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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (285) hide show
  1. package/README.md +6 -30
  2. package/configurations.d.ts +4 -5
  3. package/configurations.js +12 -24
  4. package/configurations.js.map +1 -1
  5. package/definitions/entry.d.ts +4 -5
  6. package/definitions/entry.js +5 -174
  7. package/definitions/entry.js.map +1 -1
  8. package/definitions/group.d.ts +6 -6
  9. package/definitions/group.js +5 -58
  10. package/definitions/group.js.map +1 -1
  11. package/definitions/model.d.ts +6 -6
  12. package/definitions/model.js +5 -102
  13. package/definitions/model.js.map +1 -1
  14. package/definitions/types.d.ts +59 -0
  15. package/definitions/types.js +3 -0
  16. package/definitions/types.js.map +1 -0
  17. package/dynamoDb/index.d.ts +2 -2
  18. package/dynamoDb/index.js +5 -14
  19. package/dynamoDb/index.js.map +1 -1
  20. package/dynamoDb/storage/longText.js +11 -18
  21. package/dynamoDb/storage/longText.js.map +1 -1
  22. package/dynamoDb/storage/richText.d.ts +0 -5
  23. package/dynamoDb/storage/richText.js +25 -80
  24. package/dynamoDb/storage/richText.js.map +1 -1
  25. package/elasticsearch/createElasticsearchIndex.d.ts +3 -3
  26. package/elasticsearch/createElasticsearchIndex.js +7 -15
  27. package/elasticsearch/createElasticsearchIndex.js.map +1 -1
  28. package/elasticsearch/deleteElasticsearchIndex.d.ts +2 -2
  29. package/elasticsearch/deleteElasticsearchIndex.js +3 -10
  30. package/elasticsearch/deleteElasticsearchIndex.js.map +1 -1
  31. package/elasticsearch/index.d.ts +1 -1
  32. package/elasticsearch/index.js +3 -11
  33. package/elasticsearch/index.js.map +1 -1
  34. package/elasticsearch/indexing/dateTimeIndexing.d.ts +1 -1
  35. package/elasticsearch/indexing/dateTimeIndexing.js +1 -8
  36. package/elasticsearch/indexing/dateTimeIndexing.js.map +1 -1
  37. package/elasticsearch/indexing/defaultFieldIndexing.d.ts +1 -1
  38. package/elasticsearch/indexing/defaultFieldIndexing.js +1 -8
  39. package/elasticsearch/indexing/defaultFieldIndexing.js.map +1 -1
  40. package/elasticsearch/indexing/index.d.ts +1 -1
  41. package/elasticsearch/indexing/index.js +8 -16
  42. package/elasticsearch/indexing/index.js.map +1 -1
  43. package/elasticsearch/indexing/jsonIndexing.d.ts +1 -1
  44. package/elasticsearch/indexing/jsonIndexing.js +1 -8
  45. package/elasticsearch/indexing/jsonIndexing.js.map +1 -1
  46. package/elasticsearch/indexing/longTextIndexing.d.ts +1 -1
  47. package/elasticsearch/indexing/longTextIndexing.js +1 -8
  48. package/elasticsearch/indexing/longTextIndexing.js.map +1 -1
  49. package/elasticsearch/indexing/numberIndexing.d.ts +1 -1
  50. package/elasticsearch/indexing/numberIndexing.js +1 -8
  51. package/elasticsearch/indexing/numberIndexing.js.map +1 -1
  52. package/elasticsearch/indexing/objectIndexing.d.ts +1 -1
  53. package/elasticsearch/indexing/objectIndexing.js +6 -13
  54. package/elasticsearch/indexing/objectIndexing.js.map +1 -1
  55. package/elasticsearch/indexing/richTextIndexing.d.ts +1 -1
  56. package/elasticsearch/indexing/richTextIndexing.js +1 -8
  57. package/elasticsearch/indexing/richTextIndexing.js.map +1 -1
  58. package/elasticsearch/indices/base.d.ts +1 -1
  59. package/elasticsearch/indices/base.js +4 -10
  60. package/elasticsearch/indices/base.js.map +1 -1
  61. package/elasticsearch/indices/index.d.ts +1 -1
  62. package/elasticsearch/indices/index.js +3 -11
  63. package/elasticsearch/indices/index.js.map +1 -1
  64. package/elasticsearch/search/index.d.ts +1 -1
  65. package/elasticsearch/search/index.js +4 -10
  66. package/elasticsearch/search/index.js.map +1 -1
  67. package/elasticsearch/search/refSearch.d.ts +1 -1
  68. package/elasticsearch/search/refSearch.js +3 -10
  69. package/elasticsearch/search/refSearch.js.map +1 -1
  70. package/elasticsearch/search/searchableJson.d.ts +2 -0
  71. package/elasticsearch/search/searchableJson.js +53 -0
  72. package/elasticsearch/search/searchableJson.js.map +1 -0
  73. package/elasticsearch/search/timeSearch.d.ts +1 -1
  74. package/elasticsearch/search/timeSearch.js +3 -10
  75. package/elasticsearch/search/timeSearch.js.map +1 -1
  76. package/helpers/entryIndexHelpers.d.ts +10 -10
  77. package/helpers/entryIndexHelpers.js +32 -26
  78. package/helpers/entryIndexHelpers.js.map +1 -1
  79. package/helpers/fieldIdentifier.d.ts +1 -1
  80. package/helpers/fieldIdentifier.js +2 -10
  81. package/helpers/fieldIdentifier.js.map +1 -1
  82. package/helpers/index.d.ts +2 -2
  83. package/helpers/index.js +2 -27
  84. package/helpers/index.js.map +1 -1
  85. package/index.d.ts +2 -2
  86. package/index.js +108 -134
  87. package/index.js.map +1 -1
  88. package/operations/entry/dataLoader/DataLoaderCache.d.ts +1 -3
  89. package/operations/entry/dataLoader/DataLoaderCache.js +2 -9
  90. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
  91. package/operations/entry/dataLoader/constants.js +1 -7
  92. package/operations/entry/dataLoader/constants.js.map +1 -1
  93. package/operations/entry/dataLoader/createBatchScheduleFn.js +4 -10
  94. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
  95. package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +3 -3
  96. package/operations/entry/dataLoader/getAllEntryRevisions.js +11 -24
  97. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
  98. package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +3 -3
  99. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +18 -30
  100. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
  101. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +3 -3
  102. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +18 -30
  103. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
  104. package/operations/entry/dataLoader/getRevisionById.d.ts +3 -3
  105. package/operations/entry/dataLoader/getRevisionById.js +23 -35
  106. package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
  107. package/operations/entry/dataLoader/index.d.ts +5 -5
  108. package/operations/entry/dataLoader/index.js +10 -31
  109. package/operations/entry/dataLoader/index.js.map +1 -1
  110. package/operations/entry/dataLoader/types.d.ts +3 -4
  111. package/operations/entry/dataLoader/types.js +1 -5
  112. package/operations/entry/dataLoader/types.js.map +1 -1
  113. package/operations/entry/dataLoaders.d.ts +13 -13
  114. package/operations/entry/dataLoaders.js +15 -25
  115. package/operations/entry/dataLoaders.js.map +1 -1
  116. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +1 -1
  117. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +1 -8
  118. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +1 -1
  119. package/operations/entry/elasticsearch/body.d.ts +3 -3
  120. package/operations/entry/elasticsearch/body.js +21 -28
  121. package/operations/entry/elasticsearch/body.js.map +1 -1
  122. package/operations/entry/elasticsearch/fields.d.ts +3 -3
  123. package/operations/entry/elasticsearch/fields.js +110 -24
  124. package/operations/entry/elasticsearch/fields.js.map +1 -1
  125. package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +2 -2
  126. package/operations/entry/elasticsearch/filtering/applyFiltering.js +10 -17
  127. package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +1 -1
  128. package/operations/entry/elasticsearch/filtering/exec.d.ts +7 -6
  129. package/operations/entry/elasticsearch/filtering/exec.js +48 -45
  130. package/operations/entry/elasticsearch/filtering/exec.js.map +1 -1
  131. package/operations/entry/elasticsearch/filtering/index.d.ts +1 -1
  132. package/operations/entry/elasticsearch/filtering/index.js +1 -16
  133. package/operations/entry/elasticsearch/filtering/index.js.map +1 -1
  134. package/operations/entry/elasticsearch/filtering/path.d.ts +2 -1
  135. package/operations/entry/elasticsearch/filtering/path.js +9 -17
  136. package/operations/entry/elasticsearch/filtering/path.js.map +1 -1
  137. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.d.ts +1 -1
  138. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +6 -14
  139. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js.map +1 -1
  140. package/operations/entry/elasticsearch/filtering/plugins/index.d.ts +1 -1
  141. package/operations/entry/elasticsearch/filtering/plugins/index.js +5 -12
  142. package/operations/entry/elasticsearch/filtering/plugins/index.js.map +1 -1
  143. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.d.ts +1 -1
  144. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +7 -15
  145. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js.map +1 -1
  146. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.d.ts +1 -1
  147. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +15 -16
  148. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js.map +1 -1
  149. package/operations/entry/elasticsearch/filtering/populated.d.ts +1 -1
  150. package/operations/entry/elasticsearch/filtering/populated.js +1 -8
  151. package/operations/entry/elasticsearch/filtering/populated.js.map +1 -1
  152. package/operations/entry/elasticsearch/filtering/values.d.ts +1 -1
  153. package/operations/entry/elasticsearch/filtering/values.js +4 -12
  154. package/operations/entry/elasticsearch/filtering/values.js.map +1 -1
  155. package/operations/entry/elasticsearch/fullTextSearch.d.ts +3 -3
  156. package/operations/entry/elasticsearch/fullTextSearch.js +6 -12
  157. package/operations/entry/elasticsearch/fullTextSearch.js.map +1 -1
  158. package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +1 -1
  159. package/operations/entry/elasticsearch/fullTextSearchFields.js +1 -8
  160. package/operations/entry/elasticsearch/fullTextSearchFields.js.map +1 -1
  161. package/operations/entry/elasticsearch/initialQuery.d.ts +2 -2
  162. package/operations/entry/elasticsearch/initialQuery.js +9 -26
  163. package/operations/entry/elasticsearch/initialQuery.js.map +1 -1
  164. package/operations/entry/elasticsearch/keyword.d.ts +1 -1
  165. package/operations/entry/elasticsearch/keyword.js +4 -9
  166. package/operations/entry/elasticsearch/keyword.js.map +1 -1
  167. package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +4 -4
  168. package/operations/entry/elasticsearch/plugins/bodyModifier.js +3 -10
  169. package/operations/entry/elasticsearch/plugins/bodyModifier.js.map +1 -1
  170. package/operations/entry/elasticsearch/plugins/operator.d.ts +2 -3
  171. package/operations/entry/elasticsearch/plugins/operator.js +4 -19
  172. package/operations/entry/elasticsearch/plugins/operator.js.map +1 -1
  173. package/operations/entry/elasticsearch/plugins/queryModifier.d.ts +4 -4
  174. package/operations/entry/elasticsearch/plugins/queryModifier.js +3 -10
  175. package/operations/entry/elasticsearch/plugins/queryModifier.js.map +1 -1
  176. package/operations/entry/elasticsearch/plugins/search.d.ts +2 -2
  177. package/operations/entry/elasticsearch/plugins/search.js +5 -13
  178. package/operations/entry/elasticsearch/plugins/search.js.map +1 -1
  179. package/operations/entry/elasticsearch/plugins/sortModifier.d.ts +4 -4
  180. package/operations/entry/elasticsearch/plugins/sortModifier.js +3 -10
  181. package/operations/entry/elasticsearch/plugins/sortModifier.js.map +1 -1
  182. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.d.ts +2 -0
  183. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js +6 -0
  184. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js.map +1 -0
  185. package/operations/entry/elasticsearch/sort.d.ts +4 -4
  186. package/operations/entry/elasticsearch/sort.js +57 -33
  187. package/operations/entry/elasticsearch/sort.js.map +1 -1
  188. package/operations/entry/elasticsearch/transformValueForSearch.d.ts +2 -2
  189. package/operations/entry/elasticsearch/transformValueForSearch.js +4 -9
  190. package/operations/entry/elasticsearch/transformValueForSearch.js.map +1 -1
  191. package/operations/entry/elasticsearch/types.d.ts +5 -5
  192. package/operations/entry/elasticsearch/types.js +1 -5
  193. package/operations/entry/elasticsearch/types.js.map +1 -1
  194. package/operations/entry/index.d.ts +7 -6
  195. package/operations/entry/index.js +634 -735
  196. package/operations/entry/index.js.map +1 -1
  197. package/operations/entry/keys.d.ts +31 -1
  198. package/operations/entry/keys.js +56 -19
  199. package/operations/entry/keys.js.map +1 -1
  200. package/operations/entry/recordType.js +3 -12
  201. package/operations/entry/recordType.js.map +1 -1
  202. package/operations/entry/transformations/convertEntryKeys.d.ts +6 -6
  203. package/operations/entry/transformations/convertEntryKeys.js +2 -10
  204. package/operations/entry/transformations/convertEntryKeys.js.map +1 -1
  205. package/operations/entry/transformations/index.d.ts +17 -17
  206. package/operations/entry/transformations/index.js +22 -30
  207. package/operations/entry/transformations/index.js.map +1 -1
  208. package/operations/entry/transformations/modifyEntryValues.d.ts +27 -34
  209. package/operations/entry/transformations/modifyEntryValues.js +1 -8
  210. package/operations/entry/transformations/modifyEntryValues.js.map +1 -1
  211. package/operations/entry/transformations/transformEntryKeys.d.ts +8 -8
  212. package/operations/entry/transformations/transformEntryKeys.js +4 -11
  213. package/operations/entry/transformations/transformEntryKeys.js.map +1 -1
  214. package/operations/entry/transformations/transformEntryToIndex.d.ts +7 -7
  215. package/operations/entry/transformations/transformEntryToIndex.js +3 -10
  216. package/operations/entry/transformations/transformEntryToIndex.js.map +1 -1
  217. package/operations/group/index.d.ts +6 -5
  218. package/operations/group/index.js +39 -73
  219. package/operations/group/index.js.map +1 -1
  220. package/operations/model/index.d.ts +4 -4
  221. package/operations/model/index.js +38 -57
  222. package/operations/model/index.js.map +1 -1
  223. package/package.json +29 -41
  224. package/plugins/CmsElasticsearchModelFieldPlugin.d.ts +1 -1
  225. package/plugins/CmsElasticsearchModelFieldPlugin.js +2 -8
  226. package/plugins/CmsElasticsearchModelFieldPlugin.js.map +1 -1
  227. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +3 -2
  228. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +3 -11
  229. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +1 -1
  230. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.d.ts +2 -2
  231. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +3 -11
  232. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js.map +1 -1
  233. package/plugins/CmsEntryElasticsearchIndexPlugin.js +2 -9
  234. package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +1 -1
  235. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +3 -2
  236. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +3 -11
  237. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +1 -1
  238. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +3 -2
  239. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +3 -11
  240. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +1 -1
  241. package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +3 -2
  242. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +3 -11
  243. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +1 -1
  244. package/plugins/CmsEntryElasticsearchValuesModifier.d.ts +12 -12
  245. package/plugins/CmsEntryElasticsearchValuesModifier.js +4 -12
  246. package/plugins/CmsEntryElasticsearchValuesModifier.js.map +1 -1
  247. package/plugins/CmsEntryFilterPlugin.d.ts +3 -3
  248. package/plugins/CmsEntryFilterPlugin.js +2 -9
  249. package/plugins/CmsEntryFilterPlugin.js.map +1 -1
  250. package/plugins/index.d.ts +8 -8
  251. package/plugins/index.js +8 -93
  252. package/plugins/index.js.map +1 -1
  253. package/tasks/createIndexTaskPlugin.d.ts +2 -2
  254. package/tasks/createIndexTaskPlugin.js +36 -62
  255. package/tasks/createIndexTaskPlugin.js.map +1 -1
  256. package/types.d.ts +28 -33
  257. package/types.js +5 -8
  258. package/types.js.map +1 -1
  259. package/values/NoValueContainer.d.ts +5 -0
  260. package/values/NoValueContainer.js +13 -0
  261. package/values/NoValueContainer.js.map +1 -0
  262. package/definitions/entryElasticsearch.d.ts +0 -8
  263. package/definitions/entryElasticsearch.js +0 -38
  264. package/definitions/entryElasticsearch.js.map +0 -1
  265. package/definitions/system.d.ts +0 -8
  266. package/definitions/system.js +0 -42
  267. package/definitions/system.js.map +0 -1
  268. package/definitions/table.d.ts +0 -8
  269. package/definitions/table.js +0 -25
  270. package/definitions/table.js.map +0 -1
  271. package/definitions/tableElasticsearch.d.ts +0 -8
  272. package/definitions/tableElasticsearch.js +0 -25
  273. package/definitions/tableElasticsearch.js.map +0 -1
  274. package/dynamoDb/storage/date.d.ts +0 -3
  275. package/dynamoDb/storage/date.js +0 -84
  276. package/dynamoDb/storage/date.js.map +0 -1
  277. package/elasticsearch/indices/japanese.d.ts +0 -2
  278. package/elasticsearch/indices/japanese.js +0 -14
  279. package/elasticsearch/indices/japanese.js.map +0 -1
  280. package/operations/system/index.d.ts +0 -6
  281. package/operations/system/index.js +0 -94
  282. package/operations/system/index.js.map +0 -1
  283. package/operations/system/indexes.d.ts +0 -10
  284. package/operations/system/indexes.js +0 -41
  285. package/operations/system/indexes.js.map +0 -1
