@webiny/api-elasticsearch 6.0.0-beta.0 → 6.0.0-rc.1
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/README.md +10 -0
- package/client.d.ts +2 -2
- package/client.js +11 -31
- package/client.js.map +1 -1
- package/compression.d.ts +1 -1
- package/compression.js +13 -40
- package/compression.js.map +1 -1
- package/cursors.d.ts +2 -2
- package/cursors.js +5 -13
- package/cursors.js.map +1 -1
- package/db/entity.d.ts +7 -0
- package/db/entity.js +20 -0
- package/db/entity.js.map +1 -0
- package/db/index.d.ts +3 -0
- package/db/index.js +5 -0
- package/db/index.js.map +1 -0
- package/db/table.d.ts +7 -0
- package/db/table.js +17 -0
- package/db/table.js.map +1 -0
- package/db/types.d.ts +6 -0
- package/db/types.js +3 -0
- package/db/types.js.map +1 -0
- package/index.d.ts +18 -16
- package/index.js +27 -182
- package/index.js.map +1 -1
- package/indexConfiguration/base.d.ts +1 -1
- package/indexConfiguration/base.js +3 -10
- package/indexConfiguration/base.js.map +1 -1
- package/indexConfiguration/common.d.ts +1 -1
- package/indexConfiguration/common.js +12 -8
- package/indexConfiguration/common.js.map +1 -1
- package/indexConfiguration/index.d.ts +2 -3
- package/indexConfiguration/index.js +2 -38
- package/indexConfiguration/index.js.map +1 -1
- package/indexPrefix.d.ts +1 -0
- package/indexPrefix.js +5 -0
- package/indexPrefix.js.map +1 -0
- package/indices.d.ts +2 -3
- package/indices.js +6 -16
- package/indices.js.map +1 -1
- package/limit.js +1 -8
- package/limit.js.map +1 -1
- package/normalize.js +3 -11
- package/normalize.js.map +1 -1
- package/operations/ElasticsearchCatHealth.d.ts +2 -2
- package/operations/ElasticsearchCatHealth.js +6 -13
- package/operations/ElasticsearchCatHealth.js.map +1 -1
- package/operations/ElasticsearchCatNodes.d.ts +2 -2
- package/operations/ElasticsearchCatNodes.js +6 -13
- package/operations/ElasticsearchCatNodes.js.map +1 -1
- package/operations/index.d.ts +3 -3
- package/operations/index.js +3 -38
- package/operations/index.js.map +1 -1
- package/operations/stripConnectionFromException.js +1 -8
- package/operations/stripConnectionFromException.js.map +1 -1
- package/operations/types.d.ts +1 -1
- package/operations/types.js +1 -7
- package/operations/types.js.map +1 -1
- package/operators.d.ts +2 -5
- package/operators.js +3 -41
- package/operators.js.map +1 -1
- package/package.json +14 -18
- package/plugins/definition/ElasticsearchBodyModifierPlugin.d.ts +1 -1
- package/plugins/definition/ElasticsearchBodyModifierPlugin.js +4 -12
- package/plugins/definition/ElasticsearchBodyModifierPlugin.js.map +1 -1
- package/plugins/definition/ElasticsearchFieldPlugin.d.ts +2 -2
- package/plugins/definition/ElasticsearchFieldPlugin.js +2 -9
- package/plugins/definition/ElasticsearchFieldPlugin.js.map +1 -1
- package/plugins/definition/ElasticsearchIndexPlugin.d.ts +2 -10
- package/plugins/definition/ElasticsearchIndexPlugin.js +4 -23
- package/plugins/definition/ElasticsearchIndexPlugin.js.map +1 -1
- package/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin.d.ts +1 -5
- package/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin.js +2 -17
- package/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin.js.map +1 -1
- package/plugins/definition/ElasticsearchQueryModifierPlugin.d.ts +1 -1
- package/plugins/definition/ElasticsearchQueryModifierPlugin.js +4 -12
- package/plugins/definition/ElasticsearchQueryModifierPlugin.js.map +1 -1
- package/plugins/definition/ElasticsearchSortModifierPlugin.d.ts +1 -1
- package/plugins/definition/ElasticsearchSortModifierPlugin.js +4 -12
- package/plugins/definition/ElasticsearchSortModifierPlugin.js.map +1 -1
- package/plugins/definition/index.d.ts +6 -7
- package/plugins/definition/index.js +6 -82
- package/plugins/definition/index.js.map +1 -1
- package/plugins/index.d.ts +2 -2
- package/plugins/index.js +2 -27
- package/plugins/index.js.map +1 -1
- package/plugins/operator/andIn.d.ts +2 -2
- package/plugins/operator/andIn.js +2 -9
- package/plugins/operator/andIn.js.map +1 -1
- package/plugins/operator/between.d.ts +2 -2
- package/plugins/operator/between.js +2 -9
- package/plugins/operator/between.js.map +1 -1
- package/plugins/operator/contains.d.ts +2 -2
- package/plugins/operator/contains.js +4 -11
- package/plugins/operator/contains.js.map +1 -1
- package/plugins/operator/equal.d.ts +2 -2
- package/plugins/operator/equal.js +3 -10
- package/plugins/operator/equal.js.map +1 -1
- package/plugins/operator/gt.d.ts +2 -2
- package/plugins/operator/gt.js +2 -9
- package/plugins/operator/gt.js.map +1 -1
- package/plugins/operator/gte.d.ts +2 -2
- package/plugins/operator/gte.js +2 -9
- package/plugins/operator/gte.js.map +1 -1
- package/plugins/operator/in.d.ts +2 -2
- package/plugins/operator/in.js +2 -9
- package/plugins/operator/in.js.map +1 -1
- package/plugins/operator/index.d.ts +15 -16
- package/plugins/operator/index.js +15 -181
- package/plugins/operator/index.js.map +1 -1
- package/plugins/operator/lt.d.ts +2 -2
- package/plugins/operator/lt.js +2 -9
- package/plugins/operator/lt.js.map +1 -1
- package/plugins/operator/lte.d.ts +2 -2
- package/plugins/operator/lte.js +2 -9
- package/plugins/operator/lte.js.map +1 -1
- package/plugins/operator/not.d.ts +2 -2
- package/plugins/operator/not.js +3 -10
- package/plugins/operator/not.js.map +1 -1
- package/plugins/operator/notBetween.d.ts +2 -2
- package/plugins/operator/notBetween.js +2 -9
- package/plugins/operator/notBetween.js.map +1 -1
- package/plugins/operator/notContains.d.ts +2 -2
- package/plugins/operator/notContains.js +4 -11
- package/plugins/operator/notContains.js.map +1 -1
- package/plugins/operator/notIn.d.ts +2 -2
- package/plugins/operator/notIn.js +2 -9
- package/plugins/operator/notIn.js.map +1 -1
- package/plugins/operator/notStartsWith.d.ts +2 -2
- package/plugins/operator/notStartsWith.js +2 -9
- package/plugins/operator/notStartsWith.js.map +1 -1
- package/plugins/operator/startsWith.d.ts +2 -2
- package/plugins/operator/startsWith.js +2 -9
- package/plugins/operator/startsWith.js.map +1 -1
- package/sharedIndex.d.ts +1 -0
- package/sharedIndex.js +5 -0
- package/sharedIndex.js.map +1 -0
- package/sort.d.ts +2 -2
- package/sort.js +18 -17
- package/sort.js.map +1 -1
- package/types.d.ts +32 -20
- package/types.js +28 -26
- package/types.js.map +1 -1
- package/utils/createIndex.d.ts +2 -3
- package/utils/createIndex.js +7 -19
- package/utils/createIndex.js.map +1 -1
- package/utils/index.d.ts +3 -3
- package/utils/index.js +3 -27
- package/utils/index.js.map +1 -1
- package/utils/waitUntilHealthy/UnhealthyClusterError.js +2 -9
- package/utils/waitUntilHealthy/UnhealthyClusterError.js.map +1 -1
- package/utils/waitUntilHealthy/WaitUntilHealthy.d.ts +4 -4
- package/utils/waitUntilHealthy/WaitUntilHealthy.js +22 -29
- package/utils/waitUntilHealthy/WaitUntilHealthy.js.map +1 -1
- package/utils/waitUntilHealthy/WaitingHealthyClusterAbortedError.js +2 -9
- package/utils/waitUntilHealthy/WaitingHealthyClusterAbortedError.js.map +1 -1
- package/utils/waitUntilHealthy/index.d.ts +6 -6
- package/utils/waitUntilHealthy/index.js +6 -49
- package/utils/waitUntilHealthy/index.js.map +1 -1
- package/utils/waitUntilHealthy/reason/ClusterHealthReason.d.ts +2 -2
- package/utils/waitUntilHealthy/reason/ClusterHealthReason.js +2 -10
- package/utils/waitUntilHealthy/reason/ClusterHealthReason.js.map +1 -1
- package/utils/waitUntilHealthy/reason/IReason.js +1 -5
- package/utils/waitUntilHealthy/reason/MemoryReason.d.ts +1 -1
- package/utils/waitUntilHealthy/reason/MemoryReason.js +2 -10
- package/utils/waitUntilHealthy/reason/MemoryReason.js.map +1 -1
- package/utils/waitUntilHealthy/reason/ProcessorReason.d.ts +1 -1
- package/utils/waitUntilHealthy/reason/ProcessorReason.js +2 -10
- package/utils/waitUntilHealthy/reason/ProcessorReason.js.map +1 -1
- package/utils/waitUntilHealthy/reason/index.d.ts +3 -3
- package/utils/waitUntilHealthy/reason/index.js +3 -38
- package/utils/waitUntilHealthy/reason/index.js.map +1 -1
- package/where.d.ts +4 -4
- package/where.js +7 -16
- package/where.js.map +1 -1
- package/indexConfiguration/japanese.d.ts +0 -6
- package/indexConfiguration/japanese.js +0 -121
- package/indexConfiguration/japanese.js.map +0 -1
- package/plugins/GzipCompression.d.ts +0 -24
- package/plugins/GzipCompression.js +0 -70
- package/plugins/GzipCompression.js.map +0 -1
- package/plugins/definition/CompressionPlugin.d.ts +0 -20
- package/plugins/definition/CompressionPlugin.js +0 -28
- package/plugins/definition/CompressionPlugin.js.map +0 -1
- package/plugins/operator/japanese/contains.d.ts +0 -8
- package/plugins/operator/japanese/contains.js +0 -44
- package/plugins/operator/japanese/contains.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ElasticsearchQueryBuilderOperatorPlugin } from "
|
|
2
|
-
import { ElasticsearchBoolQueryConfig, ElasticsearchQueryBuilderArgsPlugin } from "../../types";
|
|
1
|
+
import { ElasticsearchQueryBuilderOperatorPlugin } from "../../plugins/definition/ElasticsearchQueryBuilderOperatorPlugin.js";
|
|
2
|
+
import type { ElasticsearchBoolQueryConfig, ElasticsearchQueryBuilderArgsPlugin } from "../../types.js";
|
|
3
3
|
export declare class ElasticsearchQueryBuilderOperatorStartsWithPlugin extends ElasticsearchQueryBuilderOperatorPlugin {
|
|
4
4
|
name: string;
|
|
5
5
|
getOperator(): string;
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ElasticsearchQueryBuilderOperatorStartsWithPlugin = void 0;
|
|
7
|
-
var _ElasticsearchQueryBuilderOperatorPlugin = require("../definition/ElasticsearchQueryBuilderOperatorPlugin");
|
|
8
|
-
class ElasticsearchQueryBuilderOperatorStartsWithPlugin extends _ElasticsearchQueryBuilderOperatorPlugin.ElasticsearchQueryBuilderOperatorPlugin {
|
|
1
|
+
import { ElasticsearchQueryBuilderOperatorPlugin } from "../definition/ElasticsearchQueryBuilderOperatorPlugin.js";
|
|
2
|
+
export class ElasticsearchQueryBuilderOperatorStartsWithPlugin extends ElasticsearchQueryBuilderOperatorPlugin {
|
|
9
3
|
name = "elasticsearch.queryBuilder.operator.startsWith.default";
|
|
10
4
|
getOperator() {
|
|
11
5
|
return "startsWith";
|
|
@@ -25,6 +19,5 @@ class ElasticsearchQueryBuilderOperatorStartsWithPlugin extends _ElasticsearchQu
|
|
|
25
19
|
});
|
|
26
20
|
}
|
|
27
21
|
}
|
|
28
|
-
exports.ElasticsearchQueryBuilderOperatorStartsWithPlugin = ElasticsearchQueryBuilderOperatorStartsWithPlugin;
|
|
29
22
|
|
|
30
23
|
//# sourceMappingURL=startsWith.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["ElasticsearchQueryBuilderOperatorPlugin","ElasticsearchQueryBuilderOperatorStartsWithPlugin","name","getOperator","apply","query","params","value","basePath","undefined","filter","push","match_phrase_prefix"],"sources":["startsWith.ts"],"sourcesContent":["import { ElasticsearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin.js\";\nimport type { ElasticsearchBoolQueryConfig, ElasticsearchQueryBuilderArgsPlugin } from \"~/types.js\";\n\nexport class ElasticsearchQueryBuilderOperatorStartsWithPlugin extends ElasticsearchQueryBuilderOperatorPlugin {\n public override name = \"elasticsearch.queryBuilder.operator.startsWith.default\";\n\n public getOperator(): string {\n return \"startsWith\";\n }\n\n public apply(\n query: ElasticsearchBoolQueryConfig,\n params: ElasticsearchQueryBuilderArgsPlugin\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"],"mappings":"AAAA,SAASA,uCAAuC;AAGhD,OAAO,MAAMC,iDAAiD,SAASD,uCAAuC,CAAC;EAC3FE,IAAI,GAAG,wDAAwD;EAExEC,WAAWA,CAAA,EAAW;IACzB,OAAO,YAAY;EACvB;EAEOC,KAAKA,CACRC,KAAmC,EACnCC,MAA2C,EACvC;IACJ,MAAM;MAAEC,KAAK;MAAEC;IAAS,CAAC,GAAGF,MAAM;IAClC,IAAIC,KAAK,KAAK,EAAE,IAAIA,KAAK,KAAK,IAAI,IAAIA,KAAK,KAAKE,SAAS,EAAE;MACvD;IACJ;IACAJ,KAAK,CAACK,MAAM,CAACC,IAAI,CAAC;MACdC,mBAAmB,EAAE;QACjB,CAACJ,QAAQ,GAAGD;MAChB;IACJ,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
|
package/sharedIndex.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isSharedElasticsearchIndex: () => boolean;
|
package/sharedIndex.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["isSharedElasticsearchIndex","process","env","OPENSEARCH_SHARED_INDEXES"],"sources":["sharedIndex.ts"],"sourcesContent":["export const isSharedElasticsearchIndex = () => {\n return process.env.OPENSEARCH_SHARED_INDEXES === \"true\";\n};\n"],"mappings":"AAAA,OAAO,MAAMA,0BAA0B,GAAGA,CAAA,KAAM;EAC5C,OAAOC,OAAO,CAACC,GAAG,CAACC,yBAAyB,KAAK,MAAM;AAC3D,CAAC","ignoreList":[]}
|
package/sort.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ElasticsearchFieldPlugin } from "./plugins";
|
|
1
|
+
import type { SortOrder, SortType } from "./types.js";
|
|
2
|
+
import { ElasticsearchFieldPlugin } from "./plugins/index.js";
|
|
3
3
|
interface CreateSortParams {
|
|
4
4
|
sort: string[];
|
|
5
5
|
defaults?: {
|
package/sort.js
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.createSort = void 0;
|
|
8
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
|
-
var _plugins = require("./plugins");
|
|
10
|
-
const sortRegExp = new RegExp(/^([a-zA-Z-0-9_@]+)_(ASC|DESC)$/);
|
|
11
|
-
const createSort = params => {
|
|
1
|
+
import WebinyError from "@webiny/error";
|
|
2
|
+
import { ElasticsearchFieldPlugin } from "./plugins/index.js";
|
|
3
|
+
const sortRegExp = /^((?:values\.)?[a-zA-Z0-9_@-]+)_(ASC|DESC)$/;
|
|
4
|
+
export const createSort = params => {
|
|
12
5
|
const {
|
|
13
6
|
sort,
|
|
14
7
|
defaults,
|
|
@@ -33,19 +26,19 @@ const createSort = params => {
|
|
|
33
26
|
/**
|
|
34
27
|
* Cast as string because nothing else should be allowed yet.
|
|
35
28
|
*/
|
|
36
|
-
|
|
29
|
+
const result = sort.reduce((acc, value) => {
|
|
37
30
|
if (typeof value !== "string") {
|
|
38
|
-
throw new
|
|
31
|
+
throw new WebinyError(`Sort as object is not supported..`);
|
|
39
32
|
}
|
|
40
33
|
const match = value.match(sortRegExp);
|
|
41
34
|
if (!match) {
|
|
42
|
-
throw new
|
|
35
|
+
throw new WebinyError(`Cannot sort by "${value}".`);
|
|
43
36
|
}
|
|
44
37
|
const [, field, initialOrder] = match;
|
|
45
38
|
const order = initialOrder.toLowerCase() === "asc" ? "asc" : "desc";
|
|
46
|
-
const plugin = fieldPlugins[field] || fieldPlugins[
|
|
39
|
+
const plugin = fieldPlugins[field] || fieldPlugins[ElasticsearchFieldPlugin.ALL];
|
|
47
40
|
if (!plugin) {
|
|
48
|
-
throw new
|
|
41
|
+
throw new WebinyError(`Missing plugin for the field "${field}"`, "PLUGIN_SORT_ERROR", {
|
|
49
42
|
field
|
|
50
43
|
});
|
|
51
44
|
}
|
|
@@ -57,7 +50,15 @@ const createSort = params => {
|
|
|
57
50
|
acc[path] = plugin.getSortOptions(order);
|
|
58
51
|
return acc;
|
|
59
52
|
}, {});
|
|
53
|
+
/**
|
|
54
|
+
* If we do not have id in the sort, we add it as we need a tie_breaker for the Elasticsearch to be able to sort consistently.
|
|
55
|
+
*/
|
|
56
|
+
if (!result["id.keyword"] && !result["id"]) {
|
|
57
|
+
result["id.keyword"] = {
|
|
58
|
+
order: "asc"
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
return result;
|
|
60
62
|
};
|
|
61
|
-
exports.createSort = createSort;
|
|
62
63
|
|
|
63
64
|
//# sourceMappingURL=sort.js.map
|
package/sort.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["WebinyError","ElasticsearchFieldPlugin","sortRegExp","createSort","params","sort","defaults","fieldPlugins","length","field","order","unmappedType","unmapped_type","undefined","result","reduce","acc","value","match","initialOrder","toLowerCase","plugin","ALL","path","getPath","getSortOptions"],"sources":["sort.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { FieldSortOptions, SortOrder, SortType } from \"~/types.js\";\nimport { ElasticsearchFieldPlugin } from \"~/plugins/index.js\";\n\nconst sortRegExp = /^((?:values\\.)?[a-zA-Z0-9_@-]+)_(ASC|DESC)$/;\n\ninterface CreateSortParams {\n sort: string[];\n defaults?: {\n field?: string;\n order?: SortOrder;\n unmappedType?: string;\n };\n fieldPlugins: Record<string, ElasticsearchFieldPlugin>;\n}\n\nexport const createSort = (params: CreateSortParams): SortType => {\n const { sort, defaults, fieldPlugins } = params;\n if (!sort || sort.length === 0) {\n const { field, order, unmappedType } = defaults || {};\n /**\n * We say that our system defaults is always id since all records we create have some kind of primary ID.\n */\n return {\n [field || \"id.keyword\"]: {\n order: order || \"desc\",\n unmapped_type: unmappedType || undefined\n }\n };\n }\n /**\n * Cast as string because nothing else should be allowed yet.\n */\n const result = sort.reduce(\n (acc, value) => {\n if (typeof value !== \"string\") {\n throw new WebinyError(`Sort as object is not supported..`);\n }\n const match = value.match(sortRegExp);\n\n if (!match) {\n throw new WebinyError(`Cannot sort by \"${value}\".`);\n }\n\n const [, field, initialOrder] = match;\n const order: SortOrder = initialOrder.toLowerCase() === \"asc\" ? \"asc\" : \"desc\";\n\n const plugin: ElasticsearchFieldPlugin =\n fieldPlugins[field] || fieldPlugins[ElasticsearchFieldPlugin.ALL];\n if (!plugin) {\n throw new WebinyError(\n `Missing plugin for the field \"${field}\"`,\n \"PLUGIN_SORT_ERROR\",\n {\n field\n }\n );\n }\n /**\n * In case field plugin is the global one, change the * with actual field name.\n * Custom path methods will return their own values anyway so replacing * will not matter.\n */\n const path = plugin.getPath(field);\n\n acc[path] = plugin.getSortOptions(order);\n\n return acc;\n },\n {} as Record<string, FieldSortOptions>\n );\n /**\n * If we do not have id in the sort, we add it as we need a tie_breaker for the Elasticsearch to be able to sort consistently.\n */\n if (!result[\"id.keyword\"] && !result[\"id\"]) {\n result[\"id.keyword\"] = {\n order: \"asc\"\n };\n }\n return result;\n};\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AAEvC,SAASC,wBAAwB;AAEjC,MAAMC,UAAU,GAAG,6CAA6C;AAYhE,OAAO,MAAMC,UAAU,GAAIC,MAAwB,IAAe;EAC9D,MAAM;IAAEC,IAAI;IAAEC,QAAQ;IAAEC;EAAa,CAAC,GAAGH,MAAM;EAC/C,IAAI,CAACC,IAAI,IAAIA,IAAI,CAACG,MAAM,KAAK,CAAC,EAAE;IAC5B,MAAM;MAAEC,KAAK;MAAEC,KAAK;MAAEC;IAAa,CAAC,GAAGL,QAAQ,IAAI,CAAC,CAAC;IACrD;AACR;AACA;IACQ,OAAO;MACH,CAACG,KAAK,IAAI,YAAY,GAAG;QACrBC,KAAK,EAAEA,KAAK,IAAI,MAAM;QACtBE,aAAa,EAAED,YAAY,IAAIE;MACnC;IACJ,CAAC;EACL;EACA;AACJ;AACA;EACI,MAAMC,MAAM,GAAGT,IAAI,CAACU,MAAM,CACtB,CAACC,GAAG,EAAEC,KAAK,KAAK;IACZ,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;MAC3B,MAAM,IAAIjB,WAAW,CAAC,mCAAmC,CAAC;IAC9D;IACA,MAAMkB,KAAK,GAAGD,KAAK,CAACC,KAAK,CAAChB,UAAU,CAAC;IAErC,IAAI,CAACgB,KAAK,EAAE;MACR,MAAM,IAAIlB,WAAW,CAAC,mBAAmBiB,KAAK,IAAI,CAAC;IACvD;IAEA,MAAM,GAAGR,KAAK,EAAEU,YAAY,CAAC,GAAGD,KAAK;IACrC,MAAMR,KAAgB,GAAGS,YAAY,CAACC,WAAW,CAAC,CAAC,KAAK,KAAK,GAAG,KAAK,GAAG,MAAM;IAE9E,MAAMC,MAAgC,GAClCd,YAAY,CAACE,KAAK,CAAC,IAAIF,YAAY,CAACN,wBAAwB,CAACqB,GAAG,CAAC;IACrE,IAAI,CAACD,MAAM,EAAE;MACT,MAAM,IAAIrB,WAAW,CACjB,iCAAiCS,KAAK,GAAG,EACzC,mBAAmB,EACnB;QACIA;MACJ,CACJ,CAAC;IACL;IACA;AACZ;AACA;AACA;IACY,MAAMc,IAAI,GAAGF,MAAM,CAACG,OAAO,CAACf,KAAK,CAAC;IAElCO,GAAG,CAACO,IAAI,CAAC,GAAGF,MAAM,CAACI,cAAc,CAACf,KAAK,CAAC;IAExC,OAAOM,GAAG;EACd,CAAC,EACD,CAAC,CACL,CAAC;EACD;AACJ;AACA;EACI,IAAI,CAACF,MAAM,CAAC,YAAY,CAAC,IAAI,CAACA,MAAM,CAAC,IAAI,CAAC,EAAE;IACxCA,MAAM,CAAC,YAAY,CAAC,GAAG;MACnBJ,KAAK,EAAE;IACX,CAAC;EACL;EACA,OAAOI,MAAM;AACjB,CAAC","ignoreList":[]}
|
package/types.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { Client
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { Client } from "@elastic/elasticsearch";
|
|
2
|
+
import { type ApiResponse } from "@elastic/elasticsearch";
|
|
3
|
+
import type { BoolQueryConfig, PrimitiveValue, Query as esQuery } from "elastic-ts";
|
|
4
|
+
import type { Context, GenericRecord } from "@webiny/api/types.js";
|
|
4
5
|
/**
|
|
5
6
|
* Re-export some dep lib types.
|
|
6
7
|
*/
|
|
7
8
|
export * from "elastic-ts";
|
|
8
|
-
export { ApiResponse };
|
|
9
|
+
export type { ApiResponse };
|
|
9
10
|
export interface ElasticsearchContext extends Context {
|
|
10
11
|
elasticsearch: Client;
|
|
11
12
|
}
|
|
@@ -13,7 +14,7 @@ export interface ElasticsearchContext extends Context {
|
|
|
13
14
|
* To simplify our plugins, we say that query contains arrays of objects, not single objects.
|
|
14
15
|
* And that they all are defined as empty arrays at the start.
|
|
15
16
|
*/
|
|
16
|
-
export interface ElasticsearchBoolQueryConfig extends
|
|
17
|
+
export interface ElasticsearchBoolQueryConfig extends BoolQueryConfig {
|
|
17
18
|
must: esQuery[];
|
|
18
19
|
filter: esQuery[];
|
|
19
20
|
should: esQuery[];
|
|
@@ -24,7 +25,7 @@ export interface ElasticsearchBoolQueryConfig extends esBoolQueryConfig {
|
|
|
24
25
|
*
|
|
25
26
|
* @category Elasticsearch
|
|
26
27
|
*/
|
|
27
|
-
export
|
|
28
|
+
export type ElasticsearchQueryOperator = "eq" | "not" | "in" | "not_in" | "contains" | "not_contains" | "between" | "not_between" | "gt" | "gte" | "lt" | "lte" | string;
|
|
28
29
|
/**
|
|
29
30
|
* Definition for arguments of the ElasticsearchQueryBuilderOperatorPlugin.apply method.
|
|
30
31
|
*
|
|
@@ -59,28 +60,35 @@ export interface ElasticsearchQueryBuilderArgsPlugin {
|
|
|
59
60
|
* Elasticsearch responses.
|
|
60
61
|
*/
|
|
61
62
|
export interface ElasticsearchSearchResponseHit<T> {
|
|
63
|
+
_index: string;
|
|
64
|
+
_type: string;
|
|
65
|
+
_id: string;
|
|
66
|
+
_score: number | null;
|
|
62
67
|
_source: T;
|
|
63
|
-
sort:
|
|
68
|
+
sort: PrimitiveValue[];
|
|
64
69
|
}
|
|
65
70
|
export interface ElasticsearchSearchResponseAggregationBucket<T> {
|
|
66
71
|
key: T;
|
|
67
72
|
doc_count: number;
|
|
68
73
|
}
|
|
69
|
-
export interface
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
total: {
|
|
74
|
-
value: number;
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
aggregations: {
|
|
78
|
-
[key: string]: {
|
|
79
|
-
buckets: ElasticsearchSearchResponseAggregationBucket<T>[];
|
|
80
|
-
};
|
|
81
|
-
};
|
|
74
|
+
export interface ElasticsearchSearchResponseBodyHits<T> {
|
|
75
|
+
hits: ElasticsearchSearchResponseHit<T>[];
|
|
76
|
+
total: {
|
|
77
|
+
value: number;
|
|
82
78
|
};
|
|
83
79
|
}
|
|
80
|
+
export interface ElasticsearchSearchResponseBodyAggregations<T> {
|
|
81
|
+
[key: string]: {
|
|
82
|
+
buckets: ElasticsearchSearchResponseAggregationBucket<T>[];
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
export interface ElasticsearchSearchResponseBody<T> {
|
|
86
|
+
hits: ElasticsearchSearchResponseBodyHits<T>;
|
|
87
|
+
aggregations: ElasticsearchSearchResponseBodyAggregations<T>;
|
|
88
|
+
}
|
|
89
|
+
export interface ElasticsearchSearchResponse<T = GenericRecord> {
|
|
90
|
+
body: ElasticsearchSearchResponseBody<T>;
|
|
91
|
+
}
|
|
84
92
|
export interface ElasticsearchIndexRequestBodyMappingsDynamicTemplate {
|
|
85
93
|
[key: string]: {
|
|
86
94
|
path_match?: string;
|
|
@@ -108,6 +116,9 @@ export interface ElasticsearchIndexRequestBodyMappingsDynamicTemplate {
|
|
|
108
116
|
[key: string]: any;
|
|
109
117
|
};
|
|
110
118
|
}
|
|
119
|
+
export interface ElasticsearchIndexRequestBodySettingsTotalFields {
|
|
120
|
+
limit?: number;
|
|
121
|
+
}
|
|
111
122
|
interface ElasticsearchIndexRequestBodySettings {
|
|
112
123
|
analysis?: {
|
|
113
124
|
[key: string]: any;
|
|
@@ -165,6 +176,7 @@ interface ElasticsearchIndexRequestBodySettings {
|
|
|
165
176
|
default_pipeline?: string;
|
|
166
177
|
final_pipeline?: string;
|
|
167
178
|
hidden?: boolean;
|
|
179
|
+
total_fields?: ElasticsearchIndexRequestBodySettingsTotalFields;
|
|
168
180
|
[key: string]: any;
|
|
169
181
|
}
|
|
170
182
|
export interface ElasticsearchIndexRequestBody {
|
package/types.js
CHANGED
|
@@ -1,29 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Re-export some dep lib types.
|
|
3
|
+
*/
|
|
4
|
+
export * from "elastic-ts";
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
});
|
|
6
|
+
/**
|
|
7
|
+
* To simplify our plugins, we say that query contains arrays of objects, not single objects.
|
|
8
|
+
* And that they all are defined as empty arrays at the start.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Definitions of possible Elasticsearch operators.
|
|
13
|
+
*
|
|
14
|
+
* @category Elasticsearch
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Definition for arguments of the ElasticsearchQueryBuilderOperatorPlugin.apply method.
|
|
19
|
+
*
|
|
20
|
+
* @see ElasticsearchQueryBuilderOperatorPlugin.apply
|
|
21
|
+
*
|
|
22
|
+
* @category Plugin
|
|
23
|
+
* @category Elasticsearch
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Elasticsearch responses.
|
|
28
|
+
*/
|
|
29
|
+
export {};
|
|
28
30
|
|
|
29
31
|
//# sourceMappingURL=types.js.map
|
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { Client } from \"@elastic/elasticsearch\";\nimport { type ApiResponse } from \"@elastic/elasticsearch\";\nimport type { BoolQueryConfig, PrimitiveValue, Query as esQuery } from \"elastic-ts\";\nimport type { Context, GenericRecord } from \"@webiny/api/types.js\";\n/**\n * Re-export some dep lib types.\n */\nexport * from \"elastic-ts\";\nexport type { ApiResponse };\n\nexport interface ElasticsearchContext extends Context {\n elasticsearch: Client;\n}\n\n/**\n * To simplify our plugins, we say that query contains arrays of objects, not single objects.\n * And that they all are defined as empty arrays at the start.\n */\nexport interface ElasticsearchBoolQueryConfig extends BoolQueryConfig {\n must: esQuery[];\n filter: esQuery[];\n should: esQuery[];\n must_not: esQuery[];\n}\n\n/**\n * Definitions of possible Elasticsearch operators.\n *\n * @category Elasticsearch\n */\nexport type ElasticsearchQueryOperator =\n | \"eq\"\n | \"not\"\n | \"in\"\n | \"not_in\"\n | \"contains\"\n | \"not_contains\"\n | \"between\"\n | \"not_between\"\n | \"gt\"\n | \"gte\"\n | \"lt\"\n | \"lte\"\n | string;\n\n/**\n * Definition for arguments of the ElasticsearchQueryBuilderOperatorPlugin.apply method.\n *\n * @see ElasticsearchQueryBuilderOperatorPlugin.apply\n *\n * @category Plugin\n * @category Elasticsearch\n */\nexport interface ElasticsearchQueryBuilderArgsPlugin {\n /**\n * Name of the field.\n */\n name: string;\n /**\n * A full path to the field. Including the \".keyword\" if it is added.\n */\n path: string;\n /**\n * A path to the field, plain.\n */\n basePath: string;\n /**\n * Value to apply.\n */\n value: any;\n /**\n * Is path containing the \".keyword\"\n */\n keyword: boolean;\n}\n\n/**\n * Elasticsearch responses.\n */\nexport interface ElasticsearchSearchResponseHit<T> {\n _index: string;\n _type: string;\n _id: string;\n _score: number | null;\n _source: T;\n sort: PrimitiveValue[];\n}\nexport interface ElasticsearchSearchResponseAggregationBucket<T> {\n key: T;\n doc_count: number;\n}\n\nexport interface ElasticsearchSearchResponseBodyHits<T> {\n hits: ElasticsearchSearchResponseHit<T>[];\n total: {\n value: number;\n };\n}\n\nexport interface ElasticsearchSearchResponseBodyAggregations<T> {\n [key: string]: {\n buckets: ElasticsearchSearchResponseAggregationBucket<T>[];\n };\n}\n\nexport interface ElasticsearchSearchResponseBody<T> {\n hits: ElasticsearchSearchResponseBodyHits<T>;\n aggregations: ElasticsearchSearchResponseBodyAggregations<T>;\n}\n\nexport interface ElasticsearchSearchResponse<T = GenericRecord> {\n body: ElasticsearchSearchResponseBody<T>;\n}\n\nexport interface ElasticsearchIndexRequestBodyMappingsDynamicTemplate {\n [key: string]: {\n path_match?: string;\n path_unmatch?: string;\n match_mapping_type?: string;\n match?: string;\n unmatch?: string;\n mapping?: {\n numeric_detection?: boolean;\n date_detection?: boolean;\n type?:\n | \"string\"\n | \"date\"\n | \"binary\"\n | \"boolean\"\n | \"object\"\n | \"ip\"\n | \"geo\"\n | \"long\"\n | \"integer\"\n | \"short\"\n | \"byte\"\n | \"double\"\n | \"float\"\n | \"half_float\"\n | \"scaled_float\"\n | \"unsigned_long\"\n | string;\n search_analyzer?: string;\n analyzer?: string;\n fields?: {\n [key: string]:\n | {\n type: string;\n search_analyzer?: string;\n analyzer?: string;\n ignore_above?: number;\n [key: string]: any;\n }\n | undefined;\n };\n [key: string]: any;\n };\n [key: string]: any;\n };\n}\n\nexport interface ElasticsearchIndexRequestBodySettingsTotalFields {\n limit?: number;\n}\n\ninterface ElasticsearchIndexRequestBodySettings {\n analysis?: {\n [key: string]: any;\n };\n number_of_shards?: number;\n number_of_routing_shards?: number;\n codec?: string;\n routing_partition_size?: number;\n soft_deletes?: {\n enabled?: boolean;\n retention_lease?: {\n period?: string;\n };\n };\n load_fixed_bitset_filters_eagerly?: boolean;\n shard?: {\n check_on_startup?: boolean | \"checksum\";\n };\n number_of_replicas?: number;\n auto_expand_replicas?: string | \"all\" | false;\n search?: {\n idle?: {\n after?: string;\n };\n };\n refresh_interval?: string;\n max_result_window?: number;\n max_inner_result_window?: number;\n max_rescore_window?: number;\n max_docvalue_fields_search?: number;\n max_script_fields?: number;\n max_ngram_diff?: number;\n max_shingle_diff?: number;\n max_refresh_listeners?: number;\n analyze?: {\n max_token_count?: number;\n };\n highlight?: {\n max_analyzed_offset?: number;\n };\n max_terms_count?: number;\n max_regex_length?: number;\n query?: {\n default_field?: string;\n };\n routing?: {\n allocation?: {\n enable?: \"all\" | \"primaries\" | \"new_primaries\" | \"none\";\n };\n rebalance?: {\n enable?: \"all\" | \"primaries\" | \"new_primaries\" | \"none\";\n };\n };\n gc_deletes?: string;\n default_pipeline?: string;\n final_pipeline?: string;\n hidden?: boolean;\n total_fields?: ElasticsearchIndexRequestBodySettingsTotalFields;\n [key: string]: any;\n}\n\nexport interface ElasticsearchIndexRequestBody {\n settings?: {\n index?: Partial<ElasticsearchIndexRequestBodySettings>;\n };\n mappings: {\n numeric_detection?: boolean;\n dynamic_templates?: ElasticsearchIndexRequestBodyMappingsDynamicTemplate[];\n properties?: {\n [key: string]: {\n analyzer?: string;\n type?: string;\n normalizer?: string;\n index?: string;\n fields?: {\n [key: string]: {\n type: string;\n ignore_above?: number;\n search_analyzer?: string;\n analyzer?: string;\n [key: string]: any;\n };\n };\n [key: string]: any;\n };\n };\n [key: string]: any;\n };\n aliases?: {\n [key: string]: {\n filter?: {\n [key: string]: any;\n };\n index_routing?: string;\n is_hidden?: boolean;\n is_write_index?: boolean;\n routing?: string;\n search_routing?: string;\n };\n };\n}\n"],"mappings":"AAIA;AACA;AACA;AACA,cAAc,YAAY;;AAO1B;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAwBA;AACA;AACA;AAFA","ignoreList":[]}
|
package/utils/createIndex.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Client } from "@elastic/elasticsearch";
|
|
2
|
-
import { PluginsContainer } from "@webiny/plugins";
|
|
1
|
+
import type { Client } from "@elastic/elasticsearch";
|
|
2
|
+
import type { PluginsContainer } from "@webiny/plugins";
|
|
3
3
|
interface OnExists {
|
|
4
4
|
(): void;
|
|
5
5
|
}
|
|
@@ -11,7 +11,6 @@ interface CreateIndexParams {
|
|
|
11
11
|
plugins: PluginsContainer;
|
|
12
12
|
type: string;
|
|
13
13
|
tenant: string;
|
|
14
|
-
locale: string;
|
|
15
14
|
index: string;
|
|
16
15
|
onExists?: OnExists;
|
|
17
16
|
onError?: OnError;
|
package/utils/createIndex.js
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.createIndex = void 0;
|
|
8
|
-
var _indices = require("../indices");
|
|
9
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
1
|
+
import { getLastAddedIndexPlugin } from "../indices.js";
|
|
2
|
+
import WebinyError from "@webiny/error";
|
|
10
3
|
const indexExists = async params => {
|
|
11
4
|
const {
|
|
12
5
|
client,
|
|
@@ -29,7 +22,7 @@ const indexExists = async params => {
|
|
|
29
22
|
onExists();
|
|
30
23
|
}
|
|
31
24
|
return true;
|
|
32
|
-
} catch
|
|
25
|
+
} catch {
|
|
33
26
|
console.error(`Could not determine if the index "${index}" exists.`);
|
|
34
27
|
}
|
|
35
28
|
return false;
|
|
@@ -40,7 +33,6 @@ const indexCreate = async params => {
|
|
|
40
33
|
index,
|
|
41
34
|
plugin,
|
|
42
35
|
tenant,
|
|
43
|
-
locale,
|
|
44
36
|
type,
|
|
45
37
|
onError
|
|
46
38
|
} = params;
|
|
@@ -56,7 +48,7 @@ const indexCreate = async params => {
|
|
|
56
48
|
if (onError) {
|
|
57
49
|
error = onError(ex);
|
|
58
50
|
}
|
|
59
|
-
throw new
|
|
51
|
+
throw new WebinyError(error.message || `Could not create Elasticsearch index for the ${type}.`, error.code || "CREATE_OPENSEARCH_INDEX_ERROR", {
|
|
60
52
|
error: {
|
|
61
53
|
...error,
|
|
62
54
|
message: error.message,
|
|
@@ -64,24 +56,21 @@ const indexCreate = async params => {
|
|
|
64
56
|
data: error.data
|
|
65
57
|
},
|
|
66
58
|
type,
|
|
67
|
-
locale,
|
|
68
59
|
tenant,
|
|
69
60
|
index,
|
|
70
61
|
body: plugin.body
|
|
71
62
|
});
|
|
72
63
|
}
|
|
73
64
|
};
|
|
74
|
-
const createIndex = async params => {
|
|
65
|
+
export const createIndex = async params => {
|
|
75
66
|
const {
|
|
76
67
|
plugins,
|
|
77
68
|
type,
|
|
78
|
-
locale,
|
|
79
69
|
onExists
|
|
80
70
|
} = params;
|
|
81
|
-
const plugin =
|
|
71
|
+
const plugin = getLastAddedIndexPlugin({
|
|
82
72
|
container: plugins,
|
|
83
|
-
type
|
|
84
|
-
locale
|
|
73
|
+
type
|
|
85
74
|
});
|
|
86
75
|
const exists = await indexExists(params);
|
|
87
76
|
if (exists) {
|
|
@@ -95,6 +84,5 @@ const createIndex = async params => {
|
|
|
95
84
|
plugin
|
|
96
85
|
});
|
|
97
86
|
};
|
|
98
|
-
exports.createIndex = createIndex;
|
|
99
87
|
|
|
100
88
|
//# sourceMappingURL=createIndex.js.map
|
package/utils/createIndex.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["getLastAddedIndexPlugin","WebinyError","indexExists","params","client","index","onExists","response","indices","exists","ignore_unavailable","allow_no_indices","include_defaults","flat_settings","local","body","console","error","indexCreate","plugin","tenant","type","onError","create","ex","message","code","data","createIndex","plugins","container"],"sources":["createIndex.ts"],"sourcesContent":["import type { Client } from \"@elastic/elasticsearch\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport { getLastAddedIndexPlugin } from \"~/indices.js\";\nimport type { ElasticsearchIndexPlugin } from \"~/plugins/index.js\";\nimport WebinyError from \"@webiny/error\";\n\ninterface OnExists {\n (): void;\n}\n\ninterface OnError {\n (ex: Error): Error;\n}\n\ninterface ExistsIndexParams {\n client: Client;\n index: string;\n onExists?: OnExists;\n}\n\nconst indexExists = async (params: ExistsIndexParams): Promise<boolean> => {\n const { client, index, onExists } = params;\n\n try {\n const response = await client.indices.exists({\n index,\n ignore_unavailable: false,\n allow_no_indices: true,\n include_defaults: true,\n flat_settings: false,\n local: false\n });\n if (!response.body) {\n return false;\n }\n if (onExists) {\n onExists();\n }\n return true;\n } catch {\n console.error(`Could not determine if the index \"${index}\" exists.`);\n }\n return false;\n};\n\ninterface IndexCreateParams {\n client: Client;\n index: string;\n type: string;\n tenant: string;\n plugin: ElasticsearchIndexPlugin;\n onError?: OnError;\n}\n\nconst indexCreate = async (params: IndexCreateParams): Promise<void> => {\n const { client, index, plugin, tenant, type, onError } = params;\n\n try {\n await client.indices.create({\n index,\n body: {\n ...plugin.body\n }\n });\n } catch (ex) {\n let error = ex;\n if (onError) {\n error = onError(ex);\n }\n throw new WebinyError(\n error.message || `Could not create Elasticsearch index for the ${type}.`,\n error.code || \"CREATE_OPENSEARCH_INDEX_ERROR\",\n {\n error: {\n ...error,\n message: error.message,\n code: error.code,\n data: error.data\n },\n type,\n tenant,\n index,\n body: plugin.body\n }\n );\n }\n};\n\ninterface CreateIndexParams {\n client: Client;\n plugins: PluginsContainer;\n type: string;\n tenant: string;\n index: string;\n onExists?: OnExists;\n onError?: OnError;\n}\n\nexport const createIndex = async (params: CreateIndexParams): Promise<void> => {\n const { plugins, type, onExists } = params;\n const plugin = getLastAddedIndexPlugin<ElasticsearchIndexPlugin>({\n container: plugins,\n type\n });\n\n const exists = await indexExists(params);\n if (exists) {\n if (onExists) {\n onExists();\n }\n return;\n }\n\n await indexCreate({\n ...params,\n plugin\n });\n};\n"],"mappings":"AAEA,SAASA,uBAAuB;AAEhC,OAAOC,WAAW,MAAM,eAAe;AAgBvC,MAAMC,WAAW,GAAG,MAAOC,MAAyB,IAAuB;EACvE,MAAM;IAAEC,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAC,GAAGH,MAAM;EAE1C,IAAI;IACA,MAAMI,QAAQ,GAAG,MAAMH,MAAM,CAACI,OAAO,CAACC,MAAM,CAAC;MACzCJ,KAAK;MACLK,kBAAkB,EAAE,KAAK;MACzBC,gBAAgB,EAAE,IAAI;MACtBC,gBAAgB,EAAE,IAAI;MACtBC,aAAa,EAAE,KAAK;MACpBC,KAAK,EAAE;IACX,CAAC,CAAC;IACF,IAAI,CAACP,QAAQ,CAACQ,IAAI,EAAE;MAChB,OAAO,KAAK;IAChB;IACA,IAAIT,QAAQ,EAAE;MACVA,QAAQ,CAAC,CAAC;IACd;IACA,OAAO,IAAI;EACf,CAAC,CAAC,MAAM;IACJU,OAAO,CAACC,KAAK,CAAC,qCAAqCZ,KAAK,WAAW,CAAC;EACxE;EACA,OAAO,KAAK;AAChB,CAAC;AAWD,MAAMa,WAAW,GAAG,MAAOf,MAAyB,IAAoB;EACpE,MAAM;IAAEC,MAAM;IAAEC,KAAK;IAAEc,MAAM;IAAEC,MAAM;IAAEC,IAAI;IAAEC;EAAQ,CAAC,GAAGnB,MAAM;EAE/D,IAAI;IACA,MAAMC,MAAM,CAACI,OAAO,CAACe,MAAM,CAAC;MACxBlB,KAAK;MACLU,IAAI,EAAE;QACF,GAAGI,MAAM,CAACJ;MACd;IACJ,CAAC,CAAC;EACN,CAAC,CAAC,OAAOS,EAAE,EAAE;IACT,IAAIP,KAAK,GAAGO,EAAE;IACd,IAAIF,OAAO,EAAE;MACTL,KAAK,GAAGK,OAAO,CAACE,EAAE,CAAC;IACvB;IACA,MAAM,IAAIvB,WAAW,CACjBgB,KAAK,CAACQ,OAAO,IAAI,gDAAgDJ,IAAI,GAAG,EACxEJ,KAAK,CAACS,IAAI,IAAI,+BAA+B,EAC7C;MACIT,KAAK,EAAE;QACH,GAAGA,KAAK;QACRQ,OAAO,EAAER,KAAK,CAACQ,OAAO;QACtBC,IAAI,EAAET,KAAK,CAACS,IAAI;QAChBC,IAAI,EAAEV,KAAK,CAACU;MAChB,CAAC;MACDN,IAAI;MACJD,MAAM;MACNf,KAAK;MACLU,IAAI,EAAEI,MAAM,CAACJ;IACjB,CACJ,CAAC;EACL;AACJ,CAAC;AAYD,OAAO,MAAMa,WAAW,GAAG,MAAOzB,MAAyB,IAAoB;EAC3E,MAAM;IAAE0B,OAAO;IAAER,IAAI;IAAEf;EAAS,CAAC,GAAGH,MAAM;EAC1C,MAAMgB,MAAM,GAAGnB,uBAAuB,CAA2B;IAC7D8B,SAAS,EAAED,OAAO;IAClBR;EACJ,CAAC,CAAC;EAEF,MAAMZ,MAAM,GAAG,MAAMP,WAAW,CAACC,MAAM,CAAC;EACxC,IAAIM,MAAM,EAAE;IACR,IAAIH,QAAQ,EAAE;MACVA,QAAQ,CAAC,CAAC;IACd;IACA;EACJ;EAEA,MAAMY,WAAW,CAAC;IACd,GAAGf,MAAM;IACTgB;EACJ,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|
package/utils/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./waitUntilHealthy";
|
|
2
|
-
export * from "./createIndex";
|
|
3
|
-
export * from "./waitUntilHealthy";
|
|
1
|
+
export * from "./waitUntilHealthy/index.js";
|
|
2
|
+
export * from "./createIndex.js";
|
|
3
|
+
export * from "./waitUntilHealthy/index.js";
|
package/utils/index.js
CHANGED
|
@@ -1,29 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _waitUntilHealthy = require("./waitUntilHealthy");
|
|
7
|
-
Object.keys(_waitUntilHealthy).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _waitUntilHealthy[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _waitUntilHealthy[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _createIndex = require("./createIndex");
|
|
18
|
-
Object.keys(_createIndex).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _createIndex[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _createIndex[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
1
|
+
export * from "./waitUntilHealthy/index.js";
|
|
2
|
+
export * from "./createIndex.js";
|
|
3
|
+
export * from "./waitUntilHealthy/index.js";
|
|
28
4
|
|
|
29
5
|
//# sourceMappingURL=index.js.map
|
package/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./waitUntilHealthy/index.js\";\nexport * from \"./createIndex.js\";\nexport * from \"./waitUntilHealthy/index.js\";\n"],"mappings":"AAAA;AACA;AACA","ignoreList":[]}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.UnhealthyClusterError = void 0;
|
|
7
|
-
var _error = require("@webiny/error");
|
|
8
|
-
class UnhealthyClusterError extends _error.WebinyError {
|
|
1
|
+
import { WebinyError } from "@webiny/error";
|
|
2
|
+
export class UnhealthyClusterError extends WebinyError {
|
|
9
3
|
constructor(maxWaitingTime) {
|
|
10
4
|
super({
|
|
11
5
|
message: `Cluster did not become healthy in ${maxWaitingTime} seconds.`,
|
|
@@ -13,6 +7,5 @@ class UnhealthyClusterError extends _error.WebinyError {
|
|
|
13
7
|
});
|
|
14
8
|
}
|
|
15
9
|
}
|
|
16
|
-
exports.UnhealthyClusterError = UnhealthyClusterError;
|
|
17
10
|
|
|
18
11
|
//# sourceMappingURL=UnhealthyClusterError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["WebinyError","UnhealthyClusterError","constructor","maxWaitingTime","message","code"],"sources":["UnhealthyClusterError.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\n\nexport class UnhealthyClusterError extends WebinyError {\n public constructor(maxWaitingTime: number) {\n super({\n message: `Cluster did not become healthy in ${maxWaitingTime} seconds.`,\n code: \"UNHEALTHY_CLUSTER\"\n });\n }\n}\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,eAAe;AAE3C,OAAO,MAAMC,qBAAqB,SAASD,WAAW,CAAC;EAC5CE,WAAWA,CAACC,cAAsB,EAAE;IACvC,KAAK,CAAC;MACFC,OAAO,EAAE,qCAAqCD,cAAc,WAAW;MACvEE,IAAI,EAAE;IACV,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Client } from "../../client";
|
|
2
|
-
import { ElasticsearchCatClusterHealthStatus } from "../../operations/types";
|
|
3
|
-
import { ClusterHealthReason, MemoryReason, ProcessorReason } from "./reason";
|
|
4
|
-
export
|
|
1
|
+
import type { Client } from "../../client.js";
|
|
2
|
+
import { ElasticsearchCatClusterHealthStatus } from "../../operations/types.js";
|
|
3
|
+
import type { ClusterHealthReason, MemoryReason, ProcessorReason } from "./reason/index.js";
|
|
4
|
+
export type WaitingReason = ProcessorReason | MemoryReason | ClusterHealthReason;
|
|
5
5
|
export interface IWaitUntilHealthyParams {
|
|
6
6
|
/**
|
|
7
7
|
* Minimum status allowed, otherwise the cluster is considered unhealthy.
|