@webiny/api-elasticsearch 5.40.0-beta.5 → 5.40.0-beta.6

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.
Files changed (51) hide show
  1. package/client.js +1 -1
  2. package/client.js.map +1 -1
  3. package/index.d.ts +1 -0
  4. package/index.js +12 -0
  5. package/index.js.map +1 -1
  6. package/operations/ElasticsearchCatHealth.d.ts +7 -0
  7. package/operations/ElasticsearchCatHealth.js +38 -0
  8. package/operations/ElasticsearchCatHealth.js.map +1 -0
  9. package/operations/ElasticsearchCatNodes.d.ts +7 -0
  10. package/operations/ElasticsearchCatNodes.js +36 -0
  11. package/operations/ElasticsearchCatNodes.js.map +1 -0
  12. package/operations/index.d.ts +3 -0
  13. package/operations/index.js +40 -0
  14. package/operations/index.js.map +1 -0
  15. package/operations/stripConnectionFromException.d.ts +1 -0
  16. package/operations/stripConnectionFromException.js +24 -0
  17. package/operations/stripConnectionFromException.js.map +1 -0
  18. package/operations/types.d.ts +35 -0
  19. package/operations/types.js +14 -0
  20. package/operations/types.js.map +1 -0
  21. package/package.json +8 -8
  22. package/utils/index.d.ts +2 -0
  23. package/utils/index.js +11 -0
  24. package/utils/index.js.map +1 -1
  25. package/utils/waitUntilHealthy/UnhealthyClusterError.d.ts +4 -0
  26. package/utils/waitUntilHealthy/UnhealthyClusterError.js +18 -0
  27. package/utils/waitUntilHealthy/UnhealthyClusterError.js.map +1 -0
  28. package/utils/waitUntilHealthy/WaitUntilHealthy.d.ts +71 -0
  29. package/utils/waitUntilHealthy/WaitUntilHealthy.js +157 -0
  30. package/utils/waitUntilHealthy/WaitUntilHealthy.js.map +1 -0
  31. package/utils/waitUntilHealthy/WaitingHealthyClusterAbortedError.d.ts +4 -0
  32. package/utils/waitUntilHealthy/WaitingHealthyClusterAbortedError.js +18 -0
  33. package/utils/waitUntilHealthy/WaitingHealthyClusterAbortedError.js.map +1 -0
  34. package/utils/waitUntilHealthy/index.d.ts +6 -0
  35. package/utils/waitUntilHealthy/index.js +51 -0
  36. package/utils/waitUntilHealthy/index.js.map +1 -0
  37. package/utils/waitUntilHealthy/reason/ClusterHealthReason.d.ts +15 -0
  38. package/utils/waitUntilHealthy/reason/ClusterHealthReason.js +21 -0
  39. package/utils/waitUntilHealthy/reason/ClusterHealthReason.js.map +1 -0
  40. package/utils/waitUntilHealthy/reason/IReason.d.ts +4 -0
  41. package/utils/waitUntilHealthy/reason/IReason.js +7 -0
  42. package/utils/waitUntilHealthy/reason/IReason.js.map +1 -0
  43. package/utils/waitUntilHealthy/reason/MemoryReason.d.ts +14 -0
  44. package/utils/waitUntilHealthy/reason/MemoryReason.js +21 -0
  45. package/utils/waitUntilHealthy/reason/MemoryReason.js.map +1 -0
  46. package/utils/waitUntilHealthy/reason/ProcessorReason.d.ts +14 -0
  47. package/utils/waitUntilHealthy/reason/ProcessorReason.js +21 -0
  48. package/utils/waitUntilHealthy/reason/ProcessorReason.js.map +1 -0
  49. package/utils/waitUntilHealthy/reason/index.d.ts +3 -0
  50. package/utils/waitUntilHealthy/reason/index.js +40 -0
  51. package/utils/waitUntilHealthy/reason/index.js.map +1 -0
package/client.js CHANGED
@@ -76,7 +76,7 @@ const createElasticsearchClient = options => {
76
76
  ...rest,
77
77
  auth: undefined
78
78
  };
