@webiny/api-sync-system 6.3.0 → 6.4.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (239) hide show
  1. package/constants.js +2 -1
  2. package/constants.js.map +1 -1
  3. package/index.js +0 -2
  4. package/package.json +14 -14
  5. package/resolver/app/RecordHandler.js +83 -105
  6. package/resolver/app/RecordHandler.js.map +1 -1
  7. package/resolver/app/RecordsValidation.js +11 -14
  8. package/resolver/app/RecordsValidation.js.map +1 -1
  9. package/resolver/app/ResolverApplication.js +24 -31
  10. package/resolver/app/ResolverApplication.js.map +1 -1
  11. package/resolver/app/abstractions/RecordHandler.js +0 -3
  12. package/resolver/app/abstractions/RecordsValidation.js +0 -3
  13. package/resolver/app/abstractions/ResolverApplication.js +0 -3
  14. package/resolver/app/abstractions/ResolverRecord.js +0 -3
  15. package/resolver/app/bundler/BaseBundle.js +17 -16
  16. package/resolver/app/bundler/BaseBundle.js.map +1 -1
  17. package/resolver/app/bundler/Bundler.js +13 -18
  18. package/resolver/app/bundler/Bundler.js.map +1 -1
  19. package/resolver/app/bundler/Bundles.js +21 -26
  20. package/resolver/app/bundler/Bundles.js.map +1 -1
  21. package/resolver/app/bundler/CommandBundle.js +7 -16
  22. package/resolver/app/bundler/CommandBundle.js.map +1 -1
  23. package/resolver/app/bundler/TableBundle.js +6 -13
  24. package/resolver/app/bundler/TableBundle.js.map +1 -1
  25. package/resolver/app/bundler/types.js +0 -3
  26. package/resolver/app/commandHandler/DeleteCommandHandler.js +22 -29
  27. package/resolver/app/commandHandler/DeleteCommandHandler.js.map +1 -1
  28. package/resolver/app/commandHandler/PutCommandHandler.js +16 -22
  29. package/resolver/app/commandHandler/PutCommandHandler.js.map +1 -1
  30. package/resolver/app/commandHandler/delete.js +11 -12
  31. package/resolver/app/commandHandler/delete.js.map +1 -1
  32. package/resolver/app/commandHandler/put.js +11 -12
  33. package/resolver/app/commandHandler/put.js.map +1 -1
  34. package/resolver/app/data/SourceDataContainer.js +28 -30
  35. package/resolver/app/data/SourceDataContainer.js.map +1 -1
  36. package/resolver/app/data/types.js +0 -3
  37. package/resolver/app/fetcher/Fetcher.js +84 -109
  38. package/resolver/app/fetcher/Fetcher.js.map +1 -1
  39. package/resolver/app/fetcher/types.js +0 -3
  40. package/resolver/app/ingestor/Ingestor.js +27 -32
  41. package/resolver/app/ingestor/Ingestor.js.map +1 -1
  42. package/resolver/app/ingestor/IngestorResult.js +28 -32
  43. package/resolver/app/ingestor/IngestorResult.js.map +1 -1
  44. package/resolver/app/ingestor/types.js +0 -3
  45. package/resolver/app/storer/Storer.js +71 -85
  46. package/resolver/app/storer/Storer.js.map +1 -1
  47. package/resolver/app/storer/types.js +0 -3
  48. package/resolver/app/transform/TransformHandler.js +45 -56
  49. package/resolver/app/transform/TransformHandler.js.map +1 -1
  50. package/resolver/app/transform/middleware.js +13 -20
  51. package/resolver/app/transform/middleware.js.map +1 -1
  52. package/resolver/app/utils/Retry.js +21 -24
  53. package/resolver/app/utils/Retry.js.map +1 -1
  54. package/resolver/app/utils/sleep.js +4 -5
  55. package/resolver/app/utils/sleep.js.map +1 -1
  56. package/resolver/app/validation/body.js +26 -31
  57. package/resolver/app/validation/body.js.map +1 -1
  58. package/resolver/app/validation/createJsonTransform.js +12 -13
  59. package/resolver/app/validation/createJsonTransform.js.map +1 -1
  60. package/resolver/app/validation/detail.js +30 -35
  61. package/resolver/app/validation/detail.js.map +1 -1
  62. package/resolver/app/validation/event.js +17 -18
  63. package/resolver/app/validation/event.js.map +1 -1
  64. package/resolver/app/validation/numericString.js +8 -11
  65. package/resolver/app/validation/numericString.js.map +1 -1
  66. package/resolver/app/validation/system.js +8 -9
  67. package/resolver/app/validation/system.js.map +1 -1
  68. package/resolver/createEventHandlerPlugin.js +70 -99
  69. package/resolver/createEventHandlerPlugin.js.map +1 -1
  70. package/resolver/createResolverHandler.js +49 -57
  71. package/resolver/createResolverHandler.js.map +1 -1
  72. package/resolver/deployment/Deployment.js +28 -31
  73. package/resolver/deployment/Deployment.js.map +1 -1
  74. package/resolver/deployment/Deployments.js +20 -23
  75. package/resolver/deployment/Deployments.js.map +1 -1
  76. package/resolver/deployment/DeploymentsFetcher.js +75 -84
  77. package/resolver/deployment/DeploymentsFetcher.js.map +1 -1
  78. package/resolver/deployment/types.js +0 -3
  79. package/resolver/lambda/LambdaTrigger.js +24 -26
  80. package/resolver/lambda/LambdaTrigger.js.map +1 -1
  81. package/resolver/plugins/CommandHandlerPlugin.js +16 -15
  82. package/resolver/plugins/CommandHandlerPlugin.js.map +1 -1
  83. package/resolver/plugins/StorerAfterEachPlugin.js +20 -19
  84. package/resolver/plugins/StorerAfterEachPlugin.js.map +1 -1
  85. package/resolver/plugins/TransformRecordPlugin.js +19 -18
  86. package/resolver/plugins/TransformRecordPlugin.js.map +1 -1
  87. package/resolver/recordTypes/fileManager/CopyFile.js +44 -67
  88. package/resolver/recordTypes/fileManager/CopyFile.js.map +1 -1
  89. package/resolver/recordTypes/fileManager/DeleteFile.js +40 -58
  90. package/resolver/recordTypes/fileManager/DeleteFile.js.map +1 -1
  91. package/resolver/recordTypes/fileManager/fileManager.js +5 -3
  92. package/resolver/recordTypes/fileManager/fileManager.js.map +1 -1
  93. package/resolver/recordTypes/fileManager/fileManagerOnDelete.js +24 -35
  94. package/resolver/recordTypes/fileManager/fileManagerOnDelete.js.map +1 -1
  95. package/resolver/recordTypes/fileManager/fileManagerOnPut.js +24 -35
  96. package/resolver/recordTypes/fileManager/fileManagerOnPut.js.map +1 -1
  97. package/resolver/recordTypes/fileManager/shouldBeHandled.js +10 -27
  98. package/resolver/recordTypes/fileManager/shouldBeHandled.js.map +1 -1
  99. package/resolver/recordTypes/fileManager/types.js +0 -3
  100. package/resolver/recordTypes/users/CopyUser.js +44 -54
  101. package/resolver/recordTypes/users/CopyUser.js.map +1 -1
  102. package/resolver/recordTypes/users/DeleteUser.js +40 -51
  103. package/resolver/recordTypes/users/DeleteUser.js.map +1 -1
  104. package/resolver/recordTypes/users/shouldBeHandled.js +10 -26
  105. package/resolver/recordTypes/users/shouldBeHandled.js.map +1 -1
  106. package/resolver/recordTypes/users/types.js +0 -3
  107. package/resolver/recordTypes/users/users.js +5 -3
  108. package/resolver/recordTypes/users/users.js.map +1 -1
  109. package/resolver/recordTypes/users/usersOnDelete.js +23 -34
  110. package/resolver/recordTypes/users/usersOnDelete.js.map +1 -1
  111. package/resolver/recordTypes/users/usersOnPut.js +24 -35
  112. package/resolver/recordTypes/users/usersOnPut.js.map +1 -1
  113. package/sync/FilterOutRecord.js +9 -17
  114. package/sync/FilterOutRecord.js.map +1 -1
  115. package/sync/attachToDynamoDbDocument.js +46 -65
  116. package/sync/attachToDynamoDbDocument.js.map +1 -1
  117. package/sync/createHandler.js +31 -40
  118. package/sync/createHandler.js.map +1 -1
  119. package/sync/createSendDataToEventBridgeOnRequestEnd.js +32 -37
  120. package/sync/createSendDataToEventBridgeOnRequestEnd.js.map +1 -1
  121. package/sync/createSyncSystem.js +24 -26
  122. package/sync/createSyncSystem.js.map +1 -1
  123. package/sync/filter/createDefaultFilterOutRecordPlugins.js +37 -76
  124. package/sync/filter/createDefaultFilterOutRecordPlugins.js.map +1 -1
  125. package/sync/handler/Handler.js +64 -76
  126. package/sync/handler/Handler.js.map +1 -1
  127. package/sync/handler/HandlerConverter.js +21 -29
  128. package/sync/handler/HandlerConverter.js.map +1 -1
  129. package/sync/handler/converter/BatchGetCommandConverter.js +12 -11
  130. package/sync/handler/converter/BatchGetCommandConverter.js.map +1 -1
  131. package/sync/handler/converter/BatchWriteCommandConverter.js +12 -11
  132. package/sync/handler/converter/BatchWriteCommandConverter.js.map +1 -1
  133. package/sync/handler/converter/DeleteCommandConverter.js +12 -11
  134. package/sync/handler/converter/DeleteCommandConverter.js.map +1 -1
  135. package/sync/handler/converter/GetCommandConverter.js +12 -11
  136. package/sync/handler/converter/GetCommandConverter.js.map +1 -1
  137. package/sync/handler/converter/PutCommandConverter.js +12 -11
  138. package/sync/handler/converter/PutCommandConverter.js.map +1 -1
  139. package/sync/handler/converter/QueryCommandConverter.js +12 -11
  140. package/sync/handler/converter/QueryCommandConverter.js.map +1 -1
  141. package/sync/handler/converter/ScanCommandConverter.js +12 -11
  142. package/sync/handler/converter/ScanCommandConverter.js.map +1 -1
  143. package/sync/handler/converter/UpdateCommandConverter.js +12 -11
  144. package/sync/handler/converter/UpdateCommandConverter.js.map +1 -1
  145. package/sync/handler/converter/commands/BatchWriteCommandValue.js +34 -37
  146. package/sync/handler/converter/commands/BatchWriteCommandValue.js.map +1 -1
  147. package/sync/handler/converter/commands/DeleteCommandValue.js +19 -16
  148. package/sync/handler/converter/commands/DeleteCommandValue.js.map +1 -1
  149. package/sync/handler/converter/commands/NullCommandValue.js +8 -8
  150. package/sync/handler/converter/commands/NullCommandValue.js.map +1 -1
  151. package/sync/handler/converter/commands/PutCommandValue.js +19 -16
  152. package/sync/handler/converter/commands/PutCommandValue.js.map +1 -1
  153. package/sync/handler/converter/commands/UpdateCommandValue.js +19 -16
  154. package/sync/handler/converter/commands/UpdateCommandValue.js.map +1 -1
  155. package/sync/handler/types.js +0 -3
  156. package/sync/plugins/FilterOutRecordPlugin.js +17 -19
  157. package/sync/plugins/FilterOutRecordPlugin.js.map +1 -1
  158. package/sync/requestPlugin.js +33 -48
  159. package/sync/requestPlugin.js.map +1 -1
  160. package/sync/types.js +0 -3
  161. package/sync/utils/getTableType.js +10 -9
  162. package/sync/utils/getTableType.js.map +1 -1
  163. package/sync/utils/manifest.js +28 -35
  164. package/sync/utils/manifest.js.map +1 -1
  165. package/sync/utils/validateSystemInput.js +21 -29
  166. package/sync/utils/validateSystemInput.js.map +1 -1
  167. package/types.js +6 -5
  168. package/types.js.map +1 -1
  169. package/utils/createSystemName.js +5 -3
  170. package/utils/createSystemName.js.map +1 -1
  171. package/worker/actions/copyFile/CopyFile.js +183 -258
  172. package/worker/actions/copyFile/CopyFile.js.map +1 -1
  173. package/worker/actions/copyFile/copyFileAction.js +26 -34
  174. package/worker/actions/copyFile/copyFileAction.js.map +1 -1
  175. package/worker/actions/copyFile/copyFileSchema.js +13 -14
  176. package/worker/actions/copyFile/copyFileSchema.js.map +1 -1
  177. package/worker/actions/copyFile/types.js +0 -3
  178. package/worker/actions/createUser/CreateUser.js +51 -74
  179. package/worker/actions/createUser/CreateUser.js.map +1 -1
  180. package/worker/actions/createUser/createUserAction.js +24 -28
  181. package/worker/actions/createUser/createUserAction.js.map +1 -1
  182. package/worker/actions/createUser/createUserSchema.js +13 -14
  183. package/worker/actions/createUser/createUserSchema.js.map +1 -1
  184. package/worker/actions/createUser/types.js +0 -3
  185. package/worker/actions/deleteFile/DeleteFile.js +52 -67
  186. package/worker/actions/deleteFile/DeleteFile.js.map +1 -1
  187. package/worker/actions/deleteFile/deleteFileAction.js +21 -29
  188. package/worker/actions/deleteFile/deleteFileAction.js.map +1 -1
  189. package/worker/actions/deleteFile/deleteFileSchema.js +13 -14
  190. package/worker/actions/deleteFile/deleteFileSchema.js.map +1 -1
  191. package/worker/actions/deleteFile/types.js +0 -3
  192. package/worker/actions/deleteUser/DeleteUser.js +38 -52
  193. package/worker/actions/deleteUser/DeleteUser.js.map +1 -1
  194. package/worker/actions/deleteUser/deleteUserAction.js +22 -26
  195. package/worker/actions/deleteUser/deleteUserAction.js.map +1 -1
  196. package/worker/actions/deleteUser/deleteUserSchema.js +12 -13
  197. package/worker/actions/deleteUser/deleteUserSchema.js.map +1 -1
  198. package/worker/actions/deleteUser/types.js +0 -3
  199. package/worker/actions/logValidationError.js +5 -6
  200. package/worker/actions/logValidationError.js.map +1 -1
  201. package/worker/actions/removeCognitoUserAttributes.js +9 -15
  202. package/worker/actions/removeCognitoUserAttributes.js.map +1 -1
  203. package/worker/actions/updateUser/UpdateUser.js +48 -65
  204. package/worker/actions/updateUser/UpdateUser.js.map +1 -1
  205. package/worker/actions/updateUser/types.js +0 -3
  206. package/worker/actions/updateUser/updateUserAction.js +24 -28
  207. package/worker/actions/updateUser/updateUserAction.js.map +1 -1
  208. package/worker/actions/updateUser/updateUserSchema.js +13 -14
  209. package/worker/actions/updateUser/updateUserSchema.js.map +1 -1
  210. package/worker/createWorkerHandler.js +24 -30
  211. package/worker/createWorkerHandler.js.map +1 -1
  212. package/worker/handler/WorkerActionHandler.js +19 -21
  213. package/worker/handler/WorkerActionHandler.js.map +1 -1
  214. package/worker/handler/eventHandler.js +14 -16
  215. package/worker/handler/eventHandler.js.map +1 -1
  216. package/worker/plugins/WorkerActionPlugin.js +17 -16
  217. package/worker/plugins/WorkerActionPlugin.js.map +1 -1
  218. package/worker/types.js +0 -3
  219. package/index.js.map +0 -1
  220. package/resolver/app/abstractions/RecordHandler.js.map +0 -1
  221. package/resolver/app/abstractions/RecordsValidation.js.map +0 -1
  222. package/resolver/app/abstractions/ResolverApplication.js.map +0 -1
  223. package/resolver/app/abstractions/ResolverRecord.js.map +0 -1
  224. package/resolver/app/bundler/types.js.map +0 -1
  225. package/resolver/app/data/types.js.map +0 -1
  226. package/resolver/app/fetcher/types.js.map +0 -1
  227. package/resolver/app/ingestor/types.js.map +0 -1
  228. package/resolver/app/storer/types.js.map +0 -1
  229. package/resolver/deployment/types.js.map +0 -1
  230. package/resolver/recordTypes/fileManager/types.js.map +0 -1
  231. package/resolver/recordTypes/users/types.js.map +0 -1
  232. package/sync/handler/types.js.map +0 -1
  233. package/sync/types.js.map +0 -1
  234. package/worker/actions/copyFile/types.js.map +0 -1
  235. package/worker/actions/createUser/types.js.map +0 -1
  236. package/worker/actions/deleteFile/types.js.map +0 -1
  237. package/worker/actions/deleteUser/types.js.map +0 -1
  238. package/worker/actions/updateUser/types.js.map +0 -1
  239. package/worker/types.js.map +0 -1
