@webiny/api-headless-cms-ddb-es 0.0.0-mt-2 → 0.0.0-unstable.0156a4c312

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 (309) hide show
  1. package/README.md +6 -30
  2. package/abstractions/CmsDdbEsDataLoaders.d.ts +5 -0
  3. package/abstractions/CmsDdbEsDataLoaders.js +5 -0
  4. package/abstractions/CmsDdbEsDataLoaders.js.map +1 -0
  5. package/abstractions/CmsDdbEsEntriesEsEntity.d.ts +5 -0
  6. package/abstractions/CmsDdbEsEntriesEsEntity.js +5 -0
  7. package/abstractions/CmsDdbEsEntriesEsEntity.js.map +1 -0
  8. package/abstractions/CmsDdbEsEntryEntity.d.ts +5 -0
  9. package/abstractions/CmsDdbEsEntryEntity.js +5 -0
  10. package/abstractions/CmsDdbEsEntryEntity.js.map +1 -0
  11. package/abstractions/CmsDdbEsGroupEntity.d.ts +5 -0
  12. package/abstractions/CmsDdbEsGroupEntity.js +5 -0
  13. package/abstractions/CmsDdbEsGroupEntity.js.map +1 -0
  14. package/abstractions/CmsDdbEsModelEntity.d.ts +5 -0
  15. package/abstractions/CmsDdbEsModelEntity.js +5 -0
  16. package/abstractions/CmsDdbEsModelEntity.js.map +1 -0
  17. package/abstractions/CmsDdbEsOsTable.d.ts +5 -0
  18. package/abstractions/CmsDdbEsOsTable.js +5 -0
  19. package/abstractions/CmsDdbEsOsTable.js.map +1 -0
  20. package/abstractions/CmsDdbEsTable.d.ts +5 -0
  21. package/abstractions/CmsDdbEsTable.js +5 -0
  22. package/abstractions/CmsDdbEsTable.js.map +1 -0
  23. package/debuggerNamespaces.d.ts +12 -0
  24. package/debuggerNamespaces.js +0 -0
  25. package/definitions/entry.d.ts +5 -6
  26. package/definitions/entry.js +9 -89
  27. package/definitions/entry.js.map +1 -0
  28. package/definitions/group.d.ts +6 -6
  29. package/definitions/group.js +9 -72
  30. package/definitions/group.js.map +1 -0
  31. package/definitions/model.d.ts +6 -6
  32. package/definitions/model.js +9 -94
  33. package/definitions/model.js.map +1 -0
  34. package/definitions/types.d.ts +65 -0
  35. package/definitions/types.js +0 -0
  36. package/feature.d.ts +10 -0
  37. package/feature.js +69 -0
  38. package/feature.js.map +1 -0
  39. package/index.d.ts +1 -2
  40. package/index.js +1 -171
  41. package/operations/entry/DdbEsCreateEntry.d.ts +24 -0
  42. package/operations/entry/DdbEsCreateEntry.js +134 -0
  43. package/operations/entry/DdbEsCreateEntry.js.map +1 -0
  44. package/operations/entry/DdbEsCreateEntryRevisionFrom.d.ts +24 -0
  45. package/operations/entry/DdbEsCreateEntryRevisionFrom.js +139 -0
  46. package/operations/entry/DdbEsCreateEntryRevisionFrom.js.map +1 -0
  47. package/operations/entry/DdbEsDeleteEntry.d.ts +18 -0
  48. package/operations/entry/DdbEsDeleteEntry.js +79 -0
  49. package/operations/entry/DdbEsDeleteEntry.js.map +1 -0
  50. package/operations/entry/DdbEsDeleteEntryRevision.d.ts +24 -0
  51. package/operations/entry/DdbEsDeleteEntryRevision.js +136 -0
  52. package/operations/entry/DdbEsDeleteEntryRevision.js.map +1 -0
  53. package/operations/entry/DdbEsDeleteMultipleEntries.d.ts +18 -0
  54. package/operations/entry/DdbEsDeleteMultipleEntries.js +80 -0
  55. package/operations/entry/DdbEsDeleteMultipleEntries.js.map +1 -0
  56. package/operations/entry/DdbEsGetEntriesByIds.d.ts +14 -0
  57. package/operations/entry/DdbEsGetEntriesByIds.js +31 -0
  58. package/operations/entry/DdbEsGetEntriesByIds.js.map +1 -0
  59. package/operations/entry/DdbEsGetEntry.d.ts +14 -0
  60. package/operations/entry/DdbEsGetEntry.js +27 -0
  61. package/operations/entry/DdbEsGetEntry.js.map +1 -0
  62. package/operations/entry/DdbEsGetLatestEntriesByIds.d.ts +14 -0
  63. package/operations/entry/DdbEsGetLatestEntriesByIds.js +31 -0
  64. package/operations/entry/DdbEsGetLatestEntriesByIds.js.map +1 -0
  65. package/operations/entry/DdbEsGetLatestRevisionByEntryId.d.ts +14 -0
  66. package/operations/entry/DdbEsGetLatestRevisionByEntryId.js +34 -0
  67. package/operations/entry/DdbEsGetLatestRevisionByEntryId.js.map +1 -0
  68. package/operations/entry/DdbEsGetPreviousRevision.d.ts +14 -0
  69. package/operations/entry/DdbEsGetPreviousRevision.js +56 -0
  70. package/operations/entry/DdbEsGetPreviousRevision.js.map +1 -0
  71. package/operations/entry/DdbEsGetPublishedEntriesByIds.d.ts +14 -0
  72. package/operations/entry/DdbEsGetPublishedEntriesByIds.js +31 -0
  73. package/operations/entry/DdbEsGetPublishedEntriesByIds.js.map +1 -0
  74. package/operations/entry/DdbEsGetPublishedRevisionByEntryId.d.ts +14 -0
  75. package/operations/entry/DdbEsGetPublishedRevisionByEntryId.js +34 -0
  76. package/operations/entry/DdbEsGetPublishedRevisionByEntryId.js.map +1 -0
  77. package/operations/entry/DdbEsGetRevisionById.d.ts +14 -0
  78. package/operations/entry/DdbEsGetRevisionById.js +34 -0
  79. package/operations/entry/DdbEsGetRevisionById.js.map +1 -0
  80. package/operations/entry/DdbEsGetRevisions.d.ts +14 -0
  81. package/operations/entry/DdbEsGetRevisions.js +33 -0
  82. package/operations/entry/DdbEsGetRevisions.js.map +1 -0
  83. package/operations/entry/DdbEsGetUniqueFieldValues.d.ts +18 -0
  84. package/operations/entry/DdbEsGetUniqueFieldValues.js +77 -0
  85. package/operations/entry/DdbEsGetUniqueFieldValues.js.map +1 -0
  86. package/operations/entry/DdbEsListEntries.d.ts +28 -0
  87. package/operations/entry/DdbEsListEntries.js +110 -0
  88. package/operations/entry/DdbEsListEntries.js.map +1 -0
  89. package/operations/entry/DdbEsMoveEntry.d.ts +20 -0
  90. package/operations/entry/DdbEsMoveEntry.js +113 -0
  91. package/operations/entry/DdbEsMoveEntry.js.map +1 -0
  92. package/operations/entry/DdbEsMoveToBin.d.ts +23 -0
  93. package/operations/entry/DdbEsMoveToBin.js +137 -0
  94. package/operations/entry/DdbEsMoveToBin.js.map +1 -0
  95. package/operations/entry/DdbEsPublishEntry.d.ts +24 -0
  96. package/operations/entry/DdbEsPublishEntry.js +231 -0
  97. package/operations/entry/DdbEsPublishEntry.js.map +1 -0
  98. package/operations/entry/DdbEsRestoreFromBin.d.ts +23 -0
  99. package/operations/entry/DdbEsRestoreFromBin.js +137 -0
  100. package/operations/entry/DdbEsRestoreFromBin.js.map +1 -0
  101. package/operations/entry/DdbEsUnpublishEntry.d.ts +24 -0
  102. package/operations/entry/DdbEsUnpublishEntry.js +127 -0
  103. package/operations/entry/DdbEsUnpublishEntry.js.map +1 -0
  104. package/operations/entry/DdbEsUpdateEntry.d.ts +24 -0
  105. package/operations/entry/DdbEsUpdateEntry.js +175 -0
  106. package/operations/entry/DdbEsUpdateEntry.js.map +1 -0
  107. package/operations/entry/dataLoader/DataLoaderCache.d.ts +16 -0
  108. package/operations/entry/dataLoader/DataLoaderCache.js +27 -0
  109. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -0
  110. package/operations/entry/dataLoader/constants.d.ts +1 -0
  111. package/operations/entry/dataLoader/constants.js +5 -0
  112. package/operations/entry/dataLoader/constants.js.map +1 -0
  113. package/operations/entry/dataLoader/createBatchScheduleFn.d.ts +8 -0
  114. package/operations/entry/dataLoader/createBatchScheduleFn.js +10 -0
  115. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -0
  116. package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +4 -0
  117. package/operations/entry/dataLoader/getAllEntryRevisions.js +24 -0
  118. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -0
  119. package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +4 -0
  120. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +34 -0
  121. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -0
  122. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +4 -0
  123. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +34 -0
  124. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -0
  125. package/operations/entry/dataLoader/getRevisionById.d.ts +4 -0
  126. package/operations/entry/dataLoader/getRevisionById.js +40 -0
  127. package/operations/entry/dataLoader/getRevisionById.js.map +1 -0
  128. package/operations/entry/dataLoader/index.d.ts +8 -0
  129. package/operations/entry/dataLoader/index.js +18 -0
  130. package/operations/entry/dataLoader/index.js.map +1 -0
  131. package/operations/entry/dataLoader/types.d.ts +6 -0
  132. package/operations/entry/dataLoader/types.js +0 -0
  133. package/operations/entry/dataLoaders.d.ts +22 -39
  134. package/operations/entry/dataLoaders.js +90 -339
  135. package/operations/entry/dataLoaders.js.map +1 -0
  136. package/operations/entry/feature.d.ts +4 -0
  137. package/operations/entry/feature.js +55 -0
  138. package/operations/entry/feature.js.map +1 -0
  139. package/operations/entry/keys.d.ts +31 -1
  140. package/operations/entry/keys.js +45 -35
  141. package/operations/entry/keys.js.map +1 -0
  142. package/operations/entry/recordType.d.ts +3 -0
  143. package/operations/entry/recordType.js +6 -0
  144. package/operations/entry/recordType.js.map +1 -0
  145. package/operations/entry/storageEntryUtils.d.ts +7 -0
  146. package/operations/entry/storageEntryUtils.js +14 -0
  147. package/operations/entry/storageEntryUtils.js.map +1 -0
  148. package/operations/entry/transformations/convertEntryKeys.d.ts +8 -0
  149. package/operations/entry/transformations/convertEntryKeys.js +25 -0
  150. package/operations/entry/transformations/convertEntryKeys.js.map +1 -0
  151. package/operations/entry/transformations/index.d.ts +32 -0
  152. package/operations/entry/transformations/index.js +91 -0
  153. package/operations/entry/transformations/index.js.map +1 -0
  154. package/operations/entry/transformations/modifyEntryValues.d.ts +53 -0
  155. package/operations/entry/transformations/modifyEntryValues.js +16 -0
  156. package/operations/entry/transformations/modifyEntryValues.js.map +1 -0
  157. package/operations/entry/transformations/transformEntryKeys.d.ts +11 -0
  158. package/operations/entry/transformations/transformEntryKeys.js +17 -0
  159. package/operations/entry/transformations/transformEntryKeys.js.map +1 -0
  160. package/operations/group/DdbEsCreateGroup.d.ts +12 -0
  161. package/operations/group/DdbEsCreateGroup.js +35 -0
  162. package/operations/group/DdbEsCreateGroup.js.map +1 -0
  163. package/operations/group/DdbEsDeleteGroup.d.ts +12 -0
  164. package/operations/group/DdbEsDeleteGroup.js +31 -0
  165. package/operations/group/DdbEsDeleteGroup.js.map +1 -0
  166. package/operations/group/DdbEsGetGroup.d.ts +12 -0
  167. package/operations/group/DdbEsGetGroup.js +31 -0
  168. package/operations/group/DdbEsGetGroup.js.map +1 -0
  169. package/operations/group/DdbEsListGroups.d.ts +14 -0
  170. package/operations/group/DdbEsListGroups.js +52 -0
  171. package/operations/group/DdbEsListGroups.js.map +1 -0
  172. package/operations/group/DdbEsUpdateGroup.d.ts +12 -0
  173. package/operations/group/DdbEsUpdateGroup.js +35 -0
  174. package/operations/group/DdbEsUpdateGroup.js.map +1 -0
  175. package/operations/group/feature.d.ts +4 -0
  176. package/operations/group/feature.js +19 -0
  177. package/operations/group/feature.js.map +1 -0
  178. package/operations/group/keys.d.ts +15 -0
  179. package/operations/group/keys.js +17 -0
  180. package/operations/group/keys.js.map +1 -0
  181. package/operations/model/DdbEsCreateModel.d.ts +16 -0
  182. package/operations/model/DdbEsCreateModel.js +56 -0
  183. package/operations/model/DdbEsCreateModel.js.map +1 -0
  184. package/operations/model/DdbEsDeleteModel.d.ts +12 -0
  185. package/operations/model/DdbEsDeleteModel.js +31 -0
  186. package/operations/model/DdbEsDeleteModel.js.map +1 -0
  187. package/operations/model/DdbEsGetModel.d.ts +12 -0
  188. package/operations/model/DdbEsGetModel.js +30 -0
  189. package/operations/model/DdbEsGetModel.js.map +1 -0
  190. package/operations/model/DdbEsListModels.d.ts +12 -0
  191. package/operations/model/DdbEsListModels.js +36 -0
  192. package/operations/model/DdbEsListModels.js.map +1 -0
  193. package/operations/model/DdbEsUpdateModel.d.ts +12 -0
  194. package/operations/model/DdbEsUpdateModel.js +36 -0
  195. package/operations/model/DdbEsUpdateModel.js.map +1 -0
  196. package/operations/model/feature.d.ts +4 -0
  197. package/operations/model/feature.js +19 -0
  198. package/operations/model/feature.js.map +1 -0
  199. package/operations/model/keys.d.ts +15 -0
  200. package/operations/model/keys.js +17 -0
  201. package/operations/model/keys.js.map +1 -0
  202. package/package.json +49 -46
  203. package/registry/CmsEntitiesDbRegistryDecorator.d.ts +27 -0
  204. package/registry/CmsEntitiesDbRegistryDecorator.js +46 -0
  205. package/registry/CmsEntitiesDbRegistryDecorator.js.map +1 -0
  206. package/tasks/CreateElasticsearchIndexTask.d.ts +15 -0
  207. package/tasks/CreateElasticsearchIndexTask.js +49 -0
  208. package/tasks/CreateElasticsearchIndexTask.js.map +1 -0
  209. package/types.d.ts +13 -182
  210. package/types.js +10 -60
  211. package/types.js.map +1 -0
  212. package/configurations.d.ts +0 -12
  213. package/configurations.js +0 -32
  214. package/definitions/entryElasticsearch.d.ts +0 -8
  215. package/definitions/entryElasticsearch.js +0 -46
  216. package/definitions/settings.d.ts +0 -8
  217. package/definitions/settings.js +0 -62
  218. package/definitions/system.d.ts +0 -8
  219. package/definitions/system.js +0 -50
  220. package/definitions/table.d.ts +0 -8
  221. package/definitions/table.js +0 -24
  222. package/definitions/tableElasticsearch.d.ts +0 -8
  223. package/definitions/tableElasticsearch.js +0 -24
  224. package/dynamoDb/index.d.ts +0 -2
  225. package/dynamoDb/index.js +0 -18
  226. package/dynamoDb/storage/date.d.ts +0 -3
  227. package/dynamoDb/storage/date.js +0 -65
  228. package/dynamoDb/storage/longText.d.ts +0 -7
  229. package/dynamoDb/storage/longText.js +0 -83
  230. package/dynamoDb/storage/richText.d.ts +0 -8
  231. package/dynamoDb/storage/richText.js +0 -110
  232. package/elasticsearch/index.d.ts +0 -2
  233. package/elasticsearch/index.js +0 -16
  234. package/elasticsearch/indexing/dateTimeIndexing.d.ts +0 -3
  235. package/elasticsearch/indexing/dateTimeIndexing.js +0 -89
  236. package/elasticsearch/indexing/defaultFieldIndexing.d.ts +0 -3
  237. package/elasticsearch/indexing/defaultFieldIndexing.js +0 -47
  238. package/elasticsearch/indexing/index.d.ts +0 -2
  239. package/elasticsearch/indexing/index.js +0 -24
  240. package/elasticsearch/indexing/longTextIndexing.d.ts +0 -3
  241. package/elasticsearch/indexing/longTextIndexing.js +0 -36
  242. package/elasticsearch/indexing/numberIndexing.d.ts +0 -3
  243. package/elasticsearch/indexing/numberIndexing.js +0 -48
  244. package/elasticsearch/indexing/objectIndexing.d.ts +0 -3
  245. package/elasticsearch/indexing/objectIndexing.js +0 -200
  246. package/elasticsearch/indexing/richTextIndexing.d.ts +0 -3
  247. package/elasticsearch/indexing/richTextIndexing.js +0 -34
  248. package/elasticsearch/search/index.d.ts +0 -3
  249. package/elasticsearch/search/index.js +0 -16
  250. package/elasticsearch/search/refSearch.d.ts +0 -3
  251. package/elasticsearch/search/refSearch.js +0 -24
  252. package/elasticsearch/search/timeSearch.d.ts +0 -3
  253. package/elasticsearch/search/timeSearch.js +0 -25
  254. package/helpers/createElasticsearchQueryBody.d.ts +0 -11
  255. package/helpers/createElasticsearchQueryBody.js +0 -375
  256. package/helpers/entryIndexHelpers.d.ts +0 -18
  257. package/helpers/entryIndexHelpers.js +0 -189
  258. package/helpers/fields.d.ts +0 -77
  259. package/helpers/fields.js +0 -174
  260. package/helpers/index.d.ts +0 -2
  261. package/helpers/index.js +0 -31
  262. package/helpers/operatorPluginsList.d.ts +0 -7
  263. package/helpers/operatorPluginsList.js +0 -30
  264. package/helpers/searchPluginsList.d.ts +0 -6
  265. package/helpers/searchPluginsList.js +0 -26
  266. package/helpers/transformValueForSearch.d.ts +0 -9
  267. package/helpers/transformValueForSearch.js +0 -26
  268. package/operations/entry/elasticsearchFields.d.ts +0 -2
  269. package/operations/entry/elasticsearchFields.js +0 -32
  270. package/operations/entry/fields.d.ts +0 -3
  271. package/operations/entry/fields.js +0 -60
  272. package/operations/entry/index.d.ts +0 -13
  273. package/operations/entry/index.js +0 -1152
  274. package/operations/group/index.d.ts +0 -8
  275. package/operations/group/index.js +0 -202
  276. package/operations/model/index.d.ts +0 -8
  277. package/operations/model/index.js +0 -205
  278. package/operations/settings/index.d.ts +0 -6
  279. package/operations/settings/index.js +0 -141
  280. package/operations/system/createElasticsearchTemplate.d.ts +0 -5
  281. package/operations/system/createElasticsearchTemplate.js +0 -62
  282. package/operations/system/index.d.ts +0 -6
  283. package/operations/system/index.js +0 -105
  284. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +0 -17
  285. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +0 -24
  286. package/plugins/CmsEntryElasticsearchFieldPlugin.d.ts +0 -12
  287. package/plugins/CmsEntryElasticsearchFieldPlugin.js +0 -24
  288. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +0 -17
  289. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +0 -24
  290. package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +0 -17
  291. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +0 -24
  292. package/upgrades/index.d.ts +0 -2
  293. package/upgrades/index.js +0 -16
  294. package/upgrades/utils.d.ts +0 -1
  295. package/upgrades/utils.js +0 -16
  296. package/upgrades/v5.0.0/cleanDatabaseRecord.d.ts +0 -6
  297. package/upgrades/v5.0.0/cleanDatabaseRecord.js +0 -16
  298. package/upgrades/v5.0.0/createOldVersionIndiceName.d.ts +0 -2
  299. package/upgrades/v5.0.0/createOldVersionIndiceName.js +0 -12
  300. package/upgrades/v5.0.0/entryValueFixer.d.ts +0 -4
  301. package/upgrades/v5.0.0/entryValueFixer.js +0 -124
  302. package/upgrades/v5.0.0/fieldFinder.d.ts +0 -6
  303. package/upgrades/v5.0.0/fieldFinder.js +0 -42
  304. package/upgrades/v5.0.0/helpers.d.ts +0 -4
  305. package/upgrades/v5.0.0/helpers.js +0 -57
  306. package/upgrades/v5.0.0/index.d.ts +0 -4
  307. package/upgrades/v5.0.0/index.js +0 -232
  308. package/upgrades/v5.8.0/index.d.ts +0 -4
  309. package/upgrades/v5.8.0/index.js +0 -426
