@webiny/api-elasticsearch 0.0.0-mt-3 → 0.0.0-unstable.2af142b57e

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 (107) hide show
  1. package/client.js +20 -24
  2. package/client.js.map +1 -0
  3. package/compression.js +0 -17
  4. package/compression.js.map +1 -0
  5. package/cursors.d.ts +3 -2
  6. package/cursors.js +5 -11
  7. package/cursors.js.map +1 -0
  8. package/index.d.ts +14 -2
  9. package/index.js +146 -13
  10. package/index.js.map +1 -0
  11. package/indexConfiguration/base.d.ts +6 -0
  12. package/indexConfiguration/base.js +40 -0
  13. package/indexConfiguration/base.js.map +1 -0
  14. package/indexConfiguration/common.d.ts +9 -0
  15. package/indexConfiguration/common.js +41 -0
  16. package/indexConfiguration/common.js.map +1 -0
  17. package/indexConfiguration/index.d.ts +3 -0
  18. package/indexConfiguration/index.js +38 -0
  19. package/indexConfiguration/index.js.map +1 -0
  20. package/indexConfiguration/japanese.d.ts +6 -0
  21. package/indexConfiguration/japanese.js +119 -0
  22. package/indexConfiguration/japanese.js.map +1 -0
  23. package/indices.d.ts +9 -0
  24. package/indices.js +28 -0
  25. package/indices.js.map +1 -0
  26. package/limit.js +0 -8
  27. package/limit.js.map +1 -0
  28. package/normalize.js +11 -12
  29. package/normalize.js.map +1 -0
  30. package/operators.d.ts +5 -14
  31. package/operators.js +35 -32
  32. package/operators.js.map +1 -0
  33. package/package.json +14 -14
  34. package/plugins/GzipCompression.d.ts +5 -0
  35. package/plugins/GzipCompression.js +10 -17
  36. package/plugins/GzipCompression.js.map +1 -0
  37. package/plugins/definition/CompressionPlugin.d.ts +1 -1
  38. package/plugins/definition/CompressionPlugin.js +1 -6
  39. package/plugins/definition/CompressionPlugin.js.map +1 -0
  40. package/plugins/definition/ElasticsearchBodyModifierPlugin.js +1 -10
  41. package/plugins/definition/ElasticsearchBodyModifierPlugin.js.map +1 -0
  42. package/plugins/definition/ElasticsearchFieldPlugin.d.ts +8 -14
  43. package/plugins/definition/ElasticsearchFieldPlugin.js +24 -71
  44. package/plugins/definition/ElasticsearchFieldPlugin.js.map +1 -0
  45. package/plugins/definition/ElasticsearchIndexPlugin.d.ts +18 -0
  46. package/plugins/definition/ElasticsearchIndexPlugin.js +36 -0
  47. package/plugins/definition/ElasticsearchIndexPlugin.js.map +1 -0
  48. package/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin.d.ts +5 -1
  49. package/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin.js +10 -7
  50. package/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin.js.map +1 -0
  51. package/plugins/definition/ElasticsearchQueryModifierPlugin.js +1 -10
  52. package/plugins/definition/ElasticsearchQueryModifierPlugin.js.map +1 -0
  53. package/plugins/definition/ElasticsearchSortModifierPlugin.js +1 -10
  54. package/plugins/definition/ElasticsearchSortModifierPlugin.js.map +1 -0
  55. package/plugins/definition/index.d.ts +7 -0
  56. package/plugins/definition/index.js +82 -0
  57. package/plugins/definition/index.js.map +1 -0
  58. package/plugins/index.d.ts +2 -0
  59. package/plugins/index.js +27 -0
  60. package/plugins/index.js.map +1 -0
  61. package/plugins/operator/andIn.js +4 -15
  62. package/plugins/operator/andIn.js.map +1 -0
  63. package/plugins/operator/between.js +8 -17
  64. package/plugins/operator/between.js.map +1 -0
  65. package/plugins/operator/contains.js +2 -11
  66. package/plugins/operator/contains.js.map +1 -0
  67. package/plugins/operator/equal.js +29 -14
  68. package/plugins/operator/equal.js.map +1 -0
  69. package/plugins/operator/gt.js +2 -10
  70. package/plugins/operator/gt.js.map +1 -0
  71. package/plugins/operator/gte.js +2 -10
  72. package/plugins/operator/gte.js.map +1 -0
  73. package/plugins/operator/in.js +7 -22
  74. package/plugins/operator/in.js.map +1 -0
  75. package/plugins/operator/index.d.ts +3 -0
  76. package/plugins/operator/index.js +33 -26
  77. package/plugins/operator/index.js.map +1 -0
  78. package/plugins/operator/japanese/contains.d.ts +8 -0
  79. package/plugins/operator/japanese/contains.js +47 -0
  80. package/plugins/operator/japanese/contains.js.map +1 -0
  81. package/plugins/operator/lt.js +2 -10
  82. package/plugins/operator/lt.js.map +1 -0
  83. package/plugins/operator/lte.js +2 -10
  84. package/plugins/operator/lte.js.map +1 -0
  85. package/plugins/operator/not.js +21 -11
  86. package/plugins/operator/not.js.map +1 -0
  87. package/plugins/operator/notBetween.js +7 -16
  88. package/plugins/operator/notBetween.js.map +1 -0
  89. package/plugins/operator/notContains.js +2 -11
  90. package/plugins/operator/notContains.js.map +1 -0
  91. package/plugins/operator/notIn.js +4 -13
  92. package/plugins/operator/notIn.js.map +1 -0
  93. package/plugins/operator/notStartsWith.d.ts +7 -0
  94. package/plugins/operator/notStartsWith.js +30 -0
  95. package/plugins/operator/notStartsWith.js.map +1 -0
  96. package/plugins/operator/startsWith.d.ts +7 -0
  97. package/plugins/operator/startsWith.js +30 -0
  98. package/plugins/operator/startsWith.js.map +1 -0
  99. package/sort.d.ts +4 -3
  100. package/sort.js +10 -16
  101. package/sort.js.map +1 -0
  102. package/types.d.ts +163 -4
  103. package/types.js +11 -2
  104. package/types.js.map +1 -0
  105. package/where.d.ts +2 -2
  106. package/where.js +4 -24
  107. package/where.js.map +1 -0
