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/collection.d.ts CHANGED
@@ -12,11 +12,12 @@
12
12
  *
13
13
  * @packageDocumentation
14
14
  */
15
- import { ArangoResponseMetadata, Dict } from "./connection";
15
+ import { AqlLiteral, AqlQuery } from "./aql";
16
+ import { ArangoApiResponse } from "./connection";
16
17
  import { ArrayCursor } from "./cursor";
17
18
  import { Database } from "./database";
18
19
  import { Document, DocumentData, DocumentMetadata, DocumentSelector, Edge, EdgeData, ObjectWithKey, Patch } from "./documents";
19
- import { EnsureFulltextIndexOptions, EnsureGeoIndexOptions, EnsureHashIndexOptions, EnsurePersistentIndexOptions, EnsureSkiplistIndexOptions, EnsureTtlIndexOptions, EnsureZkdIndexOptions, FulltextIndex, GeoIndex, HashIndex, Index, IndexSelector, PersistentIndex, SkiplistIndex, TtlIndex, ZkdIndex } from "./indexes";
20
+ import { EnsureFulltextIndexOptions, EnsureGeoIndexOptions, EnsureInvertedIndexOptions, EnsurePersistentIndexOptions, EnsureTtlIndexOptions, EnsureZkdIndexOptions, FulltextIndex, GeoIndex, Index, IndexSelector, InvertedIndex, PersistentIndex, TtlIndex, ZkdIndex } from "./indexes";
20
21
  import { Blob } from "./lib/blob";
21
22
  /**
22
23
  * Indicates whether the given value represents an {@link ArangoCollection}.
@@ -35,7 +36,7 @@ export declare function collectionToString(collection: string | ArangoCollection
35
36
  * A marker interface identifying objects that can be used in AQL template
36
37
  * strings to create references to ArangoDB collections.
37
38
  *
38
- * See {@link aql}.
39
+ * See {@link aql!aql}.
39
40
  */
