@webiny/api-headless-cms-ddb 6.4.5-beta.0 → 6.6.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) 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/index.d.ts +13 -2
  17. package/index.js +31 -71
  18. package/index.js.map +1 -1
  19. package/operations/entry/DdbCreateEntry.d.ts +16 -0
  20. package/operations/entry/DdbCreateEntry.js +77 -0
  21. package/operations/entry/DdbCreateEntry.js.map +1 -0
  22. package/operations/entry/DdbCreateEntryRevisionFrom.d.ts +16 -0
  23. package/operations/entry/DdbCreateEntryRevisionFrom.js +85 -0
  24. package/operations/entry/DdbCreateEntryRevisionFrom.js.map +1 -0
  25. package/operations/entry/DdbDeleteEntry.d.ts +16 -0
  26. package/operations/entry/DdbDeleteEntry.js +65 -0
  27. package/operations/entry/DdbDeleteEntry.js.map +1 -0
  28. package/operations/entry/DdbDeleteEntryRevision.d.ts +17 -0
  29. package/operations/entry/DdbDeleteEntryRevision.js +91 -0
  30. package/operations/entry/DdbDeleteEntryRevision.js.map +1 -0
  31. package/operations/entry/DdbDeleteMultipleEntries.d.ts +16 -0
  32. package/operations/entry/DdbDeleteMultipleEntries.js +56 -0
  33. package/operations/entry/DdbDeleteMultipleEntries.js.map +1 -0
  34. package/operations/entry/DdbGetEntriesByIds.d.ts +14 -0
  35. package/operations/entry/DdbGetEntriesByIds.js +31 -0
  36. package/operations/entry/DdbGetEntriesByIds.js.map +1 -0
  37. package/operations/entry/DdbGetEntry.d.ts +14 -0
  38. package/operations/entry/DdbGetEntry.js +27 -0
  39. package/operations/entry/DdbGetEntry.js.map +1 -0
  40. package/operations/entry/DdbGetLatestEntriesByIds.d.ts +14 -0
  41. package/operations/entry/DdbGetLatestEntriesByIds.js +31 -0
  42. package/operations/entry/DdbGetLatestEntriesByIds.js.map +1 -0
  43. package/operations/entry/DdbGetLatestRevisionByEntryId.d.ts +14 -0
  44. package/operations/entry/DdbGetLatestRevisionByEntryId.js +35 -0
  45. package/operations/entry/DdbGetLatestRevisionByEntryId.js.map +1 -0
  46. package/operations/entry/DdbGetPreviousRevision.d.ts +14 -0
  47. package/operations/entry/DdbGetPreviousRevision.js +53 -0
  48. package/operations/entry/DdbGetPreviousRevision.js.map +1 -0
  49. package/operations/entry/DdbGetPublishedEntriesByIds.d.ts +14 -0
  50. package/operations/entry/DdbGetPublishedEntriesByIds.js +31 -0
  51. package/operations/entry/DdbGetPublishedEntriesByIds.js.map +1 -0
  52. package/operations/entry/DdbGetPublishedRevisionByEntryId.d.ts +14 -0
  53. package/operations/entry/DdbGetPublishedRevisionByEntryId.js +35 -0
  54. package/operations/entry/DdbGetPublishedRevisionByEntryId.js.map +1 -0
  55. package/operations/entry/DdbGetRevisionById.d.ts +14 -0
  56. package/operations/entry/DdbGetRevisionById.js +34 -0
  57. package/operations/entry/DdbGetRevisionById.js.map +1 -0
  58. package/operations/entry/DdbGetRevisions.d.ts +14 -0
  59. package/operations/entry/DdbGetRevisions.js +33 -0
  60. package/operations/entry/DdbGetRevisions.js.map +1 -0
  61. package/operations/entry/DdbGetUniqueFieldValues.d.ts +12 -0
  62. package/operations/entry/DdbGetUniqueFieldValues.js +31 -0
  63. package/operations/entry/DdbGetUniqueFieldValues.js.map +1 -0
  64. package/operations/entry/DdbListEntries.d.ts +28 -0
  65. package/operations/entry/DdbListEntries.js +124 -0
  66. package/operations/entry/DdbListEntries.js.map +1 -0
  67. package/operations/entry/DdbMoveEntry.d.ts +14 -0
  68. package/operations/entry/DdbMoveEntry.js +57 -0
  69. package/operations/entry/DdbMoveEntry.js.map +1 -0
  70. package/operations/entry/DdbMoveToBin.d.ts +16 -0
  71. package/operations/entry/DdbMoveToBin.js +77 -0
  72. package/operations/entry/DdbMoveToBin.js.map +1 -0
  73. package/operations/entry/DdbPublishEntry.d.ts +18 -0
  74. package/operations/entry/DdbPublishEntry.js +161 -0
  75. package/operations/entry/DdbPublishEntry.js.map +1 -0
  76. package/operations/entry/DdbRestoreFromBin.d.ts +16 -0
  77. package/operations/entry/DdbRestoreFromBin.js +78 -0
  78. package/operations/entry/DdbRestoreFromBin.js.map +1 -0
  79. package/operations/entry/DdbUnpublishEntry.d.ts +17 -0
  80. package/operations/entry/DdbUnpublishEntry.js +112 -0
  81. package/operations/entry/DdbUnpublishEntry.js.map +1 -0
  82. package/operations/entry/DdbUpdateEntry.d.ts +17 -0
  83. package/operations/entry/DdbUpdateEntry.js +110 -0
  84. package/operations/entry/DdbUpdateEntry.js.map +1 -0
  85. package/operations/entry/dataLoaders.d.ts +7 -6
  86. package/operations/entry/dataLoaders.js +11 -3
  87. package/operations/entry/dataLoaders.js.map +1 -1
  88. package/operations/entry/feature.d.ts +4 -0
  89. package/operations/entry/feature.js +55 -0
  90. package/operations/entry/feature.js.map +1 -0
  91. package/operations/entry/storageEntryUtils.d.ts +8 -0
  92. package/operations/entry/storageEntryUtils.js +25 -0
  93. package/operations/entry/storageEntryUtils.js.map +1 -0
  94. package/operations/group/DdbCreateGroup.d.ts +12 -0
  95. package/operations/group/DdbCreateGroup.js +35 -0
  96. package/operations/group/DdbCreateGroup.js.map +1 -0
  97. package/operations/group/DdbDeleteGroup.d.ts +12 -0
  98. package/operations/group/DdbDeleteGroup.js +31 -0
  99. package/operations/group/DdbDeleteGroup.js.map +1 -0
  100. package/operations/group/DdbGetGroup.d.ts +12 -0
  101. package/operations/group/DdbGetGroup.js +31 -0
  102. package/operations/group/DdbGetGroup.js.map +1 -0
  103. package/operations/group/DdbListGroups.d.ts +14 -0
  104. package/operations/group/DdbListGroups.js +52 -0
  105. package/operations/group/DdbListGroups.js.map +1 -0
  106. package/operations/group/DdbUpdateGroup.d.ts +12 -0
  107. package/operations/group/DdbUpdateGroup.js +35 -0
  108. package/operations/group/DdbUpdateGroup.js.map +1 -0
  109. package/operations/group/feature.d.ts +4 -0
  110. package/operations/group/feature.js +19 -0
  111. package/operations/group/feature.js.map +1 -0
  112. package/operations/group/keys.d.ts +15 -0
  113. package/operations/group/keys.js +17 -0
  114. package/operations/group/keys.js.map +1 -0
  115. package/operations/model/DdbCreateModel.d.ts +12 -0
  116. package/operations/model/DdbCreateModel.js +37 -0
  117. package/operations/model/DdbCreateModel.js.map +1 -0
  118. package/operations/model/DdbDeleteModel.d.ts +12 -0
  119. package/operations/model/DdbDeleteModel.js +31 -0
  120. package/operations/model/DdbDeleteModel.js.map +1 -0
  121. package/operations/model/DdbGetModel.d.ts +12 -0
  122. package/operations/model/DdbGetModel.js +30 -0
  123. package/operations/model/DdbGetModel.js.map +1 -0
  124. package/operations/model/DdbListModels.d.ts +12 -0
  125. package/operations/model/DdbListModels.js +36 -0
  126. package/operations/model/DdbListModels.js.map +1 -0
  127. package/operations/model/DdbUpdateModel.d.ts +12 -0
  128. package/operations/model/DdbUpdateModel.js +36 -0
  129. package/operations/model/DdbUpdateModel.js.map +1 -0
  130. package/operations/model/feature.d.ts +4 -0
  131. package/operations/model/feature.js +19 -0
  132. package/operations/model/feature.js.map +1 -0
  133. package/operations/model/keys.d.ts +15 -0
  134. package/operations/model/keys.js +16 -0
  135. package/operations/model/keys.js.map +1 -0
  136. package/package.json +15 -17
  137. package/types.d.ts +9 -49
  138. package/types.js.map +1 -1
  139. package/dynamoDb/index.d.ts +0 -2
  140. package/dynamoDb/index.js +0 -11
  141. package/dynamoDb/index.js.map +0 -1
  142. package/dynamoDb/path/locationFolderId.d.ts +0 -2
  143. package/dynamoDb/path/locationFolderId.js +0 -21
  144. package/dynamoDb/path/locationFolderId.js.map +0 -1
  145. package/dynamoDb/path/plainObject.d.ts +0 -2
  146. package/dynamoDb/path/plainObject.js +0 -16
  147. package/dynamoDb/path/plainObject.js.map +0 -1
  148. package/dynamoDb/transformValue/datetime.d.ts +0 -5
  149. package/dynamoDb/transformValue/datetime.js +0 -29
  150. package/dynamoDb/transformValue/datetime.js.map +0 -1
  151. package/operations/entry/filtering/createExpressions.d.ts +0 -27
  152. package/operations/entry/filtering/createExpressions.js +0 -124
  153. package/operations/entry/filtering/createExpressions.js.map +0 -1
  154. package/operations/entry/filtering/createFields.d.ts +0 -16
  155. package/operations/entry/filtering/createFields.js +0 -93
  156. package/operations/entry/filtering/createFields.js.map +0 -1
  157. package/operations/entry/filtering/extractSort.d.ts +0 -17
  158. package/operations/entry/filtering/extractSort.js +0 -60
  159. package/operations/entry/filtering/extractSort.js.map +0 -1
  160. package/operations/entry/filtering/filter.d.ts +0 -16
  161. package/operations/entry/filtering/filter.js +0 -85
  162. package/operations/entry/filtering/filter.js.map +0 -1
  163. package/operations/entry/filtering/fullTextSearch.d.ts +0 -14
  164. package/operations/entry/filtering/fullTextSearch.js +0 -25
  165. package/operations/entry/filtering/fullTextSearch.js.map +0 -1
  166. package/operations/entry/filtering/getValue.d.ts +0 -5
  167. package/operations/entry/filtering/getValue.js +0 -37
  168. package/operations/entry/filtering/getValue.js.map +0 -1
  169. package/operations/entry/filtering/index.d.ts +0 -2
  170. package/operations/entry/filtering/index.js +0 -2
  171. package/operations/entry/filtering/mapPlugins.d.ts +0 -8
  172. package/operations/entry/filtering/mapPlugins.js +0 -18
  173. package/operations/entry/filtering/mapPlugins.js.map +0 -1
  174. package/operations/entry/filtering/plugins/defaultFilterCreate.d.ts +0 -2
  175. package/operations/entry/filtering/plugins/defaultFilterCreate.js +0 -33
  176. package/operations/entry/filtering/plugins/defaultFilterCreate.js.map +0 -1
  177. package/operations/entry/filtering/plugins/index.d.ts +0 -1
  178. package/operations/entry/filtering/plugins/index.js +0 -13
  179. package/operations/entry/filtering/plugins/index.js.map +0 -1
  180. package/operations/entry/filtering/plugins/objectFilterCreate.d.ts +0 -2
  181. package/operations/entry/filtering/plugins/objectFilterCreate.js +0 -68
  182. package/operations/entry/filtering/plugins/objectFilterCreate.js.map +0 -1
  183. package/operations/entry/filtering/plugins/refFilterCreate.d.ts +0 -3
  184. package/operations/entry/filtering/plugins/refFilterCreate.js +0 -63
  185. package/operations/entry/filtering/plugins/refFilterCreate.js.map +0 -1
  186. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.d.ts +0 -2
  187. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js +0 -56
  188. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js.map +0 -1
  189. package/operations/entry/filtering/sort.d.ts +0 -12
  190. package/operations/entry/filtering/sort.js +0 -41
  191. package/operations/entry/filtering/sort.js.map +0 -1
  192. package/operations/entry/filtering/systemFields.d.ts +0 -2
  193. package/operations/entry/filtering/systemFields.js +0 -149
  194. package/operations/entry/filtering/systemFields.js.map +0 -1
  195. package/operations/entry/filtering/transform.d.ts +0 -6
  196. package/operations/entry/filtering/transform.js +0 -7
  197. package/operations/entry/filtering/transform.js.map +0 -1
  198. package/operations/entry/filtering/types.d.ts +0 -40
  199. package/operations/entry/filtering/types.js +0 -0
  200. package/operations/entry/filtering/values.d.ts +0 -2
  201. package/operations/entry/filtering/values.js +0 -15
  202. package/operations/entry/filtering/values.js.map +0 -1
  203. package/operations/entry/filtering/where.d.ts +0 -5
  204. package/operations/entry/filtering/where.js +0 -22
  205. package/operations/entry/filtering/where.js.map +0 -1
  206. package/operations/entry/index.d.ts +0 -9
  207. package/operations/entry/index.js +0 -943
  208. package/operations/entry/index.js.map +0 -1
  209. package/operations/group/index.d.ts +0 -8
  210. package/operations/group/index.js +0 -121
  211. package/operations/group/index.js.map +0 -1
  212. package/operations/model/index.d.ts +0 -7
  213. package/operations/model/index.js +0 -106
  214. package/operations/model/index.js.map +0 -1
  215. package/plugins/CmsEntryFieldFilterPathPlugin.d.ts +0 -23
  216. package/plugins/CmsEntryFieldFilterPathPlugin.js +0 -30
  217. package/plugins/CmsEntryFieldFilterPathPlugin.js.map +0 -1
  218. package/plugins/CmsEntryFieldFilterPlugin.d.ts +0 -43
  219. package/plugins/CmsEntryFieldFilterPlugin.js +0 -20
  220. package/plugins/CmsEntryFieldFilterPlugin.js.map +0 -1
  221. package/plugins/CmsEntryFieldSortingPlugin.d.ts +0 -42
  222. package/plugins/CmsEntryFieldSortingPlugin.js +0 -20
  223. package/plugins/CmsEntryFieldSortingPlugin.js.map +0 -1
  224. package/plugins/CmsFieldFilterValueTransformPlugin.d.ts +0 -11
  225. package/plugins/CmsFieldFilterValueTransformPlugin.js +0 -19
  226. package/plugins/CmsFieldFilterValueTransformPlugin.js.map +0 -1
  227. package/plugins/index.d.ts +0 -4
  228. package/plugins/index.js +0 -4