79
- console.log({
79
+ console.error({
80
80
  ...data
81
81
  });
82
82
  throw new _error.default("Could not connect to Elasticsearch.", "ELASTICSEARCH_CLIENT_ERROR", data);
package/client.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_awsElasticsearchConnector","_interopRequireDefault","require","_crypto","_error","_elasticsearch","clients","Map","createClientKey","options","key","JSON","stringify","hash","crypto","createHash","update","digest","createElasticsearchClient","existing","get","cached","endpoint","node","rest","clientOptions","auth","region","String","process","env","AWS_REGION","credentials","accessKeyId","AWS_ACCESS_KEY_ID","secretAccessKey","AWS_SECRET_ACCESS_KEY","sessionToken","AWS_SESSION_TOKEN","errors","Object","keys","filter","value","length","WebinyError","join","createAwsElasticsearchConnector","Client","ex","data","error","undefined","console","log","client","set","exports"],"sources":["client.ts"],"sourcesContent":["import createAwsElasticsearchConnector from \"aws-elasticsearch-connector\";\nimport crypto from \"crypto\";\nimport WebinyError from \"@webiny/error\";\nimport { Client, ClientOptions } from \"@elastic/elasticsearch\";\n\nexport interface ElasticsearchClientOptions extends ClientOptions {\n endpoint?: string;\n}\n\nconst clients = new Map<string, Client>();\n\nconst createClientKey = (options: ElasticsearchClientOptions) => {\n const key = JSON.stringify(options);\n const hash = crypto.createHash(\"sha1\");\n hash.update(key);\n return hash.digest(\"hex\");\n};\n\nexport { Client, ClientOptions };\n\nexport const createElasticsearchClient = (options: ElasticsearchClientOptions): Client => {\n const key = createClientKey(options);\n const existing = clients.get(key);\n if (existing) {\n return existing;\n }\n\n const cached = (): Client => {\n const { endpoint, node, ...rest } = options;\n\n let clientOptions: ClientOptions = {\n node: endpoint || node,\n ...rest\n };\n\n if (!clientOptions.auth) {\n const region = String(process.env.AWS_REGION);\n\n const credentials = {\n accessKeyId: process.env.AWS_ACCESS_KEY_ID,\n secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,\n sessionToken: process.env.AWS_SESSION_TOKEN\n };\n\n const errors = Object.keys(credentials).filter(key => {\n const value = credentials[key as keyof typeof credentials];\n return !value;\n });\n if (errors.length > 0) {\n throw new WebinyError(\n `Missing keys values: ${errors.join(\", \")}`,\n \"MISSING_AWS_CREDENTIALS\"\n );\n }\n\n clientOptions = {\n ...clientOptions,\n ...createAwsElasticsearchConnector({\n region,\n // @ts-expect-error\n credentials\n })\n };\n }\n\n try {\n return new Client(clientOptions);\n } catch (ex) {\n const data = {\n error: ex,\n node: endpoint || node,\n ...rest,\n auth: undefined\n };\n console.log({\n ...data\n });\n throw new WebinyError(\n \"Could not connect to Elasticsearch.\",\n \"ELASTICSEARCH_CLIENT_ERROR\",\n data\n );\n }\n };\n\n const client = cached();\n\n clients.set(key, client);\n return client;\n};\n"],"mappings":";;;;;;;;;;;;;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,MAAMC,MAAM,GAAGC,MAAM,CAACC,IAAI,CAACT,WAAW,CAAC,CAACU,MAAM,CAAChC,GAAG,IAAI;QAClD,MAAMiC,KAAK,GAAGX,WAAW,CAACtB,GAAG,CAA6B;QAC1D,OAAO,CAACiC,KAAK;MACjB,CAAC,CAAC;MACF,IAAIJ,MAAM,CAACK,MAAM,GAAG,CAAC,EAAE;QACnB,MAAM,IAAIC,cAAW,CAChB,wBAAuBN,MAAM,CAACO,IAAI,CAAC,IAAI,CAAE,EAAC,EAC3C,yBACJ,CAAC;MACL;MAEArB,aAAa,GAAG;QACZ,GAAGA,aAAa;QAChB,GAAG,IAAAsB,kCAA+B,EAAC;UAC/BpB,MAAM;UACN;UACAK;QACJ,CAAC;MACL,CAAC;IACL;IAEA,IAAI;MACA,OAAO,IAAIgB,qBAAM,CAACvB,aAAa,CAAC;IACpC,CAAC,CAAC,OAAOwB,EAAE,EAAE;MACT,MAAMC,IAAI,GAAG;QACTC,KAAK,EAAEF,EAAE;QACT1B,IAAI,EAAED,QAAQ,IAAIC,IAAI;QACtB,GAAGC,IAAI;QACPE,IAAI,EAAE0B;MACV,CAAC;MACDC,OAAO,CAACC,GAAG,CAAC;QACR,GAAGJ;MACP,CAAC,CAAC;MACF,MAAM,IAAIL,cAAW,CACjB,qCAAqC,EACrC,4BAA4B,EAC5BK,IACJ,CAAC;IACL;EACJ,CAAC;EAED,MAAMK,MAAM,GAAGlC,MAAM,CAAC,CAAC;EAEvBf,OAAO,CAACkD,GAAG,CAAC9C,GAAG,EAAE6C,MAAM,CAAC;EACxB,OAAOA,MAAM;AACjB,CAAC;AAACE,OAAA,CAAAvC,yBAAA,GAAAA,yBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_awsElasticsearchConnector","_interopRequireDefault","require","_crypto","_error","_elasticsearch","clients","Map","createClientKey","options","key","JSON","stringify","hash","crypto","createHash","update","digest","createElasticsearchClient","existing","get","cached","endpoint","node","rest","clientOptions","auth","region","String","process","env","AWS_REGION","credentials","accessKeyId","AWS_ACCESS_KEY_ID","secretAccessKey","AWS_SECRET_ACCESS_KEY","sessionToken","AWS_SESSION_TOKEN","errors","Object","keys","filter","value","length","WebinyError","join","createAwsElasticsearchConnector","Client","ex","data","error","undefined","console","client","set","exports"],"sources":["client.ts"],"sourcesContent":["import createAwsElasticsearchConnector from \"aws-elasticsearch-connector\";\nimport crypto from \"crypto\";\nimport WebinyError from \"@webiny/error\";\nimport { Client, ClientOptions } from \"@elastic/elasticsearch\";\n\nexport interface ElasticsearchClientOptions extends ClientOptions {\n endpoint?: string;\n}\n\nconst clients = new Map<string, Client>();\n\nconst createClientKey = (options: ElasticsearchClientOptions) => {\n const key = JSON.stringify(options);\n const hash = crypto.createHash(\"sha1\");\n hash.update(key);\n return hash.digest(\"hex\");\n};\n\nexport { Client, ClientOptions };\n\nexport const createElasticsearchClient = (options: ElasticsearchClientOptions): Client => {\n const key = createClientKey(options);\n const existing = clients.get(key);\n if (existing) {\n return existing;\n }\n\n const cached = (): Client => {\n const { endpoint, node, ...rest } = options;\n\n let clientOptions: ClientOptions = {\n node: endpoint || node,\n ...rest\n };\n\n if (!clientOptions.auth) {\n const region = String(process.env.AWS_REGION);\n\n const credentials = {\n accessKeyId: process.env.AWS_ACCESS_KEY_ID,\n secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,\n sessionToken: process.env.AWS_SESSION_TOKEN\n };\n\n const errors = Object.keys(credentials).filter(key => {\n const value = credentials[key as keyof typeof credentials];\n return !value;\n });\n if (errors.length > 0) {\n throw new WebinyError(\n `Missing keys values: ${errors.join(\", \")}`,\n \"MISSING_AWS_CREDENTIALS\"\n );\n }\n\n clientOptions = {\n ...clientOptions,\n ...createAwsElasticsearchConnector({\n region,\n // @ts-expect-error\n credentials\n })\n };\n }\n\n try {\n return new Client(clientOptions);\n } catch (ex) {\n const data = {\n error: ex,\n node: endpoint || node,\n ...rest,\n auth: undefined\n };\n console.error({\n ...data\n });\n throw new WebinyError(\n \"Could not connect to Elasticsearch.\",\n \"ELASTICSEARCH_CLIENT_ERROR\",\n data\n );\n }\n };\n\n const client = cached();\n\n clients.set(key, client);\n return client;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,0BAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AAMA,MAAMI,OAAO,GAAG,IAAIC,GAAG,CAAiB,CAAC;AAEzC,MAAMC,eAAe,GAAIC,OAAmC,IAAK;EAC7D,MAAMC,GAAG,GAAGC,IAAI,CAACC,SAAS,CAACH,OAAO,CAAC;EACnC,MAAMI,IAAI,GAAGC,eAAM,CAACC,UAAU,CAAC,MAAM,CAAC;EACtCF,IAAI,CAACG,MAAM,CAACN,GAAG,CAAC;EAChB,OAAOG,IAAI,CAACI,MAAM,CAAC,KAAK,CAAC;AAC7B,CAAC;AAIM,MAAMC,yBAAyB,GAAIT,OAAmC,IAAa;EACtF,MAAMC,GAAG,GAAGF,eAAe,CAACC,OAAO,CAAC;EACpC,MAAMU,QAAQ,GAAGb,OAAO,CAACc,GAAG,CAACV,GAAG,CAAC;EACjC,IAAIS,QAAQ,EAAE;IACV,OAAOA,QAAQ;EACnB;EAEA,MAAME,MAAM,GAAGA,CAAA,KAAc;IACzB,MAAM;MAAEC,QAAQ;MAAEC,IAAI;MAAE,GAAGC;IAAK,CAAC,GAAGf,OAAO;IAE3C,IAAIgB,aAA4B,GAAG;MAC/BF,IAAI,EAAED,QAAQ,IAAIC,IAAI;MACtB,GAAGC;IACP,CAAC;IAED,IAAI,CAACC,aAAa,CAACC,IAAI,EAAE;MACrB,MAAMC,MAAM,GAAGC,MAAM,CAACC,OAAO,CAACC,GAAG,CAACC,UAAU,CAAC;MAE7C,MAAMC,WAAW,GAAG;QAChBC,WAAW,EAAEJ,OAAO,CAACC,GAAG,CAACI,iBAAiB;QAC1CC,eAAe,EAAEN,OAAO,CAACC,GAAG,CAACM,qBAAqB;QAClDC,YAAY,EAAER,OAAO,CAACC,GAAG,CAACQ;MAC9B,CAAC;MAED,MAAMC,MAAM,GAAGC,MAAM,CAACC,IAAI,CAACT,WAAW,CAAC,CAACU,MAAM,CAAChC,GAAG,IAAI;QAClD,MAAMiC,KAAK,GAAGX,WAAW,CAACtB,GAAG,CAA6B;QAC1D,OAAO,CAACiC,KAAK;MACjB,CAAC,CAAC;MACF,IAAIJ,MAAM,CAACK,MAAM,GAAG,CAAC,EAAE;QACnB,MAAM,IAAIC,cAAW,CAChB,wBAAuBN,MAAM,CAACO,IAAI,CAAC,IAAI,CAAE,EAAC,EAC3C,yBACJ,CAAC;MACL;MAEArB,aAAa,GAAG;QACZ,GAAGA,aAAa;QAChB,GAAG,IAAAsB,kCAA+B,EAAC;UAC/BpB,MAAM;UACN;UACAK;QACJ,CAAC;MACL,CAAC;IACL;IAEA,IAAI;MACA,OAAO,IAAIgB,qBAAM,CAACvB,aAAa,CAAC;IACpC,CAAC,CAAC,OAAOwB,EAAE,EAAE;MACT,MAAMC,IAAI,GAAG;QACTC,KAAK,EAAEF,EAAE;QACT1B,IAAI,EAAED,QAAQ,IAAIC,IAAI;QACtB,GAAGC,IAAI;QACPE,IAAI,EAAE0B;MACV,CAAC;MACDC,OAAO,CAACF,KAAK,CAAC;QACV,GAAGD;MACP,CAAC,CAAC;MACF,MAAM,IAAIL,cAAW,CACjB,qCAAqC,EACrC,4BAA4B,EAC5BK,IACJ,CAAC;IACL;EACJ,CAAC;EAED,MAAMI,MAAM,GAAGjC,MAAM,CAAC,CAAC;EAEvBf,OAAO,CAACiD,GAAG,CAAC7C,GAAG,EAAE4C,MAAM,CAAC;EACxB,OAAOA,MAAM;AACjB,CAAC;AAACE,OAAA,CAAAtC,yBAAA,GAAAA,yBAAA","ignoreList":[]}
package/index.d.ts CHANGED
@@ -14,6 +14,7 @@ export * from "./operators";
14
14
  export * from "./cursors";
