@webiny/api-elasticsearch 0.0.0-unstable.eb196ccd2f → 0.0.0-unstable.f6dc066313

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/README.md +10 -0
  2. package/client.d.ts +2 -2
  3. package/client.js +11 -30
  4. package/client.js.map +1 -1
  5. package/compression.js +7 -14
  6. package/compression.js.map +1 -1
  7. package/cursors.d.ts +1 -1
  8. package/cursors.js +2 -10
  9. package/cursors.js.map +1 -1
  10. package/db/entity.d.ts +7 -0
  11. package/db/entity.js +20 -0
  12. package/db/entity.js.map +1 -0
  13. package/db/index.d.ts +3 -0
  14. package/db/index.js +5 -0
  15. package/db/index.js.map +1 -0
  16. package/db/table.d.ts +7 -0
  17. package/db/table.js +17 -0
  18. package/db/table.js.map +1 -0
  19. package/db/types.d.ts +6 -0
  20. package/db/types.js +3 -0
  21. package/db/types.js.map +1 -0
  22. package/index.d.ts +18 -17
  23. package/index.js +27 -197
  24. package/index.js.map +1 -1
  25. package/indexConfiguration/base.d.ts +1 -1
  26. package/indexConfiguration/base.js +3 -10
  27. package/indexConfiguration/base.js.map +1 -1
  28. package/indexConfiguration/common.d.ts +1 -1
  29. package/indexConfiguration/common.js +1 -8
  30. package/indexConfiguration/common.js.map +1 -1
  31. package/indexConfiguration/index.d.ts +2 -3
  32. package/indexConfiguration/index.js +2 -38
  33. package/indexConfiguration/index.js.map +1 -1
  34. package/indexPrefix.js +2 -9
  35. package/indexPrefix.js.map +1 -1
  36. package/indices.d.ts +1 -2
  37. package/indices.js +6 -16
  38. package/indices.js.map +1 -1
  39. package/limit.js +1 -8
  40. package/limit.js.map +1 -1
  41. package/normalize.js +3 -11
  42. package/normalize.js.map +1 -1
  43. package/operations/ElasticsearchCatHealth.d.ts +2 -2
  44. package/operations/ElasticsearchCatHealth.js +6 -13
  45. package/operations/ElasticsearchCatHealth.js.map +1 -1
  46. package/operations/ElasticsearchCatNodes.d.ts +2 -2
  47. package/operations/ElasticsearchCatNodes.js +6 -13
  48. package/operations/ElasticsearchCatNodes.js.map +1 -1
  49. package/operations/index.d.ts +3 -3
  50. package/operations/index.js +3 -38
  51. package/operations/index.js.map +1 -1
  52. package/operations/stripConnectionFromException.js +1 -8
  53. package/operations/stripConnectionFromException.js.map +1 -1
  54. package/operations/types.js +1 -7
  55. package/operations/types.js.map +1 -1
  56. package/operators.d.ts +2 -5
  57. package/operators.js +3 -41
  58. package/operators.js.map +1 -1
  59. package/package.json +13 -12
  60. package/plugins/definition/ElasticsearchBodyModifierPlugin.js +4 -12
  61. package/plugins/definition/ElasticsearchBodyModifierPlugin.js.map +1 -1
  62. package/plugins/definition/ElasticsearchFieldPlugin.js +2 -9
  63. package/plugins/definition/ElasticsearchFieldPlugin.js.map +1 -1
  64. package/plugins/definition/ElasticsearchIndexPlugin.d.ts +2 -10
  65. package/plugins/definition/ElasticsearchIndexPlugin.js +4 -23
  66. package/plugins/definition/ElasticsearchIndexPlugin.js.map +1 -1
  67. package/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin.d.ts +1 -5
  68. package/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin.js +2 -17
  69. package/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin.js.map +1 -1
  70. package/plugins/definition/ElasticsearchQueryModifierPlugin.d.ts +1 -1
  71. package/plugins/definition/ElasticsearchQueryModifierPlugin.js +4 -12
  72. package/plugins/definition/ElasticsearchQueryModifierPlugin.js.map +1 -1
  73. package/plugins/definition/ElasticsearchSortModifierPlugin.js +4 -12
  74. package/plugins/definition/ElasticsearchSortModifierPlugin.js.map +1 -1
  75. package/plugins/definition/index.d.ts +6 -6
  76. package/plugins/definition/index.js +6 -71
  77. package/plugins/definition/index.js.map +1 -1
  78. package/plugins/index.d.ts +2 -2
  79. package/plugins/index.js +2 -27
  80. package/plugins/index.js.map +1 -1
  81. package/plugins/operator/andIn.d.ts +2 -2
  82. package/plugins/operator/andIn.js +2 -9
  83. package/plugins/operator/andIn.js.map +1 -1
  84. package/plugins/operator/between.d.ts +2 -2
  85. package/plugins/operator/between.js +2 -9
  86. package/plugins/operator/between.js.map +1 -1
  87. package/plugins/operator/contains.d.ts +2 -2
  88. package/plugins/operator/contains.js +4 -11
  89. package/plugins/operator/contains.js.map +1 -1
  90. package/plugins/operator/equal.d.ts +2 -2
  91. package/plugins/operator/equal.js +2 -9
  92. package/plugins/operator/equal.js.map +1 -1
  93. package/plugins/operator/gt.d.ts +2 -2
  94. package/plugins/operator/gt.js +2 -9
  95. package/plugins/operator/gt.js.map +1 -1
  96. package/plugins/operator/gte.d.ts +2 -2
  97. package/plugins/operator/gte.js +2 -9
  98. package/plugins/operator/gte.js.map +1 -1
  99. package/plugins/operator/in.d.ts +2 -2
  100. package/plugins/operator/in.js +2 -9
  101. package/plugins/operator/in.js.map +1 -1
  102. package/plugins/operator/index.d.ts +15 -16
  103. package/plugins/operator/index.js +15 -181
  104. package/plugins/operator/index.js.map +1 -1
  105. package/plugins/operator/lt.d.ts +2 -2
  106. package/plugins/operator/lt.js +2 -9
  107. package/plugins/operator/lt.js.map +1 -1
  108. package/plugins/operator/lte.d.ts +2 -2
  109. package/plugins/operator/lte.js +2 -9
  110. package/plugins/operator/lte.js.map +1 -1
  111. package/plugins/operator/not.d.ts +2 -2
  112. package/plugins/operator/not.js +2 -9
  113. package/plugins/operator/not.js.map +1 -1
  114. package/plugins/operator/notBetween.d.ts +2 -2
  115. package/plugins/operator/notBetween.js +2 -9
  116. package/plugins/operator/notBetween.js.map +1 -1
  117. package/plugins/operator/notContains.d.ts +2 -2
  118. package/plugins/operator/notContains.js +4 -11
  119. package/plugins/operator/notContains.js.map +1 -1
  120. package/plugins/operator/notIn.d.ts +2 -2
  121. package/plugins/operator/notIn.js +2 -9
  122. package/plugins/operator/notIn.js.map +1 -1
  123. package/plugins/operator/notStartsWith.d.ts +2 -2
  124. package/plugins/operator/notStartsWith.js +2 -9
  125. package/plugins/operator/notStartsWith.js.map +1 -1
  126. package/plugins/operator/startsWith.d.ts +2 -2
  127. package/plugins/operator/startsWith.js +2 -9
  128. package/plugins/operator/startsWith.js.map +1 -1
  129. package/sharedIndex.js +2 -9
  130. package/sharedIndex.js.map +1 -1
  131. package/sort.d.ts +2 -2
  132. package/sort.js +8 -16
  133. package/sort.js.map +1 -1
  134. package/types.d.ts +3 -3
  135. package/types.js +28 -26
  136. package/types.js.map +1 -1
  137. package/utils/createIndex.d.ts +0 -1
  138. package/utils/createIndex.js +7 -19
  139. package/utils/createIndex.js.map +1 -1
  140. package/utils/index.d.ts +3 -3
  141. package/utils/index.js +3 -27
  142. package/utils/index.js.map +1 -1
  143. package/utils/waitUntilHealthy/UnhealthyClusterError.js +2 -9
  144. package/utils/waitUntilHealthy/UnhealthyClusterError.js.map +1 -1
  145. package/utils/waitUntilHealthy/WaitUntilHealthy.d.ts +3 -3
  146. package/utils/waitUntilHealthy/WaitUntilHealthy.js +22 -29
  147. package/utils/waitUntilHealthy/WaitUntilHealthy.js.map +1 -1
  148. package/utils/waitUntilHealthy/WaitingHealthyClusterAbortedError.js +2 -9
  149. package/utils/waitUntilHealthy/WaitingHealthyClusterAbortedError.js.map +1 -1
  150. package/utils/waitUntilHealthy/index.d.ts +6 -6
  151. package/utils/waitUntilHealthy/index.js +6 -49
  152. package/utils/waitUntilHealthy/index.js.map +1 -1
  153. package/utils/waitUntilHealthy/reason/ClusterHealthReason.d.ts +2 -2
  154. package/utils/waitUntilHealthy/reason/ClusterHealthReason.js +2 -10
  155. package/utils/waitUntilHealthy/reason/ClusterHealthReason.js.map +1 -1
  156. package/utils/waitUntilHealthy/reason/IReason.js +1 -5
  157. package/utils/waitUntilHealthy/reason/MemoryReason.d.ts +1 -1
  158. package/utils/waitUntilHealthy/reason/MemoryReason.js +2 -10
  159. package/utils/waitUntilHealthy/reason/MemoryReason.js.map +1 -1
  160. package/utils/waitUntilHealthy/reason/ProcessorReason.d.ts +1 -1
  161. package/utils/waitUntilHealthy/reason/ProcessorReason.js +2 -10
  162. package/utils/waitUntilHealthy/reason/ProcessorReason.js.map +1 -1
  163. package/utils/waitUntilHealthy/reason/index.d.ts +3 -3
  164. package/utils/waitUntilHealthy/reason/index.js +3 -38
  165. package/utils/waitUntilHealthy/reason/index.js.map +1 -1
  166. package/where.d.ts +3 -3
  167. package/where.js +7 -16
  168. package/where.js.map +1 -1
  169. package/indexConfiguration/japanese.d.ts +0 -6
  170. package/indexConfiguration/japanese.js +0 -121
  171. package/indexConfiguration/japanese.js.map +0 -1
  172. package/plugins/operator/japanese/contains.d.ts +0 -8
  173. package/plugins/operator/japanese/contains.js +0 -44
  174. package/plugins/operator/japanese/contains.js.map +0 -1
