@mongodb-js/mongodb-constants 0.7.0 → 0.7.2

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.
@@ -6,6 +6,7 @@ export const ADL = mod.ADL;
6
6
  export const ANY_COLLECTION_NAMESPACE = mod.ANY_COLLECTION_NAMESPACE;
7
7
  export const ANY_NAMESPACE = mod.ANY_NAMESPACE;
8
8
  export const ATLAS = mod.ATLAS;
9
+ export const ATLAS_SEARCH_TEMPLATES = mod.ATLAS_SEARCH_TEMPLATES;
9
10
  export const BSON_TYPES = mod.BSON_TYPES;
10
11
  export const BSON_TYPE_ALIASES = mod.BSON_TYPE_ALIASES;
11
12
  export const COLLECTION = mod.COLLECTION;
@@ -0,0 +1,7 @@
1
+ export type SearchTemplate = {
2
+ name: string;
3
+ snippet: string;
4
+ version: string;
5
+ };
6
+ export declare const ATLAS_SEARCH_TEMPLATES: SearchTemplate[];
7
+ //# sourceMappingURL=atlas-search-templates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"atlas-search-templates.d.ts","sourceRoot":"","sources":["../src/atlas-search-templates.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,cAAc,EA+GlD,CAAC"}
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ATLAS_SEARCH_TEMPLATES = void 0;
7
+ const dedent_1 = __importDefault(require("dedent"));
8
+ exports.ATLAS_SEARCH_TEMPLATES = [
9
+ {
10
+ name: 'Dynamic field mappings',
11
+ snippet: (0, dedent_1.default) `{
12
+ "mappings": {
13
+ "dynamic": true
14
+ }
15
+ }`,
16
+ version: '4.4.0',
17
+ },
18
+ {
19
+ name: 'Static field mappings',
20
+ snippet: (0, dedent_1.default) `{
21
+ "mappings": {
22
+ "dynamic": false,
23
+ "fields": {
24
+ \${1:<string field name>}: {
25
+ "type": "string"
26
+ },
27
+ \${2:<number field name>}: {
28
+ "type": "number"
29
+ },
30
+ \${3:<date field name>}: {
31
+ "type": "date"
32
+ },
33
+ \${4:<geo field name>}: {
34
+ "type": "geo"
35
+ },
36
+ }
37
+ }
38
+ }`,
39
+ version: '4.4.0',
40
+ },
41
+ {
42
+ name: 'Text field mappings',
43
+ snippet: (0, dedent_1.default) `{
44
+ "mappings": {
45
+ "dynamic": true,
46
+ "fields": {
47
+ \${1:<string field name>}: [
48
+ {
49
+ // Enables text queries
50
+ "type": "string"
51
+ },
52
+ {
53
+ // Enables autocomplete queries
54
+ "type": "autocomplete"
55
+
56
+ },
57
+ {
58
+ // Enables sorting
59
+ "type": "token"
60
+ }
61
+ ]
62
+ }
63
+ }
64
+ }`,
65
+ version: '4.4.0',
66
+ },
67
+ {
68
+ name: 'Facet field mappings',
69
+ snippet: (0, dedent_1.default) `{
70
+ "mappings": {
71
+ "dynamic": true,
72
+ "fields": {
73
+ \${1:<number field name for faceting>}: [
74
+ {
75
+ "type": "numberFacet"
76
+ },
77
+ {
78
+ "type": "number"
79
+ },
80
+ ],
81
+ \${2:<date field name for faceting>}: [
82
+ {
83
+ "type": "dateFacet"
84
+ }
85
+ {
86
+ "type": "date"
87
+ }
88
+ ],
89
+ \${3:<string field name for faceting>}: [
90
+ {
91
+ "type": "stringFacet"
92
+ },
93
+ {
94
+ "type": "string",
95
+ "analyzer": "lucene.keyword"
96
+ },
97
+ ],
98
+ }
99
+ }
100
+ }`,
101
+ version: '4.4.0',
102
+ },
103
+ {
104
+ name: 'Vector Embedding field mapping',
105
+ snippet: (0, dedent_1.default) `{
106
+ "mappings": {
107
+ "dynamic": true,
108
+ "fields": {
109
+ \${1:<vector embedding field name>}: [
110
+ {
111
+ "type": "vectorEmbedding"
112
+ }
113
+ ]
114
+ }
115
+ }
116
+ }`,
117
+ version: '4.4.0',
118
+ },
119
+ ];
120
+ //# sourceMappingURL=atlas-search-templates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"atlas-search-templates.js","sourceRoot":"","sources":["../src/atlas-search-templates.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAQf,QAAA,sBAAsB,GAAqB;IACtD;QACE,IAAI,EAAE,wBAAwB;QAC9B,OAAO,EAAE,IAAA,gBAAM,EAAA;;;;UAIT;QACN,OAAO,EAAE,OAAO;KACjB;IACD;QACE,IAAI,EAAE,uBAAuB;QAC7B,OAAO,EAAE,IAAA,gBAAM,EAAA;;;;;;;;;;;;;;;;;;UAkBT;QACN,OAAO,EAAE,OAAO;KACjB;IACD;QACE,IAAI,EAAE,qBAAqB;QAC3B,OAAO,EAAE,IAAA,gBAAM,EAAA;;;;;;;;;;;;;;;;;;;;;YAqBP;QACR,OAAO,EAAE,OAAO;KACjB;IACD;QACE,IAAI,EAAE,sBAAsB;QAC5B,OAAO,EAAE,IAAA,gBAAM,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA+BP;QACR,OAAO,EAAE,OAAO;KACjB;IACD;QACE,IAAI,EAAE,gCAAgC;QACtC,OAAO,EAAE,IAAA,gBAAM,EAAA;;;;;;;;;;;UAWT;QACN,OAAO,EAAE,OAAO;KACjB;CACF,CAAC"}
package/dist/filter.d.ts CHANGED
@@ -2073,8 +2073,8 @@ declare const ALL_CONSTANTS: ({
2073
2073
  readonly apiVersions: readonly [];
2074
2074
  readonly namespaces: readonly ["coll"];
2075
2075
  readonly description: "Performs a kNN search on a vector in the specified field or fields. The field that you want to search must be covered by an Atlas Search index of type `vectorEmbedding`.";
2076
- readonly comment: "/**\n * filter: Any MongoDB Query Language (MQL) match expression that compares an indexed field with a boolean, number (not decimals), or string to use as a prefilter. (Optional)\n * index: Name of the Atlas Search index to use. If omitted, defaults to `default`. (Optional)\n * limit: Number (of type `int` only) of documents to return in the results. (Required)\n * numCandidates: Number of nearest neighbors to use during the search. You can specify a number higher than the number of documents to return (`limit`) to increase accuracy. (Required)\n * path: The field to search. (Required)\n * queryVector: Array of numbers of BSON types `int` or `double` that represent the query vector. The array size must match the number of vector `dimensions` specified in the index for the field. (Required)\n */\n";
2077
- readonly snippet: "{\n queryVector: [${1:dimension1}, ${2:dimension2}, ...],\n path: ${3:string},\n numCandidates: ${4:numCandidates},\n limit: ${5:limit},\n index: ${6:string},\n filter: {}\n}";
2076
+ readonly comment: "/**\n * queryVector: Array of numbers of BSON types `int` or `double` that represent the query vector. The array size must match the number of vector dimensions specified in the index for the field. (Required)\n * path: The field to search. (Required)\n * numCandidates: Number of nearest neighbors to use during the search. You can specify a number higher than the number of documents to return (`limit`) to increase accuracy. (Required)\n * index: Name of the Atlas Search index to use. (Required)\n * limit: Number (of type `int` only) of documents to return in the results. (Required)\n * filter: Any MongoDB Query Language (MQL) match expression that compares an indexed field with a boolean, number (not decimals), or string to use as a prefilter. (Optional)\n */\n";
2077
+ readonly snippet: "{\n queryVector: [${1:dimension1}, ${2:dimension2}, ...],\n path: ${3:string},\n numCandidates: ${4:numCandidates},\n index: ${5:string},\n limit: ${6:limit},\n filter: {${7:expression}}\n}";
2078
2078
  } | {
2079
2079
  readonly name: "$set";
2080
2080
  readonly value: "$set";
package/dist/index.d.ts CHANGED
@@ -11,4 +11,5 @@ export * from './stage-operators';
11
11
  export * from './system-variables';
12
12
  export { getFilteredCompletions, wrapField } from './filter';
13
13
  export type { Completion, FilterOptions as CompletionFilterOptions, } from './filter';
14
+ export * from './atlas-search-templates';
14
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,OAAO,CAAC;AACtB,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,MAAM,CAAC;AACrB,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC7D,YAAY,EACV,UAAU,EACV,aAAa,IAAI,uBAAuB,GACzC,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,OAAO,CAAC;AACtB,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,MAAM,CAAC;AACrB,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC7D,YAAY,EACV,UAAU,EACV,aAAa,IAAI,uBAAuB,GACzC,MAAM,UAAU,CAAC;AAClB,cAAc,0BAA0B,CAAC"}
package/dist/index.js CHANGED
@@ -29,4 +29,5 @@ __exportStar(require("./system-variables"), exports);
29
29
  var filter_1 = require("./filter");
30
30
  Object.defineProperty(exports, "getFilteredCompletions", { enumerable: true, get: function () { return filter_1.getFilteredCompletions; } });
31
31
  Object.defineProperty(exports, "wrapField", { enumerable: true, get: function () { return filter_1.wrapField; } });
32
+ __exportStar(require("./atlas-search-templates"), exports);
32
33
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,sDAAoC;AACpC,+CAA6B;AAC7B,yDAAuC;AACvC,wCAAsB;AACtB,yDAAuC;AACvC,gDAA8B;AAC9B,uCAAqB;AACrB,oDAAkC;AAClC,oDAAkC;AAClC,qDAAmC;AACnC,mCAA6D;AAApD,gHAAA,sBAAsB,OAAA;AAAE,mGAAA,SAAS,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,sDAAoC;AACpC,+CAA6B;AAC7B,yDAAuC;AACvC,wCAAsB;AACtB,yDAAuC;AACvC,gDAA8B;AAC9B,uCAAqB;AACrB,oDAAkC;AAClC,oDAAkC;AAClC,qDAAmC;AACnC,mCAA6D;AAApD,gHAAA,sBAAsB,OAAA;AAAE,mGAAA,SAAS,OAAA;AAK1C,2DAAyC"}
@@ -444,8 +444,8 @@ declare const STAGE_OPERATORS: readonly [{
444
444
  readonly apiVersions: readonly [];
445
445
  readonly namespaces: readonly ["coll"];
446
446
  readonly description: "Performs a kNN search on a vector in the specified field or fields. The field that you want to search must be covered by an Atlas Search index of type `vectorEmbedding`.";
447
- readonly comment: "/**\n * filter: Any MongoDB Query Language (MQL) match expression that compares an indexed field with a boolean, number (not decimals), or string to use as a prefilter. (Optional)\n * index: Name of the Atlas Search index to use. If omitted, defaults to `default`. (Optional)\n * limit: Number (of type `int` only) of documents to return in the results. (Required)\n * numCandidates: Number of nearest neighbors to use during the search. You can specify a number higher than the number of documents to return (`limit`) to increase accuracy. (Required)\n * path: The field to search. (Required)\n * queryVector: Array of numbers of BSON types `int` or `double` that represent the query vector. The array size must match the number of vector `dimensions` specified in the index for the field. (Required)\n */\n";
448
- readonly snippet: "{\n queryVector: [${1:dimension1}, ${2:dimension2}, ...],\n path: ${3:string},\n numCandidates: ${4:numCandidates},\n limit: ${5:limit},\n index: ${6:string},\n filter: {}\n}";
447
+ readonly comment: "/**\n * queryVector: Array of numbers of BSON types `int` or `double` that represent the query vector. The array size must match the number of vector dimensions specified in the index for the field. (Required)\n * path: The field to search. (Required)\n * numCandidates: Number of nearest neighbors to use during the search. You can specify a number higher than the number of documents to return (`limit`) to increase accuracy. (Required)\n * index: Name of the Atlas Search index to use. (Required)\n * limit: Number (of type `int` only) of documents to return in the results. (Required)\n * filter: Any MongoDB Query Language (MQL) match expression that compares an indexed field with a boolean, number (not decimals), or string to use as a prefilter. (Optional)\n */\n";
448
+ readonly snippet: "{\n queryVector: [${1:dimension1}, ${2:dimension2}, ...],\n path: ${3:string},\n numCandidates: ${4:numCandidates},\n index: ${5:string},\n limit: ${6:limit},\n filter: {${7:expression}}\n}";
449
449
  }, {
450
450
  readonly name: "$set";
451
451
  readonly value: "$set";
@@ -800,8 +800,8 @@ declare const REQUIRED_AS_FIRST_STAGE: ({
800
800
  readonly apiVersions: readonly [];
801
801
  readonly namespaces: readonly ["coll"];
802
802
  readonly description: "Performs a kNN search on a vector in the specified field or fields. The field that you want to search must be covered by an Atlas Search index of type `vectorEmbedding`.";
803
- readonly comment: "/**\n * filter: Any MongoDB Query Language (MQL) match expression that compares an indexed field with a boolean, number (not decimals), or string to use as a prefilter. (Optional)\n * index: Name of the Atlas Search index to use. If omitted, defaults to `default`. (Optional)\n * limit: Number (of type `int` only) of documents to return in the results. (Required)\n * numCandidates: Number of nearest neighbors to use during the search. You can specify a number higher than the number of documents to return (`limit`) to increase accuracy. (Required)\n * path: The field to search. (Required)\n * queryVector: Array of numbers of BSON types `int` or `double` that represent the query vector. The array size must match the number of vector `dimensions` specified in the index for the field. (Required)\n */\n";
804
- readonly snippet: "{\n queryVector: [${1:dimension1}, ${2:dimension2}, ...],\n path: ${3:string},\n numCandidates: ${4:numCandidates},\n limit: ${5:limit},\n index: ${6:string},\n filter: {}\n}";
803
+ readonly comment: "/**\n * queryVector: Array of numbers of BSON types `int` or `double` that represent the query vector. The array size must match the number of vector dimensions specified in the index for the field. (Required)\n * path: The field to search. (Required)\n * numCandidates: Number of nearest neighbors to use during the search. You can specify a number higher than the number of documents to return (`limit`) to increase accuracy. (Required)\n * index: Name of the Atlas Search index to use. (Required)\n * limit: Number (of type `int` only) of documents to return in the results. (Required)\n * filter: Any MongoDB Query Language (MQL) match expression that compares an indexed field with a boolean, number (not decimals), or string to use as a prefilter. (Optional)\n */\n";
804
+ readonly snippet: "{\n queryVector: [${1:dimension1}, ${2:dimension2}, ...],\n path: ${3:string},\n numCandidates: ${4:numCandidates},\n index: ${5:string},\n limit: ${6:limit},\n filter: {${7:expression}}\n}";
805
805
  } | {
806
806
  readonly name: "$changeStream";
807
807
  readonly value: "$changeStream";
@@ -778,21 +778,21 @@ const STAGE_OPERATORS = [
778
778
  namespaces: [ns_1.COLLECTION],
779
779
  description: 'Performs a kNN search on a vector in the specified field or fields. The field that you want to search must be covered by an Atlas Search index of type `vectorEmbedding`.',
780
780
  comment: `/**
781
- * filter: Any MongoDB Query Language (MQL) match expression that compares an indexed field with a boolean, number (not decimals), or string to use as a prefilter. (Optional)
782
- * index: Name of the Atlas Search index to use. If omitted, defaults to \`default\`. (Optional)
783
- * limit: Number (of type \`int\` only) of documents to return in the results. (Required)
784
- * numCandidates: Number of nearest neighbors to use during the search. You can specify a number higher than the number of documents to return (\`limit\`) to increase accuracy. (Required)
781
+ * queryVector: Array of numbers of BSON types \`int\` or \`double\` that represent the query vector. The array size must match the number of vector dimensions specified in the index for the field. (Required)
785
782
  * path: The field to search. (Required)
786
- * queryVector: Array of numbers of BSON types \`int\` or \`double\` that represent the query vector. The array size must match the number of vector \`dimensions\` specified in the index for the field. (Required)
783
+ * numCandidates: Number of nearest neighbors to use during the search. You can specify a number higher than the number of documents to return (\`limit\`) to increase accuracy. (Required)
784
+ * index: Name of the Atlas Search index to use. (Required)
785
+ * limit: Number (of type \`int\` only) of documents to return in the results. (Required)
786
+ * filter: Any MongoDB Query Language (MQL) match expression that compares an indexed field with a boolean, number (not decimals), or string to use as a prefilter. (Optional)
787
787
  */
788
788
  `,
789
789
  snippet: `{
790
790
  queryVector: [\${1:dimension1}, \${2:dimension2}, ...],
791
791
  path: \${3:string},
792
792
  numCandidates: \${4:numCandidates},
793
- limit: \${5:limit},
794
- index: \${6:string},
795
- filter: {}
793
+ index: \${5:string},
794
+ limit: \${6:limit},
795
+ filter: {\${7:expression}}
796
796
  }`,
797
797
  },
798
798
  {
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "email": "compass@mongodb.com"
14
14
  },
15
15
  "homepage": "https://github.com/mongodb-js/devtools-shared",
16
- "version": "0.7.0",
16
+ "version": "0.7.2",
17
17
  "repository": {
18
18
  "type": "git",
19
19
  "url": "https://github.com/mongodb-js/devtools-shared.git"
@@ -66,7 +66,8 @@
66
66
  "typescript": "^5.0.4"
67
67
  },
68
68
  "dependencies": {
69
+ "dedent": "^1.5.1",
69
70
  "semver": "^7.5.4"
70
71
  },
71
- "gitHead": "ec0dbea4c882e191ebed5bc69298776b5ae9a924"
72
+ "gitHead": "665d291d3d63746a5d9d13f951f6229fe9f308dc"
72
73
  }