@webiny/api-opensearch 6.4.5 → 6.6.0-alpha.0

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 (204) hide show
  1. package/client.js +1 -24
  2. package/client.js.map +1 -1
  3. package/exports/api/opensearch.d.ts +6 -1
  4. package/exports/api/opensearch.js +6 -1
  5. package/features/OpenSearchClient/abstraction.d.ts +3 -3
  6. package/features/OpenSearchClient/abstraction.js.map +1 -1
  7. package/features/OpenSearchClient/feature.d.ts +2 -1
  8. package/features/OpenSearchClient/feature.js +5 -3
  9. package/features/OpenSearchClient/feature.js.map +1 -1
  10. package/features/OpenSearchField/OpenSearchField.d.ts +18 -0
  11. package/{plugins/definition/OpenSearchFieldPlugin.js → features/OpenSearchField/OpenSearchField.js} +10 -13
  12. package/features/OpenSearchField/OpenSearchField.js.map +1 -0
  13. package/features/OpenSearchField/OpenSearchFieldFactory.d.ts +9 -0
  14. package/features/OpenSearchField/OpenSearchFieldFactory.js +14 -0
  15. package/features/OpenSearchField/OpenSearchFieldFactory.js.map +1 -0
  16. package/features/OpenSearchField/abstractions/OpenSearchField.d.ts +35 -0
  17. package/features/OpenSearchField/abstractions/OpenSearchField.js +6 -0
  18. package/features/OpenSearchField/abstractions/OpenSearchField.js.map +1 -0
  19. package/features/OpenSearchField/abstractions/OpenSearchFieldFactory.d.ts +8 -0
  20. package/features/OpenSearchField/abstractions/OpenSearchFieldFactory.js +5 -0
  21. package/features/OpenSearchField/abstractions/OpenSearchFieldFactory.js.map +1 -0
  22. package/features/OpenSearchField/feature.d.ts +4 -0
  23. package/features/OpenSearchField/feature.js +11 -0
  24. package/features/OpenSearchField/feature.js.map +1 -0
  25. package/features/OpenSearchIndex/OpenSearchIndexRegistry.d.ts +12 -0
  26. package/features/OpenSearchIndex/OpenSearchIndexRegistry.js +30 -0
  27. package/features/OpenSearchIndex/OpenSearchIndexRegistry.js.map +1 -0
  28. package/features/OpenSearchIndex/abstractions/OpenSearchIndex.d.ts +9 -0
  29. package/features/OpenSearchIndex/abstractions/OpenSearchIndex.js +5 -0
  30. package/features/OpenSearchIndex/abstractions/OpenSearchIndex.js.map +1 -0
  31. package/features/OpenSearchIndex/abstractions/OpenSearchIndexRegistry.d.ts +9 -0
  32. package/features/OpenSearchIndex/abstractions/OpenSearchIndexRegistry.js +5 -0
  33. package/features/OpenSearchIndex/abstractions/OpenSearchIndexRegistry.js.map +1 -0
  34. package/features/OpenSearchIndex/feature.d.ts +4 -0
  35. package/features/OpenSearchIndex/feature.js +11 -0
  36. package/features/OpenSearchIndex/feature.js.map +1 -0
  37. package/features/OpenSearchQueryBuilderOperator/OpenSearchQueryBuilderOperatorRegistry.d.ts +12 -0
  38. package/features/OpenSearchQueryBuilderOperator/OpenSearchQueryBuilderOperatorRegistry.js +28 -0
  39. package/features/OpenSearchQueryBuilderOperator/OpenSearchQueryBuilderOperatorRegistry.js.map +1 -0
  40. package/features/OpenSearchQueryBuilderOperator/abstractions/OpenSearchQueryBuilderOperator.d.ts +11 -0
  41. package/features/OpenSearchQueryBuilderOperator/abstractions/OpenSearchQueryBuilderOperator.js +5 -0
  42. package/features/OpenSearchQueryBuilderOperator/abstractions/OpenSearchQueryBuilderOperator.js.map +1 -0
  43. package/features/OpenSearchQueryBuilderOperator/abstractions/OpenSearchQueryBuilderOperatorRegistry.d.ts +10 -0
  44. package/features/OpenSearchQueryBuilderOperator/abstractions/OpenSearchQueryBuilderOperatorRegistry.js +5 -0
  45. package/features/OpenSearchQueryBuilderOperator/abstractions/OpenSearchQueryBuilderOperatorRegistry.js.map +1 -0
  46. package/features/OpenSearchQueryBuilderOperator/feature.d.ts +4 -0
  47. package/features/OpenSearchQueryBuilderOperator/feature.js +41 -0
  48. package/features/OpenSearchQueryBuilderOperator/feature.js.map +1 -0
  49. package/features/OpenSearchQueryBuilderOperator/operators/AndIn.d.ts +9 -0
  50. package/{plugins/operator/andIn.js → features/OpenSearchQueryBuilderOperator/operators/AndIn.js} +8 -7
  51. package/features/OpenSearchQueryBuilderOperator/operators/AndIn.js.map +1 -0
  52. package/features/OpenSearchQueryBuilderOperator/operators/Between.d.ts +9 -0
  53. package/{plugins/operator/between.js → features/OpenSearchQueryBuilderOperator/operators/Between.js} +8 -7
  54. package/features/OpenSearchQueryBuilderOperator/operators/Between.js.map +1 -0
  55. package/features/OpenSearchQueryBuilderOperator/operators/Contains.d.ts +9 -0
  56. package/features/OpenSearchQueryBuilderOperator/operators/Contains.js +27 -0
  57. package/features/OpenSearchQueryBuilderOperator/operators/Contains.js.map +1 -0
  58. package/features/OpenSearchQueryBuilderOperator/operators/Equal.d.ts +9 -0
  59. package/{plugins/operator/equal.js → features/OpenSearchQueryBuilderOperator/operators/Equal.js} +8 -7
  60. package/features/OpenSearchQueryBuilderOperator/operators/Equal.js.map +1 -0
  61. package/features/OpenSearchQueryBuilderOperator/operators/GreaterThan.d.ts +9 -0
  62. package/features/OpenSearchQueryBuilderOperator/operators/GreaterThan.js +23 -0
  63. package/features/OpenSearchQueryBuilderOperator/operators/GreaterThan.js.map +1 -0
  64. package/features/OpenSearchQueryBuilderOperator/operators/GreaterThanOrEqual.d.ts +9 -0
  65. package/features/OpenSearchQueryBuilderOperator/operators/GreaterThanOrEqual.js +23 -0
  66. package/features/OpenSearchQueryBuilderOperator/operators/GreaterThanOrEqual.js.map +1 -0
  67. package/features/OpenSearchQueryBuilderOperator/operators/In.d.ts +9 -0
  68. package/{plugins/operator/in.js → features/OpenSearchQueryBuilderOperator/operators/In.js} +8 -7
  69. package/features/OpenSearchQueryBuilderOperator/operators/In.js.map +1 -0
  70. package/features/OpenSearchQueryBuilderOperator/operators/LesserThan.d.ts +9 -0
  71. package/features/OpenSearchQueryBuilderOperator/operators/LesserThan.js +23 -0
  72. package/features/OpenSearchQueryBuilderOperator/operators/LesserThan.js.map +1 -0
  73. package/features/OpenSearchQueryBuilderOperator/operators/LesserThanOrEqual.d.ts +9 -0
  74. package/features/OpenSearchQueryBuilderOperator/operators/LesserThanOrEqual.js +23 -0
  75. package/features/OpenSearchQueryBuilderOperator/operators/LesserThanOrEqual.js.map +1 -0
  76. package/features/OpenSearchQueryBuilderOperator/operators/Not.d.ts +9 -0
  77. package/{plugins/operator/not.js → features/OpenSearchQueryBuilderOperator/operators/Not.js} +8 -7
  78. package/features/OpenSearchQueryBuilderOperator/operators/Not.js.map +1 -0
  79. package/features/OpenSearchQueryBuilderOperator/operators/NotBetween.d.ts +9 -0
  80. package/{plugins/operator/notBetween.js → features/OpenSearchQueryBuilderOperator/operators/NotBetween.js} +8 -7
  81. package/features/OpenSearchQueryBuilderOperator/operators/NotBetween.js.map +1 -0
  82. package/features/OpenSearchQueryBuilderOperator/operators/NotContains.d.ts +9 -0
  83. package/features/OpenSearchQueryBuilderOperator/operators/NotContains.js +27 -0
  84. package/features/OpenSearchQueryBuilderOperator/operators/NotContains.js.map +1 -0
  85. package/features/OpenSearchQueryBuilderOperator/operators/NotIn.d.ts +9 -0
  86. package/{plugins/operator/notIn.js → features/OpenSearchQueryBuilderOperator/operators/NotIn.js} +8 -7
  87. package/features/OpenSearchQueryBuilderOperator/operators/NotIn.js.map +1 -0
  88. package/features/OpenSearchQueryBuilderOperator/operators/NotStartsWith.d.ts +9 -0
  89. package/features/OpenSearchQueryBuilderOperator/operators/NotStartsWith.js +22 -0
  90. package/features/OpenSearchQueryBuilderOperator/operators/NotStartsWith.js.map +1 -0
  91. package/features/OpenSearchQueryBuilderOperator/operators/StartsWith.d.ts +9 -0
  92. package/features/OpenSearchQueryBuilderOperator/operators/StartsWith.js +22 -0
  93. package/features/OpenSearchQueryBuilderOperator/operators/StartsWith.js.map +1 -0
  94. package/index.d.ts +2 -9
  95. package/index.js +3 -27
  96. package/indices.d.ts +2 -8
  97. package/indices.js +1 -12
  98. package/package.json +11 -10
  99. package/registerOpenSearchCore.d.ts +3 -0
  100. package/registerOpenSearchCore.js +20 -0
  101. package/registerOpenSearchCore.js.map +1 -0
  102. package/sort.d.ts +2 -2
  103. package/sort.js +2 -2
  104. package/sort.js.map +1 -1
  105. package/testing/createBlankQuery.d.ts +2 -0
  106. package/testing/createBlankQuery.js +9 -0
  107. package/testing/createBlankQuery.js.map +1 -0
  108. package/testing/createTestOpenSearchClient.d.ts +11 -0
  109. package/testing/createTestOpenSearchClient.js +162 -0
  110. package/testing/createTestOpenSearchClient.js.map +1 -0
  111. package/testing/index.d.ts +4 -0
  112. package/testing/index.js +4 -0
  113. package/testing/registerOpenSearchCoreForTests.d.ts +1 -0
  114. package/testing/registerOpenSearchCoreForTests.js +9 -0
  115. package/testing/registerOpenSearchCoreForTests.js.map +1 -0
  116. package/testing/setupTestIndexManager.d.ts +13 -0
  117. package/testing/setupTestIndexManager.js +26 -0
  118. package/testing/setupTestIndexManager.js.map +1 -0
  119. package/types.d.ts +0 -8
  120. package/types.js.map +1 -1
  121. package/utils/createIndex.d.ts +2 -2
  122. package/utils/createIndex.js +2 -8
  123. package/utils/createIndex.js.map +1 -1
  124. package/where.d.ts +4 -4
  125. package/where.js +5 -5
  126. package/where.js.map +1 -1
  127. package/features/OpenSearchClient/OpenSearchClient.d.ts +0 -12
  128. package/features/OpenSearchClient/OpenSearchClient.js +0 -19
  129. package/features/OpenSearchClient/OpenSearchClient.js.map +0 -1
  130. package/features/OpenSearchContext/OpenSearchContext.d.ts +0 -8
  131. package/features/OpenSearchContext/OpenSearchContext.js +0 -14
  132. package/features/OpenSearchContext/OpenSearchContext.js.map +0 -1
  133. package/features/OpenSearchContext/abstraction.d.ts +0 -14
  134. package/features/OpenSearchContext/abstraction.js +0 -5
  135. package/features/OpenSearchContext/abstraction.js.map +0 -1
  136. package/features/OpenSearchContext/feature.d.ts +0 -5
  137. package/features/OpenSearchContext/feature.js +0 -12
  138. package/features/OpenSearchContext/feature.js.map +0 -1
  139. package/index.js.map +0 -1
  140. package/indices.js.map +0 -1
  141. package/operators.d.ts +0 -6
  142. package/operators.js +0 -22
  143. package/operators.js.map +0 -1
  144. package/plugins/definition/OpenSearchBodyModifierPlugin.d.ts +0 -13
  145. package/plugins/definition/OpenSearchBodyModifierPlugin.js +0 -17
  146. package/plugins/definition/OpenSearchBodyModifierPlugin.js.map +0 -1
  147. package/plugins/definition/OpenSearchFieldPlugin.d.ts +0 -81
  148. package/plugins/definition/OpenSearchFieldPlugin.js.map +0 -1
  149. package/plugins/definition/OpenSearchIndexPlugin.d.ts +0 -10
  150. package/plugins/definition/OpenSearchIndexPlugin.js +0 -16
  151. package/plugins/definition/OpenSearchIndexPlugin.js.map +0 -1
  152. package/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.d.ts +0 -10
  153. package/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js +0 -9
  154. package/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js.map +0 -1
  155. package/plugins/definition/OpenSearchQueryModifierPlugin.d.ts +0 -14
  156. package/plugins/definition/OpenSearchQueryModifierPlugin.js +0 -17
  157. package/plugins/definition/OpenSearchQueryModifierPlugin.js.map +0 -1
  158. package/plugins/definition/OpenSearchSortModifierPlugin.d.ts +0 -13
  159. package/plugins/definition/OpenSearchSortModifierPlugin.js +0 -17
  160. package/plugins/definition/OpenSearchSortModifierPlugin.js.map +0 -1
  161. package/plugins/definition/index.d.ts +0 -6
  162. package/plugins/definition/index.js +0 -6
  163. package/plugins/index.d.ts +0 -2
  164. package/plugins/index.js +0 -2
  165. package/plugins/operator/andIn.d.ts +0 -7
  166. package/plugins/operator/andIn.js.map +0 -1
  167. package/plugins/operator/between.d.ts +0 -7
  168. package/plugins/operator/between.js.map +0 -1
  169. package/plugins/operator/contains.d.ts +0 -7
  170. package/plugins/operator/contains.js +0 -26
  171. package/plugins/operator/contains.js.map +0 -1
  172. package/plugins/operator/equal.d.ts +0 -7
  173. package/plugins/operator/equal.js.map +0 -1
  174. package/plugins/operator/gt.d.ts +0 -7
  175. package/plugins/operator/gt.js +0 -22
  176. package/plugins/operator/gt.js.map +0 -1
  177. package/plugins/operator/gte.d.ts +0 -7
  178. package/plugins/operator/gte.js +0 -22
  179. package/plugins/operator/gte.js.map +0 -1
  180. package/plugins/operator/in.d.ts +0 -7
  181. package/plugins/operator/in.js.map +0 -1
  182. package/plugins/operator/index.d.ts +0 -15
  183. package/plugins/operator/index.js +0 -15
  184. package/plugins/operator/lt.d.ts +0 -7
  185. package/plugins/operator/lt.js +0 -22
  186. package/plugins/operator/lt.js.map +0 -1
  187. package/plugins/operator/lte.d.ts +0 -7
  188. package/plugins/operator/lte.js +0 -22
  189. package/plugins/operator/lte.js.map +0 -1
  190. package/plugins/operator/not.d.ts +0 -7
  191. package/plugins/operator/not.js.map +0 -1
  192. package/plugins/operator/notBetween.d.ts +0 -7
  193. package/plugins/operator/notBetween.js.map +0 -1
  194. package/plugins/operator/notContains.d.ts +0 -7
  195. package/plugins/operator/notContains.js +0 -26
  196. package/plugins/operator/notContains.js.map +0 -1
  197. package/plugins/operator/notIn.d.ts +0 -7
  198. package/plugins/operator/notIn.js.map +0 -1
  199. package/plugins/operator/notStartsWith.d.ts +0 -7
  200. package/plugins/operator/notStartsWith.js +0 -21
  201. package/plugins/operator/notStartsWith.js.map +0 -1
  202. package/plugins/operator/startsWith.d.ts +0 -7
  203. package/plugins/operator/startsWith.js +0 -21
  204. package/plugins/operator/startsWith.js.map +0 -1
