arangojs 7.8.0 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/CHANGELOG.md +264 -3
  2. package/CONTRIBUTING.md +1 -1
  3. package/MIGRATING.md +126 -2
  4. package/README.md +7 -13
  5. package/analyzer.d.ts +531 -253
  6. package/analyzer.d.ts.map +1 -1
  7. package/analyzer.js +9 -8
  8. package/analyzer.js.map +1 -1
  9. package/aql.d.ts +122 -139
  10. package/aql.d.ts.map +1 -1
  11. package/aql.js +146 -148
  12. package/aql.js.map +1 -1
  13. package/collection.d.ts +311 -310
  14. package/collection.d.ts.map +1 -1
  15. package/collection.js +163 -96
  16. package/collection.js.map +1 -1
  17. package/connection.d.ts +65 -52
  18. package/connection.d.ts.map +1 -1
  19. package/connection.js +142 -140
  20. package/connection.js.map +1 -1
  21. package/cursor.d.ts +108 -26
  22. package/cursor.d.ts.map +1 -1
  23. package/cursor.js +24 -23
  24. package/cursor.js.map +1 -1
  25. package/database.d.ts +298 -330
  26. package/database.d.ts.map +1 -1
  27. package/database.js +178 -252
  28. package/database.js.map +1 -1
  29. package/documents.d.ts +3 -4
  30. package/documents.d.ts.map +1 -1
  31. package/documents.js +0 -1
  32. package/documents.js.map +1 -1
  33. package/error.d.ts +3 -6
  34. package/error.d.ts.map +1 -1
  35. package/error.js +5 -7
  36. package/error.js.map +1 -1
  37. package/foxx-manifest.d.ts +7 -8
  38. package/foxx-manifest.d.ts.map +1 -1
  39. package/foxx-manifest.js +1 -1
  40. package/foxx-manifest.js.map +1 -1
  41. package/graph.d.ts +38 -56
  42. package/graph.d.ts.map +1 -1
  43. package/graph.js +59 -63
  44. package/graph.js.map +1 -1
  45. package/index.d.ts +6 -8
  46. package/index.d.ts.map +1 -1
  47. package/index.js +1 -6
  48. package/index.js.map +1 -1
  49. package/indexes.d.ts +348 -127
  50. package/indexes.d.ts.map +1 -1
  51. package/indexes.js +1 -3
  52. package/indexes.js.map +1 -1
  53. package/lib/blob.d.ts +0 -2
  54. package/lib/blob.d.ts.map +1 -1
  55. package/lib/blob.js +0 -1
  56. package/lib/blob.js.map +1 -1
  57. package/lib/btoa.d.ts +1 -3
  58. package/lib/btoa.d.ts.map +1 -1
  59. package/lib/btoa.js +3 -5
  60. package/lib/btoa.js.map +1 -1
  61. package/lib/btoa.web.d.ts +1 -3
  62. package/lib/btoa.web.d.ts.map +1 -1
  63. package/lib/btoa.web.js +4 -6
  64. package/lib/btoa.web.js.map +1 -1
  65. package/lib/codes.d.ts +2 -2
  66. package/lib/codes.d.ts.map +1 -1
  67. package/lib/codes.js +3 -3
  68. package/lib/codes.js.map +1 -1
  69. package/lib/errback.d.ts +0 -2
  70. package/lib/errback.d.ts.map +1 -1
  71. package/lib/errback.js.map +1 -1
  72. package/lib/joinPath.d.ts +0 -2
  73. package/lib/joinPath.d.ts.map +1 -1
  74. package/lib/joinPath.js +0 -2
  75. package/lib/joinPath.js.map +1 -1
  76. package/lib/joinPath.web.d.ts +1 -3
  77. package/lib/joinPath.web.d.ts.map +1 -1
  78. package/lib/joinPath.web.js +7 -4
  79. package/lib/joinPath.web.js.map +1 -1
  80. package/lib/multipart.d.ts +0 -4
  81. package/lib/multipart.d.ts.map +1 -1
  82. package/lib/multipart.js +16 -37
  83. package/lib/multipart.js.map +1 -1
  84. package/lib/multipart.web.d.ts +0 -2
  85. package/lib/multipart.web.d.ts.map +1 -1
  86. package/lib/multipart.web.js +0 -2
  87. package/lib/multipart.web.js.map +1 -1
  88. package/lib/normalizeUrl.d.ts +0 -2
  89. package/lib/normalizeUrl.d.ts.map +1 -1
  90. package/lib/normalizeUrl.js +0 -2
  91. package/lib/normalizeUrl.js.map +1 -1
  92. package/lib/omit.d.ts +1 -3
  93. package/lib/omit.d.ts.map +1 -1
  94. package/lib/omit.js +1 -2
  95. package/lib/omit.js.map +1 -1
  96. package/lib/querystringify.d.ts +4 -0
  97. package/lib/querystringify.d.ts.map +1 -0
  98. package/lib/querystringify.js +20 -0
  99. package/lib/querystringify.js.map +1 -0
  100. package/lib/querystringify.web.d.ts +2 -0
  101. package/lib/querystringify.web.d.ts.map +1 -0
  102. package/lib/querystringify.web.js +30 -0
  103. package/lib/querystringify.web.js.map +1 -0
  104. package/lib/request.d.ts +0 -1
  105. package/lib/request.d.ts.map +1 -1
  106. package/lib/request.js +6 -3
  107. package/lib/request.js.map +1 -1
  108. package/lib/request.node.d.ts +2 -8
  109. package/lib/request.node.d.ts.map +1 -1
  110. package/lib/request.node.js +16 -7
  111. package/lib/request.node.js.map +1 -1
  112. package/lib/request.web.d.ts +2 -3
  113. package/lib/request.web.d.ts.map +1 -1
  114. package/lib/request.web.js +26 -29
  115. package/lib/request.web.js.map +1 -1
  116. package/lib/xhr.d.ts +1 -3
  117. package/lib/xhr.d.ts.map +1 -1
  118. package/lib/xhr.js +0 -2
  119. package/lib/xhr.js.map +1 -1
  120. package/package.json +5 -6
  121. package/route.d.ts +1 -2
  122. package/route.d.ts.map +1 -1
  123. package/route.js +1 -2
  124. package/route.js.map +1 -1
  125. package/transaction.d.ts +31 -6
  126. package/transaction.d.ts.map +1 -1
  127. package/transaction.js +13 -6
  128. package/transaction.js.map +1 -1
  129. package/view.d.ts +237 -181
  130. package/view.d.ts.map +1 -1
  131. package/view.js +17 -25
  132. package/view.js.map +1 -1
  133. package/web.js +1 -1
  134. package/web.js.map +1 -1
  135. package/lib/error.d.ts +0 -18
  136. package/lib/error.d.ts.map +0 -1
  137. package/lib/error.js +0 -18
  138. package/lib/error.js.map +0 -1