15
15
  export * from "./client";
16
16
  export * from "./utils";
17
+ export * from "./operations";
17
18
  export { createGzipCompression } from "./plugins/GzipCompression";
18
19
  /**
19
20
  * We must accept either Elasticsearch client or options that create the client.
package/index.js CHANGED
@@ -161,6 +161,18 @@ Object.keys(_utils).forEach(function (key) {
161
161
  }
162
162
  });
163
163
  });
164
+ var _operations = require("./operations");
165
+ Object.keys(_operations).forEach(function (key) {
166
+ if (key === "default" || key === "__esModule") return;
167
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
168
+ if (key in exports && exports[key] === _operations[key]) return;
169
+ Object.defineProperty(exports, key, {
170
+ enumerable: true,
171
+ get: function () {
172
+ return _operations[key];
173
+ }
174
+ });
175
+ });
164
176
  var _GzipCompression = require("./plugins/GzipCompression");
165
177
  /**
166
178
  * TODO File should contain only exports from other files.
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_api","_client","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_operators","_elasticsearch","_indexConfiguration","_plugins","_sort","_indices","_where","_limit","_normalize","_compression","_cursors","_utils","_GzipCompression","_default","params","ContextPlugin","context","elasticsearch","WebinyError","Client","createElasticsearchClient","plugins","register","getElasticsearchOperators","default"],"sources":["index.ts"],"sourcesContent":["/**\n * TODO File should contain only exports from other files.\n */\nimport WebinyError from \"@webiny/error\";\nimport { ElasticsearchContext } from \"~/types\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { createElasticsearchClient, ElasticsearchClientOptions } from \"~/client\";\nimport { getElasticsearchOperators } from \"~/operators\";\nimport { Client } from \"@elastic/elasticsearch\";\n\nexport * from \"./indexConfiguration\";\nexport * from \"./plugins\";\nexport * from \"./sort\";\nexport * from \"./indices\";\nexport * from \"./where\";\nexport * from \"./limit\";\nexport * from \"./normalize\";\nexport * from \"./compression\";\nexport * from \"./operators\";\nexport * from \"./cursors\";\nexport * from \"./client\";\nexport * from \"./utils\";\nexport { createGzipCompression } from \"./plugins/GzipCompression\";\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 \"ELASTICSEARCH_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":";;;;;;;;;;;;;;;;AAGA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAcAG,MAAA,CAAAC,IAAA,CAAAF,OAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,OAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,OAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAbA,IAAAS,UAAA,GAAAf,OAAA;AAWAG,MAAA,CAAAC,IAAA,CAAAW,UAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAS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IC,cAAW,CACjB,yHAAyH,EACzH,mCACJ,CAAC;IACL;IACA;AACR;AACA;IACQF,OAAO,CAACC,aAAa,GACjBH,MAAM,YAAYK,qBAAM,GAAGL,MAAM,GAAG,IAAAM,iCAAyB,EAACN,MAAM,CAAC;IAEzEE,OAAO,CAACK,OAAO,CAACC,QAAQ,CAAC,IAAAC,oCAAyB,EAAC,CAAC,CAAC;EACzD,CAAC,CAAC;AACN,CAAC;AAAA3B,OAAA,CAAA4B,OAAA,GAAAX,QAAA","ignoreList":[]}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_api","_client","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_operators","_elasticsearch","_indexConfiguration","_plugins","_sort","_indices","_where","_limit","_normalize","_compression","_cursors","_utils","_operations","_GzipCompression","_default","params","ContextPlugin","context","elasticsearch","WebinyError","Client","createElasticsearchClient","plugins","register","getElasticsearchOperators","default"],"sources":["index.ts"],"sourcesContent":["/**\n * TODO File should contain only exports from other files.\n */\nimport WebinyError from \"@webiny/error\";\nimport { ElasticsearchContext } from \"~/types\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { createElasticsearchClient, ElasticsearchClientOptions } from \"~/client\";\nimport { getElasticsearchOperators } from \"~/operators\";\nimport { Client } from \"@elastic/elasticsearch\";\n\nexport * from \"./indexConfiguration\";\nexport * from \"./plugins\";\nexport * from \"./sort\";\nexport * from \"./indices\";\nexport * from \"./where\";\nexport * from \"./limit\";\nexport * from \"./normalize\";\nexport * from \"./compression\";\nexport * from \"./operators\";\nexport * from \"./cursors\";\nexport * from \"./client\";\nexport * from \"./utils\";\nexport * from \"./operations\";\nexport { createGzipCompression } from \"./plugins/GzipCompression\";\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 \"ELASTICSEARCH_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":";;;;;;;;;;;;;;;;AAGA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAcAG,MAAA,CAAAC,IAAA,CAAAF,OAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,OAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,OAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAbA,IAAAS,UAAA,GAAAf,OAAA;AAWAG,MAAA,CAAAC,IAAA,CAAAW,UAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAS,UAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,UAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AAVA,IAAAU,cAAA,GAAAhB,OAA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AAA,OAAAa,WAAA,CAAArB,GAAA;IAAA;EAAA;AAAA;AACA,IAAAsB,gBAAA,GAAA5B,OAAA;AAvBA;AACA;AACA;AAuBA;AACA;AACA;AAFA,IAAA6B,QAAA,GAIIC,MAA2C,IACL;EACtC,OAAO,IAAIC,kBAAa,CAAuBC,OAAO,IAAI;IACtD,IAAIA,OAAO,CAACC,aAAa,EAAE;MACvB,MAAM,IAAIC,cAAW,CACjB,yHAAyH,EACzH,mCACJ,CAAC;IACL;IACA;AACR;AACA;IACQF,OAAO,CAACC,aAAa,GACjBH,MAAM,YAAYK,qBAAM,GAAGL,MAAM,GAAG,IAAAM,iCAAyB,EAACN,MAAM,CAAC;IAEzEE,OAAO,CAACK,OAAO,CAACC,QAAQ,CAAC,IAAAC,oCAAyB,EAAC,CAAC,CAAC;EACzD,CAAC,CAAC;AACN,CAAC;AAAA5B,OAAA,CAAA6B,OAAA,GAAAX,QAAA","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ import { Client } from "../client";
2
+ import { IElasticsearchCatHealthResponse } from "./types";
3
+ export declare class ElasticsearchCatHealth {
4
+ private readonly client;
5
+ constructor(client: Client);
6
+ getHealth(): Promise<IElasticsearchCatHealthResponse>;
7
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ElasticsearchCatHealth = void 0;
7
+ var _error = require("@webiny/error");
8
+ var _stripConnectionFromException = require("./stripConnectionFromException");
9
+ class ElasticsearchCatHealth {
10
+ constructor(client) {
11
+ this.client = client;
12
+ }
13
+ async getHealth() {
14
+ try {
15
+ const response = await this.client.cat.health({
16
+ format: "json"
17
+ });
18
+ if (!Array.isArray(response.body) || response.body.length === 0) {
19
+ throw new _error.WebinyError({
20
+ message: `There is no valid response from cat.health operation.`,
21
+ code: "ELASTICSEARCH_HEALTH_INVALID_RESPONSE",
22
+ data: response.body
23
+ });
24
+ }
25
+ return {
26
+ ...response.body[0]
27
+ };
28
+ } catch (ex) {
29
+ console.error(`Could not fetch cluster health information: ${ex.message}`);
30
+ const error = (0, _stripConnectionFromException.stripConnectionFromException)(ex);
31
+ console.log(JSON.stringify(error));
32
+ throw error;
33
+ }
34
+ }
35
+ }
36
+ exports.ElasticsearchCatHealth = ElasticsearchCatHealth;
37
+
38
+ //# sourceMappingURL=ElasticsearchCatHealth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_error","require","_stripConnectionFromException","ElasticsearchCatHealth","constructor","client","getHealth","response","cat","health","format","Array","isArray","body","length","WebinyError","message","code","data","ex","console","error","stripConnectionFromException","log","JSON","stringify","exports"],"sources":["ElasticsearchCatHealth.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport { Client } from \"~/client\";\nimport { IElasticsearchCatHealthResponse } from \"./types\";\nimport { stripConnectionFromException } from \"~/operations/stripConnectionFromException\";\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: \"ELASTICSEARCH_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,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,6BAAA,GAAAD,OAAA;AAEO,MAAME,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,IAAIC,kBAAW,CAAC;UAClBC,OAAO,EAAG,uDAAsD;UAChEC,IAAI,EAAE,uCAAuC;UAC7CC,IAAI,EAAEX,QAAQ,CAACM;QACnB,CAAC,CAAC;MACN;MAEA,OAAO;QACH,GAAGN,QAAQ,CAACM,IAAI,CAAC,CAAC;MACtB,CAAC;IACL,CAAC,CAAC,OAAOM,EAAE,EAAE;MACTC,OAAO,CAACC,KAAK,CAAE,+CAA8CF,EAAE,CAACH,OAAQ,EAAC,CAAC;MAC1E,MAAMK,KAAK,GAAG,IAAAC,0DAA4B,EAACH,EAAE,CAAC;MAC9CC,OAAO,CAACG,GAAG,CAACC,IAAI,CAACC,SAAS,CAACJ,KAAK,CAAC,CAAC;MAClC,MAAMA,KAAK;IACf;EACJ;AACJ;AAACK,OAAA,CAAAvB,sBAAA,GAAAA,sBAAA","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ import { IElasticsearchCatNodesResponse } from "./types";
2
+ import { Client } from "../client";
3
+ export declare class ElasticsearchCatNodes {
4
+ private readonly client;
5
+ constructor(client: Client);
6
+ getNodes(): Promise<IElasticsearchCatNodesResponse>;
7
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ElasticsearchCatNodes = void 0;
7
+ var _error = require("@webiny/error");
8
+ var _stripConnectionFromException = require("./stripConnectionFromException");
9
+ class ElasticsearchCatNodes {
10
+ constructor(client) {
11
+ this.client = client;
12
+ }
13
+ async getNodes() {
14
+ try {
15
+ const response = await this.client.cat.nodes({
16
+ format: "json"
17
+ });
18
+ if (!Array.isArray(response.body) || response.body.length === 0) {
19
+ throw new _error.WebinyError({
20
+ message: `There is no valid response from cat.nodes operation.`,
21
+ code: "ELASTICSEARCH_NODES_INVALID_RESPONSE",
22
+ data: response.body
23
+ });
24
+ }
25
+ return response.body;
26
+ } catch (ex) {
27
+ console.error(`Could not fetch cluster nodes information: ${ex.message}`);
28
+ const error = (0, _stripConnectionFromException.stripConnectionFromException)(ex);
29
+ console.log(JSON.stringify(error));
30
+ throw error;
31
+ }
32
+ }
33
+ }
34
+ exports.ElasticsearchCatNodes = ElasticsearchCatNodes;
35
+
36
+ //# sourceMappingURL=ElasticsearchCatNodes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_error","require","_stripConnectionFromException","ElasticsearchCatNodes","constructor","client","getNodes","response","cat","nodes","format","Array","isArray","body","length","WebinyError","message","code","data","ex","console","error","stripConnectionFromException","log","JSON","stringify","exports"],"sources":["ElasticsearchCatNodes.ts"],"sourcesContent":["import { IElasticsearchCatNodesResponse } from \"./types\";\nimport { Client } from \"~/client\";\nimport { WebinyError } from \"@webiny/error\";\nimport { stripConnectionFromException } from \"~/operations/stripConnectionFromException\";\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: \"ELASTICSEARCH_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,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,6BAAA,GAAAD,OAAA;AAEO,MAAME,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,IAAIC,kBAAW,CAAC;UAClBC,OAAO,EAAG,sDAAqD;UAC/DC,IAAI,EAAE,sCAAsC;UAC5CC,IAAI,EAAEX,QAAQ,CAACM;QACnB,CAAC,CAAC;MACN;MACA,OAAON,QAAQ,CAACM,IAAI;IACxB,CAAC,CAAC,OAAOM,EAAE,EAAE;MACTC,OAAO,CAACC,KAAK,CAAE,8CAA6CF,EAAE,CAACH,OAAQ,EAAC,CAAC;MACzE,MAAMK,KAAK,GAAG,IAAAC,0DAA4B,EAACH,EAAE,CAAC;MAC9CC,OAAO,CAACG,GAAG,CAACC,IAAI,CAACC,SAAS,CAACJ,KAAK,CAAC,CAAC;MAClC,MAAMA,KAAK;IACf;EACJ;AACJ;AAACK,OAAA,CAAAvB,qBAAA,GAAAA,qBAAA","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ export * from "./ElasticsearchCatHealth";
2
+ export * from "./ElasticsearchCatNodes";
3
+ export * from "./types";
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
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
+ });
39
+
40
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_ElasticsearchCatHealth","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_ElasticsearchCatNodes","_types"],"sources":["index.ts"],"sourcesContent":["export * from \"./ElasticsearchCatHealth\";\nexport * from \"./ElasticsearchCatNodes\";\nexport * from \"./types\";\n"],"mappings":";;;;;AAAA,IAAAA,uBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,uBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,uBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,uBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,sBAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,sBAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,sBAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,sBAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,MAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,MAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,MAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,MAAA,CAAAN,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export declare const stripConnectionFromException: (ex: any) => any;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.stripConnectionFromException = void 0;
7
+ const stripConnectionFromException = ex => {
8
+ if (typeof ex !== "object") {
9
+ return ex;
10
+ }
11
+ if (!ex?.meta?.meta?.connection) {
12
+ return ex;
13
+ }
14
+ return {
15
+ ...ex.meta,
16
+ meta: {
17
+ ...ex.meta.meta,
18
+ connection: null
19
+ }
20
+ };
21
+ };
22
+ exports.stripConnectionFromException = stripConnectionFromException;
23
+
24
+ //# sourceMappingURL=stripConnectionFromException.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["stripConnectionFromException","ex","meta","connection","exports"],"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":";;;;;;AAAO,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;AAACC,OAAA,CAAAJ,4BAAA,GAAAA,4BAAA","ignoreList":[]}
@@ -0,0 +1,35 @@
1
+ export declare enum ElasticsearchCatClusterHealthStatus {
2
+ Green = "green",
3
+ Yellow = "yellow",
4
+ Red = "red"
5
+ }
6
+ export interface IElasticsearchCatHealthResponse {
7
+ epoch: number;
8
+ timestamp: `${number}:${number}:${number}`;
9
+ cluster: string;
10
+ status: ElasticsearchCatClusterHealthStatus;
11
+ "node.total": `${number}`;
12
+ "node.data": `${number}`;
13
+ shards: `${number}`;
14
+ pri: `${number}`;
15
+ relo: `${number}`;
16
+ init: `${number}`;
17
+ unassign: `${number}`;
18
+ pending_tasks: `${number}`;
19
+ max_task_wait_time: string;
20
+ active_shards_percent: `${number}%`;
21
+ discovered_cluster_manager?: `${boolean}`;
22
+ }
23
+ export interface IElasticsearchCatNodeResponse {
24
+ ip: string;
25
+ "heap.percent": `${number}`;
26
+ "ram.percent": `${number}`;
27
+ cpu: `${number}`;
28
+ load_1m: `${number}` | null;
29
+ load_5m: `${number}` | null;
30
+ load_15m: `${number}` | null;
31
+ "node.role": string;
32
+ master?: string;
33
+ name: string;
34
+ }
35
+ export declare type IElasticsearchCatNodesResponse = IElasticsearchCatNodeResponse[];
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ElasticsearchCatClusterHealthStatus = void 0;
7
+ let ElasticsearchCatClusterHealthStatus = exports.ElasticsearchCatClusterHealthStatus = /*#__PURE__*/function (ElasticsearchCatClusterHealthStatus) {
8
+ ElasticsearchCatClusterHealthStatus["Green"] = "green";
9
+ ElasticsearchCatClusterHealthStatus["Yellow"] = "yellow";
10
+ ElasticsearchCatClusterHealthStatus["Red"] = "red";
11
+ return ElasticsearchCatClusterHealthStatus;
12
+ }({});
13
+
14
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ElasticsearchCatClusterHealthStatus","exports"],"sources":["types.ts"],"sourcesContent":["export enum ElasticsearchCatClusterHealthStatus {\n Green = \"green\",\n Yellow = \"yellow\",\n Red = \"red\"\n}\n\nexport interface IElasticsearchCatHealthResponse {\n epoch: number;\n timestamp: `${number}:${number}:${number}`;\n cluster: string;\n status: ElasticsearchCatClusterHealthStatus;\n \"node.total\": `${number}`;\n \"node.data\": `${number}`;\n shards: `${number}`;\n pri: `${number}`;\n relo: `${number}`;\n init: `${number}`;\n unassign: `${number}`;\n pending_tasks: `${number}`;\n max_task_wait_time: string;\n active_shards_percent: `${number}%`;\n discovered_cluster_manager?: `${boolean}`;\n}\n\nexport interface IElasticsearchCatNodeResponse {\n ip: string;\n \"heap.percent\": `${number}`;\n \"ram.percent\": `${number}`;\n cpu: `${number}`;\n load_1m: `${number}` | null;\n load_5m: `${number}` | null;\n load_15m: `${number}` | null;\n \"node.role\": string;\n master?: string;\n name: string;\n}\n\nexport type IElasticsearchCatNodesResponse = IElasticsearchCatNodeResponse[];\n"],"mappings":";;;;;;IAAYA,mCAAmC,GAAAC,OAAA,CAAAD,mCAAA,0BAAnCA,mCAAmC;EAAnCA,mCAAmC;EAAnCA,mCAAmC;EAAnCA,mCAAmC;EAAA,OAAnCA,mCAAmC;AAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-elasticsearch",
3
- "version": "5.40.0-beta.5",
3
+ "version": "5.40.0-beta.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/webiny/webiny-js.git",
@@ -13,18 +13,18 @@
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
15
  "@elastic/elasticsearch": "7.12.0",
