@webiny/api-headless-cms-ddb-es 0.0.0-mt-2 → 0.0.0-unstable.1145e7667f

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 (255) hide show
  1. package/configurations.d.ts +3 -3
  2. package/configurations.js +13 -10
  3. package/configurations.js.map +1 -0
  4. package/definitions/entry.d.ts +2 -2
  5. package/definitions/entry.js +9 -12
  6. package/definitions/entry.js.map +1 -0
  7. package/definitions/entryElasticsearch.d.ts +2 -2
  8. package/definitions/entryElasticsearch.js +3 -12
  9. package/definitions/entryElasticsearch.js.map +1 -0
  10. package/definitions/group.d.ts +2 -2
  11. package/definitions/group.js +3 -12
  12. package/definitions/group.js.map +1 -0
  13. package/definitions/model.d.ts +2 -2
  14. package/definitions/model.js +25 -12
  15. package/definitions/model.js.map +1 -0
  16. package/definitions/settings.d.ts +2 -2
  17. package/definitions/settings.js +3 -12
  18. package/definitions/settings.js.map +1 -0
  19. package/definitions/system.d.ts +2 -2
  20. package/definitions/system.js +3 -12
  21. package/definitions/system.js.map +1 -0
  22. package/definitions/table.d.ts +2 -2
  23. package/definitions/table.js +0 -3
  24. package/definitions/table.js.map +1 -0
  25. package/definitions/tableElasticsearch.d.ts +2 -2
  26. package/definitions/tableElasticsearch.js +0 -3
  27. package/definitions/tableElasticsearch.js.map +1 -0
  28. package/dynamoDb/index.d.ts +1 -1
  29. package/dynamoDb/index.js +4 -11
  30. package/dynamoDb/index.js.map +1 -0
  31. package/dynamoDb/storage/date.d.ts +3 -3
  32. package/dynamoDb/storage/date.js +74 -53
  33. package/dynamoDb/storage/date.js.map +1 -0
  34. package/dynamoDb/storage/longText.d.ts +7 -4
  35. package/dynamoDb/storage/longText.js +73 -63
  36. package/dynamoDb/storage/longText.js.map +1 -0
  37. package/dynamoDb/storage/richText.d.ts +2 -3
  38. package/dynamoDb/storage/richText.js +77 -77
  39. package/dynamoDb/storage/richText.js.map +1 -0
  40. package/elasticsearch/createElasticsearchIndex.d.ts +9 -0
  41. package/elasticsearch/createElasticsearchIndex.js +49 -0
  42. package/elasticsearch/createElasticsearchIndex.js.map +1 -0
  43. package/elasticsearch/deleteElasticsearchIndex.d.ts +8 -0
  44. package/elasticsearch/deleteElasticsearchIndex.js +36 -0
  45. package/elasticsearch/deleteElasticsearchIndex.js.map +1 -0
  46. package/elasticsearch/index.d.ts +1 -1
  47. package/elasticsearch/index.js +1 -6
  48. package/elasticsearch/index.js.map +1 -0
  49. package/elasticsearch/indexing/dateTimeIndexing.js +17 -20
  50. package/elasticsearch/indexing/dateTimeIndexing.js.map +1 -0
  51. package/elasticsearch/indexing/defaultFieldIndexing.js +15 -10
  52. package/elasticsearch/indexing/defaultFieldIndexing.js.map +1 -0
  53. package/elasticsearch/indexing/index.js +1 -10
  54. package/elasticsearch/indexing/index.js.map +1 -0
  55. package/elasticsearch/indexing/longTextIndexing.d.ts +4 -0
  56. package/elasticsearch/indexing/longTextIndexing.js +14 -10
  57. package/elasticsearch/indexing/longTextIndexing.js.map +1 -0
  58. package/elasticsearch/indexing/numberIndexing.js +0 -9
  59. package/elasticsearch/indexing/numberIndexing.js.map +1 -0
  60. package/elasticsearch/indexing/objectIndexing.d.ts +9 -0
  61. package/elasticsearch/indexing/objectIndexing.js +26 -30
  62. package/elasticsearch/indexing/objectIndexing.js.map +1 -0
  63. package/elasticsearch/indexing/richTextIndexing.js +0 -5
  64. package/elasticsearch/indexing/richTextIndexing.js.map +1 -0
  65. package/elasticsearch/indices/base.d.ts +2 -0
  66. package/elasticsearch/indices/base.js +12 -0
  67. package/elasticsearch/indices/base.js.map +1 -0
  68. package/elasticsearch/indices/index.d.ts +1 -0
  69. package/elasticsearch/indices/index.js +12 -0
  70. package/elasticsearch/indices/index.js.map +1 -0
  71. package/elasticsearch/indices/japanese.d.ts +2 -0
  72. package/elasticsearch/indices/japanese.js +13 -0
  73. package/elasticsearch/indices/japanese.js.map +1 -0
  74. package/elasticsearch/search/index.d.ts +2 -2
  75. package/elasticsearch/search/index.js +3 -9
  76. package/elasticsearch/search/index.js.map +1 -0
  77. package/elasticsearch/search/refSearch.d.ts +2 -3
  78. package/elasticsearch/search/refSearch.js +23 -18
  79. package/elasticsearch/search/refSearch.js.map +1 -0
  80. package/elasticsearch/search/timeSearch.d.ts +2 -3
  81. package/elasticsearch/search/timeSearch.js +18 -17
  82. package/elasticsearch/search/timeSearch.js.map +1 -0
  83. package/helpers/entryIndexHelpers.js +43 -57
  84. package/helpers/entryIndexHelpers.js.map +1 -0
  85. package/helpers/index.d.ts +0 -1
  86. package/helpers/index.js +0 -15
  87. package/helpers/index.js.map +1 -0
  88. package/index.d.ts +1 -0
  89. package/index.js +107 -63
  90. package/index.js.map +1 -0
  91. package/operations/entry/dataLoaders.d.ts +6 -2
  92. package/operations/entry/dataLoaders.js +27 -61
  93. package/operations/entry/dataLoaders.js.map +1 -0
  94. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +18 -0
  95. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +32 -0
  96. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +1 -0
  97. package/operations/entry/elasticsearch/body.d.ts +13 -0
  98. package/operations/entry/elasticsearch/body.js +140 -0
  99. package/operations/entry/elasticsearch/body.js.map +1 -0
  100. package/operations/entry/elasticsearch/fields.d.ts +10 -0
  101. package/operations/entry/elasticsearch/fields.js +261 -0
  102. package/operations/entry/elasticsearch/fields.js.map +1 -0
  103. package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +8 -0
  104. package/operations/entry/elasticsearch/filtering/applyFiltering.js +57 -0
  105. package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +1 -0
  106. package/operations/entry/elasticsearch/filtering/exec.d.ts +17 -0
  107. package/operations/entry/elasticsearch/filtering/exec.js +172 -0
  108. package/operations/entry/elasticsearch/filtering/exec.js.map +1 -0
  109. package/operations/entry/elasticsearch/filtering/index.d.ts +1 -0
  110. package/operations/entry/elasticsearch/filtering/index.js +16 -0
  111. package/operations/entry/elasticsearch/filtering/index.js.map +1 -0
  112. package/operations/entry/elasticsearch/filtering/path.d.ts +15 -0
  113. package/operations/entry/elasticsearch/filtering/path.js +44 -0
  114. package/operations/entry/elasticsearch/filtering/path.js.map +1 -0
  115. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.d.ts +2 -0
  116. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +28 -0
  117. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js.map +1 -0
  118. package/operations/entry/elasticsearch/filtering/plugins/index.d.ts +1 -0
  119. package/operations/entry/elasticsearch/filtering/plugins/index.js +13 -0
  120. package/operations/entry/elasticsearch/filtering/plugins/index.js.map +1 -0
  121. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.d.ts +2 -0
  122. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +65 -0
  123. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js.map +1 -0
  124. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.d.ts +2 -0
  125. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +48 -0
  126. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js.map +1 -0
  127. package/operations/entry/elasticsearch/filtering/populated.d.ts +2 -0
  128. package/operations/entry/elasticsearch/filtering/populated.js +23 -0
  129. package/operations/entry/elasticsearch/filtering/populated.js.map +1 -0
  130. package/operations/entry/elasticsearch/filtering/values.d.ts +2 -0
  131. package/operations/entry/elasticsearch/filtering/values.js +22 -0
  132. package/operations/entry/elasticsearch/filtering/values.js.map +1 -0
  133. package/operations/entry/elasticsearch/fullTextSearch.d.ts +12 -0
  134. package/operations/entry/elasticsearch/fullTextSearch.js +89 -0
  135. package/operations/entry/elasticsearch/fullTextSearch.js.map +1 -0
  136. package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +8 -0
  137. package/operations/entry/elasticsearch/fullTextSearchFields.js +25 -0
  138. package/operations/entry/elasticsearch/fullTextSearchFields.js.map +1 -0
  139. package/operations/entry/elasticsearch/initialQuery.d.ts +17 -0
  140. package/operations/entry/elasticsearch/initialQuery.js +103 -0
  141. package/operations/entry/elasticsearch/initialQuery.js.map +1 -0
  142. package/operations/entry/elasticsearch/keyword.d.ts +2 -0
  143. package/operations/entry/elasticsearch/keyword.js +34 -0
  144. package/operations/entry/elasticsearch/keyword.js.map +1 -0
  145. package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +9 -0
  146. package/operations/entry/elasticsearch/plugins/bodyModifier.js +16 -0
  147. package/operations/entry/elasticsearch/plugins/bodyModifier.js.map +1 -0
  148. package/operations/entry/elasticsearch/plugins/operator.d.ts +8 -0
  149. package/operations/entry/elasticsearch/plugins/operator.js +37 -0
  150. package/operations/entry/elasticsearch/plugins/operator.js.map +1 -0
  151. package/operations/entry/elasticsearch/plugins/queryModifier.d.ts +9 -0
  152. package/operations/entry/elasticsearch/plugins/queryModifier.js +16 -0
  153. package/operations/entry/elasticsearch/plugins/queryModifier.js.map +1 -0
  154. package/operations/entry/elasticsearch/plugins/search.d.ts +7 -0
  155. package/{helpers/searchPluginsList.js → operations/entry/elasticsearch/plugins/search.js} +8 -10
  156. package/operations/entry/elasticsearch/plugins/search.js.map +1 -0
  157. package/operations/entry/elasticsearch/plugins/sortModifier.d.ts +9 -0
  158. package/operations/entry/elasticsearch/plugins/sortModifier.js +16 -0
  159. package/operations/entry/elasticsearch/plugins/sortModifier.js.map +1 -0
  160. package/operations/entry/elasticsearch/sort.d.ts +12 -0
  161. package/operations/entry/elasticsearch/sort.js +81 -0
  162. package/operations/entry/elasticsearch/sort.js.map +1 -0
  163. package/operations/entry/elasticsearch/transformValueForSearch.d.ts +16 -0
  164. package/operations/entry/elasticsearch/transformValueForSearch.js +30 -0
  165. package/operations/entry/elasticsearch/transformValueForSearch.js.map +1 -0
  166. package/operations/entry/elasticsearch/types.d.ts +41 -0
  167. package/operations/entry/elasticsearch/types.js +5 -0
  168. package/operations/entry/elasticsearch/types.js.map +1 -0
  169. package/operations/entry/index.d.ts +2 -4
  170. package/operations/entry/index.js +502 -496
  171. package/operations/entry/index.js.map +1 -0
  172. package/operations/entry/keys.js +0 -9
  173. package/operations/entry/keys.js.map +1 -0
  174. package/operations/entry/recordType.d.ts +3 -0
  175. package/operations/entry/recordType.js +18 -0
  176. package/operations/entry/recordType.js.map +1 -0
  177. package/operations/group/index.d.ts +2 -2
  178. package/operations/group/index.js +10 -47
  179. package/operations/group/index.js.map +1 -0
  180. package/operations/model/index.d.ts +2 -2
  181. package/operations/model/index.js +34 -68
  182. package/operations/model/index.js.map +1 -0
  183. package/operations/settings/index.d.ts +2 -2
  184. package/operations/settings/index.js +7 -37
  185. package/operations/settings/index.js.map +1 -0
  186. package/operations/system/index.d.ts +2 -2
  187. package/operations/system/index.js +5 -28
  188. package/operations/system/index.js.map +1 -0
  189. package/package.json +31 -29
  190. package/plugins/CmsElasticsearchModelFieldPlugin.d.ts +69 -0
  191. package/plugins/CmsElasticsearchModelFieldPlugin.js +48 -0
  192. package/plugins/CmsElasticsearchModelFieldPlugin.js.map +1 -0
  193. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +7 -3
  194. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +9 -11
  195. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +1 -0
  196. package/plugins/CmsEntryElasticsearchFieldPlugin.d.ts +3 -3
  197. package/plugins/CmsEntryElasticsearchFieldPlugin.js +3 -3
  198. package/plugins/CmsEntryElasticsearchFieldPlugin.js.map +1 -0
  199. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.d.ts +23 -0
  200. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +28 -0
  201. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js.map +1 -0
  202. package/plugins/CmsEntryElasticsearchIndexPlugin.d.ts +4 -0
  203. package/plugins/CmsEntryElasticsearchIndexPlugin.js +12 -0
  204. package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +1 -0
  205. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +31 -0
  206. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +37 -0
  207. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +1 -0
  208. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +4 -3
  209. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +9 -11
  210. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +1 -0
  211. package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +4 -3
  212. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +9 -11
  213. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +1 -0
  214. package/plugins/CmsEntryFilterPlugin.d.ts +49 -0
  215. package/plugins/CmsEntryFilterPlugin.js +24 -0
  216. package/plugins/CmsEntryFilterPlugin.js.map +1 -0
  217. package/plugins/index.d.ts +7 -0
  218. package/plugins/index.js +82 -0
  219. package/plugins/index.js.map +1 -0
  220. package/types.d.ts +8 -35
  221. package/types.js +0 -18
  222. package/types.js.map +1 -0
  223. package/helpers/createElasticsearchQueryBody.d.ts +0 -11
  224. package/helpers/createElasticsearchQueryBody.js +0 -375
  225. package/helpers/fields.d.ts +0 -77
  226. package/helpers/fields.js +0 -174
  227. package/helpers/operatorPluginsList.d.ts +0 -7
  228. package/helpers/operatorPluginsList.js +0 -30
  229. package/helpers/searchPluginsList.d.ts +0 -6
  230. package/helpers/transformValueForSearch.d.ts +0 -9
  231. package/helpers/transformValueForSearch.js +0 -26
  232. package/operations/entry/elasticsearchFields.d.ts +0 -2
  233. package/operations/entry/elasticsearchFields.js +0 -32
  234. package/operations/entry/fields.d.ts +0 -3
  235. package/operations/entry/fields.js +0 -60
  236. package/operations/system/createElasticsearchTemplate.d.ts +0 -5
  237. package/operations/system/createElasticsearchTemplate.js +0 -62
  238. package/upgrades/index.d.ts +0 -2
  239. package/upgrades/index.js +0 -16
  240. package/upgrades/utils.d.ts +0 -1
  241. package/upgrades/utils.js +0 -16
  242. package/upgrades/v5.0.0/cleanDatabaseRecord.d.ts +0 -6
  243. package/upgrades/v5.0.0/cleanDatabaseRecord.js +0 -16
  244. package/upgrades/v5.0.0/createOldVersionIndiceName.d.ts +0 -2
  245. package/upgrades/v5.0.0/createOldVersionIndiceName.js +0 -12
  246. package/upgrades/v5.0.0/entryValueFixer.d.ts +0 -4
  247. package/upgrades/v5.0.0/entryValueFixer.js +0 -124
  248. package/upgrades/v5.0.0/fieldFinder.d.ts +0 -6
  249. package/upgrades/v5.0.0/fieldFinder.js +0 -42
  250. package/upgrades/v5.0.0/helpers.d.ts +0 -4
  251. package/upgrades/v5.0.0/helpers.js +0 -57
  252. package/upgrades/v5.0.0/index.d.ts +0 -4
  253. package/upgrades/v5.0.0/index.js +0 -232
  254. package/upgrades/v5.8.0/index.d.ts +0 -4
  255. package/upgrades/v5.8.0/index.js +0 -426
