@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,82 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _CmsEntryElasticsearchBodyModifierPlugin = require("./CmsEntryElasticsearchBodyModifierPlugin");
7
+ Object.keys(_CmsEntryElasticsearchBodyModifierPlugin).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _CmsEntryElasticsearchBodyModifierPlugin[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _CmsEntryElasticsearchBodyModifierPlugin[key];
14
+ }
15
+ });
16
+ });
17
+ var _CmsEntryElasticsearchIndexPlugin = require("./CmsEntryElasticsearchIndexPlugin");
18
+ Object.keys(_CmsEntryElasticsearchIndexPlugin).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _CmsEntryElasticsearchIndexPlugin[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _CmsEntryElasticsearchIndexPlugin[key];
25
+ }
26
+ });
27
+ });
28
+ var _CmsEntryElasticsearchQueryBuilderValueSearchPlugin = require("./CmsEntryElasticsearchQueryBuilderValueSearchPlugin");
29
+ Object.keys(_CmsEntryElasticsearchQueryBuilderValueSearchPlugin).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _CmsEntryElasticsearchQueryBuilderValueSearchPlugin[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _CmsEntryElasticsearchQueryBuilderValueSearchPlugin[key];
36
+ }
37
+ });
38
+ });
39
+ var _CmsEntryElasticsearchQueryModifierPlugin = require("./CmsEntryElasticsearchQueryModifierPlugin");
40
+ Object.keys(_CmsEntryElasticsearchQueryModifierPlugin).forEach(function (key) {
41
+ if (key === "default" || key === "__esModule") return;
42
+ if (key in exports && exports[key] === _CmsEntryElasticsearchQueryModifierPlugin[key]) return;
43
+ Object.defineProperty(exports, key, {
44
+ enumerable: true,
45
+ get: function () {
46
+ return _CmsEntryElasticsearchQueryModifierPlugin[key];
47
+ }
48
+ });
49
+ });
50
+ var _CmsEntryElasticsearchSortModifierPlugin = require("./CmsEntryElasticsearchSortModifierPlugin");
51
+ Object.keys(_CmsEntryElasticsearchSortModifierPlugin).forEach(function (key) {
52
+ if (key === "default" || key === "__esModule") return;
53
+ if (key in exports && exports[key] === _CmsEntryElasticsearchSortModifierPlugin[key]) return;
54
+ Object.defineProperty(exports, key, {
55
+ enumerable: true,
56
+ get: function () {
57
+ return _CmsEntryElasticsearchSortModifierPlugin[key];
58
+ }
59
+ });
60
+ });
61
+ var _CmsEntryElasticsearchFullTextSearchPlugin = require("./CmsEntryElasticsearchFullTextSearchPlugin");
62
+ Object.keys(_CmsEntryElasticsearchFullTextSearchPlugin).forEach(function (key) {
63
+ if (key === "default" || key === "__esModule") return;
64
+ if (key in exports && exports[key] === _CmsEntryElasticsearchFullTextSearchPlugin[key]) return;
65
+ Object.defineProperty(exports, key, {
66
+ enumerable: true,
67
+ get: function () {
68
+ return _CmsEntryElasticsearchFullTextSearchPlugin[key];
69
+ }
70
+ });
71
+ });
72
+ var _CmsElasticsearchModelFieldPlugin = require("./CmsElasticsearchModelFieldPlugin");
73
+ Object.keys(_CmsElasticsearchModelFieldPlugin).forEach(function (key) {
74
+ if (key === "default" || key === "__esModule") return;
75
+ if (key in exports && exports[key] === _CmsElasticsearchModelFieldPlugin[key]) return;
76
+ Object.defineProperty(exports, key, {
77
+ enumerable: true,
78
+ get: function () {
79
+ return _CmsElasticsearchModelFieldPlugin[key];
80
+ }
81
+ });
82
+ });
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./CmsEntryElasticsearchBodyModifierPlugin\";\nexport * from \"./CmsEntryElasticsearchIndexPlugin\";\nexport * from \"./CmsEntryElasticsearchQueryBuilderValueSearchPlugin\";\nexport * from \"./CmsEntryElasticsearchQueryModifierPlugin\";\nexport * from \"./CmsEntryElasticsearchSortModifierPlugin\";\nexport * from \"./CmsEntryElasticsearchFullTextSearchPlugin\";\nexport * from \"./CmsElasticsearchModelFieldPlugin\";\n"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
package/types.d.ts CHANGED
@@ -1,40 +1,11 @@
1
- import { Plugin } from "@webiny/plugins/types";
2
- import { CmsEntry, CmsModel, CmsModelField, CmsModelFieldToGraphQLPlugin, HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations } from "@webiny/api-headless-cms/types";
1
+ import { Plugin, PluginCollection } from "@webiny/plugins/types";
2
+ import { CmsContext as BaseCmsContext, CmsEntry, CmsModel, CmsModelField, CmsModelFieldToGraphQLPlugin, HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations } from "@webiny/api-headless-cms/types";
3
3
  import { DynamoDBTypes, TableConstructor } from "dynamodb-toolbox/dist/classes/Table";
