@webiny/api-headless-cms-ddb-es 6.0.0-beta.0 → 6.0.0-rc.1

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 (285) hide show
  1. package/README.md +6 -30
  2. package/configurations.d.ts +4 -5
  3. package/configurations.js +12 -24
  4. package/configurations.js.map +1 -1
  5. package/definitions/entry.d.ts +4 -5
  6. package/definitions/entry.js +5 -174
  7. package/definitions/entry.js.map +1 -1
  8. package/definitions/group.d.ts +6 -6
  9. package/definitions/group.js +5 -58
  10. package/definitions/group.js.map +1 -1
  11. package/definitions/model.d.ts +6 -6
  12. package/definitions/model.js +5 -102
  13. package/definitions/model.js.map +1 -1
  14. package/definitions/types.d.ts +59 -0
  15. package/definitions/types.js +3 -0
  16. package/definitions/types.js.map +1 -0
  17. package/dynamoDb/index.d.ts +2 -2
  18. package/dynamoDb/index.js +5 -14
  19. package/dynamoDb/index.js.map +1 -1
  20. package/dynamoDb/storage/longText.js +11 -18
  21. package/dynamoDb/storage/longText.js.map +1 -1
  22. package/dynamoDb/storage/richText.d.ts +0 -5
  23. package/dynamoDb/storage/richText.js +25 -80
  24. package/dynamoDb/storage/richText.js.map +1 -1
  25. package/elasticsearch/createElasticsearchIndex.d.ts +3 -3
  26. package/elasticsearch/createElasticsearchIndex.js +7 -15
  27. package/elasticsearch/createElasticsearchIndex.js.map +1 -1
  28. package/elasticsearch/deleteElasticsearchIndex.d.ts +2 -2
  29. package/elasticsearch/deleteElasticsearchIndex.js +3 -10
  30. package/elasticsearch/deleteElasticsearchIndex.js.map +1 -1
  31. package/elasticsearch/index.d.ts +1 -1
  32. package/elasticsearch/index.js +3 -11
  33. package/elasticsearch/index.js.map +1 -1
  34. package/elasticsearch/indexing/dateTimeIndexing.d.ts +1 -1
  35. package/elasticsearch/indexing/dateTimeIndexing.js +1 -8
  36. package/elasticsearch/indexing/dateTimeIndexing.js.map +1 -1
  37. package/elasticsearch/indexing/defaultFieldIndexing.d.ts +1 -1
  38. package/elasticsearch/indexing/defaultFieldIndexing.js +1 -8
  39. package/elasticsearch/indexing/defaultFieldIndexing.js.map +1 -1
  40. package/elasticsearch/indexing/index.d.ts +1 -1
  41. package/elasticsearch/indexing/index.js +8 -16
  42. package/elasticsearch/indexing/index.js.map +1 -1
  43. package/elasticsearch/indexing/jsonIndexing.d.ts +1 -1
  44. package/elasticsearch/indexing/jsonIndexing.js +1 -8
  45. package/elasticsearch/indexing/jsonIndexing.js.map +1 -1
  46. package/elasticsearch/indexing/longTextIndexing.d.ts +1 -1
  47. package/elasticsearch/indexing/longTextIndexing.js +1 -8
  48. package/elasticsearch/indexing/longTextIndexing.js.map +1 -1
  49. package/elasticsearch/indexing/numberIndexing.d.ts +1 -1
  50. package/elasticsearch/indexing/numberIndexing.js +1 -8
  51. package/elasticsearch/indexing/numberIndexing.js.map +1 -1
  52. package/elasticsearch/indexing/objectIndexing.d.ts +1 -1
  53. package/elasticsearch/indexing/objectIndexing.js +6 -13
  54. package/elasticsearch/indexing/objectIndexing.js.map +1 -1
  55. package/elasticsearch/indexing/richTextIndexing.d.ts +1 -1
  56. package/elasticsearch/indexing/richTextIndexing.js +1 -8
  57. package/elasticsearch/indexing/richTextIndexing.js.map +1 -1
  58. package/elasticsearch/indices/base.d.ts +1 -1
  59. package/elasticsearch/indices/base.js +4 -10
  60. package/elasticsearch/indices/base.js.map +1 -1
  61. package/elasticsearch/indices/index.d.ts +1 -1
  62. package/elasticsearch/indices/index.js +3 -11
  63. package/elasticsearch/indices/index.js.map +1 -1
  64. package/elasticsearch/search/index.d.ts +1 -1
  65. package/elasticsearch/search/index.js +4 -10
  66. package/elasticsearch/search/index.js.map +1 -1
  67. package/elasticsearch/search/refSearch.d.ts +1 -1
  68. package/elasticsearch/search/refSearch.js +3 -10
  69. package/elasticsearch/search/refSearch.js.map +1 -1
  70. package/elasticsearch/search/searchableJson.d.ts +2 -0
  71. package/elasticsearch/search/searchableJson.js +53 -0
  72. package/elasticsearch/search/searchableJson.js.map +1 -0
  73. package/elasticsearch/search/timeSearch.d.ts +1 -1
  74. package/elasticsearch/search/timeSearch.js +3 -10
  75. package/elasticsearch/search/timeSearch.js.map +1 -1
  76. package/helpers/entryIndexHelpers.d.ts +10 -10
  77. package/helpers/entryIndexHelpers.js +32 -26
  78. package/helpers/entryIndexHelpers.js.map +1 -1
  79. package/helpers/fieldIdentifier.d.ts +1 -1
  80. package/helpers/fieldIdentifier.js +2 -10
  81. package/helpers/fieldIdentifier.js.map +1 -1
  82. package/helpers/index.d.ts +2 -2
  83. package/helpers/index.js +2 -27
  84. package/helpers/index.js.map +1 -1
  85. package/index.d.ts +2 -2
  86. package/index.js +108 -134
  87. package/index.js.map +1 -1
  88. package/operations/entry/dataLoader/DataLoaderCache.d.ts +1 -3
  89. package/operations/entry/dataLoader/DataLoaderCache.js +2 -9
  90. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
  91. package/operations/entry/dataLoader/constants.js +1 -7
  92. package/operations/entry/dataLoader/constants.js.map +1 -1
  93. package/operations/entry/dataLoader/createBatchScheduleFn.js +4 -10
  94. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
  95. package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +3 -3
  96. package/operations/entry/dataLoader/getAllEntryRevisions.js +11 -24
  97. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
  98. package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +3 -3
  99. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +18 -30
  100. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
  101. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +3 -3
  102. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +18 -30
  103. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
  104. package/operations/entry/dataLoader/getRevisionById.d.ts +3 -3
  105. package/operations/entry/dataLoader/getRevisionById.js +23 -35
  106. package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
  107. package/operations/entry/dataLoader/index.d.ts +5 -5
  108. package/operations/entry/dataLoader/index.js +10 -31
  109. package/operations/entry/dataLoader/index.js.map +1 -1
  110. package/operations/entry/dataLoader/types.d.ts +3 -4
  111. package/operations/entry/dataLoader/types.js +1 -5
  112. package/operations/entry/dataLoader/types.js.map +1 -1
  113. package/operations/entry/dataLoaders.d.ts +13 -13
  114. package/operations/entry/dataLoaders.js +15 -25
  115. package/operations/entry/dataLoaders.js.map +1 -1
  116. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +1 -1
  117. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +1 -8
  118. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +1 -1
  119. package/operations/entry/elasticsearch/body.d.ts +3 -3
  120. package/operations/entry/elasticsearch/body.js +21 -28
  121. package/operations/entry/elasticsearch/body.js.map +1 -1
  122. package/operations/entry/elasticsearch/fields.d.ts +3 -3
  123. package/operations/entry/elasticsearch/fields.js +110 -24
  124. package/operations/entry/elasticsearch/fields.js.map +1 -1
  125. package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +2 -2
  126. package/operations/entry/elasticsearch/filtering/applyFiltering.js +10 -17
  127. package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +1 -1
  128. package/operations/entry/elasticsearch/filtering/exec.d.ts +7 -6
  129. package/operations/entry/elasticsearch/filtering/exec.js +48 -45
  130. package/operations/entry/elasticsearch/filtering/exec.js.map +1 -1
  131. package/operations/entry/elasticsearch/filtering/index.d.ts +1 -1
  132. package/operations/entry/elasticsearch/filtering/index.js +1 -16
  133. package/operations/entry/elasticsearch/filtering/index.js.map +1 -1
  134. package/operations/entry/elasticsearch/filtering/path.d.ts +2 -1
  135. package/operations/entry/elasticsearch/filtering/path.js +9 -17
  136. package/operations/entry/elasticsearch/filtering/path.js.map +1 -1
  137. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.d.ts +1 -1
  138. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +6 -14
  139. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js.map +1 -1
  140. package/operations/entry/elasticsearch/filtering/plugins/index.d.ts +1 -1
  141. package/operations/entry/elasticsearch/filtering/plugins/index.js +5 -12
  142. package/operations/entry/elasticsearch/filtering/plugins/index.js.map +1 -1
  143. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.d.ts +1 -1
  144. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +7 -15
  145. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js.map +1 -1
  146. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.d.ts +1 -1
  147. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +15 -16
  148. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js.map +1 -1
  149. package/operations/entry/elasticsearch/filtering/populated.d.ts +1 -1
  150. package/operations/entry/elasticsearch/filtering/populated.js +1 -8
  151. package/operations/entry/elasticsearch/filtering/populated.js.map +1 -1
  152. package/operations/entry/elasticsearch/filtering/values.d.ts +1 -1
  153. package/operations/entry/elasticsearch/filtering/values.js +4 -12
  154. package/operations/entry/elasticsearch/filtering/values.js.map +1 -1
  155. package/operations/entry/elasticsearch/fullTextSearch.d.ts +3 -3
  156. package/operations/entry/elasticsearch/fullTextSearch.js +6 -12
  157. package/operations/entry/elasticsearch/fullTextSearch.js.map +1 -1
  158. package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +1 -1
  159. package/operations/entry/elasticsearch/fullTextSearchFields.js +1 -8
  160. package/operations/entry/elasticsearch/fullTextSearchFields.js.map +1 -1
  161. package/operations/entry/elasticsearch/initialQuery.d.ts +2 -2
  162. package/operations/entry/elasticsearch/initialQuery.js +9 -26
  163. package/operations/entry/elasticsearch/initialQuery.js.map +1 -1
  164. package/operations/entry/elasticsearch/keyword.d.ts +1 -1
  165. package/operations/entry/elasticsearch/keyword.js +4 -9
  166. package/operations/entry/elasticsearch/keyword.js.map +1 -1
  167. package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +4 -4
  168. package/operations/entry/elasticsearch/plugins/bodyModifier.js +3 -10
  169. package/operations/entry/elasticsearch/plugins/bodyModifier.js.map +1 -1
  170. package/operations/entry/elasticsearch/plugins/operator.d.ts +2 -3
  171. package/operations/entry/elasticsearch/plugins/operator.js +4 -19
  172. package/operations/entry/elasticsearch/plugins/operator.js.map +1 -1
  173. package/operations/entry/elasticsearch/plugins/queryModifier.d.ts +4 -4
  174. package/operations/entry/elasticsearch/plugins/queryModifier.js +3 -10
  175. package/operations/entry/elasticsearch/plugins/queryModifier.js.map +1 -1
  176. package/operations/entry/elasticsearch/plugins/search.d.ts +2 -2
  177. package/operations/entry/elasticsearch/plugins/search.js +5 -13
  178. package/operations/entry/elasticsearch/plugins/search.js.map +1 -1
  179. package/operations/entry/elasticsearch/plugins/sortModifier.d.ts +4 -4
  180. package/operations/entry/elasticsearch/plugins/sortModifier.js +3 -10
  181. package/operations/entry/elasticsearch/plugins/sortModifier.js.map +1 -1
  182. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.d.ts +2 -0
  183. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js +6 -0
  184. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js.map +1 -0
  185. package/operations/entry/elasticsearch/sort.d.ts +4 -4
  186. package/operations/entry/elasticsearch/sort.js +57 -33
  187. package/operations/entry/elasticsearch/sort.js.map +1 -1
  188. package/operations/entry/elasticsearch/transformValueForSearch.d.ts +2 -2
  189. package/operations/entry/elasticsearch/transformValueForSearch.js +4 -9
  190. package/operations/entry/elasticsearch/transformValueForSearch.js.map +1 -1
  191. package/operations/entry/elasticsearch/types.d.ts +5 -5
  192. package/operations/entry/elasticsearch/types.js +1 -5
  193. package/operations/entry/elasticsearch/types.js.map +1 -1
  194. package/operations/entry/index.d.ts +7 -6
  195. package/operations/entry/index.js +634 -735
  196. package/operations/entry/index.js.map +1 -1
  197. package/operations/entry/keys.d.ts +31 -1
  198. package/operations/entry/keys.js +56 -19
  199. package/operations/entry/keys.js.map +1 -1
  200. package/operations/entry/recordType.js +3 -12
  201. package/operations/entry/recordType.js.map +1 -1
  202. package/operations/entry/transformations/convertEntryKeys.d.ts +6 -6
  203. package/operations/entry/transformations/convertEntryKeys.js +2 -10
  204. package/operations/entry/transformations/convertEntryKeys.js.map +1 -1
  205. package/operations/entry/transformations/index.d.ts +17 -17
  206. package/operations/entry/transformations/index.js +22 -30
  207. package/operations/entry/transformations/index.js.map +1 -1
  208. package/operations/entry/transformations/modifyEntryValues.d.ts +27 -34
  209. package/operations/entry/transformations/modifyEntryValues.js +1 -8
  210. package/operations/entry/transformations/modifyEntryValues.js.map +1 -1
  211. package/operations/entry/transformations/transformEntryKeys.d.ts +8 -8
  212. package/operations/entry/transformations/transformEntryKeys.js +4 -11
  213. package/operations/entry/transformations/transformEntryKeys.js.map +1 -1
  214. package/operations/entry/transformations/transformEntryToIndex.d.ts +7 -7
  215. package/operations/entry/transformations/transformEntryToIndex.js +3 -10
  216. package/operations/entry/transformations/transformEntryToIndex.js.map +1 -1
  217. package/operations/group/index.d.ts +6 -5
  218. package/operations/group/index.js +39 -73
  219. package/operations/group/index.js.map +1 -1
  220. package/operations/model/index.d.ts +4 -4
  221. package/operations/model/index.js +38 -57
  222. package/operations/model/index.js.map +1 -1
  223. package/package.json +29 -41
  224. package/plugins/CmsElasticsearchModelFieldPlugin.d.ts +1 -1
  225. package/plugins/CmsElasticsearchModelFieldPlugin.js +2 -8
  226. package/plugins/CmsElasticsearchModelFieldPlugin.js.map +1 -1
  227. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +3 -2
  228. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +3 -11
  229. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +1 -1
  230. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.d.ts +2 -2
  231. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +3 -11
  232. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js.map +1 -1
  233. package/plugins/CmsEntryElasticsearchIndexPlugin.js +2 -9
  234. package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +1 -1
  235. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +3 -2
  236. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +3 -11
  237. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +1 -1
  238. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +3 -2
  239. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +3 -11
  240. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +1 -1
  241. package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +3 -2
  242. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +3 -11
  243. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +1 -1
  244. package/plugins/CmsEntryElasticsearchValuesModifier.d.ts +12 -12
  245. package/plugins/CmsEntryElasticsearchValuesModifier.js +4 -12
  246. package/plugins/CmsEntryElasticsearchValuesModifier.js.map +1 -1
  247. package/plugins/CmsEntryFilterPlugin.d.ts +3 -3
  248. package/plugins/CmsEntryFilterPlugin.js +2 -9
  249. package/plugins/CmsEntryFilterPlugin.js.map +1 -1
  250. package/plugins/index.d.ts +8 -8
  251. package/plugins/index.js +8 -93
  252. package/plugins/index.js.map +1 -1
  253. package/tasks/createIndexTaskPlugin.d.ts +2 -2
  254. package/tasks/createIndexTaskPlugin.js +36 -62
  255. package/tasks/createIndexTaskPlugin.js.map +1 -1
  256. package/types.d.ts +28 -33
  257. package/types.js +5 -8
  258. package/types.js.map +1 -1
  259. package/values/NoValueContainer.d.ts +5 -0
  260. package/values/NoValueContainer.js +13 -0
  261. package/values/NoValueContainer.js.map +1 -0
  262. package/definitions/entryElasticsearch.d.ts +0 -8
  263. package/definitions/entryElasticsearch.js +0 -38
  264. package/definitions/entryElasticsearch.js.map +0 -1
  265. package/definitions/system.d.ts +0 -8
  266. package/definitions/system.js +0 -42
  267. package/definitions/system.js.map +0 -1
  268. package/definitions/table.d.ts +0 -8
  269. package/definitions/table.js +0 -25
  270. package/definitions/table.js.map +0 -1
  271. package/definitions/tableElasticsearch.d.ts +0 -8
  272. package/definitions/tableElasticsearch.js +0 -25
  273. package/definitions/tableElasticsearch.js.map +0 -1
  274. package/dynamoDb/storage/date.d.ts +0 -3
  275. package/dynamoDb/storage/date.js +0 -84
  276. package/dynamoDb/storage/date.js.map +0 -1
  277. package/elasticsearch/indices/japanese.d.ts +0 -2
  278. package/elasticsearch/indices/japanese.js +0 -14
  279. package/elasticsearch/indices/japanese.js.map +0 -1
  280. package/operations/system/index.d.ts +0 -6
  281. package/operations/system/index.js +0 -94
  282. package/operations/system/index.js.map +0 -1
  283. package/operations/system/indexes.d.ts +0 -10
  284. package/operations/system/indexes.js +0 -41
  285. package/operations/system/indexes.js.map +0 -1
