@webiny/api-sync-system 0.0.0-unstable.a4637c5ce6 → 0.0.0-unstable.a4f3e4ea8b

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 (321) hide show
  1. package/README.md +6 -108
  2. package/constants.js +2 -7
  3. package/constants.js.map +1 -1
  4. package/index.js +3 -40
  5. package/package.json +29 -26
  6. package/resolver/app/RecordHandler.d.ts +6 -6
  7. package/resolver/app/RecordHandler.js +84 -114
  8. package/resolver/app/RecordHandler.js.map +1 -1
  9. package/resolver/app/RecordsValidation.js +13 -24
  10. package/resolver/app/RecordsValidation.js.map +1 -1
  11. package/resolver/app/ResolverApplication.d.ts +1 -1
  12. package/resolver/app/ResolverApplication.js +27 -42
  13. package/resolver/app/ResolverApplication.js.map +1 -1
  14. package/resolver/app/abstractions/RecordHandler.d.ts +1 -1
  15. package/resolver/app/abstractions/RecordHandler.js +0 -7
  16. package/resolver/app/abstractions/RecordsValidation.d.ts +2 -2
  17. package/resolver/app/abstractions/RecordsValidation.js +0 -7
  18. package/resolver/app/abstractions/ResolverApplication.js +0 -7
  19. package/resolver/app/abstractions/ResolverRecord.d.ts +1 -1
  20. package/resolver/app/abstractions/ResolverRecord.js +0 -7
  21. package/resolver/app/bundler/BaseBundle.d.ts +6 -6
  22. package/resolver/app/bundler/BaseBundle.js +16 -22
  23. package/resolver/app/bundler/BaseBundle.js.map +1 -1
  24. package/resolver/app/bundler/Bundler.d.ts +1 -1
  25. package/resolver/app/bundler/Bundler.js +12 -25
  26. package/resolver/app/bundler/Bundler.js.map +1 -1
  27. package/resolver/app/bundler/Bundles.d.ts +2 -2
  28. package/resolver/app/bundler/Bundles.js +20 -33
  29. package/resolver/app/bundler/Bundles.js.map +1 -1
  30. package/resolver/app/bundler/CommandBundle.d.ts +1 -1
  31. package/resolver/app/bundler/CommandBundle.js +8 -25
  32. package/resolver/app/bundler/CommandBundle.js.map +1 -1
  33. package/resolver/app/bundler/TableBundle.d.ts +1 -1
  34. package/resolver/app/bundler/TableBundle.js +7 -22
  35. package/resolver/app/bundler/TableBundle.js.map +1 -1
  36. package/resolver/app/bundler/types.d.ts +2 -2
  37. package/resolver/app/bundler/types.js +0 -7
  38. package/resolver/app/commandHandler/DeleteCommandHandler.d.ts +3 -3
  39. package/resolver/app/commandHandler/DeleteCommandHandler.js +21 -35
  40. package/resolver/app/commandHandler/DeleteCommandHandler.js.map +1 -1
  41. package/resolver/app/commandHandler/PutCommandHandler.d.ts +4 -4
  42. package/resolver/app/commandHandler/PutCommandHandler.js +15 -28
  43. package/resolver/app/commandHandler/PutCommandHandler.js.map +1 -1
  44. package/resolver/app/commandHandler/delete.d.ts +1 -1
  45. package/resolver/app/commandHandler/delete.js +13 -21
  46. package/resolver/app/commandHandler/delete.js.map +1 -1
  47. package/resolver/app/commandHandler/put.d.ts +1 -1
  48. package/resolver/app/commandHandler/put.js +13 -21
  49. package/resolver/app/commandHandler/put.js.map +1 -1
  50. package/resolver/app/data/SourceDataContainer.d.ts +3 -3
  51. package/resolver/app/data/SourceDataContainer.js +27 -36
  52. package/resolver/app/data/SourceDataContainer.js.map +1 -1
  53. package/resolver/app/data/types.d.ts +2 -2
  54. package/resolver/app/data/types.js +0 -7
  55. package/resolver/app/fetcher/Fetcher.d.ts +3 -3
  56. package/resolver/app/fetcher/Fetcher.js +87 -121
  57. package/resolver/app/fetcher/Fetcher.js.map +1 -1
  58. package/resolver/app/fetcher/types.d.ts +2 -2
  59. package/resolver/app/fetcher/types.js +0 -7
  60. package/resolver/app/ingestor/Ingestor.d.ts +1 -1
  61. package/resolver/app/ingestor/Ingestor.js +26 -39
  62. package/resolver/app/ingestor/Ingestor.js.map +1 -1
  63. package/resolver/app/ingestor/IngestorResult.js +27 -39
  64. package/resolver/app/ingestor/IngestorResult.js.map +1 -1
  65. package/resolver/app/ingestor/types.d.ts +2 -2
  66. package/resolver/app/ingestor/types.js +0 -7
  67. package/resolver/app/storer/Storer.d.ts +3 -3
  68. package/resolver/app/storer/Storer.js +73 -95
  69. package/resolver/app/storer/Storer.js.map +1 -1
  70. package/resolver/app/storer/types.d.ts +2 -2
  71. package/resolver/app/storer/types.js +0 -7
  72. package/resolver/app/transform/TransformHandler.d.ts +4 -4
  73. package/resolver/app/transform/TransformHandler.js +46 -64
  74. package/resolver/app/transform/TransformHandler.js.map +1 -1
  75. package/resolver/app/transform/middleware.d.ts +1 -1
  76. package/resolver/app/transform/middleware.js +12 -25
  77. package/resolver/app/transform/middleware.js.map +1 -1
  78. package/resolver/app/utils/Retry.js +21 -32
  79. package/resolver/app/utils/Retry.js.map +1 -1
  80. package/resolver/app/utils/sleep.js +4 -12
  81. package/resolver/app/utils/sleep.js.map +1 -1
  82. package/resolver/app/validation/body.d.ts +25 -124
  83. package/resolver/app/validation/body.js +31 -44
  84. package/resolver/app/validation/body.js.map +1 -1
  85. package/resolver/app/validation/createJsonTransform.d.ts +1 -1
  86. package/resolver/app/validation/createJsonTransform.js +13 -22
  87. package/resolver/app/validation/createJsonTransform.js.map +1 -1
  88. package/resolver/app/validation/detail.d.ts +19 -72
  89. package/resolver/app/validation/detail.js +33 -46
  90. package/resolver/app/validation/detail.js.map +1 -1
  91. package/resolver/app/validation/event.d.ts +29 -188
  92. package/resolver/app/validation/event.js +21 -30
  93. package/resolver/app/validation/event.js.map +1 -1
  94. package/resolver/app/validation/numericString.d.ts +1 -1
  95. package/resolver/app/validation/numericString.js +9 -20
  96. package/resolver/app/validation/numericString.js.map +1 -1
  97. package/resolver/app/validation/system.d.ts +2 -14
  98. package/resolver/app/validation/system.js +9 -18
  99. package/resolver/app/validation/system.js.map +1 -1
  100. package/resolver/createEventHandlerPlugin.d.ts +2 -1
  101. package/resolver/createEventHandlerPlugin.js +85 -121
  102. package/resolver/createEventHandlerPlugin.js.map +1 -1
  103. package/resolver/createResolverHandler.d.ts +1 -1
  104. package/resolver/createResolverHandler.js +60 -75
  105. package/resolver/createResolverHandler.js.map +1 -1
  106. package/resolver/deployment/Deployment.d.ts +2 -3
  107. package/resolver/deployment/Deployment.js +27 -44
  108. package/resolver/deployment/Deployment.js.map +1 -1
  109. package/resolver/deployment/Deployments.js +19 -30
  110. package/resolver/deployment/Deployments.js.map +1 -1
  111. package/resolver/deployment/DeploymentsFetcher.js +82 -102
  112. package/resolver/deployment/DeploymentsFetcher.js.map +1 -1
  113. package/resolver/deployment/types.d.ts +4 -6
  114. package/resolver/deployment/types.js +0 -7
  115. package/resolver/lambda/LambdaTrigger.js +25 -34
  116. package/resolver/lambda/LambdaTrigger.js.map +1 -1
  117. package/resolver/plugins/CommandHandlerPlugin.d.ts +3 -3
  118. package/resolver/plugins/CommandHandlerPlugin.js +17 -24
  119. package/resolver/plugins/CommandHandlerPlugin.js.map +1 -1
  120. package/resolver/plugins/StorerAfterEachPlugin.d.ts +2 -2
  121. package/resolver/plugins/StorerAfterEachPlugin.js +21 -29
  122. package/resolver/plugins/StorerAfterEachPlugin.js.map +1 -1
  123. package/resolver/plugins/TransformRecordPlugin.d.ts +3 -3
  124. package/resolver/plugins/TransformRecordPlugin.js +20 -27
  125. package/resolver/plugins/TransformRecordPlugin.js.map +1 -1
  126. package/resolver/recordTypes/fileManager/CopyFile.js +44 -74
  127. package/resolver/recordTypes/fileManager/CopyFile.js.map +1 -1
  128. package/resolver/recordTypes/fileManager/DeleteFile.d.ts +1 -1
  129. package/resolver/recordTypes/fileManager/DeleteFile.js +40 -65
  130. package/resolver/recordTypes/fileManager/DeleteFile.js.map +1 -1
  131. package/resolver/recordTypes/fileManager/fileManager.d.ts +1 -1
  132. package/resolver/recordTypes/fileManager/fileManager.js +7 -12
  133. package/resolver/recordTypes/fileManager/fileManager.js.map +1 -1
  134. package/resolver/recordTypes/fileManager/fileManagerOnDelete.d.ts +1 -1
  135. package/resolver/recordTypes/fileManager/fileManagerOnDelete.js +27 -45
  136. package/resolver/recordTypes/fileManager/fileManagerOnDelete.js.map +1 -1
  137. package/resolver/recordTypes/fileManager/fileManagerOnPut.d.ts +1 -1
  138. package/resolver/recordTypes/fileManager/fileManagerOnPut.js +27 -45
  139. package/resolver/recordTypes/fileManager/fileManagerOnPut.js.map +1 -1
  140. package/resolver/recordTypes/fileManager/shouldBeHandled.d.ts +1 -1
  141. package/resolver/recordTypes/fileManager/shouldBeHandled.js +10 -34
  142. package/resolver/recordTypes/fileManager/shouldBeHandled.js.map +1 -1
  143. package/resolver/recordTypes/fileManager/types.d.ts +2 -2
  144. package/resolver/recordTypes/fileManager/types.js +0 -7
  145. package/resolver/recordTypes/users/CopyUser.d.ts +2 -2
  146. package/resolver/recordTypes/users/CopyUser.js +44 -61
  147. package/resolver/recordTypes/users/CopyUser.js.map +1 -1
  148. package/resolver/recordTypes/users/DeleteUser.d.ts +2 -2
  149. package/resolver/recordTypes/users/DeleteUser.js +40 -58
  150. package/resolver/recordTypes/users/DeleteUser.js.map +1 -1
  151. package/resolver/recordTypes/users/shouldBeHandled.d.ts +1 -1
  152. package/resolver/recordTypes/users/shouldBeHandled.js +10 -33
  153. package/resolver/recordTypes/users/shouldBeHandled.js.map +1 -1
  154. package/resolver/recordTypes/users/types.d.ts +1 -1
  155. package/resolver/recordTypes/users/types.js +0 -7
  156. package/resolver/recordTypes/users/users.js +7 -12
  157. package/resolver/recordTypes/users/users.js.map +1 -1
  158. package/resolver/recordTypes/users/usersOnDelete.d.ts +2 -2
  159. package/resolver/recordTypes/users/usersOnDelete.js +26 -44
  160. package/resolver/recordTypes/users/usersOnDelete.js.map +1 -1
  161. package/resolver/recordTypes/users/usersOnPut.d.ts +2 -2
  162. package/resolver/recordTypes/users/usersOnPut.js +27 -45
  163. package/resolver/recordTypes/users/usersOnPut.js.map +1 -1
  164. package/sync/FilterOutRecord.d.ts +2 -2
  165. package/sync/FilterOutRecord.js +8 -24
  166. package/sync/FilterOutRecord.js.map +1 -1
  167. package/sync/attachToDynamoDbDocument.d.ts +1 -1
  168. package/sync/attachToDynamoDbDocument.js +48 -75
  169. package/sync/attachToDynamoDbDocument.js.map +1 -1
  170. package/sync/createHandler.js +44 -60
  171. package/sync/createHandler.js.map +1 -1
  172. package/sync/createSendDataToEventBridgeOnRequestEnd.js +34 -46
  173. package/sync/createSendDataToEventBridgeOnRequestEnd.js.map +1 -1
  174. package/sync/createSyncSystem.d.ts +1 -1
  175. package/sync/createSyncSystem.js +27 -36
  176. package/sync/createSyncSystem.js.map +1 -1
  177. package/sync/filter/createDefaultFilterOutRecordPlugins.d.ts +1 -1
  178. package/sync/filter/createDefaultFilterOutRecordPlugins.js +37 -86
  179. package/sync/filter/createDefaultFilterOutRecordPlugins.js.map +1 -1
  180. package/sync/handler/Handler.d.ts +2 -2
  181. package/sync/handler/Handler.js +66 -86
  182. package/sync/handler/Handler.js.map +1 -1
  183. package/sync/handler/HandlerConverter.js +20 -36
  184. package/sync/handler/HandlerConverter.js.map +1 -1
  185. package/sync/handler/converter/BatchGetCommandConverter.js +13 -20
  186. package/sync/handler/converter/BatchGetCommandConverter.js.map +1 -1
  187. package/sync/handler/converter/BatchWriteCommandConverter.js +13 -20
  188. package/sync/handler/converter/BatchWriteCommandConverter.js.map +1 -1
  189. package/sync/handler/converter/DeleteCommandConverter.js +13 -20
  190. package/sync/handler/converter/DeleteCommandConverter.js.map +1 -1
  191. package/sync/handler/converter/GetCommandConverter.js +13 -20
  192. package/sync/handler/converter/GetCommandConverter.js.map +1 -1
  193. package/sync/handler/converter/PutCommandConverter.js +13 -20
  194. package/sync/handler/converter/PutCommandConverter.js.map +1 -1
  195. package/sync/handler/converter/QueryCommandConverter.js +13 -20
  196. package/sync/handler/converter/QueryCommandConverter.js.map +1 -1
  197. package/sync/handler/converter/ScanCommandConverter.js +13 -20
  198. package/sync/handler/converter/ScanCommandConverter.js.map +1 -1
  199. package/sync/handler/converter/UpdateCommandConverter.js +13 -20
  200. package/sync/handler/converter/UpdateCommandConverter.js.map +1 -1
  201. package/sync/handler/converter/commands/BatchWriteCommandValue.d.ts +2 -2
  202. package/sync/handler/converter/commands/BatchWriteCommandValue.js +34 -44
  203. package/sync/handler/converter/commands/BatchWriteCommandValue.js.map +1 -1
  204. package/sync/handler/converter/commands/DeleteCommandValue.d.ts +2 -2
  205. package/sync/handler/converter/commands/DeleteCommandValue.js +19 -23
  206. package/sync/handler/converter/commands/DeleteCommandValue.js.map +1 -1
  207. package/sync/handler/converter/commands/NullCommandValue.d.ts +1 -1
  208. package/sync/handler/converter/commands/NullCommandValue.js +7 -14
  209. package/sync/handler/converter/commands/NullCommandValue.js.map +1 -1
  210. package/sync/handler/converter/commands/PutCommandValue.d.ts +2 -2
  211. package/sync/handler/converter/commands/PutCommandValue.js +19 -23
  212. package/sync/handler/converter/commands/PutCommandValue.js.map +1 -1
  213. package/sync/handler/converter/commands/UpdateCommandValue.d.ts +2 -2
  214. package/sync/handler/converter/commands/UpdateCommandValue.js +19 -23
  215. package/sync/handler/converter/commands/UpdateCommandValue.js.map +1 -1
  216. package/sync/handler/types.d.ts +3 -3
  217. package/sync/handler/types.js +0 -7
  218. package/sync/plugins/FilterOutRecordPlugin.d.ts +1 -1
  219. package/sync/plugins/FilterOutRecordPlugin.js +18 -28
  220. package/sync/plugins/FilterOutRecordPlugin.js.map +1 -1
  221. package/sync/requestPlugin.d.ts +1 -1
  222. package/sync/requestPlugin.js +39 -55
  223. package/sync/requestPlugin.js.map +1 -1
  224. package/sync/types.js +0 -7
  225. package/sync/utils/getTableType.js +11 -19
  226. package/sync/utils/getTableType.js.map +1 -1
  227. package/sync/utils/manifest.d.ts +3 -7
  228. package/sync/utils/manifest.js +30 -47
  229. package/sync/utils/manifest.js.map +1 -1
  230. package/sync/utils/validateSystemInput.d.ts +1 -1
  231. package/sync/utils/validateSystemInput.js +22 -37
  232. package/sync/utils/validateSystemInput.js.map +1 -1
  233. package/types.d.ts +3 -5
  234. package/types.js +6 -12
  235. package/types.js.map +1 -1
  236. package/utils/createSystemName.js +5 -10
  237. package/utils/createSystemName.js.map +1 -1
  238. package/worker/actions/copyFile/CopyFile.js +185 -268
  239. package/worker/actions/copyFile/CopyFile.js.map +1 -1
  240. package/worker/actions/copyFile/copyFileAction.d.ts +1 -1
  241. package/worker/actions/copyFile/copyFileAction.js +30 -45
  242. package/worker/actions/copyFile/copyFileAction.js.map +1 -1
  243. package/worker/actions/copyFile/copyFileSchema.d.ts +6 -38
  244. package/worker/actions/copyFile/copyFileSchema.js +14 -23
  245. package/worker/actions/copyFile/copyFileSchema.js.map +1 -1
  246. package/worker/actions/copyFile/types.js +0 -7
  247. package/worker/actions/createUser/CreateUser.d.ts +1 -1
  248. package/worker/actions/createUser/CreateUser.js +53 -83
  249. package/worker/actions/createUser/CreateUser.js.map +1 -1
  250. package/worker/actions/createUser/createUserAction.d.ts +2 -2
  251. package/worker/actions/createUser/createUserAction.js +28 -39
  252. package/worker/actions/createUser/createUserAction.js.map +1 -1
  253. package/worker/actions/createUser/createUserSchema.d.ts +6 -38
  254. package/worker/actions/createUser/createUserSchema.js +14 -23
  255. package/worker/actions/createUser/createUserSchema.js.map +1 -1
  256. package/worker/actions/createUser/types.js +0 -7
  257. package/worker/actions/deleteFile/DeleteFile.js +52 -74
  258. package/worker/actions/deleteFile/DeleteFile.js.map +1 -1
  259. package/worker/actions/deleteFile/deleteFileAction.d.ts +1 -1
  260. package/worker/actions/deleteFile/deleteFileAction.js +25 -40
  261. package/worker/actions/deleteFile/deleteFileAction.js.map +1 -1
  262. package/worker/actions/deleteFile/deleteFileSchema.d.ts +6 -38
  263. package/worker/actions/deleteFile/deleteFileSchema.js +14 -23
  264. package/worker/actions/deleteFile/deleteFileSchema.js.map +1 -1
  265. package/worker/actions/deleteFile/types.js +0 -7
  266. package/worker/actions/deleteUser/DeleteUser.d.ts +2 -2
  267. package/worker/actions/deleteUser/DeleteUser.js +39 -60
  268. package/worker/actions/deleteUser/DeleteUser.js.map +1 -1
  269. package/worker/actions/deleteUser/deleteUserAction.d.ts +1 -1
  270. package/worker/actions/deleteUser/deleteUserAction.js +26 -37
  271. package/worker/actions/deleteUser/deleteUserAction.js.map +1 -1
  272. package/worker/actions/deleteUser/deleteUserSchema.d.ts +5 -23
  273. package/worker/actions/deleteUser/deleteUserSchema.js +13 -22
  274. package/worker/actions/deleteUser/deleteUserSchema.js.map +1 -1
  275. package/worker/actions/deleteUser/types.js +0 -7
  276. package/worker/actions/logValidationError.js +6 -14
  277. package/worker/actions/logValidationError.js.map +1 -1
  278. package/worker/actions/removeCognitoUserAttributes.js +9 -22
  279. package/worker/actions/removeCognitoUserAttributes.js.map +1 -1
  280. package/worker/actions/updateUser/UpdateUser.d.ts +1 -1
  281. package/worker/actions/updateUser/UpdateUser.js +50 -74
  282. package/worker/actions/updateUser/UpdateUser.js.map +1 -1
  283. package/worker/actions/updateUser/types.js +0 -7
  284. package/worker/actions/updateUser/updateUserAction.d.ts +2 -2
  285. package/worker/actions/updateUser/updateUserAction.js +28 -39
  286. package/worker/actions/updateUser/updateUserAction.js.map +1 -1
  287. package/worker/actions/updateUser/updateUserSchema.d.ts +6 -38
  288. package/worker/actions/updateUser/updateUserSchema.js +14 -23
  289. package/worker/actions/updateUser/updateUserSchema.js.map +1 -1
  290. package/worker/createWorkerHandler.js +32 -45
  291. package/worker/createWorkerHandler.js.map +1 -1
  292. package/worker/handler/WorkerActionHandler.d.ts +2 -2
  293. package/worker/handler/WorkerActionHandler.js +19 -28
  294. package/worker/handler/WorkerActionHandler.js.map +1 -1
  295. package/worker/handler/eventHandler.js +18 -27
  296. package/worker/handler/eventHandler.js.map +1 -1
  297. package/worker/plugins/WorkerActionPlugin.d.ts +1 -1
  298. package/worker/plugins/WorkerActionPlugin.js +18 -25
  299. package/worker/plugins/WorkerActionPlugin.js.map +1 -1
  300. package/worker/types.js +0 -7
  301. package/index.js.map +0 -1
  302. package/resolver/app/abstractions/RecordHandler.js.map +0 -1
  303. package/resolver/app/abstractions/RecordsValidation.js.map +0 -1
  304. package/resolver/app/abstractions/ResolverApplication.js.map +0 -1
  305. package/resolver/app/abstractions/ResolverRecord.js.map +0 -1
  306. package/resolver/app/bundler/types.js.map +0 -1
  307. package/resolver/app/data/types.js.map +0 -1
  308. package/resolver/app/fetcher/types.js.map +0 -1
  309. package/resolver/app/ingestor/types.js.map +0 -1
  310. package/resolver/app/storer/types.js.map +0 -1
  311. package/resolver/deployment/types.js.map +0 -1
  312. package/resolver/recordTypes/fileManager/types.js.map +0 -1
  313. package/resolver/recordTypes/users/types.js.map +0 -1
  314. package/sync/handler/types.js.map +0 -1
  315. package/sync/types.js.map +0 -1
  316. package/worker/actions/copyFile/types.js.map +0 -1
  317. package/worker/actions/createUser/types.js.map +0 -1
  318. package/worker/actions/deleteFile/types.js.map +0 -1
  319. package/worker/actions/deleteUser/types.js.map +0 -1
  320. package/worker/actions/updateUser/types.js.map +0 -1
  321. package/worker/types.js.map +0 -1
