arangojs 7.3.0 → 7.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/README.md +4 -2
  3. package/analyzer.d.ts +188 -1
  4. package/analyzer.d.ts.map +1 -1
  5. package/analyzer.js.map +1 -1
  6. package/aql.d.ts +2 -1
  7. package/aql.d.ts.map +1 -1
  8. package/aql.js +5 -1
  9. package/aql.js.map +1 -1
  10. package/collection.d.ts +72 -11
  11. package/collection.d.ts.map +1 -1
  12. package/collection.js +16 -3
  13. package/collection.js.map +1 -1
  14. package/connection.d.ts +3 -3
  15. package/connection.d.ts.map +1 -1
  16. package/connection.js +21 -9
  17. package/connection.js.map +1 -1
  18. package/cursor.js +4 -4
  19. package/cursor.js.map +1 -1
  20. package/database.d.ts +451 -4
  21. package/database.d.ts.map +1 -1
  22. package/database.js +357 -0
  23. package/database.js.map +1 -1
  24. package/documents.d.ts +6 -6
  25. package/documents.d.ts.map +1 -1
  26. package/documents.js +2 -2
  27. package/documents.js.map +1 -1
  28. package/error.d.ts +10 -0
  29. package/error.d.ts.map +1 -1
  30. package/error.js +14 -0
  31. package/error.js.map +1 -1
  32. package/graph.d.ts +16 -4
  33. package/graph.d.ts.map +1 -1
  34. package/graph.js +18 -1
  35. package/graph.js.map +1 -1
  36. package/indexes.d.ts +70 -0
  37. package/indexes.d.ts.map +1 -1
  38. package/indexes.js.map +1 -1
  39. package/lib/error.d.ts.map +1 -1
  40. package/lib/error.js +1 -0
  41. package/lib/error.js.map +1 -1
  42. package/lib/multipart.d.ts.map +1 -1
  43. package/lib/multipart.js +1 -0
  44. package/lib/multipart.js.map +1 -1
  45. package/lib/normalizeUrl.js +1 -1
  46. package/lib/normalizeUrl.js.map +1 -1
  47. package/lib/request.node.js.map +1 -1
  48. package/lib/xhr.d.ts.map +1 -1
  49. package/lib/xhr.js +1 -0
  50. package/lib/xhr.js.map +1 -1
  51. package/package.json +1 -1
  52. package/view.d.ts +1 -1
  53. package/view.d.ts.map +1 -1
  54. package/view.js.map +1 -1
  55. package/web.js +1 -1
  56. package/web.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"request.node.js","sourceRoot":"","sources":["../../src/lib/request.node.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,+BAOc;AACd,iCAAqE;AACrE,6BAAwC;AAExC,iCAA8B;AAE9B,yCAAsC;AACtC,iCAA8B;AA0C9B;;;GAGG;AACU,QAAA,SAAS,GAAG,KAAK,CAAC;AAE/B;;;;;;;;;GASG;AACH,SAAgB,aAAa,CAC3B,OAAe,EACf,YAAgD,EAChD,KAAW;IAEX,MAAM,YAAY,GAAG,WAAQ,CAAC,OAAO,CAAC,CAAC;IACvC,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE;QAC1B,MAAM,IAAI,KAAK,CAAC,8BAA8B,OAAO,EAAE,CAAC,CAAC;KAC1D;IACD,MAAM,KAAK,GAAG,YAAY,CAAC,QAAQ,KAAK,QAAQ,CAAC;IACjD,IAAI,UAA8B,CAAC;IACnC,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,YAAY,CAAC,QAAQ,SAAS,CAAC,EAAE;QACzD,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE;YAC1B,MAAM,IAAI,KAAK,CACb,uHAAuH,OAAO,EAAE,CACjI,CAAC;SACH;QACD,MAAM,CAAC,GAAG,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC7C,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE;YACZ,UAAU,GAAG,YAAY,CAAC,QAAQ,CAAC;YACnC,OAAO,YAAY,CAAC,QAAQ,CAAC;SAC9B;aAAM;YACL,UAAU,GAAG,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC/C,YAAY,CAAC,QAAQ,GAAG,YAAY,CAAC,QAAQ,C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CAAC;KACF,CACF,CAAC;AACJ,CAAC;AA3HD,sCA2HC","sourcesContent":["/**\n * Node.js implementation of the HTTP(S) request function.\n *\n * @packageDocumentation\n * @internal\n * @hidden\n */\n\nimport {\n Agent as HttpAgent,\n AgentOptions,\n ClientRequest,\n ClientRequestArgs,\n IncomingMessage,\n request as httpRequest,\n} from \"http\";\nimport { Agent as HttpsAgent, request as httpsRequest } from \"https\";\nimport { parse as parseUrl } from \"url\";\nimport { Headers, RequestInterceptors } from \"../connection\";\nimport { btoa } from \"./btoa\";\nimport { Errback } from \"./errback\";\nimport { joinPath } from \"./joinPath\";\nimport { omit } from \"./omit\";\n\n/**\n * @internal\n * @hidden\n */\nexport interface ArangojsResponse extends IncomingMessage {\n request: ClientRequest;\n body?: any;\n arangojsHostId?: number;\n}\n\n/**\n * @internal\n * @hidden\n */\nexport interface ArangojsError extends Error {\n request: ClientRequest;\n}\n\n/**\n * @internal\n * @hidden\n */\nexport type RequestOptions = {\n method: string;\n url: { pathname: string; search?: string };\n headers: Headers;\n body: any;\n expectBinary: boolean;\n timeout?: number;\n};\n\n/**\n * @internal\n * @hidden\n */\nexport type RequestFunction = {\n (options: RequestOptions, cb: Errback<ArangojsResponse>): void;\n close?: () => void;\n};\n\n/**\n * @internal\n * @hidden\n */\nexport const isBrowser = false;\n\n/**\n * Create a function for performing requests against a given host.\n *\n * @param baseUrl - Base URL of the host, i.e. protocol, port and domain name.\n * @param agentOptions - Options to use for creating the agent.\n * @param agent - Agent to use for performing requests.\n *\n * @internal\n * @hidden\n */\nexport function createRequest(\n baseUrl: string,\n agentOptions: AgentOptions & RequestInterceptors,\n agent?: any\n): RequestFunction {\n const baseUrlParts = parseUrl(baseUrl);\n if (!baseUrlParts.protocol) {\n throw new Error(`Invalid URL (no protocol): ${baseUrl}`);\n }\n const isTls = baseUrlParts.protocol === \"https:\";\n let socketPath: string | undefined;\n if (baseUrl.startsWith(`${baseUrlParts.protocol}//unix:`)) {\n if (!baseUrlParts.pathname) {\n throw new Error(\n `Unix socket URL must be in the format http://unix:/socket/path, http+unix:///socket/path or unix:///socket/path not ${baseUrl}`\n );\n }\n const i = baseUrlParts.pathname.indexOf(\":\");\n if (i === -1) {\n socketPath = baseUrlParts.pathname;\n delete baseUrlParts.pathname;\n } else {\n socketPath = baseUrlParts.pathname.slice(0, i);\n baseUrlParts.pathname = baseUrlParts.pathname.slice(i + 1);\n if (baseUrlParts.pathname === \"\") {\n delete baseUrlParts.pathname;\n }\n }\n }\n if (socketPath && !socketPath.replace(/\\//g, \"\").length) {\n throw new Error(`Invalid URL (empty unix socket path): ${baseUrl}`);\n }\n if (!agent) {\n const opts = omit(agentOptions, [\"before\", \"after\"]);\n if (isTls) agent = new HttpsAgent(opts);\n else agent = new HttpAgent(opts);\n }\n return Object.assign(\n function request(\n { method, url, headers, body, timeout }: RequestOptions,\n callback: Errback<ArangojsResponse>\n ) {\n let path = baseUrlParts.pathname\n ? url.pathname\n ? joinPath(baseUrlParts.pathname, url.pathname)\n : baseUrlParts.pathname\n : url.pathname;\n const search = url.search\n ? baseUrlParts.search\n ? `${baseUrlParts.search}&${url.search.slice(1)}`\n : url.search\n : baseUrlParts.search;\n if (search) path += search;\n if (body && !headers[\"content-length\"]) {\n headers[\"content-length\"] = String(Buffer.byteLength(body));\n }\n if (!headers[\"authorization\"]) {\n headers[\"authorization\"] = `Basic ${btoa(\n baseUrlParts.auth || \"root:\"\n )}`;\n }\n const options: ClientRequestArgs = { path, method, headers, agent };\n if (socketPath) {\n options.socketPath = socketPath;\n } else {\n options.host = baseUrlParts.hostname;\n options.port = baseUrlParts.port;\n }\n let called = false;\n try {\n const req = (isTls ? httpsRequest : httpRequest)(\n options,\n (res: IncomingMessage) => {\n const data: Buffer[] = [];\n res.on(\"data\", (chunk) => data.push(chunk as Buffer));\n res.on(\"end\", () => {\n const response = res as ArangojsResponse;\n response.request = req;\n response.body = Buffer.concat(data);\n if (called) return;\n called = true;\n if (agentOptions.after) {\n agentOptions.after(null, response);\n }\n callback(null, response);\n });\n }\n );\n if (timeout) {\n req.setTimeout(timeout);\n }\n req.on(\"timeout\", () => {\n req.abort();\n });\n req.on(\"error\", (err) => {\n const error = err as ArangojsError;\n error.request = req;\n if (called) return;\n called = true;\n if (agentOptions.after) {\n agentOptions.after(error);\n }\n callback(error);\n });\n if (body) req.write(body);\n if (agentOptions.before) {\n agentOptions.before(req);\n }\n req.end();\n } catch (e) {\n if (called) return;\n called = true;\n setTimeout(() => {\n callback(e);\n }, 0);\n }\n },\n {\n close() {\n agent.destroy();\n },\n }\n );\n}\n"]}
