@webiny/api-sync-system 6.0.0-alpha.4 → 6.0.0-rc.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 (299) hide show
  1. package/README.md +6 -108
  2. package/constants.js +1 -7
  3. package/constants.js.map +1 -1
  4. package/index.js +3 -38
  5. package/index.js.map +1 -1
  6. package/package.json +20 -23
  7. package/resolver/app/RecordHandler.d.ts +6 -6
  8. package/resolver/app/RecordHandler.js +7 -15
  9. package/resolver/app/RecordHandler.js.map +1 -1
  10. package/resolver/app/RecordsValidation.js +6 -14
  11. package/resolver/app/RecordsValidation.js.map +1 -1
  12. package/resolver/app/ResolverApplication.d.ts +1 -1
  13. package/resolver/app/ResolverApplication.js +10 -18
  14. package/resolver/app/ResolverApplication.js.map +1 -1
  15. package/resolver/app/abstractions/RecordHandler.d.ts +1 -1
  16. package/resolver/app/abstractions/RecordHandler.js +1 -5
  17. package/resolver/app/abstractions/RecordsValidation.d.ts +2 -2
  18. package/resolver/app/abstractions/RecordsValidation.js +1 -5
  19. package/resolver/app/abstractions/RecordsValidation.js.map +1 -1
  20. package/resolver/app/abstractions/ResolverApplication.js +1 -5
  21. package/resolver/app/abstractions/ResolverRecord.d.ts +1 -1
  22. package/resolver/app/abstractions/ResolverRecord.js +1 -5
  23. package/resolver/app/abstractions/ResolverRecord.js.map +1 -1
  24. package/resolver/app/bundler/BaseBundle.d.ts +6 -6
  25. package/resolver/app/bundler/BaseBundle.js +1 -8
  26. package/resolver/app/bundler/BaseBundle.js.map +1 -1
  27. package/resolver/app/bundler/Bundler.d.ts +1 -1
  28. package/resolver/app/bundler/Bundler.js +2 -10
  29. package/resolver/app/bundler/Bundler.js.map +1 -1
  30. package/resolver/app/bundler/Bundles.d.ts +2 -2
  31. package/resolver/app/bundler/Bundles.js +2 -10
  32. package/resolver/app/bundler/Bundles.js.map +1 -1
  33. package/resolver/app/bundler/CommandBundle.d.ts +1 -1
  34. package/resolver/app/bundler/CommandBundle.js +3 -11
  35. package/resolver/app/bundler/CommandBundle.js.map +1 -1
  36. package/resolver/app/bundler/TableBundle.d.ts +1 -1
  37. package/resolver/app/bundler/TableBundle.js +3 -11
  38. package/resolver/app/bundler/TableBundle.js.map +1 -1
  39. package/resolver/app/bundler/types.d.ts +2 -2
  40. package/resolver/app/bundler/types.js +1 -5
  41. package/resolver/app/commandHandler/DeleteCommandHandler.d.ts +3 -3
  42. package/resolver/app/commandHandler/DeleteCommandHandler.js +1 -8
  43. package/resolver/app/commandHandler/DeleteCommandHandler.js.map +1 -1
  44. package/resolver/app/commandHandler/PutCommandHandler.d.ts +4 -4
  45. package/resolver/app/commandHandler/PutCommandHandler.js +1 -8
  46. package/resolver/app/commandHandler/PutCommandHandler.js.map +1 -1
  47. package/resolver/app/commandHandler/delete.d.ts +1 -1
  48. package/resolver/app/commandHandler/delete.js +6 -13
  49. package/resolver/app/commandHandler/delete.js.map +1 -1
  50. package/resolver/app/commandHandler/put.d.ts +1 -1
  51. package/resolver/app/commandHandler/put.js +6 -13
  52. package/resolver/app/commandHandler/put.js.map +1 -1
  53. package/resolver/app/data/SourceDataContainer.d.ts +3 -3
  54. package/resolver/app/data/SourceDataContainer.js +1 -8
  55. package/resolver/app/data/SourceDataContainer.js.map +1 -1
  56. package/resolver/app/data/types.d.ts +2 -2
  57. package/resolver/app/data/types.js +1 -5
  58. package/resolver/app/fetcher/Fetcher.d.ts +3 -3
  59. package/resolver/app/fetcher/Fetcher.js +13 -22
  60. package/resolver/app/fetcher/Fetcher.js.map +1 -1
  61. package/resolver/app/fetcher/types.d.ts +2 -2
  62. package/resolver/app/fetcher/types.js +1 -5
  63. package/resolver/app/ingestor/Ingestor.d.ts +1 -1
  64. package/resolver/app/ingestor/Ingestor.js +2 -10
  65. package/resolver/app/ingestor/Ingestor.js.map +1 -1
  66. package/resolver/app/ingestor/IngestorResult.js +3 -11
  67. package/resolver/app/ingestor/IngestorResult.js.map +1 -1
  68. package/resolver/app/ingestor/types.d.ts +2 -2
  69. package/resolver/app/ingestor/types.js +1 -5
  70. package/resolver/app/storer/Storer.d.ts +3 -3
  71. package/resolver/app/storer/Storer.js +12 -20
  72. package/resolver/app/storer/Storer.js.map +1 -1
  73. package/resolver/app/storer/types.d.ts +2 -2
  74. package/resolver/app/storer/types.js +1 -5
  75. package/resolver/app/storer/types.js.map +1 -1
  76. package/resolver/app/transform/TransformHandler.d.ts +4 -4
  77. package/resolver/app/transform/TransformHandler.js +5 -12
  78. package/resolver/app/transform/TransformHandler.js.map +1 -1
  79. package/resolver/app/transform/middleware.d.ts +1 -1
  80. package/resolver/app/transform/middleware.js +1 -7
  81. package/resolver/app/transform/middleware.js.map +1 -1
  82. package/resolver/app/utils/Retry.js +4 -12
  83. package/resolver/app/utils/Retry.js.map +1 -1
  84. package/resolver/app/utils/sleep.js +1 -8
  85. package/resolver/app/utils/sleep.js.map +1 -1
  86. package/resolver/app/validation/body.d.ts +6 -6
  87. package/resolver/app/validation/body.js +22 -30
  88. package/resolver/app/validation/body.js.map +1 -1
  89. package/resolver/app/validation/createJsonTransform.js +6 -14
  90. package/resolver/app/validation/createJsonTransform.js.map +1 -1
  91. package/resolver/app/validation/detail.d.ts +6 -6
  92. package/resolver/app/validation/detail.js +16 -24
  93. package/resolver/app/validation/detail.js.map +1 -1
  94. package/resolver/app/validation/event.d.ts +6 -6
  95. package/resolver/app/validation/event.js +19 -27
  96. package/resolver/app/validation/event.js.map +1 -1
  97. package/resolver/app/validation/numericString.js +5 -13
  98. package/resolver/app/validation/numericString.js.map +1 -1
  99. package/resolver/app/validation/system.js +8 -16
  100. package/resolver/app/validation/system.js.map +1 -1
  101. package/resolver/createEventHandlerPlugin.d.ts +2 -1
  102. package/resolver/createEventHandlerPlugin.js +35 -42
  103. package/resolver/createEventHandlerPlugin.js.map +1 -1
  104. package/resolver/createResolverHandler.d.ts +1 -1
  105. package/resolver/createResolverHandler.js +24 -31
  106. package/resolver/createResolverHandler.js.map +1 -1
  107. package/resolver/deployment/Deployment.d.ts +2 -3
  108. package/resolver/deployment/Deployment.js +6 -14
  109. package/resolver/deployment/Deployment.js.map +1 -1
  110. package/resolver/deployment/Deployments.js +2 -10
  111. package/resolver/deployment/Deployments.js.map +1 -1
  112. package/resolver/deployment/DeploymentsFetcher.js +33 -42
  113. package/resolver/deployment/DeploymentsFetcher.js.map +1 -1
  114. package/resolver/deployment/types.d.ts +4 -4
  115. package/resolver/deployment/types.js +1 -5
  116. package/resolver/deployment/types.js.map +1 -1
  117. package/resolver/lambda/LambdaTrigger.js +5 -12
  118. package/resolver/lambda/LambdaTrigger.js.map +1 -1
  119. package/resolver/plugins/CommandHandlerPlugin.d.ts +3 -3
  120. package/resolver/plugins/CommandHandlerPlugin.js +3 -11
  121. package/resolver/plugins/CommandHandlerPlugin.js.map +1 -1
  122. package/resolver/plugins/StorerAfterEachPlugin.d.ts +2 -2
  123. package/resolver/plugins/StorerAfterEachPlugin.js +4 -13
  124. package/resolver/plugins/StorerAfterEachPlugin.js.map +1 -1
  125. package/resolver/plugins/TransformRecordPlugin.d.ts +3 -3
  126. package/resolver/plugins/TransformRecordPlugin.js +3 -11
  127. package/resolver/plugins/TransformRecordPlugin.js.map +1 -1
  128. package/resolver/recordTypes/fileManager/CopyFile.js +4 -11
  129. package/resolver/recordTypes/fileManager/CopyFile.js.map +1 -1
  130. package/resolver/recordTypes/fileManager/DeleteFile.d.ts +1 -1
  131. package/resolver/recordTypes/fileManager/DeleteFile.js +3 -10
  132. package/resolver/recordTypes/fileManager/DeleteFile.js.map +1 -1
  133. package/resolver/recordTypes/fileManager/fileManager.d.ts +1 -1
  134. package/resolver/recordTypes/fileManager/fileManager.js +4 -11
  135. package/resolver/recordTypes/fileManager/fileManager.js.map +1 -1
  136. package/resolver/recordTypes/fileManager/fileManagerOnDelete.d.ts +1 -1
  137. package/resolver/recordTypes/fileManager/fileManagerOnDelete.js +7 -14
  138. package/resolver/recordTypes/fileManager/fileManagerOnDelete.js.map +1 -1
  139. package/resolver/recordTypes/fileManager/fileManagerOnPut.d.ts +1 -1
  140. package/resolver/recordTypes/fileManager/fileManagerOnPut.js +7 -14
  141. package/resolver/recordTypes/fileManager/fileManagerOnPut.js.map +1 -1
  142. package/resolver/recordTypes/fileManager/shouldBeHandled.d.ts +1 -1
  143. package/resolver/recordTypes/fileManager/shouldBeHandled.js +1 -8
  144. package/resolver/recordTypes/fileManager/shouldBeHandled.js.map +1 -1
  145. package/resolver/recordTypes/fileManager/types.d.ts +2 -2
  146. package/resolver/recordTypes/fileManager/types.js +1 -5
  147. package/resolver/recordTypes/users/CopyUser.d.ts +2 -2
  148. package/resolver/recordTypes/users/CopyUser.js +3 -10
  149. package/resolver/recordTypes/users/CopyUser.js.map +1 -1
  150. package/resolver/recordTypes/users/DeleteUser.d.ts +2 -2
  151. package/resolver/recordTypes/users/DeleteUser.js +3 -10
  152. package/resolver/recordTypes/users/DeleteUser.js.map +1 -1
  153. package/resolver/recordTypes/users/shouldBeHandled.d.ts +1 -1
  154. package/resolver/recordTypes/users/shouldBeHandled.js +1 -8
  155. package/resolver/recordTypes/users/shouldBeHandled.js.map +1 -1
  156. package/resolver/recordTypes/users/types.d.ts +1 -1
  157. package/resolver/recordTypes/users/types.js +1 -5
  158. package/resolver/recordTypes/users/types.js.map +1 -1
  159. package/resolver/recordTypes/users/users.js +4 -11
  160. package/resolver/recordTypes/users/users.js.map +1 -1
  161. package/resolver/recordTypes/users/usersOnDelete.d.ts +2 -2
  162. package/resolver/recordTypes/users/usersOnDelete.js +7 -14
  163. package/resolver/recordTypes/users/usersOnDelete.js.map +1 -1
  164. package/resolver/recordTypes/users/usersOnPut.d.ts +2 -2
  165. package/resolver/recordTypes/users/usersOnPut.js +7 -14
  166. package/resolver/recordTypes/users/usersOnPut.js.map +1 -1
  167. package/sync/FilterOutRecord.d.ts +2 -2
  168. package/sync/FilterOutRecord.js +2 -10
  169. package/sync/FilterOutRecord.js.map +1 -1
  170. package/sync/attachToDynamoDbDocument.d.ts +1 -1
  171. package/sync/attachToDynamoDbDocument.js +9 -17
  172. package/sync/attachToDynamoDbDocument.js.map +1 -1
  173. package/sync/createHandler.js +27 -34
  174. package/sync/createHandler.js.map +1 -1
  175. package/sync/createSendDataToEventBridgeOnRequestEnd.js +6 -13
  176. package/sync/createSendDataToEventBridgeOnRequestEnd.js.map +1 -1
  177. package/sync/createSyncSystem.d.ts +1 -1
  178. package/sync/createSyncSystem.js +6 -13
  179. package/sync/createSyncSystem.js.map +1 -1
  180. package/sync/filter/createDefaultFilterOutRecordPlugins.d.ts +1 -1
  181. package/sync/filter/createDefaultFilterOutRecordPlugins.js +9 -19
  182. package/sync/filter/createDefaultFilterOutRecordPlugins.js.map +1 -1
  183. package/sync/handler/Handler.d.ts +2 -2
  184. package/sync/handler/Handler.js +9 -17
  185. package/sync/handler/Handler.js.map +1 -1
  186. package/sync/handler/HandlerConverter.js +2 -10
  187. package/sync/handler/HandlerConverter.js.map +1 -1
  188. package/sync/handler/converter/BatchGetCommandConverter.js +6 -14
  189. package/sync/handler/converter/BatchGetCommandConverter.js.map +1 -1
  190. package/sync/handler/converter/BatchWriteCommandConverter.js +6 -14
  191. package/sync/handler/converter/BatchWriteCommandConverter.js.map +1 -1
  192. package/sync/handler/converter/DeleteCommandConverter.js +6 -14
  193. package/sync/handler/converter/DeleteCommandConverter.js.map +1 -1
  194. package/sync/handler/converter/GetCommandConverter.js +6 -14
  195. package/sync/handler/converter/GetCommandConverter.js.map +1 -1
  196. package/sync/handler/converter/PutCommandConverter.js +6 -14
  197. package/sync/handler/converter/PutCommandConverter.js.map +1 -1
  198. package/sync/handler/converter/QueryCommandConverter.js +6 -14
  199. package/sync/handler/converter/QueryCommandConverter.js.map +1 -1
  200. package/sync/handler/converter/ScanCommandConverter.js +6 -14
  201. package/sync/handler/converter/ScanCommandConverter.js.map +1 -1
  202. package/sync/handler/converter/UpdateCommandConverter.js +6 -14
  203. package/sync/handler/converter/UpdateCommandConverter.js.map +1 -1
  204. package/sync/handler/converter/commands/BatchWriteCommandValue.d.ts +2 -2
  205. package/sync/handler/converter/commands/BatchWriteCommandValue.js +4 -11
  206. package/sync/handler/converter/commands/BatchWriteCommandValue.js.map +1 -1
  207. package/sync/handler/converter/commands/DeleteCommandValue.d.ts +2 -2
  208. package/sync/handler/converter/commands/DeleteCommandValue.js +3 -10
  209. package/sync/handler/converter/commands/DeleteCommandValue.js.map +1 -1
  210. package/sync/handler/converter/commands/NullCommandValue.d.ts +1 -1
  211. package/sync/handler/converter/commands/NullCommandValue.js +1 -8
  212. package/sync/handler/converter/commands/NullCommandValue.js.map +1 -1
  213. package/sync/handler/converter/commands/PutCommandValue.d.ts +2 -2
  214. package/sync/handler/converter/commands/PutCommandValue.js +3 -10
  215. package/sync/handler/converter/commands/PutCommandValue.js.map +1 -1
  216. package/sync/handler/converter/commands/UpdateCommandValue.d.ts +2 -2
  217. package/sync/handler/converter/commands/UpdateCommandValue.js +3 -10
  218. package/sync/handler/converter/commands/UpdateCommandValue.js.map +1 -1
  219. package/sync/handler/types.d.ts +3 -3
  220. package/sync/handler/types.js +1 -5
  221. package/sync/handler/types.js.map +1 -1
  222. package/sync/plugins/FilterOutRecordPlugin.d.ts +1 -1
  223. package/sync/plugins/FilterOutRecordPlugin.js +3 -11
  224. package/sync/plugins/FilterOutRecordPlugin.js.map +1 -1
  225. package/sync/requestPlugin.d.ts +1 -1
  226. package/sync/requestPlugin.js +19 -20
  227. package/sync/requestPlugin.js.map +1 -1
  228. package/sync/types.js +1 -5
  229. package/sync/utils/getTableType.js +7 -14
  230. package/sync/utils/getTableType.js.map +1 -1
  231. package/sync/utils/manifest.d.ts +1 -1
  232. package/sync/utils/manifest.js +12 -20
  233. package/sync/utils/manifest.js.map +1 -1
  234. package/sync/utils/validateSystemInput.d.ts +1 -1
  235. package/sync/utils/validateSystemInput.js +3 -10
  236. package/sync/utils/validateSystemInput.js.map +1 -1
  237. package/types.d.ts +3 -4
  238. package/types.js +2 -8
  239. package/types.js.map +1 -1
  240. package/utils/createSystemName.js +1 -8
  241. package/utils/createSystemName.js.map +1 -1
  242. package/worker/actions/copyFile/CopyFile.js +13 -21
  243. package/worker/actions/copyFile/CopyFile.js.map +1 -1
  244. package/worker/actions/copyFile/copyFileAction.d.ts +1 -1
  245. package/worker/actions/copyFile/copyFileAction.js +9 -16
  246. package/worker/actions/copyFile/copyFileAction.js.map +1 -1
  247. package/worker/actions/copyFile/copyFileSchema.js +8 -16
  248. package/worker/actions/copyFile/copyFileSchema.js.map +1 -1
  249. package/worker/actions/copyFile/types.js +1 -5
  250. package/worker/actions/createUser/CreateUser.d.ts +1 -1
  251. package/worker/actions/createUser/CreateUser.js +9 -16
  252. package/worker/actions/createUser/CreateUser.js.map +1 -1
  253. package/worker/actions/createUser/createUserAction.d.ts +2 -2
  254. package/worker/actions/createUser/createUserAction.js +9 -16
  255. package/worker/actions/createUser/createUserAction.js.map +1 -1
  256. package/worker/actions/createUser/createUserSchema.js +8 -16
  257. package/worker/actions/createUser/createUserSchema.js.map +1 -1
  258. package/worker/actions/createUser/types.js +1 -5
  259. package/worker/actions/deleteFile/DeleteFile.js +4 -11
  260. package/worker/actions/deleteFile/DeleteFile.js.map +1 -1
  261. package/worker/actions/deleteFile/deleteFileAction.d.ts +1 -1
  262. package/worker/actions/deleteFile/deleteFileAction.js +9 -16
  263. package/worker/actions/deleteFile/deleteFileAction.js.map +1 -1
  264. package/worker/actions/deleteFile/deleteFileSchema.js +8 -16
  265. package/worker/actions/deleteFile/deleteFileSchema.js.map +1 -1
  266. package/worker/actions/deleteFile/types.js +1 -5
  267. package/worker/actions/deleteUser/DeleteUser.d.ts +2 -2
  268. package/worker/actions/deleteUser/DeleteUser.js +7 -14
  269. package/worker/actions/deleteUser/DeleteUser.js.map +1 -1
  270. package/worker/actions/deleteUser/deleteUserAction.d.ts +1 -1
  271. package/worker/actions/deleteUser/deleteUserAction.js +9 -16
  272. package/worker/actions/deleteUser/deleteUserAction.js.map +1 -1
  273. package/worker/actions/deleteUser/deleteUserSchema.js +8 -16
  274. package/worker/actions/deleteUser/deleteUserSchema.js.map +1 -1
  275. package/worker/actions/deleteUser/types.js +1 -5
  276. package/worker/actions/logValidationError.js +4 -11
  277. package/worker/actions/logValidationError.js.map +1 -1
  278. package/worker/actions/removeCognitoUserAttributes.js +1 -8
  279. package/worker/actions/removeCognitoUserAttributes.js.map +1 -1
  280. package/worker/actions/updateUser/UpdateUser.d.ts +1 -1
  281. package/worker/actions/updateUser/UpdateUser.js +9 -16
  282. package/worker/actions/updateUser/UpdateUser.js.map +1 -1
  283. package/worker/actions/updateUser/types.js +1 -5
  284. package/worker/actions/updateUser/updateUserAction.d.ts +2 -2
  285. package/worker/actions/updateUser/updateUserAction.js +9 -16
  286. package/worker/actions/updateUser/updateUserAction.js.map +1 -1
  287. package/worker/actions/updateUser/updateUserSchema.js +8 -16
  288. package/worker/actions/updateUser/updateUserSchema.js.map +1 -1
  289. package/worker/createWorkerHandler.js +17 -24
  290. package/worker/createWorkerHandler.js.map +1 -1
  291. package/worker/handler/WorkerActionHandler.d.ts +2 -2
  292. package/worker/handler/WorkerActionHandler.js +3 -10
  293. package/worker/handler/WorkerActionHandler.js.map +1 -1
  294. package/worker/handler/eventHandler.js +9 -16
  295. package/worker/handler/eventHandler.js.map +1 -1
  296. package/worker/plugins/WorkerActionPlugin.d.ts +1 -1
  297. package/worker/plugins/WorkerActionPlugin.js +3 -11
  298. package/worker/plugins/WorkerActionPlugin.js.map +1 -1
  299. package/worker/types.js +1 -5