4
4
  import { DocumentClient } from "aws-sdk/clients/dynamodb";
5
5
  import { EntityAttributeConfig, EntityCompositeAttributes } from "dynamodb-toolbox/dist/classes/Entity";
6
6
  import { Client } from "@elastic/elasticsearch";
7
7
  import { Entity, Table } from "dynamodb-toolbox";
8
8
  import { PluginsContainer } from "@webiny/plugins";
9
- /**
10
- * Arguments for ElasticsearchQueryBuilderValueSearchPlugin.
11
- *
12
- * @see ElasticsearchQueryBuilderValueSearchPlugin.transform
13
- */
14
- interface ElasticsearchQueryBuilderValueSearchPluginArgs {
15
- field: CmsModelField;
16
- value: any;
17
- }
18
- /**
19
- * A plugin definition for transforming the search value for Elasticsearch.
20
- *
21
- * @category Plugin
22
- * @category Elasticsearch
23
- */
24
- export interface ElasticsearchQueryBuilderValueSearchPlugin extends Plugin {
25
- /**
26
- * A plugin type.
27
- */
28
- type: "cms-elastic-search-query-builder-value-search";
29
- /**
30
- * A field type for plugin to target.
31
- */
32
- fieldType: string;
33
- /**
34
- * Transform value that is going to be searched for in the Elasticsearch.
35
- */
36
- transform: (args: ElasticsearchQueryBuilderValueSearchPluginArgs) => any;
37
- }
38
9
  /**
39
10
  * A definition of the entry that is being prepared for the Elasticsearch.
40
11
  *
@@ -131,7 +102,7 @@ export interface CmsModelFieldToElasticsearchPlugin extends Plugin {
131
102
  * unmappedType: "date"
132
103
  * ```
133
104
  */