1
+ {"version":3,"file":"request.node.js","sourceRoot":"","sources":["../../src/lib/request.node.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,+BAOc;AACd,iCAAqE;AACrE,6BAA4D;AAE5D,iCAA8B;AAE9B,yCAAsC;AACtC,iCAA8B;AA0C9B;;;GAGG;AACU,QAAA,SAAS,GAAG,KAAK,CAAC;AAE/B;;;;;;;;;GASG;AACH,SAAgB,aAAa,CAC3B,OAAe,EACf,YAAgD,EAChD,KAAW;IAEX,MAAM,YAAY,GAAG,WAAQ,CAAC,OAAO,CAAgC,CAAC;IACtE,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE;QAC1B,MAAM,IAAI,KAAK,CAAC,8BAA8B,OAAO,EAAE,CAAC,CAAC;KAC1D;IACD,MAAM,KAAK,GAAG,YAAY,CAAC,QAAQ,KAAK,QAAQ,CAAC;IACjD,IAAI,UAA8B,CAAC;IACnC,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,YAAY,CAAC,QAAQ,SAAS,CAAC,EAAE;QACzD,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE;YAC1B,MAAM,IAAI,KAAK,CACb,uHAAuH,OAAO,EAAE,CACjI,CAAC;SACH;QACD,MAAM,CAAC,GAAG,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC7C,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE;YACZ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AAI,MAAM;gBAAE,OAAO;YACnB,MAAM,GAAG,IAAI,CAAC;YACd,UAAU,CAAC,GAAG,EAAE;gBACd,QAAQ,CAAC,CAAC,CAAC,CAAC;YACd,CAAC,EAAE,CAAC,CAAC,CAAC;SACP;IACH,CAAC,EACD;QACE,KAAK;YACH,KAAK,CAAC,OAAO,EAAE,CAAC;QAClB,CAAC;KACF,CACF,CAAC;AACJ,CAAC;AA3HD,sCA2HC","sourcesContent":["/**\n * Node.js implementation of the HTTP(S) request function.\n *\n * @packageDocumentation\n * @internal\n * @hidden\n */\n\nimport {\n Agent as HttpAgent,\n AgentOptions,\n ClientRequest,\n ClientRequestArgs,\n IncomingMessage,\n request as httpRequest,\n} from \"http\";\nimport { Agent as HttpsAgent, request as httpsRequest } from \"https\";\nimport { parse as parseUrl, UrlWithStringQuery } from \"url\";\nimport { Headers, RequestInterceptors } from \"../connection\";\nimport { btoa } from \"./btoa\";\nimport { Errback } from \"./errback\";\nimport { joinPath } from \"./joinPath\";\nimport { omit } from \"./omit\";\n\n/**\n * @internal\n * @hidden\n */\nexport interface ArangojsResponse extends IncomingMessage {\n request: ClientRequest;\n body?: any;\n arangojsHostId?: number;\n}\n\n/**\n * @internal\n * @hidden\n */\nexport interface ArangojsError extends Error {\n request: ClientRequest;\n}\n\n/**\n * @internal\n * @hidden\n */\nexport type RequestOptions = {\n method: string;\n url: { pathname: string; search?: string };\n headers: Headers;\n body: any;\n expectBinary: boolean;\n timeout?: number;\n};\n\n/**\n * @internal\n * @hidden\n */\nexport type RequestFunction = {\n (options: RequestOptions, cb: Errback<ArangojsResponse>): void;\n close?: () => void;\n};\n\n/**\n * @internal\n * @hidden\n */\nexport const isBrowser = false;\n\n/**\n * Create a function for performing requests against a given host.\n *\n * @param baseUrl - Base URL of the host, i.e. protocol, port and domain name.\n * @param agentOptions - Options to use for creating the agent.\n * @param agent - Agent to use for performing requests.\n *\n * @internal\n * @hidden\n */\nexport function createRequest(\n baseUrl: string,\n agentOptions: AgentOptions & RequestInterceptors,\n agent?: any\n): RequestFunction {\n const baseUrlParts = parseUrl(baseUrl) as Partial<UrlWithStringQuery>;\n if (!baseUrlParts.protocol) {\n throw new Error(`Invalid URL (no protocol): ${baseUrl}`);\n }\n const isTls = baseUrlParts.protocol === \"https:\";\n let socketPath: string | undefined;\n if (baseUrl.startsWith(`${baseUrlParts.protocol}//unix:`)) {\n if (!baseUrlParts.pathname) {\n throw new Error(\n `Unix socket URL must be in the format http://unix:/socket/path, http+unix:///socket/path or unix:///socket/path not ${baseUrl}`\n );\n }\n const i = baseUrlParts.pathname.indexOf(\":\");\n if (i === -1) {\n socketPath = baseUrlParts.pathname;\n delete baseUrlParts.pathname;\n } else {\n socketPath = baseUrlParts.pathname.slice(0, i);\n baseUrlParts.pathname = baseUrlParts.pathname.slice(i + 1);\n if (baseUrlParts.pathname === \"\") {\n delete baseUrlParts.pathname;\n }\n }\n }\n if (socketPath && !socketPath.replace(/\\//g, \"\").length) {\n throw new Error(`Invalid URL (empty unix socket path): ${baseUrl}`);\n }\n if (!agent) {\n const opts = omit(agentOptions, [\"before\", \"after\"]);\n if (isTls) agent = new HttpsAgent(opts);\n else agent = new HttpAgent(opts);\n }\n return Object.assign(\n function request(\n { method, url, headers, body, timeout }: RequestOptions,\n callback: Errback<ArangojsResponse>\n ) {\n let path = baseUrlParts.pathname\n ? url.pathname\n ? joinPath(baseUrlParts.pathname, url.pathname)\n : baseUrlParts.pathname\n : url.pathname;\n const search = url.search\n ? baseUrlParts.search\n ? `${baseUrlParts.search}&${url.search.slice(1)}`\n : url.search\n : baseUrlParts.search;\n if (search) path += search;\n if (body && !headers[\"content-length\"]) {\n headers[\"content-length\"] = String(Buffer.byteLength(body));\n }\n if (!headers[\"authorization\"]) {\n headers[\"authorization\"] = `Basic ${btoa(\n baseUrlParts.auth || \"root:\"\n )}`;\n }\n const options: ClientRequestArgs = { path, method, headers, agent };\n if (socketPath) {\n options.socketPath = socketPath;\n } else {\n options.host = baseUrlParts.hostname;\n options.port = baseUrlParts.port;\n }\n let called = false;\n try {\n const req = (isTls ? httpsRequest : httpRequest)(\n options,\n (res: IncomingMessage) => {\n const data: Buffer[] = [];\n res.on(\"data\", (chunk) => data.push(chunk as Buffer));\n res.on(\"end\", () => {\n const response = res as ArangojsResponse;\n response.request = req;\n response.body = Buffer.concat(data);\n if (called) return;\n called = true;\n if (agentOptions.after) {\n agentOptions.after(null, response);\n }\n callback(null, response);\n });\n }\n );\n if (timeout) {\n req.setTimeout(timeout);\n }\n req.on(\"timeout\", () => {\n req.abort();\n });\n req.on(\"error\", (err) => {\n const error = err as ArangojsError;\n error.request = req;\n if (called) return;\n called = true;\n if (agentOptions.after) {\n agentOptions.after(error);\n }\n callback(error);\n });\n if (body) req.write(body);\n if (agentOptions.before) {\n agentOptions.before(req);\n }\n req.end();\n } catch (e) {\n if (called) return;\n called = true;\n setTimeout(() => {\n callback(e);\n }, 0);\n }\n },\n {\n close() {\n agent.destroy();\n },\n }\n );\n}\n"]}
package/lib/xhr.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"xhr.d.ts","sourceRoot":"","sources":["../../src/lib/xhr.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;kCAOzB,GAAG,MACR,OAAO,CAAC,GAAG,CAAC,KACb,aAAa;AAPlB;;;GAGG;AACH,wBAGmB"}
1
+ {"version":3,"file":"xhr.d.ts","sourceRoot":"","sources":["../../src/lib/xhr.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;kCAQzB,GAAG,MACR,OAAO,CAAC,GAAG,CAAC,KACb,aAAa;AARlB;;;GAGG;AAEH,wBAGmB"}
package/lib/xhr.js CHANGED
@@ -11,5 +11,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
11
11
  * @internal
12
12
  * @hidden
13
13
  */
14
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
14
15
  exports.default = require("xhr");
15
16
  //# sourceMappingURL=xhr.js.map
package/lib/xhr.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"xhr.js","sourceRoot":"","sources":["../../src/lib/xhr.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAKH;;;GAGG;AACH,kBAAe,OAAO,CAAC,KAAK,CAGV,CAAC","sourcesContent":["/**\n * Wrapper around the `xhr` module for HTTP(S) requests in the browser.\n *\n * @packageDocumentation\n * @internal\n * @hidden\n */\n\nimport { ClientRequest } from \"http\";\nimport { Errback } from \"./errback\";\n\n/**\n * @internal\n * @hidden\n */\nexport default require(\"xhr\") as (\n options: any,\n cb: Errback<any>\n) => ClientRequest;\n"]}
1
+ {"version":3,"file":"xhr.js","sourceRoot":"","sources":["../../src/lib/xhr.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAKH;;;GAGG;AACH,8DAA8D;AAC9D,kBAAe,OAAO,CAAC,KAAK,CAGV,CAAC","sourcesContent":["/**\n * Wrapper around the `xhr` module for HTTP(S) requests in the browser.\n *\n * @packageDocumentation\n * @internal\n * @hidden\n */\n\nimport { ClientRequest } from \"http\";\nimport { Errback } from \"./errback\";\n\n/**\n * @internal\n * @hidden\n */\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nexport default require(\"xhr\") as (\n options: any,\n cb: Errback<any>\n) => ClientRequest;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arangojs",
3
- "version": "7.3.0",
3
+ "version": "7.6.0",
4
4
  "engines": {
5
5
  "node": ">=10"
6
6
  },
package/view.d.ts CHANGED
@@ -314,7 +314,7 @@ export declare type ArangoSearchViewPropertiesOptions = {
314
314
  * See {@link ArangoSearchView} for the concrete type representing an
315
315
  * ArangoSearch View.
316
316
  */
317
- export declare class View<PropertiesOptions extends object = any, Properties extends object = any> {
317
+ export declare class View<PropertiesOptions extends Record<string, unknown> = any, Properties extends Record<string, unknown> = any> {
318
318
  protected _name: string;
319
319
  protected _db: Database;
320
320
  /**
package/view.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../src/view.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,sBAAsB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC;;GAEG;AACH,oBAAY,QAAQ;IAClB,iBAAiB,iBAAiB;CACnC;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,IAAI,IAAI,CAEpD;AAED;;GAEG;AACH,oBAAY,eAAe,GAAG;IAC5B;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,EAAE,QAAQ,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,oBAAY,oBAAoB,GAAG;IACjC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE,IAAI,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAAC;IAChD;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,oBAAY,0BAA0B,GAAG;IACvC;;OAEG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,yBAAyB,EAAE,MAAM,CAAC;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AAE,cAAc,IAAI,CAAC,IAAI,aAAa,EAAE,EAC9C,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAClB,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,gBAAgB,CACd,UAA8B;QAE9B,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CACrB;YACE,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,cAAc,IAAI,CAAC,IAAI,aAAa;YAC1C,IAAI,EAAE,UAAU,IAAI,EAAE;SACvB,EACD,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAClB,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,iBAAiB,CACf,UAA8B;QAE9B,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CACrB;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,cAAc,IAAI,CAAC,IAAI,aAAa;YAC1C,IAAI,EAAE,UAAU,IAAI,EAAE;SACvB,EACD,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAClB,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;OAWG;IACH,IAAI;QACF,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CACrB;YACE,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,cAAc,IAAI,CAAC,IAAI,EAAE;SAChC,EACD,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CACzB,CAAC;IACJ,CAAC;CACF;AApOD,oBAoOC","sourcesContent":["/**\n * ```ts\n * import type { ArangoSearchView } from \"arangojs/view\";\n * ```\n *\n * The \"view\" module provides View related types and interfaces for TypeScript.\n *\n * @packageDocumentation\n */\nimport { ArangoResponseMetadata, Dict } from \"./connection\";\nimport { Database } from \"./database\";\nimport { isArangoError } from \"./error\";\nimport { VIEW_NOT_FOUND } from \"./lib/codes\";\n\n/**\n * String values indicating the View type.\n */\nexport enum ViewType {\n ARANGOSEARCH_VIEW = \"arangosearch\",\n}\n\n/**\n * Indicates whether the given value represents a {@link View}.\n *\n * @param view - A value that might be a View.\n */\nexport function isArangoView(view: any): view is View {\n return Boolean(view && view.isArangoView);\n}\n\n/**\n * Generic description of a View.\n */\nexport type ViewDescription = {\n /**\n * A globally unique identifier for this View.\n */\n globallyUniqueId: string;\n /**\n * An identifier for this View.\n */\n id: string;\n /**\n * Name of the View.\n */\n name: string;\n /**\n * Type of the View.\n */\n type: ViewType;\n};\n\n/**\n * A link definition for an ArangoSearch View.\n */\nexport type ArangoSearchViewLink = {\n /**\n * A list of names of Analyzers to apply to values of processed document\n * attributes.\n *\n * Default: `[\"identity\"]`\n */\n analyzers?: string[];\n /**\n * An object mapping names of attributes to process for each document to\n * {@link ArangoSearchViewLink} definitions.\n */\n fields?: Dict<ArangoSearchViewLink | undefined>;\n /**\n * If set to `true`, all document attributes will be processed, otherwise\n * only the attributes in `fields` will be processed.\n *\n * Default: `false`\n */\n includeAllFields?: boolean;\n /**\n * If set to `true`, the position of values in array values will be tracked,\n * otherwise all values in an array will be treated as equal alternatives.\n */\n trackListPositions?: boolean;\n /**\n * Controls how the view should keep track of the attribute values.\n *\n * Default: `\"none\"`\n */\n storeValues?: \"none\" | \"id\";\n};\n\n/**\n * Properties of an ArangoSearch View.\n */\nexport type ArangoSearchViewProperties = {\n /**\n * How many commits to wait between removing unused files.\n */\n cleanupIntervalStep: number;\n /**\n * How long to wait between applying the `consolidationPolicy`.\n */\n consolidationIntervalMsec: number;\n /**\n * Maximum number of writers cached in the pool.\n */\n writebufferIdle: number;\n /**\n * Maximum number of concurrent active writers that perform a transaction.\n */\n writebufferActive: number;\n /**\n * Maximum memory byte size per writer before a writer flush is triggered.\n */\n writebufferSizeMax: number;\n /**\n * Consolidation policy to apply for selecting which segments should be\n * merged.\n */\n consolidationPolicy: BytesAccumConsolidationPolicy | TierConsolidationPolicy;\n /**\n * Attribute path (`field`) for the value of each document that is\n * used for sorting.\n */\n primarySort: {\n /**\n * Attribute path for the value of each document used for\n * sorting.\n */\n field: string;\n /**\n * If set to `\"asc\"`, the primary sorting order is ascending.\n * If set to `\"desc\"`, the primary sorting order is descending.\n */\n direction: \"desc\" | \"asc\";\n }[];\n /**\n * Compression to use for the primary sort data.\n *\n * Default: `\"lz4\"`\n */\n primarySortCompression: PrimarySortCompression;\n /**\n * Attribute paths for which values should be stored in the view index\n * in addition to those used for sorting via `primarySort`.\n */\n storedValues: {\n /**\n * Attribute paths for which values should be stored in the view index\n * in addition to those used for sorting via `primarySort`.\n */\n fields: string[];\n }[];\n /**\n * An object mapping names of linked collections to\n * {@link ArangoSearchViewLink} definitions.\n */\n links: Dict<ArangoSearchViewLink | undefined>;\n};\n\n/**\n * Policy to consolidate based on segment byte size and live document count as\n * dictated by the customization attributes.\n */\nexport type BytesAccumConsolidationPolicy = {\n /**\n * Type of consolidation policy.\n */\n type: \"bytes_accum\";\n /**\n * Must be in the range of `0.0` to `1.0`.\n */\n threshold?: number;\n};\n\n/**\n * Policy to consolidate if the sum of all candidate segment byte size is less\n * than the total segment byte size multiplied by a given threshold.\n */\nexport type TierConsolidationPolicy = {\n /**\n * Type of consolidation policy.\n */\n type: \"tier\";\n /**\n * Minimum number of segments that will be evaluated as candidates\n * for consolidation.\n *\n * Default: `1`\n */\n segmentsMin?: number;\n /**\n * Maximum number of segments that will be evaluated as candidates\n * for consolidation.\n *\n * Default: `10`\n */\n segmentsMax?: number;\n /**\n * Maximum allowed size of all consolidated segments.\n *\n * Default: `5368709120`, i.e. 5 GiB\n */\n segmentsBytesMax?: number;\n /**\n * Defines the value to treat all smaller segments as equal for\n * consolidation selection.\n *\n * Default: `2097152`, i.e. 2 MiB\n */\n segmentsBytesFloor?: number;\n /**\n * Minimum score.\n */\n minScore?: number;\n};\n\n/**\n * Compression to use for primary sort data of a View.\n *\n * Default: `\"lz4\"`\n */\nexport type PrimarySortCompression = \"lz4\" | \"none\";\n\n/**\n * Properties of an ArangoSearch View.\n */\nexport type ArangoSearchViewPropertiesOptions = {\n /**\n * How many commits to wait between removing unused files.\n *\n * Default: `2`\n */\n cleanupIntervalStep?: number;\n /**\n * How long to wait between applying the `consolidationPolicy`.\n *\n * Default: `10000`\n */\n consolidationIntervalMsec?: number;\n /**\n * How long to wait between commiting View data store changes and making\n * documents visible to queries.\n *\n * Default: `1000`\n */\n commitIntervalMsec?: number;\n /**\n * Maximum number of writers cached in the pool.\n *\n * Default: `64`\n */\n writebufferIdle?: number;\n /**\n * Maximum number of concurrent active writers that perform a transaction.\n *\n * Default: `0`\n */\n writebufferActive?: number;\n /**\n * Maximum memory byte size per writer before a writer flush is triggered.\n *\n * Default: `33554432`, i.e. 32 MiB\n */\n writebufferSizeMax?: number;\n /**\n * Consolidation policy to apply for selecting which segments should be\n * merged.\n */\n consolidationPolicy?: BytesAccumConsolidationPolicy | TierConsolidationPolicy;\n /**\n * Attribute path (`field`) for the value of each document that will be\n * used for sorting.\n *\n * If `direction` is set to `\"asc\"` or `asc` is set to `true`,\n * the primary sorting order will be ascending.\n *\n * If `direction` is set to `\"desc\"` or `asc` is set to `false`,\n * the primary sorting order will be descending.\n */\n primarySort?: (\n | {\n /**\n * Attribute path for the value of each document to use for\n * sorting.\n */\n field: string;\n /**\n * If set to `\"asc\"`, the primary sorting order will be ascending.\n * If set to `\"desc\"`, the primary sorting order will be descending.\n */\n direction: \"desc\" | \"asc\";\n }\n | {\n /**\n * Attribute path for the value of each document to use for\n * sorting.\n */\n field: string;\n /**\n * If set to `true`, the primary sorting order will be ascending.\n * If set to `false`, the primary sorting order will be descending.\n */\n asc: boolean;\n }\n )[];\n /**\n * Compression to use for the primary sort data.\n *\n * Default: `\"lz4\"`\n */\n primarySortCompression?: PrimarySortCompression;\n /**\n * Attribute paths for which values should be stored in the view index\n * in addition to those used for sorting via `primarySort`.\n */\n storedValues?: {\n /**\n * Attribute paths for which values should be stored in the view index\n * in addition to those used for sorting via `primarySort`.\n */\n fields: string[];\n }[];\n /**\n * An object mapping names of linked collections to\n * {@link ArangoSearchViewLink} definitions.\n */\n links?: Dict<ArangoSearchViewLink | undefined>;\n};\n\n/**\n * Represents a View in a {@link Database}.\n *\n * See {@link ArangoSearchView} for the concrete type representing an\n * ArangoSearch View.\n */\nexport class View<\n PropertiesOptions extends object = any,\n Properties extends object = any\n> {\n protected _name: string;\n protected _db: Database;\n\n /**\n * @internal\n * @hidden\n */\n constructor(db: Database, name: string) {\n this._db = db;\n this._name = name;\n }\n\n /**\n * @internal\n *\n * Indicates that this object represents an ArangoDB View.\n */\n get isArangoView(): true {\n return true;\n }\n\n /**\n * Name of the View.\n */\n get name() {\n return this._name;\n }\n\n /**\n * Retrieves general information about the View.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view = db.view(\"some-view\");\n * const data = await view.get();\n * // data contains general information about the View\n * ```\n */\n get(): Promise<ViewDescription & ArangoResponseMetadata> {\n return this._db.request(\n { path: `/_api/view/${this.name}` },\n (res) => res.body\n );\n }\n\n /**\n * Checks whether the View exists.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view = db.view(\"some-view\");\n * const exists = await view.exists();\n * console.log(exists); // indicates whether the View exists\n * ```\n */\n async exists(): Promise<boolean> {\n try {\n await this.get();\n return true;\n } catch (err) {\n if (isArangoError(err) && err.errorNum === VIEW_NOT_FOUND) {\n return false;\n }\n throw err;\n }\n }\n\n /**\n * Creates a View with the given `options` and the instance's name.\n *\n * See also {@link Database.createView}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view = db.view(\"potatoes\");\n * await view.create();\n * // the ArangoSearch View \"potatoes\" now exists\n * ```\n */\n create(\n options?: PropertiesOptions & { type: ViewType }\n ): Promise<ViewDescription & Properties> {\n return this._db.request(\n {\n method: \"POST\",\n path: \"/_api/view\",\n body: {\n type: ViewType.ARANGOSEARCH_VIEW,\n ...(options || {}),\n name: this.name,\n },\n },\n (res) => res.body\n );\n }\n\n /**\n * Renames the View and updates the instance's `name` to `newName`.\n *\n * Additionally removes the instance from the {@link Database}'s internal\n * cache.\n *\n * **Note**: Renaming Views may not be supported when ArangoDB is\n * running in a cluster configuration.\n *\n * @param newName - The new name of the View.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view1 = db.view(\"some-view\");\n * await view1.rename(\"other-view\");\n * const view2 = db.view(\"some-view\");\n * const view3 = db.view(\"other-view\");\n * // Note all three View instances are different objects but\n * // view1 and view3 represent the same ArangoDB view!\n * ```\n */\n async rename(\n newName: string\n ): Promise<ViewDescription & ArangoResponseMetadata> {\n const result = this._db.renameView(this._name, newName);\n this._name = newName;\n return result;\n }\n\n /**\n * Retrieves the View's properties.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view = db.view(\"some-view\");\n * const data = await view.properties();\n * // data contains the View's properties\n * ```\n */\n properties(): Promise<ViewDescription & Properties & ArangoResponseMetadata> {\n return this._db.request(\n { path: `/_api/view/${this.name}/properties` },\n (res) => res.body\n );\n }\n\n /**\n * Updates the properties of the View.\n *\n * @param properties - Properties of the View to update.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view = db.view(\"some-view\");\n * const result = await view.updateProperties({\n * consolidationIntervalMsec: 234\n * });\n * console.log(result.consolidationIntervalMsec); // 234\n * ```\n */\n updateProperties(\n properties?: PropertiesOptions\n ): Promise<ViewDescription & Properties> {\n return this._db.request(\n {\n method: \"PATCH\",\n path: `/_api/view/${this.name}/properties`,\n body: properties || {},\n },\n (res) => res.body\n );\n }\n\n /**\n * Replaces the properties of the View.\n *\n * @param properties - New properties of the View.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view = db.view(\"some-view\");\n * const result = await view.replaceProperties({\n * consolidationIntervalMsec: 234\n * });\n * console.log(result.consolidationIntervalMsec); // 234\n * ```\n */\n replaceProperties(\n properties?: PropertiesOptions\n ): Promise<ViewDescription & Properties> {\n return this._db.request(\n {\n method: \"PUT\",\n path: `/_api/view/${this.name}/properties`,\n body: properties || {},\n },\n (res) => res.body\n );\n }\n\n /**\n * Deletes the View from the database.\n *\n * @example\n *\n * ```js\n * const db = new Database();\n * const view = db.view(\"some-view\");\n * await view.drop();\n * // the View \"some-view\" no longer exists\n * ```\n */\n drop(): Promise<boolean> {\n return this._db.request(\n {\n method: \"DELETE\",\n path: `/_api/view/${this.name}`,\n },\n (res) => res.body.result\n );\n }\n}\n\n/**\n * Represents an ArangoSearch View in a {@link Database}.\n */\nexport interface ArangoSearchView\n extends View<\n ArangoSearchViewPropertiesOptions,\n ArangoSearchViewProperties & { type: ViewType.ARANGOSEARCH_VIEW }\n > {}\n"]}
1
+ {"version":3,"file":"view.js","sourceRoot":"","sources":["../src/view.ts"],"names":[],"mappings":";;;AAWA,mCAAwC;AACxC,uCAA6C;AAE7C;;GAEG;AACH,IAAY,QAEX;AAFD,WAAY,QAAQ;IAClB,8CAAkC,CAAA;AACpC,CAAC,EAFW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAEnB;AAED;;;;GAIG;AACH,SAAgB,YAAY,CAAC,IAAS;IACpC,OAAO,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC;AAC5C,CAAC;AAFD,oCAEC;AA2SD;;;;;GAKG;AACH,MAAa,IAAI;IAOf;;;OAGG;IACH,YAAY,EAAY,EAAE,IAAY;QACpC,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;QACd,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED;;;;OAIG;IACH,IAAI,YAAY;QACd,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED;;;;;;;;;;OAUG;IACH,GAAG;QACD,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CACrB,EAAE,IAAI,EAAE,cAAc,IAAI,CAAC,IAAI,EAAE,EAAE,EACnC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAClB,CAAC;IACJ,CAAC;IAED;;;;;;;;;;OAUG;I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O;YACf,IAAI,EAAE,cAAc,IAAI,CAAC,IAAI,aAAa;YAC1C,IAAI,EAAE,UAAU,IAAI,EAAE;SACvB,EACD,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAClB,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,iBAAiB,CACf,UAA8B;QAE9B,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CACrB;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,cAAc,IAAI,CAAC,IAAI,aAAa;YAC1C,IAAI,EAAE,UAAU,IAAI,EAAE;SACvB,EACD,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAClB,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;OAWG;IACH,IAAI;QACF,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CACrB;YACE,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,cAAc,IAAI,CAAC,IAAI,EAAE;SAChC,EACD,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CACzB,CAAC;IACJ,CAAC;CACF;AApOD,oBAoOC","sourcesContent":["/**\n * ```ts\n * import type { ArangoSearchView } from \"arangojs/view\";\n * ```\n *\n * The \"view\" module provides View related types and interfaces for TypeScript.\n *\n * @packageDocumentation\n */\nimport { ArangoResponseMetadata, Dict } from \"./connection\";\nimport { Database } from \"./database\";\nimport { isArangoError } from \"./error\";\nimport { VIEW_NOT_FOUND } from \"./lib/codes\";\n\n/**\n * String values indicating the View type.\n */\nexport enum ViewType {\n ARANGOSEARCH_VIEW = \"arangosearch\",\n}\n\n/**\n * Indicates whether the given value represents a {@link View}.\n *\n * @param view - A value that might be a View.\n */\nexport function isArangoView(view: any): view is View {\n return Boolean(view && view.isArangoView);\n}\n\n/**\n * Generic description of a View.\n */\nexport type ViewDescription = {\n /**\n * A globally unique identifier for this View.\n */\n globallyUniqueId: string;\n /**\n * An identifier for this View.\n */\n id: string;\n /**\n * Name of the View.\n */\n name: string;\n /**\n * Type of the View.\n */\n type: ViewType;\n};\n\n/**\n * A link definition for an ArangoSearch View.\n */\nexport type ArangoSearchViewLink = {\n /**\n * A list of names of Analyzers to apply to values of processed document\n * attributes.\n *\n * Default: `[\"identity\"]`\n */\n analyzers?: string[];\n /**\n * An object mapping names of attributes to process for each document to\n * {@link ArangoSearchViewLink} definitions.\n */\n fields?: Dict<ArangoSearchViewLink | undefined>;\n /**\n * If set to `true`, all document attributes will be processed, otherwise\n * only the attributes in `fields` will be processed.\n *\n * Default: `false`\n */\n includeAllFields?: boolean;\n /**\n * If set to `true`, the position of values in array values will be tracked,\n * otherwise all values in an array will be treated as equal alternatives.\n */\n trackListPositions?: boolean;\n /**\n * Controls how the view should keep track of the attribute values.\n *\n * Default: `\"none\"`\n */\n storeValues?: \"none\" | \"id\";\n};\n\n/**\n * Properties of an ArangoSearch View.\n */\nexport type ArangoSearchViewProperties = {\n /**\n * How many commits to wait between removing unused files.\n */\n cleanupIntervalStep: number;\n /**\n * How long to wait between applying the `consolidationPolicy`.\n */\n consolidationIntervalMsec: number;\n /**\n * Maximum number of writers cached in the pool.\n */\n writebufferIdle: number;\n /**\n * Maximum number of concurrent active writers that perform a transaction.\n */\n writebufferActive: number;\n /**\n * Maximum memory byte size per writer before a writer flush is triggered.\n */\n writebufferSizeMax: number;\n /**\n * Consolidation policy to apply for selecting which segments should be\n * merged.\n */\n consolidationPolicy: BytesAccumConsolidationPolicy | TierConsolidationPolicy;\n /**\n * Attribute path (`field`) for the value of each document that is\n * used for sorting.\n */\n primarySort: {\n /**\n * Attribute path for the value of each document used for\n * sorting.\n */\n field: string;\n /**\n * If set to `\"asc\"`, the primary sorting order is ascending.\n * If set to `\"desc\"`, the primary sorting order is descending.\n */\n direction: \"desc\" | \"asc\";\n }[];\n /**\n * Compression to use for the primary sort data.\n *\n * Default: `\"lz4\"`\n */\n primarySortCompression: PrimarySortCompression;\n /**\n * Attribute paths for which values should be stored in the view index\n * in addition to those used for sorting via `primarySort`.\n */\n storedValues: {\n /**\n * Attribute paths for which values should be stored in the view index\n * in addition to those used for sorting via `primarySort`.\n */\n fields: string[];\n }[];\n /**\n * An object mapping names of linked collections to\n * {@link ArangoSearchViewLink} definitions.\n */\n links: Dict<ArangoSearchViewLink | undefined>;\n};\n\n/**\n * Policy to consolidate based on segment byte size and live document count as\n * dictated by the customization attributes.\n */\nexport type BytesAccumConsolidationPolicy = {\n /**\n * Type of consolidation policy.\n */\n type: \"bytes_accum\";\n /**\n * Must be in the range of `0.0` to `1.0`.\n */\n threshold?: number;\n};\n\n/**\n * Policy to consolidate if the sum of all candidate segment byte size is less\n * than the total segment byte size multiplied by a given threshold.\n */\nexport type TierConsolidationPolicy = {\n /**\n * Type of consolidation policy.\n */\n type: \"tier\";\n /**\n * Minimum number of segments that will be evaluated as candidates\n * for consolidation.\n *\n * Default: `1`\n */\n segmentsMin?: number;\n /**\n * Maximum number of segments that will be evaluated as candidates\n * for consolidation.\n *\n * Default: `10`\n */\n segmentsMax?: number;\n /**\n * Maximum allowed size of all consolidated segments.\n *\n * Default: `5368709120`, i.e. 5 GiB\n */\n segmentsBytesMax?: number;\n /**\n * Defines the value to treat all smaller segments as equal for\n * consolidation selection.\n *\n * Default: `2097152`, i.e. 2 MiB\n */\n segmentsBytesFloor?: number;\n /**\n * Minimum score.\n */\n minScore?: number;\n};\n\n/**\n * Compression to use for primary sort data of a View.\n *\n * Default: `\"lz4\"`\n */\nexport type PrimarySortCompression = \"lz4\" | \"none\";\n\n/**\n * Properties of an ArangoSearch View.\n */\nexport type ArangoSearchViewPropertiesOptions = {\n /**\n * How many commits to wait between removing unused files.\n *\n * Default: `2`\n */\n cleanupIntervalStep?: number;\n /**\n * How long to wait between applying the `consolidationPolicy`.\n *\n * Default: `10000`\n */\n consolidationIntervalMsec?: number;\n /**\n * How long to wait between commiting View data store changes and making\n * documents visible to queries.\n *\n * Default: `1000`\n */\n commitIntervalMsec?: number;\n /**\n * Maximum number of writers cached in the pool.\n *\n * Default: `64`\n */\n writebufferIdle?: number;\n /**\n * Maximum number of concurrent active writers that perform a transaction.\n *\n * Default: `0`\n */\n writebufferActive?: number;\n /**\n * Maximum memory byte size per writer before a writer flush is triggered.\n *\n * Default: `33554432`, i.e. 32 MiB\n */\n writebufferSizeMax?: number;\n /**\n * Consolidation policy to apply for selecting which segments should be\n * merged.\n */\n consolidationPolicy?: BytesAccumConsolidationPolicy | TierConsolidationPolicy;\n /**\n * Attribute path (`field`) for the value of each document that will be\n * used for sorting.\n *\n * If `direction` is set to `\"asc\"` or `asc` is set to `true`,\n * the primary sorting order will be ascending.\n *\n * If `direction` is set to `\"desc\"` or `asc` is set to `false`,\n * the primary sorting order will be descending.\n */\n primarySort?: (\n | {\n /**\n * Attribute path for the value of each document to use for\n * sorting.\n */\n field: string;\n /**\n * If set to `\"asc\"`, the primary sorting order will be ascending.\n * If set to `\"desc\"`, the primary sorting order will be descending.\n */\n direction: \"desc\" | \"asc\";\n }\n | {\n /**\n * Attribute path for the value of each document to use for\n * sorting.\n */\n field: string;\n /**\n * If set to `true`, the primary sorting order will be ascending.\n * If set to `false`, the primary sorting order will be descending.\n */\n asc: boolean;\n }\n )[];\n /**\n * Compression to use for the primary sort data.\n *\n * Default: `\"lz4\"`\n */\n primarySortCompression?: PrimarySortCompression;\n /**\n * Attribute paths for which values should be stored in the view index\n * in addition to those used for sorting via `primarySort`.\n */\n storedValues?: {\n /**\n * Attribute paths for which values should be stored in the view index\n * in addition to those used for sorting via `primarySort`.\n */\n fields: string[];\n }[];\n /**\n * An object mapping names of linked collections to\n * {@link ArangoSearchViewLink} definitions.\n */\n links?: Dict<ArangoSearchViewLink | undefined>;\n};\n\n/**\n * Represents a View in a {@link Database}.\n *\n * See {@link ArangoSearchView} for the concrete type representing an\n * ArangoSearch View.\n */\nexport class View<\n PropertiesOptions extends Record<string, unknown> = any,\n Properties extends Record<string, unknown> = any\n> {\n protected _name: string;\n protected _db: Database;\n\n /**\n * @internal\n * @hidden\n */\n constructor(db: Database, name: string) {\n this._db = db;\n this._name = name;\n }\n\n /**\n * @internal\n *\n * Indicates that this object represents an ArangoDB View.\n */\n get isArangoView(): true {\n return true;\n }\n\n /**\n * Name of the View.\n */\n get name() {\n return this._name;\n }\n\n /**\n * Retrieves general information about the View.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view = db.view(\"some-view\");\n * const data = await view.get();\n * // data contains general information about the View\n * ```\n */\n get(): Promise<ViewDescription & ArangoResponseMetadata> {\n return this._db.request(\n { path: `/_api/view/${this.name}` },\n (res) => res.body\n );\n }\n\n /**\n * Checks whether the View exists.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view = db.view(\"some-view\");\n * const exists = await view.exists();\n * console.log(exists); // indicates whether the View exists\n * ```\n */\n async exists(): Promise<boolean> {\n try {\n await this.get();\n return true;\n } catch (err) {\n if (isArangoError(err) && err.errorNum === VIEW_NOT_FOUND) {\n return false;\n }\n throw err;\n }\n }\n\n /**\n * Creates a View with the given `options` and the instance's name.\n *\n * See also {@link Database.createView}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view = db.view(\"potatoes\");\n * await view.create();\n * // the ArangoSearch View \"potatoes\" now exists\n * ```\n */\n create(\n options?: PropertiesOptions & { type: ViewType }\n ): Promise<ViewDescription & Properties> {\n return this._db.request(\n {\n method: \"POST\",\n path: \"/_api/view\",\n body: {\n type: ViewType.ARANGOSEARCH_VIEW,\n ...(options || {}),\n name: this.name,\n },\n },\n (res) => res.body\n );\n }\n\n /**\n * Renames the View and updates the instance's `name` to `newName`.\n *\n * Additionally removes the instance from the {@link Database}'s internal\n * cache.\n *\n * **Note**: Renaming Views may not be supported when ArangoDB is\n * running in a cluster configuration.\n *\n * @param newName - The new name of the View.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view1 = db.view(\"some-view\");\n * await view1.rename(\"other-view\");\n * const view2 = db.view(\"some-view\");\n * const view3 = db.view(\"other-view\");\n * // Note all three View instances are different objects but\n * // view1 and view3 represent the same ArangoDB view!\n * ```\n */\n async rename(\n newName: string\n ): Promise<ViewDescription & ArangoResponseMetadata> {\n const result = this._db.renameView(this._name, newName);\n this._name = newName;\n return result;\n }\n\n /**\n * Retrieves the View's properties.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view = db.view(\"some-view\");\n * const data = await view.properties();\n * // data contains the View's properties\n * ```\n */\n properties(): Promise<ViewDescription & Properties & ArangoResponseMetadata> {\n return this._db.request(\n { path: `/_api/view/${this.name}/properties` },\n (res) => res.body\n );\n }\n\n /**\n * Updates the properties of the View.\n *\n * @param properties - Properties of the View to update.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view = db.view(\"some-view\");\n * const result = await view.updateProperties({\n * consolidationIntervalMsec: 234\n * });\n * console.log(result.consolidationIntervalMsec); // 234\n * ```\n */\n updateProperties(\n properties?: PropertiesOptions\n ): Promise<ViewDescription & Properties> {\n return this._db.request(\n {\n method: \"PATCH\",\n path: `/_api/view/${this.name}/properties`,\n body: properties || {},\n },\n (res) => res.body\n );\n }\n\n /**\n * Replaces the properties of the View.\n *\n * @param properties - New properties of the View.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view = db.view(\"some-view\");\n * const result = await view.replaceProperties({\n * consolidationIntervalMsec: 234\n * });\n * console.log(result.consolidationIntervalMsec); // 234\n * ```\n */\n replaceProperties(\n properties?: PropertiesOptions\n ): Promise<ViewDescription & Properties> {\n return this._db.request(\n {\n method: \"PUT\",\n path: `/_api/view/${this.name}/properties`,\n body: properties || {},\n },\n (res) => res.body\n );\n }\n\n /**\n * Deletes the View from the database.\n *\n * @example\n *\n * ```js\n * const db = new Database();\n * const view = db.view(\"some-view\");\n * await view.drop();\n * // the View \"some-view\" no longer exists\n * ```\n */\n drop(): Promise<boolean> {\n return this._db.request(\n {\n method: \"DELETE\",\n path: `/_api/view/${this.name}`,\n },\n (res) => res.body.result\n );\n }\n}\n\n/**\n * Represents an ArangoSearch View in a {@link Database}.\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface ArangoSearchView\n extends View<\n ArangoSearchViewPropertiesOptions,\n ArangoSearchViewProperties & { type: ViewType.ARANGOSEARCH_VIEW }\n > {}\n"]}