@webiny/api-headless-cms-ddb-es 0.0.0-mt-3 → 0.0.0-unstable.06b2ede40f

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 (325) hide show
  1. package/configurations.d.ts +15 -8
  2. package/configurations.js +29 -12
  3. package/configurations.js.map +1 -0
  4. package/definitions/entry.d.ts +6 -5
  5. package/definitions/entry.js +111 -20
  6. package/definitions/entry.js.map +1 -0
  7. package/definitions/entryElasticsearch.d.ts +6 -5
  8. package/definitions/entryElasticsearch.js +11 -16
  9. package/definitions/entryElasticsearch.js.map +1 -0
  10. package/definitions/group.d.ts +6 -5
  11. package/definitions/group.js +8 -16
  12. package/definitions/group.js.map +1 -0
  13. package/definitions/model.d.ts +6 -5
  14. package/definitions/model.js +30 -16
  15. package/definitions/model.js.map +1 -0
  16. package/definitions/system.d.ts +6 -5
  17. package/definitions/system.js +8 -16
  18. package/definitions/system.js.map +1 -0
  19. package/definitions/table.d.ts +6 -6
  20. package/definitions/table.js +7 -6
  21. package/definitions/table.js.map +1 -0
  22. package/definitions/tableElasticsearch.d.ts +6 -6
  23. package/definitions/tableElasticsearch.js +7 -6
  24. package/definitions/tableElasticsearch.js.map +1 -0
  25. package/dynamoDb/index.d.ts +2 -1
  26. package/dynamoDb/index.js +10 -12
  27. package/dynamoDb/index.js.map +1 -0
  28. package/dynamoDb/storage/longText.d.ts +7 -4
  29. package/dynamoDb/storage/longText.js +75 -62
  30. package/dynamoDb/storage/longText.js.map +1 -0
  31. package/dynamoDb/storage/richText.d.ts +2 -8
  32. package/dynamoDb/storage/richText.js +49 -100
  33. package/dynamoDb/storage/richText.js.map +1 -0
  34. package/elasticsearch/createElasticsearchIndex.d.ts +9 -0
  35. package/elasticsearch/createElasticsearchIndex.js +40 -0
  36. package/elasticsearch/createElasticsearchIndex.js.map +1 -0
  37. package/elasticsearch/deleteElasticsearchIndex.d.ts +8 -0
  38. package/elasticsearch/deleteElasticsearchIndex.js +38 -0
  39. package/elasticsearch/deleteElasticsearchIndex.js.map +1 -0
  40. package/elasticsearch/index.d.ts +1 -1
  41. package/elasticsearch/index.js +3 -6
  42. package/elasticsearch/index.js.map +1 -0
  43. package/elasticsearch/indexing/dateTimeIndexing.d.ts +1 -1
  44. package/elasticsearch/indexing/dateTimeIndexing.js +21 -22
  45. package/elasticsearch/indexing/dateTimeIndexing.js.map +1 -0
  46. package/elasticsearch/indexing/defaultFieldIndexing.d.ts +1 -1
  47. package/elasticsearch/indexing/defaultFieldIndexing.js +17 -10
  48. package/elasticsearch/indexing/defaultFieldIndexing.js.map +1 -0
  49. package/elasticsearch/indexing/index.js +5 -11
  50. package/elasticsearch/indexing/index.js.map +1 -0
  51. package/elasticsearch/indexing/jsonIndexing.d.ts +2 -0
  52. package/elasticsearch/indexing/jsonIndexing.js +28 -0
  53. package/elasticsearch/indexing/jsonIndexing.js.map +1 -0
  54. package/elasticsearch/indexing/longTextIndexing.d.ts +5 -1
  55. package/elasticsearch/indexing/longTextIndexing.js +16 -10
  56. package/elasticsearch/indexing/longTextIndexing.js.map +1 -0
  57. package/elasticsearch/indexing/numberIndexing.d.ts +1 -1
  58. package/elasticsearch/indexing/numberIndexing.js +2 -9
  59. package/elasticsearch/indexing/numberIndexing.js.map +1 -0
  60. package/elasticsearch/indexing/objectIndexing.d.ts +10 -1
  61. package/elasticsearch/indexing/objectIndexing.js +37 -36
  62. package/elasticsearch/indexing/objectIndexing.js.map +1 -0
  63. package/elasticsearch/indexing/richTextIndexing.d.ts +1 -1
  64. package/elasticsearch/indexing/richTextIndexing.js +2 -5
  65. package/elasticsearch/indexing/richTextIndexing.js.map +1 -0
  66. package/elasticsearch/indices/base.d.ts +2 -0
  67. package/elasticsearch/indices/base.js +13 -0
  68. package/elasticsearch/indices/base.js.map +1 -0
  69. package/elasticsearch/indices/index.d.ts +1 -0
  70. package/elasticsearch/indices/index.js +14 -0
  71. package/elasticsearch/indices/index.js.map +1 -0
  72. package/elasticsearch/indices/japanese.d.ts +2 -0
  73. package/elasticsearch/indices/japanese.js +14 -0
  74. package/elasticsearch/indices/japanese.js.map +1 -0
  75. package/elasticsearch/search/index.d.ts +2 -2
  76. package/elasticsearch/search/index.js +6 -9
  77. package/elasticsearch/search/index.js.map +1 -0
  78. package/elasticsearch/search/refSearch.d.ts +2 -3
  79. package/elasticsearch/search/refSearch.js +24 -17
  80. package/elasticsearch/search/refSearch.js.map +1 -0
  81. package/elasticsearch/search/searchableJson.d.ts +2 -0
  82. package/elasticsearch/search/searchableJson.js +60 -0
  83. package/elasticsearch/search/searchableJson.js.map +1 -0
  84. package/elasticsearch/search/timeSearch.d.ts +2 -3
  85. package/elasticsearch/search/timeSearch.js +18 -16
  86. package/elasticsearch/search/timeSearch.js.map +1 -0
  87. package/helpers/entryIndexHelpers.d.ts +3 -3
  88. package/helpers/entryIndexHelpers.js +59 -58
  89. package/helpers/entryIndexHelpers.js.map +1 -0
  90. package/helpers/fieldIdentifier.d.ts +6 -0
  91. package/helpers/fieldIdentifier.js +43 -0
  92. package/helpers/fieldIdentifier.js.map +1 -0
  93. package/helpers/index.d.ts +1 -1
  94. package/helpers/index.js +11 -13
  95. package/helpers/index.js.map +1 -0
  96. package/index.d.ts +2 -1
  97. package/index.js +132 -78
  98. package/index.js.map +1 -0
  99. package/operations/entry/dataLoader/DataLoaderCache.d.ts +17 -0
  100. package/operations/entry/dataLoader/DataLoaderCache.js +41 -0
  101. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -0
  102. package/operations/entry/dataLoader/constants.d.ts +1 -0
  103. package/operations/entry/dataLoader/constants.js +10 -0
  104. package/operations/entry/dataLoader/constants.js.map +1 -0
  105. package/operations/entry/dataLoader/createBatchScheduleFn.d.ts +8 -0
  106. package/operations/entry/dataLoader/createBatchScheduleFn.js +25 -0
  107. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -0
  108. package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +4 -0
  109. package/operations/entry/dataLoader/getAllEntryRevisions.js +45 -0
  110. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -0
  111. package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +4 -0
  112. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +52 -0
  113. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -0
  114. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +4 -0
  115. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +52 -0
  116. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -0
  117. package/operations/entry/dataLoader/getRevisionById.d.ts +4 -0
  118. package/operations/entry/dataLoader/getRevisionById.js +62 -0
  119. package/operations/entry/dataLoader/getRevisionById.js.map +1 -0
  120. package/operations/entry/dataLoader/index.d.ts +8 -0
  121. package/operations/entry/dataLoader/index.js +40 -0
  122. package/operations/entry/dataLoader/index.js.map +1 -0
  123. package/operations/entry/dataLoader/types.d.ts +6 -0
  124. package/operations/entry/dataLoader/types.js +7 -0
  125. package/operations/entry/dataLoader/types.js.map +1 -0
  126. package/operations/entry/dataLoaders.d.ts +21 -38
  127. package/operations/entry/dataLoaders.js +59 -290
  128. package/operations/entry/dataLoaders.js.map +1 -0
  129. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +18 -0
  130. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +34 -0
  131. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +1 -0
  132. package/operations/entry/elasticsearch/body.d.ts +13 -0
  133. package/operations/entry/elasticsearch/body.js +142 -0
  134. package/operations/entry/elasticsearch/body.js.map +1 -0
  135. package/operations/entry/elasticsearch/fields.d.ts +10 -0
  136. package/operations/entry/elasticsearch/fields.js +315 -0
  137. package/operations/entry/elasticsearch/fields.js.map +1 -0
  138. package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +8 -0
  139. package/operations/entry/elasticsearch/filtering/applyFiltering.js +60 -0
  140. package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +1 -0
  141. package/operations/entry/elasticsearch/filtering/exec.d.ts +17 -0
  142. package/operations/entry/elasticsearch/filtering/exec.js +175 -0
  143. package/operations/entry/elasticsearch/filtering/exec.js.map +1 -0
  144. package/operations/entry/elasticsearch/filtering/index.d.ts +1 -0
  145. package/operations/entry/elasticsearch/filtering/index.js +18 -0
  146. package/operations/entry/elasticsearch/filtering/index.js.map +1 -0
  147. package/operations/entry/elasticsearch/filtering/path.d.ts +16 -0
  148. package/operations/entry/elasticsearch/filtering/path.js +48 -0
  149. package/operations/entry/elasticsearch/filtering/path.js.map +1 -0
  150. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.d.ts +2 -0
  151. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +30 -0
  152. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js.map +1 -0
  153. package/operations/entry/elasticsearch/filtering/plugins/index.d.ts +1 -0
  154. package/operations/entry/elasticsearch/filtering/plugins/index.js +15 -0
  155. package/operations/entry/elasticsearch/filtering/plugins/index.js.map +1 -0
  156. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.d.ts +2 -0
  157. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +69 -0
  158. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js.map +1 -0
  159. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.d.ts +2 -0
  160. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +57 -0
  161. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js.map +1 -0
  162. package/operations/entry/elasticsearch/filtering/populated.d.ts +2 -0
  163. package/operations/entry/elasticsearch/filtering/populated.js +25 -0
  164. package/operations/entry/elasticsearch/filtering/populated.js.map +1 -0
  165. package/operations/entry/elasticsearch/filtering/values.d.ts +2 -0
  166. package/operations/entry/elasticsearch/filtering/values.js +24 -0
  167. package/operations/entry/elasticsearch/filtering/values.js.map +1 -0
  168. package/operations/entry/elasticsearch/fullTextSearch.d.ts +12 -0
  169. package/operations/entry/elasticsearch/fullTextSearch.js +91 -0
  170. package/operations/entry/elasticsearch/fullTextSearch.js.map +1 -0
  171. package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +8 -0
  172. package/operations/entry/elasticsearch/fullTextSearchFields.js +27 -0
  173. package/operations/entry/elasticsearch/fullTextSearchFields.js.map +1 -0
  174. package/operations/entry/elasticsearch/initialQuery.d.ts +17 -0
  175. package/operations/entry/elasticsearch/initialQuery.js +106 -0
  176. package/operations/entry/elasticsearch/initialQuery.js.map +1 -0
  177. package/operations/entry/elasticsearch/keyword.d.ts +2 -0
  178. package/operations/entry/elasticsearch/keyword.js +36 -0
  179. package/operations/entry/elasticsearch/keyword.js.map +1 -0
  180. package/operations/entry/elasticsearch/logIgnoredEsResponseError.d.ts +9 -0
  181. package/operations/entry/elasticsearch/logIgnoredEsResponseError.js +26 -0
  182. package/operations/entry/elasticsearch/logIgnoredEsResponseError.js.map +1 -0
  183. package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +9 -0
  184. package/operations/entry/elasticsearch/plugins/bodyModifier.js +18 -0
  185. package/operations/entry/elasticsearch/plugins/bodyModifier.js.map +1 -0
  186. package/operations/entry/elasticsearch/plugins/operator.d.ts +8 -0
  187. package/operations/entry/elasticsearch/plugins/operator.js +39 -0
  188. package/operations/entry/elasticsearch/plugins/operator.js.map +1 -0
  189. package/operations/entry/elasticsearch/plugins/queryModifier.d.ts +9 -0
  190. package/operations/entry/elasticsearch/plugins/queryModifier.js +18 -0
  191. package/operations/entry/elasticsearch/plugins/queryModifier.js.map +1 -0
  192. package/operations/entry/elasticsearch/plugins/search.d.ts +7 -0
  193. package/{helpers/searchPluginsList.js → operations/entry/elasticsearch/plugins/search.js} +9 -9
  194. package/operations/entry/elasticsearch/plugins/search.js.map +1 -0
  195. package/operations/entry/elasticsearch/plugins/sortModifier.d.ts +9 -0
  196. package/operations/entry/elasticsearch/plugins/sortModifier.js +18 -0
  197. package/operations/entry/elasticsearch/plugins/sortModifier.js.map +1 -0
  198. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.d.ts +2 -0
  199. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js +13 -0
  200. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js.map +1 -0
  201. package/operations/entry/elasticsearch/sort.d.ts +12 -0
  202. package/operations/entry/elasticsearch/sort.js +89 -0
  203. package/operations/entry/elasticsearch/sort.js.map +1 -0
  204. package/operations/entry/elasticsearch/transformValueForSearch.d.ts +16 -0
  205. package/operations/entry/elasticsearch/transformValueForSearch.js +32 -0
  206. package/operations/entry/elasticsearch/transformValueForSearch.js.map +1 -0
  207. package/operations/entry/elasticsearch/types.d.ts +41 -0
  208. package/operations/entry/elasticsearch/types.js +7 -0
  209. package/operations/entry/elasticsearch/types.js.map +1 -0
  210. package/operations/entry/index.d.ts +6 -8
  211. package/operations/entry/index.js +1422 -693
  212. package/operations/entry/index.js.map +1 -0
  213. package/operations/entry/keys.js +2 -9
  214. package/operations/entry/keys.js.map +1 -0
  215. package/operations/entry/recordType.d.ts +3 -0
  216. package/operations/entry/recordType.js +20 -0
  217. package/operations/entry/recordType.js.map +1 -0
  218. package/operations/entry/transformations/convertEntryKeys.d.ts +8 -0
  219. package/operations/entry/transformations/convertEntryKeys.js +38 -0
  220. package/operations/entry/transformations/convertEntryKeys.js.map +1 -0
  221. package/operations/entry/transformations/index.d.ts +29 -0
  222. package/operations/entry/transformations/index.js +127 -0
  223. package/operations/entry/transformations/index.js.map +1 -0
  224. package/operations/entry/transformations/modifyEntryValues.d.ts +58 -0
  225. package/operations/entry/transformations/modifyEntryValues.js +28 -0
  226. package/operations/entry/transformations/modifyEntryValues.js.map +1 -0
  227. package/operations/entry/transformations/transformEntryKeys.d.ts +11 -0
  228. package/operations/entry/transformations/transformEntryKeys.js +27 -0
  229. package/operations/entry/transformations/transformEntryKeys.js.map +1 -0
  230. package/operations/entry/transformations/transformEntryToIndex.d.ts +10 -0
  231. package/operations/entry/transformations/transformEntryToIndex.js +31 -0
  232. package/operations/entry/transformations/transformEntryToIndex.js.map +1 -0
  233. package/operations/group/index.d.ts +5 -5
  234. package/operations/group/index.js +40 -63
  235. package/operations/group/index.js.map +1 -0
  236. package/operations/model/index.d.ts +5 -5
  237. package/operations/model/index.js +56 -78
  238. package/operations/model/index.js.map +1 -0
  239. package/operations/system/index.d.ts +4 -4
  240. package/operations/system/index.js +20 -31
  241. package/operations/system/index.js.map +1 -0
  242. package/operations/system/indexes.d.ts +10 -0
  243. package/operations/system/indexes.js +41 -0
  244. package/operations/system/indexes.js.map +1 -0
  245. package/package.json +38 -40
  246. package/plugins/CmsElasticsearchModelFieldPlugin.d.ts +69 -0
  247. package/plugins/CmsElasticsearchModelFieldPlugin.js +52 -0
  248. package/plugins/CmsElasticsearchModelFieldPlugin.js.map +1 -0
  249. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +9 -4
  250. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +10 -13
  251. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +1 -0
  252. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.d.ts +23 -0
  253. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +27 -0
  254. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js.map +1 -0
  255. package/plugins/CmsEntryElasticsearchIndexPlugin.d.ts +4 -0
  256. package/plugins/CmsEntryElasticsearchIndexPlugin.js +13 -0
  257. package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +1 -0
  258. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +32 -0
  259. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +40 -0
  260. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +1 -0
  261. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +6 -4
  262. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +10 -13
  263. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +1 -0
  264. package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +6 -4
  265. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +10 -13
  266. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +1 -0
  267. package/plugins/CmsEntryElasticsearchValuesModifier.d.ts +33 -0
  268. package/plugins/CmsEntryElasticsearchValuesModifier.js +50 -0
  269. package/plugins/CmsEntryElasticsearchValuesModifier.js.map +1 -0
  270. package/plugins/CmsEntryFilterPlugin.d.ts +49 -0
  271. package/plugins/CmsEntryFilterPlugin.js +22 -0
  272. package/plugins/CmsEntryFilterPlugin.js.map +1 -0
  273. package/plugins/index.d.ts +8 -0
  274. package/plugins/index.js +95 -0
  275. package/plugins/index.js.map +1 -0
  276. package/tasks/createIndexTaskPlugin.d.ts +2 -0
  277. package/tasks/createIndexTaskPlugin.js +67 -0
  278. package/tasks/createIndexTaskPlugin.js.map +1 -0
  279. package/types.d.ts +30 -52
  280. package/types.js +5 -23
  281. package/types.js.map +1 -0
  282. package/values/NoValueContainer.d.ts +5 -0
  283. package/values/NoValueContainer.js +20 -0
  284. package/values/NoValueContainer.js.map +1 -0
  285. package/definitions/settings.d.ts +0 -8
  286. package/definitions/settings.js +0 -62
  287. package/dynamoDb/storage/date.d.ts +0 -3
  288. package/dynamoDb/storage/date.js +0 -65
  289. package/helpers/createElasticsearchQueryBody.d.ts +0 -11
  290. package/helpers/createElasticsearchQueryBody.js +0 -375
  291. package/helpers/fields.d.ts +0 -77
  292. package/helpers/fields.js +0 -174
  293. package/helpers/operatorPluginsList.d.ts +0 -7
  294. package/helpers/operatorPluginsList.js +0 -30
  295. package/helpers/searchPluginsList.d.ts +0 -6
  296. package/helpers/transformValueForSearch.d.ts +0 -9
  297. package/helpers/transformValueForSearch.js +0 -26
  298. package/operations/entry/elasticsearchFields.d.ts +0 -2
  299. package/operations/entry/elasticsearchFields.js +0 -32
  300. package/operations/entry/fields.d.ts +0 -3
  301. package/operations/entry/fields.js +0 -60
  302. package/operations/settings/index.d.ts +0 -6
  303. package/operations/settings/index.js +0 -141
  304. package/operations/system/createElasticsearchTemplate.d.ts +0 -5
  305. package/operations/system/createElasticsearchTemplate.js +0 -62
  306. package/plugins/CmsEntryElasticsearchFieldPlugin.d.ts +0 -12
  307. package/plugins/CmsEntryElasticsearchFieldPlugin.js +0 -24
  308. package/upgrades/index.d.ts +0 -2
  309. package/upgrades/index.js +0 -16
  310. package/upgrades/utils.d.ts +0 -1
  311. package/upgrades/utils.js +0 -16
  312. package/upgrades/v5.0.0/cleanDatabaseRecord.d.ts +0 -6
  313. package/upgrades/v5.0.0/cleanDatabaseRecord.js +0 -16
  314. package/upgrades/v5.0.0/createOldVersionIndiceName.d.ts +0 -2
  315. package/upgrades/v5.0.0/createOldVersionIndiceName.js +0 -12
  316. package/upgrades/v5.0.0/entryValueFixer.d.ts +0 -4
  317. package/upgrades/v5.0.0/entryValueFixer.js +0 -124
  318. package/upgrades/v5.0.0/fieldFinder.d.ts +0 -6
  319. package/upgrades/v5.0.0/fieldFinder.js +0 -42
  320. package/upgrades/v5.0.0/helpers.d.ts +0 -4
  321. package/upgrades/v5.0.0/helpers.js +0 -57
  322. package/upgrades/v5.0.0/index.d.ts +0 -4
  323. package/upgrades/v5.0.0/index.js +0 -232
  324. package/upgrades/v5.8.0/index.d.ts +0 -4
  325. package/upgrades/v5.8.0/index.js +0 -426
@@ -0,0 +1,95 @@
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
+ });
83
+ var _CmsEntryElasticsearchValuesModifier = require("./CmsEntryElasticsearchValuesModifier");
84
+ Object.keys(_CmsEntryElasticsearchValuesModifier).forEach(function (key) {
85
+ if (key === "default" || key === "__esModule") return;
86
+ if (key in exports && exports[key] === _CmsEntryElasticsearchValuesModifier[key]) return;
87
+ Object.defineProperty(exports, key, {
88
+ enumerable: true,
89
+ get: function () {
90
+ return _CmsEntryElasticsearchValuesModifier[key];
91
+ }
92
+ });
93
+ });
94
+
95
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_CmsEntryElasticsearchBodyModifierPlugin","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_CmsEntryElasticsearchIndexPlugin","_CmsEntryElasticsearchQueryBuilderValueSearchPlugin","_CmsEntryElasticsearchQueryModifierPlugin","_CmsEntryElasticsearchSortModifierPlugin","_CmsEntryElasticsearchFullTextSearchPlugin","_CmsElasticsearchModelFieldPlugin","_CmsEntryElasticsearchValuesModifier"],"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\";\nexport * from \"./CmsEntryElasticsearchValuesModifier\";\n"],"mappings":"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","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ import type { CmsContext } from "../types";
2
+ export declare const createIndexTaskPluginTest: () => import("@webiny/api-elasticsearch-tasks").CreateElasticsearchIndexTaskPlugin<CmsContext>;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createIndexTaskPluginTest = void 0;
7
+ var _apiElasticsearchTasks = require("@webiny/api-elasticsearch-tasks");
8
+ var _configurations = require("../configurations");
9
+ const createIndexTaskPluginTest = () => {
10
+ return (0, _apiElasticsearchTasks.createElasticsearchIndexTaskPlugin)({
11
+ name: "elasticsearch.cms.createIndexTaskPlugin",
12
+ getIndexList: async ({
13
+ context,
14
+ locale,
15
+ tenant
16
+ }) => {
17
+ const originalTenant = context.tenancy.getCurrentTenant();
18
+ if (!originalTenant) {
19
+ return [];
20
+ }
21
+ const originalLocale = context.i18n.getCurrentLocale("content");
22
+ if (!originalLocale) {
23
+ return [];
24
+ }
25
+ const selectedTenant = await context.tenancy.getTenantById(tenant);
26
+ if (!selectedTenant) {
27
+ return [];
28
+ }
29
+ const selectedLocale = await context.i18n.getLocale(locale);
30
+ if (!selectedLocale) {
31
+ return [];
32
+ }
33
+ const models = await context.cms.listModels();
34
+ if (models.length === 0) {
35
+ return [];
36
+ }
37
+ context.tenancy.setCurrentTenant(selectedTenant);
38
+ context.i18n.setCurrentLocale("content", selectedLocale);
39
+ const indexes = models.map(model => {
40
+ const {
41
+ index
42
+ } = _configurations.configurations.es({
43
+ model: {
44
+ modelId: model.modelId,
45
+ tenant,
46
+ locale
47
+ }
48
+ });
49
+ return {
50
+ index,
51
+ settings: _configurations.configurations.indexSettings({
52
+ context,
53
+ model: {
54
+ locale
55
+ }
56
+ })
57
+ };
58
+ });
59
+ context.tenancy.setCurrentTenant(originalTenant);
60
+ context.i18n.setCurrentLocale("content", originalLocale);
61
+ return indexes;
62
+ }
63
+ });
64
+ };
65
+ exports.createIndexTaskPluginTest = createIndexTaskPluginTest;
66
+
67
+ //# sourceMappingURL=createIndexTaskPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_apiElasticsearchTasks","require","_configurations","createIndexTaskPluginTest","createElasticsearchIndexTaskPlugin","name","getIndexList","context","locale","tenant","originalTenant","tenancy","getCurrentTenant","originalLocale","i18n","getCurrentLocale","selectedTenant","getTenantById","selectedLocale","getLocale","models","cms","listModels","length","setCurrentTenant","setCurrentLocale","indexes","map","model","index","configurations","es","modelId","settings","indexSettings","exports"],"sources":["createIndexTaskPlugin.ts"],"sourcesContent":["import type { CreateElasticsearchIndexTaskPluginIndex } from \"@webiny/api-elasticsearch-tasks\";\nimport { createElasticsearchIndexTaskPlugin } from \"@webiny/api-elasticsearch-tasks\";\nimport { configurations } from \"~/configurations\";\nimport type { CmsContext } from \"~/types\";\n\nexport const createIndexTaskPluginTest = () => {\n return createElasticsearchIndexTaskPlugin<CmsContext>({\n name: \"elasticsearch.cms.createIndexTaskPlugin\",\n getIndexList: async ({ context, locale, tenant }) => {\n const originalTenant = context.tenancy.getCurrentTenant();\n if (!originalTenant) {\n return [];\n }\n const originalLocale = context.i18n.getCurrentLocale(\"content\");\n if (!originalLocale) {\n return [];\n }\n\n const selectedTenant = await context.tenancy.getTenantById(tenant);\n if (!selectedTenant) {\n return [];\n }\n const selectedLocale = await context.i18n.getLocale(locale);\n if (!selectedLocale) {\n return [];\n }\n const models = await context.cms.listModels();\n if (models.length === 0) {\n return [];\n }\n\n context.tenancy.setCurrentTenant(selectedTenant);\n context.i18n.setCurrentLocale(\"content\", selectedLocale);\n\n const indexes = models.map<CreateElasticsearchIndexTaskPluginIndex>(model => {\n const { index } = configurations.es({\n model: {\n modelId: model.modelId,\n tenant,\n locale\n }\n });\n return {\n index,\n settings: configurations.indexSettings({\n context,\n model: {\n locale\n }\n })\n };\n });\n\n context.tenancy.setCurrentTenant(originalTenant);\n context.i18n.setCurrentLocale(\"content\", originalLocale);\n return indexes;\n }\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,sBAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAGO,MAAME,yBAAyB,GAAGA,CAAA,KAAM;EAC3C,OAAO,IAAAC,yDAAkC,EAAa;IAClDC,IAAI,EAAE,yCAAyC;IAC/CC,YAAY,EAAE,MAAAA,CAAO;MAAEC,OAAO;MAAEC,MAAM;MAAEC;IAAO,CAAC,KAAK;MACjD,MAAMC,cAAc,GAAGH,OAAO,CAACI,OAAO,CAACC,gBAAgB,CAAC,CAAC;MACzD,IAAI,CAACF,cAAc,EAAE;QACjB,OAAO,EAAE;MACb;MACA,MAAMG,cAAc,GAAGN,OAAO,CAACO,IAAI,CAACC,gBAAgB,CAAC,SAAS,CAAC;MAC/D,IAAI,CAACF,cAAc,EAAE;QACjB,OAAO,EAAE;MACb;MAEA,MAAMG,cAAc,GAAG,MAAMT,OAAO,CAACI,OAAO,CAACM,aAAa,CAACR,MAAM,CAAC;MAClE,IAAI,CAACO,cAAc,EAAE;QACjB,OAAO,EAAE;MACb;MACA,MAAME,cAAc,GAAG,MAAMX,OAAO,CAACO,IAAI,CAACK,SAAS,CAACX,MAAM,CAAC;MAC3D,IAAI,CAACU,cAAc,EAAE;QACjB,OAAO,EAAE;MACb;MACA,MAAME,MAAM,GAAG,MAAMb,OAAO,CAACc,GAAG,CAACC,UAAU,CAAC,CAAC;MAC7C,IAAIF,MAAM,CAACG,MAAM,KAAK,CAAC,EAAE;QACrB,OAAO,EAAE;MACb;MAEAhB,OAAO,CAACI,OAAO,CAACa,gBAAgB,CAACR,cAAc,CAAC;MAChDT,OAAO,CAACO,IAAI,CAACW,gBAAgB,CAAC,SAAS,EAAEP,cAAc,CAAC;MAExD,MAAMQ,OAAO,GAAGN,MAAM,CAACO,GAAG,CAA0CC,KAAK,IAAI;QACzE,MAAM;UAAEC;QAAM,CAAC,GAAGC,8BAAc,CAACC,EAAE,CAAC;UAChCH,KAAK,EAAE;YACHI,OAAO,EAAEJ,KAAK,CAACI,OAAO;YACtBvB,MAAM;YACND;UACJ;QACJ,CAAC,CAAC;QACF,OAAO;UACHqB,KAAK;UACLI,QAAQ,EAAEH,8BAAc,CAACI,aAAa,CAAC;YACnC3B,OAAO;YACPqB,KAAK,EAAE;cACHpB;YACJ;UACJ,CAAC;QACL,CAAC;MACL,CAAC,CAAC;MAEFD,OAAO,CAACI,OAAO,CAACa,gBAAgB,CAACd,cAAc,CAAC;MAChDH,OAAO,CAACO,IAAI,CAACW,gBAAgB,CAAC,SAAS,EAAEZ,cAAc,CAAC;MACxD,OAAOa,OAAO;IAClB;EACJ,CAAC,CAAC;AACN,CAAC;AAACS,OAAA,CAAAhC,yBAAA,GAAAA,yBAAA","ignoreList":[]}
package/types.d.ts CHANGED
@@ -1,40 +1,9 @@
1
- import { Plugin } from "@webiny/plugins/types";
2
- import { CmsEntry, CmsModel, CmsModelField, CmsModelFieldToGraphQLPlugin, HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations } from "@webiny/api-headless-cms/types";
3
- import { DynamoDBTypes, TableConstructor } from "dynamodb-toolbox/dist/classes/Table";
4
- import { DocumentClient } from "aws-sdk/clients/dynamodb";
5
- import { EntityAttributeConfig, EntityCompositeAttributes } from "dynamodb-toolbox/dist/classes/Entity";
6
- import { Client } from "@elastic/elasticsearch";
7
- import { Entity, Table } from "dynamodb-toolbox";
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
- }
1
+ import type { Plugin, PluginCollection } from "@webiny/plugins/types";
2
+ import type { CmsContext as BaseCmsContext, CmsEntry, CmsEntryStorageOperations as BaseCmsEntryStorageOperations, CmsModel, CmsModelField, CmsModelFieldToGraphQLPlugin, CmsModelFieldType, HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations } from "@webiny/api-headless-cms/types";
3
+ import type { AttributeDefinition, Entity, Table, TableConstructor } from "@webiny/db-dynamodb/toolbox";
4
+ import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
5
+ import type { Client } from "@elastic/elasticsearch";
6
+ import type { PluginsContainer } from "@webiny/plugins";
38
7
  /**
39
8
  * A definition of the entry that is being prepared for the Elasticsearch.
40
9
  *
@@ -62,7 +31,7 @@ export interface CmsIndexEntry extends CmsEntry {
62
31
  * @category Elasticsearch
63
32
  * @category CmsEntry
64
33
  */
