arangojs 8.4.0 → 8.4.1
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 +7 -0
- package/aql.d.ts +1 -1
- package/aql.d.ts.map +1 -1
- package/aql.js.map +1 -1
- package/connection.js +1 -1
- package/package.json +1 -1
- package/web.js +1 -1
- package/web.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -14,6 +14,12 @@ This driver uses semantic versioning:
|
|
|
14
14
|
- A change in the major version (e.g. 1.Y.Z -> 2.0.0) indicates _breaking_
|
|
15
15
|
changes that require changes in your code to upgrade.
|
|
16
16
|
|
|
17
|
+
## [8.4.1] - 2023-09-15
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- Fixed default return type of AQL queries being `undefined` instead of `any` ([#797](https://github.com/arangodb/arangojs/issues/797))
|
|
22
|
+
|
|
17
23
|
## [8.4.0] - 2023-07-10
|
|
18
24
|
|
|
19
25
|
### Changed
|
|
@@ -1705,6 +1711,7 @@ For a detailed list of changes between pre-release versions of v7 see the
|
|
|
1705
1711
|
|
|
1706
1712
|
Graph methods now only return the relevant part of the response body.
|
|
1707
1713
|
|
|
1714
|
+
[8.4.1]: https://github.com/arangodb/arangojs/compare/v8.4.0...v8.4.1
|
|
1708
1715
|
[8.4.0]: https://github.com/arangodb/arangojs/compare/v8.3.1...v8.4.0
|
|
1709
1716
|
[8.3.1]: https://github.com/arangodb/arangojs/compare/v8.3.0...v8.3.1
|
|
1710
1717
|
[8.3.0]: https://github.com/arangodb/arangojs/compare/v8.2.1...v8.3.0
|
package/aql.d.ts
CHANGED
package/aql.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aql.d.ts","sourceRoot":"","sources":["../src/aql.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,gBAAgB,EAAsB,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,KAAK,EAAiB,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAgB,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE5C,OAAO,CAAC,MAAM,IAAI,EAAE,OAAO,MAAM,CAAC;AAElC;;;GAGG;AACH,MAAM,WAAW,QAAQ,CAAC,CAAC,GAAG,GAAG;IAC/B,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"aql.d.ts","sourceRoot":"","sources":["../src/aql.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,gBAAgB,EAAsB,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,KAAK,EAAiB,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAgB,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE5C,OAAO,CAAC,MAAM,IAAI,EAAE,OAAO,MAAM,CAAC;AAElC;;;GAGG;AACH,MAAM,WAAW,QAAQ,CAAC,CAAC,GAAG,GAAG;IAC/B,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;IACjB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,QAAQ,CAAC,CAAC,CAAC;IAC7D;;OAEG;IACH,OAAO,EAAE,MAAM;QAAE,OAAO,EAAE,MAAM,EAAE,CAAC;QAAC,IAAI,EAAE,QAAQ,EAAE,CAAA;KAAE,CAAC;CACxD;AAED;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;OAKG;IACH,KAAK,EAAE,MAAM,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,oBAAY,QAAQ,GAChB,gBAAgB,GAChB,IAAI,GACJ,KAAK,GACL,iBAAiB,GACjB,UAAU,GACV,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,GACT,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACnB,GAAG,EAAE,CAAC;AAEV;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,QAAQ,CAExD;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,iBAAiB,CAE1E;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,IAAI,UAAU,CAEhE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwFG;AACH,wBAAgB,GAAG,CAAC,CAAC,GAAG,GAAG,EACzB,eAAe,EAAE,oBAAoB,EACrC,GAAG,IAAI,EAAE,QAAQ,EAAE,GAClB,iBAAiB,CAAC,CAAC,CAAC,CA2DtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,wBAAgB,OAAO,CACrB,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,IAAI,GAAG,SAAS,GAC/D,UAAU,CAYZ;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,GAAG,GAAE,MAAY,GAAG,iBAAiB,CAQ7E"}
|
package/aql.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aql.js","sourceRoot":"","sources":["../src/aql.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * ```js\n * import { aql } from \"arangojs/aql\";\n * ```\n *\n * The \"aql\" module provides the {@link aql} template string handler and\n * helper functions, as well as associated types and interfaces for TypeScript.\n *\n * The aql function and namespace is also re-exported by the \"index\" module.\n *\n * @packageDocumentation\n */\nimport { isArangoAnalyzer } from \"./analyzer\";\nimport { ArangoCollection, isArangoCollection } from \"./collection\";\nimport { Graph, isArangoGraph } from \"./graph\";\nimport { isArangoView, View } from \"./view\";\n\ndeclare const type: unique symbol;\n\n/**\n * Generic AQL query object consisting of an AQL query string and its bind\n * parameters.\n */\nexport interface AqlQuery<T = any> {\n [type]?: T;\n /**\n * An AQL query string.\n */\n query: string;\n /**\n * An object mapping AQL bind parameter names to their respective values.\n *\n * Names of parameters representing collections are prefixed with an\n * at-symbol.\n */\n bindVars: Record<string, any>;\n}\n\n/**\n * Derived type representing AQL query objects generated by the AQL helper\n * functions and the AQL template string handler. These objects can be fed\n * back into these helper functions to be inlined or merged in complex queries.\n *\n * @internal\n */\nexport interface GeneratedAqlQuery<T = any> extends AqlQuery<T> {\n /**\n * @internal\n */\n _source: () => { strings: string[]; args: AqlValue[] };\n}\n\n/**\n * An object representing a trusted AQL literal that will be inlined directly\n * when used in an AQL template or passed to AQL helper functions.\n *\n * Arbitrary values can be converted to trusted AQL literals by passing them\n * to the {@link literal} helper function.\n */\nexport interface AqlLiteral {\n /**\n * @internal\n *\n * Returns a string representation of this AQL literal that can be inlined\n * in an AQL template.\n */\n toAQL: () => string;\n}\n\n/**\n * A value that can be used in an AQL template string or passed to an AQL\n * helper function.\n */\nexport type AqlValue =\n | ArangoCollection\n | View\n | Graph\n | GeneratedAqlQuery\n | AqlLiteral\n | string\n | number\n | boolean\n | null\n | undefined\n | Record<string, any>\n | any[];\n\n/**\n * Indicates whether the given value is an {@link AqlQuery}.\n *\n * @param query - A value that might be an `AqlQuery`.\n */\nexport function isAqlQuery(query: any): query is AqlQuery {\n return Boolean(query && typeof query.query === \"string\" && query.bindVars);\n}\n\n/**\n * Indicates whether the given value is a {@link GeneratedAqlQuery}.\n *\n * @param query - A value that might be a `GeneratedAqlQuery`.\n *\n * @internal\n */\nexport function isGeneratedAqlQuery(query: any): query is GeneratedAqlQuery {\n return isAqlQuery(query) && typeof (query as any)._source === \"function\";\n}\n\n/**\n * Indicates whether the given value is an {@link AqlLiteral}.\n *\n * @param literal - A value that might be an `AqlLiteral`.\n */\nexport function isAqlLiteral(literal: any): literal is AqlLiteral {\n return Boolean(literal && typeof literal.toAQL === \"function\");\n}\n\n/**\n * Template string handler (template tag) for AQL queries.\n *\n * The `aql` tag can be used to write complex AQL queries as multi-line strings\n * without having to worry about `bindVars` and the distinction between\n * collections and regular parameters.\n *\n * Tagged template strings will return an {@link AqlQuery} object with\n * `query` and `bindVars` attributes reflecting any interpolated values.\n *\n * Any {@link collection.ArangoCollection} instance used in a query string will\n * be recognized as a collection reference and generate an AQL collection bind\n * parameter instead of a regular AQL value bind parameter.\n *\n * **Note**: you should always use the `aql` template tag when writing\n * dynamic AQL queries instead of using untagged (normal) template strings.\n * Untagged template strings will inline any interpolated values and return\n * a plain string as result. The `aql` template tag will only inline references\n * to the interpolated values and produce an AQL query object containing both\n * the query and the values. This prevents most injection attacks when using\n * untrusted values in dynamic queries.\n *\n * @example\n * ```js\n * // Some user-supplied string that may be malicious\n * const untrustedValue = req.body.email;\n *\n * // Without aql tag: BAD! DO NOT DO THIS!\n * const badQuery = `\n * FOR user IN users\n * FILTER user.email == \"${untrustedValue}\"\n * RETURN user\n * `;\n * // e.g. if untrustedValue is '\" || user.admin == true || \"':\n * // Query:\n * // FOR user IN users\n * // FILTER user.email == \"\" || user.admin == true || \"\"\n * // RETURN user\n *\n * // With the aql tag: GOOD! MUCH SAFER!\n * const betterQuery = aql`\n * FOR user IN users\n * FILTER user.email == ${untrustedValue}\n * RETURN user\n * `;\n * // Query:\n * // FOR user IN users\n * // FILTER user.email == @value0\n * // RETURN user\n * // Bind parameters:\n * // value0 -> untrustedValue\n * ```\n *\n * @example\n * ```js\n * const collection = db.collection(\"some-collection\");\n * const minValue = 23;\n * const result = await db.query(aql`\n * FOR d IN ${collection}\n * FILTER d.num > ${minValue}\n * RETURN d\n * `);\n *\n * // Equivalent raw query object\n * const result2 = await db.query({\n * query: `\n * FOR d IN @@collection\n * FILTER d.num > @minValue\n * RETURN d\n * `,\n * bindVars: {\n * \"@collection\": collection.name,\n * minValue: minValue\n * }\n * });\n * ```\n *\n * @example\n * ```js\n * const collection = db.collection(\"some-collection\");\n * const color = \"green\";\n * const filter = aql`FILTER d.color == ${color}'`;\n * const result = await db.query(aql`\n * FOR d IN ${collection}\n * ${filter}\n * RETURN d\n * `);\n * ```\n */\nexport function aql<T = any>(\n templateStrings: TemplateStringsArray,\n ...args: AqlValue[]\n): GeneratedAqlQuery<T> {\n const strings = [...templateStrings];\n const bindVars: Record<string, any> = {};\n const bindValues = [];\n let query = strings[0];\n for (let i = 0; i < args.length; i++) {\n const rawValue = args[i];\n let value = rawValue;\n if (isGeneratedAqlQuery(rawValue)) {\n const src = rawValue._source();\n if (src.args.length) {\n query += src.strings[0];\n args.splice(i, 1, ...src.args);\n strings.splice(\n i,\n 2,\n strings[i] + src.strings[0],\n ...src.strings.slice(1, src.args.length),\n src.strings[src.args.length] + strings[i + 1]\n );\n } else {\n query += rawValue.query + strings[i + 1];\n args.splice(i, 1);\n strings.splice(i, 2, strings[i] + rawValue.query + strings[i + 1]);\n }\n i -= 1;\n continue;\n }\n if (rawValue === undefined) {\n query += strings[i + 1];\n continue;\n }\n if (isAqlLiteral(rawValue)) {\n query += `${rawValue.toAQL()}${strings[i + 1]}`;\n continue;\n }\n const index = bindValues.indexOf(rawValue);\n const isKnown = index !== -1;\n let name = `value${isKnown ? index : bindValues.length}`;\n if (\n isArangoCollection(rawValue) ||\n isArangoGraph(rawValue) ||\n isArangoView(rawValue) ||\n isArangoAnalyzer(rawValue)\n ) {\n name = `@${name}`;\n value = rawValue.name;\n }\n if (!isKnown) {\n bindValues.push(rawValue);\n bindVars[name] = value;\n }\n query += `@${name}${strings[i + 1]}`;\n }\n return {\n query,\n bindVars,\n _source: () => ({ strings, args }),\n };\n}\n\n/**\n * Marks an arbitrary scalar value (i.e. a string, number or boolean) as\n * safe for being inlined directly into AQL queries when used in an `aql`\n * template string, rather than being converted into a bind parameter.\n *\n * **Note**: Nesting `aql` template strings is a much safer alternative for\n * most use cases. This low-level helper function only exists to help with\n * rare edge cases where a trusted AQL query fragment must be read from a\n * string (e.g. when reading query fragments from JSON) and should only be\n * used as a last resort.\n *\n * @example\n * ```js\n * // BAD! DO NOT DO THIS!\n * const sortDirection = literal('ASC');\n *\n * // GOOD! DO THIS INSTEAD!\n * const sortDirection = aql`ASC`;\n * ```\n *\n * @example\n * ```js\n * // BAD! DO NOT DO THIS!\n * const filterColor = literal('FILTER d.color == \"green\"');\n * const result = await db.query(aql`\n * FOR d IN some-collection\n * ${filterColor}\n * RETURN d\n * `);\n *\n * // GOOD! DO THIS INSTEAD!\n * const color = \"green\";\n * const filterColor = aql`FILTER d.color === ${color}`;\n * const result = await db.query(aql`\n * FOR d IN some-collection\n * ${filterColor}\n * RETURN d\n * `);\n * ```\n *\n * @example\n * ```js\n * // WARNING: We explicitly trust the environment variable to be safe!\n * const filter = literal(process.env.FILTER_STATEMENT);\n * const users = await db.query(aql`\n * FOR user IN users\n * ${filter}\n * RETURN user\n * `);\n * ```\n */\nexport function literal(\n value: string | number | boolean | AqlLiteral | null | undefined\n): AqlLiteral {\n if (isAqlLiteral(value)) {\n return value;\n }\n return {\n toAQL() {\n if (value === undefined) {\n return \"\";\n }\n return String(value);\n },\n };\n}\n\n/**\n * Constructs {@link AqlQuery} objects from an array of arbitrary values.\n *\n * **Note**: Nesting `aql` template strings is a much safer alternative\n * for most use cases. This low-level helper function only exists to\n * complement the `aql` tag when constructing complex queries from dynamic\n * arrays of query fragments.\n *\n * @param values - Array of values to join. These values will behave exactly\n * like values interpolated in an `aql` template string.\n * @param sep - Seperator to insert between values. This value will behave\n * exactly like a value passed to {@link literal}, i.e. it will be\n * inlined as-is, rather than being converted into a bind parameter.\n *\n * @example\n * ```js\n * const users = db.collection(\"users\");\n * const filters = [];\n * if (adminsOnly) filters.push(aql`FILTER user.admin`);\n * if (activeOnly) filters.push(aql`FILTER user.active`);\n * const result = await db.query(aql`\n * FOR user IN ${users}\n * ${join(filters)}\n * RETURN user\n * `);\n * ```\n *\n * @example\n * ```js\n * const users = db.collection(\"users\");\n * const keys = [\"jreyes\", \"ghermann\"];\n *\n * // BAD! NEEDLESSLY COMPLEX!\n * const docs = keys.map(key => aql`DOCUMENT(${users}, ${key}`));\n * const result = await db.query(aql`\n * FOR user IN [\n * ${join(docs, \", \")}\n * ]\n * RETURN user\n * `);\n * // Query:\n * // FOR user IN [\n * // DOCUMENT(@@value0, @value1), DOCUMENT(@@value0, @value2)\n * // ]\n * // RETURN user\n * // Bind parameters:\n * // @value0 -> \"users\"\n * // value1 -> \"jreyes\"\n * // value2 -> \"ghermann\"\n *\n * // GOOD! MUCH SIMPLER!\n * const result = await db.query(aql`\n * FOR key IN ${keys}\n * LET user = DOCUMENT(${users}, key)\n * RETURN user\n * `);\n * // Query:\n * // FOR user IN @value0\n * // LET user = DOCUMENT(@@value1, key)\n * // RETURN user\n * // Bind parameters:\n * // value0 -> [\"jreyes\", \"ghermann\"]\n * // @value1 -> \"users\"\n * ```\n */\nexport function join(values: AqlValue[], sep: string = \" \"): GeneratedAqlQuery {\n if (!values.length) {\n return aql``;\n }\n if (values.length === 1) {\n return aql`${values[0]}`;\n }\n return aql([\"\", ...Array(values.length - 1).fill(sep), \"\"] as any, ...values);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"aql.js","sourceRoot":"","sources":["../src/aql.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * ```js\n * import { aql } from \"arangojs/aql\";\n * ```\n *\n * The \"aql\" module provides the {@link aql} template string handler and\n * helper functions, as well as associated types and interfaces for TypeScript.\n *\n * The aql function and namespace is also re-exported by the \"index\" module.\n *\n * @packageDocumentation\n */\nimport { isArangoAnalyzer } from \"./analyzer\";\nimport { ArangoCollection, isArangoCollection } from \"./collection\";\nimport { Graph, isArangoGraph } from \"./graph\";\nimport { isArangoView, View } from \"./view\";\n\ndeclare const type: unique symbol;\n\n/**\n * Generic AQL query object consisting of an AQL query string and its bind\n * parameters.\n */\nexport interface AqlQuery<T = any> {\n [type]?: T | any;\n /**\n * An AQL query string.\n */\n query: string;\n /**\n * An object mapping AQL bind parameter names to their respective values.\n *\n * Names of parameters representing collections are prefixed with an\n * at-symbol.\n */\n bindVars: Record<string, any>;\n}\n\n/**\n * Derived type representing AQL query objects generated by the AQL helper\n * functions and the AQL template string handler. These objects can be fed\n * back into these helper functions to be inlined or merged in complex queries.\n *\n * @internal\n */\nexport interface GeneratedAqlQuery<T = any> extends AqlQuery<T> {\n /**\n * @internal\n */\n _source: () => { strings: string[]; args: AqlValue[] };\n}\n\n/**\n * An object representing a trusted AQL literal that will be inlined directly\n * when used in an AQL template or passed to AQL helper functions.\n *\n * Arbitrary values can be converted to trusted AQL literals by passing them\n * to the {@link literal} helper function.\n */\nexport interface AqlLiteral {\n /**\n * @internal\n *\n * Returns a string representation of this AQL literal that can be inlined\n * in an AQL template.\n */\n toAQL: () => string;\n}\n\n/**\n * A value that can be used in an AQL template string or passed to an AQL\n * helper function.\n */\nexport type AqlValue =\n | ArangoCollection\n | View\n | Graph\n | GeneratedAqlQuery\n | AqlLiteral\n | string\n | number\n | boolean\n | null\n | undefined\n | Record<string, any>\n | any[];\n\n/**\n * Indicates whether the given value is an {@link AqlQuery}.\n *\n * @param query - A value that might be an `AqlQuery`.\n */\nexport function isAqlQuery(query: any): query is AqlQuery {\n return Boolean(query && typeof query.query === \"string\" && query.bindVars);\n}\n\n/**\n * Indicates whether the given value is a {@link GeneratedAqlQuery}.\n *\n * @param query - A value that might be a `GeneratedAqlQuery`.\n *\n * @internal\n */\nexport function isGeneratedAqlQuery(query: any): query is GeneratedAqlQuery {\n return isAqlQuery(query) && typeof (query as any)._source === \"function\";\n}\n\n/**\n * Indicates whether the given value is an {@link AqlLiteral}.\n *\n * @param literal - A value that might be an `AqlLiteral`.\n */\nexport function isAqlLiteral(literal: any): literal is AqlLiteral {\n return Boolean(literal && typeof literal.toAQL === \"function\");\n}\n\n/**\n * Template string handler (template tag) for AQL queries.\n *\n * The `aql` tag can be used to write complex AQL queries as multi-line strings\n * without having to worry about `bindVars` and the distinction between\n * collections and regular parameters.\n *\n * Tagged template strings will return an {@link AqlQuery} object with\n * `query` and `bindVars` attributes reflecting any interpolated values.\n *\n * Any {@link collection.ArangoCollection} instance used in a query string will\n * be recognized as a collection reference and generate an AQL collection bind\n * parameter instead of a regular AQL value bind parameter.\n *\n * **Note**: you should always use the `aql` template tag when writing\n * dynamic AQL queries instead of using untagged (normal) template strings.\n * Untagged template strings will inline any interpolated values and return\n * a plain string as result. The `aql` template tag will only inline references\n * to the interpolated values and produce an AQL query object containing both\n * the query and the values. This prevents most injection attacks when using\n * untrusted values in dynamic queries.\n *\n * @example\n * ```js\n * // Some user-supplied string that may be malicious\n * const untrustedValue = req.body.email;\n *\n * // Without aql tag: BAD! DO NOT DO THIS!\n * const badQuery = `\n * FOR user IN users\n * FILTER user.email == \"${untrustedValue}\"\n * RETURN user\n * `;\n * // e.g. if untrustedValue is '\" || user.admin == true || \"':\n * // Query:\n * // FOR user IN users\n * // FILTER user.email == \"\" || user.admin == true || \"\"\n * // RETURN user\n *\n * // With the aql tag: GOOD! MUCH SAFER!\n * const betterQuery = aql`\n * FOR user IN users\n * FILTER user.email == ${untrustedValue}\n * RETURN user\n * `;\n * // Query:\n * // FOR user IN users\n * // FILTER user.email == @value0\n * // RETURN user\n * // Bind parameters:\n * // value0 -> untrustedValue\n * ```\n *\n * @example\n * ```js\n * const collection = db.collection(\"some-collection\");\n * const minValue = 23;\n * const result = await db.query(aql`\n * FOR d IN ${collection}\n * FILTER d.num > ${minValue}\n * RETURN d\n * `);\n *\n * // Equivalent raw query object\n * const result2 = await db.query({\n * query: `\n * FOR d IN @@collection\n * FILTER d.num > @minValue\n * RETURN d\n * `,\n * bindVars: {\n * \"@collection\": collection.name,\n * minValue: minValue\n * }\n * });\n * ```\n *\n * @example\n * ```js\n * const collection = db.collection(\"some-collection\");\n * const color = \"green\";\n * const filter = aql`FILTER d.color == ${color}'`;\n * const result = await db.query(aql`\n * FOR d IN ${collection}\n * ${filter}\n * RETURN d\n * `);\n * ```\n */\nexport function aql<T = any>(\n templateStrings: TemplateStringsArray,\n ...args: AqlValue[]\n): GeneratedAqlQuery<T> {\n const strings = [...templateStrings];\n const bindVars: Record<string, any> = {};\n const bindValues = [];\n let query = strings[0];\n for (let i = 0; i < args.length; i++) {\n const rawValue = args[i];\n let value = rawValue;\n if (isGeneratedAqlQuery(rawValue)) {\n const src = rawValue._source();\n if (src.args.length) {\n query += src.strings[0];\n args.splice(i, 1, ...src.args);\n strings.splice(\n i,\n 2,\n strings[i] + src.strings[0],\n ...src.strings.slice(1, src.args.length),\n src.strings[src.args.length] + strings[i + 1]\n );\n } else {\n query += rawValue.query + strings[i + 1];\n args.splice(i, 1);\n strings.splice(i, 2, strings[i] + rawValue.query + strings[i + 1]);\n }\n i -= 1;\n continue;\n }\n if (rawValue === undefined) {\n query += strings[i + 1];\n continue;\n }\n if (isAqlLiteral(rawValue)) {\n query += `${rawValue.toAQL()}${strings[i + 1]}`;\n continue;\n }\n const index = bindValues.indexOf(rawValue);\n const isKnown = index !== -1;\n let name = `value${isKnown ? index : bindValues.length}`;\n if (\n isArangoCollection(rawValue) ||\n isArangoGraph(rawValue) ||\n isArangoView(rawValue) ||\n isArangoAnalyzer(rawValue)\n ) {\n name = `@${name}`;\n value = rawValue.name;\n }\n if (!isKnown) {\n bindValues.push(rawValue);\n bindVars[name] = value;\n }\n query += `@${name}${strings[i + 1]}`;\n }\n return {\n query,\n bindVars,\n _source: () => ({ strings, args }),\n };\n}\n\n/**\n * Marks an arbitrary scalar value (i.e. a string, number or boolean) as\n * safe for being inlined directly into AQL queries when used in an `aql`\n * template string, rather than being converted into a bind parameter.\n *\n * **Note**: Nesting `aql` template strings is a much safer alternative for\n * most use cases. This low-level helper function only exists to help with\n * rare edge cases where a trusted AQL query fragment must be read from a\n * string (e.g. when reading query fragments from JSON) and should only be\n * used as a last resort.\n *\n * @example\n * ```js\n * // BAD! DO NOT DO THIS!\n * const sortDirection = literal('ASC');\n *\n * // GOOD! DO THIS INSTEAD!\n * const sortDirection = aql`ASC`;\n * ```\n *\n * @example\n * ```js\n * // BAD! DO NOT DO THIS!\n * const filterColor = literal('FILTER d.color == \"green\"');\n * const result = await db.query(aql`\n * FOR d IN some-collection\n * ${filterColor}\n * RETURN d\n * `);\n *\n * // GOOD! DO THIS INSTEAD!\n * const color = \"green\";\n * const filterColor = aql`FILTER d.color === ${color}`;\n * const result = await db.query(aql`\n * FOR d IN some-collection\n * ${filterColor}\n * RETURN d\n * `);\n * ```\n *\n * @example\n * ```js\n * // WARNING: We explicitly trust the environment variable to be safe!\n * const filter = literal(process.env.FILTER_STATEMENT);\n * const users = await db.query(aql`\n * FOR user IN users\n * ${filter}\n * RETURN user\n * `);\n * ```\n */\nexport function literal(\n value: string | number | boolean | AqlLiteral | null | undefined\n): AqlLiteral {\n if (isAqlLiteral(value)) {\n return value;\n }\n return {\n toAQL() {\n if (value === undefined) {\n return \"\";\n }\n return String(value);\n },\n };\n}\n\n/**\n * Constructs {@link AqlQuery} objects from an array of arbitrary values.\n *\n * **Note**: Nesting `aql` template strings is a much safer alternative\n * for most use cases. This low-level helper function only exists to\n * complement the `aql` tag when constructing complex queries from dynamic\n * arrays of query fragments.\n *\n * @param values - Array of values to join. These values will behave exactly\n * like values interpolated in an `aql` template string.\n * @param sep - Seperator to insert between values. This value will behave\n * exactly like a value passed to {@link literal}, i.e. it will be\n * inlined as-is, rather than being converted into a bind parameter.\n *\n * @example\n * ```js\n * const users = db.collection(\"users\");\n * const filters = [];\n * if (adminsOnly) filters.push(aql`FILTER user.admin`);\n * if (activeOnly) filters.push(aql`FILTER user.active`);\n * const result = await db.query(aql`\n * FOR user IN ${users}\n * ${join(filters)}\n * RETURN user\n * `);\n * ```\n *\n * @example\n * ```js\n * const users = db.collection(\"users\");\n * const keys = [\"jreyes\", \"ghermann\"];\n *\n * // BAD! NEEDLESSLY COMPLEX!\n * const docs = keys.map(key => aql`DOCUMENT(${users}, ${key}`));\n * const result = await db.query(aql`\n * FOR user IN [\n * ${join(docs, \", \")}\n * ]\n * RETURN user\n * `);\n * // Query:\n * // FOR user IN [\n * // DOCUMENT(@@value0, @value1), DOCUMENT(@@value0, @value2)\n * // ]\n * // RETURN user\n * // Bind parameters:\n * // @value0 -> \"users\"\n * // value1 -> \"jreyes\"\n * // value2 -> \"ghermann\"\n *\n * // GOOD! MUCH SIMPLER!\n * const result = await db.query(aql`\n * FOR key IN ${keys}\n * LET user = DOCUMENT(${users}, key)\n * RETURN user\n * `);\n * // Query:\n * // FOR user IN @value0\n * // LET user = DOCUMENT(@@value1, key)\n * // RETURN user\n * // Bind parameters:\n * // value0 -> [\"jreyes\", \"ghermann\"]\n * // @value1 -> \"users\"\n * ```\n */\nexport function join(values: AqlValue[], sep: string = \" \"): GeneratedAqlQuery {\n if (!values.length) {\n return aql``;\n }\n if (values.length === 1) {\n return aql`${values[0]}`;\n }\n return aql([\"\", ...Array(values.length - 1).fill(sep), \"\"] as any, ...values);\n}\n"]}
|
package/connection.js
CHANGED
|
@@ -451,7 +451,7 @@ class Connection {
|
|
|
451
451
|
...this._headers,
|
|
452
452
|
"content-type": contentType,
|
|
453
453
|
"x-arango-version": String(this._arangoVersion),
|
|
454
|
-
"x-arango-driver": `arangojs/8.4.
|
|
454
|
+
"x-arango-driver": `arangojs/8.4.1 (cloud)`,
|
|
455
455
|
};
|
|
456
456
|
if (this._transactionId) {
|
|
457
457
|
extraHeaders["x-arango-trx-id"] = this._transactionId;
|
package/package.json
CHANGED
package/web.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.arangojs=e():t.arangojs=e()}(self,(function(){return function(){var t={192:function(t,e,r){var n;n="undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self?self:{},t.exports=n},534:function(t){t.exports=function(t){if(!t)return!1;var r=e.call(t);return"[object Function]"===r||"function"==typeof t&&"[object RegExp]"!==r||"undefined"!=typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)};var e=Object.prototype.toString},69:function(t){var e=function(t){return t.replace(/^\s+|\s+$/g,"")};t.exports=function(t){if(!t)return{};for(var r,n={},o=e(t).split("\n"),i=0;i<o.length;i++){var s=o[i],a=s.indexOf(":"),h=e(s.slice(0,a)).toLowerCase(),u=e(s.slice(a+1));void 0===n[h]?n[h]=u:(r=n[h],"[object Array]"===Object.prototype.toString.call(r)?n[h].push(u):n[h]=[n[h],u])}return n}},588:function(t){var e=function(t){"use strict";var e,r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",h=i.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var i=e&&e.prototype instanceof y?e:y,s=Object.create(i.prototype),a=new S(n||[]);return o(s,"_invoke",{value:C(t,r,a)}),s}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var d="suspendedStart",p="executing",m="completed",f={};function y(){}function _(){}function g(){}var b={};u(b,s,(function(){return this}));var v=Object.getPrototypeOf,w=v&&v(v(I([])));w&&w!==r&&n.call(w,s)&&(b=w);var q=g.prototype=y.prototype=Object.create(b);function x(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function T(t,e){function r(o,i,s,a){var h=l(t[o],t,i);if("throw"!==h.type){var u=h.arg,c=u.value;return c&&"object"==typeof c&&n.call(c,"__await")?e.resolve(c.__await).then((function(t){r("next",t,s,a)}),(function(t){r("throw",t,s,a)})):e.resolve(c).then((function(t){u.value=t,s(u)}),(function(t){return r("throw",t,s,a)}))}a(h.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function C(t,e,r){var n=d;return function(o,i){if(n===p)throw new Error("Generator is already running");if(n===m){if("throw"===o)throw i;return A()}for(r.method=o,r.arg=i;;){var s=r.delegate;if(s){var a=U(s,r);if(a){if(a===f)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===d)throw n=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var h=l(t,e,r);if("normal"===h.type){if(n=r.done?m:"suspendedYield",h.arg===f)continue;return{value:h.arg,done:r.done}}"throw"===h.type&&(n=m,r.method="throw",r.arg=h.arg)}}}function U(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,U(t,r),"throw"===r.method))return f;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var o=l(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,f;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,f):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}function R(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(R,this),this.reset(!0)}function I(t){if(t){var r=t[s];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}return{next:A}}function A(){return{value:e,done:!0}}return _.prototype=g,o(q,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:_,configurable:!0}),_.displayName=u(g,h,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===_||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,u(t,h,"GeneratorFunction")),t.prototype=Object.create(q),t},t.awrap=function(t){return{__await:t}},x(T.prototype),u(T.prototype,a,(function(){return this})),t.AsyncIterator=T,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var s=new T(c(e,r,n,o),i);return t.isGeneratorFunction(r)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},x(q),u(q,h,"Generator"),u(q,s,(function(){return this})),u(q,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=I,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(E),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return a.type="throw",a.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],a=s.completion;if("root"===s.tryLoc)return o("end");if(s.tryLoc<=this.prev){var h=n.call(s,"catchLoc"),u=n.call(s,"finallyLoc");if(h&&u){if(this.prev<s.catchLoc)return o(s.catchLoc,!0);if(this.prev<s.finallyLoc)return o(s.finallyLoc)}else if(h){if(this.prev<s.catchLoc)return o(s.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return o(s.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=t,s.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:I(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),f}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}},994:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(107);class o{constructor(t){if(this.length=0,this.unlinkCleanup=t=>{this.first===t&&(this.first=this.first.behind),this.last===t&&(this.last=this.last.before),this.length--},t){t instanceof o&&(t=t.values());for(const e of t)this.push(e)}}clear(t=!1){if(t)for(;this.first;)this.first.unlink(!0);this.first=this.last=void 0,this.length=0}every(t,e){e&&(t=t.bind(e));for(const e of this.keys())if(!t(e.value,e,this))return!1;return!0}filter(t,e){e&&(t=t.bind(e));const r=new o;for(const[e,n]of this)t(n,e,this)&&r.push(n);return r}find(t,e){e&&(t=t.bind(e));for(const[e,r]of this)if(t(r,e,this))return r}findItem(t,e){e&&(t=t.bind(e));for(const[e,r]of this)if(t(r,e,this))return e}forEach(t,e){e&&(t=t.bind(e));for(const[e,r]of this)t(r,e,this)}includes(t,e=0){let r=this.getItemByIndex(e);for(;r;){if(r.value===t)return!0;r=r.behind}return!1}itemOf(t,e=0){let r=this.getItemByIndex(e);for(;r;){if(r.value===t)return r;r=r.behind}}lastItemOf(t,e=-1){let r=this.getItemByIndex(e);for(;r;){if(r.value===t)return r;r=r.before}}map(t,e){e&&(t=t.bind(e));const r=new o;for(const[e,n]of this)r.push(t(n,e,this));return r}reduce(t,e){let r=this.first;if(!r){if(!e)throw new TypeError("Empty accumulator on empty LinkedList is not allowed.");return e}if(void 0===e){if(e=r.value,!r.behind)return e;r=r.behind}do{e=t(e,r.value,r,this),r=r.behind}while(r);return e}reduceRight(t,e){let r=this.last;if(!r){if(!e)throw new TypeError("Empty accumulator on empty LinkedList is not allowed.");return e}if(void 0===e){if(e=r.value,!r.before)return e;r=r.before}do{e=t(e,r.value,r,this),r=r.before}while(r);return e}some(t,e){e&&(t=t.bind(e));for(const[e,r]of this)if(t(r,e,this))return!0;return!1}join(t){return[...this.values()].join(t)}concat(...t){const e=new o(this);for(const r of t)r instanceof o?e.push(...r.values()):e.push(r);return e}pop(){if(!this.last)return;const t=this.last;return t.unlink(),t.value}push(...t){for(const e of t){const t=new n.LinkedListItem(e,this.unlinkCleanup);this.first&&this.last?(this.last.insertBehind(t),this.last=t):this.first=this.last=t,this.length++}return this.length}unshift(...t){for(const e of t){const t=new n.LinkedListItem(e,this.unlinkCleanup);this.last&&this.first?(t.insertBehind(this.first),this.first=t):this.first=this.last=t,this.length++}return this.length}remove(t){for(const e of this.keys())if(e.value===t)return e.unlink(),!0;return!1}removeAllOccurrences(t){let e=!1;for(const r of this.keys())r.value===t&&(r.unlink(),e=!0);return e}shift(){if(!this.first)return;const t=this.first;return t.unlink(),t.value}*[Symbol.iterator](){let t=this.first;if(t)do{yield[t,t.value],t=t.behind}while(t)}entries(){return this[Symbol.iterator]()}*keys(){let t=this.first;if(t)do{yield t,t=t.behind}while(t)}*values(){let t=this.first;if(t)do{yield t.value,t=t.behind}while(t)}getItemByIndex(t){if(void 0===t)throw new Error("index must be a number!");if(!this.first)return;let e;if(t>0)for(e=this.first;e&&t--;)e=e.behind;else{if(!(t<0))return this.first;for(e=this.last;e&&++t;)e=e.before}return e}}e.LinkedList=o},107:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LinkedListItem=class{constructor(t,e){this.value=t,this.unlinkCleanup=e}insertBehind(t){if(t.insertBefore(this),this.behind){let e=t;for(;e.behind;)e=e.behind;this.behind.insertBefore(e),e.insertBehind(this.behind)}this.behind=t}unlink(t=!1){this.before&&(this.before.behind=this.behind),this.behind&&(this.behind.before=this.before),this.unlinkCleanup&&this.unlinkCleanup(this),this.unlinkCleanup=void 0,t&&(this.before=this.behind=void 0)}insertBefore(t){this.before=t,this.unlinkCleanup||(this.unlinkCleanup=t.unlinkCleanup)}}},95:function(t,e,r){"use strict";function n(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),n(r(994)),n(r(107))},377:function(t,e,r){"use strict";var n=r(192),o=r(534),i=r(69),s=r(786);function a(t,e,r){var n=t;return o(e)?(r=e,"string"==typeof t&&(n={uri:t})):n=s(e,{uri:t}),n.callback=r,n}function h(t,e,r){return u(e=a(t,e,r))}function u(t){if(void 0===t.callback)throw new Error("callback argument missing");var e=!1,r=function(r,n,o){e||(e=!0,t.callback(r,n,o))};function n(){var t=void 0;if(t=c.response?c.response:c.responseText||function(t){try{if("document"===t.responseType)return t.responseXML;var e=t.responseXML&&"parsererror"===t.responseXML.documentElement.nodeName;if(""===t.responseType&&!e)return t.responseXML}catch(t){}return null}(c),_)try{t=JSON.parse(t)}catch(t){}return t}function o(t){return clearTimeout(l),t instanceof Error||(t=new Error(""+(t||"Unknown XMLHttpRequest Error"))),t.statusCode=0,r(t,g)}function s(){if(!u){var e;clearTimeout(l),e=t.useXDR&&void 0===c.status?200:1223===c.status?204:c.status;var o=g,s=null;return 0!==e?(o={body:n(),statusCode:e,method:p,headers:{},url:d,rawRequest:c},c.getAllResponseHeaders&&(o.headers=i(c.getAllResponseHeaders()))):s=new Error("Internal XMLHttpRequest Error"),r(s,o,o.body)}}var a,u,c=t.xhr||null;c||(c=t.cors||t.useXDR?new h.XDomainRequest:new h.XMLHttpRequest);var l,d=c.url=t.uri||t.url,p=c.method=t.method||"GET",m=t.body||t.data,f=c.headers=t.headers||{},y=!!t.sync,_=!1,g={body:void 0,headers:{},statusCode:0,method:p,url:d,rawRequest:c};if("json"in t&&!1!==t.json&&(_=!0,f.accept||f.Accept||(f.Accept="application/json"),"GET"!==p&&"HEAD"!==p&&(f["content-type"]||f["Content-Type"]||(f["Content-Type"]="application/json"),m=JSON.stringify(!0===t.json?m:t.json))),c.onreadystatechange=function(){4===c.readyState&&setTimeout(s,0)},c.onload=s,c.onerror=o,c.onprogress=function(){},c.onabort=function(){u=!0},c.ontimeout=o,c.open(p,d,!y,t.username,t.password),y||(c.withCredentials=!!t.withCredentials),!y&&t.timeout>0&&(l=setTimeout((function(){if(!u){u=!0,c.abort("timeout");var t=new Error("XMLHttpRequest timeout");t.code="ETIMEDOUT",o(t)}}),t.timeout)),c.setRequestHeader)for(a in f)f.hasOwnProperty(a)&&c.setRequestHeader(a,f[a]);else if(t.headers&&!function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}(t.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(c.responseType=t.responseType),"beforeSend"in t&&"function"==typeof t.beforeSend&&t.beforeSend(c),c.send(m||null),c}t.exports=h,t.exports.default=h,h.XMLHttpRequest=n.XMLHttpRequest||function(){},h.XDomainRequest="withCredentials"in new h.XMLHttpRequest?h.XMLHttpRequest:n.XDomainRequest,function(t,e){for(var r=0;r<t.length;r++)e(t[r])}(["get","put","post","patch","head","delete"],(function(t){h["delete"===t?"del":t]=function(e,r,n){return(r=a(e,r,n)).method=t.toUpperCase(),u(r)}}))},786:function(t){t.exports=function(){for(var t={},r=0;r<arguments.length;r++){var n=arguments[r];for(var o in n)e.call(n,o)&&(t[o]=n[o])}return t};var e=Object.prototype.hasOwnProperty},594:function(t,e,r){"use strict";r.d(e,{L:function(){return s},W:function(){return i}});var n=r(43),o=r(979);function i(t){return Boolean(t&&t.isArangoAnalyzer)}class s{constructor(t,e){this._db=t,this._name=e.normalize("NFC")}get isArangoAnalyzer(){return!0}get name(){return this._name}async exists(){try{return await this.get(),!0}catch(t){if((0,n.Pp)(t)&&t.errorNum===o.IB)return!1;throw t}}get(){return this._db.request({path:`/_api/analyzer/${encodeURIComponent(this._name)}`})}create(t){return this._db.request({method:"POST",path:"/_api/analyzer",body:{name:this._name,...t}})}drop(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._db.request({method:"DELETE",path:`/_api/analyzer/${encodeURIComponent(this._name)}`,qs:{force:t}})}}},97:function(t,e,r){"use strict";r.r(e),r.d(e,{aql:function(){return c},isAqlLiteral:function(){return u},isAqlQuery:function(){return a},isGeneratedAqlQuery:function(){return h},join:function(){return d},literal:function(){return l}});var n=r(594),o=r(91),i=r(909),s=r(94);function a(t){return Boolean(t&&"string"==typeof t.query&&t.bindVars)}function h(t){return a(t)&&"function"==typeof t._source}function u(t){return Boolean(t&&"function"==typeof t.toAQL)}function c(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),a=1;a<e;a++)r[a-1]=arguments[a];const c=[...t],l={},d=[];let p=c[0];for(let t=0;t<r.length;t++){const e=r[t];let a=e;if(h(e)){const n=e._source();n.args.length?(p+=n.strings[0],r.splice(t,1,...n.args),c.splice(t,2,c[t]+n.strings[0],...n.strings.slice(1,n.args.length),n.strings[n.args.length]+c[t+1])):(p+=e.query+c[t+1],r.splice(t,1),c.splice(t,2,c[t]+e.query+c[t+1])),t-=1;continue}if(void 0===e){p+=c[t+1];continue}if(u(e)){p+=`${e.toAQL()}${c[t+1]}`;continue}const m=d.indexOf(e),f=-1!==m;let y=`value${f?m:d.length}`;((0,o.isArangoCollection)(e)||(0,i.Vp)(e)||(0,s.isArangoView)(e)||(0,n.W)(e))&&(y=`@${y}`,a=e.name),f||(d.push(e),l[y]=a),p+=`@${y}${c[t+1]}`}return{query:p,bindVars:l,_source:()=>({strings:c,args:r})}}function l(t){return u(t)?t:{toAQL(){return void 0===t?"":String(t)}}}function d(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";return t.length?1===t.length?c`${t[0]}`:c(["",...Array(t.length-1).fill(e),""],...t):c``}},91:function(t,e,r){"use strict";r.r(e),r.d(e,{Collection:function(){return p},CollectionStatus:function(){return d},CollectionType:function(){return l},collectionToString:function(){return c},isArangoCollection:function(){return u}});var n=r(97),o=r(267),i=r(974),s=r(43);function a(t,e){if("string"!=typeof t){if(t.id)return a(t.id,e);throw new Error("Index handle must be a string or an object with an id attribute")}if(t.includes("/")){const[r,...n]=t.split("/"),o=r.normalize("NFC");if(o!==e)throw new Error(`Index ID "${t}" does not match collection name "${e}"`);return[o,t=n.join("/").normalize("NFC")].join("/")}return`${e}/${String(t).normalize("NFC")}`}var h=r(979);function u(t){return Boolean(t&&t.isArangoCollection)}function c(t){return u(t)?String(t.name):String(t).normalize("NFC")}let l,d;!function(t){t[t.DOCUMENT_COLLECTION=2]="DOCUMENT_COLLECTION",t[t.EDGE_COLLECTION=3]="EDGE_COLLECTION"}(l||(l={})),function(t){t[t.NEWBORN=1]="NEWBORN",t[t.UNLOADED=2]="UNLOADED",t[t.LOADED=3]="LOADED",t[t.UNLOADING=4]="UNLOADING",t[t.DELETED=5]="DELETED",t[t.LOADING=6]="LOADING"}(d||(d={}));class p{constructor(t,e){this._name=e.normalize("NFC"),this._db=t}get isArangoCollection(){return!0}get name(){return this._name}get(){return this._db.request({path:`/_api/collection/${encodeURIComponent(this._name)}`})}async exists(){try{return await this.get(),!0}catch(t){if((0,s.Pp)(t)&&t.errorNum===h.Xf)return!1;throw t}}create(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{waitForSyncReplication:e,enforceReplicationFactor:r,...o}=t;o.computedValues&&(o.computedValues=o.computedValues.map((t=>(0,n.isAqlLiteral)(t.expression)?{...t,expression:t.expression.toAQL()}:(0,n.isAqlQuery)(t.expression)?{...t,expression:t.expression.query}:t)));const i={};return"boolean"==typeof e&&(i.waitForSyncReplication=e?1:0),"boolean"==typeof r&&(i.enforceReplicationFactor=r?1:0),this._db.request({method:"POST",path:"/_api/collection",qs:i,body:{...o,name:this._name}})}properties(t){return t?this._db.request({method:"PUT",path:`/_api/collection/${encodeURIComponent(this._name)}/properties`,body:t}):this._db.request({path:`/_api/collection/${encodeURIComponent(this._name)}/properties`})}count(){return this._db.request({path:`/_api/collection/${encodeURIComponent(this._name)}/count`})}async recalculateCount(){return this._db.request({method:"PUT",path:`/_api/collection/${encodeURIComponent(this._name)}/recalculateCount`},(t=>t.body.result))}figures(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._db.request({path:`/_api/collection/${encodeURIComponent(this._name)}/figures`,qs:{details:t}})}revision(){return this._db.request({path:`/_api/collection/${encodeURIComponent(this._name)}/revision`})}checksum(t){return this._db.request({path:`/_api/collection/${encodeURIComponent(this._name)}/checksum`,qs:t})}async loadIndexes(){return this._db.request({method:"PUT",path:`/_api/collection/${encodeURIComponent(this._name)}/loadIndexesIntoMemory`},(t=>t.body.result))}async rename(t){const e=await this._db.renameCollection(this._name,t);return this._name=t.normalize("NFC"),e}truncate(){return this._db.request({method:"PUT",path:`/_api/collection/${this._name}/truncate`})}drop(t){return this._db.request({method:"DELETE",path:`/_api/collection/${encodeURIComponent(this._name)}`,qs:t})}getResponsibleShard(t){return this._db.request({method:"PUT",path:`/_api/collection/${encodeURIComponent(this._name)}/responsibleShard`,body:t},(t=>t.body.shardId))}documentId(t){return(0,i.q)(t,this._name)}async documentExists(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{ifMatch:r,ifNoneMatch:n}=e,o={};r&&(o["if-match"]=r),n&&(o["if-none-match"]=n);try{return await this._db.request({method:"HEAD",path:`/_api/document/${encodeURI((0,i.q)(t,this._name))}`,headers:o},(t=>{if(n&&304===t.statusCode)throw new s.oo(t);return!0}))}catch(t){if(404===t.code)return!1;throw t}}documents(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{allowDirtyRead:r}=e;return this._db.request({method:"PUT",path:`/_api/document/${encodeURIComponent(this._name)}`,qs:{onlyget:!0},allowDirtyRead:r,body:t})}async document(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&(e={graceful:e});const{allowDirtyRead:r,graceful:n=!1,ifMatch:o,ifNoneMatch:a}=e,u={};o&&(u["if-match"]=o),a&&(u["if-none-match"]=a);const c=this._db.request({path:`/_api/document/${encodeURI((0,i.q)(t,this._name))}`,headers:u,allowDirtyRead:r},(t=>{if(a&&304===t.statusCode)throw new s.oo(t);return t.body}));if(!n)return c;try{return await c}catch(t){if((0,s.Pp)(t)&&t.errorNum===h.Gk)return null;throw t}}save(t,e){return this._db.request({method:"POST",path:`/_api/document/${encodeURIComponent(this._name)}`,body:t,qs:e},(t=>null!=e&&e.silent?void 0:t.body))}saveAll(t,e){return this._db.request({method:"POST",path:`/_api/document/${encodeURIComponent(this._name)}`,body:t,qs:e},(t=>null!=e&&e.silent?void 0:t.body))}replace(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{ifMatch:n,...o}=r,s={};return n&&(s["if-match"]=n),this._db.request({method:"PUT",path:`/_api/document/${encodeURI((0,i.q)(t,this._name))}`,headers:s,body:e,qs:o},(t=>null!=r&&r.silent?void 0:t.body))}replaceAll(t,e){return this._db.request({method:"PUT",path:`/_api/document/${encodeURIComponent(this._name)}`,body:t,qs:e},(t=>null!=e&&e.silent?void 0:t.body))}update(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{ifMatch:n,...o}=r,s={};return n&&(s["if-match"]=n),this._db.request({method:"PATCH",path:`/_api/document/${encodeURI((0,i.q)(t,this._name))}`,headers:s,body:e,qs:o},(t=>null!=r&&r.silent?void 0:t.body))}updateAll(t,e){return this._db.request({method:"PATCH",path:`/_api/document/${encodeURIComponent(this._name)}`,body:t,qs:e},(t=>null!=e&&e.silent?void 0:t.body))}remove(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{ifMatch:r,...n}=e,o={};return r&&(o["if-match"]=r),this._db.request({method:"DELETE",path:`/_api/document/${encodeURI((0,i.q)(t,this._name))}`,headers:o,qs:n},(t=>null!=e&&e.silent?void 0:t.body))}removeAll(t,e){return this._db.request({method:"DELETE",path:`/_api/document/${encodeURIComponent(this._name)}`,body:t,qs:e},(t=>null!=e&&e.silent?void 0:t.body))}import(t){const e={...arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},collection:this._name};return Array.isArray(t)&&(e.type=Array.isArray(t[0])?void 0:"documents",t=t.map((t=>JSON.stringify(t))).join("\r\n")+"\r\n"),this._db.request({method:"POST",path:"/_api/import",body:t,isBinary:!0,qs:e})}_edges(t,e,r){const{allowDirtyRead:n}=e;return this._db.request({path:`/_api/edges/${encodeURIComponent(this._name)}`,allowDirtyRead:n,qs:{direction:r,vertex:(0,i.q)(t,this._name,!1)}})}edges(t,e){return this._edges(t,e)}inEdges(t,e){return this._edges(t,e,"in")}outEdges(t,e){return this._edges(t,e,"out")}traversal(t,e){return this._db.request({method:"POST",path:"/_api/traversal",body:{...e,startVertex:t,edgeCollection:this._name}},(t=>t.body.result))}list(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"id";return this._db.request({method:"PUT",path:"/_api/simple/all-keys",body:{type:t,collection:this._name}},(t=>new o.o(this._db,t.body,t.arangojsHostUrl).items))}all(t){return this._db.request({method:"PUT",path:"/_api/simple/all",body:{...t,collection:this._name}},(t=>new o.o(this._db,t.body,t.arangojsHostUrl).items))}any(){return this._db.request({method:"PUT",path:"/_api/simple/any",body:{collection:this._name}},(t=>t.body.document))}byExample(t,e){return this._db.request({method:"PUT",path:"/_api/simple/by-example",body:{...e,example:t,collection:this._name}},(t=>new o.o(this._db,t.body,t.arangojsHostUrl).items))}firstExample(t){return this._db.request({method:"PUT",path:"/_api/simple/first-example",body:{example:t,collection:this._name}},(t=>t.body.document))}removeByExample(t,e){return this._db.request({method:"PUT",path:"/_api/simple/remove-by-example",body:{...e,example:t,collection:this._name}})}replaceByExample(t,e,r){return this._db.request({method:"PUT",path:"/_api/simple/replace-by-example",body:{...r,example:t,newValue:e,collection:this._name}})}updateByExample(t,e,r){return this._db.request({method:"PUT",path:"/_api/simple/update-by-example",body:{...r,example:t,newValue:e,collection:this._name}})}lookupByKeys(t){return this._db.request({method:"PUT",path:"/_api/simple/lookup-by-keys",body:{keys:t,collection:this._name}},(t=>t.body.documents))}removeByKeys(t,e){return this._db.request({method:"PUT",path:"/_api/simple/remove-by-keys",body:{options:e,keys:t,collection:this._name}})}indexes(){return this._db.request({path:"/_api/index",qs:{collection:this._name}},(t=>t.body.indexes))}index(t){return this._db.request({path:`/_api/index/${encodeURI(a(t,this._name))}`})}ensureIndex(t){const e={...t};return e.name&&(e.name=e.name.normalize("NFC")),this._db.request({method:"POST",path:"/_api/index",body:t,qs:{collection:this._name}})}dropIndex(t){return this._db.request({method:"DELETE",path:`/_api/index/${encodeURI(a(t,this._name))}`})}fulltext(t,e){let{index:r,...n}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this._db.request({method:"PUT",path:"/_api/simple/fulltext",body:{...n,index:r?a(r,this._name):void 0,attribute:t,query:e,collection:this._name}},(t=>new o.o(this._db,t.body,t.arangojsHostUrl).items))}compact(){return this._db.request({method:"PUT",path:`/_api/collection/${this._name}/compact`},(t=>t.body))}}},267:function(t,e,r){"use strict";r.d(e,{o:function(){return o}});var n=r(95);class o{constructor(t,e,r,o){const s=new n.LinkedList(e.result.length?[new n.LinkedList(e.result)]:[]);this._db=t,this._batches=s,this._id=e.id,this._hasMore=Boolean(e.id&&e.hasMore),this._nextBatchId=e.nextBatchId,this._hostUrl=r,this._count=e.count,this._extra=e.extra,this._allowDirtyRead=o,this._itemsCursor=new i(this,{get isEmpty(){return!s.length},more:()=>this._more(),shift:()=>{var t;let e=null===(t=s.first)||void 0===t?void 0:t.value;for(;e&&!e.length;){var r;s.shift(),e=null===(r=s.first)||void 0===r?void 0:r.value}if(!e)return;const n=e.shift();return e.length||s.shift(),n}})}async _more(){if(!this._id||!this.hasMore)return;const t=await this._db.request({method:"POST",path:this._nextBatchId?`/_api/cursor/${encodeURIComponent(this._id)}/${this._nextBatchId}`:`/_api/cursor/${encodeURIComponent(this._id)}`,hostUrl:this._hostUrl,allowDirtyRead:this._allowDirtyRead});this._batches.push(new n.LinkedList(t.result)),this._hasMore=t.hasMore,this._nextBatchId=t.nextBatchId}get items(){return this._itemsCursor}get extra(){return this._extra}get count(){return this._count}get hasMore(){return this._hasMore}get hasNext(){return this.hasMore||Boolean(this._batches.length)}async*[Symbol.asyncIterator](){for(;this.hasNext;)yield this.next()}async loadAll(){for(;this._hasMore;)await this._more()}async all(){return this.map((t=>t))}async next(){for(;!this._batches.length&&this.hasNext;)await this._more();if(!this._batches.length)return;const t=this._batches.shift();if(!t)return;const e=[...t.values()];return t.clear(!0),e}async forEach(t){let e=0;for(;this.hasNext;){const r=t(await this.next(),e,this);if(e++,!1===r)return r;this.hasNext&&await this._more()}return!0}async map(t){let e=0;const r=[];for(;this.hasNext;){const n=await this.next();r.push(t(n,e,this)),e++}return r}async flatMap(t){let e=0;const r=[];for(;this.hasNext;){const n=t(await this.next(),e,this);Array.isArray(n)?r.push(...n):r.push(n),e++}return r}async reduce(t,e){let r=0;if(!this.hasNext)return e;void 0===e&&(e=await this.next(),r+=1);let n=e;for(;this.hasNext;)n=t(n,await this.next(),r,this),r++;return n}async kill(){if(this._batches.length){for(const t of this._batches.values())t.clear();this._batches.clear()}if(this.hasNext)return this._db.request({method:"DELETE",path:`/_api/cursor/${encodeURIComponent(this._id)}`},(()=>{this._hasMore=!1}))}}class i{constructor(t,e){this._batches=t,this._view=e}get batches(){return this._batches}get extra(){return this.batches.extra}get count(){return this.batches.count}get hasNext(){return this.batches.hasNext}async*[Symbol.asyncIterator](){for(;this.hasNext;)yield this.next()}async all(){return this.batches.flatMap((t=>t))}async next(){for(;this._view.isEmpty&&this.batches.hasMore;)await this._view.more();if(!this._view.isEmpty)return this._view.shift()}async forEach(t){let e=0;for(;this.hasNext;){const r=t(await this.next(),e,this);if(e++,!1===r)return r}return!0}async map(t){let e=0;const r=[];for(;this.hasNext;){const n=await this.next();r.push(t(n,e,this)),e++}return r}async flatMap(t){let e=0;const r=[];for(;this.hasNext;){const n=t(await this.next(),e,this);Array.isArray(n)?r.push(...n):r.push(n),e++}return r}async reduce(t,e){let r=0;if(!this.hasNext)return e;void 0===e&&(e=await this.next(),r+=1);let n=e;for(;this.hasNext;)n=t(n,await this.next(),r,this),r++;return n}async kill(){return this.batches.kill()}}},928:function(t,e,r){"use strict";r.r(e),r.d(e,{Database:function(){return T},isArangoDatabase:function(){return q}});var n=r(594),o=r(97),i=r(91),s=r(95),a=r(43);function h(t){return btoa(t)}var u=r(979);function c(t){const e=t.match(/^(tcp|ssl|tls)((?::|\+).+)/);e&&(t=("tcp"===e[1]?"http":"https")+e[2]);const r=t.match(/^(?:(http|https)\+)?unix:\/\/(\/.+)/);return r&&(t=`${r[1]||"http"}://unix:${r[2]}`),t}var l=r(377);function d(){return{error:!0,message:this.message}}function p(t,e){const r=new URL(t),n=h(`${r.username||"root"}:${r.password}`);r.username="",r.password="";const o=function(t,e){const r={};for(const n of Object.keys(t))e.includes(n)||(r[n]=t[n]);return r}(e,["maxSockets"]);return function(t,e){let{method:i,url:s,headers:a,body:h,timeout:u,expectBinary:c}=t;const p=new URL(s.pathname,r);s.search?r.search?p.search=`${r.search}&${s.search.slice(1)}`:p.search=s.search.slice(1):p.search=r.search,a.authorization||(a.authorization=`Basic ${n}`);let m=(t,r)=>{m=()=>{},e(t,r)};const f=l({useXDR:!0,withCredentials:!0,...o,responseType:c?"blob":"text",url:String(p),body:h,method:i,headers:a,timeout:u},((t,e)=>{if(t){const e=t;e.request=f,e.toJSON=d,o.after&&o.after(e),m(e)}else{const t=e;t.request=f,t.body||(t.body=""),o.after&&o.after(null,t),m(null,t)}}));o.before&&o.before(f)}}const m=/\/(json|javascript)(\W|$)/;class f{_activeTasks=0;_arangoVersion=30900;_queue=new s.LinkedList;_databases=new Map;_hosts=[];_hostUrls=[];_transactionId=null;_queueTimes=new s.LinkedList;constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=t.url?Array.isArray(t.url)?t.url:[t.url]:["http://127.0.0.1:8529"],r=3*("ROUND_ROBIN"===t.loadBalancingStrategy?e.length:1);void 0!==t.arangoVersion&&(this._arangoVersion=t.arangoVersion),this._agent=t.agent,this._agentOptions={maxSockets:r,...t.agentOptions},this._maxTasks=this._agentOptions.maxSockets,this._headers={...t.headers},this._loadBalancingStrategy=t.loadBalancingStrategy??"NONE",this._precaptureStackTraces=Boolean(t.precaptureStackTraces),this._responseQueueTimeSamples=t.responseQueueTimeSamples??10,this._retryOnConflict=t.retryOnConflict??0,this._responseQueueTimeSamples<0&&(this._responseQueueTimeSamples=1/0),!1===t.maxRetries?this._maxRetries=!1:this._maxRetries=Number(t.maxRetries??0),this.addToHostList(e),t.auth&&(t.auth.hasOwnProperty("token")?this.setBearerAuth(t.auth):this.setBasicAuth(t.auth)),"ONE_RANDOM"===this._loadBalancingStrategy?(this._activeHostUrl=this._hostUrls[Math.floor(Math.random()*this._hostUrls.length)],this._activeDirtyHostUrl=this._hostUrls[Math.floor(Math.random()*this._hostUrls.length)]):(this._activeHostUrl=this._hostUrls[0],this._activeDirtyHostUrl=this._hostUrls[0])}get isArangoConnection(){return!0}get queueTime(){return{getLatest:()=>{var t;return null===(t=this._queueTimes.last)||void 0===t?void 0:t.value[1]},getValues:()=>Array.from(this._queueTimes.values()),getAvg:()=>{let t=0;for(const[,[,e]]of this._queueTimes)t+=e/this._queueTimes.length;return t}}}_runQueue(){if(!this._queue.length||this._activeTasks>=this._maxTasks)return;const t=this._queue.shift();let e=this._activeHostUrl;void 0!==t.hostUrl?e=t.hostUrl:t.allowDirtyRead?(e=this._activeDirtyHostUrl,this._activeDirtyHostUrl=this._hostUrls[(this._hostUrls.indexOf(this._activeDirtyHostUrl)+1)%this._hostUrls.length],t.options.headers["x-arango-allow-dirty-read"]="true"):"ROUND_ROBIN"===this._loadBalancingStrategy&&(this._activeHostUrl=this._hostUrls[(this._hostUrls.indexOf(this._activeHostUrl)+1)%this._hostUrls.length]),this._activeTasks+=1;const r=(n,o)=>{if(this._activeTasks-=1,!n&&o)if(503===o.statusCode&&o.headers["x-arango-endpoint"]){const r=o.headers["x-arango-endpoint"],[n]=this.addToHostList(r);t.hostUrl=n,this._activeHostUrl===e&&(this._activeHostUrl=n),this._queue.push(t)}else{o.arangojsHostUrl=e;const i=o.headers["content-type"],s=o.headers["x-arango-queue-time-seconds"];if(s)for(this._queueTimes.push([Date.now(),Number(s)]);this._responseQueueTimeSamples<this._queueTimes.length;)this._queueTimes.shift();let h;if(o.body.length&&i&&i.match(m))try{h=o.body,h=JSON.parse(h)}catch(e){if(!t.options.expectBinary)return"string"!=typeof h&&(h=o.body.toString("utf-8")),e.res=o,t.stack&&(e.stack+=t.stack()),void r(e)}else h=o.body&&!t.options.expectBinary?o.body.toString("utf-8"):o.body;(0,a.NV)(h)?(o.body=h,n=new a.XM(o)):o.statusCode&&o.statusCode>=400?(o.body=h,n=new a.oo(o)):(t.options.expectBinary||(o.body=h),t.resolve(t.transform?t.transform(o):o))}n&&(!t.allowDirtyRead&&this._hosts.length>1&&this._activeHostUrl===e&&"ROUND_ROBIN"!==this._loadBalancingStrategy&&(this._activeHostUrl=this._hostUrls[(this._hostUrls.indexOf(this._activeHostUrl)+1)%this._hostUrls.length]),(0,a.Pp)(n)&&n.errorNum===u.Vt&&t.retryOnConflict>0?(t.retryOnConflict-=1,this._queue.push(t)):((0,a.g0)(n)&&"connect"===n.syscall&&"ECONNREFUSED"===n.code||(0,a.Pp)(n)&&n.errorNum===u.W2)&&void 0===t.hostUrl&&!1!==this._maxRetries&&t.retries<(this._maxRetries||this._hosts.length-1)?(t.retries+=1,this._queue.push(t)):(t.stack&&(n.stack+=t.stack()),t.reject(n))),this._runQueue()};try{this._hosts[this._hostUrls.indexOf(e)](t.options,r)}catch(t){r(t)}}_buildUrl(t){let{basePath:e,path:r,qs:n}=t;const o=`${e||""}${r||""}`;let i;return n&&(i="string"==typeof n?`?${n}`:`?${function(t){let e="";for(let[r,n]of Object.entries(t))if(void 0!==n)if(r=encodeURIComponent(r),Array.isArray(n))for(let t of n)t=null==t?"":encodeURIComponent(String(t)),e+=`&${r}=${t}`;else n=null===n?"":encodeURIComponent(String(n)),e+=`&${r}=${n}`;return e.slice(1)}(n)}`),i?{pathname:o,search:i}:{pathname:o}}setBearerAuth(t){this.setHeader("authorization",`Bearer ${t.token}`)}setBasicAuth(t){this.setHeader("authorization",`Basic ${h(`${t.username}:${t.password}`)}`)}setResponseQueueTimeSamples(t){for(t<0&&(t=1/0),this._responseQueueTimeSamples=t;this._responseQueueTimeSamples<this._queueTimes.length;)this._queueTimes.shift()}database(t,e){if(null!==e)return e?(this._databases.set(t,e),e):this._databases.get(t);this._databases.delete(t)}setHostList(t){const e=t.map((t=>c(t)));this._hosts.splice(0,this._hosts.length,...e.map((t=>{const e=this._hostUrls.indexOf(t);return-1!==e?this._hosts[e]:p(t,this._agentOptions,this._agent)}))),this._hostUrls.splice(0,this._hostUrls.length,...e)}addToHostList(t){const e=(Array.isArray(t)?t:[t]).map((t=>c(t))),r=e.filter((t=>-1===this._hostUrls.indexOf(t)));return this._hostUrls.push(...r),this._hosts.push(...r.map((t=>p(t,this._agentOptions,this._agent)))),e}setTransactionId(t){this._transactionId=t}clearTransactionId(){this._transactionId=null}setHeader(t,e){null===e?delete this._headers[t]:this._headers[t]=e}close(){for(const t of this._hosts)t.close&&t.close()}async waitForPropagation(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1/0;const r=this._hosts.length,n=[],o=Date.now();let i=0;for(;;){if(n.length===r)return;for(;n.includes(this._hostUrls[i]);)i=(i+1)%r;const s=this._hostUrls[i];try{await this.request({...t,hostUrl:s})}catch(t){if(o+e<Date.now())throw t;await new Promise((t=>setTimeout(t,1e3)));continue}n.includes(s)||n.push(s)}}request(t,e){let{hostUrl:r,method:n="GET",body:o,expectBinary:i=!1,isBinary:s=!1,allowDirtyRead:a=!1,retryOnConflict:h=this._retryOnConflict,timeout:u=0,headers:c,...l}=t;return new Promise(((t,d)=>{let p="text/plain";s?p="application/octet-stream":o&&("object"==typeof o?(o=JSON.stringify(o),p="application/json"):o=String(o));const m={...this._headers,"content-type":p,"x-arango-version":String(this._arangoVersion),"x-arango-driver":"arangojs/8.4.0 (cloud)"};this._transactionId&&(m["x-arango-trx-id"]=this._transactionId);const f={retries:0,hostUrl:r,allowDirtyRead:a,retryOnConflict:h,options:{url:this._buildUrl(l),headers:{...m,...c},timeout:u,method:n,expectBinary:i,body:o},reject:d,resolve:t,transform:e};if(this._precaptureStackTraces)if("function"==typeof Error.captureStackTrace){const t={};Error.captureStackTrace(t),f.stack=()=>`\n${t.stack.split("\n").slice(3).join("\n")}`}else{const t=function(){let t=new Error;if(!t.stack)try{throw t}catch(e){t=e}return t}();Object.prototype.hasOwnProperty.call(t,"stack")&&(f.stack=()=>`\n${t.stack.split("\n").slice(4).join("\n")}`)}this._queue.push(f),this._runQueue()}))}}var y=r(267),_=r(909);function g(t,e){let r;try{r=new FormData;for(const e of Object.keys(t)){let n=t[e];void 0!==n&&(n instanceof Blob||"object"!=typeof n&&"function"!=typeof n||(n=JSON.stringify(n)),r.append(e,n))}}catch(t){return void e(t)}e(null,{body:r})}class b{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};e?"/"!==e.charAt(0)&&(e=`/${e}`):e="",this._db=t,this._path=e,this._headers=r}route(t,e){return t?"/"!==t.charAt(0)&&(t=`/${t}`):t="",new b(this._db,this._path+t,{...this._headers,...e})}request(t){const e={...t};return e.path&&"/"!==e.path?this._path&&"/"!==e.path.charAt(0)?e.path=`/${e.path}`:e.path=e.path:e.path="",e.basePath=this._path,e.headers={...this._headers,...e.headers},e.method=e.method?e.method.toUpperCase():"GET",this._db.request(e,!1)}delete(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];const n="string"==typeof e[0]?e.shift():void 0,[o,i]=e;return this.request({method:"DELETE",path:n,qs:o,headers:i})}get(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];const n="string"==typeof e[0]?e.shift():void 0,[o,i]=e;return this.request({method:"GET",path:n,qs:o,headers:i})}head(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];const n="string"==typeof e[0]?e.shift():void 0,[o,i]=e;return this.request({method:"HEAD",path:n,qs:o,headers:i})}patch(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];const n="string"==typeof e[0]?e.shift():void 0,[o,i,s]=e;return this.request({method:"PATCH",path:n,body:o,qs:i,headers:s})}post(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];const n="string"==typeof e[0]?e.shift():void 0,[o,i,s]=e;return this.request({method:"POST",path:n,body:o,qs:i,headers:s})}put(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];const n="string"==typeof e[0]?e.shift():void 0,[o,i,s]=e;return this.request({method:"PUT",path:n,body:o,qs:i,headers:s})}}class v{constructor(t,e){this._db=t,this._id=e}get isArangoTransaction(){return!0}get id(){return this._id}async exists(){try{return await this.get(),!0}catch(t){if((0,a.Pp)(t)&&t.errorNum===u.kO)return!1;throw t}}get(){return this._db.request({path:`/_api/transaction/${encodeURIComponent(this.id)}`},(t=>t.body.result))}commit(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{allowDirtyRead:e}=t;return this._db.request({method:"PUT",path:`/_api/transaction/${encodeURIComponent(this.id)}`,allowDirtyRead:e},(t=>t.body.result))}abort(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{allowDirtyRead:e}=t;return this._db.request({method:"DELETE",path:`/_api/transaction/${encodeURIComponent(this.id)}`,allowDirtyRead:e},(t=>t.body.result))}step(t){const e=this._db._connection;e.setTransactionId(this.id);try{const r=t();if(!r)throw new Error("Transaction callback was not an async function or did not return a promise!");return Promise.resolve(r)}finally{e.clearTransactionId()}}}var w=r(94);function q(t){return Boolean(t&&t.isArangoDatabase)}function x(t){if("string"==typeof t)return{write:[t]};if(Array.isArray(t))return{write:t.map(i.collectionToString)};if((0,i.isArangoCollection)(t))return{write:(0,i.collectionToString)(t)};const e={};return t&&(void 0!==t.allowImplicit&&(e.allowImplicit=t.allowImplicit),t.read&&(e.read=Array.isArray(t.read)?t.read.map(i.collectionToString):(0,i.collectionToString)(t.read)),t.write&&(e.write=Array.isArray(t.write)?t.write.map(i.collectionToString):(0,i.collectionToString)(t.write)),t.exclusive&&(e.exclusive=Array.isArray(t.exclusive)?t.exclusive.map(i.collectionToString):(0,i.collectionToString)(t.exclusive))),e}class T{_analyzers=new Map;_collections=new Map;_graphs=new Map;_views=new Map;constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;if(q(t)){const r=t._connection,n=(e||t.name).normalize("NFC");this._connection=r,this._name=n;const o=r.database(n);if(o)return o}else{const r=t,{databaseName:n,...o}="string"==typeof r||Array.isArray(r)?{databaseName:e,url:r}:r;this._connection=new f(o),this._name=(null==n?void 0:n.normalize("NFC"))||"_system"}}get isArangoDatabase(){return!0}get name(){return this._name}version(t){return this.request({method:"GET",path:"/_api/version",qs:{details:t}})}route(t,e){return new b(this,t,e)}request(t){let{absolutePath:e=!1,basePath:r,...n}=t,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.body;return e||(r=`/_db/${encodeURIComponent(this._name)}${r||""}`),this._connection.request({basePath:r,...n},o||void 0)}async acquireHostList(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const e=await this.request({path:"/_api/cluster/endpoints"},(t=>t.body.endpoints.map((t=>t.endpoint))));e.length>0&&(t?this._connection.setHostList(e):this._connection.addToHostList(e))}close(){this._connection.close()}async waitForPropagation(t,e){let{basePath:r,...n}=t;await this._connection.waitForPropagation({...n,basePath:`/_db/${encodeURIComponent(this._name)}${r||""}`},e)}get queueTime(){return this._connection.queueTime}setResponseQueueTimeSamples(t){this._connection.setResponseQueueTimeSamples(t)}useBasicAuth(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"root",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return this._connection.setBasicAuth({username:t,password:e}),this}useBearerAuth(t){return this._connection.setBearerAuth({token:t}),this}login(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"root",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return this.request({method:"POST",path:"/_open/auth",body:{username:t,password:e}},(t=>(this.useBearerAuth(t.body.jwt),t.body.jwt)))}renewAuthToken(){return this.request({method:"POST",path:"/_open/auth/renew"},(t=>t.body.jwt?(this.useBearerAuth(t.body.jwt),t.body.jwt):null))}getClusterImbalance(){return this.request({path:"/_admin/cluster/rebalance"},(t=>t.body.result))}computeClusterRebalance(t){return this.request({method:"POST",path:"/_admin/cluster/rebalance",body:{version:1,...t}},(t=>t.body.result))}executeClusterRebalance(t){return this.request({method:"POST",path:"/_admin/cluster/rebalance/execute",body:{version:1,moves:t}})}rebalanceCluster(t){return this.request({method:"PUT",path:"/_admin/cluster/rebalance",body:{version:1,...t}})}database(t){return new T(this,t)}get(){return this.request({path:"/_api/database/current"},(t=>t.body.result))}async exists(){try{return await this.get(),!0}catch(t){if((0,a.Pp)(t)&&t.errorNum===u.zp)return!1;throw t}}createDatabase(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{users:r,...n}=Array.isArray(e)?{users:e}:e;return this.request({method:"POST",path:"/_api/database",body:{name:t.normalize("NFC"),users:r,options:n}},(()=>this.database(t)))}listDatabases(){return this.request({path:"/_api/database"},(t=>t.body.result))}listUserDatabases(){return this.request({path:"/_api/database/user"},(t=>t.body.result))}databases(){return this.request({path:"/_api/database"},(t=>t.body.result.map((t=>this.database(t)))))}userDatabases(){return this.request({path:"/_api/database/user"},(t=>t.body.result.map((t=>this.database(t)))))}dropDatabase(t){return t=t.normalize("NFC"),this.request({method:"DELETE",path:`/_api/database/${encodeURIComponent(t)}`},(t=>t.body.result))}collection(t){return t=t.normalize("NFC"),this._collections.has(t)||this._collections.set(t,new i.Collection(this,t)),this._collections.get(t)}async createCollection(t,e){const r=this.collection(t);return await r.create(e),r}async createEdgeCollection(t,e){return this.createCollection(t,{...e,type:i.CollectionType.EDGE_COLLECTION})}async renameCollection(t,e){t=t.normalize("NFC");const r=await this.request({method:"PUT",path:`/_api/collection/${encodeURIComponent(t)}/rename`,body:{name:e.normalize("NFC")}});return this._collections.delete(t),r}listCollections(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.request({path:"/_api/collection",qs:{excludeSystem:t}},(t=>t.body.result))}async collections(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return(await this.listCollections(t)).map((t=>this.collection(t.name)))}graph(t){return t=t.normalize("NFC"),this._graphs.has(t)||this._graphs.set(t,new _.kJ(this,t)),this._graphs.get(t)}async createGraph(t,e,r){const n=this.graph(t.normalize("NFC"));return await n.create(e,r),n}listGraphs(){return this.request({path:"/_api/gharial"},(t=>t.body.graphs))}async graphs(){return(await this.listGraphs()).map((t=>this.graph(t._key)))}view(t){return t=t.normalize("NFC"),this._views.has(t)||this._views.set(t,new w.View(this,t)),this._views.get(t)}async createView(t,e){const r=this.view(t.normalize("NFC"));return await r.create(e),r}async renameView(t,e){t=t.normalize("NFC");const r=await this.request({method:"PUT",path:`/_api/view/${encodeURIComponent(t)}/rename`,body:{name:e.normalize("NFC")}});return this._views.delete(t),r}listViews(){return this.request({path:"/_api/view"},(t=>t.body.result))}async views(){return(await this.listViews()).map((t=>this.view(t.name)))}analyzer(t){return t=t.normalize("NFC"),this._analyzers.has(t)||this._analyzers.set(t,new n.L(this,t)),this._analyzers.get(t)}async createAnalyzer(t,e){const r=this.analyzer(t);return await r.create(e),r}listAnalyzers(){return this.request({path:"/_api/analyzer"},(t=>t.body.result))}async analyzers(){return(await this.listAnalyzers()).map((t=>this.analyzer(t.name)))}listUsers(){return this.request({path:"/_api/user"},(t=>t.body.result))}getUser(t){return this.request({path:`/_api/user/${encodeURIComponent(t)}`})}createUser(t,e){return"string"==typeof e&&(e={passwd:e}),this.request({method:"POST",path:"/_api/user",body:{user:t,...e}},(t=>t.body))}updateUser(t,e){return"string"==typeof e&&(e={passwd:e}),this.request({method:"PATCH",path:`/_api/user/${encodeURIComponent(t)}`,body:e},(t=>t.body))}replaceUser(t,e){return"string"==typeof e&&(e={passwd:e}),this.request({method:"PUT",path:`/_api/user/${encodeURIComponent(t)}`,body:e},(t=>t.body))}removeUser(t){return this.request({method:"DELETE",path:`/_api/user/${encodeURIComponent(t)}`},(t=>t.body))}getUserAccessLevel(t,e){let{database:r,collection:n}=e;const o=q(r)?r.name:(null==r?void 0:r.normalize("NFC"))??((0,i.isArangoCollection)(n)?n._db.name:this._name),s=n?`/${encodeURIComponent((0,i.isArangoCollection)(n)?n.name:n.normalize("NFC"))}`:"";return this.request({path:`/_api/user/${encodeURIComponent(t)}/database/${encodeURIComponent(o)}${s}`},(t=>t.body.result))}setUserAccessLevel(t,e){let{database:r,collection:n,grant:o}=e;const s=q(r)?r.name:(null==r?void 0:r.normalize("NFC"))??((0,i.isArangoCollection)(n)?n._db.name:this._name),a=n?`/${encodeURIComponent((0,i.isArangoCollection)(n)?n.name:n.normalize("NFC"))}`:"";return this.request({method:"PUT",path:`/_api/user/${encodeURIComponent(t)}/database/${encodeURIComponent(s)}${a}`,body:{grant:o}},(t=>t.body))}clearUserAccessLevel(t,e){let{database:r,collection:n}=e;const o=q(r)?r.name:(null==r?void 0:r.normalize("NFC"))??((0,i.isArangoCollection)(n)?n._db.name:this._name),s=n?`/${encodeURIComponent((0,i.isArangoCollection)(n)?n.name:n.normalize("NFC"))}`:"";return this.request({method:"DELETE",path:`/_api/user/${encodeURIComponent(t)}/database/${encodeURIComponent(o)}${s}`},(t=>t.body))}getUserDatabases(t,e){return this.request({path:`/_api/user/${encodeURIComponent(t)}/database`,qs:{full:e}},(t=>t.body.result))}executeTransaction(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{allowDirtyRead:n,...o}=r;return this.request({method:"POST",path:"/_api/transaction",allowDirtyRead:n,body:{collections:x(t),action:e,...o}},(t=>t.body.result))}transaction(t){return new v(this,t)}beginTransaction(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{allowDirtyRead:r,...n}=e;return this.request({method:"POST",path:"/_api/transaction/begin",allowDirtyRead:r,body:{collections:x(t),...n}},(t=>new v(this,t.body.result.id)))}async withTransaction(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=await this.beginTransaction(t,r);try{const t=await e((t=>n.step(t)));return await n.commit(),t}catch(t){try{await n.abort()}catch{}throw t}}listTransactions(){return this._connection.request({path:"/_api/transaction"},(t=>t.body.transactions))}async transactions(){return(await this.listTransactions()).map((t=>this.transaction(t.id)))}query(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};(0,o.isAqlQuery)(t)?(r=e??{},e=t.bindVars,t=t.query):(0,o.isAqlLiteral)(t)&&(t=t.toAQL());const{allowDirtyRead:n,retryOnConflict:i,count:s,batchSize:a,cache:h,memoryLimit:u,ttl:c,timeout:l,...d}=r;return this.request({method:"POST",path:"/_api/cursor",body:{query:t,bindVars:e,count:s,batchSize:a,cache:h,memoryLimit:u,ttl:c,options:d},allowDirtyRead:n,retryOnConflict:i,timeout:l},(t=>new y.o(this,t.body,t.arangojsHostUrl,n).items))}explain(t,e,r){return(0,o.isAqlQuery)(t)?(r=e,e=t.bindVars,t=t.query):(0,o.isAqlLiteral)(t)&&(t=t.toAQL()),this.request({method:"POST",path:"/_api/explain",body:{query:t,bindVars:e,options:r}})}parse(t){return(0,o.isAqlQuery)(t)?t=t.query:(0,o.isAqlLiteral)(t)&&(t=t.toAQL()),this.request({method:"POST",path:"/_api/query",body:{query:t}})}queryRules(){return this.request({path:"/_api/query/rules"})}queryTracking(t){return this.request(t?{method:"PUT",path:"/_api/query/properties",body:t}:{method:"GET",path:"/_api/query/properties"})}listRunningQueries(){return this.request({method:"GET",path:"/_api/query/current"})}listSlowQueries(){return this.request({method:"GET",path:"/_api/query/slow"})}clearSlowQueries(){return this.request({method:"DELETE",path:"/_api/query/slow"},(()=>{}))}killQuery(t){return this.request({method:"DELETE",path:`/_api/query/${encodeURIComponent(t)}`},(()=>{}))}listFunctions(){return this.request({path:"/_api/aqlfunction"},(t=>t.body.result))}createFunction(t,e){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.request({method:"POST",path:"/_api/aqlfunction",body:{name:t,code:e,isDeterministic:r}})}dropFunction(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.request({method:"DELETE",path:`/_api/aqlfunction/${encodeURIComponent(t)}`,qs:{group:e}})}listServices(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.request({path:"/_api/foxx",qs:{excludeSystem:t}})}async installService(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{configuration:n,dependencies:o,...i}=r,s=await g({configuration:n,dependencies:o,source:e});return await this.request({...s,method:"POST",path:"/_api/foxx",isBinary:!0,qs:{...i,mount:t}})}async replaceService(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{configuration:n,dependencies:o,...i}=r,s=await g({configuration:n,dependencies:o,source:e});return await this.request({...s,method:"PUT",path:"/_api/foxx/service",isBinary:!0,qs:{...i,mount:t}})}async upgradeService(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{configuration:n,dependencies:o,...i}=r,s=await g({configuration:n,dependencies:o,source:e});return await this.request({...s,method:"PATCH",path:"/_api/foxx/service",isBinary:!0,qs:{...i,mount:t}})}uninstallService(t,e){return this.request({method:"DELETE",path:"/_api/foxx/service",qs:{...e,mount:t}},(()=>{}))}getService(t){return this.request({path:"/_api/foxx/service",qs:{mount:t}})}getServiceConfiguration(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.request({path:"/_api/foxx/configuration",qs:{mount:t,minimal:e}})}replaceServiceConfiguration(t,e){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.request({method:"PUT",path:"/_api/foxx/configuration",body:e,qs:{mount:t,minimal:r}})}updateServiceConfiguration(t,e){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.request({method:"PATCH",path:"/_api/foxx/configuration",body:e,qs:{mount:t,minimal:r}})}getServiceDependencies(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.request({path:"/_api/foxx/dependencies",qs:{mount:t,minimal:e}})}replaceServiceDependencies(t,e){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.request({method:"PUT",path:"/_api/foxx/dependencies",body:e,qs:{mount:t,minimal:r}})}updateServiceDependencies(t,e){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.request({method:"PATCH",path:"/_api/foxx/dependencies",body:e,qs:{mount:t,minimal:r}})}setServiceDevelopmentMode(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.request({method:e?"POST":"DELETE",path:"/_api/foxx/development",qs:{mount:t}})}listServiceScripts(t){return this.request({path:"/_api/foxx/scripts",qs:{mount:t}})}runServiceScript(t,e,r){return this.request({method:"POST",path:`/_api/foxx/scripts/${encodeURIComponent(e)}`,body:r,qs:{mount:t}})}runServiceTests(t,e){return this.request({method:"POST",path:"/_api/foxx/tests",qs:{...e,mount:t}})}getServiceReadme(t){return this.request({path:"/_api/foxx/readme",qs:{mount:t}})}getServiceDocumentation(t){return this.request({path:"/_api/foxx/swagger",qs:{mount:t}})}downloadService(t){return this.request({method:"POST",path:"/_api/foxx/download",qs:{mount:t},expectBinary:!0})}commitLocalServiceState(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.request({method:"POST",path:"/_api/foxx/commit",qs:{replace:t}},(()=>{}))}}},974:function(t,e,r){"use strict";function n(t,e){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if("string"!=typeof t){if(t._id)return n(t._id,e);if(t._key)return n(t._key,e);throw new Error("Document handle must be a string or an object with a _key or _id attribute")}if(t.includes("/")){const[n,...o]=t.split("/"),i=n.normalize("NFC");if(r&&i!==e)throw new Error(`Document ID "${t}" does not match collection name "${e}"`);return[i,...o].join("/")}return`${e}/${t}`}r.d(e,{q:function(){return n}})},43:function(t,e,r){"use strict";r.d(e,{NV:function(){return s},Pp:function(){return i},XM:function(){return h},g0:function(){return a},oo:function(){return u}});const n={0:"Network Error",304:"Not Modified",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",444:"Connection Closed Without Response",451:"Unavailable For Legal Reasons",499:"Client Closed Request",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",510:"Not Extended",511:"Network Authentication Required",599:"Network Connect Timeout Error"},o=["fileName","lineNumber","columnNumber","stack","description","number"];function i(t){return Boolean(t&&t.isArangoError)}function s(t){return t&&t.hasOwnProperty("error")&&t.hasOwnProperty("code")&&t.hasOwnProperty("errorMessage")&&t.hasOwnProperty("errorNum")}function a(t){return Object.getPrototypeOf(t)===Error.prototype&&t.hasOwnProperty("code")&&t.hasOwnProperty("errno")&&t.hasOwnProperty("syscall")}class h extends Error{name="ArangoError";constructor(t){super(),this.response=t,this.message=t.body.errorMessage,this.errorNum=t.body.errorNum,this.code=t.body.code;const e=new Error(this.message);e.name=this.name;for(const t of o)e[t]&&(this[t]=e[t])}get isArangoError(){return!0}toJSON(){return{error:!0,errorMessage:this.message,errorNum:this.errorNum,code:this.code}}}class u extends Error{name="HttpError";constructor(t){super(),this.response=t,this.code=t.statusCode||500,this.message=n[this.code]||n[500];const e=new Error(this.message);e.name=this.name;for(const t of o)e[t]&&(this[t]=e[t])}toJSON(){return{error:!0,code:this.code}}}},909:function(t,e,r){"use strict";r.d(e,{Vp:function(){return a},kJ:function(){return d}});var n=r(91),o=r(974),i=r(43),s=r(979);function a(t){return Boolean(t&&t.isArangoGraph)}function h(t,e){const{new:r,old:n,[e]:o,...i}=t,s={...i,...o};return void 0!==r&&(s.new=r),void 0!==n&&(s.old=n),s}function u(t){const e={};return e.collection=(0,n.collectionToString)(t.collection),e.from=Array.isArray(t.from)?t.from.map(n.collectionToString):[(0,n.collectionToString)(t.from)],e.to=Array.isArray(t.to)?t.to.map(n.collectionToString):[(0,n.collectionToString)(t.to)],e}class c{constructor(t,e,r){this._db=t,this._collection=t.collection(e),this._name=this._collection.name,this._graph=r}get isArangoCollection(){return!0}get name(){return this._name}get collection(){return this._collection}get graph(){return this._graph}async vertexExists(t){try{return await this._db.request({method:"HEAD",path:`/_api/gharial/${encodeURIComponent(this.graph.name)}/vertex/${encodeURI((0,o.q)(t,this._name))}`},(()=>!0))}catch(t){if(404===t.code)return!1;throw t}}async vertex(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&(e={graceful:e});const{allowDirtyRead:r,graceful:n=!1,rev:a,...h}=e,u={};a&&(u["if-match"]=a);const c=this._db.request({path:`/_api/gharial/${encodeURIComponent(this.graph.name)}/vertex/${encodeURI((0,o.q)(t,this._name))}`,headers:u,qs:h,allowDirtyRead:r},(t=>t.body.vertex));if(!n)return c;try{return await c}catch(t){if((0,i.Pp)(t)&&t.errorNum===s.Gk)return null;throw t}}save(t,e){return this._db.request({method:"POST",path:`/_api/gharial/${encodeURIComponent(this.graph.name)}/vertex/${encodeURIComponent(this._name)}`,body:t,qs:e},(t=>h(t.body,"vertex")))}replace(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};"string"==typeof r&&(r={rev:r});const{rev:n,...i}=r,s={};return n&&(s["if-match"]=n),this._db.request({method:"PUT",path:`/_api/gharial/${encodeURIComponent(this.graph.name)}/vertex/${encodeURI((0,o.q)(t,this._name))}`,body:e,qs:i,headers:s},(t=>h(t.body,"vertex")))}update(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};"string"==typeof r&&(r={rev:r});const n={},{rev:i,...s}=r;return i&&(n["if-match"]=i),this._db.request({method:"PATCH",path:`/_api/gharial/${encodeURIComponent(this.graph.name)}/vertex/${encodeURI((0,o.q)(t,this._name))}`,body:e,qs:s,headers:n},(t=>h(t.body,"vertex")))}remove(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"==typeof e&&(e={rev:e});const r={},{rev:n,...i}=e;return n&&(r["if-match"]=n),this._db.request({method:"DELETE",path:`/_api/gharial/${encodeURIComponent(this.graph.name)}/vertex/${encodeURI((0,o.q)(t,this._name))}`,qs:i,headers:r},(t=>h(t.body,"removed")))}}class l{constructor(t,e,r){this._db=t,this._collection=t.collection(e),this._name=this._collection.name,this._graph=r}get isArangoCollection(){return!0}get name(){return this._name}get collection(){return this._collection}get graph(){return this._graph}async edgeExists(t){try{return await this._db.request({method:"HEAD",path:`/_api/gharial/${encodeURIComponent(this.graph.name)}/edge/${encodeURI((0,o.q)(t,this._name))}`},(()=>!0))}catch(t){if(404===t.code)return!1;throw t}}async edge(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&(e={graceful:e});const{allowDirtyRead:r,graceful:n=!1,rev:a,...h}=e,u=this._db.request({path:`/_api/gharial/${encodeURIComponent(this.graph.name)}/edge/${encodeURI((0,o.q)(t,this._name))}`,qs:h,allowDirtyRead:r},(t=>t.body.edge));if(!n)return u;try{return await u}catch(t){if((0,i.Pp)(t)&&t.errorNum===s.Gk)return null;throw t}}save(t,e){return this._db.request({method:"POST",path:`/_api/gharial/${encodeURIComponent(this.graph.name)}/edge/${encodeURIComponent(this._name)}`,body:t,qs:e},(t=>h(t.body,"edge")))}replace(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};"string"==typeof r&&(r={rev:r});const{rev:n,...i}=r,s={};return n&&(s["if-match"]=n),this._db.request({method:"PUT",path:`/_api/gharial/${encodeURIComponent(this.graph.name)}/edge/${encodeURI((0,o.q)(t,this._name))}`,body:e,qs:i,headers:s},(t=>h(t.body,"edge")))}update(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};"string"==typeof r&&(r={rev:r});const{rev:n,...i}=r,s={};return n&&(s["if-match"]=n),this._db.request({method:"PATCH",path:`/_api/gharial/${encodeURIComponent(this.graph.name)}/edge/${encodeURI((0,o.q)(t,this._name))}`,body:e,qs:i,headers:s},(t=>h(t.body,"edge")))}remove(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"==typeof e&&(e={rev:e});const{rev:r,...n}=e,i={};return r&&(i["if-match"]=r),this._db.request({method:"DELETE",path:`/_api/gharial/${encodeURIComponent(this.graph.name)}/edge/${encodeURI((0,o.q)(t,this._name))}`,qs:n,headers:i},(t=>h(t.body,"removed")))}}class d{constructor(t,e){this._name=e.normalize("NFC"),this._db=t}get isArangoGraph(){return!0}get name(){return this._name}async exists(){try{return await this.get(),!0}catch(t){if((0,i.Pp)(t)&&t.errorNum===s.D$)return!1;throw t}}get(){return this._db.request({path:`/_api/gharial/${encodeURIComponent(this._name)}`},(t=>t.body.graph))}create(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{orphanCollections:r,satellites:o,waitForSync:i,isSmart:s,...a}=e;return this._db.request({method:"POST",path:"/_api/gharial",body:{orphanCollections:r&&(Array.isArray(r)?r.map(n.collectionToString):[(0,n.collectionToString)(r)]),edgeDefinitions:t.map(u),isSmart:s,name:this._name,options:{...a,satellites:null==o?void 0:o.map(n.collectionToString)}},qs:{waitForSync:i}},(t=>t.body.graph))}drop(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._db.request({method:"DELETE",path:`/_api/gharial/${encodeURIComponent(this._name)}`,qs:{dropCollections:t}},(t=>t.body.removed))}vertexCollection(t){return new c(this._db,(0,n.collectionToString)(t),this)}listVertexCollections(){return this._db.request({path:`/_api/gharial/${encodeURIComponent(this._name)}/vertex`},(t=>t.body.collections))}async vertexCollections(){return(await this.listVertexCollections()).map((t=>new c(this._db,t,this)))}addVertexCollection(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{satellites:r,...o}=e;return this._db.request({method:"POST",path:`/_api/gharial/${encodeURIComponent(this._name)}/vertex`,body:{collection:(0,n.collectionToString)(t),options:{...o,satellites:null==r?void 0:r.map(n.collectionToString)}}},(t=>t.body.graph))}removeVertexCollection(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._db.request({method:"DELETE",path:`/_api/gharial/${encodeURIComponent(this._name)}/vertex/${encodeURIComponent((0,n.collectionToString)(t))}`,qs:{dropCollection:e}},(t=>t.body.graph))}edgeCollection(t){return new l(this._db,(0,n.collectionToString)(t),this)}listEdgeCollections(){return this._db.request({path:`/_api/gharial/${encodeURIComponent(this._name)}/edge`},(t=>t.body.collections))}async edgeCollections(){return(await this.listEdgeCollections()).map((t=>new l(this._db,t,this)))}addEdgeDefinition(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{satellites:r,...o}=e;return this._db.request({method:"POST",path:`/_api/gharial/${encodeURIComponent(this._name)}/edge`,body:{...u(t),options:{...o,satellites:null==r?void 0:r.map(n.collectionToString)}}},(t=>t.body.graph))}replaceEdgeDefinition(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=t,i=e;e&&!e.hasOwnProperty("collection")&&(r=e,e=void 0),e||(i=t,o=i.collection);const{satellites:s,...a}=r;return this._db.request({method:"PUT",path:`/_api/gharial/${encodeURIComponent(this._name)}/edge/${encodeURIComponent((0,n.collectionToString)(o))}`,body:{...u(i),options:{...a,satellites:null==s?void 0:s.map(n.collectionToString)}}},(t=>t.body.graph))}removeEdgeDefinition(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._db.request({method:"DELETE",path:`/_api/gharial/${encodeURIComponent(this._name)}/edge/${encodeURIComponent((0,n.collectionToString)(t))}`,qs:{dropCollection:e}},(t=>t.body.graph))}traversal(t,e){return this._db.request({method:"POST",path:"/_api/traversal",body:{...e,startVertex:t,graphName:this._name}},(t=>t.body.result))}}},979:function(t,e,r){"use strict";r.d(e,{D$:function(){return l},Gk:function(){return a},IB:function(){return s},I_:function(){return u},Vt:function(){return i},W2:function(){return o},Xf:function(){return h},kO:function(){return n},zp:function(){return c}});const n=10,o=503,i=1200,s=1202,a=1202,h=1203,u=1203,c=1228,l=1924},94:function(t,e,r){"use strict";r.r(e),r.d(e,{View:function(){return s},isArangoView:function(){return i}});var n=r(43),o=r(979);function i(t){return Boolean(t&&t.isArangoView)}class s{constructor(t,e){this._db=t,this._name=e.normalize("NFC")}get isArangoView(){return!0}get name(){return this._name}get(){return this._db.request({path:`/_api/view/${encodeURIComponent(this._name)}`})}async exists(){try{return await this.get(),!0}catch(t){if((0,n.Pp)(t)&&t.errorNum===o.I_)return!1;throw t}}create(t){return this._db.request({method:"POST",path:"/_api/view",body:{...t,name:this._name}})}async rename(t){const e=this._db.renameView(this._name,t);return this._name=t.normalize("NFC"),e}properties(){return this._db.request({path:`/_api/view/${encodeURIComponent(this._name)}/properties`})}updateProperties(t){return this._db.request({method:"PATCH",path:`/_api/view/${encodeURIComponent(this._name)}/properties`,body:t??{}})}replaceProperties(t){return this._db.request({method:"PUT",path:`/_api/view/${encodeURIComponent(this._name)}/properties`,body:t??{}})}drop(){return this._db.request({method:"DELETE",path:`/_api/view/${encodeURIComponent(this._name)}`},(t=>t.body.result))}}},293:function(t,e,r){"use strict";const{aql:n}=r(97),{CollectionStatus:o,CollectionType:i}=r(91),{ViewType:s}=r(94),{Database:a}=r(928);function h(t){return"string"==typeof t||Array.isArray(t),new a(t)}t.exports=h,Object.assign(h,{aql:n,arangojs:h,CollectionStatus:o,CollectionType:i,Database:a,ViewType:s})}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}return r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,{a:e}),e},r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r(588),r(293)}()}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.arangojs=e():t.arangojs=e()}(self,(function(){return function(){var t={192:function(t,e,r){var n;n="undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self?self:{},t.exports=n},534:function(t){t.exports=function(t){if(!t)return!1;var r=e.call(t);return"[object Function]"===r||"function"==typeof t&&"[object RegExp]"!==r||"undefined"!=typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)};var e=Object.prototype.toString},69:function(t){var e=function(t){return t.replace(/^\s+|\s+$/g,"")};t.exports=function(t){if(!t)return{};for(var r,n={},o=e(t).split("\n"),i=0;i<o.length;i++){var s=o[i],a=s.indexOf(":"),h=e(s.slice(0,a)).toLowerCase(),u=e(s.slice(a+1));void 0===n[h]?n[h]=u:(r=n[h],"[object Array]"===Object.prototype.toString.call(r)?n[h].push(u):n[h]=[n[h],u])}return n}},588:function(t){var e=function(t){"use strict";var e,r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",h=i.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var i=e&&e.prototype instanceof y?e:y,s=Object.create(i.prototype),a=new S(n||[]);return o(s,"_invoke",{value:C(t,r,a)}),s}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var d="suspendedStart",p="executing",m="completed",f={};function y(){}function _(){}function g(){}var b={};u(b,s,(function(){return this}));var v=Object.getPrototypeOf,w=v&&v(v(I([])));w&&w!==r&&n.call(w,s)&&(b=w);var q=g.prototype=y.prototype=Object.create(b);function x(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function T(t,e){function r(o,i,s,a){var h=l(t[o],t,i);if("throw"!==h.type){var u=h.arg,c=u.value;return c&&"object"==typeof c&&n.call(c,"__await")?e.resolve(c.__await).then((function(t){r("next",t,s,a)}),(function(t){r("throw",t,s,a)})):e.resolve(c).then((function(t){u.value=t,s(u)}),(function(t){return r("throw",t,s,a)}))}a(h.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function C(t,e,r){var n=d;return function(o,i){if(n===p)throw new Error("Generator is already running");if(n===m){if("throw"===o)throw i;return A()}for(r.method=o,r.arg=i;;){var s=r.delegate;if(s){var a=U(s,r);if(a){if(a===f)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===d)throw n=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var h=l(t,e,r);if("normal"===h.type){if(n=r.done?m:"suspendedYield",h.arg===f)continue;return{value:h.arg,done:r.done}}"throw"===h.type&&(n=m,r.method="throw",r.arg=h.arg)}}}function U(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,U(t,r),"throw"===r.method))return f;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var o=l(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,f;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,f):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}function R(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(R,this),this.reset(!0)}function I(t){if(t){var r=t[s];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}return{next:A}}function A(){return{value:e,done:!0}}return _.prototype=g,o(q,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:_,configurable:!0}),_.displayName=u(g,h,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===_||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,u(t,h,"GeneratorFunction")),t.prototype=Object.create(q),t},t.awrap=function(t){return{__await:t}},x(T.prototype),u(T.prototype,a,(function(){return this})),t.AsyncIterator=T,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var s=new T(c(e,r,n,o),i);return t.isGeneratorFunction(r)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},x(q),u(q,h,"Generator"),u(q,s,(function(){return this})),u(q,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=I,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(E),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return a.type="throw",a.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],a=s.completion;if("root"===s.tryLoc)return o("end");if(s.tryLoc<=this.prev){var h=n.call(s,"catchLoc"),u=n.call(s,"finallyLoc");if(h&&u){if(this.prev<s.catchLoc)return o(s.catchLoc,!0);if(this.prev<s.finallyLoc)return o(s.finallyLoc)}else if(h){if(this.prev<s.catchLoc)return o(s.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return o(s.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=t,s.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:I(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),f}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}},994:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(107);class o{constructor(t){if(this.length=0,this.unlinkCleanup=t=>{this.first===t&&(this.first=this.first.behind),this.last===t&&(this.last=this.last.before),this.length--},t){t instanceof o&&(t=t.values());for(const e of t)this.push(e)}}clear(t=!1){if(t)for(;this.first;)this.first.unlink(!0);this.first=this.last=void 0,this.length=0}every(t,e){e&&(t=t.bind(e));for(const e of this.keys())if(!t(e.value,e,this))return!1;return!0}filter(t,e){e&&(t=t.bind(e));const r=new o;for(const[e,n]of this)t(n,e,this)&&r.push(n);return r}find(t,e){e&&(t=t.bind(e));for(const[e,r]of this)if(t(r,e,this))return r}findItem(t,e){e&&(t=t.bind(e));for(const[e,r]of this)if(t(r,e,this))return e}forEach(t,e){e&&(t=t.bind(e));for(const[e,r]of this)t(r,e,this)}includes(t,e=0){let r=this.getItemByIndex(e);for(;r;){if(r.value===t)return!0;r=r.behind}return!1}itemOf(t,e=0){let r=this.getItemByIndex(e);for(;r;){if(r.value===t)return r;r=r.behind}}lastItemOf(t,e=-1){let r=this.getItemByIndex(e);for(;r;){if(r.value===t)return r;r=r.before}}map(t,e){e&&(t=t.bind(e));const r=new o;for(const[e,n]of this)r.push(t(n,e,this));return r}reduce(t,e){let r=this.first;if(!r){if(!e)throw new TypeError("Empty accumulator on empty LinkedList is not allowed.");return e}if(void 0===e){if(e=r.value,!r.behind)return e;r=r.behind}do{e=t(e,r.value,r,this),r=r.behind}while(r);return e}reduceRight(t,e){let r=this.last;if(!r){if(!e)throw new TypeError("Empty accumulator on empty LinkedList is not allowed.");return e}if(void 0===e){if(e=r.value,!r.before)return e;r=r.before}do{e=t(e,r.value,r,this),r=r.before}while(r);return e}some(t,e){e&&(t=t.bind(e));for(const[e,r]of this)if(t(r,e,this))return!0;return!1}join(t){return[...this.values()].join(t)}concat(...t){const e=new o(this);for(const r of t)r instanceof o?e.push(...r.values()):e.push(r);return e}pop(){if(!this.last)return;const t=this.last;return t.unlink(),t.value}push(...t){for(const e of t){const t=new n.LinkedListItem(e,this.unlinkCleanup);this.first&&this.last?(this.last.insertBehind(t),this.last=t):this.first=this.last=t,this.length++}return this.length}unshift(...t){for(const e of t){const t=new n.LinkedListItem(e,this.unlinkCleanup);this.last&&this.first?(t.insertBehind(this.first),this.first=t):this.first=this.last=t,this.length++}return this.length}remove(t){for(const e of this.keys())if(e.value===t)return e.unlink(),!0;return!1}removeAllOccurrences(t){let e=!1;for(const r of this.keys())r.value===t&&(r.unlink(),e=!0);return e}shift(){if(!this.first)return;const t=this.first;return t.unlink(),t.value}*[Symbol.iterator](){let t=this.first;if(t)do{yield[t,t.value],t=t.behind}while(t)}entries(){return this[Symbol.iterator]()}*keys(){let t=this.first;if(t)do{yield t,t=t.behind}while(t)}*values(){let t=this.first;if(t)do{yield t.value,t=t.behind}while(t)}getItemByIndex(t){if(void 0===t)throw new Error("index must be a number!");if(!this.first)return;let e;if(t>0)for(e=this.first;e&&t--;)e=e.behind;else{if(!(t<0))return this.first;for(e=this.last;e&&++t;)e=e.before}return e}}e.LinkedList=o},107:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LinkedListItem=class{constructor(t,e){this.value=t,this.unlinkCleanup=e}insertBehind(t){if(t.insertBefore(this),this.behind){let e=t;for(;e.behind;)e=e.behind;this.behind.insertBefore(e),e.insertBehind(this.behind)}this.behind=t}unlink(t=!1){this.before&&(this.before.behind=this.behind),this.behind&&(this.behind.before=this.before),this.unlinkCleanup&&this.unlinkCleanup(this),this.unlinkCleanup=void 0,t&&(this.before=this.behind=void 0)}insertBefore(t){this.before=t,this.unlinkCleanup||(this.unlinkCleanup=t.unlinkCleanup)}}},95:function(t,e,r){"use strict";function n(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),n(r(994)),n(r(107))},377:function(t,e,r){"use strict";var n=r(192),o=r(534),i=r(69),s=r(786);function a(t,e,r){var n=t;return o(e)?(r=e,"string"==typeof t&&(n={uri:t})):n=s(e,{uri:t}),n.callback=r,n}function h(t,e,r){return u(e=a(t,e,r))}function u(t){if(void 0===t.callback)throw new Error("callback argument missing");var e=!1,r=function(r,n,o){e||(e=!0,t.callback(r,n,o))};function n(){var t=void 0;if(t=c.response?c.response:c.responseText||function(t){try{if("document"===t.responseType)return t.responseXML;var e=t.responseXML&&"parsererror"===t.responseXML.documentElement.nodeName;if(""===t.responseType&&!e)return t.responseXML}catch(t){}return null}(c),_)try{t=JSON.parse(t)}catch(t){}return t}function o(t){return clearTimeout(l),t instanceof Error||(t=new Error(""+(t||"Unknown XMLHttpRequest Error"))),t.statusCode=0,r(t,g)}function s(){if(!u){var e;clearTimeout(l),e=t.useXDR&&void 0===c.status?200:1223===c.status?204:c.status;var o=g,s=null;return 0!==e?(o={body:n(),statusCode:e,method:p,headers:{},url:d,rawRequest:c},c.getAllResponseHeaders&&(o.headers=i(c.getAllResponseHeaders()))):s=new Error("Internal XMLHttpRequest Error"),r(s,o,o.body)}}var a,u,c=t.xhr||null;c||(c=t.cors||t.useXDR?new h.XDomainRequest:new h.XMLHttpRequest);var l,d=c.url=t.uri||t.url,p=c.method=t.method||"GET",m=t.body||t.data,f=c.headers=t.headers||{},y=!!t.sync,_=!1,g={body:void 0,headers:{},statusCode:0,method:p,url:d,rawRequest:c};if("json"in t&&!1!==t.json&&(_=!0,f.accept||f.Accept||(f.Accept="application/json"),"GET"!==p&&"HEAD"!==p&&(f["content-type"]||f["Content-Type"]||(f["Content-Type"]="application/json"),m=JSON.stringify(!0===t.json?m:t.json))),c.onreadystatechange=function(){4===c.readyState&&setTimeout(s,0)},c.onload=s,c.onerror=o,c.onprogress=function(){},c.onabort=function(){u=!0},c.ontimeout=o,c.open(p,d,!y,t.username,t.password),y||(c.withCredentials=!!t.withCredentials),!y&&t.timeout>0&&(l=setTimeout((function(){if(!u){u=!0,c.abort("timeout");var t=new Error("XMLHttpRequest timeout");t.code="ETIMEDOUT",o(t)}}),t.timeout)),c.setRequestHeader)for(a in f)f.hasOwnProperty(a)&&c.setRequestHeader(a,f[a]);else if(t.headers&&!function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}(t.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(c.responseType=t.responseType),"beforeSend"in t&&"function"==typeof t.beforeSend&&t.beforeSend(c),c.send(m||null),c}t.exports=h,t.exports.default=h,h.XMLHttpRequest=n.XMLHttpRequest||function(){},h.XDomainRequest="withCredentials"in new h.XMLHttpRequest?h.XMLHttpRequest:n.XDomainRequest,function(t,e){for(var r=0;r<t.length;r++)e(t[r])}(["get","put","post","patch","head","delete"],(function(t){h["delete"===t?"del":t]=function(e,r,n){return(r=a(e,r,n)).method=t.toUpperCase(),u(r)}}))},786:function(t){t.exports=function(){for(var t={},r=0;r<arguments.length;r++){var n=arguments[r];for(var o in n)e.call(n,o)&&(t[o]=n[o])}return t};var e=Object.prototype.hasOwnProperty},594:function(t,e,r){"use strict";r.d(e,{L:function(){return s},W:function(){return i}});var n=r(43),o=r(979);function i(t){return Boolean(t&&t.isArangoAnalyzer)}class s{constructor(t,e){this._db=t,this._name=e.normalize("NFC")}get isArangoAnalyzer(){return!0}get name(){return this._name}async exists(){try{return await this.get(),!0}catch(t){if((0,n.Pp)(t)&&t.errorNum===o.IB)return!1;throw t}}get(){return this._db.request({path:`/_api/analyzer/${encodeURIComponent(this._name)}`})}create(t){return this._db.request({method:"POST",path:"/_api/analyzer",body:{name:this._name,...t}})}drop(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._db.request({method:"DELETE",path:`/_api/analyzer/${encodeURIComponent(this._name)}`,qs:{force:t}})}}},97:function(t,e,r){"use strict";r.r(e),r.d(e,{aql:function(){return c},isAqlLiteral:function(){return u},isAqlQuery:function(){return a},isGeneratedAqlQuery:function(){return h},join:function(){return d},literal:function(){return l}});var n=r(594),o=r(91),i=r(909),s=r(94);function a(t){return Boolean(t&&"string"==typeof t.query&&t.bindVars)}function h(t){return a(t)&&"function"==typeof t._source}function u(t){return Boolean(t&&"function"==typeof t.toAQL)}function c(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),a=1;a<e;a++)r[a-1]=arguments[a];const c=[...t],l={},d=[];let p=c[0];for(let t=0;t<r.length;t++){const e=r[t];let a=e;if(h(e)){const n=e._source();n.args.length?(p+=n.strings[0],r.splice(t,1,...n.args),c.splice(t,2,c[t]+n.strings[0],...n.strings.slice(1,n.args.length),n.strings[n.args.length]+c[t+1])):(p+=e.query+c[t+1],r.splice(t,1),c.splice(t,2,c[t]+e.query+c[t+1])),t-=1;continue}if(void 0===e){p+=c[t+1];continue}if(u(e)){p+=`${e.toAQL()}${c[t+1]}`;continue}const m=d.indexOf(e),f=-1!==m;let y=`value${f?m:d.length}`;((0,o.isArangoCollection)(e)||(0,i.Vp)(e)||(0,s.isArangoView)(e)||(0,n.W)(e))&&(y=`@${y}`,a=e.name),f||(d.push(e),l[y]=a),p+=`@${y}${c[t+1]}`}return{query:p,bindVars:l,_source:()=>({strings:c,args:r})}}function l(t){return u(t)?t:{toAQL(){return void 0===t?"":String(t)}}}function d(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";return t.length?1===t.length?c`${t[0]}`:c(["",...Array(t.length-1).fill(e),""],...t):c``}},91:function(t,e,r){"use strict";r.r(e),r.d(e,{Collection:function(){return p},CollectionStatus:function(){return d},CollectionType:function(){return l},collectionToString:function(){return c},isArangoCollection:function(){return u}});var n=r(97),o=r(267),i=r(974),s=r(43);function a(t,e){if("string"!=typeof t){if(t.id)return a(t.id,e);throw new Error("Index handle must be a string or an object with an id attribute")}if(t.includes("/")){const[r,...n]=t.split("/"),o=r.normalize("NFC");if(o!==e)throw new Error(`Index ID "${t}" does not match collection name "${e}"`);return[o,t=n.join("/").normalize("NFC")].join("/")}return`${e}/${String(t).normalize("NFC")}`}var h=r(979);function u(t){return Boolean(t&&t.isArangoCollection)}function c(t){return u(t)?String(t.name):String(t).normalize("NFC")}let l,d;!function(t){t[t.DOCUMENT_COLLECTION=2]="DOCUMENT_COLLECTION",t[t.EDGE_COLLECTION=3]="EDGE_COLLECTION"}(l||(l={})),function(t){t[t.NEWBORN=1]="NEWBORN",t[t.UNLOADED=2]="UNLOADED",t[t.LOADED=3]="LOADED",t[t.UNLOADING=4]="UNLOADING",t[t.DELETED=5]="DELETED",t[t.LOADING=6]="LOADING"}(d||(d={}));class p{constructor(t,e){this._name=e.normalize("NFC"),this._db=t}get isArangoCollection(){return!0}get name(){return this._name}get(){return this._db.request({path:`/_api/collection/${encodeURIComponent(this._name)}`})}async exists(){try{return await this.get(),!0}catch(t){if((0,s.Pp)(t)&&t.errorNum===h.Xf)return!1;throw t}}create(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{waitForSyncReplication:e,enforceReplicationFactor:r,...o}=t;o.computedValues&&(o.computedValues=o.computedValues.map((t=>(0,n.isAqlLiteral)(t.expression)?{...t,expression:t.expression.toAQL()}:(0,n.isAqlQuery)(t.expression)?{...t,expression:t.expression.query}:t)));const i={};return"boolean"==typeof e&&(i.waitForSyncReplication=e?1:0),"boolean"==typeof r&&(i.enforceReplicationFactor=r?1:0),this._db.request({method:"POST",path:"/_api/collection",qs:i,body:{...o,name:this._name}})}properties(t){return t?this._db.request({method:"PUT",path:`/_api/collection/${encodeURIComponent(this._name)}/properties`,body:t}):this._db.request({path:`/_api/collection/${encodeURIComponent(this._name)}/properties`})}count(){return this._db.request({path:`/_api/collection/${encodeURIComponent(this._name)}/count`})}async recalculateCount(){return this._db.request({method:"PUT",path:`/_api/collection/${encodeURIComponent(this._name)}/recalculateCount`},(t=>t.body.result))}figures(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._db.request({path:`/_api/collection/${encodeURIComponent(this._name)}/figures`,qs:{details:t}})}revision(){return this._db.request({path:`/_api/collection/${encodeURIComponent(this._name)}/revision`})}checksum(t){return this._db.request({path:`/_api/collection/${encodeURIComponent(this._name)}/checksum`,qs:t})}async loadIndexes(){return this._db.request({method:"PUT",path:`/_api/collection/${encodeURIComponent(this._name)}/loadIndexesIntoMemory`},(t=>t.body.result))}async rename(t){const e=await this._db.renameCollection(this._name,t);return this._name=t.normalize("NFC"),e}truncate(){return this._db.request({method:"PUT",path:`/_api/collection/${this._name}/truncate`})}drop(t){return this._db.request({method:"DELETE",path:`/_api/collection/${encodeURIComponent(this._name)}`,qs:t})}getResponsibleShard(t){return this._db.request({method:"PUT",path:`/_api/collection/${encodeURIComponent(this._name)}/responsibleShard`,body:t},(t=>t.body.shardId))}documentId(t){return(0,i.q)(t,this._name)}async documentExists(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{ifMatch:r,ifNoneMatch:n}=e,o={};r&&(o["if-match"]=r),n&&(o["if-none-match"]=n);try{return await this._db.request({method:"HEAD",path:`/_api/document/${encodeURI((0,i.q)(t,this._name))}`,headers:o},(t=>{if(n&&304===t.statusCode)throw new s.oo(t);return!0}))}catch(t){if(404===t.code)return!1;throw t}}documents(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{allowDirtyRead:r}=e;return this._db.request({method:"PUT",path:`/_api/document/${encodeURIComponent(this._name)}`,qs:{onlyget:!0},allowDirtyRead:r,body:t})}async document(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&(e={graceful:e});const{allowDirtyRead:r,graceful:n=!1,ifMatch:o,ifNoneMatch:a}=e,u={};o&&(u["if-match"]=o),a&&(u["if-none-match"]=a);const c=this._db.request({path:`/_api/document/${encodeURI((0,i.q)(t,this._name))}`,headers:u,allowDirtyRead:r},(t=>{if(a&&304===t.statusCode)throw new s.oo(t);return t.body}));if(!n)return c;try{return await c}catch(t){if((0,s.Pp)(t)&&t.errorNum===h.Gk)return null;throw t}}save(t,e){return this._db.request({method:"POST",path:`/_api/document/${encodeURIComponent(this._name)}`,body:t,qs:e},(t=>null!=e&&e.silent?void 0:t.body))}saveAll(t,e){return this._db.request({method:"POST",path:`/_api/document/${encodeURIComponent(this._name)}`,body:t,qs:e},(t=>null!=e&&e.silent?void 0:t.body))}replace(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{ifMatch:n,...o}=r,s={};return n&&(s["if-match"]=n),this._db.request({method:"PUT",path:`/_api/document/${encodeURI((0,i.q)(t,this._name))}`,headers:s,body:e,qs:o},(t=>null!=r&&r.silent?void 0:t.body))}replaceAll(t,e){return this._db.request({method:"PUT",path:`/_api/document/${encodeURIComponent(this._name)}`,body:t,qs:e},(t=>null!=e&&e.silent?void 0:t.body))}update(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{ifMatch:n,...o}=r,s={};return n&&(s["if-match"]=n),this._db.request({method:"PATCH",path:`/_api/document/${encodeURI((0,i.q)(t,this._name))}`,headers:s,body:e,qs:o},(t=>null!=r&&r.silent?void 0:t.body))}updateAll(t,e){return this._db.request({method:"PATCH",path:`/_api/document/${encodeURIComponent(this._name)}`,body:t,qs:e},(t=>null!=e&&e.silent?void 0:t.body))}remove(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{ifMatch:r,...n}=e,o={};return r&&(o["if-match"]=r),this._db.request({method:"DELETE",path:`/_api/document/${encodeURI((0,i.q)(t,this._name))}`,headers:o,qs:n},(t=>null!=e&&e.silent?void 0:t.body))}removeAll(t,e){return this._db.request({method:"DELETE",path:`/_api/document/${encodeURIComponent(this._name)}`,body:t,qs:e},(t=>null!=e&&e.silent?void 0:t.body))}import(t){const e={...arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},collection:this._name};return Array.isArray(t)&&(e.type=Array.isArray(t[0])?void 0:"documents",t=t.map((t=>JSON.stringify(t))).join("\r\n")+"\r\n"),this._db.request({method:"POST",path:"/_api/import",body:t,isBinary:!0,qs:e})}_edges(t,e,r){const{allowDirtyRead:n}=e;return this._db.request({path:`/_api/edges/${encodeURIComponent(this._name)}`,allowDirtyRead:n,qs:{direction:r,vertex:(0,i.q)(t,this._name,!1)}})}edges(t,e){return this._edges(t,e)}inEdges(t,e){return this._edges(t,e,"in")}outEdges(t,e){return this._edges(t,e,"out")}traversal(t,e){return this._db.request({method:"POST",path:"/_api/traversal",body:{...e,startVertex:t,edgeCollection:this._name}},(t=>t.body.result))}list(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"id";return this._db.request({method:"PUT",path:"/_api/simple/all-keys",body:{type:t,collection:this._name}},(t=>new o.o(this._db,t.body,t.arangojsHostUrl).items))}all(t){return this._db.request({method:"PUT",path:"/_api/simple/all",body:{...t,collection:this._name}},(t=>new o.o(this._db,t.body,t.arangojsHostUrl).items))}any(){return this._db.request({method:"PUT",path:"/_api/simple/any",body:{collection:this._name}},(t=>t.body.document))}byExample(t,e){return this._db.request({method:"PUT",path:"/_api/simple/by-example",body:{...e,example:t,collection:this._name}},(t=>new o.o(this._db,t.body,t.arangojsHostUrl).items))}firstExample(t){return this._db.request({method:"PUT",path:"/_api/simple/first-example",body:{example:t,collection:this._name}},(t=>t.body.document))}removeByExample(t,e){return this._db.request({method:"PUT",path:"/_api/simple/remove-by-example",body:{...e,example:t,collection:this._name}})}replaceByExample(t,e,r){return this._db.request({method:"PUT",path:"/_api/simple/replace-by-example",body:{...r,example:t,newValue:e,collection:this._name}})}updateByExample(t,e,r){return this._db.request({method:"PUT",path:"/_api/simple/update-by-example",body:{...r,example:t,newValue:e,collection:this._name}})}lookupByKeys(t){return this._db.request({method:"PUT",path:"/_api/simple/lookup-by-keys",body:{keys:t,collection:this._name}},(t=>t.body.documents))}removeByKeys(t,e){return this._db.request({method:"PUT",path:"/_api/simple/remove-by-keys",body:{options:e,keys:t,collection:this._name}})}indexes(){return this._db.request({path:"/_api/index",qs:{collection:this._name}},(t=>t.body.indexes))}index(t){return this._db.request({path:`/_api/index/${encodeURI(a(t,this._name))}`})}ensureIndex(t){const e={...t};return e.name&&(e.name=e.name.normalize("NFC")),this._db.request({method:"POST",path:"/_api/index",body:t,qs:{collection:this._name}})}dropIndex(t){return this._db.request({method:"DELETE",path:`/_api/index/${encodeURI(a(t,this._name))}`})}fulltext(t,e){let{index:r,...n}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this._db.request({method:"PUT",path:"/_api/simple/fulltext",body:{...n,index:r?a(r,this._name):void 0,attribute:t,query:e,collection:this._name}},(t=>new o.o(this._db,t.body,t.arangojsHostUrl).items))}compact(){return this._db.request({method:"PUT",path:`/_api/collection/${this._name}/compact`},(t=>t.body))}}},267:function(t,e,r){"use strict";r.d(e,{o:function(){return o}});var n=r(95);class o{constructor(t,e,r,o){const s=new n.LinkedList(e.result.length?[new n.LinkedList(e.result)]:[]);this._db=t,this._batches=s,this._id=e.id,this._hasMore=Boolean(e.id&&e.hasMore),this._nextBatchId=e.nextBatchId,this._hostUrl=r,this._count=e.count,this._extra=e.extra,this._allowDirtyRead=o,this._itemsCursor=new i(this,{get isEmpty(){return!s.length},more:()=>this._more(),shift:()=>{var t;let e=null===(t=s.first)||void 0===t?void 0:t.value;for(;e&&!e.length;){var r;s.shift(),e=null===(r=s.first)||void 0===r?void 0:r.value}if(!e)return;const n=e.shift();return e.length||s.shift(),n}})}async _more(){if(!this._id||!this.hasMore)return;const t=await this._db.request({method:"POST",path:this._nextBatchId?`/_api/cursor/${encodeURIComponent(this._id)}/${this._nextBatchId}`:`/_api/cursor/${encodeURIComponent(this._id)}`,hostUrl:this._hostUrl,allowDirtyRead:this._allowDirtyRead});this._batches.push(new n.LinkedList(t.result)),this._hasMore=t.hasMore,this._nextBatchId=t.nextBatchId}get items(){return this._itemsCursor}get extra(){return this._extra}get count(){return this._count}get hasMore(){return this._hasMore}get hasNext(){return this.hasMore||Boolean(this._batches.length)}async*[Symbol.asyncIterator](){for(;this.hasNext;)yield this.next()}async loadAll(){for(;this._hasMore;)await this._more()}async all(){return this.map((t=>t))}async next(){for(;!this._batches.length&&this.hasNext;)await this._more();if(!this._batches.length)return;const t=this._batches.shift();if(!t)return;const e=[...t.values()];return t.clear(!0),e}async forEach(t){let e=0;for(;this.hasNext;){const r=t(await this.next(),e,this);if(e++,!1===r)return r;this.hasNext&&await this._more()}return!0}async map(t){let e=0;const r=[];for(;this.hasNext;){const n=await this.next();r.push(t(n,e,this)),e++}return r}async flatMap(t){let e=0;const r=[];for(;this.hasNext;){const n=t(await this.next(),e,this);Array.isArray(n)?r.push(...n):r.push(n),e++}return r}async reduce(t,e){let r=0;if(!this.hasNext)return e;void 0===e&&(e=await this.next(),r+=1);let n=e;for(;this.hasNext;)n=t(n,await this.next(),r,this),r++;return n}async kill(){if(this._batches.length){for(const t of this._batches.values())t.clear();this._batches.clear()}if(this.hasNext)return this._db.request({method:"DELETE",path:`/_api/cursor/${encodeURIComponent(this._id)}`},(()=>{this._hasMore=!1}))}}class i{constructor(t,e){this._batches=t,this._view=e}get batches(){return this._batches}get extra(){return this.batches.extra}get count(){return this.batches.count}get hasNext(){return this.batches.hasNext}async*[Symbol.asyncIterator](){for(;this.hasNext;)yield this.next()}async all(){return this.batches.flatMap((t=>t))}async next(){for(;this._view.isEmpty&&this.batches.hasMore;)await this._view.more();if(!this._view.isEmpty)return this._view.shift()}async forEach(t){let e=0;for(;this.hasNext;){const r=t(await this.next(),e,this);if(e++,!1===r)return r}return!0}async map(t){let e=0;const r=[];for(;this.hasNext;){const n=await this.next();r.push(t(n,e,this)),e++}return r}async flatMap(t){let e=0;const r=[];for(;this.hasNext;){const n=t(await this.next(),e,this);Array.isArray(n)?r.push(...n):r.push(n),e++}return r}async reduce(t,e){let r=0;if(!this.hasNext)return e;void 0===e&&(e=await this.next(),r+=1);let n=e;for(;this.hasNext;)n=t(n,await this.next(),r,this),r++;return n}async kill(){return this.batches.kill()}}},928:function(t,e,r){"use strict";r.r(e),r.d(e,{Database:function(){return T},isArangoDatabase:function(){return q}});var n=r(594),o=r(97),i=r(91),s=r(95),a=r(43);function h(t){return btoa(t)}var u=r(979);function c(t){const e=t.match(/^(tcp|ssl|tls)((?::|\+).+)/);e&&(t=("tcp"===e[1]?"http":"https")+e[2]);const r=t.match(/^(?:(http|https)\+)?unix:\/\/(\/.+)/);return r&&(t=`${r[1]||"http"}://unix:${r[2]}`),t}var l=r(377);function d(){return{error:!0,message:this.message}}function p(t,e){const r=new URL(t),n=h(`${r.username||"root"}:${r.password}`);r.username="",r.password="";const o=function(t,e){const r={};for(const n of Object.keys(t))e.includes(n)||(r[n]=t[n]);return r}(e,["maxSockets"]);return function(t,e){let{method:i,url:s,headers:a,body:h,timeout:u,expectBinary:c}=t;const p=new URL(s.pathname,r);s.search?r.search?p.search=`${r.search}&${s.search.slice(1)}`:p.search=s.search.slice(1):p.search=r.search,a.authorization||(a.authorization=`Basic ${n}`);let m=(t,r)=>{m=()=>{},e(t,r)};const f=l({useXDR:!0,withCredentials:!0,...o,responseType:c?"blob":"text",url:String(p),body:h,method:i,headers:a,timeout:u},((t,e)=>{if(t){const e=t;e.request=f,e.toJSON=d,o.after&&o.after(e),m(e)}else{const t=e;t.request=f,t.body||(t.body=""),o.after&&o.after(null,t),m(null,t)}}));o.before&&o.before(f)}}const m=/\/(json|javascript)(\W|$)/;class f{_activeTasks=0;_arangoVersion=30900;_queue=new s.LinkedList;_databases=new Map;_hosts=[];_hostUrls=[];_transactionId=null;_queueTimes=new s.LinkedList;constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=t.url?Array.isArray(t.url)?t.url:[t.url]:["http://127.0.0.1:8529"],r=3*("ROUND_ROBIN"===t.loadBalancingStrategy?e.length:1);void 0!==t.arangoVersion&&(this._arangoVersion=t.arangoVersion),this._agent=t.agent,this._agentOptions={maxSockets:r,...t.agentOptions},this._maxTasks=this._agentOptions.maxSockets,this._headers={...t.headers},this._loadBalancingStrategy=t.loadBalancingStrategy??"NONE",this._precaptureStackTraces=Boolean(t.precaptureStackTraces),this._responseQueueTimeSamples=t.responseQueueTimeSamples??10,this._retryOnConflict=t.retryOnConflict??0,this._responseQueueTimeSamples<0&&(this._responseQueueTimeSamples=1/0),!1===t.maxRetries?this._maxRetries=!1:this._maxRetries=Number(t.maxRetries??0),this.addToHostList(e),t.auth&&(t.auth.hasOwnProperty("token")?this.setBearerAuth(t.auth):this.setBasicAuth(t.auth)),"ONE_RANDOM"===this._loadBalancingStrategy?(this._activeHostUrl=this._hostUrls[Math.floor(Math.random()*this._hostUrls.length)],this._activeDirtyHostUrl=this._hostUrls[Math.floor(Math.random()*this._hostUrls.length)]):(this._activeHostUrl=this._hostUrls[0],this._activeDirtyHostUrl=this._hostUrls[0])}get isArangoConnection(){return!0}get queueTime(){return{getLatest:()=>{var t;return null===(t=this._queueTimes.last)||void 0===t?void 0:t.value[1]},getValues:()=>Array.from(this._queueTimes.values()),getAvg:()=>{let t=0;for(const[,[,e]]of this._queueTimes)t+=e/this._queueTimes.length;return t}}}_runQueue(){if(!this._queue.length||this._activeTasks>=this._maxTasks)return;const t=this._queue.shift();let e=this._activeHostUrl;void 0!==t.hostUrl?e=t.hostUrl:t.allowDirtyRead?(e=this._activeDirtyHostUrl,this._activeDirtyHostUrl=this._hostUrls[(this._hostUrls.indexOf(this._activeDirtyHostUrl)+1)%this._hostUrls.length],t.options.headers["x-arango-allow-dirty-read"]="true"):"ROUND_ROBIN"===this._loadBalancingStrategy&&(this._activeHostUrl=this._hostUrls[(this._hostUrls.indexOf(this._activeHostUrl)+1)%this._hostUrls.length]),this._activeTasks+=1;const r=(n,o)=>{if(this._activeTasks-=1,!n&&o)if(503===o.statusCode&&o.headers["x-arango-endpoint"]){const r=o.headers["x-arango-endpoint"],[n]=this.addToHostList(r);t.hostUrl=n,this._activeHostUrl===e&&(this._activeHostUrl=n),this._queue.push(t)}else{o.arangojsHostUrl=e;const i=o.headers["content-type"],s=o.headers["x-arango-queue-time-seconds"];if(s)for(this._queueTimes.push([Date.now(),Number(s)]);this._responseQueueTimeSamples<this._queueTimes.length;)this._queueTimes.shift();let h;if(o.body.length&&i&&i.match(m))try{h=o.body,h=JSON.parse(h)}catch(e){if(!t.options.expectBinary)return"string"!=typeof h&&(h=o.body.toString("utf-8")),e.res=o,t.stack&&(e.stack+=t.stack()),void r(e)}else h=o.body&&!t.options.expectBinary?o.body.toString("utf-8"):o.body;(0,a.NV)(h)?(o.body=h,n=new a.XM(o)):o.statusCode&&o.statusCode>=400?(o.body=h,n=new a.oo(o)):(t.options.expectBinary||(o.body=h),t.resolve(t.transform?t.transform(o):o))}n&&(!t.allowDirtyRead&&this._hosts.length>1&&this._activeHostUrl===e&&"ROUND_ROBIN"!==this._loadBalancingStrategy&&(this._activeHostUrl=this._hostUrls[(this._hostUrls.indexOf(this._activeHostUrl)+1)%this._hostUrls.length]),(0,a.Pp)(n)&&n.errorNum===u.Vt&&t.retryOnConflict>0?(t.retryOnConflict-=1,this._queue.push(t)):((0,a.g0)(n)&&"connect"===n.syscall&&"ECONNREFUSED"===n.code||(0,a.Pp)(n)&&n.errorNum===u.W2)&&void 0===t.hostUrl&&!1!==this._maxRetries&&t.retries<(this._maxRetries||this._hosts.length-1)?(t.retries+=1,this._queue.push(t)):(t.stack&&(n.stack+=t.stack()),t.reject(n))),this._runQueue()};try{this._hosts[this._hostUrls.indexOf(e)](t.options,r)}catch(t){r(t)}}_buildUrl(t){let{basePath:e,path:r,qs:n}=t;const o=`${e||""}${r||""}`;let i;return n&&(i="string"==typeof n?`?${n}`:`?${function(t){let e="";for(let[r,n]of Object.entries(t))if(void 0!==n)if(r=encodeURIComponent(r),Array.isArray(n))for(let t of n)t=null==t?"":encodeURIComponent(String(t)),e+=`&${r}=${t}`;else n=null===n?"":encodeURIComponent(String(n)),e+=`&${r}=${n}`;return e.slice(1)}(n)}`),i?{pathname:o,search:i}:{pathname:o}}setBearerAuth(t){this.setHeader("authorization",`Bearer ${t.token}`)}setBasicAuth(t){this.setHeader("authorization",`Basic ${h(`${t.username}:${t.password}`)}`)}setResponseQueueTimeSamples(t){for(t<0&&(t=1/0),this._responseQueueTimeSamples=t;this._responseQueueTimeSamples<this._queueTimes.length;)this._queueTimes.shift()}database(t,e){if(null!==e)return e?(this._databases.set(t,e),e):this._databases.get(t);this._databases.delete(t)}setHostList(t){const e=t.map((t=>c(t)));this._hosts.splice(0,this._hosts.length,...e.map((t=>{const e=this._hostUrls.indexOf(t);return-1!==e?this._hosts[e]:p(t,this._agentOptions,this._agent)}))),this._hostUrls.splice(0,this._hostUrls.length,...e)}addToHostList(t){const e=(Array.isArray(t)?t:[t]).map((t=>c(t))),r=e.filter((t=>-1===this._hostUrls.indexOf(t)));return this._hostUrls.push(...r),this._hosts.push(...r.map((t=>p(t,this._agentOptions,this._agent)))),e}setTransactionId(t){this._transactionId=t}clearTransactionId(){this._transactionId=null}setHeader(t,e){null===e?delete this._headers[t]:this._headers[t]=e}close(){for(const t of this._hosts)t.close&&t.close()}async waitForPropagation(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1/0;const r=this._hosts.length,n=[],o=Date.now();let i=0;for(;;){if(n.length===r)return;for(;n.includes(this._hostUrls[i]);)i=(i+1)%r;const s=this._hostUrls[i];try{await this.request({...t,hostUrl:s})}catch(t){if(o+e<Date.now())throw t;await new Promise((t=>setTimeout(t,1e3)));continue}n.includes(s)||n.push(s)}}request(t,e){let{hostUrl:r,method:n="GET",body:o,expectBinary:i=!1,isBinary:s=!1,allowDirtyRead:a=!1,retryOnConflict:h=this._retryOnConflict,timeout:u=0,headers:c,...l}=t;return new Promise(((t,d)=>{let p="text/plain";s?p="application/octet-stream":o&&("object"==typeof o?(o=JSON.stringify(o),p="application/json"):o=String(o));const m={...this._headers,"content-type":p,"x-arango-version":String(this._arangoVersion),"x-arango-driver":"arangojs/8.4.1 (cloud)"};this._transactionId&&(m["x-arango-trx-id"]=this._transactionId);const f={retries:0,hostUrl:r,allowDirtyRead:a,retryOnConflict:h,options:{url:this._buildUrl(l),headers:{...m,...c},timeout:u,method:n,expectBinary:i,body:o},reject:d,resolve:t,transform:e};if(this._precaptureStackTraces)if("function"==typeof Error.captureStackTrace){const t={};Error.captureStackTrace(t),f.stack=()=>`\n${t.stack.split("\n").slice(3).join("\n")}`}else{const t=function(){let t=new Error;if(!t.stack)try{throw t}catch(e){t=e}return t}();Object.prototype.hasOwnProperty.call(t,"stack")&&(f.stack=()=>`\n${t.stack.split("\n").slice(4).join("\n")}`)}this._queue.push(f),this._runQueue()}))}}var y=r(267),_=r(909);function g(t,e){let r;try{r=new FormData;for(const e of Object.keys(t)){let n=t[e];void 0!==n&&(n instanceof Blob||"object"!=typeof n&&"function"!=typeof n||(n=JSON.stringify(n)),r.append(e,n))}}catch(t){return void e(t)}e(null,{body:r})}class b{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};e?"/"!==e.charAt(0)&&(e=`/${e}`):e="",this._db=t,this._path=e,this._headers=r}route(t,e){return t?"/"!==t.charAt(0)&&(t=`/${t}`):t="",new b(this._db,this._path+t,{...this._headers,...e})}request(t){const e={...t};return e.path&&"/"!==e.path?this._path&&"/"!==e.path.charAt(0)?e.path=`/${e.path}`:e.path=e.path:e.path="",e.basePath=this._path,e.headers={...this._headers,...e.headers},e.method=e.method?e.method.toUpperCase():"GET",this._db.request(e,!1)}delete(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];const n="string"==typeof e[0]?e.shift():void 0,[o,i]=e;return this.request({method:"DELETE",path:n,qs:o,headers:i})}get(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];const n="string"==typeof e[0]?e.shift():void 0,[o,i]=e;return this.request({method:"GET",path:n,qs:o,headers:i})}head(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];const n="string"==typeof e[0]?e.shift():void 0,[o,i]=e;return this.request({method:"HEAD",path:n,qs:o,headers:i})}patch(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];const n="string"==typeof e[0]?e.shift():void 0,[o,i,s]=e;return this.request({method:"PATCH",path:n,body:o,qs:i,headers:s})}post(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];const n="string"==typeof e[0]?e.shift():void 0,[o,i,s]=e;return this.request({method:"POST",path:n,body:o,qs:i,headers:s})}put(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];const n="string"==typeof e[0]?e.shift():void 0,[o,i,s]=e;return this.request({method:"PUT",path:n,body:o,qs:i,headers:s})}}class v{constructor(t,e){this._db=t,this._id=e}get isArangoTransaction(){return!0}get id(){return this._id}async exists(){try{return await this.get(),!0}catch(t){if((0,a.Pp)(t)&&t.errorNum===u.kO)return!1;throw t}}get(){return this._db.request({path:`/_api/transaction/${encodeURIComponent(this.id)}`},(t=>t.body.result))}commit(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{allowDirtyRead:e}=t;return this._db.request({method:"PUT",path:`/_api/transaction/${encodeURIComponent(this.id)}`,allowDirtyRead:e},(t=>t.body.result))}abort(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{allowDirtyRead:e}=t;return this._db.request({method:"DELETE",path:`/_api/transaction/${encodeURIComponent(this.id)}`,allowDirtyRead:e},(t=>t.body.result))}step(t){const e=this._db._connection;e.setTransactionId(this.id);try{const r=t();if(!r)throw new Error("Transaction callback was not an async function or did not return a promise!");return Promise.resolve(r)}finally{e.clearTransactionId()}}}var w=r(94);function q(t){return Boolean(t&&t.isArangoDatabase)}function x(t){if("string"==typeof t)return{write:[t]};if(Array.isArray(t))return{write:t.map(i.collectionToString)};if((0,i.isArangoCollection)(t))return{write:(0,i.collectionToString)(t)};const e={};return t&&(void 0!==t.allowImplicit&&(e.allowImplicit=t.allowImplicit),t.read&&(e.read=Array.isArray(t.read)?t.read.map(i.collectionToString):(0,i.collectionToString)(t.read)),t.write&&(e.write=Array.isArray(t.write)?t.write.map(i.collectionToString):(0,i.collectionToString)(t.write)),t.exclusive&&(e.exclusive=Array.isArray(t.exclusive)?t.exclusive.map(i.collectionToString):(0,i.collectionToString)(t.exclusive))),e}class T{_analyzers=new Map;_collections=new Map;_graphs=new Map;_views=new Map;constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;if(q(t)){const r=t._connection,n=(e||t.name).normalize("NFC");this._connection=r,this._name=n;const o=r.database(n);if(o)return o}else{const r=t,{databaseName:n,...o}="string"==typeof r||Array.isArray(r)?{databaseName:e,url:r}:r;this._connection=new f(o),this._name=(null==n?void 0:n.normalize("NFC"))||"_system"}}get isArangoDatabase(){return!0}get name(){return this._name}version(t){return this.request({method:"GET",path:"/_api/version",qs:{details:t}})}route(t,e){return new b(this,t,e)}request(t){let{absolutePath:e=!1,basePath:r,...n}=t,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.body;return e||(r=`/_db/${encodeURIComponent(this._name)}${r||""}`),this._connection.request({basePath:r,...n},o||void 0)}async acquireHostList(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const e=await this.request({path:"/_api/cluster/endpoints"},(t=>t.body.endpoints.map((t=>t.endpoint))));e.length>0&&(t?this._connection.setHostList(e):this._connection.addToHostList(e))}close(){this._connection.close()}async waitForPropagation(t,e){let{basePath:r,...n}=t;await this._connection.waitForPropagation({...n,basePath:`/_db/${encodeURIComponent(this._name)}${r||""}`},e)}get queueTime(){return this._connection.queueTime}setResponseQueueTimeSamples(t){this._connection.setResponseQueueTimeSamples(t)}useBasicAuth(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"root",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return this._connection.setBasicAuth({username:t,password:e}),this}useBearerAuth(t){return this._connection.setBearerAuth({token:t}),this}login(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"root",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return this.request({method:"POST",path:"/_open/auth",body:{username:t,password:e}},(t=>(this.useBearerAuth(t.body.jwt),t.body.jwt)))}renewAuthToken(){return this.request({method:"POST",path:"/_open/auth/renew"},(t=>t.body.jwt?(this.useBearerAuth(t.body.jwt),t.body.jwt):null))}getClusterImbalance(){return this.request({path:"/_admin/cluster/rebalance"},(t=>t.body.result))}computeClusterRebalance(t){return this.request({method:"POST",path:"/_admin/cluster/rebalance",body:{version:1,...t}},(t=>t.body.result))}executeClusterRebalance(t){return this.request({method:"POST",path:"/_admin/cluster/rebalance/execute",body:{version:1,moves:t}})}rebalanceCluster(t){return this.request({method:"PUT",path:"/_admin/cluster/rebalance",body:{version:1,...t}})}database(t){return new T(this,t)}get(){return this.request({path:"/_api/database/current"},(t=>t.body.result))}async exists(){try{return await this.get(),!0}catch(t){if((0,a.Pp)(t)&&t.errorNum===u.zp)return!1;throw t}}createDatabase(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{users:r,...n}=Array.isArray(e)?{users:e}:e;return this.request({method:"POST",path:"/_api/database",body:{name:t.normalize("NFC"),users:r,options:n}},(()=>this.database(t)))}listDatabases(){return this.request({path:"/_api/database"},(t=>t.body.result))}listUserDatabases(){return this.request({path:"/_api/database/user"},(t=>t.body.result))}databases(){return this.request({path:"/_api/database"},(t=>t.body.result.map((t=>this.database(t)))))}userDatabases(){return this.request({path:"/_api/database/user"},(t=>t.body.result.map((t=>this.database(t)))))}dropDatabase(t){return t=t.normalize("NFC"),this.request({method:"DELETE",path:`/_api/database/${encodeURIComponent(t)}`},(t=>t.body.result))}collection(t){return t=t.normalize("NFC"),this._collections.has(t)||this._collections.set(t,new i.Collection(this,t)),this._collections.get(t)}async createCollection(t,e){const r=this.collection(t);return await r.create(e),r}async createEdgeCollection(t,e){return this.createCollection(t,{...e,type:i.CollectionType.EDGE_COLLECTION})}async renameCollection(t,e){t=t.normalize("NFC");const r=await this.request({method:"PUT",path:`/_api/collection/${encodeURIComponent(t)}/rename`,body:{name:e.normalize("NFC")}});return this._collections.delete(t),r}listCollections(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.request({path:"/_api/collection",qs:{excludeSystem:t}},(t=>t.body.result))}async collections(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return(await this.listCollections(t)).map((t=>this.collection(t.name)))}graph(t){return t=t.normalize("NFC"),this._graphs.has(t)||this._graphs.set(t,new _.kJ(this,t)),this._graphs.get(t)}async createGraph(t,e,r){const n=this.graph(t.normalize("NFC"));return await n.create(e,r),n}listGraphs(){return this.request({path:"/_api/gharial"},(t=>t.body.graphs))}async graphs(){return(await this.listGraphs()).map((t=>this.graph(t._key)))}view(t){return t=t.normalize("NFC"),this._views.has(t)||this._views.set(t,new w.View(this,t)),this._views.get(t)}async createView(t,e){const r=this.view(t.normalize("NFC"));return await r.create(e),r}async renameView(t,e){t=t.normalize("NFC");const r=await this.request({method:"PUT",path:`/_api/view/${encodeURIComponent(t)}/rename`,body:{name:e.normalize("NFC")}});return this._views.delete(t),r}listViews(){return this.request({path:"/_api/view"},(t=>t.body.result))}async views(){return(await this.listViews()).map((t=>this.view(t.name)))}analyzer(t){return t=t.normalize("NFC"),this._analyzers.has(t)||this._analyzers.set(t,new n.L(this,t)),this._analyzers.get(t)}async createAnalyzer(t,e){const r=this.analyzer(t);return await r.create(e),r}listAnalyzers(){return this.request({path:"/_api/analyzer"},(t=>t.body.result))}async analyzers(){return(await this.listAnalyzers()).map((t=>this.analyzer(t.name)))}listUsers(){return this.request({path:"/_api/user"},(t=>t.body.result))}getUser(t){return this.request({path:`/_api/user/${encodeURIComponent(t)}`})}createUser(t,e){return"string"==typeof e&&(e={passwd:e}),this.request({method:"POST",path:"/_api/user",body:{user:t,...e}},(t=>t.body))}updateUser(t,e){return"string"==typeof e&&(e={passwd:e}),this.request({method:"PATCH",path:`/_api/user/${encodeURIComponent(t)}`,body:e},(t=>t.body))}replaceUser(t,e){return"string"==typeof e&&(e={passwd:e}),this.request({method:"PUT",path:`/_api/user/${encodeURIComponent(t)}`,body:e},(t=>t.body))}removeUser(t){return this.request({method:"DELETE",path:`/_api/user/${encodeURIComponent(t)}`},(t=>t.body))}getUserAccessLevel(t,e){let{database:r,collection:n}=e;const o=q(r)?r.name:(null==r?void 0:r.normalize("NFC"))??((0,i.isArangoCollection)(n)?n._db.name:this._name),s=n?`/${encodeURIComponent((0,i.isArangoCollection)(n)?n.name:n.normalize("NFC"))}`:"";return this.request({path:`/_api/user/${encodeURIComponent(t)}/database/${encodeURIComponent(o)}${s}`},(t=>t.body.result))}setUserAccessLevel(t,e){let{database:r,collection:n,grant:o}=e;const s=q(r)?r.name:(null==r?void 0:r.normalize("NFC"))??((0,i.isArangoCollection)(n)?n._db.name:this._name),a=n?`/${encodeURIComponent((0,i.isArangoCollection)(n)?n.name:n.normalize("NFC"))}`:"";return this.request({method:"PUT",path:`/_api/user/${encodeURIComponent(t)}/database/${encodeURIComponent(s)}${a}`,body:{grant:o}},(t=>t.body))}clearUserAccessLevel(t,e){let{database:r,collection:n}=e;const o=q(r)?r.name:(null==r?void 0:r.normalize("NFC"))??((0,i.isArangoCollection)(n)?n._db.name:this._name),s=n?`/${encodeURIComponent((0,i.isArangoCollection)(n)?n.name:n.normalize("NFC"))}`:"";return this.request({method:"DELETE",path:`/_api/user/${encodeURIComponent(t)}/database/${encodeURIComponent(o)}${s}`},(t=>t.body))}getUserDatabases(t,e){return this.request({path:`/_api/user/${encodeURIComponent(t)}/database`,qs:{full:e}},(t=>t.body.result))}executeTransaction(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{allowDirtyRead:n,...o}=r;return this.request({method:"POST",path:"/_api/transaction",allowDirtyRead:n,body:{collections:x(t),action:e,...o}},(t=>t.body.result))}transaction(t){return new v(this,t)}beginTransaction(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{allowDirtyRead:r,...n}=e;return this.request({method:"POST",path:"/_api/transaction/begin",allowDirtyRead:r,body:{collections:x(t),...n}},(t=>new v(this,t.body.result.id)))}async withTransaction(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=await this.beginTransaction(t,r);try{const t=await e((t=>n.step(t)));return await n.commit(),t}catch(t){try{await n.abort()}catch{}throw t}}listTransactions(){return this._connection.request({path:"/_api/transaction"},(t=>t.body.transactions))}async transactions(){return(await this.listTransactions()).map((t=>this.transaction(t.id)))}query(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};(0,o.isAqlQuery)(t)?(r=e??{},e=t.bindVars,t=t.query):(0,o.isAqlLiteral)(t)&&(t=t.toAQL());const{allowDirtyRead:n,retryOnConflict:i,count:s,batchSize:a,cache:h,memoryLimit:u,ttl:c,timeout:l,...d}=r;return this.request({method:"POST",path:"/_api/cursor",body:{query:t,bindVars:e,count:s,batchSize:a,cache:h,memoryLimit:u,ttl:c,options:d},allowDirtyRead:n,retryOnConflict:i,timeout:l},(t=>new y.o(this,t.body,t.arangojsHostUrl,n).items))}explain(t,e,r){return(0,o.isAqlQuery)(t)?(r=e,e=t.bindVars,t=t.query):(0,o.isAqlLiteral)(t)&&(t=t.toAQL()),this.request({method:"POST",path:"/_api/explain",body:{query:t,bindVars:e,options:r}})}parse(t){return(0,o.isAqlQuery)(t)?t=t.query:(0,o.isAqlLiteral)(t)&&(t=t.toAQL()),this.request({method:"POST",path:"/_api/query",body:{query:t}})}queryRules(){return this.request({path:"/_api/query/rules"})}queryTracking(t){return this.request(t?{method:"PUT",path:"/_api/query/properties",body:t}:{method:"GET",path:"/_api/query/properties"})}listRunningQueries(){return this.request({method:"GET",path:"/_api/query/current"})}listSlowQueries(){return this.request({method:"GET",path:"/_api/query/slow"})}clearSlowQueries(){return this.request({method:"DELETE",path:"/_api/query/slow"},(()=>{}))}killQuery(t){return this.request({method:"DELETE",path:`/_api/query/${encodeURIComponent(t)}`},(()=>{}))}listFunctions(){return this.request({path:"/_api/aqlfunction"},(t=>t.body.result))}createFunction(t,e){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.request({method:"POST",path:"/_api/aqlfunction",body:{name:t,code:e,isDeterministic:r}})}dropFunction(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.request({method:"DELETE",path:`/_api/aqlfunction/${encodeURIComponent(t)}`,qs:{group:e}})}listServices(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.request({path:"/_api/foxx",qs:{excludeSystem:t}})}async installService(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{configuration:n,dependencies:o,...i}=r,s=await g({configuration:n,dependencies:o,source:e});return await this.request({...s,method:"POST",path:"/_api/foxx",isBinary:!0,qs:{...i,mount:t}})}async replaceService(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{configuration:n,dependencies:o,...i}=r,s=await g({configuration:n,dependencies:o,source:e});return await this.request({...s,method:"PUT",path:"/_api/foxx/service",isBinary:!0,qs:{...i,mount:t}})}async upgradeService(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{configuration:n,dependencies:o,...i}=r,s=await g({configuration:n,dependencies:o,source:e});return await this.request({...s,method:"PATCH",path:"/_api/foxx/service",isBinary:!0,qs:{...i,mount:t}})}uninstallService(t,e){return this.request({method:"DELETE",path:"/_api/foxx/service",qs:{...e,mount:t}},(()=>{}))}getService(t){return this.request({path:"/_api/foxx/service",qs:{mount:t}})}getServiceConfiguration(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.request({path:"/_api/foxx/configuration",qs:{mount:t,minimal:e}})}replaceServiceConfiguration(t,e){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.request({method:"PUT",path:"/_api/foxx/configuration",body:e,qs:{mount:t,minimal:r}})}updateServiceConfiguration(t,e){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.request({method:"PATCH",path:"/_api/foxx/configuration",body:e,qs:{mount:t,minimal:r}})}getServiceDependencies(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.request({path:"/_api/foxx/dependencies",qs:{mount:t,minimal:e}})}replaceServiceDependencies(t,e){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.request({method:"PUT",path:"/_api/foxx/dependencies",body:e,qs:{mount:t,minimal:r}})}updateServiceDependencies(t,e){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.request({method:"PATCH",path:"/_api/foxx/dependencies",body:e,qs:{mount:t,minimal:r}})}setServiceDevelopmentMode(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.request({method:e?"POST":"DELETE",path:"/_api/foxx/development",qs:{mount:t}})}listServiceScripts(t){return this.request({path:"/_api/foxx/scripts",qs:{mount:t}})}runServiceScript(t,e,r){return this.request({method:"POST",path:`/_api/foxx/scripts/${encodeURIComponent(e)}`,body:r,qs:{mount:t}})}runServiceTests(t,e){return this.request({method:"POST",path:"/_api/foxx/tests",qs:{...e,mount:t}})}getServiceReadme(t){return this.request({path:"/_api/foxx/readme",qs:{mount:t}})}getServiceDocumentation(t){return this.request({path:"/_api/foxx/swagger",qs:{mount:t}})}downloadService(t){return this.request({method:"POST",path:"/_api/foxx/download",qs:{mount:t},expectBinary:!0})}commitLocalServiceState(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.request({method:"POST",path:"/_api/foxx/commit",qs:{replace:t}},(()=>{}))}}},974:function(t,e,r){"use strict";function n(t,e){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if("string"!=typeof t){if(t._id)return n(t._id,e);if(t._key)return n(t._key,e);throw new Error("Document handle must be a string or an object with a _key or _id attribute")}if(t.includes("/")){const[n,...o]=t.split("/"),i=n.normalize("NFC");if(r&&i!==e)throw new Error(`Document ID "${t}" does not match collection name "${e}"`);return[i,...o].join("/")}return`${e}/${t}`}r.d(e,{q:function(){return n}})},43:function(t,e,r){"use strict";r.d(e,{NV:function(){return s},Pp:function(){return i},XM:function(){return h},g0:function(){return a},oo:function(){return u}});const n={0:"Network Error",304:"Not Modified",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",444:"Connection Closed Without Response",451:"Unavailable For Legal Reasons",499:"Client Closed Request",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",510:"Not Extended",511:"Network Authentication Required",599:"Network Connect Timeout Error"},o=["fileName","lineNumber","columnNumber","stack","description","number"];function i(t){return Boolean(t&&t.isArangoError)}function s(t){return t&&t.hasOwnProperty("error")&&t.hasOwnProperty("code")&&t.hasOwnProperty("errorMessage")&&t.hasOwnProperty("errorNum")}function a(t){return Object.getPrototypeOf(t)===Error.prototype&&t.hasOwnProperty("code")&&t.hasOwnProperty("errno")&&t.hasOwnProperty("syscall")}class h extends Error{name="ArangoError";constructor(t){super(),this.response=t,this.message=t.body.errorMessage,this.errorNum=t.body.errorNum,this.code=t.body.code;const e=new Error(this.message);e.name=this.name;for(const t of o)e[t]&&(this[t]=e[t])}get isArangoError(){return!0}toJSON(){return{error:!0,errorMessage:this.message,errorNum:this.errorNum,code:this.code}}}class u extends Error{name="HttpError";constructor(t){super(),this.response=t,this.code=t.statusCode||500,this.message=n[this.code]||n[500];const e=new Error(this.message);e.name=this.name;for(const t of o)e[t]&&(this[t]=e[t])}toJSON(){return{error:!0,code:this.code}}}},909:function(t,e,r){"use strict";r.d(e,{Vp:function(){return a},kJ:function(){return d}});var n=r(91),o=r(974),i=r(43),s=r(979);function a(t){return Boolean(t&&t.isArangoGraph)}function h(t,e){const{new:r,old:n,[e]:o,...i}=t,s={...i,...o};return void 0!==r&&(s.new=r),void 0!==n&&(s.old=n),s}function u(t){const e={};return e.collection=(0,n.collectionToString)(t.collection),e.from=Array.isArray(t.from)?t.from.map(n.collectionToString):[(0,n.collectionToString)(t.from)],e.to=Array.isArray(t.to)?t.to.map(n.collectionToString):[(0,n.collectionToString)(t.to)],e}class c{constructor(t,e,r){this._db=t,this._collection=t.collection(e),this._name=this._collection.name,this._graph=r}get isArangoCollection(){return!0}get name(){return this._name}get collection(){return this._collection}get graph(){return this._graph}async vertexExists(t){try{return await this._db.request({method:"HEAD",path:`/_api/gharial/${encodeURIComponent(this.graph.name)}/vertex/${encodeURI((0,o.q)(t,this._name))}`},(()=>!0))}catch(t){if(404===t.code)return!1;throw t}}async vertex(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&(e={graceful:e});const{allowDirtyRead:r,graceful:n=!1,rev:a,...h}=e,u={};a&&(u["if-match"]=a);const c=this._db.request({path:`/_api/gharial/${encodeURIComponent(this.graph.name)}/vertex/${encodeURI((0,o.q)(t,this._name))}`,headers:u,qs:h,allowDirtyRead:r},(t=>t.body.vertex));if(!n)return c;try{return await c}catch(t){if((0,i.Pp)(t)&&t.errorNum===s.Gk)return null;throw t}}save(t,e){return this._db.request({method:"POST",path:`/_api/gharial/${encodeURIComponent(this.graph.name)}/vertex/${encodeURIComponent(this._name)}`,body:t,qs:e},(t=>h(t.body,"vertex")))}replace(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};"string"==typeof r&&(r={rev:r});const{rev:n,...i}=r,s={};return n&&(s["if-match"]=n),this._db.request({method:"PUT",path:`/_api/gharial/${encodeURIComponent(this.graph.name)}/vertex/${encodeURI((0,o.q)(t,this._name))}`,body:e,qs:i,headers:s},(t=>h(t.body,"vertex")))}update(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};"string"==typeof r&&(r={rev:r});const n={},{rev:i,...s}=r;return i&&(n["if-match"]=i),this._db.request({method:"PATCH",path:`/_api/gharial/${encodeURIComponent(this.graph.name)}/vertex/${encodeURI((0,o.q)(t,this._name))}`,body:e,qs:s,headers:n},(t=>h(t.body,"vertex")))}remove(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"==typeof e&&(e={rev:e});const r={},{rev:n,...i}=e;return n&&(r["if-match"]=n),this._db.request({method:"DELETE",path:`/_api/gharial/${encodeURIComponent(this.graph.name)}/vertex/${encodeURI((0,o.q)(t,this._name))}`,qs:i,headers:r},(t=>h(t.body,"removed")))}}class l{constructor(t,e,r){this._db=t,this._collection=t.collection(e),this._name=this._collection.name,this._graph=r}get isArangoCollection(){return!0}get name(){return this._name}get collection(){return this._collection}get graph(){return this._graph}async edgeExists(t){try{return await this._db.request({method:"HEAD",path:`/_api/gharial/${encodeURIComponent(this.graph.name)}/edge/${encodeURI((0,o.q)(t,this._name))}`},(()=>!0))}catch(t){if(404===t.code)return!1;throw t}}async edge(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&(e={graceful:e});const{allowDirtyRead:r,graceful:n=!1,rev:a,...h}=e,u=this._db.request({path:`/_api/gharial/${encodeURIComponent(this.graph.name)}/edge/${encodeURI((0,o.q)(t,this._name))}`,qs:h,allowDirtyRead:r},(t=>t.body.edge));if(!n)return u;try{return await u}catch(t){if((0,i.Pp)(t)&&t.errorNum===s.Gk)return null;throw t}}save(t,e){return this._db.request({method:"POST",path:`/_api/gharial/${encodeURIComponent(this.graph.name)}/edge/${encodeURIComponent(this._name)}`,body:t,qs:e},(t=>h(t.body,"edge")))}replace(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};"string"==typeof r&&(r={rev:r});const{rev:n,...i}=r,s={};return n&&(s["if-match"]=n),this._db.request({method:"PUT",path:`/_api/gharial/${encodeURIComponent(this.graph.name)}/edge/${encodeURI((0,o.q)(t,this._name))}`,body:e,qs:i,headers:s},(t=>h(t.body,"edge")))}update(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};"string"==typeof r&&(r={rev:r});const{rev:n,...i}=r,s={};return n&&(s["if-match"]=n),this._db.request({method:"PATCH",path:`/_api/gharial/${encodeURIComponent(this.graph.name)}/edge/${encodeURI((0,o.q)(t,this._name))}`,body:e,qs:i,headers:s},(t=>h(t.body,"edge")))}remove(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"==typeof e&&(e={rev:e});const{rev:r,...n}=e,i={};return r&&(i["if-match"]=r),this._db.request({method:"DELETE",path:`/_api/gharial/${encodeURIComponent(this.graph.name)}/edge/${encodeURI((0,o.q)(t,this._name))}`,qs:n,headers:i},(t=>h(t.body,"removed")))}}class d{constructor(t,e){this._name=e.normalize("NFC"),this._db=t}get isArangoGraph(){return!0}get name(){return this._name}async exists(){try{return await this.get(),!0}catch(t){if((0,i.Pp)(t)&&t.errorNum===s.D$)return!1;throw t}}get(){return this._db.request({path:`/_api/gharial/${encodeURIComponent(this._name)}`},(t=>t.body.graph))}create(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{orphanCollections:r,satellites:o,waitForSync:i,isSmart:s,...a}=e;return this._db.request({method:"POST",path:"/_api/gharial",body:{orphanCollections:r&&(Array.isArray(r)?r.map(n.collectionToString):[(0,n.collectionToString)(r)]),edgeDefinitions:t.map(u),isSmart:s,name:this._name,options:{...a,satellites:null==o?void 0:o.map(n.collectionToString)}},qs:{waitForSync:i}},(t=>t.body.graph))}drop(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._db.request({method:"DELETE",path:`/_api/gharial/${encodeURIComponent(this._name)}`,qs:{dropCollections:t}},(t=>t.body.removed))}vertexCollection(t){return new c(this._db,(0,n.collectionToString)(t),this)}listVertexCollections(){return this._db.request({path:`/_api/gharial/${encodeURIComponent(this._name)}/vertex`},(t=>t.body.collections))}async vertexCollections(){return(await this.listVertexCollections()).map((t=>new c(this._db,t,this)))}addVertexCollection(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{satellites:r,...o}=e;return this._db.request({method:"POST",path:`/_api/gharial/${encodeURIComponent(this._name)}/vertex`,body:{collection:(0,n.collectionToString)(t),options:{...o,satellites:null==r?void 0:r.map(n.collectionToString)}}},(t=>t.body.graph))}removeVertexCollection(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._db.request({method:"DELETE",path:`/_api/gharial/${encodeURIComponent(this._name)}/vertex/${encodeURIComponent((0,n.collectionToString)(t))}`,qs:{dropCollection:e}},(t=>t.body.graph))}edgeCollection(t){return new l(this._db,(0,n.collectionToString)(t),this)}listEdgeCollections(){return this._db.request({path:`/_api/gharial/${encodeURIComponent(this._name)}/edge`},(t=>t.body.collections))}async edgeCollections(){return(await this.listEdgeCollections()).map((t=>new l(this._db,t,this)))}addEdgeDefinition(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{satellites:r,...o}=e;return this._db.request({method:"POST",path:`/_api/gharial/${encodeURIComponent(this._name)}/edge`,body:{...u(t),options:{...o,satellites:null==r?void 0:r.map(n.collectionToString)}}},(t=>t.body.graph))}replaceEdgeDefinition(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=t,i=e;e&&!e.hasOwnProperty("collection")&&(r=e,e=void 0),e||(i=t,o=i.collection);const{satellites:s,...a}=r;return this._db.request({method:"PUT",path:`/_api/gharial/${encodeURIComponent(this._name)}/edge/${encodeURIComponent((0,n.collectionToString)(o))}`,body:{...u(i),options:{...a,satellites:null==s?void 0:s.map(n.collectionToString)}}},(t=>t.body.graph))}removeEdgeDefinition(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._db.request({method:"DELETE",path:`/_api/gharial/${encodeURIComponent(this._name)}/edge/${encodeURIComponent((0,n.collectionToString)(t))}`,qs:{dropCollection:e}},(t=>t.body.graph))}traversal(t,e){return this._db.request({method:"POST",path:"/_api/traversal",body:{...e,startVertex:t,graphName:this._name}},(t=>t.body.result))}}},979:function(t,e,r){"use strict";r.d(e,{D$:function(){return l},Gk:function(){return a},IB:function(){return s},I_:function(){return u},Vt:function(){return i},W2:function(){return o},Xf:function(){return h},kO:function(){return n},zp:function(){return c}});const n=10,o=503,i=1200,s=1202,a=1202,h=1203,u=1203,c=1228,l=1924},94:function(t,e,r){"use strict";r.r(e),r.d(e,{View:function(){return s},isArangoView:function(){return i}});var n=r(43),o=r(979);function i(t){return Boolean(t&&t.isArangoView)}class s{constructor(t,e){this._db=t,this._name=e.normalize("NFC")}get isArangoView(){return!0}get name(){return this._name}get(){return this._db.request({path:`/_api/view/${encodeURIComponent(this._name)}`})}async exists(){try{return await this.get(),!0}catch(t){if((0,n.Pp)(t)&&t.errorNum===o.I_)return!1;throw t}}create(t){return this._db.request({method:"POST",path:"/_api/view",body:{...t,name:this._name}})}async rename(t){const e=this._db.renameView(this._name,t);return this._name=t.normalize("NFC"),e}properties(){return this._db.request({path:`/_api/view/${encodeURIComponent(this._name)}/properties`})}updateProperties(t){return this._db.request({method:"PATCH",path:`/_api/view/${encodeURIComponent(this._name)}/properties`,body:t??{}})}replaceProperties(t){return this._db.request({method:"PUT",path:`/_api/view/${encodeURIComponent(this._name)}/properties`,body:t??{}})}drop(){return this._db.request({method:"DELETE",path:`/_api/view/${encodeURIComponent(this._name)}`},(t=>t.body.result))}}},293:function(t,e,r){"use strict";const{aql:n}=r(97),{CollectionStatus:o,CollectionType:i}=r(91),{ViewType:s}=r(94),{Database:a}=r(928);function h(t){return"string"==typeof t||Array.isArray(t),new a(t)}t.exports=h,Object.assign(h,{aql:n,arangojs:h,CollectionStatus:o,CollectionType:i,Database:a,ViewType:s})}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}return r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,{a:e}),e},r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r(588),r(293)}()}));
|
|
2
2
|
//# sourceMappingURL=web.js.map
|