@@ -1,10 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createProcessorReason = exports.ProcessorReason = void 0;
7
- class ProcessorReason {
1
+ export class ProcessorReason {
8
2
  name = "processor";
9
3
  constructor(params) {
10
4
  this.maximum = params.maximum;
@@ -12,10 +6,8 @@ class ProcessorReason {
12
6
  this.description = params.description;
13
7
  }
14
8
  }
15
- exports.ProcessorReason = ProcessorReason;
16
- const createProcessorReason = params => {
9
+ export const createProcessorReason = params => {
17
10
  return new ProcessorReason(params);
18
11
  };
19
- exports.createProcessorReason = createProcessorReason;
20
12
 
21
13
  //# sourceMappingURL=ProcessorReason.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ProcessorReason","name","constructor","params","maximum","current","description","exports","createProcessorReason"],"sources":["ProcessorReason.ts"],"sourcesContent":["import type { IReason } from \"~/utils/waitUntilHealthy/reason/IReason\";\n\nexport interface IProcessorReasonParams {\n maximum: number;\n current: number;\n description?: string;\n}\n\nexport class ProcessorReason implements IReason {\n public readonly name = \"processor\";\n public readonly maximum: number;\n public readonly current: number;\n public readonly description?: string;\n\n public constructor(params: IProcessorReasonParams) {\n this.maximum = params.maximum;\n this.current = params.current;\n this.description = params.description;\n }\n}\n\nexport const createProcessorReason = (params: IProcessorReasonParams): ProcessorReason => {\n return new ProcessorReason(params);\n};\n"],"mappings":";;;;;;AAQO,MAAMA,eAAe,CAAoB;EAC5BC,IAAI,GAAG,WAAW;EAK3BC,WAAWA,CAACC,MAA8B,EAAE;IAC/C,IAAI,CAACC,OAAO,GAAGD,MAAM,CAACC,OAAO;IAC7B,IAAI,CAACC,OAAO,GAAGF,MAAM,CAACE,OAAO;IAC7B,IAAI,CAACC,WAAW,GAAGH,MAAM,CAACG,WAAW;EACzC;AACJ;AAACC,OAAA,CAAAP,eAAA,GAAAA,eAAA;AAEM,MAAMQ,qBAAqB,GAAIL,MAA8B,IAAsB;EACtF,OAAO,IAAIH,eAAe,CAACG,MAAM,CAAC;AACtC,CAAC;AAACI,OAAA,CAAAC,qBAAA,GAAAA,qBAAA","ignoreList":[]}
1
+ {"version":3,"names":["ProcessorReason","name","constructor","params","maximum","current","description","createProcessorReason"],"sources":["ProcessorReason.ts"],"sourcesContent":["import type { IReason } from \"~/utils/waitUntilHealthy/reason/IReason.js\";\n\nexport interface IProcessorReasonParams {\n maximum: number;\n current: number;\n description?: string;\n}\n\nexport class ProcessorReason implements IReason {\n public readonly name = \"processor\";\n public readonly maximum: number;\n public readonly current: number;\n public readonly description?: string;\n\n public constructor(params: IProcessorReasonParams) {\n this.maximum = params.maximum;\n this.current = params.current;\n this.description = params.description;\n }\n}\n\nexport const createProcessorReason = (params: IProcessorReasonParams): ProcessorReason => {\n return new ProcessorReason(params);\n};\n"],"mappings":"AAQA,OAAO,MAAMA,eAAe,CAAoB;EAC5BC,IAAI,GAAG,WAAW;EAK3BC,WAAWA,CAACC,MAA8B,EAAE;IAC/C,IAAI,CAACC,OAAO,GAAGD,MAAM,CAACC,OAAO;IAC7B,IAAI,CAACC,OAAO,GAAGF,MAAM,CAACE,OAAO;IAC7B,IAAI,CAACC,WAAW,GAAGH,MAAM,CAACG,WAAW;EACzC;AACJ;AAEA,OAAO,MAAMC,qBAAqB,GAAIJ,MAA8B,IAAsB;EACtF,OAAO,IAAIH,eAAe,CAACG,MAAM,CAAC;AACtC,CAAC","ignoreList":[]}
@@ -1,3 +1,3 @@
1
- export * from "./ClusterHealthReason";
2
- export * from "./MemoryReason";
3
- export * from "./ProcessorReason";
1
+ export * from "./ClusterHealthReason.js";
2
+ export * from "./MemoryReason.js";
3
+ export * from "./ProcessorReason.js";
@@ -1,40 +1,5 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _ClusterHealthReason = require("./ClusterHealthReason");
7
- Object.keys(_ClusterHealthReason).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _ClusterHealthReason[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _ClusterHealthReason[key];
14
- }
15
- });
16
- });
17
- var _MemoryReason = require("./MemoryReason");
18
- Object.keys(_MemoryReason).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _MemoryReason[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function () {
24
- return _MemoryReason[key];
25
- }
26
- });
27
- });
28
- var _ProcessorReason = require("./ProcessorReason");
29
- Object.keys(_ProcessorReason).forEach(function (key) {
30
- if (key === "default" || key === "__esModule") return;
31
- if (key in exports && exports[key] === _ProcessorReason[key]) return;
32
- Object.defineProperty(exports, key, {
33
- enumerable: true,
34
- get: function () {
35
- return _ProcessorReason[key];
36
- }
37
- });
38
- });
1
+ export * from "./ClusterHealthReason.js";
2
+ export * from "./MemoryReason.js";
3
+ export * from "./ProcessorReason.js";
39
4
 