package/client.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import crypto_0 from "crypto";
2
2
  import error from "@webiny/error";
3
3
  import { Client } from "@opensearch-project/opensearch";
4
- import { AwsSigv4Signer } from "@opensearch-project/opensearch/aws";
5
4
  const clients = new Map();
6
5
  const createClientKey = (options)=>{
7
6
  const key = JSON.stringify(options);
@@ -14,32 +13,10 @@ const createOpenSearchClient = (options)=>{
14
13
  const existing = clients.get(key);
15
14
  if (existing) return existing;
16
15
  const { endpoint, node, ...rest } = options;
17
- let clientOptions = {
16
+ const clientOptions = {
18
17
  node: endpoint || node,
19
18
  ...rest
20
19
  };
21
- if (!clientOptions.auth) {
22
- const region = process.env.AWS_REGION;
23
- if (!region) throw new error("Missing AWS_REGION environment variable.", "MISSING_AWS_REGION");
24
- clientOptions = {
25
- ...clientOptions,
26
- ...AwsSigv4Signer({
27
- region,
28
- service: "es",
29
- getCredentials: ()=>{
30
- const accessKeyId = process.env.AWS_ACCESS_KEY_ID;
31
- const secretAccessKey = process.env.AWS_SECRET_ACCESS_KEY;
32
- const sessionToken = process.env.AWS_SESSION_TOKEN;
33
- if (!accessKeyId || !secretAccessKey) throw new error("Missing AWS credentials (AWS_ACCESS_KEY_ID or AWS_SECRET_ACCESS_KEY).", "MISSING_AWS_CREDENTIALS");
34
- return Promise.resolve({
35
- accessKeyId,
36
- secretAccessKey,
37
- sessionToken
38
- });
39
- }
40
- })
41
- };
42
- }
43
20
  try {
44
21
  const client = new Client(clientOptions);
45
22
  clients.set(key, client);
package/client.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sources":["../src/client.ts"],"sourcesContent":["import crypto from \"crypto\";\nimport WebinyError from \"@webiny/error\";\nimport { Client } from \"@opensearch-project/opensearch\";\nimport type { ClientOptions } from \"@opensearch-project/opensearch\";\nimport { AwsSigv4Signer } from \"@opensearch-project/opensearch/aws\";\n\nexport interface OpenSearchClientOptions extends ClientOptions {\n endpoint?: string;\n}\n\nexport { Client };\nexport type { OpenSearchClientOptions as ClientOptions };\n\nconst clients = new Map<string, Client>();\n\nconst createClientKey = (options: OpenSearchClientOptions): string => {\n const key = JSON.stringify(options);\n const hash = crypto.createHash(\"sha256\");\n hash.update(key);\n return hash.digest(\"hex\");\n};\n\nexport const createOpenSearchClient = (options: OpenSearchClientOptions): Client => {\n const key = createClientKey(options);\n const existing = clients.get(key);\n if (existing) {\n return existing;\n }\n\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 = process.env.AWS_REGION;\n if (!region) {\n throw new WebinyError(\"Missing AWS_REGION environment variable.\", \"MISSING_AWS_REGION\");\n }\n\n clientOptions = {\n ...clientOptions,\n ...AwsSigv4Signer({\n region,\n service: \"es\",\n getCredentials: () => {\n const accessKeyId = process.env.AWS_ACCESS_KEY_ID;\n const secretAccessKey = process.env.AWS_SECRET_ACCESS_KEY;\n const sessionToken = process.env.AWS_SESSION_TOKEN;\n\n if (!accessKeyId || !secretAccessKey) {\n throw new WebinyError(\n \"Missing AWS credentials (AWS_ACCESS_KEY_ID or AWS_SECRET_ACCESS_KEY).\",\n \"MISSING_AWS_CREDENTIALS\"\n );\n }\n\n return Promise.resolve({ accessKeyId, secretAccessKey, sessionToken });\n }\n })\n };\n }\n\n try {\n const client = new Client(clientOptions);\n clients.set(key, client);\n return client;\n } catch (ex) {\n const data = {\n error: ex,\n node: endpoint || node,\n ...rest,\n auth: undefined\n };\n console.error(data);\n throw new WebinyError(\"Could not connect to OpenSearch.\", \"OPENSEARCH_CLIENT_ERROR\", data);\n }\n};\n"],"names":["clients","Map","createClientKey","options","key","JSON","hash","crypto","createOpenSearchClient","existing","endpoint","node","rest","clientOptions","region","process","WebinyError","AwsSigv4Signer","accessKeyId","secretAccessKey","sessionToken","Promise","client","Client","ex","data","undefined","console"],"mappings":";;;;AAaA,MAAMA,UAAU,IAAIC;AAEpB,MAAMC,kBAAkB,CAACC;IACrB,MAAMC,MAAMC,KAAK,SAAS,CAACF;IAC3B,MAAMG,OAAOC,SAAAA,UAAiB,CAAC;IAC/BD,KAAK,MAAM,CAACF;IACZ,OAAOE,KAAK,MAAM,CAAC;AACvB;AAEO,MAAME,yBAAyB,CAACL;IACnC,MAAMC,MAAMF,gBAAgBC;IAC5B,MAAMM,WAAWT,QAAQ,GAAG,CAACI;IAC7B,IAAIK,UACA,OAAOA;IAGX,MAAM,EAAEC,QAAQ,EAAEC,IAAI,EAAE,GAAGC,MAAM,GAAGT;IAEpC,IAAIU,gBAA+B;QAC/B,MAAMH,YAAYC;QAClB,GAAGC,IAAI;IACX;IAEA,IAAI,CAACC,cAAc,IAAI,EAAE;QACrB,MAAMC,SAASC,QAAQ,GAAG,CAAC,UAAU;QACrC,IAAI,CAACD,QACD,MAAM,IAAIE,MAAY,4CAA4C;QAGtEH,gBAAgB;YACZ,GAAGA,aAAa;YAChB,GAAGI,eAAe;gBACdH;gBACA,SAAS;gBACT,gBAAgB;oBACZ,MAAMI,cAAcH,QAAQ,GAAG,CAAC,iBAAiB;oBACjD,MAAMI,kBAAkBJ,QAAQ,GAAG,CAAC,qBAAqB;oBACzD,MAAMK,eAAeL,QAAQ,GAAG,CAAC,iBAAiB;oBAElD,IAAI,CAACG,eAAe,CAACC,iBACjB,MAAM,IAAIH,MACN,yEACA;oBAIR,OAAOK,QAAQ,OAAO,CAAC;wBAAEH;wBAAaC;wBAAiBC;oBAAa;gBACxE;YACJ,EAAE;QACN;IACJ;IAEA,IAAI;QACA,MAAME,SAAS,IAAIC,OAAOV;QAC1Bb,QAAQ,GAAG,CAACI,KAAKkB;QACjB,OAAOA;IACX,EAAE,OAAOE,IAAI;QACT,MAAMC,OAAO;YACT,OAAOD;YACP,MAAMd,YAAYC;YAClB,GAAGC,IAAI;YACP,MAAMc;QACV;QACAC,QAAQ,KAAK,CAACF;QACd,MAAM,IAAIT,MAAY,oCAAoC,2BAA2BS;IACzF;AACJ"}
1
+ {"version":3,"file":"client.js","sources":["../src/client.ts"],"sourcesContent":["import crypto from \"crypto\";\nimport WebinyError from \"@webiny/error\";\nimport { Client } from \"@opensearch-project/opensearch\";\nimport type { ClientOptions } from \"@opensearch-project/opensearch\";\n\nexport interface OpenSearchClientOptions extends ClientOptions {\n endpoint?: string;\n}\n\nexport { Client };\nexport type { OpenSearchClientOptions as ClientOptions };\n\nconst clients = new Map<string, Client>();\n\nconst createClientKey = (options: OpenSearchClientOptions): string => {\n const key = JSON.stringify(options);\n const hash = crypto.createHash(\"sha256\");\n hash.update(key);\n return hash.digest(\"hex\");\n};\n\nexport const createOpenSearchClient = (options: OpenSearchClientOptions): Client => {\n const key = createClientKey(options);\n const existing = clients.get(key);\n if (existing) {\n return existing;\n }\n\n const { endpoint, node, ...rest } = options;\n\n const clientOptions: ClientOptions = {\n node: endpoint || node,\n ...rest\n };\n\n try {\n const client = new Client(clientOptions);\n clients.set(key, client);\n return client;\n } catch (ex) {\n const data = {\n error: ex,\n node: endpoint || node,\n ...rest,\n auth: undefined\n };\n console.error(data);\n throw new WebinyError(\"Could not connect to OpenSearch.\", \"OPENSEARCH_CLIENT_ERROR\", data);\n }\n};\n"],"names":["clients","Map","createClientKey","options","key","JSON","hash","crypto","createOpenSearchClient","existing","endpoint","node","rest","clientOptions","client","Client","ex","data","undefined","console","WebinyError"],"mappings":";;;AAYA,MAAMA,UAAU,IAAIC;AAEpB,MAAMC,kBAAkB,CAACC;IACrB,MAAMC,MAAMC,KAAK,SAAS,CAACF;IAC3B,MAAMG,OAAOC,SAAAA,UAAiB,CAAC;IAC/BD,KAAK,MAAM,CAACF;IACZ,OAAOE,KAAK,MAAM,CAAC;AACvB;AAEO,MAAME,yBAAyB,CAACL;IACnC,MAAMC,MAAMF,gBAAgBC;IAC5B,MAAMM,WAAWT,QAAQ,GAAG,CAACI;IAC7B,IAAIK,UACA,OAAOA;IAGX,MAAM,EAAEC,QAAQ,EAAEC,IAAI,EAAE,GAAGC,MAAM,GAAGT;IAEpC,MAAMU,gBAA+B;QACjC,MAAMH,YAAYC;QAClB,GAAGC,IAAI;IACX;IAEA,IAAI;QACA,MAAME,SAAS,IAAIC,OAAOF;QAC1Bb,QAAQ,GAAG,CAACI,KAAKU;QACjB,OAAOA;IACX,EAAE,OAAOE,IAAI;QACT,MAAMC,OAAO;YACT,OAAOD;YACP,MAAMN,YAAYC;YAClB,GAAGC,IAAI;YACP,MAAMM;QACV;QACAC,QAAQ,KAAK,CAACF;QACd,MAAM,IAAIG,MAAY,oCAAoC,2BAA2BH;IACzF;AACJ"}
@@ -1,4 +1,9 @@
1
1
  export { createOpenSearchClient } from "../../client.js";
2
2
  export { OpenSearchClient } from "../../features/OpenSearchClient/abstraction.js";
3
- export { OpenSearchContext } from "../../features/OpenSearchContext/abstraction.js";
4
3
  export { OpenSearchClientFactory } from "../../features/OpenSearchClientFactory/abstraction.js";
4
+ export { OpenSearchQueryBuilderOperator } from "../../features/OpenSearchQueryBuilderOperator/abstractions/OpenSearchQueryBuilderOperator.js";
5
+ export { OpenSearchQueryBuilderOperatorRegistry } from "../../features/OpenSearchQueryBuilderOperator/abstractions/OpenSearchQueryBuilderOperatorRegistry.js";
6
+ export { OpenSearchField, OpenSearchFieldAll } from "../../features/OpenSearchField/abstractions/OpenSearchField.js";
7
+ export { OpenSearchFieldFactory } from "../../features/OpenSearchField/abstractions/OpenSearchFieldFactory.js";
8
+ export { OpenSearchIndex } from "../../features/OpenSearchIndex/abstractions/OpenSearchIndex.js";
9
+ export { OpenSearchIndexRegistry } from "../../features/OpenSearchIndex/abstractions/OpenSearchIndexRegistry.js";
@@ -1,4 +1,9 @@
1
1
  export { createOpenSearchClient } from "../../client.js";
2
2
  export { OpenSearchClient } from "../../features/OpenSearchClient/abstraction.js";
3
- export { OpenSearchContext } from "../../features/OpenSearchContext/abstraction.js";
4
3
  export { OpenSearchClientFactory } from "../../features/OpenSearchClientFactory/abstraction.js";
4
+ export { OpenSearchQueryBuilderOperator } from "../../features/OpenSearchQueryBuilderOperator/abstractions/OpenSearchQueryBuilderOperator.js";
5
+ export { OpenSearchQueryBuilderOperatorRegistry } from "../../features/OpenSearchQueryBuilderOperator/abstractions/OpenSearchQueryBuilderOperatorRegistry.js";
6
+ export { OpenSearchField, OpenSearchFieldAll } from "../../features/OpenSearchField/abstractions/OpenSearchField.js";
7
+ export { OpenSearchFieldFactory } from "../../features/OpenSearchField/abstractions/OpenSearchFieldFactory.js";
8
+ export { OpenSearchIndex } from "../../features/OpenSearchIndex/abstractions/OpenSearchIndex.js";
9
+ export { OpenSearchIndexRegistry } from "../../features/OpenSearchIndex/abstractions/OpenSearchIndexRegistry.js";
@@ -1,9 +1,9 @@
1
- import type { Client } from "../../client.js";
1
+ import type { Client as IClient } from "../../client.js";
2
2
  export interface IOpenSearchClient {
3
- use(): Client;
3
+ use(): IClient;
4
4
  }
5
5
  export declare const OpenSearchClient: import("@webiny/di").Abstraction<IOpenSearchClient>;
6
6
  export declare namespace OpenSearchClient {
7
7
  type Interface = IOpenSearchClient;
8
- type Return = Client;
8
+ type Client = IClient;
9
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"features/OpenSearchClient/abstraction.js","sources":["../../../src/features/OpenSearchClient/abstraction.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Client } from \"~/client.js\";\n\nexport interface IOpenSearchClient {\n use(): Client;\n}\n\nexport const OpenSearchClient = createAbstraction<IOpenSearchClient>(\"OpenSearch/Client\");\n\nexport namespace OpenSearchClient {\n export type Interface = IOpenSearchClient;\n export type Return = Client;\n}\n"],"names":["OpenSearchClient","createAbstraction"],"mappings":";AAOO,MAAMA,mBAAmBC,kBAAqC"}
1
+ {"version":3,"file":"features/OpenSearchClient/abstraction.js","sources":["../../../src/features/OpenSearchClient/abstraction.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Client as IClient } from \"~/client.js\";\n\nexport interface IOpenSearchClient {\n use(): IClient;\n}\n\nexport const OpenSearchClient = createAbstraction<IOpenSearchClient>(\"OpenSearch/Client\");\n\nexport namespace OpenSearchClient {\n export type Interface = IOpenSearchClient;\n export type Client = IClient;\n}\n"],"names":["OpenSearchClient","createAbstraction"],"mappings":";AAOO,MAAMA,mBAAmBC,kBAAqC"}
@@ -1,4 +1,5 @@
1
+ import type { Client } from "../../client.js";
1
2
  export declare const OpenSearchClientFeature: {
2
3
  name: string;
3
- register(container: import("@webiny/di").Container): void;
4
+ register(container: import("@webiny/di").Container, context: Client): void;
4
5
  };
@@ -1,9 +1,11 @@
1
1
  import { createFeature } from "@webiny/feature/api/index.js";
2
- import { OpenSearchClient } from "./OpenSearchClient.js";
2
+ import { OpenSearchClient } from "./abstraction.js";
3
3
  const OpenSearchClientFeature = createFeature({
4
4
  name: "opensearch.internal.client",
5
- register (container) {
6
- container.register(OpenSearchClient);
5
+ register (container, client) {
6
+ container.registerInstance(OpenSearchClient, {
7
+ use: ()=>client
8
+ });
7
9
  }
8
10
  });
9
11
  export { OpenSearchClientFeature };
@@ -1 +1 @@
1
- {"version":3,"file":"features/OpenSearchClient/feature.js","sources":["../../../src/features/OpenSearchClient/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api/index.js\";\n\nimport { OpenSearchClient } from \"./OpenSearchClient.js\";\n\nexport const OpenSearchClientFeature = createFeature({\n name: \"opensearch.internal.client\",\n register(container) {\n container.register(OpenSearchClient);\n }\n});\n"],"names":["OpenSearchClientFeature","createFeature","container","OpenSearchClient"],"mappings":";;AAIO,MAAMA,0BAA0BC,cAAc;IACjD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
1
+ {"version":3,"file":"features/OpenSearchClient/feature.js","sources":["../../../src/features/OpenSearchClient/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api/index.js\";\nimport type { Client } from \"~/client.js\";\nimport { OpenSearchClient } from \"./abstraction.js\";\n\nexport const OpenSearchClientFeature = createFeature<Client>({\n name: \"opensearch.internal.client\",\n register(container, client) {\n container.registerInstance(OpenSearchClient, {\n use: () => {\n return client;\n }\n });\n }\n});\n"],"names":["OpenSearchClientFeature","createFeature","container","client","OpenSearchClient"],"mappings":";;AAIO,MAAMA,0BAA0BC,cAAsB;IACzD,MAAM;IACN,UAASC,SAAS,EAAEC,MAAM;QACtBD,UAAU,gBAAgB,CAACE,kBAAkB;YACzC,KAAK,IACMD;QAEf;IACJ;AACJ"}
@@ -0,0 +1,18 @@
1
+ import type { FieldSortOptions } from "../../types.js";
2
+ import type { SortOrder } from "../../types.js";
3
+ import type { OpenSearchField as OpenSearchFieldAbstraction } from "./abstractions/OpenSearchField.js";
4
+ export declare class OpenSearchField implements OpenSearchFieldAbstraction.Interface {
5
+ readonly field: string;
6
+ readonly path: string;
7
+ readonly keyword: boolean;
8
+ readonly unmappedType?: string;
9
+ readonly sortable: boolean;
10
+ readonly searchable: boolean;
11
+ private readonly searchValueFn?;
12
+ static create(params: OpenSearchFieldAbstraction.Params): OpenSearchField;
13
+ private constructor();
14
+ getSortOptions(order: SortOrder): FieldSortOptions;
15
+ getPath(field: string): string;
16
+ getBasePath(field: string): string;
17
+ toSearchValue(params: OpenSearchFieldAbstraction.SearchValueParams): any;
18
+ }
@@ -1,4 +1,3 @@
1
- import { Plugin } from "@webiny/plugins";
2
1
  const keywordLessUnmappedType = [
3
2
  "date",
4
3
  "long"
@@ -9,22 +8,19 @@ const unmappedTypeHasKeyword = (type)=>{
9
8
  }
10
9
  return true;
11
10
  };
12
- class OpenSearchFieldPlugin extends Plugin {
13
- static{
14
- this.type = "opensearch.fieldDefinition";
15
- }
16
- static{
17
- this.ALL = "*";
11
+ class OpenSearchField {
12
+ static create(params) {
13
+ return new OpenSearchField(params);
18
14
  }
19
15
  constructor(params){
20
- super();
21
16
  this.field = params.field;
22
17
  this.path = params.path || params.field;
23
- this.keyword = void 0 === params.keyword ? true : params.keyword;
24
18
  this.unmappedType = params.unmappedType;
25
- if (false === unmappedTypeHasKeyword(params.unmappedType)) this.keyword = false;
19
+ const keyword = void 0 === params.keyword ? true : params.keyword;
20
+ this.keyword = unmappedTypeHasKeyword(params.unmappedType) ? keyword : false;
26
21
  this.sortable = void 0 === params.sortable ? true : params.sortable;
27
22
  this.searchable = void 0 === params.searchable ? true : params.searchable;
23
+ this.searchValueFn = params.toSearchValue;
28
24
  }
29
25
  getSortOptions(order) {
30
26
  const options = {
@@ -40,13 +36,14 @@ class OpenSearchFieldPlugin extends Plugin {
40
36
  return `${this.getBasePath(field)}${this.keyword ? ".keyword" : ""}`;
41
37
  }
42
38
  getBasePath(field) {
43
- if (this.path === OpenSearchFieldPlugin.ALL) return field;
39
+ if ("*" === this.path) return field;
44
40
  return this.path;
45
41
  }
46
42
  toSearchValue(params) {
43
+ if (this.searchValueFn) return this.searchValueFn(params);
47
44
  return params.value;
48
45
  }
49
46
  }
50
- export { OpenSearchFieldPlugin };
47
+ export { OpenSearchField };
51
48
 
52
- //# sourceMappingURL=OpenSearchFieldPlugin.js.map
49
+ //# sourceMappingURL=OpenSearchField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/OpenSearchField/OpenSearchField.js","sources":["../../../src/features/OpenSearchField/OpenSearchField.ts"],"sourcesContent":["import type { FieldSortOptions } from \"~/types.js\";\nimport type { SortOrder } from \"~/types.js\";\nimport type { OpenSearchField as OpenSearchFieldAbstraction } from \"./abstractions/OpenSearchField.js\";\n\nconst keywordLessUnmappedType = [\"date\", \"long\"];\n\nconst unmappedTypeHasKeyword = (type?: string): boolean => {\n if (!type) {\n return true;\n } else if (keywordLessUnmappedType.includes(type)) {\n return false;\n }\n return true;\n};\n\nexport class OpenSearchField implements OpenSearchFieldAbstraction.Interface {\n public readonly field: string;\n public readonly path: string;\n public readonly keyword: boolean;\n public readonly unmappedType?: string;\n public readonly sortable: boolean;\n public readonly searchable: boolean;\n private readonly searchValueFn?: (params: OpenSearchFieldAbstraction.SearchValueParams) => any;\n\n public static create(params: OpenSearchFieldAbstraction.Params) {\n return new OpenSearchField(params);\n }\n\n private constructor(params: OpenSearchFieldAbstraction.Params) {\n this.field = params.field;\n this.path = params.path || params.field;\n this.unmappedType = params.unmappedType;\n const keyword = params.keyword === undefined ? true : params.keyword;\n this.keyword = unmappedTypeHasKeyword(params.unmappedType) ? keyword : false;\n this.sortable = params.sortable === undefined ? true : params.sortable;\n this.searchable = params.searchable === undefined ? true : params.searchable;\n this.searchValueFn = params.toSearchValue;\n }\n\n public getSortOptions(order: SortOrder): FieldSortOptions {\n const options = {\n order\n };\n if (!this.unmappedType) {\n return options;\n }\n return {\n ...options,\n unmapped_type: this.unmappedType as any\n };\n }\n\n public getPath(field: string): string {\n return `${this.getBasePath(field)}${this.keyword ? \".keyword\" : \"\"}`;\n }\n\n public getBasePath(field: string): string {\n if (this.path === \"*\") {\n return field;\n }\n return this.path;\n }\n\n public toSearchValue(params: OpenSearchFieldAbstraction.SearchValueParams): any {\n if (this.searchValueFn) {\n return this.searchValueFn(params);\n }\n return params.value;\n }\n}\n"],"names":["keywordLessUnmappedType","unmappedTypeHasKeyword","type","OpenSearchField","params","keyword","undefined","order","options","field"],"mappings":"AAIA,MAAMA,0BAA0B;IAAC;IAAQ;CAAO;AAEhD,MAAMC,yBAAyB,CAACC;IAC5B,IAAKA,MAEE;QAAA,IAAIF,wBAAwB,QAAQ,CAACE,OACxC,OAAO;IACX;IACA,OAAO;AACX;AAEO,MAAMC;IAST,OAAc,OAAOC,MAAyC,EAAE;QAC5D,OAAO,IAAID,gBAAgBC;IAC/B;IAEA,YAAoBA,MAAyC,CAAE;QAC3D,IAAI,CAAC,KAAK,GAAGA,OAAO,KAAK;QACzB,IAAI,CAAC,IAAI,GAAGA,OAAO,IAAI,IAAIA,OAAO,KAAK;QACvC,IAAI,CAAC,YAAY,GAAGA,OAAO,YAAY;QACvC,MAAMC,UAAUD,AAAmBE,WAAnBF,OAAO,OAAO,GAAiB,OAAOA,OAAO,OAAO;QACpE,IAAI,CAAC,OAAO,GAAGH,uBAAuBG,OAAO,YAAY,IAAIC,UAAU;QACvE,IAAI,CAAC,QAAQ,GAAGD,AAAoBE,WAApBF,OAAO,QAAQ,GAAiB,OAAOA,OAAO,QAAQ;QACtE,IAAI,CAAC,UAAU,GAAGA,AAAsBE,WAAtBF,OAAO,UAAU,GAAiB,OAAOA,OAAO,UAAU;QAC5E,IAAI,CAAC,aAAa,GAAGA,OAAO,aAAa;IAC7C;IAEO,eAAeG,KAAgB,EAAoB;QACtD,MAAMC,UAAU;YACZD;QACJ;QACA,IAAI,CAAC,IAAI,CAAC,YAAY,EAClB,OAAOC;QAEX,OAAO;YACH,GAAGA,OAAO;YACV,eAAe,IAAI,CAAC,YAAY;QACpC;IACJ;IAEO,QAAQC,KAAa,EAAU;QAClC,OAAO,GAAG,IAAI,CAAC,WAAW,CAACA,SAAS,IAAI,CAAC,OAAO,GAAG,aAAa,IAAI;IACxE;IAEO,YAAYA,KAAa,EAAU;QACtC,IAAI,AAAc,QAAd,IAAI,CAAC,IAAI,EACT,OAAOA;QAEX,OAAO,IAAI,CAAC,IAAI;IACpB;IAEO,cAAcL,MAAoD,EAAO;QAC5E,IAAI,IAAI,CAAC,aAAa,EAClB,OAAO,IAAI,CAAC,aAAa,CAACA;QAE9B,OAAOA,OAAO,KAAK;IACvB;AACJ"}
@@ -0,0 +1,9 @@
1
+ import { OpenSearchFieldFactory as Abstraction } from "./abstractions/OpenSearchFieldFactory.js";
2
+ import type { OpenSearchField as OpenSearchFieldAbstraction } from "./abstractions/OpenSearchField.js";
3
+ declare class OpenSearchFieldFactoryImpl implements Abstraction.Interface {
4
+ create(params: OpenSearchFieldAbstraction.Params): OpenSearchFieldAbstraction.Interface;
5
+ }
6
+ export declare const OpenSearchFieldFactory: typeof OpenSearchFieldFactoryImpl & {
7
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions/OpenSearchFieldFactory.js").IOpenSearchFieldFactory>;
8
+ };
9
+ export {};
@@ -0,0 +1,14 @@
1
+ import { OpenSearchFieldFactory } from "./abstractions/OpenSearchFieldFactory.js";
2
+ import { OpenSearchField } from "./OpenSearchField.js";
3
+ class OpenSearchFieldFactoryImpl {
4
+ create(params) {
5
+ return OpenSearchField.create(params);
6
+ }
7
+ }
8
+ const OpenSearchFieldFactory_OpenSearchFieldFactory = OpenSearchFieldFactory.createImplementation({
9
+ implementation: OpenSearchFieldFactoryImpl,
10
+ dependencies: []
11
+ });
12
+ export { OpenSearchFieldFactory_OpenSearchFieldFactory as OpenSearchFieldFactory };
13
+
14
+ //# sourceMappingURL=OpenSearchFieldFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/OpenSearchField/OpenSearchFieldFactory.js","sources":["../../../src/features/OpenSearchField/OpenSearchFieldFactory.ts"],"sourcesContent":["import { OpenSearchFieldFactory as Abstraction } from \"./abstractions/OpenSearchFieldFactory.js\";\nimport type { OpenSearchField as OpenSearchFieldAbstraction } from \"./abstractions/OpenSearchField.js\";\nimport { OpenSearchField } from \"./OpenSearchField.js\";\n\nclass OpenSearchFieldFactoryImpl implements Abstraction.Interface {\n public create(params: OpenSearchFieldAbstraction.Params): OpenSearchFieldAbstraction.Interface {\n return OpenSearchField.create(params);\n }\n}\n\nexport const OpenSearchFieldFactory = Abstraction.createImplementation({\n implementation: OpenSearchFieldFactoryImpl,\n dependencies: []\n});\n"],"names":["OpenSearchFieldFactoryImpl","params","OpenSearchField","OpenSearchFieldFactory","Abstraction"],"mappings":";;AAIA,MAAMA;IACK,OAAOC,MAAyC,EAAwC;QAC3F,OAAOC,gBAAgB,MAAM,CAACD;IAClC;AACJ;AAEO,MAAME,gDAAyBC,uBAAAA,oBAAgC,CAAC;IACnE,gBAAgBJ;IAChB,cAAc,EAAE;AACpB"}
@@ -0,0 +1,35 @@
1
+ import type { FieldSortOptions } from "../../../types.js";
2
+ import type { SortOrder } from "../../../types.js";
3
+ export interface ToSearchValueParams {
4
+ value: any;
5
+ path: string;
6
+ basePath: string;
7
+ }
8
+ export interface OpenSearchFieldParams {
9
+ field: string;
10
+ path?: string;
11
+ keyword?: boolean;
12
+ unmappedType?: string;
13
+ sortable?: boolean;
14
+ searchable?: boolean;
15
+ toSearchValue?: (params: ToSearchValueParams) => any;
16
+ }
17
+ export interface IOpenSearchField {
18
+ readonly field: string;
19
+ readonly path: string;
20
+ readonly keyword: boolean;
21
+ readonly unmappedType?: string;
22
+ readonly sortable: boolean;
23
+ readonly searchable: boolean;
24
+ getPath(field: string): string;
25
+ getBasePath(field: string): string;
26
+ getSortOptions(order: SortOrder): FieldSortOptions;
27
+ toSearchValue(params: ToSearchValueParams): any;
28
+ }
29
+ export declare const OpenSearchField: import("@webiny/di").Abstraction<IOpenSearchField>;
30
+ export declare namespace OpenSearchField {
31
+ type Interface = IOpenSearchField;
32
+ type Params = OpenSearchFieldParams;
33
+ type SearchValueParams = ToSearchValueParams;
34
+ }
35
+ export declare const OpenSearchFieldAll: "*";
@@ -0,0 +1,6 @@
1
+ import { createAbstraction } from "@webiny/feature/exports/api.js";
2
+ const OpenSearchField = createAbstraction("OpenSearch/Field");
3
+ const OpenSearchFieldAll = "*";
4
+ export { OpenSearchField, OpenSearchFieldAll };
5
+
6
+ //# sourceMappingURL=OpenSearchField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/OpenSearchField/abstractions/OpenSearchField.js","sources":["../../../../src/features/OpenSearchField/abstractions/OpenSearchField.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/exports/api.js\";\nimport type { FieldSortOptions } from \"~/types.js\";\nimport type { SortOrder } from \"~/types.js\";\n\nexport interface ToSearchValueParams {\n value: any;\n path: string;\n basePath: string;\n}\n\nexport interface OpenSearchFieldParams {\n field: string;\n path?: string;\n keyword?: boolean;\n unmappedType?: string;\n sortable?: boolean;\n searchable?: boolean;\n toSearchValue?: (params: ToSearchValueParams) => any;\n}\n\nexport interface IOpenSearchField {\n readonly field: string;\n readonly path: string;\n readonly keyword: boolean;\n readonly unmappedType?: string;\n readonly sortable: boolean;\n readonly searchable: boolean;\n getPath(field: string): string;\n getBasePath(field: string): string;\n getSortOptions(order: SortOrder): FieldSortOptions;\n toSearchValue(params: ToSearchValueParams): any;\n}\n\nexport const OpenSearchField = createAbstraction<IOpenSearchField>(\"OpenSearch/Field\");\n\nexport namespace OpenSearchField {\n export type Interface = IOpenSearchField;\n export type Params = OpenSearchFieldParams;\n export type SearchValueParams = ToSearchValueParams;\n}\n\n/* The wildcard sentinel value used to match any field path. */\nexport const OpenSearchFieldAll = \"*\" as const;\n"],"names":["OpenSearchField","createAbstraction","OpenSearchFieldAll"],"mappings":";AAiCO,MAAMA,kBAAkBC,kBAAoC;AAS5D,MAAMC,qBAAqB"}
@@ -0,0 +1,8 @@
1
+ import type { OpenSearchField } from "./OpenSearchField.js";
2
+ export interface IOpenSearchFieldFactory {
3
+ create(params: OpenSearchField.Params): OpenSearchField.Interface;
4
+ }
5
+ export declare const OpenSearchFieldFactory: import("@webiny/di").Abstraction<IOpenSearchFieldFactory>;
6
+ export declare namespace OpenSearchFieldFactory {
7
+ type Interface = IOpenSearchFieldFactory;
8
+ }
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/exports/api.js";
2
+ const OpenSearchFieldFactory = createAbstraction("OpenSearch/FieldFactory");
3
+ export { OpenSearchFieldFactory };
4
+
5
+ //# sourceMappingURL=OpenSearchFieldFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/OpenSearchField/abstractions/OpenSearchFieldFactory.js","sources":["../../../../src/features/OpenSearchField/abstractions/OpenSearchFieldFactory.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/exports/api.js\";\nimport type { OpenSearchField } from \"./OpenSearchField.js\";\n\nexport interface IOpenSearchFieldFactory {\n create(params: OpenSearchField.Params): OpenSearchField.Interface;\n}\n\nexport const OpenSearchFieldFactory =\n createAbstraction<IOpenSearchFieldFactory>(\"OpenSearch/FieldFactory\");\n\nexport namespace OpenSearchFieldFactory {\n export type Interface = IOpenSearchFieldFactory;\n}\n"],"names":["OpenSearchFieldFactory","createAbstraction"],"mappings":";AAOO,MAAMA,yBACTC,kBAA2C"}
@@ -0,0 +1,4 @@
1
+ export declare const OpenSearchFieldFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -0,0 +1,11 @@
1
+ import { createFeature } from "@webiny/feature/api/index.js";
2
+ import { OpenSearchFieldFactory } from "./OpenSearchFieldFactory.js";
3
+ const OpenSearchFieldFeature = createFeature({
4
+ name: "opensearch.internal.field",
5
+ register (container) {
6
+ container.register(OpenSearchFieldFactory).inSingletonScope();
7
+ }
8
+ });
9
+ export { OpenSearchFieldFeature };
10
+
11
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/OpenSearchField/feature.js","sources":["../../../src/features/OpenSearchField/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api/index.js\";\nimport { OpenSearchFieldFactory } from \"./OpenSearchFieldFactory.js\";\n\nexport const OpenSearchFieldFeature = createFeature({\n name: \"opensearch.internal.field\",\n register(container) {\n container.register(OpenSearchFieldFactory).inSingletonScope();\n }\n});\n"],"names":["OpenSearchFieldFeature","createFeature","container","OpenSearchFieldFactory"],"mappings":";;AAGO,MAAMA,yBAAyBC,cAAc;IAChD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC,wBAAwB,gBAAgB;IAC/D;AACJ"}
@@ -0,0 +1,12 @@
1
+ import { OpenSearchIndex } from "./abstractions/OpenSearchIndex.js";
2
+ import { OpenSearchIndexRegistry as Abstraction } from "./abstractions/OpenSearchIndexRegistry.js";
3
+ declare class OpenSearchIndexRegistryImpl implements Abstraction.Interface {
4
+ private readonly indices;
5
+ constructor(indices: OpenSearchIndex.Interface[]);
6
+ getLastAdded(): OpenSearchIndex.Interface;
7
+ getAll(): OpenSearchIndex.Interface[];
8
+ }
9
+ export declare const OpenSearchIndexRegistry: typeof OpenSearchIndexRegistryImpl & {
10
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions/OpenSearchIndexRegistry.js").IOpenSearchIndexRegistry>;
11
+ };
12
+ export {};
@@ -0,0 +1,30 @@
1
+ import error from "@webiny/error";
2
+ import { OpenSearchIndex } from "./abstractions/OpenSearchIndex.js";
3
+ import { OpenSearchIndexRegistry } from "./abstractions/OpenSearchIndexRegistry.js";
4
+ class OpenSearchIndexRegistryImpl {
5
+ constructor(indices){
6
+ this.indices = indices;
7
+ }
8
+ getLastAdded() {
9
+ const usable = this.indices.filter((index)=>index.canUse());
10
+ if (0 === usable.length) throw new error("Could not find a single OpenSearchIndex.", "OPENSEARCH_INDEX_TEMPLATE_ERROR");
11
+ return usable[usable.length - 1];
12
+ }
13
+ getAll() {
14
+ return this.indices.filter((index)=>index.canUse());
15
+ }
16
+ }
17
+ const OpenSearchIndexRegistry_OpenSearchIndexRegistry = OpenSearchIndexRegistry.createImplementation({
18
+ implementation: OpenSearchIndexRegistryImpl,
19
+ dependencies: [
20
+ [
21
+ OpenSearchIndex,
22
+ {
23
+ multiple: true
24
+ }
25
+ ]
26
+ ]
27
+ });
28
+ export { OpenSearchIndexRegistry_OpenSearchIndexRegistry as OpenSearchIndexRegistry };
29
+
30
+ //# sourceMappingURL=OpenSearchIndexRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/OpenSearchIndex/OpenSearchIndexRegistry.js","sources":["../../../src/features/OpenSearchIndex/OpenSearchIndexRegistry.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { OpenSearchIndex } from \"./abstractions/OpenSearchIndex.js\";\nimport { OpenSearchIndexRegistry as Abstraction } from \"./abstractions/OpenSearchIndexRegistry.js\";\n\nclass OpenSearchIndexRegistryImpl implements Abstraction.Interface {\n private readonly indices: OpenSearchIndex.Interface[];\n\n public constructor(indices: OpenSearchIndex.Interface[]) {\n this.indices = indices;\n }\n\n public getLastAdded(): OpenSearchIndex.Interface {\n const usable = this.indices.filter(index => index.canUse());\n if (usable.length === 0) {\n throw new WebinyError(\n \"Could not find a single OpenSearchIndex.\",\n \"OPENSEARCH_INDEX_TEMPLATE_ERROR\"\n );\n }\n return usable[usable.length - 1];\n }\n\n public getAll(): OpenSearchIndex.Interface[] {\n return this.indices.filter(index => index.canUse());\n }\n}\n\nexport const OpenSearchIndexRegistry = Abstraction.createImplementation({\n implementation: OpenSearchIndexRegistryImpl,\n dependencies: [[OpenSearchIndex, { multiple: true }]]\n});\n"],"names":["OpenSearchIndexRegistryImpl","indices","usable","index","WebinyError","OpenSearchIndexRegistry","Abstraction","OpenSearchIndex"],"mappings":";;;AAIA,MAAMA;IAGF,YAAmBC,OAAoC,CAAE;QACrD,IAAI,CAAC,OAAO,GAAGA;IACnB;IAEO,eAA0C;QAC7C,MAAMC,SAAS,IAAI,CAAC,OAAO,CAAC,MAAM,CAACC,CAAAA,QAASA,MAAM,MAAM;QACxD,IAAID,AAAkB,MAAlBA,OAAO,MAAM,EACb,MAAM,IAAIE,MACN,4CACA;QAGR,OAAOF,MAAM,CAACA,OAAO,MAAM,GAAG,EAAE;IACpC;IAEO,SAAsC;QACzC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAACC,CAAAA,QAASA,MAAM,MAAM;IACpD;AACJ;AAEO,MAAME,kDAA0BC,wBAAAA,oBAAgC,CAAC;IACpE,gBAAgBN;IAChB,cAAc;QAAC;YAACO;YAAiB;gBAAE,UAAU;YAAK;SAAE;KAAC;AACzD"}
@@ -0,0 +1,9 @@
1
+ import type { OpenSearchIndexRequestBody } from "../../../types.js";
2
+ export interface IOpenSearchIndex {
3
+ readonly body: OpenSearchIndexRequestBody;
4
+ canUse(): boolean;
5
+ }
6
+ export declare const OpenSearchIndex: import("@webiny/di").Abstraction<IOpenSearchIndex>;
7
+ export declare namespace OpenSearchIndex {
8
+ type Interface = IOpenSearchIndex;
9
+ }
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/exports/api.js";
2
+ const OpenSearchIndex = createAbstraction("OpenSearch/Index");
3
+ export { OpenSearchIndex };
4
+
5
+ //# sourceMappingURL=OpenSearchIndex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/OpenSearchIndex/abstractions/OpenSearchIndex.js","sources":["../../../../src/features/OpenSearchIndex/abstractions/OpenSearchIndex.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/exports/api.js\";\nimport type { OpenSearchIndexRequestBody } from \"~/types.js\";\n\nexport interface IOpenSearchIndex {\n readonly body: OpenSearchIndexRequestBody;\n canUse(): boolean;\n}\n\nexport const OpenSearchIndex = createAbstraction<IOpenSearchIndex>(\"OpenSearch/Index\");\n\nexport namespace OpenSearchIndex {\n export type Interface = IOpenSearchIndex;\n}\n"],"names":["OpenSearchIndex","createAbstraction"],"mappings":";AAQO,MAAMA,kBAAkBC,kBAAoC"}
@@ -0,0 +1,9 @@
1
+ import type { OpenSearchIndex } from "./OpenSearchIndex.js";
2
+ export interface IOpenSearchIndexRegistry {
3
+ getLastAdded(): OpenSearchIndex.Interface;
4
+ getAll(): OpenSearchIndex.Interface[];
5
+ }
6
+ export declare const OpenSearchIndexRegistry: import("@webiny/di").Abstraction<IOpenSearchIndexRegistry>;
7
+ export declare namespace OpenSearchIndexRegistry {
8
+ type Interface = IOpenSearchIndexRegistry;
9
+ }
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/exports/api.js";
2
+ const OpenSearchIndexRegistry = createAbstraction("OpenSearch/IndexRegistry");
3
+ export { OpenSearchIndexRegistry };
4
+
5
+ //# sourceMappingURL=OpenSearchIndexRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/OpenSearchIndex/abstractions/OpenSearchIndexRegistry.js","sources":["../../../../src/features/OpenSearchIndex/abstractions/OpenSearchIndexRegistry.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/exports/api.js\";\nimport type { OpenSearchIndex } from \"./OpenSearchIndex.js\";\n\nexport interface IOpenSearchIndexRegistry {\n getLastAdded(): OpenSearchIndex.Interface;\n getAll(): OpenSearchIndex.Interface[];\n}\n\nexport const OpenSearchIndexRegistry = createAbstraction<IOpenSearchIndexRegistry>(\n \"OpenSearch/IndexRegistry\"\n);\n\nexport namespace OpenSearchIndexRegistry {\n export type Interface = IOpenSearchIndexRegistry;\n}\n"],"names":["OpenSearchIndexRegistry","createAbstraction"],"mappings":";AAQO,MAAMA,0BAA0BC,kBACnC"}
@@ -0,0 +1,4 @@
1
+ export declare const OpenSearchIndexFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -0,0 +1,11 @@
1
+ import { createFeature } from "@webiny/feature/api/index.js";
2
+ import { OpenSearchIndexRegistry } from "./OpenSearchIndexRegistry.js";
3
+ const OpenSearchIndexFeature = createFeature({
4
+ name: "opensearch.internal.index",
5
+ register (container) {
6
+ container.register(OpenSearchIndexRegistry).inSingletonScope();
7
+ }
8
+ });
9
+ export { OpenSearchIndexFeature };
10
+
11
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/OpenSearchIndex/feature.js","sources":["../../../src/features/OpenSearchIndex/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api/index.js\";\nimport { OpenSearchIndexRegistry } from \"./OpenSearchIndexRegistry.js\";\n\nexport const OpenSearchIndexFeature = createFeature({\n name: \"opensearch.internal.index\",\n register(container) {\n container.register(OpenSearchIndexRegistry).inSingletonScope();\n }\n});\n"],"names":["OpenSearchIndexFeature","createFeature","container","OpenSearchIndexRegistry"],"mappings":";;AAGO,MAAMA,yBAAyBC,cAAc;IAChD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC,yBAAyB,gBAAgB;IAChE;AACJ"}
@@ -0,0 +1,12 @@
1
+ import { OpenSearchQueryBuilderOperator } from "./abstractions/OpenSearchQueryBuilderOperator.js";
2
+ import { OpenSearchQueryBuilderOperatorRegistry as Abstraction } from "./abstractions/OpenSearchQueryBuilderOperatorRegistry.js";
3
+ declare class OpenSearchQueryBuilderOperatorRegistryImpl implements Abstraction.Interface {
4
+ private readonly operators;
5
+ constructor(operators: OpenSearchQueryBuilderOperator.Interface[]);
6
+ get(operator: string): OpenSearchQueryBuilderOperator.Interface | undefined;
7
+ getAll(): OpenSearchQueryBuilderOperator.Interface[];
8
+ }
9
+ export declare const OpenSearchQueryBuilderOperatorRegistry: typeof OpenSearchQueryBuilderOperatorRegistryImpl & {
10
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions/OpenSearchQueryBuilderOperatorRegistry.js").IOpenSearchQueryBuilderOperatorRegistry>;
11
+ };
12
+ export {};
@@ -0,0 +1,28 @@
1
+ import { OpenSearchQueryBuilderOperator } from "./abstractions/OpenSearchQueryBuilderOperator.js";
2
+ import { OpenSearchQueryBuilderOperatorRegistry } from "./abstractions/OpenSearchQueryBuilderOperatorRegistry.js";
3
+ class OpenSearchQueryBuilderOperatorRegistryImpl {
4
+ constructor(operators){
5
+ this.operators = new Map();
6
+ for (const operator of operators)this.operators.set(operator.getOperator(), operator);
7
+ }
8
+ get(operator) {
9
+ return this.operators.get(operator);
10
+ }
11
+ getAll() {
12
+ return Array.from(this.operators.values());
13
+ }
14
+ }
15
+ const OpenSearchQueryBuilderOperatorRegistry_OpenSearchQueryBuilderOperatorRegistry = OpenSearchQueryBuilderOperatorRegistry.createImplementation({
16
+ implementation: OpenSearchQueryBuilderOperatorRegistryImpl,
17
+ dependencies: [
18
+ [
19
+ OpenSearchQueryBuilderOperator,
20
+ {
21
+ multiple: true
22
+ }
23
+ ]
24
+ ]
25
+ });
26
+ export { OpenSearchQueryBuilderOperatorRegistry_OpenSearchQueryBuilderOperatorRegistry as OpenSearchQueryBuilderOperatorRegistry };
27
+
28
+ //# sourceMappingURL=OpenSearchQueryBuilderOperatorRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/OpenSearchQueryBuilderOperator/OpenSearchQueryBuilderOperatorRegistry.js","sources":["../../../src/features/OpenSearchQueryBuilderOperator/OpenSearchQueryBuilderOperatorRegistry.ts"],"sourcesContent":["import { OpenSearchQueryBuilderOperator } from \"./abstractions/OpenSearchQueryBuilderOperator.js\";\nimport { OpenSearchQueryBuilderOperatorRegistry as Abstraction } from \"./abstractions/OpenSearchQueryBuilderOperatorRegistry.js\";\n\nclass OpenSearchQueryBuilderOperatorRegistryImpl implements Abstraction.Interface {\n private readonly operators: Map<string, OpenSearchQueryBuilderOperator.Interface>;\n\n public constructor(operators: OpenSearchQueryBuilderOperator.Interface[]) {\n this.operators = new Map();\n for (const operator of operators) {\n this.operators.set(operator.getOperator(), operator);\n }\n }\n\n public get(operator: string): OpenSearchQueryBuilderOperator.Interface | undefined {\n return this.operators.get(operator);\n }\n\n public getAll(): OpenSearchQueryBuilderOperator.Interface[] {\n return Array.from(this.operators.values());\n }\n}\n\nexport const OpenSearchQueryBuilderOperatorRegistry = Abstraction.createImplementation({\n implementation: OpenSearchQueryBuilderOperatorRegistryImpl,\n dependencies: [[OpenSearchQueryBuilderOperator, { multiple: true }]]\n});\n"],"names":["OpenSearchQueryBuilderOperatorRegistryImpl","operators","Map","operator","Array","OpenSearchQueryBuilderOperatorRegistry","Abstraction","OpenSearchQueryBuilderOperator"],"mappings":";;AAGA,MAAMA;IAGF,YAAmBC,SAAqD,CAAE;QACtE,IAAI,CAAC,SAAS,GAAG,IAAIC;QACrB,KAAK,MAAMC,YAAYF,UACnB,IAAI,CAAC,SAAS,CAAC,GAAG,CAACE,SAAS,WAAW,IAAIA;IAEnD;IAEO,IAAIA,QAAgB,EAAwD;QAC/E,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAACA;IAC9B;IAEO,SAAqD;QACxD,OAAOC,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM;IAC3C;AACJ;AAEO,MAAMC,gFAAyCC,uCAAAA,oBAAgC,CAAC;IACnF,gBAAgBN;IAChB,cAAc;QAAC;YAACO;YAAgC;gBAAE,UAAU;YAAK;SAAE;KAAC;AACxE"}
@@ -0,0 +1,11 @@
1
+ import type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from "../../../types.js";
2
+ export interface IOpenSearchQueryBuilderOperator {
3
+ getOperator(): string;
4
+ apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void;
5
+ }
6
+ export declare const OpenSearchQueryBuilderOperator: import("@webiny/di").Abstraction<IOpenSearchQueryBuilderOperator>;
7
+ export declare namespace OpenSearchQueryBuilderOperator {
8
+ type Interface = IOpenSearchQueryBuilderOperator;
9
+ type Query = OpenSearchBoolQueryConfig;
10
+ type Params = OpenSearchQueryBuilderArgsPlugin;
11
+ }
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/exports/api.js";
2
+ const OpenSearchQueryBuilderOperator = createAbstraction("OpenSearch/QueryBuilder/Operator");
3
+ export { OpenSearchQueryBuilderOperator };
4
+
5
+ //# sourceMappingURL=OpenSearchQueryBuilderOperator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/OpenSearchQueryBuilderOperator/abstractions/OpenSearchQueryBuilderOperator.js","sources":["../../../../src/features/OpenSearchQueryBuilderOperator/abstractions/OpenSearchQueryBuilderOperator.ts"],"sourcesContent":["import type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from \"~/types.js\";\nimport { createAbstraction } from \"@webiny/feature/exports/api.js\";\n\nexport interface IOpenSearchQueryBuilderOperator {\n getOperator(): string;\n apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void;\n}\n\nexport const OpenSearchQueryBuilderOperator = createAbstraction<IOpenSearchQueryBuilderOperator>(\n \"OpenSearch/QueryBuilder/Operator\"\n);\n\nexport namespace OpenSearchQueryBuilderOperator {\n export type Interface = IOpenSearchQueryBuilderOperator;\n export type Query = OpenSearchBoolQueryConfig;\n export type Params = OpenSearchQueryBuilderArgsPlugin;\n}\n"],"names":["OpenSearchQueryBuilderOperator","createAbstraction"],"mappings":";AAQO,MAAMA,iCAAiCC,kBAC1C"}
@@ -0,0 +1,10 @@
1
+ import type { OpenSearchQueryBuilderOperator } from "./OpenSearchQueryBuilderOperator.js";
2
+ export interface IOpenSearchQueryBuilderOperatorRegistry {
3
+ get(operator: string): OpenSearchQueryBuilderOperator.Interface | undefined;
4
+ getAll(): OpenSearchQueryBuilderOperator.Interface[];
5
+ }
6
+ export declare const OpenSearchQueryBuilderOperatorRegistry: import("@webiny/di").Abstraction<IOpenSearchQueryBuilderOperatorRegistry>;
7
+ export declare namespace OpenSearchQueryBuilderOperatorRegistry {
8
+ type Interface = IOpenSearchQueryBuilderOperatorRegistry;
9
+ type Operator = OpenSearchQueryBuilderOperator.Interface;
10
+ }
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/exports/api.js";
2
+ const OpenSearchQueryBuilderOperatorRegistry = createAbstraction("OpenSearch/QueryBuilder/OperatorRegistry");
3
+ export { OpenSearchQueryBuilderOperatorRegistry };
4
+
5
+ //# sourceMappingURL=OpenSearchQueryBuilderOperatorRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/OpenSearchQueryBuilderOperator/abstractions/OpenSearchQueryBuilderOperatorRegistry.js","sources":["../../../../src/features/OpenSearchQueryBuilderOperator/abstractions/OpenSearchQueryBuilderOperatorRegistry.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/exports/api.js\";\nimport type { OpenSearchQueryBuilderOperator } from \"./OpenSearchQueryBuilderOperator.js\";\n\nexport interface IOpenSearchQueryBuilderOperatorRegistry {\n get(operator: string): OpenSearchQueryBuilderOperator.Interface | undefined;\n getAll(): OpenSearchQueryBuilderOperator.Interface[];\n}\n\nexport const OpenSearchQueryBuilderOperatorRegistry =\n createAbstraction<IOpenSearchQueryBuilderOperatorRegistry>(\n \"OpenSearch/QueryBuilder/OperatorRegistry\"\n );\n\nexport namespace OpenSearchQueryBuilderOperatorRegistry {\n export type Interface = IOpenSearchQueryBuilderOperatorRegistry;\n export type Operator = OpenSearchQueryBuilderOperator.Interface;\n}\n"],"names":["OpenSearchQueryBuilderOperatorRegistry","createAbstraction"],"mappings":";AAQO,MAAMA,yCACTC,kBACI"}
@@ -0,0 +1,4 @@
1
+ export declare const OpenSearchQueryBuilderOperatorFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };