arangojs 8.2.1 → 8.4.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/CHANGELOG.md CHANGED
@@ -14,6 +14,126 @@ This driver uses semantic versioning:
14
14
  - A change in the major version (e.g. 1.Y.Z -> 2.0.0) indicates _breaking_
15
15
  changes that require changes in your code to upgrade.
16
16
 
17
+ ## [8.4.0] - 2023-07-10
18
+
19
+ ### Changed
20
+
21
+ - Fetching additional cursor results now uses `POST` instead of `PUT` (DE-605)
22
+
23
+ The `POST` route was deprecated and the `PUT` route is supported in all
24
+ actively maintained versions of ArangoDB.
25
+
26
+ - User management methods now use database-relative URLs (DE-606)
27
+
28
+ Previously these methods would make requests without a database prefix,
29
+ implicitly using the `_system` database.
30
+
31
+ - `aql` template strings now take a generic type argument
32
+
33
+ This allows explictly setting the item type of the `ArrayCursor` returned by
34
+ `db.query` when using `aql` template strings. Note that like when setting
35
+ the type on `db.query` directly, arangojs can make no guarantees that the
36
+ type matches the actual data returned by the query.
37
+
38
+ ```ts
39
+ const numbers = await db.query(aql<{ index: number; squared: number }>`
40
+ FOR i IN 1..1000
41
+ RETURN {
42
+ index: i,
43
+ squared: i * i
44
+ }
45
+ `);
46
+ const first = await numbers.next(); // { index: number; squared: number; }
47
+ console.log(first.index, first.squared); // 1 1
48
+ ```
49
+
50
+ ### Fixed
51
+
52
+ - Fixed `listUsers` behavior ([#782](https://github.com/arangodb/arangojs/issues/782))
53
+
54
+ - Fixed `graph.create` not correctly handling `isDisjoint` option
55
+
56
+ ### Added
57
+
58
+ - Added missing attributes to `QueryInfo` and `MultiExplainResult.stats` types (DE-607)
59
+
60
+ - Added cluster rebalancing methods to `Database` (DE-583)
61
+
62
+ - Added `db.withTransaction` helper method for streaming transactions ([#786](https://github.com/arangodb/arangojs/discussions/786))
63
+
64
+ This method allows using streaming transactions without having to manually
65
+ begin and commit or abort the transaction.
66
+
67
+ ```ts
68
+ const vertices = db.collection("vertices");
69
+ const edges = db.collection("edges");
70
+ const info = await db.withTransaction([vertices, edges], async (step) => {
71
+ const start = await step(() => vertices.document("a"));
72
+ const end = await step(() => vertices.document("b"));
73
+ return await step(() => edges.save({ _from: start._id, _to: end._id }));
74
+ });
75
+ ```
76
+
77
+ ## [8.3.1] - 2023-06-05
78
+
79
+ ### Changed
80
+
81
+ - Added note that Simple Queries traversals are removed in ArangoDB 3.12.
82
+
83
+ ## [8.3.0] - 2023-05-11
84
+
85
+ ### Fixed
86
+
87
+ - Fixed `updateUser` and `replaceUser` behavior ([#783](https://github.com/arangodb/arangojs/issues/783))
88
+
89
+ ### Added
90
+
91
+ - Added `renewAuthToken` method to `Database` ([#784](https://github.com/arangodb/arangojs/issues/784))
92
+
93
+ This method allows refreshing the authentication token passed to the
94
+ `useBearerAuth` method or used by the `login` method. Note that ArangoDB
95
+ will currently only return a new token if the token is going to expire
96
+ in the next 150 seconds.
97
+
98
+ - Added `returnOld` and `mergeObjects` to `CollectionInsertOptions` type
99
+
100
+ These options are only available when using `overwriteMode`.
101
+
102
+ - Added caching options to `InvertedIndex` and `ArangoSearchView` types
103
+
104
+ These options were added in ArangoDB 3.10.2.
105
+
106
+ - Added support for `ArangoSearchView` type `storedValues` shorthand notation
107
+
108
+ Instead of using an object, attributes can also be defined as arrays of
109
+ strings and arrays of arrays of strings. This was added in ArangoDB 3.10.3.
110
+
111
+ - Added `peakMemoryUsage` and `executionTime` to `SingleExplainResult.stats` type
112
+
113
+ These attributes were added in ArangoDB 3.10.4.
114
+
115
+ - Added `geo_s2` Analyzer types
116
+
117
+ This Analyzer was added in ArangoDB 3.10.5.
118
+
119
+ - Added `refillIndexCaches` option to document operation options types
120
+
121
+ This option was added in ArangoDB 3.11.
122
+
123
+ - Added `optimizeTopK` to `ArangoSearchView` and `InvertedIndex` types
124
+
125
+ This option was added in ArangoDB 3.11.
126
+
127
+ - Added support for `allowRetry` option in `db.query`
128
+
129
+ This feature was added in ArangoDB 3.11.
130
+
131
+ - Added `x-arango-driver` header
132
+
133
+ The arangojs driver now correctly identifies itself to ArangoDB, allowing the
134
+ ArangoGraph Insights Platform to take advantage of the driver's support for
135
+ cloud-optimized behaviors.
136
+
17
137
  ## [8.2.1] - 2023-04-05
18
138
 
19
139
  ### Fixed
@@ -165,7 +285,7 @@ for upgrading your code to arangojs v8.
165
285
  squared: i * i
166
286
  }
167
287
  `);
168
- const first = await numbers.next();
288
+ const first = await numbers.next(); // { index: number; squared: number; }
169
289
  console.log(first.index, first.squared); // 1 1
170
290
  ```
171
291
 
@@ -1585,6 +1705,9 @@ For a detailed list of changes between pre-release versions of v7 see the
1585
1705
 
1586
1706
  Graph methods now only return the relevant part of the response body.
1587
1707
 
1708
+ [8.4.0]: https://github.com/arangodb/arangojs/compare/v8.3.1...v8.4.0
1709
+ [8.3.1]: https://github.com/arangodb/arangojs/compare/v8.3.0...v8.3.1
1710
+ [8.3.0]: https://github.com/arangodb/arangojs/compare/v8.2.1...v8.3.0
1588
1711
  [8.2.1]: https://github.com/arangodb/arangojs/compare/v8.2.0...v8.2.1
1589
1712
  [8.2.0]: https://github.com/arangodb/arangojs/compare/v8.1.0...v8.2.0
1590
1713
  [8.1.0]: https://github.com/arangodb/arangojs/compare/v8.0.0...v8.1.0
package/analyzer.d.ts CHANGED
@@ -23,7 +23,7 @@ export declare type AnalyzerFeature = "frequency" | "norm" | "position" | "offse
23
23
  /**
24
24
  * Analyzer type and its type-specific properties.
25
25
  */
26
- export declare type CreateAnalyzerOptions = CreateIdentityAnalyzerOptions | CreateDelimiterAnalyzerOptions | CreateStemAnalyzerOptions | CreateNormAnalyzerOptions | CreateNgramAnalyzerOptions | CreateTextAnalyzerOptions | CreateSegmentationAnalyzerOptions | CreateAqlAnalyzerOptions | CreatePipelineAnalyzerOptions | CreateStopwordsAnalyzerOptions | CreateCollationAnalyzerOptions | CreateMinHashAnalyzerOptions | CreateClassificationAnalyzerOptions | CreateNearestNeighborsAnalyzerOptions | CreateGeoJsonAnalyzerOptions | CreateGeoPointAnalyzerOptions;
26
+ export declare type CreateAnalyzerOptions = CreateIdentityAnalyzerOptions | CreateDelimiterAnalyzerOptions | CreateStemAnalyzerOptions | CreateNormAnalyzerOptions | CreateNgramAnalyzerOptions | CreateTextAnalyzerOptions | CreateSegmentationAnalyzerOptions | CreateAqlAnalyzerOptions | CreatePipelineAnalyzerOptions | CreateStopwordsAnalyzerOptions | CreateCollationAnalyzerOptions | CreateMinHashAnalyzerOptions | CreateClassificationAnalyzerOptions | CreateNearestNeighborsAnalyzerOptions | CreateGeoJsonAnalyzerOptions | CreateGeoPointAnalyzerOptions | CreateGeoS2AnalyzerOptions;
27
27
  /**
28
28
  * Options for creating an Identity Analyzer.
29
29
  */
@@ -376,7 +376,7 @@ export declare type CreateCollationAnalyzerOptions = {
376
376
  };
377
377
  };
378
378
  /**
379
- * Options for creating a MinHash Analyzer
379
+ * (Enterprise Edition only.) Options for creating a MinHash Analyzer
380
380
  */
381
381
  export declare type CreateMinHashAnalyzerOptions = {
382
382
  /**
@@ -402,7 +402,7 @@ export declare type CreateMinHashAnalyzerOptions = {
402
402
  };
403
403
  };
404
404
  /**
405
- * Options for creating a Classification Analyzer
405
+ * (Enterprise Edition only.) Options for creating a Classification Analyzer
406
406
  */
407
407
  export declare type CreateClassificationAnalyzerOptions = {
408
408
  /**
@@ -436,7 +436,7 @@ export declare type CreateClassificationAnalyzerOptions = {
436
436
  };
437
437
  };
438
438
  /**
439
- * Options for creating a NearestNeighbors Analyzer
439
+ * (Enterprise Edition only.) Options for creating a NearestNeighbors Analyzer.
440
440
  */
441
441
  export declare type CreateNearestNeighborsAnalyzerOptions = {
442
442
  /**
@@ -539,6 +539,57 @@ export declare type CreateGeoPointAnalyzerOptions = {
539
539
  };
540
540
  };
541
541
  };
542
+ /**
543
+ * (Enterprise Edition only.) Options for creating a Geo S2 Analyzer
544
+ */
545
+ export declare type CreateGeoS2AnalyzerOptions = {
546
+ /**
547
+ * Type of the Analyzer.
548
+ */
549
+ type: "geo_s2";
550
+ /**
551
+ * Features to enable for this Analyzer.
552
+ */
553
+ features?: AnalyzerFeature[];
554
+ /**
555
+ * Additional properties for the Analyzer.
556
+ */
557
+ properties: {
558
+ /**
559
+ * If set to `"centroid"`, only the centroid of the input geometry will be
560
+ * computed and indexed.
561
+ *
562
+ * If set to `"point"` only GeoJSON objects of type Point will be indexed and
563
+ * all other geometry types will be ignored.
564
+ *
565
+ * Default: `"shape"`
566
+ */
567
+ type?: "shape" | "centroid" | "point";
568
+ /**
569
+ * Options for fine-tuning geo queries.
570
+ *
571
+ * Default: `{ maxCells: 20, minLevel: 4, maxLevel: 23 }`
572
+ */
573
+ options?: {
574
+ maxCells?: number;
575
+ minLevel?: number;
576
+ maxLevel?: number;
577
+ };
578
+ /**
579
+ * If set to `"latLngDouble"`, each latitude and longitude value is stored
580
+ * as an 8-byte floating-point value (16 bytes per coordinate pair).
581
+ *
582
+ * If set to `"latLngInt"`, each latitude and longitude value is stored as
583
+ * a 4-byte integer value (8 bytes per coordinate pair).
584
+ *
585
+ * If set to `"s2Point"`, each longitude-latitude pair is stored in the
586
+ * native format of Google S2 (24 bytes per coordinate pair).
587
+ *
588
+ * Default: `"latLngDouble"`
589
+ */
590
+ format?: "latLngDouble" | "latLngInt" | "s2Point";
591
+ };
592
+ };
542
593
  /**
543
594
  * Shared attributes of all Analyzer descriptions.
544
595
  */
@@ -555,7 +606,7 @@ export declare type GenericAnalyzerDescription = {
555
606
  /**
556
607
  * An object describing an Analyzer.
557
608
  */
558
- export declare type AnalyzerDescription = IdentityAnalyzerDescription | DelimiterAnalyzerDescription | StemAnalyzerDescription | NormAnalyzerDescription | NgramAnalyzerDescription | TextAnalyzerDescription | SegmentationAnalyzerDescription | AqlAnalyzerDescription | PipelineAnalyzerDescription | StopwordsAnalyzerDescription | CollationAnalyzerDescription | MinHashAnalyzerDescription | ClassificationAnalyzerDescription | NearestNeighborsAnalyzerDescription | GeoJsonAnalyzerDescription | GeoPointAnalyzerDescription;
609
+ export declare type AnalyzerDescription = IdentityAnalyzerDescription | DelimiterAnalyzerDescription | StemAnalyzerDescription | NormAnalyzerDescription | NgramAnalyzerDescription | TextAnalyzerDescription | SegmentationAnalyzerDescription | AqlAnalyzerDescription | PipelineAnalyzerDescription | StopwordsAnalyzerDescription | CollationAnalyzerDescription | MinHashAnalyzerDescription | ClassificationAnalyzerDescription | NearestNeighborsAnalyzerDescription | GeoJsonAnalyzerDescription | GeoPointAnalyzerDescription | GeoS2AnalyzerDescription;
559
610
  /**
560
611
  * An object describing an Identity Analyzer.
561
612
  */
@@ -734,6 +785,21 @@ export declare type GeoPointAnalyzerDescription = GenericAnalyzerDescription & {
734
785
  };
735
786
  };
736
787
  };
788
+ /**
789
+ * (Enterprise Edition only.) An object describing a GeoS2 Analyzer
790
+ */
791
+ export declare type GeoS2AnalyzerDescription = GenericAnalyzerDescription & {
792
+ type: "geo_s2";
793
+ properties: {
794
+ type: "shape" | "centroid" | "point";
795
+ description: {
796
+ maxCells: number;
797
+ minLevel: number;
798
+ maxLevel: number;
799
+ };
800
+ format: "latLngDouble" | "latLngInt" | "s2Point";
801
+ };
802
+ };
737
803
  /**
738
804
  * Represents an Analyzer in a {@link database.Database}.
739
805
  */
@@ -795,7 +861,7 @@ export declare class Analyzer {
795
861
  * // the identity Analyzer "potatoes" now exists
796
862
  * ```
797
863
  */
798
- create<Options extends CreateAnalyzerOptions>(options: Options): Promise<Options extends CreateIdentityAnalyzerOptions ? IdentityAnalyzerDescription : Options extends CreateDelimiterAnalyzerOptions ? DelimiterAnalyzerDescription : Options extends CreateStemAnalyzerOptions ? StemAnalyzerDescription : Options extends CreateNormAnalyzerOptions ? NormAnalyzerDescription : Options extends CreateNgramAnalyzerOptions ? NgramAnalyzerDescription : Options extends CreateTextAnalyzerOptions ? TextAnalyzerDescription : Options extends CreateSegmentationAnalyzerOptions ? SegmentationAnalyzerDescription : Options extends CreateAqlAnalyzerOptions ? AqlAnalyzerDescription : Options extends CreatePipelineAnalyzerOptions ? PipelineAnalyzerDescription : Options extends CreateStopwordsAnalyzerOptions ? StopwordsAnalyzerDescription : Options extends CreateCollationAnalyzerOptions ? CollationAnalyzerDescription : Options extends CreateMinHashAnalyzerOptions ? MinHashAnalyzerDescription : Options extends CreateClassificationAnalyzerOptions ? ClassificationAnalyzerDescription : Options extends CreateNearestNeighborsAnalyzerOptions ? NearestNeighborsAnalyzerDescription : Options extends CreateGeoJsonAnalyzerOptions ? GeoJsonAnalyzerDescription : Options extends CreateGeoPointAnalyzerOptions ? GeoPointAnalyzerDescription : AnalyzerDescription>;
864
+ create<Options extends CreateAnalyzerOptions>(options: Options): Promise<Options extends CreateIdentityAnalyzerOptions ? IdentityAnalyzerDescription : Options extends CreateDelimiterAnalyzerOptions ? DelimiterAnalyzerDescription : Options extends CreateStemAnalyzerOptions ? StemAnalyzerDescription : Options extends CreateNormAnalyzerOptions ? NormAnalyzerDescription : Options extends CreateNgramAnalyzerOptions ? NgramAnalyzerDescription : Options extends CreateTextAnalyzerOptions ? TextAnalyzerDescription : Options extends CreateSegmentationAnalyzerOptions ? SegmentationAnalyzerDescription : Options extends CreateAqlAnalyzerOptions ? AqlAnalyzerDescription : Options extends CreatePipelineAnalyzerOptions ? PipelineAnalyzerDescription : Options extends CreateStopwordsAnalyzerOptions ? StopwordsAnalyzerDescription : Options extends CreateCollationAnalyzerOptions ? CollationAnalyzerDescription : Options extends CreateMinHashAnalyzerOptions ? MinHashAnalyzerDescription : Options extends CreateClassificationAnalyzerOptions ? ClassificationAnalyzerDescription : Options extends CreateNearestNeighborsAnalyzerOptions ? NearestNeighborsAnalyzerDescription : Options extends CreateGeoJsonAnalyzerOptions ? GeoJsonAnalyzerDescription : Options extends CreateGeoPointAnalyzerOptions ? GeoPointAnalyzerDescription : Options extends CreateGeoS2AnalyzerOptions ? GeoS2AnalyzerDescription : AnalyzerDescription>;
799
865
  /**
800
866
  * Deletes the Analyzer from the database.
801
867
  *
package/analyzer.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"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AAG,CAAC,OAAO,CAAC;YACtB,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,kBAAkB,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YACxD,EAAE,EAAE,EAAE,KAAK,EAAE;SACd,CAAC,CAAC;IACL,CAAC;CACF;AAtJD,4BAsJC","sourcesContent":["/**\n * ```ts\n * import type { Analyzer } from \"arangojs/analyzer\";\n * ```\n *\n * The \"analyzer\" module provides analyzer related types and interfaces\n * for TypeScript.\n *\n * @packageDocumentation\n */\nimport { ArangoApiResponse } from \"./connection\";\nimport { Database } from \"./database\";\nimport { isArangoError } from \"./error\";\nimport { ANALYZER_NOT_FOUND } from \"./lib/codes\";\n\n/**\n * Indicates whether the given value represents an {@link Analyzer}.\n *\n * @param analyzer - A value that might be an Analyzer.\n */\nexport function isArangoAnalyzer(analyzer: any): analyzer is Analyzer {\n return Boolean(analyzer && analyzer.isArangoAnalyzer);\n}\n\n/**\n * Name of a feature enabled for an Analyzer.\n */\nexport type AnalyzerFeature = \"frequency\" | \"norm\" | \"position\" | \"offset\";\n\n/**\n * Analyzer type and its type-specific properties.\n */\nexport type CreateAnalyzerOptions =\n | CreateIdentityAnalyzerOptions\n | CreateDelimiterAnalyzerOptions\n | CreateStemAnalyzerOptions\n | CreateNormAnalyzerOptions\n | CreateNgramAnalyzerOptions\n | CreateTextAnalyzerOptions\n | CreateSegmentationAnalyzerOptions\n | CreateAqlAnalyzerOptions\n | CreatePipelineAnalyzerOptions\n | CreateStopwordsAnalyzerOptions\n | CreateCollationAnalyzerOptions\n | CreateMinHashAnalyzerOptions\n | CreateClassificationAnalyzerOptions\n | CreateNearestNeighborsAnalyzerOptions\n | CreateGeoJsonAnalyzerOptions\n | CreateGeoPointAnalyzerOptions;\n\n/**\n * Options for creating an Identity Analyzer.\n */\nexport type CreateIdentityAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"identity\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n *\n * The `identity` Analyzer does not take additional properties.\n */\n properties?: Record<string, never>;\n};\n\n/**\n * Options for creating a Delimiter Analyzer.\n */\nexport type CreateDelimiterAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"delimiter\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n *\n * The value will be used as delimiter to split text into tokens as specified\n * in RFC 4180, without starting new records on newlines.\n */\n properties: string | { delimiter: string };\n};\n\n/**\n * Options for creating a Stem Analyzer.\n */\nexport type CreateStemAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"stem\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n *\n * The value defines the text locale.\n *\n * Format: `language[_COUNTRY][.encoding][@variant]`\n */\n properties: { locale: string };\n};\n\n/**\n * Options for creating a Norm Analyzer.\n */\nexport type CreateNormAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"norm\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: {\n /**\n * Text locale.\n *\n * Format: `language[_COUNTRY][.encoding][@variant]`\n */\n locale: string;\n /**\n * Case conversion.\n *\n * Default: `\"lower\"`\n */\n case?: \"lower\" | \"none\" | \"upper\";\n /**\n * Preserve accents in returned words.\n *\n * Default: `false`\n */\n accent?: boolean;\n };\n};\n\n/**\n * Options for creating an Ngram Analyzer.\n */\nexport type CreateNgramAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"ngram\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: {\n /**\n * Maximum n-gram length.\n */\n max: number;\n /**\n * Minimum n-gram length.\n */\n min: number;\n /**\n * Output the original value as well.\n */\n preserveOriginal: boolean;\n };\n};\n\n/**\n * Options for creating a Text Analyzer.\n */\nexport type CreateTextAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"text\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: {\n /**\n * Text locale.\n *\n * Format: `language[_COUNTRY][.encoding][@variant]`\n */\n locale: string;\n /**\n * Case conversion.\n *\n * Default: `\"lower\"`\n */\n case?: \"lower\" | \"none\" | \"upper\";\n /**\n * Words to omit from result.\n *\n * Defaults to the words loaded from the file at `stopwordsPath`.\n */\n stopwords?: string[];\n /**\n * Path with a `language` sub-directory containing files with words to omit.\n *\n * Defaults to the path specified in the server-side environment variable\n * `IRESEARCH_TEXT_STOPWORD_PATH` or the current working directory of the\n * ArangoDB process.\n */\n stopwordsPath?: string;\n /**\n * Preserve accents in returned words.\n *\n * Default: `false`\n */\n accent?: boolean;\n /**\n * Apply stemming on returned words.\n *\n * Default: `true`\n */\n stemming?: boolean;\n /**\n * If present, then edge n-grams are generated for each token (word).\n */\n edgeNgram?: { min?: number; max?: number; preserveOriginal?: boolean };\n };\n};\n\n/**\n * Options for creating a Segmentation Analyzer\n */\nexport type CreateSegmentationAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"segmentation\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: {\n /**\n * Which tokens should be returned.\n *\n * Default: `\"alpha\"`\n */\n break?: \"all\" | \"alpha\" | \"graphic\";\n /**\n * What case all returned tokens should be converted to if applicable.\n *\n * Default: `\"none\"`\n */\n case?: \"lower\" | \"upper\" | \"none\";\n };\n};\n\n/**\n * Options for creating an AQL Analyzer\n */\nexport type CreateAqlAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"aql\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: {\n /**\n * AQL query to be executed.\n */\n queryString: string;\n /**\n * If set to `true`, the position is set to `0` for all members of the query result array.\n *\n * Default: `false`\n */\n collapsePositions?: boolean;\n /**\n * If set to `false`, `null` values will be discarded from the View index.\n *\n * Default: `true`\n */\n keepNull?: boolean;\n /**\n * Number between `1` and `1000` that determines the batch size for reading\n * data from the query.\n *\n * Default: `1`\n */\n batchSize?: number;\n /**\n * Memory limit for query execution in bytes.\n *\n * Default: `1048576` (1 MiB)\n */\n memoryLimit?: number;\n /**\n * Data type of the returned tokens.\n *\n * Default: `\"string\"`\n */\n returnType?: \"string\" | \"number\" | \"bool\";\n };\n};\n\n/**\n * Options for creating a Pipeline Analyzer\n */\nexport type CreatePipelineAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"pipeline\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: {\n /**\n * Definitions for Analyzers to chain in this Pipeline Analyzer.\n */\n pipeline: Omit<CreateAnalyzerOptions, \"features\">[];\n };\n};\n\n/**\n * Options for creating a Stopwords Analyzer\n */\nexport type CreateStopwordsAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"stopwords\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: {\n /**\n * Array of strings that describe the tokens to be discarded.\n */\n stopwords: string[];\n /**\n * Whether stopword values should be interpreted as hex-encoded strings.\n *\n * Default: `false`\n */\n hex?: boolean;\n };\n};\n\n/**\n * Options for creating a Collation Analyzer\n */\nexport type CreateCollationAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"collation\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: {\n /**\n * Text locale.\n *\n * Format: `language[_COUNTRY][.encoding][@variant]`\n */\n locale: string;\n };\n};\n\n/**\n * Options for creating a MinHash Analyzer\n */\nexport type CreateMinHashAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"minhash\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: {\n /**\n * An Analyzer definition-like object with `type` and `properties` attributes.\n */\n analyzer: Omit<CreateAnalyzerOptions, \"features\">;\n /**\n * Size of the MinHash signature.\n */\n numHashes: number;\n };\n};\n\n/**\n * Options for creating a Classification Analyzer\n */\nexport type CreateClassificationAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"classification\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: {\n /**\n * On-disk path to the trained fastText supervised model.\n */\n model_location: string;\n /**\n * Number of class labels that will be produced per input.\n *\n * Default: `1`\n */\n top_k?: number;\n /**\n * Probability threshold for which a label will be assigned to an input.\n *\n * Default: `0.99`\n */\n threshold?: number;\n };\n};\n\n/**\n * Options for creating a NearestNeighbors Analyzer\n */\nexport type CreateNearestNeighborsAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"nearest_neighbors\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: {\n /**\n * On-disk path to the trained fastText supervised model.\n */\n model_location: string;\n /**\n * Number of class labels that will be produced per input.\n *\n * Default: `1`\n */\n top_k?: number;\n };\n};\n\n/**\n * Options for creating a GeoJSON Analyzer\n */\nexport type CreateGeoJsonAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"geojson\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: {\n /**\n * If set to `\"centroid\"`, only the centroid of the input geometry will be\n * computed and indexed.\n *\n * If set to `\"point\"` only GeoJSON objects of type Point will be indexed and\n * all other geometry types will be ignored.\n *\n * Default: `\"shape\"`\n */\n type?: \"shape\" | \"centroid\" | \"point\";\n /**\n * Options for fine-tuning geo queries.\n *\n * Default: `{ maxCells: 20, minLevel: 4, maxLevel: 23 }`\n */\n options?: { maxCells?: number; minLevel?: number; maxLevel?: number };\n };\n};\n\n/**\n * Options for creating a GeoPoint Analyzer\n */\nexport type CreateGeoPointAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"geopoint\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: {\n /**\n * Attribute paths of the latitude value relative to the field for which the\n * Analyzer is defined in the View.\n */\n latitude?: string[];\n /**\n * Attribute paths of the longitude value relative to the field for which the\n * Analyzer is defined in the View.\n */\n longitude?: string[];\n /**\n * Options for fine-tuning geo queries.\n *\n * Default: `{ maxCells: 20, minLevel: 4, maxLevel: 23 }`\n */\n options?: { minCells?: number; minLevel?: number; maxLevel?: number };\n };\n};\n\n/**\n * Shared attributes of all Analyzer descriptions.\n */\nexport type GenericAnalyzerDescription = {\n /**\n * A unique name for this Analyzer.\n */\n name: string;\n /**\n * Features enabled for this Analyzer.\n */\n features: AnalyzerFeature[];\n};\n\n/**\n * An object describing an Analyzer.\n */\nexport type AnalyzerDescription =\n | IdentityAnalyzerDescription\n | DelimiterAnalyzerDescription\n | StemAnalyzerDescription\n | NormAnalyzerDescription\n | NgramAnalyzerDescription\n | TextAnalyzerDescription\n | SegmentationAnalyzerDescription\n | AqlAnalyzerDescription\n | PipelineAnalyzerDescription\n | StopwordsAnalyzerDescription\n | CollationAnalyzerDescription\n | MinHashAnalyzerDescription\n | ClassificationAnalyzerDescription\n | NearestNeighborsAnalyzerDescription\n | GeoJsonAnalyzerDescription\n | GeoPointAnalyzerDescription;\n\n/**\n * An object describing an Identity Analyzer.\n */\nexport type IdentityAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"identity\";\n properties: Record<string, never>;\n};\n\n/**\n * An object describing a Delimiter Analyzer.\n */\nexport type DelimiterAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"delimiter\";\n properties: { delimiter: string };\n};\n\n/**\n * An object describing a Stem Analyzer.\n */\nexport type StemAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"stem\";\n properties: { locale: string };\n};\n\n/**\n * An object describing a Norm Analyzer.\n */\nexport type NormAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"norm\";\n properties: {\n locale: string;\n case: \"lower\" | \"none\" | \"upper\";\n accent: boolean;\n };\n};\n\n/**\n * An object describing an Ngram Analyzer.\n */\nexport type NgramAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"ngram\";\n properties: {\n max: number;\n min: number;\n preserveOriginal: boolean;\n };\n};\n\n/**\n * An object describing a Text Analyzer.\n */\nexport type TextAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"text\";\n properties: {\n locale: string;\n case: \"lower\" | \"none\" | \"upper\";\n stopwords: string[];\n stopwordsPath: string;\n accent: boolean;\n stemming: boolean;\n edgeNgram: { min: number; max: number; preserveOriginal: boolean };\n };\n};\n\n/**\n * An object describing a Segmentation Analyzer\n */\nexport type SegmentationAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"segmentation\";\n properties: {\n break: \"all\" | \"alpha\" | \"graphic\";\n case: \"lower\" | \"upper\" | \"none\";\n };\n};\n\n/**\n * An object describing an AQL Analyzer\n */\nexport type AqlAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"aql\";\n properties: {\n queryString: string;\n collapsePositions: boolean;\n keepNull: boolean;\n batchSize: number;\n memoryLimit: number;\n returnType: \"string\" | \"number\" | \"bool\";\n };\n};\n\n/**\n * An object describing a Pipeline Analyzer\n */\nexport type PipelineAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"pipeline\";\n properties: {\n pipeline: Omit<AnalyzerDescription, \"name\" | \"features\">[];\n };\n};\n\n/**\n * An object describing a Stopwords Analyzer\n */\nexport type StopwordsAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"stopwords\";\n properties: {\n stopwords: string[];\n hex: boolean;\n };\n};\n\n/**\n * An object describing a Collation Analyzer\n */\nexport type CollationAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"collation\";\n properties: {\n locale: string;\n };\n};\n\n/**\n * (Enterprise Edition only.) An object describing a MinHash Analyzer\n */\nexport type MinHashAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"minhash\";\n properties: {\n analyzer: Omit<AnalyzerDescription, \"name\" | \"features\">;\n numHashes: number;\n };\n};\n\n/**\n * (Enterprise Edition only.) An object describing a Classification Analyzer\n */\nexport type ClassificationAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"classification\";\n properties: {\n model_location: string;\n top_k: number;\n threshold: number;\n };\n};\n\n/**\n * (Enterprise Edition only.) An object describing a NearestNeighbors Analyzer\n */\nexport type NearestNeighborsAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"nearest_neighbors\";\n properties: {\n model_location: string;\n top_k: number;\n };\n};\n\n/**\n * An object describing a GeoJSON Analyzer\n */\nexport type GeoJsonAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"geojson\";\n properties: {\n type: \"shape\" | \"centroid\" | \"point\";\n description: { maxCells: number; minLevel: number; maxLevel: number };\n };\n};\n\n/**\n * An object describing a GeoPoint Analyzer\n */\nexport type GeoPointAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"geopoint\";\n properties: {\n latitude: string[];\n longitude: string[];\n description: { minCells: number; minLevel: number; maxLevel: number };\n };\n};\n\n/**\n * Represents an Analyzer in a {@link database.Database}.\n */\nexport class Analyzer {\n protected _name: string;\n protected _db: Database;\n\n /**\n * @internal\n */\n constructor(db: Database, name: string) {\n this._db = db;\n this._name = name.normalize(\"NFC\");\n }\n\n /**\n * @internal\n *\n * Indicates that this object represents an ArangoDB Analyzer.\n */\n get isArangoAnalyzer(): true {\n return true;\n }\n\n /**\n * Name of this Analyzer.\n *\n * See also {@link database.Database}.\n */\n get name() {\n return this._name;\n }\n\n /**\n * Checks whether the Analyzer exists.\n *\n * @example\n * ```js\n * const db = new Database();\n * const analyzer = db.analyzer(\"some-analyzer\");\n * const result = await analyzer.exists();\n * // result indicates whether the Analyzer exists\n * ```\n */\n async exists(): Promise<boolean> {\n try {\n await this.get();\n return true;\n } catch (err: any) {\n if (isArangoError(err) && err.errorNum === ANALYZER_NOT_FOUND) {\n return false;\n }\n throw err;\n }\n }\n\n /**\n * Retrieves the Analyzer definition for the Analyzer.\n *\n * @example\n * ```js\n * const db = new Database();\n * const analyzer = db.analyzer(\"some-analyzer\");\n * const definition = await analyzer.get();\n * // definition contains the Analyzer definition\n * ```\n */\n get(): Promise<ArangoApiResponse<AnalyzerDescription>> {\n return this._db.request({\n path: `/_api/analyzer/${encodeURIComponent(this._name)}`,\n });\n }\n\n /**\n * Creates a new Analyzer with the given `options` and the instance's name.\n *\n * See also {@link database.Database#createAnalyzer}.\n *\n * @param options - Options for creating the Analyzer.\n *\n * @example\n * ```js\n * const db = new Database();\n * const analyzer = db.analyzer(\"potatoes\");\n * await analyzer.create({ type: \"identity\" });\n * // the identity Analyzer \"potatoes\" now exists\n * ```\n */\n create<Options extends CreateAnalyzerOptions>(\n options: Options\n ): Promise<\n Options extends CreateIdentityAnalyzerOptions\n ? IdentityAnalyzerDescription\n : Options extends CreateDelimiterAnalyzerOptions\n ? DelimiterAnalyzerDescription\n : Options extends CreateStemAnalyzerOptions\n ? StemAnalyzerDescription\n : Options extends CreateNormAnalyzerOptions\n ? NormAnalyzerDescription\n : Options extends CreateNgramAnalyzerOptions\n ? NgramAnalyzerDescription\n : Options extends CreateTextAnalyzerOptions\n ? TextAnalyzerDescription\n : Options extends CreateSegmentationAnalyzerOptions\n ? SegmentationAnalyzerDescription\n : Options extends CreateAqlAnalyzerOptions\n ? AqlAnalyzerDescription\n : Options extends CreatePipelineAnalyzerOptions\n ? PipelineAnalyzerDescription\n : Options extends CreateStopwordsAnalyzerOptions\n ? StopwordsAnalyzerDescription\n : Options extends CreateCollationAnalyzerOptions\n ? CollationAnalyzerDescription\n : Options extends CreateMinHashAnalyzerOptions\n ? MinHashAnalyzerDescription\n : Options extends CreateClassificationAnalyzerOptions\n ? ClassificationAnalyzerDescription\n : Options extends CreateNearestNeighborsAnalyzerOptions\n ? NearestNeighborsAnalyzerDescription\n : Options extends CreateGeoJsonAnalyzerOptions\n ? GeoJsonAnalyzerDescription\n : Options extends CreateGeoPointAnalyzerOptions\n ? GeoPointAnalyzerDescription\n : AnalyzerDescription\n > {\n return this._db.request({\n method: \"POST\",\n path: \"/_api/analyzer\",\n body: { name: this._name, ...options },\n });\n }\n\n /**\n * Deletes the Analyzer from the database.\n *\n * @param force - Whether the Analyzer should still be deleted even if it\n * is currently in use.\n *\n * @example\n * ```js\n * const db = new Database();\n * const analyzer = db.analyzer(\"some-analyzer\");\n * await analyzer.drop();\n * // the Analyzer \"some-analyzer\" no longer exists\n * ```\n */\n drop(force: boolean = false): Promise<ArangoApiResponse<{ name: string }>> {\n return this._db.request({\n method: \"DELETE\",\n path: `/_api/analyzer/${encodeURIComponent(this._name)}`,\n qs: { force },\n });\n }\n}\n"]}
1
+ {"version":3,"file":"analyzer.js","sourceRoot":"","sources":["../src/analyzer.ts"],"names":[],"mappings":";;;AAYA,mCAAwC;AACxC,uCAAiD;AAEjD;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,QAAa;IAC5C,OAAO,OAAO,CAAC,QAAQ,IAAI,QAAQ,CAAC,gBAAgB,CAAC,CAAC;AACxD,CAAC;AAFD,4CAEC;AAkzBD;;GAEG;AACH,MAAa,QAAQ;IAInB;;OAEG;IACH,YAAY,EAAY,EAAE,IAAY;QACpC,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;QACd,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAED;;;;OAIG;IACH,IAAI,gBAAgB;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,MAAM;QACV,IAAI;YACF,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;YACjB,OAAO,IAAI,CAAC;SACb;QAAC,OAAO,GAAQ,EAAE;YACjB,IAAI,IAAA,qBAAa,EAAC,GAAG,CAAC,IAAI,GAAG,CAAC,QAAQ,KAAK,0BAAkB,EAAE;gBAC7D,OAAO,KAAK,CAAC;aACd;YACD,MAAM,GAAG,CAAC;SACX;IACH,CAAC;IAED;;;;;;;;;;OAUG;IACH,GAAG;QACD,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;YACtB,IAAI,EAAE,kBAAkB,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;SACzD,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,MAAM,CACJ,OAAgB;QAsChB,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;YACtB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,GAAG,OAAO,EAAE;SACvC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,IAAI,CAAC,QAAiB,KAAK;QACzB,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;YACtB,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,kBAAkB,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YACxD,EAAE,EAAE,EAAE,KAAK,EAAE;SACd,CAAC,CAAC;IACL,CAAC;CACF;AAxJD,4BAwJC","sourcesContent":["/**\n * ```ts\n * import type { Analyzer } from \"arangojs/analyzer\";\n * ```\n *\n * The \"analyzer\" module provides analyzer related types and interfaces\n * for TypeScript.\n *\n * @packageDocumentation\n */\nimport { ArangoApiResponse } from \"./connection\";\nimport { Database } from \"./database\";\nimport { isArangoError } from \"./error\";\nimport { ANALYZER_NOT_FOUND } from \"./lib/codes\";\n\n/**\n * Indicates whether the given value represents an {@link Analyzer}.\n *\n * @param analyzer - A value that might be an Analyzer.\n */\nexport function isArangoAnalyzer(analyzer: any): analyzer is Analyzer {\n return Boolean(analyzer && analyzer.isArangoAnalyzer);\n}\n\n/**\n * Name of a feature enabled for an Analyzer.\n */\nexport type AnalyzerFeature = \"frequency\" | \"norm\" | \"position\" | \"offset\";\n\n/**\n * Analyzer type and its type-specific properties.\n */\nexport type CreateAnalyzerOptions =\n | CreateIdentityAnalyzerOptions\n | CreateDelimiterAnalyzerOptions\n | CreateStemAnalyzerOptions\n | CreateNormAnalyzerOptions\n | CreateNgramAnalyzerOptions\n | CreateTextAnalyzerOptions\n | CreateSegmentationAnalyzerOptions\n | CreateAqlAnalyzerOptions\n | CreatePipelineAnalyzerOptions\n | CreateStopwordsAnalyzerOptions\n | CreateCollationAnalyzerOptions\n | CreateMinHashAnalyzerOptions\n | CreateClassificationAnalyzerOptions\n | CreateNearestNeighborsAnalyzerOptions\n | CreateGeoJsonAnalyzerOptions\n | CreateGeoPointAnalyzerOptions\n | CreateGeoS2AnalyzerOptions;\n\n/**\n * Options for creating an Identity Analyzer.\n */\nexport type CreateIdentityAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"identity\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n *\n * The `identity` Analyzer does not take additional properties.\n */\n properties?: Record<string, never>;\n};\n\n/**\n * Options for creating a Delimiter Analyzer.\n */\nexport type CreateDelimiterAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"delimiter\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n *\n * The value will be used as delimiter to split text into tokens as specified\n * in RFC 4180, without starting new records on newlines.\n */\n properties: string | { delimiter: string };\n};\n\n/**\n * Options for creating a Stem Analyzer.\n */\nexport type CreateStemAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"stem\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n *\n * The value defines the text locale.\n *\n * Format: `language[_COUNTRY][.encoding][@variant]`\n */\n properties: { locale: string };\n};\n\n/**\n * Options for creating a Norm Analyzer.\n */\nexport type CreateNormAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"norm\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: {\n /**\n * Text locale.\n *\n * Format: `language[_COUNTRY][.encoding][@variant]`\n */\n locale: string;\n /**\n * Case conversion.\n *\n * Default: `\"lower\"`\n */\n case?: \"lower\" | \"none\" | \"upper\";\n /**\n * Preserve accents in returned words.\n *\n * Default: `false`\n */\n accent?: boolean;\n };\n};\n\n/**\n * Options for creating an Ngram Analyzer.\n */\nexport type CreateNgramAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"ngram\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: {\n /**\n * Maximum n-gram length.\n */\n max: number;\n /**\n * Minimum n-gram length.\n */\n min: number;\n /**\n * Output the original value as well.\n */\n preserveOriginal: boolean;\n };\n};\n\n/**\n * Options for creating a Text Analyzer.\n */\nexport type CreateTextAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"text\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: {\n /**\n * Text locale.\n *\n * Format: `language[_COUNTRY][.encoding][@variant]`\n */\n locale: string;\n /**\n * Case conversion.\n *\n * Default: `\"lower\"`\n */\n case?: \"lower\" | \"none\" | \"upper\";\n /**\n * Words to omit from result.\n *\n * Defaults to the words loaded from the file at `stopwordsPath`.\n */\n stopwords?: string[];\n /**\n * Path with a `language` sub-directory containing files with words to omit.\n *\n * Defaults to the path specified in the server-side environment variable\n * `IRESEARCH_TEXT_STOPWORD_PATH` or the current working directory of the\n * ArangoDB process.\n */\n stopwordsPath?: string;\n /**\n * Preserve accents in returned words.\n *\n * Default: `false`\n */\n accent?: boolean;\n /**\n * Apply stemming on returned words.\n *\n * Default: `true`\n */\n stemming?: boolean;\n /**\n * If present, then edge n-grams are generated for each token (word).\n */\n edgeNgram?: { min?: number; max?: number; preserveOriginal?: boolean };\n };\n};\n\n/**\n * Options for creating a Segmentation Analyzer\n */\nexport type CreateSegmentationAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"segmentation\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: {\n /**\n * Which tokens should be returned.\n *\n * Default: `\"alpha\"`\n */\n break?: \"all\" | \"alpha\" | \"graphic\";\n /**\n * What case all returned tokens should be converted to if applicable.\n *\n * Default: `\"none\"`\n */\n case?: \"lower\" | \"upper\" | \"none\";\n };\n};\n\n/**\n * Options for creating an AQL Analyzer\n */\nexport type CreateAqlAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"aql\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: {\n /**\n * AQL query to be executed.\n */\n queryString: string;\n /**\n * If set to `true`, the position is set to `0` for all members of the query result array.\n *\n * Default: `false`\n */\n collapsePositions?: boolean;\n /**\n * If set to `false`, `null` values will be discarded from the View index.\n *\n * Default: `true`\n */\n keepNull?: boolean;\n /**\n * Number between `1` and `1000` that determines the batch size for reading\n * data from the query.\n *\n * Default: `1`\n */\n batchSize?: number;\n /**\n * Memory limit for query execution in bytes.\n *\n * Default: `1048576` (1 MiB)\n */\n memoryLimit?: number;\n /**\n * Data type of the returned tokens.\n *\n * Default: `\"string\"`\n */\n returnType?: \"string\" | \"number\" | \"bool\";\n };\n};\n\n/**\n * Options for creating a Pipeline Analyzer\n */\nexport type CreatePipelineAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"pipeline\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: {\n /**\n * Definitions for Analyzers to chain in this Pipeline Analyzer.\n */\n pipeline: Omit<CreateAnalyzerOptions, \"features\">[];\n };\n};\n\n/**\n * Options for creating a Stopwords Analyzer\n */\nexport type CreateStopwordsAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"stopwords\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: {\n /**\n * Array of strings that describe the tokens to be discarded.\n */\n stopwords: string[];\n /**\n * Whether stopword values should be interpreted as hex-encoded strings.\n *\n * Default: `false`\n */\n hex?: boolean;\n };\n};\n\n/**\n * Options for creating a Collation Analyzer\n */\nexport type CreateCollationAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"collation\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: {\n /**\n * Text locale.\n *\n * Format: `language[_COUNTRY][.encoding][@variant]`\n */\n locale: string;\n };\n};\n\n/**\n * (Enterprise Edition only.) Options for creating a MinHash Analyzer\n */\nexport type CreateMinHashAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"minhash\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: {\n /**\n * An Analyzer definition-like object with `type` and `properties` attributes.\n */\n analyzer: Omit<CreateAnalyzerOptions, \"features\">;\n /**\n * Size of the MinHash signature.\n */\n numHashes: number;\n };\n};\n\n/**\n * (Enterprise Edition only.) Options for creating a Classification Analyzer\n */\nexport type CreateClassificationAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"classification\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: {\n /**\n * On-disk path to the trained fastText supervised model.\n */\n model_location: string;\n /**\n * Number of class labels that will be produced per input.\n *\n * Default: `1`\n */\n top_k?: number;\n /**\n * Probability threshold for which a label will be assigned to an input.\n *\n * Default: `0.99`\n */\n threshold?: number;\n };\n};\n\n/**\n * (Enterprise Edition only.) Options for creating a NearestNeighbors Analyzer.\n */\nexport type CreateNearestNeighborsAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"nearest_neighbors\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: {\n /**\n * On-disk path to the trained fastText supervised model.\n */\n model_location: string;\n /**\n * Number of class labels that will be produced per input.\n *\n * Default: `1`\n */\n top_k?: number;\n };\n};\n\n/**\n * Options for creating a GeoJSON Analyzer\n */\nexport type CreateGeoJsonAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"geojson\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: {\n /**\n * If set to `\"centroid\"`, only the centroid of the input geometry will be\n * computed and indexed.\n *\n * If set to `\"point\"` only GeoJSON objects of type Point will be indexed and\n * all other geometry types will be ignored.\n *\n * Default: `\"shape\"`\n */\n type?: \"shape\" | \"centroid\" | \"point\";\n /**\n * Options for fine-tuning geo queries.\n *\n * Default: `{ maxCells: 20, minLevel: 4, maxLevel: 23 }`\n */\n options?: { maxCells?: number; minLevel?: number; maxLevel?: number };\n };\n};\n\n/**\n * Options for creating a GeoPoint Analyzer\n */\nexport type CreateGeoPointAnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"geopoint\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: {\n /**\n * Attribute paths of the latitude value relative to the field for which the\n * Analyzer is defined in the View.\n */\n latitude?: string[];\n /**\n * Attribute paths of the longitude value relative to the field for which the\n * Analyzer is defined in the View.\n */\n longitude?: string[];\n /**\n * Options for fine-tuning geo queries.\n *\n * Default: `{ maxCells: 20, minLevel: 4, maxLevel: 23 }`\n */\n options?: { minCells?: number; minLevel?: number; maxLevel?: number };\n };\n};\n\n/**\n * (Enterprise Edition only.) Options for creating a Geo S2 Analyzer\n */\nexport type CreateGeoS2AnalyzerOptions = {\n /**\n * Type of the Analyzer.\n */\n type: \"geo_s2\";\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n /**\n * Additional properties for the Analyzer.\n */\n properties: {\n /**\n * If set to `\"centroid\"`, only the centroid of the input geometry will be\n * computed and indexed.\n *\n * If set to `\"point\"` only GeoJSON objects of type Point will be indexed and\n * all other geometry types will be ignored.\n *\n * Default: `\"shape\"`\n */\n type?: \"shape\" | \"centroid\" | \"point\";\n /**\n * Options for fine-tuning geo queries.\n *\n * Default: `{ maxCells: 20, minLevel: 4, maxLevel: 23 }`\n */\n options?: { maxCells?: number; minLevel?: number; maxLevel?: number };\n /**\n * If set to `\"latLngDouble\"`, each latitude and longitude value is stored\n * as an 8-byte floating-point value (16 bytes per coordinate pair).\n *\n * If set to `\"latLngInt\"`, each latitude and longitude value is stored as\n * a 4-byte integer value (8 bytes per coordinate pair).\n *\n * If set to `\"s2Point\"`, each longitude-latitude pair is stored in the\n * native format of Google S2 (24 bytes per coordinate pair).\n *\n * Default: `\"latLngDouble\"`\n */\n format?: \"latLngDouble\" | \"latLngInt\" | \"s2Point\";\n };\n};\n\n/**\n * Shared attributes of all Analyzer descriptions.\n */\nexport type GenericAnalyzerDescription = {\n /**\n * A unique name for this Analyzer.\n */\n name: string;\n /**\n * Features enabled for this Analyzer.\n */\n features: AnalyzerFeature[];\n};\n\n/**\n * An object describing an Analyzer.\n */\nexport type AnalyzerDescription =\n | IdentityAnalyzerDescription\n | DelimiterAnalyzerDescription\n | StemAnalyzerDescription\n | NormAnalyzerDescription\n | NgramAnalyzerDescription\n | TextAnalyzerDescription\n | SegmentationAnalyzerDescription\n | AqlAnalyzerDescription\n | PipelineAnalyzerDescription\n | StopwordsAnalyzerDescription\n | CollationAnalyzerDescription\n | MinHashAnalyzerDescription\n | ClassificationAnalyzerDescription\n | NearestNeighborsAnalyzerDescription\n | GeoJsonAnalyzerDescription\n | GeoPointAnalyzerDescription\n | GeoS2AnalyzerDescription;\n\n/**\n * An object describing an Identity Analyzer.\n */\nexport type IdentityAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"identity\";\n properties: Record<string, never>;\n};\n\n/**\n * An object describing a Delimiter Analyzer.\n */\nexport type DelimiterAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"delimiter\";\n properties: { delimiter: string };\n};\n\n/**\n * An object describing a Stem Analyzer.\n */\nexport type StemAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"stem\";\n properties: { locale: string };\n};\n\n/**\n * An object describing a Norm Analyzer.\n */\nexport type NormAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"norm\";\n properties: {\n locale: string;\n case: \"lower\" | \"none\" | \"upper\";\n accent: boolean;\n };\n};\n\n/**\n * An object describing an Ngram Analyzer.\n */\nexport type NgramAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"ngram\";\n properties: {\n max: number;\n min: number;\n preserveOriginal: boolean;\n };\n};\n\n/**\n * An object describing a Text Analyzer.\n */\nexport type TextAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"text\";\n properties: {\n locale: string;\n case: \"lower\" | \"none\" | \"upper\";\n stopwords: string[];\n stopwordsPath: string;\n accent: boolean;\n stemming: boolean;\n edgeNgram: { min: number; max: number; preserveOriginal: boolean };\n };\n};\n\n/**\n * An object describing a Segmentation Analyzer\n */\nexport type SegmentationAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"segmentation\";\n properties: {\n break: \"all\" | \"alpha\" | \"graphic\";\n case: \"lower\" | \"upper\" | \"none\";\n };\n};\n\n/**\n * An object describing an AQL Analyzer\n */\nexport type AqlAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"aql\";\n properties: {\n queryString: string;\n collapsePositions: boolean;\n keepNull: boolean;\n batchSize: number;\n memoryLimit: number;\n returnType: \"string\" | \"number\" | \"bool\";\n };\n};\n\n/**\n * An object describing a Pipeline Analyzer\n */\nexport type PipelineAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"pipeline\";\n properties: {\n pipeline: Omit<AnalyzerDescription, \"name\" | \"features\">[];\n };\n};\n\n/**\n * An object describing a Stopwords Analyzer\n */\nexport type StopwordsAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"stopwords\";\n properties: {\n stopwords: string[];\n hex: boolean;\n };\n};\n\n/**\n * An object describing a Collation Analyzer\n */\nexport type CollationAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"collation\";\n properties: {\n locale: string;\n };\n};\n\n/**\n * (Enterprise Edition only.) An object describing a MinHash Analyzer\n */\nexport type MinHashAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"minhash\";\n properties: {\n analyzer: Omit<AnalyzerDescription, \"name\" | \"features\">;\n numHashes: number;\n };\n};\n\n/**\n * (Enterprise Edition only.) An object describing a Classification Analyzer\n */\nexport type ClassificationAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"classification\";\n properties: {\n model_location: string;\n top_k: number;\n threshold: number;\n };\n};\n\n/**\n * (Enterprise Edition only.) An object describing a NearestNeighbors Analyzer\n */\nexport type NearestNeighborsAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"nearest_neighbors\";\n properties: {\n model_location: string;\n top_k: number;\n };\n};\n\n/**\n * An object describing a GeoJSON Analyzer\n */\nexport type GeoJsonAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"geojson\";\n properties: {\n type: \"shape\" | \"centroid\" | \"point\";\n description: { maxCells: number; minLevel: number; maxLevel: number };\n };\n};\n\n/**\n * An object describing a GeoPoint Analyzer\n */\nexport type GeoPointAnalyzerDescription = GenericAnalyzerDescription & {\n type: \"geopoint\";\n properties: {\n latitude: string[];\n longitude: string[];\n description: { minCells: number; minLevel: number; maxLevel: number };\n };\n};\n\n/**\n * (Enterprise Edition only.) An object describing a GeoS2 Analyzer\n */\nexport type GeoS2AnalyzerDescription = GenericAnalyzerDescription & {\n type: \"geo_s2\";\n properties: {\n type: \"shape\" | \"centroid\" | \"point\";\n description: { maxCells: number; minLevel: number; maxLevel: number };\n format: \"latLngDouble\" | \"latLngInt\" | \"s2Point\";\n };\n};\n\n/**\n * Represents an Analyzer in a {@link database.Database}.\n */\nexport class Analyzer {\n protected _name: string;\n protected _db: Database;\n\n /**\n * @internal\n */\n constructor(db: Database, name: string) {\n this._db = db;\n this._name = name.normalize(\"NFC\");\n }\n\n /**\n * @internal\n *\n * Indicates that this object represents an ArangoDB Analyzer.\n */\n get isArangoAnalyzer(): true {\n return true;\n }\n\n /**\n * Name of this Analyzer.\n *\n * See also {@link database.Database}.\n */\n get name() {\n return this._name;\n }\n\n /**\n * Checks whether the Analyzer exists.\n *\n * @example\n * ```js\n * const db = new Database();\n * const analyzer = db.analyzer(\"some-analyzer\");\n * const result = await analyzer.exists();\n * // result indicates whether the Analyzer exists\n * ```\n */\n async exists(): Promise<boolean> {\n try {\n await this.get();\n return true;\n } catch (err: any) {\n if (isArangoError(err) && err.errorNum === ANALYZER_NOT_FOUND) {\n return false;\n }\n throw err;\n }\n }\n\n /**\n * Retrieves the Analyzer definition for the Analyzer.\n *\n * @example\n * ```js\n * const db = new Database();\n * const analyzer = db.analyzer(\"some-analyzer\");\n * const definition = await analyzer.get();\n * // definition contains the Analyzer definition\n * ```\n */\n get(): Promise<ArangoApiResponse<AnalyzerDescription>> {\n return this._db.request({\n path: `/_api/analyzer/${encodeURIComponent(this._name)}`,\n });\n }\n\n /**\n * Creates a new Analyzer with the given `options` and the instance's name.\n *\n * See also {@link database.Database#createAnalyzer}.\n *\n * @param options - Options for creating the Analyzer.\n *\n * @example\n * ```js\n * const db = new Database();\n * const analyzer = db.analyzer(\"potatoes\");\n * await analyzer.create({ type: \"identity\" });\n * // the identity Analyzer \"potatoes\" now exists\n * ```\n */\n create<Options extends CreateAnalyzerOptions>(\n options: Options\n ): Promise<\n Options extends CreateIdentityAnalyzerOptions\n ? IdentityAnalyzerDescription\n : Options extends CreateDelimiterAnalyzerOptions\n ? DelimiterAnalyzerDescription\n : Options extends CreateStemAnalyzerOptions\n ? StemAnalyzerDescription\n : Options extends CreateNormAnalyzerOptions\n ? NormAnalyzerDescription\n : Options extends CreateNgramAnalyzerOptions\n ? NgramAnalyzerDescription\n : Options extends CreateTextAnalyzerOptions\n ? TextAnalyzerDescription\n : Options extends CreateSegmentationAnalyzerOptions\n ? SegmentationAnalyzerDescription\n : Options extends CreateAqlAnalyzerOptions\n ? AqlAnalyzerDescription\n : Options extends CreatePipelineAnalyzerOptions\n ? PipelineAnalyzerDescription\n : Options extends CreateStopwordsAnalyzerOptions\n ? StopwordsAnalyzerDescription\n : Options extends CreateCollationAnalyzerOptions\n ? CollationAnalyzerDescription\n : Options extends CreateMinHashAnalyzerOptions\n ? MinHashAnalyzerDescription\n : Options extends CreateClassificationAnalyzerOptions\n ? ClassificationAnalyzerDescription\n : Options extends CreateNearestNeighborsAnalyzerOptions\n ? NearestNeighborsAnalyzerDescription\n : Options extends CreateGeoJsonAnalyzerOptions\n ? GeoJsonAnalyzerDescription\n : Options extends CreateGeoPointAnalyzerOptions\n ? GeoPointAnalyzerDescription\n : Options extends CreateGeoS2AnalyzerOptions\n ? GeoS2AnalyzerDescription\n : AnalyzerDescription\n > {\n return this._db.request({\n method: \"POST\",\n path: \"/_api/analyzer\",\n body: { name: this._name, ...options },\n });\n }\n\n /**\n * Deletes the Analyzer from the database.\n *\n * @param force - Whether the Analyzer should still be deleted even if it\n * is currently in use.\n *\n * @example\n * ```js\n * const db = new Database();\n * const analyzer = db.analyzer(\"some-analyzer\");\n * await analyzer.drop();\n * // the Analyzer \"some-analyzer\" no longer exists\n * ```\n */\n drop(force: boolean = false): Promise<ArangoApiResponse<{ name: string }>> {\n return this._db.request({\n method: \"DELETE\",\n path: `/_api/analyzer/${encodeURIComponent(this._name)}`,\n qs: { force },\n });\n }\n}\n"]}
package/aql.d.ts CHANGED
@@ -1,11 +1,13 @@
1
1
  import { ArangoCollection } from "./collection";
2
2
  import { Graph } from "./graph";
3
3
  import { View } from "./view";
4
+ declare const type: unique symbol;
4
5
  /**
5
6
  * Generic AQL query object consisting of an AQL query string and its bind
6
7
  * parameters.
7
8
  */
8
- export interface AqlQuery {
9
+ export interface AqlQuery<T = any> {
10
+ [type]?: T;
9
11
  /**
10
12
  * An AQL query string.
11
13
  */
@@ -25,7 +27,7 @@ export interface AqlQuery {
25
27
  *
26
28
  * @internal
27
29
  */
28
- export interface GeneratedAqlQuery extends AqlQuery {
30
+ export interface GeneratedAqlQuery<T = any> extends AqlQuery<T> {
29
31
  /**
30
32
  * @internal
31
33
  */
@@ -164,7 +166,7 @@ export declare function isAqlLiteral(literal: any): literal is AqlLiteral;
164
166
  * `);
165
167
  * ```
166
168
  */
167
- export declare function aql(templateStrings: TemplateStringsArray, ...args: AqlValue[]): GeneratedAqlQuery;
169
+ export declare function aql<T = any>(templateStrings: TemplateStringsArray, ...args: AqlValue[]): GeneratedAqlQuery<T>;
168
170
  /**
169
171
  * Marks an arbitrary scalar value (i.e. a string, number or boolean) as
170
172
  * safe for being inlined directly into AQL queries when used in an `aql`
@@ -283,4 +285,5 @@ export declare function literal(value: string | number | boolean | AqlLiteral |
283
285
  * ```
284
286
  */
285
287
  export declare function join(values: AqlValue[], sep?: string): GeneratedAqlQuery;
288
+ export {};
286
289
  //# sourceMappingURL=aql.d.ts.map
package/aql.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"aql.d.ts","sourceRoot":"","sources":["../src/aql.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,gBAAg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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,SAAgB,IAAI,CAAC,MAAkB,EAAE,MAAc,GAAG;IACxD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;QAClB,OAAO,GAAG,CAAA,EAAE,CAAC;KACd;IACD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;QACvB,OAAO,GAAG,CAAA,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;KAC1B;IACD,OAAO,GAAG,CAAC,CAAC,EAAE,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAQ,EAAE,GAAG,MAAM,CAAC,CAAC;AAChF,CAAC;AARD,oBAQC","sourcesContent":["/**\n * ```js\n * import { aql } from \"arangojs/aql\";\n * ```\n *\n * The \"aql\" module provides the {@link aql} template string handler and\n * helper functions, as well as associated types and interfaces for TypeScript.\n *\n * The aql function and namespace is also re-exported by the \"index\" module.\n *\n * @packageDocumentation\n */\nimport { isArangoAnalyzer } from \"./analyzer\";\nimport { ArangoCollection, isArangoCollection } from \"./collection\";\nimport { Graph, isArangoGraph } from \"./graph\";\nimport { isArangoView, View } from \"./view\";\n\n/**\n * Generic AQL query object consisting of an AQL query string and its bind\n * parameters.\n */\nexport interface AqlQuery {\n /**\n * An AQL query string.\n */\n query: string;\n /**\n * An object mapping AQL bind parameter names to their respective values.\n *\n * Names of parameters representing collections are prefixed with an\n * at-symbol.\n */\n bindVars: Record<string, any>;\n}\n\n/**\n * Derived type representing AQL query objects generated by the AQL helper\n * functions and the AQL template string handler. These objects can be fed\n * back into these helper functions to be inlined or merged in complex queries.\n *\n * @internal\n */\nexport interface GeneratedAqlQuery extends AqlQuery {\n /**\n * @internal\n */\n _source: () => { strings: string[]; args: AqlValue[] };\n}\n\n/**\n * An object representing a trusted AQL literal that will be inlined directly\n * when used in an AQL template or passed to AQL helper functions.\n *\n * Arbitrary values can be converted to trusted AQL literals by passing them\n * to the {@link literal} helper function.\n */\nexport interface AqlLiteral {\n /**\n * @internal\n *\n * Returns a string representation of this AQL literal that can be inlined\n * in an AQL template.\n */\n toAQL: () => string;\n}\n\n/**\n * A value that can be used in an AQL template string or passed to an AQL\n * helper function.\n */\nexport type AqlValue =\n | ArangoCollection\n | View\n | Graph\n | GeneratedAqlQuery\n | AqlLiteral\n | string\n | number\n | boolean\n | null\n | undefined\n | Record<string, any>\n | any[];\n\n/**\n * Indicates whether the given value is an {@link AqlQuery}.\n *\n * @param query - A value that might be an `AqlQuery`.\n */\nexport function isAqlQuery(query: any): query is AqlQuery {\n return Boolean(query && typeof query.query === \"string\" && query.bindVars);\n}\n\n/**\n * Indicates whether the given value is a {@link GeneratedAqlQuery}.\n *\n * @param query - A value that might be a `GeneratedAqlQuery`.\n *\n * @internal\n */\nexport function isGeneratedAqlQuery(query: any): query is GeneratedAqlQuery {\n return isAqlQuery(query) && typeof (query as any)._source === \"function\";\n}\n\n/**\n * Indicates whether the given value is an {@link AqlLiteral}.\n *\n * @param literal - A value that might be an `AqlLiteral`.\n */\nexport function isAqlLiteral(literal: any): literal is AqlLiteral {\n return Boolean(literal && typeof literal.toAQL === \"function\");\n}\n\n/**\n * Template string handler (template tag) for AQL queries.\n *\n * The `aql` tag can be used to write complex AQL queries as multi-line strings\n * without having to worry about `bindVars` and the distinction between\n * collections and regular parameters.\n *\n * Tagged template strings will return an {@link AqlQuery} object with\n * `query` and `bindVars` attributes reflecting any interpolated values.\n *\n * Any {@link collection.ArangoCollection} instance used in a query string will\n * be recognized as a collection reference and generate an AQL collection bind\n * parameter instead of a regular AQL value bind parameter.\n *\n * **Note**: you should always use the `aql` template tag when writing\n * dynamic AQL queries instead of using untagged (normal) template strings.\n * Untagged template strings will inline any interpolated values and return\n * a plain string as result. The `aql` template tag will only inline references\n * to the interpolated values and produce an AQL query object containing both\n * the query and the values. This prevents most injection attacks when using\n * untrusted values in dynamic queries.\n *\n * @example\n * ```js\n * // Some user-supplied string that may be malicious\n * const untrustedValue = req.body.email;\n *\n * // Without aql tag: BAD! DO NOT DO THIS!\n * const badQuery = `\n * FOR user IN users\n * FILTER user.email == \"${untrustedValue}\"\n * RETURN user\n * `;\n * // e.g. if untrustedValue is '\" || user.admin == true || \"':\n * // Query:\n * // FOR user IN users\n * // FILTER user.email == \"\" || user.admin == true || \"\"\n * // RETURN user\n *\n * // With the aql tag: GOOD! MUCH SAFER!\n * const betterQuery = aql`\n * FOR user IN users\n * FILTER user.email == ${untrustedValue}\n * RETURN user\n * `;\n * // Query:\n * // FOR user IN users\n * // FILTER user.email == @value0\n * // RETURN user\n * // Bind parameters:\n * // value0 -> untrustedValue\n * ```\n *\n * @example\n * ```js\n * const collection = db.collection(\"some-collection\");\n * const minValue = 23;\n * const result = await db.query(aql`\n * FOR d IN ${collection}\n * FILTER d.num > ${minValue}\n * RETURN d\n * `);\n *\n * // Equivalent raw query object\n * const result2 = await db.query({\n * query: `\n * FOR d IN @@collection\n * FILTER d.num > @minValue\n * RETURN d\n * `,\n * bindVars: {\n * \"@collection\": collection.name,\n * minValue: minValue\n * }\n * });\n * ```\n *\n * @example\n * ```js\n * const collection = db.collection(\"some-collection\");\n * const color = \"green\";\n * const filter = aql`FILTER d.color == ${color}'`;\n * const result = await db.query(aql`\n * FOR d IN ${collection}\n * ${filter}\n * RETURN d\n * `);\n * ```\n */\nexport function aql(\n templateStrings: TemplateStringsArray,\n ...args: AqlValue[]\n): GeneratedAqlQuery {\n const strings = [...templateStrings];\n const bindVars: Record<string, any> = {};\n const bindValues = [];\n let query = strings[0];\n for (let i = 0; i < args.length; i++) {\n const rawValue = args[i];\n let value = rawValue;\n if (isGeneratedAqlQuery(rawValue)) {\n const src = rawValue._source();\n if (src.args.length) {\n query += src.strings[0];\n args.splice(i, 1, ...src.args);\n strings.splice(\n i,\n 2,\n strings[i] + src.strings[0],\n ...src.strings.slice(1, src.args.length),\n src.strings[src.args.length] + strings[i + 1]\n );\n } else {\n query += rawValue.query + strings[i + 1];\n args.splice(i, 1);\n strings.splice(i, 2, strings[i] + rawValue.query + strings[i + 1]);\n }\n i -= 1;\n continue;\n }\n if (rawValue === undefined) {\n query += strings[i + 1];\n continue;\n }\n if (isAqlLiteral(rawValue)) {\n query += `${rawValue.toAQL()}${strings[i + 1]}`;\n continue;\n }\n const index = bindValues.indexOf(rawValue);\n const isKnown = index !== -1;\n let name = `value${isKnown ? index : bindValues.length}`;\n if (\n isArangoCollection(rawValue) ||\n isArangoGraph(rawValue) ||\n isArangoView(rawValue) ||\n isArangoAnalyzer(rawValue)\n ) {\n name = `@${name}`;\n value = rawValue.name;\n }\n if (!isKnown) {\n bindValues.push(rawValue);\n bindVars[name] = value;\n }\n query += `@${name}${strings[i + 1]}`;\n }\n return {\n query,\n bindVars,\n _source: () => ({ strings, args }),\n };\n}\n\n/**\n * Marks an arbitrary scalar value (i.e. a string, number or boolean) as\n * safe for being inlined directly into AQL queries when used in an `aql`\n * template string, rather than being converted into a bind parameter.\n *\n * **Note**: Nesting `aql` template strings is a much safer alternative for\n * most use cases. This low-level helper function only exists to help with\n * rare edge cases where a trusted AQL query fragment must be read from a\n * string (e.g. when reading query fragments from JSON) and should only be\n * used as a last resort.\n *\n * @example\n * ```js\n * // BAD! DO NOT DO THIS!\n * const sortDirection = literal('ASC');\n *\n * // GOOD! DO THIS INSTEAD!\n * const sortDirection = aql`ASC`;\n * ```\n *\n * @example\n * ```js\n * // BAD! DO NOT DO THIS!\n * const filterColor = literal('FILTER d.color == \"green\"');\n * const result = await db.query(aql`\n * FOR d IN some-collection\n * ${filterColor}\n * RETURN d\n * `);\n *\n * // GOOD! DO THIS INSTEAD!\n * const color = \"green\";\n * const filterColor = aql`FILTER d.color === ${color}`;\n * const result = await db.query(aql`\n * FOR d IN some-collection\n * ${filterColor}\n * RETURN d\n * `);\n * ```\n *\n * @example\n * ```js\n * // WARNING: We explicitly trust the environment variable to be safe!\n * const filter = literal(process.env.FILTER_STATEMENT);\n * const users = await db.query(aql`\n * FOR user IN users\n * ${filter}\n * RETURN user\n * `);\n * ```\n */\nexport function literal(\n value: string | number | boolean | AqlLiteral | null | undefined\n): AqlLiteral {\n if (isAqlLiteral(value)) {\n return value;\n }\n return {\n toAQL() {\n if (value === undefined) {\n return \"\";\n }\n return String(value);\n },\n };\n}\n\n/**\n * Constructs {@link AqlQuery} objects from an array of arbitrary values.\n *\n * **Note**: Nesting `aql` template strings is a much safer alternative\n * for most use cases. This low-level helper function only exists to\n * complement the `aql` tag when constructing complex queries from dynamic\n * arrays of query fragments.\n *\n * @param values - Array of values to join. These values will behave exactly\n * like values interpolated in an `aql` template string.\n * @param sep - Seperator to insert between values. This value will behave\n * exactly like a value passed to {@link literal}, i.e. it will be\n * inlined as-is, rather than being converted into a bind parameter.\n *\n * @example\n * ```js\n * const users = db.collection(\"users\");\n * const filters = [];\n * if (adminsOnly) filters.push(aql`FILTER user.admin`);\n * if (activeOnly) filters.push(aql`FILTER user.active`);\n * const result = await db.query(aql`\n * FOR user IN ${users}\n * ${join(filters)}\n * RETURN user\n * `);\n * ```\n *\n * @example\n * ```js\n * const users = db.collection(\"users\");\n * const keys = [\"jreyes\", \"ghermann\"];\n *\n * // BAD! NEEDLESSLY COMPLEX!\n * const docs = keys.map(key => aql`DOCUMENT(${users}, ${key}`));\n * const result = await db.query(aql`\n * FOR user IN [\n * ${join(docs, \", \")}\n * ]\n * RETURN user\n * `);\n * // Query:\n * // FOR user IN [\n * // DOCUMENT(@@value0, @value1), DOCUMENT(@@value0, @value2)\n * // ]\n * // RETURN user\n * // Bind parameters:\n * // @value0 -> \"users\"\n * // value1 -> \"jreyes\"\n * // value2 -> \"ghermann\"\n *\n * // GOOD! MUCH SIMPLER!\n * const result = await db.query(aql`\n * FOR key IN ${keys}\n * LET user = DOCUMENT(${users}, key)\n * RETURN user\n * `);\n * // Query:\n * // FOR user IN @value0\n * // LET user = DOCUMENT(@@value1, key)\n * // RETURN user\n * // Bind parameters:\n * // value0 -> [\"jreyes\", \"ghermann\"]\n * // @value1 -> \"users\"\n * ```\n */\nexport function join(values: AqlValue[], sep: string = \" \"): GeneratedAqlQuery {\n if (!values.length) {\n return aql``;\n }\n if (values.length === 1) {\n return aql`${values[0]}`;\n }\n return aql([\"\", ...Array(values.length - 1).fill(sep), \"\"] as any, ...values);\n}\n"]}
1
+ {"version":3,"file":"aql.js","sourceRoot":"","sources":["../src/aql.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;GAWG;AACH,yCAA8C;AAC9C,6CAAoE;AACpE,mCAA+C;AAC/C,iCAA4C;AAwE5C;;;;GAIG;AACH,SAAgB,UAAU,CAAC,KAAU;IACnC,OAAO,OAAO,CAAC,KAAK,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC;AAC7E,CAAC;AAFD,gCAEC;AAED;;;;;;GAMG;AACH,SAAgB,mBAAmB,CAAC,KAAU;IAC5C,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,OAAQ,KAAa,CAAC,OAAO,KAAK,UAAU,CAAC;AAC3E,CAAC;AAFD,kDAEC;AAED;;;;GAIG;AACH,SAAgB,YAAY,CAAC,OAAY;IACvC,OAAO,OAAO,CAAC,OAAO,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,UAAU,CAAC,CAAC;AACjE,CAAC;AAFD,oCAEC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwFG;AACH,SAAgB,GAAG,CACjB,eAAqC,EACrC,GAAG,IAAgB;IAEnB,MAAM,OAAO,GAAG,CAAC,GAAG,eAAe,CAAC,CAAC;IACrC,MAAM,QAAQ,GAAwB,EAAE,CAAC;IACzC,MAAM,UAAU,GAAG,EAAE,CAAC;IACtB,IAAI,KAAK,GAAG,OAAO,CAAC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;IAEhE,IAAI,YAAY,CAAC,KAAK,CAAC,EAAE;QACvB,OAAO,KAAK,CAAC;KACd;IACD,OAAO;QACL,KAAK;YACH,IAAI,KAAK,KAAK,SAAS,EAAE;gBACvB,OAAO,EAAE,CAAC;aACX;YACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC;AAdD,0BAcC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,SAAgB,IAAI,CAAC,MAAkB,EAAE,MAAc,GAAG;IACxD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;QAClB,OAAO,GAAG,CAAA,EAAE,CAAC;KACd;IACD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;QACvB,OAAO,GAAG,CAAA,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;KAC1B;IACD,OAAO,GAAG,CAAC,CAAC,EAAE,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAQ,EAAE,GAAG,MAAM,CAAC,CAAC;AAChF,CAAC;AARD,oBAQC","sourcesContent":["/**\n * ```js\n * import { aql } from \"arangojs/aql\";\n * ```\n *\n * The \"aql\" module provides the {@link aql} template string handler and\n * helper functions, as well as associated types and interfaces for TypeScript.\n *\n * The aql function and namespace is also re-exported by the \"index\" module.\n *\n * @packageDocumentation\n */\nimport { isArangoAnalyzer } from \"./analyzer\";\nimport { ArangoCollection, isArangoCollection } from \"./collection\";\nimport { Graph, isArangoGraph } from \"./graph\";\nimport { isArangoView, View } from \"./view\";\n\ndeclare const type: unique symbol;\n\n/**\n * Generic AQL query object consisting of an AQL query string and its bind\n * parameters.\n */\nexport interface AqlQuery<T = any> {\n [type]?: T;\n /**\n * An AQL query string.\n */\n query: string;\n /**\n * An object mapping AQL bind parameter names to their respective values.\n *\n * Names of parameters representing collections are prefixed with an\n * at-symbol.\n */\n bindVars: Record<string, any>;\n}\n\n/**\n * Derived type representing AQL query objects generated by the AQL helper\n * functions and the AQL template string handler. These objects can be fed\n * back into these helper functions to be inlined or merged in complex queries.\n *\n * @internal\n */\nexport interface GeneratedAqlQuery<T = any> extends AqlQuery<T> {\n /**\n * @internal\n */\n _source: () => { strings: string[]; args: AqlValue[] };\n}\n\n/**\n * An object representing a trusted AQL literal that will be inlined directly\n * when used in an AQL template or passed to AQL helper functions.\n *\n * Arbitrary values can be converted to trusted AQL literals by passing them\n * to the {@link literal} helper function.\n */\nexport interface AqlLiteral {\n /**\n * @internal\n *\n * Returns a string representation of this AQL literal that can be inlined\n * in an AQL template.\n */\n toAQL: () => string;\n}\n\n/**\n * A value that can be used in an AQL template string or passed to an AQL\n * helper function.\n */\nexport type AqlValue =\n | ArangoCollection\n | View\n | Graph\n | GeneratedAqlQuery\n | AqlLiteral\n | string\n | number\n | boolean\n | null\n | undefined\n | Record<string, any>\n | any[];\n\n/**\n * Indicates whether the given value is an {@link AqlQuery}.\n *\n * @param query - A value that might be an `AqlQuery`.\n */\nexport function isAqlQuery(query: any): query is AqlQuery {\n return Boolean(query && typeof query.query === \"string\" && query.bindVars);\n}\n\n/**\n * Indicates whether the given value is a {@link GeneratedAqlQuery}.\n *\n * @param query - A value that might be a `GeneratedAqlQuery`.\n *\n * @internal\n */\nexport function isGeneratedAqlQuery(query: any): query is GeneratedAqlQuery {\n return isAqlQuery(query) && typeof (query as any)._source === \"function\";\n}\n\n/**\n * Indicates whether the given value is an {@link AqlLiteral}.\n *\n * @param literal - A value that might be an `AqlLiteral`.\n */\nexport function isAqlLiteral(literal: any): literal is AqlLiteral {\n return Boolean(literal && typeof literal.toAQL === \"function\");\n}\n\n/**\n * Template string handler (template tag) for AQL queries.\n *\n * The `aql` tag can be used to write complex AQL queries as multi-line strings\n * without having to worry about `bindVars` and the distinction between\n * collections and regular parameters.\n *\n * Tagged template strings will return an {@link AqlQuery} object with\n * `query` and `bindVars` attributes reflecting any interpolated values.\n *\n * Any {@link collection.ArangoCollection} instance used in a query string will\n * be recognized as a collection reference and generate an AQL collection bind\n * parameter instead of a regular AQL value bind parameter.\n *\n * **Note**: you should always use the `aql` template tag when writing\n * dynamic AQL queries instead of using untagged (normal) template strings.\n * Untagged template strings will inline any interpolated values and return\n * a plain string as result. The `aql` template tag will only inline references\n * to the interpolated values and produce an AQL query object containing both\n * the query and the values. This prevents most injection attacks when using\n * untrusted values in dynamic queries.\n *\n * @example\n * ```js\n * // Some user-supplied string that may be malicious\n * const untrustedValue = req.body.email;\n *\n * // Without aql tag: BAD! DO NOT DO THIS!\n * const badQuery = `\n * FOR user IN users\n * FILTER user.email == \"${untrustedValue}\"\n * RETURN user\n * `;\n * // e.g. if untrustedValue is '\" || user.admin == true || \"':\n * // Query:\n * // FOR user IN users\n * // FILTER user.email == \"\" || user.admin == true || \"\"\n * // RETURN user\n *\n * // With the aql tag: GOOD! MUCH SAFER!\n * const betterQuery = aql`\n * FOR user IN users\n * FILTER user.email == ${untrustedValue}\n * RETURN user\n * `;\n * // Query:\n * // FOR user IN users\n * // FILTER user.email == @value0\n * // RETURN user\n * // Bind parameters:\n * // value0 -> untrustedValue\n * ```\n *\n * @example\n * ```js\n * const collection = db.collection(\"some-collection\");\n * const minValue = 23;\n * const result = await db.query(aql`\n * FOR d IN ${collection}\n * FILTER d.num > ${minValue}\n * RETURN d\n * `);\n *\n * // Equivalent raw query object\n * const result2 = await db.query({\n * query: `\n * FOR d IN @@collection\n * FILTER d.num > @minValue\n * RETURN d\n * `,\n * bindVars: {\n * \"@collection\": collection.name,\n * minValue: minValue\n * }\n * });\n * ```\n *\n * @example\n * ```js\n * const collection = db.collection(\"some-collection\");\n * const color = \"green\";\n * const filter = aql`FILTER d.color == ${color}'`;\n * const result = await db.query(aql`\n * FOR d IN ${collection}\n * ${filter}\n * RETURN d\n * `);\n * ```\n */\nexport function aql<T = any>(\n templateStrings: TemplateStringsArray,\n ...args: AqlValue[]\n): GeneratedAqlQuery<T> {\n const strings = [...templateStrings];\n const bindVars: Record<string, any> = {};\n const bindValues = [];\n let query = strings[0];\n for (let i = 0; i < args.length; i++) {\n const rawValue = args[i];\n let value = rawValue;\n if (isGeneratedAqlQuery(rawValue)) {\n const src = rawValue._source();\n if (src.args.length) {\n query += src.strings[0];\n args.splice(i, 1, ...src.args);\n strings.splice(\n i,\n 2,\n strings[i] + src.strings[0],\n ...src.strings.slice(1, src.args.length),\n src.strings[src.args.length] + strings[i + 1]\n );\n } else {\n query += rawValue.query + strings[i + 1];\n args.splice(i, 1);\n strings.splice(i, 2, strings[i] + rawValue.query + strings[i + 1]);\n }\n i -= 1;\n continue;\n }\n if (rawValue === undefined) {\n query += strings[i + 1];\n continue;\n }\n if (isAqlLiteral(rawValue)) {\n query += `${rawValue.toAQL()}${strings[i + 1]}`;\n continue;\n }\n const index = bindValues.indexOf(rawValue);\n const isKnown = index !== -1;\n let name = `value${isKnown ? index : bindValues.length}`;\n if (\n isArangoCollection(rawValue) ||\n isArangoGraph(rawValue) ||\n isArangoView(rawValue) ||\n isArangoAnalyzer(rawValue)\n ) {\n name = `@${name}`;\n value = rawValue.name;\n }\n if (!isKnown) {\n bindValues.push(rawValue);\n bindVars[name] = value;\n }\n query += `@${name}${strings[i + 1]}`;\n }\n return {\n query,\n bindVars,\n _source: () => ({ strings, args }),\n };\n}\n\n/**\n * Marks an arbitrary scalar value (i.e. a string, number or boolean) as\n * safe for being inlined directly into AQL queries when used in an `aql`\n * template string, rather than being converted into a bind parameter.\n *\n * **Note**: Nesting `aql` template strings is a much safer alternative for\n * most use cases. This low-level helper function only exists to help with\n * rare edge cases where a trusted AQL query fragment must be read from a\n * string (e.g. when reading query fragments from JSON) and should only be\n * used as a last resort.\n *\n * @example\n * ```js\n * // BAD! DO NOT DO THIS!\n * const sortDirection = literal('ASC');\n *\n * // GOOD! DO THIS INSTEAD!\n * const sortDirection = aql`ASC`;\n * ```\n *\n * @example\n * ```js\n * // BAD! DO NOT DO THIS!\n * const filterColor = literal('FILTER d.color == \"green\"');\n * const result = await db.query(aql`\n * FOR d IN some-collection\n * ${filterColor}\n * RETURN d\n * `);\n *\n * // GOOD! DO THIS INSTEAD!\n * const color = \"green\";\n * const filterColor = aql`FILTER d.color === ${color}`;\n * const result = await db.query(aql`\n * FOR d IN some-collection\n * ${filterColor}\n * RETURN d\n * `);\n * ```\n *\n * @example\n * ```js\n * // WARNING: We explicitly trust the environment variable to be safe!\n * const filter = literal(process.env.FILTER_STATEMENT);\n * const users = await db.query(aql`\n * FOR user IN users\n * ${filter}\n * RETURN user\n * `);\n * ```\n */\nexport function literal(\n value: string | number | boolean | AqlLiteral | null | undefined\n): AqlLiteral {\n if (isAqlLiteral(value)) {\n return value;\n }\n return {\n toAQL() {\n if (value === undefined) {\n return \"\";\n }\n return String(value);\n },\n };\n}\n\n/**\n * Constructs {@link AqlQuery} objects from an array of arbitrary values.\n *\n * **Note**: Nesting `aql` template strings is a much safer alternative\n * for most use cases. This low-level helper function only exists to\n * complement the `aql` tag when constructing complex queries from dynamic\n * arrays of query fragments.\n *\n * @param values - Array of values to join. These values will behave exactly\n * like values interpolated in an `aql` template string.\n * @param sep - Seperator to insert between values. This value will behave\n * exactly like a value passed to {@link literal}, i.e. it will be\n * inlined as-is, rather than being converted into a bind parameter.\n *\n * @example\n * ```js\n * const users = db.collection(\"users\");\n * const filters = [];\n * if (adminsOnly) filters.push(aql`FILTER user.admin`);\n * if (activeOnly) filters.push(aql`FILTER user.active`);\n * const result = await db.query(aql`\n * FOR user IN ${users}\n * ${join(filters)}\n * RETURN user\n * `);\n * ```\n *\n * @example\n * ```js\n * const users = db.collection(\"users\");\n * const keys = [\"jreyes\", \"ghermann\"];\n *\n * // BAD! NEEDLESSLY COMPLEX!\n * const docs = keys.map(key => aql`DOCUMENT(${users}, ${key}`));\n * const result = await db.query(aql`\n * FOR user IN [\n * ${join(docs, \", \")}\n * ]\n * RETURN user\n * `);\n * // Query:\n * // FOR user IN [\n * // DOCUMENT(@@value0, @value1), DOCUMENT(@@value0, @value2)\n * // ]\n * // RETURN user\n * // Bind parameters:\n * // @value0 -> \"users\"\n * // value1 -> \"jreyes\"\n * // value2 -> \"ghermann\"\n *\n * // GOOD! MUCH SIMPLER!\n * const result = await db.query(aql`\n * FOR key IN ${keys}\n * LET user = DOCUMENT(${users}, key)\n * RETURN user\n * `);\n * // Query:\n * // FOR user IN @value0\n * // LET user = DOCUMENT(@@value1, key)\n * // RETURN user\n * // Bind parameters:\n * // value0 -> [\"jreyes\", \"ghermann\"]\n * // @value1 -> \"users\"\n * ```\n */\nexport function join(values: AqlValue[], sep: string = \" \"): GeneratedAqlQuery {\n if (!values.length) {\n return aql``;\n }\n if (values.length === 1) {\n return aql`${values[0]}`;\n }\n return aql([\"\", ...Array(values.length - 1).fill(sep), \"\"] as any, ...values);\n}\n"]}