arangojs 10.0.0-alpha.0 → 10.0.0-alpha.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.
Files changed (167) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/README.md +50 -16
  3. package/cjs/administration.js.map +1 -1
  4. package/cjs/analyzers.js +3 -3
  5. package/cjs/analyzers.js.map +1 -1
  6. package/cjs/collections.d.ts +6 -6
  7. package/cjs/collections.js +31 -31
  8. package/cjs/collections.js.map +1 -1
  9. package/cjs/configuration.d.ts +181 -0
  10. package/cjs/configuration.d.ts.map +1 -0
  11. package/cjs/configuration.js +12 -0
  12. package/cjs/configuration.js.map +1 -0
  13. package/cjs/connection.d.ts +205 -222
  14. package/cjs/connection.d.ts.map +1 -1
  15. package/cjs/connection.js +329 -127
  16. package/cjs/connection.js.map +1 -1
  17. package/cjs/cursors.d.ts +1 -1
  18. package/cjs/cursors.d.ts.map +1 -1
  19. package/cjs/cursors.js +5 -5
  20. package/cjs/cursors.js.map +1 -1
  21. package/cjs/databases.d.ts +10 -17
  22. package/cjs/databases.d.ts.map +1 -1
  23. package/cjs/databases.js +98 -100
  24. package/cjs/databases.js.map +1 -1
  25. package/cjs/errors.d.ts +40 -25
  26. package/cjs/errors.d.ts.map +1 -1
  27. package/cjs/errors.js +77 -91
  28. package/cjs/errors.js.map +1 -1
  29. package/cjs/graphs.js +22 -22
  30. package/cjs/graphs.js.map +1 -1
  31. package/cjs/index.d.ts +3 -3
  32. package/cjs/index.d.ts.map +1 -1
  33. package/cjs/index.js.map +1 -1
  34. package/cjs/jobs.js +4 -4
  35. package/cjs/jobs.js.map +1 -1
  36. package/cjs/lib/util.d.ts +50 -0
  37. package/cjs/lib/util.d.ts.map +1 -0
  38. package/cjs/lib/util.js +108 -0
  39. package/cjs/lib/util.js.map +1 -0
  40. package/cjs/lib/{linkedList.d.ts → x3-linkedlist.d.ts} +1 -1
  41. package/cjs/lib/x3-linkedlist.d.ts.map +1 -0
  42. package/cjs/lib/{linkedList.js → x3-linkedlist.js} +1 -1
  43. package/cjs/lib/x3-linkedlist.js.map +1 -0
  44. package/cjs/queries.js.map +1 -1
  45. package/cjs/routes.d.ts +18 -18
  46. package/cjs/routes.d.ts.map +1 -1
  47. package/cjs/routes.js +57 -42
  48. package/cjs/routes.js.map +1 -1
  49. package/cjs/transactions.js +3 -3
  50. package/cjs/transactions.js.map +1 -1
  51. package/cjs/views.js +6 -6
  52. package/cjs/views.js.map +1 -1
  53. package/collections.d.ts +6 -6
  54. package/configuration.d.ts +181 -0
  55. package/configuration.d.ts.map +1 -0
  56. package/connection.d.ts +205 -222
  57. package/connection.d.ts.map +1 -1
  58. package/cursors.d.ts +1 -1
  59. package/cursors.d.ts.map +1 -1
  60. package/databases.d.ts +10 -17
  61. package/databases.d.ts.map +1 -1
  62. package/errors.d.ts +40 -25
  63. package/errors.d.ts.map +1 -1
  64. package/esm/administration.js.map +1 -1
  65. package/esm/analyzers.js +3 -3
  66. package/esm/analyzers.js.map +1 -1
  67. package/esm/collections.d.ts +6 -6
  68. package/esm/collections.js +31 -31
  69. package/esm/collections.js.map +1 -1
  70. package/esm/configuration.d.ts +181 -0
  71. package/esm/configuration.d.ts.map +1 -0
  72. package/esm/configuration.js +8 -0
  73. package/esm/configuration.js.map +1 -0
  74. package/esm/connection.d.ts +205 -222
  75. package/esm/connection.d.ts.map +1 -1
  76. package/esm/connection.js +323 -124
  77. package/esm/connection.js.map +1 -1
  78. package/esm/cursors.d.ts +1 -1
  79. package/esm/cursors.d.ts.map +1 -1
  80. package/esm/cursors.js +3 -3
  81. package/esm/cursors.js.map +1 -1
  82. package/esm/databases.d.ts +10 -17
  83. package/esm/databases.d.ts.map +1 -1
  84. package/esm/databases.js +98 -100
  85. package/esm/databases.js.map +1 -1
  86. package/esm/errors.d.ts +40 -25
  87. package/esm/errors.d.ts.map +1 -1
  88. package/esm/errors.js +53 -91
  89. package/esm/errors.js.map +1 -1
  90. package/esm/graphs.js +22 -22
  91. package/esm/graphs.js.map +1 -1
  92. package/esm/index.d.ts +3 -3
  93. package/esm/index.d.ts.map +1 -1
  94. package/esm/index.js.map +1 -1
  95. package/esm/jobs.js +4 -4
  96. package/esm/jobs.js.map +1 -1
  97. package/esm/lib/util.d.ts +50 -0
  98. package/esm/lib/util.d.ts.map +1 -0
  99. package/esm/lib/util.js +99 -0
  100. package/esm/lib/util.js.map +1 -0
  101. package/{lib/linkedList.d.ts → esm/lib/x3-linkedlist.d.ts} +1 -1
  102. package/esm/lib/x3-linkedlist.d.ts.map +1 -0
  103. package/esm/lib/{linkedList.js → x3-linkedlist.js} +1 -1
  104. package/esm/lib/x3-linkedlist.js.map +1 -0
  105. package/esm/queries.js.map +1 -1
  106. package/esm/routes.d.ts +18 -18
  107. package/esm/routes.d.ts.map +1 -1
  108. package/esm/routes.js +34 -42
  109. package/esm/routes.js.map +1 -1
  110. package/esm/transactions.js +3 -3
  111. package/esm/transactions.js.map +1 -1
  112. package/esm/views.js +6 -6
  113. package/esm/views.js.map +1 -1
  114. package/index.d.ts +3 -3
  115. package/index.d.ts.map +1 -1
  116. package/lib/util.d.ts +50 -0
  117. package/lib/util.d.ts.map +1 -0
  118. package/{esm/lib/linkedList.d.ts → lib/x3-linkedlist.d.ts} +1 -1
  119. package/lib/x3-linkedlist.d.ts.map +1 -0
  120. package/package.json +4 -1
  121. package/routes.d.ts +18 -18
  122. package/routes.d.ts.map +1 -1
  123. package/cjs/lib/joinPath.d.ts +0 -11
  124. package/cjs/lib/joinPath.d.ts.map +0 -1
  125. package/cjs/lib/joinPath.js +0 -23
  126. package/cjs/lib/joinPath.js.map +0 -1
  127. package/cjs/lib/linkedList.d.ts.map +0 -1
  128. package/cjs/lib/linkedList.js.map +0 -1
  129. package/cjs/lib/mergeHeaders.d.ts +0 -12
  130. package/cjs/lib/mergeHeaders.d.ts.map +0 -1
  131. package/cjs/lib/mergeHeaders.js +0 -22
  132. package/cjs/lib/mergeHeaders.js.map +0 -1
  133. package/cjs/lib/normalizeUrl.d.ts +0 -11
  134. package/cjs/lib/normalizeUrl.d.ts.map +0 -1
  135. package/cjs/lib/normalizeUrl.js +0 -23
  136. package/cjs/lib/normalizeUrl.js.map +0 -1
  137. package/cjs/lib/request.d.ts +0 -57
  138. package/cjs/lib/request.d.ts.map +0 -1
  139. package/cjs/lib/request.js +0 -116
  140. package/cjs/lib/request.js.map +0 -1
  141. package/esm/lib/joinPath.d.ts +0 -11
  142. package/esm/lib/joinPath.d.ts.map +0 -1
  143. package/esm/lib/joinPath.js +0 -19
  144. package/esm/lib/joinPath.js.map +0 -1
  145. package/esm/lib/linkedList.d.ts.map +0 -1
  146. package/esm/lib/linkedList.js.map +0 -1
  147. package/esm/lib/mergeHeaders.d.ts +0 -12
  148. package/esm/lib/mergeHeaders.d.ts.map +0 -1
  149. package/esm/lib/mergeHeaders.js +0 -18
  150. package/esm/lib/mergeHeaders.js.map +0 -1
  151. package/esm/lib/normalizeUrl.d.ts +0 -11
  152. package/esm/lib/normalizeUrl.d.ts.map +0 -1
  153. package/esm/lib/normalizeUrl.js +0 -19
  154. package/esm/lib/normalizeUrl.js.map +0 -1
  155. package/esm/lib/request.d.ts +0 -57
  156. package/esm/lib/request.d.ts.map +0 -1
  157. package/esm/lib/request.js +0 -112
  158. package/esm/lib/request.js.map +0 -1
  159. package/lib/joinPath.d.ts +0 -11
  160. package/lib/joinPath.d.ts.map +0 -1
  161. package/lib/linkedList.d.ts.map +0 -1
  162. package/lib/mergeHeaders.d.ts +0 -12
  163. package/lib/mergeHeaders.d.ts.map +0 -1
  164. package/lib/normalizeUrl.d.ts +0 -11
  165. package/lib/normalizeUrl.d.ts.map +0 -1
  166. package/lib/request.d.ts +0 -57
  167. package/lib/request.d.ts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -14,6 +14,73 @@ 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