16
- "@webiny/api": "5.40.0-beta.5",
17
- "@webiny/error": "5.40.0-beta.5",
18
- "@webiny/plugins": "5.40.0-beta.5",
19
- "@webiny/utils": "5.40.0-beta.5",
16
+ "@webiny/api": "5.40.0-beta.6",
17
+ "@webiny/error": "5.40.0-beta.6",
18
+ "@webiny/plugins": "5.40.0-beta.6",
19
+ "@webiny/utils": "5.40.0-beta.6",
20
20
  "aws-elasticsearch-connector": "9.2.0",
21
21
  "elastic-ts": "0.8.0"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@babel/cli": "7.24.1",
25
25
  "@babel/core": "7.24.3",
26
- "@webiny/cli": "5.40.0-beta.5",
27
- "@webiny/project-utils": "5.40.0-beta.5",
26
+ "@webiny/cli": "5.40.0-beta.6",
27
+ "@webiny/project-utils": "5.40.0-beta.6",
28
28
  "rimraf": "5.0.5",
29
29
  "ttypescript": "1.5.15",
30
30
  "typescript": "4.7.4"
@@ -37,5 +37,5 @@
37
37
  "build": "yarn webiny run build",
38
38
  "watch": "yarn webiny run watch"
39
39
  },
40
- "gitHead": "04482b686c63fdadebd4c6c1db7595af1140cfc7"
40
+ "gitHead": "e6ce53a387a9b1ab39aa8d15e4ed9be2359f17aa"
41
41
  }