@@ -15,7 +15,7 @@ export interface ToSearchValueParams {
15
15
  */
16
16
  basePath: string;
17
17
  }
18
- export interface Params {
18
+ export interface ElasticsearchFieldPluginParams {
19
19
  /**
20
20
  * Which field is this plugin for.
21
21
  */
@@ -51,19 +51,13 @@ export interface Params {
51
51
  export declare abstract class ElasticsearchFieldPlugin extends Plugin {
52
52
  static readonly type: string;
53
53
  static readonly ALL: string;
54
- private readonly _field;
55
- private readonly _path;
56
- private readonly _keyword;
57
- private readonly _unmappedType;
58
- private readonly _sortable;
59
- private readonly _searchable;
60
- get field(): string;
61
- get path(): string;
62
- get keyword(): boolean;
63
- get unmappedType(): string | undefined;
64
- get sortable(): boolean;
65
- get searchable(): boolean;
66
- constructor(params: Params);
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: ElasticsearchFieldPluginParams);
67
61
  /**
68
62
  * The default sort options. Extend in your own plugin if you want to add more options.
69
63
  */
@@ -1,128 +1,81 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.ElasticsearchFieldPlugin = void 0;
9
-
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
10
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
10
  var _plugins = require("@webiny/plugins");
13
-
14
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
15
-
16
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
17
-
18
11
  const keywordLessUnmappedType = ["date", "long"];
19
-
20
12
  const unmappedTypeHasKeyword = type => {
21
- if (keywordLessUnmappedType.includes(type)) {
13
+ if (!type) {
14
+ return true;
15
+ } else if (keywordLessUnmappedType.includes(type)) {
22
16
  return false;
23
17
  }
24
-
25
18
  return true;
26
19
  };
27
-
28
20
  class ElasticsearchFieldPlugin extends _plugins.Plugin {
29
- get field() {
30
- return this._field;
31
- }
32
-
33
- get path() {
34
- return this._path;
35
- }
36
-
37
- get keyword() {
38
- return this._keyword;
39
- }
40
-
41
- get unmappedType() {
42
- return this._unmappedType;
43
- }
44
-
45
- get sortable() {
46
- return this._sortable;
47
- }
48
-
49
- get searchable() {
50
- return this._searchable;
51
- }
52
-
53
21
  constructor(params) {
54
22
  super();
55
- (0, _defineProperty2.default)(this, "_field", void 0);
56
- (0, _defineProperty2.default)(this, "_path", void 0);
57
- (0, _defineProperty2.default)(this, "_keyword", void 0);
58
- (0, _defineProperty2.default)(this, "_unmappedType", void 0);
59
- (0, _defineProperty2.default)(this, "_sortable", void 0);
60
- (0, _defineProperty2.default)(this, "_searchable", void 0);
61
- this._field = params.field;
62
- this._path = params.path || params.field;
63
- this._keyword = params.keyword === undefined ? true : params.keyword;
64
- this._unmappedType = params.unmappedType;
65
-
23
+ (0, _defineProperty2.default)(this, "field", void 0);
24
+ (0, _defineProperty2.default)(this, "path", void 0);
25
+ (0, _defineProperty2.default)(this, "keyword", void 0);
26
+ (0, _defineProperty2.default)(this, "unmappedType", void 0);
27
+ (0, _defineProperty2.default)(this, "sortable", void 0);
28
+ (0, _defineProperty2.default)(this, "searchable", void 0);
29
+ this.field = params.field;
30
+ this.path = params.path || params.field;
31
+ this.keyword = params.keyword === undefined ? true : params.keyword;
32
+ this.unmappedType = params.unmappedType;
66
33
  if (unmappedTypeHasKeyword(params.unmappedType) === false) {
67
- this._keyword = false;
34
+ this.keyword = false;
68
35
  }
69
-
70
- this._sortable = params.sortable === undefined ? true : params.sortable;
71
- this._searchable = params.searchable === undefined ? true : params.searchable;
36
+ this.sortable = params.sortable === undefined ? true : params.sortable;
37
+ this.searchable = params.searchable === undefined ? true : params.searchable;
72
38
  }
73
39
  /**
74
40
  * The default sort options. Extend in your own plugin if you want to add more options.
75
41
  */
76
-
77
-
78
42
  getSortOptions(order) {
79
43
  const options = {
80
44
  order
81
45
  };
82
-
83
- if (!this._unmappedType) {
46
+ if (!this.unmappedType) {
84
47
  return options;
85
48
  }
86
-
87
- return _objectSpread(_objectSpread({}, options), {}, {
88
- unmapped_type: this._unmappedType
49
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, options), {}, {
50
+ unmapped_type: this.unmappedType
89
51
  });
90
52
  }
91
53
  /**
92
54
  * The default path generator. Extend in your own plugin if you want to add more options.
93
55
  * 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.
94
56
  */
95
-
96
-
97
57
  getPath(field) {
98
- return `${this.getBasePath(field)}${this._keyword ? ".keyword" : ""}`;
58
+ return `${this.getBasePath(field)}${this.keyword ? ".keyword" : ""}`;
99
59
  }
100
60
  /**
101
61
  * @see getPath
102
62
  *
103
63
  * This is the default base path generator. Basically it replaces ALL with given field name.
104
64
  */
105
-
106
-
107
65
  getBasePath(field) {
108
- if (this._path === this.constructor.ALL) {
66
+ if (this.path === ElasticsearchFieldPlugin.ALL) {
109
67
  return field;
110
68
  }
111
-
112
- return this._path;
69
+ return this.path;
113
70
  }
114
71
  /**
115
72
  * The default transformer. Just returns the value by default.
116
73
  * Override to implement what ever is required.
117
74
  */
118
-
119
-
120
75
  toSearchValue(params) {
121
76
  return params.value;
122
77
  }
123
-
124
78
  }
125
-
126
79
  exports.ElasticsearchFieldPlugin = ElasticsearchFieldPlugin;
127
80
  (0, _defineProperty2.default)(ElasticsearchFieldPlugin, "type", "elasticsearch.fieldDefinition");
128
81
  (0, _defineProperty2.default)(ElasticsearchFieldPlugin, "ALL", "*");
@@ -0,0 +1 @@
1
+ {"version":3,"names":["keywordLessUnmappedType","unmappedTypeHasKeyword","type","includes","ElasticsearchFieldPlugin","Plugin","constructor","params","field","path","keyword","undefined","unmappedType","sortable","searchable","getSortOptions","order","options","unmapped_type","getPath","getBasePath","ALL","toSearchValue","value"],"sources":["ElasticsearchFieldPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { FieldSortOptions, SortOrder } from \"elastic-ts\";\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 ElasticsearchFieldPluginParams {\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 abstract class ElasticsearchFieldPlugin extends Plugin {\n public static override readonly type: string = \"elasticsearch.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: ElasticsearchFieldPluginParams) {\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 unmapped_type: this.unmappedType\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 === ElasticsearchFieldPlugin.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;AAKA,MAAMA,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;AAkDM,MAAeE,wBAAwB,SAASC,eAAM,CAAC;EAW1DC,WAAW,CAACC,MAAsC,EAAE;IAChD,KAAK,EAAE;IAAC;IAAA;IAAA;IAAA;IAAA;IAAA;IACR,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,cAAc,CAACC,KAAgB,EAAoB;IACtD,MAAMC,OAAO,GAAG;MACZD;IACJ,CAAC;IACD,IAAI,CAAC,IAAI,CAACJ,YAAY,EAAE;MACpB,OAAOK,OAAO;IAClB;IACA,mEACOA,OAAO;MACVC,aAAa,EAAE,IAAI,CAACN;IAAY;EAExC;EACA;AACJ;AACA;AACA;EACWO,OAAO,CAACX,KAAa,EAAU;IAClC,OAAQ,GAAE,IAAI,CAACY,WAAW,CAACZ,KAAK,CAAE,GAAE,IAAI,CAACE,OAAO,GAAG,UAAU,GAAG,EAAG,EAAC;EACxE;EACA;AACJ;AACA;AACA;AACA;EACWU,WAAW,CAACZ,KAAa,EAAU;IACtC,IAAI,IAAI,CAACC,IAAI,KAAKL,wBAAwB,CAACiB,GAAG,EAAE;MAC5C,OAAOb,KAAK;IAChB;IACA,OAAO,IAAI,CAACC,IAAI;EACpB;EACA;AACJ;AACA;AACA;EACWa,aAAa,CAACf,MAA2B,EAAO;IACnD,OAAOA,MAAM,CAACgB,KAAK;EACvB;AACJ;AAAC;AAAA,8BA/DqBnB,wBAAwB,UACK,+BAA+B;AAAA,8BAD5DA,wBAAwB,SAEL,GAAG"}
@@ -0,0 +1,18 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ import { ElasticsearchIndexRequestBody } from "../../types";
3
+ export interface ElasticsearchIndexPluginParams {
4
+ /**
5
+ * For which locales are we applying this plugin.
6
+ * Options:
7
+ * - locale codes to target specific locale
8
+ * - null for all
9
+ */
10
+ locales?: string[];
11
+ body: ElasticsearchIndexRequestBody;
12
+ }
13
+ export declare abstract class ElasticsearchIndexPlugin extends Plugin {
14
+ readonly body: ElasticsearchIndexRequestBody;
15
+ private readonly locales;
16
+ constructor(params: ElasticsearchIndexPluginParams);
17
+ canUse(locale: string): boolean;
18
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.ElasticsearchIndexPlugin = void 0;
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
+ var _error = _interopRequireDefault(require("@webiny/error"));
11
+ var _plugins = require("@webiny/plugins");
12
+ class ElasticsearchIndexPlugin extends _plugins.Plugin {
13
+ constructor(params) {
14
+ super();
15
+ (0, _defineProperty2.default)(this, "body", void 0);
16
+ (0, _defineProperty2.default)(this, "locales", void 0);
17
+ const {
18
+ locales,
19
+ body
20
+ } = params;
21
+ this.body = (0, _objectSpread2.default)({}, body);
22
+ this.locales = locales ? locales.map(locale => locale.toLowerCase()) : undefined;
23
+ }
24
+ canUse(locale) {
25
+ if (!this.locales) {
26
+ return true;
27
+ } else if (this.locales.length === 0) {
28
+ throw new _error.default("Cannot have Elasticsearch Index Template plugin with no locales defined.", "LOCALES_ERROR", {
29
+ body: this.body,
30
+ locales: this.locales
31
+ });
32
+ }
33
+ return this.locales.includes(locale.toLowerCase());
34
+ }
35
+ }
36
+ exports.ElasticsearchIndexPlugin = ElasticsearchIndexPlugin;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ElasticsearchIndexPlugin","Plugin","constructor","params","locales","body","map","locale","toLowerCase","undefined","canUse","length","WebinyError","includes"],"sources":["ElasticsearchIndexPlugin.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { Plugin } from \"@webiny/plugins\";\nimport { ElasticsearchIndexRequestBody } from \"~/types\";\n\nexport interface ElasticsearchIndexPluginParams {\n /**\n * For which locales are we applying this plugin.\n * Options:\n * - locale codes to target specific locale\n * - null for all\n */\n locales?: string[];\n body: ElasticsearchIndexRequestBody;\n}\n\nexport abstract class ElasticsearchIndexPlugin extends Plugin {\n public readonly body: ElasticsearchIndexRequestBody;\n private readonly locales: string[] | undefined;\n\n public constructor(params: ElasticsearchIndexPluginParams) {\n super();\n const { locales, body } = params;\n this.body = {\n ...body\n };\n this.locales = locales ? locales.map(locale => locale.toLowerCase()) : undefined;\n }\n\n public canUse(locale: string): boolean {\n if (!this.locales) {\n return true;\n } else if (this.locales.length === 0) {\n throw new WebinyError(\n \"Cannot have Elasticsearch Index Template plugin with no locales defined.\",\n \"LOCALES_ERROR\",\n {\n body: this.body,\n locales: this.locales\n }\n );\n }\n return this.locales.includes(locale.toLowerCase());\n }\n}\n"],"mappings":";;;;;;;;;AAAA;AACA;AAcO,MAAeA,wBAAwB,SAASC,eAAM,CAAC;EAInDC,WAAW,CAACC,MAAsC,EAAE;IACvD,KAAK,EAAE;IAAC;IAAA;IACR,MAAM;MAAEC,OAAO;MAAEC;IAAK,CAAC,GAAGF,MAAM;IAChC,IAAI,CAACE,IAAI,mCACFA,IAAI,CACV;IACD,IAAI,CAACD,OAAO,GAAGA,OAAO,GAAGA,OAAO,CAACE,GAAG,CAACC,MAAM,IAAIA,MAAM,CAACC,WAAW,EAAE,CAAC,GAAGC,SAAS;EACpF;EAEOC,MAAM,CAACH,MAAc,EAAW;IACnC,IAAI,CAAC,IAAI,CAACH,OAAO,EAAE;MACf,OAAO,IAAI;IACf,CAAC,MAAM,IAAI,IAAI,CAACA,OAAO,CAACO,MAAM,KAAK,CAAC,EAAE;MAClC,MAAM,IAAIC,cAAW,CACjB,0EAA0E,EAC1E,eAAe,EACf;QACIP,IAAI,EAAE,IAAI,CAACA,IAAI;QACfD,OAAO,EAAE,IAAI,CAACA;MAClB,CAAC,CACJ;IACL;IACA,OAAO,IAAI,CAACA,OAAO,CAACS,QAAQ,CAACN,MAAM,CAACC,WAAW,EAAE,CAAC;EACtD;AACJ;AAAC"}
@@ -4,7 +4,11 @@ import { ElasticsearchBoolQueryConfig, ElasticsearchQueryBuilderArgsPlugin } fro
4
4
  * Built-in operators name ends with .default because user can override the operator, just write a name without the .default keyword.
5
5
  */
6
6
  export declare abstract class ElasticsearchQueryBuilderOperatorPlugin extends Plugin {
7
- static readonly type = "elasticsearch.queryBuilder.operator";
7
+ static readonly type: string;
8
+ /**
9
+ * Check if current locale is supported by this plugin.
10
+ */
11
+ isLocaleSupported(_: string): boolean;
8
12
  abstract getOperator(): string;
9
13
  abstract apply(query: ElasticsearchBoolQueryConfig, params: ElasticsearchQueryBuilderArgsPlugin): void;
10
14
  }
@@ -1,20 +1,23 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.ElasticsearchQueryBuilderOperatorPlugin = void 0;
9
-
10
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
9
  var _plugins = require("@webiny/plugins");
13
-
14
10
  /**
15
11
  * Built-in operators name ends with .default because user can override the operator, just write a name without the .default keyword.
16
12
  */
17
- class ElasticsearchQueryBuilderOperatorPlugin extends _plugins.Plugin {}
18
-
13
+ class ElasticsearchQueryBuilderOperatorPlugin extends _plugins.Plugin {
14
+ /**
15
+ * Check if current locale is supported by this plugin.
16
+ */
17
+ // eslint-disable-next-line
18
+ isLocaleSupported(_) {
19
+ return true;
20
+ }
21
+ }
19
22
  exports.ElasticsearchQueryBuilderOperatorPlugin = ElasticsearchQueryBuilderOperatorPlugin;
20
23
  (0, _defineProperty2.default)(ElasticsearchQueryBuilderOperatorPlugin, "type", "elasticsearch.queryBuilder.operator");
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ElasticsearchQueryBuilderOperatorPlugin","Plugin","isLocaleSupported","_"],"sources":["ElasticsearchQueryBuilderOperatorPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { ElasticsearchBoolQueryConfig, ElasticsearchQueryBuilderArgsPlugin } from \"~/types\";\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 ElasticsearchQueryBuilderOperatorPlugin extends Plugin {\n public static override readonly type: string = \"elasticsearch.queryBuilder.operator\";\n\n /**\n * Check if current locale is supported by this plugin.\n */\n // eslint-disable-next-line\n public isLocaleSupported(_: string): boolean {\n return true;\n }\n\n public abstract getOperator(): string;\n\n public abstract apply(\n query: ElasticsearchBoolQueryConfig,\n params: ElasticsearchQueryBuilderArgsPlugin\n ): void;\n}\n"],"mappings":";;;;;;;;AAAA;AAGA;AACA;AACA;AACO,MAAeA,uCAAuC,SAASC,eAAM,CAAC;EAGzE;AACJ;AACA;EACI;EACOC,iBAAiB,CAACC,CAAS,EAAW;IACzC,OAAO,IAAI;EACf;AAQJ;AAAC;AAAA,8BAjBqBH,uCAAuC,UACV,qCAAqC"}
@@ -1,35 +1,26 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.ElasticsearchQueryModifierPlugin = void 0;
9
-
10
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
9
  var _error = _interopRequireDefault(require("@webiny/error"));
13
-
14
10
  var _plugins = require("@webiny/plugins");
15
-
16
11
  class ElasticsearchQueryModifierPlugin extends _plugins.Plugin {
17
12
  constructor(callable) {
18
13
  super();
19
14
  (0, _defineProperty2.default)(this, "callable", void 0);
20
15
  this.callable = callable;
21
16
  }
22
-
23
17
  modifyQuery(params) {
24
18
  if (typeof this.callable !== "function") {
25
19
  throw new _error.default(`Missing modification for the query.`, "QUERY_MODIFICATION_MISSING", {
26
20
  params
27
21
  });
28
22
  }
29
-
30
23
  this.callable(params);
31
24
  }
32
-
33
25
  }
34
-
35
26
  exports.ElasticsearchQueryModifierPlugin = ElasticsearchQueryModifierPlugin;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ElasticsearchQueryModifierPlugin","Plugin","constructor","callable","modifyQuery","params","WebinyError"],"sources":["ElasticsearchQueryModifierPlugin.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { Plugin } from \"@webiny/plugins\";\nimport { ElasticsearchBoolQueryConfig } from \"~/types\";\n\nexport interface ModifyQueryParams {\n query: ElasticsearchBoolQueryConfig;\n where: Record<string, any>;\n}\n\nexport interface ModifyQueryCallable<T extends ModifyQueryParams> {\n (params: T): void;\n}\n\nexport abstract class ElasticsearchQueryModifierPlugin<\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;AACA;AAYO,MAAeA,gCAAgC,SAE5CC,eAAM,CAAC;EAGNC,WAAW,CAACC,QAAiC,EAAE;IAClD,KAAK,EAAE;IAAC;IACR,IAAI,CAACA,QAAQ,GAAGA,QAAQ;EAC5B;EAEOC,WAAW,CAACC,MAAS,EAAQ;IAChC,IAAI,OAAO,IAAI,CAACF,QAAQ,KAAK,UAAU,EAAE;MACrC,MAAM,IAAIG,cAAW,CAChB,qCAAoC,EACrC,4BAA4B,EAC5B;QACID;MACJ,CAAC,CACJ;IACL;IACA,IAAI,CAACF,QAAQ,CAACE,MAAM,CAAC;EACzB;AACJ;AAAC"}
@@ -1,35 +1,26 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.ElasticsearchSortModifierPlugin = void 0;
9
-
10
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
9
  var _error = _interopRequireDefault(require("@webiny/error"));
13
-
14
10
  var _plugins = require("@webiny/plugins");
15
-
16
11
  class ElasticsearchSortModifierPlugin extends _plugins.Plugin {
17
12
  constructor(callable) {
18
13
  super();
19
14
  (0, _defineProperty2.default)(this, "callable", void 0);
20
15
  this.callable = callable;
21
16
  }
22
-
23
17
  modifySort(params) {
24
18
  if (typeof this.callable !== "function") {
25
19
  throw new _error.default(`Missing modification for the sort.`, "SORT_MODIFICATION_MISSING", {
26
20
  params
27
21
  });
28
22
  }
29
-
30
23
  this.callable(params);
31
24
  }
32
-
33
25
  }
34
-
35
26
  exports.ElasticsearchSortModifierPlugin = ElasticsearchSortModifierPlugin;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ElasticsearchSortModifierPlugin","Plugin","constructor","callable","modifySort","params","WebinyError"],"sources":["ElasticsearchSortModifierPlugin.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { Plugin } from \"@webiny/plugins\";\nimport { Sort } from \"elastic-ts\";\n\nexport interface ModifySortParams {\n sort: Sort;\n}\n\nexport interface ModifySortCallable<T extends ModifySortParams> {\n (params: T): void;\n}\n\nexport abstract class ElasticsearchSortModifierPlugin<\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;AACA;AAWO,MAAeA,+BAA+B,SAE3CC,eAAM,CAAC;EAGNC,WAAW,CAACC,QAAgC,EAAE;IACjD,KAAK,EAAE;IAAC;IACR,IAAI,CAACA,QAAQ,GAAGA,QAAQ;EAC5B;EAEOC,UAAU,CAACC,MAAS,EAAQ;IAC/B,IAAI,OAAO,IAAI,CAACF,QAAQ,KAAK,UAAU,EAAE;MACrC,MAAM,IAAIG,cAAW,CAChB,oCAAmC,EACpC,2BAA2B,EAC3B;QACID;MACJ,CAAC,CACJ;IACL;IACA,IAAI,CAACF,QAAQ,CAACE,MAAM,CAAC;EACzB;AACJ;AAAC"}
@@ -0,0 +1,7 @@
1
+ export * from "./CompressionPlugin";
2
+ export * from "./ElasticsearchBodyModifierPlugin";
3
+ export * from "./ElasticsearchFieldPlugin";
4
+ export * from "./ElasticsearchIndexPlugin";
5
+ export * from "./ElasticsearchQueryBuilderOperatorPlugin";
6
+ export * from "./ElasticsearchQueryModifierPlugin";
7
+ export * from "./ElasticsearchSortModifierPlugin";
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _CompressionPlugin = require("./CompressionPlugin");
7
+ Object.keys(_CompressionPlugin).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _CompressionPlugin[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _CompressionPlugin[key];
14
+ }
15
+ });
16
+ });
17
+ var _ElasticsearchBodyModifierPlugin = require("./ElasticsearchBodyModifierPlugin");
18
+ Object.keys(_ElasticsearchBodyModifierPlugin).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _ElasticsearchBodyModifierPlugin[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _ElasticsearchBodyModifierPlugin[key];
25
+ }
26
+ });
27
+ });
28
+ var _ElasticsearchFieldPlugin = require("./ElasticsearchFieldPlugin");
29
+ Object.keys(_ElasticsearchFieldPlugin).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _ElasticsearchFieldPlugin[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _ElasticsearchFieldPlugin[key];
36
+ }
37
+ });
38
+ });
39
+ var _ElasticsearchIndexPlugin = require("./ElasticsearchIndexPlugin");
40
+ Object.keys(_ElasticsearchIndexPlugin).forEach(function (key) {
41
+ if (key === "default" || key === "__esModule") return;
42
+ if (key in exports && exports[key] === _ElasticsearchIndexPlugin[key]) return;
43
+ Object.defineProperty(exports, key, {
44
+ enumerable: true,
45
+ get: function () {
46
+ return _ElasticsearchIndexPlugin[key];
47
+ }
48
+ });
49
+ });
50
+ var _ElasticsearchQueryBuilderOperatorPlugin = require("./ElasticsearchQueryBuilderOperatorPlugin");
51
+ Object.keys(_ElasticsearchQueryBuilderOperatorPlugin).forEach(function (key) {
52
+ if (key === "default" || key === "__esModule") return;
53
+ if (key in exports && exports[key] === _ElasticsearchQueryBuilderOperatorPlugin[key]) return;
54
+ Object.defineProperty(exports, key, {
55
+ enumerable: true,
56
+ get: function () {
57
+ return _ElasticsearchQueryBuilderOperatorPlugin[key];
58
+ }
59
+ });
60
+ });
61
+ var _ElasticsearchQueryModifierPlugin = require("./ElasticsearchQueryModifierPlugin");
62
+ Object.keys(_ElasticsearchQueryModifierPlugin).forEach(function (key) {
63
+ if (key === "default" || key === "__esModule") return;
64
+ if (key in exports && exports[key] === _ElasticsearchQueryModifierPlugin[key]) return;
65
+ Object.defineProperty(exports, key, {
66
+ enumerable: true,
67
+ get: function () {
68
+ return _ElasticsearchQueryModifierPlugin[key];
69
+ }
70
+ });
71
+ });
72
+ var _ElasticsearchSortModifierPlugin = require("./ElasticsearchSortModifierPlugin");
73
+ Object.keys(_ElasticsearchSortModifierPlugin).forEach(function (key) {
74
+ if (key === "default" || key === "__esModule") return;
75
+ if (key in exports && exports[key] === _ElasticsearchSortModifierPlugin[key]) return;
76
+ Object.defineProperty(exports, key, {
77
+ enumerable: true,
78
+ get: function () {
79
+ return _ElasticsearchSortModifierPlugin[key];
80
+ }
81
+ });
82
+ });
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./CompressionPlugin\";\nexport * from \"./ElasticsearchBodyModifierPlugin\";\nexport * from \"./ElasticsearchFieldPlugin\";\nexport * from \"./ElasticsearchIndexPlugin\";\nexport * from \"./ElasticsearchQueryBuilderOperatorPlugin\";\nexport * from \"./ElasticsearchQueryModifierPlugin\";\nexport * from \"./ElasticsearchSortModifierPlugin\";\n"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
@@ -0,0 +1,2 @@
1
+ export * from "./operator";
2
+ export * from "./definition";
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _operator = require("./operator");
7
+ Object.keys(_operator).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _operator[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _operator[key];
14
+ }
15
+ });
16
+ });
17
+ var _definition = require("./definition");
18
+ Object.keys(_definition).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _definition[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _definition[key];
25
+ }
26
+ });
27
+ });
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./operator\";\nexport * from \"./definition\";\n"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
@@ -1,26 +1,20 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.ElasticsearchQueryBuilderOperatorAndInPlugin = void 0;
9
-
10
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
9
  var _ElasticsearchQueryBuilderOperatorPlugin = require("../definition/ElasticsearchQueryBuilderOperatorPlugin");
