@webiny/api-headless-cms-ddb 0.0.0-unstable.e6f0dc8ca7 → 0.0.0-unstable.e9333b3f0b

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 (267) hide show
  1. package/abstractions/CmsDdbDataLoaders.d.ts +5 -0
  2. package/abstractions/CmsDdbDataLoaders.js +5 -0
  3. package/abstractions/CmsDdbDataLoaders.js.map +1 -0
  4. package/abstractions/CmsDdbEntryEntity.d.ts +5 -0
  5. package/abstractions/CmsDdbEntryEntity.js +5 -0
  6. package/abstractions/CmsDdbEntryEntity.js.map +1 -0
  7. package/abstractions/CmsDdbGroupEntity.d.ts +5 -0
  8. package/abstractions/CmsDdbGroupEntity.js +5 -0
  9. package/abstractions/CmsDdbGroupEntity.js.map +1 -0
  10. package/abstractions/CmsDdbModelEntity.d.ts +5 -0
  11. package/abstractions/CmsDdbModelEntity.js +5 -0
  12. package/abstractions/CmsDdbModelEntity.js.map +1 -0
  13. package/abstractions/CmsDdbTable.d.ts +5 -0
  14. package/abstractions/CmsDdbTable.js +5 -0
  15. package/abstractions/CmsDdbTable.js.map +1 -0
  16. package/definitions/entry.js +7 -9
  17. package/definitions/entry.js.map +1 -1
  18. package/definitions/group.js +7 -9
  19. package/definitions/group.js.map +1 -1
  20. package/definitions/model.js +7 -9
  21. package/definitions/model.js.map +1 -1
  22. package/definitions/table.js +6 -7
  23. package/definitions/table.js.map +1 -1
  24. package/definitions/types.d.ts +4 -0
  25. package/definitions/types.js +0 -3
  26. package/index.d.ts +17 -2
  27. package/index.js +31 -88
  28. package/index.js.map +1 -1
  29. package/operations/entry/DdbCreateEntry.d.ts +16 -0
  30. package/operations/entry/DdbCreateEntry.js +77 -0
  31. package/operations/entry/DdbCreateEntry.js.map +1 -0
  32. package/operations/entry/DdbCreateEntryRevisionFrom.d.ts +16 -0
  33. package/operations/entry/DdbCreateEntryRevisionFrom.js +85 -0
  34. package/operations/entry/DdbCreateEntryRevisionFrom.js.map +1 -0
  35. package/operations/entry/DdbDeleteEntry.d.ts +16 -0
  36. package/operations/entry/DdbDeleteEntry.js +65 -0
  37. package/operations/entry/DdbDeleteEntry.js.map +1 -0
  38. package/operations/entry/DdbDeleteEntryRevision.d.ts +17 -0
  39. package/operations/entry/DdbDeleteEntryRevision.js +91 -0
  40. package/operations/entry/DdbDeleteEntryRevision.js.map +1 -0
  41. package/operations/entry/DdbDeleteMultipleEntries.d.ts +16 -0
  42. package/operations/entry/DdbDeleteMultipleEntries.js +59 -0
  43. package/operations/entry/DdbDeleteMultipleEntries.js.map +1 -0
  44. package/operations/entry/DdbGetEntriesByIds.d.ts +14 -0
  45. package/operations/entry/DdbGetEntriesByIds.js +31 -0
  46. package/operations/entry/DdbGetEntriesByIds.js.map +1 -0
  47. package/operations/entry/DdbGetEntry.d.ts +14 -0
  48. package/operations/entry/DdbGetEntry.js +27 -0
  49. package/operations/entry/DdbGetEntry.js.map +1 -0
  50. package/operations/entry/DdbGetLatestEntriesByIds.d.ts +14 -0
  51. package/operations/entry/DdbGetLatestEntriesByIds.js +31 -0
  52. package/operations/entry/DdbGetLatestEntriesByIds.js.map +1 -0
  53. package/operations/entry/DdbGetLatestRevisionByEntryId.d.ts +14 -0
  54. package/operations/entry/DdbGetLatestRevisionByEntryId.js +35 -0
  55. package/operations/entry/DdbGetLatestRevisionByEntryId.js.map +1 -0
  56. package/operations/entry/DdbGetPreviousRevision.d.ts +14 -0
  57. package/operations/entry/DdbGetPreviousRevision.js +53 -0
  58. package/operations/entry/DdbGetPreviousRevision.js.map +1 -0
  59. package/operations/entry/DdbGetPublishedEntriesByIds.d.ts +14 -0
  60. package/operations/entry/DdbGetPublishedEntriesByIds.js +31 -0
  61. package/operations/entry/DdbGetPublishedEntriesByIds.js.map +1 -0
  62. package/operations/entry/DdbGetPublishedRevisionByEntryId.d.ts +14 -0
  63. package/operations/entry/DdbGetPublishedRevisionByEntryId.js +35 -0
  64. package/operations/entry/DdbGetPublishedRevisionByEntryId.js.map +1 -0
  65. package/operations/entry/DdbGetRevisionById.d.ts +14 -0
  66. package/operations/entry/DdbGetRevisionById.js +34 -0
  67. package/operations/entry/DdbGetRevisionById.js.map +1 -0
  68. package/operations/entry/DdbGetRevisions.d.ts +14 -0
  69. package/operations/entry/DdbGetRevisions.js +33 -0
  70. package/operations/entry/DdbGetRevisions.js.map +1 -0
  71. package/operations/entry/DdbGetUniqueFieldValues.d.ts +12 -0
  72. package/operations/entry/DdbGetUniqueFieldValues.js +31 -0
  73. package/operations/entry/DdbGetUniqueFieldValues.js.map +1 -0
  74. package/operations/entry/DdbListEntries.d.ts +28 -0
  75. package/operations/entry/DdbListEntries.js +124 -0
  76. package/operations/entry/DdbListEntries.js.map +1 -0
  77. package/operations/entry/DdbMoveEntry.d.ts +14 -0
  78. package/operations/entry/DdbMoveEntry.js +57 -0
  79. package/operations/entry/DdbMoveEntry.js.map +1 -0
  80. package/operations/entry/DdbMoveToBin.d.ts +16 -0
  81. package/operations/entry/DdbMoveToBin.js +77 -0
  82. package/operations/entry/DdbMoveToBin.js.map +1 -0
  83. package/operations/entry/DdbPublishEntry.d.ts +18 -0
  84. package/operations/entry/DdbPublishEntry.js +162 -0
  85. package/operations/entry/DdbPublishEntry.js.map +1 -0
  86. package/operations/entry/DdbRestoreFromBin.d.ts +16 -0
  87. package/operations/entry/DdbRestoreFromBin.js +78 -0
  88. package/operations/entry/DdbRestoreFromBin.js.map +1 -0
  89. package/operations/entry/DdbUnpublishEntry.d.ts +17 -0
  90. package/operations/entry/DdbUnpublishEntry.js +112 -0
  91. package/operations/entry/DdbUnpublishEntry.js.map +1 -0
  92. package/operations/entry/DdbUpdateEntry.d.ts +17 -0
  93. package/operations/entry/DdbUpdateEntry.js +105 -0
  94. package/operations/entry/DdbUpdateEntry.js.map +1 -0
  95. package/operations/entry/dataLoader/DataLoaderCache.js +22 -26
  96. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
  97. package/operations/entry/dataLoader/constants.js +2 -1
  98. package/operations/entry/dataLoader/constants.js.map +1 -1
  99. package/operations/entry/dataLoader/createBatchScheduleFn.js +6 -15
  100. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
  101. package/operations/entry/dataLoader/getAllEntryRevisions.js +18 -29
  102. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
  103. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +31 -41
  104. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
  105. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +31 -41
  106. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
  107. package/operations/entry/dataLoader/getRevisionById.js +33 -47
  108. package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
  109. package/operations/entry/dataLoader/index.js +8 -9
  110. package/operations/entry/dataLoader/index.js.map +1 -1
  111. package/operations/entry/dataLoader/types.js +0 -3
  112. package/operations/entry/dataLoaders.d.ts +7 -6
  113. package/operations/entry/dataLoaders.js +89 -99
  114. package/operations/entry/dataLoaders.js.map +1 -1
  115. package/operations/entry/feature.d.ts +4 -0
  116. package/operations/entry/feature.js +53 -0
  117. package/operations/entry/feature.js.map +1 -0
  118. package/operations/entry/keys.d.ts +6 -0
  119. package/operations/entry/keys.js +57 -77
  120. package/operations/entry/keys.js.map +1 -1
  121. package/operations/entry/storageEntryUtils.d.ts +8 -0
  122. package/operations/entry/storageEntryUtils.js +25 -0
  123. package/operations/entry/storageEntryUtils.js.map +1 -0
  124. package/operations/group/DdbCreateGroup.d.ts +12 -0
  125. package/operations/group/DdbCreateGroup.js +35 -0
  126. package/operations/group/DdbCreateGroup.js.map +1 -0
  127. package/operations/group/DdbDeleteGroup.d.ts +12 -0
  128. package/operations/group/DdbDeleteGroup.js +31 -0
  129. package/operations/group/DdbDeleteGroup.js.map +1 -0
  130. package/operations/group/DdbGetGroup.d.ts +12 -0
  131. package/operations/group/DdbGetGroup.js +31 -0
  132. package/operations/group/DdbGetGroup.js.map +1 -0
  133. package/operations/group/DdbListGroups.d.ts +14 -0
  134. package/operations/group/DdbListGroups.js +52 -0
  135. package/operations/group/DdbListGroups.js.map +1 -0
  136. package/operations/group/DdbUpdateGroup.d.ts +12 -0
  137. package/operations/group/DdbUpdateGroup.js +35 -0
  138. package/operations/group/DdbUpdateGroup.js.map +1 -0
  139. package/operations/group/feature.d.ts +4 -0
  140. package/operations/group/feature.js +19 -0
  141. package/operations/group/feature.js.map +1 -0
  142. package/operations/group/keys.d.ts +15 -0
  143. package/operations/group/keys.js +17 -0
  144. package/operations/group/keys.js.map +1 -0
  145. package/operations/model/DdbCreateModel.d.ts +12 -0
  146. package/operations/model/DdbCreateModel.js +37 -0
  147. package/operations/model/DdbCreateModel.js.map +1 -0
  148. package/operations/model/DdbDeleteModel.d.ts +12 -0
  149. package/operations/model/DdbDeleteModel.js +31 -0
  150. package/operations/model/DdbDeleteModel.js.map +1 -0
  151. package/operations/model/DdbGetModel.d.ts +12 -0
  152. package/operations/model/DdbGetModel.js +30 -0
  153. package/operations/model/DdbGetModel.js.map +1 -0
  154. package/operations/model/DdbListModels.d.ts +12 -0
  155. package/operations/model/DdbListModels.js +36 -0
  156. package/operations/model/DdbListModels.js.map +1 -0
  157. package/operations/model/DdbUpdateModel.d.ts +12 -0
  158. package/operations/model/DdbUpdateModel.js +36 -0
  159. package/operations/model/DdbUpdateModel.js.map +1 -0
  160. package/operations/model/feature.d.ts +4 -0
  161. package/operations/model/feature.js +19 -0
  162. package/operations/model/feature.js.map +1 -0
  163. package/operations/model/keys.d.ts +15 -0
  164. package/operations/model/keys.js +16 -0
  165. package/operations/model/keys.js.map +1 -0
  166. package/package.json +22 -24
  167. package/requestFeature.d.ts +17 -0
  168. package/requestFeature.js +19 -0
  169. package/requestFeature.js.map +1 -0
  170. package/types.d.ts +10 -50
  171. package/types.js +6 -5
  172. package/types.js.map +1 -1
  173. package/definitions/types.js.map +0 -1
  174. package/dynamoDb/index.d.ts +0 -2
  175. package/dynamoDb/index.js +0 -6
  176. package/dynamoDb/index.js.map +0 -1
  177. package/dynamoDb/path/locationFolderId.d.ts +0 -2
  178. package/dynamoDb/path/locationFolderId.js +0 -34
  179. package/dynamoDb/path/locationFolderId.js.map +0 -1
  180. package/dynamoDb/path/plainObject.d.ts +0 -2
  181. package/dynamoDb/path/plainObject.js +0 -26
  182. package/dynamoDb/path/plainObject.js.map +0 -1
  183. package/dynamoDb/transformValue/datetime.d.ts +0 -5
  184. package/dynamoDb/transformValue/datetime.js +0 -40
  185. package/dynamoDb/transformValue/datetime.js.map +0 -1
  186. package/operations/entry/dataLoader/types.js.map +0 -1
  187. package/operations/entry/filtering/createExpressions.d.ts +0 -27
  188. package/operations/entry/filtering/createExpressions.js +0 -172
  189. package/operations/entry/filtering/createExpressions.js.map +0 -1
  190. package/operations/entry/filtering/createFields.d.ts +0 -16
  191. package/operations/entry/filtering/createFields.js +0 -106
  192. package/operations/entry/filtering/createFields.js.map +0 -1
  193. package/operations/entry/filtering/extractSort.d.ts +0 -17
  194. package/operations/entry/filtering/extractSort.js +0 -84
  195. package/operations/entry/filtering/extractSort.js.map +0 -1
  196. package/operations/entry/filtering/filter.d.ts +0 -16
  197. package/operations/entry/filtering/filter.js +0 -153
  198. package/operations/entry/filtering/filter.js.map +0 -1
  199. package/operations/entry/filtering/fullTextSearch.d.ts +0 -14
  200. package/operations/entry/filtering/fullTextSearch.js +0 -42
  201. package/operations/entry/filtering/fullTextSearch.js.map +0 -1
  202. package/operations/entry/filtering/getValue.d.ts +0 -5
  203. package/operations/entry/filtering/getValue.js +0 -59
  204. package/operations/entry/filtering/getValue.js.map +0 -1
  205. package/operations/entry/filtering/index.d.ts +0 -2
  206. package/operations/entry/filtering/index.js +0 -4
  207. package/operations/entry/filtering/index.js.map +0 -1
  208. package/operations/entry/filtering/mapPlugins.d.ts +0 -8
  209. package/operations/entry/filtering/mapPlugins.js +0 -25
  210. package/operations/entry/filtering/mapPlugins.js.map +0 -1
  211. package/operations/entry/filtering/plugins/defaultFilterCreate.d.ts +0 -2
  212. package/operations/entry/filtering/plugins/defaultFilterCreate.js +0 -37
  213. package/operations/entry/filtering/plugins/defaultFilterCreate.js.map +0 -1
  214. package/operations/entry/filtering/plugins/index.d.ts +0 -1
  215. package/operations/entry/filtering/plugins/index.js +0 -9
  216. package/operations/entry/filtering/plugins/index.js.map +0 -1
  217. package/operations/entry/filtering/plugins/objectFilterCreate.d.ts +0 -2
  218. package/operations/entry/filtering/plugins/objectFilterCreate.js +0 -84
  219. package/operations/entry/filtering/plugins/objectFilterCreate.js.map +0 -1
  220. package/operations/entry/filtering/plugins/refFilterCreate.d.ts +0 -3
  221. package/operations/entry/filtering/plugins/refFilterCreate.js +0 -74
  222. package/operations/entry/filtering/plugins/refFilterCreate.js.map +0 -1
  223. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.d.ts +0 -2
  224. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js +0 -62
  225. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js.map +0 -1
  226. package/operations/entry/filtering/sort.d.ts +0 -12
  227. package/operations/entry/filtering/sort.js +0 -67
  228. package/operations/entry/filtering/sort.js.map +0 -1
  229. package/operations/entry/filtering/systemFields.d.ts +0 -2
  230. package/operations/entry/filtering/systemFields.js +0 -131
  231. package/operations/entry/filtering/systemFields.js.map +0 -1
  232. package/operations/entry/filtering/transform.d.ts +0 -6
  233. package/operations/entry/filtering/transform.js +0 -11
  234. package/operations/entry/filtering/transform.js.map +0 -1
  235. package/operations/entry/filtering/types.d.ts +0 -40
  236. package/operations/entry/filtering/types.js +0 -3
  237. package/operations/entry/filtering/types.js.map +0 -1
  238. package/operations/entry/filtering/values.d.ts +0 -2
  239. package/operations/entry/filtering/values.js +0 -16
  240. package/operations/entry/filtering/values.js.map +0 -1
  241. package/operations/entry/filtering/where.d.ts +0 -5
  242. package/operations/entry/filtering/where.js +0 -28
  243. package/operations/entry/filtering/where.js.map +0 -1
  244. package/operations/entry/index.d.ts +0 -9
  245. package/operations/entry/index.js +0 -1197
  246. package/operations/entry/index.js.map +0 -1
  247. package/operations/group/index.d.ts +0 -8
  248. package/operations/group/index.js +0 -142
  249. package/operations/group/index.js.map +0 -1
  250. package/operations/model/index.d.ts +0 -7
  251. package/operations/model/index.js +0 -127
  252. package/operations/model/index.js.map +0 -1
  253. package/plugins/CmsEntryFieldFilterPathPlugin.d.ts +0 -23
  254. package/plugins/CmsEntryFieldFilterPathPlugin.js +0 -40
  255. package/plugins/CmsEntryFieldFilterPathPlugin.js.map +0 -1
  256. package/plugins/CmsEntryFieldFilterPlugin.d.ts +0 -43
  257. package/plugins/CmsEntryFieldFilterPlugin.js +0 -21
  258. package/plugins/CmsEntryFieldFilterPlugin.js.map +0 -1
  259. package/plugins/CmsEntryFieldSortingPlugin.d.ts +0 -42
  260. package/plugins/CmsEntryFieldSortingPlugin.js +0 -19
  261. package/plugins/CmsEntryFieldSortingPlugin.js.map +0 -1
  262. package/plugins/CmsFieldFilterValueTransformPlugin.d.ts +0 -11
  263. package/plugins/CmsFieldFilterValueTransformPlugin.js +0 -16
  264. package/plugins/CmsFieldFilterValueTransformPlugin.js.map +0 -1
  265. package/plugins/index.d.ts +0 -4
  266. package/plugins/index.js +0 -6
  267. package/plugins/index.js.map +0 -1
