@webiny/api-sync-system 0.0.0-unstable.a4637c5ce6 → 0.0.0-unstable.a4f3e4ea8b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -108
- package/constants.js +2 -7
- package/constants.js.map +1 -1
- package/index.js +3 -40
- package/package.json +29 -26
- package/resolver/app/RecordHandler.d.ts +6 -6
- package/resolver/app/RecordHandler.js +84 -114
- package/resolver/app/RecordHandler.js.map +1 -1
- package/resolver/app/RecordsValidation.js +13 -24
- package/resolver/app/RecordsValidation.js.map +1 -1
- package/resolver/app/ResolverApplication.d.ts +1 -1
- package/resolver/app/ResolverApplication.js +27 -42
- package/resolver/app/ResolverApplication.js.map +1 -1
- package/resolver/app/abstractions/RecordHandler.d.ts +1 -1
- package/resolver/app/abstractions/RecordHandler.js +0 -7
- package/resolver/app/abstractions/RecordsValidation.d.ts +2 -2
- package/resolver/app/abstractions/RecordsValidation.js +0 -7
- package/resolver/app/abstractions/ResolverApplication.js +0 -7
- package/resolver/app/abstractions/ResolverRecord.d.ts +1 -1
- package/resolver/app/abstractions/ResolverRecord.js +0 -7
- package/resolver/app/bundler/BaseBundle.d.ts +6 -6
- package/resolver/app/bundler/BaseBundle.js +16 -22
- package/resolver/app/bundler/BaseBundle.js.map +1 -1
- package/resolver/app/bundler/Bundler.d.ts +1 -1
- package/resolver/app/bundler/Bundler.js +12 -25
- package/resolver/app/bundler/Bundler.js.map +1 -1
- package/resolver/app/bundler/Bundles.d.ts +2 -2
- package/resolver/app/bundler/Bundles.js +20 -33
- package/resolver/app/bundler/Bundles.js.map +1 -1
- package/resolver/app/bundler/CommandBundle.d.ts +1 -1
- package/resolver/app/bundler/CommandBundle.js +8 -25
- package/resolver/app/bundler/CommandBundle.js.map +1 -1
- package/resolver/app/bundler/TableBundle.d.ts +1 -1
- package/resolver/app/bundler/TableBundle.js +7 -22
- package/resolver/app/bundler/TableBundle.js.map +1 -1
- package/resolver/app/bundler/types.d.ts +2 -2
- package/resolver/app/bundler/types.js +0 -7
- package/resolver/app/commandHandler/DeleteCommandHandler.d.ts +3 -3
- package/resolver/app/commandHandler/DeleteCommandHandler.js +21 -35
- package/resolver/app/commandHandler/DeleteCommandHandler.js.map +1 -1
- package/resolver/app/commandHandler/PutCommandHandler.d.ts +4 -4
- package/resolver/app/commandHandler/PutCommandHandler.js +15 -28
- package/resolver/app/commandHandler/PutCommandHandler.js.map +1 -1
- package/resolver/app/commandHandler/delete.d.ts +1 -1
- package/resolver/app/commandHandler/delete.js +13 -21
- package/resolver/app/commandHandler/delete.js.map +1 -1
- package/resolver/app/commandHandler/put.d.ts +1 -1
- package/resolver/app/commandHandler/put.js +13 -21
- package/resolver/app/commandHandler/put.js.map +1 -1
- package/resolver/app/data/SourceDataContainer.d.ts +3 -3
- package/resolver/app/data/SourceDataContainer.js +27 -36
- package/resolver/app/data/SourceDataContainer.js.map +1 -1
- package/resolver/app/data/types.d.ts +2 -2
- package/resolver/app/data/types.js +0 -7
- package/resolver/app/fetcher/Fetcher.d.ts +3 -3
- package/resolver/app/fetcher/Fetcher.js +87 -121
- package/resolver/app/fetcher/Fetcher.js.map +1 -1
- package/resolver/app/fetcher/types.d.ts +2 -2
- package/resolver/app/fetcher/types.js +0 -7
- package/resolver/app/ingestor/Ingestor.d.ts +1 -1
- package/resolver/app/ingestor/Ingestor.js +26 -39
- package/resolver/app/ingestor/Ingestor.js.map +1 -1
- package/resolver/app/ingestor/IngestorResult.js +27 -39
- package/resolver/app/ingestor/IngestorResult.js.map +1 -1
- package/resolver/app/ingestor/types.d.ts +2 -2
- package/resolver/app/ingestor/types.js +0 -7
- package/resolver/app/storer/Storer.d.ts +3 -3
- package/resolver/app/storer/Storer.js +73 -95
- package/resolver/app/storer/Storer.js.map +1 -1
- package/resolver/app/storer/types.d.ts +2 -2
- package/resolver/app/storer/types.js +0 -7
- package/resolver/app/transform/TransformHandler.d.ts +4 -4
- package/resolver/app/transform/TransformHandler.js +46 -64
- package/resolver/app/transform/TransformHandler.js.map +1 -1
- package/resolver/app/transform/middleware.d.ts +1 -1
- package/resolver/app/transform/middleware.js +12 -25
- package/resolver/app/transform/middleware.js.map +1 -1
- package/resolver/app/utils/Retry.js +21 -32
- package/resolver/app/utils/Retry.js.map +1 -1
- package/resolver/app/utils/sleep.js +4 -12
- package/resolver/app/utils/sleep.js.map +1 -1
- package/resolver/app/validation/body.d.ts +25 -124
- package/resolver/app/validation/body.js +31 -44
- package/resolver/app/validation/body.js.map +1 -1
- package/resolver/app/validation/createJsonTransform.d.ts +1 -1
- package/resolver/app/validation/createJsonTransform.js +13 -22
- package/resolver/app/validation/createJsonTransform.js.map +1 -1
- package/resolver/app/validation/detail.d.ts +19 -72
- package/resolver/app/validation/detail.js +33 -46
- package/resolver/app/validation/detail.js.map +1 -1
- package/resolver/app/validation/event.d.ts +29 -188
- package/resolver/app/validation/event.js +21 -30
- package/resolver/app/validation/event.js.map +1 -1
- package/resolver/app/validation/numericString.d.ts +1 -1
- package/resolver/app/validation/numericString.js +9 -20
- package/resolver/app/validation/numericString.js.map +1 -1
- package/resolver/app/validation/system.d.ts +2 -14
- package/resolver/app/validation/system.js +9 -18
- package/resolver/app/validation/system.js.map +1 -1
- package/resolver/createEventHandlerPlugin.d.ts +2 -1
- package/resolver/createEventHandlerPlugin.js +85 -121
- package/resolver/createEventHandlerPlugin.js.map +1 -1
- package/resolver/createResolverHandler.d.ts +1 -1
- package/resolver/createResolverHandler.js +60 -75
- package/resolver/createResolverHandler.js.map +1 -1
- package/resolver/deployment/Deployment.d.ts +2 -3
- package/resolver/deployment/Deployment.js +27 -44
- package/resolver/deployment/Deployment.js.map +1 -1
- package/resolver/deployment/Deployments.js +19 -30
- package/resolver/deployment/Deployments.js.map +1 -1
- package/resolver/deployment/DeploymentsFetcher.js +82 -102
- package/resolver/deployment/DeploymentsFetcher.js.map +1 -1
- package/resolver/deployment/types.d.ts +4 -6
- package/resolver/deployment/types.js +0 -7
- package/resolver/lambda/LambdaTrigger.js +25 -34
- package/resolver/lambda/LambdaTrigger.js.map +1 -1
- package/resolver/plugins/CommandHandlerPlugin.d.ts +3 -3
- package/resolver/plugins/CommandHandlerPlugin.js +17 -24
- package/resolver/plugins/CommandHandlerPlugin.js.map +1 -1
- package/resolver/plugins/StorerAfterEachPlugin.d.ts +2 -2
- package/resolver/plugins/StorerAfterEachPlugin.js +21 -29
- package/resolver/plugins/StorerAfterEachPlugin.js.map +1 -1
- package/resolver/plugins/TransformRecordPlugin.d.ts +3 -3
- package/resolver/plugins/TransformRecordPlugin.js +20 -27
- package/resolver/plugins/TransformRecordPlugin.js.map +1 -1
- package/resolver/recordTypes/fileManager/CopyFile.js +44 -74
- package/resolver/recordTypes/fileManager/CopyFile.js.map +1 -1
- package/resolver/recordTypes/fileManager/DeleteFile.d.ts +1 -1
- package/resolver/recordTypes/fileManager/DeleteFile.js +40 -65
- package/resolver/recordTypes/fileManager/DeleteFile.js.map +1 -1
- package/resolver/recordTypes/fileManager/fileManager.d.ts +1 -1
- package/resolver/recordTypes/fileManager/fileManager.js +7 -12
- package/resolver/recordTypes/fileManager/fileManager.js.map +1 -1
- package/resolver/recordTypes/fileManager/fileManagerOnDelete.d.ts +1 -1
- package/resolver/recordTypes/fileManager/fileManagerOnDelete.js +27 -45
- package/resolver/recordTypes/fileManager/fileManagerOnDelete.js.map +1 -1
- package/resolver/recordTypes/fileManager/fileManagerOnPut.d.ts +1 -1
- package/resolver/recordTypes/fileManager/fileManagerOnPut.js +27 -45
- package/resolver/recordTypes/fileManager/fileManagerOnPut.js.map +1 -1
- package/resolver/recordTypes/fileManager/shouldBeHandled.d.ts +1 -1
- package/resolver/recordTypes/fileManager/shouldBeHandled.js +10 -34
- package/resolver/recordTypes/fileManager/shouldBeHandled.js.map +1 -1
- package/resolver/recordTypes/fileManager/types.d.ts +2 -2
- package/resolver/recordTypes/fileManager/types.js +0 -7
- package/resolver/recordTypes/users/CopyUser.d.ts +2 -2
- package/resolver/recordTypes/users/CopyUser.js +44 -61
- package/resolver/recordTypes/users/CopyUser.js.map +1 -1
- package/resolver/recordTypes/users/DeleteUser.d.ts +2 -2
- package/resolver/recordTypes/users/DeleteUser.js +40 -58
- package/resolver/recordTypes/users/DeleteUser.js.map +1 -1
- package/resolver/recordTypes/users/shouldBeHandled.d.ts +1 -1
- package/resolver/recordTypes/users/shouldBeHandled.js +10 -33
- package/resolver/recordTypes/users/shouldBeHandled.js.map +1 -1
- package/resolver/recordTypes/users/types.d.ts +1 -1
- package/resolver/recordTypes/users/types.js +0 -7
- package/resolver/recordTypes/users/users.js +7 -12
- package/resolver/recordTypes/users/users.js.map +1 -1
- package/resolver/recordTypes/users/usersOnDelete.d.ts +2 -2
- package/resolver/recordTypes/users/usersOnDelete.js +26 -44
- package/resolver/recordTypes/users/usersOnDelete.js.map +1 -1
- package/resolver/recordTypes/users/usersOnPut.d.ts +2 -2
- package/resolver/recordTypes/users/usersOnPut.js +27 -45
- package/resolver/recordTypes/users/usersOnPut.js.map +1 -1
- package/sync/FilterOutRecord.d.ts +2 -2
- package/sync/FilterOutRecord.js +8 -24
- package/sync/FilterOutRecord.js.map +1 -1
- package/sync/attachToDynamoDbDocument.d.ts +1 -1
- package/sync/attachToDynamoDbDocument.js +48 -75
- package/sync/attachToDynamoDbDocument.js.map +1 -1
- package/sync/createHandler.js +44 -60
- package/sync/createHandler.js.map +1 -1
- package/sync/createSendDataToEventBridgeOnRequestEnd.js +34 -46
- package/sync/createSendDataToEventBridgeOnRequestEnd.js.map +1 -1
- package/sync/createSyncSystem.d.ts +1 -1
- package/sync/createSyncSystem.js +27 -36
- package/sync/createSyncSystem.js.map +1 -1
- package/sync/filter/createDefaultFilterOutRecordPlugins.d.ts +1 -1
- package/sync/filter/createDefaultFilterOutRecordPlugins.js +37 -86
- package/sync/filter/createDefaultFilterOutRecordPlugins.js.map +1 -1
- package/sync/handler/Handler.d.ts +2 -2
- package/sync/handler/Handler.js +66 -86
- package/sync/handler/Handler.js.map +1 -1
- package/sync/handler/HandlerConverter.js +20 -36
- package/sync/handler/HandlerConverter.js.map +1 -1
- package/sync/handler/converter/BatchGetCommandConverter.js +13 -20
- package/sync/handler/converter/BatchGetCommandConverter.js.map +1 -1
- package/sync/handler/converter/BatchWriteCommandConverter.js +13 -20
- package/sync/handler/converter/BatchWriteCommandConverter.js.map +1 -1
- package/sync/handler/converter/DeleteCommandConverter.js +13 -20
- package/sync/handler/converter/DeleteCommandConverter.js.map +1 -1
- package/sync/handler/converter/GetCommandConverter.js +13 -20
- package/sync/handler/converter/GetCommandConverter.js.map +1 -1
- package/sync/handler/converter/PutCommandConverter.js +13 -20
- package/sync/handler/converter/PutCommandConverter.js.map +1 -1
- package/sync/handler/converter/QueryCommandConverter.js +13 -20
- package/sync/handler/converter/QueryCommandConverter.js.map +1 -1
- package/sync/handler/converter/ScanCommandConverter.js +13 -20
- package/sync/handler/converter/ScanCommandConverter.js.map +1 -1
- package/sync/handler/converter/UpdateCommandConverter.js +13 -20
- package/sync/handler/converter/UpdateCommandConverter.js.map +1 -1
- package/sync/handler/converter/commands/BatchWriteCommandValue.d.ts +2 -2
- package/sync/handler/converter/commands/BatchWriteCommandValue.js +34 -44
- package/sync/handler/converter/commands/BatchWriteCommandValue.js.map +1 -1
- package/sync/handler/converter/commands/DeleteCommandValue.d.ts +2 -2
- package/sync/handler/converter/commands/DeleteCommandValue.js +19 -23
- package/sync/handler/converter/commands/DeleteCommandValue.js.map +1 -1
- package/sync/handler/converter/commands/NullCommandValue.d.ts +1 -1
- package/sync/handler/converter/commands/NullCommandValue.js +7 -14
- package/sync/handler/converter/commands/NullCommandValue.js.map +1 -1
- package/sync/handler/converter/commands/PutCommandValue.d.ts +2 -2
- package/sync/handler/converter/commands/PutCommandValue.js +19 -23
- package/sync/handler/converter/commands/PutCommandValue.js.map +1 -1
- package/sync/handler/converter/commands/UpdateCommandValue.d.ts +2 -2
- package/sync/handler/converter/commands/UpdateCommandValue.js +19 -23
- package/sync/handler/converter/commands/UpdateCommandValue.js.map +1 -1
- package/sync/handler/types.d.ts +3 -3
- package/sync/handler/types.js +0 -7
- package/sync/plugins/FilterOutRecordPlugin.d.ts +1 -1
- package/sync/plugins/FilterOutRecordPlugin.js +18 -28
- package/sync/plugins/FilterOutRecordPlugin.js.map +1 -1
- package/sync/requestPlugin.d.ts +1 -1
- package/sync/requestPlugin.js +39 -55
- package/sync/requestPlugin.js.map +1 -1
- package/sync/types.js +0 -7
- package/sync/utils/getTableType.js +11 -19
- package/sync/utils/getTableType.js.map +1 -1
- package/sync/utils/manifest.d.ts +3 -7
- package/sync/utils/manifest.js +30 -47
- package/sync/utils/manifest.js.map +1 -1
- package/sync/utils/validateSystemInput.d.ts +1 -1
- package/sync/utils/validateSystemInput.js +22 -37
- package/sync/utils/validateSystemInput.js.map +1 -1
- package/types.d.ts +3 -5
- package/types.js +6 -12
- package/types.js.map +1 -1
- package/utils/createSystemName.js +5 -10
- package/utils/createSystemName.js.map +1 -1
- package/worker/actions/copyFile/CopyFile.js +185 -268
- package/worker/actions/copyFile/CopyFile.js.map +1 -1
- package/worker/actions/copyFile/copyFileAction.d.ts +1 -1
- package/worker/actions/copyFile/copyFileAction.js +30 -45
- package/worker/actions/copyFile/copyFileAction.js.map +1 -1
- package/worker/actions/copyFile/copyFileSchema.d.ts +6 -38
- package/worker/actions/copyFile/copyFileSchema.js +14 -23
- package/worker/actions/copyFile/copyFileSchema.js.map +1 -1
- package/worker/actions/copyFile/types.js +0 -7
- package/worker/actions/createUser/CreateUser.d.ts +1 -1
- package/worker/actions/createUser/CreateUser.js +53 -83
- package/worker/actions/createUser/CreateUser.js.map +1 -1
- package/worker/actions/createUser/createUserAction.d.ts +2 -2
- package/worker/actions/createUser/createUserAction.js +28 -39
- package/worker/actions/createUser/createUserAction.js.map +1 -1
- package/worker/actions/createUser/createUserSchema.d.ts +6 -38
- package/worker/actions/createUser/createUserSchema.js +14 -23
- package/worker/actions/createUser/createUserSchema.js.map +1 -1
- package/worker/actions/createUser/types.js +0 -7
- package/worker/actions/deleteFile/DeleteFile.js +52 -74
- package/worker/actions/deleteFile/DeleteFile.js.map +1 -1
- package/worker/actions/deleteFile/deleteFileAction.d.ts +1 -1
- package/worker/actions/deleteFile/deleteFileAction.js +25 -40
- package/worker/actions/deleteFile/deleteFileAction.js.map +1 -1
- package/worker/actions/deleteFile/deleteFileSchema.d.ts +6 -38
- package/worker/actions/deleteFile/deleteFileSchema.js +14 -23
- package/worker/actions/deleteFile/deleteFileSchema.js.map +1 -1
- package/worker/actions/deleteFile/types.js +0 -7
- package/worker/actions/deleteUser/DeleteUser.d.ts +2 -2
- package/worker/actions/deleteUser/DeleteUser.js +39 -60
- package/worker/actions/deleteUser/DeleteUser.js.map +1 -1
- package/worker/actions/deleteUser/deleteUserAction.d.ts +1 -1
- package/worker/actions/deleteUser/deleteUserAction.js +26 -37
- package/worker/actions/deleteUser/deleteUserAction.js.map +1 -1
- package/worker/actions/deleteUser/deleteUserSchema.d.ts +5 -23
- package/worker/actions/deleteUser/deleteUserSchema.js +13 -22
- package/worker/actions/deleteUser/deleteUserSchema.js.map +1 -1
- package/worker/actions/deleteUser/types.js +0 -7
- package/worker/actions/logValidationError.js +6 -14
- package/worker/actions/logValidationError.js.map +1 -1
- package/worker/actions/removeCognitoUserAttributes.js +9 -22
- package/worker/actions/removeCognitoUserAttributes.js.map +1 -1
- package/worker/actions/updateUser/UpdateUser.d.ts +1 -1
- package/worker/actions/updateUser/UpdateUser.js +50 -74
- package/worker/actions/updateUser/UpdateUser.js.map +1 -1
- package/worker/actions/updateUser/types.js +0 -7
- package/worker/actions/updateUser/updateUserAction.d.ts +2 -2
- package/worker/actions/updateUser/updateUserAction.js +28 -39
- package/worker/actions/updateUser/updateUserAction.js.map +1 -1
- package/worker/actions/updateUser/updateUserSchema.d.ts +6 -38
- package/worker/actions/updateUser/updateUserSchema.js +14 -23
- package/worker/actions/updateUser/updateUserSchema.js.map +1 -1
- package/worker/createWorkerHandler.js +32 -45
- package/worker/createWorkerHandler.js.map +1 -1
- package/worker/handler/WorkerActionHandler.d.ts +2 -2
- package/worker/handler/WorkerActionHandler.js +19 -28
- package/worker/handler/WorkerActionHandler.js.map +1 -1
- package/worker/handler/eventHandler.js +18 -27
- package/worker/handler/eventHandler.js.map +1 -1
- package/worker/plugins/WorkerActionPlugin.d.ts +1 -1
- package/worker/plugins/WorkerActionPlugin.js +18 -25
- package/worker/plugins/WorkerActionPlugin.js.map +1 -1
- package/worker/types.js +0 -7
- package/index.js.map +0 -1
- package/resolver/app/abstractions/RecordHandler.js.map +0 -1
- package/resolver/app/abstractions/RecordsValidation.js.map +0 -1
- package/resolver/app/abstractions/ResolverApplication.js.map +0 -1
- package/resolver/app/abstractions/ResolverRecord.js.map +0 -1
- package/resolver/app/bundler/types.js.map +0 -1
- package/resolver/app/data/types.js.map +0 -1
- package/resolver/app/fetcher/types.js.map +0 -1
- package/resolver/app/ingestor/types.js.map +0 -1
- package/resolver/app/storer/types.js.map +0 -1
- package/resolver/deployment/types.js.map +0 -1
- package/resolver/recordTypes/fileManager/types.js.map +0 -1
- package/resolver/recordTypes/users/types.js.map +0 -1
- package/sync/handler/types.js.map +0 -1
- package/sync/types.js.map +0 -1
- package/worker/actions/copyFile/types.js.map +0 -1
- package/worker/actions/createUser/types.js.map +0 -1
- package/worker/actions/deleteFile/types.js.map +0 -1
- package/worker/actions/deleteUser/types.js.map +0 -1
- package/worker/actions/updateUser/types.js.map +0 -1
- package/worker/types.js.map +0 -1
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.PutCommandValue = void 0;
|
|
7
|
-
var _getTableType = require("../../../utils/getTableType.js");
|
|
1
|
+
import { getTableType } from "../../../utils/getTableType.js";
|
|
8
2
|
class PutCommandValue {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
3
|
+
constructor(input){
|
|
4
|
+
this.command = "put";
|
|
5
|
+
const tableName = input.input.TableName;
|
|
6
|
+
this.item = {
|
|
7
|
+
command: this.command,
|
|
8
|
+
PK: input.input.Item.PK,
|
|
9
|
+
SK: input.input.Item.SK,
|
|
10
|
+
tableName,
|
|
11
|
+
tableType: getTableType(tableName),
|
|
12
|
+
input
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
getItems() {
|
|
16
|
+
return [
|
|
17
|
+
this.item
|
|
18
|
+
];
|
|
19
|
+
}
|
|
24
20
|
}
|
|
25
|
-
|
|
21
|
+
export { PutCommandValue };
|
|
26
22
|
|
|
27
23
|
//# sourceMappingURL=PutCommandValue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"sync/handler/converter/commands/PutCommandValue.js","sources":["../../../../../src/sync/handler/converter/commands/PutCommandValue.ts"],"sourcesContent":["import type { PutCommand } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport type { ICommandValue, ICommandValueItemExtended } from \"~/sync/types.js\";\nimport type { NonEmptyArray } from \"@webiny/api/types.js\";\nimport { getTableType } from \"~/sync/utils/getTableType.js\";\n\nexport class PutCommandValue implements ICommandValue {\n public readonly command = \"put\";\n public readonly item: ICommandValueItemExtended;\n\n public constructor(input: PutCommand) {\n const tableName = input.input.TableName as string;\n this.item = {\n command: this.command,\n PK: input.input.Item!.PK,\n SK: input.input.Item!.SK,\n tableName,\n tableType: getTableType(tableName),\n input\n };\n }\n\n public getItems(): NonEmptyArray<ICommandValueItemExtended> {\n return [this.item];\n }\n}\n"],"names":["PutCommandValue","input","tableName","getTableType"],"mappings":";AAKO,MAAMA;IAIT,YAAmBC,KAAiB,CAAE;aAHtB,OAAO,GAAG;QAItB,MAAMC,YAAYD,MAAM,KAAK,CAAC,SAAS;QACvC,IAAI,CAAC,IAAI,GAAG;YACR,SAAS,IAAI,CAAC,OAAO;YACrB,IAAIA,MAAM,KAAK,CAAC,IAAI,CAAE,EAAE;YACxB,IAAIA,MAAM,KAAK,CAAC,IAAI,CAAE,EAAE;YACxBC;YACA,WAAWC,aAAaD;YACxBD;QACJ;IACJ;IAEO,WAAqD;QACxD,OAAO;YAAC,IAAI,CAAC,IAAI;SAAC;IACtB;AACJ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { UpdateCommand } from "@webiny/aws-sdk/client-dynamodb";
|
|
2
|
-
import type { ICommandValue, ICommandValueItemExtended } from "
|
|
1
|
+
import type { UpdateCommand } from "@webiny/aws-sdk/client-dynamodb/index.js";
|
|
2
|
+
import type { ICommandValue, ICommandValueItemExtended } from "../../../../sync/types.js";
|
|
3
3
|
import type { NonEmptyArray } from "@webiny/api/types.js";
|
|
4
4
|
export declare class UpdateCommandValue implements ICommandValue {
|
|
5
5
|
readonly command = "update";
|
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.UpdateCommandValue = void 0;
|
|
7
|
-
var _getTableType = require("../../../utils/getTableType.js");
|
|
1
|
+
import { getTableType } from "../../../utils/getTableType.js";
|
|
8
2
|
class UpdateCommandValue {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
3
|
+
constructor(input){
|
|
4
|
+
this.command = "update";
|
|
5
|
+
const tableName = input.input.TableName;
|
|
6
|
+
this.item = {
|
|
7
|
+
command: this.command,
|
|
8
|
+
PK: input.input.Key.PK,
|
|
9
|
+
SK: input.input.Key.SK,
|
|
10
|
+
tableName,
|
|
11
|
+
tableType: getTableType(tableName),
|
|
12
|
+
input
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
getItems() {
|
|
16
|
+
return [
|
|
17
|
+
this.item
|
|
18
|
+
];
|
|
19
|
+
}
|
|
24
20
|
}
|
|
25
|
-
|
|
21
|
+
export { UpdateCommandValue };
|
|
26
22
|
|
|
27
23
|
//# sourceMappingURL=UpdateCommandValue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"sync/handler/converter/commands/UpdateCommandValue.js","sources":["../../../../../src/sync/handler/converter/commands/UpdateCommandValue.ts"],"sourcesContent":["import type { UpdateCommand } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport type { ICommandValue, ICommandValueItemExtended } from \"~/sync/types.js\";\nimport type { NonEmptyArray } from \"@webiny/api/types.js\";\nimport { getTableType } from \"~/sync/utils/getTableType.js\";\n\nexport class UpdateCommandValue implements ICommandValue {\n public readonly command = \"update\";\n public readonly item: ICommandValueItemExtended;\n\n public constructor(input: UpdateCommand) {\n const tableName = input.input.TableName as string;\n this.item = {\n command: this.command,\n PK: input.input.Key!.PK,\n SK: input.input.Key!.SK,\n tableName,\n tableType: getTableType(tableName),\n input\n };\n }\n\n public getItems(): NonEmptyArray<ICommandValueItemExtended> {\n return [this.item];\n }\n}\n"],"names":["UpdateCommandValue","input","tableName","getTableType"],"mappings":";AAKO,MAAMA;IAIT,YAAmBC,KAAoB,CAAE;aAHzB,OAAO,GAAG;QAItB,MAAMC,YAAYD,MAAM,KAAK,CAAC,SAAS;QACvC,IAAI,CAAC,IAAI,GAAG;YACR,SAAS,IAAI,CAAC,OAAO;YACrB,IAAIA,MAAM,KAAK,CAAC,GAAG,CAAE,EAAE;YACvB,IAAIA,MAAM,KAAK,CAAC,GAAG,CAAE,EAAE;YACvBC;YACA,WAAWC,aAAaD;YACxBD;QACJ;IACJ;IAEO,WAAqD;QACxD,OAAO;YAAC,IAAI,CAAC,IAAI;SAAC;IACtB;AACJ"}
|
package/sync/handler/types.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { NonEmptyArray } from "@webiny/api/types";
|
|
1
|
+
import type { NonEmptyArray } from "@webiny/api/types.js";
|
|
2
2
|
import type { DynamoDBTableType, ExtendedCommandType } from "../../types.js";
|
|
3
|
-
import type { ISystem } from "../types";
|
|
3
|
+
import type { ISystem } from "../types.js";
|
|
4
4
|
export interface IDetailItem {
|
|
5
5
|
PK: string;
|
|
6
6
|
SK: string;
|
|
7
7
|
command: ExtendedCommandType;
|
|
8
8
|
/**
|
|
9
|
-
* There will be multiple tables that will get populated through the system (regular table and
|
|
9
|
+
* There will be multiple tables that will get populated through the system (regular table and opensearch for start).
|
|
10
10
|
*/
|
|
11
11
|
tableName: string;
|
|
12
12
|
tableType: DynamoDBTableType;
|
package/sync/handler/types.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Plugin } from "@webiny/plugins/Plugin.js";
|
|
2
|
-
import type { ICommandValueItemExtended } from "
|
|
2
|
+
import type { ICommandValueItemExtended } from "../../sync/types.js";
|
|
3
3
|
export interface IFilterOutRecordPluginCallable {
|
|
4
4
|
(record: ICommandValueItemExtended): boolean;
|
|
5
5
|
}
|
|
@@ -1,31 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
*/
|
|
18
|
-
execute(item) {
|
|
19
|
-
return this.cb(item);
|
|
20
|
-
}
|
|
21
|
-
static createName(name) {
|
|
22
|
-
return `${FilterOutRecordPlugin.type}.${name}`;
|
|
23
|
-
}
|
|
1
|
+
import { Plugin } from "@webiny/plugins/Plugin.js";
|
|
2
|
+
class FilterOutRecordPlugin extends Plugin {
|
|
3
|
+
static{
|
|
4
|
+
this.type = "sync.filterOut.record";
|
|
5
|
+
}
|
|
6
|
+
constructor(params){
|
|
7
|
+
super();
|
|
8
|
+
this.name = params.name;
|
|
9
|
+
this.cb = params.filterOut;
|
|
10
|
+
}
|
|
11
|
+
execute(item) {
|
|
12
|
+
return this.cb(item);
|
|
13
|
+
}
|
|
14
|
+
static createName(name) {
|
|
15
|
+
return `${FilterOutRecordPlugin.type}.${name}`;
|
|
16
|
+
}
|
|
24
17
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return new FilterOutRecordPlugin(params);
|
|
28
|
-
};
|
|
29
|
-
exports.createFilterOutRecordPlugin = createFilterOutRecordPlugin;
|
|
18
|
+
const createFilterOutRecordPlugin = (params)=>new FilterOutRecordPlugin(params);
|
|
19
|
+
export { FilterOutRecordPlugin, createFilterOutRecordPlugin };
|
|
30
20
|
|
|
31
21
|
//# sourceMappingURL=FilterOutRecordPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"sync/plugins/FilterOutRecordPlugin.js","sources":["../../../src/sync/plugins/FilterOutRecordPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/Plugin.js\";\nimport type { ICommandValueItemExtended } from \"~/sync/types.js\";\n\nexport interface IFilterOutRecordPluginCallable {\n (record: ICommandValueItemExtended): boolean;\n}\n\nexport interface IFilterOutRecordPluginParams {\n /**\n * Filter out returns true if the record should be filtered out.\n */\n filterOut: IFilterOutRecordPluginCallable;\n name: string;\n}\n\nexport class FilterOutRecordPlugin extends Plugin {\n public static override readonly type: string = \"sync.filterOut.record\";\n\n private readonly cb: IFilterOutRecordPluginCallable;\n\n public constructor(params: IFilterOutRecordPluginParams) {\n super();\n this.name = params.name;\n this.cb = params.filterOut;\n }\n /**\n * If method returns `true`, the record will be filtered out.\n */\n public execute(item: ICommandValueItemExtended): boolean {\n return this.cb(item);\n }\n\n public static createName(name: string): string {\n return `${FilterOutRecordPlugin.type}.${name}`;\n }\n}\n\nexport const createFilterOutRecordPlugin = (\n params: IFilterOutRecordPluginParams\n): FilterOutRecordPlugin => {\n return new FilterOutRecordPlugin(params);\n};\n"],"names":["FilterOutRecordPlugin","Plugin","params","item","name","createFilterOutRecordPlugin"],"mappings":";AAeO,MAAMA,8BAA8BC;;aACP,IAAI,GAAW;;IAI/C,YAAmBC,MAAoC,CAAE;QACrD,KAAK;QACL,IAAI,CAAC,IAAI,GAAGA,OAAO,IAAI;QACvB,IAAI,CAAC,EAAE,GAAGA,OAAO,SAAS;IAC9B;IAIO,QAAQC,IAA+B,EAAW;QACrD,OAAO,IAAI,CAAC,EAAE,CAACA;IACnB;IAEA,OAAc,WAAWC,IAAY,EAAU;QAC3C,OAAO,GAAGJ,sBAAsB,IAAI,CAAC,CAAC,EAAEI,MAAM;IAClD;AACJ;AAEO,MAAMC,8BAA8B,CACvCH,SAEO,IAAIF,sBAAsBE"}
|
package/sync/requestPlugin.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb/index.js";
|
|
2
|
-
import type { ICommandConverter, IGetEventBridgeCallable, ISystem } from "
|
|
2
|
+
import type { ICommandConverter, IGetEventBridgeCallable, ISystem } from "../sync/types.js";
|
|
3
3
|
export interface ICreateSyncSystemHandlerOnRequestPluginParams {
|
|
4
4
|
getDocumentClient(): Pick<DynamoDBDocument, "send">;
|
|
5
5
|
getEventBridgeClient: IGetEventBridgeCallable;
|
package/sync/requestPlugin.js
CHANGED
|
@@ -1,59 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
handler
|
|
34
|
-
} = (0, _createHandler.createHandler)({
|
|
35
|
-
getEventBridgeClient: () => {
|
|
36
|
-
return params.getEventBridgeClient({
|
|
37
|
-
region: manifest.sync.region
|
|
1
|
+
import { createHandlerOnRequest } from "@webiny/handler";
|
|
2
|
+
import { getManifest } from "./utils/manifest.js";
|
|
3
|
+
import { attachToDynamoDbDocument } from "./attachToDynamoDbDocument.js";
|
|
4
|
+
import { createSendDataToEventBridgeOnRequestEnd } from "./createSendDataToEventBridgeOnRequestEnd.js";
|
|
5
|
+
import { createHandler } from "./createHandler.js";
|
|
6
|
+
import { convertException } from "@webiny/utils/exception.js";
|
|
7
|
+
const createSyncSystemHandlerOnRequestPlugin = (params)=>createHandlerOnRequest(async (_, __, context)=>{
|
|
8
|
+
const { data: manifest, error } = await getManifest();
|
|
9
|
+
if (error) {
|
|
10
|
+
if ("true" !== process.env.DEBUG) return;
|
|
11
|
+
console.error("Error happened when fetching manifest.");
|
|
12
|
+
console.log(JSON.stringify({
|
|
13
|
+
error: convertException(error)
|
|
14
|
+
}));
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (!manifest?.sync?.region) {
|
|
18
|
+
if ("true" !== process.env.DEBUG) return;
|
|
19
|
+
console.error("There is no manifest.");
|
|
20
|
+
console.log(JSON.stringify({
|
|
21
|
+
manifest
|
|
22
|
+
}));
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const { handler } = createHandler({
|
|
26
|
+
getEventBridgeClient: ()=>params.getEventBridgeClient({
|
|
27
|
+
region: manifest.sync.region
|
|
28
|
+
}),
|
|
29
|
+
system: params.system,
|
|
30
|
+
manifest,
|
|
31
|
+
commandConverters: params.commandConverters,
|
|
32
|
+
getPlugins: ()=>context.plugins
|
|
38
33
|
});
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
(0, _attachToDynamoDbDocument.attachToDynamoDbDocument)({
|
|
48
|
-
handler
|
|
34
|
+
attachToDynamoDbDocument({
|
|
35
|
+
handler
|
|
36
|
+
});
|
|
37
|
+
context.plugins.register([
|
|
38
|
+
createSendDataToEventBridgeOnRequestEnd(handler)
|
|
39
|
+
]);
|
|
49
40
|
});
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* When request ends, send the data to the EventBridge.
|
|
53
|
-
*/
|
|
54
|
-
(0, _createSendDataToEventBridgeOnRequestEnd.createSendDataToEventBridgeOnRequestEnd)(handler)]);
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
exports.createSyncSystemHandlerOnRequestPlugin = createSyncSystemHandlerOnRequestPlugin;
|
|
41
|
+
export { createSyncSystemHandlerOnRequestPlugin };
|
|
58
42
|
|
|
59
43
|
//# sourceMappingURL=requestPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"sync/requestPlugin.js","sources":["../../src/sync/requestPlugin.ts"],"sourcesContent":["import type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport type { ICommandConverter, IGetEventBridgeCallable, ISystem } from \"~/sync/types.js\";\nimport { createHandlerOnRequest } from \"@webiny/handler\";\nimport { getManifest } from \"~/sync/utils/manifest.js\";\nimport { attachToDynamoDbDocument } from \"~/sync/attachToDynamoDbDocument.js\";\nimport { createSendDataToEventBridgeOnRequestEnd } from \"~/sync/createSendDataToEventBridgeOnRequestEnd.js\";\nimport { createHandler } from \"./createHandler.js\";\nimport { convertException } from \"@webiny/utils/exception.js\";\n\nexport interface ICreateSyncSystemHandlerOnRequestPluginParams {\n getDocumentClient(): Pick<DynamoDBDocument, \"send\">;\n getEventBridgeClient: IGetEventBridgeCallable;\n system: ISystem;\n commandConverters?: ICommandConverter[];\n}\n\nexport const createSyncSystemHandlerOnRequestPlugin = (\n params: ICreateSyncSystemHandlerOnRequestPluginParams\n) => {\n return createHandlerOnRequest(async (_, __, context) => {\n const { data: manifest, error } = await getManifest();\n if (error) {\n if (process.env.DEBUG !== \"true\") {\n return;\n }\n console.error(\"Error happened when fetching manifest.\");\n console.log(\n JSON.stringify({\n error: convertException(error)\n })\n );\n return;\n } else if (!manifest?.sync?.region) {\n if (process.env.DEBUG !== \"true\") {\n return;\n }\n console.error(\"There is no manifest.\");\n console.log(\n JSON.stringify({\n manifest\n })\n );\n return;\n }\n\n const { handler } = createHandler({\n getEventBridgeClient: () => {\n return params.getEventBridgeClient({\n region: manifest.sync.region\n });\n },\n system: params.system,\n manifest,\n commandConverters: params.commandConverters,\n getPlugins: () => {\n return context.plugins;\n }\n });\n\n attachToDynamoDbDocument({\n handler\n });\n context.plugins.register([\n /**\n * When request ends, send the data to the EventBridge.\n */\n createSendDataToEventBridgeOnRequestEnd(handler)\n ]);\n });\n};\n"],"names":["createSyncSystemHandlerOnRequestPlugin","params","createHandlerOnRequest","_","__","context","manifest","error","getManifest","process","console","JSON","convertException","handler","createHandler","attachToDynamoDbDocument","createSendDataToEventBridgeOnRequestEnd"],"mappings":";;;;;;AAgBO,MAAMA,yCAAyC,CAClDC,SAEOC,uBAAuB,OAAOC,GAAGC,IAAIC;QACxC,MAAM,EAAE,MAAMC,QAAQ,EAAEC,KAAK,EAAE,GAAG,MAAMC;QACxC,IAAID,OAAO;YACP,IAAIE,AAAsB,WAAtBA,QAAQ,GAAG,CAAC,KAAK,EACjB;YAEJC,QAAQ,KAAK,CAAC;YACdA,QAAQ,GAAG,CACPC,KAAK,SAAS,CAAC;gBACX,OAAOC,iBAAiBL;YAC5B;YAEJ;QACJ;QAAO,IAAI,CAACD,UAAU,MAAM,QAAQ;YAChC,IAAIG,AAAsB,WAAtBA,QAAQ,GAAG,CAAC,KAAK,EACjB;YAEJC,QAAQ,KAAK,CAAC;YACdA,QAAQ,GAAG,CACPC,KAAK,SAAS,CAAC;gBACXL;YACJ;YAEJ;QACJ;QAEA,MAAM,EAAEO,OAAO,EAAE,GAAGC,cAAc;YAC9B,sBAAsB,IACXb,OAAO,oBAAoB,CAAC;oBAC/B,QAAQK,SAAS,IAAI,CAAC,MAAM;gBAChC;YAEJ,QAAQL,OAAO,MAAM;YACrBK;YACA,mBAAmBL,OAAO,iBAAiB;YAC3C,YAAY,IACDI,QAAQ,OAAO;QAE9B;QAEAU,yBAAyB;YACrBF;QACJ;QACAR,QAAQ,OAAO,CAAC,QAAQ,CAAC;YAIrBW,wCAAwCH;SAC3C;IACL"}
|
package/sync/types.js
CHANGED
|
@@ -1,22 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return _types.DynamoDBTableType.REGULAR;
|
|
12
|
-
case process.env.DB_TABLE_ELASTICSEARCH:
|
|
13
|
-
return _types.DynamoDBTableType.ELASTICSEARCH;
|
|
14
|
-
case process.env.DB_TABLE_LOG:
|
|
15
|
-
return _types.DynamoDBTableType.LOG;
|
|
16
|
-
default:
|
|
17
|
-
return _types.DynamoDBTableType.UNKNOWN;
|
|
18
|
-
}
|
|
1
|
+
import { DynamoDBTableType } from "../../types.js";
|
|
2
|
+
const getTableType = (tableName)=>{
|
|
3
|
+
switch(tableName){
|
|
4
|
+
case process.env.DB_TABLE:
|
|
5
|
+
return DynamoDBTableType.REGULAR;
|
|
6
|
+
case process.env.DB_TABLE_OPENSEARCH:
|
|
7
|
+
return DynamoDBTableType.OPENSEARCH;
|
|
8
|
+
default:
|
|
9
|
+
return DynamoDBTableType.UNKNOWN;
|
|
10
|
+
}
|
|
19
11
|
};
|
|
20
|
-
|
|
12
|
+
export { getTableType };
|
|
21
13
|
|
|
22
14
|
//# sourceMappingURL=getTableType.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"sync/utils/getTableType.js","sources":["../../../src/sync/utils/getTableType.ts"],"sourcesContent":["import { DynamoDBTableType } from \"~/types.js\";\n\nexport const getTableType = (tableName: string): DynamoDBTableType => {\n switch (tableName) {\n case process.env.DB_TABLE:\n return DynamoDBTableType.REGULAR;\n case process.env.DB_TABLE_OPENSEARCH:\n return DynamoDBTableType.OPENSEARCH;\n default:\n return DynamoDBTableType.UNKNOWN;\n }\n};\n"],"names":["getTableType","tableName","process","DynamoDBTableType"],"mappings":";AAEO,MAAMA,eAAe,CAACC;IACzB,OAAQA;QACJ,KAAKC,QAAQ,GAAG,CAAC,QAAQ;YACrB,OAAOC,kBAAkB,OAAO;QACpC,KAAKD,QAAQ,GAAG,CAAC,mBAAmB;YAChC,OAAOC,kBAAkB,UAAU;QACvC;YACI,OAAOA,kBAAkB,OAAO;IACxC;AACJ"}
|
package/sync/utils/manifest.d.ts
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
export interface IGetManifestParams {
|
|
3
|
-
getDocumentClient(): Pick<DynamoDBDocument, "send">;
|
|
4
|
-
}
|
|
5
|
-
export declare const getManifest: (params: IGetManifestParams) => Promise<{
|
|
1
|
+
export declare const getManifest: () => Promise<{
|
|
6
2
|
data: {
|
|
7
3
|
sync: {
|
|
8
|
-
region: string;
|
|
9
4
|
eventBusArn: string;
|
|
10
5
|
eventBusName: string;
|
|
6
|
+
region: string;
|
|
11
7
|
};
|
|
12
8
|
};
|
|
13
9
|
error?: undefined;
|
|
14
10
|
} | {
|
|
15
|
-
error: any;
|
|
16
11
|
data?: undefined;
|
|
12
|
+
error: any;
|
|
17
13
|
}>;
|
package/sync/utils/manifest.js
CHANGED
|
@@ -1,52 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _utils = require("@webiny/utils");
|
|
11
|
-
const validateManifest = _zod.default.object({
|
|
12
|
-
sync: _zod.default.object({
|
|
13
|
-
eventBusArn: _zod.default.string(),
|
|
14
|
-
eventBusName: _zod.default.string(),
|
|
15
|
-
region: _zod.default.string()
|
|
16
|
-
})
|
|
1
|
+
import { ServiceDiscovery } from "@webiny/api-core/features/serviceDiscovery/index.js";
|
|
2
|
+
import zod from "zod";
|
|
3
|
+
import { createZodError } from "@webiny/utils";
|
|
4
|
+
const validateManifest = zod.object({
|
|
5
|
+
sync: zod.object({
|
|
6
|
+
eventBusArn: zod.string(),
|
|
7
|
+
eventBusName: zod.string(),
|
|
8
|
+
region: zod.string()
|
|
9
|
+
})
|
|
17
10
|
});
|
|
18
|
-
const getManifest = async
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
error: err
|
|
39
|
-
};
|
|
11
|
+
const getManifest = async ()=>{
|
|
12
|
+
try {
|
|
13
|
+
const manifest = await ServiceDiscovery.load();
|
|
14
|
+
if (!manifest?.sync) return {
|
|
15
|
+
error: new Error("Sync System Manifest not found. Probably Sync System is not turned on.")
|
|
16
|
+
};
|
|
17
|
+
const { data, error } = validateManifest.safeParse(manifest);
|
|
18
|
+
if (error) {
|
|
19
|
+
const err = createZodError(error);
|
|
20
|
+
return {
|
|
21
|
+
error: err
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
data
|
|
26
|
+
};
|
|
27
|
+
} catch (ex) {
|
|
28
|
+
return {
|
|
29
|
+
error: ex
|
|
30
|
+
};
|
|
40
31
|
}
|
|
41
|
-
return {
|
|
42
|
-
data
|
|
43
|
-
};
|
|
44
|
-
} catch (ex) {
|
|
45
|
-
return {
|
|
46
|
-
error: ex
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
32
|
};
|
|
50
|
-
|
|
33
|
+
export { getManifest };
|
|
51
34
|
|
|
52
35
|
//# sourceMappingURL=manifest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"sync/utils/manifest.js","sources":["../../../src/sync/utils/manifest.ts"],"sourcesContent":["import { ServiceDiscovery } from \"@webiny/api-core/features/serviceDiscovery/index.js\";\nimport zod from \"zod\";\nimport { createZodError } from \"@webiny/utils\";\n\nconst validateManifest = zod.object({\n sync: zod.object({\n eventBusArn: zod.string(),\n eventBusName: zod.string(),\n region: zod.string()\n })\n});\n\nexport const getManifest = async () => {\n try {\n const manifest = await ServiceDiscovery.load();\n if (!manifest?.sync) {\n return {\n /*\n * This error will be silent. We do not want to log or throw at this point.\n */\n error: new Error(\n \"Sync System Manifest not found. Probably Sync System is not turned on.\"\n )\n };\n }\n const { data, error } = validateManifest.safeParse(manifest);\n if (error) {\n const err = createZodError(error);\n return {\n error: err\n };\n }\n return {\n data\n };\n } catch (ex) {\n return {\n error: ex\n };\n }\n};\n"],"names":["validateManifest","zod","getManifest","manifest","ServiceDiscovery","Error","data","error","err","createZodError","ex"],"mappings":";;;AAIA,MAAMA,mBAAmBC,IAAI,MAAM,CAAC;IAChC,MAAMA,IAAI,MAAM,CAAC;QACb,aAAaA,IAAI,MAAM;QACvB,cAAcA,IAAI,MAAM;QACxB,QAAQA,IAAI,MAAM;IACtB;AACJ;AAEO,MAAMC,cAAc;IACvB,IAAI;QACA,MAAMC,WAAW,MAAMC,iBAAiB,IAAI;QAC5C,IAAI,CAACD,UAAU,MACX,OAAO;YAIH,OAAO,IAAIE,MACP;QAER;QAEJ,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGP,iBAAiB,SAAS,CAACG;QACnD,IAAII,OAAO;YACP,MAAMC,MAAMC,eAAeF;YAC3B,OAAO;gBACH,OAAOC;YACX;QACJ;QACA,OAAO;YACHF;QACJ;IACJ,EAAE,OAAOI,IAAI;QACT,OAAO;YACH,OAAOA;QACX;IACJ;AACJ"}
|
|
@@ -1,44 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.validateSystemInput = void 0;
|
|
7
|
-
var _createSystemName = require("../../utils/createSystemName.js");
|
|
8
|
-
const validateSystemInput = input => {
|
|
9
|
-
const {
|
|
10
|
-
env,
|
|
11
|
-
region,
|
|
12
|
-
variant,
|
|
13
|
-
version
|
|
14
|
-
} = input;
|
|
15
|
-
if (!env) {
|
|
16
|
-
return {
|
|
17
|
-
error: "Sync System: No environment variable provided. Sync System will not be attached."
|
|
1
|
+
import { createSystemName } from "../../utils/createSystemName.js";
|
|
2
|
+
const validateSystemInput = (input)=>{
|
|
3
|
+
const { env, region, variant, version } = input;
|
|
4
|
+
if (!env) return {
|
|
5
|
+
error: "Sync System: No environment variable provided. Sync System will not be attached."
|
|
18
6
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
if (!region) return {
|
|
8
|
+
error: "Sync System: No region variable provided. Sync System will not be attached."
|
|
9
|
+
};
|
|
10
|
+
if (!version) return {
|
|
11
|
+
error: "Sync System: No version variable provided. Sync System will not be attached."
|
|
22
12
|
};
|
|
23
|
-
|
|
13
|
+
const name = createSystemName({
|
|
14
|
+
env,
|
|
15
|
+
variant
|
|
16
|
+
});
|
|
24
17
|
return {
|
|
25
|
-
|
|
18
|
+
system: {
|
|
19
|
+
env,
|
|
20
|
+
name,
|
|
21
|
+
region,
|
|
22
|
+
variant,
|
|
23
|
+
version
|
|
24
|
+
}
|
|
26
25
|
};
|
|
27
|
-
}
|
|
28
|
-
const name = (0, _createSystemName.createSystemName)({
|
|
29
|
-
env,
|
|
30
|
-
variant
|
|
31
|
-
});
|
|
32
|
-
return {
|
|
33
|
-
system: {
|
|
34
|
-
env,
|
|
35
|
-
name,
|
|
36
|
-
region,
|
|
37
|
-
variant,
|
|
38
|
-
version
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
26
|
};
|
|
42
|
-
|
|
27
|
+
export { validateSystemInput };
|
|
43
28
|
|
|
44
29
|
//# sourceMappingURL=validateSystemInput.js.map
|