@webiny/api-sync-system 0.0.0-unstable.e6f0dc8ca7 → 0.0.0-unstable.e9333b3f0b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/constants.js +2 -1
  2. package/constants.js.map +1 -1
  3. package/index.d.ts +11 -3
  4. package/index.js +8 -5
  5. package/package.json +23 -18
  6. package/resolver/SyncResolverConfig.d.ts +17 -0
  7. package/resolver/SyncResolverConfig.js +5 -0
  8. package/resolver/SyncResolverConfig.js.map +1 -0
  9. package/resolver/SyncResolverLambdaHandler.d.ts +14 -0
  10. package/resolver/SyncResolverLambdaHandler.js +159 -0
  11. package/resolver/SyncResolverLambdaHandler.js.map +1 -0
  12. package/resolver/app/RecordHandler.js +83 -105
  13. package/resolver/app/RecordHandler.js.map +1 -1
  14. package/resolver/app/RecordsValidation.js +11 -14
  15. package/resolver/app/RecordsValidation.js.map +1 -1
  16. package/resolver/app/ResolverApplication.js +24 -31
  17. package/resolver/app/ResolverApplication.js.map +1 -1
  18. package/resolver/app/abstractions/RecordHandler.js +0 -3
  19. package/resolver/app/abstractions/RecordsValidation.js +0 -3
  20. package/resolver/app/abstractions/ResolverApplication.js +0 -3
  21. package/resolver/app/abstractions/ResolverRecord.js +0 -3
  22. package/resolver/app/bundler/BaseBundle.js +17 -16
  23. package/resolver/app/bundler/BaseBundle.js.map +1 -1
  24. package/resolver/app/bundler/Bundler.js +13 -18
  25. package/resolver/app/bundler/Bundler.js.map +1 -1
  26. package/resolver/app/bundler/Bundles.js +21 -26
  27. package/resolver/app/bundler/Bundles.js.map +1 -1
  28. package/resolver/app/bundler/CommandBundle.js +7 -16
  29. package/resolver/app/bundler/CommandBundle.js.map +1 -1
  30. package/resolver/app/bundler/TableBundle.js +6 -13
  31. package/resolver/app/bundler/TableBundle.js.map +1 -1
  32. package/resolver/app/bundler/types.js +0 -3
  33. package/resolver/app/commandHandler/DeleteCommandHandler.js +22 -29
  34. package/resolver/app/commandHandler/DeleteCommandHandler.js.map +1 -1
  35. package/resolver/app/commandHandler/PutCommandHandler.js +16 -22
  36. package/resolver/app/commandHandler/PutCommandHandler.js.map +1 -1
  37. package/resolver/app/commandHandler/delete.js +11 -12
  38. package/resolver/app/commandHandler/delete.js.map +1 -1
  39. package/resolver/app/commandHandler/put.js +11 -12
  40. package/resolver/app/commandHandler/put.js.map +1 -1
  41. package/resolver/app/data/SourceDataContainer.js +28 -30
  42. package/resolver/app/data/SourceDataContainer.js.map +1 -1
  43. package/resolver/app/data/types.js +0 -3
  44. package/resolver/app/fetcher/Fetcher.js +84 -109
  45. package/resolver/app/fetcher/Fetcher.js.map +1 -1
  46. package/resolver/app/fetcher/types.js +0 -3
  47. package/resolver/app/ingestor/Ingestor.js +27 -32
  48. package/resolver/app/ingestor/Ingestor.js.map +1 -1
  49. package/resolver/app/ingestor/IngestorResult.js +28 -32
  50. package/resolver/app/ingestor/IngestorResult.js.map +1 -1
  51. package/resolver/app/ingestor/types.js +0 -3
  52. package/resolver/app/storer/Storer.js +71 -85
  53. package/resolver/app/storer/Storer.js.map +1 -1
  54. package/resolver/app/storer/types.js +0 -3
  55. package/resolver/app/transform/TransformHandler.js +45 -56
  56. package/resolver/app/transform/TransformHandler.js.map +1 -1
  57. package/resolver/app/transform/middleware.js +13 -20
  58. package/resolver/app/transform/middleware.js.map +1 -1
  59. package/resolver/app/utils/Retry.js +21 -24
  60. package/resolver/app/utils/Retry.js.map +1 -1
  61. package/resolver/app/utils/sleep.js +4 -5
  62. package/resolver/app/utils/sleep.js.map +1 -1
  63. package/resolver/app/validation/body.d.ts +5 -5
  64. package/resolver/app/validation/body.js +26 -31
  65. package/resolver/app/validation/body.js.map +1 -1
  66. package/resolver/app/validation/createJsonTransform.js +12 -13
  67. package/resolver/app/validation/createJsonTransform.js.map +1 -1
  68. package/resolver/app/validation/detail.d.ts +5 -5
  69. package/resolver/app/validation/detail.js +30 -35
  70. package/resolver/app/validation/detail.js.map +1 -1
  71. package/resolver/app/validation/event.d.ts +5 -5
  72. package/resolver/app/validation/event.js +17 -18
  73. package/resolver/app/validation/event.js.map +1 -1
  74. package/resolver/app/validation/numericString.js +8 -11
  75. package/resolver/app/validation/numericString.js.map +1 -1
  76. package/resolver/app/validation/system.js +8 -9
  77. package/resolver/app/validation/system.js.map +1 -1
  78. package/resolver/deployment/Deployment.js +28 -31
  79. package/resolver/deployment/Deployment.js.map +1 -1
  80. package/resolver/deployment/Deployments.js +20 -23
  81. package/resolver/deployment/Deployments.js.map +1 -1
  82. package/resolver/deployment/DeploymentsFetcher.js +75 -84
  83. package/resolver/deployment/DeploymentsFetcher.js.map +1 -1
  84. package/resolver/deployment/types.js +0 -3
  85. package/resolver/lambda/LambdaTrigger.js +24 -26
  86. package/resolver/lambda/LambdaTrigger.js.map +1 -1
  87. package/resolver/plugins/CommandHandlerPlugin.js +16 -15
  88. package/resolver/plugins/CommandHandlerPlugin.js.map +1 -1
  89. package/resolver/plugins/StorerAfterEachPlugin.js +20 -19
  90. package/resolver/plugins/StorerAfterEachPlugin.js.map +1 -1
  91. package/resolver/plugins/TransformRecordPlugin.js +19 -18
  92. package/resolver/plugins/TransformRecordPlugin.js.map +1 -1
  93. package/resolver/recordTypes/fileManager/CopyFile.js +44 -67
  94. package/resolver/recordTypes/fileManager/CopyFile.js.map +1 -1
  95. package/resolver/recordTypes/fileManager/DeleteFile.js +40 -58
  96. package/resolver/recordTypes/fileManager/DeleteFile.js.map +1 -1
  97. package/resolver/recordTypes/fileManager/fileManager.js +5 -3
  98. package/resolver/recordTypes/fileManager/fileManager.js.map +1 -1
  99. package/resolver/recordTypes/fileManager/fileManagerOnDelete.js +24 -35
  100. package/resolver/recordTypes/fileManager/fileManagerOnDelete.js.map +1 -1
  101. package/resolver/recordTypes/fileManager/fileManagerOnPut.js +24 -35
  102. package/resolver/recordTypes/fileManager/fileManagerOnPut.js.map +1 -1
  103. package/resolver/recordTypes/fileManager/shouldBeHandled.js +10 -27
  104. package/resolver/recordTypes/fileManager/shouldBeHandled.js.map +1 -1
  105. package/resolver/recordTypes/fileManager/types.js +0 -3
  106. package/resolver/recordTypes/users/CopyUser.js +44 -54
  107. package/resolver/recordTypes/users/CopyUser.js.map +1 -1
  108. package/resolver/recordTypes/users/DeleteUser.js +40 -51
  109. package/resolver/recordTypes/users/DeleteUser.js.map +1 -1
  110. package/resolver/recordTypes/users/shouldBeHandled.js +10 -26
  111. package/resolver/recordTypes/users/shouldBeHandled.js.map +1 -1
  112. package/resolver/recordTypes/users/types.js +0 -3
  113. package/resolver/recordTypes/users/users.js +5 -3
  114. package/resolver/recordTypes/users/users.js.map +1 -1
  115. package/resolver/recordTypes/users/usersOnDelete.js +23 -34
  116. package/resolver/recordTypes/users/usersOnDelete.js.map +1 -1
  117. package/resolver/recordTypes/users/usersOnPut.js +24 -35
  118. package/resolver/recordTypes/users/usersOnPut.js.map +1 -1
  119. package/sync/ApiGatewaySyncDecorator.d.ts +14 -0
  120. package/sync/ApiGatewaySyncDecorator.js +49 -0
  121. package/sync/ApiGatewaySyncDecorator.js.map +1 -0
  122. package/sync/FilterOutRecord.js +9 -17
  123. package/sync/FilterOutRecord.js.map +1 -1
  124. package/sync/SyncSystemConfig.d.ts +11 -0
  125. package/sync/SyncSystemConfig.js +5 -0
  126. package/sync/SyncSystemConfig.js.map +1 -0
  127. package/sync/attachToDynamoDbDocument.js +46 -65
  128. package/sync/attachToDynamoDbDocument.js.map +1 -1
  129. package/sync/createHandler.js +31 -40
  130. package/sync/createHandler.js.map +1 -1
  131. package/sync/filter/createDefaultFilterOutRecordPlugins.js +37 -76
  132. package/sync/filter/createDefaultFilterOutRecordPlugins.js.map +1 -1
  133. package/sync/handler/Handler.js +64 -76
  134. package/sync/handler/Handler.js.map +1 -1
  135. package/sync/handler/HandlerConverter.js +21 -29
  136. package/sync/handler/HandlerConverter.js.map +1 -1
  137. package/sync/handler/converter/BatchGetCommandConverter.js +12 -11
  138. package/sync/handler/converter/BatchGetCommandConverter.js.map +1 -1
  139. package/sync/handler/converter/BatchWriteCommandConverter.js +12 -11
  140. package/sync/handler/converter/BatchWriteCommandConverter.js.map +1 -1
  141. package/sync/handler/converter/DeleteCommandConverter.js +12 -11
  142. package/sync/handler/converter/DeleteCommandConverter.js.map +1 -1
  143. package/sync/handler/converter/GetCommandConverter.js +12 -11
  144. package/sync/handler/converter/GetCommandConverter.js.map +1 -1
  145. package/sync/handler/converter/PutCommandConverter.js +12 -11
  146. package/sync/handler/converter/PutCommandConverter.js.map +1 -1
  147. package/sync/handler/converter/QueryCommandConverter.js +12 -11
  148. package/sync/handler/converter/QueryCommandConverter.js.map +1 -1
  149. package/sync/handler/converter/ScanCommandConverter.js +12 -11
  150. package/sync/handler/converter/ScanCommandConverter.js.map +1 -1
  151. package/sync/handler/converter/UpdateCommandConverter.js +12 -11
  152. package/sync/handler/converter/UpdateCommandConverter.js.map +1 -1
  153. package/sync/handler/converter/commands/BatchWriteCommandValue.js +34 -37
  154. package/sync/handler/converter/commands/BatchWriteCommandValue.js.map +1 -1
  155. package/sync/handler/converter/commands/DeleteCommandValue.js +19 -16
  156. package/sync/handler/converter/commands/DeleteCommandValue.js.map +1 -1
  157. package/sync/handler/converter/commands/NullCommandValue.js +8 -8
  158. package/sync/handler/converter/commands/NullCommandValue.js.map +1 -1
  159. package/sync/handler/converter/commands/PutCommandValue.js +19 -16
  160. package/sync/handler/converter/commands/PutCommandValue.js.map +1 -1
  161. package/sync/handler/converter/commands/UpdateCommandValue.js +19 -16
  162. package/sync/handler/converter/commands/UpdateCommandValue.js.map +1 -1
  163. package/sync/handler/types.js +0 -3
  164. package/sync/plugins/FilterOutRecordPlugin.js +17 -19
  165. package/sync/plugins/FilterOutRecordPlugin.js.map +1 -1
  166. package/sync/types.js +0 -3
  167. package/sync/utils/getTableType.js +10 -9
  168. package/sync/utils/getTableType.js.map +1 -1
  169. package/sync/utils/manifest.d.ts +2 -6
  170. package/sync/utils/manifest.js +27 -36
  171. package/sync/utils/manifest.js.map +1 -1
  172. package/sync/utils/validateSystemInput.js +21 -29
  173. package/sync/utils/validateSystemInput.js.map +1 -1
  174. package/types.d.ts +0 -2
  175. package/types.js +6 -5
  176. package/types.js.map +1 -1
  177. package/utils/createSystemName.js +5 -3
  178. package/utils/createSystemName.js.map +1 -1
  179. package/worker/SyncWorkerConfig.d.ts +9 -0
  180. package/worker/SyncWorkerConfig.js +5 -0
  181. package/worker/SyncWorkerConfig.js.map +1 -0
  182. package/worker/SyncWorkerEventHandler.d.ts +14 -0
  183. package/worker/SyncWorkerEventHandler.js +5 -0
  184. package/worker/SyncWorkerEventHandler.js.map +1 -0
  185. package/worker/SyncWorkerEventType.d.ts +10 -0
  186. package/worker/SyncWorkerEventType.js +24 -0
  187. package/worker/SyncWorkerEventType.js.map +1 -0
  188. package/worker/SyncWorkerLambdaHandler.d.ts +13 -0
  189. package/worker/SyncWorkerLambdaHandler.js +61 -0
  190. package/worker/SyncWorkerLambdaHandler.js.map +1 -0
  191. package/worker/actions/copyFile/CopyFile.js +183 -258
  192. package/worker/actions/copyFile/CopyFile.js.map +1 -1
  193. package/worker/actions/copyFile/copyFileAction.js +26 -34
  194. package/worker/actions/copyFile/copyFileAction.js.map +1 -1
  195. package/worker/actions/copyFile/copyFileSchema.js +13 -14
  196. package/worker/actions/copyFile/copyFileSchema.js.map +1 -1
  197. package/worker/actions/copyFile/types.js +0 -3
  198. package/worker/actions/createUser/CreateUser.js +51 -74
  199. package/worker/actions/createUser/CreateUser.js.map +1 -1
  200. package/worker/actions/createUser/createUserAction.js +24 -28
  201. package/worker/actions/createUser/createUserAction.js.map +1 -1
  202. package/worker/actions/createUser/createUserSchema.js +13 -14
  203. package/worker/actions/createUser/createUserSchema.js.map +1 -1
  204. package/worker/actions/createUser/types.js +0 -3
  205. package/worker/actions/deleteFile/DeleteFile.js +52 -67
  206. package/worker/actions/deleteFile/DeleteFile.js.map +1 -1
  207. package/worker/actions/deleteFile/deleteFileAction.js +21 -29
  208. package/worker/actions/deleteFile/deleteFileAction.js.map +1 -1
  209. package/worker/actions/deleteFile/deleteFileSchema.js +13 -14
  210. package/worker/actions/deleteFile/deleteFileSchema.js.map +1 -1
  211. package/worker/actions/deleteFile/types.js +0 -3
  212. package/worker/actions/deleteUser/DeleteUser.js +38 -52
  213. package/worker/actions/deleteUser/DeleteUser.js.map +1 -1
  214. package/worker/actions/deleteUser/deleteUserAction.js +22 -26
  215. package/worker/actions/deleteUser/deleteUserAction.js.map +1 -1
  216. package/worker/actions/deleteUser/deleteUserSchema.js +12 -13
  217. package/worker/actions/deleteUser/deleteUserSchema.js.map +1 -1
  218. package/worker/actions/deleteUser/types.js +0 -3
  219. package/worker/actions/logValidationError.js +5 -6
  220. package/worker/actions/logValidationError.js.map +1 -1
  221. package/worker/actions/removeCognitoUserAttributes.js +9 -15
  222. package/worker/actions/removeCognitoUserAttributes.js.map +1 -1
  223. package/worker/actions/updateUser/UpdateUser.js +48 -65
  224. package/worker/actions/updateUser/UpdateUser.js.map +1 -1
  225. package/worker/actions/updateUser/types.js +0 -3
  226. package/worker/actions/updateUser/updateUserAction.js +24 -28
  227. package/worker/actions/updateUser/updateUserAction.js.map +1 -1
  228. package/worker/actions/updateUser/updateUserSchema.js +13 -14
  229. package/worker/actions/updateUser/updateUserSchema.js.map +1 -1
  230. package/worker/handler/WorkerActionHandler.js +19 -21
  231. package/worker/handler/WorkerActionHandler.js.map +1 -1
  232. package/worker/plugins/WorkerActionPlugin.js +17 -16
  233. package/worker/plugins/WorkerActionPlugin.js.map +1 -1
  234. package/worker/types.js +0 -3
  235. package/index.js.map +0 -1
  236. package/resolver/app/abstractions/RecordHandler.js.map +0 -1
  237. package/resolver/app/abstractions/RecordsValidation.js.map +0 -1
  238. package/resolver/app/abstractions/ResolverApplication.js.map +0 -1
  239. package/resolver/app/abstractions/ResolverRecord.js.map +0 -1
  240. package/resolver/app/bundler/types.js.map +0 -1
  241. package/resolver/app/data/types.js.map +0 -1
  242. package/resolver/app/fetcher/types.js.map +0 -1
  243. package/resolver/app/ingestor/types.js.map +0 -1
  244. package/resolver/app/storer/types.js.map +0 -1
  245. package/resolver/createEventHandlerPlugin.d.ts +0 -11
  246. package/resolver/createEventHandlerPlugin.js +0 -120
  247. package/resolver/createEventHandlerPlugin.js.map +0 -1
  248. package/resolver/createResolverHandler.d.ts +0 -21
  249. package/resolver/createResolverHandler.js +0 -72
  250. package/resolver/createResolverHandler.js.map +0 -1
  251. package/resolver/deployment/types.js.map +0 -1
  252. package/resolver/recordTypes/fileManager/types.js.map +0 -1
  253. package/resolver/recordTypes/users/types.js.map +0 -1
  254. package/sync/createSendDataToEventBridgeOnRequestEnd.d.ts +0 -2
  255. package/sync/createSendDataToEventBridgeOnRequestEnd.js +0 -44
  256. package/sync/createSendDataToEventBridgeOnRequestEnd.js.map +0 -1
  257. package/sync/createSyncSystem.d.ts +0 -16
  258. package/sync/createSyncSystem.js +0 -35
  259. package/sync/createSyncSystem.js.map +0 -1
  260. package/sync/handler/types.js.map +0 -1
  261. package/sync/requestPlugin.d.ts +0 -9
  262. package/sync/requestPlugin.js +0 -58
  263. package/sync/requestPlugin.js.map +0 -1
  264. package/sync/types.js.map +0 -1
  265. package/worker/actions/copyFile/types.js.map +0 -1
  266. package/worker/actions/createUser/types.js.map +0 -1
  267. package/worker/actions/deleteFile/types.js.map +0 -1
  268. package/worker/actions/deleteUser/types.js.map +0 -1
  269. package/worker/actions/updateUser/types.js.map +0 -1
  270. package/worker/createWorkerHandler.d.ts +0 -11
  271. package/worker/createWorkerHandler.js +0 -41
  272. package/worker/createWorkerHandler.js.map +0 -1
  273. package/worker/handler/eventHandler.d.ts +0 -1
  274. package/worker/handler/eventHandler.js +0 -24
  275. package/worker/handler/eventHandler.js.map +0 -1
  276. package/worker/types.js.map +0 -1
