@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.
Files changed (79) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +92 -0
  3. package/dist/accumulators.d.ts +2 -0
  4. package/dist/accumulators.d.ts.map +1 -0
  5. package/dist/accumulators.js +177 -0
  6. package/dist/accumulators.js.map +1 -0
  7. package/dist/bsonConstructors.d.ts +2 -0
  8. package/dist/bsonConstructors.d.ts.map +1 -0
  9. package/dist/bsonConstructors.js +81 -0
  10. package/dist/bsonConstructors.js.map +1 -0
  11. package/dist/docLinks.d.ts +13 -0
  12. package/dist/docLinks.d.ts.map +1 -0
  13. package/dist/docLinks.js +76 -0
  14. package/dist/docLinks.js.map +1 -0
  15. package/dist/docLinks.test.d.ts +2 -0
  16. package/dist/docLinks.test.d.ts.map +1 -0
  17. package/dist/docLinks.test.js +67 -0
  18. package/dist/docLinks.test.js.map +1 -0
  19. package/dist/expressionOperators.d.ts +2 -0
  20. package/dist/expressionOperators.d.ts.map +1 -0
  21. package/dist/expressionOperators.js +1094 -0
  22. package/dist/expressionOperators.js.map +1 -0
  23. package/dist/getFilteredCompletions.d.ts +48 -0
  24. package/dist/getFilteredCompletions.d.ts.map +1 -0
  25. package/dist/getFilteredCompletions.js +90 -0
  26. package/dist/getFilteredCompletions.js.map +1 -0
  27. package/dist/getFilteredCompletions.test.d.ts +2 -0
  28. package/dist/getFilteredCompletions.test.d.ts.map +1 -0
  29. package/dist/getFilteredCompletions.test.js +202 -0
  30. package/dist/getFilteredCompletions.test.js.map +1 -0
  31. package/dist/index.d.ts +22 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +97 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/metaTags.d.ts +62 -0
  36. package/dist/metaTags.d.ts.map +1 -0
  37. package/dist/metaTags.js +116 -0
  38. package/dist/metaTags.js.map +1 -0
  39. package/dist/operatorReference.test.d.ts +2 -0
  40. package/dist/operatorReference.test.d.ts.map +1 -0
  41. package/dist/operatorReference.test.js +209 -0
  42. package/dist/operatorReference.test.js.map +1 -0
  43. package/dist/parseOperatorReference.d.ts +54 -0
  44. package/dist/parseOperatorReference.d.ts.map +1 -0
  45. package/dist/parseOperatorReference.js +103 -0
  46. package/dist/parseOperatorReference.js.map +1 -0
  47. package/dist/parseOperatorReference.test.d.ts +2 -0
  48. package/dist/parseOperatorReference.test.d.ts.map +1 -0
  49. package/dist/parseOperatorReference.test.js +151 -0
  50. package/dist/parseOperatorReference.test.js.map +1 -0
  51. package/dist/queryOperators.d.ts +2 -0
  52. package/dist/queryOperators.d.ts.map +1 -0
  53. package/dist/queryOperators.js +398 -0
  54. package/dist/queryOperators.js.map +1 -0
  55. package/dist/stages.d.ts +2 -0
  56. package/dist/stages.d.ts.map +1 -0
  57. package/dist/stages.js +265 -0
  58. package/dist/stages.js.map +1 -0
  59. package/dist/structuralInvariants.test.d.ts +2 -0
  60. package/dist/structuralInvariants.test.d.ts.map +1 -0
  61. package/dist/structuralInvariants.test.js +219 -0
  62. package/dist/structuralInvariants.test.js.map +1 -0
  63. package/dist/systemVariables.d.ts +2 -0
  64. package/dist/systemVariables.d.ts.map +1 -0
  65. package/dist/systemVariables.js +64 -0
  66. package/dist/systemVariables.js.map +1 -0
  67. package/dist/types.d.ts +139 -0
  68. package/dist/types.d.ts.map +1 -0
  69. package/dist/types.js +7 -0
  70. package/dist/types.js.map +1 -0
  71. package/dist/updateOperators.d.ts +2 -0
  72. package/dist/updateOperators.d.ts.map +1 -0
  73. package/dist/updateOperators.js +188 -0
  74. package/dist/updateOperators.js.map +1 -0
  75. package/dist/windowOperators.d.ts +2 -0
  76. package/dist/windowOperators.d.ts.map +1 -0
  77. package/dist/windowOperators.js +219 -0
  78. package/dist/windowOperators.js.map +1 -0
  79. package/package.json +25 -0