13
-
14
10
  class ElasticsearchQueryBuilderOperatorAndInPlugin extends _ElasticsearchQueryBuilderOperatorPlugin.ElasticsearchQueryBuilderOperatorPlugin {
15
11
  constructor(...args) {
16
12
  super(...args);
17
13
  (0, _defineProperty2.default)(this, "name", "elasticsearch.queryBuilder.operator.andIn.default");
18
14
  }
19
-
20
15
  getOperator() {
21
16
  return "and_in";
22
17
  }
23
-
24
18
  apply(query, params) {
25
19
  const {
26
20
  value: values,
@@ -28,29 +22,24 @@ class ElasticsearchQueryBuilderOperatorAndInPlugin extends _ElasticsearchQueryBu
28
22
  basePath
29
23
  } = params;
30
24
  const isArray = Array.isArray(values);
31
-
32
25
  if (isArray === false || values.length === 0) {
33
26
  throw new Error(`You cannot filter field "${path}" with "in" operator and not send an array of values.`);
34
27
  }
35
-
36
- let useBasePath = false; // Only use ".keyword" if all of the provided values are strings.
37
-
28
+ let useBasePath = false;
29
+ // Only use ".keyword" if all of the provided values are strings.
38
30
  for (const value of values) {
39
31
  if (typeof value !== "string") {
40
32
  useBasePath = true;
41
33
  break;
42
34
  }
43
35
  }
44
-
45
36
  for (const value of values) {
46
- query.must.push({
37
+ query.filter.push({
47
38
  term: {
48
39
  [useBasePath ? basePath : path]: value
49
40
  }
50
41
  });
51
42
  }
52
43
  }
53
-
54
44
  }
55
-
56
45
  exports.ElasticsearchQueryBuilderOperatorAndInPlugin = ElasticsearchQueryBuilderOperatorAndInPlugin;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ElasticsearchQueryBuilderOperatorAndInPlugin","ElasticsearchQueryBuilderOperatorPlugin","getOperator","apply","query","params","value","values","path","basePath","isArray","Array","length","Error","useBasePath","filter","push","term"],"sources":["andIn.ts"],"sourcesContent":["import { ElasticsearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin\";\nimport { ElasticsearchBoolQueryConfig, ElasticsearchQueryBuilderArgsPlugin } from \"~/types\";\n\nexport class ElasticsearchQueryBuilderOperatorAndInPlugin extends ElasticsearchQueryBuilderOperatorPlugin {\n public override name = \"elasticsearch.queryBuilder.operator.andIn.default\";\n\n public getOperator(): string {\n return \"and_in\";\n }\n\n public apply(\n query: ElasticsearchBoolQueryConfig,\n params: ElasticsearchQueryBuilderArgsPlugin\n ): 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;AAGO,MAAMA,4CAA4C,SAASC,gFAAuC,CAAC;EAAA;IAAA;IAAA,4CAC/E,mDAAmD;EAAA;EAEnEC,WAAW,GAAW;IACzB,OAAO,QAAQ;EACnB;EAEOC,KAAK,CACRC,KAAmC,EACnCC,MAA2C,EACvC;IACJ,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,CACV,4BAA2BL,IAAK,uDAAsD,CAC1F;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;AAAC"}