arangojs 7.7.0 → 7.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/database.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"database.js","sourceRoot":"","sources":["../src/database.ts"],"names":[],"mappings":";;;AAaA,yCAIoB;AACpB,+BAAuE;AACvE,6CAUsB;AACtB,6CAOsB;AACtB,qCAA2D;AAC3D,mCAAwC;AAExC,mCAKiB;AAEjB,uCAAiD;AACjD,+CAAyC;AAEzC,mCAAgC;AAChC,+CAA4C;AAC5C,iCAMgB;AAEhB;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,QAAa;IAC5C,OAAO,OAAO,CAAC,QAAQ,IAAI,QAAQ,CAAC,gBAAgB,CAAC,CAAC;AACxD,CAAC;AAFD,4CAEC;AAED;;;GAGG;AACH,SAAS,4BAA4B,CACnC,WAIoB;IAEpB,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;QACnC,OAAO,EAAE,KAAK,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC;KACjC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;QAC9B,OAAO,EAAE,KAAK,EAAE,WAAW,CAAC,GAAG,CAAC,+BAAkB,CAAC,EAAE,CAAC;KACvD;IACD,IAAI,+BAAkB,CAAC,WAAW,CAAC,EAAE;QACnC,OAAO,EAAE,KAAK,EAAE,+BAAkB,CAAC,WAAW,CAAC,EAAE,CAAC;KACnD;IACD,MAAM,IAAI,GAAkC,EAAE,CAAC;IAC/C,IAAI,WAAW,EAAE;QACf,IAAI,WAAW,CAAC,aAAa,KAAK,SAAS,EAAE;YAC3C,IAAI,CAAC,aAAa,GAAG,WAAW,CAAC,aAAa,CAAC;SAChD;QACD,IAAI,WAAW,CAAC,IAAI,EAAE;YACpB,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC;gBACzC,CAA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AO,IAAI,CAAC,OAAO,CACjB;YACE,IAAI,EAAE,oBAAoB;YAC1B,EAAE,EAAE,EAAE,KAAK,EAAE;SACd,EACD,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAClB,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,eAAe,CAAC,KAAa;QAC3B,OAAO,IAAI,CAAC,OAAO,CACjB;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,qBAAqB;YAC3B,EAAE,EAAE,EAAE,KAAK,EAAE;YACb,YAAY,EAAE,IAAI;SACnB,EACD,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAClB,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,uBAAuB,CAAC,UAAmB,KAAK;QAC9C,OAAO,IAAI,CAAC,OAAO,CACjB;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,mBAAmB;YACzB,EAAE,EAAE,EAAE,OAAO,EAAE;SAChB,EACD,GAAG,EAAE,CAAC,SAAS,CAChB,CAAC;IACJ,CAAC;CAEF;AAjzHD,4BAizHC","sourcesContent":["/**\n * ```js\n * import { Database } from \"arangojs/database\";\n * ```\n *\n * The \"database\" module provides the {@link Database} class and associated\n * types and interfaces for TypeScript.\n *\n * The Database class is also re-exported by the \"index\" module.\n *\n * @packageDocumentation\n */\nimport { Readable } from \"stream\";\nimport {\n Analyzer,\n AnalyzerDescription,\n CreateAnalyzerOptions,\n} from \"./analyzer\";\nimport { AqlLiteral, AqlQuery, isAqlLiteral, isAqlQuery } from \"./aql\";\nimport {\n ArangoCollection,\n Collection,\n CollectionMetadata,\n collectionToString,\n CollectionType,\n CreateCollectionOptions,\n DocumentCollection,\n EdgeCollection,\n isArangoCollection,\n} from \"./collection\";\nimport {\n ArangoResponseMetadata,\n Config,\n Connection,\n Dict,\n Headers,\n RequestOptions,\n} from \"./connection\";\nimport { ArrayCursor, BatchedArrayCursor } from \"./cursor\";\nimport { isArangoError } from \"./error\";\nimport { FoxxManifest } from \"./foxx-manifest\";\nimport {\n EdgeDefinitionOptions,\n Graph,\n GraphCreateOptions,\n GraphInfo,\n} from \"./graph\";\nimport { Blob } from \"./lib/blob\";\nimport { DATABASE_NOT_FOUND } from \"./lib/codes\";\nimport { toForm } from \"./lib/multipart\";\nimport { ArangojsResponse } from \"./lib/request\";\nimport { Route } from \"./route\";\nimport { Transaction } from \"./transaction\";\nimport {\n ArangoSearchView,\n ArangoSearchViewPropertiesOptions,\n View,\n ViewDescription,\n ViewType,\n} from \"./view\";\n\n/**\n * Indicates whether the given value represents a {@link Database}.\n *\n * @param database - A value that might be a database.\n */\nexport function isArangoDatabase(database: any): database is Database {\n return Boolean(database && database.isArangoDatabase);\n}\n\n/**\n * @internal\n * @hidden\n */\nfunction coerceTransactionCollections(\n collections:\n | (TransactionCollections & { allowImplicit?: boolean })\n | (string | ArangoCollection)[]\n | string\n | ArangoCollection\n): CoercedTransactionCollections {\n if (typeof collections === \"string\") {\n return { write: [collections] };\n }\n if (Array.isArray(collections)) {\n return { write: collections.map(collectionToString) };\n }\n if (isArangoCollection(collections)) {\n return { write: collectionToString(collections) };\n }\n const cols: CoercedTransactionCollections = {};\n if (collections) {\n if (collections.allowImplicit !== undefined) {\n cols.allowImplicit = collections.allowImplicit;\n }\n if (collections.read) {\n cols.read = Array.isArray(collections.read)\n ? collections.read.map(collectionToString)\n : collectionToString(collections.read);\n }\n if (collections.write) {\n cols.write = Array.isArray(collections.write)\n ? collections.write.map(collectionToString)\n : collectionToString(collections.write);\n }\n if (collections.exclusive) {\n cols.exclusive = Array.isArray(collections.exclusive)\n ? collections.exclusive.map(collectionToString)\n : collectionToString(collections.exclusive);\n }\n }\n return cols;\n}\n\n/**\n * @internal\n * @hidden\n */\ntype CoercedTransactionCollections = {\n allowImplicit?: boolean;\n exclusive?: string | string[];\n write?: string | string[];\n read?: string | string[];\n};\n\n/**\n * Collections involved in a transaction.\n */\nexport type TransactionCollections = {\n /**\n * An array of collections or a single collection that will be read from or\n * written to during the transaction with no other writes being able to run\n * in parallel.\n */\n exclusive?: (string | ArangoCollection)[] | string | ArangoCollection;\n /**\n * An array of collections or a single collection that will be read from or\n * written to during the transaction.\n *\n * If ArangoDB is using the MMFiles storage engine, this option behaves\n * exactly like `exclusive`, i.e. no other writes will run in parallel.\n */\n write?: (string | ArangoCollection)[] | string | ArangoCollection;\n /**\n * An array of collections or a single collection that will be read from\n * during the transaction.\n */\n read?: (string | ArangoCollection)[] | string | ArangoCollection;\n};\n\n/**\n * Options for how the transaction should be performed.\n */\nexport type TransactionOptions = {\n /**\n * Whether the transaction may read from collections not specified for this\n * transaction. If set to `false`, accessing any collections not specified\n * will result in the transaction being aborted to avoid potential deadlocks.\n *\n * Default: `true`.\n */\n allowImplicit?: boolean;\n /**\n * Determines whether to force the transaction to write all data to disk\n * before returning.\n */\n waitForSync?: boolean;\n /**\n * Determines how long the database will wait while attempting to gain locks\n * on collections used by the transaction before timing out.\n */\n lockTimeout?: number;\n /**\n * (RocksDB only.) Determines the transaction size limit in bytes.\n */\n maxTransactionSize?: number;\n /**\n * (RocksDB only.) Determines the maximum number of operations after which an\n * intermediate commit is performed automatically.\n *\n * @deprecated Removed in ArangoDB 3.4.\n */\n intermediateCommitCount?: number;\n /**\n * (RocksDB only.) Determine the maximum total size of operations after which\n * an intermediate commit is performed automatically.\n *\n * @deprecated Removed in ArangoDB 3.4.\n */\n intermediateCommitSize?: number;\n};\n\n/**\n * Options for executing a query.\n *\n * See {@link Database.query}.\n */\nexport type QueryOptions = {\n /**\n * If set to `true`, the query will be executed with support for dirty reads\n * enabled, permitting ArangoDB to return a potentially dirty or stale result\n * and arangojs will load balance the request without distinguishing between\n * leaders and followers.\n *\n * Note that dirty reads are only supported for read-only queries, not data\n * modification queries (e.g. using `INSERT`, `UPDATE`, `REPLACE` or\n * `REMOVE`) and only when using ArangoDB 3.4 or later.\n *\n * Default: `false`\n */\n allowDirtyRead?: boolean;\n /**\n * Maximum time in milliseconds arangojs will wait for a server response.\n * Exceeding this value will result in the request being cancelled.\n *\n * **Note**: Setting a timeout for the client does not guarantee the query\n * will be killed by ArangoDB if it is already being executed. See the\n * `maxRuntime` option for limiting the execution time within ArangoDB.\n */\n timeout?: number;\n /**\n * Unless set to `false`, the number of result values in the result set will\n * be returned in the `count` attribute. This may be disabled by default in\n * a future version of ArangoDB if calculating this value has a performance\n * impact for some queries.\n *\n * Default: `true`.\n */\n count?: boolean;\n /**\n * Number of result values to be transferred by the server in each\n * network roundtrip (or \"batch\").\n *\n * Must be greater than zero.\n */\n batchSize?: number;\n /**\n * If set to `false`, the AQL query results cache lookup will be skipped for\n * this query.\n *\n * Default: `true`\n */\n cache?: boolean;\n /**\n * Maximum memory size in bytes that the query is allowed to use.\n * Exceeding this value will result in the query failing with an error.\n *\n * If set to `0`, the memory limit is disabled.\n *\n * Default: `0`\n */\n memoryLimit?: number;\n /**\n * Maximum allowed execution time before the query will be killed in seconds.\n *\n * If set to `0`, the query will be allowed to run indefinitely.\n *\n * Default: `0`\n */\n maxRuntime?: number;\n /**\n * Time-to-live for the cursor in seconds. The cursor results may be\n * garbage collected by ArangoDB after this much time has passed.\n *\n * Default: `30`\n */\n ttl?: number;\n /**\n * If set to `true`, the query will throw an exception and abort if it would\n otherwise produce a warning.\n */\n failOnWarning?: boolean;\n /**\n * If set to `1` or `true`, additional query profiling information will be\n * returned in the `extra.profile` attribute if the query is not served from\n * the result cache.\n *\n * If set to `2`, the query will return execution stats per query plan node\n * in the `extra.stats.nodes` attribute. Additionally the query plan is\n * returned in `extra.plan`.\n */\n profile?: boolean | number;\n /**\n * If set to `true`, the query will be executed as a streaming query.\n */\n stream?: boolean;\n /**\n * Limits the maximum number of warnings a query will return.\n */\n maxWarningsCount?: number;\n /**\n * If set to `true` and the query has a `LIMIT` clause, the total number of\n * values matched before the last top-level `LIMIT` in the query was applied\n * will be returned in the `extra.stats.fullCount` attribute.\n */\n fullCount?: boolean;\n /**\n * If set to `false`, the query data will not be stored in the RocksDB block\n * cache. This can be used to avoid thrashing he block cache when reading a\n * lot of data.\n */\n fillBlockCache?: boolean;\n /**\n * An object with a `rules` property specifying a list of optimizer rules to\n * be included or excluded by the optimizer for this query. Prefix a rule\n * name with `+` to include it, or `-` to exclude it. The name `all` acts as\n * an alias matching all optimizer rules.\n */\n optimizer?: { rules: string[] };\n /**\n * Limits the maximum number of plans that will be created by the AQL query\n * optimizer.\n */\n maxPlans?: number;\n /**\n * Controls after how many execution nodes in a query a stack split should be\n * performed.\n *\n * Default: `250` (`200` on macOS)\n */\n maxNodesPerCallstack?: number;\n /**\n * (RocksDB only.) Maximum size of transactions in bytes.\n */\n maxTransactionSize?: number;\n /**\n * (RocksDB only.) Maximum number of operations after which an intermediate\n * commit is automatically performed.\n */\n intermediateCommitCount?: number;\n /**\n * (RocksDB only.) Maximum total size of operations in bytes after which an\n * intermediate commit is automatically performed.\n */\n intermediateCommitSize?: number;\n /**\n * (Enterprise Edition cluster only.) If set to `true`, collections\n * inaccessible to current user will result in an access error instead\n * of being treated as empty.\n */\n skipInaccessibleCollections?: boolean;\n /**\n * (Enterprise Edition cluster only.) Limits the maximum time in seconds a\n * DBServer will wait to bring satellite collections involved in the query\n * into sync. Exceeding this value will result in the query being stopped.\n *\n * Default: `60`\n */\n satelliteSyncWait?: number;\n};\n\n/**\n * Options for explaining a query.\n *\n * See {@link Database.explain}.\n */\nexport type ExplainOptions = {\n /**\n * An object with a `rules` property specifying a list of optimizer rules to\n * be included or excluded by the optimizer for this query. Prefix a rule\n * name with `+` to include it, or `-` to exclude it. The name `all` acts as\n * an alias matching all optimizer rules.\n */\n optimizer?: { rules: string[] };\n /**\n * Maximum number of plans that the optimizer is allowed to generate.\n * Setting this to a low value limits the amount of work the optimizer does.\n */\n maxNumberOfPlans?: number;\n /**\n * If set to true, all possible execution plans will be returned as the\n * `plans` property. Otherwise only the optimal execution plan will be\n * returned as the `plan` property.\n *\n * Default: `false`\n */\n allPlans?: boolean;\n};\n\n/**\n * Details for a transaction.\n *\n * See also {@link TransactionStatus}.\n */\nexport type TransactionDetails = {\n /**\n * Unique identifier of the transaction.\n */\n id: string;\n /**\n * Status (or \"state\") of the transaction.\n */\n state: \"running\" | \"committed\" | \"aborted\";\n};\n\n/**\n * Plan explaining query execution.\n */\nexport type ExplainPlan = {\n /**\n * Execution nodes in this plan.\n */\n nodes: {\n [key: string]: any;\n type: string;\n id: number;\n dependencies: number[];\n estimatedCost: number;\n estimatedNrItems: number;\n }[];\n /**\n * Rules applied by the optimizer.\n */\n rules: string[];\n /**\n * Information about collections involved in the query.\n */\n collections: {\n name: string;\n type: \"read\" | \"write\";\n }[];\n /**\n * Variables used in the query.\n */\n variables: {\n id: number;\n name: string;\n }[];\n /**\n * Total estimated cost of the plan.\n */\n estimatedCost: number;\n /**\n * Estimated number of items returned by the query.\n */\n estimatedNrItems: number;\n /**\n * Whether the query is a data modification query.\n */\n isModificationQuery: boolean;\n};\n\n/**\n * Result of explaining a query with a single plan.\n */\nexport type SingleExplainResult = {\n /**\n * Query plan.\n */\n plan: ExplainPlan;\n /**\n * Whether it would be possible to cache the query.\n */\n cacheable: boolean;\n /**\n * Warnings encountered while planning the query execution.\n */\n warnings: { code: number; message: string }[];\n /**\n * Statistical information about the query plan generation.\n */\n stats: {\n /**\n * Total number of rules executed for this query.\n */\n rulesExecuted: number;\n /**\n * Number of rules skipped for this query.\n */\n rulesSkipped: number;\n /**\n * Total number of plans created.\n */\n plansCreated: number;\n };\n};\n\n/**\n * Result of explaining a query with multiple plans.\n */\nexport type MultiExplainResult = {\n /**\n * Query plans.\n */\n plans: ExplainPlan[];\n /**\n * Whether it would be possible to cache the query.\n */\n cacheable: boolean;\n /**\n * Warnings encountered while planning the query execution.\n */\n warnings: { code: number; message: string }[];\n /**\n * Statistical information about the query plan generation.\n */\n stats: {\n /**\n * Total number of rules executed for this query.\n */\n rulesExecuted: number;\n /**\n * Number of rules skipped for this query.\n */\n rulesSkipped: number;\n /**\n * Total number of plans created.\n */\n plansCreated: number;\n };\n};\n\n/**\n * Node in an AQL abstract syntax tree (AST).\n */\nexport type AstNode = {\n [key: string]: any;\n type: string;\n subNodes: AstNode[];\n};\n\n/**\n * Result of parsing a query.\n */\nexport type ParseResult = {\n /**\n * Whether the query was parsed.\n */\n parsed: boolean;\n /**\n * Names of all collections involved in the query.\n */\n collections: string[];\n /**\n * Names of all bind parameters used in the query.\n */\n bindVars: string[];\n /**\n * Abstract syntax tree (AST) of the query.\n */\n ast: AstNode[];\n};\n\n/**\n * Information about query tracking.\n */\nexport type QueryTracking = {\n /**\n * Whether query tracking is enabled.\n */\n enabled: boolean;\n /**\n * Maximum query string length in bytes that is kept in the list.\n */\n maxQueryStringLength: number;\n /**\n * Maximum number of slow queries that is kept in the list.\n */\n maxSlowQueries: number;\n /**\n * Threshold execution time in seconds for when a query is\n * considered slow.\n */\n slowQueryThreshold: number;\n /**\n * Whether bind parameters are being tracked along with queries.\n */\n trackBindVars: boolean;\n /**\n * Whether slow queries are being tracked.\n */\n trackSlowQueries: boolean;\n};\n\n/**\n * Options for query tracking.\n *\n * See {@link Database.queryTracking}.\n */\nexport type QueryTrackingOptions = {\n /**\n * If set to `false`, neither queries nor slow queries will be tracked.\n */\n enabled?: boolean;\n /**\n * Maximum query string length in bytes that will be kept in the list.\n */\n maxQueryStringLength?: number;\n /**\n * Maximum number of slow queries to be kept in the list.\n */\n maxSlowQueries?: number;\n /**\n * Threshold execution time in seconds for when a query will be\n * considered slow.\n */\n slowQueryThreshold?: number;\n /**\n * If set to `true`, bind parameters will be tracked along with queries.\n */\n trackBindVars?: boolean;\n /**\n * If set to `true` and `enabled` is also set to `true`, slow queries will be\n * tracked if their execution time exceeds `slowQueryThreshold`.\n */\n trackSlowQueries?: boolean;\n};\n\n/**\n * Object describing a query.\n */\nexport type QueryInfo = {\n /**\n * Unique identifier for this query.\n */\n id: string;\n /**\n * Query string (potentially truncated).\n */\n query: string;\n /**\n * Bind parameters used in the query.\n */\n bindVars: Dict<any>;\n /**\n * Query's running time in seconds.\n */\n runTime: number;\n /**\n * Date and time the query was started.\n */\n started: string;\n /**\n * Query's current execution state.\n */\n state: \"executing\" | \"finished\" | \"killed\";\n /**\n * Whether the query uses a streaming cursor.\n */\n stream: boolean;\n};\n\n/**\n * Database user to create with a database.\n */\nexport type CreateDatabaseUser = {\n /**\n * Username of the user to create.\n */\n username: string;\n /**\n * Password of the user to create.\n *\n * Default: `\"\"`\n */\n passwd?: string;\n /**\n * Whether the user is active.\n *\n * Default: `true`\n */\n active?: boolean;\n /**\n * Additional data to store with the user object.\n */\n extra?: Dict<any>;\n};\n\n/**\n * Options for creating a database.\n *\n * See {@link Database.createDatabase}.\n */\nexport type CreateDatabaseOptions = {\n /**\n * Database users to create with the database.\n */\n users?: CreateDatabaseUser[];\n /**\n * (Cluster only.) The sharding method to use for new collections in the\n * database.\n */\n sharding?: \"\" | \"flexible\" | \"single\";\n /**\n * (Cluster only.) Default replication factor for new collections in this\n * database.\n *\n * Setting this to `1` disables replication. Setting this to `\"satellite\"`\n * will replicate to every DBServer.\n */\n replicationFactor?: \"satellite\" | number;\n /**\n * (Cluster only.) Default write concern for new collections created in this\n * database.\n */\n writeConcern?: number;\n /**\n * (Cluster only.) Default write concern for new collections created in this\n * database.\n *\n * @deprecated Renamed to `writeConcern` in ArangoDB 3.6.\n */\n minReplicationFactor?: number;\n};\n\n/**\n * Object describing a database.\n *\n * See {@link Database.get}.\n */\nexport type DatabaseInfo = {\n /**\n * Name of the database.\n */\n name: string;\n /**\n * Unique identifier of the database.\n */\n id: string;\n /**\n * File system path of the database.\n */\n path: string;\n /**\n * Whether the database is the system database.\n */\n isSystem: boolean;\n /**\n * (Cluster only.) The sharding method to use for new collections in the\n * database.\n */\n sharding?: \"\" | \"flexible\" | \"single\";\n /**\n * (Cluster only.) Default replication factor for new collections in this\n * database.\n */\n replicationFactor?: \"satellite\" | number;\n /**\n * (Cluster only.) Default write concern for new collections created in this\n * database.\n */\n writeConcern?: number;\n /**\n * (Cluster only.) Default write concern for new collections created in this\n * database.\n *\n * @deprecated Renamed to `writeConcern` in ArangoDB 3.6.\n */\n minReplicationFactor?: number;\n};\n\n/**\n * Result of retrieving database version information.\n */\nexport type VersionInfo = {\n /**\n * Value identifying the server type, i.e. `\"arango\"`.\n */\n server: string;\n /**\n * ArangoDB license type or \"edition\".\n */\n license: \"community\" | \"enterprise\";\n /**\n * ArangoDB server version.\n */\n version: string;\n /**\n * Additional information about the ArangoDB server.\n */\n details?: { [key: string]: string };\n};\n\n/**\n * Definition of an AQL User Function.\n */\nexport type AqlUserFunction = {\n /**\n * Name of the AQL User Function.\n */\n name: string;\n /**\n * Implementation of the AQL User Function.\n */\n code: string;\n /**\n * Whether the function is deterministic.\n *\n * See {@link Database.createFunction}.\n */\n isDeterministic: boolean;\n};\n\n/**\n * Options for installing the service.\n *\n * See {@link Database.installService}.\n */\nexport type InstallServiceOptions = {\n /**\n * An object mapping configuration option names to values.\n *\n * See also {@link Database.getServiceConfiguration}.\n */\n configuration?: Dict<any>;\n /**\n * An object mapping dependency aliases to mount points.\n *\n * See also {@link Database.getServiceDependencies}.\n */\n dependencies?: Dict<string>;\n /**\n * Whether the service should be installed in development mode.\n *\n * See also {@link Database.setServiceDevelopmentMode}.\n *\n * Default: `false`\n */\n development?: boolean;\n /**\n * Whether the service should be installed in legacy compatibility mode\n *\n * This overrides the `engines` option in the service manifest (if any).\n *\n * Default: `false`\n */\n legacy?: boolean;\n /**\n * Whether the \"setup\" script should be executed.\n *\n * Default: `true`\n */\n setup?: boolean;\n};\n\n/**\n * Options for replacing a service.\n *\n * See {@link Database.replaceService}.\n */\nexport type ReplaceServiceOptions = {\n /**\n * An object mapping configuration option names to values.\n *\n * See also {@link Database.getServiceConfiguration}.\n */\n configuration?: Dict<any>;\n /**\n * An object mapping dependency aliases to mount points.\n *\n * See also {@link Database.getServiceDependencies}.\n */\n dependencies?: Dict<string>;\n /**\n * Whether the service should be installed in development mode.\n *\n * See also {@link Database.setServiceDevelopmentMode}.\n *\n * Default: `false`\n */\n development?: boolean;\n /**\n * Whether the service should be installed in legacy compatibility mode\n *\n * This overrides the `engines` option in the service manifest (if any).\n *\n * Default: `false`\n */\n legacy?: boolean;\n /**\n * Whether the \"setup\" script should be executed.\n *\n * Default: `true`\n */\n setup?: boolean;\n /**\n * Whether the existing service's \"teardown\" script should be executed\n * prior to removing that service.\n *\n * Default: `true`\n */\n teardown?: boolean;\n /**\n * If set to `true`, replacing a service that does not already exist will\n * fall back to installing the new service.\n *\n * Default: `false`\n */\n force?: boolean;\n};\n\n/**\n * Options for upgrading a service.\n *\n * See {@link Database.upgradeService}.\n */\nexport type UpgradeServiceOptions = {\n /**\n * An object mapping configuration option names to values.\n *\n * See also {@link Database.getServiceConfiguration}.\n */\n configuration?: Dict<any>;\n /**\n * An object mapping dependency aliases to mount points.\n *\n * See also {@link Database.getServiceDependencies}.\n */\n dependencies?: Dict<string>;\n /**\n * Whether the service should be installed in development mode.\n *\n * See also {@link Database.setServiceDevelopmentMode}.\n *\n * Default: `false`\n */\n development?: boolean;\n /**\n * Whether the service should be installed in legacy compatibility mode\n *\n * This overrides the `engines` option in the service manifest (if any).\n *\n * Default: `false`\n */\n legacy?: boolean;\n /**\n * Whether the \"setup\" script should be executed.\n *\n * Default: `true`\n */\n setup?: boolean;\n /**\n * Whether the existing service's \"teardown\" script should be executed\n * prior to upgrading that service.\n *\n * Default: `false`\n */\n teardown?: boolean;\n /**\n * Unless set to `true`, upgrading a service that does not already exist will\n * fall back to installing the new service.\n *\n * Default: `false`\n */\n force?: boolean;\n};\n\n/**\n * Options for uninstalling a service.\n *\n * See {@link Database.uninstallService}.\n */\nexport type UninstallServiceOptions = {\n /**\n * Whether the service's \"teardown\" script should be executed\n * prior to removing that service.\n *\n * Default: `true`\n */\n teardown?: boolean;\n /**\n * If set to `true`, uninstalling a service that does not already exist\n * will be considered successful.\n *\n * Default: `false`\n */\n force?: boolean;\n};\n\n/**\n * Object briefly describing a Foxx service.\n */\nexport type ServiceSummary = {\n /**\n * Service mount point, relative to the database.\n */\n mount: string;\n /**\n * Name defined in the service manifest.\n */\n name?: string;\n /**\n * Version defined in the service manifest.\n */\n version?: string;\n /**\n * Service dependencies the service expects to be able to match as a mapping\n * from dependency names to versions the service is compatible with.\n */\n provides: Dict<string>;\n /**\n * Whether development mode is enabled for this service.\n */\n development: boolean;\n /**\n * Whether the service is running in legacy compatibility mode.\n */\n legacy: boolean;\n};\n\n/**\n * Object describing a Foxx service in detail.\n */\nexport type ServiceInfo = {\n /**\n * Service mount point, relative to the database.\n */\n mount: string;\n /**\n * File system path of the service.\n */\n path: string;\n /**\n * Name defined in the service manifest.\n */\n name?: string;\n /**\n * Version defined in the service manifest.\n */\n version?: string;\n /**\n * Whether development mode is enabled for this service.\n */\n development: boolean;\n /**\n * Whether the service is running in legacy compatibility mode.\n */\n legacy: boolean;\n /**\n * Content of the service manifest of this service.\n */\n manifest: FoxxManifest;\n /**\n * Internal checksum of the service's initial source bundle.\n */\n checksum: string;\n /**\n * Options for this service.\n */\n options: {\n /**\n * Configuration values set for this service.\n */\n configuration: Dict<any>;\n /**\n * Service dependency configuration of this service.\n */\n dependencies: Dict<string>;\n };\n};\n\n/**\n * Object describing a configuration option of a Foxx service.\n */\nexport type ServiceConfiguration = {\n /**\n * Data type of the configuration value.\n *\n * **Note**: `\"int\"` and `\"bool\"` are historical synonyms for `\"integer\"` and\n * `\"boolean\"`. The `\"password\"` type is synonymous with `\"string\"` but can\n * be used to distinguish values which should not be displayed in plain text\n * by software when managing the service.\n */\n type:\n | \"integer\"\n | \"boolean\"\n | \"string\"\n | \"number\"\n | \"json\"\n | \"password\"\n | \"int\"\n | \"bool\";\n /**\n * Current value of the configuration option as stored internally.\n */\n currentRaw: any;\n /**\n * Processed current value of the configuration option as exposed in the\n * service code.\n */\n current: any;\n /**\n * Formatted name of the configuration option.\n */\n title: string;\n /**\n * Human-readable description of the configuration option.\n */\n description?: string;\n /**\n * Whether the configuration option must be set in order for the service\n * to be operational.\n */\n required: boolean;\n /**\n * Default value of the configuration option.\n */\n default?: any;\n};\n\n/**\n * Object describing a single-service dependency defined by a Foxx service.\n */\nexport type SingleServiceDependency = {\n /**\n * Whether this is a multi-service dependency.\n */\n multiple: false;\n /**\n * Current mount point the dependency is resolved to.\n */\n current?: string;\n /**\n * Formatted name of the dependency.\n */\n title: string;\n /**\n * Name of the service the dependency expects to match.\n */\n name: string;\n /**\n * Version of the service the dependency expects to match.\n */\n version: string;\n /**\n * Human-readable description of the dependency.\n */\n description?: string;\n /**\n * Whether the dependency must be matched in order for the service\n * to be operational.\n */\n required: boolean;\n};\n\n/**\n * Object describing a multi-service dependency defined by a Foxx service.\n */\nexport type MultiServiceDependency = {\n /**\n * Whether this is a multi-service dependency.\n */\n multiple: true;\n /**\n * Current mount points the dependency is resolved to.\n */\n current?: string[];\n /**\n * Formatted name of the dependency.\n */\n title: string;\n /**\n * Name of the service the dependency expects to match.\n */\n name: string;\n /**\n * Version of the service the dependency expects to match.\n */\n version: string;\n /**\n * Human-readable description of the dependency.\n */\n description?: string;\n /**\n * Whether the dependency must be matched in order for the service\n * to be operational.\n */\n required: boolean;\n};\n\n/**\n * Test stats for a Foxx service's tests.\n */\nexport type ServiceTestStats = {\n /**\n * Total number of tests found.\n */\n tests: number;\n /**\n * Number of tests that ran successfully.\n */\n passes: number;\n /**\n * Number of tests that failed.\n */\n failures: number;\n /**\n * Number of tests skipped or not executed.\n */\n pending: number;\n /**\n * Total test duration in milliseconds.\n */\n duration: number;\n};\n\n/**\n * Test results for a single test case using the stream reporter.\n */\nexport type ServiceTestStreamTest = {\n title: string;\n fullTitle: string;\n duration: number;\n err?: string;\n};\n\n/**\n * Test results for a Foxx service's tests using the stream reporter.\n */\nexport type ServiceTestStreamReport = (\n | [\"start\", { total: number }]\n | [\"pass\", ServiceTestStreamTest]\n | [\"fail\", ServiceTestStreamTest]\n | [\"end\", ServiceTestStats]\n)[];\n\n/**\n * Test results for a single test case using the suite reporter.\n */\nexport type ServiceTestSuiteTest = {\n result: \"pending\" | \"pass\" | \"fail\";\n title: string;\n duration: number;\n err?: any;\n};\n\n/**\n * Test results for a single test suite using the suite reporter.\n */\nexport type ServiceTestSuite = {\n title: string;\n suites: ServiceTestSuite[];\n tests: ServiceTestSuiteTest[];\n};\n\n/**\n * Test results for a Foxx service's tests using the suite reporter.\n */\nexport type ServiceTestSuiteReport = {\n stats: ServiceTestStats;\n suites: ServiceTestSuite[];\n tests: ServiceTestSuiteTest[];\n};\n\n/**\n * Test results for a single test case in XUnit format using the JSONML\n * representation.\n */\nexport type ServiceTestXunitTest =\n | [\"testcase\", { classname: string; name: string; time: number }]\n | [\n \"testcase\",\n { classname: string; name: string; time: number },\n [\"failure\", { message: string; type: string }, string]\n ];\n\n/**\n * Test results for a Foxx service's tests in XUnit format using the JSONML\n * representation.\n */\nexport type ServiceTestXunitReport = [\n \"testsuite\",\n {\n timestamp: number;\n tests: number;\n errors: number;\n failures: number;\n skip: number;\n time: number;\n },\n ...ServiceTestXunitTest[]\n];\n\n/**\n * Test results for a Foxx service's tests in TAP format.\n */\nexport type ServiceTestTapReport = string[];\n\n/**\n * Test results for a single test case using the default reporter.\n */\nexport type ServiceTestDefaultTest = {\n title: string;\n fullTitle: string;\n duration: number;\n err?: string;\n};\n\n/**\n * Test results for a Foxx service's tests using the default reporter.\n */\nexport type ServiceTestDefaultReport = {\n stats: ServiceTestStats;\n tests: ServiceTestDefaultTest[];\n pending: ServiceTestDefaultTest[];\n failures: ServiceTestDefaultTest[];\n passes: ServiceTestDefaultTest[];\n};\n\n/**\n * OpenAPI 2.0 description of a Foxx service.\n */\nexport type SwaggerJson = {\n [key: string]: any;\n info: {\n title: string;\n description: string;\n version: string;\n license: string;\n };\n path: {\n [key: string]: any;\n };\n};\n\n/**\n * Access level for an ArangoDB user's access to a collection or database.\n */\nexport type AccessLevel = \"rw\" | \"ro\" | \"none\";\n\n/**\n * Properties of an ArangoDB user object.\n */\nexport type ArangoUser = {\n /**\n * ArangoDB username of the user.\n */\n user: string;\n /**\n * Whether the ArangoDB user account is enabled and can authenticate.\n */\n active: boolean;\n /**\n * Additional information to store about this user.\n */\n extra: Record<string, any>;\n};\n\n/**\n * Options for creating an ArangoDB user.\n */\nexport type CreateUserOptions = {\n /**\n * ArangoDB username of the user.\n */\n user: string;\n /**\n * Password the ArangoDB user will use for authentication.\n */\n passwd: string;\n /**\n * Whether the ArangoDB user account is enabled and can authenticate.\n *\n * Default: `true`\n */\n active?: boolean;\n /**\n * Additional information to store about this user.\n *\n * Default: `{}`\n */\n extra?: Record<string, any>;\n};\n\n/**\n * Options for modifying an ArangoDB user.\n */\nexport type UserOptions = {\n /**\n * Password the ArangoDB user will use for authentication.\n */\n passwd: string;\n /**\n * Whether the ArangoDB user account is enabled and can authenticate.\n *\n * Default: `true`\n */\n active?: boolean;\n /**\n * Additional information to store about this user.\n *\n * Default: `{}`\n */\n extra?: Record<string, any>;\n};\n\n/**\n * Options for accessing or manipulating access levels.\n */\nexport type UserAccessLevelOptions = {\n /**\n * The database to access or manipulate the access level of.\n *\n * If `collection` is an `ArangoCollection`, this option defaults to the\n * database the collection is contained in. Otherwise this option defaults to\n * the current database.\n */\n database?: Database | string;\n /**\n * The collection to access or manipulate the access level of.\n */\n collection?: ArangoCollection | string;\n};\n\n/**\n * An object providing methods for accessing queue time metrics of the most\n * recently received server responses if the server supports this feature.\n */\nexport type QueueTimeMetrics = {\n /**\n * Returns the queue time of the most recently received response in seconds.\n */\n getLatest: () => number | undefined;\n /**\n * Returns a list of the most recently received queue time values as tuples\n * of the timestamp of the response being processed in milliseconds and the\n * queue time in seconds.\n */\n getValues: () => [number, number][];\n /**\n * Returns the average queue time of the most recently received responses\n * in seconds.\n */\n getAvg: () => number;\n};\n\n/**\n * An object representing a single ArangoDB database. All arangojs collections,\n * cursors, analyzers and so on are linked to a `Database` object.\n */\nexport class Database {\n protected _connection: Connection;\n protected _name: string;\n protected _analyzers = new Map<string, Analyzer>();\n protected _collections = new Map<string, Collection>();\n protected _graphs = new Map<string, Graph>();\n protected _views = new Map<string, ArangoSearchView>();\n\n /**\n * Creates a new `Database` instance with its own connection pool.\n *\n * See also {@link Database.database}.\n *\n * @param config - An object with configuration options.\n *\n * @example\n * ```js\n * const db = new Database({\n * url: \"http://localhost:8529\",\n * databaseName: \"my_database\",\n * auth: { username: \"admin\", password: \"hunter2\" },\n * });\n * ```\n */\n constructor(config?: Config);\n /**\n * Creates a new `Database` instance with its own connection pool.\n *\n * See also {@link Database.database}.\n *\n * @param url - Base URL of the ArangoDB server or list of server URLs.\n * Equivalent to the `url` option in {@link Config}.\n *\n * @example\n * ```js\n * const db = new Database(\"http://localhost:8529\", \"my_database\");\n * db.useBasicAuth(\"admin\", \"hunter2\");\n * ```\n */\n constructor(url: string | string[], name?: string);\n // There's currently no way to hide a single overload from typedoc\n // /**\n // * @internal\n // * @hidden\n // */\n // constructor(database: Database, name?: string);\n constructor(\n configOrDatabase: string | string[] | Config | Database = {},\n name?: string\n ) {\n if (isArangoDatabase(configOrDatabase)) {\n const connection = configOrDatabase._connection;\n const databaseName = (name || configOrDatabase.name).normalize(\"NFC\");\n this._connection = connection;\n this._name = databaseName;\n const database = connection.database(databaseName);\n if (database) return database;\n } else {\n const config = configOrDatabase;\n const { databaseName, ...options } =\n typeof config === \"string\" || Array.isArray(config)\n ? { databaseName: name, url: config }\n : config;\n this._connection = new Connection(options);\n this._name = databaseName?.normalize(\"NFC\") || \"_system\";\n }\n }\n\n //#region misc\n /**\n * @internal\n *\n * Indicates that this object represents an ArangoDB database.\n */\n get isArangoDatabase(): true {\n return true;\n }\n\n /**\n * Name of the ArangoDB database this instance represents.\n */\n get name() {\n return this._name;\n }\n\n /**\n * Fetches version information from the ArangoDB server.\n *\n * @param details - If set to `true`, additional information about the\n * ArangoDB server will be available as the `details` property.\n *\n * @example\n * ```js\n * const db = new Database();\n * const version = await db.version();\n * // the version object contains the ArangoDB version information.\n * // license: \"community\" or \"enterprise\"\n * // version: ArangoDB version number\n * // server: description of the server\n * ```\n */\n version(details?: boolean): Promise<VersionInfo> {\n return this.request(\n {\n method: \"GET\",\n path: \"/_api/version\",\n qs: { details },\n },\n (res) => res.body\n );\n }\n\n /**\n * Returns a new {@link Route} instance for the given path (relative to the\n * database) that can be used to perform arbitrary HTTP requests.\n *\n * @param path - The database-relative URL of the route. Defaults to the\n * database API root.\n * @param headers - Default headers that should be sent with each request to\n * the route.\n *\n * @example\n * ```js\n * const db = new Database();\n * const myFoxxService = db.route(\"my-foxx-service\");\n * const response = await myFoxxService.post(\"users\", {\n * username: \"admin\",\n * password: \"hunter2\"\n * });\n * // response.body is the result of\n * // POST /_db/_system/my-foxx-service/users\n * // with JSON request body '{\"username\": \"admin\", \"password\": \"hunter2\"}'\n * ```\n */\n route(path?: string, headers?: Headers): Route {\n return new Route(this, path, headers);\n }\n\n /**\n * @internal\n *\n * Performs an arbitrary HTTP request against the database.\n *\n * If `absolutePath` is set to `true`, the database path will not be\n * automatically prepended to the `basePath`.\n *\n * @param T - Return type to use. Defaults to the response object type.\n * @param options - Options for this request.\n * @param transform - An optional function to transform the low-level\n * response object to a more useful return value.\n */\n request<T = ArangojsResponse>(\n options: RequestOptions & { absolutePath?: boolean },\n transform?: (res: ArangojsResponse) => T\n ): Promise<T>;\n request<T = ArangojsResponse>(\n {\n absolutePath = false,\n basePath,\n ...opts\n }: RequestOptions & { absolutePath?: boolean },\n transform?: (res: ArangojsResponse) => T\n ): Promise<T> {\n if (!absolutePath) {\n basePath = `/_db/${encodeURIComponent(this._name)}${basePath || \"\"}`;\n }\n return this._connection.request({ basePath, ...opts }, transform);\n }\n\n /**\n * Updates the URL list by requesting a list of all coordinators in the\n * cluster and adding any endpoints not initially specified in the\n * {@link Config}.\n *\n * For long-running processes communicating with an ArangoDB cluster it is\n * recommended to run this method periodically (e.g. once per hour) to make\n * sure new coordinators are picked up correctly and can be used for\n * fail-over or load balancing.\n *\n * @example\n * ```js\n * const db = new Database();\n * const interval = setInterval(\n * () => db.acquireHostList(),\n * 5 * 60 * 1000 // every 5 minutes\n * );\n *\n * // later\n * clearInterval(interval);\n * db.close();\n * ```\n */\n async acquireHostList(): Promise<void> {\n const urls: string[] = await this.request(\n { path: \"/_api/cluster/endpoints\" },\n (res) => res.body.endpoints.map((endpoint: any) => endpoint.endpoint)\n );\n this._connection.addToHostList(urls);\n }\n\n /**\n * Closes all active connections of this database instance.\n *\n * Can be used to clean up idling connections during longer periods of\n * inactivity.\n *\n * **Note**: This method currently has no effect in the browser version of\n * arangojs.\n *\n * @example\n * ```js\n * const db = new Database();\n * const sessions = db.collection(\"sessions\");\n * // Clean up expired sessions once per hour\n * setInterval(async () => {\n * await db.query(aql`\n * FOR session IN ${sessions}\n * FILTER session.expires < DATE_NOW()\n * REMOVE session IN ${sessions}\n * `);\n * // Making sure to close the connections because they're no longer used\n * db.close();\n * }, 1000 * 60 * 60);\n * ```\n */\n close(): void {\n this._connection.close();\n }\n\n /**\n * Performs a request against every known coordinator and returns when the\n * request has succeeded against every coordinator or the timeout is reached.\n *\n * **Note**: This method is primarily intended to make database setup easier\n * in cluster scenarios and requires all coordinators to be known to arangojs\n * before the method is invoked. The method is not useful in single-server or\n * leader-follower replication scenarios.\n *\n * @example\n * ```js\n * const db = new Database({ loadBalancingStrategy: \"ROUND_ROBIN\" });\n * await db.acquireHostList();\n * const analyzer = db.analyzer(\"my-analyzer\");\n * await analyzer.create();\n * await db.waitForPropagation(\n * { path: `/_api/analyzer/${encodeURIComponent(analyzer.name)}` },\n * 30000\n * );\n * // Analyzer has been propagated to all coordinators and can safely be used\n * ```\n *\n * @param request - Request to perform against each known coordinator.\n * @param timeout - Maximum number of milliseconds to wait for propagation.\n */\n async waitForPropagation(\n request: RequestOptions,\n timeout?: number\n ): Promise<void>;\n async waitForPropagation(\n { basePath, ...request }: RequestOptions,\n timeout?: number\n ): Promise<void> {\n await this._connection.waitForPropagation(\n {\n ...request,\n basePath: `/_db/${encodeURIComponent(this._name)}${basePath || \"\"}`,\n },\n timeout\n );\n }\n\n /**\n * Methods for accessing the server-reported queue times of the mostly\n * recently received responses.\n */\n get queueTime(): QueueTimeMetrics {\n return this._connection.queueTime;\n }\n\n /**\n * Sets the limit for the number of values of the most recently received\n * server-reported queue times that can be accessed using\n * {@link Database.queueTime}.\n *\n * @param responseQueueTimeSamples - Number of values to maintain.\n */\n setResponseQueueTimeSamples(responseQueueTimeSamples: number) {\n this._connection.setResponseQueueTimeSamples(responseQueueTimeSamples);\n }\n //#endregion\n\n //#region auth\n /**\n * Updates the `Database` instance and its connection string to use the given\n * `databaseName`, then returns itself.\n *\n * **Note**: This also affects all collections, cursors and other arangojs\n * objects originating from this database object, which may cause unexpected\n * results.\n *\n * @param databaseName - Name of the database to use.\n *\n * @deprecated Use {@link Database.database} instead.\n *\n * @example\n * ```js\n * const systemDb = new Database();\n * // systemDb.useDatabase(\"my_database\"); // deprecated\n * const myDb = systemDb.database(\"my_database\");\n * ```\n */\n useDatabase(databaseName: string): this {\n this._connection.database(this._name, null);\n this._name = databaseName.normalize(\"NFC\");\n return this;\n }\n\n /**\n * Updates the `Database` instance's `authorization` header to use Basic\n * authentication with the given `username` and `password`, then returns\n * itself.\n *\n * @param username - The username to authenticate with.\n * @param password - The password to authenticate with.\n *\n * @example\n * ```js\n * const db = new Database();\n * db.useDatabase(\"test\");\n * db.useBasicAuth(\"admin\", \"hunter2\");\n * // The database instance now uses the database \"test\"\n * // with the username \"admin\" and password \"hunter2\".\n * ```\n */\n useBasicAuth(username: string = \"root\", password: string = \"\"): this {\n this._connection.setBasicAuth({ username, password });\n return this;\n }\n\n /**\n * Updates the `Database` instance's `authorization` header to use Bearer\n * authentication with the given authentication `token`, then returns itself.\n *\n * @param token - The token to authenticate with.\n *\n * @example\n * ```js\n * const db = new Database();\n * db.useBearerAuth(\"keyboardcat\");\n * // The database instance now uses Bearer authentication.\n * ```\n */\n useBearerAuth(token: string): this {\n this._connection.setBearerAuth({ token });\n return this;\n }\n\n /**\n * Validates the given database credentials and exchanges them for an\n * authentication token, then uses the authentication token for future\n * requests and returns it.\n *\n * @param username - The username to authenticate with.\n * @param password - The password to authenticate with.\n *\n * @example\n * ```js\n * const db = new Database();\n * db.useDatabase(\"test\");\n * await db.login(\"admin\", \"hunter2\");\n * // The database instance now uses the database \"test\"\n * // with an authentication token for the \"admin\" user.\n * ```\n */\n login(username: string = \"root\", password: string = \"\"): Promise<string> {\n return this.request(\n {\n method: \"POST\",\n path: \"/_open/auth\",\n body: { username, password },\n },\n (res) => {\n this.useBearerAuth(res.body.jwt);\n return res.body.jwt;\n }\n );\n }\n //#endregion\n\n //#region databases\n /**\n * Creates a new `Database` instance for the given `databaseName` that\n * shares this database's connection pool.\n *\n * See also {@link Database.constructor}.\n *\n * @param databaseName - Name of the database.\n *\n * @example\n * ```js\n * const systemDb = new Database();\n * const myDb = system.database(\"my_database\");\n * ```\n */\n database(databaseName: string) {\n return new Database(this as any, databaseName);\n }\n\n /**\n * Fetches the database description for the active database from the server.\n *\n * @example\n * ```js\n * const db = new Database();\n * const info = await db.get();\n * // the database exists\n * ```\n */\n get(): Promise<DatabaseInfo> {\n return this.request(\n { path: \"/_api/database/current\" },\n (res) => res.body.result\n );\n }\n\n /**\n * Checks whether the database exists.\n *\n * @example\n * ```js\n * const db = new Database();\n * const result = await db.exists();\n * // result indicates whether the database exists\n * ```\n */\n async exists(): Promise<boolean> {\n try {\n await this.get();\n return true;\n } catch (err) {\n if (isArangoError(err) && err.errorNum === DATABASE_NOT_FOUND) {\n return false;\n }\n throw err;\n }\n }\n\n /**\n * Creates a new database with the given `databaseName` with the given\n * `options` and returns a `Database` instance for that database.\n *\n * @param databaseName - Name of the database to create.\n * @param options - Options for creating the database.\n *\n * @example\n * ```js\n * const db = new Database();\n * const info = await db.createDatabase(\"mydb\", {\n * users: [{ username: \"root\" }]\n * });\n * // the database has been created\n * db.useDatabase(\"mydb\");\n * db.useBasicAuth(\"root\", \"\");\n * ```\n */\n createDatabase(\n databaseName: string,\n options?: CreateDatabaseOptions\n ): Promise<Database>;\n /**\n * Creates a new database with the given `databaseName` with the given\n * `users` and returns a `Database` instance for that database.\n *\n * @param databaseName - Name of the database to create.\n * @param users - Database users to create with the database.\n *\n * @example\n * ```js\n * const db = new Database();\n * const info = await db.createDatabase(\"mydb\", [{ username: \"root\" }]);\n * // the database has been created\n * db.useDatabase(\"mydb\");\n * db.useBasicAuth(\"root\", \"\");\n * ```\n */\n createDatabase(\n databaseName: string,\n users: CreateDatabaseUser[]\n ): Promise<Database>;\n createDatabase(\n databaseName: string,\n usersOrOptions?: CreateDatabaseUser[] | CreateDatabaseOptions\n ): Promise<Database> {\n const { users, ...options } = Array.isArray(usersOrOptions)\n ? { users: usersOrOptions }\n : usersOrOptions || {};\n return this.request(\n {\n method: \"POST\",\n path: \"/_api/database\",\n body: { name: databaseName.normalize(\"NFC\"), users, options },\n },\n () => this.database(databaseName)\n );\n }\n\n /**\n * Fetches all databases from the server and returns an array of their names.\n *\n * See also {@link Database.databases} and\n * {@link Database.listUserDatabases}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const names = await db.listDatabases();\n * // databases is an array of database names\n * ```\n */\n listDatabases(): Promise<string[]> {\n return this.request({ path: \"/_api/database\" }, (res) => res.body.result);\n }\n\n /**\n * Fetches all databases accessible to the active user from the server and\n * returns an array of their names.\n *\n * See also {@link Database.userDatabases} and\n * {@link Database.listDatabases}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const names = await db.listUserDatabases();\n * // databases is an array of database names\n * ```\n */\n listUserDatabases(): Promise<string[]> {\n return this.request(\n { path: \"/_api/database/user\" },\n (res) => res.body.result\n );\n }\n\n /**\n * Fetches all databases from the server and returns an array of `Database`\n * instances for those databases.\n *\n * See also {@link Database.listDatabases} and\n * {@link Database.userDatabases}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const names = await db.databases();\n * // databases is an array of databases\n * ```\n */\n databases(): Promise<Database[]> {\n return this.request({ path: \"/_api/database\" }, (res) =>\n (res.body.result as string[]).map((databaseName) =>\n this.database(databaseName)\n )\n );\n }\n\n /**\n * Fetches all databases accessible to the active user from the server and\n * returns an array of `Database` instances for those databases.\n *\n * See also {@link Database.listUserDatabases} and\n * {@link Database.databases}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const names = await db.userDatabases();\n * // databases is an array of databases\n * ```\n */\n userDatabases(): Promise<Database[]> {\n return this.request({ path: \"/_api/database/user\" }, (res) =>\n (res.body.result as string[]).map((databaseName) =>\n this.database(databaseName)\n )\n );\n }\n\n /**\n * Deletes the database with the given `databaseName` from the server.\n *\n * @param databaseName - Name of the database to delete.\n *\n * @example\n * ```js\n * const db = new Database();\n * await db.dropDatabase(\"mydb\");\n * // database \"mydb\" no longer exists\n * ```\n */\n dropDatabase(databaseName: string): Promise<boolean> {\n databaseName = databaseName.normalize(\"NFC\");\n return this.request(\n {\n method: \"DELETE\",\n path: `/_api/database/${encodeURIComponent(databaseName)}`,\n },\n (res) => res.body.result\n );\n }\n //#endregion\n\n //#region collections\n /**\n * Returns a `Collection` instance for the given collection name.\n *\n * In TypeScript the collection implements both the\n * {@link DocumentCollection} and {@link EdgeCollection} interfaces and can\n * be cast to either type to enforce a stricter API.\n *\n * @param T - Type to use for document data. Defaults to `any`.\n * @param collectionName - Name of the edge collection.\n *\n * @example\n * ```js\n * const db = new Database();\n * const collection = db.collection(\"potatoes\");\n * ```\n *\n * @example\n * ```ts\n * interface Person {\n * name: string;\n * }\n * const db = new Database();\n * const persons = db.collection<Person>(\"persons\");\n * ```\n *\n * @example\n * ```ts\n * interface Person {\n * name: string;\n * }\n * interface Friend {\n * startDate: number;\n * endDate?: number;\n * }\n * const db = new Database();\n * const documents = db.collection(\"persons\") as DocumentCollection<Person>;\n * const edges = db.collection(\"friends\") as EdgeCollection<Friend>;\n * ```\n */\n collection<T extends Record<string, any> = any>(\n collectionName: string\n ): DocumentCollection<T> & EdgeCollection<T> {\n collectionName = collectionName.normalize(\"NFC\");\n if (!this._collections.has(collectionName)) {\n this._collections.set(\n collectionName,\n new Collection(this, collectionName)\n );\n }\n return this._collections.get(collectionName)!;\n }\n\n /**\n * Creates a new collection with the given `collectionName` and `options`,\n * then returns a {@link DocumentCollection} instance for the new collection.\n *\n * @param T - Type to use for document data. Defaults to `any`.\n * @param collectionName - Name of the new collection.\n * @param options - Options for creating the collection.\n *\n * @example\n * ```ts\n * const db = new Database();\n * const documents = db.createCollection(\"persons\");\n * ```\n *\n * @example\n * ```ts\n * interface Person {\n * name: string;\n * }\n * const db = new Database();\n * const documents = db.createCollection<Person>(\"persons\");\n * ```\n */\n async createCollection<T extends Record<string, any> = any>(\n collectionName: string,\n options?: CreateCollectionOptions & {\n type?: CollectionType.DOCUMENT_COLLECTION;\n }\n ): Promise<DocumentCollection<T>>;\n /**\n * Creates a new edge collection with the given `collectionName` and\n * `options`, then returns an {@link EdgeCollection} instance for the new\n * edge collection.\n *\n * @param T - Type to use for edge document data. Defaults to `any`.\n * @param collectionName - Name of the new collection.\n * @param options - Options for creating the collection.\n *\n * @example\n * ```js\n * const db = new Database();\n * const edges = db.createCollection(\"friends\", {\n * type: CollectionType.EDGE_COLLECTION\n * });\n * ```\n *\n * @example\n * ```ts\n * interface Friend {\n * startDate: number;\n * endDate?: number;\n * }\n * const db = new Database();\n * const edges = db.createCollection<Friend>(\"friends\", {\n * type: CollectionType.EDGE_COLLECTION\n * });\n * ```\n */\n async createCollection<T extends Record<string, any> = any>(\n collectionName: string,\n options: CreateCollectionOptions & {\n type: CollectionType.EDGE_COLLECTION;\n }\n ): Promise<EdgeCollection<T>>;\n async createCollection<T extends Record<string, any> = any>(\n collectionName: string,\n options?: CreateCollectionOptions & { type?: CollectionType }\n ): Promise<DocumentCollection<T> & EdgeCollection<T>> {\n const collection = this.collection(collectionName);\n await collection.create(options);\n return collection;\n }\n\n /**\n * Creates a new edge collection with the given `collectionName` and\n * `options`, then returns an {@link EdgeCollection} instance for the new\n * edge collection.\n *\n * This is a convenience method for calling {@link Database.createCollection}\n * with `options.type` set to `EDGE_COLLECTION`.\n *\n * @param T - Type to use for edge document data. Defaults to `any`.\n * @param collectionName - Name of the new collection.\n * @param options - Options for creating the collection.\n *\n * @example\n * ```js\n * const db = new Database();\n * const edges = db.createEdgeCollection(\"friends\");\n * ```\n *\n * @example\n * ```ts\n * interface Friend {\n * startDate: number;\n * endDate?: number;\n * }\n * const db = new Database();\n * const edges = db.createEdgeCollection<Friend>(\"friends\");\n * ```\n */\n async createEdgeCollection<T extends Record<string, any> = any>(\n collectionName: string,\n options?: CreateCollectionOptions\n ): Promise<EdgeCollection<T>> {\n return this.createCollection(collectionName, {\n ...options,\n type: CollectionType.EDGE_COLLECTION,\n });\n }\n\n /**\n * Renames the collection `collectionName` to `newName`.\n *\n * Additionally removes any stored `Collection` instance for\n * `collectionName` from the `Database` instance's internal cache.\n *\n * **Note**: Renaming collections may not be supported when ArangoDB is\n * running in a cluster configuration.\n *\n * @param collectionName - Current name of the collection.\n * @param newName - The new name of the collection.\n */\n async renameCollection(\n collectionName: string,\n newName: string\n ): Promise<ArangoResponseMetadata & CollectionMetadata> {\n collectionName = collectionName.normalize(\"NFC\");\n const result = await this.request(\n {\n method: \"PUT\",\n path: `/_api/collection/${encodeURIComponent(collectionName)}/rename`,\n body: { name: newName.normalize(\"NFC\") },\n },\n (res) => res.body\n );\n this._collections.delete(collectionName);\n return result;\n }\n\n /**\n * Fetches all collections from the database and returns an array of\n * collection descriptions.\n *\n * See also {@link Database.collections}.\n *\n * @param excludeSystem - Whether system collections should be excluded.\n *\n * @example\n * ```js\n * const db = new Database();\n * const collections = await db.listCollections();\n * // collections is an array of collection descriptions\n * // not including system collections\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * const collections = await db.listCollections(false);\n * // collections is an array of collection descriptions\n * // including system collections\n * ```\n */\n listCollections(\n excludeSystem: boolean = true\n ): Promise<CollectionMetadata[]> {\n return this.request(\n {\n path: \"/_api/collection\",\n qs: { excludeSystem },\n },\n (res) => res.body.result\n );\n }\n\n /**\n * Fetches all collections from the database and returns an array of\n * `Collection` instances.\n *\n * In TypeScript these instances implement both the\n * {@link DocumentCollection} and {@link EdgeCollection} interfaces and can\n * be cast to either type to enforce a stricter API.\n *\n * See also {@link Database.listCollections}.\n *\n * @param excludeSystem - Whether system collections should be excluded.\n *\n * @example\n * ```js\n * const db = new Database();\n * const collections = await db.collections();\n * // collections is an array of DocumentCollection\n * // and EdgeCollection instances\n * // not including system collections\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * const collections = await db.collections(false);\n * // collections is an array of DocumentCollection\n * // and EdgeCollection instances\n * // including system collections\n * ```\n */\n async collections(\n excludeSystem: boolean = true\n ): Promise<Array<DocumentCollection & EdgeCollection>> {\n const collections = await this.listCollections(excludeSystem);\n return collections.map((data) => this.collection(data.name));\n }\n //#endregion\n\n //#region graphs\n /**\n * Returns a {@link Graph} instance representing the graph with the given\n * `graphName`.\n *\n * @param graphName - Name of the graph.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * ```\n */\n graph(graphName: string): Graph {\n graphName = graphName.normalize(\"NFC\");\n if (!this._graphs.has(graphName)) {\n this._graphs.set(graphName, new Graph(this, graphName));\n }\n return this._graphs.get(graphName)!;\n }\n\n /**\n * Creates a graph with the given `graphName` and `edgeDefinitions`, then\n * returns a {@link Graph} instance for the new graph.\n *\n * @param graphName - Name of the graph to be created.\n * @param edgeDefinitions - An array of edge definitions.\n * @param options - An object defining the properties of the graph.\n */\n async createGraph(\n graphName: string,\n edgeDefinitions: EdgeDefinitionOptions[],\n options?: GraphCreateOptions\n ): Promise<Graph> {\n const graph = this.graph(graphName.normalize(\"NFC\"));\n await graph.create(edgeDefinitions, options);\n return graph;\n }\n\n /**\n * Fetches all graphs from the database and returns an array of graph\n * descriptions.\n *\n * See also {@link Database.graphs}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graphs = await db.listGraphs();\n * // graphs is an array of graph descriptions\n * ```\n */\n listGraphs(): Promise<GraphInfo[]> {\n return this.request({ path: \"/_api/gharial\" }, (res) => res.body.graphs);\n }\n\n /**\n * Fetches all graphs from the database and returns an array of {@link Graph}\n * instances for those graphs.\n *\n * See also {@link Database.listGraphs}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graphs = await db.graphs();\n * // graphs is an array of Graph instances\n * ```\n */\n async graphs(): Promise<Graph[]> {\n const graphs = await this.listGraphs();\n return graphs.map((data: any) => this.graph(data._key));\n }\n //#endregion\n\n //#region views\n /**\n * Returns an {@link ArangoSearchView} instance for the given `viewName`.\n *\n * @param viewName - Name of the ArangoSearch View.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view = db.view(\"potatoes\");\n * ```\n */\n view(viewName: string): ArangoSearchView {\n viewName = viewName.normalize(\"NFC\");\n if (!this._views.has(viewName)) {\n this._views.set(viewName, new View(this, viewName));\n }\n return this._views.get(viewName)!;\n }\n\n /**\n * Creates a new ArangoSearch View with the given `viewName` and `options`\n * and returns an {@link ArangoSearchView} instance for the created View.\n *\n * @param viewName - Name of the ArangoSearch View.\n * @param options - An object defining the properties of the View.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view = await db.createView(\"potatoes\");\n * // the ArangoSearch View \"potatoes\" now exists\n * ```\n */\n async createView(\n viewName: string,\n options?: ArangoSearchViewPropertiesOptions\n ): Promise<ArangoSearchView> {\n const view = this.view(viewName.normalize(\"NFC\"));\n await view.create({ ...options, type: ViewType.ARANGOSEARCH_VIEW });\n return view;\n }\n\n /**\n * Renames the view `viewName` to `newName`.\n *\n * Additionally removes any stored {@link View} instance for `viewName` from\n * the `Database` instance's internal cache.\n *\n * **Note**: Renaming views may not be supported when ArangoDB is running in\n * a cluster configuration.\n *\n * @param viewName - Current name of the view.\n * @param newName - The new name of the view.\n */\n async renameView(\n viewName: string,\n newName: string\n ): Promise<ArangoResponseMetadata & ViewDescription> {\n viewName = viewName.normalize(\"NFC\");\n const result = await this.request(\n {\n method: \"PUT\",\n path: `/_api/view/${encodeURIComponent(viewName)}/rename`,\n body: { name: newName.normalize(\"NFC\") },\n },\n (res) => res.body\n );\n this._views.delete(viewName);\n return result;\n }\n\n /**\n * Fetches all Views from the database and returns an array of View\n * descriptions.\n *\n * See also {@link Database.views}.\n *\n * @example\n * ```js\n * const db = new Database();\n *\n * const views = await db.listViews();\n * // views is an array of View descriptions\n * ```\n */\n listViews(): Promise<ViewDescription[]> {\n return this.request({ path: \"/_api/view\" }, (res) => res.body.result);\n }\n\n /**\n * Fetches all Views from the database and returns an array of\n * {@link ArangoSearchView} instances for the Views.\n *\n * See also {@link Database.listViews}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const views = await db.views();\n * // views is an array of ArangoSearch View instances\n * ```\n */\n async views(): Promise<ArangoSearchView[]> {\n const views = await this.listViews();\n return views.map((data) => this.view(data.name));\n }\n //#endregion\n\n //#region analyzers\n /**\n * Returns an {@link Analyzer} instance representing the Analyzer with the\n * given `analyzerName`.\n *\n * @example\n * ```js\n * const db = new Database();\n * const analyzer = db.analyzer(\"some-analyzer\");\n * const info = await analyzer.get();\n * ```\n */\n analyzer(analyzerName: string): Analyzer {\n analyzerName = analyzerName.normalize(\"NFC\");\n if (!this._analyzers.has(analyzerName)) {\n this._analyzers.set(analyzerName, new Analyzer(this, analyzerName));\n }\n return this._analyzers.get(analyzerName)!;\n }\n\n /**\n * Creates a new Analyzer with the given `analyzerName` and `options`, then\n * returns an {@link Analyzer} instance for the new Analyzer.\n *\n * @param analyzerName - Name of the Analyzer.\n * @param options - An object defining the properties of the Analyzer.\n *\n * @example\n * ```js\n * const db = new Database();\n * const analyzer = await db.createAnalyzer(\"potatoes\", { type: \"identity\" });\n * // the identity Analyzer \"potatoes\" now exists\n * ```\n */\n async createAnalyzer(\n analyzerName: string,\n options: CreateAnalyzerOptions\n ): Promise<Analyzer> {\n const analyzer = this.analyzer(analyzerName);\n await analyzer.create(options);\n return analyzer;\n }\n\n /**\n * Fetches all Analyzers visible in the database and returns an array of\n * Analyzer descriptions.\n *\n * See also {@link Database.analyzers}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const analyzers = await db.listAnalyzers();\n * // analyzers is an array of Analyzer descriptions\n * ```\n */\n listAnalyzers(): Promise<AnalyzerDescription[]> {\n return this.request({ path: \"/_api/analyzer\" }, (res) => res.body.result);\n }\n\n /**\n * Fetches all Analyzers visible in the database and returns an array of\n * {@link Analyzer} instances for those Analyzers.\n *\n * See also {@link Database.listAnalyzers}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const analyzers = await db.analyzers();\n * // analyzers is an array of Analyzer instances\n * ```\n */\n async analyzers(): Promise<Analyzer[]> {\n const analyzers = await this.listAnalyzers();\n return analyzers.map((data) => this.analyzer(data.name));\n }\n //#endregion\n\n //#region users\n /**\n * Fetches all ArangoDB users visible to the authenticated user and returns\n * an array of user objects.\n *\n * @example\n * ```js\n * const db = new Database();\n * const users = await db.listUsers();\n * // users is an array of user objects\n * ```\n */\n listUsers(): Promise<ArangoUser[]> {\n return this.request({\n absolutePath: true,\n path: \"/_api/user\",\n });\n }\n\n /**\n * Fetches the user data of a single ArangoDB user.\n *\n * @param username - Name of the ArangoDB user to fetch.\n *\n * @example\n * ```js\n * const db = new Database();\n * const user = await db.getUser(\"steve\");\n * // user is the user object for the user named \"steve\"\n * ```\n */\n getUser(username: string): Promise<ArangoUser & ArangoResponseMetadata> {\n return this.request({\n absolutePath: true,\n path: `/_api/user/${encodeURIComponent(username)}`,\n });\n }\n\n /**\n * Creates a new ArangoDB user with the given password.\n *\n * @param username - Name of the ArangoDB user to create.\n * @param passwd - Password of the new ArangoDB user.\n *\n * @example\n * ```js\n * const db = new Database();\n * const user = await db.createUser(\"steve\", \"hunter2\");\n * // The user \"steve\" has been created\n * ```\n */\n createUser(\n username: string,\n passwd: string\n ): Promise<ArangoUser & ArangoResponseMetadata>;\n /**\n * Creates a new ArangoDB user with the given options.\n *\n * @param username - Name of the ArangoDB user to create.\n * @param options - Additional options for creating the ArangoDB user.\n *\n * @example\n * ```js\n * const db = new Database();\n * const user = await db.createUser(\"steve\", { passwd: \"hunter2\" });\n * // The user \"steve\" has been created\n * ```\n */\n createUser(\n username: string,\n options: UserOptions\n ): Promise<ArangoUser & ArangoResponseMetadata>;\n createUser(\n username: string,\n options: string | UserOptions\n ): Promise<ArangoUser & ArangoResponseMetadata> {\n if (typeof options === \"string\") {\n options = { passwd: options };\n }\n return this.request(\n {\n absolutePath: true,\n method: \"POST\",\n path: \"/_api/user\",\n body: { user: username, ...options },\n },\n (res) => res.body\n );\n }\n\n /**\n * Sets the password of a given ArangoDB user to the new value.\n *\n * @param username - Name of the ArangoDB user to change the password for.\n * @param passwd - New password for the ArangoDB user.\n *\n * @example\n * ```js\n * const db = new Database();\n * const user = await db.updateUser(\"steve\", \"hunter2\");\n * // The user \"steve\" has received a new password\n * ```\n */\n updateUser(\n username: string,\n passwd: string\n ): Promise<ArangoUser & ArangoResponseMetadata>;\n /**\n * Updates the ArangoDB user with the new options.\n *\n * @param username - Name of the ArangoDB user to modify.\n * @param options - Options of the ArangoDB user to modify.\n *\n * @example\n * ```js\n * const db = new Database();\n * const user = await db.updateUser(\"steve\", { active: false });\n * // The user \"steve\" has been set to inactive\n * ```\n */\n updateUser(\n username: string,\n options: Partial<UserOptions>\n ): Promise<ArangoUser & ArangoResponseMetadata>;\n updateUser(\n username: string,\n options: string | Partial<UserOptions>\n ): Promise<ArangoUser & ArangoResponseMetadata> {\n if (typeof options === \"string\") {\n options = { passwd: options };\n }\n return this.request(\n {\n absolutePath: true,\n method: \"PATCH\",\n path: `/api/user/${encodeURIComponent(username)}`,\n body: options,\n },\n (res) => res.body\n );\n }\n\n /**\n * Replaces the ArangoDB user's option with the new options.\n *\n * @param username - Name of the ArangoDB user to modify.\n * @param options - New options to replace the user's existing options.\n *\n * @example\n * ```js\n * const db = new Database();\n * const user = await db.replaceUser(\"steve\", { passwd: \"\", active: false });\n * // The user \"steve\" has been set to inactive with an empty password\n * ```\n */\n replaceUser(\n username: string,\n options: UserOptions\n ): Promise<ArangoUser & ArangoResponseMetadata> {\n if (typeof options === \"string\") {\n options = { passwd: options };\n }\n return this.request(\n {\n absolutePath: true,\n method: \"PUT\",\n path: `/api/user/${encodeURIComponent(username)}`,\n body: options,\n },\n (res) => res.body\n );\n }\n\n /**\n * Removes the ArangoDB user with the given username from the server.\n *\n * @param username - Name of the ArangoDB user to remove.\n *\n * @example\n * ```js\n * const db = new Database();\n * await db.removeUser(\"steve\");\n * // The user \"steve\" has been removed\n * ```\n */\n removeUser(username: string): Promise<ArangoResponseMetadata> {\n return this.request(\n {\n absolutePath: true,\n method: \"DELETE\",\n path: `/_api/user/${encodeURIComponent(username)}`,\n },\n (res) => res.body\n );\n }\n\n /**\n * Fetches the given ArangoDB user's access level for the database, or the\n * given collection in the given database.\n *\n * @param username - Name of the ArangoDB user to fetch the access level for.\n * @param database - Database to fetch the access level for.\n * @param collection - Collection to fetch the access level for.\n *\n * @example\n * ```js\n * const db = new Database();\n * const accessLevel = await db.getUserAccessLevel(\"steve\");\n * // The access level of the user \"steve\" has been fetched for the current\n * // database.\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * const accessLevel = await db.getUserAccessLevel(\"steve\", {\n * database: \"staging\"\n * });\n * // The access level of the user \"steve\" has been fetched for the \"staging\"\n * // database.\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * const accessLevel = await db.getUserAccessLevel(\"steve\", {\n * collection: \"pokemons\"\n * });\n * // The access level of the user \"steve\" has been fetched for the\n * // \"pokemons\" collection in the current database.\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * const accessLevel = await db.getUserAccessLevel(\"steve\", {\n * database: \"staging\",\n * collection: \"pokemons\"\n * });\n * // The access level of the user \"steve\" has been fetched for the\n * // \"pokemons\" collection in the \"staging\" database.\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * const staging = db.database(\"staging\");\n * const accessLevel = await db.getUserAccessLevel(\"steve\", {\n * database: staging\n * });\n * // The access level of the user \"steve\" has been fetched for the \"staging\"\n * // database.\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * const staging = db.database(\"staging\");\n * const accessLevel = await db.getUserAccessLevel(\"steve\", {\n * collection: staging.collection(\"pokemons\")\n * });\n * // The access level of the user \"steve\" has been fetched for the\n * // \"pokemons\" collection in database \"staging\".\n * ```\n */\n getUserAccessLevel(\n username: string,\n { database, collection }: UserAccessLevelOptions\n ): Promise<AccessLevel> {\n const databaseName = isArangoDatabase(database)\n ? database.name\n : database?.normalize(\"NFC\") ??\n (isArangoCollection(collection)\n ? ((collection as any)._db as Database).name\n : this._name);\n const suffix = collection\n ? `/${encodeURIComponent(\n isArangoCollection(collection)\n ? collection.name\n : collection.normalize(\"NFC\")\n )}`\n : \"\";\n return this.request(\n {\n absolutePath: true,\n path: `/_api/user/${encodeURIComponent(\n username\n )}/database/${encodeURIComponent(databaseName)}${suffix}`,\n },\n (res) => res.body\n );\n }\n\n /**\n * Sets the given ArangoDB user's access level for the database, or the\n * given collection in the given database.\n *\n * @param username - Name of the ArangoDB user to set the access level for.\n * @param database - Database to set the access level for.\n * @param collection - Collection to set the access level for.\n * @param grant - Access level to set for the given user.\n *\n * @example\n * ```js\n * const db = new Database();\n * await db.setUserAccessLevel(\"steve\", { grant: \"rw\" });\n * // The user \"steve\" now has read-write access to the current database.\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * await db.setUserAccessLevel(\"steve\", {\n * database: \"staging\",\n * grant: \"rw\"\n * });\n * // The user \"steve\" now has read-write access to the \"staging\" database.\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * await db.setUserAccessLevel(\"steve\", {\n * collection: \"pokemons\",\n * grant: \"rw\"\n * });\n * // The user \"steve\" now has read-write access to the \"pokemons\" collection\n * // in the current database.\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * await db.setUserAccessLevel(\"steve\", {\n * database: \"staging\",\n * collection: \"pokemons\",\n * grant: \"rw\"\n * });\n * // The user \"steve\" now has read-write access to the \"pokemons\" collection\n * // in the \"staging\" database.\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * const staging = db.database(\"staging\");\n * await db.setUserAccessLevel(\"steve\", {\n * database: staging,\n * grant: \"rw\"\n * });\n * // The user \"steve\" now has read-write access to the \"staging\" database.\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * const staging = db.database(\"staging\");\n * await db.setUserAccessLevel(\"steve\", {\n * collection: staging.collection(\"pokemons\"),\n * grant: \"rw\"\n * });\n * // The user \"steve\" now has read-write access to the \"pokemons\" collection\n * // in database \"staging\".\n * ```\n */\n setUserAccessLevel(\n username: string,\n {\n database,\n collection,\n grant,\n }: UserAccessLevelOptions & { grant: AccessLevel }\n ): Promise<Record<string, AccessLevel> & ArangoResponseMetadata> {\n const databaseName = isArangoDatabase(database)\n ? database.name\n : database?.normalize(\"NFC\") ??\n (isArangoCollection(collection)\n ? ((collection as any)._db as Database).name\n : this._name);\n const suffix = collection\n ? `/${encodeURIComponent(\n isArangoCollection(collection)\n ? collection.name\n : collection.normalize(\"NFC\")\n )}`\n : \"\";\n return this.request(\n {\n absolutePath: true,\n method: \"PUT\",\n path: `/_api/user/${encodeURIComponent(\n username\n )}/database/${encodeURIComponent(databaseName)}${suffix}`,\n body: { grant },\n },\n (res) => res.body\n );\n }\n\n /**\n * Clears the given ArangoDB user's access level for the database, or the\n * given collection in the given database.\n *\n * @param username - Name of the ArangoDB user to clear the access level for.\n * @param database - Database to clear the access level for.\n * @param collection - Collection to clear the access level for.\n *\n * @example\n * ```js\n * const db = new Database();\n * await db.clearUserAccessLevel(\"steve\");\n * // The access level of the user \"steve\" has been cleared for the current\n * // database.\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * await db.clearUserAccessLevel(\"steve\", { database: \"staging\" });\n * // The access level of the user \"steve\" has been cleared for the \"staging\"\n * // database.\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * await db.clearUserAccessLevel(\"steve\", { collection: \"pokemons\" });\n * // The access level of the user \"steve\" has been cleared for the\n * // \"pokemons\" collection in the current database.\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * await db.clearUserAccessLevel(\"steve\", {\n * database: \"staging\",\n * collection: \"pokemons\"\n * });\n * // The access level of the user \"steve\" has been cleared for the\n * // \"pokemons\" collection in the \"staging\" database.\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * const staging = db.database(\"staging\");\n * await db.clearUserAccessLevel(\"steve\", { database: staging });\n * // The access level of the user \"steve\" has been cleared for the \"staging\"\n * // database.\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * const staging = db.database(\"staging\");\n * await db.clearUserAccessLevel(\"steve\", {\n * collection: staging.collection(\"pokemons\")\n * });\n * // The access level of the user \"steve\" has been cleared for the\n * // \"pokemons\" collection in database \"staging\".\n * ```\n */\n clearUserAccessLevel(\n username: string,\n { database, collection }: UserAccessLevelOptions\n ): Promise<Record<string, AccessLevel> & ArangoResponseMetadata> {\n const databaseName = isArangoDatabase(database)\n ? database.name\n : database?.normalize(\"NFC\") ??\n (isArangoCollection(collection)\n ? ((collection as any)._db as Database).name\n : this._name);\n const suffix = collection\n ? `/${encodeURIComponent(\n isArangoCollection(collection)\n ? collection.name\n : collection.normalize(\"NFC\")\n )}`\n : \"\";\n return this.request(\n {\n absolutePath: true,\n method: \"DELETE\",\n path: `/_api/user/${encodeURIComponent(\n username\n )}/database/${encodeURIComponent(databaseName)}${suffix}`,\n },\n (res) => res.body\n );\n }\n\n /**\n * Fetches an object mapping names of databases to the access level of the\n * given ArangoDB user for those databases.\n *\n * @param username - Name of the ArangoDB user to fetch the access levels for.\n * @param full - Whether access levels for collections should be included.\n *\n * @example\n * ```js\n * const db = new Database();\n * const accessLevels = await db.getUserDatabases(\"steve\");\n * for (const [databaseName, accessLevel] of Object.entries(accessLevels)) {\n * console.log(`${databaseName}: ${accessLevel}`);\n * }\n * ```\n */\n getUserDatabases(\n username: string,\n full?: false\n ): Promise<Record<string, AccessLevel>>;\n /**\n * Fetches an object mapping names of databases to the access level of the\n * given ArangoDB user for those databases and the collections within each\n * database.\n *\n * @param username - Name of the ArangoDB user to fetch the access levels for.\n * @param full - Whether access levels for collections should be included.\n *\n * @example\n * ```js\n * const db = new Database();\n * const accessLevels = await db.getUserDatabases(\"steve\", true);\n * for (const [databaseName, obj] of Object.entries(accessLevels)) {\n * console.log(`${databaseName}: ${obj.permission}`);\n * for (const [collectionName, accessLevel] of Object.entries(obj.collections)) {\n * console.log(`${databaseName}/${collectionName}: ${accessLevel}`);\n * }\n * }\n * ```\n */\n getUserDatabases(\n username: string,\n full: true\n ): Promise<\n Record<\n string,\n {\n permission: AccessLevel;\n collections: Record<string, AccessLevel | \"undefined\">;\n }\n >\n >;\n getUserDatabases(\n username: string,\n full?: boolean\n ): Promise<Record<string, any>> {\n return this.request({\n absolutePath: true,\n path: `/_api/user/${encodeURIComponent(username)}/database`,\n qs: { full },\n });\n }\n //#endregion\n\n //#region transactions\n /**\n * Performs a server-side JavaScript transaction and returns its return\n * value.\n *\n * Collections can be specified as collection names (strings) or objects\n * implementing the {@link ArangoCollection} interface: `Collection`,\n * {@link GraphVertexCollection}, {@link GraphEdgeCollection} as well as\n * (in TypeScript) {@link DocumentCollection} and {@link EdgeCollection}.\n *\n * **Note**: The `action` function will be evaluated and executed on the\n * server inside ArangoDB's embedded JavaScript environment and can not\n * access any values other than those passed via the `params` option.\n *\n * See the official ArangoDB documentation for\n * {@link https://www.arangodb.com/docs/stable/appendix-java-script-modules-arango-db.html | the JavaScript `@arangodb` module}\n * for information about accessing the database from within ArangoDB's\n * server-side JavaScript environment.\n *\n * @param collections - Collections involved in the transaction.\n * @param action - A string evaluating to a JavaScript function to be\n * executed on the server.\n * @param options - Options for the transaction. If `options.allowImplicit`\n * is specified, it will be used if `collections.allowImplicit` was not\n * specified.\n *\n * @example\n * ```js\n * const db = new Database();\n *\n * const action = `\n * function(params) {\n * // This code will be executed inside ArangoDB!\n * const { query } = require(\"@arangodb\");\n * return query\\`\n * FOR user IN _users\n * FILTER user.age > ${params.age}\n * RETURN u.user\n * \\`.toArray();\n * }\n * `);\n *\n * const result = await db.executeTransaction({\n * read: [\"_users\"]\n * }, action, {\n * params: { age: 12 }\n * });\n * // result contains the return value of the action\n * ```\n */\n executeTransaction(\n collections: TransactionCollections & { allowImplicit?: boolean },\n action: string,\n options?: TransactionOptions & { params?: any }\n ): Promise<any>;\n /**\n * Performs a server-side transaction and returns its return value.\n *\n * Collections can be specified as collection names (strings) or objects\n * implementing the {@link ArangoCollection} interface: `Collection`,\n * {@link GraphVertexCollection}, {@link GraphEdgeCollection} as well as\n * (in TypeScript) {@link DocumentCollection} and {@link EdgeCollection}.\n *\n * **Note**: The `action` function will be evaluated and executed on the\n * server inside ArangoDB's embedded JavaScript environment and can not\n * access any values other than those passed via the `params` option.\n * See the official ArangoDB documentation for\n * {@link https://www.arangodb.com/docs/stable/appendix-java-script-modules-arango-db.html | the JavaScript `@arangodb` module}\n * for information about accessing the database from within ArangoDB's\n * server-side JavaScript environment.\n *\n * @param collections - Collections that can be read from and written to\n * during the transaction.\n * @param action - A string evaluating to a JavaScript function to be\n * executed on the server.\n * @param options - Options for the transaction.\n *\n * @example\n * ```js\n * const db = new Database();\n *\n * const action = `\n * function(params) {\n * // This code will be executed inside ArangoDB!\n * const { query } = require(\"@arangodb\");\n * return query\\`\n * FOR user IN _users\n * FILTER user.age > ${params.age}\n * RETURN u.user\n * \\`.toArray();\n * }\n * `);\n *\n * const result = await db.executeTransaction([\"_users\"], action, {\n * params: { age: 12 }\n * });\n * // result contains the return value of the action\n * ```\n */\n executeTransaction(\n collections: (string | ArangoCollection)[],\n action: string,\n options?: TransactionOptions & { params?: any }\n ): Promise<any>;\n /**\n * Performs a server-side transaction and returns its return value.\n *\n * The Collection can be specified as a collection name (string) or an object\n * implementing the {@link ArangoCollection} interface: `Collection`,\n * {@link GraphVertexCollection}, {@link GraphEdgeCollection} as well as\n * (in TypeScript) {@link DocumentCollection} and {@link EdgeCollection}.\n *\n * **Note**: The `action` function will be evaluated and executed on the\n * server inside ArangoDB's embedded JavaScript environment and can not\n * access any values other than those passed via the `params` option.\n * See the official ArangoDB documentation for\n * {@link https://www.arangodb.com/docs/stable/appendix-java-script-modules-arango-db.html | the JavaScript `@arangodb` module}\n * for information about accessing the database from within ArangoDB's\n * server-side JavaScript environment.\n *\n * @param collection - A collection that can be read from and written to\n * during the transaction.\n * @param action - A string evaluating to a JavaScript function to be\n * executed on the server.\n * @param options - Options for the transaction.\n *\n * @example\n * ```js\n * const db = new Database();\n *\n * const action = `\n * function(params) {\n * // This code will be executed inside ArangoDB!\n * const { query } = require(\"@arangodb\");\n * return query\\`\n * FOR user IN _users\n * FILTER user.age > ${params.age}\n * RETURN u.user\n * \\`.toArray();\n * }\n * `);\n *\n * const result = await db.executeTransaction(\"_users\", action, {\n * params: { age: 12 }\n * });\n * // result contains the return value of the action\n * ```\n */\n executeTransaction(\n collection: string | ArangoCollection,\n action: string,\n options?: TransactionOptions & { params?: any }\n ): Promise<any>;\n executeTransaction(\n collections:\n | (TransactionCollections & { allowImplicit?: boolean })\n | (string | ArangoCollection)[]\n | string\n | ArangoCollection,\n action: string,\n options?: TransactionOptions & { params?: any }\n ): Promise<any> {\n return this.request(\n {\n method: \"POST\",\n path: \"/_api/transaction\",\n body: {\n collections: coerceTransactionCollections(collections),\n action,\n ...options,\n },\n },\n (res) => res.body.result\n );\n }\n\n /**\n * Returns a {@link Transaction} instance for an existing streaming\n * transaction with the given `id`.\n *\n * See also {@link Database.beginTransaction}.\n *\n * @param id - The `id` of an existing stream transaction.\n *\n * @example\n * ```js\n * const trx1 = await db.beginTransaction(collections);\n * const id = trx1.id;\n * // later\n * const trx2 = db.transaction(id);\n * await trx2.commit();\n * ```\n */\n transaction(transactionId: string): Transaction {\n return new Transaction(this, transactionId);\n }\n\n /**\n * Begins a new streaming transaction for the given collections, then returns\n * a {@link Transaction} instance for the transaction.\n *\n * Collections can be specified as collection names (strings) or objects\n * implementing the {@link ArangoCollection} interface: `Collection`,\n * {@link GraphVertexCollection}, {@link GraphEdgeCollection} as well as\n * (in TypeScript) {@link DocumentCollection} and {@link EdgeCollection}.\n *\n * @param collections - Collections involved in the transaction.\n * @param options - Options for the transaction.\n *\n * @example\n * ```js\n * const vertices = db.collection(\"vertices\");\n * const edges = db.collection(\"edges\");\n * const trx = await db.beginTransaction({\n * read: [\"vertices\"],\n * write: [edges] // collection instances can be passed directly\n * });\n * const start = await trx.step(() => vertices.document(\"a\"));\n * const end = await trx.step(() => vertices.document(\"b\"));\n * await trx.step(() => edges.save({ _from: start._id, _to: end._id }));\n * await trx.commit();\n * ```\n */\n beginTransaction(\n collections: TransactionCollections,\n options?: TransactionOptions\n ): Promise<Transaction>;\n /**\n * Begins a new streaming transaction for the given collections, then returns\n * a {@link Transaction} instance for the transaction.\n *\n * Collections can be specified as collection names (strings) or objects\n * implementing the {@link ArangoCollection} interface: `Collection`,\n * {@link GraphVertexCollection}, {@link GraphEdgeCollection} as well as\n * (in TypeScript) {@link DocumentCollection} and {@link EdgeCollection}.\n *\n * @param collections - Collections that can be read from and written to\n * during the transaction.\n * @param options - Options for the transaction.\n *\n * @example\n * ```js\n * const vertices = db.collection(\"vertices\");\n * const edges = db.collection(\"edges\");\n * const trx = await db.beginTransaction([\n * \"vertices\",\n * edges // collection instances can be passed directly\n * ]);\n * const start = await trx.step(() => vertices.document(\"a\"));\n * const end = await trx.step(() => vertices.document(\"b\"));\n * await trx.step(() => edges.save({ _from: start._id, _to: end._id }));\n * await trx.commit();\n * ```\n */\n beginTransaction(\n collections: (string | ArangoCollection)[],\n options?: TransactionOptions\n ): Promise<Transaction>;\n /**\n * Begins a new streaming transaction for the given collections, then returns\n * a {@link Transaction} instance for the transaction.\n *\n * The Collection can be specified as a collection name (string) or an object\n * implementing the {@link ArangoCollection} interface: `Collection`,\n * {@link GraphVertexCollection}, {@link GraphEdgeCollection} as well as\n * (in TypeScript) {@link DocumentCollection} and {@link EdgeCollection}.\n *\n * @param collections - A collection that can be read from and written to\n * during the transaction.\n * @param options - Options for the transaction.\n *\n * @example\n * ```js\n * const vertices = db.collection(\"vertices\");\n * const start = vertices.document(\"a\");\n * const end = vertices.document(\"b\");\n * const edges = db.collection(\"edges\");\n * const trx = await db.beginTransaction(\n * edges // collection instances can be passed directly\n * );\n * await trx.step(() => edges.save({ _from: start._id, _to: end._id }));\n * await trx.commit();\n * ```\n */\n beginTransaction(\n collection: string | ArangoCollection,\n options?: TransactionOptions\n ): Promise<Transaction>;\n beginTransaction(\n collections:\n | TransactionCollections\n | (string | ArangoCollection)[]\n | string\n | ArangoCollection,\n options?: TransactionOptions\n ): Promise<Transaction> {\n return this.request(\n {\n method: \"POST\",\n path: \"/_api/transaction/begin\",\n body: {\n collections: coerceTransactionCollections(collections),\n ...options,\n },\n },\n (res) => new Transaction(this, res.body.result.id)\n );\n }\n\n /**\n * Fetches all active transactions from the database and returns an array of\n * transaction descriptions.\n *\n * See also {@link Database.transactions}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const transactions = await db.listTransactions();\n * // transactions is an array of transaction descriptions\n * ```\n */\n listTransactions(): Promise<TransactionDetails[]> {\n return this._connection.request(\n { path: \"/_api/transaction\" },\n (res) => res.body.transactions\n );\n }\n\n /**\n * Fetches all active transactions from the database and returns an array of\n * {@link Transaction} instances for those transactions.\n *\n * See also {@link Database.listTransactions}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const transactions = await db.transactions();\n * // transactions is an array of transactions\n * ```\n */\n async transactions(): Promise<Transaction[]> {\n const transactions = await this.listTransactions();\n return transactions.map((data) => this.transaction(data.id));\n }\n //#endregion\n\n //#region queries\n /**\n * Performs a database query using the given `query`, then returns a new\n * {@link ArrayCursor} instance for the result set.\n *\n * See the {@link aql} template string handler for information about how\n * to create a query string without manually defining bind parameters nor\n * having to worry about escaping variables.\n *\n * @param query - An object containing an AQL query string and bind\n * parameters, e.g. the object returned from an {@link aql} template string.\n * @param options - Options for the query execution.\n *\n * @example\n * ```js\n * const db = new Database();\n * const active = true;\n *\n * // Using an aql template string\n * const cursor = await db.query(aql`\n * FOR u IN _users\n * FILTER u.authData.active == ${active}\n * RETURN u.user\n * `);\n * // cursor is a cursor for the query result\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * const active = true;\n *\n * // Using an object with a regular multi-line string\n * const cursor = await db.query({\n * query: `\n * FOR u IN _users\n * FILTER u.authData.active == @active\n * RETURN u.user\n * `,\n * bindVars: { active: active }\n * });\n * ```\n */\n query(query: AqlQuery, options?: QueryOptions): Promise<ArrayCursor>;\n /**\n * Performs a database query using the given `query` and `bindVars`, then\n * returns a new {@link ArrayCursor} instance for the result set.\n *\n * See the {@link aql} template string handler for a safer and easier\n * alternative to passing strings directly.\n *\n * @param query - An AQL query string.\n * @param bindVars - An object defining bind parameters for the query.\n * @param options - Options for the query execution.\n *\n * @example\n * ```js\n * const db = new Database();\n * const active = true;\n *\n * const cursor = await db.query(\n * // A normal multi-line string\n * `\n * FOR u IN _users\n * FILTER u.authData.active == @active\n * RETURN u.user\n * `,\n * { active: active }\n * );\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * const active = true;\n *\n * const cursor = await db.query(\n * // An AQL literal created from a normal multi-line string\n * aql.literal(`\n * FOR u IN _users\n * FILTER u.authData.active == @active\n * RETURN u.user\n * `),\n * { active: active }\n * );\n * ```\n */\n query(\n query: string | AqlLiteral,\n bindVars?: Dict<any>,\n options?: QueryOptions\n ): Promise<ArrayCursor>;\n query(\n query: string | AqlQuery | AqlLiteral,\n bindVars?: Dict<any>,\n options?: QueryOptions\n ): Promise<ArrayCursor> {\n if (isAqlQuery(query)) {\n options = bindVars;\n bindVars = query.bindVars;\n query = query.query;\n } else if (isAqlLiteral(query)) {\n query = query.toAQL();\n }\n const {\n allowDirtyRead,\n count,\n batchSize,\n cache,\n memoryLimit,\n ttl,\n timeout,\n ...opts\n } = options || {};\n return this.request(\n {\n method: \"POST\",\n path: \"/_api/cursor\",\n body: {\n query,\n bindVars,\n count,\n batchSize,\n cache,\n memoryLimit,\n ttl,\n options: opts,\n },\n allowDirtyRead,\n timeout,\n },\n (res) =>\n new BatchedArrayCursor(\n this,\n res.body,\n res.arangojsHostId,\n allowDirtyRead\n ).items\n );\n }\n\n /**\n * Explains a database query using the given `query`.\n *\n * See the {@link aql} template string handler for information about how\n * to create a query string without manually defining bind parameters nor\n * having to worry about escaping variables.\n *\n * @param query - An object containing an AQL query string and bind\n * parameters, e.g. the object returned from an {@link aql} template string.\n * @param options - Options for explaining the query.\n *\n * @example\n * ```js\n * const db = new Database();\n * const collection = db.collection(\"some-collection\");\n * const explanation = await db.explain(aql`\n * FOR doc IN ${collection}\n * FILTER doc.flavor == \"strawberry\"\n * RETURN doc._key\n * `);\n * ```\n */\n explain(\n query: AqlQuery,\n options?: ExplainOptions & { allPlans?: false }\n ): Promise<ArangoResponseMetadata & SingleExplainResult>;\n /**\n * Explains a database query using the given `query`.\n *\n * See the {@link aql} template string handler for information about how\n * to create a query string without manually defining bind parameters nor\n * having to worry about escaping variables.\n *\n * @param query - An object containing an AQL query string and bind\n * parameters, e.g. the object returned from an {@link aql} template string.\n * @param options - Options for explaining the query.\n *\n * @example\n * ```js\n * const db = new Database();\n * const collection = db.collection(\"some-collection\");\n * const explanation = await db.explain(\n * aql`\n * FOR doc IN ${collection}\n * FILTER doc.flavor == \"strawberry\"\n * RETURN doc._key\n * `,\n * { allPlans: true }\n * );\n * ```\n */\n explain(\n query: AqlQuery,\n options?: ExplainOptions & { allPlans: true }\n ): Promise<ArangoResponseMetadata & MultiExplainResult>;\n /**\n * Explains a database query using the given `query` and `bindVars`.\n *\n * See the {@link aql} template string handler for a safer and easier\n * alternative to passing strings directly.\n *\n * @param query - An AQL query string.\n * @param bindVars - An object defining bind parameters for the query.\n * @param options - Options for explaining the query.\n *\n * @example\n * ```js\n * const db = new Database();\n * const collection = db.collection(\"some-collection\");\n * const explanation = await db.explain(\n * `\n * FOR doc IN @@collection\n * FILTER doc.flavor == \"strawberry\"\n * RETURN doc._key\n * `,\n * { \"@collection\": collection.name }\n * );\n * ```\n */\n explain(\n query: string | AqlLiteral,\n bindVars?: Dict<any>,\n options?: ExplainOptions & { allPlans?: false }\n ): Promise<ArangoResponseMetadata & SingleExplainResult>;\n /**\n * Explains a database query using the given `query` and `bindVars`.\n *\n * See the {@link aql} template string handler for a safer and easier\n * alternative to passing strings directly.\n *\n * @param query - An AQL query string.\n * @param bindVars - An object defining bind parameters for the query.\n * @param options - Options for explaining the query.\n *\n * @example\n * ```js\n * const db = new Database();\n * const collection = db.collection(\"some-collection\");\n * const explanation = await db.explain(\n * `\n * FOR doc IN @@collection\n * FILTER doc.flavor == \"strawberry\"\n * RETURN doc._key\n * `,\n * { \"@collection\": collection.name },\n * { allPlans: true }\n * );\n * ```\n */\n explain(\n query: string | AqlLiteral,\n bindVars?: Dict<any>,\n options?: ExplainOptions & { allPlans: true }\n ): Promise<ArangoResponseMetadata & MultiExplainResult>;\n explain(\n query: string | AqlQuery | AqlLiteral,\n bindVars?: Dict<any>,\n options?: ExplainOptions\n ): Promise<\n ArangoResponseMetadata & (SingleExplainResult | MultiExplainResult)\n > {\n if (isAqlQuery(query)) {\n options = bindVars;\n bindVars = query.bindVars;\n query = query.query;\n } else if (isAqlLiteral(query)) {\n query = query.toAQL();\n }\n return this.request(\n {\n method: \"POST\",\n path: \"/_api/explain\",\n body: { query, bindVars, options },\n },\n (res) => res.body\n );\n }\n\n /**\n * Parses the given query and returns the result.\n *\n * See the {@link aql} template string handler for information about how\n * to create a query string without manually defining bind parameters nor\n * having to worry about escaping variables.\n *\n * @param query - An AQL query string or an object containing an AQL query\n * string and bind parameters, e.g. the object returned from an {@link aql}\n * template string.\n *\n * @example\n * ```js\n * const db = new Database();\n * const collection = db.collection(\"some-collection\");\n * const ast = await db.parse(aql`\n * FOR doc IN ${collection}\n * FILTER doc.flavor == \"strawberry\"\n * RETURN doc._key\n * `);\n * ```\n */\n parse(query: string | AqlQuery | AqlLiteral): Promise<ParseResult> {\n if (isAqlQuery(query)) {\n query = query.query;\n } else if (isAqlLiteral(query)) {\n query = query.toAQL();\n }\n return this.request(\n {\n method: \"POST\",\n path: \"/_api/query\",\n body: { query },\n },\n (res) => res.body\n );\n }\n\n /**\n * Fetches the query tracking properties.\n *\n * @example\n * ```js\n * const db = new Database();\n * const tracking = await db.queryTracking();\n * console.log(tracking.enabled);\n * ```\n */\n queryTracking(): Promise<QueryTracking>;\n /**\n * Modifies the query tracking properties.\n *\n * @param options - Options for query tracking.\n *\n * @example\n * ```js\n * const db = new Database();\n * // track up to 5 slow queries exceeding 5 seconds execution time\n * await db.setQueryTracking({\n * enabled: true,\n * trackSlowQueries: true,\n * maxSlowQueries: 5,\n * slowQueryThreshold: 5\n * });\n * ```\n */\n queryTracking(options: QueryTrackingOptions): Promise<QueryTracking>;\n queryTracking(options?: QueryTrackingOptions): Promise<QueryTracking> {\n return this.request(\n options\n ? {\n method: \"PUT\",\n path: \"/_api/query/properties\",\n body: options,\n }\n : {\n method: \"GET\",\n path: \"/_api/query/properties\",\n },\n (res) => res.body\n );\n }\n\n /**\n * Fetches a list of information for all currently running queries.\n *\n * See also {@link Database.listSlowQueries} and {@link Database.killQuery}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const queries = await db.listRunningQueries();\n * ```\n */\n listRunningQueries(): Promise<QueryInfo[]> {\n return this.request(\n {\n method: \"GET\",\n path: \"/_api/query/current\",\n },\n (res) => res.body\n );\n }\n\n /**\n * Fetches a list of information for all recent slow queries.\n *\n * See also {@link Database.listRunningQueries} and\n * {@link Database.clearSlowQueries}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const queries = await db.listSlowQueries();\n * // Only works if slow query tracking is enabled\n * ```\n */\n listSlowQueries(): Promise<QueryInfo[]> {\n return this.request(\n {\n method: \"GET\",\n path: \"/_api/query/slow\",\n },\n (res) => res.body\n );\n }\n\n /**\n * Clears the list of recent slow queries.\n *\n * See also {@link Database.listSlowQueries}.\n *\n * @example\n * ```js\n * const db = new Database();\n * await db.clearSlowQueries();\n * // Slow query list is now cleared\n * ```\n */\n clearSlowQueries(): Promise<void> {\n return this.request(\n {\n method: \"DELETE\",\n path: \"/_api/query/slow\",\n },\n () => undefined\n );\n }\n\n /**\n * Kills a running query with the given `queryId`.\n *\n * See also {@link Database.listRunningQueries}.\n *\n * @param queryId - The ID of a currently running query.\n *\n * @example\n * ```js\n * const db = new Database();\n * const queries = await db.listRunningQueries();\n * await Promise.all(queries.map(\n * async (query) => {\n * if (query.state === \"executing\") {\n * await db.killQuery(query.id);\n * }\n * }\n * ));\n * ```\n */\n killQuery(queryId: string): Promise<void> {\n return this.request(\n {\n method: \"DELETE\",\n path: `/_api/query/${encodeURIComponent(queryId)}`,\n },\n () => undefined\n );\n }\n //#endregion\n\n //#region functions\n /**\n * Fetches a list of all AQL user functions registered with the database.\n *\n * @example\n * ```js\n * const db = new Database();\n * const functions = await db.listFunctions();\n * const names = functions.map(fn => fn.name);\n * ```\n */\n listFunctions(): Promise<AqlUserFunction[]> {\n return this.request(\n { path: \"/_api/aqlfunction\" },\n (res) => res.body.result\n );\n }\n\n /**\n * Creates an AQL user function with the given _name_ and _code_ if it does\n * not already exist or replaces it if a function with the same name already\n * existed.\n *\n * @param name - A valid AQL function name. The function name must consist\n * of at least two alphanumeric identifiers separated with double colons.\n * @param code - A string evaluating to a JavaScript function (not a\n * JavaScript function object).\n * @param isDeterministic - If set to `true`, the function is expected to\n * always return the same result for equivalent inputs. This option currently\n * has no effect but may allow for optimizations in the future.\n *\n * @example\n * ```js\n * const db = new Database();\n * await db.createFunction(\n * \"ACME::ACCOUNTING::CALCULATE_VAT\",\n * \"(price) => price * 0.19\"\n * );\n * // Use the new function in an AQL query with template handler:\n * const cursor = await db.query(aql`\n * FOR product IN products\n * RETURN MERGE(\n * { vat: ACME::ACCOUNTING::CALCULATE_VAT(product.price) },\n * product\n * )\n * `);\n * // cursor is a cursor for the query result\n * ```\n */\n createFunction(\n name: string,\n code: string,\n isDeterministic: boolean = false\n ): Promise<ArangoResponseMetadata & { isNewlyCreated: boolean }> {\n return this.request(\n {\n method: \"POST\",\n path: \"/_api/aqlfunction\",\n body: { name, code, isDeterministic },\n },\n (res) => res.body\n );\n }\n\n /**\n * Deletes the AQL user function with the given name from the database.\n *\n * @param name - The name of the user function to drop.\n * @param group - If set to `true`, all functions with a name starting with\n * `name` will be deleted, otherwise only the function with the exact name\n * will be deleted.\n *\n * @example\n * ```js\n * const db = new Database();\n * await db.dropFunction(\"ACME::ACCOUNTING::CALCULATE_VAT\");\n * // the function no longer exists\n * ```\n */\n dropFunction(\n name: string,\n group: boolean = false\n ): Promise<ArangoResponseMetadata & { deletedCount: number }> {\n return this.request(\n {\n method: \"DELETE\",\n path: `/_api/aqlfunction/${encodeURIComponent(name)}`,\n qs: { group },\n },\n (res) => res.body\n );\n }\n //#endregion\n\n //#region services\n /**\n * Fetches a list of all installed service.\n *\n * @param excludeSystem - Whether system services should be excluded.\n *\n * @example\n * ```js\n * const db = new Database();\n * const services = await db.listServices();\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * const services = await db.listServices(false); // all services\n * ```\n */\n listServices(excludeSystem: boolean = true): Promise<ServiceSummary[]> {\n return this.request(\n {\n path: \"/_api/foxx\",\n qs: { excludeSystem },\n },\n (res) => res.body\n );\n }\n\n /**\n * Installs a new service.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param source - The service bundle to install.\n * @param options - Options for installing the service.\n *\n * @example\n * ```js\n * const db = new Database();\n * // Using a node.js file stream as source\n * const source = fs.createReadStream(\"./my-foxx-service.zip\");\n * const info = await db.installService(\"/hello\", source);\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * // Using a node.js Buffer as source\n * const source = fs.readFileSync(\"./my-foxx-service.zip\");\n * const info = await db.installService(\"/hello\", source);\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * // Using a File (Blob) from a browser file input\n * const element = document.getElementById(\"my-file-input\");\n * const source = element.files[0];\n * const info = await db.installService(\"/hello\", source);\n * ```\n */\n async installService(\n mount: string,\n source: Readable | Buffer | Blob | string,\n options: InstallServiceOptions = {}\n ): Promise<ServiceInfo> {\n const { configuration, dependencies, ...qs } = options;\n const req = await toForm({\n configuration,\n dependencies,\n source,\n });\n return await this.request(\n {\n ...req,\n method: \"POST\",\n path: \"/_api/foxx\",\n isBinary: true,\n qs: { ...qs, mount },\n },\n (res) => res.body\n );\n }\n\n /**\n * Replaces an existing service with a new service by completely removing the\n * old service and installing a new service at the same mount point.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param source - The service bundle to install.\n * @param options - Options for replacing the service.\n *\n * @example\n * ```js\n * const db = new Database();\n * // Using a node.js file stream as source\n * const source = fs.createReadStream(\"./my-foxx-service.zip\");\n * const info = await db.replaceService(\"/hello\", source);\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * // Using a node.js Buffer as source\n * const source = fs.readFileSync(\"./my-foxx-service.zip\");\n * const info = await db.replaceService(\"/hello\", source);\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * // Using a File (Blob) from a browser file input\n * const element = document.getElementById(\"my-file-input\");\n * const source = element.files[0];\n * const info = await db.replaceService(\"/hello\", source);\n * ```\n */\n async replaceService(\n mount: string,\n source: Readable | Buffer | Blob | string,\n options: ReplaceServiceOptions = {}\n ): Promise<ServiceInfo> {\n const { configuration, dependencies, ...qs } = options;\n const req = await toForm({\n configuration,\n dependencies,\n source,\n });\n return await this.request(\n {\n ...req,\n method: \"PUT\",\n path: \"/_api/foxx/service\",\n isBinary: true,\n qs: { ...qs, mount },\n },\n (res) => res.body\n );\n }\n\n /**\n * Replaces an existing service with a new service while retaining the old\n * service's configuration and dependencies.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param source - The service bundle to install.\n * @param options - Options for upgrading the service.\n *\n * @example\n * ```js\n * const db = new Database();\n * // Using a node.js file stream as source\n * const source = fs.createReadStream(\"./my-foxx-service.zip\");\n * const info = await db.upgradeService(\"/hello\", source);\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * // Using a node.js Buffer as source\n * const source = fs.readFileSync(\"./my-foxx-service.zip\");\n * const info = await db.upgradeService(\"/hello\", source);\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * // Using a File (Blob) from a browser file input\n * const element = document.getElementById(\"my-file-input\");\n * const source = element.files[0];\n * const info = await db.upgradeService(\"/hello\", source);\n * ```\n */\n async upgradeService(\n mount: string,\n source: Readable | Buffer | Blob | string,\n options: UpgradeServiceOptions = {}\n ): Promise<ServiceInfo> {\n const { configuration, dependencies, ...qs } = options;\n const req = await toForm({\n configuration,\n dependencies,\n source,\n });\n return await this.request(\n {\n ...req,\n method: \"PATCH\",\n path: \"/_api/foxx/service\",\n isBinary: true,\n qs: { ...qs, mount },\n },\n (res) => res.body\n );\n }\n\n /**\n * Completely removes a service from the database.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param options - Options for uninstalling the service.\n *\n * @example\n * ```js\n * const db = new Database();\n * await db.uninstallService(\"/my-foxx\");\n * ```\n */\n uninstallService(\n mount: string,\n options?: UninstallServiceOptions\n ): Promise<void> {\n return this.request(\n {\n method: \"DELETE\",\n path: \"/_api/foxx/service\",\n qs: { ...options, mount },\n },\n () => undefined\n );\n }\n\n /**\n * Retrieves information about a mounted service.\n *\n * @param mount - The service's mount point, relative to the database.\n *\n * @example\n * ```js\n * const db = new Database();\n * const info = await db.getService(\"/my-service\");\n * // info contains detailed information about the service\n * ```\n */\n getService(mount: string): Promise<ServiceInfo> {\n return this.request(\n {\n path: \"/_api/foxx/service\",\n qs: { mount },\n },\n (res) => res.body\n );\n }\n\n /**\n * Retrieves information about the service's configuration options and their\n * current values.\n *\n * See also {@link Database.replaceServiceConfiguration} and\n * {@link Database.updateServiceConfiguration}.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param minimal - If set to `true`, the result will only include each\n * configuration option's current value. Otherwise it will include the full\n * definition for each option.\n *\n * @example\n * ```js\n * const db = new Database();\n * const config = await db.getServiceConfiguration(\"/my-service\");\n * for (const [key, option] of Object.entries(config)) {\n * console.log(`${option.title} (${key}): ${option.current}`);\n * }\n * ```\n */\n async getServiceConfiguration(\n mount: string,\n minimal?: false\n ): Promise<Dict<ServiceConfiguration>>;\n /**\n * Retrieves information about the service's configuration options and their\n * current values.\n *\n * See also {@link Database.replaceServiceConfiguration} and\n * {@link Database.updateServiceConfiguration}.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param minimal - If set to `true`, the result will only include each\n * configuration option's current value. Otherwise it will include the full\n * definition for each option.\n *\n * @example\n * ```js\n * const db = new Database();\n * const config = await db.getServiceConfiguration(\"/my-service\", true);\n * for (const [key, value] of Object.entries(config)) {\n * console.log(`${key}: ${value}`);\n * }\n * ```\n */\n async getServiceConfiguration(\n mount: string,\n minimal: true\n ): Promise<Dict<any>>;\n async getServiceConfiguration(mount: string, minimal: boolean = false) {\n const result = await this.request(\n {\n path: \"/_api/foxx/configuration\",\n qs: { mount, minimal },\n },\n (res) => res.body\n );\n if (\n !minimal ||\n !Object.keys(result).every((key: string) => result[key].title)\n ) {\n return result;\n }\n const values: any = {};\n for (const key of Object.keys(result)) {\n values[key] = result[key].current;\n }\n return values;\n }\n\n /**\n * Replaces the configuration of the given service, discarding any existing\n * values for options not specified.\n *\n * See also {@link Database.updateServiceConfiguration} and\n * {@link Database.getServiceConfiguration}.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param cfg - An object mapping configuration option names to values.\n * @param minimal - If set to `true`, the result will only include each\n * configuration option's current value and warning (if any).\n * Otherwise it will include the full definition for each option.\n *\n * **Note**: When using ArangoDB 3.2.8 or older, setting the `minimal` option\n * to `true` avoids triggering a second request to fetch the full\n * configuration definitions.\n *\n * @example\n * ```js\n * const db = new Database();\n * const config = { currency: \"USD\", locale: \"en-US\" };\n * const info = await db.replaceServiceConfiguration(\"/my-service\", config);\n * for (const [key, option] of Object.entries(info)) {\n * console.log(`${option.title} (${key}): ${option.value}`);\n * if (option.warning) console.warn(`Warning: ${option.warning}`);\n * }\n * ```\n */\n async replaceServiceConfiguration(\n mount: string,\n cfg: Dict<any>,\n minimal?: false\n ): Promise<Dict<ServiceConfiguration & { warning?: string }>>;\n /**\n * Replaces the configuration of the given service, discarding any existing\n * values for options not specified.\n *\n * See also {@link Database.updateServiceConfiguration} and\n * {@link Database.getServiceConfiguration}.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param cfg - An object mapping configuration option names to values.\n * @param minimal - If set to `true`, the result will only include each\n * configuration option's current value and warning (if any).\n * Otherwise it will include the full definition for each option.\n *\n * **Note**: When using ArangoDB 3.2.8 or older, setting the `minimal` option\n * to `true` avoids triggering a second request to fetch the full\n * configuration definitions.\n *\n * @example\n * ```js\n * const db = new Database();\n * const config = { currency: \"USD\", locale: \"en-US\" };\n * const info = await db.replaceServiceConfiguration(\"/my-service\", config);\n * for (const [key, value] of Object.entries(info.values)) {\n * console.log(`${key}: ${value}`);\n * if (info.warnings[key]) console.warn(`Warning: ${info.warnings[key]}`);\n * }\n * ```\n */\n async replaceServiceConfiguration(\n mount: string,\n cfg: Dict<any>,\n minimal: true\n ): Promise<{\n values: Dict<any>;\n warnings: Dict<string | undefined>;\n }>;\n async replaceServiceConfiguration(\n mount: string,\n cfg: Dict<any>,\n minimal: boolean = false\n ) {\n const result = await this.request(\n {\n method: \"PUT\",\n path: \"/_api/foxx/configuration\",\n body: cfg,\n qs: { mount, minimal },\n },\n (res) => res.body\n );\n if (\n minimal ||\n !result.values ||\n !Object.keys(result.values).every(\n (key: string) => result.values[key].title\n )\n ) {\n return result;\n }\n const result2 = (await this.getServiceConfiguration(mount, false)) as Dict<\n ServiceConfiguration & { warning?: string }\n >;\n if (result.warnings) {\n for (const key of Object.keys(result2)) {\n result2[key].warning = result.warnings[key];\n }\n }\n return result2;\n }\n\n /**\n * Updates the configuration of the given service while maintaining any\n * existing values for options not specified.\n *\n * See also {@link Database.replaceServiceConfiguration} and\n * {@link Database.getServiceConfiguration}.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param cfg - An object mapping configuration option names to values.\n * @param minimal - If set to `true`, the result will only include each\n * configuration option's current value and warning (if any).\n * Otherwise it will include the full definition for each option.\n *\n * **Note**: When using ArangoDB 3.2.8 or older, setting the `minimal` option\n * to `true` avoids triggering a second request to fetch the full\n * configuration definitions.\n *\n * @example\n * ```js\n * const db = new Database();\n * const config = { currency: \"USD\", locale: \"en-US\" };\n * const info = await db.updateServiceConfiguration(\"/my-service\", config);\n * for (const [key, option] of Object.entries(info)) {\n * console.log(`${option.title} (${key}): ${option.value}`);\n * if (option.warning) console.warn(`Warning: ${option.warning}`);\n * }\n * ```\n */\n async updateServiceConfiguration(\n mount: string,\n cfg: Dict<any>,\n minimal?: false\n ): Promise<Dict<ServiceConfiguration & { warning?: string }>>;\n /**\n * Updates the configuration of the given service while maintaining any\n * existing values for options not specified.\n *\n * See also {@link Database.replaceServiceConfiguration} and\n * {@link Database.getServiceConfiguration}.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param cfg - An object mapping configuration option names to values.\n * @param minimal - If set to `true`, the result will only include each\n * configuration option's current value and warning (if any).\n * Otherwise it will include the full definition for each option.\n *\n * **Note**: When using ArangoDB 3.2.8 or older, setting the `minimal` option\n * to `true` avoids triggering a second request to fetch the full\n * configuration definitions.\n *\n * @example\n * ```js\n * const db = new Database();\n * const config = { currency: \"USD\", locale: \"en-US\" };\n * const info = await db.updateServiceConfiguration(\"/my-service\", config);\n * for (const [key, value] of Object.entries(info.values)) {\n * console.log(`${key}: ${value}`);\n * if (info.warnings[key]) console.warn(`Warning: ${info.warnings[key]}`);\n * }\n * ```\n */\n async updateServiceConfiguration(\n mount: string,\n cfg: Dict<any>,\n minimal: true\n ): Promise<{\n values: Dict<any>;\n warnings: Dict<string | undefined>;\n }>;\n async updateServiceConfiguration(\n mount: string,\n cfg: Dict<any>,\n minimal: boolean = false\n ) {\n const result = await this.request(\n {\n method: \"PATCH\",\n path: \"/_api/foxx/configuration\",\n body: cfg,\n qs: { mount, minimal },\n },\n (res) => res.body\n );\n if (\n minimal ||\n !result.values ||\n !Object.keys(result.values).every(\n (key: string) => result.values[key].title\n )\n ) {\n return result;\n }\n const result2 = (await this.getServiceConfiguration(mount, false)) as Dict<\n ServiceConfiguration & { warning?: string }\n >;\n if (result.warnings) {\n for (const key of Object.keys(result2)) {\n result2[key].warning = result.warnings[key];\n }\n }\n return result2;\n }\n\n /**\n * Retrieves information about the service's dependencies and their current\n * mount points.\n *\n * See also {@link Database.replaceServiceDependencies} and\n * {@link Database.updateServiceDependencies}.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param minimal - If set to `true`, the result will only include each\n * dependency's current mount point. Otherwise it will include the full\n * definition for each dependency.\n *\n * @example\n * ```js\n * const db = new Database();\n * const deps = await db.getServiceDependencies(\"/my-service\");\n * for (const [key, dep] of Object.entries(deps)) {\n * console.log(`${dep.title} (${key}): ${dep.current}`);\n * }\n * ```\n */\n async getServiceDependencies(\n mount: string,\n minimal?: false\n ): Promise<Dict<SingleServiceDependency | MultiServiceDependency>>;\n /**\n * Retrieves information about the service's dependencies and their current\n * mount points.\n *\n * See also {@link Database.replaceServiceDependencies} and\n * {@link Database.updateServiceDependencies}.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param minimal - If set to `true`, the result will only include each\n * dependency's current mount point. Otherwise it will include the full\n * definition for each dependency.\n *\n * @example\n * ```js\n * const db = new Database();\n * const deps = await db.getServiceDependencies(\"/my-service\", true);\n * for (const [key, value] of Object.entries(deps)) {\n * console.log(`${key}: ${value}`);\n * }\n * ```\n */\n async getServiceDependencies(\n mount: string,\n minimal: true\n ): Promise<Dict<string | string[] | undefined>>;\n async getServiceDependencies(mount: string, minimal: boolean = false) {\n const result = await this.request(\n {\n path: \"/_api/foxx/dependencies\",\n qs: { mount, minimal },\n },\n (res) => res.body\n );\n if (\n !minimal ||\n !Object.keys(result).every((key: string) => result[key].title)\n )\n return result;\n const values: any = {};\n for (const key of Object.keys(result)) {\n values[key] = result[key].current;\n }\n return values;\n }\n\n /**\n * Replaces the dependencies of the given service, discarding any existing\n * mount points for dependencies not specified.\n *\n * See also {@link Database.updateServiceDependencies} and\n * {@link Database.getServiceDependencies}.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param cfg - An object mapping dependency aliases to mount points.\n * @param minimal - If set to `true`, the result will only include each\n * dependency's current mount point. Otherwise it will include the full\n * definition for each dependency.\n *\n * **Note**: When using ArangoDB 3.2.8 or older, setting the `minimal` option\n * to `true` avoids triggering a second request to fetch the full\n * dependency definitions.\n *\n * @example\n * ```js\n * const db = new Database();\n * const deps = { mailer: \"/mailer-api\", auth: \"/remote-auth\" };\n * const info = await db.replaceServiceDependencies(\"/my-service\", deps);\n * for (const [key, dep] of Object.entries(info)) {\n * console.log(`${dep.title} (${key}): ${dep.current}`);\n * if (dep.warning) console.warn(`Warning: ${dep.warning}`);\n * }\n * ```\n */\n async replaceServiceDependencies(\n mount: string,\n deps: Dict<string>,\n minimal?: false\n ): Promise<\n Dict<\n (SingleServiceDependency | MultiServiceDependency) & { warning?: string }\n >\n >;\n /**\n * Replaces the dependencies of the given service, discarding any existing\n * mount points for dependencies not specified.\n *\n * See also {@link Database.updateServiceDependencies} and\n * {@link Database.getServiceDependencies}.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param cfg - An object mapping dependency aliases to mount points.\n * @param minimal - If set to `true`, the result will only include each\n * dependency's current mount point. Otherwise it will include the full\n * definition for each dependency.\n *\n * **Note**: When using ArangoDB 3.2.8 or older, setting the `minimal` option\n * to `true` avoids triggering a second request to fetch the full\n * dependency definitions.\n *\n * @example\n * ```js\n * const db = new Database();\n * const deps = { mailer: \"/mailer-api\", auth: \"/remote-auth\" };\n * const info = await db.replaceServiceDependencies(\n * \"/my-service\",\n * deps,\n * true\n * );\n * for (const [key, value] of Object.entries(info)) {\n * console.log(`${key}: ${value}`);\n * if (info.warnings[key]) console.warn(`Warning: ${info.warnings[key]}`);\n * }\n * ```\n */\n async replaceServiceDependencies(\n mount: string,\n deps: Dict<string>,\n minimal: true\n ): Promise<{\n values: Dict<string>;\n warnings: Dict<string | undefined>;\n }>;\n async replaceServiceDependencies(\n mount: string,\n deps: Dict<string>,\n minimal: boolean = false\n ) {\n const result = await this.request(\n {\n method: \"PUT\",\n path: \"/_api/foxx/dependencies\",\n body: deps,\n qs: { mount, minimal },\n },\n (res) => res.body\n );\n if (\n minimal ||\n !result.values ||\n !Object.keys(result.values).every(\n (key: string) => result.values[key].title\n )\n ) {\n return result;\n }\n // Work around \"minimal\" flag not existing in 3.3\n const result2 = (await this.getServiceDependencies(mount, false)) as Dict<\n (SingleServiceDependency | MultiServiceDependency) & { warning?: string }\n >;\n if (result.warnings) {\n for (const key of Object.keys(result2)) {\n (result2[key] as any).warning = result.warnings[key];\n }\n }\n return result2;\n }\n\n /**\n * Updates the dependencies of the given service while maintaining any\n * existing mount points for dependencies not specified.\n *\n * See also {@link Database.replaceServiceDependencies} and\n * {@link Database.getServiceDependencies}.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param cfg - An object mapping dependency aliases to mount points.\n * @param minimal - If set to `true`, the result will only include each\n * dependency's current mount point. Otherwise it will include the full\n * definition for each dependency.\n *\n * **Note**: When using ArangoDB 3.2.8 or older, setting the `minimal` option\n * to `true` avoids triggering a second request to fetch the full\n * dependency definitions.\n *\n * @example\n * ```js\n * const db = new Database();\n * const deps = { mailer: \"/mailer-api\", auth: \"/remote-auth\" };\n * const info = await db.updateServiceDependencies(\"/my-service\", deps);\n * for (const [key, dep] of Object.entries(info)) {\n * console.log(`${dep.title} (${key}): ${dep.current}`);\n * if (dep.warning) console.warn(`Warning: ${dep.warning}`);\n * }\n * ```\n */\n async updateServiceDependencies(\n mount: string,\n deps: Dict<string>,\n minimal?: false\n ): Promise<\n Dict<\n (SingleServiceDependency | MultiServiceDependency) & { warning?: string }\n >\n >;\n /**\n * Updates the dependencies of the given service while maintaining any\n * existing mount points for dependencies not specified.\n *\n * See also {@link Database.replaceServiceDependencies} and\n * {@link Database.getServiceDependencies}.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param cfg - An object mapping dependency aliases to mount points.\n * @param minimal - If set to `true`, the result will only include each\n * dependency's current mount point. Otherwise it will include the full\n * definition for each dependency.\n *\n * **Note**: When using ArangoDB 3.2.8 or older, setting the `minimal` option\n * to `true` avoids triggering a second request to fetch the full\n * dependency definitions.\n *\n * @example\n * ```js\n * const db = new Database();\n * const deps = { mailer: \"/mailer-api\", auth: \"/remote-auth\" };\n * const info = await db.updateServiceDependencies(\n * \"/my-service\",\n * deps,\n * true\n * );\n * for (const [key, value] of Object.entries(info)) {\n * console.log(`${key}: ${value}`);\n * if (info.warnings[key]) console.warn(`Warning: ${info.warnings[key]}`);\n * }\n * ```\n */\n async updateServiceDependencies(\n mount: string,\n deps: Dict<string>,\n minimal: true\n ): Promise<{\n values: Dict<string>;\n warnings: Dict<string | undefined>;\n }>;\n async updateServiceDependencies(\n mount: string,\n deps: Dict<string>,\n minimal: boolean = false\n ) {\n const result = await this.request(\n {\n method: \"PATCH\",\n path: \"/_api/foxx/dependencies\",\n body: deps,\n qs: { mount, minimal },\n },\n (res) => res.body\n );\n if (\n minimal ||\n !result.values ||\n !Object.keys(result.values).every(\n (key: string) => result.values[key].title\n )\n ) {\n return result;\n }\n // Work around \"minimal\" flag not existing in 3.3\n const result2 = (await this.getServiceDependencies(mount, false)) as Dict<\n (SingleServiceDependency | MultiServiceDependency) & { warning?: string }\n >;\n if (result.warnings) {\n for (const key of Object.keys(result2)) {\n result2[key].warning = result.warnings[key];\n }\n }\n return result2;\n }\n\n /**\n * Enables or disables development mode for the given service.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param enabled - Whether development mode should be enabled or disabled.\n *\n * @example\n * ```js\n * const db = new Database();\n * await db.setServiceDevelopmentMode(\"/my-service\", true);\n * // the service is now in development mode\n * await db.setServiceDevelopmentMode(\"/my-service\", false);\n * // the service is now in production mode\n * ```\n */\n setServiceDevelopmentMode(\n mount: string,\n enabled: boolean = true\n ): Promise<ServiceInfo> {\n return this.request(\n {\n method: enabled ? \"POST\" : \"DELETE\",\n path: \"/_api/foxx/development\",\n qs: { mount },\n },\n (res) => res.body\n );\n }\n\n /**\n * Retrieves a list of scripts defined in the service manifest's \"scripts\"\n * section mapped to their human readable representations.\n *\n * @param mount - The service's mount point, relative to the database.\n *\n * @example\n * ```js\n * const db = new Database();\n * const scripts = await db.listServiceScripts(\"/my-service\");\n * for (const [name, title] of Object.entries(scripts)) {\n * console.log(`${name}: ${title}`);\n * }\n * ```\n */\n listServiceScripts(mount: string): Promise<Dict<string>> {\n return this.request(\n {\n path: \"/_api/foxx/scripts\",\n qs: { mount },\n },\n (res) => res.body\n );\n }\n\n /**\n * Executes a service script and retrieves its result exposed as\n * `module.exports` (if any).\n *\n * @param mount - The service's mount point, relative to the database.\n * @param name - Name of the service script to execute as defined in the\n * service manifest.\n * @param params - Arbitrary value that will be exposed to the script as\n * `argv[0]` in the service context (e.g. `module.context.argv[0]`).\n * Must be serializable to JSON.\n *\n * @example\n * ```js\n * const db = new Database();\n * const result = await db.runServiceScript(\n * \"/my-service\",\n * \"create-user\",\n * {\n * username: \"service_admin\",\n * password: \"hunter2\"\n * }\n * );\n * ```\n */\n runServiceScript(mount: string, name: string, params?: any): Promise<any> {\n return this.request(\n {\n method: \"POST\",\n path: `/_api/foxx/scripts/${encodeURIComponent(name)}`,\n body: params,\n qs: { mount },\n },\n (res) => res.body\n );\n }\n\n /**\n * Runs the tests of a given service and returns the results using the\n * \"default\" reporter.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param options - Options for running the tests.\n *\n * @example\n * ```js\n * const db = new Database();\n * const testReport = await db.runServiceTests(\"/my-foxx\");\n * ```\n */\n runServiceTests(\n mount: string,\n options?: {\n reporter?: \"default\";\n /**\n * Whether the reporter should use \"idiomatic\" mode. Has no effect when\n * using the \"default\" or \"suite\" reporters.\n */\n idiomatic?: false;\n /**\n * If set, only tests with full names including this exact string will be\n * executed.\n */\n filter?: string;\n }\n ): Promise<ServiceTestDefaultReport>;\n /**\n * Runs the tests of a given service and returns the results using the\n * \"suite\" reporter, which groups the test result by test suite.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param options - Options for running the tests.\n *\n * @example\n * ```js\n * const db = new Database();\n * const suiteReport = await db.runServiceTests(\n * \"/my-foxx\",\n * { reporter: \"suite\" }\n * );\n * ```\n */\n runServiceTests(\n mount: string,\n options: {\n reporter: \"suite\";\n /**\n * Whether the reporter should use \"idiomatic\" mode. Has no effect when\n * using the \"default\" or \"suite\" reporters.\n */\n idiomatic?: false;\n /**\n * If set, only tests with full names including this exact string will be\n * executed.\n */\n filter?: string;\n }\n ): Promise<ServiceTestSuiteReport>;\n /**\n * Runs the tests of a given service and returns the results using the\n * \"stream\" reporter, which represents the results as a sequence of tuples\n * representing events.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param options - Options for running the tests.\n *\n * @example\n * ```js\n * const db = new Database();\n * const streamEvents = await db.runServiceTests(\n * \"/my-foxx\",\n * { reporter: \"stream\" }\n * );\n * ```\n */\n runServiceTests(\n mount: string,\n options: {\n reporter: \"stream\";\n /**\n * Whether the reporter should use \"idiomatic\" mode. If set to `true`,\n * the results will be returned as a formatted string.\n */\n idiomatic?: false;\n /**\n * If set, only tests with full names including this exact string will be\n * executed.\n */\n filter?: string;\n }\n ): Promise<ServiceTestStreamReport>;\n /**\n * Runs the tests of a given service and returns the results using the\n * \"tap\" reporter, which represents the results as an array of strings using\n * the \"tap\" format.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param options - Options for running the tests.\n *\n * @example\n * ```js\n * const db = new Database();\n * const tapLines = await db.runServiceTests(\n * \"/my-foxx\",\n * { reporter: \"tap\" }\n * );\n * ```\n */\n runServiceTests(\n mount: string,\n options: {\n reporter: \"tap\";\n /**\n * Whether the reporter should use \"idiomatic\" mode. If set to `true`,\n * the results will be returned as a formatted string.\n */\n idiomatic?: false;\n /**\n * If set, only tests with full names including this exact string will be\n * executed.\n */\n filter?: string;\n }\n ): Promise<ServiceTestTapReport>;\n /**\n * Runs the tests of a given service and returns the results using the\n * \"xunit\" reporter, which represents the results as an XML document using\n * the JSONML exchange format.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param options - Options for running the tests.\n *\n * @example\n * ```js\n * const db = new Database();\n * const jsonML = await db.runServiceTests(\n * \"/my-foxx\",\n * { reporter: \"xunit\" }\n * );\n * ```\n */\n runServiceTests(\n mount: string,\n options: {\n reporter: \"xunit\";\n /**\n * Whether the reporter should use \"idiomatic\" mode. If set to `true`,\n * the results will be returned as a formatted string.\n */\n idiomatic?: false;\n /**\n * If set, only tests with full names including this exact string will be\n * executed.\n */\n filter?: string;\n }\n ): Promise<ServiceTestXunitReport>;\n /**\n * Runs the tests of a given service and returns the results as a string\n * using the \"stream\" reporter in \"idiomatic\" mode, which represents the\n * results as a line-delimited JSON stream of tuples representing events.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param options - Options for running the tests.\n *\n * @example\n * ```js\n * const db = new Database();\n * const streamReport = await db.runServiceTests(\n * \"/my-foxx\",\n * { reporter: \"stream\", idiomatic: true }\n * );\n * ```\n */\n runServiceTests(\n mount: string,\n options: {\n reporter: \"stream\";\n /**\n * Whether the reporter should use \"idiomatic\" mode. If set to `false`,\n * the results will be returned as an array of tuples instead of a\n * string.\n */\n idiomatic: true;\n /**\n * If set, only tests with full names including this exact string will be\n * executed.\n */\n filter?: string;\n }\n ): Promise<string>;\n /**\n * Runs the tests of a given service and returns the results as a string\n * using the \"tap\" reporter in \"idiomatic\" mode, which represents the\n * results using the \"tap\" format.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param options - Options for running the tests.\n *\n * @example\n * ```js\n * const db = new Database();\n * const tapReport = await db.runServiceTests(\n * \"/my-foxx\",\n * { reporter: \"tap\", idiomatic: true }\n * );\n * ```\n */\n runServiceTests(\n mount: string,\n options: {\n reporter: \"tap\";\n /**\n * Whether the reporter should use \"idiomatic\" mode. If set to `false`,\n * the results will be returned as an array of strings instead of a\n * single string.\n */\n idiomatic: true;\n /**\n * If set, only tests with full names including this exact string will be\n * executed.\n */\n filter?: string;\n }\n ): Promise<string>;\n /**\n * Runs the tests of a given service and returns the results as a string\n * using the \"xunit\" reporter in \"idiomatic\" mode, which represents the\n * results as an XML document.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param options - Options for running the tests.\n *\n * @example\n * ```js\n * const db = new Database();\n * const xml = await db.runServiceTests(\n * \"/my-foxx\",\n * { reporter: \"xunit\", idiomatic: true }\n * );\n * ```\n */\n runServiceTests(\n mount: string,\n options: {\n reporter: \"xunit\";\n /**\n * Whether the reporter should use \"idiomatic\" mode. If set to `false`,\n * the results will be returned using the JSONML exchange format\n * instead of a string.\n */\n idiomatic: true;\n /**\n * If set, only tests with full names including this exact string will be\n * executed.\n */\n filter?: string;\n }\n ): Promise<string>;\n runServiceTests(\n mount: string,\n options?: {\n reporter?: string;\n idiomatic?: boolean;\n filter?: string;\n }\n ) {\n return this.request(\n {\n method: \"POST\",\n path: \"/_api/foxx/tests\",\n qs: {\n ...options,\n mount,\n },\n },\n (res) => res.body\n );\n }\n\n /**\n * Retrieves the text content of the service's `README` or `README.md` file.\n *\n * Returns `undefined` if no such file could be found.\n *\n * @param mount - The service's mount point, relative to the database.\n *\n * @example\n * ```js\n * const db = new Database();\n * const readme = await db.getServiceReadme(\"/my-service\");\n * if (readme !== undefined) console.log(readme);\n * else console.warn(`No README found.`)\n * ```\n */\n getServiceReadme(mount: string): Promise<string | undefined> {\n return this.request(\n {\n path: \"/_api/foxx/readme\",\n qs: { mount },\n },\n (res) => res.body\n );\n }\n\n /**\n * Retrieves an Open API compatible Swagger API description object for the\n * service installed at the given mount point.\n *\n * @param mount - The service's mount point, relative to the database.\n *\n * @example\n * ```js\n * const db = new Database();\n * const spec = await db.getServiceDocumentation(\"/my-service\");\n * // spec is a Swagger API description of the service\n * ```\n */\n getServiceDocumentation(mount: string): Promise<SwaggerJson> {\n return this.request(\n {\n path: \"/_api/foxx/swagger\",\n qs: { mount },\n },\n (res) => res.body\n );\n }\n\n /**\n * Retrieves a zip bundle containing the service files.\n *\n * Returns a `Buffer` in node.js or `Blob` in the browser.\n *\n * @param mount - The service's mount point, relative to the database.\n *\n * @example\n * ```js\n * const db = new Database();\n * const serviceBundle = await db.downloadService(\"/my-foxx\");\n * ```\n */\n downloadService(mount: string): Promise<Buffer | Blob> {\n return this.request(\n {\n method: \"POST\",\n path: \"/_api/foxx/download\",\n qs: { mount },\n expectBinary: true,\n },\n (res) => res.body\n );\n }\n\n /**\n * Writes all locally available services to the database and updates any\n * service bundles missing in the database.\n *\n * @param replace - If set to `true`, outdated services will also be\n * committed. This can be used to solve some consistency problems when\n * service bundles are missing in the database or were deleted manually.\n *\n * @example\n * ```js\n * await db.commitLocalServiceState();\n * // all services available on the coordinator have been written to the db\n * ```\n *\n * @example\n * ```js\n * await db.commitLocalServiceState(true);\n * // all service conflicts have been resolved in favor of this coordinator\n * ```\n */\n commitLocalServiceState(replace: boolean = false): Promise<void> {\n return this.request(\n {\n method: \"POST\",\n path: \"/_api/foxx/commit\",\n qs: { replace },\n },\n () => undefined\n );\n }\n //#endregion\n}\n"]}
1
+ {"version":3,"file":"database.js","sourceRoot":"","sources":["../src/database.ts"],"names":[],"mappings":";;;AAaA,yCAIoB;AACpB,+BAAuE;AACvE,6CAUsB;AACtB,6CAOsB;AACtB,qCAA2D;AAC3D,mCAAwC;AAExC,mCAKiB;AAEjB,uCAAiD;AACjD,+CAAyC;AAEzC,mCAAgC;AAChC,+CAA4C;AAC5C,iCAMgB;AAEhB;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,QAAa;IAC5C,OAAO,OAAO,CAAC,QAAQ,IAAI,QAAQ,CAAC,gBAAgB,CAAC,CAAC;AACxD,CAAC;AAFD,4CAEC;AAED;;;GAGG;AACH,SAAS,4BAA4B,CACnC,WAIoB;IAEpB,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;QACnC,OAAO,EAAE,KAAK,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC;KACjC;IACD,IAAI,KAAK,CAAC,OAAO,C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CAAC;CAEF;AAnzHD,4BAmzHC","sourcesContent":["/**\n * ```js\n * import { Database } from \"arangojs/database\";\n * ```\n *\n * The \"database\" module provides the {@link Database} class and associated\n * types and interfaces for TypeScript.\n *\n * The Database class is also re-exported by the \"index\" module.\n *\n * @packageDocumentation\n */\nimport { Readable } from \"stream\";\nimport {\n Analyzer,\n AnalyzerDescription,\n CreateAnalyzerOptions,\n} from \"./analyzer\";\nimport { AqlLiteral, AqlQuery, isAqlLiteral, isAqlQuery } from \"./aql\";\nimport {\n ArangoCollection,\n Collection,\n CollectionMetadata,\n collectionToString,\n CollectionType,\n CreateCollectionOptions,\n DocumentCollection,\n EdgeCollection,\n isArangoCollection,\n} from \"./collection\";\nimport {\n ArangoResponseMetadata,\n Config,\n Connection,\n Dict,\n Headers,\n RequestOptions,\n} from \"./connection\";\nimport { ArrayCursor, BatchedArrayCursor } from \"./cursor\";\nimport { isArangoError } from \"./error\";\nimport { FoxxManifest } from \"./foxx-manifest\";\nimport {\n EdgeDefinitionOptions,\n Graph,\n GraphCreateOptions,\n GraphInfo,\n} from \"./graph\";\nimport { Blob } from \"./lib/blob\";\nimport { DATABASE_NOT_FOUND } from \"./lib/codes\";\nimport { toForm } from \"./lib/multipart\";\nimport { ArangojsResponse } from \"./lib/request\";\nimport { Route } from \"./route\";\nimport { Transaction } from \"./transaction\";\nimport {\n ArangoSearchView,\n ArangoSearchViewPropertiesOptions,\n View,\n ViewDescription,\n ViewType,\n} from \"./view\";\n\n/**\n * Indicates whether the given value represents a {@link Database}.\n *\n * @param database - A value that might be a database.\n */\nexport function isArangoDatabase(database: any): database is Database {\n return Boolean(database && database.isArangoDatabase);\n}\n\n/**\n * @internal\n * @hidden\n */\nfunction coerceTransactionCollections(\n collections:\n | (TransactionCollections & { allowImplicit?: boolean })\n | (string | ArangoCollection)[]\n | string\n | ArangoCollection\n): CoercedTransactionCollections {\n if (typeof collections === \"string\") {\n return { write: [collections] };\n }\n if (Array.isArray(collections)) {\n return { write: collections.map(collectionToString) };\n }\n if (isArangoCollection(collections)) {\n return { write: collectionToString(collections) };\n }\n const cols: CoercedTransactionCollections = {};\n if (collections) {\n if (collections.allowImplicit !== undefined) {\n cols.allowImplicit = collections.allowImplicit;\n }\n if (collections.read) {\n cols.read = Array.isArray(collections.read)\n ? collections.read.map(collectionToString)\n : collectionToString(collections.read);\n }\n if (collections.write) {\n cols.write = Array.isArray(collections.write)\n ? collections.write.map(collectionToString)\n : collectionToString(collections.write);\n }\n if (collections.exclusive) {\n cols.exclusive = Array.isArray(collections.exclusive)\n ? collections.exclusive.map(collectionToString)\n : collectionToString(collections.exclusive);\n }\n }\n return cols;\n}\n\n/**\n * @internal\n * @hidden\n */\ntype CoercedTransactionCollections = {\n allowImplicit?: boolean;\n exclusive?: string | string[];\n write?: string | string[];\n read?: string | string[];\n};\n\n/**\n * Collections involved in a transaction.\n */\nexport type TransactionCollections = {\n /**\n * An array of collections or a single collection that will be read from or\n * written to during the transaction with no other writes being able to run\n * in parallel.\n */\n exclusive?: (string | ArangoCollection)[] | string | ArangoCollection;\n /**\n * An array of collections or a single collection that will be read from or\n * written to during the transaction.\n *\n * If ArangoDB is using the MMFiles storage engine, this option behaves\n * exactly like `exclusive`, i.e. no other writes will run in parallel.\n */\n write?: (string | ArangoCollection)[] | string | ArangoCollection;\n /**\n * An array of collections or a single collection that will be read from\n * during the transaction.\n */\n read?: (string | ArangoCollection)[] | string | ArangoCollection;\n};\n\n/**\n * Options for how the transaction should be performed.\n */\nexport type TransactionOptions = {\n /**\n * Whether the transaction may read from collections not specified for this\n * transaction. If set to `false`, accessing any collections not specified\n * will result in the transaction being aborted to avoid potential deadlocks.\n *\n * Default: `true`.\n */\n allowImplicit?: boolean;\n /**\n * Determines whether to force the transaction to write all data to disk\n * before returning.\n */\n waitForSync?: boolean;\n /**\n * Determines how long the database will wait while attempting to gain locks\n * on collections used by the transaction before timing out.\n */\n lockTimeout?: number;\n /**\n * (RocksDB only.) Determines the transaction size limit in bytes.\n */\n maxTransactionSize?: number;\n /**\n * (RocksDB only.) Determines the maximum number of operations after which an\n * intermediate commit is performed automatically.\n *\n * @deprecated Removed in ArangoDB 3.4.\n */\n intermediateCommitCount?: number;\n /**\n * (RocksDB only.) Determine the maximum total size of operations after which\n * an intermediate commit is performed automatically.\n *\n * @deprecated Removed in ArangoDB 3.4.\n */\n intermediateCommitSize?: number;\n};\n\n/**\n * Options for executing a query.\n *\n * See {@link Database.query}.\n */\nexport type QueryOptions = {\n /**\n * If set to `true`, the query will be executed with support for dirty reads\n * enabled, permitting ArangoDB to return a potentially dirty or stale result\n * and arangojs will load balance the request without distinguishing between\n * leaders and followers.\n *\n * Note that dirty reads are only supported for read-only queries, not data\n * modification queries (e.g. using `INSERT`, `UPDATE`, `REPLACE` or\n * `REMOVE`) and only when using ArangoDB 3.4 or later.\n *\n * Default: `false`\n */\n allowDirtyRead?: boolean;\n /**\n * Maximum time in milliseconds arangojs will wait for a server response.\n * Exceeding this value will result in the request being cancelled.\n *\n * **Note**: Setting a timeout for the client does not guarantee the query\n * will be killed by ArangoDB if it is already being executed. See the\n * `maxRuntime` option for limiting the execution time within ArangoDB.\n */\n timeout?: number;\n /**\n * If set to a positive number, the query will automatically be retried at\n * most this many times if it results in a write-write conflict.\n *\n * Default: `0`\n */\n retryOnConflict?: number;\n /**\n * Unless set to `false`, the number of result values in the result set will\n * be returned in the `count` attribute. This may be disabled by default in\n * a future version of ArangoDB if calculating this value has a performance\n * impact for some queries.\n *\n * Default: `true`.\n */\n count?: boolean;\n /**\n * Number of result values to be transferred by the server in each\n * network roundtrip (or \"batch\").\n *\n * Must be greater than zero.\n */\n batchSize?: number;\n /**\n * If set to `false`, the AQL query results cache lookup will be skipped for\n * this query.\n *\n * Default: `true`\n */\n cache?: boolean;\n /**\n * Maximum memory size in bytes that the query is allowed to use.\n * Exceeding this value will result in the query failing with an error.\n *\n * If set to `0`, the memory limit is disabled.\n *\n * Default: `0`\n */\n memoryLimit?: number;\n /**\n * Maximum allowed execution time before the query will be killed in seconds.\n *\n * If set to `0`, the query will be allowed to run indefinitely.\n *\n * Default: `0`\n */\n maxRuntime?: number;\n /**\n * Time-to-live for the cursor in seconds. The cursor results may be\n * garbage collected by ArangoDB after this much time has passed.\n *\n * Default: `30`\n */\n ttl?: number;\n /**\n * If set to `true`, the query will throw an exception and abort if it would\n otherwise produce a warning.\n */\n failOnWarning?: boolean;\n /**\n * If set to `1` or `true`, additional query profiling information will be\n * returned in the `extra.profile` attribute if the query is not served from\n * the result cache.\n *\n * If set to `2`, the query will return execution stats per query plan node\n * in the `extra.stats.nodes` attribute. Additionally the query plan is\n * returned in `extra.plan`.\n */\n profile?: boolean | number;\n /**\n * If set to `true`, the query will be executed as a streaming query.\n */\n stream?: boolean;\n /**\n * Limits the maximum number of warnings a query will return.\n */\n maxWarningsCount?: number;\n /**\n * If set to `true` and the query has a `LIMIT` clause, the total number of\n * values matched before the last top-level `LIMIT` in the query was applied\n * will be returned in the `extra.stats.fullCount` attribute.\n */\n fullCount?: boolean;\n /**\n * If set to `false`, the query data will not be stored in the RocksDB block\n * cache. This can be used to avoid thrashing he block cache when reading a\n * lot of data.\n */\n fillBlockCache?: boolean;\n /**\n * An object with a `rules` property specifying a list of optimizer rules to\n * be included or excluded by the optimizer for this query. Prefix a rule\n * name with `+` to include it, or `-` to exclude it. The name `all` acts as\n * an alias matching all optimizer rules.\n */\n optimizer?: { rules: string[] };\n /**\n * Limits the maximum number of plans that will be created by the AQL query\n * optimizer.\n */\n maxPlans?: number;\n /**\n * Controls after how many execution nodes in a query a stack split should be\n * performed.\n *\n * Default: `250` (`200` on macOS)\n */\n maxNodesPerCallstack?: number;\n /**\n * (RocksDB only.) Maximum size of transactions in bytes.\n */\n maxTransactionSize?: number;\n /**\n * (RocksDB only.) Maximum number of operations after which an intermediate\n * commit is automatically performed.\n */\n intermediateCommitCount?: number;\n /**\n * (RocksDB only.) Maximum total size of operations in bytes after which an\n * intermediate commit is automatically performed.\n */\n intermediateCommitSize?: number;\n /**\n * (Enterprise Edition cluster only.) If set to `true`, collections\n * inaccessible to current user will result in an access error instead\n * of being treated as empty.\n */\n skipInaccessibleCollections?: boolean;\n /**\n * (Enterprise Edition cluster only.) Limits the maximum time in seconds a\n * DBServer will wait to bring satellite collections involved in the query\n * into sync. Exceeding this value will result in the query being stopped.\n *\n * Default: `60`\n */\n satelliteSyncWait?: number;\n};\n\n/**\n * Options for explaining a query.\n *\n * See {@link Database.explain}.\n */\nexport type ExplainOptions = {\n /**\n * An object with a `rules` property specifying a list of optimizer rules to\n * be included or excluded by the optimizer for this query. Prefix a rule\n * name with `+` to include it, or `-` to exclude it. The name `all` acts as\n * an alias matching all optimizer rules.\n */\n optimizer?: { rules: string[] };\n /**\n * Maximum number of plans that the optimizer is allowed to generate.\n * Setting this to a low value limits the amount of work the optimizer does.\n */\n maxNumberOfPlans?: number;\n /**\n * If set to true, all possible execution plans will be returned as the\n * `plans` property. Otherwise only the optimal execution plan will be\n * returned as the `plan` property.\n *\n * Default: `false`\n */\n allPlans?: boolean;\n};\n\n/**\n * Details for a transaction.\n *\n * See also {@link TransactionStatus}.\n */\nexport type TransactionDetails = {\n /**\n * Unique identifier of the transaction.\n */\n id: string;\n /**\n * Status (or \"state\") of the transaction.\n */\n state: \"running\" | \"committed\" | \"aborted\";\n};\n\n/**\n * Plan explaining query execution.\n */\nexport type ExplainPlan = {\n /**\n * Execution nodes in this plan.\n */\n nodes: {\n [key: string]: any;\n type: string;\n id: number;\n dependencies: number[];\n estimatedCost: number;\n estimatedNrItems: number;\n }[];\n /**\n * Rules applied by the optimizer.\n */\n rules: string[];\n /**\n * Information about collections involved in the query.\n */\n collections: {\n name: string;\n type: \"read\" | \"write\";\n }[];\n /**\n * Variables used in the query.\n */\n variables: {\n id: number;\n name: string;\n }[];\n /**\n * Total estimated cost of the plan.\n */\n estimatedCost: number;\n /**\n * Estimated number of items returned by the query.\n */\n estimatedNrItems: number;\n /**\n * Whether the query is a data modification query.\n */\n isModificationQuery: boolean;\n};\n\n/**\n * Result of explaining a query with a single plan.\n */\nexport type SingleExplainResult = {\n /**\n * Query plan.\n */\n plan: ExplainPlan;\n /**\n * Whether it would be possible to cache the query.\n */\n cacheable: boolean;\n /**\n * Warnings encountered while planning the query execution.\n */\n warnings: { code: number; message: string }[];\n /**\n * Statistical information about the query plan generation.\n */\n stats: {\n /**\n * Total number of rules executed for this query.\n */\n rulesExecuted: number;\n /**\n * Number of rules skipped for this query.\n */\n rulesSkipped: number;\n /**\n * Total number of plans created.\n */\n plansCreated: number;\n };\n};\n\n/**\n * Result of explaining a query with multiple plans.\n */\nexport type MultiExplainResult = {\n /**\n * Query plans.\n */\n plans: ExplainPlan[];\n /**\n * Whether it would be possible to cache the query.\n */\n cacheable: boolean;\n /**\n * Warnings encountered while planning the query execution.\n */\n warnings: { code: number; message: string }[];\n /**\n * Statistical information about the query plan generation.\n */\n stats: {\n /**\n * Total number of rules executed for this query.\n */\n rulesExecuted: number;\n /**\n * Number of rules skipped for this query.\n */\n rulesSkipped: number;\n /**\n * Total number of plans created.\n */\n plansCreated: number;\n };\n};\n\n/**\n * Node in an AQL abstract syntax tree (AST).\n */\nexport type AstNode = {\n [key: string]: any;\n type: string;\n subNodes: AstNode[];\n};\n\n/**\n * Result of parsing a query.\n */\nexport type ParseResult = {\n /**\n * Whether the query was parsed.\n */\n parsed: boolean;\n /**\n * Names of all collections involved in the query.\n */\n collections: string[];\n /**\n * Names of all bind parameters used in the query.\n */\n bindVars: string[];\n /**\n * Abstract syntax tree (AST) of the query.\n */\n ast: AstNode[];\n};\n\n/**\n * Information about query tracking.\n */\nexport type QueryTracking = {\n /**\n * Whether query tracking is enabled.\n */\n enabled: boolean;\n /**\n * Maximum query string length in bytes that is kept in the list.\n */\n maxQueryStringLength: number;\n /**\n * Maximum number of slow queries that is kept in the list.\n */\n maxSlowQueries: number;\n /**\n * Threshold execution time in seconds for when a query is\n * considered slow.\n */\n slowQueryThreshold: number;\n /**\n * Whether bind parameters are being tracked along with queries.\n */\n trackBindVars: boolean;\n /**\n * Whether slow queries are being tracked.\n */\n trackSlowQueries: boolean;\n};\n\n/**\n * Options for query tracking.\n *\n * See {@link Database.queryTracking}.\n */\nexport type QueryTrackingOptions = {\n /**\n * If set to `false`, neither queries nor slow queries will be tracked.\n */\n enabled?: boolean;\n /**\n * Maximum query string length in bytes that will be kept in the list.\n */\n maxQueryStringLength?: number;\n /**\n * Maximum number of slow queries to be kept in the list.\n */\n maxSlowQueries?: number;\n /**\n * Threshold execution time in seconds for when a query will be\n * considered slow.\n */\n slowQueryThreshold?: number;\n /**\n * If set to `true`, bind parameters will be tracked along with queries.\n */\n trackBindVars?: boolean;\n /**\n * If set to `true` and `enabled` is also set to `true`, slow queries will be\n * tracked if their execution time exceeds `slowQueryThreshold`.\n */\n trackSlowQueries?: boolean;\n};\n\n/**\n * Object describing a query.\n */\nexport type QueryInfo = {\n /**\n * Unique identifier for this query.\n */\n id: string;\n /**\n * Query string (potentially truncated).\n */\n query: string;\n /**\n * Bind parameters used in the query.\n */\n bindVars: Dict<any>;\n /**\n * Query's running time in seconds.\n */\n runTime: number;\n /**\n * Date and time the query was started.\n */\n started: string;\n /**\n * Query's current execution state.\n */\n state: \"executing\" | \"finished\" | \"killed\";\n /**\n * Whether the query uses a streaming cursor.\n */\n stream: boolean;\n};\n\n/**\n * Database user to create with a database.\n */\nexport type CreateDatabaseUser = {\n /**\n * Username of the user to create.\n */\n username: string;\n /**\n * Password of the user to create.\n *\n * Default: `\"\"`\n */\n passwd?: string;\n /**\n * Whether the user is active.\n *\n * Default: `true`\n */\n active?: boolean;\n /**\n * Additional data to store with the user object.\n */\n extra?: Dict<any>;\n};\n\n/**\n * Options for creating a database.\n *\n * See {@link Database.createDatabase}.\n */\nexport type CreateDatabaseOptions = {\n /**\n * Database users to create with the database.\n */\n users?: CreateDatabaseUser[];\n /**\n * (Cluster only.) The sharding method to use for new collections in the\n * database.\n */\n sharding?: \"\" | \"flexible\" | \"single\";\n /**\n * (Cluster only.) Default replication factor for new collections in this\n * database.\n *\n * Setting this to `1` disables replication. Setting this to `\"satellite\"`\n * will replicate to every DBServer.\n */\n replicationFactor?: \"satellite\" | number;\n /**\n * (Cluster only.) Default write concern for new collections created in this\n * database.\n */\n writeConcern?: number;\n /**\n * (Cluster only.) Default write concern for new collections created in this\n * database.\n *\n * @deprecated Renamed to `writeConcern` in ArangoDB 3.6.\n */\n minReplicationFactor?: number;\n};\n\n/**\n * Object describing a database.\n *\n * See {@link Database.get}.\n */\nexport type DatabaseInfo = {\n /**\n * Name of the database.\n */\n name: string;\n /**\n * Unique identifier of the database.\n */\n id: string;\n /**\n * File system path of the database.\n */\n path: string;\n /**\n * Whether the database is the system database.\n */\n isSystem: boolean;\n /**\n * (Cluster only.) The sharding method to use for new collections in the\n * database.\n */\n sharding?: \"\" | \"flexible\" | \"single\";\n /**\n * (Cluster only.) Default replication factor for new collections in this\n * database.\n */\n replicationFactor?: \"satellite\" | number;\n /**\n * (Cluster only.) Default write concern for new collections created in this\n * database.\n */\n writeConcern?: number;\n /**\n * (Cluster only.) Default write concern for new collections created in this\n * database.\n *\n * @deprecated Renamed to `writeConcern` in ArangoDB 3.6.\n */\n minReplicationFactor?: number;\n};\n\n/**\n * Result of retrieving database version information.\n */\nexport type VersionInfo = {\n /**\n * Value identifying the server type, i.e. `\"arango\"`.\n */\n server: string;\n /**\n * ArangoDB license type or \"edition\".\n */\n license: \"community\" | \"enterprise\";\n /**\n * ArangoDB server version.\n */\n version: string;\n /**\n * Additional information about the ArangoDB server.\n */\n details?: { [key: string]: string };\n};\n\n/**\n * Definition of an AQL User Function.\n */\nexport type AqlUserFunction = {\n /**\n * Name of the AQL User Function.\n */\n name: string;\n /**\n * Implementation of the AQL User Function.\n */\n code: string;\n /**\n * Whether the function is deterministic.\n *\n * See {@link Database.createFunction}.\n */\n isDeterministic: boolean;\n};\n\n/**\n * Options for installing the service.\n *\n * See {@link Database.installService}.\n */\nexport type InstallServiceOptions = {\n /**\n * An object mapping configuration option names to values.\n *\n * See also {@link Database.getServiceConfiguration}.\n */\n configuration?: Dict<any>;\n /**\n * An object mapping dependency aliases to mount points.\n *\n * See also {@link Database.getServiceDependencies}.\n */\n dependencies?: Dict<string>;\n /**\n * Whether the service should be installed in development mode.\n *\n * See also {@link Database.setServiceDevelopmentMode}.\n *\n * Default: `false`\n */\n development?: boolean;\n /**\n * Whether the service should be installed in legacy compatibility mode\n *\n * This overrides the `engines` option in the service manifest (if any).\n *\n * Default: `false`\n */\n legacy?: boolean;\n /**\n * Whether the \"setup\" script should be executed.\n *\n * Default: `true`\n */\n setup?: boolean;\n};\n\n/**\n * Options for replacing a service.\n *\n * See {@link Database.replaceService}.\n */\nexport type ReplaceServiceOptions = {\n /**\n * An object mapping configuration option names to values.\n *\n * See also {@link Database.getServiceConfiguration}.\n */\n configuration?: Dict<any>;\n /**\n * An object mapping dependency aliases to mount points.\n *\n * See also {@link Database.getServiceDependencies}.\n */\n dependencies?: Dict<string>;\n /**\n * Whether the service should be installed in development mode.\n *\n * See also {@link Database.setServiceDevelopmentMode}.\n *\n * Default: `false`\n */\n development?: boolean;\n /**\n * Whether the service should be installed in legacy compatibility mode\n *\n * This overrides the `engines` option in the service manifest (if any).\n *\n * Default: `false`\n */\n legacy?: boolean;\n /**\n * Whether the \"setup\" script should be executed.\n *\n * Default: `true`\n */\n setup?: boolean;\n /**\n * Whether the existing service's \"teardown\" script should be executed\n * prior to removing that service.\n *\n * Default: `true`\n */\n teardown?: boolean;\n /**\n * If set to `true`, replacing a service that does not already exist will\n * fall back to installing the new service.\n *\n * Default: `false`\n */\n force?: boolean;\n};\n\n/**\n * Options for upgrading a service.\n *\n * See {@link Database.upgradeService}.\n */\nexport type UpgradeServiceOptions = {\n /**\n * An object mapping configuration option names to values.\n *\n * See also {@link Database.getServiceConfiguration}.\n */\n configuration?: Dict<any>;\n /**\n * An object mapping dependency aliases to mount points.\n *\n * See also {@link Database.getServiceDependencies}.\n */\n dependencies?: Dict<string>;\n /**\n * Whether the service should be installed in development mode.\n *\n * See also {@link Database.setServiceDevelopmentMode}.\n *\n * Default: `false`\n */\n development?: boolean;\n /**\n * Whether the service should be installed in legacy compatibility mode\n *\n * This overrides the `engines` option in the service manifest (if any).\n *\n * Default: `false`\n */\n legacy?: boolean;\n /**\n * Whether the \"setup\" script should be executed.\n *\n * Default: `true`\n */\n setup?: boolean;\n /**\n * Whether the existing service's \"teardown\" script should be executed\n * prior to upgrading that service.\n *\n * Default: `false`\n */\n teardown?: boolean;\n /**\n * Unless set to `true`, upgrading a service that does not already exist will\n * fall back to installing the new service.\n *\n * Default: `false`\n */\n force?: boolean;\n};\n\n/**\n * Options for uninstalling a service.\n *\n * See {@link Database.uninstallService}.\n */\nexport type UninstallServiceOptions = {\n /**\n * Whether the service's \"teardown\" script should be executed\n * prior to removing that service.\n *\n * Default: `true`\n */\n teardown?: boolean;\n /**\n * If set to `true`, uninstalling a service that does not already exist\n * will be considered successful.\n *\n * Default: `false`\n */\n force?: boolean;\n};\n\n/**\n * Object briefly describing a Foxx service.\n */\nexport type ServiceSummary = {\n /**\n * Service mount point, relative to the database.\n */\n mount: string;\n /**\n * Name defined in the service manifest.\n */\n name?: string;\n /**\n * Version defined in the service manifest.\n */\n version?: string;\n /**\n * Service dependencies the service expects to be able to match as a mapping\n * from dependency names to versions the service is compatible with.\n */\n provides: Dict<string>;\n /**\n * Whether development mode is enabled for this service.\n */\n development: boolean;\n /**\n * Whether the service is running in legacy compatibility mode.\n */\n legacy: boolean;\n};\n\n/**\n * Object describing a Foxx service in detail.\n */\nexport type ServiceInfo = {\n /**\n * Service mount point, relative to the database.\n */\n mount: string;\n /**\n * File system path of the service.\n */\n path: string;\n /**\n * Name defined in the service manifest.\n */\n name?: string;\n /**\n * Version defined in the service manifest.\n */\n version?: string;\n /**\n * Whether development mode is enabled for this service.\n */\n development: boolean;\n /**\n * Whether the service is running in legacy compatibility mode.\n */\n legacy: boolean;\n /**\n * Content of the service manifest of this service.\n */\n manifest: FoxxManifest;\n /**\n * Internal checksum of the service's initial source bundle.\n */\n checksum: string;\n /**\n * Options for this service.\n */\n options: {\n /**\n * Configuration values set for this service.\n */\n configuration: Dict<any>;\n /**\n * Service dependency configuration of this service.\n */\n dependencies: Dict<string>;\n };\n};\n\n/**\n * Object describing a configuration option of a Foxx service.\n */\nexport type ServiceConfiguration = {\n /**\n * Data type of the configuration value.\n *\n * **Note**: `\"int\"` and `\"bool\"` are historical synonyms for `\"integer\"` and\n * `\"boolean\"`. The `\"password\"` type is synonymous with `\"string\"` but can\n * be used to distinguish values which should not be displayed in plain text\n * by software when managing the service.\n */\n type:\n | \"integer\"\n | \"boolean\"\n | \"string\"\n | \"number\"\n | \"json\"\n | \"password\"\n | \"int\"\n | \"bool\";\n /**\n * Current value of the configuration option as stored internally.\n */\n currentRaw: any;\n /**\n * Processed current value of the configuration option as exposed in the\n * service code.\n */\n current: any;\n /**\n * Formatted name of the configuration option.\n */\n title: string;\n /**\n * Human-readable description of the configuration option.\n */\n description?: string;\n /**\n * Whether the configuration option must be set in order for the service\n * to be operational.\n */\n required: boolean;\n /**\n * Default value of the configuration option.\n */\n default?: any;\n};\n\n/**\n * Object describing a single-service dependency defined by a Foxx service.\n */\nexport type SingleServiceDependency = {\n /**\n * Whether this is a multi-service dependency.\n */\n multiple: false;\n /**\n * Current mount point the dependency is resolved to.\n */\n current?: string;\n /**\n * Formatted name of the dependency.\n */\n title: string;\n /**\n * Name of the service the dependency expects to match.\n */\n name: string;\n /**\n * Version of the service the dependency expects to match.\n */\n version: string;\n /**\n * Human-readable description of the dependency.\n */\n description?: string;\n /**\n * Whether the dependency must be matched in order for the service\n * to be operational.\n */\n required: boolean;\n};\n\n/**\n * Object describing a multi-service dependency defined by a Foxx service.\n */\nexport type MultiServiceDependency = {\n /**\n * Whether this is a multi-service dependency.\n */\n multiple: true;\n /**\n * Current mount points the dependency is resolved to.\n */\n current?: string[];\n /**\n * Formatted name of the dependency.\n */\n title: string;\n /**\n * Name of the service the dependency expects to match.\n */\n name: string;\n /**\n * Version of the service the dependency expects to match.\n */\n version: string;\n /**\n * Human-readable description of the dependency.\n */\n description?: string;\n /**\n * Whether the dependency must be matched in order for the service\n * to be operational.\n */\n required: boolean;\n};\n\n/**\n * Test stats for a Foxx service's tests.\n */\nexport type ServiceTestStats = {\n /**\n * Total number of tests found.\n */\n tests: number;\n /**\n * Number of tests that ran successfully.\n */\n passes: number;\n /**\n * Number of tests that failed.\n */\n failures: number;\n /**\n * Number of tests skipped or not executed.\n */\n pending: number;\n /**\n * Total test duration in milliseconds.\n */\n duration: number;\n};\n\n/**\n * Test results for a single test case using the stream reporter.\n */\nexport type ServiceTestStreamTest = {\n title: string;\n fullTitle: string;\n duration: number;\n err?: string;\n};\n\n/**\n * Test results for a Foxx service's tests using the stream reporter.\n */\nexport type ServiceTestStreamReport = (\n | [\"start\", { total: number }]\n | [\"pass\", ServiceTestStreamTest]\n | [\"fail\", ServiceTestStreamTest]\n | [\"end\", ServiceTestStats]\n)[];\n\n/**\n * Test results for a single test case using the suite reporter.\n */\nexport type ServiceTestSuiteTest = {\n result: \"pending\" | \"pass\" | \"fail\";\n title: string;\n duration: number;\n err?: any;\n};\n\n/**\n * Test results for a single test suite using the suite reporter.\n */\nexport type ServiceTestSuite = {\n title: string;\n suites: ServiceTestSuite[];\n tests: ServiceTestSuiteTest[];\n};\n\n/**\n * Test results for a Foxx service's tests using the suite reporter.\n */\nexport type ServiceTestSuiteReport = {\n stats: ServiceTestStats;\n suites: ServiceTestSuite[];\n tests: ServiceTestSuiteTest[];\n};\n\n/**\n * Test results for a single test case in XUnit format using the JSONML\n * representation.\n */\nexport type ServiceTestXunitTest =\n | [\"testcase\", { classname: string; name: string; time: number }]\n | [\n \"testcase\",\n { classname: string; name: string; time: number },\n [\"failure\", { message: string; type: string }, string]\n ];\n\n/**\n * Test results for a Foxx service's tests in XUnit format using the JSONML\n * representation.\n */\nexport type ServiceTestXunitReport = [\n \"testsuite\",\n {\n timestamp: number;\n tests: number;\n errors: number;\n failures: number;\n skip: number;\n time: number;\n },\n ...ServiceTestXunitTest[]\n];\n\n/**\n * Test results for a Foxx service's tests in TAP format.\n */\nexport type ServiceTestTapReport = string[];\n\n/**\n * Test results for a single test case using the default reporter.\n */\nexport type ServiceTestDefaultTest = {\n title: string;\n fullTitle: string;\n duration: number;\n err?: string;\n};\n\n/**\n * Test results for a Foxx service's tests using the default reporter.\n */\nexport type ServiceTestDefaultReport = {\n stats: ServiceTestStats;\n tests: ServiceTestDefaultTest[];\n pending: ServiceTestDefaultTest[];\n failures: ServiceTestDefaultTest[];\n passes: ServiceTestDefaultTest[];\n};\n\n/**\n * OpenAPI 2.0 description of a Foxx service.\n */\nexport type SwaggerJson = {\n [key: string]: any;\n info: {\n title: string;\n description: string;\n version: string;\n license: string;\n };\n path: {\n [key: string]: any;\n };\n};\n\n/**\n * Access level for an ArangoDB user's access to a collection or database.\n */\nexport type AccessLevel = \"rw\" | \"ro\" | \"none\";\n\n/**\n * Properties of an ArangoDB user object.\n */\nexport type ArangoUser = {\n /**\n * ArangoDB username of the user.\n */\n user: string;\n /**\n * Whether the ArangoDB user account is enabled and can authenticate.\n */\n active: boolean;\n /**\n * Additional information to store about this user.\n */\n extra: Record<string, any>;\n};\n\n/**\n * Options for creating an ArangoDB user.\n */\nexport type CreateUserOptions = {\n /**\n * ArangoDB username of the user.\n */\n user: string;\n /**\n * Password the ArangoDB user will use for authentication.\n */\n passwd: string;\n /**\n * Whether the ArangoDB user account is enabled and can authenticate.\n *\n * Default: `true`\n */\n active?: boolean;\n /**\n * Additional information to store about this user.\n *\n * Default: `{}`\n */\n extra?: Record<string, any>;\n};\n\n/**\n * Options for modifying an ArangoDB user.\n */\nexport type UserOptions = {\n /**\n * Password the ArangoDB user will use for authentication.\n */\n passwd: string;\n /**\n * Whether the ArangoDB user account is enabled and can authenticate.\n *\n * Default: `true`\n */\n active?: boolean;\n /**\n * Additional information to store about this user.\n *\n * Default: `{}`\n */\n extra?: Record<string, any>;\n};\n\n/**\n * Options for accessing or manipulating access levels.\n */\nexport type UserAccessLevelOptions = {\n /**\n * The database to access or manipulate the access level of.\n *\n * If `collection` is an `ArangoCollection`, this option defaults to the\n * database the collection is contained in. Otherwise this option defaults to\n * the current database.\n */\n database?: Database | string;\n /**\n * The collection to access or manipulate the access level of.\n */\n collection?: ArangoCollection | string;\n};\n\n/**\n * An object providing methods for accessing queue time metrics of the most\n * recently received server responses if the server supports this feature.\n */\nexport type QueueTimeMetrics = {\n /**\n * Returns the queue time of the most recently received response in seconds.\n */\n getLatest: () => number | undefined;\n /**\n * Returns a list of the most recently received queue time values as tuples\n * of the timestamp of the response being processed in milliseconds and the\n * queue time in seconds.\n */\n getValues: () => [number, number][];\n /**\n * Returns the average queue time of the most recently received responses\n * in seconds.\n */\n getAvg: () => number;\n};\n\n/**\n * An object representing a single ArangoDB database. All arangojs collections,\n * cursors, analyzers and so on are linked to a `Database` object.\n */\nexport class Database {\n protected _connection: Connection;\n protected _name: string;\n protected _analyzers = new Map<string, Analyzer>();\n protected _collections = new Map<string, Collection>();\n protected _graphs = new Map<string, Graph>();\n protected _views = new Map<string, ArangoSearchView>();\n\n /**\n * Creates a new `Database` instance with its own connection pool.\n *\n * See also {@link Database.database}.\n *\n * @param config - An object with configuration options.\n *\n * @example\n * ```js\n * const db = new Database({\n * url: \"http://localhost:8529\",\n * databaseName: \"my_database\",\n * auth: { username: \"admin\", password: \"hunter2\" },\n * });\n * ```\n */\n constructor(config?: Config);\n /**\n * Creates a new `Database` instance with its own connection pool.\n *\n * See also {@link Database.database}.\n *\n * @param url - Base URL of the ArangoDB server or list of server URLs.\n * Equivalent to the `url` option in {@link Config}.\n *\n * @example\n * ```js\n * const db = new Database(\"http://localhost:8529\", \"my_database\");\n * db.useBasicAuth(\"admin\", \"hunter2\");\n * ```\n */\n constructor(url: string | string[], name?: string);\n // There's currently no way to hide a single overload from typedoc\n // /**\n // * @internal\n // * @hidden\n // */\n // constructor(database: Database, name?: string);\n constructor(\n configOrDatabase: string | string[] | Config | Database = {},\n name?: string\n ) {\n if (isArangoDatabase(configOrDatabase)) {\n const connection = configOrDatabase._connection;\n const databaseName = (name || configOrDatabase.name).normalize(\"NFC\");\n this._connection = connection;\n this._name = databaseName;\n const database = connection.database(databaseName);\n if (database) return database;\n } else {\n const config = configOrDatabase;\n const { databaseName, ...options } =\n typeof config === \"string\" || Array.isArray(config)\n ? { databaseName: name, url: config }\n : config;\n this._connection = new Connection(options);\n this._name = databaseName?.normalize(\"NFC\") || \"_system\";\n }\n }\n\n //#region misc\n /**\n * @internal\n *\n * Indicates that this object represents an ArangoDB database.\n */\n get isArangoDatabase(): true {\n return true;\n }\n\n /**\n * Name of the ArangoDB database this instance represents.\n */\n get name() {\n return this._name;\n }\n\n /**\n * Fetches version information from the ArangoDB server.\n *\n * @param details - If set to `true`, additional information about the\n * ArangoDB server will be available as the `details` property.\n *\n * @example\n * ```js\n * const db = new Database();\n * const version = await db.version();\n * // the version object contains the ArangoDB version information.\n * // license: \"community\" or \"enterprise\"\n * // version: ArangoDB version number\n * // server: description of the server\n * ```\n */\n version(details?: boolean): Promise<VersionInfo> {\n return this.request(\n {\n method: \"GET\",\n path: \"/_api/version\",\n qs: { details },\n },\n (res) => res.body\n );\n }\n\n /**\n * Returns a new {@link Route} instance for the given path (relative to the\n * database) that can be used to perform arbitrary HTTP requests.\n *\n * @param path - The database-relative URL of the route. Defaults to the\n * database API root.\n * @param headers - Default headers that should be sent with each request to\n * the route.\n *\n * @example\n * ```js\n * const db = new Database();\n * const myFoxxService = db.route(\"my-foxx-service\");\n * const response = await myFoxxService.post(\"users\", {\n * username: \"admin\",\n * password: \"hunter2\"\n * });\n * // response.body is the result of\n * // POST /_db/_system/my-foxx-service/users\n * // with JSON request body '{\"username\": \"admin\", \"password\": \"hunter2\"}'\n * ```\n */\n route(path?: string, headers?: Headers): Route {\n return new Route(this, path, headers);\n }\n\n /**\n * @internal\n *\n * Performs an arbitrary HTTP request against the database.\n *\n * If `absolutePath` is set to `true`, the database path will not be\n * automatically prepended to the `basePath`.\n *\n * @param T - Return type to use. Defaults to the response object type.\n * @param options - Options for this request.\n * @param transform - An optional function to transform the low-level\n * response object to a more useful return value.\n */\n request<T = ArangojsResponse>(\n options: RequestOptions & { absolutePath?: boolean },\n transform?: (res: ArangojsResponse) => T\n ): Promise<T>;\n request<T = ArangojsResponse>(\n {\n absolutePath = false,\n basePath,\n ...opts\n }: RequestOptions & { absolutePath?: boolean },\n transform?: (res: ArangojsResponse) => T\n ): Promise<T> {\n if (!absolutePath) {\n basePath = `/_db/${encodeURIComponent(this._name)}${basePath || \"\"}`;\n }\n return this._connection.request({ basePath, ...opts }, transform);\n }\n\n /**\n * Updates the URL list by requesting a list of all coordinators in the\n * cluster and adding any endpoints not initially specified in the\n * {@link Config}.\n *\n * For long-running processes communicating with an ArangoDB cluster it is\n * recommended to run this method periodically (e.g. once per hour) to make\n * sure new coordinators are picked up correctly and can be used for\n * fail-over or load balancing.\n *\n * @example\n * ```js\n * const db = new Database();\n * const interval = setInterval(\n * () => db.acquireHostList(),\n * 5 * 60 * 1000 // every 5 minutes\n * );\n *\n * // later\n * clearInterval(interval);\n * db.close();\n * ```\n */\n async acquireHostList(): Promise<void> {\n const urls: string[] = await this.request(\n { path: \"/_api/cluster/endpoints\" },\n (res) => res.body.endpoints.map((endpoint: any) => endpoint.endpoint)\n );\n this._connection.addToHostList(urls);\n }\n\n /**\n * Closes all active connections of this database instance.\n *\n * Can be used to clean up idling connections during longer periods of\n * inactivity.\n *\n * **Note**: This method currently has no effect in the browser version of\n * arangojs.\n *\n * @example\n * ```js\n * const db = new Database();\n * const sessions = db.collection(\"sessions\");\n * // Clean up expired sessions once per hour\n * setInterval(async () => {\n * await db.query(aql`\n * FOR session IN ${sessions}\n * FILTER session.expires < DATE_NOW()\n * REMOVE session IN ${sessions}\n * `);\n * // Making sure to close the connections because they're no longer used\n * db.close();\n * }, 1000 * 60 * 60);\n * ```\n */\n close(): void {\n this._connection.close();\n }\n\n /**\n * Performs a request against every known coordinator and returns when the\n * request has succeeded against every coordinator or the timeout is reached.\n *\n * **Note**: This method is primarily intended to make database setup easier\n * in cluster scenarios and requires all coordinators to be known to arangojs\n * before the method is invoked. The method is not useful in single-server or\n * leader-follower replication scenarios.\n *\n * @example\n * ```js\n * const db = new Database({ loadBalancingStrategy: \"ROUND_ROBIN\" });\n * await db.acquireHostList();\n * const analyzer = db.analyzer(\"my-analyzer\");\n * await analyzer.create();\n * await db.waitForPropagation(\n * { path: `/_api/analyzer/${encodeURIComponent(analyzer.name)}` },\n * 30000\n * );\n * // Analyzer has been propagated to all coordinators and can safely be used\n * ```\n *\n * @param request - Request to perform against each known coordinator.\n * @param timeout - Maximum number of milliseconds to wait for propagation.\n */\n async waitForPropagation(\n request: RequestOptions,\n timeout?: number\n ): Promise<void>;\n async waitForPropagation(\n { basePath, ...request }: RequestOptions,\n timeout?: number\n ): Promise<void> {\n await this._connection.waitForPropagation(\n {\n ...request,\n basePath: `/_db/${encodeURIComponent(this._name)}${basePath || \"\"}`,\n },\n timeout\n );\n }\n\n /**\n * Methods for accessing the server-reported queue times of the mostly\n * recently received responses.\n */\n get queueTime(): QueueTimeMetrics {\n return this._connection.queueTime;\n }\n\n /**\n * Sets the limit for the number of values of the most recently received\n * server-reported queue times that can be accessed using\n * {@link Database.queueTime}.\n *\n * @param responseQueueTimeSamples - Number of values to maintain.\n */\n setResponseQueueTimeSamples(responseQueueTimeSamples: number) {\n this._connection.setResponseQueueTimeSamples(responseQueueTimeSamples);\n }\n //#endregion\n\n //#region auth\n /**\n * Updates the `Database` instance and its connection string to use the given\n * `databaseName`, then returns itself.\n *\n * **Note**: This also affects all collections, cursors and other arangojs\n * objects originating from this database object, which may cause unexpected\n * results.\n *\n * @param databaseName - Name of the database to use.\n *\n * @deprecated Use {@link Database.database} instead.\n *\n * @example\n * ```js\n * const systemDb = new Database();\n * // systemDb.useDatabase(\"my_database\"); // deprecated\n * const myDb = systemDb.database(\"my_database\");\n * ```\n */\n useDatabase(databaseName: string): this {\n this._connection.database(this._name, null);\n this._name = databaseName.normalize(\"NFC\");\n return this;\n }\n\n /**\n * Updates the `Database` instance's `authorization` header to use Basic\n * authentication with the given `username` and `password`, then returns\n * itself.\n *\n * @param username - The username to authenticate with.\n * @param password - The password to authenticate with.\n *\n * @example\n * ```js\n * const db = new Database();\n * db.useDatabase(\"test\");\n * db.useBasicAuth(\"admin\", \"hunter2\");\n * // The database instance now uses the database \"test\"\n * // with the username \"admin\" and password \"hunter2\".\n * ```\n */\n useBasicAuth(username: string = \"root\", password: string = \"\"): this {\n this._connection.setBasicAuth({ username, password });\n return this;\n }\n\n /**\n * Updates the `Database` instance's `authorization` header to use Bearer\n * authentication with the given authentication `token`, then returns itself.\n *\n * @param token - The token to authenticate with.\n *\n * @example\n * ```js\n * const db = new Database();\n * db.useBearerAuth(\"keyboardcat\");\n * // The database instance now uses Bearer authentication.\n * ```\n */\n useBearerAuth(token: string): this {\n this._connection.setBearerAuth({ token });\n return this;\n }\n\n /**\n * Validates the given database credentials and exchanges them for an\n * authentication token, then uses the authentication token for future\n * requests and returns it.\n *\n * @param username - The username to authenticate with.\n * @param password - The password to authenticate with.\n *\n * @example\n * ```js\n * const db = new Database();\n * db.useDatabase(\"test\");\n * await db.login(\"admin\", \"hunter2\");\n * // The database instance now uses the database \"test\"\n * // with an authentication token for the \"admin\" user.\n * ```\n */\n login(username: string = \"root\", password: string = \"\"): Promise<string> {\n return this.request(\n {\n method: \"POST\",\n path: \"/_open/auth\",\n body: { username, password },\n },\n (res) => {\n this.useBearerAuth(res.body.jwt);\n return res.body.jwt;\n }\n );\n }\n //#endregion\n\n //#region databases\n /**\n * Creates a new `Database` instance for the given `databaseName` that\n * shares this database's connection pool.\n *\n * See also {@link Database.constructor}.\n *\n * @param databaseName - Name of the database.\n *\n * @example\n * ```js\n * const systemDb = new Database();\n * const myDb = system.database(\"my_database\");\n * ```\n */\n database(databaseName: string) {\n return new Database(this as any, databaseName);\n }\n\n /**\n * Fetches the database description for the active database from the server.\n *\n * @example\n * ```js\n * const db = new Database();\n * const info = await db.get();\n * // the database exists\n * ```\n */\n get(): Promise<DatabaseInfo> {\n return this.request(\n { path: \"/_api/database/current\" },\n (res) => res.body.result\n );\n }\n\n /**\n * Checks whether the database exists.\n *\n * @example\n * ```js\n * const db = new Database();\n * const result = await db.exists();\n * // result indicates whether the database exists\n * ```\n */\n async exists(): Promise<boolean> {\n try {\n await this.get();\n return true;\n } catch (err) {\n if (isArangoError(err) && err.errorNum === DATABASE_NOT_FOUND) {\n return false;\n }\n throw err;\n }\n }\n\n /**\n * Creates a new database with the given `databaseName` with the given\n * `options` and returns a `Database` instance for that database.\n *\n * @param databaseName - Name of the database to create.\n * @param options - Options for creating the database.\n *\n * @example\n * ```js\n * const db = new Database();\n * const info = await db.createDatabase(\"mydb\", {\n * users: [{ username: \"root\" }]\n * });\n * // the database has been created\n * db.useDatabase(\"mydb\");\n * db.useBasicAuth(\"root\", \"\");\n * ```\n */\n createDatabase(\n databaseName: string,\n options?: CreateDatabaseOptions\n ): Promise<Database>;\n /**\n * Creates a new database with the given `databaseName` with the given\n * `users` and returns a `Database` instance for that database.\n *\n * @param databaseName - Name of the database to create.\n * @param users - Database users to create with the database.\n *\n * @example\n * ```js\n * const db = new Database();\n * const info = await db.createDatabase(\"mydb\", [{ username: \"root\" }]);\n * // the database has been created\n * db.useDatabase(\"mydb\");\n * db.useBasicAuth(\"root\", \"\");\n * ```\n */\n createDatabase(\n databaseName: string,\n users: CreateDatabaseUser[]\n ): Promise<Database>;\n createDatabase(\n databaseName: string,\n usersOrOptions?: CreateDatabaseUser[] | CreateDatabaseOptions\n ): Promise<Database> {\n const { users, ...options } = Array.isArray(usersOrOptions)\n ? { users: usersOrOptions }\n : usersOrOptions || {};\n return this.request(\n {\n method: \"POST\",\n path: \"/_api/database\",\n body: { name: databaseName.normalize(\"NFC\"), users, options },\n },\n () => this.database(databaseName)\n );\n }\n\n /**\n * Fetches all databases from the server and returns an array of their names.\n *\n * See also {@link Database.databases} and\n * {@link Database.listUserDatabases}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const names = await db.listDatabases();\n * // databases is an array of database names\n * ```\n */\n listDatabases(): Promise<string[]> {\n return this.request({ path: \"/_api/database\" }, (res) => res.body.result);\n }\n\n /**\n * Fetches all databases accessible to the active user from the server and\n * returns an array of their names.\n *\n * See also {@link Database.userDatabases} and\n * {@link Database.listDatabases}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const names = await db.listUserDatabases();\n * // databases is an array of database names\n * ```\n */\n listUserDatabases(): Promise<string[]> {\n return this.request(\n { path: \"/_api/database/user\" },\n (res) => res.body.result\n );\n }\n\n /**\n * Fetches all databases from the server and returns an array of `Database`\n * instances for those databases.\n *\n * See also {@link Database.listDatabases} and\n * {@link Database.userDatabases}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const names = await db.databases();\n * // databases is an array of databases\n * ```\n */\n databases(): Promise<Database[]> {\n return this.request({ path: \"/_api/database\" }, (res) =>\n (res.body.result as string[]).map((databaseName) =>\n this.database(databaseName)\n )\n );\n }\n\n /**\n * Fetches all databases accessible to the active user from the server and\n * returns an array of `Database` instances for those databases.\n *\n * See also {@link Database.listUserDatabases} and\n * {@link Database.databases}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const names = await db.userDatabases();\n * // databases is an array of databases\n * ```\n */\n userDatabases(): Promise<Database[]> {\n return this.request({ path: \"/_api/database/user\" }, (res) =>\n (res.body.result as string[]).map((databaseName) =>\n this.database(databaseName)\n )\n );\n }\n\n /**\n * Deletes the database with the given `databaseName` from the server.\n *\n * @param databaseName - Name of the database to delete.\n *\n * @example\n * ```js\n * const db = new Database();\n * await db.dropDatabase(\"mydb\");\n * // database \"mydb\" no longer exists\n * ```\n */\n dropDatabase(databaseName: string): Promise<boolean> {\n databaseName = databaseName.normalize(\"NFC\");\n return this.request(\n {\n method: \"DELETE\",\n path: `/_api/database/${encodeURIComponent(databaseName)}`,\n },\n (res) => res.body.result\n );\n }\n //#endregion\n\n //#region collections\n /**\n * Returns a `Collection` instance for the given collection name.\n *\n * In TypeScript the collection implements both the\n * {@link DocumentCollection} and {@link EdgeCollection} interfaces and can\n * be cast to either type to enforce a stricter API.\n *\n * @param T - Type to use for document data. Defaults to `any`.\n * @param collectionName - Name of the edge collection.\n *\n * @example\n * ```js\n * const db = new Database();\n * const collection = db.collection(\"potatoes\");\n * ```\n *\n * @example\n * ```ts\n * interface Person {\n * name: string;\n * }\n * const db = new Database();\n * const persons = db.collection<Person>(\"persons\");\n * ```\n *\n * @example\n * ```ts\n * interface Person {\n * name: string;\n * }\n * interface Friend {\n * startDate: number;\n * endDate?: number;\n * }\n * const db = new Database();\n * const documents = db.collection(\"persons\") as DocumentCollection<Person>;\n * const edges = db.collection(\"friends\") as EdgeCollection<Friend>;\n * ```\n */\n collection<T extends Record<string, any> = any>(\n collectionName: string\n ): DocumentCollection<T> & EdgeCollection<T> {\n collectionName = collectionName.normalize(\"NFC\");\n if (!this._collections.has(collectionName)) {\n this._collections.set(\n collectionName,\n new Collection(this, collectionName)\n );\n }\n return this._collections.get(collectionName)!;\n }\n\n /**\n * Creates a new collection with the given `collectionName` and `options`,\n * then returns a {@link DocumentCollection} instance for the new collection.\n *\n * @param T - Type to use for document data. Defaults to `any`.\n * @param collectionName - Name of the new collection.\n * @param options - Options for creating the collection.\n *\n * @example\n * ```ts\n * const db = new Database();\n * const documents = db.createCollection(\"persons\");\n * ```\n *\n * @example\n * ```ts\n * interface Person {\n * name: string;\n * }\n * const db = new Database();\n * const documents = db.createCollection<Person>(\"persons\");\n * ```\n */\n async createCollection<T extends Record<string, any> = any>(\n collectionName: string,\n options?: CreateCollectionOptions & {\n type?: CollectionType.DOCUMENT_COLLECTION;\n }\n ): Promise<DocumentCollection<T>>;\n /**\n * Creates a new edge collection with the given `collectionName` and\n * `options`, then returns an {@link EdgeCollection} instance for the new\n * edge collection.\n *\n * @param T - Type to use for edge document data. Defaults to `any`.\n * @param collectionName - Name of the new collection.\n * @param options - Options for creating the collection.\n *\n * @example\n * ```js\n * const db = new Database();\n * const edges = db.createCollection(\"friends\", {\n * type: CollectionType.EDGE_COLLECTION\n * });\n * ```\n *\n * @example\n * ```ts\n * interface Friend {\n * startDate: number;\n * endDate?: number;\n * }\n * const db = new Database();\n * const edges = db.createCollection<Friend>(\"friends\", {\n * type: CollectionType.EDGE_COLLECTION\n * });\n * ```\n */\n async createCollection<T extends Record<string, any> = any>(\n collectionName: string,\n options: CreateCollectionOptions & {\n type: CollectionType.EDGE_COLLECTION;\n }\n ): Promise<EdgeCollection<T>>;\n async createCollection<T extends Record<string, any> = any>(\n collectionName: string,\n options?: CreateCollectionOptions & { type?: CollectionType }\n ): Promise<DocumentCollection<T> & EdgeCollection<T>> {\n const collection = this.collection(collectionName);\n await collection.create(options);\n return collection;\n }\n\n /**\n * Creates a new edge collection with the given `collectionName` and\n * `options`, then returns an {@link EdgeCollection} instance for the new\n * edge collection.\n *\n * This is a convenience method for calling {@link Database.createCollection}\n * with `options.type` set to `EDGE_COLLECTION`.\n *\n * @param T - Type to use for edge document data. Defaults to `any`.\n * @param collectionName - Name of the new collection.\n * @param options - Options for creating the collection.\n *\n * @example\n * ```js\n * const db = new Database();\n * const edges = db.createEdgeCollection(\"friends\");\n * ```\n *\n * @example\n * ```ts\n * interface Friend {\n * startDate: number;\n * endDate?: number;\n * }\n * const db = new Database();\n * const edges = db.createEdgeCollection<Friend>(\"friends\");\n * ```\n */\n async createEdgeCollection<T extends Record<string, any> = any>(\n collectionName: string,\n options?: CreateCollectionOptions\n ): Promise<EdgeCollection<T>> {\n return this.createCollection(collectionName, {\n ...options,\n type: CollectionType.EDGE_COLLECTION,\n });\n }\n\n /**\n * Renames the collection `collectionName` to `newName`.\n *\n * Additionally removes any stored `Collection` instance for\n * `collectionName` from the `Database` instance's internal cache.\n *\n * **Note**: Renaming collections may not be supported when ArangoDB is\n * running in a cluster configuration.\n *\n * @param collectionName - Current name of the collection.\n * @param newName - The new name of the collection.\n */\n async renameCollection(\n collectionName: string,\n newName: string\n ): Promise<ArangoResponseMetadata & CollectionMetadata> {\n collectionName = collectionName.normalize(\"NFC\");\n const result = await this.request(\n {\n method: \"PUT\",\n path: `/_api/collection/${encodeURIComponent(collectionName)}/rename`,\n body: { name: newName.normalize(\"NFC\") },\n },\n (res) => res.body\n );\n this._collections.delete(collectionName);\n return result;\n }\n\n /**\n * Fetches all collections from the database and returns an array of\n * collection descriptions.\n *\n * See also {@link Database.collections}.\n *\n * @param excludeSystem - Whether system collections should be excluded.\n *\n * @example\n * ```js\n * const db = new Database();\n * const collections = await db.listCollections();\n * // collections is an array of collection descriptions\n * // not including system collections\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * const collections = await db.listCollections(false);\n * // collections is an array of collection descriptions\n * // including system collections\n * ```\n */\n listCollections(\n excludeSystem: boolean = true\n ): Promise<CollectionMetadata[]> {\n return this.request(\n {\n path: \"/_api/collection\",\n qs: { excludeSystem },\n },\n (res) => res.body.result\n );\n }\n\n /**\n * Fetches all collections from the database and returns an array of\n * `Collection` instances.\n *\n * In TypeScript these instances implement both the\n * {@link DocumentCollection} and {@link EdgeCollection} interfaces and can\n * be cast to either type to enforce a stricter API.\n *\n * See also {@link Database.listCollections}.\n *\n * @param excludeSystem - Whether system collections should be excluded.\n *\n * @example\n * ```js\n * const db = new Database();\n * const collections = await db.collections();\n * // collections is an array of DocumentCollection\n * // and EdgeCollection instances\n * // not including system collections\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * const collections = await db.collections(false);\n * // collections is an array of DocumentCollection\n * // and EdgeCollection instances\n * // including system collections\n * ```\n */\n async collections(\n excludeSystem: boolean = true\n ): Promise<Array<DocumentCollection & EdgeCollection>> {\n const collections = await this.listCollections(excludeSystem);\n return collections.map((data) => this.collection(data.name));\n }\n //#endregion\n\n //#region graphs\n /**\n * Returns a {@link Graph} instance representing the graph with the given\n * `graphName`.\n *\n * @param graphName - Name of the graph.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graph = db.graph(\"some-graph\");\n * ```\n */\n graph(graphName: string): Graph {\n graphName = graphName.normalize(\"NFC\");\n if (!this._graphs.has(graphName)) {\n this._graphs.set(graphName, new Graph(this, graphName));\n }\n return this._graphs.get(graphName)!;\n }\n\n /**\n * Creates a graph with the given `graphName` and `edgeDefinitions`, then\n * returns a {@link Graph} instance for the new graph.\n *\n * @param graphName - Name of the graph to be created.\n * @param edgeDefinitions - An array of edge definitions.\n * @param options - An object defining the properties of the graph.\n */\n async createGraph(\n graphName: string,\n edgeDefinitions: EdgeDefinitionOptions[],\n options?: GraphCreateOptions\n ): Promise<Graph> {\n const graph = this.graph(graphName.normalize(\"NFC\"));\n await graph.create(edgeDefinitions, options);\n return graph;\n }\n\n /**\n * Fetches all graphs from the database and returns an array of graph\n * descriptions.\n *\n * See also {@link Database.graphs}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graphs = await db.listGraphs();\n * // graphs is an array of graph descriptions\n * ```\n */\n listGraphs(): Promise<GraphInfo[]> {\n return this.request({ path: \"/_api/gharial\" }, (res) => res.body.graphs);\n }\n\n /**\n * Fetches all graphs from the database and returns an array of {@link Graph}\n * instances for those graphs.\n *\n * See also {@link Database.listGraphs}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const graphs = await db.graphs();\n * // graphs is an array of Graph instances\n * ```\n */\n async graphs(): Promise<Graph[]> {\n const graphs = await this.listGraphs();\n return graphs.map((data: any) => this.graph(data._key));\n }\n //#endregion\n\n //#region views\n /**\n * Returns an {@link ArangoSearchView} instance for the given `viewName`.\n *\n * @param viewName - Name of the ArangoSearch View.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view = db.view(\"potatoes\");\n * ```\n */\n view(viewName: string): ArangoSearchView {\n viewName = viewName.normalize(\"NFC\");\n if (!this._views.has(viewName)) {\n this._views.set(viewName, new View(this, viewName));\n }\n return this._views.get(viewName)!;\n }\n\n /**\n * Creates a new ArangoSearch View with the given `viewName` and `options`\n * and returns an {@link ArangoSearchView} instance for the created View.\n *\n * @param viewName - Name of the ArangoSearch View.\n * @param options - An object defining the properties of the View.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view = await db.createView(\"potatoes\");\n * // the ArangoSearch View \"potatoes\" now exists\n * ```\n */\n async createView(\n viewName: string,\n options?: ArangoSearchViewPropertiesOptions\n ): Promise<ArangoSearchView> {\n const view = this.view(viewName.normalize(\"NFC\"));\n await view.create({ ...options, type: ViewType.ARANGOSEARCH_VIEW });\n return view;\n }\n\n /**\n * Renames the view `viewName` to `newName`.\n *\n * Additionally removes any stored {@link View} instance for `viewName` from\n * the `Database` instance's internal cache.\n *\n * **Note**: Renaming views may not be supported when ArangoDB is running in\n * a cluster configuration.\n *\n * @param viewName - Current name of the view.\n * @param newName - The new name of the view.\n */\n async renameView(\n viewName: string,\n newName: string\n ): Promise<ArangoResponseMetadata & ViewDescription> {\n viewName = viewName.normalize(\"NFC\");\n const result = await this.request(\n {\n method: \"PUT\",\n path: `/_api/view/${encodeURIComponent(viewName)}/rename`,\n body: { name: newName.normalize(\"NFC\") },\n },\n (res) => res.body\n );\n this._views.delete(viewName);\n return result;\n }\n\n /**\n * Fetches all Views from the database and returns an array of View\n * descriptions.\n *\n * See also {@link Database.views}.\n *\n * @example\n * ```js\n * const db = new Database();\n *\n * const views = await db.listViews();\n * // views is an array of View descriptions\n * ```\n */\n listViews(): Promise<ViewDescription[]> {\n return this.request({ path: \"/_api/view\" }, (res) => res.body.result);\n }\n\n /**\n * Fetches all Views from the database and returns an array of\n * {@link ArangoSearchView} instances for the Views.\n *\n * See also {@link Database.listViews}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const views = await db.views();\n * // views is an array of ArangoSearch View instances\n * ```\n */\n async views(): Promise<ArangoSearchView[]> {\n const views = await this.listViews();\n return views.map((data) => this.view(data.name));\n }\n //#endregion\n\n //#region analyzers\n /**\n * Returns an {@link Analyzer} instance representing the Analyzer with the\n * given `analyzerName`.\n *\n * @example\n * ```js\n * const db = new Database();\n * const analyzer = db.analyzer(\"some-analyzer\");\n * const info = await analyzer.get();\n * ```\n */\n analyzer(analyzerName: string): Analyzer {\n analyzerName = analyzerName.normalize(\"NFC\");\n if (!this._analyzers.has(analyzerName)) {\n this._analyzers.set(analyzerName, new Analyzer(this, analyzerName));\n }\n return this._analyzers.get(analyzerName)!;\n }\n\n /**\n * Creates a new Analyzer with the given `analyzerName` and `options`, then\n * returns an {@link Analyzer} instance for the new Analyzer.\n *\n * @param analyzerName - Name of the Analyzer.\n * @param options - An object defining the properties of the Analyzer.\n *\n * @example\n * ```js\n * const db = new Database();\n * const analyzer = await db.createAnalyzer(\"potatoes\", { type: \"identity\" });\n * // the identity Analyzer \"potatoes\" now exists\n * ```\n */\n async createAnalyzer(\n analyzerName: string,\n options: CreateAnalyzerOptions\n ): Promise<Analyzer> {\n const analyzer = this.analyzer(analyzerName);\n await analyzer.create(options);\n return analyzer;\n }\n\n /**\n * Fetches all Analyzers visible in the database and returns an array of\n * Analyzer descriptions.\n *\n * See also {@link Database.analyzers}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const analyzers = await db.listAnalyzers();\n * // analyzers is an array of Analyzer descriptions\n * ```\n */\n listAnalyzers(): Promise<AnalyzerDescription[]> {\n return this.request({ path: \"/_api/analyzer\" }, (res) => res.body.result);\n }\n\n /**\n * Fetches all Analyzers visible in the database and returns an array of\n * {@link Analyzer} instances for those Analyzers.\n *\n * See also {@link Database.listAnalyzers}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const analyzers = await db.analyzers();\n * // analyzers is an array of Analyzer instances\n * ```\n */\n async analyzers(): Promise<Analyzer[]> {\n const analyzers = await this.listAnalyzers();\n return analyzers.map((data) => this.analyzer(data.name));\n }\n //#endregion\n\n //#region users\n /**\n * Fetches all ArangoDB users visible to the authenticated user and returns\n * an array of user objects.\n *\n * @example\n * ```js\n * const db = new Database();\n * const users = await db.listUsers();\n * // users is an array of user objects\n * ```\n */\n listUsers(): Promise<ArangoUser[]> {\n return this.request({\n absolutePath: true,\n path: \"/_api/user\",\n });\n }\n\n /**\n * Fetches the user data of a single ArangoDB user.\n *\n * @param username - Name of the ArangoDB user to fetch.\n *\n * @example\n * ```js\n * const db = new Database();\n * const user = await db.getUser(\"steve\");\n * // user is the user object for the user named \"steve\"\n * ```\n */\n getUser(username: string): Promise<ArangoUser & ArangoResponseMetadata> {\n return this.request({\n absolutePath: true,\n path: `/_api/user/${encodeURIComponent(username)}`,\n });\n }\n\n /**\n * Creates a new ArangoDB user with the given password.\n *\n * @param username - Name of the ArangoDB user to create.\n * @param passwd - Password of the new ArangoDB user.\n *\n * @example\n * ```js\n * const db = new Database();\n * const user = await db.createUser(\"steve\", \"hunter2\");\n * // The user \"steve\" has been created\n * ```\n */\n createUser(\n username: string,\n passwd: string\n ): Promise<ArangoUser & ArangoResponseMetadata>;\n /**\n * Creates a new ArangoDB user with the given options.\n *\n * @param username - Name of the ArangoDB user to create.\n * @param options - Additional options for creating the ArangoDB user.\n *\n * @example\n * ```js\n * const db = new Database();\n * const user = await db.createUser(\"steve\", { passwd: \"hunter2\" });\n * // The user \"steve\" has been created\n * ```\n */\n createUser(\n username: string,\n options: UserOptions\n ): Promise<ArangoUser & ArangoResponseMetadata>;\n createUser(\n username: string,\n options: string | UserOptions\n ): Promise<ArangoUser & ArangoResponseMetadata> {\n if (typeof options === \"string\") {\n options = { passwd: options };\n }\n return this.request(\n {\n absolutePath: true,\n method: \"POST\",\n path: \"/_api/user\",\n body: { user: username, ...options },\n },\n (res) => res.body\n );\n }\n\n /**\n * Sets the password of a given ArangoDB user to the new value.\n *\n * @param username - Name of the ArangoDB user to change the password for.\n * @param passwd - New password for the ArangoDB user.\n *\n * @example\n * ```js\n * const db = new Database();\n * const user = await db.updateUser(\"steve\", \"hunter2\");\n * // The user \"steve\" has received a new password\n * ```\n */\n updateUser(\n username: string,\n passwd: string\n ): Promise<ArangoUser & ArangoResponseMetadata>;\n /**\n * Updates the ArangoDB user with the new options.\n *\n * @param username - Name of the ArangoDB user to modify.\n * @param options - Options of the ArangoDB user to modify.\n *\n * @example\n * ```js\n * const db = new Database();\n * const user = await db.updateUser(\"steve\", { active: false });\n * // The user \"steve\" has been set to inactive\n * ```\n */\n updateUser(\n username: string,\n options: Partial<UserOptions>\n ): Promise<ArangoUser & ArangoResponseMetadata>;\n updateUser(\n username: string,\n options: string | Partial<UserOptions>\n ): Promise<ArangoUser & ArangoResponseMetadata> {\n if (typeof options === \"string\") {\n options = { passwd: options };\n }\n return this.request(\n {\n absolutePath: true,\n method: \"PATCH\",\n path: `/api/user/${encodeURIComponent(username)}`,\n body: options,\n },\n (res) => res.body\n );\n }\n\n /**\n * Replaces the ArangoDB user's option with the new options.\n *\n * @param username - Name of the ArangoDB user to modify.\n * @param options - New options to replace the user's existing options.\n *\n * @example\n * ```js\n * const db = new Database();\n * const user = await db.replaceUser(\"steve\", { passwd: \"\", active: false });\n * // The user \"steve\" has been set to inactive with an empty password\n * ```\n */\n replaceUser(\n username: string,\n options: UserOptions\n ): Promise<ArangoUser & ArangoResponseMetadata> {\n if (typeof options === \"string\") {\n options = { passwd: options };\n }\n return this.request(\n {\n absolutePath: true,\n method: \"PUT\",\n path: `/api/user/${encodeURIComponent(username)}`,\n body: options,\n },\n (res) => res.body\n );\n }\n\n /**\n * Removes the ArangoDB user with the given username from the server.\n *\n * @param username - Name of the ArangoDB user to remove.\n *\n * @example\n * ```js\n * const db = new Database();\n * await db.removeUser(\"steve\");\n * // The user \"steve\" has been removed\n * ```\n */\n removeUser(username: string): Promise<ArangoResponseMetadata> {\n return this.request(\n {\n absolutePath: true,\n method: \"DELETE\",\n path: `/_api/user/${encodeURIComponent(username)}`,\n },\n (res) => res.body\n );\n }\n\n /**\n * Fetches the given ArangoDB user's access level for the database, or the\n * given collection in the given database.\n *\n * @param username - Name of the ArangoDB user to fetch the access level for.\n * @param database - Database to fetch the access level for.\n * @param collection - Collection to fetch the access level for.\n *\n * @example\n * ```js\n * const db = new Database();\n * const accessLevel = await db.getUserAccessLevel(\"steve\");\n * // The access level of the user \"steve\" has been fetched for the current\n * // database.\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * const accessLevel = await db.getUserAccessLevel(\"steve\", {\n * database: \"staging\"\n * });\n * // The access level of the user \"steve\" has been fetched for the \"staging\"\n * // database.\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * const accessLevel = await db.getUserAccessLevel(\"steve\", {\n * collection: \"pokemons\"\n * });\n * // The access level of the user \"steve\" has been fetched for the\n * // \"pokemons\" collection in the current database.\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * const accessLevel = await db.getUserAccessLevel(\"steve\", {\n * database: \"staging\",\n * collection: \"pokemons\"\n * });\n * // The access level of the user \"steve\" has been fetched for the\n * // \"pokemons\" collection in the \"staging\" database.\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * const staging = db.database(\"staging\");\n * const accessLevel = await db.getUserAccessLevel(\"steve\", {\n * database: staging\n * });\n * // The access level of the user \"steve\" has been fetched for the \"staging\"\n * // database.\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * const staging = db.database(\"staging\");\n * const accessLevel = await db.getUserAccessLevel(\"steve\", {\n * collection: staging.collection(\"pokemons\")\n * });\n * // The access level of the user \"steve\" has been fetched for the\n * // \"pokemons\" collection in database \"staging\".\n * ```\n */\n getUserAccessLevel(\n username: string,\n { database, collection }: UserAccessLevelOptions\n ): Promise<AccessLevel> {\n const databaseName = isArangoDatabase(database)\n ? database.name\n : database?.normalize(\"NFC\") ??\n (isArangoCollection(collection)\n ? ((collection as any)._db as Database).name\n : this._name);\n const suffix = collection\n ? `/${encodeURIComponent(\n isArangoCollection(collection)\n ? collection.name\n : collection.normalize(\"NFC\")\n )}`\n : \"\";\n return this.request(\n {\n absolutePath: true,\n path: `/_api/user/${encodeURIComponent(\n username\n )}/database/${encodeURIComponent(databaseName)}${suffix}`,\n },\n (res) => res.body\n );\n }\n\n /**\n * Sets the given ArangoDB user's access level for the database, or the\n * given collection in the given database.\n *\n * @param username - Name of the ArangoDB user to set the access level for.\n * @param database - Database to set the access level for.\n * @param collection - Collection to set the access level for.\n * @param grant - Access level to set for the given user.\n *\n * @example\n * ```js\n * const db = new Database();\n * await db.setUserAccessLevel(\"steve\", { grant: \"rw\" });\n * // The user \"steve\" now has read-write access to the current database.\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * await db.setUserAccessLevel(\"steve\", {\n * database: \"staging\",\n * grant: \"rw\"\n * });\n * // The user \"steve\" now has read-write access to the \"staging\" database.\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * await db.setUserAccessLevel(\"steve\", {\n * collection: \"pokemons\",\n * grant: \"rw\"\n * });\n * // The user \"steve\" now has read-write access to the \"pokemons\" collection\n * // in the current database.\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * await db.setUserAccessLevel(\"steve\", {\n * database: \"staging\",\n * collection: \"pokemons\",\n * grant: \"rw\"\n * });\n * // The user \"steve\" now has read-write access to the \"pokemons\" collection\n * // in the \"staging\" database.\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * const staging = db.database(\"staging\");\n * await db.setUserAccessLevel(\"steve\", {\n * database: staging,\n * grant: \"rw\"\n * });\n * // The user \"steve\" now has read-write access to the \"staging\" database.\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * const staging = db.database(\"staging\");\n * await db.setUserAccessLevel(\"steve\", {\n * collection: staging.collection(\"pokemons\"),\n * grant: \"rw\"\n * });\n * // The user \"steve\" now has read-write access to the \"pokemons\" collection\n * // in database \"staging\".\n * ```\n */\n setUserAccessLevel(\n username: string,\n {\n database,\n collection,\n grant,\n }: UserAccessLevelOptions & { grant: AccessLevel }\n ): Promise<Record<string, AccessLevel> & ArangoResponseMetadata> {\n const databaseName = isArangoDatabase(database)\n ? database.name\n : database?.normalize(\"NFC\") ??\n (isArangoCollection(collection)\n ? ((collection as any)._db as Database).name\n : this._name);\n const suffix = collection\n ? `/${encodeURIComponent(\n isArangoCollection(collection)\n ? collection.name\n : collection.normalize(\"NFC\")\n )}`\n : \"\";\n return this.request(\n {\n absolutePath: true,\n method: \"PUT\",\n path: `/_api/user/${encodeURIComponent(\n username\n )}/database/${encodeURIComponent(databaseName)}${suffix}`,\n body: { grant },\n },\n (res) => res.body\n );\n }\n\n /**\n * Clears the given ArangoDB user's access level for the database, or the\n * given collection in the given database.\n *\n * @param username - Name of the ArangoDB user to clear the access level for.\n * @param database - Database to clear the access level for.\n * @param collection - Collection to clear the access level for.\n *\n * @example\n * ```js\n * const db = new Database();\n * await db.clearUserAccessLevel(\"steve\");\n * // The access level of the user \"steve\" has been cleared for the current\n * // database.\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * await db.clearUserAccessLevel(\"steve\", { database: \"staging\" });\n * // The access level of the user \"steve\" has been cleared for the \"staging\"\n * // database.\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * await db.clearUserAccessLevel(\"steve\", { collection: \"pokemons\" });\n * // The access level of the user \"steve\" has been cleared for the\n * // \"pokemons\" collection in the current database.\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * await db.clearUserAccessLevel(\"steve\", {\n * database: \"staging\",\n * collection: \"pokemons\"\n * });\n * // The access level of the user \"steve\" has been cleared for the\n * // \"pokemons\" collection in the \"staging\" database.\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * const staging = db.database(\"staging\");\n * await db.clearUserAccessLevel(\"steve\", { database: staging });\n * // The access level of the user \"steve\" has been cleared for the \"staging\"\n * // database.\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * const staging = db.database(\"staging\");\n * await db.clearUserAccessLevel(\"steve\", {\n * collection: staging.collection(\"pokemons\")\n * });\n * // The access level of the user \"steve\" has been cleared for the\n * // \"pokemons\" collection in database \"staging\".\n * ```\n */\n clearUserAccessLevel(\n username: string,\n { database, collection }: UserAccessLevelOptions\n ): Promise<Record<string, AccessLevel> & ArangoResponseMetadata> {\n const databaseName = isArangoDatabase(database)\n ? database.name\n : database?.normalize(\"NFC\") ??\n (isArangoCollection(collection)\n ? ((collection as any)._db as Database).name\n : this._name);\n const suffix = collection\n ? `/${encodeURIComponent(\n isArangoCollection(collection)\n ? collection.name\n : collection.normalize(\"NFC\")\n )}`\n : \"\";\n return this.request(\n {\n absolutePath: true,\n method: \"DELETE\",\n path: `/_api/user/${encodeURIComponent(\n username\n )}/database/${encodeURIComponent(databaseName)}${suffix}`,\n },\n (res) => res.body\n );\n }\n\n /**\n * Fetches an object mapping names of databases to the access level of the\n * given ArangoDB user for those databases.\n *\n * @param username - Name of the ArangoDB user to fetch the access levels for.\n * @param full - Whether access levels for collections should be included.\n *\n * @example\n * ```js\n * const db = new Database();\n * const accessLevels = await db.getUserDatabases(\"steve\");\n * for (const [databaseName, accessLevel] of Object.entries(accessLevels)) {\n * console.log(`${databaseName}: ${accessLevel}`);\n * }\n * ```\n */\n getUserDatabases(\n username: string,\n full?: false\n ): Promise<Record<string, AccessLevel>>;\n /**\n * Fetches an object mapping names of databases to the access level of the\n * given ArangoDB user for those databases and the collections within each\n * database.\n *\n * @param username - Name of the ArangoDB user to fetch the access levels for.\n * @param full - Whether access levels for collections should be included.\n *\n * @example\n * ```js\n * const db = new Database();\n * const accessLevels = await db.getUserDatabases(\"steve\", true);\n * for (const [databaseName, obj] of Object.entries(accessLevels)) {\n * console.log(`${databaseName}: ${obj.permission}`);\n * for (const [collectionName, accessLevel] of Object.entries(obj.collections)) {\n * console.log(`${databaseName}/${collectionName}: ${accessLevel}`);\n * }\n * }\n * ```\n */\n getUserDatabases(\n username: string,\n full: true\n ): Promise<\n Record<\n string,\n {\n permission: AccessLevel;\n collections: Record<string, AccessLevel | \"undefined\">;\n }\n >\n >;\n getUserDatabases(\n username: string,\n full?: boolean\n ): Promise<Record<string, any>> {\n return this.request({\n absolutePath: true,\n path: `/_api/user/${encodeURIComponent(username)}/database`,\n qs: { full },\n });\n }\n //#endregion\n\n //#region transactions\n /**\n * Performs a server-side JavaScript transaction and returns its return\n * value.\n *\n * Collections can be specified as collection names (strings) or objects\n * implementing the {@link ArangoCollection} interface: `Collection`,\n * {@link GraphVertexCollection}, {@link GraphEdgeCollection} as well as\n * (in TypeScript) {@link DocumentCollection} and {@link EdgeCollection}.\n *\n * **Note**: The `action` function will be evaluated and executed on the\n * server inside ArangoDB's embedded JavaScript environment and can not\n * access any values other than those passed via the `params` option.\n *\n * See the official ArangoDB documentation for\n * {@link https://www.arangodb.com/docs/stable/appendix-java-script-modules-arango-db.html | the JavaScript `@arangodb` module}\n * for information about accessing the database from within ArangoDB's\n * server-side JavaScript environment.\n *\n * @param collections - Collections involved in the transaction.\n * @param action - A string evaluating to a JavaScript function to be\n * executed on the server.\n * @param options - Options for the transaction. If `options.allowImplicit`\n * is specified, it will be used if `collections.allowImplicit` was not\n * specified.\n *\n * @example\n * ```js\n * const db = new Database();\n *\n * const action = `\n * function(params) {\n * // This code will be executed inside ArangoDB!\n * const { query } = require(\"@arangodb\");\n * return query\\`\n * FOR user IN _users\n * FILTER user.age > ${params.age}\n * RETURN u.user\n * \\`.toArray();\n * }\n * `);\n *\n * const result = await db.executeTransaction({\n * read: [\"_users\"]\n * }, action, {\n * params: { age: 12 }\n * });\n * // result contains the return value of the action\n * ```\n */\n executeTransaction(\n collections: TransactionCollections & { allowImplicit?: boolean },\n action: string,\n options?: TransactionOptions & { params?: any }\n ): Promise<any>;\n /**\n * Performs a server-side transaction and returns its return value.\n *\n * Collections can be specified as collection names (strings) or objects\n * implementing the {@link ArangoCollection} interface: `Collection`,\n * {@link GraphVertexCollection}, {@link GraphEdgeCollection} as well as\n * (in TypeScript) {@link DocumentCollection} and {@link EdgeCollection}.\n *\n * **Note**: The `action` function will be evaluated and executed on the\n * server inside ArangoDB's embedded JavaScript environment and can not\n * access any values other than those passed via the `params` option.\n * See the official ArangoDB documentation for\n * {@link https://www.arangodb.com/docs/stable/appendix-java-script-modules-arango-db.html | the JavaScript `@arangodb` module}\n * for information about accessing the database from within ArangoDB's\n * server-side JavaScript environment.\n *\n * @param collections - Collections that can be read from and written to\n * during the transaction.\n * @param action - A string evaluating to a JavaScript function to be\n * executed on the server.\n * @param options - Options for the transaction.\n *\n * @example\n * ```js\n * const db = new Database();\n *\n * const action = `\n * function(params) {\n * // This code will be executed inside ArangoDB!\n * const { query } = require(\"@arangodb\");\n * return query\\`\n * FOR user IN _users\n * FILTER user.age > ${params.age}\n * RETURN u.user\n * \\`.toArray();\n * }\n * `);\n *\n * const result = await db.executeTransaction([\"_users\"], action, {\n * params: { age: 12 }\n * });\n * // result contains the return value of the action\n * ```\n */\n executeTransaction(\n collections: (string | ArangoCollection)[],\n action: string,\n options?: TransactionOptions & { params?: any }\n ): Promise<any>;\n /**\n * Performs a server-side transaction and returns its return value.\n *\n * The Collection can be specified as a collection name (string) or an object\n * implementing the {@link ArangoCollection} interface: `Collection`,\n * {@link GraphVertexCollection}, {@link GraphEdgeCollection} as well as\n * (in TypeScript) {@link DocumentCollection} and {@link EdgeCollection}.\n *\n * **Note**: The `action` function will be evaluated and executed on the\n * server inside ArangoDB's embedded JavaScript environment and can not\n * access any values other than those passed via the `params` option.\n * See the official ArangoDB documentation for\n * {@link https://www.arangodb.com/docs/stable/appendix-java-script-modules-arango-db.html | the JavaScript `@arangodb` module}\n * for information about accessing the database from within ArangoDB's\n * server-side JavaScript environment.\n *\n * @param collection - A collection that can be read from and written to\n * during the transaction.\n * @param action - A string evaluating to a JavaScript function to be\n * executed on the server.\n * @param options - Options for the transaction.\n *\n * @example\n * ```js\n * const db = new Database();\n *\n * const action = `\n * function(params) {\n * // This code will be executed inside ArangoDB!\n * const { query } = require(\"@arangodb\");\n * return query\\`\n * FOR user IN _users\n * FILTER user.age > ${params.age}\n * RETURN u.user\n * \\`.toArray();\n * }\n * `);\n *\n * const result = await db.executeTransaction(\"_users\", action, {\n * params: { age: 12 }\n * });\n * // result contains the return value of the action\n * ```\n */\n executeTransaction(\n collection: string | ArangoCollection,\n action: string,\n options?: TransactionOptions & { params?: any }\n ): Promise<any>;\n executeTransaction(\n collections:\n | (TransactionCollections & { allowImplicit?: boolean })\n | (string | ArangoCollection)[]\n | string\n | ArangoCollection,\n action: string,\n options?: TransactionOptions & { params?: any }\n ): Promise<any> {\n return this.request(\n {\n method: \"POST\",\n path: \"/_api/transaction\",\n body: {\n collections: coerceTransactionCollections(collections),\n action,\n ...options,\n },\n },\n (res) => res.body.result\n );\n }\n\n /**\n * Returns a {@link Transaction} instance for an existing streaming\n * transaction with the given `id`.\n *\n * See also {@link Database.beginTransaction}.\n *\n * @param id - The `id` of an existing stream transaction.\n *\n * @example\n * ```js\n * const trx1 = await db.beginTransaction(collections);\n * const id = trx1.id;\n * // later\n * const trx2 = db.transaction(id);\n * await trx2.commit();\n * ```\n */\n transaction(transactionId: string): Transaction {\n return new Transaction(this, transactionId);\n }\n\n /**\n * Begins a new streaming transaction for the given collections, then returns\n * a {@link Transaction} instance for the transaction.\n *\n * Collections can be specified as collection names (strings) or objects\n * implementing the {@link ArangoCollection} interface: `Collection`,\n * {@link GraphVertexCollection}, {@link GraphEdgeCollection} as well as\n * (in TypeScript) {@link DocumentCollection} and {@link EdgeCollection}.\n *\n * @param collections - Collections involved in the transaction.\n * @param options - Options for the transaction.\n *\n * @example\n * ```js\n * const vertices = db.collection(\"vertices\");\n * const edges = db.collection(\"edges\");\n * const trx = await db.beginTransaction({\n * read: [\"vertices\"],\n * write: [edges] // collection instances can be passed directly\n * });\n * const start = await trx.step(() => vertices.document(\"a\"));\n * const end = await trx.step(() => vertices.document(\"b\"));\n * await trx.step(() => edges.save({ _from: start._id, _to: end._id }));\n * await trx.commit();\n * ```\n */\n beginTransaction(\n collections: TransactionCollections,\n options?: TransactionOptions\n ): Promise<Transaction>;\n /**\n * Begins a new streaming transaction for the given collections, then returns\n * a {@link Transaction} instance for the transaction.\n *\n * Collections can be specified as collection names (strings) or objects\n * implementing the {@link ArangoCollection} interface: `Collection`,\n * {@link GraphVertexCollection}, {@link GraphEdgeCollection} as well as\n * (in TypeScript) {@link DocumentCollection} and {@link EdgeCollection}.\n *\n * @param collections - Collections that can be read from and written to\n * during the transaction.\n * @param options - Options for the transaction.\n *\n * @example\n * ```js\n * const vertices = db.collection(\"vertices\");\n * const edges = db.collection(\"edges\");\n * const trx = await db.beginTransaction([\n * \"vertices\",\n * edges // collection instances can be passed directly\n * ]);\n * const start = await trx.step(() => vertices.document(\"a\"));\n * const end = await trx.step(() => vertices.document(\"b\"));\n * await trx.step(() => edges.save({ _from: start._id, _to: end._id }));\n * await trx.commit();\n * ```\n */\n beginTransaction(\n collections: (string | ArangoCollection)[],\n options?: TransactionOptions\n ): Promise<Transaction>;\n /**\n * Begins a new streaming transaction for the given collections, then returns\n * a {@link Transaction} instance for the transaction.\n *\n * The Collection can be specified as a collection name (string) or an object\n * implementing the {@link ArangoCollection} interface: `Collection`,\n * {@link GraphVertexCollection}, {@link GraphEdgeCollection} as well as\n * (in TypeScript) {@link DocumentCollection} and {@link EdgeCollection}.\n *\n * @param collections - A collection that can be read from and written to\n * during the transaction.\n * @param options - Options for the transaction.\n *\n * @example\n * ```js\n * const vertices = db.collection(\"vertices\");\n * const start = vertices.document(\"a\");\n * const end = vertices.document(\"b\");\n * const edges = db.collection(\"edges\");\n * const trx = await db.beginTransaction(\n * edges // collection instances can be passed directly\n * );\n * await trx.step(() => edges.save({ _from: start._id, _to: end._id }));\n * await trx.commit();\n * ```\n */\n beginTransaction(\n collection: string | ArangoCollection,\n options?: TransactionOptions\n ): Promise<Transaction>;\n beginTransaction(\n collections:\n | TransactionCollections\n | (string | ArangoCollection)[]\n | string\n | ArangoCollection,\n options?: TransactionOptions\n ): Promise<Transaction> {\n return this.request(\n {\n method: \"POST\",\n path: \"/_api/transaction/begin\",\n body: {\n collections: coerceTransactionCollections(collections),\n ...options,\n },\n },\n (res) => new Transaction(this, res.body.result.id)\n );\n }\n\n /**\n * Fetches all active transactions from the database and returns an array of\n * transaction descriptions.\n *\n * See also {@link Database.transactions}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const transactions = await db.listTransactions();\n * // transactions is an array of transaction descriptions\n * ```\n */\n listTransactions(): Promise<TransactionDetails[]> {\n return this._connection.request(\n { path: \"/_api/transaction\" },\n (res) => res.body.transactions\n );\n }\n\n /**\n * Fetches all active transactions from the database and returns an array of\n * {@link Transaction} instances for those transactions.\n *\n * See also {@link Database.listTransactions}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const transactions = await db.transactions();\n * // transactions is an array of transactions\n * ```\n */\n async transactions(): Promise<Transaction[]> {\n const transactions = await this.listTransactions();\n return transactions.map((data) => this.transaction(data.id));\n }\n //#endregion\n\n //#region queries\n /**\n * Performs a database query using the given `query`, then returns a new\n * {@link ArrayCursor} instance for the result set.\n *\n * See the {@link aql} template string handler for information about how\n * to create a query string without manually defining bind parameters nor\n * having to worry about escaping variables.\n *\n * @param query - An object containing an AQL query string and bind\n * parameters, e.g. the object returned from an {@link aql} template string.\n * @param options - Options for the query execution.\n *\n * @example\n * ```js\n * const db = new Database();\n * const active = true;\n *\n * // Using an aql template string\n * const cursor = await db.query(aql`\n * FOR u IN _users\n * FILTER u.authData.active == ${active}\n * RETURN u.user\n * `);\n * // cursor is a cursor for the query result\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * const active = true;\n *\n * // Using an object with a regular multi-line string\n * const cursor = await db.query({\n * query: `\n * FOR u IN _users\n * FILTER u.authData.active == @active\n * RETURN u.user\n * `,\n * bindVars: { active: active }\n * });\n * ```\n */\n query(query: AqlQuery, options?: QueryOptions): Promise<ArrayCursor>;\n /**\n * Performs a database query using the given `query` and `bindVars`, then\n * returns a new {@link ArrayCursor} instance for the result set.\n *\n * See the {@link aql} template string handler for a safer and easier\n * alternative to passing strings directly.\n *\n * @param query - An AQL query string.\n * @param bindVars - An object defining bind parameters for the query.\n * @param options - Options for the query execution.\n *\n * @example\n * ```js\n * const db = new Database();\n * const active = true;\n *\n * const cursor = await db.query(\n * // A normal multi-line string\n * `\n * FOR u IN _users\n * FILTER u.authData.active == @active\n * RETURN u.user\n * `,\n * { active: active }\n * );\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * const active = true;\n *\n * const cursor = await db.query(\n * // An AQL literal created from a normal multi-line string\n * aql.literal(`\n * FOR u IN _users\n * FILTER u.authData.active == @active\n * RETURN u.user\n * `),\n * { active: active }\n * );\n * ```\n */\n query(\n query: string | AqlLiteral,\n bindVars?: Dict<any>,\n options?: QueryOptions\n ): Promise<ArrayCursor>;\n query(\n query: string | AqlQuery | AqlLiteral,\n bindVars?: Dict<any>,\n options?: QueryOptions\n ): Promise<ArrayCursor> {\n if (isAqlQuery(query)) {\n options = bindVars;\n bindVars = query.bindVars;\n query = query.query;\n } else if (isAqlLiteral(query)) {\n query = query.toAQL();\n }\n const {\n allowDirtyRead,\n retryOnConflict,\n count,\n batchSize,\n cache,\n memoryLimit,\n ttl,\n timeout,\n ...opts\n } = options || {};\n return this.request(\n {\n method: \"POST\",\n path: \"/_api/cursor\",\n body: {\n query,\n bindVars,\n count,\n batchSize,\n cache,\n memoryLimit,\n ttl,\n options: opts,\n },\n allowDirtyRead,\n retryOnConflict,\n timeout,\n },\n (res) =>\n new BatchedArrayCursor(\n this,\n res.body,\n res.arangojsHostId,\n allowDirtyRead\n ).items\n );\n }\n\n /**\n * Explains a database query using the given `query`.\n *\n * See the {@link aql} template string handler for information about how\n * to create a query string without manually defining bind parameters nor\n * having to worry about escaping variables.\n *\n * @param query - An object containing an AQL query string and bind\n * parameters, e.g. the object returned from an {@link aql} template string.\n * @param options - Options for explaining the query.\n *\n * @example\n * ```js\n * const db = new Database();\n * const collection = db.collection(\"some-collection\");\n * const explanation = await db.explain(aql`\n * FOR doc IN ${collection}\n * FILTER doc.flavor == \"strawberry\"\n * RETURN doc._key\n * `);\n * ```\n */\n explain(\n query: AqlQuery,\n options?: ExplainOptions & { allPlans?: false }\n ): Promise<ArangoResponseMetadata & SingleExplainResult>;\n /**\n * Explains a database query using the given `query`.\n *\n * See the {@link aql} template string handler for information about how\n * to create a query string without manually defining bind parameters nor\n * having to worry about escaping variables.\n *\n * @param query - An object containing an AQL query string and bind\n * parameters, e.g. the object returned from an {@link aql} template string.\n * @param options - Options for explaining the query.\n *\n * @example\n * ```js\n * const db = new Database();\n * const collection = db.collection(\"some-collection\");\n * const explanation = await db.explain(\n * aql`\n * FOR doc IN ${collection}\n * FILTER doc.flavor == \"strawberry\"\n * RETURN doc._key\n * `,\n * { allPlans: true }\n * );\n * ```\n */\n explain(\n query: AqlQuery,\n options?: ExplainOptions & { allPlans: true }\n ): Promise<ArangoResponseMetadata & MultiExplainResult>;\n /**\n * Explains a database query using the given `query` and `bindVars`.\n *\n * See the {@link aql} template string handler for a safer and easier\n * alternative to passing strings directly.\n *\n * @param query - An AQL query string.\n * @param bindVars - An object defining bind parameters for the query.\n * @param options - Options for explaining the query.\n *\n * @example\n * ```js\n * const db = new Database();\n * const collection = db.collection(\"some-collection\");\n * const explanation = await db.explain(\n * `\n * FOR doc IN @@collection\n * FILTER doc.flavor == \"strawberry\"\n * RETURN doc._key\n * `,\n * { \"@collection\": collection.name }\n * );\n * ```\n */\n explain(\n query: string | AqlLiteral,\n bindVars?: Dict<any>,\n options?: ExplainOptions & { allPlans?: false }\n ): Promise<ArangoResponseMetadata & SingleExplainResult>;\n /**\n * Explains a database query using the given `query` and `bindVars`.\n *\n * See the {@link aql} template string handler for a safer and easier\n * alternative to passing strings directly.\n *\n * @param query - An AQL query string.\n * @param bindVars - An object defining bind parameters for the query.\n * @param options - Options for explaining the query.\n *\n * @example\n * ```js\n * const db = new Database();\n * const collection = db.collection(\"some-collection\");\n * const explanation = await db.explain(\n * `\n * FOR doc IN @@collection\n * FILTER doc.flavor == \"strawberry\"\n * RETURN doc._key\n * `,\n * { \"@collection\": collection.name },\n * { allPlans: true }\n * );\n * ```\n */\n explain(\n query: string | AqlLiteral,\n bindVars?: Dict<any>,\n options?: ExplainOptions & { allPlans: true }\n ): Promise<ArangoResponseMetadata & MultiExplainResult>;\n explain(\n query: string | AqlQuery | AqlLiteral,\n bindVars?: Dict<any>,\n options?: ExplainOptions\n ): Promise<\n ArangoResponseMetadata & (SingleExplainResult | MultiExplainResult)\n > {\n if (isAqlQuery(query)) {\n options = bindVars;\n bindVars = query.bindVars;\n query = query.query;\n } else if (isAqlLiteral(query)) {\n query = query.toAQL();\n }\n return this.request(\n {\n method: \"POST\",\n path: \"/_api/explain\",\n body: { query, bindVars, options },\n },\n (res) => res.body\n );\n }\n\n /**\n * Parses the given query and returns the result.\n *\n * See the {@link aql} template string handler for information about how\n * to create a query string without manually defining bind parameters nor\n * having to worry about escaping variables.\n *\n * @param query - An AQL query string or an object containing an AQL query\n * string and bind parameters, e.g. the object returned from an {@link aql}\n * template string.\n *\n * @example\n * ```js\n * const db = new Database();\n * const collection = db.collection(\"some-collection\");\n * const ast = await db.parse(aql`\n * FOR doc IN ${collection}\n * FILTER doc.flavor == \"strawberry\"\n * RETURN doc._key\n * `);\n * ```\n */\n parse(query: string | AqlQuery | AqlLiteral): Promise<ParseResult> {\n if (isAqlQuery(query)) {\n query = query.query;\n } else if (isAqlLiteral(query)) {\n query = query.toAQL();\n }\n return this.request(\n {\n method: \"POST\",\n path: \"/_api/query\",\n body: { query },\n },\n (res) => res.body\n );\n }\n\n /**\n * Fetches the query tracking properties.\n *\n * @example\n * ```js\n * const db = new Database();\n * const tracking = await db.queryTracking();\n * console.log(tracking.enabled);\n * ```\n */\n queryTracking(): Promise<QueryTracking>;\n /**\n * Modifies the query tracking properties.\n *\n * @param options - Options for query tracking.\n *\n * @example\n * ```js\n * const db = new Database();\n * // track up to 5 slow queries exceeding 5 seconds execution time\n * await db.setQueryTracking({\n * enabled: true,\n * trackSlowQueries: true,\n * maxSlowQueries: 5,\n * slowQueryThreshold: 5\n * });\n * ```\n */\n queryTracking(options: QueryTrackingOptions): Promise<QueryTracking>;\n queryTracking(options?: QueryTrackingOptions): Promise<QueryTracking> {\n return this.request(\n options\n ? {\n method: \"PUT\",\n path: \"/_api/query/properties\",\n body: options,\n }\n : {\n method: \"GET\",\n path: \"/_api/query/properties\",\n },\n (res) => res.body\n );\n }\n\n /**\n * Fetches a list of information for all currently running queries.\n *\n * See also {@link Database.listSlowQueries} and {@link Database.killQuery}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const queries = await db.listRunningQueries();\n * ```\n */\n listRunningQueries(): Promise<QueryInfo[]> {\n return this.request(\n {\n method: \"GET\",\n path: \"/_api/query/current\",\n },\n (res) => res.body\n );\n }\n\n /**\n * Fetches a list of information for all recent slow queries.\n *\n * See also {@link Database.listRunningQueries} and\n * {@link Database.clearSlowQueries}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const queries = await db.listSlowQueries();\n * // Only works if slow query tracking is enabled\n * ```\n */\n listSlowQueries(): Promise<QueryInfo[]> {\n return this.request(\n {\n method: \"GET\",\n path: \"/_api/query/slow\",\n },\n (res) => res.body\n );\n }\n\n /**\n * Clears the list of recent slow queries.\n *\n * See also {@link Database.listSlowQueries}.\n *\n * @example\n * ```js\n * const db = new Database();\n * await db.clearSlowQueries();\n * // Slow query list is now cleared\n * ```\n */\n clearSlowQueries(): Promise<void> {\n return this.request(\n {\n method: \"DELETE\",\n path: \"/_api/query/slow\",\n },\n () => undefined\n );\n }\n\n /**\n * Kills a running query with the given `queryId`.\n *\n * See also {@link Database.listRunningQueries}.\n *\n * @param queryId - The ID of a currently running query.\n *\n * @example\n * ```js\n * const db = new Database();\n * const queries = await db.listRunningQueries();\n * await Promise.all(queries.map(\n * async (query) => {\n * if (query.state === \"executing\") {\n * await db.killQuery(query.id);\n * }\n * }\n * ));\n * ```\n */\n killQuery(queryId: string): Promise<void> {\n return this.request(\n {\n method: \"DELETE\",\n path: `/_api/query/${encodeURIComponent(queryId)}`,\n },\n () => undefined\n );\n }\n //#endregion\n\n //#region functions\n /**\n * Fetches a list of all AQL user functions registered with the database.\n *\n * @example\n * ```js\n * const db = new Database();\n * const functions = await db.listFunctions();\n * const names = functions.map(fn => fn.name);\n * ```\n */\n listFunctions(): Promise<AqlUserFunction[]> {\n return this.request(\n { path: \"/_api/aqlfunction\" },\n (res) => res.body.result\n );\n }\n\n /**\n * Creates an AQL user function with the given _name_ and _code_ if it does\n * not already exist or replaces it if a function with the same name already\n * existed.\n *\n * @param name - A valid AQL function name. The function name must consist\n * of at least two alphanumeric identifiers separated with double colons.\n * @param code - A string evaluating to a JavaScript function (not a\n * JavaScript function object).\n * @param isDeterministic - If set to `true`, the function is expected to\n * always return the same result for equivalent inputs. This option currently\n * has no effect but may allow for optimizations in the future.\n *\n * @example\n * ```js\n * const db = new Database();\n * await db.createFunction(\n * \"ACME::ACCOUNTING::CALCULATE_VAT\",\n * \"(price) => price * 0.19\"\n * );\n * // Use the new function in an AQL query with template handler:\n * const cursor = await db.query(aql`\n * FOR product IN products\n * RETURN MERGE(\n * { vat: ACME::ACCOUNTING::CALCULATE_VAT(product.price) },\n * product\n * )\n * `);\n * // cursor is a cursor for the query result\n * ```\n */\n createFunction(\n name: string,\n code: string,\n isDeterministic: boolean = false\n ): Promise<ArangoResponseMetadata & { isNewlyCreated: boolean }> {\n return this.request(\n {\n method: \"POST\",\n path: \"/_api/aqlfunction\",\n body: { name, code, isDeterministic },\n },\n (res) => res.body\n );\n }\n\n /**\n * Deletes the AQL user function with the given name from the database.\n *\n * @param name - The name of the user function to drop.\n * @param group - If set to `true`, all functions with a name starting with\n * `name` will be deleted, otherwise only the function with the exact name\n * will be deleted.\n *\n * @example\n * ```js\n * const db = new Database();\n * await db.dropFunction(\"ACME::ACCOUNTING::CALCULATE_VAT\");\n * // the function no longer exists\n * ```\n */\n dropFunction(\n name: string,\n group: boolean = false\n ): Promise<ArangoResponseMetadata & { deletedCount: number }> {\n return this.request(\n {\n method: \"DELETE\",\n path: `/_api/aqlfunction/${encodeURIComponent(name)}`,\n qs: { group },\n },\n (res) => res.body\n );\n }\n //#endregion\n\n //#region services\n /**\n * Fetches a list of all installed service.\n *\n * @param excludeSystem - Whether system services should be excluded.\n *\n * @example\n * ```js\n * const db = new Database();\n * const services = await db.listServices();\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * const services = await db.listServices(false); // all services\n * ```\n */\n listServices(excludeSystem: boolean = true): Promise<ServiceSummary[]> {\n return this.request(\n {\n path: \"/_api/foxx\",\n qs: { excludeSystem },\n },\n (res) => res.body\n );\n }\n\n /**\n * Installs a new service.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param source - The service bundle to install.\n * @param options - Options for installing the service.\n *\n * @example\n * ```js\n * const db = new Database();\n * // Using a node.js file stream as source\n * const source = fs.createReadStream(\"./my-foxx-service.zip\");\n * const info = await db.installService(\"/hello\", source);\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * // Using a node.js Buffer as source\n * const source = fs.readFileSync(\"./my-foxx-service.zip\");\n * const info = await db.installService(\"/hello\", source);\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * // Using a File (Blob) from a browser file input\n * const element = document.getElementById(\"my-file-input\");\n * const source = element.files[0];\n * const info = await db.installService(\"/hello\", source);\n * ```\n */\n async installService(\n mount: string,\n source: Readable | Buffer | Blob | string,\n options: InstallServiceOptions = {}\n ): Promise<ServiceInfo> {\n const { configuration, dependencies, ...qs } = options;\n const req = await toForm({\n configuration,\n dependencies,\n source,\n });\n return await this.request(\n {\n ...req,\n method: \"POST\",\n path: \"/_api/foxx\",\n isBinary: true,\n qs: { ...qs, mount },\n },\n (res) => res.body\n );\n }\n\n /**\n * Replaces an existing service with a new service by completely removing the\n * old service and installing a new service at the same mount point.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param source - The service bundle to install.\n * @param options - Options for replacing the service.\n *\n * @example\n * ```js\n * const db = new Database();\n * // Using a node.js file stream as source\n * const source = fs.createReadStream(\"./my-foxx-service.zip\");\n * const info = await db.replaceService(\"/hello\", source);\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * // Using a node.js Buffer as source\n * const source = fs.readFileSync(\"./my-foxx-service.zip\");\n * const info = await db.replaceService(\"/hello\", source);\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * // Using a File (Blob) from a browser file input\n * const element = document.getElementById(\"my-file-input\");\n * const source = element.files[0];\n * const info = await db.replaceService(\"/hello\", source);\n * ```\n */\n async replaceService(\n mount: string,\n source: Readable | Buffer | Blob | string,\n options: ReplaceServiceOptions = {}\n ): Promise<ServiceInfo> {\n const { configuration, dependencies, ...qs } = options;\n const req = await toForm({\n configuration,\n dependencies,\n source,\n });\n return await this.request(\n {\n ...req,\n method: \"PUT\",\n path: \"/_api/foxx/service\",\n isBinary: true,\n qs: { ...qs, mount },\n },\n (res) => res.body\n );\n }\n\n /**\n * Replaces an existing service with a new service while retaining the old\n * service's configuration and dependencies.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param source - The service bundle to install.\n * @param options - Options for upgrading the service.\n *\n * @example\n * ```js\n * const db = new Database();\n * // Using a node.js file stream as source\n * const source = fs.createReadStream(\"./my-foxx-service.zip\");\n * const info = await db.upgradeService(\"/hello\", source);\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * // Using a node.js Buffer as source\n * const source = fs.readFileSync(\"./my-foxx-service.zip\");\n * const info = await db.upgradeService(\"/hello\", source);\n * ```\n *\n * @example\n * ```js\n * const db = new Database();\n * // Using a File (Blob) from a browser file input\n * const element = document.getElementById(\"my-file-input\");\n * const source = element.files[0];\n * const info = await db.upgradeService(\"/hello\", source);\n * ```\n */\n async upgradeService(\n mount: string,\n source: Readable | Buffer | Blob | string,\n options: UpgradeServiceOptions = {}\n ): Promise<ServiceInfo> {\n const { configuration, dependencies, ...qs } = options;\n const req = await toForm({\n configuration,\n dependencies,\n source,\n });\n return await this.request(\n {\n ...req,\n method: \"PATCH\",\n path: \"/_api/foxx/service\",\n isBinary: true,\n qs: { ...qs, mount },\n },\n (res) => res.body\n );\n }\n\n /**\n * Completely removes a service from the database.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param options - Options for uninstalling the service.\n *\n * @example\n * ```js\n * const db = new Database();\n * await db.uninstallService(\"/my-foxx\");\n * ```\n */\n uninstallService(\n mount: string,\n options?: UninstallServiceOptions\n ): Promise<void> {\n return this.request(\n {\n method: \"DELETE\",\n path: \"/_api/foxx/service\",\n qs: { ...options, mount },\n },\n () => undefined\n );\n }\n\n /**\n * Retrieves information about a mounted service.\n *\n * @param mount - The service's mount point, relative to the database.\n *\n * @example\n * ```js\n * const db = new Database();\n * const info = await db.getService(\"/my-service\");\n * // info contains detailed information about the service\n * ```\n */\n getService(mount: string): Promise<ServiceInfo> {\n return this.request(\n {\n path: \"/_api/foxx/service\",\n qs: { mount },\n },\n (res) => res.body\n );\n }\n\n /**\n * Retrieves information about the service's configuration options and their\n * current values.\n *\n * See also {@link Database.replaceServiceConfiguration} and\n * {@link Database.updateServiceConfiguration}.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param minimal - If set to `true`, the result will only include each\n * configuration option's current value. Otherwise it will include the full\n * definition for each option.\n *\n * @example\n * ```js\n * const db = new Database();\n * const config = await db.getServiceConfiguration(\"/my-service\");\n * for (const [key, option] of Object.entries(config)) {\n * console.log(`${option.title} (${key}): ${option.current}`);\n * }\n * ```\n */\n async getServiceConfiguration(\n mount: string,\n minimal?: false\n ): Promise<Dict<ServiceConfiguration>>;\n /**\n * Retrieves information about the service's configuration options and their\n * current values.\n *\n * See also {@link Database.replaceServiceConfiguration} and\n * {@link Database.updateServiceConfiguration}.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param minimal - If set to `true`, the result will only include each\n * configuration option's current value. Otherwise it will include the full\n * definition for each option.\n *\n * @example\n * ```js\n * const db = new Database();\n * const config = await db.getServiceConfiguration(\"/my-service\", true);\n * for (const [key, value] of Object.entries(config)) {\n * console.log(`${key}: ${value}`);\n * }\n * ```\n */\n async getServiceConfiguration(\n mount: string,\n minimal: true\n ): Promise<Dict<any>>;\n async getServiceConfiguration(mount: string, minimal: boolean = false) {\n const result = await this.request(\n {\n path: \"/_api/foxx/configuration\",\n qs: { mount, minimal },\n },\n (res) => res.body\n );\n if (\n !minimal ||\n !Object.keys(result).every((key: string) => result[key].title)\n ) {\n return result;\n }\n const values: any = {};\n for (const key of Object.keys(result)) {\n values[key] = result[key].current;\n }\n return values;\n }\n\n /**\n * Replaces the configuration of the given service, discarding any existing\n * values for options not specified.\n *\n * See also {@link Database.updateServiceConfiguration} and\n * {@link Database.getServiceConfiguration}.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param cfg - An object mapping configuration option names to values.\n * @param minimal - If set to `true`, the result will only include each\n * configuration option's current value and warning (if any).\n * Otherwise it will include the full definition for each option.\n *\n * **Note**: When using ArangoDB 3.2.8 or older, setting the `minimal` option\n * to `true` avoids triggering a second request to fetch the full\n * configuration definitions.\n *\n * @example\n * ```js\n * const db = new Database();\n * const config = { currency: \"USD\", locale: \"en-US\" };\n * const info = await db.replaceServiceConfiguration(\"/my-service\", config);\n * for (const [key, option] of Object.entries(info)) {\n * console.log(`${option.title} (${key}): ${option.value}`);\n * if (option.warning) console.warn(`Warning: ${option.warning}`);\n * }\n * ```\n */\n async replaceServiceConfiguration(\n mount: string,\n cfg: Dict<any>,\n minimal?: false\n ): Promise<Dict<ServiceConfiguration & { warning?: string }>>;\n /**\n * Replaces the configuration of the given service, discarding any existing\n * values for options not specified.\n *\n * See also {@link Database.updateServiceConfiguration} and\n * {@link Database.getServiceConfiguration}.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param cfg - An object mapping configuration option names to values.\n * @param minimal - If set to `true`, the result will only include each\n * configuration option's current value and warning (if any).\n * Otherwise it will include the full definition for each option.\n *\n * **Note**: When using ArangoDB 3.2.8 or older, setting the `minimal` option\n * to `true` avoids triggering a second request to fetch the full\n * configuration definitions.\n *\n * @example\n * ```js\n * const db = new Database();\n * const config = { currency: \"USD\", locale: \"en-US\" };\n * const info = await db.replaceServiceConfiguration(\"/my-service\", config);\n * for (const [key, value] of Object.entries(info.values)) {\n * console.log(`${key}: ${value}`);\n * if (info.warnings[key]) console.warn(`Warning: ${info.warnings[key]}`);\n * }\n * ```\n */\n async replaceServiceConfiguration(\n mount: string,\n cfg: Dict<any>,\n minimal: true\n ): Promise<{\n values: Dict<any>;\n warnings: Dict<string | undefined>;\n }>;\n async replaceServiceConfiguration(\n mount: string,\n cfg: Dict<any>,\n minimal: boolean = false\n ) {\n const result = await this.request(\n {\n method: \"PUT\",\n path: \"/_api/foxx/configuration\",\n body: cfg,\n qs: { mount, minimal },\n },\n (res) => res.body\n );\n if (\n minimal ||\n !result.values ||\n !Object.keys(result.values).every(\n (key: string) => result.values[key].title\n )\n ) {\n return result;\n }\n const result2 = (await this.getServiceConfiguration(mount, false)) as Dict<\n ServiceConfiguration & { warning?: string }\n >;\n if (result.warnings) {\n for (const key of Object.keys(result2)) {\n result2[key].warning = result.warnings[key];\n }\n }\n return result2;\n }\n\n /**\n * Updates the configuration of the given service while maintaining any\n * existing values for options not specified.\n *\n * See also {@link Database.replaceServiceConfiguration} and\n * {@link Database.getServiceConfiguration}.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param cfg - An object mapping configuration option names to values.\n * @param minimal - If set to `true`, the result will only include each\n * configuration option's current value and warning (if any).\n * Otherwise it will include the full definition for each option.\n *\n * **Note**: When using ArangoDB 3.2.8 or older, setting the `minimal` option\n * to `true` avoids triggering a second request to fetch the full\n * configuration definitions.\n *\n * @example\n * ```js\n * const db = new Database();\n * const config = { currency: \"USD\", locale: \"en-US\" };\n * const info = await db.updateServiceConfiguration(\"/my-service\", config);\n * for (const [key, option] of Object.entries(info)) {\n * console.log(`${option.title} (${key}): ${option.value}`);\n * if (option.warning) console.warn(`Warning: ${option.warning}`);\n * }\n * ```\n */\n async updateServiceConfiguration(\n mount: string,\n cfg: Dict<any>,\n minimal?: false\n ): Promise<Dict<ServiceConfiguration & { warning?: string }>>;\n /**\n * Updates the configuration of the given service while maintaining any\n * existing values for options not specified.\n *\n * See also {@link Database.replaceServiceConfiguration} and\n * {@link Database.getServiceConfiguration}.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param cfg - An object mapping configuration option names to values.\n * @param minimal - If set to `true`, the result will only include each\n * configuration option's current value and warning (if any).\n * Otherwise it will include the full definition for each option.\n *\n * **Note**: When using ArangoDB 3.2.8 or older, setting the `minimal` option\n * to `true` avoids triggering a second request to fetch the full\n * configuration definitions.\n *\n * @example\n * ```js\n * const db = new Database();\n * const config = { currency: \"USD\", locale: \"en-US\" };\n * const info = await db.updateServiceConfiguration(\"/my-service\", config);\n * for (const [key, value] of Object.entries(info.values)) {\n * console.log(`${key}: ${value}`);\n * if (info.warnings[key]) console.warn(`Warning: ${info.warnings[key]}`);\n * }\n * ```\n */\n async updateServiceConfiguration(\n mount: string,\n cfg: Dict<any>,\n minimal: true\n ): Promise<{\n values: Dict<any>;\n warnings: Dict<string | undefined>;\n }>;\n async updateServiceConfiguration(\n mount: string,\n cfg: Dict<any>,\n minimal: boolean = false\n ) {\n const result = await this.request(\n {\n method: \"PATCH\",\n path: \"/_api/foxx/configuration\",\n body: cfg,\n qs: { mount, minimal },\n },\n (res) => res.body\n );\n if (\n minimal ||\n !result.values ||\n !Object.keys(result.values).every(\n (key: string) => result.values[key].title\n )\n ) {\n return result;\n }\n const result2 = (await this.getServiceConfiguration(mount, false)) as Dict<\n ServiceConfiguration & { warning?: string }\n >;\n if (result.warnings) {\n for (const key of Object.keys(result2)) {\n result2[key].warning = result.warnings[key];\n }\n }\n return result2;\n }\n\n /**\n * Retrieves information about the service's dependencies and their current\n * mount points.\n *\n * See also {@link Database.replaceServiceDependencies} and\n * {@link Database.updateServiceDependencies}.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param minimal - If set to `true`, the result will only include each\n * dependency's current mount point. Otherwise it will include the full\n * definition for each dependency.\n *\n * @example\n * ```js\n * const db = new Database();\n * const deps = await db.getServiceDependencies(\"/my-service\");\n * for (const [key, dep] of Object.entries(deps)) {\n * console.log(`${dep.title} (${key}): ${dep.current}`);\n * }\n * ```\n */\n async getServiceDependencies(\n mount: string,\n minimal?: false\n ): Promise<Dict<SingleServiceDependency | MultiServiceDependency>>;\n /**\n * Retrieves information about the service's dependencies and their current\n * mount points.\n *\n * See also {@link Database.replaceServiceDependencies} and\n * {@link Database.updateServiceDependencies}.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param minimal - If set to `true`, the result will only include each\n * dependency's current mount point. Otherwise it will include the full\n * definition for each dependency.\n *\n * @example\n * ```js\n * const db = new Database();\n * const deps = await db.getServiceDependencies(\"/my-service\", true);\n * for (const [key, value] of Object.entries(deps)) {\n * console.log(`${key}: ${value}`);\n * }\n * ```\n */\n async getServiceDependencies(\n mount: string,\n minimal: true\n ): Promise<Dict<string | string[] | undefined>>;\n async getServiceDependencies(mount: string, minimal: boolean = false) {\n const result = await this.request(\n {\n path: \"/_api/foxx/dependencies\",\n qs: { mount, minimal },\n },\n (res) => res.body\n );\n if (\n !minimal ||\n !Object.keys(result).every((key: string) => result[key].title)\n )\n return result;\n const values: any = {};\n for (const key of Object.keys(result)) {\n values[key] = result[key].current;\n }\n return values;\n }\n\n /**\n * Replaces the dependencies of the given service, discarding any existing\n * mount points for dependencies not specified.\n *\n * See also {@link Database.updateServiceDependencies} and\n * {@link Database.getServiceDependencies}.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param cfg - An object mapping dependency aliases to mount points.\n * @param minimal - If set to `true`, the result will only include each\n * dependency's current mount point. Otherwise it will include the full\n * definition for each dependency.\n *\n * **Note**: When using ArangoDB 3.2.8 or older, setting the `minimal` option\n * to `true` avoids triggering a second request to fetch the full\n * dependency definitions.\n *\n * @example\n * ```js\n * const db = new Database();\n * const deps = { mailer: \"/mailer-api\", auth: \"/remote-auth\" };\n * const info = await db.replaceServiceDependencies(\"/my-service\", deps);\n * for (const [key, dep] of Object.entries(info)) {\n * console.log(`${dep.title} (${key}): ${dep.current}`);\n * if (dep.warning) console.warn(`Warning: ${dep.warning}`);\n * }\n * ```\n */\n async replaceServiceDependencies(\n mount: string,\n deps: Dict<string>,\n minimal?: false\n ): Promise<\n Dict<\n (SingleServiceDependency | MultiServiceDependency) & { warning?: string }\n >\n >;\n /**\n * Replaces the dependencies of the given service, discarding any existing\n * mount points for dependencies not specified.\n *\n * See also {@link Database.updateServiceDependencies} and\n * {@link Database.getServiceDependencies}.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param cfg - An object mapping dependency aliases to mount points.\n * @param minimal - If set to `true`, the result will only include each\n * dependency's current mount point. Otherwise it will include the full\n * definition for each dependency.\n *\n * **Note**: When using ArangoDB 3.2.8 or older, setting the `minimal` option\n * to `true` avoids triggering a second request to fetch the full\n * dependency definitions.\n *\n * @example\n * ```js\n * const db = new Database();\n * const deps = { mailer: \"/mailer-api\", auth: \"/remote-auth\" };\n * const info = await db.replaceServiceDependencies(\n * \"/my-service\",\n * deps,\n * true\n * );\n * for (const [key, value] of Object.entries(info)) {\n * console.log(`${key}: ${value}`);\n * if (info.warnings[key]) console.warn(`Warning: ${info.warnings[key]}`);\n * }\n * ```\n */\n async replaceServiceDependencies(\n mount: string,\n deps: Dict<string>,\n minimal: true\n ): Promise<{\n values: Dict<string>;\n warnings: Dict<string | undefined>;\n }>;\n async replaceServiceDependencies(\n mount: string,\n deps: Dict<string>,\n minimal: boolean = false\n ) {\n const result = await this.request(\n {\n method: \"PUT\",\n path: \"/_api/foxx/dependencies\",\n body: deps,\n qs: { mount, minimal },\n },\n (res) => res.body\n );\n if (\n minimal ||\n !result.values ||\n !Object.keys(result.values).every(\n (key: string) => result.values[key].title\n )\n ) {\n return result;\n }\n // Work around \"minimal\" flag not existing in 3.3\n const result2 = (await this.getServiceDependencies(mount, false)) as Dict<\n (SingleServiceDependency | MultiServiceDependency) & { warning?: string }\n >;\n if (result.warnings) {\n for (const key of Object.keys(result2)) {\n (result2[key] as any).warning = result.warnings[key];\n }\n }\n return result2;\n }\n\n /**\n * Updates the dependencies of the given service while maintaining any\n * existing mount points for dependencies not specified.\n *\n * See also {@link Database.replaceServiceDependencies} and\n * {@link Database.getServiceDependencies}.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param cfg - An object mapping dependency aliases to mount points.\n * @param minimal - If set to `true`, the result will only include each\n * dependency's current mount point. Otherwise it will include the full\n * definition for each dependency.\n *\n * **Note**: When using ArangoDB 3.2.8 or older, setting the `minimal` option\n * to `true` avoids triggering a second request to fetch the full\n * dependency definitions.\n *\n * @example\n * ```js\n * const db = new Database();\n * const deps = { mailer: \"/mailer-api\", auth: \"/remote-auth\" };\n * const info = await db.updateServiceDependencies(\"/my-service\", deps);\n * for (const [key, dep] of Object.entries(info)) {\n * console.log(`${dep.title} (${key}): ${dep.current}`);\n * if (dep.warning) console.warn(`Warning: ${dep.warning}`);\n * }\n * ```\n */\n async updateServiceDependencies(\n mount: string,\n deps: Dict<string>,\n minimal?: false\n ): Promise<\n Dict<\n (SingleServiceDependency | MultiServiceDependency) & { warning?: string }\n >\n >;\n /**\n * Updates the dependencies of the given service while maintaining any\n * existing mount points for dependencies not specified.\n *\n * See also {@link Database.replaceServiceDependencies} and\n * {@link Database.getServiceDependencies}.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param cfg - An object mapping dependency aliases to mount points.\n * @param minimal - If set to `true`, the result will only include each\n * dependency's current mount point. Otherwise it will include the full\n * definition for each dependency.\n *\n * **Note**: When using ArangoDB 3.2.8 or older, setting the `minimal` option\n * to `true` avoids triggering a second request to fetch the full\n * dependency definitions.\n *\n * @example\n * ```js\n * const db = new Database();\n * const deps = { mailer: \"/mailer-api\", auth: \"/remote-auth\" };\n * const info = await db.updateServiceDependencies(\n * \"/my-service\",\n * deps,\n * true\n * );\n * for (const [key, value] of Object.entries(info)) {\n * console.log(`${key}: ${value}`);\n * if (info.warnings[key]) console.warn(`Warning: ${info.warnings[key]}`);\n * }\n * ```\n */\n async updateServiceDependencies(\n mount: string,\n deps: Dict<string>,\n minimal: true\n ): Promise<{\n values: Dict<string>;\n warnings: Dict<string | undefined>;\n }>;\n async updateServiceDependencies(\n mount: string,\n deps: Dict<string>,\n minimal: boolean = false\n ) {\n const result = await this.request(\n {\n method: \"PATCH\",\n path: \"/_api/foxx/dependencies\",\n body: deps,\n qs: { mount, minimal },\n },\n (res) => res.body\n );\n if (\n minimal ||\n !result.values ||\n !Object.keys(result.values).every(\n (key: string) => result.values[key].title\n )\n ) {\n return result;\n }\n // Work around \"minimal\" flag not existing in 3.3\n const result2 = (await this.getServiceDependencies(mount, false)) as Dict<\n (SingleServiceDependency | MultiServiceDependency) & { warning?: string }\n >;\n if (result.warnings) {\n for (const key of Object.keys(result2)) {\n result2[key].warning = result.warnings[key];\n }\n }\n return result2;\n }\n\n /**\n * Enables or disables development mode for the given service.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param enabled - Whether development mode should be enabled or disabled.\n *\n * @example\n * ```js\n * const db = new Database();\n * await db.setServiceDevelopmentMode(\"/my-service\", true);\n * // the service is now in development mode\n * await db.setServiceDevelopmentMode(\"/my-service\", false);\n * // the service is now in production mode\n * ```\n */\n setServiceDevelopmentMode(\n mount: string,\n enabled: boolean = true\n ): Promise<ServiceInfo> {\n return this.request(\n {\n method: enabled ? \"POST\" : \"DELETE\",\n path: \"/_api/foxx/development\",\n qs: { mount },\n },\n (res) => res.body\n );\n }\n\n /**\n * Retrieves a list of scripts defined in the service manifest's \"scripts\"\n * section mapped to their human readable representations.\n *\n * @param mount - The service's mount point, relative to the database.\n *\n * @example\n * ```js\n * const db = new Database();\n * const scripts = await db.listServiceScripts(\"/my-service\");\n * for (const [name, title] of Object.entries(scripts)) {\n * console.log(`${name}: ${title}`);\n * }\n * ```\n */\n listServiceScripts(mount: string): Promise<Dict<string>> {\n return this.request(\n {\n path: \"/_api/foxx/scripts\",\n qs: { mount },\n },\n (res) => res.body\n );\n }\n\n /**\n * Executes a service script and retrieves its result exposed as\n * `module.exports` (if any).\n *\n * @param mount - The service's mount point, relative to the database.\n * @param name - Name of the service script to execute as defined in the\n * service manifest.\n * @param params - Arbitrary value that will be exposed to the script as\n * `argv[0]` in the service context (e.g. `module.context.argv[0]`).\n * Must be serializable to JSON.\n *\n * @example\n * ```js\n * const db = new Database();\n * const result = await db.runServiceScript(\n * \"/my-service\",\n * \"create-user\",\n * {\n * username: \"service_admin\",\n * password: \"hunter2\"\n * }\n * );\n * ```\n */\n runServiceScript(mount: string, name: string, params?: any): Promise<any> {\n return this.request(\n {\n method: \"POST\",\n path: `/_api/foxx/scripts/${encodeURIComponent(name)}`,\n body: params,\n qs: { mount },\n },\n (res) => res.body\n );\n }\n\n /**\n * Runs the tests of a given service and returns the results using the\n * \"default\" reporter.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param options - Options for running the tests.\n *\n * @example\n * ```js\n * const db = new Database();\n * const testReport = await db.runServiceTests(\"/my-foxx\");\n * ```\n */\n runServiceTests(\n mount: string,\n options?: {\n reporter?: \"default\";\n /**\n * Whether the reporter should use \"idiomatic\" mode. Has no effect when\n * using the \"default\" or \"suite\" reporters.\n */\n idiomatic?: false;\n /**\n * If set, only tests with full names including this exact string will be\n * executed.\n */\n filter?: string;\n }\n ): Promise<ServiceTestDefaultReport>;\n /**\n * Runs the tests of a given service and returns the results using the\n * \"suite\" reporter, which groups the test result by test suite.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param options - Options for running the tests.\n *\n * @example\n * ```js\n * const db = new Database();\n * const suiteReport = await db.runServiceTests(\n * \"/my-foxx\",\n * { reporter: \"suite\" }\n * );\n * ```\n */\n runServiceTests(\n mount: string,\n options: {\n reporter: \"suite\";\n /**\n * Whether the reporter should use \"idiomatic\" mode. Has no effect when\n * using the \"default\" or \"suite\" reporters.\n */\n idiomatic?: false;\n /**\n * If set, only tests with full names including this exact string will be\n * executed.\n */\n filter?: string;\n }\n ): Promise<ServiceTestSuiteReport>;\n /**\n * Runs the tests of a given service and returns the results using the\n * \"stream\" reporter, which represents the results as a sequence of tuples\n * representing events.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param options - Options for running the tests.\n *\n * @example\n * ```js\n * const db = new Database();\n * const streamEvents = await db.runServiceTests(\n * \"/my-foxx\",\n * { reporter: \"stream\" }\n * );\n * ```\n */\n runServiceTests(\n mount: string,\n options: {\n reporter: \"stream\";\n /**\n * Whether the reporter should use \"idiomatic\" mode. If set to `true`,\n * the results will be returned as a formatted string.\n */\n idiomatic?: false;\n /**\n * If set, only tests with full names including this exact string will be\n * executed.\n */\n filter?: string;\n }\n ): Promise<ServiceTestStreamReport>;\n /**\n * Runs the tests of a given service and returns the results using the\n * \"tap\" reporter, which represents the results as an array of strings using\n * the \"tap\" format.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param options - Options for running the tests.\n *\n * @example\n * ```js\n * const db = new Database();\n * const tapLines = await db.runServiceTests(\n * \"/my-foxx\",\n * { reporter: \"tap\" }\n * );\n * ```\n */\n runServiceTests(\n mount: string,\n options: {\n reporter: \"tap\";\n /**\n * Whether the reporter should use \"idiomatic\" mode. If set to `true`,\n * the results will be returned as a formatted string.\n */\n idiomatic?: false;\n /**\n * If set, only tests with full names including this exact string will be\n * executed.\n */\n filter?: string;\n }\n ): Promise<ServiceTestTapReport>;\n /**\n * Runs the tests of a given service and returns the results using the\n * \"xunit\" reporter, which represents the results as an XML document using\n * the JSONML exchange format.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param options - Options for running the tests.\n *\n * @example\n * ```js\n * const db = new Database();\n * const jsonML = await db.runServiceTests(\n * \"/my-foxx\",\n * { reporter: \"xunit\" }\n * );\n * ```\n */\n runServiceTests(\n mount: string,\n options: {\n reporter: \"xunit\";\n /**\n * Whether the reporter should use \"idiomatic\" mode. If set to `true`,\n * the results will be returned as a formatted string.\n */\n idiomatic?: false;\n /**\n * If set, only tests with full names including this exact string will be\n * executed.\n */\n filter?: string;\n }\n ): Promise<ServiceTestXunitReport>;\n /**\n * Runs the tests of a given service and returns the results as a string\n * using the \"stream\" reporter in \"idiomatic\" mode, which represents the\n * results as a line-delimited JSON stream of tuples representing events.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param options - Options for running the tests.\n *\n * @example\n * ```js\n * const db = new Database();\n * const streamReport = await db.runServiceTests(\n * \"/my-foxx\",\n * { reporter: \"stream\", idiomatic: true }\n * );\n * ```\n */\n runServiceTests(\n mount: string,\n options: {\n reporter: \"stream\";\n /**\n * Whether the reporter should use \"idiomatic\" mode. If set to `false`,\n * the results will be returned as an array of tuples instead of a\n * string.\n */\n idiomatic: true;\n /**\n * If set, only tests with full names including this exact string will be\n * executed.\n */\n filter?: string;\n }\n ): Promise<string>;\n /**\n * Runs the tests of a given service and returns the results as a string\n * using the \"tap\" reporter in \"idiomatic\" mode, which represents the\n * results using the \"tap\" format.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param options - Options for running the tests.\n *\n * @example\n * ```js\n * const db = new Database();\n * const tapReport = await db.runServiceTests(\n * \"/my-foxx\",\n * { reporter: \"tap\", idiomatic: true }\n * );\n * ```\n */\n runServiceTests(\n mount: string,\n options: {\n reporter: \"tap\";\n /**\n * Whether the reporter should use \"idiomatic\" mode. If set to `false`,\n * the results will be returned as an array of strings instead of a\n * single string.\n */\n idiomatic: true;\n /**\n * If set, only tests with full names including this exact string will be\n * executed.\n */\n filter?: string;\n }\n ): Promise<string>;\n /**\n * Runs the tests of a given service and returns the results as a string\n * using the \"xunit\" reporter in \"idiomatic\" mode, which represents the\n * results as an XML document.\n *\n * @param mount - The service's mount point, relative to the database.\n * @param options - Options for running the tests.\n *\n * @example\n * ```js\n * const db = new Database();\n * const xml = await db.runServiceTests(\n * \"/my-foxx\",\n * { reporter: \"xunit\", idiomatic: true }\n * );\n * ```\n */\n runServiceTests(\n mount: string,\n options: {\n reporter: \"xunit\";\n /**\n * Whether the reporter should use \"idiomatic\" mode. If set to `false`,\n * the results will be returned using the JSONML exchange format\n * instead of a string.\n */\n idiomatic: true;\n /**\n * If set, only tests with full names including this exact string will be\n * executed.\n */\n filter?: string;\n }\n ): Promise<string>;\n runServiceTests(\n mount: string,\n options?: {\n reporter?: string;\n idiomatic?: boolean;\n filter?: string;\n }\n ) {\n return this.request(\n {\n method: \"POST\",\n path: \"/_api/foxx/tests\",\n qs: {\n ...options,\n mount,\n },\n },\n (res) => res.body\n );\n }\n\n /**\n * Retrieves the text content of the service's `README` or `README.md` file.\n *\n * Returns `undefined` if no such file could be found.\n *\n * @param mount - The service's mount point, relative to the database.\n *\n * @example\n * ```js\n * const db = new Database();\n * const readme = await db.getServiceReadme(\"/my-service\");\n * if (readme !== undefined) console.log(readme);\n * else console.warn(`No README found.`)\n * ```\n */\n getServiceReadme(mount: string): Promise<string | undefined> {\n return this.request(\n {\n path: \"/_api/foxx/readme\",\n qs: { mount },\n },\n (res) => res.body\n );\n }\n\n /**\n * Retrieves an Open API compatible Swagger API description object for the\n * service installed at the given mount point.\n *\n * @param mount - The service's mount point, relative to the database.\n *\n * @example\n * ```js\n * const db = new Database();\n * const spec = await db.getServiceDocumentation(\"/my-service\");\n * // spec is a Swagger API description of the service\n * ```\n */\n getServiceDocumentation(mount: string): Promise<SwaggerJson> {\n return this.request(\n {\n path: \"/_api/foxx/swagger\",\n qs: { mount },\n },\n (res) => res.body\n );\n }\n\n /**\n * Retrieves a zip bundle containing the service files.\n *\n * Returns a `Buffer` in node.js or `Blob` in the browser.\n *\n * @param mount - The service's mount point, relative to the database.\n *\n * @example\n * ```js\n * const db = new Database();\n * const serviceBundle = await db.downloadService(\"/my-foxx\");\n * ```\n */\n downloadService(mount: string): Promise<Buffer | Blob> {\n return this.request(\n {\n method: \"POST\",\n path: \"/_api/foxx/download\",\n qs: { mount },\n expectBinary: true,\n },\n (res) => res.body\n );\n }\n\n /**\n * Writes all locally available services to the database and updates any\n * service bundles missing in the database.\n *\n * @param replace - If set to `true`, outdated services will also be\n * committed. This can be used to solve some consistency problems when\n * service bundles are missing in the database or were deleted manually.\n *\n * @example\n * ```js\n * await db.commitLocalServiceState();\n * // all services available on the coordinator have been written to the db\n * ```\n *\n * @example\n * ```js\n * await db.commitLocalServiceState(true);\n * // all service conflicts have been resolved in favor of this coordinator\n * ```\n */\n commitLocalServiceState(replace: boolean = false): Promise<void> {\n return this.request(\n {\n method: \"POST\",\n path: \"/_api/foxx/commit\",\n qs: { replace },\n },\n () => undefined\n );\n }\n //#endregion\n}\n"]}