@@ -0,0 +1,5 @@
1
+ import type { IDataLoadersHandler } from "../types.js";
2
+ export declare const CmsDdbDataLoaders: import("@webiny/di").Abstraction<IDataLoadersHandler>;
3
+ export declare namespace CmsDdbDataLoaders {
4
+ type Interface = IDataLoadersHandler;
5
+ }
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ const CmsDdbDataLoaders = createAbstraction("Cms/Ddb/DataLoaders");
3
+ export { CmsDdbDataLoaders };
4
+
5
+ //# sourceMappingURL=CmsDdbDataLoaders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstractions/CmsDdbDataLoaders.js","sources":["../../src/abstractions/CmsDdbDataLoaders.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { IDataLoadersHandler } from \"~/types.js\";\n\nexport const CmsDdbDataLoaders = createAbstraction<IDataLoadersHandler>(\"Cms/Ddb/DataLoaders\");\n\nexport namespace CmsDdbDataLoaders {\n export type Interface = IDataLoadersHandler;\n}\n"],"names":["CmsDdbDataLoaders","createAbstraction"],"mappings":";AAGO,MAAMA,oBAAoBC,kBAAuC"}
@@ -0,0 +1,5 @@
1
+ import type { IEntryEntity } from "../definitions/types.js";
2
+ export declare const CmsDdbEntryEntity: import("@webiny/di").Abstraction<IEntryEntity>;
3
+ export declare namespace CmsDdbEntryEntity {
4
+ type Interface = IEntryEntity;
5
+ }
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ const CmsDdbEntryEntity = createAbstraction("Cms/Ddb/EntryEntity");
3
+ export { CmsDdbEntryEntity };
4
+
5
+ //# sourceMappingURL=CmsDdbEntryEntity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstractions/CmsDdbEntryEntity.js","sources":["../../src/abstractions/CmsDdbEntryEntity.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { IEntryEntity } from \"~/definitions/types.js\";\n\nexport const CmsDdbEntryEntity = createAbstraction<IEntryEntity>(\"Cms/Ddb/EntryEntity\");\n\nexport namespace CmsDdbEntryEntity {\n export type Interface = IEntryEntity;\n}\n"],"names":["CmsDdbEntryEntity","createAbstraction"],"mappings":";AAGO,MAAMA,oBAAoBC,kBAAgC"}
@@ -0,0 +1,5 @@
1
+ import type { IGroupEntity } from "../definitions/types.js";
2
+ export declare const CmsDdbGroupEntity: import("@webiny/di").Abstraction<IGroupEntity>;
3
+ export declare namespace CmsDdbGroupEntity {
4
+ type Interface = IGroupEntity;
5
+ }
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ const CmsDdbGroupEntity = createAbstraction("Cms/Ddb/GroupEntity");
3
+ export { CmsDdbGroupEntity };
4
+
5
+ //# sourceMappingURL=CmsDdbGroupEntity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstractions/CmsDdbGroupEntity.js","sources":["../../src/abstractions/CmsDdbGroupEntity.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { IGroupEntity } from \"~/definitions/types.js\";\n\nexport const CmsDdbGroupEntity = createAbstraction<IGroupEntity>(\"Cms/Ddb/GroupEntity\");\n\nexport namespace CmsDdbGroupEntity {\n export type Interface = IGroupEntity;\n}\n"],"names":["CmsDdbGroupEntity","createAbstraction"],"mappings":";AAGO,MAAMA,oBAAoBC,kBAAgC"}
@@ -0,0 +1,5 @@
1
+ import type { IModelEntity } from "../definitions/types.js";
2
+ export declare const CmsDdbModelEntity: import("@webiny/di").Abstraction<IModelEntity>;
3
+ export declare namespace CmsDdbModelEntity {
4
+ type Interface = IModelEntity;
5
+ }
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ const CmsDdbModelEntity = createAbstraction("Cms/Ddb/ModelEntity");
3
+ export { CmsDdbModelEntity };
4
+
5
+ //# sourceMappingURL=CmsDdbModelEntity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstractions/CmsDdbModelEntity.js","sources":["../../src/abstractions/CmsDdbModelEntity.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { IModelEntity } from \"~/definitions/types.js\";\n\nexport const CmsDdbModelEntity = createAbstraction<IModelEntity>(\"Cms/Ddb/ModelEntity\");\n\nexport namespace CmsDdbModelEntity {\n export type Interface = IModelEntity;\n}\n"],"names":["CmsDdbModelEntity","createAbstraction"],"mappings":";AAGO,MAAMA,oBAAoBC,kBAAgC"}
@@ -0,0 +1,5 @@
1
+ import type { ITable } from "@webiny/db-dynamodb";
2
+ export declare const CmsDdbTable: import("@webiny/di").Abstraction<ITable<string, string, string>>;
3
+ export declare namespace CmsDdbTable {
4
+ type Interface = ITable;
5
+ }
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ const CmsDdbTable = createAbstraction("Cms/Ddb/Table");
3
+ export { CmsDdbTable };
4
+
5
+ //# sourceMappingURL=CmsDdbTable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstractions/CmsDdbTable.js","sources":["../../src/abstractions/CmsDdbTable.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { ITable } from \"@webiny/db-dynamodb\";\n\nexport const CmsDdbTable = createAbstraction<ITable>(\"Cms/Ddb/Table\");\n\nexport namespace CmsDdbTable {\n export type Interface = ITable;\n}\n"],"names":["CmsDdbTable","createAbstraction"],"mappings":";AAGO,MAAMA,cAAcC,kBAA0B"}
@@ -1,13 +1,11 @@
1
1
  import { createStandardEntity } from "@webiny/db-dynamodb";
