@webiny/api-elasticsearch 0.0.0-mt-3 → 0.0.0-unstable.06b2ede40f
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/client.d.ts +1 -0
- package/client.js +79 -36
- package/client.js.map +1 -0
- package/compression.d.ts +1 -1
- package/compression.js +13 -49
- package/compression.js.map +1 -0
- package/cursors.d.ts +3 -2
- package/cursors.js +10 -14
- package/cursors.js.map +1 -0
- package/index.d.ts +19 -4
- package/index.js +187 -13
- package/index.js.map +1 -0
- package/indexConfiguration/base.d.ts +6 -0
- package/indexConfiguration/base.js +42 -0
- package/indexConfiguration/base.js.map +1 -0
- package/indexConfiguration/common.d.ts +9 -0
- package/indexConfiguration/common.js +54 -0
- package/indexConfiguration/common.js.map +1 -0
- package/indexConfiguration/index.d.ts +3 -0
- package/indexConfiguration/index.js +40 -0
- package/indexConfiguration/index.js.map +1 -0
- package/indexConfiguration/japanese.d.ts +6 -0
- package/indexConfiguration/japanese.js +121 -0
- package/indexConfiguration/japanese.js.map +1 -0
- package/indexPrefix.d.ts +1 -0
- package/indexPrefix.js +12 -0
- package/indexPrefix.js.map +1 -0
- package/indices.d.ts +9 -0
- package/indices.js +30 -0
- package/indices.js.map +1 -0
- package/limit.js +2 -8
- package/limit.js.map +1 -0
- package/normalize.d.ts +1 -0
- package/normalize.js +47 -12
- package/normalize.js.map +1 -0
- package/operations/ElasticsearchCatHealth.d.ts +7 -0
- package/operations/ElasticsearchCatHealth.js +38 -0
- package/operations/ElasticsearchCatHealth.js.map +1 -0
- package/operations/ElasticsearchCatNodes.d.ts +7 -0
- package/operations/ElasticsearchCatNodes.js +36 -0
- package/operations/ElasticsearchCatNodes.js.map +1 -0
- package/operations/index.d.ts +3 -0
- package/operations/index.js +40 -0
- package/operations/index.js.map +1 -0
- package/operations/stripConnectionFromException.d.ts +1 -0
- package/operations/stripConnectionFromException.js +24 -0
- package/operations/stripConnectionFromException.js.map +1 -0
- package/operations/types.d.ts +35 -0
- package/operations/types.js +14 -0
- package/operations/types.js.map +1 -0
- package/operators.d.ts +5 -14
- package/operators.js +37 -32
- package/operators.js.map +1 -0
- package/package.json +12 -25
- package/plugins/definition/ElasticsearchBodyModifierPlugin.d.ts +1 -1
- package/plugins/definition/ElasticsearchBodyModifierPlugin.js +3 -12
- package/plugins/definition/ElasticsearchBodyModifierPlugin.js.map +1 -0
- package/plugins/definition/ElasticsearchFieldPlugin.d.ts +11 -17
- package/plugins/definition/ElasticsearchFieldPlugin.js +22 -75
- package/plugins/definition/ElasticsearchFieldPlugin.js.map +1 -0
- package/plugins/definition/ElasticsearchIndexPlugin.d.ts +18 -0
- package/plugins/definition/ElasticsearchIndexPlugin.js +36 -0
- package/plugins/definition/ElasticsearchIndexPlugin.js.map +1 -0
- package/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin.d.ts +6 -2
- package/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin.js +12 -8
- package/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin.js.map +1 -0
- package/plugins/definition/ElasticsearchQueryModifierPlugin.d.ts +1 -1
- package/plugins/definition/ElasticsearchQueryModifierPlugin.js +3 -12
- package/plugins/definition/ElasticsearchQueryModifierPlugin.js.map +1 -0
- package/plugins/definition/ElasticsearchSortModifierPlugin.d.ts +1 -1
- package/plugins/definition/ElasticsearchSortModifierPlugin.js +3 -12
- package/plugins/definition/ElasticsearchSortModifierPlugin.js.map +1 -0
- package/plugins/definition/index.d.ts +6 -0
- package/plugins/definition/index.js +73 -0
- package/plugins/definition/index.js.map +1 -0
- package/plugins/index.d.ts +2 -0
- package/plugins/index.js +29 -0
- package/plugins/index.js.map +1 -0
- package/plugins/operator/andIn.d.ts +1 -1
- package/plugins/operator/andIn.js +6 -20
- package/plugins/operator/andIn.js.map +1 -0
- package/plugins/operator/between.d.ts +1 -1
- package/plugins/operator/between.js +10 -22
- package/plugins/operator/between.js.map +1 -0
- package/plugins/operator/contains.d.ts +1 -1
- package/plugins/operator/contains.js +4 -16
- package/plugins/operator/contains.js.map +1 -0
- package/plugins/operator/equal.d.ts +1 -1
- package/plugins/operator/equal.js +31 -19
- package/plugins/operator/equal.js.map +1 -0
- package/plugins/operator/gt.d.ts +1 -1
- package/plugins/operator/gt.js +4 -15
- package/plugins/operator/gt.js.map +1 -0
- package/plugins/operator/gte.d.ts +1 -1
- package/plugins/operator/gte.js +4 -15
- package/plugins/operator/gte.js.map +1 -0
- package/plugins/operator/in.d.ts +1 -1
- package/plugins/operator/in.js +9 -27
- package/plugins/operator/in.js.map +1 -0
- package/plugins/operator/index.d.ts +3 -0
- package/plugins/operator/index.js +36 -27
- package/plugins/operator/index.js.map +1 -0
- package/plugins/operator/japanese/contains.d.ts +8 -0
- package/plugins/operator/japanese/contains.js +44 -0
- package/plugins/operator/japanese/contains.js.map +1 -0
- package/plugins/operator/lt.d.ts +1 -1
- package/plugins/operator/lt.js +4 -15
- package/plugins/operator/lt.js.map +1 -0
- package/plugins/operator/lte.d.ts +1 -1
- package/plugins/operator/lte.js +4 -15
- package/plugins/operator/lte.js.map +1 -0
- package/plugins/operator/not.d.ts +1 -1
- package/plugins/operator/not.js +27 -16
- package/plugins/operator/not.js.map +1 -0
- package/plugins/operator/notBetween.d.ts +1 -1
- package/plugins/operator/notBetween.js +9 -21
- package/plugins/operator/notBetween.js.map +1 -0
- package/plugins/operator/notContains.d.ts +1 -1
- package/plugins/operator/notContains.js +4 -16
- package/plugins/operator/notContains.js.map +1 -0
- package/plugins/operator/notIn.d.ts +1 -1
- package/plugins/operator/notIn.js +6 -18
- package/plugins/operator/notIn.js.map +1 -0
- package/plugins/operator/notStartsWith.d.ts +7 -0
- package/plugins/operator/notStartsWith.js +30 -0
- package/plugins/operator/notStartsWith.js.map +1 -0
- package/plugins/operator/startsWith.d.ts +7 -0
- package/plugins/operator/startsWith.js +30 -0
- package/plugins/operator/startsWith.js.map +1 -0
- package/sharedIndex.d.ts +1 -0
- package/sharedIndex.js +12 -0
- package/sharedIndex.js.map +1 -0
- package/sort.d.ts +5 -4
- package/sort.js +22 -17
- package/sort.js.map +1 -0
- package/types.d.ts +178 -6
- package/types.js +14 -3
- package/types.js.map +1 -0
- package/utils/createIndex.d.ts +20 -0
- package/utils/createIndex.js +100 -0
- package/utils/createIndex.js.map +1 -0
- package/utils/index.d.ts +3 -0
- package/utils/index.js +29 -0
- package/utils/index.js.map +1 -0
- package/utils/waitUntilHealthy/UnhealthyClusterError.d.ts +4 -0
- package/utils/waitUntilHealthy/UnhealthyClusterError.js +18 -0
- package/utils/waitUntilHealthy/UnhealthyClusterError.js.map +1 -0
- package/utils/waitUntilHealthy/WaitUntilHealthy.d.ts +71 -0
- package/utils/waitUntilHealthy/WaitUntilHealthy.js +157 -0
- package/utils/waitUntilHealthy/WaitUntilHealthy.js.map +1 -0
- package/utils/waitUntilHealthy/WaitingHealthyClusterAbortedError.d.ts +4 -0
- package/utils/waitUntilHealthy/WaitingHealthyClusterAbortedError.js +18 -0
- package/utils/waitUntilHealthy/WaitingHealthyClusterAbortedError.js.map +1 -0
- package/utils/waitUntilHealthy/index.d.ts +6 -0
- package/utils/waitUntilHealthy/index.js +51 -0
- package/utils/waitUntilHealthy/index.js.map +1 -0
- package/utils/waitUntilHealthy/reason/ClusterHealthReason.d.ts +15 -0
- package/utils/waitUntilHealthy/reason/ClusterHealthReason.js +21 -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 +7 -0
- package/utils/waitUntilHealthy/reason/IReason.js.map +1 -0
- package/utils/waitUntilHealthy/reason/MemoryReason.d.ts +14 -0
- package/utils/waitUntilHealthy/reason/MemoryReason.js +21 -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 +21 -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 +40 -0
- package/utils/waitUntilHealthy/reason/index.js.map +1 -0
- package/where.d.ts +5 -5
- package/where.js +11 -26
- package/where.js.map +1 -0
- package/plugins/GzipCompression.d.ts +0 -19
- package/plugins/GzipCompression.js +0 -75
- package/plugins/definition/CompressionPlugin.d.ts +0 -20
- package/plugins/definition/CompressionPlugin.js +0 -17
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ClusterHealthReason","name","constructor","params","minimum","current","description","exports","createClusterHealthStatusReason"],"sources":["ClusterHealthReason.ts"],"sourcesContent":["import type { ElasticsearchCatClusterHealthStatus } from \"~/operations\";\nimport type { IReason } from \"~/utils/waitUntilHealthy/reason/IReason\";\n\nexport interface IClusterHealthReasonParams {\n minimum: ElasticsearchCatClusterHealthStatus;\n current: ElasticsearchCatClusterHealthStatus;\n description?: string;\n}\n\nexport class ClusterHealthReason implements IReason {\n public readonly name = \"clusterHealth\";\n public readonly minimum: ElasticsearchCatClusterHealthStatus;\n public readonly current: ElasticsearchCatClusterHealthStatus;\n public readonly description?: string;\n\n public constructor(params: IClusterHealthReasonParams) {\n this.minimum = params.minimum;\n this.current = params.current;\n this.description = params.description;\n }\n}\n\nexport const createClusterHealthStatusReason = (\n params: IClusterHealthReasonParams\n): ClusterHealthReason => {\n return new ClusterHealthReason(params);\n};\n"],"mappings":";;;;;;AASO,MAAMA,mBAAmB,CAAoB;EAChCC,IAAI,GAAG,eAAe;EAK/BC,WAAWA,CAACC,MAAkC,EAAE;IACnD,IAAI,CAACC,OAAO,GAAGD,MAAM,CAACC,OAAO;IAC7B,IAAI,CAACC,OAAO,GAAGF,MAAM,CAACE,OAAO;IAC7B,IAAI,CAACC,WAAW,GAAGH,MAAM,CAACG,WAAW;EACzC;AACJ;AAACC,OAAA,CAAAP,mBAAA,GAAAA,mBAAA;AAEM,MAAMQ,+BAA+B,GACxCL,MAAkC,IACZ;EACtB,OAAO,IAAIH,mBAAmB,CAACG,MAAM,CAAC;AAC1C,CAAC;AAACI,OAAA,CAAAC,+BAAA,GAAAA,+BAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["IReason.ts"],"sourcesContent":["export interface IReason {\n name: string;\n description?: string;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IReason } from "./IReason";
|
|
2
|
+
export interface IMemoryReasonParams {
|
|
3
|
+
maximum: number;
|
|
4
|
+
current: number;
|
|
5
|
+
description?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class MemoryReason implements IReason {
|
|
8
|
+
readonly name = "memory";
|
|
9
|
+
readonly maximum: number;
|
|
10
|
+
readonly current: number;
|
|
11
|
+
readonly description?: string;
|
|
12
|
+
constructor(params: IMemoryReasonParams);
|
|
13
|
+
}
|
|
14
|
+
export declare const createMemoryReason: (params: IMemoryReasonParams) => MemoryReason;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createMemoryReason = exports.MemoryReason = void 0;
|
|
7
|
+
class MemoryReason {
|
|
8
|
+
name = "memory";
|
|
9
|
+
constructor(params) {
|
|
10
|
+
this.maximum = params.maximum;
|
|
11
|
+
this.current = params.current;
|
|
12
|
+
this.description = params.description;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.MemoryReason = MemoryReason;
|
|
16
|
+
const createMemoryReason = params => {
|
|
17
|
+
return new MemoryReason(params);
|
|
18
|
+
};
|
|
19
|
+
exports.createMemoryReason = createMemoryReason;
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=MemoryReason.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MemoryReason","name","constructor","params","maximum","current","description","exports","createMemoryReason"],"sources":["MemoryReason.ts"],"sourcesContent":["import type { IReason } from \"~/utils/waitUntilHealthy/reason/IReason\";\n\nexport interface IMemoryReasonParams {\n maximum: number;\n current: number;\n description?: string;\n}\n\nexport class MemoryReason implements IReason {\n public readonly name = \"memory\";\n public readonly maximum: number;\n public readonly current: number;\n public readonly description?: string;\n\n public constructor(params: IMemoryReasonParams) {\n this.maximum = params.maximum;\n this.current = params.current;\n this.description = params.description;\n }\n}\n\nexport const createMemoryReason = (params: IMemoryReasonParams): MemoryReason => {\n return new MemoryReason(params);\n};\n"],"mappings":";;;;;;AAQO,MAAMA,YAAY,CAAoB;EACzBC,IAAI,GAAG,QAAQ;EAKxBC,WAAWA,CAACC,MAA2B,EAAE;IAC5C,IAAI,CAACC,OAAO,GAAGD,MAAM,CAACC,OAAO;IAC7B,IAAI,CAACC,OAAO,GAAGF,MAAM,CAACE,OAAO;IAC7B,IAAI,CAACC,WAAW,GAAGH,MAAM,CAACG,WAAW;EACzC;AACJ;AAACC,OAAA,CAAAP,YAAA,GAAAA,YAAA;AAEM,MAAMQ,kBAAkB,GAAIL,MAA2B,IAAmB;EAC7E,OAAO,IAAIH,YAAY,CAACG,MAAM,CAAC;AACnC,CAAC;AAACI,OAAA,CAAAC,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IReason } from "./IReason";
|
|
2
|
+
export interface IProcessorReasonParams {
|
|
3
|
+
maximum: number;
|
|
4
|
+
current: number;
|
|
5
|
+
description?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class ProcessorReason implements IReason {
|
|
8
|
+
readonly name = "processor";
|
|
9
|
+
readonly maximum: number;
|
|
10
|
+
readonly current: number;
|
|
11
|
+
readonly description?: string;
|
|
12
|
+
constructor(params: IProcessorReasonParams);
|
|
13
|
+
}
|
|
14
|
+
export declare const createProcessorReason: (params: IProcessorReasonParams) => ProcessorReason;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createProcessorReason = exports.ProcessorReason = void 0;
|
|
7
|
+
class ProcessorReason {
|
|
8
|
+
name = "processor";
|
|
9
|
+
constructor(params) {
|
|
10
|
+
this.maximum = params.maximum;
|
|
11
|
+
this.current = params.current;
|
|
12
|
+
this.description = params.description;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.ProcessorReason = ProcessorReason;
|
|
16
|
+
const createProcessorReason = params => {
|
|
17
|
+
return new ProcessorReason(params);
|
|
18
|
+
};
|
|
19
|
+
exports.createProcessorReason = createProcessorReason;
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=ProcessorReason.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ProcessorReason","name","constructor","params","maximum","current","description","exports","createProcessorReason"],"sources":["ProcessorReason.ts"],"sourcesContent":["import type { IReason } from \"~/utils/waitUntilHealthy/reason/IReason\";\n\nexport interface IProcessorReasonParams {\n maximum: number;\n current: number;\n description?: string;\n}\n\nexport class ProcessorReason implements IReason {\n public readonly name = \"processor\";\n public readonly maximum: number;\n public readonly current: number;\n public readonly description?: string;\n\n public constructor(params: IProcessorReasonParams) {\n this.maximum = params.maximum;\n this.current = params.current;\n this.description = params.description;\n }\n}\n\nexport const createProcessorReason = (params: IProcessorReasonParams): ProcessorReason => {\n return new ProcessorReason(params);\n};\n"],"mappings":";;;;;;AAQO,MAAMA,eAAe,CAAoB;EAC5BC,IAAI,GAAG,WAAW;EAK3BC,WAAWA,CAACC,MAA8B,EAAE;IAC/C,IAAI,CAACC,OAAO,GAAGD,MAAM,CAACC,OAAO;IAC7B,IAAI,CAACC,OAAO,GAAGF,MAAM,CAACE,OAAO;IAC7B,IAAI,CAACC,WAAW,GAAGH,MAAM,CAACG,WAAW;EACzC;AACJ;AAACC,OAAA,CAAAP,eAAA,GAAAA,eAAA;AAEM,MAAMQ,qBAAqB,GAAIL,MAA8B,IAAsB;EACtF,OAAO,IAAIH,eAAe,CAACG,MAAM,CAAC;AACtC,CAAC;AAACI,OAAA,CAAAC,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _ClusterHealthReason = require("./ClusterHealthReason");
|
|
7
|
+
Object.keys(_ClusterHealthReason).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _ClusterHealthReason[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _ClusterHealthReason[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _MemoryReason = require("./MemoryReason");
|
|
18
|
+
Object.keys(_MemoryReason).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _MemoryReason[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _MemoryReason[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _ProcessorReason = require("./ProcessorReason");
|
|
29
|
+
Object.keys(_ProcessorReason).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _ProcessorReason[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _ProcessorReason[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_ClusterHealthReason","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_MemoryReason","_ProcessorReason"],"sources":["index.ts"],"sourcesContent":["export * from \"./ClusterHealthReason\";\nexport * from \"./MemoryReason\";\nexport * from \"./ProcessorReason\";\n"],"mappings":";;;;;AAAA,IAAAA,oBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,oBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,oBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,oBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,aAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,aAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,aAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,aAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,gBAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,gBAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,gBAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,gBAAA,CAAAN,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
package/where.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ElasticsearchBoolQueryConfig } from "./types";
|
|
1
|
+
import type { ElasticsearchBoolQueryConfig } from "./types";
|
|
2
2
|
import { ElasticsearchFieldPlugin } from "./plugins/definition/ElasticsearchFieldPlugin";
|
|
3
|
-
import { ElasticsearchQueryBuilderOperatorPlugin } from "./plugins/definition/ElasticsearchQueryBuilderOperatorPlugin";
|
|
4
|
-
|
|
5
|
-
export interface
|
|
3
|
+
import type { ElasticsearchQueryBuilderOperatorPlugin } from "./plugins/definition/ElasticsearchQueryBuilderOperatorPlugin";
|
|
4
|
+
type Records<T> = Record<string, T>;
|
|
5
|
+
export interface ApplyWhereParams {
|
|
6
6
|
query: ElasticsearchBoolQueryConfig;
|
|
7
7
|
where: Records<any>;
|
|
8
8
|
fields: Records<ElasticsearchFieldPlugin>;
|
|
@@ -13,5 +13,5 @@ export interface ParseWhereKeyResult {
|
|
|
13
13
|
operator: string;
|
|
14
14
|
}
|
|
15
15
|
export declare const parseWhereKey: (key: string) => ParseWhereKeyResult;
|
|
16
|
-
export declare const applyWhere: (params:
|
|
16
|
+
export declare const applyWhere: (params: ApplyWhereParams) => void;
|
|
17
17
|
export {};
|
package/where.js
CHANGED
|
@@ -1,41 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.parseWhereKey = exports.applyWhere = void 0;
|
|
9
|
-
|
|
10
8
|
var _ElasticsearchFieldPlugin = require("./plugins/definition/ElasticsearchFieldPlugin");
|
|
11
|
-
|
|
12
9
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
/**
|
|
11
|
+
* TODO remove the wbyAco prefix when we move the user fields to the values property.
|
|
12
|
+
*/
|
|
13
|
+
const parseWhereKeyRegExp = new RegExp(/^((?:wbyAco_)?[a-zA-Z0-9]+)(_[a-zA-Z0-9_]+)?$/);
|
|
16
14
|
const parseWhereKey = key => {
|
|
17
15
|
const match = key.match(parseWhereKeyRegExp);
|
|
18
|
-
|
|
19
16
|
if (!match) {
|
|
20
17
|
throw new Error(`It is not possible to search by key "${key}"`);
|
|
21
18
|
}
|
|
22
|
-
|
|
23
19
|
const [, field, operation = "eq"] = match;
|
|
24
|
-
|
|
25
|
-
if (!field.match(/^([a-zA-Z]+)$/)) {
|
|
20
|
+
if (!field.match(/^(?:wbyAco_)?([a-zA-Z0-9]+)$/)) {
|
|
26
21
|
throw new Error(`Cannot filter by "${field}".`);
|
|
27
22
|
}
|
|
28
|
-
|
|
29
|
-
const operator = operation.match(/^_/) ? operation.substr(1) : operation;
|
|
23
|
+
const operator = operation.match(/^_/) ? operation.slice(1) : operation;
|
|
30
24
|
return {
|
|
31
25
|
field,
|
|
32
26
|
operator
|
|
33
27
|
};
|
|
34
28
|
};
|
|
35
|
-
|
|
36
29
|
exports.parseWhereKey = parseWhereKey;
|
|
37
30
|
const ALL = _ElasticsearchFieldPlugin.ElasticsearchFieldPlugin.ALL;
|
|
38
|
-
|
|
39
31
|
const applyWhere = params => {
|
|
40
32
|
const {
|
|
41
33
|
query,
|
|
@@ -43,58 +35,50 @@ const applyWhere = params => {
|
|
|
43
35
|
fields,
|
|
44
36
|
operators
|
|
45
37
|
} = params;
|
|
46
|
-
|
|
47
38
|
for (const key in where) {
|
|
48
39
|
if (where.hasOwnProperty(key) === false) {
|
|
49
40
|
continue;
|
|
50
41
|
}
|
|
51
|
-
|
|
52
42
|
const initialValue = where[key];
|
|
53
43
|
/**
|
|
54
44
|
* There is a possibility that undefined is sent as a value, so just skip it.
|
|
55
45
|
*/
|
|
56
|
-
|
|
57
46
|
if (initialValue === undefined) {
|
|
58
47
|
continue;
|
|
59
48
|
}
|
|
60
|
-
|
|
61
49
|
const {
|
|
62
50
|
field,
|
|
63
51
|
operator
|
|
64
52
|
} = parseWhereKey(key);
|
|
65
53
|
const fieldPlugin = fields[field] || fields[ALL];
|
|
66
|
-
|
|
67
54
|
if (!fieldPlugin) {
|
|
68
55
|
throw new _error.default(`Missing plugin for the field "${field}".`, "PLUGIN_WHERE_ERROR", {
|
|
69
56
|
field
|
|
70
57
|
});
|
|
71
58
|
}
|
|
72
|
-
|
|
73
59
|
const operatorPlugin = operators[operator];
|
|
74
|
-
|
|
75
60
|
if (!operatorPlugin) {
|
|
76
61
|
throw new _error.default(`Missing plugin for the operator "${operator}"`, "PLUGIN_WHERE_ERROR", {
|
|
77
62
|
operator
|
|
78
63
|
});
|
|
79
64
|
}
|
|
65
|
+
|
|
80
66
|
/**
|
|
81
67
|
* Get the path but in the case of * (all fields, replace * with the field.
|
|
82
68
|
* Custom path would return its own value anyways.
|
|
83
69
|
*/
|
|
84
|
-
|
|
85
|
-
|
|
86
70
|
const path = fieldPlugin.getPath(field);
|
|
87
71
|
const basePath = fieldPlugin.getBasePath(field);
|
|
88
72
|
/**
|
|
89
73
|
* Transform the value for the search.
|
|
90
74
|
*/
|
|
91
|
-
|
|
92
75
|
const value = fieldPlugin.toSearchValue({
|
|
93
76
|
value: initialValue,
|
|
94
77
|
path,
|
|
95
78
|
basePath
|
|
96
79
|
});
|
|
97
80
|
operatorPlugin.apply(query, {
|
|
81
|
+
name: field,
|
|
98
82
|
value,
|
|
99
83
|
path,
|
|
100
84
|
basePath,
|
|
@@ -102,5 +86,6 @@ const applyWhere = params => {
|
|
|
102
86
|
});
|
|
103
87
|
}
|
|
104
88
|
};
|
|
89
|
+
exports.applyWhere = applyWhere;
|
|
105
90
|
|
|
106
|
-
|
|
91
|
+
//# sourceMappingURL=where.js.map
|
package/where.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_ElasticsearchFieldPlugin","require","_error","_interopRequireDefault","parseWhereKeyRegExp","RegExp","parseWhereKey","key","match","Error","field","operation","operator","slice","exports","ALL","ElasticsearchFieldPlugin","applyWhere","params","query","where","fields","operators","hasOwnProperty","initialValue","undefined","fieldPlugin","WebinyError","operatorPlugin","path","getPath","basePath","getBasePath","value","toSearchValue","apply","name","keyword"],"sources":["where.ts"],"sourcesContent":["import type { ElasticsearchBoolQueryConfig } from \"~/types\";\nimport { ElasticsearchFieldPlugin } from \"~/plugins/definition/ElasticsearchFieldPlugin\";\nimport type { ElasticsearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin\";\nimport WebinyError from \"@webiny/error\";\n\ntype Records<T> = Record<string, T>;\n\nexport interface ApplyWhereParams {\n query: ElasticsearchBoolQueryConfig;\n where: Records<any>;\n fields: Records<ElasticsearchFieldPlugin>;\n operators: Records<ElasticsearchQueryBuilderOperatorPlugin>;\n}\n\nexport interface ParseWhereKeyResult {\n field: string;\n operator: string;\n}\n\n/**\n * TODO remove the wbyAco prefix when we move the user fields to the values property.\n */\nconst parseWhereKeyRegExp = new RegExp(/^((?:wbyAco_)?[a-zA-Z0-9]+)(_[a-zA-Z0-9_]+)?$/);\n\nexport const parseWhereKey = (key: string): ParseWhereKeyResult => {\n const match = key.match(parseWhereKeyRegExp);\n\n if (!match) {\n throw new Error(`It is not possible to search by key \"${key}\"`);\n }\n\n const [, field, operation = \"eq\"] = match;\n\n if (!field.match(/^(?:wbyAco_)?([a-zA-Z0-9]+)$/)) {\n throw new Error(`Cannot filter by \"${field}\".`);\n }\n\n const operator = operation.match(/^_/) ? operation.slice(1) : operation;\n\n return { field, operator };\n};\n\nconst ALL = ElasticsearchFieldPlugin.ALL;\n\nexport const applyWhere = (params: ApplyWhereParams): void => {\n const { query, where, fields, operators } = params;\n\n for (const key in where) {\n if (where.hasOwnProperty(key) === false) {\n continue;\n }\n const initialValue = where[key];\n /**\n * There is a possibility that undefined is sent as a value, so just skip it.\n */\n if (initialValue === undefined) {\n continue;\n }\n const { field, operator } = parseWhereKey(key);\n const fieldPlugin: ElasticsearchFieldPlugin = fields[field] || fields[ALL];\n if (!fieldPlugin) {\n throw new WebinyError(\n `Missing plugin for the field \"${field}\".`,\n \"PLUGIN_WHERE_ERROR\",\n {\n field\n }\n );\n }\n const operatorPlugin = operators[operator];\n if (!operatorPlugin) {\n throw new WebinyError(\n `Missing plugin for the operator \"${operator}\"`,\n \"PLUGIN_WHERE_ERROR\",\n {\n operator\n }\n );\n }\n\n /**\n * Get the path but in the case of * (all fields, replace * with the field.\n * Custom path would return its own value anyways.\n */\n const path = fieldPlugin.getPath(field);\n const basePath = fieldPlugin.getBasePath(field);\n /**\n * Transform the value for the search.\n */\n const value = fieldPlugin.toSearchValue({\n value: initialValue,\n path,\n basePath\n });\n\n operatorPlugin.apply(query, {\n name: field,\n value,\n path,\n basePath,\n keyword: fieldPlugin.keyword\n });\n }\n};\n"],"mappings":";;;;;;;AACA,IAAAA,yBAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAgBA;AACA;AACA;AACA,MAAMG,mBAAmB,GAAG,IAAIC,MAAM,CAAC,+CAA+C,CAAC;AAEhF,MAAMC,aAAa,GAAIC,GAAW,IAA0B;EAC/D,MAAMC,KAAK,GAAGD,GAAG,CAACC,KAAK,CAACJ,mBAAmB,CAAC;EAE5C,IAAI,CAACI,KAAK,EAAE;IACR,MAAM,IAAIC,KAAK,CAAC,wCAAwCF,GAAG,GAAG,CAAC;EACnE;EAEA,MAAM,GAAGG,KAAK,EAAEC,SAAS,GAAG,IAAI,CAAC,GAAGH,KAAK;EAEzC,IAAI,CAACE,KAAK,CAACF,KAAK,CAAC,8BAA8B,CAAC,EAAE;IAC9C,MAAM,IAAIC,KAAK,CAAC,qBAAqBC,KAAK,IAAI,CAAC;EACnD;EAEA,MAAME,QAAQ,GAAGD,SAAS,CAACH,KAAK,CAAC,IAAI,CAAC,GAAGG,SAAS,CAACE,KAAK,CAAC,CAAC,CAAC,GAAGF,SAAS;EAEvE,OAAO;IAAED,KAAK;IAAEE;EAAS,CAAC;AAC9B,CAAC;AAACE,OAAA,CAAAR,aAAA,GAAAA,aAAA;AAEF,MAAMS,GAAG,GAAGC,kDAAwB,CAACD,GAAG;AAEjC,MAAME,UAAU,GAAIC,MAAwB,IAAW;EAC1D,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC,MAAM;IAAEC;EAAU,CAAC,GAAGJ,MAAM;EAElD,KAAK,MAAMX,GAAG,IAAIa,KAAK,EAAE;IACrB,IAAIA,KAAK,CAACG,cAAc,CAAChB,GAAG,CAAC,KAAK,KAAK,EAAE;MACrC;IACJ;IACA,MAAMiB,YAAY,GAAGJ,KAAK,CAACb,GAAG,CAAC;IAC/B;AACR;AACA;IACQ,IAAIiB,YAAY,KAAKC,SAAS,EAAE;MAC5B;IACJ;IACA,MAAM;MAAEf,KAAK;MAAEE;IAAS,CAAC,GAAGN,aAAa,CAACC,GAAG,CAAC;IAC9C,MAAMmB,WAAqC,GAAGL,MAAM,CAACX,KAAK,CAAC,IAAIW,MAAM,CAACN,GAAG,CAAC;IAC1E,IAAI,CAACW,WAAW,EAAE;MACd,MAAM,IAAIC,cAAW,CACjB,iCAAiCjB,KAAK,IAAI,EAC1C,oBAAoB,EACpB;QACIA;MACJ,CACJ,CAAC;IACL;IACA,MAAMkB,cAAc,GAAGN,SAAS,CAACV,QAAQ,CAAC;IAC1C,IAAI,CAACgB,cAAc,EAAE;MACjB,MAAM,IAAID,cAAW,CACjB,oCAAoCf,QAAQ,GAAG,EAC/C,oBAAoB,EACpB;QACIA;MACJ,CACJ,CAAC;IACL;;IAEA;AACR;AACA;AACA;IACQ,MAAMiB,IAAI,GAAGH,WAAW,CAACI,OAAO,CAACpB,KAAK,CAAC;IACvC,MAAMqB,QAAQ,GAAGL,WAAW,CAACM,WAAW,CAACtB,KAAK,CAAC;IAC/C;AACR;AACA;IACQ,MAAMuB,KAAK,GAAGP,WAAW,CAACQ,aAAa,CAAC;MACpCD,KAAK,EAAET,YAAY;MACnBK,IAAI;MACJE;IACJ,CAAC,CAAC;IAEFH,cAAc,CAACO,KAAK,CAAChB,KAAK,EAAE;MACxBiB,IAAI,EAAE1B,KAAK;MACXuB,KAAK;MACLJ,IAAI;MACJE,QAAQ;MACRM,OAAO,EAAEX,WAAW,CAACW;IACzB,CAAC,CAAC;EACN;AACJ,CAAC;AAACvB,OAAA,CAAAG,UAAA,GAAAA,UAAA","ignoreList":[]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { CompressionPlugin } from "./definition/CompressionPlugin";
|
|
2
|
-
export interface CompressedData {
|
|
3
|
-
compression: string;
|
|
4
|
-
value: string;
|
|
5
|
-
}
|
|
6
|
-
interface OriginalData {
|
|
7
|
-
[key: string]: any;
|
|
8
|
-
}
|
|
9
|
-
declare class GzipCompression extends CompressionPlugin {
|
|
10
|
-
canCompress(data: any): boolean;
|
|
11
|
-
compress(data: any): Promise<{
|
|
12
|
-
compression: string;
|
|
13
|
-
value: string;
|
|
14
|
-
}>;
|
|
15
|
-
canDecompress(data: CompressedData | Record<string, any>): boolean;
|
|
16
|
-
decompress(data: CompressedData): Promise<OriginalData | null>;
|
|
17
|
-
}
|
|
18
|
-
declare const _default: () => GzipCompression;
|
|
19
|
-
export default _default;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _CompressionPlugin = require("./definition/CompressionPlugin");
|
|
9
|
-
|
|
10
|
-
var _gzip = require("@webiny/utils/compression/gzip");
|
|
11
|
-
|
|
12
|
-
const GZIP = "gzip";
|
|
13
|
-
const TO_STORAGE_ENCODING = "base64";
|
|
14
|
-
const FROM_STORAGE_ENCODING = "utf8";
|
|
15
|
-
|
|
16
|
-
const convertToBuffer = value => {
|
|
17
|
-
if (typeof value === "string") {
|
|
18
|
-
return Buffer.from(value, TO_STORAGE_ENCODING);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return value;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
class GzipCompression extends _CompressionPlugin.CompressionPlugin {
|
|
25
|
-
canCompress(data) {
|
|
26
|
-
/**
|
|
27
|
-
* If already compressed, skip this.
|
|
28
|
-
*/
|
|
29
|
-
if (data.compression) {
|
|
30
|
-
if (data.compression !== "GZIP") {
|
|
31
|
-
console.log(`Data is already compressed with "${data.compression}".`);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
async compress(data) {
|
|
41
|
-
const value = await (0, _gzip.compress)(JSON.stringify(data));
|
|
42
|
-
return {
|
|
43
|
-
compression: GZIP,
|
|
44
|
-
value: value.toString(TO_STORAGE_ENCODING)
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
canDecompress(data) {
|
|
49
|
-
if (!data || !data.compression) {
|
|
50
|
-
return false;
|
|
51
|
-
} else if (data.compression !== GZIP) {
|
|
52
|
-
console.log(`Could not decompress given data since its compression is not "${GZIP}". It is "${data.compression}".`);
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return true;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
async decompress(data) {
|
|
60
|
-
try {
|
|
61
|
-
const buf = await (0, _gzip.decompress)(convertToBuffer(data.value));
|
|
62
|
-
const value = buf.toString(FROM_STORAGE_ENCODING);
|
|
63
|
-
return JSON.parse(value);
|
|
64
|
-
} catch (ex) {
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
var _default = () => {
|
|
72
|
-
return new GzipCompression();
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
exports.default = _default;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Plugin } from "@webiny/plugins";
|
|
2
|
-
export declare abstract class CompressionPlugin extends Plugin {
|
|
3
|
-
static readonly type = "elasticsearch.compression";
|
|
4
|
-
/**
|
|
5
|
-
* Check if data can be compressed.
|
|
6
|
-
*/
|
|
7
|
-
abstract canCompress(data: any): boolean;
|
|
8
|
-
/**
|
|
9
|
-
* Pass the data to get the compressed one back.
|
|
10
|
-
*/
|
|
11
|
-
abstract compress(data: any): Promise<any>;
|
|
12
|
-
/**
|
|
13
|
-
* Check if data can be decompressed.
|
|
14
|
-
*/
|
|
15
|
-
abstract canDecompress(data: any): boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Passed the compressed data to get the original data back.
|
|
18
|
-
*/
|
|
19
|
-
abstract decompress(data: any): Promise<any>;
|
|
20
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.CompressionPlugin = void 0;
|
|
9
|
-
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
|
-
var _plugins = require("@webiny/plugins");
|
|
13
|
-
|
|
14
|
-
class CompressionPlugin extends _plugins.Plugin {}
|
|
15
|
-
|
|
16
|
-
exports.CompressionPlugin = CompressionPlugin;
|
|
17
|
-
(0, _defineProperty2.default)(CompressionPlugin, "type", "elasticsearch.compression");
|