@webiny/api-sync-system 0.0.0-unstable.6f45466a1d → 0.0.0-unstable.7be00a75a9
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/constants.js +2 -1
- package/constants.js.map +1 -1
- package/index.js +0 -2
- package/package.json +26 -22
- package/resolver/app/RecordHandler.js +83 -105
- package/resolver/app/RecordHandler.js.map +1 -1
- package/resolver/app/RecordsValidation.js +11 -14
- package/resolver/app/RecordsValidation.js.map +1 -1
- package/resolver/app/ResolverApplication.js +24 -31
- package/resolver/app/ResolverApplication.js.map +1 -1
- package/resolver/app/abstractions/RecordHandler.js +0 -3
- package/resolver/app/abstractions/RecordsValidation.js +0 -3
- package/resolver/app/abstractions/ResolverApplication.js +0 -3
- package/resolver/app/abstractions/ResolverRecord.js +0 -3
- package/resolver/app/bundler/BaseBundle.js +17 -16
- package/resolver/app/bundler/BaseBundle.js.map +1 -1
- package/resolver/app/bundler/Bundler.js +13 -18
- package/resolver/app/bundler/Bundler.js.map +1 -1
- package/resolver/app/bundler/Bundles.js +21 -26
- package/resolver/app/bundler/Bundles.js.map +1 -1
- package/resolver/app/bundler/CommandBundle.js +7 -16
- package/resolver/app/bundler/CommandBundle.js.map +1 -1
- package/resolver/app/bundler/TableBundle.js +6 -13
- package/resolver/app/bundler/TableBundle.js.map +1 -1
- package/resolver/app/bundler/types.js +0 -3
- package/resolver/app/commandHandler/DeleteCommandHandler.js +22 -29
- package/resolver/app/commandHandler/DeleteCommandHandler.js.map +1 -1
- package/resolver/app/commandHandler/PutCommandHandler.js +16 -22
- package/resolver/app/commandHandler/PutCommandHandler.js.map +1 -1
- package/resolver/app/commandHandler/delete.js +11 -12
- package/resolver/app/commandHandler/delete.js.map +1 -1
- package/resolver/app/commandHandler/put.js +11 -12
- package/resolver/app/commandHandler/put.js.map +1 -1
- package/resolver/app/data/SourceDataContainer.js +28 -30
- package/resolver/app/data/SourceDataContainer.js.map +1 -1
- package/resolver/app/data/types.js +0 -3
- package/resolver/app/fetcher/Fetcher.js +84 -109
- package/resolver/app/fetcher/Fetcher.js.map +1 -1
- package/resolver/app/fetcher/types.js +0 -3
- package/resolver/app/ingestor/Ingestor.js +27 -32
- package/resolver/app/ingestor/Ingestor.js.map +1 -1
- package/resolver/app/ingestor/IngestorResult.js +28 -32
- package/resolver/app/ingestor/IngestorResult.js.map +1 -1
- package/resolver/app/ingestor/types.js +0 -3
- package/resolver/app/storer/Storer.js +71 -85
- package/resolver/app/storer/Storer.js.map +1 -1
- package/resolver/app/storer/types.js +0 -3
- package/resolver/app/transform/TransformHandler.js +45 -56
- package/resolver/app/transform/TransformHandler.js.map +1 -1
- package/resolver/app/transform/middleware.js +13 -20
- package/resolver/app/transform/middleware.js.map +1 -1
- package/resolver/app/utils/Retry.js +21 -24
- package/resolver/app/utils/Retry.js.map +1 -1
- package/resolver/app/utils/sleep.js +4 -5
- package/resolver/app/utils/sleep.js.map +1 -1
- package/resolver/app/validation/body.d.ts +24 -123
- package/resolver/app/validation/body.js +26 -31
- package/resolver/app/validation/body.js.map +1 -1
- package/resolver/app/validation/createJsonTransform.d.ts +1 -1
- package/resolver/app/validation/createJsonTransform.js +12 -13
- package/resolver/app/validation/createJsonTransform.js.map +1 -1
- package/resolver/app/validation/detail.d.ts +17 -70
- package/resolver/app/validation/detail.js +30 -35
- package/resolver/app/validation/detail.js.map +1 -1
- package/resolver/app/validation/event.d.ts +28 -187
- package/resolver/app/validation/event.js +17 -18
- package/resolver/app/validation/event.js.map +1 -1
- package/resolver/app/validation/numericString.d.ts +1 -1
- package/resolver/app/validation/numericString.js +8 -11
- package/resolver/app/validation/numericString.js.map +1 -1
- package/resolver/app/validation/system.d.ts +2 -14
- package/resolver/app/validation/system.js +8 -9
- package/resolver/app/validation/system.js.map +1 -1
- package/resolver/createEventHandlerPlugin.js +70 -99
- package/resolver/createEventHandlerPlugin.js.map +1 -1
- package/resolver/createResolverHandler.js +49 -57
- package/resolver/createResolverHandler.js.map +1 -1
- package/resolver/deployment/Deployment.js +28 -37
- package/resolver/deployment/Deployment.js.map +1 -1
- package/resolver/deployment/Deployments.js +20 -23
- package/resolver/deployment/Deployments.js.map +1 -1
- package/resolver/deployment/DeploymentsFetcher.js +75 -86
- package/resolver/deployment/DeploymentsFetcher.js.map +1 -1
- package/resolver/deployment/types.d.ts +0 -2
- package/resolver/deployment/types.js +0 -3
- package/resolver/lambda/LambdaTrigger.js +24 -26
- package/resolver/lambda/LambdaTrigger.js.map +1 -1
- package/resolver/plugins/CommandHandlerPlugin.js +16 -15
- package/resolver/plugins/CommandHandlerPlugin.js.map +1 -1
- package/resolver/plugins/StorerAfterEachPlugin.js +20 -19
- package/resolver/plugins/StorerAfterEachPlugin.js.map +1 -1
- package/resolver/plugins/TransformRecordPlugin.js +19 -18
- package/resolver/plugins/TransformRecordPlugin.js.map +1 -1
- package/resolver/recordTypes/fileManager/CopyFile.js +44 -67
- package/resolver/recordTypes/fileManager/CopyFile.js.map +1 -1
- package/resolver/recordTypes/fileManager/DeleteFile.js +40 -58
- package/resolver/recordTypes/fileManager/DeleteFile.js.map +1 -1
- package/resolver/recordTypes/fileManager/fileManager.js +5 -3
- package/resolver/recordTypes/fileManager/fileManager.js.map +1 -1
- package/resolver/recordTypes/fileManager/fileManagerOnDelete.js +24 -35
- package/resolver/recordTypes/fileManager/fileManagerOnDelete.js.map +1 -1
- package/resolver/recordTypes/fileManager/fileManagerOnPut.js +24 -35
- package/resolver/recordTypes/fileManager/fileManagerOnPut.js.map +1 -1
- package/resolver/recordTypes/fileManager/shouldBeHandled.js +10 -27
- package/resolver/recordTypes/fileManager/shouldBeHandled.js.map +1 -1
- package/resolver/recordTypes/fileManager/types.js +0 -3
- package/resolver/recordTypes/users/CopyUser.js +44 -54
- package/resolver/recordTypes/users/CopyUser.js.map +1 -1
- package/resolver/recordTypes/users/DeleteUser.js +40 -51
- package/resolver/recordTypes/users/DeleteUser.js.map +1 -1
- package/resolver/recordTypes/users/shouldBeHandled.js +10 -26
- package/resolver/recordTypes/users/shouldBeHandled.js.map +1 -1
- package/resolver/recordTypes/users/types.js +0 -3
- package/resolver/recordTypes/users/users.js +5 -3
- package/resolver/recordTypes/users/users.js.map +1 -1
- package/resolver/recordTypes/users/usersOnDelete.js +23 -34
- package/resolver/recordTypes/users/usersOnDelete.js.map +1 -1
- package/resolver/recordTypes/users/usersOnPut.js +24 -35
- package/resolver/recordTypes/users/usersOnPut.js.map +1 -1
- package/sync/FilterOutRecord.js +9 -17
- package/sync/FilterOutRecord.js.map +1 -1
- package/sync/attachToDynamoDbDocument.js +46 -65
- package/sync/attachToDynamoDbDocument.js.map +1 -1
- package/sync/createHandler.js +31 -40
- package/sync/createHandler.js.map +1 -1
- package/sync/createSendDataToEventBridgeOnRequestEnd.js +32 -37
- package/sync/createSendDataToEventBridgeOnRequestEnd.js.map +1 -1
- package/sync/createSyncSystem.js +24 -26
- package/sync/createSyncSystem.js.map +1 -1
- package/sync/filter/createDefaultFilterOutRecordPlugins.js +37 -76
- package/sync/filter/createDefaultFilterOutRecordPlugins.js.map +1 -1
- package/sync/handler/Handler.js +64 -76
- package/sync/handler/Handler.js.map +1 -1
- package/sync/handler/HandlerConverter.js +21 -29
- package/sync/handler/HandlerConverter.js.map +1 -1
- package/sync/handler/converter/BatchGetCommandConverter.js +12 -11
- package/sync/handler/converter/BatchGetCommandConverter.js.map +1 -1
- package/sync/handler/converter/BatchWriteCommandConverter.js +12 -11
- package/sync/handler/converter/BatchWriteCommandConverter.js.map +1 -1
- package/sync/handler/converter/DeleteCommandConverter.js +12 -11
- package/sync/handler/converter/DeleteCommandConverter.js.map +1 -1
- package/sync/handler/converter/GetCommandConverter.js +12 -11
- package/sync/handler/converter/GetCommandConverter.js.map +1 -1
- package/sync/handler/converter/PutCommandConverter.js +12 -11
- package/sync/handler/converter/PutCommandConverter.js.map +1 -1
- package/sync/handler/converter/QueryCommandConverter.js +12 -11
- package/sync/handler/converter/QueryCommandConverter.js.map +1 -1
- package/sync/handler/converter/ScanCommandConverter.js +12 -11
- package/sync/handler/converter/ScanCommandConverter.js.map +1 -1
- package/sync/handler/converter/UpdateCommandConverter.js +12 -11
- package/sync/handler/converter/UpdateCommandConverter.js.map +1 -1
- package/sync/handler/converter/commands/BatchWriteCommandValue.js +34 -37
- package/sync/handler/converter/commands/BatchWriteCommandValue.js.map +1 -1
- package/sync/handler/converter/commands/DeleteCommandValue.js +19 -16
- package/sync/handler/converter/commands/DeleteCommandValue.js.map +1 -1
- package/sync/handler/converter/commands/NullCommandValue.js +8 -8
- package/sync/handler/converter/commands/NullCommandValue.js.map +1 -1
- package/sync/handler/converter/commands/PutCommandValue.js +19 -16
- package/sync/handler/converter/commands/PutCommandValue.js.map +1 -1
- package/sync/handler/converter/commands/UpdateCommandValue.js +19 -16
- package/sync/handler/converter/commands/UpdateCommandValue.js.map +1 -1
- package/sync/handler/types.js +0 -3
- package/sync/plugins/FilterOutRecordPlugin.js +17 -19
- package/sync/plugins/FilterOutRecordPlugin.js.map +1 -1
- package/sync/requestPlugin.js +33 -48
- package/sync/requestPlugin.js.map +1 -1
- package/sync/types.js +0 -3
- package/sync/utils/getTableType.js +10 -11
- package/sync/utils/getTableType.js.map +1 -1
- package/sync/utils/manifest.d.ts +1 -1
- package/sync/utils/manifest.js +28 -35
- package/sync/utils/manifest.js.map +1 -1
- package/sync/utils/validateSystemInput.js +21 -29
- package/sync/utils/validateSystemInput.js.map +1 -1
- package/types.d.ts +0 -1
- package/types.js +6 -6
- package/types.js.map +1 -1
- package/utils/createSystemName.js +5 -3
- package/utils/createSystemName.js.map +1 -1
- package/worker/actions/copyFile/CopyFile.js +183 -258
- package/worker/actions/copyFile/CopyFile.js.map +1 -1
- package/worker/actions/copyFile/copyFileAction.js +26 -34
- package/worker/actions/copyFile/copyFileAction.js.map +1 -1
- package/worker/actions/copyFile/copyFileSchema.d.ts +6 -38
- package/worker/actions/copyFile/copyFileSchema.js +13 -14
- package/worker/actions/copyFile/copyFileSchema.js.map +1 -1
- package/worker/actions/copyFile/types.js +0 -3
- package/worker/actions/createUser/CreateUser.js +51 -74
- package/worker/actions/createUser/CreateUser.js.map +1 -1
- package/worker/actions/createUser/createUserAction.js +24 -28
- package/worker/actions/createUser/createUserAction.js.map +1 -1
- package/worker/actions/createUser/createUserSchema.d.ts +6 -38
- package/worker/actions/createUser/createUserSchema.js +13 -14
- package/worker/actions/createUser/createUserSchema.js.map +1 -1
- package/worker/actions/createUser/types.js +0 -3
- package/worker/actions/deleteFile/DeleteFile.js +52 -67
- package/worker/actions/deleteFile/DeleteFile.js.map +1 -1
- package/worker/actions/deleteFile/deleteFileAction.js +21 -29
- package/worker/actions/deleteFile/deleteFileAction.js.map +1 -1
- package/worker/actions/deleteFile/deleteFileSchema.d.ts +6 -38
- package/worker/actions/deleteFile/deleteFileSchema.js +13 -14
- package/worker/actions/deleteFile/deleteFileSchema.js.map +1 -1
- package/worker/actions/deleteFile/types.js +0 -3
- package/worker/actions/deleteUser/DeleteUser.js +38 -52
- package/worker/actions/deleteUser/DeleteUser.js.map +1 -1
- package/worker/actions/deleteUser/deleteUserAction.js +22 -26
- package/worker/actions/deleteUser/deleteUserAction.js.map +1 -1
- package/worker/actions/deleteUser/deleteUserSchema.d.ts +5 -23
- package/worker/actions/deleteUser/deleteUserSchema.js +12 -13
- package/worker/actions/deleteUser/deleteUserSchema.js.map +1 -1
- package/worker/actions/deleteUser/types.js +0 -3
- package/worker/actions/logValidationError.js +5 -6
- package/worker/actions/logValidationError.js.map +1 -1
- package/worker/actions/removeCognitoUserAttributes.js +9 -15
- package/worker/actions/removeCognitoUserAttributes.js.map +1 -1
- package/worker/actions/updateUser/UpdateUser.js +48 -65
- package/worker/actions/updateUser/UpdateUser.js.map +1 -1
- package/worker/actions/updateUser/types.js +0 -3
- package/worker/actions/updateUser/updateUserAction.js +24 -28
- package/worker/actions/updateUser/updateUserAction.js.map +1 -1
- package/worker/actions/updateUser/updateUserSchema.d.ts +6 -38
- package/worker/actions/updateUser/updateUserSchema.js +13 -14
- package/worker/actions/updateUser/updateUserSchema.js.map +1 -1
- package/worker/createWorkerHandler.js +24 -30
- package/worker/createWorkerHandler.js.map +1 -1
- package/worker/handler/WorkerActionHandler.js +19 -21
- package/worker/handler/WorkerActionHandler.js.map +1 -1
- package/worker/handler/eventHandler.js +14 -16
- package/worker/handler/eventHandler.js.map +1 -1
- package/worker/plugins/WorkerActionPlugin.js +17 -16
- package/worker/plugins/WorkerActionPlugin.js.map +1 -1
- package/worker/types.js +0 -3
- package/index.js.map +0 -1
- package/resolver/app/abstractions/RecordHandler.js.map +0 -1
- package/resolver/app/abstractions/RecordsValidation.js.map +0 -1
- package/resolver/app/abstractions/ResolverApplication.js.map +0 -1
- package/resolver/app/abstractions/ResolverRecord.js.map +0 -1
- package/resolver/app/bundler/types.js.map +0 -1
- package/resolver/app/data/types.js.map +0 -1
- package/resolver/app/fetcher/types.js.map +0 -1
- package/resolver/app/ingestor/types.js.map +0 -1
- package/resolver/app/storer/types.js.map +0 -1
- package/resolver/deployment/types.js.map +0 -1
- package/resolver/recordTypes/fileManager/types.js.map +0 -1
- package/resolver/recordTypes/users/types.js.map +0 -1
- package/sync/handler/types.js.map +0 -1
- package/sync/types.js.map +0 -1
- package/worker/actions/copyFile/types.js.map +0 -1
- package/worker/actions/createUser/types.js.map +0 -1
- package/worker/actions/deleteFile/types.js.map +0 -1
- package/worker/actions/deleteUser/types.js.map +0 -1
- package/worker/actions/updateUser/types.js.map +0 -1
- package/worker/types.js.map +0 -1
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import zod from "zod";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
};
|
|
2
|
+
const createJsonTransform = (name)=>zod.string().transform((value, ctx)=>{
|
|
3
|
+
try {
|
|
4
|
+
return JSON.parse(value);
|
|
5
|
+
} catch {
|
|
6
|
+
ctx.addIssue({
|
|
7
|
+
code: zod.ZodIssueCode.custom,
|
|
8
|
+
message: `${name} must be a valid JSON string.`
|
|
9
|
+
});
|
|
10
|
+
return zod.NEVER;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
export { createJsonTransform };
|
|
15
14
|
|
|
16
15
|
//# sourceMappingURL=createJsonTransform.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"resolver/app/validation/createJsonTransform.js","sources":["../../../../src/resolver/app/validation/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"],"names":["createJsonTransform","name","zod","value","ctx","JSON"],"mappings":";AAEO,MAAMA,sBAAsB,CAACC,OACzBC,IAAI,MAAM,GAAG,SAAS,CAAC,CAACC,OAAOC;QAClC,IAAI;YACA,OAAOC,KAAK,KAAK,CAACF;QACtB,EAAE,OAAM;YACJC,IAAI,QAAQ,CAAC;gBACT,MAAMF,IAAI,YAAY,CAAC,MAAM;gBAC7B,SAAS,GAAGD,KAAK,6BAA6B,CAAC;YACnD;YACA,OAAOC,IAAI,KAAK;QACpB;IACJ"}
|
|
@@ -3,87 +3,34 @@ import type { NonEmptyArray } from "@webiny/api/types.js";
|
|
|
3
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
|
-
items: zod.
|
|
6
|
+
items: zod.ZodPipe<zod.ZodArray<zod.ZodObject<{
|
|
7
7
|
PK: zod.ZodString;
|
|
8
8
|
SK: zod.ZodString;
|
|
9
9
|
tableName: zod.ZodString;
|
|
10
|
-
tableType: zod.
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
tableType: zod.ZodPipe<zod.ZodEnum<{
|
|
11
|
+
regular: "regular";
|
|
12
|
+
opensearch: "opensearch";
|
|
13
|
+
unknown: "unknown";
|
|
14
|
+
log: "log";
|
|
15
|
+
}>, zod.ZodTransform<DynamoDBTableType, "regular" | "opensearch" | "unknown" | "log">>;
|
|
16
|
+
command: zod.ZodEnum<{
|
|
17
|
+
put: "put";
|
|
18
|
+
delete: "delete";
|
|
19
|
+
update: "update";
|
|
20
|
+
}>;
|
|
21
|
+
}, zod.core.$strip>>, zod.ZodTransform<NonEmptyArray<IResolverRecordBodyItem>, {
|
|
13
22
|
PK: string;
|
|
14
23
|
SK: string;
|
|
15
24
|
tableName: string;
|
|
16
25
|
tableType: DynamoDBTableType;
|
|
17
26
|
command: "put" | "delete" | "update";
|
|
18
|
-
}
|
|
19
|
-
PK: string;
|
|
20
|
-
SK: string;
|
|
21
|
-
tableName: string;
|
|
22
|
-
tableType: "unknown" | "regular" | "opensearch" | "log";
|
|
23
|
-
command: "put" | "delete" | "update";
|
|
24
|
-
}>, "many">, {
|
|
25
|
-
PK: string;
|
|
26
|
-
SK: string;
|
|
27
|
-
tableName: string;
|
|
28
|
-
tableType: DynamoDBTableType;
|
|
29
|
-
command: "put" | "delete" | "update";
|
|
30
|
-
}[], {
|
|
31
|
-
PK: string;
|
|
32
|
-
SK: string;
|
|
33
|
-
tableName: string;
|
|
34
|
-
tableType: "unknown" | "regular" | "opensearch" | "log";
|
|
35
|
-
command: "put" | "delete" | "update";
|
|
36
|
-
}[]>, NonEmptyArray<IResolverRecordBodyItem>, {
|
|
37
|
-
PK: string;
|
|
38
|
-
SK: string;
|
|
39
|
-
tableName: string;
|
|
40
|
-
tableType: "unknown" | "regular" | "opensearch" | "log";
|
|
41
|
-
command: "put" | "delete" | "update";
|
|
42
|
-
}[]>;
|
|
27
|
+
}[]>>;
|
|
43
28
|
source: zod.ZodObject<{
|
|
44
29
|
name: zod.ZodString;
|
|
45
30
|
env: zod.ZodString;
|
|
46
|
-
variant: zod.
|
|
31
|
+
variant: zod.ZodPipe<zod.ZodOptional<zod.ZodNullable<zod.ZodOptional<zod.ZodString>>>, zod.ZodTransform<string | undefined, string | null | undefined>>;
|
|
47
32
|
region: zod.ZodString;
|
|
48
33
|
version: zod.ZodString;
|
|
49
|
-
},
|
|
50
|
-
region: string;
|
|
51
|
-
name: string;
|
|
52
|
-
env: string;
|
|
53
|
-
version: string;
|
|
54
|
-
variant?: string | undefined;
|
|
55
|
-
}, {
|
|
56
|
-
region: string;
|
|
57
|
-
name: string;
|
|
58
|
-
env: string;
|
|
59
|
-
version: string;
|
|
60
|
-
variant?: string | null | undefined;
|
|
61
|
-
}>;
|
|
34
|
+
}, zod.core.$strip>;
|
|
62
35
|
id: zod.ZodString;
|
|
63
|
-
},
|
|
64
|
-
source: {
|
|
65
|
-
region: string;
|
|
66
|
-
name: string;
|
|
67
|
-
env: string;
|
|
68
|
-
version: string;
|
|
69
|
-
variant?: string | undefined;
|
|
70
|
-
};
|
|
71
|
-
items: NonEmptyArray<IResolverRecordBodyItem>;
|
|
72
|
-
id: string;
|
|
73
|
-
}, {
|
|
74
|
-
source: {
|
|
75
|
-
region: string;
|
|
76
|
-
name: string;
|
|
77
|
-
env: string;
|
|
78
|
-
version: string;
|
|
79
|
-
variant?: string | null | undefined;
|
|
80
|
-
};
|
|
81
|
-
items: {
|
|
82
|
-
PK: string;
|
|
83
|
-
SK: string;
|
|
84
|
-
tableName: string;
|
|
85
|
-
tableType: "unknown" | "regular" | "opensearch" | "log";
|
|
86
|
-
command: "put" | "delete" | "update";
|
|
87
|
-
}[];
|
|
88
|
-
id: string;
|
|
89
|
-
}>;
|
|
36
|
+
}, zod.core.$strip>;
|
|
@@ -1,42 +1,37 @@
|
|
|
1
1
|
import zod from "zod";
|
|
2
2
|
import { createSystemValidation } from "./system.js";
|
|
3
3
|
import { DynamoDBTableType } from "../../../types.js";
|
|
4
|
-
const convert = input
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const transformTableType = input => {
|
|
11
|
-
const keys = Object.keys(DynamoDBTableType);
|
|
12
|
-
for (const key of keys) {
|
|
13
|
-
const value = DynamoDBTableType[key];
|
|
14
|
-
if (value === input) {
|
|
15
|
-
return value;
|
|
4
|
+
const convert = (input)=>input;
|
|
5
|
+
const transformTableType = (input)=>{
|
|
6
|
+
const keys = Object.keys(DynamoDBTableType);
|
|
7
|
+
for (const key of keys){
|
|
8
|
+
const value = DynamoDBTableType[key];
|
|
9
|
+
if (value === input) return value;
|
|
16
10
|
}
|
|
17
|
-
|
|
18
|
-
return DynamoDBTableType.UNKNOWN;
|
|
19
|
-
};
|
|
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 => {
|
|
27
|
-
return transformTableType(input);
|
|
28
|
-
}),
|
|
29
|
-
command: zod.enum(["update", "put", "delete"])
|
|
30
|
-
})).refine(values => {
|
|
31
|
-
return values.length > 0;
|
|
32
|
-
}, {
|
|
33
|
-
message: `"items" array must not be empty.`
|
|
34
|
-
}).transform(values => {
|
|
35
|
-
return convert(values);
|
|
36
|
-
}),
|
|
37
|
-
source: createSystemValidation(),
|
|
38
|
-
id: zod.string()
|
|
39
|
-
});
|
|
11
|
+
return DynamoDBTableType.UNKNOWN;
|
|
40
12
|
};
|
|
13
|
+
const createDetailValidation = ()=>zod.object({
|
|
14
|
+
items: zod.array(zod.object({
|
|
15
|
+
PK: zod.string(),
|
|
16
|
+
SK: zod.string(),
|
|
17
|
+
tableName: zod.string(),
|
|
18
|
+
tableType: zod["enum"]([
|
|
19
|
+
"regular",
|
|
20
|
+
"opensearch",
|
|
21
|
+
"log",
|
|
22
|
+
"unknown"
|
|
23
|
+
]).transform((input)=>transformTableType(input)),
|
|
24
|
+
command: zod["enum"]([
|
|
25
|
+
"update",
|
|
26
|
+
"put",
|
|
27
|
+
"delete"
|
|
28
|
+
])
|
|
29
|
+
})).refine((values)=>values.length > 0, {
|
|
30
|
+
message: '"items" array must not be empty.'
|
|
31
|
+
}).transform((values)=>convert(values)),
|
|
32
|
+
source: createSystemValidation(),
|
|
33
|
+
id: zod.string()
|
|
34
|
+
});
|
|
35
|
+
export { createDetailValidation };
|
|
41
36
|
|
|
42
37
|
//# sourceMappingURL=detail.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"resolver/app/validation/detail.js","sources":["../../../../src/resolver/app/validation/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"],"names":["convert","input","transformTableType","keys","Object","DynamoDBTableType","key","value","createDetailValidation","zod","values","createSystemValidation"],"mappings":";;;AAMA,MAAMA,UAAU,CAACC,QAINA;AAGX,MAAMC,qBAAqB,CAACD;IACxB,MAAME,OAAOC,OAAO,IAAI,CAACC;IACzB,KAAK,MAAMC,OAAOH,KAAM;QACpB,MAAMI,QAAQF,iBAAiB,CAACC,IAAI;QACpC,IAAIC,UAAUN,OACV,OAAOM;IAEf;IACA,OAAOF,kBAAkB,OAAO;AACpC;AAEO,MAAMG,yBAAyB,IAC3BC,IAAI,MAAM,CAAC;QACd,OAAOA,IAAAA,KACG,CACFA,IAAI,MAAM,CAAC;YACP,IAAIA,IAAI,MAAM;YACd,IAAIA,IAAI,MAAM;YACd,WAAWA,IAAI,MAAM;YACrB,WAAWA,GAAG,CAAHA,OACF,CAAC;gBAAC;gBAAW;gBAAc;gBAAO;aAAU,EAChD,SAAS,CAACR,CAAAA,QACAC,mBAAmBD;YAElC,SAASQ,GAAG,CAAHA,OAAQ,CAAC;gBAAC;gBAAU;gBAAO;aAAS;QACjD,IAEH,MAAM,CACHC,CAAAA,SACWA,OAAO,MAAM,GAAG,GAE3B;YACI,SAAS;QACb,GAEH,SAAS,CAACA,CAAAA,SACAV,QAAQU;QAEvB,QAAQC;QACR,IAAIF,IAAI,MAAM;IAClB"}
|
|
@@ -2,216 +2,57 @@ import zod from "zod";
|
|
|
2
2
|
export declare const createEventValidation: () => zod.ZodArray<zod.ZodObject<{
|
|
3
3
|
messageId: zod.ZodString;
|
|
4
4
|
receiptHandle: zod.ZodString;
|
|
5
|
-
body: zod.
|
|
6
|
-
version: zod.
|
|
5
|
+
body: zod.ZodPipe<zod.ZodPipe<zod.ZodString, zod.ZodTransform<any, string>>, zod.ZodObject<{
|
|
6
|
+
version: zod.ZodPipe<zod.ZodString, zod.ZodTransform<`${number}`, string>>;
|
|
7
7
|
id: zod.ZodString;
|
|
8
|
-
"detail-type": zod.
|
|
9
|
-
source: zod.
|
|
10
|
-
account: zod.
|
|
11
|
-
time: zod.
|
|
8
|
+
"detail-type": zod.ZodPipe<zod.ZodString, zod.ZodTransform<"synchronization-input", string>>;
|
|
9
|
+
source: zod.ZodPipe<zod.ZodString, zod.ZodTransform<`webiny:${string}`, string>>;
|
|
10
|
+
account: zod.ZodPipe<zod.ZodString, zod.ZodTransform<`${number}`, string>>;
|
|
11
|
+
time: zod.ZodPipe<zod.ZodString, zod.ZodTransform<Date, string>>;
|
|
12
12
|
region: zod.ZodString;
|
|
13
|
-
resources: zod.ZodArray<zod.ZodString
|
|
13
|
+
resources: zod.ZodArray<zod.ZodString>;
|
|
14
14
|
detail: zod.ZodObject<{
|
|
15
|
-
items: zod.
|
|
15
|
+
items: zod.ZodPipe<zod.ZodArray<zod.ZodObject<{
|
|
16
16
|
PK: zod.ZodString;
|
|
17
17
|
SK: zod.ZodString;
|
|
18
18
|
tableName: zod.ZodString;
|
|
19
|
-
tableType: zod.
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
tableType: zod.ZodPipe<zod.ZodEnum<{
|
|
20
|
+
regular: "regular";
|
|
21
|
+
opensearch: "opensearch";
|
|
22
|
+
unknown: "unknown";
|
|
23
|
+
log: "log";
|
|
24
|
+
}>, zod.ZodTransform<import("../../../types").DynamoDBTableType, "regular" | "opensearch" | "unknown" | "log">>;
|
|
25
|
+
command: zod.ZodEnum<{
|
|
26
|
+
put: "put";
|
|
27
|
+
delete: "delete";
|
|
28
|
+
update: "update";
|
|
29
|
+
}>;
|
|
30
|
+
}, zod.core.$strip>>, zod.ZodTransform<import("@webiny/api/types").NonEmptyArray<import("../abstractions/ResolverRecord").IResolverRecordBodyItem>, {
|
|
22
31
|
PK: string;
|
|
23
32
|
SK: string;
|
|
24
33
|
tableName: string;
|
|
25
34
|
tableType: import("../../../types").DynamoDBTableType;
|
|
26
35
|
command: "put" | "delete" | "update";
|
|
27
|
-
}
|
|
28
|
-
PK: string;
|
|
29
|
-
SK: string;
|
|
30
|
-
tableName: string;
|
|
31
|
-
tableType: "unknown" | "regular" | "opensearch" | "log";
|
|
32
|
-
command: "put" | "delete" | "update";
|
|
33
|
-
}>, "many">, {
|
|
34
|
-
PK: string;
|
|
35
|
-
SK: string;
|
|
36
|
-
tableName: string;
|
|
37
|
-
tableType: import("../../../types").DynamoDBTableType;
|
|
38
|
-
command: "put" | "delete" | "update";
|
|
39
|
-
}[], {
|
|
40
|
-
PK: string;
|
|
41
|
-
SK: string;
|
|
42
|
-
tableName: string;
|
|
43
|
-
tableType: "unknown" | "regular" | "opensearch" | "log";
|
|
44
|
-
command: "put" | "delete" | "update";
|
|
45
|
-
}[]>, import("@webiny/api/types").NonEmptyArray<import("../abstractions/ResolverRecord").IResolverRecordBodyItem>, {
|
|
46
|
-
PK: string;
|
|
47
|
-
SK: string;
|
|
48
|
-
tableName: string;
|
|
49
|
-
tableType: "unknown" | "regular" | "opensearch" | "log";
|
|
50
|
-
command: "put" | "delete" | "update";
|
|
51
|
-
}[]>;
|
|
36
|
+
}[]>>;
|
|
52
37
|
source: zod.ZodObject<{
|
|
53
38
|
name: zod.ZodString;
|
|
54
39
|
env: zod.ZodString;
|
|
55
|
-
variant: zod.
|
|
40
|
+
variant: zod.ZodPipe<zod.ZodOptional<zod.ZodNullable<zod.ZodOptional<zod.ZodString>>>, zod.ZodTransform<string | undefined, string | null | undefined>>;
|
|
56
41
|
region: zod.ZodString;
|
|
57
42
|
version: zod.ZodString;
|
|
58
|
-
},
|
|
59
|
-
region: string;
|
|
60
|
-
name: string;
|
|
61
|
-
env: string;
|
|
62
|
-
version: string;
|
|
63
|
-
variant?: string | undefined;
|
|
64
|
-
}, {
|
|
65
|
-
region: string;
|
|
66
|
-
name: string;
|
|
67
|
-
env: string;
|
|
68
|
-
version: string;
|
|
69
|
-
variant?: string | null | undefined;
|
|
70
|
-
}>;
|
|
43
|
+
}, zod.core.$strip>;
|
|
71
44
|
id: zod.ZodString;
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
region: string;
|
|
75
|
-
name: string;
|
|
76
|
-
env: string;
|
|
77
|
-
version: string;
|
|
78
|
-
variant?: string | undefined;
|
|
79
|
-
};
|
|
80
|
-
items: import("@webiny/api/types").NonEmptyArray<import("../abstractions/ResolverRecord").IResolverRecordBodyItem>;
|
|
81
|
-
id: string;
|
|
82
|
-
}, {
|
|
83
|
-
source: {
|
|
84
|
-
region: string;
|
|
85
|
-
name: string;
|
|
86
|
-
env: string;
|
|
87
|
-
version: string;
|
|
88
|
-
variant?: string | null | undefined;
|
|
89
|
-
};
|
|
90
|
-
items: {
|
|
91
|
-
PK: string;
|
|
92
|
-
SK: string;
|
|
93
|
-
tableName: string;
|
|
94
|
-
tableType: "unknown" | "regular" | "opensearch" | "log";
|
|
95
|
-
command: "put" | "delete" | "update";
|
|
96
|
-
}[];
|
|
97
|
-
id: string;
|
|
98
|
-
}>;
|
|
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}`;
|
|
106
|
-
time: Date;
|
|
107
|
-
resources: string[];
|
|
108
|
-
detail: {
|
|
109
|
-
source: {
|
|
110
|
-
region: string;
|
|
111
|
-
name: string;
|
|
112
|
-
env: string;
|
|
113
|
-
version: string;
|
|
114
|
-
variant?: string | undefined;
|
|
115
|
-
};
|
|
116
|
-
items: import("@webiny/api/types").NonEmptyArray<import("../abstractions/ResolverRecord").IResolverRecordBodyItem>;
|
|
117
|
-
id: string;
|
|
118
|
-
};
|
|
119
|
-
}, {
|
|
120
|
-
region: string;
|
|
121
|
-
source: string;
|
|
122
|
-
version: string;
|
|
123
|
-
id: string;
|
|
124
|
-
"detail-type": string;
|
|
125
|
-
account: string;
|
|
126
|
-
time: string;
|
|
127
|
-
resources: string[];
|
|
128
|
-
detail: {
|
|
129
|
-
source: {
|
|
130
|
-
region: string;
|
|
131
|
-
name: string;
|
|
132
|
-
env: string;
|
|
133
|
-
version: string;
|
|
134
|
-
variant?: string | null | undefined;
|
|
135
|
-
};
|
|
136
|
-
items: {
|
|
137
|
-
PK: string;
|
|
138
|
-
SK: string;
|
|
139
|
-
tableName: string;
|
|
140
|
-
tableType: "unknown" | "regular" | "opensearch" | "log";
|
|
141
|
-
command: "put" | "delete" | "update";
|
|
142
|
-
}[];
|
|
143
|
-
id: string;
|
|
144
|
-
};
|
|
145
|
-
}>>;
|
|
45
|
+
}, zod.core.$strip>;
|
|
46
|
+
}, zod.core.$strip>>;
|
|
146
47
|
attributes: zod.ZodObject<{
|
|
147
48
|
ApproximateReceiveCount: zod.ZodString;
|
|
148
49
|
SentTimestamp: zod.ZodString;
|
|
149
50
|
SenderId: zod.ZodString;
|
|
150
51
|
ApproximateFirstReceiveTimestamp: zod.ZodString;
|
|
151
|
-
},
|
|
152
|
-
|
|
153
|
-
SentTimestamp: string;
|
|
154
|
-
SenderId: string;
|
|
155
|
-
ApproximateFirstReceiveTimestamp: string;
|
|
156
|
-
}, {
|
|
157
|
-
ApproximateReceiveCount: string;
|
|
158
|
-
SentTimestamp: string;
|
|
159
|
-
SenderId: string;
|
|
160
|
-
ApproximateFirstReceiveTimestamp: string;
|
|
161
|
-
}>;
|
|
162
|
-
messageAttributes: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
52
|
+
}, zod.core.$strip>;
|
|
53
|
+
messageAttributes: zod.ZodOptional<zod.ZodObject<{}, zod.core.$loose>>;
|
|
163
54
|
md5OfBody: zod.ZodString;
|
|
164
55
|
eventSource: zod.ZodString;
|
|
165
56
|
eventSourceARN: zod.ZodString;
|
|
166
57
|
awsRegion: zod.ZodString;
|
|
167
|
-
},
|
|
168
|
-
body: {
|
|
169
|
-
region: string;
|
|
170
|
-
source: `webiny:${string}`;
|
|
171
|
-
version: `${number}`;
|
|
172
|
-
id: string;
|
|
173
|
-
"detail-type": "synchronization-input";
|
|
174
|
-
account: `${number}`;
|
|
175
|
-
time: Date;
|
|
176
|
-
resources: string[];
|
|
177
|
-
detail: {
|
|
178
|
-
source: {
|
|
179
|
-
region: string;
|
|
180
|
-
name: string;
|
|
181
|
-
env: string;
|
|
182
|
-
version: string;
|
|
183
|
-
variant?: string | undefined;
|
|
184
|
-
};
|
|
185
|
-
items: import("@webiny/api/types").NonEmptyArray<import("../abstractions/ResolverRecord").IResolverRecordBodyItem>;
|
|
186
|
-
id: string;
|
|
187
|
-
};
|
|
188
|
-
};
|
|
189
|
-
messageId: string;
|
|
190
|
-
receiptHandle: string;
|
|
191
|
-
attributes: {
|
|
192
|
-
ApproximateReceiveCount: string;
|
|
193
|
-
SentTimestamp: string;
|
|
194
|
-
SenderId: string;
|
|
195
|
-
ApproximateFirstReceiveTimestamp: string;
|
|
196
|
-
};
|
|
197
|
-
md5OfBody: string;
|
|
198
|
-
eventSource: string;
|
|
199
|
-
eventSourceARN: string;
|
|
200
|
-
awsRegion: string;
|
|
201
|
-
messageAttributes?: zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough"> | undefined;
|
|
202
|
-
}, {
|
|
203
|
-
body: string;
|
|
204
|
-
messageId: string;
|
|
205
|
-
receiptHandle: string;
|
|
206
|
-
attributes: {
|
|
207
|
-
ApproximateReceiveCount: string;
|
|
208
|
-
SentTimestamp: string;
|
|
209
|
-
SenderId: string;
|
|
210
|
-
ApproximateFirstReceiveTimestamp: string;
|
|
211
|
-
};
|
|
212
|
-
md5OfBody: string;
|
|
213
|
-
eventSource: string;
|
|
214
|
-
eventSourceARN: string;
|
|
215
|
-
awsRegion: string;
|
|
216
|
-
messageAttributes?: zod.objectInputType<{}, zod.ZodTypeAny, "passthrough"> | undefined;
|
|
217
|
-
}>, "many">;
|
|
58
|
+
}, zod.core.$strip>>;
|
|
@@ -2,23 +2,22 @@ import zod from "zod";
|
|
|
2
2
|
import { createJsonTransform } from "./createJsonTransform.js";
|
|
3
3
|
import { createBodyValidation } from "./body.js";
|
|
4
4
|
const bodyTransform = createJsonTransform("Body");
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
5
|
+
const createEventValidation = ()=>zod.array(zod.object({
|
|
6
|
+
messageId: zod.string(),
|
|
7
|
+
receiptHandle: zod.string(),
|
|
8
|
+
body: bodyTransform.pipe(createBodyValidation()),
|
|
9
|
+
attributes: zod.object({
|
|
10
|
+
ApproximateReceiveCount: zod.string(),
|
|
11
|
+
SentTimestamp: zod.string(),
|
|
12
|
+
SenderId: zod.string(),
|
|
13
|
+
ApproximateFirstReceiveTimestamp: zod.string()
|
|
14
|
+
}),
|
|
15
|
+
messageAttributes: zod.looseObject({}).optional(),
|
|
16
|
+
md5OfBody: zod.string(),
|
|
17
|
+
eventSource: zod.string(),
|
|
18
|
+
eventSourceARN: zod.string(),
|
|
19
|
+
awsRegion: zod.string()
|
|
20
|
+
}));
|
|
21
|
+
export { createEventValidation };
|
|
23
22
|
|
|
24
23
|
//# sourceMappingURL=event.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"resolver/app/validation/event.js","sources":["../../../../src/resolver/app/validation/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.looseObject({}).optional(),\n md5OfBody: zod.string(),\n eventSource: zod.string(),\n eventSourceARN: zod.string(),\n awsRegion: zod.string()\n })\n );\n};\n"],"names":["bodyTransform","createJsonTransform","createEventValidation","zod","createBodyValidation"],"mappings":";;;AAIA,MAAMA,gBAAgBC,oBAAoB;AAEnC,MAAMC,wBAAwB,IAC1BC,IAAI,KAAK,CACZA,IAAI,MAAM,CAAC;QACP,WAAWA,IAAI,MAAM;QACrB,eAAeA,IAAI,MAAM;QACzB,MAAMH,cAAc,IAAI,CAACI;QACzB,YAAYD,IAAI,MAAM,CAAC;YACnB,yBAAyBA,IAAI,MAAM;YACnC,eAAeA,IAAI,MAAM;YACzB,UAAUA,IAAI,MAAM;YACpB,kCAAkCA,IAAI,MAAM;QAChD;QACA,mBAAmBA,IAAI,WAAW,CAAC,CAAC,GAAG,QAAQ;QAC/C,WAAWA,IAAI,MAAM;QACrB,aAAaA,IAAI,MAAM;QACvB,gBAAgBA,IAAI,MAAM;QAC1B,WAAWA,IAAI,MAAM;IACzB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import zod from "zod";
|
|
2
|
-
export declare const createNumericStringValidation: (name: string) => zod.
|
|
2
|
+
export declare const createNumericStringValidation: (name: string) => zod.ZodPipe<zod.ZodString, zod.ZodTransform<`${number}`, string>>;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import zod from "zod";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
message: `"${name}" must be a numeric string.`
|
|
2
|
+
const createNumericStringValidation = (name)=>zod.string().transform((value, ctx)=>{
|
|
3
|
+
if (/^\d+$/.test(value)) return value;
|
|
4
|
+
ctx.addIssue({
|
|
5
|
+
code: zod.ZodIssueCode.custom,
|
|
6
|
+
message: `"${name}" must be a numeric string.`
|
|
7
|
+
});
|
|
8
|
+
return zod.NEVER;
|
|
10
9
|
});
|
|
11
|
-
|
|
12
|
-
});
|
|
13
|
-
};
|
|
10
|
+
export { createNumericStringValidation };
|
|
14
11
|
|
|
15
12
|
//# sourceMappingURL=numericString.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"resolver/app/validation/numericString.js","sources":["../../../../src/resolver/app/validation/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"],"names":["createNumericStringValidation","name","zod","value","ctx"],"mappings":";AAEO,MAAMA,gCAAgC,CAACC,OACnCC,IAAI,MAAM,GAAG,SAAS,CAAC,CAACC,OAAOC;QAClC,IAAI,QAAQ,IAAI,CAACD,QACb,OAAOA;QAEXC,IAAI,QAAQ,CAAC;YACT,MAAMF,IAAI,YAAY,CAAC,MAAM;YAC7B,SAAS,CAAC,CAAC,EAAED,KAAK,2BAA2B,CAAC;QAClD;QACA,OAAOC,IAAI,KAAK;IACpB"}
|
|
@@ -2,19 +2,7 @@ import zod from "zod";
|
|
|
2
2
|
export declare const createSystemValidation: () => zod.ZodObject<{
|
|
3
3
|
name: zod.ZodString;
|
|
4
4
|
env: zod.ZodString;
|
|
5
|
-
variant: zod.
|
|
5
|
+
variant: zod.ZodPipe<zod.ZodOptional<zod.ZodNullable<zod.ZodOptional<zod.ZodString>>>, zod.ZodTransform<string | undefined, string | null | undefined>>;
|
|
6
6
|
region: zod.ZodString;
|
|
7
7
|
version: zod.ZodString;
|
|
8
|
-
},
|
|
9
|
-
region: string;
|
|
10
|
-
name: string;
|
|
11
|
-
env: string;
|
|
12
|
-
version: string;
|
|
13
|
-
variant?: string | undefined;
|
|
14
|
-
}, {
|
|
15
|
-
region: string;
|
|
16
|
-
name: string;
|
|
17
|
-
env: string;
|
|
18
|
-
version: string;
|
|
19
|
-
variant?: string | null | undefined;
|
|
20
|
-
}>;
|
|
8
|
+
}, zod.core.$strip>;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import zod from "zod";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
2
|
+
const createSystemValidation = ()=>zod.object({
|
|
3
|
+
name: zod.string(),
|
|
4
|
+
env: zod.string(),
|
|
5
|
+
variant: zod.string().optional().nullish().transform((value)=>value || void 0),
|
|
6
|
+
region: zod.string(),
|
|
7
|
+
version: zod.string()
|
|
8
|
+
});
|
|
9
|
+
export { createSystemValidation };
|
|
11
10
|
|
|
12
11
|
//# sourceMappingURL=system.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"resolver/app/validation/system.js","sources":["../../../../src/resolver/app/validation/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"],"names":["createSystemValidation","zod","value","undefined"],"mappings":";AAEO,MAAMA,yBAAyB,IAC3BC,IAAI,MAAM,CAAC;QACd,MAAMA,IAAI,MAAM;QAChB,KAAKA,IAAI,MAAM;QACf,SAASA,IAAAA,MACE,GACN,QAAQ,GACR,OAAO,GACP,SAAS,CAACC,CAAAA,QAASA,SAASC;QACjC,QAAQF,IAAI,MAAM;QAClB,SAASA,IAAI,MAAM;IACvB"}
|