@@ -1,48 +1,33 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createResolverApp = exports.ResolverApplication = void 0;
7
- var _RecordsValidation = require("./RecordsValidation.js");
8
- var _utils = require("@webiny/utils");
9
- var _Ingestor = require("./ingestor/Ingestor.js");
10
- var _IngestorResult = require("./ingestor/IngestorResult.js");
1
+ import { createRecordsValidation } from "./RecordsValidation.js";
2
+ import { convertException } from "@webiny/utils";
3
+ import { createIngestor } from "./ingestor/Ingestor.js";
4
+ import { createIngestorResult } from "./ingestor/IngestorResult.js";
11
5
  class ResolverApplication {
12
- constructor(params) {
13
- this.recordHandler = params.recordHandler;
14
- this.deployments = params.deployments;
15
- }
16
- async resolve(params) {
17
- const validation = (0, _RecordsValidation.createRecordsValidation)();
18
- const result = await validation.validate(params.records);
19
- if (result.error) {
20
- throw result.error;
6
+ constructor(params){
7
+ this.recordHandler = params.recordHandler;
8
+ this.deployments = params.deployments;
21
9
  }
22
- const ingestor = (0, _Ingestor.createIngestor)({
23
- createIngestorResult: () => {
24
- return (0, _IngestorResult.createIngestorResult)();
25
- },
26
- getSource: name => {
27
- return this.deployments.get(name);
28
- }
29
- });
30
- const data = await ingestor.ingest({
31
- records: result.records
32
- });
33
- try {
34
- await this.recordHandler.handle({
35
- data
36
- });
37
- } catch (ex) {
38
- console.error((0, _utils.convertException)(ex));
10
+ async resolve(params) {
11
+ const validation = createRecordsValidation();
12
+ const result = await validation.validate(params.records);
13
+ if (result.error) throw result.error;
14
+ const ingestor = createIngestor({
15
+ createIngestorResult: ()=>createIngestorResult(),
16
+ getSource: (name)=>this.deployments.get(name)
17
+ });
18
+ const data = await ingestor.ingest({
19
+ records: result.records
20
+ });
21
+ try {
22
+ await this.recordHandler.handle({
23
+ data
24
+ });
25
+ } catch (ex) {
26
+ console.error(convertException(ex));
27
+ }
39
28
  }
40
- }
41
29
  }
42
- exports.ResolverApplication = ResolverApplication;
43
- const createResolverApp = params => {
44
- return new ResolverApplication(params);
45
- };
46
- exports.createResolverApp = createResolverApp;
30
+ const createResolverApp = (params)=>new ResolverApplication(params);
31
+ export { ResolverApplication, createResolverApp };
47
32
 
48
33
  //# sourceMappingURL=ResolverApplication.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_RecordsValidation","require","_utils","_Ingestor","_IngestorResult","ResolverApplication","constructor","params","recordHandler","deployments","resolve","validation","createRecordsValidation","result","validate","records","error","ingestor","createIngestor","createIngestorResult","getSource","name","get","data","ingest","handle","ex","console","convertException","exports","createResolverApp"],"sources":["ResolverApplication.ts"],"sourcesContent":["import type {\n IResolverApplication,\n IResolverApplicationResolveParams\n} from \"./abstractions/ResolverApplication.js\";\nimport { createRecordsValidation } from \"./RecordsValidation.js\";\nimport { convertException } from \"@webiny/utils\";\nimport type { IRecordHandler } from \"./abstractions/RecordHandler.js\";\nimport type { IDeployments } from \"~/resolver/deployment/types.js\";\nimport { createIngestor } from \"./ingestor/Ingestor.js\";\nimport { createIngestorResult } from \"~/resolver/app/ingestor/IngestorResult.js\";\n\nexport interface IResolverApplicationParams {\n recordHandler: IRecordHandler;\n deployments: IDeployments;\n}\n\nexport class ResolverApplication implements IResolverApplication {\n private readonly recordHandler: IRecordHandler;\n private readonly deployments: IDeployments;\n\n public constructor(params: IResolverApplicationParams) {\n this.recordHandler = params.recordHandler;\n this.deployments = params.deployments;\n }\n\n public async resolve(params: IResolverApplicationResolveParams): Promise<void> {\n const validation = createRecordsValidation();\n\n const result = await validation.validate(params.records);\n if (result.error) {\n throw result.error;\n }\n\n const ingestor = createIngestor({\n createIngestorResult: () => {\n return createIngestorResult();\n },\n getSource: name => {\n return this.deployments.get(name);\n }\n });\n\n const data = await ingestor.ingest({\n records: result.records\n });\n\n try {\n await this.recordHandler.handle({\n data\n });\n } catch (ex) {\n console.error(convertException(ex));\n }\n }\n}\n\nexport const createResolverApp = (params: IResolverApplicationParams): IResolverApplication => {\n return new ResolverApplication(params);\n};\n"],"mappings":";;;;;;AAIA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAGA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AAOO,MAAMI,mBAAmB,CAAiC;EAItDC,WAAWA,CAACC,MAAkC,EAAE;IACnD,IAAI,CAACC,aAAa,GAAGD,MAAM,CAACC,aAAa;IACzC,IAAI,CAACC,WAAW,GAAGF,MAAM,CAACE,WAAW;EACzC;EAEA,MAAaC,OAAOA,CAACH,MAAyC,EAAiB;IAC3E,MAAMI,UAAU,GAAG,IAAAC,0CAAuB,EAAC,CAAC;IAE5C,MAAMC,MAAM,GAAG,MAAMF,UAAU,CAACG,QAAQ,CAACP,MAAM,CAACQ,OAAO,CAAC;IACxD,IAAIF,MAAM,CAACG,KAAK,EAAE;MACd,MAAMH,MAAM,CAACG,KAAK;IACtB;IAEA,MAAMC,QAAQ,GAAG,IAAAC,wBAAc,EAAC;MAC5BC,oBAAoB,EAAEA,CAAA,KAAM;QACxB,OAAO,IAAAA,oCAAoB,EAAC,CAAC;MACjC,CAAC;MACDC,SAAS,EAAEC,IAAI,IAAI;QACf,OAAO,IAAI,CAACZ,WAAW,CAACa,GAAG,CAACD,IAAI,CAAC;MACrC;IACJ,CAAC,CAAC;IAEF,MAAME,IAAI,GAAG,MAAMN,QAAQ,CAACO,MAAM,CAAC;MAC/BT,OAAO,EAAEF,MAAM,CAACE;IACpB,CAAC,CAAC;IAEF,IAAI;MACA,MAAM,IAAI,CAACP,aAAa,CAACiB,MAAM,CAAC;QAC5BF;MACJ,CAAC,CAAC;IACN,CAAC,CAAC,OAAOG,EAAE,EAAE;MACTC,OAAO,CAACX,KAAK,CAAC,IAAAY,uBAAgB,EAACF,EAAE,CAAC,CAAC;IACvC;EACJ;AACJ;AAACG,OAAA,CAAAxB,mBAAA,GAAAA,mBAAA;AAEM,MAAMyB,iBAAiB,GAAIvB,MAAkC,IAA2B;EAC3F,OAAO,IAAIF,mBAAmB,CAACE,MAAM,CAAC;AAC1C,CAAC;AAACsB,OAAA,CAAAC,iBAAA,GAAAA,iBAAA","ignoreList":[]}
1
+ {"version":3,"file":"resolver/app/ResolverApplication.js","sources":["../../../src/resolver/app/ResolverApplication.ts"],"sourcesContent":["import type {\n IResolverApplication,\n IResolverApplicationResolveParams\n} from \"./abstractions/ResolverApplication.js\";\nimport { createRecordsValidation } from \"./RecordsValidation.js\";\nimport { convertException } from \"@webiny/utils\";\nimport type { IRecordHandler } from \"./abstractions/RecordHandler.js\";\nimport type { IDeployments } from \"~/resolver/deployment/types.js\";\nimport { createIngestor } from \"./ingestor/Ingestor.js\";\nimport { createIngestorResult } from \"~/resolver/app/ingestor/IngestorResult.js\";\n\nexport interface IResolverApplicationParams {\n recordHandler: IRecordHandler;\n deployments: IDeployments;\n}\n\nexport class ResolverApplication implements IResolverApplication {\n private readonly recordHandler: IRecordHandler;\n private readonly deployments: IDeployments;\n\n public constructor(params: IResolverApplicationParams) {\n this.recordHandler = params.recordHandler;\n this.deployments = params.deployments;\n }\n\n public async resolve(params: IResolverApplicationResolveParams): Promise<void> {\n const validation = createRecordsValidation();\n\n const result = await validation.validate(params.records);\n if (result.error) {\n throw result.error;\n }\n\n const ingestor = createIngestor({\n createIngestorResult: () => {\n return createIngestorResult();\n },\n getSource: name => {\n return this.deployments.get(name);\n }\n });\n\n const data = await ingestor.ingest({\n records: result.records\n });\n\n try {\n await this.recordHandler.handle({\n data\n });\n } catch (ex) {\n console.error(convertException(ex));\n }\n }\n}\n\nexport const createResolverApp = (params: IResolverApplicationParams): IResolverApplication => {\n return new ResolverApplication(params);\n};\n"],"names":["ResolverApplication","params","validation","createRecordsValidation","result","ingestor","createIngestor","createIngestorResult","name","data","ex","console","convertException","createResolverApp"],"mappings":";;;;AAgBO,MAAMA;IAIT,YAAmBC,MAAkC,CAAE;QACnD,IAAI,CAAC,aAAa,GAAGA,OAAO,aAAa;QACzC,IAAI,CAAC,WAAW,GAAGA,OAAO,WAAW;IACzC;IAEA,MAAa,QAAQA,MAAyC,EAAiB;QAC3E,MAAMC,aAAaC;QAEnB,MAAMC,SAAS,MAAMF,WAAW,QAAQ,CAACD,OAAO,OAAO;QACvD,IAAIG,OAAO,KAAK,EACZ,MAAMA,OAAO,KAAK;QAGtB,MAAMC,WAAWC,eAAe;YAC5B,sBAAsB,IACXC;YAEX,WAAWC,CAAAA,OACA,IAAI,CAAC,WAAW,CAAC,GAAG,CAACA;QAEpC;QAEA,MAAMC,OAAO,MAAMJ,SAAS,MAAM,CAAC;YAC/B,SAASD,OAAO,OAAO;QAC3B;QAEA,IAAI;YACA,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;gBAC5BK;YACJ;QACJ,EAAE,OAAOC,IAAI;YACTC,QAAQ,KAAK,CAACC,iBAAiBF;QACnC;IACJ;AACJ;AAEO,MAAMG,oBAAoB,CAACZ,SACvB,IAAID,oBAAoBC"}
@@ -1,4 +1,4 @@
1
- import type { IIngestorResult } from "../ingestor/types.js";
1
+ import type { IIngestorResult } from "../../../resolver/app/ingestor/types.js";
2
2
  export interface IRecordHandlerHandleParams {
3
3
  data: IIngestorResult;
4
4
  }
@@ -1,7 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- //# sourceMappingURL=RecordHandler.js.map
@@ -1,5 +1,5 @@
1
- import type { SQSRecord } from "@webiny/aws-sdk/types";
2
- import type { IResolverSQSRecord } from "./ResolverRecord.js";
1
+ import type { SQSRecord } from "@webiny/aws-sdk/types/index.js";
2
+ import type { IResolverSQSRecord } from "../../../resolver/app/abstractions/ResolverRecord.js";
3
3
  export interface IRecordsValidationValid {
4
4
  records: IResolverSQSRecord[];
5
5
  error?: never;
@@ -1,7 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- //# sourceMappingURL=RecordsValidation.js.map
@@ -1,7 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- //# sourceMappingURL=ResolverApplication.js.map
@@ -7,7 +7,7 @@ export interface IResolverRecordBodyItem {
7
7
  SK: string;
8
8
  command: ExtendedCommandType;
9
9
  /**
10
- * There will be multiple tables that will get populated through the system (regular table and elasticsearch for start).
10
+ * There will be multiple tables that will get populated through the system (regular table and opensearch for start).
11
11
  */
12
12
  tableName: string;
13
13
  tableType: DynamoDBTableType;
@@ -1,7 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- //# sourceMappingURL=ResolverRecord.js.map
@@ -1,9 +1,9 @@
1
- import type { IBundle, IBundleItem } from "./types.js";
2
- import type { IDeployment } from "../../deployment/types";
3
- import type { ITable } from "../../../sync/types";
4
- import type { CommandType } from "../../../types";
5
- import { type ExtendedCommandType } from "../../../types";
6
- import type { IIngestorResultItem } from "../ingestor/types";
1
+ import type { IBundle, IBundleItem } from "../../../resolver/app/bundler/types.js";
2
+ import type { IDeployment } from "../../../resolver/deployment/types.js";
3
+ import type { ITable } from "../../../sync/types.js";
4
+ import type { CommandType } from "../../../types.js";
5
+ import { type ExtendedCommandType } from "../../../types.js";
6
+ import type { IIngestorResultItem } from "../ingestor/types.js";
7
7
  export interface IBaseBundleParams {
8
8
  command: ExtendedCommandType;
9
9
  table: ITable;
@@ -1,26 +1,20 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.BaseBundle = void 0;
7
1
  class BaseBundle {
8
- items = [];
9
- constructor(params) {
10
- this.command = this.getCommand(params.command);
11
- this.table = params.table;
12
- this.source = params.source;
13
- }
14
- getCommand(command) {
15
- return command === "delete" ? "delete" : "put";
16
- }
17
- add(item) {
18
- this.items.push({
19
- PK: item.PK,
20
- SK: item.SK
21
- });
22
- }
2
+ constructor(params){
3
+ this.items = [];
4
+ this.command = this.getCommand(params.command);
5
+ this.table = params.table;
6
+ this.source = params.source;
7
+ }
8
+ getCommand(command) {
9
+ return "delete" === command ? "delete" : "put";
10
+ }
11
+ add(item) {
12
+ this.items.push({
13
+ PK: item.PK,
14
+ SK: item.SK
15
+ });
16
+ }
23
17
  }
24
- exports.BaseBundle = BaseBundle;
18
+ export { BaseBundle };
25
19
 
26
20
  //# sourceMappingURL=BaseBundle.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["BaseBundle","items","constructor","params","command","getCommand","table","source","add","item","push","PK","SK","exports"],"sources":["BaseBundle.ts"],"sourcesContent":["import type { IBundle, IBundleItem } from \"~/resolver/app/bundler/types.js\";\nimport type { IDeployment } from \"~/resolver/deployment/types\";\nimport type { ITable } from \"~/sync/types\";\nimport type { CommandType } from \"~/types\";\nimport { type ExtendedCommandType } from \"~/types\";\nimport type { IIngestorResultItem } from \"../ingestor/types\";\n\nexport interface IBaseBundleParams {\n command: ExtendedCommandType;\n table: ITable;\n source: IDeployment;\n}\n\nexport abstract class BaseBundle implements IBundle {\n readonly items: IBundleItem[] = [];\n readonly command: CommandType;\n readonly table: ITable;\n readonly source: IDeployment;\n\n public abstract canAdd(item: IIngestorResultItem): boolean;\n\n public constructor(params: IBaseBundleParams) {\n this.command = this.getCommand(params.command);\n this.table = params.table;\n this.source = params.source;\n }\n\n protected getCommand(command: ExtendedCommandType): CommandType {\n return command === \"delete\" ? \"delete\" : \"put\";\n }\n\n public add(item: IIngestorResultItem): void {\n this.items.push({\n PK: item.PK,\n SK: item.SK\n });\n }\n}\n"],"mappings":";;;;;;AAaO,MAAeA,UAAU,CAAoB;EACvCC,KAAK,GAAkB,EAAE;EAO3BC,WAAWA,CAACC,MAAyB,EAAE;IAC1C,IAAI,CAACC,OAAO,GAAG,IAAI,CAACC,UAAU,CAACF,MAAM,CAACC,OAAO,CAAC;IAC9C,IAAI,CAACE,KAAK,GAAGH,MAAM,CAACG,KAAK;IACzB,IAAI,CAACC,MAAM,GAAGJ,MAAM,CAACI,MAAM;EAC/B;EAEUF,UAAUA,CAACD,OAA4B,EAAe;IAC5D,OAAOA,OAAO,KAAK,QAAQ,GAAG,QAAQ,GAAG,KAAK;EAClD;EAEOI,GAAGA,CAACC,IAAyB,EAAQ;IACxC,IAAI,CAACR,KAAK,CAACS,IAAI,CAAC;MACZC,EAAE,EAAEF,IAAI,CAACE,EAAE;MACXC,EAAE,EAAEH,IAAI,CAACG;IACb,CAAC,CAAC;EACN;AACJ;AAACC,OAAA,CAAAb,UAAA,GAAAA,UAAA","ignoreList":[]}
1
+ {"version":3,"file":"resolver/app/bundler/BaseBundle.js","sources":["../../../../src/resolver/app/bundler/BaseBundle.ts"],"sourcesContent":["import type { IBundle, IBundleItem } from \"~/resolver/app/bundler/types.js\";\nimport type { IDeployment } from \"~/resolver/deployment/types.js\";\nimport type { ITable } from \"~/sync/types.js\";\nimport type { CommandType } from \"~/types.js\";\nimport { type ExtendedCommandType } from \"~/types.js\";\nimport type { IIngestorResultItem } from \"../ingestor/types.js\";\n\nexport interface IBaseBundleParams {\n command: ExtendedCommandType;\n table: ITable;\n source: IDeployment;\n}\n\nexport abstract class BaseBundle implements IBundle {\n readonly items: IBundleItem[] = [];\n readonly command: CommandType;\n readonly table: ITable;\n readonly source: IDeployment;\n\n public abstract canAdd(item: IIngestorResultItem): boolean;\n\n public constructor(params: IBaseBundleParams) {\n this.command = this.getCommand(params.command);\n this.table = params.table;\n this.source = params.source;\n }\n\n protected getCommand(command: ExtendedCommandType): CommandType {\n return command === \"delete\" ? \"delete\" : \"put\";\n }\n\n public add(item: IIngestorResultItem): void {\n this.items.push({\n PK: item.PK,\n SK: item.SK\n });\n }\n}\n"],"names":["BaseBundle","params","command","item"],"mappings":"AAaO,MAAeA;IAQlB,YAAmBC,MAAyB,CAAE;aAPrC,KAAK,GAAkB,EAAE;QAQ9B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,UAAU,CAACA,OAAO,OAAO;QAC7C,IAAI,CAAC,KAAK,GAAGA,OAAO,KAAK;QACzB,IAAI,CAAC,MAAM,GAAGA,OAAO,MAAM;IAC/B;IAEU,WAAWC,OAA4B,EAAe;QAC5D,OAAOA,AAAY,aAAZA,UAAuB,WAAW;IAC7C;IAEO,IAAIC,IAAyB,EAAQ;QACxC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;YACZ,IAAIA,KAAK,EAAE;YACX,IAAIA,KAAK,EAAE;QACf;IACJ;AACJ"}
@@ -1,4 +1,4 @@
1
- import type { IBundler, IBundlerBundleParams, IBundles } from "./types.js";
1
+ import type { IBundler, IBundlerBundleParams, IBundles } from "../../../resolver/app/bundler/types.js";
2
2
  export interface IBundlerParams {
3
3
  createBundles: () => IBundles;
4
4
  }
@@ -1,30 +1,17 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createBundler = exports.Bundler = void 0;
7
1
  class Bundler {
8
- constructor(params) {
9
- this.createBundles = params.createBundles;
10
- }
11
- bundle(params) {
12
- const {
13
- items
14
- } = params;
15
- const bundles = this.createBundles();
16
- for (const item of items) {
17
- bundles.add({
18
- item
19
- });
2
+ constructor(params){
3
+ this.createBundles = params.createBundles;
4
+ }
5
+ bundle(params) {
6
+ const { items } = params;
7
+ const bundles = this.createBundles();
8
+ for (const item of items)bundles.add({
9
+ item
10
+ });
11
+ return bundles;
20
12
  }
21
- return bundles;
22
- }
23
13
  }
24
- exports.Bundler = Bundler;
25
- const createBundler = params => {
26
- return new Bundler(params);
27
- };
28
- exports.createBundler = createBundler;
14
+ const createBundler = (params)=>new Bundler(params);
15
+ export { Bundler, createBundler };
29
16
 
30
17
  //# sourceMappingURL=Bundler.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Bundler","constructor","params","createBundles","bundle","items","bundles","item","add","exports","createBundler"],"sources":["Bundler.ts"],"sourcesContent":["import type { IBundler, IBundlerBundleParams, IBundles } from \"~/resolver/app/bundler/types.js\";\n\nexport interface IBundlerParams {\n createBundles: () => IBundles;\n}\n\nexport class Bundler implements IBundler {\n private readonly createBundles: () => IBundles;\n\n public constructor(params: IBundlerParams) {\n this.createBundles = params.createBundles;\n }\n\n public bundle(params: IBundlerBundleParams): IBundles {\n const { items } = params;\n\n const bundles = this.createBundles();\n\n for (const item of items) {\n bundles.add({\n item\n });\n }\n\n return bundles;\n }\n}\n\nexport const createBundler = (params: IBundlerParams) => {\n return new Bundler(params);\n};\n"],"mappings":";;;;;;AAMO,MAAMA,OAAO,CAAqB;EAG9BC,WAAWA,CAACC,MAAsB,EAAE;IACvC,IAAI,CAACC,aAAa,GAAGD,MAAM,CAACC,aAAa;EAC7C;EAEOC,MAAMA,CAACF,MAA4B,EAAY;IAClD,MAAM;MAAEG;IAAM,CAAC,GAAGH,MAAM;IAExB,MAAMI,OAAO,GAAG,IAAI,CAACH,aAAa,CAAC,CAAC;IAEpC,KAAK,MAAMI,IAAI,IAAIF,KAAK,EAAE;MACtBC,OAAO,CAACE,GAAG,CAAC;QACRD;MACJ,CAAC,CAAC;IACN;IAEA,OAAOD,OAAO;EAClB;AACJ;AAACG,OAAA,CAAAT,OAAA,GAAAA,OAAA;AAEM,MAAMU,aAAa,GAAIR,MAAsB,IAAK;EACrD,OAAO,IAAIF,OAAO,CAACE,MAAM,CAAC;AAC9B,CAAC;AAACO,OAAA,CAAAC,aAAA,GAAAA,aAAA","ignoreList":[]}
1
+ {"version":3,"file":"resolver/app/bundler/Bundler.js","sources":["../../../../src/resolver/app/bundler/Bundler.ts"],"sourcesContent":["import type { IBundler, IBundlerBundleParams, IBundles } from \"~/resolver/app/bundler/types.js\";\n\nexport interface IBundlerParams {\n createBundles: () => IBundles;\n}\n\nexport class Bundler implements IBundler {\n private readonly createBundles: () => IBundles;\n\n public constructor(params: IBundlerParams) {\n this.createBundles = params.createBundles;\n }\n\n public bundle(params: IBundlerBundleParams): IBundles {\n const { items } = params;\n\n const bundles = this.createBundles();\n\n for (const item of items) {\n bundles.add({\n item\n });\n }\n\n return bundles;\n }\n}\n\nexport const createBundler = (params: IBundlerParams) => {\n return new Bundler(params);\n};\n"],"names":["Bundler","params","items","bundles","item","createBundler"],"mappings":"AAMO,MAAMA;IAGT,YAAmBC,MAAsB,CAAE;QACvC,IAAI,CAAC,aAAa,GAAGA,OAAO,aAAa;IAC7C;IAEO,OAAOA,MAA4B,EAAY;QAClD,MAAM,EAAEC,KAAK,EAAE,GAAGD;QAElB,MAAME,UAAU,IAAI,CAAC,aAAa;QAElC,KAAK,MAAMC,QAAQF,MACfC,QAAQ,GAAG,CAAC;YACRC;QACJ;QAGJ,OAAOD;IACX;AACJ;AAEO,MAAME,gBAAgB,CAACJ,SACnB,IAAID,QAAQC"}
@@ -1,5 +1,5 @@
1
- import type { IBundle, IBundles, IBundlesAddParams } from "./types.js";
2
- import type { IIngestorResultItem } from "../ingestor/types.js";
1
+ import type { IBundle, IBundles, IBundlesAddParams } from "../../../resolver/app/bundler/types.js";
2
+ import type { IIngestorResultItem } from "../../../resolver/app/ingestor/types.js";
3
3
  export interface IBundlesParams {
4
4
  createBundle: (item: IIngestorResultItem) => IBundle;
5
5
  }
@@ -1,38 +1,25 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createBundles = exports.Bundles = void 0;
7
1
  class Bundles {
8
- bundles = [];
9
- constructor(params) {
10
- this.createBundle = params.createBundle;
11
- }
12
- add(params) {
13
- const {
14
- item
15
- } = params;
16
- const bundle = this.getBundle(item);
17
- bundle.add(item);
18
- }
19
- getBundles() {
20
- return this.bundles;
21
- }
22
- getBundle(item) {
23
- const last = this.bundles[this.bundles.length - 1];
24
- if (last?.canAdd(item)) {
25
- return last;
2
+ constructor(params){
3
+ this.bundles = [];
4
+ this.createBundle = params.createBundle;
5
+ }
6
+ add(params) {
7
+ const { item } = params;
8
+ const bundle = this.getBundle(item);
9
+ bundle.add(item);
10
+ }
11
+ getBundles() {
12
+ return this.bundles;
13
+ }
14
+ getBundle(item) {
15
+ const last = this.bundles[this.bundles.length - 1];
16
+ if (last?.canAdd(item)) return last;
17
+ const bundle = this.createBundle(item);
18
+ this.bundles.push(bundle);
19
+ return bundle;
26
20
  }
27
- const bundle = this.createBundle(item);
28
- this.bundles.push(bundle);
29
- return bundle;
30
- }
31
21
  }
32
- exports.Bundles = Bundles;
33
- const createBundles = params => {
34
- return new Bundles(params);
35
- };
36
- exports.createBundles = createBundles;
22
+ const createBundles = (params)=>new Bundles(params);
23
+ export { Bundles, createBundles };
37
24
 
38
25
  //# sourceMappingURL=Bundles.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Bundles","bundles","constructor","params","createBundle","add","item","bundle","getBundle","getBundles","last","length","canAdd","push","exports","createBundles"],"sources":["Bundles.ts"],"sourcesContent":["import type { IBundle, IBundles, IBundlesAddParams } from \"~/resolver/app/bundler/types.js\";\nimport type { IIngestorResultItem } from \"~/resolver/app/ingestor/types.js\";\n\nexport interface IBundlesParams {\n createBundle: (item: IIngestorResultItem) => IBundle;\n}\n\nexport class Bundles implements IBundles {\n private readonly bundles: IBundle[] = [];\n private readonly createBundle: (item: IIngestorResultItem) => IBundle;\n\n public constructor(params: IBundlesParams) {\n this.createBundle = params.createBundle;\n }\n\n public add(params: IBundlesAddParams): void {\n const { item } = params;\n\n const bundle = this.getBundle(item);\n\n bundle.add(item);\n }\n\n public getBundles(): IBundle[] {\n return this.bundles;\n }\n\n private getBundle(item: IIngestorResultItem): IBundle {\n const last = this.bundles[this.bundles.length - 1];\n if (last?.canAdd(item)) {\n return last;\n }\n const bundle = this.createBundle(item);\n this.bundles.push(bundle);\n return bundle;\n }\n}\n\nexport const createBundles = (params: IBundlesParams) => {\n return new Bundles(params);\n};\n"],"mappings":";;;;;;AAOO,MAAMA,OAAO,CAAqB;EACpBC,OAAO,GAAc,EAAE;EAGjCC,WAAWA,CAACC,MAAsB,EAAE;IACvC,IAAI,CAACC,YAAY,GAAGD,MAAM,CAACC,YAAY;EAC3C;EAEOC,GAAGA,CAACF,MAAyB,EAAQ;IACxC,MAAM;MAAEG;IAAK,CAAC,GAAGH,MAAM;IAEvB,MAAMI,MAAM,GAAG,IAAI,CAACC,SAAS,CAACF,IAAI,CAAC;IAEnCC,MAAM,CAACF,GAAG,CAACC,IAAI,CAAC;EACpB;EAEOG,UAAUA,CAAA,EAAc;IAC3B,OAAO,IAAI,CAACR,OAAO;EACvB;EAEQO,SAASA,CAACF,IAAyB,EAAW;IAClD,MAAMI,IAAI,GAAG,IAAI,CAACT,OAAO,CAAC,IAAI,CAACA,OAAO,CAACU,MAAM,GAAG,CAAC,CAAC;IAClD,IAAID,IAAI,EAAEE,MAAM,CAACN,IAAI,CAAC,EAAE;MACpB,OAAOI,IAAI;IACf;IACA,MAAMH,MAAM,GAAG,IAAI,CAACH,YAAY,CAACE,IAAI,CAAC;IACtC,IAAI,CAACL,OAAO,CAACY,IAAI,CAACN,MAAM,CAAC;IACzB,OAAOA,MAAM;EACjB;AACJ;AAACO,OAAA,CAAAd,OAAA,GAAAA,OAAA;AAEM,MAAMe,aAAa,GAAIZ,MAAsB,IAAK;EACrD,OAAO,IAAIH,OAAO,CAACG,MAAM,CAAC;AAC9B,CAAC;AAACW,OAAA,CAAAC,aAAA,GAAAA,aAAA","ignoreList":[]}
1
+ {"version":3,"file":"resolver/app/bundler/Bundles.js","sources":["../../../../src/resolver/app/bundler/Bundles.ts"],"sourcesContent":["import type { IBundle, IBundles, IBundlesAddParams } from \"~/resolver/app/bundler/types.js\";\nimport type { IIngestorResultItem } from \"~/resolver/app/ingestor/types.js\";\n\nexport interface IBundlesParams {\n createBundle: (item: IIngestorResultItem) => IBundle;\n}\n\nexport class Bundles implements IBundles {\n private readonly bundles: IBundle[] = [];\n private readonly createBundle: (item: IIngestorResultItem) => IBundle;\n\n public constructor(params: IBundlesParams) {\n this.createBundle = params.createBundle;\n }\n\n public add(params: IBundlesAddParams): void {\n const { item } = params;\n\n const bundle = this.getBundle(item);\n\n bundle.add(item);\n }\n\n public getBundles(): IBundle[] {\n return this.bundles;\n }\n\n private getBundle(item: IIngestorResultItem): IBundle {\n const last = this.bundles[this.bundles.length - 1];\n if (last?.canAdd(item)) {\n return last;\n }\n const bundle = this.createBundle(item);\n this.bundles.push(bundle);\n return bundle;\n }\n}\n\nexport const createBundles = (params: IBundlesParams) => {\n return new Bundles(params);\n};\n"],"names":["Bundles","params","item","bundle","last","createBundles"],"mappings":"AAOO,MAAMA;IAIT,YAAmBC,MAAsB,CAAE;aAH1B,OAAO,GAAc,EAAE;QAIpC,IAAI,CAAC,YAAY,GAAGA,OAAO,YAAY;IAC3C;IAEO,IAAIA,MAAyB,EAAQ;QACxC,MAAM,EAAEC,IAAI,EAAE,GAAGD;QAEjB,MAAME,SAAS,IAAI,CAAC,SAAS,CAACD;QAE9BC,OAAO,GAAG,CAACD;IACf;IAEO,aAAwB;QAC3B,OAAO,IAAI,CAAC,OAAO;IACvB;IAEQ,UAAUA,IAAyB,EAAW;QAClD,MAAME,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,EAAE;QAClD,IAAIA,MAAM,OAAOF,OACb,OAAOE;QAEX,MAAMD,SAAS,IAAI,CAAC,YAAY,CAACD;QACjC,IAAI,CAAC,OAAO,CAAC,IAAI,CAACC;QAClB,OAAOA;IACX;AACJ;AAEO,MAAME,gBAAgB,CAACJ,SACnB,IAAID,QAAQC"}
@@ -6,7 +6,7 @@
6
6
  * This will be used for executing the commands in the target systems.
7
7
  */
8
8
  import type { IBundle } from "./types.js";
9
- import type { IIngestorResultItem } from "../ingestor/types";
9
+ import type { IIngestorResultItem } from "../ingestor/types.js";
10
10
  import type { IBaseBundleParams } from "./BaseBundle.js";
11
11
  import { BaseBundle } from "./BaseBundle.js";
12
12
  export declare class CommandBundle extends BaseBundle {
@@ -1,28 +1,11 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createCommandBundle = exports.CommandBundle = void 0;
7
- var _BaseBundle = require("./BaseBundle.js");
8
- /**
9
- * Used to bundle by source system, table and command.
10
- * If we receive >1 commands in a single batch, for example, put -> delete -> put -> delete, we need to make sure
11
- * that commands are executed in that order.
12
- *
13
- * This will be used for executing the commands in the target systems.
14
- */
15
-
16
- class CommandBundle extends _BaseBundle.BaseBundle {
17
- canAdd(item) {
18
- const command = this.getCommand(item.command);
19
- return this.command === command && this.table.name === item.table.name && this.source.name === item.source.name;
20
- }
1
+ import { BaseBundle } from "./BaseBundle.js";
2
+ class CommandBundle extends BaseBundle {
3
+ canAdd(item) {
4
+ const command = this.getCommand(item.command);
5
+ return this.command === command && this.table.name === item.table.name && this.source.name === item.source.name;
6
+ }
21
7
  }
22
- exports.CommandBundle = CommandBundle;
23
- const createCommandBundle = params => {
24
- return new CommandBundle(params);
25
- };
26
- exports.createCommandBundle = createCommandBundle;
8
+ const createCommandBundle = (params)=>new CommandBundle(params);
9
+ export { CommandBundle, createCommandBundle };
27
10
 
28
11
  //# sourceMappingURL=CommandBundle.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_BaseBundle","require","CommandBundle","BaseBundle","canAdd","item","command","getCommand","table","name","source","exports","createCommandBundle","params"],"sources":["CommandBundle.ts"],"sourcesContent":["/**\n * Used to bundle by source system, table and command.\n * If we receive >1 commands in a single batch, for example, put -> delete -> put -> delete, we need to make sure\n * that commands are executed in that order.\n *\n * This will be used for executing the commands in the target systems.\n */\nimport type { IBundle } from \"./types.js\";\nimport type { IIngestorResultItem } from \"../ingestor/types\";\nimport type { IBaseBundleParams } from \"./BaseBundle.js\";\nimport { BaseBundle } from \"./BaseBundle.js\";\n\nexport class CommandBundle extends BaseBundle {\n public canAdd(item: IIngestorResultItem): boolean {\n const command = this.getCommand(item.command);\n return (\n this.command === command &&\n this.table.name === item.table.name &&\n this.source.name === item.source.name\n );\n }\n}\n\nexport const createCommandBundle = (params: IBaseBundleParams): IBundle => {\n return new CommandBundle(params);\n};\n"],"mappings":";;;;;;AAUA,IAAAA,WAAA,GAAAC,OAAA;AAVA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMO,MAAMC,aAAa,SAASC,sBAAU,CAAC;EACnCC,MAAMA,CAACC,IAAyB,EAAW;IAC9C,MAAMC,OAAO,GAAG,IAAI,CAACC,UAAU,CAACF,IAAI,CAACC,OAAO,CAAC;IAC7C,OACI,IAAI,CAACA,OAAO,KAAKA,OAAO,IACxB,IAAI,CAACE,KAAK,CAACC,IAAI,KAAKJ,IAAI,CAACG,KAAK,CAACC,IAAI,IACnC,IAAI,CAACC,MAAM,CAACD,IAAI,KAAKJ,IAAI,CAACK,MAAM,CAACD,IAAI;EAE7C;AACJ;AAACE,OAAA,CAAAT,aAAA,GAAAA,aAAA;AAEM,MAAMU,mBAAmB,GAAIC,MAAyB,IAAc;EACvE,OAAO,IAAIX,aAAa,CAACW,MAAM,CAAC;AACpC,CAAC;AAACF,OAAA,CAAAC,mBAAA,GAAAA,mBAAA","ignoreList":[]}
1
+ {"version":3,"file":"resolver/app/bundler/CommandBundle.js","sources":["../../../../src/resolver/app/bundler/CommandBundle.ts"],"sourcesContent":["/**\n * Used to bundle by source system, table and command.\n * If we receive >1 commands in a single batch, for example, put -> delete -> put -> delete, we need to make sure\n * that commands are executed in that order.\n *\n * This will be used for executing the commands in the target systems.\n */\nimport type { IBundle } from \"./types.js\";\nimport type { IIngestorResultItem } from \"../ingestor/types.js\";\nimport type { IBaseBundleParams } from \"./BaseBundle.js\";\nimport { BaseBundle } from \"./BaseBundle.js\";\n\nexport class CommandBundle extends BaseBundle {\n public canAdd(item: IIngestorResultItem): boolean {\n const command = this.getCommand(item.command);\n return (\n this.command === command &&\n this.table.name === item.table.name &&\n this.source.name === item.source.name\n );\n }\n}\n\nexport const createCommandBundle = (params: IBaseBundleParams): IBundle => {\n return new CommandBundle(params);\n};\n"],"names":["CommandBundle","BaseBundle","item","command","createCommandBundle","params"],"mappings":";AAYO,MAAMA,sBAAsBC;IACxB,OAAOC,IAAyB,EAAW;QAC9C,MAAMC,UAAU,IAAI,CAAC,UAAU,CAACD,KAAK,OAAO;QAC5C,OACI,IAAI,CAAC,OAAO,KAAKC,WACjB,IAAI,CAAC,KAAK,CAAC,IAAI,KAAKD,KAAK,KAAK,CAAC,IAAI,IACnC,IAAI,CAAC,MAAM,CAAC,IAAI,KAAKA,KAAK,MAAM,CAAC,IAAI;IAE7C;AACJ;AAEO,MAAME,sBAAsB,CAACC,SACzB,IAAIL,cAAcK"}
@@ -4,7 +4,7 @@
4
4
  * It will be used to fetch the data from the source system tables.
5
5
  */
6
6
  import type { IBundle } from "./types.js";
7
- import type { IIngestorResultItem } from "../ingestor/types";
7
+ import type { IIngestorResultItem } from "../ingestor/types.js";
8
8
  import type { IBaseBundleParams } from "./BaseBundle.js";
9
9
  import { BaseBundle } from "./BaseBundle.js";
10
10
  export declare class TableBundle extends BaseBundle {
@@ -1,25 +1,10 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createTableBundle = exports.TableBundle = void 0;
7
- var _BaseBundle = require("./BaseBundle.js");
8
- /**
9
- * This will bundle records by system and table.
10
- *
11
- * It will be used to fetch the data from the source system tables.
12
- */
13
-
14
- class TableBundle extends _BaseBundle.BaseBundle {
15
- canAdd(item) {
16
- return this.source.name === item.source.name && this.table.name === item.table.name;
17
- }
1
+ import { BaseBundle } from "./BaseBundle.js";
2
+ class TableBundle extends BaseBundle {
3
+ canAdd(item) {
4
+ return this.source.name === item.source.name && this.table.name === item.table.name;
5
+ }
18
6
  }
19
- exports.TableBundle = TableBundle;
20
- const createTableBundle = params => {
21
- return new TableBundle(params);
22
- };
23
- exports.createTableBundle = createTableBundle;
7
+ const createTableBundle = (params)=>new TableBundle(params);
8
+ export { TableBundle, createTableBundle };
24
9
 
25
10
  //# sourceMappingURL=TableBundle.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_BaseBundle","require","TableBundle","BaseBundle","canAdd","item","source","name","table","exports","createTableBundle","params"],"sources":["TableBundle.ts"],"sourcesContent":["/**\n * This will bundle records by system and table.\n *\n * It will be used to fetch the data from the source system tables.\n */\nimport type { IBundle } from \"./types.js\";\nimport type { IIngestorResultItem } from \"../ingestor/types\";\nimport type { IBaseBundleParams } from \"./BaseBundle.js\";\nimport { BaseBundle } from \"./BaseBundle.js\";\n\nexport class TableBundle extends BaseBundle {\n public canAdd(item: IIngestorResultItem): boolean {\n return this.source.name === item.source.name && this.table.name === item.table.name;\n }\n}\n\nexport const createTableBundle = (params: IBaseBundleParams): IBundle => {\n return new TableBundle(params);\n};\n"],"mappings":";;;;;;AAQA,IAAAA,WAAA,GAAAC,OAAA;AARA;AACA;AACA;AACA;AACA;;AAMO,MAAMC,WAAW,SAASC,sBAAU,CAAC;EACjCC,MAAMA,CAACC,IAAyB,EAAW;IAC9C,OAAO,IAAI,CAACC,MAAM,CAACC,IAAI,KAAKF,IAAI,CAACC,MAAM,CAACC,IAAI,IAAI,IAAI,CAACC,KAAK,CAACD,IAAI,KAAKF,IAAI,CAACG,KAAK,CAACD,IAAI;EACvF;AACJ;AAACE,OAAA,CAAAP,WAAA,GAAAA,WAAA;AAEM,MAAMQ,iBAAiB,GAAIC,MAAyB,IAAc;EACrE,OAAO,IAAIT,WAAW,CAACS,MAAM,CAAC;AAClC,CAAC;AAACF,OAAA,CAAAC,iBAAA,GAAAA,iBAAA","ignoreList":[]}
1
+ {"version":3,"file":"resolver/app/bundler/TableBundle.js","sources":["../../../../src/resolver/app/bundler/TableBundle.ts"],"sourcesContent":["/**\n * This will bundle records by system and table.\n *\n * It will be used to fetch the data from the source system tables.\n */\nimport type { IBundle } from \"./types.js\";\nimport type { IIngestorResultItem } from \"../ingestor/types.js\";\nimport type { IBaseBundleParams } from \"./BaseBundle.js\";\nimport { BaseBundle } from \"./BaseBundle.js\";\n\nexport class TableBundle extends BaseBundle {\n public canAdd(item: IIngestorResultItem): boolean {\n return this.source.name === item.source.name && this.table.name === item.table.name;\n }\n}\n\nexport const createTableBundle = (params: IBaseBundleParams): IBundle => {\n return new TableBundle(params);\n};\n"],"names":["TableBundle","BaseBundle","item","createTableBundle","params"],"mappings":";AAUO,MAAMA,oBAAoBC;IACtB,OAAOC,IAAyB,EAAW;QAC9C,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,KAAKA,KAAK,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,KAAKA,KAAK,KAAK,CAAC,IAAI;IACvF;AACJ;AAEO,MAAMC,oBAAoB,CAACC,SACvB,IAAIJ,YAAYI"}
@@ -1,7 +1,7 @@
1
- import type { IIngestorResultItem } from "../ingestor/types.js";
1
+ import type { IIngestorResultItem } from "../../../resolver/app/ingestor/types.js";
2
2
  import type { CommandType } from "../../../types.js";
3
3
  import type { ITable } from "../../../sync/types.js";
4
- import type { IDeployment } from "../../deployment/types.js";
4
+ import type { IDeployment } from "../../../resolver/deployment/types.js";
5
5
  export interface IBundleItem {
6
6
  PK: string;
7
7
  SK: string;
@@ -1,7 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- //# sourceMappingURL=types.js.map
@@ -1,7 +1,7 @@
1
- import type { IStoreItem, IStorer } from "../storer/types";
2
- import type { IDeployment } from "../../deployment/types.js";
1
+ import type { IStoreItem, IStorer } from "../storer/types.js";
2
+ import type { IDeployment } from "../../../resolver/deployment/types.js";
3
3
  import type { ITable } from "../../../sync/types.js";
4
- import type { IBundle } from "../bundler/types.js";
4
+ import type { IBundle } from "../../../resolver/app/bundler/types.js";
5
5
  export interface IDeleteCommandHandlerHandleParams {
6
6
  targetDeployment: IDeployment;
7
7
  targetTable: ITable;
@@ -1,39 +1,25 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.DeleteCommandHandler = void 0;
7
1
  class DeleteCommandHandler {
8
- constructor(params) {
9
- this.storer = params.storer;
10
- }
11
- async handle(params) {
12
- const {
13
- targetDeployment,
14
- targetTable,
15
- bundle
16
- } = params;
17
- const result = bundle.items.map(item => {
18
- if (!item.PK || !item.SK) {
19
- return null;
20
- }
21
- return {
22
- PK: item.PK,
23
- SK: item.SK
24
- };
25
- }).filter(item => {
26
- return !!item;
27
- });
28
- await this.storer.store({
29
- command: "delete",
30
- deployment: targetDeployment,
31
- table: targetTable,
32
- items: result,
33
- bundle
34
- });
35
- }
2
+ constructor(params){
3
+ this.storer = params.storer;
4
+ }
5
+ async handle(params) {
6
+ const { targetDeployment, targetTable, bundle } = params;
7
+ const result = bundle.items.map((item)=>{
8
+ if (!item.PK || !item.SK) return null;
9
+ return {
10
+ PK: item.PK,
11
+ SK: item.SK
12
+ };
13
+ }).filter((item)=>!!item);
14
+ await this.storer.store({
15
+ command: "delete",
16
+ deployment: targetDeployment,
17
+ table: targetTable,
18
+ items: result,
19
+ bundle
20
+ });
21
+ }
36
22
  }
37
- exports.DeleteCommandHandler = DeleteCommandHandler;
23
+ export { DeleteCommandHandler };
38
24
 
39
25
  //# sourceMappingURL=DeleteCommandHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["DeleteCommandHandler","constructor","params","storer","handle","targetDeployment","targetTable","bundle","result","items","map","item","PK","SK","filter","store","command","deployment","table","exports"],"sources":["DeleteCommandHandler.ts"],"sourcesContent":["import type { IStoreItem, IStorer } from \"../storer/types\";\nimport type { IDeployment } from \"~/resolver/deployment/types.js\";\nimport type { ITable } from \"~/sync/types.js\";\nimport type { IBundle } from \"~/resolver/app/bundler/types.js\";\n\nexport interface IDeleteCommandHandlerHandleParams {\n targetDeployment: IDeployment;\n targetTable: ITable;\n items: IStoreItem[];\n bundle: IBundle;\n}\n\nexport interface IDeleteCommandHandlerParams {\n storer: IStorer;\n}\n\nexport class DeleteCommandHandler {\n private readonly storer: IStorer;\n\n public constructor(params: IDeleteCommandHandlerParams) {\n this.storer = params.storer;\n }\n public async handle(params: IDeleteCommandHandlerHandleParams): Promise<void> {\n const { targetDeployment, targetTable, bundle } = params;\n const result = bundle.items\n .map(item => {\n if (!item.PK || !item.SK) {\n return null;\n }\n return {\n PK: item.PK,\n SK: item.SK\n };\n })\n .filter((item): item is IStoreItem => {\n return !!item;\n });\n\n await this.storer.store({\n command: \"delete\",\n deployment: targetDeployment,\n table: targetTable,\n items: result,\n bundle\n });\n }\n}\n"],"mappings":";;;;;;AAgBO,MAAMA,oBAAoB,CAAC;EAGvBC,WAAWA,CAACC,MAAmC,EAAE;IACpD,IAAI,CAACC,MAAM,GAAGD,MAAM,CAACC,MAAM;EAC/B;EACA,MAAaC,MAAMA,CAACF,MAAyC,EAAiB;IAC1E,MAAM;MAAEG,gBAAgB;MAAEC,WAAW;MAAEC;IAAO,CAAC,GAAGL,MAAM;IACxD,MAAMM,MAAM,GAAGD,MAAM,CAACE,KAAK,CACtBC,GAAG,CAACC,IAAI,IAAI;MACT,IAAI,CAACA,IAAI,CAACC,EAAE,IAAI,CAACD,IAAI,CAACE,EAAE,EAAE;QACtB,OAAO,IAAI;MACf;MACA,OAAO;QACHD,EAAE,EAAED,IAAI,CAACC,EAAE;QACXC,EAAE,EAAEF,IAAI,CAACE;MACb,CAAC;IACL,CAAC,CAAC,CACDC,MAAM,CAAEH,IAAI,IAAyB;MAClC,OAAO,CAAC,CAACA,IAAI;IACjB,CAAC,CAAC;IAEN,MAAM,IAAI,CAACR,MAAM,CAACY,KAAK,CAAC;MACpBC,OAAO,EAAE,QAAQ;MACjBC,UAAU,EAAEZ,gBAAgB;MAC5Ba,KAAK,EAAEZ,WAAW;MAClBG,KAAK,EAAED,MAAM;MACbD;IACJ,CAAC,CAAC;EACN;AACJ;AAACY,OAAA,CAAAnB,oBAAA,GAAAA,oBAAA","ignoreList":[]}
1
+ {"version":3,"file":"resolver/app/commandHandler/DeleteCommandHandler.js","sources":["../../../../src/resolver/app/commandHandler/DeleteCommandHandler.ts"],"sourcesContent":["import type { IStoreItem, IStorer } from \"../storer/types.js\";\nimport type { IDeployment } from \"~/resolver/deployment/types.js\";\nimport type { ITable } from \"~/sync/types.js\";\nimport type { IBundle } from \"~/resolver/app/bundler/types.js\";\n\nexport interface IDeleteCommandHandlerHandleParams {\n targetDeployment: IDeployment;\n targetTable: ITable;\n items: IStoreItem[];\n bundle: IBundle;\n}\n\nexport interface IDeleteCommandHandlerParams {\n storer: IStorer;\n}\n\nexport class DeleteCommandHandler {\n private readonly storer: IStorer;\n\n public constructor(params: IDeleteCommandHandlerParams) {\n this.storer = params.storer;\n }\n public async handle(params: IDeleteCommandHandlerHandleParams): Promise<void> {\n const { targetDeployment, targetTable, bundle } = params;\n const result = bundle.items\n .map(item => {\n if (!item.PK || !item.SK) {\n return null;\n }\n return {\n PK: item.PK,\n SK: item.SK\n };\n })\n .filter((item): item is IStoreItem => {\n return !!item;\n });\n\n await this.storer.store({\n command: \"delete\",\n deployment: targetDeployment,\n table: targetTable,\n items: result,\n bundle\n });\n }\n}\n"],"names":["DeleteCommandHandler","params","targetDeployment","targetTable","bundle","result","item"],"mappings":"AAgBO,MAAMA;IAGT,YAAmBC,MAAmC,CAAE;QACpD,IAAI,CAAC,MAAM,GAAGA,OAAO,MAAM;IAC/B;IACA,MAAa,OAAOA,MAAyC,EAAiB;QAC1E,MAAM,EAAEC,gBAAgB,EAAEC,WAAW,EAAEC,MAAM,EAAE,GAAGH;QAClD,MAAMI,SAASD,OAAO,KAAK,CACtB,GAAG,CAACE,CAAAA;YACD,IAAI,CAACA,KAAK,EAAE,IAAI,CAACA,KAAK,EAAE,EACpB,OAAO;YAEX,OAAO;gBACH,IAAIA,KAAK,EAAE;gBACX,IAAIA,KAAK,EAAE;YACf;QACJ,GACC,MAAM,CAAC,CAACA,OACE,CAAC,CAACA;QAGjB,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;YACpB,SAAS;YACT,YAAYJ;YACZ,OAAOC;YACP,OAAOE;YACPD;QACJ;IACJ;AACJ"}