arangojs 7.4.0 → 7.6.1
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 +52 -0
- package/analyzer.d.ts +188 -1
- package/analyzer.d.ts.map +1 -1
- package/analyzer.js.map +1 -1
- package/aql.d.ts +2 -1
- package/aql.d.ts.map +1 -1
- package/aql.js +5 -1
- package/aql.js.map +1 -1
- package/collection.d.ts +72 -11
- package/collection.d.ts.map +1 -1
- package/collection.js +15 -2
- package/collection.js.map +1 -1
- package/connection.d.ts +2 -2
- package/connection.d.ts.map +1 -1
- package/connection.js.map +1 -1
- package/cursor.d.ts +12 -6
- package/cursor.d.ts.map +1 -1
- package/cursor.js +4 -4
- package/cursor.js.map +1 -1
- package/database.d.ts +451 -4
- package/database.d.ts.map +1 -1
- package/database.js +357 -0
- package/database.js.map +1 -1
- package/documents.d.ts +5 -5
- package/documents.d.ts.map +1 -1
- package/documents.js.map +1 -1
- package/graph.d.ts +16 -4
- package/graph.d.ts.map +1 -1
- package/graph.js +18 -1
- package/graph.js.map +1 -1
- package/indexes.d.ts +70 -0
- package/indexes.d.ts.map +1 -1
- package/indexes.js.map +1 -1
- package/lib/error.d.ts.map +1 -1
- package/lib/error.js +1 -0
- package/lib/error.js.map +1 -1
- package/lib/multipart.d.ts.map +1 -1
- package/lib/multipart.js +1 -0
- package/lib/multipart.js.map +1 -1
- package/lib/normalizeUrl.js +1 -1
- package/lib/normalizeUrl.js.map +1 -1
- package/lib/request.node.js.map +1 -1
- package/lib/xhr.d.ts.map +1 -1
- package/lib/xhr.js +1 -0
- package/lib/xhr.js.map +1 -1
- package/package.json +1 -1
- package/view.d.ts +1 -1
- package/view.d.ts.map +1 -1
- package/view.js.map +1 -1
- package/web.js +1 -1
- package/web.js.map +1 -1
package/indexes.d.ts
CHANGED
|
@@ -54,6 +54,20 @@ export declare type EnsureHashIndexOptions = {
|
|
|
54
54
|
* Default: `true`
|
|
55
55
|
*/
|
|
56
56
|
deduplicate?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* If set to `false`, index selectivity estimates will be disabled for this
|
|
59
|
+
* index.
|
|
60
|
+
*
|
|
61
|
+
* Default: `true`
|
|
62
|
+
*/
|
|
63
|
+
estimates?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* If set to `true`, the index will be created in the background to reduce
|
|
66
|
+
* the write-lock duration for the collection during index creation.
|
|
67
|
+
*
|
|
68
|
+
* Default: `false`
|
|
69
|
+
*/
|
|
70
|
+
inBackground?: boolean;
|
|
57
71
|
};
|
|
58
72
|
/**
|
|
59
73
|
* (MMFiles only.) Options for creating a skiplist index.
|
|
@@ -94,6 +108,20 @@ export declare type EnsureSkiplistIndexOptions = {
|
|
|
94
108
|
* Default: `true`
|
|
95
109
|
*/
|
|
96
110
|
deduplicate?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* If set to `false`, index selectivity estimates will be disabled for this
|
|
113
|
+
* index.
|
|
114
|
+
*
|
|
115
|
+
* Default: `true`
|
|
116
|
+
*/
|
|
117
|
+
estimates?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* If set to `true`, the index will be created in the background to reduce
|
|
120
|
+
* the write-lock duration for the collection during index creation.
|
|
121
|
+
*
|
|
122
|
+
* Default: `false`
|
|
123
|
+
*/
|
|
124
|
+
inBackground?: boolean;
|
|
97
125
|
};
|
|
98
126
|
/**
|
|
99
127
|
* Options for creating a persistent index.
|
|
@@ -125,6 +153,20 @@ export declare type EnsurePersistentIndexOptions = {
|
|
|
125
153
|
* Default: `false`
|
|
126
154
|
*/
|
|
127
155
|
sparse?: boolean;
|
|
156
|
+
/**
|
|
157
|
+
* If set to `false`, index selectivity estimates will be disabled for this
|
|
158
|
+
* index.
|
|
159
|
+
*
|
|
160
|
+
* Default: `true`
|
|
161
|
+
*/
|
|
162
|
+
estimates?: boolean;
|
|
163
|
+
/**
|
|
164
|
+
* If set to `true`, the index will be created in the background to reduce
|
|
165
|
+
* the write-lock duration for the collection during index creation.
|
|
166
|
+
*
|
|
167
|
+
* Default: `false`
|
|
168
|
+
*/
|
|
169
|
+
inBackground?: boolean;
|
|
128
170
|
};
|
|
129
171
|
/**
|
|
130
172
|
* Options for creating a geo index.
|
|
@@ -148,6 +190,13 @@ export declare type EnsureGeoIndexOptions = {
|
|
|
148
190
|
* A unique name for this index.
|
|
149
191
|
*/
|
|
150
192
|
name?: string;
|
|
193
|
+
/**
|
|
194
|
+
* If set to `true`, the index will be created in the background to reduce
|
|
195
|
+
* the write-lock duration for the collection during index creation.
|
|
196
|
+
*
|
|
197
|
+
* Default: `false`
|
|
198
|
+
*/
|
|
199
|
+
inBackground?: boolean;
|
|
151
200
|
} | {
|
|
152
201
|
type: "geo";
|
|
153
202
|
/**
|
|
@@ -170,6 +219,13 @@ export declare type EnsureGeoIndexOptions = {
|
|
|
170
219
|
* A unique name for this index.
|
|
171
220
|
*/
|
|
172
221
|
name?: string;
|
|
222
|
+
/**
|
|
223
|
+
* If set to `true`, the index will be created in the background to reduce
|
|
224
|
+
* the write-lock duration for the collection during index creation.
|
|
225
|
+
*
|
|
226
|
+
* Default: `false`
|
|
227
|
+
*/
|
|
228
|
+
inBackground?: boolean;
|
|
173
229
|
};
|
|
174
230
|
/**
|
|
175
231
|
* Options for creating a fulltext index.
|
|
@@ -191,6 +247,13 @@ export declare type EnsureFulltextIndexOptions = {
|
|
|
191
247
|
* Minimum character length of words to index.
|
|
192
248
|
*/
|
|
193
249
|
minLength?: number;
|
|
250
|
+
/**
|
|
251
|
+
* If set to `true`, the index will be created in the background to reduce
|
|
252
|
+
* the write-lock duration for the collection during index creation.
|
|
253
|
+
*
|
|
254
|
+
* Default: `false`
|
|
255
|
+
*/
|
|
256
|
+
inBackground?: boolean;
|
|
194
257
|
};
|
|
195
258
|
/**
|
|
196
259
|
* Options for creating a TTL index.
|
|
@@ -213,6 +276,13 @@ export declare type EnsureTtlIndexOptions = {
|
|
|
213
276
|
* be considered as expired.
|
|
214
277
|
*/
|
|
215
278
|
expireAfter: number;
|
|
279
|
+
/**
|
|
280
|
+
* If set to `true`, the index will be created in the background to reduce
|
|
281
|
+
* the write-lock duration for the collection during index creation.
|
|
282
|
+
*
|
|
283
|
+
* Default: `false`
|
|
284
|
+
*/
|
|
285
|
+
inBackground?: boolean;
|
|
216
286
|
};
|
|
217
287
|
/**
|
|
218
288
|
* Shared attributes of all index types.
|
package/indexes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexes.d.ts","sourceRoot":"","sources":["../src/indexes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;GAKG;AACH,oBAAY,sBAAsB,GAAG;IACnC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"indexes.d.ts","sourceRoot":"","sources":["../src/indexes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;GAKG;AACH,oBAAY,sBAAsB,GAAG;IACnC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;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EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,oBAAY,cAAc,GAAG;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;GAEG;AACH,oBAAY,aAAa,GAAG,YAAY,GAAG,cAAc,GAAG,MAAM,CAAC;AAEnE;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,aAAa,EACvB,cAAc,EAAE,MAAM,GACrB,MAAM,CAkBR"}
|
package/indexes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexes.js","sourceRoot":"","sources":["../src/indexes.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAoUH;;;GAGG;AACH,SAAgB,YAAY,CAC1B,QAAuB,EACvB,cAAsB;IAEtB,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;QAChC,IAAI,QAAQ,CAAC,EAAE,EAAE;YACf,OAAO,YAAY,CAAC,QAAQ,CAAC,EAAE,EAAE,cAAc,CAAC,CAAC;SAClD;QACD,MAAM,IAAI,KAAK,CACb,iEAAiE,CAClE,CAAC;KACH;IACD,IAAI,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QAC1B,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,cAAc,GAAG,CAAC,EAAE;YAC9C,MAAM,IAAI,KAAK,CACb,aAAa,QAAQ,qCAAqC,cAAc,GAAG,CAC5E,CAAC;SACH;QACD,OAAO,QAAQ,CAAC;KACjB;IACD,OAAO,GAAG,cAAc,IAAI,QAAQ,EAAE,CAAC;AACzC,CAAC;AArBD,oCAqBC","sourcesContent":["/**\n * ```ts\n * import type {\n * FulltextIndex,\n * GeoIndex,\n * HashIndex,\n * PersistentIndex,\n * PrimaryIndex,\n * SkiplistIndex,\n * TtlIndex,\n * } from \"arangojs/indexes\";\n * ```\n *\n * The \"indexes\" module provides index-related types for TypeScript.\n *\n * @packageDocumentation\n */\n\n/**\n * (MMFiles only.) Options for creating a hash index.\n *\n * When using the RocksDB storage engine, this index type behaves identically\n * to {@link EnsurePersistentIndexOptions}.\n */\nexport type EnsureHashIndexOptions = {\n /**\n * Type of this index.\n */\n type: \"hash\";\n /**\n * An array of attribute paths.\n */\n fields: string[];\n /**\n * A unique name for this index.\n */\n name?: string;\n /**\n * If set to `true`, a unique index will be created.\n *\n * Default: `false`\n */\n unique?: boolean;\n /**\n * If set to `true`, the index will omit documents that do not contain at\n * least one of the attribute paths in `fields` and these documents will be\n * ignored for uniqueness checks.\n *\n * Default: `false`\n */\n sparse?: boolean;\n /**\n * If set to `false`, array values will not be deduplicated.\n *\n * Default: `true`\n */\n deduplicate?: boolean;\n};\n\n/**\n * (MMFiles only.) Options for creating a skiplist index.\n *\n * When using the RocksDB storage engine, this index type behaves identically\n * to {@link EnsurePersistentIndexOptions}.\n */\nexport type EnsureSkiplistIndexOptions = {\n /**\n * Type of this index.\n */\n type: \"skiplist\";\n /**\n * An array of attribute paths.\n */\n fields: string[];\n /**\n * A unique name for this index.\n */\n name?: string;\n /**\n * If set to `true`, a unique index will be created.\n *\n * Default: `false`\n */\n unique?: boolean;\n /**\n * If set to `true`, the index will omit documents that do not contain at\n * least one of the attribute paths in `fields` and these documents will be\n * ignored for uniqueness checks.\n *\n * Default: `false`\n */\n sparse?: boolean;\n /**\n * If set to `false`, array values will not be deduplicated.\n *\n * Default: `true`\n */\n deduplicate?: boolean;\n};\n\n/**\n * Options for creating a persistent index.\n */\nexport type EnsurePersistentIndexOptions = {\n /**\n * Type of this index.\n */\n type: \"persistent\";\n /**\n * An array of attribute paths.\n */\n fields: string[];\n /**\n * A unique name for this index.\n */\n name?: string;\n /**\n * If set to `true`, a unique index will be created.\n *\n * Default: `false`\n */\n unique?: boolean;\n /**\n * If set to `true`, the index will omit documents that do not contain at\n * least one of the attribute paths in `fields` and these documents will be\n * ignored for uniqueness checks.\n *\n * Default: `false`\n */\n sparse?: boolean;\n};\n\n/**\n * Options for creating a geo index.\n */\nexport type EnsureGeoIndexOptions =\n | {\n type: \"geo\";\n /**\n * If set to `true`, `fields` must be an array containing a single attribute\n * path and the attribute value must be an array with two values, the first\n * of which will be interpreted as the longitude and the second of which will\n * be interpreted as the latitude of the document.\n *\n * Default: `false`\n */\n geoJson?: false;\n /**\n * Attribute paths for the document's latitude and longitude values.\n */\n fields: [string, string];\n /**\n * A unique name for this index.\n */\n name?: string;\n }\n | {\n type: \"geo\";\n /**\n * If set to `true`, `fields` must be an array containing a single attribute\n * path and the attribute value must be an array with two values, the first\n * of which will be interpreted as the longitude and the second of which will\n * be interpreted as the latitude of the document.\n *\n * Default: `false`\n */\n geoJson?: boolean;\n /**\n * An array containing the attribute path for an array containing two values,\n * the first of which will be interpreted as the latitude, the second as the\n * longitude. If `geoJson` is set to `true`, the order is reversed to match\n * the GeoJSON format.\n */\n fields: [string];\n /**\n * A unique name for this index.\n */\n name?: string;\n };\n\n/**\n * Options for creating a fulltext index.\n */\nexport type EnsureFulltextIndexOptions = {\n /**\n * Type of this index.\n */\n type: \"fulltext\";\n /**\n * An array containing exactly one attribute path.\n */\n fields: [string];\n /**\n * A unique name for this index.\n */\n name?: string;\n /**\n * Minimum character length of words to index.\n */\n minLength?: number;\n};\n\n/**\n * Options for creating a TTL index.\n */\nexport type EnsureTtlIndexOptions = {\n /**\n * Type of this index.\n */\n type: \"ttl\";\n /**\n * An array containing exactly one attribute path.\n */\n fields: [string];\n /**\n * A unique name for this index.\n */\n name?: string;\n /**\n * Duration in seconds after the attribute value at which the document will\n * be considered as expired.\n */\n expireAfter: number;\n};\n\n/**\n * Shared attributes of all index types.\n */\nexport type GenericIndex = {\n /**\n * A unique name for this index.\n */\n name?: string;\n /**\n * A unique identifier for this index.\n */\n id: string;\n /**\n * Whether documents not containing at least one of the attribute paths\n * are omitted by this index.\n */\n sparse: boolean;\n /**\n * Whether this index enforces uniqueness for values of its attribute paths.\n */\n unique: boolean;\n};\n\n/**\n * An object representing a persistent index.\n */\nexport type PersistentIndex = GenericIndex & {\n type: \"persistent\";\n fields: string[];\n};\n\n/**\n * An object representing a skiplist index.\n */\nexport type SkiplistIndex = GenericIndex & {\n type: \"skiplist\";\n fields: string[];\n};\n\n/**\n * An object representing a hash index.\n */\nexport type HashIndex = GenericIndex & {\n type: \"hash\";\n fields: string[];\n selectivityEstimate: number;\n};\n\n/**\n * An object representing a primary index.\n */\nexport type PrimaryIndex = GenericIndex & {\n type: \"primary\";\n fields: string[];\n selectivityEstimate: number;\n};\n\n/**\n * An object representing a fulltext index.\n */\nexport type FulltextIndex = GenericIndex & {\n type: \"fulltext\";\n fields: [string];\n minLength: number;\n};\n\n/**\n * An object representing a geo index.\n */\nexport type GeoIndex = GenericIndex & {\n type: \"geo\";\n fields: [string] | [string, string];\n geoJson: boolean;\n bestIndexedLevel: number;\n worstIndexedLevel: number;\n maxNumCoverCells: number;\n};\n\n/**\n * An object representing a TTL index.\n */\nexport type TtlIndex = GenericIndex & {\n type: \"ttl\";\n fields: [string];\n expireAfter: number;\n selectivityEstimate: number;\n};\n\n/**\n * An object representing an index.\n */\nexport type Index =\n | GeoIndex\n | FulltextIndex\n | PersistentIndex\n | PrimaryIndex\n | HashIndex\n | SkiplistIndex\n | TtlIndex;\n\nexport type ObjectWithId = {\n [key: string]: any;\n id: string;\n};\n\nexport type ObjectWithName = {\n [key: string]: any;\n name: string;\n};\n\n/**\n * Index name, id or object with a `name` or `id` property.\n */\nexport type IndexSelector = ObjectWithId | ObjectWithName | string;\n\n/**\n * @internal\n * @hidden\n */\nexport function _indexHandle(\n selector: IndexSelector,\n collectionName: string\n): string {\n if (typeof selector !== \"string\") {\n if (selector.id) {\n return _indexHandle(selector.id, collectionName);\n }\n throw new Error(\n \"Index handle must be a string or an object with an id attribute\"\n );\n }\n if (selector.includes(\"/\")) {\n if (!selector.startsWith(`${collectionName}/`)) {\n throw new Error(\n `Index ID \"${selector}\" does not match collection name \"${collectionName}\"`\n );\n }\n return selector;\n }\n return `${collectionName}/${selector}`;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"indexes.js","sourceRoot":"","sources":["../src/indexes.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AA0YH;;;GAGG;AACH,SAAgB,YAAY,CAC1B,QAAuB,EACvB,cAAsB;IAEtB,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;QAChC,IAAI,QAAQ,CAAC,EAAE,EAAE;YACf,OAAO,YAAY,CAAC,QAAQ,CAAC,EAAE,EAAE,cAAc,CAAC,CAAC;SAClD;QACD,MAAM,IAAI,KAAK,CACb,iEAAiE,CAClE,CAAC;KACH;IACD,IAAI,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QAC1B,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,cAAc,GAAG,CAAC,EAAE;YAC9C,MAAM,IAAI,KAAK,CACb,aAAa,QAAQ,qCAAqC,cAAc,GAAG,CAC5E,CAAC;SACH;QACD,OAAO,QAAQ,CAAC;KACjB;IACD,OAAO,GAAG,cAAc,IAAI,QAAQ,EAAE,CAAC;AACzC,CAAC;AArBD,oCAqBC","sourcesContent":["/**\n * ```ts\n * import type {\n * FulltextIndex,\n * GeoIndex,\n * HashIndex,\n * PersistentIndex,\n * PrimaryIndex,\n * SkiplistIndex,\n * TtlIndex,\n * } from \"arangojs/indexes\";\n * ```\n *\n * The \"indexes\" module provides index-related types for TypeScript.\n *\n * @packageDocumentation\n */\n\n/**\n * (MMFiles only.) Options for creating a hash index.\n *\n * When using the RocksDB storage engine, this index type behaves identically\n * to {@link EnsurePersistentIndexOptions}.\n */\nexport type EnsureHashIndexOptions = {\n /**\n * Type of this index.\n */\n type: \"hash\";\n /**\n * An array of attribute paths.\n */\n fields: string[];\n /**\n * A unique name for this index.\n */\n name?: string;\n /**\n * If set to `true`, a unique index will be created.\n *\n * Default: `false`\n */\n unique?: boolean;\n /**\n * If set to `true`, the index will omit documents that do not contain at\n * least one of the attribute paths in `fields` and these documents will be\n * ignored for uniqueness checks.\n *\n * Default: `false`\n */\n sparse?: boolean;\n /**\n * If set to `false`, array values will not be deduplicated.\n *\n * Default: `true`\n */\n deduplicate?: boolean;\n /**\n * If set to `false`, index selectivity estimates will be disabled for this\n * index.\n *\n * Default: `true`\n */\n estimates?: boolean;\n /**\n * If set to `true`, the index will be created in the background to reduce\n * the write-lock duration for the collection during index creation.\n *\n * Default: `false`\n */\n inBackground?: boolean;\n};\n\n/**\n * (MMFiles only.) Options for creating a skiplist index.\n *\n * When using the RocksDB storage engine, this index type behaves identically\n * to {@link EnsurePersistentIndexOptions}.\n */\nexport type EnsureSkiplistIndexOptions = {\n /**\n * Type of this index.\n */\n type: \"skiplist\";\n /**\n * An array of attribute paths.\n */\n fields: string[];\n /**\n * A unique name for this index.\n */\n name?: string;\n /**\n * If set to `true`, a unique index will be created.\n *\n * Default: `false`\n */\n unique?: boolean;\n /**\n * If set to `true`, the index will omit documents that do not contain at\n * least one of the attribute paths in `fields` and these documents will be\n * ignored for uniqueness checks.\n *\n * Default: `false`\n */\n sparse?: boolean;\n /**\n * If set to `false`, array values will not be deduplicated.\n *\n * Default: `true`\n */\n deduplicate?: boolean;\n /**\n * If set to `false`, index selectivity estimates will be disabled for this\n * index.\n *\n * Default: `true`\n */\n estimates?: boolean;\n /**\n * If set to `true`, the index will be created in the background to reduce\n * the write-lock duration for the collection during index creation.\n *\n * Default: `false`\n */\n inBackground?: boolean;\n};\n\n/**\n * Options for creating a persistent index.\n */\nexport type EnsurePersistentIndexOptions = {\n /**\n * Type of this index.\n */\n type: \"persistent\";\n /**\n * An array of attribute paths.\n */\n fields: string[];\n /**\n * A unique name for this index.\n */\n name?: string;\n /**\n * If set to `true`, a unique index will be created.\n *\n * Default: `false`\n */\n unique?: boolean;\n /**\n * If set to `true`, the index will omit documents that do not contain at\n * least one of the attribute paths in `fields` and these documents will be\n * ignored for uniqueness checks.\n *\n * Default: `false`\n */\n sparse?: boolean;\n /**\n * If set to `false`, index selectivity estimates will be disabled for this\n * index.\n *\n * Default: `true`\n */\n estimates?: boolean;\n /**\n * If set to `true`, the index will be created in the background to reduce\n * the write-lock duration for the collection during index creation.\n *\n * Default: `false`\n */\n inBackground?: boolean;\n};\n\n/**\n * Options for creating a geo index.\n */\nexport type EnsureGeoIndexOptions =\n | {\n type: \"geo\";\n /**\n * If set to `true`, `fields` must be an array containing a single attribute\n * path and the attribute value must be an array with two values, the first\n * of which will be interpreted as the longitude and the second of which will\n * be interpreted as the latitude of the document.\n *\n * Default: `false`\n */\n geoJson?: false;\n /**\n * Attribute paths for the document's latitude and longitude values.\n */\n fields: [string, string];\n /**\n * A unique name for this index.\n */\n name?: string;\n /**\n * If set to `true`, the index will be created in the background to reduce\n * the write-lock duration for the collection during index creation.\n *\n * Default: `false`\n */\n inBackground?: boolean;\n }\n | {\n type: \"geo\";\n /**\n * If set to `true`, `fields` must be an array containing a single attribute\n * path and the attribute value must be an array with two values, the first\n * of which will be interpreted as the longitude and the second of which will\n * be interpreted as the latitude of the document.\n *\n * Default: `false`\n */\n geoJson?: boolean;\n /**\n * An array containing the attribute path for an array containing two values,\n * the first of which will be interpreted as the latitude, the second as the\n * longitude. If `geoJson` is set to `true`, the order is reversed to match\n * the GeoJSON format.\n */\n fields: [string];\n /**\n * A unique name for this index.\n */\n name?: string;\n /**\n * If set to `true`, the index will be created in the background to reduce\n * the write-lock duration for the collection during index creation.\n *\n * Default: `false`\n */\n inBackground?: boolean;\n };\n\n/**\n * Options for creating a fulltext index.\n */\nexport type EnsureFulltextIndexOptions = {\n /**\n * Type of this index.\n */\n type: \"fulltext\";\n /**\n * An array containing exactly one attribute path.\n */\n fields: [string];\n /**\n * A unique name for this index.\n */\n name?: string;\n /**\n * Minimum character length of words to index.\n */\n minLength?: number;\n /**\n * If set to `true`, the index will be created in the background to reduce\n * the write-lock duration for the collection during index creation.\n *\n * Default: `false`\n */\n inBackground?: boolean;\n};\n\n/**\n * Options for creating a TTL index.\n */\nexport type EnsureTtlIndexOptions = {\n /**\n * Type of this index.\n */\n type: \"ttl\";\n /**\n * An array containing exactly one attribute path.\n */\n fields: [string];\n /**\n * A unique name for this index.\n */\n name?: string;\n /**\n * Duration in seconds after the attribute value at which the document will\n * be considered as expired.\n */\n expireAfter: number;\n /**\n * If set to `true`, the index will be created in the background to reduce\n * the write-lock duration for the collection during index creation.\n *\n * Default: `false`\n */\n inBackground?: boolean;\n};\n\n/**\n * Shared attributes of all index types.\n */\nexport type GenericIndex = {\n /**\n * A unique name for this index.\n */\n name?: string;\n /**\n * A unique identifier for this index.\n */\n id: string;\n /**\n * Whether documents not containing at least one of the attribute paths\n * are omitted by this index.\n */\n sparse: boolean;\n /**\n * Whether this index enforces uniqueness for values of its attribute paths.\n */\n unique: boolean;\n};\n\n/**\n * An object representing a persistent index.\n */\nexport type PersistentIndex = GenericIndex & {\n type: \"persistent\";\n fields: string[];\n};\n\n/**\n * An object representing a skiplist index.\n */\nexport type SkiplistIndex = GenericIndex & {\n type: \"skiplist\";\n fields: string[];\n};\n\n/**\n * An object representing a hash index.\n */\nexport type HashIndex = GenericIndex & {\n type: \"hash\";\n fields: string[];\n selectivityEstimate: number;\n};\n\n/**\n * An object representing a primary index.\n */\nexport type PrimaryIndex = GenericIndex & {\n type: \"primary\";\n fields: string[];\n selectivityEstimate: number;\n};\n\n/**\n * An object representing a fulltext index.\n */\nexport type FulltextIndex = GenericIndex & {\n type: \"fulltext\";\n fields: [string];\n minLength: number;\n};\n\n/**\n * An object representing a geo index.\n */\nexport type GeoIndex = GenericIndex & {\n type: \"geo\";\n fields: [string] | [string, string];\n geoJson: boolean;\n bestIndexedLevel: number;\n worstIndexedLevel: number;\n maxNumCoverCells: number;\n};\n\n/**\n * An object representing a TTL index.\n */\nexport type TtlIndex = GenericIndex & {\n type: \"ttl\";\n fields: [string];\n expireAfter: number;\n selectivityEstimate: number;\n};\n\n/**\n * An object representing an index.\n */\nexport type Index =\n | GeoIndex\n | FulltextIndex\n | PersistentIndex\n | PrimaryIndex\n | HashIndex\n | SkiplistIndex\n | TtlIndex;\n\nexport type ObjectWithId = {\n [key: string]: any;\n id: string;\n};\n\nexport type ObjectWithName = {\n [key: string]: any;\n name: string;\n};\n\n/**\n * Index name, id or object with a `name` or `id` property.\n */\nexport type IndexSelector = ObjectWithId | ObjectWithName | string;\n\n/**\n * @internal\n * @hidden\n */\nexport function _indexHandle(\n selector: IndexSelector,\n collectionName: string\n): string {\n if (typeof selector !== \"string\") {\n if (selector.id) {\n return _indexHandle(selector.id, collectionName);\n }\n throw new Error(\n \"Index handle must be a string or an object with an id attribute\"\n );\n }\n if (selector.includes(\"/\")) {\n if (!selector.startsWith(`${collectionName}/`)) {\n throw new Error(\n `Index ID \"${selector}\" does not match collection name \"${collectionName}\"`\n );\n }\n return selector;\n }\n return `${collectionName}/${selector}`;\n}\n"]}
|
package/lib/error.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/lib/error.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/lib/error.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,OAAO,KAAoC,CAAC;AAE1E;;;GAGG;AACH,oBAAY,eAAe,GAAG,OAAO,KAAK,CAAC"}
|
package/lib/error.js
CHANGED
package/lib/error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/lib/error.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAEtC;;;GAGG;AACU,QAAA,eAAe,GAAiB,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC","sourcesContent":["/**\n * Wrapper around the `es6-error` module.\n *\n * @packageDocumentation\n * @internal\n * @hidden\n */\n\nconst Es6Error = require(\"es6-error\");\n\n/**\n * @internal\n * @hidden\n */\nexport const ExtendableError: typeof Error = Es6Error.default || Es6Error;\n\n/**\n * @internal\n * @hidden\n */\nexport type ExtendableError = typeof Error;\n"]}
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/lib/error.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,8DAA8D;AAC9D,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAEtC;;;GAGG;AACU,QAAA,eAAe,GAAiB,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC","sourcesContent":["/**\n * Wrapper around the `es6-error` module.\n *\n * @packageDocumentation\n * @internal\n * @hidden\n */\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst Es6Error = require(\"es6-error\");\n\n/**\n * @internal\n * @hidden\n */\nexport const ExtendableError: typeof Error = Es6Error.default || Es6Error;\n\n/**\n * @internal\n * @hidden\n */\nexport type ExtendableError = typeof Error;\n"]}
|
package/lib/multipart.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multipart.d.ts","sourceRoot":"","sources":["../../src/lib/multipart.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"multipart.d.ts","sourceRoot":"","sources":["../../src/lib/multipart.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAWxC;;;GAGG;AACH,oBAAY,MAAM,GAAG;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAoChE"}
|
package/lib/multipart.js
CHANGED
package/lib/multipart.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multipart.js","sourceRoot":"","sources":["../../src/lib/multipart.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,mCAAkC;AASlC,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAqB,CAAC;AAmB5D;;;GAGG;AACH,SAAgB,MAAM,CAAC,MAAc;IACnC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,IAAI;YACF,MAAM,IAAI,GAAG,IAAI,SAAS,EAAE,CAAC;YAC7B,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;gBACrC,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;gBACxB,IAAI,KAAK,KAAK,SAAS;oBAAE,SAAS;gBAClC,IACE,CAAC,CAAC,KAAK,YAAY,iBAAQ,CAAC;oBAC5B,CAAC,CAAC,KAAK,YAAY,MAAM,CAAC,MAAM,CAAC;oBACjC,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,UAAU,CAAC,EAC1D;oBACA,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;iBAC/B;gBACD,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;aACzB;YACD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;YAC7B,MAAM,IAAI,GAAa,EAAE,CAAC;YAC1B,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAa,CAAC,CAAC,CAAC;YACrD,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;gBACpB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;gBAC/B,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;gBACpC,MAAM,OAAO,GAAG;oBACd,cAAc,EAAE,iCAAiC,QAAQ,EAAE;oBAC3D,gBAAgB,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;iBACtC,CAAC;gBACF,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;YAC7B,CAAC,CAAC,CAAC;YACH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;gBACvB,MAAM,CAAC,CAAC,CAAC,CAAC;YACZ,CAAC,CAAC,CAAC;SACJ;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,CAAC,CAAC,CAAC,CAAC;SACX;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AApCD,wBAoCC","sourcesContent":["/**\n * Utility function for constructing a multipart form in Node.js.\n *\n * @packageDocumentation\n * @internal\n * @hidden\n */\n\nimport { Readable } from \"stream\";\nimport { Headers } from \"../connection\";\n\ndeclare class MultiPart {\n append(key: string, value: Readable | Buffer | string): void;\n getBoundary(): string;\n stream(): Readable;\n}\n\nconst Multipart = require(\"multi-part\") as typeof MultiPart;\n\n/**\n * @internal\n * @hidden\n */\nexport type Fields = {\n [key: string]: any;\n};\n\n/**\n * @internal\n * @hidden\n */\nexport interface MultipartRequest {\n headers?: Headers;\n body: Buffer;\n}\n\n/**\n * @internal\n * @hidden\n */\nexport function toForm(fields: Fields): Promise<MultipartRequest> {\n return new Promise((resolve, reject) => {\n try {\n const form = new Multipart();\n for (const key of Object.keys(fields)) {\n let value = fields[key];\n if (value === undefined) continue;\n if (\n !(value instanceof Readable) &&\n !(value instanceof global.Buffer) &&\n (typeof value === \"object\" || typeof value === \"function\")\n ) {\n value = JSON.stringify(value);\n }\n form.append(key, value);\n }\n const stream = form.stream();\n const bufs: Buffer[] = [];\n stream.on(\"data\", (buf) => bufs.push(buf as Buffer));\n stream.on(\"end\", () => {\n bufs.push(Buffer.from(\"\\r\\n\"));\n const body = Buffer.concat(bufs);\n const boundary = form.getBoundary();\n const headers = {\n \"content-type\": `multipart/form-data; boundary=${boundary}`,\n \"content-length\": String(body.length),\n };\n resolve({ body, headers });\n });\n stream.on(\"error\", (e) => {\n reject(e);\n });\n } catch (e) {\n reject(e);\n }\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"multipart.js","sourceRoot":"","sources":["../../src/lib/multipart.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,mCAAkC;AASlC,8DAA8D;AAC9D,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAqB,CAAC;AAmB5D;;;GAGG;AACH,SAAgB,MAAM,CAAC,MAAc;IACnC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,IAAI;YACF,MAAM,IAAI,GAAG,IAAI,SAAS,EAAE,CAAC;YAC7B,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;gBACrC,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;gBACxB,IAAI,KAAK,KAAK,SAAS;oBAAE,SAAS;gBAClC,IACE,CAAC,CAAC,KAAK,YAAY,iBAAQ,CAAC;oBAC5B,CAAC,CAAC,KAAK,YAAY,MAAM,CAAC,MAAM,CAAC;oBACjC,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,UAAU,CAAC,EAC1D;oBACA,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;iBAC/B;gBACD,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;aACzB;YACD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;YAC7B,MAAM,IAAI,GAAa,EAAE,CAAC;YAC1B,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAa,CAAC,CAAC,CAAC;YACrD,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;gBACpB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;gBAC/B,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;gBACpC,MAAM,OAAO,GAAG;oBACd,cAAc,EAAE,iCAAiC,QAAQ,EAAE;oBAC3D,gBAAgB,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;iBACtC,CAAC;gBACF,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;YAC7B,CAAC,CAAC,CAAC;YACH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;gBACvB,MAAM,CAAC,CAAC,CAAC,CAAC;YACZ,CAAC,CAAC,CAAC;SACJ;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,CAAC,CAAC,CAAC,CAAC;SACX;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AApCD,wBAoCC","sourcesContent":["/**\n * Utility function for constructing a multipart form in Node.js.\n *\n * @packageDocumentation\n * @internal\n * @hidden\n */\n\nimport { Readable } from \"stream\";\nimport { Headers } from \"../connection\";\n\ndeclare class MultiPart {\n append(key: string, value: Readable | Buffer | string): void;\n getBoundary(): string;\n stream(): Readable;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst Multipart = require(\"multi-part\") as typeof MultiPart;\n\n/**\n * @internal\n * @hidden\n */\nexport type Fields = {\n [key: string]: any;\n};\n\n/**\n * @internal\n * @hidden\n */\nexport interface MultipartRequest {\n headers?: Headers;\n body: Buffer;\n}\n\n/**\n * @internal\n * @hidden\n */\nexport function toForm(fields: Fields): Promise<MultipartRequest> {\n return new Promise((resolve, reject) => {\n try {\n const form = new Multipart();\n for (const key of Object.keys(fields)) {\n let value = fields[key];\n if (value === undefined) continue;\n if (\n !(value instanceof Readable) &&\n !(value instanceof global.Buffer) &&\n (typeof value === \"object\" || typeof value === \"function\")\n ) {\n value = JSON.stringify(value);\n }\n form.append(key, value);\n }\n const stream = form.stream();\n const bufs: Buffer[] = [];\n stream.on(\"data\", (buf) => bufs.push(buf as Buffer));\n stream.on(\"end\", () => {\n bufs.push(Buffer.from(\"\\r\\n\"));\n const body = Buffer.concat(bufs);\n const boundary = form.getBoundary();\n const headers = {\n \"content-type\": `multipart/form-data; boundary=${boundary}`,\n \"content-length\": String(body.length),\n };\n resolve({ body, headers });\n });\n stream.on(\"error\", (e) => {\n reject(e);\n });\n } catch (e) {\n reject(e);\n }\n });\n}\n"]}
|
package/lib/normalizeUrl.js
CHANGED
|
@@ -16,7 +16,7 @@ function normalizeUrl(url) {
|
|
|
16
16
|
const raw = url.match(/^(tcp|ssl|tls)((?::|\+).+)/);
|
|
17
17
|
if (raw)
|
|
18
18
|
url = (raw[1] === "tcp" ? "http" : "https") + raw[2];
|
|
19
|
-
const unix = url.match(/^(?:(https
|
|
19
|
+
const unix = url.match(/^(?:(http|https)\+)?unix:\/\/(\/.+)/);
|
|
20
20
|
if (unix)
|
|
21
21
|
url = `${unix[1] || "http"}://unix:${unix[2]}`;
|
|
22
22
|
return url;
|
package/lib/normalizeUrl.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeUrl.js","sourceRoot":"","sources":["../../src/lib/normalizeUrl.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH;;;GAGG;AACH,SAAgB,YAAY,CAAC,GAAW;IACtC,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;IACpD,IAAI,GAAG;QAAE,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAC9D,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"normalizeUrl.js","sourceRoot":"","sources":["../../src/lib/normalizeUrl.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH;;;GAGG;AACH,SAAgB,YAAY,CAAC,GAAW;IACtC,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;IACpD,IAAI,GAAG;QAAE,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAC9D,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC;IAC9D,IAAI,IAAI;QAAE,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,MAAM,WAAW,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IACzD,OAAO,GAAG,CAAC;AACb,CAAC;AAND,oCAMC","sourcesContent":["/**\n * Utility function for normalizing URLs.\n *\n * @packageDocumentation\n * @internal\n * @hidden\n */\n\n/**\n * @internal\n * @hidden\n */\nexport function normalizeUrl(url: string): string {\n const raw = url.match(/^(tcp|ssl|tls)((?::|\\+).+)/);\n if (raw) url = (raw[1] === \"tcp\" ? \"http\" : \"https\") + raw[2];\n const unix = url.match(/^(?:(http|https)\\+)?unix:\\/\\/(\\/.+)/);\n if (unix) url = `${unix[1] || \"http\"}://unix:${unix[2]}`;\n return url;\n}\n"]}
|
package/lib/request.node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.node.js","sourceRoot":"","sources":["../../src/lib/request.node.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,+BAOc;AACd,iCAAqE;AACrE,
|
|
1
|
+
{"version":3,"file":"request.node.js","sourceRoot":"","sources":["../../src/lib/request.node.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,+BAOc;AACd,iCAAqE;AACrE,6BAA4D;AAE5D,iCAA8B;AAE9B,yCAAsC;AACtC,iCAA8B;AA0C9B;;;GAGG;AACU,QAAA,SAAS,GAAG,KAAK,CAAC;AAE/B;;;;;;;;;GASG;AACH,SAAgB,aAAa,CAC3B,OAAe,EACf,YAAgD,EAChD,KAAW;IAEX,MAAM,YAAY,GAAG,WAAQ,CAAC,OAAO,CAAgC,CAAC;IACtE,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE;QAC1B,MAAM,IAAI,KAAK,CAAC,8BAA8B,OAAO,EAAE,CAAC,CAAC;KAC1D;IACD,MAAM,KAAK,GAAG,YAAY,CAAC,QAAQ,KAAK,QAAQ,CAAC;IACjD,IAAI,UAA8B,CAAC;IACnC,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,YAAY,CAAC,QAAQ,SAAS,CAAC,EAAE;QACzD,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE;YAC1B,MAAM,IAAI,KAAK,CACb,uHAAuH,OAAO,EAAE,CACjI,CAAC;SACH;QACD,MAAM,CAAC,GAAG,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC7C,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE;YACZ,UAAU,GAAG,YAAY,CAAC,QAAQ,CAAC;YACnC,OAAO,YAAY,CAAC,QAAQ,CAAC;SAC9B;aAAM;YACL,UAAU,GAAG,YAAY,CAAC,QAAQ,CAAC,KAAK,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AAC,CAAC,CAAC;SACP;IACH,CAAC,EACD;QACE,KAAK;YACH,KAAK,CAAC,OAAO,EAAE,CAAC;QAClB,CAAC;KACF,CACF,CAAC;AACJ,CAAC;AA3HD,sCA2HC","sourcesContent":["/**\n * Node.js implementation of the HTTP(S) request function.\n *\n * @packageDocumentation\n * @internal\n * @hidden\n */\n\nimport {\n Agent as HttpAgent,\n AgentOptions,\n ClientRequest,\n ClientRequestArgs,\n IncomingMessage,\n request as httpRequest,\n} from \"http\";\nimport { Agent as HttpsAgent, request as httpsRequest } from \"https\";\nimport { parse as parseUrl, UrlWithStringQuery } from \"url\";\nimport { Headers, RequestInterceptors } from \"../connection\";\nimport { btoa } from \"./btoa\";\nimport { Errback } from \"./errback\";\nimport { joinPath } from \"./joinPath\";\nimport { omit } from \"./omit\";\n\n/**\n * @internal\n * @hidden\n */\nexport interface ArangojsResponse extends IncomingMessage {\n request: ClientRequest;\n body?: any;\n arangojsHostId?: number;\n}\n\n/**\n * @internal\n * @hidden\n */\nexport interface ArangojsError extends Error {\n request: ClientRequest;\n}\n\n/**\n * @internal\n * @hidden\n */\nexport type RequestOptions = {\n method: string;\n url: { pathname: string; search?: string };\n headers: Headers;\n body: any;\n expectBinary: boolean;\n timeout?: number;\n};\n\n/**\n * @internal\n * @hidden\n */\nexport type RequestFunction = {\n (options: RequestOptions, cb: Errback<ArangojsResponse>): void;\n close?: () => void;\n};\n\n/**\n * @internal\n * @hidden\n */\nexport const isBrowser = false;\n\n/**\n * Create a function for performing requests against a given host.\n *\n * @param baseUrl - Base URL of the host, i.e. protocol, port and domain name.\n * @param agentOptions - Options to use for creating the agent.\n * @param agent - Agent to use for performing requests.\n *\n * @internal\n * @hidden\n */\nexport function createRequest(\n baseUrl: string,\n agentOptions: AgentOptions & RequestInterceptors,\n agent?: any\n): RequestFunction {\n const baseUrlParts = parseUrl(baseUrl) as Partial<UrlWithStringQuery>;\n if (!baseUrlParts.protocol) {\n throw new Error(`Invalid URL (no protocol): ${baseUrl}`);\n }\n const isTls = baseUrlParts.protocol === \"https:\";\n let socketPath: string | undefined;\n if (baseUrl.startsWith(`${baseUrlParts.protocol}//unix:`)) {\n if (!baseUrlParts.pathname) {\n throw new Error(\n `Unix socket URL must be in the format http://unix:/socket/path, http+unix:///socket/path or unix:///socket/path not ${baseUrl}`\n );\n }\n const i = baseUrlParts.pathname.indexOf(\":\");\n if (i === -1) {\n socketPath = baseUrlParts.pathname;\n delete baseUrlParts.pathname;\n } else {\n socketPath = baseUrlParts.pathname.slice(0, i);\n baseUrlParts.pathname = baseUrlParts.pathname.slice(i + 1);\n if (baseUrlParts.pathname === \"\") {\n delete baseUrlParts.pathname;\n }\n }\n }\n if (socketPath && !socketPath.replace(/\\//g, \"\").length) {\n throw new Error(`Invalid URL (empty unix socket path): ${baseUrl}`);\n }\n if (!agent) {\n const opts = omit(agentOptions, [\"before\", \"after\"]);\n if (isTls) agent = new HttpsAgent(opts);\n else agent = new HttpAgent(opts);\n }\n return Object.assign(\n function request(\n { method, url, headers, body, timeout }: RequestOptions,\n callback: Errback<ArangojsResponse>\n ) {\n let path = baseUrlParts.pathname\n ? url.pathname\n ? joinPath(baseUrlParts.pathname, url.pathname)\n : baseUrlParts.pathname\n : url.pathname;\n const search = url.search\n ? baseUrlParts.search\n ? `${baseUrlParts.search}&${url.search.slice(1)}`\n : url.search\n : baseUrlParts.search;\n if (search) path += search;\n if (body && !headers[\"content-length\"]) {\n headers[\"content-length\"] = String(Buffer.byteLength(body));\n }\n if (!headers[\"authorization\"]) {\n headers[\"authorization\"] = `Basic ${btoa(\n baseUrlParts.auth || \"root:\"\n )}`;\n }\n const options: ClientRequestArgs = { path, method, headers, agent };\n if (socketPath) {\n options.socketPath = socketPath;\n } else {\n options.host = baseUrlParts.hostname;\n options.port = baseUrlParts.port;\n }\n let called = false;\n try {\n const req = (isTls ? httpsRequest : httpRequest)(\n options,\n (res: IncomingMessage) => {\n const data: Buffer[] = [];\n res.on(\"data\", (chunk) => data.push(chunk as Buffer));\n res.on(\"end\", () => {\n const response = res as ArangojsResponse;\n response.request = req;\n response.body = Buffer.concat(data);\n if (called) return;\n called = true;\n if (agentOptions.after) {\n agentOptions.after(null, response);\n }\n callback(null, response);\n });\n }\n );\n if (timeout) {\n req.setTimeout(timeout);\n }\n req.on(\"timeout\", () => {\n req.abort();\n });\n req.on(\"error\", (err) => {\n const error = err as ArangojsError;\n error.request = req;\n if (called) return;\n called = true;\n if (agentOptions.after) {\n agentOptions.after(error);\n }\n callback(error);\n });\n if (body) req.write(body);\n if (agentOptions.before) {\n agentOptions.before(req);\n }\n req.end();\n } catch (e) {\n if (called) return;\n called = true;\n setTimeout(() => {\n callback(e);\n }, 0);\n }\n },\n {\n close() {\n agent.destroy();\n },\n }\n );\n}\n"]}
|
package/lib/xhr.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xhr.d.ts","sourceRoot":"","sources":["../../src/lib/xhr.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"xhr.d.ts","sourceRoot":"","sources":["../../src/lib/xhr.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;kCAQzB,GAAG,MACR,OAAO,CAAC,GAAG,CAAC,KACb,aAAa;AARlB;;;GAGG;AAEH,wBAGmB"}
|
package/lib/xhr.js
CHANGED
package/lib/xhr.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xhr.js","sourceRoot":"","sources":["../../src/lib/xhr.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAKH;;;GAGG;AACH,kBAAe,OAAO,CAAC,KAAK,CAGV,CAAC","sourcesContent":["/**\n * Wrapper around the `xhr` module for HTTP(S) requests in the browser.\n *\n * @packageDocumentation\n * @internal\n * @hidden\n */\n\nimport { ClientRequest } from \"http\";\nimport { Errback } from \"./errback\";\n\n/**\n * @internal\n * @hidden\n */\nexport default require(\"xhr\") as (\n options: any,\n cb: Errback<any>\n) => ClientRequest;\n"]}
|
|
1
|
+
{"version":3,"file":"xhr.js","sourceRoot":"","sources":["../../src/lib/xhr.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAKH;;;GAGG;AACH,8DAA8D;AAC9D,kBAAe,OAAO,CAAC,KAAK,CAGV,CAAC","sourcesContent":["/**\n * Wrapper around the `xhr` module for HTTP(S) requests in the browser.\n *\n * @packageDocumentation\n * @internal\n * @hidden\n */\n\nimport { ClientRequest } from \"http\";\nimport { Errback } from \"./errback\";\n\n/**\n * @internal\n * @hidden\n */\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nexport default require(\"xhr\") as (\n options: any,\n cb: Errback<any>\n) => ClientRequest;\n"]}
|
package/package.json
CHANGED
package/view.d.ts
CHANGED
|
@@ -314,7 +314,7 @@ export declare type ArangoSearchViewPropertiesOptions = {
|
|
|
314
314
|
* See {@link ArangoSearchView} for the concrete type representing an
|
|
315
315
|
* ArangoSearch View.
|
|
316
316
|
*/
|
|
317
|
-
export declare class View<PropertiesOptions extends
|
|
317
|
+
export declare class View<PropertiesOptions extends Record<string, any> = any, Properties extends Record<string, any> = any> {
|
|
318
318
|
protected _name: string;
|
|
319
319
|
protected _db: Database;
|
|
320
320
|
/**
|
package/view.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../src/view.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,sBAAsB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC;;GAEG;AACH,oBAAY,QAAQ;I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AC,IAAI,CAClB,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,iBAAiB,CACf,UAA8B;QAE9B,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CACrB;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,cAAc,IAAI,CAAC,IAAI,aAAa;YAC1C,IAAI,EAAE,UAAU,IAAI,EAAE;SACvB,EACD,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAClB,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;OAWG;IACH,IAAI;QACF,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CACrB;YACE,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,cAAc,IAAI,CAAC,IAAI,EAAE;SAChC,EACD,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CACzB,CAAC;IACJ,CAAC;CACF;AApOD,oBAoOC","sourcesContent":["/**\n * ```ts\n * import type { ArangoSearchView } from \"arangojs/view\";\n * ```\n *\n * The \"view\" module provides View related types and interfaces for TypeScript.\n *\n * @packageDocumentation\n */\nimport { ArangoResponseMetadata, Dict } from \"./connection\";\nimport { Database } from \"./database\";\nimport { isArangoError } from \"./error\";\nimport { VIEW_NOT_FOUND } from \"./lib/codes\";\n\n/**\n * String values indicating the View type.\n */\nexport enum ViewType {\n ARANGOSEARCH_VIEW = \"arangosearch\",\n}\n\n/**\n * Indicates whether the given value represents a {@link View}.\n *\n * @param view - A value that might be a View.\n */\nexport function isArangoView(view: any): view is View {\n return Boolean(view && view.isArangoView);\n}\n\n/**\n * Generic description of a View.\n */\nexport type ViewDescription = {\n /**\n * A globally unique identifier for this View.\n */\n globallyUniqueId: string;\n /**\n * An identifier for this View.\n */\n id: string;\n /**\n * Name of the View.\n */\n name: string;\n /**\n * Type of the View.\n */\n type: ViewType;\n};\n\n/**\n * A link definition for an ArangoSearch View.\n */\nexport type ArangoSearchViewLink = {\n /**\n * A list of names of Analyzers to apply to values of processed document\n * attributes.\n *\n * Default: `[\"identity\"]`\n */\n analyzers?: string[];\n /**\n * An object mapping names of attributes to process for each document to\n * {@link ArangoSearchViewLink} definitions.\n */\n fields?: Dict<ArangoSearchViewLink | undefined>;\n /**\n * If set to `true`, all document attributes will be processed, otherwise\n * only the attributes in `fields` will be processed.\n *\n * Default: `false`\n */\n includeAllFields?: boolean;\n /**\n * If set to `true`, the position of values in array values will be tracked,\n * otherwise all values in an array will be treated as equal alternatives.\n */\n trackListPositions?: boolean;\n /**\n * Controls how the view should keep track of the attribute values.\n *\n * Default: `\"none\"`\n */\n storeValues?: \"none\" | \"id\";\n};\n\n/**\n * Properties of an ArangoSearch View.\n */\nexport type ArangoSearchViewProperties = {\n /**\n * How many commits to wait between removing unused files.\n */\n cleanupIntervalStep: number;\n /**\n * How long to wait between applying the `consolidationPolicy`.\n */\n consolidationIntervalMsec: number;\n /**\n * Maximum number of writers cached in the pool.\n */\n writebufferIdle: number;\n /**\n * Maximum number of concurrent active writers that perform a transaction.\n */\n writebufferActive: number;\n /**\n * Maximum memory byte size per writer before a writer flush is triggered.\n */\n writebufferSizeMax: number;\n /**\n * Consolidation policy to apply for selecting which segments should be\n * merged.\n */\n consolidationPolicy: BytesAccumConsolidationPolicy | TierConsolidationPolicy;\n /**\n * Attribute path (`field`) for the value of each document that is\n * used for sorting.\n */\n primarySort: {\n /**\n * Attribute path for the value of each document used for\n * sorting.\n */\n field: string;\n /**\n * If set to `\"asc\"`, the primary sorting order is ascending.\n * If set to `\"desc\"`, the primary sorting order is descending.\n */\n direction: \"desc\" | \"asc\";\n }[];\n /**\n * Compression to use for the primary sort data.\n *\n * Default: `\"lz4\"`\n */\n primarySortCompression: PrimarySortCompression;\n /**\n * Attribute paths for which values should be stored in the view index\n * in addition to those used for sorting via `primarySort`.\n */\n storedValues: {\n /**\n * Attribute paths for which values should be stored in the view index\n * in addition to those used for sorting via `primarySort`.\n */\n fields: string[];\n }[];\n /**\n * An object mapping names of linked collections to\n * {@link ArangoSearchViewLink} definitions.\n */\n links: Dict<ArangoSearchViewLink | undefined>;\n};\n\n/**\n * Policy to consolidate based on segment byte size and live document count as\n * dictated by the customization attributes.\n */\nexport type BytesAccumConsolidationPolicy = {\n /**\n * Type of consolidation policy.\n */\n type: \"bytes_accum\";\n /**\n * Must be in the range of `0.0` to `1.0`.\n */\n threshold?: number;\n};\n\n/**\n * Policy to consolidate if the sum of all candidate segment byte size is less\n * than the total segment byte size multiplied by a given threshold.\n */\nexport type TierConsolidationPolicy = {\n /**\n * Type of consolidation policy.\n */\n type: \"tier\";\n /**\n * Minimum number of segments that will be evaluated as candidates\n * for consolidation.\n *\n * Default: `1`\n */\n segmentsMin?: number;\n /**\n * Maximum number of segments that will be evaluated as candidates\n * for consolidation.\n *\n * Default: `10`\n */\n segmentsMax?: number;\n /**\n * Maximum allowed size of all consolidated segments.\n *\n * Default: `5368709120`, i.e. 5 GiB\n */\n segmentsBytesMax?: number;\n /**\n * Defines the value to treat all smaller segments as equal for\n * consolidation selection.\n *\n * Default: `2097152`, i.e. 2 MiB\n */\n segmentsBytesFloor?: number;\n /**\n * Minimum score.\n */\n minScore?: number;\n};\n\n/**\n * Compression to use for primary sort data of a View.\n *\n * Default: `\"lz4\"`\n */\nexport type PrimarySortCompression = \"lz4\" | \"none\";\n\n/**\n * Properties of an ArangoSearch View.\n */\nexport type ArangoSearchViewPropertiesOptions = {\n /**\n * How many commits to wait between removing unused files.\n *\n * Default: `2`\n */\n cleanupIntervalStep?: number;\n /**\n * How long to wait between applying the `consolidationPolicy`.\n *\n * Default: `10000`\n */\n consolidationIntervalMsec?: number;\n /**\n * How long to wait between commiting View data store changes and making\n * documents visible to queries.\n *\n * Default: `1000`\n */\n commitIntervalMsec?: number;\n /**\n * Maximum number of writers cached in the pool.\n *\n * Default: `64`\n */\n writebufferIdle?: number;\n /**\n * Maximum number of concurrent active writers that perform a transaction.\n *\n * Default: `0`\n */\n writebufferActive?: number;\n /**\n * Maximum memory byte size per writer before a writer flush is triggered.\n *\n * Default: `33554432`, i.e. 32 MiB\n */\n writebufferSizeMax?: number;\n /**\n * Consolidation policy to apply for selecting which segments should be\n * merged.\n */\n consolidationPolicy?: BytesAccumConsolidationPolicy | TierConsolidationPolicy;\n /**\n * Attribute path (`field`) for the value of each document that will be\n * used for sorting.\n *\n * If `direction` is set to `\"asc\"` or `asc` is set to `true`,\n * the primary sorting order will be ascending.\n *\n * If `direction` is set to `\"desc\"` or `asc` is set to `false`,\n * the primary sorting order will be descending.\n */\n primarySort?: (\n | {\n /**\n * Attribute path for the value of each document to use for\n * sorting.\n */\n field: string;\n /**\n * If set to `\"asc\"`, the primary sorting order will be ascending.\n * If set to `\"desc\"`, the primary sorting order will be descending.\n */\n direction: \"desc\" | \"asc\";\n }\n | {\n /**\n * Attribute path for the value of each document to use for\n * sorting.\n */\n field: string;\n /**\n * If set to `true`, the primary sorting order will be ascending.\n * If set to `false`, the primary sorting order will be descending.\n */\n asc: boolean;\n }\n )[];\n /**\n * Compression to use for the primary sort data.\n *\n * Default: `\"lz4\"`\n */\n primarySortCompression?: PrimarySortCompression;\n /**\n * Attribute paths for which values should be stored in the view index\n * in addition to those used for sorting via `primarySort`.\n */\n storedValues?: {\n /**\n * Attribute paths for which values should be stored in the view index\n * in addition to those used for sorting via `primarySort`.\n */\n fields: string[];\n }[];\n /**\n * An object mapping names of linked collections to\n * {@link ArangoSearchViewLink} definitions.\n */\n links?: Dict<ArangoSearchViewLink | undefined>;\n};\n\n/**\n * Represents a View in a {@link Database}.\n *\n * See {@link ArangoSearchView} for the concrete type representing an\n * ArangoSearch View.\n */\nexport class View<\n PropertiesOptions extends object = any,\n Properties extends object = any\n> {\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;\n }\n\n /**\n * @internal\n *\n * Indicates that this object represents an ArangoDB View.\n */\n get isArangoView(): true {\n return true;\n }\n\n /**\n * Name of the View.\n */\n get name() {\n return this._name;\n }\n\n /**\n * Retrieves general information about the View.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view = db.view(\"some-view\");\n * const data = await view.get();\n * // data contains general information about the View\n * ```\n */\n get(): Promise<ViewDescription & ArangoResponseMetadata> {\n return this._db.request(\n { path: `/_api/view/${this.name}` },\n (res) => res.body\n );\n }\n\n /**\n * Checks whether the View exists.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view = db.view(\"some-view\");\n * const exists = await view.exists();\n * console.log(exists); // indicates whether the View 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 === VIEW_NOT_FOUND) {\n return false;\n }\n throw err;\n }\n }\n\n /**\n * Creates a View with the given `options` and the instance's name.\n *\n * See also {@link Database.createView}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view = db.view(\"potatoes\");\n * await view.create();\n * // the ArangoSearch View \"potatoes\" now exists\n * ```\n */\n create(\n options?: PropertiesOptions & { type: ViewType }\n ): Promise<ViewDescription & Properties> {\n return this._db.request(\n {\n method: \"POST\",\n path: \"/_api/view\",\n body: {\n type: ViewType.ARANGOSEARCH_VIEW,\n ...(options || {}),\n name: this.name,\n },\n },\n (res) => res.body\n );\n }\n\n /**\n * Renames the View and updates the instance's `name` to `newName`.\n *\n * Additionally removes the instance from the {@link Database}'s internal\n * cache.\n *\n * **Note**: Renaming Views may not be supported when ArangoDB is\n * running in a cluster configuration.\n *\n * @param newName - The new name of the View.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view1 = db.view(\"some-view\");\n * await view1.rename(\"other-view\");\n * const view2 = db.view(\"some-view\");\n * const view3 = db.view(\"other-view\");\n * // Note all three View instances are different objects but\n * // view1 and view3 represent the same ArangoDB view!\n * ```\n */\n async rename(\n newName: string\n ): Promise<ViewDescription & ArangoResponseMetadata> {\n const result = this._db.renameView(this._name, newName);\n this._name = newName;\n return result;\n }\n\n /**\n * Retrieves the View's properties.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view = db.view(\"some-view\");\n * const data = await view.properties();\n * // data contains the View's properties\n * ```\n */\n properties(): Promise<ViewDescription & Properties & ArangoResponseMetadata> {\n return this._db.request(\n { path: `/_api/view/${this.name}/properties` },\n (res) => res.body\n );\n }\n\n /**\n * Updates the properties of the View.\n *\n * @param properties - Properties of the View to update.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view = db.view(\"some-view\");\n * const result = await view.updateProperties({\n * consolidationIntervalMsec: 234\n * });\n * console.log(result.consolidationIntervalMsec); // 234\n * ```\n */\n updateProperties(\n properties?: PropertiesOptions\n ): Promise<ViewDescription & Properties> {\n return this._db.request(\n {\n method: \"PATCH\",\n path: `/_api/view/${this.name}/properties`,\n body: properties || {},\n },\n (res) => res.body\n );\n }\n\n /**\n * Replaces the properties of the View.\n *\n * @param properties - New properties of the View.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view = db.view(\"some-view\");\n * const result = await view.replaceProperties({\n * consolidationIntervalMsec: 234\n * });\n * console.log(result.consolidationIntervalMsec); // 234\n * ```\n */\n replaceProperties(\n properties?: PropertiesOptions\n ): Promise<ViewDescription & Properties> {\n return this._db.request(\n {\n method: \"PUT\",\n path: `/_api/view/${this.name}/properties`,\n body: properties || {},\n },\n (res) => res.body\n );\n }\n\n /**\n * Deletes the View from the database.\n *\n * @example\n *\n * ```js\n * const db = new Database();\n * const view = db.view(\"some-view\");\n * await view.drop();\n * // the View \"some-view\" no longer exists\n * ```\n */\n drop(): Promise<boolean> {\n return this._db.request(\n {\n method: \"DELETE\",\n path: `/_api/view/${this.name}`,\n },\n (res) => res.body.result\n );\n }\n}\n\n/**\n * Represents an ArangoSearch View in a {@link Database}.\n */\nexport interface ArangoSearchView\n extends View<\n ArangoSearchViewPropertiesOptions,\n ArangoSearchViewProperties & { type: ViewType.ARANGOSEARCH_VIEW }\n > {}\n"]}
|
|
1
|
+
{"version":3,"file":"view.js","sourceRoot":"","sources":["../src/view.ts"],"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,EAAE;SACvB,EACD,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAClB,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;OAWG;IACH,IAAI;QACF,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CACrB;YACE,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,cAAc,IAAI,CAAC,IAAI,EAAE;SAChC,EACD,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CACzB,CAAC;IACJ,CAAC;CACF;AApOD,oBAoOC","sourcesContent":["/**\n * ```ts\n * import type { ArangoSearchView } from \"arangojs/view\";\n * ```\n *\n * The \"view\" module provides View related types and interfaces for TypeScript.\n *\n * @packageDocumentation\n */\nimport { ArangoResponseMetadata, Dict } from \"./connection\";\nimport { Database } from \"./database\";\nimport { isArangoError } from \"./error\";\nimport { VIEW_NOT_FOUND } from \"./lib/codes\";\n\n/**\n * String values indicating the View type.\n */\nexport enum ViewType {\n ARANGOSEARCH_VIEW = \"arangosearch\",\n}\n\n/**\n * Indicates whether the given value represents a {@link View}.\n *\n * @param view - A value that might be a View.\n */\nexport function isArangoView(view: any): view is View {\n return Boolean(view && view.isArangoView);\n}\n\n/**\n * Generic description of a View.\n */\nexport type ViewDescription = {\n /**\n * A globally unique identifier for this View.\n */\n globallyUniqueId: string;\n /**\n * An identifier for this View.\n */\n id: string;\n /**\n * Name of the View.\n */\n name: string;\n /**\n * Type of the View.\n */\n type: ViewType;\n};\n\n/**\n * A link definition for an ArangoSearch View.\n */\nexport type ArangoSearchViewLink = {\n /**\n * A list of names of Analyzers to apply to values of processed document\n * attributes.\n *\n * Default: `[\"identity\"]`\n */\n analyzers?: string[];\n /**\n * An object mapping names of attributes to process for each document to\n * {@link ArangoSearchViewLink} definitions.\n */\n fields?: Dict<ArangoSearchViewLink | undefined>;\n /**\n * If set to `true`, all document attributes will be processed, otherwise\n * only the attributes in `fields` will be processed.\n *\n * Default: `false`\n */\n includeAllFields?: boolean;\n /**\n * If set to `true`, the position of values in array values will be tracked,\n * otherwise all values in an array will be treated as equal alternatives.\n */\n trackListPositions?: boolean;\n /**\n * Controls how the view should keep track of the attribute values.\n *\n * Default: `\"none\"`\n */\n storeValues?: \"none\" | \"id\";\n};\n\n/**\n * Properties of an ArangoSearch View.\n */\nexport type ArangoSearchViewProperties = {\n /**\n * How many commits to wait between removing unused files.\n */\n cleanupIntervalStep: number;\n /**\n * How long to wait between applying the `consolidationPolicy`.\n */\n consolidationIntervalMsec: number;\n /**\n * Maximum number of writers cached in the pool.\n */\n writebufferIdle: number;\n /**\n * Maximum number of concurrent active writers that perform a transaction.\n */\n writebufferActive: number;\n /**\n * Maximum memory byte size per writer before a writer flush is triggered.\n */\n writebufferSizeMax: number;\n /**\n * Consolidation policy to apply for selecting which segments should be\n * merged.\n */\n consolidationPolicy: BytesAccumConsolidationPolicy | TierConsolidationPolicy;\n /**\n * Attribute path (`field`) for the value of each document that is\n * used for sorting.\n */\n primarySort: {\n /**\n * Attribute path for the value of each document used for\n * sorting.\n */\n field: string;\n /**\n * If set to `\"asc\"`, the primary sorting order is ascending.\n * If set to `\"desc\"`, the primary sorting order is descending.\n */\n direction: \"desc\" | \"asc\";\n }[];\n /**\n * Compression to use for the primary sort data.\n *\n * Default: `\"lz4\"`\n */\n primarySortCompression: PrimarySortCompression;\n /**\n * Attribute paths for which values should be stored in the view index\n * in addition to those used for sorting via `primarySort`.\n */\n storedValues: {\n /**\n * Attribute paths for which values should be stored in the view index\n * in addition to those used for sorting via `primarySort`.\n */\n fields: string[];\n }[];\n /**\n * An object mapping names of linked collections to\n * {@link ArangoSearchViewLink} definitions.\n */\n links: Dict<ArangoSearchViewLink | undefined>;\n};\n\n/**\n * Policy to consolidate based on segment byte size and live document count as\n * dictated by the customization attributes.\n */\nexport type BytesAccumConsolidationPolicy = {\n /**\n * Type of consolidation policy.\n */\n type: \"bytes_accum\";\n /**\n * Must be in the range of `0.0` to `1.0`.\n */\n threshold?: number;\n};\n\n/**\n * Policy to consolidate if the sum of all candidate segment byte size is less\n * than the total segment byte size multiplied by a given threshold.\n */\nexport type TierConsolidationPolicy = {\n /**\n * Type of consolidation policy.\n */\n type: \"tier\";\n /**\n * Minimum number of segments that will be evaluated as candidates\n * for consolidation.\n *\n * Default: `1`\n */\n segmentsMin?: number;\n /**\n * Maximum number of segments that will be evaluated as candidates\n * for consolidation.\n *\n * Default: `10`\n */\n segmentsMax?: number;\n /**\n * Maximum allowed size of all consolidated segments.\n *\n * Default: `5368709120`, i.e. 5 GiB\n */\n segmentsBytesMax?: number;\n /**\n * Defines the value to treat all smaller segments as equal for\n * consolidation selection.\n *\n * Default: `2097152`, i.e. 2 MiB\n */\n segmentsBytesFloor?: number;\n /**\n * Minimum score.\n */\n minScore?: number;\n};\n\n/**\n * Compression to use for primary sort data of a View.\n *\n * Default: `\"lz4\"`\n */\nexport type PrimarySortCompression = \"lz4\" | \"none\";\n\n/**\n * Properties of an ArangoSearch View.\n */\nexport type ArangoSearchViewPropertiesOptions = {\n /**\n * How many commits to wait between removing unused files.\n *\n * Default: `2`\n */\n cleanupIntervalStep?: number;\n /**\n * How long to wait between applying the `consolidationPolicy`.\n *\n * Default: `10000`\n */\n consolidationIntervalMsec?: number;\n /**\n * How long to wait between commiting View data store changes and making\n * documents visible to queries.\n *\n * Default: `1000`\n */\n commitIntervalMsec?: number;\n /**\n * Maximum number of writers cached in the pool.\n *\n * Default: `64`\n */\n writebufferIdle?: number;\n /**\n * Maximum number of concurrent active writers that perform a transaction.\n *\n * Default: `0`\n */\n writebufferActive?: number;\n /**\n * Maximum memory byte size per writer before a writer flush is triggered.\n *\n * Default: `33554432`, i.e. 32 MiB\n */\n writebufferSizeMax?: number;\n /**\n * Consolidation policy to apply for selecting which segments should be\n * merged.\n */\n consolidationPolicy?: BytesAccumConsolidationPolicy | TierConsolidationPolicy;\n /**\n * Attribute path (`field`) for the value of each document that will be\n * used for sorting.\n *\n * If `direction` is set to `\"asc\"` or `asc` is set to `true`,\n * the primary sorting order will be ascending.\n *\n * If `direction` is set to `\"desc\"` or `asc` is set to `false`,\n * the primary sorting order will be descending.\n */\n primarySort?: (\n | {\n /**\n * Attribute path for the value of each document to use for\n * sorting.\n */\n field: string;\n /**\n * If set to `\"asc\"`, the primary sorting order will be ascending.\n * If set to `\"desc\"`, the primary sorting order will be descending.\n */\n direction: \"desc\" | \"asc\";\n }\n | {\n /**\n * Attribute path for the value of each document to use for\n * sorting.\n */\n field: string;\n /**\n * If set to `true`, the primary sorting order will be ascending.\n * If set to `false`, the primary sorting order will be descending.\n */\n asc: boolean;\n }\n )[];\n /**\n * Compression to use for the primary sort data.\n *\n * Default: `\"lz4\"`\n */\n primarySortCompression?: PrimarySortCompression;\n /**\n * Attribute paths for which values should be stored in the view index\n * in addition to those used for sorting via `primarySort`.\n */\n storedValues?: {\n /**\n * Attribute paths for which values should be stored in the view index\n * in addition to those used for sorting via `primarySort`.\n */\n fields: string[];\n }[];\n /**\n * An object mapping names of linked collections to\n * {@link ArangoSearchViewLink} definitions.\n */\n links?: Dict<ArangoSearchViewLink | undefined>;\n};\n\n/**\n * Represents a View in a {@link Database}.\n *\n * See {@link ArangoSearchView} for the concrete type representing an\n * ArangoSearch View.\n */\nexport class View<\n PropertiesOptions extends Record<string, any> = any,\n Properties extends Record<string, any> = any\n> {\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;\n }\n\n /**\n * @internal\n *\n * Indicates that this object represents an ArangoDB View.\n */\n get isArangoView(): true {\n return true;\n }\n\n /**\n * Name of the View.\n */\n get name() {\n return this._name;\n }\n\n /**\n * Retrieves general information about the View.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view = db.view(\"some-view\");\n * const data = await view.get();\n * // data contains general information about the View\n * ```\n */\n get(): Promise<ViewDescription & ArangoResponseMetadata> {\n return this._db.request(\n { path: `/_api/view/${this.name}` },\n (res) => res.body\n );\n }\n\n /**\n * Checks whether the View exists.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view = db.view(\"some-view\");\n * const exists = await view.exists();\n * console.log(exists); // indicates whether the View 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 === VIEW_NOT_FOUND) {\n return false;\n }\n throw err;\n }\n }\n\n /**\n * Creates a View with the given `options` and the instance's name.\n *\n * See also {@link Database.createView}.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view = db.view(\"potatoes\");\n * await view.create();\n * // the ArangoSearch View \"potatoes\" now exists\n * ```\n */\n create(\n options?: PropertiesOptions & { type: ViewType }\n ): Promise<ViewDescription & Properties> {\n return this._db.request(\n {\n method: \"POST\",\n path: \"/_api/view\",\n body: {\n type: ViewType.ARANGOSEARCH_VIEW,\n ...(options || {}),\n name: this.name,\n },\n },\n (res) => res.body\n );\n }\n\n /**\n * Renames the View and updates the instance's `name` to `newName`.\n *\n * Additionally removes the instance from the {@link Database}'s internal\n * cache.\n *\n * **Note**: Renaming Views may not be supported when ArangoDB is\n * running in a cluster configuration.\n *\n * @param newName - The new name of the View.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view1 = db.view(\"some-view\");\n * await view1.rename(\"other-view\");\n * const view2 = db.view(\"some-view\");\n * const view3 = db.view(\"other-view\");\n * // Note all three View instances are different objects but\n * // view1 and view3 represent the same ArangoDB view!\n * ```\n */\n async rename(\n newName: string\n ): Promise<ViewDescription & ArangoResponseMetadata> {\n const result = this._db.renameView(this._name, newName);\n this._name = newName;\n return result;\n }\n\n /**\n * Retrieves the View's properties.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view = db.view(\"some-view\");\n * const data = await view.properties();\n * // data contains the View's properties\n * ```\n */\n properties(): Promise<ViewDescription & Properties & ArangoResponseMetadata> {\n return this._db.request(\n { path: `/_api/view/${this.name}/properties` },\n (res) => res.body\n );\n }\n\n /**\n * Updates the properties of the View.\n *\n * @param properties - Properties of the View to update.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view = db.view(\"some-view\");\n * const result = await view.updateProperties({\n * consolidationIntervalMsec: 234\n * });\n * console.log(result.consolidationIntervalMsec); // 234\n * ```\n */\n updateProperties(\n properties?: PropertiesOptions\n ): Promise<ViewDescription & Properties> {\n return this._db.request(\n {\n method: \"PATCH\",\n path: `/_api/view/${this.name}/properties`,\n body: properties || {},\n },\n (res) => res.body\n );\n }\n\n /**\n * Replaces the properties of the View.\n *\n * @param properties - New properties of the View.\n *\n * @example\n * ```js\n * const db = new Database();\n * const view = db.view(\"some-view\");\n * const result = await view.replaceProperties({\n * consolidationIntervalMsec: 234\n * });\n * console.log(result.consolidationIntervalMsec); // 234\n * ```\n */\n replaceProperties(\n properties?: PropertiesOptions\n ): Promise<ViewDescription & Properties> {\n return this._db.request(\n {\n method: \"PUT\",\n path: `/_api/view/${this.name}/properties`,\n body: properties || {},\n },\n (res) => res.body\n );\n }\n\n /**\n * Deletes the View from the database.\n *\n * @example\n *\n * ```js\n * const db = new Database();\n * const view = db.view(\"some-view\");\n * await view.drop();\n * // the View \"some-view\" no longer exists\n * ```\n */\n drop(): Promise<boolean> {\n return this._db.request(\n {\n method: \"DELETE\",\n path: `/_api/view/${this.name}`,\n },\n (res) => res.body.result\n );\n }\n}\n\n/**\n * Represents an ArangoSearch View in a {@link Database}.\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface ArangoSearchView\n extends View<\n ArangoSearchViewPropertiesOptions,\n ArangoSearchViewProperties & { type: ViewType.ARANGOSEARCH_VIEW }\n > {}\n"]}
|