40
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_ClusterHealthReason","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_MemoryReason","_ProcessorReason"],"sources":["index.ts"],"sourcesContent":["export * from \"./ClusterHealthReason\";\nexport * from \"./MemoryReason\";\nexport * from \"./ProcessorReason\";\n"],"mappings":";;;;;AAAA,IAAAA,oBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,oBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,oBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,oBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,aAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,aAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,aAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,aAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,gBAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,gBAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,gBAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,gBAAA,CAAAN,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./ClusterHealthReason.js\";\nexport * from \"./MemoryReason.js\";\nexport * from \"./ProcessorReason.js\";\n"],"mappings":"AAAA;AACA;AACA","ignoreList":[]}
package/where.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { ElasticsearchBoolQueryConfig } from "./types";
2
- import { ElasticsearchFieldPlugin } from "./plugins/definition/ElasticsearchFieldPlugin";
3
- import type { ElasticsearchQueryBuilderOperatorPlugin } from "./plugins/definition/ElasticsearchQueryBuilderOperatorPlugin";
1
+ import type { ElasticsearchBoolQueryConfig } from "./types.js";
2
+ import { ElasticsearchFieldPlugin } from "./plugins/definition/ElasticsearchFieldPlugin.js";
3
+ import type { ElasticsearchQueryBuilderOperatorPlugin } from "./plugins/definition/ElasticsearchQueryBuilderOperatorPlugin.js";
4
4
  type Records<T> = Record<string, T>;
