@webiny/api-sync-system 0.0.0-unstable.06b2ede40f

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 (360) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +113 -0
  3. package/constants.d.ts +1 -0
  4. package/constants.js +9 -0
  5. package/constants.js.map +1 -0
  6. package/index.d.ts +3 -0
  7. package/index.js +40 -0
  8. package/index.js.map +1 -0
  9. package/package.json +45 -0
  10. package/resolver/app/RecordHandler.d.ts +34 -0
  11. package/resolver/app/RecordHandler.js +126 -0
  12. package/resolver/app/RecordHandler.js.map +1 -0
  13. package/resolver/app/RecordsValidation.d.ts +6 -0
  14. package/resolver/app/RecordsValidation.js +29 -0
  15. package/resolver/app/RecordsValidation.js.map +1 -0
  16. package/resolver/app/ResolverApplication.d.ts +14 -0
  17. package/resolver/app/ResolverApplication.js +48 -0
  18. package/resolver/app/ResolverApplication.js.map +1 -0
  19. package/resolver/app/abstractions/RecordHandler.d.ts +7 -0
  20. package/resolver/app/abstractions/RecordHandler.js +7 -0
  21. package/resolver/app/abstractions/RecordHandler.js.map +1 -0
  22. package/resolver/app/abstractions/RecordsValidation.d.ts +14 -0
  23. package/resolver/app/abstractions/RecordsValidation.js +7 -0
  24. package/resolver/app/abstractions/RecordsValidation.js.map +1 -0
  25. package/resolver/app/abstractions/ResolverApplication.d.ts +7 -0
  26. package/resolver/app/abstractions/ResolverApplication.js +7 -0
  27. package/resolver/app/abstractions/ResolverApplication.js.map +1 -0
  28. package/resolver/app/abstractions/ResolverRecord.d.ts +42 -0
  29. package/resolver/app/abstractions/ResolverRecord.js +7 -0
  30. package/resolver/app/abstractions/ResolverRecord.js.map +1 -0
  31. package/resolver/app/bundler/BaseBundle.d.ts +21 -0
  32. package/resolver/app/bundler/BaseBundle.js +26 -0
  33. package/resolver/app/bundler/BaseBundle.js.map +1 -0
  34. package/resolver/app/bundler/Bundler.d.ts +10 -0
  35. package/resolver/app/bundler/Bundler.js +30 -0
  36. package/resolver/app/bundler/Bundler.js.map +1 -0
  37. package/resolver/app/bundler/Bundles.d.ts +14 -0
  38. package/resolver/app/bundler/Bundles.js +38 -0
  39. package/resolver/app/bundler/Bundles.js.map +1 -0
  40. package/resolver/app/bundler/CommandBundle.d.ts +15 -0
  41. package/resolver/app/bundler/CommandBundle.js +28 -0
  42. package/resolver/app/bundler/CommandBundle.js.map +1 -0
  43. package/resolver/app/bundler/TableBundle.d.ts +13 -0
  44. package/resolver/app/bundler/TableBundle.js +25 -0
  45. package/resolver/app/bundler/TableBundle.js.map +1 -0
  46. package/resolver/app/bundler/types.d.ts +29 -0
  47. package/resolver/app/bundler/types.js +7 -0
  48. package/resolver/app/bundler/types.js.map +1 -0
  49. package/resolver/app/commandHandler/DeleteCommandHandler.d.ts +18 -0
  50. package/resolver/app/commandHandler/DeleteCommandHandler.js +39 -0
  51. package/resolver/app/commandHandler/DeleteCommandHandler.js.map +1 -0
  52. package/resolver/app/commandHandler/PutCommandHandler.d.ts +18 -0
  53. package/resolver/app/commandHandler/PutCommandHandler.js +32 -0
  54. package/resolver/app/commandHandler/PutCommandHandler.js.map +1 -0
  55. package/resolver/app/commandHandler/delete.d.ts +2 -0
  56. package/resolver/app/commandHandler/delete.js +24 -0
  57. package/resolver/app/commandHandler/delete.js.map +1 -0
  58. package/resolver/app/commandHandler/put.d.ts +2 -0
  59. package/resolver/app/commandHandler/put.js +24 -0
  60. package/resolver/app/commandHandler/put.js.map +1 -0
  61. package/resolver/app/data/SourceDataContainer.d.ts +12 -0
  62. package/resolver/app/data/SourceDataContainer.js +42 -0
  63. package/resolver/app/data/SourceDataContainer.js.map +1 -0
  64. package/resolver/app/data/types.d.ts +23 -0
  65. package/resolver/app/data/types.js +7 -0
  66. package/resolver/app/data/types.js.map +1 -0
  67. package/resolver/app/fetcher/Fetcher.d.ts +22 -0
  68. package/resolver/app/fetcher/Fetcher.js +132 -0
  69. package/resolver/app/fetcher/Fetcher.js.map +1 -0
  70. package/resolver/app/fetcher/types.d.ts +25 -0
  71. package/resolver/app/fetcher/types.js +7 -0
  72. package/resolver/app/fetcher/types.js.map +1 -0
  73. package/resolver/app/ingestor/Ingestor.d.ts +13 -0
  74. package/resolver/app/ingestor/Ingestor.js +44 -0
  75. package/resolver/app/ingestor/Ingestor.js.map +1 -0
  76. package/resolver/app/ingestor/IngestorResult.d.ts +7 -0
  77. package/resolver/app/ingestor/IngestorResult.js +45 -0
  78. package/resolver/app/ingestor/IngestorResult.js.map +1 -0
  79. package/resolver/app/ingestor/types.d.ts +26 -0
  80. package/resolver/app/ingestor/types.js +7 -0
  81. package/resolver/app/ingestor/types.js.map +1 -0
  82. package/resolver/app/storer/Storer.d.ts +44 -0
  83. package/resolver/app/storer/Storer.js +103 -0
  84. package/resolver/app/storer/Storer.js.map +1 -0
  85. package/resolver/app/storer/types.d.ts +21 -0
  86. package/resolver/app/storer/types.js +7 -0
  87. package/resolver/app/storer/types.js.map +1 -0
  88. package/resolver/app/transform/TransformHandler.d.ts +34 -0
  89. package/resolver/app/transform/TransformHandler.js +70 -0
  90. package/resolver/app/transform/TransformHandler.js.map +1 -0
  91. package/resolver/app/transform/middleware.d.ts +3 -0
  92. package/resolver/app/transform/middleware.js +29 -0
  93. package/resolver/app/transform/middleware.js.map +1 -0
  94. package/resolver/app/utils/Retry.d.ts +18 -0
  95. package/resolver/app/utils/Retry.js +38 -0
  96. package/resolver/app/utils/Retry.js.map +1 -0
  97. package/resolver/app/utils/sleep.d.ts +1 -0
  98. package/resolver/app/utils/sleep.js +14 -0
  99. package/resolver/app/utils/sleep.js.map +1 -0
  100. package/resolver/app/validation/body.d.ts +142 -0
  101. package/resolver/app/validation/body.js +46 -0
  102. package/resolver/app/validation/body.js.map +1 -0
  103. package/resolver/app/validation/createJsonTransform.d.ts +2 -0
  104. package/resolver/app/validation/createJsonTransform.js +24 -0
  105. package/resolver/app/validation/createJsonTransform.js.map +1 -0
  106. package/resolver/app/validation/detail.d.ts +89 -0
  107. package/resolver/app/validation/detail.js +50 -0
  108. package/resolver/app/validation/detail.js.map +1 -0
  109. package/resolver/app/validation/event.d.ts +217 -0
  110. package/resolver/app/validation/event.js +32 -0
  111. package/resolver/app/validation/event.js.map +1 -0
  112. package/resolver/app/validation/numericString.d.ts +2 -0
  113. package/resolver/app/validation/numericString.js +23 -0
  114. package/resolver/app/validation/numericString.js.map +1 -0
  115. package/resolver/app/validation/system.d.ts +20 -0
  116. package/resolver/app/validation/system.js +20 -0
  117. package/resolver/app/validation/system.js.map +1 -0
  118. package/resolver/createEventHandlerPlugin.d.ts +10 -0
  119. package/resolver/createEventHandlerPlugin.js +127 -0
  120. package/resolver/createEventHandlerPlugin.js.map +1 -0
  121. package/resolver/createResolverHandler.d.ts +21 -0
  122. package/resolver/createResolverHandler.js +79 -0
  123. package/resolver/createResolverHandler.js.map +1 -0
  124. package/resolver/deployment/Deployment.d.ts +17 -0
  125. package/resolver/deployment/Deployment.js +50 -0
  126. package/resolver/deployment/Deployment.js.map +1 -0
  127. package/resolver/deployment/Deployments.d.ts +13 -0
  128. package/resolver/deployment/Deployments.js +34 -0
  129. package/resolver/deployment/Deployments.js.map +1 -0
  130. package/resolver/deployment/DeploymentsFetcher.d.ts +16 -0
  131. package/resolver/deployment/DeploymentsFetcher.js +112 -0
  132. package/resolver/deployment/DeploymentsFetcher.js.map +1 -0
  133. package/resolver/deployment/types.d.ts +34 -0
  134. package/resolver/deployment/types.js +7 -0
  135. package/resolver/deployment/types.js.map +1 -0
  136. package/resolver/lambda/LambdaTrigger.d.ts +18 -0
  137. package/resolver/lambda/LambdaTrigger.js +39 -0
  138. package/resolver/lambda/LambdaTrigger.js.map +1 -0
  139. package/resolver/plugins/CommandHandlerPlugin.d.ts +31 -0
  140. package/resolver/plugins/CommandHandlerPlugin.js +27 -0
  141. package/resolver/plugins/CommandHandlerPlugin.js.map +1 -0
  142. package/resolver/plugins/StorerAfterEachPlugin.d.ts +31 -0
  143. package/resolver/plugins/StorerAfterEachPlugin.js +33 -0
  144. package/resolver/plugins/StorerAfterEachPlugin.js.map +1 -0
  145. package/resolver/plugins/TransformRecordPlugin.d.ts +38 -0
  146. package/resolver/plugins/TransformRecordPlugin.js +30 -0
  147. package/resolver/plugins/TransformRecordPlugin.js.map +1 -0
  148. package/resolver/recordTypes/fileManager/CopyFile.d.ts +14 -0
  149. package/resolver/recordTypes/fileManager/CopyFile.js +81 -0
  150. package/resolver/recordTypes/fileManager/CopyFile.js.map +1 -0
  151. package/resolver/recordTypes/fileManager/DeleteFile.d.ts +14 -0
  152. package/resolver/recordTypes/fileManager/DeleteFile.js +72 -0
  153. package/resolver/recordTypes/fileManager/DeleteFile.js.map +1 -0
  154. package/resolver/recordTypes/fileManager/fileManager.d.ts +6 -0
  155. package/resolver/recordTypes/fileManager/fileManager.js +14 -0
  156. package/resolver/recordTypes/fileManager/fileManager.js.map +1 -0
  157. package/resolver/recordTypes/fileManager/fileManagerOnDelete.d.ts +5 -0
  158. package/resolver/recordTypes/fileManager/fileManagerOnDelete.js +48 -0
  159. package/resolver/recordTypes/fileManager/fileManagerOnDelete.js.map +1 -0
  160. package/resolver/recordTypes/fileManager/fileManagerOnPut.d.ts +5 -0
  161. package/resolver/recordTypes/fileManager/fileManagerOnPut.js +48 -0
  162. package/resolver/recordTypes/fileManager/fileManagerOnPut.js.map +1 -0
  163. package/resolver/recordTypes/fileManager/shouldBeHandled.d.ts +2 -0
  164. package/resolver/recordTypes/fileManager/shouldBeHandled.js +37 -0
  165. package/resolver/recordTypes/fileManager/shouldBeHandled.js.map +1 -0
  166. package/resolver/recordTypes/fileManager/types.d.ts +26 -0
  167. package/resolver/recordTypes/fileManager/types.js +7 -0
  168. package/resolver/recordTypes/fileManager/types.js.map +1 -0
  169. package/resolver/recordTypes/users/CopyUser.d.ts +18 -0
  170. package/resolver/recordTypes/users/CopyUser.js +67 -0
  171. package/resolver/recordTypes/users/CopyUser.js.map +1 -0
  172. package/resolver/recordTypes/users/DeleteUser.d.ts +18 -0
  173. package/resolver/recordTypes/users/DeleteUser.js +65 -0
  174. package/resolver/recordTypes/users/DeleteUser.js.map +1 -0
  175. package/resolver/recordTypes/users/shouldBeHandled.d.ts +2 -0
  176. package/resolver/recordTypes/users/shouldBeHandled.js +36 -0
  177. package/resolver/recordTypes/users/shouldBeHandled.js.map +1 -0
  178. package/resolver/recordTypes/users/types.d.ts +24 -0
  179. package/resolver/recordTypes/users/types.js +7 -0
  180. package/resolver/recordTypes/users/types.js.map +1 -0
  181. package/resolver/recordTypes/users/users.d.ts +6 -0
  182. package/resolver/recordTypes/users/users.js +14 -0
  183. package/resolver/recordTypes/users/users.js.map +1 -0
  184. package/resolver/recordTypes/users/usersOnDelete.d.ts +5 -0
  185. package/resolver/recordTypes/users/usersOnDelete.js +47 -0
  186. package/resolver/recordTypes/users/usersOnDelete.js.map +1 -0
  187. package/resolver/recordTypes/users/usersOnPut.d.ts +5 -0
  188. package/resolver/recordTypes/users/usersOnPut.js +48 -0
  189. package/resolver/recordTypes/users/usersOnPut.js.map +1 -0
  190. package/sync/FilterOutRecord.d.ts +11 -0
  191. package/sync/FilterOutRecord.js +29 -0
  192. package/sync/FilterOutRecord.js.map +1 -0
  193. package/sync/attachToDynamoDbDocument.d.ts +11 -0
  194. package/sync/attachToDynamoDbDocument.js +79 -0
  195. package/sync/attachToDynamoDbDocument.js.map +1 -0
  196. package/sync/createHandler.d.ts +14 -0
  197. package/sync/createHandler.js +63 -0
  198. package/sync/createHandler.js.map +1 -0
  199. package/sync/createSendDataToEventBridgeOnRequestEnd.d.ts +2 -0
  200. package/sync/createSendDataToEventBridgeOnRequestEnd.js +51 -0
  201. package/sync/createSendDataToEventBridgeOnRequestEnd.js.map +1 -0
  202. package/sync/createSyncSystem.d.ts +16 -0
  203. package/sync/createSyncSystem.js +42 -0
  204. package/sync/createSyncSystem.js.map +1 -0
  205. package/sync/filter/createDefaultFilterOutRecordPlugins.d.ts +13 -0
  206. package/sync/filter/createDefaultFilterOutRecordPlugins.js +88 -0
  207. package/sync/filter/createDefaultFilterOutRecordPlugins.js.map +1 -0
  208. package/sync/handler/Handler.d.ts +28 -0
  209. package/sync/handler/Handler.js +93 -0
  210. package/sync/handler/Handler.js.map +1 -0
  211. package/sync/handler/HandlerConverter.d.ts +12 -0
  212. package/sync/handler/HandlerConverter.js +43 -0
  213. package/sync/handler/HandlerConverter.js.map +1 -0
  214. package/sync/handler/converter/BatchGetCommandConverter.d.ts +8 -0
  215. package/sync/handler/converter/BatchGetCommandConverter.js +24 -0
  216. package/sync/handler/converter/BatchGetCommandConverter.js.map +1 -0
  217. package/sync/handler/converter/BatchWriteCommandConverter.d.ts +9 -0
  218. package/sync/handler/converter/BatchWriteCommandConverter.js +24 -0
  219. package/sync/handler/converter/BatchWriteCommandConverter.js.map +1 -0
  220. package/sync/handler/converter/DeleteCommandConverter.d.ts +9 -0
  221. package/sync/handler/converter/DeleteCommandConverter.js +24 -0
  222. package/sync/handler/converter/DeleteCommandConverter.js.map +1 -0
  223. package/sync/handler/converter/GetCommandConverter.d.ts +8 -0
  224. package/sync/handler/converter/GetCommandConverter.js +24 -0
  225. package/sync/handler/converter/GetCommandConverter.js.map +1 -0
  226. package/sync/handler/converter/PutCommandConverter.d.ts +9 -0
  227. package/sync/handler/converter/PutCommandConverter.js +24 -0
  228. package/sync/handler/converter/PutCommandConverter.js.map +1 -0
  229. package/sync/handler/converter/QueryCommandConverter.d.ts +8 -0
  230. package/sync/handler/converter/QueryCommandConverter.js +24 -0
  231. package/sync/handler/converter/QueryCommandConverter.js.map +1 -0
  232. package/sync/handler/converter/ScanCommandConverter.d.ts +8 -0
  233. package/sync/handler/converter/ScanCommandConverter.js +24 -0
  234. package/sync/handler/converter/ScanCommandConverter.js.map +1 -0
  235. package/sync/handler/converter/UpdateCommandConverter.d.ts +9 -0
  236. package/sync/handler/converter/UpdateCommandConverter.js +24 -0
  237. package/sync/handler/converter/UpdateCommandConverter.js.map +1 -0
  238. package/sync/handler/converter/commands/BatchWriteCommandValue.d.ts +9 -0
  239. package/sync/handler/converter/commands/BatchWriteCommandValue.js +51 -0
  240. package/sync/handler/converter/commands/BatchWriteCommandValue.js.map +1 -0
  241. package/sync/handler/converter/commands/DeleteCommandValue.d.ts +9 -0
  242. package/sync/handler/converter/commands/DeleteCommandValue.js +27 -0
  243. package/sync/handler/converter/commands/DeleteCommandValue.js.map +1 -0
  244. package/sync/handler/converter/commands/NullCommandValue.d.ts +8 -0
  245. package/sync/handler/converter/commands/NullCommandValue.js +18 -0
  246. package/sync/handler/converter/commands/NullCommandValue.js.map +1 -0
  247. package/sync/handler/converter/commands/PutCommandValue.d.ts +9 -0
  248. package/sync/handler/converter/commands/PutCommandValue.js +27 -0
  249. package/sync/handler/converter/commands/PutCommandValue.js.map +1 -0
  250. package/sync/handler/converter/commands/UpdateCommandValue.d.ts +9 -0
  251. package/sync/handler/converter/commands/UpdateCommandValue.js +27 -0
  252. package/sync/handler/converter/commands/UpdateCommandValue.js.map +1 -0
  253. package/sync/handler/types.d.ts +18 -0
  254. package/sync/handler/types.js +7 -0
  255. package/sync/handler/types.js.map +1 -0
  256. package/sync/plugins/FilterOutRecordPlugin.d.ts +23 -0
  257. package/sync/plugins/FilterOutRecordPlugin.js +31 -0
  258. package/sync/plugins/FilterOutRecordPlugin.js.map +1 -0
  259. package/sync/requestPlugin.d.ts +9 -0
  260. package/sync/requestPlugin.js +59 -0
  261. package/sync/requestPlugin.js.map +1 -0
  262. package/sync/types.d.ts +64 -0
  263. package/sync/types.js +7 -0
  264. package/sync/types.js.map +1 -0
  265. package/sync/utils/getTableType.d.ts +2 -0
  266. package/sync/utils/getTableType.js +22 -0
  267. package/sync/utils/getTableType.js.map +1 -0
  268. package/sync/utils/manifest.d.ts +17 -0
  269. package/sync/utils/manifest.js +52 -0
  270. package/sync/utils/manifest.js.map +1 -0
  271. package/sync/utils/validateSystemInput.d.ts +11 -0
  272. package/sync/utils/validateSystemInput.js +44 -0
  273. package/sync/utils/validateSystemInput.js.map +1 -0
  274. package/types.d.ts +42 -0
  275. package/types.js +15 -0
  276. package/types.js.map +1 -0
  277. package/utils/createSystemName.d.ts +5 -0
  278. package/utils/createSystemName.js +12 -0
  279. package/utils/createSystemName.js.map +1 -0
  280. package/worker/actions/copyFile/CopyFile.d.ts +63 -0
  281. package/worker/actions/copyFile/CopyFile.js +283 -0
  282. package/worker/actions/copyFile/CopyFile.js.map +1 -0
  283. package/worker/actions/copyFile/copyFileAction.d.ts +6 -0
  284. package/worker/actions/copyFile/copyFileAction.js +47 -0
  285. package/worker/actions/copyFile/copyFileAction.js.map +1 -0
  286. package/worker/actions/copyFile/copyFileSchema.d.ts +47 -0
  287. package/worker/actions/copyFile/copyFileSchema.js +25 -0
  288. package/worker/actions/copyFile/copyFileSchema.js.map +1 -0
  289. package/worker/actions/copyFile/types.d.ts +10 -0
  290. package/worker/actions/copyFile/types.js +7 -0
  291. package/worker/actions/copyFile/types.js.map +1 -0
  292. package/worker/actions/createUser/CreateUser.d.ts +17 -0
  293. package/worker/actions/createUser/CreateUser.js +90 -0
  294. package/worker/actions/createUser/CreateUser.js.map +1 -0
  295. package/worker/actions/createUser/createUserAction.d.ts +6 -0
  296. package/worker/actions/createUser/createUserAction.js +42 -0
  297. package/worker/actions/createUser/createUserAction.js.map +1 -0
  298. package/worker/actions/createUser/createUserSchema.d.ts +47 -0
  299. package/worker/actions/createUser/createUserSchema.js +25 -0
  300. package/worker/actions/createUser/createUserSchema.js.map +1 -0
  301. package/worker/actions/createUser/types.d.ts +10 -0
  302. package/worker/actions/createUser/types.js +7 -0
  303. package/worker/actions/createUser/types.js.map +1 -0
  304. package/worker/actions/deleteFile/DeleteFile.d.ts +24 -0
  305. package/worker/actions/deleteFile/DeleteFile.js +82 -0
  306. package/worker/actions/deleteFile/DeleteFile.js.map +1 -0
  307. package/worker/actions/deleteFile/deleteFileAction.d.ts +6 -0
  308. package/worker/actions/deleteFile/deleteFileAction.js +42 -0
  309. package/worker/actions/deleteFile/deleteFileAction.js.map +1 -0
  310. package/worker/actions/deleteFile/deleteFileSchema.d.ts +47 -0
  311. package/worker/actions/deleteFile/deleteFileSchema.js +25 -0
  312. package/worker/actions/deleteFile/deleteFileSchema.js.map +1 -0
  313. package/worker/actions/deleteFile/types.d.ts +9 -0
  314. package/worker/actions/deleteFile/types.js +7 -0
  315. package/worker/actions/deleteFile/types.js.map +1 -0
  316. package/worker/actions/deleteUser/DeleteUser.d.ts +16 -0
  317. package/worker/actions/deleteUser/DeleteUser.js +67 -0
  318. package/worker/actions/deleteUser/DeleteUser.js.map +1 -0
  319. package/worker/actions/deleteUser/deleteUserAction.d.ts +6 -0
  320. package/worker/actions/deleteUser/deleteUserAction.js +40 -0
  321. package/worker/actions/deleteUser/deleteUserAction.js.map +1 -0
  322. package/worker/actions/deleteUser/deleteUserSchema.d.ts +29 -0
  323. package/worker/actions/deleteUser/deleteUserSchema.js +24 -0
  324. package/worker/actions/deleteUser/deleteUserSchema.js.map +1 -0
  325. package/worker/actions/deleteUser/types.d.ts +9 -0
  326. package/worker/actions/deleteUser/types.js +7 -0
  327. package/worker/actions/deleteUser/types.js.map +1 -0
  328. package/worker/actions/logValidationError.d.ts +2 -0
  329. package/worker/actions/logValidationError.js +17 -0
  330. package/worker/actions/logValidationError.js.map +1 -0
  331. package/worker/actions/removeCognitoUserAttributes.d.ts +6 -0
  332. package/worker/actions/removeCognitoUserAttributes.js +24 -0
  333. package/worker/actions/removeCognitoUserAttributes.js.map +1 -0
  334. package/worker/actions/updateUser/UpdateUser.d.ts +17 -0
  335. package/worker/actions/updateUser/UpdateUser.js +81 -0
  336. package/worker/actions/updateUser/UpdateUser.js.map +1 -0
  337. package/worker/actions/updateUser/types.d.ts +10 -0
  338. package/worker/actions/updateUser/types.js +7 -0
  339. package/worker/actions/updateUser/types.js.map +1 -0
  340. package/worker/actions/updateUser/updateUserAction.d.ts +6 -0
  341. package/worker/actions/updateUser/updateUserAction.js +42 -0
  342. package/worker/actions/updateUser/updateUserAction.js.map +1 -0
  343. package/worker/actions/updateUser/updateUserSchema.d.ts +47 -0
  344. package/worker/actions/updateUser/updateUserSchema.js +25 -0
  345. package/worker/actions/updateUser/updateUserSchema.js.map +1 -0
  346. package/worker/createWorkerHandler.d.ts +11 -0
  347. package/worker/createWorkerHandler.js +48 -0
  348. package/worker/createWorkerHandler.js.map +1 -0
  349. package/worker/handler/WorkerActionHandler.d.ts +10 -0
  350. package/worker/handler/WorkerActionHandler.js +33 -0
  351. package/worker/handler/WorkerActionHandler.js.map +1 -0
  352. package/worker/handler/eventHandler.d.ts +1 -0
  353. package/worker/handler/eventHandler.js +31 -0
  354. package/worker/handler/eventHandler.js.map +1 -0
  355. package/worker/plugins/WorkerActionPlugin.d.ts +10 -0
  356. package/worker/plugins/WorkerActionPlugin.js +28 -0
  357. package/worker/plugins/WorkerActionPlugin.js.map +1 -0
  358. package/worker/types.d.ts +14 -0
  359. package/worker/types.js +7 -0
  360. package/worker/types.js.map +1 -0
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_index","require","_UpdateCommandValue","UpdateCommandConverter","name","can","input","UpdateCommand","convert","UpdateCommandValue","exports","createUpdateCommandConverter"],"sources":["UpdateCommandConverter.ts"],"sourcesContent":["import { UpdateCommand } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport type { ICommandConverter, IDynamoDbCommand } from \"../../types.js\";\nimport { UpdateCommandValue } from \"./commands/UpdateCommandValue.js\";\n\nexport class UpdateCommandConverter implements ICommandConverter {\n public readonly name: string = \"update\";\n\n public can(input: IDynamoDbCommand): boolean {\n return input instanceof UpdateCommand;\n }\n public convert(input: UpdateCommand) {\n return new UpdateCommandValue(input);\n }\n}\n\nexport const createUpdateCommandConverter = (): ICommandConverter => {\n return new UpdateCommandConverter();\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,mBAAA,GAAAD,OAAA;AAEO,MAAME,sBAAsB,CAA8B;EAC7CC,IAAI,GAAW,QAAQ;EAEhCC,GAAGA,CAACC,KAAuB,EAAW;IACzC,OAAOA,KAAK,YAAYC,oBAAa;EACzC;EACOC,OAAOA,CAACF,KAAoB,EAAE;IACjC,OAAO,IAAIG,sCAAkB,CAACH,KAAK,CAAC;EACxC;AACJ;AAACI,OAAA,CAAAP,sBAAA,GAAAA,sBAAA;AAEM,MAAMQ,4BAA4B,GAAGA,CAAA,KAAyB;EACjE,OAAO,IAAIR,sBAAsB,CAAC,CAAC;AACvC,CAAC;AAACO,OAAA,CAAAC,4BAAA,GAAAA,4BAAA","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ import type { BatchWriteCommand } from "@webiny/aws-sdk/client-dynamodb";
2
+ import type { ICommandValue, ICommandValueItemExtended } from "../../../types.js";
3
+ import type { NonEmptyArray } from "@webiny/api/types.js";
4
+ export declare class BatchWriteCommandValue implements ICommandValue {
5
+ readonly command = "batchWrite";
6
+ readonly items: ICommandValueItemExtended[];
7
+ constructor(input: BatchWriteCommand);
8
+ getItems(): NonEmptyArray<ICommandValueItemExtended> | null;
9
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.BatchWriteCommandValue = void 0;
7
+ var _getTableType = require("../../../utils/getTableType.js");
8
+ const convert = items => {
9
+ if (items.length === 0) {
10
+ return null;
11
+ }
12
+ return items;
13
+ };
14
+ class BatchWriteCommandValue {
15
+ command = "batchWrite";
16
+ items = [];
17
+ constructor(input) {
18
+ for (const tableName in input.input.RequestItems) {
19
+ const values = input.input.RequestItems[tableName];
20
+ for (const value of values) {
21
+ if (value.PutRequest?.Item) {
22
+ const item = value.PutRequest.Item;
23
+ this.items.push({
24
+ command: "put",
25
+ PK: item.PK,
26
+ SK: item.SK,
27
+ tableName,
28
+ tableType: (0, _getTableType.getTableType)(tableName),
29
+ input
30
+ });
31
+ } else if (value.DeleteRequest?.Key) {
32
+ const item = value.DeleteRequest.Key;
33
+ this.items.push({
34
+ command: "delete",
35
+ PK: item.PK,
36
+ SK: item.SK,
37
+ tableName,
38
+ tableType: (0, _getTableType.getTableType)(tableName),
39
+ input
40
+ });
41
+ }
42
+ }
43
+ }
44
+ }
45
+ getItems() {
46
+ return convert(this.items);
47
+ }
48
+ }
49
+ exports.BatchWriteCommandValue = BatchWriteCommandValue;
50
+
51
+ //# sourceMappingURL=BatchWriteCommandValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_getTableType","require","convert","items","length","BatchWriteCommandValue","command","constructor","input","tableName","RequestItems","values","value","PutRequest","Item","item","push","PK","SK","tableType","getTableType","DeleteRequest","Key","getItems","exports"],"sources":["BatchWriteCommandValue.ts"],"sourcesContent":["import type { BatchWriteCommand } from \"@webiny/aws-sdk/client-dynamodb\";\nimport type { ICommandValue, ICommandValueItemExtended } from \"~/sync/types.js\";\nimport type { NonEmptyArray } from \"@webiny/api/types.js\";\nimport { getTableType } from \"~/sync/utils/getTableType.js\";\n\nconst convert = (\n items: ICommandValueItemExtended[]\n): NonEmptyArray<ICommandValueItemExtended> | null => {\n if (items.length === 0) {\n return null;\n }\n return items as NonEmptyArray<ICommandValueItemExtended>;\n};\n\nexport class BatchWriteCommandValue implements ICommandValue {\n public readonly command = \"batchWrite\";\n public readonly items: ICommandValueItemExtended[] = [];\n\n public constructor(input: BatchWriteCommand) {\n for (const tableName in input.input.RequestItems) {\n const values = input.input.RequestItems[tableName];\n for (const value of values) {\n if (value.PutRequest?.Item) {\n const item = value.PutRequest.Item;\n\n this.items.push({\n command: \"put\",\n PK: item.PK,\n SK: item.SK,\n tableName,\n tableType: getTableType(tableName),\n input\n });\n } else if (value.DeleteRequest?.Key) {\n const item = value.DeleteRequest.Key;\n\n this.items.push({\n command: \"delete\",\n PK: item.PK,\n SK: item.SK,\n tableName,\n tableType: getTableType(tableName),\n input\n });\n }\n }\n }\n }\n\n public getItems(): NonEmptyArray<ICommandValueItemExtended> | null {\n return convert(this.items);\n }\n}\n"],"mappings":";;;;;;AAGA,IAAAA,aAAA,GAAAC,OAAA;AAEA,MAAMC,OAAO,GACTC,KAAkC,IACgB;EAClD,IAAIA,KAAK,CAACC,MAAM,KAAK,CAAC,EAAE;IACpB,OAAO,IAAI;EACf;EACA,OAAOD,KAAK;AAChB,CAAC;AAEM,MAAME,sBAAsB,CAA0B;EACzCC,OAAO,GAAG,YAAY;EACtBH,KAAK,GAAgC,EAAE;EAEhDI,WAAWA,CAACC,KAAwB,EAAE;IACzC,KAAK,MAAMC,SAAS,IAAID,KAAK,CAACA,KAAK,CAACE,YAAY,EAAE;MAC9C,MAAMC,MAAM,GAAGH,KAAK,CAACA,KAAK,CAACE,YAAY,CAACD,SAAS,CAAC;MAClD,KAAK,MAAMG,KAAK,IAAID,MAAM,EAAE;QACxB,IAAIC,KAAK,CAACC,UAAU,EAAEC,IAAI,EAAE;UACxB,MAAMC,IAAI,GAAGH,KAAK,CAACC,UAAU,CAACC,IAAI;UAElC,IAAI,CAACX,KAAK,CAACa,IAAI,CAAC;YACZV,OAAO,EAAE,KAAK;YACdW,EAAE,EAAEF,IAAI,CAACE,EAAE;YACXC,EAAE,EAAEH,IAAI,CAACG,EAAE;YACXT,SAAS;YACTU,SAAS,EAAE,IAAAC,0BAAY,EAACX,SAAS,CAAC;YAClCD;UACJ,CAAC,CAAC;QACN,CAAC,MAAM,IAAII,KAAK,CAACS,aAAa,EAAEC,GAAG,EAAE;UACjC,MAAMP,IAAI,GAAGH,KAAK,CAACS,aAAa,CAACC,GAAG;UAEpC,IAAI,CAACnB,KAAK,CAACa,IAAI,CAAC;YACZV,OAAO,EAAE,QAAQ;YACjBW,EAAE,EAAEF,IAAI,CAACE,EAAE;YACXC,EAAE,EAAEH,IAAI,CAACG,EAAE;YACXT,SAAS;YACTU,SAAS,EAAE,IAAAC,0BAAY,EAACX,SAAS,CAAC;YAClCD;UACJ,CAAC,CAAC;QACN;MACJ;IACJ;EACJ;EAEOe,QAAQA,CAAA,EAAoD;IAC/D,OAAOrB,OAAO,CAAC,IAAI,CAACC,KAAK,CAAC;EAC9B;AACJ;AAACqB,OAAA,CAAAnB,sBAAA,GAAAA,sBAAA","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ import type { DeleteCommand } from "@webiny/aws-sdk/client-dynamodb";
2
+ import type { ICommandValue, ICommandValueItemExtended } from "../../../types.js";
3
+ import type { NonEmptyArray } from "@webiny/api/types.js";
4
+ export declare class DeleteCommandValue implements ICommandValue {
5
+ readonly command = "delete";
6
+ readonly item: ICommandValueItemExtended;
7
+ constructor(input: DeleteCommand);
8
+ getItems(): NonEmptyArray<ICommandValueItemExtended>;
9
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DeleteCommandValue = void 0;
7
+ var _getTableType = require("../../../utils/getTableType.js");
8
+ class DeleteCommandValue {
9
+ command = "delete";
10
+ constructor(input) {
11
+ const tableName = input.input.TableName;
12
+ this.item = {
13
+ command: this.command,
14
+ PK: input.input.Key.PK,
15
+ SK: input.input.Key.SK,
16
+ tableName,
17
+ tableType: (0, _getTableType.getTableType)(tableName),
18
+ input
19
+ };
20
+ }
21
+ getItems() {
22
+ return [this.item];
23
+ }
24
+ }
25
+ exports.DeleteCommandValue = DeleteCommandValue;
26
+
27
+ //# sourceMappingURL=DeleteCommandValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_getTableType","require","DeleteCommandValue","command","constructor","input","tableName","TableName","item","PK","Key","SK","tableType","getTableType","getItems","exports"],"sources":["DeleteCommandValue.ts"],"sourcesContent":["import type { DeleteCommand } from \"@webiny/aws-sdk/client-dynamodb\";\nimport type { ICommandValue, ICommandValueItemExtended } from \"~/sync/types.js\";\nimport type { NonEmptyArray } from \"@webiny/api/types.js\";\nimport { getTableType } from \"~/sync/utils/getTableType.js\";\n\nexport class DeleteCommandValue implements ICommandValue {\n public readonly command = \"delete\";\n public readonly item: ICommandValueItemExtended;\n\n public constructor(input: DeleteCommand) {\n const tableName = input.input.TableName as string;\n this.item = {\n command: this.command,\n PK: input.input.Key!.PK,\n SK: input.input.Key!.SK,\n tableName,\n tableType: getTableType(tableName),\n input\n };\n }\n\n public getItems(): NonEmptyArray<ICommandValueItemExtended> {\n return [this.item];\n }\n}\n"],"mappings":";;;;;;AAGA,IAAAA,aAAA,GAAAC,OAAA;AAEO,MAAMC,kBAAkB,CAA0B;EACrCC,OAAO,GAAG,QAAQ;EAG3BC,WAAWA,CAACC,KAAoB,EAAE;IACrC,MAAMC,SAAS,GAAGD,KAAK,CAACA,KAAK,CAACE,SAAmB;IACjD,IAAI,CAACC,IAAI,GAAG;MACRL,OAAO,EAAE,IAAI,CAACA,OAAO;MACrBM,EAAE,EAAEJ,KAAK,CAACA,KAAK,CAACK,GAAG,CAAED,EAAE;MACvBE,EAAE,EAAEN,KAAK,CAACA,KAAK,CAACK,GAAG,CAAEC,EAAE;MACvBL,SAAS;MACTM,SAAS,EAAE,IAAAC,0BAAY,EAACP,SAAS,CAAC;MAClCD;IACJ,CAAC;EACL;EAEOS,QAAQA,CAAA,EAA6C;IACxD,OAAO,CAAC,IAAI,CAACN,IAAI,CAAC;EACtB;AACJ;AAACO,OAAA,CAAAb,kBAAA,GAAAA,kBAAA","ignoreList":[]}
@@ -0,0 +1,8 @@
1
+ import type { ICommandValue } from "../../../types.js";
2
+ export declare class NullCommandValue implements ICommandValue {
3
+ /**
4
+ * Does not matter what will be here, we will not use it.
5
+ */
6
+ readonly command = "null";
7
+ getItems(): null;
8
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.NullCommandValue = void 0;
7
+ class NullCommandValue {
8
+ /**
9
+ * Does not matter what will be here, we will not use it.
10
+ */
11
+ command = "null";
12
+ getItems() {
13
+ return null;
14
+ }
15
+ }
16
+ exports.NullCommandValue = NullCommandValue;
17
+
18
+ //# sourceMappingURL=NullCommandValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NullCommandValue","command","getItems","exports"],"sources":["NullCommandValue.ts"],"sourcesContent":["import type { ICommandValue } from \"~/sync/types.js\";\n\nexport class NullCommandValue implements ICommandValue {\n /**\n * Does not matter what will be here, we will not use it.\n */\n public readonly command = \"null\";\n\n public getItems(): null {\n return null;\n }\n}\n"],"mappings":";;;;;;AAEO,MAAMA,gBAAgB,CAA0B;EACnD;AACJ;AACA;EACoBC,OAAO,GAAG,MAAM;EAEzBC,QAAQA,CAAA,EAAS;IACpB,OAAO,IAAI;EACf;AACJ;AAACC,OAAA,CAAAH,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ import type { PutCommand } from "@webiny/aws-sdk/client-dynamodb";
2
+ import type { ICommandValue, ICommandValueItemExtended } from "../../../types.js";
3
+ import type { NonEmptyArray } from "@webiny/api/types.js";
4
+ export declare class PutCommandValue implements ICommandValue {
5
+ readonly command = "put";
6
+ readonly item: ICommandValueItemExtended;
7
+ constructor(input: PutCommand);
8
+ getItems(): NonEmptyArray<ICommandValueItemExtended>;
9
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.PutCommandValue = void 0;
7
+ var _getTableType = require("../../../utils/getTableType.js");
8
+ class PutCommandValue {
9
+ command = "put";
10
+ constructor(input) {
11
+ const tableName = input.input.TableName;
12
+ this.item = {
13
+ command: this.command,
14
+ PK: input.input.Item.PK,
15
+ SK: input.input.Item.SK,
16
+ tableName,
17
+ tableType: (0, _getTableType.getTableType)(tableName),
18
+ input
19
+ };
20
+ }
21
+ getItems() {
22
+ return [this.item];
23
+ }
24
+ }
25
+ exports.PutCommandValue = PutCommandValue;
26
+
27
+ //# sourceMappingURL=PutCommandValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_getTableType","require","PutCommandValue","command","constructor","input","tableName","TableName","item","PK","Item","SK","tableType","getTableType","getItems","exports"],"sources":["PutCommandValue.ts"],"sourcesContent":["import type { PutCommand } from \"@webiny/aws-sdk/client-dynamodb\";\nimport type { ICommandValue, ICommandValueItemExtended } from \"~/sync/types.js\";\nimport type { NonEmptyArray } from \"@webiny/api/types.js\";\nimport { getTableType } from \"~/sync/utils/getTableType.js\";\n\nexport class PutCommandValue implements ICommandValue {\n public readonly command = \"put\";\n public readonly item: ICommandValueItemExtended;\n\n public constructor(input: PutCommand) {\n const tableName = input.input.TableName as string;\n this.item = {\n command: this.command,\n PK: input.input.Item!.PK,\n SK: input.input.Item!.SK,\n tableName,\n tableType: getTableType(tableName),\n input\n };\n }\n\n public getItems(): NonEmptyArray<ICommandValueItemExtended> {\n return [this.item];\n }\n}\n"],"mappings":";;;;;;AAGA,IAAAA,aAAA,GAAAC,OAAA;AAEO,MAAMC,eAAe,CAA0B;EAClCC,OAAO,GAAG,KAAK;EAGxBC,WAAWA,CAACC,KAAiB,EAAE;IAClC,MAAMC,SAAS,GAAGD,KAAK,CAACA,KAAK,CAACE,SAAmB;IACjD,IAAI,CAACC,IAAI,GAAG;MACRL,OAAO,EAAE,IAAI,CAACA,OAAO;MACrBM,EAAE,EAAEJ,KAAK,CAACA,KAAK,CAACK,IAAI,CAAED,EAAE;MACxBE,EAAE,EAAEN,KAAK,CAACA,KAAK,CAACK,IAAI,CAAEC,EAAE;MACxBL,SAAS;MACTM,SAAS,EAAE,IAAAC,0BAAY,EAACP,SAAS,CAAC;MAClCD;IACJ,CAAC;EACL;EAEOS,QAAQA,CAAA,EAA6C;IACxD,OAAO,CAAC,IAAI,CAACN,IAAI,CAAC;EACtB;AACJ;AAACO,OAAA,CAAAb,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ import type { UpdateCommand } from "@webiny/aws-sdk/client-dynamodb";
2
+ import type { ICommandValue, ICommandValueItemExtended } from "../../../types.js";
3
+ import type { NonEmptyArray } from "@webiny/api/types.js";
4
+ export declare class UpdateCommandValue implements ICommandValue {
5
+ readonly command = "update";
6
+ readonly item: ICommandValueItemExtended;
7
+ constructor(input: UpdateCommand);
8
+ getItems(): NonEmptyArray<ICommandValueItemExtended>;
9
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.UpdateCommandValue = void 0;
7
+ var _getTableType = require("../../../utils/getTableType.js");
8
+ class UpdateCommandValue {
9
+ command = "update";
10
+ constructor(input) {
11
+ const tableName = input.input.TableName;
12
+ this.item = {
13
+ command: this.command,
14
+ PK: input.input.Key.PK,
15
+ SK: input.input.Key.SK,
16
+ tableName,
17
+ tableType: (0, _getTableType.getTableType)(tableName),
18
+ input
19
+ };
20
+ }
21
+ getItems() {
22
+ return [this.item];
23
+ }
24
+ }
25
+ exports.UpdateCommandValue = UpdateCommandValue;
26
+
27
+ //# sourceMappingURL=UpdateCommandValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_getTableType","require","UpdateCommandValue","command","constructor","input","tableName","TableName","item","PK","Key","SK","tableType","getTableType","getItems","exports"],"sources":["UpdateCommandValue.ts"],"sourcesContent":["import type { UpdateCommand } from \"@webiny/aws-sdk/client-dynamodb\";\nimport type { ICommandValue, ICommandValueItemExtended } from \"~/sync/types.js\";\nimport type { NonEmptyArray } from \"@webiny/api/types.js\";\nimport { getTableType } from \"~/sync/utils/getTableType.js\";\n\nexport class UpdateCommandValue implements ICommandValue {\n public readonly command = \"update\";\n public readonly item: ICommandValueItemExtended;\n\n public constructor(input: UpdateCommand) {\n const tableName = input.input.TableName as string;\n this.item = {\n command: this.command,\n PK: input.input.Key!.PK,\n SK: input.input.Key!.SK,\n tableName,\n tableType: getTableType(tableName),\n input\n };\n }\n\n public getItems(): NonEmptyArray<ICommandValueItemExtended> {\n return [this.item];\n }\n}\n"],"mappings":";;;;;;AAGA,IAAAA,aAAA,GAAAC,OAAA;AAEO,MAAMC,kBAAkB,CAA0B;EACrCC,OAAO,GAAG,QAAQ;EAG3BC,WAAWA,CAACC,KAAoB,EAAE;IACrC,MAAMC,SAAS,GAAGD,KAAK,CAACA,KAAK,CAACE,SAAmB;IACjD,IAAI,CAACC,IAAI,GAAG;MACRL,OAAO,EAAE,IAAI,CAACA,OAAO;MACrBM,EAAE,EAAEJ,KAAK,CAACA,KAAK,CAACK,GAAG,CAAED,EAAE;MACvBE,EAAE,EAAEN,KAAK,CAACA,KAAK,CAACK,GAAG,CAAEC,EAAE;MACvBL,SAAS;MACTM,SAAS,EAAE,IAAAC,0BAAY,EAACP,SAAS,CAAC;MAClCD;IACJ,CAAC;EACL;EAEOS,QAAQA,CAAA,EAA6C;IACxD,OAAO,CAAC,IAAI,CAACN,IAAI,CAAC;EACtB;AACJ;AAACO,OAAA,CAAAb,kBAAA,GAAAA,kBAAA","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ import type { NonEmptyArray } from "@webiny/api/types";
2
+ import type { DynamoDBTableType, ExtendedCommandType } from "../../types.js";
3
+ import type { ISystem } from "../types";
4
+ export interface IDetailItem {
5
+ PK: string;
6
+ SK: string;
7
+ command: ExtendedCommandType;
8
+ /**
9
+ * There will be multiple tables that will get populated through the system (regular table and elasticsearch for start).
10
+ */
11
+ tableName: string;
12
+ tableType: DynamoDBTableType;
13
+ }
14
+ export interface IDetail {
15
+ items: NonEmptyArray<IDetailItem>;
16
+ source: ISystem;
17
+ id: string;
18
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { NonEmptyArray } from \"@webiny/api/types\";\nimport type { DynamoDBTableType, ExtendedCommandType } from \"~/types.js\";\nimport type { ISystem } from \"../types\";\n\nexport interface IDetailItem {\n PK: string;\n SK: string;\n command: ExtendedCommandType;\n /**\n * There will be multiple tables that will get populated through the system (regular table and elasticsearch for start).\n */\n tableName: string;\n tableType: DynamoDBTableType;\n}\n\nexport interface IDetail {\n items: NonEmptyArray<IDetailItem>;\n source: ISystem;\n id: string;\n}\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,23 @@
1
+ import { Plugin } from "@webiny/plugins/Plugin.js";
2
+ import type { ICommandValueItemExtended } from "../types.js";
3
+ export interface IFilterOutRecordPluginCallable {
4
+ (record: ICommandValueItemExtended): boolean;
5
+ }
6
+ export interface IFilterOutRecordPluginParams {
7
+ /**
8
+ * Filter out returns true if the record should be filtered out.
9
+ */
10
+ filterOut: IFilterOutRecordPluginCallable;
11
+ name: string;
12
+ }
13
+ export declare class FilterOutRecordPlugin extends Plugin {
14
+ static readonly type: string;
15
+ private readonly cb;
16
+ constructor(params: IFilterOutRecordPluginParams);
17
+ /**
18
+ * If method returns `true`, the record will be filtered out.
19
+ */
20
+ execute(item: ICommandValueItemExtended): boolean;
21
+ static createName(name: string): string;
22
+ }
23
+ export declare const createFilterOutRecordPlugin: (params: IFilterOutRecordPluginParams) => FilterOutRecordPlugin;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createFilterOutRecordPlugin = exports.FilterOutRecordPlugin = void 0;
7
+ var _Plugin = require("@webiny/plugins/Plugin.js");
8
+ class FilterOutRecordPlugin extends _Plugin.Plugin {
9
+ static type = "sync.filterOut.record";
10
+ constructor(params) {
11
+ super();
12
+ this.name = params.name;
13
+ this.cb = params.filterOut;
14
+ }
15
+ /**
16
+ * If method returns `true`, the record will be filtered out.
17
+ */
18
+ execute(item) {
19
+ return this.cb(item);
20
+ }
21
+ static createName(name) {
22
+ return `${FilterOutRecordPlugin.type}.${name}`;
23
+ }
24
+ }
25
+ exports.FilterOutRecordPlugin = FilterOutRecordPlugin;
26
+ const createFilterOutRecordPlugin = params => {
27
+ return new FilterOutRecordPlugin(params);
28
+ };
29
+ exports.createFilterOutRecordPlugin = createFilterOutRecordPlugin;
30
+
31
+ //# sourceMappingURL=FilterOutRecordPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_Plugin","require","FilterOutRecordPlugin","Plugin","type","constructor","params","name","cb","filterOut","execute","item","createName","exports","createFilterOutRecordPlugin"],"sources":["FilterOutRecordPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/Plugin.js\";\nimport type { ICommandValueItemExtended } from \"~/sync/types.js\";\n\nexport interface IFilterOutRecordPluginCallable {\n (record: ICommandValueItemExtended): boolean;\n}\n\nexport interface IFilterOutRecordPluginParams {\n /**\n * Filter out returns true if the record should be filtered out.\n */\n filterOut: IFilterOutRecordPluginCallable;\n name: string;\n}\n\nexport class FilterOutRecordPlugin extends Plugin {\n public static override readonly type: string = \"sync.filterOut.record\";\n\n private readonly cb: IFilterOutRecordPluginCallable;\n\n public constructor(params: IFilterOutRecordPluginParams) {\n super();\n this.name = params.name;\n this.cb = params.filterOut;\n }\n /**\n * If method returns `true`, the record will be filtered out.\n */\n public execute(item: ICommandValueItemExtended): boolean {\n return this.cb(item);\n }\n\n public static createName(name: string): string {\n return `${FilterOutRecordPlugin.type}.${name}`;\n }\n}\n\nexport const createFilterOutRecordPlugin = (\n params: IFilterOutRecordPluginParams\n): FilterOutRecordPlugin => {\n return new FilterOutRecordPlugin(params);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAeO,MAAMC,qBAAqB,SAASC,cAAM,CAAC;EAC9C,OAAgCC,IAAI,GAAW,uBAAuB;EAI/DC,WAAWA,CAACC,MAAoC,EAAE;IACrD,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,IAAI,GAAGD,MAAM,CAACC,IAAI;IACvB,IAAI,CAACC,EAAE,GAAGF,MAAM,CAACG,SAAS;EAC9B;EACA;AACJ;AACA;EACWC,OAAOA,CAACC,IAA+B,EAAW;IACrD,OAAO,IAAI,CAACH,EAAE,CAACG,IAAI,CAAC;EACxB;EAEA,OAAcC,UAAUA,CAACL,IAAY,EAAU;IAC3C,OAAO,GAAGL,qBAAqB,CAACE,IAAI,IAAIG,IAAI,EAAE;EAClD;AACJ;AAACM,OAAA,CAAAX,qBAAA,GAAAA,qBAAA;AAEM,MAAMY,2BAA2B,GACpCR,MAAoC,IACZ;EACxB,OAAO,IAAIJ,qBAAqB,CAACI,MAAM,CAAC;AAC5C,CAAC;AAACO,OAAA,CAAAC,2BAAA,GAAAA,2BAAA","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb/index.js";
2
+ import type { ICommandConverter, IGetEventBridgeCallable, ISystem } from "./types.js";
3
+ export interface ICreateSyncSystemHandlerOnRequestPluginParams {
4
+ getDocumentClient(): Pick<DynamoDBDocument, "send">;
5
+ getEventBridgeClient: IGetEventBridgeCallable;
6
+ system: ISystem;
7
+ commandConverters?: ICommandConverter[];
8
+ }
9
+ export declare const createSyncSystemHandlerOnRequestPlugin: (params: ICreateSyncSystemHandlerOnRequestPluginParams) => import("@webiny/handler").HandlerOnRequestPlugin<import("@webiny/handler/types.js").Context>;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createSyncSystemHandlerOnRequestPlugin = void 0;
7
+ var _handler = require("@webiny/handler");
8
+ var _manifest = require("./utils/manifest.js");
9
+ var _attachToDynamoDbDocument = require("./attachToDynamoDbDocument.js");
10
+ var _createSendDataToEventBridgeOnRequestEnd = require("./createSendDataToEventBridgeOnRequestEnd.js");
11
+ var _createHandler = require("./createHandler.js");
12
+ var _exception = require("@webiny/utils/exception.js");
13
+ const createSyncSystemHandlerOnRequestPlugin = params => {
14
+ return (0, _handler.createHandlerOnRequest)(async (_, __, context) => {
15
+ const {
16
+ data: manifest,
17
+ error
18
+ } = await (0, _manifest.getManifest)(params);
19
+ if (error) {
20
+ console.error("Error happened when fetching manifest.");
21
+ console.log(JSON.stringify({
22
+ error: (0, _exception.convertException)(error)
23
+ }));
24
+ return;
25
+ } else if (!manifest?.sync?.region) {
26
+ console.error("There is no manifest.");
27
+ console.log(JSON.stringify({
28
+ manifest
29
+ }));
30
+ return;
31
+ }
32
+ const {
33
+ handler
34
+ } = (0, _createHandler.createHandler)({
35
+ getEventBridgeClient: () => {
36
+ return params.getEventBridgeClient({
37
+ region: manifest.sync.region
38
+ });
39
+ },
40
+ system: params.system,
41
+ manifest,
42
+ commandConverters: params.commandConverters,
43
+ getPlugins: () => {
44
+ return context.plugins;
45
+ }
46
+ });
47
+ (0, _attachToDynamoDbDocument.attachToDynamoDbDocument)({
48
+ handler
49
+ });
50
+ context.plugins.register([
51
+ /**
52
+ * When request ends, send the data to the EventBridge.
53
+ */
54
+ (0, _createSendDataToEventBridgeOnRequestEnd.createSendDataToEventBridgeOnRequestEnd)(handler)]);
55
+ });
56
+ };
57
+ exports.createSyncSystemHandlerOnRequestPlugin = createSyncSystemHandlerOnRequestPlugin;
58
+
59
+ //# sourceMappingURL=requestPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_handler","require","_manifest","_attachToDynamoDbDocument","_createSendDataToEventBridgeOnRequestEnd","_createHandler","_exception","createSyncSystemHandlerOnRequestPlugin","params","createHandlerOnRequest","_","__","context","data","manifest","error","getManifest","console","log","JSON","stringify","convertException","sync","region","handler","createHandler","getEventBridgeClient","system","commandConverters","getPlugins","plugins","attachToDynamoDbDocument","register","createSendDataToEventBridgeOnRequestEnd","exports"],"sources":["requestPlugin.ts"],"sourcesContent":["import type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport type { ICommandConverter, IGetEventBridgeCallable, ISystem } from \"~/sync/types.js\";\nimport { createHandlerOnRequest } from \"@webiny/handler\";\nimport { getManifest } from \"~/sync/utils/manifest.js\";\nimport { attachToDynamoDbDocument } from \"~/sync/attachToDynamoDbDocument.js\";\nimport { createSendDataToEventBridgeOnRequestEnd } from \"~/sync/createSendDataToEventBridgeOnRequestEnd.js\";\nimport { createHandler } from \"./createHandler.js\";\nimport { convertException } from \"@webiny/utils/exception.js\";\n\nexport interface ICreateSyncSystemHandlerOnRequestPluginParams {\n getDocumentClient(): Pick<DynamoDBDocument, \"send\">;\n getEventBridgeClient: IGetEventBridgeCallable;\n system: ISystem;\n commandConverters?: ICommandConverter[];\n}\n\nexport const createSyncSystemHandlerOnRequestPlugin = (\n params: ICreateSyncSystemHandlerOnRequestPluginParams\n) => {\n return createHandlerOnRequest(async (_, __, context) => {\n const { data: manifest, error } = await getManifest(params);\n if (error) {\n console.error(\"Error happened when fetching manifest.\");\n console.log(\n JSON.stringify({\n error: convertException(error)\n })\n );\n return;\n } else if (!manifest?.sync?.region) {\n console.error(\"There is no manifest.\");\n console.log(\n JSON.stringify({\n manifest\n })\n );\n return;\n }\n\n const { handler } = createHandler({\n getEventBridgeClient: () => {\n return params.getEventBridgeClient({\n region: manifest.sync.region\n });\n },\n system: params.system,\n manifest,\n commandConverters: params.commandConverters,\n getPlugins: () => {\n return context.plugins;\n }\n });\n\n attachToDynamoDbDocument({\n handler\n });\n context.plugins.register([\n /**\n * When request ends, send the data to the EventBridge.\n */\n createSendDataToEventBridgeOnRequestEnd(handler)\n ]);\n });\n};\n"],"mappings":";;;;;;AAEA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,yBAAA,GAAAF,OAAA;AACA,IAAAG,wCAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AASO,MAAMM,sCAAsC,GAC/CC,MAAqD,IACpD;EACD,OAAO,IAAAC,+BAAsB,EAAC,OAAOC,CAAC,EAAEC,EAAE,EAAEC,OAAO,KAAK;IACpD,MAAM;MAAEC,IAAI,EAAEC,QAAQ;MAAEC;IAAM,CAAC,GAAG,MAAM,IAAAC,qBAAW,EAACR,MAAM,CAAC;IAC3D,IAAIO,KAAK,EAAE;MACPE,OAAO,CAACF,KAAK,CAAC,wCAAwC,CAAC;MACvDE,OAAO,CAACC,GAAG,CACPC,IAAI,CAACC,SAAS,CAAC;QACXL,KAAK,EAAE,IAAAM,2BAAgB,EAACN,KAAK;MACjC,CAAC,CACL,CAAC;MACD;IACJ,CAAC,MAAM,IAAI,CAACD,QAAQ,EAAEQ,IAAI,EAAEC,MAAM,EAAE;MAChCN,OAAO,CAACF,KAAK,CAAC,uBAAuB,CAAC;MACtCE,OAAO,CAACC,GAAG,CACPC,IAAI,CAACC,SAAS,CAAC;QACXN;MACJ,CAAC,CACL,CAAC;MACD;IACJ;IAEA,MAAM;MAAEU;IAAQ,CAAC,GAAG,IAAAC,4BAAa,EAAC;MAC9BC,oBAAoB,EAAEA,CAAA,KAAM;QACxB,OAAOlB,MAAM,CAACkB,oBAAoB,CAAC;UAC/BH,MAAM,EAAET,QAAQ,CAACQ,IAAI,CAACC;QAC1B,CAAC,CAAC;MACN,CAAC;MACDI,MAAM,EAAEnB,MAAM,CAACmB,MAAM;MACrBb,QAAQ;MACRc,iBAAiB,EAAEpB,MAAM,CAACoB,iBAAiB;MAC3CC,UAAU,EAAEA,CAAA,KAAM;QACd,OAAOjB,OAAO,CAACkB,OAAO;MAC1B;IACJ,CAAC,CAAC;IAEF,IAAAC,kDAAwB,EAAC;MACrBP;IACJ,CAAC,CAAC;IACFZ,OAAO,CAACkB,OAAO,CAACE,QAAQ,CAAC;IACrB;AACZ;AACA;IACY,IAAAC,gFAAuC,EAACT,OAAO,CAAC,CACnD,CAAC;EACN,CAAC,CAAC;AACN,CAAC;AAACU,OAAA,CAAA3B,sCAAA,GAAAA,sCAAA","ignoreList":[]}
@@ -0,0 +1,64 @@
1
+ import type { NonEmptyArray } from "@webiny/api/types.js";
2
+ import type { BatchGetCommand, BatchWriteCommand, DeleteCommand, GetCommand, PutCommand, QueryCommand, ScanCommand, UpdateCommand } from "@webiny/aws-sdk/client-dynamodb/index.js";
3
+ import type { EventBridgeClient, EventBridgeClientConfig, PutEventsCommandOutput } from "@webiny/aws-sdk/client-eventbridge/index.js";
4
+ import type { AllCommandType, DynamoDBTableType, ExtendedCommandType } from "../types.js";
5
+ export interface IManifestData {
6
+ region: string;
7
+ eventBusName: string;
8
+ eventBusArn: string;
9
+ }
10
+ export interface IManifest {
11
+ sync: IManifestData;
12
+ }
13
+ export type IDynamoDbCommand = PutCommand | QueryCommand | ScanCommand | DeleteCommand | BatchWriteCommand | BatchGetCommand | GetCommand | UpdateCommand;
14
+ export interface ICommandValueItem {
15
+ PK: string;
16
+ SK: string;
17
+ command: ExtendedCommandType;
18
+ tableName: string;
19
+ tableType: DynamoDBTableType;
20
+ }
21
+ export interface ICommandValueItemExtended extends ICommandValueItem {
22
+ input: IDynamoDbCommand;
23
+ }
24
+ export interface ICommandValue {
25
+ readonly command: AllCommandType;
26
+ getItems(): NonEmptyArray<ICommandValueItemExtended> | null;
27
+ }
28
+ export interface ICommand<Result extends ICommandValue = ICommandValue> {
29
+ name: string;
30
+ can(input: IDynamoDbCommand): boolean;
31
+ convert(input: IDynamoDbCommand): Result;
32
+ }
33
+ export interface ITable {
34
+ name: string;
35
+ arn: string;
36
+ type: DynamoDBTableType;
37
+ }
38
+ export interface ISystem {
39
+ name: string;
40
+ env: string;
41
+ variant?: string | undefined;
42
+ region: string;
43
+ version: string;
44
+ }
45
+ export interface IHandler {
46
+ readonly id: string;
47
+ flush(): Promise<PutEventsCommandOutput | null>;
48
+ add(input: IDynamoDbCommand): void;
49
+ }
50
+ export interface ICommandConverter<Result extends ICommandValue = ICommandValue> {
51
+ name: string;
52
+ can(input: IDynamoDbCommand): boolean;
53
+ convert(input: IDynamoDbCommand): Result;
54
+ }
55
+ export interface IHandlerConverter {
56
+ register(input: ICommandConverter | ICommandConverter[]): void;
57
+ convert(input: IDynamoDbCommand): ICommandValue;
58
+ }
59
+ export interface IGetEventBridgeCallableParams extends Omit<Partial<EventBridgeClientConfig>, "region"> {
60
+ region: string;
61
+ }
62
+ export interface IGetEventBridgeCallable {
63
+ (params: IGetEventBridgeCallableParams): Pick<EventBridgeClient, "send">;
64
+ }
package/sync/types.js ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { NonEmptyArray } from \"@webiny/api/types.js\";\nimport type {\n BatchGetCommand,\n BatchWriteCommand,\n DeleteCommand,\n GetCommand,\n PutCommand,\n QueryCommand,\n ScanCommand,\n UpdateCommand\n} from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport type {\n EventBridgeClient,\n EventBridgeClientConfig,\n PutEventsCommandOutput\n} from \"@webiny/aws-sdk/client-eventbridge/index.js\";\nimport type { AllCommandType, DynamoDBTableType, ExtendedCommandType } from \"~/types.js\";\n\nexport interface IManifestData {\n region: string;\n eventBusName: string;\n eventBusArn: string;\n}\n\nexport interface IManifest {\n sync: IManifestData;\n}\n\nexport type IDynamoDbCommand =\n | PutCommand\n | QueryCommand\n | ScanCommand\n | DeleteCommand\n | BatchWriteCommand\n | BatchGetCommand\n | GetCommand\n | UpdateCommand;\n\nexport interface ICommandValueItem {\n PK: string;\n SK: string;\n command: ExtendedCommandType;\n tableName: string;\n tableType: DynamoDBTableType;\n}\n\nexport interface ICommandValueItemExtended extends ICommandValueItem {\n input: IDynamoDbCommand;\n}\n\nexport interface ICommandValue {\n readonly command: AllCommandType;\n getItems(): NonEmptyArray<ICommandValueItemExtended> | null;\n}\n\nexport interface ICommand<Result extends ICommandValue = ICommandValue> {\n name: string;\n can(input: IDynamoDbCommand): boolean;\n convert(input: IDynamoDbCommand): Result;\n}\n\nexport interface ITable {\n name: string;\n arn: string;\n type: DynamoDBTableType;\n}\n\nexport interface ISystem {\n name: string;\n env: string;\n variant?: string | undefined;\n region: string;\n version: string;\n}\n\nexport interface IHandler {\n readonly id: string;\n flush(): Promise<PutEventsCommandOutput | null>;\n add(input: IDynamoDbCommand): void;\n}\n\nexport interface ICommandConverter<Result extends ICommandValue = ICommandValue> {\n name: string;\n can(input: IDynamoDbCommand): boolean;\n convert(input: IDynamoDbCommand): Result;\n}\n\nexport interface IHandlerConverter {\n register(input: ICommandConverter | ICommandConverter[]): void;\n convert(input: IDynamoDbCommand): ICommandValue;\n}\n\nexport interface IGetEventBridgeCallableParams\n extends Omit<Partial<EventBridgeClientConfig>, \"region\"> {\n region: string;\n}\n\nexport interface IGetEventBridgeCallable {\n (params: IGetEventBridgeCallableParams): Pick<EventBridgeClient, \"send\">;\n}\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ import { DynamoDBTableType } from "../../types.js";
2
+ export declare const getTableType: (tableName: string) => DynamoDBTableType;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getTableType = void 0;
7
+ var _types = require("../../types.js");
8
+ const getTableType = tableName => {
9
+ switch (tableName) {
10
+ case process.env.DB_TABLE:
11
+ return _types.DynamoDBTableType.REGULAR;
12
+ case process.env.DB_TABLE_ELASTICSEARCH:
13
+ return _types.DynamoDBTableType.ELASTICSEARCH;
14
+ case process.env.DB_TABLE_LOG:
15
+ return _types.DynamoDBTableType.LOG;
16
+ default:
17
+ return _types.DynamoDBTableType.UNKNOWN;
18
+ }
19
+ };
20
+ exports.getTableType = getTableType;
21
+
22
+ //# sourceMappingURL=getTableType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_types","require","getTableType","tableName","process","env","DB_TABLE","DynamoDBTableType","REGULAR","DB_TABLE_ELASTICSEARCH","ELASTICSEARCH","DB_TABLE_LOG","LOG","UNKNOWN","exports"],"sources":["getTableType.ts"],"sourcesContent":["import { DynamoDBTableType } from \"~/types.js\";\n\nexport const getTableType = (tableName: string): DynamoDBTableType => {\n switch (tableName) {\n case process.env.DB_TABLE:\n return DynamoDBTableType.REGULAR;\n case process.env.DB_TABLE_ELASTICSEARCH:\n return DynamoDBTableType.ELASTICSEARCH;\n case process.env.DB_TABLE_LOG:\n return DynamoDBTableType.LOG;\n default:\n return DynamoDBTableType.UNKNOWN;\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEO,MAAMC,YAAY,GAAIC,SAAiB,IAAwB;EAClE,QAAQA,SAAS;IACb,KAAKC,OAAO,CAACC,GAAG,CAACC,QAAQ;MACrB,OAAOC,wBAAiB,CAACC,OAAO;IACpC,KAAKJ,OAAO,CAACC,GAAG,CAACI,sBAAsB;MACnC,OAAOF,wBAAiB,CAACG,aAAa;IAC1C,KAAKN,OAAO,CAACC,GAAG,CAACM,YAAY;MACzB,OAAOJ,wBAAiB,CAACK,GAAG;IAChC;MACI,OAAOL,wBAAiB,CAACM,OAAO;EACxC;AACJ,CAAC;AAACC,OAAA,CAAAZ,YAAA,GAAAA,YAAA","ignoreList":[]}
@@ -0,0 +1,17 @@
1
+ import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
2
+ export interface IGetManifestParams {
3
+ getDocumentClient(): Pick<DynamoDBDocument, "send">;
4
+ }
5
+ export declare const getManifest: (params: IGetManifestParams) => Promise<{
6
+ data: {
7
+ sync: {
8
+ region: string;
9
+ eventBusArn: string;
10
+ eventBusName: string;
11
+ };
12
+ };
13
+ error?: undefined;
14
+ } | {
15
+ error: any;
16
+ data?: undefined;
17
+ }>;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.getManifest = void 0;
8
+ var _api = require("@webiny/api");
9
+ var _zod = _interopRequireDefault(require("zod"));
10
+ var _utils = require("@webiny/utils");
11
+ const validateManifest = _zod.default.object({
12
+ sync: _zod.default.object({
13
+ eventBusArn: _zod.default.string(),
14
+ eventBusName: _zod.default.string(),
15
+ region: _zod.default.string()
16
+ })
17
+ });
18
+ const getManifest = async params => {
19
+ const documentClient = params.getDocumentClient();
20
+ try {
21
+ _api.ServiceDiscovery.setDocumentClient(documentClient);
22
+ const manifest = await _api.ServiceDiscovery.load();
23
+ if (!manifest?.sync) {
24
+ return {
25
+ /**
26
+ * This error will be silent. We do not want to log or throw at this point.
27
+ */
28
+ error: new Error("Sync System Manifest not found. Probably Sync System is not turned on.")
29
+ };
30
+ }
31
+ const {
32
+ data,
33
+ error
34
+ } = validateManifest.safeParse(manifest);
35
+ if (error) {
36
+ const err = (0, _utils.createZodError)(error);
37
+ return {
38
+ error: err
39
+ };
40
+ }
41
+ return {
42
+ data
43
+ };
44
+ } catch (ex) {
45
+ return {
46
+ error: ex
47
+ };
48
+ }
49
+ };
50
+ exports.getManifest = getManifest;
51
+
52
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_api","require","_zod","_interopRequireDefault","_utils","validateManifest","zod","object","sync","eventBusArn","string","eventBusName","region","getManifest","params","documentClient","getDocumentClient","ServiceDiscovery","setDocumentClient","manifest","load","error","Error","data","safeParse","err","createZodError","ex","exports"],"sources":["manifest.ts"],"sourcesContent":["import { ServiceDiscovery } from \"@webiny/api\";\nimport zod from \"zod\";\nimport { createZodError } from \"@webiny/utils\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb\";\n\nconst validateManifest = zod.object({\n sync: zod.object({\n eventBusArn: zod.string(),\n eventBusName: zod.string(),\n region: zod.string()\n })\n});\n\nexport interface IGetManifestParams {\n getDocumentClient(): Pick<DynamoDBDocument, \"send\">;\n}\n\nexport const getManifest = async (params: IGetManifestParams) => {\n const documentClient = params.getDocumentClient();\n try {\n ServiceDiscovery.setDocumentClient(documentClient);\n const manifest = await ServiceDiscovery.load();\n if (!manifest?.sync) {\n return {\n /**\n * This error will be silent. We do not want to log or throw at this point.\n */\n error: new Error(\n \"Sync System Manifest not found. Probably Sync System is not turned on.\"\n )\n };\n }\n const { data, error } = validateManifest.safeParse(manifest);\n if (error) {\n const err = createZodError(error);\n return {\n error: err\n };\n }\n return {\n data\n };\n } catch (ex) {\n return {\n error: ex\n };\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAGA,MAAMI,gBAAgB,GAAGC,YAAG,CAACC,MAAM,CAAC;EAChCC,IAAI,EAAEF,YAAG,CAACC,MAAM,CAAC;IACbE,WAAW,EAAEH,YAAG,CAACI,MAAM,CAAC,CAAC;IACzBC,YAAY,EAAEL,YAAG,CAACI,MAAM,CAAC,CAAC;IAC1BE,MAAM,EAAEN,YAAG,CAACI,MAAM,CAAC;EACvB,CAAC;AACL,CAAC,CAAC;AAMK,MAAMG,WAAW,GAAG,MAAOC,MAA0B,IAAK;EAC7D,MAAMC,cAAc,GAAGD,MAAM,CAACE,iBAAiB,CAAC,CAAC;EACjD,IAAI;IACAC,qBAAgB,CAACC,iBAAiB,CAACH,cAAc,CAAC;IAClD,MAAMI,QAAQ,GAAG,MAAMF,qBAAgB,CAACG,IAAI,CAAC,CAAC;IAC9C,IAAI,CAACD,QAAQ,EAAEX,IAAI,EAAE;MACjB,OAAO;QACH;AAChB;AACA;QACgBa,KAAK,EAAE,IAAIC,KAAK,CACZ,wEACJ;MACJ,CAAC;IACL;IACA,MAAM;MAAEC,IAAI;MAAEF;IAAM,CAAC,GAAGhB,gBAAgB,CAACmB,SAAS,CAACL,QAAQ,CAAC;IAC5D,IAAIE,KAAK,EAAE;MACP,MAAMI,GAAG,GAAG,IAAAC,qBAAc,EAACL,KAAK,CAAC;MACjC,OAAO;QACHA,KAAK,EAAEI;MACX,CAAC;IACL;IACA,OAAO;MACHF;IACJ,CAAC;EACL,CAAC,CAAC,OAAOI,EAAE,EAAE;IACT,OAAO;MACHN,KAAK,EAAEM;IACX,CAAC;EACL;AACJ,CAAC;AAACC,OAAA,CAAAf,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ import type { ISystem } from "../types.js";
2
+ export interface IValidResponse {
3
+ system: ISystem;
4
+ error?: never;
5
+ }
6
+ export interface IErrorResponse {
7
+ error: string;
8
+ system?: never;
9
+ }
10
+ export type ValidateSystemInputResponse = IValidResponse | IErrorResponse;
11
+ export declare const validateSystemInput: (input: Partial<ISystem>) => ValidateSystemInputResponse;