UNPKG

151 kBTypeScriptView Raw
1/// <reference types="node" resolution-mode="require"/>
2/// <reference types="node" resolution-mode="require"/>
3/**
4 * ```js
5 * import { Database } from "arangojs/database.js";
6 * ```
7 *
8 * The "database" module provides the {@link Database} class and associated
9 * types and interfaces for TypeScript.
10 *
11 * The Database class is also re-exported by the "index" module.
12 *
13 * @packageDocumentation
14 */
15import { Analyzer, AnalyzerDescription, CreateAnalyzerOptions } from "./analyzer.js";
16import { AqlLiteral, AqlQuery } from "./aql.js";
17import { ArangoCollection, Collection, CollectionMetadata, CollectionType, CreateCollectionOptions, DocumentCollection, EdgeCollection } from "./collection.js";
18import { ArangoApiResponse, Config, Connection, RequestOptions } from "./connection.js";
19import { ArrayCursor } from "./cursor.js";
20import { FoxxManifest } from "./foxx-manifest.js";
21import { CreateGraphOptions, EdgeDefinitionOptions, Graph, GraphInfo } from "./graph.js";
22import { Job } from "./job.js";
23import { ArangojsResponse } from "./lib/request.js";
24import { Route } from "./route.js";
25import { Transaction } from "./transaction.js";
26import { CreateViewOptions, View, ViewDescription } from "./view.js";
27/**
28 * Indicates whether the given value represents a {@link Database}.
29 *
30 * @param database - A value that might be a database.
31 */
32export declare function isArangoDatabase(database: any): database is Database;
33/**
34 * Collections involved in a transaction.
35 */
36export type TransactionCollections = {
37 /**
38 * An array of collections or a single collection that will be read from or
39 * written to during the transaction with no other writes being able to run
40 * in parallel.
41 */
42 exclusive?: (string | ArangoCollection)[] | string | ArangoCollection;
43 /**
44 * An array of collections or a single collection that will be read from or
45 * written to during the transaction.
46 */
47 write?: (string | ArangoCollection)[] | string | ArangoCollection;
48 /**
49 * An array of collections or a single collection that will be read from
50 * during the transaction.
51 */
52 read?: (string | ArangoCollection)[] | string | ArangoCollection;
53};
54/**
55 * Options for how the transaction should be performed.
56 */
57export type TransactionOptions = {
58 /**
59 * Whether the transaction may read from collections not specified for this
60 * transaction. If set to `false`, accessing any collections not specified
61 * will result in the transaction being aborted to avoid potential deadlocks.
62 *
63 * Default: `true`.
64 */
65 allowImplicit?: boolean;
66 /**
67 * If set to `true`, the request will explicitly permit ArangoDB to return a
68 * potentially dirty or stale result and arangojs will load balance the
69 * request without distinguishing between leaders and followers.
70 */
71 allowDirtyRead?: boolean;
72 /**
73 * Determines whether to force the transaction to write all data to disk
74 * before returning.
75 */
76 waitForSync?: boolean;
77 /**
78 * Determines how long the database will wait while attempting to gain locks
79 * on collections used by the transaction before timing out.
80 */
81 lockTimeout?: number;
82 /**
83 * Determines the transaction size limit in bytes.
84 */
85 maxTransactionSize?: number;
86 /**
87 * If set to `true`, the fast lock round will be skipped, which makes each
88 * locking operation take longer but guarantees deterministic locking order
89 * and may avoid deadlocks when many concurrent transactions are queued and
90 * try to access the same collection with an exclusive lock.
91 */
92 skipFastLockRound?: boolean;
93};
94/**
95 * Options for executing a query.
96 *
97 * See {@link Database#query}.
98 */
99export type QueryOptions = {
100 /**
101 * If set to `true`, the query will be executed with support for dirty reads
102 * enabled, permitting ArangoDB to return a potentially dirty or stale result
103 * and arangojs will load balance the request without distinguishing between
104 * leaders and followers.
105 *
106 * Note that dirty reads are only supported for read-only queries, not data
107 * modification queries (e.g. using `INSERT`, `UPDATE`, `REPLACE` or
108 * `REMOVE`) and only when using ArangoDB 3.4 or later.
109 *
110 * Default: `false`
111 */
112 allowDirtyRead?: boolean;
113 /**
114 * If set to `true`, cursor results will be stored by ArangoDB in such a way
115 * that batch reads can be retried in the case of a communication error.
116 *
117 * Default: `false`
118 */
119 allowRetry?: boolean;
120 /**
121 * Maximum time in milliseconds arangojs will wait for a server response.
122 * Exceeding this value will result in the request being cancelled.
123 *
124 * **Note**: Setting a timeout for the client does not guarantee the query
125 * will be killed by ArangoDB if it is already being executed. See the
126 * `maxRuntime` option for limiting the execution time within ArangoDB.
127 */
128 timeout?: number;
129 /**
130 * If set to a positive number, the query will automatically be retried at
131 * most this many times if it results in a write-write conflict.
132 *
133 * Default: `0`
134 */
135 retryOnConflict?: number;
136 /**
137 * Unless set to `false`, the number of result values in the result set will
138 * be returned in the `count` attribute. This may be disabled by default in
139 * a future version of ArangoDB if calculating this value has a performance
140 * impact for some queries.
141 *
142 * Default: `true`.
143 */
144 count?: boolean;
145 /**
146 * Number of result values to be transferred by the server in each
147 * network roundtrip (or "batch").
148 *
149 * Must be greater than zero.
150 */
151 batchSize?: number;
152 /**
153 * If set to `false`, the AQL query results cache lookup will be skipped for
154 * this query.
155 *
156 * Default: `true`
157 */
158 cache?: boolean;
159 /**
160 * Maximum memory size in bytes that the query is allowed to use.
161 * Exceeding this value will result in the query failing with an error.
162 *
163 * If set to `0`, the memory limit is disabled.
164 *
165 * Default: `0`
166 */
167 memoryLimit?: number;
168 /**
169 * Maximum allowed execution time before the query will be killed in seconds.
170 *
171 * If set to `0`, the query will be allowed to run indefinitely.
172 *
173 * Default: `0`
174 */
175 maxRuntime?: number;
176 /**
177 * Time-to-live for the cursor in seconds. The cursor results may be
178 * garbage collected by ArangoDB after this much time has passed.
179 *
180 * Default: `30`
181 */
182 ttl?: number;
183 /**
184 * If set to `true`, the query will throw an exception and abort if it would
185 otherwise produce a warning.
186 */
187 failOnWarning?: boolean;
188 /**
189 * If set to `1` or `true`, additional query profiling information will be
190 * returned in the `extra.profile` attribute if the query is not served from
191 * the result cache.
192 *
193 * If set to `2`, the query will return execution stats per query plan node
194 * in the `extra.stats.nodes` attribute. Additionally the query plan is
195 * returned in `extra.plan`.
196 */
197 profile?: boolean | number;
198 /**
199 * If set to `true`, the query will be executed as a streaming query.
200 */
201 stream?: boolean;
202 /**
203 * Limits the maximum number of warnings a query will return.
204 */
205 maxWarningsCount?: number;
206 /**
207 * If set to `true` and the query has a `LIMIT` clause, the total number of
208 * values matched before the last top-level `LIMIT` in the query was applied
209 * will be returned in the `extra.stats.fullCount` attribute.
210 */
211 fullCount?: boolean;
212 /**
213 * If set to `false`, the query data will not be stored in the RocksDB block
214 * cache. This can be used to avoid thrashing he block cache when reading a
215 * lot of data.
216 */
217 fillBlockCache?: boolean;
218 /**
219 * An object with a `rules` property specifying a list of optimizer rules to
220 * be included or excluded by the optimizer for this query. Prefix a rule
221 * name with `+` to include it, or `-` to exclude it. The name `all` acts as
222 * an alias matching all optimizer rules.
223 */
224 optimizer?: {
225 rules: string[];
226 };
227 /**
228 * Limits the maximum number of plans that will be created by the AQL query
229 * optimizer.
230 */
231 maxPlans?: number;
232 /**
233 * Controls after how many execution nodes in a query a stack split should be
234 * performed.
235 *
236 * Default: `250` (`200` on macOS)
237 */
238 maxNodesPerCallstack?: number;
239 /**
240 * Maximum size of transactions in bytes.
241 */
242 maxTransactionSize?: number;
243 /**
244 * Maximum number of operations after which an intermediate commit is
245 * automatically performed.
246 */
247 intermediateCommitCount?: number;
248 /**
249 * Maximum total size of operations in bytes after which an intermediate
250 * commit is automatically performed.
251 */
252 intermediateCommitSize?: number;
253 /**
254 * (Enterprise Edition cluster only.) If set to `true`, collections
255 * inaccessible to current user will result in an access error instead
256 * of being treated as empty.
257 */
258 skipInaccessibleCollections?: boolean;
259 /**
260 * (Enterprise Edition cluster only.) Limits the maximum time in seconds a
261 * DBServer will wait to bring satellite collections involved in the query
262 * into sync. Exceeding this value will result in the query being stopped.
263 *
264 * Default: `60`
265 */
266 satelliteSyncWait?: number;
267};
268/**
269 * Options for explaining a query.
270 *
271 * See {@link Database#explain}.
272 */
273export type ExplainOptions = {
274 /**
275 * An object with a `rules` property specifying a list of optimizer rules to
276 * be included or excluded by the optimizer for this query. Prefix a rule
277 * name with `+` to include it, or `-` to exclude it. The name `all` acts as
278 * an alias matching all optimizer rules.
279 */
280 optimizer?: {
281 rules: string[];
282 };
283 /**
284 * Maximum number of plans that the optimizer is allowed to generate.
285 * Setting this to a low value limits the amount of work the optimizer does.
286 */
287 maxNumberOfPlans?: number;
288 /**
289 * If set to true, all possible execution plans will be returned as the
290 * `plans` property. Otherwise only the optimal execution plan will be
291 * returned as the `plan` property.
292 *
293 * Default: `false`
294 */
295 allPlans?: boolean;
296};
297/**
298 * Details for a transaction.
299 *
300 * See also {@link transaction.TransactionStatus}.
301 */
302export type TransactionDetails = {
303 /**
304 * Unique identifier of the transaction.
305 */
306 id: string;
307 /**
308 * Status (or "state") of the transaction.
309 */
310 state: "running" | "committed" | "aborted";
311};
312/**
313 * Plan explaining query execution.
314 */
315export type ExplainPlan = {
316 /**
317 * Execution nodes in this plan.
318 */
319 nodes: {
320 [key: string]: any;
321 type: string;
322 id: number;
323 dependencies: number[];
324 estimatedCost: number;
325 estimatedNrItems: number;
326 }[];
327 /**
328 * Rules applied by the optimizer.
329 */
330 rules: string[];
331 /**
332 * Information about collections involved in the query.
333 */
334 collections: {
335 name: string;
336 type: "read" | "write";
337 }[];
338 /**
339 * Variables used in the query.
340 */
341 variables: {
342 id: number;
343 name: string;
344 }[];
345 /**
346 * Total estimated cost of the plan.
347 */
348 estimatedCost: number;
349 /**
350 * Estimated number of items returned by the query.
351 */
352 estimatedNrItems: number;
353 /**
354 * Whether the query is a data modification query.
355 */
356 isModificationQuery: boolean;
357};
358/**
359 * Optimizer statistics for an explained query.
360 */
361export type ExplainStats = {
362 /**
363 * Total number of rules executed for this query.
364 */
365 rulesExecuted: number;
366 /**
367 * Number of rules skipped for this query.
368 */
369 rulesSkipped: number;
370 /**
371 * Total number of plans created.
372 */
373 plansCreated: number;
374 /**
375 * Maximum memory usage in bytes of the query during explain.
376 */
377 peakMemoryUsage: number;
378 /**
379 * Time in seconds needed to explain the query.
380 */
381 executionTime: number;
382};
383/**
384 * Result of explaining a query with a single plan.
385 */
386export type SingleExplainResult = {
387 /**
388 * Query plan.
389 */
390 plan: ExplainPlan;
391 /**
392 * Whether it would be possible to cache the query.
393 */
394 cacheable: boolean;
395 /**
396 * Warnings encountered while planning the query execution.
397 */
398 warnings: {
399 code: number;
400 message: string;
401 }[];
402 /**
403 * Optimizer statistics for the explained query.
404 */
405 stats: ExplainStats;
406};
407/**
408 * Result of explaining a query with multiple plans.
409 */
410export type MultiExplainResult = {
411 /**
412 * Query plans.
413 */
414 plans: ExplainPlan[];
415 /**
416 * Whether it would be possible to cache the query.
417 */
418 cacheable: boolean;
419 /**
420 * Warnings encountered while planning the query execution.
421 */
422 warnings: {
423 code: number;
424 message: string;
425 }[];
426 /**
427 * Optimizer statistics for the explained query.
428 */
429 stats: ExplainStats;
430};
431/**
432 * Node in an AQL abstract syntax tree (AST).
433 */
434export type AstNode = {
435 [key: string]: any;
436 type: string;
437 subNodes: AstNode[];
438};
439/**
440 * Result of parsing a query.
441 */
442export type ParseResult = {
443 /**
444 * Whether the query was parsed.
445 */
446 parsed: boolean;
447 /**
448 * Names of all collections involved in the query.
449 */
450 collections: string[];
451 /**
452 * Names of all bind parameters used in the query.
453 */
454 bindVars: string[];
455 /**
456 * Abstract syntax tree (AST) of the query.
457 */
458 ast: AstNode[];
459};
460/**
461 * Optimizer rule for AQL queries.
462 */
463export type QueryOptimizerRule = {
464 name: string;
465 flags: {
466 hidden: boolean;
467 clusterOnly: boolean;
468 canBeDisabled: boolean;
469 canCreateAdditionalPlans: boolean;
470 disabledByDefault: boolean;
471 enterpriseOnly: boolean;
472 };
473};
474/**
475 * Information about query tracking.
476 */
477export type QueryTracking = {
478 /**
479 * Whether query tracking is enabled.
480 */
481 enabled: boolean;
482 /**
483 * Maximum query string length in bytes that is kept in the list.
484 */
485 maxQueryStringLength: number;
486 /**
487 * Maximum number of slow queries that is kept in the list.
488 */
489 maxSlowQueries: number;
490 /**
491 * Threshold execution time in seconds for when a query is
492 * considered slow.
493 */
494 slowQueryThreshold: number;
495 /**
496 * Whether bind parameters are being tracked along with queries.
497 */
498 trackBindVars: boolean;
499 /**
500 * Whether slow queries are being tracked.
501 */
502 trackSlowQueries: boolean;
503};
504/**
505 * Options for query tracking.
506 *
507 * See {@link Database#queryTracking}.
508 */
509export type QueryTrackingOptions = {
510 /**
511 * If set to `false`, neither queries nor slow queries will be tracked.
512 */
513 enabled?: boolean;
514 /**
515 * Maximum query string length in bytes that will be kept in the list.
516 */
517 maxQueryStringLength?: number;
518 /**
519 * Maximum number of slow queries to be kept in the list.
520 */
521 maxSlowQueries?: number;
522 /**
523 * Threshold execution time in seconds for when a query will be
524 * considered slow.
525 */
526 slowQueryThreshold?: number;
527 /**
528 * If set to `true`, bind parameters will be tracked along with queries.
529 */
530 trackBindVars?: boolean;
531 /**
532 * If set to `true` and `enabled` is also set to `true`, slow queries will be
533 * tracked if their execution time exceeds `slowQueryThreshold`.
534 */
535 trackSlowQueries?: boolean;
536};
537/**
538 * Object describing a query.
539 */
540export type QueryInfo = {
541 /**
542 * Unique identifier for this query.
543 */
544 id: string;
545 /**
546 * Name of the database the query runs in.
547 */
548 database: string;
549 /**
550 * Name of the user that started the query.
551 */
552 user: string;
553 /**
554 * Query string (potentially truncated).
555 */
556 query: string;
557 /**
558 * Bind parameters used in the query.
559 */
560 bindVars: Record<string, any>;
561 /**
562 * Date and time the query was started.
563 */
564 started: string;
565 /**
566 * Query's running time in seconds.
567 */
568 runTime: number;
569 /**
570 * Maximum memory usage in bytes of the query.
571 */
572 peakMemoryUsage: number;
573 /**
574 * Query's current execution state.
575 */
576 state: "executing" | "finished" | "killed";
577 /**
578 * Whether the query uses a streaming cursor.
579 */
580 stream: boolean;
581};
582/**
583 * Information about a cluster imbalance.
584 */
585export type ClusterImbalanceInfo = {
586 /**
587 * Information about the leader imbalance.
588 */
589 leader: {
590 /**
591 * The weight of leader shards per DB-Server. A leader has a weight of 1 by default but it is higher if collections can only be moved together because of `distributeShardsLike`.
592 */
593 weightUsed: number[];
594 /**
595 * The ideal weight of leader shards per DB-Server.
596 */
597 targetWeight: number[];
598 /**
599 * The number of leader shards per DB-Server.
600 */
601 numberShards: number[];
602 /**
603 * The measure of the leader shard distribution. The higher the number, the worse the distribution.
604 */
605 leaderDupl: number[];
606 /**
607 * The sum of all weights.
608 */
609 totalWeight: number;
610 /**
611 * The measure of the total imbalance. A high value indicates a high imbalance.
612 */
613 imbalance: number;
614 /**
615 * The sum of shards, counting leader shards only.
616 */
617 totalShards: number;
618 };
619 /**
620 * Information about the shard imbalance.
621 */
622 shards: {
623 /**
624 * The size of shards per DB-Server.
625 */
626 sizeUsed: number[];
627 /**
628 * The ideal size of shards per DB-Server.
629 */
630 targetSize: number[];
631 /**
632 * The number of leader and follower shards per DB-Server.
633 */
634 numberShards: number[];
635 /**
636 * The sum of the sizes.
637 */
638 totalUsed: number;
639 /**
640 * The sum of shards, counting leader and follower shards.
641 */
642 totalShards: number;
643 /**
644 * The sum of system collection shards, counting leader shards only.
645 */
646 totalShardsFromSystemCollections: number;
647 /**
648 * The measure of the total imbalance. A high value indicates a high imbalance.
649 */
650 imbalance: number;
651 };
652};
653/**
654 * Information about the current state of the cluster imbalance.
655 */
656export type ClusterRebalanceState = ClusterImbalanceInfo & {
657 /**
658 * The number of pending move shard operations.
659 */
660 pendingMoveShards: number;
661 /**
662 * The number of planned move shard operations.
663 */
664 todoMoveShards: number;
665};
666/**
667 * Options for rebalancing the cluster.
668 */
669export type ClusterRebalanceOptions = {
670 /**
671 * Maximum number of moves to be computed.
672 *
673 * Default: `1000`
674 */
675 maximumNumberOfMoves?: number;
676 /**
677 * Allow leader changes without moving data.
678 *
679 * Default: `true`
680 */
681 leaderChanges?: boolean;
682 /**
683 * Allow moving leaders.
684 *
685 * Default: `false`
686 */
687 moveLeaders?: boolean;
688 /**
689 * Allow moving followers.
690 *
691 * Default: `false`
692 */
693 moveFollowers?: boolean;
694 /**
695 * Ignore system collections in the rebalance plan.
696 *
697 * Default: `false`
698 */
699 excludeSystemCollections?: boolean;
700 /**
701 * Default: `256**6`
702 */
703 piFactor?: number;
704 /**
705 * A list of database names to exclude from the analysis.
706 *
707 * Default: `[]`
708 */
709 databasesExcluded?: string[];
710};
711export type ClusterRebalanceMove = {
712 /**
713 * The server name from which to move.
714 */
715 from: string;
716 /**
717 * The ID of the destination server.
718 */
719 to: string;
720 /**
721 * Shard ID of the shard to be moved.
722 */
723 shard: string;
724 /**
725 * Collection ID of the collection the shard belongs to.
726 */
727 collection: number;
728 /**
729 * True if this is a leader move shard operation.
730 */
731 isLeader: boolean;
732};
733export type ClusterRebalanceResult = {
734 /**
735 * Imbalance before the suggested move shard operations are applied.
736 */
737 imbalanceBefore: ClusterImbalanceInfo;
738 /**
739 * Expected imbalance after the suggested move shard operations are applied.
740 */
741 imbalanceAfter: ClusterImbalanceInfo;
742 /**
743 * Suggested move shard operations.
744 */
745 moves: ClusterRebalanceMove[];
746};
747/**
748 * Database user to create with a database.
749 */
750export type CreateDatabaseUser = {
751 /**
752 * Username of the user to create.
753 */
754 username: string;
755 /**
756 * Password of the user to create.
757 *
758 * Default: `""`
759 */
760 passwd?: string;
761 /**
762 * Whether the user is active.
763 *
764 * Default: `true`
765 */
766 active?: boolean;
767 /**
768 * Additional data to store with the user object.
769 */
770 extra?: Record<string, any>;
771};
772/**
773 * Options for creating a database.
774 *
775 * See {@link Database#createDatabase}.
776 */
777export type CreateDatabaseOptions = {
778 /**
779 * Database users to create with the database.
780 */
781 users?: CreateDatabaseUser[];
782 /**
783 * (Cluster only.) The sharding method to use for new collections in the
784 * database.
785 */
786 sharding?: "" | "flexible" | "single";
787 /**
788 * (Cluster only.) Default replication factor for new collections in this
789 * database.
790 *
791 * Setting this to `1` disables replication. Setting this to `"satellite"`
792 * will replicate to every DBServer.
793 */
794 replicationFactor?: "satellite" | number;
795 /**
796 * (Cluster only.) Default write concern for new collections created in this
797 * database.
798 */
799 writeConcern?: number;
800};
801/**
802 * Object describing a database.
803 *
804 * See {@link Database#get}.
805 */
806export type DatabaseInfo = {
807 /**
808 * Name of the database.
809 */
810 name: string;
811 /**
812 * Unique identifier of the database.
813 */
814 id: string;
815 /**
816 * File system path of the database.
817 */
818 path: string;
819 /**
820 * Whether the database is the system database.
821 */
822 isSystem: boolean;
823 /**
824 * (Cluster only.) The sharding method to use for new collections in the
825 * database.
826 */
827 sharding?: "" | "flexible" | "single";
828 /**
829 * (Cluster only.) Default replication factor for new collections in this
830 * database.
831 */
832 replicationFactor?: "satellite" | number;
833 /**
834 * (Cluster only.) Default write concern for new collections created in this
835 * database.
836 */
837 writeConcern?: number;
838};
839/**
840 * Result of retrieving database version information.
841 */
842export type VersionInfo = {
843 /**
844 * Value identifying the server type, i.e. `"arango"`.
845 */
846 server: string;
847 /**
848 * ArangoDB license type or "edition".
849 */
850 license: "community" | "enterprise";
851 /**
852 * ArangoDB server version.
853 */
854 version: string;
855 /**
856 * Additional information about the ArangoDB server.
857 */
858 details?: {
859 [key: string]: string;
860 };
861};
862/**
863 * Definition of an AQL User Function.
864 */
865export type AqlUserFunction = {
866 /**
867 * Name of the AQL User Function.
868 */
869 name: string;
870 /**
871 * Implementation of the AQL User Function.
872 */
873 code: string;
874 /**
875 * Whether the function is deterministic.
876 *
877 * See {@link Database#createFunction}.
878 */
879 isDeterministic: boolean;
880};
881/**
882 * Options for installing the service.
883 *
884 * See {@link Database#installService}.
885 */
886export type InstallServiceOptions = {
887 /**
888 * An object mapping configuration option names to values.
889 *
890 * See also {@link Database#getServiceConfiguration}.
891 */
892 configuration?: Record<string, any>;
893 /**
894 * An object mapping dependency aliases to mount points.
895 *
896 * See also {@link Database#getServiceDependencies}.
897 */
898 dependencies?: Record<string, string>;
899 /**
900 * Whether the service should be installed in development mode.
901 *
902 * See also {@link Database#setServiceDevelopmentMode}.
903 *
904 * Default: `false`
905 */
906 development?: boolean;
907 /**
908 * Whether the service should be installed in legacy compatibility mode
909 *
910 * This overrides the `engines` option in the service manifest (if any).
911 *
912 * Default: `false`
913 */
914 legacy?: boolean;
915 /**
916 * Whether the "setup" script should be executed.
917 *
918 * Default: `true`
919 */
920 setup?: boolean;
921};
922/**
923 * Options for replacing a service.
924 *
925 * See {@link Database#replaceService}.
926 */
927export type ReplaceServiceOptions = {
928 /**
929 * An object mapping configuration option names to values.
930 *
931 * See also {@link Database#getServiceConfiguration}.
932 */
933 configuration?: Record<string, any>;
934 /**
935 * An object mapping dependency aliases to mount points.
936 *
937 * See also {@link Database#getServiceDependencies}.
938 */
939 dependencies?: Record<string, string>;
940 /**
941 * Whether the service should be installed in development mode.
942 *
943 * See also {@link Database#setServiceDevelopmentMode}.
944 *
945 * Default: `false`
946 */
947 development?: boolean;
948 /**
949 * Whether the service should be installed in legacy compatibility mode
950 *
951 * This overrides the `engines` option in the service manifest (if any).
952 *
953 * Default: `false`
954 */
955 legacy?: boolean;
956 /**
957 * Whether the "setup" script should be executed.
958 *
959 * Default: `true`
960 */
961 setup?: boolean;
962 /**
963 * Whether the existing service's "teardown" script should be executed
964 * prior to removing that service.
965 *
966 * Default: `true`
967 */
968 teardown?: boolean;
969 /**
970 * If set to `true`, replacing a service that does not already exist will
971 * fall back to installing the new service.
972 *
973 * Default: `false`
974 */
975 force?: boolean;
976};
977/**
978 * Options for upgrading a service.
979 *
980 * See {@link Database#upgradeService}.
981 */
982export type UpgradeServiceOptions = {
983 /**
984 * An object mapping configuration option names to values.
985 *
986 * See also {@link Database#getServiceConfiguration}.
987 */
988 configuration?: Record<string, any>;
989 /**
990 * An object mapping dependency aliases to mount points.
991 *
992 * See also {@link Database#getServiceDependencies}.
993 */
994 dependencies?: Record<string, string>;
995 /**
996 * Whether the service should be installed in development mode.
997 *
998 * See also {@link Database#setServiceDevelopmentMode}.
999 *
1000 * Default: `false`
1001 */
1002 development?: boolean;
1003 /**
1004 * Whether the service should be installed in legacy compatibility mode
1005 *
1006 * This overrides the `engines` option in the service manifest (if any).
1007 *
1008 * Default: `false`
1009 */
1010 legacy?: boolean;
1011 /**
1012 * Whether the "setup" script should be executed.
1013 *
1014 * Default: `true`
1015 */
1016 setup?: boolean;
1017 /**
1018 * Whether the existing service's "teardown" script should be executed
1019 * prior to upgrading that service.
1020 *
1021 * Default: `false`
1022 */
1023 teardown?: boolean;
1024 /**
1025 * Unless set to `true`, upgrading a service that does not already exist will
1026 * fall back to installing the new service.
1027 *
1028 * Default: `false`
1029 */
1030 force?: boolean;
1031};
1032/**
1033 * Options for uninstalling a service.
1034 *
1035 * See {@link Database#uninstallService}.
1036 */
1037export type UninstallServiceOptions = {
1038 /**
1039 * Whether the service's "teardown" script should be executed
1040 * prior to removing that service.
1041 *
1042 * Default: `true`
1043 */
1044 teardown?: boolean;
1045 /**
1046 * If set to `true`, uninstalling a service that does not already exist
1047 * will be considered successful.
1048 *
1049 * Default: `false`
1050 */
1051 force?: boolean;
1052};
1053/**
1054 * Object briefly describing a Foxx service.
1055 */
1056export type ServiceSummary = {
1057 /**
1058 * Service mount point, relative to the database.
1059 */
1060 mount: string;
1061 /**
1062 * Name defined in the service manifest.
1063 */
1064 name?: string;
1065 /**
1066 * Version defined in the service manifest.
1067 */
1068 version?: string;
1069 /**
1070 * Service dependencies the service expects to be able to match as a mapping
1071 * from dependency names to versions the service is compatible with.
1072 */
1073 provides: Record<string, string>;
1074 /**
1075 * Whether development mode is enabled for this service.
1076 */
1077 development: boolean;
1078 /**
1079 * Whether the service is running in legacy compatibility mode.
1080 */
1081 legacy: boolean;
1082};
1083/**
1084 * Object describing a Foxx service in detail.
1085 */
1086export type ServiceInfo = {
1087 /**
1088 * Service mount point, relative to the database.
1089 */
1090 mount: string;
1091 /**
1092 * File system path of the service.
1093 */
1094 path: string;
1095 /**
1096 * Name defined in the service manifest.
1097 */
1098 name?: string;
1099 /**
1100 * Version defined in the service manifest.
1101 */
1102 version?: string;
1103 /**
1104 * Whether development mode is enabled for this service.
1105 */
1106 development: boolean;
1107 /**
1108 * Whether the service is running in legacy compatibility mode.
1109 */
1110 legacy: boolean;
1111 /**
1112 * Content of the service manifest of this service.
1113 */
1114 manifest: FoxxManifest;
1115 /**
1116 * Internal checksum of the service's initial source bundle.
1117 */
1118 checksum: string;
1119 /**
1120 * Options for this service.
1121 */
1122 options: {
1123 /**
1124 * Configuration values set for this service.
1125 */
1126 configuration: Record<string, any>;
1127 /**
1128 * Service dependency configuration of this service.
1129 */
1130 dependencies: Record<string, string>;
1131 };
1132};
1133/**
1134 * Object describing a configuration option of a Foxx service.
1135 */
1136export type ServiceConfiguration = {
1137 /**
1138 * Data type of the configuration value.
1139 *
1140 * **Note**: `"int"` and `"bool"` are historical synonyms for `"integer"` and
1141 * `"boolean"`. The `"password"` type is synonymous with `"string"` but can
1142 * be used to distinguish values which should not be displayed in plain text
1143 * by software when managing the service.
1144 */
1145 type: "integer" | "boolean" | "string" | "number" | "json" | "password" | "int" | "bool";
1146 /**
1147 * Current value of the configuration option as stored internally.
1148 */
1149 currentRaw: any;
1150 /**
1151 * Processed current value of the configuration option as exposed in the
1152 * service code.
1153 */
1154 current: any;
1155 /**
1156 * Formatted name of the configuration option.
1157 */
1158 title: string;
1159 /**
1160 * Human-readable description of the configuration option.
1161 */
1162 description?: string;
1163 /**
1164 * Whether the configuration option must be set in order for the service
1165 * to be operational.
1166 */
1167 required: boolean;
1168 /**
1169 * Default value of the configuration option.
1170 */
1171 default?: any;
1172};
1173/**
1174 * Object describing a single-service dependency defined by a Foxx service.
1175 */
1176export type SingleServiceDependency = {
1177 /**
1178 * Whether this is a multi-service dependency.
1179 */
1180 multiple: false;
1181 /**
1182 * Current mount point the dependency is resolved to.
1183 */
1184 current?: string;
1185 /**
1186 * Formatted name of the dependency.
1187 */
1188 title: string;
1189 /**
1190 * Name of the service the dependency expects to match.
1191 */
1192 name: string;
1193 /**
1194 * Version of the service the dependency expects to match.
1195 */
1196 version: string;
1197 /**
1198 * Human-readable description of the dependency.
1199 */
1200 description?: string;
1201 /**
1202 * Whether the dependency must be matched in order for the service
1203 * to be operational.
1204 */
1205 required: boolean;
1206};
1207/**
1208 * Object describing a multi-service dependency defined by a Foxx service.
1209 */
1210export type MultiServiceDependency = {
1211 /**
1212 * Whether this is a multi-service dependency.
1213 */
1214 multiple: true;
1215 /**
1216 * Current mount points the dependency is resolved to.
1217 */
1218 current?: string[];
1219 /**
1220 * Formatted name of the dependency.
1221 */
1222 title: string;
1223 /**
1224 * Name of the service the dependency expects to match.
1225 */
1226 name: string;
1227 /**
1228 * Version of the service the dependency expects to match.
1229 */
1230 version: string;
1231 /**
1232 * Human-readable description of the dependency.
1233 */
1234 description?: string;
1235 /**
1236 * Whether the dependency must be matched in order for the service
1237 * to be operational.
1238 */
1239 required: boolean;
1240};
1241/**
1242 * Test stats for a Foxx service's tests.
1243 */
1244export type ServiceTestStats = {
1245 /**
1246 * Total number of tests found.
1247 */
1248 tests: number;
1249 /**
1250 * Number of tests that ran successfully.
1251 */
1252 passes: number;
1253 /**
1254 * Number of tests that failed.
1255 */
1256 failures: number;
1257 /**
1258 * Number of tests skipped or not executed.
1259 */
1260 pending: number;
1261 /**
1262 * Total test duration in milliseconds.
1263 */
1264 duration: number;
1265};
1266/**
1267 * Test results for a single test case using the stream reporter.
1268 */
1269export type ServiceTestStreamTest = {
1270 title: string;
1271 fullTitle: string;
1272 duration: number;
1273 err?: string;
1274};
1275/**
1276 * Test results for a Foxx service's tests using the stream reporter.
1277 */
1278export type ServiceTestStreamReport = (["start", {
1279 total: number;
1280}] | ["pass", ServiceTestStreamTest] | ["fail", ServiceTestStreamTest] | ["end", ServiceTestStats])[];
1281/**
1282 * Test results for a single test case using the suite reporter.
1283 */
1284export type ServiceTestSuiteTest = {
1285 result: "pending" | "pass" | "fail";
1286 title: string;
1287 duration: number;
1288 err?: any;
1289};
1290/**
1291 * Test results for a single test suite using the suite reporter.
1292 */
1293export type ServiceTestSuite = {
1294 title: string;
1295 suites: ServiceTestSuite[];
1296 tests: ServiceTestSuiteTest[];
1297};
1298/**
1299 * Test results for a Foxx service's tests using the suite reporter.
1300 */
1301export type ServiceTestSuiteReport = {
1302 stats: ServiceTestStats;
1303 suites: ServiceTestSuite[];
1304 tests: ServiceTestSuiteTest[];
1305};
1306/**
1307 * Test results for a single test case in XUnit format using the JSONML
1308 * representation.
1309 */
1310export type ServiceTestXunitTest = ["testcase", {
1311 classname: string;
1312 name: string;
1313 time: number;
1314}] | [
1315 "testcase",
1316 {
1317 classname: string;
1318 name: string;
1319 time: number;
1320 },
1321 [
1322 "failure",
1323 {
1324 message: string;
1325 type: string;
1326 },
1327 string
1328 ]
1329];
1330/**
1331 * Test results for a Foxx service's tests in XUnit format using the JSONML
1332 * representation.
1333 */
1334export type ServiceTestXunitReport = [
1335 "testsuite",
1336 {
1337 timestamp: number;
1338 tests: number;
1339 errors: number;
1340 failures: number;
1341 skip: number;
1342 time: number;
1343 },
1344 ...ServiceTestXunitTest[]
1345];
1346/**
1347 * Test results for a Foxx service's tests in TAP format.
1348 */
1349export type ServiceTestTapReport = string[];
1350/**
1351 * Test results for a single test case using the default reporter.
1352 */
1353export type ServiceTestDefaultTest = {
1354 title: string;
1355 fullTitle: string;
1356 duration: number;
1357 err?: string;
1358};
1359/**
1360 * Test results for a Foxx service's tests using the default reporter.
1361 */
1362export type ServiceTestDefaultReport = {
1363 stats: ServiceTestStats;
1364 tests: ServiceTestDefaultTest[];
1365 pending: ServiceTestDefaultTest[];
1366 failures: ServiceTestDefaultTest[];
1367 passes: ServiceTestDefaultTest[];
1368};
1369/**
1370 * OpenAPI 2.0 description of a Foxx service.
1371 */
1372export type SwaggerJson = {
1373 [key: string]: any;
1374 info: {
1375 title: string;
1376 description: string;
1377 version: string;
1378 license: string;
1379 };
1380 path: {
1381 [key: string]: any;
1382 };
1383};
1384/**
1385 * Access level for an ArangoDB user's access to a collection or database.
1386 */
1387export type AccessLevel = "rw" | "ro" | "none";
1388/**
1389 * Properties of an ArangoDB user object.
1390 */
1391export type ArangoUser = {
1392 /**
1393 * ArangoDB username of the user.
1394 */
1395 user: string;
1396 /**
1397 * Whether the ArangoDB user account is enabled and can authenticate.
1398 */
1399 active: boolean;
1400 /**
1401 * Additional information to store about this user.
1402 */
1403 extra: Record<string, any>;
1404};
1405/**
1406 * Options for creating an ArangoDB user.
1407 */
1408export type CreateUserOptions = {
1409 /**
1410 * ArangoDB username of the user.
1411 */
1412 user: string;
1413 /**
1414 * Password the ArangoDB user will use for authentication.
1415 */
1416 passwd: string;
1417 /**
1418 * Whether the ArangoDB user account is enabled and can authenticate.
1419 *
1420 * Default: `true`
1421 */
1422 active?: boolean;
1423 /**
1424 * Additional information to store about this user.
1425 *
1426 * Default: `{}`
1427 */
1428 extra?: Record<string, any>;
1429};
1430/**
1431 * Options for modifying an ArangoDB user.
1432 */
1433export type UserOptions = {
1434 /**
1435 * Password the ArangoDB user will use for authentication.
1436 */
1437 passwd: string;
1438 /**
1439 * Whether the ArangoDB user account is enabled and can authenticate.
1440 *
1441 * Default: `true`
1442 */
1443 active?: boolean;
1444 /**
1445 * Additional information to store about this user.
1446 *
1447 * Default: `{}`
1448 */
1449 extra?: Record<string, any>;
1450};
1451/**
1452 * Options for accessing or manipulating access levels.
1453 */
1454export type UserAccessLevelOptions = {
1455 /**
1456 * The database to access or manipulate the access level of.
1457 *
1458 * If `collection` is an `ArangoCollection`, this option defaults to the
1459 * database the collection is contained in. Otherwise this option defaults to
1460 * the current database.
1461 */
1462 database?: Database | string;
1463 /**
1464 * The collection to access or manipulate the access level of.
1465 */
1466 collection?: ArangoCollection | string;
1467};
1468/**
1469 * An object providing methods for accessing queue time metrics of the most
1470 * recently received server responses if the server supports this feature.
1471 */
1472export type QueueTimeMetrics = {
1473 /**
1474 * Returns the queue time of the most recently received response in seconds.
1475 */
1476 getLatest: () => number | undefined;
1477 /**
1478 * Returns a list of the most recently received queue time values as tuples
1479 * of the timestamp of the response being processed in milliseconds and the
1480 * queue time in seconds.
1481 */
1482 getValues: () => [number, number][];
1483 /**
1484 * Returns the average queue time of the most recently received responses
1485 * in seconds.
1486 */
1487 getAvg: () => number;
1488};
1489/**
1490 * (Enterprise Edition only.) Options for creating a hot backup.
1491 */
1492export type HotBackupOptions = {
1493 /**
1494 * If set to `true` and no global transaction lock can be acquired within the
1495 * given timeout, a possibly inconsistent backup is taken.
1496 *
1497 * Default: `false`
1498 */
1499 allowInconsistent?: boolean;
1500 /**
1501 * (Enterprise Edition cluster only.) If set to `true` and no global
1502 * transaction lock can be acquired within the given timeout, all running
1503 * transactions are forcefully aborted to ensure that a consistent backup
1504 * can be created.
1505 *
1506 * Default: `false`.
1507 */
1508 force?: boolean;
1509 /**
1510 * Label to appended to the backup's identifier.
1511 *
1512 * Default: If omitted or empty, a UUID will be generated.
1513 */
1514 label?: string;
1515 /**
1516 * Time in seconds that the operation will attempt to get a consistent
1517 * snapshot.
1518 *
1519 * Default: `120`.
1520 */
1521 timeout?: number;
1522};
1523/**
1524 * (Enterprise Edition only.) Result of a hot backup.
1525 */
1526export type HotBackupResult = {
1527 id: string;
1528 potentiallyInconsistent: boolean;
1529 sizeInBytes: number;
1530 datetime: string;
1531 nrDBServers: number;
1532 nrFiles: number;
1533};
1534/**
1535 * (Enterprise Edition only.) List of known hot backups.
1536 */
1537export type HotBackupList = {
1538 server: string;
1539 list: Record<string, HotBackupResult & {
1540 version: string;
1541 keys: any[];
1542 available: boolean;
1543 nrPiecesPresent: number;
1544 countIncludesFilesOnly: boolean;
1545 }>;
1546};
1547/**
1548 * Numeric representation of the logging level of a log entry.
1549 */
1550export declare enum LogLevel {
1551 FATAL = 0,
1552 ERROR = 1,
1553 WARNING = 2,
1554 INFO = 3,
1555 DEBUG = 4
1556}
1557/**
1558 * String representation of the logging level of a log entry.
1559 */
1560export type LogLevelLabel = "FATAL" | "ERROR" | "WARNING" | "INFO" | "DEBUG";
1561/**
1562 * Logging level setting.
1563 */
1564export type LogLevelSetting = LogLevelLabel | "DEFAULT";
1565/**
1566 * Log sorting direction, ascending or descending.
1567 */
1568export type LogSortDirection = "asc" | "desc";
1569/**
1570 * Options for retrieving log entries.
1571 */
1572export type LogEntriesOptions = {
1573 /**
1574 * Maximum log level of the entries to retrieve.
1575 *
1576 * Default: `INFO`.
1577 */
1578 upto?: LogLevel | LogLevelLabel | Lowercase<LogLevelLabel>;
1579 /**
1580 * If set, only log entries with this log level will be returned.
1581 */
1582 level?: LogLevel | LogLevelLabel | Lowercase<LogLevelLabel>;
1583 /**
1584 * If set, only log entries with an `lid` greater than or equal to this value
1585 * will be returned.
1586 */
1587 start?: number;
1588 /**
1589 * If set, only this many entries will be returned.
1590 */
1591 size?: number;
1592 /**
1593 * If set, this many log entries will be skipped.
1594 */
1595 offset?: number;
1596 /**
1597 * If set, only log entries containing the specified text will be returned.
1598 */
1599 search?: string;
1600 /**
1601 * If set to `"desc"`, log entries will be returned in reverse chronological
1602 * order.
1603 *
1604 * Default: `"asc"`.
1605 */
1606 sort?: LogSortDirection;
1607};
1608/**
1609 * An object representing a single log entry.
1610 */
1611export type LogMessage = {
1612 id: number;
1613 topic: string;
1614 level: LogLevelLabel;
1615 date: string;
1616 message: string;
1617};
1618/**
1619 * An object representing a list of log entries.
1620 */
1621export type LogEntries = {
1622 totalAmount: number;
1623 lid: number[];
1624 topic: string[];
1625 level: LogLevel[];
1626 timestamp: number[];
1627 text: string[];
1628};
1629type TrappedError = {
1630 error: true;
1631};
1632type TrappedRequest = {
1633 error?: false;
1634 jobId: string;
1635 onResolve: (res: ArangojsResponse) => void;
1636 onReject: (error: any) => void;
1637};
1638/**
1639 * An object representing a single ArangoDB database. All arangojs collections,
1640 * cursors, analyzers and so on are linked to a `Database` object.
1641 */
1642export declare class Database {
1643 protected _connection: Connection;
1644 protected _name: string;
1645 protected _analyzers: Map<string, Analyzer>;
1646 protected _collections: Map<string, Collection<any, any>>;
1647 protected _graphs: Map<string, Graph>;
1648 protected _views: Map<string, View>;
1649 protected _trapRequest?: (trapped: TrappedError | TrappedRequest) => void;
1650 /**
1651 * Creates a new `Database` instance with its own connection pool.
1652 *
1653 * See also {@link Database#database}.
1654 *
1655 * @param config - An object with configuration options.
1656 *
1657 * @example
1658 * ```js
1659 * const db = new Database({
1660 * url: "http://127.0.0.1:8529",
1661 * databaseName: "my_database",
1662 * auth: { username: "admin", password: "hunter2" },
1663 * });
1664 * ```
1665 */
1666 constructor(config?: Config);
1667 /**
1668 * Creates a new `Database` instance with its own connection pool.
1669 *
1670 * See also {@link Database#database}.
1671 *
1672 * @param url - Base URL of the ArangoDB server or list of server URLs.
1673 * Equivalent to the `url` option in {@link connection.Config}.
1674 *
1675 * @example
1676 * ```js
1677 * const db = new Database("http://127.0.0.1:8529", "my_database");
1678 * db.useBasicAuth("admin", "hunter2");
1679 * ```
1680 */
1681 constructor(url: string | string[], name?: string);
1682 /**
1683 * @internal
1684 */
1685 constructor(database: Database, name?: string);
1686 /**
1687 * @internal
1688 *
1689 * Indicates that this object represents an ArangoDB database.
1690 */
1691 get isArangoDatabase(): true;
1692 /**
1693 * Name of the ArangoDB database this instance represents.
1694 */
1695 get name(): string;
1696 /**
1697 * Fetches version information from the ArangoDB server.
1698 *
1699 * @param details - If set to `true`, additional information about the
1700 * ArangoDB server will be available as the `details` property.
1701 *
1702 * @example
1703 * ```js
1704 * const db = new Database();
1705 * const version = await db.version();
1706 * // the version object contains the ArangoDB version information.
1707 * // license: "community" or "enterprise"
1708 * // version: ArangoDB version number
1709 * // server: description of the server
1710 * ```
1711 */
1712 version(details?: boolean): Promise<VersionInfo>;
1713 /**
1714 * Retrives the server's current system time in milliseconds with microsecond
1715 * precision.
1716 */
1717 time(): Promise<number>;
1718 /**
1719 * Returns a new {@link route.Route} instance for the given path (relative to the
1720 * database) that can be used to perform arbitrary HTTP requests.
1721 *
1722 * @param path - The database-relative URL of the route. Defaults to the
1723 * database API root.
1724 * @param headers - Default headers that should be sent with each request to
1725 * the route.
1726 *
1727 * @example
1728 * ```js
1729 * const db = new Database();
1730 * const myFoxxService = db.route("my-foxx-service");
1731 * const response = await myFoxxService.post("users", {
1732 * username: "admin",
1733 * password: "hunter2"
1734 * });
1735 * // response.body is the result of
1736 * // POST /_db/_system/my-foxx-service/users
1737 * // with JSON request body '{"username": "admin", "password": "hunter2"}'
1738 * ```
1739 */
1740 route(path?: string, headers?: Headers | Record<string, string>): Route;
1741 /**
1742 * Creates an async job by executing the given callback function. The first
1743 * database request performed by the callback will be marked for asynchronous
1744 * execution and its result will be made available as an async job.
1745 *
1746 * Returns a {@link Job} instance that can be used to retrieve the result
1747 * of the callback function once the request has been executed.
1748 *
1749 * @param callback - Callback function to execute as an async job.
1750 *
1751 * @example
1752 * ```js
1753 * const db = new Database();
1754 * const job = await db.createJob(() => db.collections());
1755 * while (!job.isLoaded) {
1756 * await timeout(1000);
1757 * await job.load();
1758 * }
1759 * // job.result is a list of Collection instances
1760 * ```
1761 */
1762 createJob<T>(callback: () => Promise<T>): Promise<Job<T>>;
1763 /**
1764 * @internal
1765 *
1766 * Performs an arbitrary HTTP request against the database.
1767 *
1768 * If `absolutePath` is set to `true`, the database path will not be
1769 * automatically prepended to the `basePath`.
1770 *
1771 * @param T - Return type to use. Defaults to the response object type.
1772 * @param options - Options for this request.
1773 * @param transform - An optional function to transform the low-level
1774 * response object to a more useful return value.
1775 */
1776 request<T = any>(options: RequestOptions & {
1777 absolutePath?: boolean;
1778 }, transform?: (res: ArangojsResponse) => T): Promise<T>;
1779 /**
1780 * @internal
1781 *
1782 * Performs an arbitrary HTTP request against the database.
1783 *
1784 * If `absolutePath` is set to `true`, the database path will not be
1785 * automatically prepended to the `basePath`.
1786 *
1787 * @param options - Options for this request.
1788 * @param transform - If set to `false`, the raw response object will be
1789 * returned.
1790 */
1791 request(options: RequestOptions & {
1792 absolutePath?: boolean;
1793 }, transform: false): Promise<ArangojsResponse>;
1794 /**
1795 * Updates the URL list by requesting a list of all coordinators in the
1796 * cluster and adding any endpoints not initially specified in the
1797 * {@link connection.Config}.
1798 *
1799 * For long-running processes communicating with an ArangoDB cluster it is
1800 * recommended to run this method periodically (e.g. once per hour) to make
1801 * sure new coordinators are picked up correctly and can be used for
1802 * fail-over or load balancing.
1803 *
1804 * @param overwrite - If set to `true`, the existing host list will be
1805 * replaced instead of extended.
1806 *
1807 * @example
1808 * ```js
1809 * const db = new Database();
1810 * const interval = setInterval(
1811 * () => db.acquireHostList(),
1812 * 5 * 60 * 1000 // every 5 minutes
1813 * );
1814 *
1815 * // later
1816 * clearInterval(interval);
1817 * system.close();
1818 * ```
1819 */
1820 acquireHostList(overwrite?: boolean): Promise<void>;
1821 /**
1822 * Closes all active connections of this database instance.
1823 *
1824 * Can be used to clean up idling connections during longer periods of
1825 * inactivity.
1826 *
1827 * **Note**: This method currently has no effect in the browser version of
1828 * arangojs.
1829 *
1830 * @example
1831 * ```js
1832 * const db = new Database();
1833 * const sessions = db.collection("sessions");
1834 * // Clean up expired sessions once per hour
1835 * setInterval(async () => {
1836 * await db.query(aql`
1837 * FOR session IN ${sessions}
1838 * FILTER session.expires < DATE_NOW()
1839 * REMOVE session IN ${sessions}
1840 * `);
1841 * // Making sure to close the connections because they're no longer used
1842 * system.close();
1843 * }, 1000 * 60 * 60);
1844 * ```
1845 */
1846 close(): void;
1847 /**
1848 * Attempts to initiate a clean shutdown of the server.
1849 */
1850 shutdown(): Promise<void>;
1851 /**
1852 * Performs a request against every known coordinator and returns when the
1853 * request has succeeded against every coordinator or the timeout is reached.
1854 *
1855 * **Note**: This method is primarily intended to make database setup easier
1856 * in cluster scenarios and requires all coordinators to be known to arangojs
1857 * before the method is invoked. The method is not useful in single-server or
1858 * leader-follower replication scenarios.
1859 *
1860 * @example
1861 * ```js
1862 * const db = new Database({ loadBalancingStrategy: "ROUND_ROBIN" });
1863 * await system.acquireHostList();
1864 * const analyzer = db.analyzer("my-analyzer");
1865 * await analyzer.create();
1866 * await db.waitForPropagation(
1867 * { path: `/_api/analyzer/${encodeURIComponent(analyzer.name)}` },
1868 * 30000
1869 * );
1870 * // Analyzer has been propagated to all coordinators and can safely be used
1871 * ```
1872 *
1873 * @param request - Request to perform against each known coordinator.
1874 * @param timeout - Maximum number of milliseconds to wait for propagation.
1875 */
1876 waitForPropagation(request: RequestOptions, timeout?: number): Promise<void>;
1877 /**
1878 * Methods for accessing the server-reported queue times of the mostly
1879 * recently received responses.
1880 */
1881 get queueTime(): QueueTimeMetrics;
1882 /**
1883 * Sets the limit for the number of values of the most recently received
1884 * server-reported queue times that can be accessed using
1885 * {@link Database#queueTime}.
1886 *
1887 * @param responseQueueTimeSamples - Number of values to maintain.
1888 */
1889 setResponseQueueTimeSamples(responseQueueTimeSamples: number): void;
1890 /**
1891 * Updates the underlying connection's `authorization` header to use Basic
1892 * authentication with the given `username` and `password`, then returns
1893 * itself.
1894 *
1895 * @param username - The username to authenticate with.
1896 * @param password - The password to authenticate with.
1897 *
1898 * @example
1899 * ```js
1900 * const db = new Database();
1901 * db.useBasicAuth("admin", "hunter2");
1902 * // with the username "admin" and password "hunter2".
1903 * ```
1904 */
1905 useBasicAuth(username?: string, password?: string): this;
1906 /**
1907 * Updates the underlying connection's `authorization` header to use Bearer
1908 * authentication with the given authentication `token`, then returns itself.
1909 *
1910 * @param token - The token to authenticate with.
1911 *
1912 * @example
1913 * ```js
1914 * const db = new Database();
1915 * db.useBearerAuth("keyboardcat");
1916 * // The database instance now uses Bearer authentication.
1917 * ```
1918 */
1919 useBearerAuth(token: string): this;
1920 /**
1921 * Validates the given database credentials and exchanges them for an
1922 * authentication token, then uses the authentication token for future
1923 * requests and returns it.
1924 *
1925 * @param username - The username to authenticate with.
1926 * @param password - The password to authenticate with.
1927 *
1928 * @example
1929 * ```js
1930 * const db = new Database();
1931 * await db.login("admin", "hunter2");
1932 * // with an authentication token for the "admin" user.
1933 * ```
1934 */
1935 login(username?: string, password?: string): Promise<string>;
1936 /**
1937 * Attempts to renew the authentication token passed to {@link Database#useBearerAuth}
1938 * or returned and used by {@link Database#login}. If a new authentication
1939 * token is issued, it will be used for future requests and returned.
1940 *
1941 * @example
1942 * ```js
1943 * const db = new Database();
1944 * await db.login("admin", "hunter2");
1945 * // ... later ...
1946 * const newToken = await db.renewAuthToken();
1947 * if (!newToken) // no new token issued
1948 * ```
1949 */
1950 renewAuthToken(): Promise<string | null>;
1951 /**
1952 * Computes the current cluster imbalance.
1953 *
1954 * @example
1955 * ```js
1956 * const db = new Database();
1957 * const imbalance = await db.getClusterImbalance();
1958 * ```
1959 */
1960 getClusterImbalance(): Promise<ClusterRebalanceState>;
1961 /**
1962 * Computes a set of move shard operations to rebalance the cluster.
1963 *
1964 * @example
1965 * ```js
1966 * const db = new Database();
1967 * const result = await db.computerClusterRebalance({
1968 * moveLeaders: true,
1969 * moveFollowers: true
1970 * });
1971 * if (result.moves.length) {
1972 * await db.executeClusterRebalance(result.moves);
1973 * }
1974 * ```
1975 */
1976 computeClusterRebalance(opts: ClusterRebalanceOptions): Promise<ClusterRebalanceResult>;
1977 /**
1978 * Executes the given cluster move shard operations.
1979 *
1980 * @example
1981 * ```js
1982 * const db = new Database();
1983 * const result = await db.computerClusterRebalance({
1984 * moveLeaders: true,
1985 * moveFollowers: true
1986 * });
1987 * if (result.moves.length) {
1988 * await db.executeClusterRebalance(result.moves);
1989 * }
1990 * ```
1991 */
1992 executeClusterRebalance(moves: ClusterRebalanceMove[]): Promise<unknown>;
1993 /**
1994 * Computes a set of move shard operations to rebalance the cluster and
1995 * executes them.
1996 *
1997 * @example
1998 * ```js
1999 * const db = new Database();
2000 * const result = await db.rebalanceCluster({
2001 * moveLeaders: true,
2002 * moveFollowers: true
2003 * });
2004 * // The cluster is now rebalanced.
2005 * ```
2006 */
2007 rebalanceCluster(opts: ClusterRebalanceOptions): Promise<ClusterRebalanceResult>;
2008 /**
2009 * Creates a new `Database` instance for the given `databaseName` that
2010 * shares this database's connection pool.
2011 *
2012 * See also {@link Database:constructor}.
2013 *
2014 * @param databaseName - Name of the database.
2015 *
2016 * @example
2017 * ```js
2018 * const systemDb = new Database();
2019 * const myDb = system.database("my_database");
2020 * ```
2021 */
2022 database(databaseName: string): Database;
2023 /**
2024 * Fetches the database description for the active database from the server.
2025 *
2026 * @example
2027 * ```js
2028 * const db = new Database();
2029 * const info = await db.get();
2030 * // the database exists
2031 * ```
2032 */
2033 get(): Promise<DatabaseInfo>;
2034 /**
2035 * Checks whether the database exists.
2036 *
2037 * @example
2038 * ```js
2039 * const db = new Database();
2040 * const result = await db.exists();
2041 * // result indicates whether the database exists
2042 * ```
2043 */
2044 exists(): Promise<boolean>;
2045 /**
2046 * Creates a new database with the given `databaseName` with the given
2047 * `options` and returns a `Database` instance for that database.
2048 *
2049 * @param databaseName - Name of the database to create.
2050 * @param options - Options for creating the database.
2051 *
2052 * @example
2053 * ```js
2054 * const db = new Database();
2055 * const info = await db.createDatabase("mydb", {
2056 * users: [{ username: "root" }]
2057 * });
2058 * // the database has been created
2059 * ```
2060 */
2061 createDatabase(databaseName: string, options?: CreateDatabaseOptions): Promise<Database>;
2062 /**
2063 * Creates a new database with the given `databaseName` with the given
2064 * `users` and returns a `Database` instance for that database.
2065 *
2066 * @param databaseName - Name of the database to create.
2067 * @param users - Database users to create with the database.
2068 *
2069 * @example
2070 * ```js
2071 * const db = new Database();
2072 * const info = await db.createDatabase("mydb", [{ username: "root" }]);
2073 * // the database has been created
2074 * ```
2075 */
2076 createDatabase(databaseName: string, users: CreateDatabaseUser[]): Promise<Database>;
2077 /**
2078 * Fetches all databases from the server and returns an array of their names.
2079 *
2080 * See also {@link Database#databases} and
2081 * {@link Database#listUserDatabases}.
2082 *
2083 * @example
2084 * ```js
2085 * const db = new Database();
2086 * const names = await db.listDatabases();
2087 * // databases is an array of database names
2088 * ```
2089 */
2090 listDatabases(): Promise<string[]>;
2091 /**
2092 * Fetches all databases accessible to the active user from the server and
2093 * returns an array of their names.
2094 *
2095 * See also {@link Database#userDatabases} and
2096 * {@link Database#listDatabases}.
2097 *
2098 * @example
2099 * ```js
2100 * const db = new Database();
2101 * const names = await db.listUserDatabases();
2102 * // databases is an array of database names
2103 * ```
2104 */
2105 listUserDatabases(): Promise<string[]>;
2106 /**
2107 * Fetches all databases from the server and returns an array of `Database`
2108 * instances for those databases.
2109 *
2110 * See also {@link Database#listDatabases} and
2111 * {@link Database#userDatabases}.
2112 *
2113 * @example
2114 * ```js
2115 * const db = new Database();
2116 * const names = await db.databases();
2117 * // databases is an array of databases
2118 * ```
2119 */
2120 databases(): Promise<Database[]>;
2121 /**
2122 * Fetches all databases accessible to the active user from the server and
2123 * returns an array of `Database` instances for those databases.
2124 *
2125 * See also {@link Database#listUserDatabases} and
2126 * {@link Database#databases}.
2127 *
2128 * @example
2129 * ```js
2130 * const db = new Database();
2131 * const names = await db.userDatabases();
2132 * // databases is an array of databases
2133 * ```
2134 */
2135 userDatabases(): Promise<Database[]>;
2136 /**
2137 * Deletes the database with the given `databaseName` from the server.
2138 *
2139 * @param databaseName - Name of the database to delete.
2140 *
2141 * @example
2142 * ```js
2143 * const db = new Database();
2144 * await db.dropDatabase("mydb");
2145 * // database "mydb" no longer exists
2146 * ```
2147 */
2148 dropDatabase(databaseName: string): Promise<boolean>;
2149 /**
2150 * Returns a `Collection` instance for the given collection name.
2151 *
2152 * In TypeScript the collection implements both the
2153 * {@link collection.DocumentCollection} and {@link collection.EdgeCollection}
2154 * interfaces and can be cast to either type to enforce a stricter API.
2155 *
2156 * @param T - Type to use for document data. Defaults to `any`.
2157 * @param collectionName - Name of the edge collection.
2158 *
2159 * @example
2160 * ```js
2161 * const db = new Database();
2162 * const collection = db.collection("potatoes");
2163 * ```
2164 *
2165 * @example
2166 * ```ts
2167 * interface Person {
2168 * name: string;
2169 * }
2170 * const db = new Database();
2171 * const persons = db.collection<Person>("persons");
2172 * ```
2173 *
2174 * @example
2175 * ```ts
2176 * interface Person {
2177 * name: string;
2178 * }
2179 * interface Friend {
2180 * startDate: number;
2181 * endDate?: number;
2182 * }
2183 * const db = new Database();
2184 * const documents = db.collection("persons") as DocumentCollection<Person>;
2185 * const edges = db.collection("friends") as EdgeCollection<Friend>;
2186 * ```
2187 */
2188 collection<T extends Record<string, any> = any>(collectionName: string): DocumentCollection<T> & EdgeCollection<T>;
2189 /**
2190 * Creates a new collection with the given `collectionName` and `options`,
2191 * then returns a {@link collection.DocumentCollection} instance for the new collection.
2192 *
2193 * @param T - Type to use for document data. Defaults to `any`.
2194 * @param collectionName - Name of the new collection.
2195 * @param options - Options for creating the collection.
2196 *
2197 * @example
2198 * ```ts
2199 * const db = new Database();
2200 * const documents = db.createCollection("persons");
2201 * ```
2202 *
2203 * @example
2204 * ```ts
2205 * interface Person {
2206 * name: string;
2207 * }
2208 * const db = new Database();
2209 * const documents = db.createCollection<Person>("persons");
2210 * ```
2211 */
2212 createCollection<T extends Record<string, any> = any>(collectionName: string, options?: CreateCollectionOptions & {
2213 type?: CollectionType.DOCUMENT_COLLECTION;
2214 }): Promise<DocumentCollection<T>>;
2215 /**
2216 * Creates a new edge collection with the given `collectionName` and
2217 * `options`, then returns an {@link collection.EdgeCollection} instance for the new
2218 * edge collection.
2219 *
2220 * @param T - Type to use for edge document data. Defaults to `any`.
2221 * @param collectionName - Name of the new collection.
2222 * @param options - Options for creating the collection.
2223 *
2224 * @example
2225 * ```js
2226 * const db = new Database();
2227 * const edges = db.createCollection("friends", {
2228 * type: CollectionType.EDGE_COLLECTION
2229 * });
2230 * ```
2231 *
2232 * @example
2233 * ```ts
2234 * interface Friend {
2235 * startDate: number;
2236 * endDate?: number;
2237 * }
2238 * const db = new Database();
2239 * const edges = db.createCollection<Friend>("friends", {
2240 * type: CollectionType.EDGE_COLLECTION
2241 * });
2242 * ```
2243 */
2244 createCollection<T extends Record<string, any> = any>(collectionName: string, options: CreateCollectionOptions & {
2245 type: CollectionType.EDGE_COLLECTION;
2246 }): Promise<EdgeCollection<T>>;
2247 /**
2248 * Creates a new edge collection with the given `collectionName` and
2249 * `options`, then returns an {@link collection.EdgeCollection} instance for the new
2250 * edge collection.
2251 *
2252 * This is a convenience method for calling {@link Database#createCollection}
2253 * with `options.type` set to `EDGE_COLLECTION`.
2254 *
2255 * @param T - Type to use for edge document data. Defaults to `any`.
2256 * @param collectionName - Name of the new collection.
2257 * @param options - Options for creating the collection.
2258 *
2259 * @example
2260 * ```js
2261 * const db = new Database();
2262 * const edges = db.createEdgeCollection("friends");
2263 * ```
2264 *
2265 * @example
2266 * ```ts
2267 * interface Friend {
2268 * startDate: number;
2269 * endDate?: number;
2270 * }
2271 * const db = new Database();
2272 * const edges = db.createEdgeCollection<Friend>("friends");
2273 * ```
2274 */
2275 createEdgeCollection<T extends Record<string, any> = any>(collectionName: string, options?: CreateCollectionOptions): Promise<EdgeCollection<T>>;
2276 /**
2277 * Renames the collection `collectionName` to `newName`.
2278 *
2279 * Additionally removes any stored `Collection` instance for
2280 * `collectionName` from the `Database` instance's internal cache.
2281 *
2282 * **Note**: Renaming collections may not be supported when ArangoDB is
2283 * running in a cluster configuration.
2284 *
2285 * @param collectionName - Current name of the collection.
2286 * @param newName - The new name of the collection.
2287 */
2288 renameCollection(collectionName: string, newName: string): Promise<ArangoApiResponse<CollectionMetadata>>;
2289 /**
2290 * Fetches all collections from the database and returns an array of
2291 * collection descriptions.
2292 *
2293 * See also {@link Database#collections}.
2294 *
2295 * @param excludeSystem - Whether system collections should be excluded.
2296 *
2297 * @example
2298 * ```js
2299 * const db = new Database();
2300 * const collections = await db.listCollections();
2301 * // collections is an array of collection descriptions
2302 * // not including system collections
2303 * ```
2304 *
2305 * @example
2306 * ```js
2307 * const db = new Database();
2308 * const collections = await db.listCollections(false);
2309 * // collections is an array of collection descriptions
2310 * // including system collections
2311 * ```
2312 */
2313 listCollections(excludeSystem?: boolean): Promise<CollectionMetadata[]>;
2314 /**
2315 * Fetches all collections from the database and returns an array of
2316 * `Collection` instances.
2317 *
2318 * In TypeScript these instances implement both the
2319 * {@link collection.DocumentCollection} and {@link collection.EdgeCollection}
2320 * interfaces and can be cast to either type to enforce a stricter API.
2321 *
2322 * See also {@link Database#listCollections}.
2323 *
2324 * @param excludeSystem - Whether system collections should be excluded.
2325 *
2326 * @example
2327 * ```js
2328 * const db = new Database();
2329 * const collections = await db.collections();
2330 * // collections is an array of DocumentCollection and EdgeCollection
2331 * // instances not including system collections
2332 * ```
2333 *
2334 * @example
2335 * ```js
2336 * const db = new Database();
2337 * const collections = await db.collections(false);
2338 * // collections is an array of DocumentCollection and EdgeCollection
2339 * // instances including system collections
2340 * ```
2341 */
2342 collections(excludeSystem?: boolean): Promise<Array<DocumentCollection & EdgeCollection>>;
2343 /**
2344 * Returns a {@link graph.Graph} instance representing the graph with the given
2345 * `graphName`.
2346 *
2347 * @param graphName - Name of the graph.
2348 *
2349 * @example
2350 * ```js
2351 * const db = new Database();
2352 * const graph = db.graph("some-graph");
2353 * ```
2354 */
2355 graph(graphName: string): Graph;
2356 /**
2357 * Creates a graph with the given `graphName` and `edgeDefinitions`, then
2358 * returns a {@link graph.Graph} instance for the new graph.
2359 *
2360 * @param graphName - Name of the graph to be created.
2361 * @param edgeDefinitions - An array of edge definitions.
2362 * @param options - An object defining the properties of the graph.
2363 */
2364 createGraph(graphName: string, edgeDefinitions: EdgeDefinitionOptions[], options?: CreateGraphOptions): Promise<Graph>;
2365 /**
2366 * Fetches all graphs from the database and returns an array of graph
2367 * descriptions.
2368 *
2369 * See also {@link Database#graphs}.
2370 *
2371 * @example
2372 * ```js
2373 * const db = new Database();
2374 * const graphs = await db.listGraphs();
2375 * // graphs is an array of graph descriptions
2376 * ```
2377 */
2378 listGraphs(): Promise<GraphInfo[]>;
2379 /**
2380 * Fetches all graphs from the database and returns an array of {@link graph.Graph}
2381 * instances for those graphs.
2382 *
2383 * See also {@link Database#listGraphs}.
2384 *
2385 * @example
2386 * ```js
2387 * const db = new Database();
2388 * const graphs = await db.graphs();
2389 * // graphs is an array of Graph instances
2390 * ```
2391 */
2392 graphs(): Promise<Graph[]>;
2393 /**
2394 * Returns a {@link view.View} instance for the given `viewName`.
2395 *
2396 * @param viewName - Name of the ArangoSearch or SearchAlias View.
2397 *
2398 * @example
2399 * ```js
2400 * const db = new Database();
2401 * const view = db.view("potatoes");
2402 * ```
2403 */
2404 view(viewName: string): View;
2405 /**
2406 * Creates a new View with the given `viewName` and `options`, then returns a
2407 * {@link view.View} instance for the new View.
2408 *
2409 * @param viewName - Name of the View.
2410 * @param options - An object defining the properties of the View.
2411 *
2412 * @example
2413 * ```js
2414 * const db = new Database();
2415 * const view = await db.createView("potatoes", { type: "arangosearch" });
2416 * // the ArangoSearch View "potatoes" now exists
2417 * ```
2418 */
2419 createView(viewName: string, options: CreateViewOptions): Promise<View>;
2420 /**
2421 * Renames the view `viewName` to `newName`.
2422 *
2423 * Additionally removes any stored {@link view.View} instance for `viewName` from
2424 * the `Database` instance's internal cache.
2425 *
2426 * **Note**: Renaming views may not be supported when ArangoDB is running in
2427 * a cluster configuration.
2428 *
2429 * @param viewName - Current name of the view.
2430 * @param newName - The new name of the view.
2431 */
2432 renameView(viewName: string, newName: string): Promise<ArangoApiResponse<ViewDescription>>;
2433 /**
2434 * Fetches all Views from the database and returns an array of View
2435 * descriptions.
2436 *
2437 * See also {@link Database#views}.
2438 *
2439 * @example
2440 * ```js
2441 * const db = new Database();
2442 *
2443 * const views = await db.listViews();
2444 * // views is an array of View descriptions
2445 * ```
2446 */
2447 listViews(): Promise<ViewDescription[]>;
2448 /**
2449 * Fetches all Views from the database and returns an array of
2450 * {@link view.View} instances
2451 * for the Views.
2452 *
2453 * See also {@link Database#listViews}.
2454 *
2455 * @example
2456 * ```js
2457 * const db = new Database();
2458 * const views = await db.views();
2459 * // views is an array of ArangoSearch View instances
2460 * ```
2461 */
2462 views(): Promise<View[]>;
2463 /**
2464 * Returns an {@link analyzer.Analyzer} instance representing the Analyzer with the
2465 * given `analyzerName`.
2466 *
2467 * @example
2468 * ```js
2469 * const db = new Database();
2470 * const analyzer = db.analyzer("some-analyzer");
2471 * const info = await analyzer.get();
2472 * ```
2473 */
2474 analyzer(analyzerName: string): Analyzer;
2475 /**
2476 * Creates a new Analyzer with the given `analyzerName` and `options`, then
2477 * returns an {@link analyzer.Analyzer} instance for the new Analyzer.
2478 *
2479 * @param analyzerName - Name of the Analyzer.
2480 * @param options - An object defining the properties of the Analyzer.
2481 *
2482 * @example
2483 * ```js
2484 * const db = new Database();
2485 * const analyzer = await db.createAnalyzer("potatoes", { type: "identity" });
2486 * // the identity Analyzer "potatoes" now exists
2487 * ```
2488 */
2489 createAnalyzer(analyzerName: string, options: CreateAnalyzerOptions): Promise<Analyzer>;
2490 /**
2491 * Fetches all Analyzers visible in the database and returns an array of
2492 * Analyzer descriptions.
2493 *
2494 * See also {@link Database#analyzers}.
2495 *
2496 * @example
2497 * ```js
2498 * const db = new Database();
2499 * const analyzers = await db.listAnalyzers();
2500 * // analyzers is an array of Analyzer descriptions
2501 * ```
2502 */
2503 listAnalyzers(): Promise<AnalyzerDescription[]>;
2504 /**
2505 * Fetches all Analyzers visible in the database and returns an array of
2506 * {@link analyzer.Analyzer} instances for those Analyzers.
2507 *
2508 * See also {@link Database#listAnalyzers}.
2509 *
2510 * @example
2511 * ```js
2512 * const db = new Database();
2513 * const analyzers = await db.analyzers();
2514 * // analyzers is an array of Analyzer instances
2515 * ```
2516 */
2517 analyzers(): Promise<Analyzer[]>;
2518 /**
2519 * Fetches all ArangoDB users visible to the authenticated user and returns
2520 * an array of user objects.
2521 *
2522 * @example
2523 * ```js
2524 * const db = new Database();
2525 * const users = await db.listUsers();
2526 * // users is an array of user objects
2527 * ```
2528 */
2529 listUsers(): Promise<ArangoUser[]>;
2530 /**
2531 * Fetches the user data of a single ArangoDB user.
2532 *
2533 * @param username - Name of the ArangoDB user to fetch.
2534 *
2535 * @example
2536 * ```js
2537 * const db = new Database();
2538 * const user = await db.getUser("steve");
2539 * // user is the user object for the user named "steve"
2540 * ```
2541 */
2542 getUser(username: string): Promise<ArangoApiResponse<ArangoUser>>;
2543 /**
2544 * Creates a new ArangoDB user with the given password.
2545 *
2546 * @param username - Name of the ArangoDB user to create.
2547 * @param passwd - Password of the new ArangoDB user.
2548 *
2549 * @example
2550 * ```js
2551 * const db = new Database();
2552 * const user = await db.createUser("steve", "hunter2");
2553 * // The user "steve" has been created
2554 * ```
2555 */
2556 createUser(username: string, passwd: string): Promise<ArangoApiResponse<ArangoUser>>;
2557 /**
2558 * Creates a new ArangoDB user with the given options.
2559 *
2560 * @param username - Name of the ArangoDB user to create.
2561 * @param options - Additional options for creating the ArangoDB user.
2562 *
2563 * @example
2564 * ```js
2565 * const db = new Database();
2566 * const user = await db.createUser("steve", { passwd: "hunter2" });
2567 * // The user "steve" has been created
2568 * ```
2569 */
2570 createUser(username: string, options: UserOptions): Promise<ArangoApiResponse<ArangoUser>>;
2571 /**
2572 * Sets the password of a given ArangoDB user to the new value.
2573 *
2574 * @param username - Name of the ArangoDB user to change the password for.
2575 * @param passwd - New password for the ArangoDB user.
2576 *
2577 * @example
2578 * ```js
2579 * const db = new Database();
2580 * const user = await db.updateUser("steve", "hunter2");
2581 * // The user "steve" has received a new password
2582 * ```
2583 */
2584 updateUser(username: string, passwd: string): Promise<ArangoApiResponse<ArangoUser>>;
2585 /**
2586 * Updates the ArangoDB user with the new options.
2587 *
2588 * @param username - Name of the ArangoDB user to modify.
2589 * @param options - Options of the ArangoDB user to modify.
2590 *
2591 * @example
2592 * ```js
2593 * const db = new Database();
2594 * const user = await db.updateUser("steve", { active: false });
2595 * // The user "steve" has been set to inactive
2596 * ```
2597 */
2598 updateUser(username: string, options: Partial<UserOptions>): Promise<ArangoApiResponse<ArangoUser>>;
2599 /**
2600 * Replaces the ArangoDB user's option with the new options.
2601 *
2602 * @param username - Name of the ArangoDB user to modify.
2603 * @param options - New options to replace the user's existing options.
2604 *
2605 * @example
2606 * ```js
2607 * const db = new Database();
2608 * const user = await db.replaceUser("steve", { passwd: "", active: false });
2609 * // The user "steve" has been set to inactive with an empty password
2610 * ```
2611 */
2612 replaceUser(username: string, options: UserOptions): Promise<ArangoApiResponse<ArangoUser>>;
2613 /**
2614 * Removes the ArangoDB user with the given username from the server.
2615 *
2616 * @param username - Name of the ArangoDB user to remove.
2617 *
2618 * @example
2619 * ```js
2620 * const db = new Database();
2621 * await db.removeUser("steve");
2622 * // The user "steve" has been removed
2623 * ```
2624 */
2625 removeUser(username: string): Promise<ArangoApiResponse<Record<string, never>>>;
2626 /**
2627 * Fetches the given ArangoDB user's access level for the database, or the
2628 * given collection in the given database.
2629 *
2630 * @param username - Name of the ArangoDB user to fetch the access level for.
2631 * @param database - Database to fetch the access level for.
2632 * @param collection - Collection to fetch the access level for.
2633 *
2634 * @example
2635 * ```js
2636 * const db = new Database();
2637 * const accessLevel = await db.getUserAccessLevel("steve");
2638 * // The access level of the user "steve" has been fetched for the current
2639 * // database.
2640 * ```
2641 *
2642 * @example
2643 * ```js
2644 * const db = new Database();
2645 * const accessLevel = await db.getUserAccessLevel("steve", {
2646 * database: "staging"
2647 * });
2648 * // The access level of the user "steve" has been fetched for the "staging"
2649 * // database.
2650 * ```
2651 *
2652 * @example
2653 * ```js
2654 * const db = new Database();
2655 * const accessLevel = await db.getUserAccessLevel("steve", {
2656 * collection: "pokemons"
2657 * });
2658 * // The access level of the user "steve" has been fetched for the
2659 * // "pokemons" collection in the current database.
2660 * ```
2661 *
2662 * @example
2663 * ```js
2664 * const db = new Database();
2665 * const accessLevel = await db.getUserAccessLevel("steve", {
2666 * database: "staging",
2667 * collection: "pokemons"
2668 * });
2669 * // The access level of the user "steve" has been fetched for the
2670 * // "pokemons" collection in the "staging" database.
2671 * ```
2672 *
2673 * @example
2674 * ```js
2675 * const db = new Database();
2676 * const staging = db.database("staging");
2677 * const accessLevel = await db.getUserAccessLevel("steve", {
2678 * database: staging
2679 * });
2680 * // The access level of the user "steve" has been fetched for the "staging"
2681 * // database.
2682 * ```
2683 *
2684 * @example
2685 * ```js
2686 * const db = new Database();
2687 * const staging = db.database("staging");
2688 * const accessLevel = await db.getUserAccessLevel("steve", {
2689 * collection: staging.collection("pokemons")
2690 * });
2691 * // The access level of the user "steve" has been fetched for the
2692 * // "pokemons" collection in database "staging".
2693 * ```
2694 */
2695 getUserAccessLevel(username: string, { database, collection }: UserAccessLevelOptions): Promise<AccessLevel>;
2696 /**
2697 * Sets the given ArangoDB user's access level for the database, or the
2698 * given collection in the given database.
2699 *
2700 * @param username - Name of the ArangoDB user to set the access level for.
2701 * @param database - Database to set the access level for.
2702 * @param collection - Collection to set the access level for.
2703 * @param grant - Access level to set for the given user.
2704 *
2705 * @example
2706 * ```js
2707 * const db = new Database();
2708 * await db.setUserAccessLevel("steve", { grant: "rw" });
2709 * // The user "steve" now has read-write access to the current database.
2710 * ```
2711 *
2712 * @example
2713 * ```js
2714 * const db = new Database();
2715 * await db.setUserAccessLevel("steve", {
2716 * database: "staging",
2717 * grant: "rw"
2718 * });
2719 * // The user "steve" now has read-write access to the "staging" database.
2720 * ```
2721 *
2722 * @example
2723 * ```js
2724 * const db = new Database();
2725 * await db.setUserAccessLevel("steve", {
2726 * collection: "pokemons",
2727 * grant: "rw"
2728 * });
2729 * // The user "steve" now has read-write access to the "pokemons" collection
2730 * // in the current database.
2731 * ```
2732 *
2733 * @example
2734 * ```js
2735 * const db = new Database();
2736 * await db.setUserAccessLevel("steve", {
2737 * database: "staging",
2738 * collection: "pokemons",
2739 * grant: "rw"
2740 * });
2741 * // The user "steve" now has read-write access to the "pokemons" collection
2742 * // in the "staging" database.
2743 * ```
2744 *
2745 * @example
2746 * ```js
2747 * const db = new Database();
2748 * const staging = db.database("staging");
2749 * await db.setUserAccessLevel("steve", {
2750 * database: staging,
2751 * grant: "rw"
2752 * });
2753 * // The user "steve" now has read-write access to the "staging" database.
2754 * ```
2755 *
2756 * @example
2757 * ```js
2758 * const db = new Database();
2759 * const staging = db.database("staging");
2760 * await db.setUserAccessLevel("steve", {
2761 * collection: staging.collection("pokemons"),
2762 * grant: "rw"
2763 * });
2764 * // The user "steve" now has read-write access to the "pokemons" collection
2765 * // in database "staging".
2766 * ```
2767 */
2768 setUserAccessLevel(username: string, { database, collection, grant, }: UserAccessLevelOptions & {
2769 grant: AccessLevel;
2770 }): Promise<ArangoApiResponse<Record<string, AccessLevel>>>;
2771 /**
2772 * Clears the given ArangoDB user's access level for the database, or the
2773 * given collection in the given database.
2774 *
2775 * @param username - Name of the ArangoDB user to clear the access level for.
2776 * @param database - Database to clear the access level for.
2777 * @param collection - Collection to clear the access level for.
2778 *
2779 * @example
2780 * ```js
2781 * const db = new Database();
2782 * await db.clearUserAccessLevel("steve");
2783 * // The access level of the user "steve" has been cleared for the current
2784 * // database.
2785 * ```
2786 *
2787 * @example
2788 * ```js
2789 * const db = new Database();
2790 * await db.clearUserAccessLevel("steve", { database: "staging" });
2791 * // The access level of the user "steve" has been cleared for the "staging"
2792 * // database.
2793 * ```
2794 *
2795 * @example
2796 * ```js
2797 * const db = new Database();
2798 * await db.clearUserAccessLevel("steve", { collection: "pokemons" });
2799 * // The access level of the user "steve" has been cleared for the
2800 * // "pokemons" collection in the current database.
2801 * ```
2802 *
2803 * @example
2804 * ```js
2805 * const db = new Database();
2806 * await db.clearUserAccessLevel("steve", {
2807 * database: "staging",
2808 * collection: "pokemons"
2809 * });
2810 * // The access level of the user "steve" has been cleared for the
2811 * // "pokemons" collection in the "staging" database.
2812 * ```
2813 *
2814 * @example
2815 * ```js
2816 * const db = new Database();
2817 * const staging = db.database("staging");
2818 * await db.clearUserAccessLevel("steve", { database: staging });
2819 * // The access level of the user "steve" has been cleared for the "staging"
2820 * // database.
2821 * ```
2822 *
2823 * @example
2824 * ```js
2825 * const db = new Database();
2826 * const staging = db.database("staging");
2827 * await db.clearUserAccessLevel("steve", {
2828 * collection: staging.collection("pokemons")
2829 * });
2830 * // The access level of the user "steve" has been cleared for the
2831 * // "pokemons" collection in database "staging".
2832 * ```
2833 */
2834 clearUserAccessLevel(username: string, { database, collection }: UserAccessLevelOptions): Promise<ArangoApiResponse<Record<string, AccessLevel>>>;
2835 /**
2836 * Fetches an object mapping names of databases to the access level of the
2837 * given ArangoDB user for those databases.
2838 *
2839 * @param username - Name of the ArangoDB user to fetch the access levels for.
2840 * @param full - Whether access levels for collections should be included.
2841 *
2842 * @example
2843 * ```js
2844 * const db = new Database();
2845 * const accessLevels = await db.getUserDatabases("steve");
2846 * for (const [databaseName, accessLevel] of Object.entries(accessLevels)) {
2847 * console.log(`${databaseName}: ${accessLevel}`);
2848 * }
2849 * ```
2850 */
2851 getUserDatabases(username: string, full?: false): Promise<Record<string, AccessLevel>>;
2852 /**
2853 * Fetches an object mapping names of databases to the access level of the
2854 * given ArangoDB user for those databases and the collections within each
2855 * database.
2856 *
2857 * @param username - Name of the ArangoDB user to fetch the access levels for.
2858 * @param full - Whether access levels for collections should be included.
2859 *
2860 * @example
2861 * ```js
2862 * const db = new Database();
2863 * const accessLevels = await db.getUserDatabases("steve", true);
2864 * for (const [databaseName, obj] of Object.entries(accessLevels)) {
2865 * console.log(`${databaseName}: ${obj.permission}`);
2866 * for (const [collectionName, accessLevel] of Object.entries(obj.collections)) {
2867 * console.log(`${databaseName}/${collectionName}: ${accessLevel}`);
2868 * }
2869 * }
2870 * ```
2871 */
2872 getUserDatabases(username: string, full: true): Promise<Record<string, {
2873 permission: AccessLevel;
2874 collections: Record<string, AccessLevel | "undefined">;
2875 }>>;
2876 /**
2877 * Performs a server-side JavaScript transaction and returns its return
2878 * value.
2879 *
2880 * Collections can be specified as collection names (strings) or objects
2881 * implementing the {@link collection.ArangoCollection} interface: `Collection`,
2882 * {@link graph.GraphVertexCollection}, {@link graph.GraphEdgeCollection} as well as
2883 * (in TypeScript) {@link collection.DocumentCollection} and {@link collection.EdgeCollection}.
2884 *
2885 * **Note**: The `action` function will be evaluated and executed on the
2886 * server inside ArangoDB's embedded JavaScript environment and can not
2887 * access any values other than those passed via the `params` option.
2888 *
2889 * See the official ArangoDB documentation for
2890 * [the JavaScript `@arangodb` module](https://www.arangodb.com/docs/stable/appendix-java-script-modules-arango-db.html)
2891 * for information about accessing the database from within ArangoDB's
2892 * server-side JavaScript environment.
2893 *
2894 * @param collections - Collections involved in the transaction.
2895 * @param action - A string evaluating to a JavaScript function to be
2896 * executed on the server.
2897 * @param options - Options for the transaction. If `options.allowImplicit`
2898 * is specified, it will be used if `collections.allowImplicit` was not
2899 * specified.
2900 *
2901 * @example
2902 * ```js
2903 * const db = new Database();
2904 *
2905 * const action = `
2906 * function(params) {
2907 * // This code will be executed inside ArangoDB!
2908 * const { query } = require("@arangodb");
2909 * return query\`
2910 * FOR user IN _users
2911 * FILTER user.age > ${params.age}
2912 * RETURN u.user
2913 * \`.toArray();
2914 * }
2915 * `);
2916 *
2917 * const result = await db.executeTransaction({
2918 * read: ["_users"]
2919 * }, action, {
2920 * params: { age: 12 }
2921 * });
2922 * // result contains the return value of the action
2923 * ```
2924 */
2925 executeTransaction(collections: TransactionCollections & {
2926 allowImplicit?: boolean;
2927 }, action: string, options?: TransactionOptions & {
2928 params?: any;
2929 }): Promise<any>;
2930 /**
2931 * Performs a server-side transaction and returns its return value.
2932 *
2933 * Collections can be specified as collection names (strings) or objects
2934 * implementing the {@link collection.ArangoCollection} interface: `Collection`,
2935 * {@link graph.GraphVertexCollection}, {@link graph.GraphEdgeCollection} as well as
2936 * (in TypeScript) {@link collection.DocumentCollection} and {@link collection.EdgeCollection}.
2937 *
2938 * **Note**: The `action` function will be evaluated and executed on the
2939 * server inside ArangoDB's embedded JavaScript environment and can not
2940 * access any values other than those passed via the `params` option.
2941 * See the official ArangoDB documentation for
2942 * [the JavaScript `@arangodb` module](https://www.arangodb.com/docs/stable/appendix-java-script-modules-arango-db.html)
2943 * for information about accessing the database from within ArangoDB's
2944 * server-side JavaScript environment.
2945 *
2946 * @param collections - Collections that can be read from and written to
2947 * during the transaction.
2948 * @param action - A string evaluating to a JavaScript function to be
2949 * executed on the server.
2950 * @param options - Options for the transaction.
2951 *
2952 * @example
2953 * ```js
2954 * const db = new Database();
2955 *
2956 * const action = `
2957 * function(params) {
2958 * // This code will be executed inside ArangoDB!
2959 * const { query } = require("@arangodb");
2960 * return query\`
2961 * FOR user IN _users
2962 * FILTER user.age > ${params.age}
2963 * RETURN u.user
2964 * \`.toArray();
2965 * }
2966 * `);
2967 *
2968 * const result = await db.executeTransaction(["_users"], action, {
2969 * params: { age: 12 }
2970 * });
2971 * // result contains the return value of the action
2972 * ```
2973 */
2974 executeTransaction(collections: (string | ArangoCollection)[], action: string, options?: TransactionOptions & {
2975 params?: any;
2976 }): Promise<any>;
2977 /**
2978 * Performs a server-side transaction and returns its return value.
2979 *
2980 * The Collection can be specified as a collection name (string) or an object
2981 * implementing the {@link collection.ArangoCollection} interface: `Collection`,
2982 * {@link graph.GraphVertexCollection}, {@link graph.GraphEdgeCollection} as well as
2983 * (in TypeScript) {@link collection.DocumentCollection} and {@link collection.EdgeCollection}.
2984 *
2985 * **Note**: The `action` function will be evaluated and executed on the
2986 * server inside ArangoDB's embedded JavaScript environment and can not
2987 * access any values other than those passed via the `params` option.
2988 * See the official ArangoDB documentation for
2989 * [the JavaScript `@arangodb` module](https://www.arangodb.com/docs/stable/appendix-java-script-modules-arango-db.html)
2990 * for information about accessing the database from within ArangoDB's
2991 * server-side JavaScript environment.
2992 *
2993 * @param collection - A collection that can be read from and written to
2994 * during the transaction.
2995 * @param action - A string evaluating to a JavaScript function to be
2996 * executed on the server.
2997 * @param options - Options for the transaction.
2998 *
2999 * @example
3000 * ```js
3001 * const db = new Database();
3002 *
3003 * const action = `
3004 * function(params) {
3005 * // This code will be executed inside ArangoDB!
3006 * const { query } = require("@arangodb");
3007 * return query\`
3008 * FOR user IN _users
3009 * FILTER user.age > ${params.age}
3010 * RETURN u.user
3011 * \`.toArray();
3012 * }
3013 * `);
3014 *
3015 * const result = await db.executeTransaction("_users", action, {
3016 * params: { age: 12 }
3017 * });
3018 * // result contains the return value of the action
3019 * ```
3020 */
3021 executeTransaction(collection: string | ArangoCollection, action: string, options?: TransactionOptions & {
3022 params?: any;
3023 }): Promise<any>;
3024 /**
3025 * Returns a {@link transaction.Transaction} instance for an existing streaming
3026 * transaction with the given `id`.
3027 *
3028 * See also {@link Database#beginTransaction}.
3029 *
3030 * @param id - The `id` of an existing stream transaction.
3031 *
3032 * @example
3033 * ```js
3034 * const trx1 = await db.beginTransaction(collections);
3035 * const id = trx1.id;
3036 * // later
3037 * const trx2 = db.transaction(id);
3038 * await trx2.commit();
3039 * ```
3040 */
3041 transaction(transactionId: string): Transaction;
3042 /**
3043 * Begins a new streaming transaction for the given collections, then returns
3044 * a {@link transaction.Transaction} instance for the transaction.
3045 *
3046 * Collections can be specified as collection names (strings) or objects
3047 * implementing the {@link collection.ArangoCollection} interface: `Collection`,
3048 * {@link graph.GraphVertexCollection}, {@link graph.GraphEdgeCollection} as
3049 * well as (in TypeScript) {@link collection.DocumentCollection} and
3050 * {@link collection.EdgeCollection}.
3051 *
3052 * @param collections - Collections involved in the transaction.
3053 * @param options - Options for the transaction.
3054 *
3055 * @example
3056 * ```js
3057 * const vertices = db.collection("vertices");
3058 * const edges = db.collection("edges");
3059 * const trx = await db.beginTransaction({
3060 * read: ["vertices"],
3061 * write: [edges] // collection instances can be passed directly
3062 * });
3063 * const start = await trx.step(() => vertices.document("a"));
3064 * const end = await trx.step(() => vertices.document("b"));
3065 * await trx.step(() => edges.save({ _from: start._id, _to: end._id }));
3066 * await trx.commit();
3067 * ```
3068 */
3069 beginTransaction(collections: TransactionCollections, options?: TransactionOptions): Promise<Transaction>;
3070 /**
3071 * Begins a new streaming transaction for the given collections, then returns
3072 * a {@link transaction.Transaction} instance for the transaction.
3073 *
3074 * Collections can be specified as collection names (strings) or objects
3075 * implementing the {@link collection.ArangoCollection} interface: `Collection`,
3076 * {@link graph.GraphVertexCollection}, {@link graph.GraphEdgeCollection} as well as
3077 * (in TypeScript) {@link collection.DocumentCollection} and {@link collection.EdgeCollection}.
3078 *
3079 * @param collections - Collections that can be read from and written to
3080 * during the transaction.
3081 * @param options - Options for the transaction.
3082 *
3083 * @example
3084 * ```js
3085 * const vertices = db.collection("vertices");
3086 * const edges = db.collection("edges");
3087 * const trx = await db.beginTransaction([
3088 * "vertices",
3089 * edges // collection instances can be passed directly
3090 * ]);
3091 * const start = await trx.step(() => vertices.document("a"));
3092 * const end = await trx.step(() => vertices.document("b"));
3093 * await trx.step(() => edges.save({ _from: start._id, _to: end._id }));
3094 * await trx.commit();
3095 * ```
3096 */
3097 beginTransaction(collections: (string | ArangoCollection)[], options?: TransactionOptions): Promise<Transaction>;
3098 /**
3099 * Begins a new streaming transaction for the given collections, then returns
3100 * a {@link transaction.Transaction} instance for the transaction.
3101 *
3102 * The Collection can be specified as a collection name (string) or an object
3103 * implementing the {@link collection.ArangoCollection} interface: `Collection`,
3104 * {@link graph.GraphVertexCollection}, {@link graph.GraphEdgeCollection} as well as
3105 * (in TypeScript) {@link collection.DocumentCollection} and {@link collection.EdgeCollection}.
3106 *
3107 * @param collection - A collection that can be read from and written to
3108 * during the transaction.
3109 * @param options - Options for the transaction.
3110 *
3111 * @example
3112 * ```js
3113 * const vertices = db.collection("vertices");
3114 * const start = vertices.document("a");
3115 * const end = vertices.document("b");
3116 * const edges = db.collection("edges");
3117 * const trx = await db.beginTransaction(
3118 * edges // collection instances can be passed directly
3119 * );
3120 * await trx.step(() => edges.save({ _from: start._id, _to: end._id }));
3121 * await trx.commit();
3122 * ```
3123 */
3124 beginTransaction(collection: string | ArangoCollection, options?: TransactionOptions): Promise<Transaction>;
3125 /**
3126 * Begins and commits a transaction using the given callback. Individual
3127 * requests that are part of the transaction need to be wrapped in the step
3128 * function passed into the callback. If the promise returned by the callback
3129 * is rejected, the transaction will be aborted.
3130 *
3131 * Collections can be specified as collection names (strings) or objects
3132 * implementing the {@link collection.ArangoCollection} interface: `Collection`,
3133 * {@link graph.GraphVertexCollection}, {@link graph.GraphEdgeCollection} as
3134 * well as (in TypeScript) {@link collection.DocumentCollection} and
3135 * {@link collection.EdgeCollection}.
3136 *
3137 * @param collections - Collections involved in the transaction.
3138 * @param callback - Callback function executing the transaction steps.
3139 * @param options - Options for the transaction.
3140 *
3141 * @example
3142 * ```js
3143 * const vertices = db.collection("vertices");
3144 * const edges = db.collection("edges");
3145 * await db.withTransaction(
3146 * {
3147 * read: ["vertices"],
3148 * write: [edges] // collection instances can be passed directly
3149 * },
3150 * async (step) => {
3151 * const start = await step(() => vertices.document("a"));
3152 * const end = await step(() => vertices.document("b"));
3153 * await step(() => edges.save({ _from: start._id, _to: end._id }));
3154 * }
3155 * );
3156 * ```
3157 */
3158 withTransaction<T>(collections: TransactionCollections, callback: (step: Transaction["step"]) => Promise<T>, options?: TransactionOptions): Promise<T>;
3159 /**
3160 * Begins and commits a transaction using the given callback. Individual
3161 * requests that are part of the transaction need to be wrapped in the step
3162 * function passed into the callback. If the promise returned by the callback
3163 * is rejected, the transaction will be aborted.
3164 *
3165 * Collections can be specified as collection names (strings) or objects
3166 * implementing the {@link collection.ArangoCollection} interface: `Collection`,
3167 * {@link graph.GraphVertexCollection}, {@link graph.GraphEdgeCollection} as well as
3168 * (in TypeScript) {@link collection.DocumentCollection} and {@link collection.EdgeCollection}.
3169 *
3170 * @param collections - Collections that can be read from and written to
3171 * during the transaction.
3172 * @param callback - Callback function executing the transaction steps.
3173 * @param options - Options for the transaction.
3174 *
3175 * @example
3176 * ```js
3177 * const vertices = db.collection("vertices");
3178 * const edges = db.collection("edges");
3179 * await db.withTransaction(
3180 * [
3181 * "vertices",
3182 * edges, // collection instances can be passed directly
3183 * ],
3184 * async (step) => {
3185 * const start = await step(() => vertices.document("a"));
3186 * const end = await step(() => vertices.document("b"));
3187 * await step(() => edges.save({ _from: start._id, _to: end._id }));
3188 * }
3189 * );
3190 * ```
3191 */
3192 withTransaction<T>(collections: (string | ArangoCollection)[], callback: (step: Transaction["step"]) => Promise<T>, options?: TransactionOptions): Promise<T>;
3193 /**
3194 * Begins and commits a transaction using the given callback. Individual
3195 * requests that are part of the transaction need to be wrapped in the step
3196 * function passed into the callback. If the promise returned by the callback
3197 * is rejected, the transaction will be aborted.
3198 *
3199 * The Collection can be specified as a collection name (string) or an object
3200 * implementing the {@link collection.ArangoCollection} interface: `Collection`,
3201 * {@link graph.GraphVertexCollection}, {@link graph.GraphEdgeCollection} as well as
3202 * (in TypeScript) {@link collection.DocumentCollection} and {@link collection.EdgeCollection}.
3203 *
3204 * @param collection - A collection that can be read from and written to
3205 * during the transaction.
3206 * @param callback - Callback function executing the transaction steps.
3207 * @param options - Options for the transaction.
3208 *
3209 * @example
3210 * ```js
3211 * const vertices = db.collection("vertices");
3212 * const start = vertices.document("a");
3213 * const end = vertices.document("b");
3214 * const edges = db.collection("edges");
3215 * await db.withTransaction(
3216 * edges, // collection instances can be passed directly
3217 * async (step) => {
3218 * await step(() => edges.save({ _from: start._id, _to: end._id }));
3219 * }
3220 * );
3221 * ```
3222 */
3223 withTransaction<T>(collection: string | ArangoCollection, callback: (step: Transaction["step"]) => Promise<T>, options?: TransactionOptions): Promise<T>;
3224 /**
3225 * Fetches all active transactions from the database and returns an array of
3226 * transaction descriptions.
3227 *
3228 * See also {@link Database#transactions}.
3229 *
3230 * @example
3231 * ```js
3232 * const db = new Database();
3233 * const transactions = await db.listTransactions();
3234 * // transactions is an array of transaction descriptions
3235 * ```
3236 */
3237 listTransactions(): Promise<TransactionDetails[]>;
3238 /**
3239 * Fetches all active transactions from the database and returns an array of
3240 * {@link transaction.Transaction} instances for those transactions.
3241 *
3242 * See also {@link Database#listTransactions}.
3243 *
3244 * @example
3245 * ```js
3246 * const db = new Database();
3247 * const transactions = await db.transactions();
3248 * // transactions is an array of transactions
3249 * ```
3250 */
3251 transactions(): Promise<Transaction[]>;
3252 /**
3253 * Performs a database query using the given `query`, then returns a new
3254 * {@link cursor.ArrayCursor} instance for the result set.
3255 *
3256 * See the {@link aql!aql} template string handler for information about how
3257 * to create a query string without manually defining bind parameters nor
3258 * having to worry about escaping variables.
3259 *
3260 * **Note**: When executing a query in a streaming transaction using the
3261 * `step` method, the resulting cursor will be bound to that transaction and
3262 * you do not need to use the `step` method to consume it.
3263 *
3264 * @param query - An object containing an AQL query string and bind
3265 * parameters, e.g. the object returned from an {@link aql!aql} template string.
3266 * @param options - Options for the query execution.
3267 *
3268 * @example
3269 * ```js
3270 * const db = new Database();
3271 * const active = true;
3272 * const Users = db.collection("_users");
3273 *
3274 * // Using an aql template string:
3275 * // Bind parameters are automatically extracted and arangojs collections
3276 * // are automatically passed as collection bind parameters.
3277 * const cursor = await db.query(aql`
3278 * FOR u IN ${Users}
3279 * FILTER u.authData.active == ${active}
3280 * RETURN u.user
3281 * `);
3282 * // cursor is a cursor for the query result
3283 * ```
3284 *
3285 * @example
3286 * ```js
3287 * const db = new Database();
3288 * const active = true;
3289 * const Users = db.collection("_users");
3290 *
3291 * // Using an object with a regular multi-line string
3292 * const cursor = await db.query({
3293 * query: `
3294 * FOR u IN @@users
3295 * FILTER u.authData.active == @active
3296 * RETURN u.user
3297 * `,
3298 * bindVars: { active: active, "@users": Users.name }
3299 * });
3300 * ```
3301 */
3302 query<T = any>(query: AqlQuery<T>, options?: QueryOptions): Promise<ArrayCursor<T>>;
3303 /**
3304 * Performs a database query using the given `query` and `bindVars`, then
3305 * returns a new {@link cursor.ArrayCursor} instance for the result set.
3306 *
3307 * See the {@link aql!aql} template string handler for a safer and easier
3308 * alternative to passing strings directly.
3309 *
3310 * **Note**: When executing a query in a streaming transaction using the
3311 * `step` method, the resulting cursor will be bound to that transaction and
3312 * you do not need to use the `step` method to consume it.
3313 *
3314 * @param query - An AQL query string.
3315 * @param bindVars - An object defining bind parameters for the query.
3316 * @param options - Options for the query execution.
3317 *
3318 * @example
3319 * ```js
3320 * const db = new Database();
3321 * const active = true;
3322 * const Users = db.collection("_users");
3323 *
3324 * const cursor = await db.query(
3325 * // A normal multi-line string
3326 * `
3327 * FOR u IN @@users
3328 * FILTER u.authData.active == @active
3329 * RETURN u.user
3330 * `,
3331 * { active: active, "@users": Users.name }
3332 * );
3333 * ```
3334 *
3335 * @example
3336 * ```js
3337 * const db = new Database();
3338 * const active = true;
3339 * const Users = db.collection("_users");
3340 *
3341 * const cursor = await db.query(
3342 * // An AQL literal created from a normal multi-line string
3343 * aql.literal(`
3344 * FOR u IN @@users
3345 * FILTER u.authData.active == @active
3346 * RETURN u.user
3347 * `),
3348 * { active: active, "@users": Users.name }
3349 * );
3350 * ```
3351 */
3352 query<T = any>(query: string | AqlLiteral, bindVars?: Record<string, any>, options?: QueryOptions): Promise<ArrayCursor<T>>;
3353 /**
3354 * Explains a database query using the given `query`.
3355 *
3356 * See the {@link aql!aql} template string handler for information about how
3357 * to create a query string without manually defining bind parameters nor
3358 * having to worry about escaping variables.
3359 *
3360 * @param query - An object containing an AQL query string and bind
3361 * parameters, e.g. the object returned from an {@link aql!aql} template string.
3362 * @param options - Options for explaining the query.
3363 *
3364 * @example
3365 * ```js
3366 * const db = new Database();
3367 * const collection = db.collection("some-collection");
3368 * const explanation = await db.explain(aql`
3369 * FOR doc IN ${collection}
3370 * FILTER doc.flavor == "strawberry"
3371 * RETURN doc._key
3372 * `);
3373 * ```
3374 */
3375 explain(query: AqlQuery, options?: ExplainOptions & {
3376 allPlans?: false;
3377 }): Promise<ArangoApiResponse<SingleExplainResult>>;
3378 /**
3379 * Explains a database query using the given `query`.
3380 *
3381 * See the {@link aql!aql} template string handler for information about how
3382 * to create a query string without manually defining bind parameters nor
3383 * having to worry about escaping variables.
3384 *
3385 * @param query - An object containing an AQL query string and bind
3386 * parameters, e.g. the object returned from an {@link aql!aql} template string.
3387 * @param options - Options for explaining the query.
3388 *
3389 * @example
3390 * ```js
3391 * const db = new Database();
3392 * const collection = db.collection("some-collection");
3393 * const explanation = await db.explain(
3394 * aql`
3395 * FOR doc IN ${collection}
3396 * FILTER doc.flavor == "strawberry"
3397 * RETURN doc._key
3398 * `,
3399 * { allPlans: true }
3400 * );
3401 * ```
3402 */
3403 explain(query: AqlQuery, options?: ExplainOptions & {
3404 allPlans: true;
3405 }): Promise<ArangoApiResponse<MultiExplainResult>>;
3406 /**
3407 * Explains a database query using the given `query` and `bindVars`.
3408 *
3409 * See the {@link aql!aql} template string handler for a safer and easier
3410 * alternative to passing strings directly.
3411 *
3412 * @param query - An AQL query string.
3413 * @param bindVars - An object defining bind parameters for the query.
3414 * @param options - Options for explaining the query.
3415 *
3416 * @example
3417 * ```js
3418 * const db = new Database();
3419 * const collection = db.collection("some-collection");
3420 * const explanation = await db.explain(
3421 * `
3422 * FOR doc IN @@collection
3423 * FILTER doc.flavor == "strawberry"
3424 * RETURN doc._key
3425 * `,
3426 * { "@collection": collection.name }
3427 * );
3428 * ```
3429 */
3430 explain(query: string | AqlLiteral, bindVars?: Record<string, any>, options?: ExplainOptions & {
3431 allPlans?: false;
3432 }): Promise<ArangoApiResponse<SingleExplainResult>>;
3433 /**
3434 * Explains a database query using the given `query` and `bindVars`.
3435 *
3436 * See the {@link aql!aql} template string handler for a safer and easier
3437 * alternative to passing strings directly.
3438 *
3439 * @param query - An AQL query string.
3440 * @param bindVars - An object defining bind parameters for the query.
3441 * @param options - Options for explaining the query.
3442 *
3443 * @example
3444 * ```js
3445 * const db = new Database();
3446 * const collection = db.collection("some-collection");
3447 * const explanation = await db.explain(
3448 * `
3449 * FOR doc IN @@collection
3450 * FILTER doc.flavor == "strawberry"
3451 * RETURN doc._key
3452 * `,
3453 * { "@collection": collection.name },
3454 * { allPlans: true }
3455 * );
3456 * ```
3457 */
3458 explain(query: string | AqlLiteral, bindVars?: Record<string, any>, options?: ExplainOptions & {
3459 allPlans: true;
3460 }): Promise<ArangoApiResponse<MultiExplainResult>>;
3461 /**
3462 * Parses the given query and returns the result.
3463 *
3464 * See the {@link aql!aql} template string handler for information about how
3465 * to create a query string without manually defining bind parameters nor
3466 * having to worry about escaping variables.
3467 *
3468 * @param query - An AQL query string or an object containing an AQL query
3469 * string and bind parameters, e.g. the object returned from an {@link aql!aql}
3470 * template string.
3471 *
3472 * @example
3473 * ```js
3474 * const db = new Database();
3475 * const collection = db.collection("some-collection");
3476 * const ast = await db.parse(aql`
3477 * FOR doc IN ${collection}
3478 * FILTER doc.flavor == "strawberry"
3479 * RETURN doc._key
3480 * `);
3481 * ```
3482 */
3483 parse(query: string | AqlQuery | AqlLiteral): Promise<ParseResult>;
3484 /**
3485 * Fetches the available optimizer rules.
3486 *
3487 * @example
3488 * ```js
3489 * const db = new Database();
3490 * const rules = await db.queryRules();
3491 * for (const rule of rules) {
3492 * console.log(rule.name);
3493 * }
3494 * ```
3495 */
3496 queryRules(): Promise<QueryOptimizerRule[]>;
3497 /**
3498 * Fetches the query tracking properties.
3499 *
3500 * @example
3501 * ```js
3502 * const db = new Database();
3503 * const tracking = await db.queryTracking();
3504 * console.log(tracking.enabled);
3505 * ```
3506 */
3507 queryTracking(): Promise<QueryTracking>;
3508 /**
3509 * Modifies the query tracking properties.
3510 *
3511 * @param options - Options for query tracking.
3512 *
3513 * @example
3514 * ```js
3515 * const db = new Database();
3516 * // track up to 5 slow queries exceeding 5 seconds execution time
3517 * await db.setQueryTracking({
3518 * enabled: true,
3519 * trackSlowQueries: true,
3520 * maxSlowQueries: 5,
3521 * slowQueryThreshold: 5
3522 * });
3523 * ```
3524 */
3525 queryTracking(options: QueryTrackingOptions): Promise<QueryTracking>;
3526 /**
3527 * Fetches a list of information for all currently running queries.
3528 *
3529 * See also {@link Database#listSlowQueries} and {@link Database#killQuery}.
3530 *
3531 * @example
3532 * ```js
3533 * const db = new Database();
3534 * const queries = await db.listRunningQueries();
3535 * ```
3536 */
3537 listRunningQueries(): Promise<QueryInfo[]>;
3538 /**
3539 * Fetches a list of information for all recent slow queries.
3540 *
3541 * See also {@link Database#listRunningQueries} and
3542 * {@link Database#clearSlowQueries}.
3543 *
3544 * @example
3545 * ```js
3546 * const db = new Database();
3547 * const queries = await db.listSlowQueries();
3548 * // Only works if slow query tracking is enabled
3549 * ```
3550 */
3551 listSlowQueries(): Promise<QueryInfo[]>;
3552 /**
3553 * Clears the list of recent slow queries.
3554 *
3555 * See also {@link Database#listSlowQueries}.
3556 *
3557 * @example
3558 * ```js
3559 * const db = new Database();
3560 * await db.clearSlowQueries();
3561 * // Slow query list is now cleared
3562 * ```
3563 */
3564 clearSlowQueries(): Promise<void>;
3565 /**
3566 * Kills a running query with the given `queryId`.
3567 *
3568 * See also {@link Database#listRunningQueries}.
3569 *
3570 * @param queryId - The ID of a currently running query.
3571 *
3572 * @example
3573 * ```js
3574 * const db = new Database();
3575 * const queries = await db.listRunningQueries();
3576 * await Promise.all(queries.map(
3577 * async (query) => {
3578 * if (query.state === "executing") {
3579 * await db.killQuery(query.id);
3580 * }
3581 * }
3582 * ));
3583 * ```
3584 */
3585 killQuery(queryId: string): Promise<void>;
3586 /**
3587 * Fetches a list of all AQL user functions registered with the database.
3588 *
3589 * @example
3590 * ```js
3591 * const db = new Database();
3592 * const functions = await db.listFunctions();
3593 * const names = functions.map(fn => fn.name);
3594 * ```
3595 */
3596 listFunctions(): Promise<AqlUserFunction[]>;
3597 /**
3598 * Creates an AQL user function with the given _name_ and _code_ if it does
3599 * not already exist or replaces it if a function with the same name already
3600 * existed.
3601 *
3602 * @param name - A valid AQL function name. The function name must consist
3603 * of at least two alphanumeric identifiers separated with double colons.
3604 * @param code - A string evaluating to a JavaScript function (not a
3605 * JavaScript function object).
3606 * @param isDeterministic - If set to `true`, the function is expected to
3607 * always return the same result for equivalent inputs. This option currently
3608 * has no effect but may allow for optimizations in the future.
3609 *
3610 * @example
3611 * ```js
3612 * const db = new Database();
3613 * await db.createFunction(
3614 * "ACME::ACCOUNTING::CALCULATE_VAT",
3615 * "(price) => price * 0.19"
3616 * );
3617 * // Use the new function in an AQL query with template handler:
3618 * const cursor = await db.query(aql`
3619 * FOR product IN products
3620 * RETURN MERGE(
3621 * { vat: ACME::ACCOUNTING::CALCULATE_VAT(product.price) },
3622 * product
3623 * )
3624 * `);
3625 * // cursor is a cursor for the query result
3626 * ```
3627 */
3628 createFunction(name: string, code: string, isDeterministic?: boolean): Promise<ArangoApiResponse<{
3629 isNewlyCreated: boolean;
3630 }>>;
3631 /**
3632 * Deletes the AQL user function with the given name from the database.
3633 *
3634 * @param name - The name of the user function to drop.
3635 * @param group - If set to `true`, all functions with a name starting with
3636 * `name` will be deleted, otherwise only the function with the exact name
3637 * will be deleted.
3638 *
3639 * @example
3640 * ```js
3641 * const db = new Database();
3642 * await db.dropFunction("ACME::ACCOUNTING::CALCULATE_VAT");
3643 * // the function no longer exists
3644 * ```
3645 */
3646 dropFunction(name: string, group?: boolean): Promise<ArangoApiResponse<{
3647 deletedCount: number;
3648 }>>;
3649 /**
3650 * Fetches a list of all installed service.
3651 *
3652 * @param excludeSystem - Whether system services should be excluded.
3653 *
3654 * @example
3655 * ```js
3656 * const db = new Database();
3657 * const services = await db.listServices();
3658 * ```
3659 *
3660 * @example
3661 * ```js
3662 * const db = new Database();
3663 * const services = await db.listServices(false); // all services
3664 * ```
3665 */
3666 listServices(excludeSystem?: boolean): Promise<ServiceSummary[]>;
3667 /**
3668 * Installs a new service.
3669 *
3670 * @param mount - The service's mount point, relative to the database.
3671 * @param source - The service bundle to install.
3672 * @param options - Options for installing the service.
3673 *
3674 * @example
3675 * ```js
3676 * const db = new Database();
3677 * // Using a Buffer in Node.js as source
3678 * const source = new Blob([await fs.readFileSync("./my-foxx-service.zip")]);
3679 * const info = await db.installService("/hello", source);
3680 * ```
3681 *
3682 * @example
3683 * ```js
3684 * const db = new Database();
3685 * // Using a Blob in Node.js as source
3686 * const source = await fs.openAsBlob("./my-foxx-service.zip");
3687 * const info = await db.installService("/hello", source);
3688 * ```
3689 *
3690 * @example
3691 * ```js
3692 * const db = new Database();
3693 * // Using a File from a browser file input as source
3694 * const element = document.getElementById("my-file-input");
3695 * const source = element.files[0];
3696 * const info = await db.installService("/hello", source);
3697 * ```
3698 */
3699 installService(mount: string, source: File | Blob | string, options?: InstallServiceOptions): Promise<ServiceInfo>;
3700 /**
3701 * Replaces an existing service with a new service by completely removing the
3702 * old service and installing a new service at the same mount point.
3703 *
3704 * @param mount - The service's mount point, relative to the database.
3705 * @param source - The service bundle to install.
3706 * @param options - Options for replacing the service.
3707 *
3708 * @example
3709 * ```js
3710 * const db = new Database();
3711 * // Using a Buffer in Node.js as source
3712 * const source = new Blob([await fs.readFileSync("./my-foxx-service.zip")]);
3713 * const info = await db.replaceService("/hello", source);
3714 * ```
3715 *
3716 * @example
3717 * ```js
3718 * const db = new Database();
3719 * // Using a Blob in Node.js as source
3720 * const source = await fs.openAsBlob("./my-foxx-service.zip");
3721 * const info = await db.replaceService("/hello", source);
3722 * ```
3723 *
3724 * @example
3725 * ```js
3726 * const db = new Database();
3727 * // Using a File from a browser file input as source
3728 * const element = document.getElementById("my-file-input");
3729 * const source = element.files[0];
3730 * const info = await db.replaceService("/hello", source);
3731 * ```
3732 */
3733 replaceService(mount: string, source: File | Blob | string, options?: ReplaceServiceOptions): Promise<ServiceInfo>;
3734 /**
3735 * Replaces an existing service with a new service while retaining the old
3736 * service's configuration and dependencies.
3737 *
3738 * @param mount - The service's mount point, relative to the database.
3739 * @param source - The service bundle to install.
3740 * @param options - Options for upgrading the service.
3741 *
3742 * @example
3743 * ```js
3744 * const db = new Database();
3745 * // Using a Buffer in Node.js as source
3746 * const source = new Blob([await fs.readFileSync("./my-foxx-service.zip")]);
3747 * const info = await db.upgradeService("/hello", source);
3748 * ```
3749 *
3750 * @example
3751 * ```js
3752 * const db = new Database();
3753 * // Using a Blob in Node.js as source
3754 * const source = await fs.openAsBlob("./my-foxx-service.zip");
3755 * const info = await db.upgradeService("/hello", source);
3756 * ```
3757 *
3758 * @example
3759 * ```js
3760 * const db = new Database();
3761 * // Using a File from a browser file input as source
3762 * const element = document.getElementById("my-file-input");
3763 * const source = element.files[0];
3764 * const info = await db.upgradeService("/hello", source);
3765 * ```
3766 */
3767 upgradeService(mount: string, source: File | Blob | string, options?: UpgradeServiceOptions): Promise<ServiceInfo>;
3768 /**
3769 * Completely removes a service from the database.
3770 *
3771 * @param mount - The service's mount point, relative to the database.
3772 * @param options - Options for uninstalling the service.
3773 *
3774 * @example
3775 * ```js
3776 * const db = new Database();
3777 * await db.uninstallService("/my-foxx");
3778 * ```
3779 */
3780 uninstallService(mount: string, options?: UninstallServiceOptions): Promise<void>;
3781 /**
3782 * Retrieves information about a mounted service.
3783 *
3784 * @param mount - The service's mount point, relative to the database.
3785 *
3786 * @example
3787 * ```js
3788 * const db = new Database();
3789 * const info = await db.getService("/my-service");
3790 * // info contains detailed information about the service
3791 * ```
3792 */
3793 getService(mount: string): Promise<ServiceInfo>;
3794 /**
3795 * Retrieves information about the service's configuration options and their
3796 * current values.
3797 *
3798 * See also {@link Database#replaceServiceConfiguration} and
3799 * {@link Database#updateServiceConfiguration}.
3800 *
3801 * @param mount - The service's mount point, relative to the database.
3802 * @param minimal - If set to `true`, the result will only include each
3803 * configuration option's current value. Otherwise it will include the full
3804 * definition for each option.
3805 *
3806 * @example
3807 * ```js
3808 * const db = new Database();
3809 * const config = await db.getServiceConfiguration("/my-service");
3810 * for (const [key, option] of Object.entries(config)) {
3811 * console.log(`${option.title} (${key}): ${option.current}`);
3812 * }
3813 * ```
3814 */
3815 getServiceConfiguration(mount: string, minimal?: false): Promise<Record<string, ServiceConfiguration>>;
3816 /**
3817 * Retrieves information about the service's configuration options and their
3818 * current values.
3819 *
3820 * See also {@link Database#replaceServiceConfiguration} and
3821 * {@link Database#updateServiceConfiguration}.
3822 *
3823 * @param mount - The service's mount point, relative to the database.
3824 * @param minimal - If set to `true`, the result will only include each
3825 * configuration option's current value. Otherwise it will include the full
3826 * definition for each option.
3827 *
3828 * @example
3829 * ```js
3830 * const db = new Database();
3831 * const config = await db.getServiceConfiguration("/my-service", true);
3832 * for (const [key, value] of Object.entries(config)) {
3833 * console.log(`${key}: ${value}`);
3834 * }
3835 * ```
3836 */
3837 getServiceConfiguration(mount: string, minimal: true): Promise<Record<string, any>>;
3838 /**
3839 * Replaces the configuration of the given service, discarding any existing
3840 * values for options not specified.
3841 *
3842 * See also {@link Database#updateServiceConfiguration} and
3843 * {@link Database#getServiceConfiguration}.
3844 *
3845 * @param mount - The service's mount point, relative to the database.
3846 * @param cfg - An object mapping configuration option names to values.
3847 * @param minimal - If set to `true`, the result will only include each
3848 * configuration option's current value and warning (if any).
3849 * Otherwise it will include the full definition for each option.
3850 *
3851 * @example
3852 * ```js
3853 * const db = new Database();
3854 * const config = { currency: "USD", locale: "en-US" };
3855 * const info = await db.replaceServiceConfiguration("/my-service", config);
3856 * for (const [key, option] of Object.entries(info)) {
3857 * console.log(`${option.title} (${key}): ${option.value}`);
3858 * if (option.warning) console.warn(`Warning: ${option.warning}`);
3859 * }
3860 * ```
3861 */
3862 replaceServiceConfiguration(mount: string, cfg: Record<string, any>, minimal?: false): Promise<Record<string, ServiceConfiguration & {
3863 warning?: string;
3864 }>>;
3865 /**
3866 * Replaces the configuration of the given service, discarding any existing
3867 * values for options not specified.
3868 *
3869 * See also {@link Database#updateServiceConfiguration} and
3870 * {@link Database#getServiceConfiguration}.
3871 *
3872 * @param mount - The service's mount point, relative to the database.
3873 * @param cfg - An object mapping configuration option names to values.
3874 * @param minimal - If set to `true`, the result will only include each
3875 * configuration option's current value and warning (if any).
3876 * Otherwise it will include the full definition for each option.
3877 *
3878 * @example
3879 * ```js
3880 * const db = new Database();
3881 * const config = { currency: "USD", locale: "en-US" };
3882 * const info = await db.replaceServiceConfiguration("/my-service", config);
3883 * for (const [key, value] of Object.entries(info.values)) {
3884 * console.log(`${key}: ${value}`);
3885 * if (info.warnings[key]) console.warn(`Warning: ${info.warnings[key]}`);
3886 * }
3887 * ```
3888 */
3889 replaceServiceConfiguration(mount: string, cfg: Record<string, any>, minimal: true): Promise<{
3890 values: Record<string, any>;
3891 warnings: Record<string, string>;
3892 }>;
3893 /**
3894 * Updates the configuration of the given service while maintaining any
3895 * existing values for options not specified.
3896 *
3897 * See also {@link Database#replaceServiceConfiguration} and
3898 * {@link Database#getServiceConfiguration}.
3899 *
3900 * @param mount - The service's mount point, relative to the database.
3901 * @param cfg - An object mapping configuration option names to values.
3902 * @param minimal - If set to `true`, the result will only include each
3903 * configuration option's current value and warning (if any).
3904 * Otherwise it will include the full definition for each option.
3905 *
3906 * @example
3907 * ```js
3908 * const db = new Database();
3909 * const config = { currency: "USD", locale: "en-US" };
3910 * const info = await db.updateServiceConfiguration("/my-service", config);
3911 * for (const [key, option] of Object.entries(info)) {
3912 * console.log(`${option.title} (${key}): ${option.value}`);
3913 * if (option.warning) console.warn(`Warning: ${option.warning}`);
3914 * }
3915 * ```
3916 */
3917 updateServiceConfiguration(mount: string, cfg: Record<string, any>, minimal?: false): Promise<Record<string, ServiceConfiguration & {
3918 warning?: string;
3919 }>>;
3920 /**
3921 * Updates the configuration of the given service while maintaining any
3922 * existing values for options not specified.
3923 *
3924 * See also {@link Database#replaceServiceConfiguration} and
3925 * {@link Database#getServiceConfiguration}.
3926 *
3927 * @param mount - The service's mount point, relative to the database.
3928 * @param cfg - An object mapping configuration option names to values.
3929 * @param minimal - If set to `true`, the result will only include each
3930 * configuration option's current value and warning (if any).
3931 * Otherwise it will include the full definition for each option.
3932 *
3933 * @example
3934 * ```js
3935 * const db = new Database();
3936 * const config = { currency: "USD", locale: "en-US" };
3937 * const info = await db.updateServiceConfiguration("/my-service", config);
3938 * for (const [key, value] of Object.entries(info.values)) {
3939 * console.log(`${key}: ${value}`);
3940 * if (info.warnings[key]) console.warn(`Warning: ${info.warnings[key]}`);
3941 * }
3942 * ```
3943 */
3944 updateServiceConfiguration(mount: string, cfg: Record<string, any>, minimal: true): Promise<{
3945 values: Record<string, any>;
3946 warnings: Record<string, string>;
3947 }>;
3948 /**
3949 * Retrieves information about the service's dependencies and their current
3950 * mount points.
3951 *
3952 * See also {@link Database#replaceServiceDependencies} and
3953 * {@link Database#updateServiceDependencies}.
3954 *
3955 * @param mount - The service's mount point, relative to the database.
3956 * @param minimal - If set to `true`, the result will only include each
3957 * dependency's current mount point. Otherwise it will include the full
3958 * definition for each dependency.
3959 *
3960 * @example
3961 * ```js
3962 * const db = new Database();
3963 * const deps = await db.getServiceDependencies("/my-service");
3964 * for (const [key, dep] of Object.entries(deps)) {
3965 * console.log(`${dep.title} (${key}): ${dep.current}`);
3966 * }
3967 * ```
3968 */
3969 getServiceDependencies(mount: string, minimal?: false): Promise<Record<string, SingleServiceDependency | MultiServiceDependency>>;
3970 /**
3971 * Retrieves information about the service's dependencies and their current
3972 * mount points.
3973 *
3974 * See also {@link Database#replaceServiceDependencies} and
3975 * {@link Database#updateServiceDependencies}.
3976 *
3977 * @param mount - The service's mount point, relative to the database.
3978 * @param minimal - If set to `true`, the result will only include each
3979 * dependency's current mount point. Otherwise it will include the full
3980 * definition for each dependency.
3981 *
3982 * @example
3983 * ```js
3984 * const db = new Database();
3985 * const deps = await db.getServiceDependencies("/my-service", true);
3986 * for (const [key, value] of Object.entries(deps)) {
3987 * console.log(`${key}: ${value}`);
3988 * }
3989 * ```
3990 */
3991 getServiceDependencies(mount: string, minimal: true): Promise<Record<string, string | string[]>>;
3992 /**
3993 * Replaces the dependencies of the given service, discarding any existing
3994 * mount points for dependencies not specified.
3995 *
3996 * See also {@link Database#updateServiceDependencies} and
3997 * {@link Database#getServiceDependencies}.
3998 *
3999 * @param mount - The service's mount point, relative to the database.
4000 * @param cfg - An object mapping dependency aliases to mount points.
4001 * @param minimal - If set to `true`, the result will only include each
4002 * dependency's current mount point. Otherwise it will include the full
4003 * definition for each dependency.
4004 *
4005 * @example
4006 * ```js
4007 * const db = new Database();
4008 * const deps = { mailer: "/mailer-api", auth: "/remote-auth" };
4009 * const info = await db.replaceServiceDependencies("/my-service", deps);
4010 * for (const [key, dep] of Object.entries(info)) {
4011 * console.log(`${dep.title} (${key}): ${dep.current}`);
4012 * if (dep.warning) console.warn(`Warning: ${dep.warning}`);
4013 * }
4014 * ```
4015 */
4016 replaceServiceDependencies(mount: string, deps: Record<string, string>, minimal?: false): Promise<Record<string, (SingleServiceDependency | MultiServiceDependency) & {
4017 warning?: string;
4018 }>>;
4019 /**
4020 * Replaces the dependencies of the given service, discarding any existing
4021 * mount points for dependencies not specified.
4022 *
4023 * See also {@link Database#updateServiceDependencies} and
4024 * {@link Database#getServiceDependencies}.
4025 *
4026 * @param mount - The service's mount point, relative to the database.
4027 * @param cfg - An object mapping dependency aliases to mount points.
4028 * @param minimal - If set to `true`, the result will only include each
4029 * dependency's current mount point. Otherwise it will include the full
4030 * definition for each dependency.
4031 *
4032 * @example
4033 * ```js
4034 * const db = new Database();
4035 * const deps = { mailer: "/mailer-api", auth: "/remote-auth" };
4036 * const info = await db.replaceServiceDependencies(
4037 * "/my-service",
4038 * deps,
4039 * true
4040 * );
4041 * for (const [key, value] of Object.entries(info)) {
4042 * console.log(`${key}: ${value}`);
4043 * if (info.warnings[key]) console.warn(`Warning: ${info.warnings[key]}`);
4044 * }
4045 * ```
4046 */
4047 replaceServiceDependencies(mount: string, deps: Record<string, string>, minimal: true): Promise<{
4048 values: Record<string, string>;
4049 warnings: Record<string, string>;
4050 }>;
4051 /**
4052 * Updates the dependencies of the given service while maintaining any
4053 * existing mount points for dependencies not specified.
4054 *
4055 * See also {@link Database#replaceServiceDependencies} and
4056 * {@link Database#getServiceDependencies}.
4057 *
4058 * @param mount - The service's mount point, relative to the database.
4059 * @param cfg - An object mapping dependency aliases to mount points.
4060 * @param minimal - If set to `true`, the result will only include each
4061 * dependency's current mount point. Otherwise it will include the full
4062 * definition for each dependency.
4063 *
4064 * @example
4065 * ```js
4066 * const db = new Database();
4067 * const deps = { mailer: "/mailer-api", auth: "/remote-auth" };
4068 * const info = await db.updateServiceDependencies("/my-service", deps);
4069 * for (const [key, dep] of Object.entries(info)) {
4070 * console.log(`${dep.title} (${key}): ${dep.current}`);
4071 * if (dep.warning) console.warn(`Warning: ${dep.warning}`);
4072 * }
4073 * ```
4074 */
4075 updateServiceDependencies(mount: string, deps: Record<string, string>, minimal?: false): Promise<Record<string, (SingleServiceDependency | MultiServiceDependency) & {
4076 warning?: string;
4077 }>>;
4078 /**
4079 * Updates the dependencies of the given service while maintaining any
4080 * existing mount points for dependencies not specified.
4081 *
4082 * See also {@link Database#replaceServiceDependencies} and
4083 * {@link Database#getServiceDependencies}.
4084 *
4085 * @param mount - The service's mount point, relative to the database.
4086 * @param cfg - An object mapping dependency aliases to mount points.
4087 * @param minimal - If set to `true`, the result will only include each
4088 * dependency's current mount point. Otherwise it will include the full
4089 * definition for each dependency.
4090 *
4091 * @example
4092 * ```js
4093 * const db = new Database();
4094 * const deps = { mailer: "/mailer-api", auth: "/remote-auth" };
4095 * const info = await db.updateServiceDependencies(
4096 * "/my-service",
4097 * deps,
4098 * true
4099 * );
4100 * for (const [key, value] of Object.entries(info)) {
4101 * console.log(`${key}: ${value}`);
4102 * if (info.warnings[key]) console.warn(`Warning: ${info.warnings[key]}`);
4103 * }
4104 * ```
4105 */
4106 updateServiceDependencies(mount: string, deps: Record<string, string>, minimal: true): Promise<{
4107 values: Record<string, string>;
4108 warnings: Record<string, string>;
4109 }>;
4110 /**
4111 * Enables or disables development mode for the given service.
4112 *
4113 * @param mount - The service's mount point, relative to the database.
4114 * @param enabled - Whether development mode should be enabled or disabled.
4115 *
4116 * @example
4117 * ```js
4118 * const db = new Database();
4119 * await db.setServiceDevelopmentMode("/my-service", true);
4120 * // the service is now in development mode
4121 * await db.setServiceDevelopmentMode("/my-service", false);
4122 * // the service is now in production mode
4123 * ```
4124 */
4125 setServiceDevelopmentMode(mount: string, enabled?: boolean): Promise<ServiceInfo>;
4126 /**
4127 * Retrieves a list of scripts defined in the service manifest's "scripts"
4128 * section mapped to their human readable representations.
4129 *
4130 * @param mount - The service's mount point, relative to the database.
4131 *
4132 * @example
4133 * ```js
4134 * const db = new Database();
4135 * const scripts = await db.listServiceScripts("/my-service");
4136 * for (const [name, title] of Object.entries(scripts)) {
4137 * console.log(`${name}: ${title}`);
4138 * }
4139 * ```
4140 */
4141 listServiceScripts(mount: string): Promise<Record<string, string>>;
4142 /**
4143 * Executes a service script and retrieves its result exposed as
4144 * `module.exports` (if any).
4145 *
4146 * @param mount - The service's mount point, relative to the database.
4147 * @param name - Name of the service script to execute as defined in the
4148 * service manifest.
4149 * @param params - Arbitrary value that will be exposed to the script as
4150 * `argv[0]` in the service context (e.g. `module.context.argv[0]`).
4151 * Must be serializable to JSON.
4152 *
4153 * @example
4154 * ```js
4155 * const db = new Database();
4156 * const result = await db.runServiceScript(
4157 * "/my-service",
4158 * "create-user",
4159 * {
4160 * username: "service_admin",
4161 * password: "hunter2"
4162 * }
4163 * );
4164 * ```
4165 */
4166 runServiceScript(mount: string, name: string, params?: any): Promise<any>;
4167 /**
4168 * Runs the tests of a given service and returns the results using the
4169 * "default" reporter.
4170 *
4171 * @param mount - The service's mount point, relative to the database.
4172 * @param options - Options for running the tests.
4173 *
4174 * @example
4175 * ```js
4176 * const db = new Database();
4177 * const testReport = await db.runServiceTests("/my-foxx");
4178 * ```
4179 */
4180 runServiceTests(mount: string, options?: {
4181 reporter?: "default";
4182 /**
4183 * Whether the reporter should use "idiomatic" mode. Has no effect when
4184 * using the "default" or "suite" reporters.
4185 */
4186 idiomatic?: false;
4187 /**
4188 * If set, only tests with full names including this exact string will be
4189 * executed.
4190 */
4191 filter?: string;
4192 }): Promise<ServiceTestDefaultReport>;
4193 /**
4194 * Runs the tests of a given service and returns the results using the
4195 * "suite" reporter, which groups the test result by test suite.
4196 *
4197 * @param mount - The service's mount point, relative to the database.
4198 * @param options - Options for running the tests.
4199 *
4200 * @example
4201 * ```js
4202 * const db = new Database();
4203 * const suiteReport = await db.runServiceTests(
4204 * "/my-foxx",
4205 * { reporter: "suite" }
4206 * );
4207 * ```
4208 */
4209 runServiceTests(mount: string, options: {
4210 reporter: "suite";
4211 /**
4212 * Whether the reporter should use "idiomatic" mode. Has no effect when
4213 * using the "default" or "suite" reporters.
4214 */
4215 idiomatic?: false;
4216 /**
4217 * If set, only tests with full names including this exact string will be
4218 * executed.
4219 */
4220 filter?: string;
4221 }): Promise<ServiceTestSuiteReport>;
4222 /**
4223 * Runs the tests of a given service and returns the results using the
4224 * "stream" reporter, which represents the results as a sequence of tuples
4225 * representing events.
4226 *
4227 * @param mount - The service's mount point, relative to the database.
4228 * @param options - Options for running the tests.
4229 *
4230 * @example
4231 * ```js
4232 * const db = new Database();
4233 * const streamEvents = await db.runServiceTests(
4234 * "/my-foxx",
4235 * { reporter: "stream" }
4236 * );
4237 * ```
4238 */
4239 runServiceTests(mount: string, options: {
4240 reporter: "stream";
4241 /**
4242 * Whether the reporter should use "idiomatic" mode. If set to `true`,
4243 * the results will be returned as a formatted string.
4244 */
4245 idiomatic?: false;
4246 /**
4247 * If set, only tests with full names including this exact string will be
4248 * executed.
4249 */
4250 filter?: string;
4251 }): Promise<ServiceTestStreamReport>;
4252 /**
4253 * Runs the tests of a given service and returns the results using the
4254 * "tap" reporter, which represents the results as an array of strings using
4255 * the "tap" format.
4256 *
4257 * @param mount - The service's mount point, relative to the database.
4258 * @param options - Options for running the tests.
4259 *
4260 * @example
4261 * ```js
4262 * const db = new Database();
4263 * const tapLines = await db.runServiceTests(
4264 * "/my-foxx",
4265 * { reporter: "tap" }
4266 * );
4267 * ```
4268 */
4269 runServiceTests(mount: string, options: {
4270 reporter: "tap";
4271 /**
4272 * Whether the reporter should use "idiomatic" mode. If set to `true`,
4273 * the results will be returned as a formatted string.
4274 */
4275 idiomatic?: false;
4276 /**
4277 * If set, only tests with full names including this exact string will be
4278 * executed.
4279 */
4280 filter?: string;
4281 }): Promise<ServiceTestTapReport>;
4282 /**
4283 * Runs the tests of a given service and returns the results using the
4284 * "xunit" reporter, which represents the results as an XML document using
4285 * the JSONML exchange format.
4286 *
4287 * @param mount - The service's mount point, relative to the database.
4288 * @param options - Options for running the tests.
4289 *
4290 * @example
4291 * ```js
4292 * const db = new Database();
4293 * const jsonML = await db.runServiceTests(
4294 * "/my-foxx",
4295 * { reporter: "xunit" }
4296 * );
4297 * ```
4298 */
4299 runServiceTests(mount: string, options: {
4300 reporter: "xunit";
4301 /**
4302 * Whether the reporter should use "idiomatic" mode. If set to `true`,
4303 * the results will be returned as a formatted string.
4304 */
4305 idiomatic?: false;
4306 /**
4307 * If set, only tests with full names including this exact string will be
4308 * executed.
4309 */
4310 filter?: string;
4311 }): Promise<ServiceTestXunitReport>;
4312 /**
4313 * Runs the tests of a given service and returns the results as a string
4314 * using the "stream" reporter in "idiomatic" mode, which represents the
4315 * results as a line-delimited JSON stream of tuples representing events.
4316 *
4317 * @param mount - The service's mount point, relative to the database.
4318 * @param options - Options for running the tests.
4319 *
4320 * @example
4321 * ```js
4322 * const db = new Database();
4323 * const streamReport = await db.runServiceTests(
4324 * "/my-foxx",
4325 * { reporter: "stream", idiomatic: true }
4326 * );
4327 * ```
4328 */
4329 runServiceTests(mount: string, options: {
4330 reporter: "stream";
4331 /**
4332 * Whether the reporter should use "idiomatic" mode. If set to `false`,
4333 * the results will be returned as an array of tuples instead of a
4334 * string.
4335 */
4336 idiomatic: true;
4337 /**
4338 * If set, only tests with full names including this exact string will be
4339 * executed.
4340 */
4341 filter?: string;
4342 }): Promise<string>;
4343 /**
4344 * Runs the tests of a given service and returns the results as a string
4345 * using the "tap" reporter in "idiomatic" mode, which represents the
4346 * results using the "tap" format.
4347 *
4348 * @param mount - The service's mount point, relative to the database.
4349 * @param options - Options for running the tests.
4350 *
4351 * @example
4352 * ```js
4353 * const db = new Database();
4354 * const tapReport = await db.runServiceTests(
4355 * "/my-foxx",
4356 * { reporter: "tap", idiomatic: true }
4357 * );
4358 * ```
4359 */
4360 runServiceTests(mount: string, options: {
4361 reporter: "tap";
4362 /**
4363 * Whether the reporter should use "idiomatic" mode. If set to `false`,
4364 * the results will be returned as an array of strings instead of a
4365 * single string.
4366 */
4367 idiomatic: true;
4368 /**
4369 * If set, only tests with full names including this exact string will be
4370 * executed.
4371 */
4372 filter?: string;
4373 }): Promise<string>;
4374 /**
4375 * Runs the tests of a given service and returns the results as a string
4376 * using the "xunit" reporter in "idiomatic" mode, which represents the
4377 * results as an XML document.
4378 *
4379 * @param mount - The service's mount point, relative to the database.
4380 * @param options - Options for running the tests.
4381 *
4382 * @example
4383 * ```js
4384 * const db = new Database();
4385 * const xml = await db.runServiceTests(
4386 * "/my-foxx",
4387 * { reporter: "xunit", idiomatic: true }
4388 * );
4389 * ```
4390 */
4391 runServiceTests(mount: string, options: {
4392 reporter: "xunit";
4393 /**
4394 * Whether the reporter should use "idiomatic" mode. If set to `false`,
4395 * the results will be returned using the JSONML exchange format
4396 * instead of a string.
4397 */
4398 idiomatic: true;
4399 /**
4400 * If set, only tests with full names including this exact string will be
4401 * executed.
4402 */
4403 filter?: string;
4404 }): Promise<string>;
4405 /**
4406 * Retrieves the text content of the service's `README` or `README.md` file.
4407 *
4408 * Returns `undefined` if no such file could be found.
4409 *
4410 * @param mount - The service's mount point, relative to the database.
4411 *
4412 * @example
4413 * ```js
4414 * const db = new Database();
4415 * const readme = await db.getServiceReadme("/my-service");
4416 * if (readme !== undefined) console.log(readme);
4417 * else console.warn(`No README found.`)
4418 * ```
4419 */
4420 getServiceReadme(mount: string): Promise<string | undefined>;
4421 /**
4422 * Retrieves an Open API compatible Swagger API description object for the
4423 * service installed at the given mount point.
4424 *
4425 * @param mount - The service's mount point, relative to the database.
4426 *
4427 * @example
4428 * ```js
4429 * const db = new Database();
4430 * const spec = await db.getServiceDocumentation("/my-service");
4431 * // spec is a Swagger API description of the service
4432 * ```
4433 */
4434 getServiceDocumentation(mount: string): Promise<SwaggerJson>;
4435 /**
4436 * Retrieves a zip bundle containing the service files.
4437 *
4438 * Returns a `Buffer` in node.js or `Blob` in the browser.
4439 *
4440 * @param mount - The service's mount point, relative to the database.
4441 *
4442 * @example
4443 * ```js
4444 * const db = new Database();
4445 * const serviceBundle = await db.downloadService("/my-foxx");
4446 * ```
4447 */
4448 downloadService(mount: string): Promise<Buffer | Blob>;
4449 /**
4450 * Writes all locally available services to the database and updates any
4451 * service bundles missing in the database.
4452 *
4453 * @param replace - If set to `true`, outdated services will also be
4454 * committed. This can be used to solve some consistency problems when
4455 * service bundles are missing in the database or were deleted manually.
4456 *
4457 * @example
4458 * ```js
4459 * await db.commitLocalServiceState();
4460 * // all services available on the coordinator have been written to the db
4461 * ```
4462 *
4463 * @example
4464 * ```js
4465 * await db.commitLocalServiceState(true);
4466 * // all service conflicts have been resolved in favor of this coordinator
4467 * ```
4468 */
4469 commitLocalServiceState(replace?: boolean): Promise<void>;
4470 /**
4471 * (Enterprise Edition only.) Creates a hot backup of the entire ArangoDB
4472 * deployment including all databases, collections, etc.
4473 *
4474 * Returns an object describing the backup result.
4475 *
4476 * @param options - Options for creating the backup.
4477 *
4478 * @example
4479 * ```js
4480 * const info = await db.createHotBackup();
4481 * // a hot backup has been created
4482 * ```
4483 */
4484 createHotBackup(options?: HotBackupOptions): Promise<HotBackupResult>;
4485 /**
4486 * (Enterprise Edition only.) Retrieves a list of all locally found hot
4487 * backups.
4488 *
4489 * @param id - If specified, only the backup with the given ID will be
4490 * returned.
4491 *
4492 * @example
4493 * ```js
4494 * const backups = await db.listHotBackups();
4495 * for (const backup of backups) {
4496 * console.log(backup.id);
4497 * }
4498 * ```
4499 */
4500 listHotBackups(id?: string | string[]): Promise<HotBackupList>;
4501 /**
4502 * (Enteprise Edition only.) Restores a consistent local hot backup.
4503 *
4504 * Returns the directory path of the restored backup.
4505 *
4506 * @param id - The ID of the backup to restore.
4507 *
4508 * @example
4509 * ```js
4510 * await db.restoreHotBackup("2023-09-19T15.38.21Z_example");
4511 * // the backup has been restored
4512 * ```
4513 */
4514 restoreHotBackup(id: string): Promise<string>;
4515 /**
4516 * (Enterprise Edition only.) Deletes a local hot backup.
4517 *
4518 * @param id - The ID of the backup to delete.
4519 *
4520 * @example
4521 * ```js
4522 * await db.deleteHotBackup("2023-09-19T15.38.21Z_example");
4523 * // the backup has been deleted
4524 * ```
4525 */
4526 deleteHotBackup(id: string): Promise<void>;
4527 /**
4528 * Retrieves the log messages from the server's global log.
4529 *
4530 * @param options - Options for retrieving the log entries.
4531 *
4532 * @example
4533 * ```js
4534 * const log = await db.getLogEntries();
4535 * for (let i = 0; i < log.totalAmount; i++) {
4536 * console.log(`${
4537 * new Date(log.timestamp[i] * 1000).toISOString()
4538 * } - [${LogLevel[log.level[i]]}] ${log.text[i]} (#${log.lid[i]})`);
4539 * }
4540 * ```
4541 */
4542 getLogEntries(options?: LogEntriesOptions): Promise<LogEntries>;
4543 /**
4544 * Retrieves the log messages from the server's global log.
4545 *
4546 * @param options - Options for retrieving the log entries.
4547 *
4548 * @deprecated This endpoint has been deprecated in ArangoDB 3.8.
4549 * Use {@link Database#getLogEntries} instead.
4550 *
4551 * @example
4552 * ```js
4553 * const messages = await db.getLogMessages();
4554 * for (const m of messages) {
4555 * console.log(`${m.date} - [${m.level}] ${m.message} (#${m.id})`);
4556 * }
4557 * ```
4558 */
4559 getLogMessages(options?: LogEntriesOptions): Promise<LogMessage[]>;
4560 /**
4561 * Retrieves the server's current log level for each topic.
4562 *
4563 * @example
4564 * ```js
4565 * const levels = await db.getLogLevel();
4566 * console.log(levels.request); // log level for incoming requests
4567 * ```
4568 */
4569 getLogLevel(): Promise<Record<string, LogLevelSetting>>;
4570 /**
4571 * Sets the server's log level for each of the given topics to the given level.
4572 *
4573 * Any omitted topics will be left unchanged.
4574 *
4575 * @param levels - An object mapping topic names to log levels.
4576 *
4577 * @example
4578 * ```js
4579 * await db.setLogLevel({ request: "debug" });
4580 * // Debug information will now be logged for each request
4581 * ```
4582 */
4583 setLogLevel(levels: Record<string, LogLevelSetting>): Promise<Record<string, LogLevelSetting>>;
4584 /**
4585 * Returns a {@link job.Job} instance for the given `jobId`.
4586 *
4587 * @param jobId - ID of the async job.
4588 *
4589 * @example
4590 * ```js
4591 * const db = new Database();
4592 * const job = db.job("12345");
4593 * ```
4594 */
4595 job(jobId: string): Job;
4596 /**
4597 * Returns a list of the IDs of all currently pending async jobs.
4598 *
4599 * @example
4600 * ```js
4601 * const db = new Database();
4602 * const pendingJobs = await db.listPendingJobs();
4603 * console.log(pendingJobs); // e.g. ["12345", "67890"]
4604 * ```
4605 */
4606 listPendingJobs(): Promise<string[]>;
4607 /**
4608 * Returns a list of the IDs of all currently available completed async jobs.
4609 *
4610 * @example
4611 * ```js
4612 * const db = new Database();
4613 * const completedJobs = await db.listCompletedJobs();
4614 * console.log(completedJobs); // e.g. ["12345", "67890"]
4615 * ```
4616 */
4617 listCompletedJobs(): Promise<string[]>;
4618 /**
4619 * Deletes the results of all completed async jobs created before the given
4620 * threshold.
4621 *
4622 * @param threshold - The expiration timestamp in milliseconds.
4623 *
4624 * @example
4625 * ```js
4626 * const db = new Database();
4627 * const ONE_WEEK = 7 * 24 * 60 * 60 * 1000;
4628 * await db.deleteExpiredJobResults(Date.now() - ONE_WEEK);
4629 * // all job results older than a week have been deleted
4630 * ```
4631 */
4632 deleteExpiredJobResults(threshold: number): Promise<void>;
4633 /**
4634 * Deletes the results of all completed async jobs.
4635 */
4636 deleteAllJobResults(): Promise<void>;
4637}
4638export {};
4639//# sourceMappingURL=database.d.ts.map
\No newline at end of file