@@ -1,19 +1,12 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createApplyFiltering = void 0;
8
- var _error = _interopRequireDefault(require("@webiny/error"));
9
- var _transformValueForSearch = require("../transformValueForSearch");
10
- var _keyword = require("../keyword");
11
- var _path = require("./path");
12
- const createApplyFiltering = ({
1
+ import WebinyError from "@webiny/error";
2
+ import { transformValueForSearch } from "../transformValueForSearch.js";
3
+ import { hasKeyword } from "../keyword.js";
4
+ import { createFieldPathFactory } from "./path.js";
5
+ export const createApplyFiltering = ({
13
6
  operatorPlugins,
14
7
  searchPlugins
15
8
  }) => {
16
- const createFieldPath = (0, _path.createFieldPathFactory)({
9
+ const createFieldPath = createFieldPathFactory({
17
10
  plugins: searchPlugins
18
11
  });
19
12
  return params => {
@@ -26,22 +19,23 @@ const createApplyFiltering = ({
26
19
  } = params;
27
20
  const plugin = operatorPlugins[operator];
28
21
  if (!plugin) {
29
- throw new _error.default(`Elasticsearch operator "${operator}" plugin missing.`, "PLUGIN_MISSING", {
22
+ throw new WebinyError(`Elasticsearch operator "${operator}" plugin missing.`, "PLUGIN_MISSING", {
30
23
  operator
31
24
  });
32
25
  }
33
- const value = (0, _transformValueForSearch.transformValueForSearch)({
26
+ const value = transformValueForSearch({
34
27
  plugins: searchPlugins,
35
28
  field: field.field,
36
29
  value: initialValue
37
30
  });
38
- const keyword = (0, _keyword.hasKeyword)(field);
31
+ const keyword = hasKeyword(field);
39
32
  const {
40
33
  basePath,
41
34
  path
42
35
  } = createFieldPath({
43
36
  field,
44
37
  value,
38
+ originalValue: initialValue,
45
39
  key,
46
40
  keyword
47
41
  });
@@ -54,6 +48,5 @@ const createApplyFiltering = ({
54
48
  });
55
49
  };
56
50
  };
57
- exports.createApplyFiltering = createApplyFiltering;
58
51
 
59
52
  //# sourceMappingURL=applyFiltering.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_transformValueForSearch","_keyword","_path","createApplyFiltering","operatorPlugins","searchPlugins","createFieldPath","createFieldPathFactory","plugins","params","key","value","initialValue","query","operator","field","plugin","WebinyError","transformValueForSearch","keyword","hasKeyword","basePath","path","apply","name","fieldId","exports"],"sources":["applyFiltering.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { transformValueForSearch } from \"~/operations/entry/elasticsearch/transformValueForSearch\";\nimport { hasKeyword } from \"~/operations/entry/elasticsearch/keyword\";\nimport {\n ElasticsearchQueryBuilderOperatorPlugins,\n ElasticsearchQuerySearchValuePlugins\n} from \"~/operations/entry/elasticsearch/types\";\nimport { createFieldPathFactory } from \"~/operations/entry/elasticsearch/filtering/path\";\nimport { ApplyFilteringCb } from \"~/plugins/CmsEntryFilterPlugin\";\n\ninterface CreateParams {\n operatorPlugins: ElasticsearchQueryBuilderOperatorPlugins;\n searchPlugins: ElasticsearchQuerySearchValuePlugins;\n}\n\nexport const createApplyFiltering = ({\n operatorPlugins,\n searchPlugins\n}: CreateParams): ApplyFilteringCb => {\n const createFieldPath = createFieldPathFactory({\n plugins: searchPlugins\n });\n\n return params => {\n const { key, value: initialValue, query, operator, field } = params;\n\n const plugin = operatorPlugins[operator];\n if (!plugin) {\n throw new WebinyError(\n `Elasticsearch operator \"${operator}\" plugin missing.`,\n \"PLUGIN_MISSING\",\n {\n operator\n }\n );\n }\n\n const value = transformValueForSearch({\n plugins: searchPlugins,\n field: field.field,\n value: initialValue\n });\n\n const keyword = hasKeyword(field);\n\n const { basePath, path } = createFieldPath({\n field,\n value,\n key,\n keyword\n });\n\n plugin.apply(query, {\n name: field.field.fieldId,\n basePath,\n path,\n value,\n keyword\n });\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,wBAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AAQO,MAAMI,oBAAoB,GAAGA,CAAC;EACjCC,eAAe;EACfC;AACU,CAAC,KAAuB;EAClC,MAAMC,eAAe,GAAG,IAAAC,4BAAsB,EAAC;IAC3CC,OAAO,EAAEH;EACb,CAAC,CAAC;EAEF,OAAOI,MAAM,IAAI;IACb,MAAM;MAAEC,GAAG;MAAEC,KAAK,EAAEC,YAAY;MAAEC,KAAK;MAAEC,QAAQ;MAAEC;IAAM,CAAC,GAAGN,MAAM;IAEnE,MAAMO,MAAM,GAAGZ,eAAe,CAACU,QAAQ,CAAC;IACxC,IAAI,CAACE,MAAM,EAAE;MACT,MAAM,IAAIC,cAAW,CAChB,2BAA0BH,QAAS,mBAAkB,EACtD,gBAAgB,EAChB;QACIA;MACJ,CACJ,CAAC;IACL;IAEA,MAAMH,KAAK,GAAG,IAAAO,gDAAuB,EAAC;MAClCV,OAAO,EAAEH,aAAa;MACtBU,KAAK,EAAEA,KAAK,CAACA,KAAK;MAClBJ,KAAK,EAAEC;IACX,CAAC,CAAC;IAEF,MAAMO,OAAO,GAAG,IAAAC,mBAAU,EAACL,KAAK,CAAC;IAEjC,MAAM;MAAEM,QAAQ;MAAEC;IAAK,CAAC,GAAGhB,eAAe,CAAC;MACvCS,KAAK;MACLJ,KAAK;MACLD,GAAG;MACHS;IACJ,CAAC,CAAC;IAEFH,MAAM,CAACO,KAAK,CAACV,KAAK,EAAE;MAChBW,IAAI,EAAET,KAAK,CAACA,KAAK,CAACU,OAAO;MACzBJ,QAAQ;MACRC,IAAI;MACJX,KAAK;MACLQ;IACJ,CAAC,CAAC;EACN,CAAC;AACL,CAAC;AAACO,OAAA,CAAAvB,oBAAA,GAAAA,oBAAA","ignoreList":[]}
1
+ {"version":3,"names":["WebinyError","transformValueForSearch","hasKeyword","createFieldPathFactory","createApplyFiltering","operatorPlugins","searchPlugins","createFieldPath","plugins","params","key","value","initialValue","query","operator","field","plugin","keyword","basePath","path","originalValue","apply","name","fieldId"],"sources":["applyFiltering.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { transformValueForSearch } from \"~/operations/entry/elasticsearch/transformValueForSearch.js\";\nimport { hasKeyword } from \"~/operations/entry/elasticsearch/keyword.js\";\nimport type {\n ElasticsearchQueryBuilderOperatorPlugins,\n ElasticsearchQuerySearchValuePlugins\n} from \"~/operations/entry/elasticsearch/types.js\";\nimport { createFieldPathFactory } from \"~/operations/entry/elasticsearch/filtering/path.js\";\nimport type { ApplyFilteringCb } from \"~/plugins/CmsEntryFilterPlugin.js\";\n\ninterface CreateParams {\n operatorPlugins: ElasticsearchQueryBuilderOperatorPlugins;\n searchPlugins: ElasticsearchQuerySearchValuePlugins;\n}\n\nexport const createApplyFiltering = ({\n operatorPlugins,\n searchPlugins\n}: CreateParams): ApplyFilteringCb => {\n const createFieldPath = createFieldPathFactory({\n plugins: searchPlugins\n });\n\n return params => {\n const { key, value: initialValue, query, operator, field } = params;\n\n const plugin = operatorPlugins[operator];\n if (!plugin) {\n throw new WebinyError(\n `Elasticsearch operator \"${operator}\" plugin missing.`,\n \"PLUGIN_MISSING\",\n {\n operator\n }\n );\n }\n\n const value = transformValueForSearch({\n plugins: searchPlugins,\n field: field.field,\n value: initialValue\n });\n\n const keyword = hasKeyword(field);\n\n const { basePath, path } = createFieldPath({\n field,\n value,\n originalValue: initialValue,\n key,\n keyword\n });\n\n plugin.apply(query, {\n name: field.field.fieldId,\n basePath,\n path,\n value,\n keyword\n });\n };\n};\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AACvC,SAASC,uBAAuB;AAChC,SAASC,UAAU;AAKnB,SAASC,sBAAsB;AAQ/B,OAAO,MAAMC,oBAAoB,GAAGA,CAAC;EACjCC,eAAe;EACfC;AACU,CAAC,KAAuB;EAClC,MAAMC,eAAe,GAAGJ,sBAAsB,CAAC;IAC3CK,OAAO,EAAEF;EACb,CAAC,CAAC;EAEF,OAAOG,MAAM,IAAI;IACb,MAAM;MAAEC,GAAG;MAAEC,KAAK,EAAEC,YAAY;MAAEC,KAAK;MAAEC,QAAQ;MAAEC;IAAM,CAAC,GAAGN,MAAM;IAEnE,MAAMO,MAAM,GAAGX,eAAe,CAACS,QAAQ,CAAC;IACxC,IAAI,CAACE,MAAM,EAAE;MACT,MAAM,IAAIhB,WAAW,CACjB,2BAA2Bc,QAAQ,mBAAmB,EACtD,gBAAgB,EAChB;QACIA;MACJ,CACJ,CAAC;IACL;IAEA,MAAMH,KAAK,GAAGV,uBAAuB,CAAC;MAClCO,OAAO,EAAEF,aAAa;MACtBS,KAAK,EAAEA,KAAK,CAACA,KAAK;MAClBJ,KAAK,EAAEC;IACX,CAAC,CAAC;IAEF,MAAMK,OAAO,GAAGf,UAAU,CAACa,KAAK,CAAC;IAEjC,MAAM;MAAEG,QAAQ;MAAEC;IAAK,CAAC,GAAGZ,eAAe,CAAC;MACvCQ,KAAK;MACLJ,KAAK;MACLS,aAAa,EAAER,YAAY;MAC3BF,GAAG;MACHO;IACJ,CAAC,CAAC;IAEFD,MAAM,CAACK,KAAK,CAACR,KAAK,EAAE;MAChBS,IAAI,EAAEP,KAAK,CAACA,KAAK,CAACQ,OAAO;MACzBL,QAAQ;MACRC,IAAI;MACJR,KAAK;MACLM;IACJ,CAAC,CAAC;EACN,CAAC;AACL,CAAC","ignoreList":[]}
@@ -1,17 +1,18 @@
1
- import { CmsEntryListWhere, CmsModel } from "@webiny/api-headless-cms/types";
2
- import { ModelFields } from "../types";
3
- import { PluginsContainer } from "@webiny/plugins";
4
- import { ElasticsearchBoolQueryConfig } from "@webiny/api-elasticsearch/types";
1
+ import type { CmsEntryListWhere, CmsModel } from "@webiny/api-headless-cms/types/index.js";
2
+ import type { ModelFields } from "../../../../operations/entry/elasticsearch/types.js";
3
+ import type { PluginsContainer } from "@webiny/plugins";
4
+ import type { ElasticsearchBoolQueryConfig } from "@webiny/api-elasticsearch/types.js";
5
5
  export interface CreateExecParams {
6
6
  model: CmsModel;
7
7
  fields: ModelFields;
8
8
  plugins: PluginsContainer;
9
9
  }
10
- export interface ExecParams {
10
+ export interface IExecParams {
11
11
  where: CmsEntryListWhere;
12
12
  query: ElasticsearchBoolQueryConfig;
13
+ isValues?: boolean;
13
14
  }
14
15
  export interface CreateExecFilteringResponse {
15
- (params: ExecParams): void;
16
+ (params: IExecParams): void;
16
17
  }
17
18
  export declare const createExecFiltering: (params: CreateExecParams) => CreateExecFilteringResponse;
@@ -1,21 +1,15 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createExecFiltering = void 0;
8
- var _error = _interopRequireDefault(require("@webiny/error"));
9
- var _search = require("../plugins/search");
10
- var _operator = require("../plugins/operator");
11
- var _initialQuery = require("../initialQuery");
12
- var _apiElasticsearch = require("@webiny/api-elasticsearch");
13
- var _values = require("./values");
14
- var _populated = require("./populated");
15
- var _applyFiltering = require("./applyFiltering");
16
- var _CmsEntryFilterPlugin = require("../../../../plugins/CmsEntryFilterPlugin");
17
- var _assignMinimumShouldMatchToQuery = require("../assignMinimumShouldMatchToQuery");
18
- const createExecFiltering = params => {
1
+ import WebinyError from "@webiny/error";
2
+ import { createSearchPluginList } from "../plugins/search.js";
3
+ import { createOperatorPluginList } from "../plugins/operator.js";
4
+ import { createBaseQuery } from "../initialQuery.js";
5
+ import { parseWhereKey } from "@webiny/api-elasticsearch";
6
+ import { getWhereValues } from "./values.js";
7
+ import { getPopulated } from "./populated.js";
8
+ import { createApplyFiltering } from "./applyFiltering.js";
9
+ import { CmsEntryFilterPlugin } from "../../../../plugins/CmsEntryFilterPlugin.js";
10
+ import { assignMinimumShouldMatchToQuery } from "../assignMinimumShouldMatchToQuery.js";
11
+ import { getBaseFieldType } from "@webiny/api-headless-cms/utils/getBaseFieldType.js";
12
+ export const createExecFiltering = params => {
19
13
  const {
20
14
  fields,
21
15
  plugins,
@@ -25,37 +19,40 @@ const createExecFiltering = params => {
25
19
  /**
26
20
  * We need the search plugins as key -> plugin value, so it is easy to find plugin we need, without iterating through array.
27
21
  */
28
- const searchPlugins = (0, _search.createSearchPluginList)({
22
+ const searchPlugins = createSearchPluginList({
29
23
  plugins
30
24
  });
31
25
  /**
32
26
  * We need the operator plugins, which we execute on our where conditions.
33
27
  */
34
- const operatorPlugins = (0, _operator.createOperatorPluginList)({
35
- plugins,
36
- locale: model.locale
28
+ const operatorPlugins = createOperatorPluginList({
29
+ plugins
37
30
  });
38
- const applyFiltering = (0, _applyFiltering.createApplyFiltering)({
31
+ const applyFiltering = createApplyFiltering({
39
32
  operatorPlugins,
40
33
  searchPlugins
41
34
  });
42
- const filteringPlugins = plugins.byType(_CmsEntryFilterPlugin.CmsEntryFilterPlugin.type).reduce((collection, plugin) => {
35
+ const filteringPlugins = plugins.byType(CmsEntryFilterPlugin.type).reduce((collection, plugin) => {
43
36
  collection[plugin.fieldType] = plugin;
44
37
  return collection;
45
38
  }, {});
46
39
  const getFilterPlugin = type => {
47
- const plugin = filteringPlugins[type] || filteringPlugins["*"];
40
+ const fieldType = getBaseFieldType({
41
+ type
42
+ });
43
+ const plugin = filteringPlugins[fieldType] || filteringPlugins["*"];
48
44
  if (plugin) {
49
45
  return plugin;
50
46
  }
51
- throw new _error.default(`There is no filtering plugin for the given field type "${type}".`, "FILTERING_PLUGIN_ERROR", {
52
- type
47
+ throw new WebinyError(`There is no filtering plugin for the given field type "${fieldType}".`, "FILTERING_PLUGIN_ERROR", {
48
+ fieldType
53
49
  });
54
50
  };
55
51
  const execFiltering = params => {
56
52
  const {
57
53
  where: initialWhere,
58
- query
54
+ query,
55
+ isValues = false
59
56
  } = params;
60
57
  /**
61
58
  * No point in continuing if no "where" conditions exist.
@@ -64,9 +61,7 @@ const createExecFiltering = params => {
64
61
  if (keys.length === 0) {
65
62
  return;
66
63
  }
67
- const where = {
68
- ...initialWhere
69
- };
64
+ const where = structuredClone(initialWhere);
70
65
  for (const key in where) {
71
66
  const value = where[key];
72
67
  /**
@@ -80,15 +75,16 @@ const createExecFiltering = params => {
80
75
  /**
81
76
  * When we are running with AND, the "value" MUST be an array.
82
77
  */else if (key === "AND") {
83
- const childWhereList = (0, _values.getWhereValues)(value, "AND");
84
- const childQuery = (0, _initialQuery.createBaseQuery)();
78
+ const childWhereList = getWhereValues(value, "AND");
79
+ const childQuery = createBaseQuery();
85
80
  for (const childWhere of childWhereList) {
86
81
  execFiltering({
87
82
  query: childQuery,
88
- where: childWhere
83
+ where: childWhere,
84
+ isValues
89
85
  });
90
86
  }
91
- const childQueryBool = (0, _populated.getPopulated)(childQuery);
87
+ const childQueryBool = getPopulated(childQuery);
92
88
  if (Object.keys(childQueryBool).length === 0) {
93
89
  continue;
94
90
  }
@@ -101,18 +97,19 @@ const createExecFiltering = params => {
101
97
  /**
102
98
  * When we are running with OR, the "value" must be an array.
103
99
  */else if (key === "OR") {
104
- const childWhereList = (0, _values.getWhereValues)(value, "OR");
100
+ const childWhereList = getWhereValues(value, "OR");
105
101
  /**
106
102
  * Each of the conditions MUST produce it's own should section.
107
103
  */
108
104
  const should = [];
109
105
  for (const childWhere of childWhereList) {
110
- const childQuery = (0, _initialQuery.createBaseQuery)();
106
+ const childQuery = createBaseQuery();
111
107
  execFiltering({
112
108
  query: childQuery,
113
- where: childWhere
109
+ where: childWhere,
110
+ isValues
114
111
  });
115
- const childQueryBool = (0, _populated.getPopulated)(childQuery);
112
+ const childQueryBool = getPopulated(childQuery);
116
113
  if (Object.keys(childQueryBool).length === 0) {
117
114
  continue;
118
115
  }
@@ -128,16 +125,23 @@ const createExecFiltering = params => {
128
125
  * If there are any should, minimum to have is 1.
129
126
  * Of course, do not override if it's already set.
130
127
  */
131
- (0, _assignMinimumShouldMatchToQuery.assignMinimumShouldMatchToQuery)({
128
+ assignMinimumShouldMatchToQuery({
132
129
  query
133
130
  });
134
131
  continue;
132
+ } else if (key === "values") {
133
+ execFiltering({
134
+ query,
135
+ where: where[key],
136
+ isValues: true
137
+ });
138
+ continue;
135
139
  }
136
140
  const {
137
141
  field: whereFieldId,
138
142
  operator
139
- } = (0, _apiElasticsearch.parseWhereKey)(key);
140
- let fieldId = whereFieldId;
143
+ } = parseWhereKey(key);
144
+ let fieldId = isValues ? `values.${whereFieldId}` : whereFieldId;
141
145
 
142
146
  /**
143
147
  * TODO This will be required until the storage operations receive the fieldId instead of field storageId.
@@ -147,13 +151,13 @@ const createExecFiltering = params => {
147
151
  */
148
152
  const cmsModelField = model.fields.find(f => f.fieldId === fieldId);
149
153
  if (!cmsModelField && !fields[fieldId]) {
150
- throw new _error.default(`There is no CMS Model Field "${fieldId}".`);
154
+ throw new WebinyError(`There is no CMS Model Field "${fieldId}".`);
151
155
  } else if (cmsModelField) {
152
156
  fieldId = cmsModelField.fieldId;
153
157
  }
154
158
  const field = fields[fieldId];
155
159
  if (!field) {
156
- throw new _error.default(`There is no field "${fieldId}".`, "EXEC_FILTERING_ERROR");
160
+ throw new WebinyError(`There is no field "${fieldId}".`, "EXEC_FILTERING_ERROR");
157
161
  }
158
162
  const filterPlugin = getFilterPlugin(field.type);
159
163
  filterPlugin.exec({
@@ -170,6 +174,5 @@ const createExecFiltering = params => {
170
174
  };
171
175
  return execFiltering;
172
176
  };
173
- exports.createExecFiltering = createExecFiltering;
174
177
 
175
178
  //# sourceMappingURL=exec.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_search","_operator","_initialQuery","_apiElasticsearch","_values","_populated","_applyFiltering","_CmsEntryFilterPlugin","_assignMinimumShouldMatchToQuery","createExecFiltering","params","fields","plugins","model","searchPlugins","createSearchPluginList","operatorPlugins","createOperatorPluginList","locale","applyFiltering","createApplyFiltering","filteringPlugins","byType","CmsEntryFilterPlugin","type","reduce","collection","plugin","fieldType","getFilterPlugin","WebinyError","execFiltering","where","initialWhere","query","keys","Object","length","key","value","undefined","childWhereList","getWhereValues","childQuery","createBaseQuery","childWhere","childQueryBool","getPopulated","filter","push","bool","should","assignMinimumShouldMatchToQuery","field","whereFieldId","operator","parseWhereKey","fieldId","cmsModelField","find","f","filterPlugin","exec","exports"],"sources":["exec.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsEntryListWhere, CmsModel } from \"@webiny/api-headless-cms/types\";\nimport { ModelFields } from \"~/operations/entry/elasticsearch/types\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { ElasticsearchBoolQueryConfig, Query } from \"@webiny/api-elasticsearch/types\";\nimport { createSearchPluginList } from \"~/operations/entry/elasticsearch/plugins/search\";\nimport { createOperatorPluginList } from \"~/operations/entry/elasticsearch/plugins/operator\";\nimport { createBaseQuery } from \"~/operations/entry/elasticsearch/initialQuery\";\nimport { parseWhereKey } from \"@webiny/api-elasticsearch\";\nimport { getWhereValues } from \"./values\";\nimport { getPopulated } from \"./populated\";\nimport { createApplyFiltering } from \"./applyFiltering\";\nimport { CmsEntryFilterPlugin } from \"~/plugins/CmsEntryFilterPlugin\";\nimport { assignMinimumShouldMatchToQuery } from \"~/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery\";\n\nexport interface CreateExecParams {\n model: CmsModel;\n fields: ModelFields;\n plugins: PluginsContainer;\n}\nexport interface ExecParams {\n where: CmsEntryListWhere;\n query: ElasticsearchBoolQueryConfig;\n}\nexport interface CreateExecFilteringResponse {\n (params: ExecParams): void;\n}\nexport const createExecFiltering = (params: CreateExecParams): CreateExecFilteringResponse => {\n const { fields, plugins, model } = params;\n\n /**\n * We need the search plugins as key -> plugin value, so it is easy to find plugin we need, without iterating through array.\n */\n const searchPlugins = createSearchPluginList({\n plugins\n });\n /**\n * We need the operator plugins, which we execute on our where conditions.\n */\n const operatorPlugins = createOperatorPluginList({\n plugins,\n locale: model.locale\n });\n\n const applyFiltering = createApplyFiltering({\n operatorPlugins,\n searchPlugins\n });\n\n const filteringPlugins = plugins\n .byType<CmsEntryFilterPlugin>(CmsEntryFilterPlugin.type)\n .reduce<Record<string, CmsEntryFilterPlugin>>((collection, plugin) => {\n collection[plugin.fieldType] = plugin;\n\n return collection;\n }, {});\n\n const getFilterPlugin = (type: string) => {\n const plugin = filteringPlugins[type] || filteringPlugins[\"*\"];\n if (plugin) {\n return plugin;\n }\n throw new WebinyError(\n `There is no filtering plugin for the given field type \"${type}\".`,\n \"FILTERING_PLUGIN_ERROR\",\n {\n type\n }\n );\n };\n\n const execFiltering = (params: ExecParams) => {\n const { where: initialWhere, query } = params;\n /**\n * No point in continuing if no \"where\" conditions exist.\n */\n const keys = Object.keys(initialWhere);\n if (keys.length === 0) {\n return;\n }\n const where: CmsEntryListWhere = {\n ...initialWhere\n };\n\n for (const key in where) {\n const value = where[key];\n /**\n * We always skip if no value is defined.\n * Only skip undefined value, null is valid.\n */\n if (value === undefined) {\n continue;\n }\n //\n /**\n * When we are running with AND, the \"value\" MUST be an array.\n */\n else if (key === \"AND\") {\n const childWhereList = getWhereValues(value, \"AND\");\n\n const childQuery = createBaseQuery();\n\n for (const childWhere of childWhereList) {\n execFiltering({\n query: childQuery,\n where: childWhere\n });\n }\n const childQueryBool = getPopulated(childQuery);\n if (Object.keys(childQueryBool).length === 0) {\n continue;\n }\n query.filter.push({\n bool: childQueryBool\n });\n\n continue;\n }\n //\n /**\n * When we are running with OR, the \"value\" must be an array.\n */\n else if (key === \"OR\") {\n const childWhereList = getWhereValues(value, \"OR\");\n /**\n * Each of the conditions MUST produce it's own should section.\n */\n const should: Query[] = [];\n for (const childWhere of childWhereList) {\n const childQuery = createBaseQuery();\n execFiltering({\n query: childQuery,\n where: childWhere\n });\n const childQueryBool = getPopulated(childQuery);\n if (Object.keys(childQueryBool).length === 0) {\n continue;\n }\n should.push({\n bool: childQueryBool\n });\n }\n if (should.length === 0) {\n continue;\n }\n query.should.push(...should);\n /**\n * If there are any should, minimum to have is 1.\n * Of course, do not override if it's already set.\n */\n assignMinimumShouldMatchToQuery({\n query\n });\n continue;\n }\n const { field: whereFieldId, operator } = parseWhereKey(key);\n\n let fieldId: string = whereFieldId;\n\n /**\n * TODO This will be required until the storage operations receive the fieldId instead of field storageId.\n * TODO For this to work without field searching, we need to refactor how the query looks like.\n *\n * Storage operations should NEVER receive an field storageId, only alias - fieldId.\n */\n const cmsModelField = model.fields.find(f => f.fieldId === fieldId);\n if (!cmsModelField && !fields[fieldId]) {\n throw new WebinyError(`There is no CMS Model Field \"${fieldId}\".`);\n } else if (cmsModelField) {\n fieldId = cmsModelField.fieldId;\n }\n\n const field = fields[fieldId];\n if (!field) {\n throw new WebinyError(`There is no field \"${fieldId}\".`, \"EXEC_FILTERING_ERROR\");\n }\n const filterPlugin = getFilterPlugin(field.type);\n\n filterPlugin.exec({\n applyFiltering,\n getFilterPlugin,\n key,\n value,\n operator,\n field,\n fields,\n query\n });\n }\n };\n\n return execFiltering;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,OAAA,GAAAD,OAAA;AACA,IA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,YAAY,GAAGhC,eAAe,CAACwB,KAAK,CAAC7B,IAAI,CAAC;MAEhDqC,YAAY,CAACC,IAAI,CAAC;QACd3C,cAAc;QACdU,eAAe;QACfS,GAAG;QACHC,KAAK;QACLgB,QAAQ;QACRF,KAAK;QACL1C,MAAM;QACNuB;MACJ,CAAC,CAAC;IACN;EACJ,CAAC;EAED,OAAOH,aAAa;AACxB,CAAC;AAACgC,OAAA,CAAAtD,mBAAA,GAAAA,mBAAA","ignoreList":[]}
1
+ {"version":3,"names":["WebinyError","createSearchPluginList","createOperatorPluginList","createBaseQuery","parseWhereKey","getWhereValues","getPopulated","createApplyFiltering","CmsEntryFilterPlugin","assignMinimumShouldMatchToQuery","getBaseFieldType","createExecFiltering","params","fields","plugins","model","searchPlugins","operatorPlugins","applyFiltering","filteringPlugins","byType","type","reduce","collection","plugin","fieldType","getFilterPlugin","execFiltering","where","initialWhere","query","isValues","keys","Object","length","structuredClone","key","value","undefined","childWhereList","childQuery","childWhere","childQueryBool","filter","push","bool","should","field","whereFieldId","operator","fieldId","cmsModelField","find","f","filterPlugin","exec"],"sources":["exec.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { CmsEntryListWhere, CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { ModelFields } from \"~/operations/entry/elasticsearch/types.js\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport type { ElasticsearchBoolQueryConfig, Query } from \"@webiny/api-elasticsearch/types.js\";\nimport { createSearchPluginList } from \"~/operations/entry/elasticsearch/plugins/search.js\";\nimport { createOperatorPluginList } from \"~/operations/entry/elasticsearch/plugins/operator.js\";\nimport { createBaseQuery } from \"~/operations/entry/elasticsearch/initialQuery.js\";\nimport { parseWhereKey } from \"@webiny/api-elasticsearch\";\nimport { getWhereValues } from \"./values.js\";\nimport { getPopulated } from \"./populated.js\";\nimport { createApplyFiltering } from \"./applyFiltering.js\";\nimport { CmsEntryFilterPlugin } from \"~/plugins/CmsEntryFilterPlugin.js\";\nimport { assignMinimumShouldMatchToQuery } from \"~/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js\";\nimport { getBaseFieldType } from \"@webiny/api-headless-cms/utils/getBaseFieldType.js\";\n\nexport interface CreateExecParams {\n model: CmsModel;\n fields: ModelFields;\n plugins: PluginsContainer;\n}\nexport interface IExecParams {\n where: CmsEntryListWhere;\n query: ElasticsearchBoolQueryConfig;\n isValues?: boolean;\n}\nexport interface CreateExecFilteringResponse {\n (params: IExecParams): void;\n}\nexport const createExecFiltering = (params: CreateExecParams): CreateExecFilteringResponse => {\n const { fields, plugins, model } = params;\n\n /**\n * We need the search plugins as key -> plugin value, so it is easy to find plugin we need, without iterating through array.\n */\n const searchPlugins = createSearchPluginList({\n plugins\n });\n /**\n * We need the operator plugins, which we execute on our where conditions.\n */\n const operatorPlugins = createOperatorPluginList({\n plugins\n });\n\n const applyFiltering = createApplyFiltering({\n operatorPlugins,\n searchPlugins\n });\n\n const filteringPlugins = plugins\n .byType<CmsEntryFilterPlugin>(CmsEntryFilterPlugin.type)\n .reduce<Record<string, CmsEntryFilterPlugin>>((collection, plugin) => {\n collection[plugin.fieldType] = plugin;\n\n return collection;\n }, {});\n\n const getFilterPlugin = (type: string) => {\n const fieldType = getBaseFieldType({\n type\n });\n\n const plugin = filteringPlugins[fieldType] || filteringPlugins[\"*\"];\n if (plugin) {\n return plugin;\n }\n throw new WebinyError(\n `There is no filtering plugin for the given field type \"${fieldType}\".`,\n \"FILTERING_PLUGIN_ERROR\",\n {\n fieldType\n }\n );\n };\n\n const execFiltering = (params: IExecParams) => {\n const { where: initialWhere, query, isValues = false } = params;\n /**\n * No point in continuing if no \"where\" conditions exist.\n */\n const keys = Object.keys(initialWhere);\n if (keys.length === 0) {\n return;\n }\n const where = structuredClone(initialWhere);\n\n for (const key in where) {\n const value = where[key as keyof typeof where];\n /**\n * We always skip if no value is defined.\n * Only skip undefined value, null is valid.\n */\n if (value === undefined) {\n continue;\n }\n //\n /**\n * When we are running with AND, the \"value\" MUST be an array.\n */\n else if (key === \"AND\") {\n const childWhereList = getWhereValues(value, \"AND\");\n\n const childQuery = createBaseQuery();\n\n for (const childWhere of childWhereList) {\n execFiltering({\n query: childQuery,\n where: childWhere,\n isValues\n });\n }\n const childQueryBool = getPopulated(childQuery);\n if (Object.keys(childQueryBool).length === 0) {\n continue;\n }\n query.filter.push({\n bool: childQueryBool\n });\n\n continue;\n }\n //\n /**\n * When we are running with OR, the \"value\" must be an array.\n */\n else if (key === \"OR\") {\n const childWhereList = getWhereValues(value, \"OR\");\n /**\n * Each of the conditions MUST produce it's own should section.\n */\n const should: Query[] = [];\n for (const childWhere of childWhereList) {\n const childQuery = createBaseQuery();\n execFiltering({\n query: childQuery,\n where: childWhere,\n isValues\n });\n const childQueryBool = getPopulated(childQuery);\n if (Object.keys(childQueryBool).length === 0) {\n continue;\n }\n should.push({\n bool: childQueryBool\n });\n }\n if (should.length === 0) {\n continue;\n }\n query.should.push(...should);\n /**\n * If there are any should, minimum to have is 1.\n * Of course, do not override if it's already set.\n */\n assignMinimumShouldMatchToQuery({\n query\n });\n continue;\n } else if (key === \"values\") {\n execFiltering({\n query,\n where: where[key] as CmsEntryListWhere,\n isValues: true\n });\n continue;\n }\n const { field: whereFieldId, operator } = parseWhereKey(key);\n\n let fieldId: string = isValues ? `values.${whereFieldId}` : whereFieldId;\n\n /**\n * TODO This will be required until the storage operations receive the fieldId instead of field storageId.\n * TODO For this to work without field searching, we need to refactor how the query looks like.\n *\n * Storage operations should NEVER receive an field storageId, only alias - fieldId.\n */\n const cmsModelField = model.fields.find(f => f.fieldId === fieldId);\n if (!cmsModelField && !fields[fieldId]) {\n throw new WebinyError(`There is no CMS Model Field \"${fieldId}\".`);\n } else if (cmsModelField) {\n fieldId = cmsModelField.fieldId;\n }\n\n const field = fields[fieldId];\n if (!field) {\n throw new WebinyError(`There is no field \"${fieldId}\".`, \"EXEC_FILTERING_ERROR\");\n }\n const filterPlugin = getFilterPlugin(field.type);\n\n filterPlugin.exec({\n applyFiltering,\n getFilterPlugin,\n key,\n value,\n operator,\n field,\n fields,\n query\n });\n }\n };\n\n return execFiltering;\n};\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AAKvC,SAASC,sBAAsB;AAC/B,SAASC,wBAAwB;AACjC,SAASC,eAAe;AACxB,SAASC,aAAa,QAAQ,2BAA2B;AACzD,SAASC,cAAc;AACvB,SAASC,YAAY;AACrB,SAASC,oBAAoB;AAC7B,SAASC,oBAAoB;AAC7B,SAASC,+BAA+B;AACxC,SAASC,gBAAgB,QAAQ,oDAAoD;AAerF,OAAO,MAAMC,mBAAmB,GAAIC,MAAwB,IAAkC;EAC1F,MAAM;IAAEC,MAAM;IAAEC,OAAO;IAAEC;EAAM,CAAC,GAAGH,MAAM;;EAEzC;AACJ;AACA;EACI,MAAMI,aAAa,GAAGf,sBAAsB,CAAC;IACzCa;EACJ,CAAC,CAAC;EACF;AACJ;AACA;EACI,MAAMG,eAAe,GAAGf,wBAAwB,CAAC;IAC7CY;EACJ,CAAC,CAAC;EAEF,MAAMI,cAAc,GAAGX,oBAAoB,CAAC;IACxCU,eAAe;IACfD;EACJ,CAAC,CAAC;EAEF,MAAMG,gBAAgB,GAAGL,OAAO,CAC3BM,MAAM,CAAuBZ,oBAAoB,CAACa,IAAI,CAAC,CACvDC,MAAM,CAAuC,CAACC,UAAU,EAAEC,MAAM,KAAK;IAClED,UAAU,CAACC,MAAM,CAACC,SAAS,CAAC,GAAGD,MAAM;IAErC,OAAOD,UAAU;EACrB,CAAC,EAAE,CAAC,CAAC,CAAC;EAEV,MAAMG,eAAe,GAAIL,IAAY,IAAK;IACtC,MAAMI,SAAS,GAAGf,gBAAgB,CAAC;MAC/BW;IACJ,CAAC,CAAC;IAEF,MAAMG,MAAM,GAAGL,gBAAgB,CAACM,SAAS,CAAC,IAAIN,gBAAgB,CAAC,GAAG,CAAC;IACnE,IAAIK,MAAM,EAAE;MACR,OAAOA,MAAM;IACjB;IACA,MAAM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AI,CAACtC,MAAM,CAACqC,OAAO,CAAC,EAAE;QACpC,MAAM,IAAIlD,WAAW,CAAC,gCAAgCkD,OAAO,IAAI,CAAC;MACtE,CAAC,MAAM,IAAIC,aAAa,EAAE;QACtBD,OAAO,GAAGC,aAAa,CAACD,OAAO;MACnC;MAEA,MAAMH,KAAK,GAAGlC,MAAM,CAACqC,OAAO,CAAC;MAC7B,IAAI,CAACH,KAAK,EAAE;QACR,MAAM,IAAI/C,WAAW,CAAC,sBAAsBkD,OAAO,IAAI,EAAE,sBAAsB,CAAC;MACpF;MACA,MAAMI,YAAY,GAAG5B,eAAe,CAACqB,KAAK,CAAC1B,IAAI,CAAC;MAEhDiC,YAAY,CAACC,IAAI,CAAC;QACdrC,cAAc;QACdQ,eAAe;QACfU,GAAG;QACHC,KAAK;QACLY,QAAQ;QACRF,KAAK;QACLlC,MAAM;QACNiB;MACJ,CAAC,CAAC;IACN;EACJ,CAAC;EAED,OAAOH,aAAa;AACxB,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- export * from "./exec";
1
+ export * from "./exec.js";
@@ -1,18 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _exec = require("./exec");
7
- Object.keys(_exec).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _exec[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _exec[key];
14
- }
15
- });
16
- });
1
+ export * from "./exec.js";
17
2
 
18
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_exec","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["index.ts"],"sourcesContent":["export * from \"./exec\";\n"],"mappings":";;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,KAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,KAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,KAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./exec.js\";\n"],"mappings":"AAAA","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { ElasticsearchQuerySearchValuePlugins, ModelField } from "../types";
1
+ import type { ElasticsearchQuerySearchValuePlugins, ModelField } from "../../../../operations/entry/elasticsearch/types.js";
2
2
  interface FieldPathFactoryParams {
3
3
  plugins: ElasticsearchQuerySearchValuePlugins;
4
4
  }
@@ -6,6 +6,7 @@ interface FieldPathParams {
6
6
  field: ModelField;
7
7
  key: string;
8
8
  value: any;
9
+ originalValue: any;
9
10
  keyword: boolean;
10
11
  }
11
12
  export declare const createFieldPathFactory: ({ plugins }: FieldPathFactoryParams) => (params: FieldPathParams) => {
@@ -1,10 +1,5 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createFieldPathFactory = void 0;
7
- const createFieldPathFactory = ({
1
+ import { getBaseFieldType } from "@webiny/api-headless-cms/utils/getBaseFieldType.js";
2
+ export const createFieldPathFactory = ({
8
3
  plugins
9
4
  }) => {
10
5
  return params => {
@@ -12,15 +7,18 @@ const createFieldPathFactory = ({
12
7
  field,
13
8
  key,
14
9
  value,
15
- keyword
10
+ keyword,
11
+ originalValue
16
12
  } = params;
17
- const plugin = plugins[field.type];
13
+ const fieldType = getBaseFieldType(field);
14
+ const plugin = plugins[fieldType];
18
15
  let fieldPath = null;
19
16
  if (plugin) {
20
17
  fieldPath = plugin.createPath({
21
18
  field: field.field,
22
19
  value,
23
- key
20
+ key,
21
+ originalValue
24
22
  });
25
23
  }
26
24
  if (!fieldPath) {
@@ -29,18 +27,12 @@ const createFieldPathFactory = ({
29
27
  fieldPath = typeof field.path === "function" ? field.path(value) : field.path;
30
28
  }
31
29
  }
32
- const result = [];
33
- if (!field.systemField) {
34
- result.push("values");
35
- }
36
- result.push(...field.parents.map(p => p.storageId));
37
- result.push(fieldPath);
30
+ const result = field.parents.map(p => p.storageId).concat([fieldPath]);
38
31
  return {
39
32
  basePath: result.join("."),
40
33
  path: result.concat(keyword ? ["keyword"] : []).join(".")
41
34
  };
42
35
  };
43
36
  };
44
- exports.createFieldPathFactory = createFieldPathFactory;
45
37
 
46
38
  //# sourceMappingURL=path.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createFieldPathFactory","plugins","params","field","key","value","keyword","plugin","type","fieldPath","createPath","storageId","path","result","systemField","push","parents","map","p","basePath","join","concat","exports"],"sources":["path.ts"],"sourcesContent":["import {\n ElasticsearchQuerySearchValuePlugins,\n ModelField\n} from \"~/operations/entry/elasticsearch/types\";\n\ninterface FieldPathFactoryParams {\n plugins: ElasticsearchQuerySearchValuePlugins;\n}\ninterface FieldPathParams {\n field: ModelField;\n key: string;\n value: any;\n keyword: boolean;\n}\n\nexport const createFieldPathFactory = ({ plugins }: FieldPathFactoryParams) => {\n return (params: FieldPathParams) => {\n const { field, key, value, keyword } = params;\n const plugin = plugins[field.type];\n\n let fieldPath: string | null = null;\n if (plugin) {\n fieldPath = plugin.createPath({ field: field.field, value, key });\n }\n if (!fieldPath) {\n fieldPath = field.field.storageId;\n if (field.path) {\n fieldPath = typeof field.path === \"function\" ? field.path(value) : field.path;\n }\n }\n\n const result: string[] = [];\n if (!field.systemField) {\n result.push(\"values\");\n }\n result.push(...field.parents.map(p => p.storageId));\n result.push(fieldPath);\n\n return {\n basePath: result.join(\".\"),\n path: result.concat(keyword ? [\"keyword\"] : []).join(\".\")\n };\n };\n};\n"],"mappings":";;;;;;AAeO,MAAMA,sBAAsB,GAAGA,CAAC;EAAEC;AAAg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plugins","params","field","key","value","keyword","originalValue","fieldType","plugin","fieldPath","createPath","storageId","path","result","parents","map","p","concat","basePath","join"],"sources":["path.ts"],"sourcesContent":["import type {\n ElasticsearchQuerySearchValuePlugins,\n ModelField\n} from \"~/operations/entry/elasticsearch/types.js\";\nimport { getBaseFieldType } from \"@webiny/api-headless-cms/utils/getBaseFieldType.js\";\n\ninterface FieldPathFactoryParams {\n plugins: ElasticsearchQuerySearchValuePlugins;\n}\ninterface FieldPathParams {\n field: ModelField;\n key: string;\n value: any;\n originalValue: any;\n keyword: boolean;\n}\n\nexport const createFieldPathFactory = ({ plugins }: FieldPathFactoryParams) => {\n return (params: FieldPathParams) => {\n const { field, key, value, keyword, originalValue } = params;\n const fieldType = getBaseFieldType(field);\n const plugin = plugins[fieldType];\n\n let fieldPath: string | null = null;\n if (plugin) {\n fieldPath = plugin.createPath({ field: field.field, value, key, originalValue });\n }\n if (!fieldPath) {\n fieldPath = field.field.storageId;\n if (field.path) {\n fieldPath = typeof field.path === \"function\" ? field.path(value) : field.path;\n }\n }\n\n const result: string[] = field.parents.map(p => p.storageId).concat([fieldPath]);\n\n return {\n basePath: result.join(\".\"),\n path: result.concat(keyword ? [\"keyword\"] : []).join(\".\")\n };\n };\n};\n"],"mappings":"AAIA,SAASA,gBAAgB,QAAQ,oDAAoD;AAarF,OAAO,MAAMC,sBAAsB,GAAGA,CAAC;EAAEC;AAAgC,CAAC,KAAK;EAC3E,OAAQC,MAAuB,IAAK;IAChC,MAAM;MAAEC,KAAK;MAAEC,GAAG;MAAEC,KAAK;MAAEC,OAAO;MAAEC;IAAc,CAAC,GAAGL,MAAM;IAC5D,MAAMM,SAAS,GAAGT,gBAAgB,CAACI,KAAK,CAAC;IACzC,MAAMM,MAAM,GAAGR,OAAO,CAACO,SAAS,CAAC;IAEjC,IAAIE,SAAwB,GAAG,IAAI;IACnC,IAAID,MAAM,EAAE;MACRC,SAAS,GAAGD,MAAM,CAACE,UAAU,CAAC;QAAER,KAAK,EAAEA,KAAK,CAACA,KAAK;QAAEE,KAAK;QAAED,GAAG;QAAEG;MAAc,CAAC,CAAC;IACpF;IACA,IAAI,CAACG,SAAS,EAAE;MACZA,SAAS,GAAGP,KAAK,CAACA,KAAK,CAACS,SAAS;MACjC,IAAIT,KAAK,CAACU,IAAI,EAAE;QACZH,SAAS,GAAG,OAAOP,KAAK,CAACU,IAAI,KAAK,UAAU,GAAGV,KAAK,CAACU,IAAI,CAACR,KAAK,CAAC,GAAGF,KAAK,CAACU,IAAI;MACjF;IACJ;IAEA,MAAMC,MAAgB,GAAGX,KAAK,CAACY,OAAO,CAACC,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACL,SAAS,CAAC,CAACM,MAAM,CAAC,CAACR,SAAS,CAAC,CAAC;IAEhF,OAAO;MACHS,QAAQ,EAAEL,MAAM,CAACM,IAAI,CAAC,GAAG,CAAC;MAC1BP,IAAI,EAAEC,MAAM,CAACI,MAAM,CAACZ,OAAO,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,CAACc,IAAI,CAAC,GAAG;IAC5D,CAAC;EACL,CAAC;AACL,CAAC","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import { CmsEntryFilterPlugin } from "../../../../../plugins/CmsEntryFilterPlugin";
1
+ import { CmsEntryFilterPlugin } from "../../../../../plugins/CmsEntryFilterPlugin.js";
2
2
  export declare const createDefaultFilterPlugin: () => CmsEntryFilterPlugin;
@@ -1,15 +1,8 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createDefaultFilterPlugin = void 0;
8
- var _error = _interopRequireDefault(require("@webiny/error"));
9
- var _CmsEntryFilterPlugin = require("../../../../../plugins/CmsEntryFilterPlugin");
10
- const createDefaultFilterPlugin = () => {
11
- const plugin = new _CmsEntryFilterPlugin.CmsEntryFilterPlugin({
12
- fieldType: _CmsEntryFilterPlugin.CmsEntryFilterPlugin.ALL,
1
+ import WebinyError from "@webiny/error";
2
+ import { CmsEntryFilterPlugin } from "../../../../../plugins/CmsEntryFilterPlugin.js";
3
+ export const createDefaultFilterPlugin = () => {
4
+ const plugin = new CmsEntryFilterPlugin({
5
+ fieldType: CmsEntryFilterPlugin.ALL,
13
6
  exec: params => {
14
7
  const {
15
8
  applyFiltering,
@@ -17,7 +10,7 @@ const createDefaultFilterPlugin = () => {
17
10
  } = params;
18
11
  if (!params.field.searchable) {
19
12
  const identifier = [...field.parents.map(p => p.fieldId), field.field.fieldId].join(".");
20
- throw new _error.default(`Field "${identifier}" is not searchable.`);
13
+ throw new WebinyError(`Field "${identifier}" is not searchable.`);
21
14
  }
22
15
  applyFiltering(params);
23
16
  }
@@ -25,6 +18,5 @@ const createDefaultFilterPlugin = () => {
25
18
  plugin.name = `${plugin.type}.default.all`;
26
19
  return plugin;
27
20
  };
28
- exports.createDefaultFilterPlugin = createDefaultFilterPlugin;
29
21
 
30
22
  //# sourceMappingURL=defaultFilterPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_CmsEntryFilterPlugin","createDefaultFilterPlugin","plugin","CmsEntryFilterPlugin","fieldType","ALL","exec","params","applyFiltering","field","searchable","identifier","parents","map","p","fieldId","join","WebinyError","name","type","exports"],"sources":["defaultFilterPlugin.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsEntryFilterPlugin } from \"~/plugins/CmsEntryFilterPlugin\";\n\nexport const createDefaultFilterPlugin = () => {\n const plugin = new CmsEntryFilterPlugin({\n fieldType: CmsEntryFilterPlugin.ALL,\n exec: params => {\n const { applyFiltering, field } = params;\n if (!params.field.searchable) {\n const identifier = [...field.parents.map(p => p.fieldId), field.field.fieldId].join(\n \".\"\n );\n throw new WebinyError(`Field \"${identifier}\" is not searchable.`);\n }\n applyFiltering(params);\n }\n });\n\n plugin.name = `${plugin.type}.default.all`;\n\n return plugin;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AAEO,MAAME,yBAAyB,GAAGA,CAAA,KAAM;EAC3C,MAAMC,MAAM,GAAG,IAAIC,0CAAoB,CAAC;IACpCC,SAAS,EAAED,0CAAoB,CAACE,GAAG;IACnCC,IAAI,EAAEC,MAAM,IAAI;MACZ,MAAM;QAAEC,cAAc;QAAEC;MAAM,CAAC,GAAGF,MAAM;MACxC,IAAI,CAACA,MAAM,CAACE,KAAK,CAACC,UAAU,EAAE;QAC1B,MAAMC,UAAU,GAAG,CAAC,GAAGF,KAAK,CAACG,OAAO,CAACC,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,OAAO,CAAC,EAAEN,KAAK,CAACA,KAAK,CAACM,OAAO,CAAC,CAACC,IAAI,CAC/E,GACJ,CAAC;QACD,MAAM,IAAIC,cAAW,CAAE,UAASN,UAAW,sBAAqB,CAAC;MACrE;MACAH,cAAc,CAACD,MAAM,CAAC;IAC1B;EACJ,CAAC,CAAC;EAEFL,MAAM,CAACgB,IAAI,GAAI,GAAEhB,MAAM,CAACiB,IAAK,cAAa;EAE1C,OAAOjB,MAAM;AACjB,CAAC;AAACkB,OAAA,CAAAnB,yBAAA,GAAAA,yBAAA","ignoreList":[]}
1
+ {"version":3,"names":["WebinyError","CmsEntryFilterPlugin","createDefaultFilterPlugin","plugin","fieldType","ALL","exec","params","applyFiltering","field","searchable","identifier","parents","map","p","fieldId","join","name","type"],"sources":["defaultFilterPlugin.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsEntryFilterPlugin } from \"~/plugins/CmsEntryFilterPlugin.js\";\n\nexport const createDefaultFilterPlugin = () => {\n const plugin = new CmsEntryFilterPlugin({\n fieldType: CmsEntryFilterPlugin.ALL,\n exec: params => {\n const { applyFiltering, field } = params;\n if (!params.field.searchable) {\n const identifier = [...field.parents.map(p => p.fieldId), field.field.fieldId].join(\n \".\"\n );\n throw new WebinyError(`Field \"${identifier}\" is not searchable.`);\n }\n applyFiltering(params);\n }\n });\n\n plugin.name = `${plugin.type}.default.all`;\n\n return plugin;\n};\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AACvC,SAASC,oBAAoB;AAE7B,OAAO,MAAMC,yBAAyB,GAAGA,CAAA,KAAM;EAC3C,MAAMC,MAAM,GAAG,IAAIF,oBAAoB,CAAC;IACpCG,SAAS,EAAEH,oBAAoB,CAACI,GAAG;IACnCC,IAAI,EAAEC,MAAM,IAAI;MACZ,MAAM;QAAEC,cAAc;QAAEC;MAAM,CAAC,GAAGF,MAAM;MACxC,IAAI,CAACA,MAAM,CAACE,KAAK,CAACC,UAAU,EAAE;QAC1B,MAAMC,UAAU,GAAG,CAAC,GAAGF,KAAK,CAACG,OAAO,CAACC,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,OAAO,CAAC,EAAEN,KAAK,CAACA,KAAK,CAACM,OAAO,CAAC,CAACC,IAAI,CAC/E,GACJ,CAAC;QACD,MAAM,IAAIhB,WAAW,CAAC,UAAUW,UAAU,sBAAsB,CAAC;MACrE;MACAH,cAAc,CAACD,MAAM,CAAC;IAC1B;EACJ,CAAC,CAAC;EAEFJ,MAAM,CAACc,IAAI,GAAG,GAAGd,MAAM,CAACe,IAAI,cAAc;EAE1C,OAAOf,MAAM;AACjB,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- export declare const createFilterPlugins: () => import("../../../../../plugins/CmsEntryFilterPlugin").CmsEntryFilterPlugin[];
1
+ export declare const createFilterPlugins: () => import("../../../../../plugins/CmsEntryFilterPlugin.js").CmsEntryFilterPlugin[];
@@ -1,15 +1,8 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createFilterPlugins = void 0;
7
- var _defaultFilterPlugin = require("./defaultFilterPlugin");
8
- var _objectFilterPlugin = require("./objectFilterPlugin");
9
- var _refFilterPlugin = require("./refFilterPlugin");
10
- const createFilterPlugins = () => {
11
- return [(0, _defaultFilterPlugin.createDefaultFilterPlugin)(), (0, _objectFilterPlugin.createObjectFilterPlugin)(), (0, _refFilterPlugin.createRefFilterPlugin)()];
1
+ import { createDefaultFilterPlugin } from "./defaultFilterPlugin.js";
2
+ import { createObjectFilterPlugin } from "./objectFilterPlugin.js";
3
+ import { createRefFilterPlugin } from "./refFilterPlugin.js";
4
+ export const createFilterPlugins = () => {
5
+ return [createDefaultFilterPlugin(), createObjectFilterPlugin(), createRefFilterPlugin()];
12
6
  };
13
- exports.createFilterPlugins = createFilterPlugins;
14
7
 
15
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_defaultFilterPlugin","require","_objectFilterPlugin","_refFilterPlugin","createFilterPlugins","createDefaultFilterPlugin","createObjectFilterPlugin","createRefFilterPlugin","exports"],"sources":["index.ts"],"sourcesContent":["import { createDefaultFilterPlugin } from \"./defaultFilterPlugin\";\nimport { createObjectFilterPlugin } from \"./objectFilterPlugin\";\nimport { createRefFilterPlugin } from \"./refFilterPlugin\";\n\nexport const createFilterPlugins = () => {\n return [createDefaultFilterPlugin(), createObjectFilterPlugin(), createRefFilterPlugin()];\n};\n"],"mappings":";;;;;;AAAA,IAAAA,oBAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AAEO,MAAMG,mBAAmB,GAAGA,CAAA,KAAM;EACrC,OAAO,CAAC,IAAAC,8CAAyB,EAAC,CAAC,EAAE,IAAAC,4CAAwB,EAAC,CAAC,EAAE,IAAAC,sCAAqB,EAAC,CAAC,CAAC;AAC7F,CAAC;AAACC,OAAA,CAAAJ,mBAAA,GAAAA,mBAAA","ignoreList":[]}
1
+ {"version":3,"names":["createDefaultFilterPlugin","createObjectFilterPlugin","createRefFilterPlugin","createFilterPlugins"],"sources":["index.ts"],"sourcesContent":["import { createDefaultFilterPlugin } from \"./defaultFilterPlugin.js\";\nimport { createObjectFilterPlugin } from \"./objectFilterPlugin.js\";\nimport { createRefFilterPlugin } from \"./refFilterPlugin.js\";\n\nexport const createFilterPlugins = () => {\n return [createDefaultFilterPlugin(), createObjectFilterPlugin(), createRefFilterPlugin()];\n};\n"],"mappings":"AAAA,SAASA,yBAAyB;AAClC,SAASC,wBAAwB;AACjC,SAASC,qBAAqB;AAE9B,OAAO,MAAMC,mBAAmB,GAAGA,CAAA,KAAM;EACrC,OAAO,CAACH,yBAAyB,CAAC,CAAC,EAAEC,wBAAwB,CAAC,CAAC,EAAEC,qBAAqB,CAAC,CAAC,CAAC;AAC7F,CAAC","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import { CmsEntryFilterPlugin } from "../../../../../plugins/CmsEntryFilterPlugin";
1
+ import { CmsEntryFilterPlugin } from "../../../../../plugins/CmsEntryFilterPlugin.js";
2
2
  export declare const createObjectFilterPlugin: () => CmsEntryFilterPlugin;
@@ -1,15 +1,8 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createObjectFilterPlugin = void 0;
8
- var _CmsEntryFilterPlugin = require("../../../../../plugins/CmsEntryFilterPlugin");
9
- var _apiElasticsearch = require("@webiny/api-elasticsearch");
10
- var _error = _interopRequireDefault(require("@webiny/error"));
11
- const createObjectFilterPlugin = () => {
12
- const plugin = new _CmsEntryFilterPlugin.CmsEntryFilterPlugin({
1
+ import { CmsEntryFilterPlugin } from "../../../../../plugins/CmsEntryFilterPlugin.js";
2
+ import { parseWhereKey } from "@webiny/api-elasticsearch";
3
+ import WebinyError from "@webiny/error";
4
+ export const createObjectFilterPlugin = () => {
5
+ const plugin = new CmsEntryFilterPlugin({
13
6
  fieldType: "object",
14
7
  exec: params => {
15
8
  const {
@@ -32,11 +25,11 @@ const createObjectFilterPlugin = () => {
32
25
  const {
33
26
  field: whereFieldId,
34
27
  operator
35
- } = (0, _apiElasticsearch.parseWhereKey)(key);
28
+ } = parseWhereKey(key);
36
29
  const identifier = [...parentField.parents.map(p => p.fieldId), parentField.field.fieldId, whereFieldId].join(".");
37
30
  const field = fields[identifier];
38
31
  if (!field) {
39
- throw new _error.default(`There is no field "${identifier}".`, "OBJECT_FILTER_FIELD_ERROR", {
32
+ throw new WebinyError(`There is no field "${identifier}".`, "OBJECT_FILTER_FIELD_ERROR", {
40
33
  fields: Object.keys(fields)
41
34
  });
42
35
  }
@@ -64,6 +57,5 @@ const createObjectFilterPlugin = () => {
64
57
  plugin.name = `${plugin.type}.default.object`;
65
58
  return plugin;
66
59
  };
67
- exports.createObjectFilterPlugin = createObjectFilterPlugin;
68
60
 
69
61
  //# sourceMappingURL=objectFilterPlugin.js.map