@@ -1,30 +1,25 @@
1
- export class Bundles {
2
- bundles = [];
3
- constructor(params) {
4
- this.createBundle = params.createBundle;
5
- }
6
- add(params) {
7
- const {
8
- item
9
- } = params;
10
- const bundle = this.getBundle(item);
11
- bundle.add(item);
12
- }
13
- getBundles() {
14
- return this.bundles;
15
- }
16
- getBundle(item) {
17
- const last = this.bundles[this.bundles.length - 1];
18
- if (last?.canAdd(item)) {
19
- return last;
1
+ class Bundles {
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;
20
20
  }
21
- const bundle = this.createBundle(item);
22
- this.bundles.push(bundle);
23
- return bundle;
24
- }
25
21
  }
26
- export const createBundles = params => {
27
- return new Bundles(params);
28
- };
22
+ const createBundles = (params)=>new Bundles(params);
23
+ export { Bundles, createBundles };
29
24
 
30
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","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":"AAOA,OAAO,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;AAEA,OAAO,MAAMO,aAAa,GAAIX,MAAsB,IAAK;EACrD,OAAO,IAAIH,OAAO,CAACG,MAAM,CAAC;AAC9B,CAAC","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"}
@@ -1,20 +1,11 @@
1
- /**
2
- * Used to bundle by source system, table and command.
3
- * If we receive >1 commands in a single batch, for example, put -> delete -> put -> delete, we need to make sure
4
- * that commands are executed in that order.
5
- *
6
- * This will be used for executing the commands in the target systems.
7
- */
8
-
9
1
  import { BaseBundle } from "./BaseBundle.js";
10
- export class CommandBundle extends BaseBundle {
11
- canAdd(item) {
12
- const command = this.getCommand(item.command);
13
- return this.command === command && this.table.name === item.table.name && this.source.name === item.source.name;
14
- }
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
+ }
15
7
  }
