@webiny/api-opensearch 0.0.0-unstable.e6f0dc8ca7

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 (210) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +11 -0
  3. package/client.d.ts +8 -0
  4. package/client.js +70 -0
  5. package/client.js.map +1 -0
  6. package/cursors.d.ts +10 -0
  7. package/cursors.js +37 -0
  8. package/cursors.js.map +1 -0
  9. package/db/entity.d.ts +7 -0
  10. package/db/entity.js +20 -0
  11. package/db/entity.js.map +1 -0
  12. package/db/index.d.ts +3 -0
  13. package/db/index.js +5 -0
  14. package/db/index.js.map +1 -0
  15. package/db/table.d.ts +7 -0
  16. package/db/table.js +17 -0
  17. package/db/table.js.map +1 -0
  18. package/db/types.d.ts +6 -0
  19. package/db/types.js +3 -0
  20. package/db/types.js.map +1 -0
  21. package/exports/api/opensearch.d.ts +4 -0
  22. package/exports/api/opensearch.js +6 -0
  23. package/exports/api/opensearch.js.map +1 -0
  24. package/features/OpenSearchClient/OpenSearchClient.d.ts +12 -0
  25. package/features/OpenSearchClient/OpenSearchClient.js +16 -0
  26. package/features/OpenSearchClient/OpenSearchClient.js.map +1 -0
  27. package/features/OpenSearchClient/abstraction.d.ts +9 -0
  28. package/features/OpenSearchClient/abstraction.js +4 -0
  29. package/features/OpenSearchClient/abstraction.js.map +1 -0
  30. package/features/OpenSearchClient/feature.d.ts +4 -0
  31. package/features/OpenSearchClient/feature.js +10 -0
  32. package/features/OpenSearchClient/feature.js.map +1 -0
  33. package/features/OpenSearchClientFactory/OpenSearchClientFactory.d.ts +9 -0
  34. package/features/OpenSearchClientFactory/OpenSearchClientFactory.js +16 -0
  35. package/features/OpenSearchClientFactory/OpenSearchClientFactory.js.map +1 -0
  36. package/features/OpenSearchClientFactory/abstraction.d.ts +10 -0
  37. package/features/OpenSearchClientFactory/abstraction.js +4 -0
  38. package/features/OpenSearchClientFactory/abstraction.js.map +1 -0
  39. package/features/OpenSearchClientFactory/feature.d.ts +4 -0
  40. package/features/OpenSearchClientFactory/feature.js +10 -0
  41. package/features/OpenSearchClientFactory/feature.js.map +1 -0
  42. package/features/OpenSearchContext/OpenSearchContext.d.ts +8 -0
  43. package/features/OpenSearchContext/OpenSearchContext.js +13 -0
  44. package/features/OpenSearchContext/OpenSearchContext.js.map +1 -0
  45. package/features/OpenSearchContext/abstraction.d.ts +14 -0
  46. package/features/OpenSearchContext/abstraction.js +4 -0
  47. package/features/OpenSearchContext/abstraction.js.map +1 -0
  48. package/features/OpenSearchContext/feature.d.ts +5 -0
  49. package/features/OpenSearchContext/feature.js +13 -0
  50. package/features/OpenSearchContext/feature.js.map +1 -0
  51. package/index.d.ts +21 -0
  52. package/index.js +40 -0
  53. package/index.js.map +1 -0
  54. package/indexConfiguration/base.d.ts +6 -0
  55. package/indexConfiguration/base.js +35 -0
  56. package/indexConfiguration/base.js.map +1 -0
  57. package/indexConfiguration/common.d.ts +9 -0
  58. package/indexConfiguration/common.js +44 -0
  59. package/indexConfiguration/common.js.map +1 -0
  60. package/indexConfiguration/index.d.ts +2 -0
  61. package/indexConfiguration/index.js +4 -0
  62. package/indexConfiguration/index.js.map +1 -0
  63. package/indexPrefix.d.ts +1 -0
  64. package/indexPrefix.js +5 -0
  65. package/indexPrefix.js.map +1 -0
  66. package/indices.d.ts +8 -0
  67. package/indices.js +20 -0
  68. package/indices.js.map +1 -0
  69. package/limit.d.ts +1 -0
  70. package/limit.js +32 -0
  71. package/limit.js.map +1 -0
  72. package/normalize.d.ts +6 -0
  73. package/normalize.js +54 -0
  74. package/normalize.js.map +1 -0
  75. package/operations/OpenSearchCatHealth.d.ts +7 -0
  76. package/operations/OpenSearchCatHealth.js +31 -0
  77. package/operations/OpenSearchCatHealth.js.map +1 -0
  78. package/operations/OpenSearchCatNodes.d.ts +7 -0
  79. package/operations/OpenSearchCatNodes.js +29 -0
  80. package/operations/OpenSearchCatNodes.js.map +1 -0
  81. package/operations/index.d.ts +3 -0
  82. package/operations/index.js +5 -0
  83. package/operations/index.js.map +1 -0
  84. package/operations/stripConnectionFromException.d.ts +1 -0
  85. package/operations/stripConnectionFromException.js +17 -0
  86. package/operations/stripConnectionFromException.js.map +1 -0
  87. package/operations/types.d.ts +12 -0
  88. package/operations/types.js +8 -0
  89. package/operations/types.js.map +1 -0
  90. package/operators.d.ts +6 -0
  91. package/operators.js +9 -0
  92. package/operators.js.map +1 -0
  93. package/package.json +40 -0
  94. package/plugins/definition/OpenSearchBodyModifierPlugin.d.ts +13 -0
  95. package/plugins/definition/OpenSearchBodyModifierPlugin.js +18 -0
  96. package/plugins/definition/OpenSearchBodyModifierPlugin.js.map +1 -0
  97. package/plugins/definition/OpenSearchFieldPlugin.d.ts +81 -0
  98. package/plugins/definition/OpenSearchFieldPlugin.js +69 -0
  99. package/plugins/definition/OpenSearchFieldPlugin.js.map +1 -0
  100. package/plugins/definition/OpenSearchIndexPlugin.d.ts +10 -0
  101. package/plugins/definition/OpenSearchIndexPlugin.js +17 -0
  102. package/plugins/definition/OpenSearchIndexPlugin.js.map +1 -0
  103. package/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.d.ts +10 -0
  104. package/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js +9 -0
  105. package/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js.map +1 -0
  106. package/plugins/definition/OpenSearchQueryModifierPlugin.d.ts +14 -0
  107. package/plugins/definition/OpenSearchQueryModifierPlugin.js +18 -0
  108. package/plugins/definition/OpenSearchQueryModifierPlugin.js.map +1 -0
  109. package/plugins/definition/OpenSearchSortModifierPlugin.d.ts +13 -0
  110. package/plugins/definition/OpenSearchSortModifierPlugin.js +18 -0
  111. package/plugins/definition/OpenSearchSortModifierPlugin.js.map +1 -0
  112. package/plugins/definition/index.d.ts +6 -0
  113. package/plugins/definition/index.js +8 -0
  114. package/plugins/definition/index.js.map +1 -0
  115. package/plugins/index.d.ts +2 -0
  116. package/plugins/index.js +4 -0
  117. package/plugins/index.js.map +1 -0
  118. package/plugins/operator/andIn.d.ts +7 -0
  119. package/plugins/operator/andIn.js +35 -0
  120. package/plugins/operator/andIn.js.map +1 -0
  121. package/plugins/operator/between.d.ts +7 -0
  122. package/plugins/operator/between.js +32 -0
  123. package/plugins/operator/between.js.map +1 -0
  124. package/plugins/operator/contains.d.ts +7 -0
  125. package/plugins/operator/contains.js +24 -0
  126. package/plugins/operator/contains.js.map +1 -0
  127. package/plugins/operator/equal.d.ts +7 -0
  128. package/plugins/operator/equal.js +50 -0
  129. package/plugins/operator/equal.js.map +1 -0
  130. package/plugins/operator/gt.d.ts +7 -0
  131. package/plugins/operator/gt.js +22 -0
  132. package/plugins/operator/gt.js.map +1 -0
  133. package/plugins/operator/gte.d.ts +7 -0
  134. package/plugins/operator/gte.js +22 -0
  135. package/plugins/operator/gte.js.map +1 -0
  136. package/plugins/operator/in.d.ts +7 -0
  137. package/plugins/operator/in.js +29 -0
  138. package/plugins/operator/in.js.map +1 -0
  139. package/plugins/operator/index.d.ts +15 -0
  140. package/plugins/operator/index.js +17 -0
  141. package/plugins/operator/index.js.map +1 -0
  142. package/plugins/operator/lt.d.ts +7 -0
  143. package/plugins/operator/lt.js +22 -0
  144. package/plugins/operator/lt.js.map +1 -0
  145. package/plugins/operator/lte.d.ts +7 -0
  146. package/plugins/operator/lte.js +22 -0
  147. package/plugins/operator/lte.js.map +1 -0
  148. package/plugins/operator/not.d.ts +7 -0
  149. package/plugins/operator/not.js +44 -0
  150. package/plugins/operator/not.js.map +1 -0
  151. package/plugins/operator/notBetween.d.ts +7 -0
  152. package/plugins/operator/notBetween.js +32 -0
  153. package/plugins/operator/notBetween.js.map +1 -0
  154. package/plugins/operator/notContains.d.ts +7 -0
  155. package/plugins/operator/notContains.js +24 -0
  156. package/plugins/operator/notContains.js.map +1 -0
  157. package/plugins/operator/notIn.d.ts +7 -0
  158. package/plugins/operator/notIn.js +27 -0
  159. package/plugins/operator/notIn.js.map +1 -0
  160. package/plugins/operator/notStartsWith.d.ts +7 -0
  161. package/plugins/operator/notStartsWith.js +23 -0
  162. package/plugins/operator/notStartsWith.js.map +1 -0
  163. package/plugins/operator/startsWith.d.ts +7 -0
  164. package/plugins/operator/startsWith.js +23 -0
  165. package/plugins/operator/startsWith.js.map +1 -0
  166. package/sharedIndex.d.ts +1 -0
  167. package/sharedIndex.js +5 -0
  168. package/sharedIndex.js.map +1 -0
  169. package/sort.d.ts +13 -0
  170. package/sort.js +65 -0
  171. package/sort.js.map +1 -0
  172. package/types.d.ts +68 -0
  173. package/types.js +68 -0
  174. package/types.js.map +1 -0
  175. package/utils/createIndex.d.ts +19 -0
  176. package/utils/createIndex.js +88 -0
  177. package/utils/createIndex.js.map +1 -0
  178. package/utils/index.d.ts +2 -0
  179. package/utils/index.js +4 -0
  180. package/utils/index.js.map +1 -0
  181. package/utils/waitUntilHealthy/UnhealthyClusterError.d.ts +4 -0
  182. package/utils/waitUntilHealthy/UnhealthyClusterError.js +11 -0
  183. package/utils/waitUntilHealthy/UnhealthyClusterError.js.map +1 -0
  184. package/utils/waitUntilHealthy/WaitUntilHealthy.d.ts +72 -0
  185. package/utils/waitUntilHealthy/WaitUntilHealthy.js +161 -0
  186. package/utils/waitUntilHealthy/WaitUntilHealthy.js.map +1 -0
  187. package/utils/waitUntilHealthy/WaitingHealthyClusterAbortedError.d.ts +4 -0
  188. package/utils/waitUntilHealthy/WaitingHealthyClusterAbortedError.js +11 -0
  189. package/utils/waitUntilHealthy/WaitingHealthyClusterAbortedError.js.map +1 -0
  190. package/utils/waitUntilHealthy/index.d.ts +4 -0
  191. package/utils/waitUntilHealthy/index.js +6 -0
  192. package/utils/waitUntilHealthy/index.js.map +1 -0
  193. package/utils/waitUntilHealthy/reason/ClusterHealthReason.d.ts +15 -0
  194. package/utils/waitUntilHealthy/reason/ClusterHealthReason.js +13 -0
  195. package/utils/waitUntilHealthy/reason/ClusterHealthReason.js.map +1 -0
  196. package/utils/waitUntilHealthy/reason/IReason.d.ts +4 -0
  197. package/utils/waitUntilHealthy/reason/IReason.js +3 -0
  198. package/utils/waitUntilHealthy/reason/IReason.js.map +1 -0
  199. package/utils/waitUntilHealthy/reason/MemoryReason.d.ts +14 -0
  200. package/utils/waitUntilHealthy/reason/MemoryReason.js +13 -0
  201. package/utils/waitUntilHealthy/reason/MemoryReason.js.map +1 -0
  202. package/utils/waitUntilHealthy/reason/ProcessorReason.d.ts +14 -0
  203. package/utils/waitUntilHealthy/reason/ProcessorReason.js +13 -0
  204. package/utils/waitUntilHealthy/reason/ProcessorReason.js.map +1 -0
  205. package/utils/waitUntilHealthy/reason/index.d.ts +3 -0
  206. package/utils/waitUntilHealthy/reason/index.js +5 -0
  207. package/utils/waitUntilHealthy/reason/index.js.map +1 -0
  208. package/where.d.ts +17 -0
  209. package/where.js +82 -0
  210. package/where.js.map +1 -0
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ContextPlugin","Client","createOpenSearchClient","getOpenSearchOperators","OpenSearchClientFactoryFeature","OpenSearchClientFeature","OpenSearchContextFeature","createOpenSearchContext","params","plugin","context","opensearch","Error","client","elasticsearch","plugins","register","container","name"],"sources":["index.ts"],"sourcesContent":["import type { OpenSearchContext } from \"./types.js\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport type { OpenSearchClientOptions } from \"./client.js\";\nimport { Client, createOpenSearchClient } from \"./client.js\";\nimport { getOpenSearchOperators } from \"./operators.js\";\nimport { OpenSearchClientFactoryFeature } from \"./features/OpenSearchClientFactory/feature.js\";\nimport { OpenSearchClientFeature } from \"./features/OpenSearchClient/feature.js\";\nimport { OpenSearchContextFeature } from \"~/features/OpenSearchContext/feature.js\";\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 \"./operators.js\";\nexport * from \"./cursors.js\";\nexport {\n createOpenSearchClient,\n type Client,\n type ClientOptions,\n type OpenSearchClientOptions\n} 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\";\nexport * from \"./types.js\";\n\nexport const createOpenSearchContext = (\n params: OpenSearchClientOptions | Client\n): ContextPlugin<OpenSearchContext> => {\n const plugin = new ContextPlugin<OpenSearchContext>(context => {\n if (context.opensearch) {\n throw new Error(\"OpenSearch context must not be loaded more than once!\");\n }\n const client = params instanceof Client ? params : createOpenSearchClient(params);\n context.opensearch = client;\n context.elasticsearch = client;\n\n context.plugins.register(getOpenSearchOperators());\n\n OpenSearchContextFeature.register(context.container, context);\n OpenSearchClientFeature.register(context.container);\n OpenSearchClientFactoryFeature.register(context.container);\n });\n\n plugin.name = \"context.opensearch\";\n\n return plugin;\n};\n"],"mappings":"AACA,SAASA,aAAa,QAAQ,aAAa;AAE3C,SAASC,MAAM,EAAEC,sBAAsB;AACvC,SAASC,sBAAsB;AAC/B,SAASC,8BAA8B;AACvC,SAASC,uBAAuB;AAChC,SAASC,wBAAwB;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SACIJ,sBAAsB;AAK1B;AACA;AACA;AACA;AACA;AACA;AAEA,OAAO,MAAMK,uBAAuB,GAChCC,MAAwC,IACL;EACnC,MAAMC,MAAM,GAAG,IAAIT,aAAa,CAAoBU,OAAO,IAAI;IAC3D,IAAIA,OAAO,CAACC,UAAU,EAAE;MACpB,MAAM,IAAIC,KAAK,CAAC,uDAAuD,CAAC;IAC5E;IACA,MAAMC,MAAM,GAAGL,MAAM,YAAYP,MAAM,GAAGO,MAAM,GAAGN,sBAAsB,CAACM,MAAM,CAAC;IACjFE,OAAO,CAACC,UAAU,GAAGE,MAAM;IAC3BH,OAAO,CAACI,aAAa,GAAGD,MAAM;IAE9BH,OAAO,CAACK,OAAO,CAACC,QAAQ,CAACb,sBAAsB,CAAC,CAAC,CAAC;IAElDG,wBAAwB,CAACU,QAAQ,CAACN,OAAO,CAACO,SAAS,EAAEP,OAAO,CAAC;IAC7DL,uBAAuB,CAACW,QAAQ,CAACN,OAAO,CAACO,SAAS,CAAC;IACnDb,8BAA8B,CAACY,QAAQ,CAACN,OAAO,CAACO,SAAS,CAAC;EAC9D,CAAC,CAAC;EAEFR,MAAM,CAACS,IAAI,GAAG,oBAAoB;EAElC,OAAOT,MAAM;AACjB,CAAC","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ import type { OpenSearchIndexRequestBody } from "../types.js";
2
+ interface Modifier {
3
+ (config: OpenSearchIndexRequestBody): OpenSearchIndexRequestBody;
4
+ }
5
+ export declare const getBaseConfiguration: (modifier?: Modifier) => import("@opensearch-project/opensearch/api/index.js").Indices_Create_RequestBody;
6
+ export {};
@@ -0,0 +1,35 @@
1
+ import { getCommonMappings } from "./common.js";
2
+ const config = {
3
+ mappings: {
4
+ dynamic_templates: getCommonMappings(mappings => {
5
+ return mappings.concat([{
6
+ strings: {
7
+ match_mapping_type: "string",
8
+ mapping: {
9
+ type: "text",
10
+ fields: {
11
+ keyword: {
12
+ type: "keyword",
13
+ ignore_above: 256
14
+ }
15
+ }
16
+ }
17
+ }
18
+ }]);
19
+ }),
20
+ properties: {
21
+ rawValues: {
22
+ type: "object",
23
+ enabled: false
24
+ }
25
+ }
26
+ }
27
+ };
28
+ export const getBaseConfiguration = modifier => {
29
+ if (!modifier) {
30
+ return config;
31
+ }
32
+ return modifier(config);
33
+ };
34
+
35
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1 @@
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 { OpenSearchIndexRequestBody } from \"~/types.js\";\nimport { getCommonMappings } from \"./common.js\";\n\nconst config: OpenSearchIndexRequestBody = {\n mappings: {\n dynamic_templates: getCommonMappings(mappings => {\n return mappings.concat([\n {\n strings: {\n match_mapping_type: \"string\",\n mapping: {\n type: \"text\",\n fields: {\n keyword: {\n type: \"keyword\",\n ignore_above: 256\n }\n }\n }\n }\n }\n ]);\n }),\n properties: {\n rawValues: {\n type: \"object\",\n enabled: false\n }\n }\n }\n};\n\ninterface Modifier {\n (config: OpenSearchIndexRequestBody): OpenSearchIndexRequestBody;\n}\nexport const getBaseConfiguration = (modifier?: Modifier) => {\n if (!modifier) {\n return config;\n }\n return modifier(config);\n};\n"],"mappings":"AACA,SAASA,iBAAiB;AAE1B,MAAMC,MAAkC,GAAG;EACvCC,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":[]}
@@ -0,0 +1,9 @@
1
+ import type { OpenSearchIndexRequestBodyMappingsDynamicTemplate } from "../types.js";
2
+ interface Modifier {
3
+ (mappings: OpenSearchIndexRequestBodyMappingsDynamicTemplate[]): OpenSearchIndexRequestBodyMappingsDynamicTemplate[];
4
+ }
5
+ /**
6
+ * @internal
7
+ */
8
+ export declare const getCommonMappings: (cb?: Modifier) => OpenSearchIndexRequestBodyMappingsDynamicTemplate[];
9
+ export {};
@@ -0,0 +1,44 @@
1
+ const getDefaultMappings = () => {
2
+ return [{
3
+ ids: {
4
+ match: "^id|entryId$",
5
+ mapping: {
6
+ type: "keyword"
7
+ }
8
+ }
9
+ }, {
10
+ /* Update with the correct date fields. */
11
+ dates: {
12
+ match: "^createdOn|savedOn|publishedOn$",
13
+ mapping: {
14
+ type: "date"
15
+ }
16
+ }
17
+ }, {
18
+ numbers: {
19
+ match: "number@*",
20
+ mapping: {
21
+ type: "scaled_float",
22
+ scaling_factor: 10000
23
+ }
24
+ }
25
+ }, {
26
+ booleans: {
27
+ match: "boolean@*",
28
+ mapping: {
29
+ type: "boolean"
30
+ }
31
+ }
32
+ }];
33
+ };
34
+ /**
35
+ * @internal
36
+ */
37
+ export const getCommonMappings = cb => {
38
+ if (!cb) {
39
+ return getDefaultMappings();
40
+ }
41
+ return cb(getDefaultMappings());
42
+ };
43
+
44
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getDefaultMappings","ids","match","mapping","type","dates","numbers","scaling_factor","booleans","getCommonMappings","cb"],"sources":["common.ts"],"sourcesContent":["import type { OpenSearchIndexRequestBodyMappingsDynamicTemplate } from \"~/types.js\";\n\nconst getDefaultMappings = (): OpenSearchIndexRequestBodyMappingsDynamicTemplate[] => {\n return [\n {\n ids: {\n match: \"^id|entryId$\",\n mapping: {\n type: \"keyword\"\n }\n }\n },\n {\n /* Update with the correct date fields. */\n dates: {\n match: \"^createdOn|savedOn|publishedOn$\",\n mapping: {\n type: \"date\"\n }\n }\n },\n {\n numbers: {\n match: \"number@*\",\n mapping: {\n type: \"scaled_float\",\n scaling_factor: 10000\n }\n }\n },\n {\n booleans: {\n match: \"boolean@*\",\n mapping: {\n type: \"boolean\"\n }\n }\n }\n ];\n};\n\ninterface Modifier {\n (\n mappings: OpenSearchIndexRequestBodyMappingsDynamicTemplate[]\n ): OpenSearchIndexRequestBodyMappingsDynamicTemplate[];\n}\n/**\n * @internal\n */\nexport const getCommonMappings = (\n cb?: Modifier\n): OpenSearchIndexRequestBodyMappingsDynamicTemplate[] => {\n if (!cb) {\n return getDefaultMappings();\n }\n\n return cb(getDefaultMappings());\n};\n"],"mappings":"AAEA,MAAMA,kBAAkB,GAAGA,CAAA,KAA2D;EAClF,OAAO,CACH;IACIC,GAAG,EAAE;MACDC,KAAK,EAAE,cAAc;MACrBC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV;IACJ;EACJ,CAAC,EACD;IACI;IACAC,KAAK,EAAE;MACHH,KAAK,EAAE,iCAAiC;MACxCC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV;IACJ;EACJ,CAAC,EACD;IACIE,OAAO,EAAE;MACLJ,KAAK,EAAE,UAAU;MACjBC,OAAO,EAAE;QACLC,IAAI,EAAE,cAAc;QACpBG,cAAc,EAAE;MACpB;IACJ;EACJ,CAAC,EACD;IACIC,QAAQ,EAAE;MACNN,KAAK,EAAE,WAAW;MAClBC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV;IACJ;EACJ,CAAC,CACJ;AACL,CAAC;AAOD;AACA;AACA;AACA,OAAO,MAAMK,iBAAiB,GAC1BC,EAAa,IACyC;EACtD,IAAI,CAACA,EAAE,EAAE;IACL,OAAOV,kBAAkB,CAAC,CAAC;EAC/B;EAEA,OAAOU,EAAE,CAACV,kBAAkB,CAAC,CAAC,CAAC;AACnC,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export * from "./base.js";
2
+ export * from "./common.js";
@@ -0,0 +1,4 @@
1
+ export * from "./base.js";
2
+ export * from "./common.js";
3
+
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./base.js\";\nexport * from \"./common.js\";\n"],"mappings":"AAAA;AACA","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export declare const getOpenSearchIndexPrefix: () => string;
package/indexPrefix.js ADDED
@@ -0,0 +1,5 @@
1
+ export const getOpenSearchIndexPrefix = () => {
2
+ return process.env.OPENSEARCH_INDEX_PREFIX || process.env.ELASTICSEARCH_INDEX_PREFIX || process.env.WEBINY_OPENSEARCH_INDEX_PREFIX || process.env.WEBINY_ELASTICSEARCH_INDEX_PREFIX || "";
3
+ };
4
+
5
+ //# sourceMappingURL=indexPrefix.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getOpenSearchIndexPrefix","process","env","OPENSEARCH_INDEX_PREFIX","ELASTICSEARCH_INDEX_PREFIX","WEBINY_OPENSEARCH_INDEX_PREFIX","WEBINY_ELASTICSEARCH_INDEX_PREFIX"],"sources":["indexPrefix.ts"],"sourcesContent":["export const getOpenSearchIndexPrefix = (): string => {\n return (\n process.env.OPENSEARCH_INDEX_PREFIX ||\n process.env.ELASTICSEARCH_INDEX_PREFIX ||\n process.env.WEBINY_OPENSEARCH_INDEX_PREFIX ||\n process.env.WEBINY_ELASTICSEARCH_INDEX_PREFIX ||\n \"\"\n );\n};\n"],"mappings":"AAAA,OAAO,MAAMA,wBAAwB,GAAGA,CAAA,KAAc;EAClD,OACIC,OAAO,CAACC,GAAG,CAACC,uBAAuB,IACnCF,OAAO,CAACC,GAAG,CAACE,0BAA0B,IACtCH,OAAO,CAACC,GAAG,CAACG,8BAA8B,IAC1CJ,OAAO,CAACC,GAAG,CAACI,iCAAiC,IAC7C,EAAE;AAEV,CAAC","ignoreList":[]}
package/indices.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import type { OpenSearchIndexPlugin } from "./plugins/definition/OpenSearchIndexPlugin.js";
2
+ import type { PluginsContainer } from "@webiny/plugins";
3
+ interface IndicesPluginsParams {
4
+ container: PluginsContainer;
5
+ type: string;
6
+ }
7
+ export declare const getLastAddedIndexPlugin: <T extends OpenSearchIndexPlugin>(params: IndicesPluginsParams) => T;
8
+ export {};
package/indices.js ADDED
@@ -0,0 +1,20 @@
1
+ import WebinyError from "@webiny/error";
2
+ const listIndicesPlugins = ({
3
+ container,
4
+ type
5
+ }) => {
6
+ return container.byType(type).filter(plugin => {
7
+ return plugin.canUse();
8
+ });
9
+ };
10
+ export const getLastAddedIndexPlugin = params => {
11
+ const plugins = listIndicesPlugins(params);
12
+ if (plugins.length === 0) {
13
+ throw new WebinyError(`Could not find a single OpenSearchIndexPlugin of type "${params.type}".`, "OPENSEARCH_INDEX_TEMPLATE_ERROR", {
14
+ type: params.type
15
+ });
16
+ }
17
+ return plugins.pop();
18
+ };
19
+
20
+ //# sourceMappingURL=indices.js.map
package/indices.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"names":["WebinyError","listIndicesPlugins","container","type","byType","filter","plugin","canUse","getLastAddedIndexPlugin","params","plugins","length","pop"],"sources":["indices.ts"],"sourcesContent":["import type { OpenSearchIndexPlugin } from \"~/plugins/definition/OpenSearchIndexPlugin.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 OpenSearchIndexPlugin>({\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 OpenSearchIndexPlugin>(\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 OpenSearchIndexPlugin 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,CAAkC;EACzDC,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,0DAA0DS,MAAM,CAACN,IAAI,IAAI,EACzE,iCAAiC,EACjC;MACIA,IAAI,EAAEM,MAAM,CAACN;IACjB,CACJ,CAAC;EACL;EAEA,OAAOO,OAAO,CAACE,GAAG,CAAC,CAAC;AACxB,CAAC","ignoreList":[]}
package/limit.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const createLimit: (limit?: number, defaultValue?: number) => number;
package/limit.js ADDED
@@ -0,0 +1,32 @@
1
+ /**
2
+ * This is the max limit of the OpenSearch.
3
+ * Change here if it changes (and if it is necessary).
4
+ */
5
+ const ES_LIMIT_MAX = 10000;
6
+ /**
7
+ * Our system default limit.
8
+ */
9
+ const ES_LIMIT_DEFAULT = 50;
10
+ export const createLimit = (limit, defaultValue = ES_LIMIT_DEFAULT) => {
11
+ /**
12
+ * Limit can possibly be null/undefined or less than 1.
13
+ * In that case return the defaults.
14
+ */
15
+ if (!limit || limit < 1) {
16
+ return defaultValue;
17
+ }
18
+ /**
19
+ * Users input limit cannot be greater than the OpenSearch one.
20
+ * OpenSearch query breaks because of that.
21
+ */
22
+ if (limit < ES_LIMIT_MAX) {
23
+ return limit;
24
+ }
25
+ /**
26
+ * Always reduce by 1 because we check if there are more items by adding 1 to the limit
27
+ * and then remove that last one loaded.
28
+ */
29
+ return ES_LIMIT_MAX - 1;
30
+ };
31
+
32
+ //# sourceMappingURL=limit.js.map
package/limit.js.map ADDED
@@ -0,0 +1 @@
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 OpenSearch.\n * Change here if it changes (and if it is necessary).\n */\nconst ES_LIMIT_MAX = 10000;\n/**\n * Our system default limit.\n */\nconst ES_LIMIT_DEFAULT = 50;\n\nexport const createLimit = (limit?: number, defaultValue = ES_LIMIT_DEFAULT): number => {\n /**\n * Limit can possibly be null/undefined or less than 1.\n * In that case return the defaults.\n */\n if (!limit || limit < 1) {\n return defaultValue;\n }\n /**\n * Users input limit cannot be greater than the OpenSearch one.\n * OpenSearch query breaks because of that.\n */\n if (limit < ES_LIMIT_MAX) {\n return limit;\n }\n /**\n * Always reduce by 1 because we check if there are more items by adding 1 to the limit\n * and then remove that last one loaded.\n */\n return ES_LIMIT_MAX - 1;\n};\n"],"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.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Before performing the query, we need to escape all special characters.
3
+ * @see https://opensearch.org/docs/latest/query-dsl/full-text/query-string/
4
+ */
5
+ export declare const normalizeValue: (value: string) => string;
6
+ export declare const normalizeValueWithAsterisk: (initial: string) => string;
package/normalize.js ADDED
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Before performing the query, we need to escape all special characters.
3
+ * @see https://opensearch.org/docs/latest/query-dsl/full-text/query-string/
4
+ */
5
+
6
+ const specialCharactersToRemove = [`\\?`];
7
+ const specialCharacterToSpace = ["-", "\\\\"];
8
+ const specialCharacters = ["\\\\", "\\+",
9
+ // "\\-",
10
+ "\\=", `&`, `\\|`, ">", "<", `!`, "\\(", "\\)", "\\{", "\\}", "\\[", "\\]", "\\^", '\\"', "\\~", "\\*", `:`, `/`, "\\#"];
11
+ export const normalizeValue = value => {
12
+ let result = value || "";
13
+ if (!result) {
14
+ return result;
15
+ }
16
+ for (const character of specialCharactersToRemove) {
17
+ result = result.replace(new RegExp(character, "g"), "");
18
+ }
19
+ for (const character of specialCharacterToSpace) {
20
+ result = result.replace(new RegExp(character, "g"), " ");
21
+ }
22
+ for (const character of specialCharacters) {
23
+ result = result.replace(new RegExp(character, "g"), `\\${character}`);
24
+ }
25
+ return result || "";
26
+ };
27
+ const hasSpecialChar = value => {
28
+ if (!value) {
29
+ return null;
30
+ }
31
+ return value.match(/^([0-9a-zA-Z]+)$/i) === null;
32
+ };
33
+ export const normalizeValueWithAsterisk = initial => {
34
+ const value = normalizeValue(initial);
35
+ const results = value.split(" ");
36
+ let result = value;
37
+ /**
38
+ * If there is a / in the first word, do not put asterisk in front of it.
39
+ */
40
+ const firstWord = results[0];
41
+ if (hasSpecialChar(firstWord) === false) {
42
+ result = `*${result}`;
43
+ }
44
+ /**
45
+ * If there is a / in the last word, do not put asterisk at the end of it.
46
+ */
47
+ const lastWord = results[results.length - 1];
48
+ if (hasSpecialChar(lastWord) === false) {
49
+ result = `${result}*`;
50
+ }
51
+ return result;
52
+ };
53
+
54
+ //# sourceMappingURL=normalize.js.map
@@ -0,0 +1 @@
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://opensearch.org/docs/latest/query-dsl/full-text/query-string/\n */\n\nconst specialCharactersToRemove = [`\\\\?`];\n\nconst specialCharacterToSpace = [\"-\", \"\\\\\\\\\"];\n\nconst specialCharacters = [\n \"\\\\\\\\\",\n \"\\\\+\",\n // \"\\\\-\",\n \"\\\\=\",\n `&`,\n `\\\\|`,\n \">\",\n \"<\",\n `!`,\n \"\\\\(\",\n \"\\\\)\",\n \"\\\\{\",\n \"\\\\}\",\n \"\\\\[\",\n \"\\\\]\",\n \"\\\\^\",\n '\\\\\"',\n \"\\\\~\",\n \"\\\\*\",\n `:`,\n `/`,\n \"\\\\#\"\n];\n\nexport const normalizeValue = (value: string) => {\n let result = value || \"\";\n if (!result) {\n return result;\n }\n for (const character of specialCharactersToRemove) {\n result = result.replace(new RegExp(character, \"g\"), \"\");\n }\n for (const character of specialCharacterToSpace) {\n result = result.replace(new RegExp(character, \"g\"), \" \");\n }\n\n for (const character of specialCharacters) {\n result = result.replace(new RegExp(character, \"g\"), `\\\\${character}`);\n }\n\n return result || \"\";\n};\n\nconst hasSpecialChar = (value: string): boolean | null => {\n if (!value) {\n return null;\n }\n return value.match(/^([0-9a-zA-Z]+)$/i) === null;\n};\n\nexport const normalizeValueWithAsterisk = (initial: string) => {\n const value = normalizeValue(initial);\n const results = value.split(\" \");\n\n let result = value;\n /**\n * If there is a / in the first word, do not put asterisk in front of it.\n */\n const firstWord = results[0];\n if (hasSpecialChar(firstWord) === false) {\n result = `*${result}`;\n }\n /**\n * If there is a / in the last word, do not put asterisk at the end of it.\n */\n const lastWord = results[results.length - 1];\n if (hasSpecialChar(lastWord) === false) {\n result = `${result}*`;\n }\n\n return result;\n};\n"],"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,GAAG,EACH,KAAK,EACL,GAAG,EACH,GAAG,EACH,GAAG,EACH,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,GAAG,EACH,GAAG,EACH,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":[]}
@@ -0,0 +1,7 @@
1
+ import type { Client } from "../client.js";
2
+ import type { IOpenSearchCatHealthResponse } from "./types.js";
3
+ export declare class OpenSearchCatHealth {
4
+ private readonly client;
5
+ constructor(client: Client);
6
+ getHealth(): Promise<IOpenSearchCatHealthResponse>;
7
+ }
@@ -0,0 +1,31 @@
1
+ import { WebinyError } from "@webiny/error";
2
+ import { stripConnectionFromException } from "./stripConnectionFromException.js";
3
+ export class OpenSearchCatHealth {
4
+ constructor(client) {
5
+ this.client = client;
6
+ }
7
+ async getHealth() {
8
+ try {
9
+ const response = await this.client.cat.health({
10
+ format: "json"
11
+ });
12
+ if (!Array.isArray(response.body) || response.body.length === 0) {
13
+ throw new WebinyError({
14
+ message: `There is no valid response from cat.health operation.`,
15
+ code: "OPENSEARCH_HEALTH_INVALID_RESPONSE",
16
+ data: response.body
17
+ });
18
+ }
19
+ return {
20
+ ...response.body[0]
21
+ };
22
+ } catch (ex) {
23
+ console.error(`Could not fetch cluster health information: ${ex.message}`);
24
+ const error = stripConnectionFromException(ex);
25
+ console.log(JSON.stringify(error));
26
+ throw error;
27
+ }
28
+ }
29
+ }
30
+
31
+ //# sourceMappingURL=OpenSearchCatHealth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["WebinyError","stripConnectionFromException","OpenSearchCatHealth","constructor","client","getHealth","response","cat","health","format","Array","isArray","body","length","message","code","data","ex","console","error","log","JSON","stringify"],"sources":["OpenSearchCatHealth.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport type { Client } from \"~/client.js\";\nimport type { IOpenSearchCatHealthResponse } from \"./types.js\";\nimport { stripConnectionFromException } from \"~/operations/stripConnectionFromException.js\";\n\nexport class OpenSearchCatHealth {\n private readonly client: Client;\n\n public constructor(client: Client) {\n this.client = client;\n }\n\n public async getHealth(): Promise<IOpenSearchCatHealthResponse> {\n try {\n const response = await this.client.cat.health({\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,mBAAmB,CAAC;EAGtBC,WAAWA,CAACC,MAAc,EAAE;IAC/B,IAAI,CAACA,MAAM,GAAGA,MAAM;EACxB;EAEA,MAAaC,SAASA,CAAA,EAA0C;IAC5D,IAAI;MACA,MAAMC,QAAQ,GAAG,MAAM,IAAI,CAACF,MAAM,CAACG,GAAG,CAACC,MAAM,CAAC;QAC1CC,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":[]}
@@ -0,0 +1,7 @@
1
+ import type { IOpenSearchCatNodesResponse } from "./types.js";
2
+ import type { Client } from "../client.js";
3
+ export declare class OpenSearchCatNodes {
4
+ private readonly client;
5
+ constructor(client: Client);
6
+ getNodes(): Promise<IOpenSearchCatNodesResponse>;
7
+ }
@@ -0,0 +1,29 @@
1
+ import { WebinyError } from "@webiny/error";
2
+ import { stripConnectionFromException } from "./stripConnectionFromException.js";
3
+ export class OpenSearchCatNodes {
4
+ constructor(client) {
5
+ this.client = client;
6
+ }
7
+ async getNodes() {
8
+ try {
9
+ const response = await this.client.cat.nodes({
10
+ format: "json"
11
+ });
12
+ if (!Array.isArray(response.body) || response.body.length === 0) {
13
+ throw new WebinyError({
14
+ message: `There is no valid response from cat.nodes operation.`,
15
+ code: "OPENSEARCH_NODES_INVALID_RESPONSE",
16
+ data: response.body
17
+ });
18
+ }
19
+ return response.body;
20
+ } catch (ex) {
21
+ console.error(`Could not fetch cluster nodes information: ${ex.message}`);
22
+ const error = stripConnectionFromException(ex);
23
+ console.log(JSON.stringify(error));
24
+ throw error;
25
+ }
26
+ }
27
+ }
28
+
29
+ //# sourceMappingURL=OpenSearchCatNodes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["WebinyError","stripConnectionFromException","OpenSearchCatNodes","constructor","client","getNodes","response","cat","nodes","format","Array","isArray","body","length","message","code","data","ex","console","error","log","JSON","stringify"],"sources":["OpenSearchCatNodes.ts"],"sourcesContent":["import type { IOpenSearchCatNodesResponse } from \"./types.js\";\nimport type { Client } from \"~/client.js\";\nimport { WebinyError } from \"@webiny/error\";\nimport { stripConnectionFromException } from \"~/operations/stripConnectionFromException.js\";\n\nexport class OpenSearchCatNodes {\n private readonly client: Client;\n\n public constructor(client: Client) {\n this.client = client;\n }\n\n public async getNodes(): Promise<IOpenSearchCatNodesResponse> {\n try {\n const response = await this.client.cat.nodes({\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,kBAAkB,CAAC;EAGrBC,WAAWA,CAACC,MAAc,EAAE;IAC/B,IAAI,CAACA,MAAM,GAAGA,MAAM;EACxB;EAEA,MAAaC,QAAQA,CAAA,EAAyC;IAC1D,IAAI;MACA,MAAMC,QAAQ,GAAG,MAAM,IAAI,CAACF,MAAM,CAACG,GAAG,CAACC,KAAK,CAAC;QACzCC,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":[]}
@@ -0,0 +1,3 @@
1
+ export * from "./OpenSearchCatHealth.js";
2
+ export * from "./OpenSearchCatNodes.js";
3
+ export * from "./types.js";
@@ -0,0 +1,5 @@
1
+ export * from "./OpenSearchCatHealth.js";
2
+ export * from "./OpenSearchCatNodes.js";
3
+ export * from "./types.js";
4
+
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./OpenSearchCatHealth.js\";\nexport * from \"./OpenSearchCatNodes.js\";\nexport * from \"./types.js\";\n"],"mappings":"AAAA;AACA;AACA","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export declare const stripConnectionFromException: (ex: any) => any;
@@ -0,0 +1,17 @@
1
+ export const stripConnectionFromException = ex => {
2
+ if (typeof ex !== "object") {
3
+ return ex;
4
+ }
5
+ if (!ex?.meta?.meta?.connection) {
6
+ return ex;
7
+ }
8
+ return {
9
+ ...ex.meta,
10
+ meta: {
11
+ ...ex.meta.meta,
12
+ connection: null
13
+ }
14
+ };
15
+ };
16
+
17
+ //# sourceMappingURL=stripConnectionFromException.js.map
@@ -0,0 +1 @@
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":[]}
@@ -0,0 +1,12 @@
1
+ import type { Cat_Health_ResponseBody, Cat_Nodes_ResponseBody } from "@opensearch-project/opensearch/api/index.js";
2
+ export declare enum OpenSearchCatClusterHealthStatus {
3
+ Green = "green",
4
+ Yellow = "yellow",
5
+ Red = "red"
6
+ }
7
+ type HealthRecord = Cat_Health_ResponseBody[number];
8
+ type NodesRecord = Cat_Nodes_ResponseBody[number];
9
+ export type IOpenSearchCatHealthResponse = HealthRecord;
10
+ export type IOpenSearchCatNodeResponse = NodesRecord;
11
+ export type IOpenSearchCatNodesResponse = IOpenSearchCatNodeResponse[];
12
+ export {};
@@ -0,0 +1,8 @@
1
+ export let OpenSearchCatClusterHealthStatus = /*#__PURE__*/function (OpenSearchCatClusterHealthStatus) {
2
+ OpenSearchCatClusterHealthStatus["Green"] = "green";
3
+ OpenSearchCatClusterHealthStatus["Yellow"] = "yellow";
4
+ OpenSearchCatClusterHealthStatus["Red"] = "red";
5
+ return OpenSearchCatClusterHealthStatus;
6
+ }({});
7
+
8
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["OpenSearchCatClusterHealthStatus"],"sources":["types.ts"],"sourcesContent":["import type {\n Cat_Health_ResponseBody,\n Cat_Nodes_ResponseBody\n} from \"@opensearch-project/opensearch/api/index.js\";\n\nexport enum OpenSearchCatClusterHealthStatus {\n Green = \"green\",\n Yellow = \"yellow\",\n Red = \"red\"\n}\n\ntype HealthRecord = Cat_Health_ResponseBody[number];\n\ntype NodesRecord = Cat_Nodes_ResponseBody[number];\n\nexport type IOpenSearchCatHealthResponse = HealthRecord;\n\nexport type IOpenSearchCatNodeResponse = NodesRecord;\n\nexport type IOpenSearchCatNodesResponse = IOpenSearchCatNodeResponse[];\n"],"mappings":"AAKA,WAAYA,gCAAgC,0BAAhCA,gCAAgC;EAAhCA,gCAAgC;EAAhCA,gCAAgC;EAAhCA,gCAAgC;EAAA,OAAhCA,gCAAgC;AAAA","ignoreList":[]}
package/operators.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { OpenSearchQueryBuilderOperatorBetweenPlugin, OpenSearchQueryBuilderOperatorAndInPlugin, OpenSearchQueryBuilderOperatorGreaterThanOrEqualToPlugin, OpenSearchQueryBuilderOperatorGreaterThanPlugin, OpenSearchQueryBuilderOperatorContainsPlugin, OpenSearchQueryBuilderOperatorLesserThanOrEqualToPlugin, OpenSearchQueryBuilderOperatorInPlugin, OpenSearchQueryBuilderOperatorLesserThanPlugin, OpenSearchQueryBuilderOperatorNotBetweenPlugin, OpenSearchQueryBuilderOperatorNotContainsPlugin, OpenSearchQueryBuilderOperatorNotPlugin, OpenSearchQueryBuilderOperatorNotInPlugin, OpenSearchQueryBuilderOperatorEqualPlugin, OpenSearchQueryBuilderOperatorStartsWithPlugin, OpenSearchQueryBuilderOperatorNotStartsWithPlugin } from "./plugins/operator/index.js";
2
+ /**
3
+ * We export as a function because there might be something to be sent to the operators at some point.
4
+ * This way, we make it easier to upgrade.
5
+ */
6
+ export declare const getOpenSearchOperators: () => (OpenSearchQueryBuilderOperatorBetweenPlugin | OpenSearchQueryBuilderOperatorContainsPlugin | OpenSearchQueryBuilderOperatorEqualPlugin | OpenSearchQueryBuilderOperatorGreaterThanPlugin | OpenSearchQueryBuilderOperatorGreaterThanOrEqualToPlugin | OpenSearchQueryBuilderOperatorAndInPlugin | OpenSearchQueryBuilderOperatorInPlugin | OpenSearchQueryBuilderOperatorLesserThanPlugin | OpenSearchQueryBuilderOperatorLesserThanOrEqualToPlugin | OpenSearchQueryBuilderOperatorNotPlugin | OpenSearchQueryBuilderOperatorNotBetweenPlugin | OpenSearchQueryBuilderOperatorNotContainsPlugin | OpenSearchQueryBuilderOperatorNotInPlugin | OpenSearchQueryBuilderOperatorStartsWithPlugin | OpenSearchQueryBuilderOperatorNotStartsWithPlugin)[];
package/operators.js ADDED
@@ -0,0 +1,9 @@
1
+ import { OpenSearchQueryBuilderOperatorBetweenPlugin, OpenSearchQueryBuilderOperatorAndInPlugin, OpenSearchQueryBuilderOperatorGreaterThanOrEqualToPlugin, OpenSearchQueryBuilderOperatorGreaterThanPlugin, OpenSearchQueryBuilderOperatorContainsPlugin, OpenSearchQueryBuilderOperatorLesserThanOrEqualToPlugin, OpenSearchQueryBuilderOperatorInPlugin, OpenSearchQueryBuilderOperatorLesserThanPlugin, OpenSearchQueryBuilderOperatorNotBetweenPlugin, OpenSearchQueryBuilderOperatorNotContainsPlugin, OpenSearchQueryBuilderOperatorNotPlugin, OpenSearchQueryBuilderOperatorNotInPlugin, OpenSearchQueryBuilderOperatorEqualPlugin, OpenSearchQueryBuilderOperatorStartsWithPlugin, OpenSearchQueryBuilderOperatorNotStartsWithPlugin } from "./plugins/operator/index.js";
2
+ const operators = [new OpenSearchQueryBuilderOperatorBetweenPlugin(), new OpenSearchQueryBuilderOperatorNotBetweenPlugin(), new OpenSearchQueryBuilderOperatorContainsPlugin(), new OpenSearchQueryBuilderOperatorNotContainsPlugin(), new OpenSearchQueryBuilderOperatorEqualPlugin(), new OpenSearchQueryBuilderOperatorNotPlugin(), new OpenSearchQueryBuilderOperatorGreaterThanPlugin(), new OpenSearchQueryBuilderOperatorGreaterThanOrEqualToPlugin(), new OpenSearchQueryBuilderOperatorLesserThanPlugin(), new OpenSearchQueryBuilderOperatorLesserThanOrEqualToPlugin(), new OpenSearchQueryBuilderOperatorInPlugin(), new OpenSearchQueryBuilderOperatorAndInPlugin(), new OpenSearchQueryBuilderOperatorNotInPlugin(), new OpenSearchQueryBuilderOperatorStartsWithPlugin(), new OpenSearchQueryBuilderOperatorNotStartsWithPlugin()];
3
+ /**
4
+ * We export as a function because there might be something to be sent to the operators at some point.
5
+ * This way, we make it easier to upgrade.
6
+ */
7
+ export const getOpenSearchOperators = () => operators;
8
+
9
+ //# sourceMappingURL=operators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["OpenSearchQueryBuilderOperatorBetweenPlugin","OpenSearchQueryBuilderOperatorAndInPlugin","OpenSearchQueryBuilderOperatorGreaterThanOrEqualToPlugin","OpenSearchQueryBuilderOperatorGreaterThanPlugin","OpenSearchQueryBuilderOperatorContainsPlugin","OpenSearchQueryBuilderOperatorLesserThanOrEqualToPlugin","OpenSearchQueryBuilderOperatorInPlugin","OpenSearchQueryBuilderOperatorLesserThanPlugin","OpenSearchQueryBuilderOperatorNotBetweenPlugin","OpenSearchQueryBuilderOperatorNotContainsPlugin","OpenSearchQueryBuilderOperatorNotPlugin","OpenSearchQueryBuilderOperatorNotInPlugin","OpenSearchQueryBuilderOperatorEqualPlugin","OpenSearchQueryBuilderOperatorStartsWithPlugin","OpenSearchQueryBuilderOperatorNotStartsWithPlugin","operators","getOpenSearchOperators"],"sources":["operators.ts"],"sourcesContent":["import {\n OpenSearchQueryBuilderOperatorBetweenPlugin,\n OpenSearchQueryBuilderOperatorAndInPlugin,\n OpenSearchQueryBuilderOperatorGreaterThanOrEqualToPlugin,\n OpenSearchQueryBuilderOperatorGreaterThanPlugin,\n OpenSearchQueryBuilderOperatorContainsPlugin,\n OpenSearchQueryBuilderOperatorLesserThanOrEqualToPlugin,\n OpenSearchQueryBuilderOperatorInPlugin,\n OpenSearchQueryBuilderOperatorLesserThanPlugin,\n OpenSearchQueryBuilderOperatorNotBetweenPlugin,\n OpenSearchQueryBuilderOperatorNotContainsPlugin,\n OpenSearchQueryBuilderOperatorNotPlugin,\n OpenSearchQueryBuilderOperatorNotInPlugin,\n OpenSearchQueryBuilderOperatorEqualPlugin,\n OpenSearchQueryBuilderOperatorStartsWithPlugin,\n OpenSearchQueryBuilderOperatorNotStartsWithPlugin\n} from \"~/plugins/operator/index.js\";\n\nconst operators = [\n new OpenSearchQueryBuilderOperatorBetweenPlugin(),\n new OpenSearchQueryBuilderOperatorNotBetweenPlugin(),\n new OpenSearchQueryBuilderOperatorContainsPlugin(),\n new OpenSearchQueryBuilderOperatorNotContainsPlugin(),\n new OpenSearchQueryBuilderOperatorEqualPlugin(),\n new OpenSearchQueryBuilderOperatorNotPlugin(),\n new OpenSearchQueryBuilderOperatorGreaterThanPlugin(),\n new OpenSearchQueryBuilderOperatorGreaterThanOrEqualToPlugin(),\n new OpenSearchQueryBuilderOperatorLesserThanPlugin(),\n new OpenSearchQueryBuilderOperatorLesserThanOrEqualToPlugin(),\n new OpenSearchQueryBuilderOperatorInPlugin(),\n new OpenSearchQueryBuilderOperatorAndInPlugin(),\n new OpenSearchQueryBuilderOperatorNotInPlugin(),\n new OpenSearchQueryBuilderOperatorStartsWithPlugin(),\n new OpenSearchQueryBuilderOperatorNotStartsWithPlugin()\n];\n/**\n * We export as a function because there might be something to be sent to the operators at some point.\n * This way, we make it easier to upgrade.\n */\nexport const getOpenSearchOperators = () => operators;\n"],"mappings":"AAAA,SACIA,2CAA2C,EAC3CC,yCAAyC,EACzCC,wDAAwD,EACxDC,+CAA+C,EAC/CC,4CAA4C,EAC5CC,uDAAuD,EACvDC,sCAAsC,EACtCC,8CAA8C,EAC9CC,8CAA8C,EAC9CC,+CAA+C,EAC/CC,uCAAuC,EACvCC,yCAAyC,EACzCC,yCAAyC,EACzCC,8CAA8C,EAC9CC,iDAAiD;AAGrD,MAAMC,SAAS,GAAG,CACd,IAAIf,2CAA2C,CAAC,CAAC,EACjD,IAAIQ,8CAA8C,CAAC,CAAC,EACpD,IAAIJ,4CAA4C,CAAC,CAAC,EAClD,IAAIK,+CAA+C,CAAC,CAAC,EACrD,IAAIG,yCAAyC,CAAC,CAAC,EAC/C,IAAIF,uCAAuC,CAAC,CAAC,EAC7C,IAAIP,+CAA+C,CAAC,CAAC,EACrD,IAAID,wDAAwD,CAAC,CAAC,EAC9D,IAAIK,8CAA8C,CAAC,CAAC,EACpD,IAAIF,uDAAuD,CAAC,CAAC,EAC7D,IAAIC,sCAAsC,CAAC,CAAC,EAC5C,IAAIL,yCAAyC,CAAC,CAAC,EAC/C,IAAIU,yCAAyC,CAAC,CAAC,EAC/C,IAAIE,8CAA8C,CAAC,CAAC,EACpD,IAAIC,iDAAiD,CAAC,CAAC,CAC1D;AACD;AACA;AACA;AACA;AACA,OAAO,MAAME,sBAAsB,GAAGA,CAAA,KAAMD,SAAS","ignoreList":[]}
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@webiny/api-opensearch",
3
+ "version": "0.0.0-unstable.e6f0dc8ca7",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": "./index.js",
7
+ "./*": "./*"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/webiny/webiny-js.git",
12
+ "directory": "packages/api-opensearch"
13
+ },
14
+ "description": "A set of plugins to work with OpenSearch.",
15
+ "contributors": [
16
+ "Pavel Denisjuk <pavel@webiny.com>"
17
+ ],
18
+ "license": "MIT",
19
+ "dependencies": {
20
+ "@opensearch-project/opensearch": "3.6.0",
21
+ "@webiny/api": "0.0.0-unstable.e6f0dc8ca7",
22
+ "@webiny/aws-sdk": "0.0.0-unstable.e6f0dc8ca7",
23
+ "@webiny/db-dynamodb": "0.0.0-unstable.e6f0dc8ca7",
24
+ "@webiny/error": "0.0.0-unstable.e6f0dc8ca7",
25
+ "@webiny/feature": "0.0.0-unstable.e6f0dc8ca7",
26
+ "@webiny/plugins": "0.0.0-unstable.e6f0dc8ca7"
27
+ },
28
+ "devDependencies": {
29
+ "@webiny/build-tools": "0.0.0-unstable.e6f0dc8ca7",
30
+ "@webiny/project-utils": "0.0.0-unstable.e6f0dc8ca7",
31
+ "rimraf": "6.1.3",
32
+ "typescript": "6.0.3",
33
+ "vitest": "4.1.5"
34
+ },
35
+ "publishConfig": {
36
+ "access": "public",
37
+ "directory": "dist"
38
+ },
39
+ "gitHead": "e6f0dc8ca741c1fcc3fec9a5b9e86fdd49544641"
40
+ }
@@ -0,0 +1,13 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ import type { SearchBody } from "../../types.js";
3
+ export interface ModifyBodyParams {
4
+ body: SearchBody;
5
+ }
6
+ export interface ModifyBodyCallable<T extends ModifyBodyParams> {
7
+ (params: T): void;
8
+ }
9
+ export declare abstract class OpenSearchBodyModifierPlugin<T extends ModifyBodyParams = ModifyBodyParams> extends Plugin {
10
+ private readonly callable?;
11
+ constructor(callable?: ModifyBodyCallable<T>);
12
+ modifyBody(params: T): void;
13
+ }
@@ -0,0 +1,18 @@
1
+ import WebinyError from "@webiny/error";
2
+ import { Plugin } from "@webiny/plugins";
3
+ export class OpenSearchBodyModifierPlugin extends Plugin {
4
+ constructor(callable) {
5
+ super();
6
+ this.callable = callable;
7
+ }
8
+ modifyBody(params) {
9
+ if (typeof this.callable !== "function") {
10
+ throw new WebinyError(`Missing modification for the body.`, "BODY_MODIFICATION_MISSING", {
11
+ params
12
+ });
13
+ }
14
+ this.callable(params);
15
+ }
16
+ }
17
+
18
+ //# sourceMappingURL=OpenSearchBodyModifierPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["WebinyError","Plugin","OpenSearchBodyModifierPlugin","constructor","callable","modifyBody","params"],"sources":["OpenSearchBodyModifierPlugin.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { Plugin } from \"@webiny/plugins\";\nimport type { SearchBody } from \"~/types.js\";\n\nexport interface ModifyBodyParams {\n body: SearchBody;\n}\n\nexport interface ModifyBodyCallable<T extends ModifyBodyParams> {\n (params: T): void;\n}\n\nexport abstract class OpenSearchBodyModifierPlugin<\n T extends ModifyBodyParams = ModifyBodyParams\n> extends Plugin {\n private readonly callable?: ModifyBodyCallable<T>;\n\n public constructor(callable?: ModifyBodyCallable<T>) {\n super();\n this.callable = callable;\n }\n\n public modifyBody(params: T): void {\n if (typeof this.callable !== \"function\") {\n throw new WebinyError(\n `Missing modification for the body.`,\n \"BODY_MODIFICATION_MISSING\",\n {\n params\n }\n );\n }\n this.callable(params);\n }\n}\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AACvC,SAASC,MAAM,QAAQ,iBAAiB;AAWxC,OAAO,MAAeC,4BAA4B,SAExCD,MAAM,CAAC;EAGNE,WAAWA,CAACC,QAAgC,EAAE;IACjD,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,QAAQ,GAAGA,QAAQ;EAC5B;EAEOC,UAAUA,CAACC,MAAS,EAAQ;IAC/B,IAAI,OAAO,IAAI,CAACF,QAAQ,KAAK,UAAU,EAAE;MACrC,MAAM,IAAIJ,WAAW,CACjB,oCAAoC,EACpC,2BAA2B,EAC3B;QACIM;MACJ,CACJ,CAAC;IACL;IACA,IAAI,CAACF,QAAQ,CAACE,MAAM,CAAC;EACzB;AACJ","ignoreList":[]}