@documentdb-js/operator-registry 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +92 -0
- package/dist/accumulators.d.ts +2 -0
- package/dist/accumulators.d.ts.map +1 -0
- package/dist/accumulators.js +177 -0
- package/dist/accumulators.js.map +1 -0
- package/dist/bsonConstructors.d.ts +2 -0
- package/dist/bsonConstructors.d.ts.map +1 -0
- package/dist/bsonConstructors.js +81 -0
- package/dist/bsonConstructors.js.map +1 -0
- package/dist/docLinks.d.ts +13 -0
- package/dist/docLinks.d.ts.map +1 -0
- package/dist/docLinks.js +76 -0
- package/dist/docLinks.js.map +1 -0
- package/dist/docLinks.test.d.ts +2 -0
- package/dist/docLinks.test.d.ts.map +1 -0
- package/dist/docLinks.test.js +67 -0
- package/dist/docLinks.test.js.map +1 -0
- package/dist/expressionOperators.d.ts +2 -0
- package/dist/expressionOperators.d.ts.map +1 -0
- package/dist/expressionOperators.js +1094 -0
- package/dist/expressionOperators.js.map +1 -0
- package/dist/getFilteredCompletions.d.ts +48 -0
- package/dist/getFilteredCompletions.d.ts.map +1 -0
- package/dist/getFilteredCompletions.js +90 -0
- package/dist/getFilteredCompletions.js.map +1 -0
- package/dist/getFilteredCompletions.test.d.ts +2 -0
- package/dist/getFilteredCompletions.test.d.ts.map +1 -0
- package/dist/getFilteredCompletions.test.js +202 -0
- package/dist/getFilteredCompletions.test.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +97 -0
- package/dist/index.js.map +1 -0
- package/dist/metaTags.d.ts +62 -0
- package/dist/metaTags.d.ts.map +1 -0
- package/dist/metaTags.js +116 -0
- package/dist/metaTags.js.map +1 -0
- package/dist/operatorReference.test.d.ts +2 -0
- package/dist/operatorReference.test.d.ts.map +1 -0
- package/dist/operatorReference.test.js +209 -0
- package/dist/operatorReference.test.js.map +1 -0
- package/dist/parseOperatorReference.d.ts +54 -0
- package/dist/parseOperatorReference.d.ts.map +1 -0
- package/dist/parseOperatorReference.js +103 -0
- package/dist/parseOperatorReference.js.map +1 -0
- package/dist/parseOperatorReference.test.d.ts +2 -0
- package/dist/parseOperatorReference.test.d.ts.map +1 -0
- package/dist/parseOperatorReference.test.js +151 -0
- package/dist/parseOperatorReference.test.js.map +1 -0
- package/dist/queryOperators.d.ts +2 -0
- package/dist/queryOperators.d.ts.map +1 -0
- package/dist/queryOperators.js +398 -0
- package/dist/queryOperators.js.map +1 -0
- package/dist/stages.d.ts +2 -0
- package/dist/stages.d.ts.map +1 -0
- package/dist/stages.js +265 -0
- package/dist/stages.js.map +1 -0
- package/dist/structuralInvariants.test.d.ts +2 -0
- package/dist/structuralInvariants.test.d.ts.map +1 -0
- package/dist/structuralInvariants.test.js +219 -0
- package/dist/structuralInvariants.test.js.map +1 -0
- package/dist/systemVariables.d.ts +2 -0
- package/dist/systemVariables.d.ts.map +1 -0
- package/dist/systemVariables.js +64 -0
- package/dist/systemVariables.js.map +1 -0
- package/dist/types.d.ts +139 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/dist/updateOperators.d.ts +2 -0
- package/dist/updateOperators.d.ts.map +1 -0
- package/dist/updateOperators.js +188 -0
- package/dist/updateOperators.js.map +1 -0
- package/dist/windowOperators.d.ts +2 -0
- package/dist/windowOperators.d.ts.map +1 -0
- package/dist/windowOperators.js +219 -0
- package/dist/windowOperators.js.map +1 -0
- package/package.json +25 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { type ALL_META_TAGS } from './metaTags';
|
|
2
|
+
/**
|
|
3
|
+
* Represents a single operator, stage, accumulator, or BSON constructor
|
|
4
|
+
* for use in autocomplete, hover docs, and diagnostics.
|
|
5
|
+
*/
|
|
6
|
+
export interface OperatorEntry {
|
|
7
|
+
/** The operator string, e.g. "$gt", "$match", "ObjectId" */
|
|
8
|
+
readonly value: string;
|
|
9
|
+
/**
|
|
10
|
+
* Category tag for filtering. Determines which contexts this entry
|
|
11
|
+
* appears in. See {@link MetaTag} for the full set.
|
|
12
|
+
*
|
|
13
|
+
* Examples: "query", "query:comparison", "stage", "accumulator",
|
|
14
|
+
* "expr:arith", "expr:date", "bson", "field:identifier"
|
|
15
|
+
*/
|
|
16
|
+
readonly meta: MetaTag;
|
|
17
|
+
/** Human-readable one-line description. */
|
|
18
|
+
readonly description: string;
|
|
19
|
+
/**
|
|
20
|
+
* Monaco snippet with tab stops for insertion.
|
|
21
|
+
* Example: '{ \\$match: { ${1:field}: ${2:value} } }'
|
|
22
|
+
* If absent, `value` is inserted as-is.
|
|
23
|
+
*/
|
|
24
|
+
readonly snippet?: string;
|
|
25
|
+
/**
|
|
26
|
+
* URL to the DocumentDB documentation page for this operator.
|
|
27
|
+
* Generated from `docLinks.ts` helpers.
|
|
28
|
+
*/
|
|
29
|
+
readonly link?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Applicable BSON types for type-aware filtering.
|
|
32
|
+
* If set, this operator only appears when the field's bsonType
|
|
33
|
+
* matches one of these values. If absent, the operator is universal.
|
|
34
|
+
*
|
|
35
|
+
* Example: $regex → ['string'], $size → ['array']
|
|
36
|
+
*/
|
|
37
|
+
readonly applicableBsonTypes?: readonly string[];
|
|
38
|
+
/**
|
|
39
|
+
* Whether this operator is valid as a standalone completion at top-level
|
|
40
|
+
* positions (key, value, operator). Defaults to `true` when absent.
|
|
41
|
+
*
|
|
42
|
+
* Set to `false` for operators that are only valid inside another operator's
|
|
43
|
+
* value object — e.g., geospatial shape specifiers (`$box`, `$geometry`)
|
|
44
|
+
* which are only valid inside `$geoWithin`/`$near`, or sort-only modifiers
|
|
45
|
+
* like `$natural`.
|
|
46
|
+
*
|
|
47
|
+
* Completion providers should filter out `standalone === false` entries
|
|
48
|
+
* from standard completion lists. These entries remain in the registry
|
|
49
|
+
* for hover documentation and future context-aware nested completions.
|
|
50
|
+
*/
|
|
51
|
+
readonly standalone?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* @experimental Not yet populated by the generator; reserved for a future
|
|
54
|
+
* contextual-snippet feature.
|
|
55
|
+
*
|
|
56
|
+
* When populated, this field carries a hint about the type of value an operator
|
|
57
|
+
* produces or expects, enabling the CompletionItemProvider to tailor snippets
|
|
58
|
+
* and insert sensible placeholder values based on context.
|
|
59
|
+
*
|
|
60
|
+
* Planned values and their meanings:
|
|
61
|
+
* - `"number"` — operator always produces a number
|
|
62
|
+
* (e.g. `$size` on an array field → insert a numeric comparand)
|
|
63
|
+
* - `"boolean"` — operator produces true/false
|
|
64
|
+
* (e.g. `$and`, `$or` in expression context)
|
|
65
|
+
* - `"string"` — operator produces a string
|
|
66
|
+
* (e.g. `$concat`, `$toLower`)
|
|
67
|
+
* - `"array"` — operator produces an array
|
|
68
|
+
* (e.g. `$push` accumulator, `$concatArrays`)
|
|
69
|
+
* - `"date"` — operator produces a date
|
|
70
|
+
* (e.g. `$dateAdd`, `$toDate`)
|
|
71
|
+
* - `"same"` — operator produces the same type as its input
|
|
72
|
+
* (e.g. `$min`, `$max`, comparison operators like `$gt`)
|
|
73
|
+
* - `"object"` — operator produces a document/object
|
|
74
|
+
* (e.g. `$mergeObjects`)
|
|
75
|
+
* - `"any"` — return type is undetermined or context-dependent
|
|
76
|
+
*
|
|
77
|
+
* This field is intentionally absent from all current entries. The generator
|
|
78
|
+
* (`scripts/generate-from-reference.ts`) does not yet emit it. It will be
|
|
79
|
+
* populated in a follow-up pass once the `CompletionItemProvider` is ready
|
|
80
|
+
* to consume it.
|
|
81
|
+
*/
|
|
82
|
+
readonly returnType?: string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Filter configuration for {@link getFilteredCompletions}.
|
|
86
|
+
*/
|
|
87
|
+
export interface CompletionFilter {
|
|
88
|
+
/**
|
|
89
|
+
* Meta tag prefixes to include. Supports prefix matching:
|
|
90
|
+
* 'query' matches 'query', 'query:comparison', 'query:logical', etc.
|
|
91
|
+
* 'expr' matches all 'expr:*' entries.
|
|
92
|
+
*/
|
|
93
|
+
readonly meta: readonly string[];
|
|
94
|
+
/** Optional: only return operators applicable to these BSON types. */
|
|
95
|
+
readonly bsonTypes?: readonly string[];
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Meta tag constants. Tags use a hierarchical scheme:
|
|
99
|
+
*
|
|
100
|
+
* - 'query' — top-level query operators (in find filter, $match)
|
|
101
|
+
* - 'query:comparison' — comparison subset ($eq, $gt, etc.)
|
|
102
|
+
* - 'query:logical' — logical ($and, $or, $not, $nor)
|
|
103
|
+
* - 'query:element' — element ($exists, $type)
|
|
104
|
+
* - 'query:evaluation' — evaluation ($expr, $regex, $mod, $text)
|
|
105
|
+
* - 'query:array' — array ($all, $elemMatch, $size)
|
|
106
|
+
* - 'query:bitwise' — bitwise ($bitsAllSet, etc.)
|
|
107
|
+
* - 'query:geospatial' — geospatial ($geoWithin, $near, etc.)
|
|
108
|
+
* - 'query:projection' — projection ($, $elemMatch, $slice)
|
|
109
|
+
* - 'query:misc' — miscellaneous ($comment, $rand, $natural)
|
|
110
|
+
* - 'update' — update operators ($set, $unset, $inc, etc.)
|
|
111
|
+
* - 'update:field' — field update subset
|
|
112
|
+
* - 'update:array' — array update subset ($push, $pull, etc.)
|
|
113
|
+
* - 'update:bitwise' — bitwise update ($bit)
|
|
114
|
+
* - 'stage' — aggregation pipeline stages ($match, $group, etc.)
|
|
115
|
+
* - 'accumulator' — accumulators ($sum, $avg, $first, etc.)
|
|
116
|
+
* - 'expr:arith' — arithmetic expressions ($add, $subtract, etc.)
|
|
117
|
+
* - 'expr:array' — array expressions ($arrayElemAt, $filter, etc.)
|
|
118
|
+
* - 'expr:bool' — boolean expressions ($and, $or, $not)
|
|
119
|
+
* - 'expr:comparison' — comparison expressions ($cmp, $eq, etc.)
|
|
120
|
+
* - 'expr:conditional' — conditional ($cond, $ifNull, $switch)
|
|
121
|
+
* - 'expr:date' — date expressions ($dateAdd, $year, etc.)
|
|
122
|
+
* - 'expr:object' — object expressions ($mergeObjects, etc.)
|
|
123
|
+
* - 'expr:set' — set expressions ($setUnion, etc.)
|
|
124
|
+
* - 'expr:string' — string expressions ($concat, $substr, etc.)
|
|
125
|
+
* - 'expr:trig' — trigonometry ($sin, $cos, etc.)
|
|
126
|
+
* - 'expr:type' — type conversion ($convert, $toInt, etc.)
|
|
127
|
+
* - 'expr:datasize' — data size ($bsonSize, $binarySize)
|
|
128
|
+
* - 'expr:timestamp' — timestamp ($tsIncrement, $tsSecond)
|
|
129
|
+
* - 'expr:bitwise' — bitwise expressions ($bitAnd, $bitOr, etc.)
|
|
130
|
+
* - 'expr:literal' — $literal
|
|
131
|
+
* - 'expr:misc' — miscellaneous expressions ($getField, $rand, etc.)
|
|
132
|
+
* - 'expr:variable' — variable expressions ($let)
|
|
133
|
+
* - 'window' — window operators ($rank, $denseRank, etc.)
|
|
134
|
+
* - 'bson' — BSON constructor functions (ObjectId, ISODate, etc.)
|
|
135
|
+
* - 'variable' — system variables ($$NOW, $$ROOT, etc.)
|
|
136
|
+
* - 'field:identifier' — injected field names from schema (not static)
|
|
137
|
+
*/
|
|
138
|
+
export type MetaTag = (typeof ALL_META_TAGS)[number] | (string & {});
|
|
139
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC1B,4DAA4D;IAC5D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAEvB,2CAA2C;IAC3C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAE1B;;;OAGG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;;;OAMG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAEjD;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IAEjC,sEAAsE;IACtE,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;gGAGgG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateOperators.d.ts","sourceRoot":"","sources":["../src/updateOperators.ts"],"names":[],"mappings":"AAuMA,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.loadUpdateOperators = loadUpdateOperators;
|
|
8
|
+
// AUTO-GENERATED — DO NOT EDIT BY HAND
|
|
9
|
+
//
|
|
10
|
+
// Generated by: npm run generate (scripts/generate-from-reference.ts)
|
|
11
|
+
// Sources: resources/scraped/operator-reference.md
|
|
12
|
+
// resources/overrides/operator-overrides.md
|
|
13
|
+
// resources/overrides/operator-snippets.md
|
|
14
|
+
//
|
|
15
|
+
// To change operator data, edit the overrides/snippets files and re-run the generator.
|
|
16
|
+
const docLinks_1 = require("./docLinks");
|
|
17
|
+
const getFilteredCompletions_1 = require("./getFilteredCompletions");
|
|
18
|
+
const metaTags_1 = require("./metaTags");
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
// Field Update Operators
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
const fieldUpdateOperators = [
|
|
23
|
+
{
|
|
24
|
+
value: '$currentDate',
|
|
25
|
+
meta: metaTags_1.META_UPDATE_FIELD,
|
|
26
|
+
description: 'The $currentDate operator sets the value of a field to the current date, either as a Date or a timestamp.',
|
|
27
|
+
snippet: '{ $currentDate: { "${1:field}": true } }',
|
|
28
|
+
link: (0, docLinks_1.getDocLink)('$currentDate', metaTags_1.META_UPDATE_FIELD),
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
value: '$inc',
|
|
32
|
+
meta: metaTags_1.META_UPDATE_FIELD,
|
|
33
|
+
description: 'The $inc operator increments the value of a field by a specified amount.',
|
|
34
|
+
snippet: '{ $inc: { "${1:field}": ${2:value} } }',
|
|
35
|
+
link: (0, docLinks_1.getDocLink)('$inc', metaTags_1.META_UPDATE_FIELD),
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
value: '$min',
|
|
39
|
+
meta: metaTags_1.META_UPDATE_FIELD,
|
|
40
|
+
description: 'Updates the field only if the specified value is less than the existing field value.',
|
|
41
|
+
snippet: '{ $min: { "${1:field}": ${2:value} } }',
|
|
42
|
+
link: 'https://learn.microsoft.com/en-us/azure/documentdb/operators/accumulators/$min', // inferred from another category
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
value: '$max',
|
|
46
|
+
meta: metaTags_1.META_UPDATE_FIELD,
|
|
47
|
+
description: 'Updates the field only if the specified value is greater than the existing field value.',
|
|
48
|
+
snippet: '{ $max: { "${1:field}": ${2:value} } }',
|
|
49
|
+
link: 'https://learn.microsoft.com/en-us/azure/documentdb/operators/accumulators/$max', // inferred from another category
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
value: '$mul',
|
|
53
|
+
meta: metaTags_1.META_UPDATE_FIELD,
|
|
54
|
+
description: 'The $mul operator multiplies the value of a field by a specified number.',
|
|
55
|
+
snippet: '{ $mul: { "${1:field}": ${2:value} } }',
|
|
56
|
+
link: (0, docLinks_1.getDocLink)('$mul', metaTags_1.META_UPDATE_FIELD),
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
value: '$rename',
|
|
60
|
+
meta: metaTags_1.META_UPDATE_FIELD,
|
|
61
|
+
description: 'The $rename operator allows renaming fields in documents during update operations.',
|
|
62
|
+
snippet: '{ $rename: { "${1:oldField}": "${2:newField}" } }',
|
|
63
|
+
link: (0, docLinks_1.getDocLink)('$rename', metaTags_1.META_UPDATE_FIELD),
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
value: '$set',
|
|
67
|
+
meta: metaTags_1.META_UPDATE_FIELD,
|
|
68
|
+
description: 'The $set operator in Azure DocumentDB updates or creates a new field with a specified value',
|
|
69
|
+
snippet: '{ $set: { "${1:field}": ${2:value} } }',
|
|
70
|
+
link: 'https://learn.microsoft.com/en-us/azure/documentdb/operators/aggregation/$set', // inferred from another category
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
value: '$setOnInsert',
|
|
74
|
+
meta: metaTags_1.META_UPDATE_FIELD,
|
|
75
|
+
description: 'The $setOnInsert operator sets field values only when an upsert operation results in an insert of a new document.',
|
|
76
|
+
snippet: '{ $setOnInsert: { "${1:field}": ${2:value} } }',
|
|
77
|
+
link: (0, docLinks_1.getDocLink)('$setOnInsert', metaTags_1.META_UPDATE_FIELD),
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
value: '$unset',
|
|
81
|
+
meta: metaTags_1.META_UPDATE_FIELD,
|
|
82
|
+
description: 'Removes the specified field from a document.',
|
|
83
|
+
snippet: '{ $unset: { "${1:field}": ${2:value} } }',
|
|
84
|
+
link: 'https://learn.microsoft.com/en-us/azure/documentdb/operators/aggregation/$unset', // inferred from another category
|
|
85
|
+
},
|
|
86
|
+
];
|
|
87
|
+
// ---------------------------------------------------------------------------
|
|
88
|
+
// Array Update Operators
|
|
89
|
+
// ---------------------------------------------------------------------------
|
|
90
|
+
const arrayUpdateOperators = [
|
|
91
|
+
{
|
|
92
|
+
value: '$',
|
|
93
|
+
meta: metaTags_1.META_UPDATE_ARRAY,
|
|
94
|
+
description: 'The $ positional operator identifies an element in an array to update without explicitly specifying the position of the element in the array.',
|
|
95
|
+
link: (0, docLinks_1.getDocLink)('$', metaTags_1.META_UPDATE_ARRAY),
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
value: '$[]',
|
|
99
|
+
meta: metaTags_1.META_UPDATE_ARRAY,
|
|
100
|
+
description: 'Positional all operator. Acts as a placeholder to update all elements in an array field.',
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
value: '$[identifier]',
|
|
104
|
+
meta: metaTags_1.META_UPDATE_ARRAY,
|
|
105
|
+
description: 'Filtered positional operator. Acts as a placeholder to update elements that match an arrayFilters condition.',
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
value: '$addToSet',
|
|
109
|
+
meta: metaTags_1.META_UPDATE_ARRAY,
|
|
110
|
+
description: "The addToSet operator adds elements to an array if they don't already exist, while ensuring uniqueness of elements within the set.",
|
|
111
|
+
snippet: '{ $addToSet: { "${1:field}": ${2:value} } }',
|
|
112
|
+
link: (0, docLinks_1.getDocLink)('$addToSet', metaTags_1.META_UPDATE_ARRAY),
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
value: '$pop',
|
|
116
|
+
meta: metaTags_1.META_UPDATE_ARRAY,
|
|
117
|
+
description: 'Removes the first or last element of an array.',
|
|
118
|
+
snippet: '{ $pop: { "${1:field}": ${2:1} } }',
|
|
119
|
+
link: (0, docLinks_1.getDocLink)('$pop', metaTags_1.META_UPDATE_ARRAY),
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
value: '$pull',
|
|
123
|
+
meta: metaTags_1.META_UPDATE_ARRAY,
|
|
124
|
+
description: 'Removes all instances of a value from an array.',
|
|
125
|
+
snippet: '{ $pull: { "${1:field}": ${2:condition} } }',
|
|
126
|
+
link: (0, docLinks_1.getDocLink)('$pull', metaTags_1.META_UPDATE_ARRAY),
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
value: '$push',
|
|
130
|
+
meta: metaTags_1.META_UPDATE_ARRAY,
|
|
131
|
+
description: 'The $push operator adds a specified value to an array within a document.',
|
|
132
|
+
snippet: '{ $push: { "${1:field}": ${2:value} } }',
|
|
133
|
+
link: (0, docLinks_1.getDocLink)('$push', metaTags_1.META_UPDATE_ARRAY),
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
value: '$pullAll',
|
|
137
|
+
meta: metaTags_1.META_UPDATE_ARRAY,
|
|
138
|
+
description: 'The $pullAll operator is used to remove all instances of the specified values from an array.',
|
|
139
|
+
snippet: '{ $pullAll: { "${1:field}": [${2:values}] } }',
|
|
140
|
+
link: (0, docLinks_1.getDocLink)('$pullAll', metaTags_1.META_UPDATE_ARRAY),
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
value: '$each',
|
|
144
|
+
meta: metaTags_1.META_UPDATE_ARRAY,
|
|
145
|
+
description: 'The $each operator is used within an `$addToSet`or`$push` operation to add multiple elements to an array field in a single update operation.',
|
|
146
|
+
snippet: '{ $each: [${1:values}] }',
|
|
147
|
+
link: (0, docLinks_1.getDocLink)('$each', metaTags_1.META_UPDATE_ARRAY),
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
value: '$position',
|
|
151
|
+
meta: metaTags_1.META_UPDATE_ARRAY,
|
|
152
|
+
description: 'Specifies the position in the array at which the $push operator inserts elements. Used with $each.',
|
|
153
|
+
snippet: '{ $position: ${1:index} }',
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
value: '$slice',
|
|
157
|
+
meta: metaTags_1.META_UPDATE_ARRAY,
|
|
158
|
+
description: 'Limits the number of elements in an array during a `$push` operation.',
|
|
159
|
+
snippet: '{ $slice: ${1:number} }',
|
|
160
|
+
link: 'https://learn.microsoft.com/en-us/azure/documentdb/operators/array-expression/$slice', // inferred from another category
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
value: '$sort',
|
|
164
|
+
meta: metaTags_1.META_UPDATE_ARRAY,
|
|
165
|
+
description: 'Sorts the elements of an array during a `$push` operation.',
|
|
166
|
+
snippet: '{ $sort: { "${1:field}": ${2:1} } }',
|
|
167
|
+
link: 'https://learn.microsoft.com/en-us/azure/documentdb/operators/aggregation/$sort', // inferred from another category
|
|
168
|
+
},
|
|
169
|
+
];
|
|
170
|
+
// ---------------------------------------------------------------------------
|
|
171
|
+
// Bitwise Update Operators
|
|
172
|
+
// ---------------------------------------------------------------------------
|
|
173
|
+
const bitwiseUpdateOperators = [
|
|
174
|
+
{
|
|
175
|
+
value: '$bit',
|
|
176
|
+
meta: metaTags_1.META_UPDATE_BITWISE,
|
|
177
|
+
description: 'The `$bit` operator is used to perform bitwise operations on integer values.',
|
|
178
|
+
snippet: '{ $bit: { "${1:field}": { "${2:and|or|xor}": ${3:value} } } }',
|
|
179
|
+
link: (0, docLinks_1.getDocLink)('$bit', metaTags_1.META_UPDATE_BITWISE),
|
|
180
|
+
},
|
|
181
|
+
];
|
|
182
|
+
// ---------------------------------------------------------------------------
|
|
183
|
+
// Registration
|
|
184
|
+
// ---------------------------------------------------------------------------
|
|
185
|
+
function loadUpdateOperators() {
|
|
186
|
+
(0, getFilteredCompletions_1.registerOperators)([...fieldUpdateOperators, ...arrayUpdateOperators, ...bitwiseUpdateOperators]);
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=updateOperators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateOperators.js","sourceRoot":"","sources":["../src/updateOperators.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAoMhG,kDAEC;AApMD,uCAAuC;AACvC,EAAE;AACF,uEAAuE;AACvE,wDAAwD;AACxD,0DAA0D;AAC1D,yDAAyD;AACzD,EAAE;AACF,uFAAuF;AAEvF,yCAAwC;AACxC,qEAA6D;AAC7D,yCAAuF;AAGvF,8EAA8E;AAC9E,yBAAyB;AACzB,8EAA8E;AAE9E,MAAM,oBAAoB,GAA6B;IACnD;QACI,KAAK,EAAE,cAAc;QACrB,IAAI,EAAE,4BAAiB;QACvB,WAAW,EACP,2GAA2G;QAC/G,OAAO,EAAE,0CAA0C;QACnD,IAAI,EAAE,IAAA,qBAAU,EAAC,cAAc,EAAE,4BAAiB,CAAC;KACtD;IACD;QACI,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,4BAAiB;QACvB,WAAW,EAAE,0EAA0E;QACvF,OAAO,EAAE,wCAAwC;QACjD,IAAI,EAAE,IAAA,qBAAU,EAAC,MAAM,EAAE,4BAAiB,CAAC;KAC9C;IACD;QACI,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,4BAAiB;QACvB,WAAW,EA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,OAAO,EAAE,0BAA0B;QACnC,IAAI,EAAE,IAAA,qBAAU,EAAC,OAAO,EAAE,4BAAiB,CAAC;KAC/C;IACD;QACI,KAAK,EAAE,WAAW;QAClB,IAAI,EAAE,4BAAiB;QACvB,WAAW,EACP,oGAAoG;QACxG,OAAO,EAAE,2BAA2B;KACvC;IACD;QACI,KAAK,EAAE,QAAQ;QACf,IAAI,EAAE,4BAAiB;QACvB,WAAW,EAAE,uEAAuE;QACpF,OAAO,EAAE,yBAAyB;QAClC,IAAI,EAAE,sFAAsF,EAAE,iCAAiC;KAClI;IACD;QACI,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,4BAAiB;QACvB,WAAW,EAAE,4DAA4D;QACzE,OAAO,EAAE,qCAAqC;QAC9C,IAAI,EAAE,gFAAgF,EAAE,iCAAiC;KAC5H;CACJ,CAAC;AAEF,8EAA8E;AAC9E,2BAA2B;AAC3B,8EAA8E;AAE9E,MAAM,sBAAsB,GAA6B;IACrD;QACI,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,8BAAmB;QACzB,WAAW,EAAE,8EAA8E;QAC3F,OAAO,EAAE,+DAA+D;QACxE,IAAI,EAAE,IAAA,qBAAU,EAAC,MAAM,EAAE,8BAAmB,CAAC;KAChD;CACJ,CAAC;AAEF,8EAA8E;AAC9E,eAAe;AACf,8EAA8E;AAE9E,SAAgB,mBAAmB;IAC/B,IAAA,0CAAiB,EAAC,CAAC,GAAG,oBAAoB,EAAE,GAAG,oBAAoB,EAAE,GAAG,sBAAsB,CAAC,CAAC,CAAC;AACrG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"windowOperators.d.ts","sourceRoot":"","sources":["../src/windowOperators.ts"],"names":[],"mappings":"AAsOA,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C"}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.loadWindowOperators = loadWindowOperators;
|
|
8
|
+
// AUTO-GENERATED — DO NOT EDIT BY HAND
|
|
9
|
+
//
|
|
10
|
+
// Generated by: npm run generate (scripts/generate-from-reference.ts)
|
|
11
|
+
// Sources: resources/scraped/operator-reference.md
|
|
12
|
+
// resources/overrides/operator-overrides.md
|
|
13
|
+
// resources/overrides/operator-snippets.md
|
|
14
|
+
//
|
|
15
|
+
// To change operator data, edit the overrides/snippets files and re-run the generator.
|
|
16
|
+
const docLinks_1 = require("./docLinks");
|
|
17
|
+
const getFilteredCompletions_1 = require("./getFilteredCompletions");
|
|
18
|
+
const metaTags_1 = require("./metaTags");
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
// Window Operators
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
const windowOperators = [
|
|
23
|
+
{
|
|
24
|
+
value: '$sum',
|
|
25
|
+
meta: metaTags_1.META_WINDOW,
|
|
26
|
+
description: 'The $sum operator calculates the sum of the values of a field based on a filtering criteria',
|
|
27
|
+
snippet: '{ $sum: "${1:\\$field}" }',
|
|
28
|
+
link: 'https://learn.microsoft.com/en-us/azure/documentdb/operators/accumulators/$sum', // inferred from another category
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
value: '$push',
|
|
32
|
+
meta: metaTags_1.META_WINDOW,
|
|
33
|
+
description: 'The $push operator adds a specified value to an array within a document.',
|
|
34
|
+
snippet: '{ $push: "${1:\\$field}" }',
|
|
35
|
+
link: 'https://learn.microsoft.com/en-us/azure/documentdb/operators/array-update/$push', // inferred from another category
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
value: '$addToSet',
|
|
39
|
+
meta: metaTags_1.META_WINDOW,
|
|
40
|
+
description: "The addToSet operator adds elements to an array if they don't already exist, while ensuring uniqueness of elements within the set.",
|
|
41
|
+
snippet: '{ $addToSet: "${1:\\$field}" }',
|
|
42
|
+
link: 'https://learn.microsoft.com/en-us/azure/documentdb/operators/array-update/$addtoset', // inferred from another category
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
value: '$count',
|
|
46
|
+
meta: metaTags_1.META_WINDOW,
|
|
47
|
+
description: 'The `$count` operator is used to count the number of documents that match a query filtering criteria.',
|
|
48
|
+
snippet: '{ $count: "${1:\\$field}" }',
|
|
49
|
+
link: 'https://learn.microsoft.com/en-us/azure/documentdb/operators/accumulators/$count', // inferred from another category
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
value: '$max',
|
|
53
|
+
meta: metaTags_1.META_WINDOW,
|
|
54
|
+
description: 'The $max operator returns the maximum value from a set of input values.',
|
|
55
|
+
snippet: '{ $max: "${1:\\$field}" }',
|
|
56
|
+
link: 'https://learn.microsoft.com/en-us/azure/documentdb/operators/accumulators/$max', // inferred from another category
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
value: '$min',
|
|
60
|
+
meta: metaTags_1.META_WINDOW,
|
|
61
|
+
description: 'Retrieves the minimum value for a specified field',
|
|
62
|
+
snippet: '{ $min: "${1:\\$field}" }',
|
|
63
|
+
link: 'https://learn.microsoft.com/en-us/azure/documentdb/operators/accumulators/$min', // inferred from another category
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
value: '$avg',
|
|
67
|
+
meta: metaTags_1.META_WINDOW,
|
|
68
|
+
description: 'Computes the average of numeric values for documents in a group, bucket, or window.',
|
|
69
|
+
snippet: '{ $avg: "${1:\\$field}" }',
|
|
70
|
+
link: 'https://learn.microsoft.com/en-us/azure/documentdb/operators/accumulators/$avg', // inferred from another category
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
value: '$stdDevPop',
|
|
74
|
+
meta: metaTags_1.META_WINDOW,
|
|
75
|
+
description: 'The $stddevpop operator calculates the standard deviation of the specified values',
|
|
76
|
+
snippet: '{ $stdDevPop: "${1:\\$field}" }',
|
|
77
|
+
link: 'https://learn.microsoft.com/en-us/azure/documentdb/operators/accumulators/$stddevpop', // inferred from another category
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
value: '$bottom',
|
|
81
|
+
meta: metaTags_1.META_WINDOW,
|
|
82
|
+
description: "The $bottom operator returns the last document from the query's result set sorted by one or more fields",
|
|
83
|
+
snippet: '{ $bottom: "${1:\\$field}" }',
|
|
84
|
+
link: 'https://learn.microsoft.com/en-us/azure/documentdb/operators/accumulators/$bottom', // inferred from another category
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
value: '$bottomN',
|
|
88
|
+
meta: metaTags_1.META_WINDOW,
|
|
89
|
+
description: 'The $bottomN operator returns the last N documents from the result sorted by one or more fields',
|
|
90
|
+
snippet: '{ $bottomN: "${1:\\$field}" }',
|
|
91
|
+
link: 'https://learn.microsoft.com/en-us/azure/documentdb/operators/accumulators/$bottomn', // inferred from another category
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
value: '$covariancePop',
|
|
95
|
+
meta: metaTags_1.META_WINDOW,
|
|
96
|
+
description: 'The $covariancePop operator returns the covariance of two numerical expressions',
|
|
97
|
+
snippet: '{ $covariancePop: "${1:\\$field}" }',
|
|
98
|
+
link: (0, docLinks_1.getDocLink)('$covariancePop', metaTags_1.META_WINDOW),
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
value: '$covarianceSamp',
|
|
102
|
+
meta: metaTags_1.META_WINDOW,
|
|
103
|
+
description: 'The $covarianceSamp operator returns the covariance of a sample of two numerical expressions',
|
|
104
|
+
snippet: '{ $covarianceSamp: "${1:\\$field}" }',
|
|
105
|
+
link: (0, docLinks_1.getDocLink)('$covarianceSamp', metaTags_1.META_WINDOW),
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
value: '$denseRank',
|
|
109
|
+
meta: metaTags_1.META_WINDOW,
|
|
110
|
+
description: 'The $denseRank operator assigns and returns a positional ranking for each document within a partition based on a specified sort order',
|
|
111
|
+
snippet: '{ $denseRank: {} }',
|
|
112
|
+
link: (0, docLinks_1.getDocLink)('$denseRank', metaTags_1.META_WINDOW),
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
value: '$derivative',
|
|
116
|
+
meta: metaTags_1.META_WINDOW,
|
|
117
|
+
description: 'The $derivative operator calculates the average rate of change of the value of a field within a specified window.',
|
|
118
|
+
snippet: '{ $derivative: { input: "${1:\\$field}", unit: "${2:hour}" } }',
|
|
119
|
+
link: (0, docLinks_1.getDocLink)('$derivative', metaTags_1.META_WINDOW),
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
value: '$documentNumber',
|
|
123
|
+
meta: metaTags_1.META_WINDOW,
|
|
124
|
+
description: 'The $documentNumber operator assigns and returns a position for each document within a partition based on a specified sort order',
|
|
125
|
+
snippet: '{ $documentNumber: {} }',
|
|
126
|
+
link: (0, docLinks_1.getDocLink)('$documentNumber', metaTags_1.META_WINDOW),
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
value: '$expMovingAvg',
|
|
130
|
+
meta: metaTags_1.META_WINDOW,
|
|
131
|
+
description: 'The $expMovingAvg operator calculates the moving average of a field based on the specified number of documents to hold the highest weight',
|
|
132
|
+
snippet: '{ $expMovingAvg: { input: "${1:\\$field}", N: ${2:number} } }',
|
|
133
|
+
link: (0, docLinks_1.getDocLink)('$expMovingAvg', metaTags_1.META_WINDOW),
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
value: '$first',
|
|
137
|
+
meta: metaTags_1.META_WINDOW,
|
|
138
|
+
description: "The $first operator returns the first value in a group according to the group's sorting order.",
|
|
139
|
+
snippet: '{ $first: "${1:\\$field}" }',
|
|
140
|
+
link: 'https://learn.microsoft.com/en-us/azure/documentdb/operators/accumulators/$first', // inferred from another category
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
value: '$integral',
|
|
144
|
+
meta: metaTags_1.META_WINDOW,
|
|
145
|
+
description: 'The $integral operator calculates the area under a curve with the specified range of documents forming the adjacent documents for the calculation.',
|
|
146
|
+
snippet: '{ $integral: { input: "${1:\\$field}", unit: "${2:hour}" } }',
|
|
147
|
+
link: (0, docLinks_1.getDocLink)('$integral', metaTags_1.META_WINDOW),
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
value: '$last',
|
|
151
|
+
meta: metaTags_1.META_WINDOW,
|
|
152
|
+
description: 'The $last operator returns the last document from the result sorted by one or more fields',
|
|
153
|
+
snippet: '{ $last: "${1:\\$field}" }',
|
|
154
|
+
link: 'https://learn.microsoft.com/en-us/azure/documentdb/operators/accumulators/$last', // inferred from another category
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
value: '$linearFill',
|
|
158
|
+
meta: metaTags_1.META_WINDOW,
|
|
159
|
+
description: 'The $linearFill operator interpolates missing values in a sequence of documents using linear interpolation.',
|
|
160
|
+
snippet: '{ $linearFill: "${1:\\$field}" }',
|
|
161
|
+
link: (0, docLinks_1.getDocLink)('$linearFill', metaTags_1.META_WINDOW),
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
value: '$locf',
|
|
165
|
+
meta: metaTags_1.META_WINDOW,
|
|
166
|
+
description: 'The $locf operator propagates the last observed non-null value forward within a partition in a windowed query.',
|
|
167
|
+
snippet: '{ $locf: "${1:\\$field}" }',
|
|
168
|
+
link: (0, docLinks_1.getDocLink)('$locf', metaTags_1.META_WINDOW),
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
value: '$minN',
|
|
172
|
+
meta: metaTags_1.META_WINDOW,
|
|
173
|
+
description: 'Retrieves the bottom N values based on a specified filtering criteria',
|
|
174
|
+
snippet: '{ $minN: "${1:\\$field}" }',
|
|
175
|
+
link: 'https://learn.microsoft.com/en-us/azure/documentdb/operators/accumulators/$minn',
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
value: '$rank',
|
|
179
|
+
meta: metaTags_1.META_WINDOW,
|
|
180
|
+
description: 'The $rank operator ranks documents within a partition based on a specified sort order.',
|
|
181
|
+
snippet: '{ $rank: {} }',
|
|
182
|
+
link: (0, docLinks_1.getDocLink)('$rank', metaTags_1.META_WINDOW),
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
value: '$shift',
|
|
186
|
+
meta: metaTags_1.META_WINDOW,
|
|
187
|
+
description: 'A window operator that shifts values within a partition and returns the shifted value.',
|
|
188
|
+
snippet: '{ $shift: { output: "${1:\\$field}", by: ${2:1}, default: ${3:null} } }',
|
|
189
|
+
link: (0, docLinks_1.getDocLink)('$shift', metaTags_1.META_WINDOW),
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
value: '$stdDevSamp',
|
|
193
|
+
meta: metaTags_1.META_WINDOW,
|
|
194
|
+
description: 'The $stddevsamp operator calculates the standard deviation of a specified sample of values and not the entire population',
|
|
195
|
+
snippet: '{ $stdDevSamp: "${1:\\$field}" }',
|
|
196
|
+
link: 'https://learn.microsoft.com/en-us/azure/documentdb/operators/accumulators/$stddevsamp', // inferred from another category
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
value: '$top',
|
|
200
|
+
meta: metaTags_1.META_WINDOW,
|
|
201
|
+
description: 'The $top operator returns the first document from the result set sorted by one or more fields',
|
|
202
|
+
snippet: '{ $top: "${1:\\$field}" }',
|
|
203
|
+
link: 'https://learn.microsoft.com/en-us/azure/documentdb/operators/accumulators/$top', // inferred from another category
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
value: '$topN',
|
|
207
|
+
meta: metaTags_1.META_WINDOW,
|
|
208
|
+
description: 'The $topN operator returns the first N documents from the result sorted by one or more fields',
|
|
209
|
+
snippet: '{ $topN: "${1:\\$field}" }',
|
|
210
|
+
link: 'https://learn.microsoft.com/en-us/azure/documentdb/operators/accumulators/$topn', // inferred from another category
|
|
211
|
+
},
|
|
212
|
+
];
|
|
213
|
+
// ---------------------------------------------------------------------------
|
|
214
|
+
// Registration
|
|
215
|
+
// ---------------------------------------------------------------------------
|
|
216
|
+
function loadWindowOperators() {
|
|
217
|
+
(0, getFilteredCompletions_1.registerOperators)([...windowOperators]);
|
|
218
|
+
}
|
|
219
|
+
//# sourceMappingURL=windowOperators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"windowOperators.js","sourceRoot":"","sources":["../src/windowOperators.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAmOhG,kDAEC;AAnOD,uCAAuC;AACvC,EAAE;AACF,uEAAuE;AACvE,wDAAwD;AACxD,0DAA0D;AAC1D,yDAAyD;AACzD,EAAE;AACF,uFAAuF;AAEvF,yCAAwC;AACxC,qEAA6D;AAC7D,yCAAyC;AAGzC,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E,MAAM,eAAe,GAA6B;IAC9C;QACI,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,sBAAW;QACjB,WAAW,EAAE,6FAA6F;QAC1G,OAAO,EAAE,2BAA2B;QACpC,IAAI,EAAE,gFAAgF,EAAE,iCAAiC;KAC5H;IACD;QACI,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,sBAAW;QACjB,WAAW,EAAE,0EAA0E;QACvF,OAAO,EAAE,4BAA4B;QACrC,IAAI,EAAE,iFAAiF,EAAE,iCAAiC;KAC7H;IACD;QACI,KAAK,EAAE,WAAW;QAClB,IAAI,EAAE,sBAAW;QACjB,WAAW,EACP,oIAAoI;QACxI,OAAO,EAAE,gCAAgC;QACzC,IAAI,EAAE,qFAAqF,EAAE,iCAAiC;KACjI;IACD;QACI,KAAK,EAAE,QAAQ;QACf,IAAI,EAAE,sBAAW;QACjB,WAAW,EACP,uGAAuG;QAC3G,OAAO,EAAE,6BAA6B;QACtC,IAAI,EAAE,kFAAkF,EAAE,iCAAiC;KAC9H;IACD;QACI,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,sBAAW;QACjB,WAA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iC;KAC7H;CACJ,CAAC;AAEF,8EAA8E;AAC9E,eAAe;AACf,8EAA8E;AAE9E,SAAgB,mBAAmB;IAC/B,IAAA,0CAAiB,EAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC;AAC5C,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@documentdb-js/operator-registry",
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "Static operator metadata for DocumentDB-supported operators, stages, accumulators, and BSON constructors",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc -p . && tsc -p tsconfig.scripts.json --noEmit",
|
|
12
|
+
"clean": "rimraf dist tsconfig.tsbuildinfo",
|
|
13
|
+
"test": "jest --config jest.config.js",
|
|
14
|
+
"prettier-fix": "prettier -w \"(scripts|src)/**/*.@(js|ts|jsx|tsx|json|md)\" \"./*.@(js|ts|jsx|tsx|json|md)\"",
|
|
15
|
+
"scrape": "ts-node scripts/scrape-operator-docs.ts && prettier --write resources/scraped/operator-reference.md",
|
|
16
|
+
"generate": "ts-node scripts/generate-from-reference.ts",
|
|
17
|
+
"evaluate": "ts-node scripts/evaluate-overrides.ts"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/microsoft/vscode-documentdb",
|
|
22
|
+
"directory": "packages/documentdb-js-operator-registry"
|
|
23
|
+
},
|
|
24
|
+
"license": "MIT"
|
|
25
|
+
}
|