@@ -0,0 +1,18 @@
1
+ import { BoolQueryConfig } from "@webiny/api-elasticsearch/types";
2
+ /**
3
+ * This function will assign a minimum_should_match for the query if conditions are met:
4
+ * * should is an array
5
+ * * it is not empty
6
+ * * minimum_should_match is not already set
7
+ *
8
+ *
9
+ * By the default we set it to 1 as we want at least one OR condition to produce results.
10
+ *
11
+ * Users can modify minimum_should_match value via the body or query modification plugins.
12
+ */
13
+ interface Params {
14
+ query: BoolQueryConfig;
15
+ value?: number;
16
+ }
17
+ export declare const assignMinimumShouldMatchToQuery: ({ query, value }: Params) => void;
18
+ export {};
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.assignMinimumShouldMatchToQuery = void 0;
7
+ /**
8
+ * This function will assign a minimum_should_match for the query if conditions are met:
9
+ * * should is an array
10
+ * * it is not empty
11
+ * * minimum_should_match is not already set
12
+ *
13
+ *
14
+ * By the default we set it to 1 as we want at least one OR condition to produce results.
15
+ *
16
+ * Users can modify minimum_should_match value via the body or query modification plugins.
17
+ */
18
+
19
+ const assignMinimumShouldMatchToQuery = ({
20
+ query,
21
+ value = 1
22
+ }) => {
23
+ if (!Array.isArray(query.should)) {
24
+ return;
25
+ } else if (query.should.length === 0) {
26
+ return;
27
+ } else if (query.minimum_should_match) {
28
+ return;
29
+ }
30
+ query.minimum_should_match = value > 0 ? value : 1;
31
+ };
32
+ exports.assignMinimumShouldMatchToQuery = assignMinimumShouldMatchToQuery;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["assignMinimumShouldMatchToQuery","query","value","Array","isArray","should","length","minimum_should_match"],"sources":["assignMinimumShouldMatchToQuery.ts"],"sourcesContent":["import { BoolQueryConfig } from \"@webiny/api-elasticsearch/types\";\n\n/**\n * This function will assign a minimum_should_match for the query if conditions are met:\n * * should is an array\n * * it is not empty\n * * minimum_should_match is not already set\n *\n *\n * By the default we set it to 1 as we want at least one OR condition to produce results.\n *\n * Users can modify minimum_should_match value via the body or query modification plugins.\n */\ninterface Params {\n query: BoolQueryConfig;\n value?: number;\n}\nexport const assignMinimumShouldMatchToQuery = ({ query, value = 1 }: Params): void => {\n if (!Array.isArray(query.should)) {\n return;\n } else if (query.should.length === 0) {\n return;\n } else if (query.minimum_should_match) {\n return;\n }\n query.minimum_should_match = value > 0 ? value : 1;\n};\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKO,MAAMA,+BAA+B,GAAG,CAAC;EAAEC,KAAK;EAAEC,KAAK,GAAG;AAAU,CAAC,KAAW;EACnF,IAAI,CAACC,KAAK,CAACC,OAAO,CAACH,KAAK,CAACI,MAAM,CAAC,EAAE;IAC9B;EACJ,CAAC,MAAM,IAAIJ,KAAK,CAACI,MAAM,CAACC,MAAM,KAAK,CAAC,EAAE;IAClC;EACJ,CAAC,MAAM,IAAIL,KAAK,CAACM,oBAAoB,EAAE;IACnC;EACJ;EACAN,KAAK,CAACM,oBAAoB,GAAGL,KAAK,GAAG,CAAC,GAAGA,KAAK,GAAG,CAAC;AACtD,CAAC;AAAC"}
@@ -0,0 +1,13 @@
1
+ import { PluginsContainer } from "@webiny/plugins";
2
+ import { CmsEntryListParams, CmsEntryListWhere, CmsModel } from "@webiny/api-headless-cms/types";
3
+ import { PrimitiveValue, SearchBody } from "@webiny/api-elasticsearch/types";
4
+ interface Params {
5
+ plugins: PluginsContainer;
6
+ model: CmsModel;
7
+ params: Omit<CmsEntryListParams, "where" | "after"> & {
8
+ where: CmsEntryListWhere;
9
+ after?: PrimitiveValue[];
10
+ };
11
+ }
12
+ export declare const createElasticsearchBody: ({ plugins, model, params }: Params) => SearchBody;
13
+ export {};
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createElasticsearchBody = void 0;
7
+ var _fields = require("./fields");
8
+ var _fullTextSearchFields = require("./fullTextSearchFields");
9
+ var _initialQuery = require("./initialQuery");
10
+ var _fullTextSearch = require("./fullTextSearch");
11
+ var _queryModifier = require("./plugins/queryModifier");
12
+ var _sortModifier = require("./plugins/sortModifier");
13
+ var _bodyModifier = require("./plugins/bodyModifier");
14
+ var _sort = require("./sort");
15
+ var _filtering = require("./filtering");
16
+ var _assignMinimumShouldMatchToQuery = require("./assignMinimumShouldMatchToQuery");
17
+ const createElasticsearchBody = ({
18
+ plugins,
19
+ model,
20
+ params
21
+ }) => {
22
+ const {
23
+ fields,
24
+ search: term,
25
+ where,
26
+ sort: initialSort,
27
+ after,
28
+ limit
29
+ } = params;
30
+ /**
31
+ * We need the model fields constructed as a key -> field value, so we do not need to iterate through array when we require some field.
32
+ */
33
+ const modelFields = (0, _fields.createModelFields)({
34
+ plugins,
35
+ model
36
+ });
37
+
38
+ /**
39
+ * We need the query modifier plugins.
40
+ */
41
+ const queryModifierPlugins = (0, _queryModifier.createQueryModifierPluginList)({
42
+ plugins,
43
+ model
44
+ });
45
+ /**
46
+ * We need the sort modifier plugins.
47
+ */
48
+ const sortModifierPlugins = (0, _sortModifier.createSortModifierPluginList)({
49
+ plugins,
50
+ model
51
+ });
52
+ /**
53
+ * We need the body modifier plugins.
54
+ */
55
+ const bodyModifierPlugins = (0, _bodyModifier.createBodyModifierPluginList)({
56
+ plugins,
57
+ model
58
+ });
59
+ /**
60
+ * We need the fields which we can search through via the full text search.
61
+ *
62
+ */
63
+ const fullTextSearchFields = (0, _fullTextSearchFields.createFullTextSearchFields)({
64
+ model,
65
+ term,
66
+ fields
67
+ });
68
+ /**
69
+ * The initial elasticsearch query where we attach some default conditions we always need.
70
+ */
71
+ const query = (0, _initialQuery.createInitialQuery)({
72
+ where,
73
+ model
74
+ });
75
+ /**
76
+ * Apply the full text search, if term is set.
77
+ */
78
+ (0, _fullTextSearch.applyFullTextSearch)({
79
+ model,
80
+ plugins,
81
+ query,
82
+ term,
83
+ fields: fullTextSearchFields
84
+ });
85
+ const execFiltering = (0, _filtering.createExecFiltering)({
86
+ model,
87
+ fields: modelFields,
88
+ plugins
89
+ });
90
+ execFiltering({
91
+ where,
92
+ query
93
+ });
94
+ for (const pl of queryModifierPlugins) {
95
+ pl.modifyQuery({
96
+ query,
97
+ model,
98
+ where
99
+ });
100
+ }
101
+ const sort = (0, _sort.createElasticsearchSort)({
102
+ plugins,
103
+ sort: initialSort,
104
+ modelFields,
105
+ model
106
+ });
107
+ for (const pl of sortModifierPlugins) {
108
+ pl.modifySort({
109
+ sort,
110
+ model
111
+ });
112
+ }
113
+ const boolQuery = {
114
+ must: query.must.length > 0 ? query.must : undefined,
115
+ must_not: query.must_not.length > 0 ? query.must_not : undefined,
116
+ should: query.should.length > 0 ? query.should : undefined,
117
+ filter: query.filter.length > 0 ? query.filter : undefined
118
+ };
119
+ (0, _assignMinimumShouldMatchToQuery.assignMinimumShouldMatchToQuery)({
120
+ query: boolQuery
121
+ });
122
+ const body = {
123
+ query: {
124
+ bool: boolQuery
125
+ },
126
+ sort,
127
+ size: (limit || 0) + 1,
128
+ search_after: after,
129
+ track_total_hits: true
130
+ };
131
+ for (const pl of bodyModifierPlugins) {
132
+ pl.modifyBody({
133
+ body,
134
+ model,
135
+ where
136
+ });
137
+ }
138
+ return body;
139
+ };
140
+ exports.createElasticsearchBody = createElasticsearchBody;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createElasticsearchBody","plugins","model","params","fields","search","term","where","sort","initialSort","after","limit","modelFields","createModelFields","queryModifierPlugins","createQueryModifierPluginList","sortModifierPlugins","createSortModifierPluginList","bodyModifierPlugins","createBodyModifierPluginList","fullTextSearchFields","createFullTextSearchFields","query","createInitialQuery","applyFullTextSearch","execFiltering","createExecFiltering","pl","modifyQuery","createElasticsearchSort","modifySort","boolQuery","must","length","undefined","must_not","should","filter","assignMinimumShouldMatchToQuery","body","bool","size","search_after","track_total_hits","modifyBody"],"sources":["body.ts"],"sourcesContent":["import { PluginsContainer } from \"@webiny/plugins\";\nimport { CmsEntryListParams, CmsEntryListWhere, CmsModel } from \"@webiny/api-headless-cms/types\";\nimport { createModelFields } from \"./fields\";\nimport { createFullTextSearchFields } from \"./fullTextSearchFields\";\nimport { createInitialQuery } from \"./initialQuery\";\nimport { applyFullTextSearch } from \"./fullTextSearch\";\nimport { createQueryModifierPluginList } from \"./plugins/queryModifier\";\nimport { createSortModifierPluginList } from \"./plugins/sortModifier\";\nimport { createBodyModifierPluginList } from \"./plugins/bodyModifier\";\nimport { createElasticsearchSort } from \"./sort\";\nimport { PrimitiveValue, SearchBody, BoolQueryConfig } from \"@webiny/api-elasticsearch/types\";\nimport { createExecFiltering } from \"./filtering\";\nimport { assignMinimumShouldMatchToQuery } from \"./assignMinimumShouldMatchToQuery\";\n\ninterface Params {\n plugins: PluginsContainer;\n model: CmsModel;\n params: Omit<CmsEntryListParams, \"where\" | \"after\"> & {\n where: CmsEntryListWhere;\n after?: PrimitiveValue[];\n };\n}\nexport const createElasticsearchBody = ({ plugins, model, params }: Params): SearchBody => {\n const { fields, search: term, where, sort: initialSort, after, limit } = params;\n /**\n * We need the model fields constructed as a key -> field value, so we do not need to iterate through array when we require some field.\n */\n const modelFields = createModelFields({\n plugins,\n model\n });\n\n /**\n * We need the query modifier plugins.\n */\n const queryModifierPlugins = createQueryModifierPluginList({\n plugins,\n model\n });\n /**\n * We need the sort modifier plugins.\n */\n const sortModifierPlugins = createSortModifierPluginList({\n plugins,\n model\n });\n /**\n * We need the body modifier plugins.\n */\n const bodyModifierPlugins = createBodyModifierPluginList({\n plugins,\n model\n });\n /**\n * We need the fields which we can search through via the full text search.\n *\n */\n const fullTextSearchFields = createFullTextSearchFields({\n model,\n term,\n fields\n });\n /**\n * The initial elasticsearch query where we attach some default conditions we always need.\n */\n const query = createInitialQuery({\n where,\n model\n });\n /**\n * Apply the full text search, if term is set.\n */\n applyFullTextSearch({\n model,\n plugins,\n query,\n term,\n fields: fullTextSearchFields\n });\n\n const execFiltering = createExecFiltering({\n model,\n fields: modelFields,\n plugins\n });\n\n execFiltering({\n where,\n query\n });\n\n for (const pl of queryModifierPlugins) {\n pl.modifyQuery({ query, model, where });\n }\n\n const sort = createElasticsearchSort({\n plugins,\n sort: initialSort,\n modelFields,\n model\n });\n\n for (const pl of sortModifierPlugins) {\n pl.modifySort({\n sort,\n model\n });\n }\n\n const boolQuery: BoolQueryConfig = {\n must: query.must.length > 0 ? query.must : undefined,\n must_not: query.must_not.length > 0 ? query.must_not : undefined,\n should: query.should.length > 0 ? query.should : undefined,\n filter: query.filter.length > 0 ? query.filter : undefined\n };\n\n assignMinimumShouldMatchToQuery({\n query: boolQuery\n });\n\n const body: SearchBody = {\n query: {\n bool: boolQuery\n },\n sort,\n size: (limit || 0) + 1,\n search_after: after,\n track_total_hits: true\n };\n\n for (const pl of bodyModifierPlugins) {\n pl.modifyBody({\n body,\n model,\n where\n });\n }\n\n return body;\n};\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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0 +1,10 @@
1
+ import { PluginsContainer } from "@webiny/plugins";
2
+ import { CmsModel } from "@webiny/api-headless-cms/types";
3
+ interface Params {
4
+ plugins: PluginsContainer;
5
+ model: CmsModel;
6
+ }
7
+ export declare const createModelFields: ({ plugins, model }: Params) => {
8
+ [x: string]: import("./types").ModelField;
9
+ };
10
+ export {};
@@ -0,0 +1,261 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.createModelFields = void 0;
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
+ var _error = _interopRequireDefault(require("@webiny/error"));
10
+ var _plugins = require("../../../plugins");
11
+ const createSystemField = field => {
12
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, field), {}, {
13
+ id: field.fieldId,
14
+ label: field.fieldId
15
+ });
16
+ };
17
+ const createSystemFields = () => {
18
+ return {
19
+ id: {
20
+ type: "text",
21
+ systemField: true,
22
+ searchable: true,
23
+ sortable: true,
24
+ field: createSystemField({
25
+ storageId: "id",
26
+ fieldId: "id",
27
+ type: "text"
28
+ }),
29
+ parents: []
30
+ },
31
+ entryId: {
32
+ type: "text",
33
+ systemField: true,
34
+ searchable: true,
35
+ sortable: true,
36
+ field: createSystemField({
37
+ storageId: "entryId",
38
+ fieldId: "entryId",
39
+ type: "text"
40
+ }),
41
+ parents: []
42
+ },
43
+ savedOn: {
44
+ type: "date",
45
+ unmappedType: "date",
46
+ keyword: false,
47
+ systemField: true,
48
+ searchable: true,
49
+ sortable: true,
50
+ field: createSystemField({
51
+ storageId: "savedOn",
52
+ fieldId: "savedOn",
53
+ type: "datetime",
54
+ settings: {
55
+ type: "dateTimeWithoutTimezone"
56
+ }
57
+ }),
58
+ parents: []
59
+ },
60
+ createdOn: {
61
+ type: "date",
62
+ unmappedType: "date",
63
+ keyword: false,
64
+ systemField: true,
65
+ searchable: true,
66
+ sortable: true,
67
+ field: createSystemField({
68
+ storageId: "createdOn",
69
+ fieldId: "createdOn",
70
+ type: "text",
71
+ settings: {
72
+ type: "dateTimeWithoutTimezone"
73
+ }
74
+ }),
75
+ parents: []
76
+ },
77
+ createdBy: {
78
+ type: "text",
79
+ unmappedType: undefined,
80
+ systemField: true,
81
+ searchable: true,
82
+ sortable: false,
83
+ path: "createdBy.id",
84
+ field: createSystemField({
85
+ storageId: "createdBy",
86
+ fieldId: "createdBy",
87
+ type: "text"
88
+ }),
89
+ parents: []
90
+ },
91
+ ownedBy: {
92
+ type: "text",
93
+ unmappedType: undefined,
94
+ systemField: true,
95
+ searchable: true,
96
+ sortable: false,
97
+ path: "ownedBy.id",
98
+ field: createSystemField({
99
+ storageId: "ownedBy",
100
+ fieldId: "ownedBy",
101
+ type: "text"
102
+ }),
103
+ parents: []
104
+ },
105
+ version: {
106
+ type: "number",
107
+ unmappedType: undefined,
108
+ keyword: false,
109
+ systemField: true,
110
+ searchable: true,
111
+ sortable: true,
112
+ field: createSystemField({
113
+ storageId: "version",
114
+ fieldId: "version",
115
+ type: "number"
116
+ }),
117
+ parents: []
118
+ },
119
+ status: {
120
+ type: "string",
121
+ unmappedType: undefined,
122
+ keyword: false,
123
+ systemField: true,
124
+ searchable: true,
125
+ sortable: false,
126
+ field: createSystemField({
127
+ storageId: "status",
128
+ fieldId: "status",
129
+ type: "string"
130
+ }),
131
+ parents: []
132
+ }
133
+ };
134
+ };
135
+ const buildCustomFields = params => {
136
+ const {
137
+ fields,
138
+ fieldTypePlugins
139
+ } = params;
140
+ return fields.reduce((collection, field) => {
141
+ const typePlugin = fieldTypePlugins[field.fieldType];
142
+ if (!typePlugin) {
143
+ return collection;
144
+ }
145
+ let unmappedType = undefined;
146
+ if (typePlugin.unmappedType) {
147
+ unmappedType = typePlugin.unmappedType(field);
148
+ }
149
+ collection[field.fieldId] = {
150
+ type: field.fieldType,
151
+ field: createSystemField({
152
+ storageId: field.fieldId,
153
+ fieldId: field.fieldId,
154
+ type: field.fieldType
155
+ }),
156
+ unmappedType,
157
+ fullTextSearch: field.searchable ? typePlugin.fullTextSearch : false,
158
+ searchable: field.searchable || typePlugin.searchable,
159
+ sortable: field.sortable || typePlugin.sortable,
160
+ systemField: false,
161
+ path: field.path,
162
+ parents: []
163
+ };
164
+ return collection;
165
+ }, {});
166
+ };
167
+ const buildFieldsList = params => {
168
+ const {
169
+ plugins,
170
+ fields,
171
+ parents
172
+ } = params;
173
+ return fields.reduce((result, field) => {
174
+ var _field$settings;
175
+ const plugin = plugins[field.type];
176
+ if (!plugin) {
177
+ throw new _error.default(`There is no plugin for field type "${field.type}".`);
178
+ }
179
+ const {
180
+ searchable,
181
+ sortable,
182
+ unmappedType,
183
+ fullTextSearch
184
+ } = plugin;
185
+ /**
186
+ * If a field has child fields, go through them and add them to a result.
187
+ */
188
+ const childFields = ((_field$settings = field.settings) === null || _field$settings === void 0 ? void 0 : _field$settings.fields) || [];
189
+ if (childFields.length > 0) {
190
+ /**
191
+ * Let's build all the child fields
192
+ */
193
+ const childResult = buildFieldsList({
194
+ fields: childFields,
195
+ plugins,
196
+ parents: [...parents, {
197
+ fieldId: field.fieldId,
198
+ storageId: field.storageId,
199
+ type: field.type
200
+ }]
201
+ });
202
+ Object.assign(result, childResult);
203
+ }
204
+ const identifier = [...parents.map(p => p.fieldId), field.fieldId].join(".");
205
+ result[identifier] = {
206
+ type: field.type,
207
+ parents,
208
+ searchable,
209
+ sortable,
210
+ fullTextSearch,
211
+ unmappedType: typeof unmappedType === "function" ? unmappedType(field) : undefined,
212
+ systemField: false,
213
+ field
214
+ };
215
+ return result;
216
+ }, {});
217
+ };
218
+ const createModelFields = ({
219
+ plugins,
220
+ model
221
+ }) => {
222
+ const fields = model.fields;
223
+ const fieldDefinitionPlugins = plugins.byType(_plugins.CmsElasticsearchModelFieldPlugin.type).filter(plugin => {
224
+ return plugin.canBeApplied(model.modelId);
225
+ });
226
+ /**
227
+ * Collect all unmappedType from elastic plugins.
228
+ */
229
+ const unmappedTypes = plugins.byType("cms-model-field-to-elastic-search").reduce((acc, plugin) => {
230
+ if (!plugin.unmappedType) {
231
+ return acc;
232
+ }
233
+ acc[plugin.fieldType] = plugin.unmappedType;
234
+ return acc;
235
+ }, {});
236
+ /**
237
+ * Collect all field types from the plugins.
238
+ */
239
+ const fieldTypePlugins = plugins.byType("cms-model-field-to-graphql").reduce((types, plugin) => {
240
+ const {
241
+ fieldType,
242
+ fullTextSearch
243
+ } = plugin;
244
+ types[fieldType] = {
245
+ unmappedType: unmappedTypes[fieldType],
246
+ searchable: plugin.isSearchable,
247
+ sortable: plugin.isSortable,
248
+ fullTextSearch
249
+ };
250
+ return types;
251
+ }, {});
252
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, createSystemFields()), buildCustomFields({
253
+ fields: fieldDefinitionPlugins,
254
+ fieldTypePlugins
255
+ })), buildFieldsList({
256
+ fields,
257
+ plugins: fieldTypePlugins,
258
+ parents: []
259
+ }));
260
+ };
261
+ exports.createModelFields = createModelFields;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createSystemField","field","id","fieldId","label","createSystemFields","type","systemField","searchable","sortable","storageId","parents","entryId","savedOn","unmappedType","keyword","settings","createdOn","createdBy","undefined","path","ownedBy","version","status","buildCustomFields","params","fields","fieldTypePlugins","reduce","collection","typePlugin","fieldType","fullTextSearch","buildFieldsList","plugins","result","plugin","WebinyError","childFields","length","childResult","Object","assign","identifier","map","p","join","createModelFields","model","fieldDefinitionPlugins","byType","CmsElasticsearchModelFieldPlugin","filter","canBeApplied","modelId","unmappedTypes","acc","types","isSearchable","isSortable"],"sources":["fields.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport {\n CmsModel,\n CmsModelField,\n CmsModelFieldToGraphQLPlugin\n} from \"@webiny/api-headless-cms/types\";\nimport { CmsModelFieldToElasticsearchPlugin } from \"~/types\";\nimport { ModelFieldParent, ModelFields } from \"./types\";\nimport { CmsElasticsearchModelFieldPlugin } from \"~/plugins\";\n\ntype PartialCmsModelField = Partial<CmsModelField> &\n Pick<CmsModelField, \"storageId\" | \"fieldId\" | \"type\">;\nconst createSystemField = (field: PartialCmsModelField): CmsModelField => {\n return {\n ...field,\n id: field.fieldId,\n label: field.fieldId\n };\n};\n\nconst createSystemFields = (): ModelFields => {\n return {\n id: {\n type: \"text\",\n systemField: true,\n searchable: true,\n sortable: true,\n field: createSystemField({\n storageId: \"id\",\n fieldId: \"id\",\n type: \"text\"\n }),\n parents: []\n },\n entryId: {\n type: \"text\",\n systemField: true,\n searchable: true,\n sortable: true,\n field: createSystemField({\n storageId: \"entryId\",\n fieldId: \"entryId\",\n type: \"text\"\n }),\n parents: []\n },\n savedOn: {\n type: \"date\",\n unmappedType: \"date\",\n keyword: false,\n systemField: true,\n searchable: true,\n sortable: true,\n field: createSystemField({\n storageId: \"savedOn\",\n fieldId: \"savedOn\",\n type: \"datetime\",\n settings: {\n type: \"dateTimeWithoutTimezone\"\n }\n }),\n parents: []\n },\n createdOn: {\n type: \"date\",\n unmappedType: \"date\",\n keyword: false,\n systemField: true,\n searchable: true,\n sortable: true,\n field: createSystemField({\n storageId: \"createdOn\",\n fieldId: \"createdOn\",\n type: \"text\",\n settings: {\n type: \"dateTimeWithoutTimezone\"\n }\n }),\n parents: []\n },\n createdBy: {\n type: \"text\",\n unmappedType: undefined,\n systemField: true,\n searchable: true,\n sortable: false,\n path: \"createdBy.id\",\n field: createSystemField({\n storageId: \"createdBy\",\n fieldId: \"createdBy\",\n type: \"text\"\n }),\n parents: []\n },\n ownedBy: {\n type: \"text\",\n unmappedType: undefined,\n systemField: true,\n searchable: true,\n sortable: false,\n path: \"ownedBy.id\",\n field: createSystemField({\n storageId: \"ownedBy\",\n fieldId: \"ownedBy\",\n type: \"text\"\n }),\n parents: []\n },\n version: {\n type: \"number\",\n unmappedType: undefined,\n keyword: false,\n systemField: true,\n searchable: true,\n sortable: true,\n field: createSystemField({\n storageId: \"version\",\n fieldId: \"version\",\n type: \"number\"\n }),\n parents: []\n },\n status: {\n type: \"string\",\n unmappedType: undefined,\n keyword: false,\n systemField: true,\n searchable: true,\n sortable: false,\n field: createSystemField({\n storageId: \"status\",\n fieldId: \"status\",\n type: \"string\"\n }),\n parents: []\n }\n };\n};\n\ninterface UnmappedFieldTypes {\n [type: string]: (field: Pick<CmsModelField, \"fieldId\" | \"type\">) => string | undefined;\n}\n\ninterface FieldTypePlugin {\n unmappedType?: (field: Pick<CmsModelField, \"fieldId\" | \"type\">) => string | undefined;\n searchable: boolean;\n sortable: boolean;\n fullTextSearch?: boolean;\n}\n\ninterface FieldTypePlugins {\n [key: string]: FieldTypePlugin;\n}\n\ninterface BuildCustomFieldsParams {\n fields: CmsElasticsearchModelFieldPlugin[];\n fieldTypePlugins: FieldTypePlugins;\n}\n\nconst buildCustomFields = (params: BuildCustomFieldsParams) => {\n const { fields, fieldTypePlugins } = params;\n\n return fields.reduce<ModelFields>((collection, field) => {\n const typePlugin = fieldTypePlugins[field.fieldType];\n if (!typePlugin) {\n return collection;\n }\n let unmappedType: string | undefined = undefined;\n if (typePlugin.unmappedType) {\n unmappedType = typePlugin.unmappedType(field);\n }\n\n collection[field.fieldId] = {\n type: field.fieldType,\n field: createSystemField({\n storageId: field.fieldId,\n fieldId: field.fieldId,\n type: field.fieldType\n }),\n unmappedType,\n fullTextSearch: field.searchable ? typePlugin.fullTextSearch : false,\n searchable: field.searchable || typePlugin.searchable,\n sortable: field.sortable || typePlugin.sortable,\n systemField: false,\n path: field.path,\n parents: []\n };\n\n return collection;\n }, {});\n};\n\ninterface BuildParams {\n plugins: FieldTypePlugins;\n fields: CmsModelField[];\n parents: ModelFieldParent[];\n}\n\nconst buildFieldsList = (params: BuildParams): ModelFields => {\n const { plugins, fields, parents } = params;\n\n return fields.reduce<ModelFields>((result, field) => {\n const plugin = plugins[field.type];\n if (!plugin) {\n throw new WebinyError(`There is no plugin for field type \"${field.type}\".`);\n }\n\n const { searchable, sortable, unmappedType, fullTextSearch } = plugin;\n /**\n * If a field has child fields, go through them and add them to a result.\n */\n const childFields = field.settings?.fields || [];\n if (childFields.length > 0) {\n /**\n * Let's build all the child fields\n */\n const childResult = buildFieldsList({\n fields: childFields,\n plugins,\n parents: [\n ...parents,\n {\n fieldId: field.fieldId,\n storageId: field.storageId,\n type: field.type\n }\n ]\n });\n Object.assign(result, childResult);\n }\n\n const identifier = [...parents.map(p => p.fieldId), field.fieldId].join(\".\");\n\n result[identifier] = {\n type: field.type,\n parents,\n searchable,\n sortable,\n fullTextSearch,\n unmappedType: typeof unmappedType === \"function\" ? unmappedType(field) : undefined,\n systemField: false,\n field\n };\n\n return result;\n }, {});\n};\n\ninterface Params {\n plugins: PluginsContainer;\n model: CmsModel;\n}\n\nexport const createModelFields = ({ plugins, model }: Params) => {\n const fields = model.fields;\n const fieldDefinitionPlugins = plugins\n .byType<CmsElasticsearchModelFieldPlugin>(CmsElasticsearchModelFieldPlugin.type)\n .filter(plugin => {\n return plugin.canBeApplied(model.modelId);\n });\n /**\n * Collect all unmappedType from elastic plugins.\n */\n const unmappedTypes = plugins\n .byType<CmsModelFieldToElasticsearchPlugin>(\"cms-model-field-to-elastic-search\")\n .reduce<UnmappedFieldTypes>((acc, plugin) => {\n if (!plugin.unmappedType) {\n return acc;\n }\n acc[plugin.fieldType] = plugin.unmappedType;\n return acc;\n }, {});\n /**\n * Collect all field types from the plugins.\n */\n const fieldTypePlugins = plugins\n .byType<CmsModelFieldToGraphQLPlugin>(\"cms-model-field-to-graphql\")\n .reduce<FieldTypePlugins>((types, plugin) => {\n const { fieldType, fullTextSearch } = plugin;\n types[fieldType] = {\n unmappedType: unmappedTypes[fieldType],\n searchable: plugin.isSearchable,\n sortable: plugin.isSortable,\n fullTextSearch\n };\n return types;\n }, {});\n\n return {\n ...createSystemFields(),\n ...buildCustomFields({\n fields: fieldDefinitionPlugins,\n fieldTypePlugins\n }),\n ...buildFieldsList({\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M,KAAK;IACzC,MAAM;MAAEL,SAAS;MAAEC;IAAe,CAAC,GAAGI,MAAM;IAC5CqB,KAAK,CAAC1B,SAAS,CAAC,GAAG;MACfjB,YAAY,EAAEyC,aAAa,CAACxB,SAAS,CAAC;MACtCvB,UAAU,EAAE4B,MAAM,CAACsB,YAAY;MAC/BjD,QAAQ,EAAE2B,MAAM,CAACuB,UAAU;MAC3B3B;IACJ,CAAC;IACD,OAAOyB,KAAK;EAChB,CAAC,EAAE,CAAC,CAAC,CAAC;EAEV,+FACOpD,kBAAkB,EAAE,GACpBmB,iBAAiB,CAAC;IACjBE,MAAM,EAAEuB,sBAAsB;IAC9BtB;EACJ,CAAC,CAAC,GACCM,eAAe,CAAC;IACfP,MAAM;IACNQ,OAAO,EAAEP,gBAAgB;IACzBhB,OAAO,EAAE;EACb,CAAC,CAAC;AAEV,CAAC;AAAC"}
@@ -0,0 +1,8 @@
1
+ import { ElasticsearchQueryBuilderOperatorPlugins, ElasticsearchQuerySearchValuePlugins } from "../types";
2
+ import { ApplyFilteringCb } from "../../../../plugins/CmsEntryFilterPlugin";
3
+ interface CreateParams {
4
+ operatorPlugins: ElasticsearchQueryBuilderOperatorPlugins;
5
+ searchPlugins: ElasticsearchQuerySearchValuePlugins;
6
+ }
7
+ export declare const createApplyFiltering: ({ operatorPlugins, searchPlugins }: CreateParams) => ApplyFilteringCb;
8
+ export {};
@@ -0,0 +1,57 @@
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 = ({
13
+ operatorPlugins,
14
+ searchPlugins
15
+ }) => {
16
+ const createFieldPath = (0, _path.createFieldPathFactory)({
17
+ plugins: searchPlugins
18
+ });
19
+ return params => {
20
+ const {
21
+ key,
22
+ value: initialValue,
23
+ query,
24
+ operator,
25
+ field
26
+ } = params;
27
+ const plugin = operatorPlugins[operator];
28
+ if (!plugin) {
29
+ throw new _error.default(`Elasticsearch operator "${operator}" plugin missing.`, "PLUGIN_MISSING", {
30
+ operator
31
+ });
32
+ }
33
+ const value = (0, _transformValueForSearch.transformValueForSearch)({
34
+ plugins: searchPlugins,
35
+ field: field.field,
36
+ value: initialValue
37
+ });
38
+ const keyword = (0, _keyword.hasKeyword)(field);
39
+ const {
40
+ basePath,
41
+ path
42
+ } = createFieldPath({
43
+ field,
44
+ value,
45
+ key,
46
+ keyword
47
+ });
48
+ plugin.apply(query, {
49
+ name: field.field.fieldId,
50
+ basePath,
51
+ path,
52
+ value,
53
+ keyword
54
+ });
55
+ };
56
+ };
57
+ exports.createApplyFiltering = createApplyFiltering;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createApplyFiltering","operatorPlugins","searchPlugins","createFieldPath","createFieldPathFactory","plugins","params","key","value","initialValue","query","operator","field","plugin","WebinyError","transformValueForSearch","keyword","hasKeyword","basePath","path","apply","name","fieldId"],"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;AACA;AACA;AAKA;AAQO,MAAMA,oBAAoB,GAAG,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,CAAC,CACJ;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;AAAC"}
@@ -0,0 +1,17 @@
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";
5
+ export interface CreateExecParams {
6
+ model: CmsModel;
7
+ fields: ModelFields;
8
+ plugins: PluginsContainer;
9
+ }
10
+ export interface ExecParams {
11
+ where: CmsEntryListWhere;
12
+ query: ElasticsearchBoolQueryConfig;
13
+ }
14
+ export interface CreateExecFilteringResponse {
15
+ (params: ExecParams): void;
16
+ }
17
+ export declare const createExecFiltering: (params: CreateExecParams) => CreateExecFilteringResponse;