@@ -0,0 +1,35 @@
1
+ import error from "@webiny/error";
2
+ import { UpdateGroupStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/group/UpdateGroupStorageOperation.js";
3
+ import { CmsDdbEsGroupEntity } from "../../abstractions/CmsDdbEsGroupEntity.js";
4
+ import { createKeys, createType } from "./keys.js";
5
+ class DdbEsUpdateGroupImpl {
6
+ constructor(entity){
7
+ this.entity = entity;
8
+ }
9
+ async execute(params) {
10
+ const { group } = params;
11
+ const keys = createKeys(group);
12
+ try {
13
+ await this.entity.put({
14
+ data: group,
15
+ TYPE: createType(),
16
+ ...keys
17
+ });
18
+ } catch (ex) {
19
+ throw new error(ex.message || "Could not update group.", ex.code || "UPDATE_GROUP_ERROR", {
20
+ error: ex,
21
+ group,
22
+ keys
23
+ });
24
+ }
25
+ }
26
+ }
27
+ const DdbEsUpdateGroup = UpdateGroupStorageOperation.createImplementation({
28
+ implementation: DdbEsUpdateGroupImpl,
29
+ dependencies: [
30
+ CmsDdbEsGroupEntity
31
+ ]
32
+ });
33
+ export { DdbEsUpdateGroup };
34
+
35
+ //# sourceMappingURL=DdbEsUpdateGroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/group/DdbEsUpdateGroup.js","sources":["../../../src/operations/group/DdbEsUpdateGroup.ts"],"sourcesContent":["import type { CmsGroupStorageOperationsUpdateParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport { UpdateGroupStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/group/UpdateGroupStorageOperation.js\";\nimport { CmsDdbEsGroupEntity } from \"~/abstractions/CmsDdbEsGroupEntity.js\";\nimport { createKeys, createType } from \"./keys.js\";\n\nclass DdbEsUpdateGroupImpl implements UpdateGroupStorageOperation.Interface {\n constructor(private entity: CmsDdbEsGroupEntity.Interface) {}\n\n async execute(params: CmsGroupStorageOperationsUpdateParams) {\n const { group } = params;\n const keys = createKeys(group);\n try {\n await this.entity.put({\n data: group,\n TYPE: createType(),\n ...keys\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update group.\",\n ex.code || \"UPDATE_GROUP_ERROR\",\n {\n error: ex,\n group,\n keys\n }\n );\n }\n }\n}\n\nexport const DdbEsUpdateGroup = UpdateGroupStorageOperation.createImplementation({\n implementation: DdbEsUpdateGroupImpl,\n dependencies: [CmsDdbEsGroupEntity]\n});\n"],"names":["DdbEsUpdateGroupImpl","entity","params","group","keys","createKeys","createType","ex","WebinyError","DdbEsUpdateGroup","UpdateGroupStorageOperation","CmsDdbEsGroupEntity"],"mappings":";;;;AAMA,MAAMA;IACF,YAAoBC,MAAqC,CAAE;aAAvCA,MAAM,GAANA;IAAwC;IAE5D,MAAM,QAAQC,MAA6C,EAAE;QACzD,MAAM,EAAEC,KAAK,EAAE,GAAGD;QAClB,MAAME,OAAOC,WAAWF;QACxB,IAAI;YACA,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;gBAClB,MAAMA;gBACN,MAAMG;gBACN,GAAGF,IAAI;YACX;QACJ,EAAE,OAAOG,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,2BACdA,GAAG,IAAI,IAAI,sBACX;gBACI,OAAOA;gBACPJ;gBACAC;YACJ;QAER;IACJ;AACJ;AAEO,MAAMK,mBAAmBC,4BAA4B,oBAAoB,CAAC;IAC7E,gBAAgBV;IAChB,cAAc;QAACW;KAAoB;AACvC"}
@@ -0,0 +1,4 @@
1
+ export declare const DdbEsGroupStorageOpsFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -0,0 +1,19 @@
1
+ import { createFeature } from "@webiny/feature/api/index.js";
2
+ import { DdbEsGetGroup } from "./DdbEsGetGroup.js";
3
+ import { DdbEsListGroups } from "./DdbEsListGroups.js";
4
+ import { DdbEsCreateGroup } from "./DdbEsCreateGroup.js";
5
+ import { DdbEsUpdateGroup } from "./DdbEsUpdateGroup.js";
6
+ import { DdbEsDeleteGroup } from "./DdbEsDeleteGroup.js";
7
+ const DdbEsGroupStorageOpsFeature = createFeature({
8
+ name: "cms.ddbEs.groupStorageOps",
9
+ register: (container)=>{
10
+ container.register(DdbEsGetGroup);
11
+ container.register(DdbEsListGroups);
12
+ container.register(DdbEsCreateGroup);
13
+ container.register(DdbEsUpdateGroup);
14
+ container.register(DdbEsDeleteGroup);
15
+ }
16
+ });
17
+ export { DdbEsGroupStorageOpsFeature };
18
+
19
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/group/feature.js","sources":["../../../src/operations/group/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api/index.js\";\nimport { DdbEsGetGroup } from \"./DdbEsGetGroup.js\";\nimport { DdbEsListGroups } from \"./DdbEsListGroups.js\";\nimport { DdbEsCreateGroup } from \"./DdbEsCreateGroup.js\";\nimport { DdbEsUpdateGroup } from \"./DdbEsUpdateGroup.js\";\nimport { DdbEsDeleteGroup } from \"./DdbEsDeleteGroup.js\";\n\nexport const DdbEsGroupStorageOpsFeature = createFeature({\n name: \"cms.ddbEs.groupStorageOps\",\n register: container => {\n container.register(DdbEsGetGroup);\n container.register(DdbEsListGroups);\n container.register(DdbEsCreateGroup);\n container.register(DdbEsUpdateGroup);\n container.register(DdbEsDeleteGroup);\n }\n});\n"],"names":["DdbEsGroupStorageOpsFeature","createFeature","container","DdbEsGetGroup","DdbEsListGroups","DdbEsCreateGroup","DdbEsUpdateGroup","DdbEsDeleteGroup"],"mappings":";;;;;;AAOO,MAAMA,8BAA8BC,cAAc;IACrD,MAAM;IACN,UAAUC,CAAAA;QACNA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;QACnBF,UAAU,QAAQ,CAACG;QACnBH,UAAU,QAAQ,CAACI;QACnBJ,UAAU,QAAQ,CAACK;IACvB;AACJ"}
@@ -0,0 +1,15 @@
1
+ interface PartitionKeyParams {
2
+ tenant: string;
3
+ }
4
+ export declare const createPartitionKey: (params: PartitionKeyParams) => string;
5
+ interface SortKeyParams {
6
+ id: string;
7
+ }
8
+ interface Keys {
9
+ PK: string;
10
+ SK: string;
11
+ GSI_TENANT: string;
12
+ }
13
+ export declare const createKeys: (params: PartitionKeyParams & SortKeyParams) => Keys;
14
+ export declare const createType: () => string;
15
+ export {};
@@ -0,0 +1,17 @@
1
+ const createPartitionKey = (params)=>{
2
+ const { tenant } = params;
3
+ return `T#${tenant}#CMS#CMG`;
4
+ };
5
+ const createSortKeys = (params)=>{
6
+ const { id } = params;
7
+ return id;
8
+ };
9
+ const createKeys = (params)=>({
10
+ PK: createPartitionKey(params),
11
+ SK: createSortKeys(params),
12
+ GSI_TENANT: params.tenant
13
+ });
14
+ const createType = ()=>"cms.group";
15
+ export { createKeys, createPartitionKey, createType };
16
+
17
+ //# sourceMappingURL=keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/group/keys.js","sources":["../../../src/operations/group/keys.ts"],"sourcesContent":["interface PartitionKeyParams {\n tenant: string;\n}\n\nexport const createPartitionKey = (params: PartitionKeyParams): string => {\n const { tenant } = params;\n return `T#${tenant}#CMS#CMG`;\n};\n\ninterface SortKeyParams {\n id: string;\n}\n\nconst createSortKeys = (params: SortKeyParams): string => {\n const { id } = params;\n return id;\n};\n\ninterface Keys {\n PK: string;\n SK: string;\n GSI_TENANT: string;\n}\n\nexport const createKeys = (params: PartitionKeyParams & SortKeyParams): Keys => {\n return {\n PK: createPartitionKey(params),\n SK: createSortKeys(params),\n GSI_TENANT: params.tenant\n };\n};\n\nexport const createType = (): string => {\n return \"cms.group\";\n};\n"],"names":["createPartitionKey","params","tenant","createSortKeys","id","createKeys","createType"],"mappings":"AAIO,MAAMA,qBAAqB,CAACC;IAC/B,MAAM,EAAEC,MAAM,EAAE,GAAGD;IACnB,OAAO,CAAC,EAAE,EAAEC,OAAO,QAAQ,CAAC;AAChC;AAMA,MAAMC,iBAAiB,CAACF;IACpB,MAAM,EAAEG,EAAE,EAAE,GAAGH;IACf,OAAOG;AACX;AAQO,MAAMC,aAAa,CAACJ,SAChB;QACH,IAAID,mBAAmBC;QACvB,IAAIE,eAAeF;QACnB,YAAYA,OAAO,MAAM;IAC7B;AAGG,MAAMK,aAAa,IACf"}
@@ -0,0 +1,16 @@
1
+ import type { CmsModelStorageOperationsCreateParams } from "@webiny/api-headless-cms/types/index.js";
2
+ import { CreateModelStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/CreateModelStorageOperation.js";
3
+ import { CmsDdbEsModelEntity } from "../../abstractions/CmsDdbEsModelEntity.js";
4
+ import { OpenSearchClient } from "@webiny/api-opensearch/exports/api/opensearch.js";
5
+ import { CmsModelOpenSearchIndexProvider } from "@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js";
6
+ declare class DdbEsCreateModelImpl implements CreateModelStorageOperation.Interface {
7
+ private entity;
8
+ private indexProvider;
9
+ private elasticsearch;
10
+ constructor(entity: CmsDdbEsModelEntity.Interface, openSearchClient: OpenSearchClient.Interface, indexProvider: CmsModelOpenSearchIndexProvider.Interface);
11
+ execute(params: CmsModelStorageOperationsCreateParams): Promise<import("@webiny/api-headless-cms/types/model.js").StorageCmsModel>;
12
+ }
13
+ export declare const DdbEsCreateModel: typeof DdbEsCreateModelImpl & {
14
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/model/CreateModelStorageOperation.js").ICreateModelStorageOperation>;
15
+ };
16
+ export {};
@@ -0,0 +1,56 @@
1
+ import _webiny_error from "@webiny/error";
2
+ import { createConfigurations } from "@webiny/api-headless-cms-utils-os/configurations.js";
3
+ import { CreateModelStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/CreateModelStorageOperation.js";
4
+ import { CmsDdbEsModelEntity } from "../../abstractions/CmsDdbEsModelEntity.js";
5
+ import { OpenSearchClient } from "@webiny/api-opensearch/exports/api/opensearch.js";
6
+ import { createKeys, createType } from "./keys.js";
7
+ import { CmsModelOpenSearchIndexProvider } from "@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js";
8
+ class DdbEsCreateModelImpl {
9
+ constructor(entity, openSearchClient, indexProvider){
10
+ this.entity = entity;
11
+ this.indexProvider = indexProvider;
12
+ this.elasticsearch = openSearchClient.use();
13
+ }
14
+ async execute(params) {
15
+ const { model } = params;
16
+ const configurations = createConfigurations(this.indexProvider);
17
+ const { index } = await configurations.es({
18
+ model
19
+ });
20
+ const keys = createKeys(model);
21
+ let error;
22
+ try {
23
+ await this.entity.put({
24
+ data: model,
25
+ ...keys,
26
+ TYPE: createType()
27
+ });
28
+ return model;
29
+ } catch (ex) {
30
+ error = ex;
31
+ }
32
+ try {
33
+ await this.elasticsearch.indices.delete({
34
+ index,
35
+ ignore_unavailable: true
36
+ });
37
+ } catch (ex) {
38
+ throw new _webiny_error(`Could not delete elasticsearch index "${index}" after model record failed to be created.`, "DELETE_MODEL_INDEX_ERROR", {
39
+ dynamodbError: error,
40
+ elasticsearchError: ex
41
+ });
42
+ }
43
+ throw error;
44
+ }
45
+ }
46
+ const DdbEsCreateModel = CreateModelStorageOperation.createImplementation({
47
+ implementation: DdbEsCreateModelImpl,
48
+ dependencies: [
49
+ CmsDdbEsModelEntity,
50
+ OpenSearchClient,
51
+ CmsModelOpenSearchIndexProvider
52
+ ]
53
+ });
54
+ export { DdbEsCreateModel };
55
+
56
+ //# sourceMappingURL=DdbEsCreateModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/model/DdbEsCreateModel.js","sources":["../../../src/operations/model/DdbEsCreateModel.ts"],"sourcesContent":["import type { CmsModelStorageOperationsCreateParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport { createConfigurations } from \"@webiny/api-headless-cms-utils-os/configurations.js\";\nimport { CreateModelStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/model/CreateModelStorageOperation.js\";\nimport { CmsDdbEsModelEntity } from \"~/abstractions/CmsDdbEsModelEntity.js\";\nimport { OpenSearchClient } from \"@webiny/api-opensearch/exports/api/opensearch.js\";\nimport { createKeys, createType } from \"./keys.js\";\nimport { CmsModelOpenSearchIndexProvider } from \"@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js\";\n\nclass DdbEsCreateModelImpl implements CreateModelStorageOperation.Interface {\n private elasticsearch;\n\n constructor(\n private entity: CmsDdbEsModelEntity.Interface,\n openSearchClient: OpenSearchClient.Interface,\n private indexProvider: CmsModelOpenSearchIndexProvider.Interface\n ) {\n this.elasticsearch = openSearchClient.use();\n }\n\n async execute(params: CmsModelStorageOperationsCreateParams) {\n const { model } = params;\n\n const configurations = createConfigurations(this.indexProvider);\n const { index } = await configurations.es({\n model\n });\n\n const keys = createKeys(model);\n\n let error;\n try {\n await this.entity.put({\n data: model,\n ...keys,\n TYPE: createType()\n });\n return model;\n } catch (ex) {\n error = ex;\n }\n try {\n await this.elasticsearch.indices.delete({\n index,\n ignore_unavailable: true\n });\n } catch (ex) {\n throw new WebinyError(\n `Could not delete elasticsearch index \"${index}\" after model record failed to be created.`,\n \"DELETE_MODEL_INDEX_ERROR\",\n {\n dynamodbError: error,\n elasticsearchError: ex\n }\n );\n }\n throw error;\n }\n}\n\nexport const DdbEsCreateModel = CreateModelStorageOperation.createImplementation({\n implementation: DdbEsCreateModelImpl,\n dependencies: [CmsDdbEsModelEntity, OpenSearchClient, CmsModelOpenSearchIndexProvider]\n});\n"],"names":["DdbEsCreateModelImpl","entity","openSearchClient","indexProvider","params","model","configurations","createConfigurations","index","keys","createKeys","error","createType","ex","WebinyError","DdbEsCreateModel","CreateModelStorageOperation","CmsDdbEsModelEntity","OpenSearchClient","CmsModelOpenSearchIndexProvider"],"mappings":";;;;;;;AASA,MAAMA;IAGF,YACYC,MAAqC,EAC7CC,gBAA4C,EACpCC,aAAwD,CAClE;aAHUF,MAAM,GAANA;aAEAE,aAAa,GAAbA;QAER,IAAI,CAAC,aAAa,GAAGD,iBAAiB,GAAG;IAC7C;IAEA,MAAM,QAAQE,MAA6C,EAAE;QACzD,MAAM,EAAEC,KAAK,EAAE,GAAGD;QAElB,MAAME,iBAAiBC,qBAAqB,IAAI,CAAC,aAAa;QAC9D,MAAM,EAAEC,KAAK,EAAE,GAAG,MAAMF,eAAe,EAAE,CAAC;YACtCD;QACJ;QAEA,MAAMI,OAAOC,WAAWL;QAExB,IAAIM;QACJ,IAAI;YACA,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;gBAClB,MAAMN;gBACN,GAAGI,IAAI;gBACP,MAAMG;YACV;YACA,OAAOP;QACX,EAAE,OAAOQ,IAAI;YACTF,QAAQE;QACZ;QACA,IAAI;YACA,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC;gBACpCL;gBACA,oBAAoB;YACxB;QACJ,EAAE,OAAOK,IAAI;YACT,MAAM,IAAIC,cACN,CAAC,sCAAsC,EAAEN,MAAM,0CAA0C,CAAC,EAC1F,4BACA;gBACI,eAAeG;gBACf,oBAAoBE;YACxB;QAER;QACA,MAAMF;IACV;AACJ;AAEO,MAAMI,mBAAmBC,4BAA4B,oBAAoB,CAAC;IAC7E,gBAAgBhB;IAChB,cAAc;QAACiB;QAAqBC;QAAkBC;KAAgC;AAC1F"}
@@ -0,0 +1,12 @@
1
+ import type { CmsModelStorageOperationsDeleteParams } from "@webiny/api-headless-cms/types/index.js";
2
+ import { DeleteModelStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/DeleteModelStorageOperation.js";
3
+ import { CmsDdbEsModelEntity } from "../../abstractions/CmsDdbEsModelEntity.js";
4
+ declare class DdbEsDeleteModelImpl implements DeleteModelStorageOperation.Interface {
5
+ private entity;
6
+ constructor(entity: CmsDdbEsModelEntity.Interface);
7
+ execute(params: CmsModelStorageOperationsDeleteParams): Promise<void>;
8
+ }
9
+ export declare const DdbEsDeleteModel: typeof DdbEsDeleteModelImpl & {
10
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/model/DeleteModelStorageOperation.js").IDeleteModelStorageOperation>;
11
+ };
12
+ export {};
@@ -0,0 +1,31 @@
1
+ import error from "@webiny/error";
2
+ import { DeleteModelStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/DeleteModelStorageOperation.js";
3
+ import { CmsDdbEsModelEntity } from "../../abstractions/CmsDdbEsModelEntity.js";
4
+ import { createKeys } from "./keys.js";
5
+ class DdbEsDeleteModelImpl {
6
+ constructor(entity){
7
+ this.entity = entity;
8
+ }
9
+ async execute(params) {
10
+ const { model } = params;
11
+ const keys = createKeys(model);
12
+ try {
13
+ await this.entity.delete(keys);
14
+ } catch (ex) {
15
+ throw new error(ex.message || "Could not delete model.", ex.code || "MODEL_DELETE_ERROR", {
16
+ error: ex,
17
+ model,
18
+ keys
19
+ });
20
+ }
21
+ }
22
+ }
23
+ const DdbEsDeleteModel = DeleteModelStorageOperation.createImplementation({
24
+ implementation: DdbEsDeleteModelImpl,
25
+ dependencies: [
26
+ CmsDdbEsModelEntity
27
+ ]
28
+ });
29
+ export { DdbEsDeleteModel };
30
+
31
+ //# sourceMappingURL=DdbEsDeleteModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/model/DdbEsDeleteModel.js","sources":["../../../src/operations/model/DdbEsDeleteModel.ts"],"sourcesContent":["import type { CmsModelStorageOperationsDeleteParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport { DeleteModelStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/model/DeleteModelStorageOperation.js\";\nimport { CmsDdbEsModelEntity } from \"~/abstractions/CmsDdbEsModelEntity.js\";\nimport { createKeys } from \"./keys.js\";\n\nclass DdbEsDeleteModelImpl implements DeleteModelStorageOperation.Interface {\n constructor(private entity: CmsDdbEsModelEntity.Interface) {}\n\n async execute(params: CmsModelStorageOperationsDeleteParams): Promise<void> {\n const { model } = params;\n const keys = createKeys(model);\n\n try {\n await this.entity.delete(keys);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete model.\",\n ex.code || \"MODEL_DELETE_ERROR\",\n {\n error: ex,\n model,\n keys\n }\n );\n }\n }\n}\n\nexport const DdbEsDeleteModel = DeleteModelStorageOperation.createImplementation({\n implementation: DdbEsDeleteModelImpl,\n dependencies: [CmsDdbEsModelEntity]\n});\n"],"names":["DdbEsDeleteModelImpl","entity","params","model","keys","createKeys","ex","WebinyError","DdbEsDeleteModel","DeleteModelStorageOperation","CmsDdbEsModelEntity"],"mappings":";;;;AAMA,MAAMA;IACF,YAAoBC,MAAqC,CAAE;aAAvCA,MAAM,GAANA;IAAwC;IAE5D,MAAM,QAAQC,MAA6C,EAAiB;QACxE,MAAM,EAAEC,KAAK,EAAE,GAAGD;QAClB,MAAME,OAAOC,WAAWF;QAExB,IAAI;YACA,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAACC;QAC7B,EAAE,OAAOE,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,2BACdA,GAAG,IAAI,IAAI,sBACX;gBACI,OAAOA;gBACPH;gBACAC;YACJ;QAER;IACJ;AACJ;AAEO,MAAMI,mBAAmBC,4BAA4B,oBAAoB,CAAC;IAC7E,gBAAgBT;IAChB,cAAc;QAACU;KAAoB;AACvC"}
@@ -0,0 +1,12 @@
1
+ import type { CmsModelStorageOperationsGetParams } from "@webiny/api-headless-cms/types/index.js";
2
+ import { GetModelStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/GetModelStorageOperation.js";
3
+ import { CmsDdbEsModelEntity } from "../../abstractions/CmsDdbEsModelEntity.js";
4
+ declare class DdbEsGetModelImpl implements GetModelStorageOperation.Interface {
5
+ private entity;
6
+ constructor(entity: CmsDdbEsModelEntity.Interface);
7
+ execute(params: CmsModelStorageOperationsGetParams): Promise<import("@webiny/api-headless-cms/types/model.js").StorageCmsModel | null>;
8
+ }
9
+ export declare const DdbEsGetModel: typeof DdbEsGetModelImpl & {
10
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/model/GetModelStorageOperation.js").IGetModelStorageOperation>;
11
+ };
12
+ export {};
@@ -0,0 +1,30 @@
1
+ import error from "@webiny/error";
2
+ import { GetModelStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/GetModelStorageOperation.js";
3
+ import { CmsDdbEsModelEntity } from "../../abstractions/CmsDdbEsModelEntity.js";
4
+ import { createKeys } from "./keys.js";
5
+ class DdbEsGetModelImpl {
6
+ constructor(entity){
7
+ this.entity = entity;
8
+ }
9
+ async execute(params) {
10
+ const keys = createKeys(params);
11
+ try {
12
+ const result = await this.entity.get(keys);
13
+ return result ? result.data : null;
14
+ } catch (ex) {
15
+ throw new error(ex.message || "Could not get model.", ex.code || "MODEL_GET_ERROR", {
16
+ error: ex,
17
+ keys
18
+ });
19
+ }
20
+ }
21
+ }
22
+ const DdbEsGetModel = GetModelStorageOperation.createImplementation({
23
+ implementation: DdbEsGetModelImpl,
24
+ dependencies: [
25
+ CmsDdbEsModelEntity
26
+ ]
27
+ });
28
+ export { DdbEsGetModel };
29
+
30
+ //# sourceMappingURL=DdbEsGetModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/model/DdbEsGetModel.js","sources":["../../../src/operations/model/DdbEsGetModel.ts"],"sourcesContent":["import type { CmsModelStorageOperationsGetParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport { GetModelStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/model/GetModelStorageOperation.js\";\nimport { CmsDdbEsModelEntity } from \"~/abstractions/CmsDdbEsModelEntity.js\";\nimport { createKeys } from \"./keys.js\";\n\nclass DdbEsGetModelImpl implements GetModelStorageOperation.Interface {\n constructor(private entity: CmsDdbEsModelEntity.Interface) {}\n\n async execute(params: CmsModelStorageOperationsGetParams) {\n const keys = createKeys(params);\n\n try {\n const result = await this.entity.get(keys);\n\n return result ? result.data : null;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get model.\",\n ex.code || \"MODEL_GET_ERROR\",\n {\n error: ex,\n keys\n }\n );\n }\n }\n}\n\nexport const DdbEsGetModel = GetModelStorageOperation.createImplementation({\n implementation: DdbEsGetModelImpl,\n dependencies: [CmsDdbEsModelEntity]\n});\n"],"names":["DdbEsGetModelImpl","entity","params","keys","createKeys","result","ex","WebinyError","DdbEsGetModel","GetModelStorageOperation","CmsDdbEsModelEntity"],"mappings":";;;;AAMA,MAAMA;IACF,YAAoBC,MAAqC,CAAE;aAAvCA,MAAM,GAANA;IAAwC;IAE5D,MAAM,QAAQC,MAA0C,EAAE;QACtD,MAAMC,OAAOC,WAAWF;QAExB,IAAI;YACA,MAAMG,SAAS,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAACF;YAErC,OAAOE,SAASA,OAAO,IAAI,GAAG;QAClC,EAAE,OAAOC,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,wBACdA,GAAG,IAAI,IAAI,mBACX;gBACI,OAAOA;gBACPH;YACJ;QAER;IACJ;AACJ;AAEO,MAAMK,gBAAgBC,yBAAyB,oBAAoB,CAAC;IACvE,gBAAgBT;IAChB,cAAc;QAACU;KAAoB;AACvC"}
@@ -0,0 +1,12 @@
1
+ import type { CmsModelStorageOperationsListParams } from "@webiny/api-headless-cms/types/index.js";
2
+ import { ListModelsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/ListModelsStorageOperation.js";
3
+ import { CmsDdbEsModelEntity } from "../../abstractions/CmsDdbEsModelEntity.js";
4
+ declare class DdbEsListModelsImpl implements ListModelsStorageOperation.Interface {
5
+ private entity;
6
+ constructor(entity: CmsDdbEsModelEntity.Interface);
7
+ execute(params: CmsModelStorageOperationsListParams): Promise<import("@webiny/api-headless-cms/types/model.js").StorageCmsModel[]>;
8
+ }
9
+ export declare const DdbEsListModels: typeof DdbEsListModelsImpl & {
10
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/model/ListModelsStorageOperation.js").IListModelsStorageOperation>;
11
+ };
12
+ export {};
@@ -0,0 +1,36 @@
1
+ import error from "@webiny/error";
2
+ import { ListModelsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/ListModelsStorageOperation.js";
3
+ import { CmsDdbEsModelEntity } from "../../abstractions/CmsDdbEsModelEntity.js";
4
+ import { createPartitionKey } from "./keys.js";
5
+ class DdbEsListModelsImpl {
6
+ constructor(entity){
7
+ this.entity = entity;
8
+ }
9
+ async execute(params) {
10
+ const { where } = params;
11
+ const partitionKey = createPartitionKey(where);
12
+ try {
13
+ const result = await this.entity.queryAll({
14
+ partitionKey,
15
+ options: {
16
+ gte: " "
17
+ }
18
+ });
19
+ return result ? result.map((item)=>item.data) : [];
20
+ } catch (ex) {
21
+ throw new error(ex.message || "Could not list models.", ex.code || "MODEL_LIST_ERROR", {
22
+ error: ex,
23
+ partitionKey
24
+ });
25
+ }
26
+ }
27
+ }
28
+ const DdbEsListModels = ListModelsStorageOperation.createImplementation({
29
+ implementation: DdbEsListModelsImpl,
30
+ dependencies: [
31
+ CmsDdbEsModelEntity
32
+ ]
33
+ });
34
+ export { DdbEsListModels };
35
+
36
+ //# sourceMappingURL=DdbEsListModels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/model/DdbEsListModels.js","sources":["../../../src/operations/model/DdbEsListModels.ts"],"sourcesContent":["import type { CmsModelStorageOperationsListParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport { ListModelsStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/model/ListModelsStorageOperation.js\";\nimport { CmsDdbEsModelEntity } from \"~/abstractions/CmsDdbEsModelEntity.js\";\nimport { createPartitionKey } from \"./keys.js\";\n\nclass DdbEsListModelsImpl implements ListModelsStorageOperation.Interface {\n constructor(private entity: CmsDdbEsModelEntity.Interface) {}\n\n async execute(params: CmsModelStorageOperationsListParams) {\n const { where } = params;\n const partitionKey = createPartitionKey(where);\n try {\n const result = await this.entity.queryAll({\n partitionKey,\n options: {\n gte: \" \"\n }\n });\n return result ? result.map(item => item.data) : [];\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not list models.\",\n ex.code || \"MODEL_LIST_ERROR\",\n {\n error: ex,\n partitionKey\n }\n );\n }\n }\n}\n\nexport const DdbEsListModels = ListModelsStorageOperation.createImplementation({\n implementation: DdbEsListModelsImpl,\n dependencies: [CmsDdbEsModelEntity]\n});\n"],"names":["DdbEsListModelsImpl","entity","params","where","partitionKey","createPartitionKey","result","item","ex","WebinyError","DdbEsListModels","ListModelsStorageOperation","CmsDdbEsModelEntity"],"mappings":";;;;AAMA,MAAMA;IACF,YAAoBC,MAAqC,CAAE;aAAvCA,MAAM,GAANA;IAAwC;IAE5D,MAAM,QAAQC,MAA2C,EAAE;QACvD,MAAM,EAAEC,KAAK,EAAE,GAAGD;QAClB,MAAME,eAAeC,mBAAmBF;QACxC,IAAI;YACA,MAAMG,SAAS,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;gBACtCF;gBACA,SAAS;oBACL,KAAK;gBACT;YACJ;YACA,OAAOE,SAASA,OAAO,GAAG,CAACC,CAAAA,OAAQA,KAAK,IAAI,IAAI,EAAE;QACtD,EAAE,OAAOC,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,0BACdA,GAAG,IAAI,IAAI,oBACX;gBACI,OAAOA;gBACPJ;YACJ;QAER;IACJ;AACJ;AAEO,MAAMM,kBAAkBC,2BAA2B,oBAAoB,CAAC;IAC3E,gBAAgBX;IAChB,cAAc;QAACY;KAAoB;AACvC"}
@@ -0,0 +1,12 @@
1
+ import type { CmsModelStorageOperationsUpdateParams } from "@webiny/api-headless-cms/types/index.js";
2
+ import { UpdateModelStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/UpdateModelStorageOperation.js";
3
+ import { CmsDdbEsModelEntity } from "../../abstractions/CmsDdbEsModelEntity.js";
4
+ declare class DdbEsUpdateModelImpl implements UpdateModelStorageOperation.Interface {
5
+ private entity;
6
+ constructor(entity: CmsDdbEsModelEntity.Interface);
7
+ execute(params: CmsModelStorageOperationsUpdateParams): Promise<import("@webiny/api-headless-cms/types/model.js").StorageCmsModel>;
8
+ }
9
+ export declare const DdbEsUpdateModel: typeof DdbEsUpdateModelImpl & {
10
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/model/UpdateModelStorageOperation.js").IUpdateModelStorageOperation>;
11
+ };
12
+ export {};
@@ -0,0 +1,36 @@
1
+ import error from "@webiny/error";
2
+ import { UpdateModelStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/UpdateModelStorageOperation.js";
3
+ import { CmsDdbEsModelEntity } from "../../abstractions/CmsDdbEsModelEntity.js";
4
+ import { createKeys, createType } from "./keys.js";
5
+ class DdbEsUpdateModelImpl {
6
+ constructor(entity){
7
+ this.entity = entity;
8
+ }
9
+ async execute(params) {
10
+ const { model } = params;
11
+ const keys = createKeys(model);
12
+ try {
13
+ await this.entity.put({
14
+ data: model,
15
+ ...keys,
16
+ TYPE: createType()
17
+ });
18
+ return model;
19
+ } catch (ex) {
20
+ throw new error(ex.message || "Could not update model.", ex.code || "MODEL_UPDATE_ERROR", {
21
+ error: ex,
22
+ model,
23
+ keys
24
+ });
25
+ }
26
+ }
27
+ }
28
+ const DdbEsUpdateModel = UpdateModelStorageOperation.createImplementation({
29
+ implementation: DdbEsUpdateModelImpl,
30
+ dependencies: [
31
+ CmsDdbEsModelEntity
32
+ ]
33
+ });
34
+ export { DdbEsUpdateModel };
35
+
36
+ //# sourceMappingURL=DdbEsUpdateModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/model/DdbEsUpdateModel.js","sources":["../../../src/operations/model/DdbEsUpdateModel.ts"],"sourcesContent":["import type { CmsModelStorageOperationsUpdateParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport { UpdateModelStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/model/UpdateModelStorageOperation.js\";\nimport { CmsDdbEsModelEntity } from \"~/abstractions/CmsDdbEsModelEntity.js\";\nimport { createKeys, createType } from \"./keys.js\";\n\nclass DdbEsUpdateModelImpl implements UpdateModelStorageOperation.Interface {\n constructor(private entity: CmsDdbEsModelEntity.Interface) {}\n\n async execute(params: CmsModelStorageOperationsUpdateParams) {\n const { model } = params;\n\n const keys = createKeys(model);\n\n try {\n await this.entity.put({\n data: model,\n ...keys,\n TYPE: createType()\n });\n return model;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update model.\",\n ex.code || \"MODEL_UPDATE_ERROR\",\n {\n error: ex,\n model,\n keys\n }\n );\n }\n }\n}\n\nexport const DdbEsUpdateModel = UpdateModelStorageOperation.createImplementation({\n implementation: DdbEsUpdateModelImpl,\n dependencies: [CmsDdbEsModelEntity]\n});\n"],"names":["DdbEsUpdateModelImpl","entity","params","model","keys","createKeys","createType","ex","WebinyError","DdbEsUpdateModel","UpdateModelStorageOperation","CmsDdbEsModelEntity"],"mappings":";;;;AAMA,MAAMA;IACF,YAAoBC,MAAqC,CAAE;aAAvCA,MAAM,GAANA;IAAwC;IAE5D,MAAM,QAAQC,MAA6C,EAAE;QACzD,MAAM,EAAEC,KAAK,EAAE,GAAGD;QAElB,MAAME,OAAOC,WAAWF;QAExB,IAAI;YACA,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;gBAClB,MAAMA;gBACN,GAAGC,IAAI;gBACP,MAAME;YACV;YACA,OAAOH;QACX,EAAE,OAAOI,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,2BACdA,GAAG,IAAI,IAAI,sBACX;gBACI,OAAOA;gBACPJ;gBACAC;YACJ;QAER;IACJ;AACJ;AAEO,MAAMK,mBAAmBC,4BAA4B,oBAAoB,CAAC;IAC7E,gBAAgBV;IAChB,cAAc;QAACW;KAAoB;AACvC"}
@@ -0,0 +1,4 @@
1
+ export declare const DdbEsModelStorageOpsFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -0,0 +1,19 @@
1
+ import { createFeature } from "@webiny/feature/api/index.js";
2
+ import { DdbEsGetModel } from "./DdbEsGetModel.js";
3
+ import { DdbEsListModels } from "./DdbEsListModels.js";
4
+ import { DdbEsCreateModel } from "./DdbEsCreateModel.js";
5
+ import { DdbEsUpdateModel } from "./DdbEsUpdateModel.js";
6
+ import { DdbEsDeleteModel } from "./DdbEsDeleteModel.js";
7
+ const DdbEsModelStorageOpsFeature = createFeature({
8
+ name: "cms.ddbEs.modelStorageOps",
9
+ register: (container)=>{
10
+ container.register(DdbEsGetModel);
11
+ container.register(DdbEsListModels);
12
+ container.register(DdbEsCreateModel);
13
+ container.register(DdbEsUpdateModel);
14
+ container.register(DdbEsDeleteModel);
15
+ }
16
+ });
17
+ export { DdbEsModelStorageOpsFeature };
18
+
19
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/model/feature.js","sources":["../../../src/operations/model/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api/index.js\";\nimport { DdbEsGetModel } from \"./DdbEsGetModel.js\";\nimport { DdbEsListModels } from \"./DdbEsListModels.js\";\nimport { DdbEsCreateModel } from \"./DdbEsCreateModel.js\";\nimport { DdbEsUpdateModel } from \"./DdbEsUpdateModel.js\";\nimport { DdbEsDeleteModel } from \"./DdbEsDeleteModel.js\";\n\nexport const DdbEsModelStorageOpsFeature = createFeature({\n name: \"cms.ddbEs.modelStorageOps\",\n register: container => {\n container.register(DdbEsGetModel);\n container.register(DdbEsListModels);\n container.register(DdbEsCreateModel);\n container.register(DdbEsUpdateModel);\n container.register(DdbEsDeleteModel);\n }\n});\n"],"names":["DdbEsModelStorageOpsFeature","createFeature","container","DdbEsGetModel","DdbEsListModels","DdbEsCreateModel","DdbEsUpdateModel","DdbEsDeleteModel"],"mappings":";;;;;;AAOO,MAAMA,8BAA8BC,cAAc;IACrD,MAAM;IACN,UAAUC,CAAAA;QACNA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;QACnBF,UAAU,QAAQ,CAACG;QACnBH,UAAU,QAAQ,CAACI;QACnBJ,UAAU,QAAQ,CAACK;IACvB;AACJ"}
@@ -0,0 +1,15 @@
1
+ interface PartitionKeysParams {
2
+ tenant: string;
3
+ }
4
+ export declare const createPartitionKey: (params: PartitionKeysParams) => string;
5
+ interface SortKeyParams {
6
+ modelId: string;
7
+ }
8
+ interface Keys {
9
+ PK: string;
10
+ SK: string;
11
+ GSI_TENANT: string;
12
+ }
13
+ export declare const createKeys: (params: PartitionKeysParams & SortKeyParams) => Keys;
14
+ export declare const createType: () => string;
15
+ export {};
@@ -0,0 +1,17 @@
1
+ const createPartitionKey = (params)=>{
2
+ const { tenant } = params;
3
+ return `T#${tenant}#CMS#CM`;
4
+ };
5
+ const createSortKey = (params)=>params.modelId;
6
+ const createKeys = (params)=>{
7
+ if (!params.tenant) throw new Error("Missing tenant when creating model keys!");
8
+ return {
9
+ PK: createPartitionKey(params),
10
+ SK: createSortKey(params),
11
+ GSI_TENANT: params.tenant
12
+ };
13
+ };
14
+ const createType = ()=>"cms.model";
15
+ export { createKeys, createPartitionKey, createType };
16
+
17
+ //# sourceMappingURL=keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/model/keys.js","sources":["../../../src/operations/model/keys.ts"],"sourcesContent":["interface PartitionKeysParams {\n tenant: string;\n}\n\nexport const createPartitionKey = (params: PartitionKeysParams): string => {\n const { tenant } = params;\n return `T#${tenant}#CMS#CM`;\n};\n\ninterface SortKeyParams {\n modelId: string;\n}\n\nconst createSortKey = (params: SortKeyParams): string => {\n return params.modelId;\n};\n\ninterface Keys {\n PK: string;\n SK: string;\n GSI_TENANT: string;\n}\n\nexport const createKeys = (params: PartitionKeysParams & SortKeyParams): Keys => {\n if (!params.tenant) {\n throw new Error(\"Missing tenant when creating model keys!\");\n }\n return {\n PK: createPartitionKey(params),\n SK: createSortKey(params),\n GSI_TENANT: params.tenant\n };\n};\n\nexport const createType = (): string => {\n return \"cms.model\";\n};\n"],"names":["createPartitionKey","params","tenant","createSortKey","createKeys","Error","createType"],"mappings":"AAIO,MAAMA,qBAAqB,CAACC;IAC/B,MAAM,EAAEC,MAAM,EAAE,GAAGD;IACnB,OAAO,CAAC,EAAE,EAAEC,OAAO,OAAO,CAAC;AAC/B;AAMA,MAAMC,gBAAgB,CAACF,SACZA,OAAO,OAAO;AASlB,MAAMG,aAAa,CAACH;IACvB,IAAI,CAACA,OAAO,MAAM,EACd,MAAM,IAAII,MAAM;IAEpB,OAAO;QACH,IAAIL,mBAAmBC;QACvB,IAAIE,cAAcF;QAClB,YAAYA,OAAO,MAAM;IAC7B;AACJ;AAEO,MAAMK,aAAa,IACf"}
package/package.json CHANGED
@@ -1,13 +1,21 @@
1
1
  {
2
2
  "name": "@webiny/api-headless-cms-ddb-es",
3
- "version": "0.0.0-mt-2",
4
- "main": "index.js",
3
+ "version": "0.0.0-unstable.0156a4c312",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": "./index.js",
7
+ "./*": "./*"
8
+ },
5
9
  "keywords": [
6
10
  "@webiny/api-headless-cms",
7
11
  "storage-operations",
8
12
  "dynamodb",
9
13
  "elasticsearch",
10
- "cms:ddb-es"
14
+ "ddb-es",
15
+ "cms:ddb-es",
16
+ "opensearch",
17
+ "ddb-os",
18
+ "cms:ddb-os"
11
19
  ],
12
20
  "repository": {
13
21
  "type": "git",
@@ -22,52 +30,47 @@
22
30
  ],
23
31
  "license": "MIT",
24
32
  "dependencies": {
25
- "@babel/runtime": "7.15.4",
26
- "@webiny/api-headless-cms": "0.0.0-mt-2",
27
- "@webiny/api-upgrade": "0.0.0-mt-2",
28
- "@webiny/db-dynamodb": "0.0.0-mt-2",
29
- "@webiny/error": "0.0.0-mt-2",
30
- "@webiny/handler": "0.0.0-mt-2",
31
- "@webiny/handler-aws": "0.0.0-mt-2",
32
- "@webiny/handler-db": "0.0.0-mt-2",
33
- "@webiny/plugins": "0.0.0-mt-2",
34
- "@webiny/utils": "0.0.0-mt-2",
35
- "dataloader": "2.0.0",
36
- "dynamodb-toolbox": "0.3.4",
37
- "jsonpack": "1.1.5",
38
- "lodash.chunk": "4.2.0",
39
- "lodash.clonedeep": "4.5.0",
40
- "lodash.omit": "4.5.0"
33
+ "@webiny/api": "0.0.0-unstable.0156a4c312",
34
+ "@webiny/api-core": "0.0.0-unstable.0156a4c312",
35
+ "@webiny/api-headless-cms": "0.0.0-unstable.0156a4c312",
36
+ "@webiny/api-headless-cms-storage": "0.0.0-unstable.0156a4c312",
37
+ "@webiny/api-headless-cms-utils-os": "0.0.0-unstable.0156a4c312",
38
+ "@webiny/api-opensearch": "0.0.0-unstable.0156a4c312",
39
+ "@webiny/api-opensearch-aws": "0.0.0-unstable.0156a4c312",
40
+ "@webiny/api-search-index-tasks": "0.0.0-unstable.0156a4c312",
41
+ "@webiny/db": "0.0.0-unstable.0156a4c312",
42
+ "@webiny/db-dynamodb": "0.0.0-unstable.0156a4c312",
43
+ "@webiny/error": "0.0.0-unstable.0156a4c312",
44
+ "@webiny/feature": "0.0.0-unstable.0156a4c312",
45
+ "@webiny/plugins": "0.0.0-unstable.0156a4c312",
46
+ "@webiny/stdlib": "0.0.21",
47
+ "@webiny/utils": "0.0.0-unstable.0156a4c312",
48
+ "dataloader": "2.2.3",
49
+ "lodash": "4.18.1"
41
50
  },
42
51
  "devDependencies": {
43
- "@babel/cli": "^7.5.5",
44
- "@babel/core": "^7.5.5",
45
- "@babel/preset-env": "^7.5.5",
46
- "@babel/preset-flow": "^7.0.0",
47
- "@elastic/elasticsearch": "7.12.0",
48
- "@shelf/jest-elasticsearch": "^1.0.0",
49
- "@types/jsonpack": "^1.1.0",
50
- "@webiny/api-dynamodb-to-elasticsearch": "^0.0.0-mt-2",
51
- "@webiny/api-elasticsearch": "^0.0.0-mt-2",
52
- "@webiny/cli": "^0.0.0-mt-2",
53
- "@webiny/project-utils": "^0.0.0-mt-2",
54
- "jest": "^26.6.3",
55
- "jest-dynalite": "^3.2.0",
56
- "jest-environment-node": "^26.6.2",
57
- "mdbid": "^1.0.0",
58
- "prettier": "^2.3.2",
59
- "rimraf": "^3.0.2",
60
- "sinon": "^9.0.2",
61
- "ttypescript": "^1.5.12",
62
- "typescript": "^4.1.3"
52
+ "@types/jsonpack": "1.1.6",
53
+ "@webiny/api-core-testing": "0.0.0-unstable.0156a4c312",
54
+ "@webiny/api-graphql": "0.0.0-unstable.0156a4c312",
55
+ "@webiny/api-search-index-tasks-ddb-os": "0.0.0-unstable.0156a4c312",
56
+ "@webiny/api-sync-ddb-to-opensearch": "0.0.0-unstable.0156a4c312",
57
+ "@webiny/background-tasks": "0.0.0-unstable.0156a4c312",
58
+ "@webiny/build-tools": "0.0.0-unstable.0156a4c312",
59
+ "@webiny/di": "2.0.0",
60
+ "@webiny/event-handler-core": "0.0.0-unstable.0156a4c312",
61
+ "@webiny/handler": "0.0.0-unstable.0156a4c312",
62
+ "@webiny/logger": "0.0.0-unstable.0156a4c312",
63
+ "@webiny/wcp": "0.0.0-unstable.0156a4c312",
64
+ "jest-dynalite": "3.6.1",
65
+ "rimraf": "6.1.3",
66
+ "typescript": "7.0.2",
67
+ "vitest": "5.0.5"
63
68
  },
64
69
  "publishConfig": {
65
- "access": "public",
66
- "directory": "dist"
67
- },
68
- "scripts": {
69
- "build": "yarn webiny run build",
70
- "watch": "yarn webiny run watch"
70
+ "access": "public"
71
71
  },
72
- "gitHead": "3c0dcfb3c22c9f83107fdb97b25014cd03d9db7d"
72
+ "gitHead": "b8aec8a1be3f25c3b428b357fe1e352c7cbff9ae",
73
+ "webiny": {
74
+ "publishFrom": "dist"
75
+ }
73
76
  }