65
- interface CmsModelFieldToElasticsearchToParams {
34
+ export interface CmsModelFieldToElasticsearchToParams {
66
35
  plugins: PluginsContainer;
67
36
  model: CmsModel;
68
37
  field: CmsModelField;
@@ -83,7 +52,7 @@ interface CmsModelFieldToElasticsearchToParams {
83
52
  * @category Elasticsearch
84
53
  * @category CmsEntry
85
54
  */
86
- interface CmsModelFieldToElasticsearchFromParams {
55
+ export interface CmsModelFieldToElasticsearchFromParams {
87
56
  plugins: PluginsContainer;
88
57
  model: CmsModel;
89
58
  field: CmsModelField;
@@ -122,7 +91,7 @@ export interface CmsModelFieldToElasticsearchPlugin extends Plugin {
122
91
  * fieldType: "myField"
123
92
  * ```
124
93
  */
125
- fieldType: string;
94
+ fieldType: CmsModelFieldType;
126
95
  /**
127
96
  * If you need to define a type when building an Elasticsearch query.
128
97
  * 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.
@@ -131,7 +100,7 @@ export interface CmsModelFieldToElasticsearchPlugin extends Plugin {
131
100
  * unmappedType: "date"
132
101
  * ```
133
102
  */
134
- unmappedType?: (field: CmsModelField) => string;
103
+ unmappedType?: (field: Pick<CmsModelField, "fieldId" | "type">) => string;
135
104
  /**
136
105
  * 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
106
  * It returns `Partial<CmsContentIndexEntryType>`. Always return a top-level property of the entry since it is merged via spread operator.
@@ -158,34 +127,43 @@ export interface CmsModelFieldToElasticsearchPlugin extends Plugin {
158
127
  */
159
128
  fromIndex?: (params: CmsModelFieldToElasticsearchFromParams) => any;
160
129
  }
161
- export declare type AttributeDefinition = DynamoDBTypes | EntityAttributeConfig | EntityCompositeAttributes;
162
- export declare type Attributes = Record<string, AttributeDefinition>;
130
+ export type Attributes = Record<string, AttributeDefinition>;
163
131
  export declare enum ENTITIES {
164
132
  SYSTEM = "CmsSystem",
165
- SETTINGS = "CmsSettings",
166
133
  GROUPS = "CmsGroups",
167
134
  MODELS = "CmsModels",
168
135
  ENTRIES = "CmsEntries",
169
136
  ENTRIES_ES = "CmsEntriesElasticsearch"
170
137
  }
171
138
  export interface TableModifier {
172
- (table: TableConstructor): TableConstructor;
139
+ (table: TableConstructor<string, string, string>): TableConstructor<string, string, string>;
173
140
  }
174
141
  export interface StorageOperationsFactoryParams {
175
- documentClient: DocumentClient;
142
+ documentClient: DynamoDBDocument;
176
143
  elasticsearch: Client;
177
144
  table?: TableModifier;
178
145
  esTable?: TableModifier;
179
- modelFieldToGraphQLPlugins: CmsModelFieldToGraphQLPlugin[];
180
146
  attributes?: Record<ENTITIES, Attributes>;
181
- plugins?: Plugin[] | Plugin[][];
147
+ plugins?: PluginCollection;
182
148
  }
183
- export interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations {
184
- getTable: () => Table;
185
- getEsTable: () => Table;
186
- getEntities: () => Record<"system" | "settings" | "groups" | "models" | "entries" | "entriesEs", Entity<any>>;
149
+ export interface CmsContext extends BaseCmsContext {
150
+ [key: string]: any;
151
+ }
152
+ export interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations<CmsContext> {
153
+ getTable: () => Table<string, string, string>;
154
+ getEsTable: () => Table<string, string, string>;
155
+ getEntities: () => Record<"system" | "groups" | "models" | "entries" | "entriesEs", Entity<any>>;
187
156
  }
188
157
  export interface StorageOperationsFactory {
189
158
  (params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;
190
159
  }
160
+ export interface CmsEntryStorageOperations extends BaseCmsEntryStorageOperations {
161
+ dataLoaders: DataLoadersHandlerInterface;
162
+ }
163
+ export interface DataLoadersHandlerInterfaceClearAllParams {
164
+ model: Pick<CmsModel, "tenant" | "locale">;
165
+ }
166
+ export interface DataLoadersHandlerInterface {
167
+ clearAll: (params?: DataLoadersHandlerInterfaceClearAllParams) => void;
168
+ }
191
169
  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
  *
@@ -47,14 +30,13 @@ exports.ENTITIES = void 0;
47
30
  * @category CmsEntry
48
31
  * @category Elasticsearch
49
32
  */
50
- let ENTITIES;
51
- exports.ENTITIES = ENTITIES;
52
-
53
- (function (ENTITIES) {
33
+ let ENTITIES = exports.ENTITIES = /*#__PURE__*/function (ENTITIES) {
54
34
  ENTITIES["SYSTEM"] = "CmsSystem";
55
- ENTITIES["SETTINGS"] = "CmsSettings";
56
35
  ENTITIES["GROUPS"] = "CmsGroups";
57
36
  ENTITIES["MODELS"] = "CmsModels";
58
37
  ENTITIES["ENTRIES"] = "CmsEntries";
59
38
  ENTITIES["ENTRIES_ES"] = "CmsEntriesElasticsearch";
60
- })(ENTITIES || (exports.ENTITIES = ENTITIES = {}));
39
+ return ENTITIES;
40
+ }({});
41
+
42
+ //# sourceMappingURL=types.js.map
package/types.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ENTITIES","exports"],"sources":["types.ts"],"sourcesContent":["import type { Plugin, PluginCollection } from \"@webiny/plugins/types\";\nimport type {\n CmsContext as BaseCmsContext,\n CmsEntry,\n CmsEntryStorageOperations as BaseCmsEntryStorageOperations,\n CmsModel,\n CmsModelField,\n CmsModelFieldToGraphQLPlugin,\n CmsModelFieldType,\n HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations\n} from \"@webiny/api-headless-cms/types\";\nimport type {\n AttributeDefinition,\n Entity,\n Table,\n TableConstructor\n} from \"@webiny/db-dynamodb/toolbox\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb\";\nimport type { Client } from \"@elastic/elasticsearch\";\nimport type { 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 */\nexport interface 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 */\nexport interface 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: CmsModelFieldType;\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 Attributes = Record<string, AttributeDefinition>;\n\nexport enum ENTITIES {\n SYSTEM = \"CmsSystem\",\n GROUPS = \"CmsGroups\",\n MODELS = \"CmsModels\",\n ENTRIES = \"CmsEntries\",\n ENTRIES_ES = \"CmsEntriesElasticsearch\"\n}\n\nexport interface TableModifier {\n (table: TableConstructor<string, string, string>): TableConstructor<string, string, string>;\n}\n\nexport interface StorageOperationsFactoryParams {\n documentClient: DynamoDBDocument;\n elasticsearch: Client;\n table?: TableModifier;\n esTable?: TableModifier;\n attributes?: Record<ENTITIES, Attributes>;\n plugins?: PluginCollection;\n}\n\nexport interface CmsContext extends BaseCmsContext {\n [key: string]: any;\n}\n\nexport interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations<CmsContext> {\n getTable: () => Table<string, string, string>;\n getEsTable: () => Table<string, string, string>;\n getEntities: () => Record<\n \"system\" | \"groups\" | \"models\" | \"entries\" | \"entriesEs\",\n Entity<any>\n >;\n}\n\nexport interface StorageOperationsFactory {\n (params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;\n}\n\nexport interface CmsEntryStorageOperations extends BaseCmsEntryStorageOperations {\n dataLoaders: DataLoadersHandlerInterface;\n}\n\nexport interface DataLoadersHandlerInterfaceClearAllParams {\n model: Pick<CmsModel, \"tenant\" | \"locale\">;\n}\nexport interface DataLoadersHandlerInterface {\n clearAll: (params?: DataLoadersHandlerInterfaceClearAllParams) => void;\n}\n"],"mappings":";;;;;;AAqBA;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,IA2DYA,QAAQ,GAAAC,OAAA,CAAAD,QAAA,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ export declare class NoValueContainer {
2
+ private constructor();
3
+ static create(): NoValueContainer;
4
+ static is(value: unknown): boolean;
5
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.NoValueContainer = void 0;
7
+ class NoValueContainer {
8
+ constructor() {
9
+ //
10
+ }
11
+ static create() {
12
+ return new NoValueContainer();
13
+ }
14
+ static is(value) {
15
+ return value instanceof NoValueContainer;
16
+ }
17
+ }
18
+ exports.NoValueContainer = NoValueContainer;
19
+
20
+ //# sourceMappingURL=NoValueContainer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NoValueContainer","constructor","create","is","value","exports"],"sources":["NoValueContainer.ts"],"sourcesContent":["export class NoValueContainer {\n private constructor() {\n //\n }\n\n public static create(): NoValueContainer {\n return new NoValueContainer();\n }\n\n public static is(value: unknown): boolean {\n return value instanceof NoValueContainer;\n }\n}\n"],"mappings":";;;;;;AAAO,MAAMA,gBAAgB,CAAC;EAClBC,WAAWA,CAAA,EAAG;IAClB;EAAA;EAGJ,OAAcC,MAAMA,CAAA,EAAqB;IACrC,OAAO,IAAIF,gBAAgB,CAAC,CAAC;EACjC;EAEA,OAAcG,EAAEA,CAACC,KAAc,EAAW;IACtC,OAAOA,KAAK,YAAYJ,gBAAgB;EAC5C;AACJ;AAACK,OAAA,CAAAL,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -1,8 +0,0 @@
1
- import { Entity, Table } from "dynamodb-toolbox";
2
- import { Attributes } from "../types";
3
- export interface Params {
4
- table: Table;
5
- entityName: string;
6
- attributes: Attributes;
7
- }
8
- export declare const createSettingsEntity: (params: Params) => Entity<any>;
@@ -1,62 +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.createSettingsEntity = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
- var _dynamodbToolbox = require("dynamodb-toolbox");
13
-
14
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
15
-
16
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
17
-
18
- const createSettingsEntity = params => {
19
- const {
20
- entityName,
21
- table,
22
- attributes
23
- } = params;
24
- return new _dynamodbToolbox.Entity({
25
- name: entityName,
26
- table,
27
- attributes: _objectSpread({
28
- PK: {
29
- partitionKey: true
30
- },
31
- SK: {
32
- sortKey: true
33
- },
34
- TYPE: {
35
- type: "string"
36
- },
37
- key: {
38
- type: "string"
39
- },
40
- uploadMinFileSize: {
41
- type: "number"
42
- },
43
- uploadMaxFileSize: {
44
- type: "number"
45
- },
46
- srcPrefix: {
47
- type: "string"
48
- },
49
- contentModelLastChange: {
50
- type: "string"
51
- },
52
- tenant: {
53
- type: "string"
54
- },
55
- locale: {
56
- type: "string"
57
- }
58
- }, attributes || {})
59
- });
60
- };
61
-
62
- exports.createSettingsEntity = createSettingsEntity;
@@ -1,3 +0,0 @@
1
- import { StorageTransformPlugin } from "@webiny/api-headless-cms/content/plugins/storage/StorageTransformPlugin";
2
- declare const _default: () => StorageTransformPlugin<any, any>;
3
- export default _default;
@@ -1,65 +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.default = void 0;
9
-
10
- var _error = _interopRequireDefault(require("@webiny/error"));
11
-
12
- var _StorageTransformPlugin = require("@webiny/api-headless-cms/content/plugins/storage/StorageTransformPlugin");
13
-
14
- const excludeTypes = ["time", "dateTimeWithTimezone"];
15
- const plugin = new _StorageTransformPlugin.StorageTransformPlugin({
16
- fieldType: "datetime",
17
- fromStorage: async ({
18
- value,
19
- field
20
- }) => {
21
- const {
22
- type
23
- } = field.settings || {};
24
-
25
- if (!value || !type || excludeTypes.includes(type)) {
26
- return value;
27
- }
28
-
29
- try {
30
- return new Date(value);
31
- } catch {
32
- console.log(`Could not transform from storage for field type`);
33
- return value;
34
- }
35
- },
36
- toStorage: async ({
37
- value,
38
- field
39
- }) => {
40
- const {
41
- type
42
- } = field.settings || {};
43
-
44
- if (!value || !type || excludeTypes.includes(type)) {
45
- return value;
46
- }
47
-
48
- if (value.toISOString) {
49
- return value.toISOString();
50
- } else if (typeof value === "string") {
51
- return value;
52
- }
53
-
54
- throw new _error.default("Error converting value to a storage type.", "TO_STORAGE_ERROR", {
55
- value,
56
- fieldId: field.fieldId
57
- });
58
- }
59
- });
60
-
61
- var _default = () => {
62
- return plugin;
63
- };
64
-
65
- exports.default = _default;
@@ -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 {};