package/dist/stages.js ADDED
@@ -0,0 +1,265 @@
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.loadStages = loadStages;
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
+ // Aggregation Pipeline Stages
21
+ // ---------------------------------------------------------------------------
22
+ const aggregationPipelineStages = [
23
+ {
24
+ value: '$addFields',
25
+ meta: metaTags_1.META_STAGE,
26
+ description: 'The $addFields stage in the aggregation pipeline is used to add new fields to documents.',
27
+ snippet: '{ $addFields: { ${1:newField}: ${2:expression} } }',
28
+ link: (0, docLinks_1.getDocLink)('$addFields', metaTags_1.META_STAGE),
29
+ },
30
+ {
31
+ value: '$bucket',
32
+ meta: metaTags_1.META_STAGE,
33
+ description: 'Groups input documents into buckets based on specified boundaries.',
34
+ snippet: '{ $bucket: { groupBy: "${1:\\$field}", boundaries: [${2:values}], default: "${3:Other}" } }',
35
+ link: (0, docLinks_1.getDocLink)('$bucket', metaTags_1.META_STAGE),
36
+ },
37
+ {
38
+ value: '$bucketAuto',
39
+ meta: metaTags_1.META_STAGE,
40
+ description: 'Categorizes documents into a specified number of groups based on a given expression, automatically determining bucket boundaries.',
41
+ snippet: '{ $bucketAuto: { groupBy: "${1:\\$field}", buckets: ${2:number} } }',
42
+ },
43
+ {
44
+ value: '$changeStream',
45
+ meta: metaTags_1.META_STAGE,
46
+ description: 'The $changeStream stage opens a change stream cursor to track data changes in real-time.',
47
+ snippet: '{ $changeStream: {} }',
48
+ link: (0, docLinks_1.getDocLink)('$changeStream', metaTags_1.META_STAGE),
49
+ },
50
+ {
51
+ value: '$collStats',
52
+ meta: metaTags_1.META_STAGE,
53
+ description: 'The $collStats stage in the aggregation pipeline is used to return statistics about a collection.',
54
+ snippet: '{ $collStats: { storageStats: {} } }',
55
+ link: (0, docLinks_1.getDocLink)('$collStats', metaTags_1.META_STAGE),
56
+ },
57
+ {
58
+ value: '$count',
59
+ meta: metaTags_1.META_STAGE,
60
+ description: 'The `$count` operator is used to count the number of documents that match a query filtering criteria.',
61
+ snippet: '{ $count: "${1:countField}" }',
62
+ link: 'https://learn.microsoft.com/en-us/azure/documentdb/operators/accumulators/$count', // inferred from another category
63
+ },
64
+ {
65
+ value: '$densify',
66
+ meta: metaTags_1.META_STAGE,
67
+ description: 'Adds missing data points in a sequence of values within an array or collection.',
68
+ snippet: '{ $densify: { field: "${1:field}", range: { step: ${2:1}, bounds: "full" } } }',
69
+ link: (0, docLinks_1.getDocLink)('$densify', metaTags_1.META_STAGE),
70
+ },
71
+ {
72
+ value: '$documents',
73
+ meta: metaTags_1.META_STAGE,
74
+ description: 'The $documents stage creates a pipeline from a set of provided documents.',
75
+ snippet: '{ $documents: [${1:documents}] }',
76
+ link: (0, docLinks_1.getDocLink)('$documents', metaTags_1.META_STAGE),
77
+ },
78
+ {
79
+ value: '$facet',
80
+ meta: metaTags_1.META_STAGE,
81
+ description: 'The $facet allows for multiple parallel aggregations to be executed within a single pipeline stage.',
82
+ snippet: '{ $facet: { ${1:outputField}: [{ ${2:stage} }] } }',
83
+ link: (0, docLinks_1.getDocLink)('$facet', metaTags_1.META_STAGE),
84
+ },
85
+ {
86
+ value: '$fill',
87
+ meta: metaTags_1.META_STAGE,
88
+ description: 'The $fill stage allows filling missing values in documents based on specified methods and criteria.',
89
+ snippet: '{ $fill: { output: { ${1:field}: { method: "${2:linear}" } } } }',
90
+ link: (0, docLinks_1.getDocLink)('$fill', metaTags_1.META_STAGE),
91
+ },
92
+ {
93
+ value: '$geoNear',
94
+ meta: metaTags_1.META_STAGE,
95
+ description: 'The $geoNear operator finds and sorts documents by their proximity to a geospatial point, returning distance information for each document.',
96
+ snippet: '{ $geoNear: { near: { type: "Point", coordinates: [${1:lng}, ${2:lat}] }, distanceField: "${3:distance}" } }',
97
+ link: (0, docLinks_1.getDocLink)('$geoNear', metaTags_1.META_STAGE),
98
+ },
99
+ {
100
+ value: '$graphLookup',
101
+ meta: metaTags_1.META_STAGE,
102
+ description: 'Performs a recursive search on a collection to return documents connected by a specified field relationship.',
103
+ snippet: '{ $graphLookup: { from: "${1:collection}", startWith: "${2:\\$field}", connectFromField: "${3:field}", connectToField: "${4:field}", as: "${5:result}" } }',
104
+ },
105
+ {
106
+ value: '$group',
107
+ meta: metaTags_1.META_STAGE,
108
+ description: 'The $group stage groups documents by specified identifier expressions and applies accumulator expressions.',
109
+ snippet: '{ $group: { _id: "${1:\\$field}", ${2:accumulator}: { ${3:\\$sum}: 1 } } }',
110
+ link: (0, docLinks_1.getDocLink)('$group', metaTags_1.META_STAGE),
111
+ },
112
+ {
113
+ value: '$indexStats',
114
+ meta: metaTags_1.META_STAGE,
115
+ description: 'The $indexStats stage returns usage statistics for each index in the collection.',
116
+ snippet: '{ $indexStats: {} }',
117
+ link: (0, docLinks_1.getDocLink)('$indexStats', metaTags_1.META_STAGE),
118
+ },
119
+ {
120
+ value: '$limit',
121
+ meta: metaTags_1.META_STAGE,
122
+ description: 'Restricts the number of documents passed to the next stage in the pipeline.',
123
+ snippet: '{ $limit: ${1:number} }',
124
+ },
125
+ {
126
+ value: '$lookup',
127
+ meta: metaTags_1.META_STAGE,
128
+ description: 'The $lookup stage in the Aggregation Framework is used to perform left outer joins with other collections.',
129
+ snippet: '{ $lookup: { from: "${1:collection}", localField: "${2:field}", foreignField: "${3:field}", as: "${4:result}" } }',
130
+ link: (0, docLinks_1.getDocLink)('$lookup', metaTags_1.META_STAGE),
131
+ },
132
+ {
133
+ value: '$match',
134
+ meta: metaTags_1.META_STAGE,
135
+ description: 'The $match stage in the aggregation pipeline is used to filter documents that match a specified condition.',
136
+ snippet: '{ $match: { ${1:query} } }',
137
+ link: (0, docLinks_1.getDocLink)('$match', metaTags_1.META_STAGE),
138
+ },
139
+ {
140
+ value: '$merge',
141
+ meta: metaTags_1.META_STAGE,
142
+ description: 'The $merge stage in an aggregation pipeline writes the results of the aggregation to a specified collection.',
143
+ snippet: '{ $merge: { into: "${1:collection}" } }',
144
+ link: (0, docLinks_1.getDocLink)('$merge', metaTags_1.META_STAGE),
145
+ },
146
+ {
147
+ value: '$out',
148
+ meta: metaTags_1.META_STAGE,
149
+ description: 'The `$out` stage in an aggregation pipeline writes the resulting documents to a specified collection.',
150
+ snippet: '{ $out: "${1:collection}" }',
151
+ link: (0, docLinks_1.getDocLink)('$out', metaTags_1.META_STAGE),
152
+ },
153
+ {
154
+ value: '$project',
155
+ meta: metaTags_1.META_STAGE,
156
+ description: 'Reshapes documents by including, excluding, or computing new fields.',
157
+ snippet: '{ $project: { ${1:field}: 1 } }',
158
+ },
159
+ {
160
+ value: '$redact',
161
+ meta: metaTags_1.META_STAGE,
162
+ description: 'Filters the content of the documents based on access rights.',
163
+ snippet: '{ $redact: { \\$cond: { if: { ${1:expression} }, then: "${2:\\$\\$DESCEND}", else: "${3:\\$\\$PRUNE}" } } }',
164
+ link: (0, docLinks_1.getDocLink)('$redact', metaTags_1.META_STAGE),
165
+ },
166
+ {
167
+ value: '$replaceRoot',
168
+ meta: metaTags_1.META_STAGE,
169
+ description: 'Replaces the input document with a specified embedded document, promoting it to the top level.',
170
+ snippet: '{ $replaceRoot: { newRoot: "${1:\\$field}" } }',
171
+ },
172
+ {
173
+ value: '$replaceWith',
174
+ meta: metaTags_1.META_STAGE,
175
+ description: 'The $replaceWith operator in Azure DocumentDB returns a document after replacing a document with the specified document',
176
+ snippet: '{ $replaceWith: "${1:\\$field}" }',
177
+ link: (0, docLinks_1.getDocLink)('$replaceWith', metaTags_1.META_STAGE),
178
+ },
179
+ {
180
+ value: '$sample',
181
+ meta: metaTags_1.META_STAGE,
182
+ description: 'The $sample operator in Azure DocumentDB returns a randomly selected number of documents',
183
+ snippet: '{ $sample: { size: ${1:number} } }',
184
+ link: (0, docLinks_1.getDocLink)('$sample', metaTags_1.META_STAGE),
185
+ },
186
+ {
187
+ value: '$search',
188
+ meta: metaTags_1.META_STAGE,
189
+ description: 'Performs full-text search on string fields using Atlas Search or compatible search indexes.',
190
+ snippet: '{ $search: { ${1} } }',
191
+ },
192
+ {
193
+ value: '$searchMeta',
194
+ meta: metaTags_1.META_STAGE,
195
+ description: 'Returns metadata about an Atlas Search query without returning the matching documents.',
196
+ snippet: '{ $searchMeta: { ${1} } }',
197
+ },
198
+ {
199
+ value: '$set',
200
+ meta: metaTags_1.META_STAGE,
201
+ description: 'The $set operator in Azure DocumentDB updates or creates a new field with a specified value',
202
+ snippet: '{ $set: { ${1:field}: ${2:expression} } }',
203
+ link: (0, docLinks_1.getDocLink)('$set', metaTags_1.META_STAGE),
204
+ },
205
+ {
206
+ value: '$setWindowFields',
207
+ meta: metaTags_1.META_STAGE,
208
+ description: 'Adds computed fields to documents using window functions over a specified partition and sort order.',
209
+ snippet: '{ $setWindowFields: { partitionBy: "${1:\\$field}", sortBy: { ${2:field}: ${3:1} }, output: { ${4:newField}: { ${5:windowFunc} } } } }',
210
+ },
211
+ {
212
+ value: '$skip',
213
+ meta: metaTags_1.META_STAGE,
214
+ description: 'The $skip stage in the aggregation pipeline is used to skip a specified number of documents from the input and pass the remaining documents to the next stage in the pipeline.',
215
+ snippet: '{ $skip: ${1:number} }',
216
+ link: (0, docLinks_1.getDocLink)('$skip', metaTags_1.META_STAGE),
217
+ },
218
+ {
219
+ value: '$sort',
220
+ meta: metaTags_1.META_STAGE,
221
+ description: 'The $sort stage in the aggregation pipeline is used to order the documents in the pipeline by a specified field or fields.',
222
+ snippet: '{ $sort: { ${1:field}: ${2:1} } }',
223
+ link: (0, docLinks_1.getDocLink)('$sort', metaTags_1.META_STAGE),
224
+ },
225
+ {
226
+ value: '$sortByCount',
227
+ meta: metaTags_1.META_STAGE,
228
+ description: 'The $sortByCount stage in the aggregation pipeline is used to group documents by a specified expression and then sort the count of documents in each group in descending order.',
229
+ snippet: '{ $sortByCount: "${1:\\$field}" }',
230
+ link: (0, docLinks_1.getDocLink)('$sortByCount', metaTags_1.META_STAGE),
231
+ },
232
+ {
233
+ value: '$unionWith',
234
+ meta: metaTags_1.META_STAGE,
235
+ description: 'Combines the results of two collections into a single result set, similar to SQL UNION ALL.',
236
+ snippet: '{ $unionWith: { coll: "${1:collection}", pipeline: [${2}] } }',
237
+ },
238
+ {
239
+ value: '$unset',
240
+ meta: metaTags_1.META_STAGE,
241
+ description: 'The $unset stage in the aggregation pipeline is used to remove specified fields from documents.',
242
+ snippet: '{ $unset: "${1:field}" }',
243
+ link: (0, docLinks_1.getDocLink)('$unset', metaTags_1.META_STAGE),
244
+ },
245
+ {
246
+ value: '$unwind',
247
+ meta: metaTags_1.META_STAGE,
248
+ description: 'The $unwind stage in the aggregation framework is used to deconstruct an array field from the input documents to output a document for each element.',
249
+ snippet: '{ $unwind: "${1:\\$arrayField}" }',
250
+ link: (0, docLinks_1.getDocLink)('$unwind', metaTags_1.META_STAGE),
251
+ },
252
+ {
253
+ value: '$currentOp',
254
+ meta: metaTags_1.META_STAGE,
255
+ description: 'Returns information on active and queued operations for the database instance.',
256
+ snippet: '{ $currentOp: { allUsers: true } }',
257
+ },
258
+ ];
259
+ // ---------------------------------------------------------------------------
260
+ // Registration
261
+ // ---------------------------------------------------------------------------
262
+ function loadStages() {
263
+ (0, getFilteredCompletions_1.registerOperators)([...aggregationPipelineStages]);
264
+ }
265
+ //# sourceMappingURL=stages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stages.js","sourceRoot":"","sources":["../src/stages.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AA6RhG,gCAEC;AA7RD,uCAAuC;AACvC,E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CAAC;KACxC;IACD;QACI,KAAK,EAAE,cAAc;QACrB,IAAI,EAAE,qBAAU;QAChB,WAAW,EACP,iLAAiL;QACrL,OAAO,EAAE,mCAAmC;QAC5C,IAAI,EAAE,IAAA,qBAAU,EAAC,cAAc,EAAE,qBAAU,CAAC;KAC/C;IACD;QACI,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,qBAAU;QAChB,WAAW,EAAE,6FAA6F;QAC1G,OAAO,EAAE,+DAA+D;KAC3E;IACD;QACI,KAAK,EAAE,QAAQ;QACf,IAAI,EAAE,qBAAU;QAChB,WAAW,EAAE,iGAAiG;QAC9G,OAAO,EAAE,0BAA0B;QACnC,IAAI,EAAE,IAAA,qBAAU,EAAC,QAAQ,EAAE,qBAAU,CAAC;KACzC;IACD;QACI,KAAK,EAAE,SAAS;QAChB,IAAI,EAAE,qBAAU;QAChB,WAAW,EACP,sJAAsJ;QAC1J,OAAO,EAAE,mCAAmC;QAC5C,IAAI,EAAE,IAAA,qBAAU,EAAC,SAAS,EAAE,qBAAU,CAAC;KAC1C;IACD;QACI,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,qBAAU;QAChB,WAAW,EAAE,gFAAgF;QAC7F,OAAO,EAAE,oCAAoC;KAChD;CACJ,CAAC;AAEF,8EAA8E;AAC9E,eAAe;AACf,8EAA8E;AAE9E,SAAgB,UAAU;IACtB,IAAA,0CAAiB,EAAC,CAAC,GAAG,yBAAyB,CAAC,CAAC,CAAC;AACtD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=structuralInvariants.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structuralInvariants.test.d.ts","sourceRoot":"","sources":["../src/structuralInvariants.test.ts"],"names":[],"mappings":""}
@@ -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
+ /**
8
+ * Structural invariant tests for all operator entries.
9
+ *
10
+ * Validates that every entry in getAllCompletions() has the correct shape,
11
+ * consistent meta tags, and reasonable values.
12
+ */
13
+ const index_1 = require("./index");
14
+ const allOperators = (0, index_1.getAllCompletions)();
15
+ describe('structural invariants', () => {
16
+ test('total operator count is in the expected range', () => {
17
+ // 308 total (298 from dump + 10 BSON constructors)
18
+ expect(allOperators.length).toBeGreaterThanOrEqual(290);
19
+ expect(allOperators.length).toBeLessThanOrEqual(320);
20
+ });
21
+ test('every entry has required fields', () => {
22
+ const invalid = [];
23
+ for (const op of allOperators) {
24
+ if (!op.value) {
25
+ invalid.push('entry missing value');
26
+ }
27
+ if (!op.meta) {
28
+ invalid.push(`${op.value} missing meta`);
29
+ }
30
+ if (!op.description) {
31
+ invalid.push(`${op.value} missing description`);
32
+ }
33
+ }
34
+ expect(invalid).toEqual([]);
35
+ });
36
+ test('operator values start with $ or $$ (except BSON constructors)', () => {
37
+ const invalid = [];
38
+ for (const op of allOperators) {
39
+ if (op.meta === 'bson') {
40
+ // BSON constructors: ObjectId, ISODate, etc. — no $ prefix
41
+ expect(op.value).toMatch(/^[A-Z]/);
42
+ }
43
+ else if (op.meta === 'variable') {
44
+ // System variables start with $$
45
+ if (!op.value.startsWith('$$')) {
46
+ invalid.push(`${op.value} (variable) should start with $$`);
47
+ }
48
+ }
49
+ else {
50
+ // All other operators start with $
51
+ if (!op.value.startsWith('$')) {
52
+ invalid.push(`${op.value} (${op.meta}) should start with $`);
53
+ }
54
+ }
55
+ }
56
+ expect(invalid).toEqual([]);
57
+ });
58
+ test('every entry has a valid meta tag', () => {
59
+ const validMetas = new Set(index_1.ALL_META_TAGS);
60
+ const invalid = [];
61
+ for (const op of allOperators) {
62
+ if (!validMetas.has(op.meta)) {
63
+ invalid.push(`${op.value} has unknown meta: ${op.meta}`);
64
+ }
65
+ }
66
+ expect(invalid).toEqual([]);
67
+ });
68
+ test('descriptions are non-empty strings', () => {
69
+ const empty = [];
70
+ for (const op of allOperators) {
71
+ if (typeof op.description !== 'string' || op.description.trim().length === 0) {
72
+ empty.push(`${op.value} (${op.meta}) has empty description`);
73
+ }
74
+ }
75
+ expect(empty).toEqual([]);
76
+ });
77
+ test('snippets are strings when present', () => {
78
+ const invalid = [];
79
+ for (const op of allOperators) {
80
+ if (op.snippet !== undefined && typeof op.snippet !== 'string') {
81
+ invalid.push(`${op.value} (${op.meta}) has non-string snippet`);
82
+ }
83
+ }
84
+ expect(invalid).toEqual([]);
85
+ });
86
+ test('links are valid URLs when present', () => {
87
+ const invalid = [];
88
+ for (const op of allOperators) {
89
+ if (op.link !== undefined) {
90
+ if (typeof op.link !== 'string' || !op.link.startsWith('https://')) {
91
+ invalid.push(`${op.value} (${op.meta}) has invalid link: ${op.link}`);
92
+ }
93
+ }
94
+ }
95
+ expect(invalid).toEqual([]);
96
+ });
97
+ test('applicableBsonTypes is a string array when present', () => {
98
+ const invalid = [];
99
+ for (const op of allOperators) {
100
+ if (op.applicableBsonTypes !== undefined) {
101
+ if (!Array.isArray(op.applicableBsonTypes)) {
102
+ invalid.push(`${op.value} (${op.meta}) applicableBsonTypes is not an array`);
103
+ }
104
+ else {
105
+ for (const t of op.applicableBsonTypes) {
106
+ if (typeof t !== 'string' || t.trim().length === 0) {
107
+ invalid.push(`${op.value} (${op.meta}) has empty BSON type`);
108
+ }
109
+ }
110
+ }
111
+ }
112
+ }
113
+ expect(invalid).toEqual([]);
114
+ });
115
+ test('no duplicate (value, meta) pairs', () => {
116
+ const seen = new Set();
117
+ const duplicates = [];
118
+ for (const op of allOperators) {
119
+ const key = `${op.value}|${op.meta}`;
120
+ if (seen.has(key)) {
121
+ duplicates.push(key);
122
+ }
123
+ seen.add(key);
124
+ }
125
+ expect(duplicates).toEqual([]);
126
+ });
127
+ test('BSON constructors have expected entries', () => {
128
+ const bsonOps = allOperators.filter((op) => op.meta === 'bson');
129
+ const bsonValues = bsonOps.map((op) => op.value).sort();
130
+ expect(bsonValues).toEqual(expect.arrayContaining([
131
+ 'BinData',
132
+ 'ISODate',
133
+ 'MaxKey',
134
+ 'MinKey',
135
+ 'NumberDecimal',
136
+ 'NumberInt',
137
+ 'NumberLong',
138
+ 'ObjectId',
139
+ 'Timestamp',
140
+ 'UUID',
141
+ ]));
142
+ });
143
+ test('system variables have expected entries', () => {
144
+ const varOps = allOperators.filter((op) => op.meta === 'variable');
145
+ const varValues = varOps.map((op) => op.value).sort();
146
+ expect(varValues).toEqual(expect.arrayContaining(['$$CURRENT', '$$DESCEND', '$$KEEP', '$$NOW', '$$PRUNE', '$$REMOVE', '$$ROOT']));
147
+ });
148
+ test('key operators are present', () => {
149
+ const values = new Set(allOperators.map((op) => op.value));
150
+ // Query operators
151
+ expect(values.has('$eq')).toBe(true);
152
+ expect(values.has('$gt')).toBe(true);
153
+ expect(values.has('$and')).toBe(true);
154
+ expect(values.has('$regex')).toBe(true);
155
+ expect(values.has('$exists')).toBe(true);
156
+ // Stages
157
+ expect(values.has('$match')).toBe(true);
158
+ expect(values.has('$group')).toBe(true);
159
+ expect(values.has('$lookup')).toBe(true);
160
+ expect(values.has('$project')).toBe(true);
161
+ expect(values.has('$sort')).toBe(true);
162
+ // Update operators
163
+ expect(values.has('$set')).toBe(true);
164
+ expect(values.has('$unset')).toBe(true);
165
+ expect(values.has('$inc')).toBe(true);
166
+ // Accumulators
167
+ expect(values.has('$sum')).toBe(true);
168
+ expect(values.has('$avg')).toBe(true);
169
+ // Expressions
170
+ expect(values.has('$add')).toBe(true);
171
+ expect(values.has('$concat')).toBe(true);
172
+ expect(values.has('$cond')).toBe(true);
173
+ });
174
+ test('excluded operators are NOT present with unsupported meta tags', () => {
175
+ // These should not be present (deprecated or not supported)
176
+ const opsByValueMeta = new Map();
177
+ for (const op of allOperators) {
178
+ opsByValueMeta.set(`${op.value}|${op.meta}`, op);
179
+ }
180
+ // $where is deprecated and should not be present as evaluation query
181
+ expect(opsByValueMeta.has('$where|query:evaluation')).toBe(false);
182
+ });
183
+ });
184
+ describe('meta tag coverage', () => {
185
+ test('every meta tag in ALL_META_TAGS has at least one operator (except parent-only and runtime tags)', () => {
186
+ const metasWithOps = new Set(allOperators.map((op) => op.meta));
187
+ // Parent-only tags: operators use subcategories (query:comparison, update:field),
188
+ // not the bare 'query' or 'update' tags. 'field:identifier' is runtime-injected.
189
+ const parentOnlyTags = new Set(['query', 'update', 'field:identifier']);
190
+ const missing = [];
191
+ for (const tag of index_1.ALL_META_TAGS) {
192
+ if (parentOnlyTags.has(tag)) {
193
+ continue;
194
+ }
195
+ if (!metasWithOps.has(tag)) {
196
+ missing.push(tag);
197
+ }
198
+ }
199
+ expect(missing).toEqual([]);
200
+ });
201
+ test('top-level meta categories have expected operator counts', () => {
202
+ const countByPrefix = {};
203
+ for (const op of allOperators) {
204
+ const prefix = op.meta.includes(':') ? op.meta.split(':')[0] : op.meta;
205
+ countByPrefix[prefix] = (countByPrefix[prefix] || 0) + 1;
206
+ }
207
+ expect(countByPrefix['query']).toBe(43);
208
+ expect(countByPrefix['update']).toBe(22);
209
+ expect(countByPrefix['stage']).toBe(35);
210
+ expect(countByPrefix['accumulator']).toBe(21);
211
+ expect(countByPrefix['window']).toBe(27);
212
+ expect(countByPrefix['bson']).toBe(10);
213
+ expect(countByPrefix['variable']).toBe(7);
214
+ // Expression operators: ~143-144
215
+ expect(countByPrefix['expr']).toBeGreaterThanOrEqual(140);
216
+ expect(countByPrefix['expr']).toBeLessThanOrEqual(150);
217
+ });
218
+ });
219
+ //# sourceMappingURL=structuralInvariants.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structuralInvariants.test.js","sourceRoot":"","sources":["../src/structuralInvariants.test.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAEhG;;;;;GAKG;AAEH,mCAA+E;AAE/E,MAAM,YAAY,GAAG,IAAA,yBAAiB,GAAE,CAAC;AAEzC,QAAQ,CAAC,uBAAuB,EAA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,IAAI,CAAC,EAAE,CAAC,CAAC;QACzC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACxC,MAAM,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC9C,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACzC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACvC,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC1C,iCAAiC;QACjC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC;QAC1D,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function loadSystemVariables(): void;
2
+ //# sourceMappingURL=systemVariables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"systemVariables.d.ts","sourceRoot":"","sources":["../src/systemVariables.ts"],"names":[],"mappings":"AAuEA,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C"}
@@ -0,0 +1,64 @@
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.loadSystemVariables = loadSystemVariables;
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 getFilteredCompletions_1 = require("./getFilteredCompletions");
17
+ const metaTags_1 = require("./metaTags");
18
+ // ---------------------------------------------------------------------------
19
+ // Variables in Aggregation Expressions
20
+ // ---------------------------------------------------------------------------
21
+ const systemVariables = [
22
+ {
23
+ value: '$$NOW',
24
+ meta: metaTags_1.META_VARIABLE,
25
+ description: 'Returns the current datetime as a Date object. Constant throughout a single aggregation pipeline.',
26
+ },
27
+ {
28
+ value: '$$ROOT',
29
+ meta: metaTags_1.META_VARIABLE,
30
+ description: 'References the root document — the top-level document currently being processed in the pipeline stage.',
31
+ },
32
+ {
33
+ value: '$$REMOVE',
34
+ meta: metaTags_1.META_VARIABLE,
35
+ description: 'Removes a field from the output document. Used with $project or $addFields to conditionally exclude fields.',
36
+ },
37
+ {
38
+ value: '$$CURRENT',
39
+ meta: metaTags_1.META_VARIABLE,
40
+ description: 'References the current document in the pipeline stage. Equivalent to $$ROOT at the start of the pipeline.',
41
+ },
42
+ {
43
+ value: '$$DESCEND',
44
+ meta: metaTags_1.META_VARIABLE,
45
+ description: 'Used with $redact. Returns the document fields at the current level and continues descending into subdocuments.',
46
+ },
47
+ {
48
+ value: '$$PRUNE',
49
+ meta: metaTags_1.META_VARIABLE,
50
+ description: 'Used with $redact. Excludes all fields at the current document level and stops descending into subdocuments.',
51
+ },
52
+ {
53
+ value: '$$KEEP',
54
+ meta: metaTags_1.META_VARIABLE,
55
+ description: 'Used with $redact. Keeps all fields at the current document level without further descending into subdocuments.',
56
+ },
57
+ ];
58
+ // ---------------------------------------------------------------------------
59
+ // Registration
60
+ // ---------------------------------------------------------------------------
61
+ function loadSystemVariables() {
62
+ (0, getFilteredCompletions_1.registerOperators)([...systemVariables]);
63
+ }
64
+ //# sourceMappingURL=systemVariables.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"systemVariables.js","sourceRoot":"","sources":["../src/systemVariables.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAoEhG,kDAEC;AApED,uCAAuC;AACvC,EAAE;AACF,uEAAuE;AACvE,wDAAwD;AACxD,0DAA0D;AAC1D,yDAAyD;AACzD,EAAE;AACF,uFAAuF;AAEvF,qEAA6D;AAC7D,yCAA2C;AAG3C,8EAA8E;AAC9E,uCAAuC;AACvC,8EAA8E;AAE9E,MAAM,eAAe,GAA6B;IAC9C;QACI,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,wBAAa;QACnB,WAAW,EACP,mGAAmG;KAC1G;IACD;QACI,KAAK,EAAE,QAAQ;QACf,IAAI,EAAE,wBAAa;QACnB,WAAW,EACP,wGAAwG;KAC/G;IACD;QACI,KAAK,EAAE,UAAU;QACjB,IAAI,EAAE,wBAAa;QACnB,WAAW,EACP,6GAA6G;KACpH;IACD;QACI,KAAK,EAAE,WAAW;QAClB,IAAI,EAAE,wBAAa;QACnB,WAAW,EACP,2GAA2G;KAClH;IACD;QACI,KAAK,EAAE,WAAW;QAClB,IAAI,EAAE,wBAAa;QACnB,WAAW,EACP,iHAAiH;KACxH;IACD;QACI,KAAK,EAAE,SAAS;QAChB,IAAI,EAAE,wBAAa;QACnB,WAAW,EACP,8GAA8G;KACrH;IACD;QACI,KAAK,EAAE,QAAQ;QACf,IAAI,EAAE,wBAAa;QACnB,WAAW,EACP,iHAAiH;KACxH;CACJ,CAAC;AAEF,8EAA8E;AAC9E,eAAe;AACf,8EAA8E;AAE9E,SAAgB,mBAAmB;IAC/B,IAAA,0CAAiB,EAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC;AAC5C,CAAC"}