40
41
  export interface ArangoCollection {
41
42
  /**
@@ -74,11 +75,11 @@ export declare type KeyGenerator = "traditional" | "autoincrement" | "uuid" | "p
74
75
  /**
75
76
  * Strategy for sharding a collection.
76
77
  */
77
- export declare type ShardingStrategy = "hash" | "enterprise-hash-smart-edge" | "community-compat" | "enterprise-compat" | "enterprise-smart-edge-compat";
78
+ export declare type ShardingStrategy = "hash" | "enterprise-hash-smart-edge" | "enterprise-hash-smart-vertex" | "community-compat" | "enterprise-compat" | "enterprise-smart-edge-compat";
78
79
  /**
79
80
  * Type of document reference.
80
81
  *
81
- * See {@link DocumentCollection.list} and {@link EdgeCollection.list}.
82
+ * See {@link DocumentCollection#list} and {@link EdgeCollection#list}.
82
83
  *
83
84
  * @deprecated Simple Queries have been deprecated in ArangoDB 3.4 and can be
84
85
  * replaced with AQL queries.
@@ -94,6 +95,43 @@ export declare type SimpleQueryListType = "id" | "key" | "path";
94
95
  * * `"strict"`: New and modified documents are always validated.
95
96
  */
96
97
  export declare type ValidationLevel = "none" | "new" | "moderate" | "strict";
98
+ /**
99
+ * Write operation that can result in a computed value being computed.
100
+ */
101
+ export declare type WriteOperation = "insert" | "update" | "replace";
102
+ /**
103
+ * Properties defining a computed value.
104
+ */
105
+ export declare type ComputedValueProperties = {
106
+ /**
107
+ * Name of the target attribute of the computed value.
108
+ */
109
+ name: string;
110
+ /**
111
+ * AQL `RETURN` expression that computes the value.
112
+ */
113
+ expression: string;
114
+ /**
115
+ * If set to `false`, the computed value will not be applied if the
116
+ * expression evaluates to `null`.
117
+ */
118
+ overwrite: boolean;
119
+ /**
120
+ * Which operations should result in the value being computed.
121
+ */
122
+ computeOn: WriteOperation[];
123
+ /**
124
+ * If set to `false`, the field will be unset if the expression evaluates to
125
+ * `null`. Otherwise the field will be set to the value `null`. Has no effect
126
+ * if `overwrite` is set to `false`.
127
+ */
128
+ keepNull: boolean;
129
+ /**
130
+ * Whether the write operation should fail if the expression produces a
131
+ * warning.
132
+ */
133
+ failOnWarning: boolean;
134
+ };
97
135
  /**
98
136
  * General information about a collection.
99
137
  */
@@ -192,12 +230,6 @@ export declare type CollectionProperties = {
192
230
  * (Cluster only.) Write concern for this collection.
193
231
  */
194
232
  writeConcern: number;
195
- /**
196
- * (Cluster only.) Write concern for this collection.
197
- *
198
- * @deprecated Renamed to `writeConcern` in ArangoDB 3.6.
199
- */
200
- minReplicationFactor?: number;
201
233
  /**
202
234
  * (Cluster only.) Number of shards of this collection.
203
235
  */
@@ -210,48 +242,90 @@ export declare type CollectionProperties = {
210
242
  /**
211
243
  * (Cluster only.) Replication factor of the collection.
212
244
  */
213
- replicationFactor?: number;
245
+ replicationFactor?: number | "satellite";
214
246
  /**
215
247
  * (Cluster only.) Sharding strategy of the collection.
216
248
  */
217
249
  shardingStrategy?: ShardingStrategy;
218
250
  /**
219
- * (MMFiles only.) Whether the collection will be compacted.
220
- *
221
- * @deprecated The MMFiles storage engine was removed in ArangoDB 3.7.
251
+ * (Enterprise Edition cluster only.) If set to a collection name, sharding
252
+ * of the new collection will follow the rules for that collection. As long
253
+ * as the new collection exists, the indicated collection can not be dropped.
254
+ */
255
+ distributeShardsLike?: string;
256
+ /**
257
+ * (Enterprise Edition cluster only.) Attribute containing the shard key
258
+ * value of the referred-to smart join collection.
222
259
  */
223
- doCompact?: boolean;
260
+ smartJoinAttribute?: string;
224
261
  /**
225
- * (MMFiles only.) Maximum size for each journal or datafile in bytes.
262
+ * (Enterprise Edition cluster only.) Attribute used for sharding.
263
+ */
264
+ smartGraphAttribute?: string;
265
+ /**
266
+ * Computed values applied to documents in this collection.
267
+ */
268
+ computedValues: ComputedValueProperties[];
269
+ /**
270
+ * Whether the in-memory hash cache is enabled for this collection.
271
+ */
272
+ cacheEnabled: boolean;
273
+ /**
274
+ * Whether the newer revision-based replication protocol is enabled for
275
+ * this collection.
276
+ */
277
+ syncByRevision: boolean;
278
+ /**
279
+ * (Enterprise Edition only.) Whether the collection is used in a SmartGraph or EnterpriseGraph.
280
+ */
281
+ isSmart?: boolean;
282
+ /**
283
+ * (Enterprise Edition only.) Whether the SmartGraph this collection belongs to is disjoint.
284
+ */
285
+ isDisjoint?: string;
286
+ };
287
+ /**
288
+ * Options for creating a computed value.
289
+ */
290
+ export declare type ComputedValueOptions = {
291
+ /**
292
+ * Name of the target attribute of the computed value.
293
+ */
294
+ name: string;
295
+ /**
296
+ * AQL `RETURN` expression that computes the value.
226
297
  *
227
- * @deprecated The MMFiles storage engine was removed in ArangoDB 3.7.
298
+ * Note that when passing an AQL query object, the `bindVars` will be ignored.
228
299
  */
229
- journalSize?: number;
300
+ expression: string | AqlLiteral | AqlQuery;
230
301
  /**
231
- * (MMFiles only.) Number of buckets into which indexes using hash tables are
232
- * split.
302
+ * If set to `false`, the computed value will not be applied if the
303
+ * expression evaluates to `null`.
233
304
  *
234
- * @deprecated The MMFiles storage engine was removed in ArangoDB 3.7.
305
+ * Default: `true`
235
306
  */
236
- indexBuckets?: number;
307
+ overwrite?: boolean;
237
308
  /**
238
- * (MMFiles only.) If set to `true`, the collection will only be kept
239
- * in-memory and discarded when unloaded, resulting in full data loss.
309
+ * Which operations should result in the value being computed.
240
310
  *
241
- * @deprecated The MMFiles storage engine was removed in ArangoDB 3.7.
311
+ * Default: `["insert", "update", "replace"]`
242
312
  */
243
- isVolatile?: boolean;
313
+ computeOn?: WriteOperation[];
244
314
  /**
245
- * (Enterprise Edition cluster only.) If set to a collection name, sharding
246
- * of the new collection will follow the rules for that collection. As long
247
- * as the new collection exists, the indicated collection can not be dropped.
315
+ * If set to `false`, the field will be unset if the expression evaluates to
316
+ * `null`. Otherwise the field will be set to the value `null`. Has no effect
317
+ * if `overwrite` is set to `false`.
318
+ *
319
+ * Default: `true`
248
320
  */
249
- distributeShardsLike?: string;
321
+ keepNull?: boolean;
250
322
  /**
251
- * (Enterprise Edition cluster only.) Attribute containing the shard key
252
- * value of the referred-to smart join collection.
323
+ * Whether the write operation should fail if the expression produces a
324
+ * warning.
325
+ *
326
+ * Default: `false`
253
327
  */
254
- smartJoinAttribute?: string;
328
+ failOnWarning?: boolean;
255
329
  };
256
330
  /**
257
331
  * Options for validating collection documents.
@@ -275,7 +349,7 @@ export declare type SchemaOptions = {
275
349
  /**
276
350
  * Options for setting a collection's properties.
277
351
  *
278
- * See {@link DocumentCollection.properties} and {@link EdgeCollection.properties}.
352
+ * See {@link DocumentCollection#properties} and {@link EdgeCollection#properties}.
279
353
  */
280
354
  export declare type CollectionPropertiesOptions = {
281
355
  /**
@@ -283,18 +357,31 @@ export declare type CollectionPropertiesOptions = {
283
357
  * a document create, update, replace or removal operation.
284
358
  */
285
359
  waitForSync?: boolean;
360
+ /**
361
+ * (Cluster only.) How many copies of each document should be kept in the
362
+ * cluster.
363
+ *
364
+ * Default: `1`
365
+ */
366
+ replicationFactor?: number | "satellite";
367
+ /**
368
+ * (Cluster only.) Write concern for this collection.
369
+ */
370
+ writeConcern?: number;
286
371
  /**
287
372
  * Options for validating documents in this collection.
288
373
  */
289
374
  schema?: SchemaOptions;
290
375
  /**
291
- * (MMFiles only.) Maximum size for each journal or datafile in bytes.
292
- *
293
- * Must be a number greater than or equal to `1048576` (1 MiB).
376
+ * Computed values to apply to documents in this collection.
377
+ */
378
+ computedValues?: ComputedValueOptions[];
379
+ /**
380
+ * Whether the in-memory hash cache is enabled for this collection.
294
381
  *
295
- * @deprecated The MMFiles storage engine was removed in ArangoDB 3.7.
382
+ * Default: `false`
296
383
  */
297
- journalSize?: number;
384
+ cacheEnabled?: boolean;
298
385
  };
299
386
  /**
300
387
  * Options for retrieving a collection checksum.
@@ -355,8 +442,8 @@ export declare type CollectionKeyOptions = {
355
442
  /**
356
443
  * Options for creating a collection.
357
444
  *
358
- * See {@link Database.createCollection}, {@link Database.createEdgeCollection}
359
- * and {@link DocumentCollection.create} or {@link EdgeCollection.create}.
445
+ * See {@link database.Database#createCollection}, {@link database.Database#createEdgeCollection}
446
+ * and {@link DocumentCollection#create} or {@link EdgeCollection#create}.
360
447
  */
361
448
  export declare type CreateCollectionOptions = {
362
449
  /**
@@ -420,63 +507,48 @@ export declare type CreateCollectionOptions = {
420
507
  * (Cluster only.) Write concern for this collection.
421
508
  */
422
509
  writeConcern?: number;
423
- /**
424
- * (Cluster only.) Write concern for this collection.
425
- *
426
- * @deprecated Renamed to `writeConcern` in ArangoDB 3.6.
427
- */
428
- minReplicationFactor?: number;
429
510
  /**
430
511
  * (Cluster only.) Sharding strategy to use.
431
512
  */
432
513
  shardingStrategy?: ShardingStrategy;
433
514
  /**
434
- * (MMFiles only.) Number of buckets into which indexes using hash tables are
435
- * split.
436
- *
437
- * Must be a power of 2 and less than or equal to `1024`.
438
- *
439
- * Default: `16`
440
- *
441
- * @deprecated The MMFiles storage engine was removed in ArangoDB 3.7.
515
+ * (Enterprise Edition cluster only.) If set to a collection name, sharding
516
+ * of the new collection will follow the rules for that collection. As long
517
+ * as the new collection exists, the indicated collection can not be dropped.
442
518
  */
443
- indexBuckets?: number;
519
+ distributeShardsLike?: string;
444
520
  /**
445
- * (MMFiles only.) Whether the collection will be compacted.
446
- *
447
- * Default: `true`
448
- *
449
- * @deprecated The MMFiles storage engine was removed in ArangoDB 3.7.
521
+ * (Enterprise Edition cluster only.) Attribute containing the shard key
522
+ * value of the referred-to smart join collection.
450
523
  */
451
- doCompact?: boolean;
524
+ smartJoinAttribute?: string;
452
525
  /**
453
- * (MMFiles only.) Maximum size for each journal or datafile in bytes.
454
- *
455
- * Must be a number greater than or equal to `1048576` (1 MiB).
456
- *
457
- * @deprecated The MMFiles storage engine was removed in ArangoDB 3.7.
526
+ * (Enterprise Edition cluster only.) Attribute used for sharding.
458
527
  */
459
- journalSize?: number;
528
+ smartGraphAttribute?: string;
460
529
  /**
461
- * (MMFiles only.) If set to `true`, the collection will only be kept
462
- * in-memory and discarded when unloaded, resulting in full data loss.
463
- *
464
- * Default: `false`
465
- *
466
- * @deprecated The MMFiles storage engine was removed in ArangoDB 3.7.
530
+ * Computed values to apply to documents in this collection.
467
531
  */
468
- isVolatile?: boolean;
532
+ computedValues?: ComputedValueOptions[];
469
533
  /**
470
- * (Enterprise Edition cluster only.) If set to a collection name, sharding
471
- * of the new collection will follow the rules for that collection. As long
472
- * as the new collection exists, the indicated collection can not be dropped.
534
+ * Whether the in-memory hash cache is enabled for this collection.
473
535
  */
474
- distributeShardsLike?: string;
536
+ cacheEnabled?: boolean;
537
+ };
538
+ /**
539
+ * Options for checking whether a document exists in a collection.
540
+ */
541
+ export declare type DocumentExistsOptions = {
475
542
  /**
476
- * (Enterprise Edition cluster only.) Attribute containing the shard key
477
- * value of the referred-to smart join collection.
543
+ * If set to a document revision, the document will only match if its `_rev`
544
+ * matches the given revision.
478
545
  */
479
- smartJoinAttribute?: string;
546
+ ifMatch?: string;
547
+ /**
548
+ * If set to a document revision, the document will only match if its `_rev`
549
+ * does not match the given revision.
550
+ */
551
+ ifNoneMatch?: string;
480
552
  };
481
553
  /**
482
554
  * Options for retrieving a document from a collection.
@@ -493,6 +565,17 @@ export declare type CollectionReadOptions = {
493
565
  * request without distinguishing between leaders and followers.
494
566
  */
495
567
  allowDirtyRead?: boolean;
568
+ /**
569
+ * If set to a document revision, the request will fail with an error if the
570
+ * document exists but its `_rev` does not match the given revision.
571
+ */
572
+ ifMatch?: string;
573
+ /**
574
+ * If set to a document revision, the request will fail with an error if the
575
+ * document exists and its `_rev` matches the given revision. Note that an
576
+ * `HttpError` with code 304 will be thrown instead of an `ArangoError`.
577
+ */
578
+ ifNoneMatch?: string;
496
579
  };
497
580
  /**
498
581
  * Options for retrieving multiple documents from a collection.
@@ -529,14 +612,6 @@ export declare type CollectionInsertOptions = {
529
612
  * Default: `false`
530
613
  */
531
614
  returnNew?: boolean;
532
- /**
533
- * If set to `true`, a document with the same `_key` or `_id` already
534
- * existing will be overwritten instead of resulting in an exception.
535
- *
536
- * @deprecated This option has been deprecated in ArangoDB 3.7 and replaced
537
- * with the `overwriteMode` option.
538
- */
539
- overwrite?: boolean;
540
615
  /**
541
616
  * Defines what should happen if a document with the same `_key` or `_id`
542
617
  * already exists, instead of throwing an exception.
@@ -583,6 +658,11 @@ export declare type CollectionReplaceOptions = {
583
658
  * Default: `false`
584
659
  */
585
660
  returnOld?: boolean;
661
+ /**
662
+ * If set to a document revision, the document will only be replaced if its
663
+ * `_rev` matches the given revision.
664
+ */
665
+ ifMatch?: string;
586
666
  };