@@ -1,17 +1,11 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createFileManagerOnPutPlugin = void 0;
7
- var _StorerAfterEachPlugin = require("../../plugins/StorerAfterEachPlugin.js");
8
- var _shouldBeHandled = require("./shouldBeHandled.js");
9
- var _utils = require("@webiny/utils");
10
- const createFileManagerOnPutPlugin = params => {
1
+ import { createStorerAfterEachPluginWithName } from "../../plugins/StorerAfterEachPlugin.js";
2
+ import { shouldBeHandled } from "./shouldBeHandled.js";
3
+ import { convertException } from "@webiny/utils";
4
+ export const createFileManagerOnPutPlugin = params => {
11
5
  const {
12
6
  copyFile
13
7
  } = params;
14
- return (0, _StorerAfterEachPlugin.createStorerAfterEachPluginWithName)("fileManager.onPut", {
8
+ return createStorerAfterEachPluginWithName("fileManager.onPut", {
15
9
  canHandle: params => {
16
10
  const {
17
11
  command
@@ -19,7 +13,7 @@ const createFileManagerOnPutPlugin = params => {
19
13
  if (command !== "put") {
20
14
  return false;
21
15
  }
22
- return (0, _shouldBeHandled.shouldBeHandled)(params);
16
+ return shouldBeHandled(params);
23
17
  },
24
18
  handle: async params => {
25
19
  const {
@@ -38,11 +32,10 @@ const createFileManagerOnPutPlugin = params => {
38
32
  });
39
33
  } catch (ex) {
40
34
  console.error("Error while handling file manager onPut plugin.");
41
- console.log((0, _utils.convertException)(ex));
35
+ console.log(convertException(ex));
42
36
  }
43
37
  }
44
38
  });
45
39
  };
46
- exports.createFileManagerOnPutPlugin = createFileManagerOnPutPlugin;
47
40
 
48
41
  //# sourceMappingURL=fileManagerOnPut.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_StorerAfterEachPlugin","require","_shouldBeHandled","_utils","createFileManagerOnPutPlugin","params","copyFile","createStorerAfterEachPluginWithName","canHandle","command","shouldBeHandled","handle","item","key","values","target","source","ex","console","error","log","convertException","exports"],"sources":["fileManagerOnPut.ts"],"sourcesContent":["import { createStorerAfterEachPluginWithName } from \"~/resolver/plugins/StorerAfterEachPlugin.js\";\nimport { shouldBeHandled } from \"./shouldBeHandled.js\";\nimport { convertException } from \"@webiny/utils\";\nimport type { ICopyFile } from \"./types.js\";\n\nexport interface ICreateFileManagerOnPutPluginParams {\n copyFile: ICopyFile;\n}\n\nexport const createFileManagerOnPutPlugin = (params: ICreateFileManagerOnPutPluginParams) => {\n const { copyFile } = params;\n\n return createStorerAfterEachPluginWithName(\"fileManager.onPut\", {\n canHandle: params => {\n const { command } = params;\n if (command !== \"put\") {\n return false;\n }\n return shouldBeHandled(params);\n },\n handle: async params => {\n const { item } = params;\n /**\n * We are 100% positive that the key exists here because canHandle would not allow for handle to be called.\n */\n // @ts-expect-error\n const key = (item.values[\"text@key\"] || item.values[\"key\"]) as string;\n try {\n await copyFile.handle({\n target: params.target,\n source: params.source,\n key\n });\n } catch (ex) {\n console.error(\"Error while handling file manager onPut plugin.\");\n console.log(convertException(ex));\n }\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAOO,MAAMG,4BAA4B,GAAIC,MAA2C,IAAK;EACzF,MAAM;IAAEC;EAAS,CAAC,GAAGD,MAAM;EAE3B,OAAO,IAAAE,0DAAmC,EAAC,mBAAmB,EAAE;IAC5DC,SAAS,EAAEH,MAAM,IAAI;MACjB,MAAM;QAAEI;MAAQ,CAAC,GAAGJ,MAAM;MAC1B,IAAII,OAAO,KAAK,KAAK,EAAE;QACnB,OAAO,KAAK;MAChB;MACA,OAAO,IAAAC,gCAAe,EAACL,MAAM,CAAC;IAClC,CAAC;IACDM,MAAM,EAAE,MAAMN,MAAM,IAAI;MACpB,MAAM;QAAEO;MAAK,CAAC,GAAGP,MAAM;MACvB;AACZ;AACA;MACY;MACA,MAAMQ,GAAG,GAAID,IAAI,CAACE,MAAM,CAAC,UAAU,CAAC,IAAIF,IAAI,CAACE,MAAM,CAAC,KAAK,CAAY;MACrE,IAAI;QACA,MAAMR,QAAQ,CAACK,MAAM,CAAC;UAClBI,MAAM,EAAEV,MAAM,CAACU,MAAM;UACrBC,MAAM,EAAEX,MAAM,CAACW,MAAM;UACrBH;QACJ,CAAC,CAAC;MACN,CAAC,CAAC,OAAOI,EAAE,EAAE;QACTC,OAAO,CAACC,KAAK,CAAC,iDAAiD,CAAC;QAChED,OAAO,CAACE,GAAG,CAAC,IAAAC,uBAAgB,EAACJ,EAAE,CAAC,CAAC;MACrC;IACJ;EACJ,CAAC,CAAC;AACN,CAAC;AAACK,OAAA,CAAAlB,4BAAA,GAAAA,4BAAA","ignoreList":[]}
1
+ {"version":3,"names":["createStorerAfterEachPluginWithName","shouldBeHandled","convertException","createFileManagerOnPutPlugin","params","copyFile","canHandle","command","handle","item","key","values","target","source","ex","console","error","log"],"sources":["fileManagerOnPut.ts"],"sourcesContent":["import { createStorerAfterEachPluginWithName } from \"~/resolver/plugins/StorerAfterEachPlugin.js\";\nimport { shouldBeHandled } from \"./shouldBeHandled.js\";\nimport { convertException } from \"@webiny/utils\";\nimport type { ICopyFile } from \"./types.js\";\n\nexport interface ICreateFileManagerOnPutPluginParams {\n copyFile: ICopyFile;\n}\n\nexport const createFileManagerOnPutPlugin = (params: ICreateFileManagerOnPutPluginParams) => {\n const { copyFile } = params;\n\n return createStorerAfterEachPluginWithName(\"fileManager.onPut\", {\n canHandle: params => {\n const { command } = params;\n if (command !== \"put\") {\n return false;\n }\n return shouldBeHandled(params);\n },\n handle: async params => {\n const { item } = params;\n /**\n * We are 100% positive that the key exists here because canHandle would not allow for handle to be called.\n */\n // @ts-expect-error\n const key = (item.values[\"text@key\"] || item.values[\"key\"]) as string;\n try {\n await copyFile.handle({\n target: params.target,\n source: params.source,\n key\n });\n } catch (ex) {\n console.error(\"Error while handling file manager onPut plugin.\");\n console.log(convertException(ex));\n }\n }\n });\n};\n"],"mappings":"AAAA,SAASA,mCAAmC;AAC5C,SAASC,eAAe;AACxB,SAASC,gBAAgB,QAAQ,eAAe;AAOhD,OAAO,MAAMC,4BAA4B,GAAIC,MAA2C,IAAK;EACzF,MAAM;IAAEC;EAAS,CAAC,GAAGD,MAAM;EAE3B,OAAOJ,mCAAmC,CAAC,mBAAmB,EAAE;IAC5DM,SAAS,EAAEF,MAAM,IAAI;MACjB,MAAM;QAAEG;MAAQ,CAAC,GAAGH,MAAM;MAC1B,IAAIG,OAAO,KAAK,KAAK,EAAE;QACnB,OAAO,KAAK;MAChB;MACA,OAAON,eAAe,CAACG,MAAM,CAAC;IAClC,CAAC;IACDI,MAAM,EAAE,MAAMJ,MAAM,IAAI;MACpB,MAAM;QAAEK;MAAK,CAAC,GAAGL,MAAM;MACvB;AACZ;AACA;MACY;MACA,MAAMM,GAAG,GAAID,IAAI,CAACE,MAAM,CAAC,UAAU,CAAC,IAAIF,IAAI,CAACE,MAAM,CAAC,KAAK,CAAY;MACrE,IAAI;QACA,MAAMN,QAAQ,CAACG,MAAM,CAAC;UAClBI,MAAM,EAAER,MAAM,CAACQ,MAAM;UACrBC,MAAM,EAAET,MAAM,CAACS,MAAM;UACrBH;QACJ,CAAC,CAAC;MACN,CAAC,CAAC,OAAOI,EAAE,EAAE;QACTC,OAAO,CAACC,KAAK,CAAC,iDAAiD,CAAC;QAChED,OAAO,CAACE,GAAG,CAACf,gBAAgB,CAACY,EAAE,CAAC,CAAC;MACrC;IACJ;EACJ,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import type { IStorerAfterEachPluginCanHandleParams } from "../../plugins/StorerAfterEachPlugin.js";
1
+ import type { IStorerAfterEachPluginCanHandleParams } from "../../../resolver/plugins/StorerAfterEachPlugin.js";
2
2
  export declare const shouldBeHandled: (params: IStorerAfterEachPluginCanHandleParams) => boolean;
@@ -1,10 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.shouldBeHandled = void 0;
7
- const shouldBeHandled = params => {
1
+ export const shouldBeHandled = params => {
8
2
  const {
9
3
  item,
10
4
  table
@@ -32,6 +26,5 @@ const shouldBeHandled = params => {
32
26
  */
33
27
  return typeof key === "string" && key.length > 2;
34
28
  };
35
- exports.shouldBeHandled = shouldBeHandled;
36
29
 
37
30
  //# sourceMappingURL=shouldBeHandled.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["shouldBeHandled","params","item","table","type","SK","modelId","values","key","length","exports"],"sources":["shouldBeHandled.ts"],"sourcesContent":["import type { IStorerAfterEachPluginCanHandleParams } from \"~/resolver/plugins/StorerAfterEachPlugin.js\";\n\nexport const shouldBeHandled = (params: IStorerAfterEachPluginCanHandleParams): boolean => {\n const { item, table } = params;\n if (table.type !== \"regular\") {\n return false;\n } else if (item.SK !== \"L\") {\n return false;\n }\n // TODO use constant from fileManager\n else if (item.modelId !== \"fmFile\") {\n return false;\n } else if (!item.values) {\n return false;\n }\n\n // @ts-expect-error\n const key = item.values[\"text@key\"] || item.values[\"key\"];\n if (!key) {\n return false;\n }\n /**\n * We can check length for being more than 2 characters,\n * because we know that the key is a string.\n */\n return typeof key === \"string\" && key.length > 2;\n};\n"],"mappings":";;;;;;AAEO,MAAMA,eAAe,GAAIC,MAA6C,IAAc;EACvF,MAAM;IAAEC,IAAI;IAAEC;EAAM,CAAC,GAAGF,MAAM;EAC9B,IAAIE,KAAK,CAACC,IAAI,KAAK,SAAS,EAAE;IAC1B,OAAO,KAAK;EAChB,CAAC,MAAM,IAAIF,IAAI,CAACG,EAAE,KAAK,GAAG,EAAE;IACxB,OAAO,KAAK;EAChB;EACA;EAAA,KACK,IAAIH,IAAI,CAACI,OAAO,KAAK,QAAQ,EAAE;IAChC,OAAO,KAAK;EAChB,CAAC,MAAM,IAAI,CAACJ,IAAI,CAACK,MAAM,EAAE;IACrB,OAAO,KAAK;EAChB;;EAEA;EACA,MAAMC,GAAG,GAAGN,IAAI,CAACK,MAAM,CAAC,UAAU,CAAC,IAAIL,IAAI,CAACK,MAAM,CAAC,KAAK,CAAC;EACzD,IAAI,CAACC,GAAG,EAAE;IACN,OAAO,KAAK;EAChB;EACA;AACJ;AACA;AACA;EACI,OAAO,OAAOA,GAAG,KAAK,QAAQ,IAAIA,GAAG,CAACC,MAAM,GAAG,CAAC;AACpD,CAAC;AAACC,OAAA,CAAAV,eAAA,GAAAA,eAAA","ignoreList":[]}
1
+ {"version":3,"names":["shouldBeHandled","params","item","table","type","SK","modelId","values","key","length"],"sources":["shouldBeHandled.ts"],"sourcesContent":["import type { IStorerAfterEachPluginCanHandleParams } from \"~/resolver/plugins/StorerAfterEachPlugin.js\";\n\nexport const shouldBeHandled = (params: IStorerAfterEachPluginCanHandleParams): boolean => {\n const { item, table } = params;\n if (table.type !== \"regular\") {\n return false;\n } else if (item.SK !== \"L\") {\n return false;\n }\n // TODO use constant from fileManager\n else if (item.modelId !== \"fmFile\") {\n return false;\n } else if (!item.values) {\n return false;\n }\n\n // @ts-expect-error\n const key = item.values[\"text@key\"] || item.values[\"key\"];\n if (!key) {\n return false;\n }\n /**\n * We can check length for being more than 2 characters,\n * because we know that the key is a string.\n */\n return typeof key === \"string\" && key.length > 2;\n};\n"],"mappings":"AAEA,OAAO,MAAMA,eAAe,GAAIC,MAA6C,IAAc;EACvF,MAAM;IAAEC,IAAI;IAAEC;EAAM,CAAC,GAAGF,MAAM;EAC9B,IAAIE,KAAK,CAACC,IAAI,KAAK,SAAS,EAAE;IAC1B,OAAO,KAAK;EAChB,CAAC,MAAM,IAAIF,IAAI,CAACG,EAAE,KAAK,GAAG,EAAE;IACxB,OAAO,KAAK;EAChB;EACA;EAAA,KACK,IAAIH,IAAI,CAACI,OAAO,KAAK,QAAQ,EAAE;IAChC,OAAO,KAAK;EAChB,CAAC,MAAM,IAAI,CAACJ,IAAI,CAACK,MAAM,EAAE;IACrB,OAAO,KAAK;EAChB;;EAEA;EACA,MAAMC,GAAG,GAAGN,IAAI,CAACK,MAAM,CAAC,UAAU,CAAC,IAAIL,IAAI,CAACK,MAAM,CAAC,KAAK,CAAC;EACzD,IAAI,CAACC,GAAG,EAAE;IACN,OAAO,KAAK;EAChB;EACA;AACJ;AACA;AACA;EACI,OAAO,OAAOA,GAAG,KAAK,QAAQ,IAAIA,GAAG,CAACC,MAAM,GAAG,CAAC;AACpD,CAAC","ignoreList":[]}
@@ -1,6 +1,6 @@
1
- import type { LambdaTrigger } from "../../lambda/LambdaTrigger.js";
1
+ import type { LambdaTrigger } from "../../../resolver/lambda/LambdaTrigger.js";
2
2
  import type { S3Client, S3ClientConfig } from "@webiny/aws-sdk/client-s3/index.js";
3
- import type { IDeployment } from "../../deployment/types.js";
3
+ import type { IDeployment } from "../../../resolver/deployment/types.js";
4
4
  import type { InvokeCommandOutput } from "@webiny/aws-sdk/client-lambda/index.js";
5
5
  export interface IGetLambdaTriggerCb<T> {
6
6
  (): LambdaTrigger<T>;
@@ -1,7 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
1
+ export {};
6
2
 
7
3
  //# sourceMappingURL=types.js.map
@@ -1,5 +1,5 @@
1
- import type { ICopyUser, ICopyUserHandleParams, ICreateCognitoIdentityProviderClientCb } from "./types";
2
- import type { LambdaTrigger } from "../../lambda/LambdaTrigger.js";
1
+ import type { ICopyUser, ICopyUserHandleParams, ICreateCognitoIdentityProviderClientCb } from "./types.js";
2
+ import type { LambdaTrigger } from "../../../resolver/lambda/LambdaTrigger.js";
3
3
  import type { InvokeCommandOutput } from "@webiny/aws-sdk/client-lambda/index.js";
4
4
  import type { ICopyUserLambdaPayload } from "../../../types.js";
5
5
  export interface IGetLambdaTriggerCb {
@@ -1,11 +1,5 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.CopyUser = void 0;
7
- var _clientCognitoIdentityProvider = require("@webiny/aws-sdk/client-cognito-identity-provider");
8
- class CopyUser {
1
+ import { AdminGetUserCommand } from "@webiny/aws-sdk/client-cognito-identity-provider/index.js";
2
+ export class CopyUser {
9
3
  constructor(params) {
10
4
  this.createCognitoIdentityProviderClient = params.createCognitoIdentityProviderClient;
11
5
  this.getLambdaTrigger = params.getLambdaTrigger;
@@ -53,7 +47,7 @@ class CopyUser {
53
47
  UserPoolId: userPoolId,
54
48
  Username: username
55
49
  };
56
- const cmd = new _clientCognitoIdentityProvider.AdminGetUserCommand(input);
50
+ const cmd = new AdminGetUserCommand(input);
57
51
  try {
58
52
  const result = await provider.send(cmd);
59
53
  return result.$metadata?.httpStatusCode === 200;
@@ -62,6 +56,5 @@ class CopyUser {
62
56
  }
63
57
  }
64
58
  }
65
- exports.CopyUser = CopyUser;
66
59
 
67
60
  //# sourceMappingURL=CopyUser.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_clientCognitoIdentityProvider","require","CopyUser","constructor","params","createCognitoIdentityProviderClient","getLambdaTrigger","handle","username","target","source","exists","userExists","userPoolId","services","cognitoUserPoolId","region","invocationType","payload","action","provider","input","UserPoolId","Username","cmd","AdminGetUserCommand","result","send","$metadata","httpStatusCode","exports"],"sources":["CopyUser.ts"],"sourcesContent":["import type {\n ICopyUser,\n ICopyUserHandleParams,\n ICreateCognitoIdentityProviderClientCb\n} from \"./types\";\nimport type { LambdaTrigger } from \"~/resolver/lambda/LambdaTrigger.js\";\nimport type { InvokeCommandOutput } from \"@webiny/aws-sdk/client-lambda/index.js\";\nimport type { AdminGetUserCommandInput } from \"@webiny/aws-sdk/client-cognito-identity-provider\";\nimport { AdminGetUserCommand } from \"@webiny/aws-sdk/client-cognito-identity-provider\";\nimport type { ICopyUserLambdaPayload } from \"~/types.js\";\n\ninterface IGetUserParams {\n username: string;\n userPoolId: string;\n region: string;\n}\n\nexport interface IGetLambdaTriggerCb {\n (): LambdaTrigger<ICopyUserLambdaPayload>;\n}\n\nexport interface ICopyUserParams {\n createCognitoIdentityProviderClient: ICreateCognitoIdentityProviderClientCb;\n getLambdaTrigger: IGetLambdaTriggerCb;\n}\n\nexport class CopyUser implements ICopyUser {\n private readonly createCognitoIdentityProviderClient: ICreateCognitoIdentityProviderClientCb;\n private readonly getLambdaTrigger: IGetLambdaTriggerCb;\n\n public constructor(params: ICopyUserParams) {\n this.createCognitoIdentityProviderClient = params.createCognitoIdentityProviderClient;\n this.getLambdaTrigger = params.getLambdaTrigger;\n }\n\n public async handle(params: ICopyUserHandleParams): Promise<InvokeCommandOutput | null> {\n const { username, target, source } = params;\n\n const exists = await this.userExists({\n username,\n userPoolId: target.services.cognitoUserPoolId,\n region: target.region\n });\n\n return await this.getLambdaTrigger().handle({\n invocationType: \"Event\",\n payload: {\n /**\n * We need to be able to create or update a user, depending on whether it already exists in the target user pool.\n */\n action: exists ? \"updateUser\" : \"createUser\",\n username,\n source: {\n region: source.region,\n userPoolId: source.services.cognitoUserPoolId\n },\n target: {\n region: target.region,\n userPoolId: target.services.cognitoUserPoolId\n }\n }\n });\n }\n\n private async userExists(params: IGetUserParams): Promise<boolean> {\n const { userPoolId, username, region } = params;\n\n const provider = this.createCognitoIdentityProviderClient({\n region\n });\n\n const input: AdminGetUserCommandInput = {\n UserPoolId: userPoolId,\n Username: username\n };\n const cmd = new AdminGetUserCommand(input);\n try {\n const result = await provider.send(cmd);\n return result.$metadata?.httpStatusCode === 200;\n } catch {\n return false;\n }\n }\n}\n"],"mappings":";;;;;;AAQA,IAAAA,8BAAA,GAAAC,OAAA;AAkBO,MAAMC,QAAQ,CAAsB;EAIhCC,WAAWA,CAACC,MAAuB,EAAE;IACxC,IAAI,CAACC,mCAAmC,GAAGD,MAAM,CAACC,mCAAmC;IACrF,IAAI,CAACC,gBAAgB,GAAGF,MAAM,CAACE,gBAAgB;EACnD;EAEA,MAAaC,MAAMA,CAACH,MAA6B,EAAuC;IACpF,MAAM;MAAEI,QAAQ;MAAEC,MAAM;MAAEC;IAAO,CAAC,GAAGN,MAAM;IAE3C,MAAMO,MAAM,GAAG,MAAM,IAAI,CAACC,UAAU,CAAC;MACjCJ,QAAQ;MACRK,UAAU,EAAEJ,MAAM,CAACK,QAAQ,CAACC,iBAAiB;MAC7CC,MAAM,EAAEP,MAAM,CAACO;IACnB,CAAC,CAAC;IAEF,OAAO,MAAM,IAAI,CAACV,gBAAgB,CAAC,CAAC,CAACC,MAAM,CAAC;MACxCU,cAAc,EAAE,OAAO;MACvBC,OAAO,EAAE;QACL;AAChB;AACA;QACgBC,MAAM,EAAER,MAAM,GAAG,YAAY,GAAG,YAAY;QAC5CH,QAAQ;QACRE,MAAM,EAAE;UACJM,MAAM,EAAEN,MAAM,CAACM,MAAM;UACrBH,UAAU,EAAEH,MAAM,CAACI,QAAQ,CAACC;QAChC,CAAC;QACDN,MAAM,EAAE;UACJO,MAAM,EAAEP,MAAM,CAACO,MAAM;UACrBH,UAAU,EAAEJ,MAAM,CAACK,QAAQ,CAACC;QAChC;MACJ;IACJ,CAAC,CAAC;EACN;EAEA,MAAcH,UAAUA,CAACR,MAAsB,EAAoB;IAC/D,MAAM;MAAES,UAAU;MAAEL,QAAQ;MAAEQ;IAAO,CAAC,GAAGZ,MAAM;IAE/C,MAAMgB,QAAQ,GAAG,IAAI,CAACf,mCAAmC,CAAC;MACtDW;IACJ,CAAC,CAAC;IAEF,MAAMK,KAA+B,GAAG;MACpCC,UAAU,EAAET,UAAU;MACtBU,QAAQ,EAAEf;IACd,CAAC;IACD,MAAMgB,GAAG,GAAG,IAAIC,kDAAmB,CAACJ,KAAK,CAAC;IAC1C,IAAI;MACA,MAAMK,MAAM,GAAG,MAAMN,QAAQ,CAACO,IAAI,CAACH,GAAG,CAAC;MACvC,OAAOE,MAAM,CAACE,SAAS,EAAEC,cAAc,KAAK,GAAG;IACnD,CAAC,CAAC,MAAM;MACJ,OAAO,KAAK;IAChB;EACJ;AACJ;AAACC,OAAA,CAAA5B,QAAA,GAAAA,QAAA","ignoreList":[]}
1
+ {"version":3,"names":["AdminGetUserCommand","CopyUser","constructor","params","createCognitoIdentityProviderClient","getLambdaTrigger","handle","username","target","source","exists","userExists","userPoolId","services","cognitoUserPoolId","region","invocationType","payload","action","provider","input","UserPoolId","Username","cmd","result","send","$metadata","httpStatusCode"],"sources":["CopyUser.ts"],"sourcesContent":["import type {\n ICopyUser,\n ICopyUserHandleParams,\n ICreateCognitoIdentityProviderClientCb\n} from \"./types.js\";\nimport type { LambdaTrigger } from \"~/resolver/lambda/LambdaTrigger.js\";\nimport type { InvokeCommandOutput } from \"@webiny/aws-sdk/client-lambda/index.js\";\nimport type { AdminGetUserCommandInput } from \"@webiny/aws-sdk/client-cognito-identity-provider/index.js\";\nimport { AdminGetUserCommand } from \"@webiny/aws-sdk/client-cognito-identity-provider/index.js\";\nimport type { ICopyUserLambdaPayload } from \"~/types.js\";\n\ninterface IGetUserParams {\n username: string;\n userPoolId: string;\n region: string;\n}\n\nexport interface IGetLambdaTriggerCb {\n (): LambdaTrigger<ICopyUserLambdaPayload>;\n}\n\nexport interface ICopyUserParams {\n createCognitoIdentityProviderClient: ICreateCognitoIdentityProviderClientCb;\n getLambdaTrigger: IGetLambdaTriggerCb;\n}\n\nexport class CopyUser implements ICopyUser {\n private readonly createCognitoIdentityProviderClient: ICreateCognitoIdentityProviderClientCb;\n private readonly getLambdaTrigger: IGetLambdaTriggerCb;\n\n public constructor(params: ICopyUserParams) {\n this.createCognitoIdentityProviderClient = params.createCognitoIdentityProviderClient;\n this.getLambdaTrigger = params.getLambdaTrigger;\n }\n\n public async handle(params: ICopyUserHandleParams): Promise<InvokeCommandOutput | null> {\n const { username, target, source } = params;\n\n const exists = await this.userExists({\n username,\n userPoolId: target.services.cognitoUserPoolId,\n region: target.region\n });\n\n return await this.getLambdaTrigger().handle({\n invocationType: \"Event\",\n payload: {\n /**\n * We need to be able to create or update a user, depending on whether it already exists in the target user pool.\n */\n action: exists ? \"updateUser\" : \"createUser\",\n username,\n source: {\n region: source.region,\n userPoolId: source.services.cognitoUserPoolId\n },\n target: {\n region: target.region,\n userPoolId: target.services.cognitoUserPoolId\n }\n }\n });\n }\n\n private async userExists(params: IGetUserParams): Promise<boolean> {\n const { userPoolId, username, region } = params;\n\n const provider = this.createCognitoIdentityProviderClient({\n region\n });\n\n const input: AdminGetUserCommandInput = {\n UserPoolId: userPoolId,\n Username: username\n };\n const cmd = new AdminGetUserCommand(input);\n try {\n const result = await provider.send(cmd);\n return result.$metadata?.httpStatusCode === 200;\n } catch {\n return false;\n }\n }\n}\n"],"mappings":"AAQA,SAASA,mBAAmB,QAAQ,2DAA2D;AAkB/F,OAAO,MAAMC,QAAQ,CAAsB;EAIhCC,WAAWA,CAACC,MAAuB,EAAE;IACxC,IAAI,CAACC,mCAAmC,GAAGD,MAAM,CAACC,mCAAmC;IACrF,IAAI,CAACC,gBAAgB,GAAGF,MAAM,CAACE,gBAAgB;EACnD;EAEA,MAAaC,MAAMA,CAACH,MAA6B,EAAuC;IACpF,MAAM;MAAEI,QAAQ;MAAEC,MAAM;MAAEC;IAAO,CAAC,GAAGN,MAAM;IAE3C,MAAMO,MAAM,GAAG,MAAM,IAAI,CAACC,UAAU,CAAC;MACjCJ,QAAQ;MACRK,UAAU,EAAEJ,MAAM,CAACK,QAAQ,CAACC,iBAAiB;MAC7CC,MAAM,EAAEP,MAAM,CAACO;IACnB,CAAC,CAAC;IAEF,OAAO,MAAM,IAAI,CAACV,gBAAgB,CAAC,CAAC,CAACC,MAAM,CAAC;MACxCU,cAAc,EAAE,OAAO;MACvBC,OAAO,EAAE;QACL;AAChB;AACA;QACgBC,MAAM,EAAER,MAAM,GAAG,YAAY,GAAG,YAAY;QAC5CH,QAAQ;QACRE,MAAM,EAAE;UACJM,MAAM,EAAEN,MAAM,CAACM,MAAM;UACrBH,UAAU,EAAEH,MAAM,CAACI,QAAQ,CAACC;QAChC,CAAC;QACDN,MAAM,EAAE;UACJO,MAAM,EAAEP,MAAM,CAACO,MAAM;UACrBH,UAAU,EAAEJ,MAAM,CAACK,QAAQ,CAACC;QAChC;MACJ;IACJ,CAAC,CAAC;EACN;EAEA,MAAcH,UAAUA,CAACR,MAAsB,EAAoB;IAC/D,MAAM;MAAES,UAAU;MAAEL,QAAQ;MAAEQ;IAAO,CAAC,GAAGZ,MAAM;IAE/C,MAAMgB,QAAQ,GAAG,IAAI,CAACf,mCAAmC,CAAC;MACtDW;IACJ,CAAC,CAAC;IAEF,MAAMK,KAA+B,GAAG;MACpCC,UAAU,EAAET,UAAU;MACtBU,QAAQ,EAAEf;IACd,CAAC;IACD,MAAMgB,GAAG,GAAG,IAAIvB,mBAAmB,CAACoB,KAAK,CAAC;IAC1C,IAAI;MACA,MAAMI,MAAM,GAAG,MAAML,QAAQ,CAACM,IAAI,CAACF,GAAG,CAAC;MACvC,OAAOC,MAAM,CAACE,SAAS,EAAEC,cAAc,KAAK,GAAG;IACnD,CAAC,CAAC,MAAM;MACJ,OAAO,KAAK;IAChB;EACJ;AACJ","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import type { ICreateCognitoIdentityProviderClientCb, IDeleteUser, IDeleteUserHandleParams } from "./types";
2
- import type { LambdaTrigger } from "../../lambda/LambdaTrigger.js";
1
+ import type { ICreateCognitoIdentityProviderClientCb, IDeleteUser, IDeleteUserHandleParams } from "./types.js";
2
+ import type { LambdaTrigger } from "../../../resolver/lambda/LambdaTrigger.js";
3
3
  import type { InvokeCommandOutput } from "@webiny/aws-sdk/client-lambda/index.js";
4
4
  import type { IDeleteUserLambdaPayload } from "../../../types.js";
5
5
  export interface IGetLambdaTriggerCb {
@@ -1,11 +1,5 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.DeleteUser = void 0;
7
- var _clientCognitoIdentityProvider = require("@webiny/aws-sdk/client-cognito-identity-provider");
8
- class DeleteUser {
1
+ import { AdminGetUserCommand } from "@webiny/aws-sdk/client-cognito-identity-provider/index.js";
2
+ export class DeleteUser {
9
3
  constructor(params) {
10
4
  this.createCognitoIdentityProviderClient = params.createCognitoIdentityProviderClient;
11
5
  this.getLambdaTrigger = params.getLambdaTrigger;
@@ -51,7 +45,7 @@ class DeleteUser {
51
45
  UserPoolId: userPoolId,
52
46
  Username: username
53
47
  };
54
- const cmd = new _clientCognitoIdentityProvider.AdminGetUserCommand(input);
48
+ const cmd = new AdminGetUserCommand(input);
55
49
  try {
56
50
  const result = await provider.send(cmd);
57
51
  return result.$metadata?.httpStatusCode === 200;
@@ -60,6 +54,5 @@ class DeleteUser {
60
54
  }
61
55
  }
62
56
  }
63
- exports.DeleteUser = DeleteUser;
64
57
 
65
58
  //# sourceMappingURL=DeleteUser.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_clientCognitoIdentityProvider","require","DeleteUser","constructor","params","createCognitoIdentityProviderClient","getLambdaTrigger","handle","username","target","exists","userExists","userPoolId","services","cognitoUserPoolId","region","invocationType","payload","action","provider","input","UserPoolId","Username","cmd","AdminGetUserCommand","result","send","$metadata","httpStatusCode","exports"],"sources":["DeleteUser.ts"],"sourcesContent":["import type {\n ICreateCognitoIdentityProviderClientCb,\n IDeleteUser,\n IDeleteUserHandleParams\n} from \"./types\";\nimport type { LambdaTrigger } from \"~/resolver/lambda/LambdaTrigger.js\";\nimport type { InvokeCommandOutput } from \"@webiny/aws-sdk/client-lambda/index.js\";\nimport type { AdminGetUserCommandInput } from \"@webiny/aws-sdk/client-cognito-identity-provider\";\nimport { AdminGetUserCommand } from \"@webiny/aws-sdk/client-cognito-identity-provider\";\nimport type { IDeleteUserLambdaPayload } from \"~/types.js\";\n\ninterface IGetUserParams {\n username: string;\n userPoolId: string;\n region: string;\n}\n\nexport interface IGetLambdaTriggerCb {\n (): LambdaTrigger<IDeleteUserLambdaPayload>;\n}\n\nexport interface IDeleteUserParams {\n createCognitoIdentityProviderClient: ICreateCognitoIdentityProviderClientCb;\n getLambdaTrigger: IGetLambdaTriggerCb;\n}\n\nexport class DeleteUser implements IDeleteUser {\n private readonly createCognitoIdentityProviderClient: ICreateCognitoIdentityProviderClientCb;\n private readonly getLambdaTrigger: IGetLambdaTriggerCb;\n\n public constructor(params: IDeleteUserParams) {\n this.createCognitoIdentityProviderClient = params.createCognitoIdentityProviderClient;\n this.getLambdaTrigger = params.getLambdaTrigger;\n }\n\n public async handle(params: IDeleteUserHandleParams): Promise<InvokeCommandOutput | null> {\n const { username, target } = params;\n\n const exists = await this.userExists({\n username,\n userPoolId: target.services.cognitoUserPoolId,\n region: target.region\n });\n if (!exists) {\n return null;\n }\n\n return await this.getLambdaTrigger().handle({\n invocationType: \"Event\",\n payload: {\n /**\n * We need to be able to create or update a user, depending on whether it already exists in the target user pool.\n */\n action: \"deleteUser\",\n username,\n target: {\n region: target.region,\n userPoolId: target.services.cognitoUserPoolId\n }\n }\n });\n }\n\n private async userExists(params: IGetUserParams): Promise<boolean> {\n const { userPoolId, username, region } = params;\n\n const provider = this.createCognitoIdentityProviderClient({\n region\n });\n\n const input: AdminGetUserCommandInput = {\n UserPoolId: userPoolId,\n Username: username\n };\n const cmd = new AdminGetUserCommand(input);\n try {\n const result = await provider.send(cmd);\n return result.$metadata?.httpStatusCode === 200;\n } catch {\n return false;\n }\n }\n}\n"],"mappings":";;;;;;AAQA,IAAAA,8BAAA,GAAAC,OAAA;AAkBO,MAAMC,UAAU,CAAwB;EAIpCC,WAAWA,CAACC,MAAyB,EAAE;IAC1C,IAAI,CAACC,mCAAmC,GAAGD,MAAM,CAACC,mCAAmC;IACrF,IAAI,CAACC,gBAAgB,GAAGF,MAAM,CAACE,gBAAgB;EACnD;EAEA,MAAaC,MAAMA,CAACH,MAA+B,EAAuC;IACtF,MAAM;MAAEI,QAAQ;MAAEC;IAAO,CAAC,GAAGL,MAAM;IAEnC,MAAMM,MAAM,GAAG,MAAM,IAAI,CAACC,UAAU,CAAC;MACjCH,QAAQ;MACRI,UAAU,EAAEH,MAAM,CAACI,QAAQ,CAACC,iBAAiB;MAC7CC,MAAM,EAAEN,MAAM,CAACM;IACnB,CAAC,CAAC;IACF,IAAI,CAACL,MAAM,EAAE;MACT,OAAO,IAAI;IACf;IAEA,OAAO,MAAM,IAAI,CAACJ,gBAAgB,CAAC,CAAC,CAACC,MAAM,CAAC;MACxCS,cAAc,EAAE,OAAO;MACvBC,OAAO,EAAE;QACL;AAChB;AACA;QACgBC,MAAM,EAAE,YAAY;QACpBV,QAAQ;QACRC,MAAM,EAAE;UACJM,MAAM,EAAEN,MAAM,CAACM,MAAM;UACrBH,UAAU,EAAEH,MAAM,CAACI,QAAQ,CAACC;QAChC;MACJ;IACJ,CAAC,CAAC;EACN;EAEA,MAAcH,UAAUA,CAACP,MAAsB,EAAoB;IAC/D,MAAM;MAAEQ,UAAU;MAAEJ,QAAQ;MAAEO;IAAO,CAAC,GAAGX,MAAM;IAE/C,MAAMe,QAAQ,GAAG,IAAI,CAACd,mCAAmC,CAAC;MACtDU;IACJ,CAAC,CAAC;IAEF,MAAMK,KAA+B,GAAG;MACpCC,UAAU,EAAET,UAAU;MACtBU,QAAQ,EAAEd;IACd,CAAC;IACD,MAAMe,GAAG,GAAG,IAAIC,kDAAmB,CAACJ,KAAK,CAAC;IAC1C,IAAI;MACA,MAAMK,MAAM,GAAG,MAAMN,QAAQ,CAACO,IAAI,CAACH,GAAG,CAAC;MACvC,OAAOE,MAAM,CAACE,SAAS,EAAEC,cAAc,KAAK,GAAG;IACnD,CAAC,CAAC,MAAM;MACJ,OAAO,KAAK;IAChB;EACJ;AACJ;AAACC,OAAA,CAAA3B,UAAA,GAAAA,UAAA","ignoreList":[]}
1
+ {"version":3,"names":["AdminGetUserCommand","DeleteUser","constructor","params","createCognitoIdentityProviderClient","getLambdaTrigger","handle","username","target","exists","userExists","userPoolId","services","cognitoUserPoolId","region","invocationType","payload","action","provider","input","UserPoolId","Username","cmd","result","send","$metadata","httpStatusCode"],"sources":["DeleteUser.ts"],"sourcesContent":["import type {\n ICreateCognitoIdentityProviderClientCb,\n IDeleteUser,\n IDeleteUserHandleParams\n} from \"./types.js\";\nimport type { LambdaTrigger } from \"~/resolver/lambda/LambdaTrigger.js\";\nimport type { InvokeCommandOutput } from \"@webiny/aws-sdk/client-lambda/index.js\";\nimport type { AdminGetUserCommandInput } from \"@webiny/aws-sdk/client-cognito-identity-provider/index.js\";\nimport { AdminGetUserCommand } from \"@webiny/aws-sdk/client-cognito-identity-provider/index.js\";\nimport type { IDeleteUserLambdaPayload } from \"~/types.js\";\n\ninterface IGetUserParams {\n username: string;\n userPoolId: string;\n region: string;\n}\n\nexport interface IGetLambdaTriggerCb {\n (): LambdaTrigger<IDeleteUserLambdaPayload>;\n}\n\nexport interface IDeleteUserParams {\n createCognitoIdentityProviderClient: ICreateCognitoIdentityProviderClientCb;\n getLambdaTrigger: IGetLambdaTriggerCb;\n}\n\nexport class DeleteUser implements IDeleteUser {\n private readonly createCognitoIdentityProviderClient: ICreateCognitoIdentityProviderClientCb;\n private readonly getLambdaTrigger: IGetLambdaTriggerCb;\n\n public constructor(params: IDeleteUserParams) {\n this.createCognitoIdentityProviderClient = params.createCognitoIdentityProviderClient;\n this.getLambdaTrigger = params.getLambdaTrigger;\n }\n\n public async handle(params: IDeleteUserHandleParams): Promise<InvokeCommandOutput | null> {\n const { username, target } = params;\n\n const exists = await this.userExists({\n username,\n userPoolId: target.services.cognitoUserPoolId,\n region: target.region\n });\n if (!exists) {\n return null;\n }\n\n return await this.getLambdaTrigger().handle({\n invocationType: \"Event\",\n payload: {\n /**\n * We need to be able to create or update a user, depending on whether it already exists in the target user pool.\n */\n action: \"deleteUser\",\n username,\n target: {\n region: target.region,\n userPoolId: target.services.cognitoUserPoolId\n }\n }\n });\n }\n\n private async userExists(params: IGetUserParams): Promise<boolean> {\n const { userPoolId, username, region } = params;\n\n const provider = this.createCognitoIdentityProviderClient({\n region\n });\n\n const input: AdminGetUserCommandInput = {\n UserPoolId: userPoolId,\n Username: username\n };\n const cmd = new AdminGetUserCommand(input);\n try {\n const result = await provider.send(cmd);\n return result.$metadata?.httpStatusCode === 200;\n } catch {\n return false;\n }\n }\n}\n"],"mappings":"AAQA,SAASA,mBAAmB,QAAQ,2DAA2D;AAkB/F,OAAO,MAAMC,UAAU,CAAwB;EAIpCC,WAAWA,CAACC,MAAyB,EAAE;IAC1C,IAAI,CAACC,mCAAmC,GAAGD,MAAM,CAACC,mCAAmC;IACrF,IAAI,CAACC,gBAAgB,GAAGF,MAAM,CAACE,gBAAgB;EACnD;EAEA,MAAaC,MAAMA,CAACH,MAA+B,EAAuC;IACtF,MAAM;MAAEI,QAAQ;MAAEC;IAAO,CAAC,GAAGL,MAAM;IAEnC,MAAMM,MAAM,GAAG,MAAM,IAAI,CAACC,UAAU,CAAC;MACjCH,QAAQ;MACRI,UAAU,EAAEH,MAAM,CAACI,QAAQ,CAACC,iBAAiB;MAC7CC,MAAM,EAAEN,MAAM,CAACM;IACnB,CAAC,CAAC;IACF,IAAI,CAACL,MAAM,EAAE;MACT,OAAO,IAAI;IACf;IAEA,OAAO,MAAM,IAAI,CAACJ,gBAAgB,CAAC,CAAC,CAACC,MAAM,CAAC;MACxCS,cAAc,EAAE,OAAO;MACvBC,OAAO,EAAE;QACL;AAChB;AACA;QACgBC,MAAM,EAAE,YAAY;QACpBV,QAAQ;QACRC,MAAM,EAAE;UACJM,MAAM,EAAEN,MAAM,CAACM,MAAM;UACrBH,UAAU,EAAEH,MAAM,CAACI,QAAQ,CAACC;QAChC;MACJ;IACJ,CAAC,CAAC;EACN;EAEA,MAAcH,UAAUA,CAACP,MAAsB,EAAoB;IAC/D,MAAM;MAAEQ,UAAU;MAAEJ,QAAQ;MAAEO;IAAO,CAAC,GAAGX,MAAM;IAE/C,MAAMe,QAAQ,GAAG,IAAI,CAACd,mCAAmC,CAAC;MACtDU;IACJ,CAAC,CAAC;IAEF,MAAMK,KAA+B,GAAG;MACpCC,UAAU,EAAET,UAAU;MACtBU,QAAQ,EAAEd;IACd,CAAC;IACD,MAAMe,GAAG,GAAG,IAAItB,mBAAmB,CAACmB,KAAK,CAAC;IAC1C,IAAI;MACA,MAAMI,MAAM,GAAG,MAAML,QAAQ,CAACM,IAAI,CAACF,GAAG,CAAC;MACvC,OAAOC,MAAM,CAACE,SAAS,EAAEC,cAAc,KAAK,GAAG;IACnD,CAAC,CAAC,MAAM;MACJ,OAAO,KAAK;IAChB;EACJ;AACJ","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import type { IStorerAfterEachPluginCanHandleParams } from "../../plugins/StorerAfterEachPlugin.js";
1
+ import type { IStorerAfterEachPluginCanHandleParams } from "../../../resolver/plugins/StorerAfterEachPlugin.js";
2
2
  export declare const shouldBeHandled: (params: IStorerAfterEachPluginCanHandleParams) => boolean;
@@ -1,10 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.shouldBeHandled = void 0;
7
- const shouldBeHandled = params => {
1
+ export const shouldBeHandled = params => {
8
2
  const {
9
3
  item,
10
4
  table,
@@ -31,6 +25,5 @@ const shouldBeHandled = params => {
31
25
  }
32
26
  return true;
33
27
  };
34
- exports.shouldBeHandled = shouldBeHandled;
35
28
 
36
29
  //# sourceMappingURL=shouldBeHandled.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["shouldBeHandled","params","item","table","source","target","type","PK","includes","SK","TYPE","services","cognitoUserPoolId","data","email","exports"],"sources":["shouldBeHandled.ts"],"sourcesContent":["import type { IStorerAfterEachPluginCanHandleParams } from \"~/resolver/plugins/StorerAfterEachPlugin.js\";\n\nexport const shouldBeHandled = (params: IStorerAfterEachPluginCanHandleParams): boolean => {\n const { item, table, source, target } = params;\n if (table.type !== \"regular\") {\n return false;\n } else if (item.PK.includes(\"#ADMIN_USER#\") === false) {\n return false;\n } else if (item.SK !== \"A\") {\n return false;\n } else if (item.TYPE !== \"adminUsers.user\") {\n return false;\n } else if (!source.services.cognitoUserPoolId || !target.services.cognitoUserPoolId) {\n return false;\n }\n /**\n * TODO verify that email is always present in Cognito users.\n */\n // @ts-expect-error\n else if (!item.data?.email) {\n return false;\n }\n return true;\n};\n"],"mappings":";;;;;;AAEO,MAAMA,eAAe,GAAIC,MAA6C,IAAc;EACvF,MAAM;IAAEC,IAAI;IAAEC,KAAK;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGJ,MAAM;EAC9C,IAAIE,KAAK,CAACG,IAAI,KAAK,SAAS,EAAE;IAC1B,OAAO,KAAK;EAChB,CAAC,MAAM,IAAIJ,IAAI,CAACK,EAAE,CAACC,QAAQ,CAAC,cAAc,CAAC,KAAK,KAAK,EAAE;IACnD,OAAO,KAAK;EAChB,CAAC,MAAM,IAAIN,IAAI,CAACO,EAAE,KAAK,GAAG,EAAE;IACxB,OAAO,KAAK;EAChB,CAAC,MAAM,IAAIP,IAAI,CAACQ,IAAI,KAAK,iBAAiB,EAAE;IACxC,OAAO,KAAK;EAChB,CAAC,MAAM,IAAI,CAACN,MAAM,CAACO,QAAQ,CAACC,iBAAiB,IAAI,CAACP,MAAM,CAACM,QAAQ,CAACC,iBAAiB,EAAE;IACjF,OAAO,KAAK;EAChB;EACA;AACJ;AACA;EACI;EAAA,KACK,IAAI,CAACV,IAAI,CAACW,IAAI,EAAEC,KAAK,EAAE;IACxB,OAAO,KAAK;EAChB;EACA,OAAO,IAAI;AACf,CAAC;AAACC,OAAA,CAAAf,eAAA,GAAAA,eAAA","ignoreList":[]}
1
+ {"version":3,"names":["shouldBeHandled","params","item","table","source","target","type","PK","includes","SK","TYPE","services","cognitoUserPoolId","data","email"],"sources":["shouldBeHandled.ts"],"sourcesContent":["import type { IStorerAfterEachPluginCanHandleParams } from \"~/resolver/plugins/StorerAfterEachPlugin.js\";\n\nexport const shouldBeHandled = (params: IStorerAfterEachPluginCanHandleParams): boolean => {\n const { item, table, source, target } = params;\n if (table.type !== \"regular\") {\n return false;\n } else if (item.PK.includes(\"#ADMIN_USER#\") === false) {\n return false;\n } else if (item.SK !== \"A\") {\n return false;\n } else if (item.TYPE !== \"adminUsers.user\") {\n return false;\n } else if (!source.services.cognitoUserPoolId || !target.services.cognitoUserPoolId) {\n return false;\n }\n /**\n * TODO verify that email is always present in Cognito users.\n */\n // @ts-expect-error\n else if (!item.data?.email) {\n return false;\n }\n return true;\n};\n"],"mappings":"AAEA,OAAO,MAAMA,eAAe,GAAIC,MAA6C,IAAc;EACvF,MAAM;IAAEC,IAAI;IAAEC,KAAK;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGJ,MAAM;EAC9C,IAAIE,KAAK,CAACG,IAAI,KAAK,SAAS,EAAE;IAC1B,OAAO,KAAK;EAChB,CAAC,MAAM,IAAIJ,IAAI,CAACK,EAAE,CAACC,QAAQ,CAAC,cAAc,CAAC,KAAK,KAAK,EAAE;IACnD,OAAO,KAAK;EAChB,CAAC,MAAM,IAAIN,IAAI,CAACO,EAAE,KAAK,GAAG,EAAE;IACxB,OAAO,KAAK;EAChB,CAAC,MAAM,IAAIP,IAAI,CAACQ,IAAI,KAAK,iBAAiB,EAAE;IACxC,OAAO,KAAK;EAChB,CAAC,MAAM,IAAI,CAACN,MAAM,CAACO,QAAQ,CAACC,iBAAiB,IAAI,CAACP,MAAM,CAACM,QAAQ,CAACC,iBAAiB,EAAE;IACjF,OAAO,KAAK;EAChB;EACA;AACJ;AACA;EACI;EAAA,KACK,IAAI,CAACV,IAAI,CAACW,IAAI,EAAEC,KAAK,EAAE;IACxB,OAAO,KAAK;EAChB;EACA,OAAO,IAAI;AACf,CAAC","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import type { IDeployment } from "../../deployment/types";
1
+ import type { IDeployment } from "../../../resolver/deployment/types.js";
2
2
  import type { CognitoIdentityProviderClient, CognitoIdentityProviderClientConfig } from "@webiny/aws-sdk/client-cognito-identity-provider/index.js";
3
3
  import type { InvokeCommandOutput } from "@webiny/aws-sdk/client-lambda/index.js";
4
4
  export interface IUserDeploymentServices {
@@ -1,7 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
1
+ export {};
6
2
 
7
3
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { IDeployment } from \"~/resolver/deployment/types\";\nimport type {\n CognitoIdentityProviderClient,\n CognitoIdentityProviderClientConfig\n} from \"@webiny/aws-sdk/client-cognito-identity-provider/index.js\";\nimport type { InvokeCommandOutput } from \"@webiny/aws-sdk/client-lambda/index.js\";\n\nexport interface IUserDeploymentServices {\n cognitoUserPoolId: string;\n}\n\nexport interface ICopyUserHandleParams {\n username: string;\n source: Pick<IDeployment<IUserDeploymentServices>, \"region\" | \"services\">;\n target: Pick<IDeployment<IUserDeploymentServices>, \"region\" | \"services\">;\n}\n\nexport interface ICopyUser {\n handle(params: ICopyUserHandleParams): Promise<InvokeCommandOutput | null>;\n}\n\nexport interface IDeleteUserHandleParams {\n username: string;\n target: Pick<IDeployment<IUserDeploymentServices>, \"region\" | \"services\">;\n}\n\nexport interface IDeleteUser {\n handle(params: IDeleteUserHandleParams): Promise<InvokeCommandOutput | null>;\n}\n\nexport interface ICreateCognitoIdentityProviderClientCb {\n (config: Partial<CognitoIdentityProviderClientConfig>): Pick<\n CognitoIdentityProviderClient,\n \"send\"\n >;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { IDeployment } from \"~/resolver/deployment/types.js\";\nimport type {\n CognitoIdentityProviderClient,\n CognitoIdentityProviderClientConfig\n} from \"@webiny/aws-sdk/client-cognito-identity-provider/index.js\";\nimport type { InvokeCommandOutput } from \"@webiny/aws-sdk/client-lambda/index.js\";\n\nexport interface IUserDeploymentServices {\n cognitoUserPoolId: string;\n}\n\nexport interface ICopyUserHandleParams {\n username: string;\n source: Pick<IDeployment<IUserDeploymentServices>, \"region\" | \"services\">;\n target: Pick<IDeployment<IUserDeploymentServices>, \"region\" | \"services\">;\n}\n\nexport interface ICopyUser {\n handle(params: ICopyUserHandleParams): Promise<InvokeCommandOutput | null>;\n}\n\nexport interface IDeleteUserHandleParams {\n username: string;\n target: Pick<IDeployment<IUserDeploymentServices>, \"region\" | \"services\">;\n}\n\nexport interface IDeleteUser {\n handle(params: IDeleteUserHandleParams): Promise<InvokeCommandOutput | null>;\n}\n\nexport interface ICreateCognitoIdentityProviderClientCb {\n (\n config: Partial<CognitoIdentityProviderClientConfig>\n ): Pick<CognitoIdentityProviderClient, \"send\">;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1,14 +1,7 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createUsersPlugins = void 0;
7
- var _usersOnPut = require("./usersOnPut.js");
8
- var _usersOnDelete = require("./usersOnDelete.js");
9
- const createUsersPlugins = params => {
10
- return [(0, _usersOnPut.createUserOnPutPlugin)(params), (0, _usersOnDelete.createUserOnDeletePlugin)(params)];
1
+ import { createUserOnPutPlugin } from "./usersOnPut.js";
2
+ import { createUserOnDeletePlugin } from "./usersOnDelete.js";
3
+ export const createUsersPlugins = params => {
4
+ return [createUserOnPutPlugin(params), createUserOnDeletePlugin(params)];
11
5
  };
12
- exports.createUsersPlugins = createUsersPlugins;
13
6
 
14
7
  //# sourceMappingURL=users.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_usersOnPut","require","_usersOnDelete","createUsersPlugins","params","createUserOnPutPlugin","createUserOnDeletePlugin","exports"],"sources":["users.ts"],"sourcesContent":["import { createUserOnPutPlugin } from \"./usersOnPut.js\";\nimport { createUserOnDeletePlugin } from \"./usersOnDelete.js\";\nimport type { ICopyUser, IDeleteUser } from \"./types.js\";\n\nexport interface ICreateUsersPluginsParams {\n copyUser: ICopyUser;\n deleteUser: IDeleteUser;\n}\n\nexport const createUsersPlugins = (params: ICreateUsersPluginsParams) => {\n return [createUserOnPutPlugin(params), createUserOnDeletePlugin(params)];\n};\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAQO,MAAME,kBAAkB,GAAIC,MAAiC,IAAK;EACrE,OAAO,CAAC,IAAAC,iCAAqB,EAACD,MAAM,CAAC,EAAE,IAAAE,uCAAwB,EAACF,MAAM,CAAC,CAAC;AAC5E,CAAC;AAACG,OAAA,CAAAJ,kBAAA,GAAAA,kBAAA","ignoreList":[]}
1
+ {"version":3,"names":["createUserOnPutPlugin","createUserOnDeletePlugin","createUsersPlugins","params"],"sources":["users.ts"],"sourcesContent":["import { createUserOnPutPlugin } from \"./usersOnPut.js\";\nimport { createUserOnDeletePlugin } from \"./usersOnDelete.js\";\nimport type { ICopyUser, IDeleteUser } from \"./types.js\";\n\nexport interface ICreateUsersPluginsParams {\n copyUser: ICopyUser;\n deleteUser: IDeleteUser;\n}\n\nexport const createUsersPlugins = (params: ICreateUsersPluginsParams) => {\n return [createUserOnPutPlugin(params), createUserOnDeletePlugin(params)];\n};\n"],"mappings":"AAAA,SAASA,qBAAqB;AAC9B,SAASC,wBAAwB;AAQjC,OAAO,MAAMC,kBAAkB,GAAIC,MAAiC,IAAK;EACrE,OAAO,CAACH,qBAAqB,CAACG,MAAM,CAAC,EAAEF,wBAAwB,CAACE,MAAM,CAAC,CAAC;AAC5E,CAAC","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import type { IDeleteUser } from "./types.js";
1
+ import type { IDeleteUser } from "../../../resolver/recordTypes/users/types.js";
2
2
  export interface IDeleteUserOnDeletePluginParams {
3
3
  deleteUser: IDeleteUser;
4
4
  }
5
- export declare const createUserOnDeletePlugin: (params: IDeleteUserOnDeletePluginParams) => import("../../plugins/StorerAfterEachPlugin.js").StorerAfterEachPlugin;
5
+ export declare const createUserOnDeletePlugin: (params: IDeleteUserOnDeletePluginParams) => import("~/resolver/plugins/StorerAfterEachPlugin.js").StorerAfterEachPlugin;
@@ -1,17 +1,11 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createUserOnDeletePlugin = void 0;
7
- var _StorerAfterEachPlugin = require("../../plugins/StorerAfterEachPlugin.js");
8
- var _shouldBeHandled = require("./shouldBeHandled.js");
9
- var _utils = require("@webiny/utils");
10
- const createUserOnDeletePlugin = params => {
1
+ import { createStorerAfterEachPluginWithName } from "../../plugins/StorerAfterEachPlugin.js";
2
+ import { shouldBeHandled } from "./shouldBeHandled.js";
3
+ import { convertException } from "@webiny/utils";
4
+ export const createUserOnDeletePlugin = params => {
11
5
  const {
12
6
  deleteUser
13
7
  } = params;
14
- return (0, _StorerAfterEachPlugin.createStorerAfterEachPluginWithName)("users.onDelete", {
8
+ return createStorerAfterEachPluginWithName("users.onDelete", {
15
9
  canHandle: params => {
16
10
  const {
17
11
  command
@@ -19,7 +13,7 @@ const createUserOnDeletePlugin = params => {
19
13
  if (command !== "delete") {
20
14
  return false;
21
15
  }
22
- return (0, _shouldBeHandled.shouldBeHandled)(params);
16
+ return shouldBeHandled(params);
23
17
  },
24
18
  handle: async params => {
25
19
  const {
@@ -37,11 +31,10 @@ const createUserOnDeletePlugin = params => {
37
31
  });
38
32
  } catch (ex) {
39
33
  console.error("Error while handling users onDelete plugin.");
40
- console.log((0, _utils.convertException)(ex));
34
+ console.log(convertException(ex));
41
35
  }
42
36
  }
43
37
  });
44
38
  };
45
- exports.createUserOnDeletePlugin = createUserOnDeletePlugin;
46
39
 
47
40
  //# sourceMappingURL=usersOnDelete.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_StorerAfterEachPlugin","require","_shouldBeHandled","_utils","createUserOnDeletePlugin","params","deleteUser","createStorerAfterEachPluginWithName","canHandle","command","shouldBeHandled","handle","item","username","data","email","target","ex","console","error","log","convertException","exports"],"sources":["usersOnDelete.ts"],"sourcesContent":["import { createStorerAfterEachPluginWithName } from \"~/resolver/plugins/StorerAfterEachPlugin.js\";\nimport { shouldBeHandled } from \"./shouldBeHandled.js\";\nimport { convertException } from \"@webiny/utils\";\nimport type { IDeleteUser } from \"~/resolver/recordTypes/users/types.js\";\n\nexport interface IDeleteUserOnDeletePluginParams {\n deleteUser: IDeleteUser;\n}\n\nexport const createUserOnDeletePlugin = (params: IDeleteUserOnDeletePluginParams) => {\n const { deleteUser } = params;\n\n return createStorerAfterEachPluginWithName(\"users.onDelete\", {\n canHandle: params => {\n const { command } = params;\n if (command !== \"delete\") {\n return false;\n }\n return shouldBeHandled(params);\n },\n handle: async params => {\n const { item } = params;\n /**\n * We are 100% positive that the key exists here because canHandle would not allow for handle to be called.\n */\n // @ts-expect-error\n const username = item.data.email as string;\n try {\n await deleteUser.handle({\n target: params.target,\n username\n });\n } catch (ex) {\n console.error(\"Error while handling users onDelete plugin.\");\n console.log(convertException(ex));\n }\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAOO,MAAMG,wBAAwB,GAAIC,MAAuC,IAAK;EACjF,MAAM;IAAEC;EAAW,CAAC,GAAGD,MAAM;EAE7B,OAAO,IAAAE,0DAAmC,EAAC,gBAAgB,EAAE;IACzDC,SAAS,EAAEH,MAAM,IAAI;MACjB,MAAM;QAAEI;MAAQ,CAAC,GAAGJ,MAAM;MAC1B,IAAII,OAAO,KAAK,QAAQ,EAAE;QACtB,OAAO,KAAK;MAChB;MACA,OAAO,IAAAC,gCAAe,EAACL,MAAM,CAAC;IAClC,CAAC;IACDM,MAAM,EAAE,MAAMN,MAAM,IAAI;MACpB,MAAM;QAAEO;MAAK,CAAC,GAAGP,MAAM;MACvB;AACZ;AACA;MACY;MACA,MAAMQ,QAAQ,GAAGD,IAAI,CAACE,IAAI,CAACC,KAAe;MAC1C,IAAI;QACA,MAAMT,UAAU,CAACK,MAAM,CAAC;UACpBK,MAAM,EAAEX,MAAM,CAACW,MAAM;UACrBH;QACJ,CAAC,CAAC;MACN,CAAC,CAAC,OAAOI,EAAE,EAAE;QACTC,OAAO,CAACC,KAAK,CAAC,6CAA6C,CAAC;QAC5DD,OAAO,CAACE,GAAG,CAAC,IAAAC,uBAAgB,EAACJ,EAAE,CAAC,CAAC;MACrC;IACJ;EACJ,CAAC,CAAC;AACN,CAAC;AAACK,OAAA,CAAAlB,wBAAA,GAAAA,wBAAA","ignoreList":[]}
1
+ {"version":3,"names":["createStorerAfterEachPluginWithName","shouldBeHandled","convertException","createUserOnDeletePlugin","params","deleteUser","canHandle","command","handle","item","username","data","email","target","ex","console","error","log"],"sources":["usersOnDelete.ts"],"sourcesContent":["import { createStorerAfterEachPluginWithName } from \"~/resolver/plugins/StorerAfterEachPlugin.js\";\nimport { shouldBeHandled } from \"./shouldBeHandled.js\";\nimport { convertException } from \"@webiny/utils\";\nimport type { IDeleteUser } from \"~/resolver/recordTypes/users/types.js\";\n\nexport interface IDeleteUserOnDeletePluginParams {\n deleteUser: IDeleteUser;\n}\n\nexport const createUserOnDeletePlugin = (params: IDeleteUserOnDeletePluginParams) => {\n const { deleteUser } = params;\n\n return createStorerAfterEachPluginWithName(\"users.onDelete\", {\n canHandle: params => {\n const { command } = params;\n if (command !== \"delete\") {\n return false;\n }\n return shouldBeHandled(params);\n },\n handle: async params => {\n const { item } = params;\n /**\n * We are 100% positive that the key exists here because canHandle would not allow for handle to be called.\n */\n // @ts-expect-error\n const username = item.data.email as string;\n try {\n await deleteUser.handle({\n target: params.target,\n username\n });\n } catch (ex) {\n console.error(\"Error while handling users onDelete plugin.\");\n console.log(convertException(ex));\n }\n }\n });\n};\n"],"mappings":"AAAA,SAASA,mCAAmC;AAC5C,SAASC,eAAe;AACxB,SAASC,gBAAgB,QAAQ,eAAe;AAOhD,OAAO,MAAMC,wBAAwB,GAAIC,MAAuC,IAAK;EACjF,MAAM;IAAEC;EAAW,CAAC,GAAGD,MAAM;EAE7B,OAAOJ,mCAAmC,CAAC,gBAAgB,EAAE;IACzDM,SAAS,EAAEF,MAAM,IAAI;MACjB,MAAM;QAAEG;MAAQ,CAAC,GAAGH,MAAM;MAC1B,IAAIG,OAAO,KAAK,QAAQ,EAAE;QACtB,OAAO,KAAK;MAChB;MACA,OAAON,eAAe,CAACG,MAAM,CAAC;IAClC,CAAC;IACDI,MAAM,EAAE,MAAMJ,MAAM,IAAI;MACpB,MAAM;QAAEK;MAAK,CAAC,GAAGL,MAAM;MACvB;AACZ;AACA;MACY;MACA,MAAMM,QAAQ,GAAGD,IAAI,CAACE,IAAI,CAACC,KAAe;MAC1C,IAAI;QACA,MAAMP,UAAU,CAACG,MAAM,CAAC;UACpBK,MAAM,EAAET,MAAM,CAACS,MAAM;UACrBH;QACJ,CAAC,CAAC;MACN,CAAC,CAAC,OAAOI,EAAE,EAAE;QACTC,OAAO,CAACC,KAAK,CAAC,6CAA6C,CAAC;QAC5DD,OAAO,CAACE,GAAG,CAACf,gBAAgB,CAACY,EAAE,CAAC,CAAC;MACrC;IACJ;EACJ,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import type { ICopyUser } from "./types.js";
1
+ import type { ICopyUser } from "../../../resolver/recordTypes/users/types.js";
2
2
  export interface ICreateUserOnPutPluginParams {
3
3
  copyUser: ICopyUser;
4
4
  }
5
- export declare const createUserOnPutPlugin: (params: ICreateUserOnPutPluginParams) => import("../../plugins/StorerAfterEachPlugin.js").StorerAfterEachPlugin;
5
+ export declare const createUserOnPutPlugin: (params: ICreateUserOnPutPluginParams) => import("~/resolver/plugins/StorerAfterEachPlugin.js").StorerAfterEachPlugin;
@@ -1,17 +1,11 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createUserOnPutPlugin = void 0;
7
- var _StorerAfterEachPlugin = require("../../plugins/StorerAfterEachPlugin.js");
8
- var _shouldBeHandled = require("./shouldBeHandled.js");
9
- var _utils = require("@webiny/utils");
10
- const createUserOnPutPlugin = params => {
1
+ import { createStorerAfterEachPluginWithName } from "../../plugins/StorerAfterEachPlugin.js";
2
+ import { shouldBeHandled } from "./shouldBeHandled.js";
3
+ import { convertException } from "@webiny/utils";
4
+ export const createUserOnPutPlugin = params => {
11
5
  const {
12
6
  copyUser
13
7
  } = params;
14
- return (0, _StorerAfterEachPlugin.createStorerAfterEachPluginWithName)("users.onPut", {
8
+ return createStorerAfterEachPluginWithName("users.onPut", {
15
9
  canHandle: params => {
16
10
  const {
17
11
  command
@@ -19,7 +13,7 @@ const createUserOnPutPlugin = params => {
19
13
  if (command !== "put") {
20
14
  return false;
21
15
  }
22
- return (0, _shouldBeHandled.shouldBeHandled)(params);
16
+ return shouldBeHandled(params);
23
17
  },
24
18
  handle: async params => {
25
19
  const {
@@ -38,11 +32,10 @@ const createUserOnPutPlugin = params => {
38
32
  });
39
33
  } catch (ex) {
40
34
  console.error("Error while handling users onPut plugin.");
41
- console.log((0, _utils.convertException)(ex));
35
+ console.log(convertException(ex));
42
36
  }
43
37
  }
44
38
  });
45
39
  };
46
- exports.createUserOnPutPlugin = createUserOnPutPlugin;
47
40
 
48
41
  //# sourceMappingURL=usersOnPut.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_StorerAfterEachPlugin","require","_shouldBeHandled","_utils","createUserOnPutPlugin","params","copyUser","createStorerAfterEachPluginWithName","canHandle","command","shouldBeHandled","handle","item","username","data","email","target","source","ex","console","error","log","convertException","exports"],"sources":["usersOnPut.ts"],"sourcesContent":["import { createStorerAfterEachPluginWithName } from \"~/resolver/plugins/StorerAfterEachPlugin.js\";\nimport { shouldBeHandled } from \"./shouldBeHandled.js\";\nimport { convertException } from \"@webiny/utils\";\nimport type { ICopyUser } from \"~/resolver/recordTypes/users/types.js\";\n\nexport interface ICreateUserOnPutPluginParams {\n copyUser: ICopyUser;\n}\n\nexport const createUserOnPutPlugin = (params: ICreateUserOnPutPluginParams) => {\n const { copyUser } = params;\n\n return createStorerAfterEachPluginWithName(\"users.onPut\", {\n canHandle: params => {\n const { command } = params;\n if (command !== \"put\") {\n return false;\n }\n return shouldBeHandled(params);\n },\n handle: async params => {\n const { item } = params;\n /**\n * We are 100% positive that the key exists here because canHandle would not allow for handle to be called.\n */\n // @ts-expect-error\n const username = item.data.email as string;\n try {\n await copyUser.handle({\n target: params.target,\n source: params.source,\n username\n });\n } catch (ex) {\n console.error(\"Error while handling users onPut plugin.\");\n console.log(convertException(ex));\n }\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAOO,MAAMG,qBAAqB,GAAIC,MAAoC,IAAK;EAC3E,MAAM;IAAEC;EAAS,CAAC,GAAGD,MAAM;EAE3B,OAAO,IAAAE,0DAAmC,EAAC,aAAa,EAAE;IACtDC,SAAS,EAAEH,MAAM,IAAI;MACjB,MAAM;QAAEI;MAAQ,CAAC,GAAGJ,MAAM;MAC1B,IAAII,OAAO,KAAK,KAAK,EAAE;QACnB,OAAO,KAAK;MAChB;MACA,OAAO,IAAAC,gCAAe,EAACL,MAAM,CAAC;IAClC,CAAC;IACDM,MAAM,EAAE,MAAMN,MAAM,IAAI;MACpB,MAAM;QAAEO;MAAK,CAAC,GAAGP,MAAM;MACvB;AACZ;AACA;MACY;MACA,MAAMQ,QAAQ,GAAGD,IAAI,CAACE,IAAI,CAACC,KAAe;MAC1C,IAAI;QACA,MAAMT,QAAQ,CAACK,MAAM,CAAC;UAClBK,MAAM,EAAEX,MAAM,CAACW,MAAM;UACrBC,MAAM,EAAEZ,MAAM,CAACY,MAAM;UACrBJ;QACJ,CAAC,CAAC;MACN,CAAC,CAAC,OAAOK,EAAE,EAAE;QACTC,OAAO,CAACC,KAAK,CAAC,0CAA0C,CAAC;QACzDD,OAAO,CAACE,GAAG,CAAC,IAAAC,uBAAgB,EAACJ,EAAE,CAAC,CAAC;MACrC;IACJ;EACJ,CAAC,CAAC;AACN,CAAC;AAACK,OAAA,CAAAnB,qBAAA,GAAAA,qBAAA","ignoreList":[]}
1
+ {"version":3,"names":["createStorerAfterEachPluginWithName","shouldBeHandled","convertException","createUserOnPutPlugin","params","copyUser","canHandle","command","handle","item","username","data","email","target","source","ex","console","error","log"],"sources":["usersOnPut.ts"],"sourcesContent":["import { createStorerAfterEachPluginWithName } from \"~/resolver/plugins/StorerAfterEachPlugin.js\";\nimport { shouldBeHandled } from \"./shouldBeHandled.js\";\nimport { convertException } from \"@webiny/utils\";\nimport type { ICopyUser } from \"~/resolver/recordTypes/users/types.js\";\n\nexport interface ICreateUserOnPutPluginParams {\n copyUser: ICopyUser;\n}\n\nexport const createUserOnPutPlugin = (params: ICreateUserOnPutPluginParams) => {\n const { copyUser } = params;\n\n return createStorerAfterEachPluginWithName(\"users.onPut\", {\n canHandle: params => {\n const { command } = params;\n if (command !== \"put\") {\n return false;\n }\n return shouldBeHandled(params);\n },\n handle: async params => {\n const { item } = params;\n /**\n * We are 100% positive that the key exists here because canHandle would not allow for handle to be called.\n */\n // @ts-expect-error\n const username = item.data.email as string;\n try {\n await copyUser.handle({\n target: params.target,\n source: params.source,\n username\n });\n } catch (ex) {\n console.error(\"Error while handling users onPut plugin.\");\n console.log(convertException(ex));\n }\n }\n });\n};\n"],"mappings":"AAAA,SAASA,mCAAmC;AAC5C,SAASC,eAAe;AACxB,SAASC,gBAAgB,QAAQ,eAAe;AAOhD,OAAO,MAAMC,qBAAqB,GAAIC,MAAoC,IAAK;EAC3E,MAAM;IAAEC;EAAS,CAAC,GAAGD,MAAM;EAE3B,OAAOJ,mCAAmC,CAAC,aAAa,EAAE;IACtDM,SAAS,EAAEF,MAAM,IAAI;MACjB,MAAM;QAAEG;MAAQ,CAAC,GAAGH,MAAM;MAC1B,IAAIG,OAAO,KAAK,KAAK,EAAE;QACnB,OAAO,KAAK;MAChB;MACA,OAAON,eAAe,CAACG,MAAM,CAAC;IAClC,CAAC;IACDI,MAAM,EAAE,MAAMJ,MAAM,IAAI;MACpB,MAAM;QAAEK;MAAK,CAAC,GAAGL,MAAM;MACvB;AACZ;AACA;MACY;MACA,MAAMM,QAAQ,GAAGD,IAAI,CAACE,IAAI,CAACC,KAAe;MAC1C,IAAI;QACA,MAAMP,QAAQ,CAACG,MAAM,CAAC;UAClBK,MAAM,EAAET,MAAM,CAACS,MAAM;UACrBC,MAAM,EAAEV,MAAM,CAACU,MAAM;UACrBJ;QACJ,CAAC,CAAC;MACN,CAAC,CAAC,OAAOK,EAAE,EAAE;QACTC,OAAO,CAACC,KAAK,CAAC,0CAA0C,CAAC;QACzDD,OAAO,CAACE,GAAG,CAAChB,gBAAgB,CAACa,EAAE,CAAC,CAAC;MACrC;IACJ;EACJ,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import type { FilterOutRecordPlugin } from "./plugins/FilterOutRecordPlugin.js";
2
- import type { ICommandValueItemExtended } from "./types.js";
1
+ import type { FilterOutRecordPlugin } from "../sync/plugins/FilterOutRecordPlugin.js";
2
+ import type { ICommandValueItemExtended } from "../sync/types.js";
3
3
  export declare class FilterOutRecord {
4
4
  private readonly plugins;
5
5
  constructor(plugins: FilterOutRecordPlugin[]);
@@ -1,10 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createFilterOutRecord = exports.FilterOutRecord = void 0;
7
- class FilterOutRecord {
1
+ export class FilterOutRecord {
8
2
  constructor(plugins) {
9
3
  this.plugins = plugins;
10
4
  }
@@ -20,10 +14,8 @@ class FilterOutRecord {
20
14
  return false;
21
15
  }
22
16
  }
23
- exports.FilterOutRecord = FilterOutRecord;
24
- const createFilterOutRecord = plugins => {
17
+ export const createFilterOutRecord = plugins => {
25
18
  return new FilterOutRecord(plugins);
26
19
  };
27
- exports.createFilterOutRecord = createFilterOutRecord;
28
20
 
29
21
  //# sourceMappingURL=FilterOutRecord.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["FilterOutRecord","constructor","plugins","filterOut","item","plugin","execute","exports","createFilterOutRecord"],"sources":["FilterOutRecord.ts"],"sourcesContent":["import type { FilterOutRecordPlugin } from \"~/sync/plugins/FilterOutRecordPlugin.js\";\nimport type { ICommandValueItemExtended } from \"~/sync/types.js\";\n\nexport class FilterOutRecord {\n private readonly plugins: FilterOutRecordPlugin[];\n\n public constructor(plugins: FilterOutRecordPlugin[]) {\n this.plugins = plugins;\n }\n /**\n * If method returns `true`, the record will be filtered out.\n */\n public filterOut(item: ICommandValueItemExtended): boolean {\n for (const plugin of this.plugins) {\n if (plugin.execute(item)) {\n return true;\n }\n }\n return false;\n }\n}\n\nexport const createFilterOutRecord = (plugins: FilterOutRecordPlugin[]): FilterOutRecord => {\n return new FilterOutRecord(plugins);\n};\n"],"mappings":";;;;;;AAGO,MAAMA,eAAe,CAAC;EAGlBC,WAAWA,CAACC,OAAgC,EAAE;IACjD,IAAI,CAACA,OAAO,GAAGA,OAAO;EAC1B;EACA;AACJ;AACA;EACWC,SAASA,CAACC,IAA+B,EAAW;IACvD,KAAK,MAAMC,MAAM,IAAI,IAAI,CAACH,OAAO,EAAE;MAC/B,IAAIG,MAAM,CAACC,OAAO,CAACF,IAAI,CAAC,EAAE;QACtB,OAAO,IAAI;MACf;IACJ;IACA,OAAO,KAAK;EAChB;AACJ;AAACG,OAAA,CAAAP,eAAA,GAAAA,eAAA;AAEM,MAAMQ,qBAAqB,GAAIN,OAAgC,IAAsB;EACxF,OAAO,IAAIF,eAAe,CAACE,OAAO,CAAC;AACvC,CAAC;AAACK,OAAA,CAAAC,qBAAA,GAAAA,qBAAA","ignoreList":[]}
1
+ {"version":3,"names":["FilterOutRecord","constructor","plugins","filterOut","item","plugin","execute","createFilterOutRecord"],"sources":["FilterOutRecord.ts"],"sourcesContent":["import type { FilterOutRecordPlugin } from \"~/sync/plugins/FilterOutRecordPlugin.js\";\nimport type { ICommandValueItemExtended } from \"~/sync/types.js\";\n\nexport class FilterOutRecord {\n private readonly plugins: FilterOutRecordPlugin[];\n\n public constructor(plugins: FilterOutRecordPlugin[]) {\n this.plugins = plugins;\n }\n /**\n * If method returns `true`, the record will be filtered out.\n */\n public filterOut(item: ICommandValueItemExtended): boolean {\n for (const plugin of this.plugins) {\n if (plugin.execute(item)) {\n return true;\n }\n }\n return false;\n }\n}\n\nexport const createFilterOutRecord = (plugins: FilterOutRecordPlugin[]): FilterOutRecord => {\n return new FilterOutRecord(plugins);\n};\n"],"mappings":"AAGA,OAAO,MAAMA,eAAe,CAAC;EAGlBC,WAAWA,CAACC,OAAgC,EAAE;IACjD,IAAI,CAACA,OAAO,GAAGA,OAAO;EAC1B;EACA;AACJ;AACA;EACWC,SAASA,CAACC,IAA+B,EAAW;IACvD,KAAK,MAAMC,MAAM,IAAI,IAAI,CAACH,OAAO,EAAE;MAC/B,IAAIG,MAAM,CAACC,OAAO,CAACF,IAAI,CAAC,EAAE;QACtB,OAAO,IAAI;MACf;IACJ;IACA,OAAO,KAAK;EAChB;AACJ;AAEA,OAAO,MAAMG,qBAAqB,GAAIL,OAAgC,IAAsB;EACxF,OAAO,IAAIF,eAAe,CAACE,OAAO,CAAC;AACvC,CAAC","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import type { IHandler } from "./types.js";
1
+ import type { IHandler } from "../sync/types.js";
2
2
  import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb/index.js";
3
3
  export interface IAttachToDynamoDbDocumentParams {
4
4
  handler: IHandler;
@@ -1,12 +1,6 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.decorateClientWithHandler = exports.attachToDynamoDbDocument = void 0;
7
- var _getDocumentClient = require("@webiny/aws-sdk/client-dynamodb/getDocumentClient");
8
- var _index = require("@webiny/aws-sdk/client-dynamodb/index.js");
9
- const decorateClientWithHandler = params => {
1
+ import { decorateDocumentClient } from "@webiny/aws-sdk/client-dynamodb/getDocumentClient.js";
2
+ import { BatchWriteCommand, DeleteCommand, PutCommand, UpdateCommand } from "@webiny/aws-sdk/client-dynamodb/index.js";
3
+ export const decorateClientWithHandler = params => {
10
4
  const {
11
5
  handler,
12
6
  client
@@ -35,7 +29,7 @@ const decorateClientWithHandler = params => {
35
29
  };
36
30
  // @ts-expect-error
37
31
  client.put = async params => {
38
- const cmd = new _index.PutCommand(params);
32
+ const cmd = new PutCommand(params);
39
33
  handler.add(cmd);
40
34
  // @ts-expect-error
41
35
  return originalPut.apply(client, [params]);
@@ -43,7 +37,7 @@ const decorateClientWithHandler = params => {
43
37
 
44
38
  // @ts-expect-error
45
39
  client.delete = async params => {
46
- const cmd = new _index.DeleteCommand(params);
40
+ const cmd = new DeleteCommand(params);
47
41
  handler.add(cmd);
48
42
  // @ts-expect-error
49
43
  return originalDelete.apply(client, [params]);
@@ -51,29 +45,27 @@ const decorateClientWithHandler = params => {
51
45
 
52
46
  // @ts-expect-error
53
47
  client.batchWrite = async params => {
54
- const cmd = new _index.BatchWriteCommand(params);
48
+ const cmd = new BatchWriteCommand(params);
55
49
  handler.add(cmd);
56
50
  // @ts-expect-error
57
51
  return originalBatchWrite.apply(client, [params]);
58
52
  };
59
53
  client.update = async params => {
60
- const cmd = new _index.UpdateCommand(params);
54
+ const cmd = new UpdateCommand(params);
61
55
  handler.add(cmd);
62
56
  return originalUpdate(params);
63
57
  };
64
58
  return client;
65
59
  };
66
- exports.decorateClientWithHandler = decorateClientWithHandler;
67
- const attachToDynamoDbDocument = ({
60
+ export const attachToDynamoDbDocument = ({
68
61
  handler
69
62
  }) => {
70
- return (0, _getDocumentClient.decorateDocumentClient)(client => {
63
+ return decorateDocumentClient(client => {
71
64
  return decorateClientWithHandler({
72
65
  handler,
73
66
  client
74
67
  });
75
68
  });
76
69
  };
77
- exports.attachToDynamoDbDocument = attachToDynamoDbDocument;
78
70
 
79
71
  //# sourceMappingURL=attachToDynamoDbDocument.js.map