package/utils/index.d.ts CHANGED
@@ -1 +1,3 @@
1
+ export * from "./waitUntilHealthy";
1
2
  export * from "./createIndex";
3
+ export * from "./waitUntilHealthy";
package/utils/index.js CHANGED
@@ -3,6 +3,17 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
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
+ });
6
17
  var _createIndex = require("./createIndex");
7
18
  Object.keys(_createIndex).forEach(function (key) {
8
19
  if (key === "default" || key === "__esModule") return;
@@ -1 +1 @@
1
- {"version":3,"names":["_createIndex","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["index.ts"],"sourcesContent":["export * from \"./createIndex\";\n"],"mappings":";;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,YAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,YAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,YAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["_waitUntilHealthy","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_createIndex"],"sources":["index.ts"],"sourcesContent":["export * from \"./waitUntilHealthy\";\nexport * from \"./createIndex\";\nexport * from \"./waitUntilHealthy\";\n"],"mappings":";;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEAC,MAAA,CAAAC,IAAA,CAAAH,iBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,iBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,iBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AADA,IAAAK,YAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,YAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,YAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,YAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ import { WebinyError } from "@webiny/error";
2
+ export declare class UnhealthyClusterError extends WebinyError {
3
+ constructor(maxWaitingTime: number);
4
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
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 {
9
+ constructor(maxWaitingTime) {
10
+ super({
11
+ message: `Cluster did not become healthy in ${maxWaitingTime} seconds.`,
12
+ code: "UNHEALTHY_CLUSTER"
13
+ });
14
+ }
15
+ }
16
+ exports.UnhealthyClusterError = UnhealthyClusterError;
17
+
18
+ //# sourceMappingURL=UnhealthyClusterError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_error","require","UnhealthyClusterError","WebinyError","constructor","maxWaitingTime","message","code","exports"],"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,IAAAA,MAAA,GAAAC,OAAA;AAEO,MAAMC,qBAAqB,SAASC,kBAAW,CAAC;EAC5CC,WAAWA,CAACC,cAAsB,EAAE;IACvC,KAAK,CAAC;MACFC,OAAO,EAAG,qCAAoCD,cAAe,WAAU;MACvEE,IAAI,EAAE;IACV,CAAC,CAAC;EACN;AACJ;AAACC,OAAA,CAAAN,qBAAA,GAAAA,qBAAA","ignoreList":[]}
@@ -0,0 +1,71 @@
1
+ import { Client } from "../../client";
2
+ import { ElasticsearchCatClusterHealthStatus } from "../../operations/types";
3
+ import { ClusterHealthReason, MemoryReason, ProcessorReason } from "./reason";
4
+ export declare type WaitingReason = ProcessorReason | MemoryReason | ClusterHealthReason;
5
+ export interface IWaitUntilHealthyParams {
6
+ /**
7
+ * Minimum status allowed, otherwise the cluster is considered unhealthy.
8
+ */
9
+ minClusterHealthStatus: ElasticsearchCatClusterHealthStatus.Green | ElasticsearchCatClusterHealthStatus.Yellow;
10
+ /**
11
+ * Maximum processor percent allowed, otherwise the cluster is considered unhealthy.
12
+ */
13
+ maxProcessorPercent: number;
14
+ /**
15
+ * Maximum RAM percent allowed, otherwise the cluster is considered unhealthy.
16
+ */
17
+ maxRamPercent?: number;
18
+ /**
19
+ * Maximum time to wait in seconds.
20
+ * This is to prevent infinite waiting in case the cluster never becomes healthy.
21
+ */
22
+ maxWaitingTime: number;
23
+ /**
24
+ * Time in seconds to wait between each check.
25
+ * This is to prevent spamming the cluster with requests.
26
+ * Default is WAITING_TIME_STEP seconds.
27
+ */
28
+ waitingTimeStep?: number;
29
+ }
30
+ export interface IWaitOptionsOnUnhealthyParams {
31
+ startedAt: Date;
32
+ mustEndAt: Date;
33
+ waitingTimeStep: number;
34
+ runs: number;
35
+ waitingReason: WaitingReason;
36
+ }
37
+ export interface IWaitOptionsOnTimeoutParams {
38
+ startedAt: Date;
39
+ mustEndAt: Date;
40
+ waitingTimeStep: number;
41
+ runs: number;
42
+ waitingReason: WaitingReason;
43
+ }
44
+ export interface IWaitOptions {
45
+ onUnhealthy?(params: IWaitOptionsOnUnhealthyParams): Promise<void>;
46
+ onTimeout?(params: IWaitOptionsOnTimeoutParams): Promise<void>;
47
+ }
48
+ export interface IWaitUntilHealthyWaitResponse {
49
+ runningTime: number;
50
+ runs: number;
51
+ }
52
+ declare class WaitUntilHealthy {
53
+ private readonly client;
54
+ private readonly options;
55
+ private readonly catHealth;
56
+ private readonly catNodes;
57
+ private aborted;
58
+ constructor(client: Client, options: IWaitUntilHealthyParams);
59
+ abort(): void;
60
+ /**
61
+ * @throws UnhealthyClusterError
62
+ * @throws WaitingHealthyClusterAbortedError
63
+ */
64
+ wait(options?: IWaitOptions): Promise<IWaitUntilHealthyWaitResponse>;
65
+ private shouldWait;
66
+ private getProcessorPercent;
67
+ private getRamPercent;
68
+ private transformClusterHealthStatus;
69
+ }
70
+ export type { WaitUntilHealthy };
71
+ export declare const createWaitUntilHealthy: (client: Client, params: IWaitUntilHealthyParams) => WaitUntilHealthy;
@@ -0,0 +1,157 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createWaitUntilHealthy = void 0;
7
+ var _ElasticsearchCatHealth = require("../../operations/ElasticsearchCatHealth");
8
+ var _ElasticsearchCatNodes = require("../../operations/ElasticsearchCatNodes");
9
+ var _types = require("../../operations/types");
10
+ var _UnhealthyClusterError = require("./UnhealthyClusterError");
11
+ var _reason = require("./reason");
12
+ var _WaitingHealthyClusterAbortedError = require("./WaitingHealthyClusterAbortedError");
13
+ const WAITING_TIME_STEP = 10;
14
+ class WaitUntilHealthy {
15
+ aborted = false;
16
+ constructor(client, options) {
17
+ this.client = client;
18
+ this.options = options;
19
+ this.catHealth = new _ElasticsearchCatHealth.ElasticsearchCatHealth(this.client);
20
+ this.catNodes = new _ElasticsearchCatNodes.ElasticsearchCatNodes(this.client);
21
+ }
22
+ abort() {
23
+ this.aborted = true;
24
+ }
25
+ /**
26
+ * @throws UnhealthyClusterError
27
+ * @throws WaitingHealthyClusterAbortedError
28
+ */
29
+ async wait(options) {
30
+ if (this.aborted) {
31
+ throw new _WaitingHealthyClusterAbortedError.WaitingHealthyClusterAbortedError(`Waiting for the cluster to become healthy was aborted even before it started.`);
32
+ }
33
+ const startedAt = new Date();
34
+ const mustEndAt = new Date(startedAt.getTime() + this.options.maxWaitingTime * 1000);
35
+ const waitingTimeStep = this.options.waitingTimeStep || WAITING_TIME_STEP;
36
+ let runs = 1;
37
+ let waitingReason;
38
+ while (waitingReason = await this.shouldWait()) {
39
+ if (new Date() >= mustEndAt) {
40
+ if (options?.onTimeout) {
41
+ await options.onTimeout({
42
+ startedAt,
43
+ mustEndAt,
44
+ waitingTimeStep,
45
+ waitingReason,
46
+ runs
47
+ });
48
+ }
49
+ throw new _UnhealthyClusterError.UnhealthyClusterError(this.options.maxWaitingTime);
50
+ } else if (options?.onUnhealthy) {
51
+ await options.onUnhealthy({
52
+ startedAt,
53
+ mustEndAt,
54
+ waitingTimeStep,
55
+ waitingReason,
56
+ runs
57
+ });
58
+ }
59
+ /**
60
+ * Abort check is separated from other IFs because it can be aborted in onUnhealthy callback.
61
+ */
62
+ if (this.aborted) {
63
+ throw new _WaitingHealthyClusterAbortedError.WaitingHealthyClusterAbortedError();
64
+ }
65
+ runs++;
66
+ await new Promise(resolve => {
67
+ setTimeout(resolve, waitingTimeStep * 1000);
68
+ });
69
+ }
70
+ const runningTime = new Date().getTime() - startedAt.getTime();
71
+ return {
72
+ runningTime,
73
+ runs
74
+ };
75
+ }
76
+ async shouldWait() {
77
+ let health;
78
+ let nodes;
79
+ try {
80
+ health = await this.catHealth.getHealth();
81
+ } catch (ex) {
82
+ return (0, _reason.createClusterHealthStatusReason)({
83
+ description: ex.message,
84
+ minimum: this.options.minClusterHealthStatus,
85
+ current: _types.ElasticsearchCatClusterHealthStatus.Red
86
+ });
87
+ }
88
+ try {
89
+ nodes = await this.catNodes.getNodes();
90
+ } catch (ex) {
91
+ return (0, _reason.createClusterHealthStatusReason)({
92
+ description: ex.message,
93
+ minimum: this.options.minClusterHealthStatus,
94
+ current: _types.ElasticsearchCatClusterHealthStatus.Red
95
+ });
96
+ }
97
+ const clusterHealthStatus = this.transformClusterHealthStatus(health.status);
98
+ const minClusterHealthStatus = this.transformClusterHealthStatus(this.options.minClusterHealthStatus);
99
+ if (clusterHealthStatus > minClusterHealthStatus) {
100
+ return (0, _reason.createClusterHealthStatusReason)({
101
+ minimum: this.options.minClusterHealthStatus,
102
+ current: health.status
103
+ });
104
+ }
105
+ const processorPercent = this.getProcessorPercent(nodes);
106
+ if (processorPercent > this.options.maxProcessorPercent) {
107
+ return (0, _reason.createProcessorReason)({
108
+ maximum: this.options.maxProcessorPercent,
109
+ current: processorPercent
110
+ });
111
+ }
112
+ /**
113
+ * Possibly no max ram definition?
114
+ */
115
+ if (this.options.maxRamPercent === undefined) {
116
+ return false;
117
+ }
118
+ const ramPercent = this.getRamPercent(nodes);
119
+ if (ramPercent > this.options.maxRamPercent) {
120
+ return (0, _reason.createMemoryReason)({
121
+ maximum: this.options.maxRamPercent,
122
+ current: ramPercent
123
+ });
124
+ }
125
+ return false;
126
+ }
127
+ getProcessorPercent(nodes) {
128
+ const total = nodes.reduce((total, node) => {
129
+ return total + parseFloat(node.cpu);
130
+ }, 0);
131
+ return total / nodes.length;
132
+ }
133
+ getRamPercent(nodes) {
134
+ const total = nodes.reduce((total, node) => {
135
+ return total + parseFloat(node["ram.percent"]);
136
+ }, 0);
137
+ return total / nodes.length;
138
+ }
139
+ transformClusterHealthStatus(status) {
140
+ switch (status) {
141
+ case _types.ElasticsearchCatClusterHealthStatus.Green:
142
+ return 1;
143
+ case _types.ElasticsearchCatClusterHealthStatus.Yellow:
144
+ return 2;
145
+ case _types.ElasticsearchCatClusterHealthStatus.Red:
146
+ return 3;
147
+ default:
148
+ return 99;
149
+ }
150
+ }
151
+ }
152
+ const createWaitUntilHealthy = (client, params) => {
153
+ return new WaitUntilHealthy(client, params);
154
+ };
155
+ exports.createWaitUntilHealthy = createWaitUntilHealthy;
156
+
157
+ //# sourceMappingURL=WaitUntilHealthy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_ElasticsearchCatHealth","require","_ElasticsearchCatNodes","_types","_UnhealthyClusterError","_reason","_WaitingHealthyClusterAbortedError","WAITING_TIME_STEP","WaitUntilHealthy","aborted","constructor","client","options","catHealth","ElasticsearchCatHealth","catNodes","ElasticsearchCatNodes","abort","wait","WaitingHealthyClusterAbortedError","startedAt","Date","mustEndAt","getTime","maxWaitingTime","waitingTimeStep","runs","waitingReason","shouldWait","onTimeout","UnhealthyClusterError","onUnhealthy","Promise","resolve","setTimeout","runningTime","health","nodes","getHealth","ex","createClusterHealthStatusReason","description","message","minimum","minClusterHealthStatus","current","ElasticsearchCatClusterHealthStatus","Red","getNodes","clusterHealthStatus","transformClusterHealthStatus","status","processorPercent","getProcessorPercent","maxProcessorPercent","createProcessorReason","maximum","maxRamPercent","undefined","ramPercent","getRamPercent","createMemoryReason","total","reduce","node","parseFloat","cpu","length","Green","Yellow","createWaitUntilHealthy","params","exports"],"sources":["WaitUntilHealthy.ts"],"sourcesContent":["import { Client } from \"~/client\";\nimport { ElasticsearchCatHealth } from \"~/operations/ElasticsearchCatHealth\";\nimport { ElasticsearchCatNodes } from \"~/operations/ElasticsearchCatNodes\";\nimport {\n ElasticsearchCatClusterHealthStatus,\n IElasticsearchCatHealthResponse,\n IElasticsearchCatNodesResponse\n} from \"~/operations/types\";\nimport { UnhealthyClusterError } from \"~/utils/waitUntilHealthy/UnhealthyClusterError\";\nimport {\n ClusterHealthReason,\n createClusterHealthStatusReason,\n createMemoryReason,\n createProcessorReason,\n MemoryReason,\n ProcessorReason\n} from \"./reason\";\nimport { WaitingHealthyClusterAbortedError } from \"./WaitingHealthyClusterAbortedError\";\n\nconst WAITING_TIME_STEP = 10;\n\nexport type WaitingReason = ProcessorReason | MemoryReason | ClusterHealthReason;\n\nexport interface IWaitUntilHealthyParams {\n /**\n * Minimum status allowed, otherwise the cluster is considered unhealthy.\n */\n minClusterHealthStatus:\n | ElasticsearchCatClusterHealthStatus.Green\n | ElasticsearchCatClusterHealthStatus.Yellow;\n /**\n * Maximum processor percent allowed, otherwise the cluster is considered unhealthy.\n */\n maxProcessorPercent: number;\n /**\n * Maximum RAM percent allowed, otherwise the cluster is considered unhealthy.\n */\n maxRamPercent?: number;\n /**\n * Maximum time to wait in seconds.\n * This is to prevent infinite waiting in case the cluster never becomes healthy.\n */\n maxWaitingTime: number;\n /**\n * Time in seconds to wait between each check.\n * This is to prevent spamming the cluster with requests.\n * Default is WAITING_TIME_STEP seconds.\n */\n waitingTimeStep?: number;\n}\n\nexport interface IWaitOptionsOnUnhealthyParams {\n startedAt: Date;\n mustEndAt: Date;\n waitingTimeStep: number;\n runs: number;\n waitingReason: WaitingReason;\n}\n\nexport interface IWaitOptionsOnTimeoutParams {\n startedAt: Date;\n mustEndAt: Date;\n waitingTimeStep: number;\n runs: number;\n waitingReason: WaitingReason;\n}\n\nexport interface IWaitOptions {\n onUnhealthy?(params: IWaitOptionsOnUnhealthyParams): Promise<void>;\n onTimeout?(params: IWaitOptionsOnTimeoutParams): Promise<void>;\n}\n\nexport interface IWaitUntilHealthyWaitResponse {\n runningTime: number;\n runs: number;\n}\n\nclass WaitUntilHealthy {\n private readonly client: Client;\n private readonly options: IWaitUntilHealthyParams;\n\n private readonly catHealth: ElasticsearchCatHealth;\n private readonly catNodes: ElasticsearchCatNodes;\n\n private aborted = false;\n\n public constructor(client: Client, options: IWaitUntilHealthyParams) {\n this.client = client;\n this.options = options;\n\n this.catHealth = new ElasticsearchCatHealth(this.client);\n this.catNodes = new ElasticsearchCatNodes(this.client);\n }\n\n public abort(): void {\n this.aborted = true;\n }\n /**\n * @throws UnhealthyClusterError\n * @throws WaitingHealthyClusterAbortedError\n */\n public async wait(options?: IWaitOptions): Promise<IWaitUntilHealthyWaitResponse> {\n if (this.aborted) {\n throw new WaitingHealthyClusterAbortedError(\n `Waiting for the cluster to become healthy was aborted even before it started.`\n );\n }\n const startedAt = new Date();\n const mustEndAt = new Date(startedAt.getTime() + this.options.maxWaitingTime * 1000);\n const waitingTimeStep = this.options.waitingTimeStep || WAITING_TIME_STEP;\n let runs = 1;\n let waitingReason: WaitingReason | false;\n while ((waitingReason = await this.shouldWait())) {\n if (new Date() >= mustEndAt) {\n if (options?.onTimeout) {\n await options.onTimeout({\n startedAt,\n mustEndAt,\n waitingTimeStep,\n waitingReason,\n runs\n });\n }\n throw new UnhealthyClusterError(this.options.maxWaitingTime);\n } else if (options?.onUnhealthy) {\n await options.onUnhealthy({\n startedAt,\n mustEndAt,\n waitingTimeStep,\n waitingReason,\n runs\n });\n }\n /**\n * Abort check is separated from other IFs because it can be aborted in onUnhealthy callback.\n */\n if (this.aborted) {\n throw new WaitingHealthyClusterAbortedError();\n }\n runs++;\n await new Promise(resolve => {\n setTimeout(resolve, waitingTimeStep * 1000);\n });\n }\n\n const runningTime = new Date().getTime() - startedAt.getTime();\n\n return {\n runningTime,\n runs\n };\n }\n\n private async shouldWait(): Promise<WaitingReason | false> {\n let health: IElasticsearchCatHealthResponse;\n let nodes: IElasticsearchCatNodesResponse;\n try {\n health = await this.catHealth.getHealth();\n } catch (ex) {\n return createClusterHealthStatusReason({\n description: ex.message,\n minimum: this.options.minClusterHealthStatus,\n current: ElasticsearchCatClusterHealthStatus.Red\n });\n }\n try {\n nodes = await this.catNodes.getNodes();\n } catch (ex) {\n return createClusterHealthStatusReason({\n description: ex.message,\n minimum: this.options.minClusterHealthStatus,\n current: ElasticsearchCatClusterHealthStatus.Red\n });\n }\n\n const clusterHealthStatus = this.transformClusterHealthStatus(health.status);\n const minClusterHealthStatus = this.transformClusterHealthStatus(\n this.options.minClusterHealthStatus\n );\n if (clusterHealthStatus > minClusterHealthStatus) {\n return createClusterHealthStatusReason({\n minimum: this.options.minClusterHealthStatus,\n current: health.status\n });\n }\n\n const processorPercent = this.getProcessorPercent(nodes);\n if (processorPercent > this.options.maxProcessorPercent) {\n return createProcessorReason({\n maximum: this.options.maxProcessorPercent,\n current: processorPercent\n });\n }\n /**\n * Possibly no max ram definition?\n */\n if (this.options.maxRamPercent === undefined) {\n return false;\n }\n\n const ramPercent = this.getRamPercent(nodes);\n if (ramPercent > this.options.maxRamPercent) {\n return createMemoryReason({\n maximum: this.options.maxRamPercent,\n current: ramPercent\n });\n }\n return false;\n }\n\n private getProcessorPercent(nodes: IElasticsearchCatNodesResponse): number {\n const total = nodes.reduce<number>((total, node) => {\n return total + parseFloat(node.cpu);\n }, 0);\n return total / nodes.length;\n }\n\n private getRamPercent(nodes: IElasticsearchCatNodesResponse): number {\n const total = nodes.reduce<number>((total, node) => {\n return total + parseFloat(node[\"ram.percent\"]);\n }, 0);\n return total / nodes.length;\n }\n\n private transformClusterHealthStatus(status: ElasticsearchCatClusterHealthStatus): number {\n switch (status) {\n case ElasticsearchCatClusterHealthStatus.Green:\n return 1;\n case ElasticsearchCatClusterHealthStatus.Yellow:\n return 2;\n case ElasticsearchCatClusterHealthStatus.Red:\n return 3;\n default:\n return 99;\n }\n }\n}\n\nexport type { WaitUntilHealthy };\n\nexport const createWaitUntilHealthy = (\n client: Client,\n params: IWaitUntilHealthyParams\n): WaitUntilHealthy => {\n return new WaitUntilHealthy(client, params);\n};\n"],"mappings":";;;;;;AACA,IAAAA,uBAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAKA,IAAAG,sBAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAQA,IAAAK,kCAAA,GAAAL,OAAA;AAEA,MAAMM,iBAAiB,GAAG,EAAE;AA0D5B,MAAMC,gBAAgB,CAAC;EAOXC,OAAO,GAAG,KAAK;EAEhBC,WAAWA,CAACC,MAAc,EAAEC,OAAgC,EAAE;IACjE,IAAI,CAACD,MAAM,GAAGA,MAAM;IACpB,I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,CAACD,KAAK,EAAEE,IAAI,KAAK;MAChD,OAAOF,KAAK,GAAGG,UAAU,CAACD,IAAI,CAAC,aAAa,CAAC,CAAC;IAClD,CAAC,EAAE,CAAC,CAAC;IACL,OAAOF,KAAK,GAAGzB,KAAK,CAAC8B,MAAM;EAC/B;EAEQjB,4BAA4BA,CAACC,MAA2C,EAAU;IACtF,QAAQA,MAAM;MACV,KAAKL,0CAAmC,CAACsB,KAAK;QAC1C,OAAO,CAAC;MACZ,KAAKtB,0CAAmC,CAACuB,MAAM;QAC3C,OAAO,CAAC;MACZ,KAAKvB,0CAAmC,CAACC,GAAG;QACxC,OAAO,CAAC;MACZ;QACI,OAAO,EAAE;IACjB;EACJ;AACJ;AAIO,MAAMuB,sBAAsB,GAAGA,CAClC3D,MAAc,EACd4D,MAA+B,KACZ;EACnB,OAAO,IAAI/D,gBAAgB,CAACG,MAAM,EAAE4D,MAAM,CAAC;AAC/C,CAAC;AAACC,OAAA,CAAAF,sBAAA,GAAAA,sBAAA","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ import { WebinyError } from "@webiny/error";
2
+ export declare class WaitingHealthyClusterAbortedError extends WebinyError {
3
+ constructor(message?: string);
4
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.WaitingHealthyClusterAbortedError = void 0;
7
+ var _error = require("@webiny/error");
8
+ class WaitingHealthyClusterAbortedError extends _error.WebinyError {
9
+ constructor(message) {
10
+ super({
11
+ message: message || `Waiting for the cluster to become healthy was aborted.`,
12
+ code: "WAITING_HEALTHY_CLUSTER_ABORTED"
13
+ });
14
+ }
15
+ }
16
+ exports.WaitingHealthyClusterAbortedError = WaitingHealthyClusterAbortedError;
17
+
18
+ //# sourceMappingURL=WaitingHealthyClusterAbortedError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_error","require","WaitingHealthyClusterAbortedError","WebinyError","constructor","message","code","exports"],"sources":["WaitingHealthyClusterAbortedError.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\n\nexport class WaitingHealthyClusterAbortedError extends WebinyError {\n public constructor(message?: string) {\n super({\n message: message || `Waiting for the cluster to become healthy was aborted.`,\n code: \"WAITING_HEALTHY_CLUSTER_ABORTED\"\n });\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEO,MAAMC,iCAAiC,SAASC,kBAAW,CAAC;EACxDC,WAAWA,CAACC,OAAgB,EAAE;IACjC,KAAK,CAAC;MACFA,OAAO,EAAEA,OAAO,IAAK,wDAAuD;MAC5EC,IAAI,EAAE;IACV,CAAC,CAAC;EACN;AACJ;AAACC,OAAA,CAAAL,iCAAA,GAAAA,iCAAA","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ export * from "./WaitingHealthyClusterAbortedError";
2
+ export * from "./UnhealthyClusterError";
3
+ export * from "./WaitUntilHealthy";
4
+ export * from "./UnhealthyClusterError";
5
+ export * from "./WaitUntilHealthy";
6
+ export * from "./reason";
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _WaitingHealthyClusterAbortedError = require("./WaitingHealthyClusterAbortedError");
7
+ Object.keys(_WaitingHealthyClusterAbortedError).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _WaitingHealthyClusterAbortedError[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _WaitingHealthyClusterAbortedError[key];
14
+ }
15
+ });
16
+ });
17
+ var _UnhealthyClusterError = require("./UnhealthyClusterError");
18
+ Object.keys(_UnhealthyClusterError).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _UnhealthyClusterError[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _UnhealthyClusterError[key];
25
+ }
26
+ });
27
+ });
28
+ var _WaitUntilHealthy = require("./WaitUntilHealthy");
29
+ Object.keys(_WaitUntilHealthy).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _WaitUntilHealthy[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _WaitUntilHealthy[key];
36
+ }
37
+ });
38
+ });
39
+ var _reason = require("./reason");
40
+ Object.keys(_reason).forEach(function (key) {
41
+ if (key === "default" || key === "__esModule") return;
42
+ if (key in exports && exports[key] === _reason[key]) return;
43
+ Object.defineProperty(exports, key, {
44
+ enumerable: true,
45
+ get: function () {
46
+ return _reason[key];
47
+ }
48
+ });
49
+ });
50
+
51
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_WaitingHealthyClusterAbortedError","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_UnhealthyClusterError","_WaitUntilHealthy","_reason"],"sources":["index.ts"],"sourcesContent":["export * from \"./WaitingHealthyClusterAbortedError\";\nexport * from \"./UnhealthyClusterError\";\nexport * from \"./WaitUntilHealthy\";\nexport * from \"./UnhealthyClusterError\";\nexport * from \"./WaitUntilHealthy\";\nexport * from \"./reason\";\n"],"mappings":";;;;;AAAA,IAAAA,kCAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,kCAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,kCAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,kCAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,sBAAA,GAAAT,OAAA;AAEAC,MAAA,CAAAC,IAAA,CAAAO,sBAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,sBAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,sBAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AADA,IAAAM,iBAAA,GAAAV,OAAA;AAEAC,MAAA,CAAAC,IAAA,CAAAQ,iBAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,iBAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,iBAAA,CAAAN,GAAA;IAAA;EAAA;AAAA;AACA,IAAAO,OAAA,GAAAX,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAS,OAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,OAAA,CAAAP,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,OAAA,CAAAP,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -0,0 +1,15 @@
1
+ import { ElasticsearchCatClusterHealthStatus } from "../../../operations";
2
+ import { IReason } from "./IReason";
3
+ export interface IClusterHealthReasonParams {
4
+ minimum: ElasticsearchCatClusterHealthStatus;
5
+ current: ElasticsearchCatClusterHealthStatus;
6
+ description?: string;
7
+ }
8
+ export declare class ClusterHealthReason implements IReason {
9
+ readonly name = "clusterHealth";
10
+ readonly minimum: ElasticsearchCatClusterHealthStatus;
11
+ readonly current: ElasticsearchCatClusterHealthStatus;
12
+ readonly description?: string;
13
+ constructor(params: IClusterHealthReasonParams);
14
+ }
15
+ export declare const createClusterHealthStatusReason: (params: IClusterHealthReasonParams) => ClusterHealthReason;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createClusterHealthStatusReason = exports.ClusterHealthReason = void 0;
7
+ class ClusterHealthReason {
8
+ name = "clusterHealth";
9
+ constructor(params) {
10
+ this.minimum = params.minimum;
11
+ this.current = params.current;
12
+ this.description = params.description;
13
+ }
14
+ }
15
+ exports.ClusterHealthReason = ClusterHealthReason;
16
+ const createClusterHealthStatusReason = params => {
17
+ return new ClusterHealthReason(params);
18
+ };
19
+ exports.createClusterHealthStatusReason = createClusterHealthStatusReason;
20
+
21
+ //# sourceMappingURL=ClusterHealthReason.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ClusterHealthReason","name","constructor","params","minimum","current","description","exports","createClusterHealthStatusReason"],"sources":["ClusterHealthReason.ts"],"sourcesContent":["import { ElasticsearchCatClusterHealthStatus } from \"~/operations\";\nimport { 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,4 @@
1
+ export interface IReason {
2
+ name: string;
3
+ description?: string;
4
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ //# sourceMappingURL=IReason.js.map
@@ -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 { 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 { 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 { 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 { 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,3 @@
1
+ export * from "./ClusterHealthReason";
2
+ export * from "./MemoryReason";
3
+ export * from "./ProcessorReason";
@@ -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":[]}