@webiny/api-elasticsearch 0.0.0-unstable.eb196ccd2f → 0.0.0-unstable.f6dc066313
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 -30
- package/client.js.map +1 -1
- package/compression.js +7 -14
- package/compression.js.map +1 -1
- package/cursors.d.ts +1 -1
- package/cursors.js +2 -10
- 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 -17
- package/index.js +27 -197
- 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 +1 -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.js +2 -9
- package/indexPrefix.js.map +1 -1
- package/indices.d.ts +1 -2
- 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.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 +13 -12
- package/plugins/definition/ElasticsearchBodyModifierPlugin.js +4 -12
- package/plugins/definition/ElasticsearchBodyModifierPlugin.js.map +1 -1
- 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.js +4 -12
- package/plugins/definition/ElasticsearchSortModifierPlugin.js.map +1 -1
- package/plugins/definition/index.d.ts +6 -6
- package/plugins/definition/index.js +6 -71
- 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 +2 -9
- 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 +2 -9
- 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.js +2 -9
- package/sharedIndex.js.map +1 -1
- package/sort.d.ts +2 -2
- package/sort.js +8 -16
- package/sort.js.map +1 -1
- package/types.d.ts +3 -3
- package/types.js +28 -26
- package/types.js.map +1 -1
- package/utils/createIndex.d.ts +0 -1
- 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 +3 -3
- 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 +3 -3
- 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/operator/japanese/contains.d.ts +0 -8
- package/plugins/operator/japanese/contains.js +0 -44
- package/plugins/operator/japanese/contains.js.map +0 -1
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["WebinyError","ContextPlugin","createElasticsearchClient","getElasticsearchOperators","Client","params","context","elasticsearch","plugins","register"],"sources":["index.ts"],"sourcesContent":["/**\n * TODO File should contain only exports from other files.\n */\nimport WebinyError from \"@webiny/error\";\nimport type { ElasticsearchContext } from \"~/types.js\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport type { ElasticsearchClientOptions } from \"~/client.js\";\nimport { createElasticsearchClient } from \"~/client.js\";\nimport { getElasticsearchOperators } from \"~/operators.js\";\nimport { Client } from \"@elastic/elasticsearch\";\n\nexport * from \"./indexConfiguration/index.js\";\nexport * from \"./plugins/index.js\";\nexport * from \"./sort.js\";\nexport * from \"./indices.js\";\nexport * from \"./where.js\";\nexport * from \"./limit.js\";\nexport * from \"./normalize.js\";\nexport * from \"./compression.js\";\nexport * from \"./operators.js\";\nexport * from \"./cursors.js\";\nexport * from \"./client.js\";\nexport * from \"./utils/index.js\";\nexport * from \"./operations/index.js\";\nexport * from \"./sharedIndex.js\";\nexport * from \"./indexPrefix.js\";\nexport * from \"./db/index.js\";\n\n/**\n * We must accept either Elasticsearch client or options that create the client.\n */\nexport default (\n params: ElasticsearchClientOptions | Client\n): ContextPlugin<ElasticsearchContext> => {\n return new ContextPlugin<ElasticsearchContext>(context => {\n if (context.elasticsearch) {\n throw new WebinyError(\n \"Elasticsearch client is already initialized, no need to define it again. Check your code for duplicate initializations.\",\n \"OPENSEARCH_ALREADY_INITIALIZED\"\n );\n }\n /**\n * Initialize the Elasticsearch client.\n */\n context.elasticsearch =\n params instanceof Client ? params : createElasticsearchClient(params);\n\n context.plugins.register(getElasticsearchOperators());\n });\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,WAAW,MAAM,eAAe;AAEvC,SAASC,aAAa,QAAQ,aAAa;AAE3C,SAASC,yBAAyB;AAClC,SAASC,yBAAyB;AAClC,SAASC,MAAM,QAAQ,wBAAwB;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eACIC,MAA2C,IACL;EACtC,OAAO,IAAIJ,aAAa,CAAuBK,OAAO,IAAI;IACtD,IAAIA,OAAO,CAACC,aAAa,EAAE;MACvB,MAAM,IAAIP,WAAW,CACjB,yHAAyH,EACzH,gCACJ,CAAC;IACL;IACA;AACR;AACA;IACQM,OAAO,CAACC,aAAa,GACjBF,MAAM,YAAYD,MAAM,GAAGC,MAAM,GAAGH,yBAAyB,CAACG,MAAM,CAAC;IAEzEC,OAAO,CAACE,OAAO,CAACC,QAAQ,CAACN,yBAAyB,CAAC,CAAC,CAAC;EACzD,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getBaseConfiguration = void 0;
|
|
7
|
-
var _common = require("./common");
|
|
1
|
+
import { getCommonMappings } from "./common.js";
|
|
8
2
|
const config = {
|
|
9
3
|
mappings: {
|
|
10
|
-
dynamic_templates:
|
|
4
|
+
dynamic_templates: getCommonMappings(mappings => {
|
|
11
5
|
return mappings.concat([{
|
|
12
6
|
strings: {
|
|
13
7
|
match_mapping_type: "string",
|
|
@@ -31,12 +25,11 @@ const config = {
|
|
|
31
25
|
}
|
|
32
26
|
}
|
|
33
27
|
};
|
|
34
|
-
const getBaseConfiguration = modifier => {
|
|
28
|
+
export const getBaseConfiguration = modifier => {
|
|
35
29
|
if (!modifier) {
|
|
36
30
|
return config;
|
|
37
31
|
}
|
|
38
32
|
return modifier(config);
|
|
39
33
|
};
|
|
40
|
-
exports.getBaseConfiguration = getBaseConfiguration;
|
|
41
34
|
|
|
42
35
|
//# sourceMappingURL=base.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["getCommonMappings","config","mappings","dynamic_templates","concat","strings","match_mapping_type","mapping","type","fields","keyword","ignore_above","properties","rawValues","enabled","getBaseConfiguration","modifier"],"sources":["base.ts"],"sourcesContent":["import type { ElasticsearchIndexRequestBody } from \"~/types.js\";\nimport { getCommonMappings } from \"./common.js\";\n\nconst config: ElasticsearchIndexRequestBody = {\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: ElasticsearchIndexRequestBody): ElasticsearchIndexRequestBody;\n}\nexport const getBaseConfiguration = (modifier?: Modifier) => {\n if (!modifier) {\n return config;\n }\n return modifier(config);\n};\n"],"mappings":"AACA,SAASA,iBAAiB;AAE1B,MAAMC,MAAqC,GAAG;EAC1CC,QAAQ,EAAE;IACNC,iBAAiB,EAAEH,iBAAiB,CAACE,QAAQ,IAAI;MAC7C,OAAOA,QAAQ,CAACE,MAAM,CAAC,CACnB;QACIC,OAAO,EAAE;UACLC,kBAAkB,EAAE,QAAQ;UAC5BC,OAAO,EAAE;YACLC,IAAI,EAAE,MAAM;YACZC,MAAM,EAAE;cACJC,OAAO,EAAE;gBACLF,IAAI,EAAE,SAAS;gBACfG,YAAY,EAAE;cAClB;YACJ;UACJ;QACJ;MACJ,CAAC,CACJ,CAAC;IACN,CAAC,CAAC;IACFC,UAAU,EAAE;MACRC,SAAS,EAAE;QACPL,IAAI,EAAE,QAAQ;QACdM,OAAO,EAAE;MACb;IACJ;EACJ;AACJ,CAAC;AAKD,OAAO,MAAMC,oBAAoB,GAAIC,QAAmB,IAAK;EACzD,IAAI,CAACA,QAAQ,EAAE;IACX,OAAOf,MAAM;EACjB;EACA,OAAOe,QAAQ,CAACf,MAAM,CAAC;AAC3B,CAAC","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ElasticsearchIndexRequestBodyMappingsDynamicTemplate } from "../types";
|
|
1
|
+
import type { ElasticsearchIndexRequestBodyMappingsDynamicTemplate } from "../types.js";
|
|
2
2
|
interface Modifier {
|
|
3
3
|
(mappings: ElasticsearchIndexRequestBodyMappingsDynamicTemplate[]): ElasticsearchIndexRequestBodyMappingsDynamicTemplate[];
|
|
4
4
|
}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getCommonMappings = void 0;
|
|
7
1
|
const getDefaultMappings = () => {
|
|
8
2
|
return [{
|
|
9
3
|
ids: {
|
|
@@ -43,12 +37,11 @@ const getDefaultMappings = () => {
|
|
|
43
37
|
/**
|
|
44
38
|
* @internal
|
|
45
39
|
*/
|
|
46
|
-
const getCommonMappings = cb => {
|
|
40
|
+
export const getCommonMappings = cb => {
|
|
47
41
|
if (!cb) {
|
|
48
42
|
return getDefaultMappings();
|
|
49
43
|
}
|
|
50
44
|
return cb(getDefaultMappings());
|
|
51
45
|
};
|
|
52
|
-
exports.getCommonMappings = getCommonMappings;
|
|
53
46
|
|
|
54
47
|
//# sourceMappingURL=common.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getDefaultMappings","ids","match","mapping","type","keyword","dates","numbers","scaling_factor","booleans","getCommonMappings","cb"
|
|
1
|
+
{"version":3,"names":["getDefaultMappings","ids","match","mapping","type","keyword","dates","numbers","scaling_factor","booleans","getCommonMappings","cb"],"sources":["common.ts"],"sourcesContent":["import type { ElasticsearchIndexRequestBodyMappingsDynamicTemplate } from \"~/types.js\";\n\nconst getDefaultMappings = (): ElasticsearchIndexRequestBodyMappingsDynamicTemplate[] => {\n return [\n {\n ids: {\n match: \"^id|entryId$\",\n mapping: {\n type: \"string\",\n keyword: true\n }\n }\n },\n {\n /**\n * Update with the correct date fields.\n */\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: ElasticsearchIndexRequestBodyMappingsDynamicTemplate[]\n ): ElasticsearchIndexRequestBodyMappingsDynamicTemplate[];\n}\n/**\n * @internal\n */\nexport const getCommonMappings = (\n cb?: Modifier\n): ElasticsearchIndexRequestBodyMappingsDynamicTemplate[] => {\n if (!cb) {\n return getDefaultMappings();\n }\n\n return cb(getDefaultMappings());\n};\n"],"mappings":"AAEA,MAAMA,kBAAkB,GAAGA,CAAA,KAA8D;EACrF,OAAO,CACH;IACIC,GAAG,EAAE;MACDC,KAAK,EAAE,cAAc;MACrBC,OAAO,EAAE;QACLC,IAAI,EAAE,QAAQ;QACdC,OAAO,EAAE;MACb;IACJ;EACJ,CAAC,EACD;IACI;AACZ;AACA;IACYC,KAAK,EAAE;MACHJ,KAAK,EAAE,iCAAiC;MACxCC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV;IACJ;EACJ,CAAC,EACD;IACIG,OAAO,EAAE;MACLL,KAAK,EAAE,UAAU;MACjBC,OAAO,EAAE;QACLC,IAAI,EAAE,cAAc;QACpBI,cAAc,EAAE;MACpB;IACJ;EACJ,CAAC,EACD;IACIC,QAAQ,EAAE;MACNP,KAAK,EAAE,WAAW;MAClBC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV;IACJ;EACJ,CAAC,CACJ;AACL,CAAC;AAOD;AACA;AACA;AACA,OAAO,MAAMM,iBAAiB,GAC1BC,EAAa,IAC4C;EACzD,IAAI,CAACA,EAAE,EAAE;IACL,OAAOX,kBAAkB,CAAC,CAAC;EAC/B;EAEA,OAAOW,EAAE,CAACX,kBAAkB,CAAC,CAAC,CAAC;AACnC,CAAC","ignoreList":[]}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export * from "./base";
|
|
2
|
-
export * from "./common";
|
|
3
|
-
export * from "./japanese";
|
|
1
|
+
export * from "./base.js";
|
|
2
|
+
export * from "./common.js";
|
|
@@ -1,40 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _base = require("./base");
|
|
7
|
-
Object.keys(_base).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _base[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _base[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _common = require("./common");
|
|
18
|
-
Object.keys(_common).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _common[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _common[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
var _japanese = require("./japanese");
|
|
29
|
-
Object.keys(_japanese).forEach(function (key) {
|
|
30
|
-
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (key in exports && exports[key] === _japanese[key]) return;
|
|
32
|
-
Object.defineProperty(exports, key, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () {
|
|
35
|
-
return _japanese[key];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
|
1
|
+
export * from "./base.js";
|
|
2
|
+
export * from "./common.js";
|
|
39
3
|
|
|
40
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./base.js\";\nexport * from \"./common.js\";\n"],"mappings":"AAAA;AACA","ignoreList":[]}
|
package/indexPrefix.js
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getElasticsearchIndexPrefix = void 0;
|
|
7
|
-
const getElasticsearchIndexPrefix = () => {
|
|
8
|
-
return process.env.ELASTIC_SEARCH_INDEX_PREFIX || process.env.WEBINY_ELASTIC_SEARCH_INDEX_PREFIX || "";
|
|
1
|
+
export const getElasticsearchIndexPrefix = () => {
|
|
2
|
+
return process.env.OPENSEARCH_INDEX_PREFIX || process.env.WEBINY_OPENSEARCH_INDEX_PREFIX || "";
|
|
9
3
|
};
|
|
10
|
-
exports.getElasticsearchIndexPrefix = getElasticsearchIndexPrefix;
|
|
11
4
|
|
|
12
5
|
//# sourceMappingURL=indexPrefix.js.map
|
package/indexPrefix.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getElasticsearchIndexPrefix","process","env","
|
|
1
|
+
{"version":3,"names":["getElasticsearchIndexPrefix","process","env","OPENSEARCH_INDEX_PREFIX","WEBINY_OPENSEARCH_INDEX_PREFIX"],"sources":["indexPrefix.ts"],"sourcesContent":["export const getElasticsearchIndexPrefix = (): string => {\n return process.env.OPENSEARCH_INDEX_PREFIX || process.env.WEBINY_OPENSEARCH_INDEX_PREFIX || \"\";\n};\n"],"mappings":"AAAA,OAAO,MAAMA,2BAA2B,GAAGA,CAAA,KAAc;EACrD,OAAOC,OAAO,CAACC,GAAG,CAACC,uBAAuB,IAAIF,OAAO,CAACC,GAAG,CAACE,8BAA8B,IAAI,EAAE;AAClG,CAAC","ignoreList":[]}
|
package/indices.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type { ElasticsearchIndexPlugin } from "./plugins/definition/ElasticsearchIndexPlugin";
|
|
1
|
+
import type { ElasticsearchIndexPlugin } from "./plugins/definition/ElasticsearchIndexPlugin.js";
|
|
2
2
|
import type { PluginsContainer } from "@webiny/plugins";
|
|
3
3
|
interface IndicesPluginsParams {
|
|
4
4
|
container: PluginsContainer;
|
|
5
5
|
type: string;
|
|
6
|
-
locale: string;
|
|
7
6
|
}
|
|
8
7
|
export declare const getLastAddedIndexPlugin: <T extends ElasticsearchIndexPlugin>(params: IndicesPluginsParams) => T;
|
|
9
8
|
export {};
|
package/indices.js
CHANGED
|
@@ -1,30 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.getLastAddedIndexPlugin = void 0;
|
|
8
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
1
|
+
import WebinyError from "@webiny/error";
|
|
9
2
|
const listIndicesPlugins = ({
|
|
10
3
|
container,
|
|
11
|
-
type
|
|
12
|
-
locale
|
|
4
|
+
type
|
|
13
5
|
}) => {
|
|
14
6
|
return container.byType(type).filter(plugin => {
|
|
15
|
-
return plugin.canUse(
|
|
7
|
+
return plugin.canUse();
|
|
16
8
|
});
|
|
17
9
|
};
|
|
18
|
-
const getLastAddedIndexPlugin = params => {
|
|
10
|
+
export const getLastAddedIndexPlugin = params => {
|
|
19
11
|
const plugins = listIndicesPlugins(params);
|
|
20
12
|
if (plugins.length === 0) {
|
|
21
|
-
throw new
|
|
22
|
-
type: params.type
|
|
23
|
-
locale: params.locale
|
|
13
|
+
throw new WebinyError(`Could not find a single ElasticsearchIndexPlugin of type "${params.type}".`, "OPENSEARCH_INDEX_TEMPLATE_ERROR", {
|
|
14
|
+
type: params.type
|
|
24
15
|
});
|
|
25
16
|
}
|
|
26
17
|
return plugins.pop();
|
|
27
18
|
};
|
|
28
|
-
exports.getLastAddedIndexPlugin = getLastAddedIndexPlugin;
|
|
29
19
|
|
|
30
20
|
//# sourceMappingURL=indices.js.map
|
package/indices.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["WebinyError","listIndicesPlugins","container","type","byType","filter","plugin","canUse","getLastAddedIndexPlugin","params","plugins","length","pop"],"sources":["indices.ts"],"sourcesContent":["import type { ElasticsearchIndexPlugin } from \"~/plugins/definition/ElasticsearchIndexPlugin.js\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport WebinyError from \"@webiny/error\";\n\ninterface IndicesPluginsParams {\n container: PluginsContainer;\n type: string;\n}\nconst listIndicesPlugins = <T extends ElasticsearchIndexPlugin>({\n container,\n type\n}: IndicesPluginsParams): T[] => {\n return container.byType<T>(type).filter(plugin => {\n return plugin.canUse();\n });\n};\n\nexport const getLastAddedIndexPlugin = <T extends ElasticsearchIndexPlugin>(\n params: IndicesPluginsParams\n): T => {\n const plugins = listIndicesPlugins<T>(params);\n if (plugins.length === 0) {\n throw new WebinyError(\n `Could not find a single ElasticsearchIndexPlugin of type \"${params.type}\".`,\n \"OPENSEARCH_INDEX_TEMPLATE_ERROR\",\n {\n type: params.type\n }\n );\n }\n\n return plugins.pop() as T;\n};\n"],"mappings":"AAEA,OAAOA,WAAW,MAAM,eAAe;AAMvC,MAAMC,kBAAkB,GAAGA,CAAqC;EAC5DC,SAAS;EACTC;AACkB,CAAC,KAAU;EAC7B,OAAOD,SAAS,CAACE,MAAM,CAAID,IAAI,CAAC,CAACE,MAAM,CAACC,MAAM,IAAI;IAC9C,OAAOA,MAAM,CAACC,MAAM,CAAC,CAAC;EAC1B,CAAC,CAAC;AACN,CAAC;AAED,OAAO,MAAMC,uBAAuB,GAChCC,MAA4B,IACxB;EACJ,MAAMC,OAAO,GAAGT,kBAAkB,CAAIQ,MAAM,CAAC;EAC7C,IAAIC,OAAO,CAACC,MAAM,KAAK,CAAC,EAAE;IACtB,MAAM,IAAIX,WAAW,CACjB,6DAA6DS,MAAM,CAACN,IAAI,IAAI,EAC5E,iCAAiC,EACjC;MACIA,IAAI,EAAEM,MAAM,CAACN;IACjB,CACJ,CAAC;EACL;EAEA,OAAOO,OAAO,CAACE,GAAG,CAAC,CAAC;AACxB,CAAC","ignoreList":[]}
|
package/limit.js
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createLimit = void 0;
|
|
7
1
|
/**
|
|
8
2
|
* This is the max limit of the Elasticsearch.
|
|
9
3
|
* Change here if it changes (and if it is necessary).
|
|
@@ -13,7 +7,7 @@ const ES_LIMIT_MAX = 10000;
|
|
|
13
7
|
* Our system default limit.
|
|
14
8
|
*/
|
|
15
9
|
const ES_LIMIT_DEFAULT = 50;
|
|
16
|
-
const createLimit = (limit, defaultValue = ES_LIMIT_DEFAULT) => {
|
|
10
|
+
export const createLimit = (limit, defaultValue = ES_LIMIT_DEFAULT) => {
|
|
17
11
|
/**
|
|
18
12
|
* Limit can possibly be null/undefined or less than 1.
|
|
19
13
|
* In that case return the defaults.
|
|
@@ -34,6 +28,5 @@ const createLimit = (limit, defaultValue = ES_LIMIT_DEFAULT) => {
|
|
|
34
28
|
*/
|
|
35
29
|
return ES_LIMIT_MAX - 1;
|
|
36
30
|
};
|
|
37
|
-
exports.createLimit = createLimit;
|
|
38
31
|
|
|
39
32
|
//# sourceMappingURL=limit.js.map
|
package/limit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ES_LIMIT_MAX","ES_LIMIT_DEFAULT","createLimit","limit","defaultValue"
|
|
1
|
+
{"version":3,"names":["ES_LIMIT_MAX","ES_LIMIT_DEFAULT","createLimit","limit","defaultValue"],"sources":["limit.ts"],"sourcesContent":["/**\n * This is the max limit of the Elasticsearch.\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 Elasticsearch one.\n * Elasticsearch 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"],"mappings":"AAAA;AACA;AACA;AACA;AACA,MAAMA,YAAY,GAAG,KAAK;AAC1B;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG,EAAE;AAE3B,OAAO,MAAMC,WAAW,GAAGA,CAACC,KAAc,EAAEC,YAAY,GAAGH,gBAAgB,KAAa;EACpF;AACJ;AACA;AACA;EACI,IAAI,CAACE,KAAK,IAAIA,KAAK,GAAG,CAAC,EAAE;IACrB,OAAOC,YAAY;EACvB;EACA;AACJ;AACA;AACA;EACI,IAAID,KAAK,GAAGH,YAAY,EAAE;IACtB,OAAOG,KAAK;EAChB;EACA;AACJ;AACA;AACA;EACI,OAAOH,YAAY,GAAG,CAAC;AAC3B,CAAC","ignoreList":[]}
|
package/normalize.js
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.normalizeValueWithAsterisk = exports.normalizeValue = void 0;
|
|
7
1
|
/**
|
|
8
2
|
* Before performing the query, we need to escape all special characters.
|
|
9
3
|
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#_reserved_characters
|
|
10
4
|
*/
|
|
11
5
|
|
|
12
6
|
const specialCharactersToRemove = [`\\?`];
|
|
13
|
-
const specialCharacterToSpace = ["-"];
|
|
7
|
+
const specialCharacterToSpace = ["-", "\\\\"];
|
|
14
8
|
const specialCharacters = ["\\\\", "\\+",
|
|
15
9
|
// "\\-",
|
|
16
10
|
"\\=", `\&`, `\\|`, ">", "<", `\!`, "\\(", "\\)", "\\{", "\\}", "\\[", "\\]", "\\^", '\\"', "\\~", "\\*", `\:`, `\/`, "\\#"];
|
|
17
|
-
const normalizeValue = value => {
|
|
11
|
+
export const normalizeValue = value => {
|
|
18
12
|
let result = value || "";
|
|
19
13
|
if (!result) {
|
|
20
14
|
return result;
|
|
@@ -30,14 +24,13 @@ const normalizeValue = value => {
|
|
|
30
24
|
}
|
|
31
25
|
return result || "";
|
|
32
26
|
};
|
|
33
|
-
exports.normalizeValue = normalizeValue;
|
|
34
27
|
const hasSpecialChar = value => {
|
|
35
28
|
if (!value) {
|
|
36
29
|
return null;
|
|
37
30
|
}
|
|
38
31
|
return value.match(/^([0-9a-zA-Z]+)$/i) === null;
|
|
39
32
|
};
|
|
40
|
-
const normalizeValueWithAsterisk = initial => {
|
|
33
|
+
export const normalizeValueWithAsterisk = initial => {
|
|
41
34
|
const value = normalizeValue(initial);
|
|
42
35
|
const results = value.split(" ");
|
|
43
36
|
let result = value;
|
|
@@ -57,6 +50,5 @@ const normalizeValueWithAsterisk = initial => {
|
|
|
57
50
|
}
|
|
58
51
|
return result;
|
|
59
52
|
};
|
|
60
|
-
exports.normalizeValueWithAsterisk = normalizeValueWithAsterisk;
|
|
61
53
|
|
|
62
54
|
//# sourceMappingURL=normalize.js.map
|
package/normalize.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["specialCharactersToRemove","specialCharacterToSpace","specialCharacters","normalizeValue","value","result","character","replace","RegExp","
|
|
1
|
+
{"version":3,"names":["specialCharactersToRemove","specialCharacterToSpace","specialCharacters","normalizeValue","value","result","character","replace","RegExp","hasSpecialChar","match","normalizeValueWithAsterisk","initial","results","split","firstWord","lastWord","length"],"sources":["normalize.ts"],"sourcesContent":["/**\n * Before performing the query, we need to escape all special characters.\n * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#_reserved_characters\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"],"mappings":"AAAA;AACA;AACA;AACA;;AAEA,MAAMA,yBAAyB,GAAG,CAAC,KAAK,CAAC;AAEzC,MAAMC,uBAAuB,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC;AAE7C,MAAMC,iBAAiB,GAAG,CACtB,MAAM,EACN,KAAK;AACL;AACA,KAAK,EACL,IAAI,EACJ,KAAK,EACL,GAAG,EACH,GAAG,EACH,IAAI,EACJ,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,KAAK,CACR;AAED,OAAO,MAAMC,cAAc,GAAIC,KAAa,IAAK;EAC7C,IAAIC,MAAM,GAAGD,KAAK,IAAI,EAAE;EACxB,IAAI,CAACC,MAAM,EAAE;IACT,OAAOA,MAAM;EACjB;EACA,KAAK,MAAMC,SAAS,IAAIN,yBAAyB,EAAE;IAC/CK,MAAM,GAAGA,MAAM,CAACE,OAAO,CAAC,IAAIC,MAAM,CAACF,SAAS,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC;EAC3D;EACA,KAAK,MAAMA,SAAS,IAAIL,uBAAuB,EAAE;IAC7CI,MAAM,GAAGA,MAAM,CAACE,OAAO,CAAC,IAAIC,MAAM,CAACF,SAAS,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC;EAC5D;EAEA,KAAK,MAAMA,SAAS,IAAIJ,iBAAiB,EAAE;IACvCG,MAAM,GAAGA,MAAM,CAACE,OAAO,CAAC,IAAIC,MAAM,CAACF,SAAS,EAAE,GAAG,CAAC,EAAE,KAAKA,SAAS,EAAE,CAAC;EACzE;EAEA,OAAOD,MAAM,IAAI,EAAE;AACvB,CAAC;AAED,MAAMI,cAAc,GAAIL,KAAa,IAAqB;EACtD,IAAI,CAACA,KAAK,EAAE;IACR,OAAO,IAAI;EACf;EACA,OAAOA,KAAK,CAACM,KAAK,CAAC,mBAAmB,CAAC,KAAK,IAAI;AACpD,CAAC;AAED,OAAO,MAAMC,0BAA0B,GAAIC,OAAe,IAAK;EAC3D,MAAMR,KAAK,GAAGD,cAAc,CAACS,OAAO,CAAC;EACrC,MAAMC,OAAO,GAAGT,KAAK,CAACU,KAAK,CAAC,GAAG,CAAC;EAEhC,IAAIT,MAAM,GAAGD,KAAK;EAClB;AACJ;AACA;EACI,MAAMW,SAAS,GAAGF,OAAO,CAAC,CAAC,CAAC;EAC5B,IAAIJ,cAAc,CAACM,SAAS,CAAC,KAAK,KAAK,EAAE;IACrCV,MAAM,GAAG,IAAIA,MAAM,EAAE;EACzB;EACA;AACJ;AACA;EACI,MAAMW,QAAQ,GAAGH,OAAO,CAACA,OAAO,CAACI,MAAM,GAAG,CAAC,CAAC;EAC5C,IAAIR,cAAc,CAACO,QAAQ,CAAC,KAAK,KAAK,EAAE;IACpCX,MAAM,GAAG,GAAGA,MAAM,GAAG;EACzB;EAEA,OAAOA,MAAM;AACjB,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Client } from "../client";
|
|
2
|
-
import type { IElasticsearchCatHealthResponse } from "./types";
|
|
1
|
+
import type { Client } from "../client.js";
|
|
2
|
+
import type { IElasticsearchCatHealthResponse } from "./types.js";
|
|
3
3
|
export declare class ElasticsearchCatHealth {
|
|
4
4
|
private readonly client;
|
|
5
5
|
constructor(client: Client);
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ElasticsearchCatHealth = void 0;
|
|
7
|
-
var _error = require("@webiny/error");
|
|
8
|
-
var _stripConnectionFromException = require("./stripConnectionFromException");
|
|
9
|
-
class ElasticsearchCatHealth {
|
|
1
|
+
import { WebinyError } from "@webiny/error";
|
|
2
|
+
import { stripConnectionFromException } from "./stripConnectionFromException.js";
|
|
3
|
+
export class ElasticsearchCatHealth {
|
|
10
4
|
constructor(client) {
|
|
11
5
|
this.client = client;
|
|
12
6
|
}
|
|
@@ -16,9 +10,9 @@ class ElasticsearchCatHealth {
|
|
|
16
10
|
format: "json"
|
|
17
11
|
});
|
|
18
12
|
if (!Array.isArray(response.body) || response.body.length === 0) {
|
|
19
|
-
throw new
|
|
13
|
+
throw new WebinyError({
|
|
20
14
|
message: `There is no valid response from cat.health operation.`,
|
|
21
|
-
code: "
|
|
15
|
+
code: "OPENSEARCH_HEALTH_INVALID_RESPONSE",
|
|
22
16
|
data: response.body
|
|
23
17
|
});
|
|
24
18
|
}
|
|
@@ -27,12 +21,11 @@ class ElasticsearchCatHealth {
|
|
|
27
21
|
};
|
|
28
22
|
} catch (ex) {
|
|
29
23
|
console.error(`Could not fetch cluster health information: ${ex.message}`);
|
|
30
|
-
const error =
|
|
24
|
+
const error = stripConnectionFromException(ex);
|
|
31
25
|
console.log(JSON.stringify(error));
|
|
32
26
|
throw error;
|
|
33
27
|
}
|
|
34
28
|
}
|
|
35
29
|
}
|
|
36
|
-
exports.ElasticsearchCatHealth = ElasticsearchCatHealth;
|
|
37
30
|
|
|
38
31
|
//# sourceMappingURL=ElasticsearchCatHealth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["WebinyError","stripConnectionFromException","ElasticsearchCatHealth","constructor","client","getHealth","response","cat","health","format","Array","isArray","body","length","message","code","data","ex","console","error","log","JSON","stringify"],"sources":["ElasticsearchCatHealth.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport type { Client } from \"~/client.js\";\nimport type { IElasticsearchCatHealthResponse } from \"./types.js\";\nimport { stripConnectionFromException } from \"~/operations/stripConnectionFromException.js\";\n\nexport class ElasticsearchCatHealth {\n private readonly client: Client;\n\n public constructor(client: Client) {\n this.client = client;\n }\n\n public async getHealth(): Promise<IElasticsearchCatHealthResponse> {\n try {\n const response = await this.client.cat.health<\n unknown | [IElasticsearchCatHealthResponse]\n >({\n format: \"json\"\n });\n\n if (!Array.isArray(response.body) || response.body.length === 0) {\n throw new WebinyError({\n message: `There is no valid response from cat.health operation.`,\n code: \"OPENSEARCH_HEALTH_INVALID_RESPONSE\",\n data: response.body\n });\n }\n\n return {\n ...response.body[0]\n };\n } catch (ex) {\n console.error(`Could not fetch cluster health information: ${ex.message}`);\n const error = stripConnectionFromException(ex);\n console.log(JSON.stringify(error));\n throw error;\n }\n }\n}\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,eAAe;AAG3C,SAASC,4BAA4B;AAErC,OAAO,MAAMC,sBAAsB,CAAC;EAGzBC,WAAWA,CAACC,MAAc,EAAE;IAC/B,IAAI,CAACA,MAAM,GAAGA,MAAM;EACxB;EAEA,MAAaC,SAASA,CAAA,EAA6C;IAC/D,IAAI;MACA,MAAMC,QAAQ,GAAG,MAAM,IAAI,CAACF,MAAM,CAACG,GAAG,CAACC,MAAM,CAE3C;QACEC,MAAM,EAAE;MACZ,CAAC,CAAC;MAEF,IAAI,CAACC,KAAK,CAACC,OAAO,CAACL,QAAQ,CAACM,IAAI,CAAC,IAAIN,QAAQ,CAACM,IAAI,CAACC,MAAM,KAAK,CAAC,EAAE;QAC7D,MAAM,IAAIb,WAAW,CAAC;UAClBc,OAAO,EAAE,uDAAuD;UAChEC,IAAI,EAAE,oCAAoC;UAC1CC,IAAI,EAAEV,QAAQ,CAACM;QACnB,CAAC,CAAC;MACN;MAEA,OAAO;QACH,GAAGN,QAAQ,CAACM,IAAI,CAAC,CAAC;MACtB,CAAC;IACL,CAAC,CAAC,OAAOK,EAAE,EAAE;MACTC,OAAO,CAACC,KAAK,CAAC,+CAA+CF,EAAE,CAACH,OAAO,EAAE,CAAC;MAC1E,MAAMK,KAAK,GAAGlB,4BAA4B,CAACgB,EAAE,CAAC;MAC9CC,OAAO,CAACE,GAAG,CAACC,IAAI,CAACC,SAAS,CAACH,KAAK,CAAC,CAAC;MAClC,MAAMA,KAAK;IACf;EACJ;AACJ","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { IElasticsearchCatNodesResponse } from "./types";
|
|
2
|
-
import type { Client } from "../client";
|
|
1
|
+
import type { IElasticsearchCatNodesResponse } from "./types.js";
|
|
2
|
+
import type { Client } from "../client.js";
|
|
3
3
|
export declare class ElasticsearchCatNodes {
|
|
4
4
|
private readonly client;
|
|
5
5
|
constructor(client: Client);
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ElasticsearchCatNodes = void 0;
|
|
7
|
-
var _error = require("@webiny/error");
|
|
8
|
-
var _stripConnectionFromException = require("./stripConnectionFromException");
|
|
9
|
-
class ElasticsearchCatNodes {
|
|
1
|
+
import { WebinyError } from "@webiny/error";
|
|
2
|
+
import { stripConnectionFromException } from "./stripConnectionFromException.js";
|
|
3
|
+
export class ElasticsearchCatNodes {
|
|
10
4
|
constructor(client) {
|
|
11
5
|
this.client = client;
|
|
12
6
|
}
|
|
@@ -16,21 +10,20 @@ class ElasticsearchCatNodes {
|
|
|
16
10
|
format: "json"
|
|
17
11
|
});
|
|
18
12
|
if (!Array.isArray(response.body) || response.body.length === 0) {
|
|
19
|
-
throw new
|
|
13
|
+
throw new WebinyError({
|
|
20
14
|
message: `There is no valid response from cat.nodes operation.`,
|
|
21
|
-
code: "
|
|
15
|
+
code: "OPENSEARCH_NODES_INVALID_RESPONSE",
|
|
22
16
|
data: response.body
|
|
23
17
|
});
|
|
24
18
|
}
|
|
25
19
|
return response.body;
|
|
26
20
|
} catch (ex) {
|
|
27
21
|
console.error(`Could not fetch cluster nodes information: ${ex.message}`);
|
|
28
|
-
const error =
|
|
22
|
+
const error = stripConnectionFromException(ex);
|
|
29
23
|
console.log(JSON.stringify(error));
|
|
30
24
|
throw error;
|
|
31
25
|
}
|
|
32
26
|
}
|
|
33
27
|
}
|
|
34
|
-
exports.ElasticsearchCatNodes = ElasticsearchCatNodes;
|
|
35
28
|
|
|
36
29
|
//# sourceMappingURL=ElasticsearchCatNodes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["WebinyError","stripConnectionFromException","ElasticsearchCatNodes","constructor","client","getNodes","response","cat","nodes","format","Array","isArray","body","length","message","code","data","ex","console","error","log","JSON","stringify"],"sources":["ElasticsearchCatNodes.ts"],"sourcesContent":["import type { IElasticsearchCatNodesResponse } from \"./types.js\";\nimport type { Client } from \"~/client.js\";\nimport { WebinyError } from \"@webiny/error\";\nimport { stripConnectionFromException } from \"~/operations/stripConnectionFromException.js\";\n\nexport class ElasticsearchCatNodes {\n private readonly client: Client;\n\n public constructor(client: Client) {\n this.client = client;\n }\n\n public async getNodes(): Promise<IElasticsearchCatNodesResponse> {\n try {\n const response = await this.client.cat.nodes<IElasticsearchCatNodesResponse>({\n format: \"json\"\n });\n if (!Array.isArray(response.body) || response.body.length === 0) {\n throw new WebinyError({\n message: `There is no valid response from cat.nodes operation.`,\n code: \"OPENSEARCH_NODES_INVALID_RESPONSE\",\n data: response.body\n });\n }\n return response.body;\n } catch (ex) {\n console.error(`Could not fetch cluster nodes information: ${ex.message}`);\n const error = stripConnectionFromException(ex);\n console.log(JSON.stringify(error));\n throw error;\n }\n }\n}\n"],"mappings":"AAEA,SAASA,WAAW,QAAQ,eAAe;AAC3C,SAASC,4BAA4B;AAErC,OAAO,MAAMC,qBAAqB,CAAC;EAGxBC,WAAWA,CAACC,MAAc,EAAE;IAC/B,IAAI,CAACA,MAAM,GAAGA,MAAM;EACxB;EAEA,MAAaC,QAAQA,CAAA,EAA4C;IAC7D,IAAI;MACA,MAAMC,QAAQ,GAAG,MAAM,IAAI,CAACF,MAAM,CAACG,GAAG,CAACC,KAAK,CAAiC;QACzEC,MAAM,EAAE;MACZ,CAAC,CAAC;MACF,IAAI,CAACC,KAAK,CAACC,OAAO,CAACL,QAAQ,CAACM,IAAI,CAAC,IAAIN,QAAQ,CAACM,IAAI,CAACC,MAAM,KAAK,CAAC,EAAE;QAC7D,MAAM,IAAIb,WAAW,CAAC;UAClBc,OAAO,EAAE,sDAAsD;UAC/DC,IAAI,EAAE,mCAAmC;UACzCC,IAAI,EAAEV,QAAQ,CAACM;QACnB,CAAC,CAAC;MACN;MACA,OAAON,QAAQ,CAACM,IAAI;IACxB,CAAC,CAAC,OAAOK,EAAE,EAAE;MACTC,OAAO,CAACC,KAAK,CAAC,8CAA8CF,EAAE,CAACH,OAAO,EAAE,CAAC;MACzE,MAAMK,KAAK,GAAGlB,4BAA4B,CAACgB,EAAE,CAAC;MAC9CC,OAAO,CAACE,GAAG,CAACC,IAAI,CAACC,SAAS,CAACH,KAAK,CAAC,CAAC;MAClC,MAAMA,KAAK;IACf;EACJ;AACJ","ignoreList":[]}
|
package/operations/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./ElasticsearchCatHealth";
|
|
2
|
-
export * from "./ElasticsearchCatNodes";
|
|
3
|
-
export * from "./types";
|
|
1
|
+
export * from "./ElasticsearchCatHealth.js";
|
|
2
|
+
export * from "./ElasticsearchCatNodes.js";
|
|
3
|
+
export * from "./types.js";
|
package/operations/index.js
CHANGED
|
@@ -1,40 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _ElasticsearchCatHealth = require("./ElasticsearchCatHealth");
|
|
7
|
-
Object.keys(_ElasticsearchCatHealth).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _ElasticsearchCatHealth[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _ElasticsearchCatHealth[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _ElasticsearchCatNodes = require("./ElasticsearchCatNodes");
|
|
18
|
-
Object.keys(_ElasticsearchCatNodes).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _ElasticsearchCatNodes[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _ElasticsearchCatNodes[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
var _types = require("./types");
|
|
29
|
-
Object.keys(_types).forEach(function (key) {
|
|
30
|
-
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (key in exports && exports[key] === _types[key]) return;
|
|
32
|
-
Object.defineProperty(exports, key, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () {
|
|
35
|
-
return _types[key];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
|
1
|
+
export * from "./ElasticsearchCatHealth.js";
|
|
2
|
+
export * from "./ElasticsearchCatNodes.js";
|
|
3
|
+
export * from "./types.js";
|
|
39
4
|
|
|
40
5
|
//# sourceMappingURL=index.js.map
|
package/operations/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./ElasticsearchCatHealth.js\";\nexport * from \"./ElasticsearchCatNodes.js\";\nexport * from \"./types.js\";\n"],"mappings":"AAAA;AACA;AACA","ignoreList":[]}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.stripConnectionFromException = void 0;
|
|
7
|
-
const stripConnectionFromException = ex => {
|
|
1
|
+
export const stripConnectionFromException = ex => {
|
|
8
2
|
if (typeof ex !== "object") {
|
|
9
3
|
return ex;
|
|
10
4
|
}
|
|
@@ -19,6 +13,5 @@ const stripConnectionFromException = ex => {
|
|
|
19
13
|
}
|
|
20
14
|
};
|
|
21
15
|
};
|
|
22
|
-
exports.stripConnectionFromException = stripConnectionFromException;
|
|
23
16
|
|
|
24
17
|
//# sourceMappingURL=stripConnectionFromException.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["stripConnectionFromException","ex","meta","connection"
|
|
1
|
+
{"version":3,"names":["stripConnectionFromException","ex","meta","connection"],"sources":["stripConnectionFromException.ts"],"sourcesContent":["export const stripConnectionFromException = (ex: any): any => {\n if (typeof ex !== \"object\") {\n return ex;\n }\n if (!ex?.meta?.meta?.connection) {\n return ex;\n }\n return {\n ...ex.meta,\n meta: {\n ...ex.meta.meta,\n connection: null\n }\n };\n};\n"],"mappings":"AAAA,OAAO,MAAMA,4BAA4B,GAAIC,EAAO,IAAU;EAC1D,IAAI,OAAOA,EAAE,KAAK,QAAQ,EAAE;IACxB,OAAOA,EAAE;EACb;EACA,IAAI,CAACA,EAAE,EAAEC,IAAI,EAAEA,IAAI,EAAEC,UAAU,EAAE;IAC7B,OAAOF,EAAE;EACb;EACA,OAAO;IACH,GAAGA,EAAE,CAACC,IAAI;IACVA,IAAI,EAAE;MACF,GAAGD,EAAE,CAACC,IAAI,CAACA,IAAI;MACfC,UAAU,EAAE;IAChB;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
|
package/operations/types.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ElasticsearchCatClusterHealthStatus = void 0;
|
|
7
|
-
let ElasticsearchCatClusterHealthStatus = exports.ElasticsearchCatClusterHealthStatus = /*#__PURE__*/function (ElasticsearchCatClusterHealthStatus) {
|
|
1
|
+
export let ElasticsearchCatClusterHealthStatus = /*#__PURE__*/function (ElasticsearchCatClusterHealthStatus) {
|
|
8
2
|
ElasticsearchCatClusterHealthStatus["Green"] = "green";
|
|
9
3
|
ElasticsearchCatClusterHealthStatus["Yellow"] = "yellow";
|
|
10
4
|
ElasticsearchCatClusterHealthStatus["Red"] = "red";
|