@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
@@ -0,0 +1,81 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ import type { FieldSortOptions, SortOrder } from "../../types.js";
3
+ export type UnmappedTypes = "date" | "long" | string;
4
+ export interface ToSearchValueParams {
5
+ /**
6
+ * The value to transform.
7
+ */
8
+ value: any;
9
+ /**
10
+ * When using toSearchValue() in our code we send a field.getPath() value here.
11
+ */
12
+ path: string;
13
+ /**
14
+ * When using toSearchValue() in our code we send a field.getBasePath() value here.
15
+ */
16
+ basePath: string;
17
+ }
18
+ export interface OpenSearchFieldPluginParams {
19
+ /**
20
+ * Which field is this plugin for.
21
+ */
22
+ field: string;
23
+ /**
24
+ * Some specific path of a field?
25
+ * Example: createdBy is createdBy.id
26
+ */
27
+ path?: string;
28
+ /**
29
+ * Add a .keyword at the end of the field path?
30
+ */
31
+ keyword?: boolean;
32
+ /**
33
+ * Is the field of a specific type, but possibly not mapped?
34
+ * Happens when inserting a date in string format.
35
+ * You need to cast it as date when running the search/sort to work correctly.
36
+ */
37
+ unmappedType?: UnmappedTypes;
38
+ /**
39
+ * Is the field sortable?
40
+ */
41
+ sortable?: boolean;
42
+ /**
43
+ * Is the field searchable?
44
+ */
45
+ searchable?: boolean;
46
+ /**
47
+ * Used to transform the input value for the search.
48
+ */
49
+ toSearchValue?: (params: ToSearchValueParams) => any;
50
+ }
51
+ export declare class OpenSearchFieldPlugin extends Plugin {
52
+ static readonly type: string;
53
+ static readonly ALL: string;
54
+ readonly field: string;
55
+ readonly path: string;
56
+ readonly keyword: boolean;
57
+ readonly unmappedType?: string;
58
+ readonly sortable: boolean;
59
+ readonly searchable: boolean;
60
+ constructor(params: OpenSearchFieldPluginParams);
61
+ /**
62
+ * The default sort options. Extend in your own plugin if you want to add more options.
63
+ */
64
+ getSortOptions(order: SortOrder): FieldSortOptions;
65
+ /**
66
+ * The default path generator. Extend in your own plugin if you want to add more options.
67
+ * Field parameter is here because there is a possibility that this is the ALL field plugin, so we need to know which field are we working on.
68
+ */
69
+ getPath(field: string): string;
70
+ /**
71
+ * @see getPath
72
+ *
73
+ * This is the default base path generator. Basically it replaces ALL with given field name.
74
+ */
75
+ getBasePath(field: string): string;
76
+ /**
77
+ * The default transformer. Just returns the value by default.
78
+ * Override to implement what ever is required.
79
+ */
80
+ toSearchValue(params: ToSearchValueParams): any;
81
+ }
@@ -0,0 +1,69 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ const keywordLessUnmappedType = ["date", "long"];
3
+ const unmappedTypeHasKeyword = type => {
4
+ if (!type) {
5
+ return true;
6
+ } else if (keywordLessUnmappedType.includes(type)) {
7
+ return false;
8
+ }
9
+ return true;
10
+ };
11
+ export class OpenSearchFieldPlugin extends Plugin {
12
+ static type = "opensearch.fieldDefinition";
13
+ static ALL = "*";
14
+ constructor(params) {
15
+ super();
16
+ this.field = params.field;
17
+ this.path = params.path || params.field;
18
+ this.keyword = params.keyword === undefined ? true : params.keyword;
19
+ this.unmappedType = params.unmappedType;
20
+ if (unmappedTypeHasKeyword(params.unmappedType) === false) {
21
+ this.keyword = false;
22
+ }
23
+ this.sortable = params.sortable === undefined ? true : params.sortable;
24
+ this.searchable = params.searchable === undefined ? true : params.searchable;
25
+ }
26
+ /**
27
+ * The default sort options. Extend in your own plugin if you want to add more options.
28
+ */
29
+ getSortOptions(order) {
30
+ const options = {
31
+ order
32
+ };
33
+ if (!this.unmappedType) {
34
+ return options;
35
+ }
36
+ return {
37
+ ...options,
38
+ // TODO: Cast to the proper MappingFieldType once deep opensearch _types/ imports are resolvable under bundler resolution.
39
+ unmapped_type: this.unmappedType
40
+ };
41
+ }
42
+ /**
43
+ * The default path generator. Extend in your own plugin if you want to add more options.
44
+ * Field parameter is here because there is a possibility that this is the ALL field plugin, so we need to know which field are we working on.
45
+ */
46
+ getPath(field) {
47
+ return `${this.getBasePath(field)}${this.keyword ? ".keyword" : ""}`;
48
+ }
49
+ /**
50
+ * @see getPath
51
+ *
52
+ * This is the default base path generator. Basically it replaces ALL with given field name.
53
+ */
54
+ getBasePath(field) {
55
+ if (this.path === OpenSearchFieldPlugin.ALL) {
56
+ return field;
57
+ }
58
+ return this.path;
59
+ }
60
+ /**
61
+ * The default transformer. Just returns the value by default.
62
+ * Override to implement what ever is required.
63
+ */
64
+ toSearchValue(params) {
65
+ return params.value;
66
+ }
67
+ }
68
+
69
+ //# sourceMappingURL=OpenSearchFieldPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Plugin","keywordLessUnmappedType","unmappedTypeHasKeyword","type","includes","OpenSearchFieldPlugin","ALL","constructor","params","field","path","keyword","undefined","unmappedType","sortable","searchable","getSortOptions","order","options","unmapped_type","getPath","getBasePath","toSearchValue","value"],"sources":["OpenSearchFieldPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { FieldSortOptions, SortOrder } from \"~/types.js\";\n\nexport type UnmappedTypes = \"date\" | \"long\" | string;\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 interface ToSearchValueParams {\n /**\n * The value to transform.\n */\n value: any;\n /**\n * When using toSearchValue() in our code we send a field.getPath() value here.\n */\n path: string;\n /**\n * When using toSearchValue() in our code we send a field.getBasePath() value here.\n */\n basePath: string;\n}\nexport interface OpenSearchFieldPluginParams {\n /**\n * Which field is this plugin for.\n */\n field: string;\n /**\n * Some specific path of a field?\n * Example: createdBy is createdBy.id\n */\n path?: string;\n /**\n * Add a .keyword at the end of the field path?\n */\n keyword?: boolean;\n /**\n * Is the field of a specific type, but possibly not mapped?\n * Happens when inserting a date in string format.\n * You need to cast it as date when running the search/sort to work correctly.\n */\n unmappedType?: UnmappedTypes;\n /**\n * Is the field sortable?\n */\n sortable?: boolean;\n /**\n * Is the field searchable?\n */\n searchable?: boolean;\n /**\n * Used to transform the input value for the search.\n */\n toSearchValue?: (params: ToSearchValueParams) => any;\n}\n\nexport class OpenSearchFieldPlugin extends Plugin {\n public static override readonly type: string = \"opensearch.fieldDefinition\";\n public static readonly ALL: string = \"*\";\n\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\n constructor(params: OpenSearchFieldPluginParams) {\n super();\n this.field = params.field;\n this.path = params.path || params.field;\n this.keyword = params.keyword === undefined ? true : params.keyword;\n this.unmappedType = params.unmappedType;\n if (unmappedTypeHasKeyword(params.unmappedType) === false) {\n this.keyword = false;\n }\n this.sortable = params.sortable === undefined ? true : params.sortable;\n this.searchable = params.searchable === undefined ? true : params.searchable;\n }\n /**\n * The default sort options. Extend in your own plugin if you want to add more options.\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 // TODO: Cast to the proper MappingFieldType once deep opensearch _types/ imports are resolvable under bundler resolution.\n unmapped_type: this.unmappedType as any\n };\n }\n /**\n * The default path generator. Extend in your own plugin if you want to add more options.\n * Field parameter is here because there is a possibility that this is the ALL field plugin, so we need to know which field are we working on.\n */\n public getPath(field: string): string {\n return `${this.getBasePath(field)}${this.keyword ? \".keyword\" : \"\"}`;\n }\n /**\n * @see getPath\n *\n * This is the default base path generator. Basically it replaces ALL with given field name.\n */\n public getBasePath(field: string): string {\n if (this.path === OpenSearchFieldPlugin.ALL) {\n return field;\n }\n return this.path;\n }\n /**\n * The default transformer. Just returns the value by default.\n * Override to implement what ever is required.\n */\n public toSearchValue(params: ToSearchValueParams): any {\n return params.value;\n }\n}\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,iBAAiB;AAKxC,MAAMC,uBAAuB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;AAEhD,MAAMC,sBAAsB,GAAIC,IAAa,IAAc;EACvD,IAAI,CAACA,IAAI,EAAE;IACP,OAAO,IAAI;EACf,CAAC,MAAM,IAAIF,uBAAuB,CAACG,QAAQ,CAACD,IAAI,CAAC,EAAE;IAC/C,OAAO,KAAK;EAChB;EACA,OAAO,IAAI;AACf,CAAC;AAkDD,OAAO,MAAME,qBAAqB,SAASL,MAAM,CAAC;EAC9C,OAAgCG,IAAI,GAAW,4BAA4B;EAC3E,OAAuBG,GAAG,GAAW,GAAG;EASxCC,WAAWA,CAACC,MAAmC,EAAE;IAC7C,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,KAAK,GAAGD,MAAM,CAACC,KAAK;IACzB,IAAI,CAACC,IAAI,GAAGF,MAAM,CAACE,IAAI,IAAIF,MAAM,CAACC,KAAK;IACvC,IAAI,CAACE,OAAO,GAAGH,MAAM,CAACG,OAAO,KAAKC,SAAS,GAAG,IAAI,GAAGJ,MAAM,CAACG,OAAO;IACnE,IAAI,CAACE,YAAY,GAAGL,MAAM,CAACK,YAAY;IACvC,IAAIX,sBAAsB,CAACM,MAAM,CAACK,YAAY,CAAC,KAAK,KAAK,EAAE;MACvD,IAAI,CAACF,OAAO,GAAG,KAAK;IACxB;IACA,IAAI,CAACG,QAAQ,GAAGN,MAAM,CAACM,QAAQ,KAAKF,SAAS,GAAG,IAAI,GAAGJ,MAAM,CAACM,QAAQ;IACtE,IAAI,CAACC,UAAU,GAAGP,MAAM,CAACO,UAAU,KAAKH,SAAS,GAAG,IAAI,GAAGJ,MAAM,CAACO,UAAU;EAChF;EACA;AACJ;AACA;EACWC,cAAcA,CAACC,KAAgB,EAAoB;IACtD,MAAMC,OAAO,GAAG;MACZD;IACJ,CAAC;IACD,IAAI,CAAC,IAAI,CAACJ,YAAY,EAAE;MACpB,OAAOK,OAAO;IAClB;IACA,OAAO;MACH,GAAGA,OAAO;MACV;MACAC,aAAa,EAAE,IAAI,CAACN;IACxB,CAAC;EACL;EACA;AACJ;AACA;AACA;EACWO,OAAOA,CAACX,KAAa,EAAU;IAClC,OAAO,GAAG,IAAI,CAACY,WAAW,CAACZ,KAAK,CAAC,GAAG,IAAI,CAACE,OAAO,GAAG,UAAU,GAAG,EAAE,EAAE;EACxE;EACA;AACJ;AACA;AACA;AACA;EACWU,WAAWA,CAACZ,KAAa,EAAU;IACtC,IAAI,IAAI,CAACC,IAAI,KAAKL,qBAAqB,CAACC,GAAG,EAAE;MACzC,OAAOG,KAAK;IAChB;IACA,OAAO,IAAI,CAACC,IAAI;EACpB;EACA;AACJ;AACA;AACA;EACWY,aAAaA,CAACd,MAA2B,EAAO;IACnD,OAAOA,MAAM,CAACe,KAAK;EACvB;AACJ","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ import type { OpenSearchIndexRequestBody } from "../../types.js";
3
+ export interface OpenSearchIndexPluginParams {
4
+ body: OpenSearchIndexRequestBody;
5
+ }
6
+ export declare abstract class OpenSearchIndexPlugin extends Plugin {
7
+ readonly body: OpenSearchIndexRequestBody;
8
+ constructor(params: OpenSearchIndexPluginParams);
9
+ canUse(): boolean;
10
+ }
@@ -0,0 +1,17 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ export class OpenSearchIndexPlugin extends Plugin {
3
+ constructor(params) {
4
+ super();
5
+ const {
6
+ body
7
+ } = params;
8
+ this.body = {
9
+ ...body
10
+ };
11
+ }
12
+ canUse() {
13
+ return true;
14
+ }
15
+ }
16
+
17
+ //# sourceMappingURL=OpenSearchIndexPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Plugin","OpenSearchIndexPlugin","constructor","params","body","canUse"],"sources":["OpenSearchIndexPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { OpenSearchIndexRequestBody } from \"~/types.js\";\n\nexport interface OpenSearchIndexPluginParams {\n body: OpenSearchIndexRequestBody;\n}\n\nexport abstract class OpenSearchIndexPlugin extends Plugin {\n public readonly body: OpenSearchIndexRequestBody;\n\n public constructor(params: OpenSearchIndexPluginParams) {\n super();\n const { body } = params;\n this.body = {\n ...body\n };\n }\n\n public canUse(): boolean {\n return true;\n }\n}\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,iBAAiB;AAOxC,OAAO,MAAeC,qBAAqB,SAASD,MAAM,CAAC;EAGhDE,WAAWA,CAACC,MAAmC,EAAE;IACpD,KAAK,CAAC,CAAC;IACP,MAAM;MAAEC;IAAK,CAAC,GAAGD,MAAM;IACvB,IAAI,CAACC,IAAI,GAAG;MACR,GAAGA;IACP,CAAC;EACL;EAEOC,MAAMA,CAAA,EAAY;IACrB,OAAO,IAAI;EACf;AACJ","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ import type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from "../../types.js";
3
+ /**
4
+ * Built-in operators name ends with .default because user can override the operator, just write a name without the .default keyword.
5
+ */
6
+ export declare abstract class OpenSearchQueryBuilderOperatorPlugin extends Plugin {
7
+ static readonly type: string;
8
+ abstract getOperator(): string;
9
+ abstract apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void;
10
+ }
@@ -0,0 +1,9 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ /**
3
+ * Built-in operators name ends with .default because user can override the operator, just write a name without the .default keyword.
4
+ */
5
+ export class OpenSearchQueryBuilderOperatorPlugin extends Plugin {
6
+ static type = "opensearch.queryBuilder.operator";
7
+ }
8
+
9
+ //# sourceMappingURL=OpenSearchQueryBuilderOperatorPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Plugin","OpenSearchQueryBuilderOperatorPlugin","type"],"sources":["OpenSearchQueryBuilderOperatorPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from \"~/types.js\";\n\n/**\n * Built-in operators name ends with .default because user can override the operator, just write a name without the .default keyword.\n */\nexport abstract class OpenSearchQueryBuilderOperatorPlugin extends Plugin {\n public static override readonly type: string = \"opensearch.queryBuilder.operator\";\n\n public abstract getOperator(): string;\n\n public abstract apply(\n query: OpenSearchBoolQueryConfig,\n params: OpenSearchQueryBuilderArgsPlugin\n ): void;\n}\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,iBAAiB;AAGxC;AACA;AACA;AACA,OAAO,MAAeC,oCAAoC,SAASD,MAAM,CAAC;EACtE,OAAgCE,IAAI,GAAW,kCAAkC;AAQrF","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ import type { OpenSearchBoolQueryConfig } from "../../types.js";
3
+ export interface ModifyQueryParams {
4
+ query: OpenSearchBoolQueryConfig;
5
+ where: Record<string, any>;
6
+ }
7
+ export interface ModifyQueryCallable<T extends ModifyQueryParams> {
8
+ (params: T): void;
9
+ }
10
+ export declare abstract class OpenSearchQueryModifierPlugin<T extends ModifyQueryParams = ModifyQueryParams> extends Plugin {
11
+ private readonly callable?;
12
+ constructor(callable?: ModifyQueryCallable<T>);
13
+ modifyQuery(params: T): void;
14
+ }
@@ -0,0 +1,18 @@
1
+ import WebinyError from "@webiny/error";
2
+ import { Plugin } from "@webiny/plugins";
3
+ export class OpenSearchQueryModifierPlugin extends Plugin {
4
+ constructor(callable) {
5
+ super();
6
+ this.callable = callable;
7
+ }
8
+ modifyQuery(params) {
9
+ if (typeof this.callable !== "function") {
10
+ throw new WebinyError(`Missing modification for the query.`, "QUERY_MODIFICATION_MISSING", {
11
+ params
12
+ });
13
+ }
14
+ this.callable(params);
15
+ }
16
+ }
17
+
18
+ //# sourceMappingURL=OpenSearchQueryModifierPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["WebinyError","Plugin","OpenSearchQueryModifierPlugin","constructor","callable","modifyQuery","params"],"sources":["OpenSearchQueryModifierPlugin.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { Plugin } from \"@webiny/plugins\";\nimport type { OpenSearchBoolQueryConfig } from \"~/types.js\";\n\nexport interface ModifyQueryParams {\n query: OpenSearchBoolQueryConfig;\n where: Record<string, any>;\n}\n\nexport interface ModifyQueryCallable<T extends ModifyQueryParams> {\n (params: T): void;\n}\n\nexport abstract class OpenSearchQueryModifierPlugin<\n T extends ModifyQueryParams = ModifyQueryParams\n> extends Plugin {\n private readonly callable?: ModifyQueryCallable<T>;\n\n public constructor(callable?: ModifyQueryCallable<T>) {\n super();\n this.callable = callable;\n }\n\n public modifyQuery(params: T): void {\n if (typeof this.callable !== \"function\") {\n throw new WebinyError(\n `Missing modification for the query.`,\n \"QUERY_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;AAYxC,OAAO,MAAeC,6BAA6B,SAEzCD,MAAM,CAAC;EAGNE,WAAWA,CAACC,QAAiC,EAAE;IAClD,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,QAAQ,GAAGA,QAAQ;EAC5B;EAEOC,WAAWA,CAACC,MAAS,EAAQ;IAChC,IAAI,OAAO,IAAI,CAACF,QAAQ,KAAK,UAAU,EAAE;MACrC,MAAM,IAAIJ,WAAW,CACjB,qCAAqC,EACrC,4BAA4B,EAC5B;QACIM;MACJ,CACJ,CAAC;IACL;IACA,IAAI,CAACF,QAAQ,CAACE,MAAM,CAAC;EACzB;AACJ","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ import type { Sort } from "../../types.js";
3
+ export interface ModifySortParams {
4
+ sort: Sort;
5
+ }
6
+ export interface ModifySortCallable<T extends ModifySortParams> {
7
+ (params: T): void;
8
+ }
9
+ export declare abstract class OpenSearchSortModifierPlugin<T extends ModifySortParams = ModifySortParams> extends Plugin {
10
+ private readonly callable?;
11
+ constructor(callable?: ModifySortCallable<T>);
12
+ modifySort(params: T): void;
13
+ }
@@ -0,0 +1,18 @@
1
+ import WebinyError from "@webiny/error";
2
+ import { Plugin } from "@webiny/plugins";
3
+ export class OpenSearchSortModifierPlugin extends Plugin {
4
+ constructor(callable) {
5
+ super();
6
+ this.callable = callable;
7
+ }
8
+ modifySort(params) {
9
+ if (typeof this.callable !== "function") {
10
+ throw new WebinyError(`Missing modification for the sort.`, "SORT_MODIFICATION_MISSING", {
11
+ params
12
+ });
13
+ }
14
+ this.callable(params);
15
+ }
16
+ }
17
+
18
+ //# sourceMappingURL=OpenSearchSortModifierPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["WebinyError","Plugin","OpenSearchSortModifierPlugin","constructor","callable","modifySort","params"],"sources":["OpenSearchSortModifierPlugin.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { Plugin } from \"@webiny/plugins\";\nimport type { Sort } from \"~/types.js\";\n\nexport interface ModifySortParams {\n sort: Sort;\n}\n\nexport interface ModifySortCallable<T extends ModifySortParams> {\n (params: T): void;\n}\n\nexport abstract class OpenSearchSortModifierPlugin<\n T extends ModifySortParams = ModifySortParams\n> extends Plugin {\n private readonly callable?: ModifySortCallable<T>;\n\n public constructor(callable?: ModifySortCallable<T>) {\n super();\n this.callable = callable;\n }\n\n public modifySort(params: T): void {\n if (typeof this.callable !== \"function\") {\n throw new WebinyError(\n `Missing modification for the sort.`,\n \"SORT_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":[]}
@@ -0,0 +1,6 @@
1
+ export * from "./OpenSearchBodyModifierPlugin.js";
2
+ export * from "./OpenSearchFieldPlugin.js";
3
+ export * from "./OpenSearchIndexPlugin.js";
4
+ export * from "./OpenSearchQueryBuilderOperatorPlugin.js";
5
+ export * from "./OpenSearchQueryModifierPlugin.js";
6
+ export * from "./OpenSearchSortModifierPlugin.js";
@@ -0,0 +1,8 @@
1
+ export * from "./OpenSearchBodyModifierPlugin.js";
2
+ export * from "./OpenSearchFieldPlugin.js";
3
+ export * from "./OpenSearchIndexPlugin.js";
4
+ export * from "./OpenSearchQueryBuilderOperatorPlugin.js";
5
+ export * from "./OpenSearchQueryModifierPlugin.js";
6
+ export * from "./OpenSearchSortModifierPlugin.js";
7
+
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./OpenSearchBodyModifierPlugin.js\";\nexport * from \"./OpenSearchFieldPlugin.js\";\nexport * from \"./OpenSearchIndexPlugin.js\";\nexport * from \"./OpenSearchQueryBuilderOperatorPlugin.js\";\nexport * from \"./OpenSearchQueryModifierPlugin.js\";\nexport * from \"./OpenSearchSortModifierPlugin.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export * from "./definition/index.js";
2
+ export * from "./operator/index.js";
@@ -0,0 +1,4 @@
1
+ export * from "./definition/index.js";
2
+ export * from "./operator/index.js";
3
+
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./definition/index.js\";\nexport * from \"./operator/index.js\";\n"],"mappings":"AAAA;AACA","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ import { OpenSearchQueryBuilderOperatorPlugin } from "../../plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js";
2
+ import type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from "../../types.js";
3
+ export declare class OpenSearchQueryBuilderOperatorAndInPlugin extends OpenSearchQueryBuilderOperatorPlugin {
4
+ name: string;
5
+ getOperator(): string;
6
+ apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void;
7
+ }
@@ -0,0 +1,35 @@
1
+ import { OpenSearchQueryBuilderOperatorPlugin } from "../definition/OpenSearchQueryBuilderOperatorPlugin.js";
2
+ export class OpenSearchQueryBuilderOperatorAndInPlugin extends OpenSearchQueryBuilderOperatorPlugin {
3
+ name = "opensearch.queryBuilder.operator.andIn.default";
4
+ getOperator() {
5
+ return "and_in";
6
+ }
7
+ apply(query, params) {
8
+ const {
9
+ value: values,
10
+ path,
11
+ basePath
12
+ } = params;
13
+ const isArray = Array.isArray(values);
14
+ if (isArray === false || values.length === 0) {
15
+ throw new Error(`You cannot filter field "${path}" with "in" operator and not send an array of values.`);
16
+ }
17
+ let useBasePath = false;
18
+ // Only use ".keyword" if all of the provided values are strings.
19
+ for (const value of values) {
20
+ if (typeof value !== "string") {
21
+ useBasePath = true;
22
+ break;
23
+ }
24
+ }
25
+ for (const value of values) {
26
+ query.filter.push({
27
+ term: {
28
+ [useBasePath ? basePath : path]: value
29
+ }
30
+ });
31
+ }
32
+ }
33
+ }
34
+
35
+ //# sourceMappingURL=andIn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["OpenSearchQueryBuilderOperatorPlugin","OpenSearchQueryBuilderOperatorAndInPlugin","name","getOperator","apply","query","params","value","values","path","basePath","isArray","Array","length","Error","useBasePath","filter","push","term"],"sources":["andIn.ts"],"sourcesContent":["import { OpenSearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js\";\nimport type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from \"~/types.js\";\n\nexport class OpenSearchQueryBuilderOperatorAndInPlugin extends OpenSearchQueryBuilderOperatorPlugin {\n public override name = \"opensearch.queryBuilder.operator.andIn.default\";\n\n public getOperator(): string {\n return \"and_in\";\n }\n\n public apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void {\n const { value: values, path, basePath } = params;\n const isArray = Array.isArray(values);\n if (isArray === false || values.length === 0) {\n throw new Error(\n `You cannot filter field \"${path}\" with \"in\" operator and not send an array of values.`\n );\n }\n\n let useBasePath = false;\n // Only use \".keyword\" if all of the provided values are strings.\n for (const value of values) {\n if (typeof value !== \"string\") {\n useBasePath = true;\n break;\n }\n }\n\n for (const value of values) {\n query.filter.push({\n term: {\n [useBasePath ? basePath : path]: value\n }\n });\n }\n }\n}\n"],"mappings":"AAAA,SAASA,oCAAoC;AAG7C,OAAO,MAAMC,yCAAyC,SAASD,oCAAoC,CAAC;EAChFE,IAAI,GAAG,gDAAgD;EAEhEC,WAAWA,CAAA,EAAW;IACzB,OAAO,QAAQ;EACnB;EAEOC,KAAKA,CAACC,KAAgC,EAAEC,MAAwC,EAAQ;IAC3F,MAAM;MAAEC,KAAK,EAAEC,MAAM;MAAEC,IAAI;MAAEC;IAAS,CAAC,GAAGJ,MAAM;IAChD,MAAMK,OAAO,GAAGC,KAAK,CAACD,OAAO,CAACH,MAAM,CAAC;IACrC,IAAIG,OAAO,KAAK,KAAK,IAAIH,MAAM,CAACK,MAAM,KAAK,CAAC,EAAE;MAC1C,MAAM,IAAIC,KAAK,CACX,4BAA4BL,IAAI,uDACpC,CAAC;IACL;IAEA,IAAIM,WAAW,GAAG,KAAK;IACvB;IACA,KAAK,MAAMR,KAAK,IAAIC,MAAM,EAAE;MACxB,IAAI,OAAOD,KAAK,KAAK,QAAQ,EAAE;QAC3BQ,WAAW,GAAG,IAAI;QAClB;MACJ;IACJ;IAEA,KAAK,MAAMR,KAAK,IAAIC,MAAM,EAAE;MACxBH,KAAK,CAACW,MAAM,CAACC,IAAI,CAAC;QACdC,IAAI,EAAE;UACF,CAACH,WAAW,GAAGL,QAAQ,GAAGD,IAAI,GAAGF;QACrC;MACJ,CAAC,CAAC;IACN;EACJ;AACJ","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ import { OpenSearchQueryBuilderOperatorPlugin } from "../../plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js";
2
+ import type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from "../../types.js";
3
+ export declare class OpenSearchQueryBuilderOperatorBetweenPlugin extends OpenSearchQueryBuilderOperatorPlugin {
4
+ name: string;
5
+ getOperator(): string;
6
+ apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void;
7
+ }
@@ -0,0 +1,32 @@
1
+ import { OpenSearchQueryBuilderOperatorPlugin } from "../definition/OpenSearchQueryBuilderOperatorPlugin.js";
2
+ export class OpenSearchQueryBuilderOperatorBetweenPlugin extends OpenSearchQueryBuilderOperatorPlugin {
3
+ name = "opensearch.queryBuilder.operator.between.default";
4
+ getOperator() {
5
+ return "between";
6
+ }
7
+ apply(query, params) {
8
+ const {
9
+ value,
10
+ basePath,
11
+ name
12
+ } = params;
13
+ if (Array.isArray(value) === false) {
14
+ throw new Error(`You cannot filter field path "${name}" with between query and not send an array of values.`);
15
+ } else if (value.length !== 2) {
16
+ throw new Error(`You must pass 2 values in the array for field path "${name}" filtering.`);
17
+ }
18
+ // we take gte first because it should be a lesser value than lte, eg [5, 10]
19
+ // 6 >= gte && 6 <= lte
20
+ const [gte, lte] = value;
21
+ query.filter.push({
22
+ range: {
23
+ [basePath]: {
24
+ lte,
25
+ gte
26
+ }
27
+ }
28
+ });
29
+ }
30
+ }
31
+
32
+ //# sourceMappingURL=between.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["OpenSearchQueryBuilderOperatorPlugin","OpenSearchQueryBuilderOperatorBetweenPlugin","name","getOperator","apply","query","params","value","basePath","Array","isArray","Error","length","gte","lte","filter","push","range"],"sources":["between.ts"],"sourcesContent":["import { OpenSearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js\";\nimport type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from \"~/types.js\";\n\nexport class OpenSearchQueryBuilderOperatorBetweenPlugin extends OpenSearchQueryBuilderOperatorPlugin {\n public override name = \"opensearch.queryBuilder.operator.between.default\";\n\n public getOperator(): string {\n return \"between\";\n }\n\n public apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void {\n const { value, basePath, name } = params;\n if (Array.isArray(value) === false) {\n throw new Error(\n `You cannot filter field path \"${name}\" with between query and not send an array of values.`\n );\n } else if (value.length !== 2) {\n throw new Error(\n `You must pass 2 values in the array for field path \"${name}\" filtering.`\n );\n }\n // we take gte first because it should be a lesser value than lte, eg [5, 10]\n // 6 >= gte && 6 <= lte\n const [gte, lte] = value;\n query.filter.push({\n range: {\n [basePath]: {\n lte,\n gte\n }\n }\n });\n }\n}\n"],"mappings":"AAAA,SAASA,oCAAoC;AAG7C,OAAO,MAAMC,2CAA2C,SAASD,oCAAoC,CAAC;EAClFE,IAAI,GAAG,kDAAkD;EAElEC,WAAWA,CAAA,EAAW;IACzB,OAAO,SAAS;EACpB;EAEOC,KAAKA,CAACC,KAAgC,EAAEC,MAAwC,EAAQ;IAC3F,MAAM;MAAEC,KAAK;MAAEC,QAAQ;MAAEN;IAAK,CAAC,GAAGI,MAAM;IACxC,IAAIG,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,KAAK,KAAK,EAAE;MAChC,MAAM,IAAII,KAAK,CACX,iCAAiCT,IAAI,uDACzC,CAAC;IACL,CAAC,MAAM,IAAIK,KAAK,CAACK,MAAM,KAAK,CAAC,EAAE;MAC3B,MAAM,IAAID,KAAK,CACX,uDAAuDT,IAAI,cAC/D,CAAC;IACL;IACA;IACA;IACA,MAAM,CAACW,GAAG,EAAEC,GAAG,CAAC,GAAGP,KAAK;IACxBF,KAAK,CAACU,MAAM,CAACC,IAAI,CAAC;MACdC,KAAK,EAAE;QACH,CAACT,QAAQ,GAAG;UACRM,GAAG;UACHD;QACJ;MACJ;IACJ,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ import { OpenSearchQueryBuilderOperatorPlugin } from "../../plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js";
2
+ import type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from "../../types.js";
3
+ export declare class OpenSearchQueryBuilderOperatorContainsPlugin extends OpenSearchQueryBuilderOperatorPlugin {
4
+ name: string;
5
+ getOperator(): string;
6
+ apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void;
7
+ }
@@ -0,0 +1,24 @@
1
+ import { OpenSearchQueryBuilderOperatorPlugin } from "../definition/OpenSearchQueryBuilderOperatorPlugin.js";
2
+ import { normalizeValueWithAsterisk } from "../../normalize.js";
3
+ export class OpenSearchQueryBuilderOperatorContainsPlugin extends OpenSearchQueryBuilderOperatorPlugin {
4
+ name = "opensearch.queryBuilder.operator.contains.default";
5
+ getOperator() {
6
+ return "contains";
7
+ }
8
+ apply(query, params) {
9
+ const {
10
+ value,
11
+ basePath
12
+ } = params;
13
+ query.must.push({
14
+ query_string: {
15
+ allow_leading_wildcard: true,
16
+ fields: [basePath],
17
+ query: normalizeValueWithAsterisk(value),
18
+ default_operator: "and"
19
+ }
20
+ });
21
+ }
22
+ }
23
+
24
+ //# sourceMappingURL=contains.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["OpenSearchQueryBuilderOperatorPlugin","normalizeValueWithAsterisk","OpenSearchQueryBuilderOperatorContainsPlugin","name","getOperator","apply","query","params","value","basePath","must","push","query_string","allow_leading_wildcard","fields","default_operator"],"sources":["contains.ts"],"sourcesContent":["import { OpenSearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js\";\nimport { normalizeValueWithAsterisk } from \"~/normalize.js\";\nimport type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from \"~/types.js\";\n\nexport class OpenSearchQueryBuilderOperatorContainsPlugin extends OpenSearchQueryBuilderOperatorPlugin {\n public override name = \"opensearch.queryBuilder.operator.contains.default\";\n\n public getOperator(): string {\n return \"contains\";\n }\n\n public apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void {\n const { value, basePath } = params;\n query.must.push({\n query_string: {\n allow_leading_wildcard: true,\n fields: [basePath],\n query: normalizeValueWithAsterisk(value),\n default_operator: \"and\"\n }\n });\n }\n}\n"],"mappings":"AAAA,SAASA,oCAAoC;AAC7C,SAASC,0BAA0B;AAGnC,OAAO,MAAMC,4CAA4C,SAASF,oCAAoC,CAAC;EACnFG,IAAI,GAAG,mDAAmD;EAEnEC,WAAWA,CAAA,EAAW;IACzB,OAAO,UAAU;EACrB;EAEOC,KAAKA,CAACC,KAAgC,EAAEC,MAAwC,EAAQ;IAC3F,MAAM;MAAEC,KAAK;MAAEC;IAAS,CAAC,GAAGF,MAAM;IAClCD,KAAK,CAACI,IAAI,CAACC,IAAI,CAAC;MACZC,YAAY,EAAE;QACVC,sBAAsB,EAAE,IAAI;QAC5BC,MAAM,EAAE,CAACL,QAAQ,CAAC;QAClBH,KAAK,EAAEL,0BAA0B,CAACO,KAAK,CAAC;QACxCO,gBAAgB,EAAE;MACtB;IACJ,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ import { OpenSearchQueryBuilderOperatorPlugin } from "../../plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js";
2
+ import type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from "../../types.js";
3
+ export declare class OpenSearchQueryBuilderOperatorEqualPlugin extends OpenSearchQueryBuilderOperatorPlugin {
4
+ name: string;
5
+ getOperator(): string;
6
+ apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void;
7
+ }
@@ -0,0 +1,50 @@
1
+ import { OpenSearchQueryBuilderOperatorPlugin } from "../definition/OpenSearchQueryBuilderOperatorPlugin.js";
2
+ export class OpenSearchQueryBuilderOperatorEqualPlugin extends OpenSearchQueryBuilderOperatorPlugin {
3
+ name = "opensearch.queryBuilder.operator.equal.default";
4
+ getOperator() {
5
+ return "eq";
6
+ }
7
+ apply(query, params) {
8
+ const {
9
+ value,
10
+ path,
11
+ basePath
12
+ } = params;
13
+ if (value === null || value === undefined) {
14
+ query.must_not.push({
15
+ exists: {
16
+ field: path
17
+ }
18
+ });
19
+ return;
20
+ }
21
+ const typeOf = typeof value;
22
+ /**
23
+ * If value is a number or boolean, use filtering instead of must/term
24
+ */
25
+ if (typeOf === "number" || typeOf === "boolean") {
26
+ query.filter.push({
27
+ term: {
28
+ [basePath]: value
29
+ }
30
+ });
31
+ return;
32
+ }
33
+ /**
34
+ * In case we are searching for a string, use regular path.
35
+ * Otherwise use base path.
36
+ */
37
+ const useBasePath = typeOf !== "string";
38
+ const valuePath = useBasePath ? basePath : path;
39
+ /**
40
+ * String or something else.
41
+ */
42
+ query.filter.push({
43
+ term: {
44
+ [valuePath]: value
45
+ }
46
+ });
47
+ }
48
+ }
49
+
50
+ //# sourceMappingURL=equal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["OpenSearchQueryBuilderOperatorPlugin","OpenSearchQueryBuilderOperatorEqualPlugin","name","getOperator","apply","query","params","value","path","basePath","undefined","must_not","push","exists","field","typeOf","filter","term","useBasePath","valuePath"],"sources":["equal.ts"],"sourcesContent":["import { OpenSearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js\";\nimport type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from \"~/types.js\";\n\nexport class OpenSearchQueryBuilderOperatorEqualPlugin extends OpenSearchQueryBuilderOperatorPlugin {\n public override name = \"opensearch.queryBuilder.operator.equal.default\";\n\n public getOperator(): string {\n return \"eq\";\n }\n\n public apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void {\n const { value, path, basePath } = params;\n\n if (value === null || value === undefined) {\n query.must_not.push({\n exists: {\n field: path\n }\n });\n return;\n }\n const typeOf = typeof value;\n /**\n * If value is a number or boolean, use filtering instead of must/term\n */\n if (typeOf === \"number\" || typeOf === \"boolean\") {\n query.filter.push({\n term: {\n [basePath]: value\n }\n });\n return;\n }\n /**\n * In case we are searching for a string, use regular path.\n * Otherwise use base path.\n */\n const useBasePath = typeOf !== \"string\";\n const valuePath = useBasePath ? basePath : path;\n /**\n * String or something else.\n */\n query.filter.push({\n term: {\n [valuePath]: value\n }\n });\n }\n}\n"],"mappings":"AAAA,SAASA,oCAAoC;AAG7C,OAAO,MAAMC,yCAAyC,SAASD,oCAAoC,CAAC;EAChFE,IAAI,GAAG,gDAAgD;EAEhEC,WAAWA,CAAA,EAAW;IACzB,OAAO,IAAI;EACf;EAEOC,KAAKA,CAACC,KAAgC,EAAEC,MAAwC,EAAQ;IAC3F,MAAM;MAAEC,KAAK;MAAEC,IAAI;MAAEC;IAAS,CAAC,GAAGH,MAAM;IAExC,IAAIC,KAAK,KAAK,IAAI,IAAIA,KAAK,KAAKG,SAAS,EAAE;MACvCL,KAAK,CAACM,QAAQ,CAACC,IAAI,CAAC;QAChBC,MAAM,EAAE;UACJC,KAAK,EAAEN;QACX;MACJ,CAAC,CAAC;MACF;IACJ;IACA,MAAMO,MAAM,GAAG,OAAOR,KAAK;IAC3B;AACR;AACA;IACQ,IAAIQ,MAAM,KAAK,QAAQ,IAAIA,MAAM,KAAK,SAAS,EAAE;MAC7CV,KAAK,CAACW,MAAM,CAACJ,IAAI,CAAC;QACdK,IAAI,EAAE;UACF,CAACR,QAAQ,GAAGF;QAChB;MACJ,CAAC,CAAC;MACF;IACJ;IACA;AACR;AACA;AACA;IACQ,MAAMW,WAAW,GAAGH,MAAM,KAAK,QAAQ;IACvC,MAAMI,SAAS,GAAGD,WAAW,GAAGT,QAAQ,GAAGD,IAAI;IAC/C;AACR;AACA;IACQH,KAAK,CAACW,MAAM,CAACJ,IAAI,CAAC;MACdK,IAAI,EAAE;QACF,CAACE,SAAS,GAAGZ;MACjB;IACJ,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ import { OpenSearchQueryBuilderOperatorPlugin } from "../../plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js";
2
+ import type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from "../../types.js";
3
+ export declare class OpenSearchQueryBuilderOperatorGreaterThanPlugin extends OpenSearchQueryBuilderOperatorPlugin {
4
+ name: string;
5
+ getOperator(): string;
6
+ apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void;
7
+ }
@@ -0,0 +1,22 @@
1
+ import { OpenSearchQueryBuilderOperatorPlugin } from "../definition/OpenSearchQueryBuilderOperatorPlugin.js";
2
+ export class OpenSearchQueryBuilderOperatorGreaterThanPlugin extends OpenSearchQueryBuilderOperatorPlugin {
3
+ name = "opensearch.queryBuilder.operator.greaterThan.default";
4
+ getOperator() {
5
+ return "gt";
6
+ }
7
+ apply(query, params) {
8
+ const {
9
+ value,
10
+ basePath
11
+ } = params;
12
+ query.filter.push({
13
+ range: {
14
+ [basePath]: {
15
+ gt: value
16
+ }
17
+ }
18
+ });
19
+ }
20
+ }
21
+
22
+ //# sourceMappingURL=gt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["OpenSearchQueryBuilderOperatorPlugin","OpenSearchQueryBuilderOperatorGreaterThanPlugin","name","getOperator","apply","query","params","value","basePath","filter","push","range","gt"],"sources":["gt.ts"],"sourcesContent":["import { OpenSearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js\";\nimport type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from \"~/types.js\";\n\nexport class OpenSearchQueryBuilderOperatorGreaterThanPlugin extends OpenSearchQueryBuilderOperatorPlugin {\n public override name = \"opensearch.queryBuilder.operator.greaterThan.default\";\n\n public getOperator(): string {\n return \"gt\";\n }\n\n public apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void {\n const { value, basePath } = params;\n query.filter.push({\n range: {\n [basePath]: {\n gt: value\n }\n }\n });\n }\n}\n"],"mappings":"AAAA,SAASA,oCAAoC;AAG7C,OAAO,MAAMC,+CAA+C,SAASD,oCAAoC,CAAC;EACtFE,IAAI,GAAG,sDAAsD;EAEtEC,WAAWA,CAAA,EAAW;IACzB,OAAO,IAAI;EACf;EAEOC,KAAKA,CAACC,KAAgC,EAAEC,MAAwC,EAAQ;IAC3F,MAAM;MAAEC,KAAK;MAAEC;IAAS,CAAC,GAAGF,MAAM;IAClCD,KAAK,CAACI,MAAM,CAACC,IAAI,CAAC;MACdC,KAAK,EAAE;QACH,CAACH,QAAQ,GAAG;UACRI,EAAE,EAAEL;QACR;MACJ;IACJ,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ import { OpenSearchQueryBuilderOperatorPlugin } from "../../plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js";
2
+ import type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from "../../types.js";
3
+ export declare class OpenSearchQueryBuilderOperatorGreaterThanOrEqualToPlugin extends OpenSearchQueryBuilderOperatorPlugin {
4
+ name: string;
5
+ getOperator(): string;
6
+ apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void;
7
+ }
@@ -0,0 +1,22 @@
1
+ import { OpenSearchQueryBuilderOperatorPlugin } from "../definition/OpenSearchQueryBuilderOperatorPlugin.js";
2
+ export class OpenSearchQueryBuilderOperatorGreaterThanOrEqualToPlugin extends OpenSearchQueryBuilderOperatorPlugin {
3
+ name = "opensearch.queryBuilder.operator.greaterThanOrEqualTo.default";
4
+ getOperator() {
5
+ return "gte";
6
+ }
7
+ apply(query, params) {
8
+ const {
9
+ value,
10
+ basePath
11
+ } = params;
12
+ query.filter.push({
13
+ range: {
14
+ [basePath]: {
15
+ gte: value
16
+ }
17
+ }
18
+ });
19
+ }
20
+ }
21
+
22
+ //# sourceMappingURL=gte.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["OpenSearchQueryBuilderOperatorPlugin","OpenSearchQueryBuilderOperatorGreaterThanOrEqualToPlugin","name","getOperator","apply","query","params","value","basePath","filter","push","range","gte"],"sources":["gte.ts"],"sourcesContent":["import { OpenSearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js\";\nimport type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from \"~/types.js\";\n\nexport class OpenSearchQueryBuilderOperatorGreaterThanOrEqualToPlugin extends OpenSearchQueryBuilderOperatorPlugin {\n public override name = \"opensearch.queryBuilder.operator.greaterThanOrEqualTo.default\";\n\n public getOperator(): string {\n return \"gte\";\n }\n\n public apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void {\n const { value, basePath } = params;\n query.filter.push({\n range: {\n [basePath]: {\n gte: value\n }\n }\n });\n }\n}\n"],"mappings":"AAAA,SAASA,oCAAoC;AAG7C,OAAO,MAAMC,wDAAwD,SAASD,oCAAoC,CAAC;EAC/FE,IAAI,GAAG,+DAA+D;EAE/EC,WAAWA,CAAA,EAAW;IACzB,OAAO,KAAK;EAChB;EAEOC,KAAKA,CAACC,KAAgC,EAAEC,MAAwC,EAAQ;IAC3F,MAAM;MAAEC,KAAK;MAAEC;IAAS,CAAC,GAAGF,MAAM;IAClCD,KAAK,CAACI,MAAM,CAACC,IAAI,CAAC;MACdC,KAAK,EAAE;QACH,CAACH,QAAQ,GAAG;UACRI,GAAG,EAAEL;QACT;MACJ;IACJ,CAAC,CAAC;EACN;AACJ","ignoreList":[]}