package/plugins/index.js CHANGED
@@ -1,95 +1,10 @@
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
- });
1
+ export * from "./CmsEntryElasticsearchBodyModifierPlugin.js";
2
+ export * from "./CmsEntryElasticsearchIndexPlugin.js";
3
+ export * from "./CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js";
4
+ export * from "./CmsEntryElasticsearchQueryModifierPlugin.js";
5
+ export * from "./CmsEntryElasticsearchSortModifierPlugin.js";
6
+ export * from "./CmsEntryElasticsearchFullTextSearchPlugin.js";
7
+ export * from "./CmsElasticsearchModelFieldPlugin.js";
8
+ export * from "./CmsEntryElasticsearchValuesModifier.js";
94
9
 
95
10
  //# sourceMappingURL=index.js.map
@@ -1 +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":";;;;;AAAA,IAAAA,wCAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,wCAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,wCAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,wCAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,iCAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,iCAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,iCAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,iCAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,mDAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,mDAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,mDAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,mDAAA,CAAAN,GAAA;IAAA;EAAA;AAAA;AACA,IAAAO,yCAAA,GAAAX,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAS,yCAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,yCAAA,CAAAP,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,yCAAA,CAAAP,GAAA;IAAA;EAAA;AAAA;AACA,IAAAQ,wCAAA,GAAAZ,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAU,wCAAA,EAAAT,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAQ,wCAAA,CAAAR,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAI,wCAAA,CAAAR,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,0CAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,0CAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAS,0CAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAK,0CAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AACA,IAAAU,iCAAA,GAAAd,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAY,iCAAA,EAAAX,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAU,iCAAA,CAAAV,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAM,iCAAA,CAAAV,GAAA;IAAA;EAAA;AAAA;AACA,IAAAW,oCAAA,GAAAf,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAa,oCAAA,EAAAZ,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAW,oCAAA,CAAAX,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAO,oCAAA,CAAAX,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./CmsEntryElasticsearchBodyModifierPlugin.js\";\nexport * from \"./CmsEntryElasticsearchIndexPlugin.js\";\nexport * from \"./CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js\";\nexport * from \"./CmsEntryElasticsearchQueryModifierPlugin.js\";\nexport * from \"./CmsEntryElasticsearchSortModifierPlugin.js\";\nexport * from \"./CmsEntryElasticsearchFullTextSearchPlugin.js\";\nexport * from \"./CmsElasticsearchModelFieldPlugin.js\";\nexport * from \"./CmsEntryElasticsearchValuesModifier.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import { CmsContext } from "../types";
2
- export declare const createIndexTaskPluginTest: () => import("@webiny/api-elasticsearch-tasks").CreateElasticsearchIndexTaskPlugin<CmsContext>;
1
+ import type { CmsContext } from "../types.js";
2
+ export declare const createCreateIndexTask: (context: CmsContext) => void;
@@ -1,67 +1,41 @@
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;
1
+ import { OpensearchTenantIndexFactory } from "@webiny/api-elasticsearch-tasks";
2
+ import { ListModelsUseCase } from "@webiny/api-headless-cms/features/contentModel/ListModels/index.js";
3
+ import { configurations } from "../configurations.js";
4
+ class CreateElasticsearchIndexTask {
5
+ constructor(context, listModels) {
6
+ this.context = context;
7
+ this.listModels = listModels;
8
+ }
9
+ async getIndexList(tenant) {
10
+ const result = await this.listModels.execute();
11
+ const models = result.value;
12
+ if (models.length === 0) {
13
+ return [];
62
14
  }
15
+ const indexes = models.map(model => {
16
+ const {
17
+ index
18
+ } = configurations.es({
19
+ model: {
20
+ modelId: model.modelId,
21
+ tenant: tenant.id
22
+ }
23
+ });
24
+ return {
25
+ index,
26
+ settings: configurations.indexSettings({
27
+ context: this.context
28
+ })
29
+ };
30
+ });
31
+ return indexes;
32
+ }
33
+ }
34
+ export const createCreateIndexTask = context => {
35
+ context.container.registerFactory(OpensearchTenantIndexFactory, () => {
36
+ const listModels = context.container.resolve(ListModelsUseCase);
37
+ return new CreateElasticsearchIndexTask(context, listModels);
63
38
  });
64
39
  };