2
- export const createEntryEntity = params => {
3
- const {
4
- table,
5
- entityName
6
- } = params;
7
- return createStandardEntity({
8
- name: entityName,
9
- table: table.table
10
- });
2
+ const createEntryEntity = (params)=>{
3
+ const { table, entityName } = params;
4
+ return createStandardEntity({
5
+ name: entityName,
6
+ table: table.table
7
+ });
11
8
  };
9
+ export { createEntryEntity };
12
10
 
13
11
  //# sourceMappingURL=entry.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createStandardEntity","createEntryEntity","params","table","entityName","name"],"sources":["entry.ts"],"sourcesContent":["import { createStandardEntity, type ITable } from \"@webiny/db-dynamodb\";\nimport type { IEntryEntity, IEntryEntityAttributesData } from \"./types.js\";\n\ninterface Params {\n table: ITable;\n entityName: string;\n}\n\nexport const createEntryEntity = (params: Params): IEntryEntity => {\n const { table, entityName } = params;\n return createStandardEntity<IEntryEntityAttributesData>({\n name: entityName,\n table: table.table\n });\n};\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAqB,qBAAqB;AAQvE,OAAO,MAAMC,iBAAiB,GAAIC,MAAc,IAAmB;EAC/D,MAAM;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGF,MAAM;EACpC,OAAOF,oBAAoB,CAA6B;IACpDK,IAAI,EAAED,UAAU;IAChBD,KAAK,EAAEA,KAAK,CAACA;EACjB,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"definitions/entry.js","sources":["../../src/definitions/entry.ts"],"sourcesContent":["import { createStandardEntity, type ITable } from \"@webiny/db-dynamodb\";\nimport type { IEntryEntity, IEntryEntityAttributesData } from \"./types.js\";\n\ninterface Params {\n table: ITable;\n entityName: string;\n}\n\nexport const createEntryEntity = (params: Params): IEntryEntity => {\n const { table, entityName } = params;\n return createStandardEntity<IEntryEntityAttributesData>({\n name: entityName,\n table: table.table\n });\n};\n"],"names":["createEntryEntity","params","table","entityName","createStandardEntity"],"mappings":";AAQO,MAAMA,oBAAoB,CAACC;IAC9B,MAAM,EAAEC,KAAK,EAAEC,UAAU,EAAE,GAAGF;IAC9B,OAAOG,qBAAiD;QACpD,MAAMD;QACN,OAAOD,MAAM,KAAK;IACtB;AACJ"}
@@ -1,13 +1,11 @@
1
1
  import { createStandardEntity } from "@webiny/db-dynamodb";
2
- export const createGroupEntity = params => {
3
- const {
4
- table,
5
- entityName
6
- } = params;
7
- return createStandardEntity({
8
- table: table.table,
9
- name: entityName
10
- });
2
+ const createGroupEntity = (params)=>{
3
+ const { table, entityName } = params;
4
+ return createStandardEntity({
5
+ table: table.table,
6
+ name: entityName
7
+ });
11
8
  };
9
+ export { createGroupEntity };
12
10
 
13
11
  //# sourceMappingURL=group.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createStandardEntity","createGroupEntity","params","table","entityName","name"],"sources":["group.ts"],"sourcesContent":["import { createStandardEntity, type ITable } from \"@webiny/db-dynamodb\";\nimport type { IGroupEntity } from \"./types.js\";\nimport type { CmsGroup } from \"@webiny/api-headless-cms/types/index.js\";\n\ninterface Params {\n table: ITable;\n entityName: string;\n}\n\nexport const createGroupEntity = (params: Params): IGroupEntity => {\n const { table, entityName } = params;\n return createStandardEntity<CmsGroup>({\n table: table.table,\n name: entityName\n });\n};\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAqB,qBAAqB;AASvE,OAAO,MAAMC,iBAAiB,GAAIC,MAAc,IAAmB;EAC/D,MAAM;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGF,MAAM;EACpC,OAAOF,oBAAoB,CAAW;IAClCG,KAAK,EAAEA,KAAK,CAACA,KAAK;IAClBE,IAAI,EAAED;EACV,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"definitions/group.js","sources":["../../src/definitions/group.ts"],"sourcesContent":["import { createStandardEntity, type ITable } from \"@webiny/db-dynamodb\";\nimport type { IGroupEntity } from \"./types.js\";\nimport type { CmsGroup } from \"@webiny/api-headless-cms/types/index.js\";\n\ninterface Params {\n table: ITable;\n entityName: string;\n}\n\nexport const createGroupEntity = (params: Params): IGroupEntity => {\n const { table, entityName } = params;\n return createStandardEntity<CmsGroup>({\n table: table.table,\n name: entityName\n });\n};\n"],"names":["createGroupEntity","params","table","entityName","createStandardEntity"],"mappings":";AASO,MAAMA,oBAAoB,CAACC;IAC9B,MAAM,EAAEC,KAAK,EAAEC,UAAU,EAAE,GAAGF;IAC9B,OAAOG,qBAA+B;QAClC,OAAOF,MAAM,KAAK;QAClB,MAAMC;IACV;AACJ"}
@@ -1,13 +1,11 @@
1
1
  import { createStandardEntity } from "@webiny/db-dynamodb";
2
- export const createModelEntity = params => {
3
- const {
4
- table,
5
- entityName
6
- } = params;
7
- return createStandardEntity({
8
- table: table.table,
9
- name: entityName
10
- });
2
+ const createModelEntity = (params)=>{
3
+ const { table, entityName } = params;
4
+ return createStandardEntity({
5
+ table: table.table,
6
+ name: entityName
7
+ });
11
8
  };
9
+ export { createModelEntity };
12
10
 
13
11
  //# sourceMappingURL=model.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createStandardEntity","createModelEntity","params","table","entityName","name"],"sources":["model.ts"],"sourcesContent":["import { createStandardEntity, type ITable } from \"@webiny/db-dynamodb\";\nimport type { IModelEntity } from \"./types.js\";\nimport type { StorageCmsModel } from \"@webiny/api-headless-cms/types/index.js\";\n\ninterface Params {\n table: ITable;\n entityName: string;\n}\n\nexport const createModelEntity = (params: Params): IModelEntity => {\n const { table, entityName } = params;\n return createStandardEntity<StorageCmsModel>({\n table: table.table,\n name: entityName\n });\n};\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAqB,qBAAqB;AASvE,OAAO,MAAMC,iBAAiB,GAAIC,MAAc,IAAmB;EAC/D,MAAM;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGF,MAAM;EACpC,OAAOF,oBAAoB,CAAkB;IACzCG,KAAK,EAAEA,KAAK,CAACA,KAAK;IAClBE,IAAI,EAAED;EACV,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"definitions/model.js","sources":["../../src/definitions/model.ts"],"sourcesContent":["import { createStandardEntity, type ITable } from \"@webiny/db-dynamodb\";\nimport type { IModelEntity } from \"./types.js\";\nimport type { StorageCmsModel } from \"@webiny/api-headless-cms/types/index.js\";\n\ninterface Params {\n table: ITable;\n entityName: string;\n}\n\nexport const createModelEntity = (params: Params): IModelEntity => {\n const { table, entityName } = params;\n return createStandardEntity<StorageCmsModel>({\n table: table.table,\n name: entityName\n });\n};\n"],"names":["createModelEntity","params","table","entityName","createStandardEntity"],"mappings":";AASO,MAAMA,oBAAoB,CAACC;IAC9B,MAAM,EAAEC,KAAK,EAAEC,UAAU,EAAE,GAAGF;IAC9B,OAAOG,qBAAsC;QACzC,OAAOF,MAAM,KAAK;QAClB,MAAMC;IACV;AACJ"}
@@ -1,9 +1,8 @@
1
- import { createTable as baseCreateTable } from "@webiny/db-dynamodb";
2
- export const createTable = params => {
3
- return baseCreateTable({
4
- name: params.name || process.env.DB_TABLE_HEADLESS_CMS || process.env.DB_TABLE,
5
- documentClient: params.documentClient
6
- });
7
- };
1
+ import { createTable } from "@webiny/db-dynamodb";
2
+ const table_createTable = (params)=>createTable({
3
+ name: params.name || process.env.DB_TABLE_HEADLESS_CMS || process.env.DB_TABLE,
4
+ documentClient: params.documentClient
5
+ });
6
+ export { table_createTable as createTable };
8
7
 
9
8
  //# sourceMappingURL=table.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createTable","baseCreateTable","params","name","process","env","DB_TABLE_HEADLESS_CMS","DB_TABLE","documentClient"],"sources":["table.ts"],"sourcesContent":["import { createTable as baseCreateTable } from \"@webiny/db-dynamodb\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\n\ninterface Params {\n name?: string;\n documentClient: DynamoDBDocument;\n}\n\nexport const createTable = (params: Params) => {\n return baseCreateTable({\n name: params.name || process.env.DB_TABLE_HEADLESS_CMS || (process.env.DB_TABLE as string),\n documentClient: params.documentClient\n });\n};\n"],"mappings":"AAAA,SAASA,WAAW,IAAIC,eAAe,QAAQ,qBAAqB;AAQpE,OAAO,MAAMD,WAAW,GAAIE,MAAc,IAAK;EAC3C,OAAOD,eAAe,CAAC;IACnBE,IAAI,EAAED,MAAM,CAACC,IAAI,IAAIC,OAAO,CAACC,GAAG,CAACC,qBAAqB,IAAKF,OAAO,CAACC,GAAG,CAACE,QAAmB;IAC1FC,cAAc,EAAEN,MAAM,CAACM;EAC3B,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"definitions/table.js","sources":["../../src/definitions/table.ts"],"sourcesContent":["import { createTable as baseCreateTable } from \"@webiny/db-dynamodb\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\n\ninterface Params {\n name?: string;\n documentClient: DynamoDBDocument;\n}\n\nexport const createTable = (params: Params) => {\n return baseCreateTable({\n name: params.name || process.env.DB_TABLE_HEADLESS_CMS || (process.env.DB_TABLE as string),\n documentClient: params.documentClient\n });\n};\n"],"names":["createTable","params","baseCreateTable","process"],"mappings":";AAQO,MAAMA,oBAAc,CAACC,SACjBC,YAAgB;QACnB,MAAMD,OAAO,IAAI,IAAIE,QAAQ,GAAG,CAAC,qBAAqB,IAAKA,QAAQ,GAAG,CAAC,QAAQ;QAC/E,gBAAgBF,OAAO,cAAc;IACzC"}
@@ -54,6 +54,10 @@ export interface IEntryEntityAttributesData {
54
54
  system?: ICmsEntrySystem;
55
55
  live: ICmsEntryLive | null;
56
56
  revisionDescription: string | undefined;
57
+ /**
58
+ * A timestamp of when the entry should be automatically deleted from the database.
59
+ */
60
+ expiresAt: number | null;
57
61
  }
58
62
  export type IEntryEntityAttributes = IStandardEntityAttributes<IEntryEntityAttributesData>;
59
63
  export type IModelEntity = IEntity<IStandardEntityAttributes<StorageCmsModel>>;
@@ -1,3 +0,0 @@
1
- export {};
2
-
3
- //# sourceMappingURL=types.js.map
package/index.d.ts CHANGED
@@ -1,2 +1,17 @@
1
- export * from "./plugins/index.js";
2
- export declare const registerDynamoDbStorageOperations: () => import("@webiny/handler").RegisterExtensionPlugin<import("@webiny/handler/types.js").Context>[];
1
+ export { HeadlessCmsDdbRequestFeature } from "./requestFeature.js";
2
+ /**
3
+ * Root half of the DynamoDB CMS storage: the table and entity definitions, built once per process.
4
+ * The storage operations are per request, in `HeadlessCmsDdbRequestFeature`.
5
+ * Requires DynamoDBClient to be registered in the container first (via DbFeature).
6
+ *
7
+ * Usage:
8
+ * DbFeature.register(container, { documentClient, table });
9
+ * HeadlessCmsDdbFeature.register(container);
10
+ * // then in request:
11
+ * HeadlessCmsDdbRequestFeature.register(requestContainer);
12
+ * HeadlessCmsFeature.register(requestContainer, { type: "manage" });
13
+ */
14
+ export declare const HeadlessCmsDdbFeature: {
15
+ name: string;
16
+ register(container: import("@webiny/di").Container): void;
17
+ };
package/index.js CHANGED
@@ -1,97 +1,40 @@
1
- import { registerExtension as registerDynamoDbExtension } from "@webiny/db-dynamodb";
2
- import dynamoDbPlugins from "./dynamoDb/index.js";
3
1
  import { ENTITIES } from "./types.js";
4
2
  import { createGroupEntity } from "./definitions/group.js";
5
3
  import { createModelEntity } from "./definitions/model.js";
6
4
  import { createEntryEntity } from "./definitions/entry.js";
7
- import { createGroupsStorageOperations } from "./operations/group/index.js";
8
- import { createModelsStorageOperations } from "./operations/model/index.js";
9
- import { createEntriesStorageOperations } from "./operations/entry/index.js";
10
- import { createFilterCreatePlugins } from "./operations/entry/filtering/plugins/index.js";
11
5
  import { createTable } from "./definitions/table.js";
12
- import { createRegisterExtensionPlugin } from "@webiny/handler";
13
6
  import { createFeature } from "@webiny/feature/api/index.js";
14
- import { StorageOperationsFactory as StorageOperationsFactoryAbstraction } from "@webiny/api-headless-cms/exports/api/cms/storage.js";
15
- export * from "./plugins/index.js";
16
- const createDynamoDbStorageOperations = params => {
17
- const {
18
- table,
19
- documentClient,
20
- plugins,
21
- container
22
- } = params;
23
- const tableInstance = createTable({
24
- name: table,
25
- documentClient
26
- });
27
- const entities = {
28
- groups: createGroupEntity({
29
- entityName: ENTITIES.GROUPS,
30
- table: tableInstance
31
- }),
32
- models: createModelEntity({
33
- entityName: ENTITIES.MODELS,
34
- table: tableInstance
35
- }),
36
- entries: createEntryEntity({
37
- entityName: ENTITIES.ENTRIES,
38
- table: tableInstance
39
- })
40
- };
41
- plugins.register([
42
- /**
43
- * Field plugins for DynamoDB.
44
- */
45
- dynamoDbPlugins(),
46
- /**
47
- * Filter create plugins.
48
- */
49
- createFilterCreatePlugins()]);
50
- const entries = createEntriesStorageOperations({
51
- entity: entities.entries,
52
- container,
53
- plugins
54
- });
55
- return {
56
- name: "dynamodb",
57
- beforeInit: async () => {
58
- entries.dataLoaders.clearAll();
59
- },
60
- getEntities: () => entities,
61
- getTable: () => tableInstance,
62
- groups: createGroupsStorageOperations({
63
- entity: entities.groups,
64
- container
65
- }),
66
- models: createModelsStorageOperations({
67
- entity: entities.models
68
- }),
69
- entries
70
- };
71
- };
72
- class DynamoDbStorageOperationsFactoryImpl {
73
- async create(context) {
74
- return createDynamoDbStorageOperations({
75
- documentClient: context.db.driver.getClient(),
76
- plugins: context.plugins,
77
- container: context.container
78
- });
79
- }
80
- }
81
- const DynamoDbStorageOperationsFactory = StorageOperationsFactoryAbstraction.createImplementation({
82
- implementation: DynamoDbStorageOperationsFactoryImpl,
83
- dependencies: []
7
+ import { DynamoDBClient } from "@webiny/db-dynamodb";
8
+ import { FilterUtilFeature } from "@webiny/db-dynamodb/feature/FilterUtil/feature.js";
9
+ import { CmsDdbTable } from "./abstractions/CmsDdbTable.js";
10
+ import { CmsDdbGroupEntity } from "./abstractions/CmsDdbGroupEntity.js";
11
+ import { CmsDdbModelEntity } from "./abstractions/CmsDdbModelEntity.js";
12
+ import { CmsDdbEntryEntity } from "./abstractions/CmsDdbEntryEntity.js";
13
+ const HeadlessCmsDdbFeature = createFeature({
14
+ name: "cms.storageOperations.ddb",
15
+ register: (container)=>{
16
+ FilterUtilFeature.register(container);
17
+ const db = container.resolve(DynamoDBClient);
18
+ const documentClient = db.client;
19
+ const tableInstance = createTable({
20
+ documentClient
21
+ });
22
+ container.registerInstance(CmsDdbTable, tableInstance);
23
+ container.registerInstance(CmsDdbGroupEntity, createGroupEntity({
24
+ entityName: ENTITIES.GROUPS,
25
+ table: tableInstance
26
+ }));
27
+ container.registerInstance(CmsDdbModelEntity, createModelEntity({
28
+ entityName: ENTITIES.MODELS,
29
+ table: tableInstance
30
+ }));
31
+ container.registerInstance(CmsDdbEntryEntity, createEntryEntity({
32
+ entityName: ENTITIES.ENTRIES,
33
+ table: tableInstance
34
+ }));
35
+ }
84
36
  });
85
- const storageOperationsFeature = createFeature({
86
- name: "cms.storageOperations.openSearch",
87
- register: container => {
88
- container.register(DynamoDbStorageOperationsFactory).inSingletonScope();
89
- }
90
- });
91
- export const registerDynamoDbStorageOperations = () => {
92
- return [registerDynamoDbExtension(), createRegisterExtensionPlugin(context => {
93
- return storageOperationsFeature.register(context.container);
94
- })];
95
- };
37
+ export { HeadlessCmsDdbRequestFeature } from "./requestFeature.js";
38
+ export { HeadlessCmsDdbFeature };
96
39
 
97
40
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["registerExtension","registerDynamoDbExtension","dynamoDbPlugins","ENTITIES","createGroupEntity","createModelEntity","createEntryEntity","createGroupsStorageOperations","createModelsStorageOperations","createEntriesStorageOperations","createFilterCreatePlugins","createTable","createRegisterExtensionPlugin","createFeature","StorageOperationsFactory","StorageOperationsFactoryAbstraction","createDynamoDbStorageOperations","params","table","documentClient","plugins","container","tableInstance","name","entities","groups","entityName","GROUPS","models","MODELS","entries","ENTRIES","register","entity","beforeInit","dataLoaders","clearAll","getEntities","getTable","DynamoDbStorageOperationsFactoryImpl","create","context","db","driver","getClient","DynamoDbStorageOperationsFactory","createImplementation","implementation","dependencies","storageOperationsFeature","inSingletonScope","registerDynamoDbStorageOperations"],"sources":["index.ts"],"sourcesContent":["import { registerExtension as registerDynamoDbExtension } from \"@webiny/db-dynamodb\";\nimport dynamoDbPlugins from \"./dynamoDb/index.js\";\nimport type { CmsContext, StorageOperationsFactory } from \"~/types.js\";\nimport { ENTITIES } from \"~/types.js\";\nimport { createGroupEntity } from \"~/definitions/group.js\";\nimport { createModelEntity } from \"~/definitions/model.js\";\nimport { createEntryEntity } from \"~/definitions/entry.js\";\nimport { createGroupsStorageOperations } from \"~/operations/group/index.js\";\nimport { createModelsStorageOperations } from \"~/operations/model/index.js\";\nimport { createEntriesStorageOperations } from \"./operations/entry/index.js\";\nimport { createFilterCreatePlugins } from \"~/operations/entry/filtering/plugins/index.js\";\nimport { createTable } from \"~/definitions/table.js\";\nimport { createRegisterExtensionPlugin } from \"@webiny/handler\";\nimport { createFeature } from \"@webiny/feature/api/index.js\";\nimport { StorageOperationsFactory as StorageOperationsFactoryAbstraction } from \"@webiny/api-headless-cms/exports/api/cms/storage.js\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\n\nexport * from \"./plugins/index.js\";\n\nconst createDynamoDbStorageOperations: StorageOperationsFactory = params => {\n const { table, documentClient, plugins, container } = params;\n\n const tableInstance = createTable({\n name: table,\n documentClient\n });\n\n const entities = {\n groups: createGroupEntity({\n entityName: ENTITIES.GROUPS,\n table: tableInstance\n }),\n models: createModelEntity({\n entityName: ENTITIES.MODELS,\n table: tableInstance\n }),\n entries: createEntryEntity({\n entityName: ENTITIES.ENTRIES,\n table: tableInstance\n })\n };\n\n plugins.register([\n /**\n * Field plugins for DynamoDB.\n */\n dynamoDbPlugins(),\n /**\n * Filter create plugins.\n */\n createFilterCreatePlugins()\n ]);\n\n const entries = createEntriesStorageOperations({\n entity: entities.entries,\n container,\n plugins\n });\n\n return {\n name: \"dynamodb\",\n beforeInit: async () => {\n entries.dataLoaders.clearAll();\n },\n getEntities: () => entities,\n getTable: () => tableInstance,\n groups: createGroupsStorageOperations({\n entity: entities.groups,\n container\n }),\n models: createModelsStorageOperations({\n entity: entities.models\n }),\n entries\n };\n};\n\nclass DynamoDbStorageOperationsFactoryImpl\n implements StorageOperationsFactoryAbstraction.Interface\n{\n public async create(context: CmsContext) {\n return createDynamoDbStorageOperations({\n documentClient: context.db.driver.getClient() as DynamoDBDocument,\n plugins: context.plugins,\n container: context.container\n });\n }\n}\n\nconst DynamoDbStorageOperationsFactory = StorageOperationsFactoryAbstraction.createImplementation({\n implementation: DynamoDbStorageOperationsFactoryImpl,\n dependencies: []\n});\n\nconst storageOperationsFeature = createFeature({\n name: \"cms.storageOperations.openSearch\",\n register: container => {\n container.register(DynamoDbStorageOperationsFactory).inSingletonScope();\n }\n});\n\nexport const registerDynamoDbStorageOperations = () => {\n return [\n registerDynamoDbExtension(),\n createRegisterExtensionPlugin(context => {\n return storageOperationsFeature.register(context.container);\n })\n ];\n};\n"],"mappings":"AAAA,SAASA,iBAAiB,IAAIC,yBAAyB,QAAQ,qBAAqB;AACpF,OAAOC,eAAe;AAEtB,SAASC,QAAQ;AACjB,SAASC,iBAAiB;AAC1B,SAASC,iBAAiB;AAC1B,SAASC,iBAAiB;AAC1B,SAASC,6BAA6B;AACtC,SAASC,6BAA6B;AACtC,SAASC,8BAA8B;AACvC,SAASC,yBAAyB;AAClC,SAASC,WAAW;AACpB,SAASC,6BAA6B,QAAQ,iBAAiB;AAC/D,SAASC,aAAa,QAAQ,8BAA8B;AAC5D,SAASC,wBAAwB,IAAIC,mCAAmC,QAAQ,qDAAqD;AAGrI;AAEA,MAAMC,+BAAyD,GAAGC,MAAM,IAAI;EACxE,MAAM;IAAEC,KAAK;IAAEC,cAAc;IAAEC,OAAO;IAAEC;EAAU,CAAC,GAAGJ,MAAM;EAE5D,MAAMK,aAAa,GAAGX,WAAW,CAAC;IAC9BY,IAAI,EAAEL,KAAK;IACXC;EACJ,CAAC,CAAC;EAEF,MAAMK,QAAQ,GAAG;IACbC,MAAM,EAAErB,iBAAiB,CAAC;MACtBsB,UAAU,EAAEvB,QAAQ,CAACwB,MAAM;MAC3BT,KAAK,EAAEI;IACX,CAAC,CAAC;IACFM,MAAM,EAAEvB,iBAAiB,CAAC;MACtBqB,UAAU,EAAEvB,QAAQ,CAAC0B,MAAM;MAC3BX,KAAK,EAAEI;IACX,CAAC,CAAC;IACFQ,OAAO,EAAExB,iBAAiB,CAAC;MACvBoB,UAAU,EAAEvB,QAAQ,CAAC4B,OAAO;MAC5Bb,KAAK,EAAEI;IACX,CAAC;EACL,CAAC;EAEDF,OAAO,CAACY,QAAQ,CAAC;EACb;AACR;AACA;EACQ9B,eAAe,CAAC,CAAC;EACjB;AACR;AACA;EACQQ,yBAAyB,CAAC,CAAC,CAC9B,CAAC;EAEF,MAAMoB,OAAO,GAAGrB,8BAA8B,CAAC;IAC3CwB,MAAM,EAAET,QAAQ,CAACM,OAAO;IACxBT,SAAS;IACTD;EACJ,CAAC,CAAC;EAEF,OAAO;IACHG,IAAI,EAAE,UAAU;IAChBW,UAAU,EAAE,MAAAA,CAAA,KAAY;MACpBJ,OAAO,CAACK,WAAW,CAACC,QAAQ,CAAC,CAAC;IAClC,CAAC;IACDC,WAAW,EAAEA,CAAA,KAAMb,QAAQ;IAC3Bc,QAAQ,EAAEA,CAAA,KAAMhB,aAAa;IAC7BG,MAAM,EAAElB,6BAA6B,CAAC;MAClC0B,MAAM,EAAET,QAAQ,CAACC,MAAM;MACvBJ;IACJ,CAAC,CAAC;IACFO,MAAM,EAAEpB,6BAA6B,CAAC;MAClCyB,MAAM,EAAET,QAAQ,CAACI;IACrB,CAAC,CAAC;IACFE;EACJ,CAAC;AACL,CAAC;AAED,MAAMS,oCAAoC,CAE1C;EACI,MAAaC,MAAMA,CAACC,OAAmB,EAAE;IACrC,OAAOzB,+BAA+B,CAAC;MACnCG,cAAc,EAAEsB,OAAO,CAACC,EAAE,CAACC,MAAM,CAACC,SAAS,CAAC,CAAqB;MACjExB,OAAO,EAAEqB,OAAO,CAACrB,OAAO;MACxBC,SAAS,EAAEoB,OAAO,CAACpB;IACvB,CAAC,CAAC;EACN;AACJ;AAEA,MAAMwB,gCAAgC,GAAG9B,mCAAmC,CAAC+B,oBAAoB,CAAC;EAC9FC,cAAc,EAAER,oCAAoC;EACpDS,YAAY,EAAE;AAClB,CAAC,CAAC;AAEF,MAAMC,wBAAwB,GAAGpC,aAAa,CAAC;EAC3CU,IAAI,EAAE,kCAAkC;EACxCS,QAAQ,EAAEX,SAAS,IAAI;IACnBA,SAAS,CAACW,QAAQ,CAACa,gCAAgC,CAAC,CAACK,gBAAgB,CAAC,CAAC;EAC3E;AACJ,CAAC,CAAC;AAEF,OAAO,MAAMC,iCAAiC,GAAGA,CAAA,KAAM;EACnD,OAAO,CACHlD,yBAAyB,CAAC,CAAC,EAC3BW,6BAA6B,CAAC6B,OAAO,IAAI;IACrC,OAAOQ,wBAAwB,CAACjB,QAAQ,CAACS,OAAO,CAACpB,SAAS,CAAC;EAC/D,CAAC,CAAC,CACL;AACL,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { ENTITIES } from \"~/types.js\";\nimport { createGroupEntity } from \"~/definitions/group.js\";\nimport { createModelEntity } from \"~/definitions/model.js\";\nimport { createEntryEntity } from \"~/definitions/entry.js\";\nimport { createTable } from \"~/definitions/table.js\";\nimport { createFeature } from \"@webiny/feature/api/index.js\";\nimport { DynamoDBClient } from \"@webiny/db-dynamodb\";\nimport { FilterUtilFeature } from \"@webiny/db-dynamodb/feature/FilterUtil/feature.js\";\nimport { CmsDdbTable } from \"~/abstractions/CmsDdbTable.js\";\nimport { CmsDdbGroupEntity } from \"~/abstractions/CmsDdbGroupEntity.js\";\nimport { CmsDdbModelEntity } from \"~/abstractions/CmsDdbModelEntity.js\";\nimport { CmsDdbEntryEntity } from \"~/abstractions/CmsDdbEntryEntity.js\";\n\nexport { HeadlessCmsDdbRequestFeature } from \"~/requestFeature.js\";\n\n/**\n * Root half of the DynamoDB CMS storage: the table and entity definitions, built once per process.\n * The storage operations are per request, in `HeadlessCmsDdbRequestFeature`.\n * Requires DynamoDBClient to be registered in the container first (via DbFeature).\n *\n * Usage:\n * DbFeature.register(container, { documentClient, table });\n * HeadlessCmsDdbFeature.register(container);\n * // then in request:\n * HeadlessCmsDdbRequestFeature.register(requestContainer);\n * HeadlessCmsFeature.register(requestContainer, { type: \"manage\" });\n */\nexport const HeadlessCmsDdbFeature = createFeature({\n name: \"cms.storageOperations.ddb\",\n register: container => {\n FilterUtilFeature.register(container);\n\n const db = container.resolve(DynamoDBClient);\n const documentClient = db.client;\n\n const tableInstance = createTable({ documentClient });\n\n // Register infrastructure instances (app-scoped)\n container.registerInstance(CmsDdbTable, tableInstance);\n container.registerInstance(\n CmsDdbGroupEntity,\n createGroupEntity({\n entityName: ENTITIES.GROUPS,\n table: tableInstance\n })\n );\n container.registerInstance(\n CmsDdbModelEntity,\n createModelEntity({\n entityName: ENTITIES.MODELS,\n table: tableInstance\n })\n );\n container.registerInstance(\n CmsDdbEntryEntity,\n createEntryEntity({\n entityName: ENTITIES.ENTRIES,\n table: tableInstance\n })\n );\n }\n});\n"],"names":["HeadlessCmsDdbFeature","createFeature","container","FilterUtilFeature","db","DynamoDBClient","documentClient","tableInstance","createTable","CmsDdbTable","CmsDdbGroupEntity","createGroupEntity","ENTITIES","CmsDdbModelEntity","createModelEntity","CmsDdbEntryEntity","createEntryEntity"],"mappings":";;;;;;;;;;;;AA2BO,MAAMA,wBAAwBC,cAAc;IAC/C,MAAM;IACN,UAAUC,CAAAA;QACNC,kBAAkB,QAAQ,CAACD;QAE3B,MAAME,KAAKF,UAAU,OAAO,CAACG;QAC7B,MAAMC,iBAAiBF,GAAG,MAAM;QAEhC,MAAMG,gBAAgBC,YAAY;YAAEF;QAAe;QAGnDJ,UAAU,gBAAgB,CAACO,aAAaF;QACxCL,UAAU,gBAAgB,CACtBQ,mBACAC,kBAAkB;YACd,YAAYC,SAAS,MAAM;YAC3B,OAAOL;QACX;QAEJL,UAAU,gBAAgB,CACtBW,mBACAC,kBAAkB;YACd,YAAYF,SAAS,MAAM;YAC3B,OAAOL;QACX;QAEJL,UAAU,gBAAgB,CACtBa,mBACAC,kBAAkB;YACd,YAAYJ,SAAS,OAAO;YAC5B,OAAOL;QACX;IAER;AACJ"}
@@ -0,0 +1,16 @@
1
+ import type { CmsModel, CmsEntryValues, CmsEntryStorageOperationsCreateParams } from "@webiny/api-headless-cms/types/index.js";
2
+ import { CreateEntryStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/CreateEntryStorageOperation.js";
3
+ import { CmsDdbEntryEntity } from "../../abstractions/CmsDdbEntryEntity.js";
4
+ import { CmsDdbDataLoaders } from "../../abstractions/CmsDdbDataLoaders.js";
5
+ import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
6
+ declare class DdbCreateEntryImpl implements CreateEntryStorageOperation.Interface {
7
+ private entity;
8
+ private dataLoaders;
9
+ private storageModelProvider;
10
+ constructor(entity: CmsDdbEntryEntity.Interface, dataLoaders: CmsDdbDataLoaders.Interface, storageModelProvider: CmsStorageModelProvider.Interface);
11
+ execute<T extends CmsEntryValues = CmsEntryValues>(initialModel: CmsModel, params: CmsEntryStorageOperationsCreateParams<T>): Promise<import("@webiny/api-headless-cms/types/types.js").CmsStorageEntry<T>>;
12
+ }
13
+ export declare const DdbCreateEntry: typeof DdbCreateEntryImpl & {
14
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/CreateEntryStorageOperation.js").ICreateEntryStorageOperation>;
15
+ };
16
+ export {};
@@ -0,0 +1,77 @@
1
+ import error from "@webiny/error";
2
+ import { CreateEntryStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/CreateEntryStorageOperation.js";
3
+ import { CmsDdbEntryEntity } from "../../abstractions/CmsDdbEntryEntity.js";
4
+ import { CmsDdbDataLoaders } from "../../abstractions/CmsDdbDataLoaders.js";
5
+ import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
6
+ import { createEntryLatestKeys, createEntryPublishedKeys, createEntryRevisionKeys } from "./keys.js";
7
+ import { convertToStorageEntry } from "./storageEntryUtils.js";
8
+ class DdbCreateEntryImpl {
9
+ constructor(entity, dataLoaders, storageModelProvider){
10
+ this.entity = entity;
11
+ this.dataLoaders = dataLoaders;
12
+ this.storageModelProvider = storageModelProvider;
13
+ }
14
+ async execute(initialModel, params) {
15
+ const { entry, storageEntry: initialStorageEntry } = params;
16
+ const model = this.storageModelProvider.getModel(initialModel);
17
+ const isPublished = "published" === entry.status;
18
+ const locked = isPublished ? true : entry.locked;
19
+ const storageEntry = convertToStorageEntry({
20
+ model,
21
+ storageEntry: initialStorageEntry
22
+ });
23
+ const storageEntryRevisionKeys = createEntryRevisionKeys(entry);
24
+ const storageEntryLatestKeys = createEntryLatestKeys(entry);
25
+ const entityBatch = this.entity.createEntityWriter({
26
+ put: [
27
+ {
28
+ ...storageEntryRevisionKeys,
29
+ data: {
30
+ ...storageEntry,
31
+ locked
32
+ }
33
+ },
34
+ {
35
+ ...storageEntryLatestKeys,
36
+ data: {
37
+ ...storageEntry,
38
+ locked
39
+ }
40
+ }
41
+ ]
42
+ });
43
+ if (isPublished) {
44
+ const storageEntryPublishedKeys = createEntryPublishedKeys(storageEntry);
45
+ entityBatch.put({
46
+ ...storageEntryPublishedKeys,
47
+ data: {
48
+ ...storageEntry,
49
+ locked
50
+ }
51
+ });
52
+ }
53
+ try {
54
+ await entityBatch.execute();
55
+ this.dataLoaders.clearAll({
56
+ tenant: entry.tenant
57
+ });
58
+ } catch (ex) {
59
+ throw new error(ex.message || "Could not insert data into the DynamoDB.", ex.code || "CREATE_ENTRY_ERROR", {
60
+ error: ex,
61
+ entry
62
+ });
63
+ }
64
+ return initialStorageEntry;
65
+ }
66
+ }
67
+ const DdbCreateEntry = CreateEntryStorageOperation.createImplementation({
68
+ implementation: DdbCreateEntryImpl,
69
+ dependencies: [
70
+ CmsDdbEntryEntity,
71
+ CmsDdbDataLoaders,
72
+ CmsStorageModelProvider
73
+ ]
74
+ });
75
+ export { DdbCreateEntry };
76
+
77
+ //# sourceMappingURL=DdbCreateEntry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/entry/DdbCreateEntry.js","sources":["../../../src/operations/entry/DdbCreateEntry.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsCreateParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { CreateEntryStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/CreateEntryStorageOperation.js\";\nimport { CmsDdbEntryEntity } from \"~/abstractions/CmsDdbEntryEntity.js\";\nimport { CmsDdbDataLoaders } from \"~/abstractions/CmsDdbDataLoaders.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport {\n createEntryLatestKeys,\n createEntryPublishedKeys,\n createEntryRevisionKeys\n} from \"~/operations/entry/keys.js\";\nimport { convertToStorageEntry } from \"./storageEntryUtils.js\";\n\nclass DdbCreateEntryImpl implements CreateEntryStorageOperation.Interface {\n constructor(\n private entity: CmsDdbEntryEntity.Interface,\n private dataLoaders: CmsDdbDataLoaders.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface\n ) {}\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n params: CmsEntryStorageOperationsCreateParams<T>\n ) {\n const { entry, storageEntry: initialStorageEntry } = params;\n const model = this.storageModelProvider.getModel(initialModel);\n\n const isPublished = entry.status === \"published\";\n\n const locked = isPublished ? true : entry.locked;\n\n const storageEntry = convertToStorageEntry({\n model,\n storageEntry: initialStorageEntry\n });\n\n const storageEntryRevisionKeys = createEntryRevisionKeys(entry);\n const storageEntryLatestKeys = createEntryLatestKeys(entry);\n /**\n * We need to:\n * - create new main entry item\n * - create new or update the latest entry item\n */\n const entityBatch = this.entity.createEntityWriter({\n put: [\n {\n ...storageEntryRevisionKeys,\n data: {\n ...storageEntry,\n locked\n }\n },\n {\n ...storageEntryLatestKeys,\n data: {\n ...storageEntry,\n locked\n }\n }\n ]\n });\n\n /**\n * We need to create published entry if\n */\n if (isPublished) {\n const storageEntryPublishedKeys = createEntryPublishedKeys(storageEntry);\n entityBatch.put({\n ...storageEntryPublishedKeys,\n data: {\n ...storageEntry,\n locked\n }\n });\n }\n\n try {\n await entityBatch.execute();\n this.dataLoaders.clearAll({\n tenant: entry.tenant\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not insert data into the DynamoDB.\",\n ex.code || \"CREATE_ENTRY_ERROR\",\n {\n error: ex,\n entry\n }\n );\n }\n\n return initialStorageEntry;\n }\n}\n\nexport const DdbCreateEntry = CreateEntryStorageOperation.createImplementation({\n implementation: DdbCreateEntryImpl,\n dependencies: [CmsDdbEntryEntity, CmsDdbDataLoaders, CmsStorageModelProvider]\n});\n"],"names":["DdbCreateEntryImpl","entity","dataLoaders","storageModelProvider","initialModel","params","entry","initialStorageEntry","model","isPublished","locked","storageEntry","convertToStorageEntry","storageEntryRevisionKeys","createEntryRevisionKeys","storageEntryLatestKeys","createEntryLatestKeys","entityBatch","storageEntryPublishedKeys","createEntryPublishedKeys","ex","WebinyError","DdbCreateEntry","CreateEntryStorageOperation","CmsDdbEntryEntity","CmsDdbDataLoaders","CmsStorageModelProvider"],"mappings":";;;;;;;AAiBA,MAAMA;IACF,YACYC,MAAmC,EACnCC,WAAwC,EACxCC,oBAAuD,CACjE;aAHUF,MAAM,GAANA;aACAC,WAAW,GAAXA;aACAC,oBAAoB,GAApBA;IACT;IAEH,MAAM,QACFC,YAAsB,EACtBC,MAAgD,EAClD;QACE,MAAM,EAAEC,KAAK,EAAE,cAAcC,mBAAmB,EAAE,GAAGF;QACrD,MAAMG,QAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAACJ;QAEjD,MAAMK,cAAcH,AAAiB,gBAAjBA,MAAM,MAAM;QAEhC,MAAMI,SAASD,cAAc,OAAOH,MAAM,MAAM;QAEhD,MAAMK,eAAeC,sBAAsB;YACvCJ;YACA,cAAcD;QAClB;QAEA,MAAMM,2BAA2BC,wBAAwBR;QACzD,MAAMS,yBAAyBC,sBAAsBV;QAMrD,MAAMW,cAAc,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC;YAC/C,KAAK;gBACD;oBACI,GAAGJ,wBAAwB;oBAC3B,MAAM;wBACF,GAAGF,YAAY;wBACfD;oBACJ;gBACJ;gBACA;oBACI,GAAGK,sBAAsB;oBACzB,MAAM;wBACF,GAAGJ,YAAY;wBACfD;oBACJ;gBACJ;aACH;QACL;QAKA,IAAID,aAAa;YACb,MAAMS,4BAA4BC,yBAAyBR;YAC3DM,YAAY,GAAG,CAAC;gBACZ,GAAGC,yBAAyB;gBAC5B,MAAM;oBACF,GAAGP,YAAY;oBACfD;gBACJ;YACJ;QACJ;QAEA,IAAI;YACA,MAAMO,YAAY,OAAO;YACzB,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC;gBACtB,QAAQX,MAAM,MAAM;YACxB;QACJ,EAAE,OAAOc,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,4CACdA,GAAG,IAAI,IAAI,sBACX;gBACI,OAAOA;gBACPd;YACJ;QAER;QAEA,OAAOC;IACX;AACJ;AAEO,MAAMe,iBAAiBC,4BAA4B,oBAAoB,CAAC;IAC3E,gBAAgBvB;IAChB,cAAc;QAACwB;QAAmBC;QAAmBC;KAAwB;AACjF"}
@@ -0,0 +1,16 @@
1
+ import type { CmsModel, CmsEntryValues, CmsEntryStorageOperationsCreateRevisionFromParams } from "@webiny/api-headless-cms/types/index.js";
2
+ import { CreateEntryRevisionFromStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/CreateEntryRevisionFromStorageOperation.js";
3
+ import { CmsDdbEntryEntity } from "../../abstractions/CmsDdbEntryEntity.js";
4
+ import { CmsDdbDataLoaders } from "../../abstractions/CmsDdbDataLoaders.js";
5
+ import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
6
+ declare class DdbCreateEntryRevisionFromImpl implements CreateEntryRevisionFromStorageOperation.Interface {
7
+ private entity;
8
+ private dataLoaders;
9
+ private storageModelProvider;
10
+ constructor(entity: CmsDdbEntryEntity.Interface, dataLoaders: CmsDdbDataLoaders.Interface, storageModelProvider: CmsStorageModelProvider.Interface);
11
+ execute<T extends CmsEntryValues = CmsEntryValues>(initialModel: CmsModel, params: CmsEntryStorageOperationsCreateRevisionFromParams<T>): Promise<import("@webiny/api-headless-cms/types/types.js").CmsStorageEntry<T>>;
12
+ }
13
+ export declare const DdbCreateEntryRevisionFrom: typeof DdbCreateEntryRevisionFromImpl & {
14
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/CreateEntryRevisionFromStorageOperation.js").ICreateEntryRevisionFromStorageOperation>;
15
+ };
16
+ export {};