@webiny/api-sync-system 6.0.0-alpha.4 → 6.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +6 -6
- 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 +6 -6
- package/resolver/app/validation/detail.js +16 -24
- package/resolver/app/validation/detail.js.map +1 -1
- package/resolver/app/validation/event.d.ts +6 -6
- 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.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.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.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.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.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
|
@@ -13,7 +13,7 @@ export declare const createBodyValidation: () => zod.ZodObject<{
|
|
|
13
13
|
PK: zod.ZodString;
|
|
14
14
|
SK: zod.ZodString;
|
|
15
15
|
tableName: zod.ZodString;
|
|
16
|
-
tableType: zod.ZodEffects<zod.ZodEnum<["regular", "
|
|
16
|
+
tableType: zod.ZodEffects<zod.ZodEnum<["regular", "opensearch", "log", "unknown"]>, import("../../../types.js").DynamoDBTableType, "unknown" | "regular" | "opensearch" | "log">;
|
|
17
17
|
command: zod.ZodEnum<["update", "put", "delete"]>;
|
|
18
18
|
}, "strip", zod.ZodTypeAny, {
|
|
19
19
|
PK: string;
|
|
@@ -25,7 +25,7 @@ export declare const createBodyValidation: () => zod.ZodObject<{
|
|
|
25
25
|
PK: string;
|
|
26
26
|
SK: string;
|
|
27
27
|
tableName: string;
|
|
28
|
-
tableType: "unknown" | "regular" | "
|
|
28
|
+
tableType: "unknown" | "regular" | "opensearch" | "log";
|
|
29
29
|
command: "put" | "delete" | "update";
|
|
30
30
|
}>, "many">, {
|
|
31
31
|
PK: string;
|
|
@@ -37,13 +37,13 @@ export declare const createBodyValidation: () => zod.ZodObject<{
|
|
|
37
37
|
PK: string;
|
|
38
38
|
SK: string;
|
|
39
39
|
tableName: string;
|
|
40
|
-
tableType: "unknown" | "regular" | "
|
|
40
|
+
tableType: "unknown" | "regular" | "opensearch" | "log";
|
|
41
41
|
command: "put" | "delete" | "update";
|
|
42
42
|
}[]>, import("@webiny/api/types.js").NonEmptyArray<import("../abstractions/ResolverRecord.js").IResolverRecordBodyItem>, {
|
|
43
43
|
PK: string;
|
|
44
44
|
SK: string;
|
|
45
45
|
tableName: string;
|
|
46
|
-
tableType: "unknown" | "regular" | "
|
|
46
|
+
tableType: "unknown" | "regular" | "opensearch" | "log";
|
|
47
47
|
command: "put" | "delete" | "update";
|
|
48
48
|
}[]>;
|
|
49
49
|
source: zod.ZodObject<{
|
|
@@ -88,7 +88,7 @@ export declare const createBodyValidation: () => zod.ZodObject<{
|
|
|
88
88
|
PK: string;
|
|
89
89
|
SK: string;
|
|
90
90
|
tableName: string;
|
|
91
|
-
tableType: "unknown" | "regular" | "
|
|
91
|
+
tableType: "unknown" | "regular" | "opensearch" | "log";
|
|
92
92
|
command: "put" | "delete" | "update";
|
|
93
93
|
}[];
|
|
94
94
|
id: string;
|
|
@@ -134,7 +134,7 @@ export declare const createBodyValidation: () => zod.ZodObject<{
|
|
|
134
134
|
PK: string;
|
|
135
135
|
SK: string;
|
|
136
136
|
tableName: string;
|
|
137
|
-
tableType: "unknown" | "regular" | "
|
|
137
|
+
tableType: "unknown" | "regular" | "opensearch" | "log";
|
|
138
138
|
command: "put" | "delete" | "update";
|
|
139
139
|
}[];
|
|
140
140
|
id: string;
|
|
@@ -1,46 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const createBodyValidation = () => {
|
|
14
|
-
return _zod.default.object({
|
|
15
|
-
version: (0, _numericString.createNumericStringValidation)("version"),
|
|
16
|
-
id: _zod.default.string(),
|
|
17
|
-
"detail-type": _zod.default.string().transform((value, ctx) => {
|
|
18
|
-
if (value === _constants.SQS_EVENT_NAME) {
|
|
19
|
-
return _constants.SQS_EVENT_NAME;
|
|
1
|
+
import zod from "zod";
|
|
2
|
+
import { createDetailValidation } from "./detail.js";
|
|
3
|
+
import { SQS_EVENT_NAME } from "../../../constants.js";
|
|
4
|
+
import { createNumericStringValidation } from "./numericString.js";
|
|
5
|
+
const detailValidation = createDetailValidation();
|
|
6
|
+
export const createBodyValidation = () => {
|
|
7
|
+
return zod.object({
|
|
8
|
+
version: createNumericStringValidation("version"),
|
|
9
|
+
id: zod.string(),
|
|
10
|
+
"detail-type": zod.string().transform((value, ctx) => {
|
|
11
|
+
if (value === SQS_EVENT_NAME) {
|
|
12
|
+
return SQS_EVENT_NAME;
|
|
20
13
|
}
|
|
21
14
|
ctx.addIssue({
|
|
22
|
-
code:
|
|
23
|
-
message: `"detail-type" must be "${
|
|
15
|
+
code: zod.ZodIssueCode.custom,
|
|
16
|
+
message: `"detail-type" must be "${SQS_EVENT_NAME}".`
|
|
24
17
|
});
|
|
25
|
-
return
|
|
18
|
+
return zod.NEVER;
|
|
26
19
|
}),
|
|
27
|
-
source:
|
|
20
|
+
source: zod.string().transform((value, ctx) => {
|
|
28
21
|
if (value.startsWith("webiny:")) {
|
|
29
22
|
return value;
|
|
30
23
|
}
|
|
31
24
|
ctx.addIssue({
|
|
32
|
-
code:
|
|
25
|
+
code: zod.ZodIssueCode.custom,
|
|
33
26
|
message: `"source" must start with "webiny:".`
|
|
34
27
|
});
|
|
35
|
-
return
|
|
28
|
+
return zod.NEVER;
|
|
36
29
|
}),
|
|
37
|
-
account:
|
|
38
|
-
time:
|
|
39
|
-
region:
|
|
40
|
-
resources:
|
|
30
|
+
account: createNumericStringValidation("account"),
|
|
31
|
+
time: zod.string().transform(value => new Date(value)),
|
|
32
|
+
region: zod.string(),
|
|
33
|
+
resources: zod.array(zod.string()),
|
|
41
34
|
detail: detailValidation
|
|
42
35
|
});
|
|
43
36
|
};
|
|
44
|
-
exports.createBodyValidation = createBodyValidation;
|
|
45
37
|
|
|
46
38
|
//# sourceMappingURL=body.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["zod","createDetailValidation","SQS_EVENT_NAME","createNumericStringValidation","detailValidation","createBodyValidation","object","version","id","string","transform","value","ctx","addIssue","code","ZodIssueCode","custom","message","NEVER","source","startsWith","account","time","Date","region","resources","array","detail"],"sources":["body.ts"],"sourcesContent":["import zod from \"zod\";\nimport { createDetailValidation } from \"./detail.js\";\nimport { SQS_EVENT_NAME } from \"~/constants.js\";\nimport { createNumericStringValidation } from \"~/resolver/app/validation/numericString.js\";\n\nconst detailValidation = createDetailValidation();\n\nexport const createBodyValidation = () => {\n return zod.object({\n version: createNumericStringValidation(\"version\"),\n id: zod.string(),\n \"detail-type\": zod.string().transform((value, ctx) => {\n if (value === SQS_EVENT_NAME) {\n return SQS_EVENT_NAME;\n }\n ctx.addIssue({\n code: zod.ZodIssueCode.custom,\n message: `\"detail-type\" must be \"${SQS_EVENT_NAME}\".`\n });\n return zod.NEVER;\n }),\n source: zod.string().transform((value, ctx) => {\n if (value.startsWith(\"webiny:\")) {\n return value as `webiny:${string}`;\n }\n ctx.addIssue({\n code: zod.ZodIssueCode.custom,\n message: `\"source\" must start with \"webiny:\".`\n });\n return zod.NEVER;\n }),\n account: createNumericStringValidation(\"account\"),\n time: zod.string().transform(value => new Date(value)),\n region: zod.string(),\n resources: zod.array(zod.string()),\n detail: detailValidation\n });\n};\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,KAAK;AACrB,SAASC,sBAAsB;AAC/B,SAASC,cAAc;AACvB,SAASC,6BAA6B;AAEtC,MAAMC,gBAAgB,GAAGH,sBAAsB,CAAC,CAAC;AAEjD,OAAO,MAAMI,oBAAoB,GAAGA,CAAA,KAAM;EACtC,OAAOL,GAAG,CAACM,MAAM,CAAC;IACdC,OAAO,EAAEJ,6BAA6B,CAAC,SAAS,CAAC;IACjDK,EAAE,EAAER,GAAG,CAACS,MAAM,CAAC,CAAC;IAChB,aAAa,EAAET,GAAG,CAACS,MAAM,CAAC,CAAC,CAACC,SAAS,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;MAClD,IAAID,KAAK,KAAKT,cAAc,EAAE;QAC1B,OAAOA,cAAc;MACzB;MACAU,GAAG,CAACC,QAAQ,CAAC;QACTC,IAAI,EAAEd,GAAG,CAACe,YAAY,CAACC,MAAM;QAC7BC,OAAO,EAAE,0BAA0Bf,cAAc;MACrD,CAAC,CAAC;MACF,OAAOF,GAAG,CAACkB,KAAK;IACpB,CAAC,CAAC;IACFC,MAAM,EAAEnB,GAAG,CAACS,MAAM,CAAC,CAAC,CAACC,SAAS,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;MAC3C,IAAID,KAAK,CAACS,UAAU,CAAC,SAAS,CAAC,EAAE;QAC7B,OAAOT,KAAK;MAChB;MACAC,GAAG,CAACC,QAAQ,CAAC;QACTC,IAAI,EAAEd,GAAG,CAACe,YAAY,CAACC,MAAM;QAC7BC,OAAO,EAAE;MACb,CAAC,CAAC;MACF,OAAOjB,GAAG,CAACkB,KAAK;IACpB,CAAC,CAAC;IACFG,OAAO,EAAElB,6BAA6B,CAAC,SAAS,CAAC;IACjDmB,IAAI,EAAEtB,GAAG,CAACS,MAAM,CAAC,CAAC,CAACC,SAAS,CAACC,KAAK,IAAI,IAAIY,IAAI,CAACZ,KAAK,CAAC,CAAC;IACtDa,MAAM,EAAExB,GAAG,CAACS,MAAM,CAAC,CAAC;IACpBgB,SAAS,EAAEzB,GAAG,CAAC0B,KAAK,CAAC1B,GAAG,CAACS,MAAM,CAAC,CAAC,CAAC;IAClCkB,MAAM,EAAEvB;EACZ,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|
|
@@ -1,24 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.createJsonTransform = void 0;
|
|
8
|
-
var _zod = _interopRequireDefault(require("zod"));
|
|
9
|
-
const createJsonTransform = name => {
|
|
10
|
-
return _zod.default.string().transform((value, ctx) => {
|
|
1
|
+
import zod from "zod";
|
|
2
|
+
export const createJsonTransform = name => {
|
|
3
|
+
return zod.string().transform((value, ctx) => {
|
|
11
4
|
try {
|
|
12
5
|
return JSON.parse(value);
|
|
13
|
-
} catch
|
|
6
|
+
} catch {
|
|
14
7
|
ctx.addIssue({
|
|
15
|
-
code:
|
|
8
|
+
code: zod.ZodIssueCode.custom,
|
|
16
9
|
message: `${name} must be a valid JSON string.`
|
|
17
10
|
});
|
|
18
|
-
return
|
|
11
|
+
return zod.NEVER;
|
|
19
12
|
}
|
|
20
13
|
});
|
|
21
14
|
};
|
|
22
|
-
exports.createJsonTransform = createJsonTransform;
|
|
23
15
|
|
|
24
16
|
//# sourceMappingURL=createJsonTransform.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["zod","createJsonTransform","name","string","transform","value","ctx","JSON","parse","addIssue","code","ZodIssueCode","custom","message","NEVER"],"sources":["createJsonTransform.ts"],"sourcesContent":["import zod from \"zod\";\n\nexport const createJsonTransform = (name: string) => {\n return zod.string().transform((value, ctx) => {\n try {\n return JSON.parse(value);\n } catch {\n ctx.addIssue({\n code: zod.ZodIssueCode.custom,\n message: `${name} must be a valid JSON string.`\n });\n return zod.NEVER;\n }\n });\n};\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,KAAK;AAErB,OAAO,MAAMC,mBAAmB,GAAIC,IAAY,IAAK;EACjD,OAAOF,GAAG,CAACG,MAAM,CAAC,CAAC,CAACC,SAAS,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;IAC1C,IAAI;MACA,OAAOC,IAAI,CAACC,KAAK,CAACH,KAAK,CAAC;IAC5B,CAAC,CAAC,MAAM;MACJC,GAAG,CAACG,QAAQ,CAAC;QACTC,IAAI,EAAEV,GAAG,CAACW,YAAY,CAACC,MAAM;QAC7BC,OAAO,EAAE,GAAGX,IAAI;MACpB,CAAC,CAAC;MACF,OAAOF,GAAG,CAACc,KAAK;IACpB;EACJ,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import zod from "zod";
|
|
2
2
|
import type { NonEmptyArray } from "@webiny/api/types.js";
|
|
3
|
-
import type { IResolverRecordBodyItem } from "
|
|
3
|
+
import type { IResolverRecordBodyItem } from "../../../resolver/app/abstractions/ResolverRecord.js";
|
|
4
4
|
import { DynamoDBTableType } from "../../../types.js";
|
|
5
5
|
export declare const createDetailValidation: () => zod.ZodObject<{
|
|
6
6
|
items: zod.ZodEffects<zod.ZodEffects<zod.ZodArray<zod.ZodObject<{
|
|
7
7
|
PK: zod.ZodString;
|
|
8
8
|
SK: zod.ZodString;
|
|
9
9
|
tableName: zod.ZodString;
|
|
10
|
-
tableType: zod.ZodEffects<zod.ZodEnum<["regular", "
|
|
10
|
+
tableType: zod.ZodEffects<zod.ZodEnum<["regular", "opensearch", "log", "unknown"]>, DynamoDBTableType, "unknown" | "regular" | "opensearch" | "log">;
|
|
11
11
|
command: zod.ZodEnum<["update", "put", "delete"]>;
|
|
12
12
|
}, "strip", zod.ZodTypeAny, {
|
|
13
13
|
PK: string;
|
|
@@ -19,7 +19,7 @@ export declare const createDetailValidation: () => zod.ZodObject<{
|
|
|
19
19
|
PK: string;
|
|
20
20
|
SK: string;
|
|
21
21
|
tableName: string;
|
|
22
|
-
tableType: "unknown" | "regular" | "
|
|
22
|
+
tableType: "unknown" | "regular" | "opensearch" | "log";
|
|
23
23
|
command: "put" | "delete" | "update";
|
|
24
24
|
}>, "many">, {
|
|
25
25
|
PK: string;
|
|
@@ -31,13 +31,13 @@ export declare const createDetailValidation: () => zod.ZodObject<{
|
|
|
31
31
|
PK: string;
|
|
32
32
|
SK: string;
|
|
33
33
|
tableName: string;
|
|
34
|
-
tableType: "unknown" | "regular" | "
|
|
34
|
+
tableType: "unknown" | "regular" | "opensearch" | "log";
|
|
35
35
|
command: "put" | "delete" | "update";
|
|
36
36
|
}[]>, NonEmptyArray<IResolverRecordBodyItem>, {
|
|
37
37
|
PK: string;
|
|
38
38
|
SK: string;
|
|
39
39
|
tableName: string;
|
|
40
|
-
tableType: "unknown" | "regular" | "
|
|
40
|
+
tableType: "unknown" | "regular" | "opensearch" | "log";
|
|
41
41
|
command: "put" | "delete" | "update";
|
|
42
42
|
}[]>;
|
|
43
43
|
source: zod.ZodObject<{
|
|
@@ -82,7 +82,7 @@ export declare const createDetailValidation: () => zod.ZodObject<{
|
|
|
82
82
|
PK: string;
|
|
83
83
|
SK: string;
|
|
84
84
|
tableName: string;
|
|
85
|
-
tableType: "unknown" | "regular" | "
|
|
85
|
+
tableType: "unknown" | "regular" | "opensearch" | "log";
|
|
86
86
|
command: "put" | "delete" | "update";
|
|
87
87
|
}[];
|
|
88
88
|
id: string;
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.createDetailValidation = void 0;
|
|
8
|
-
var _zod = _interopRequireDefault(require("zod"));
|
|
9
|
-
var _system = require("./system.js");
|
|
10
|
-
var _types = require("../../../types.js");
|
|
1
|
+
import zod from "zod";
|
|
2
|
+
import { createSystemValidation } from "./system.js";
|
|
3
|
+
import { DynamoDBTableType } from "../../../types.js";
|
|
11
4
|
const convert = input => {
|
|
12
5
|
/**
|
|
13
6
|
* We can safely cast as NonEmptyArray<IResolverRecordBodyItem> here because we already validated that the array is not empty.
|
|
@@ -15,25 +8,25 @@ const convert = input => {
|
|
|
15
8
|
return input;
|
|
16
9
|
};
|
|
17
10
|
const transformTableType = input => {
|
|
18
|
-
const keys = Object.keys(
|
|
11
|
+
const keys = Object.keys(DynamoDBTableType);
|
|
19
12
|
for (const key of keys) {
|
|
20
|
-
const value =
|
|
13
|
+
const value = DynamoDBTableType[key];
|
|
21
14
|
if (value === input) {
|
|
22
15
|
return value;
|
|
23
16
|
}
|
|
24
17
|
}
|
|
25
|
-
return
|
|
18
|
+
return DynamoDBTableType.UNKNOWN;
|
|
26
19
|
};
|
|
27
|
-
const createDetailValidation = () => {
|
|
28
|
-
return
|
|
29
|
-
items:
|
|
30
|
-
PK:
|
|
31
|
-
SK:
|
|
32
|
-
tableName:
|
|
33
|
-
tableType:
|
|
20
|
+
export const createDetailValidation = () => {
|
|
21
|
+
return zod.object({
|
|
22
|
+
items: zod.array(zod.object({
|
|
23
|
+
PK: zod.string(),
|
|
24
|
+
SK: zod.string(),
|
|
25
|
+
tableName: zod.string(),
|
|
26
|
+
tableType: zod.enum(["regular", "opensearch", "log", "unknown"]).transform(input => {
|
|
34
27
|
return transformTableType(input);
|
|
35
28
|
}),
|
|
36
|
-
command:
|
|
29
|
+
command: zod.enum(["update", "put", "delete"])
|
|
37
30
|
})).refine(values => {
|
|
38
31
|
return values.length > 0;
|
|
39
32
|
}, {
|
|
@@ -41,10 +34,9 @@ const createDetailValidation = () => {
|
|
|
41
34
|
}).transform(values => {
|
|
42
35
|
return convert(values);
|
|
43
36
|
}),
|
|
44
|
-
source:
|
|
45
|
-
id:
|
|
37
|
+
source: createSystemValidation(),
|
|
38
|
+
id: zod.string()
|
|
46
39
|
});
|
|
47
40
|
};
|
|
48
|
-
exports.createDetailValidation = createDetailValidation;
|
|
49
41
|
|
|
50
42
|
//# sourceMappingURL=detail.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["zod","createSystemValidation","DynamoDBTableType","convert","input","transformTableType","keys","Object","key","value","UNKNOWN","createDetailValidation","object","items","array","PK","string","SK","tableName","tableType","enum","transform","command","refine","values","length","message","source","id"],"sources":["detail.ts"],"sourcesContent":["import zod from \"zod\";\nimport type { NonEmptyArray } from \"@webiny/api/types.js\";\nimport type { IResolverRecordBodyItem } from \"~/resolver/app/abstractions/ResolverRecord.js\";\nimport { createSystemValidation } from \"./system.js\";\nimport { DynamoDBTableType } from \"~/types.js\";\n\nconst convert = (input: IResolverRecordBodyItem[]) => {\n /**\n * We can safely cast as NonEmptyArray<IResolverRecordBodyItem> here because we already validated that the array is not empty.\n */\n return input as NonEmptyArray<IResolverRecordBodyItem>;\n};\n\nconst transformTableType = (input: string): DynamoDBTableType => {\n const keys = Object.keys(DynamoDBTableType) as (keyof typeof DynamoDBTableType)[];\n for (const key of keys) {\n const value = DynamoDBTableType[key];\n if (value === input) {\n return value;\n }\n }\n return DynamoDBTableType.UNKNOWN;\n};\n\nexport const createDetailValidation = () => {\n return zod.object({\n items: zod\n .array(\n zod.object({\n PK: zod.string(),\n SK: zod.string(),\n tableName: zod.string(),\n tableType: zod\n .enum([\"regular\", \"opensearch\", \"log\", \"unknown\"])\n .transform(input => {\n return transformTableType(input);\n }),\n command: zod.enum([\"update\", \"put\", \"delete\"])\n })\n )\n .refine(\n values => {\n return values.length > 0;\n },\n {\n message: `\"items\" array must not be empty.`\n }\n )\n .transform(values => {\n return convert(values);\n }),\n source: createSystemValidation(),\n id: zod.string()\n });\n};\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,KAAK;AAGrB,SAASC,sBAAsB;AAC/B,SAASC,iBAAiB;AAE1B,MAAMC,OAAO,GAAIC,KAAgC,IAAK;EAClD;AACJ;AACA;EACI,OAAOA,KAAK;AAChB,CAAC;AAED,MAAMC,kBAAkB,GAAID,KAAa,IAAwB;EAC7D,MAAME,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACJ,iBAAiB,CAAuC;EACjF,KAAK,MAAMM,GAAG,IAAIF,IAAI,EAAE;IACpB,MAAMG,KAAK,GAAGP,iBAAiB,CAACM,GAAG,CAAC;IACpC,IAAIC,KAAK,KAAKL,KAAK,EAAE;MACjB,OAAOK,KAAK;IAChB;EACJ;EACA,OAAOP,iBAAiB,CAACQ,OAAO;AACpC,CAAC;AAED,OAAO,MAAMC,sBAAsB,GAAGA,CAAA,KAAM;EACxC,OAAOX,GAAG,CAACY,MAAM,CAAC;IACdC,KAAK,EAAEb,GAAG,CACLc,KAAK,CACFd,GAAG,CAACY,MAAM,CAAC;MACPG,EAAE,EAAEf,GAAG,CAACgB,MAAM,CAAC,CAAC;MAChBC,EAAE,EAAEjB,GAAG,CAACgB,MAAM,CAAC,CAAC;MAChBE,SAAS,EAAElB,GAAG,CAACgB,MAAM,CAAC,CAAC;MACvBG,SAAS,EAAEnB,GAAG,CACToB,IAAI,CAAC,CAAC,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CACjDC,SAAS,CAACjB,KAAK,IAAI;QAChB,OAAOC,kBAAkB,CAACD,KAAK,CAAC;MACpC,CAAC,CAAC;MACNkB,OAAO,EAAEtB,GAAG,CAACoB,IAAI,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,CAAC;IACjD,CAAC,CACL,CAAC,CACAG,MAAM,CACHC,MAAM,IAAI;MACN,OAAOA,MAAM,CAACC,MAAM,GAAG,CAAC;IAC5B,CAAC,EACD;MACIC,OAAO,EAAE;IACb,CACJ,CAAC,CACAL,SAAS,CAACG,MAAM,IAAI;MACjB,OAAOrB,OAAO,CAACqB,MAAM,CAAC;IAC1B,CAAC,CAAC;IACNG,MAAM,EAAE1B,sBAAsB,CAAC,CAAC;IAChC2B,EAAE,EAAE5B,GAAG,CAACgB,MAAM,CAAC;EACnB,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|
|
@@ -16,7 +16,7 @@ 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;
|
|
@@ -28,7 +28,7 @@ export declare const createEventValidation: () => zod.ZodArray<zod.ZodObject<{
|
|
|
28
28
|
PK: string;
|
|
29
29
|
SK: string;
|
|
30
30
|
tableName: string;
|
|
31
|
-
tableType: "unknown" | "regular" | "
|
|
31
|
+
tableType: "unknown" | "regular" | "opensearch" | "log";
|
|
32
32
|
command: "put" | "delete" | "update";
|
|
33
33
|
}>, "many">, {
|
|
34
34
|
PK: string;
|
|
@@ -40,13 +40,13 @@ export declare const createEventValidation: () => zod.ZodArray<zod.ZodObject<{
|
|
|
40
40
|
PK: string;
|
|
41
41
|
SK: string;
|
|
42
42
|
tableName: string;
|
|
43
|
-
tableType: "unknown" | "regular" | "
|
|
43
|
+
tableType: "unknown" | "regular" | "opensearch" | "log";
|
|
44
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" | "regular" | "
|
|
49
|
+
tableType: "unknown" | "regular" | "opensearch" | "log";
|
|
50
50
|
command: "put" | "delete" | "update";
|
|
51
51
|
}[]>;
|
|
52
52
|
source: zod.ZodObject<{
|
|
@@ -91,7 +91,7 @@ export declare const createEventValidation: () => zod.ZodArray<zod.ZodObject<{
|
|
|
91
91
|
PK: string;
|
|
92
92
|
SK: string;
|
|
93
93
|
tableName: string;
|
|
94
|
-
tableType: "unknown" | "regular" | "
|
|
94
|
+
tableType: "unknown" | "regular" | "opensearch" | "log";
|
|
95
95
|
command: "put" | "delete" | "update";
|
|
96
96
|
}[];
|
|
97
97
|
id: string;
|
|
@@ -137,7 +137,7 @@ export declare const createEventValidation: () => zod.ZodArray<zod.ZodObject<{
|
|
|
137
137
|
PK: string;
|
|
138
138
|
SK: string;
|
|
139
139
|
tableName: string;
|
|
140
|
-
tableType: "unknown" | "regular" | "
|
|
140
|
+
tableType: "unknown" | "regular" | "opensearch" | "log";
|
|
141
141
|
command: "put" | "delete" | "update";
|
|
142
142
|
}[];
|
|
143
143
|
id: 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":[]}
|
|
@@ -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>;
|