@webiny/api-opensearch 0.0.0-unstable.0d717d18dd
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 +21 -0
- package/README.md +11 -0
- package/client.d.ts +8 -0
- package/client.js +37 -0
- package/client.js.map +1 -0
- package/cursors.d.ts +10 -0
- package/cursors.js +25 -0
- package/cursors.js.map +1 -0
- package/db/entity.d.ts +7 -0
- package/db/entity.js +18 -0
- package/db/entity.js.map +1 -0
- package/db/index.d.ts +3 -0
- package/db/index.js +3 -0
- package/db/table.d.ts +7 -0
- package/db/table.js +13 -0
- package/db/table.js.map +1 -0
- package/db/types.d.ts +6 -0
- package/db/types.js +0 -0
- package/exports/api/opensearch.d.ts +9 -0
- package/exports/api/opensearch.js +9 -0
- package/features/OpenSearchClient/abstraction.d.ts +9 -0
- package/features/OpenSearchClient/abstraction.js +5 -0
- package/features/OpenSearchClient/abstraction.js.map +1 -0
- package/features/OpenSearchClient/feature.d.ts +5 -0
- package/features/OpenSearchClient/feature.js +13 -0
- package/features/OpenSearchClient/feature.js.map +1 -0
- package/features/OpenSearchClientFactory/OpenSearchClientFactory.d.ts +9 -0
- package/features/OpenSearchClientFactory/OpenSearchClientFactory.js +15 -0
- package/features/OpenSearchClientFactory/OpenSearchClientFactory.js.map +1 -0
- package/features/OpenSearchClientFactory/abstraction.d.ts +10 -0
- package/features/OpenSearchClientFactory/abstraction.js +5 -0
- package/features/OpenSearchClientFactory/abstraction.js.map +1 -0
- package/features/OpenSearchClientFactory/feature.d.ts +4 -0
- package/features/OpenSearchClientFactory/feature.js +11 -0
- package/features/OpenSearchClientFactory/feature.js.map +1 -0
- package/features/OpenSearchField/OpenSearchField.d.ts +18 -0
- package/features/OpenSearchField/OpenSearchField.js +49 -0
- package/features/OpenSearchField/OpenSearchField.js.map +1 -0
- package/features/OpenSearchField/OpenSearchFieldFactory.d.ts +9 -0
- package/features/OpenSearchField/OpenSearchFieldFactory.js +14 -0
- package/features/OpenSearchField/OpenSearchFieldFactory.js.map +1 -0
- package/features/OpenSearchField/abstractions/OpenSearchField.d.ts +35 -0
- package/features/OpenSearchField/abstractions/OpenSearchField.js +6 -0
- package/features/OpenSearchField/abstractions/OpenSearchField.js.map +1 -0
- package/features/OpenSearchField/abstractions/OpenSearchFieldFactory.d.ts +8 -0
- package/features/OpenSearchField/abstractions/OpenSearchFieldFactory.js +5 -0
- package/features/OpenSearchField/abstractions/OpenSearchFieldFactory.js.map +1 -0
- package/features/OpenSearchField/feature.d.ts +4 -0
- package/features/OpenSearchField/feature.js +11 -0
- package/features/OpenSearchField/feature.js.map +1 -0
- package/features/OpenSearchIndex/OpenSearchIndexRegistry.d.ts +12 -0
- package/features/OpenSearchIndex/OpenSearchIndexRegistry.js +30 -0
- package/features/OpenSearchIndex/OpenSearchIndexRegistry.js.map +1 -0
- package/features/OpenSearchIndex/abstractions/OpenSearchIndex.d.ts +9 -0
- package/features/OpenSearchIndex/abstractions/OpenSearchIndex.js +5 -0
- package/features/OpenSearchIndex/abstractions/OpenSearchIndex.js.map +1 -0
- package/features/OpenSearchIndex/abstractions/OpenSearchIndexRegistry.d.ts +9 -0
- package/features/OpenSearchIndex/abstractions/OpenSearchIndexRegistry.js +5 -0
- package/features/OpenSearchIndex/abstractions/OpenSearchIndexRegistry.js.map +1 -0
- package/features/OpenSearchIndex/feature.d.ts +4 -0
- package/features/OpenSearchIndex/feature.js +11 -0
- package/features/OpenSearchIndex/feature.js.map +1 -0
- package/features/OpenSearchQueryBuilderOperator/OpenSearchQueryBuilderOperatorRegistry.d.ts +12 -0
- package/features/OpenSearchQueryBuilderOperator/OpenSearchQueryBuilderOperatorRegistry.js +28 -0
- package/features/OpenSearchQueryBuilderOperator/OpenSearchQueryBuilderOperatorRegistry.js.map +1 -0
- package/features/OpenSearchQueryBuilderOperator/abstractions/OpenSearchQueryBuilderOperator.d.ts +11 -0
- package/features/OpenSearchQueryBuilderOperator/abstractions/OpenSearchQueryBuilderOperator.js +5 -0
- package/features/OpenSearchQueryBuilderOperator/abstractions/OpenSearchQueryBuilderOperator.js.map +1 -0
- package/features/OpenSearchQueryBuilderOperator/abstractions/OpenSearchQueryBuilderOperatorRegistry.d.ts +10 -0
- package/features/OpenSearchQueryBuilderOperator/abstractions/OpenSearchQueryBuilderOperatorRegistry.js +5 -0
- package/features/OpenSearchQueryBuilderOperator/abstractions/OpenSearchQueryBuilderOperatorRegistry.js.map +1 -0
- package/features/OpenSearchQueryBuilderOperator/feature.d.ts +4 -0
- package/features/OpenSearchQueryBuilderOperator/feature.js +41 -0
- package/features/OpenSearchQueryBuilderOperator/feature.js.map +1 -0
- package/features/OpenSearchQueryBuilderOperator/operators/AndIn.d.ts +9 -0
- package/features/OpenSearchQueryBuilderOperator/operators/AndIn.js +28 -0
- package/features/OpenSearchQueryBuilderOperator/operators/AndIn.js.map +1 -0
- package/features/OpenSearchQueryBuilderOperator/operators/Between.d.ts +9 -0
- package/features/OpenSearchQueryBuilderOperator/operators/Between.js +27 -0
- package/features/OpenSearchQueryBuilderOperator/operators/Between.js.map +1 -0
- package/features/OpenSearchQueryBuilderOperator/operators/Contains.d.ts +9 -0
- package/features/OpenSearchQueryBuilderOperator/operators/Contains.js +27 -0
- package/features/OpenSearchQueryBuilderOperator/operators/Contains.js.map +1 -0
- package/features/OpenSearchQueryBuilderOperator/operators/Equal.d.ts +9 -0
- package/features/OpenSearchQueryBuilderOperator/operators/Equal.js +34 -0
- package/features/OpenSearchQueryBuilderOperator/operators/Equal.js.map +1 -0
- package/features/OpenSearchQueryBuilderOperator/operators/GreaterThan.d.ts +9 -0
- package/features/OpenSearchQueryBuilderOperator/operators/GreaterThan.js +23 -0
- package/features/OpenSearchQueryBuilderOperator/operators/GreaterThan.js.map +1 -0
- package/features/OpenSearchQueryBuilderOperator/operators/GreaterThanOrEqual.d.ts +9 -0
- package/features/OpenSearchQueryBuilderOperator/operators/GreaterThanOrEqual.js +23 -0
- package/features/OpenSearchQueryBuilderOperator/operators/GreaterThanOrEqual.js.map +1 -0
- package/features/OpenSearchQueryBuilderOperator/operators/In.d.ts +9 -0
- package/features/OpenSearchQueryBuilderOperator/operators/In.js +24 -0
- package/features/OpenSearchQueryBuilderOperator/operators/In.js.map +1 -0
- package/features/OpenSearchQueryBuilderOperator/operators/LesserThan.d.ts +9 -0
- package/features/OpenSearchQueryBuilderOperator/operators/LesserThan.js +23 -0
- package/features/OpenSearchQueryBuilderOperator/operators/LesserThan.js.map +1 -0
- package/features/OpenSearchQueryBuilderOperator/operators/LesserThanOrEqual.d.ts +9 -0
- package/features/OpenSearchQueryBuilderOperator/operators/LesserThanOrEqual.js +23 -0
- package/features/OpenSearchQueryBuilderOperator/operators/LesserThanOrEqual.js.map +1 -0
- package/features/OpenSearchQueryBuilderOperator/operators/Not.d.ts +9 -0
- package/features/OpenSearchQueryBuilderOperator/operators/Not.js +38 -0
- package/features/OpenSearchQueryBuilderOperator/operators/Not.js.map +1 -0
- package/features/OpenSearchQueryBuilderOperator/operators/NotBetween.d.ts +9 -0
- package/features/OpenSearchQueryBuilderOperator/operators/NotBetween.js +27 -0
- package/features/OpenSearchQueryBuilderOperator/operators/NotBetween.js.map +1 -0
- package/features/OpenSearchQueryBuilderOperator/operators/NotContains.d.ts +9 -0
- package/features/OpenSearchQueryBuilderOperator/operators/NotContains.js +27 -0
- package/features/OpenSearchQueryBuilderOperator/operators/NotContains.js.map +1 -0
- package/features/OpenSearchQueryBuilderOperator/operators/NotIn.d.ts +9 -0
- package/features/OpenSearchQueryBuilderOperator/operators/NotIn.js +24 -0
- package/features/OpenSearchQueryBuilderOperator/operators/NotIn.js.map +1 -0
- package/features/OpenSearchQueryBuilderOperator/operators/NotStartsWith.d.ts +9 -0
- package/features/OpenSearchQueryBuilderOperator/operators/NotStartsWith.js +22 -0
- package/features/OpenSearchQueryBuilderOperator/operators/NotStartsWith.js.map +1 -0
- package/features/OpenSearchQueryBuilderOperator/operators/StartsWith.d.ts +9 -0
- package/features/OpenSearchQueryBuilderOperator/operators/StartsWith.js +22 -0
- package/features/OpenSearchQueryBuilderOperator/operators/StartsWith.js.map +1 -0
- package/index.d.ts +14 -0
- package/index.js +14 -0
- package/indexConfiguration/base.d.ts +6 -0
- package/indexConfiguration/base.js +34 -0
- package/indexConfiguration/base.js.map +1 -0
- package/indexConfiguration/common.d.ts +9 -0
- package/indexConfiguration/common.js +42 -0
- package/indexConfiguration/common.js.map +1 -0
- package/indexConfiguration/index.d.ts +2 -0
- package/indexConfiguration/index.js +2 -0
- package/indexPrefix.d.ts +1 -0
- package/indexPrefix.js +4 -0
- package/indexPrefix.js.map +1 -0
- package/indices.d.ts +2 -0
- package/indices.js +1 -0
- package/limit.d.ts +1 -0
- package/limit.js +10 -0
- package/limit.js.map +1 -0
- package/normalize.d.ts +6 -0
- package/normalize.js +55 -0
- package/normalize.js.map +1 -0
- package/operations/OpenSearchCatHealth.d.ts +7 -0
- package/operations/OpenSearchCatHealth.js +30 -0
- package/operations/OpenSearchCatHealth.js.map +1 -0
- package/operations/OpenSearchCatNodes.d.ts +7 -0
- package/operations/OpenSearchCatNodes.js +28 -0
- package/operations/OpenSearchCatNodes.js.map +1 -0
- package/operations/index.d.ts +3 -0
- package/operations/index.js +3 -0
- package/operations/stripConnectionFromException.d.ts +1 -0
- package/operations/stripConnectionFromException.js +14 -0
- package/operations/stripConnectionFromException.js.map +1 -0
- package/operations/types.d.ts +12 -0
- package/operations/types.js +9 -0
- package/operations/types.js.map +1 -0
- package/package.json +42 -0
- package/registerOpenSearchCore.d.ts +3 -0
- package/registerOpenSearchCore.js +20 -0
- package/registerOpenSearchCore.js.map +1 -0
- package/sharedIndex.d.ts +1 -0
- package/sharedIndex.js +4 -0
- package/sharedIndex.js.map +1 -0
- package/sort.d.ts +13 -0
- package/sort.js +36 -0
- package/sort.js.map +1 -0
- package/testing/createBlankQuery.d.ts +2 -0
- package/testing/createBlankQuery.js +9 -0
- package/testing/createBlankQuery.js.map +1 -0
- package/testing/createTestOpenSearchClient.d.ts +11 -0
- package/testing/createTestOpenSearchClient.js +162 -0
- package/testing/createTestOpenSearchClient.js.map +1 -0
- package/testing/index.d.ts +4 -0
- package/testing/index.js +4 -0
- package/testing/registerOpenSearchCoreForTests.d.ts +1 -0
- package/testing/registerOpenSearchCoreForTests.js +9 -0
- package/testing/registerOpenSearchCoreForTests.js.map +1 -0
- package/testing/setupTestIndexManager.d.ts +13 -0
- package/testing/setupTestIndexManager.js +26 -0
- package/testing/setupTestIndexManager.js.map +1 -0
- package/types.d.ts +60 -0
- package/types.js +8 -0
- package/types.js.map +1 -0
- package/utils/createIndex.d.ts +19 -0
- package/utils/createIndex.js +60 -0
- package/utils/createIndex.js.map +1 -0
- package/utils/index.d.ts +2 -0
- package/utils/index.js +2 -0
- package/utils/waitUntilHealthy/UnhealthyClusterError.d.ts +4 -0
- package/utils/waitUntilHealthy/UnhealthyClusterError.js +12 -0
- package/utils/waitUntilHealthy/UnhealthyClusterError.js.map +1 -0
- package/utils/waitUntilHealthy/WaitUntilHealthy.d.ts +72 -0
- package/utils/waitUntilHealthy/WaitUntilHealthy.js +131 -0
- package/utils/waitUntilHealthy/WaitUntilHealthy.js.map +1 -0
- package/utils/waitUntilHealthy/WaitingHealthyClusterAbortedError.d.ts +4 -0
- package/utils/waitUntilHealthy/WaitingHealthyClusterAbortedError.js +12 -0
- package/utils/waitUntilHealthy/WaitingHealthyClusterAbortedError.js.map +1 -0
- package/utils/waitUntilHealthy/index.d.ts +4 -0
- package/utils/waitUntilHealthy/index.js +4 -0
- package/utils/waitUntilHealthy/reason/ClusterHealthReason.d.ts +15 -0
- package/utils/waitUntilHealthy/reason/ClusterHealthReason.js +12 -0
- package/utils/waitUntilHealthy/reason/ClusterHealthReason.js.map +1 -0
- package/utils/waitUntilHealthy/reason/IReason.d.ts +4 -0
- package/utils/waitUntilHealthy/reason/IReason.js +0 -0
- package/utils/waitUntilHealthy/reason/MemoryReason.d.ts +14 -0
- package/utils/waitUntilHealthy/reason/MemoryReason.js +12 -0
- package/utils/waitUntilHealthy/reason/MemoryReason.js.map +1 -0
- package/utils/waitUntilHealthy/reason/ProcessorReason.d.ts +14 -0
- package/utils/waitUntilHealthy/reason/ProcessorReason.js +12 -0
- package/utils/waitUntilHealthy/reason/ProcessorReason.js.map +1 -0
- package/utils/waitUntilHealthy/reason/index.d.ts +3 -0
- package/utils/waitUntilHealthy/reason/index.js +3 -0
- package/where.d.ts +17 -0
- package/where.js +49 -0
- package/where.js.map +1 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperator } from "../abstractions/OpenSearchQueryBuilderOperator.js";
|
|
2
|
+
class LesserThanImpl {
|
|
3
|
+
getOperator() {
|
|
4
|
+
return "lt";
|
|
5
|
+
}
|
|
6
|
+
apply(query, params) {
|
|
7
|
+
const { value, basePath } = params;
|
|
8
|
+
query.filter.push({
|
|
9
|
+
range: {
|
|
10
|
+
[basePath]: {
|
|
11
|
+
lt: value
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const LesserThan = OpenSearchQueryBuilderOperator.createImplementation({
|
|
18
|
+
implementation: LesserThanImpl,
|
|
19
|
+
dependencies: []
|
|
20
|
+
});
|
|
21
|
+
export { LesserThan };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=LesserThan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/OpenSearchQueryBuilderOperator/operators/LesserThan.js","sources":["../../../../src/features/OpenSearchQueryBuilderOperator/operators/LesserThan.ts"],"sourcesContent":["import { OpenSearchQueryBuilderOperator } from \"../abstractions/OpenSearchQueryBuilderOperator.js\";\n\nclass LesserThanImpl implements OpenSearchQueryBuilderOperator.Interface {\n public getOperator(): string {\n return \"lt\";\n }\n\n public apply(\n query: OpenSearchQueryBuilderOperator.Query,\n params: OpenSearchQueryBuilderOperator.Params\n ): void {\n const { value, basePath } = params;\n query.filter.push({\n range: {\n [basePath]: {\n lt: value\n }\n }\n });\n }\n}\n\nexport const LesserThan = OpenSearchQueryBuilderOperator.createImplementation({\n implementation: LesserThanImpl,\n dependencies: []\n});\n"],"names":["LesserThanImpl","query","params","value","basePath","LesserThan","OpenSearchQueryBuilderOperator"],"mappings":";AAEA,MAAMA;IACK,cAAsB;QACzB,OAAO;IACX;IAEO,MACHC,KAA2C,EAC3CC,MAA6C,EACzC;QACJ,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGF;QAC5BD,MAAM,MAAM,CAAC,IAAI,CAAC;YACd,OAAO;gBACH,CAACG,SAAS,EAAE;oBACR,IAAID;gBACR;YACJ;QACJ;IACJ;AACJ;AAEO,MAAME,aAAaC,+BAA+B,oBAAoB,CAAC;IAC1E,gBAAgBN;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperator } from "../abstractions/OpenSearchQueryBuilderOperator.js";
|
|
2
|
+
declare class LesserThanOrEqualImpl implements OpenSearchQueryBuilderOperator.Interface {
|
|
3
|
+
getOperator(): string;
|
|
4
|
+
apply(query: OpenSearchQueryBuilderOperator.Query, params: OpenSearchQueryBuilderOperator.Params): void;
|
|
5
|
+
}
|
|
6
|
+
export declare const LesserThanOrEqual: typeof LesserThanOrEqualImpl & {
|
|
7
|
+
__abstraction: import("@webiny/di").Abstraction<import("../abstractions/OpenSearchQueryBuilderOperator.js").IOpenSearchQueryBuilderOperator>;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperator } from "../abstractions/OpenSearchQueryBuilderOperator.js";
|
|
2
|
+
class LesserThanOrEqualImpl {
|
|
3
|
+
getOperator() {
|
|
4
|
+
return "lte";
|
|
5
|
+
}
|
|
6
|
+
apply(query, params) {
|
|
7
|
+
const { value, basePath } = params;
|
|
8
|
+
query.filter.push({
|
|
9
|
+
range: {
|
|
10
|
+
[basePath]: {
|
|
11
|
+
lte: value
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const LesserThanOrEqual = OpenSearchQueryBuilderOperator.createImplementation({
|
|
18
|
+
implementation: LesserThanOrEqualImpl,
|
|
19
|
+
dependencies: []
|
|
20
|
+
});
|
|
21
|
+
export { LesserThanOrEqual };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=LesserThanOrEqual.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/OpenSearchQueryBuilderOperator/operators/LesserThanOrEqual.js","sources":["../../../../src/features/OpenSearchQueryBuilderOperator/operators/LesserThanOrEqual.ts"],"sourcesContent":["import { OpenSearchQueryBuilderOperator } from \"../abstractions/OpenSearchQueryBuilderOperator.js\";\n\nclass LesserThanOrEqualImpl implements OpenSearchQueryBuilderOperator.Interface {\n public getOperator(): string {\n return \"lte\";\n }\n\n public apply(\n query: OpenSearchQueryBuilderOperator.Query,\n params: OpenSearchQueryBuilderOperator.Params\n ): void {\n const { value, basePath } = params;\n query.filter.push({\n range: {\n [basePath]: {\n lte: value\n }\n }\n });\n }\n}\n\nexport const LesserThanOrEqual = OpenSearchQueryBuilderOperator.createImplementation({\n implementation: LesserThanOrEqualImpl,\n dependencies: []\n});\n"],"names":["LesserThanOrEqualImpl","query","params","value","basePath","LesserThanOrEqual","OpenSearchQueryBuilderOperator"],"mappings":";AAEA,MAAMA;IACK,cAAsB;QACzB,OAAO;IACX;IAEO,MACHC,KAA2C,EAC3CC,MAA6C,EACzC;QACJ,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGF;QAC5BD,MAAM,MAAM,CAAC,IAAI,CAAC;YACd,OAAO;gBACH,CAACG,SAAS,EAAE;oBACR,KAAKD;gBACT;YACJ;QACJ;IACJ;AACJ;AAEO,MAAME,oBAAoBC,+BAA+B,oBAAoB,CAAC;IACjF,gBAAgBN;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperator } from "../abstractions/OpenSearchQueryBuilderOperator.js";
|
|
2
|
+
declare class NotImpl implements OpenSearchQueryBuilderOperator.Interface {
|
|
3
|
+
getOperator(): string;
|
|
4
|
+
apply(query: OpenSearchQueryBuilderOperator.Query, params: OpenSearchQueryBuilderOperator.Params): void;
|
|
5
|
+
}
|
|
6
|
+
export declare const Not: typeof NotImpl & {
|
|
7
|
+
__abstraction: import("@webiny/di").Abstraction<import("../abstractions/OpenSearchQueryBuilderOperator.js").IOpenSearchQueryBuilderOperator>;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperator } from "../abstractions/OpenSearchQueryBuilderOperator.js";
|
|
2
|
+
class NotImpl {
|
|
3
|
+
getOperator() {
|
|
4
|
+
return "not";
|
|
5
|
+
}
|
|
6
|
+
apply(query, params) {
|
|
7
|
+
const { value, path, basePath } = params;
|
|
8
|
+
if (null == value) return void query.filter.push({
|
|
9
|
+
exists: {
|
|
10
|
+
field: path
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
const typeOf = typeof value;
|
|
14
|
+
if ("boolean" === typeOf) return void query.filter.push({
|
|
15
|
+
bool: {
|
|
16
|
+
must_not: {
|
|
17
|
+
term: {
|
|
18
|
+
[path]: value
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const useBasePath = "string" !== typeOf;
|
|
24
|
+
const valuePath = useBasePath ? basePath : path;
|
|
25
|
+
query.must_not.push({
|
|
26
|
+
term: {
|
|
27
|
+
[valuePath]: value
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const Not = OpenSearchQueryBuilderOperator.createImplementation({
|
|
33
|
+
implementation: NotImpl,
|
|
34
|
+
dependencies: []
|
|
35
|
+
});
|
|
36
|
+
export { Not };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=Not.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/OpenSearchQueryBuilderOperator/operators/Not.js","sources":["../../../../src/features/OpenSearchQueryBuilderOperator/operators/Not.ts"],"sourcesContent":["import { OpenSearchQueryBuilderOperator } from \"../abstractions/OpenSearchQueryBuilderOperator.js\";\n\nclass NotImpl implements OpenSearchQueryBuilderOperator.Interface {\n public getOperator(): string {\n return \"not\";\n }\n\n public apply(\n query: OpenSearchQueryBuilderOperator.Query,\n params: OpenSearchQueryBuilderOperator.Params\n ): void {\n const { value, path, basePath } = params;\n\n if (value === null || value === undefined) {\n query.filter.push({\n exists: {\n field: path\n }\n });\n return;\n }\n\n const typeOf = typeof value;\n\n if (typeOf === \"boolean\") {\n query.filter.push({\n bool: {\n must_not: {\n term: {\n [path]: value\n }\n }\n }\n });\n return;\n }\n\n const useBasePath = typeOf !== \"string\";\n const valuePath = useBasePath ? basePath : path;\n query.must_not.push({\n term: {\n [valuePath]: value\n }\n });\n }\n}\n\nexport const Not = OpenSearchQueryBuilderOperator.createImplementation({\n implementation: NotImpl,\n dependencies: []\n});\n"],"names":["NotImpl","query","params","value","path","basePath","typeOf","useBasePath","valuePath","Not","OpenSearchQueryBuilderOperator"],"mappings":";AAEA,MAAMA;IACK,cAAsB;QACzB,OAAO;IACX;IAEO,MACHC,KAA2C,EAC3CC,MAA6C,EACzC;QACJ,MAAM,EAAEC,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAE,GAAGH;QAElC,IAAIC,QAAAA,OAAuC,YACvCF,MAAM,MAAM,CAAC,IAAI,CAAC;YACd,QAAQ;gBACJ,OAAOG;YACX;QACJ;QAIJ,MAAME,SAAS,OAAOH;QAEtB,IAAIG,AAAW,cAAXA,QAAsB,YACtBL,MAAM,MAAM,CAAC,IAAI,CAAC;YACd,MAAM;gBACF,UAAU;oBACN,MAAM;wBACF,CAACG,KAAK,EAAED;oBACZ;gBACJ;YACJ;QACJ;QAIJ,MAAMI,cAAcD,AAAW,aAAXA;QACpB,MAAME,YAAYD,cAAcF,WAAWD;QAC3CH,MAAM,QAAQ,CAAC,IAAI,CAAC;YAChB,MAAM;gBACF,CAACO,UAAU,EAAEL;YACjB;QACJ;IACJ;AACJ;AAEO,MAAMM,MAAMC,+BAA+B,oBAAoB,CAAC;IACnE,gBAAgBV;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperator } from "../abstractions/OpenSearchQueryBuilderOperator.js";
|
|
2
|
+
declare class NotBetweenImpl implements OpenSearchQueryBuilderOperator.Interface {
|
|
3
|
+
getOperator(): string;
|
|
4
|
+
apply(query: OpenSearchQueryBuilderOperator.Query, params: OpenSearchQueryBuilderOperator.Params): void;
|
|
5
|
+
}
|
|
6
|
+
export declare const NotBetween: typeof NotBetweenImpl & {
|
|
7
|
+
__abstraction: import("@webiny/di").Abstraction<import("../abstractions/OpenSearchQueryBuilderOperator.js").IOpenSearchQueryBuilderOperator>;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperator } from "../abstractions/OpenSearchQueryBuilderOperator.js";
|
|
2
|
+
class NotBetweenImpl {
|
|
3
|
+
getOperator() {
|
|
4
|
+
return "not_between";
|
|
5
|
+
}
|
|
6
|
+
apply(query, params) {
|
|
7
|
+
const { value, basePath, name } = params;
|
|
8
|
+
if (false === Array.isArray(value)) throw new Error(`You cannot filter field path "${name}" with "not_between" query and not send an array of values.`);
|
|
9
|
+
if (2 !== value.length) throw new Error(`You must pass 2 values in the array for field path "${name}" filtering.`);
|
|
10
|
+
const [gte, lte] = value;
|
|
11
|
+
query.must_not.push({
|
|
12
|
+
range: {
|
|
13
|
+
[basePath]: {
|
|
14
|
+
lte,
|
|
15
|
+
gte
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const NotBetween = OpenSearchQueryBuilderOperator.createImplementation({
|
|
22
|
+
implementation: NotBetweenImpl,
|
|
23
|
+
dependencies: []
|
|
24
|
+
});
|
|
25
|
+
export { NotBetween };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=NotBetween.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/OpenSearchQueryBuilderOperator/operators/NotBetween.js","sources":["../../../../src/features/OpenSearchQueryBuilderOperator/operators/NotBetween.ts"],"sourcesContent":["import { OpenSearchQueryBuilderOperator } from \"../abstractions/OpenSearchQueryBuilderOperator.js\";\n\nclass NotBetweenImpl implements OpenSearchQueryBuilderOperator.Interface {\n public getOperator(): string {\n return \"not_between\";\n }\n\n public apply(\n query: OpenSearchQueryBuilderOperator.Query,\n params: OpenSearchQueryBuilderOperator.Params\n ): void {\n const { value, basePath, name } = params;\n if (Array.isArray(value) === false) {\n throw new Error(\n `You cannot filter field path \"${name}\" with \"not_between\" query and not send an array of values.`\n );\n } else if (value.length !== 2) {\n throw new Error(\n `You must pass 2 values in the array for field path \"${name}\" filtering.`\n );\n }\n const [gte, lte] = value;\n query.must_not.push({\n range: {\n [basePath]: {\n lte,\n gte\n }\n }\n });\n }\n}\n\nexport const NotBetween = OpenSearchQueryBuilderOperator.createImplementation({\n implementation: NotBetweenImpl,\n dependencies: []\n});\n"],"names":["NotBetweenImpl","query","params","value","basePath","name","Array","Error","gte","lte","NotBetween","OpenSearchQueryBuilderOperator"],"mappings":";AAEA,MAAMA;IACK,cAAsB;QACzB,OAAO;IACX;IAEO,MACHC,KAA2C,EAC3CC,MAA6C,EACzC;QACJ,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,IAAI,EAAE,GAAGH;QAClC,IAAII,AAAyB,UAAzBA,MAAM,OAAO,CAACH,QACd,MAAM,IAAII,MACN,CAAC,8BAA8B,EAAEF,KAAK,2DAA2D,CAAC;QAEnG,IAAIF,AAAiB,MAAjBA,MAAM,MAAM,EACnB,MAAM,IAAII,MACN,CAAC,oDAAoD,EAAEF,KAAK,YAAY,CAAC;QAGjF,MAAM,CAACG,KAAKC,IAAI,GAAGN;QACnBF,MAAM,QAAQ,CAAC,IAAI,CAAC;YAChB,OAAO;gBACH,CAACG,SAAS,EAAE;oBACRK;oBACAD;gBACJ;YACJ;QACJ;IACJ;AACJ;AAEO,MAAME,aAAaC,+BAA+B,oBAAoB,CAAC;IAC1E,gBAAgBX;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperator } from "../abstractions/OpenSearchQueryBuilderOperator.js";
|
|
2
|
+
declare class NotContainsImpl implements OpenSearchQueryBuilderOperator.Interface {
|
|
3
|
+
getOperator(): string;
|
|
4
|
+
apply(query: OpenSearchQueryBuilderOperator.Query, params: OpenSearchQueryBuilderOperator.Params): void;
|
|
5
|
+
}
|
|
6
|
+
export declare const NotContains: typeof NotContainsImpl & {
|
|
7
|
+
__abstraction: import("@webiny/di").Abstraction<import("../abstractions/OpenSearchQueryBuilderOperator.js").IOpenSearchQueryBuilderOperator>;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { normalizeValueWithAsterisk } from "../../../normalize.js";
|
|
2
|
+
import { OpenSearchQueryBuilderOperator } from "../abstractions/OpenSearchQueryBuilderOperator.js";
|
|
3
|
+
class NotContainsImpl {
|
|
4
|
+
getOperator() {
|
|
5
|
+
return "not_contains";
|
|
6
|
+
}
|
|
7
|
+
apply(query, params) {
|
|
8
|
+
const { value, basePath } = params;
|
|
9
|
+
query.must_not.push({
|
|
10
|
+
query_string: {
|
|
11
|
+
allow_leading_wildcard: true,
|
|
12
|
+
fields: [
|
|
13
|
+
basePath
|
|
14
|
+
],
|
|
15
|
+
query: normalizeValueWithAsterisk(value),
|
|
16
|
+
default_operator: "and"
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const NotContains = OpenSearchQueryBuilderOperator.createImplementation({
|
|
22
|
+
implementation: NotContainsImpl,
|
|
23
|
+
dependencies: []
|
|
24
|
+
});
|
|
25
|
+
export { NotContains };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=NotContains.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/OpenSearchQueryBuilderOperator/operators/NotContains.js","sources":["../../../../src/features/OpenSearchQueryBuilderOperator/operators/NotContains.ts"],"sourcesContent":["import { normalizeValueWithAsterisk } from \"~/normalize.js\";\nimport { OpenSearchQueryBuilderOperator } from \"../abstractions/OpenSearchQueryBuilderOperator.js\";\n\nclass NotContainsImpl implements OpenSearchQueryBuilderOperator.Interface {\n public getOperator(): string {\n return \"not_contains\";\n }\n\n public apply(\n query: OpenSearchQueryBuilderOperator.Query,\n params: OpenSearchQueryBuilderOperator.Params\n ): void {\n const { value, basePath } = params;\n query.must_not.push({\n query_string: {\n allow_leading_wildcard: true,\n fields: [basePath],\n query: normalizeValueWithAsterisk(value),\n default_operator: \"and\"\n }\n });\n }\n}\n\nexport const NotContains = OpenSearchQueryBuilderOperator.createImplementation({\n implementation: NotContainsImpl,\n dependencies: []\n});\n"],"names":["NotContainsImpl","query","params","value","basePath","normalizeValueWithAsterisk","NotContains","OpenSearchQueryBuilderOperator"],"mappings":";;AAGA,MAAMA;IACK,cAAsB;QACzB,OAAO;IACX;IAEO,MACHC,KAA2C,EAC3CC,MAA6C,EACzC;QACJ,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGF;QAC5BD,MAAM,QAAQ,CAAC,IAAI,CAAC;YAChB,cAAc;gBACV,wBAAwB;gBACxB,QAAQ;oBAACG;iBAAS;gBAClB,OAAOC,2BAA2BF;gBAClC,kBAAkB;YACtB;QACJ;IACJ;AACJ;AAEO,MAAMG,cAAcC,+BAA+B,oBAAoB,CAAC;IAC3E,gBAAgBP;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperator } from "../abstractions/OpenSearchQueryBuilderOperator.js";
|
|
2
|
+
declare class NotInImpl implements OpenSearchQueryBuilderOperator.Interface {
|
|
3
|
+
getOperator(): string;
|
|
4
|
+
apply(query: OpenSearchQueryBuilderOperator.Query, params: OpenSearchQueryBuilderOperator.Params): void;
|
|
5
|
+
}
|
|
6
|
+
export declare const NotIn: typeof NotInImpl & {
|
|
7
|
+
__abstraction: import("@webiny/di").Abstraction<import("../abstractions/OpenSearchQueryBuilderOperator.js").IOpenSearchQueryBuilderOperator>;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperator } from "../abstractions/OpenSearchQueryBuilderOperator.js";
|
|
2
|
+
class NotInImpl {
|
|
3
|
+
getOperator() {
|
|
4
|
+
return "not_in";
|
|
5
|
+
}
|
|
6
|
+
apply(query, params) {
|
|
7
|
+
const { value: values, path, basePath, name } = params;
|
|
8
|
+
const isArray = Array.isArray(values);
|
|
9
|
+
if (false === isArray || 0 === values.length) throw new Error(`You cannot filter field "${name}" with "not_in" operator and not send an array of values.`);
|
|
10
|
+
const useBasePath = values.some((value)=>"string" != typeof value);
|
|
11
|
+
query.must_not.push({
|
|
12
|
+
terms: {
|
|
13
|
+
[useBasePath ? basePath : path]: values
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const NotIn = OpenSearchQueryBuilderOperator.createImplementation({
|
|
19
|
+
implementation: NotInImpl,
|
|
20
|
+
dependencies: []
|
|
21
|
+
});
|
|
22
|
+
export { NotIn };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=NotIn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/OpenSearchQueryBuilderOperator/operators/NotIn.js","sources":["../../../../src/features/OpenSearchQueryBuilderOperator/operators/NotIn.ts"],"sourcesContent":["import { OpenSearchQueryBuilderOperator } from \"../abstractions/OpenSearchQueryBuilderOperator.js\";\n\nclass NotInImpl implements OpenSearchQueryBuilderOperator.Interface {\n public getOperator(): string {\n return \"not_in\";\n }\n\n public apply(\n query: OpenSearchQueryBuilderOperator.Query,\n params: OpenSearchQueryBuilderOperator.Params\n ): void {\n const { value: values, path, basePath, name } = params;\n const isArray = Array.isArray(values);\n if (isArray === false || values.length === 0) {\n throw new Error(\n `You cannot filter field \"${name}\" with \"not_in\" operator and not send an array of values.`\n );\n }\n\n const useBasePath = values.some(\n (value: string | number | boolean | null | undefined) => typeof value !== \"string\"\n );\n\n query.must_not.push({\n terms: {\n [useBasePath ? basePath : path]: values\n }\n });\n }\n}\n\nexport const NotIn = OpenSearchQueryBuilderOperator.createImplementation({\n implementation: NotInImpl,\n dependencies: []\n});\n"],"names":["NotInImpl","query","params","values","path","basePath","name","isArray","Array","Error","useBasePath","value","NotIn","OpenSearchQueryBuilderOperator"],"mappings":";AAEA,MAAMA;IACK,cAAsB;QACzB,OAAO;IACX;IAEO,MACHC,KAA2C,EAC3CC,MAA6C,EACzC;QACJ,MAAM,EAAE,OAAOC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,IAAI,EAAE,GAAGJ;QAChD,MAAMK,UAAUC,MAAM,OAAO,CAACL;QAC9B,IAAII,AAAY,UAAZA,WAAqBJ,AAAkB,MAAlBA,OAAO,MAAM,EAClC,MAAM,IAAIM,MACN,CAAC,yBAAyB,EAAEH,KAAK,yDAAyD,CAAC;QAInG,MAAMI,cAAcP,OAAO,IAAI,CAC3B,CAACQ,QAAwD,AAAiB,YAAjB,OAAOA;QAGpEV,MAAM,QAAQ,CAAC,IAAI,CAAC;YAChB,OAAO;gBACH,CAACS,cAAcL,WAAWD,KAAK,EAAED;YACrC;QACJ;IACJ;AACJ;AAEO,MAAMS,QAAQC,+BAA+B,oBAAoB,CAAC;IACrE,gBAAgBb;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperator } from "../abstractions/OpenSearchQueryBuilderOperator.js";
|
|
2
|
+
declare class NotStartsWithImpl implements OpenSearchQueryBuilderOperator.Interface {
|
|
3
|
+
getOperator(): string;
|
|
4
|
+
apply(query: OpenSearchQueryBuilderOperator.Query, params: OpenSearchQueryBuilderOperator.Params): void;
|
|
5
|
+
}
|
|
6
|
+
export declare const NotStartsWith: typeof NotStartsWithImpl & {
|
|
7
|
+
__abstraction: import("@webiny/di").Abstraction<import("../abstractions/OpenSearchQueryBuilderOperator.js").IOpenSearchQueryBuilderOperator>;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperator } from "../abstractions/OpenSearchQueryBuilderOperator.js";
|
|
2
|
+
class NotStartsWithImpl {
|
|
3
|
+
getOperator() {
|
|
4
|
+
return "not_startsWith";
|
|
5
|
+
}
|
|
6
|
+
apply(query, params) {
|
|
7
|
+
const { value, basePath } = params;
|
|
8
|
+
if ("" === value || null == value) return;
|
|
9
|
+
query.must_not.push({
|
|
10
|
+
match_phrase_prefix: {
|
|
11
|
+
[basePath]: value
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const NotStartsWith = OpenSearchQueryBuilderOperator.createImplementation({
|
|
17
|
+
implementation: NotStartsWithImpl,
|
|
18
|
+
dependencies: []
|
|
19
|
+
});
|
|
20
|
+
export { NotStartsWith };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=NotStartsWith.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/OpenSearchQueryBuilderOperator/operators/NotStartsWith.js","sources":["../../../../src/features/OpenSearchQueryBuilderOperator/operators/NotStartsWith.ts"],"sourcesContent":["import { OpenSearchQueryBuilderOperator } from \"../abstractions/OpenSearchQueryBuilderOperator.js\";\n\nclass NotStartsWithImpl implements OpenSearchQueryBuilderOperator.Interface {\n public getOperator(): string {\n return \"not_startsWith\";\n }\n\n public apply(\n query: OpenSearchQueryBuilderOperator.Query,\n params: OpenSearchQueryBuilderOperator.Params\n ): void {\n const { value, basePath } = params;\n if (value === \"\" || value === null || value === undefined) {\n return;\n }\n query.must_not.push({\n match_phrase_prefix: {\n [basePath]: value\n }\n });\n }\n}\n\nexport const NotStartsWith = OpenSearchQueryBuilderOperator.createImplementation({\n implementation: NotStartsWithImpl,\n dependencies: []\n});\n"],"names":["NotStartsWithImpl","query","params","value","basePath","NotStartsWith","OpenSearchQueryBuilderOperator"],"mappings":";AAEA,MAAMA;IACK,cAAsB;QACzB,OAAO;IACX;IAEO,MACHC,KAA2C,EAC3CC,MAA6C,EACzC;QACJ,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGF;QAC5B,IAAIC,AAAU,OAAVA,SAAkCA,QAAlBA,OAChB;QAEJF,MAAM,QAAQ,CAAC,IAAI,CAAC;YAChB,qBAAqB;gBACjB,CAACG,SAAS,EAAED;YAChB;QACJ;IACJ;AACJ;AAEO,MAAME,gBAAgBC,+BAA+B,oBAAoB,CAAC;IAC7E,gBAAgBN;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperator } from "../abstractions/OpenSearchQueryBuilderOperator.js";
|
|
2
|
+
declare class StartsWithImpl implements OpenSearchQueryBuilderOperator.Interface {
|
|
3
|
+
getOperator(): string;
|
|
4
|
+
apply(query: OpenSearchQueryBuilderOperator.Query, params: OpenSearchQueryBuilderOperator.Params): void;
|
|
5
|
+
}
|
|
6
|
+
export declare const StartsWith: typeof StartsWithImpl & {
|
|
7
|
+
__abstraction: import("@webiny/di").Abstraction<import("../abstractions/OpenSearchQueryBuilderOperator.js").IOpenSearchQueryBuilderOperator>;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperator } from "../abstractions/OpenSearchQueryBuilderOperator.js";
|
|
2
|
+
class StartsWithImpl {
|
|
3
|
+
getOperator() {
|
|
4
|
+
return "startsWith";
|
|
5
|
+
}
|
|
6
|
+
apply(query, params) {
|
|
7
|
+
const { value, basePath } = params;
|
|
8
|
+
if ("" === value || null == value) return;
|
|
9
|
+
query.filter.push({
|
|
10
|
+
match_phrase_prefix: {
|
|
11
|
+
[basePath]: value
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const StartsWith = OpenSearchQueryBuilderOperator.createImplementation({
|
|
17
|
+
implementation: StartsWithImpl,
|
|
18
|
+
dependencies: []
|
|
19
|
+
});
|
|
20
|
+
export { StartsWith };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=StartsWith.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/OpenSearchQueryBuilderOperator/operators/StartsWith.js","sources":["../../../../src/features/OpenSearchQueryBuilderOperator/operators/StartsWith.ts"],"sourcesContent":["import { OpenSearchQueryBuilderOperator } from \"../abstractions/OpenSearchQueryBuilderOperator.js\";\n\nclass StartsWithImpl implements OpenSearchQueryBuilderOperator.Interface {\n public getOperator(): string {\n return \"startsWith\";\n }\n\n public apply(\n query: OpenSearchQueryBuilderOperator.Query,\n params: OpenSearchQueryBuilderOperator.Params\n ): void {\n const { value, basePath } = params;\n if (value === \"\" || value === null || value === undefined) {\n return;\n }\n query.filter.push({\n match_phrase_prefix: {\n [basePath]: value\n }\n });\n }\n}\n\nexport const StartsWith = OpenSearchQueryBuilderOperator.createImplementation({\n implementation: StartsWithImpl,\n dependencies: []\n});\n"],"names":["StartsWithImpl","query","params","value","basePath","StartsWith","OpenSearchQueryBuilderOperator"],"mappings":";AAEA,MAAMA;IACK,cAAsB;QACzB,OAAO;IACX;IAEO,MACHC,KAA2C,EAC3CC,MAA6C,EACzC;QACJ,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGF;QAC5B,IAAIC,AAAU,OAAVA,SAAkCA,QAAlBA,OAChB;QAEJF,MAAM,MAAM,CAAC,IAAI,CAAC;YACd,qBAAqB;gBACjB,CAACG,SAAS,EAAED;YAChB;QACJ;IACJ;AACJ;AAEO,MAAME,aAAaC,+BAA+B,oBAAoB,CAAC;IAC1E,gBAAgBN;IAChB,cAAc,EAAE;AACpB"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { registerOpenSearchCore } from "./registerOpenSearchCore.js";
|
|
2
|
+
export { getCommonMappings, getBaseConfiguration } from "./indexConfiguration/index.js";
|
|
3
|
+
export * from "./sort.js";
|
|
4
|
+
export * from "./where.js";
|
|
5
|
+
export * from "./limit.js";
|
|
6
|
+
export * from "./normalize.js";
|
|
7
|
+
export * from "./cursors.js";
|
|
8
|
+
export { createOpenSearchClient, type Client, type ClientOptions, type OpenSearchClientOptions } from "./client.js";
|
|
9
|
+
export * from "./utils/index.js";
|
|
10
|
+
export * from "./operations/index.js";
|
|
11
|
+
export * from "./sharedIndex.js";
|
|
12
|
+
export * from "./indexPrefix.js";
|
|
13
|
+
export * from "./db/index.js";
|
|
14
|
+
export * from "./types.js";
|
package/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from "./sort.js";
|
|
2
|
+
export * from "./where.js";
|
|
3
|
+
export * from "./limit.js";
|
|
4
|
+
export * from "./normalize.js";
|
|
5
|
+
export * from "./cursors.js";
|
|
6
|
+
export * from "./utils/index.js";
|
|
7
|
+
export * from "./operations/index.js";
|
|
8
|
+
export * from "./sharedIndex.js";
|
|
9
|
+
export * from "./indexPrefix.js";
|
|
10
|
+
export * from "./db/index.js";
|
|
11
|
+
export * from "./types.js";
|
|
12
|
+
export { registerOpenSearchCore } from "./registerOpenSearchCore.js";
|
|
13
|
+
export { getBaseConfiguration, getCommonMappings } from "./indexConfiguration/index.js";
|
|
14
|
+
export { createOpenSearchClient } from "./client.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { OpenSearchIndexRequestBody } from "../types.js";
|
|
2
|
+
interface Modifier {
|
|
3
|
+
(config: OpenSearchIndexRequestBody): OpenSearchIndexRequestBody;
|
|
4
|
+
}
|
|
5
|
+
export declare const getBaseConfiguration: (modifier?: Modifier) => import("@opensearch-project/opensearch/api/index.js").Indices_Create_RequestBody;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { getCommonMappings } from "./common.js";
|
|
2
|
+
const config = {
|
|
3
|
+
mappings: {
|
|
4
|
+
dynamic_templates: getCommonMappings((mappings)=>mappings.concat([
|
|
5
|
+
{
|
|
6
|
+
strings: {
|
|
7
|
+
match_mapping_type: "string",
|
|
8
|
+
mapping: {
|
|
9
|
+
type: "text",
|
|
10
|
+
fields: {
|
|
11
|
+
keyword: {
|
|
12
|
+
type: "keyword",
|
|
13
|
+
ignore_above: 256
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
])),
|
|
20
|
+
properties: {
|
|
21
|
+
rawValues: {
|
|
22
|
+
type: "object",
|
|
23
|
+
enabled: false
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const getBaseConfiguration = (modifier)=>{
|
|
29
|
+
if (!modifier) return config;
|
|
30
|
+
return modifier(config);
|
|
31
|
+
};
|
|
32
|
+
export { getBaseConfiguration };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexConfiguration/base.js","sources":["../../src/indexConfiguration/base.ts"],"sourcesContent":["import type { OpenSearchIndexRequestBody } from \"~/types.js\";\nimport { getCommonMappings } from \"./common.js\";\n\nconst config: OpenSearchIndexRequestBody = {\n mappings: {\n dynamic_templates: getCommonMappings(mappings => {\n return mappings.concat([\n {\n strings: {\n match_mapping_type: \"string\",\n mapping: {\n type: \"text\",\n fields: {\n keyword: {\n type: \"keyword\",\n ignore_above: 256\n }\n }\n }\n }\n }\n ]);\n }),\n properties: {\n rawValues: {\n type: \"object\",\n enabled: false\n }\n }\n }\n};\n\ninterface Modifier {\n (config: OpenSearchIndexRequestBody): OpenSearchIndexRequestBody;\n}\nexport const getBaseConfiguration = (modifier?: Modifier) => {\n if (!modifier) {\n return config;\n }\n return modifier(config);\n};\n"],"names":["config","getCommonMappings","mappings","getBaseConfiguration","modifier"],"mappings":";AAGA,MAAMA,SAAqC;IACvC,UAAU;QACN,mBAAmBC,kBAAkBC,CAAAA,WAC1BA,SAAS,MAAM,CAAC;gBACnB;oBACI,SAAS;wBACL,oBAAoB;wBACpB,SAAS;4BACL,MAAM;4BACN,QAAQ;gCACJ,SAAS;oCACL,MAAM;oCACN,cAAc;gCAClB;4BACJ;wBACJ;oBACJ;gBACJ;aACH;QAEL,YAAY;YACR,WAAW;gBACP,MAAM;gBACN,SAAS;YACb;QACJ;IACJ;AACJ;AAKO,MAAMC,uBAAuB,CAACC;IACjC,IAAI,CAACA,UACD,OAAOJ;IAEX,OAAOI,SAASJ;AACpB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { OpenSearchIndexRequestBodyMappingsDynamicTemplate } from "../types.js";
|
|
2
|
+
interface Modifier {
|
|
3
|
+
(mappings: OpenSearchIndexRequestBodyMappingsDynamicTemplate[]): OpenSearchIndexRequestBodyMappingsDynamicTemplate[];
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare const getCommonMappings: (cb?: Modifier) => OpenSearchIndexRequestBodyMappingsDynamicTemplate[];
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const getDefaultMappings = ()=>[
|
|
2
|
+
{
|
|
3
|
+
ids: {
|
|
4
|
+
match: "^id|entryId$",
|
|
5
|
+
mapping: {
|
|
6
|
+
type: "keyword"
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
dates: {
|
|
12
|
+
match: "^createdOn|savedOn|publishedOn$",
|
|
13
|
+
mapping: {
|
|
14
|
+
type: "date"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
numbers: {
|
|
20
|
+
match: "number@*",
|
|
21
|
+
mapping: {
|
|
22
|
+
type: "scaled_float",
|
|
23
|
+
scaling_factor: 10000
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
booleans: {
|
|
29
|
+
match: "boolean@*",
|
|
30
|
+
mapping: {
|
|
31
|
+
type: "boolean"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
];
|
|
36
|
+
const getCommonMappings = (cb)=>{
|
|
37
|
+
if (!cb) return getDefaultMappings();
|
|
38
|
+
return cb(getDefaultMappings());
|
|
39
|
+
};
|
|
40
|
+
export { getCommonMappings };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexConfiguration/common.js","sources":["../../src/indexConfiguration/common.ts"],"sourcesContent":["import type { OpenSearchIndexRequestBodyMappingsDynamicTemplate } from \"~/types.js\";\n\nconst getDefaultMappings = (): OpenSearchIndexRequestBodyMappingsDynamicTemplate[] => {\n return [\n {\n ids: {\n match: \"^id|entryId$\",\n mapping: {\n type: \"keyword\"\n }\n }\n },\n {\n /* Update with the correct date fields. */\n dates: {\n match: \"^createdOn|savedOn|publishedOn$\",\n mapping: {\n type: \"date\"\n }\n }\n },\n {\n numbers: {\n match: \"number@*\",\n mapping: {\n type: \"scaled_float\",\n scaling_factor: 10000\n }\n }\n },\n {\n booleans: {\n match: \"boolean@*\",\n mapping: {\n type: \"boolean\"\n }\n }\n }\n ];\n};\n\ninterface Modifier {\n (\n mappings: OpenSearchIndexRequestBodyMappingsDynamicTemplate[]\n ): OpenSearchIndexRequestBodyMappingsDynamicTemplate[];\n}\n/**\n * @internal\n */\nexport const getCommonMappings = (\n cb?: Modifier\n): OpenSearchIndexRequestBodyMappingsDynamicTemplate[] => {\n if (!cb) {\n return getDefaultMappings();\n }\n\n return cb(getDefaultMappings());\n};\n"],"names":["getDefaultMappings","getCommonMappings","cb"],"mappings":"AAEA,MAAMA,qBAAqB,IAChB;QACH;YACI,KAAK;gBACD,OAAO;gBACP,SAAS;oBACL,MAAM;gBACV;YACJ;QACJ;QACA;YAEI,OAAO;gBACH,OAAO;gBACP,SAAS;oBACL,MAAM;gBACV;YACJ;QACJ;QACA;YACI,SAAS;gBACL,OAAO;gBACP,SAAS;oBACL,MAAM;oBACN,gBAAgB;gBACpB;YACJ;QACJ;QACA;YACI,UAAU;gBACN,OAAO;gBACP,SAAS;oBACL,MAAM;gBACV;YACJ;QACJ;KACH;AAWE,MAAMC,oBAAoB,CAC7BC;IAEA,IAAI,CAACA,IACD,OAAOF;IAGX,OAAOE,GAAGF;AACd"}
|
package/indexPrefix.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getOpenSearchIndexPrefix: () => string;
|
package/indexPrefix.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const getOpenSearchIndexPrefix = ()=>process.env.OPENSEARCH_INDEX_PREFIX || process.env.ELASTICSEARCH_INDEX_PREFIX || process.env.WEBINY_OPENSEARCH_INDEX_PREFIX || process.env.WEBINY_ELASTICSEARCH_INDEX_PREFIX || "";
|
|
2
|
+
export { getOpenSearchIndexPrefix };
|
|
3
|
+
|
|
4
|
+
//# sourceMappingURL=indexPrefix.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexPrefix.js","sources":["../src/indexPrefix.ts"],"sourcesContent":["export const getOpenSearchIndexPrefix = (): string => {\n return (\n process.env.OPENSEARCH_INDEX_PREFIX ||\n process.env.ELASTICSEARCH_INDEX_PREFIX ||\n process.env.WEBINY_OPENSEARCH_INDEX_PREFIX ||\n process.env.WEBINY_ELASTICSEARCH_INDEX_PREFIX ||\n \"\"\n );\n};\n"],"names":["getOpenSearchIndexPrefix","process"],"mappings":"AAAO,MAAMA,2BAA2B,IAEhCC,QAAQ,GAAG,CAAC,uBAAuB,IACnCA,QAAQ,GAAG,CAAC,0BAA0B,IACtCA,QAAQ,GAAG,CAAC,8BAA8B,IAC1CA,QAAQ,GAAG,CAAC,iCAAiC,IAC7C"}
|
package/indices.d.ts
ADDED
package/indices.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { OpenSearchIndexRegistry } from "./features/OpenSearchIndex/abstractions/OpenSearchIndexRegistry.js";
|
package/limit.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createLimit: (limit?: number, defaultValue?: number) => number;
|
package/limit.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const ES_LIMIT_MAX = 10000;
|
|
2
|
+
const ES_LIMIT_DEFAULT = 50;
|
|
3
|
+
const createLimit = (limit, defaultValue = ES_LIMIT_DEFAULT)=>{
|
|
4
|
+
if (!limit || limit < 1) return defaultValue;
|
|
5
|
+
if (limit < ES_LIMIT_MAX) return limit;
|
|
6
|
+
return ES_LIMIT_MAX - 1;
|
|
7
|
+
};
|
|
8
|
+
export { createLimit };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=limit.js.map
|
package/limit.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limit.js","sources":["../src/limit.ts"],"sourcesContent":["/**\n * This is the max limit of the OpenSearch.\n * Change here if it changes (and if it is necessary).\n */\nconst ES_LIMIT_MAX = 10000;\n/**\n * Our system default limit.\n */\nconst ES_LIMIT_DEFAULT = 50;\n\nexport const createLimit = (limit?: number, defaultValue = ES_LIMIT_DEFAULT): number => {\n /**\n * Limit can possibly be null/undefined or less than 1.\n * In that case return the defaults.\n */\n if (!limit || limit < 1) {\n return defaultValue;\n }\n /**\n * Users input limit cannot be greater than the OpenSearch one.\n * OpenSearch query breaks because of that.\n */\n if (limit < ES_LIMIT_MAX) {\n return limit;\n }\n /**\n * Always reduce by 1 because we check if there are more items by adding 1 to the limit\n * and then remove that last one loaded.\n */\n return ES_LIMIT_MAX - 1;\n};\n"],"names":["ES_LIMIT_MAX","ES_LIMIT_DEFAULT","createLimit","limit","defaultValue"],"mappings":"AAIA,MAAMA,eAAe;AAIrB,MAAMC,mBAAmB;AAElB,MAAMC,cAAc,CAACC,OAAgBC,eAAeH,gBAAgB;IAKvE,IAAI,CAACE,SAASA,QAAQ,GAClB,OAAOC;IAMX,IAAID,QAAQH,cACR,OAAOG;IAMX,OAAOH,eAAe;AAC1B"}
|
package/normalize.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Before performing the query, we need to escape all special characters.
|
|
3
|
+
* @see https://opensearch.org/docs/latest/query-dsl/full-text/query-string/
|
|
4
|
+
*/
|
|
5
|
+
export declare const normalizeValue: (value: string) => string;
|
|
6
|
+
export declare const normalizeValueWithAsterisk: (initial: string) => string;
|
package/normalize.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const specialCharactersToRemove = [
|
|
2
|
+
"\\?"
|
|
3
|
+
];
|
|
4
|
+
const specialCharacterToSpace = [
|
|
5
|
+
"-",
|
|
6
|
+
"\\\\"
|
|
7
|
+
];
|
|
8
|
+
const specialCharacters = [
|
|
9
|
+
"\\\\",
|
|
10
|
+
"\\+",
|
|
11
|
+
"\\=",
|
|
12
|
+
"&",
|
|
13
|
+
"\\|",
|
|
14
|
+
">",
|
|
15
|
+
"<",
|
|
16
|
+
"!",
|
|
17
|
+
"\\(",
|
|
18
|
+
"\\)",
|
|
19
|
+
"\\{",
|
|
20
|
+
"\\}",
|
|
21
|
+
"\\[",
|
|
22
|
+
"\\]",
|
|
23
|
+
"\\^",
|
|
24
|
+
'\\"',
|
|
25
|
+
"\\~",
|
|
26
|
+
"\\*",
|
|
27
|
+
":",
|
|
28
|
+
"/",
|
|
29
|
+
"\\#"
|
|
30
|
+
];
|
|
31
|
+
const normalizeValue = (value)=>{
|
|
32
|
+
let result = value || "";
|
|
33
|
+
if (!result) return result;
|
|
34
|
+
for (const character of specialCharactersToRemove)result = result.replace(new RegExp(character, "g"), "");
|
|
35
|
+
for (const character of specialCharacterToSpace)result = result.replace(new RegExp(character, "g"), " ");
|
|
36
|
+
for (const character of specialCharacters)result = result.replace(new RegExp(character, "g"), `\\${character}`);
|
|
37
|
+
return result || "";
|
|
38
|
+
};
|
|
39
|
+
const hasSpecialChar = (value)=>{
|
|
40
|
+
if (!value) return null;
|
|
41
|
+
return null === value.match(/^([0-9a-zA-Z]+)$/i);
|
|
42
|
+
};
|
|
43
|
+
const normalizeValueWithAsterisk = (initial)=>{
|
|
44
|
+
const value = normalizeValue(initial);
|
|
45
|
+
const results = value.split(" ");
|
|
46
|
+
let result = value;
|
|
47
|
+
const firstWord = results[0];
|
|
48
|
+
if (false === hasSpecialChar(firstWord)) result = `*${result}`;
|
|
49
|
+
const lastWord = results[results.length - 1];
|
|
50
|
+
if (false === hasSpecialChar(lastWord)) result = `${result}*`;
|
|
51
|
+
return result;
|
|
52
|
+
};
|
|
53
|
+
export { normalizeValue, normalizeValueWithAsterisk };
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=normalize.js.map
|
package/normalize.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.js","sources":["../src/normalize.ts"],"sourcesContent":["/**\n * Before performing the query, we need to escape all special characters.\n * @see https://opensearch.org/docs/latest/query-dsl/full-text/query-string/\n */\n\nconst specialCharactersToRemove = [`\\\\?`];\n\nconst specialCharacterToSpace = [\"-\", \"\\\\\\\\\"];\n\nconst specialCharacters = [\n \"\\\\\\\\\",\n \"\\\\+\",\n // \"\\\\-\",\n \"\\\\=\",\n `&`,\n `\\\\|`,\n \">\",\n \"<\",\n `!`,\n \"\\\\(\",\n \"\\\\)\",\n \"\\\\{\",\n \"\\\\}\",\n \"\\\\[\",\n \"\\\\]\",\n \"\\\\^\",\n '\\\\\"',\n \"\\\\~\",\n \"\\\\*\",\n `:`,\n `/`,\n \"\\\\#\"\n];\n\nexport const normalizeValue = (value: string) => {\n let result = value || \"\";\n if (!result) {\n return result;\n }\n for (const character of specialCharactersToRemove) {\n result = result.replace(new RegExp(character, \"g\"), \"\");\n }\n for (const character of specialCharacterToSpace) {\n result = result.replace(new RegExp(character, \"g\"), \" \");\n }\n\n for (const character of specialCharacters) {\n result = result.replace(new RegExp(character, \"g\"), `\\\\${character}`);\n }\n\n return result || \"\";\n};\n\nconst hasSpecialChar = (value: string): boolean | null => {\n if (!value) {\n return null;\n }\n return value.match(/^([0-9a-zA-Z]+)$/i) === null;\n};\n\nexport const normalizeValueWithAsterisk = (initial: string) => {\n const value = normalizeValue(initial);\n const results = value.split(\" \");\n\n let result = value;\n /**\n * If there is a / in the first word, do not put asterisk in front of it.\n */\n const firstWord = results[0];\n if (hasSpecialChar(firstWord) === false) {\n result = `*${result}`;\n }\n /**\n * If there is a / in the last word, do not put asterisk at the end of it.\n */\n const lastWord = results[results.length - 1];\n if (hasSpecialChar(lastWord) === false) {\n result = `${result}*`;\n }\n\n return result;\n};\n"],"names":["specialCharactersToRemove","specialCharacterToSpace","specialCharacters","normalizeValue","value","result","character","RegExp","hasSpecialChar","normalizeValueWithAsterisk","initial","results","firstWord","lastWord"],"mappings":"AAKA,MAAMA,4BAA4B;IAAC;CAAM;AAEzC,MAAMC,0BAA0B;IAAC;IAAK;CAAO;AAE7C,MAAMC,oBAAoB;IACtB;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACH;AAEM,MAAMC,iBAAiB,CAACC;IAC3B,IAAIC,SAASD,SAAS;IACtB,IAAI,CAACC,QACD,OAAOA;IAEX,KAAK,MAAMC,aAAaN,0BACpBK,SAASA,OAAO,OAAO,CAAC,IAAIE,OAAOD,WAAW,MAAM;IAExD,KAAK,MAAMA,aAAaL,wBACpBI,SAASA,OAAO,OAAO,CAAC,IAAIE,OAAOD,WAAW,MAAM;IAGxD,KAAK,MAAMA,aAAaJ,kBACpBG,SAASA,OAAO,OAAO,CAAC,IAAIE,OAAOD,WAAW,MAAM,CAAC,EAAE,EAAEA,WAAW;IAGxE,OAAOD,UAAU;AACrB;AAEA,MAAMG,iBAAiB,CAACJ;IACpB,IAAI,CAACA,OACD,OAAO;IAEX,OAAOA,AAAqC,SAArCA,MAAM,KAAK,CAAC;AACvB;AAEO,MAAMK,6BAA6B,CAACC;IACvC,MAAMN,QAAQD,eAAeO;IAC7B,MAAMC,UAAUP,MAAM,KAAK,CAAC;IAE5B,IAAIC,SAASD;IAIb,MAAMQ,YAAYD,OAAO,CAAC,EAAE;IAC5B,IAAIH,AAA8B,UAA9BA,eAAeI,YACfP,SAAS,CAAC,CAAC,EAAEA,QAAQ;IAKzB,MAAMQ,WAAWF,OAAO,CAACA,QAAQ,MAAM,GAAG,EAAE;IAC5C,IAAIH,AAA6B,UAA7BA,eAAeK,WACfR,SAAS,GAAGA,OAAO,CAAC,CAAC;IAGzB,OAAOA;AACX"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Client } from "../client.js";
|
|
2
|
+
import type { IOpenSearchCatHealthResponse } from "./types.js";
|
|
3
|
+
export declare class OpenSearchCatHealth {
|
|
4
|
+
private readonly client;
|
|
5
|
+
constructor(client: Client);
|
|
6
|
+
getHealth(): Promise<IOpenSearchCatHealthResponse>;
|
|
7
|
+
}
|