@awsless/awsless 0.0.666 → 0.0.667
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/dist/app.json +1 -1
- package/dist/app.stage.json +1 -1
- package/dist/bin.js +986 -416
- package/dist/build-json-schema.js +302 -177
- package/dist/prebuild/icon/bundle.zip +0 -0
- package/dist/prebuild/image/bundle.zip +0 -0
- package/dist/prebuild/on-error-log/bundle.zip +0 -0
- package/dist/prebuild/on-failure/bundle.zip +0 -0
- package/dist/prebuild/rpc/bundle.zip +0 -0
- package/dist/server.d.ts +12 -1
- package/dist/server.js +88 -9
- package/dist/stack.json +1 -1
- package/dist/stack.stage.json +1 -1
- package/package.json +15 -14
|
@@ -4,7 +4,7 @@ import { join as join2 } from "path";
|
|
|
4
4
|
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
5
5
|
|
|
6
6
|
// src/config/app.ts
|
|
7
|
-
import { z as
|
|
7
|
+
import { z as z26 } from "zod";
|
|
8
8
|
|
|
9
9
|
// src/feature/alert/schema.ts
|
|
10
10
|
import { kebabCase } from "change-case";
|
|
@@ -233,7 +233,7 @@ var LogRetentionSchema = DurationSchema.refine(
|
|
|
233
233
|
(duration) => {
|
|
234
234
|
return validLogRetentionDays.includes(toDays(duration));
|
|
235
235
|
},
|
|
236
|
-
`Invalid log retention. Valid days are: ${validLogRetentionDays.map((
|
|
236
|
+
`Invalid log retention. Valid days are: ${validLogRetentionDays.map((days6) => `${days6}`).join(", ")}`
|
|
237
237
|
).describe("The log retention duration.");
|
|
238
238
|
var LogSchema = z11.union([
|
|
239
239
|
z11.boolean().transform((enabled) => ({ retention: enabled ? days(7) : days(0) })),
|
|
@@ -773,13 +773,11 @@ var RpcSchema = z21.record(
|
|
|
773
773
|
).describe("The queries for your global RPC API.")
|
|
774
774
|
).describe("Define the schema in your stack for your global RPC API.").optional();
|
|
775
775
|
|
|
776
|
-
// src/feature/
|
|
777
|
-
import { days as days4, toDays as toDays2 } from "@awsless/duration";
|
|
776
|
+
// src/feature/job/schema.ts
|
|
777
|
+
import { days as days4, hours as hours2, minutes as minutes5, toDays as toDays2 } from "@awsless/duration";
|
|
778
778
|
import { toMebibytes } from "@awsless/size";
|
|
779
779
|
import { z as z22 } from "zod";
|
|
780
|
-
var CpuSchema = z22.union([z22.literal(0.25), z22.literal(0.5), z22.literal(1), z22.literal(2), z22.literal(4), z22.literal(8), z22.literal(16)]).transform((v) => `${v} vCPU`).describe(
|
|
781
|
-
"The number of virtual CPU units (vCPU) used by the instance. Valid values: 0.25, 0.5, 1, 2, 4, 8, 16 vCPU."
|
|
782
|
-
);
|
|
780
|
+
var CpuSchema = z22.union([z22.literal(0.25), z22.literal(0.5), z22.literal(1), z22.literal(2), z22.literal(4), z22.literal(8), z22.literal(16)]).transform((v) => `${v} vCPU`).describe("The number of virtual CPU units (vCPU) used by the job. Valid values: 0.25, 0.5, 1, 2, 4, 8, 16 vCPU.");
|
|
783
781
|
var validMemorySize = [
|
|
784
782
|
// 0.25 vCPU
|
|
785
783
|
512,
|
|
@@ -816,22 +814,9 @@ var validMemorySize = [
|
|
|
816
814
|
var MemorySizeSchema2 = SizeSchema.refine(
|
|
817
815
|
(s) => validMemorySize.includes(toMebibytes(s)),
|
|
818
816
|
`Invalid memory size. Allowed sizes: ${validMemorySize.join(", ")} MiB`
|
|
819
|
-
).describe("The amount of memory (in MiB) used by the
|
|
820
|
-
var HealthCheckSchema = z22.object({
|
|
821
|
-
path: z22.string().describe("The path that the container runs to determine if it is healthy."),
|
|
822
|
-
interval: DurationSchema.describe("The time period in seconds between each health check execution."),
|
|
823
|
-
retries: z22.number().int().min(1).max(10).describe(
|
|
824
|
-
"The number of times to retry a failed health check before the container is considered unhealthy."
|
|
825
|
-
),
|
|
826
|
-
startPeriod: DurationSchema.describe(
|
|
827
|
-
"The optional grace period to provide containers time to bootstrap before failed health checks count towards the maximum number of retries."
|
|
828
|
-
),
|
|
829
|
-
timeout: DurationSchema.describe(
|
|
830
|
-
"The time period in seconds to wait for a health check to succeed before it is considered a failure."
|
|
831
|
-
)
|
|
832
|
-
}).describe("The health check command and associated configuration parameters for the container.");
|
|
817
|
+
).describe("The amount of memory (in MiB) used by the job. Valid memory values depend on the CPU configuration.");
|
|
833
818
|
var EnvironmentSchema2 = z22.record(z22.string(), z22.string()).optional().describe("Environment variable key-value pairs.");
|
|
834
|
-
var ArchitectureSchema3 = z22.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the
|
|
819
|
+
var ArchitectureSchema3 = z22.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the job supports.");
|
|
835
820
|
var ActionSchema2 = z22.string();
|
|
836
821
|
var ActionsSchema2 = z22.union([ActionSchema2.transform((v) => [v]), ActionSchema2.array()]);
|
|
837
822
|
var ArnSchema2 = z22.string().startsWith("arn:");
|
|
@@ -843,9 +828,7 @@ var PermissionSchema2 = z22.object({
|
|
|
843
828
|
actions: ActionsSchema2,
|
|
844
829
|
resources: ResourcesSchema2
|
|
845
830
|
});
|
|
846
|
-
var PermissionsSchema2 = z22.union([PermissionSchema2.transform((v) => [v]), PermissionSchema2.array()]).describe("Add IAM permissions to your
|
|
847
|
-
var DescriptionSchema2 = z22.string().describe("A description of the instance.");
|
|
848
|
-
var ImageSchema = z22.string().optional().describe("The URL of the container image to use.");
|
|
831
|
+
var PermissionsSchema2 = z22.union([PermissionSchema2.transform((v) => [v]), PermissionSchema2.array()]).describe("Add IAM permissions to your job.");
|
|
849
832
|
var validLogRetentionDays2 = [
|
|
850
833
|
...[1, 3, 5, 7, 14, 30, 60, 90, 120, 150],
|
|
851
834
|
...[180, 365, 400, 545, 731, 1096, 1827, 2192],
|
|
@@ -858,7 +841,7 @@ var LogRetentionSchema2 = DurationSchema.refine(
|
|
|
858
841
|
(duration) => {
|
|
859
842
|
return validLogRetentionDays2.includes(toDays2(duration));
|
|
860
843
|
},
|
|
861
|
-
`Invalid log retention. Valid days are: ${validLogRetentionDays2.map((
|
|
844
|
+
`Invalid log retention. Valid days are: ${validLogRetentionDays2.map((days6) => `${days6}`).join(", ")}`
|
|
862
845
|
).describe("The log retention duration.");
|
|
863
846
|
var LogSchema2 = z22.union([
|
|
864
847
|
z22.boolean().transform((enabled) => ({ retention: enabled ? days4(7) : days4(0) })),
|
|
@@ -868,59 +851,199 @@ var LogSchema2 = z22.union([
|
|
|
868
851
|
})
|
|
869
852
|
]).describe("Enable logging to a CloudWatch log group. Providing a duration value will set the log retention time.");
|
|
870
853
|
var FileCodeSchema2 = z22.object({
|
|
871
|
-
file: LocalFileSchema.describe("The file path of the
|
|
854
|
+
file: LocalFileSchema.describe("The file path of the job code.")
|
|
872
855
|
});
|
|
873
856
|
var CodeSchema2 = z22.union([
|
|
874
857
|
LocalFileSchema.transform((file) => ({
|
|
875
858
|
file
|
|
876
859
|
})).pipe(FileCodeSchema2),
|
|
877
860
|
FileCodeSchema2
|
|
878
|
-
]).describe("Specify the code of your
|
|
879
|
-
var
|
|
861
|
+
]).describe("Specify the code of your job.");
|
|
862
|
+
var TimeoutSchema3 = DurationSchema.refine(durationMin(minutes5(1)), "Minimum timeout is 1 minute.").refine(durationMax(hours2(4)), "Maximum timeout is 4 hours.").describe("The maximum time the job is allowed to run before being stopped.");
|
|
863
|
+
var ImageSchema = z22.string().describe("The URL of the container image to use.");
|
|
864
|
+
var StartupCommandSchema = z22.union([z22.string().transform((v) => [v]), z22.string().array()]).describe("Optional shell commands to run before the job program starts.");
|
|
865
|
+
var ASchema = z22.object({
|
|
880
866
|
code: CodeSchema2,
|
|
881
|
-
description: DescriptionSchema2.optional(),
|
|
882
867
|
image: ImageSchema.optional(),
|
|
868
|
+
startupCommand: StartupCommandSchema.optional(),
|
|
883
869
|
log: LogSchema2.optional(),
|
|
884
870
|
cpu: CpuSchema.optional(),
|
|
885
871
|
memorySize: MemorySizeSchema2.optional(),
|
|
886
872
|
architecture: ArchitectureSchema3.optional(),
|
|
887
873
|
environment: EnvironmentSchema2.optional(),
|
|
888
874
|
permissions: PermissionsSchema2.optional(),
|
|
889
|
-
|
|
890
|
-
// restartPolicy: RestartPolicySchema.optional(),
|
|
875
|
+
timeout: TimeoutSchema3.default("30 minutes").describe("The maximum time the job is allowed to run before being stopped. Default: 30 minutes.")
|
|
891
876
|
});
|
|
892
|
-
var
|
|
877
|
+
var JobSchema = z22.union([
|
|
893
878
|
LocalFileSchema.transform((code) => ({
|
|
894
879
|
code
|
|
895
|
-
})).pipe(
|
|
896
|
-
|
|
880
|
+
})).pipe(ASchema),
|
|
881
|
+
ASchema
|
|
897
882
|
]);
|
|
898
|
-
var
|
|
899
|
-
var
|
|
883
|
+
var JobsSchema = z22.record(ResourceIdSchema, JobSchema).optional().describe("Define the jobs in your stack.");
|
|
884
|
+
var JobDefaultSchema = z22.object({
|
|
900
885
|
image: ImageSchema.optional(),
|
|
901
886
|
cpu: CpuSchema.default(0.25),
|
|
902
887
|
memorySize: MemorySizeSchema2.default("512 MB"),
|
|
903
888
|
architecture: ArchitectureSchema3.default("arm64"),
|
|
904
889
|
environment: EnvironmentSchema2.optional(),
|
|
905
890
|
permissions: PermissionsSchema2.optional(),
|
|
906
|
-
|
|
907
|
-
// restartPolicy: RestartPolicySchema.default({ enabled: true }),
|
|
891
|
+
timeout: TimeoutSchema3.optional(),
|
|
908
892
|
log: LogSchema2.default(true).transform((log) => ({
|
|
909
893
|
retention: log.retention ?? days4(7)
|
|
910
894
|
}))
|
|
911
895
|
}).default({});
|
|
912
896
|
|
|
897
|
+
// src/feature/instance/schema.ts
|
|
898
|
+
import { days as days5, toDays as toDays3 } from "@awsless/duration";
|
|
899
|
+
import { toMebibytes as toMebibytes2 } from "@awsless/size";
|
|
900
|
+
import { z as z23 } from "zod";
|
|
901
|
+
var CpuSchema2 = z23.union([z23.literal(0.25), z23.literal(0.5), z23.literal(1), z23.literal(2), z23.literal(4), z23.literal(8), z23.literal(16)]).transform((v) => `${v} vCPU`).describe(
|
|
902
|
+
"The number of virtual CPU units (vCPU) used by the instance. Valid values: 0.25, 0.5, 1, 2, 4, 8, 16 vCPU."
|
|
903
|
+
);
|
|
904
|
+
var validMemorySize2 = [
|
|
905
|
+
// 0.25 vCPU
|
|
906
|
+
512,
|
|
907
|
+
1024,
|
|
908
|
+
2048,
|
|
909
|
+
// 0.5 vCPU
|
|
910
|
+
1024,
|
|
911
|
+
2048,
|
|
912
|
+
3072,
|
|
913
|
+
4096,
|
|
914
|
+
// 1 vCPU
|
|
915
|
+
2048,
|
|
916
|
+
3072,
|
|
917
|
+
4096,
|
|
918
|
+
5120,
|
|
919
|
+
6144,
|
|
920
|
+
7168,
|
|
921
|
+
8192,
|
|
922
|
+
// 2 vCPU
|
|
923
|
+
4096,
|
|
924
|
+
5120,
|
|
925
|
+
6144,
|
|
926
|
+
7168,
|
|
927
|
+
8192,
|
|
928
|
+
9216,
|
|
929
|
+
10240,
|
|
930
|
+
11264,
|
|
931
|
+
12288,
|
|
932
|
+
13312,
|
|
933
|
+
14336,
|
|
934
|
+
15360,
|
|
935
|
+
16384
|
|
936
|
+
];
|
|
937
|
+
var MemorySizeSchema3 = SizeSchema.refine(
|
|
938
|
+
(s) => validMemorySize2.includes(toMebibytes2(s)),
|
|
939
|
+
`Invalid memory size. Allowed sizes: ${validMemorySize2.join(", ")} MiB`
|
|
940
|
+
).describe("The amount of memory (in MiB) used by the instance. Valid memory values depend on the CPU configuration.");
|
|
941
|
+
var HealthCheckSchema = z23.object({
|
|
942
|
+
path: z23.string().describe("The path that the container runs to determine if it is healthy."),
|
|
943
|
+
interval: DurationSchema.describe("The time period in seconds between each health check execution."),
|
|
944
|
+
retries: z23.number().int().min(1).max(10).describe(
|
|
945
|
+
"The number of times to retry a failed health check before the container is considered unhealthy."
|
|
946
|
+
),
|
|
947
|
+
startPeriod: DurationSchema.describe(
|
|
948
|
+
"The optional grace period to provide containers time to bootstrap before failed health checks count towards the maximum number of retries."
|
|
949
|
+
),
|
|
950
|
+
timeout: DurationSchema.describe(
|
|
951
|
+
"The time period in seconds to wait for a health check to succeed before it is considered a failure."
|
|
952
|
+
)
|
|
953
|
+
}).describe("The health check command and associated configuration parameters for the container.");
|
|
954
|
+
var EnvironmentSchema3 = z23.record(z23.string(), z23.string()).optional().describe("Environment variable key-value pairs.");
|
|
955
|
+
var ArchitectureSchema4 = z23.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the instance supports.");
|
|
956
|
+
var ActionSchema3 = z23.string();
|
|
957
|
+
var ActionsSchema3 = z23.union([ActionSchema3.transform((v) => [v]), ActionSchema3.array()]);
|
|
958
|
+
var ArnSchema3 = z23.string().startsWith("arn:");
|
|
959
|
+
var WildcardSchema3 = z23.literal("*");
|
|
960
|
+
var ResourceSchema3 = z23.union([ArnSchema3, WildcardSchema3]);
|
|
961
|
+
var ResourcesSchema3 = z23.union([ResourceSchema3.transform((v) => [v]), ResourceSchema3.array()]);
|
|
962
|
+
var PermissionSchema3 = z23.object({
|
|
963
|
+
effect: z23.enum(["allow", "deny"]).default("allow"),
|
|
964
|
+
actions: ActionsSchema3,
|
|
965
|
+
resources: ResourcesSchema3
|
|
966
|
+
});
|
|
967
|
+
var PermissionsSchema3 = z23.union([PermissionSchema3.transform((v) => [v]), PermissionSchema3.array()]).describe("Add IAM permissions to your instance.");
|
|
968
|
+
var DescriptionSchema2 = z23.string().describe("A description of the instance.");
|
|
969
|
+
var ImageSchema2 = z23.string().optional().describe("The URL of the container image to use.");
|
|
970
|
+
var validLogRetentionDays3 = [
|
|
971
|
+
...[1, 3, 5, 7, 14, 30, 60, 90, 120, 150],
|
|
972
|
+
...[180, 365, 400, 545, 731, 1096, 1827, 2192],
|
|
973
|
+
...[2557, 2922, 3288, 3653]
|
|
974
|
+
];
|
|
975
|
+
var LogRetentionSchema3 = DurationSchema.refine(
|
|
976
|
+
durationMin(days5(0)),
|
|
977
|
+
"Minimum log retention is 0 day, which will disable logging."
|
|
978
|
+
).refine(
|
|
979
|
+
(duration) => {
|
|
980
|
+
return validLogRetentionDays3.includes(toDays3(duration));
|
|
981
|
+
},
|
|
982
|
+
`Invalid log retention. Valid days are: ${validLogRetentionDays3.map((days6) => `${days6}`).join(", ")}`
|
|
983
|
+
).describe("The log retention duration.");
|
|
984
|
+
var LogSchema3 = z23.union([
|
|
985
|
+
z23.boolean().transform((enabled) => ({ retention: enabled ? days5(7) : days5(0) })),
|
|
986
|
+
LogRetentionSchema3.transform((retention) => ({ retention })),
|
|
987
|
+
z23.object({
|
|
988
|
+
retention: LogRetentionSchema3.optional()
|
|
989
|
+
})
|
|
990
|
+
]).describe("Enable logging to a CloudWatch log group. Providing a duration value will set the log retention time.");
|
|
991
|
+
var FileCodeSchema3 = z23.object({
|
|
992
|
+
file: LocalFileSchema.describe("The file path of the instance code.")
|
|
993
|
+
});
|
|
994
|
+
var CodeSchema3 = z23.union([
|
|
995
|
+
LocalFileSchema.transform((file) => ({
|
|
996
|
+
file
|
|
997
|
+
})).pipe(FileCodeSchema3),
|
|
998
|
+
FileCodeSchema3
|
|
999
|
+
]).describe("Specify the code of your instance.");
|
|
1000
|
+
var StartupCommandSchema2 = z23.union([z23.string().transform((v) => [v]), z23.string().array()]).describe("Optional shell commands to run before the instance program starts.");
|
|
1001
|
+
var ISchema = z23.object({
|
|
1002
|
+
code: CodeSchema3,
|
|
1003
|
+
description: DescriptionSchema2.optional(),
|
|
1004
|
+
image: ImageSchema2.optional(),
|
|
1005
|
+
startupCommand: StartupCommandSchema2.optional(),
|
|
1006
|
+
log: LogSchema3.optional(),
|
|
1007
|
+
cpu: CpuSchema2.optional(),
|
|
1008
|
+
memorySize: MemorySizeSchema3.optional(),
|
|
1009
|
+
architecture: ArchitectureSchema4.optional(),
|
|
1010
|
+
environment: EnvironmentSchema3.optional(),
|
|
1011
|
+
permissions: PermissionsSchema3.optional(),
|
|
1012
|
+
healthCheck: HealthCheckSchema.optional()
|
|
1013
|
+
// restartPolicy: RestartPolicySchema.optional(),
|
|
1014
|
+
});
|
|
1015
|
+
var InstanceSchema = z23.union([
|
|
1016
|
+
LocalFileSchema.transform((code) => ({
|
|
1017
|
+
code
|
|
1018
|
+
})).pipe(ISchema),
|
|
1019
|
+
ISchema
|
|
1020
|
+
]);
|
|
1021
|
+
var InstancesSchema = z23.record(ResourceIdSchema, InstanceSchema).optional().describe("Define the instances in your stack.");
|
|
1022
|
+
var InstanceDefaultSchema = z23.object({
|
|
1023
|
+
image: ImageSchema2.optional(),
|
|
1024
|
+
cpu: CpuSchema2.default(0.25),
|
|
1025
|
+
memorySize: MemorySizeSchema3.default("512 MB"),
|
|
1026
|
+
architecture: ArchitectureSchema4.default("arm64"),
|
|
1027
|
+
environment: EnvironmentSchema3.optional(),
|
|
1028
|
+
permissions: PermissionsSchema3.optional(),
|
|
1029
|
+
healthCheck: HealthCheckSchema.optional(),
|
|
1030
|
+
// restartPolicy: RestartPolicySchema.default({ enabled: true }),
|
|
1031
|
+
log: LogSchema3.default(true).transform((log) => ({
|
|
1032
|
+
retention: log.retention ?? days5(7)
|
|
1033
|
+
}))
|
|
1034
|
+
}).default({});
|
|
1035
|
+
|
|
913
1036
|
// src/feature/topic/schema.ts
|
|
914
1037
|
import { kebabCase as kebabCase3 } from "change-case";
|
|
915
|
-
import { z as
|
|
916
|
-
var TopicNameSchema =
|
|
917
|
-
var TopicsDefaultSchema =
|
|
1038
|
+
import { z as z24 } from "zod";
|
|
1039
|
+
var TopicNameSchema = z24.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => kebabCase3(value)).describe("Define event topic name.");
|
|
1040
|
+
var TopicsDefaultSchema = z24.array(TopicNameSchema).refine((topics) => {
|
|
918
1041
|
return topics.length === new Set(topics).size;
|
|
919
1042
|
}, "Must be a list of unique topic names").optional().describe("Define the event topics for your app.");
|
|
920
|
-
var SubscribersSchema =
|
|
1043
|
+
var SubscribersSchema = z24.record(TopicNameSchema, TaskSchema).optional().describe("Define the event topics to subscribe too in your stack.");
|
|
921
1044
|
|
|
922
1045
|
// src/config/schema/region.ts
|
|
923
|
-
import { z as
|
|
1046
|
+
import { z as z25 } from "zod";
|
|
924
1047
|
var US = ["us-east-2", "us-east-1", "us-west-1", "us-west-2"];
|
|
925
1048
|
var AF = ["af-south-1"];
|
|
926
1049
|
var AP = [
|
|
@@ -949,16 +1072,16 @@ var EU = [
|
|
|
949
1072
|
var ME = ["me-south-1", "me-central-1"];
|
|
950
1073
|
var SA = ["sa-east-1"];
|
|
951
1074
|
var regions = [...US, ...AF, ...AP, ...CA, ...EU, ...ME, ...SA];
|
|
952
|
-
var RegionSchema =
|
|
1075
|
+
var RegionSchema = z25.enum(regions);
|
|
953
1076
|
|
|
954
1077
|
// src/config/app.ts
|
|
955
|
-
var AppSchema =
|
|
956
|
-
$schema:
|
|
1078
|
+
var AppSchema = z26.object({
|
|
1079
|
+
$schema: z26.string().optional(),
|
|
957
1080
|
name: ResourceIdSchema.describe("App name."),
|
|
958
1081
|
region: RegionSchema.describe("The AWS region to deploy to."),
|
|
959
|
-
profile:
|
|
960
|
-
protect:
|
|
961
|
-
removal:
|
|
1082
|
+
profile: z26.string().describe("The AWS profile to deploy to."),
|
|
1083
|
+
protect: z26.boolean().default(false).describe("Protect your app & stacks from being deleted."),
|
|
1084
|
+
removal: z26.enum(["remove", "retain"]).default("remove").describe(
|
|
962
1085
|
[
|
|
963
1086
|
"Configure how your resources are handled when they have to be removed.",
|
|
964
1087
|
"",
|
|
@@ -972,13 +1095,14 @@ var AppSchema = z25.object({
|
|
|
972
1095
|
// .default('prod')
|
|
973
1096
|
// .describe('The deployment stage.'),
|
|
974
1097
|
// onFailure: OnFailureSchema,
|
|
975
|
-
defaults:
|
|
1098
|
+
defaults: z26.object({
|
|
976
1099
|
onFailure: OnFailureDefaultSchema,
|
|
977
1100
|
onErrorLog: OnErrorLogDefaultSchema,
|
|
978
1101
|
auth: AuthDefaultSchema,
|
|
979
1102
|
domains: DomainsDefaultSchema,
|
|
980
1103
|
function: FunctionDefaultSchema,
|
|
981
1104
|
instance: InstanceDefaultSchema,
|
|
1105
|
+
job: JobDefaultSchema,
|
|
982
1106
|
queue: QueueDefaultSchema,
|
|
983
1107
|
// graphql: GraphQLDefaultSchema,
|
|
984
1108
|
// http: HttpDefaultSchema,
|
|
@@ -1249,11 +1373,11 @@ var createStagePatchJsonSchema = (baseSchema, title) => {
|
|
|
1249
1373
|
};
|
|
1250
1374
|
|
|
1251
1375
|
// src/config/stack.ts
|
|
1252
|
-
import { z as
|
|
1376
|
+
import { z as z41 } from "zod";
|
|
1253
1377
|
|
|
1254
1378
|
// src/feature/cache/schema.ts
|
|
1255
1379
|
import { gibibytes as gibibytes2 } from "@awsless/size";
|
|
1256
|
-
import { z as
|
|
1380
|
+
import { z as z27 } from "zod";
|
|
1257
1381
|
var StorageSchema = SizeSchema.refine(sizeMin(gibibytes2(1)), "Minimum storage size is 1 GB").refine(
|
|
1258
1382
|
sizeMax(gibibytes2(5e3)),
|
|
1259
1383
|
"Maximum storage size is 5000 GB"
|
|
@@ -1264,31 +1388,31 @@ var MinimumStorageSchema = StorageSchema.describe(
|
|
|
1264
1388
|
var MaximumStorageSchema = StorageSchema.describe(
|
|
1265
1389
|
"The upper limit for data storage the cache is set to use. You can specify a size value from 1 GB to 5000 GB."
|
|
1266
1390
|
);
|
|
1267
|
-
var EcpuSchema =
|
|
1391
|
+
var EcpuSchema = z27.number().int().min(1e3).max(15e6);
|
|
1268
1392
|
var MinimumEcpuSchema = EcpuSchema.describe(
|
|
1269
1393
|
"The minimum number of ECPUs the cache can consume per second. You can specify a integer from 1,000 to 15,000,000."
|
|
1270
1394
|
);
|
|
1271
1395
|
var MaximumEcpuSchema = EcpuSchema.describe(
|
|
1272
1396
|
"The maximum number of ECPUs the cache can consume per second. You can specify a integer from 1,000 to 15,000,000."
|
|
1273
1397
|
);
|
|
1274
|
-
var CachesSchema =
|
|
1398
|
+
var CachesSchema = z27.record(
|
|
1275
1399
|
ResourceIdSchema,
|
|
1276
|
-
|
|
1400
|
+
z27.object({
|
|
1277
1401
|
minStorage: MinimumStorageSchema.optional(),
|
|
1278
1402
|
maxStorage: MaximumStorageSchema.optional(),
|
|
1279
1403
|
minECPU: MinimumEcpuSchema.optional(),
|
|
1280
1404
|
maxECPU: MaximumEcpuSchema.optional(),
|
|
1281
|
-
snapshotRetentionLimit:
|
|
1405
|
+
snapshotRetentionLimit: z27.number().int().positive().default(1)
|
|
1282
1406
|
})
|
|
1283
1407
|
).optional().describe("Define the caches in your stack. For access to the cache put your functions inside the global VPC.");
|
|
1284
1408
|
|
|
1285
1409
|
// src/feature/command/schema.ts
|
|
1286
|
-
import { z as
|
|
1287
|
-
var CommandSchema =
|
|
1288
|
-
|
|
1410
|
+
import { z as z28 } from "zod";
|
|
1411
|
+
var CommandSchema = z28.union([
|
|
1412
|
+
z28.object({
|
|
1289
1413
|
file: LocalFileSchema,
|
|
1290
|
-
handler:
|
|
1291
|
-
description:
|
|
1414
|
+
handler: z28.string().default("default").describe("The name of the handler that needs to run"),
|
|
1415
|
+
description: z28.string().optional().describe("A description of the command")
|
|
1292
1416
|
// options: z.record(ResourceIdSchema, OptionSchema).optional(),
|
|
1293
1417
|
// arguments: z.record(ResourceIdSchema, ArgumentSchema).optional(),
|
|
1294
1418
|
}),
|
|
@@ -1298,22 +1422,22 @@ var CommandSchema = z27.union([
|
|
|
1298
1422
|
description: void 0
|
|
1299
1423
|
}))
|
|
1300
1424
|
]);
|
|
1301
|
-
var CommandsSchema =
|
|
1425
|
+
var CommandsSchema = z28.record(ResourceIdSchema, CommandSchema).optional().describe("Define the custom commands for your stack.");
|
|
1302
1426
|
|
|
1303
1427
|
// src/feature/config/schema.ts
|
|
1304
|
-
import { z as
|
|
1305
|
-
var ConfigNameSchema =
|
|
1306
|
-
var ConfigsSchema =
|
|
1428
|
+
import { z as z29 } from "zod";
|
|
1429
|
+
var ConfigNameSchema = z29.string().regex(/[a-z0-9\-]/g, "Invalid config name");
|
|
1430
|
+
var ConfigsSchema = z29.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
|
|
1307
1431
|
|
|
1308
1432
|
// src/feature/cron/schema/index.ts
|
|
1309
|
-
import { z as
|
|
1433
|
+
import { z as z31 } from "zod";
|
|
1310
1434
|
|
|
1311
1435
|
// src/feature/cron/schema/schedule.ts
|
|
1312
|
-
import { z as
|
|
1436
|
+
import { z as z30 } from "zod";
|
|
1313
1437
|
import { awsCronExpressionValidator } from "aws-cron-expression-validator";
|
|
1314
|
-
var RateExpressionSchema =
|
|
1438
|
+
var RateExpressionSchema = z30.custom(
|
|
1315
1439
|
(value) => {
|
|
1316
|
-
return
|
|
1440
|
+
return z30.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
|
|
1317
1441
|
const [str] = rate.split(" ");
|
|
1318
1442
|
const number = parseInt(str);
|
|
1319
1443
|
return number > 0;
|
|
@@ -1329,9 +1453,9 @@ var RateExpressionSchema = z29.custom(
|
|
|
1329
1453
|
}
|
|
1330
1454
|
return `rate(${rate})`;
|
|
1331
1455
|
});
|
|
1332
|
-
var CronExpressionSchema =
|
|
1456
|
+
var CronExpressionSchema = z30.custom(
|
|
1333
1457
|
(value) => {
|
|
1334
|
-
return
|
|
1458
|
+
return z30.string().safeParse(value).success;
|
|
1335
1459
|
},
|
|
1336
1460
|
{ message: "Invalid cron expression" }
|
|
1337
1461
|
).superRefine((value, ctx) => {
|
|
@@ -1340,12 +1464,12 @@ var CronExpressionSchema = z29.custom(
|
|
|
1340
1464
|
} catch (error) {
|
|
1341
1465
|
if (error instanceof Error) {
|
|
1342
1466
|
ctx.addIssue({
|
|
1343
|
-
code:
|
|
1467
|
+
code: z30.ZodIssueCode.custom,
|
|
1344
1468
|
message: `Invalid cron expression: ${error.message}`
|
|
1345
1469
|
});
|
|
1346
1470
|
} else {
|
|
1347
1471
|
ctx.addIssue({
|
|
1348
|
-
code:
|
|
1472
|
+
code: z30.ZodIssueCode.custom,
|
|
1349
1473
|
message: "Invalid cron expression"
|
|
1350
1474
|
});
|
|
1351
1475
|
}
|
|
@@ -1356,32 +1480,32 @@ var CronExpressionSchema = z29.custom(
|
|
|
1356
1480
|
var ScheduleExpressionSchema = RateExpressionSchema.or(CronExpressionSchema);
|
|
1357
1481
|
|
|
1358
1482
|
// src/feature/cron/schema/index.ts
|
|
1359
|
-
var RetryAttemptsSchema4 =
|
|
1483
|
+
var RetryAttemptsSchema4 = z31.number().int().min(0).max(2).describe(
|
|
1360
1484
|
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
|
|
1361
1485
|
);
|
|
1362
|
-
var CronsSchema =
|
|
1486
|
+
var CronsSchema = z31.record(
|
|
1363
1487
|
ResourceIdSchema,
|
|
1364
|
-
|
|
1365
|
-
enabled:
|
|
1488
|
+
z31.object({
|
|
1489
|
+
enabled: z31.boolean().default(true).describe("If the cron is enabled."),
|
|
1366
1490
|
consumer: FunctionSchema.describe("The consuming lambda function properties."),
|
|
1367
1491
|
schedule: ScheduleExpressionSchema.describe(
|
|
1368
1492
|
'The scheduling expression.\n\nexample: "0 20 * * ? *"\nexample: "5 minutes"'
|
|
1369
1493
|
),
|
|
1370
|
-
payload:
|
|
1494
|
+
payload: z31.unknown().optional().describe("The JSON payload that will be passed to the consumer."),
|
|
1371
1495
|
retryAttempts: RetryAttemptsSchema4.default(2)
|
|
1372
1496
|
})
|
|
1373
1497
|
).optional().describe(`Define the cron jobs in your stack.`);
|
|
1374
1498
|
|
|
1375
1499
|
// src/feature/search/schema.ts
|
|
1376
1500
|
import { gibibytes as gibibytes3 } from "@awsless/size";
|
|
1377
|
-
import { z as
|
|
1378
|
-
var VersionSchema =
|
|
1501
|
+
import { z as z32 } from "zod";
|
|
1502
|
+
var VersionSchema = z32.union([
|
|
1379
1503
|
//
|
|
1380
|
-
|
|
1381
|
-
|
|
1504
|
+
z32.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]),
|
|
1505
|
+
z32.string()
|
|
1382
1506
|
]).describe("Specify the OpenSearch engine version.");
|
|
1383
|
-
var TypeSchema =
|
|
1384
|
-
|
|
1507
|
+
var TypeSchema = z32.union([
|
|
1508
|
+
z32.enum([
|
|
1385
1509
|
"t3.small",
|
|
1386
1510
|
"t3.medium",
|
|
1387
1511
|
"m3.medium",
|
|
@@ -1455,13 +1579,13 @@ var TypeSchema = z31.union([
|
|
|
1455
1579
|
"r6gd.12xlarge",
|
|
1456
1580
|
"r6gd.16xlarge"
|
|
1457
1581
|
]),
|
|
1458
|
-
|
|
1582
|
+
z32.string()
|
|
1459
1583
|
]).describe("Instance type of data nodes in the cluster.");
|
|
1460
|
-
var CountSchema =
|
|
1584
|
+
var CountSchema = z32.number().int().min(1).describe("Number of instances in the cluster.");
|
|
1461
1585
|
var StorageSizeSchema = SizeSchema.refine(sizeMin(gibibytes3(10)), "Minimum storage size is 10 GB").refine(sizeMax(gibibytes3(100)), "Maximum storage size is 100 GB").describe("The size of the function's /tmp directory. You can specify a size value from 512 MB to 10 GiB.");
|
|
1462
|
-
var SearchsSchema =
|
|
1586
|
+
var SearchsSchema = z32.record(
|
|
1463
1587
|
ResourceIdSchema,
|
|
1464
|
-
|
|
1588
|
+
z32.object({
|
|
1465
1589
|
type: TypeSchema.default("t3.small"),
|
|
1466
1590
|
count: CountSchema.default(1),
|
|
1467
1591
|
version: VersionSchema.default("2.13"),
|
|
@@ -1472,12 +1596,12 @@ var SearchsSchema = z31.record(
|
|
|
1472
1596
|
).optional().describe("Define the search instances in your stack. Backed by OpenSearch.");
|
|
1473
1597
|
|
|
1474
1598
|
// src/feature/site/schema.ts
|
|
1475
|
-
import { z as
|
|
1599
|
+
import { z as z34 } from "zod";
|
|
1476
1600
|
|
|
1477
1601
|
// src/config/schema/local-entry.ts
|
|
1478
1602
|
import { stat as stat3 } from "fs/promises";
|
|
1479
|
-
import { z as
|
|
1480
|
-
var LocalEntrySchema =
|
|
1603
|
+
import { z as z33 } from "zod";
|
|
1604
|
+
var LocalEntrySchema = z33.union([
|
|
1481
1605
|
RelativePathSchema.refine(async (path) => {
|
|
1482
1606
|
try {
|
|
1483
1607
|
const s = await stat3(path);
|
|
@@ -1486,7 +1610,7 @@ var LocalEntrySchema = z32.union([
|
|
|
1486
1610
|
return false;
|
|
1487
1611
|
}
|
|
1488
1612
|
}, `File or directory doesn't exist`),
|
|
1489
|
-
|
|
1613
|
+
z33.object({
|
|
1490
1614
|
nocheck: RelativePathSchema.describe(
|
|
1491
1615
|
"Specifies a local file or directory without checking if the file or directory exists."
|
|
1492
1616
|
)
|
|
@@ -1494,21 +1618,21 @@ var LocalEntrySchema = z32.union([
|
|
|
1494
1618
|
]);
|
|
1495
1619
|
|
|
1496
1620
|
// src/feature/site/schema.ts
|
|
1497
|
-
var SitesSchema =
|
|
1621
|
+
var SitesSchema = z34.record(
|
|
1498
1622
|
ResourceIdSchema,
|
|
1499
|
-
|
|
1623
|
+
z34.object({
|
|
1500
1624
|
router: ResourceIdSchema.describe("The router id to link your site with."),
|
|
1501
1625
|
path: RouteSchema2.describe("The path inside the router to link your site to."),
|
|
1502
|
-
build:
|
|
1503
|
-
command:
|
|
1626
|
+
build: z34.object({
|
|
1627
|
+
command: z34.string().describe(
|
|
1504
1628
|
`Specifies the files and directories to generate the cache key for your custom build command.`
|
|
1505
1629
|
),
|
|
1506
|
-
cacheKey:
|
|
1630
|
+
cacheKey: z34.union([LocalEntrySchema.transform((v) => [v]), LocalEntrySchema.array()]).describe(
|
|
1507
1631
|
`Specifies the files and directories to generate the cache key for your custom build command.`
|
|
1508
1632
|
),
|
|
1509
|
-
configs:
|
|
1633
|
+
configs: z34.string().array().optional().describe("Define the config values for your build command.")
|
|
1510
1634
|
}).optional().describe(`Specifies the build process for sites that need a build step.`),
|
|
1511
|
-
static:
|
|
1635
|
+
static: z34.union([LocalDirectorySchema, z34.boolean()]).optional().describe(
|
|
1512
1636
|
"Specifies the path to the static files directory. Additionally you can also pass `true` when you don't have local static files, but still want to make an S3 bucket."
|
|
1513
1637
|
),
|
|
1514
1638
|
ssr: FunctionSchema.optional().describe("Specifies the file that will render the site on the server.")
|
|
@@ -1516,21 +1640,21 @@ var SitesSchema = z33.record(
|
|
|
1516
1640
|
).optional().describe("Define the sites in your stack.");
|
|
1517
1641
|
|
|
1518
1642
|
// src/feature/store/schema.ts
|
|
1519
|
-
import { z as
|
|
1520
|
-
var StoresSchema =
|
|
1521
|
-
|
|
1643
|
+
import { z as z35 } from "zod";
|
|
1644
|
+
var StoresSchema = z35.union([
|
|
1645
|
+
z35.array(ResourceIdSchema).transform((list) => {
|
|
1522
1646
|
const stores = {};
|
|
1523
1647
|
for (const key of list) {
|
|
1524
1648
|
stores[key] = {};
|
|
1525
1649
|
}
|
|
1526
1650
|
return stores;
|
|
1527
1651
|
}),
|
|
1528
|
-
|
|
1652
|
+
z35.record(
|
|
1529
1653
|
ResourceIdSchema,
|
|
1530
|
-
|
|
1654
|
+
z35.object({
|
|
1531
1655
|
static: LocalDirectorySchema.optional().describe("Specifies the path to the static files directory."),
|
|
1532
|
-
versioning:
|
|
1533
|
-
events:
|
|
1656
|
+
versioning: z35.boolean().default(false).describe("Enable versioning of your store."),
|
|
1657
|
+
events: z35.object({
|
|
1534
1658
|
// create
|
|
1535
1659
|
"created:*": TaskSchema.optional().describe(
|
|
1536
1660
|
"Subscribe to notifications regardless of the API that was used to create an object."
|
|
@@ -1563,30 +1687,30 @@ var StoresSchema = z34.union([
|
|
|
1563
1687
|
]).optional().describe("Define the stores in your stack.");
|
|
1564
1688
|
|
|
1565
1689
|
// src/feature/icon/schema.ts
|
|
1566
|
-
import { z as
|
|
1690
|
+
import { z as z36 } from "zod";
|
|
1567
1691
|
var staticOriginSchema = LocalDirectorySchema.describe(
|
|
1568
1692
|
"Specifies the path to a local image directory that will be uploaded in S3."
|
|
1569
1693
|
);
|
|
1570
1694
|
var functionOriginSchema = FunctionSchema.describe(
|
|
1571
1695
|
"Specifies the file that will be called when an image isn't found in the (cache) bucket."
|
|
1572
1696
|
);
|
|
1573
|
-
var IconsSchema =
|
|
1697
|
+
var IconsSchema = z36.record(
|
|
1574
1698
|
ResourceIdSchema,
|
|
1575
|
-
|
|
1699
|
+
z36.object({
|
|
1576
1700
|
// domain: ResourceIdSchema.describe('The domain id to link your site with.').optional(),
|
|
1577
1701
|
// subDomain: z.string().optional(),
|
|
1578
1702
|
router: ResourceIdSchema.describe("The router id to link your icon proxy."),
|
|
1579
1703
|
path: RouteSchema2.describe("The path inside the router to link your icon proxy to."),
|
|
1580
1704
|
log: LogSchema.optional(),
|
|
1581
1705
|
cacheDuration: DurationSchema.optional().describe("The cache duration of the cached icons."),
|
|
1582
|
-
preserveIds:
|
|
1583
|
-
symbols:
|
|
1584
|
-
origin:
|
|
1585
|
-
|
|
1706
|
+
preserveIds: z36.boolean().optional().default(false).describe("Preserve the IDs of the icons."),
|
|
1707
|
+
symbols: z36.boolean().optional().default(false).describe(`Convert the SVG's to SVG symbols.`),
|
|
1708
|
+
origin: z36.union([
|
|
1709
|
+
z36.object({
|
|
1586
1710
|
static: staticOriginSchema,
|
|
1587
1711
|
function: functionOriginSchema.optional()
|
|
1588
1712
|
}),
|
|
1589
|
-
|
|
1713
|
+
z36.object({
|
|
1590
1714
|
static: staticOriginSchema.optional(),
|
|
1591
1715
|
function: functionOriginSchema
|
|
1592
1716
|
})
|
|
@@ -1613,13 +1737,13 @@ var IconsSchema = z35.record(
|
|
|
1613
1737
|
).optional().describe("Define an svg icon proxy in your stack. Store, optimize, and deliver svg icons at scale.");
|
|
1614
1738
|
|
|
1615
1739
|
// src/feature/image/schema.ts
|
|
1616
|
-
import { z as
|
|
1617
|
-
var transformationOptionsSchema =
|
|
1618
|
-
width:
|
|
1619
|
-
height:
|
|
1620
|
-
fit:
|
|
1621
|
-
position:
|
|
1622
|
-
quality:
|
|
1740
|
+
import { z as z37 } from "zod";
|
|
1741
|
+
var transformationOptionsSchema = z37.object({
|
|
1742
|
+
width: z37.number().int().positive().optional(),
|
|
1743
|
+
height: z37.number().int().positive().optional(),
|
|
1744
|
+
fit: z37.enum(["cover", "contain", "fill", "inside", "outside"]).optional(),
|
|
1745
|
+
position: z37.enum(["top", "right top", "right", "right bottom", "bottom", "left bottom", "left", "left top", "center"]).optional(),
|
|
1746
|
+
quality: z37.number().int().min(1).max(100).optional()
|
|
1623
1747
|
});
|
|
1624
1748
|
var staticOriginSchema2 = LocalDirectorySchema.describe(
|
|
1625
1749
|
"Specifies the path to a local image directory that will be uploaded in S3."
|
|
@@ -1627,38 +1751,38 @@ var staticOriginSchema2 = LocalDirectorySchema.describe(
|
|
|
1627
1751
|
var functionOriginSchema2 = FunctionSchema.describe(
|
|
1628
1752
|
"Specifies the file that will be called when an image isn't found in the (cache) bucket."
|
|
1629
1753
|
);
|
|
1630
|
-
var ImagesSchema =
|
|
1754
|
+
var ImagesSchema = z37.record(
|
|
1631
1755
|
ResourceIdSchema,
|
|
1632
|
-
|
|
1756
|
+
z37.object({
|
|
1633
1757
|
// domain: ResourceIdSchema.describe('The domain id to link your site with.').optional(),
|
|
1634
1758
|
// subDomain: z.string().optional(),
|
|
1635
1759
|
router: ResourceIdSchema.describe("The router id to link your image proxy."),
|
|
1636
1760
|
path: RouteSchema2.describe("The path inside the router to link your image proxy to."),
|
|
1637
1761
|
log: LogSchema.optional(),
|
|
1638
1762
|
cacheDuration: DurationSchema.optional().describe("Cache duration of the cached images."),
|
|
1639
|
-
presets:
|
|
1640
|
-
extensions:
|
|
1641
|
-
jpg:
|
|
1642
|
-
mozjpeg:
|
|
1643
|
-
progressive:
|
|
1763
|
+
presets: z37.record(z37.string(), transformationOptionsSchema).describe("Named presets for image transformations"),
|
|
1764
|
+
extensions: z37.object({
|
|
1765
|
+
jpg: z37.object({
|
|
1766
|
+
mozjpeg: z37.boolean().optional(),
|
|
1767
|
+
progressive: z37.boolean().optional()
|
|
1644
1768
|
}).optional(),
|
|
1645
|
-
webp:
|
|
1646
|
-
effort:
|
|
1647
|
-
lossless:
|
|
1648
|
-
nearLossless:
|
|
1769
|
+
webp: z37.object({
|
|
1770
|
+
effort: z37.number().int().min(1).max(10).default(7).optional(),
|
|
1771
|
+
lossless: z37.boolean().optional(),
|
|
1772
|
+
nearLossless: z37.boolean().optional()
|
|
1649
1773
|
}).optional(),
|
|
1650
|
-
png:
|
|
1651
|
-
compressionLevel:
|
|
1774
|
+
png: z37.object({
|
|
1775
|
+
compressionLevel: z37.number().int().min(0).max(9).default(6).optional()
|
|
1652
1776
|
}).optional()
|
|
1653
1777
|
}).refine((data) => {
|
|
1654
1778
|
return Object.keys(data).length > 0;
|
|
1655
1779
|
}, "At least one extension must be defined.").describe("Specify the allowed extensions."),
|
|
1656
|
-
origin:
|
|
1657
|
-
|
|
1780
|
+
origin: z37.union([
|
|
1781
|
+
z37.object({
|
|
1658
1782
|
static: staticOriginSchema2,
|
|
1659
1783
|
function: functionOriginSchema2.optional()
|
|
1660
1784
|
}),
|
|
1661
|
-
|
|
1785
|
+
z37.object({
|
|
1662
1786
|
static: staticOriginSchema2.optional(),
|
|
1663
1787
|
function: functionOriginSchema2
|
|
1664
1788
|
})
|
|
@@ -1673,7 +1797,7 @@ var ImagesSchema = z36.record(
|
|
|
1673
1797
|
).optional().describe("Define an image proxy in your stack. Store, transform, optimize, and deliver images at scale.");
|
|
1674
1798
|
|
|
1675
1799
|
// src/feature/metric/schema.ts
|
|
1676
|
-
import { z as
|
|
1800
|
+
import { z as z38 } from "zod";
|
|
1677
1801
|
var ops = {
|
|
1678
1802
|
">": "GreaterThanThreshold",
|
|
1679
1803
|
">=": "GreaterThanOrEqualToThreshold",
|
|
@@ -1687,15 +1811,15 @@ var stats = {
|
|
|
1687
1811
|
min: "Minimum",
|
|
1688
1812
|
max: "Maximum"
|
|
1689
1813
|
};
|
|
1690
|
-
var WhereSchema =
|
|
1691
|
-
|
|
1814
|
+
var WhereSchema = z38.union([
|
|
1815
|
+
z38.string().regex(/(count|avg|sum|min|max) (>|>=|<|<=) (\d)/, "Invalid where query").transform((where) => {
|
|
1692
1816
|
const [stat4, op, value] = where.split(" ");
|
|
1693
1817
|
return { stat: stat4, op, value: parseFloat(value) };
|
|
1694
1818
|
}),
|
|
1695
|
-
|
|
1696
|
-
stat:
|
|
1697
|
-
op:
|
|
1698
|
-
value:
|
|
1819
|
+
z38.object({
|
|
1820
|
+
stat: z38.enum(["count", "avg", "sum", "min", "max"]),
|
|
1821
|
+
op: z38.enum([">", ">=", "<", "<="]),
|
|
1822
|
+
value: z38.number()
|
|
1699
1823
|
})
|
|
1700
1824
|
]).transform((where) => {
|
|
1701
1825
|
return {
|
|
@@ -1704,39 +1828,39 @@ var WhereSchema = z37.union([
|
|
|
1704
1828
|
value: where.value
|
|
1705
1829
|
};
|
|
1706
1830
|
});
|
|
1707
|
-
var AlarmSchema =
|
|
1708
|
-
description:
|
|
1831
|
+
var AlarmSchema = z38.object({
|
|
1832
|
+
description: z38.string().optional(),
|
|
1709
1833
|
where: WhereSchema,
|
|
1710
1834
|
period: DurationSchema,
|
|
1711
|
-
minDataPoints:
|
|
1712
|
-
trigger:
|
|
1835
|
+
minDataPoints: z38.number().int().default(1),
|
|
1836
|
+
trigger: z38.union([EmailSchema.transform((v) => [v]), EmailSchema.array(), FunctionSchema])
|
|
1713
1837
|
});
|
|
1714
|
-
var MetricsSchema =
|
|
1838
|
+
var MetricsSchema = z38.record(
|
|
1715
1839
|
ResourceIdSchema,
|
|
1716
|
-
|
|
1717
|
-
type:
|
|
1840
|
+
z38.object({
|
|
1841
|
+
type: z38.enum(["number", "size", "duration"]),
|
|
1718
1842
|
alarms: AlarmSchema.array().optional()
|
|
1719
1843
|
})
|
|
1720
1844
|
).optional().describe("Define the metrics in your stack.");
|
|
1721
1845
|
|
|
1722
1846
|
// src/feature/table/schema.ts
|
|
1723
|
-
import { minutes as
|
|
1724
|
-
import { z as
|
|
1725
|
-
var KeySchema =
|
|
1726
|
-
var TablesSchema =
|
|
1847
|
+
import { minutes as minutes6, seconds as seconds4 } from "@awsless/duration";
|
|
1848
|
+
import { z as z39 } from "zod";
|
|
1849
|
+
var KeySchema = z39.string().min(1).max(255);
|
|
1850
|
+
var TablesSchema = z39.record(
|
|
1727
1851
|
ResourceIdSchema,
|
|
1728
|
-
|
|
1852
|
+
z39.object({
|
|
1729
1853
|
hash: KeySchema.describe(
|
|
1730
1854
|
"Specifies the name of the partition / hash key that makes up the primary key for the table."
|
|
1731
1855
|
),
|
|
1732
1856
|
sort: KeySchema.optional().describe(
|
|
1733
1857
|
"Specifies the name of the range / sort key that makes up the primary key for the table."
|
|
1734
1858
|
),
|
|
1735
|
-
fields:
|
|
1859
|
+
fields: z39.record(z39.string(), z39.enum(["string", "number", "binary"])).optional().describe(
|
|
1736
1860
|
'A list of attributes that describe the key schema for the table and indexes. If no attribute field is defined we default to "string".'
|
|
1737
1861
|
),
|
|
1738
|
-
class:
|
|
1739
|
-
pointInTimeRecovery:
|
|
1862
|
+
class: z39.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
|
|
1863
|
+
pointInTimeRecovery: z39.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
|
|
1740
1864
|
ttl: KeySchema.optional().describe(
|
|
1741
1865
|
[
|
|
1742
1866
|
"The name of the TTL attribute used to store the expiration time for items in the table.",
|
|
@@ -1744,8 +1868,8 @@ var TablesSchema = z38.record(
|
|
|
1744
1868
|
].join("\n")
|
|
1745
1869
|
),
|
|
1746
1870
|
// deletionProtection: DeletionProtectionSchema.optional(),
|
|
1747
|
-
stream:
|
|
1748
|
-
type:
|
|
1871
|
+
stream: z39.object({
|
|
1872
|
+
type: z39.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
|
|
1749
1873
|
[
|
|
1750
1874
|
"When an item in the table is modified, you can determines what information is written to the stream for this table.",
|
|
1751
1875
|
"Valid values are:",
|
|
@@ -1755,7 +1879,7 @@ var TablesSchema = z38.record(
|
|
|
1755
1879
|
"- new-and-old-images - Both the new and the old item images of the item are written to the stream."
|
|
1756
1880
|
].join("\n")
|
|
1757
1881
|
),
|
|
1758
|
-
batchSize:
|
|
1882
|
+
batchSize: z39.number().min(1).max(1e4).default(1).describe(
|
|
1759
1883
|
[
|
|
1760
1884
|
"The maximum number of records in each batch that Lambda pulls from your stream and sends to your function.",
|
|
1761
1885
|
"Lambda passes all of the records in the batch to the function in a single call, up to the payload limit for synchronous invocation (6 MB).",
|
|
@@ -1765,7 +1889,7 @@ var TablesSchema = z38.record(
|
|
|
1765
1889
|
batchWindow: DurationSchema.refine(
|
|
1766
1890
|
durationMin(seconds4(1)),
|
|
1767
1891
|
"Minimum batch window duration is 1 second"
|
|
1768
|
-
).refine(durationMax(
|
|
1892
|
+
).refine(durationMax(minutes6(5)), "Maximum batch window duration is 5 minutes").optional().describe(
|
|
1769
1893
|
[
|
|
1770
1894
|
"The maximum amount of time that is spend gathering records before invoking the function.",
|
|
1771
1895
|
"You can specify a duration from 1 seconds to 5 minutes."
|
|
@@ -1784,7 +1908,7 @@ var TablesSchema = z38.record(
|
|
|
1784
1908
|
// 'The default value is 60s',
|
|
1785
1909
|
// ].join('\n')
|
|
1786
1910
|
// ),
|
|
1787
|
-
retryAttempts:
|
|
1911
|
+
retryAttempts: z39.number().min(-1).max(1e4).default(2).describe(
|
|
1788
1912
|
[
|
|
1789
1913
|
"Discard records after the specified number of retries.",
|
|
1790
1914
|
"-1 will sets the maximum number of retries to infinite.",
|
|
@@ -1793,7 +1917,7 @@ var TablesSchema = z38.record(
|
|
|
1793
1917
|
"The default value is 2"
|
|
1794
1918
|
].join("\n")
|
|
1795
1919
|
),
|
|
1796
|
-
concurrencyPerShard:
|
|
1920
|
+
concurrencyPerShard: z39.number().min(1).max(10).default(1).describe(
|
|
1797
1921
|
[
|
|
1798
1922
|
"The number of batches to process concurrently from each shard.",
|
|
1799
1923
|
"You can specify a number from 1 to 10."
|
|
@@ -1803,16 +1927,16 @@ var TablesSchema = z38.record(
|
|
|
1803
1927
|
}).optional().describe(
|
|
1804
1928
|
"The settings for the DynamoDB table stream, which capture changes to items stored in the table."
|
|
1805
1929
|
),
|
|
1806
|
-
indexes:
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
hash:
|
|
1930
|
+
indexes: z39.record(
|
|
1931
|
+
z39.string(),
|
|
1932
|
+
z39.object({
|
|
1933
|
+
hash: z39.union([KeySchema.transform((v) => [v]), KeySchema.array()]).describe(
|
|
1810
1934
|
"Specifies the name of the partition / hash key that makes up the primary key for the global secondary index."
|
|
1811
1935
|
),
|
|
1812
|
-
sort:
|
|
1936
|
+
sort: z39.union([KeySchema.transform((v) => [v]), KeySchema.array()]).optional().describe(
|
|
1813
1937
|
"Specifies the name of the range / sort key that makes up the primary key for the global secondary index."
|
|
1814
1938
|
),
|
|
1815
|
-
projection:
|
|
1939
|
+
projection: z39.enum(["all", "keys-only"]).default("all").describe(
|
|
1816
1940
|
[
|
|
1817
1941
|
"The set of attributes that are projected into the index:",
|
|
1818
1942
|
"- all - All of the table attributes are projected into the index.",
|
|
@@ -1826,12 +1950,12 @@ var TablesSchema = z38.record(
|
|
|
1826
1950
|
).optional().describe("Define the tables in your stack.");
|
|
1827
1951
|
|
|
1828
1952
|
// src/feature/test/schema.ts
|
|
1829
|
-
import { z as
|
|
1830
|
-
var TestsSchema =
|
|
1953
|
+
import { z as z40 } from "zod";
|
|
1954
|
+
var TestsSchema = z40.union([
|
|
1831
1955
|
//
|
|
1832
1956
|
LocalDirectorySchema.transform((v) => [v]),
|
|
1833
1957
|
LocalDirectorySchema.array(),
|
|
1834
|
-
|
|
1958
|
+
z40.literal(false)
|
|
1835
1959
|
]).describe("Define the location of your tests for your stack.").optional();
|
|
1836
1960
|
|
|
1837
1961
|
// src/config/stack.ts
|
|
@@ -1839,8 +1963,8 @@ var DependsSchema = ResourceIdSchema.array().optional().describe("Define the sta
|
|
|
1839
1963
|
var NameSchema = ResourceIdSchema.refine((name) => !["base", "hostedzones"].includes(name), {
|
|
1840
1964
|
message: `Stack name can't be a reserved name.`
|
|
1841
1965
|
}).describe("Stack name.");
|
|
1842
|
-
var StackSchema =
|
|
1843
|
-
$schema:
|
|
1966
|
+
var StackSchema = z41.object({
|
|
1967
|
+
$schema: z41.string().optional(),
|
|
1844
1968
|
name: NameSchema,
|
|
1845
1969
|
depends: DependsSchema,
|
|
1846
1970
|
commands: CommandsSchema,
|
|
@@ -1857,6 +1981,7 @@ var StackSchema = z40.object({
|
|
|
1857
1981
|
subscribers: SubscribersSchema,
|
|
1858
1982
|
functions: FunctionsSchema,
|
|
1859
1983
|
instances: InstancesSchema,
|
|
1984
|
+
jobs: JobsSchema,
|
|
1860
1985
|
tasks: TasksSchema,
|
|
1861
1986
|
tables: TablesSchema,
|
|
1862
1987
|
stores: StoresSchema,
|