@@ -1,35 +1,33 @@
1
- export class SourceDataContainer {
2
- items = {};
3
- constructor() {
4
- // block
5
- }
6
- static create() {
7
- return new SourceDataContainer();
8
- }
9
- get(input) {
10
- const key = this.createKey(input);
11
- const item = this.items[key];
12
- return item?.data || null;
13
- }
14
- add(item, data) {
15
- const key = this.createKey(item);
16
- if (this.items[key]) {
17
- return;
1
+ class SourceDataContainer {
2
+ constructor(){
3
+ this.items = {};
18
4
  }
19
- this.items[key] = {
20
- ...item,
21
- data
22
- };
23
- }
24
- merge(container) {
25
- for (const key in container.items) {
26
- const item = container.items[key];
27
- this.add(item, item.data);
5
+ static create() {
6
+ return new SourceDataContainer();
7
+ }
8
+ get(input) {
9
+ const key = this.createKey(input);
10
+ const item = this.items[key];
11
+ return item?.data || null;
12
+ }
13
+ add(item, data) {
14
+ const key = this.createKey(item);
15
+ if (this.items[key]) return;
16
+ this.items[key] = {
17
+ ...item,
18
+ data
19
+ };
20
+ }
21
+ merge(container) {
22
+ for(const key in container.items){
23
+ const item = container.items[key];
24
+ this.add(item, item.data);
25
+ }
26
+ }
27
+ createKey(item) {
28
+ return `${item.source.name}#${item.table.name}#${item.PK}#${item.SK}`;
28
29
  }
29
- }
30
- createKey(item) {
31
- return `${item.source.name}#${item.table.name}#${item.PK}#${item.SK}`;
32
- }
33
30
  }
31
+ export { SourceDataContainer };
34
32
 
35
33
  //# sourceMappingURL=SourceDataContainer.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["SourceDataContainer","items","constructor","create","get","input","key","createKey","item","data","add","merge","container","source","name","table","PK","SK"],"sources":["SourceDataContainer.ts"],"sourcesContent":["import type { GenericRecord } from \"@webiny/api/types.js\";\nimport type { IInputItem, IItem, ISourceDataContainer } from \"~/resolver/app/data/types.js\";\nimport type { IStoreItem } from \"~/resolver/app/storer/types.js\";\n\nexport class SourceDataContainer implements ISourceDataContainer {\n public readonly items: GenericRecord<string, IItem> = {};\n\n private constructor() {\n // block\n }\n\n public static create(): ISourceDataContainer {\n return new SourceDataContainer();\n }\n\n public get(input: IInputItem): IStoreItem | null {\n const key = this.createKey(input);\n const item = this.items[key];\n return item?.data || null;\n }\n\n public add(item: IInputItem, data: IStoreItem | null): void {\n const key = this.createKey(item);\n if (this.items[key]) {\n return;\n }\n\n this.items[key] = {\n ...item,\n data\n };\n }\n\n public merge(container: ISourceDataContainer): void {\n for (const key in container.items) {\n const item = container.items[key];\n this.add(item, item.data);\n }\n }\n\n private createKey(item: IInputItem): string {\n return `${item.source.name}#${item.table.name}#${item.PK}#${item.SK}`;\n }\n}\n"],"mappings":"AAIA,OAAO,MAAMA,mBAAmB,CAAiC;EAC7CC,KAAK,GAAiC,CAAC,CAAC;EAEhDC,WAAWA,CAAA,EAAG;IAClB;EAAA;EAGJ,OAAcC,MAAMA,CAAA,EAAyB;IACzC,OAAO,IAAIH,mBAAmB,CAAC,CAAC;EACpC;EAEOI,GAAGA,CAACC,KAAiB,EAAqB;IAC7C,MAAMC,GAAG,GAAG,IAAI,CAACC,SAAS,CAACF,KAAK,CAAC;IACjC,MAAMG,IAAI,GAAG,IAAI,CAACP,KAAK,CAACK,GAAG,CAAC;IAC5B,OAAOE,IAAI,EAAEC,IAAI,IAAI,IAAI;EAC7B;EAEOC,GAAGA,CAACF,IAAgB,EAAEC,IAAuB,EAAQ;IACxD,MAAMH,GAAG,GAAG,IAAI,CAACC,SAAS,CAACC,IAAI,CAAC;IAChC,IAAI,IAAI,CAACP,KAAK,CAACK,GAAG,CAAC,EAAE;MACjB;IACJ;IAEA,IAAI,CAACL,KAAK,CAACK,GAAG,CAAC,GAAG;MACd,GAAGE,IAAI;MACPC;IACJ,CAAC;EACL;EAEOE,KAAKA,CAACC,SAA+B,EAAQ;IAChD,KAAK,MAAMN,GAAG,IAAIM,SAAS,CAACX,KAAK,EAAE;MAC/B,MAAMO,IAAI,GAAGI,SAAS,CAACX,KAAK,CAACK,GAAG,CAAC;MACjC,IAAI,CAACI,GAAG,CAACF,IAAI,EAAEA,IAAI,CAACC,IAAI,CAAC;IAC7B;EACJ;EAEQF,SAASA,CAACC,IAAgB,EAAU;IACxC,OAAO,GAAGA,IAAI,CAACK,MAAM,CAACC,IAAI,IAAIN,IAAI,CAACO,KAAK,CAACD,IAAI,IAAIN,IAAI,CAACQ,EAAE,IAAIR,IAAI,CAACS,EAAE,EAAE;EACzE;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"resolver/app/data/SourceDataContainer.js","sources":["../../../../src/resolver/app/data/SourceDataContainer.ts"],"sourcesContent":["import type { GenericRecord } from \"@webiny/api/types.js\";\nimport type { IInputItem, IItem, ISourceDataContainer } from \"~/resolver/app/data/types.js\";\nimport type { IStoreItem } from \"~/resolver/app/storer/types.js\";\n\nexport class SourceDataContainer implements ISourceDataContainer {\n public readonly items: GenericRecord<string, IItem> = {};\n\n private constructor() {\n // block\n }\n\n public static create(): ISourceDataContainer {\n return new SourceDataContainer();\n }\n\n public get(input: IInputItem): IStoreItem | null {\n const key = this.createKey(input);\n const item = this.items[key];\n return item?.data || null;\n }\n\n public add(item: IInputItem, data: IStoreItem | null): void {\n const key = this.createKey(item);\n if (this.items[key]) {\n return;\n }\n\n this.items[key] = {\n ...item,\n data\n };\n }\n\n public merge(container: ISourceDataContainer): void {\n for (const key in container.items) {\n const item = container.items[key];\n this.add(item, item.data);\n }\n }\n\n private createKey(item: IInputItem): string {\n return `${item.source.name}#${item.table.name}#${item.PK}#${item.SK}`;\n }\n}\n"],"names":["SourceDataContainer","input","key","item","data","container"],"mappings":"AAIO,MAAMA;IAGT,aAAsB;aAFN,KAAK,GAAiC,CAAC;IAIvD;IAEA,OAAc,SAA+B;QACzC,OAAO,IAAIA;IACf;IAEO,IAAIC,KAAiB,EAAqB;QAC7C,MAAMC,MAAM,IAAI,CAAC,SAAS,CAACD;QAC3B,MAAME,OAAO,IAAI,CAAC,KAAK,CAACD,IAAI;QAC5B,OAAOC,MAAM,QAAQ;IACzB;IAEO,IAAIA,IAAgB,EAAEC,IAAuB,EAAQ;QACxD,MAAMF,MAAM,IAAI,CAAC,SAAS,CAACC;QAC3B,IAAI,IAAI,CAAC,KAAK,CAACD,IAAI,EACf;QAGJ,IAAI,CAAC,KAAK,CAACA,IAAI,GAAG;YACd,GAAGC,IAAI;YACPC;QACJ;IACJ;IAEO,MAAMC,SAA+B,EAAQ;QAChD,IAAK,MAAMH,OAAOG,UAAU,KAAK,CAAE;YAC/B,MAAMF,OAAOE,UAAU,KAAK,CAACH,IAAI;YACjC,IAAI,CAAC,GAAG,CAACC,MAAMA,KAAK,IAAI;QAC5B;IACJ;IAEQ,UAAUA,IAAgB,EAAU;QACxC,OAAO,GAAGA,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,EAAEA,KAAK,KAAK,CAAC,IAAI,CAAC,CAAC,EAAEA,KAAK,EAAE,CAAC,CAAC,EAAEA,KAAK,EAAE,EAAE;IACzE;AACJ"}
@@ -1,3 +0,0 @@
1
- export {};
2
-
3
- //# sourceMappingURL=types.js.map
@@ -1,123 +1,98 @@
1
1
  import { BatchGetCommand } from "@webiny/aws-sdk/client-dynamodb/index.js";
2
- import lodashChunk from "lodash/chunk.js";
2
+ import chunk from "lodash/chunk.js";
3
3
  import { SourceDataContainer } from "../data/SourceDataContainer.js";
4
4
  import { convertException } from "@webiny/utils";
5
5
  import { createRetry } from "../utils/Retry.js";
6
- export class Fetcher {
7
- constructor(params) {
8
- this.createDocumentClient = params.createDocumentClient;
9
- this.maxRetries = params.maxRetries || 10;
10
- this.retryDelay = params.retryDelay || 1000;
11
- }
12
- async exec(params) {
13
- const {
14
- deployment,
15
- items: input,
16
- table,
17
- maxBatchSize = 25
18
- } = params;
19
- if (input.length === 0) {
20
- return {
21
- items: SourceDataContainer.create()
22
- };
6
+ class Fetcher {
7
+ constructor(params){
8
+ this.createDocumentClient = params.createDocumentClient;
9
+ this.maxRetries = params.maxRetries || 10;
10
+ this.retryDelay = params.retryDelay || 1000;
23
11
  }
24
- const client = this.createDocumentClient(deployment);
25
- const results = await this.execute({
26
- client,
27
- table,
28
- maxBatchSize,
29
- records: input
30
- });
31
- const items = SourceDataContainer.create();
32
- for (const item of input) {
33
- const data = results.find(result => {
34
- return item.PK === result.PK && item.SK === result.SK;
35
- });
36
- items.add({
37
- PK: item.PK,
38
- SK: item.SK,
39
- table,
40
- source: deployment
41
- }, data || null);
12
+ async exec(params) {
13
+ const { deployment, items: input, table, maxBatchSize = 25 } = params;
14
+ if (0 === input.length) return {
15
+ items: SourceDataContainer.create()
16
+ };
17
+ const client = this.createDocumentClient(deployment);
18
+ const results = await this.execute({
19
+ client,
20
+ table,
21
+ maxBatchSize,
22
+ records: input
23
+ });
24
+ const items = SourceDataContainer.create();
25
+ for (const item of input){
26
+ const data = results.find((result)=>item.PK === result.PK && item.SK === result.SK);
27
+ items.add({
28
+ PK: item.PK,
29
+ SK: item.SK,
30
+ table,
31
+ source: deployment
32
+ }, data || null);
33
+ }
34
+ return {
35
+ items
36
+ };
42
37
  }
43
- return {
44
- items
45
- };
46
- }
47
- async execute(params) {
48
- const {
49
- client,
50
- table,
51
- records: items,
52
- maxBatchSize
53
- } = params;
54
- const batches = lodashChunk(items, maxBatchSize);
55
- const results = [];
56
- for (const batch of batches) {
57
- let keys = this.getKeys(batch);
58
- while (keys.length > 0) {
59
- const command = new BatchGetCommand({
60
- RequestItems: {
61
- [table.name]: {
62
- Keys: keys
38
+ async execute(params) {
39
+ const { client, table, records: items, maxBatchSize } = params;
40
+ const batches = chunk(items, maxBatchSize);
41
+ const results = [];
42
+ for (const batch of batches){
43
+ let keys = this.getKeys(batch);
44
+ while(keys.length > 0){
45
+ const command = new BatchGetCommand({
46
+ RequestItems: {
47
+ [table.name]: {
48
+ Keys: keys
49
+ }
50
+ }
51
+ });
52
+ const { items, unprocessedKeys } = await this.runCommand({
53
+ command,
54
+ client,
55
+ table: table.name
56
+ });
57
+ results.push(...items);
58
+ keys = unprocessedKeys;
63
59
  }
64
- }
60
+ }
61
+ return results;
62
+ }
63
+ async runCommand(params) {
64
+ const { command, table, client } = params;
65
+ const retry = createRetry({
66
+ maxRetries: this.maxRetries,
67
+ retryDelay: this.retryDelay
65
68
  });
66
- const {
67
- items,
68
- unprocessedKeys
69
- } = await this.runCommand({
70
- command,
71
- client,
72
- table: table.name
69
+ return await retry.retry(async ()=>{
70
+ const result = await client.send(command);
71
+ return {
72
+ items: result.Responses?.[table] || [],
73
+ unprocessedKeys: result.UnprocessedKeys?.[table]?.Keys || []
74
+ };
75
+ }, {
76
+ onFail: (ex)=>{
77
+ console.error(`Max retries reached. Could not fetch items from table: ${table}`);
78
+ console.log(convertException(ex));
79
+ console.log(JSON.stringify(command));
80
+ }
73
81
  });
74
- results.push(...items);
75
- keys = unprocessedKeys;
76
- }
77
82
  }
78
- return results;
79
- }
80
- async runCommand(params) {
81
- const {
82
- command,
83
- table,
84
- client
85
- } = params;
86
- const retry = createRetry({
87
- maxRetries: this.maxRetries,
88
- retryDelay: this.retryDelay
89
- });
90
- return await retry.retry(async () => {
91
- const result = await client.send(command);
92
- return {
93
- items: result.Responses?.[table] || [],
94
- unprocessedKeys: result.UnprocessedKeys?.[table]?.Keys || []
95
- };
96
- }, {
97
- onFail: ex => {
98
- console.error(`Max retries reached. Could not fetch items from table: ${table}`);
99
- console.log(convertException(ex));
100
- console.log(JSON.stringify(command));
101
- }
102
- });
103
- }
104
- getKeys(items) {
105
- const keys = new Map();
106
- for (const item of items) {
107
- const key = `PK:${item.PK}#SK:${item.SK}`;
108
- if (keys.has(key)) {
109
- continue;
110
- }
111
- keys.set(key, {
112
- PK: item.PK,
113
- SK: item.SK
114
- });
83
+ getKeys(items) {
84
+ const keys = new Map();
85
+ for (const item of items){
86
+ const key = `PK:${item.PK}#SK:${item.SK}`;
87
+ if (!keys.has(key)) keys.set(key, {
88
+ PK: item.PK,
89
+ SK: item.SK
90
+ });
91
+ }
92
+ return Array.from(keys.values());
115
93
  }
116
- return Array.from(keys.values());
117
- }
118
94
  }
119
- export const createFetcher = params => {
120
- return new Fetcher(params);
121
- };
95
+ const createFetcher = (params)=>new Fetcher(params);
96
+ export { Fetcher, createFetcher };
122
97
 
123
98
  //# sourceMappingURL=Fetcher.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["BatchGetCommand","lodashChunk","SourceDataContainer","convertException","createRetry","Fetcher","constructor","params","createDocumentClient","maxRetries","retryDelay","exec","deployment","items","input","table","maxBatchSize","length","create","client","results","execute","records","item","data","find","result","PK","SK","add","source","batches","batch","keys","getKeys","command","RequestItems","name","Keys","unprocessedKeys","runCommand","push","retry","send","Responses","UnprocessedKeys","onFail","ex","console","error","log","JSON","stringify","Map","key","has","set","Array","from","values","createFetcher"],"sources":["Fetcher.ts"],"sourcesContent":["import type { IFetcher, IFetcherExecParams, IFetcherExecResult } from \"./types.js\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport { BatchGetCommand } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport lodashChunk from \"lodash/chunk.js\";\nimport type { IDeployment } from \"~/resolver/deployment/types.js\";\nimport { SourceDataContainer } from \"~/resolver/app/data/SourceDataContainer.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport { convertException } from \"@webiny/utils\";\nimport type { IStoreItem } from \"~/resolver/app/storer/types.js\";\nimport type { ITable } from \"~/sync/types.js\";\nimport { createRetry } from \"~/resolver/app/utils/Retry.js\";\n\nexport interface IFetcherParamsCreateDocumentClientCallable {\n (deployment: Pick<IDeployment, \"region\">): Pick<DynamoDBDocument, \"send\">;\n}\n\nexport interface IFetcherParams {\n maxRetries?: number;\n retryDelay?: number;\n createDocumentClient: IFetcherParamsCreateDocumentClientCallable;\n}\n\ninterface IKeys {\n PK: string;\n SK: string;\n}\n\ninterface IFetcherExecuteRunCommandParams {\n command: BatchGetCommand;\n table: string;\n client: Pick<DynamoDBDocument, \"send\">;\n}\n\ninterface IFetcherExecuteRunCommandResult<T = GenericRecord> {\n items: T[];\n unprocessedKeys: IKeys[];\n}\n\ninterface IFetchExecuteExecuteParamsItem {\n PK: string;\n SK: string;\n}\n\ninterface IFetchExecuteExecuteParams {\n maxBatchSize: number;\n client: Pick<DynamoDBDocument, \"send\">;\n table: ITable;\n records: IFetchExecuteExecuteParamsItem[];\n}\n\nexport class Fetcher implements IFetcher {\n private readonly createDocumentClient: IFetcherParamsCreateDocumentClientCallable;\n private readonly maxRetries: number;\n private readonly retryDelay: number;\n\n public constructor(params: IFetcherParams) {\n this.createDocumentClient = params.createDocumentClient;\n this.maxRetries = params.maxRetries || 10;\n this.retryDelay = params.retryDelay || 1000;\n }\n\n public async exec(params: IFetcherExecParams): Promise<IFetcherExecResult> {\n const { deployment, items: input, table, maxBatchSize = 25 } = params;\n if (input.length === 0) {\n return {\n items: SourceDataContainer.create()\n };\n }\n\n const client = this.createDocumentClient(deployment);\n\n const results = await this.execute({\n client,\n table,\n maxBatchSize,\n records: input\n });\n\n const items = SourceDataContainer.create();\n\n for (const item of input) {\n const data = results.find(result => {\n return item.PK === result.PK && item.SK === result.SK;\n });\n items.add(\n {\n PK: item.PK,\n SK: item.SK,\n table,\n source: deployment\n },\n data || null\n );\n }\n\n return {\n items\n };\n }\n\n private async execute<T = IStoreItem>(params: IFetchExecuteExecuteParams) {\n const { client, table, records: items, maxBatchSize } = params;\n const batches = lodashChunk(items, maxBatchSize);\n\n const results: T[] = [];\n for (const batch of batches) {\n let keys = this.getKeys(batch);\n\n while (keys.length > 0) {\n const command = new BatchGetCommand({\n RequestItems: {\n [table.name]: {\n Keys: keys\n }\n }\n });\n const { items, unprocessedKeys } = await this.runCommand<T>({\n command,\n client,\n table: table.name\n });\n\n results.push(...items);\n\n keys = unprocessedKeys;\n }\n }\n return results;\n }\n\n private async runCommand<T = GenericRecord>(\n params: IFetcherExecuteRunCommandParams\n ): Promise<IFetcherExecuteRunCommandResult<T>> {\n const { command, table, client } = params;\n\n const retry = createRetry({\n maxRetries: this.maxRetries,\n retryDelay: this.retryDelay\n });\n\n return await retry.retry(\n async () => {\n const result = await client.send(command);\n\n return {\n items: (result.Responses?.[table] || []) as T[],\n unprocessedKeys: (result.UnprocessedKeys?.[table]?.Keys || []) as IKeys[]\n };\n },\n {\n onFail: ex => {\n console.error(\n `Max retries reached. Could not fetch items from table: ${table}`\n );\n console.log(convertException(ex));\n console.log(JSON.stringify(command));\n }\n }\n );\n }\n\n private getKeys(items: IFetchExecuteExecuteParamsItem[]): IKeys[] {\n const keys = new Map<string, IKeys>();\n\n for (const item of items) {\n const key = `PK:${item.PK}#SK:${item.SK}`;\n if (keys.has(key)) {\n continue;\n }\n keys.set(key, {\n PK: item.PK,\n SK: item.SK\n });\n }\n\n return Array.from(keys.values());\n }\n}\n\nexport const createFetcher = (params: IFetcherParams): IFetcher => {\n return new Fetcher(params);\n};\n"],"mappings":"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","ignoreList":[]}
1
+ {"version":3,"file":"resolver/app/fetcher/Fetcher.js","sources":["../../../../src/resolver/app/fetcher/Fetcher.ts"],"sourcesContent":["import type { IFetcher, IFetcherExecParams, IFetcherExecResult } from \"./types.js\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport { BatchGetCommand } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport lodashChunk from \"lodash/chunk.js\";\nimport type { IDeployment } from \"~/resolver/deployment/types.js\";\nimport { SourceDataContainer } from \"~/resolver/app/data/SourceDataContainer.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport { convertException } from \"@webiny/utils\";\nimport type { IStoreItem } from \"~/resolver/app/storer/types.js\";\nimport type { ITable } from \"~/sync/types.js\";\nimport { createRetry } from \"~/resolver/app/utils/Retry.js\";\n\nexport interface IFetcherParamsCreateDocumentClientCallable {\n (deployment: Pick<IDeployment, \"region\">): Pick<DynamoDBDocument, \"send\">;\n}\n\nexport interface IFetcherParams {\n maxRetries?: number;\n retryDelay?: number;\n createDocumentClient: IFetcherParamsCreateDocumentClientCallable;\n}\n\ninterface IKeys {\n PK: string;\n SK: string;\n}\n\ninterface IFetcherExecuteRunCommandParams {\n command: BatchGetCommand;\n table: string;\n client: Pick<DynamoDBDocument, \"send\">;\n}\n\ninterface IFetcherExecuteRunCommandResult<T = GenericRecord> {\n items: T[];\n unprocessedKeys: IKeys[];\n}\n\ninterface IFetchExecuteExecuteParamsItem {\n PK: string;\n SK: string;\n}\n\ninterface IFetchExecuteExecuteParams {\n maxBatchSize: number;\n client: Pick<DynamoDBDocument, \"send\">;\n table: ITable;\n records: IFetchExecuteExecuteParamsItem[];\n}\n\nexport class Fetcher implements IFetcher {\n private readonly createDocumentClient: IFetcherParamsCreateDocumentClientCallable;\n private readonly maxRetries: number;\n private readonly retryDelay: number;\n\n public constructor(params: IFetcherParams) {\n this.createDocumentClient = params.createDocumentClient;\n this.maxRetries = params.maxRetries || 10;\n this.retryDelay = params.retryDelay || 1000;\n }\n\n public async exec(params: IFetcherExecParams): Promise<IFetcherExecResult> {\n const { deployment, items: input, table, maxBatchSize = 25 } = params;\n if (input.length === 0) {\n return {\n items: SourceDataContainer.create()\n };\n }\n\n const client = this.createDocumentClient(deployment);\n\n const results = await this.execute({\n client,\n table,\n maxBatchSize,\n records: input\n });\n\n const items = SourceDataContainer.create();\n\n for (const item of input) {\n const data = results.find(result => {\n return item.PK === result.PK && item.SK === result.SK;\n });\n items.add(\n {\n PK: item.PK,\n SK: item.SK,\n table,\n source: deployment\n },\n data || null\n );\n }\n\n return {\n items\n };\n }\n\n private async execute<T = IStoreItem>(params: IFetchExecuteExecuteParams) {\n const { client, table, records: items, maxBatchSize } = params;\n const batches = lodashChunk(items, maxBatchSize);\n\n const results: T[] = [];\n for (const batch of batches) {\n let keys = this.getKeys(batch);\n\n while (keys.length > 0) {\n const command = new BatchGetCommand({\n RequestItems: {\n [table.name]: {\n Keys: keys\n }\n }\n });\n const { items, unprocessedKeys } = await this.runCommand<T>({\n command,\n client,\n table: table.name\n });\n\n results.push(...items);\n\n keys = unprocessedKeys;\n }\n }\n return results;\n }\n\n private async runCommand<T = GenericRecord>(\n params: IFetcherExecuteRunCommandParams\n ): Promise<IFetcherExecuteRunCommandResult<T>> {\n const { command, table, client } = params;\n\n const retry = createRetry({\n maxRetries: this.maxRetries,\n retryDelay: this.retryDelay\n });\n\n return await retry.retry(\n async () => {\n const result = await client.send(command);\n\n return {\n items: (result.Responses?.[table] || []) as T[],\n unprocessedKeys: (result.UnprocessedKeys?.[table]?.Keys || []) as IKeys[]\n };\n },\n {\n onFail: ex => {\n console.error(\n `Max retries reached. Could not fetch items from table: ${table}`\n );\n console.log(convertException(ex));\n console.log(JSON.stringify(command));\n }\n }\n );\n }\n\n private getKeys(items: IFetchExecuteExecuteParamsItem[]): IKeys[] {\n const keys = new Map<string, IKeys>();\n\n for (const item of items) {\n const key = `PK:${item.PK}#SK:${item.SK}`;\n if (keys.has(key)) {\n continue;\n }\n keys.set(key, {\n PK: item.PK,\n SK: item.SK\n });\n }\n\n return Array.from(keys.values());\n }\n}\n\nexport const createFetcher = (params: IFetcherParams): IFetcher => {\n return new Fetcher(params);\n};\n"],"names":["Fetcher","params","deployment","input","table","maxBatchSize","SourceDataContainer","client","results","items","item","data","result","batches","lodashChunk","batch","keys","command","BatchGetCommand","unprocessedKeys","retry","createRetry","ex","console","convertException","JSON","Map","key","Array","createFetcher"],"mappings":";;;;;AAkDO,MAAMA;IAKT,YAAmBC,MAAsB,CAAE;QACvC,IAAI,CAAC,oBAAoB,GAAGA,OAAO,oBAAoB;QACvD,IAAI,CAAC,UAAU,GAAGA,OAAO,UAAU,IAAI;QACvC,IAAI,CAAC,UAAU,GAAGA,OAAO,UAAU,IAAI;IAC3C;IAEA,MAAa,KAAKA,MAA0B,EAA+B;QACvE,MAAM,EAAEC,UAAU,EAAE,OAAOC,KAAK,EAAEC,KAAK,EAAEC,eAAe,EAAE,EAAE,GAAGJ;QAC/D,IAAIE,AAAiB,MAAjBA,MAAM,MAAM,EACZ,OAAO;YACH,OAAOG,oBAAoB,MAAM;QACrC;QAGJ,MAAMC,SAAS,IAAI,CAAC,oBAAoB,CAACL;QAEzC,MAAMM,UAAU,MAAM,IAAI,CAAC,OAAO,CAAC;YAC/BD;YACAH;YACAC;YACA,SAASF;QACb;QAEA,MAAMM,QAAQH,oBAAoB,MAAM;QAExC,KAAK,MAAMI,QAAQP,MAAO;YACtB,MAAMQ,OAAOH,QAAQ,IAAI,CAACI,CAAAA,SACfF,KAAK,EAAE,KAAKE,OAAO,EAAE,IAAIF,KAAK,EAAE,KAAKE,OAAO,EAAE;YAEzDH,MAAM,GAAG,CACL;gBACI,IAAIC,KAAK,EAAE;gBACX,IAAIA,KAAK,EAAE;gBACXN;gBACA,QAAQF;YACZ,GACAS,QAAQ;QAEhB;QAEA,OAAO;YACHF;QACJ;IACJ;IAEA,MAAc,QAAwBR,MAAkC,EAAE;QACtE,MAAM,EAAEM,MAAM,EAAEH,KAAK,EAAE,SAASK,KAAK,EAAEJ,YAAY,EAAE,GAAGJ;QACxD,MAAMY,UAAUC,MAAYL,OAAOJ;QAEnC,MAAMG,UAAe,EAAE;QACvB,KAAK,MAAMO,SAASF,QAAS;YACzB,IAAIG,OAAO,IAAI,CAAC,OAAO,CAACD;YAExB,MAAOC,KAAK,MAAM,GAAG,EAAG;gBACpB,MAAMC,UAAU,IAAIC,gBAAgB;oBAChC,cAAc;wBACV,CAACd,MAAM,IAAI,CAAC,EAAE;4BACV,MAAMY;wBACV;oBACJ;gBACJ;gBACA,MAAM,EAAEP,KAAK,EAAEU,eAAe,EAAE,GAAG,MAAM,IAAI,CAAC,UAAU,CAAI;oBACxDF;oBACAV;oBACA,OAAOH,MAAM,IAAI;gBACrB;gBAEAI,QAAQ,IAAI,IAAIC;gBAEhBO,OAAOG;YACX;QACJ;QACA,OAAOX;IACX;IAEA,MAAc,WACVP,MAAuC,EACI;QAC3C,MAAM,EAAEgB,OAAO,EAAEb,KAAK,EAAEG,MAAM,EAAE,GAAGN;QAEnC,MAAMmB,QAAQC,YAAY;YACtB,YAAY,IAAI,CAAC,UAAU;YAC3B,YAAY,IAAI,CAAC,UAAU;QAC/B;QAEA,OAAO,MAAMD,MAAM,KAAK,CACpB;YACI,MAAMR,SAAS,MAAML,OAAO,IAAI,CAACU;YAEjC,OAAO;gBACH,OAAQL,OAAO,SAAS,EAAE,CAACR,MAAM,IAAI,EAAE;gBACvC,iBAAkBQ,OAAO,eAAe,EAAE,CAACR,MAAM,EAAE,QAAQ,EAAE;YACjE;QACJ,GACA;YACI,QAAQkB,CAAAA;gBACJC,QAAQ,KAAK,CACT,CAAC,uDAAuD,EAAEnB,OAAO;gBAErEmB,QAAQ,GAAG,CAACC,iBAAiBF;gBAC7BC,QAAQ,GAAG,CAACE,KAAK,SAAS,CAACR;YAC/B;QACJ;IAER;IAEQ,QAAQR,KAAuC,EAAW;QAC9D,MAAMO,OAAO,IAAIU;QAEjB,KAAK,MAAMhB,QAAQD,MAAO;YACtB,MAAMkB,MAAM,CAAC,GAAG,EAAEjB,KAAK,EAAE,CAAC,IAAI,EAAEA,KAAK,EAAE,EAAE;YACzC,KAAIM,KAAK,GAAG,CAACW,MAGbX,KAAK,GAAG,CAACW,KAAK;gBACV,IAAIjB,KAAK,EAAE;gBACX,IAAIA,KAAK,EAAE;YACf;QACJ;QAEA,OAAOkB,MAAM,IAAI,CAACZ,KAAK,MAAM;IACjC;AACJ;AAEO,MAAMa,gBAAgB,CAAC5B,SACnB,IAAID,QAAQC"}
@@ -1,3 +0,0 @@
1
- export {};
2
-
3
- //# sourceMappingURL=types.js.map
@@ -1,36 +1,31 @@
1
- export class Ingestor {
2
- constructor(params) {
3
- this.createIngestorResult = params.createIngestorResult;
4
- this.getSource = params.getSource;
5
- }
6
- async ingest(params) {
7
- const {
8
- records
9
- } = params;
10
- const result = this.createIngestorResult();
11
- for (const record of records) {
12
- const detail = record.body.detail;
13
- const source = this.getSource(detail.source.name);
14
- if (!source) {
15
- console.error(`Could not find deployment for SQS Record source: ${detail.source.name}. More info in next log line.`);
16
- console.log(JSON.stringify({
17
- source: detail.source,
18
- items: detail.items
19
- }));
20
- continue;
21
- }
22
- for (const item of detail.items) {
23
- result.add({
24
- item,
25
- source
26
- });
27
- }
1
+ class Ingestor {
2
+ constructor(params){
3
+ this.createIngestorResult = params.createIngestorResult;
4
+ this.getSource = params.getSource;
5
+ }
6
+ async ingest(params) {
7
+ const { records } = params;
8
+ const result = this.createIngestorResult();
9
+ for (const record of records){
10
+ const detail = record.body.detail;
11
+ const source = this.getSource(detail.source.name);
12
+ if (!source) {
13
+ console.error(`Could not find deployment for SQS Record source: ${detail.source.name}. More info in next log line.`);
14
+ console.log(JSON.stringify({
15
+ source: detail.source,
16
+ items: detail.items
17
+ }));
18
+ continue;
19
+ }
20
+ for (const item of detail.items)result.add({
21
+ item,
22
+ source
23
+ });
24
+ }
25
+ return result;
28
26
  }
29
- return result;
30
- }
31
27
  }
32
- export const createIngestor = params => {
33
- return new Ingestor(params);
34
- };
28
+ const createIngestor = (params)=>new Ingestor(params);
29
+ export { Ingestor, createIngestor };
35
30
 
36
31
  //# sourceMappingURL=Ingestor.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Ingestor","constructor","params","createIngestorResult","getSource","ingest","records","result","record","detail","body","source","name","console","error","log","JSON","stringify","items","item","add","createIngestor"],"sources":["Ingestor.ts"],"sourcesContent":["import type { IIngestor, IIngestorIngestParams, IIngestorResult } from \"./types.js\";\nimport type { IDeployment } from \"~/resolver/deployment/types.js\";\n\nexport interface IIngestorParams {\n createIngestorResult: () => IIngestorResult;\n getSource: (name: string) => IDeployment | null;\n}\n\nexport class Ingestor implements IIngestor {\n private readonly createIngestorResult: () => IIngestorResult;\n private readonly getSource: (name: string) => IDeployment | null;\n\n public constructor(params: IIngestorParams) {\n this.createIngestorResult = params.createIngestorResult;\n this.getSource = params.getSource;\n }\n\n public async ingest(params: IIngestorIngestParams): Promise<IIngestorResult> {\n const { records } = params;\n\n const result = this.createIngestorResult();\n\n for (const record of records) {\n const detail = record.body.detail;\n const source = this.getSource(detail.source.name);\n if (!source) {\n console.error(\n `Could not find deployment for SQS Record source: ${detail.source.name}. More info in next log line.`\n );\n console.log(\n JSON.stringify({\n source: detail.source,\n items: detail.items\n })\n );\n continue;\n }\n\n for (const item of detail.items) {\n result.add({\n item,\n source\n });\n }\n }\n\n return result;\n }\n}\n\nexport const createIngestor = (params: IIngestorParams): IIngestor => {\n return new Ingestor(params);\n};\n"],"mappings":"AAQA,OAAO,MAAMA,QAAQ,CAAsB;EAIhCC,WAAWA,CAACC,MAAuB,EAAE;IACxC,IAAI,CAACC,oBAAoB,GAAGD,MAAM,CAACC,oBAAoB;IACvD,IAAI,CAACC,SAAS,GAAGF,MAAM,CAACE,SAAS;EACrC;EAEA,MAAaC,MAAMA,CAACH,MAA6B,EAA4B;IACzE,MAAM;MAAEI;IAAQ,CAAC,GAAGJ,MAAM;IAE1B,MAAMK,MAAM,GAAG,IAAI,CAACJ,oBAAoB,CAAC,CAAC;IAE1C,KAAK,MAAMK,MAAM,IAAIF,OAAO,EAAE;MAC1B,MAAMG,MAAM,GAAGD,MAAM,CAACE,IAAI,CAACD,MAAM;MACjC,MAAME,MAAM,GAAG,IAAI,CAACP,SAAS,CAACK,MAAM,CAACE,MAAM,CAACC,IAAI,CAAC;MACjD,IAAI,CAACD,MAAM,EAAE;QACTE,OAAO,CAACC,KAAK,CACT,oDAAoDL,MAAM,CAACE,MAAM,CAACC,IAAI,+BAC1E,CAAC;QACDC,OAAO,CAACE,GAAG,CACPC,IAAI,CAACC,SAAS,CAAC;UACXN,MAAM,EAAEF,MAAM,CAACE,MAAM;UACrBO,KAAK,EAAET,MAAM,CAACS;QAClB,CAAC,CACL,CAAC;QACD;MACJ;MAEA,KAAK,MAAMC,IAAI,IAAIV,MAAM,CAACS,KAAK,EAAE;QAC7BX,MAAM,CAACa,GAAG,CAAC;UACPD,IAAI;UACJR;QACJ,CAAC,CAAC;MACN;IACJ;IAEA,OAAOJ,MAAM;EACjB;AACJ;AAEA,OAAO,MAAMc,cAAc,GAAInB,MAAuB,IAAgB;EAClE,OAAO,IAAIF,QAAQ,CAACE,MAAM,CAAC;AAC/B,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"resolver/app/ingestor/Ingestor.js","sources":["../../../../src/resolver/app/ingestor/Ingestor.ts"],"sourcesContent":["import type { IIngestor, IIngestorIngestParams, IIngestorResult } from \"./types.js\";\nimport type { IDeployment } from \"~/resolver/deployment/types.js\";\n\nexport interface IIngestorParams {\n createIngestorResult: () => IIngestorResult;\n getSource: (name: string) => IDeployment | null;\n}\n\nexport class Ingestor implements IIngestor {\n private readonly createIngestorResult: () => IIngestorResult;\n private readonly getSource: (name: string) => IDeployment | null;\n\n public constructor(params: IIngestorParams) {\n this.createIngestorResult = params.createIngestorResult;\n this.getSource = params.getSource;\n }\n\n public async ingest(params: IIngestorIngestParams): Promise<IIngestorResult> {\n const { records } = params;\n\n const result = this.createIngestorResult();\n\n for (const record of records) {\n const detail = record.body.detail;\n const source = this.getSource(detail.source.name);\n if (!source) {\n console.error(\n `Could not find deployment for SQS Record source: ${detail.source.name}. More info in next log line.`\n );\n console.log(\n JSON.stringify({\n source: detail.source,\n items: detail.items\n })\n );\n continue;\n }\n\n for (const item of detail.items) {\n result.add({\n item,\n source\n });\n }\n }\n\n return result;\n }\n}\n\nexport const createIngestor = (params: IIngestorParams): IIngestor => {\n return new Ingestor(params);\n};\n"],"names":["Ingestor","params","records","result","record","detail","source","console","JSON","item","createIngestor"],"mappings":"AAQO,MAAMA;IAIT,YAAmBC,MAAuB,CAAE;QACxC,IAAI,CAAC,oBAAoB,GAAGA,OAAO,oBAAoB;QACvD,IAAI,CAAC,SAAS,GAAGA,OAAO,SAAS;IACrC;IAEA,MAAa,OAAOA,MAA6B,EAA4B;QACzE,MAAM,EAAEC,OAAO,EAAE,GAAGD;QAEpB,MAAME,SAAS,IAAI,CAAC,oBAAoB;QAExC,KAAK,MAAMC,UAAUF,QAAS;YAC1B,MAAMG,SAASD,OAAO,IAAI,CAAC,MAAM;YACjC,MAAME,SAAS,IAAI,CAAC,SAAS,CAACD,OAAO,MAAM,CAAC,IAAI;YAChD,IAAI,CAACC,QAAQ;gBACTC,QAAQ,KAAK,CACT,CAAC,iDAAiD,EAAEF,OAAO,MAAM,CAAC,IAAI,CAAC,6BAA6B,CAAC;gBAEzGE,QAAQ,GAAG,CACPC,KAAK,SAAS,CAAC;oBACX,QAAQH,OAAO,MAAM;oBACrB,OAAOA,OAAO,KAAK;gBACvB;gBAEJ;YACJ;YAEA,KAAK,MAAMI,QAAQJ,OAAO,KAAK,CAC3BF,OAAO,GAAG,CAAC;gBACPM;gBACAH;YACJ;QAER;QAEA,OAAOH;IACX;AACJ;AAEO,MAAMO,iBAAiB,CAACT,SACpB,IAAID,SAASC"}
@@ -1,37 +1,33 @@
1
- export class IngestorResult {
2
- items = new Map();
3
- add(params) {
4
- const {
5
- item,
6
- source
7
- } = params;
8
- let table;
9
- try {
10
- table = source.getTable(item.tableType);
11
- } catch {
12
- console.error(`Could not find table for SQS Record source: ${item.tableName} / ${item.tableType}. More info in next log line.`);
13
- console.log(JSON.stringify(item));
14
- return;
1
+ class IngestorResult {
2
+ add(params) {
3
+ const { item, source } = params;
4
+ let table;
5
+ try {
6
+ table = source.getTable(item.tableType);
7
+ } catch {
8
+ console.error(`Could not find table for SQS Record source: ${item.tableName} / ${item.tableType}. More info in next log line.`);
9
+ console.log(JSON.stringify(item));
10
+ return;
11
+ }
12
+ const command = "delete" === item.command ? "delete" : "put";
13
+ const key = `PK:${item.PK}#SK:${item.SK}#cmd:${command}#source:${source.name}`;
14
+ if (this.items.has(key)) return;
15
+ this.items.set(key, {
16
+ PK: item.PK,
17
+ SK: item.SK,
18
+ source,
19
+ command,
20
+ table
21
+ });
15
22
  }
16
- const command = item.command === "delete" ? "delete" : "put";
17
- const key = `PK:${item.PK}#SK:${item.SK}#cmd:${command}#source:${source.name}`;
18
- if (this.items.has(key)) {
19
- return;
23
+ getItems() {
24
+ return Array.from(this.items.values());
25
+ }
26
+ constructor(){
27
+ this.items = new Map();
20
28
  }
21
- this.items.set(key, {
22
- PK: item.PK,
23
- SK: item.SK,
24
- source,
25
- command,
26
- table
27
- });
28
- }
29
- getItems() {
30
- return Array.from(this.items.values());
31
- }
32
29
  }
33
- export const createIngestorResult = () => {
34
- return new IngestorResult();
35
- };
30
+ const createIngestorResult = ()=>new IngestorResult();
31
+ export { IngestorResult, createIngestorResult };
36
32
 
37
33
  //# sourceMappingURL=IngestorResult.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["IngestorResult","items","Map","add","params","item","source","table","getTable","tableType","console","error","tableName","log","JSON","stringify","command","key","PK","SK","name","has","set","getItems","Array","from","values","createIngestorResult"],"sources":["IngestorResult.ts"],"sourcesContent":["import type { IIngestorResult, IIngestorResultAddParams, IIngestorResultItem } from \"./types.js\";\nimport type { ITable } from \"~/sync/types.js\";\n\nexport class IngestorResult implements IIngestorResult {\n private readonly items: Map<string, IIngestorResultItem> = new Map();\n\n public add(params: IIngestorResultAddParams): void {\n const { item, source } = params;\n let table: ITable;\n try {\n table = source.getTable(item.tableType);\n } catch {\n console.error(\n `Could not find table for SQS Record source: ${item.tableName} / ${item.tableType}. More info in next log line.`\n );\n console.log(JSON.stringify(item));\n return;\n }\n\n const command = item.command === \"delete\" ? \"delete\" : \"put\";\n\n const key = `PK:${item.PK}#SK:${item.SK}#cmd:${command}#source:${source.name}`;\n\n if (this.items.has(key)) {\n return;\n }\n\n this.items.set(key, {\n PK: item.PK,\n SK: item.SK,\n source,\n command,\n table\n });\n }\n\n public getItems(): IIngestorResultItem[] {\n return Array.from(this.items.values());\n }\n}\n\nexport const createIngestorResult = (): IIngestorResult => {\n return new IngestorResult();\n};\n"],"mappings":"AAGA,OAAO,MAAMA,cAAc,CAA4B;EAClCC,KAAK,GAAqC,IAAIC,GAAG,CAAC,CAAC;EAE7DC,GAAGA,CAACC,MAAgC,EAAQ;IAC/C,MAAM;MAAEC,IAAI;MAAEC;IAAO,CAAC,GAAGF,MAAM;IAC/B,IAAIG,KAAa;IACjB,IAAI;MACAA,KAAK,GAAGD,MAAM,CAACE,QAAQ,CAACH,IAAI,CAACI,SAAS,CAAC;IAC3C,CAAC,CAAC,MAAM;MACJC,OAAO,CAACC,KAAK,CACT,+CAA+CN,IAAI,CAACO,SAAS,MAAMP,IAAI,CAACI,SAAS,+BACrF,CAAC;MACDC,OAAO,CAACG,GAAG,CAACC,IAAI,CAACC,SAAS,CAACV,IAAI,CAAC,CAAC;MACjC;IACJ;IAEA,MAAMW,OAAO,GAAGX,IAAI,CAACW,OAAO,KAAK,QAAQ,GAAG,QAAQ,GAAG,KAAK;IAE5D,MAAMC,GAAG,GAAG,MAAMZ,IAAI,CAACa,EAAE,OAAOb,IAAI,CAACc,EAAE,QAAQH,OAAO,WAAWV,MAAM,CAACc,IAAI,EAAE;IAE9E,IAAI,IAAI,CAACnB,KAAK,CAACoB,GAAG,CAACJ,GAAG,CAAC,EAAE;MACrB;IACJ;IAEA,IAAI,CAAChB,KAAK,CAACqB,GAAG,CAACL,GAAG,EAAE;MAChBC,EAAE,EAAEb,IAAI,CAACa,EAAE;MACXC,EAAE,EAAEd,IAAI,CAACc,EAAE;MACXb,MAAM;MACNU,OAAO;MACPT;IACJ,CAAC,CAAC;EACN;EAEOgB,QAAQA,CAAA,EAA0B;IACrC,OAAOC,KAAK,CAACC,IAAI,CAAC,IAAI,CAACxB,KAAK,CAACyB,MAAM,CAAC,CAAC,CAAC;EAC1C;AACJ;AAEA,OAAO,MAAMC,oBAAoB,GAAGA,CAAA,KAAuB;EACvD,OAAO,IAAI3B,cAAc,CAAC,CAAC;AAC/B,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"resolver/app/ingestor/IngestorResult.js","sources":["../../../../src/resolver/app/ingestor/IngestorResult.ts"],"sourcesContent":["import type { IIngestorResult, IIngestorResultAddParams, IIngestorResultItem } from \"./types.js\";\nimport type { ITable } from \"~/sync/types.js\";\n\nexport class IngestorResult implements IIngestorResult {\n private readonly items: Map<string, IIngestorResultItem> = new Map();\n\n public add(params: IIngestorResultAddParams): void {\n const { item, source } = params;\n let table: ITable;\n try {\n table = source.getTable(item.tableType);\n } catch {\n console.error(\n `Could not find table for SQS Record source: ${item.tableName} / ${item.tableType}. More info in next log line.`\n );\n console.log(JSON.stringify(item));\n return;\n }\n\n const command = item.command === \"delete\" ? \"delete\" : \"put\";\n\n const key = `PK:${item.PK}#SK:${item.SK}#cmd:${command}#source:${source.name}`;\n\n if (this.items.has(key)) {\n return;\n }\n\n this.items.set(key, {\n PK: item.PK,\n SK: item.SK,\n source,\n command,\n table\n });\n }\n\n public getItems(): IIngestorResultItem[] {\n return Array.from(this.items.values());\n }\n}\n\nexport const createIngestorResult = (): IIngestorResult => {\n return new IngestorResult();\n};\n"],"names":["IngestorResult","params","item","source","table","console","JSON","command","key","Array","Map","createIngestorResult"],"mappings":"AAGO,MAAMA;IAGF,IAAIC,MAAgC,EAAQ;QAC/C,MAAM,EAAEC,IAAI,EAAEC,MAAM,EAAE,GAAGF;QACzB,IAAIG;QACJ,IAAI;YACAA,QAAQD,OAAO,QAAQ,CAACD,KAAK,SAAS;QAC1C,EAAE,OAAM;YACJG,QAAQ,KAAK,CACT,CAAC,4CAA4C,EAAEH,KAAK,SAAS,CAAC,GAAG,EAAEA,KAAK,SAAS,CAAC,6BAA6B,CAAC;YAEpHG,QAAQ,GAAG,CAACC,KAAK,SAAS,CAACJ;YAC3B;QACJ;QAEA,MAAMK,UAAUL,AAAiB,aAAjBA,KAAK,OAAO,GAAgB,WAAW;QAEvD,MAAMM,MAAM,CAAC,GAAG,EAAEN,KAAK,EAAE,CAAC,IAAI,EAAEA,KAAK,EAAE,CAAC,KAAK,EAAEK,QAAQ,QAAQ,EAAEJ,OAAO,IAAI,EAAE;QAE9E,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAACK,MACf;QAGJ,IAAI,CAAC,KAAK,CAAC,GAAG,CAACA,KAAK;YAChB,IAAIN,KAAK,EAAE;YACX,IAAIA,KAAK,EAAE;YACXC;YACAI;YACAH;QACJ;IACJ;IAEO,WAAkC;QACrC,OAAOK,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM;IACvC;;aAlCiB,KAAK,GAAqC,IAAIC;;AAmCnE;AAEO,MAAMC,uBAAuB,IACzB,IAAIX"}
@@ -1,3 +0,0 @@
1
- export {};
2
-
3
- //# sourceMappingURL=types.js.map