+ ## [10.0.0-alpha.1] - 2024-12-09
18
+
19
+ This is a major release and breaks backwards compatibility.
20
+
21
+ See [the migration guide](./MIGRATING.md#v9-to-v10) for detailed instructions
22
+ for upgrading your code to arangojs v10.
23
+
24
+ ### Changed
25
+
26
+ - Renamed `CollectionDropOptions` type to `DropCollectionOptions`
27
+
28
+ - Renamed `CollectionTruncateOptions` type to `TruncateCollectionOptions`
29
+
30
+ - Renamed `Config` type to `ConfigOptions`
31
+
32
+ - Renamed `path` option to `pathname` in `RequestOptions` type
33
+
34
+ This affects the `db.waitForPropagation` and `route.request` methods.
35
+
36
+ - Removed `basePath` option from `RequestOptions` type
37
+
38
+ This affects the `db.waitForPropagation` and `route.request` methods.
39
+
40
+ - Renamed `route.path` property to `route.pathname`
41
+
42
+ - Changed error type constructor signatures
43
+
44
+ The `request` property is now always positional and the `options` property
45
+ is always optional.
46
+
47
+ - Moved configuration related types to new `config` module
48
+
49
+ The following types were moved: `Config`, `LoadBalancingStrategy`,
50
+ `BasicAuthCredentials` and `BearerAuthCredentials`.
51
+
52
+ - Moved `ArangoErrorResponse` type to `connection` module
53
+
54
+ The type is now also no longer marked as internal.
55
+
56
+ - Moved configuration related types to new `configuration` module
57
+
58
+ The following types were moved: `ConfigOptions`, `LoadBalancingStrategy`,
59
+ `BasicAuthCredentials` and `BearerAuthCredentials`.
60
+
61
+ - Moved internal utility functions to new `lib/util` module
62
+
63
+ These methods are all still marked as internal and should not be used
64
+ directly.
65
+
66
+ - Closing a connection now closes all open requests
67
+
68
+ Previously in certain situations only the most recent request would be
69
+ closed per server. Note that this still merely aborts the requests but
70
+ does not guarantee the underlying connections are closed as these are
71
+ handled by Node.js or the browser natively.
72
+
73
+ ### Added
74
+
75
+ - Restored support for Unix domain sockets
76
+
77
+ Using Unix domain sockets requires the `undici` library to be installed.
78
+
79
+ - Restored support for `config.agentOptions`
80
+
81
+ The `config.agentOptions` option can now be used to create a custom `undici`
82
+ agent if the `undici` library is installed.
83
+
17
84
  ## [10.0.0-alpha.0] - 2024-11-28
18
85
 
19
86
  This is a major release and breaks backwards compatibility.
@@ -2288,6 +2355,7 @@ For a detailed list of changes between pre-release versions of v7 see the
2288
2355
 
2289
2356
  Graph methods now only return the relevant part of the response body.
2290
2357
 
2358
+ [10.0.0-alpha.1]: https://github.com/arangodb/arangojs/compare/v10.0.0-alpha.0...v10.0.0-alpha.1
2291
2359
  [10.0.0-alpha.0]: https://github.com/arangodb/arangojs/compare/v9.2.0...v10.0.0-alpha.0
2292
2360
  [9.2.0]: https://github.com/arangodb/arangojs/compare/v9.1.0...v9.2.0
2293
2361
  [9.1.0]: https://github.com/arangodb/arangojs/compare/v9.0.0...v9.1.0
package/README.md CHANGED
@@ -255,7 +255,7 @@ allowing arangojs to provide more meaningful stack traces at the cost of an
255
255
  impact to performance even when no error occurs.
256
256
 
257
257
  ```diff
258
- const { Database } = require("arangojs");
258
+ import { Database } from "arangojs";
259
259
 
260
260
  const db = new Database({
261
261
  url: ARANGODB_SERVER,
@@ -269,15 +269,47 @@ that do not support the `stack` property on error objects, this option will
269
269
  still impact performance but not result in any additional information becoming
270
270
  available.
271
271
 
272
+ ### Unix domain sockets
273
+
274
+ If you want to use Unix domain sockets, you need to install the `undici` module,
275
+ which is an optional dependency of arangojs.
276
+
277
+ ```sh
278
+ npm install --save undici
279
+ ```
280
+
281
+ If the `undici` module is not installed and arangojs attempts to make a request
282
+ over a Unix domain socket, the request will fail with a plain `Error` with a
283
+ message indicating that the `undici` module is unavailable.
284
+
272
285
  ### Node.js with self-signed HTTPS certificates
273
286
 
274
- If you need to support self-signed HTTPS certificates in Node.js, you may have
275
- to override the global fetch agent. At the time of this writing, there is no
276
- official way to do this for the native `fetch` implementation in Node.js.
287
+ If you need to support self-signed HTTPS certificates in Node.js, you will need
288
+ to install the `undici` module, which is an optional dependency of arangojs.
289
+
290
+ ```sh
291
+ npm install --save undici
292
+ ```
293
+
294
+ You can instruct arangojs to use the `undici` module by setting the
295
+ `config.agentOptions` option:
296
+
297
+ ```diff
298
+ import { Database } from "arangojs";
299
+
300
+ const db = new Database({
301
+ url: ARANGODB_SERVER,
302
+ + agentOptions: {
303
+ + ca: [
304
+ + fs.readFileSync(".ssl/sub.class1.server.ca.pem"),
305
+ + fs.readFileSync(".ssl/ca.pem"),
306
+ + ],
307
+ + },
308
+ });
309
+ ```
277
310
 
278
- However as Node.js uses the `undici` module for its `fetch` implementation
279
- internally, you can override the global agent by adding `undici` as a
280
- dependency to your project and using its `setGlobalDispatcher` as follows:
311
+ To override the global fetch agent instead, you can use the `undici` module's
312
+ `setGlobalDispatcher` method as follows:
281
313
 
282
314
  ```js
283
315
  import { Agent, setGlobalDispatcher } from "undici";
@@ -293,20 +325,22 @@ setGlobalDispatcher(
293
325
  ```
294
326
 
295
327
  Although this is **strongly discouraged**, it's also possible to disable
296
- HTTPS certificate validation entirely, but note this has
328
+ HTTPS certificate validation entirely this way, but note this has
297
329
  **extremely dangerous** security implications:
298
330
 
299
- ```js
300
- import { Agent, setGlobalDispatcher } from "undici";
331
+ ```diff
332
+ import { Database } from "arangojs";
301
333
 
302
- setGlobalDispatcher(
303
- new Agent({
304
- rejectUnauthorized: false,
305
- })
306
- );
334
+ const db = new Database({
335
+ url: ARANGODB_SERVER,
336
+ + agentOptions: {
337
+ + rejectUnauthorized: false,
338
+ + },
339
+ });
307
340
  ```
308
341
 
309
- This is a [known limitation](https://github.com/orgs/nodejs/discussions/44038#discussioncomment-5701073)
342
+ The requirement to use the `undici` module to override these settings is a
343
+ [known limitation](https://github.com/orgs/nodejs/discussions/44038#discussioncomment-5701073)
310
344
  of Node.js at the time of this writing.
311
345
 
312
346
  When using arangojs in the browser, self-signed HTTPS certificates need to
@@ -1 +1 @@
1
- {"version":3,"file":"administration.js","sourceRoot":"","sources":["../../src/administration.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAqVF,CAAC","sourcesContent":["/**\n * ```ts\n * import type { VersionInfo } from \"arangojs/administration\";\n * ```\n *\n * The \"administration\" module provides types for database administration.\n *\n * @packageDocumentation\n */\n\n/**\n * Result of retrieving database version information.\n */\nexport type VersionInfo = {\n /**\n * Value identifying the server type, i.e. `\"arango\"`.\n */\n server: string;\n /**\n * ArangoDB license type or \"edition\".\n */\n license: \"community\" | \"enterprise\";\n /**\n * ArangoDB server version.\n */\n version: string;\n /**\n * Additional information about the ArangoDB server.\n */\n details?: { [key: string]: string };\n};\n\n/**\n * Information about the storage engine.\n */\nexport type EngineInfo = {\n /**\n * Endianness of the storage engine.\n */\n endianness?: \"little\" | \"big\";\n /**\n * Name of the storage engine.\n */\n name: string;\n /**\n * Features supported by the storage engine.\n */\n supports?: {\n /**\n * Index types supported by the storage engine.\n */\n indexes?: string[];\n /**\n * Aliases supported by the storage engine.\n */\n aliases?: {\n /**\n * Index type aliases supported by the storage engine.\n */\n indexes?: Record<string, string>;\n }\n };\n};\n\n/**\n * Information about the server status.\n */\nexport type ServerStatusInformation = {\n /**\n * (Cluster Coordinators and DB-Servers only.) The address of the server.\n */\n address?: string;\n /**\n * (Cluster Coordinators and DB-Servers only.) Information about the Agency.\n */\n agency?: {\n /**\n * Information about the communication with the Agency.\n */\n agencyComm: {\n /**\n * A list of possible Agency endpoints.\n */\n endpoints: string[];\n };\n };\n /**\n * (Cluster Agents only.) Information about the Agents.\n */\n agent?: {\n /**\n * The endpoint of the queried Agent.\n */\n endpoint: string;\n /**\n * Server ID of the queried Agent.\n */\n id: string;\n /**\n * Server ID of the leading Agent.\n */\n leaderId: string;\n /**\n * Whether the queried Agent is the leader.\n */\n leading: boolean;\n /**\n * The current term number.\n */\n term: number;\n };\n /**\n * (Cluster Coordinators only.) Information about the Coordinators.\n */\n coordinator?: {\n /**\n * The server ID of the Coordinator that is the Foxx master.\n */\n foxxmaster: string[];\n /**\n * Whether the queried Coordinator is the Foxx master.\n */\n isFoxxmaster: boolean[];\n };\n /**\n * Whether the Foxx API is enabled.\n */\n foxxApi: boolean;\n /**\n * A host identifier defined by the HOST or NODE_NAME environment variable, \n * or a fallback value using a machine identifier or the cluster/Agency address.\n */\n host: string;\n /**\n * A hostname defined by the HOSTNAME environment variable.\n */\n hostname?: string;\n /**\n * ArangoDB Edition.\n */\n license: \"community\" | \"enterprise\";\n /**\n * Server operation mode.\n * \n * @deprecated use `operationMode` instead\n */\n mode: \"server\" | \"console\";\n /**\n * Server operation mode.\n */\n operationMode: \"server\" | \"console\";\n /**\n * The process ID of arangod.\n */\n pid: number;\n /**\n * Server type.\n */\n server: \"arango\";\n /**\n * Information about the server status.\n */\n serverInfo: {\n /**\n * Whether the maintenance mode is enabled.\n */\n maintenance: boolean;\n /**\n * (Cluster only.) The persisted ID.\n */\n persistedId?: string;\n /**\n * Startup and recovery information.\n */\n progress: {\n /**\n * Internal name of the feature that is currently being prepared, started, stopped or unprepared.\n */\n feature: string;\n /**\n * Name of the lifecycle phase the instance is currently in.\n */\n phase: string;\n /**\n * Current recovery sequence number value.\n */\n recoveryTick: number;\n };\n /**\n * Whether writes are disabled.\n */\n readOnly: boolean;\n /**\n * (Cluster only.) The reboot ID. Changes on every restart.\n */\n rebootId?: number;\n /**\n * Either \"SINGLE\", \"COORDINATOR\", \"PRIMARY\" (DB-Server), or \"AGENT\"\n */\n role: \"SINGLE\" | \"COORDINATOR\" | \"PRIMARY\" | \"AGENT\";\n /**\n * (Cluster Coordinators and DB-Servers only.) The server ID.\n */\n serverId?: string;\n /**\n * (Cluster Coordinators and DB-Servers only.) Either \"STARTUP\", \"SERVING\",\n * or \"SHUTDOWN\".\n */\n state?: \"STARTUP\" | \"SERVING\" | \"SHUTDOWN\";\n /**\n * The server version string.\n */\n version: string;\n /**\n * Whether writes are enabled.\n * \n * @deprecated Use `readOnly` instead.\n */\n writeOpsEnabled: boolean;\n };\n};\n\n/**\n * Server availability.\n *\n * - `\"default\"`: The server is operational.\n * \n * - `\"readonly\"`: The server is in read-only mode.\n * \n * - `false`: The server is not available.\n */\nexport type ServerAvailability = \"default\" | \"readonly\" | false;\n\n/**\n * Single server deployment information for support purposes.\n */\nexport type SingleServerSupportInfo = {\n /**\n * ISO 8601 datetime string of when the information was requested.\n */\n date: string;\n /**\n * Information about the deployment.\n */\n deployment: {\n /**\n * Deployment mode:\n * \n * - `\"single\"`: A single server deployment.\n * \n * - `\"cluster\"`: A cluster deployment.\n */\n type: \"single\";\n };\n};\n\n/**\n * Cluster deployment information for support purposes.\n */\nexport type ClusterSupportInfo = {\n /**\n * ISO 8601 datetime string of when the information was requested.\n */\n date: string;\n /**\n * Information about the deployment.\n */\n deployment: {\n /**\n * Deployment mode:\n * \n * - `\"single\"`: A single server deployment.\n * \n * - `\"cluster\"`: A cluster deployment.\n */\n type: \"cluster\";\n /**\n * Information about the servers in the cluster.\n */\n servers: Record<string, Record<string, any>>;\n /**\n * Number of agents in the cluster.\n */\n agents: number;\n /**\n * Number of coordinators in the cluster.\n */\n coordinators: number;\n /**\n * Number of DB-Servers in the cluster.\n */\n dbServers: number;\n /**\n * Information about the shards in the cluster.\n */\n shards: {\n /**\n * Number of collections in the cluster.\n */\n collections: number;\n /**\n * Number of shards in the cluster.\n */\n shards: number;\n /**\n * Number of leaders in the cluster.\n */\n leaders: number;\n /**\n * Number of real leaders in the cluster.\n */\n realLeaders: number;\n /**\n * Number of followers in the cluster.\n */\n followers: number;\n /**\n * Number of servers in the cluster.\n */\n servers: number;\n }\n };\n /**\n * (Cluster only.) Information about the ArangoDB instance as well as the\n * host machine.\n */\n host: Record<string, any>;\n};\n\n/**\n * An object providing methods for accessing queue time metrics of the most\n * recently received server responses if the server supports this feature.\n */\nexport interface QueueTimeMetrics {\n /**\n * Returns the queue time of the most recently received response in seconds.\n */\n getLatest(): number | undefined;\n /**\n * Returns a list of the most recently received queue time values as tuples\n * of the timestamp of the response being processed in milliseconds and the\n * queue time in seconds.\n */\n getValues(): [number, number][];\n /**\n * Returns the average queue time of the most recently received responses\n * in seconds.\n */\n getAvg(): number;\n};\n"]}
1
+ {"version":3,"file":"administration.js","sourceRoot":"","sources":["../../src/administration.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAqVF,CAAC","sourcesContent":["/**\n * ```ts\n * import type { VersionInfo } from \"arangojs/administration\";\n * ```\n *\n * The \"administration\" module provides types for database administration.\n *\n * @packageDocumentation\n */\n\n/**\n * Result of retrieving database version information.\n */\nexport type VersionInfo = {\n /**\n * Value identifying the server type, i.e. `\"arango\"`.\n */\n server: string;\n /**\n * ArangoDB license type or \"edition\".\n */\n license: \"community\" | \"enterprise\";\n /**\n * ArangoDB server version.\n */\n version: string;\n /**\n * Additional information about the ArangoDB server.\n */\n details?: { [key: string]: string };\n};\n\n/**\n * Information about the storage engine.\n */\nexport type EngineInfo = {\n /**\n * Endianness of the storage engine.\n */\n endianness?: \"little\" | \"big\";\n /**\n * Name of the storage engine.\n */\n name: string;\n /**\n * Features supported by the storage engine.\n */\n supports?: {\n /**\n * Index types supported by the storage engine.\n */\n indexes?: string[];\n /**\n * Aliases supported by the storage engine.\n */\n aliases?: {\n /**\n * Index type aliases supported by the storage engine.\n */\n indexes?: Record<string, string>;\n }\n };\n};\n\n/**\n * Information about the server status.\n */\nexport type ServerStatusInformation = {\n /**\n * (Cluster Coordinators and DB-Servers only.) The address of the server.\n */\n address?: string;\n /**\n * (Cluster Coordinators and DB-Servers only.) Information about the Agency.\n */\n agency?: {\n /**\n * Information about the communication with the Agency.\n */\n agencyComm: {\n /**\n * A list of possible Agency endpoints.\n */\n endpoints: string[];\n };\n };\n /**\n * (Cluster Agents only.) Information about the Agents.\n */\n agent?: {\n /**\n * The endpoint of the queried Agent.\n */\n endpoint: string;\n /**\n * Server ID of the queried Agent.\n */\n id: string;\n /**\n * Server ID of the leading Agent.\n */\n leaderId: string;\n /**\n * Whether the queried Agent is the leader.\n */\n leading: boolean;\n /**\n * The current term number.\n */\n term: number;\n };\n /**\n * (Cluster Coordinators only.) Information about the Coordinators.\n */\n coordinator?: {\n /**\n * The server ID of the Coordinator that is the Foxx master.\n */\n foxxmaster: string[];\n /**\n * Whether the queried Coordinator is the Foxx master.\n */\n isFoxxmaster: boolean[];\n };\n /**\n * Whether the Foxx API is enabled.\n */\n foxxApi: boolean;\n /**\n * A host identifier defined by the HOST or NODE_NAME environment variable, \n * or a fallback value using a machine identifier or the cluster/Agency address.\n */\n host: string;\n /**\n * A hostname defined by the HOSTNAME environment variable.\n */\n hostname?: string;\n /**\n * ArangoDB Edition.\n */\n license: \"community\" | \"enterprise\";\n /**\n * Server operation mode.\n *\n * @deprecated use `operationMode` instead\n */\n mode: \"server\" | \"console\";\n /**\n * Server operation mode.\n */\n operationMode: \"server\" | \"console\";\n /**\n * The process ID of arangod.\n */\n pid: number;\n /**\n * Server type.\n */\n server: \"arango\";\n /**\n * Information about the server status.\n */\n serverInfo: {\n /**\n * Whether the maintenance mode is enabled.\n */\n maintenance: boolean;\n /**\n * (Cluster only.) The persisted ID.\n */\n persistedId?: string;\n /**\n * Startup and recovery information.\n */\n progress: {\n /**\n * Internal name of the feature that is currently being prepared, started, stopped or unprepared.\n */\n feature: string;\n /**\n * Name of the lifecycle phase the instance is currently in.\n */\n phase: string;\n /**\n * Current recovery sequence number value.\n */\n recoveryTick: number;\n };\n /**\n * Whether writes are disabled.\n */\n readOnly: boolean;\n /**\n * (Cluster only.) The reboot ID. Changes on every restart.\n */\n rebootId?: number;\n /**\n * Either \"SINGLE\", \"COORDINATOR\", \"PRIMARY\" (DB-Server), or \"AGENT\"\n */\n role: \"SINGLE\" | \"COORDINATOR\" | \"PRIMARY\" | \"AGENT\";\n /**\n * (Cluster Coordinators and DB-Servers only.) The server ID.\n */\n serverId?: string;\n /**\n * (Cluster Coordinators and DB-Servers only.) Either \"STARTUP\", \"SERVING\",\n * or \"SHUTDOWN\".\n */\n state?: \"STARTUP\" | \"SERVING\" | \"SHUTDOWN\";\n /**\n * The server version string.\n */\n version: string;\n /**\n * Whether writes are enabled.\n *\n * @deprecated Use `readOnly` instead.\n */\n writeOpsEnabled: boolean;\n };\n};\n\n/**\n * Server availability.\n *\n * - `\"default\"`: The server is operational.\n *\n * - `\"readonly\"`: The server is in read-only mode.\n *\n * - `false`: The server is not available.\n */\nexport type ServerAvailability = \"default\" | \"readonly\" | false;\n\n/**\n * Single server deployment information for support purposes.\n */\nexport type SingleServerSupportInfo = {\n /**\n * ISO 8601 datetime string of when the information was requested.\n */\n date: string;\n /**\n * Information about the deployment.\n */\n deployment: {\n /**\n * Deployment mode:\n *\n * - `\"single\"`: A single server deployment.\n *\n * - `\"cluster\"`: A cluster deployment.\n */\n type: \"single\";\n };\n};\n\n/**\n * Cluster deployment information for support purposes.\n */\nexport type ClusterSupportInfo = {\n /**\n * ISO 8601 datetime string of when the information was requested.\n */\n date: string;\n /**\n * Information about the deployment.\n */\n deployment: {\n /**\n * Deployment mode:\n *\n * - `\"single\"`: A single server deployment.\n *\n * - `\"cluster\"`: A cluster deployment.\n */\n type: \"cluster\";\n /**\n * Information about the servers in the cluster.\n */\n servers: Record<string, Record<string, any>>;\n /**\n * Number of agents in the cluster.\n */\n agents: number;\n /**\n * Number of coordinators in the cluster.\n */\n coordinators: number;\n /**\n * Number of DB-Servers in the cluster.\n */\n dbServers: number;\n /**\n * Information about the shards in the cluster.\n */\n shards: {\n /**\n * Number of collections in the cluster.\n */\n collections: number;\n /**\n * Number of shards in the cluster.\n */\n shards: number;\n /**\n * Number of leaders in the cluster.\n */\n leaders: number;\n /**\n * Number of real leaders in the cluster.\n */\n realLeaders: number;\n /**\n * Number of followers in the cluster.\n */\n followers: number;\n /**\n * Number of servers in the cluster.\n */\n servers: number;\n }\n };\n /**\n * (Cluster only.) Information about the ArangoDB instance as well as the\n * host machine.\n */\n host: Record<string, any>;\n};\n\n/**\n * An object providing methods for accessing queue time metrics of the most\n * recently received server responses if the server supports this feature.\n */\nexport interface QueueTimeMetrics {\n /**\n * Returns the queue time of the most recently received response in seconds.\n */\n getLatest(): number | undefined;\n /**\n * Returns a list of the most recently received queue time values as tuples\n * of the timestamp of the response being processed in milliseconds and the\n * queue time in seconds.\n */\n getValues(): [number, number][];\n /**\n * Returns the average queue time of the most recently received responses\n * in seconds.\n */\n getAvg(): number;\n};\n"]}
package/cjs/analyzers.js CHANGED
@@ -108,7 +108,7 @@ class Analyzer {
108
108
  */
109
109
  get() {
110
110
  return this._db.request({
111
- path: `/_api/analyzer/${encodeURIComponent(this._name)}`,
111
+ pathname: `/_api/analyzer/${encodeURIComponent(this._name)}`,
112
112
  });
113
113
  }
114
114
  /**
@@ -129,7 +129,7 @@ class Analyzer {
129
129
  create(options) {
130
130
  return this._db.request({
131
131
  method: "POST",
132
- path: "/_api/analyzer",
132
+ pathname: "/_api/analyzer",
133
133
  body: { name: this._name, ...options },
134
134
  });
135
135
  }
@@ -150,7 +150,7 @@ class Analyzer {
150
150
  drop(force = false) {
151
151
  return this._db.request({
152
152
  method: "DELETE",
153
- path: `/_api/analyzer/${encodeURIComponent(this._name)}`,
153
+ pathname: `/_api/analyzer/${encodeURIComponent(this._name)}`,
154
154
  search: { force },
155
155
  });
156
156
  }
@@ -1 +1 @@
1
- {"version":3,"file":"analyzers.js","sourceRoot":"","sources":["../../src/analyzers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,oDAAsC;AACtC,6CAAoD;AA6yBpD,YAAY;AAEZ,wBAAwB;AACxB;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,QAAa;IAC5C,OAAO,OAAO,CAAC,QAAQ,IAAI,QAAQ,CAAC,gBAAgB,CAAC,CAAC;AACxD,CAAC;AAFD,4CAEC;AAED;;GAEG;AACH,MAAa,QAAQ;IACT,KAAK,CAAS;IACd,GAAG,CAAqB;IAElC;;OAEG;IACH,YAAY,EAAsB,EAAE,IAAY;QAC9C,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;QACd,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;IAED;;;;OAIG;IACH,IAAI,gBAAgB;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,MAAM;QACV,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;YACjB,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,IAAI,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,QAAQ,KAAK,6BAAkB,EAAE,CAAC;gBACrE,OAAO,KAAK,CAAC;YACf,CAAC;YACD,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;IAED;;;;;;;;;;OAUG;IACH,GAAG;QACD,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;YACtB,IAAI,EAAE,kBAAkB,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;SACzD,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,MAAM,CACJ,OAAgB;QAsChB,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;YACtB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,GAAG,OAAO,EAAE;SACvC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,IAAI,CAAC,QAAiB,KAAK;QACzB,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;YACtB,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,kBAAkB,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YACxD,MAAM,EAAE,EAAE,KAAK,EAAE;SAClB,CAAC,CAAC;IACL,CAAC;CACF;AA/JD,4BA+JC;AACD,YAAY","sourcesContent":["/**\n * ```ts\n * import type { Analyzer } from \"arangojs/analyzers\";\n * ```\n *\n * The \"analyzers\" module provides Analyzer related types and interfaces\n * for TypeScript.\n *\n * @packageDocumentation\n */\nimport * as databases from \"./databases.js\";\nimport * as connection from \"./connection.js\";\nimport * as errors from \"./errors.js\";\nimport { ANALYZER_NOT_FOUND } from \"./lib/codes.js\";\n\n//#region Shared types\n/**\n * Name of a feature enabled for an Analyzer.\n */\nexport type AnalyzerFeature = \"frequency\" | \"norm\" | \"position\" | \"offset\";\n\n/**\n * Text case conversion type.\n */\nexport type CaseConversion = \"lower\" | \"upper\" | \"none\";\n\n/**\n * Token type for a Segmentation Analyzer.\n */\nexport type SegmentationTokenType = \"all\" | \"alpha\" | \"graphic\";\n\n/**\n * Token data type for an AQL Analyzer.\n */\nexport type AqlReturnTokenType = \"string\" | \"number\" | \"bool\";\n\n/**\n * GeoJSON type.\n */\nexport type GeoType = \"shape\" | \"centroid\" | \"point\";\n\n/**\n * Storage format of a Geo S2 Analyzer.\n */\nexport type GeoS2Format = \"latLngDouble\" | \"latLngInt\" | \"s2Point\";\n\n/**\n * Type of an Analyzer.\n */\nexport type AnalyzerType = AnalyzerDescription[\"type\"];\n//#endregion\n\n//#region CreateAnalyzerOptions\n/**\n * Analyzer type and its type-specific properties.\n */\nexport type CreateAnalyzerOptions =\n | CreateIdentityAnalyzerOptions\n | CreateDelimiterAnalyzerOptions\n | CreateMultiDelimiterAnalyzerOptions\n | CreateStemAnalyzerOptions\n | CreateNormAnalyzerOptions\n | CreateNgramAnalyzerOptions\n | CreateTextAnalyzerOptions\n | CreateSegmentationAnalyzerOptions\n | CreateAqlAnalyzerOptions\n | CreatePipelineAnalyzerOptions\n | CreateStopwordsAnalyzerOptions\n | CreateCollationAnalyzerOptions\n | CreateMinHashAnalyzerOptions\n | CreateClassificationAnalyzerOptions\n | CreateNearestNeighborsAnalyzerOptions\n | CreateWildcardAnalyzerOptions\n | CreateGeoJsonAnalyzerOptions\n | CreateGeoPointAnalyzerOptions\n | CreateGeoS2AnalyzerOptions;\n\ntype CreateAnalyzerOptionsType<\n Type extends AnalyzerType,\n Properties = void\n> = Properties extends void\n ? {\n /**\n * Type of the Analyzer.\n */\n type: Type;\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * This Analyzer does not take additional properties.\n */\n properties?: Record<string, never>;\n }\n : {\n /**\n * Type of the Analyzer.\n */\n type: Type;\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: Properties;\n };\n\n/**\n * Options for creating an Identity Analyzer.\n */\nexport type CreateIdentityAnalyzerOptions = CreateAnalyzerOptionsType<\n \"identity\"\n>;\n\n/**\n * Options for creating a Delimiter Analyzer.\n */\nexport type CreateDelimiterAnalyzerOptions = CreateAnalyzerOptionsType<\n \"delimiter\",\n | string\n | {\n /**\n * This value will be used as delimiter to split text into tokens as\n * specified in RFC 4180, without starting new records on newlines.\n */\n delimiter: string;\n }\n>;\n\n/**\n * Options for creating a Multi-Delimiter Analyzer.\n */\nexport type CreateMultiDelimiterAnalyzerOptions = CreateAnalyzerOptionsType<\n \"multi_delimiter\",\n {\n /**\n * This value will be used as delimiter to split text into tokens as\n * specified in RFC 4180, without starting new records on newlines.\n */\n delimiters: string[];\n }\n>;\n\n/**\n * Options for creating a Stem Analyzer.\n */\nexport type CreateStemAnalyzerOptions = CreateAnalyzerOptionsType<\n \"stem\",\n {\n /**\n * Text locale.\n *\n * Format: `language[_COUNTRY][.encoding][@variant]`\n */\n locale: string;\n }\n>;\n\n/**\n * Options for creating a Norm Analyzer.\n */\nexport type CreateNormAnalyzerOptions = CreateAnalyzerOptionsType<\n \"norm\",\n {\n /**\n * Text locale.\n *\n * Format: `language[_COUNTRY][.encoding][@variant]`\n */\n locale: string;\n /**\n * Case conversion.\n *\n * Default: `\"lower\"`\n */\n case?: CaseConversion;\n /**\n * Preserve accents in returned words.\n *\n * Default: `false`\n */\n accent?: boolean;\n }\n>;\n\n/**\n * Options for creating an Ngram Analyzer.\n */\nexport type CreateNgramAnalyzerOptions = CreateAnalyzerOptionsType<\n \"ngram\",\n {\n /**\n * Maximum n-gram length.\n */\n max: number;\n /**\n * Minimum n-gram length.\n */\n min: number;\n /**\n * Output the original value as well.\n */\n preserveOriginal: boolean;\n }\n>;\n\n/**\n * Options for creating a Text Analyzer.\n */\nexport type CreateTextAnalyzerOptions = CreateAnalyzerOptionsType<\n \"text\",\n {\n /**\n * Text locale.\n *\n * Format: `language[_COUNTRY][.encoding][@variant]`\n */\n locale: string;\n /**\n * Case conversion.\n *\n * Default: `\"lower\"`\n */\n case?: CaseConversion;\n /**\n * Words to omit from result.\n *\n * Defaults to the words loaded from the file at `stopwordsPath`.\n */\n stopwords?: string[];\n /**\n * Path with a `language` sub-directory containing files with words to omit.\n *\n * Defaults to the path specified in the server-side environment variable\n * `IRESEARCH_TEXT_STOPWORD_PATH` or the current working directory of the\n * ArangoDB process.\n */\n stopwordsPath?: string;\n /**\n * Preserve accents in returned words.\n *\n * Default: `false`\n */\n accent?: boolean;\n /**\n * Apply stemming on returned words.\n *\n * Default: `true`\n */\n stemming?: boolean;\n /**\n * If present, then edge n-grams are generated for each token (word).\n */\n edgeNgram?: {\n min?: number;\n max?: number;\n preserveOriginal?: boolean;\n };\n }\n>;\n\n/**\n * Options for creating a Segmentation Analyzer\n */\nexport type CreateSegmentationAnalyzerOptions = CreateAnalyzerOptionsType<\n \"segmentation\",\n {\n /**\n * Which tokens should be returned.\n *\n * Default: `\"alpha\"`\n */\n break?: SegmentationTokenType;\n /**\n * What case all returned tokens should be converted to if applicable.\n *\n * Default: `\"none\"`\n */\n case?: CaseConversion;\n }\n>;\n\n/**\n * Options for creating an AQL Analyzer\n */\nexport type CreateAqlAnalyzerOptions = CreateAnalyzerOptionsType<\n \"aql\",\n {\n /**\n * AQL query to be executed.\n */\n queryString: string;\n /**\n * If set to `true`, the position is set to `0` for all members of the query result array.\n *\n * Default: `false`\n */\n collapsePositions?: boolean;\n /**\n * If set to `false`, `null` values will be discarded from the View index.\n *\n * Default: `true`\n */\n keepNull?: boolean;\n /**\n * Number between `1` and `1000` that determines the batch size for reading\n * data from the query.\n *\n * Default: `1`\n */\n batchSize?: number;\n /**\n * Memory limit for query execution in bytes.\n *\n * Default: `1048576` (1 MiB)\n */\n memoryLimit?: number;\n /**\n * Data type of the returned tokens.\n *\n * Default: `\"string\"`\n */\n returnType?: AqlReturnTokenType;\n }\n>;\n\n/**\n * Options for creating a Pipeline Analyzer\n */\nexport type CreatePipelineAnalyzerOptions = CreateAnalyzerOptionsType<\n \"pipeline\",\n {\n /**\n * Definitions for Analyzers to chain in this Pipeline Analyzer.\n */\n pipeline: Omit<CreateAnalyzerOptions, \"features\">[];\n }\n>;\n\n/**\n * Options for creating a Stopwords Analyzer\n */\nexport type CreateStopwordsAnalyzerOptions = CreateAnalyzerOptionsType<\n \"stopwords\",\n {\n /**\n * Array of strings that describe the tokens to be discarded.\n */\n stopwords: string[];\n /**\n * Whether stopword values should be interpreted as hex-encoded strings.\n *\n * Default: `false`\n */\n hex?: boolean;\n }\n>;\n\n/**\n * Options for creating a Collation Analyzer\n */\nexport type CreateCollationAnalyzerOptions = CreateAnalyzerOptionsType<\n \"collation\",\n {\n /**\n * Text locale.\n *\n * Format: `language[_COUNTRY][.encoding][@variant]`\n */\n locale: string;\n }\n>;\n\n/**\n * (Enterprise Edition only.) Options for creating a MinHash Analyzer\n */\nexport type CreateMinHashAnalyzerOptions = CreateAnalyzerOptionsType<\n \"minhash\",\n {\n /**\n * An Analyzer definition-like object with `type` and `properties` attributes.\n */\n analyzer: Omit<CreateAnalyzerOptions, \"features\">;\n /**\n * Size of the MinHash signature.\n */\n numHashes: number;\n }\n>;\n\n/**\n * (Enterprise Edition only.) Options for creating a Classification Analyzer\n */\nexport type CreateClassificationAnalyzerOptions = CreateAnalyzerOptionsType<\n \"classification\",\n {\n /**\n * On-disk path to the trained fastText supervised model.\n */\n model_location: string;\n /**\n * Number of class labels that will be produced per input.\n *\n * Default: `1`\n */\n top_k?: number;\n /**\n * Probability threshold for which a label will be assigned to an input.\n *\n * Default: `0.99`\n */\n threshold?: number;\n }\n>;\n\n/**\n * (Enterprise Edition only.) Options for creating a NearestNeighbors Analyzer.\n */\nexport type CreateNearestNeighborsAnalyzerOptions = CreateAnalyzerOptionsType<\n \"nearest_neighbors\",\n {\n /**\n * On-disk path to the trained fastText supervised model.\n */\n model_location: string;\n /**\n * Number of class labels that will be produced per input.\n *\n * Default: `1`\n */\n top_k?: number;\n }\n>;\n\n/**\n * Options for creating a Wildcard Analyzer.\n */\nexport type CreateWildcardAnalyzerOptions = CreateAnalyzerOptionsType<\n \"wildcard\",\n {\n /**\n * N-gram length. Must be a positive integer greater than or equal to 2.\n */\n ngramSize: string;\n /**\n * An Analyzer definition-like object with `type` and `properties` attributes.\n */\n analyzer?: Omit<CreateAnalyzerOptions, \"features\">;\n }\n>;\n\n/**\n * Options for creating a GeoJSON Analyzer\n */\nexport type CreateGeoJsonAnalyzerOptions = CreateAnalyzerOptionsType<\n \"geojson\",\n {\n /**\n * If set to `\"centroid\"`, only the centroid of the input geometry will be\n * computed and indexed.\n *\n * If set to `\"point\"` only GeoJSON objects of type Point will be indexed and\n * all other geometry types will be ignored.\n *\n * Default: `\"shape\"`\n */\n type?: GeoType;\n /**\n * Options for fine-tuning geo queries.\n *\n * Default: `{ maxCells: 20, minLevel: 4, maxLevel: 23 }`\n */\n options?: {\n maxCells?: number;\n minLevel?: number;\n maxLevel?: number;\n };\n }\n>;\n\n/**\n * Options for creating a GeoPoint Analyzer\n */\nexport type CreateGeoPointAnalyzerOptions = CreateAnalyzerOptionsType<\n \"geopoint\",\n {\n /**\n * Attribute paths of the latitude value relative to the field for which the\n * Analyzer is defined in the View.\n */\n latitude?: string[];\n /**\n * Attribute paths of the longitude value relative to the field for which the\n * Analyzer is defined in the View.\n */\n longitude?: string[];\n /**\n * Options for fine-tuning geo queries.\n *\n * Default: `{ maxCells: 20, minLevel: 4, maxLevel: 23 }`\n */\n options?: {\n minCells?: number;\n minLevel?: number;\n maxLevel?: number;\n };\n }\n>;\n\n/**\n * (Enterprise Edition only.) Options for creating a Geo S2 Analyzer\n */\nexport type CreateGeoS2AnalyzerOptions = CreateAnalyzerOptionsType<\n \"geo_s2\",\n {\n /**\n * If set to `\"centroid\"`, only the centroid of the input geometry will be\n * computed and indexed.\n *\n * If set to `\"point\"` only GeoJSON objects of type Point will be indexed and\n * all other geometry types will be ignored.\n *\n * Default: `\"shape\"`\n */\n type?: GeoType;\n /**\n * Options for fine-tuning geo queries.\n *\n * Default: `{ maxCells: 20, minLevel: 4, maxLevel: 23 }`\n */\n options?: {\n maxCells?: number;\n minLevel?: number;\n maxLevel?: number;\n };\n /**\n * If set to `\"latLngDouble\"`, each latitude and longitude value is stored\n * as an 8-byte floating-point value (16 bytes per coordinate pair).\n *\n * If set to `\"latLngInt\"`, each latitude and longitude value is stored as\n * a 4-byte integer value (8 bytes per coordinate pair).\n *\n * If set to `\"s2Point\"`, each longitude-latitude pair is stored in the\n * native format of Google S2 (24 bytes per coordinate pair).\n *\n * Default: `\"latLngDouble\"`\n */\n format?: GeoS2Format;\n }\n>;\n//#endregion\n\n//#region AnalyzerDescription\n/**\n * An object describing an Analyzer.\n */\nexport type AnalyzerDescription =\n | IdentityAnalyzerDescription\n | DelimiterAnalyzerDescription\n | MultiDelimiterAnalyzerDescription\n | StemAnalyzerDescription\n | NormAnalyzerDescription\n | NgramAnalyzerDescription\n | TextAnalyzerDescription\n | SegmentationAnalyzerDescription\n | AqlAnalyzerDescription\n | PipelineAnalyzerDescription\n | StopwordsAnalyzerDescription\n | CollationAnalyzerDescription\n | MinHashAnalyzerDescription\n | ClassificationAnalyzerDescription\n | NearestNeighborsAnalyzerDescription\n | WildcardAnalyzerDescription\n | GeoJsonAnalyzerDescription\n | GeoPointAnalyzerDescription\n | GeoS2AnalyzerDescription;\n\n/**\n * Shared attributes of all Analyzer descriptions.\n */\ntype AnalyzerDescriptionType<\n Type extends string,\n Properties = Record<string, never>\n> = {\n /**\n * A unique name for this Analyzer.\n */\n name: string;\n /**\n * Type of the Analyzer.\n */\n type: Type;\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: Properties;\n};\n\n/**\n * An object describing an Identity Analyzer.\n */\nexport type IdentityAnalyzerDescription = AnalyzerDescriptionType<\"identity\">;\n\n/**\n * An object describing a Delimiter Analyzer.\n */\nexport type DelimiterAnalyzerDescription = AnalyzerDescriptionType<\n \"delimiter\",\n { delimiter: string }\n>;\n\n/**\n * An object describing a Multi Delimiter Analyzer.\n */\nexport type MultiDelimiterAnalyzerDescription = AnalyzerDescriptionType<\n \"multi_delimiter\",\n { delimiters: string[] }\n>;\n\n/**\n * An object describing a Stem Analyzer.\n */\nexport type StemAnalyzerDescription = AnalyzerDescriptionType<\n \"stem\",\n { locale: string }\n>;\n\n/**\n * An object describing a Norm Analyzer.\n */\nexport type NormAnalyzerDescription = AnalyzerDescriptionType<\n \"norm\",\n {\n locale: string;\n case: CaseConversion;\n accent: boolean;\n }\n>;\n\n/**\n * An object describing an Ngram Analyzer.\n */\nexport type NgramAnalyzerDescription = AnalyzerDescriptionType<\n \"ngram\",\n {\n min: number;\n max: number;\n preserveOriginal: boolean;\n }\n>;\n\n/**\n * An object describing a Text Analyzer.\n */\nexport type TextAnalyzerDescription = AnalyzerDescriptionType<\n \"text\",\n {\n locale: string;\n case: CaseConversion;\n stopwords: string[];\n stopwordsPath: string;\n accent: boolean;\n stemming: boolean;\n edgeNgram: {\n min: number;\n max: number;\n preserveOriginal: boolean;\n };\n }\n>;\n\n/**\n * An object describing a Segmentation Analyzer\n */\nexport type SegmentationAnalyzerDescription = AnalyzerDescriptionType<\n \"segmentation\",\n {\n break: SegmentationTokenType;\n case: CaseConversion;\n }\n>;\n\n/**\n * An object describing an AQL Analyzer\n */\nexport type AqlAnalyzerDescription = AnalyzerDescriptionType<\n \"aql\",\n {\n queryString: string;\n collapsePositions: boolean;\n keepNull: boolean;\n batchSize: number;\n memoryLimit: number;\n returnType: AqlReturnTokenType;\n }\n>;\n\n/**\n * An object describing a Pipeline Analyzer\n */\nexport type PipelineAnalyzerDescription = AnalyzerDescriptionType<\n \"pipeline\",\n {\n pipeline: Omit<AnalyzerDescription, \"name\" | \"features\">[];\n }\n>;\n\n/**\n * An object describing a Stopwords Analyzer\n */\nexport type StopwordsAnalyzerDescription = AnalyzerDescriptionType<\n \"stopwords\",\n {\n stopwords: string[];\n hex: boolean;\n }\n>;\n\n/**\n * An object describing a Collation Analyzer\n */\nexport type CollationAnalyzerDescription = AnalyzerDescriptionType<\n \"collation\",\n {\n locale: string;\n }\n>;\n\n/**\n * (Enterprise Edition only.) An object describing a MinHash Analyzer\n */\nexport type MinHashAnalyzerDescription = AnalyzerDescriptionType<\n \"minhash\",\n {\n analyzer: Omit<AnalyzerDescription, \"name\" | \"features\">;\n numHashes: number;\n }\n>;\n\n/**\n * (Enterprise Edition only.) An object describing a Classification Analyzer\n */\nexport type ClassificationAnalyzerDescription = AnalyzerDescriptionType<\n \"classification\",\n {\n model_location: string;\n top_k: number;\n threshold: number;\n }\n>;\n\n/**\n * (Enterprise Edition only.) An object describing a NearestNeighbors Analyzer\n */\nexport type NearestNeighborsAnalyzerDescription = AnalyzerDescriptionType<\n \"nearest_neighbors\",\n {\n model_location: string;\n top_k: number;\n }\n>;\n\n/**\n * An object describing a Wildcard Analyzer\n */\nexport type WildcardAnalyzerDescription = AnalyzerDescriptionType<\n \"wildcard\",\n {\n ngramSize: number;\n analyzer?: Omit<AnalyzerDescription, \"name\" | \"features\">;\n }\n>;\n\n/**\n * An object describing a GeoJSON Analyzer\n */\nexport type GeoJsonAnalyzerDescription = AnalyzerDescriptionType<\n \"geojson\",\n {\n type: GeoType;\n description: {\n maxCells: number;\n minLevel: number;\n maxLevel: number;\n };\n }\n>;\n\n/**\n * An object describing a GeoPoint Analyzer\n */\nexport type GeoPointAnalyzerDescription = AnalyzerDescriptionType<\n \"geopoint\",\n {\n latitude: string[];\n longitude: string[];\n description: {\n minCells: number;\n minLevel: number;\n maxLevel: number;\n };\n }\n>;\n\n/**\n * (Enterprise Edition only.) An object describing a GeoS2 Analyzer\n */\nexport type GeoS2AnalyzerDescription = AnalyzerDescriptionType<\n \"geo_s2\",\n {\n type: GeoType;\n description: {\n maxCells: number;\n minLevel: number;\n maxLevel: number;\n };\n format: GeoS2Format;\n }\n>;\n//#endregion\n\n//#region Analyzer class\n/**\n * Indicates whether the given value represents an {@link Analyzer}.\n *\n * @param analyzer - A value that might be an Analyzer.\n */\nexport function isArangoAnalyzer(analyzer: any): analyzer is Analyzer {\n return Boolean(analyzer && analyzer.isArangoAnalyzer);\n}\n\n/**\n * Represents an Analyzer in a {@link databases.Database}.\n */\nexport class Analyzer {\n protected _name: string;\n protected _db: databases.Database;\n\n /**\n * @internal\n */\n constructor(db: databases.Database, name: string) {\n this._db = db;\n this._name = name;\n }\n\n /**\n * Database this analyzer belongs to.\n */\n get database() {\n return this._db;\n }\n\n /**\n * @internal\n *\n * Indicates that this object represents an ArangoDB Analyzer.\n */\n get isArangoAnalyzer(): true {\n return true;\n }\n\n /**\n * Name of this Analyzer.\n *\n * See also {@link databases.Database}.\n */\n get name() {\n return this._name;\n }\n\n /**\n * Checks whether the Analyzer exists.\n *\n * @example\n * ```js\n * const db = new Database();\n * const analyzer = db.analyzer(\"some-analyzer\");\n * const result = await analyzer.exists();\n * // result indicates whether the Analyzer exists\n * ```\n */\n async exists(): Promise<boolean> {\n try {\n await this.get();\n return true;\n } catch (err: any) {\n if (errors.isArangoError(err) && err.errorNum === ANALYZER_NOT_FOUND) {\n return false;\n }\n throw err;\n }\n }\n\n /**\n * Retrieves the Analyzer definition for the Analyzer.\n *\n * @example\n * ```js\n * const db = new Database();\n * const analyzer = db.analyzer(\"some-analyzer\");\n * const definition = await analyzer.get();\n * // definition contains the Analyzer definition\n * ```\n */\n get(): Promise<connection.ArangoApiResponse<AnalyzerDescription>> {\n return this._db.request({\n path: `/_api/analyzer/${encodeURIComponent(this._name)}`,\n });\n }\n\n /**\n * Creates a new Analyzer with the given `options` and the instance's name.\n *\n * See also {@link databases.Database#createAnalyzer}.\n *\n * @param options - Options for creating the Analyzer.\n *\n * @example\n * ```js\n * const db = new Database();\n * const analyzer = db.analyzer(\"potatoes\");\n * await analyzer.create({ type: \"identity\" });\n * // the identity Analyzer \"potatoes\" now exists\n * ```\n */\n create<Options extends CreateAnalyzerOptions>(\n options: Options\n ): Promise<\n Options extends CreateIdentityAnalyzerOptions\n ? IdentityAnalyzerDescription\n : Options extends CreateDelimiterAnalyzerOptions\n ? DelimiterAnalyzerDescription\n : Options extends CreateStemAnalyzerOptions\n ? StemAnalyzerDescription\n : Options extends CreateNormAnalyzerOptions\n ? NormAnalyzerDescription\n : Options extends CreateNgramAnalyzerOptions\n ? NgramAnalyzerDescription\n : Options extends CreateTextAnalyzerOptions\n ? TextAnalyzerDescription\n : Options extends CreateSegmentationAnalyzerOptions\n ? SegmentationAnalyzerDescription\n : Options extends CreateAqlAnalyzerOptions\n ? AqlAnalyzerDescription\n : Options extends CreatePipelineAnalyzerOptions\n ? PipelineAnalyzerDescription\n : Options extends CreateStopwordsAnalyzerOptions\n ? StopwordsAnalyzerDescription\n : Options extends CreateCollationAnalyzerOptions\n ? CollationAnalyzerDescription\n : Options extends CreateMinHashAnalyzerOptions\n ? MinHashAnalyzerDescription\n : Options extends CreateClassificationAnalyzerOptions\n ? ClassificationAnalyzerDescription\n : Options extends CreateNearestNeighborsAnalyzerOptions\n ? NearestNeighborsAnalyzerDescription\n : Options extends CreateGeoJsonAnalyzerOptions\n ? GeoJsonAnalyzerDescription\n : Options extends CreateGeoPointAnalyzerOptions\n ? GeoPointAnalyzerDescription\n : Options extends CreateGeoS2AnalyzerOptions\n ? GeoS2AnalyzerDescription\n : AnalyzerDescription\n > {\n return this._db.request({\n method: \"POST\",\n path: \"/_api/analyzer\",\n body: { name: this._name, ...options },\n });\n }\n\n /**\n * Deletes the Analyzer from the database.\n *\n * @param force - Whether the Analyzer should still be deleted even if it\n * is currently in use.\n *\n * @example\n * ```js\n * const db = new Database();\n * const analyzer = db.analyzer(\"some-analyzer\");\n * await analyzer.drop();\n * // the Analyzer \"some-analyzer\" no longer exists\n * ```\n */\n drop(force: boolean = false): Promise<connection.ArangoApiResponse<{ name: string }>> {\n return this._db.request({\n method: \"DELETE\",\n path: `/_api/analyzer/${encodeURIComponent(this._name)}`,\n search: { force },\n });\n }\n}\n//#endregion"]}
1
+ {"version":3,"file":"analyzers.js","sourceRoot":"","sources":["../../src/analyzers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,oDAAsC;AACtC,6CAAoD;AA6yBpD,YAAY;AAEZ,wBAAwB;AACxB;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,QAAa;IAC5C,OAAO,OAAO,CAAC,QAAQ,IAAI,QAAQ,CAAC,gBAAgB,CAAC,CAAC;AACxD,CAAC;AAFD,4CAEC;AAED;;GAEG;AACH,MAAa,QAAQ;IACT,KAAK,CAAS;IACd,GAAG,CAAqB;IAElC;;OAEG;IACH,YAAY,EAAsB,EAAE,IAAY;QAC9C,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;QACd,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;IAED;;;;OAIG;IACH,IAAI,gBAAgB;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,MAAM;QACV,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;YACjB,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,IAAI,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,QAAQ,KAAK,6BAAkB,EAAE,CAAC;gBACrE,OAAO,KAAK,CAAC;YACf,CAAC;YACD,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;IAED;;;;;;;;;;OAUG;IACH,GAAG;QACD,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;YACtB,QAAQ,EAAE,kBAAkB,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,MAAM,CACJ,OAAgB;QAsChB,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;YACtB,MAAM,EAAE,MAAM;YACd,QAAQ,EAAE,gBAAgB;YAC1B,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,GAAG,OAAO,EAAE;SACvC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,IAAI,CAAC,QAAiB,KAAK;QACzB,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;YACtB,MAAM,EAAE,QAAQ;YAChB,QAAQ,EAAE,kBAAkB,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YAC5D,MAAM,EAAE,EAAE,KAAK,EAAE;SAClB,CAAC,CAAC;IACL,CAAC;CACF;AA/JD,4BA+JC;AACD,YAAY","sourcesContent":["/**\n * ```ts\n * import type { Analyzer } from \"arangojs/analyzers\";\n * ```\n *\n * The \"analyzers\" module provides Analyzer related types and interfaces\n * for TypeScript.\n *\n * @packageDocumentation\n */\nimport * as databases from \"./databases.js\";\nimport * as connection from \"./connection.js\";\nimport * as errors from \"./errors.js\";\nimport { ANALYZER_NOT_FOUND } from \"./lib/codes.js\";\n\n//#region Shared types\n/**\n * Name of a feature enabled for an Analyzer.\n */\nexport type AnalyzerFeature = \"frequency\" | \"norm\" | \"position\" | \"offset\";\n\n/**\n * Text case conversion type.\n */\nexport type CaseConversion = \"lower\" | \"upper\" | \"none\";\n\n/**\n * Token type for a Segmentation Analyzer.\n */\nexport type SegmentationTokenType = \"all\" | \"alpha\" | \"graphic\";\n\n/**\n * Token data type for an AQL Analyzer.\n */\nexport type AqlReturnTokenType = \"string\" | \"number\" | \"bool\";\n\n/**\n * GeoJSON type.\n */\nexport type GeoType = \"shape\" | \"centroid\" | \"point\";\n\n/**\n * Storage format of a Geo S2 Analyzer.\n */\nexport type GeoS2Format = \"latLngDouble\" | \"latLngInt\" | \"s2Point\";\n\n/**\n * Type of an Analyzer.\n */\nexport type AnalyzerType = AnalyzerDescription[\"type\"];\n//#endregion\n\n//#region CreateAnalyzerOptions\n/**\n * Analyzer type and its type-specific properties.\n */\nexport type CreateAnalyzerOptions =\n | CreateIdentityAnalyzerOptions\n | CreateDelimiterAnalyzerOptions\n | CreateMultiDelimiterAnalyzerOptions\n | CreateStemAnalyzerOptions\n | CreateNormAnalyzerOptions\n | CreateNgramAnalyzerOptions\n | CreateTextAnalyzerOptions\n | CreateSegmentationAnalyzerOptions\n | CreateAqlAnalyzerOptions\n | CreatePipelineAnalyzerOptions\n | CreateStopwordsAnalyzerOptions\n | CreateCollationAnalyzerOptions\n | CreateMinHashAnalyzerOptions\n | CreateClassificationAnalyzerOptions\n | CreateNearestNeighborsAnalyzerOptions\n | CreateWildcardAnalyzerOptions\n | CreateGeoJsonAnalyzerOptions\n | CreateGeoPointAnalyzerOptions\n | CreateGeoS2AnalyzerOptions;\n\ntype CreateAnalyzerOptionsType<\n Type extends AnalyzerType,\n Properties = void\n> = Properties extends void\n ? {\n /**\n * Type of the Analyzer.\n */\n type: Type;\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * This Analyzer does not take additional properties.\n */\n properties?: Record<string, never>;\n }\n : {\n /**\n * Type of the Analyzer.\n */\n type: Type;\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: Properties;\n };\n\n/**\n * Options for creating an Identity Analyzer.\n */\nexport type CreateIdentityAnalyzerOptions = CreateAnalyzerOptionsType<\n \"identity\"\n>;\n\n/**\n * Options for creating a Delimiter Analyzer.\n */\nexport type CreateDelimiterAnalyzerOptions = CreateAnalyzerOptionsType<\n \"delimiter\",\n | string\n | {\n /**\n * This value will be used as delimiter to split text into tokens as\n * specified in RFC 4180, without starting new records on newlines.\n */\n delimiter: string;\n }\n>;\n\n/**\n * Options for creating a Multi-Delimiter Analyzer.\n */\nexport type CreateMultiDelimiterAnalyzerOptions = CreateAnalyzerOptionsType<\n \"multi_delimiter\",\n {\n /**\n * This value will be used as delimiter to split text into tokens as\n * specified in RFC 4180, without starting new records on newlines.\n */\n delimiters: string[];\n }\n>;\n\n/**\n * Options for creating a Stem Analyzer.\n */\nexport type CreateStemAnalyzerOptions = CreateAnalyzerOptionsType<\n \"stem\",\n {\n /**\n * Text locale.\n *\n * Format: `language[_COUNTRY][.encoding][@variant]`\n */\n locale: string;\n }\n>;\n\n/**\n * Options for creating a Norm Analyzer.\n */\nexport type CreateNormAnalyzerOptions = CreateAnalyzerOptionsType<\n \"norm\",\n {\n /**\n * Text locale.\n *\n * Format: `language[_COUNTRY][.encoding][@variant]`\n */\n locale: string;\n /**\n * Case conversion.\n *\n * Default: `\"lower\"`\n */\n case?: CaseConversion;\n /**\n * Preserve accents in returned words.\n *\n * Default: `false`\n */\n accent?: boolean;\n }\n>;\n\n/**\n * Options for creating an Ngram Analyzer.\n */\nexport type CreateNgramAnalyzerOptions = CreateAnalyzerOptionsType<\n \"ngram\",\n {\n /**\n * Maximum n-gram length.\n */\n max: number;\n /**\n * Minimum n-gram length.\n */\n min: number;\n /**\n * Output the original value as well.\n */\n preserveOriginal: boolean;\n }\n>;\n\n/**\n * Options for creating a Text Analyzer.\n */\nexport type CreateTextAnalyzerOptions = CreateAnalyzerOptionsType<\n \"text\",\n {\n /**\n * Text locale.\n *\n * Format: `language[_COUNTRY][.encoding][@variant]`\n */\n locale: string;\n /**\n * Case conversion.\n *\n * Default: `\"lower\"`\n */\n case?: CaseConversion;\n /**\n * Words to omit from result.\n *\n * Defaults to the words loaded from the file at `stopwordsPath`.\n */\n stopwords?: string[];\n /**\n * Path with a `language` sub-directory containing files with words to omit.\n *\n * Defaults to the path specified in the server-side environment variable\n * `IRESEARCH_TEXT_STOPWORD_PATH` or the current working directory of the\n * ArangoDB process.\n */\n stopwordsPath?: string;\n /**\n * Preserve accents in returned words.\n *\n * Default: `false`\n */\n accent?: boolean;\n /**\n * Apply stemming on returned words.\n *\n * Default: `true`\n */\n stemming?: boolean;\n /**\n * If present, then edge n-grams are generated for each token (word).\n */\n edgeNgram?: {\n min?: number;\n max?: number;\n preserveOriginal?: boolean;\n };\n }\n>;\n\n/**\n * Options for creating a Segmentation Analyzer\n */\nexport type CreateSegmentationAnalyzerOptions = CreateAnalyzerOptionsType<\n \"segmentation\",\n {\n /**\n * Which tokens should be returned.\n *\n * Default: `\"alpha\"`\n */\n break?: SegmentationTokenType;\n /**\n * What case all returned tokens should be converted to if applicable.\n *\n * Default: `\"none\"`\n */\n case?: CaseConversion;\n }\n>;\n\n/**\n * Options for creating an AQL Analyzer\n */\nexport type CreateAqlAnalyzerOptions = CreateAnalyzerOptionsType<\n \"aql\",\n {\n /**\n * AQL query to be executed.\n */\n queryString: string;\n /**\n * If set to `true`, the position is set to `0` for all members of the query result array.\n *\n * Default: `false`\n */\n collapsePositions?: boolean;\n /**\n * If set to `false`, `null` values will be discarded from the View index.\n *\n * Default: `true`\n */\n keepNull?: boolean;\n /**\n * Number between `1` and `1000` that determines the batch size for reading\n * data from the query.\n *\n * Default: `1`\n */\n batchSize?: number;\n /**\n * Memory limit for query execution in bytes.\n *\n * Default: `1048576` (1 MiB)\n */\n memoryLimit?: number;\n /**\n * Data type of the returned tokens.\n *\n * Default: `\"string\"`\n */\n returnType?: AqlReturnTokenType;\n }\n>;\n\n/**\n * Options for creating a Pipeline Analyzer\n */\nexport type CreatePipelineAnalyzerOptions = CreateAnalyzerOptionsType<\n \"pipeline\",\n {\n /**\n * Definitions for Analyzers to chain in this Pipeline Analyzer.\n */\n pipeline: Omit<CreateAnalyzerOptions, \"features\">[];\n }\n>;\n\n/**\n * Options for creating a Stopwords Analyzer\n */\nexport type CreateStopwordsAnalyzerOptions = CreateAnalyzerOptionsType<\n \"stopwords\",\n {\n /**\n * Array of strings that describe the tokens to be discarded.\n */\n stopwords: string[];\n /**\n * Whether stopword values should be interpreted as hex-encoded strings.\n *\n * Default: `false`\n */\n hex?: boolean;\n }\n>;\n\n/**\n * Options for creating a Collation Analyzer\n */\nexport type CreateCollationAnalyzerOptions = CreateAnalyzerOptionsType<\n \"collation\",\n {\n /**\n * Text locale.\n *\n * Format: `language[_COUNTRY][.encoding][@variant]`\n */\n locale: string;\n }\n>;\n\n/**\n * (Enterprise Edition only.) Options for creating a MinHash Analyzer\n */\nexport type CreateMinHashAnalyzerOptions = CreateAnalyzerOptionsType<\n \"minhash\",\n {\n /**\n * An Analyzer definition-like object with `type` and `properties` attributes.\n */\n analyzer: Omit<CreateAnalyzerOptions, \"features\">;\n /**\n * Size of the MinHash signature.\n */\n numHashes: number;\n }\n>;\n\n/**\n * (Enterprise Edition only.) Options for creating a Classification Analyzer\n */\nexport type CreateClassificationAnalyzerOptions = CreateAnalyzerOptionsType<\n \"classification\",\n {\n /**\n * On-disk path to the trained fastText supervised model.\n */\n model_location: string;\n /**\n * Number of class labels that will be produced per input.\n *\n * Default: `1`\n */\n top_k?: number;\n /**\n * Probability threshold for which a label will be assigned to an input.\n *\n * Default: `0.99`\n */\n threshold?: number;\n }\n>;\n\n/**\n * (Enterprise Edition only.) Options for creating a NearestNeighbors Analyzer.\n */\nexport type CreateNearestNeighborsAnalyzerOptions = CreateAnalyzerOptionsType<\n \"nearest_neighbors\",\n {\n /**\n * On-disk path to the trained fastText supervised model.\n */\n model_location: string;\n /**\n * Number of class labels that will be produced per input.\n *\n * Default: `1`\n */\n top_k?: number;\n }\n>;\n\n/**\n * Options for creating a Wildcard Analyzer.\n */\nexport type CreateWildcardAnalyzerOptions = CreateAnalyzerOptionsType<\n \"wildcard\",\n {\n /**\n * N-gram length. Must be a positive integer greater than or equal to 2.\n */\n ngramSize: string;\n /**\n * An Analyzer definition-like object with `type` and `properties` attributes.\n */\n analyzer?: Omit<CreateAnalyzerOptions, \"features\">;\n }\n>;\n\n/**\n * Options for creating a GeoJSON Analyzer\n */\nexport type CreateGeoJsonAnalyzerOptions = CreateAnalyzerOptionsType<\n \"geojson\",\n {\n /**\n * If set to `\"centroid\"`, only the centroid of the input geometry will be\n * computed and indexed.\n *\n * If set to `\"point\"` only GeoJSON objects of type Point will be indexed and\n * all other geometry types will be ignored.\n *\n * Default: `\"shape\"`\n */\n type?: GeoType;\n /**\n * Options for fine-tuning geo queries.\n *\n * Default: `{ maxCells: 20, minLevel: 4, maxLevel: 23 }`\n */\n options?: {\n maxCells?: number;\n minLevel?: number;\n maxLevel?: number;\n };\n }\n>;\n\n/**\n * Options for creating a GeoPoint Analyzer\n */\nexport type CreateGeoPointAnalyzerOptions = CreateAnalyzerOptionsType<\n \"geopoint\",\n {\n /**\n * Attribute paths of the latitude value relative to the field for which the\n * Analyzer is defined in the View.\n */\n latitude?: string[];\n /**\n * Attribute paths of the longitude value relative to the field for which the\n * Analyzer is defined in the View.\n */\n longitude?: string[];\n /**\n * Options for fine-tuning geo queries.\n *\n * Default: `{ maxCells: 20, minLevel: 4, maxLevel: 23 }`\n */\n options?: {\n minCells?: number;\n minLevel?: number;\n maxLevel?: number;\n };\n }\n>;\n\n/**\n * (Enterprise Edition only.) Options for creating a Geo S2 Analyzer\n */\nexport type CreateGeoS2AnalyzerOptions = CreateAnalyzerOptionsType<\n \"geo_s2\",\n {\n /**\n * If set to `\"centroid\"`, only the centroid of the input geometry will be\n * computed and indexed.\n *\n * If set to `\"point\"` only GeoJSON objects of type Point will be indexed and\n * all other geometry types will be ignored.\n *\n * Default: `\"shape\"`\n */\n type?: GeoType;\n /**\n * Options for fine-tuning geo queries.\n *\n * Default: `{ maxCells: 20, minLevel: 4, maxLevel: 23 }`\n */\n options?: {\n maxCells?: number;\n minLevel?: number;\n maxLevel?: number;\n };\n /**\n * If set to `\"latLngDouble\"`, each latitude and longitude value is stored\n * as an 8-byte floating-point value (16 bytes per coordinate pair).\n *\n * If set to `\"latLngInt\"`, each latitude and longitude value is stored as\n * a 4-byte integer value (8 bytes per coordinate pair).\n *\n * If set to `\"s2Point\"`, each longitude-latitude pair is stored in the\n * native format of Google S2 (24 bytes per coordinate pair).\n *\n * Default: `\"latLngDouble\"`\n */\n format?: GeoS2Format;\n }\n>;\n//#endregion\n\n//#region AnalyzerDescription\n/**\n * An object describing an Analyzer.\n */\nexport type AnalyzerDescription =\n | IdentityAnalyzerDescription\n | DelimiterAnalyzerDescription\n | MultiDelimiterAnalyzerDescription\n | StemAnalyzerDescription\n | NormAnalyzerDescription\n | NgramAnalyzerDescription\n | TextAnalyzerDescription\n | SegmentationAnalyzerDescription\n | AqlAnalyzerDescription\n | PipelineAnalyzerDescription\n | StopwordsAnalyzerDescription\n | CollationAnalyzerDescription\n | MinHashAnalyzerDescription\n | ClassificationAnalyzerDescription\n | NearestNeighborsAnalyzerDescription\n | WildcardAnalyzerDescription\n | GeoJsonAnalyzerDescription\n | GeoPointAnalyzerDescription\n | GeoS2AnalyzerDescription;\n\n/**\n * Shared attributes of all Analyzer descriptions.\n */\ntype AnalyzerDescriptionType<\n Type extends string,\n Properties = Record<string, never>\n> = {\n /**\n * A unique name for this Analyzer.\n */\n name: string;\n /**\n * Type of the Analyzer.\n */\n type: Type;\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: Properties;\n};\n\n/**\n * An object describing an Identity Analyzer.\n */\nexport type IdentityAnalyzerDescription = AnalyzerDescriptionType<\"identity\">;\n\n/**\n * An object describing a Delimiter Analyzer.\n */\nexport type DelimiterAnalyzerDescription = AnalyzerDescriptionType<\n \"delimiter\",\n { delimiter: string }\n>;\n\n/**\n * An object describing a Multi Delimiter Analyzer.\n */\nexport type MultiDelimiterAnalyzerDescription = AnalyzerDescriptionType<\n \"multi_delimiter\",\n { delimiters: string[] }\n>;\n\n/**\n * An object describing a Stem Analyzer.\n */\nexport type StemAnalyzerDescription = AnalyzerDescriptionType<\n \"stem\",\n { locale: string }\n>;\n\n/**\n * An object describing a Norm Analyzer.\n */\nexport type NormAnalyzerDescription = AnalyzerDescriptionType<\n \"norm\",\n {\n locale: string;\n case: CaseConversion;\n accent: boolean;\n }\n>;\n\n/**\n * An object describing an Ngram Analyzer.\n */\nexport type NgramAnalyzerDescription = AnalyzerDescriptionType<\n \"ngram\",\n {\n min: number;\n max: number;\n preserveOriginal: boolean;\n }\n>;\n\n/**\n * An object describing a Text Analyzer.\n */\nexport type TextAnalyzerDescription = AnalyzerDescriptionType<\n \"text\",\n {\n locale: string;\n case: CaseConversion;\n stopwords: string[];\n stopwordsPath: string;\n accent: boolean;\n stemming: boolean;\n edgeNgram: {\n min: number;\n max: number;\n preserveOriginal: boolean;\n };\n }\n>;\n\n/**\n * An object describing a Segmentation Analyzer\n */\nexport type SegmentationAnalyzerDescription = AnalyzerDescriptionType<\n \"segmentation\",\n {\n break: SegmentationTokenType;\n case: CaseConversion;\n }\n>;\n\n/**\n * An object describing an AQL Analyzer\n */\nexport type AqlAnalyzerDescription = AnalyzerDescriptionType<\n \"aql\",\n {\n queryString: string;\n collapsePositions: boolean;\n keepNull: boolean;\n batchSize: number;\n memoryLimit: number;\n returnType: AqlReturnTokenType;\n }\n>;\n\n/**\n * An object describing a Pipeline Analyzer\n */\nexport type PipelineAnalyzerDescription = AnalyzerDescriptionType<\n \"pipeline\",\n {\n pipeline: Omit<AnalyzerDescription, \"name\" | \"features\">[];\n }\n>;\n\n/**\n * An object describing a Stopwords Analyzer\n */\nexport type StopwordsAnalyzerDescription = AnalyzerDescriptionType<\n \"stopwords\",\n {\n stopwords: string[];\n hex: boolean;\n }\n>;\n\n/**\n * An object describing a Collation Analyzer\n */\nexport type CollationAnalyzerDescription = AnalyzerDescriptionType<\n \"collation\",\n {\n locale: string;\n }\n>;\n\n/**\n * (Enterprise Edition only.) An object describing a MinHash Analyzer\n */\nexport type MinHashAnalyzerDescription = AnalyzerDescriptionType<\n \"minhash\",\n {\n analyzer: Omit<AnalyzerDescription, \"name\" | \"features\">;\n numHashes: number;\n }\n>;\n\n/**\n * (Enterprise Edition only.) An object describing a Classification Analyzer\n */\nexport type ClassificationAnalyzerDescription = AnalyzerDescriptionType<\n \"classification\",\n {\n model_location: string;\n top_k: number;\n threshold: number;\n }\n>;\n\n/**\n * (Enterprise Edition only.) An object describing a NearestNeighbors Analyzer\n */\nexport type NearestNeighborsAnalyzerDescription = AnalyzerDescriptionType<\n \"nearest_neighbors\",\n {\n model_location: string;\n top_k: number;\n }\n>;\n\n/**\n * An object describing a Wildcard Analyzer\n */\nexport type WildcardAnalyzerDescription = AnalyzerDescriptionType<\n \"wildcard\",\n {\n ngramSize: number;\n analyzer?: Omit<AnalyzerDescription, \"name\" | \"features\">;\n }\n>;\n\n/**\n * An object describing a GeoJSON Analyzer\n */\nexport type GeoJsonAnalyzerDescription = AnalyzerDescriptionType<\n \"geojson\",\n {\n type: GeoType;\n description: {\n maxCells: number;\n minLevel: number;\n maxLevel: number;\n };\n }\n>;\n\n/**\n * An object describing a GeoPoint Analyzer\n */\nexport type GeoPointAnalyzerDescription = AnalyzerDescriptionType<\n \"geopoint\",\n {\n latitude: string[];\n longitude: string[];\n description: {\n minCells: number;\n minLevel: number;\n maxLevel: number;\n };\n }\n>;\n\n/**\n * (Enterprise Edition only.) An object describing a GeoS2 Analyzer\n */\nexport type GeoS2AnalyzerDescription = AnalyzerDescriptionType<\n \"geo_s2\",\n {\n type: GeoType;\n description: {\n maxCells: number;\n minLevel: number;\n maxLevel: number;\n };\n format: GeoS2Format;\n }\n>;\n//#endregion\n\n//#region Analyzer class\n/**\n * Indicates whether the given value represents an {@link Analyzer}.\n *\n * @param analyzer - A value that might be an Analyzer.\n */\nexport function isArangoAnalyzer(analyzer: any): analyzer is Analyzer {\n return Boolean(analyzer && analyzer.isArangoAnalyzer);\n}\n\n/**\n * Represents an Analyzer in a {@link databases.Database}.\n */\nexport class Analyzer {\n protected _name: string;\n protected _db: databases.Database;\n\n /**\n * @internal\n */\n constructor(db: databases.Database, name: string) {\n this._db = db;\n this._name = name;\n }\n\n /**\n * Database this analyzer belongs to.\n */\n get database() {\n return this._db;\n }\n\n /**\n * @internal\n *\n * Indicates that this object represents an ArangoDB Analyzer.\n */\n get isArangoAnalyzer(): true {\n return true;\n }\n\n /**\n * Name of this Analyzer.\n *\n * See also {@link databases.Database}.\n */\n get name() {\n return this._name;\n }\n\n /**\n * Checks whether the Analyzer exists.\n *\n * @example\n * ```js\n * const db = new Database();\n * const analyzer = db.analyzer(\"some-analyzer\");\n * const result = await analyzer.exists();\n * // result indicates whether the Analyzer exists\n * ```\n */\n async exists(): Promise<boolean> {\n try {\n await this.get();\n return true;\n } catch (err: any) {\n if (errors.isArangoError(err) && err.errorNum === ANALYZER_NOT_FOUND) {\n return false;\n }\n throw err;\n }\n }\n\n /**\n * Retrieves the Analyzer definition for the Analyzer.\n *\n * @example\n * ```js\n * const db = new Database();\n * const analyzer = db.analyzer(\"some-analyzer\");\n * const definition = await analyzer.get();\n * // definition contains the Analyzer definition\n * ```\n */\n get(): Promise<connection.ArangoApiResponse<AnalyzerDescription>> {\n return this._db.request({\n pathname: `/_api/analyzer/${encodeURIComponent(this._name)}`,\n });\n }\n\n /**\n * Creates a new Analyzer with the given `options` and the instance's name.\n *\n * See also {@link databases.Database#createAnalyzer}.\n *\n * @param options - Options for creating the Analyzer.\n *\n * @example\n * ```js\n * const db = new Database();\n * const analyzer = db.analyzer(\"potatoes\");\n * await analyzer.create({ type: \"identity\" });\n * // the identity Analyzer \"potatoes\" now exists\n * ```\n */\n create<Options extends CreateAnalyzerOptions>(\n options: Options\n ): Promise<\n Options extends CreateIdentityAnalyzerOptions\n ? IdentityAnalyzerDescription\n : Options extends CreateDelimiterAnalyzerOptions\n ? DelimiterAnalyzerDescription\n : Options extends CreateStemAnalyzerOptions\n ? StemAnalyzerDescription\n : Options extends CreateNormAnalyzerOptions\n ? NormAnalyzerDescription\n : Options extends CreateNgramAnalyzerOptions\n ? NgramAnalyzerDescription\n : Options extends CreateTextAnalyzerOptions\n ? TextAnalyzerDescription\n : Options extends CreateSegmentationAnalyzerOptions\n ? SegmentationAnalyzerDescription\n : Options extends CreateAqlAnalyzerOptions\n ? AqlAnalyzerDescription\n : Options extends CreatePipelineAnalyzerOptions\n ? PipelineAnalyzerDescription\n : Options extends CreateStopwordsAnalyzerOptions\n ? StopwordsAnalyzerDescription\n : Options extends CreateCollationAnalyzerOptions\n ? CollationAnalyzerDescription\n : Options extends CreateMinHashAnalyzerOptions\n ? MinHashAnalyzerDescription\n : Options extends CreateClassificationAnalyzerOptions\n ? ClassificationAnalyzerDescription\n : Options extends CreateNearestNeighborsAnalyzerOptions\n ? NearestNeighborsAnalyzerDescription\n : Options extends CreateGeoJsonAnalyzerOptions\n ? GeoJsonAnalyzerDescription\n : Options extends CreateGeoPointAnalyzerOptions\n ? GeoPointAnalyzerDescription\n : Options extends CreateGeoS2AnalyzerOptions\n ? GeoS2AnalyzerDescription\n : AnalyzerDescription\n > {\n return this._db.request({\n method: \"POST\",\n pathname: \"/_api/analyzer\",\n body: { name: this._name, ...options },\n });\n }\n\n /**\n * Deletes the Analyzer from the database.\n *\n * @param force - Whether the Analyzer should still be deleted even if it\n * is currently in use.\n *\n * @example\n * ```js\n * const db = new Database();\n * const analyzer = db.analyzer(\"some-analyzer\");\n * await analyzer.drop();\n * // the Analyzer \"some-analyzer\" no longer exists\n * ```\n */\n drop(force: boolean = false): Promise<connection.ArangoApiResponse<{ name: string }>> {\n return this._db.request({\n method: \"DELETE\",\n pathname: `/_api/analyzer/${encodeURIComponent(this._name)}`,\n search: { force },\n });\n }\n}\n//#endregion"]}
@@ -302,7 +302,7 @@ export type CollectionChecksumOptions = {
302
302
  /**
303
303
  * Options for truncating collections.
304
304
  */
305
- export type CollectionTruncateOptions = {
305
+ export type TruncateCollectionOptions = {
306
306
  /**
307
307
  * Whether the collection should be compacted after truncation.
308
308
  */
@@ -316,7 +316,7 @@ export type CollectionTruncateOptions = {
316
316
  /**
317
317
  * Options for dropping collections.
318
318
  */
319
- export type CollectionDropOptions = {
319
+ export type DropCollectionOptions = {
320
320
  /**
321
321
  * Whether the collection is a system collection. If the collection is a
322
322
  * system collection, this option must be set to `true` or ArangoDB will
@@ -748,7 +748,7 @@ export interface DocumentCollection<EntryResultType extends Record<string, any>
748
748
  * // the collection "some-collection" is now empty
749
749
  * ```
750
750
  */
751
- truncate(options?: CollectionTruncateOptions): Promise<connection.ArangoApiResponse<CollectionDescription>>;
751
+ truncate(options?: TruncateCollectionOptions): Promise<connection.ArangoApiResponse<CollectionDescription>>;
752
752
  /**
753
753
  * Deletes the collection from the database.
754
754
  *
@@ -762,7 +762,7 @@ export interface DocumentCollection<EntryResultType extends Record<string, any>
762
762
  * // The collection "some-collection" is now an ex-collection
763
763
  * ```
764
764
  */
765
- drop(options?: CollectionDropOptions): Promise<connection.ArangoApiResponse<{
765
+ drop(options?: DropCollectionOptions): Promise<connection.ArangoApiResponse<{
766
766
  id: string;
767
767
  }>>;
768
768
  /**
@@ -2042,8 +2042,8 @@ export declare class Collection<EntryResultType extends Record<string, any> = an
2042
2042
  checksum: string;
2043
2043
  }>>;
2044
2044
  rename(newName: string): Promise<connection.ArangoApiResponse<CollectionDescription>>;
2045
- truncate(options?: CollectionTruncateOptions): Promise<connection.ArangoApiResponse<CollectionDescription>>;
2046
- drop(options?: CollectionDropOptions): Promise<any>;
2045
+ truncate(options?: TruncateCollectionOptions): Promise<connection.ArangoApiResponse<CollectionDescription>>;
2046
+ drop(options?: DropCollectionOptions): Promise<any>;
2047
2047
  compact(): Promise<any>;
2048
2048
  getResponsibleShard(document: Partial<documents.Document<EntryResultType>>): Promise<string>;
2049
2049
  documentId(selector: documents.DocumentSelector): string;