134
- unmappedType?: (field: CmsModelField) => string;
105
+ unmappedType?: (field: Pick<CmsModelField, "fieldId" | "type">) => string;
135
106
  /**
136
107
  * This is meant to do some transformation of the entry, preferably only to fieldType it was defined for. Nothing is stopping you to do anything you want to other fields, but try to separate field transformations.
137
108
  * It returns `Partial<CmsContentIndexEntryType>`. Always return a top-level property of the entry since it is merged via spread operator.
@@ -176,11 +147,10 @@ export interface StorageOperationsFactoryParams {
176
147
  elasticsearch: Client;
177
148
  table?: TableModifier;
178
149
  esTable?: TableModifier;
179
- modelFieldToGraphQLPlugins: CmsModelFieldToGraphQLPlugin[];
180
150
  attributes?: Record<ENTITIES, Attributes>;
181
- plugins?: Plugin[] | Plugin[][];
151
+ plugins?: PluginCollection;
182
152
  }
183
- export interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations {
153
+ export interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations<CmsContext> {
184
154
  getTable: () => Table;
185
155
  getEsTable: () => Table;
186
156
  getEntities: () => Record<"system" | "settings" | "groups" | "models" | "entries" | "entriesEs", Entity<any>>;
@@ -188,4 +158,7 @@ export interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOper
188
158
  export interface StorageOperationsFactory {
189
159
  (params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;
190
160
  }
161
+ export interface CmsContext extends BaseCmsContext {
162
+ [key: string]: any;
163
+ }
191
164
  export {};
package/types.js CHANGED
@@ -4,41 +4,24 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ENTITIES = void 0;
7
-
8
- /**
9
- * Arguments for ElasticsearchQueryBuilderValueSearchPlugin.
10
- *
11
- * @see ElasticsearchQueryBuilderValueSearchPlugin.transform
12
- */
13
-
14
- /**
15
- * A plugin definition for transforming the search value for Elasticsearch.
16
- *
17
- * @category Plugin
18
- * @category Elasticsearch
19
- */
20
-
21
7
  /**
22
8
  * A definition of the entry that is being prepared for the Elasticsearch.
23
9
  *
24
10
  * @category Elasticsearch
25
11
  * @category CmsEntry
26
12
  */
27
-
28
13
  /**
29
14
  * Arguments for the method that is transforming content entry in its original form to the one we are storing to the Elasticsearch.
30
15
  *
31
16
  * @category Elasticsearch
32
17
  * @category CmsEntry
33
18
  */
34
-
35
19
  /**
36
20
  * Arguments for the method that is transforming content entry from Elasticsearch into the original one.
37
21
  *
38
22
  * @category Elasticsearch
39
23
  * @category CmsEntry
40
24
  */
41
-
42
25
  /**
43
26
  * A plugin defining transformation of entry for Elasticsearch.
44
27
  *
@@ -49,7 +32,6 @@ exports.ENTITIES = void 0;
49
32
  */
50
33
  let ENTITIES;
51
34
  exports.ENTITIES = ENTITIES;