587
667
  /**
588
668
  * Options for updating a document in a collection.
@@ -637,6 +717,11 @@ export declare type CollectionUpdateOptions = {
637
717
  * Default: `true`
638
718
  */
639
719
  mergeObjects?: boolean;
720
+ /**
721
+ * If set to a document revision, the document will only be updated if its
722
+ * `_rev` matches the given revision.
723
+ */
724
+ ifMatch?: string;
640
725
  };
641
726
  /**
642
727
  * Options for removing a document from a collection.
@@ -662,6 +747,11 @@ export declare type CollectionRemoveOptions = {
662
747
  * Default: `false`
663
748
  */
664
749
  silent?: boolean;
750
+ /**
751
+ * If set to a document revision, the document will only be removed if its
752
+ * `_rev` matches the given revision.
753
+ */
754
+ ifMatch?: string;
665
755
  };
666
756
  /**
667
757
  * Options for bulk importing documents into a collection.
@@ -707,6 +797,17 @@ export declare type CollectionImportOptions = {
707
797
  */
708
798
  details?: boolean;
709
799
  };
800
+ /**
801
+ * Options for retrieving a document's edges from a collection.
802
+ */
803
+ export declare type CollectionEdgesOptions = {
804
+ /**
805
+ * If set to `true`, the request will explicitly permit ArangoDB to return a
806
+ * potentially dirty or stale result and arangojs will load balance the
807
+ * request without distinguishing between leaders and followers.
808
+ */
809
+ allowDirtyRead?: boolean;
810
+ };
710
811
  /**
711
812
  * Options for retrieving documents by example.
712
813
  *
@@ -728,14 +829,14 @@ export declare type SimpleQueryByExampleOptions = {
728
829
  *
729
830
  * Must be greater than zero.
730
831
  *
731
- * See also {@link QueryOptions}.
832
+ * See also {@link database.QueryOptions}.
732
833
  */
733
834
  batchSize?: number;
734
835
  /**
735
836
  * Time-to-live for the cursor in seconds. The cursor results may be
736
837
  * garbage collected by ArangoDB after this much time has passed.
737
838
  *
738
- * See also {@link QueryOptions}.
839
+ * See also {@link database.QueryOptions}.
739
840
  */
740
841
  ttl?: number;
741
842
  };
@@ -760,20 +861,20 @@ export declare type SimpleQueryAllOptions = {
760
861
  *
761
862
  * Must be greater than zero.
762
863
  *
763
- * See also {@link QueryOptions}.
864
+ * See also {@link database.QueryOptions}.
764
865
  */
765
866
  batchSize?: number;
766
867
  /**
767
868
  * Time-to-live for the cursor in seconds. The cursor results may be
768
869
  * garbage collected by ArangoDB after this much time has passed.
769
870
  *
770
- * See also {@link QueryOptions}.
871
+ * See also {@link database.QueryOptions}.
771
872
  */
772
873
  ttl?: number;
773
874
  /**
774
875
  * If set to `true`, the query will be executed as a streaming query.
775
876
  *
776
- * See also {@link QueryOptions}.
877
+ * See also {@link database.QueryOptions}.
777
878
  */
778
879
  stream?: boolean;
779
880
  };
