@webiny/api-sync-system 0.0.0-unstable.9bd236cf5e → 0.0.0-unstable.ac6ebf63c6
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 +1 -7
- package/constants.js.map +1 -1
- package/index.js +3 -38
- package/index.js.map +1 -1
- package/package.json +20 -23
- package/resolver/app/RecordHandler.d.ts +6 -6
- package/resolver/app/RecordHandler.js +7 -15
- package/resolver/app/RecordHandler.js.map +1 -1
- package/resolver/app/RecordsValidation.js +6 -14
- package/resolver/app/RecordsValidation.js.map +1 -1
- package/resolver/app/ResolverApplication.d.ts +1 -1
- package/resolver/app/ResolverApplication.js +10 -18
- package/resolver/app/ResolverApplication.js.map +1 -1
- package/resolver/app/abstractions/RecordHandler.d.ts +1 -1
- package/resolver/app/abstractions/RecordHandler.js +1 -5
- package/resolver/app/abstractions/RecordsValidation.d.ts +2 -2
- package/resolver/app/abstractions/RecordsValidation.js +1 -5
- package/resolver/app/abstractions/RecordsValidation.js.map +1 -1
- package/resolver/app/abstractions/ResolverApplication.js +1 -5
- package/resolver/app/abstractions/ResolverRecord.d.ts +1 -1
- package/resolver/app/abstractions/ResolverRecord.js +1 -5
- package/resolver/app/abstractions/ResolverRecord.js.map +1 -1
- package/resolver/app/bundler/BaseBundle.d.ts +6 -6
- package/resolver/app/bundler/BaseBundle.js +1 -8
- package/resolver/app/bundler/BaseBundle.js.map +1 -1
- package/resolver/app/bundler/Bundler.d.ts +1 -1
- package/resolver/app/bundler/Bundler.js +2 -10
- package/resolver/app/bundler/Bundler.js.map +1 -1
- package/resolver/app/bundler/Bundles.d.ts +2 -2
- package/resolver/app/bundler/Bundles.js +2 -10
- package/resolver/app/bundler/Bundles.js.map +1 -1
- package/resolver/app/bundler/CommandBundle.d.ts +1 -1
- package/resolver/app/bundler/CommandBundle.js +3 -11
- package/resolver/app/bundler/CommandBundle.js.map +1 -1
- package/resolver/app/bundler/TableBundle.d.ts +1 -1
- package/resolver/app/bundler/TableBundle.js +3 -11
- package/resolver/app/bundler/TableBundle.js.map +1 -1
- package/resolver/app/bundler/types.d.ts +2 -2
- package/resolver/app/bundler/types.js +1 -5
- package/resolver/app/commandHandler/DeleteCommandHandler.d.ts +3 -3
- package/resolver/app/commandHandler/DeleteCommandHandler.js +1 -8
- package/resolver/app/commandHandler/DeleteCommandHandler.js.map +1 -1
- package/resolver/app/commandHandler/PutCommandHandler.d.ts +4 -4
- package/resolver/app/commandHandler/PutCommandHandler.js +1 -8
- package/resolver/app/commandHandler/PutCommandHandler.js.map +1 -1
- package/resolver/app/commandHandler/delete.d.ts +1 -1
- package/resolver/app/commandHandler/delete.js +6 -13
- package/resolver/app/commandHandler/delete.js.map +1 -1
- package/resolver/app/commandHandler/put.d.ts +1 -1
- package/resolver/app/commandHandler/put.js +6 -13
- package/resolver/app/commandHandler/put.js.map +1 -1
- package/resolver/app/data/SourceDataContainer.d.ts +3 -3
- package/resolver/app/data/SourceDataContainer.js +1 -8
- package/resolver/app/data/SourceDataContainer.js.map +1 -1
- package/resolver/app/data/types.d.ts +2 -2
- package/resolver/app/data/types.js +1 -5
- package/resolver/app/fetcher/Fetcher.d.ts +3 -3
- package/resolver/app/fetcher/Fetcher.js +13 -22
- package/resolver/app/fetcher/Fetcher.js.map +1 -1
- package/resolver/app/fetcher/types.d.ts +2 -2
- package/resolver/app/fetcher/types.js +1 -5
- package/resolver/app/ingestor/Ingestor.d.ts +1 -1
- package/resolver/app/ingestor/Ingestor.js +2 -10
- package/resolver/app/ingestor/Ingestor.js.map +1 -1
- package/resolver/app/ingestor/IngestorResult.js +3 -11
- package/resolver/app/ingestor/IngestorResult.js.map +1 -1
- package/resolver/app/ingestor/types.d.ts +2 -2
- package/resolver/app/ingestor/types.js +1 -5
- package/resolver/app/storer/Storer.d.ts +3 -3
- package/resolver/app/storer/Storer.js +12 -20
- package/resolver/app/storer/Storer.js.map +1 -1
- package/resolver/app/storer/types.d.ts +2 -2
- package/resolver/app/storer/types.js +1 -5
- package/resolver/app/storer/types.js.map +1 -1
- package/resolver/app/transform/TransformHandler.d.ts +4 -4
- package/resolver/app/transform/TransformHandler.js +5 -12
- package/resolver/app/transform/TransformHandler.js.map +1 -1
- package/resolver/app/transform/middleware.d.ts +1 -1
- package/resolver/app/transform/middleware.js +1 -7
- package/resolver/app/transform/middleware.js.map +1 -1
- package/resolver/app/utils/Retry.js +4 -12
- package/resolver/app/utils/Retry.js.map +1 -1
- package/resolver/app/utils/sleep.js +1 -8
- package/resolver/app/utils/sleep.js.map +1 -1
- package/resolver/app/validation/body.d.ts +43 -43
- package/resolver/app/validation/body.js +22 -30
- package/resolver/app/validation/body.js.map +1 -1
- package/resolver/app/validation/createJsonTransform.js +6 -14
- package/resolver/app/validation/createJsonTransform.js.map +1 -1
- package/resolver/app/validation/detail.d.ts +22 -22
- package/resolver/app/validation/detail.js +16 -24
- package/resolver/app/validation/detail.js.map +1 -1
- package/resolver/app/validation/event.d.ts +57 -57
- package/resolver/app/validation/event.js +19 -27
- package/resolver/app/validation/event.js.map +1 -1
- package/resolver/app/validation/numericString.js +5 -13
- package/resolver/app/validation/numericString.js.map +1 -1
- package/resolver/app/validation/system.d.ts +4 -4
- package/resolver/app/validation/system.js +8 -16
- package/resolver/app/validation/system.js.map +1 -1
- package/resolver/createEventHandlerPlugin.d.ts +2 -1
- package/resolver/createEventHandlerPlugin.js +35 -42
- package/resolver/createEventHandlerPlugin.js.map +1 -1
- package/resolver/createResolverHandler.d.ts +1 -1
- package/resolver/createResolverHandler.js +24 -31
- package/resolver/createResolverHandler.js.map +1 -1
- package/resolver/deployment/Deployment.d.ts +2 -3
- package/resolver/deployment/Deployment.js +6 -14
- package/resolver/deployment/Deployment.js.map +1 -1
- package/resolver/deployment/Deployments.js +2 -10
- package/resolver/deployment/Deployments.js.map +1 -1
- package/resolver/deployment/DeploymentsFetcher.js +33 -42
- package/resolver/deployment/DeploymentsFetcher.js.map +1 -1
- package/resolver/deployment/types.d.ts +4 -4
- package/resolver/deployment/types.js +1 -5
- package/resolver/deployment/types.js.map +1 -1
- package/resolver/lambda/LambdaTrigger.js +5 -12
- package/resolver/lambda/LambdaTrigger.js.map +1 -1
- package/resolver/plugins/CommandHandlerPlugin.d.ts +3 -3
- package/resolver/plugins/CommandHandlerPlugin.js +3 -11
- package/resolver/plugins/CommandHandlerPlugin.js.map +1 -1
- package/resolver/plugins/StorerAfterEachPlugin.d.ts +2 -2
- package/resolver/plugins/StorerAfterEachPlugin.js +4 -13
- package/resolver/plugins/StorerAfterEachPlugin.js.map +1 -1
- package/resolver/plugins/TransformRecordPlugin.d.ts +3 -3
- package/resolver/plugins/TransformRecordPlugin.js +3 -11
- package/resolver/plugins/TransformRecordPlugin.js.map +1 -1
- package/resolver/recordTypes/fileManager/CopyFile.js +4 -11
- package/resolver/recordTypes/fileManager/CopyFile.js.map +1 -1
- package/resolver/recordTypes/fileManager/DeleteFile.d.ts +1 -1
- package/resolver/recordTypes/fileManager/DeleteFile.js +3 -10
- package/resolver/recordTypes/fileManager/DeleteFile.js.map +1 -1
- package/resolver/recordTypes/fileManager/fileManager.d.ts +1 -1
- package/resolver/recordTypes/fileManager/fileManager.js +4 -11
- package/resolver/recordTypes/fileManager/fileManager.js.map +1 -1
- package/resolver/recordTypes/fileManager/fileManagerOnDelete.d.ts +1 -1
- package/resolver/recordTypes/fileManager/fileManagerOnDelete.js +7 -14
- package/resolver/recordTypes/fileManager/fileManagerOnDelete.js.map +1 -1
- package/resolver/recordTypes/fileManager/fileManagerOnPut.d.ts +1 -1
- package/resolver/recordTypes/fileManager/fileManagerOnPut.js +7 -14
- package/resolver/recordTypes/fileManager/fileManagerOnPut.js.map +1 -1
- package/resolver/recordTypes/fileManager/shouldBeHandled.d.ts +1 -1
- package/resolver/recordTypes/fileManager/shouldBeHandled.js +1 -8
- package/resolver/recordTypes/fileManager/shouldBeHandled.js.map +1 -1
- package/resolver/recordTypes/fileManager/types.d.ts +2 -2
- package/resolver/recordTypes/fileManager/types.js +1 -5
- package/resolver/recordTypes/users/CopyUser.d.ts +2 -2
- package/resolver/recordTypes/users/CopyUser.js +3 -10
- package/resolver/recordTypes/users/CopyUser.js.map +1 -1
- package/resolver/recordTypes/users/DeleteUser.d.ts +2 -2
- package/resolver/recordTypes/users/DeleteUser.js +3 -10
- package/resolver/recordTypes/users/DeleteUser.js.map +1 -1
- package/resolver/recordTypes/users/shouldBeHandled.d.ts +1 -1
- package/resolver/recordTypes/users/shouldBeHandled.js +1 -8
- package/resolver/recordTypes/users/shouldBeHandled.js.map +1 -1
- package/resolver/recordTypes/users/types.d.ts +1 -1
- package/resolver/recordTypes/users/types.js +1 -5
- package/resolver/recordTypes/users/types.js.map +1 -1
- package/resolver/recordTypes/users/users.js +4 -11
- package/resolver/recordTypes/users/users.js.map +1 -1
- package/resolver/recordTypes/users/usersOnDelete.d.ts +2 -2
- package/resolver/recordTypes/users/usersOnDelete.js +7 -14
- package/resolver/recordTypes/users/usersOnDelete.js.map +1 -1
- package/resolver/recordTypes/users/usersOnPut.d.ts +2 -2
- package/resolver/recordTypes/users/usersOnPut.js +7 -14
- package/resolver/recordTypes/users/usersOnPut.js.map +1 -1
- package/sync/FilterOutRecord.d.ts +2 -2
- package/sync/FilterOutRecord.js +2 -10
- package/sync/FilterOutRecord.js.map +1 -1
- package/sync/attachToDynamoDbDocument.d.ts +1 -1
- package/sync/attachToDynamoDbDocument.js +9 -17
- package/sync/attachToDynamoDbDocument.js.map +1 -1
- package/sync/createHandler.js +27 -34
- package/sync/createHandler.js.map +1 -1
- package/sync/createSendDataToEventBridgeOnRequestEnd.js +6 -13
- package/sync/createSendDataToEventBridgeOnRequestEnd.js.map +1 -1
- package/sync/createSyncSystem.d.ts +1 -1
- package/sync/createSyncSystem.js +6 -13
- package/sync/createSyncSystem.js.map +1 -1
- package/sync/filter/createDefaultFilterOutRecordPlugins.d.ts +1 -1
- package/sync/filter/createDefaultFilterOutRecordPlugins.js +9 -19
- package/sync/filter/createDefaultFilterOutRecordPlugins.js.map +1 -1
- package/sync/handler/Handler.d.ts +2 -2
- package/sync/handler/Handler.js +9 -17
- package/sync/handler/Handler.js.map +1 -1
- package/sync/handler/HandlerConverter.js +2 -10
- package/sync/handler/HandlerConverter.js.map +1 -1
- package/sync/handler/converter/BatchGetCommandConverter.js +6 -14
- package/sync/handler/converter/BatchGetCommandConverter.js.map +1 -1
- package/sync/handler/converter/BatchWriteCommandConverter.js +6 -14
- package/sync/handler/converter/BatchWriteCommandConverter.js.map +1 -1
- package/sync/handler/converter/DeleteCommandConverter.js +6 -14
- package/sync/handler/converter/DeleteCommandConverter.js.map +1 -1
- package/sync/handler/converter/GetCommandConverter.js +6 -14
- package/sync/handler/converter/GetCommandConverter.js.map +1 -1
- package/sync/handler/converter/PutCommandConverter.js +6 -14
- package/sync/handler/converter/PutCommandConverter.js.map +1 -1
- package/sync/handler/converter/QueryCommandConverter.js +6 -14
- package/sync/handler/converter/QueryCommandConverter.js.map +1 -1
- package/sync/handler/converter/ScanCommandConverter.js +6 -14
- package/sync/handler/converter/ScanCommandConverter.js.map +1 -1
- package/sync/handler/converter/UpdateCommandConverter.js +6 -14
- 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 +4 -11
- 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 +3 -10
- 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 +1 -8
- 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 +3 -10
- 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 +3 -10
- package/sync/handler/converter/commands/UpdateCommandValue.js.map +1 -1
- package/sync/handler/types.d.ts +3 -3
- package/sync/handler/types.js +1 -5
- package/sync/handler/types.js.map +1 -1
- package/sync/plugins/FilterOutRecordPlugin.d.ts +1 -1
- package/sync/plugins/FilterOutRecordPlugin.js +3 -11
- package/sync/plugins/FilterOutRecordPlugin.js.map +1 -1
- package/sync/requestPlugin.d.ts +1 -1
- package/sync/requestPlugin.js +19 -20
- package/sync/requestPlugin.js.map +1 -1
- package/sync/types.js +1 -5
- package/sync/utils/getTableType.js +7 -14
- package/sync/utils/getTableType.js.map +1 -1
- package/sync/utils/manifest.d.ts +1 -1
- package/sync/utils/manifest.js +12 -20
- package/sync/utils/manifest.js.map +1 -1
- package/sync/utils/validateSystemInput.d.ts +1 -1
- package/sync/utils/validateSystemInput.js +3 -10
- package/sync/utils/validateSystemInput.js.map +1 -1
- package/types.d.ts +3 -4
- package/types.js +2 -8
- package/types.js.map +1 -1
- package/utils/createSystemName.js +1 -8
- package/utils/createSystemName.js.map +1 -1
- package/worker/actions/copyFile/CopyFile.js +13 -21
- package/worker/actions/copyFile/CopyFile.js.map +1 -1
- package/worker/actions/copyFile/copyFileAction.d.ts +1 -1
- package/worker/actions/copyFile/copyFileAction.js +9 -16
- package/worker/actions/copyFile/copyFileAction.js.map +1 -1
- package/worker/actions/copyFile/copyFileSchema.d.ts +2 -2
- package/worker/actions/copyFile/copyFileSchema.js +8 -16
- package/worker/actions/copyFile/copyFileSchema.js.map +1 -1
- package/worker/actions/copyFile/types.js +1 -5
- package/worker/actions/createUser/CreateUser.d.ts +1 -1
- package/worker/actions/createUser/CreateUser.js +9 -16
- package/worker/actions/createUser/CreateUser.js.map +1 -1
- package/worker/actions/createUser/createUserAction.d.ts +2 -2
- package/worker/actions/createUser/createUserAction.js +9 -16
- package/worker/actions/createUser/createUserAction.js.map +1 -1
- package/worker/actions/createUser/createUserSchema.d.ts +2 -2
- package/worker/actions/createUser/createUserSchema.js +8 -16
- package/worker/actions/createUser/createUserSchema.js.map +1 -1
- package/worker/actions/createUser/types.js +1 -5
- package/worker/actions/deleteFile/DeleteFile.js +4 -11
- package/worker/actions/deleteFile/DeleteFile.js.map +1 -1
- package/worker/actions/deleteFile/deleteFileAction.d.ts +1 -1
- package/worker/actions/deleteFile/deleteFileAction.js +9 -16
- package/worker/actions/deleteFile/deleteFileAction.js.map +1 -1
- package/worker/actions/deleteFile/deleteFileSchema.d.ts +2 -2
- package/worker/actions/deleteFile/deleteFileSchema.js +8 -16
- package/worker/actions/deleteFile/deleteFileSchema.js.map +1 -1
- package/worker/actions/deleteFile/types.js +1 -5
- package/worker/actions/deleteUser/DeleteUser.d.ts +2 -2
- package/worker/actions/deleteUser/DeleteUser.js +7 -14
- package/worker/actions/deleteUser/DeleteUser.js.map +1 -1
- package/worker/actions/deleteUser/deleteUserAction.d.ts +1 -1
- package/worker/actions/deleteUser/deleteUserAction.js +9 -16
- package/worker/actions/deleteUser/deleteUserAction.js.map +1 -1
- package/worker/actions/deleteUser/deleteUserSchema.js +8 -16
- package/worker/actions/deleteUser/deleteUserSchema.js.map +1 -1
- package/worker/actions/deleteUser/types.js +1 -5
- package/worker/actions/logValidationError.js +4 -11
- package/worker/actions/logValidationError.js.map +1 -1
- package/worker/actions/removeCognitoUserAttributes.js +1 -8
- package/worker/actions/removeCognitoUserAttributes.js.map +1 -1
- package/worker/actions/updateUser/UpdateUser.d.ts +1 -1
- package/worker/actions/updateUser/UpdateUser.js +9 -16
- package/worker/actions/updateUser/UpdateUser.js.map +1 -1
- package/worker/actions/updateUser/types.js +1 -5
- package/worker/actions/updateUser/updateUserAction.d.ts +2 -2
- package/worker/actions/updateUser/updateUserAction.js +9 -16
- package/worker/actions/updateUser/updateUserAction.js.map +1 -1
- package/worker/actions/updateUser/updateUserSchema.d.ts +2 -2
- package/worker/actions/updateUser/updateUserSchema.js +8 -16
- package/worker/actions/updateUser/updateUserSchema.js.map +1 -1
- package/worker/createWorkerHandler.js +17 -24
- package/worker/createWorkerHandler.js.map +1 -1
- package/worker/handler/WorkerActionHandler.d.ts +2 -2
- package/worker/handler/WorkerActionHandler.js +3 -10
- package/worker/handler/WorkerActionHandler.js.map +1 -1
- package/worker/handler/eventHandler.js +9 -16
- package/worker/handler/eventHandler.js.map +1 -1
- package/worker/plugins/WorkerActionPlugin.d.ts +1 -1
- package/worker/plugins/WorkerActionPlugin.js +3 -11
- package/worker/plugins/WorkerActionPlugin.js.map +1 -1
- package/worker/types.js +1 -5
|
@@ -16,38 +16,38 @@ export declare const createEventValidation: () => zod.ZodArray<zod.ZodObject<{
|
|
|
16
16
|
PK: zod.ZodString;
|
|
17
17
|
SK: zod.ZodString;
|
|
18
18
|
tableName: zod.ZodString;
|
|
19
|
-
tableType: zod.ZodEffects<zod.ZodEnum<["regular", "
|
|
19
|
+
tableType: zod.ZodEffects<zod.ZodEnum<["regular", "opensearch", "log", "unknown"]>, import("../../../types").DynamoDBTableType, "unknown" | "regular" | "opensearch" | "log">;
|
|
20
20
|
command: zod.ZodEnum<["update", "put", "delete"]>;
|
|
21
21
|
}, "strip", zod.ZodTypeAny, {
|
|
22
22
|
PK: string;
|
|
23
23
|
SK: string;
|
|
24
24
|
tableName: string;
|
|
25
25
|
tableType: import("../../../types").DynamoDBTableType;
|
|
26
|
-
command: "
|
|
26
|
+
command: "put" | "delete" | "update";
|
|
27
27
|
}, {
|
|
28
28
|
PK: string;
|
|
29
29
|
SK: string;
|
|
30
30
|
tableName: string;
|
|
31
|
-
tableType: "unknown" | "
|
|
32
|
-
command: "
|
|
31
|
+
tableType: "unknown" | "regular" | "opensearch" | "log";
|
|
32
|
+
command: "put" | "delete" | "update";
|
|
33
33
|
}>, "many">, {
|
|
34
34
|
PK: string;
|
|
35
35
|
SK: string;
|
|
36
36
|
tableName: string;
|
|
37
37
|
tableType: import("../../../types").DynamoDBTableType;
|
|
38
|
-
command: "
|
|
38
|
+
command: "put" | "delete" | "update";
|
|
39
39
|
}[], {
|
|
40
40
|
PK: string;
|
|
41
41
|
SK: string;
|
|
42
42
|
tableName: string;
|
|
43
|
-
tableType: "unknown" | "
|
|
44
|
-
command: "
|
|
43
|
+
tableType: "unknown" | "regular" | "opensearch" | "log";
|
|
44
|
+
command: "put" | "delete" | "update";
|
|
45
45
|
}[]>, import("@webiny/api/types").NonEmptyArray<import("../abstractions/ResolverRecord").IResolverRecordBodyItem>, {
|
|
46
46
|
PK: string;
|
|
47
47
|
SK: string;
|
|
48
48
|
tableName: string;
|
|
49
|
-
tableType: "unknown" | "
|
|
50
|
-
command: "
|
|
49
|
+
tableType: "unknown" | "regular" | "opensearch" | "log";
|
|
50
|
+
command: "put" | "delete" | "update";
|
|
51
51
|
}[]>;
|
|
52
52
|
source: zod.ZodObject<{
|
|
53
53
|
name: zod.ZodString;
|
|
@@ -56,92 +56,92 @@ export declare const createEventValidation: () => zod.ZodArray<zod.ZodObject<{
|
|
|
56
56
|
region: zod.ZodString;
|
|
57
57
|
version: zod.ZodString;
|
|
58
58
|
}, "strip", zod.ZodTypeAny, {
|
|
59
|
-
name: string;
|
|
60
59
|
region: string;
|
|
61
|
-
|
|
60
|
+
name: string;
|
|
62
61
|
env: string;
|
|
62
|
+
version: string;
|
|
63
63
|
variant?: string | undefined;
|
|
64
64
|
}, {
|
|
65
|
-
name: string;
|
|
66
65
|
region: string;
|
|
67
|
-
|
|
66
|
+
name: string;
|
|
68
67
|
env: string;
|
|
68
|
+
version: string;
|
|
69
69
|
variant?: string | null | undefined;
|
|
70
70
|
}>;
|
|
71
71
|
id: zod.ZodString;
|
|
72
72
|
}, "strip", zod.ZodTypeAny, {
|
|
73
|
-
id: string;
|
|
74
73
|
source: {
|
|
75
|
-
name: string;
|
|
76
74
|
region: string;
|
|
77
|
-
|
|
75
|
+
name: string;
|
|
78
76
|
env: string;
|
|
77
|
+
version: string;
|
|
79
78
|
variant?: string | undefined;
|
|
80
79
|
};
|
|
81
80
|
items: import("@webiny/api/types").NonEmptyArray<import("../abstractions/ResolverRecord").IResolverRecordBodyItem>;
|
|
82
|
-
}, {
|
|
83
81
|
id: string;
|
|
82
|
+
}, {
|
|
84
83
|
source: {
|
|
85
|
-
name: string;
|
|
86
84
|
region: string;
|
|
87
|
-
|
|
85
|
+
name: string;
|
|
88
86
|
env: string;
|
|
87
|
+
version: string;
|
|
89
88
|
variant?: string | null | undefined;
|
|
90
89
|
};
|
|
91
90
|
items: {
|
|
92
91
|
PK: string;
|
|
93
92
|
SK: string;
|
|
94
93
|
tableName: string;
|
|
95
|
-
tableType: "unknown" | "
|
|
96
|
-
command: "
|
|
94
|
+
tableType: "unknown" | "regular" | "opensearch" | "log";
|
|
95
|
+
command: "put" | "delete" | "update";
|
|
97
96
|
}[];
|
|
97
|
+
id: string;
|
|
98
98
|
}>;
|
|
99
99
|
}, "strip", zod.ZodTypeAny, {
|
|
100
|
+
region: string;
|
|
101
|
+
source: `webiny:${string}`;
|
|
102
|
+
version: `${number}`;
|
|
103
|
+
id: string;
|
|
104
|
+
"detail-type": "synchronization-input";
|
|
105
|
+
account: `${number}`;
|
|
100
106
|
time: Date;
|
|
107
|
+
resources: string[];
|
|
101
108
|
detail: {
|
|
102
|
-
id: string;
|
|
103
109
|
source: {
|
|
104
|
-
name: string;
|
|
105
110
|
region: string;
|
|
106
|
-
|
|
111
|
+
name: string;
|
|
107
112
|
env: string;
|
|
113
|
+
version: string;
|
|
108
114
|
variant?: string | undefined;
|
|
109
115
|
};
|
|
110
116
|
items: import("@webiny/api/types").NonEmptyArray<import("../abstractions/ResolverRecord").IResolverRecordBodyItem>;
|
|
117
|
+
id: string;
|
|
111
118
|
};
|
|
112
|
-
id: string;
|
|
113
|
-
source: `webiny:${string}`;
|
|
114
|
-
region: string;
|
|
115
|
-
"detail-type": "synchronization-input";
|
|
116
|
-
version: `${number}`;
|
|
117
|
-
account: `${number}`;
|
|
118
|
-
resources: string[];
|
|
119
119
|
}, {
|
|
120
|
+
region: string;
|
|
121
|
+
source: string;
|
|
122
|
+
version: string;
|
|
123
|
+
id: string;
|
|
124
|
+
"detail-type": string;
|
|
125
|
+
account: string;
|
|
120
126
|
time: string;
|
|
127
|
+
resources: string[];
|
|
121
128
|
detail: {
|
|
122
|
-
id: string;
|
|
123
129
|
source: {
|
|
124
|
-
name: string;
|
|
125
130
|
region: string;
|
|
126
|
-
|
|
131
|
+
name: string;
|
|
127
132
|
env: string;
|
|
133
|
+
version: string;
|
|
128
134
|
variant?: string | null | undefined;
|
|
129
135
|
};
|
|
130
136
|
items: {
|
|
131
137
|
PK: string;
|
|
132
138
|
SK: string;
|
|
133
139
|
tableName: string;
|
|
134
|
-
tableType: "unknown" | "
|
|
135
|
-
command: "
|
|
140
|
+
tableType: "unknown" | "regular" | "opensearch" | "log";
|
|
141
|
+
command: "put" | "delete" | "update";
|
|
136
142
|
}[];
|
|
143
|
+
id: string;
|
|
137
144
|
};
|
|
138
|
-
id: string;
|
|
139
|
-
source: string;
|
|
140
|
-
region: string;
|
|
141
|
-
"detail-type": string;
|
|
142
|
-
version: string;
|
|
143
|
-
account: string;
|
|
144
|
-
resources: string[];
|
|
145
145
|
}>>;
|
|
146
146
|
attributes: zod.ZodObject<{
|
|
147
147
|
ApproximateReceiveCount: zod.ZodString;
|
|
@@ -166,34 +166,34 @@ export declare const createEventValidation: () => zod.ZodArray<zod.ZodObject<{
|
|
|
166
166
|
awsRegion: zod.ZodString;
|
|
167
167
|
}, "strip", zod.ZodTypeAny, {
|
|
168
168
|
body: {
|
|
169
|
+
region: string;
|
|
170
|
+
source: `webiny:${string}`;
|
|
171
|
+
version: `${number}`;
|
|
172
|
+
id: string;
|
|
173
|
+
"detail-type": "synchronization-input";
|
|
174
|
+
account: `${number}`;
|
|
169
175
|
time: Date;
|
|
176
|
+
resources: string[];
|
|
170
177
|
detail: {
|
|
171
|
-
id: string;
|
|
172
178
|
source: {
|
|
173
|
-
name: string;
|
|
174
179
|
region: string;
|
|
175
|
-
|
|
180
|
+
name: string;
|
|
176
181
|
env: string;
|
|
182
|
+
version: string;
|
|
177
183
|
variant?: string | undefined;
|
|
178
184
|
};
|
|
179
185
|
items: import("@webiny/api/types").NonEmptyArray<import("../abstractions/ResolverRecord").IResolverRecordBodyItem>;
|
|
186
|
+
id: string;
|
|
180
187
|
};
|
|
181
|
-
id: string;
|
|
182
|
-
source: `webiny:${string}`;
|
|
183
|
-
region: string;
|
|
184
|
-
"detail-type": "synchronization-input";
|
|
185
|
-
version: `${number}`;
|
|
186
|
-
account: `${number}`;
|
|
187
|
-
resources: string[];
|
|
188
188
|
};
|
|
189
|
+
messageId: string;
|
|
190
|
+
receiptHandle: string;
|
|
189
191
|
attributes: {
|
|
190
192
|
ApproximateReceiveCount: string;
|
|
191
193
|
SentTimestamp: string;
|
|
192
194
|
SenderId: string;
|
|
193
195
|
ApproximateFirstReceiveTimestamp: string;
|
|
194
196
|
};
|
|
195
|
-
messageId: string;
|
|
196
|
-
receiptHandle: string;
|
|
197
197
|
md5OfBody: string;
|
|
198
198
|
eventSource: string;
|
|
199
199
|
eventSourceARN: string;
|
|
@@ -201,14 +201,14 @@ export declare const createEventValidation: () => zod.ZodArray<zod.ZodObject<{
|
|
|
201
201
|
messageAttributes?: zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough"> | undefined;
|
|
202
202
|
}, {
|
|
203
203
|
body: string;
|
|
204
|
+
messageId: string;
|
|
205
|
+
receiptHandle: string;
|
|
204
206
|
attributes: {
|
|
205
207
|
ApproximateReceiveCount: string;
|
|
206
208
|
SentTimestamp: string;
|
|
207
209
|
SenderId: string;
|
|
208
210
|
ApproximateFirstReceiveTimestamp: string;
|
|
209
211
|
};
|
|
210
|
-
messageId: string;
|
|
211
|
-
receiptHandle: string;
|
|
212
212
|
md5OfBody: string;
|
|
213
213
|
eventSource: string;
|
|
214
214
|
eventSourceARN: string;
|
|
@@ -1,32 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
receiptHandle: _zod.default.string(),
|
|
16
|
-
body: bodyTransform.pipe((0, _body.createBodyValidation)()),
|
|
17
|
-
attributes: _zod.default.object({
|
|
18
|
-
ApproximateReceiveCount: _zod.default.string(),
|
|
19
|
-
SentTimestamp: _zod.default.string(),
|
|
20
|
-
SenderId: _zod.default.string(),
|
|
21
|
-
ApproximateFirstReceiveTimestamp: _zod.default.string()
|
|
1
|
+
import zod from "zod";
|
|
2
|
+
import { createJsonTransform } from "./createJsonTransform.js";
|
|
3
|
+
import { createBodyValidation } from "./body.js";
|
|
4
|
+
const bodyTransform = createJsonTransform("Body");
|
|
5
|
+
export const createEventValidation = () => {
|
|
6
|
+
return zod.array(zod.object({
|
|
7
|
+
messageId: zod.string(),
|
|
8
|
+
receiptHandle: zod.string(),
|
|
9
|
+
body: bodyTransform.pipe(createBodyValidation()),
|
|
10
|
+
attributes: zod.object({
|
|
11
|
+
ApproximateReceiveCount: zod.string(),
|
|
12
|
+
SentTimestamp: zod.string(),
|
|
13
|
+
SenderId: zod.string(),
|
|
14
|
+
ApproximateFirstReceiveTimestamp: zod.string()
|
|
22
15
|
}),
|
|
23
|
-
messageAttributes:
|
|
24
|
-
md5OfBody:
|
|
25
|
-
eventSource:
|
|
26
|
-
eventSourceARN:
|
|
27
|
-
awsRegion:
|
|
16
|
+
messageAttributes: zod.object({}).passthrough().optional(),
|
|
17
|
+
md5OfBody: zod.string(),
|
|
18
|
+
eventSource: zod.string(),
|
|
19
|
+
eventSourceARN: zod.string(),
|
|
20
|
+
awsRegion: zod.string()
|
|
28
21
|
}));
|
|
29
22
|
};
|
|
30
|
-
exports.createEventValidation = createEventValidation;
|
|
31
23
|
|
|
32
24
|
//# sourceMappingURL=event.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["zod","createJsonTransform","createBodyValidation","bodyTransform","createEventValidation","array","object","messageId","string","receiptHandle","body","pipe","attributes","ApproximateReceiveCount","SentTimestamp","SenderId","ApproximateFirstReceiveTimestamp","messageAttributes","passthrough","optional","md5OfBody","eventSource","eventSourceARN","awsRegion"],"sources":["event.ts"],"sourcesContent":["import zod from \"zod\";\nimport { createJsonTransform } from \"~/resolver/app/validation/createJsonTransform.js\";\nimport { createBodyValidation } from \"~/resolver/app/validation/body.js\";\n\nconst bodyTransform = createJsonTransform(\"Body\");\n\nexport const createEventValidation = () => {\n return zod.array(\n zod.object({\n messageId: zod.string(),\n receiptHandle: zod.string(),\n body: bodyTransform.pipe(createBodyValidation()),\n attributes: zod.object({\n ApproximateReceiveCount: zod.string(),\n SentTimestamp: zod.string(),\n SenderId: zod.string(),\n ApproximateFirstReceiveTimestamp: zod.string()\n }),\n messageAttributes: zod.object({}).passthrough().optional(),\n md5OfBody: zod.string(),\n eventSource: zod.string(),\n eventSourceARN: zod.string(),\n awsRegion: zod.string()\n })\n );\n};\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,KAAK;AACrB,SAASC,mBAAmB;AAC5B,SAASC,oBAAoB;AAE7B,MAAMC,aAAa,GAAGF,mBAAmB,CAAC,MAAM,CAAC;AAEjD,OAAO,MAAMG,qBAAqB,GAAGA,CAAA,KAAM;EACvC,OAAOJ,GAAG,CAACK,KAAK,CACZL,GAAG,CAACM,MAAM,CAAC;IACPC,SAAS,EAAEP,GAAG,CAACQ,MAAM,CAAC,CAAC;IACvBC,aAAa,EAAET,GAAG,CAACQ,MAAM,CAAC,CAAC;IAC3BE,IAAI,EAAEP,aAAa,CAACQ,IAAI,CAACT,oBAAoB,CAAC,CAAC,CAAC;IAChDU,UAAU,EAAEZ,GAAG,CAACM,MAAM,CAAC;MACnBO,uBAAuB,EAAEb,GAAG,CAACQ,MAAM,CAAC,CAAC;MACrCM,aAAa,EAAEd,GAAG,CAACQ,MAAM,CAAC,CAAC;MAC3BO,QAAQ,EAAEf,GAAG,CAACQ,MAAM,CAAC,CAAC;MACtBQ,gCAAgC,EAAEhB,GAAG,CAACQ,MAAM,CAAC;IACjD,CAAC,CAAC;IACFS,iBAAiB,EAAEjB,GAAG,CAACM,MAAM,CAAC,CAAC,CAAC,CAAC,CAACY,WAAW,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;IAC1DC,SAAS,EAAEpB,GAAG,CAACQ,MAAM,CAAC,CAAC;IACvBa,WAAW,EAAErB,GAAG,CAACQ,MAAM,CAAC,CAAC;IACzBc,cAAc,EAAEtB,GAAG,CAACQ,MAAM,CAAC,CAAC;IAC5Be,SAAS,EAAEvB,GAAG,CAACQ,MAAM,CAAC;EAC1B,CAAC,CACL,CAAC;AACL,CAAC","ignoreList":[]}
|
|
@@ -1,23 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.createNumericStringValidation = void 0;
|
|
8
|
-
var _zod = _interopRequireDefault(require("zod"));
|
|
9
|
-
const createNumericStringValidation = name => {
|
|
10
|
-
return _zod.default.string().transform((value, ctx) => {
|
|
1
|
+
import zod from "zod";
|
|
2
|
+
export const createNumericStringValidation = name => {
|
|
3
|
+
return zod.string().transform((value, ctx) => {
|
|
11
4
|
if (/^\d+$/.test(value)) {
|
|
12
5
|
return value;
|
|
13
6
|
}
|
|
14
7
|
ctx.addIssue({
|
|
15
|
-
code:
|
|
8
|
+
code: zod.ZodIssueCode.custom,
|
|
16
9
|
message: `"${name}" must be a numeric string.`
|
|
17
10
|
});
|
|
18
|
-
return
|
|
11
|
+
return zod.NEVER;
|
|
19
12
|
});
|
|
20
13
|
};
|
|
21
|
-
exports.createNumericStringValidation = createNumericStringValidation;
|
|
22
14
|
|
|
23
15
|
//# sourceMappingURL=numericString.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["zod","createNumericStringValidation","name","string","transform","value","ctx","test","addIssue","code","ZodIssueCode","custom","message","NEVER"],"sources":["numericString.ts"],"sourcesContent":["import zod from \"zod\";\n\nexport const createNumericStringValidation = (name: string) => {\n return zod.string().transform((value, ctx) => {\n if (/^\\d+$/.test(value)) {\n return value as `${number}`;\n }\n ctx.addIssue({\n code: zod.ZodIssueCode.custom,\n message: `\"${name}\" must be a numeric string.`\n });\n return zod.NEVER;\n });\n};\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,KAAK;AAErB,OAAO,MAAMC,6BAA6B,GAAIC,IAAY,IAAK;EAC3D,OAAOF,GAAG,CAACG,MAAM,CAAC,CAAC,CAACC,SAAS,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;IAC1C,IAAI,OAAO,CAACC,IAAI,CAACF,KAAK,CAAC,EAAE;MACrB,OAAOA,KAAK;IAChB;IACAC,GAAG,CAACE,QAAQ,CAAC;MACTC,IAAI,EAAET,GAAG,CAACU,YAAY,CAACC,MAAM;MAC7BC,OAAO,EAAE,IAAIV,IAAI;IACrB,CAAC,CAAC;IACF,OAAOF,GAAG,CAACa,KAAK;EACpB,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|
|
@@ -6,15 +6,15 @@ export declare const createSystemValidation: () => zod.ZodObject<{
|
|
|
6
6
|
region: zod.ZodString;
|
|
7
7
|
version: zod.ZodString;
|
|
8
8
|
}, "strip", zod.ZodTypeAny, {
|
|
9
|
-
name: string;
|
|
10
9
|
region: string;
|
|
11
|
-
|
|
10
|
+
name: string;
|
|
12
11
|
env: string;
|
|
12
|
+
version: string;
|
|
13
13
|
variant?: string | undefined;
|
|
14
14
|
}, {
|
|
15
|
-
name: string;
|
|
16
15
|
region: string;
|
|
17
|
-
|
|
16
|
+
name: string;
|
|
18
17
|
env: string;
|
|
18
|
+
version: string;
|
|
19
19
|
variant?: string | null | undefined;
|
|
20
20
|
}>;
|
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const createSystemValidation = () => {
|
|
10
|
-
return _zod.default.object({
|
|
11
|
-
name: _zod.default.string(),
|
|
12
|
-
env: _zod.default.string(),
|
|
13
|
-
variant: _zod.default.string().optional().nullish().transform(value => value || undefined),
|
|
14
|
-
region: _zod.default.string(),
|
|
15
|
-
version: _zod.default.string()
|
|
1
|
+
import zod from "zod";
|
|
2
|
+
export const createSystemValidation = () => {
|
|
3
|
+
return zod.object({
|
|
4
|
+
name: zod.string(),
|
|
5
|
+
env: zod.string(),
|
|
6
|
+
variant: zod.string().optional().nullish().transform(value => value || undefined),
|
|
7
|
+
region: zod.string(),
|
|
8
|
+
version: zod.string()
|
|
16
9
|
});
|
|
17
10
|
};
|
|
18
|
-
exports.createSystemValidation = createSystemValidation;
|
|
19
11
|
|
|
20
12
|
//# sourceMappingURL=system.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["zod","createSystemValidation","object","name","string","env","variant","optional","nullish","transform","value","undefined","region","version"],"sources":["system.ts"],"sourcesContent":["import zod from \"zod\";\n\nexport const createSystemValidation = () => {\n return zod.object({\n name: zod.string(),\n env: zod.string(),\n variant: zod\n .string()\n .optional()\n .nullish()\n .transform(value => value || undefined),\n region: zod.string(),\n version: zod.string()\n });\n};\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,KAAK;AAErB,OAAO,MAAMC,sBAAsB,GAAGA,CAAA,KAAM;EACxC,OAAOD,GAAG,CAACE,MAAM,CAAC;IACdC,IAAI,EAAEH,GAAG,CAACI,MAAM,CAAC,CAAC;IAClBC,GAAG,EAAEL,GAAG,CAACI,MAAM,CAAC,CAAC;IACjBE,OAAO,EAAEN,GAAG,CACPI,MAAM,CAAC,CAAC,CACRG,QAAQ,CAAC,CAAC,CACVC,OAAO,CAAC,CAAC,CACTC,SAAS,CAACC,KAAK,IAAIA,KAAK,IAAIC,SAAS,CAAC;IAC3CC,MAAM,EAAEZ,GAAG,CAACI,MAAM,CAAC,CAAC;IACpBS,OAAO,EAAEb,GAAG,CAACI,MAAM,CAAC;EACxB,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { DynamoDBClientConfig, DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb/index.js";
|
|
2
|
+
import type { Reply as FastifyReply } from "@webiny/handler/types.js";
|
|
2
3
|
import { SQSEventHandler } from "@webiny/handler-aws/sqs/plugins/SQSEventHandler.js";
|
|
3
4
|
export interface ICreateEventHandlerPluginParams {
|
|
4
5
|
tableName: string | undefined;
|
|
@@ -7,4 +8,4 @@ export interface ICreateEventHandlerPluginParams {
|
|
|
7
8
|
/**
|
|
8
9
|
* TODO maybe add logger?
|
|
9
10
|
*/
|
|
10
|
-
export declare const createEventHandlerPlugin: (params: ICreateEventHandlerPluginParams) => SQSEventHandler<
|
|
11
|
+
export declare const createEventHandlerPlugin: (params: ICreateEventHandlerPluginParams) => SQSEventHandler<FastifyReply>;
|
|
@@ -1,45 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var _TableBundle = require("./app/bundler/TableBundle.js");
|
|
18
|
-
var _TransformHandler = require("./app/transform/TransformHandler.js");
|
|
19
|
-
var _SQSEventHandler = require("@webiny/handler-aws/sqs/plugins/SQSEventHandler.js");
|
|
20
|
-
var _Storer = require("./app/storer/Storer.js");
|
|
21
|
-
var _StorerAfterEachPlugin = require("./plugins/StorerAfterEachPlugin.js");
|
|
22
|
-
var _SourceDataContainer = require("./app/data/SourceDataContainer.js");
|
|
1
|
+
import { createEventHandler as createSQSEventHandler } from "@webiny/handler-aws/sqs/index.js";
|
|
2
|
+
import { createResolverApp } from "./app/ResolverApplication.js";
|
|
3
|
+
import { convertException } from "@webiny/utils";
|
|
4
|
+
import { createRecordHandler } from "./app/RecordHandler.js";
|
|
5
|
+
import { createFetcher } from "./app/fetcher/Fetcher.js";
|
|
6
|
+
import { createDeploymentsFetcher } from "./deployment/DeploymentsFetcher.js";
|
|
7
|
+
import { WebinyError } from "@webiny/error";
|
|
8
|
+
import { createBundler } from "./app/bundler/Bundler.js";
|
|
9
|
+
import { createBundles } from "./app/bundler/Bundles.js";
|
|
10
|
+
import { createCommandBundle } from "./app/bundler/CommandBundle.js";
|
|
11
|
+
import { createTableBundle } from "./app/bundler/TableBundle.js";
|
|
12
|
+
import { TransformHandler } from "./app/transform/TransformHandler.js";
|
|
13
|
+
import { SQSEventHandler } from "@webiny/handler-aws/sqs/plugins/SQSEventHandler.js";
|
|
14
|
+
import { createStorer } from "./app/storer/Storer.js";
|
|
15
|
+
import { StorerAfterEachPlugin } from "./plugins/StorerAfterEachPlugin.js";
|
|
16
|
+
import { SourceDataContainer } from "./app/data/SourceDataContainer.js";
|
|
23
17
|
/**
|
|
24
18
|
* TODO maybe add logger?
|
|
25
19
|
*/
|
|
26
|
-
const createEventHandlerPlugin = params => {
|
|
20
|
+
export const createEventHandlerPlugin = params => {
|
|
27
21
|
const {
|
|
28
22
|
createDocumentClient,
|
|
29
23
|
tableName
|
|
30
24
|
} = params;
|
|
31
|
-
const plugin = (
|
|
25
|
+
const plugin = createSQSEventHandler(async ({
|
|
32
26
|
event,
|
|
33
27
|
context,
|
|
34
28
|
reply
|
|
35
29
|
}) => {
|
|
36
30
|
if (!tableName) {
|
|
37
|
-
throw new
|
|
31
|
+
throw new WebinyError({
|
|
38
32
|
message: "Table name variable is not set."
|
|
39
33
|
});
|
|
40
34
|
}
|
|
41
35
|
try {
|
|
42
|
-
const fetcher =
|
|
36
|
+
const fetcher = createFetcher({
|
|
43
37
|
maxRetries: 10,
|
|
44
38
|
retryDelay: 1000,
|
|
45
39
|
createDocumentClient: deployment => {
|
|
@@ -48,7 +42,7 @@ const createEventHandlerPlugin = params => {
|
|
|
48
42
|
});
|
|
49
43
|
}
|
|
50
44
|
});
|
|
51
|
-
const deploymentsFetcher =
|
|
45
|
+
const deploymentsFetcher = createDeploymentsFetcher({
|
|
52
46
|
client: createDocumentClient({
|
|
53
47
|
region: process.env.AWS_REGION
|
|
54
48
|
}),
|
|
@@ -58,8 +52,8 @@ const createEventHandlerPlugin = params => {
|
|
|
58
52
|
* Fetch all possible deployments, out of which we will filter out the deployment that the records came from.
|
|
59
53
|
*/
|
|
60
54
|
const deployments = await deploymentsFetcher.fetch();
|
|
61
|
-
const storerAfterEachPlugins = context.plugins.byType(
|
|
62
|
-
const storer =
|
|
55
|
+
const storerAfterEachPlugins = context.plugins.byType(StorerAfterEachPlugin.type);
|
|
56
|
+
const storer = createStorer({
|
|
63
57
|
createDocumentClient: deployment => {
|
|
64
58
|
return createDocumentClient({
|
|
65
59
|
region: deployment.region
|
|
@@ -74,34 +68,34 @@ const createEventHandlerPlugin = params => {
|
|
|
74
68
|
}
|
|
75
69
|
}
|
|
76
70
|
});
|
|
77
|
-
const transformHandler = new
|
|
71
|
+
const transformHandler = new TransformHandler({
|
|
78
72
|
plugins: context.plugins
|
|
79
73
|
});
|
|
80
|
-
const recordHandler =
|
|
74
|
+
const recordHandler = createRecordHandler({
|
|
81
75
|
plugins: context.plugins,
|
|
82
76
|
fetcher,
|
|
83
77
|
storer,
|
|
84
78
|
deployments,
|
|
85
79
|
transformHandler,
|
|
86
|
-
commandBundler:
|
|
80
|
+
commandBundler: createBundler({
|
|
87
81
|
createBundles: () => {
|
|
88
|
-
return
|
|
89
|
-
createBundle:
|
|
82
|
+
return createBundles({
|
|
83
|
+
createBundle: createCommandBundle
|
|
90
84
|
});
|
|
91
85
|
}
|
|
92
86
|
}),
|
|
93
|
-
tableBundler:
|
|
87
|
+
tableBundler: createBundler({
|
|
94
88
|
createBundles: () => {
|
|
95
|
-
return
|
|
96
|
-
createBundle:
|
|
89
|
+
return createBundles({
|
|
90
|
+
createBundle: createTableBundle
|
|
97
91
|
});
|
|
98
92
|
}
|
|
99
93
|
}),
|
|
100
94
|
createSourceDataContainer: () => {
|
|
101
|
-
return
|
|
95
|
+
return SourceDataContainer.create();
|
|
102
96
|
}
|
|
103
97
|
});
|
|
104
|
-
const app =
|
|
98
|
+
const app = createResolverApp({
|
|
105
99
|
recordHandler,
|
|
106
100
|
deployments
|
|
107
101
|
});
|
|
@@ -112,16 +106,15 @@ const createEventHandlerPlugin = params => {
|
|
|
112
106
|
ok: true
|
|
113
107
|
});
|
|
114
108
|
} catch (ex) {
|
|
115
|
-
const error =
|
|
109
|
+
const error = convertException(ex);
|
|
116
110
|
console.error(error);
|
|
117
111
|
return reply.send({
|
|
118
112
|
error
|
|
119
113
|
});
|
|
120
114
|
}
|
|
121
115
|
});
|
|
122
|
-
plugin.name = `${
|
|
116
|
+
plugin.name = `${SQSEventHandler.type}.syncResolver`;
|
|
123
117
|
return plugin;
|
|
124
118
|
};
|
|
125
|
-
exports.createEventHandlerPlugin = createEventHandlerPlugin;
|
|
126
119
|
|
|
127
120
|
//# sourceMappingURL=createEventHandlerPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["createEventHandler","createSQSEventHandler","createResolverApp","convertException","createRecordHandler","createFetcher","createDeploymentsFetcher","WebinyError","createBundler","createBundles","createCommandBundle","createTableBundle","TransformHandler","SQSEventHandler","createStorer","StorerAfterEachPlugin","SourceDataContainer","createEventHandlerPlugin","params","createDocumentClient","tableName","plugin","event","context","reply","message","fetcher","maxRetries","retryDelay","deployment","region","deploymentsFetcher","client","process","env","AWS_REGION","table","deployments","fetch","storerAfterEachPlugins","plugins","byType","type","storer","afterEach","canHandle","handle","transformHandler","recordHandler","commandBundler","createBundle","tableBundler","createSourceDataContainer","create","app","resolve","records","Records","send","ok","ex","error","console","name"],"sources":["createEventHandlerPlugin.ts"],"sourcesContent":["import { createEventHandler as createSQSEventHandler } from \"@webiny/handler-aws/sqs/index.js\";\nimport { createResolverApp } from \"./app/ResolverApplication.js\";\nimport { convertException } from \"@webiny/utils\";\nimport { createRecordHandler } from \"./app/RecordHandler.js\";\nimport { createFetcher } from \"~/resolver/app/fetcher/Fetcher.js\";\nimport { createDeploymentsFetcher } from \"~/resolver/deployment/DeploymentsFetcher.js\";\nimport { WebinyError } from \"@webiny/error\";\nimport type {\n DynamoDBClientConfig,\n DynamoDBDocument\n} from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport { createBundler } from \"~/resolver/app/bundler/Bundler.js\";\nimport { createBundles } from \"~/resolver/app/bundler/Bundles.js\";\nimport { createCommandBundle } from \"~/resolver/app/bundler/CommandBundle.js\";\nimport { createTableBundle } from \"~/resolver/app/bundler/TableBundle.js\";\nimport { TransformHandler } from \"~/resolver/app/transform/TransformHandler.js\";\nimport type { Reply as FastifyReply } from \"@webiny/handler/types.js\";\nimport { SQSEventHandler } from \"@webiny/handler-aws/sqs/plugins/SQSEventHandler.js\";\nimport { createStorer } from \"./app/storer/Storer.js\";\nimport { StorerAfterEachPlugin } from \"./plugins/StorerAfterEachPlugin.js\";\nimport { SourceDataContainer } from \"~/resolver/app/data/SourceDataContainer.js\";\n\nexport interface ICreateEventHandlerPluginParams {\n tableName: string | undefined;\n createDocumentClient: (params: DynamoDBClientConfig) => Pick<DynamoDBDocument, \"send\">;\n}\n/**\n * TODO maybe add logger?\n */\nexport const createEventHandlerPlugin = (params: ICreateEventHandlerPluginParams) => {\n const { createDocumentClient, tableName } = params;\n\n const plugin = createSQSEventHandler(\n async ({ event, context, reply }): Promise<FastifyReply> => {\n if (!tableName) {\n throw new WebinyError({\n message: \"Table name variable is not set.\"\n });\n }\n try {\n const fetcher = createFetcher({\n maxRetries: 10,\n retryDelay: 1000,\n createDocumentClient: deployment => {\n return createDocumentClient({\n region: deployment.region\n });\n }\n });\n\n const deploymentsFetcher = createDeploymentsFetcher({\n client: createDocumentClient({\n region: process.env.AWS_REGION\n }),\n table: tableName\n });\n /**\n * Fetch all possible deployments, out of which we will filter out the deployment that the records came from.\n */\n const deployments = await deploymentsFetcher.fetch();\n\n const storerAfterEachPlugins = context.plugins.byType<StorerAfterEachPlugin>(\n StorerAfterEachPlugin.type\n );\n\n const storer = createStorer({\n createDocumentClient: deployment => {\n return createDocumentClient({\n region: deployment.region\n });\n },\n afterEach: async params => {\n for (const plugin of storerAfterEachPlugins) {\n if (!plugin.canHandle(params)) {\n continue;\n }\n await plugin.handle(params);\n }\n }\n });\n\n const transformHandler = new TransformHandler({\n plugins: context.plugins\n });\n\n const recordHandler = createRecordHandler({\n plugins: context.plugins,\n fetcher,\n storer,\n deployments,\n transformHandler,\n commandBundler: createBundler({\n createBundles: () => {\n return createBundles({\n createBundle: createCommandBundle\n });\n }\n }),\n tableBundler: createBundler({\n createBundles: () => {\n return createBundles({\n createBundle: createTableBundle\n });\n }\n }),\n createSourceDataContainer: () => {\n return SourceDataContainer.create();\n }\n });\n const app = createResolverApp({\n recordHandler,\n deployments\n });\n\n await app.resolve({\n records: event.Records\n });\n return reply.send({\n ok: true\n });\n } catch (ex) {\n const error = convertException(ex);\n console.error(error);\n return reply.send({\n error\n });\n }\n }\n );\n\n plugin.name = `${SQSEventHandler.type}.syncResolver`;\n\n return plugin;\n};\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { HandlerCallable, HandlerParams } from "@webiny/handler-aws/sqs";
|
|
1
|
+
import type { HandlerCallable, HandlerParams } from "@webiny/handler-aws/sqs/index.js";
|
|
2
2
|
import type { TransformRecordPlugin } from "./plugins/TransformRecordPlugin.js";
|
|
3
3
|
import type { CommandHandlerPlugin } from "./plugins/CommandHandlerPlugin.js";
|
|
4
4
|
import type { DynamoDBClientConfig, DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb/index.js";
|