arangojs 7.8.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +264 -3
- package/CONTRIBUTING.md +1 -1
- package/MIGRATING.md +126 -2
- package/README.md +7 -13
- package/analyzer.d.ts +531 -253
- package/analyzer.d.ts.map +1 -1
- package/analyzer.js +9 -8
- package/analyzer.js.map +1 -1
- package/aql.d.ts +122 -139
- package/aql.d.ts.map +1 -1
- package/aql.js +146 -148
- package/aql.js.map +1 -1
- package/collection.d.ts +311 -310
- package/collection.d.ts.map +1 -1
- package/collection.js +163 -96
- package/collection.js.map +1 -1
- package/connection.d.ts +65 -52
- package/connection.d.ts.map +1 -1
- package/connection.js +142 -140
- package/connection.js.map +1 -1
- package/cursor.d.ts +108 -26
- package/cursor.d.ts.map +1 -1
- package/cursor.js +24 -23
- package/cursor.js.map +1 -1
- package/database.d.ts +298 -330
- package/database.d.ts.map +1 -1
- package/database.js +178 -252
- package/database.js.map +1 -1
- package/documents.d.ts +3 -4
- package/documents.d.ts.map +1 -1
- package/documents.js +0 -1
- package/documents.js.map +1 -1
- package/error.d.ts +3 -6
- package/error.d.ts.map +1 -1
- package/error.js +5 -7
- package/error.js.map +1 -1
- package/foxx-manifest.d.ts +7 -8
- package/foxx-manifest.d.ts.map +1 -1
- package/foxx-manifest.js +1 -1
- package/foxx-manifest.js.map +1 -1
- package/graph.d.ts +38 -56
- package/graph.d.ts.map +1 -1
- package/graph.js +59 -63
- package/graph.js.map +1 -1
- package/index.d.ts +6 -8
- package/index.d.ts.map +1 -1
- package/index.js +1 -6
- package/index.js.map +1 -1
- package/indexes.d.ts +348 -127
- package/indexes.d.ts.map +1 -1
- package/indexes.js +1 -3
- package/indexes.js.map +1 -1
- package/lib/blob.d.ts +0 -2
- package/lib/blob.d.ts.map +1 -1
- package/lib/blob.js +0 -1
- package/lib/blob.js.map +1 -1
- package/lib/btoa.d.ts +1 -3
- package/lib/btoa.d.ts.map +1 -1
- package/lib/btoa.js +3 -5
- package/lib/btoa.js.map +1 -1
- package/lib/btoa.web.d.ts +1 -3
- package/lib/btoa.web.d.ts.map +1 -1
- package/lib/btoa.web.js +4 -6
- package/lib/btoa.web.js.map +1 -1
- package/lib/codes.d.ts +2 -2
- package/lib/codes.d.ts.map +1 -1
- package/lib/codes.js +3 -3
- package/lib/codes.js.map +1 -1
- package/lib/errback.d.ts +0 -2
- package/lib/errback.d.ts.map +1 -1
- package/lib/errback.js.map +1 -1
- package/lib/joinPath.d.ts +0 -2
- package/lib/joinPath.d.ts.map +1 -1
- package/lib/joinPath.js +0 -2
- package/lib/joinPath.js.map +1 -1
- package/lib/joinPath.web.d.ts +1 -3
- package/lib/joinPath.web.d.ts.map +1 -1
- package/lib/joinPath.web.js +7 -4
- package/lib/joinPath.web.js.map +1 -1
- package/lib/multipart.d.ts +0 -4
- package/lib/multipart.d.ts.map +1 -1
- package/lib/multipart.js +16 -37
- package/lib/multipart.js.map +1 -1
- package/lib/multipart.web.d.ts +0 -2
- package/lib/multipart.web.d.ts.map +1 -1
- package/lib/multipart.web.js +0 -2
- package/lib/multipart.web.js.map +1 -1
- package/lib/normalizeUrl.d.ts +0 -2
- package/lib/normalizeUrl.d.ts.map +1 -1
- package/lib/normalizeUrl.js +0 -2
- package/lib/normalizeUrl.js.map +1 -1
- package/lib/omit.d.ts +1 -3
- package/lib/omit.d.ts.map +1 -1
- package/lib/omit.js +1 -2
- package/lib/omit.js.map +1 -1
- package/lib/querystringify.d.ts +4 -0
- package/lib/querystringify.d.ts.map +1 -0
- package/lib/querystringify.js +20 -0
- package/lib/querystringify.js.map +1 -0
- package/lib/querystringify.web.d.ts +2 -0
- package/lib/querystringify.web.d.ts.map +1 -0
- package/lib/querystringify.web.js +30 -0
- package/lib/querystringify.web.js.map +1 -0
- package/lib/request.d.ts +0 -1
- package/lib/request.d.ts.map +1 -1
- package/lib/request.js +6 -3
- package/lib/request.js.map +1 -1
- package/lib/request.node.d.ts +2 -8
- package/lib/request.node.d.ts.map +1 -1
- package/lib/request.node.js +16 -7
- package/lib/request.node.js.map +1 -1
- package/lib/request.web.d.ts +2 -3
- package/lib/request.web.d.ts.map +1 -1
- package/lib/request.web.js +26 -29
- package/lib/request.web.js.map +1 -1
- package/lib/xhr.d.ts +1 -3
- package/lib/xhr.d.ts.map +1 -1
- package/lib/xhr.js +0 -2
- package/lib/xhr.js.map +1 -1
- package/package.json +5 -6
- package/route.d.ts +1 -2
- package/route.d.ts.map +1 -1
- package/route.js +1 -2
- package/route.js.map +1 -1
- package/transaction.d.ts +31 -6
- package/transaction.d.ts.map +1 -1
- package/transaction.js +13 -6
- package/transaction.js.map +1 -1
- package/view.d.ts +237 -181
- package/view.d.ts.map +1 -1
- package/view.js +17 -25
- package/view.js.map +1 -1
- package/web.js +1 -1
- package/web.js.map +1 -1
- package/lib/error.d.ts +0 -18
- package/lib/error.d.ts.map +0 -1
- package/lib/error.js +0 -18
- package/lib/error.js.map +0 -1
package/analyzer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../src/analyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,GAAG,GAAG,QAAQ,IAAI,QAAQ,CAEpE;AAED;;GAEG;AACH,oBAAY,eAAe,GAAG,WAAW,GAAG,MAAM,GAAG,UAAU,CAAC;AAEhE;;GAEG;AACH,oBAAY,mBAAmB,GAAG,YAAY,GAAG;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,oBAAY,qBAAqB,GAAG,YAAY,GAAG;IACjD;;OAEG;IACH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CAAC;IAYhC;;;;;;;;;;OAUG;IACH,GAAG,IAAI,OAAO,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;IAMtD;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,OAAO,SAAS,qBAAqB,EAC1C,OAAO,EAAE,OAAO,GACf,OAAO,CACR,OAAO,SAAS,6BAA6B,GACzC,2BAA2B,GAC3B,OAAO,SAAS,8BAA8B,GAC9C,4BAA4B,GAC5B,OAAO,SAAS,yBAAyB,GACzC,uBAAuB,GACvB,OAAO,SAAS,yBAAyB,GACzC,uBAAuB,GACvB,OAAO,SAAS,0BAA0B,GAC1C,wBAAwB,GACxB,OAAO,SAAS,yBAAyB,GACzC,uBAAuB,GACvB,OAAO,SAAS,iCAAiC,GACjD,+BAA+B,GAC/B,OAAO,SAAS,wBAAwB,GACxC,sBAAsB,GACtB,OAAO,SAAS,6BAA6B,GAC7C,2BAA2B,GAC3B,OAAO,SAAS,8BAA8B,GAC9C,4BAA4B,GAC5B,OAAO,SAAS,8BAA8B,GAC9C,4BAA4B,GAC5B,OAAO,SAAS,4BAA4B,GAC5C,0BAA0B,GAC1B,OAAO,SAAS,mCAAmC,GACnD,iCAAiC,GACjC,OAAO,SAAS,qCAAqC,GACrD,mCAAmC,GACnC,OAAO,SAAS,4BAA4B,GAC5C,0BAA0B,GAC1B,OAAO,SAAS,6BAA6B,GAC7C,2BAA2B,GAC3B,mBAAmB,CACxB;IAQD;;;;;;;;;;;;;OAaG;IACH,IAAI,CAAC,KAAK,GAAE,OAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAO3E"}
|
package/analyzer.js
CHANGED
|
@@ -13,12 +13,11 @@ function isArangoAnalyzer(analyzer) {
|
|
|
13
13
|
}
|
|
14
14
|
exports.isArangoAnalyzer = isArangoAnalyzer;
|
|
15
15
|
/**
|
|
16
|
-
* Represents an Analyzer in a {@link Database}.
|
|
16
|
+
* Represents an Analyzer in a {@link database.Database}.
|
|
17
17
|
*/
|
|
18
18
|
class Analyzer {
|
|
19
19
|
/**
|
|
20
20
|
* @internal
|
|
21
|
-
* @hidden
|
|
22
21
|
*/
|
|
23
22
|
constructor(db, name) {
|
|
24
23
|
this._db = db;
|
|
@@ -35,7 +34,7 @@ class Analyzer {
|
|
|
35
34
|
/**
|
|
36
35
|
* Name of this Analyzer.
|
|
37
36
|
*
|
|
38
|
-
* See also {@link Database
|
|
37
|
+
* See also {@link database.Database}.
|
|
39
38
|
*/
|
|
40
39
|
get name() {
|
|
41
40
|
return this._name;
|
|
@@ -57,7 +56,7 @@ class Analyzer {
|
|
|
57
56
|
return true;
|
|
58
57
|
}
|
|
59
58
|
catch (err) {
|
|
60
|
-
if (error_1.isArangoError(err) && err.errorNum === codes_1.ANALYZER_NOT_FOUND) {
|
|
59
|
+
if ((0, error_1.isArangoError)(err) && err.errorNum === codes_1.ANALYZER_NOT_FOUND) {
|
|
61
60
|
return false;
|
|
62
61
|
}
|
|
63
62
|
throw err;
|
|
@@ -75,12 +74,14 @@ class Analyzer {
|
|
|
75
74
|
* ```
|
|
76
75
|
*/
|
|
77
76
|
get() {
|
|
78
|
-
return this._db.request({
|
|
77
|
+
return this._db.request({
|
|
78
|
+
path: `/_api/analyzer/${encodeURIComponent(this._name)}`,
|
|
79
|
+
});
|
|
79
80
|
}
|
|
80
81
|
/**
|
|
81
82
|
* Creates a new Analyzer with the given `options` and the instance's name.
|
|
82
83
|
*
|
|
83
|
-
* See also {@link Database
|
|
84
|
+
* See also {@link database.Database#createAnalyzer}.
|
|
84
85
|
*
|
|
85
86
|
* @param options - Options for creating the Analyzer.
|
|
86
87
|
*
|
|
@@ -97,7 +98,7 @@ class Analyzer {
|
|
|
97
98
|
method: "POST",
|
|
98
99
|
path: "/_api/analyzer",
|
|
99
100
|
body: { name: this._name, ...options },
|
|
100
|
-
}
|
|
101
|
+
});
|
|
101
102
|
}
|
|
102
103
|
/**
|
|
103
104
|
* Deletes the Analyzer from the database.
|
|
@@ -118,7 +119,7 @@ class Analyzer {
|
|
|
118
119
|
method: "DELETE",
|
|
119
120
|
path: `/_api/analyzer/${encodeURIComponent(this._name)}`,
|
|
120
121
|
qs: { force },
|
|
121
|
-
}
|
|
122
|
+
});
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
125
|
exports.Analyzer = Analyzer;
|
package/analyzer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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;AAidD;;GAEG;AACH,MAAa,QAAQ;IAInB;;;OAGG;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,GAAG,EAAE;YACZ,IAAI,qBAAa,CAAC,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,CACrB,EAAE,IAAI,EAAE,kBAAkB,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,EAC5D,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAClB,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,OAA8B;QACnC,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CACrB;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,GAAG,OAAO,EAAE;SACvC,EACD,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAClB,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,IAAI,CACF,QAAiB,KAAK;QAEtB,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CACrB;YACE,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,kBAAkB,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YACxD,EAAE,EAAE,EAAE,KAAK,EAAE;SACd,EACD,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAClB,CAAC;IACJ,CAAC;CACF;AA5HD,4BA4HC","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 { ArangoResponseMetadata } 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\";\n\n/**\n * An object describing an Analyzer.\n */\nexport type AnalyzerDescription = AnalyzerInfo & {\n name: string;\n features: AnalyzerFeature[];\n};\n\n/**\n * Options for creating an Analyzer.\n */\nexport type CreateAnalyzerOptions = AnalyzerInfo & {\n /**\n * Features to enable for this Analyzer.\n */\n features?: AnalyzerFeature[];\n};\n\n/**\n * Analyzer type and its type-specific properties.\n */\nexport type AnalyzerInfo =\n | IdentityAnalyzerInfo\n | DelimiterAnalyzerInfo\n | StemAnalyzerInfo\n | NormAnalyzerInfo\n | NgramAnalyzerInfo\n | TextAnalyzerInfo\n | PipelineAnalyzer\n | AqlAnalyzer\n | GeoJsonAnalyzer\n | GeoPointAnalyzer\n | StopwordsAnalyzer\n | SegmentationAnalyzer\n | CollationAnalyzer;\n\n/**\n * Analyzer type and type-specific properties for an Identity Analyzer.\n */\nexport type IdentityAnalyzerInfo = {\n /**\n * Type of the Analyzer.\n */\n type: \"identity\";\n /**\n * Additional properties for the Analyzer.\n *\n * The `identity` Analyzer does not take additional properties.\n */\n properties?: null;\n};\n\n/**\n * Analyzer type and type-specific properties for a Delimiter Analyzer.\n */\nexport type DelimiterAnalyzerInfo = {\n /**\n * Type of the Analyzer.\n */\n type: \"delimiter\";\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 * Analyzer type and type-specific properties for a Stem Analyzer.\n */\nexport type StemAnalyzerInfo = {\n /**\n * Type of the Analyzer.\n */\n type: \"stem\";\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 * Properties of a Norm Analyzer.\n */\nexport type NormAnalyzerProperties = {\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 * Analyzer type and type-specific properties for a Norm Analyzer.\n */\nexport type NormAnalyzerInfo = {\n /**\n * Type of the Analyzer.\n */\n type: \"norm\";\n /**\n * Additional properties for the Analyzer.\n */\n properties: NormAnalyzerProperties;\n};\n\n/**\n * Properties of an Ngram Analyzer.\n */\nexport type NgramAnalyzerProperties = {\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 * Analyzer type and type-specific properties for an Ngram Analyzer.\n */\nexport type NgramAnalyzerInfo = {\n /**\n * Type of the Analyzer.\n */\n type: \"ngram\";\n /**\n * Additional properties for the Analyzer.\n */\n properties: NgramAnalyzerProperties;\n};\n\n/**\n * Properties of a Text Analyzer.\n */\nexport type TextAnalyzerProperties = {\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 * Analyzer type and type-specific properties for a Text Analyzer.\n */\nexport type TextAnalyzerInfo = {\n /**\n * Type of the Analyzer.\n */\n type: \"text\";\n /**\n * Additional properties for the Analyzer.\n */\n properties: TextAnalyzerProperties;\n};\n\n/**\n * Properties of a Pipeline Analyzer.\n */\nexport type PipelineAnalyzerProperties = {\n /**\n * Definitions for Analyzers to chain in this Pipeline Analyzer.\n */\n pipeline: AnalyzerInfo[];\n};\n\n/**\n * Analyzer type and type-specific properties for a Pipeline Analyzer\n */\nexport type PipelineAnalyzer = {\n /**\n * Type of the Analyzer.\n */\n type: \"pipeline\";\n /**\n * Additional properties for the Analyzer.\n */\n properties: PipelineAnalyzerProperties;\n};\n\n/**\n * Properties of an AQL Analyzer.\n */\nexport type AqlAnalyzerProperties = {\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 * Analyzer type and type-specific properties for an AQL Analyzer\n */\nexport type AqlAnalyzer = {\n /**\n * Type of the Analyzer.\n */\n type: \"aql\";\n /**\n * Additional properties for the Analyzer.\n */\n properties: AqlAnalyzerProperties;\n};\n\n/**\n * Properties of a GeoJSON Analyzer.\n */\nexport type GeoJsonAnalyzerProperties = {\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 * Analyzer type and type-specific properties for a GeoJSON Analyzer\n */\nexport type GeoJsonAnalyzer = {\n /**\n * Type of the Analyzer.\n */\n type: \"geojson\";\n /**\n * Additional properties for the Analyzer.\n */\n properties: GeoJsonAnalyzerProperties;\n};\n\n/**\n * Properties of a GeoPoint Analyzer.\n */\nexport type GeoPointAnalyzerProperties = {\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 * Analyzer type and type-specific properties for a GeoPoint Analyzer\n */\nexport type GeoPointAnalyzer = {\n /**\n * Type of the Analyzer.\n */\n type: \"geopoint\";\n /**\n * Additional properties for the Analyzer.\n */\n properties: GeoPointAnalyzerProperties;\n};\n\n/**\n * Properties of a Stopwords Analyzer.\n */\nexport type StopwordsAnalyzerProperties = {\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 * Analyzer type and type-specific properties for a Stopwords Analyzer\n */\nexport type StopwordsAnalyzer = {\n /**\n * Type of the Analyzer.\n */\n type: \"stopwords\";\n /**\n * Additional properties for the Analyzer.\n */\n properties: StopwordsAnalyzerProperties;\n};\n\n/**\n * Properties of a Segmentation Analyzer.\n */\nexport type SegmentationAnalyzerProperties = {\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 * Analyzer type and type-specific properties for a Segmentation Analyzer\n */\nexport type SegmentationAnalyzer = {\n /**\n * Type of the Analyzer.\n */\n type: \"segmentation\";\n /**\n * Additional properties for the Analyzer.\n */\n properties: SegmentationAnalyzerProperties;\n};\n\n/**\n * Properties of a Collation Analyzer.\n */\nexport type CollationAnalyzerProperties = {\n /**\n * Text locale.\n *\n * Format: `language[_COUNTRY][.encoding][@variant]`\n */\n locale: string;\n};\n\n/**\n * Analyzer type and type-specific properties for a Collation Analyzer\n */\nexport type CollationAnalyzer = {\n /**\n * Type of the Analyzer.\n */\n type: \"collation\";\n /**\n * Additional properties for the Analyzer.\n */\n properties: CollationAnalyzerProperties;\n};\n\n/**\n * Represents an Analyzer in a {@link Database}.\n */\nexport class Analyzer {\n protected _name: string;\n protected _db: Database;\n\n /**\n * @internal\n * @hidden\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.analyzer}.\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) {\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<ArangoResponseMetadata & AnalyzerDescription> {\n return this._db.request(\n { path: `/_api/analyzer/${encodeURIComponent(this._name)}` },\n (res) => res.body\n );\n }\n\n /**\n * Creates a new Analyzer with the given `options` and the instance's name.\n *\n * See also {@link 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: CreateAnalyzerOptions): Promise<AnalyzerDescription> {\n return this._db.request(\n {\n method: \"POST\",\n path: \"/_api/analyzer\",\n body: { name: this._name, ...options },\n },\n (res) => res.body\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(\n force: boolean = false\n ): Promise<ArangoResponseMetadata & { name: string }> {\n return this._db.request(\n {\n method: \"DELETE\",\n path: `/_api/analyzer/${encodeURIComponent(this._name)}`,\n qs: { force },\n },\n (res) => res.body\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;AAovBD;;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;QAoChB,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;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"]}
|
package/aql.d.ts
CHANGED
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ```js
|
|
3
|
-
* import { aql } from "arangojs/aql";
|
|
4
|
-
* ```
|
|
5
|
-
*
|
|
6
|
-
* The "aql" module provides the {@link aql} template string handler and
|
|
7
|
-
* helper functions, as well as associated types and interfaces for TypeScript.
|
|
8
|
-
*
|
|
9
|
-
* The aql function and namespace is also re-exported by the "index" module.
|
|
10
|
-
*
|
|
11
|
-
* @packageDocumentation
|
|
12
|
-
*/
|
|
13
1
|
import { ArangoCollection } from "./collection";
|
|
14
|
-
import { Dict } from "./connection";
|
|
15
2
|
import { Graph } from "./graph";
|
|
16
3
|
import { View } from "./view";
|
|
17
4
|
/**
|
|
@@ -29,7 +16,7 @@ export interface AqlQuery {
|
|
|
29
16
|
* Names of parameters representing collections are prefixed with an
|
|
30
17
|
* at-symbol.
|
|
31
18
|
*/
|
|
32
|
-
bindVars:
|
|
19
|
+
bindVars: Record<string, any>;
|
|
33
20
|
}
|
|
34
21
|
/**
|
|
35
22
|
* Derived type representing AQL query objects generated by the AQL helper
|
|
@@ -41,7 +28,6 @@ export interface AqlQuery {
|
|
|
41
28
|
export interface GeneratedAqlQuery extends AqlQuery {
|
|
42
29
|
/**
|
|
43
30
|
* @internal
|
|
44
|
-
* @hidden
|
|
45
31
|
*/
|
|
46
32
|
_source: () => {
|
|
47
33
|
strings: string[];
|
|
@@ -53,7 +39,7 @@ export interface GeneratedAqlQuery extends AqlQuery {
|
|
|
53
39
|
* when used in an AQL template or passed to AQL helper functions.
|
|
54
40
|
*
|
|
55
41
|
* Arbitrary values can be converted to trusted AQL literals by passing them
|
|
56
|
-
* to the {@link
|
|
42
|
+
* to the {@link literal} helper function.
|
|
57
43
|
*/
|
|
58
44
|
export interface AqlLiteral {
|
|
59
45
|
/**
|
|
@@ -81,7 +67,6 @@ export declare function isAqlQuery(query: any): query is AqlQuery;
|
|
|
81
67
|
* @param query - A value that might be a `GeneratedAqlQuery`.
|
|
82
68
|
*
|
|
83
69
|
* @internal
|
|
84
|
-
* @hidden
|
|
85
70
|
*/
|
|
86
71
|
export declare function isGeneratedAqlQuery(query: any): query is GeneratedAqlQuery;
|
|
87
72
|
/**
|
|
@@ -100,8 +85,8 @@ export declare function isAqlLiteral(literal: any): literal is AqlLiteral;
|
|
|
100
85
|
* Tagged template strings will return an {@link AqlQuery} object with
|
|
101
86
|
* `query` and `bindVars` attributes reflecting any interpolated values.
|
|
102
87
|
*
|
|
103
|
-
* Any {@link ArangoCollection} instance used in a query string will
|
|
104
|
-
* recognized as a collection reference and generate an AQL collection bind
|
|
88
|
+
* Any {@link collection.ArangoCollection} instance used in a query string will
|
|
89
|
+
* be recognized as a collection reference and generate an AQL collection bind
|
|
105
90
|
* parameter instead of a regular AQL value bind parameter.
|
|
106
91
|
*
|
|
107
92
|
* **Note**: you should always use the `aql` template tag when writing
|
|
@@ -180,124 +165,122 @@ export declare function isAqlLiteral(literal: any): literal is AqlLiteral;
|
|
|
180
165
|
* ```
|
|
181
166
|
*/
|
|
182
167
|
export declare function aql(templateStrings: TemplateStringsArray, ...args: AqlValue[]): GeneratedAqlQuery;
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
function join(values: AqlValue[], sep?: string): GeneratedAqlQuery;
|
|
302
|
-
}
|
|
168
|
+
/**
|
|
169
|
+
* Marks an arbitrary scalar value (i.e. a string, number or boolean) as
|
|
170
|
+
* safe for being inlined directly into AQL queries when used in an `aql`
|
|
171
|
+
* template string, rather than being converted into a bind parameter.
|
|
172
|
+
*
|
|
173
|
+
* **Note**: Nesting `aql` template strings is a much safer alternative for
|
|
174
|
+
* most use cases. This low-level helper function only exists to help with
|
|
175
|
+
* rare edge cases where a trusted AQL query fragment must be read from a
|
|
176
|
+
* string (e.g. when reading query fragments from JSON) and should only be
|
|
177
|
+
* used as a last resort.
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```js
|
|
181
|
+
* // BAD! DO NOT DO THIS!
|
|
182
|
+
* const sortDirection = literal('ASC');
|
|
183
|
+
*
|
|
184
|
+
* // GOOD! DO THIS INSTEAD!
|
|
185
|
+
* const sortDirection = aql`ASC`;
|
|
186
|
+
* ```
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* ```js
|
|
190
|
+
* // BAD! DO NOT DO THIS!
|
|
191
|
+
* const filterColor = literal('FILTER d.color == "green"');
|
|
192
|
+
* const result = await db.query(aql`
|
|
193
|
+
* FOR d IN some-collection
|
|
194
|
+
* ${filterColor}
|
|
195
|
+
* RETURN d
|
|
196
|
+
* `);
|
|
197
|
+
*
|
|
198
|
+
* // GOOD! DO THIS INSTEAD!
|
|
199
|
+
* const color = "green";
|
|
200
|
+
* const filterColor = aql`FILTER d.color === ${color}`;
|
|
201
|
+
* const result = await db.query(aql`
|
|
202
|
+
* FOR d IN some-collection
|
|
203
|
+
* ${filterColor}
|
|
204
|
+
* RETURN d
|
|
205
|
+
* `);
|
|
206
|
+
* ```
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* ```js
|
|
210
|
+
* // WARNING: We explicitly trust the environment variable to be safe!
|
|
211
|
+
* const filter = literal(process.env.FILTER_STATEMENT);
|
|
212
|
+
* const users = await db.query(aql`
|
|
213
|
+
* FOR user IN users
|
|
214
|
+
* ${filter}
|
|
215
|
+
* RETURN user
|
|
216
|
+
* `);
|
|
217
|
+
* ```
|
|
218
|
+
*/
|
|
219
|
+
export declare function literal(value: string | number | boolean | AqlLiteral | null | undefined): AqlLiteral;
|
|
220
|
+
/**
|
|
221
|
+
* Constructs {@link AqlQuery} objects from an array of arbitrary values.
|
|
222
|
+
*
|
|
223
|
+
* **Note**: Nesting `aql` template strings is a much safer alternative
|
|
224
|
+
* for most use cases. This low-level helper function only exists to
|
|
225
|
+
* complement the `aql` tag when constructing complex queries from dynamic
|
|
226
|
+
* arrays of query fragments.
|
|
227
|
+
*
|
|
228
|
+
* @param values - Array of values to join. These values will behave exactly
|
|
229
|
+
* like values interpolated in an `aql` template string.
|
|
230
|
+
* @param sep - Seperator to insert between values. This value will behave
|
|
231
|
+
* exactly like a value passed to {@link literal}, i.e. it will be
|
|
232
|
+
* inlined as-is, rather than being converted into a bind parameter.
|
|
233
|
+
*
|
|
234
|
+
* @example
|
|
235
|
+
* ```js
|
|
236
|
+
* const users = db.collection("users");
|
|
237
|
+
* const filters = [];
|
|
238
|
+
* if (adminsOnly) filters.push(aql`FILTER user.admin`);
|
|
239
|
+
* if (activeOnly) filters.push(aql`FILTER user.active`);
|
|
240
|
+
* const result = await db.query(aql`
|
|
241
|
+
* FOR user IN ${users}
|
|
242
|
+
* ${join(filters)}
|
|
243
|
+
* RETURN user
|
|
244
|
+
* `);
|
|
245
|
+
* ```
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* ```js
|
|
249
|
+
* const users = db.collection("users");
|
|
250
|
+
* const keys = ["jreyes", "ghermann"];
|
|
251
|
+
*
|
|
252
|
+
* // BAD! NEEDLESSLY COMPLEX!
|
|
253
|
+
* const docs = keys.map(key => aql`DOCUMENT(${users}, ${key}`));
|
|
254
|
+
* const result = await db.query(aql`
|
|
255
|
+
* FOR user IN [
|
|
256
|
+
* ${join(docs, ", ")}
|
|
257
|
+
* ]
|
|
258
|
+
* RETURN user
|
|
259
|
+
* `);
|
|
260
|
+
* // Query:
|
|
261
|
+
* // FOR user IN [
|
|
262
|
+
* // DOCUMENT(@@value0, @value1), DOCUMENT(@@value0, @value2)
|
|
263
|
+
* // ]
|
|
264
|
+
* // RETURN user
|
|
265
|
+
* // Bind parameters:
|
|
266
|
+
* // @value0 -> "users"
|
|
267
|
+
* // value1 -> "jreyes"
|
|
268
|
+
* // value2 -> "ghermann"
|
|
269
|
+
*
|
|
270
|
+
* // GOOD! MUCH SIMPLER!
|
|
271
|
+
* const result = await db.query(aql`
|
|
272
|
+
* FOR key IN ${keys}
|
|
273
|
+
* LET user = DOCUMENT(${users}, key)
|
|
274
|
+
* RETURN user
|
|
275
|
+
* `);
|
|
276
|
+
* // Query:
|
|
277
|
+
* // FOR user IN @value0
|
|
278
|
+
* // LET user = DOCUMENT(@@value1, key)
|
|
279
|
+
* // RETURN user
|
|
280
|
+
* // Bind parameters:
|
|
281
|
+
* // value0 -> ["jreyes", "ghermann"]
|
|
282
|
+
* // @value1 -> "users"
|
|
283
|
+
* ```
|
|
284
|
+
*/
|
|
285
|
+
export declare function join(values: AqlValue[], sep?: string): GeneratedAqlQuery;
|
|
303
286
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"aql.d.ts","sourceRoot":"","sources":["../src/aql.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,gBAAgB,EAAsB,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,KAAK,EAAiB,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAgB,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE5C;;;GAGG;AACH,MAAM,WAA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