@webiny/api-headless-cms-ddb 0.0.0-unstable.df7a8bb475 → 0.0.0-unstable.e1999482d0

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 (272) 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 +11 -5
  25. package/definitions/types.js +0 -3
  26. package/index.d.ts +10 -3
  27. package/index.js +40 -85
  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 +30 -0
  75. package/operations/entry/DdbListEntries.js +133 -0
  76. package/operations/entry/DdbListEntries.js.map +1 -0
  77. package/operations/entry/DdbMoveEntry.d.ts +16 -0
  78. package/operations/entry/DdbMoveEntry.js +63 -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.d.ts +1 -0
  96. package/operations/entry/dataLoader/DataLoaderCache.js +22 -29
  97. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
  98. package/operations/entry/dataLoader/constants.js +2 -1
  99. package/operations/entry/dataLoader/constants.js.map +1 -1
  100. package/operations/entry/dataLoader/createBatchScheduleFn.js +6 -15
  101. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
  102. package/operations/entry/dataLoader/getAllEntryRevisions.js +18 -26
  103. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
  104. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +32 -38
  105. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
  106. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +32 -38
  107. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
  108. package/operations/entry/dataLoader/getRevisionById.js +34 -44
  109. package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
  110. package/operations/entry/dataLoader/index.js +8 -9
  111. package/operations/entry/dataLoader/index.js.map +1 -1
  112. package/operations/entry/dataLoader/types.d.ts +1 -0
  113. package/operations/entry/dataLoader/types.js +0 -3
  114. package/operations/entry/dataLoaders.d.ts +7 -6
  115. package/operations/entry/dataLoaders.js +89 -97
  116. package/operations/entry/dataLoaders.js.map +1 -1
  117. package/operations/entry/feature.d.ts +4 -0
  118. package/operations/entry/feature.js +55 -0
  119. package/operations/entry/feature.js.map +1 -0
  120. package/operations/entry/keys.d.ts +6 -0
  121. package/operations/entry/keys.js +57 -77
  122. package/operations/entry/keys.js.map +1 -1
  123. package/operations/entry/storageEntryUtils.d.ts +8 -0
  124. package/operations/entry/storageEntryUtils.js +25 -0
  125. package/operations/entry/storageEntryUtils.js.map +1 -0
  126. package/operations/group/DdbCreateGroup.d.ts +12 -0
  127. package/operations/group/DdbCreateGroup.js +35 -0
  128. package/operations/group/DdbCreateGroup.js.map +1 -0
  129. package/operations/group/DdbDeleteGroup.d.ts +12 -0
  130. package/operations/group/DdbDeleteGroup.js +31 -0
  131. package/operations/group/DdbDeleteGroup.js.map +1 -0
  132. package/operations/group/DdbGetGroup.d.ts +12 -0
  133. package/operations/group/DdbGetGroup.js +31 -0
  134. package/operations/group/DdbGetGroup.js.map +1 -0
  135. package/operations/group/DdbListGroups.d.ts +14 -0
  136. package/operations/group/DdbListGroups.js +52 -0
  137. package/operations/group/DdbListGroups.js.map +1 -0
  138. package/operations/group/DdbUpdateGroup.d.ts +12 -0
  139. package/operations/group/DdbUpdateGroup.js +35 -0
  140. package/operations/group/DdbUpdateGroup.js.map +1 -0
  141. package/operations/group/feature.d.ts +4 -0
  142. package/operations/group/feature.js +19 -0
  143. package/operations/group/feature.js.map +1 -0
  144. package/operations/group/keys.d.ts +15 -0
  145. package/operations/group/keys.js +17 -0
  146. package/operations/group/keys.js.map +1 -0
  147. package/operations/model/DdbCreateModel.d.ts +12 -0
  148. package/operations/model/DdbCreateModel.js +37 -0
  149. package/operations/model/DdbCreateModel.js.map +1 -0
  150. package/operations/model/DdbDeleteModel.d.ts +12 -0
  151. package/operations/model/DdbDeleteModel.js +31 -0
  152. package/operations/model/DdbDeleteModel.js.map +1 -0
  153. package/operations/model/DdbGetModel.d.ts +12 -0
  154. package/operations/model/DdbGetModel.js +30 -0
  155. package/operations/model/DdbGetModel.js.map +1 -0
  156. package/operations/model/DdbListModels.d.ts +12 -0
  157. package/operations/model/DdbListModels.js +36 -0
  158. package/operations/model/DdbListModels.js.map +1 -0
  159. package/operations/model/DdbUpdateModel.d.ts +12 -0
  160. package/operations/model/DdbUpdateModel.js +36 -0
  161. package/operations/model/DdbUpdateModel.js.map +1 -0
  162. package/operations/model/feature.d.ts +4 -0
  163. package/operations/model/feature.js +19 -0
  164. package/operations/model/feature.js.map +1 -0
  165. package/operations/model/keys.d.ts +15 -0
  166. package/operations/model/keys.js +16 -0
  167. package/operations/model/keys.js.map +1 -0
  168. package/package.json +26 -22
  169. package/types.d.ts +10 -48
  170. package/types.js +6 -5
  171. package/types.js.map +1 -1
  172. package/definitions/types.js.map +0 -1
  173. package/dynamoDb/index.d.ts +0 -2
  174. package/dynamoDb/index.js +0 -8
  175. package/dynamoDb/index.js.map +0 -1
  176. package/dynamoDb/path/locationFolderId.d.ts +0 -2
  177. package/dynamoDb/path/locationFolderId.js +0 -34
  178. package/dynamoDb/path/locationFolderId.js.map +0 -1
  179. package/dynamoDb/path/plainObject.d.ts +0 -2
  180. package/dynamoDb/path/plainObject.js +0 -26
  181. package/dynamoDb/path/plainObject.js.map +0 -1
  182. package/dynamoDb/storage/longText.d.ts +0 -10
  183. package/dynamoDb/storage/longText.js +0 -86
  184. package/dynamoDb/storage/longText.js.map +0 -1
  185. package/dynamoDb/storage/richText.d.ts +0 -2
  186. package/dynamoDb/storage/richText.js +0 -52
  187. package/dynamoDb/storage/richText.js.map +0 -1
  188. package/dynamoDb/transformValue/datetime.d.ts +0 -5
  189. package/dynamoDb/transformValue/datetime.js +0 -40
  190. package/dynamoDb/transformValue/datetime.js.map +0 -1
  191. package/operations/entry/dataLoader/types.js.map +0 -1
  192. package/operations/entry/filtering/createExpressions.d.ts +0 -26
  193. package/operations/entry/filtering/createExpressions.js +0 -175
  194. package/operations/entry/filtering/createExpressions.js.map +0 -1
  195. package/operations/entry/filtering/createFields.d.ts +0 -16
  196. package/operations/entry/filtering/createFields.js +0 -106
  197. package/operations/entry/filtering/createFields.js.map +0 -1
  198. package/operations/entry/filtering/extractSort.d.ts +0 -17
  199. package/operations/entry/filtering/extractSort.js +0 -84
  200. package/operations/entry/filtering/extractSort.js.map +0 -1
  201. package/operations/entry/filtering/filter.d.ts +0 -15
  202. package/operations/entry/filtering/filter.js +0 -150
  203. package/operations/entry/filtering/filter.js.map +0 -1
  204. package/operations/entry/filtering/fullTextSearch.d.ts +0 -14
  205. package/operations/entry/filtering/fullTextSearch.js +0 -42
  206. package/operations/entry/filtering/fullTextSearch.js.map +0 -1
  207. package/operations/entry/filtering/getValue.d.ts +0 -5
  208. package/operations/entry/filtering/getValue.js +0 -59
  209. package/operations/entry/filtering/getValue.js.map +0 -1
  210. package/operations/entry/filtering/index.d.ts +0 -2
  211. package/operations/entry/filtering/index.js +0 -4
  212. package/operations/entry/filtering/index.js.map +0 -1
  213. package/operations/entry/filtering/mapPlugins.d.ts +0 -8
  214. package/operations/entry/filtering/mapPlugins.js +0 -25
  215. package/operations/entry/filtering/mapPlugins.js.map +0 -1
  216. package/operations/entry/filtering/plugins/defaultFilterCreate.d.ts +0 -2
  217. package/operations/entry/filtering/plugins/defaultFilterCreate.js +0 -37
  218. package/operations/entry/filtering/plugins/defaultFilterCreate.js.map +0 -1
  219. package/operations/entry/filtering/plugins/index.d.ts +0 -1
  220. package/operations/entry/filtering/plugins/index.js +0 -9
  221. package/operations/entry/filtering/plugins/index.js.map +0 -1
  222. package/operations/entry/filtering/plugins/objectFilterCreate.d.ts +0 -2
  223. package/operations/entry/filtering/plugins/objectFilterCreate.js +0 -84
  224. package/operations/entry/filtering/plugins/objectFilterCreate.js.map +0 -1
  225. package/operations/entry/filtering/plugins/refFilterCreate.d.ts +0 -3
  226. package/operations/entry/filtering/plugins/refFilterCreate.js +0 -74
  227. package/operations/entry/filtering/plugins/refFilterCreate.js.map +0 -1
  228. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.d.ts +0 -2
  229. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js +0 -57
  230. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js.map +0 -1
  231. package/operations/entry/filtering/sort.d.ts +0 -12
  232. package/operations/entry/filtering/sort.js +0 -67
  233. package/operations/entry/filtering/sort.js.map +0 -1
  234. package/operations/entry/filtering/systemFields.d.ts +0 -2
  235. package/operations/entry/filtering/systemFields.js +0 -116
  236. package/operations/entry/filtering/systemFields.js.map +0 -1
  237. package/operations/entry/filtering/transform.d.ts +0 -6
  238. package/operations/entry/filtering/transform.js +0 -11
  239. package/operations/entry/filtering/transform.js.map +0 -1
  240. package/operations/entry/filtering/types.d.ts +0 -40
  241. package/operations/entry/filtering/types.js +0 -3
  242. package/operations/entry/filtering/types.js.map +0 -1
  243. package/operations/entry/filtering/values.d.ts +0 -2
  244. package/operations/entry/filtering/values.js +0 -16
  245. package/operations/entry/filtering/values.js.map +0 -1
  246. package/operations/entry/filtering/where.d.ts +0 -5
  247. package/operations/entry/filtering/where.js +0 -28
  248. package/operations/entry/filtering/where.js.map +0 -1
  249. package/operations/entry/index.d.ts +0 -7
  250. package/operations/entry/index.js +0 -1196
  251. package/operations/entry/index.js.map +0 -1
  252. package/operations/group/index.d.ts +0 -9
  253. package/operations/group/index.js +0 -145
  254. package/operations/group/index.js.map +0 -1
  255. package/operations/model/index.d.ts +0 -7
  256. package/operations/model/index.js +0 -128
  257. package/operations/model/index.js.map +0 -1
  258. package/plugins/CmsEntryFieldFilterPathPlugin.d.ts +0 -23
  259. package/plugins/CmsEntryFieldFilterPathPlugin.js +0 -40
  260. package/plugins/CmsEntryFieldFilterPathPlugin.js.map +0 -1
  261. package/plugins/CmsEntryFieldFilterPlugin.d.ts +0 -43
  262. package/plugins/CmsEntryFieldFilterPlugin.js +0 -21
  263. package/plugins/CmsEntryFieldFilterPlugin.js.map +0 -1
  264. package/plugins/CmsEntryFieldSortingPlugin.d.ts +0 -42
  265. package/plugins/CmsEntryFieldSortingPlugin.js +0 -19
  266. package/plugins/CmsEntryFieldSortingPlugin.js.map +0 -1
  267. package/plugins/CmsFieldFilterValueTransformPlugin.d.ts +0 -11
  268. package/plugins/CmsFieldFilterValueTransformPlugin.js +0 -16
  269. package/plugins/CmsFieldFilterValueTransformPlugin.js.map +0 -1
  270. package/plugins/index.d.ts +0 -4
  271. package/plugins/index.js +0 -6
  272. package/plugins/index.js.map +0 -1