@@ -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 { CmsDdbModelEntity } from "../../abstractions/CmsDdbModelEntity.js";
4
+ declare class DdbDeleteModelImpl implements DeleteModelStorageOperation.Interface {
5
+ private entity;
6
+ constructor(entity: CmsDdbModelEntity.Interface);
7
+ execute(params: CmsModelStorageOperationsDeleteParams): Promise<void>;
8
+ }
9
+ export declare const DdbDeleteModel: typeof DdbDeleteModelImpl & {
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 { CmsDdbModelEntity } from "../../abstractions/CmsDdbModelEntity.js";
4
+ import { createKeys } from "./keys.js";
5
+ class DdbDeleteModelImpl {
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 DdbDeleteModel = DeleteModelStorageOperation.createImplementation({
24
+ implementation: DdbDeleteModelImpl,
25
+ dependencies: [
26
+ CmsDdbModelEntity
27
+ ]
28
+ });
29
+ export { DdbDeleteModel };
30
+
31
+ //# sourceMappingURL=DdbDeleteModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/model/DdbDeleteModel.js","sources":["../../../src/operations/model/DdbDeleteModel.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 { CmsDdbModelEntity } from \"~/abstractions/CmsDdbModelEntity.js\";\nimport { createKeys } from \"./keys.js\";\n\nclass DdbDeleteModelImpl implements DeleteModelStorageOperation.Interface {\n constructor(private entity: CmsDdbModelEntity.Interface) {}\n\n async execute(params: CmsModelStorageOperationsDeleteParams) {\n const { model } = params;\n const keys = createKeys(model);\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 { error: ex, model, keys }\n );\n }\n }\n}\n\nexport const DdbDeleteModel = DeleteModelStorageOperation.createImplementation({\n implementation: DdbDeleteModelImpl,\n dependencies: [CmsDdbModelEntity]\n});\n"],"names":["DdbDeleteModelImpl","entity","params","model","keys","createKeys","ex","WebinyError","DdbDeleteModel","DeleteModelStorageOperation","CmsDdbModelEntity"],"mappings":";;;;AAMA,MAAMA;IACF,YAAoBC,MAAmC,CAAE;aAArCA,MAAM,GAANA;IAAsC;IAE1D,MAAM,QAAQC,MAA6C,EAAE;QACzD,MAAM,EAAEC,KAAK,EAAE,GAAGD;QAClB,MAAME,OAAOC,WAAWF;QACxB,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;gBAAE,OAAOA;gBAAIH;gBAAOC;YAAK;QAEjC;IACJ;AACJ;AAEO,MAAMI,iBAAiBC,4BAA4B,oBAAoB,CAAC;IAC3E,gBAAgBT;IAChB,cAAc;QAACU;KAAkB;AACrC"}
@@ -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 { CmsDdbModelEntity } from "../../abstractions/CmsDdbModelEntity.js";
4
+ declare class DdbGetModelImpl implements GetModelStorageOperation.Interface {
5
+ private entity;
6
+ constructor(entity: CmsDdbModelEntity.Interface);
7
+ execute(params: CmsModelStorageOperationsGetParams): Promise<import("@webiny/api-headless-cms/types/model.js").StorageCmsModel | null>;
8
+ }
9
+ export declare const DdbGetModel: typeof DdbGetModelImpl & {
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 { CmsDdbModelEntity } from "../../abstractions/CmsDdbModelEntity.js";
4
+ import { createKeys } from "./keys.js";
5
+ class DdbGetModelImpl {
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?.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 DdbGetModel = GetModelStorageOperation.createImplementation({
23
+ implementation: DdbGetModelImpl,
24
+ dependencies: [
25
+ CmsDdbModelEntity
26
+ ]
27
+ });
28
+ export { DdbGetModel };
29
+
30
+ //# sourceMappingURL=DdbGetModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/model/DdbGetModel.js","sources":["../../../src/operations/model/DdbGetModel.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 { CmsDdbModelEntity } from \"~/abstractions/CmsDdbModelEntity.js\";\nimport { createKeys } from \"./keys.js\";\n\nclass DdbGetModelImpl implements GetModelStorageOperation.Interface {\n constructor(private entity: CmsDdbModelEntity.Interface) {}\n\n async execute(params: CmsModelStorageOperationsGetParams) {\n const keys = createKeys(params);\n try {\n const result = await this.entity.get(keys);\n return result?.data || null;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get model.\",\n ex.code || \"MODEL_GET_ERROR\",\n { error: ex, keys }\n );\n }\n }\n}\n\nexport const DdbGetModel = GetModelStorageOperation.createImplementation({\n implementation: DdbGetModelImpl,\n dependencies: [CmsDdbModelEntity]\n});\n"],"names":["DdbGetModelImpl","entity","params","keys","createKeys","result","ex","WebinyError","DdbGetModel","GetModelStorageOperation","CmsDdbModelEntity"],"mappings":";;;;AAMA,MAAMA;IACF,YAAoBC,MAAmC,CAAE;aAArCA,MAAM,GAANA;IAAsC;IAE1D,MAAM,QAAQC,MAA0C,EAAE;QACtD,MAAMC,OAAOC,WAAWF;QACxB,IAAI;YACA,MAAMG,SAAS,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAACF;YACrC,OAAOE,QAAQ,QAAQ;QAC3B,EAAE,OAAOC,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,wBACdA,GAAG,IAAI,IAAI,mBACX;gBAAE,OAAOA;gBAAIH;YAAK;QAE1B;IACJ;AACJ;AAEO,MAAMK,cAAcC,yBAAyB,oBAAoB,CAAC;IACrE,gBAAgBT;IAChB,cAAc;QAACU;KAAkB;AACrC"}
@@ -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 { CmsDdbModelEntity } from "../../abstractions/CmsDdbModelEntity.js";
4
+ declare class DdbListModelsImpl implements ListModelsStorageOperation.Interface {
5
+ private entity;
6
+ constructor(entity: CmsDdbModelEntity.Interface);
7
+ execute(params: CmsModelStorageOperationsListParams): Promise<import("@webiny/api-headless-cms/types/model.js").StorageCmsModel[]>;
8
+ }
9
+ export declare const DdbListModels: typeof DdbListModelsImpl & {
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 { CmsDdbModelEntity } from "../../abstractions/CmsDdbModelEntity.js";
4
+ import { createPartitionKey } from "./keys.js";
5
+ class DdbListModelsImpl {
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.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 DdbListModels = ListModelsStorageOperation.createImplementation({
29
+ implementation: DdbListModelsImpl,
30
+ dependencies: [
31
+ CmsDdbModelEntity
32
+ ]
33
+ });
34
+ export { DdbListModels };
35
+
36
+ //# sourceMappingURL=DdbListModels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/model/DdbListModels.js","sources":["../../../src/operations/model/DdbListModels.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 { CmsDdbModelEntity } from \"~/abstractions/CmsDdbModelEntity.js\";\nimport { createPartitionKey } from \"./keys.js\";\n\nclass DdbListModelsImpl implements ListModelsStorageOperation.Interface {\n constructor(private entity: CmsDdbModelEntity.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: { gte: \" \" }\n });\n return 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 { error: ex, partitionKey }\n );\n }\n }\n}\n\nexport const DdbListModels = ListModelsStorageOperation.createImplementation({\n implementation: DdbListModelsImpl,\n dependencies: [CmsDdbModelEntity]\n});\n"],"names":["DdbListModelsImpl","entity","params","where","partitionKey","createPartitionKey","result","item","ex","WebinyError","DdbListModels","ListModelsStorageOperation","CmsDdbModelEntity"],"mappings":";;;;AAMA,MAAMA;IACF,YAAoBC,MAAmC,CAAE;aAArCA,MAAM,GAANA;IAAsC;IAE1D,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;oBAAE,KAAK;gBAAI;YACxB;YACA,OAAOE,OAAO,GAAG,CAACC,CAAAA,OAAQA,KAAK,IAAI;QACvC,EAAE,OAAOC,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,0BACdA,GAAG,IAAI,IAAI,oBACX;gBAAE,OAAOA;gBAAIJ;YAAa;QAElC;IACJ;AACJ;AAEO,MAAMM,gBAAgBC,2BAA2B,oBAAoB,CAAC;IACzE,gBAAgBX;IAChB,cAAc;QAACY;KAAkB;AACrC"}
@@ -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 { CmsDdbModelEntity } from "../../abstractions/CmsDdbModelEntity.js";
4
+ declare class DdbUpdateModelImpl implements UpdateModelStorageOperation.Interface {
5
+ private entity;
6
+ constructor(entity: CmsDdbModelEntity.Interface);
7
+ execute(params: CmsModelStorageOperationsUpdateParams): Promise<import("@webiny/api-headless-cms/types/model.js").StorageCmsModel>;
8
+ }
9
+ export declare const DdbUpdateModel: typeof DdbUpdateModelImpl & {
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 { CmsDdbModelEntity } from "../../abstractions/CmsDdbModelEntity.js";
4
+ import { createKeys, createType } from "./keys.js";
5
+ class DdbUpdateModelImpl {
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 DdbUpdateModel = UpdateModelStorageOperation.createImplementation({
29
+ implementation: DdbUpdateModelImpl,
30
+ dependencies: [
31
+ CmsDdbModelEntity
32
+ ]
33
+ });
34
+ export { DdbUpdateModel };
35
+
36
+ //# sourceMappingURL=DdbUpdateModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/model/DdbUpdateModel.js","sources":["../../../src/operations/model/DdbUpdateModel.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 { CmsDdbModelEntity } from \"~/abstractions/CmsDdbModelEntity.js\";\nimport { createKeys, createType } from \"./keys.js\";\n\nclass DdbUpdateModelImpl implements UpdateModelStorageOperation.Interface {\n constructor(private entity: CmsDdbModelEntity.Interface) {}\n\n async execute(params: CmsModelStorageOperationsUpdateParams) {\n const { model } = params;\n const keys = createKeys(model);\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 { error: ex, model, keys }\n );\n }\n }\n}\n\nexport const DdbUpdateModel = UpdateModelStorageOperation.createImplementation({\n implementation: DdbUpdateModelImpl,\n dependencies: [CmsDdbModelEntity]\n});\n"],"names":["DdbUpdateModelImpl","entity","params","model","keys","createKeys","createType","ex","WebinyError","DdbUpdateModel","UpdateModelStorageOperation","CmsDdbModelEntity"],"mappings":";;;;AAMA,MAAMA;IACF,YAAoBC,MAAmC,CAAE;aAArCA,MAAM,GAANA;IAAsC;IAE1D,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,GAAGC,IAAI;gBACP,MAAME;YACV;YACA,OAAOH;QACX,EAAE,OAAOI,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,2BACdA,GAAG,IAAI,IAAI,sBACX;gBAAE,OAAOA;gBAAIJ;gBAAOC;YAAK;QAEjC;IACJ;AACJ;AAEO,MAAMK,iBAAiBC,4BAA4B,oBAAoB,CAAC;IAC3E,gBAAgBV;IAChB,cAAc;QAACW;KAAkB;AACrC"}
@@ -0,0 +1,4 @@
1
+ export declare const DdbModelStorageOpsFeature: {
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 { DdbGetModel } from "./DdbGetModel.js";
3
+ import { DdbListModels } from "./DdbListModels.js";
4
+ import { DdbCreateModel } from "./DdbCreateModel.js";
5
+ import { DdbUpdateModel } from "./DdbUpdateModel.js";
6
+ import { DdbDeleteModel } from "./DdbDeleteModel.js";
7
+ const DdbModelStorageOpsFeature = createFeature({
8
+ name: "cms.ddb.modelStorageOps",
9
+ register: (container)=>{
10
+ container.register(DdbGetModel);
11
+ container.register(DdbListModels);
12
+ container.register(DdbCreateModel);
13
+ container.register(DdbUpdateModel);
14
+ container.register(DdbDeleteModel);
15
+ }
16
+ });
17
+ export { DdbModelStorageOpsFeature };
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 { DdbGetModel } from \"./DdbGetModel.js\";\nimport { DdbListModels } from \"./DdbListModels.js\";\nimport { DdbCreateModel } from \"./DdbCreateModel.js\";\nimport { DdbUpdateModel } from \"./DdbUpdateModel.js\";\nimport { DdbDeleteModel } from \"./DdbDeleteModel.js\";\n\nexport const DdbModelStorageOpsFeature = createFeature({\n name: \"cms.ddb.modelStorageOps\",\n register: container => {\n container.register(DdbGetModel);\n container.register(DdbListModels);\n container.register(DdbCreateModel);\n container.register(DdbUpdateModel);\n container.register(DdbDeleteModel);\n }\n});\n"],"names":["DdbModelStorageOpsFeature","createFeature","container","DdbGetModel","DdbListModels","DdbCreateModel","DdbUpdateModel","DdbDeleteModel"],"mappings":";;;;;;AAOO,MAAMA,4BAA4BC,cAAc;IACnD,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,16 @@
1
+ import error from "@webiny/error";
2
+ const createPartitionKey = (params)=>{
3
+ const { tenant } = params;
4
+ if (!tenant) throw new error("Missing tenant variable when creating model partitionKey.");
5
+ return `T#${tenant}#CMS#CM`;
6
+ };
7
+ const createSortKey = (params)=>params.modelId;
8
+ const createKeys = (params)=>({
9
+ PK: createPartitionKey(params),
10
+ SK: createSortKey(params),
11
+ GSI_TENANT: params.tenant
12
+ });
13
+ const createType = ()=>"cms.model";
14
+ export { createKeys, createPartitionKey, createType };
15
+
16
+ //# sourceMappingURL=keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/model/keys.js","sources":["../../../src/operations/model/keys.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\n\ninterface PartitionKeysParams {\n tenant: string;\n}\n\nexport const createPartitionKey = (params: PartitionKeysParams): string => {\n const { tenant } = params;\n if (!tenant) {\n throw new WebinyError(`Missing tenant variable when creating model partitionKey.`);\n }\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 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","WebinyError","createSortKey","createKeys","createType"],"mappings":";AAMO,MAAMA,qBAAqB,CAACC;IAC/B,MAAM,EAAEC,MAAM,EAAE,GAAGD;IACnB,IAAI,CAACC,QACD,MAAM,IAAIC,MAAY;IAE1B,OAAO,CAAC,EAAE,EAAED,OAAO,OAAO,CAAC;AAC/B;AAMA,MAAME,gBAAgB,CAACH,SACZA,OAAO,OAAO;AASlB,MAAMI,aAAa,CAACJ,SAChB;QACH,IAAID,mBAAmBC;QACvB,IAAIG,cAAcH;QAClB,YAAYA,OAAO,MAAM;IAC7B;AAGG,MAAMK,aAAa,IACf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-headless-cms-ddb",
3
- "version": "6.4.5-beta.0",
3
+ "version": "6.6.0-alpha.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -26,27 +26,25 @@
26
26
  ],
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
- "@webiny/api": "6.4.5-beta.0",
30
- "@webiny/api-headless-cms": "6.4.5-beta.0",
31
- "@webiny/aws-sdk": "6.4.5-beta.0",
32
- "@webiny/db-dynamodb": "6.4.5-beta.0",
33
- "@webiny/error": "6.4.5-beta.0",
34
- "@webiny/feature": "6.4.5-beta.0",
35
- "@webiny/handler": "6.4.5-beta.0",
36
- "@webiny/handler-db": "6.4.5-beta.0",
37
- "@webiny/utils": "6.4.5-beta.0",
38
- "dataloader": "2.2.3",
39
- "dot-prop": "10.1.0",
40
- "lodash": "4.18.1"
29
+ "@webiny/api": "6.6.0-alpha.0",
30
+ "@webiny/api-headless-cms": "6.6.0-alpha.0",
31
+ "@webiny/api-headless-cms-storage": "6.6.0-alpha.0",
32
+ "@webiny/aws-sdk": "6.6.0-alpha.0",
33
+ "@webiny/db-dynamodb": "6.6.0-alpha.0",
34
+ "@webiny/db-utils": "6.6.0-alpha.0",
35
+ "@webiny/error": "6.6.0-alpha.0",
36
+ "@webiny/feature": "6.6.0-alpha.0",
37
+ "@webiny/handler": "6.6.0-alpha.0",
38
+ "@webiny/utils": "6.6.0-alpha.0",
39
+ "dataloader": "2.2.3"
41
40
  },
42
41
  "devDependencies": {
43
42
  "@types/jsonpack": "1.1.6",
44
- "@webiny/build-tools": "6.4.5-beta.0",
43
+ "@webiny/build-tools": "6.6.0-alpha.0",
45
44
  "@webiny/di": "1.0.2",
46
- "@webiny/plugins": "6.4.5-beta.0",
47
- "@webiny/project-utils": "6.4.5-beta.0",
45
+ "@webiny/project-utils": "6.6.0-alpha.0",
48
46
  "jest-dynalite": "3.6.1",
49
- "typescript": "6.0.3",
47
+ "typescript": "7.0.2",
50
48
  "vitest": "4.1.10"
51
49
  },
52
50
  "publishConfig": {
package/types.d.ts CHANGED
@@ -1,60 +1,20 @@
1
- import { type Plugin, PluginsContainer } from "@webiny/plugins/types.js";
2
- import type { CmsContext, CmsEntryStorageOperations as BaseCmsEntryStorageOperations, CmsModelField, HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations } from "@webiny/api-headless-cms/types/index.js";
3
- import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb/index.js";
4
- import type { IEntryEntity, IGroupEntity, IModelEntity } from "./definitions/types.js";
5
- import type { ITable } from "@webiny/db-dynamodb";
6
- export type { CmsContext };
7
- export type { IGroupEntity, IModelEntity, IEntryEntity };
8
- interface CmsFieldFilterValueTransformParams {
9
- /**
10
- * A field which value we are transforming.
11
- */
12
- field: Partial<CmsModelField> & Pick<CmsModelField, "id" | "storageId" | "fieldId" | "settings">;
13
- value: any;
14
- }
15
- export interface CmsFieldFilterValueTransformPlugin extends Plugin {
16
- /**
17
- * A plugin type.
18
- */
19
- type: "cms-field-filter-value-transform";
20
- /**
21
- * A field type this plugin is for.
22
- */
23
- fieldType: string;
24
- /**
25
- * Transform method which expect field definition and value to transform.
26
- */
27
- transform: (params: CmsFieldFilterValueTransformParams) => any;
28
- }
1
+ import type { CmsEntryValues, CmsModel, CmsStorageEntry } from "@webiny/api-headless-cms/types/index.js";
29
2
  export declare enum ENTITIES {
30
3
  GROUPS = "CmsGroups",
31
4
  MODELS = "CmsModels",
32
5
  ENTRIES = "CmsEntries"
33
6
  }
34
- export interface StorageOperationsFactoryParams {
35
- documentClient: DynamoDBDocument;
36
- table?: string;
37
- plugins: PluginsContainer;
38
- container: CmsContext["container"];
39
- }
40
- export interface IHeadlessCmsStorageOperationsGetEntitiesResult {
41
- groups: IGroupEntity;
42
- models: IModelEntity;
43
- entries: IEntryEntity;
44
- }
45
- export interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations {
46
- getTable: () => ITable;
47
- getEntities: () => IHeadlessCmsStorageOperationsGetEntitiesResult;
48
- }
49
- export interface StorageOperationsFactory {
50
- (params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;
51
- }
52
- export interface CmsEntryStorageOperations extends BaseCmsEntryStorageOperations {
53
- dataLoaders: IDataLoadersHandler;
54
- }
55
7
  export interface DataLoadersHandlerInterfaceClearAllParams {
56
8
  tenant: string;
57
9
  }
10
+ export interface DataLoadersHandlerDataLoaderParams {
11
+ model: Pick<CmsModel, "tenant" | "modelId">;
12
+ ids: readonly string[];
13
+ }
58
14
  export interface IDataLoadersHandler {
15
+ getAllEntryRevisions<T extends CmsEntryValues = CmsEntryValues>(params: DataLoadersHandlerDataLoaderParams): Promise<CmsStorageEntry<T>[]>;
16
+ getRevisionById<T extends CmsEntryValues = CmsEntryValues>(params: DataLoadersHandlerDataLoaderParams): Promise<CmsStorageEntry<T>[]>;
17
+ getPublishedRevisionByEntryId<T extends CmsEntryValues = CmsEntryValues>(params: DataLoadersHandlerDataLoaderParams): Promise<CmsStorageEntry<T>[]>;
18
+ getLatestRevisionByEntryId<T extends CmsEntryValues = CmsEntryValues>(params: DataLoadersHandlerDataLoaderParams): Promise<CmsStorageEntry<T>[]>;
59
19
  clearAll: (params?: DataLoadersHandlerInterfaceClearAllParams) => void;
60
20
  }
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sources":["../src/types.ts"],"sourcesContent":["import { type Plugin, PluginsContainer } from \"@webiny/plugins/types.js\";\nimport type {\n CmsContext,\n CmsEntryStorageOperations as BaseCmsEntryStorageOperations,\n CmsModelField,\n HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport type { IEntryEntity, IGroupEntity, IModelEntity } from \"~/definitions/types.js\";\nimport type { ITable } from \"@webiny/db-dynamodb\";\n\nexport type { CmsContext };\n\nexport type { IGroupEntity, IModelEntity, IEntryEntity };\n\ninterface CmsFieldFilterValueTransformParams {\n /**\n * A field which value we are transforming.\n */\n field: Partial<CmsModelField> &\n Pick<CmsModelField, \"id\" | \"storageId\" | \"fieldId\" | \"settings\">;\n value: any;\n}\n\nexport interface CmsFieldFilterValueTransformPlugin extends Plugin {\n /**\n * A plugin type.\n */\n type: \"cms-field-filter-value-transform\";\n /**\n * A field type this plugin is for.\n */\n fieldType: string;\n /**\n * Transform method which expect field definition and value to transform.\n */\n transform: (params: CmsFieldFilterValueTransformParams) => any;\n}\n\nexport enum ENTITIES {\n GROUPS = \"CmsGroups\",\n MODELS = \"CmsModels\",\n ENTRIES = \"CmsEntries\"\n}\n\nexport interface StorageOperationsFactoryParams {\n documentClient: DynamoDBDocument;\n table?: string;\n plugins: PluginsContainer;\n container: CmsContext[\"container\"];\n}\n\nexport interface IHeadlessCmsStorageOperationsGetEntitiesResult {\n groups: IGroupEntity;\n models: IModelEntity;\n entries: IEntryEntity;\n}\n\nexport interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations {\n getTable: () => ITable;\n getEntities: () => IHeadlessCmsStorageOperationsGetEntitiesResult;\n}\n\nexport interface StorageOperationsFactory {\n (params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;\n}\n\nexport interface CmsEntryStorageOperations extends BaseCmsEntryStorageOperations {\n dataLoaders: IDataLoadersHandler;\n}\n\nexport interface DataLoadersHandlerInterfaceClearAllParams {\n tenant: string;\n}\nexport interface IDataLoadersHandler {\n clearAll: (params?: DataLoadersHandlerInterfaceClearAllParams) => void;\n}\n"],"names":["ENTITIES"],"mappings":"AAuCO,IAAKA,iBAAQA,WAAAA,GAAAA,SAARA,QAAQ;;;;WAARA"}
1
+ {"version":3,"file":"types.js","sources":["../src/types.ts"],"sourcesContent":["import type {\n CmsEntryValues,\n CmsModel,\n CmsStorageEntry\n} from \"@webiny/api-headless-cms/types/index.js\";\n\nexport enum ENTITIES {\n GROUPS = \"CmsGroups\",\n MODELS = \"CmsModels\",\n ENTRIES = \"CmsEntries\"\n}\n\nexport interface DataLoadersHandlerInterfaceClearAllParams {\n tenant: string;\n}\n\nexport interface DataLoadersHandlerDataLoaderParams {\n model: Pick<CmsModel, \"tenant\" | \"modelId\">;\n ids: readonly string[];\n}\n\nexport interface IDataLoadersHandler {\n getAllEntryRevisions<T extends CmsEntryValues = CmsEntryValues>(\n params: DataLoadersHandlerDataLoaderParams\n ): Promise<CmsStorageEntry<T>[]>;\n getRevisionById<T extends CmsEntryValues = CmsEntryValues>(\n params: DataLoadersHandlerDataLoaderParams\n ): Promise<CmsStorageEntry<T>[]>;\n getPublishedRevisionByEntryId<T extends CmsEntryValues = CmsEntryValues>(\n params: DataLoadersHandlerDataLoaderParams\n ): Promise<CmsStorageEntry<T>[]>;\n getLatestRevisionByEntryId<T extends CmsEntryValues = CmsEntryValues>(\n params: DataLoadersHandlerDataLoaderParams\n ): Promise<CmsStorageEntry<T>[]>;\n clearAll: (params?: DataLoadersHandlerInterfaceClearAllParams) => void;\n}\n"],"names":["ENTITIES"],"mappings":"AAMO,IAAKA,iBAAQA,WAAAA,GAAAA,SAARA,QAAQ;;;;WAARA"}
@@ -1,2 +0,0 @@
1
- declare const _default: () => (import("../index.js").CmsEntryFieldFilterPathPlugin | import("../types.js").CmsFieldFilterValueTransformPlugin)[];
2
- export default _default;
package/dynamoDb/index.js DELETED
@@ -1,11 +0,0 @@
1
- import { createPlainObjectPathPlugin } from "./path/plainObject.js";
2
- import { createDatetimeTransformValuePlugin } from "./transformValue/datetime.js";
3
- import { createLocationFolderIdPathPlugin } from "./path/locationFolderId.js";
4
- const dynamoDb = ()=>[
5
- createPlainObjectPathPlugin(),
6
- createLocationFolderIdPathPlugin(),
7
- createDatetimeTransformValuePlugin()
8
- ];
9
- export default dynamoDb;
10
-
11
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dynamoDb/index.js","sources":["../../src/dynamoDb/index.ts"],"sourcesContent":["import { createPlainObjectPathPlugin } from \"./path/plainObject.js\";\nimport { createDatetimeTransformValuePlugin } from \"./transformValue/datetime.js\";\nimport { createLocationFolderIdPathPlugin } from \"~/dynamoDb/path/locationFolderId.js\";\n\nexport default () => [\n createPlainObjectPathPlugin(),\n createLocationFolderIdPathPlugin(),\n createDatetimeTransformValuePlugin()\n];\n"],"names":["createPlainObjectPathPlugin","createLocationFolderIdPathPlugin","createDatetimeTransformValuePlugin"],"mappings":";;;AAIA,iBAAgB,IAAK;QACjBA;QACAC;QACAC;KACJ"}
@@ -1,2 +0,0 @@
1
- import { CmsEntryFieldFilterPathPlugin } from "../../plugins/CmsEntryFieldFilterPathPlugin.js";
2
- export declare const createLocationFolderIdPathPlugin: () => CmsEntryFieldFilterPathPlugin;
@@ -1,21 +0,0 @@
1
- import error from "@webiny/error";
2
- import { CmsEntryFieldFilterPathPlugin } from "../../plugins/CmsEntryFieldFilterPathPlugin.js";
3
- const createPath = ({ field })=>{
4
- const { path } = field.settings || {};
5
- if (!path) throw new error("Missing path settings value.", "FIELD_SETTINGS_ERROR", {
6
- field
7
- });
8
- return path;
9
- };
10
- const createLocationFolderIdPathPlugin = ()=>new CmsEntryFieldFilterPathPlugin({
11
- fieldType: "text",
12
- path: createPath,
13
- canUse: (field, parents)=>{
14
- if ("folderId" !== field.fieldId) return false;
15
- if (!parents?.length) return false;
16
- return "wbyAco_location" === parents[0];
17
- }
18
- });
19
- export { createLocationFolderIdPathPlugin };
20
-
21
- //# sourceMappingURL=locationFolderId.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dynamoDb/path/locationFolderId.js","sources":["../../../src/dynamoDb/path/locationFolderId.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport WebinyError from \"@webiny/error\";\nimport type { CreatePathCallable } from \"~/plugins/CmsEntryFieldFilterPathPlugin.js\";\nimport { CmsEntryFieldFilterPathPlugin } from \"~/plugins/CmsEntryFieldFilterPathPlugin.js\";\n\nconst createPath: CreatePathCallable = ({ field }) => {\n const { path } = field.settings || {};\n if (!path) {\n throw new WebinyError(\"Missing path settings value.\", \"FIELD_SETTINGS_ERROR\", {\n field\n });\n }\n return path;\n};\n\nexport const createLocationFolderIdPathPlugin = (): CmsEntryFieldFilterPathPlugin => {\n return new CmsEntryFieldFilterPathPlugin({\n fieldType: \"text\",\n path: createPath,\n canUse: (field, parents) => {\n if (field.fieldId !== \"folderId\") {\n return false;\n } else if (!parents?.length) {\n return false;\n }\n return parents[0] === \"wbyAco_location\";\n }\n });\n};\n"],"names":["createPath","field","path","WebinyError","createLocationFolderIdPathPlugin","CmsEntryFieldFilterPathPlugin","parents"],"mappings":";;AAOA,MAAMA,aAAiC,CAAC,EAAEC,KAAK,EAAE;IAC7C,MAAM,EAAEC,IAAI,EAAE,GAAGD,MAAM,QAAQ,IAAI,CAAC;IACpC,IAAI,CAACC,MACD,MAAM,IAAIC,MAAY,gCAAgC,wBAAwB;QAC1EF;IACJ;IAEJ,OAAOC;AACX;AAEO,MAAME,mCAAmC,IACrC,IAAIC,8BAA8B;QACrC,WAAW;QACX,MAAML;QACN,QAAQ,CAACC,OAAOK;YACZ,IAAIL,AAAkB,eAAlBA,MAAM,OAAO,EACb,OAAO;YACJ,IAAI,CAACK,SAAS,QACjB,OAAO;YAEX,OAAOA,AAAe,sBAAfA,OAAO,CAAC,EAAE;QACrB;IACJ"}
@@ -1,2 +0,0 @@
1
- import { CmsEntryFieldFilterPathPlugin } from "../../plugins/CmsEntryFieldFilterPathPlugin.js";
2
- export declare const createPlainObjectPathPlugin: () => CmsEntryFieldFilterPathPlugin;
@@ -1,16 +0,0 @@
1
- import error from "@webiny/error";
2
- import { CmsEntryFieldFilterPathPlugin } from "../../plugins/CmsEntryFieldFilterPathPlugin.js";
3
- const createPath = ({ field })=>{
4
- const { path } = field.settings || {};
5
- if (!path) throw new error("Missing path settings value.", "FIELD_SETTINGS_ERROR", {
6
- field
7
- });
8
- return path;
9
- };
10
- const createPlainObjectPathPlugin = ()=>new CmsEntryFieldFilterPathPlugin({
11
- fieldType: "plainObject",
12
- path: createPath
13
- });
14
- export { createPlainObjectPathPlugin };
15
-
16
- //# sourceMappingURL=plainObject.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dynamoDb/path/plainObject.js","sources":["../../../src/dynamoDb/path/plainObject.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport WebinyError from \"@webiny/error\";\nimport type { CreatePathCallable } from \"~/plugins/CmsEntryFieldFilterPathPlugin.js\";\nimport { CmsEntryFieldFilterPathPlugin } from \"~/plugins/CmsEntryFieldFilterPathPlugin.js\";\n\nconst createPath: CreatePathCallable = ({ field }) => {\n const { path } = field.settings || {};\n if (!path) {\n throw new WebinyError(\"Missing path settings value.\", \"FIELD_SETTINGS_ERROR\", {\n field\n });\n }\n return path;\n};\n\nexport const createPlainObjectPathPlugin = (): CmsEntryFieldFilterPathPlugin => {\n return new CmsEntryFieldFilterPathPlugin({\n fieldType: \"plainObject\",\n path: createPath\n });\n};\n"],"names":["createPath","field","path","WebinyError","createPlainObjectPathPlugin","CmsEntryFieldFilterPathPlugin"],"mappings":";;AAOA,MAAMA,aAAiC,CAAC,EAAEC,KAAK,EAAE;IAC7C,MAAM,EAAEC,IAAI,EAAE,GAAGD,MAAM,QAAQ,IAAI,CAAC;IACpC,IAAI,CAACC,MACD,MAAM,IAAIC,MAAY,gCAAgC,wBAAwB;QAC1EF;IACJ;IAEJ,OAAOC;AACX;AAEO,MAAME,8BAA8B,IAChC,IAAIC,8BAA8B;QACrC,WAAW;QACX,MAAML;IACV"}
@@ -1,5 +0,0 @@
1
- /**
2
- * File is @internal
3
- */
4
- import type { CmsFieldFilterValueTransformPlugin } from "../../types.js";
5
- export declare const createDatetimeTransformValuePlugin: () => CmsFieldFilterValueTransformPlugin;
@@ -1,29 +0,0 @@
1
- import { TimeTransformPlugin } from "@webiny/db-dynamodb/plugins/definitions/TimeTransformPlugin.js";
2
- import { DateTimeTransformPlugin } from "@webiny/db-dynamodb/plugins/definitions/DateTimeTransformPlugin.js";
3
- const timeTransformer = new TimeTransformPlugin({
4
- fields: [
5
- "*"
6
- ]
7
- });
8
- const dateTimeTransformer = new DateTimeTransformPlugin({
9
- fields: [
10
- "*"
11
- ]
12
- });
13
- const createDatetimeTransformValuePlugin = ()=>({
14
- type: "cms-field-filter-value-transform",
15
- name: "cms-field-value-filter-transform-datetime",
16
- fieldType: "datetime",
17
- transform: ({ field, value })=>{
18
- const { type } = field.settings || {};
19
- if ("time" === type) return timeTransformer.transform({
20
- value
21
- });
22
- return dateTimeTransformer.transform({
23
- value
24
- });
25
- }
26
- });
27
- export { createDatetimeTransformValuePlugin };
28
-
29
- //# sourceMappingURL=datetime.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dynamoDb/transformValue/datetime.js","sources":["../../../src/dynamoDb/transformValue/datetime.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport type { CmsFieldFilterValueTransformPlugin } from \"~/types.js\";\nimport { TimeTransformPlugin } from \"@webiny/db-dynamodb/plugins/definitions/TimeTransformPlugin.js\";\nimport { DateTimeTransformPlugin } from \"@webiny/db-dynamodb/plugins/definitions/DateTimeTransformPlugin.js\";\n\nconst timeTransformer = new TimeTransformPlugin({\n fields: [\"*\"]\n});\nconst dateTimeTransformer = new DateTimeTransformPlugin({\n fields: [\"*\"]\n});\n\nexport const createDatetimeTransformValuePlugin = (): CmsFieldFilterValueTransformPlugin => {\n return {\n type: \"cms-field-filter-value-transform\",\n name: \"cms-field-value-filter-transform-datetime\",\n fieldType: \"datetime\",\n /**\n * Always transform into the milliseconds.\n */\n transform: ({ field, value }) => {\n const { type } = field.settings || {};\n if (type === \"time\") {\n return timeTransformer.transform({\n value\n });\n }\n return dateTimeTransformer.transform({\n value\n });\n }\n };\n};\n"],"names":["timeTransformer","TimeTransformPlugin","dateTimeTransformer","DateTimeTransformPlugin","createDatetimeTransformValuePlugin","field","value","type"],"mappings":";;AAOA,MAAMA,kBAAkB,IAAIC,oBAAoB;IAC5C,QAAQ;QAAC;KAAI;AACjB;AACA,MAAMC,sBAAsB,IAAIC,wBAAwB;IACpD,QAAQ;QAAC;KAAI;AACjB;AAEO,MAAMC,qCAAqC,IACvC;QACH,MAAM;QACN,MAAM;QACN,WAAW;QAIX,WAAW,CAAC,EAAEC,KAAK,EAAEC,KAAK,EAAE;YACxB,MAAM,EAAEC,IAAI,EAAE,GAAGF,MAAM,QAAQ,IAAI,CAAC;YACpC,IAAIE,AAAS,WAATA,MACA,OAAOP,gBAAgB,SAAS,CAAC;gBAC7BM;YACJ;YAEJ,OAAOJ,oBAAoB,SAAS,CAAC;gBACjCI;YACJ;QACJ;IACJ"}
@@ -1,27 +0,0 @@
1
- import type { CmsContext, CmsEntryListWhere } from "@webiny/api-headless-cms/types/index.js";
2
- import type { PluginsContainer } from "@webiny/plugins";
3
- import type { Field } from "./types.js";
4
- import { ValueFilter } from "@webiny/db-dynamodb/feature/ValueFilter/index.js";
5
- interface ICreateExpressionsParams {
6
- plugins: PluginsContainer;
7
- container: CmsContext["container"];
8
- where: Partial<CmsEntryListWhere>;
9
- fields: Record<string, Field>;
10
- }
11
- export type ExpressionCondition = "AND" | "OR";
12
- export interface Expression {
13
- expressions: Expression[];
14
- filters: Filter[];
15
- condition: ExpressionCondition;
16
- }
17
- export interface Filter {
18
- field: Field;
19
- path: string;
20
- fieldPathId: string;
21
- filter: ValueFilter.Interface;
22
- negate: boolean;
23
- compareValue: any;
24
- transformValue: <I = any, O = any>(value: I) => O;
25
- }
26
- export declare const createExpressions: (params: ICreateExpressionsParams) => Expression;
27
- export {};