52
-
53
35
  (function (ENTITIES) {
54
36
  ENTITIES["SYSTEM"] = "CmsSystem";
55
37
  ENTITIES["SETTINGS"] = "CmsSettings";
package/types.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ENTITIES"],"sources":["types.ts"],"sourcesContent":["import { Plugin, PluginCollection } from \"@webiny/plugins/types\";\nimport {\n CmsContext as BaseCmsContext,\n CmsEntry,\n CmsModel,\n CmsModelField,\n CmsModelFieldToGraphQLPlugin,\n HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations\n} from \"@webiny/api-headless-cms/types\";\nimport { DynamoDBTypes, TableConstructor } from \"dynamodb-toolbox/dist/classes/Table\";\nimport { DocumentClient } from \"aws-sdk/clients/dynamodb\";\nimport {\n EntityAttributeConfig,\n EntityCompositeAttributes\n} from \"dynamodb-toolbox/dist/classes/Entity\";\nimport { Client } from \"@elastic/elasticsearch\";\nimport { Entity, Table } from \"dynamodb-toolbox\";\nimport { PluginsContainer } from \"@webiny/plugins\";\n\n/**\n * A definition of the entry that is being prepared for the Elasticsearch.\n *\n * @category Elasticsearch\n * @category CmsEntry\n */\nexport interface CmsIndexEntry extends CmsEntry {\n /**\n * Values that are not going to be indexed.\n */\n rawValues: Record<string, any>;\n /**\n * A first part of the ID, without the revision.\n * For example, we can search for all the revisions of the given entry.\n */\n primaryId: string;\n /**\n * Dev can add what ever keys they want and need. Just need to be careful not to break the entry.\n */\n [key: string]: any;\n}\n\n/**\n * Arguments for the method that is transforming content entry in its original form to the one we are storing to the Elasticsearch.\n *\n * @category Elasticsearch\n * @category CmsEntry\n */\ninterface CmsModelFieldToElasticsearchToParams {\n plugins: PluginsContainer;\n model: CmsModel;\n field: CmsModelField;\n /**\n * Raw value on the entry - before prepare for storage.\n */\n rawValue: any;\n /**\n * Value prepared for storage received from base api-headless-cms package.\n */\n value: any;\n getFieldIndexPlugin(fieldType: string): CmsModelFieldToElasticsearchPlugin;\n getFieldTypePlugin(fieldType: string): CmsModelFieldToGraphQLPlugin;\n}\n\n/**\n * Arguments for the method that is transforming content entry from Elasticsearch into the original one.\n *\n * @category Elasticsearch\n * @category CmsEntry\n */\ninterface CmsModelFieldToElasticsearchFromParams {\n plugins: PluginsContainer;\n model: CmsModel;\n field: CmsModelField;\n value: any;\n rawValue: any;\n getFieldIndexPlugin(fieldType: string): CmsModelFieldToElasticsearchPlugin;\n getFieldTypePlugin(fieldType: string): CmsModelFieldToGraphQLPlugin;\n}\n\ninterface ToIndexValue {\n /**\n * Use this key to store value for indexing.\n */\n value?: any;\n /**\n * Use this key to tell ES that this value should not be indexed.\n */\n rawValue?: any;\n}\n\n/**\n * A plugin defining transformation of entry for Elasticsearch.\n *\n * @category Plugin\n * @category ContentModelField\n * @category CmsEntry\n * @category Elasticsearch\n */\nexport interface CmsModelFieldToElasticsearchPlugin extends Plugin {\n /**\n * A plugin type\n */\n type: \"cms-model-field-to-elastic-search\";\n /**\n * A unique identifier of the field type (text, number, json, myField, ...).\n *\n * ```ts\n * fieldType: \"myField\"\n * ```\n */\n fieldType: string;\n /**\n * If you need to define a type when building an Elasticsearch query.\n * Check [dateTimeIndexing](https://github.com/webiny/webiny-js/blob/3074165701b8b45e5fc6ac2444caace7d04ada66/packages/api-headless-cms/src/content/plugins/es/indexing/dateTimeIndexing.ts) plugin for usage example.\n *\n * ```ts\n * unmappedType: \"date\"\n * ```\n */\n unmappedType?: (field: Pick<CmsModelField, \"fieldId\" | \"type\">) => string;\n /**\n * This is meant to do some transformation of the entry, preferably only to fieldType it was defined for. Nothing is stopping you to do anything you want to other fields, but try to separate field transformations.\n * It returns `Partial<CmsContentIndexEntryType>`. Always return a top-level property of the entry since it is merged via spread operator.\n *\n * ```ts\n * toIndex({ value }) {\n * return {\n * value: value, // This will be stored and indexed\n * rawValue: JSON.stringify(value) // This will be stored but excluded from indexing\n * };\n * }\n * ```\n */\n toIndex?: (params: CmsModelFieldToElasticsearchToParams) => ToIndexValue;\n /**\n * This is meant to revert a transformation done in the `toIndex` method.\n * You have access to \"value\" or a \"rawValue\", depending on what you returned from `toIndex`.\n *\n * ```ts\n * fromIndex({ value, rawValue }) {\n * return JSON.parse(rawValue);\n * }\n * ```\n */\n fromIndex?: (params: CmsModelFieldToElasticsearchFromParams) => any;\n}\n\nexport type AttributeDefinition = DynamoDBTypes | EntityAttributeConfig | EntityCompositeAttributes;\n\nexport type Attributes = Record<string, AttributeDefinition>;\n\nexport enum ENTITIES {\n SYSTEM = \"CmsSystem\",\n SETTINGS = \"CmsSettings\",\n GROUPS = \"CmsGroups\",\n MODELS = \"CmsModels\",\n ENTRIES = \"CmsEntries\",\n ENTRIES_ES = \"CmsEntriesElasticsearch\"\n}\n\nexport interface TableModifier {\n (table: TableConstructor): TableConstructor;\n}\n\nexport interface StorageOperationsFactoryParams {\n documentClient: DocumentClient;\n elasticsearch: Client;\n table?: TableModifier;\n esTable?: TableModifier;\n attributes?: Record<ENTITIES, Attributes>;\n plugins?: PluginCollection;\n}\n\nexport interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations<CmsContext> {\n getTable: () => Table;\n getEsTable: () => Table;\n getEntities: () => Record<\n \"system\" | \"settings\" | \"groups\" | \"models\" | \"entries\" | \"entriesEs\",\n Entity<any>\n >;\n}\n\nexport interface StorageOperationsFactory {\n (params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;\n}\n\nexport interface CmsContext extends BaseCmsContext {\n [key: string]: any;\n}\n"],"mappings":";;;;;;AAmBA;AACA;AACA;AACA;AACA;AACA;AAiBA;AACA;AACA;AACA;AACA;AACA;AAiBA;AACA;AACA;AACA;AACA;AACA;AAsBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,IA6DYA,QAAQ;AAAA;AAAA,WAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;AAAA,GAARA,QAAQ,wBAARA,QAAQ"}
@@ -1,11 +0,0 @@
1
- import { CmsEntryListParams, CmsModel } from "@webiny/api-headless-cms/types";
2
- import { SearchBody as esSearchBody } from "@webiny/api-elasticsearch/types";
3
- import { PluginsContainer } from "@webiny/plugins";
4
- interface CreateElasticsearchParams {
5
- plugins: PluginsContainer;
6
- model: CmsModel;
7
- args: CmsEntryListParams;
8
- parentPath?: string;
9
- }
10
- export declare const createElasticsearchQueryBody: (params: CreateElasticsearchParams) => esSearchBody;
11
- export {};
@@ -1,375 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.createElasticsearchQueryBody = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
- var _error = _interopRequireDefault(require("@webiny/error"));
13
-
14
- var _operatorPluginsList = require("./operatorPluginsList");
15
-
16
- var _transformValueForSearch = require("./transformValueForSearch");
17
-
18
- var _searchPluginsList = require("./searchPluginsList");
19
-
20
- var _cursors = require("@webiny/api-elasticsearch/cursors");
21
-
22
- var _sort = require("@webiny/api-elasticsearch/sort");
23
-
24
- var _fields = require("./fields");
25
-
26
- var _CmsEntryElasticsearchFieldPlugin = require("../plugins/CmsEntryElasticsearchFieldPlugin");
27
-
28
- var _where = require("@webiny/api-elasticsearch/where");
29
-
30
- var _entry = require("../operations/entry");
31
-
32
- var _CmsEntryElasticsearchQueryModifierPlugin = require("../plugins/CmsEntryElasticsearchQueryModifierPlugin");
33
-
34
- var _CmsEntryElasticsearchSortModifierPlugin = require("../plugins/CmsEntryElasticsearchSortModifierPlugin");
35
-
36
- var _CmsEntryElasticsearchBodyModifierPlugin = require("../plugins/CmsEntryElasticsearchBodyModifierPlugin");
37
-
38
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
39
-
40
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
41
-
42
- const specialFields = ["published", "latest", "locale", "tenant"];
43
- const noKeywordFields = ["date", "number", "boolean"];
44
-
45
- const createElasticsearchSortParams = args => {
46
- const {
47
- sort,
48
- modelFields,
49
- parentPath,
50
- searchPlugins
51
- } = args;
52
-
53
- if (!sort || sort.length === 0) {
54
- return undefined;
55
- }
56
-
57
- const sortPlugins = Object.values(modelFields).reduce((plugins, modelField) => {
58
- const searchPlugin = searchPlugins[modelField.type];
59
- plugins[modelField.field.fieldId] = new _CmsEntryElasticsearchFieldPlugin.CmsEntryElasticsearchFieldPlugin({
60
- unmappedType: modelField.unmappedType,
61
- keyword: hasKeyword(modelField),
62
- sortable: modelField.isSortable,
63
- searchable: modelField.isSearchable,
64
- field: modelField.field.fieldId,
65
- path: createFieldPath({
66
- parentPath,
67
- modelField: modelField,
68
- searchPlugin
69
- })
70
- });
71
- return plugins;
72
- }, {});
73
- return (0, _sort.createSort)({
74
- fieldPlugins: sortPlugins,
75
- sort
76
- });
77
- };
78
- /**
79
- * Latest and published are specific in Elasticsearch to that extend that they are tagged in the __type property.
80
- * We allow either published or either latest.
81
- * Latest is used in the manage API and published in the read API.
82
- */
83
-
84
-
85
- const createInitialQueryValue = args => {
86
- const {
87
- where
88
- } = args;
89
- const query = {
90
- must: [],
91
- must_not: [],
92
- should: [],
93
- filter: []
94
- }; // When ES index is shared between tenants, we need to filter records by tenant ID
95
-
96
- const sharedIndex = process.env.ELASTICSEARCH_SHARED_INDEXES === "true";
97
-
98
- if (sharedIndex) {
99
- query.must.push({
100
- term: {
101
- "tenant.keyword": where.tenant
102
- }
103
- });
104
- }
105
-
106
- delete where["tenant"];
107
-
108
- if (where.locale) {
109
- query.must.push({
110
- term: {
111
- "locale.keyword": where.locale
112
- }
113
- });
114
- }
115
-
116
- delete where["locale"];
117
- /**
118
- * We must transform published and latest where args into something that is understandable by our Elasticsearch
119
- */
120
-
121
- if (where.published === true) {
122
- query.must.push({
123
- term: {
124
- "__type.keyword": (0, _entry.createPublishedType)()
125
- }
126
- });
127
- } else if (where.latest === true) {
128
- query.must.push({
129
- term: {
130
- "__type.keyword": (0, _entry.createLatestType)()
131
- }
132
- });
133
- } // we do not allow not published and not latest
134
- else if (where.published === false) {
135
- throw new _error.default(`Cannot call Elasticsearch query with "published" set at false.`, "ELASTICSEARCH_UNSUPPORTED_QUERY", {
136
- where
137
- });
138
- } else if (where.latest === false) {
139
- throw new _error.default(`Cannot call Elasticsearch query with "latest" set at false.`, "ELASTICSEARCH_UNSUPPORTED_QUERY", {
140
- where
141
- });
142
- } //
143
-
144
-
145
- return query;
146
- };
147
-
148
- const createFieldPath = ({
149
- modelField,
150
- searchPlugin,
151
- parentPath
152
- }) => {
153
- let path;
154
-
155
- if (searchPlugin && typeof searchPlugin.createPath === "function") {
156
- path = searchPlugin.createPath({
157
- field: modelField.field
158
- });
159
- } else if (typeof modelField.path === "function") {
160
- path = modelField.path(modelField.field.fieldId);
161
- }
162
-
163
- if (!path) {
164
- path = modelField.path || modelField.field.fieldId || modelField.field.id;
165
- }
166
-
167
- return modelField.isSystemField || !parentPath || path.match(parentPath) ? path : `${parentPath}.${path}`;
168
- };
169
-
170
- const hasKeyword = modelField => {
171
- /**
172
- * We defined some field types that MUST have no keyword added to the field path
173
- */
174
- if (noKeywordFields.includes(modelField.type)) {
175
- return false;
176
- } else if (modelField.unmappedType) {
177
- /**
178
- * If modelField has unmapped type defined, do not add keyword.
179
- */
180
- return false;
181
- } else if (modelField.keyword === false) {
182
- /**
183
- * And if specifically defined that modelField has no keyword, do not add it.
184
- */
185
- return false;
186
- }
187
- /**
188
- * All other fields have keyword added.
189
- */
190
-
191
-
192
- return true;
193
- };
194
- /*
195
- * Iterate through where keys and apply plugins where necessary
196
- */
197
-
198
-
199
- const execElasticsearchBuildQueryPlugins = params => {
200
- const {
201
- where: initialWhere,
202
- modelFields,
203
- parentPath,
204
- plugins,
205
- searchPlugins
206
- } = params;
207
-
208
- const where = _objectSpread({}, initialWhere);
209
-
210
- const query = createInitialQueryValue(_objectSpread(_objectSpread({}, params), {}, {
211
- where
212
- }));
213
- /**
214
- * Always remove special fields, as these do not exist in Elasticsearch.
215
- */
216
-
217
- for (const sf of specialFields) {
218
- delete where[sf];
219
- }
220
-
221
- if (Object.keys(where).length === 0) {
222
- return query;
223
- }
224
-
225
- const operatorPlugins = (0, _operatorPluginsList.operatorPluginsList)(plugins);
226
-
227
- for (const key in where) {
228
- if (where.hasOwnProperty(key) === false) {
229
- continue;
230
- }
231
- /**
232
- * We do not need to go further if value is undefined.
233
- * There are few hardcoded possibilities when value is undefined, for example, ownedBy.
234
- */
235
-
236
-
237
- if (where[key] === undefined) {
238
- continue;
239
- }
240
-
241
- const {
242
- field,
243
- operator
244
- } = (0, _where.parseWhereKey)(key);
245
- const modelField = modelFields[field];
246
-
247
- if (!modelField) {
248
- throw new _error.default(`There is no field "${field}".`);
249
- }
250
-
251
- const {
252
- isSearchable = false,
253
- field: cmsField
254
- } = modelField;
255
-
256
- if (!isSearchable) {
257
- throw new _error.default(`Field "${field}" is not searchable.`);
258
- }
259
-
260
- const plugin = operatorPlugins[operator];
261
-
262
- if (!plugin) {
263
- throw new _error.default("Operator plugin missing.", "PLUGIN_MISSING", {
264
- operator
265
- });
266
- }
267
-
268
- const fieldSearchPlugin = searchPlugins[modelField.type];
269
- const value = (0, _transformValueForSearch.transformValueForSearch)({
270
- plugins: searchPlugins,
271
- field: cmsField,
272
- value: where[key]
273
- });
274
- const fieldPath = createFieldPath({
275
- searchPlugin: fieldSearchPlugin,
276
- modelField,
277
- parentPath: parentPath
278
- });
279
- const keyword = hasKeyword(modelField);
280
- plugin.apply(query, {
281
- basePath: fieldPath,
282
- path: keyword ? `${fieldPath}.keyword` : fieldPath,
283
- value,
284
- keyword
285
- });
286
- }
287
-
288
- return query;
289
- };
290
-
291
- const createElasticsearchQueryBody = params => {
292
- const {
293
- plugins,
294
- model,
295
- args,
296
- parentPath = null
297
- } = params;
298
- const {
299
- where,
300
- after,
301
- limit,
302
- sort: initialSort
303
- } = args;
304
- const modelFields = (0, _fields.createModelFields)(plugins, model);
305
- const searchPlugins = (0, _searchPluginsList.searchPluginsList)(plugins);
306
- const query = execElasticsearchBuildQueryPlugins({
307
- model,
308
- plugins,
309
- where,
310
- modelFields,
311
- parentPath,
312
- searchPlugins
313
- });
314
- const queryPlugins = plugins.byType(_CmsEntryElasticsearchQueryModifierPlugin.CmsEntryElasticsearchQueryModifierPlugin.type).filter(pl => {
315
- return !pl.modelId || pl.modelId === model.modelId;
316
- });
317
-
318
- for (const pl of queryPlugins) {
319
- pl.modifyQuery({
320
- query,
321
- model,
322
- where
323
- });
324
- }
325
-
326
- const sort = createElasticsearchSortParams({
327
- plugins,
328
- sort: initialSort,
329
- modelFields,
330
- parentPath,
331
- model,
332
- searchPlugins
333
- });
334
- const sortPlugins = plugins.byType(_CmsEntryElasticsearchSortModifierPlugin.CmsEntryElasticsearchSortModifierPlugin.type).filter(pl => {
335
- return !pl.modelId || pl.modelId === model.modelId;
336
- });
337
-
338
- for (const pl of sortPlugins) {
339
- pl.modifySort({
340
- sort,
341
- model
342
- });
343
- }
344
-
345
- const body = {
346
- query: {
347
- bool: {
348
- must: query.must.length > 0 ? query.must : undefined,
349
- must_not: query.must_not.length > 0 ? query.must_not : undefined,
350
- should: query.should.length > 0 ? query.should : undefined,
351
- filter: query.filter.length > 0 ? query.filter : undefined
352
- }
353
- },
354
- sort,
355
- size: limit + 1,
356
- // eslint-disable-next-line
357
- search_after: (0, _cursors.decodeCursor)(after),
358
- // eslint-disable-next-line
359
- track_total_hits: true
360
- };
361
- const bodyPlugins = plugins.byType(_CmsEntryElasticsearchBodyModifierPlugin.CmsEntryElasticsearchBodyModifierPlugin.type).filter(pl => {
362
- return !pl.modelId || pl.modelId === model.modelId;
363
- });
364
-
365
- for (const pl of bodyPlugins) {
366
- pl.modifyBody({
367
- body,
368
- model
369
- });
370
- }
371
-
372
- return body;
373
- };
374
-
375
- exports.createElasticsearchQueryBody = createElasticsearchQueryBody;
@@ -1,77 +0,0 @@
1
- import { CmsModel, CmsModelField } from "@webiny/api-headless-cms/types";
2
- import { PluginsContainer } from "@webiny/plugins";
3
- declare type ModelFieldPath = string | ((value: string) => string);
4
- export interface ModelField {
5
- unmappedType?: string;
6
- keyword?: boolean;
7
- isSearchable: boolean;
8
- isSortable: boolean;
9
- type: string;
10
- isSystemField?: boolean;
11
- field: CmsModelField;
12
- path?: ModelFieldPath;
13
- }
14
- export declare type ModelFields = Record<string, ModelField>;
15
- export declare const systemFields: {
16
- id: {
17
- type: string;
18
- isSystemField: boolean;
19
- isSearchable: boolean;
20
- isSortable: boolean;
21
- field: CmsModelField;
22
- };
23
- entryId: {
24
- type: string;
25
- isSystemField: boolean;
26
- isSearchable: boolean;
27
- isSortable: boolean;
28
- field: CmsModelField;
29
- };
30
- savedOn: {
31
- type: string;
32
- unmappedType: string;
33
- keyword: boolean;
34
- isSystemField: boolean;
35
- isSearchable: boolean;
36
- isSortable: boolean;
37
- field: CmsModelField;
38
- };
39
- createdOn: {
40
- type: string;
41
- unmappedType: string;
42
- keyword: boolean;
43
- isSystemField: boolean;
44
- isSearchable: boolean;
45
- isSortable: boolean;
46
- field: CmsModelField;
47
- };
48
- createdBy: {
49
- type: string;
50
- unmappedType: any;
51
- isSystemField: boolean;
52
- isSearchable: boolean;
53
- isSortable: boolean;
54
- path: string;
55
- field: CmsModelField;
56
- };
57
- ownedBy: {
58
- type: string;
59
- unmappedType: any;
60
- isSystemField: boolean;
61
- isSearchable: boolean;
62
- isSortable: boolean;
63
- path: string;
64
- field: CmsModelField;
65
- };
66
- version: {
67
- type: string;
68
- unmappedType: any;
69
- keyword: boolean;
70
- isSystemField: boolean;
71
- isSearchable: boolean;
72
- isSortable: boolean;
73
- field: CmsModelField;
74
- };
75
- };
76
- export declare const createModelFields: (plugins: PluginsContainer, model: CmsModel) => ModelFields;
77
- export {};