65
- exports.createIndexTaskPluginTest = createIndexTaskPluginTest;
66
40
 
67
41
  //# sourceMappingURL=createIndexTaskPlugin.js.map
@@ -1 +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 {\n createElasticsearchIndexTaskPlugin,\n CreateElasticsearchIndexTaskPluginIndex\n} from \"@webiny/api-elasticsearch-tasks\";\nimport { configurations } from \"~/configurations\";\nimport { 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":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AAIA,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":[]}
1
+ {"version":3,"names":["OpensearchTenantIndexFactory","ListModelsUseCase","configurations","CreateElasticsearchIndexTask","constructor","context","listModels","getIndexList","tenant","result","execute","models","value","length","indexes","map","model","index","es","modelId","id","settings","indexSettings","createCreateIndexTask","container","registerFactory","resolve"],"sources":["createIndexTaskPlugin.ts"],"sourcesContent":["import { OpensearchTenantIndexFactory } from \"@webiny/api-elasticsearch-tasks\";\nimport type { Tenant } from \"@webiny/api-core/types/tenancy.js\";\nimport { ListModelsUseCase } from \"@webiny/api-headless-cms/features/contentModel/ListModels/index.js\";\nimport { configurations } from \"~/configurations.js\";\nimport type { CmsContext } from \"~/types.js\";\n\nclass CreateElasticsearchIndexTask implements OpensearchTenantIndexFactory.Interface {\n constructor(\n private context: CmsContext,\n private listModels: ListModelsUseCase.Interface\n ) {}\n\n async getIndexList(tenant: Tenant): Promise<OpensearchTenantIndexFactory.IndexConfig[]> {\n const result = await this.listModels.execute();\n const models = result.value;\n\n if (models.length === 0) {\n return [];\n }\n\n const indexes = models.map<OpensearchTenantIndexFactory.IndexConfig>(model => {\n const { index } = configurations.es({\n model: {\n modelId: model.modelId,\n tenant: tenant.id\n }\n });\n return {\n index,\n settings: configurations.indexSettings({\n context: this.context\n })\n };\n });\n\n return indexes;\n }\n}\n\nexport const createCreateIndexTask = (context: CmsContext) => {\n context.container.registerFactory(OpensearchTenantIndexFactory, () => {\n const listModels = context.container.resolve(ListModelsUseCase);\n return new CreateElasticsearchIndexTask(context, listModels);\n });\n};\n"],"mappings":"AAAA,SAASA,4BAA4B,QAAQ,iCAAiC;AAE9E,SAASC,iBAAiB,QAAQ,oEAAoE;AACtG,SAASC,cAAc;AAGvB,MAAMC,4BAA4B,CAAmD;EACjFC,WAAWA,CACCC,OAAmB,EACnBC,UAAuC,EACjD;IAAA,KAFUD,OAAmB,GAAnBA,OAAmB;IAAA,KACnBC,UAAuC,GAAvCA,UAAuC;EAChD;EAEH,MAAMC,YAAYA,CAACC,MAAc,EAAuD;IACpF,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACH,UAAU,CAACI,OAAO,CAAC,CAAC;IAC9C,MAAMC,MAAM,GAAGF,MAAM,CAACG,KAAK;IAE3B,IAAID,MAAM,CAACE,MAAM,KAAK,CAAC,EAAE;MACrB,OAAO,EAAE;IACb;IAEA,MAAMC,OAAO,GAAGH,MAAM,CAACI,GAAG,CAA2CC,KAAK,IAAI;MAC1E,MAAM;QAAEC;MAAM,CAAC,GAAGf,cAAc,CAACgB,EAAE,CAAC;QAChCF,KAAK,EAAE;UACHG,OAAO,EAAEH,KAAK,CAACG,OAAO;UACtBX,MAAM,EAAEA,MAAM,CAACY;QACnB;MACJ,CAAC,CAAC;MACF,OAAO;QACHH,KAAK;QACLI,QAAQ,EAAEnB,cAAc,CAACoB,aAAa,CAAC;UACnCjB,OAAO,EAAE,IAAI,CAACA;QAClB,CAAC;MACL,CAAC;IACL,CAAC,CAAC;IAEF,OAAOS,OAAO;EAClB;AACJ;AAEA,OAAO,MAAMS,qBAAqB,GAAIlB,OAAmB,IAAK;EAC1DA,OAAO,CAACmB,SAAS,CAACC,eAAe,CAACzB,4BAA4B,EAAE,MAAM;IAClE,MAAMM,UAAU,GAAGD,OAAO,CAACmB,SAAS,CAACE,OAAO,CAACzB,iBAAiB,CAAC;IAC/D,OAAO,IAAIE,4BAA4B,CAACE,OAAO,EAAEC,UAAU,CAAC;EAChE,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
package/types.d.ts CHANGED
@@ -1,29 +1,24 @@
1
- import { Plugin, PluginCollection } from "@webiny/plugins/types";
2
- import { CmsContext as BaseCmsContext, CmsEntry, CmsEntryStorageOperations as BaseCmsEntryStorageOperations, CmsModel, CmsModelField, CmsModelFieldToGraphQLPlugin, CmsModelFieldType, HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations } from "@webiny/api-headless-cms/types";
3
- import { TableConstructor } from "@webiny/db-dynamodb/toolbox";
4
- import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
5
- import { AttributeDefinition } from "@webiny/db-dynamodb/toolbox";
6
- import { Client } from "@elastic/elasticsearch";
7
- import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
8
- import { PluginsContainer } from "@webiny/plugins";
1
+ import type { Plugin, PluginCollection } from "@webiny/plugins/types.js";
2
+ import type { CmsContext as BaseCmsContext, CmsEntry, CmsEntryStorageOperations as BaseCmsEntryStorageOperations, CmsEntryValues, CmsModel, CmsModelField, CmsModelFieldToGraphQLPlugin, CmsModelFieldType, HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations } from "@webiny/api-headless-cms/types/index.js";
3
+ import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb/index.js";
4
+ import type { Client } from "@elastic/elasticsearch";
5
+ import type { PluginsContainer } from "@webiny/plugins";
6
+ import type { IEntryEntity, IGroupEntity, IModelEntity } from "./definitions/types.js";
7
+ import type { IElasticsearchEntity } from "@webiny/api-elasticsearch";
8
+ import type { ITable } from "@webiny/db-dynamodb";
9
9
  /**
10
10
  * A definition of the entry that is being prepared for the Elasticsearch.
11
11
  *
12
12
  * @category Elasticsearch
13
13
  * @category CmsEntry
14
14
  */
15
- export interface CmsIndexEntry extends CmsEntry {
15
+ export interface CmsIndexEntry<T extends CmsEntryValues = CmsEntryValues> extends CmsEntry<T> {
16
16
  /**
17
17
  * Values that are not going to be indexed.
18
18
  */
19
- rawValues: Record<string, any>;
19
+ rawValues: Partial<T>;
20
20
  /**
21
- * A first part of the ID, without the revision.
22
- * For example, we can search for all the revisions of the given entry.
23
- */
24
- primaryId: string;
25
- /**
26
- * Dev can add what ever keys they want and need. Just need to be careful not to break the entry.
21
+ * Dev can add whatever keys they want and need. Just need to be careful not to break the entry.
27
22
  */
28
23
  [key: string]: any;
29
24
  }
@@ -129,43 +124,43 @@ export interface CmsModelFieldToElasticsearchPlugin extends Plugin {
129
124
  */
130
125
  fromIndex?: (params: CmsModelFieldToElasticsearchFromParams) => any;
131
126
  }
132
- export declare type Attributes = Record<string, AttributeDefinition>;
133
127
  export declare enum ENTITIES {
134
- SYSTEM = "CmsSystem",
135
128
  GROUPS = "CmsGroups",
136
129
  MODELS = "CmsModels",
137
130
  ENTRIES = "CmsEntries",
138
131
  ENTRIES_ES = "CmsEntriesElasticsearch"
139
132
  }
140
- export interface TableModifier {
141
- (table: TableConstructor<string, string, string>): TableConstructor<string, string, string>;
142
- }
143
133
  export interface StorageOperationsFactoryParams {
144
134
  documentClient: DynamoDBDocument;
145
135
  elasticsearch: Client;
146
- table?: TableModifier;
147
- esTable?: TableModifier;
148
- attributes?: Record<ENTITIES, Attributes>;
136
+ table?: string;
137
+ esTable?: string;
149
138
  plugins?: PluginCollection;
150
139
  }
140
+ export interface CmsContext extends BaseCmsContext {
141
+ [key: string]: any;
142
+ }
143
+ export interface IGetEntitiesResponse {
144
+ groups: IGroupEntity;
145
+ models: IModelEntity;
146
+ entries: IEntryEntity;
147
+ entriesEs: IElasticsearchEntity;
148
+ }
151
149
  export interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations<CmsContext> {
152
- getTable: () => Table<string, string, string>;
153
- getEsTable: () => Table<string, string, string>;
154
- getEntities: () => Record<"system" | "groups" | "models" | "entries" | "entriesEs", Entity<any>>;
150
+ getTable: () => ITable;
151
+ getEsTable: () => ITable;
152
+ getEntities: () => IGetEntitiesResponse;
155
153
  }
156
154
  export interface StorageOperationsFactory {
157
155
  (params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;
158
156
  }
159
- export interface CmsContext extends BaseCmsContext {
160
- [key: string]: any;
161
- }
162
157
  export interface CmsEntryStorageOperations extends BaseCmsEntryStorageOperations {
163
- dataLoaders: DataLoadersHandlerInterface;
158
+ dataLoaders: IDataLoadersHandler;
164
159
  }
165
160
  export interface DataLoadersHandlerInterfaceClearAllParams {
166
- model: Pick<CmsModel, "tenant" | "locale">;
161
+ model: Pick<CmsModel, "tenant">;
167
162
  }
168
- export interface DataLoadersHandlerInterface {
163
+ export interface IDataLoadersHandler {
169
164
  clearAll: (params?: DataLoadersHandlerInterfaceClearAllParams) => void;
170
165
  }
171
166
  export {};
package/types.js CHANGED
@@ -1,27 +1,24 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ENTITIES = void 0;
7
1
  /**
8
2
  * A definition of the entry that is being prepared for the Elasticsearch.
9
3
  *
10
4
  * @category Elasticsearch
11
5
  * @category CmsEntry
12
6
  */
7
+
13
8
  /**
14
9
  * Arguments for the method that is transforming content entry in its original form to the one we are storing to the Elasticsearch.
15
10
  *
16
11
  * @category Elasticsearch
17
12
  * @category CmsEntry
18
13
  */
14
+
19
15
  /**
20
16
  * Arguments for the method that is transforming content entry from Elasticsearch into the original one.
21
17
  *
22
18
  * @category Elasticsearch
23
19
  * @category CmsEntry
24
20
  */
21
+
25
22
  /**
26
23
  * A plugin defining transformation of entry for Elasticsearch.
27
24
  *
@@ -30,8 +27,8 @@ exports.ENTITIES = void 0;
30
27
  * @category CmsEntry
31
28
  * @category Elasticsearch
32
29
  */
33
- let ENTITIES = exports.ENTITIES = /*#__PURE__*/function (ENTITIES) {
34
- ENTITIES["SYSTEM"] = "CmsSystem";
30
+
31
+ export let ENTITIES = /*#__PURE__*/function (ENTITIES) {
35
32
  ENTITIES["GROUPS"] = "CmsGroups";
36
33
  ENTITIES["MODELS"] = "CmsModels";
37
34
  ENTITIES["ENTRIES"] = "CmsEntries";
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["ENTITIES","exports"],"sources":["types.ts"],"sourcesContent":["import { Plugin, PluginCollection } from \"@webiny/plugins/types\";\nimport {\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 { TableConstructor } from \"@webiny/db-dynamodb/toolbox\";\nimport { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb\";\nimport { AttributeDefinition } from \"@webiny/db-dynamodb/toolbox\";\nimport { Client } from \"@elastic/elasticsearch\";\nimport { Entity, Table } from \"@webiny/db-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 */\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 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 CmsContext extends BaseCmsContext {\n [key: string]: any;\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":";;;;;;AAkBA;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":[]}
1
+ {"version":3,"names":["ENTITIES"],"sources":["types.ts"],"sourcesContent":["import type { Plugin, PluginCollection } from \"@webiny/plugins/types.js\";\nimport type {\n CmsContext as BaseCmsContext,\n CmsEntry,\n CmsEntryStorageOperations as BaseCmsEntryStorageOperations,\n CmsEntryValues,\n CmsModel,\n CmsModelField,\n CmsModelFieldToGraphQLPlugin,\n CmsModelFieldType,\n HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport type { Client } from \"@elastic/elasticsearch\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport type { IEntryEntity, IGroupEntity, IModelEntity } from \"~/definitions/types.js\";\nimport type { IElasticsearchEntity } from \"@webiny/api-elasticsearch\";\nimport type { ITable } from \"@webiny/db-dynamodb\";\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<T extends CmsEntryValues = CmsEntryValues> extends CmsEntry<T> {\n /**\n * Values that are not going to be indexed.\n */\n rawValues: Partial<T>;\n /**\n * Dev can add whatever 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 enum ENTITIES {\n GROUPS = \"CmsGroups\",\n MODELS = \"CmsModels\",\n ENTRIES = \"CmsEntries\",\n ENTRIES_ES = \"CmsEntriesElasticsearch\"\n}\n\nexport interface StorageOperationsFactoryParams {\n documentClient: DynamoDBDocument;\n elasticsearch: Client;\n table?: string;\n esTable?: string;\n plugins?: PluginCollection;\n}\n\nexport interface CmsContext extends BaseCmsContext {\n [key: string]: any;\n}\n\nexport interface IGetEntitiesResponse {\n groups: IGroupEntity;\n models: IModelEntity;\n entries: IEntryEntity;\n entriesEs: IElasticsearchEntity;\n}\n\nexport interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations<CmsContext> {\n getTable: () => ITable;\n getEsTable: () => ITable;\n getEntities: () => IGetEntitiesResponse;\n}\n\nexport interface StorageOperationsFactory {\n (params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;\n}\n\nexport interface CmsEntryStorageOperations extends BaseCmsEntryStorageOperations {\n dataLoaders: IDataLoadersHandler;\n}\n\nexport interface DataLoadersHandlerInterfaceClearAllParams {\n model: Pick<CmsModel, \"tenant\">;\n}\nexport interface IDataLoadersHandler {\n clearAll: (params?: DataLoadersHandlerInterfaceClearAllParams) => void;\n}\n"],"mappings":"AAmBA;AACA;AACA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA;;AAiBA;AACA;AACA;AACA;AACA;AACA;;AAsBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkDA,WAAYA,QAAQ,0BAARA,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,13 @@
1
+ export class NoValueContainer {
2
+ constructor() {
3
+ //
4
+ }
5
+ static create() {
6
+ return new NoValueContainer();
7
+ }
8
+ static is(value) {
9
+ return value instanceof NoValueContainer;
10
+ }
11
+ }
12
+
13
+ //# sourceMappingURL=NoValueContainer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NoValueContainer","constructor","create","is","value"],"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":"AAAA,OAAO,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","ignoreList":[]}
@@ -1,8 +0,0 @@
1
- import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
2
- import { Attributes } from "../types";
3
- export interface CreateEntryElasticsearchEntityParams {
4
- table: Table<string, string, string>;
5
- entityName: string;
6
- attributes: Attributes;
7
- }
8
- export declare const createEntryElasticsearchEntity: (params: CreateEntryElasticsearchEntityParams) => Entity<any>;
@@ -1,38 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createEntryElasticsearchEntity = void 0;
7
- var _toolbox = require("@webiny/db-dynamodb/toolbox");
8
- const createEntryElasticsearchEntity = params => {
9
- const {
10
- table,
11
- entityName,
12
- attributes
13
- } = params;
14
- return new _toolbox.Entity({
15
- name: entityName,
16
- table,
17
- attributes: {
18
- PK: {
19
- type: "string",
20
- partitionKey: true
21
- },
22
- SK: {
23
- type: "string",
24
- sortKey: true
25
- },
26
- index: {
27
- type: "string"
28
- },
29
- data: {
30
- type: "map"
31
- },
32
- ...(attributes || {})
33
- }
34
- });
35
- };
36
- exports.createEntryElasticsearchEntity = createEntryElasticsearchEntity;
37
-
38
- //# sourceMappingURL=entryElasticsearch.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_toolbox","require","createEntryElasticsearchEntity","params","table","entityName","attributes","Entity","name","PK","type","partitionKey","SK","sortKey","index","data","exports"],"sources":["entryElasticsearch.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\nexport interface CreateEntryElasticsearchEntityParams {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\nexport const createEntryElasticsearchEntity = (\n params: CreateEntryElasticsearchEntityParams\n): Entity<any> => {\n const { table, entityName, attributes } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n type: \"string\",\n partitionKey: true\n },\n SK: {\n type: \"string\",\n sortKey: true\n },\n index: {\n type: \"string\"\n },\n data: {\n type: \"map\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAQO,MAAMC,8BAA8B,GACvCC,MAA4C,IAC9B;EACd,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAW,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEH,UAAU;IAChBD,KAAK;IACLE,UAAU,EAAE;MACRG,EAAE,EAAE;QACAC,IAAI,EAAE,QAAQ;QACdC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAF,IAAI,EAAE,QAAQ;QACdG,OAAO,EAAE;MACb,CAAC;MACDC,KAAK,EAAE;QACHJ,IAAI,EAAE;MACV,CAAC;MACDK,IAAI,EAAE;QACFL,IAAI,EAAE;MACV,CAAC;MACD,IAAIJ,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACU,OAAA,CAAAd,8BAAA,GAAAA,8BAAA","ignoreList":[]}
@@ -1,8 +0,0 @@
1
- import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
2
- import { Attributes } from "../types";
3
- export interface CreateSystemEntityParams {
4
- table: Table<string, string, string>;
5
- entityName: string;
6
- attributes: Attributes;
7
- }
8
- export declare const createSystemEntity: (params: CreateSystemEntityParams) => Entity<any>;
@@ -1,42 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createSystemEntity = void 0;
7
- var _toolbox = require("@webiny/db-dynamodb/toolbox");
8
- const createSystemEntity = params => {
9
- const {
10
- entityName,
11
- attributes,
12
- table
13
- } = params;
14
- return new _toolbox.Entity({
15
- name: entityName,
16
- table,
17
- attributes: {
18
- PK: {
19
- partitionKey: true
20
- },
21
- SK: {
22
- sortKey: true
23
- },
24
- version: {
25
- type: "string"
26
- },
27
- locale: {
28
- type: "string"
29
- },
30
- tenant: {
31
- type: "string"
32
- },
33
- readAPIKey: {
34
- type: "string"
35
- },
36
- ...(attributes || {})
37
- }
38
- });
39
- };
40
- exports.createSystemEntity = createSystemEntity;
41
-
42
- //# sourceMappingURL=system.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_toolbox","require","createSystemEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","version","type","locale","tenant","readAPIKey","exports"],"sources":["system.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\nexport interface CreateSystemEntityParams {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createSystemEntity = (params: CreateSystemEntityParams): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n version: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n readAPIKey: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,kBAAkB,GAAIC,MAAgC,IAAkB;EACjF,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV,CAAC;MACDC,MAAM,EAAE;QACJD,IAAI,EAAE;MACV,CAAC;MACDE,MAAM,EAAE;QACJF,IAAI,EAAE;MACV,CAAC;MACDG,UAAU,EAAE;QACRH,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACa,OAAA,CAAAhB,kBAAA,GAAAA,kBAAA","ignoreList":[]}
@@ -1,8 +0,0 @@
1
- import { TableModifier } from "../types";
2
- import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
3
- import { Table } from "@webiny/db-dynamodb/toolbox";
4
- export interface CreateTableParams {
5
- table?: TableModifier;
6
- documentClient: DynamoDBDocument;
7
- }
8
- export declare const createTable: ({ table, documentClient }: CreateTableParams) => Table<string, string, string>;
@@ -1,25 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createTable = void 0;
7
- var _toolbox = require("@webiny/db-dynamodb/toolbox");
8
- const createTable = ({
9
- table,
10
- documentClient
11
- }) => {
12
- const tableConfig = {
13
- name: process.env.DB_TABLE_HEADLESS_CMS || process.env.DB_TABLE,
14
- partitionKey: "PK",
15
- sortKey: "SK",
16
- DocumentClient: documentClient,
17
- autoExecute: true,
18
- autoParse: true
19
- };
20
- const config = typeof table === "function" ? table(tableConfig) : tableConfig;
21
- return new _toolbox.Table(config);
22
- };
23
- exports.createTable = createTable;
24
-
25
- //# sourceMappingURL=table.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_toolbox","require","createTable","table","documentClient","tableConfig","name","process","env","DB_TABLE_HEADLESS_CMS","DB_TABLE","partitionKey","sortKey","DocumentClient","autoExecute","autoParse","config","Table","exports"],"sources":["table.ts"],"sourcesContent":["import { TableModifier } from \"~/types\";\nimport { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb\";\nimport { Table, TableConstructor } from \"@webiny/db-dynamodb/toolbox\";\n\nexport interface CreateTableParams {\n table?: TableModifier;\n documentClient: DynamoDBDocument;\n}\nexport const createTable = ({\n table,\n documentClient\n}: CreateTableParams): Table<string, string, string> => {\n const tableConfig: TableConstructor<string, string, string> = {\n name: process.env.DB_TABLE_HEADLESS_CMS || (process.env.DB_TABLE as string),\n partitionKey: \"PK\",\n sortKey: \"SK\",\n DocumentClient: documentClient,\n autoExecute: true,\n autoParse: true\n };\n\n const config = typeof table === \"function\" ? table(tableConfig) : tableConfig;\n\n return new Table(config);\n};\n"],"mappings":";;;;;;AAEA,IAAAA,QAAA,GAAAC,OAAA;AAMO,MAAMC,WAAW,GAAGA,CAAC;EACxBC,KAAK;EACLC;AACe,CAAC,KAAoC;EACpD,MAAMC,WAAqD,GAAG;IAC1DC,IAAI,EAAEC,OAAO,CAACC,GAAG,CAACC,qBAAqB,IAAKF,OAAO,CAACC,GAAG,CAACE,QAAmB;IAC3EC,YAAY,EAAE,IAAI;IAClBC,OAAO,EAAE,IAAI;IACbC,cAAc,EAAET,cAAc;IAC9BU,WAAW,EAAE,IAAI;IACjBC,SAAS,EAAE;EACf,CAAC;EAED,MAAMC,MAAM,GAAG,OAAOb,KAAK,KAAK,UAAU,GAAGA,KAAK,CAACE,WAAW,CAAC,GAAGA,WAAW;EAE7E,OAAO,IAAIY,cAAK,CAACD,MAAM,CAAC;AAC5B,CAAC;AAACE,OAAA,CAAAhB,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -1,8 +0,0 @@
1
- import { TableModifier } from "../types";
2
- import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
3
- import { Table } from "@webiny/db-dynamodb/toolbox";
4
- export interface CreateElasticsearchTableParams {
5
- table?: TableModifier;
6
- documentClient: DynamoDBDocument;
7
- }
8
- export declare const createElasticsearchTable: ({ table, documentClient }: CreateElasticsearchTableParams) => Table<string, string, string>;