@@ -1,52 +1,42 @@
1
- import DataLoader from "dataloader";
1
+ import dataloader from "dataloader";
2
2
  import { cleanupItems } from "@webiny/db-dynamodb/utils/cleanup.js";
3
3
  import { createPartitionKey, createRevisionSortKey } from "../keys.js";
4
4
  import { parseIdentifier } from "@webiny/utils";
5
5
  import { createBatchScheduleFn } from "./createBatchScheduleFn.js";
6
- export const createGetRevisionById = params => {
7
- const {
8
- entity,
9
- tenant
10
- } = params;
11
- return new DataLoader(async ids => {
12
- const reader = entity.createEntityReader();
13
- const keys = new Set();
14
- for (const id of ids) {
15
- const partitionKey = createPartitionKey({
16
- tenant,
17
- id
18
- });
19
- const {
20
- version
21
- } = parseIdentifier(id);
22
- if (version === null) {
23
- continue;
24
- }
25
- const sortKey = createRevisionSortKey({
26
- version
27
- });
28
- const key = `${partitionKey}__${sortKey}`;
29
- if (keys.has(key)) {
30
- continue;
31
- }
32
- keys.add(key);
33
- reader.get({
34
- PK: partitionKey,
35
- SK: sortKey
36
- });
37
- }
38
- const records = await reader.execute();
39
- const items = cleanupItems(entity.entity, records).map(item => {
40
- return item.data;
6
+ const createGetRevisionById = (params)=>{
7
+ const { entity, tenant, modelId } = params;
8
+ return new dataloader(async (ids)=>{
9
+ const reader = entity.createEntityReader();
10
+ const keys = new Set();
11
+ for (const id of ids){
12
+ const partitionKey = createPartitionKey({
13
+ tenant,
14
+ id
15
+ });
16
+ const { version } = parseIdentifier(id);
17
+ if (null === version) continue;
18
+ const sortKey = createRevisionSortKey({
19
+ version
20
+ });
21
+ const key = `${partitionKey}__${sortKey}`;
22
+ if (!keys.has(key)) {
23
+ keys.add(key);
24
+ reader.get({
25
+ PK: partitionKey,
26
+ SK: sortKey
27
+ });
28
+ }
29
+ }
30
+ const records = await reader.execute();
31
+ const items = cleanupItems(entity.entity, records).map((item)=>item.data);
32
+ return ids.map((id)=>items.filter((item)=>{
33
+ if (item.modelId !== modelId) return false;
34
+ return id === item.id;
35
+ }));
36
+ }, {
37
+ batchScheduleFn: createBatchScheduleFn()
41
38
  });
42
- return ids.map(id => {
43
- return items.filter(item => {
44
- return id === item.id;
45
- });
46
- });
47
- }, {
48
- batchScheduleFn: createBatchScheduleFn()
49
- });
50
39
  };
40
+ export { createGetRevisionById };
51
41
 
52
42
  //# sourceMappingURL=getRevisionById.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["DataLoader","cleanupItems","createPartitionKey","createRevisionSortKey","parseIdentifier","createBatchScheduleFn","createGetRevisionById","params","entity","tenant","ids","reader","createEntityReader","keys","Set","id","partitionKey","version","sortKey","key","has","add","get","PK","SK","records","execute","items","map","item","data","filter","batchScheduleFn"],"sources":["getRevisionById.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\nimport type { CmsStorageEntry } from \"@webiny/api-headless-cms/types/index.js\";\nimport { cleanupItems } from \"@webiny/db-dynamodb/utils/cleanup.js\";\nimport { createPartitionKey, createRevisionSortKey } from \"~/operations/entry/keys.js\";\nimport type { IDataLoaderParams } from \"./types.js\";\nimport { parseIdentifier } from \"@webiny/utils\";\nimport { createBatchScheduleFn } from \"./createBatchScheduleFn.js\";\n\nexport const createGetRevisionById = (params: IDataLoaderParams) => {\n const { entity, tenant } = params;\n\n return new DataLoader<string, CmsStorageEntry[]>(\n async ids => {\n const reader = entity.createEntityReader();\n\n const keys = new Set<string>();\n\n for (const id of ids) {\n const partitionKey = createPartitionKey({\n tenant,\n id\n });\n const { version } = parseIdentifier(id);\n if (version === null) {\n continue;\n }\n const sortKey = createRevisionSortKey({\n version\n });\n const key = `${partitionKey}__${sortKey}`;\n if (keys.has(key)) {\n continue;\n }\n keys.add(key);\n\n reader.get({\n PK: partitionKey,\n SK: sortKey\n });\n }\n\n const records = await reader.execute();\n const items = cleanupItems(entity.entity, records).map(item => {\n return item.data;\n });\n\n return ids.map(id => {\n return items.filter(item => {\n return id === item.id;\n });\n });\n },\n {\n batchScheduleFn: createBatchScheduleFn()\n }\n );\n};\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,YAAY;AAEnC,SAASC,YAAY,QAAQ,sCAAsC;AACnE,SAASC,kBAAkB,EAAEC,qBAAqB;AAElD,SAASC,eAAe,QAAQ,eAAe;AAC/C,SAASC,qBAAqB;AAE9B,OAAO,MAAMC,qBAAqB,GAAIC,MAAyB,IAAK;EAChE,MAAM;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGF,MAAM;EAEjC,OAAO,IAAIP,UAAU,CACjB,MAAMU,GAAG,IAAI;IACT,MAAMC,MAAM,GAAGH,MAAM,CAACI,kBAAkB,CAAC,CAAC;IAE1C,MAAMC,IAAI,GAAG,IAAIC,GAAG,CAAS,CAAC;IAE9B,KAAK,MAAMC,EAAE,IAAIL,GAAG,EAAE;MAClB,MAAMM,YAAY,GAAGd,kBAAkB,CAAC;QACpCO,MAAM;QACNM;MACJ,CAAC,CAAC;MACF,MAAM;QAAEE;MAAQ,CAAC,GAAGb,eAAe,CAACW,EAAE,CAAC;MACvC,IAAIE,OAAO,KAAK,IAAI,EAAE;QAClB;MACJ;MACA,MAAMC,OAAO,GAAGf,qBAAqB,CAAC;QAClCc;MACJ,CAAC,CAAC;MACF,MAAME,GAAG,GAAG,GAAGH,YAAY,KAAKE,OAAO,EAAE;MACzC,IAAIL,IAAI,CAACO,GAAG,CAACD,GAAG,CAAC,EAAE;QACf;MACJ;MACAN,IAAI,CAACQ,GAAG,CAACF,GAAG,CAAC;MAEbR,MAAM,CAACW,GAAG,CAAC;QACPC,EAAE,EAAEP,YAAY;QAChBQ,EAAE,EAAEN;MACR,CAAC,CAAC;IACN;IAEA,MAAMO,OAAO,GAAG,MAAMd,MAAM,CAACe,OAAO,CAAC,CAAC;IACtC,MAAMC,KAAK,GAAG1B,YAAY,CAACO,MAAM,CAACA,MAAM,EAAEiB,OAAO,CAAC,CAACG,GAAG,CAACC,IAAI,IAAI;MAC3D,OAAOA,IAAI,CAACC,IAAI;IACpB,CAAC,CAAC;IAEF,OAAOpB,GAAG,CAACkB,GAAG,CAACb,EAAE,IAAI;MACjB,OAAOY,KAAK,CAACI,MAAM,CAACF,IAAI,IAAI;QACxB,OAAOd,EAAE,KAAKc,IAAI,CAACd,EAAE;MACzB,CAAC,CAAC;IACN,CAAC,CAAC;EACN,CAAC,EACD;IACIiB,eAAe,EAAE3B,qBAAqB,CAAC;EAC3C,CACJ,CAAC;AACL,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"operations/entry/dataLoader/getRevisionById.js","sources":["../../../../src/operations/entry/dataLoader/getRevisionById.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\nimport type { CmsStorageEntry } from \"@webiny/api-headless-cms/types/index.js\";\nimport { cleanupItems } from \"@webiny/db-dynamodb/utils/cleanup.js\";\nimport { createPartitionKey, createRevisionSortKey } from \"~/operations/entry/keys.js\";\nimport type { IDataLoaderParams } from \"./types.js\";\nimport { parseIdentifier } from \"@webiny/utils\";\nimport { createBatchScheduleFn } from \"./createBatchScheduleFn.js\";\n\nexport const createGetRevisionById = (params: IDataLoaderParams) => {\n const { entity, tenant, modelId } = params;\n\n return new DataLoader<string, CmsStorageEntry[]>(\n async ids => {\n const reader = entity.createEntityReader();\n\n const keys = new Set<string>();\n\n for (const id of ids) {\n const partitionKey = createPartitionKey({\n tenant,\n id\n });\n const { version } = parseIdentifier(id);\n if (version === null) {\n continue;\n }\n const sortKey = createRevisionSortKey({\n version\n });\n const key = `${partitionKey}__${sortKey}`;\n if (keys.has(key)) {\n continue;\n }\n keys.add(key);\n\n reader.get({\n PK: partitionKey,\n SK: sortKey\n });\n }\n\n const records = await reader.execute();\n const items = cleanupItems(entity.entity, records).map(item => {\n return item.data;\n });\n\n return ids.map(id => {\n return items.filter(item => {\n if (item.modelId !== modelId) {\n return false;\n }\n return id === item.id;\n });\n });\n },\n {\n batchScheduleFn: createBatchScheduleFn()\n }\n );\n};\n"],"names":["createGetRevisionById","params","entity","tenant","modelId","DataLoader","ids","reader","keys","Set","id","partitionKey","createPartitionKey","version","parseIdentifier","sortKey","createRevisionSortKey","key","records","items","cleanupItems","item","createBatchScheduleFn"],"mappings":";;;;;AAQO,MAAMA,wBAAwB,CAACC;IAClC,MAAM,EAAEC,MAAM,EAAEC,MAAM,EAAEC,OAAO,EAAE,GAAGH;IAEpC,OAAO,IAAII,WACP,OAAMC;QACF,MAAMC,SAASL,OAAO,kBAAkB;QAExC,MAAMM,OAAO,IAAIC;QAEjB,KAAK,MAAMC,MAAMJ,IAAK;YAClB,MAAMK,eAAeC,mBAAmB;gBACpCT;gBACAO;YACJ;YACA,MAAM,EAAEG,OAAO,EAAE,GAAGC,gBAAgBJ;YACpC,IAAIG,AAAY,SAAZA,SACA;YAEJ,MAAME,UAAUC,sBAAsB;gBAClCH;YACJ;YACA,MAAMI,MAAM,GAAGN,aAAa,EAAE,EAAEI,SAAS;YACzC,KAAIP,KAAK,GAAG,CAACS;gBAGbT,KAAK,GAAG,CAACS;gBAETV,OAAO,GAAG,CAAC;oBACP,IAAII;oBACJ,IAAII;gBACR;;QACJ;QAEA,MAAMG,UAAU,MAAMX,OAAO,OAAO;QACpC,MAAMY,QAAQC,aAAalB,OAAO,MAAM,EAAEgB,SAAS,GAAG,CAACG,CAAAA,OAC5CA,KAAK,IAAI;QAGpB,OAAOf,IAAI,GAAG,CAACI,CAAAA,KACJS,MAAM,MAAM,CAACE,CAAAA;gBAChB,IAAIA,KAAK,OAAO,KAAKjB,SACjB,OAAO;gBAEX,OAAOM,OAAOW,KAAK,EAAE;YACzB;IAER,GACA;QACI,iBAAiBC;IACrB;AAER"}
@@ -4,16 +4,15 @@ import { createGetPublishedRevisionByEntryId } from "./getPublishedRevisionByEnt
4
4
  import { createGetRevisionById } from "./getRevisionById.js";
5
5
  export * from "./DataLoaderCache.js";
6
6
  const dataLoaders = {
7
- getAllEntryRevisions: createGetAllEntryRevisions,
8
- getLatestRevisionByEntryId: createGetLatestRevisionByEntryId,
9
- getPublishedRevisionByEntryId: createGetPublishedRevisionByEntryId,
10
- getRevisionById: createGetRevisionById
7
+ getAllEntryRevisions: createGetAllEntryRevisions,
8
+ getLatestRevisionByEntryId: createGetLatestRevisionByEntryId,
9
+ getPublishedRevisionByEntryId: createGetPublishedRevisionByEntryId,
10
+ getRevisionById: createGetRevisionById
11
11
  };
12
- export const getDataLoaderFactory = name => {
13
- if (!dataLoaders[name]) {
14
- throw new Error(`Missing data loader "${name}".`);
15
- }
16
- return dataLoaders[name];
12
+ const getDataLoaderFactory = (name)=>{
13
+ if (!dataLoaders[name]) throw new Error(`Missing data loader "${name}".`);
14
+ return dataLoaders[name];
17
15
  };
16
+ export { getDataLoaderFactory };
18
17
 
19
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createGetAllEntryRevisions","createGetLatestRevisionByEntryId","createGetPublishedRevisionByEntryId","createGetRevisionById","dataLoaders","getAllEntryRevisions","getLatestRevisionByEntryId","getPublishedRevisionByEntryId","getRevisionById","getDataLoaderFactory","name","Error"],"sources":["index.ts"],"sourcesContent":["import type DataLoader from \"dataloader\";\nimport type { IDataLoaderParams } from \"./types.js\";\nimport { createGetAllEntryRevisions } from \"./getAllEntryRevisions.js\";\nimport { createGetLatestRevisionByEntryId } from \"./getLatestRevisionByEntryId.js\";\nimport { createGetPublishedRevisionByEntryId } from \"./getPublishedRevisionByEntryId.js\";\nimport { createGetRevisionById } from \"./getRevisionById.js\";\n\nexport * from \"./DataLoaderCache.js\";\n\ninterface Callable {\n (params: IDataLoaderParams): DataLoader<any, any>;\n}\n\nconst dataLoaders: Record<string, Callable> = {\n getAllEntryRevisions: createGetAllEntryRevisions,\n getLatestRevisionByEntryId: createGetLatestRevisionByEntryId,\n getPublishedRevisionByEntryId: createGetPublishedRevisionByEntryId,\n getRevisionById: createGetRevisionById\n};\n\nexport type DataLoaders =\n | \"getAllEntryRevisions\"\n | \"getRevisionById\"\n | \"getPublishedRevisionByEntryId\"\n | \"getLatestRevisionByEntryId\";\n\nexport const getDataLoaderFactory = (name: string) => {\n if (!dataLoaders[name]) {\n throw new Error(`Missing data loader \"${name}\".`);\n }\n return dataLoaders[name];\n};\n"],"mappings":"AAEA,SAASA,0BAA0B;AACnC,SAASC,gCAAgC;AACzC,SAASC,mCAAmC;AAC5C,SAASC,qBAAqB;AAE9B;AAMA,MAAMC,WAAqC,GAAG;EAC1CC,oBAAoB,EAAEL,0BAA0B;EAChDM,0BAA0B,EAAEL,gCAAgC;EAC5DM,6BAA6B,EAAEL,mCAAmC;EAClEM,eAAe,EAAEL;AACrB,CAAC;AAQD,OAAO,MAAMM,oBAAoB,GAAIC,IAAY,IAAK;EAClD,IAAI,CAACN,WAAW,CAACM,IAAI,CAAC,EAAE;IACpB,MAAM,IAAIC,KAAK,CAAC,wBAAwBD,IAAI,IAAI,CAAC;EACrD;EACA,OAAON,WAAW,CAACM,IAAI,CAAC;AAC5B,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"operations/entry/dataLoader/index.js","sources":["../../../../src/operations/entry/dataLoader/index.ts"],"sourcesContent":["import type DataLoader from \"dataloader\";\nimport type { IDataLoaderParams } from \"./types.js\";\nimport { createGetAllEntryRevisions } from \"./getAllEntryRevisions.js\";\nimport { createGetLatestRevisionByEntryId } from \"./getLatestRevisionByEntryId.js\";\nimport { createGetPublishedRevisionByEntryId } from \"./getPublishedRevisionByEntryId.js\";\nimport { createGetRevisionById } from \"./getRevisionById.js\";\n\nexport * from \"./DataLoaderCache.js\";\n\ninterface Callable {\n (params: IDataLoaderParams): DataLoader<any, any>;\n}\n\nconst dataLoaders: Record<string, Callable> = {\n getAllEntryRevisions: createGetAllEntryRevisions,\n getLatestRevisionByEntryId: createGetLatestRevisionByEntryId,\n getPublishedRevisionByEntryId: createGetPublishedRevisionByEntryId,\n getRevisionById: createGetRevisionById\n};\n\nexport type DataLoaders =\n | \"getAllEntryRevisions\"\n | \"getRevisionById\"\n | \"getPublishedRevisionByEntryId\"\n | \"getLatestRevisionByEntryId\";\n\nexport const getDataLoaderFactory = (name: string) => {\n if (!dataLoaders[name]) {\n throw new Error(`Missing data loader \"${name}\".`);\n }\n return dataLoaders[name];\n};\n"],"names":["dataLoaders","createGetAllEntryRevisions","createGetLatestRevisionByEntryId","createGetPublishedRevisionByEntryId","createGetRevisionById","getDataLoaderFactory","name","Error"],"mappings":";;;;;AAaA,MAAMA,cAAwC;IAC1C,sBAAsBC;IACtB,4BAA4BC;IAC5B,+BAA+BC;IAC/B,iBAAiBC;AACrB;AAQO,MAAMC,uBAAuB,CAACC;IACjC,IAAI,CAACN,WAAW,CAACM,KAAK,EAClB,MAAM,IAAIC,MAAM,CAAC,qBAAqB,EAAED,KAAK,EAAE,CAAC;IAEpD,OAAON,WAAW,CAACM,KAAK;AAC5B"}
@@ -2,4 +2,5 @@ import type { IEntryEntity } from "../../../definitions/types.js";
2
2
  export interface IDataLoaderParams {
3
3
  entity: IEntryEntity;
4
4
  tenant: string;
5
+ modelId: string;
5
6
  }
@@ -1,3 +0,0 @@
1
- export {};
2
-
3
- //# sourceMappingURL=types.js.map
@@ -1,16 +1,14 @@
1
1
  import type { CmsEntryValues, CmsModel, CmsStorageEntry } from "@webiny/api-headless-cms/types/index.js";
2
- import type { DataLoadersHandlerInterfaceClearAllParams, IDataLoadersHandler, IEntryEntity } from "../../types.js";
2
+ import type { DataLoadersHandlerInterfaceClearAllParams, IDataLoadersHandler } from "../../types.js";
3
+ import { CmsDdbEntryEntity } from "../../abstractions/CmsDdbEntryEntity.js";
3
4
  interface DataLoaderParams {
4
5
  model: Pick<CmsModel, "tenant" | "modelId">;
5
6
  ids: readonly string[];
6
7
  }
7
- interface IDataLoadersHandlerParams {
8
- entity: IEntryEntity;
9
- }
10
- export declare class DataLoadersHandler implements IDataLoadersHandler {
8
+ declare class DataLoadersHandlerImpl implements IDataLoadersHandler {
11
9
  private readonly entity;
12
10
  private readonly cache;
13
- constructor(params: IDataLoadersHandlerParams);
11
+ constructor(entity: CmsDdbEntryEntity.Interface);
14
12
  getAllEntryRevisions<T extends CmsEntryValues = CmsEntryValues>(params: DataLoaderParams): Promise<CmsStorageEntry<T>[]>;
15
13
  getRevisionById<T extends CmsEntryValues = CmsEntryValues>(params: DataLoaderParams): Promise<CmsStorageEntry<T>[]>;
16
14
  getPublishedRevisionByEntryId<T extends CmsEntryValues = CmsEntryValues>(params: DataLoaderParams): Promise<CmsStorageEntry<T>[]>;
@@ -23,4 +21,7 @@ export declare class DataLoadersHandler implements IDataLoadersHandler {
23
21
  private loadMany;
24
22
  clearAll(params?: DataLoadersHandlerInterfaceClearAllParams): void;
25
23
  }
24
+ export declare const DataLoadersHandler: typeof DataLoadersHandlerImpl & {
25
+ __abstraction: import("@webiny/di").Abstraction<IDataLoadersHandler>;
26
+ };
26
27
  export {};
@@ -1,106 +1,98 @@
1
- import WebinyError from "@webiny/error";
1
+ import error from "@webiny/error";
2
2
  import { DataLoaderCache } from "./dataLoader/DataLoaderCache.js";
3
3
  import { getDataLoaderFactory } from "./dataLoader/index.js";
4
4
  import { parseIdentifier } from "@webiny/utils";
5
- export class DataLoadersHandler {
6
- cache = new DataLoaderCache();
7
- constructor(params) {
8
- this.entity = params.entity;
9
- }
10
- async getAllEntryRevisions(params) {
11
- const ids = params.ids.map(id => {
12
- const {
13
- id: entryId
14
- } = parseIdentifier(id);
15
- return entryId;
16
- });
17
- return await this.loadMany("getAllEntryRevisions", params, ids);
18
- }
19
- async getRevisionById(params) {
20
- return await this.loadMany("getRevisionById", params, params.ids);
21
- }
22
- async getPublishedRevisionByEntryId(params) {
23
- const ids = params.ids.map(id => {
24
- const {
25
- id: entryId
26
- } = parseIdentifier(id);
27
- return entryId;
28
- });
29
- return await this.loadMany("getPublishedRevisionByEntryId", params, ids);
30
- }
31
- async getLatestRevisionByEntryId(params) {
32
- const ids = params.ids.map(id => {
33
- const {
34
- id: entryId
35
- } = parseIdentifier(id);
36
- return entryId;
37
- });
38
- return await this.loadMany("getLatestRevisionByEntryId", params, ids);
39
- }
40
-
41
- /**
42
- * TODO @ts-refactor
43
- * Maybe pass on the generics to DataLoader definition?
44
- */
45
- getLoader(name, params) {
46
- const {
47
- model
48
- } = params;
49
- const cacheParams = {
50
- tenant: model.tenant,
51
- name
52
- };
53
- let loader = this.cache.getDataLoader(cacheParams);
54
- if (loader) {
55
- return loader;
5
+ import { CmsDdbEntryEntity } from "../../abstractions/CmsDdbEntryEntity.js";
6
+ import { CmsDdbDataLoaders } from "../../abstractions/CmsDdbDataLoaders.js";
7
+ class DataLoadersHandlerImpl {
8
+ constructor(entity){
9
+ this.entity = entity;
10
+ this.cache = new DataLoaderCache();
11
+ }
12
+ async getAllEntryRevisions(params) {
13
+ const ids = params.ids.map((id)=>{
14
+ const { id: entryId } = parseIdentifier(id);
15
+ return entryId;
16
+ });
17
+ return await this.loadMany("getAllEntryRevisions", params, ids);
18
+ }
19
+ async getRevisionById(params) {
20
+ return await this.loadMany("getRevisionById", params, params.ids);
21
+ }
22
+ async getPublishedRevisionByEntryId(params) {
23
+ const ids = params.ids.map((id)=>{
24
+ const { id: entryId } = parseIdentifier(id);
25
+ return entryId;
26
+ });
27
+ return await this.loadMany("getPublishedRevisionByEntryId", params, ids);
56
28
  }
57
- const factory = getDataLoaderFactory(name);
58
- loader = factory({
59
- entity: this.entity,
60
- tenant: model.tenant
61
- });
62
- this.cache.setDataLoader(cacheParams, loader);
63
- return loader;
64
- }
65
- async loadMany(loader, params, ids) {
66
- let results = [];
67
- try {
68
- results = await this.getLoader(loader, params).loadMany(ids);
69
- if (Array.isArray(results) === true) {
70
- return results.reduce((acc, res) => {
71
- if (Array.isArray(res) === false) {
72
- if (res && res.message) {
73
- throw new WebinyError(res.message, res.code, {
74
- ...res,
75
- data: JSON.stringify(res.data || {})
76
- });
77
- }
78
- throw new WebinyError("Result from the data loader must be an array of arrays which contain requested items.", "DATA_LOADER_RESULTS_ERROR", {
79
- ...params,
80
- loader
29
+ async getLatestRevisionByEntryId(params) {
30
+ const ids = params.ids.map((id)=>{
31
+ const { id: entryId } = parseIdentifier(id);
32
+ return entryId;
33
+ });
34
+ return await this.loadMany("getLatestRevisionByEntryId", params, ids);
35
+ }
36
+ getLoader(name, params) {
37
+ const { model } = params;
38
+ const cacheParams = {
39
+ tenant: model.tenant,
40
+ modelId: model.modelId,
41
+ name
42
+ };
43
+ let loader = this.cache.getDataLoader(cacheParams);
44
+ if (loader) return loader;
45
+ const factory = getDataLoaderFactory(name);
46
+ loader = factory({
47
+ entity: this.entity,
48
+ tenant: model.tenant,
49
+ modelId: model.modelId
50
+ });
51
+ this.cache.setDataLoader(cacheParams, loader);
52
+ return loader;
53
+ }
54
+ async loadMany(loader, params, ids) {
55
+ let results = [];
56
+ try {
57
+ results = await this.getLoader(loader, params).loadMany(ids);
58
+ if (true === Array.isArray(results)) return results.reduce((acc, res)=>{
59
+ if (false === Array.isArray(res)) {
60
+ if (res && res.message) throw new error(res.message, res.code, {
61
+ ...res,
62
+ data: JSON.stringify(res.data || {})
63
+ });
64
+ throw new error("Result from the data loader must be an array of arrays which contain requested items.", "DATA_LOADER_RESULTS_ERROR", {
65
+ ...params,
66
+ loader
67
+ });
68
+ }
69
+ acc.push(...res);
70
+ return acc;
71
+ }, []);
72
+ } catch (ex) {
73
+ throw new error(ex.message || "Data loader error.", ex.code || "DATA_LOADER_ERROR", {
74
+ error: ex,
75
+ ...params,
76
+ loader,
77
+ ids
81
78
  });
82
- }
83
- acc.push(...res);
84
- return acc;
85
- }, []);
86
- }
87
- } catch (ex) {
88
- throw new WebinyError(ex.message || "Data loader error.", ex.code || "DATA_LOADER_ERROR", {
89
- error: ex,
90
- ...params,
91
- loader,
92
- ids
93
- });
79
+ }
80
+ throw new error("Data loader did not return array of items or empty array.", "INVALID_DATA_LOADER_RESULT", {
81
+ loader,
82
+ ids,
83
+ results
84
+ });
85
+ }
86
+ clearAll(params) {
87
+ this.cache.clearAll(params);
94
88
  }
95
- throw new WebinyError(`Data loader did not return array of items or empty array.`, "INVALID_DATA_LOADER_RESULT", {
96
- loader,
97
- ids,
98
- results
99
- });
100
- }
101
- clearAll(params) {
102
- this.cache.clearAll(params?.model);
103
- }
104
89
  }
90
+ const DataLoadersHandler = CmsDdbDataLoaders.createImplementation({
91
+ implementation: DataLoadersHandlerImpl,
92
+ dependencies: [
93
+ CmsDdbEntryEntity
94
+ ]
95
+ });
96
+ export { DataLoadersHandler };
105
97
 
106
98
  //# sourceMappingURL=dataLoaders.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["WebinyError","DataLoaderCache","getDataLoaderFactory","parseIdentifier","DataLoadersHandler","cache","constructor","params","entity","getAllEntryRevisions","ids","map","id","entryId","loadMany","getRevisionById","getPublishedRevisionByEntryId","getLatestRevisionByEntryId","getLoader","name","model","cacheParams","tenant","loader","getDataLoader","factory","setDataLoader","results","Array","isArray","reduce","acc","res","message","code","data","JSON","stringify","push","ex","error","clearAll"],"sources":["dataLoaders.ts"],"sourcesContent":["import type DataLoader from \"dataloader\";\nimport WebinyError from \"@webiny/error\";\nimport type {\n CmsEntryValues,\n CmsModel,\n CmsStorageEntry\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport type { CacheKeyParams } from \"~/operations/entry/dataLoader/DataLoaderCache.js\";\nimport { DataLoaderCache } from \"~/operations/entry/dataLoader/DataLoaderCache.js\";\nimport type { DataLoaders } from \"~/operations/entry/dataLoader/index.js\";\nimport { getDataLoaderFactory } from \"~/operations/entry/dataLoader/index.js\";\nimport { parseIdentifier } from \"@webiny/utils\";\nimport type {\n DataLoadersHandlerInterfaceClearAllParams,\n IDataLoadersHandler,\n IEntryEntity\n} from \"~/types.js\";\n\ninterface DataLoaderParams {\n model: Pick<CmsModel, \"tenant\" | \"modelId\">;\n ids: readonly string[];\n}\n\ninterface GetLoaderParams {\n model: Pick<CmsModel, \"tenant\" | \"modelId\">;\n}\n\ninterface IDataLoadersHandlerParams {\n entity: IEntryEntity;\n}\n\nexport class DataLoadersHandler implements IDataLoadersHandler {\n private readonly entity;\n private readonly cache = new DataLoaderCache();\n\n public constructor(params: IDataLoadersHandlerParams) {\n this.entity = params.entity;\n }\n\n public async getAllEntryRevisions<T extends CmsEntryValues = CmsEntryValues>(\n params: DataLoaderParams\n ): Promise<CmsStorageEntry<T>[]> {\n const ids = params.ids.map(id => {\n const { id: entryId } = parseIdentifier(id);\n return entryId;\n });\n return await this.loadMany<T>(\"getAllEntryRevisions\", params, ids);\n }\n\n public async getRevisionById<T extends CmsEntryValues = CmsEntryValues>(\n params: DataLoaderParams\n ): Promise<CmsStorageEntry<T>[]> {\n return await this.loadMany<T>(\"getRevisionById\", params, params.ids);\n }\n\n public async getPublishedRevisionByEntryId<T extends CmsEntryValues = CmsEntryValues>(\n params: DataLoaderParams\n ): Promise<CmsStorageEntry<T>[]> {\n const ids = params.ids.map(id => {\n const { id: entryId } = parseIdentifier(id);\n return entryId;\n });\n return await this.loadMany<T>(\"getPublishedRevisionByEntryId\", params, ids);\n }\n\n public async getLatestRevisionByEntryId<T extends CmsEntryValues = CmsEntryValues>(\n params: DataLoaderParams\n ): Promise<CmsStorageEntry<T>[]> {\n const ids = params.ids.map(id => {\n const { id: entryId } = parseIdentifier(id);\n return entryId;\n });\n return await this.loadMany<T>(\"getLatestRevisionByEntryId\", params, ids);\n }\n\n /**\n * TODO @ts-refactor\n * Maybe pass on the generics to DataLoader definition?\n */\n private getLoader(name: DataLoaders, params: GetLoaderParams): DataLoader<any, any> {\n const { model } = params;\n const cacheParams: CacheKeyParams = {\n tenant: model.tenant,\n name\n };\n let loader = this.cache.getDataLoader(cacheParams);\n if (loader) {\n return loader;\n }\n const factory = getDataLoaderFactory(name);\n loader = factory({\n entity: this.entity,\n tenant: model.tenant\n });\n this.cache.setDataLoader(cacheParams, loader);\n return loader;\n }\n\n private async loadMany<T extends CmsEntryValues = CmsEntryValues>(\n loader: DataLoaders,\n params: GetLoaderParams,\n ids: readonly string[]\n ): Promise<CmsStorageEntry<T>[]> {\n let results: any[] = [];\n try {\n results = await this.getLoader(loader, params).loadMany(ids);\n if (Array.isArray(results) === true) {\n return results.reduce((acc, res) => {\n if (Array.isArray(res) === false) {\n if (res && res.message) {\n throw new WebinyError(res.message, res.code, {\n ...res,\n data: JSON.stringify(res.data || {})\n });\n }\n throw new WebinyError(\n \"Result from the data loader must be an array of arrays which contain requested items.\",\n \"DATA_LOADER_RESULTS_ERROR\",\n {\n ...params,\n loader\n }\n );\n }\n acc.push(...res);\n return acc;\n }, []);\n }\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Data loader error.\",\n ex.code || \"DATA_LOADER_ERROR\",\n {\n error: ex,\n ...params,\n loader,\n ids\n }\n );\n }\n throw new WebinyError(\n `Data loader did not return array of items or empty array.`,\n \"INVALID_DATA_LOADER_RESULT\",\n {\n loader,\n ids,\n results\n }\n );\n }\n\n public clearAll(params?: DataLoadersHandlerInterfaceClearAllParams): void {\n this.cache.clearAll(params?.model);\n }\n}\n"],"mappings":"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","ignoreList":[]}
1
+ {"version":3,"file":"operations/entry/dataLoaders.js","sources":["../../../src/operations/entry/dataLoaders.ts"],"sourcesContent":["import type DataLoader from \"dataloader\";\nimport WebinyError from \"@webiny/error\";\nimport type {\n CmsEntryValues,\n CmsModel,\n CmsStorageEntry\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport type { CacheKeyParams } from \"~/operations/entry/dataLoader/DataLoaderCache.js\";\nimport { DataLoaderCache } from \"~/operations/entry/dataLoader/DataLoaderCache.js\";\nimport type { DataLoaders } from \"~/operations/entry/dataLoader/index.js\";\nimport { getDataLoaderFactory } from \"~/operations/entry/dataLoader/index.js\";\nimport { parseIdentifier } from \"@webiny/utils\";\nimport type { DataLoadersHandlerInterfaceClearAllParams, IDataLoadersHandler } from \"~/types.js\";\nimport { CmsDdbEntryEntity } from \"~/abstractions/CmsDdbEntryEntity.js\";\nimport { CmsDdbDataLoaders } from \"~/abstractions/CmsDdbDataLoaders.js\";\n\ninterface DataLoaderParams {\n model: Pick<CmsModel, \"tenant\" | \"modelId\">;\n ids: readonly string[];\n}\n\ninterface GetLoaderParams {\n model: Pick<CmsModel, \"tenant\" | \"modelId\">;\n}\n\nclass DataLoadersHandlerImpl implements IDataLoadersHandler {\n private readonly cache = new DataLoaderCache();\n\n public constructor(private readonly entity: CmsDdbEntryEntity.Interface) {}\n\n public async getAllEntryRevisions<T extends CmsEntryValues = CmsEntryValues>(\n params: DataLoaderParams\n ): Promise<CmsStorageEntry<T>[]> {\n const ids = params.ids.map(id => {\n const { id: entryId } = parseIdentifier(id);\n return entryId;\n });\n return await this.loadMany<T>(\"getAllEntryRevisions\", params, ids);\n }\n\n public async getRevisionById<T extends CmsEntryValues = CmsEntryValues>(\n params: DataLoaderParams\n ): Promise<CmsStorageEntry<T>[]> {\n return await this.loadMany<T>(\"getRevisionById\", params, params.ids);\n }\n\n public async getPublishedRevisionByEntryId<T extends CmsEntryValues = CmsEntryValues>(\n params: DataLoaderParams\n ): Promise<CmsStorageEntry<T>[]> {\n const ids = params.ids.map(id => {\n const { id: entryId } = parseIdentifier(id);\n return entryId;\n });\n return await this.loadMany<T>(\"getPublishedRevisionByEntryId\", params, ids);\n }\n\n public async getLatestRevisionByEntryId<T extends CmsEntryValues = CmsEntryValues>(\n params: DataLoaderParams\n ): Promise<CmsStorageEntry<T>[]> {\n const ids = params.ids.map(id => {\n const { id: entryId } = parseIdentifier(id);\n return entryId;\n });\n return await this.loadMany<T>(\"getLatestRevisionByEntryId\", params, ids);\n }\n\n /**\n * TODO @ts-refactor\n * Maybe pass on the generics to DataLoader definition?\n */\n private getLoader(name: DataLoaders, params: GetLoaderParams): DataLoader<any, any> {\n const { model } = params;\n const cacheParams: CacheKeyParams = {\n tenant: model.tenant,\n modelId: model.modelId,\n name\n };\n let loader = this.cache.getDataLoader(cacheParams);\n if (loader) {\n return loader;\n }\n const factory = getDataLoaderFactory(name);\n loader = factory({\n entity: this.entity,\n tenant: model.tenant,\n modelId: model.modelId\n });\n this.cache.setDataLoader(cacheParams, loader);\n return loader;\n }\n\n private async loadMany<T extends CmsEntryValues = CmsEntryValues>(\n loader: DataLoaders,\n params: GetLoaderParams,\n ids: readonly string[]\n ): Promise<CmsStorageEntry<T>[]> {\n let results: any[] = [];\n try {\n results = await this.getLoader(loader, params).loadMany(ids);\n if (Array.isArray(results) === true) {\n return results.reduce((acc, res) => {\n if (Array.isArray(res) === false) {\n if (res && res.message) {\n throw new WebinyError(res.message, res.code, {\n ...res,\n data: JSON.stringify(res.data || {})\n });\n }\n throw new WebinyError(\n \"Result from the data loader must be an array of arrays which contain requested items.\",\n \"DATA_LOADER_RESULTS_ERROR\",\n {\n ...params,\n loader\n }\n );\n }\n acc.push(...res);\n return acc;\n }, []);\n }\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Data loader error.\",\n ex.code || \"DATA_LOADER_ERROR\",\n {\n error: ex,\n ...params,\n loader,\n ids\n }\n );\n }\n throw new WebinyError(\n `Data loader did not return array of items or empty array.`,\n \"INVALID_DATA_LOADER_RESULT\",\n {\n loader,\n ids,\n results\n }\n );\n }\n\n public clearAll(params?: DataLoadersHandlerInterfaceClearAllParams): void {\n this.cache.clearAll(params);\n }\n}\n\nexport const DataLoadersHandler = CmsDdbDataLoaders.createImplementation({\n implementation: DataLoadersHandlerImpl,\n dependencies: [CmsDdbEntryEntity]\n});\n"],"names":["DataLoadersHandlerImpl","entity","DataLoaderCache","params","ids","id","entryId","parseIdentifier","name","model","cacheParams","loader","factory","getDataLoaderFactory","results","Array","acc","res","WebinyError","JSON","ex","DataLoadersHandler","CmsDdbDataLoaders","CmsDdbEntryEntity"],"mappings":"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"}
@@ -0,0 +1,4 @@
1
+ export declare const DdbEntryStorageOpsFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -0,0 +1,55 @@
1
+ import { createFeature } from "@webiny/feature/api/index.js";
2
+ import { DataLoadersHandler } from "./dataLoaders.js";
3
+ import { DdbCreateEntry } from "./DdbCreateEntry.js";
4
+ import { DdbCreateEntryRevisionFrom } from "./DdbCreateEntryRevisionFrom.js";
5
+ import { DdbUpdateEntry } from "./DdbUpdateEntry.js";
6
+ import { DdbMoveEntry } from "./DdbMoveEntry.js";
7
+ import { DdbMoveToBin } from "./DdbMoveToBin.js";
8
+ import { DdbDeleteEntry } from "./DdbDeleteEntry.js";
9
+ import { DdbRestoreFromBin } from "./DdbRestoreFromBin.js";
10
+ import { DdbDeleteEntryRevision } from "./DdbDeleteEntryRevision.js";
11
+ import { DdbDeleteMultipleEntries } from "./DdbDeleteMultipleEntries.js";
12
+ import { DdbGetEntry } from "./DdbGetEntry.js";
13
+ import { DdbListEntries } from "./DdbListEntries.js";
14
+ import { DdbPublishEntry } from "./DdbPublishEntry.js";
15
+ import { DdbUnpublishEntry } from "./DdbUnpublishEntry.js";
16
+ import { DdbGetEntriesByIds } from "./DdbGetEntriesByIds.js";
17
+ import { DdbGetLatestEntriesByIds } from "./DdbGetLatestEntriesByIds.js";
18
+ import { DdbGetPublishedEntriesByIds } from "./DdbGetPublishedEntriesByIds.js";
19
+ import { DdbGetRevisions } from "./DdbGetRevisions.js";
20
+ import { DdbGetRevisionById } from "./DdbGetRevisionById.js";
21
+ import { DdbGetLatestRevisionByEntryId } from "./DdbGetLatestRevisionByEntryId.js";
22
+ import { DdbGetPublishedRevisionByEntryId } from "./DdbGetPublishedRevisionByEntryId.js";
23
+ import { DdbGetPreviousRevision } from "./DdbGetPreviousRevision.js";
24
+ import { DdbGetUniqueFieldValues } from "./DdbGetUniqueFieldValues.js";
25
+ const DdbEntryStorageOpsFeature = createFeature({
26
+ name: "cms.ddb.entryStorageOps",
27
+ register: (container)=>{
28
+ container.register(DataLoadersHandler).inContainerScope();
29
+ container.register(DdbCreateEntry);
30
+ container.register(DdbCreateEntryRevisionFrom);
31
+ container.register(DdbUpdateEntry);
32
+ container.register(DdbMoveEntry);
33
+ container.register(DdbMoveToBin);
34
+ container.register(DdbDeleteEntry);
35
+ container.register(DdbRestoreFromBin);
36
+ container.register(DdbDeleteEntryRevision);
37
+ container.register(DdbDeleteMultipleEntries);
38
+ container.register(DdbGetEntry);
39
+ container.register(DdbListEntries);
40
+ container.register(DdbPublishEntry);
41
+ container.register(DdbUnpublishEntry);
42
+ container.register(DdbGetEntriesByIds);
43
+ container.register(DdbGetLatestEntriesByIds);
44
+ container.register(DdbGetPublishedEntriesByIds);
45
+ container.register(DdbGetRevisions);
46
+ container.register(DdbGetRevisionById);
47
+ container.register(DdbGetLatestRevisionByEntryId);
48
+ container.register(DdbGetPublishedRevisionByEntryId);
49
+ container.register(DdbGetPreviousRevision);
50
+ container.register(DdbGetUniqueFieldValues);
51
+ }
52
+ });
53
+ export { DdbEntryStorageOpsFeature };
54
+
55
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/entry/feature.js","sources":["../../../src/operations/entry/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api/index.js\";\nimport { DataLoadersHandler } from \"./dataLoaders.js\";\nimport { DdbCreateEntry } from \"./DdbCreateEntry.js\";\nimport { DdbCreateEntryRevisionFrom } from \"./DdbCreateEntryRevisionFrom.js\";\nimport { DdbUpdateEntry } from \"./DdbUpdateEntry.js\";\nimport { DdbMoveEntry } from \"./DdbMoveEntry.js\";\nimport { DdbMoveToBin } from \"./DdbMoveToBin.js\";\nimport { DdbDeleteEntry } from \"./DdbDeleteEntry.js\";\nimport { DdbRestoreFromBin } from \"./DdbRestoreFromBin.js\";\nimport { DdbDeleteEntryRevision } from \"./DdbDeleteEntryRevision.js\";\nimport { DdbDeleteMultipleEntries } from \"./DdbDeleteMultipleEntries.js\";\nimport { DdbGetEntry } from \"./DdbGetEntry.js\";\nimport { DdbListEntries } from \"./DdbListEntries.js\";\nimport { DdbPublishEntry } from \"./DdbPublishEntry.js\";\nimport { DdbUnpublishEntry } from \"./DdbUnpublishEntry.js\";\nimport { DdbGetEntriesByIds } from \"./DdbGetEntriesByIds.js\";\nimport { DdbGetLatestEntriesByIds } from \"./DdbGetLatestEntriesByIds.js\";\nimport { DdbGetPublishedEntriesByIds } from \"./DdbGetPublishedEntriesByIds.js\";\nimport { DdbGetRevisions } from \"./DdbGetRevisions.js\";\nimport { DdbGetRevisionById } from \"./DdbGetRevisionById.js\";\nimport { DdbGetLatestRevisionByEntryId } from \"./DdbGetLatestRevisionByEntryId.js\";\nimport { DdbGetPublishedRevisionByEntryId } from \"./DdbGetPublishedRevisionByEntryId.js\";\nimport { DdbGetPreviousRevision } from \"./DdbGetPreviousRevision.js\";\nimport { DdbGetUniqueFieldValues } from \"./DdbGetUniqueFieldValues.js\";\n\nexport const DdbEntryStorageOpsFeature = createFeature({\n name: \"cms.ddb.entryStorageOps\",\n register: container => {\n // The DataLoader caches reads, so it must live for one request: container scoped, it is built\n // per request (child) container even though the feature is registered once in the root.\n container.register(DataLoadersHandler).inContainerScope();\n container.register(DdbCreateEntry);\n container.register(DdbCreateEntryRevisionFrom);\n container.register(DdbUpdateEntry);\n container.register(DdbMoveEntry);\n container.register(DdbMoveToBin);\n container.register(DdbDeleteEntry);\n container.register(DdbRestoreFromBin);\n container.register(DdbDeleteEntryRevision);\n container.register(DdbDeleteMultipleEntries);\n container.register(DdbGetEntry);\n container.register(DdbListEntries);\n container.register(DdbPublishEntry);\n container.register(DdbUnpublishEntry);\n container.register(DdbGetEntriesByIds);\n container.register(DdbGetLatestEntriesByIds);\n container.register(DdbGetPublishedEntriesByIds);\n container.register(DdbGetRevisions);\n container.register(DdbGetRevisionById);\n container.register(DdbGetLatestRevisionByEntryId);\n container.register(DdbGetPublishedRevisionByEntryId);\n container.register(DdbGetPreviousRevision);\n container.register(DdbGetUniqueFieldValues);\n }\n});\n"],"names":["DdbEntryStorageOpsFeature","createFeature","container","DataLoadersHandler","DdbCreateEntry","DdbCreateEntryRevisionFrom","DdbUpdateEntry","DdbMoveEntry","DdbMoveToBin","DdbDeleteEntry","DdbRestoreFromBin","DdbDeleteEntryRevision","DdbDeleteMultipleEntries","DdbGetEntry","DdbListEntries","DdbPublishEntry","DdbUnpublishEntry","DdbGetEntriesByIds","DdbGetLatestEntriesByIds","DdbGetPublishedEntriesByIds","DdbGetRevisions","DdbGetRevisionById","DdbGetLatestRevisionByEntryId","DdbGetPublishedRevisionByEntryId","DdbGetPreviousRevision","DdbGetUniqueFieldValues"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAyBO,MAAMA,4BAA4BC,cAAc;IACnD,MAAM;IACN,UAAUC,CAAAA;QAGNA,UAAU,QAAQ,CAACC,oBAAoB,gBAAgB;QACvDD,UAAU,QAAQ,CAACE;QACnBF,UAAU,QAAQ,CAACG;QACnBH,UAAU,QAAQ,CAACI;QACnBJ,UAAU,QAAQ,CAACK;QACnBL,UAAU,QAAQ,CAACM;QACnBN,UAAU,QAAQ,CAACO;QACnBP,UAAU,QAAQ,CAACQ;QACnBR,UAAU,QAAQ,CAACS;QACnBT,UAAU,QAAQ,CAACU;QACnBV,UAAU,QAAQ,CAACW;QACnBX,UAAU,QAAQ,CAACY;QACnBZ,UAAU,QAAQ,CAACa;QACnBb,UAAU,QAAQ,CAACc;QACnBd,UAAU,QAAQ,CAACe;QACnBf,UAAU,QAAQ,CAACgB;QACnBhB,UAAU,QAAQ,CAACiB;QACnBjB,UAAU,QAAQ,CAACkB;QACnBlB,UAAU,QAAQ,CAACmB;QACnBnB,UAAU,QAAQ,CAACoB;QACnBpB,UAAU,QAAQ,CAACqB;QACnBrB,UAAU,QAAQ,CAACsB;QACnBtB,UAAU,QAAQ,CAACuB;IACvB;AACJ"}
@@ -24,6 +24,7 @@ export interface ICreateEntryPublishedKeysParams {
24
24
  id: string;
25
25
  tenant: string;
26
26
  modelId: string;
27
+ expiresAt: number | null;
27
28
  }
28
29
  export declare const createEntryPublishedKeys: (params: ICreateEntryPublishedKeysParams) => {
29
30
  PK: string;
@@ -32,11 +33,13 @@ export declare const createEntryPublishedKeys: (params: ICreateEntryPublishedKey
32
33
  GSI1_SK: string;
33
34
  TYPE: string;
34
35
  GSI_TENANT: string;
36
+ expiresAt: number | null;
35
37
  };
36
38
  export interface ICreateEntryLatestKeysParams {
37
39
  id: string;
38
40
  tenant: string;
39
41
  modelId: string;
42
+ expiresAt: number | null;
40
43
  }
41
44
  export declare const createEntryLatestKeys: (params: ICreateEntryLatestKeysParams) => {
42
45
  PK: string;
@@ -45,12 +48,14 @@ export declare const createEntryLatestKeys: (params: ICreateEntryLatestKeysParam
45
48
  GSI1_SK: string;
46
49
  TYPE: string;
47
50
  GSI_TENANT: string;
51
+ expiresAt: number | null;
48
52
  };
49
53
  export interface ICreateRevisionKeysParams {
50
54
  id: string;
51
55
  tenant: string;
52
56
  version: number;
53
57
  modelId: string;
58
+ expiresAt: number | null;
54
59
  }
55
60
  export declare const createEntryRevisionKeys: (params: ICreateRevisionKeysParams) => {
56
61
  PK: string;
@@ -59,5 +64,6 @@ export declare const createEntryRevisionKeys: (params: ICreateRevisionKeysParams
59
64
  GSI1_SK: string;
60
65
  TYPE: string;
61
66
  GSI_TENANT: string;
67
+ expiresAt: number | null;
62
68
  };
63
69
  export {};