package/database.js CHANGED
@@ -24,7 +24,6 @@ function isArangoDatabase(database) {
24
24
  exports.isArangoDatabase = isArangoDatabase;
25
25
  /**
26
26
  * @internal
27
- * @hidden
28
27
  */
29
28
  function coerceTransactionCollections(collections) {
30
29
  if (typeof collections === "string") {
@@ -33,8 +32,8 @@ function coerceTransactionCollections(collections) {
33
32
  if (Array.isArray(collections)) {
34
33
  return { write: collections.map(collection_1.collectionToString) };
35
34
  }
36
- if (collection_1.isArangoCollection(collections)) {
37
- return { write: collection_1.collectionToString(collections) };
35
+ if ((0, collection_1.isArangoCollection)(collections)) {
36
+ return { write: (0, collection_1.collectionToString)(collections) };
38
37
  }
39
38
  const cols = {};
40
39
  if (collections) {
@@ -44,17 +43,17 @@ function coerceTransactionCollections(collections) {
44
43
  if (collections.read) {
45
44
  cols.read = Array.isArray(collections.read)
46
45
  ? collections.read.map(collection_1.collectionToString)
47
- : collection_1.collectionToString(collections.read);
46
+ : (0, collection_1.collectionToString)(collections.read);
48
47
  }
49
48
  if (collections.write) {
50
49
  cols.write = Array.isArray(collections.write)
51
50
  ? collections.write.map(collection_1.collectionToString)
52
- : collection_1.collectionToString(collections.write);
51
+ : (0, collection_1.collectionToString)(collections.write);
53
52
  }
54
53
  if (collections.exclusive) {
55
54
  cols.exclusive = Array.isArray(collections.exclusive)
56
55
  ? collections.exclusive.map(collection_1.collectionToString)
57
- : collection_1.collectionToString(collections.exclusive);
56
+ : (0, collection_1.collectionToString)(collections.exclusive);
58
57
  }
59
58
  }
60
59
  return cols;
@@ -64,12 +63,6 @@ function coerceTransactionCollections(collections) {
64
63
  * cursors, analyzers and so on are linked to a `Database` object.
65
64
  */
66
65
  class Database {
67
- // There's currently no way to hide a single overload from typedoc
68
- // /**
69
- // * @internal
70
- // * @hidden
71
- // */
72
- // constructor(database: Database, name?: string);
73
66
  constructor(configOrDatabase = {}, name) {
74
67
  this._analyzers = new Map();
75
68
  this._collections = new Map();
@@ -90,7 +83,7 @@ class Database {
90
83
  ? { databaseName: name, url: config }
91
84
  : config;
92
85
  this._connection = new connection_1.Connection(options);
93
- this._name = (databaseName === null || databaseName === void 0 ? void 0 : databaseName.normalize("NFC")) || "_system";
86
+ this._name = databaseName?.normalize("NFC") || "_system";
94
87
  }
95
88
  }
96
89
  //#region misc
@@ -129,10 +122,10 @@ class Database {
129
122
  method: "GET",
130
123
  path: "/_api/version",
131
124
  qs: { details },
132
- }, (res) => res.body);
125
+ });
133
126
  }
134
127
  /**
135
- * Returns a new {@link Route} instance for the given path (relative to the
128
+ * Returns a new {@link route.Route} instance for the given path (relative to the
136
129
  * database) that can be used to perform arbitrary HTTP requests.
137
130
  *
138
131
  * @param path - The database-relative URL of the route. Defaults to the
@@ -156,22 +149,25 @@ class Database {
156
149
  route(path, headers) {
157
150
  return new route_1.Route(this, path, headers);
158
151
  }
159
- request({ absolutePath = false, basePath, ...opts }, transform) {
152
+ request({ absolutePath = false, basePath, ...opts }, transform = (res) => res.body) {
160
153
  if (!absolutePath) {
161
154
  basePath = `/_db/${encodeURIComponent(this._name)}${basePath || ""}`;
162
155
  }
163
- return this._connection.request({ basePath, ...opts }, transform);
156
+ return this._connection.request({ basePath, ...opts }, transform || undefined);
164
157
  }
165
158
  /**
166
159
  * Updates the URL list by requesting a list of all coordinators in the
167
160
  * cluster and adding any endpoints not initially specified in the
168
- * {@link Config}.
161
+ * {@link connection.Config}.
169
162
  *
170
163
  * For long-running processes communicating with an ArangoDB cluster it is
171
164
  * recommended to run this method periodically (e.g. once per hour) to make
172
165
  * sure new coordinators are picked up correctly and can be used for
173
166
  * fail-over or load balancing.
174
167
  *
168
+ * @param overwrite - If set to `true`, the existing host list will be
169
+ * replaced instead of extended.
170
+ *
175
171
  * @example
176
172
  * ```js
177
173
  * const db = new Database();
@@ -182,12 +178,17 @@ class Database {
182
178
  *
183
179
  * // later
184
180
  * clearInterval(interval);
185
- * db.close();
181
+ * system.close();
186
182
  * ```
187
183
  */
188
- async acquireHostList() {
184
+ async acquireHostList(overwrite = false) {
189
185
  const urls = await this.request({ path: "/_api/cluster/endpoints" }, (res) => res.body.endpoints.map((endpoint) => endpoint.endpoint));
190
- this._connection.addToHostList(urls);
186
+ if (urls.length > 0) {
187
+ if (overwrite)
188
+ this._connection.setHostList(urls);
189
+ else
190
+ this._connection.addToHostList(urls);
191
+ }
191
192
  }
192
193
  /**
193
194
  * Closes all active connections of this database instance.
@@ -210,7 +211,7 @@ class Database {
210
211
  * REMOVE session IN ${sessions}
211
212
  * `);
212
213
  * // Making sure to close the connections because they're no longer used
213
- * db.close();
214
+ * system.close();
214
215
  * }, 1000 * 60 * 60);
215
216
  * ```
216
217
  */
@@ -233,7 +234,7 @@ class Database {
233
234
  /**
234
235
  * Sets the limit for the number of values of the most recently received
235
236
  * server-reported queue times that can be accessed using
236
- * {@link Database.queueTime}.
237
+ * {@link Database#queueTime}.
237
238
  *
238
239
  * @param responseQueueTimeSamples - Number of values to maintain.
239
240
  */
@@ -243,31 +244,7 @@ class Database {
243
244
  //#endregion
244
245
  //#region auth
245
246
  /**
246
- * Updates the `Database` instance and its connection string to use the given
247
- * `databaseName`, then returns itself.
248
- *
249
- * **Note**: This also affects all collections, cursors and other arangojs
250
- * objects originating from this database object, which may cause unexpected
251
- * results.
252
- *
253
- * @param databaseName - Name of the database to use.
254
- *
255
- * @deprecated Use {@link Database.database} instead.
256
- *
257
- * @example
258
- * ```js
259
- * const systemDb = new Database();
260
- * // systemDb.useDatabase("my_database"); // deprecated
261
- * const myDb = systemDb.database("my_database");
262
- * ```
263
- */
264
- useDatabase(databaseName) {
265
- this._connection.database(this._name, null);
266
- this._name = databaseName.normalize("NFC");
267
- return this;
268
- }
269
- /**
270
- * Updates the `Database` instance's `authorization` header to use Basic
247
+ * Updates the underlying connection's `authorization` header to use Basic
271
248
  * authentication with the given `username` and `password`, then returns
272
249
  * itself.
273
250
  *
@@ -277,9 +254,7 @@ class Database {
277
254
  * @example
278
255
  * ```js
279
256
  * const db = new Database();
280
- * db.useDatabase("test");
281
257
  * db.useBasicAuth("admin", "hunter2");
282
- * // The database instance now uses the database "test"
283
258
  * // with the username "admin" and password "hunter2".
284
259
  * ```
285
260
  */
@@ -288,7 +263,7 @@ class Database {
288
263
  return this;
289
264
  }
290
265
  /**
291
- * Updates the `Database` instance's `authorization` header to use Bearer
266
+ * Updates the underlying connection's `authorization` header to use Bearer
292
267
  * authentication with the given authentication `token`, then returns itself.
293
268
  *
294
269
  * @param token - The token to authenticate with.
@@ -315,9 +290,7 @@ class Database {
315
290
  * @example
316
291
  * ```js
317
292
  * const db = new Database();
318
- * db.useDatabase("test");
319
293
  * await db.login("admin", "hunter2");
320
- * // The database instance now uses the database "test"
321
294
  * // with an authentication token for the "admin" user.
322
295
  * ```
323
296
  */
@@ -337,7 +310,7 @@ class Database {
337
310
  * Creates a new `Database` instance for the given `databaseName` that
338
311
  * shares this database's connection pool.
339
312
  *
340
- * See also {@link Database.constructor}.
313
+ * See also {@link Database:constructor}.
341
314
  *
342
315
  * @param databaseName - Name of the database.
343
316
  *
@@ -379,16 +352,16 @@ class Database {
379
352
  return true;
380
353
  }
381
354
  catch (err) {
382
- if (error_1.isArangoError(err) && err.errorNum === codes_1.DATABASE_NOT_FOUND) {
355
+ if ((0, error_1.isArangoError)(err) && err.errorNum === codes_1.DATABASE_NOT_FOUND) {
383
356
  return false;
384
357
  }
385
358
  throw err;
386
359
  }
387
360
  }
388
- createDatabase(databaseName, usersOrOptions) {
361
+ createDatabase(databaseName, usersOrOptions = {}) {
389
362
  const { users, ...options } = Array.isArray(usersOrOptions)
390
363
  ? { users: usersOrOptions }
391
- : usersOrOptions || {};
364
+ : usersOrOptions;
392
365
  return this.request({
393
366
  method: "POST",
394
367
  path: "/_api/database",
@@ -398,8 +371,8 @@ class Database {
398
371
  /**
399
372
  * Fetches all databases from the server and returns an array of their names.
400
373
  *
401
- * See also {@link Database.databases} and
402
- * {@link Database.listUserDatabases}.
374
+ * See also {@link Database#databases} and
375
+ * {@link Database#listUserDatabases}.
403
376
  *
404
377
  * @example
405
378
  * ```js
@@ -415,8 +388,8 @@ class Database {
415
388
  * Fetches all databases accessible to the active user from the server and
416
389
  * returns an array of their names.
417
390
  *
418
- * See also {@link Database.userDatabases} and
419
- * {@link Database.listDatabases}.
391
+ * See also {@link Database#userDatabases} and
392
+ * {@link Database#listDatabases}.
420
393
  *
421
394
  * @example
422
395
  * ```js
@@ -432,8 +405,8 @@ class Database {
432
405
  * Fetches all databases from the server and returns an array of `Database`
433
406
  * instances for those databases.
434
407
  *
435
- * See also {@link Database.listDatabases} and
436
- * {@link Database.userDatabases}.
408
+ * See also {@link Database#listDatabases} and
409
+ * {@link Database#userDatabases}.
437
410
  *
438
411
  * @example
439
412
  * ```js
@@ -449,8 +422,8 @@ class Database {
449
422
  * Fetches all databases accessible to the active user from the server and
450
423
  * returns an array of `Database` instances for those databases.
451
424
  *
452
- * See also {@link Database.listUserDatabases} and
453
- * {@link Database.databases}.
425
+ * See also {@link Database#listUserDatabases} and
426
+ * {@link Database#databases}.
454
427
  *
455
428
  * @example
456
429
  * ```js
@@ -487,8 +460,8 @@ class Database {
487
460
  * Returns a `Collection` instance for the given collection name.
488
461
  *
489
462
  * In TypeScript the collection implements both the
490
- * {@link DocumentCollection} and {@link EdgeCollection} interfaces and can
491
- * be cast to either type to enforce a stricter API.
463
+ * {@link collection.DocumentCollection} and {@link collection.EdgeCollection}
464
+ * interfaces and can be cast to either type to enforce a stricter API.
492
465
  *
493
466
  * @param T - Type to use for document data. Defaults to `any`.
494
467
  * @param collectionName - Name of the edge collection.
@@ -536,10 +509,10 @@ class Database {
536
509
  }
537
510
  /**
538
511
  * Creates a new edge collection with the given `collectionName` and
539
- * `options`, then returns an {@link EdgeCollection} instance for the new
512
+ * `options`, then returns an {@link collection.EdgeCollection} instance for the new
540
513
  * edge collection.
541
514
  *
542
- * This is a convenience method for calling {@link Database.createCollection}
515
+ * This is a convenience method for calling {@link Database#createCollection}
543
516
  * with `options.type` set to `EDGE_COLLECTION`.
544
517
  *
545
518
  * @param T - Type to use for edge document data. Defaults to `any`.
@@ -586,7 +559,7 @@ class Database {
586
559
  method: "PUT",
587
560
  path: `/_api/collection/${encodeURIComponent(collectionName)}/rename`,
588
561
  body: { name: newName.normalize("NFC") },
589
- }, (res) => res.body);
562
+ });
590
563
  this._collections.delete(collectionName);
591
564
  return result;
592
565
  }
@@ -594,7 +567,7 @@ class Database {
594
567
  * Fetches all collections from the database and returns an array of
595
568
  * collection descriptions.
596
569
  *
597
- * See also {@link Database.collections}.
570
+ * See also {@link Database#collections}.
598
571
  *
599
572
  * @param excludeSystem - Whether system collections should be excluded.
600
573
  *
@@ -625,10 +598,10 @@ class Database {
625
598
  * `Collection` instances.
626
599
  *
627
600
  * In TypeScript these instances implement both the
628
- * {@link DocumentCollection} and {@link EdgeCollection} interfaces and can
629
- * be cast to either type to enforce a stricter API.
601
+ * {@link collection.DocumentCollection} and {@link collection.EdgeCollection}
602
+ * interfaces and can be cast to either type to enforce a stricter API.
630
603
  *
631
- * See also {@link Database.listCollections}.
604
+ * See also {@link Database#listCollections}.
632
605
  *
633
606
  * @param excludeSystem - Whether system collections should be excluded.
634
607
  *
@@ -636,18 +609,16 @@ class Database {
636
609
  * ```js
637
610
  * const db = new Database();
638
611
  * const collections = await db.collections();
639
- * // collections is an array of DocumentCollection
640
- * // and EdgeCollection instances
641
- * // not including system collections
612
+ * // collections is an array of DocumentCollection and EdgeCollection
613
+ * // instances not including system collections
642
614
  * ```
643
615
  *
644
616
  * @example
645
617
  * ```js
646
618
  * const db = new Database();
647
619
  * const collections = await db.collections(false);
648
- * // collections is an array of DocumentCollection
649
- * // and EdgeCollection instances
650
- * // including system collections
620
+ * // collections is an array of DocumentCollection and EdgeCollection
621
+ * // instances including system collections
651
622
  * ```
652
623
  */
653
624
  async collections(excludeSystem = true) {
@@ -657,7 +628,7 @@ class Database {
657
628
  //#endregion
658
629
  //#region graphs
659
630
  /**
660
- * Returns a {@link Graph} instance representing the graph with the given
631
+ * Returns a {@link graph.Graph} instance representing the graph with the given
661
632
  * `graphName`.
662
633
  *
663
634
  * @param graphName - Name of the graph.
@@ -677,7 +648,7 @@ class Database {
677
648
  }
678
649
  /**
679
650
  * Creates a graph with the given `graphName` and `edgeDefinitions`, then
680
- * returns a {@link Graph} instance for the new graph.
651
+ * returns a {@link graph.Graph} instance for the new graph.
681
652
  *
682
653
  * @param graphName - Name of the graph to be created.
683
654
  * @param edgeDefinitions - An array of edge definitions.
@@ -692,7 +663,7 @@ class Database {
692
663
  * Fetches all graphs from the database and returns an array of graph
693
664
  * descriptions.
694
665
  *
695
- * See also {@link Database.graphs}.
666
+ * See also {@link Database#graphs}.
696
667
  *
697
668
  * @example
698
669
  * ```js
@@ -705,10 +676,10 @@ class Database {
705
676
  return this.request({ path: "/_api/gharial" }, (res) => res.body.graphs);
706
677
  }
707
678
  /**
708
- * Fetches all graphs from the database and returns an array of {@link Graph}
679
+ * Fetches all graphs from the database and returns an array of {@link graph.Graph}
709
680
  * instances for those graphs.
710
681
  *
711
- * See also {@link Database.listGraphs}.
682
+ * See also {@link Database#listGraphs}.
712
683
  *
713
684
  * @example
714
685
  * ```js
@@ -724,9 +695,9 @@ class Database {
724
695
  //#endregion
725
696
  //#region views
726
697
  /**
727
- * Returns an {@link ArangoSearchView} instance for the given `viewName`.
698
+ * Returns a {@link view.View} instance for the given `viewName`.
728
699
  *
729
- * @param viewName - Name of the ArangoSearch View.
700
+ * @param viewName - Name of the ArangoSearch or SearchAlias View.
730
701
  *
731
702
  * @example
732
703
  * ```js
@@ -742,28 +713,28 @@ class Database {
742
713
  return this._views.get(viewName);
743
714
  }
744
715
  /**
745
- * Creates a new ArangoSearch View with the given `viewName` and `options`
746
- * and returns an {@link ArangoSearchView} instance for the created View.
716
+ * Creates a new View with the given `viewName` and `options`, then returns a
717
+ * {@link view.View} instance for the new View.
747
718
  *
748
- * @param viewName - Name of the ArangoSearch View.
719
+ * @param viewName - Name of the View.
749
720
  * @param options - An object defining the properties of the View.
750
721
  *
751
722
  * @example
752
723
  * ```js
753
724
  * const db = new Database();
754
- * const view = await db.createView("potatoes");
725
+ * const view = await db.createView("potatoes", { type: "arangosearch" });
755
726
  * // the ArangoSearch View "potatoes" now exists
756
727
  * ```
757
728
  */
758
729
  async createView(viewName, options) {
759
730
  const view = this.view(viewName.normalize("NFC"));
760
- await view.create({ ...options, type: view_1.ViewType.ARANGOSEARCH_VIEW });
731
+ await view.create(options);
761
732
  return view;
762
733
  }
763
734
  /**
764
735
  * Renames the view `viewName` to `newName`.
765
736
  *
766
- * Additionally removes any stored {@link View} instance for `viewName` from
737
+ * Additionally removes any stored {@link view.View} instance for `viewName` from
767
738
  * the `Database` instance's internal cache.
768
739
  *
769
740
  * **Note**: Renaming views may not be supported when ArangoDB is running in
@@ -778,7 +749,7 @@ class Database {
778
749
  method: "PUT",
779
750
  path: `/_api/view/${encodeURIComponent(viewName)}/rename`,
780
751
  body: { name: newName.normalize("NFC") },
781
- }, (res) => res.body);
752
+ });
782
753
  this._views.delete(viewName);
783
754
  return result;
784
755
  }
@@ -786,7 +757,7 @@ class Database {
786
757
  * Fetches all Views from the database and returns an array of View
787
758
  * descriptions.
788
759
  *
789
- * See also {@link Database.views}.
760
+ * See also {@link Database#views}.
790
761
  *
791
762
  * @example
792
763
  * ```js
@@ -801,9 +772,10 @@ class Database {
801
772
  }
802
773
  /**
803
774
  * Fetches all Views from the database and returns an array of
804
- * {@link ArangoSearchView} instances for the Views.
775
+ * {@link view.View} instances
776
+ * for the Views.
805
777
  *
806
- * See also {@link Database.listViews}.
778
+ * See also {@link Database#listViews}.
807
779
  *
808
780
  * @example
809
781
  * ```js
@@ -819,7 +791,7 @@ class Database {
819
791
  //#endregion
820
792
  //#region analyzers
821
793
  /**
822
- * Returns an {@link Analyzer} instance representing the Analyzer with the
794
+ * Returns an {@link analyzer.Analyzer} instance representing the Analyzer with the
823
795
  * given `analyzerName`.
824
796
  *
825
797
  * @example
@@ -838,7 +810,7 @@ class Database {
838
810
  }
839
811
  /**
840
812
  * Creates a new Analyzer with the given `analyzerName` and `options`, then
841
- * returns an {@link Analyzer} instance for the new Analyzer.
813
+ * returns an {@link analyzer.Analyzer} instance for the new Analyzer.
842
814
  *
843
815
  * @param analyzerName - Name of the Analyzer.
844
816
  * @param options - An object defining the properties of the Analyzer.
@@ -859,7 +831,7 @@ class Database {
859
831
  * Fetches all Analyzers visible in the database and returns an array of
860
832
  * Analyzer descriptions.
861
833
  *
862
- * See also {@link Database.analyzers}.
834
+ * See also {@link Database#analyzers}.
863
835
  *
864
836
  * @example
865
837
  * ```js
@@ -873,9 +845,9 @@ class Database {
873
845
  }
874
846
  /**
875
847
  * Fetches all Analyzers visible in the database and returns an array of
876
- * {@link Analyzer} instances for those Analyzers.
848
+ * {@link analyzer.Analyzer} instances for those Analyzers.
877
849
  *
878
- * See also {@link Database.listAnalyzers}.
850
+ * See also {@link Database#listAnalyzers}.
879
851
  *
880
852
  * @example
881
853
  * ```js
@@ -1060,21 +1032,21 @@ class Database {
1060
1032
  * ```
1061
1033
  */
1062
1034
  getUserAccessLevel(username, { database, collection }) {
1063
- var _a;
1064
1035
  const databaseName = isArangoDatabase(database)
1065
1036
  ? database.name
1066
- : (_a = database === null || database === void 0 ? void 0 : database.normalize("NFC")) !== null && _a !== void 0 ? _a : (collection_1.isArangoCollection(collection)
1067
- ? collection._db.name
1068
- : this._name);
1037
+ : database?.normalize("NFC") ??
1038
+ ((0, collection_1.isArangoCollection)(collection)
1039
+ ? collection._db.name
1040
+ : this._name);
1069
1041
  const suffix = collection
1070
- ? `/${encodeURIComponent(collection_1.isArangoCollection(collection)
1042
+ ? `/${encodeURIComponent((0, collection_1.isArangoCollection)(collection)
1071
1043
  ? collection.name
1072
1044
  : collection.normalize("NFC"))}`
1073
1045
  : "";
1074
1046
  return this.request({
1075
1047
  absolutePath: true,
1076
1048
  path: `/_api/user/${encodeURIComponent(username)}/database/${encodeURIComponent(databaseName)}${suffix}`,
1077
- }, (res) => res.body);
1049
+ }, (res) => res.body.result);
1078
1050
  }
1079
1051
  /**
1080
1052
  * Sets the given ArangoDB user's access level for the database, or the
@@ -1149,14 +1121,14 @@ class Database {
1149
1121
  * ```
1150
1122
  */
1151
1123
  setUserAccessLevel(username, { database, collection, grant, }) {
1152
- var _a;
1153
1124
  const databaseName = isArangoDatabase(database)
1154
1125
  ? database.name
1155
- : (_a = database === null || database === void 0 ? void 0 : database.normalize("NFC")) !== null && _a !== void 0 ? _a : (collection_1.isArangoCollection(collection)
1156
- ? collection._db.name
1157
- : this._name);
1126
+ : database?.normalize("NFC") ??
1127
+ ((0, collection_1.isArangoCollection)(collection)
1128
+ ? collection._db.name
1129
+ : this._name);
1158
1130
  const suffix = collection
1159
- ? `/${encodeURIComponent(collection_1.isArangoCollection(collection)
1131
+ ? `/${encodeURIComponent((0, collection_1.isArangoCollection)(collection)
1160
1132
  ? collection.name
1161
1133
  : collection.normalize("NFC"))}`
1162
1134
  : "";
@@ -1231,14 +1203,14 @@ class Database {
1231
1203
  * ```
1232
1204
  */
1233
1205
  clearUserAccessLevel(username, { database, collection }) {
1234
- var _a;
1235
1206
  const databaseName = isArangoDatabase(database)
1236
1207
  ? database.name
1237
- : (_a = database === null || database === void 0 ? void 0 : database.normalize("NFC")) !== null && _a !== void 0 ? _a : (collection_1.isArangoCollection(collection)
1238
- ? collection._db.name
1239
- : this._name);
1208
+ : database?.normalize("NFC") ??
1209
+ ((0, collection_1.isArangoCollection)(collection)
1210
+ ? collection._db.name
1211
+ : this._name);
1240
1212
  const suffix = collection
1241
- ? `/${encodeURIComponent(collection_1.isArangoCollection(collection)
1213
+ ? `/${encodeURIComponent((0, collection_1.isArangoCollection)(collection)
1242
1214
  ? collection.name
1243
1215
  : collection.normalize("NFC"))}`
1244
1216
  : "";
@@ -1253,24 +1225,26 @@ class Database {
1253
1225
  absolutePath: true,
1254
1226
  path: `/_api/user/${encodeURIComponent(username)}/database`,
1255
1227
  qs: { full },
1256
- });
1228
+ }, (res) => res.body.result);
1257
1229
  }
1258
- executeTransaction(collections, action, options) {
1230
+ executeTransaction(collections, action, options = {}) {
1231
+ const { allowDirtyRead = undefined, ...opts } = options;
1259
1232
  return this.request({
1260
1233
  method: "POST",
1261
1234
  path: "/_api/transaction",
1235
+ allowDirtyRead,
1262
1236
  body: {
1263
1237
  collections: coerceTransactionCollections(collections),
1264
1238
  action,
1265
- ...options,
1239
+ ...opts,
1266
1240
  },
1267
1241
  }, (res) => res.body.result);
1268
1242
  }
1269
1243
  /**
1270
- * Returns a {@link Transaction} instance for an existing streaming
1244
+ * Returns a {@link transaction.Transaction} instance for an existing streaming
1271
1245
  * transaction with the given `id`.
1272
1246
  *
1273
- * See also {@link Database.beginTransaction}.
1247
+ * See also {@link Database#beginTransaction}.
1274
1248
  *
1275
1249
  * @param id - The `id` of an existing stream transaction.
1276
1250
  *
@@ -1286,13 +1260,15 @@ class Database {
1286
1260
  transaction(transactionId) {
1287
1261
  return new transaction_1.Transaction(this, transactionId);
1288
1262
  }
1289
- beginTransaction(collections, options) {
1263
+ beginTransaction(collections, options = {}) {
1264
+ const { allowDirtyRead = undefined, ...opts } = options;
1290
1265
  return this.request({
1291
1266
  method: "POST",
1292
1267
  path: "/_api/transaction/begin",
1268
+ allowDirtyRead,
1293
1269
  body: {
1294
1270
  collections: coerceTransactionCollections(collections),
1295
- ...options,
1271
+ ...opts,
1296
1272
  },
1297
1273
  }, (res) => new transaction_1.Transaction(this, res.body.result.id));
1298
1274
  }
@@ -1300,7 +1276,7 @@ class Database {
1300
1276
  * Fetches all active transactions from the database and returns an array of
1301
1277
  * transaction descriptions.
1302
1278
  *
1303
- * See also {@link Database.transactions}.
1279
+ * See also {@link Database#transactions}.
1304
1280
  *
1305
1281
  * @example
1306
1282
  * ```js
@@ -1314,9 +1290,9 @@ class Database {
1314
1290
  }
1315
1291
  /**
1316
1292
  * Fetches all active transactions from the database and returns an array of
1317
- * {@link Transaction} instances for those transactions.
1293
+ * {@link transaction.Transaction} instances for those transactions.
1318
1294
  *
1319
- * See also {@link Database.listTransactions}.
1295
+ * See also {@link Database#listTransactions}.
1320
1296
  *
1321
1297
  * @example
1322
1298
  * ```js
@@ -1329,16 +1305,16 @@ class Database {
1329
1305
  const transactions = await this.listTransactions();
1330
1306
  return transactions.map((data) => this.transaction(data.id));
1331
1307
  }
1332
- query(query, bindVars, options) {
1333
- if (aql_1.isAqlQuery(query)) {
1334
- options = bindVars;
1308
+ query(query, bindVars, options = {}) {
1309
+ if ((0, aql_1.isAqlQuery)(query)) {
1310
+ options = bindVars ?? {};
1335
1311
  bindVars = query.bindVars;
1336
1312
  query = query.query;
1337
1313
  }
1338
- else if (aql_1.isAqlLiteral(query)) {
1314
+ else if ((0, aql_1.isAqlLiteral)(query)) {
1339
1315
  query = query.toAQL();
1340
1316
  }
1341
- const { allowDirtyRead, retryOnConflict, count, batchSize, cache, memoryLimit, ttl, timeout, ...opts } = options || {};
1317
+ const { allowDirtyRead, retryOnConflict, count, batchSize, cache, memoryLimit, ttl, timeout, ...opts } = options;
1342
1318
  return this.request({
1343
1319
  method: "POST",
1344
1320
  path: "/_api/cursor",
@@ -1355,32 +1331,32 @@ class Database {
1355
1331
  allowDirtyRead,
1356
1332
  retryOnConflict,
1357
1333
  timeout,
1358
- }, (res) => new cursor_1.BatchedArrayCursor(this, res.body, res.arangojsHostId, allowDirtyRead).items);
1334
+ }, (res) => new cursor_1.BatchedArrayCursor(this, res.body, res.arangojsHostUrl, allowDirtyRead).items);
1359
1335
  }
1360
1336
  explain(query, bindVars, options) {
1361
- if (aql_1.isAqlQuery(query)) {
1337
+ if ((0, aql_1.isAqlQuery)(query)) {
1362
1338
  options = bindVars;
1363
1339
  bindVars = query.bindVars;
1364
1340
  query = query.query;
1365
1341
  }
1366
- else if (aql_1.isAqlLiteral(query)) {
1342
+ else if ((0, aql_1.isAqlLiteral)(query)) {
1367
1343
  query = query.toAQL();
1368
1344
  }
1369
1345
  return this.request({
1370
1346
  method: "POST",
1371
1347
  path: "/_api/explain",
1372
1348
  body: { query, bindVars, options },
1373
- }, (res) => res.body);
1349
+ });
1374
1350
  }
1375
1351
  /**
1376
1352
  * Parses the given query and returns the result.
1377
1353
  *
1378
- * See the {@link aql} template string handler for information about how
1354
+ * See the {@link aql!aql} template string handler for information about how
1379
1355
  * to create a query string without manually defining bind parameters nor
1380
1356
  * having to worry about escaping variables.
1381
1357
  *
1382
1358
  * @param query - An AQL query string or an object containing an AQL query
1383
- * string and bind parameters, e.g. the object returned from an {@link aql}
1359
+ * string and bind parameters, e.g. the object returned from an {@link aql!aql}
1384
1360
  * template string.
1385
1361
  *
1386
1362
  * @example
@@ -1395,17 +1371,34 @@ class Database {
1395
1371
  * ```
1396
1372
  */
1397
1373
  parse(query) {
1398
- if (aql_1.isAqlQuery(query)) {
1374
+ if ((0, aql_1.isAqlQuery)(query)) {
1399
1375
  query = query.query;
1400
1376
  }
1401
- else if (aql_1.isAqlLiteral(query)) {
1377
+ else if ((0, aql_1.isAqlLiteral)(query)) {
1402
1378
  query = query.toAQL();
1403
1379
  }
1404
1380
  return this.request({
1405
1381
  method: "POST",
1406
1382
  path: "/_api/query",
1407
1383
  body: { query },
1408
- }, (res) => res.body);
1384
+ });
1385
+ }
1386
+ /**
1387
+ * Fetches the available optimizer rules.
1388
+ *
1389
+ * @example
1390
+ * ```js
1391
+ * const db = new Database();
1392
+ * const rules = await db.queryRules();
1393
+ * for (const rule of rules) {
1394
+ * console.log(rule.name);
1395
+ * }
1396
+ * ```
1397
+ */
1398
+ queryRules() {
1399
+ return this.request({
1400
+ path: "/_api/query/rules",
1401
+ });
1409
1402
  }
1410
1403
  queryTracking(options) {
1411
1404
  return this.request(options
@@ -1417,12 +1410,12 @@ class Database {
1417
1410
  : {
1418
1411
  method: "GET",
1419
1412
  path: "/_api/query/properties",
1420
- }, (res) => res.body);
1413
+ });
1421
1414
  }
1422
1415
  /**
1423
1416
  * Fetches a list of information for all currently running queries.
1424
1417
  *
1425
- * See also {@link Database.listSlowQueries} and {@link Database.killQuery}.
1418
+ * See also {@link Database#listSlowQueries} and {@link Database#killQuery}.
1426
1419
  *
1427
1420
  * @example
1428
1421
  * ```js
@@ -1434,13 +1427,13 @@ class Database {
1434
1427
  return this.request({
1435
1428
  method: "GET",
1436
1429
  path: "/_api/query/current",
1437
- }, (res) => res.body);
1430
+ });
1438
1431
  }
1439
1432
  /**
1440
1433
  * Fetches a list of information for all recent slow queries.
1441
1434
  *
1442
- * See also {@link Database.listRunningQueries} and
1443
- * {@link Database.clearSlowQueries}.
1435
+ * See also {@link Database#listRunningQueries} and
1436
+ * {@link Database#clearSlowQueries}.
1444
1437
  *
1445
1438
  * @example
1446
1439
  * ```js
@@ -1453,12 +1446,12 @@ class Database {
1453
1446
  return this.request({
1454
1447
  method: "GET",
1455
1448
  path: "/_api/query/slow",
1456
- }, (res) => res.body);
1449
+ });
1457
1450
  }
1458
1451
  /**
1459
1452
  * Clears the list of recent slow queries.
1460
1453
  *
1461
- * See also {@link Database.listSlowQueries}.
1454
+ * See also {@link Database#listSlowQueries}.
1462
1455
  *
1463
1456
  * @example
1464
1457
  * ```js
@@ -1476,7 +1469,7 @@ class Database {
1476
1469
  /**
1477
1470
  * Kills a running query with the given `queryId`.
1478
1471
  *
1479
- * See also {@link Database.listRunningQueries}.
1472
+ * See also {@link Database#listRunningQueries}.
1480
1473
  *
1481
1474
  * @param queryId - The ID of a currently running query.
1482
1475
  *
@@ -1550,7 +1543,7 @@ class Database {
1550
1543
  method: "POST",
1551
1544
  path: "/_api/aqlfunction",
1552
1545
  body: { name, code, isDeterministic },
1553
- }, (res) => res.body);
1546
+ });
1554
1547
  }
1555
1548
  /**
1556
1549
  * Deletes the AQL user function with the given name from the database.
@@ -1572,7 +1565,7 @@ class Database {
1572
1565
  method: "DELETE",
1573
1566
  path: `/_api/aqlfunction/${encodeURIComponent(name)}`,
1574
1567
  qs: { group },
1575
- }, (res) => res.body);
1568
+ });
1576
1569
  }
1577
1570
  //#endregion
1578
1571
  //#region services
@@ -1597,7 +1590,7 @@ class Database {
1597
1590
  return this.request({
1598
1591
  path: "/_api/foxx",
1599
1592
  qs: { excludeSystem },
1600
- }, (res) => res.body);
1593
+ });
1601
1594
  }
1602
1595
  /**
1603
1596
  * Installs a new service.
@@ -1633,7 +1626,7 @@ class Database {
1633
1626
  */
1634
1627
  async installService(mount, source, options = {}) {
1635
1628
  const { configuration, dependencies, ...qs } = options;
1636
- const req = await multipart_1.toForm({
1629
+ const req = await (0, multipart_1.toForm)({
1637
1630
  configuration,
1638
1631
  dependencies,
1639
1632
  source,
@@ -1644,7 +1637,7 @@ class Database {
1644
1637
  path: "/_api/foxx",
1645
1638
  isBinary: true,
1646
1639
  qs: { ...qs, mount },
1647
- }, (res) => res.body);
1640
+ });
1648
1641
  }
1649
1642
  /**
1650
1643
  * Replaces an existing service with a new service by completely removing the
@@ -1681,7 +1674,7 @@ class Database {
1681
1674
  */
1682
1675
  async replaceService(mount, source, options = {}) {
1683
1676
  const { configuration, dependencies, ...qs } = options;
1684
- const req = await multipart_1.toForm({
1677
+ const req = await (0, multipart_1.toForm)({
1685
1678
  configuration,
1686
1679
  dependencies,
1687
1680
  source,
@@ -1692,7 +1685,7 @@ class Database {
1692
1685
  path: "/_api/foxx/service",
1693
1686
  isBinary: true,
1694
1687
  qs: { ...qs, mount },
1695
- }, (res) => res.body);
1688
+ });
1696
1689
  }
1697
1690
  /**
1698
1691
  * Replaces an existing service with a new service while retaining the old
@@ -1729,7 +1722,7 @@ class Database {
1729
1722
  */
1730
1723
  async upgradeService(mount, source, options = {}) {
1731
1724
  const { configuration, dependencies, ...qs } = options;
1732
- const req = await multipart_1.toForm({
1725
+ const req = await (0, multipart_1.toForm)({
1733
1726
  configuration,
1734
1727
  dependencies,
1735
1728
  source,
@@ -1740,7 +1733,7 @@ class Database {
1740
1733
  path: "/_api/foxx/service",
1741
1734
  isBinary: true,
1742
1735
  qs: { ...qs, mount },
1743
- }, (res) => res.body);
1736
+ });
1744
1737
  }
1745
1738
  /**
1746
1739
  * Completely removes a service from the database.
@@ -1777,118 +1770,51 @@ class Database {
1777
1770
  return this.request({
1778
1771
  path: "/_api/foxx/service",
1779
1772
  qs: { mount },
1780
- }, (res) => res.body);
1773
+ });
1781
1774
  }
1782
- async getServiceConfiguration(mount, minimal = false) {
1783
- const result = await this.request({
1775
+ getServiceConfiguration(mount, minimal = false) {
1776
+ return this.request({
1784
1777
  path: "/_api/foxx/configuration",
1785
1778
  qs: { mount, minimal },
1786
- }, (res) => res.body);
1787
- if (!minimal ||
1788
- !Object.keys(result).every((key) => result[key].title)) {
1789
- return result;
1790
- }
1791
- const values = {};
1792
- for (const key of Object.keys(result)) {
1793
- values[key] = result[key].current;
1794
- }
1795
- return values;
1779
+ });
1796
1780
  }
1797
- async replaceServiceConfiguration(mount, cfg, minimal = false) {
1798
- const result = await this.request({
1781
+ replaceServiceConfiguration(mount, cfg, minimal = false) {
1782
+ return this.request({
1799
1783
  method: "PUT",
1800
1784
  path: "/_api/foxx/configuration",
1801
1785
  body: cfg,
1802
1786
  qs: { mount, minimal },
1803
- }, (res) => res.body);
1804
- if (minimal ||
1805
- !result.values ||
1806
- !Object.keys(result.values).every((key) => result.values[key].title)) {
1807
- return result;
1808
- }
1809
- const result2 = (await this.getServiceConfiguration(mount, false));
1810
- if (result.warnings) {
1811
- for (const key of Object.keys(result2)) {
1812
- result2[key].warning = result.warnings[key];
1813
- }
1814
- }
1815
- return result2;
1787
+ });
1816
1788
  }
1817
- async updateServiceConfiguration(mount, cfg, minimal = false) {
1818
- const result = await this.request({
1789
+ updateServiceConfiguration(mount, cfg, minimal = false) {
1790
+ return this.request({
1819
1791
  method: "PATCH",
1820
1792
  path: "/_api/foxx/configuration",
1821
1793
  body: cfg,
1822
1794
  qs: { mount, minimal },
1823
- }, (res) => res.body);
1824
- if (minimal ||
1825
- !result.values ||
1826
- !Object.keys(result.values).every((key) => result.values[key].title)) {
1827
- return result;
1828
- }
1829
- const result2 = (await this.getServiceConfiguration(mount, false));
1830
- if (result.warnings) {
1831
- for (const key of Object.keys(result2)) {
1832
- result2[key].warning = result.warnings[key];
1833
- }
1834
- }
1835
- return result2;
1795
+ });
1836
1796
  }
1837
- async getServiceDependencies(mount, minimal = false) {
1838
- const result = await this.request({
1797
+ getServiceDependencies(mount, minimal = false) {
1798
+ return this.request({
1839
1799
  path: "/_api/foxx/dependencies",
1840
1800
  qs: { mount, minimal },
1841
- }, (res) => res.body);
1842
- if (!minimal ||
1843
- !Object.keys(result).every((key) => result[key].title))
1844
- return result;
1845
- const values = {};
1846
- for (const key of Object.keys(result)) {
1847
- values[key] = result[key].current;
1848
- }
1849
- return values;
1801
+ });
1850
1802
  }
1851
- async replaceServiceDependencies(mount, deps, minimal = false) {
1852
- const result = await this.request({
1803
+ replaceServiceDependencies(mount, deps, minimal = false) {
1804
+ return this.request({
1853
1805
  method: "PUT",
1854
1806
  path: "/_api/foxx/dependencies",
1855
1807
  body: deps,
1856
1808
  qs: { mount, minimal },
1857
- }, (res) => res.body);
1858
- if (minimal ||
1859
- !result.values ||
1860
- !Object.keys(result.values).every((key) => result.values[key].title)) {
1861
- return result;
1862
- }
1863
- // Work around "minimal" flag not existing in 3.3
1864
- const result2 = (await this.getServiceDependencies(mount, false));
1865
- if (result.warnings) {
1866
- for (const key of Object.keys(result2)) {
1867
- result2[key].warning = result.warnings[key];
1868
- }
1869
- }
1870
- return result2;
1809
+ });
1871
1810
  }
1872
- async updateServiceDependencies(mount, deps, minimal = false) {
1873
- const result = await this.request({
1811
+ updateServiceDependencies(mount, deps, minimal = false) {
1812
+ return this.request({
1874
1813
  method: "PATCH",
1875
1814
  path: "/_api/foxx/dependencies",
1876
1815
  body: deps,
1877
1816
  qs: { mount, minimal },
1878
- }, (res) => res.body);
1879
- if (minimal ||
1880
- !result.values ||
1881
- !Object.keys(result.values).every((key) => result.values[key].title)) {
1882
- return result;
1883
- }
1884
- // Work around "minimal" flag not existing in 3.3
1885
- const result2 = (await this.getServiceDependencies(mount, false));
1886
- if (result.warnings) {
1887
- for (const key of Object.keys(result2)) {
1888
- result2[key].warning = result.warnings[key];
1889
- }
1890
- }
1891
- return result2;
1817
+ });
1892
1818
  }
1893
1819
  /**
1894
1820
  * Enables or disables development mode for the given service.
@@ -1910,7 +1836,7 @@ class Database {
1910
1836
  method: enabled ? "POST" : "DELETE",
1911
1837
  path: "/_api/foxx/development",
1912
1838
  qs: { mount },
1913
- }, (res) => res.body);
1839
+ });
1914
1840
  }
1915
1841
  /**
1916
1842
  * Retrieves a list of scripts defined in the service manifest's "scripts"
@@ -1931,7 +1857,7 @@ class Database {
1931
1857
  return this.request({
1932
1858
  path: "/_api/foxx/scripts",
1933
1859
  qs: { mount },
1934
- }, (res) => res.body);
1860
+ });
1935
1861
  }
1936
1862
  /**
1937
1863
  * Executes a service script and retrieves its result exposed as
@@ -1963,7 +1889,7 @@ class Database {
1963
1889
  path: `/_api/foxx/scripts/${encodeURIComponent(name)}`,
1964
1890
  body: params,
1965
1891
  qs: { mount },
1966
- }, (res) => res.body);
1892
+ });
1967
1893
  }
1968
1894
  runServiceTests(mount, options) {
1969
1895
  return this.request({
@@ -1973,7 +1899,7 @@ class Database {
1973
1899
  ...options,
1974
1900
  mount,
1975
1901
  },
1976
- }, (res) => res.body);
1902
+ });
1977
1903
  }
1978
1904
  /**
1979
1905
  * Retrieves the text content of the service's `README` or `README.md` file.
@@ -1994,7 +1920,7 @@ class Database {
1994
1920
  return this.request({
1995
1921
  path: "/_api/foxx/readme",
1996
1922
  qs: { mount },
1997
- }, (res) => res.body);
1923
+ });
1998
1924
  }
1999
1925
  /**
2000
1926
  * Retrieves an Open API compatible Swagger API description object for the
@@ -2013,7 +1939,7 @@ class Database {
2013
1939
  return this.request({
2014
1940
  path: "/_api/foxx/swagger",
2015
1941
  qs: { mount },
2016
- }, (res) => res.body);
1942
+ });
2017
1943
  }
2018
1944
  /**
2019
1945
  * Retrieves a zip bundle containing the service files.
@@ -2034,7 +1960,7 @@ class Database {
2034
1960
  path: "/_api/foxx/download",
2035
1961
  qs: { mount },
2036
1962
  expectBinary: true,
2037
- }, (res) => res.body);
1963
+ });
2038
1964
  }
2039
1965
  /**
2040
1966
  * Writes all locally available services to the database and updates any