5
5
  export interface ApplyWhereParams {
6
6
  query: ElasticsearchBoolQueryConfig;
package/where.js CHANGED
@@ -1,17 +1,10 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.parseWhereKey = exports.applyWhere = void 0;
8
- var _ElasticsearchFieldPlugin = require("./plugins/definition/ElasticsearchFieldPlugin");
9
- var _error = _interopRequireDefault(require("@webiny/error"));
1
+ import { ElasticsearchFieldPlugin } from "./plugins/definition/ElasticsearchFieldPlugin.js";
2
+ import WebinyError from "@webiny/error";
10
3
  /**
11
4
  * TODO remove the wbyAco prefix when we move the user fields to the values property.
12
5
  */
13
6
  const parseWhereKeyRegExp = new RegExp(/^((?:wbyAco_)?[a-zA-Z0-9]+)(_[a-zA-Z0-9_]+)?$/);
14
- const parseWhereKey = key => {
7
+ export const parseWhereKey = key => {
15
8
  const match = key.match(parseWhereKeyRegExp);
16
9
  if (!match) {
17
10
  throw new Error(`It is not possible to search by key "${key}"`);
@@ -26,9 +19,8 @@ const parseWhereKey = key => {
26
19
  operator
27
20
  };
28
21
  };
29
- exports.parseWhereKey = parseWhereKey;
30
- const ALL = _ElasticsearchFieldPlugin.ElasticsearchFieldPlugin.ALL;
31
- const applyWhere = params => {
22
+ const ALL = ElasticsearchFieldPlugin.ALL;
23
+ export const applyWhere = params => {
32
24
  const {
33
25
  query,
34
26
  where,
@@ -52,13 +44,13 @@ const applyWhere = params => {
52
44
  } = parseWhereKey(key);
53
45
  const fieldPlugin = fields[field] || fields[ALL];
54
46
  if (!fieldPlugin) {
55
- throw new _error.default(`Missing plugin for the field "${field}".`, "PLUGIN_WHERE_ERROR", {
47
+ throw new WebinyError(`Missing plugin for the field "${field}".`, "PLUGIN_WHERE_ERROR", {
56
48
  field
57
49
  });
58
50
  }
59
51
  const operatorPlugin = operators[operator];
60
52
  if (!operatorPlugin) {
61
- throw new _error.default(`Missing plugin for the operator "${operator}"`, "PLUGIN_WHERE_ERROR", {
53
+ throw new WebinyError(`Missing plugin for the operator "${operator}"`, "PLUGIN_WHERE_ERROR", {
62
54
  operator
63
55
  });
64
56
  }
@@ -86,6 +78,5 @@ const applyWhere = params => {
86
78
  });
87
79
  }
88
80
  };
89
- exports.applyWhere = applyWhere;
90
81
 
91
82
  //# sourceMappingURL=where.js.map
package/where.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_ElasticsearchFieldPlugin","require","_error","_interopRequireDefault","parseWhereKeyRegExp","RegExp","parseWhereKey","key","match","Error","field","operation","operator","slice","exports","ALL","ElasticsearchFieldPlugin","applyWhere","params","query","where","fields","operators","hasOwnProperty","initialValue","undefined","fieldPlugin","WebinyError","operatorPlugin","path","getPath","basePath","getBasePath","value","toSearchValue","apply","name","keyword"],"sources":["where.ts"],"sourcesContent":["import type { ElasticsearchBoolQueryConfig } from \"~/types\";\nimport { ElasticsearchFieldPlugin } from \"~/plugins/definition/ElasticsearchFieldPlugin\";\nimport type { ElasticsearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin\";\nimport WebinyError from \"@webiny/error\";\n\ntype Records<T> = Record<string, T>;\n\nexport interface ApplyWhereParams {\n query: ElasticsearchBoolQueryConfig;\n where: Records<any>;\n fields: Records<ElasticsearchFieldPlugin>;\n operators: Records<ElasticsearchQueryBuilderOperatorPlugin>;\n}\n\nexport interface ParseWhereKeyResult {\n field: string;\n operator: string;\n}\n\n/**\n * TODO remove the wbyAco prefix when we move the user fields to the values property.\n */\nconst parseWhereKeyRegExp = new RegExp(/^((?:wbyAco_)?[a-zA-Z0-9]+)(_[a-zA-Z0-9_]+)?$/);\n\nexport const parseWhereKey = (key: string): ParseWhereKeyResult => {\n const match = key.match(parseWhereKeyRegExp);\n\n if (!match) {\n throw new Error(`It is not possible to search by key \"${key}\"`);\n }\n\n const [, field, operation = \"eq\"] = match;\n\n if (!field.match(/^(?:wbyAco_)?([a-zA-Z0-9]+)$/)) {\n throw new Error(`Cannot filter by \"${field}\".`);\n }\n\n const operator = operation.match(/^_/) ? operation.slice(1) : operation;\n\n return { field, operator };\n};\n\nconst ALL = ElasticsearchFieldPlugin.ALL;\n\nexport const applyWhere = (params: ApplyWhereParams): void => {\n const { query, where, fields, operators } = params;\n\n for (const key in where) {\n if (where.hasOwnProperty(key) === false) {\n continue;\n }\n const initialValue = where[key];\n /**\n * There is a possibility that undefined is sent as a value, so just skip it.\n */\n if (initialValue === undefined) {\n continue;\n }\n const { field, operator } = parseWhereKey(key);\n const fieldPlugin: ElasticsearchFieldPlugin = fields[field] || fields[ALL];\n if (!fieldPlugin) {\n throw new WebinyError(\n `Missing plugin for the field \"${field}\".`,\n \"PLUGIN_WHERE_ERROR\",\n {\n field\n }\n );\n }\n const operatorPlugin = operators[operator];\n if (!operatorPlugin) {\n throw new WebinyError(\n `Missing plugin for the operator \"${operator}\"`,\n \"PLUGIN_WHERE_ERROR\",\n {\n operator\n }\n );\n }\n\n /**\n * Get the path but in the case of * (all fields, replace * with the field.\n * Custom path would return its own value anyways.\n */\n const path = fieldPlugin.getPath(field);\n const basePath = fieldPlugin.getBasePath(field);\n /**\n * Transform the value for the search.\n */\n const value = fieldPlugin.toSearchValue({\n value: initialValue,\n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;IAC/B;AACR;AACA;IACQ,IAAIiB,YAAY,KAAKC,SAAS,EAAE;MAC5B;IACJ;IACA,MAAM;MAAEf,KAAK;MAAEE;IAAS,CAAC,GAAGN,aAAa,CAACC,GAAG,CAAC;IAC9C,MAAMmB,WAAqC,GAAGL,MAAM,CAACX,KAAK,CAAC,IAAIW,MAAM,CAACN,GAAG,CAAC;IAC1E,IAAI,CAACW,WAAW,EAAE;MACd,MAAM,IAAIC,cAAW,CACjB,iCAAiCjB,KAAK,IAAI,EAC1C,oBAAoB,EACpB;QACIA;MACJ,CACJ,CAAC;IACL;IACA,MAAMkB,cAAc,GAAGN,SAAS,CAACV,QAAQ,CAAC;IAC1C,IAAI,CAACgB,cAAc,EAAE;MACjB,MAAM,IAAID,cAAW,CACjB,oCAAoCf,QAAQ,GAAG,EAC/C,oBAAoB,EACpB;QACIA;MACJ,CACJ,CAAC;IACL;;IAEA;AACR;AACA;AACA;IACQ,MAAMiB,IAAI,GAAGH,WAAW,CAACI,OAAO,CAACpB,KAAK,CAAC;IACvC,MAAMqB,QAAQ,GAAGL,WAAW,CAACM,WAAW,CAACtB,KAAK,CAAC;IAC/C;AACR;AACA;IACQ,MAAMuB,KAAK,GAAGP,WAAW,CAACQ,aAAa,CAAC;MACpCD,KAAK,EAAET,YAAY;MACnBK,IAAI;MACJE;IACJ,CAAC,CAAC;IAEFH,cAAc,CAACO,KAAK,CAAChB,KAAK,EAAE;MACxBiB,IAAI,EAAE1B,KAAK;MACXuB,KAAK;MACLJ,IAAI;MACJE,QAAQ;MACRM,OAAO,EAAEX,WAAW,CAACW;IACzB,CAAC,CAAC;EACN;AACJ,CAAC;AAACvB,OAAA,CAAAG,UAAA,GAAAA,UAAA","ignoreList":[]}
1
+ {"version":3,"names":["ElasticsearchFieldPlugin","WebinyError","parseWhereKeyRegExp","RegExp","parseWhereKey","key","match","Error","field","operation","operator","slice","ALL","applyWhere","params","query","where","fields","operators","hasOwnProperty","initialValue","undefined","fieldPlugin","operatorPlugin","path","getPath","basePath","getBasePath","value","toSearchValue","apply","name","keyword"],"sources":["where.ts"],"sourcesContent":["import type { ElasticsearchBoolQueryConfig } from \"~/types.js\";\nimport { ElasticsearchFieldPlugin } from \"~/plugins/definition/ElasticsearchFieldPlugin.js\";\nimport type { ElasticsearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin.js\";\nimport WebinyError from \"@webiny/error\";\n\ntype Records<T> = Record<string, T>;\n\nexport interface ApplyWhereParams {\n query: ElasticsearchBoolQueryConfig;\n where: Records<any>;\n fields: Records<ElasticsearchFieldPlugin>;\n operators: Records<ElasticsearchQueryBuilderOperatorPlugin>;\n}\n\nexport interface ParseWhereKeyResult {\n field: string;\n operator: string;\n}\n\n/**\n * TODO remove the wbyAco prefix when we move the user fields to the values property.\n */\nconst parseWhereKeyRegExp = new RegExp(/^((?:wbyAco_)?[a-zA-Z0-9]+)(_[a-zA-Z0-9_]+)?$/);\n\nexport const parseWhereKey = (key: string): ParseWhereKeyResult => {\n const match = key.match(parseWhereKeyRegExp);\n\n if (!match) {\n throw new Error(`It is not possible to search by key \"${key}\"`);\n }\n\n const [, field, operation = \"eq\"] = match;\n\n if (!field.match(/^(?:wbyAco_)?([a-zA-Z0-9]+)$/)) {\n throw new Error(`Cannot filter by \"${field}\".`);\n }\n\n const operator = operation.match(/^_/) ? operation.slice(1) : operation;\n\n return { field, operator };\n};\n\nconst ALL = ElasticsearchFieldPlugin.ALL;\n\nexport const applyWhere = (params: ApplyWhereParams): void => {\n const { query, where, fields, operators } = params;\n\n for (const key in where) {\n if (where.hasOwnProperty(key) === false) {\n continue;\n }\n const initialValue = where[key];\n /**\n * There is a possibility that undefined is sent as a value, so just skip it.\n */\n if (initialValue === undefined) {\n continue;\n }\n const { field, operator } = parseWhereKey(key);\n const fieldPlugin: ElasticsearchFieldPlugin = fields[field] || fields[ALL];\n if (!fieldPlugin) {\n throw new WebinyError(\n `Missing plugin for the field \"${field}\".`,\n \"PLUGIN_WHERE_ERROR\",\n {\n field\n }\n );\n }\n const operatorPlugin = operators[operator];\n if (!operatorPlugin) {\n throw new WebinyError(\n `Missing plugin for the operator \"${operator}\"`,\n \"PLUGIN_WHERE_ERROR\",\n {\n operator\n }\n );\n }\n\n /**\n * Get the path but in the case of * (all fields, replace * with the field.\n * Custom path would return its own value anyways.\n */\n const path = fieldPlugin.getPath(field);\n const basePath = fieldPlugin.getBasePath(field);\n /**\n * Transform the value for the search.\n */\n const value = fieldPlugin.toSearchValue({\n value: initialValue,\n path,\n basePath\n });\n\n operatorPlugin.apply(query, {\n name: field,\n value,\n path,\n basePath,\n keyword: fieldPlugin.keyword\n });\n }\n};\n"],"mappings":"AACA,SAASA,wBAAwB;AAEjC,OAAOC,WAAW,MAAM,eAAe;AAgBvC;AACA;AACA;AACA,MAAMC,mBAAmB,GAAG,IAAIC,MAAM,CAAC,+CAA+C,CAAC;AAEvF,OAAO,MAAMC,aAAa,GAAIC,GAAW,IAA0B;EAC/D,MAAMC,KAAK,GAAGD,GAAG,CAACC,KAAK,CAACJ,mBAAmB,CAAC;EAE5C,IAAI,CAACI,KAAK,EAAE;IACR,MAAM,IAAIC,KAAK,CAAC,wCAAwCF,GAAG,GAAG,CAAC;EACnE;EAEA,MAAM,GAAGG,KAAK,EAAEC,SAAS,GAAG,IAAI,CAAC,GAAGH,KAAK;EAEzC,IAAI,CAACE,KAAK,CAACF,KAAK,CAAC,8BAA8B,CAAC,EAAE;IAC9C,MAAM,IAAIC,KAAK,CAAC,qBAAqBC,KAAK,IAAI,CAAC;EACnD;EAEA,MAAME,QAAQ,GAAGD,SAAS,CAACH,KAAK,CAAC,IAAI,CAAC,GAAGG,SAAS,CAACE,KAAK,CAAC,CAAC,CAAC,GAAGF,SAAS;EAEvE,OAAO;IAAED,KAAK;IAAEE;EAAS,CAAC;AAC9B,CAAC;AAED,MAAME,GAAG,GAAGZ,wBAAwB,CAACY,GAAG;AAExC,OAAO,MAAMC,UAAU,GAAIC,MAAwB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,WAAW,CAACU;IACzB,CAAC,CAAC;EACN;AACJ,CAAC","ignoreList":[]}
@@ -1,6 +0,0 @@
1
- import type { ElasticsearchIndexRequestBody } from "../types";
2
- interface Modifier {
3
- (config: ElasticsearchIndexRequestBody): ElasticsearchIndexRequestBody;
4
- }
5
- export declare const getJapaneseConfiguration: (modifier?: Modifier) => ElasticsearchIndexRequestBody;
6
- export {};
@@ -1,121 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getJapaneseConfiguration = void 0;
7
- var _common = require("./common");
8
- const config = {
9
- settings: {
10
- index: {
11
- analysis: {
12
- char_filter: {
13
- normalize: {
14
- type: "icu_normalizer",
15
- name: "nfkc",
16
- mode: "compose"
17
- }
18
- },
19
- tokenizer: {
20
- ja_kuromoji_tokenizer: {
21
- mode: "search",
22
- type: "kuromoji_tokenizer",
23
- discard_compound_token: "true",
24
- user_dictionary_rules: ["東京スカイツリー,東京 スカイツリー,トウキョウ スカイツリー,カスタム名詞"]
25
- },
26
- ja_ngram_tokenizer: {
27
- type: "ngram",
28
- min_gram: "2",
29
- max_gram: "2",
30
- token_chars: ["letter", "digit"]
31
- }
32
- },
33
- filter: {
34
- ja_index_synonym: {
35
- type: "synonym",
36
- lenient: "false",
37
- synonyms: []
38
- },
39
- ja_search_synonym: {
40
- type: "synonym_graph",
41
- lenient: "false",
42
- synonyms: ["米国, アメリカ", "東京大学, 東大"]
43
- }
44
- },
45
- analyzer: {
46
- ja_kuromoji_index_analyzer: {
47
- type: "custom",
48
- char_filter: ["normalize"],
49
- tokenizer: "ja_kuromoji_tokenizer",
50
- filter: ["kuromoji_baseform", "kuromoji_part_of_speech", "ja_index_synonym", "cjk_width", "ja_stop", "kuromoji_stemmer", "lowercase"]
51
- },
52
- ja_kuromoji_search_analyzer: {
53
- type: "custom",
54
- char_filter: ["normalize"],
55
- tokenizer: "ja_kuromoji_tokenizer",
56
- filter: ["kuromoji_baseform", "kuromoji_part_of_speech", "ja_search_synonym", "cjk_width", "ja_stop", "kuromoji_stemmer", "lowercase"]
57
- },
58
- ja_ngram_index_analyzer: {
59
- type: "custom",
60
- char_filter: ["normalize"],
61
- tokenizer: "ja_ngram_tokenizer",
62
- filter: ["lowercase"]
63
- },
64
- ja_ngram_search_analyzer: {
65
- type: "custom",
66
- char_filter: ["normalize"],
67
- tokenizer: "ja_ngram_tokenizer",
68
- filter: ["ja_search_synonym", "lowercase"]
69
- }
70
- },
71
- default: {
72
- type: "ja_kuromoji_index_analyzer"
73
- },
74
- default_search: {
75
- type: "ja_kuromoji_search_analyzer"
76
- }
77
- }
78
- }
79
- },
80
- mappings: {
81
- numeric_detection: true,
82
- dynamic_templates: (0, _common.getCommonMappings)(mappings => {
83
- return mappings.concat([{
84
- strings: {
85
- match_mapping_type: "string",
86
- mapping: {
87
- type: "text",
88
- search_analyzer: "ja_kuromoji_search_analyzer",
89
- analyzer: "ja_kuromoji_index_analyzer",
90
- fields: {
91
- ngram: {
92
- type: "text",
93
- search_analyzer: "ja_ngram_search_analyzer",
94
- analyzer: "ja_ngram_index_analyzer"
95
- },
96
- keyword: {
97
- ignore_above: 256,
98
- type: "keyword"
99
- }
100
- }
101
- }
102
- }
103
- }]);
104
- }),
105
- properties: {
106
- rawValues: {
107
- type: "object",
108
- enabled: false
109
- }
110
- }
111
- }
112
- };
113
- const getJapaneseConfiguration = modifier => {
114
- if (!modifier) {
115
- return config;
116
- }
117
- return modifier(config);
118
- };
119
- exports.getJapaneseConfiguration = getJapaneseConfiguration;
120
-
121
- //# sourceMappingURL=japanese.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_common","require","config","settings","index","analysis","char_filter","normalize","type","name","mode","tokenizer","ja_kuromoji_tokenizer","discard_compound_token","user_dictionary_rules","ja_ngram_tokenizer","min_gram","max_gram","token_chars","filter","ja_index_synonym","lenient","synonyms","ja_search_synonym","analyzer","ja_kuromoji_index_analyzer","ja_kuromoji_search_analyzer","ja_ngram_index_analyzer","ja_ngram_search_analyzer","default","default_search","mappings","numeric_detection","dynamic_templates","getCommonMappings","concat","strings","match_mapping_type","mapping","search_analyzer","fields","ngram","keyword","ignore_above","properties","rawValues","enabled","getJapaneseConfiguration","modifier","exports"],"sources":["japanese.ts"],"sourcesContent":["import type { ElasticsearchIndexRequestBody } from \"~/types\";\nimport { getCommonMappings } from \"./common\";\n\nconst config: ElasticsearchIndexRequestBody = {\n settings: {\n index: {\n analysis: {\n char_filter: {\n normalize: {\n type: \"icu_normalizer\",\n name: \"nfkc\",\n mode: \"compose\"\n }\n },\n tokenizer: {\n ja_kuromoji_tokenizer: {\n mode: \"search\",\n type: \"kuromoji_tokenizer\",\n discard_compound_token: \"true\",\n user_dictionary_rules: [\n \"東京スカイツリー,東京 スカイツリー,トウキョウ スカイツリー,カスタム名詞\"\n ]\n },\n ja_ngram_tokenizer: {\n type: \"ngram\",\n min_gram: \"2\",\n max_gram: \"2\",\n token_chars: [\"letter\", \"digit\"]\n }\n },\n filter: {\n ja_index_synonym: {\n type: \"synonym\",\n lenient: \"false\",\n synonyms: []\n },\n ja_search_synonym: {\n type: \"synonym_graph\",\n lenient: \"false\",\n synonyms: [\"米国, アメリカ\", \"東京大学, 東大\"]\n }\n },\n analyzer: {\n ja_kuromoji_index_analyzer: {\n type: \"custom\",\n char_filter: [\"normalize\"],\n tokenizer: \"ja_kuromoji_tokenizer\",\n filter: [\n \"kuromoji_baseform\",\n \"kuromoji_part_of_speech\",\n \"ja_index_synonym\",\n \"cjk_width\",\n \"ja_stop\",\n \"kuromoji_stemmer\",\n \"lowercase\"\n ]\n },\n ja_kuromoji_search_analyzer: {\n type: \"custom\",\n char_filter: [\"normalize\"],\n tokenizer: \"ja_kuromoji_tokenizer\",\n filter: [\n \"kuromoji_baseform\",\n \"kuromoji_part_of_speech\",\n \"ja_search_synonym\",\n \"cjk_width\",\n \"ja_stop\",\n \"kuromoji_stemmer\",\n \"lowercase\"\n ]\n },\n ja_ngram_index_analyzer: {\n type: \"custom\",\n char_filter: [\"normalize\"],\n tokenizer: \"ja_ngram_tokenizer\",\n filter: [\"lowercase\"]\n },\n ja_ngram_search_analyzer: {\n type: \"custom\",\n char_filter: [\"normalize\"],\n tokenizer: \"ja_ngram_tokenizer\",\n filter: [\"ja_search_synonym\", \"lowercase\"]\n }\n },\n default: {\n type: \"ja_kuromoji_index_analyzer\"\n },\n default_search: {\n type: \"ja_kuromoji_search_analyzer\"\n }\n }\n }\n },\n mappings: {\n numeric_detection: true,\n dynamic_templates: getCommonMappings(mappings => {\n return mappings.concat([\n {\n strings: {\n match_mapping_type: \"string\",\n mapping: {\n type: \"text\",\n search_analyzer: \"ja_kuromoji_search_analyzer\",\n analyzer: \"ja_kuromoji_index_analyzer\",\n fields: {\n ngram: {\n type: \"text\",\n search_analyzer: \"ja_ngram_search_analyzer\",\n analyzer: \"ja_ngram_index_analyzer\"\n },\n keyword: {\n ignore_above: 256,\n type: \"keyword\"\n }\n }\n }\n }\n }\n ]);\n }),\n properties: {\n rawValues: {\n type: \"object\",\n enabled: false\n }\n }\n }\n};\n\ninterface Modifier {\n (config: ElasticsearchIndexRequestBody): ElasticsearchIndexRequestBody;\n}\nexport const getJapaneseConfiguration = (modifier?: Modifier) => {\n if (!modifier) {\n return config;\n }\n return modifier(config);\n};\n"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AAEA,MAAMC,MAAqC,GAAG;EAC1CC,QAAQ,EAAE;IACNC,KAAK,EAAE;MACHC,QAAQ,EAAE;QACNC,WAAW,EAAE;UACTC,SAAS,EAAE;YACPC,IAAI,EAAE,gBAAgB;YACtBC,IAAI,EAAE,MAAM;YACZC,IAAI,EAAE;UACV;QACJ,CAAC;QACDC,SAAS,EAAE;UACPC,qBAAqB,EAAE;YACnBF,IAAI,EAAE,QAAQ;YACdF,IAAI,EAAE,oBAAoB;YAC1BK,sBAAsB,EAAE,MAAM;YAC9BC,qBAAqB,EAAE,CACnB,wCAAwC;UAEhD,CAAC;UACDC,k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CAAC;QACDU,OAAO,EAAE;UACLrB,IAAI,EAAE;QACV,CAAC;QACDsB,cAAc,EAAE;UACZtB,IAAI,EAAE;QACV;MACJ;IACJ;EACJ,CAAC;EACDuB,QAAQ,EAAE;IACNC,iBAAiB,EAAE,IAAI;IACvBC,iBAAiB,EAAE,IAAAC,yBAAiB,EAACH,QAAQ,IAAI;MAC7C,OAAOA,QAAQ,CAACI,MAAM,CAAC,CACnB;QACIC,OAAO,EAAE;UACLC,kBAAkB,EAAE,QAAQ;UAC5BC,OAAO,EAAE;YACL9B,IAAI,EAAE,MAAM;YACZ+B,eAAe,EAAE,6BAA6B;YAC9Cf,QAAQ,EAAE,4BAA4B;YACtCgB,MAAM,EAAE;cACJC,KAAK,EAAE;gBACHjC,IAAI,EAAE,MAAM;gBACZ+B,eAAe,EAAE,0BAA0B;gBAC3Cf,QAAQ,EAAE;cACd,CAAC;cACDkB,OAAO,EAAE;gBACLC,YAAY,EAAE,GAAG;gBACjBnC,IAAI,EAAE;cACV;YACJ;UACJ;QACJ;MACJ,CAAC,CACJ,CAAC;IACN,CAAC,CAAC;IACFoC,UAAU,EAAE;MACRC,SAAS,EAAE;QACPrC,IAAI,EAAE,QAAQ;QACdsC,OAAO,EAAE;MACb;IACJ;EACJ;AACJ,CAAC;AAKM,MAAMC,wBAAwB,GAAIC,QAAmB,IAAK;EAC7D,IAAI,CAACA,QAAQ,EAAE;IACX,OAAO9C,MAAM;EACjB;EACA,OAAO8C,QAAQ,CAAC9C,MAAM,CAAC;AAC3B,CAAC;AAAC+C,OAAA,CAAAF,wBAAA,GAAAA,wBAAA","ignoreList":[]}
@@ -1,8 +0,0 @@
1
- import { ElasticsearchQueryBuilderOperatorPlugin } from "../../definition/ElasticsearchQueryBuilderOperatorPlugin";
2
- import type { ElasticsearchBoolQueryConfig, ElasticsearchQueryBuilderArgsPlugin } from "../../../types";
3
- export declare class ElasticsearchQueryBuilderJapaneseOperatorContainsPlugin extends ElasticsearchQueryBuilderOperatorPlugin {
4
- name: string;
5
- isLocaleSupported(code: string): boolean;
6
- getOperator(): string;
7
- apply(query: ElasticsearchBoolQueryConfig, params: ElasticsearchQueryBuilderArgsPlugin): void;
8
- }
@@ -1,44 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ElasticsearchQueryBuilderJapaneseOperatorContainsPlugin = void 0;
7
- var _ElasticsearchQueryBuilderOperatorPlugin = require("../../definition/ElasticsearchQueryBuilderOperatorPlugin");
8
- var _normalize = require("../../../normalize");
9
- class ElasticsearchQueryBuilderJapaneseOperatorContainsPlugin extends _ElasticsearchQueryBuilderOperatorPlugin.ElasticsearchQueryBuilderOperatorPlugin {
10
- name = "elasticsearch.queryBuilder.operator.contains.japanese";
11
- isLocaleSupported(code) {
12
- if (!code) {
13
- return false;
14
- }
15
- return ["ja", "ja-jp"].includes(code.toLowerCase());
16
- }
17
- getOperator() {
18
- return "contains";
19
- }
20
- apply(query, params) {
21
- const {
22
- value: initialValue,
23
- basePath
24
- } = params;
25
- const value = (0, _normalize.normalizeValueWithAsterisk)(initialValue);
26
- query.must.push({
27
- multi_match: {
28
- query: value,
29
- type: "phrase",
30
- fields: [`${basePath}.ngram`]
31
- }
32
- });
33
- query.should.push({
34
- multi_match: {
35
- query: value,
36
- type: "phrase",
37
- fields: [`${basePath}`]
38
- }
39
- });
40
- }
41
- }
42
- exports.ElasticsearchQueryBuilderJapaneseOperatorContainsPlugin = ElasticsearchQueryBuilderJapaneseOperatorContainsPlugin;
43
-
44
- //# sourceMappingURL=contains.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_ElasticsearchQueryBuilderOperatorPlugin","require","_normalize","ElasticsearchQueryBuilderJapaneseOperatorContainsPlugin","ElasticsearchQueryBuilderOperatorPlugin","name","isLocaleSupported","code","includes","toLowerCase","getOperator","apply","query","params","value","initialValue","basePath","normalizeValueWithAsterisk","must","push","multi_match","type","fields","should","exports"],"sources":["contains.ts"],"sourcesContent":["import { ElasticsearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin\";\nimport { normalizeValueWithAsterisk } from \"~/normalize\";\nimport type { ElasticsearchBoolQueryConfig, ElasticsearchQueryBuilderArgsPlugin } from \"~/types\";\n\nexport class ElasticsearchQueryBuilderJapaneseOperatorContainsPlugin extends ElasticsearchQueryBuilderOperatorPlugin {\n public override name = \"elasticsearch.queryBuilder.operator.contains.japanese\";\n\n public override isLocaleSupported(code: string): boolean {\n if (!code) {\n return false;\n }\n return [\"ja\", \"ja-jp\"].includes(code.toLowerCase());\n }\n\n public getOperator(): string {\n return \"contains\";\n }\n\n public apply(\n query: ElasticsearchBoolQueryConfig,\n params: ElasticsearchQueryBuilderArgsPlugin\n ): void {\n const { value: initialValue, basePath } = params;\n\n const value = normalizeValueWithAsterisk(initialValue);\n query.must.push({\n multi_match: {\n query: value,\n type: \"phrase\",\n fields: [`${basePath}.ngram`]\n }\n });\n query.should.push({\n multi_match: {\n query: value,\n type: \"phrase\",\n fields: [`${basePath}`]\n }\n });\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,wCAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAGO,MAAME,uDAAuD,SAASC,gFAAuC,CAAC;EACjGC,IAAI,GAAG,uDAAuD;EAE9DC,iBAAiBA,CAACC,IAAY,EAAW;IACrD,IAAI,CAACA,IAAI,EAAE;MACP,OAAO,KAAK;IAChB;IACA,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAACC,QAAQ,CAACD,IAAI,CAACE,WAAW,CAAC,CAAC,CAAC;EACvD;EAEOC,WAAWA,CAAA,EAAW;IACzB,OAAO,UAAU;EACrB;EAEOC,KAAKA,CACRC,KAAmC,EACnCC,MAA2C,EACvC;IACJ,MAAM;MAAEC,KAAK,EAAEC,YAAY;MAAEC;IAAS,CAAC,GAAGH,MAAM;IAEhD,MAAMC,KAAK,GAAG,IAAAG,qCAA0B,EAACF,YAAY,CAAC;IACtDH,KAAK,CAACM,IAAI,CAACC,IAAI,CAAC;MACZC,WAAW,EAAE;QACTR,KAAK,EAAEE,KAAK;QACZO,IAAI,EAAE,QAAQ;QACdC,MAAM,EAAE,CAAC,GAAGN,QAAQ,QAAQ;MAChC;IACJ,CAAC,CAAC;IACFJ,KAAK,CAACW,MAAM,CAACJ,IAAI,CAAC;MACdC,WAAW,EAAE;QACTR,KAAK,EAAEE,KAAK;QACZO,IAAI,EAAE,QAAQ;QACdC,MAAM,EAAE,CAAC,GAAGN,QAAQ,EAAE;MAC1B;IACJ,CAAC,CAAC;EACN;AACJ;AAACQ,OAAA,CAAArB,uDAAA,GAAAA,uDAAA","ignoreList":[]}