@webiny/api-sync-system 0.0.0-unstable.e53eceafb5
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.
- package/LICENSE +21 -0
- package/README.md +113 -0
- package/constants.d.ts +1 -0
- package/constants.js +9 -0
- package/constants.js.map +1 -0
- package/index.d.ts +3 -0
- package/index.js +40 -0
- package/index.js.map +1 -0
- package/package.json +45 -0
- package/resolver/app/RecordHandler.d.ts +34 -0
- package/resolver/app/RecordHandler.js +126 -0
- package/resolver/app/RecordHandler.js.map +1 -0
- package/resolver/app/RecordsValidation.d.ts +6 -0
- package/resolver/app/RecordsValidation.js +29 -0
- package/resolver/app/RecordsValidation.js.map +1 -0
- package/resolver/app/ResolverApplication.d.ts +14 -0
- package/resolver/app/ResolverApplication.js +48 -0
- package/resolver/app/ResolverApplication.js.map +1 -0
- package/resolver/app/abstractions/RecordHandler.d.ts +7 -0
- package/resolver/app/abstractions/RecordHandler.js +7 -0
- package/resolver/app/abstractions/RecordHandler.js.map +1 -0
- package/resolver/app/abstractions/RecordsValidation.d.ts +14 -0
- package/resolver/app/abstractions/RecordsValidation.js +7 -0
- package/resolver/app/abstractions/RecordsValidation.js.map +1 -0
- package/resolver/app/abstractions/ResolverApplication.d.ts +7 -0
- package/resolver/app/abstractions/ResolverApplication.js +7 -0
- package/resolver/app/abstractions/ResolverApplication.js.map +1 -0
- package/resolver/app/abstractions/ResolverRecord.d.ts +42 -0
- package/resolver/app/abstractions/ResolverRecord.js +7 -0
- package/resolver/app/abstractions/ResolverRecord.js.map +1 -0
- package/resolver/app/bundler/BaseBundle.d.ts +21 -0
- package/resolver/app/bundler/BaseBundle.js +26 -0
- package/resolver/app/bundler/BaseBundle.js.map +1 -0
- package/resolver/app/bundler/Bundler.d.ts +10 -0
- package/resolver/app/bundler/Bundler.js +30 -0
- package/resolver/app/bundler/Bundler.js.map +1 -0
- package/resolver/app/bundler/Bundles.d.ts +14 -0
- package/resolver/app/bundler/Bundles.js +38 -0
- package/resolver/app/bundler/Bundles.js.map +1 -0
- package/resolver/app/bundler/CommandBundle.d.ts +15 -0
- package/resolver/app/bundler/CommandBundle.js +28 -0
- package/resolver/app/bundler/CommandBundle.js.map +1 -0
- package/resolver/app/bundler/TableBundle.d.ts +13 -0
- package/resolver/app/bundler/TableBundle.js +25 -0
- package/resolver/app/bundler/TableBundle.js.map +1 -0
- package/resolver/app/bundler/types.d.ts +29 -0
- package/resolver/app/bundler/types.js +7 -0
- package/resolver/app/bundler/types.js.map +1 -0
- package/resolver/app/commandHandler/DeleteCommandHandler.d.ts +18 -0
- package/resolver/app/commandHandler/DeleteCommandHandler.js +39 -0
- package/resolver/app/commandHandler/DeleteCommandHandler.js.map +1 -0
- package/resolver/app/commandHandler/PutCommandHandler.d.ts +18 -0
- package/resolver/app/commandHandler/PutCommandHandler.js +32 -0
- package/resolver/app/commandHandler/PutCommandHandler.js.map +1 -0
- package/resolver/app/commandHandler/delete.d.ts +2 -0
- package/resolver/app/commandHandler/delete.js +24 -0
- package/resolver/app/commandHandler/delete.js.map +1 -0
- package/resolver/app/commandHandler/put.d.ts +2 -0
- package/resolver/app/commandHandler/put.js +24 -0
- package/resolver/app/commandHandler/put.js.map +1 -0
- package/resolver/app/data/SourceDataContainer.d.ts +12 -0
- package/resolver/app/data/SourceDataContainer.js +42 -0
- package/resolver/app/data/SourceDataContainer.js.map +1 -0
- package/resolver/app/data/types.d.ts +23 -0
- package/resolver/app/data/types.js +7 -0
- package/resolver/app/data/types.js.map +1 -0
- package/resolver/app/fetcher/Fetcher.d.ts +22 -0
- package/resolver/app/fetcher/Fetcher.js +132 -0
- package/resolver/app/fetcher/Fetcher.js.map +1 -0
- package/resolver/app/fetcher/types.d.ts +25 -0
- package/resolver/app/fetcher/types.js +7 -0
- package/resolver/app/fetcher/types.js.map +1 -0
- package/resolver/app/ingestor/Ingestor.d.ts +13 -0
- package/resolver/app/ingestor/Ingestor.js +44 -0
- package/resolver/app/ingestor/Ingestor.js.map +1 -0
- package/resolver/app/ingestor/IngestorResult.d.ts +7 -0
- package/resolver/app/ingestor/IngestorResult.js +45 -0
- package/resolver/app/ingestor/IngestorResult.js.map +1 -0
- package/resolver/app/ingestor/types.d.ts +26 -0
- package/resolver/app/ingestor/types.js +7 -0
- package/resolver/app/ingestor/types.js.map +1 -0
- package/resolver/app/storer/Storer.d.ts +44 -0
- package/resolver/app/storer/Storer.js +103 -0
- package/resolver/app/storer/Storer.js.map +1 -0
- package/resolver/app/storer/types.d.ts +21 -0
- package/resolver/app/storer/types.js +7 -0
- package/resolver/app/storer/types.js.map +1 -0
- package/resolver/app/transform/TransformHandler.d.ts +34 -0
- package/resolver/app/transform/TransformHandler.js +70 -0
- package/resolver/app/transform/TransformHandler.js.map +1 -0
- package/resolver/app/transform/middleware.d.ts +3 -0
- package/resolver/app/transform/middleware.js +29 -0
- package/resolver/app/transform/middleware.js.map +1 -0
- package/resolver/app/utils/Retry.d.ts +18 -0
- package/resolver/app/utils/Retry.js +38 -0
- package/resolver/app/utils/Retry.js.map +1 -0
- package/resolver/app/utils/sleep.d.ts +1 -0
- package/resolver/app/utils/sleep.js +14 -0
- package/resolver/app/utils/sleep.js.map +1 -0
- package/resolver/app/validation/body.d.ts +142 -0
- package/resolver/app/validation/body.js +46 -0
- package/resolver/app/validation/body.js.map +1 -0
- package/resolver/app/validation/createJsonTransform.d.ts +2 -0
- package/resolver/app/validation/createJsonTransform.js +24 -0
- package/resolver/app/validation/createJsonTransform.js.map +1 -0
- package/resolver/app/validation/detail.d.ts +89 -0
- package/resolver/app/validation/detail.js +50 -0
- package/resolver/app/validation/detail.js.map +1 -0
- package/resolver/app/validation/event.d.ts +217 -0
- package/resolver/app/validation/event.js +32 -0
- package/resolver/app/validation/event.js.map +1 -0
- package/resolver/app/validation/numericString.d.ts +2 -0
- package/resolver/app/validation/numericString.js +23 -0
- package/resolver/app/validation/numericString.js.map +1 -0
- package/resolver/app/validation/system.d.ts +20 -0
- package/resolver/app/validation/system.js +20 -0
- package/resolver/app/validation/system.js.map +1 -0
- package/resolver/createEventHandlerPlugin.d.ts +10 -0
- package/resolver/createEventHandlerPlugin.js +127 -0
- package/resolver/createEventHandlerPlugin.js.map +1 -0
- package/resolver/createResolverHandler.d.ts +21 -0
- package/resolver/createResolverHandler.js +79 -0
- package/resolver/createResolverHandler.js.map +1 -0
- package/resolver/deployment/Deployment.d.ts +17 -0
- package/resolver/deployment/Deployment.js +50 -0
- package/resolver/deployment/Deployment.js.map +1 -0
- package/resolver/deployment/Deployments.d.ts +13 -0
- package/resolver/deployment/Deployments.js +34 -0
- package/resolver/deployment/Deployments.js.map +1 -0
- package/resolver/deployment/DeploymentsFetcher.d.ts +16 -0
- package/resolver/deployment/DeploymentsFetcher.js +112 -0
- package/resolver/deployment/DeploymentsFetcher.js.map +1 -0
- package/resolver/deployment/types.d.ts +34 -0
- package/resolver/deployment/types.js +7 -0
- package/resolver/deployment/types.js.map +1 -0
- package/resolver/lambda/LambdaTrigger.d.ts +18 -0
- package/resolver/lambda/LambdaTrigger.js +39 -0
- package/resolver/lambda/LambdaTrigger.js.map +1 -0
- package/resolver/plugins/CommandHandlerPlugin.d.ts +31 -0
- package/resolver/plugins/CommandHandlerPlugin.js +27 -0
- package/resolver/plugins/CommandHandlerPlugin.js.map +1 -0
- package/resolver/plugins/StorerAfterEachPlugin.d.ts +31 -0
- package/resolver/plugins/StorerAfterEachPlugin.js +33 -0
- package/resolver/plugins/StorerAfterEachPlugin.js.map +1 -0
- package/resolver/plugins/TransformRecordPlugin.d.ts +38 -0
- package/resolver/plugins/TransformRecordPlugin.js +30 -0
- package/resolver/plugins/TransformRecordPlugin.js.map +1 -0
- package/resolver/recordTypes/fileManager/CopyFile.d.ts +14 -0
- package/resolver/recordTypes/fileManager/CopyFile.js +81 -0
- package/resolver/recordTypes/fileManager/CopyFile.js.map +1 -0
- package/resolver/recordTypes/fileManager/DeleteFile.d.ts +14 -0
- package/resolver/recordTypes/fileManager/DeleteFile.js +72 -0
- package/resolver/recordTypes/fileManager/DeleteFile.js.map +1 -0
- package/resolver/recordTypes/fileManager/fileManager.d.ts +6 -0
- package/resolver/recordTypes/fileManager/fileManager.js +14 -0
- package/resolver/recordTypes/fileManager/fileManager.js.map +1 -0
- package/resolver/recordTypes/fileManager/fileManagerOnDelete.d.ts +5 -0
- package/resolver/recordTypes/fileManager/fileManagerOnDelete.js +48 -0
- package/resolver/recordTypes/fileManager/fileManagerOnDelete.js.map +1 -0
- package/resolver/recordTypes/fileManager/fileManagerOnPut.d.ts +5 -0
- package/resolver/recordTypes/fileManager/fileManagerOnPut.js +48 -0
- package/resolver/recordTypes/fileManager/fileManagerOnPut.js.map +1 -0
- package/resolver/recordTypes/fileManager/shouldBeHandled.d.ts +2 -0
- package/resolver/recordTypes/fileManager/shouldBeHandled.js +37 -0
- package/resolver/recordTypes/fileManager/shouldBeHandled.js.map +1 -0
- package/resolver/recordTypes/fileManager/types.d.ts +26 -0
- package/resolver/recordTypes/fileManager/types.js +7 -0
- package/resolver/recordTypes/fileManager/types.js.map +1 -0
- package/resolver/recordTypes/users/CopyUser.d.ts +18 -0
- package/resolver/recordTypes/users/CopyUser.js +67 -0
- package/resolver/recordTypes/users/CopyUser.js.map +1 -0
- package/resolver/recordTypes/users/DeleteUser.d.ts +18 -0
- package/resolver/recordTypes/users/DeleteUser.js +65 -0
- package/resolver/recordTypes/users/DeleteUser.js.map +1 -0
- package/resolver/recordTypes/users/shouldBeHandled.d.ts +2 -0
- package/resolver/recordTypes/users/shouldBeHandled.js +36 -0
- package/resolver/recordTypes/users/shouldBeHandled.js.map +1 -0
- package/resolver/recordTypes/users/types.d.ts +24 -0
- package/resolver/recordTypes/users/types.js +7 -0
- package/resolver/recordTypes/users/types.js.map +1 -0
- package/resolver/recordTypes/users/users.d.ts +6 -0
- package/resolver/recordTypes/users/users.js +14 -0
- package/resolver/recordTypes/users/users.js.map +1 -0
- package/resolver/recordTypes/users/usersOnDelete.d.ts +5 -0
- package/resolver/recordTypes/users/usersOnDelete.js +47 -0
- package/resolver/recordTypes/users/usersOnDelete.js.map +1 -0
- package/resolver/recordTypes/users/usersOnPut.d.ts +5 -0
- package/resolver/recordTypes/users/usersOnPut.js +48 -0
- package/resolver/recordTypes/users/usersOnPut.js.map +1 -0
- package/sync/FilterOutRecord.d.ts +11 -0
- package/sync/FilterOutRecord.js +29 -0
- package/sync/FilterOutRecord.js.map +1 -0
- package/sync/attachToDynamoDbDocument.d.ts +11 -0
- package/sync/attachToDynamoDbDocument.js +79 -0
- package/sync/attachToDynamoDbDocument.js.map +1 -0
- package/sync/createHandler.d.ts +14 -0
- package/sync/createHandler.js +63 -0
- package/sync/createHandler.js.map +1 -0
- package/sync/createSendDataToEventBridgeOnRequestEnd.d.ts +2 -0
- package/sync/createSendDataToEventBridgeOnRequestEnd.js +51 -0
- package/sync/createSendDataToEventBridgeOnRequestEnd.js.map +1 -0
- package/sync/createSyncSystem.d.ts +16 -0
- package/sync/createSyncSystem.js +42 -0
- package/sync/createSyncSystem.js.map +1 -0
- package/sync/filter/createDefaultFilterOutRecordPlugins.d.ts +13 -0
- package/sync/filter/createDefaultFilterOutRecordPlugins.js +88 -0
- package/sync/filter/createDefaultFilterOutRecordPlugins.js.map +1 -0
- package/sync/handler/Handler.d.ts +28 -0
- package/sync/handler/Handler.js +93 -0
- package/sync/handler/Handler.js.map +1 -0
- package/sync/handler/HandlerConverter.d.ts +12 -0
- package/sync/handler/HandlerConverter.js +43 -0
- package/sync/handler/HandlerConverter.js.map +1 -0
- package/sync/handler/converter/BatchGetCommandConverter.d.ts +8 -0
- package/sync/handler/converter/BatchGetCommandConverter.js +24 -0
- package/sync/handler/converter/BatchGetCommandConverter.js.map +1 -0
- package/sync/handler/converter/BatchWriteCommandConverter.d.ts +9 -0
- package/sync/handler/converter/BatchWriteCommandConverter.js +24 -0
- package/sync/handler/converter/BatchWriteCommandConverter.js.map +1 -0
- package/sync/handler/converter/DeleteCommandConverter.d.ts +9 -0
- package/sync/handler/converter/DeleteCommandConverter.js +24 -0
- package/sync/handler/converter/DeleteCommandConverter.js.map +1 -0
- package/sync/handler/converter/GetCommandConverter.d.ts +8 -0
- package/sync/handler/converter/GetCommandConverter.js +24 -0
- package/sync/handler/converter/GetCommandConverter.js.map +1 -0
- package/sync/handler/converter/PutCommandConverter.d.ts +9 -0
- package/sync/handler/converter/PutCommandConverter.js +24 -0
- package/sync/handler/converter/PutCommandConverter.js.map +1 -0
- package/sync/handler/converter/QueryCommandConverter.d.ts +8 -0
- package/sync/handler/converter/QueryCommandConverter.js +24 -0
- package/sync/handler/converter/QueryCommandConverter.js.map +1 -0
- package/sync/handler/converter/ScanCommandConverter.d.ts +8 -0
- package/sync/handler/converter/ScanCommandConverter.js +24 -0
- package/sync/handler/converter/ScanCommandConverter.js.map +1 -0
- package/sync/handler/converter/UpdateCommandConverter.d.ts +9 -0
- package/sync/handler/converter/UpdateCommandConverter.js +24 -0
- package/sync/handler/converter/UpdateCommandConverter.js.map +1 -0
- package/sync/handler/converter/commands/BatchWriteCommandValue.d.ts +9 -0
- package/sync/handler/converter/commands/BatchWriteCommandValue.js +51 -0
- package/sync/handler/converter/commands/BatchWriteCommandValue.js.map +1 -0
- package/sync/handler/converter/commands/DeleteCommandValue.d.ts +9 -0
- package/sync/handler/converter/commands/DeleteCommandValue.js +27 -0
- package/sync/handler/converter/commands/DeleteCommandValue.js.map +1 -0
- package/sync/handler/converter/commands/NullCommandValue.d.ts +8 -0
- package/sync/handler/converter/commands/NullCommandValue.js +18 -0
- package/sync/handler/converter/commands/NullCommandValue.js.map +1 -0
- package/sync/handler/converter/commands/PutCommandValue.d.ts +9 -0
- package/sync/handler/converter/commands/PutCommandValue.js +27 -0
- package/sync/handler/converter/commands/PutCommandValue.js.map +1 -0
- package/sync/handler/converter/commands/UpdateCommandValue.d.ts +9 -0
- package/sync/handler/converter/commands/UpdateCommandValue.js +27 -0
- package/sync/handler/converter/commands/UpdateCommandValue.js.map +1 -0
- package/sync/handler/types.d.ts +18 -0
- package/sync/handler/types.js +7 -0
- package/sync/handler/types.js.map +1 -0
- package/sync/plugins/FilterOutRecordPlugin.d.ts +23 -0
- package/sync/plugins/FilterOutRecordPlugin.js +31 -0
- package/sync/plugins/FilterOutRecordPlugin.js.map +1 -0
- package/sync/requestPlugin.d.ts +9 -0
- package/sync/requestPlugin.js +59 -0
- package/sync/requestPlugin.js.map +1 -0
- package/sync/types.d.ts +64 -0
- package/sync/types.js +7 -0
- package/sync/types.js.map +1 -0
- package/sync/utils/getTableType.d.ts +2 -0
- package/sync/utils/getTableType.js +22 -0
- package/sync/utils/getTableType.js.map +1 -0
- package/sync/utils/manifest.d.ts +17 -0
- package/sync/utils/manifest.js +52 -0
- package/sync/utils/manifest.js.map +1 -0
- package/sync/utils/validateSystemInput.d.ts +11 -0
- package/sync/utils/validateSystemInput.js +44 -0
- package/sync/utils/validateSystemInput.js.map +1 -0
- package/types.d.ts +42 -0
- package/types.js +15 -0
- package/types.js.map +1 -0
- package/utils/createSystemName.d.ts +5 -0
- package/utils/createSystemName.js +12 -0
- package/utils/createSystemName.js.map +1 -0
- package/worker/actions/copyFile/CopyFile.d.ts +63 -0
- package/worker/actions/copyFile/CopyFile.js +283 -0
- package/worker/actions/copyFile/CopyFile.js.map +1 -0
- package/worker/actions/copyFile/copyFileAction.d.ts +6 -0
- package/worker/actions/copyFile/copyFileAction.js +47 -0
- package/worker/actions/copyFile/copyFileAction.js.map +1 -0
- package/worker/actions/copyFile/copyFileSchema.d.ts +47 -0
- package/worker/actions/copyFile/copyFileSchema.js +25 -0
- package/worker/actions/copyFile/copyFileSchema.js.map +1 -0
- package/worker/actions/copyFile/types.d.ts +10 -0
- package/worker/actions/copyFile/types.js +7 -0
- package/worker/actions/copyFile/types.js.map +1 -0
- package/worker/actions/createUser/CreateUser.d.ts +17 -0
- package/worker/actions/createUser/CreateUser.js +90 -0
- package/worker/actions/createUser/CreateUser.js.map +1 -0
- package/worker/actions/createUser/createUserAction.d.ts +6 -0
- package/worker/actions/createUser/createUserAction.js +42 -0
- package/worker/actions/createUser/createUserAction.js.map +1 -0
- package/worker/actions/createUser/createUserSchema.d.ts +47 -0
- package/worker/actions/createUser/createUserSchema.js +25 -0
- package/worker/actions/createUser/createUserSchema.js.map +1 -0
- package/worker/actions/createUser/types.d.ts +10 -0
- package/worker/actions/createUser/types.js +7 -0
- package/worker/actions/createUser/types.js.map +1 -0
- package/worker/actions/deleteFile/DeleteFile.d.ts +24 -0
- package/worker/actions/deleteFile/DeleteFile.js +82 -0
- package/worker/actions/deleteFile/DeleteFile.js.map +1 -0
- package/worker/actions/deleteFile/deleteFileAction.d.ts +6 -0
- package/worker/actions/deleteFile/deleteFileAction.js +42 -0
- package/worker/actions/deleteFile/deleteFileAction.js.map +1 -0
- package/worker/actions/deleteFile/deleteFileSchema.d.ts +47 -0
- package/worker/actions/deleteFile/deleteFileSchema.js +25 -0
- package/worker/actions/deleteFile/deleteFileSchema.js.map +1 -0
- package/worker/actions/deleteFile/types.d.ts +9 -0
- package/worker/actions/deleteFile/types.js +7 -0
- package/worker/actions/deleteFile/types.js.map +1 -0
- package/worker/actions/deleteUser/DeleteUser.d.ts +16 -0
- package/worker/actions/deleteUser/DeleteUser.js +67 -0
- package/worker/actions/deleteUser/DeleteUser.js.map +1 -0
- package/worker/actions/deleteUser/deleteUserAction.d.ts +6 -0
- package/worker/actions/deleteUser/deleteUserAction.js +40 -0
- package/worker/actions/deleteUser/deleteUserAction.js.map +1 -0
- package/worker/actions/deleteUser/deleteUserSchema.d.ts +29 -0
- package/worker/actions/deleteUser/deleteUserSchema.js +24 -0
- package/worker/actions/deleteUser/deleteUserSchema.js.map +1 -0
- package/worker/actions/deleteUser/types.d.ts +9 -0
- package/worker/actions/deleteUser/types.js +7 -0
- package/worker/actions/deleteUser/types.js.map +1 -0
- package/worker/actions/logValidationError.d.ts +2 -0
- package/worker/actions/logValidationError.js +17 -0
- package/worker/actions/logValidationError.js.map +1 -0
- package/worker/actions/removeCognitoUserAttributes.d.ts +6 -0
- package/worker/actions/removeCognitoUserAttributes.js +24 -0
- package/worker/actions/removeCognitoUserAttributes.js.map +1 -0
- package/worker/actions/updateUser/UpdateUser.d.ts +17 -0
- package/worker/actions/updateUser/UpdateUser.js +81 -0
- package/worker/actions/updateUser/UpdateUser.js.map +1 -0
- package/worker/actions/updateUser/types.d.ts +10 -0
- package/worker/actions/updateUser/types.js +7 -0
- package/worker/actions/updateUser/types.js.map +1 -0
- package/worker/actions/updateUser/updateUserAction.d.ts +6 -0
- package/worker/actions/updateUser/updateUserAction.js +42 -0
- package/worker/actions/updateUser/updateUserAction.js.map +1 -0
- package/worker/actions/updateUser/updateUserSchema.d.ts +47 -0
- package/worker/actions/updateUser/updateUserSchema.js +25 -0
- package/worker/actions/updateUser/updateUserSchema.js.map +1 -0
- package/worker/createWorkerHandler.d.ts +11 -0
- package/worker/createWorkerHandler.js +48 -0
- package/worker/createWorkerHandler.js.map +1 -0
- package/worker/handler/WorkerActionHandler.d.ts +10 -0
- package/worker/handler/WorkerActionHandler.js +33 -0
- package/worker/handler/WorkerActionHandler.js.map +1 -0
- package/worker/handler/eventHandler.d.ts +1 -0
- package/worker/handler/eventHandler.js +31 -0
- package/worker/handler/eventHandler.js.map +1 -0
- package/worker/plugins/WorkerActionPlugin.d.ts +10 -0
- package/worker/plugins/WorkerActionPlugin.js +28 -0
- package/worker/plugins/WorkerActionPlugin.js.map +1 -0
- package/worker/types.d.ts +14 -0
- package/worker/types.js +7 -0
- package/worker/types.js.map +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Webiny
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# @webiny/api-sync-system
|
|
2
|
+
[](https://www.npmjs.com/package/@webiny/api-sync-system)
|
|
3
|
+
[](https://www.npmjs.com/package/@webiny/api-sync-system)
|
|
4
|
+
[](https://github.com/prettier/prettier)
|
|
5
|
+
[](http://makeapullrequest.com)
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
```
|
|
9
|
+
yarn add @webiny/api-sync-system
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## How To Use?
|
|
13
|
+
|
|
14
|
+
### Information About `env` and `variant` Parameters
|
|
15
|
+
We will use `dev` environment in the examples.
|
|
16
|
+
|
|
17
|
+
Variants can be anything you like, for our example we use `blue` and `green`, but you can use `orange`, `black`, `car`,
|
|
18
|
+
`horse`, `space`, etc.
|
|
19
|
+
|
|
20
|
+
### Deploy the Sync System
|
|
21
|
+
|
|
22
|
+
Deploy the Sync System to the `dev` environment.
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
yarn webiny deploy sync --env=dev
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Deploy `blue` and `green` Webiny
|
|
29
|
+
|
|
30
|
+
It imperative the two systems to be in the same environment as the Sync System, as it will automatically connect Webiny deployments in the same environment.
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
yarn webiny deploy --env=dev --variant=blue && yarn webiny deploy --env=dev --variant=green
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Also, there can be more than two systems, so you can deploy as many as you like, just make sure to use different variants.
|
|
37
|
+
|
|
38
|
+
### Install Webiny Blue Variant
|
|
39
|
+
|
|
40
|
+
Do a:
|
|
41
|
+
```
|
|
42
|
+
yarn webiny info
|
|
43
|
+
```
|
|
44
|
+
Find the `blue` variant Admin URL, and open it in your browser. Install the system by following the instructions.
|
|
45
|
+
|
|
46
|
+
At that point, green system should be installed as well.
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# TODO
|
|
50
|
+
|
|
51
|
+
### Add BlueGreen, Resolver and Work Folders to User Projects
|
|
52
|
+
We need to deploy the following folders to the user project:
|
|
53
|
+
- blueGreen
|
|
54
|
+
- sync/resolver
|
|
55
|
+
- sync/worker
|
|
56
|
+
|
|
57
|
+
Maybe have it as a CLI command?
|
|
58
|
+
|
|
59
|
+
### Test the Blue / Green Deployment
|
|
60
|
+
|
|
61
|
+
- create domains api.bg.webiny.com, admin.bg.webiny.com, website.bg.webiny.com, preview.bg.webiny.com
|
|
62
|
+
- deploy the blueGreen application
|
|
63
|
+
- make sure the domains are pointing correctly
|
|
64
|
+
- switch between blue and green deployments to test the resolver
|
|
65
|
+
- create / update entries in blue and green and make sure they are correctly transferred to the other deployment
|
|
66
|
+
|
|
67
|
+
### Cognito User Transfer
|
|
68
|
+
|
|
69
|
+
User is currently transferred but password is not so it results in error where user cannot log in and cannot reset
|
|
70
|
+
password.
|
|
71
|
+
This will be resolved by implementing a login function which will send a code to the user email and log in with that
|
|
72
|
+
code.
|
|
73
|
+
|
|
74
|
+
### Filtering out models which we do not want to sync
|
|
75
|
+
|
|
76
|
+
Currently, models are filtered out when records are being added into the sync pool. That is ok for creating or updating
|
|
77
|
+
records, but when deleting, we do not have the modelId in the item being deleted.
|
|
78
|
+
|
|
79
|
+
Maybe implement filtering in the resolver ?
|
|
80
|
+
|
|
81
|
+
### Add proper logging?
|
|
82
|
+
Use pino to log all events, separated in proper levels (info, warn, error, debug, etc...).
|
|
83
|
+
|
|
84
|
+
### Move Resolver plugins (file manager, users) into their own packages
|
|
85
|
+
We should move the resolver plugins for file manager and users into their own packages, and those packages should register them.
|
|
86
|
+
|
|
87
|
+
### Implement Dependency Injection
|
|
88
|
+
|
|
89
|
+
Currently, we need to pass a ton of methods to the Sync system handlers. It would be simple as
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
const handler = createSyncResolverHandler({
|
|
93
|
+
plugins: [],
|
|
94
|
+
debug: process.env.DEBUG === "true",
|
|
95
|
+
awsWorkerLambdaArn: process.env.AWS_SYNC_WORKER_LAMBDA_ARN,
|
|
96
|
+
});
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
if we did not need to pass all creator methods:
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
const handler = createSyncResolverHandler({
|
|
103
|
+
plugins: [],
|
|
104
|
+
debug: process.env.DEBUG === "true",
|
|
105
|
+
awsWorkerLambdaArn: process.env.AWS_SYNC_WORKER_LAMBDA_ARN,
|
|
106
|
+
createS3Client,
|
|
107
|
+
createLambdaClient,
|
|
108
|
+
createDocumentClient,
|
|
109
|
+
createCognitoIdentityProviderClient
|
|
110
|
+
});
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
And there might be new methods added in the future.
|
package/constants.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SQS_EVENT_NAME: "synchronization-input";
|
package/constants.js
ADDED
package/constants.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SQS_EVENT_NAME","exports"],"sources":["constants.ts"],"sourcesContent":["export const SQS_EVENT_NAME = \"synchronization-input\" as const;\n"],"mappings":";;;;;;AAAO,MAAMA,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG,uBAAgC","ignoreList":[]}
|
package/index.d.ts
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _createWorkerHandler = require("./worker/createWorkerHandler.js");
|
|
7
|
+
Object.keys(_createWorkerHandler).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _createWorkerHandler[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _createWorkerHandler[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _createSyncSystem = require("./sync/createSyncSystem.js");
|
|
18
|
+
Object.keys(_createSyncSystem).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _createSyncSystem[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _createSyncSystem[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _createResolverHandler = require("./resolver/createResolverHandler.js");
|
|
29
|
+
Object.keys(_createResolverHandler).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _createResolverHandler[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _createResolverHandler[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_createWorkerHandler","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_createSyncSystem","_createResolverHandler"],"sources":["index.ts"],"sourcesContent":["export * from \"./worker/createWorkerHandler.js\";\nexport * from \"./sync/createSyncSystem.js\";\nexport * from \"./resolver/createResolverHandler.js\";\n"],"mappings":";;;;;AAAA,IAAAA,oBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,oBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,oBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,oBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,iBAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,iBAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,iBAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,iBAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,sBAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,sBAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,sBAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,sBAAA,CAAAN,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@webiny/api-sync-system",
|
|
3
|
+
"version": "0.0.0-unstable.e53eceafb5",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/webiny/webiny-js.git"
|
|
8
|
+
},
|
|
9
|
+
"description": "Sync System.",
|
|
10
|
+
"author": "Webiny LTD",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@webiny/api": "0.0.0-unstable.e53eceafb5",
|
|
14
|
+
"@webiny/aws-sdk": "0.0.0-unstable.e53eceafb5",
|
|
15
|
+
"@webiny/error": "0.0.0-unstable.e53eceafb5",
|
|
16
|
+
"@webiny/handler": "0.0.0-unstable.e53eceafb5",
|
|
17
|
+
"@webiny/handler-aws": "0.0.0-unstable.e53eceafb5",
|
|
18
|
+
"@webiny/plugins": "0.0.0-unstable.e53eceafb5",
|
|
19
|
+
"@webiny/utils": "0.0.0-unstable.e53eceafb5",
|
|
20
|
+
"bytes": "3.1.2",
|
|
21
|
+
"lodash": "4.17.21",
|
|
22
|
+
"semver": "7.6.3",
|
|
23
|
+
"zod": "3.23.8"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@faker-js/faker": "9.3.0",
|
|
27
|
+
"@types/lodash": "4.17.13",
|
|
28
|
+
"@webiny/cli": "0.0.0-unstable.e53eceafb5",
|
|
29
|
+
"@webiny/project-utils": "0.0.0-unstable.e53eceafb5",
|
|
30
|
+
"aws-sdk-client-mock": "4.1.0",
|
|
31
|
+
"jest": "29.7.0",
|
|
32
|
+
"jest-dynalite": "3.6.1",
|
|
33
|
+
"rimraf": "6.0.1",
|
|
34
|
+
"typescript": "5.3.3"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public",
|
|
38
|
+
"directory": "dist"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "node ../cli/bin.js run build",
|
|
42
|
+
"watch": "node ../cli/bin.js run watch"
|
|
43
|
+
},
|
|
44
|
+
"gitHead": "e53eceafb5ce1a3872c9b4548939bb2eae5b1aef"
|
|
45
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { IRecordHandler, IRecordHandlerHandleParams } from "./abstractions/RecordHandler.js";
|
|
2
|
+
import type { PluginsContainer } from "@webiny/plugins";
|
|
3
|
+
import type { IFetcher } from "./fetcher/types.js";
|
|
4
|
+
import type { IStorer } from "./storer/types.js";
|
|
5
|
+
import type { IBundler } from "./bundler/types.js";
|
|
6
|
+
import type { IDeployments } from "../deployment/types.js";
|
|
7
|
+
import type { ITransformHandler } from "./transform/TransformHandler.js";
|
|
8
|
+
import type { ISourceDataContainer } from "./data/types.js";
|
|
9
|
+
export interface IRecordHandlerParams {
|
|
10
|
+
fetcher: IFetcher;
|
|
11
|
+
storer: IStorer;
|
|
12
|
+
plugins: PluginsContainer;
|
|
13
|
+
commandBundler: IBundler;
|
|
14
|
+
tableBundler: IBundler;
|
|
15
|
+
deployments: IDeployments;
|
|
16
|
+
transformHandler: ITransformHandler;
|
|
17
|
+
createSourceDataContainer: () => ISourceDataContainer;
|
|
18
|
+
}
|
|
19
|
+
export declare class RecordHandler implements IRecordHandler {
|
|
20
|
+
private readonly plugins;
|
|
21
|
+
private readonly commandHandlerPlugins;
|
|
22
|
+
private readonly fetcher;
|
|
23
|
+
private readonly storer;
|
|
24
|
+
private readonly commandBundler;
|
|
25
|
+
private readonly tableBundler;
|
|
26
|
+
private readonly deployments;
|
|
27
|
+
private readonly transformHandler;
|
|
28
|
+
private readonly createSourceDataContainer;
|
|
29
|
+
constructor(params: IRecordHandlerParams);
|
|
30
|
+
handle(params: IRecordHandlerHandleParams): Promise<void>;
|
|
31
|
+
private findTargetTable;
|
|
32
|
+
private getCommandHandler;
|
|
33
|
+
}
|
|
34
|
+
export declare const createRecordHandler: (params: IRecordHandlerParams) => IRecordHandler;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createRecordHandler = exports.RecordHandler = void 0;
|
|
7
|
+
var _CommandHandlerPlugin = require("../plugins/CommandHandlerPlugin.js");
|
|
8
|
+
var _utils = require("@webiny/utils");
|
|
9
|
+
class RecordHandler {
|
|
10
|
+
constructor(params) {
|
|
11
|
+
this.plugins = params.plugins;
|
|
12
|
+
this.fetcher = params.fetcher;
|
|
13
|
+
this.storer = params.storer;
|
|
14
|
+
this.commandBundler = params.commandBundler;
|
|
15
|
+
this.tableBundler = params.tableBundler;
|
|
16
|
+
this.deployments = params.deployments;
|
|
17
|
+
this.transformHandler = params.transformHandler;
|
|
18
|
+
this.createSourceDataContainer = params.createSourceDataContainer;
|
|
19
|
+
this.commandHandlerPlugins = this.plugins.byType(_CommandHandlerPlugin.CommandHandlerPlugin.type);
|
|
20
|
+
}
|
|
21
|
+
async handle(params) {
|
|
22
|
+
const {
|
|
23
|
+
data
|
|
24
|
+
} = params;
|
|
25
|
+
const sources = this.tableBundler.bundle({
|
|
26
|
+
items: data.getItems()
|
|
27
|
+
});
|
|
28
|
+
const container = this.createSourceDataContainer();
|
|
29
|
+
for (const bundle of sources.getBundles()) {
|
|
30
|
+
/**
|
|
31
|
+
* Need to fetch all the records from the source deployment tables.
|
|
32
|
+
*/
|
|
33
|
+
const {
|
|
34
|
+
items,
|
|
35
|
+
error
|
|
36
|
+
} = await this.fetcher.exec({
|
|
37
|
+
deployment: bundle.source,
|
|
38
|
+
table: bundle.table,
|
|
39
|
+
items: bundle.items,
|
|
40
|
+
maxBatchSize: 25
|
|
41
|
+
});
|
|
42
|
+
if (error) {
|
|
43
|
+
console.error(`Could not fetch records from the source table (${bundle.source.name} / ${bundle.table.name}). More info in next log line.`);
|
|
44
|
+
console.log((0, _utils.convertException)(error));
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
container.merge(items);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* We can now handle the records by going through all the items bundled by command, in correct order.
|
|
51
|
+
*/
|
|
52
|
+
const bundlesByCommand = this.commandBundler.bundle({
|
|
53
|
+
items: data.getItems()
|
|
54
|
+
});
|
|
55
|
+
for (const bundle of bundlesByCommand.getBundles()) {
|
|
56
|
+
const deployments = this.deployments.without(bundle.source);
|
|
57
|
+
for (const targetDeployment of deployments.all()) {
|
|
58
|
+
/**
|
|
59
|
+
* We need to map keys to actual items from the source deployment.
|
|
60
|
+
*/
|
|
61
|
+
const items = bundle.items.map(item => {
|
|
62
|
+
return container.get({
|
|
63
|
+
PK: item.PK,
|
|
64
|
+
SK: item.SK,
|
|
65
|
+
table: bundle.table,
|
|
66
|
+
source: bundle.source
|
|
67
|
+
});
|
|
68
|
+
}).filter(item => !!item);
|
|
69
|
+
const targetTable = this.findTargetTable({
|
|
70
|
+
bundle,
|
|
71
|
+
targetDeployment
|
|
72
|
+
});
|
|
73
|
+
if (!targetTable) {
|
|
74
|
+
console.error(`Could not find target table for source table "${bundle.table.name}" in deployment "${bundle.source.name}".`);
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
const result = await this.transformHandler.transform({
|
|
78
|
+
items,
|
|
79
|
+
sourceDeployment: bundle.source,
|
|
80
|
+
sourceTable: bundle.table,
|
|
81
|
+
targetDeployment: targetDeployment,
|
|
82
|
+
targetTable: targetTable
|
|
83
|
+
});
|
|
84
|
+
let commandHandler;
|
|
85
|
+
try {
|
|
86
|
+
commandHandler = this.getCommandHandler(bundle.command);
|
|
87
|
+
} catch (ex) {
|
|
88
|
+
console.error(ex.message);
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
await commandHandler.handle({
|
|
92
|
+
storer: this.storer,
|
|
93
|
+
items: result.items,
|
|
94
|
+
bundle,
|
|
95
|
+
targetDeployment: targetDeployment,
|
|
96
|
+
targetTable: targetTable
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
findTargetTable(params) {
|
|
102
|
+
const {
|
|
103
|
+
bundle,
|
|
104
|
+
targetDeployment
|
|
105
|
+
} = params;
|
|
106
|
+
try {
|
|
107
|
+
return targetDeployment.getTable(bundle.table.type);
|
|
108
|
+
} catch (ex) {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
getCommandHandler(command) {
|
|
113
|
+
const handler = this.commandHandlerPlugins.find(plugin => plugin.canHandle(command));
|
|
114
|
+
if (!handler) {
|
|
115
|
+
throw new Error(`Could not find a command handler for command: ${command}`);
|
|
116
|
+
}
|
|
117
|
+
return handler;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.RecordHandler = RecordHandler;
|
|
121
|
+
const createRecordHandler = params => {
|
|
122
|
+
return new RecordHandler(params);
|
|
123
|
+
};
|
|
124
|
+
exports.createRecordHandler = createRecordHandler;
|
|
125
|
+
|
|
126
|
+
//# sourceMappingURL=RecordHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_CommandHandlerPlugin","require","_utils","RecordHandler","constructor","params","plugins","fetcher","storer","commandBundler","tableBundler","deployments","transformHandler","createSourceDataContainer","commandHandlerPlugins","byType","CommandHandlerPlugin","type","handle","data","sources","bundle","items","getItems","container","getBundles","error","exec","deployment","source","table","maxBatchSize","console","name","log","convertException","merge","bundlesByCommand","without","targetDeployment","all","map","item","get","PK","SK","filter","targetTable","findTargetTable","result","transform","sourceDeployment","sourceTable","commandHandler","getCommandHandler","command","ex","message","getTable","handler","find","plugin","canHandle","Error","exports","createRecordHandler"],"sources":["RecordHandler.ts"],"sourcesContent":["import type { IRecordHandler, IRecordHandlerHandleParams } from \"./abstractions/RecordHandler.js\";\nimport { CommandHandlerPlugin } from \"../plugins/CommandHandlerPlugin.js\";\nimport { convertException } from \"@webiny/utils\";\nimport type { CommandType } from \"~/types.js\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport type { IFetcher } from \"~/resolver/app/fetcher/types.js\";\nimport type { IStoreItem, IStorer } from \"~/resolver/app/storer/types.js\";\nimport type { IBundle, IBundler } from \"~/resolver/app/bundler/types.js\";\nimport type { IDeployment, IDeployments } from \"~/resolver/deployment/types.js\";\nimport type { ITransformHandler } from \"~/resolver/app/transform/TransformHandler.js\";\nimport type { ITable } from \"~/sync/types.js\";\nimport type { ISourceDataContainer } from \"~/resolver/app/data/types.js\";\n\nexport interface IRecordHandlerParams {\n fetcher: IFetcher;\n storer: IStorer;\n plugins: PluginsContainer;\n commandBundler: IBundler;\n tableBundler: IBundler;\n deployments: IDeployments;\n transformHandler: ITransformHandler;\n createSourceDataContainer: () => ISourceDataContainer;\n}\n\ninterface IFindTargetTableParams {\n bundle: IBundle;\n targetDeployment: IDeployment;\n}\n\nexport class RecordHandler implements IRecordHandler {\n private readonly plugins: PluginsContainer;\n private readonly commandHandlerPlugins: CommandHandlerPlugin[];\n private readonly fetcher: IFetcher;\n private readonly storer: IStorer;\n private readonly commandBundler: IBundler;\n private readonly tableBundler: IBundler;\n private readonly deployments: IDeployments;\n private readonly transformHandler: ITransformHandler;\n private readonly createSourceDataContainer: () => ISourceDataContainer;\n\n public constructor(params: IRecordHandlerParams) {\n this.plugins = params.plugins;\n this.fetcher = params.fetcher;\n this.storer = params.storer;\n this.commandBundler = params.commandBundler;\n this.tableBundler = params.tableBundler;\n this.deployments = params.deployments;\n this.transformHandler = params.transformHandler;\n this.createSourceDataContainer = params.createSourceDataContainer;\n\n this.commandHandlerPlugins = this.plugins.byType<CommandHandlerPlugin>(\n CommandHandlerPlugin.type\n );\n }\n\n public async handle(params: IRecordHandlerHandleParams): Promise<void> {\n const { data } = params;\n\n const sources = this.tableBundler.bundle({\n items: data.getItems()\n });\n\n const container = this.createSourceDataContainer();\n\n for (const bundle of sources.getBundles()) {\n /**\n * Need to fetch all the records from the source deployment tables.\n */\n const { items, error } = await this.fetcher.exec({\n deployment: bundle.source,\n table: bundle.table,\n items: bundle.items,\n maxBatchSize: 25\n });\n if (error) {\n console.error(\n `Could not fetch records from the source table (${bundle.source.name} / ${bundle.table.name}). More info in next log line.`\n );\n console.log(convertException(error));\n continue;\n }\n container.merge(items);\n }\n /**\n * We can now handle the records by going through all the items bundled by command, in correct order.\n */\n const bundlesByCommand = this.commandBundler.bundle({\n items: data.getItems()\n });\n for (const bundle of bundlesByCommand.getBundles()) {\n const deployments = this.deployments.without(bundle.source);\n for (const targetDeployment of deployments.all()) {\n /**\n * We need to map keys to actual items from the source deployment.\n */\n const items = bundle.items\n .map(item => {\n return container.get({\n PK: item.PK,\n SK: item.SK,\n table: bundle.table,\n source: bundle.source\n });\n })\n .filter((item): item is IStoreItem => !!item);\n\n const targetTable = this.findTargetTable({\n bundle,\n targetDeployment\n });\n if (!targetTable) {\n console.error(\n `Could not find target table for source table \"${bundle.table.name}\" in deployment \"${bundle.source.name}\".`\n );\n continue;\n }\n\n const result = await this.transformHandler.transform({\n items,\n sourceDeployment: bundle.source,\n sourceTable: bundle.table,\n targetDeployment: targetDeployment,\n targetTable: targetTable\n });\n\n let commandHandler: CommandHandlerPlugin;\n try {\n commandHandler = this.getCommandHandler(bundle.command);\n } catch (ex) {\n console.error(ex.message);\n continue;\n }\n\n await commandHandler.handle({\n storer: this.storer,\n items: result.items,\n bundle,\n targetDeployment: targetDeployment,\n targetTable: targetTable\n });\n }\n }\n }\n\n private findTargetTable(params: IFindTargetTableParams): ITable | null {\n const { bundle, targetDeployment } = params;\n\n try {\n return targetDeployment.getTable(bundle.table.type);\n } catch (ex) {\n return null;\n }\n }\n\n private getCommandHandler(command: CommandType): CommandHandlerPlugin {\n const handler = this.commandHandlerPlugins.find(plugin => plugin.canHandle(command));\n if (!handler) {\n throw new Error(`Could not find a command handler for command: ${command}`);\n }\n\n return handler;\n }\n}\n\nexport const createRecordHandler = (params: IRecordHandlerParams): IRecordHandler => {\n return new RecordHandler(params);\n};\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SQSRecord } from "@webiny/aws-sdk/types/index.js";
|
|
2
|
+
import type { IRecordsValidation, IRecordsValidationResult } from "./abstractions/RecordsValidation.js";
|
|
3
|
+
export declare class RecordsValidation implements IRecordsValidation {
|
|
4
|
+
validate(records: SQSRecord[]): Promise<IRecordsValidationResult>;
|
|
5
|
+
}
|
|
6
|
+
export declare const createRecordsValidation: () => IRecordsValidation;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createRecordsValidation = exports.RecordsValidation = void 0;
|
|
7
|
+
var _utils = require("@webiny/utils");
|
|
8
|
+
var _event = require("./validation/event.js");
|
|
9
|
+
const validation = (0, _event.createEventValidation)();
|
|
10
|
+
class RecordsValidation {
|
|
11
|
+
async validate(records) {
|
|
12
|
+
const result = await validation.safeParseAsync(records);
|
|
13
|
+
if (result.error) {
|
|
14
|
+
return {
|
|
15
|
+
error: (0, _utils.createZodError)(result.error)
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
records: result.data
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.RecordsValidation = RecordsValidation;
|
|
24
|
+
const createRecordsValidation = () => {
|
|
25
|
+
return new RecordsValidation();
|
|
26
|
+
};
|
|
27
|
+
exports.createRecordsValidation = createRecordsValidation;
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=RecordsValidation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_utils","require","_event","validation","createEventValidation","RecordsValidation","validate","records","result","safeParseAsync","error","createZodError","data","exports","createRecordsValidation"],"sources":["RecordsValidation.ts"],"sourcesContent":["import type { SQSRecord } from \"@webiny/aws-sdk/types/index.js\";\nimport type {\n IRecordsValidation,\n IRecordsValidationResult\n} from \"./abstractions/RecordsValidation.js\";\nimport { createZodError } from \"@webiny/utils\";\nimport { createEventValidation } from \"~/resolver/app/validation/event.js\";\n\nconst validation = createEventValidation();\n\nexport class RecordsValidation implements IRecordsValidation {\n public async validate(records: SQSRecord[]): Promise<IRecordsValidationResult> {\n const result = await validation.safeParseAsync(records);\n if (result.error) {\n return {\n error: createZodError(result.error)\n };\n }\n return {\n records: result.data\n };\n }\n}\n\nexport const createRecordsValidation = (): IRecordsValidation => {\n return new RecordsValidation();\n};\n"],"mappings":";;;;;;AAKA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,MAAME,UAAU,GAAG,IAAAC,4BAAqB,EAAC,CAAC;AAEnC,MAAMC,iBAAiB,CAA+B;EACzD,MAAaC,QAAQA,CAACC,OAAoB,EAAqC;IAC3E,MAAMC,MAAM,GAAG,MAAML,UAAU,CAACM,cAAc,CAACF,OAAO,CAAC;IACvD,IAAIC,MAAM,CAACE,KAAK,EAAE;MACd,OAAO;QACHA,KAAK,EAAE,IAAAC,qBAAc,EAACH,MAAM,CAACE,KAAK;MACtC,CAAC;IACL;IACA,OAAO;MACHH,OAAO,EAAEC,MAAM,CAACI;IACpB,CAAC;EACL;AACJ;AAACC,OAAA,CAAAR,iBAAA,GAAAA,iBAAA;AAEM,MAAMS,uBAAuB,GAAGA,CAAA,KAA0B;EAC7D,OAAO,IAAIT,iBAAiB,CAAC,CAAC;AAClC,CAAC;AAACQ,OAAA,CAAAC,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IResolverApplication, IResolverApplicationResolveParams } from "./abstractions/ResolverApplication.js";
|
|
2
|
+
import type { IRecordHandler } from "./abstractions/RecordHandler.js";
|
|
3
|
+
import type { IDeployments } from "../deployment/types.js";
|
|
4
|
+
export interface IResolverApplicationParams {
|
|
5
|
+
recordHandler: IRecordHandler;
|
|
6
|
+
deployments: IDeployments;
|
|
7
|
+
}
|
|
8
|
+
export declare class ResolverApplication implements IResolverApplication {
|
|
9
|
+
private readonly recordHandler;
|
|
10
|
+
private readonly deployments;
|
|
11
|
+
constructor(params: IResolverApplicationParams);
|
|
12
|
+
resolve(params: IResolverApplicationResolveParams): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export declare const createResolverApp: (params: IResolverApplicationParams) => IResolverApplication;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createResolverApp = exports.ResolverApplication = void 0;
|
|
7
|
+
var _RecordsValidation = require("./RecordsValidation.js");
|
|
8
|
+
var _utils = require("@webiny/utils");
|
|
9
|
+
var _Ingestor = require("./ingestor/Ingestor.js");
|
|
10
|
+
var _IngestorResult = require("./ingestor/IngestorResult.js");
|
|
11
|
+
class ResolverApplication {
|
|
12
|
+
constructor(params) {
|
|
13
|
+
this.recordHandler = params.recordHandler;
|
|
14
|
+
this.deployments = params.deployments;
|
|
15
|
+
}
|
|
16
|
+
async resolve(params) {
|
|
17
|
+
const validation = (0, _RecordsValidation.createRecordsValidation)();
|
|
18
|
+
const result = await validation.validate(params.records);
|
|
19
|
+
if (result.error) {
|
|
20
|
+
throw result.error;
|
|
21
|
+
}
|
|
22
|
+
const ingestor = (0, _Ingestor.createIngestor)({
|
|
23
|
+
createIngestorResult: () => {
|
|
24
|
+
return (0, _IngestorResult.createIngestorResult)();
|
|
25
|
+
},
|
|
26
|
+
getSource: name => {
|
|
27
|
+
return this.deployments.get(name);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
const data = await ingestor.ingest({
|
|
31
|
+
records: result.records
|
|
32
|
+
});
|
|
33
|
+
try {
|
|
34
|
+
await this.recordHandler.handle({
|
|
35
|
+
data
|
|
36
|
+
});
|
|
37
|
+
} catch (ex) {
|
|
38
|
+
console.error((0, _utils.convertException)(ex));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.ResolverApplication = ResolverApplication;
|
|
43
|
+
const createResolverApp = params => {
|
|
44
|
+
return new ResolverApplication(params);
|
|
45
|
+
};
|
|
46
|
+
exports.createResolverApp = createResolverApp;
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=ResolverApplication.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_RecordsValidation","require","_utils","_Ingestor","_IngestorResult","ResolverApplication","constructor","params","recordHandler","deployments","resolve","validation","createRecordsValidation","result","validate","records","error","ingestor","createIngestor","createIngestorResult","getSource","name","get","data","ingest","handle","ex","console","convertException","exports","createResolverApp"],"sources":["ResolverApplication.ts"],"sourcesContent":["import type {\n IResolverApplication,\n IResolverApplicationResolveParams\n} from \"./abstractions/ResolverApplication.js\";\nimport { createRecordsValidation } from \"./RecordsValidation.js\";\nimport { convertException } from \"@webiny/utils\";\nimport type { IRecordHandler } from \"./abstractions/RecordHandler.js\";\nimport type { IDeployments } from \"~/resolver/deployment/types.js\";\nimport { createIngestor } from \"./ingestor/Ingestor.js\";\nimport { createIngestorResult } from \"~/resolver/app/ingestor/IngestorResult.js\";\n\nexport interface IResolverApplicationParams {\n recordHandler: IRecordHandler;\n deployments: IDeployments;\n}\n\nexport class ResolverApplication implements IResolverApplication {\n private readonly recordHandler: IRecordHandler;\n private readonly deployments: IDeployments;\n\n public constructor(params: IResolverApplicationParams) {\n this.recordHandler = params.recordHandler;\n this.deployments = params.deployments;\n }\n\n public async resolve(params: IResolverApplicationResolveParams): Promise<void> {\n const validation = createRecordsValidation();\n\n const result = await validation.validate(params.records);\n if (result.error) {\n throw result.error;\n }\n\n const ingestor = createIngestor({\n createIngestorResult: () => {\n return createIngestorResult();\n },\n getSource: name => {\n return this.deployments.get(name);\n }\n });\n\n const data = await ingestor.ingest({\n records: result.records\n });\n\n try {\n await this.recordHandler.handle({\n data\n });\n } catch (ex) {\n console.error(convertException(ex));\n }\n }\n}\n\nexport const createResolverApp = (params: IResolverApplicationParams): IResolverApplication => {\n return new ResolverApplication(params);\n};\n"],"mappings":";;;;;;AAIA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAGA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AAOO,MAAMI,mBAAmB,CAAiC;EAItDC,WAAWA,CAACC,MAAkC,EAAE;IACnD,IAAI,CAACC,aAAa,GAAGD,MAAM,CAACC,aAAa;IACzC,IAAI,CAACC,WAAW,GAAGF,MAAM,CAACE,WAAW;EACzC;EAEA,MAAaC,OAAOA,CAACH,MAAyC,EAAiB;IAC3E,MAAMI,UAAU,GAAG,IAAAC,0CAAuB,EAAC,CAAC;IAE5C,MAAMC,MAAM,GAAG,MAAMF,UAAU,CAACG,QAAQ,CAACP,MAAM,CAACQ,OAAO,CAAC;IACxD,IAAIF,MAAM,CAACG,KAAK,EAAE;MACd,MAAMH,MAAM,CAACG,KAAK;IACtB;IAEA,MAAMC,QAAQ,GAAG,IAAAC,wBAAc,EAAC;MAC5BC,oBAAoB,EAAEA,CAAA,KAAM;QACxB,OAAO,IAAAA,oCAAoB,EAAC,CAAC;MACjC,CAAC;MACDC,SAAS,EAAEC,IAAI,IAAI;QACf,OAAO,IAAI,CAACZ,WAAW,CAACa,GAAG,CAACD,IAAI,CAAC;MACrC;IACJ,CAAC,CAAC;IAEF,MAAME,IAAI,GAAG,MAAMN,QAAQ,CAACO,MAAM,CAAC;MAC/BT,OAAO,EAAEF,MAAM,CAACE;IACpB,CAAC,CAAC;IAEF,IAAI;MACA,MAAM,IAAI,CAACP,aAAa,CAACiB,MAAM,CAAC;QAC5BF;MACJ,CAAC,CAAC;IACN,CAAC,CAAC,OAAOG,EAAE,EAAE;MACTC,OAAO,CAACX,KAAK,CAAC,IAAAY,uBAAgB,EAACF,EAAE,CAAC,CAAC;IACvC;EACJ;AACJ;AAACG,OAAA,CAAAxB,mBAAA,GAAAA,mBAAA;AAEM,MAAMyB,iBAAiB,GAAIvB,MAAkC,IAA2B;EAC3F,OAAO,IAAIF,mBAAmB,CAACE,MAAM,CAAC;AAC1C,CAAC;AAACsB,OAAA,CAAAC,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["RecordHandler.ts"],"sourcesContent":["import type { IIngestorResult } from \"~/resolver/app/ingestor/types.js\";\n\nexport interface IRecordHandlerHandleParams {\n data: IIngestorResult;\n}\n\nexport interface IRecordHandler {\n handle(params: IRecordHandlerHandleParams): Promise<void>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SQSRecord } from "@webiny/aws-sdk/types";
|
|
2
|
+
import type { IResolverSQSRecord } from "./ResolverRecord.js";
|
|
3
|
+
export interface IRecordsValidationValid {
|
|
4
|
+
records: IResolverSQSRecord[];
|
|
5
|
+
error?: never;
|
|
6
|
+
}
|
|
7
|
+
export interface IRecordsValidationError {
|
|
8
|
+
records?: never;
|
|
9
|
+
error: Error;
|
|
10
|
+
}
|
|
11
|
+
export type IRecordsValidationResult = IRecordsValidationValid | IRecordsValidationError;
|
|
12
|
+
export interface IRecordsValidation {
|
|
13
|
+
validate(records: SQSRecord[]): Promise<IRecordsValidationResult>;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["RecordsValidation.ts"],"sourcesContent":["import type { SQSRecord } from \"@webiny/aws-sdk/types\";\nimport type { IResolverSQSRecord } from \"~/resolver/app/abstractions/ResolverRecord.js\";\n\nexport interface IRecordsValidationValid {\n records: IResolverSQSRecord[];\n error?: never;\n}\n\nexport interface IRecordsValidationError {\n records?: never;\n error: Error;\n}\n\nexport type IRecordsValidationResult = IRecordsValidationValid | IRecordsValidationError;\n\nexport interface IRecordsValidation {\n validate(records: SQSRecord[]): Promise<IRecordsValidationResult>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["ResolverApplication.ts"],"sourcesContent":["import type { SQSRecord } from \"@webiny/aws-sdk/types/index.js\";\n\nexport interface IResolverApplicationResolveParams {\n records: SQSRecord[];\n}\n\nexport interface IResolverApplication {\n resolve(params: IResolverApplicationResolveParams): Promise<void>;\n}\n"],"mappings":"","ignoreList":[]}
|