forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview.d.ts
More file actions
463 lines (463 loc) · 12.8 KB
/
Copy pathview.d.ts
File metadata and controls
463 lines (463 loc) · 12.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
/**
* ```ts
* import type { ArangoSearchView } from "arangojs/view";
* ```
*
* The "view" module provides View related types and interfaces for TypeScript.
*
* @packageDocumentation
*/
import { ArangoResponseMetadata, Dict } from "./connection";
import { Database } from "./database";
/**
* String values indicating the View type.
*/
export declare enum ViewType {
ARANGOSEARCH_VIEW = "arangosearch"
}
/**
* Indicates whether the given value represents a {@link View}.
*
* @param view - A value that might be a View.
*/
export declare function isArangoView(view: any): view is View;
/**
* Generic description of a View.
*/
export declare type ViewDescription = {
/**
* A globally unique identifier for this View.
*/
globallyUniqueId: string;
/**
* An identifier for this View.
*/
id: string;
/**
* Name of the View.
*/
name: string;
/**
* Type of the View.
*/
type: ViewType;
};
/**
* A link definition for an ArangoSearch View.
*/
export declare type ArangoSearchViewLink = {
/**
* A list of names of Analyzers to apply to values of processed document
* attributes.
*
* Default: `["identity"]`
*/
analyzers?: string[];
/**
* An object mapping names of attributes to process for each document to
* {@link ArangoSearchViewLink} definitions.
*/
fields?: Dict<ArangoSearchViewLink | undefined>;
/**
* If set to `true`, all document attributes will be processed, otherwise
* only the attributes in `fields` will be processed.
*
* Default: `false`
*/
includeAllFields?: boolean;
/**
* If set to `true`, the position of values in array values will be tracked,
* otherwise all values in an array will be treated as equal alternatives.
*/
trackListPositions?: boolean;
/**
* Controls how the view should keep track of the attribute values.
*
* Default: `"none"`
*/
storeValues?: "none" | "id";
};
/**
* Properties of an ArangoSearch View.
*/
export declare type ArangoSearchViewProperties = {
/**
* How many commits to wait between removing unused files.
*/
cleanupIntervalStep: number;
/**
* How long to wait between applying the `consolidationPolicy`.
*/
consolidationIntervalMsec: number;
/**
* Maximum number of writers cached in the pool.
*/
writebufferIdle: number;
/**
* Maximum number of concurrent active writers that perform a transaction.
*/
writebufferActive: number;
/**
* Maximum memory byte size per writer before a writer flush is triggered.
*/
writebufferSizeMax: number;
/**
* Consolidation policy to apply for selecting which segments should be
* merged.
*/
consolidationPolicy: BytesAccumConsolidationPolicy | TierConsolidationPolicy;
/**
* Attribute path (`field`) for the value of each document that is
* used for sorting.
*/
primarySort: {
/**
* Attribute path for the value of each document used for
* sorting.
*/
field: string;
/**
* If set to `"asc"`, the primary sorting order is ascending.
* If set to `"desc"`, the primary sorting order is descending.
*/
direction: "desc" | "asc";
}[];
/**
* Compression to use for the primary sort data.
*
* Default: `"lz4"`
*/
primarySortCompression: PrimarySortCompression;
/**
* Attribute paths for which values should be stored in the view index
* in addition to those used for sorting via `primarySort`.
*/
storedValues: {
/**
* Attribute paths for which values should be stored in the view index
* in addition to those used for sorting via `primarySort`.
*/
fields: string[];
}[];
/**
* An object mapping names of linked collections to
* {@link ArangoSearchViewLink} definitions.
*/
links: Dict<ArangoSearchViewLink | undefined>;
};
/**
* Policy to consolidate based on segment byte size and live document count as
* dictated by the customization attributes.
*/
export declare type BytesAccumConsolidationPolicy = {
/**
* Type of consolidation policy.
*/
type: "bytes_accum";
/**
* Must be in the range of `0.0` to `1.0`.
*/
threshold?: number;
};
/**
* Policy to consolidate if the sum of all candidate segment byte size is less
* than the total segment byte size multiplied by a given threshold.
*/
export declare type TierConsolidationPolicy = {
/**
* Type of consolidation policy.
*/
type: "tier";
/**
* Minimum number of segments that will be evaluated as candidates
* for consolidation.
*
* Default: `1`
*/
segmentsMin?: number;
/**
* Maximum number of segments that will be evaluated as candidates
* for consolidation.
*
* Default: `10`
*/
segmentsMax?: number;
/**
* Maximum allowed size of all consolidated segments.
*
* Default: `5368709120`, i.e. 5 GiB
*/
segmentsBytesMax?: number;
/**
* Defines the value to treat all smaller segments as equal for
* consolidation selection.
*
* Default: `2097152`, i.e. 2 MiB
*/
segmentsBytesFloor?: number;
/**
* Minimum score.
*/
minScore?: number;
};
/**
* Compression to use for primary sort data of a View.
*
* Default: `"lz4"`
*/
export declare type PrimarySortCompression = "lz4" | "none";
/**
* Properties of an ArangoSearch View.
*/
export declare type ArangoSearchViewPropertiesOptions = {
/**
* How many commits to wait between removing unused files.
*
* Default: `2`
*/
cleanupIntervalStep?: number;
/**
* How long to wait between applying the `consolidationPolicy`.
*
* Default: `10000`
*/
consolidationIntervalMsec?: number;
/**
* How long to wait between commiting View data store changes and making
* documents visible to queries.
*
* Default: `1000`
*/
commitIntervalMsec?: number;
/**
* Maximum number of writers cached in the pool.
*
* Default: `64`
*/
writebufferIdle?: number;
/**
* Maximum number of concurrent active writers that perform a transaction.
*
* Default: `0`
*/
writebufferActive?: number;
/**
* Maximum memory byte size per writer before a writer flush is triggered.
*
* Default: `33554432`, i.e. 32 MiB
*/
writebufferSizeMax?: number;
/**
* Consolidation policy to apply for selecting which segments should be
* merged.
*/
consolidationPolicy?: BytesAccumConsolidationPolicy | TierConsolidationPolicy;
/**
* Attribute path (`field`) for the value of each document that will be
* used for sorting.
*
* If `direction` is set to `"asc"` or `asc` is set to `true`,
* the primary sorting order will be ascending.
*
* If `direction` is set to `"desc"` or `asc` is set to `false`,
* the primary sorting order will be descending.
*/
primarySort?: ({
/**
* Attribute path for the value of each document to use for
* sorting.
*/
field: string;
/**
* If set to `"asc"`, the primary sorting order will be ascending.
* If set to `"desc"`, the primary sorting order will be descending.
*/
direction: "desc" | "asc";
} | {
/**
* Attribute path for the value of each document to use for
* sorting.
*/
field: string;
/**
* If set to `true`, the primary sorting order will be ascending.
* If set to `false`, the primary sorting order will be descending.
*/
asc: boolean;
})[];
/**
* Compression to use for the primary sort data.
*
* Default: `"lz4"`
*/
primarySortCompression?: PrimarySortCompression;
/**
* Attribute paths for which values should be stored in the view index
* in addition to those used for sorting via `primarySort`.
*/
storedValues?: {
/**
* Attribute paths for which values should be stored in the view index
* in addition to those used for sorting via `primarySort`.
*/
fields: string[];
}[];
/**
* An object mapping names of linked collections to
* {@link ArangoSearchViewLink} definitions.
*/
links?: Dict<ArangoSearchViewLink | undefined>;
};
/**
* Represents a View in a {@link Database}.
*
* See {@link ArangoSearchView} for the concrete type representing an
* ArangoSearch View.
*/
export declare class View<PropertiesOptions extends object = any, Properties extends object = any> {
protected _name: string;
protected _db: Database;
/**
* @internal
* @hidden
*/
constructor(db: Database, name: string);
/**
* @internal
*
* Indicates that this object represents an ArangoDB View.
*/
get isArangoView(): true;
/**
* Name of the View.
*/
get name(): string;
/**
* Retrieves general information about the View.
*
* @example
* ```js
* const db = new Database();
* const view = db.view("some-view");
* const data = await view.get();
* // data contains general information about the View
* ```
*/
get(): Promise<ViewDescription & ArangoResponseMetadata>;
/**
* Checks whether the View exists.
*
* @example
* ```js
* const db = new Database();
* const view = db.view("some-view");
* const exists = await view.exists();
* console.log(exists); // indicates whether the View exists
* ```
*/
exists(): Promise<boolean>;
/**
* Creates a View with the given `options` and the instance's name.
*
* See also {@link Database.createView}.
*
* @example
* ```js
* const db = new Database();
* const view = db.view("potatoes");
* await view.create();
* // the ArangoSearch View "potatoes" now exists
* ```
*/
create(options?: PropertiesOptions & {
type: ViewType;
}): Promise<ViewDescription & Properties>;
/**
* Renames the View and updates the instance's `name` to `newName`.
*
* Additionally removes the instance from the {@link Database}'s internal
* cache.
*
* **Note**: Renaming Views may not be supported when ArangoDB is
* running in a cluster configuration.
*
* @param newName - The new name of the View.
*
* @example
* ```js
* const db = new Database();
* const view1 = db.view("some-view");
* await view1.rename("other-view");
* const view2 = db.view("some-view");
* const view3 = db.view("other-view");
* // Note all three View instances are different objects but
* // view1 and view3 represent the same ArangoDB view!
* ```
*/
rename(newName: string): Promise<ViewDescription & ArangoResponseMetadata>;
/**
* Retrieves the View's properties.
*
* @example
* ```js
* const db = new Database();
* const view = db.view("some-view");
* const data = await view.properties();
* // data contains the View's properties
* ```
*/
properties(): Promise<ViewDescription & Properties & ArangoResponseMetadata>;
/**
* Updates the properties of the View.
*
* @param properties - Properties of the View to update.
*
* @example
* ```js
* const db = new Database();
* const view = db.view("some-view");
* const result = await view.updateProperties({
* consolidationIntervalMsec: 234
* });
* console.log(result.consolidationIntervalMsec); // 234
* ```
*/
updateProperties(properties?: PropertiesOptions): Promise<ViewDescription & Properties>;
/**
* Replaces the properties of the View.
*
* @param properties - New properties of the View.
*
* @example
* ```js
* const db = new Database();
* const view = db.view("some-view");
* const result = await view.replaceProperties({
* consolidationIntervalMsec: 234
* });
* console.log(result.consolidationIntervalMsec); // 234
* ```
*/
replaceProperties(properties?: PropertiesOptions): Promise<ViewDescription & Properties>;
/**
* Deletes the View from the database.
*
* @example
*
* ```js
* const db = new Database();
* const view = db.view("some-view");
* await view.drop();
* // the View "some-view" no longer exists
* ```
*/
drop(): Promise<boolean>;
}
/**
* Represents an ArangoSearch View in a {@link Database}.
*/
export interface ArangoSearchView extends View<ArangoSearchViewPropertiesOptions, ArangoSearchViewProperties & {
type: ViewType.ARANGOSEARCH_VIEW;
}> {
}
//# sourceMappingURL=view.d.ts.map