@@ -905,7 +1006,7 @@ export declare type TraversalOptions = {
905
1006
  * access any other variables.
906
1007
  *
907
1008
  * See the official ArangoDB documentation for
908
- * {@link https://www.arangodb.com/docs/stable/appendix-java-script-modules-arango-db.html | the JavaScript `@arangodb` module}
1009
+ * [the JavaScript `@arangodb` module](https://www.arangodb.com/docs/stable/appendix-java-script-modules-arango-db.html)
909
1010
  * for information about accessing the database from within ArangoDB's
910
1011
  * server-side JavaScript environment.
911
1012
  */
@@ -927,7 +1028,7 @@ export declare type TraversalOptions = {
927
1028
  * access any other variables.
928
1029
  *
929
1030
  * See the official ArangoDB documentation for
930
- * {@link https://www.arangodb.com/docs/stable/appendix-java-script-modules-arango-db.html | the JavaScript `@arangodb` module}
1031
+ * [the JavaScript `@arangodb` module](https://www.arangodb.com/docs/stable/appendix-java-script-modules-arango-db.html)
931
1032
  * for information about accessing the database from within ArangoDB's
932
1033
  * server-side JavaScript environment.
933
1034
  */
@@ -945,7 +1046,7 @@ export declare type TraversalOptions = {
945
1046
  * access any other variables.
946
1047
  *
947
1048
  * See the official ArangoDB documentation for
948
- * {@link https://www.arangodb.com/docs/stable/appendix-java-script-modules-arango-db.html | the JavaScript `@arangodb` module}
1049
+ * [the JavaScript `@arangodb` module](https://www.arangodb.com/docs/stable/appendix-java-script-modules-arango-db.html)
949
1050
  * for information about accessing the database from within ArangoDB's
950
1051
  * server-side JavaScript environment.
951
1052
  */
@@ -963,7 +1064,7 @@ export declare type TraversalOptions = {
963
1064
  * access any other variables.
964
1065
  *
965
1066
  * See the official ArangoDB documentation for
966
- * {@link https://www.arangodb.com/docs/stable/appendix-java-script-modules-arango-db.html | the JavaScript `@arangodb` module}
1067
+ * [the JavaScript `@arangodb` module](https://www.arangodb.com/docs/stable/appendix-java-script-modules-arango-db.html)
967
1068
  * for information about accessing the database from within ArangoDB's
968
1069
  * server-side JavaScript environment.
969
1070
  */
@@ -981,7 +1082,7 @@ export declare type TraversalOptions = {
981
1082
  * access any other variables.
982
1083
  *
983
1084
  * See the official ArangoDB documentation for
984
- * {@link https://www.arangodb.com/docs/stable/appendix-java-script-modules-arango-db.html | the JavaScript `@arangodb` module}
1085
+ * [the JavaScript `@arangodb` module](https://www.arangodb.com/docs/stable/appendix-java-script-modules-arango-db.html)
985
1086
  * for information about accessing the database from within ArangoDB's
986
1087
  * server-side JavaScript environment.
987
1088
  */
@@ -1076,7 +1177,7 @@ export declare type CollectionEdgesResult<T extends Record<string, any> = any> =
1076
1177
  /**
1077
1178
  * Result of removing documents by an example.
1078
1179
  *
1079
- * See {@link DocumentCollection.removeByExample} and {@link EdgeCollection.removeByExample}.
1180
+ * See {@link DocumentCollection#removeByExample} and {@link EdgeCollection#removeByExample}.
1080
1181
  *
1081
1182
  * @deprecated Simple Queries have been deprecated in ArangoDB 3.4 and can be
1082
1183
  * replaced with AQL queries.
@@ -1090,7 +1191,7 @@ export declare type SimpleQueryRemoveByExampleResult = {
1090
1191
  /**
1091
1192
  * Result of replacing documents by an example.
1092
1193
  *
1093
- * See {@link DocumentCollection.replaceByExample} and {@link EdgeCollection.replaceByExample}.
1194
+ * See {@link DocumentCollection#replaceByExample} and {@link EdgeCollection#replaceByExample}.
1094
1195
  *
1095
1196
  * @deprecated Simple Queries have been deprecated in ArangoDB 3.4 and can be
1096
1197
  * replaced with AQL queries.
@@ -1104,7 +1205,7 @@ export declare type SimpleQueryReplaceByExampleResult = {
1104
1205
  /**
1105
1206
  * Result of updating documents by an example.
1106
1207
  *
1107
- * See {@link DocumentCollection.updateByExample} and {@link EdgeCollection.updateByExample}.
1208
+ * See {@link DocumentCollection#updateByExample} and {@link EdgeCollection#updateByExample}.
1108
1209
  *
1109
1210
  * @deprecated Simple Queries have been deprecated in ArangoDB 3.4 and can be
1110
1211
  * replaced with AQL queries.
@@ -1118,7 +1219,7 @@ export declare type SimpleQueryUpdateByExampleResult = {
1118
1219
  /**
1119
1220
  * Result of removing documents by keys.
1120
1221
  *
1121
- * See {@link DocumentCollection.removeByKeys} and {@link EdgeCollection.removeByKeys}.
1222
+ * See {@link DocumentCollection#removeByKeys} and {@link EdgeCollection#removeByKeys}.
1122
1223
  *
1123
1224
  * @deprecated Simple Queries have been deprecated in ArangoDB 3.4 and can be
1124
1225
  * replaced with AQL queries.
@@ -1138,7 +1239,7 @@ export declare type SimpleQueryRemoveByKeysResult<T extends Record<string, any>
1138
1239
  old?: DocumentMetadata[] | Document<T>[];
1139
1240
  };
1140
1241
  /**
1141
- * Represents an document collection in a {@link Database}.
1242
+ * Represents an document collection in a {@link database.Database}.
1142
1243
  *
1143
1244
  * See {@link EdgeCollection} for a variant of this interface more suited for
1144
1245
  * edge collections.
@@ -1181,12 +1282,12 @@ export interface DocumentCollection<T extends Record<string, any> = any> extends
1181
1282
  * // data contains general information about the collection
1182
1283
  * ```
1183
1284
  */
1184
- get(): Promise<ArangoResponseMetadata & CollectionMetadata>;
1285
+ get(): Promise<ArangoApiResponse<CollectionMetadata>>;
1185
1286
  /**
1186
1287
  * Creates a collection with the given `options` and the instance's name.
1187
1288
  *
1188
- * See also {@link Database.createCollection} and
1189
- * {@link Database.createEdgeCollection}.
1289
+ * See also {@link database.Database#createCollection} and
1290
+ * {@link database.Database#createEdgeCollection}.
1190
1291
  *
1191
1292
  * **Note**: When called on an {@link EdgeCollection} instance in TypeScript,
1192
1293
  * the `type` option must still be set to the correct {@link CollectionType}.
@@ -1227,7 +1328,7 @@ export interface DocumentCollection<T extends Record<string, any> = any> extends
1227
1328
  */
1228
1329
  create(options?: CreateCollectionOptions & {
1229
1330
  type?: CollectionType;
1230
- }): Promise<ArangoResponseMetadata & CollectionMetadata & CollectionProperties>;
1331
+ }): Promise<ArangoApiResponse<CollectionMetadata & CollectionProperties>>;
1231
1332
  /**
1232
1333
  * Retrieves the collection's properties.
1233
1334
  *
@@ -1239,7 +1340,7 @@ export interface DocumentCollection<T extends Record<string, any> = any> extends
1239
1340
  * // data contains the collection's properties
1240
1341
  * ```
1241
1342
  */
1242
- properties(): Promise<ArangoResponseMetadata & CollectionMetadata & CollectionProperties>;
1343
+ properties(): Promise<ArangoApiResponse<CollectionMetadata & CollectionProperties>>;
1243
1344
  /**
1244
1345
  * Replaces the properties of the collection.
1245
1346
  *
@@ -1252,7 +1353,7 @@ export interface DocumentCollection<T extends Record<string, any> = any> extends
1252
1353
  * // whenever a document is changed
1253
1354
  * ```
1254
1355
  */
1255
- properties(properties: CollectionPropertiesOptions): Promise<ArangoResponseMetadata & CollectionMetadata & CollectionProperties>;
1356
+ properties(properties: CollectionPropertiesOptions): Promise<ArangoApiResponse<CollectionMetadata & CollectionProperties>>;
1256
1357
  /**
1257
1358
  * Retrieves information about the number of documents in a collection.
1258
1359
  *
@@ -1264,9 +1365,9 @@ export interface DocumentCollection<T extends Record<string, any> = any> extends
1264
1365
  * // data contains the collection's count
1265
1366
  * ```
1266
1367
  */
1267
- count(): Promise<ArangoResponseMetadata & CollectionMetadata & CollectionProperties & {
1368
+ count(): Promise<ArangoApiResponse<CollectionMetadata & CollectionProperties & {
1268
1369
  count: number;
1269
- }>;
1370
+ }>>;
1270
1371
  /**
1271
1372
  * (RocksDB only.) Instructs ArangoDB to recalculate the collection's
1272
1373
  * document count to fix any inconsistencies.
@@ -1297,10 +1398,10 @@ export interface DocumentCollection<T extends Record<string, any> = any> extends
1297
1398
  * // data contains the collection's figures
1298
1399
  * ```
1299
1400
  */
1300
- figures(details?: boolean): Promise<ArangoResponseMetadata & CollectionMetadata & CollectionProperties & {
1401
+ figures(details?: boolean): Promise<ArangoApiResponse<CollectionMetadata & CollectionProperties & {
1301
1402
  count: number;
1302
- figures: Dict<any>;
1303
- }>;
1403
+ figures: Record<string, any>;
1404
+ }>>;
1304
1405
  /**
1305
1406
  * Retrieves the collection revision ID.
1306
1407
  *
@@ -1312,9 +1413,9 @@ export interface DocumentCollection<T extends Record<string, any> = any> extends
1312
1413
  * // data contains the collection's revision
1313
1414
  * ```
1314
1415
  */
1315
- revision(): Promise<ArangoResponseMetadata & CollectionMetadata & CollectionProperties & {
1416
+ revision(): Promise<ArangoApiResponse<CollectionMetadata & CollectionProperties & {
1316
1417
  revision: string;
1317
- }>;
1418
+ }>>;
1318
1419
  /**
1319
1420
  * Retrieves the collection checksum.
1320
1421
  *
@@ -1328,47 +1429,10 @@ export interface DocumentCollection<T extends Record<string, any> = any> extends
1328
1429
  * // data contains the collection's checksum
1329
1430
  * ```
1330
1431
  */
1331
- checksum(options?: CollectionChecksumOptions): Promise<ArangoResponseMetadata & CollectionMetadata & {
1432
+ checksum(options?: CollectionChecksumOptions): Promise<ArangoApiResponse<CollectionMetadata & {
1332
1433
  revision: string;
1333
1434
  checksum: string;
1334
- }>;
1335
- /**
1336
- * (MMFiles only.) Instructs ArangoDB to load the collection into memory.
1337
- *
1338
- * @param count - Whether the number of documents in the collection should
1339
- * be included in the server response. Disabling this may speed up this
1340
- * process in future versions of ArangoDB.
1341
- *
1342
- * @example
1343
- * ```js
1344
- * const db = new Database();
1345
- * const collection = db.collection("some-collection");
1346
- * await collection.load();
1347
- * // the collection has now been loaded into memory
1348
- * ```
1349
- *
1350
- * @deprecated This method was deprecated in ArangoDB 3.8 as it no longer has
1351
- * any effect since the MMFiles storage engine was removed in ArangoDB 3.7.
1352
- */
1353
- load(count?: true): Promise<ArangoResponseMetadata & CollectionMetadata & {
1354
- count: number;
1355
- }>;
1356
- /**
1357
- * Instructs ArangoDB to load the collection into memory.
1358
- *
1359
- * @param count - Whether the number of documents in the collection should
1360
- * be included in the server response. Disabling this may speed up this
1361
- * process in future versions of ArangoDB.
1362
- *
1363
- * @example
1364
- * ```js
1365
- * const db = new Database();
1366
- * const collection = db.collection("some-collection");
1367
- * await collection.load(false);
1368
- * // the collection has now been loaded into memory
1369
- * ```
1370
- */
1371
- load(count: false): Promise<ArangoResponseMetadata & CollectionMetadata>;
1435
+ }>>;
1372
1436
  /**
1373
1437
  * (RocksDB only.) Instructs ArangoDB to load as many indexes of the
1374
1438
  * collection into memory as permitted by the memory limit.
@@ -1382,25 +1446,10 @@ export interface DocumentCollection<T extends Record<string, any> = any> extends
1382
1446
  * ```
1383
1447
  */
1384
1448
  loadIndexes(): Promise<boolean>;
1385
- /**
1386
- * (MMFiles only.) Instructs ArangoDB to remove the collection from memory.
1387
- *
1388
- * @example
1389
- * ```js
1390
- * const db = new Database();
1391
- * const collection = db.collection("some-collection");
1392
- * await collection.unload();
1393
- * // the collection has now been unloaded from memory
1394
- * ```
1395
- *
1396
- * @deprecated This method was deprecated in ArangoDB 3.8 as it no longer has
1397
- * any effect since the MMFiles storage engine was removed in ArangoDB 3.7.
1398
- */
1399
- unload(): Promise<ArangoResponseMetadata & CollectionMetadata>;
1400
1449
  /**
1401
1450
  * Renames the collection and updates the instance's `name` to `newName`.
1402
1451
  *
1403
- * Additionally removes the instance from the {@link Database}'s internal
1452
+ * Additionally removes the instance from the {@link database.Database}'s internal
1404
1453
  * cache.
1405
1454
  *
1406
1455
  * **Note**: Renaming collections may not be supported when ArangoDB is
@@ -1419,20 +1468,7 @@ export interface DocumentCollection<T extends Record<string, any> = any> extends
1419
1468
  * // collection1 and collection3 represent the same ArangoDB collection!
1420
1469
  * ```
1421
1470
  */
1422
- rename(newName: string): Promise<ArangoResponseMetadata & CollectionMetadata>;
1423
- /**
1424
- * (MMFiles single-server only.) Rotates the journal of the collection.
1425
- *
1426
- * @example
1427
- * ```js
1428
- * const db = new Database();
1429
- * const collection = db.collection("some-collection");
1430
- * const rotated = await collection.rotate();
1431
- * ```
1432
- *
1433
- * @deprecated The MMFiles storage engine was removed in ArangoDB 3.7.
1434
- */
1435
- rotate(): Promise<boolean>;
1471
+ rename(newName: string): Promise<ArangoApiResponse<CollectionMetadata>>;
1436
1472
  /**
1437
1473
  * Deletes all documents in the collection.
1438
1474
  *
@@ -1445,7 +1481,7 @@ export interface DocumentCollection<T extends Record<string, any> = any> extends
1445
1481
  * // the collection "some-collection" is now empty
1446
1482
  * ```
1447
1483
  */
1448
- truncate(): Promise<ArangoResponseMetadata & CollectionMetadata>;
1484
+ truncate(): Promise<ArangoApiResponse<CollectionMetadata>>;
1449
1485
  /**
1450
1486
  * Deletes the collection from the database.
1451
1487
  *
@@ -1459,7 +1495,7 @@ export interface DocumentCollection<T extends Record<string, any> = any> extends
1459
1495
  * // The collection "some-collection" is now an ex-collection
1460
1496
  * ```
1461
1497
  */
1462
- drop(options?: CollectionDropOptions): Promise<ArangoResponseMetadata>;
1498
+ drop(options?: CollectionDropOptions): Promise<ArangoApiResponse<Record<string, never>>>;
1463
1499
  /**
1464
1500
  * Retrieves the `shardId` of the shard responsible for the given document.
1465
1501
  *
@@ -1527,7 +1563,7 @@ export interface DocumentCollection<T extends Record<string, any> = any> extends
1527
1563
  * }
1528
1564
  * ```
1529
1565
  */
1530
- documentExists(selector: DocumentSelector): Promise<boolean>;
1566
+ documentExists(selector: DocumentSelector, options?: DocumentExistsOptions): Promise<boolean>;
1531
1567
  /**
1532
1568
  * Retrieves the document matching the given key or id.
1533
1569
  *
@@ -1545,7 +1581,7 @@ export interface DocumentCollection<T extends Record<string, any> = any> extends
1545
1581
  * try {
1546
1582
  * const document = await collection.document("abc123");
1547
1583
  * console.log(document);
1548
- * } catch (e) {
1584
+ * } catch (e: any) {
1549
1585
  * console.error("Could not find document");
1550
1586
  * }
1551
1587
  * ```
@@ -1581,7 +1617,7 @@ export interface DocumentCollection<T extends Record<string, any> = any> extends
1581
1617
  * try {
1582
1618
  * const document = await collection.document("abc123", false);
1583
1619
  * console.log(document);
1584
- * } catch (e) {
1620
+ * } catch (e: any) {
1585
1621
  * console.error("Could not find document");
1586
1622
  * }
1587
1623
  * ```
@@ -1616,7 +1652,7 @@ export interface DocumentCollection<T extends Record<string, any> = any> extends
1616
1652
  * try {
1617
1653
  * const documents = await collection.documents(["abc123", "xyz456"]);
1618
1654
  * console.log(documents);
1619
- * } catch (e) {
1655
+ * } catch (e: any) {
1620
1656
  * console.error("Could not find document");
1621
1657
  * }
1622
1658
  * ```
@@ -1722,7 +1758,7 @@ export interface DocumentCollection<T extends Record<string, any> = any> extends
1722
1758
  _key: string;
1723
1759
  } | {
1724
1760
  _id: string;
1725
- })>, options?: CollectionReplaceOptions): Promise<Array<DocumentMetadata & {
1761
+ })>, options?: Omit<CollectionReplaceOptions, "ifMatch">): Promise<Array<DocumentMetadata & {
1726
1762
  new?: Document<T>;
1727
1763
  old?: Document<T>;
1728
1764
  }>>;
@@ -1782,7 +1818,7 @@ export interface DocumentCollection<T extends Record<string, any> = any> extends
1782
1818
  _key: string;
1783
1819
  } | {
1784
1820
  _id: string;
1785
- })>, options?: CollectionUpdateOptions): Promise<Array<DocumentMetadata & {
1821
+ })>, options?: Omit<CollectionUpdateOptions, "ifMatch">): Promise<Array<DocumentMetadata & {
1786
1822
  new?: Document<T>;
1787
1823
  old?: Document<T>;
1788
1824
  }>>;
@@ -1834,7 +1870,7 @@ export interface DocumentCollection<T extends Record<string, any> = any> extends
1834
1870
  * // document with keys "abc123" and "def456" deleted
1835
1871
  * ```
1836
1872
  */
1837
- removeAll(selectors: DocumentSelector[], options?: CollectionRemoveOptions): Promise<Array<DocumentMetadata & {
1873
+ removeAll(selectors: (string | ObjectWithKey)[], options?: Omit<CollectionRemoveOptions, "ifMatch">): Promise<Array<DocumentMetadata & {
1838
1874
  old?: Document<T>;
1839
1875
  }>>;
1840
1876
  /**
@@ -2094,7 +2130,7 @@ export interface DocumentCollection<T extends Record<string, any> = any> extends
2094
2130
  * const deleted = await cursor.next();
2095
2131
  * ```
2096
2132
  */
2097
- removeByExample(example: Partial<DocumentData<T>>, options?: SimpleQueryRemoveByExampleOptions): Promise<ArangoResponseMetadata & SimpleQueryRemoveByExampleResult>;
2133
+ removeByExample(example: Partial<DocumentData<T>>, options?: SimpleQueryRemoveByExampleOptions): Promise<ArangoApiResponse<SimpleQueryRemoveByExampleResult>>;
2098
2134
  /**
2099
2135
  * Replaces all documents in the collection matching the given example.
2100
2136
  *
@@ -2125,7 +2161,7 @@ export interface DocumentCollection<T extends Record<string, any> = any> extends
2125
2161
  * const replaced = await cursor.next();
2126
2162
  * ```
2127
2163
  */
2128
- replaceByExample(example: Partial<DocumentData<T>>, newValue: DocumentData<T>, options?: SimpleQueryReplaceByExampleOptions): Promise<ArangoResponseMetadata & SimpleQueryReplaceByExampleResult>;
2164
+ replaceByExample(example: Partial<DocumentData<T>>, newValue: DocumentData<T>, options?: SimpleQueryReplaceByExampleOptions): Promise<ArangoApiResponse<SimpleQueryReplaceByExampleResult>>;
2129
2165
  /**
2130
2166
  * Updates all documents in the collection matching the given example.
2131
2167
  *
@@ -2156,7 +2192,7 @@ export interface DocumentCollection<T extends Record<string, any> = any> extends
2156
2192
  * const updated = await cursor.next();
2157
2193
  * ```
2158
2194
  */
2159
- updateByExample(example: Partial<DocumentData<T>>, newValue: Patch<DocumentData<T>>, options?: SimpleQueryUpdateByExampleOptions): Promise<ArangoResponseMetadata & SimpleQueryUpdateByExampleResult>;
2195
+ updateByExample(example: Partial<DocumentData<T>>, newValue: Patch<DocumentData<T>>, options?: SimpleQueryUpdateByExampleOptions): Promise<ArangoApiResponse<SimpleQueryUpdateByExampleResult>>;
2160
2196
  /**
2161
2197
  * Retrieves all documents matching the given document keys.
2162
2198
  *
@@ -2206,7 +2242,7 @@ export interface DocumentCollection<T extends Record<string, any> = any> extends
2206
2242
  * const ignored = keys.filter((key) => !removed.includes(key));
2207
2243
  * ```
2208
2244
  */
2209
- removeByKeys(keys: string[], options?: SimpleQueryRemoveByKeysOptions): Promise<ArangoResponseMetadata & SimpleQueryRemoveByKeysResult<T>>;
2245
+ removeByKeys(keys: string[], options?: SimpleQueryRemoveByKeysOptions): Promise<ArangoApiResponse<SimpleQueryRemoveByKeysResult<T>>>;
2210
2246
  /**
2211
2247
  * Performs a fulltext query in the given `attribute` on the collection.
2212
2248
  *
@@ -2271,61 +2307,9 @@ export interface DocumentCollection<T extends Record<string, any> = any> extends
2271
2307
  * });
2272
2308
  * ```
2273
2309
  */
2274
- ensureIndex(details: EnsurePersistentIndexOptions): Promise<ArangoResponseMetadata & PersistentIndex & {
2310
+ ensureIndex(details: EnsurePersistentIndexOptions): Promise<ArangoApiResponse<PersistentIndex & {
2275
2311
  isNewlyCreated: boolean;
2276
- }>;
2277
- /**
2278
- * Creates a hash index on the collection if it does not already exist.
2279
- *
2280
- * When using the RocksDB storage engine, hash indexes behave identically
2281
- * to persistent indexes.
2282
- *
2283
- * @param details - Options for creating the hash index.
2284
- *
2285
- * @example
2286
- * ```js
2287
- * const db = new Database();
2288
- * const collection = db.collection("some-collection");
2289
- * // Create a unique index for looking up documents by username
2290
- * await collection.ensureIndex({
2291
- * type: "hash",
2292
- * fields: ["username"],
2293
- * name: "unique-usernames",
2294
- * unique: true
2295
- * });
2296
- * ```
2297
- *
2298
- * @deprecated Hash indexes have been deprecated in ArangoDB 3.9 and should
2299
- * be replaced with persistent indexes.
2300
- */
2301
- ensureIndex(details: EnsureHashIndexOptions): Promise<ArangoResponseMetadata & HashIndex & {
2302
- isNewlyCreated: boolean;
2303
- }>;
2304
- /**
2305
- * Creates a skiplist index on the collection if it does not already exist.
2306
- *
2307
- * When using the RocksDB storage engine, skiplist indexes behave identically
2308
- * to persistent indexes.
2309
- *
2310
- * @param details - Options for creating the skiplist index.
2311
- *
2312
- * @example
2313
- * ```js
2314
- * const db = new Database();
2315
- * const collection = db.collection("some-collection");
2316
- * // Create an index for sorting email addresses
2317
- * await collection.ensureIndex({
2318
- * type: "skiplist",
2319
- * fields: ["email"]
2320
- * });
2321
- * ```
2322
- *
2323
- * @deprecated Skiplist indexes have been deprecated in ArangoDB 3.9 and
2324
- * should be replaced with persistent indexes.
2325
- */
2326
- ensureIndex(details: EnsureSkiplistIndexOptions): Promise<ArangoResponseMetadata & SkiplistIndex & {
2327
- isNewlyCreated: boolean;
2328
- }>;
2312
+ }>>;
2329
2313
  /**
2330
2314
  * Creates a TTL index on the collection if it does not already exist.
2331
2315
  *
@@ -2355,9 +2339,9 @@ export interface DocumentCollection<T extends Record<string, any> = any> extends
2355
2339
  * });
2356
2340
  * ```
2357
2341
  */
2358
- ensureIndex(details: EnsureTtlIndexOptions): Promise<ArangoResponseMetadata & TtlIndex & {
2342
+ ensureIndex(details: EnsureTtlIndexOptions): Promise<ArangoApiResponse<TtlIndex & {
2359
2343
  isNewlyCreated: boolean;
2360
- }>;
2344
+ }>>;
2361
2345
  /**
2362
2346
  * Creates a multi-dimensional index on the collection if it does not already exist.
2363
2347
  *
@@ -2376,14 +2360,17 @@ export interface DocumentCollection<T extends Record<string, any> = any> extends
2376
2360
  * ```
2377
2361
  * ```
2378
2362
  */
2379
- ensureIndex(details: EnsureZkdIndexOptions): Promise<ArangoResponseMetadata & ZkdIndex & {
2363
+ ensureIndex(details: EnsureZkdIndexOptions): Promise<ArangoApiResponse<ZkdIndex & {
2380
2364
  isNewlyCreated: boolean;
2381
- }>;
2365
+ }>>;
2382
2366
  /**
2383
2367
  * Creates a fulltext index on the collection if it does not already exist.
2384
2368
  *
2385
2369
  * @param details - Options for creating the fulltext index.
2386
2370
  *
2371
+ * @deprecated Fulltext indexes have been deprecated in ArangoDB 3.10 and
2372
+ * should be replaced with ArangoSearch.
2373
+ *
2387
2374
  * @example
2388
2375
  * ```js
2389
2376
  * const db = new Database();
@@ -2396,9 +2383,9 @@ export interface DocumentCollection<T extends Record<string, any> = any> extends
2396
2383
  * });
2397
2384
  * ```
2398
2385
  */
2399
- ensureIndex(details: EnsureFulltextIndexOptions): Promise<ArangoResponseMetadata & FulltextIndex & {
2386
+ ensureIndex(details: EnsureFulltextIndexOptions): Promise<ArangoApiResponse<FulltextIndex & {
2400
2387
  isNewlyCreated: boolean;
2401
- }>;
2388
+ }>>;
2402
2389
  /**
2403
2390
  * Creates a geo index on the collection if it does not already exist.
2404
2391
  *
@@ -2416,9 +2403,28 @@ export interface DocumentCollection<T extends Record<string, any> = any> extends
2416
2403
  * });
2417
2404
  * ```
2418
2405
  */
2419
- ensureIndex(details: EnsureGeoIndexOptions): Promise<ArangoResponseMetadata & GeoIndex & {
2406
+ ensureIndex(details: EnsureGeoIndexOptions): Promise<ArangoApiResponse<GeoIndex & {
2420
2407
  isNewlyCreated: boolean;
2421
- }>;
2408
+ }>>;
2409
+ /**
2410
+ * Creates a inverted index on the collection if it does not already exist.
2411
+ *
2412
+ * @param details - Options for creating the inverted index.
2413
+ *
2414
+ * @example
2415
+ * ```js
2416
+ * const db = new Database();
2417
+ * const collection = db.collection("some-collection");
2418
+ * // Create an inverted index
2419
+ * await collection.ensureIndex({
2420
+ * type: "inverted",
2421
+ * fields: ["a", { name: "b", analyzer: "text_en" }]
2422
+ * });
2423
+ * ```
2424
+ */
2425
+ ensureIndex(details: EnsureInvertedIndexOptions): Promise<ArangoApiResponse<InvertedIndex & {
2426
+ isNewlyCreated: boolean;
2427
+ }>>;
2422
2428
  /**
2423
2429
  * Deletes the index with the given name or `id` from the database.
2424
2430
  *
@@ -2432,9 +2438,9 @@ export interface DocumentCollection<T extends Record<string, any> = any> extends
2432
2438
  * // The index "some-index" no longer exists
2433
2439
  * ```
2434
2440
  */
2435
- dropIndex(selector: IndexSelector): Promise<ArangoResponseMetadata & {
2441
+ dropIndex(selector: IndexSelector): Promise<ArangoApiResponse<{
2436
2442
  id: string;
2437
- }>;
2443
+ }>>;
2438
2444
  /**
2439
2445
  * Triggers compaction for a collection.
2440
2446
  *
@@ -2446,16 +2452,16 @@ export interface DocumentCollection<T extends Record<string, any> = any> extends
2446
2452
  * // Background compaction is triggered on the collection
2447
2453
  * ```
2448
2454
  */
2449
- compact(): Promise<ArangoResponseMetadata>;
2455
+ compact(): Promise<ArangoApiResponse<Record<string, never>>>;
2450
2456
  }
2451
2457
  /**
2452
- * Represents an edge collection in a {@link Database}.
2458
+ * Represents an edge collection in a {@link database.Database}.
2453
2459
  *
2454
2460
  * See {@link DocumentCollection} for a more generic variant of this interface
2455
2461
  * more suited for regular document collections.
2456
2462
  *
2457
- * See also {@link GraphEdgeCollection} for the type representing an edge
2458
- * collection in a {@link Graph}.
2463
+ * See also {@link graph.GraphEdgeCollection} for the type representing an edge
2464
+ * collection in a {@link graph.Graph}.
2459
2465
  *
2460
2466
  * When using TypeScript, collections can be cast to a specific edge document
2461
2467
  * data type to increase type safety.
@@ -2490,7 +2496,7 @@ export interface EdgeCollection<T extends Record<string, any> = any> extends Doc
2490
2496
  * try {
2491
2497
  * const document = await collection.document("abc123");
2492
2498
  * console.log(document);
2493
- * } catch (e) {
2499
+ * } catch (e: any) {
2494
2500
  * console.error("Could not find document");
2495
2501
  * }
2496
2502
  * ```
@@ -2526,7 +2532,7 @@ export interface EdgeCollection<T extends Record<string, any> = any> extends Doc
2526
2532
  * try {
2527
2533
  * const document = await collection.document("abc123", false);
2528
2534
  * console.log(document);
2529
- * } catch (e) {
2535
+ * } catch (e: any) {
2530
2536
  * console.error("Could not find document");
2531
2537
  * }
2532
2538
  * ```
@@ -2561,7 +2567,7 @@ export interface EdgeCollection<T extends Record<string, any> = any> extends Doc
2561
2567
  * try {
2562
2568
  * const documents = await collection.documents(["abc123", "xyz456"]);
2563
2569
  * console.log(documents);
2564
- * } catch (e) {
2570
+ * } catch (e: any) {
2565
2571
  * console.error("Could not find document");
2566
2572
  * }
2567
2573
  * ```
@@ -3054,6 +3060,7 @@ export interface EdgeCollection<T extends Record<string, any> = any> extends Doc
3054
3060
  *
3055
3061
  * @param selector - Document `_key`, `_id` or object with either of those
3056
3062
  * properties (e.g. a document from this collection).
3063
+ * @param options - Options for retrieving the edges.
3057
3064
  *
3058
3065
  * @example
3059
3066
  * ```js
@@ -3069,7 +3076,7 @@ export interface EdgeCollection<T extends Record<string, any> = any> extends Doc
3069
3076
  * console.log(edges.map((edge) => edge._key)); // ["x", "y", "z"]
3070
3077
  * ```
3071
3078
  */
3072
- edges(selector: DocumentSelector): Promise<ArangoResponseMetadata & CollectionEdgesResult<T>>;
3079
+ edges(selector: DocumentSelector, options: CollectionEdgesOptions): Promise<ArangoApiResponse<CollectionEdgesResult<T>>>;
3073
3080
  /**
3074
3081
  * Retrieves a list of all incoming edges of the document matching the given
3075
3082
  * `selector`.
@@ -3079,6 +3086,7 @@ export interface EdgeCollection<T extends Record<string, any> = any> extends Doc
3079
3086
  *
3080
3087
  * @param selector - Document `_key`, `_id` or object with either of those
3081
3088
  * properties (e.g. a document from this collection).
3089
+ * @param options - Options for retrieving the edges.
3082
3090
  *
3083
3091
  * @example
3084
3092
  * ```js
@@ -3094,7 +3102,7 @@ export interface EdgeCollection<T extends Record<string, any> = any> extends Doc
3094
3102
  * console.log(edges.map((edge) => edge._key)); // ["z"]
3095
3103
  * ```
3096
3104
  */
3097
- inEdges(selector: DocumentSelector): Promise<ArangoResponseMetadata & CollectionEdgesResult<T>>;
3105
+ inEdges(selector: DocumentSelector, options: CollectionEdgesOptions): Promise<ArangoApiResponse<CollectionEdgesResult<T>>>;
3098
3106
  /**
3099
3107
  * Retrieves a list of all outgoing edges of the document matching the given
3100
3108
  * `selector`.
@@ -3104,6 +3112,7 @@ export interface EdgeCollection<T extends Record<string, any> = any> extends Doc
3104
3112
  *
3105
3113
  * @param selector - Document `_key`, `_id` or object with either of those
3106
3114
  * properties (e.g. a document from this collection).
3115
+ * @param options - Options for retrieving the edges.
3107
3116
  *
3108
3117
  * @example
3109
3118
  * ```js
@@ -3119,7 +3128,7 @@ export interface EdgeCollection<T extends Record<string, any> = any> extends Doc
3119
3128
  * console.log(edges.map((edge) => edge._key)); // ["x", "y"]
3120
3129
  * ```
3121
3130
  */
3122
- outEdges(selector: DocumentSelector): Promise<ArangoResponseMetadata & CollectionEdgesResult<T>>;
3131
+ outEdges(selector: DocumentSelector, options: CollectionEdgesOptions): Promise<ArangoApiResponse<CollectionEdgesResult<T>>>;
3123
3132
  /**
3124
3133
  * Performs a traversal starting from the given `startVertex` and following
3125
3134
  * edges contained in this edge collection.
@@ -3127,7 +3136,7 @@ export interface EdgeCollection<T extends Record<string, any> = any> extends Doc
3127
3136
  * Throws an exception when passed a document or `_id` from a different
3128
3137
  * collection.
3129
3138
  *
3130
- * See also {@link Graph.traversal}.
3139
+ * See also {@link graph.Graph#traversal}.
3131
3140
  *
3132
3141
  * @param startVertex - Document `_key`, `_id` or object with either of those
3133
3142
  * properties (e.g. a document from this collection).
@@ -3146,30 +3155,27 @@ export interface EdgeCollection<T extends Record<string, any> = any> extends Doc
3146
3155
  * ["y", "vertices/b", "vertices/c"],
3147
3156
  * ["z", "vertices/c", "vertices/d"],
3148
3157
  * ]);
3149
- * const result = await collection.traversal("vertices/a", {
3150
- * direction: "outbound",
3151
- * init: "result.vertices = [];",
3152
- * visitor: "result.vertices.push(vertex._key);",
3153
- * });
3154
- * console.log(result.vertices); // ["a", "b", "c", "d"]
3158
+ * const startVertex = "vertices/a";
3159
+ * const cursor = await db.query(aql`
3160
+ * FOR vertex IN OUTBOUND ${startVertex}
3161
+ * RETURN vertex._key
3162
+ * `);
3163
+ * const result = await cursor.all();
3164
+ * console.log(result); // ["a", "b", "c", "d"]
3155
3165
  * ```
3156
3166
  */
3157
3167
  traversal(startVertex: DocumentSelector, options?: TraversalOptions): Promise<any>;
3158
3168
  }
3159
3169
  /**
3160
3170
  * @internal
3161
- * @hidden
3162
3171
  */
3163
3172
  export declare class Collection<T extends Record<string, any> = any> implements EdgeCollection<T>, DocumentCollection<T> {
3164
3173
  protected _name: string;
3165
3174
  protected _db: Database;
3166
3175
  /**
3167
3176
  * @internal
3168
- * @hidden
3169
3177
  */
3170
3178
  constructor(db: Database, name: string);
3171
- protected _get<T extends Record<string, any>>(path: string, qs?: any): Promise<ArangoResponseMetadata & T>;
3172
- protected _put<T extends Record<string, any>>(path: string, body?: any): Promise<ArangoResponseMetadata & T>;
3173
3179
  get isArangoCollection(): true;
3174
3180
  get name(): string;
3175
3181
  get(): Promise<any>;
@@ -3177,34 +3183,29 @@ export declare class Collection<T extends Record<string, any> = any> implements
3177
3183
  create(options?: CreateCollectionOptions & {
3178
3184
  type?: CollectionType;
3179
3185
  }): Promise<any>;
3180
- properties(properties?: CollectionPropertiesOptions): Promise<ArangoResponseMetadata & CollectionMetadata & CollectionProperties>;
3181
- count(): Promise<ArangoResponseMetadata & CollectionMetadata & CollectionProperties & {
3186
+ properties(properties?: CollectionPropertiesOptions): Promise<ArangoApiResponse<CollectionMetadata & CollectionProperties>>;
3187
+ count(): Promise<ArangoApiResponse<CollectionMetadata & CollectionProperties & {
3182
3188
  count: number;
3183
- }>;
3189
+ }>>;
3184
3190
  recalculateCount(): Promise<boolean>;
3185
- figures(details?: boolean): Promise<CollectionMetadata & CollectionProperties & {
3191
+ figures(details?: boolean): Promise<CollectionMetadata & ArangoApiResponse<CollectionProperties & {
3186
3192
  count: number;
3187
- figures: Dict<any>;
3188
- } & ArangoResponseMetadata>;
3189
- revision(): Promise<ArangoResponseMetadata & CollectionMetadata & CollectionProperties & {
3193
+ figures: Record<string, any>;
3194
+ }>>;
3195
+ revision(): Promise<ArangoApiResponse<CollectionMetadata & CollectionProperties & {
3190
3196
  revision: string;
3191
- }>;
3192
- checksum(options?: CollectionChecksumOptions): Promise<ArangoResponseMetadata & CollectionMetadata & {
3197
+ }>>;
3198
+ checksum(options?: CollectionChecksumOptions): Promise<ArangoApiResponse<CollectionMetadata & {
3193
3199
  revision: string;
3194
3200
  checksum: string;
3195
- }>;
3196
- load(count?: boolean): Promise<ArangoResponseMetadata & CollectionMetadata & {
3197
- count: number;
3198
- }>;
3201
+ }>>;
3199
3202
  loadIndexes(): Promise<boolean>;
3200
- unload(): Promise<ArangoResponseMetadata & CollectionMetadata>;
3201
- rename(newName: string): Promise<ArangoResponseMetadata & CollectionMetadata>;
3202
- rotate(): Promise<boolean>;
3203
- truncate(): Promise<ArangoResponseMetadata & CollectionMetadata>;
3203
+ rename(newName: string): Promise<ArangoApiResponse<CollectionMetadata>>;
3204
+ truncate(): Promise<ArangoApiResponse<CollectionMetadata>>;
3204
3205
  drop(options?: CollectionDropOptions): Promise<any>;
3205
3206
  getResponsibleShard(document: Partial<Document<T>>): Promise<string>;
3206
3207
  documentId(selector: DocumentSelector): string;
3207
- documentExists(selector: DocumentSelector): Promise<boolean>;
3208
+ documentExists(selector: DocumentSelector, options?: DocumentExistsOptions): Promise<boolean>;
3208
3209
  documents(selectors: (string | ObjectWithKey)[], options?: CollectionBatchReadOptions): Promise<any>;
3209
3210
  document(selector: DocumentSelector, options?: boolean | CollectionReadOptions): Promise<any>;
3210
3211
  save(data: DocumentData<T>, options?: CollectionInsertOptions): Promise<any>;
@@ -3222,14 +3223,14 @@ export declare class Collection<T extends Record<string, any> = any> implements
3222
3223
  _id: string;
3223
3224
  })>, options?: CollectionUpdateOptions): Promise<any>;
3224
3225
  remove(selector: DocumentSelector, options?: CollectionRemoveOptions): Promise<any>;
3225
- removeAll(selectors: DocumentSelector[], options?: CollectionRemoveOptions): Promise<any>;
3226
+ removeAll(selectors: (string | ObjectWithKey)[], options?: CollectionRemoveOptions): Promise<any>;
3226
3227
  import(data: Buffer | Blob | string | any[], options?: CollectionImportOptions & {
3227
3228
  type?: "documents" | "list" | "auto";
3228
3229
  }): Promise<CollectionImportResult>;
3229
- protected _edges(selector: DocumentSelector, direction?: "in" | "out"): Promise<any>;
3230
- edges(vertex: DocumentSelector): Promise<any>;
3231
- inEdges(vertex: DocumentSelector): Promise<any>;
3232
- outEdges(vertex: DocumentSelector): Promise<any>;
3230
+ protected _edges(selector: DocumentSelector, options: CollectionEdgesOptions, direction?: "in" | "out"): Promise<any>;
3231
+ edges(vertex: DocumentSelector, options: CollectionEdgesOptions): Promise<any>;
3232
+ inEdges(vertex: DocumentSelector, options: CollectionEdgesOptions): Promise<any>;
3233
+ outEdges(vertex: DocumentSelector, options: CollectionEdgesOptions): Promise<any>;
3233
3234
  traversal(startVertex: DocumentSelector, options?: TraversalOptions): Promise<any>;
3234
3235
  list(type?: SimpleQueryListType): Promise<ArrayCursor<any>>;
3235
3236
  all(options?: SimpleQueryAllOptions): Promise<ArrayCursor<any>>;
@@ -3243,7 +3244,7 @@ export declare class Collection<T extends Record<string, any> = any> implements
3243
3244
  removeByKeys(keys: string[], options?: SimpleQueryRemoveByKeysOptions): Promise<any>;
3244
3245
  indexes(): Promise<any>;
3245
3246
  index(selector: IndexSelector): Promise<any>;
3246
- ensureIndex(options: EnsureHashIndexOptions | EnsureSkiplistIndexOptions | EnsurePersistentIndexOptions | EnsureGeoIndexOptions | EnsureFulltextIndexOptions | EnsureTtlIndexOptions | EnsureZkdIndexOptions): Promise<any>;
3247
+ ensureIndex(options: EnsurePersistentIndexOptions | EnsureGeoIndexOptions | EnsureFulltextIndexOptions | EnsureTtlIndexOptions | EnsureZkdIndexOptions | EnsureInvertedIndexOptions): Promise<any>;
3247
3248
  dropIndex(selector: IndexSelector): Promise<any>;
3248
3249
  fulltext(attribute: string, query: string, { index, ...options }?: SimpleQueryFulltextOptions): Promise<ArrayCursor<any>>;
3249
3250
  compact(): Promise<any>;