@webiny/api-headless-cms-ddb-es 6.0.0-alpha.5 → 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 (282) 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 -6
  6. package/definitions/entry.js +5 -174
  7. package/definitions/entry.js.map +1 -1
  8. package/definitions/group.d.ts +6 -7
  9. package/definitions/group.js +5 -58
  10. package/definitions/group.js.map +1 -1
  11. package/definitions/model.d.ts +6 -7
  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 -13
  19. package/dynamoDb/index.js.map +1 -1
  20. package/dynamoDb/storage/longText.js +10 -18
  21. package/dynamoDb/storage/longText.js.map +1 -1
  22. package/dynamoDb/storage/richText.js +10 -18
  23. package/dynamoDb/storage/richText.js.map +1 -1
  24. package/elasticsearch/createElasticsearchIndex.d.ts +1 -1
  25. package/elasticsearch/createElasticsearchIndex.js +7 -15
  26. package/elasticsearch/createElasticsearchIndex.js.map +1 -1
  27. package/elasticsearch/deleteElasticsearchIndex.d.ts +1 -1
  28. package/elasticsearch/deleteElasticsearchIndex.js +3 -10
  29. package/elasticsearch/deleteElasticsearchIndex.js.map +1 -1
  30. package/elasticsearch/index.d.ts +1 -1
  31. package/elasticsearch/index.js +3 -11
  32. package/elasticsearch/index.js.map +1 -1
  33. package/elasticsearch/indexing/dateTimeIndexing.d.ts +1 -1
  34. package/elasticsearch/indexing/dateTimeIndexing.js +1 -8
  35. package/elasticsearch/indexing/dateTimeIndexing.js.map +1 -1
  36. package/elasticsearch/indexing/defaultFieldIndexing.d.ts +1 -1
  37. package/elasticsearch/indexing/defaultFieldIndexing.js +1 -8
  38. package/elasticsearch/indexing/defaultFieldIndexing.js.map +1 -1
  39. package/elasticsearch/indexing/index.d.ts +1 -1
  40. package/elasticsearch/indexing/index.js +8 -16
  41. package/elasticsearch/indexing/index.js.map +1 -1
  42. package/elasticsearch/indexing/jsonIndexing.d.ts +1 -1
  43. package/elasticsearch/indexing/jsonIndexing.js +1 -8
  44. package/elasticsearch/indexing/jsonIndexing.js.map +1 -1
  45. package/elasticsearch/indexing/longTextIndexing.d.ts +1 -1
  46. package/elasticsearch/indexing/longTextIndexing.js +1 -8
  47. package/elasticsearch/indexing/longTextIndexing.js.map +1 -1
  48. package/elasticsearch/indexing/numberIndexing.d.ts +1 -1
  49. package/elasticsearch/indexing/numberIndexing.js +1 -8
  50. package/elasticsearch/indexing/numberIndexing.js.map +1 -1
  51. package/elasticsearch/indexing/objectIndexing.d.ts +1 -1
  52. package/elasticsearch/indexing/objectIndexing.js +6 -13
  53. package/elasticsearch/indexing/objectIndexing.js.map +1 -1
  54. package/elasticsearch/indexing/richTextIndexing.d.ts +1 -1
  55. package/elasticsearch/indexing/richTextIndexing.js +1 -8
  56. package/elasticsearch/indexing/richTextIndexing.js.map +1 -1
  57. package/elasticsearch/indices/base.d.ts +1 -1
  58. package/elasticsearch/indices/base.js +4 -10
  59. package/elasticsearch/indices/base.js.map +1 -1
  60. package/elasticsearch/indices/index.d.ts +1 -1
  61. package/elasticsearch/indices/index.js +3 -11
  62. package/elasticsearch/indices/index.js.map +1 -1
  63. package/elasticsearch/search/index.d.ts +1 -1
  64. package/elasticsearch/search/index.js +4 -11
  65. package/elasticsearch/search/index.js.map +1 -1
  66. package/elasticsearch/search/refSearch.d.ts +1 -1
  67. package/elasticsearch/search/refSearch.js +3 -10
  68. package/elasticsearch/search/refSearch.js.map +1 -1
  69. package/elasticsearch/search/searchableJson.d.ts +1 -1
  70. package/elasticsearch/search/searchableJson.js +9 -16
  71. package/elasticsearch/search/searchableJson.js.map +1 -1
  72. package/elasticsearch/search/timeSearch.d.ts +1 -1
  73. package/elasticsearch/search/timeSearch.js +3 -10
  74. package/elasticsearch/search/timeSearch.js.map +1 -1
  75. package/helpers/entryIndexHelpers.d.ts +9 -9
  76. package/helpers/entryIndexHelpers.js +32 -26
  77. package/helpers/entryIndexHelpers.js.map +1 -1
  78. package/helpers/fieldIdentifier.d.ts +1 -1
  79. package/helpers/fieldIdentifier.js +2 -10
  80. package/helpers/fieldIdentifier.js.map +1 -1
  81. package/helpers/index.d.ts +2 -2
  82. package/helpers/index.js +2 -27
  83. package/helpers/index.js.map +1 -1
  84. package/index.d.ts +2 -2
  85. package/index.js +98 -133
  86. package/index.js.map +1 -1
  87. package/operations/entry/dataLoader/DataLoaderCache.d.ts +0 -2
  88. package/operations/entry/dataLoader/DataLoaderCache.js +2 -9
  89. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
  90. package/operations/entry/dataLoader/constants.js +1 -7
  91. package/operations/entry/dataLoader/constants.js.map +1 -1
  92. package/operations/entry/dataLoader/createBatchScheduleFn.js +4 -10
  93. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
  94. package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +3 -3
  95. package/operations/entry/dataLoader/getAllEntryRevisions.js +11 -24
  96. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
  97. package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +3 -3
  98. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +18 -30
  99. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
  100. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +3 -3
  101. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +18 -30
  102. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
  103. package/operations/entry/dataLoader/getRevisionById.d.ts +3 -3
  104. package/operations/entry/dataLoader/getRevisionById.js +23 -35
  105. package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
  106. package/operations/entry/dataLoader/index.d.ts +3 -3
  107. package/operations/entry/dataLoader/index.js +10 -31
  108. package/operations/entry/dataLoader/index.js.map +1 -1
  109. package/operations/entry/dataLoader/types.d.ts +3 -4
  110. package/operations/entry/dataLoader/types.js +1 -5
  111. package/operations/entry/dataLoader/types.js.map +1 -1
  112. package/operations/entry/dataLoaders.d.ts +13 -13
  113. package/operations/entry/dataLoaders.js +15 -25
  114. package/operations/entry/dataLoaders.js.map +1 -1
  115. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +1 -1
  116. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +1 -8
  117. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +1 -1
  118. package/operations/entry/elasticsearch/body.d.ts +2 -2
  119. package/operations/entry/elasticsearch/body.js +21 -28
  120. package/operations/entry/elasticsearch/body.js.map +1 -1
  121. package/operations/entry/elasticsearch/fields.d.ts +2 -2
  122. package/operations/entry/elasticsearch/fields.js +110 -24
  123. package/operations/entry/elasticsearch/fields.js.map +1 -1
  124. package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +2 -2
  125. package/operations/entry/elasticsearch/filtering/applyFiltering.js +9 -17
  126. package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +1 -1
  127. package/operations/entry/elasticsearch/filtering/exec.d.ts +6 -5
  128. package/operations/entry/elasticsearch/filtering/exec.js +48 -45
  129. package/operations/entry/elasticsearch/filtering/exec.js.map +1 -1
  130. package/operations/entry/elasticsearch/filtering/index.d.ts +1 -1
  131. package/operations/entry/elasticsearch/filtering/index.js +1 -16
  132. package/operations/entry/elasticsearch/filtering/index.js.map +1 -1
  133. package/operations/entry/elasticsearch/filtering/path.d.ts +1 -1
  134. package/operations/entry/elasticsearch/filtering/path.js +5 -15
  135. package/operations/entry/elasticsearch/filtering/path.js.map +1 -1
  136. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.d.ts +1 -1
  137. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +6 -14
  138. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js.map +1 -1
  139. package/operations/entry/elasticsearch/filtering/plugins/index.d.ts +1 -1
  140. package/operations/entry/elasticsearch/filtering/plugins/index.js +5 -12
  141. package/operations/entry/elasticsearch/filtering/plugins/index.js.map +1 -1
  142. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.d.ts +1 -1
  143. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +7 -15
  144. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js.map +1 -1
  145. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.d.ts +1 -1
  146. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +7 -15
  147. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js.map +1 -1
  148. package/operations/entry/elasticsearch/filtering/populated.d.ts +1 -1
  149. package/operations/entry/elasticsearch/filtering/populated.js +1 -8
  150. package/operations/entry/elasticsearch/filtering/populated.js.map +1 -1
  151. package/operations/entry/elasticsearch/filtering/values.d.ts +1 -1
  152. package/operations/entry/elasticsearch/filtering/values.js +4 -12
  153. package/operations/entry/elasticsearch/filtering/values.js.map +1 -1
  154. package/operations/entry/elasticsearch/fullTextSearch.d.ts +2 -2
  155. package/operations/entry/elasticsearch/fullTextSearch.js +6 -12
  156. package/operations/entry/elasticsearch/fullTextSearch.js.map +1 -1
  157. package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +1 -1
  158. package/operations/entry/elasticsearch/fullTextSearchFields.js +1 -8
  159. package/operations/entry/elasticsearch/fullTextSearchFields.js.map +1 -1
  160. package/operations/entry/elasticsearch/initialQuery.d.ts +2 -2
  161. package/operations/entry/elasticsearch/initialQuery.js +9 -27
  162. package/operations/entry/elasticsearch/initialQuery.js.map +1 -1
  163. package/operations/entry/elasticsearch/keyword.d.ts +1 -1
  164. package/operations/entry/elasticsearch/keyword.js +4 -9
  165. package/operations/entry/elasticsearch/keyword.js.map +1 -1
  166. package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +2 -2
  167. package/operations/entry/elasticsearch/plugins/bodyModifier.js +3 -10
  168. package/operations/entry/elasticsearch/plugins/bodyModifier.js.map +1 -1
  169. package/operations/entry/elasticsearch/plugins/operator.d.ts +1 -2
  170. package/operations/entry/elasticsearch/plugins/operator.js +4 -19
  171. package/operations/entry/elasticsearch/plugins/operator.js.map +1 -1
  172. package/operations/entry/elasticsearch/plugins/queryModifier.d.ts +2 -2
  173. package/operations/entry/elasticsearch/plugins/queryModifier.js +3 -10
  174. package/operations/entry/elasticsearch/plugins/queryModifier.js.map +1 -1
  175. package/operations/entry/elasticsearch/plugins/search.d.ts +1 -1
  176. package/operations/entry/elasticsearch/plugins/search.js +5 -13
  177. package/operations/entry/elasticsearch/plugins/search.js.map +1 -1
  178. package/operations/entry/elasticsearch/plugins/sortModifier.d.ts +2 -2
  179. package/operations/entry/elasticsearch/plugins/sortModifier.js +3 -10
  180. package/operations/entry/elasticsearch/plugins/sortModifier.js.map +1 -1
  181. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js +1 -8
  182. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js.map +1 -1
  183. package/operations/entry/elasticsearch/sort.d.ts +3 -3
  184. package/operations/entry/elasticsearch/sort.js +51 -33
  185. package/operations/entry/elasticsearch/sort.js.map +1 -1
  186. package/operations/entry/elasticsearch/transformValueForSearch.d.ts +2 -2
  187. package/operations/entry/elasticsearch/transformValueForSearch.js +4 -9
  188. package/operations/entry/elasticsearch/transformValueForSearch.js.map +1 -1
  189. package/operations/entry/elasticsearch/types.d.ts +2 -2
  190. package/operations/entry/elasticsearch/types.js +1 -5
  191. package/operations/entry/elasticsearch/types.js.map +1 -1
  192. package/operations/entry/index.d.ts +5 -4
  193. package/operations/entry/index.js +333 -515
  194. package/operations/entry/index.js.map +1 -1
  195. package/operations/entry/keys.d.ts +31 -1
  196. package/operations/entry/keys.js +56 -19
  197. package/operations/entry/keys.js.map +1 -1
  198. package/operations/entry/recordType.js +3 -12
  199. package/operations/entry/recordType.js.map +1 -1
  200. package/operations/entry/transformations/convertEntryKeys.d.ts +6 -6
  201. package/operations/entry/transformations/convertEntryKeys.js +2 -10
  202. package/operations/entry/transformations/convertEntryKeys.js.map +1 -1
  203. package/operations/entry/transformations/index.d.ts +16 -16
  204. package/operations/entry/transformations/index.js +22 -30
  205. package/operations/entry/transformations/index.js.map +1 -1
  206. package/operations/entry/transformations/modifyEntryValues.d.ts +27 -34
  207. package/operations/entry/transformations/modifyEntryValues.js +1 -8
  208. package/operations/entry/transformations/modifyEntryValues.js.map +1 -1
  209. package/operations/entry/transformations/transformEntryKeys.d.ts +8 -8
  210. package/operations/entry/transformations/transformEntryKeys.js +4 -11
  211. package/operations/entry/transformations/transformEntryKeys.js.map +1 -1
  212. package/operations/entry/transformations/transformEntryToIndex.d.ts +6 -6
  213. package/operations/entry/transformations/transformEntryToIndex.js +3 -10
  214. package/operations/entry/transformations/transformEntryToIndex.js.map +1 -1
  215. package/operations/group/index.d.ts +5 -4
  216. package/operations/group/index.js +39 -73
  217. package/operations/group/index.js.map +1 -1
  218. package/operations/model/index.d.ts +3 -3
  219. package/operations/model/index.js +38 -57
  220. package/operations/model/index.js.map +1 -1
  221. package/package.json +27 -32
  222. package/plugins/CmsElasticsearchModelFieldPlugin.d.ts +1 -1
  223. package/plugins/CmsElasticsearchModelFieldPlugin.js +2 -8
  224. package/plugins/CmsElasticsearchModelFieldPlugin.js.map +1 -1
  225. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +1 -1
  226. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +3 -11
  227. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +1 -1
  228. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.d.ts +2 -2
  229. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +3 -11
  230. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js.map +1 -1
  231. package/plugins/CmsEntryElasticsearchIndexPlugin.js +2 -9
  232. package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +1 -1
  233. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +2 -2
  234. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +3 -11
  235. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +1 -1
  236. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +1 -1
  237. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +3 -11
  238. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +1 -1
  239. package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +1 -1
  240. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +3 -11
  241. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +1 -1
  242. package/plugins/CmsEntryElasticsearchValuesModifier.d.ts +12 -12
  243. package/plugins/CmsEntryElasticsearchValuesModifier.js +4 -12
  244. package/plugins/CmsEntryElasticsearchValuesModifier.js.map +1 -1
  245. package/plugins/CmsEntryFilterPlugin.d.ts +3 -3
  246. package/plugins/CmsEntryFilterPlugin.js +2 -9
  247. package/plugins/CmsEntryFilterPlugin.js.map +1 -1
  248. package/plugins/index.d.ts +8 -8
  249. package/plugins/index.js +8 -93
  250. package/plugins/index.js.map +1 -1
  251. package/tasks/createIndexTaskPlugin.d.ts +2 -2
  252. package/tasks/createIndexTaskPlugin.js +36 -62
  253. package/tasks/createIndexTaskPlugin.js.map +1 -1
  254. package/types.d.ts +23 -26
  255. package/types.js +5 -8
  256. package/types.js.map +1 -1
  257. package/values/NoValueContainer.js +1 -8
  258. package/values/NoValueContainer.js.map +1 -1
  259. package/definitions/entryElasticsearch.d.ts +0 -9
  260. package/definitions/entryElasticsearch.js +0 -41
  261. package/definitions/entryElasticsearch.js.map +0 -1
  262. package/definitions/system.d.ts +0 -9
  263. package/definitions/system.js +0 -42
  264. package/definitions/system.js.map +0 -1
  265. package/definitions/table.d.ts +0 -8
  266. package/definitions/table.js +0 -25
  267. package/definitions/table.js.map +0 -1
  268. package/definitions/tableElasticsearch.d.ts +0 -8
  269. package/definitions/tableElasticsearch.js +0 -25
  270. package/definitions/tableElasticsearch.js.map +0 -1
  271. package/elasticsearch/indices/japanese.d.ts +0 -2
  272. package/elasticsearch/indices/japanese.js +0 -14
  273. package/elasticsearch/indices/japanese.js.map +0 -1
  274. package/operations/entry/elasticsearch/logIgnoredEsResponseError.d.ts +0 -9
  275. package/operations/entry/elasticsearch/logIgnoredEsResponseError.js +0 -26
  276. package/operations/entry/elasticsearch/logIgnoredEsResponseError.js.map +0 -1
  277. package/operations/system/index.d.ts +0 -6
  278. package/operations/system/index.js +0 -94
  279. package/operations/system/index.js.map +0 -1
  280. package/operations/system/indexes.d.ts +0 -10
  281. package/operations/system/indexes.js +0 -41
  282. package/operations/system/indexes.js.map +0 -1
