arangojs 7.8.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +264 -3
- package/CONTRIBUTING.md +1 -1
- package/MIGRATING.md +126 -2
- package/README.md +7 -13
- package/analyzer.d.ts +531 -253
- package/analyzer.d.ts.map +1 -1
- package/analyzer.js +9 -8
- package/analyzer.js.map +1 -1
- package/aql.d.ts +122 -139
- package/aql.d.ts.map +1 -1
- package/aql.js +146 -148
- package/aql.js.map +1 -1
- package/collection.d.ts +311 -310
- package/collection.d.ts.map +1 -1
- package/collection.js +163 -96
- package/collection.js.map +1 -1
- package/connection.d.ts +65 -52
- package/connection.d.ts.map +1 -1
- package/connection.js +142 -140
- package/connection.js.map +1 -1
- package/cursor.d.ts +108 -26
- package/cursor.d.ts.map +1 -1
- package/cursor.js +24 -23
- package/cursor.js.map +1 -1
- package/database.d.ts +298 -330
- package/database.d.ts.map +1 -1
- package/database.js +178 -252
- package/database.js.map +1 -1
- package/documents.d.ts +3 -4
- package/documents.d.ts.map +1 -1
- package/documents.js +0 -1
- package/documents.js.map +1 -1
- package/error.d.ts +3 -6
- package/error.d.ts.map +1 -1
- package/error.js +5 -7
- package/error.js.map +1 -1
- package/foxx-manifest.d.ts +7 -8
- package/foxx-manifest.d.ts.map +1 -1
- package/foxx-manifest.js +1 -1
- package/foxx-manifest.js.map +1 -1
- package/graph.d.ts +38 -56
- package/graph.d.ts.map +1 -1
- package/graph.js +59 -63
- package/graph.js.map +1 -1
- package/index.d.ts +6 -8
- package/index.d.ts.map +1 -1
- package/index.js +1 -6
- package/index.js.map +1 -1
- package/indexes.d.ts +348 -127
- package/indexes.d.ts.map +1 -1
- package/indexes.js +1 -3
- package/indexes.js.map +1 -1
- package/lib/blob.d.ts +0 -2
- package/lib/blob.d.ts.map +1 -1
- package/lib/blob.js +0 -1
- package/lib/blob.js.map +1 -1
- package/lib/btoa.d.ts +1 -3
- package/lib/btoa.d.ts.map +1 -1
- package/lib/btoa.js +3 -5
- package/lib/btoa.js.map +1 -1
- package/lib/btoa.web.d.ts +1 -3
- package/lib/btoa.web.d.ts.map +1 -1
- package/lib/btoa.web.js +4 -6
- package/lib/btoa.web.js.map +1 -1
- package/lib/codes.d.ts +2 -2
- package/lib/codes.d.ts.map +1 -1
- package/lib/codes.js +3 -3
- package/lib/codes.js.map +1 -1
- package/lib/errback.d.ts +0 -2
- package/lib/errback.d.ts.map +1 -1
- package/lib/errback.js.map +1 -1
- package/lib/joinPath.d.ts +0 -2
- package/lib/joinPath.d.ts.map +1 -1
- package/lib/joinPath.js +0 -2
- package/lib/joinPath.js.map +1 -1
- package/lib/joinPath.web.d.ts +1 -3
- package/lib/joinPath.web.d.ts.map +1 -1
- package/lib/joinPath.web.js +7 -4
- package/lib/joinPath.web.js.map +1 -1
- package/lib/multipart.d.ts +0 -4
- package/lib/multipart.d.ts.map +1 -1
- package/lib/multipart.js +16 -37
- package/lib/multipart.js.map +1 -1
- package/lib/multipart.web.d.ts +0 -2
- package/lib/multipart.web.d.ts.map +1 -1
- package/lib/multipart.web.js +0 -2
- package/lib/multipart.web.js.map +1 -1
- package/lib/normalizeUrl.d.ts +0 -2
- package/lib/normalizeUrl.d.ts.map +1 -1
- package/lib/normalizeUrl.js +0 -2
- package/lib/normalizeUrl.js.map +1 -1
- package/lib/omit.d.ts +1 -3
- package/lib/omit.d.ts.map +1 -1
- package/lib/omit.js +1 -2
- package/lib/omit.js.map +1 -1
- package/lib/querystringify.d.ts +4 -0
- package/lib/querystringify.d.ts.map +1 -0
- package/lib/querystringify.js +20 -0
- package/lib/querystringify.js.map +1 -0
- package/lib/querystringify.web.d.ts +2 -0
- package/lib/querystringify.web.d.ts.map +1 -0
- package/lib/querystringify.web.js +30 -0
- package/lib/querystringify.web.js.map +1 -0
- package/lib/request.d.ts +0 -1
- package/lib/request.d.ts.map +1 -1
- package/lib/request.js +6 -3
- package/lib/request.js.map +1 -1
- package/lib/request.node.d.ts +2 -8
- package/lib/request.node.d.ts.map +1 -1
- package/lib/request.node.js +16 -7
- package/lib/request.node.js.map +1 -1
- package/lib/request.web.d.ts +2 -3
- package/lib/request.web.d.ts.map +1 -1
- package/lib/request.web.js +26 -29
- package/lib/request.web.js.map +1 -1
- package/lib/xhr.d.ts +1 -3
- package/lib/xhr.d.ts.map +1 -1
- package/lib/xhr.js +0 -2
- package/lib/xhr.js.map +1 -1
- package/package.json +5 -6
- package/route.d.ts +1 -2
- package/route.d.ts.map +1 -1
- package/route.js +1 -2
- package/route.js.map +1 -1
- package/transaction.d.ts +31 -6
- package/transaction.d.ts.map +1 -1
- package/transaction.js +13 -6
- package/transaction.js.map +1 -1
- package/view.d.ts +237 -181
- package/view.d.ts.map +1 -1
- package/view.js +17 -25
- package/view.js.map +1 -1
- package/web.js +1 -1
- package/web.js.map +1 -1
- package/lib/error.d.ts +0 -18
- package/lib/error.d.ts.map +0 -1
- package/lib/error.js +0 -18
- package/lib/error.js.map +0 -1
package/graph.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph.js","sourceRoot":"","sources":["../src/graph.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;GAaG;AACH,6CAMsB;AAGtB,2CASqB;AACrB,mCAAwC;AACxC,uCAAkE;AAElE;;;;GAIG;AACH,SAAgB,aAAa,CAAC,KAAU;IACtC,OAAO,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;AAC/C,CAAC;AAFD,sCAEC;AAED;;;GAGG;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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,SAAS,kBAAkB,CAAC,+BAAkB,CAAC,UAAU,CAAC,CAAC,EAAE;YAC9D,IAAI,EAAE;gBACJ,GAAG,oBAAoB,CAAC,cAAc,CAAC;gBACvC,OAAO,EAAE,EAAE,GAAG,IAAI,EAAE,UAAU,EAAE,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,GAAG,CAAC,+BAAkB,CAAC,EAAE;aACtE;SACF,EACD,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CACxB,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,+BAAkB,CAAC,UAAU,CAAC,CAAC,EAAE;YAC9D,EAAE,EAAE;gBACF,cAAc;aACf;SACF,EACD,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CACxB,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,SAAS,CAAC,WAAmB,EAAE,OAA0B;QACvD,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CACrB;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,iBAAiB;YACvB,IAAI,EAAE;gBACJ,GAAG,OAAO;gBACV,WAAW;gBACX,SAAS,EAAE,IAAI,CAAC,KAAK;aACtB;SACF,EACD,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CACzB,CAAC;IACJ,CAAC;CACF;AApmBD,sBAomBC","sourcesContent":["/**\n * ```ts\n * import type {\n * Graph,\n * GraphVertexCollection,\n * GraphEdgeCollection,\n * } from \"arangojs/graph\";\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 TraversalOptions,\n} from \"./collection\";\nimport { Headers } from \"./connection\";\nimport { Database } from \"./database\";\nimport {\n Document,\n DocumentData,\n DocumentMetadata,\n DocumentSelector,\n Edge,\n EdgeData,\n Patch,\n _documentHandle,\n} from \"./documents\";\nimport { isArangoError } from \"./error\";\nimport { DOCUMENT_NOT_FOUND, GRAPH_NOT_FOUND } from \"./lib/codes\";\n\n/**\n * Indicates whether the given value represents a {@link 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 * @hidden\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 * @hidden\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 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 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 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}.\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}.\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 DocumentMetadata}.\n *\n * @internal\n */\n _key: string;\n /**\n * Unique identifier of the document internally representing this graph.\n *\n * See {@link DocumentMetadata}.\n *\n * @internal\n */\n _id: string;\n /**\n * Revision of the document internally representing this graph.\n *\n * See {@link 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 * (Cluster only.) Write concern for new collections in the graph.\n *\n * @deprecated Renamed to `writeConcern` in ArangoDB 3.6.\n */\n minReplicationFactor?: 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 GraphCreateOptions = {\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 * (Cluster only.) Write concern for new collections in the graph.\n *\n * Has no effect when `replicationFactor` is set to `\"satellite\"`.\n *\n * @deprecated Renamed to `writeConcern` in ArangoDB 3.6.\n */\n minReplicationFactor?: 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 * **Note**: `isSmart` must be set to `true`.\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 DocumentCollection} of vertices in a {@link 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 * @hidden\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 DocumentCollection} instance for this vertex collection.\n */\n get collection() {\n return this._collection;\n }\n\n /**\n * The {@link 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) {\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) {\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) {\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 ...qs\n } = options;\n const headers: Headers = {};\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 qs,\n allowDirtyRead,\n },\n (res) => res.body.vertex\n );\n if (!graceful) return result;\n try {\n return await result;\n } catch (err) {\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 qs: options,\n },\n (res) => mungeGharialResponse(res.body, \"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, ...qs } = options;\n const headers: Headers = {};\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 qs,\n headers,\n },\n (res) => mungeGharialResponse(res.body, \"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: Headers = {};\n const { rev, ...qs } = 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 qs,\n headers,\n },\n (res) => mungeGharialResponse(res.body, \"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: Headers = {};\n const { rev, ...qs } = 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 qs,\n headers,\n },\n (res) => mungeGharialResponse(res.body, \"removed\")\n );\n }\n}\n\n/**\n * Represents a {@link EdgeCollection} of edges in a {@link 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 * @hidden\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 EdgeCollection} instance for this edge collection.\n */\n get collection() {\n return this._collection;\n }\n\n /**\n * The {@link 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) {\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) {\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) {\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 ...qs\n } = options;\n const headers: Headers = {};\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 qs,\n allowDirtyRead,\n },\n (res) => res.body.edge\n );\n if (!graceful) return result;\n try {\n return await result;\n } catch (err) {\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 qs: options,\n },\n (res) => mungeGharialResponse(res.body, \"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, ...qs } = options;\n const headers: Headers = {};\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 qs,\n headers,\n },\n (res) => mungeGharialResponse(res.body, \"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, ...qs } = options;\n const headers: Headers = {};\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 qs,\n headers,\n },\n (res) => mungeGharialResponse(res.body, \"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, ...qs } = options;\n const headers: Headers = {};\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 qs,\n headers,\n },\n (res) => mungeGharialResponse(res.body, \"removed\")\n );\n }\n}\n\n/**\n * Represents a graph in a {@link Database}.\n */\nexport class Graph {\n protected _name: string;\n\n protected _db: Database;\n\n /**\n * @internal\n * @hidden\n */\n constructor(db: Database, name: string) {\n this._name = name.normalize(\"NFC\");\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) {\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 * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * const data = await graph.get();\n * // data contains general information about the graph\n * ```\n */\n get(): Promise<GraphInfo> {\n return this._db.request(\n { path: `/_api/gharial/${encodeURIComponent(this._name)}` },\n (res) => res.body.graph\n );\n }\n\n /**\n * Creates a graph with the given `edgeDefinitions` and `options` for this\n * graph's name.\n *\n * @param edgeDefinitions - Definitions for the relations of the graph.\n * @param options - Options for creating the graph.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * const info = await graph.create([\n * {\n * collection: \"edges\",\n * from: [\"start-vertices\"],\n * to: [\"end-vertices\"],\n * },\n * ]);\n * // graph now exists\n * ```\n */\n create(\n edgeDefinitions: EdgeDefinitionOptions[],\n options?: GraphCreateOptions\n ): Promise<GraphInfo> {\n const {\n orphanCollections,\n satellites,\n waitForSync,\n isSmart,\n isDisjoint,\n ...opts\n } = options ?? {};\n return this._db.request(\n {\n method: \"POST\",\n path: \"/_api/gharial\",\n body: {\n orphanCollections:\n orphanCollections &&\n (Array.isArray(orphanCollections)\n ? orphanCollections.map(collectionToString)\n : [collectionToString(orphanCollections)]),\n edgeDefinitions: edgeDefinitions.map(coerceEdgeDefinition),\n isSmart,\n isDisjoint,\n name: this._name,\n options: { ...opts, satellites: satellites?.map(collectionToString) },\n },\n qs: { waitForSync },\n },\n (res) => res.body.graph\n );\n }\n\n /**\n * Deletes the graph from the database.\n *\n * @param dropCollections - If set to `true`, the collections associated with\n * the graph will also be deleted.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * await graph.drop();\n * // the graph \"some-graph\" no longer exists\n * ```\n */\n drop(dropCollections: boolean = false): Promise<boolean> {\n return this._db.request(\n {\n method: \"DELETE\",\n path: `/_api/gharial/${encodeURIComponent(this._name)}`,\n qs: { dropCollections },\n },\n (res) => res.body.removed\n );\n }\n\n /**\n * Returns a {@link GraphVertexCollection} instance for the given collection\n * name representing the collection in this graph.\n *\n * @param T - Type to use for document data. Defaults to `any`.\n * @param collection - Name of the vertex collection.\n */\n vertexCollection<T extends Record<string, any> = any>(\n collection: string | ArangoCollection\n ): GraphVertexCollection<T> {\n return new GraphVertexCollection<T>(\n this._db,\n collectionToString(collection),\n this\n );\n }\n\n /**\n * Fetches all vertex collections of this graph from the database and returns\n * an array of their names.\n *\n * See also {@link Graph.vertexCollections}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * const info = await graph.create([\n * {\n * collection: \"edges\",\n * from: [\"start-vertices\"],\n * to: [\"end-vertices\"],\n * },\n * ]);\n * const vertexCollectionNames = await graph.listVertexCollections();\n * // [\"start-vertices\", \"end-vertices\"]\n * ```\n */\n listVertexCollections(): Promise<string[]> {\n return this._db.request(\n { path: `/_api/gharial/${encodeURIComponent(this._name)}/vertex` },\n (res) => res.body.collections\n );\n }\n\n /**\n * Fetches all vertex collections of this graph from the database and returns\n * an array of {@link GraphVertexCollection} instances.\n *\n * See also {@link Graph.listVertexCollections}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * const info = await graph.create([\n * {\n * collection: \"edges\",\n * from: [\"start-vertices\"],\n * to: [\"end-vertices\"],\n * },\n * ]);\n * const vertexCollections = await graph.vertexCollections();\n * for (const vertexCollection of vertexCollections) {\n * console.log(vertexCollection.name);\n * // \"start-vertices\"\n * // \"end-vertices\"\n * }\n * ```\n */\n async vertexCollections(): Promise<GraphVertexCollection[]> {\n const names = await this.listVertexCollections();\n return names.map((name) => new GraphVertexCollection(this._db, name, this));\n }\n\n /**\n * Adds the given collection to this graph as a vertex collection.\n *\n * @param collection - Collection to add to the graph.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * await graph.addVertexCollection(\"more-vertices\");\n * // The collection \"more-vertices\" has been added to the graph\n * const extra = db.collection(\"extra-vertices\");\n * await graph.addVertexCollection(extra);\n * // The collection \"extra-vertices\" has been added to the graph\n * ```\n */\n addVertexCollection(\n collection: string | ArangoCollection,\n options?: AddVertexCollectionOptions\n ): Promise<GraphInfo> {\n const { satellites, ...opts } = options ?? {};\n return this._db.request(\n {\n method: \"POST\",\n path: `/_api/gharial/${encodeURIComponent(this._name)}/vertex`,\n body: {\n collection: collectionToString(collection),\n options: { ...opts, satellites: satellites?.map(collectionToString) },\n },\n },\n (res) => res.body.graph\n );\n }\n\n /**\n * Removes the given collection from this graph as a vertex collection.\n *\n * @param collection - Collection to remove from the graph.\n * @param dropCollection - If set to `true`, the collection will also be\n * deleted from the database.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * const info = await graph.create([\n * {\n * collection: \"edges\",\n * from: [\"start-vertices\"],\n * to: [\"end-vertices\"],\n * },\n * ]);\n * await graph.removeVertexCollection(\"start-vertices\");\n * // The collection \"start-vertices\" is no longer part of the graph.\n * ```\n */\n removeVertexCollection(\n collection: string | ArangoCollection,\n dropCollection: boolean = false\n ): Promise<GraphInfo> {\n return this._db.request(\n {\n method: \"DELETE\",\n path: `/_api/gharial/${encodeURIComponent(\n this._name\n )}/vertex/${encodeURIComponent(collectionToString(collection))}`,\n qs: {\n dropCollection,\n },\n },\n (res) => res.body.graph\n );\n }\n\n /**\n * Returns a {@link GraphEdgeCollection} instance for the given collection\n * name representing the collection in this graph.\n *\n * @param T - Type to use for document data. Defaults to `any`.\n * @param collection - Name of the edge collection.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * const info = await graph.create([\n * {\n * collection: \"edges\",\n * from: [\"start-vertices\"],\n * to: [\"end-vertices\"],\n * },\n * ]);\n * const graphEdgeCollection = graph.edgeCollection(\"edges\");\n * // Access the underlying EdgeCollection API:\n * const edgeCollection = graphEdgeCollection.collection;\n * ```\n */\n edgeCollection<T extends Record<string, any> = any>(\n collection: string | ArangoCollection\n ): GraphEdgeCollection<T> {\n return new GraphEdgeCollection<T>(\n this._db,\n collectionToString(collection),\n this\n );\n }\n\n /**\n * Fetches all edge collections of this graph from the database and returns\n * an array of their names.\n *\n * See also {@link Graph.edgeCollections}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * const info = await graph.create([\n * {\n * collection: \"edges\",\n * from: [\"start-vertices\"],\n * to: [\"end-vertices\"],\n * },\n * ]);\n * const edgeCollectionNames = await graph.listEdgeCollections();\n * // [\"edges\"]\n * ```\n */\n listEdgeCollections(): Promise<string[]> {\n return this._db.request(\n { path: `/_api/gharial/${encodeURIComponent(this._name)}/edge` },\n (res) => res.body.collections\n );\n }\n\n /**\n * Fetches all edge collections of this graph from the database and returns\n * an array of {@link GraphEdgeCollection} instances.\n *\n * See also {@link Graph.listEdgeCollections}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * const info = await graph.create([\n * {\n * collection: \"edges\",\n * from: [\"start-vertices\"],\n * to: [\"end-vertices\"],\n * },\n * ]);\n * const graphEdgeCollections = await graph.edgeCollections();\n * for (const collection of graphEdgeCollection) {\n * console.log(collection.name);\n * // \"edges\"\n * }\n * ```\n */\n async edgeCollections(): Promise<GraphEdgeCollection[]> {\n const names = await this.listEdgeCollections();\n return names.map((name) => new GraphEdgeCollection(this._db, name, this));\n }\n\n /**\n * Adds an edge definition to this graph.\n *\n * @param edgeDefinition - Definition of a relation in this graph.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * await graph.addEdgeDefinition({\n * collection: \"edges\",\n * from: [\"start-vertices\"],\n * to: [\"end-vertices\"],\n * });\n * // The edge definition has been added to the graph\n * ```\n */\n addEdgeDefinition(\n edgeDefinition: EdgeDefinitionOptions,\n options?: AddEdgeDefinitionOptions\n ): Promise<GraphInfo> {\n const { satellites, ...opts } = options ?? {};\n return this._db.request(\n {\n method: \"POST\",\n path: `/_api/gharial/${encodeURIComponent(this._name)}/edge`,\n body: {\n ...coerceEdgeDefinition(edgeDefinition),\n options: { ...opts, satellites: satellites?.map(collectionToString) },\n },\n },\n (res) => res.body.graph\n );\n }\n\n /**\n * Replaces an edge definition in this graph. The existing edge definition\n * for the given edge collection will be overwritten.\n *\n * @param edgeDefinition - Definition of a relation in this graph.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * const info = await graph.create([\n * {\n * collection: \"edges\",\n * from: [\"start-vertices\"],\n * to: [\"end-vertices\"],\n * },\n * ]);\n * await graph.replaceEdgeDefinition({\n * collection: \"edges\",\n * from: [\"start-vertices\"],\n * to: [\"other-vertices\"],\n * });\n * // The edge definition for \"edges\" has been replaced\n * ```\n */\n replaceEdgeDefinition(\n edgeDefinition: EdgeDefinitionOptions,\n options?: ReplaceEdgeDefinitionOptions\n ): Promise<GraphInfo>;\n /**\n * Replaces an edge definition in this graph. The existing edge definition\n * for the given edge collection will be overwritten.\n *\n * @param collection - Edge collection for which to replace the definition.\n * @param edgeDefinition - Definition of a relation in this graph.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * const info = await graph.create([\n * {\n * collection: \"edges\",\n * from: [\"start-vertices\"],\n * to: [\"end-vertices\"],\n * },\n * ]);\n * await graph.replaceEdgeDefinition(\"edges\", {\n * collection: \"edges\",\n * from: [\"start-vertices\"],\n * to: [\"other-vertices\"],\n * });\n * // The edge definition for \"edges\" has been replaced\n * ```\n */\n replaceEdgeDefinition(\n collection: string | ArangoCollection,\n edgeDefinition: EdgeDefinitionOptions,\n options?: ReplaceEdgeDefinitionOptions\n ): Promise<GraphInfo>;\n replaceEdgeDefinition(\n collectionOrEdgeDefinitionOptions:\n | string\n | ArangoCollection\n | EdgeDefinitionOptions,\n edgeDefinitionOrOptions?:\n | EdgeDefinitionOptions\n | ReplaceEdgeDefinitionOptions,\n options?: ReplaceEdgeDefinitionOptions\n ) {\n let collection = collectionOrEdgeDefinitionOptions as\n | string\n | ArangoCollection;\n let edgeDefinition = edgeDefinitionOrOptions as EdgeDefinitionOptions;\n if (\n edgeDefinitionOrOptions &&\n !edgeDefinitionOrOptions.hasOwnProperty(\"collection\")\n ) {\n options = edgeDefinitionOrOptions as ReplaceEdgeDefinitionOptions;\n edgeDefinitionOrOptions = undefined;\n }\n if (!edgeDefinitionOrOptions) {\n edgeDefinition =\n collectionOrEdgeDefinitionOptions as EdgeDefinitionOptions;\n collection = edgeDefinition.collection;\n }\n const { satellites, ...opts } = options ?? {};\n return this._db.request(\n {\n method: \"PUT\",\n path: `/_api/gharial/${encodeURIComponent(\n this._name\n )}/edge/${encodeURIComponent(collectionToString(collection))}`,\n body: {\n ...coerceEdgeDefinition(edgeDefinition),\n options: { ...opts, satellites: satellites?.map(collectionToString) },\n },\n },\n (res) => res.body.graph\n );\n }\n\n /**\n * Removes the edge definition for the given edge collection from this graph.\n *\n * @param collection - Edge collection for which to remove the definition.\n * @param dropCollection - If set to `true`, the collection will also be\n * deleted from the database.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * const info = await graph.create([\n * {\n * collection: \"edges\",\n * from: [\"start-vertices\"],\n * to: [\"end-vertices\"],\n * },\n * ]);\n * await graph.removeEdgeDefinition(\"edges\");\n * // The edge definition for \"edges\" has been replaced\n * ```\n */\n removeEdgeDefinition(\n collection: string | ArangoCollection,\n dropCollection: boolean = false\n ): Promise<GraphInfo> {\n return this._db.request(\n {\n method: \"DELETE\",\n path: `/_api/gharial/${encodeURIComponent(\n this._name\n )}/edge/${encodeURIComponent(collectionToString(collection))}`,\n qs: {\n dropCollection,\n },\n },\n (res) => res.body.graph\n );\n }\n\n /**\n * Performs a traversal starting from the given `startVertex` and following\n * edges contained in this graph.\n *\n * See also {@link EdgeCollection.traversal}.\n *\n * @param startVertex - Document `_id` of a vertex in this graph.\n * @param options - Options for performing the traversal.\n *\n * @deprecated Simple Queries have been deprecated in ArangoDB 3.4 and can be\n * replaced with AQL queries.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"my-graph\");\n * const collection = graph.edgeCollection(\"edges\").collection;\n * await collection.import([\n * [\"_key\", \"_from\", \"_to\"],\n * [\"x\", \"vertices/a\", \"vertices/b\"],\n * [\"y\", \"vertices/b\", \"vertices/c\"],\n * [\"z\", \"vertices/c\", \"vertices/d\"],\n * ]);\n * const result = await graph.traversal(\"vertices/a\", {\n * direction: \"outbound\",\n * init: \"result.vertices = [];\",\n * visitor: \"result.vertices.push(vertex._key);\",\n * });\n * console.log(result.vertices); // [\"a\", \"b\", \"c\", \"d\"]\n * ```\n */\n traversal(startVertex: string, options?: TraversalOptions): Promise<any> {\n return this._db.request(\n {\n method: \"POST\",\n path: `/_api/traversal`,\n body: {\n ...options,\n startVertex,\n graphName: this._name,\n },\n },\n (res) => res.body.result\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"graph.js","sourceRoot":"","sources":["../src/graph.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;GAaG;AACH,6CAMsB;AAGtB,2CASqB;AACrB,mCAAwC;AACxC,uCAAkE;AAElE;;;;GAIG;AACH,SAAgB,aAAa,CAAC,KAAU;IACtC,OAAO,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;AAC/C,CAAC;AAF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F,EACD,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CACzB,CAAC;IACJ,CAAC;CACF;AApmBD,sBAomBC","sourcesContent":["/**\n * ```ts\n * import type {\n * Graph,\n * GraphVertexCollection,\n * GraphEdgeCollection,\n * } from \"arangojs/graph\";\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 TraversalOptions,\n} from \"./collection\";\nimport { Headers } from \"./connection\";\nimport { Database } from \"./database\";\nimport {\n Document,\n DocumentData,\n DocumentMetadata,\n DocumentSelector,\n Edge,\n EdgeData,\n Patch,\n _documentHandle,\n} from \"./documents\";\nimport { isArangoError } from \"./error\";\nimport { DOCUMENT_NOT_FOUND, GRAPH_NOT_FOUND } from \"./lib/codes\";\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 ...qs\n } = options;\n const headers: Headers = {};\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 qs,\n allowDirtyRead,\n },\n (res) => res.body.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 qs: options,\n },\n (res) => mungeGharialResponse(res.body, \"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, ...qs } = options;\n const headers: Headers = {};\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 qs,\n headers,\n },\n (res) => mungeGharialResponse(res.body, \"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: Headers = {};\n const { rev, ...qs } = 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 qs,\n headers,\n },\n (res) => mungeGharialResponse(res.body, \"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: Headers = {};\n const { rev, ...qs } = 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 qs,\n headers,\n },\n (res) => mungeGharialResponse(res.body, \"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 ...qs\n } = options;\n const headers: Headers = {};\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 qs,\n allowDirtyRead,\n },\n (res) => res.body.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 qs: options,\n },\n (res) => mungeGharialResponse(res.body, \"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, ...qs } = options;\n const headers: Headers = {};\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 qs,\n headers,\n },\n (res) => mungeGharialResponse(res.body, \"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, ...qs } = options;\n const headers: Headers = {};\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 qs,\n headers,\n },\n (res) => mungeGharialResponse(res.body, \"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, ...qs } = options;\n const headers: Headers = {};\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 qs,\n headers,\n },\n (res) => mungeGharialResponse(res.body, \"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.normalize(\"NFC\");\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 * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * const data = await graph.get();\n * // data contains general information about the graph\n * ```\n */\n get(): Promise<GraphInfo> {\n return this._db.request(\n { path: `/_api/gharial/${encodeURIComponent(this._name)}` },\n (res) => res.body.graph\n );\n }\n\n /**\n * Creates a graph with the given `edgeDefinitions` and `options` for this\n * graph's name.\n *\n * @param edgeDefinitions - Definitions for the relations of the graph.\n * @param options - Options for creating the graph.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * const info = await graph.create([\n * {\n * collection: \"edges\",\n * from: [\"start-vertices\"],\n * to: [\"end-vertices\"],\n * },\n * ]);\n * // graph now exists\n * ```\n */\n create(\n edgeDefinitions: EdgeDefinitionOptions[],\n options: CreateGraphOptions = {}\n ): Promise<GraphInfo> {\n const {\n orphanCollections,\n satellites,\n waitForSync,\n isSmart,\n isDisjoint,\n ...opts\n } = options;\n return this._db.request(\n {\n method: \"POST\",\n path: \"/_api/gharial\",\n body: {\n orphanCollections:\n orphanCollections &&\n (Array.isArray(orphanCollections)\n ? orphanCollections.map(collectionToString)\n : [collectionToString(orphanCollections)]),\n edgeDefinitions: edgeDefinitions.map(coerceEdgeDefinition),\n isSmart,\n isDisjoint,\n name: this._name,\n options: { ...opts, satellites: satellites?.map(collectionToString) },\n },\n qs: { waitForSync },\n },\n (res) => res.body.graph\n );\n }\n\n /**\n * Deletes the graph from the database.\n *\n * @param dropCollections - If set to `true`, the collections associated with\n * the graph will also be deleted.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * await graph.drop();\n * // the graph \"some-graph\" no longer exists\n * ```\n */\n drop(dropCollections: boolean = false): Promise<boolean> {\n return this._db.request(\n {\n method: \"DELETE\",\n path: `/_api/gharial/${encodeURIComponent(this._name)}`,\n qs: { dropCollections },\n },\n (res) => res.body.removed\n );\n }\n\n /**\n * Returns a {@link graph.GraphVertexCollection} instance for the given collection\n * name representing the collection in this graph.\n *\n * @param T - Type to use for document data. Defaults to `any`.\n * @param collection - Name of the vertex collection.\n */\n vertexCollection<T extends Record<string, any> = any>(\n collection: string | ArangoCollection\n ): GraphVertexCollection<T> {\n return new GraphVertexCollection<T>(\n this._db,\n collectionToString(collection),\n this\n );\n }\n\n /**\n * Fetches all vertex collections of this graph from the database and returns\n * an array of their names.\n *\n * See also {@link graph.Graph#vertexCollections}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * const info = await graph.create([\n * {\n * collection: \"edges\",\n * from: [\"start-vertices\"],\n * to: [\"end-vertices\"],\n * },\n * ]);\n * const vertexCollectionNames = await graph.listVertexCollections();\n * // [\"start-vertices\", \"end-vertices\"]\n * ```\n */\n listVertexCollections(): Promise<string[]> {\n return this._db.request(\n { path: `/_api/gharial/${encodeURIComponent(this._name)}/vertex` },\n (res) => res.body.collections\n );\n }\n\n /**\n * Fetches all vertex collections of this graph from the database and returns\n * an array of {@link graph.GraphVertexCollection} instances.\n *\n * See also {@link graph.Graph#listVertexCollections}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * const info = await graph.create([\n * {\n * collection: \"edges\",\n * from: [\"start-vertices\"],\n * to: [\"end-vertices\"],\n * },\n * ]);\n * const vertexCollections = await graph.vertexCollections();\n * for (const vertexCollection of vertexCollections) {\n * console.log(vertexCollection.name);\n * // \"start-vertices\"\n * // \"end-vertices\"\n * }\n * ```\n */\n async vertexCollections(): Promise<GraphVertexCollection[]> {\n const names = await this.listVertexCollections();\n return names.map((name) => new GraphVertexCollection(this._db, name, this));\n }\n\n /**\n * Adds the given collection to this graph as a vertex collection.\n *\n * @param collection - Collection to add to the graph.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * await graph.addVertexCollection(\"more-vertices\");\n * // The collection \"more-vertices\" has been added to the graph\n * const extra = db.collection(\"extra-vertices\");\n * await graph.addVertexCollection(extra);\n * // The collection \"extra-vertices\" has been added to the graph\n * ```\n */\n addVertexCollection(\n collection: string | ArangoCollection,\n options: AddVertexCollectionOptions = {}\n ): Promise<GraphInfo> {\n const { satellites, ...opts } = options;\n return this._db.request(\n {\n method: \"POST\",\n path: `/_api/gharial/${encodeURIComponent(this._name)}/vertex`,\n body: {\n collection: collectionToString(collection),\n options: { ...opts, satellites: satellites?.map(collectionToString) },\n },\n },\n (res) => res.body.graph\n );\n }\n\n /**\n * Removes the given collection from this graph as a vertex collection.\n *\n * @param collection - Collection to remove from the graph.\n * @param dropCollection - If set to `true`, the collection will also be\n * deleted from the database.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * const info = await graph.create([\n * {\n * collection: \"edges\",\n * from: [\"start-vertices\"],\n * to: [\"end-vertices\"],\n * },\n * ]);\n * await graph.removeVertexCollection(\"start-vertices\");\n * // The collection \"start-vertices\" is no longer part of the graph.\n * ```\n */\n removeVertexCollection(\n collection: string | ArangoCollection,\n dropCollection: boolean = false\n ): Promise<GraphInfo> {\n return this._db.request(\n {\n method: \"DELETE\",\n path: `/_api/gharial/${encodeURIComponent(\n this._name\n )}/vertex/${encodeURIComponent(collectionToString(collection))}`,\n qs: {\n dropCollection,\n },\n },\n (res) => res.body.graph\n );\n }\n\n /**\n * Returns a {@link graph.GraphEdgeCollection} instance for the given collection\n * name representing the collection in this graph.\n *\n * @param T - Type to use for document data. Defaults to `any`.\n * @param collection - Name of the edge collection.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * const info = await graph.create([\n * {\n * collection: \"edges\",\n * from: [\"start-vertices\"],\n * to: [\"end-vertices\"],\n * },\n * ]);\n * const graphEdgeCollection = graph.edgeCollection(\"edges\");\n * // Access the underlying EdgeCollection API:\n * const edgeCollection = graphEdgeCollection.collection;\n * ```\n */\n edgeCollection<T extends Record<string, any> = any>(\n collection: string | ArangoCollection\n ): GraphEdgeCollection<T> {\n return new GraphEdgeCollection<T>(\n this._db,\n collectionToString(collection),\n this\n );\n }\n\n /**\n * Fetches all edge collections of this graph from the database and returns\n * an array of their names.\n *\n * See also {@link graph.Graph#edgeCollections}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * const info = await graph.create([\n * {\n * collection: \"edges\",\n * from: [\"start-vertices\"],\n * to: [\"end-vertices\"],\n * },\n * ]);\n * const edgeCollectionNames = await graph.listEdgeCollections();\n * // [\"edges\"]\n * ```\n */\n listEdgeCollections(): Promise<string[]> {\n return this._db.request(\n { path: `/_api/gharial/${encodeURIComponent(this._name)}/edge` },\n (res) => res.body.collections\n );\n }\n\n /**\n * Fetches all edge collections of this graph from the database and returns\n * an array of {@link graph.GraphEdgeCollection} instances.\n *\n * See also {@link graph.Graph#listEdgeCollections}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * const info = await graph.create([\n * {\n * collection: \"edges\",\n * from: [\"start-vertices\"],\n * to: [\"end-vertices\"],\n * },\n * ]);\n * const graphEdgeCollections = await graph.edgeCollections();\n * for (const collection of graphEdgeCollection) {\n * console.log(collection.name);\n * // \"edges\"\n * }\n * ```\n */\n async edgeCollections(): Promise<GraphEdgeCollection[]> {\n const names = await this.listEdgeCollections();\n return names.map((name) => new GraphEdgeCollection(this._db, name, this));\n }\n\n /**\n * Adds an edge definition to this graph.\n *\n * @param edgeDefinition - Definition of a relation in this graph.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * await graph.addEdgeDefinition({\n * collection: \"edges\",\n * from: [\"start-vertices\"],\n * to: [\"end-vertices\"],\n * });\n * // The edge definition has been added to the graph\n * ```\n */\n addEdgeDefinition(\n edgeDefinition: EdgeDefinitionOptions,\n options: AddEdgeDefinitionOptions = {}\n ): Promise<GraphInfo> {\n const { satellites, ...opts } = options;\n return this._db.request(\n {\n method: \"POST\",\n path: `/_api/gharial/${encodeURIComponent(this._name)}/edge`,\n body: {\n ...coerceEdgeDefinition(edgeDefinition),\n options: { ...opts, satellites: satellites?.map(collectionToString) },\n },\n },\n (res) => res.body.graph\n );\n }\n\n /**\n * Replaces an edge definition in this graph. The existing edge definition\n * for the given edge collection will be overwritten.\n *\n * @param edgeDefinition - Definition of a relation in this graph.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * const info = await graph.create([\n * {\n * collection: \"edges\",\n * from: [\"start-vertices\"],\n * to: [\"end-vertices\"],\n * },\n * ]);\n * await graph.replaceEdgeDefinition({\n * collection: \"edges\",\n * from: [\"start-vertices\"],\n * to: [\"other-vertices\"],\n * });\n * // The edge definition for \"edges\" has been replaced\n * ```\n */\n replaceEdgeDefinition(\n edgeDefinition: EdgeDefinitionOptions,\n options?: ReplaceEdgeDefinitionOptions\n ): Promise<GraphInfo>;\n /**\n * Replaces an edge definition in this graph. The existing edge definition\n * for the given edge collection will be overwritten.\n *\n * @param collection - Edge collection for which to replace the definition.\n * @param edgeDefinition - Definition of a relation in this graph.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * const info = await graph.create([\n * {\n * collection: \"edges\",\n * from: [\"start-vertices\"],\n * to: [\"end-vertices\"],\n * },\n * ]);\n * await graph.replaceEdgeDefinition(\"edges\", {\n * collection: \"edges\",\n * from: [\"start-vertices\"],\n * to: [\"other-vertices\"],\n * });\n * // The edge definition for \"edges\" has been replaced\n * ```\n */\n replaceEdgeDefinition(\n collection: string | ArangoCollection,\n edgeDefinition: EdgeDefinitionOptions,\n options?: ReplaceEdgeDefinitionOptions\n ): Promise<GraphInfo>;\n replaceEdgeDefinition(\n collectionOrEdgeDefinitionOptions:\n | string\n | ArangoCollection\n | EdgeDefinitionOptions,\n edgeDefinitionOrOptions?:\n | EdgeDefinitionOptions\n | ReplaceEdgeDefinitionOptions,\n options: ReplaceEdgeDefinitionOptions = {}\n ) {\n let collection = collectionOrEdgeDefinitionOptions as\n | string\n | ArangoCollection;\n let edgeDefinition = edgeDefinitionOrOptions as EdgeDefinitionOptions;\n if (\n edgeDefinitionOrOptions &&\n !edgeDefinitionOrOptions.hasOwnProperty(\"collection\")\n ) {\n options = edgeDefinitionOrOptions as ReplaceEdgeDefinitionOptions;\n edgeDefinitionOrOptions = undefined;\n }\n if (!edgeDefinitionOrOptions) {\n edgeDefinition =\n collectionOrEdgeDefinitionOptions as EdgeDefinitionOptions;\n collection = edgeDefinition.collection;\n }\n const { satellites, ...opts } = options;\n return this._db.request(\n {\n method: \"PUT\",\n path: `/_api/gharial/${encodeURIComponent(\n this._name\n )}/edge/${encodeURIComponent(collectionToString(collection))}`,\n body: {\n ...coerceEdgeDefinition(edgeDefinition),\n options: { ...opts, satellites: satellites?.map(collectionToString) },\n },\n },\n (res) => res.body.graph\n );\n }\n\n /**\n * Removes the edge definition for the given edge collection from this graph.\n *\n * @param collection - Edge collection for which to remove the definition.\n * @param dropCollection - If set to `true`, the collection will also be\n * deleted from the database.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * const info = await graph.create([\n * {\n * collection: \"edges\",\n * from: [\"start-vertices\"],\n * to: [\"end-vertices\"],\n * },\n * ]);\n * await graph.removeEdgeDefinition(\"edges\");\n * // The edge definition for \"edges\" has been replaced\n * ```\n */\n removeEdgeDefinition(\n collection: string | ArangoCollection,\n dropCollection: boolean = false\n ): Promise<GraphInfo> {\n return this._db.request(\n {\n method: \"DELETE\",\n path: `/_api/gharial/${encodeURIComponent(\n this._name\n )}/edge/${encodeURIComponent(collectionToString(collection))}`,\n qs: {\n dropCollection,\n },\n },\n (res) => res.body.graph\n );\n }\n\n /**\n * Performs a traversal starting from the given `startVertex` and following\n * edges contained in this graph.\n *\n * See also {@link collection.EdgeCollection#traversal}.\n *\n * @param startVertex - Document `_id` of a vertex in this graph.\n * @param options - Options for performing the traversal.\n *\n * @deprecated Simple Queries have been deprecated in ArangoDB 3.4 and can be\n * replaced with AQL queries.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"my-graph\");\n * const collection = graph.edgeCollection(\"edges\").collection;\n * await collection.import([\n * [\"_key\", \"_from\", \"_to\"],\n * [\"x\", \"vertices/a\", \"vertices/b\"],\n * [\"y\", \"vertices/b\", \"vertices/c\"],\n * [\"z\", \"vertices/c\", \"vertices/d\"],\n * ]);\n * const startVertex = \"vertices/a\";\n * const cursor = await db.query(aql`\n * FOR vertex IN OUTBOUND ${startVertex} GRAPH ${graph}\n * RETURN vertex._key\n * `);\n * const result = await cursor.all();\n * console.log(result); // [\"a\", \"b\", \"c\", \"d\"]\n * ```\n */\n traversal(startVertex: string, options?: TraversalOptions): Promise<any> {\n return this._db.request(\n {\n method: \"POST\",\n path: `/_api/traversal`,\n body: {\n ...options,\n startVertex,\n graphName: this._name,\n },\n },\n (res) => res.body.result\n );\n }\n}\n"]}
|
package/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* If you are just getting started, you probably want to use the
|
|
10
10
|
* {@link arangojs} function, which is also the default export of this module,
|
|
11
|
-
* or the {@link Database} class for which it is a wrapper.
|
|
11
|
+
* or the {@link database.Database} class for which it is a wrapper.
|
|
12
12
|
*
|
|
13
13
|
* @packageDocumentation
|
|
14
14
|
*/
|
|
@@ -17,14 +17,14 @@ import { Database } from "./database";
|
|
|
17
17
|
/**
|
|
18
18
|
* Creates a new `Database` instance with its own connection pool.
|
|
19
19
|
*
|
|
20
|
-
* This is a wrapper function for the {@link Database
|
|
20
|
+
* This is a wrapper function for the {@link database.Database:constructor}.
|
|
21
21
|
*
|
|
22
22
|
* @param config - An object with configuration options.
|
|
23
23
|
*
|
|
24
24
|
* @example
|
|
25
25
|
* ```js
|
|
26
26
|
* const db = arangojs({
|
|
27
|
-
* url: "http://
|
|
27
|
+
* url: "http://127.0.0.1:8529",
|
|
28
28
|
* databaseName: "myDatabase",
|
|
29
29
|
* auth: { username: "admin", password: "hunter2" },
|
|
30
30
|
* });
|
|
@@ -34,21 +34,19 @@ export declare function arangojs(config?: Config): Database;
|
|
|
34
34
|
/**
|
|
35
35
|
* Creates a new `Database` instance with its own connection pool.
|
|
36
36
|
*
|
|
37
|
-
* This is a wrapper function for the {@link Database
|
|
37
|
+
* This is a wrapper function for the {@link database.Database:constructor}.
|
|
38
38
|
*
|
|
39
39
|
* @param url - Base URL of the ArangoDB server or list of server URLs.
|
|
40
|
-
* Equivalent to the `url` option in {@link Config}.
|
|
40
|
+
* Equivalent to the `url` option in {@link connection.Config}.
|
|
41
41
|
*
|
|
42
42
|
* @example
|
|
43
43
|
* ```js
|
|
44
|
-
* const db = arangojs("http://
|
|
44
|
+
* const db = arangojs("http://127.0.0.1:8529", "myDatabase");
|
|
45
45
|
* db.useBasicAuth("admin", "hunter2");
|
|
46
46
|
* ```
|
|
47
47
|
*/
|
|
48
48
|
export declare function arangojs(url: string | string[], name?: string): Database;
|
|
49
49
|
export default arangojs;
|
|
50
50
|
export { aql } from "./aql";
|
|
51
|
-
export { CollectionStatus, CollectionType } from "./collection";
|
|
52
51
|
export { Database } from "./database";
|
|
53
|
-
export { ViewType } from "./view";
|
|
54
52
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;AACpD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;AAQ1E,eAAe,QAAQ,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;AACpD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;AAQ1E,eAAe,QAAQ,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.arangojs = void 0;
|
|
3
|
+
exports.Database = exports.aql = exports.arangojs = void 0;
|
|
4
4
|
const database_1 = require("./database");
|
|
5
5
|
module.exports = exports = arangojs;
|
|
6
6
|
function arangojs(config, name) {
|
|
@@ -14,11 +14,6 @@ exports.arangojs = arangojs;
|
|
|
14
14
|
exports.default = arangojs;
|
|
15
15
|
var aql_1 = require("./aql");
|
|
16
16
|
Object.defineProperty(exports, "aql", { enumerable: true, get: function () { return aql_1.aql; } });
|
|
17
|
-
var collection_1 = require("./collection");
|
|
18
|
-
Object.defineProperty(exports, "CollectionStatus", { enumerable: true, get: function () { return collection_1.CollectionStatus; } });
|
|
19
|
-
Object.defineProperty(exports, "CollectionType", { enumerable: true, get: function () { return collection_1.CollectionType; } });
|
|
20
17
|
var database_2 = require("./database");
|
|
21
18
|
Object.defineProperty(exports, "Database", { enumerable: true, get: function () { return database_2.Database; } });
|
|
22
|
-
var view_1 = require("./view");
|
|
23
|
-
Object.defineProperty(exports, "ViewType", { enumerable: true, get: function () { return view_1.ViewType; } });
|
|
24
19
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAeA,yCAAsC;AAEtC,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAC;AAiCpC,SAAgB,QAAQ,CAAC,MAAmC,EAAE,IAAa;IACzE,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACvD,MAAM,GAAG,GAAG,MAAM,CAAC;QACnB,OAAO,IAAI,mBAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;KAChC;IACD,OAAO,IAAI,mBAAQ,CAAC,MAAM,CAAC,CAAC;AAC9B,CAAC;AAND,4BAMC;AACD,kBAAe,QAAQ,CAAC;AACxB,6BAA4B;AAAnB,0FAAA,GAAG,OAAA;AACZ,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAeA,yCAAsC;AAEtC,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAC;AAiCpC,SAAgB,QAAQ,CAAC,MAAmC,EAAE,IAAa;IACzE,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACvD,MAAM,GAAG,GAAG,MAAM,CAAC;QACnB,OAAO,IAAI,mBAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;KAChC;IACD,OAAO,IAAI,mBAAQ,CAAC,MAAM,CAAC,CAAC;AAC9B,CAAC;AAND,4BAMC;AACD,kBAAe,QAAQ,CAAC;AACxB,6BAA4B;AAAnB,0FAAA,GAAG,OAAA;AACZ,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA","sourcesContent":["/**\n * ```js\n * import arangojs, { aql, Database } from \"arangojs\";\n * ```\n *\n * The \"index\" module is the default entry point when importing the arangojs\n * module or using the web build in the browser.\n *\n * If you are just getting started, you probably want to use the\n * {@link arangojs} function, which is also the default export of this module,\n * or the {@link database.Database} class for which it is a wrapper.\n *\n * @packageDocumentation\n */\nimport { Config } from \"./connection\";\nimport { Database } from \"./database\";\n\nmodule.exports = exports = arangojs;\n/**\n * Creates a new `Database` instance with its own connection pool.\n *\n * This is a wrapper function for the {@link database.Database:constructor}.\n *\n * @param config - An object with configuration options.\n *\n * @example\n * ```js\n * const db = arangojs({\n * url: \"http://127.0.0.1:8529\",\n * databaseName: \"myDatabase\",\n * auth: { username: \"admin\", password: \"hunter2\" },\n * });\n * ```\n */\nexport function arangojs(config?: Config): Database;\n/**\n * Creates a new `Database` instance with its own connection pool.\n *\n * This is a wrapper function for the {@link database.Database:constructor}.\n *\n * @param url - Base URL of the ArangoDB server or list of server URLs.\n * Equivalent to the `url` option in {@link connection.Config}.\n *\n * @example\n * ```js\n * const db = arangojs(\"http://127.0.0.1:8529\", \"myDatabase\");\n * db.useBasicAuth(\"admin\", \"hunter2\");\n * ```\n */\nexport function arangojs(url: string | string[], name?: string): Database;\nexport function arangojs(config?: string | string[] | Config, name?: string) {\n if (typeof config === \"string\" || Array.isArray(config)) {\n const url = config;\n return new Database(url, name);\n }\n return new Database(config);\n}\nexport default arangojs;\nexport { aql } from \"./aql\";\nexport { Database } from \"./database\";\n"]}
|