@awsless/awsless 0.0.478 → 0.0.480
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/bin.js +370 -252
- package/dist/build-json-schema.js +20 -5
- package/dist/prebuild/rpc/bundle.zip +0 -0
- package/dist/stack.json +1 -1
- package/package.json +13 -13
package/dist/bin.js
CHANGED
|
@@ -47,6 +47,81 @@ import { mkdir, readFile, rm, writeFile } from "fs/promises";
|
|
|
47
47
|
import { homedir } from "os";
|
|
48
48
|
import { dirname, join as join2 } from "path";
|
|
49
49
|
|
|
50
|
+
// src/formation/cloudfront.ts
|
|
51
|
+
import { CloudFrontClient, CreateInvalidationCommand } from "@aws-sdk/client-cloudfront";
|
|
52
|
+
import { createCustomProvider, createCustomResourceClass } from "@awsless/formation";
|
|
53
|
+
import { z } from "zod";
|
|
54
|
+
var Invalidation = createCustomResourceClass(
|
|
55
|
+
"cloudfront",
|
|
56
|
+
"invalidation"
|
|
57
|
+
);
|
|
58
|
+
var createCloudFrontProvider = ({ profile, region }) => {
|
|
59
|
+
const cloudFront = new CloudFrontClient({ profile, region });
|
|
60
|
+
return createCustomProvider("cloudfront", {
|
|
61
|
+
invalidation: {
|
|
62
|
+
async updateResource(props) {
|
|
63
|
+
const state2 = z.object({
|
|
64
|
+
distributionId: z.string(),
|
|
65
|
+
paths: z.string().array().min(1)
|
|
66
|
+
}).parse(props.proposedState);
|
|
67
|
+
const result = await cloudFront.send(
|
|
68
|
+
new CreateInvalidationCommand({
|
|
69
|
+
DistributionId: state2.distributionId,
|
|
70
|
+
InvalidationBatch: {
|
|
71
|
+
Paths: {
|
|
72
|
+
Quantity: state2.paths.length,
|
|
73
|
+
Items: state2.paths
|
|
74
|
+
},
|
|
75
|
+
CallerReference: props.idempotantToken
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
);
|
|
79
|
+
return {
|
|
80
|
+
...state2,
|
|
81
|
+
id: result.Invalidation?.Id
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
// src/formation/lambda.ts
|
|
89
|
+
import { LambdaClient, UpdateFunctionCodeCommand } from "@aws-sdk/client-lambda";
|
|
90
|
+
import { createCustomProvider as createCustomProvider2, createCustomResourceClass as createCustomResourceClass2 } from "@awsless/formation";
|
|
91
|
+
import { z as z2 } from "zod";
|
|
92
|
+
var UpdateFunctionCode = createCustomResourceClass2(
|
|
93
|
+
"lambda",
|
|
94
|
+
"update-function-code"
|
|
95
|
+
);
|
|
96
|
+
var createLambdaProvider = ({ credentials, region }) => {
|
|
97
|
+
const lambda = new LambdaClient({ credentials, region });
|
|
98
|
+
return createCustomProvider2("lambda", {
|
|
99
|
+
"update-function-code": {
|
|
100
|
+
async updateResource(props) {
|
|
101
|
+
const state2 = z2.object({
|
|
102
|
+
functionName: z2.string(),
|
|
103
|
+
architectures: z2.string().array(),
|
|
104
|
+
s3Bucket: z2.string().optional().transform((v) => v ? v : void 0),
|
|
105
|
+
s3Key: z2.string().optional().transform((v) => v ? v : void 0),
|
|
106
|
+
s3ObjectVersion: z2.string().optional().transform((v) => v ? v : void 0),
|
|
107
|
+
imageUri: z2.string().optional().transform((v) => v ? v : void 0)
|
|
108
|
+
}).parse(props.proposedState);
|
|
109
|
+
await lambda.send(
|
|
110
|
+
new UpdateFunctionCodeCommand({
|
|
111
|
+
FunctionName: state2.functionName,
|
|
112
|
+
Architectures: state2.architectures,
|
|
113
|
+
ImageUri: state2.imageUri,
|
|
114
|
+
S3Bucket: state2.s3Bucket,
|
|
115
|
+
S3Key: state2.s3Key,
|
|
116
|
+
S3ObjectVersion: state2.s3ObjectVersion
|
|
117
|
+
})
|
|
118
|
+
);
|
|
119
|
+
return state2;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
|
|
50
125
|
// src/util/path.ts
|
|
51
126
|
import { lstat } from "fs/promises";
|
|
52
127
|
import { join, normalize, relative } from "path";
|
|
@@ -130,6 +205,8 @@ var createWorkSpace = async (props) => {
|
|
|
130
205
|
const aws = await terraform.install("hashicorp", "aws", "5.94.1");
|
|
131
206
|
const workspace = new WorkSpace({
|
|
132
207
|
providers: [
|
|
208
|
+
createLambdaProvider(props),
|
|
209
|
+
createCloudFrontProvider(props),
|
|
133
210
|
aws(
|
|
134
211
|
{
|
|
135
212
|
profile: props.profile,
|
|
@@ -414,21 +491,21 @@ var debug = (...parts) => {
|
|
|
414
491
|
};
|
|
415
492
|
|
|
416
493
|
// src/config/app.ts
|
|
417
|
-
import { z as
|
|
494
|
+
import { z as z23 } from "zod";
|
|
418
495
|
|
|
419
496
|
// src/feature/alert/schema.ts
|
|
420
497
|
import { kebabCase } from "change-case";
|
|
421
|
-
import { z as
|
|
498
|
+
import { z as z4 } from "zod";
|
|
422
499
|
|
|
423
500
|
// src/config/schema/email.ts
|
|
424
|
-
import { z } from "zod";
|
|
425
|
-
var EmailSchema =
|
|
501
|
+
import { z as z3 } from "zod";
|
|
502
|
+
var EmailSchema = z3.string().email();
|
|
426
503
|
|
|
427
504
|
// src/feature/alert/schema.ts
|
|
428
|
-
var AlertNameSchema =
|
|
429
|
-
var AlertsDefaultSchema =
|
|
505
|
+
var AlertNameSchema = z4.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid alert name").transform((value) => kebabCase(value)).describe("Define alert name.");
|
|
506
|
+
var AlertsDefaultSchema = z4.record(
|
|
430
507
|
AlertNameSchema,
|
|
431
|
-
|
|
508
|
+
z4.union([
|
|
432
509
|
//
|
|
433
510
|
EmailSchema.transform((v) => [v]),
|
|
434
511
|
EmailSchema.array()
|
|
@@ -436,17 +513,17 @@ var AlertsDefaultSchema = z2.record(
|
|
|
436
513
|
).optional().describe("Define the alerts in your app. Alerts are a way to send messages to one or more email addresses.");
|
|
437
514
|
|
|
438
515
|
// src/feature/auth/schema.ts
|
|
439
|
-
import { z as
|
|
516
|
+
import { z as z7 } from "zod";
|
|
440
517
|
|
|
441
518
|
// src/config/schema/resource-id.ts
|
|
442
519
|
import { kebabCase as kebabCase2 } from "change-case";
|
|
443
|
-
import { z as
|
|
444
|
-
var ResourceIdSchema =
|
|
520
|
+
import { z as z5 } from "zod";
|
|
521
|
+
var ResourceIdSchema = z5.string().min(3).max(24).regex(/^[a-z0-9\-]+$/i, "Invalid resource ID").transform((value) => kebabCase2(value));
|
|
445
522
|
|
|
446
523
|
// src/config/schema/duration.ts
|
|
447
524
|
import { parse } from "@awsless/duration";
|
|
448
|
-
import { z as
|
|
449
|
-
var DurationSchema =
|
|
525
|
+
import { z as z6 } from "zod";
|
|
526
|
+
var DurationSchema = z6.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?|weeks?)$/, "Invalid duration").transform((v) => parse(v));
|
|
450
527
|
var durationMin = (min) => {
|
|
451
528
|
return (duration) => {
|
|
452
529
|
return duration.value >= min.value;
|
|
@@ -459,10 +536,10 @@ var durationMax = (max) => {
|
|
|
459
536
|
};
|
|
460
537
|
|
|
461
538
|
// src/feature/auth/schema.ts
|
|
462
|
-
var AuthDefaultSchema =
|
|
539
|
+
var AuthDefaultSchema = z7.record(
|
|
463
540
|
ResourceIdSchema,
|
|
464
|
-
|
|
465
|
-
allowUserRegistration:
|
|
541
|
+
z7.object({
|
|
542
|
+
allowUserRegistration: z7.boolean().default(true).describe("Specifies whether users can create an user account or if only the administrator can."),
|
|
466
543
|
// messaging: z
|
|
467
544
|
// .object({
|
|
468
545
|
// fromEmail: EmailSchema.describe("Specifies the sender's email address."),
|
|
@@ -474,23 +551,23 @@ var AuthDefaultSchema = z5.record(
|
|
|
474
551
|
// .optional()
|
|
475
552
|
// .describe('The email configuration for sending messages.'),
|
|
476
553
|
// secret: z.boolean().default(false).describe('Specifies whether you want to generate a client secret.'),
|
|
477
|
-
username:
|
|
554
|
+
username: z7.object({
|
|
478
555
|
// emailAlias: z.boolean().default(true).describe('Allow the user email to be used as username.'),
|
|
479
|
-
caseSensitive:
|
|
556
|
+
caseSensitive: z7.boolean().default(false).describe(
|
|
480
557
|
"Specifies whether username case sensitivity will be enabled. When usernames and email addresses are case insensitive, users can sign in as the same user when they enter a different capitalization of their user name."
|
|
481
558
|
)
|
|
482
559
|
}).default({}).describe("The username policy."),
|
|
483
|
-
password:
|
|
484
|
-
minLength:
|
|
485
|
-
uppercase:
|
|
486
|
-
lowercase:
|
|
487
|
-
numbers:
|
|
488
|
-
symbols:
|
|
560
|
+
password: z7.object({
|
|
561
|
+
minLength: z7.number().int().min(6).max(99).default(12).describe("Required users to have at least the minimum password length."),
|
|
562
|
+
uppercase: z7.boolean().default(true).describe("Required users to use at least one uppercase letter in their password."),
|
|
563
|
+
lowercase: z7.boolean().default(true).describe("Required users to use at least one lowercase letter in their password."),
|
|
564
|
+
numbers: z7.boolean().default(true).describe("Required users to use at least one number in their password."),
|
|
565
|
+
symbols: z7.boolean().default(true).describe("Required users to use at least one symbol in their password."),
|
|
489
566
|
temporaryPasswordValidity: DurationSchema.default("7 days").describe(
|
|
490
567
|
"The duration a temporary password is valid. If the user doesn't sign in during this time, an administrator must reset their password."
|
|
491
568
|
)
|
|
492
569
|
}).default({}).describe("The password policy."),
|
|
493
|
-
validity:
|
|
570
|
+
validity: z7.object({
|
|
494
571
|
idToken: DurationSchema.default("1 hour").describe(
|
|
495
572
|
"The ID token time limit. After this limit expires, your user can't use their ID token."
|
|
496
573
|
),
|
|
@@ -506,18 +583,18 @@ var AuthDefaultSchema = z5.record(
|
|
|
506
583
|
).default({}).describe("Define the authenticatable users in your app.");
|
|
507
584
|
|
|
508
585
|
// src/feature/domain/schema.ts
|
|
509
|
-
import { z as
|
|
510
|
-
var DomainNameSchema =
|
|
586
|
+
import { z as z8 } from "zod";
|
|
587
|
+
var DomainNameSchema = z8.string().regex(/[a-z\-\_\.]/g, "Invalid domain name").describe(
|
|
511
588
|
"Enter a fully qualified domain name, for example, www.example.com. You can optionally include a trailing dot. If you omit the trailing dot, Amazon Route 53 assumes that the domain name that you specify is fully qualified. This means that Route 53 treats www.example.com (without a trailing dot) and www.example.com. (with a trailing dot) as identical."
|
|
512
589
|
);
|
|
513
|
-
var DNSTypeSchema =
|
|
590
|
+
var DNSTypeSchema = z8.enum(["A", "AAAA", "CAA", "CNAME", "DS", "MX", "NAPTR", "NS", "PTR", "SOA", "SPF", "SRV", "TXT"]).describe("The DNS record type.");
|
|
514
591
|
var TTLSchema = DurationSchema.describe("The resource record cache time to live (TTL).");
|
|
515
|
-
var RecordsSchema =
|
|
516
|
-
var DomainsDefaultSchema =
|
|
592
|
+
var RecordsSchema = z8.string().array().describe("One or more values that correspond with the value that you specified for the Type property.");
|
|
593
|
+
var DomainsDefaultSchema = z8.record(
|
|
517
594
|
ResourceIdSchema,
|
|
518
|
-
|
|
595
|
+
z8.object({
|
|
519
596
|
domain: DomainNameSchema.describe("Define the domain name"),
|
|
520
|
-
dns:
|
|
597
|
+
dns: z8.object({
|
|
521
598
|
name: DomainNameSchema.optional(),
|
|
522
599
|
type: DNSTypeSchema,
|
|
523
600
|
ttl: TTLSchema,
|
|
@@ -529,15 +606,15 @@ var DomainsDefaultSchema = z6.record(
|
|
|
529
606
|
// src/feature/function/schema.ts
|
|
530
607
|
import { days, minutes, seconds, toDays } from "@awsless/duration";
|
|
531
608
|
import { gibibytes, mebibytes } from "@awsless/size";
|
|
532
|
-
import { z as
|
|
609
|
+
import { z as z13 } from "zod";
|
|
533
610
|
|
|
534
611
|
// src/config/schema/local-directory.ts
|
|
535
612
|
import { stat } from "fs/promises";
|
|
536
|
-
import { z as
|
|
613
|
+
import { z as z10 } from "zod";
|
|
537
614
|
|
|
538
615
|
// src/config/schema/relative-path.ts
|
|
539
616
|
import { join as join3 } from "path";
|
|
540
|
-
import { z as
|
|
617
|
+
import { z as z9 } from "zod";
|
|
541
618
|
var basePath;
|
|
542
619
|
var setLocalBasePath = (path) => {
|
|
543
620
|
basePath = path;
|
|
@@ -548,10 +625,10 @@ var resolvePath = (path) => {
|
|
|
548
625
|
}
|
|
549
626
|
return path;
|
|
550
627
|
};
|
|
551
|
-
var RelativePathSchema =
|
|
628
|
+
var RelativePathSchema = z9.string().transform((path) => resolvePath(path));
|
|
552
629
|
|
|
553
630
|
// src/config/schema/local-directory.ts
|
|
554
|
-
var LocalDirectorySchema =
|
|
631
|
+
var LocalDirectorySchema = z10.union([
|
|
555
632
|
RelativePathSchema.refine(async (path) => {
|
|
556
633
|
try {
|
|
557
634
|
const s = await stat(path);
|
|
@@ -560,15 +637,15 @@ var LocalDirectorySchema = z8.union([
|
|
|
560
637
|
return false;
|
|
561
638
|
}
|
|
562
639
|
}, `Directory doesn't exist`),
|
|
563
|
-
|
|
564
|
-
nocheck:
|
|
640
|
+
z10.object({
|
|
641
|
+
nocheck: z10.string().describe("Specifies a local directory without checking if the directory exists.")
|
|
565
642
|
}).transform((v) => v.nocheck)
|
|
566
643
|
]);
|
|
567
644
|
|
|
568
645
|
// src/config/schema/local-file.ts
|
|
569
646
|
import { stat as stat2 } from "fs/promises";
|
|
570
|
-
import { z as
|
|
571
|
-
var LocalFileSchema =
|
|
647
|
+
import { z as z11 } from "zod";
|
|
648
|
+
var LocalFileSchema = z11.union([
|
|
572
649
|
RelativePathSchema.refine(async (path) => {
|
|
573
650
|
try {
|
|
574
651
|
const s = await stat2(path);
|
|
@@ -577,15 +654,15 @@ var LocalFileSchema = z9.union([
|
|
|
577
654
|
return false;
|
|
578
655
|
}
|
|
579
656
|
}, `File doesn't exist`),
|
|
580
|
-
|
|
581
|
-
nocheck:
|
|
657
|
+
z11.object({
|
|
658
|
+
nocheck: z11.string().describe("Specifies a local file without checking if the file exists.")
|
|
582
659
|
}).transform((v) => v.nocheck)
|
|
583
660
|
]);
|
|
584
661
|
|
|
585
662
|
// src/config/schema/size.ts
|
|
586
663
|
import { parse as parse2 } from "@awsless/size";
|
|
587
|
-
import { z as
|
|
588
|
-
var SizeSchema =
|
|
664
|
+
import { z as z12 } from "zod";
|
|
665
|
+
var SizeSchema = z12.string().regex(/^[0-9]+ (B|KB|MB|GB|TB|PB)$/, "Invalid size").transform((v) => parse2(v));
|
|
589
666
|
var sizeMin = (min) => {
|
|
590
667
|
return (size) => {
|
|
591
668
|
return size.value >= min.value;
|
|
@@ -608,32 +685,32 @@ var EphemeralStorageSizeSchema = SizeSchema.refine(
|
|
|
608
685
|
sizeMin(mebibytes(512)),
|
|
609
686
|
"Minimum ephemeral storage size is 512 MB"
|
|
610
687
|
).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.");
|
|
611
|
-
var ReservedConcurrentExecutionsSchema =
|
|
612
|
-
var EnvironmentSchema =
|
|
613
|
-
var ArchitectureSchema =
|
|
614
|
-
var RetryAttemptsSchema =
|
|
688
|
+
var ReservedConcurrentExecutionsSchema = z13.number().int().min(0).describe("The number of simultaneous executions to reserve for the function. You can specify a number from 0.");
|
|
689
|
+
var EnvironmentSchema = z13.record(z13.string(), z13.string()).optional().describe("Environment variable key-value pairs.");
|
|
690
|
+
var ArchitectureSchema = z13.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the function supports.");
|
|
691
|
+
var RetryAttemptsSchema = z13.number().int().min(0).max(2).describe(
|
|
615
692
|
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
|
|
616
693
|
);
|
|
617
|
-
var NodeRuntimeSchema =
|
|
618
|
-
var ContainerRuntimeSchema =
|
|
619
|
-
var RuntimeSchema = NodeRuntimeSchema.or(ContainerRuntimeSchema).or(
|
|
620
|
-
var ActionSchema =
|
|
621
|
-
var ActionsSchema =
|
|
622
|
-
var ArnSchema =
|
|
623
|
-
var WildcardSchema =
|
|
624
|
-
var ResourceSchema =
|
|
625
|
-
var ResourcesSchema =
|
|
626
|
-
var PermissionSchema =
|
|
627
|
-
effect:
|
|
694
|
+
var NodeRuntimeSchema = z13.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x"]);
|
|
695
|
+
var ContainerRuntimeSchema = z13.literal("container");
|
|
696
|
+
var RuntimeSchema = NodeRuntimeSchema.or(ContainerRuntimeSchema).or(z13.string()).describe("The identifier of the function's runtime.");
|
|
697
|
+
var ActionSchema = z13.string();
|
|
698
|
+
var ActionsSchema = z13.union([ActionSchema.transform((v) => [v]), ActionSchema.array()]);
|
|
699
|
+
var ArnSchema = z13.string().startsWith("arn:");
|
|
700
|
+
var WildcardSchema = z13.literal("*");
|
|
701
|
+
var ResourceSchema = z13.union([ArnSchema, WildcardSchema]);
|
|
702
|
+
var ResourcesSchema = z13.union([ResourceSchema.transform((v) => [v]), ResourceSchema.array()]);
|
|
703
|
+
var PermissionSchema = z13.object({
|
|
704
|
+
effect: z13.enum(["allow", "deny"]).default("allow"),
|
|
628
705
|
actions: ActionsSchema,
|
|
629
706
|
resources: ResourcesSchema
|
|
630
707
|
});
|
|
631
|
-
var PermissionsSchema =
|
|
632
|
-
var WarmSchema =
|
|
633
|
-
var VPCSchema =
|
|
634
|
-
var MinifySchema =
|
|
635
|
-
var HandlerSchema =
|
|
636
|
-
var DescriptionSchema =
|
|
708
|
+
var PermissionsSchema = z13.union([PermissionSchema.transform((v) => [v]), PermissionSchema.array()]).describe("Add IAM permissions to your function.");
|
|
709
|
+
var WarmSchema = z13.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.");
|
|
710
|
+
var VPCSchema = z13.boolean().describe("Put the function inside your global VPC.");
|
|
711
|
+
var MinifySchema = z13.boolean().describe("Minify the function code.");
|
|
712
|
+
var HandlerSchema = z13.string().describe("The name of the exported method within your code that Lambda calls to run your function.");
|
|
713
|
+
var DescriptionSchema = z13.string().describe("A description of the function.");
|
|
637
714
|
var validLogRetentionDays = [
|
|
638
715
|
...[1, 3, 5, 7, 14, 30, 60, 90, 120, 150],
|
|
639
716
|
...[180, 365, 400, 545, 731, 1096, 1827, 2192],
|
|
@@ -648,43 +725,43 @@ var LogRetentionSchema = DurationSchema.refine(
|
|
|
648
725
|
},
|
|
649
726
|
`Invalid log retention. Valid days are: ${validLogRetentionDays.map((days6) => `${days6}`).join(", ")}`
|
|
650
727
|
).describe("The log retention duration.");
|
|
651
|
-
var LogSchema =
|
|
652
|
-
|
|
728
|
+
var LogSchema = z13.union([
|
|
729
|
+
z13.boolean().transform((enabled) => ({ retention: enabled ? days(7) : days(0) })),
|
|
653
730
|
LogRetentionSchema.transform((retention) => ({ retention })),
|
|
654
|
-
|
|
731
|
+
z13.object({
|
|
655
732
|
// subscription: LogSubscriptionSchema.optional(),
|
|
656
733
|
retention: LogRetentionSchema.optional(),
|
|
657
|
-
format:
|
|
734
|
+
format: z13.enum(["text", "json"]).describe(
|
|
658
735
|
`The format in which Lambda sends your function's application and system logs to CloudWatch. Select between plain text and structured JSON.`
|
|
659
736
|
).optional(),
|
|
660
|
-
system:
|
|
737
|
+
system: z13.enum(["debug", "info", "warn"]).describe(
|
|
661
738
|
"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."
|
|
662
739
|
).optional(),
|
|
663
|
-
level:
|
|
740
|
+
level: z13.enum(["trace", "debug", "info", "warn", "error", "fatal"]).describe(
|
|
664
741
|
"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."
|
|
665
742
|
).optional()
|
|
666
743
|
})
|
|
667
744
|
]).describe("Enable logging to a CloudWatch log group. Providing a duration value will set the log retention time.");
|
|
668
|
-
var LayersSchema =
|
|
745
|
+
var LayersSchema = z13.string().array().describe(
|
|
669
746
|
// `A list of function layers to add to the function's execution environment..`
|
|
670
747
|
`A list of function layers to add to the function's execution environment. Specify each layer by its ARN, including the version.`
|
|
671
748
|
);
|
|
672
|
-
var FileCodeSchema =
|
|
749
|
+
var FileCodeSchema = z13.object({
|
|
673
750
|
file: LocalFileSchema.describe("The file path of the function code."),
|
|
674
751
|
minify: MinifySchema.optional().default(true),
|
|
675
|
-
external:
|
|
752
|
+
external: z13.string().array().optional().describe(`A list of external packages that won't be included in the bundle.`)
|
|
676
753
|
});
|
|
677
|
-
var BundleCodeSchema =
|
|
754
|
+
var BundleCodeSchema = z13.object({
|
|
678
755
|
bundle: LocalDirectorySchema.describe("The directory that needs to be bundled.")
|
|
679
756
|
});
|
|
680
|
-
var CodeSchema =
|
|
757
|
+
var CodeSchema = z13.union([
|
|
681
758
|
LocalFileSchema.transform((file) => ({
|
|
682
759
|
file
|
|
683
760
|
})).pipe(FileCodeSchema),
|
|
684
761
|
FileCodeSchema,
|
|
685
762
|
BundleCodeSchema
|
|
686
763
|
]).describe("Specify the code of your function.");
|
|
687
|
-
var FnSchema =
|
|
764
|
+
var FnSchema = z13.object({
|
|
688
765
|
code: CodeSchema,
|
|
689
766
|
// node
|
|
690
767
|
handler: HandlerSchema.optional(),
|
|
@@ -707,14 +784,14 @@ var FnSchema = z11.object({
|
|
|
707
784
|
environment: EnvironmentSchema.optional(),
|
|
708
785
|
permissions: PermissionsSchema.optional()
|
|
709
786
|
});
|
|
710
|
-
var FunctionSchema =
|
|
787
|
+
var FunctionSchema = z13.union([
|
|
711
788
|
LocalFileSchema.transform((code) => ({
|
|
712
789
|
code
|
|
713
790
|
})).pipe(FnSchema),
|
|
714
791
|
FnSchema
|
|
715
792
|
]);
|
|
716
|
-
var FunctionsSchema =
|
|
717
|
-
var FunctionDefaultSchema =
|
|
793
|
+
var FunctionsSchema = z13.record(ResourceIdSchema, FunctionSchema).optional().describe("Define the functions in your stack.");
|
|
794
|
+
var FunctionDefaultSchema = z13.object({
|
|
718
795
|
runtime: RuntimeSchema.default("nodejs20.x"),
|
|
719
796
|
// node
|
|
720
797
|
handler: HandlerSchema.default("index.default"),
|
|
@@ -743,25 +820,25 @@ var FunctionDefaultSchema = z11.object({
|
|
|
743
820
|
}).default({});
|
|
744
821
|
|
|
745
822
|
// src/feature/layer/schema.ts
|
|
746
|
-
import { z as
|
|
823
|
+
import { z as z15 } from "zod";
|
|
747
824
|
|
|
748
825
|
// src/config/schema/lambda.ts
|
|
749
|
-
import { z as
|
|
750
|
-
var ArchitectureSchema2 =
|
|
751
|
-
var NodeRuntimeSchema2 =
|
|
826
|
+
import { z as z14 } from "zod";
|
|
827
|
+
var ArchitectureSchema2 = z14.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the function supports.");
|
|
828
|
+
var NodeRuntimeSchema2 = z14.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x"]).describe("The identifier of the function's runtime.");
|
|
752
829
|
|
|
753
830
|
// src/feature/layer/schema.ts
|
|
754
|
-
var Schema =
|
|
831
|
+
var Schema = z15.object({
|
|
755
832
|
file: LocalFileSchema,
|
|
756
833
|
runtimes: NodeRuntimeSchema2.array().optional(),
|
|
757
834
|
architecture: ArchitectureSchema2.optional(),
|
|
758
|
-
packages:
|
|
835
|
+
packages: z15.string().array().optional().describe(
|
|
759
836
|
"Define the package names that are available bundled in the layer. Those packages are not bundled while bundling the lambda."
|
|
760
837
|
)
|
|
761
838
|
});
|
|
762
|
-
var LayerSchema =
|
|
763
|
-
|
|
764
|
-
|
|
839
|
+
var LayerSchema = z15.record(
|
|
840
|
+
z15.string(),
|
|
841
|
+
z15.union([
|
|
765
842
|
LocalFileSchema.transform((file) => ({
|
|
766
843
|
file,
|
|
767
844
|
description: void 0
|
|
@@ -776,28 +853,28 @@ var OnFailureDefaultSchema = FunctionSchema.optional().describe(
|
|
|
776
853
|
);
|
|
777
854
|
|
|
778
855
|
// src/feature/on-log/schema.ts
|
|
779
|
-
import { z as
|
|
780
|
-
var FilterSchema =
|
|
781
|
-
var OnLogDefaultSchema =
|
|
856
|
+
import { z as z16 } from "zod";
|
|
857
|
+
var FilterSchema = z16.enum(["trace", "debug", "info", "warn", "error", "fatal"]).array().describe("The log level that will gets delivered to the consumer.");
|
|
858
|
+
var OnLogDefaultSchema = z16.union([
|
|
782
859
|
FunctionSchema.transform((consumer) => ({
|
|
783
860
|
consumer,
|
|
784
861
|
filter: ["error", "fatal"]
|
|
785
862
|
})),
|
|
786
|
-
|
|
863
|
+
z16.object({
|
|
787
864
|
consumer: FunctionSchema,
|
|
788
865
|
filter: FilterSchema
|
|
789
866
|
})
|
|
790
867
|
]).optional().describe("Define a subscription on all Lambda functions logs.");
|
|
791
868
|
|
|
792
869
|
// src/feature/pubsub/schema.ts
|
|
793
|
-
import { z as
|
|
870
|
+
import { z as z17 } from "zod";
|
|
794
871
|
var DomainSchema = ResourceIdSchema.describe("The domain id to link your Pubsub API with.");
|
|
795
|
-
var PubSubDefaultSchema =
|
|
872
|
+
var PubSubDefaultSchema = z17.record(
|
|
796
873
|
ResourceIdSchema,
|
|
797
|
-
|
|
874
|
+
z17.object({
|
|
798
875
|
auth: FunctionSchema,
|
|
799
876
|
domain: DomainSchema.optional(),
|
|
800
|
-
subDomain:
|
|
877
|
+
subDomain: z17.string().optional()
|
|
801
878
|
// auth: z.union([
|
|
802
879
|
// ResourceIdSchema,
|
|
803
880
|
// z.object({
|
|
@@ -813,11 +890,11 @@ var PubSubDefaultSchema = z15.record(
|
|
|
813
890
|
// .optional(),
|
|
814
891
|
})
|
|
815
892
|
).optional().describe("Define the pubsub subscriber in your stack.");
|
|
816
|
-
var PubSubSchema =
|
|
893
|
+
var PubSubSchema = z17.record(
|
|
817
894
|
ResourceIdSchema,
|
|
818
|
-
|
|
819
|
-
sql:
|
|
820
|
-
sqlVersion:
|
|
895
|
+
z17.object({
|
|
896
|
+
sql: z17.string().describe("The SQL statement used to query the IOT topic."),
|
|
897
|
+
sqlVersion: z17.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."),
|
|
821
898
|
consumer: FunctionSchema.describe("The consuming lambda function properties.")
|
|
822
899
|
})
|
|
823
900
|
).optional().describe("Define the pubsub subscriber in your stack.");
|
|
@@ -825,7 +902,7 @@ var PubSubSchema = z15.record(
|
|
|
825
902
|
// src/feature/queue/schema.ts
|
|
826
903
|
import { days as days2, hours, minutes as minutes2, seconds as seconds2 } from "@awsless/duration";
|
|
827
904
|
import { kibibytes } from "@awsless/size";
|
|
828
|
-
import { z as
|
|
905
|
+
import { z as z18 } from "zod";
|
|
829
906
|
var RetentionPeriodSchema = DurationSchema.refine(
|
|
830
907
|
durationMin(minutes2(1)),
|
|
831
908
|
"Minimum retention period is 1 minute"
|
|
@@ -853,10 +930,10 @@ var ReceiveMessageWaitTimeSchema = DurationSchema.refine(
|
|
|
853
930
|
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(
|
|
854
931
|
"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."
|
|
855
932
|
);
|
|
856
|
-
var BatchSizeSchema =
|
|
933
|
+
var BatchSizeSchema = z18.number().int().min(1, "Minimum batch size is 1").max(1e4, "Maximum batch size is 10000").describe(
|
|
857
934
|
"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."
|
|
858
935
|
);
|
|
859
|
-
var MaxConcurrencySchema =
|
|
936
|
+
var MaxConcurrencySchema = z18.number().int().min(2, "Minimum max concurrency is 2").max(1e3, "Maximum max concurrency is 1000").describe(
|
|
860
937
|
"Limits the number of concurrent instances that the queue worker can invoke. You can specify an integer from 2 to 1000."
|
|
861
938
|
);
|
|
862
939
|
var MaxBatchingWindow = DurationSchema.refine(
|
|
@@ -865,7 +942,7 @@ var MaxBatchingWindow = DurationSchema.refine(
|
|
|
865
942
|
).describe(
|
|
866
943
|
"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."
|
|
867
944
|
);
|
|
868
|
-
var QueueDefaultSchema =
|
|
945
|
+
var QueueDefaultSchema = z18.object({
|
|
869
946
|
retentionPeriod: RetentionPeriodSchema.default("7 days"),
|
|
870
947
|
visibilityTimeout: VisibilityTimeoutSchema.default("30 seconds"),
|
|
871
948
|
deliveryDelay: DeliveryDelaySchema.default("0 seconds"),
|
|
@@ -875,7 +952,7 @@ var QueueDefaultSchema = z16.object({
|
|
|
875
952
|
maxConcurrency: MaxConcurrencySchema.optional(),
|
|
876
953
|
maxBatchingWindow: MaxBatchingWindow.optional()
|
|
877
954
|
}).default({});
|
|
878
|
-
var QueueSchema =
|
|
955
|
+
var QueueSchema = z18.object({
|
|
879
956
|
consumer: FunctionSchema.describe("The consuming lambda function properties."),
|
|
880
957
|
retentionPeriod: RetentionPeriodSchema.optional(),
|
|
881
958
|
visibilityTimeout: VisibilityTimeoutSchema.optional(),
|
|
@@ -886,9 +963,9 @@ var QueueSchema = z16.object({
|
|
|
886
963
|
maxConcurrency: MaxConcurrencySchema.optional(),
|
|
887
964
|
maxBatchingWindow: MaxBatchingWindow.optional()
|
|
888
965
|
});
|
|
889
|
-
var QueuesSchema =
|
|
966
|
+
var QueuesSchema = z18.record(
|
|
890
967
|
ResourceIdSchema,
|
|
891
|
-
|
|
968
|
+
z18.union([
|
|
892
969
|
LocalFileSchema.transform((consumer) => ({
|
|
893
970
|
consumer
|
|
894
971
|
})).pipe(QueueSchema),
|
|
@@ -897,26 +974,26 @@ var QueuesSchema = z16.record(
|
|
|
897
974
|
).optional().describe("Define the queues in your stack.");
|
|
898
975
|
|
|
899
976
|
// src/feature/rest/schema.ts
|
|
900
|
-
import { z as
|
|
977
|
+
import { z as z20 } from "zod";
|
|
901
978
|
|
|
902
979
|
// src/config/schema/route.ts
|
|
903
|
-
import { z as
|
|
904
|
-
var RouteSchema =
|
|
905
|
-
|
|
906
|
-
|
|
980
|
+
import { z as z19 } from "zod";
|
|
981
|
+
var RouteSchema = z19.union([
|
|
982
|
+
z19.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS|ANY)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route"),
|
|
983
|
+
z19.literal("$default")
|
|
907
984
|
]);
|
|
908
985
|
|
|
909
986
|
// src/feature/rest/schema.ts
|
|
910
|
-
var RestDefaultSchema =
|
|
987
|
+
var RestDefaultSchema = z20.record(
|
|
911
988
|
ResourceIdSchema,
|
|
912
|
-
|
|
989
|
+
z20.object({
|
|
913
990
|
domain: ResourceIdSchema.describe("The domain id to link your API with.").optional(),
|
|
914
|
-
subDomain:
|
|
991
|
+
subDomain: z20.string().optional()
|
|
915
992
|
})
|
|
916
993
|
).optional().describe("Define your global REST API's.");
|
|
917
|
-
var RestSchema =
|
|
994
|
+
var RestSchema = z20.record(
|
|
918
995
|
ResourceIdSchema,
|
|
919
|
-
|
|
996
|
+
z20.record(
|
|
920
997
|
RouteSchema.describe(
|
|
921
998
|
[
|
|
922
999
|
"The REST API route that is comprised by the http method and http path.",
|
|
@@ -929,7 +1006,7 @@ var RestSchema = z18.record(
|
|
|
929
1006
|
).optional().describe("Define routes in your stack for your global REST API.");
|
|
930
1007
|
|
|
931
1008
|
// src/feature/rpc/schema.ts
|
|
932
|
-
import { z as
|
|
1009
|
+
import { z as z21 } from "zod";
|
|
933
1010
|
import { minutes as minutes3, seconds as seconds3 } from "@awsless/duration";
|
|
934
1011
|
var TimeoutSchema2 = DurationSchema.refine(durationMin(seconds3(10)), "Minimum timeout duration is 10 seconds").refine(durationMax(minutes3(5)), "Maximum timeout duration is 5 minutes").describe(
|
|
935
1012
|
[
|
|
@@ -938,21 +1015,21 @@ var TimeoutSchema2 = DurationSchema.refine(durationMin(seconds3(10)), "Minimum t
|
|
|
938
1015
|
"The timeouts of all inner RPC functions will be capped at 80% of this timeout."
|
|
939
1016
|
].join(" ")
|
|
940
1017
|
);
|
|
941
|
-
var RpcDefaultSchema =
|
|
1018
|
+
var RpcDefaultSchema = z21.record(
|
|
942
1019
|
ResourceIdSchema,
|
|
943
|
-
|
|
1020
|
+
z21.object({
|
|
944
1021
|
domain: ResourceIdSchema.describe("The domain id to link your RPC API with.").optional(),
|
|
945
|
-
subDomain:
|
|
1022
|
+
subDomain: z21.string().optional(),
|
|
946
1023
|
auth: FunctionSchema.optional(),
|
|
947
1024
|
log: LogSchema.optional(),
|
|
948
1025
|
timeout: TimeoutSchema2.default("1 minutes"),
|
|
949
|
-
geoRestrictions:
|
|
1026
|
+
geoRestrictions: z21.array(z21.string().length(2).toUpperCase()).default([]).describe("Specifies a blacklist of countries that should be blocked.")
|
|
950
1027
|
})
|
|
951
1028
|
).describe(`Define the global RPC API's.`).optional();
|
|
952
|
-
var RpcSchema =
|
|
1029
|
+
var RpcSchema = z21.record(ResourceIdSchema, z21.record(z21.string(), FunctionSchema).describe("The queries for your global RPC API.")).describe("Define the schema in your stack for your global RPC API.").optional();
|
|
953
1030
|
|
|
954
1031
|
// src/config/schema/region.ts
|
|
955
|
-
import { z as
|
|
1032
|
+
import { z as z22 } from "zod";
|
|
956
1033
|
var US = ["us-east-2", "us-east-1", "us-west-1", "us-west-2"];
|
|
957
1034
|
var AF = ["af-south-1"];
|
|
958
1035
|
var AP = [
|
|
@@ -981,16 +1058,16 @@ var EU = [
|
|
|
981
1058
|
var ME = ["me-south-1", "me-central-1"];
|
|
982
1059
|
var SA = ["sa-east-1"];
|
|
983
1060
|
var regions = [...US, ...AF, ...AP, ...CA, ...EU, ...ME, ...SA];
|
|
984
|
-
var RegionSchema =
|
|
1061
|
+
var RegionSchema = z22.enum(regions);
|
|
985
1062
|
|
|
986
1063
|
// src/config/app.ts
|
|
987
|
-
var AppSchema =
|
|
988
|
-
$schema:
|
|
1064
|
+
var AppSchema = z23.object({
|
|
1065
|
+
$schema: z23.string().optional(),
|
|
989
1066
|
name: ResourceIdSchema.describe("App name."),
|
|
990
1067
|
region: RegionSchema.describe("The AWS region to deploy to."),
|
|
991
|
-
profile:
|
|
992
|
-
protect:
|
|
993
|
-
removal:
|
|
1068
|
+
profile: z23.string().describe("The AWS profile to deploy to."),
|
|
1069
|
+
protect: z23.boolean().default(false).describe("Protect your app & stacks from being deleted."),
|
|
1070
|
+
removal: z23.enum(["remove", "retain"]).default("remove").describe(
|
|
994
1071
|
[
|
|
995
1072
|
"Configure how your resources are handled when they have to be removed.",
|
|
996
1073
|
"",
|
|
@@ -1004,7 +1081,7 @@ var AppSchema = z21.object({
|
|
|
1004
1081
|
// .default('prod')
|
|
1005
1082
|
// .describe('The deployment stage.'),
|
|
1006
1083
|
// onFailure: OnFailureSchema,
|
|
1007
|
-
defaults:
|
|
1084
|
+
defaults: z23.object({
|
|
1008
1085
|
onFailure: OnFailureDefaultSchema,
|
|
1009
1086
|
onLog: OnLogDefaultSchema,
|
|
1010
1087
|
auth: AuthDefaultSchema,
|
|
@@ -1026,11 +1103,11 @@ var AppSchema = z21.object({
|
|
|
1026
1103
|
});
|
|
1027
1104
|
|
|
1028
1105
|
// src/config/stack.ts
|
|
1029
|
-
import { z as
|
|
1106
|
+
import { z as z37 } from "zod";
|
|
1030
1107
|
|
|
1031
1108
|
// src/feature/cache/schema.ts
|
|
1032
1109
|
import { gibibytes as gibibytes2 } from "@awsless/size";
|
|
1033
|
-
import { z as
|
|
1110
|
+
import { z as z24 } from "zod";
|
|
1034
1111
|
var StorageSchema = SizeSchema.refine(sizeMin(gibibytes2(1)), "Minimum storage size is 1 GB").refine(
|
|
1035
1112
|
sizeMax(gibibytes2(5e3)),
|
|
1036
1113
|
"Maximum storage size is 5000 GB"
|
|
@@ -1041,31 +1118,31 @@ var MinimumStorageSchema = StorageSchema.describe(
|
|
|
1041
1118
|
var MaximumStorageSchema = StorageSchema.describe(
|
|
1042
1119
|
"The upper limit for data storage the cache is set to use. You can specify a size value from 1 GB to 5000 GB."
|
|
1043
1120
|
);
|
|
1044
|
-
var EcpuSchema =
|
|
1121
|
+
var EcpuSchema = z24.number().int().min(1e3).max(15e6);
|
|
1045
1122
|
var MinimumEcpuSchema = EcpuSchema.describe(
|
|
1046
1123
|
"The minimum number of ECPUs the cache can consume per second. You can specify a integer from 1,000 to 15,000,000."
|
|
1047
1124
|
);
|
|
1048
1125
|
var MaximumEcpuSchema = EcpuSchema.describe(
|
|
1049
1126
|
"The maximum number of ECPUs the cache can consume per second. You can specify a integer from 1,000 to 15,000,000."
|
|
1050
1127
|
);
|
|
1051
|
-
var CachesSchema =
|
|
1128
|
+
var CachesSchema = z24.record(
|
|
1052
1129
|
ResourceIdSchema,
|
|
1053
|
-
|
|
1130
|
+
z24.object({
|
|
1054
1131
|
minStorage: MinimumStorageSchema.optional(),
|
|
1055
1132
|
maxStorage: MaximumStorageSchema.optional(),
|
|
1056
1133
|
minECPU: MinimumEcpuSchema.optional(),
|
|
1057
1134
|
maxECPU: MaximumEcpuSchema.optional(),
|
|
1058
|
-
snapshotRetentionLimit:
|
|
1135
|
+
snapshotRetentionLimit: z24.number().int().positive().default(1)
|
|
1059
1136
|
})
|
|
1060
1137
|
).optional().describe("Define the caches in your stack. For access to the cache put your functions inside the global VPC.");
|
|
1061
1138
|
|
|
1062
1139
|
// src/feature/command/schema.ts
|
|
1063
|
-
import { z as
|
|
1064
|
-
var CommandSchema =
|
|
1065
|
-
|
|
1140
|
+
import { z as z25 } from "zod";
|
|
1141
|
+
var CommandSchema = z25.union([
|
|
1142
|
+
z25.object({
|
|
1066
1143
|
file: LocalFileSchema,
|
|
1067
|
-
handler:
|
|
1068
|
-
description:
|
|
1144
|
+
handler: z25.string().default("default").describe("The name of the handler that needs to run"),
|
|
1145
|
+
description: z25.string().optional().describe("A description of the command")
|
|
1069
1146
|
// options: z.record(ResourceIdSchema, OptionSchema).optional(),
|
|
1070
1147
|
// arguments: z.record(ResourceIdSchema, ArgumentSchema).optional(),
|
|
1071
1148
|
}),
|
|
@@ -1075,22 +1152,22 @@ var CommandSchema = z23.union([
|
|
|
1075
1152
|
description: void 0
|
|
1076
1153
|
}))
|
|
1077
1154
|
]);
|
|
1078
|
-
var CommandsSchema =
|
|
1155
|
+
var CommandsSchema = z25.record(ResourceIdSchema, CommandSchema).optional().describe("Define the custom commands for your stack.");
|
|
1079
1156
|
|
|
1080
1157
|
// src/feature/config/schema.ts
|
|
1081
|
-
import { z as
|
|
1082
|
-
var ConfigNameSchema =
|
|
1083
|
-
var ConfigsSchema =
|
|
1158
|
+
import { z as z26 } from "zod";
|
|
1159
|
+
var ConfigNameSchema = z26.string().regex(/[a-z0-9\-]/g, "Invalid config name");
|
|
1160
|
+
var ConfigsSchema = z26.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
|
|
1084
1161
|
|
|
1085
1162
|
// src/feature/cron/schema/index.ts
|
|
1086
|
-
import { z as
|
|
1163
|
+
import { z as z28 } from "zod";
|
|
1087
1164
|
|
|
1088
1165
|
// src/feature/cron/schema/schedule.ts
|
|
1089
|
-
import { z as
|
|
1166
|
+
import { z as z27 } from "zod";
|
|
1090
1167
|
import { awsCronExpressionValidator } from "aws-cron-expression-validator";
|
|
1091
|
-
var RateExpressionSchema =
|
|
1168
|
+
var RateExpressionSchema = z27.custom(
|
|
1092
1169
|
(value) => {
|
|
1093
|
-
return
|
|
1170
|
+
return z27.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
|
|
1094
1171
|
const [str] = rate.split(" ");
|
|
1095
1172
|
const number = parseInt(str);
|
|
1096
1173
|
return number > 0;
|
|
@@ -1106,9 +1183,9 @@ var RateExpressionSchema = z25.custom(
|
|
|
1106
1183
|
}
|
|
1107
1184
|
return `rate(${rate})`;
|
|
1108
1185
|
});
|
|
1109
|
-
var CronExpressionSchema =
|
|
1186
|
+
var CronExpressionSchema = z27.custom(
|
|
1110
1187
|
(value) => {
|
|
1111
|
-
return
|
|
1188
|
+
return z27.string().safeParse(value).success;
|
|
1112
1189
|
},
|
|
1113
1190
|
{ message: "Invalid cron expression" }
|
|
1114
1191
|
).superRefine((value, ctx) => {
|
|
@@ -1117,12 +1194,12 @@ var CronExpressionSchema = z25.custom(
|
|
|
1117
1194
|
} catch (error) {
|
|
1118
1195
|
if (error instanceof Error) {
|
|
1119
1196
|
ctx.addIssue({
|
|
1120
|
-
code:
|
|
1197
|
+
code: z27.ZodIssueCode.custom,
|
|
1121
1198
|
message: `Invalid cron expression: ${error.message}`
|
|
1122
1199
|
});
|
|
1123
1200
|
} else {
|
|
1124
1201
|
ctx.addIssue({
|
|
1125
|
-
code:
|
|
1202
|
+
code: z27.ZodIssueCode.custom,
|
|
1126
1203
|
message: "Invalid cron expression"
|
|
1127
1204
|
});
|
|
1128
1205
|
}
|
|
@@ -1133,23 +1210,23 @@ var CronExpressionSchema = z25.custom(
|
|
|
1133
1210
|
var ScheduleExpressionSchema = RateExpressionSchema.or(CronExpressionSchema);
|
|
1134
1211
|
|
|
1135
1212
|
// src/feature/cron/schema/index.ts
|
|
1136
|
-
var CronsSchema =
|
|
1213
|
+
var CronsSchema = z28.record(
|
|
1137
1214
|
ResourceIdSchema,
|
|
1138
|
-
|
|
1139
|
-
enabled:
|
|
1215
|
+
z28.object({
|
|
1216
|
+
enabled: z28.boolean().default(true).describe("If the cron is enabled."),
|
|
1140
1217
|
consumer: FunctionSchema.describe("The consuming lambda function properties."),
|
|
1141
1218
|
schedule: ScheduleExpressionSchema.describe(
|
|
1142
1219
|
'The scheduling expression.\n\nexample: "0 20 * * ? *"\nexample: "5 minutes"'
|
|
1143
1220
|
),
|
|
1144
|
-
payload:
|
|
1221
|
+
payload: z28.unknown().optional().describe("The JSON payload that will be passed to the consumer.")
|
|
1145
1222
|
})
|
|
1146
1223
|
).optional().describe(`Define the cron jobs in your stack.`);
|
|
1147
1224
|
|
|
1148
1225
|
// src/feature/search/schema.ts
|
|
1149
1226
|
import { gibibytes as gibibytes3 } from "@awsless/size";
|
|
1150
|
-
import { z as
|
|
1151
|
-
var VersionSchema =
|
|
1152
|
-
var TypeSchema =
|
|
1227
|
+
import { z as z29 } from "zod";
|
|
1228
|
+
var VersionSchema = z29.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]);
|
|
1229
|
+
var TypeSchema = z29.enum([
|
|
1153
1230
|
"t3.small",
|
|
1154
1231
|
"t3.medium",
|
|
1155
1232
|
"m3.medium",
|
|
@@ -1224,11 +1301,11 @@ var TypeSchema = z27.enum([
|
|
|
1224
1301
|
"r6gd.16xlarge"
|
|
1225
1302
|
]);
|
|
1226
1303
|
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.");
|
|
1227
|
-
var SearchsSchema =
|
|
1304
|
+
var SearchsSchema = z29.record(
|
|
1228
1305
|
ResourceIdSchema,
|
|
1229
|
-
|
|
1306
|
+
z29.object({
|
|
1230
1307
|
type: TypeSchema.default("t3.small"),
|
|
1231
|
-
count:
|
|
1308
|
+
count: z29.number().int().min(1).default(1),
|
|
1232
1309
|
version: VersionSchema.default("2.13"),
|
|
1233
1310
|
storage: StorageSizeSchema.default("10 GB")
|
|
1234
1311
|
// vpc: z.boolean().default(false),
|
|
@@ -1236,12 +1313,12 @@ var SearchsSchema = z27.record(
|
|
|
1236
1313
|
).optional().describe("Define the search instances in your stack. Backed by OpenSearch.");
|
|
1237
1314
|
|
|
1238
1315
|
// src/feature/site/schema.ts
|
|
1239
|
-
import { z as
|
|
1316
|
+
import { z as z31 } from "zod";
|
|
1240
1317
|
|
|
1241
1318
|
// src/config/schema/local-entry.ts
|
|
1242
1319
|
import { stat as stat3 } from "fs/promises";
|
|
1243
|
-
import { z as
|
|
1244
|
-
var LocalEntrySchema =
|
|
1320
|
+
import { z as z30 } from "zod";
|
|
1321
|
+
var LocalEntrySchema = z30.union([
|
|
1245
1322
|
RelativePathSchema.refine(async (path) => {
|
|
1246
1323
|
try {
|
|
1247
1324
|
const s = await stat3(path);
|
|
@@ -1250,34 +1327,45 @@ var LocalEntrySchema = z28.union([
|
|
|
1250
1327
|
return false;
|
|
1251
1328
|
}
|
|
1252
1329
|
}, `File or directory doesn't exist`),
|
|
1253
|
-
|
|
1254
|
-
nocheck:
|
|
1330
|
+
z30.object({
|
|
1331
|
+
nocheck: z30.string().describe("Specifies a local file or directory without checking if the file or directory exists.")
|
|
1255
1332
|
}).transform((v) => v.nocheck)
|
|
1256
1333
|
]);
|
|
1257
1334
|
|
|
1258
1335
|
// src/feature/site/schema.ts
|
|
1259
|
-
var ErrorResponsePathSchema =
|
|
1260
|
-
|
|
1336
|
+
var ErrorResponsePathSchema = z31.string().describe(
|
|
1337
|
+
[
|
|
1338
|
+
"The path to the custom error page that you want to return to the viewer when your origin returns the HTTP status code specified.",
|
|
1339
|
+
"- We recommend that you store custom error pages in an Amazon S3 bucket.",
|
|
1340
|
+
"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."
|
|
1341
|
+
].join("\n")
|
|
1261
1342
|
);
|
|
1262
|
-
var StatusCodeSchema =
|
|
1263
|
-
|
|
1343
|
+
var StatusCodeSchema = z31.number().int().positive().optional().describe(
|
|
1344
|
+
[
|
|
1345
|
+
"The HTTP status code that you want CloudFront to return to the viewer along with the custom error page.",
|
|
1346
|
+
"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:",
|
|
1347
|
+
"- 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.",
|
|
1348
|
+
"If you substitute 200, the response typically won't be intercepted.",
|
|
1349
|
+
`- 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.`,
|
|
1350
|
+
`- You might want to return a 200 status code (OK) and static website so your customers don't know that your website is down.`
|
|
1351
|
+
].join("\n")
|
|
1264
1352
|
);
|
|
1265
1353
|
var MinTTLSchema = DurationSchema.describe(
|
|
1266
1354
|
"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."
|
|
1267
1355
|
);
|
|
1268
|
-
var ErrorResponseSchema =
|
|
1356
|
+
var ErrorResponseSchema = z31.union([
|
|
1269
1357
|
ErrorResponsePathSchema,
|
|
1270
|
-
|
|
1358
|
+
z31.object({
|
|
1271
1359
|
path: ErrorResponsePathSchema,
|
|
1272
1360
|
statusCode: StatusCodeSchema.optional(),
|
|
1273
1361
|
minTTL: MinTTLSchema.optional()
|
|
1274
1362
|
})
|
|
1275
1363
|
]).optional();
|
|
1276
|
-
var SitesSchema =
|
|
1364
|
+
var SitesSchema = z31.record(
|
|
1277
1365
|
ResourceIdSchema,
|
|
1278
|
-
|
|
1366
|
+
z31.object({
|
|
1279
1367
|
domain: ResourceIdSchema.describe("The domain id to link your site with.").optional(),
|
|
1280
|
-
subDomain:
|
|
1368
|
+
subDomain: z31.string().optional(),
|
|
1281
1369
|
// bind: z
|
|
1282
1370
|
// .object({
|
|
1283
1371
|
// auth: z.array(ResourceIdSchema),
|
|
@@ -1286,20 +1374,20 @@ var SitesSchema = z29.record(
|
|
|
1286
1374
|
// // rest: z.array(ResourceIdSchema),
|
|
1287
1375
|
// })
|
|
1288
1376
|
// .optional(),
|
|
1289
|
-
build:
|
|
1290
|
-
command:
|
|
1377
|
+
build: z31.object({
|
|
1378
|
+
command: z31.string().describe(
|
|
1291
1379
|
`Specifies the files and directories to generate the cache key for your custom build command.`
|
|
1292
1380
|
),
|
|
1293
|
-
cacheKey:
|
|
1381
|
+
cacheKey: z31.union([LocalEntrySchema.transform((v) => [v]), LocalEntrySchema.array()]).describe(
|
|
1294
1382
|
`Specifies the files and directories to generate the cache key for your custom build command.`
|
|
1295
1383
|
)
|
|
1296
1384
|
}).optional().describe(`Specifies the build process for sites that need a build step.`),
|
|
1297
|
-
static:
|
|
1385
|
+
static: z31.union([LocalDirectorySchema, z31.boolean()]).optional().describe(
|
|
1298
1386
|
"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."
|
|
1299
1387
|
),
|
|
1300
1388
|
ssr: FunctionSchema.optional().describe("Specifies the file that will render the site on the server."),
|
|
1301
1389
|
// envPrefix: z.string().optional().describe('Specifies a prefix for all '),
|
|
1302
|
-
origin:
|
|
1390
|
+
origin: z31.enum(["ssr-first", "static-first"]).default("static-first").describe("Specifies the origin fallback ordering."),
|
|
1303
1391
|
// bind: z.object({
|
|
1304
1392
|
// auth:
|
|
1305
1393
|
// h
|
|
@@ -1312,11 +1400,15 @@ var SitesSchema = z29.record(
|
|
|
1312
1400
|
// build: z.string().optional(),
|
|
1313
1401
|
// }),
|
|
1314
1402
|
// ]),
|
|
1315
|
-
geoRestrictions:
|
|
1316
|
-
forwardHost:
|
|
1317
|
-
|
|
1403
|
+
geoRestrictions: z31.array(z31.string().length(2).toUpperCase()).default([]).describe("Specifies a blacklist of countries that should be blocked."),
|
|
1404
|
+
forwardHost: z31.boolean().default(false).describe(
|
|
1405
|
+
[
|
|
1406
|
+
"Specify if the original `host` header should be forwarded to the SSR function.",
|
|
1407
|
+
"The original `host` header will be forwarded as `x-forwarded-host`.",
|
|
1408
|
+
"Keep in mind that this requires an extra CloudFront Function."
|
|
1409
|
+
].join("\n")
|
|
1318
1410
|
),
|
|
1319
|
-
errors:
|
|
1411
|
+
errors: z31.object({
|
|
1320
1412
|
400: ErrorResponseSchema.describe("Customize a `400 Bad Request` response."),
|
|
1321
1413
|
403: ErrorResponseSchema.describe("Customize a `403 Forbidden` response."),
|
|
1322
1414
|
404: ErrorResponseSchema.describe("Customize a `404 Not Found` response."),
|
|
@@ -1329,16 +1421,16 @@ var SitesSchema = z29.record(
|
|
|
1329
1421
|
503: ErrorResponseSchema.describe("Customize a `503 Service Unavailable` response."),
|
|
1330
1422
|
504: ErrorResponseSchema.describe("Customize a `504 Gateway Timeout` response.")
|
|
1331
1423
|
}).optional().describe("Customize the error responses for specific HTTP status codes."),
|
|
1332
|
-
cors:
|
|
1333
|
-
override:
|
|
1424
|
+
cors: z31.object({
|
|
1425
|
+
override: z31.boolean().default(false),
|
|
1334
1426
|
maxAge: DurationSchema.default("365 days"),
|
|
1335
|
-
exposeHeaders:
|
|
1336
|
-
credentials:
|
|
1337
|
-
headers:
|
|
1338
|
-
origins:
|
|
1339
|
-
methods:
|
|
1340
|
-
}).optional().describe("
|
|
1341
|
-
security:
|
|
1427
|
+
exposeHeaders: z31.string().array().optional(),
|
|
1428
|
+
credentials: z31.boolean().default(false),
|
|
1429
|
+
headers: z31.string().array().default(["*"]),
|
|
1430
|
+
origins: z31.string().array().default(["*"]),
|
|
1431
|
+
methods: z31.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
|
|
1432
|
+
}).optional().describe("Specify the cors headers."),
|
|
1433
|
+
security: z31.object({
|
|
1342
1434
|
// contentSecurityPolicy: z.object({
|
|
1343
1435
|
// override: z.boolean().default(false),
|
|
1344
1436
|
// policy: z.string(),
|
|
@@ -1379,11 +1471,11 @@ var SitesSchema = z29.record(
|
|
|
1379
1471
|
// modeBlock?: boolean
|
|
1380
1472
|
// reportUri?: string
|
|
1381
1473
|
// }
|
|
1382
|
-
}).optional().describe("
|
|
1383
|
-
cache:
|
|
1384
|
-
cookies:
|
|
1385
|
-
headers:
|
|
1386
|
-
queries:
|
|
1474
|
+
}).optional().describe("Specify the security policy."),
|
|
1475
|
+
cache: z31.object({
|
|
1476
|
+
cookies: z31.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
|
|
1477
|
+
headers: z31.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
|
|
1478
|
+
queries: z31.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
|
|
1387
1479
|
}).optional().describe(
|
|
1388
1480
|
"Specifies the cookies, headers, and query values that CloudFront includes in the cache key."
|
|
1389
1481
|
)
|
|
@@ -1391,22 +1483,22 @@ var SitesSchema = z29.record(
|
|
|
1391
1483
|
).optional().describe("Define the sites in your stack.");
|
|
1392
1484
|
|
|
1393
1485
|
// src/feature/store/schema.ts
|
|
1394
|
-
import { z as
|
|
1395
|
-
var StoresSchema =
|
|
1396
|
-
|
|
1486
|
+
import { z as z32 } from "zod";
|
|
1487
|
+
var StoresSchema = z32.union([
|
|
1488
|
+
z32.array(ResourceIdSchema).transform((list4) => {
|
|
1397
1489
|
const stores = {};
|
|
1398
1490
|
for (const key of list4) {
|
|
1399
1491
|
stores[key] = {};
|
|
1400
1492
|
}
|
|
1401
1493
|
return stores;
|
|
1402
1494
|
}),
|
|
1403
|
-
|
|
1495
|
+
z32.record(
|
|
1404
1496
|
ResourceIdSchema,
|
|
1405
|
-
|
|
1497
|
+
z32.object({
|
|
1406
1498
|
// cors: CorsSchema,
|
|
1407
1499
|
// deletionProtection: DeletionProtectionSchema.optional(),
|
|
1408
|
-
versioning:
|
|
1409
|
-
events:
|
|
1500
|
+
versioning: z32.boolean().default(false).describe("Enable versioning of your store."),
|
|
1501
|
+
events: z32.object({
|
|
1410
1502
|
// create
|
|
1411
1503
|
"created:*": FunctionSchema.optional().describe(
|
|
1412
1504
|
"Subscribe to notifications regardless of the API that was used to create an object."
|
|
@@ -1440,22 +1532,22 @@ var StoresSchema = z30.union([
|
|
|
1440
1532
|
|
|
1441
1533
|
// src/feature/table/schema.ts
|
|
1442
1534
|
import { minutes as minutes4, seconds as seconds4 } from "@awsless/duration";
|
|
1443
|
-
import { z as
|
|
1444
|
-
var KeySchema =
|
|
1445
|
-
var TablesSchema =
|
|
1535
|
+
import { z as z33 } from "zod";
|
|
1536
|
+
var KeySchema = z33.string().min(1).max(255);
|
|
1537
|
+
var TablesSchema = z33.record(
|
|
1446
1538
|
ResourceIdSchema,
|
|
1447
|
-
|
|
1539
|
+
z33.object({
|
|
1448
1540
|
hash: KeySchema.describe(
|
|
1449
1541
|
"Specifies the name of the partition / hash key that makes up the primary key for the table."
|
|
1450
1542
|
),
|
|
1451
1543
|
sort: KeySchema.optional().describe(
|
|
1452
1544
|
"Specifies the name of the range / sort key that makes up the primary key for the table."
|
|
1453
1545
|
),
|
|
1454
|
-
fields:
|
|
1546
|
+
fields: z33.record(z33.string(), z33.enum(["string", "number", "binary"])).optional().describe(
|
|
1455
1547
|
'A list of attributes that describe the key schema for the table and indexes. If no attribute field is defined we default to "string".'
|
|
1456
1548
|
),
|
|
1457
|
-
class:
|
|
1458
|
-
pointInTimeRecovery:
|
|
1549
|
+
class: z33.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
|
|
1550
|
+
pointInTimeRecovery: z33.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
|
|
1459
1551
|
ttl: KeySchema.optional().describe(
|
|
1460
1552
|
[
|
|
1461
1553
|
"The name of the TTL attribute used to store the expiration time for items in the table.",
|
|
@@ -1463,8 +1555,8 @@ var TablesSchema = z31.record(
|
|
|
1463
1555
|
].join("\n")
|
|
1464
1556
|
),
|
|
1465
1557
|
// deletionProtection: DeletionProtectionSchema.optional(),
|
|
1466
|
-
stream:
|
|
1467
|
-
type:
|
|
1558
|
+
stream: z33.object({
|
|
1559
|
+
type: z33.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
|
|
1468
1560
|
[
|
|
1469
1561
|
"When an item in the table is modified, you can determines what information is written to the stream for this table.",
|
|
1470
1562
|
"Valid values are:",
|
|
@@ -1474,7 +1566,7 @@ var TablesSchema = z31.record(
|
|
|
1474
1566
|
"- new-and-old-images - Both the new and the old item images of the item are written to the stream."
|
|
1475
1567
|
].join("\n")
|
|
1476
1568
|
),
|
|
1477
|
-
batchSize:
|
|
1569
|
+
batchSize: z33.number().min(1).max(1e4).default(1).describe(
|
|
1478
1570
|
[
|
|
1479
1571
|
"The maximum number of records in each batch that Lambda pulls from your stream and sends to your function.",
|
|
1480
1572
|
"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).",
|
|
@@ -1504,7 +1596,7 @@ var TablesSchema = z31.record(
|
|
|
1504
1596
|
// 'You can specify a number from -1 to 10000.',
|
|
1505
1597
|
// ].join('\n')
|
|
1506
1598
|
// ),
|
|
1507
|
-
retryAttempts:
|
|
1599
|
+
retryAttempts: z33.number().min(-1).max(1e4).default(-1).describe(
|
|
1508
1600
|
[
|
|
1509
1601
|
"Discard records after the specified number of retries.",
|
|
1510
1602
|
"The default value is -1, which sets the maximum number of retries to infinite.",
|
|
@@ -1512,7 +1604,7 @@ var TablesSchema = z31.record(
|
|
|
1512
1604
|
"You can specify a number from -1 to 10000."
|
|
1513
1605
|
].join("\n")
|
|
1514
1606
|
),
|
|
1515
|
-
concurrencyPerShard:
|
|
1607
|
+
concurrencyPerShard: z33.number().min(1).max(10).default(1).describe(
|
|
1516
1608
|
[
|
|
1517
1609
|
"The number of batches to process concurrently from each shard.",
|
|
1518
1610
|
"You can specify a number from 1 to 10."
|
|
@@ -1522,16 +1614,16 @@ var TablesSchema = z31.record(
|
|
|
1522
1614
|
}).optional().describe(
|
|
1523
1615
|
"The settings for the DynamoDB table stream, which capture changes to items stored in the table."
|
|
1524
1616
|
),
|
|
1525
|
-
indexes:
|
|
1526
|
-
|
|
1527
|
-
|
|
1617
|
+
indexes: z33.record(
|
|
1618
|
+
z33.string(),
|
|
1619
|
+
z33.object({
|
|
1528
1620
|
hash: KeySchema.describe(
|
|
1529
1621
|
"Specifies the name of the partition / hash key that makes up the primary key for the global secondary index."
|
|
1530
1622
|
),
|
|
1531
1623
|
sort: KeySchema.optional().describe(
|
|
1532
1624
|
"Specifies the name of the range / sort key that makes up the primary key for the global secondary index."
|
|
1533
1625
|
),
|
|
1534
|
-
projection:
|
|
1626
|
+
projection: z33.enum(["all", "keys-only"]).default("all").describe(
|
|
1535
1627
|
[
|
|
1536
1628
|
"The set of attributes that are projected into the index:",
|
|
1537
1629
|
"- all - All of the table attributes are projected into the index.",
|
|
@@ -1545,11 +1637,11 @@ var TablesSchema = z31.record(
|
|
|
1545
1637
|
).optional().describe("Define the tables in your stack.");
|
|
1546
1638
|
|
|
1547
1639
|
// src/feature/task/schema.ts
|
|
1548
|
-
import { z as
|
|
1549
|
-
var RetryAttemptsSchema2 =
|
|
1640
|
+
import { z as z34 } from "zod";
|
|
1641
|
+
var RetryAttemptsSchema2 = z34.number().int().min(0).max(2).describe(
|
|
1550
1642
|
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
|
|
1551
1643
|
);
|
|
1552
|
-
var TaskSchema =
|
|
1644
|
+
var TaskSchema = z34.union([
|
|
1553
1645
|
LocalFileSchema.transform((file) => ({
|
|
1554
1646
|
consumer: {
|
|
1555
1647
|
code: {
|
|
@@ -1560,33 +1652,33 @@ var TaskSchema = z32.union([
|
|
|
1560
1652
|
},
|
|
1561
1653
|
retryAttempts: void 0
|
|
1562
1654
|
})),
|
|
1563
|
-
|
|
1655
|
+
z34.object({
|
|
1564
1656
|
consumer: FunctionSchema,
|
|
1565
1657
|
retryAttempts: RetryAttemptsSchema2.optional()
|
|
1566
1658
|
})
|
|
1567
1659
|
]);
|
|
1568
|
-
var TasksSchema =
|
|
1660
|
+
var TasksSchema = z34.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
|
|
1569
1661
|
|
|
1570
1662
|
// src/feature/test/schema.ts
|
|
1571
|
-
import { z as
|
|
1572
|
-
var TestsSchema =
|
|
1663
|
+
import { z as z35 } from "zod";
|
|
1664
|
+
var TestsSchema = z35.union([LocalDirectorySchema.transform((v) => [v]), LocalDirectorySchema.array()]).describe("Define the location of your tests for your stack.").optional();
|
|
1573
1665
|
|
|
1574
1666
|
// src/feature/topic/schema.ts
|
|
1575
1667
|
import { kebabCase as kebabCase3 } from "change-case";
|
|
1576
|
-
import { z as
|
|
1577
|
-
var TopicNameSchema =
|
|
1578
|
-
var TopicsSchema =
|
|
1668
|
+
import { z as z36 } from "zod";
|
|
1669
|
+
var TopicNameSchema = z36.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => kebabCase3(value)).describe("Define event topic name.");
|
|
1670
|
+
var TopicsSchema = z36.array(TopicNameSchema).refine((topics) => {
|
|
1579
1671
|
return topics.length === new Set(topics).size;
|
|
1580
1672
|
}, "Must be a list of unique topic names").optional().describe("Define the event topics to publish too in your stack.");
|
|
1581
|
-
var SubscribersSchema =
|
|
1673
|
+
var SubscribersSchema = z36.record(TopicNameSchema, FunctionSchema).optional().describe("Define the event topics to subscribe too in your stack.");
|
|
1582
1674
|
|
|
1583
1675
|
// src/config/stack.ts
|
|
1584
1676
|
var DependsSchema = ResourceIdSchema.array().optional().describe("Define the stacks that this stack is depended on.");
|
|
1585
1677
|
var NameSchema = ResourceIdSchema.refine((name) => !["base", "hostedzones"].includes(name), {
|
|
1586
1678
|
message: `Stack name can't be a reserved name.`
|
|
1587
1679
|
}).describe("Stack name.");
|
|
1588
|
-
var StackSchema =
|
|
1589
|
-
$schema:
|
|
1680
|
+
var StackSchema = z37.object({
|
|
1681
|
+
$schema: z37.string().optional(),
|
|
1590
1682
|
name: NameSchema,
|
|
1591
1683
|
depends: DependsSchema,
|
|
1592
1684
|
commands: CommandsSchema,
|
|
@@ -1653,13 +1745,13 @@ var readConfigWithStage = async (file, stage) => {
|
|
|
1653
1745
|
};
|
|
1654
1746
|
|
|
1655
1747
|
// src/config/load/validate.ts
|
|
1656
|
-
import { z as
|
|
1748
|
+
import { z as z38 } from "zod";
|
|
1657
1749
|
var validateConfig = async (schema, file, data) => {
|
|
1658
1750
|
try {
|
|
1659
1751
|
const result = await schema.parseAsync(data);
|
|
1660
1752
|
return result;
|
|
1661
1753
|
} catch (error) {
|
|
1662
|
-
if (error instanceof
|
|
1754
|
+
if (error instanceof z38.ZodError) {
|
|
1663
1755
|
throw new ConfigError(file, error, data);
|
|
1664
1756
|
}
|
|
1665
1757
|
throw error;
|
|
@@ -4017,6 +4109,15 @@ var rpcFeature = defineFeature({
|
|
|
4017
4109
|
const authGroup = new Group13(group, "auth", "authorizer");
|
|
4018
4110
|
const auth2 = createLambdaFunction(authGroup, ctx, "rpc", `${id}-auth`, props.auth);
|
|
4019
4111
|
result.setEnvironment("AUTH", auth2.name);
|
|
4112
|
+
new UpdateFunctionCode(group, "update", {
|
|
4113
|
+
version: auth2.code.sourceHash,
|
|
4114
|
+
functionName: result.lambda.functionName,
|
|
4115
|
+
architectures: result.lambda.architectures,
|
|
4116
|
+
s3Bucket: result.lambda.s3Bucket,
|
|
4117
|
+
s3Key: result.lambda.s3Key,
|
|
4118
|
+
s3ObjectVersion: result.lambda.s3ObjectVersion,
|
|
4119
|
+
imageUri: result.lambda.imageUri
|
|
4120
|
+
});
|
|
4020
4121
|
}
|
|
4021
4122
|
const permission = new $13.aws.lambda.Permission(group, "permission", {
|
|
4022
4123
|
principal: "cloudfront.amazonaws.com",
|
|
@@ -4313,6 +4414,8 @@ var execCommand = async ({ cwd, command }) => {
|
|
|
4313
4414
|
};
|
|
4314
4415
|
|
|
4315
4416
|
// src/feature/site/index.ts
|
|
4417
|
+
import { createHash as createHash4 } from "crypto";
|
|
4418
|
+
import { Future as Future3 } from "@awsless/formation";
|
|
4316
4419
|
var siteFeature = defineFeature({
|
|
4317
4420
|
name: "site",
|
|
4318
4421
|
onStack(ctx) {
|
|
@@ -4347,10 +4450,9 @@ var siteFeature = defineFeature({
|
|
|
4347
4450
|
const versions = [];
|
|
4348
4451
|
if (props.ssr) {
|
|
4349
4452
|
const result = createLambdaFunction(group, ctx, `site`, id, props.ssr);
|
|
4350
|
-
|
|
4351
|
-
versions.push(result.code.versionId);
|
|
4352
|
-
}
|
|
4453
|
+
versions.push(result.code.sourceHash);
|
|
4353
4454
|
ctx.onBind((name2, value) => {
|
|
4455
|
+
console.log("--BIND--", name2, value);
|
|
4354
4456
|
result.setEnvironment(name2, value);
|
|
4355
4457
|
});
|
|
4356
4458
|
new $15.aws.lambda.Permission(group, "ssr-permission", {
|
|
@@ -4431,7 +4533,7 @@ var siteFeature = defineFeature({
|
|
|
4431
4533
|
ctx.onReady(() => {
|
|
4432
4534
|
if (typeof props.static === "string") {
|
|
4433
4535
|
const files = glob2.sync("**", {
|
|
4434
|
-
cwd: props.static,
|
|
4536
|
+
cwd: join11(directories.root, props.static),
|
|
4435
4537
|
nodir: true
|
|
4436
4538
|
});
|
|
4437
4539
|
for (const file of files) {
|
|
@@ -4440,11 +4542,11 @@ var siteFeature = defineFeature({
|
|
|
4440
4542
|
key: file,
|
|
4441
4543
|
cacheControl: getCacheControl(file),
|
|
4442
4544
|
contentType: getContentType(file),
|
|
4443
|
-
source: join11(props.static, file),
|
|
4444
|
-
sourceHash: $hash(join11(props.static, file))
|
|
4545
|
+
source: join11(directories.root, props.static, file),
|
|
4546
|
+
sourceHash: $hash(join11(directories.root, props.static, file))
|
|
4445
4547
|
});
|
|
4446
4548
|
versions.push(object.key);
|
|
4447
|
-
versions.push(object.
|
|
4549
|
+
versions.push(object.sourceHash);
|
|
4448
4550
|
}
|
|
4449
4551
|
}
|
|
4450
4552
|
});
|
|
@@ -4619,6 +4721,17 @@ var siteFeature = defineFeature({
|
|
|
4619
4721
|
cachedMethods: ["GET", "HEAD"]
|
|
4620
4722
|
}
|
|
4621
4723
|
});
|
|
4724
|
+
new Invalidation(group, "invalidate", {
|
|
4725
|
+
distributionId: distribution.id,
|
|
4726
|
+
paths: ["/*"],
|
|
4727
|
+
version: new Future3((resolve) => {
|
|
4728
|
+
$combine(...versions).then((versions2) => {
|
|
4729
|
+
const combined = versions2.filter((v) => !!v).sort().join(",");
|
|
4730
|
+
const version = createHash4("sha1").update(combined).digest("hex");
|
|
4731
|
+
resolve(version);
|
|
4732
|
+
});
|
|
4733
|
+
})
|
|
4734
|
+
});
|
|
4622
4735
|
if (props.static) {
|
|
4623
4736
|
new $15.aws.s3.BucketPolicy(
|
|
4624
4737
|
group,
|
|
@@ -6007,6 +6120,11 @@ var createApp = (props) => {
|
|
|
6007
6120
|
listener(env.name, env.value);
|
|
6008
6121
|
}
|
|
6009
6122
|
}
|
|
6123
|
+
for (const listener of bindListeners) {
|
|
6124
|
+
for (const { name, value } of binds) {
|
|
6125
|
+
listener(name, value);
|
|
6126
|
+
}
|
|
6127
|
+
}
|
|
6010
6128
|
for (const stackConfig of props.stackConfigs) {
|
|
6011
6129
|
const envListeners = allLocalEnvListeners[stackConfig.name];
|
|
6012
6130
|
const permissionCallbacks = allStackPermissionCallbacks[stackConfig.name];
|
|
@@ -6304,7 +6422,7 @@ import { join as join14 } from "path";
|
|
|
6304
6422
|
import wildstring3 from "wildstring";
|
|
6305
6423
|
|
|
6306
6424
|
// src/build/__fingerprint.ts
|
|
6307
|
-
import { createHash as
|
|
6425
|
+
import { createHash as createHash5 } from "crypto";
|
|
6308
6426
|
import { readdir as readdir4, readFile as readFile4, stat as stat4 } from "fs/promises";
|
|
6309
6427
|
import { basename as basename4, dirname as dirname8, extname as extname3, join as join12 } from "path";
|
|
6310
6428
|
import parseStaticImports from "parse-static-imports";
|
|
@@ -6315,7 +6433,7 @@ var generateFileHashes = async (file, hashes) => {
|
|
|
6315
6433
|
}
|
|
6316
6434
|
const code = await readModuleFile(file);
|
|
6317
6435
|
const deps = await findDependencies(file, code);
|
|
6318
|
-
const hash =
|
|
6436
|
+
const hash = createHash5("sha1").update(code).digest();
|
|
6319
6437
|
hashes.set(file, hash);
|
|
6320
6438
|
for (const dep of deps) {
|
|
6321
6439
|
if (dep.startsWith("/")) {
|
|
@@ -6332,7 +6450,7 @@ var fingerprintFromDirectory = async (dir) => {
|
|
|
6332
6450
|
}
|
|
6333
6451
|
}
|
|
6334
6452
|
const merge2 = Buffer.concat(Array.from(hashes.values()).sort());
|
|
6335
|
-
return
|
|
6453
|
+
return createHash5("sha1").update(merge2).digest("hex");
|
|
6336
6454
|
};
|
|
6337
6455
|
var readModuleFile = (file) => {
|
|
6338
6456
|
if (file.endsWith(".js")) {
|
|
@@ -6979,7 +7097,7 @@ var resources = (program2) => {
|
|
|
6979
7097
|
// src/cli/command/run.ts
|
|
6980
7098
|
import { DynamoDBClient, dynamoDBClient } from "@awsless/dynamodb";
|
|
6981
7099
|
import { iotClient, IoTDataPlaneClient } from "@awsless/iot";
|
|
6982
|
-
import { LambdaClient, lambdaClient } from "@awsless/lambda";
|
|
7100
|
+
import { LambdaClient as LambdaClient2, lambdaClient } from "@awsless/lambda";
|
|
6983
7101
|
import { S3Client as S3Client2, s3Client } from "@awsless/s3";
|
|
6984
7102
|
import { SNSClient, snsClient } from "@awsless/sns";
|
|
6985
7103
|
import { SQSClient, sqsClient } from "@awsless/sqs";
|
|
@@ -7026,7 +7144,7 @@ var run = (program2) => {
|
|
|
7026
7144
|
throw new ExpectedError(`No "${command.handler}" handler found.`);
|
|
7027
7145
|
}
|
|
7028
7146
|
dynamoDBClient.set(new DynamoDBClient({ region, credentials }));
|
|
7029
|
-
lambdaClient.set(new
|
|
7147
|
+
lambdaClient.set(new LambdaClient2({ region, credentials }));
|
|
7030
7148
|
snsClient.set(new SNSClient({ region, credentials }));
|
|
7031
7149
|
iotClient.set(new IoTDataPlaneClient({ region, credentials }));
|
|
7032
7150
|
sqsClient.set(new SQSClient({ region, credentials }));
|