@@ -1,6 +0,0 @@
1
- import type { CmsSystemStorageOperations } from "@webiny/api-headless-cms/types";
2
- import type { Entity } from "@webiny/db-dynamodb/toolbox";
3
- export interface CreateSystemStorageOperationsParams {
4
- entity: Entity<any>;
5
- }
6
- export declare const createSystemStorageOperations: (params: CreateSystemStorageOperationsParams) => CmsSystemStorageOperations;
@@ -1,94 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createSystemStorageOperations = void 0;
8
- var _error = _interopRequireDefault(require("@webiny/error"));
9
- var _get = require("@webiny/db-dynamodb/utils/get");
10
- var _dbDynamodb = require("@webiny/db-dynamodb");
11
- const createPartitionKey = ({
12
- tenant
13
- }) => {
14
- return `T#${tenant.toLowerCase()}#SYSTEM`;
15
- };
16
- const createSortKey = () => {
17
- return "CMS";
18
- };
19
- const createKeys = params => {
20
- return {
21
- PK: createPartitionKey(params),
22
- SK: createSortKey()
23
- };
24
- };
25
- const createSystemStorageOperations = params => {
26
- const {
27
- entity
28
- } = params;
29
- const create = async ({
30
- system
31
- }) => {
32
- const keys = createKeys(system);
33
- try {
34
- await (0, _dbDynamodb.put)({
35
- entity,
36
- item: {
37
- ...system,
38
- ...keys
39
- }
40
- });
41
- return system;
42
- } catch (ex) {
43
- throw new _error.default(ex.message || "Could not create system.", ex.code || "CREATE_SYSTEM_ERROR", {
44
- error: ex,
45
- system,
46
- keys
47
- });
48
- }
49
- };
50
- const update = async params => {
51
- const {
52
- system
53
- } = params;
54
- const keys = createKeys(system);
55
- try {
56
- await (0, _dbDynamodb.put)({
57
- entity,
58
- item: {
59
- ...system,
60
- ...keys
61
- }
62
- });
63
- return system;
64
- } catch (ex) {
65
- throw new _error.default(ex.message || "Could not update system.", ex.code || "UPDATE_SYSTEM_ERROR", {
66
- error: ex,
67
- system,
68
- keys
69
- });
70
- }
71
- };
72
- const get = async params => {
73
- const keys = createKeys(params);
74
- try {
75
- return await (0, _get.getClean)({
76
- entity,
77
- keys
78
- });
79
- } catch (ex) {
80
- throw new _error.default(ex.message || "Could not get system.", ex.code || "GET_SYSTEM_ERROR", {
81
- error: ex,
82
- keys
83
- });
84
- }
85
- };
86
- return {
87
- create,
88
- update,
89
- get
90
- };
91
- };
92
- exports.createSystemStorageOperations = createSystemStorageOperations;
93
-
94
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_get","_dbDynamodb","createPartitionKey","tenant","toLowerCase","createSortKey","createKeys","params","PK","SK","createSystemStorageOperations","entity","create","system","keys","put","item","ex","WebinyError","message","code","error","update","get","getClean","exports"],"sources":["index.ts"],"sourcesContent":["import type {\n CmsSystem,\n CmsSystemStorageOperations,\n CmsSystemStorageOperationsCreateParams,\n CmsSystemStorageOperationsGetParams,\n CmsSystemStorageOperationsUpdateParams\n} from \"@webiny/api-headless-cms/types\";\nimport type { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport WebinyError from \"@webiny/error\";\nimport { getClean } from \"@webiny/db-dynamodb/utils/get\";\nimport { put } from \"@webiny/db-dynamodb\";\n\nexport interface CreateSystemStorageOperationsParams {\n entity: Entity<any>;\n}\n\ninterface PartitionKeyParams {\n tenant: string;\n}\nconst createPartitionKey = ({ tenant }: PartitionKeyParams): string => {\n return `T#${tenant.toLowerCase()}#SYSTEM`;\n};\nconst createSortKey = (): string => {\n return \"CMS\";\n};\n\ninterface Keys {\n PK: string;\n SK: string;\n}\nconst createKeys = (params: PartitionKeyParams): Keys => {\n return {\n PK: createPartitionKey(params),\n SK: createSortKey()\n };\n};\n\nexport const createSystemStorageOperations = (\n params: CreateSystemStorageOperationsParams\n): CmsSystemStorageOperations => {\n const { entity } = params;\n\n const create = async ({ system }: CmsSystemStorageOperationsCreateParams) => {\n const keys = createKeys(system);\n try {\n await put({\n entity,\n item: {\n ...system,\n ...keys\n }\n });\n return system;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create system.\",\n ex.code || \"CREATE_SYSTEM_ERROR\",\n {\n error: ex,\n system,\n keys\n }\n );\n }\n };\n\n const update = async (params: CmsSystemStorageOperationsUpdateParams) => {\n const { system } = params;\n\n const keys = createKeys(system);\n\n try {\n await put({\n entity,\n item: {\n ...system,\n ...keys\n }\n });\n return system;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update system.\",\n ex.code || \"UPDATE_SYSTEM_ERROR\",\n {\n error: ex,\n system,\n keys\n }\n );\n }\n };\n\n const get = async (params: CmsSystemStorageOperationsGetParams) => {\n const keys = createKeys(params);\n\n try {\n return await getClean<CmsSystem>({\n entity,\n keys\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get system.\",\n ex.code || \"GET_SYSTEM_ERROR\",\n {\n error: ex,\n keys\n }\n );\n }\n };\n\n return {\n create,\n update,\n get\n };\n};\n"],"mappings":";;;;;;;AAQA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AASA,MAAMG,kBAAkB,GAAGA,CAAC;EAAEC;AAA2B,CAAC,KAAa;EACnE,OAAO,KAAKA,MAAM,CAACC,WAAW,CAAC,CAAC,SAAS;AAC7C,CAAC;AACD,MAAMC,aAAa,GAAGA,CAAA,KAAc;EAChC,OAAO,KAAK;AAChB,CAAC;AAMD,MAAMC,UAAU,GAAIC,MAA0B,IAAW;EACrD,OAAO;IACHC,EAAE,EAAEN,kBAAkB,CAACK,MAAM,CAAC;IAC9BE,EAAE,EAAEJ,aAAa,CAAC;EACtB,CAAC;AACL,CAAC;AAEM,MAAMK,6BAA6B,GACtCH,MAA2C,IACd;EAC7B,MAAM;IAAEI;EAAO,CAAC,GAAGJ,MAAM;EAEzB,MAAMK,MAAM,GAAG,MAAAA,CAAO;IAAEC;EAA+C,CAAC,KAAK;IACzE,MAAMC,IAAI,GAAGR,UAAU,CAACO,MAAM,CAAC;IAC/B,IAAI;MACA,MAAM,IAAAE,eAAG,EAAC;QACNJ,MAAM;QACNK,IAAI,EAAE;UACF,GAAGH,MAAM;UACT,GAAGC;QACP;MACJ,CAAC,CAAC;MACF,OAAOD,MAAM;IACjB,CAAC,CAAC,OAAOI,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,0BAA0B,EACxCF,EAAE,CAACG,IAAI,IAAI,qBAAqB,EAChC;QACIC,KAAK,EAAEJ,EAAE;QACTJ,MAAM;QACNC;MACJ,CACJ,CAAC;IACL;EACJ,CAAC;EAED,MAAMQ,MAAM,GAAG,MAAOf,MAA8C,IAAK;IACrE,MAAM;MAAEM;IAAO,CAAC,GAAGN,MAAM;IAEzB,MAAMO,IAAI,GAAGR,UAAU,CAACO,MAAM,CAAC;IAE/B,IAAI;MACA,MAAM,IAAAE,eAAG,EAAC;QACNJ,MAAM;QACNK,IAAI,EAAE;UACF,GAAGH,MAAM;UACT,GAAGC;QACP;MACJ,CAAC,CAAC;MACF,OAAOD,MAAM;IACjB,CAAC,CAAC,OAAOI,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,0BAA0B,EACxCF,EAAE,CAACG,IAAI,IAAI,qBAAqB,EAChC;QACIC,KAAK,EAAEJ,EAAE;QACTJ,MAAM;QACNC;MACJ,CACJ,CAAC;IACL;EACJ,CAAC;EAED,MAAMS,GAAG,GAAG,MAAOhB,MAA2C,IAAK;IAC/D,MAAMO,IAAI,GAAGR,UAAU,CAACC,MAAM,CAAC;IAE/B,IAAI;MACA,OAAO,MAAM,IAAAiB,aAAQ,EAAY;QAC7Bb,MAAM;QACNG;MACJ,CAAC,CAAC;IACN,CAAC,CAAC,OAAOG,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,uBAAuB,EACrCF,EAAE,CAACG,IAAI,IAAI,kBAAkB,EAC7B;QACIC,KAAK,EAAEJ,EAAE;QACTH;MACJ,CACJ,CAAC;IACL;EACJ,CAAC;EAED,OAAO;IACHF,MAAM;IACNU,MAAM;IACNC;EACJ,CAAC;AACL,CAAC;AAACE,OAAA,CAAAf,6BAAA,GAAAA,6BAAA","ignoreList":[]}
@@ -1,10 +0,0 @@
1
- import type { CmsContext } from "../../types";
2
- import type { PluginsContainer } from "@webiny/plugins";
3
- import type { Client } from "@elastic/elasticsearch";
4
- interface Params {
5
- context: CmsContext;
6
- client: Client;
7
- plugins: PluginsContainer;
8
- }
9
- export declare const createElasticsearchIndexesOnLocaleAfterCreate: (params: Params) => Promise<void>;
10
- export {};
@@ -1,41 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createElasticsearchIndexesOnLocaleAfterCreate = void 0;
7
- var _createElasticsearchIndex = require("../../elasticsearch/createElasticsearchIndex");
8
- const createElasticsearchIndexesOnLocaleAfterCreate = async params => {
9
- const {
10
- context,
11
- client,
12
- plugins
13
- } = params;
14
- context.i18n.locales.onLocaleAfterCreate.subscribe(async ({
15
- locale,
16
- tenant
17
- }) => {
18
- /**
19
- * Get all the code models and create the indexes for them.
20
- */
21
- const models = await context.security.withoutAuthorization(async () => {
22
- return (await context.cms.listModels()).map(model => {
23
- return {
24
- ...model,
25
- tenant,
26
- locale: locale.code
27
- };
28
- });
29
- });
30
- for (const model of models) {
31
- await (0, _createElasticsearchIndex.createElasticsearchIndex)({
32
- client,
33
- plugins,
34
- model
35
- });
36
- }
37
- });
38
- };
39
- exports.createElasticsearchIndexesOnLocaleAfterCreate = createElasticsearchIndexesOnLocaleAfterCreate;
40
-
41
- //# sourceMappingURL=indexes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_createElasticsearchIndex","require","createElasticsearchIndexesOnLocaleAfterCreate","params","context","client","plugins","i18n","locales","onLocaleAfterCreate","subscribe","locale","tenant","models","security","withoutAuthorization","cms","listModels","map","model","code","createElasticsearchIndex","exports"],"sources":["indexes.ts"],"sourcesContent":["import type { CmsContext } from \"~/types\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport type { Client } from \"@elastic/elasticsearch\";\nimport { createElasticsearchIndex } from \"~/elasticsearch/createElasticsearchIndex\";\n\ninterface Params {\n context: CmsContext;\n client: Client;\n plugins: PluginsContainer;\n}\n\nexport const createElasticsearchIndexesOnLocaleAfterCreate = async (params: Params) => {\n const { context, client, plugins } = params;\n\n context.i18n.locales.onLocaleAfterCreate.subscribe(async ({ locale, tenant }) => {\n /**\n * Get all the code models and create the indexes for them.\n */\n const models = await context.security.withoutAuthorization(async () => {\n return (await context.cms.listModels()).map(model => {\n return {\n ...model,\n tenant,\n locale: locale.code\n };\n });\n });\n\n for (const model of models) {\n await createElasticsearchIndex({\n client,\n plugins,\n model\n });\n }\n });\n};\n"],"mappings":";;;;;;AAGA,IAAAA,yBAAA,GAAAC,OAAA;AAQO,MAAMC,6CAA6C,GAAG,MAAOC,MAAc,IAAK;EACnF,MAAM;IAAEC,OAAO;IAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAGH,MAAM;EAE3CC,OAAO,CAACG,IAAI,CAACC,OAAO,CAACC,mBAAmB,CAACC,SAAS,CAAC,OAAO;IAAEC,MAAM;IAAEC;EAAO,CAAC,KAAK;IAC7E;AACR;AACA;IACQ,MAAMC,MAAM,GAAG,MAAMT,OAAO,CAACU,QAAQ,CAACC,oBAAoB,CAAC,YAAY;MACnE,OAAO,CAAC,MAAMX,OAAO,CAACY,GAAG,CAACC,UAAU,CAAC,CAAC,EAAEC,GAAG,CAACC,KAAK,IAAI;QACjD,OAAO;UACH,GAAGA,KAAK;UACRP,MAAM;UACND,MAAM,EAAEA,MAAM,CAACS;QACnB,CAAC;MACL,CAAC,CAAC;IACN,CAAC,CAAC;IAEF,KAAK,MAAMD,KAAK,IAAIN,MAAM,EAAE;MACxB,MAAM,IAAAQ,kDAAwB,EAAC;QAC3BhB,MAAM;QACNC,OAAO;QACPa;MACJ,CAAC,CAAC;IACN;EACJ,CAAC,CAAC;AACN,CAAC;AAACG,OAAA,CAAApB,6CAAA,GAAAA,6CAAA","ignoreList":[]}