UNPKG

arangojs

Version:

The official ArangoDB JavaScript driver.

1 lines 65.3 kB
{"version":3,"file":"graph.js","sourceRoot":"","sources":["../../src/graph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAEL,kBAAkB,GAGnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAQL,eAAe,GAChB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAErE;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,KAAU;IACtC,OAAO,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;AAC/C,CAAC;AAED;;GAEG;AACH,SAAS,oBAAoB,CAAC,IAAS,EAAE,IAAmC;IAC1E,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;IAChE,MAAM,MAAM,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,GAAG,EAAE,CAAC;IACnC,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC;IACvD,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC;IACvD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,SAAS,oBAAoB,CAAC,OAA8B;IAC1D,MAAM,cAAc,GAAG,EAAoB,CAAC;IAC5C,cAAc,CAAC,UAAU,GAAG,kBAAkB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACnE,cAAc,CAAC,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC;QAC/C,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,GA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AE,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,CAC9B,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,oBAAoB,CAClB,UAAqC,EACrC,iBAA0B,KAAK;QAE/B,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CACrB;YACE,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,iBAAiB,kBAAkB,CACvC,IAAI,CAAC,KAAK,CACX,SAAS,kBAAkB,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,EAAE;YAC9D,MAAM,EAAE;gBACN,cAAc;aACf;SACF,EACD,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,CAC9B,CAAC;IACJ,CAAC;CACF","sourcesContent":["/**\n * ```ts\n * import type {\n * Graph,\n * GraphVertexCollection,\n * GraphEdgeCollection,\n * } from \"arangojs/graph.js\";\n * ```\n *\n * The \"graph\" module provides graph related types and interfaces\n * for TypeScript.\n *\n * @packageDocumentation\n */\nimport {\n ArangoCollection,\n collectionToString,\n DocumentCollection,\n EdgeCollection,\n} from \"./collection.js\";\nimport { Database } from \"./database.js\";\nimport {\n Document,\n DocumentData,\n DocumentMetadata,\n DocumentSelector,\n Edge,\n EdgeData,\n Patch,\n _documentHandle,\n} from \"./documents.js\";\nimport { isArangoError } from \"./error.js\";\nimport { DOCUMENT_NOT_FOUND, GRAPH_NOT_FOUND } from \"./lib/codes.js\";\n\n/**\n * Indicates whether the given value represents a {@link graph.Graph}.\n *\n * @param graph - A value that might be a Graph.\n */\nexport function isArangoGraph(graph: any): graph is Graph {\n return Boolean(graph && graph.isArangoGraph);\n}\n\n/**\n * @internal\n */\nfunction mungeGharialResponse(body: any, prop: \"vertex\" | \"edge\" | \"removed\") {\n const { new: newDoc, old: oldDoc, [prop]: doc, ...meta } = body;\n const result = { ...meta, ...doc };\n if (typeof newDoc !== \"undefined\") result.new = newDoc;\n if (typeof oldDoc !== \"undefined\") result.old = oldDoc;\n return result;\n}\n\n/**\n * @internal\n */\nfunction coerceEdgeDefinition(options: EdgeDefinitionOptions): EdgeDefinition {\n const edgeDefinition = {} as EdgeDefinition;\n edgeDefinition.collection = collectionToString(options.collection);\n edgeDefinition.from = Array.isArray(options.from)\n ? options.from.map(collectionToString)\n : [collectionToString(options.from)];\n edgeDefinition.to = Array.isArray(options.to)\n ? options.to.map(collectionToString)\n : [collectionToString(options.to)];\n return edgeDefinition;\n}\n\n/**\n * Options for retrieving a document from a graph collection.\n */\nexport type GraphCollectionReadOptions = {\n /**\n * If set to a document revision, the document will only be returned if its\n * `_rev` property matches this value.\n *\n * See also {@link documents.DocumentMetadata}.\n */\n rev?: string;\n /**\n * If set to `true`, `null` is returned instead of an exception being thrown\n * if the document does not exist.\n *\n * Default: `false`\n */\n graceful?: boolean;\n /**\n * If set to `true`, the request will explicitly permit ArangoDB to return a\n * potentially dirty or stale result and arangojs will load balance the\n * request without distinguishing between leaders and followers.\n *\n * Default: `false`\n */\n allowDirtyRead?: boolean;\n};\n\n/**\n * Options for inserting a document into a graph collection.\n */\nexport type GraphCollectionInsertOptions = {\n /**\n * If set to `true`, data will be synchronized to disk before returning.\n *\n * Default: `false`\n */\n waitForSync?: boolean;\n /**\n * If set to `true`, the complete new document will be returned as the `new`\n * property on the result object.\n *\n * Default: `false`\n */\n returnNew?: boolean;\n};\n\n/**\n * Options for replacing a document in a graph collection.\n */\nexport type GraphCollectionReplaceOptions = {\n /**\n * If set to a document revision, the document will only be modified if its\n * `_rev` property matches this value.\n *\n * See also {@link documents.DocumentMetadata}.\n */\n rev?: string;\n /**\n * If set to `true`, data will be synchronized to disk before returning.\n *\n * Default: `false`\n */\n waitForSync?: boolean;\n /**\n * If set to `false`, properties with a value of `null` will be removed from\n * the new document.\n *\n * Default: `true`\n */\n keepNull?: boolean;\n /**\n * If set to `true`, the complete old document will be returned as the `old`\n * property on the result object.\n *\n * Default: `false`\n */\n returnOld?: boolean;\n /**\n * If set to `true`, the complete new document will be returned as the `new`\n * property on the result object.\n *\n * Default: `false`\n */\n returnNew?: boolean;\n};\n\n/**\n * Options for removing a document from a graph collection.\n */\nexport type GraphCollectionRemoveOptions = {\n /**\n * If set to a document revision, the document will only be removed if its\n * `_rev` property matches this value.\n *\n * See also {@link documents.DocumentMetadata}.\n */\n rev?: string;\n /**\n * If set to `true`, data will be synchronized to disk before returning.\n *\n * Default: `false`\n */\n waitForSync?: boolean;\n /**\n * If set to `true`, the complete old document will be returned as the `old`\n * property on the result object.\n *\n * Default: `false`\n */\n returnOld?: boolean;\n};\n\n/**\n * Definition of a relation in a {@link graph.Graph}.\n */\nexport type EdgeDefinition = {\n /**\n * Name of the collection containing the edges.\n */\n collection: string;\n /**\n * Array of names of collections containing the start vertices.\n */\n from: string[];\n /**\n * Array of names of collections containing the end vertices.\n */\n to: string[];\n};\n\n/**\n * An edge definition used to define a collection of edges in a {@link graph.Graph}.\n */\nexport type EdgeDefinitionOptions = {\n /**\n * Collection containing the edges.\n */\n collection: string | ArangoCollection;\n /**\n * Collection or collections containing the start vertices.\n */\n from: (string | ArangoCollection)[] | string | ArangoCollection;\n /**\n * Collection or collections containing the end vertices.\n */\n to: (string | ArangoCollection)[] | string | ArangoCollection;\n};\n\n/**\n * General information about a graph.\n */\nexport type GraphInfo = {\n /**\n * Key of the document internally representing this graph.\n *\n * See {@link documents.DocumentMetadata}.\n *\n * @internal\n */\n _key: string;\n /**\n * Unique identifier of the document internally representing this graph.\n *\n * See {@link documents.DocumentMetadata}.\n *\n * @internal\n */\n _id: string;\n /**\n * Revision of the document internally representing this graph.\n *\n * See {@link documents.DocumentMetadata}.\n *\n * @internal\n */\n _rev: string;\n /**\n * Name of the graph.\n */\n name: string;\n /**\n * Definitions for the relations of the graph.\n */\n edgeDefinitions: EdgeDefinition[];\n /**\n * Additional vertex collections. Documents within these collections do not\n * have edges within this graph.\n */\n orphanCollections: string[];\n\n /**\n * (Cluster only.) Number of shards that is used for every collection\n * within this graph.\n */\n numberOfShards?: number;\n /**\n * (Cluster only.) Replication factor used when initially creating\n * collections for this graph.\n */\n replicationFactor?: number;\n /**\n * (Cluster only.) Write concern for new collections in the graph.\n */\n writeConcern?: number;\n /**\n * (Enterprise Edition cluster only.) If set to `true`, the graph is a\n * SatelliteGraph.\n */\n isSatellite?: boolean;\n /**\n * (Enterprise Edition cluster only.) If set to `true`, the graph has been\n * created as a SmartGraph.\n */\n isSmart?: boolean;\n /**\n * (Enterprise Edition cluster only.) Attribute containing the shard key\n * value to use for smart sharding.\n */\n smartGraphAttribute?: string;\n /**\n * (Enterprise Edition cluster only.) If set to `true`, the graph has been\n * created as a Disjoint SmartGraph.\n */\n isDisjoint?: boolean;\n};\n\n/**\n * Option for creating a graph.\n */\nexport type CreateGraphOptions = {\n /**\n * If set to `true`, the request will wait until all modifications have been\n * synchronized to disk before returning successfully.\n *\n * Default: `false`\n */\n waitForSync?: boolean;\n /**\n * Additional vertex collections. Documents within these collections do not\n * have edges within this graph.\n */\n orphanCollections?: (string | ArangoCollection)[] | string | ArangoCollection;\n\n /**\n * (Cluster only.) Number of shards that is used for every collection\n * within this graph.\n *\n * Has no effect when `replicationFactor` is set to `\"satellite\"`.\n */\n numberOfShards?: number;\n /**\n * (Cluster only.) Replication factor used when initially creating\n * collections for this graph.\n *\n * Default: `1`\n */\n replicationFactor?: number | \"satellite\";\n /**\n * (Cluster only.) Write concern for new collections in the graph.\n *\n * Has no effect when `replicationFactor` is set to `\"satellite\"`.\n */\n writeConcern?: number;\n\n // Extra options\n /**\n * (Enterprise Edition cluster only.) If set to `true`, the graph will be\n * created as a SmartGraph.\n *\n * Default: `false`\n */\n isSmart?: boolean;\n /**\n * (Enterprise Edition cluster only.) Attribute containing the shard key\n * value to use for smart sharding.\n */\n smartGraphAttribute?: string;\n /**\n * (Enterprise Edition cluster only.) If set to `true`, the graph will be\n * created as a Disjoint SmartGraph.\n *\n * Default: `false`\n */\n isDisjoint?: boolean;\n /**\n * (Enterprise Edition cluster only.) Collections to be included in a Hybrid\n * SmartGraph.\n */\n satellites?: (string | ArangoCollection)[];\n};\n\nexport type AddVertexCollectionOptions = {\n /**\n * (Enterprise Edition cluster only.) Collections to be included in a Hybrid\n * SmartGraph.\n */\n satellites?: (string | ArangoCollection)[];\n};\n\nexport type AddEdgeDefinitionOptions = {\n /**\n * (Enterprise Edition cluster only.) Collections to be included in a Hybrid\n * SmartGraph.\n */\n satellites?: (string | ArangoCollection)[];\n};\n\nexport type ReplaceEdgeDefinitionOptions = {\n /**\n * (Enterprise Edition cluster only.) Collections to be included in a Hybrid\n * SmartGraph.\n */\n satellites?: string[];\n};\n\n/**\n * Represents a {@link collection.DocumentCollection} of vertices in a {@link graph.Graph}.\n *\n * @param T - Type to use for document data. Defaults to `any`.\n */\nexport class GraphVertexCollection<T extends Record<string, any> = any>\n implements ArangoCollection\n{\n protected _db: Database;\n protected _name: string;\n protected _graph: Graph;\n protected _collection: DocumentCollection<T>;\n\n /**\n * @internal\n */\n constructor(db: Database, name: string, graph: Graph) {\n this._db = db;\n this._collection = db.collection(name);\n this._name = this._collection.name;\n this._graph = graph;\n }\n\n /**\n * @internal\n *\n * Indicates that this object represents an ArangoDB collection.\n */\n get isArangoCollection(): true {\n return true;\n }\n\n /**\n * Name of the collection.\n */\n get name() {\n return this._name;\n }\n\n /**\n * A {@link collection.DocumentCollection} instance for this vertex collection.\n */\n get collection() {\n return this._collection;\n }\n\n /**\n * The {@link graph.Graph} instance this vertex collection is bound to.\n */\n get graph() {\n return this._graph;\n }\n\n /**\n * Checks whether a vertex matching the given key or id exists in this\n * collection.\n *\n * Throws an exception when passed a vertex or `_id` from a different\n * collection.\n *\n * @param selector - Document `_key`, `_id` or object with either of those\n * properties (e.g. a vertex from this collection).\n *\n * @example\n * ```js\n * const graph = db.graph(\"some-graph\");\n * const collection = graph.vertexCollection(\"vertices\");\n * const exists = await collection.vertexExists(\"abc123\");\n * if (!exists) {\n * console.log(\"Vertex does not exist\");\n * }\n * ```\n */\n async vertexExists(selector: DocumentSelector): Promise<boolean> {\n try {\n return await this._db.request(\n {\n method: \"HEAD\",\n path: `/_api/gharial/${encodeURIComponent(\n this.graph.name\n )}/vertex/${encodeURI(_documentHandle(selector, this._name))}`,\n },\n () => true\n );\n } catch (err: any) {\n if (err.code === 404) {\n return false;\n }\n throw err;\n }\n }\n\n /**\n * Retrieves the vertex matching the given key or id.\n *\n * Throws an exception when passed a vertex or `_id` from a different\n * collection.\n *\n * @param selector - Document `_key`, `_id` or object with either of those\n * properties (e.g. a vertex from this collection).\n * @param options - Options for retrieving the vertex.\n *\n * @example\n * ```js\n * const graph = db.graph(\"some-graph\");\n * const collection = graph.vertexCollection(\"vertices\");\n * try {\n * const vertex = await collection.vertex(\"abc123\");\n * console.log(vertex);\n * } catch (e: any) {\n * console.error(\"Could not find vertex\");\n * }\n * ```\n *\n * @example\n * ```js\n * const graph = db.graph(\"some-graph\");\n * const collection = graph.vertexCollection(\"vertices\");\n * const vertex = await collection.vertex(\"abc123\", { graceful: true });\n * if (vertex) {\n * console.log(vertex);\n * } else {\n * console.error(\"Could not find vertex\");\n * }\n * ```\n */\n async vertex(\n selector: DocumentSelector,\n options?: GraphCollectionReadOptions\n ): Promise<Document<T>>;\n /**\n * Retrieves the vertex matching the given key or id.\n *\n * Throws an exception when passed a vertex or `_id` from a different\n * collection.\n *\n * @param selector - Document `_key`, `_id` or object with either of those\n * properties (e.g. a vertex from this collection).\n * @param graceful - If set to `true`, `null` is returned instead of an\n * exception being thrown if the vertex does not exist.\n *\n * @example\n * ```js\n * const graph = db.graph(\"some-graph\");\n * const collection = graph.vertexCollection(\"vertices\");\n * try {\n * const vertex = await collection.vertex(\"abc123\", false);\n * console.log(vertex);\n * } catch (e: any) {\n * console.error(\"Could not find vertex\");\n * }\n * ```\n *\n * @example\n * ```js\n * const graph = db.graph(\"some-graph\");\n * const collection = graph.vertexCollection(\"vertices\");\n * const vertex = await collection.vertex(\"abc123\", true);\n * if (vertex) {\n * console.log(vertex);\n * } else {\n * console.error(\"Could not find vertex\");\n * }\n * ```\n */\n async vertex(\n selector: DocumentSelector,\n graceful: boolean\n ): Promise<Document<T>>;\n async vertex(\n selector: DocumentSelector,\n options: boolean | GraphCollectionReadOptions = {}\n ): Promise<Document<T> | null> {\n if (typeof options === \"boolean\") {\n options = { graceful: options };\n }\n const {\n allowDirtyRead = undefined,\n graceful = false,\n rev,\n ...search\n } = options;\n const headers: Record<string, string> = {};\n if (rev) headers[\"if-match\"] = rev;\n const result = this._db.request(\n {\n path: `/_api/gharial/${encodeURIComponent(\n this.graph.name\n )}/vertex/${encodeURI(_documentHandle(selector, this._name))}`,\n headers,\n search,\n allowDirtyRead,\n },\n (res) => res.parsedBody.vertex\n );\n if (!graceful) return result;\n try {\n return await result;\n } catch (err: any) {\n if (isArangoError(err) && err.errorNum === DOCUMENT_NOT_FOUND) {\n return null;\n }\n throw err;\n }\n }\n\n /**\n * Inserts a new vertex with the given `data` into the collection.\n *\n * @param data - The contents of the new vertex.\n * @param options - Options for inserting the vertex.\n *\n * @example\n * ```js\n * const graph = db.graph(\"some-graph\");\n * const collection = graph.vertexCollection(\"friends\");\n * const result = await collection.save(\n * { _key: \"a\", color: \"blue\", count: 1 },\n * { returnNew: true }\n * );\n * console.log(result.new.color, result.new.count); // \"blue\" 1\n * ```\n */\n save(\n data: DocumentData<T>,\n options?: GraphCollectionInsertOptions\n ): Promise<DocumentMetadata & { new?: Document<T> }>;\n save(data: DocumentData<T>, options?: GraphCollectionInsertOptions) {\n return this._db.request(\n {\n method: \"POST\",\n path: `/_api/gharial/${encodeURIComponent(\n this.graph.name\n )}/vertex/${encodeURIComponent(this._name)}`,\n body: data,\n search: options,\n },\n (res) => mungeGharialResponse(res.parsedBody, \"vertex\")\n );\n }\n\n /**\n * Replaces an existing vertex in the collection.\n *\n * Throws an exception when passed a vertex or `_id` from a different\n * collection.\n *\n * @param selector - Document `_key`, `_id` or object with either of those\n * properties (e.g. a vertex from this collection).\n * @param newData - The contents of the new vertex.\n * @param options - Options for replacing the vertex.\n *\n * @example\n * ```js\n * const graph = db.graph(\"some-graph\");\n * const collection = graph.collection(\"vertices\");\n * await collection.save({ _key: \"a\", color: \"blue\", count: 1 });\n * const result = await collection.replace(\n * \"a\",\n * { color: \"red\" },\n * { returnNew: true }\n * );\n * console.log(result.new.color, result.new.count); // \"red\" undefined\n * ```\n */\n replace(\n selector: DocumentSelector,\n newValue: DocumentData<T>,\n options?: GraphCollectionReplaceOptions\n ): Promise<DocumentMetadata & { new?: Document<T>; old?: Document<T> }>;\n replace(\n selector: DocumentSelector,\n newValue: DocumentData<T>,\n options: GraphCollectionReplaceOptions = {}\n ) {\n if (typeof options === \"string\") {\n options = { rev: options };\n }\n const { rev, ...search } = options;\n const headers: Record<string, string> = {};\n if (rev) headers[\"if-match\"] = rev;\n return this._db.request(\n {\n method: \"PUT\",\n path: `/_api/gharial/${encodeURIComponent(\n this.graph.name\n )}/vertex/${encodeURI(_documentHandle(selector, this._name))}`,\n body: newValue,\n search,\n headers,\n },\n (res) => mungeGharialResponse(res.parsedBody, \"vertex\")\n );\n }\n\n /**\n * Updates an existing vertex in the collection.\n *\n * Throws an exception when passed a vertex or `_id` from a different\n * collection.\n *\n * @param selector - Document `_key`, `_id` or object with either of those\n * properties (e.g. a vertex from this collection).\n * @param newData - The data for updating the vertex.\n * @param options - Options for updating the vertex.\n *\n * @example\n * ```js\n * const graph = db.graph(\"some-graph\");\n * const collection = graph.collection(\"vertices\");\n * await collection.save({ _key: \"a\", color: \"blue\", count: 1 });\n * const result = await collection.update(\n * \"a\",\n * { count: 2 },\n * { returnNew: true }\n * );\n * console.log(result.new.color, result.new.count); // \"blue\" 2\n * ```\n */\n update(\n selector: DocumentSelector,\n newValue: Patch<DocumentData<T>>,\n options?: GraphCollectionReplaceOptions\n ): Promise<DocumentMetadata & { new?: Document<T>; old?: Document<T> }>;\n update(\n selector: DocumentSelector,\n newValue: Patch<DocumentData<T>>,\n options: GraphCollectionReplaceOptions = {}\n ) {\n if (typeof options === \"string\") {\n options = { rev: options };\n }\n const headers: Record<string, string> = {};\n const { rev, ...search } = options;\n if (rev) headers[\"if-match\"] = rev;\n return this._db.request(\n {\n method: \"PATCH\",\n path: `/_api/gharial/${encodeURIComponent(\n this.graph.name\n )}/vertex/${encodeURI(_documentHandle(selector, this._name))}`,\n body: newValue,\n search,\n headers,\n },\n (res) => mungeGharialResponse(res.parsedBody, \"vertex\")\n );\n }\n\n /**\n * Removes an existing vertex from the collection.\n *\n * Throws an exception when passed a vertex or `_id` from a different\n * collection.\n *\n * @param selector - Document `_key`, `_id` or object with either of those\n * properties (e.g. a vertex from this collection).\n * @param options - Options for removing the vertex.\n *\n * @example\n * ```js\n * const graph = db.graph(\"some-graph\");\n * const collection = graph.vertexCollection(\"vertices\");\n * await collection.remove(\"abc123\");\n * // document with key \"abc123\" deleted\n * ```\n *\n * @example\n * ```js\n * const graph = db.graph(\"some-graph\");\n * const collection = graph.vertexCollection(\"vertices\");\n * const doc = await collection.vertex(\"abc123\");\n * await collection.remove(doc);\n * // document with key \"abc123\" deleted\n * ```\n */\n remove(\n selector: DocumentSelector,\n options?: GraphCollectionRemoveOptions\n ): Promise<DocumentMetadata & { old?: Document<T> }>;\n remove(\n selector: DocumentSelector,\n options: GraphCollectionRemoveOptions = {}\n ) {\n if (typeof options === \"string\") {\n options = { rev: options };\n }\n const headers: Record<string, string> = {};\n const { rev, ...search } = options;\n if (rev) headers[\"if-match\"] = rev;\n return this._db.request(\n {\n method: \"DELETE\",\n path: `/_api/gharial/${encodeURIComponent(\n this.graph.name\n )}/vertex/${encodeURI(_documentHandle(selector, this._name))}`,\n search,\n headers,\n },\n (res) => mungeGharialResponse(res.parsedBody, \"removed\")\n );\n }\n}\n\n/**\n * Represents a {@link collection.EdgeCollection} of edges in a {@link graph.Graph}.\n *\n * @param T - Type to use for document data. Defaults to `any`.\n */\nexport class GraphEdgeCollection<T extends Record<string, any> = any>\n implements ArangoCollection\n{\n protected _db: Database;\n protected _name: string;\n protected _graph: Graph;\n protected _collection: EdgeCollection<T>;\n\n /**\n * @internal\n */\n constructor(db: Database, name: string, graph: Graph) {\n this._db = db;\n this._collection = db.collection(name);\n this._name = this._collection.name;\n this._graph = graph;\n }\n\n /**\n * @internal\n *\n * Indicates that this object represents an ArangoDB collection.\n */\n get isArangoCollection(): true {\n return true;\n }\n\n /**\n * Name of the collection.\n */\n get name() {\n return this._name;\n }\n\n /**\n * A {@link collection.EdgeCollection} instance for this edge collection.\n */\n get collection() {\n return this._collection;\n }\n\n /**\n * The {@link graph.Graph} instance this edge collection is bound to.\n */\n get graph() {\n return this._graph;\n }\n\n /**\n * Checks whether a edge matching the given key or id exists in this\n * collection.\n *\n * Throws an exception when passed a edge or `_id` from a different\n * collection.\n *\n * @param selector - Document `_key`, `_id` or object with either of those\n * properties (e.g. a edge from this collection).\n *\n * @example\n * ```js\n * const graph = db.graph(\"some-graph\");\n * const collection = graph.edgeCollection(\"friends\")\n * const exists = await collection.edgeExists(\"abc123\");\n * if (!exists) {\n * console.log(\"Edge does not exist\");\n * }\n * ```\n */\n async edgeExists(selector: DocumentSelector): Promise<boolean> {\n try {\n return await this._db.request(\n {\n method: \"HEAD\",\n path: `/_api/gharial/${encodeURIComponent(\n this.graph.name\n )}/edge/${encodeURI(_documentHandle(selector, this._name))}`,\n },\n () => true\n );\n } catch (err: any) {\n if (err.code === 404) {\n return false;\n }\n throw err;\n }\n }\n\n /**\n * Retrieves the edge matching the given key or id.\n *\n * Throws an exception when passed a edge or `_id` from a different\n * collection, or if the edge does not exist.\n *\n * @param selector - Document `_key`, `_id` or object with either of those\n * properties (e.g. a edge from this collection).\n * @param options - Options for retrieving the edge.\n *\n * @example\n * ```js\n * const graph = db.graph(\"some-graph\");\n * const collection = graph.edgeCollection(\"friends\")\n * try {\n * const edge = await collection.edge(\"abc123\");\n * console.log(edge);\n * } catch (e: any) {\n * console.error(\"Could not find edge\");\n * }\n * ```\n *\n * @example\n * ```js\n * const graph = db.graph(\"some-graph\");\n * const collection = graph.edgeCollection(\"friends\")\n * const edge = await collection.edge(\"abc123\", { graceful: true });\n * if (edge) {\n * console.log(edge);\n * } else {\n * console.error(\"Edge does not exist\");\n * }\n * ```\n */\n async edge(\n selector: DocumentSelector,\n options?: GraphCollectionReadOptions\n ): Promise<Edge<T>>;\n /**\n * Retrieves the edge matching the given key or id.\n *\n * Throws an exception when passed a edge or `_id` from a different\n * collection, or if the edge does not exist.\n *\n * @param selector - Document `_key`, `_id` or object with either of those\n * properties (e.g. a edge from this collection).\n * @param graceful - If set to `true`, `null` is returned instead of an\n * exception being thrown if the edge does not exist.\n *\n * @example\n * ```js\n * const graph = db.graph(\"some-graph\");\n * const collection = graph.edgeCollection(\"friends\")\n * try {\n * const edge = await collection.edge(\"abc123\", false);\n * console.log(edge);\n * } catch (e: any) {\n * console.error(\"Could not find edge\");\n * }\n * ```\n *\n * @example\n * ```js\n * const graph = db.graph(\"some-graph\");\n * const collection = graph.edgeCollection(\"friends\")\n * const edge = await collection.edge(\"abc123\", true);\n * if (edge) {\n * console.log(edge);\n * } else {\n * console.error(\"Edge does not exist\");\n * }\n * ```\n */\n async edge(selector: DocumentSelector, graceful: boolean): Promise<Edge<T>>;\n async edge(\n selector: DocumentSelector,\n options: boolean | GraphCollectionReadOptions = {}\n ): Promise<Edge<T> | null> {\n if (typeof options === \"boolean\") {\n options = { graceful: options };\n }\n const {\n allowDirtyRead = undefined,\n graceful = false,\n rev,\n ...search\n } = options;\n const headers: Record<string, string> = {};\n if (rev) headers[\"if-match\"] = rev;\n const result = this._db.request(\n {\n path: `/_api/gharial/${encodeURIComponent(\n this.graph.name\n )}/edge/${encodeURI(_documentHandle(selector, this._name))}`,\n search,\n allowDirtyRead,\n },\n (res) => res.parsedBody.edge\n );\n if (!graceful) return result;\n try {\n return await result;\n } catch (err: any) {\n if (isArangoError(err) && err.errorNum === DOCUMENT_NOT_FOUND) {\n return null;\n }\n throw err;\n }\n }\n\n /**\n * Inserts a new edge with the given `data` into the collection.\n *\n * @param data - The contents of the new edge.\n * @param options - Options for inserting the edge.\n *\n * @example\n * ```js\n * const db = new Database();\n * const collection = db.collection(\"friends\");\n * const result = await collection.save(\n * { _from: \"users/rana\", _to: \"users/mudasir\", active: false },\n * { returnNew: true }\n * );\n * ```\n */\n save(\n data: EdgeData<T>,\n options?: GraphCollectionInsertOptions\n ): Promise<DocumentMetadata & { new?: Edge<T> }>;\n save(data: EdgeData<T>, options?: GraphCollectionInsertOptions) {\n return this._db.request(\n {\n method: \"POST\",\n path: `/_api/gharial/${encodeURIComponent(\n this.graph.name\n )}/edge/${encodeURIComponent(this._name)}`,\n body: data,\n search: options,\n },\n (res) => mungeGharialResponse(res.parsedBody, \"edge\")\n );\n }\n\n /**\n * Replaces an existing edge in the collection.\n *\n * Throws an exception when passed a edge or `_id` from a different\n * collection.\n *\n * @param selector - Document `_key`, `_id` or object with either of those\n * properties (e.g. a edge from this collection).\n * @param newData - The contents of the new edge.\n * @param options - Options for replacing the edge.\n *\n * @example\n * ```js\n * const db = new Database();\n * const collection = db.collection(\"friends\");\n * await collection.save(\n * {\n * _key: \"musadir\",\n * _from: \"users/rana\",\n * _to: \"users/mudasir\",\n * active: true,\n * best: true\n * }\n * );\n * const result = await collection.replace(\n * \"musadir\",\n * { active: false },\n * { returnNew: true }\n * );\n * console.log(result.new.active, result.new.best); // false undefined\n * ```\n */\n replace(\n selector: DocumentSelector,\n newValue: EdgeData<T>,\n options?: GraphCollectionReplaceOptions\n ): Promise<DocumentMetadata & { new?: Edge<T>; old?: Edge<T> }>;\n replace(\n selector: DocumentSelector,\n newValue: EdgeData<T>,\n options: GraphCollectionReplaceOptions = {}\n ) {\n if (typeof options === \"string\") {\n options = { rev: options };\n }\n const { rev, ...search } = options;\n const headers: Record<string, string> = {};\n if (rev) headers[\"if-match\"] = rev;\n return this._db.request(\n {\n method: \"PUT\",\n path: `/_api/gharial/${encodeURIComponent(\n this.graph.name\n )}/edge/${encodeURI(_documentHandle(selector, this._name))}`,\n body: newValue,\n search,\n headers,\n },\n (res) => mungeGharialResponse(res.parsedBody, \"edge\")\n );\n }\n\n /**\n * Updates an existing edge in the collection.\n *\n * Throws an exception when passed a edge or `_id` from a different\n * collection.\n *\n * @param selector - Document `_key`, `_id` or object with either of those\n * properties (e.g. a edge from this collection).\n * @param newData - The data for updating the edge.\n * @param options - Options for updating the edge.\n *\n * @example\n * ```js\n * const db = new Database();\n * const collection = db.collection(\"friends\");\n * await collection.save(\n * {\n * _key: \"musadir\",\n * _from: \"users/rana\",\n * _to: \"users/mudasir\",\n * active: true,\n * best: true\n * }\n * );\n * const result = await collection.update(\n * \"musadir\",\n * { active: false },\n * { returnNew: true }\n * );\n * console.log(result.new.active, result.new.best); // false true\n * ```\n */\n update(\n selector: DocumentSelector,\n newValue: Patch<EdgeData<T>>,\n options?: GraphCollectionReplaceOptions\n ): Promise<DocumentMetadata & { new?: Edge<T>; old?: Edge<T> }>;\n update(\n selector: DocumentSelector,\n newValue: Patch<EdgeData<T>>,\n options: GraphCollectionReplaceOptions = {}\n ) {\n if (typeof options === \"string\") {\n options = { rev: options };\n }\n const { rev, ...search } = options;\n const headers: Record<string, string> = {};\n if (rev) headers[\"if-match\"] = rev;\n return this._db.request(\n {\n method: \"PATCH\",\n path: `/_api/gharial/${encodeURIComponent(\n this.graph.name\n )}/edge/${encodeURI(_documentHandle(selector, this._name))}`,\n body: newValue,\n search,\n headers,\n },\n (res) => mungeGharialResponse(res.parsedBody, \"edge\")\n );\n }\n\n /**\n * Removes an existing edge from the collection.\n *\n * Throws an exception when passed a edge or `_id` from a different\n * collection.\n *\n * @param selector - Document `_key`, `_id` or object with either of those\n * properties (e.g. a edge from this collection).\n * @param options - Options for removing the edge.\n *\n * @example\n * ```js\n * const db = new Database();\n * const collection = db.collection(\"friends\");\n * const doc = await collection.edge(\"musadir\");\n * await collection.remove(doc);\n * // edge with key \"musadir\" deleted\n * ```\n */\n remove(\n selector: DocumentSelector,\n options?: GraphCollectionRemoveOptions\n ): Promise<DocumentMetadata & { old?: Edge<T> }>;\n remove(\n selector: DocumentSelector,\n options: GraphCollectionRemoveOptions = {}\n ) {\n if (typeof options === \"string\") {\n options = { rev: options };\n }\n const { rev, ...search } = options;\n const headers: Record<string, string> = {};\n if (rev) headers[\"if-match\"] = rev;\n return this._db.request(\n {\n method: \"DELETE\",\n path: `/_api/gharial/${encodeURIComponent(\n this.graph.name\n )}/edge/${encodeURI(_documentHandle(selector, this._name))}`,\n search,\n headers,\n },\n (res) => mungeGharialResponse(res.parsedBody, \"removed\")\n );\n }\n}\n\n/**\n * Represents a graph in a {@link database.Database}.\n */\nexport class Graph {\n protected _name: string;\n\n protected _db: Database;\n\n /**\n * @internal\n */\n constructor(db: Database, name: string) {\n this._name = name;\n this._db = db;\n }\n\n /**\n * @internal\n *\n * Indicates that this object represents an ArangoDB Graph.\n */\n get isArangoGraph(): true {\n return true;\n }\n\n /**\n * Name of the graph.\n */\n get name() {\n return this._name;\n }\n\n /**\n * Checks whether the graph exists.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * const result = await graph.exists();\n * // result indicates whether the graph exists\n * ```\n */\n async exists(): Promise<boolean> {\n try {\n await this.get();\n return true;\n } catch (err: any) {\n if (isArangoError(err) && err.errorNum === GRAPH_NOT_FOUND) {\n return false;\n }\n throw err;\n }\n }\n\n /**\n * Retrieves general information about the graph.\n *\n * @example\n *