16
- export const createCommandBundle = params => {
17
- return new CommandBundle(params);
18
- };
8
+ const createCommandBundle = (params)=>new CommandBundle(params);
9
+ export { CommandBundle, createCommandBundle };
19
10
 
20
11
  //# sourceMappingURL=CommandBundle.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["BaseBundle","CommandBundle","canAdd","item","command","getCommand","table","name","source","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.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"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,UAAU;AAEnB,OAAO,MAAMC,aAAa,SAASD,UAAU,CAAC;EACnCE,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;AAEA,OAAO,MAAME,mBAAmB,GAAIC,MAAyB,IAAc;EACvE,OAAO,IAAIT,aAAa,CAACS,MAAM,CAAC;AACpC,CAAC","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"}
@@ -1,17 +1,10 @@
1
- /**
2
- * This will bundle records by system and table.
3
- *
4
- * It will be used to fetch the data from the source system tables.
5
- */
6
-
7
1
  import { BaseBundle } from "./BaseBundle.js";
8
- export class TableBundle extends BaseBundle {
9
- canAdd(item) {
10
- return this.source.name === item.source.name && this.table.name === item.table.name;
11
- }
2
+ class TableBundle extends BaseBundle {
3
+ canAdd(item) {
4
+ return this.source.name === item.source.name && this.table.name === item.table.name;
5
+ }
12
6
  }
13
- export const createTableBundle = params => {
14
- return new TableBundle(params);
15
- };
7
+ const createTableBundle = (params)=>new TableBundle(params);
8
+ export { TableBundle, createTableBundle };
16
9
 
17
10
  //# sourceMappingURL=TableBundle.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["BaseBundle","TableBundle","canAdd","item","source","name","table","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.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"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAIA,SAASA,UAAU;AAEnB,OAAO,MAAMC,WAAW,SAASD,UAAU,CAAC;EACjCE,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;AAEA,OAAO,MAAME,iBAAiB,GAAIC,MAAyB,IAAc;EACrE,OAAO,IAAIP,WAAW,CAACO,MAAM,CAAC;AAClC,CAAC","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,3 +0,0 @@
1
- export {};
2
-
3
- //# sourceMappingURL=types.js.map
@@ -1,32 +1,25 @@
1
- export class DeleteCommandHandler {
2
- constructor(params) {
3
- this.storer = params.storer;
4
- }
5
- async handle(params) {
6
- const {
7
- targetDeployment,
8
- targetTable,
9
- bundle
10
- } = params;
11
- const result = bundle.items.map(item => {
12
- if (!item.PK || !item.SK) {
13
- return null;
14
- }
15
- return {
16
- PK: item.PK,
17
- SK: item.SK
18
- };
19
- }).filter(item => {
20
- return !!item;
21
- });
22
- await this.storer.store({
23
- command: "delete",
24
- deployment: targetDeployment,
25
- table: targetTable,
26
- items: result,
27
- bundle
28
- });
29
- }
1
+ class DeleteCommandHandler {
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
+ }
30
22
  }
23
+ export { DeleteCommandHandler };
31
24
 
32
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"],"sources":["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"],"mappings":"AAgBA,OAAO,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","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"}
@@ -1,25 +1,19 @@
1
- export class PutCommandHandler {
2
- constructor(params) {
3
- this.storer = params.storer;
4
- }
5
- async handle(params) {
6
- const {
7
- items,
8
- targetDeployment,
9
- targetTable,
10
- bundle
11
- } = params;
12
- const result = items.filter(item => {
13
- return !!item.PK && !!item.SK;
14
- });
15
- await this.storer.store({
16
- command: "put",
17
- deployment: targetDeployment,
18
- table: targetTable,
19
- items: result,
20
- bundle
21
- });
22
- }
1
+ class PutCommandHandler {
2
+ constructor(params){
3
+ this.storer = params.storer;
4
+ }
5
+ async handle(params) {
6
+ const { items, targetDeployment, targetTable, bundle } = params;
7
+ const result = items.filter((item)=>!!item.PK && !!item.SK);
8
+ await this.storer.store({
9
+ command: "put",
10
+ deployment: targetDeployment,
11
+ table: targetTable,
12
+ items: result,
13
+ bundle
14
+ });
15
+ }
23
16
  }
17
+ export { PutCommandHandler };
24
18
 
25
19
  //# sourceMappingURL=PutCommandHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["PutCommandHandler","constructor","params","storer","handle","items","targetDeployment","targetTable","bundle","result","filter","item","PK","SK","store","command","deployment","table"],"sources":["PutCommandHandler.ts"],"sourcesContent":["import type { IStoreItem, IStorer } from \"../storer/types.js\";\nimport type { ITable } from \"~/sync/types.js\";\nimport type { IDeployment } from \"~/resolver/deployment/types.js\";\nimport type { IBundle } from \"~/resolver/app/bundler/types.js\";\n\nexport interface IPutCommandHandlerHandleParams {\n items: IStoreItem[];\n bundle: IBundle;\n targetDeployment: IDeployment;\n targetTable: ITable;\n}\n\nexport interface IPutCommandHandlerParams {\n storer: IStorer;\n}\n\nexport class PutCommandHandler {\n private readonly storer: IStorer;\n\n public constructor(params: IPutCommandHandlerParams) {\n this.storer = params.storer;\n }\n\n public async handle(params: IPutCommandHandlerHandleParams): Promise<void> {\n const { items, targetDeployment, targetTable, bundle } = params;\n\n const result = items.filter(item => {\n return !!item.PK && !!item.SK;\n });\n\n await this.storer.store({\n command: \"put\",\n deployment: targetDeployment,\n table: targetTable,\n items: result,\n bundle\n });\n }\n}\n"],"mappings":"AAgBA,OAAO,MAAMA,iBAAiB,CAAC;EAGpBC,WAAWA,CAACC,MAAgC,EAAE;IACjD,IAAI,CAACC,MAAM,GAAGD,MAAM,CAACC,MAAM;EAC/B;EAEA,MAAaC,MAAMA,CAACF,MAAsC,EAAiB;IACvE,MAAM;MAAEG,KAAK;MAAEC,gBAAgB;MAAEC,WAAW;MAAEC;IAAO,CAAC,GAAGN,MAAM;IAE/D,MAAMO,MAAM,GAAGJ,KAAK,CAACK,MAAM,CAACC,IAAI,IAAI;MAChC,OAAO,CAAC,CAACA,IAAI,CAACC,EAAE,IAAI,CAAC,CAACD,IAAI,CAACE,EAAE;IACjC,CAAC,CAAC;IAEF,MAAM,IAAI,CAACV,MAAM,CAACW,KAAK,CAAC;MACpBC,OAAO,EAAE,KAAK;MACdC,UAAU,EAAEV,gBAAgB;MAC5BW,KAAK,EAAEV,WAAW;MAClBF,KAAK,EAAEI,MAAM;MACbD;IACJ,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"resolver/app/commandHandler/PutCommandHandler.js","sources":["../../../../src/resolver/app/commandHandler/PutCommandHandler.ts"],"sourcesContent":["import type { IStoreItem, IStorer } from \"../storer/types.js\";\nimport type { ITable } from \"~/sync/types.js\";\nimport type { IDeployment } from \"~/resolver/deployment/types.js\";\nimport type { IBundle } from \"~/resolver/app/bundler/types.js\";\n\nexport interface IPutCommandHandlerHandleParams {\n items: IStoreItem[];\n bundle: IBundle;\n targetDeployment: IDeployment;\n targetTable: ITable;\n}\n\nexport interface IPutCommandHandlerParams {\n storer: IStorer;\n}\n\nexport class PutCommandHandler {\n private readonly storer: IStorer;\n\n public constructor(params: IPutCommandHandlerParams) {\n this.storer = params.storer;\n }\n\n public async handle(params: IPutCommandHandlerHandleParams): Promise<void> {\n const { items, targetDeployment, targetTable, bundle } = params;\n\n const result = items.filter(item => {\n return !!item.PK && !!item.SK;\n });\n\n await this.storer.store({\n command: \"put\",\n deployment: targetDeployment,\n table: targetTable,\n items: result,\n bundle\n });\n }\n}\n"],"names":["PutCommandHandler","params","items","targetDeployment","targetTable","bundle","result","item"],"mappings":"AAgBO,MAAMA;IAGT,YAAmBC,MAAgC,CAAE;QACjD,IAAI,CAAC,MAAM,GAAGA,OAAO,MAAM;IAC/B;IAEA,MAAa,OAAOA,MAAsC,EAAiB;QACvE,MAAM,EAAEC,KAAK,EAAEC,gBAAgB,EAAEC,WAAW,EAAEC,MAAM,EAAE,GAAGJ;QAEzD,MAAMK,SAASJ,MAAM,MAAM,CAACK,CAAAA,OACjB,CAAC,CAACA,KAAK,EAAE,IAAI,CAAC,CAACA,KAAK,EAAE;QAGjC,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;YACpB,SAAS;YACT,YAAYJ;YACZ,OAAOC;YACP,OAAOE;YACPD;QACJ;IACJ;AACJ"}
@@ -1,17 +1,16 @@
1
1
  import { CommandHandlerPlugin, createCommandHandlerPlugin } from "../../plugins/CommandHandlerPlugin.js";
2
2
  import { DeleteCommandHandler } from "./DeleteCommandHandler.js";
3
- export const createDeleteCommandHandlerPlugin = () => {
4
- const plugin = createCommandHandlerPlugin({
5
- canHandle: command => {
6
- return command === "delete";
7
- },
8
- handle: async params => {
9
- const handler = new DeleteCommandHandler(params);
10
- return handler.handle(params);
11
- }
12
- });
13
- plugin.name = `${CommandHandlerPlugin.type}.delete`;
14
- return plugin;
3
+ const createDeleteCommandHandlerPlugin = ()=>{
4
+ const plugin = createCommandHandlerPlugin({
5
+ canHandle: (command)=>"delete" === command,
6
+ handle: async (params)=>{
7
+ const handler = new DeleteCommandHandler(params);
8
+ return handler.handle(params);
9
+ }
10
+ });
11
+ plugin.name = `${CommandHandlerPlugin.type}.delete`;
12
+ return plugin;
15
13
  };
14
+ export { createDeleteCommandHandlerPlugin };
16
15
 
17
16
  //# sourceMappingURL=delete.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["CommandHandlerPlugin","createCommandHandlerPlugin","DeleteCommandHandler","createDeleteCommandHandlerPlugin","plugin","canHandle","command","handle","params","handler","name","type"],"sources":["delete.ts"],"sourcesContent":["import {\n CommandHandlerPlugin,\n createCommandHandlerPlugin\n} from \"~/resolver/plugins/CommandHandlerPlugin.js\";\nimport { DeleteCommandHandler } from \"./DeleteCommandHandler.js\";\n\nexport const createDeleteCommandHandlerPlugin = () => {\n const plugin = createCommandHandlerPlugin({\n canHandle: command => {\n return command === \"delete\";\n },\n handle: async params => {\n const handler = new DeleteCommandHandler(params);\n\n return handler.handle(params);\n }\n });\n\n plugin.name = `${CommandHandlerPlugin.type}.delete`;\n\n return plugin;\n};\n"],"mappings":"AAAA,SACIA,oBAAoB,EACpBC,0BAA0B;AAE9B,SAASC,oBAAoB;AAE7B,OAAO,MAAMC,gCAAgC,GAAGA,CAAA,KAAM;EAClD,MAAMC,MAAM,GAAGH,0BAA0B,CAAC;IACtCI,SAAS,EAAEC,OAAO,IAAI;MAClB,OAAOA,OAAO,KAAK,QAAQ;IAC/B,CAAC;IACDC,MAAM,EAAE,MAAMC,MAAM,IAAI;MACpB,MAAMC,OAAO,GAAG,IAAIP,oBAAoB,CAACM,MAAM,CAAC;MAEhD,OAAOC,OAAO,CAACF,MAAM,CAACC,MAAM,CAAC;IACjC;EACJ,CAAC,CAAC;EAEFJ,MAAM,CAACM,IAAI,GAAG,GAAGV,oBAAoB,CAACW,IAAI,SAAS;EAEnD,OAAOP,MAAM;AACjB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"resolver/app/commandHandler/delete.js","sources":["../../../../src/resolver/app/commandHandler/delete.ts"],"sourcesContent":["import {\n CommandHandlerPlugin,\n createCommandHandlerPlugin\n} from \"~/resolver/plugins/CommandHandlerPlugin.js\";\nimport { DeleteCommandHandler } from \"./DeleteCommandHandler.js\";\n\nexport const createDeleteCommandHandlerPlugin = () => {\n const plugin = createCommandHandlerPlugin({\n canHandle: command => {\n return command === \"delete\";\n },\n handle: async params => {\n const handler = new DeleteCommandHandler(params);\n\n return handler.handle(params);\n }\n });\n\n plugin.name = `${CommandHandlerPlugin.type}.delete`;\n\n return plugin;\n};\n"],"names":["createDeleteCommandHandlerPlugin","plugin","createCommandHandlerPlugin","command","params","handler","DeleteCommandHandler","CommandHandlerPlugin"],"mappings":";;AAMO,MAAMA,mCAAmC;IAC5C,MAAMC,SAASC,2BAA2B;QACtC,WAAWC,CAAAA,UACAA,AAAY,aAAZA;QAEX,QAAQ,OAAMC;YACV,MAAMC,UAAU,IAAIC,qBAAqBF;YAEzC,OAAOC,QAAQ,MAAM,CAACD;QAC1B;IACJ;IAEAH,OAAO,IAAI,GAAG,GAAGM,qBAAqB,IAAI,CAAC,OAAO,CAAC;IAEnD,OAAON;AACX"}
@@ -1,17 +1,16 @@
1
1
  import { CommandHandlerPlugin, createCommandHandlerPlugin } from "../../plugins/CommandHandlerPlugin.js";
2
2
  import { PutCommandHandler } from "./PutCommandHandler.js";
3
- export const createPutCommandHandlerPlugin = () => {
4
- const plugin = createCommandHandlerPlugin({
5
- canHandle: command => {
6
- return command === "put";
7
- },
8
- handle: async params => {
9
- const handler = new PutCommandHandler(params);
10
- return handler.handle(params);
11
- }
12
- });
13
- plugin.name = `${CommandHandlerPlugin.type}.put`;
14
- return plugin;
3
+ const createPutCommandHandlerPlugin = ()=>{
4
+ const plugin = createCommandHandlerPlugin({
5
+ canHandle: (command)=>"put" === command,
6
+ handle: async (params)=>{
7
+ const handler = new PutCommandHandler(params);
8
+ return handler.handle(params);
9
+ }
10
+ });
11
+ plugin.name = `${CommandHandlerPlugin.type}.put`;
12
+ return plugin;
15
13
  };
14
+ export { createPutCommandHandlerPlugin };
16
15
 
17
16
  //# sourceMappingURL=put.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["CommandHandlerPlugin","createCommandHandlerPlugin","PutCommandHandler","createPutCommandHandlerPlugin","plugin","canHandle","command","handle","params","handler","name","type"],"sources":["put.ts"],"sourcesContent":["import {\n CommandHandlerPlugin,\n createCommandHandlerPlugin\n} from \"~/resolver/plugins/CommandHandlerPlugin.js\";\nimport { PutCommandHandler } from \"./PutCommandHandler.js\";\n\nexport const createPutCommandHandlerPlugin = () => {\n const plugin = createCommandHandlerPlugin({\n canHandle: command => {\n return command === \"put\";\n },\n handle: async params => {\n const handler = new PutCommandHandler(params);\n\n return handler.handle(params);\n }\n });\n\n plugin.name = `${CommandHandlerPlugin.type}.put`;\n\n return plugin;\n};\n"],"mappings":"AAAA,SACIA,oBAAoB,EACpBC,0BAA0B;AAE9B,SAASC,iBAAiB;AAE1B,OAAO,MAAMC,6BAA6B,GAAGA,CAAA,KAAM;EAC/C,MAAMC,MAAM,GAAGH,0BAA0B,CAAC;IACtCI,SAAS,EAAEC,OAAO,IAAI;MAClB,OAAOA,OAAO,KAAK,KAAK;IAC5B,CAAC;IACDC,MAAM,EAAE,MAAMC,MAAM,IAAI;MACpB,MAAMC,OAAO,GAAG,IAAIP,iBAAiB,CAACM,MAAM,CAAC;MAE7C,OAAOC,OAAO,CAACF,MAAM,CAACC,MAAM,CAAC;IACjC;EACJ,CAAC,CAAC;EAEFJ,MAAM,CAACM,IAAI,GAAG,GAAGV,oBAAoB,CAACW,IAAI,MAAM;EAEhD,OAAOP,MAAM;AACjB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"resolver/app/commandHandler/put.js","sources":["../../../../src/resolver/app/commandHandler/put.ts"],"sourcesContent":["import {\n CommandHandlerPlugin,\n createCommandHandlerPlugin\n} from \"~/resolver/plugins/CommandHandlerPlugin.js\";\nimport { PutCommandHandler } from \"./PutCommandHandler.js\";\n\nexport const createPutCommandHandlerPlugin = () => {\n const plugin = createCommandHandlerPlugin({\n canHandle: command => {\n return command === \"put\";\n },\n handle: async params => {\n const handler = new PutCommandHandler(params);\n\n return handler.handle(params);\n }\n });\n\n plugin.name = `${CommandHandlerPlugin.type}.put`;\n\n return plugin;\n};\n"],"names":["createPutCommandHandlerPlugin","plugin","createCommandHandlerPlugin","command","params","handler","PutCommandHandler","CommandHandlerPlugin"],"mappings":";;AAMO,MAAMA,gCAAgC;IACzC,MAAMC,SAASC,2BAA2B;QACtC,WAAWC,CAAAA,UACAA,AAAY,UAAZA;QAEX,QAAQ,OAAMC;YACV,MAAMC,UAAU,IAAIC,kBAAkBF;YAEtC,OAAOC,QAAQ,MAAM,CAACD;QAC1B;IACJ;IAEAH,OAAO,IAAI,GAAG,GAAGM,qBAAqB,IAAI,CAAC,IAAI,CAAC;IAEhD,OAAON;AACX"}
@@ -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