@awsless/awsless 0.0.471 → 0.0.472
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/bin.js +418 -363
- package/dist/build-json-schema.js +232 -198
- package/dist/prebuild/rpc/HASH +1 -1
- package/dist/prebuild/rpc/bundle.zip +0 -0
- package/dist/prebuild.js +21 -24
- package/dist/stack.json +1 -1
- package/package.json +14 -14
package/dist/bin.js
CHANGED
|
@@ -414,7 +414,7 @@ var debug = (...parts) => {
|
|
|
414
414
|
};
|
|
415
415
|
|
|
416
416
|
// src/config/app.ts
|
|
417
|
-
import { z as
|
|
417
|
+
import { z as z21 } from "zod";
|
|
418
418
|
|
|
419
419
|
// src/feature/alert/schema.ts
|
|
420
420
|
import { kebabCase } from "change-case";
|
|
@@ -529,10 +529,11 @@ var DomainsDefaultSchema = z6.record(
|
|
|
529
529
|
// src/feature/function/schema.ts
|
|
530
530
|
import { days, minutes, seconds, toDays } from "@awsless/duration";
|
|
531
531
|
import { gibibytes, mebibytes } from "@awsless/size";
|
|
532
|
-
import { z as
|
|
532
|
+
import { z as z11 } from "zod";
|
|
533
533
|
|
|
534
534
|
// src/config/schema/local-directory.ts
|
|
535
535
|
import { stat } from "fs/promises";
|
|
536
|
+
import { z as z8 } from "zod";
|
|
536
537
|
|
|
537
538
|
// src/config/schema/relative-path.ts
|
|
538
539
|
import { join as join3 } from "path";
|
|
@@ -550,30 +551,41 @@ var resolvePath = (path) => {
|
|
|
550
551
|
var RelativePathSchema = z7.string().transform((path) => resolvePath(path));
|
|
551
552
|
|
|
552
553
|
// src/config/schema/local-directory.ts
|
|
553
|
-
var LocalDirectorySchema =
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
}
|
|
554
|
+
var LocalDirectorySchema = z8.union([
|
|
555
|
+
RelativePathSchema.refine(async (path) => {
|
|
556
|
+
try {
|
|
557
|
+
const s = await stat(path);
|
|
558
|
+
return s.isDirectory();
|
|
559
|
+
} catch (error) {
|
|
560
|
+
return false;
|
|
561
|
+
}
|
|
562
|
+
}, `Directory doesn't exist`),
|
|
563
|
+
z8.object({
|
|
564
|
+
nocheck: z8.string().describe("Specifies a local directory without checking if the directory exists.")
|
|
565
|
+
}).transform((v) => v.nocheck)
|
|
566
|
+
]);
|
|
561
567
|
|
|
562
568
|
// src/config/schema/local-file.ts
|
|
563
569
|
import { stat as stat2 } from "fs/promises";
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
570
|
+
import { z as z9 } from "zod";
|
|
571
|
+
var LocalFileSchema = z9.union([
|
|
572
|
+
RelativePathSchema.refine(async (path) => {
|
|
573
|
+
try {
|
|
574
|
+
const s = await stat2(path);
|
|
575
|
+
return s.isFile();
|
|
576
|
+
} catch (error) {
|
|
577
|
+
return false;
|
|
578
|
+
}
|
|
579
|
+
}, `File doesn't exist`),
|
|
580
|
+
z9.object({
|
|
581
|
+
nocheck: z9.string().describe("Specifies a local file without checking if the file exists.")
|
|
582
|
+
}).transform((v) => v.nocheck)
|
|
583
|
+
]);
|
|
572
584
|
|
|
573
585
|
// src/config/schema/size.ts
|
|
574
586
|
import { parse as parse2 } from "@awsless/size";
|
|
575
|
-
import { z as
|
|
576
|
-
var SizeSchema =
|
|
587
|
+
import { z as z10 } from "zod";
|
|
588
|
+
var SizeSchema = z10.string().regex(/^[0-9]+ (B|KB|MB|GB|TB|PB)$/, "Invalid size").transform((v) => parse2(v));
|
|
577
589
|
var sizeMin = (min) => {
|
|
578
590
|
return (size) => {
|
|
579
591
|
return size.value >= min.value;
|
|
@@ -596,32 +608,32 @@ var EphemeralStorageSizeSchema = SizeSchema.refine(
|
|
|
596
608
|
sizeMin(mebibytes(512)),
|
|
597
609
|
"Minimum ephemeral storage size is 512 MB"
|
|
598
610
|
).refine(sizeMax(gibibytes(10)), "Minimum ephemeral storage size is 10 GB").describe("The size of the function's /tmp directory. You can specify a size value from 512 MB to 10 GB.");
|
|
599
|
-
var ReservedConcurrentExecutionsSchema =
|
|
600
|
-
var EnvironmentSchema =
|
|
601
|
-
var ArchitectureSchema =
|
|
602
|
-
var RetryAttemptsSchema =
|
|
611
|
+
var ReservedConcurrentExecutionsSchema = z11.number().int().min(0).describe("The number of simultaneous executions to reserve for the function. You can specify a number from 0.");
|
|
612
|
+
var EnvironmentSchema = z11.record(z11.string(), z11.string()).optional().describe("Environment variable key-value pairs.");
|
|
613
|
+
var ArchitectureSchema = z11.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the function supports.");
|
|
614
|
+
var RetryAttemptsSchema = z11.number().int().min(0).max(2).describe(
|
|
603
615
|
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
|
|
604
616
|
);
|
|
605
|
-
var NodeRuntimeSchema =
|
|
606
|
-
var ContainerRuntimeSchema =
|
|
617
|
+
var NodeRuntimeSchema = z11.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x"]);
|
|
618
|
+
var ContainerRuntimeSchema = z11.literal("container");
|
|
607
619
|
var RuntimeSchema = NodeRuntimeSchema.or(ContainerRuntimeSchema).describe("The identifier of the function's runtime.");
|
|
608
|
-
var ActionSchema =
|
|
609
|
-
var ActionsSchema =
|
|
610
|
-
var ArnSchema =
|
|
611
|
-
var WildcardSchema =
|
|
612
|
-
var ResourceSchema =
|
|
613
|
-
var ResourcesSchema =
|
|
614
|
-
var PermissionSchema =
|
|
615
|
-
effect:
|
|
620
|
+
var ActionSchema = z11.string();
|
|
621
|
+
var ActionsSchema = z11.union([ActionSchema.transform((v) => [v]), ActionSchema.array()]);
|
|
622
|
+
var ArnSchema = z11.string().startsWith("arn:");
|
|
623
|
+
var WildcardSchema = z11.literal("*");
|
|
624
|
+
var ResourceSchema = z11.union([ArnSchema, WildcardSchema]);
|
|
625
|
+
var ResourcesSchema = z11.union([ResourceSchema.transform((v) => [v]), ResourceSchema.array()]);
|
|
626
|
+
var PermissionSchema = z11.object({
|
|
627
|
+
effect: z11.enum(["allow", "deny"]).default("allow"),
|
|
616
628
|
actions: ActionsSchema,
|
|
617
629
|
resources: ResourcesSchema
|
|
618
630
|
});
|
|
619
|
-
var PermissionsSchema =
|
|
620
|
-
var WarmSchema =
|
|
621
|
-
var VPCSchema =
|
|
622
|
-
var MinifySchema =
|
|
623
|
-
var HandlerSchema =
|
|
624
|
-
var DescriptionSchema =
|
|
631
|
+
var PermissionsSchema = z11.union([PermissionSchema.transform((v) => [v]), PermissionSchema.array()]).describe("Add IAM permissions to your function.");
|
|
632
|
+
var WarmSchema = z11.number().int().min(0).max(10).describe("Specify how many functions you want to warm up each 5 minutes. You can specify a number from 0 to 10.");
|
|
633
|
+
var VPCSchema = z11.boolean().describe("Put the function inside your global VPC.");
|
|
634
|
+
var MinifySchema = z11.boolean().describe("Minify the function code.");
|
|
635
|
+
var HandlerSchema = z11.string().describe("The name of the exported method within your code that Lambda calls to run your function.");
|
|
636
|
+
var DescriptionSchema = z11.string().describe("A description of the function.");
|
|
625
637
|
var validLogRetentionDays = [
|
|
626
638
|
...[1, 3, 5, 7, 14, 30, 60, 90, 120, 150],
|
|
627
639
|
...[180, 365, 400, 545, 731, 1096, 1827, 2192],
|
|
@@ -636,43 +648,43 @@ var LogRetentionSchema = DurationSchema.refine(
|
|
|
636
648
|
},
|
|
637
649
|
`Invalid log retention. Valid days are: ${validLogRetentionDays.map((days6) => `${days6}`).join(", ")}`
|
|
638
650
|
).describe("The log retention duration.");
|
|
639
|
-
var LogSchema =
|
|
640
|
-
|
|
651
|
+
var LogSchema = z11.union([
|
|
652
|
+
z11.boolean().transform((enabled) => ({ retention: enabled ? days(7) : days(0) })),
|
|
641
653
|
LogRetentionSchema.transform((retention) => ({ retention })),
|
|
642
|
-
|
|
654
|
+
z11.object({
|
|
643
655
|
// subscription: LogSubscriptionSchema.optional(),
|
|
644
656
|
retention: LogRetentionSchema.optional(),
|
|
645
|
-
format:
|
|
657
|
+
format: z11.enum(["text", "json"]).describe(
|
|
646
658
|
`The format in which Lambda sends your function's application and system logs to CloudWatch. Select between plain text and structured JSON.`
|
|
647
659
|
).optional(),
|
|
648
|
-
system:
|
|
660
|
+
system: z11.enum(["debug", "info", "warn"]).describe(
|
|
649
661
|
"Set this property to filter the system logs for your function that Lambda sends to CloudWatch. Lambda only sends system logs at the selected level of detail and lower, where DEBUG is the highest level and WARN is the lowest."
|
|
650
662
|
).optional(),
|
|
651
|
-
level:
|
|
663
|
+
level: z11.enum(["trace", "debug", "info", "warn", "error", "fatal"]).describe(
|
|
652
664
|
"Set this property to filter the application logs for your function that Lambda sends to CloudWatch. Lambda only sends application logs at the selected level of detail and lower, where TRACE is the highest level and FATAL is the lowest."
|
|
653
665
|
).optional()
|
|
654
666
|
})
|
|
655
667
|
]).describe("Enable logging to a CloudWatch log group. Providing a duration value will set the log retention time.");
|
|
656
|
-
var LayersSchema =
|
|
668
|
+
var LayersSchema = z11.string().array().describe(
|
|
657
669
|
// `A list of function layers to add to the function's execution environment..`
|
|
658
670
|
`A list of function layers to add to the function's execution environment. Specify each layer by its ARN, including the version.`
|
|
659
671
|
);
|
|
660
|
-
var FileCodeSchema =
|
|
672
|
+
var FileCodeSchema = z11.object({
|
|
661
673
|
file: LocalFileSchema.describe("The file path of the function code."),
|
|
662
674
|
minify: MinifySchema.optional().default(true),
|
|
663
|
-
external:
|
|
675
|
+
external: z11.string().array().optional().describe(`A list of external packages that won't be included in the bundle.`)
|
|
664
676
|
});
|
|
665
|
-
var BundleCodeSchema =
|
|
677
|
+
var BundleCodeSchema = z11.object({
|
|
666
678
|
bundle: LocalDirectorySchema.describe("The directory that needs to be bundled.")
|
|
667
679
|
});
|
|
668
|
-
var CodeSchema =
|
|
680
|
+
var CodeSchema = z11.union([
|
|
669
681
|
LocalFileSchema.transform((file) => ({
|
|
670
682
|
file
|
|
671
683
|
})).pipe(FileCodeSchema),
|
|
672
684
|
FileCodeSchema,
|
|
673
685
|
BundleCodeSchema
|
|
674
686
|
]).describe("Specify the code of your function.");
|
|
675
|
-
var FnSchema =
|
|
687
|
+
var FnSchema = z11.object({
|
|
676
688
|
code: CodeSchema,
|
|
677
689
|
// node
|
|
678
690
|
handler: HandlerSchema.optional(),
|
|
@@ -695,14 +707,14 @@ var FnSchema = z9.object({
|
|
|
695
707
|
environment: EnvironmentSchema.optional(),
|
|
696
708
|
permissions: PermissionsSchema.optional()
|
|
697
709
|
});
|
|
698
|
-
var FunctionSchema =
|
|
710
|
+
var FunctionSchema = z11.union([
|
|
699
711
|
LocalFileSchema.transform((code) => ({
|
|
700
712
|
code
|
|
701
713
|
})).pipe(FnSchema),
|
|
702
714
|
FnSchema
|
|
703
715
|
]);
|
|
704
|
-
var FunctionsSchema =
|
|
705
|
-
var FunctionDefaultSchema =
|
|
716
|
+
var FunctionsSchema = z11.record(ResourceIdSchema, FunctionSchema).optional().describe("Define the functions in your stack.");
|
|
717
|
+
var FunctionDefaultSchema = z11.object({
|
|
706
718
|
runtime: RuntimeSchema.default("nodejs20.x"),
|
|
707
719
|
// node
|
|
708
720
|
handler: HandlerSchema.default("index.default"),
|
|
@@ -731,25 +743,25 @@ var FunctionDefaultSchema = z9.object({
|
|
|
731
743
|
}).default({});
|
|
732
744
|
|
|
733
745
|
// src/feature/layer/schema.ts
|
|
734
|
-
import { z as
|
|
746
|
+
import { z as z13 } from "zod";
|
|
735
747
|
|
|
736
748
|
// src/config/schema/lambda.ts
|
|
737
|
-
import { z as
|
|
738
|
-
var ArchitectureSchema2 =
|
|
739
|
-
var NodeRuntimeSchema2 =
|
|
749
|
+
import { z as z12 } from "zod";
|
|
750
|
+
var ArchitectureSchema2 = z12.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the function supports.");
|
|
751
|
+
var NodeRuntimeSchema2 = z12.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x"]).describe("The identifier of the function's runtime.");
|
|
740
752
|
|
|
741
753
|
// src/feature/layer/schema.ts
|
|
742
|
-
var Schema =
|
|
754
|
+
var Schema = z13.object({
|
|
743
755
|
file: LocalFileSchema,
|
|
744
756
|
runtimes: NodeRuntimeSchema2.array().optional(),
|
|
745
757
|
architecture: ArchitectureSchema2.optional(),
|
|
746
|
-
packages:
|
|
758
|
+
packages: z13.string().array().optional().describe(
|
|
747
759
|
"Define the package names that are available bundled in the layer. Those packages are not bundled while bundling the lambda."
|
|
748
760
|
)
|
|
749
761
|
});
|
|
750
|
-
var LayerSchema =
|
|
751
|
-
|
|
752
|
-
|
|
762
|
+
var LayerSchema = z13.record(
|
|
763
|
+
z13.string(),
|
|
764
|
+
z13.union([
|
|
753
765
|
LocalFileSchema.transform((file) => ({
|
|
754
766
|
file,
|
|
755
767
|
description: void 0
|
|
@@ -764,28 +776,28 @@ var OnFailureDefaultSchema = FunctionSchema.optional().describe(
|
|
|
764
776
|
);
|
|
765
777
|
|
|
766
778
|
// src/feature/on-log/schema.ts
|
|
767
|
-
import { z as
|
|
768
|
-
var FilterSchema =
|
|
769
|
-
var OnLogDefaultSchema =
|
|
779
|
+
import { z as z14 } from "zod";
|
|
780
|
+
var FilterSchema = z14.enum(["trace", "debug", "info", "warn", "error", "fatal"]).array().describe("The log level that will gets delivered to the consumer.");
|
|
781
|
+
var OnLogDefaultSchema = z14.union([
|
|
770
782
|
FunctionSchema.transform((consumer) => ({
|
|
771
783
|
consumer,
|
|
772
784
|
filter: ["error", "fatal"]
|
|
773
785
|
})),
|
|
774
|
-
|
|
786
|
+
z14.object({
|
|
775
787
|
consumer: FunctionSchema,
|
|
776
788
|
filter: FilterSchema
|
|
777
789
|
})
|
|
778
790
|
]).optional().describe("Define a subscription on all Lambda functions logs.");
|
|
779
791
|
|
|
780
792
|
// src/feature/pubsub/schema.ts
|
|
781
|
-
import { z as
|
|
793
|
+
import { z as z15 } from "zod";
|
|
782
794
|
var DomainSchema = ResourceIdSchema.describe("The domain id to link your Pubsub API with.");
|
|
783
|
-
var PubSubDefaultSchema =
|
|
795
|
+
var PubSubDefaultSchema = z15.record(
|
|
784
796
|
ResourceIdSchema,
|
|
785
|
-
|
|
797
|
+
z15.object({
|
|
786
798
|
auth: FunctionSchema,
|
|
787
799
|
domain: DomainSchema.optional(),
|
|
788
|
-
subDomain:
|
|
800
|
+
subDomain: z15.string().optional()
|
|
789
801
|
// auth: z.union([
|
|
790
802
|
// ResourceIdSchema,
|
|
791
803
|
// z.object({
|
|
@@ -801,11 +813,11 @@ var PubSubDefaultSchema = z13.record(
|
|
|
801
813
|
// .optional(),
|
|
802
814
|
})
|
|
803
815
|
).optional().describe("Define the pubsub subscriber in your stack.");
|
|
804
|
-
var PubSubSchema =
|
|
816
|
+
var PubSubSchema = z15.record(
|
|
805
817
|
ResourceIdSchema,
|
|
806
|
-
|
|
807
|
-
sql:
|
|
808
|
-
sqlVersion:
|
|
818
|
+
z15.object({
|
|
819
|
+
sql: z15.string().describe("The SQL statement used to query the IOT topic."),
|
|
820
|
+
sqlVersion: z15.enum(["2015-10-08", "2016-03-23", "beta"]).default("2016-03-23").describe("The version of the SQL rules engine to use when evaluating the rule."),
|
|
809
821
|
consumer: FunctionSchema.describe("The consuming lambda function properties.")
|
|
810
822
|
})
|
|
811
823
|
).optional().describe("Define the pubsub subscriber in your stack.");
|
|
@@ -813,7 +825,7 @@ var PubSubSchema = z13.record(
|
|
|
813
825
|
// src/feature/queue/schema.ts
|
|
814
826
|
import { days as days2, hours, minutes as minutes2, seconds as seconds2 } from "@awsless/duration";
|
|
815
827
|
import { kibibytes } from "@awsless/size";
|
|
816
|
-
import { z as
|
|
828
|
+
import { z as z16 } from "zod";
|
|
817
829
|
var RetentionPeriodSchema = DurationSchema.refine(
|
|
818
830
|
durationMin(minutes2(1)),
|
|
819
831
|
"Minimum retention period is 1 minute"
|
|
@@ -841,10 +853,10 @@ var ReceiveMessageWaitTimeSchema = DurationSchema.refine(
|
|
|
841
853
|
var MaxMessageSizeSchema = SizeSchema.refine(sizeMin(kibibytes(1)), "Minimum max message size is 1 KB").refine(sizeMax(kibibytes(256)), "Maximum max message size is 256 KB").describe(
|
|
842
854
|
"The limit of how many bytes that a message can contain before Amazon SQS rejects it. You can specify an size from 1 KB to 256 KB."
|
|
843
855
|
);
|
|
844
|
-
var BatchSizeSchema =
|
|
856
|
+
var BatchSizeSchema = z16.number().int().min(1, "Minimum batch size is 1").max(1e4, "Maximum batch size is 10000").describe(
|
|
845
857
|
"The maximum number of records in each batch that Lambda pulls from your queue and sends to your function. 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). You can specify an integer from 1 to 10000."
|
|
846
858
|
);
|
|
847
|
-
var MaxConcurrencySchema =
|
|
859
|
+
var MaxConcurrencySchema = z16.number().int().min(2, "Minimum max concurrency is 2").max(1e3, "Maximum max concurrency is 1000").describe(
|
|
848
860
|
"Limits the number of concurrent instances that the queue worker can invoke. You can specify an integer from 2 to 1000."
|
|
849
861
|
);
|
|
850
862
|
var MaxBatchingWindow = DurationSchema.refine(
|
|
@@ -853,7 +865,7 @@ var MaxBatchingWindow = DurationSchema.refine(
|
|
|
853
865
|
).describe(
|
|
854
866
|
"The maximum amount of time, that Lambda spends gathering records before invoking the function. You can specify an duration from 0 seconds to 5 minutes."
|
|
855
867
|
);
|
|
856
|
-
var QueueDefaultSchema =
|
|
868
|
+
var QueueDefaultSchema = z16.object({
|
|
857
869
|
retentionPeriod: RetentionPeriodSchema.default("7 days"),
|
|
858
870
|
visibilityTimeout: VisibilityTimeoutSchema.default("30 seconds"),
|
|
859
871
|
deliveryDelay: DeliveryDelaySchema.default("0 seconds"),
|
|
@@ -863,7 +875,7 @@ var QueueDefaultSchema = z14.object({
|
|
|
863
875
|
maxConcurrency: MaxConcurrencySchema.optional(),
|
|
864
876
|
maxBatchingWindow: MaxBatchingWindow.optional()
|
|
865
877
|
}).default({});
|
|
866
|
-
var QueueSchema =
|
|
878
|
+
var QueueSchema = z16.object({
|
|
867
879
|
consumer: FunctionSchema.describe("The consuming lambda function properties."),
|
|
868
880
|
retentionPeriod: RetentionPeriodSchema.optional(),
|
|
869
881
|
visibilityTimeout: VisibilityTimeoutSchema.optional(),
|
|
@@ -874,9 +886,9 @@ var QueueSchema = z14.object({
|
|
|
874
886
|
maxConcurrency: MaxConcurrencySchema.optional(),
|
|
875
887
|
maxBatchingWindow: MaxBatchingWindow.optional()
|
|
876
888
|
});
|
|
877
|
-
var QueuesSchema =
|
|
889
|
+
var QueuesSchema = z16.record(
|
|
878
890
|
ResourceIdSchema,
|
|
879
|
-
|
|
891
|
+
z16.union([
|
|
880
892
|
LocalFileSchema.transform((consumer) => ({
|
|
881
893
|
consumer
|
|
882
894
|
})).pipe(QueueSchema),
|
|
@@ -885,41 +897,50 @@ var QueuesSchema = z14.record(
|
|
|
885
897
|
).optional().describe("Define the queues in your stack.");
|
|
886
898
|
|
|
887
899
|
// src/feature/rest/schema.ts
|
|
888
|
-
import { z as
|
|
900
|
+
import { z as z18 } from "zod";
|
|
889
901
|
|
|
890
902
|
// src/config/schema/route.ts
|
|
891
|
-
import { z as
|
|
892
|
-
var RouteSchema =
|
|
893
|
-
|
|
894
|
-
|
|
903
|
+
import { z as z17 } from "zod";
|
|
904
|
+
var RouteSchema = z17.union([
|
|
905
|
+
z17.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route"),
|
|
906
|
+
z17.literal("$default")
|
|
895
907
|
]);
|
|
896
908
|
|
|
897
909
|
// src/feature/rest/schema.ts
|
|
898
|
-
var RestDefaultSchema =
|
|
910
|
+
var RestDefaultSchema = z18.record(
|
|
899
911
|
ResourceIdSchema,
|
|
900
|
-
|
|
912
|
+
z18.object({
|
|
901
913
|
domain: ResourceIdSchema.describe("The domain id to link your API with.").optional(),
|
|
902
|
-
subDomain:
|
|
914
|
+
subDomain: z18.string().optional()
|
|
903
915
|
})
|
|
904
916
|
).optional().describe("Define your global REST API's.");
|
|
905
|
-
var RestSchema =
|
|
917
|
+
var RestSchema = z18.record(ResourceIdSchema, z18.record(RouteSchema, FunctionSchema)).optional().describe("Define routes in your stack for your global REST API.");
|
|
906
918
|
|
|
907
919
|
// src/feature/rpc/schema.ts
|
|
908
|
-
import { z as
|
|
909
|
-
|
|
920
|
+
import { z as z19 } from "zod";
|
|
921
|
+
import { minutes as minutes3, seconds as seconds3 } from "@awsless/duration";
|
|
922
|
+
var TimeoutSchema2 = DurationSchema.refine(durationMin(seconds3(10)), "Minimum timeout duration is 10 seconds").refine(durationMax(minutes3(5)), "Maximum timeout duration is 5 minutes").describe(
|
|
923
|
+
[
|
|
924
|
+
"The amount of time that the RPC lambda is allowed run before stopping it.",
|
|
925
|
+
"You can specify a size value from 1 second to 5 minutes.",
|
|
926
|
+
"The timeouts of all inner RPC functions will be capped at 80% of this timeout."
|
|
927
|
+
].join(" ")
|
|
928
|
+
);
|
|
929
|
+
var RpcDefaultSchema = z19.record(
|
|
910
930
|
ResourceIdSchema,
|
|
911
|
-
|
|
931
|
+
z19.object({
|
|
912
932
|
domain: ResourceIdSchema.describe("The domain id to link your RPC API with.").optional(),
|
|
913
|
-
subDomain:
|
|
933
|
+
subDomain: z19.string().optional(),
|
|
914
934
|
auth: FunctionSchema.optional(),
|
|
915
935
|
log: LogSchema.optional(),
|
|
916
|
-
|
|
936
|
+
timeout: TimeoutSchema2.default("1 minutes"),
|
|
937
|
+
geoRestrictions: z19.array(z19.string().length(2).toUpperCase()).default([]).describe("Specifies a blacklist of countries that should be blocked.")
|
|
917
938
|
})
|
|
918
939
|
).describe(`Define the global RPC API's.`).optional();
|
|
919
|
-
var RpcSchema =
|
|
940
|
+
var RpcSchema = z19.record(ResourceIdSchema, z19.record(z19.string(), FunctionSchema).describe("The queries for your global RPC API.")).describe("Define the schema in your stack for your global RPC API.").optional();
|
|
920
941
|
|
|
921
942
|
// src/config/schema/region.ts
|
|
922
|
-
import { z as
|
|
943
|
+
import { z as z20 } from "zod";
|
|
923
944
|
var US = ["us-east-2", "us-east-1", "us-west-1", "us-west-2"];
|
|
924
945
|
var AF = ["af-south-1"];
|
|
925
946
|
var AP = [
|
|
@@ -948,16 +969,16 @@ var EU = [
|
|
|
948
969
|
var ME = ["me-south-1", "me-central-1"];
|
|
949
970
|
var SA = ["sa-east-1"];
|
|
950
971
|
var regions = [...US, ...AF, ...AP, ...CA, ...EU, ...ME, ...SA];
|
|
951
|
-
var RegionSchema =
|
|
972
|
+
var RegionSchema = z20.enum(regions);
|
|
952
973
|
|
|
953
974
|
// src/config/app.ts
|
|
954
|
-
var AppSchema =
|
|
955
|
-
$schema:
|
|
975
|
+
var AppSchema = z21.object({
|
|
976
|
+
$schema: z21.string().optional(),
|
|
956
977
|
name: ResourceIdSchema.describe("App name."),
|
|
957
978
|
region: RegionSchema.describe("The AWS region to deploy to."),
|
|
958
|
-
profile:
|
|
959
|
-
protect:
|
|
960
|
-
removal:
|
|
979
|
+
profile: z21.string().describe("The AWS profile to deploy to."),
|
|
980
|
+
protect: z21.boolean().default(false).describe("Protect your app & stacks from being deleted."),
|
|
981
|
+
removal: z21.enum(["remove", "retain"]).default("remove").describe(
|
|
961
982
|
[
|
|
962
983
|
"Configure how your resources are handled when they have to be removed.",
|
|
963
984
|
"",
|
|
@@ -971,7 +992,7 @@ var AppSchema = z19.object({
|
|
|
971
992
|
// .default('prod')
|
|
972
993
|
// .describe('The deployment stage.'),
|
|
973
994
|
// onFailure: OnFailureSchema,
|
|
974
|
-
defaults:
|
|
995
|
+
defaults: z21.object({
|
|
975
996
|
onFailure: OnFailureDefaultSchema,
|
|
976
997
|
onLog: OnLogDefaultSchema,
|
|
977
998
|
auth: AuthDefaultSchema,
|
|
@@ -993,11 +1014,11 @@ var AppSchema = z19.object({
|
|
|
993
1014
|
});
|
|
994
1015
|
|
|
995
1016
|
// src/config/stack.ts
|
|
996
|
-
import { z as
|
|
1017
|
+
import { z as z34 } from "zod";
|
|
997
1018
|
|
|
998
1019
|
// src/feature/cache/schema.ts
|
|
999
1020
|
import { gibibytes as gibibytes2 } from "@awsless/size";
|
|
1000
|
-
import { z as
|
|
1021
|
+
import { z as z22 } from "zod";
|
|
1001
1022
|
var StorageSchema = SizeSchema.refine(sizeMin(gibibytes2(1)), "Minimum storage size is 1 GB").refine(
|
|
1002
1023
|
sizeMax(gibibytes2(5e3)),
|
|
1003
1024
|
"Maximum storage size is 5000 GB"
|
|
@@ -1008,31 +1029,31 @@ var MinimumStorageSchema = StorageSchema.describe(
|
|
|
1008
1029
|
var MaximumStorageSchema = StorageSchema.describe(
|
|
1009
1030
|
"The upper limit for data storage the cache is set to use. You can specify a size value from 1 GB to 5000 GB."
|
|
1010
1031
|
);
|
|
1011
|
-
var EcpuSchema =
|
|
1032
|
+
var EcpuSchema = z22.number().int().min(1e3).max(15e6);
|
|
1012
1033
|
var MinimumEcpuSchema = EcpuSchema.describe(
|
|
1013
1034
|
"The minimum number of ECPUs the cache can consume per second. You can specify a integer from 1,000 to 15,000,000."
|
|
1014
1035
|
);
|
|
1015
1036
|
var MaximumEcpuSchema = EcpuSchema.describe(
|
|
1016
1037
|
"The maximum number of ECPUs the cache can consume per second. You can specify a integer from 1,000 to 15,000,000."
|
|
1017
1038
|
);
|
|
1018
|
-
var CachesSchema =
|
|
1039
|
+
var CachesSchema = z22.record(
|
|
1019
1040
|
ResourceIdSchema,
|
|
1020
|
-
|
|
1041
|
+
z22.object({
|
|
1021
1042
|
minStorage: MinimumStorageSchema.optional(),
|
|
1022
1043
|
maxStorage: MaximumStorageSchema.optional(),
|
|
1023
1044
|
minECPU: MinimumEcpuSchema.optional(),
|
|
1024
1045
|
maxECPU: MaximumEcpuSchema.optional(),
|
|
1025
|
-
snapshotRetentionLimit:
|
|
1046
|
+
snapshotRetentionLimit: z22.number().int().positive().default(1)
|
|
1026
1047
|
})
|
|
1027
1048
|
).optional().describe("Define the caches in your stack. For access to the cache put your functions inside the global VPC.");
|
|
1028
1049
|
|
|
1029
1050
|
// src/feature/command/schema.ts
|
|
1030
|
-
import { z as
|
|
1031
|
-
var CommandSchema =
|
|
1032
|
-
|
|
1051
|
+
import { z as z23 } from "zod";
|
|
1052
|
+
var CommandSchema = z23.union([
|
|
1053
|
+
z23.object({
|
|
1033
1054
|
file: LocalFileSchema,
|
|
1034
|
-
handler:
|
|
1035
|
-
description:
|
|
1055
|
+
handler: z23.string().default("default").describe("The name of the handler that needs to run"),
|
|
1056
|
+
description: z23.string().optional().describe("A description of the command")
|
|
1036
1057
|
// options: z.record(ResourceIdSchema, OptionSchema).optional(),
|
|
1037
1058
|
// arguments: z.record(ResourceIdSchema, ArgumentSchema).optional(),
|
|
1038
1059
|
}),
|
|
@@ -1042,22 +1063,22 @@ var CommandSchema = z21.union([
|
|
|
1042
1063
|
description: void 0
|
|
1043
1064
|
}))
|
|
1044
1065
|
]);
|
|
1045
|
-
var CommandsSchema =
|
|
1066
|
+
var CommandsSchema = z23.record(ResourceIdSchema, CommandSchema).optional().describe("Define the custom commands for your stack.");
|
|
1046
1067
|
|
|
1047
1068
|
// src/feature/config/schema.ts
|
|
1048
|
-
import { z as
|
|
1049
|
-
var ConfigNameSchema =
|
|
1050
|
-
var ConfigsSchema =
|
|
1069
|
+
import { z as z24 } from "zod";
|
|
1070
|
+
var ConfigNameSchema = z24.string().regex(/[a-z0-9\-]/g, "Invalid config name");
|
|
1071
|
+
var ConfigsSchema = z24.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
|
|
1051
1072
|
|
|
1052
1073
|
// src/feature/cron/schema/index.ts
|
|
1053
|
-
import { z as
|
|
1074
|
+
import { z as z26 } from "zod";
|
|
1054
1075
|
|
|
1055
1076
|
// src/feature/cron/schema/schedule.ts
|
|
1056
|
-
import { z as
|
|
1077
|
+
import { z as z25 } from "zod";
|
|
1057
1078
|
import { awsCronExpressionValidator } from "aws-cron-expression-validator";
|
|
1058
|
-
var RateExpressionSchema =
|
|
1079
|
+
var RateExpressionSchema = z25.custom(
|
|
1059
1080
|
(value) => {
|
|
1060
|
-
return
|
|
1081
|
+
return z25.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
|
|
1061
1082
|
const [str] = rate.split(" ");
|
|
1062
1083
|
const number = parseInt(str);
|
|
1063
1084
|
return number > 0;
|
|
@@ -1073,9 +1094,9 @@ var RateExpressionSchema = z23.custom(
|
|
|
1073
1094
|
}
|
|
1074
1095
|
return `rate(${rate})`;
|
|
1075
1096
|
});
|
|
1076
|
-
var CronExpressionSchema =
|
|
1097
|
+
var CronExpressionSchema = z25.custom(
|
|
1077
1098
|
(value) => {
|
|
1078
|
-
return
|
|
1099
|
+
return z25.string().safeParse(value).success;
|
|
1079
1100
|
},
|
|
1080
1101
|
{ message: "Invalid cron expression" }
|
|
1081
1102
|
).superRefine((value, ctx) => {
|
|
@@ -1084,12 +1105,12 @@ var CronExpressionSchema = z23.custom(
|
|
|
1084
1105
|
} catch (error) {
|
|
1085
1106
|
if (error instanceof Error) {
|
|
1086
1107
|
ctx.addIssue({
|
|
1087
|
-
code:
|
|
1108
|
+
code: z25.ZodIssueCode.custom,
|
|
1088
1109
|
message: `Invalid cron expression: ${error.message}`
|
|
1089
1110
|
});
|
|
1090
1111
|
} else {
|
|
1091
1112
|
ctx.addIssue({
|
|
1092
|
-
code:
|
|
1113
|
+
code: z25.ZodIssueCode.custom,
|
|
1093
1114
|
message: "Invalid cron expression"
|
|
1094
1115
|
});
|
|
1095
1116
|
}
|
|
@@ -1100,23 +1121,23 @@ var CronExpressionSchema = z23.custom(
|
|
|
1100
1121
|
var ScheduleExpressionSchema = RateExpressionSchema.or(CronExpressionSchema);
|
|
1101
1122
|
|
|
1102
1123
|
// src/feature/cron/schema/index.ts
|
|
1103
|
-
var CronsSchema =
|
|
1124
|
+
var CronsSchema = z26.record(
|
|
1104
1125
|
ResourceIdSchema,
|
|
1105
|
-
|
|
1106
|
-
enabled:
|
|
1126
|
+
z26.object({
|
|
1127
|
+
enabled: z26.boolean().default(true).describe("If the cron is enabled."),
|
|
1107
1128
|
consumer: FunctionSchema.describe("The consuming lambda function properties."),
|
|
1108
1129
|
schedule: ScheduleExpressionSchema.describe(
|
|
1109
1130
|
'The scheduling expression.\n\nexample: "0 20 * * ? *"\nexample: "5 minutes"'
|
|
1110
1131
|
),
|
|
1111
|
-
payload:
|
|
1132
|
+
payload: z26.unknown().optional().describe("The JSON payload that will be passed to the consumer.")
|
|
1112
1133
|
})
|
|
1113
1134
|
).optional().describe(`Define the cron jobs in your stack.`);
|
|
1114
1135
|
|
|
1115
1136
|
// src/feature/search/schema.ts
|
|
1116
1137
|
import { gibibytes as gibibytes3 } from "@awsless/size";
|
|
1117
|
-
import { z as
|
|
1118
|
-
var VersionSchema =
|
|
1119
|
-
var TypeSchema =
|
|
1138
|
+
import { z as z27 } from "zod";
|
|
1139
|
+
var VersionSchema = z27.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]);
|
|
1140
|
+
var TypeSchema = z27.enum([
|
|
1120
1141
|
"t3.small",
|
|
1121
1142
|
"t3.medium",
|
|
1122
1143
|
"m3.medium",
|
|
@@ -1191,11 +1212,11 @@ var TypeSchema = z25.enum([
|
|
|
1191
1212
|
"r6gd.16xlarge"
|
|
1192
1213
|
]);
|
|
1193
1214
|
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.");
|
|
1194
|
-
var SearchsSchema =
|
|
1215
|
+
var SearchsSchema = z27.record(
|
|
1195
1216
|
ResourceIdSchema,
|
|
1196
|
-
|
|
1217
|
+
z27.object({
|
|
1197
1218
|
type: TypeSchema.default("t3.small"),
|
|
1198
|
-
count:
|
|
1219
|
+
count: z27.number().int().min(1).default(1),
|
|
1199
1220
|
version: VersionSchema.default("2.13"),
|
|
1200
1221
|
storage: StorageSizeSchema.default("10 GB")
|
|
1201
1222
|
// vpc: z.boolean().default(false),
|
|
@@ -1203,29 +1224,29 @@ var SearchsSchema = z25.record(
|
|
|
1203
1224
|
).optional().describe("Define the search instances in your stack. Backed by OpenSearch.");
|
|
1204
1225
|
|
|
1205
1226
|
// src/feature/site/schema.ts
|
|
1206
|
-
import { z as
|
|
1207
|
-
var ErrorResponsePathSchema =
|
|
1227
|
+
import { z as z28 } from "zod";
|
|
1228
|
+
var ErrorResponsePathSchema = z28.string().describe(
|
|
1208
1229
|
"The path to the custom error page that you want to return to the viewer when your origin returns the HTTP status code specified.\n - We recommend that you store custom error pages in an Amazon S3 bucket. If you store custom error pages on an HTTP server and the server starts to return 5xx errors, CloudFront can't get the files that you want to return to viewers because the origin server is unavailable."
|
|
1209
1230
|
);
|
|
1210
|
-
var StatusCodeSchema =
|
|
1231
|
+
var StatusCodeSchema = z28.number().int().positive().optional().describe(
|
|
1211
1232
|
"The HTTP status code that you want CloudFront to return to the viewer along with the custom error page. There are a variety of reasons that you might want CloudFront to return a status code different from the status code that your origin returned to CloudFront, for example:\n- Some Internet devices (some firewalls and corporate proxies, for example) intercept HTTP 4xx and 5xx and prevent the response from being returned to the viewer. If you substitute 200, the response typically won't be intercepted.\n- If you don't care about distinguishing among different client errors or server errors, you can specify 400 or 500 as the ResponseCode for all 4xx or 5xx errors.\n- You might want to return a 200 status code (OK) and static website so your customers don't know that your website is down."
|
|
1212
1233
|
);
|
|
1213
1234
|
var MinTTLSchema = DurationSchema.describe(
|
|
1214
1235
|
"The minimum amount of time, that you want to cache the error response. When this time period has elapsed, CloudFront queries your origin to see whether the problem that caused the error has been resolved and the requested object is now available."
|
|
1215
1236
|
);
|
|
1216
|
-
var ErrorResponseSchema =
|
|
1237
|
+
var ErrorResponseSchema = z28.union([
|
|
1217
1238
|
ErrorResponsePathSchema,
|
|
1218
|
-
|
|
1239
|
+
z28.object({
|
|
1219
1240
|
path: ErrorResponsePathSchema,
|
|
1220
1241
|
statusCode: StatusCodeSchema.optional(),
|
|
1221
1242
|
minTTL: MinTTLSchema.optional()
|
|
1222
1243
|
})
|
|
1223
1244
|
]).optional();
|
|
1224
|
-
var SitesSchema =
|
|
1245
|
+
var SitesSchema = z28.record(
|
|
1225
1246
|
ResourceIdSchema,
|
|
1226
|
-
|
|
1247
|
+
z28.object({
|
|
1227
1248
|
domain: ResourceIdSchema.describe("The domain id to link your site with.").optional(),
|
|
1228
|
-
subDomain:
|
|
1249
|
+
subDomain: z28.string().optional(),
|
|
1229
1250
|
// bind: z
|
|
1230
1251
|
// .object({
|
|
1231
1252
|
// auth: z.array(ResourceIdSchema),
|
|
@@ -1234,11 +1255,24 @@ var SitesSchema = z26.record(
|
|
|
1234
1255
|
// // rest: z.array(ResourceIdSchema),
|
|
1235
1256
|
// })
|
|
1236
1257
|
// .optional(),
|
|
1237
|
-
|
|
1258
|
+
build: z28.object({
|
|
1259
|
+
command: z28.string().describe(
|
|
1260
|
+
`Specifies the files and directories to generate the cache key for your custom build command.`
|
|
1261
|
+
),
|
|
1262
|
+
cacheKey: z28.union([
|
|
1263
|
+
LocalFileSchema.transform((v) => [v]),
|
|
1264
|
+
LocalFileSchema.array(),
|
|
1265
|
+
LocalDirectorySchema.transform((v) => [v]),
|
|
1266
|
+
LocalDirectorySchema.array()
|
|
1267
|
+
]).describe(
|
|
1268
|
+
`Specifies the files and directories to generate the cache key for your custom build command.`
|
|
1269
|
+
)
|
|
1270
|
+
}).optional().describe(`Specifies the build process for sites that need a build step.`),
|
|
1271
|
+
static: z28.union([LocalDirectorySchema, z28.boolean()]).optional().describe(
|
|
1238
1272
|
"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."
|
|
1239
1273
|
),
|
|
1240
1274
|
ssr: FunctionSchema.optional().describe("Specifies the ssr file."),
|
|
1241
|
-
origin:
|
|
1275
|
+
origin: z28.enum(["ssr-first", "static-first"]).default("static-first").describe("Specifies the origin fallback ordering."),
|
|
1242
1276
|
// bind: z.object({
|
|
1243
1277
|
// auth:
|
|
1244
1278
|
// h
|
|
@@ -1251,11 +1285,11 @@ var SitesSchema = z26.record(
|
|
|
1251
1285
|
// build: z.string().optional(),
|
|
1252
1286
|
// }),
|
|
1253
1287
|
// ]),
|
|
1254
|
-
geoRestrictions:
|
|
1255
|
-
forwardHost:
|
|
1256
|
-
"Specify if the host header
|
|
1288
|
+
geoRestrictions: z28.array(z28.string().length(2).toUpperCase()).default([]).describe("Specifies a blacklist of countries that should be blocked."),
|
|
1289
|
+
forwardHost: z28.boolean().default(false).describe(
|
|
1290
|
+
"Specify if the host header should be forwarded to the SSR function. Keep in mind that this requires an extra CloudFront Function."
|
|
1257
1291
|
),
|
|
1258
|
-
errors:
|
|
1292
|
+
errors: z28.object({
|
|
1259
1293
|
400: ErrorResponseSchema.describe("Customize a `400 Bad Request` response."),
|
|
1260
1294
|
403: ErrorResponseSchema.describe("Customize a `403 Forbidden` response."),
|
|
1261
1295
|
404: ErrorResponseSchema.describe("Customize a `404 Not Found` response."),
|
|
@@ -1268,16 +1302,16 @@ var SitesSchema = z26.record(
|
|
|
1268
1302
|
503: ErrorResponseSchema.describe("Customize a `503 Service Unavailable` response."),
|
|
1269
1303
|
504: ErrorResponseSchema.describe("Customize a `504 Gateway Timeout` response.")
|
|
1270
1304
|
}).optional().describe("Customize the error responses for specific HTTP status codes."),
|
|
1271
|
-
cors:
|
|
1272
|
-
override:
|
|
1305
|
+
cors: z28.object({
|
|
1306
|
+
override: z28.boolean().default(false),
|
|
1273
1307
|
maxAge: DurationSchema.default("365 days"),
|
|
1274
|
-
exposeHeaders:
|
|
1275
|
-
credentials:
|
|
1276
|
-
headers:
|
|
1277
|
-
origins:
|
|
1278
|
-
methods:
|
|
1308
|
+
exposeHeaders: z28.string().array().optional(),
|
|
1309
|
+
credentials: z28.boolean().default(false),
|
|
1310
|
+
headers: z28.string().array().default(["*"]),
|
|
1311
|
+
origins: z28.string().array().default(["*"]),
|
|
1312
|
+
methods: z28.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
|
|
1279
1313
|
}).optional().describe("Define the cors headers."),
|
|
1280
|
-
security:
|
|
1314
|
+
security: z28.object({
|
|
1281
1315
|
// contentSecurityPolicy: z.object({
|
|
1282
1316
|
// override: z.boolean().default(false),
|
|
1283
1317
|
// policy: z.string(),
|
|
@@ -1319,10 +1353,10 @@ var SitesSchema = z26.record(
|
|
|
1319
1353
|
// reportUri?: string
|
|
1320
1354
|
// }
|
|
1321
1355
|
}).optional().describe("Define the security policy."),
|
|
1322
|
-
cache:
|
|
1323
|
-
cookies:
|
|
1324
|
-
headers:
|
|
1325
|
-
queries:
|
|
1356
|
+
cache: z28.object({
|
|
1357
|
+
cookies: z28.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
|
|
1358
|
+
headers: z28.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
|
|
1359
|
+
queries: z28.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
|
|
1326
1360
|
}).optional().describe(
|
|
1327
1361
|
"Specifies the cookies, headers, and query values that CloudFront includes in the cache key."
|
|
1328
1362
|
)
|
|
@@ -1330,22 +1364,22 @@ var SitesSchema = z26.record(
|
|
|
1330
1364
|
).optional().describe("Define the sites in your stack.");
|
|
1331
1365
|
|
|
1332
1366
|
// src/feature/store/schema.ts
|
|
1333
|
-
import { z as
|
|
1334
|
-
var StoresSchema =
|
|
1335
|
-
|
|
1367
|
+
import { z as z29 } from "zod";
|
|
1368
|
+
var StoresSchema = z29.union([
|
|
1369
|
+
z29.array(ResourceIdSchema).transform((list5) => {
|
|
1336
1370
|
const stores = {};
|
|
1337
1371
|
for (const key of list5) {
|
|
1338
1372
|
stores[key] = {};
|
|
1339
1373
|
}
|
|
1340
1374
|
return stores;
|
|
1341
1375
|
}),
|
|
1342
|
-
|
|
1376
|
+
z29.record(
|
|
1343
1377
|
ResourceIdSchema,
|
|
1344
|
-
|
|
1378
|
+
z29.object({
|
|
1345
1379
|
// cors: CorsSchema,
|
|
1346
1380
|
// deletionProtection: DeletionProtectionSchema.optional(),
|
|
1347
|
-
versioning:
|
|
1348
|
-
events:
|
|
1381
|
+
versioning: z29.boolean().default(false).describe("Enable versioning of your store."),
|
|
1382
|
+
events: z29.object({
|
|
1349
1383
|
// create
|
|
1350
1384
|
"created:*": FunctionSchema.optional().describe(
|
|
1351
1385
|
"Subscribe to notifications regardless of the API that was used to create an object."
|
|
@@ -1378,44 +1412,44 @@ var StoresSchema = z27.union([
|
|
|
1378
1412
|
]).optional().describe("Define the stores in your stack.");
|
|
1379
1413
|
|
|
1380
1414
|
// src/feature/table/schema.ts
|
|
1381
|
-
import { z as
|
|
1382
|
-
var KeySchema =
|
|
1383
|
-
var TablesSchema =
|
|
1415
|
+
import { z as z30 } from "zod";
|
|
1416
|
+
var KeySchema = z30.string().min(1).max(255);
|
|
1417
|
+
var TablesSchema = z30.record(
|
|
1384
1418
|
ResourceIdSchema,
|
|
1385
|
-
|
|
1419
|
+
z30.object({
|
|
1386
1420
|
hash: KeySchema.describe(
|
|
1387
1421
|
"Specifies the name of the partition / hash key that makes up the primary key for the table."
|
|
1388
1422
|
),
|
|
1389
1423
|
sort: KeySchema.optional().describe(
|
|
1390
1424
|
"Specifies the name of the range / sort key that makes up the primary key for the table."
|
|
1391
1425
|
),
|
|
1392
|
-
fields:
|
|
1426
|
+
fields: z30.record(z30.string(), z30.enum(["string", "number", "binary"])).optional().describe(
|
|
1393
1427
|
'A list of attributes that describe the key schema for the table and indexes. If no attribute field is defined we default to "string".'
|
|
1394
1428
|
),
|
|
1395
|
-
class:
|
|
1396
|
-
pointInTimeRecovery:
|
|
1429
|
+
class: z30.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
|
|
1430
|
+
pointInTimeRecovery: z30.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
|
|
1397
1431
|
timeToLiveAttribute: KeySchema.optional().describe(
|
|
1398
1432
|
"The name of the TTL attribute used to store the expiration time for items in the table. To update this property, you must first disable TTL and then enable TTL with the new attribute name."
|
|
1399
1433
|
),
|
|
1400
1434
|
// deletionProtection: DeletionProtectionSchema.optional(),
|
|
1401
|
-
stream:
|
|
1402
|
-
type:
|
|
1435
|
+
stream: z30.object({
|
|
1436
|
+
type: z30.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
|
|
1403
1437
|
"When an item in the table is modified, stream.type determines what information is written to the stream for this table. Valid values are:\n- keys-only - Only the key attributes of the modified item are written to the stream.\n- new-image - The entire item, as it appears after it was modified, is written to the stream.\n- old-image - The entire item, as it appeared before it was modified, is written to the stream.\n- new-and-old-images - Both the new and the old item images of the item are written to the stream."
|
|
1404
1438
|
),
|
|
1405
1439
|
consumer: FunctionSchema.describe("The consuming lambda function for the stream")
|
|
1406
1440
|
}).optional().describe(
|
|
1407
1441
|
"The settings for the DynamoDB table stream, which capture changes to items stored in the table."
|
|
1408
1442
|
),
|
|
1409
|
-
indexes:
|
|
1410
|
-
|
|
1411
|
-
|
|
1443
|
+
indexes: z30.record(
|
|
1444
|
+
z30.string(),
|
|
1445
|
+
z30.object({
|
|
1412
1446
|
hash: KeySchema.describe(
|
|
1413
1447
|
"Specifies the name of the partition / hash key that makes up the primary key for the global secondary index."
|
|
1414
1448
|
),
|
|
1415
1449
|
sort: KeySchema.optional().describe(
|
|
1416
1450
|
"Specifies the name of the range / sort key that makes up the primary key for the global secondary index."
|
|
1417
1451
|
),
|
|
1418
|
-
projection:
|
|
1452
|
+
projection: z30.enum(["all", "keys-only"]).default("all").describe(
|
|
1419
1453
|
[
|
|
1420
1454
|
"The set of attributes that are projected into the index:",
|
|
1421
1455
|
"- all - All of the table attributes are projected into the index.",
|
|
@@ -1429,11 +1463,11 @@ var TablesSchema = z28.record(
|
|
|
1429
1463
|
).optional().describe("Define the tables in your stack.");
|
|
1430
1464
|
|
|
1431
1465
|
// src/feature/task/schema.ts
|
|
1432
|
-
import { z as
|
|
1433
|
-
var RetryAttemptsSchema2 =
|
|
1466
|
+
import { z as z31 } from "zod";
|
|
1467
|
+
var RetryAttemptsSchema2 = z31.number().int().min(0).max(2).describe(
|
|
1434
1468
|
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
|
|
1435
1469
|
);
|
|
1436
|
-
var TaskSchema =
|
|
1470
|
+
var TaskSchema = z31.union([
|
|
1437
1471
|
LocalFileSchema.transform((file) => ({
|
|
1438
1472
|
consumer: {
|
|
1439
1473
|
code: {
|
|
@@ -1444,33 +1478,33 @@ var TaskSchema = z29.union([
|
|
|
1444
1478
|
},
|
|
1445
1479
|
retryAttempts: void 0
|
|
1446
1480
|
})),
|
|
1447
|
-
|
|
1481
|
+
z31.object({
|
|
1448
1482
|
consumer: FunctionSchema,
|
|
1449
1483
|
retryAttempts: RetryAttemptsSchema2.optional()
|
|
1450
1484
|
})
|
|
1451
1485
|
]);
|
|
1452
|
-
var TasksSchema =
|
|
1486
|
+
var TasksSchema = z31.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
|
|
1453
1487
|
|
|
1454
1488
|
// src/feature/test/schema.ts
|
|
1455
|
-
import { z as
|
|
1456
|
-
var TestsSchema =
|
|
1489
|
+
import { z as z32 } from "zod";
|
|
1490
|
+
var TestsSchema = z32.union([LocalDirectorySchema.transform((v) => [v]), LocalDirectorySchema.array()]).describe("Define the location of your tests for your stack.").optional();
|
|
1457
1491
|
|
|
1458
1492
|
// src/feature/topic/schema.ts
|
|
1459
1493
|
import { kebabCase as kebabCase3 } from "change-case";
|
|
1460
|
-
import { z as
|
|
1461
|
-
var TopicNameSchema =
|
|
1462
|
-
var TopicsSchema =
|
|
1494
|
+
import { z as z33 } from "zod";
|
|
1495
|
+
var TopicNameSchema = z33.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => kebabCase3(value)).describe("Define event topic name.");
|
|
1496
|
+
var TopicsSchema = z33.array(TopicNameSchema).refine((topics) => {
|
|
1463
1497
|
return topics.length === new Set(topics).size;
|
|
1464
1498
|
}, "Must be a list of unique topic names").optional().describe("Define the event topics to publish too in your stack.");
|
|
1465
|
-
var SubscribersSchema =
|
|
1499
|
+
var SubscribersSchema = z33.record(TopicNameSchema, FunctionSchema).optional().describe("Define the event topics to subscribe too in your stack.");
|
|
1466
1500
|
|
|
1467
1501
|
// src/config/stack.ts
|
|
1468
1502
|
var DependsSchema = ResourceIdSchema.array().optional().describe("Define the stacks that this stack is depended on.");
|
|
1469
1503
|
var NameSchema = ResourceIdSchema.refine((name) => !["base", "hostedzones"].includes(name), {
|
|
1470
1504
|
message: `Stack name can't be a reserved name.`
|
|
1471
1505
|
}).describe("Stack name.");
|
|
1472
|
-
var StackSchema =
|
|
1473
|
-
$schema:
|
|
1506
|
+
var StackSchema = z34.object({
|
|
1507
|
+
$schema: z34.string().optional(),
|
|
1474
1508
|
name: NameSchema,
|
|
1475
1509
|
depends: DependsSchema,
|
|
1476
1510
|
commands: CommandsSchema,
|
|
@@ -1537,13 +1571,13 @@ var readConfigWithStage = async (file, stage) => {
|
|
|
1537
1571
|
};
|
|
1538
1572
|
|
|
1539
1573
|
// src/config/load/validate.ts
|
|
1540
|
-
import { z as
|
|
1574
|
+
import { z as z35 } from "zod";
|
|
1541
1575
|
var validateConfig = async (schema, file, data) => {
|
|
1542
1576
|
try {
|
|
1543
1577
|
const result = await schema.parseAsync(data);
|
|
1544
1578
|
return result;
|
|
1545
1579
|
} catch (error) {
|
|
1546
|
-
if (error instanceof
|
|
1580
|
+
if (error instanceof z35.ZodError) {
|
|
1547
1581
|
throw new ConfigError(file, error, data);
|
|
1548
1582
|
}
|
|
1549
1583
|
throw error;
|
|
@@ -2294,90 +2328,6 @@ var getGlobalOnFailure = (ctx) => {
|
|
|
2294
2328
|
return ctx.appConfig.defaults.onFailure ? ctx.shared.get("on-failure", "queue-arn") : void 0;
|
|
2295
2329
|
};
|
|
2296
2330
|
|
|
2297
|
-
// src/feature/function/build/typescript/bundle.ts
|
|
2298
|
-
import commonjs from "@rollup/plugin-commonjs";
|
|
2299
|
-
import json from "@rollup/plugin-json";
|
|
2300
|
-
import nodeResolve from "@rollup/plugin-node-resolve";
|
|
2301
|
-
import { createHash } from "crypto";
|
|
2302
|
-
import { dirname as dirname5 } from "path";
|
|
2303
|
-
import { rollup } from "rollup";
|
|
2304
|
-
import natives from "rollup-plugin-natives";
|
|
2305
|
-
import { swc, minify as swcMinify } from "rollup-plugin-swc3";
|
|
2306
|
-
var bundleTypeScript = async ({
|
|
2307
|
-
format: format2 = "esm",
|
|
2308
|
-
minify = true,
|
|
2309
|
-
file,
|
|
2310
|
-
nativeDir,
|
|
2311
|
-
external
|
|
2312
|
-
}) => {
|
|
2313
|
-
const bundle = await rollup({
|
|
2314
|
-
input: file,
|
|
2315
|
-
external: (importee) => {
|
|
2316
|
-
return importee.startsWith("@aws-sdk") || importee.startsWith("aws-sdk") || external?.includes(importee);
|
|
2317
|
-
},
|
|
2318
|
-
onwarn: (error) => {
|
|
2319
|
-
debugError(error.message);
|
|
2320
|
-
},
|
|
2321
|
-
treeshake: {
|
|
2322
|
-
preset: "smallest",
|
|
2323
|
-
moduleSideEffects: (id) => file === id
|
|
2324
|
-
},
|
|
2325
|
-
plugins: [
|
|
2326
|
-
commonjs({ sourceMap: true }),
|
|
2327
|
-
nodeResolve({ preferBuiltins: true }),
|
|
2328
|
-
// @ts-ignore
|
|
2329
|
-
nativeDir ? natives({
|
|
2330
|
-
copyTo: nativeDir,
|
|
2331
|
-
targetEsm: format2 === "esm",
|
|
2332
|
-
sourcemap: true
|
|
2333
|
-
}) : void 0,
|
|
2334
|
-
swc({
|
|
2335
|
-
// minify,
|
|
2336
|
-
// module: true,
|
|
2337
|
-
jsc: {
|
|
2338
|
-
baseUrl: dirname5(file),
|
|
2339
|
-
minify: { sourceMap: true }
|
|
2340
|
-
},
|
|
2341
|
-
sourceMaps: true
|
|
2342
|
-
}),
|
|
2343
|
-
minify ? swcMinify({
|
|
2344
|
-
module: format2 === "esm",
|
|
2345
|
-
sourceMap: true,
|
|
2346
|
-
compress: true
|
|
2347
|
-
}) : void 0,
|
|
2348
|
-
json()
|
|
2349
|
-
]
|
|
2350
|
-
});
|
|
2351
|
-
const ext = format2 === "esm" ? "mjs" : "js";
|
|
2352
|
-
const result = await bundle.generate({
|
|
2353
|
-
format: format2,
|
|
2354
|
-
sourcemap: "hidden",
|
|
2355
|
-
exports: "auto",
|
|
2356
|
-
manualChunks: {},
|
|
2357
|
-
entryFileNames: `index.${ext}`,
|
|
2358
|
-
chunkFileNames: `[name].${ext}`
|
|
2359
|
-
});
|
|
2360
|
-
const hash = createHash("sha1");
|
|
2361
|
-
const files = [];
|
|
2362
|
-
for (const item of result.output) {
|
|
2363
|
-
if (item.type !== "chunk") {
|
|
2364
|
-
continue;
|
|
2365
|
-
}
|
|
2366
|
-
const code = Buffer.from(item.code, "utf8");
|
|
2367
|
-
const map = item.map ? Buffer.from(item.map.toString(), "utf8") : void 0;
|
|
2368
|
-
hash.update(code);
|
|
2369
|
-
files.push({
|
|
2370
|
-
name: item.fileName,
|
|
2371
|
-
code,
|
|
2372
|
-
map
|
|
2373
|
-
});
|
|
2374
|
-
}
|
|
2375
|
-
return {
|
|
2376
|
-
hash: hash.digest("hex"),
|
|
2377
|
-
files
|
|
2378
|
-
};
|
|
2379
|
-
};
|
|
2380
|
-
|
|
2381
2331
|
// src/feature/function/build/zip.ts
|
|
2382
2332
|
import { createReadStream } from "fs";
|
|
2383
2333
|
import JSZip from "jszip";
|
|
@@ -2404,6 +2354,44 @@ import { toDays as toDays3, toSeconds } from "@awsless/duration";
|
|
|
2404
2354
|
import { toMebibytes } from "@awsless/size";
|
|
2405
2355
|
import { pascalCase } from "change-case";
|
|
2406
2356
|
|
|
2357
|
+
// src/util/cache.ts
|
|
2358
|
+
import { createHash } from "node:crypto";
|
|
2359
|
+
import { createReadStream as createReadStream2 } from "node:fs";
|
|
2360
|
+
import { lstat as lstat2, readdir } from "node:fs/promises";
|
|
2361
|
+
import { join as join7 } from "node:path";
|
|
2362
|
+
var generateCacheKey = async (directories2) => {
|
|
2363
|
+
const files = await listAllFiles(directories2);
|
|
2364
|
+
const hashes = {};
|
|
2365
|
+
for (const file of files) {
|
|
2366
|
+
hashes[file] = await createHashFromFile(file);
|
|
2367
|
+
}
|
|
2368
|
+
return createHash("md5").update(JSON.stringify(hashes)).digest("hex");
|
|
2369
|
+
};
|
|
2370
|
+
var createHashFromFile = (file) => {
|
|
2371
|
+
return new Promise((resolve) => {
|
|
2372
|
+
const hash = createHash("md5");
|
|
2373
|
+
const stream = createReadStream2(file);
|
|
2374
|
+
stream.on("data", (data) => hash.update(data));
|
|
2375
|
+
stream.on("end", () => resolve(hash.digest("hex")));
|
|
2376
|
+
});
|
|
2377
|
+
};
|
|
2378
|
+
var listAllFiles = async (list5) => {
|
|
2379
|
+
const files = [];
|
|
2380
|
+
for (const entry of list5) {
|
|
2381
|
+
const stat4 = await lstat2(entry);
|
|
2382
|
+
if (stat4.isDirectory()) {
|
|
2383
|
+
const dirents = await readdir(entry, {
|
|
2384
|
+
recursive: true,
|
|
2385
|
+
withFileTypes: true
|
|
2386
|
+
});
|
|
2387
|
+
files.push(...dirents.filter((d) => d.isFile()).map((file) => join7(file.path, file.name)));
|
|
2388
|
+
} else if (stat4.isFile()) {
|
|
2389
|
+
files.push(entry);
|
|
2390
|
+
}
|
|
2391
|
+
}
|
|
2392
|
+
return files;
|
|
2393
|
+
};
|
|
2394
|
+
|
|
2407
2395
|
// src/util/id.ts
|
|
2408
2396
|
import { createHash as createHash2 } from "crypto";
|
|
2409
2397
|
var shortId = (ns) => {
|
|
@@ -2411,18 +2399,18 @@ var shortId = (ns) => {
|
|
|
2411
2399
|
};
|
|
2412
2400
|
|
|
2413
2401
|
// src/util/temp.ts
|
|
2414
|
-
import { mkdir as mkdir3, readdir, rm as rm2 } from "fs/promises";
|
|
2415
|
-
import { join as
|
|
2402
|
+
import { mkdir as mkdir3, readdir as readdir2, rm as rm2 } from "fs/promises";
|
|
2403
|
+
import { join as join8 } from "path";
|
|
2416
2404
|
var createTempFolder = async (name) => {
|
|
2417
|
-
const path =
|
|
2418
|
-
await mkdir3(
|
|
2405
|
+
const path = join8(directories.temp, name);
|
|
2406
|
+
await mkdir3(join8(directories.temp, name), { recursive: true });
|
|
2419
2407
|
process.on("SIGTERM", async () => {
|
|
2420
2408
|
await rm2(path, { recursive: true });
|
|
2421
2409
|
});
|
|
2422
2410
|
return {
|
|
2423
2411
|
path,
|
|
2424
2412
|
async files() {
|
|
2425
|
-
return
|
|
2413
|
+
return readdir2(path, { recursive: true });
|
|
2426
2414
|
},
|
|
2427
2415
|
async delete() {
|
|
2428
2416
|
await rm2(path, { recursive: true });
|
|
@@ -2443,20 +2431,20 @@ var formatFilterPattern = (filters) => {
|
|
|
2443
2431
|
|
|
2444
2432
|
// src/feature/function/build/bundle/bundle.ts
|
|
2445
2433
|
import JSZip2 from "jszip";
|
|
2446
|
-
import { createReadStream as
|
|
2447
|
-
import { readdir as
|
|
2448
|
-
import { join as
|
|
2434
|
+
import { createReadStream as createReadStream3 } from "node:fs";
|
|
2435
|
+
import { readdir as readdir3 } from "node:fs/promises";
|
|
2436
|
+
import { join as join9, relative as relative2 } from "node:path";
|
|
2449
2437
|
var zipBundle = async ({ directory }) => {
|
|
2450
2438
|
const zip = new JSZip2();
|
|
2451
|
-
const list5 = await
|
|
2439
|
+
const list5 = await readdir3(directory, {
|
|
2452
2440
|
recursive: true,
|
|
2453
2441
|
withFileTypes: true
|
|
2454
2442
|
});
|
|
2455
2443
|
for (const file of list5) {
|
|
2456
2444
|
if (file.isFile()) {
|
|
2457
|
-
const path =
|
|
2445
|
+
const path = join9(file.path, file.name);
|
|
2458
2446
|
const rel = relative2(directory, path);
|
|
2459
|
-
zip.file(rel,
|
|
2447
|
+
zip.file(rel, createReadStream3(path));
|
|
2460
2448
|
}
|
|
2461
2449
|
}
|
|
2462
2450
|
return zip.generateAsync({
|
|
@@ -2468,42 +2456,85 @@ var zipBundle = async ({ directory }) => {
|
|
|
2468
2456
|
});
|
|
2469
2457
|
};
|
|
2470
2458
|
|
|
2471
|
-
// src/feature/function/build/
|
|
2472
|
-
import
|
|
2473
|
-
import
|
|
2474
|
-
import {
|
|
2475
|
-
import {
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2459
|
+
// src/feature/function/build/typescript/rolldown.ts
|
|
2460
|
+
import json from "@rollup/plugin-json";
|
|
2461
|
+
import nodeResolve from "@rollup/plugin-node-resolve";
|
|
2462
|
+
import { createHash as createHash3 } from "crypto";
|
|
2463
|
+
import { rolldown } from "rolldown";
|
|
2464
|
+
import natives from "rollup-plugin-natives";
|
|
2465
|
+
import { minify as swcMinify } from "rollup-plugin-swc3";
|
|
2466
|
+
var bundleTypeScriptWithRolldown = async ({
|
|
2467
|
+
format: format2 = "esm",
|
|
2468
|
+
minify = true,
|
|
2469
|
+
file,
|
|
2470
|
+
nativeDir,
|
|
2471
|
+
external
|
|
2472
|
+
}) => {
|
|
2473
|
+
const bundle = await rolldown({
|
|
2474
|
+
input: file,
|
|
2475
|
+
external: (importee) => {
|
|
2476
|
+
return importee.startsWith("@aws-sdk") || importee.startsWith("aws-sdk") || external?.includes(importee);
|
|
2477
|
+
},
|
|
2478
|
+
onwarn: (error) => {
|
|
2479
|
+
debugError(error.message);
|
|
2480
|
+
},
|
|
2481
|
+
treeshake: {
|
|
2482
|
+
// preset: 'smallest',
|
|
2483
|
+
moduleSideEffects: (id) => file === id
|
|
2484
|
+
},
|
|
2485
|
+
plugins: [
|
|
2486
|
+
// commonjs({ sourceMap: true }),
|
|
2487
|
+
nodeResolve({ preferBuiltins: true }),
|
|
2488
|
+
nativeDir ? natives({
|
|
2489
|
+
copyTo: nativeDir,
|
|
2490
|
+
targetEsm: format2 === "esm",
|
|
2491
|
+
sourcemap: true
|
|
2492
|
+
}) : void 0,
|
|
2493
|
+
// swc({
|
|
2494
|
+
// // minify,
|
|
2495
|
+
// // module: true,
|
|
2496
|
+
// jsc: {
|
|
2497
|
+
// baseUrl: dirname(file),
|
|
2498
|
+
// minify: { sourceMap: true },
|
|
2499
|
+
// },
|
|
2500
|
+
// sourceMaps: true,
|
|
2501
|
+
// }),
|
|
2502
|
+
minify ? swcMinify({
|
|
2503
|
+
module: format2 === "esm",
|
|
2504
|
+
sourceMap: true,
|
|
2505
|
+
compress: true
|
|
2506
|
+
}) : void 0,
|
|
2507
|
+
json()
|
|
2508
|
+
]
|
|
2490
2509
|
});
|
|
2491
|
-
|
|
2492
|
-
|
|
2510
|
+
const ext = format2 === "esm" ? "mjs" : "js";
|
|
2511
|
+
const result = await bundle.generate({
|
|
2512
|
+
format: format2,
|
|
2513
|
+
sourcemap: "hidden",
|
|
2514
|
+
exports: "auto",
|
|
2515
|
+
// manualChunks: {},
|
|
2516
|
+
entryFileNames: `index.${ext}`,
|
|
2517
|
+
chunkFileNames: `[name].${ext}`
|
|
2518
|
+
});
|
|
2519
|
+
const hash = createHash3("sha1");
|
|
2493
2520
|
const files = [];
|
|
2494
|
-
for (const
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
const dirents = await readdir3(entry, {
|
|
2498
|
-
recursive: true,
|
|
2499
|
-
withFileTypes: true
|
|
2500
|
-
});
|
|
2501
|
-
files.push(...dirents.filter((d) => d.isFile()).map((file) => join9(file.path, file.name)));
|
|
2502
|
-
} else if (stat4.isFile()) {
|
|
2503
|
-
files.push(entry);
|
|
2521
|
+
for (const item of result.output) {
|
|
2522
|
+
if (item.type !== "chunk") {
|
|
2523
|
+
continue;
|
|
2504
2524
|
}
|
|
2525
|
+
const code = Buffer.from(item.code, "utf8");
|
|
2526
|
+
const map = item.map ? Buffer.from(item.map.toString(), "utf8") : void 0;
|
|
2527
|
+
hash.update(code);
|
|
2528
|
+
files.push({
|
|
2529
|
+
name: item.fileName,
|
|
2530
|
+
code,
|
|
2531
|
+
map
|
|
2532
|
+
});
|
|
2505
2533
|
}
|
|
2506
|
-
return
|
|
2534
|
+
return {
|
|
2535
|
+
hash: hash.digest("hex"),
|
|
2536
|
+
files
|
|
2537
|
+
};
|
|
2507
2538
|
};
|
|
2508
2539
|
|
|
2509
2540
|
// src/feature/function/util.ts
|
|
@@ -2542,10 +2573,10 @@ var createLambdaFunction = (group, ctx, ns, id, local) => {
|
|
|
2542
2573
|
} else if ("file" in local.code) {
|
|
2543
2574
|
const fileCode = local.code;
|
|
2544
2575
|
ctx.registerBuild("function", name, async (build3, { workspace }) => {
|
|
2545
|
-
const
|
|
2546
|
-
return build3(
|
|
2576
|
+
const fingerprint = await generateFileHash(workspace, fileCode.file);
|
|
2577
|
+
return build3(fingerprint, async (write) => {
|
|
2547
2578
|
const temp = await createTempFolder(`function--${name}`);
|
|
2548
|
-
const bundle = await
|
|
2579
|
+
const bundle = await bundleTypeScriptWithRolldown({
|
|
2549
2580
|
file: fileCode.file,
|
|
2550
2581
|
external: [
|
|
2551
2582
|
...fileCode.external ?? [],
|
|
@@ -2584,14 +2615,12 @@ var createLambdaFunction = (group, ctx, ns, id, local) => {
|
|
|
2584
2615
|
} else {
|
|
2585
2616
|
const bundleCode = local.code;
|
|
2586
2617
|
ctx.registerBuild("function", name, async (build3) => {
|
|
2587
|
-
const
|
|
2588
|
-
|
|
2589
|
-
});
|
|
2590
|
-
return build3(version, async (write) => {
|
|
2618
|
+
const fingerprint = await generateCacheKey([bundleCode.bundle]);
|
|
2619
|
+
return build3(fingerprint, async (write) => {
|
|
2591
2620
|
const bundle = await zipBundle({
|
|
2592
2621
|
directory: bundleCode.bundle
|
|
2593
2622
|
});
|
|
2594
|
-
await write("HASH",
|
|
2623
|
+
await write("HASH", fingerprint);
|
|
2595
2624
|
await write("bundle.zip", bundle);
|
|
2596
2625
|
return {
|
|
2597
2626
|
size: formatByteSize(bundle.byteLength)
|
|
@@ -2872,7 +2901,7 @@ var cronFeature = defineFeature({
|
|
|
2872
2901
|
});
|
|
2873
2902
|
|
|
2874
2903
|
// src/feature/domain/index.ts
|
|
2875
|
-
import { minutes as
|
|
2904
|
+
import { minutes as minutes4, toSeconds as toSeconds2 } from "@awsless/duration";
|
|
2876
2905
|
import { $ as $5, Group as Group5 } from "@awsless/formation";
|
|
2877
2906
|
var domainFeature = defineFeature({
|
|
2878
2907
|
name: "domain",
|
|
@@ -2910,7 +2939,7 @@ var domainFeature = defineFeature({
|
|
|
2910
2939
|
zoneId: zone.id,
|
|
2911
2940
|
name: option(certificate, 0).pipe((r) => r.resourceRecordName),
|
|
2912
2941
|
type: option(certificate, 0).pipe((r) => r.resourceRecordType),
|
|
2913
|
-
ttl: toSeconds2(
|
|
2942
|
+
ttl: toSeconds2(minutes4(5)),
|
|
2914
2943
|
records: [option(certificate, 0).pipe((r) => r.resourceRecordValue)],
|
|
2915
2944
|
allowOverwrite: true
|
|
2916
2945
|
});
|
|
@@ -2918,7 +2947,7 @@ var domainFeature = defineFeature({
|
|
|
2918
2947
|
zoneId: zone.id,
|
|
2919
2948
|
name: option(certificate, 1).pipe((r) => r.resourceRecordName),
|
|
2920
2949
|
type: option(certificate, 1).pipe((r) => r.resourceRecordType),
|
|
2921
|
-
ttl: toSeconds2(
|
|
2950
|
+
ttl: toSeconds2(minutes4(5)),
|
|
2922
2951
|
records: [option(certificate, 1).pipe((r) => r.resourceRecordValue)],
|
|
2923
2952
|
allowOverwrite: true
|
|
2924
2953
|
});
|
|
@@ -2946,7 +2975,7 @@ var domainFeature = defineFeature({
|
|
|
2946
2975
|
zoneId: zone.id,
|
|
2947
2976
|
name: option(globalCertificate, 0).pipe((r) => r.resourceRecordName),
|
|
2948
2977
|
type: option(globalCertificate, 0).pipe((r) => r.resourceRecordType),
|
|
2949
|
-
ttl: toSeconds2(
|
|
2978
|
+
ttl: toSeconds2(minutes4(5)),
|
|
2950
2979
|
records: [option(globalCertificate, 0).pipe((r) => r.resourceRecordValue)],
|
|
2951
2980
|
allowOverwrite: true
|
|
2952
2981
|
});
|
|
@@ -2954,7 +2983,7 @@ var domainFeature = defineFeature({
|
|
|
2954
2983
|
zoneId: zone.id,
|
|
2955
2984
|
name: option(globalCertificate, 1).pipe((r) => r.resourceRecordName),
|
|
2956
2985
|
type: option(globalCertificate, 1).pipe((r) => r.resourceRecordType),
|
|
2957
|
-
ttl: toSeconds2(
|
|
2986
|
+
ttl: toSeconds2(minutes4(5)),
|
|
2958
2987
|
records: [option(globalCertificate, 1).pipe((r) => r.resourceRecordValue)],
|
|
2959
2988
|
allowOverwrite: true
|
|
2960
2989
|
});
|
|
@@ -2980,7 +3009,7 @@ var domainFeature = defineFeature({
|
|
|
2980
3009
|
zoneId: zone.id,
|
|
2981
3010
|
name: `_amazonses.${props.domain}`,
|
|
2982
3011
|
type: "TXT",
|
|
2983
|
-
ttl: toSeconds2(
|
|
3012
|
+
ttl: toSeconds2(minutes4(5)),
|
|
2984
3013
|
records: [identity.verificationToken]
|
|
2985
3014
|
});
|
|
2986
3015
|
const dkim = new $5.aws.ses.DomainDkim(group2, "dkim", {
|
|
@@ -2991,7 +3020,7 @@ var domainFeature = defineFeature({
|
|
|
2991
3020
|
zoneId: zone.id,
|
|
2992
3021
|
type: "CNAME",
|
|
2993
3022
|
name: dkim.dkimTokens.pipe((t) => `${t.at(i)}._domainkey`),
|
|
2994
|
-
ttl: toSeconds2(
|
|
3023
|
+
ttl: toSeconds2(minutes4(5)),
|
|
2995
3024
|
records: [dkim.dkimTokens.pipe((t) => `${t.at(i)}.dkim.amazonses.com`)]
|
|
2996
3025
|
});
|
|
2997
3026
|
}
|
|
@@ -3004,21 +3033,21 @@ var domainFeature = defineFeature({
|
|
|
3004
3033
|
zoneId: zone.id,
|
|
3005
3034
|
name: mailFrom.mailFromDomain,
|
|
3006
3035
|
type: "MX",
|
|
3007
|
-
ttl: toSeconds2(
|
|
3036
|
+
ttl: toSeconds2(minutes4(5)),
|
|
3008
3037
|
records: [`10 feedback-smtp.${ctx.appConfig.region}.amazonses.com`]
|
|
3009
3038
|
});
|
|
3010
3039
|
new $5.aws.route53.Record(group2, `SPF`, {
|
|
3011
3040
|
zoneId: zone.id,
|
|
3012
3041
|
name: mailFrom.mailFromDomain,
|
|
3013
3042
|
type: "TXT",
|
|
3014
|
-
ttl: toSeconds2(
|
|
3043
|
+
ttl: toSeconds2(minutes4(5)),
|
|
3015
3044
|
records: ["v=spf1 include:amazonses.com -all"]
|
|
3016
3045
|
});
|
|
3017
3046
|
new $5.aws.route53.Record(group2, `DMARC`, {
|
|
3018
3047
|
zoneId: zone.id,
|
|
3019
3048
|
name: `_dmarc.${props.domain}`,
|
|
3020
3049
|
type: "TXT",
|
|
3021
|
-
ttl: toSeconds2(
|
|
3050
|
+
ttl: toSeconds2(minutes4(5)),
|
|
3022
3051
|
records: ["v=DMARC1; p=none;"]
|
|
3023
3052
|
});
|
|
3024
3053
|
const verification = new $5.aws.ses.DomainIdentityVerification(
|
|
@@ -3371,7 +3400,7 @@ import { $ as $10, Group as Group10 } from "@awsless/formation";
|
|
|
3371
3400
|
import { camelCase as camelCase4, constantCase as constantCase6 } from "change-case";
|
|
3372
3401
|
import deepmerge3 from "deepmerge";
|
|
3373
3402
|
import { relative as relative4 } from "path";
|
|
3374
|
-
import { seconds as
|
|
3403
|
+
import { seconds as seconds4, toSeconds as toSeconds3 } from "@awsless/duration";
|
|
3375
3404
|
import { toBytes } from "@awsless/size";
|
|
3376
3405
|
var typeGenCode3 = `
|
|
3377
3406
|
import { SendMessageOptions, SendMessageBatchOptions, BatchItem } from '@awsless/sqs'
|
|
@@ -3442,7 +3471,7 @@ var queueFeature = defineFeature({
|
|
|
3442
3471
|
name,
|
|
3443
3472
|
delaySeconds: toSeconds3(props.deliveryDelay),
|
|
3444
3473
|
visibilityTimeoutSeconds: toSeconds3(props.visibilityTimeout),
|
|
3445
|
-
receiveWaitTimeSeconds: toSeconds3(props.receiveMessageWaitTime ??
|
|
3474
|
+
receiveWaitTimeSeconds: toSeconds3(props.receiveMessageWaitTime ?? seconds4(0)),
|
|
3446
3475
|
messageRetentionSeconds: toSeconds3(props.retentionPeriod),
|
|
3447
3476
|
maxMessageSize: toBytes(props.maxMessageSize),
|
|
3448
3477
|
redrivePolicy: onFailure && onFailure.pipe(
|
|
@@ -3598,11 +3627,11 @@ var restFeature = defineFeature({
|
|
|
3598
3627
|
import { camelCase as camelCase5, constantCase as constantCase8, kebabCase as kebabCase6 } from "change-case";
|
|
3599
3628
|
import { $ as $13, Group as Group13 } from "@awsless/formation";
|
|
3600
3629
|
import { mebibytes as mebibytes3 } from "@awsless/size";
|
|
3601
|
-
import { dirname as
|
|
3630
|
+
import { dirname as dirname5, join as join10, relative as relative5 } from "path";
|
|
3602
3631
|
import { fileURLToPath } from "node:url";
|
|
3603
3632
|
|
|
3604
3633
|
// src/feature/function/prebuild.ts
|
|
3605
|
-
import { days as days3, seconds as
|
|
3634
|
+
import { days as days3, seconds as seconds5, toDays as toDays4, toSeconds as toSeconds4 } from "@awsless/duration";
|
|
3606
3635
|
import { $ as $12, Future as Future2, resolveInputs as resolveInputs2 } from "@awsless/formation";
|
|
3607
3636
|
import { mebibytes as mebibytes2, toMebibytes as toMebibytes2 } from "@awsless/size";
|
|
3608
3637
|
import { pascalCase as pascalCase2 } from "change-case";
|
|
@@ -3691,7 +3720,7 @@ var createPrebuildLambdaFunction = (group, ctx, ns, id, props) => {
|
|
|
3691
3720
|
// runtime: props.runtime === 'container' ? undefined : props.runtime,
|
|
3692
3721
|
runtime: props.runtime,
|
|
3693
3722
|
handler: props.handler,
|
|
3694
|
-
timeout: toSeconds4(props.timeout ??
|
|
3723
|
+
timeout: toSeconds4(props.timeout ?? seconds5(10)),
|
|
3695
3724
|
memorySize: toMebibytes2(props.memorySize ?? mebibytes2(128)),
|
|
3696
3725
|
architectures: [props.architecture ?? "arm64"],
|
|
3697
3726
|
layers: props.layers?.map((id2) => ctx.shared.entry("layer", "arn", id2)),
|
|
@@ -3776,8 +3805,8 @@ var createPrebuildLambdaFunction = (group, ctx, ns, id, props) => {
|
|
|
3776
3805
|
};
|
|
3777
3806
|
|
|
3778
3807
|
// src/feature/rpc/index.ts
|
|
3779
|
-
import { days as days4,
|
|
3780
|
-
var __dirname =
|
|
3808
|
+
import { days as days4, seconds as seconds6, toSeconds as toSeconds5 } from "@awsless/duration";
|
|
3809
|
+
var __dirname = dirname5(fileURLToPath(import.meta.url));
|
|
3781
3810
|
var rpcFeature = defineFeature({
|
|
3782
3811
|
name: "rpc",
|
|
3783
3812
|
async onTypeGen(ctx) {
|
|
@@ -3812,12 +3841,23 @@ var rpcFeature = defineFeature({
|
|
|
3812
3841
|
for (const stack of ctx.stackConfigs) {
|
|
3813
3842
|
for (const [id, queries] of Object.entries(stack.rpc ?? {})) {
|
|
3814
3843
|
const list5 = names[id];
|
|
3815
|
-
|
|
3844
|
+
if (!list5) {
|
|
3845
|
+
throw new FileError(stack.file, `The RPC API for "${id}" isn't defined on app level.`);
|
|
3846
|
+
}
|
|
3847
|
+
for (const [name, props] of Object.entries(queries ?? {})) {
|
|
3816
3848
|
if (list5.has(name)) {
|
|
3817
3849
|
throw new FileError(stack.file, `Duplicate RPC API function "${id}.${name}"`);
|
|
3818
3850
|
} else {
|
|
3819
3851
|
list5.add(name);
|
|
3820
3852
|
}
|
|
3853
|
+
const timeout = toSeconds5(props.timeout ?? ctx.appConfig.defaults.function.timeout);
|
|
3854
|
+
const maxTimeout = toSeconds5(ctx.appConfig.defaults.rpc[id].timeout) * 0.8;
|
|
3855
|
+
if (timeout > maxTimeout) {
|
|
3856
|
+
throw new FileError(
|
|
3857
|
+
stack.file,
|
|
3858
|
+
`Your RPC function "${id}.${name}" has a ${timeout} seconds timeout, the maximum is ${maxTimeout} seconds.`
|
|
3859
|
+
);
|
|
3860
|
+
}
|
|
3821
3861
|
}
|
|
3822
3862
|
}
|
|
3823
3863
|
}
|
|
@@ -3834,12 +3874,13 @@ var rpcFeature = defineFeature({
|
|
|
3834
3874
|
bundleFile: join10(__dirname, "/prebuild/rpc/bundle.zip"),
|
|
3835
3875
|
bundleHash: join10(__dirname, "/prebuild/rpc/HASH"),
|
|
3836
3876
|
memorySize: mebibytes3(256),
|
|
3837
|
-
timeout:
|
|
3877
|
+
timeout: props.timeout,
|
|
3838
3878
|
handler: "index.default",
|
|
3839
3879
|
runtime: "nodejs22.x",
|
|
3840
3880
|
warm: 3,
|
|
3841
3881
|
log: props.log
|
|
3842
3882
|
});
|
|
3883
|
+
result.setEnvironment("TIMEOUT", toSeconds5(props.timeout).toString());
|
|
3843
3884
|
const schemaTable = new $13.aws.dynamodb.Table(group, "schema", {
|
|
3844
3885
|
name: formatGlobalResourceName({
|
|
3845
3886
|
appName: ctx.app.name,
|
|
@@ -3929,7 +3970,7 @@ var rpcFeature = defineFeature({
|
|
|
3929
3970
|
const certificateArn = props.domain ? ctx.shared.entry("domain", `global-certificate-arn`, props.domain) : void 0;
|
|
3930
3971
|
const cache = new $13.aws.cloudfront.CachePolicy(group, "cache", {
|
|
3931
3972
|
name,
|
|
3932
|
-
minTtl: toSeconds5(
|
|
3973
|
+
minTtl: toSeconds5(seconds6(1)),
|
|
3933
3974
|
maxTtl: toSeconds5(days4(365)),
|
|
3934
3975
|
defaultTtl: toSeconds5(days4(1))
|
|
3935
3976
|
});
|
|
@@ -4141,10 +4182,10 @@ var searchFeature = defineFeature({
|
|
|
4141
4182
|
});
|
|
4142
4183
|
|
|
4143
4184
|
// src/feature/site/index.ts
|
|
4144
|
-
import { days as days5, seconds as
|
|
4185
|
+
import { days as days5, seconds as seconds7, toSeconds as toSeconds6 } from "@awsless/duration";
|
|
4145
4186
|
import { $ as $15, Group as Group15 } from "@awsless/formation";
|
|
4146
4187
|
import { glob as glob2 } from "glob";
|
|
4147
|
-
import { join as join11 } from "path";
|
|
4188
|
+
import { dirname as dirname6, join as join11 } from "path";
|
|
4148
4189
|
|
|
4149
4190
|
// src/feature/site/util.ts
|
|
4150
4191
|
import { contentType, lookup } from "mime-types";
|
|
@@ -4179,6 +4220,7 @@ var getForwardHostFunctionCode = () => {
|
|
|
4179
4220
|
|
|
4180
4221
|
// src/feature/site/index.ts
|
|
4181
4222
|
import { camelCase as camelCase6, constantCase as constantCase10 } from "change-case";
|
|
4223
|
+
import { exec } from "promisify-child-process";
|
|
4182
4224
|
var siteFeature = defineFeature({
|
|
4183
4225
|
name: "site",
|
|
4184
4226
|
onStack(ctx) {
|
|
@@ -4190,6 +4232,20 @@ var siteFeature = defineFeature({
|
|
|
4190
4232
|
resourceType: "site",
|
|
4191
4233
|
resourceName: id
|
|
4192
4234
|
});
|
|
4235
|
+
if (props.build) {
|
|
4236
|
+
const buildProps = props.build;
|
|
4237
|
+
ctx.registerBuild("site", name, async (build3) => {
|
|
4238
|
+
const fingerprint = await generateCacheKey(buildProps.cacheKey);
|
|
4239
|
+
return build3(fingerprint, async (write) => {
|
|
4240
|
+
const cwd = join11(directories.root, dirname6(ctx.stackConfig.file));
|
|
4241
|
+
await exec(buildProps.command, { cwd });
|
|
4242
|
+
await write("HASH", fingerprint);
|
|
4243
|
+
return {
|
|
4244
|
+
size: "n/a"
|
|
4245
|
+
};
|
|
4246
|
+
});
|
|
4247
|
+
});
|
|
4248
|
+
}
|
|
4193
4249
|
const origins = [];
|
|
4194
4250
|
const originGroups = [];
|
|
4195
4251
|
let bucket;
|
|
@@ -4316,7 +4372,7 @@ var siteFeature = defineFeature({
|
|
|
4316
4372
|
}
|
|
4317
4373
|
const cache = new $15.aws.cloudfront.CachePolicy(group, "cache", {
|
|
4318
4374
|
name,
|
|
4319
|
-
minTtl: toSeconds6(
|
|
4375
|
+
minTtl: toSeconds6(seconds7(1)),
|
|
4320
4376
|
maxTtl: toSeconds6(days5(365)),
|
|
4321
4377
|
defaultTtl: toSeconds6(days5(1)),
|
|
4322
4378
|
parametersInCacheKeyAndForwardedToOrigin: {
|
|
@@ -5910,7 +5966,6 @@ var buildAssets = async (builders, stackFilters, showResult = false) => {
|
|
|
5910
5966
|
});
|
|
5911
5967
|
results.push({ ...builder, result });
|
|
5912
5968
|
} catch (error) {
|
|
5913
|
-
console.log(error);
|
|
5914
5969
|
logError(new Error(`Build failed for: ${builder.type} ${builder.name}`));
|
|
5915
5970
|
throw error;
|
|
5916
5971
|
}
|
|
@@ -6279,10 +6334,10 @@ var CustomReporter = class {
|
|
|
6279
6334
|
};
|
|
6280
6335
|
|
|
6281
6336
|
// src/test/start.ts
|
|
6282
|
-
import { swc
|
|
6337
|
+
import { swc } from "rollup-plugin-swc3";
|
|
6283
6338
|
import { configDefaults } from "vitest/config";
|
|
6284
6339
|
import { startVitest } from "vitest/node";
|
|
6285
|
-
import
|
|
6340
|
+
import commonjs from "@rollup/plugin-commonjs";
|
|
6286
6341
|
import nodeResolve2 from "@rollup/plugin-node-resolve";
|
|
6287
6342
|
import json2 from "@rollup/plugin-json";
|
|
6288
6343
|
import { dirname as dirname8, join as join13 } from "path";
|
|
@@ -6321,10 +6376,10 @@ var startTest = async (props) => {
|
|
|
6321
6376
|
{
|
|
6322
6377
|
plugins: [
|
|
6323
6378
|
// @ts-ignore
|
|
6324
|
-
|
|
6379
|
+
commonjs({ sourceMap: true }),
|
|
6325
6380
|
// @ts-ignore
|
|
6326
6381
|
nodeResolve2({ preferBuiltins: true }),
|
|
6327
|
-
|
|
6382
|
+
swc({
|
|
6328
6383
|
jsc: {
|
|
6329
6384
|
// baseUrl: dirname(input),
|
|
6330
6385
|
minify: { sourceMap: true }
|