@atscript/mongo 0.0.24 → 0.0.26
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/dist/index.cjs +15 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +15 -4
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -879,21 +879,32 @@ else flatUnion.item(existing);
|
|
|
879
879
|
this._finalizeIndexesForCollection();
|
|
880
880
|
}
|
|
881
881
|
}
|
|
882
|
-
|
|
882
|
+
getSearchIndexes() {
|
|
883
883
|
if (!this._searchIndexesMap) {
|
|
884
884
|
this._searchIndexesMap = new Map();
|
|
885
885
|
let deafultIndex;
|
|
886
886
|
for (const index of this.indexes.values()) switch (index.type) {
|
|
887
|
-
case "text":
|
|
888
|
-
|
|
887
|
+
case "text":
|
|
888
|
+
if (!deafultIndex) deafultIndex = index;
|
|
889
|
+
break;
|
|
890
|
+
case "dynamic_text":
|
|
891
|
+
deafultIndex = index;
|
|
892
|
+
break;
|
|
889
893
|
case "search_text":
|
|
890
894
|
if (!deafultIndex || deafultIndex?.type === "text") deafultIndex = index;
|
|
891
895
|
this._searchIndexesMap.set(index.name, index);
|
|
896
|
+
break;
|
|
897
|
+
case "vector":
|
|
898
|
+
this._searchIndexesMap.set(index.name, index);
|
|
899
|
+
break;
|
|
892
900
|
default:
|
|
893
901
|
}
|
|
894
902
|
if (deafultIndex && !this._searchIndexesMap.has(DEFAULT_INDEX_NAME)) this._searchIndexesMap.set(DEFAULT_INDEX_NAME, deafultIndex);
|
|
895
903
|
}
|
|
896
|
-
return this._searchIndexesMap
|
|
904
|
+
return this._searchIndexesMap;
|
|
905
|
+
}
|
|
906
|
+
getSearchIndex(name = DEFAULT_INDEX_NAME) {
|
|
907
|
+
return this.getSearchIndexes().get(name);
|
|
897
908
|
}
|
|
898
909
|
get flatMap() {
|
|
899
910
|
this._flatten();
|
package/dist/index.d.ts
CHANGED
|
@@ -90,6 +90,7 @@ declare class AsCollection<T extends TAtscriptAnnotatedTypeConstructor> {
|
|
|
90
90
|
protected _prepareIndexesForField(fieldName: string, metadata: TMetadataMap<AtscriptMetadata>): void;
|
|
91
91
|
protected _flatten(): void;
|
|
92
92
|
protected _searchIndexesMap?: Map<string, TIndex>;
|
|
93
|
+
getSearchIndexes(): Map<string, TIndex>;
|
|
93
94
|
getSearchIndex(name?: string): TIndex | undefined;
|
|
94
95
|
get flatMap(): Map<string, TAtscriptAnnotatedType>;
|
|
95
96
|
syncIndexes(): Promise<void>;
|
package/dist/index.mjs
CHANGED
|
@@ -855,21 +855,32 @@ else flatUnion.item(existing);
|
|
|
855
855
|
this._finalizeIndexesForCollection();
|
|
856
856
|
}
|
|
857
857
|
}
|
|
858
|
-
|
|
858
|
+
getSearchIndexes() {
|
|
859
859
|
if (!this._searchIndexesMap) {
|
|
860
860
|
this._searchIndexesMap = new Map();
|
|
861
861
|
let deafultIndex;
|
|
862
862
|
for (const index of this.indexes.values()) switch (index.type) {
|
|
863
|
-
case "text":
|
|
864
|
-
|
|
863
|
+
case "text":
|
|
864
|
+
if (!deafultIndex) deafultIndex = index;
|
|
865
|
+
break;
|
|
866
|
+
case "dynamic_text":
|
|
867
|
+
deafultIndex = index;
|
|
868
|
+
break;
|
|
865
869
|
case "search_text":
|
|
866
870
|
if (!deafultIndex || deafultIndex?.type === "text") deafultIndex = index;
|
|
867
871
|
this._searchIndexesMap.set(index.name, index);
|
|
872
|
+
break;
|
|
873
|
+
case "vector":
|
|
874
|
+
this._searchIndexesMap.set(index.name, index);
|
|
875
|
+
break;
|
|
868
876
|
default:
|
|
869
877
|
}
|
|
870
878
|
if (deafultIndex && !this._searchIndexesMap.has(DEFAULT_INDEX_NAME)) this._searchIndexesMap.set(DEFAULT_INDEX_NAME, deafultIndex);
|
|
871
879
|
}
|
|
872
|
-
return this._searchIndexesMap
|
|
880
|
+
return this._searchIndexesMap;
|
|
881
|
+
}
|
|
882
|
+
getSearchIndex(name = DEFAULT_INDEX_NAME) {
|
|
883
|
+
return this.getSearchIndexes().get(name);
|
|
873
884
|
}
|
|
874
885
|
get flatMap() {
|
|
875
886
|
this._flatten();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atscript/mongo",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"description": "Mongodb plugin for atscript.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.mjs",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"license": "ISC",
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"mongodb": "^6.17.0",
|
|
37
|
-
"@atscript/core": "^0.0.
|
|
38
|
-
"@atscript/typescript": "^0.0.
|
|
37
|
+
"@atscript/core": "^0.0.26",
|
|
38
|
+
"@atscript/typescript": "^0.0.26"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"vitest": "3.2.4"
|