/** * Copyright (c) "Neo4j" * Neo4j Sweden AB [https://neo4j.com] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import Integer from './integer'; import { Rules, GenericConstructor } from './mapping.highlevel'; type StandardDate = Date; /** * @typedef {number | Integer | bigint} NumberOrInteger */ type NumberOrInteger = number | Integer | bigint; interface Properties { [key: string]: any; } /** * Class for Node Type. */ declare class Node { identity: T; labels: Label[]; properties: P; elementId: string; /** * @constructor * @protected * @param {NumberOrInteger} identity - Unique identity * @param {Array} labels - Array for all labels * @param {Properties} properties - Map with node properties * @param {string} elementId - Node element identifier */ constructor(identity: T, labels: Label[], properties: P, elementId?: string); /** * Hydrates an object of a given type with the properties of the node * * @param {GenericConstructor | Rules} constructorOrRules Constructor for the desired type which must be callable with all arguments undefined or {@link Rules} for the hydration * @param {Rules} [rules] {@link Rules} for the hydration * @returns {T} */ as(rules: Rules): T; as(genericConstructor: GenericConstructor): T; as(genericConstructor: GenericConstructor, rules?: Rules): T; /** * @ignore */ toString(): string; } /** * Test if given object is an instance of {@link Node} class. * @param {Object} obj the object to test. * @return {boolean} `true` if given object is a {@link Node}, `false` otherwise. */ declare function isNode(obj: unknown): obj is Node; /** * Class for Relationship Type. */ declare class Relationship { identity: T; start: T; end: T; type: Type; properties: P; elementId: string; startNodeElementId: string; endNodeElementId: string; /** * @constructor * @protected * @param {NumberOrInteger} identity - Unique identity * @param {NumberOrInteger} start - Identity of start Node * @param {NumberOrInteger} end - Identity of end Node * @param {string} type - Relationship type * @param {Properties} properties - Map with relationship properties * @param {string} elementId - Relationship element identifier * @param {string} startNodeElementId - Start Node element identifier * @param {string} endNodeElementId - End Node element identifier */ constructor(identity: T, start: T, end: T, type: Type, properties: P, elementId?: string, startNodeElementId?: string, endNodeElementId?: string); /** * Hydrates an object of a given type with the properties of the relationship * * @param {GenericConstructor | Rules} constructorOrRules Constructor for the desired type which must be callable with all arguments undefined or {@link Rules} for the hydration * @param {Rules} [rules] {@link Rules} for the hydration * @returns {T} */ as(rules: Rules): T; as(genericConstructor: GenericConstructor): T; as(genericConstructor: GenericConstructor, rules?: Rules): T; /** * @ignore */ toString(): string; } /** * Test if given object is an instance of {@link Relationship} class. * @param {Object} obj the object to test. * @return {boolean} `true` if given object is a {@link Relationship}, `false` otherwise. */ declare function isRelationship(obj: unknown): obj is Relationship; /** * Class for UnboundRelationship Type. * @access private */ declare class UnboundRelationship { identity: T; type: Type; properties: P; elementId: string; /** * @constructor * @protected * @param {NumberOrInteger} identity - Unique identity * @param {string} type - Relationship type * @param {Properties} properties - Map with relationship properties * @param {string} elementId - Relationship element identifier */ constructor(identity: T, type: Type, properties: any, elementId?: string); /** * Bind relationship * * @protected * @deprecated use {@link UnboundRelationship#bindTo} instead * @param {Integer} start - Identity of start node * @param {Integer} end - Identity of end node * @return {Relationship} - Created relationship */ bind(start: T, end: T): Relationship; /** * Bind relationship * * @protected * @param {Node} start - Start Node * @param {Node} end - End Node * @return {Relationship} - Created relationship */ bindTo(start: Node, end: Node): Relationship; /** * Hydrates an object of a given type with the properties of the relationship * * @param {GenericConstructor | Rules} constructorOrRules Constructor for the desired type which must be callable with all arguments undefined or {@link Rules} for the hydration * @param {Rules} [rules] {@link Rules} for the hydration * @returns {T} */ as(rules: Rules): T; as(genericConstructor: GenericConstructor): T; as(genericConstructor: GenericConstructor, rules?: Rules): T; /** * @ignore */ toString(): string; } /** * Test if given object is an instance of {@link UnboundRelationship} class. * @param {Object} obj the object to test. * @return {boolean} `true` if given object is a {@link UnboundRelationship}, `false` otherwise. * @access private */ declare function isUnboundRelationship(obj: unknown): obj is UnboundRelationship; /** * Class for PathSegment Type. */ declare class PathSegment { start: Node; relationship: Relationship; end: Node; /** * @constructor * @protected * @param {Node} start - start node * @param {Relationship} rel - relationship that connects start and end node * @param {Node} end - end node */ constructor(start: Node, rel: Relationship, end: Node); } /** * Test if given object is an instance of {@link PathSegment} class. * @param {Object} obj the object to test. * @return {boolean} `true` if given object is a {@link PathSegment}, `false` otherwise. */ declare function isPathSegment(obj: unknown): obj is PathSegment; /** * Class for Path Type. */ declare class Path { start: Node; end: Node; segments: Array>; length: number; /** * @constructor * @protected * @param {Node} start - start node * @param {Node} end - end node * @param {Array} segments - Array of Segments */ constructor(start: Node, end: Node, segments: Array>); } /** * Test if given object is an instance of {@link Path} class. * @param {Object} obj the object to test. * @return {boolean} `true` if given object is a {@link Path}, `false` otherwise. */ declare function isPath(obj: unknown): obj is Path; export { Node, isNode, Relationship, isRelationship, UnboundRelationship, isUnboundRelationship, Path, isPath, PathSegment, isPathSegment }; export type { StandardDate, NumberOrInteger };