@awsless/awsless 0.0.486 → 0.0.488
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 +390 -261
- package/dist/prebuild/rpc/bundle.zip +0 -0
- package/package.json +13 -11
package/dist/bin.js
CHANGED
|
@@ -47,22 +47,157 @@ 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 {
|
|
50
|
+
// src/formation/cloudfront-kvs.ts
|
|
51
|
+
import {
|
|
52
|
+
CloudFrontKeyValueStoreClient,
|
|
53
|
+
DescribeKeyValueStoreCommand,
|
|
54
|
+
ListKeysCommand,
|
|
55
|
+
UpdateKeysCommand
|
|
56
|
+
} from "@aws-sdk/client-cloudfront-keyvaluestore";
|
|
52
57
|
import { createCustomProvider, createCustomResourceClass } from "@awsless/formation";
|
|
58
|
+
import chunk from "chunk";
|
|
53
59
|
import { z } from "zod";
|
|
54
|
-
|
|
60
|
+
import "@aws-sdk/signature-v4-crt";
|
|
61
|
+
var ImportKeys = createCustomResourceClass("cloudfront-kvs", "import-keys");
|
|
62
|
+
var createCloudFrontKvsProvider = ({ profile, region }) => {
|
|
63
|
+
const client = new CloudFrontKeyValueStoreClient({ profile, region });
|
|
64
|
+
const validateInput = (state2) => {
|
|
65
|
+
return z.object({
|
|
66
|
+
kvsArn: z.string(),
|
|
67
|
+
keys: z.array(z.object({ key: z.string(), value: z.string() })),
|
|
68
|
+
eTag: z.string().optional()
|
|
69
|
+
}).parse(state2);
|
|
70
|
+
};
|
|
71
|
+
const formatOutput = (output) => {
|
|
72
|
+
return {
|
|
73
|
+
eTag: output.ETag,
|
|
74
|
+
itemCount: output.ItemCount,
|
|
75
|
+
totalSizeInBytes: output.TotalSizeInBytes
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
const bulkUpdate = async (props) => {
|
|
79
|
+
const batches = chunk(props.mutations, 50);
|
|
80
|
+
let prev = await client.send(
|
|
81
|
+
new DescribeKeyValueStoreCommand({
|
|
82
|
+
KvsARN: props.arn
|
|
83
|
+
})
|
|
84
|
+
);
|
|
85
|
+
let result;
|
|
86
|
+
let ifMatch = prev.ETag;
|
|
87
|
+
for (const mutations of batches) {
|
|
88
|
+
result = await client.send(
|
|
89
|
+
new UpdateKeysCommand({
|
|
90
|
+
KvsARN: props.arn,
|
|
91
|
+
IfMatch: ifMatch,
|
|
92
|
+
Puts: mutations.filter((item) => item.type === "put").map((item) => ({
|
|
93
|
+
Key: item.key,
|
|
94
|
+
Value: item.value
|
|
95
|
+
})),
|
|
96
|
+
Deletes: mutations.filter((item) => item.type === "delete").map((item) => ({
|
|
97
|
+
Key: item.key
|
|
98
|
+
}))
|
|
99
|
+
})
|
|
100
|
+
);
|
|
101
|
+
ifMatch = result.ETag;
|
|
102
|
+
}
|
|
103
|
+
return result;
|
|
104
|
+
};
|
|
105
|
+
return createCustomProvider("cloudfront-kvs", {
|
|
106
|
+
"import-keys": {
|
|
107
|
+
async getResource(props) {
|
|
108
|
+
const state2 = z.object({ kvsArn: z.string() }).parse(props.state);
|
|
109
|
+
const result = await client.send(
|
|
110
|
+
new DescribeKeyValueStoreCommand({
|
|
111
|
+
KvsARN: state2.kvsArn
|
|
112
|
+
})
|
|
113
|
+
);
|
|
114
|
+
const keys = [];
|
|
115
|
+
let nextToken;
|
|
116
|
+
while (true) {
|
|
117
|
+
const result2 = await client.send(
|
|
118
|
+
new ListKeysCommand({
|
|
119
|
+
KvsARN: state2.kvsArn,
|
|
120
|
+
NextToken: nextToken,
|
|
121
|
+
MaxResults: 50
|
|
122
|
+
})
|
|
123
|
+
);
|
|
124
|
+
for (const item of result2.Items ?? []) {
|
|
125
|
+
keys.push({
|
|
126
|
+
key: item.Key,
|
|
127
|
+
value: item.Value
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
if (result2.NextToken) {
|
|
131
|
+
nextToken = result2.NextToken;
|
|
132
|
+
} else {
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
keys,
|
|
138
|
+
...state2,
|
|
139
|
+
...formatOutput(result)
|
|
140
|
+
};
|
|
141
|
+
},
|
|
142
|
+
async createResource(props) {
|
|
143
|
+
const state2 = validateInput(props.state);
|
|
144
|
+
const result = await bulkUpdate({
|
|
145
|
+
arn: state2.kvsArn,
|
|
146
|
+
mutations: state2.keys.map((item) => ({ ...item, type: "put" }))
|
|
147
|
+
});
|
|
148
|
+
return {
|
|
149
|
+
...state2,
|
|
150
|
+
...formatOutput(result)
|
|
151
|
+
};
|
|
152
|
+
},
|
|
153
|
+
async updateResource(props) {
|
|
154
|
+
const priorState = validateInput(props.priorState);
|
|
155
|
+
const proposedState = validateInput(props.proposedState);
|
|
156
|
+
const puts = proposedState.keys.filter((a) => {
|
|
157
|
+
return !priorState.keys.find((b) => a.key === b.key);
|
|
158
|
+
});
|
|
159
|
+
const deletes = priorState.keys.filter((a) => {
|
|
160
|
+
return !proposedState.keys.find((b) => a.key === b.key);
|
|
161
|
+
});
|
|
162
|
+
const result = await bulkUpdate({
|
|
163
|
+
arn: proposedState.kvsArn,
|
|
164
|
+
mutations: [
|
|
165
|
+
...puts.map((i) => ({ ...i, type: "put" })),
|
|
166
|
+
...deletes.map((i) => ({ ...i, type: "delete" }))
|
|
167
|
+
]
|
|
168
|
+
});
|
|
169
|
+
return {
|
|
170
|
+
...proposedState,
|
|
171
|
+
...formatOutput(result)
|
|
172
|
+
};
|
|
173
|
+
},
|
|
174
|
+
async deleteResource(props) {
|
|
175
|
+
const state2 = validateInput(props.state);
|
|
176
|
+
await bulkUpdate({
|
|
177
|
+
arn: state2.kvsArn,
|
|
178
|
+
mutations: state2.keys.map((i) => ({ ...i, type: "delete" }))
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
// src/formation/cloudfront.ts
|
|
186
|
+
import { CloudFrontClient, CreateInvalidationCommand } from "@aws-sdk/client-cloudfront";
|
|
187
|
+
import { createCustomProvider as createCustomProvider2, createCustomResourceClass as createCustomResourceClass2 } from "@awsless/formation";
|
|
188
|
+
import { z as z2 } from "zod";
|
|
189
|
+
var Invalidation = createCustomResourceClass2(
|
|
55
190
|
"cloudfront",
|
|
56
191
|
"invalidation"
|
|
57
192
|
);
|
|
58
193
|
var createCloudFrontProvider = ({ profile, region }) => {
|
|
59
194
|
const cloudFront = new CloudFrontClient({ profile, region });
|
|
60
|
-
return
|
|
195
|
+
return createCustomProvider2("cloudfront", {
|
|
61
196
|
invalidation: {
|
|
62
197
|
async updateResource(props) {
|
|
63
|
-
const state2 =
|
|
64
|
-
distributionId:
|
|
65
|
-
paths:
|
|
198
|
+
const state2 = z2.object({
|
|
199
|
+
distributionId: z2.string(),
|
|
200
|
+
paths: z2.string().array().min(1)
|
|
66
201
|
}).parse(props.proposedState);
|
|
67
202
|
const result = await cloudFront.send(
|
|
68
203
|
new CreateInvalidationCommand({
|
|
@@ -87,24 +222,24 @@ var createCloudFrontProvider = ({ profile, region }) => {
|
|
|
87
222
|
|
|
88
223
|
// src/formation/lambda.ts
|
|
89
224
|
import { LambdaClient, UpdateFunctionCodeCommand } from "@aws-sdk/client-lambda";
|
|
90
|
-
import { createCustomProvider as
|
|
91
|
-
import { z as
|
|
92
|
-
var UpdateFunctionCode =
|
|
225
|
+
import { createCustomProvider as createCustomProvider3, createCustomResourceClass as createCustomResourceClass3 } from "@awsless/formation";
|
|
226
|
+
import { z as z3 } from "zod";
|
|
227
|
+
var UpdateFunctionCode = createCustomResourceClass3(
|
|
93
228
|
"lambda",
|
|
94
229
|
"update-function-code"
|
|
95
230
|
);
|
|
96
231
|
var createLambdaProvider = ({ credentials, region }) => {
|
|
97
232
|
const lambda = new LambdaClient({ credentials, region });
|
|
98
|
-
return
|
|
233
|
+
return createCustomProvider3("lambda", {
|
|
99
234
|
"update-function-code": {
|
|
100
235
|
async updateResource(props) {
|
|
101
|
-
const state2 =
|
|
102
|
-
functionName:
|
|
103
|
-
architectures:
|
|
104
|
-
s3Bucket:
|
|
105
|
-
s3Key:
|
|
106
|
-
s3ObjectVersion:
|
|
107
|
-
imageUri:
|
|
236
|
+
const state2 = z3.object({
|
|
237
|
+
functionName: z3.string(),
|
|
238
|
+
architectures: z3.string().array(),
|
|
239
|
+
s3Bucket: z3.string().optional().transform((v) => v ? v : void 0),
|
|
240
|
+
s3Key: z3.string().optional().transform((v) => v ? v : void 0),
|
|
241
|
+
s3ObjectVersion: z3.string().optional().transform((v) => v ? v : void 0),
|
|
242
|
+
imageUri: z3.string().optional().transform((v) => v ? v : void 0)
|
|
108
243
|
}).parse(props.proposedState);
|
|
109
244
|
await lambda.send(
|
|
110
245
|
new UpdateFunctionCodeCommand({
|
|
@@ -207,7 +342,7 @@ var createWorkSpace = async (props) => {
|
|
|
207
342
|
providers: [
|
|
208
343
|
createLambdaProvider(props),
|
|
209
344
|
createCloudFrontProvider(props),
|
|
210
|
-
|
|
345
|
+
createCloudFrontKvsProvider(props),
|
|
211
346
|
aws(
|
|
212
347
|
{
|
|
213
348
|
profile: props.profile,
|
|
@@ -492,21 +627,21 @@ var debug = (...parts) => {
|
|
|
492
627
|
};
|
|
493
628
|
|
|
494
629
|
// src/config/app.ts
|
|
495
|
-
import { z as
|
|
630
|
+
import { z as z24 } from "zod";
|
|
496
631
|
|
|
497
632
|
// src/feature/alert/schema.ts
|
|
498
633
|
import { kebabCase } from "change-case";
|
|
499
|
-
import { z as
|
|
634
|
+
import { z as z5 } from "zod";
|
|
500
635
|
|
|
501
636
|
// src/config/schema/email.ts
|
|
502
|
-
import { z as
|
|
503
|
-
var EmailSchema =
|
|
637
|
+
import { z as z4 } from "zod";
|
|
638
|
+
var EmailSchema = z4.string().email();
|
|
504
639
|
|
|
505
640
|
// src/feature/alert/schema.ts
|
|
506
|
-
var AlertNameSchema =
|
|
507
|
-
var AlertsDefaultSchema =
|
|
641
|
+
var AlertNameSchema = z5.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid alert name").transform((value) => kebabCase(value)).describe("Define alert name.");
|
|
642
|
+
var AlertsDefaultSchema = z5.record(
|
|
508
643
|
AlertNameSchema,
|
|
509
|
-
|
|
644
|
+
z5.union([
|
|
510
645
|
//
|
|
511
646
|
EmailSchema.transform((v) => [v]),
|
|
512
647
|
EmailSchema.array()
|
|
@@ -514,17 +649,17 @@ var AlertsDefaultSchema = z4.record(
|
|
|
514
649
|
).optional().describe("Define the alerts in your app. Alerts are a way to send messages to one or more email addresses.");
|
|
515
650
|
|
|
516
651
|
// src/feature/auth/schema.ts
|
|
517
|
-
import { z as
|
|
652
|
+
import { z as z8 } from "zod";
|
|
518
653
|
|
|
519
654
|
// src/config/schema/resource-id.ts
|
|
520
655
|
import { kebabCase as kebabCase2 } from "change-case";
|
|
521
|
-
import { z as
|
|
522
|
-
var ResourceIdSchema =
|
|
656
|
+
import { z as z6 } from "zod";
|
|
657
|
+
var ResourceIdSchema = z6.string().min(3).max(24).regex(/^[a-z0-9\-]+$/i, "Invalid resource ID").transform((value) => kebabCase2(value));
|
|
523
658
|
|
|
524
659
|
// src/config/schema/duration.ts
|
|
525
660
|
import { parse } from "@awsless/duration";
|
|
526
|
-
import { z as
|
|
527
|
-
var DurationSchema =
|
|
661
|
+
import { z as z7 } from "zod";
|
|
662
|
+
var DurationSchema = z7.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?|weeks?)$/, "Invalid duration").transform((v) => parse(v));
|
|
528
663
|
var durationMin = (min) => {
|
|
529
664
|
return (duration) => {
|
|
530
665
|
return duration.value >= min.value;
|
|
@@ -537,10 +672,10 @@ var durationMax = (max) => {
|
|
|
537
672
|
};
|
|
538
673
|
|
|
539
674
|
// src/feature/auth/schema.ts
|
|
540
|
-
var AuthDefaultSchema =
|
|
675
|
+
var AuthDefaultSchema = z8.record(
|
|
541
676
|
ResourceIdSchema,
|
|
542
|
-
|
|
543
|
-
allowUserRegistration:
|
|
677
|
+
z8.object({
|
|
678
|
+
allowUserRegistration: z8.boolean().default(true).describe("Specifies whether users can create an user account or if only the administrator can."),
|
|
544
679
|
// messaging: z
|
|
545
680
|
// .object({
|
|
546
681
|
// fromEmail: EmailSchema.describe("Specifies the sender's email address."),
|
|
@@ -552,23 +687,23 @@ var AuthDefaultSchema = z7.record(
|
|
|
552
687
|
// .optional()
|
|
553
688
|
// .describe('The email configuration for sending messages.'),
|
|
554
689
|
// secret: z.boolean().default(false).describe('Specifies whether you want to generate a client secret.'),
|
|
555
|
-
username:
|
|
690
|
+
username: z8.object({
|
|
556
691
|
// emailAlias: z.boolean().default(true).describe('Allow the user email to be used as username.'),
|
|
557
|
-
caseSensitive:
|
|
692
|
+
caseSensitive: z8.boolean().default(false).describe(
|
|
558
693
|
"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."
|
|
559
694
|
)
|
|
560
695
|
}).default({}).describe("The username policy."),
|
|
561
|
-
password:
|
|
562
|
-
minLength:
|
|
563
|
-
uppercase:
|
|
564
|
-
lowercase:
|
|
565
|
-
numbers:
|
|
566
|
-
symbols:
|
|
696
|
+
password: z8.object({
|
|
697
|
+
minLength: z8.number().int().min(6).max(99).default(12).describe("Required users to have at least the minimum password length."),
|
|
698
|
+
uppercase: z8.boolean().default(true).describe("Required users to use at least one uppercase letter in their password."),
|
|
699
|
+
lowercase: z8.boolean().default(true).describe("Required users to use at least one lowercase letter in their password."),
|
|
700
|
+
numbers: z8.boolean().default(true).describe("Required users to use at least one number in their password."),
|
|
701
|
+
symbols: z8.boolean().default(true).describe("Required users to use at least one symbol in their password."),
|
|
567
702
|
temporaryPasswordValidity: DurationSchema.default("7 days").describe(
|
|
568
703
|
"The duration a temporary password is valid. If the user doesn't sign in during this time, an administrator must reset their password."
|
|
569
704
|
)
|
|
570
705
|
}).default({}).describe("The password policy."),
|
|
571
|
-
validity:
|
|
706
|
+
validity: z8.object({
|
|
572
707
|
idToken: DurationSchema.default("1 hour").describe(
|
|
573
708
|
"The ID token time limit. After this limit expires, your user can't use their ID token."
|
|
574
709
|
),
|
|
@@ -584,18 +719,18 @@ var AuthDefaultSchema = z7.record(
|
|
|
584
719
|
).default({}).describe("Define the authenticatable users in your app.");
|
|
585
720
|
|
|
586
721
|
// src/feature/domain/schema.ts
|
|
587
|
-
import { z as
|
|
588
|
-
var DomainNameSchema =
|
|
722
|
+
import { z as z9 } from "zod";
|
|
723
|
+
var DomainNameSchema = z9.string().regex(/[a-z\-\_\.]/g, "Invalid domain name").describe(
|
|
589
724
|
"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."
|
|
590
725
|
);
|
|
591
|
-
var DNSTypeSchema =
|
|
726
|
+
var DNSTypeSchema = z9.enum(["A", "AAAA", "CAA", "CNAME", "DS", "MX", "NAPTR", "NS", "PTR", "SOA", "SPF", "SRV", "TXT"]).describe("The DNS record type.");
|
|
592
727
|
var TTLSchema = DurationSchema.describe("The resource record cache time to live (TTL).");
|
|
593
|
-
var RecordsSchema =
|
|
594
|
-
var DomainsDefaultSchema =
|
|
728
|
+
var RecordsSchema = z9.string().array().describe("One or more values that correspond with the value that you specified for the Type property.");
|
|
729
|
+
var DomainsDefaultSchema = z9.record(
|
|
595
730
|
ResourceIdSchema,
|
|
596
|
-
|
|
731
|
+
z9.object({
|
|
597
732
|
domain: DomainNameSchema.describe("Define the domain name"),
|
|
598
|
-
dns:
|
|
733
|
+
dns: z9.object({
|
|
599
734
|
name: DomainNameSchema.optional(),
|
|
600
735
|
type: DNSTypeSchema,
|
|
601
736
|
ttl: TTLSchema,
|
|
@@ -607,15 +742,15 @@ var DomainsDefaultSchema = z8.record(
|
|
|
607
742
|
// src/feature/function/schema.ts
|
|
608
743
|
import { days, minutes, seconds, toDays } from "@awsless/duration";
|
|
609
744
|
import { gibibytes, mebibytes } from "@awsless/size";
|
|
610
|
-
import { z as
|
|
745
|
+
import { z as z14 } from "zod";
|
|
611
746
|
|
|
612
747
|
// src/config/schema/local-directory.ts
|
|
613
748
|
import { stat } from "fs/promises";
|
|
614
|
-
import { z as
|
|
749
|
+
import { z as z11 } from "zod";
|
|
615
750
|
|
|
616
751
|
// src/config/schema/relative-path.ts
|
|
617
752
|
import { join as join3 } from "path";
|
|
618
|
-
import { z as
|
|
753
|
+
import { z as z10 } from "zod";
|
|
619
754
|
var basePath;
|
|
620
755
|
var setLocalBasePath = (path) => {
|
|
621
756
|
basePath = path;
|
|
@@ -626,10 +761,10 @@ var resolvePath = (path) => {
|
|
|
626
761
|
}
|
|
627
762
|
return path;
|
|
628
763
|
};
|
|
629
|
-
var RelativePathSchema =
|
|
764
|
+
var RelativePathSchema = z10.string().transform((path) => resolvePath(path));
|
|
630
765
|
|
|
631
766
|
// src/config/schema/local-directory.ts
|
|
632
|
-
var LocalDirectorySchema =
|
|
767
|
+
var LocalDirectorySchema = z11.union([
|
|
633
768
|
RelativePathSchema.refine(async (path) => {
|
|
634
769
|
try {
|
|
635
770
|
const s = await stat(path);
|
|
@@ -638,7 +773,7 @@ var LocalDirectorySchema = z10.union([
|
|
|
638
773
|
return false;
|
|
639
774
|
}
|
|
640
775
|
}, `Directory doesn't exist`),
|
|
641
|
-
|
|
776
|
+
z11.object({
|
|
642
777
|
nocheck: RelativePathSchema.describe(
|
|
643
778
|
"Specifies a local directory without checking if the directory exists."
|
|
644
779
|
)
|
|
@@ -647,8 +782,8 @@ var LocalDirectorySchema = z10.union([
|
|
|
647
782
|
|
|
648
783
|
// src/config/schema/local-file.ts
|
|
649
784
|
import { stat as stat2 } from "fs/promises";
|
|
650
|
-
import { z as
|
|
651
|
-
var LocalFileSchema =
|
|
785
|
+
import { z as z12 } from "zod";
|
|
786
|
+
var LocalFileSchema = z12.union([
|
|
652
787
|
RelativePathSchema.refine(async (path) => {
|
|
653
788
|
try {
|
|
654
789
|
const s = await stat2(path);
|
|
@@ -657,15 +792,15 @@ var LocalFileSchema = z11.union([
|
|
|
657
792
|
return false;
|
|
658
793
|
}
|
|
659
794
|
}, `File doesn't exist`),
|
|
660
|
-
|
|
795
|
+
z12.object({
|
|
661
796
|
nocheck: RelativePathSchema.describe("Specifies a local file without checking if the file exists.")
|
|
662
797
|
}).transform((v) => v.nocheck)
|
|
663
798
|
]);
|
|
664
799
|
|
|
665
800
|
// src/config/schema/size.ts
|
|
666
801
|
import { parse as parse2 } from "@awsless/size";
|
|
667
|
-
import { z as
|
|
668
|
-
var SizeSchema =
|
|
802
|
+
import { z as z13 } from "zod";
|
|
803
|
+
var SizeSchema = z13.string().regex(/^[0-9]+ (B|KB|MB|GB|TB|PB)$/, "Invalid size").transform((v) => parse2(v));
|
|
669
804
|
var sizeMin = (min) => {
|
|
670
805
|
return (size) => {
|
|
671
806
|
return size.value >= min.value;
|
|
@@ -688,32 +823,32 @@ var EphemeralStorageSizeSchema = SizeSchema.refine(
|
|
|
688
823
|
sizeMin(mebibytes(512)),
|
|
689
824
|
"Minimum ephemeral storage size is 512 MB"
|
|
690
825
|
).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.");
|
|
691
|
-
var ReservedConcurrentExecutionsSchema =
|
|
692
|
-
var EnvironmentSchema =
|
|
693
|
-
var ArchitectureSchema =
|
|
694
|
-
var RetryAttemptsSchema =
|
|
826
|
+
var ReservedConcurrentExecutionsSchema = z14.number().int().min(0).describe("The number of simultaneous executions to reserve for the function. You can specify a number from 0.");
|
|
827
|
+
var EnvironmentSchema = z14.record(z14.string(), z14.string()).optional().describe("Environment variable key-value pairs.");
|
|
828
|
+
var ArchitectureSchema = z14.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the function supports.");
|
|
829
|
+
var RetryAttemptsSchema = z14.number().int().min(0).max(2).describe(
|
|
695
830
|
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
|
|
696
831
|
);
|
|
697
|
-
var NodeRuntimeSchema =
|
|
698
|
-
var ContainerRuntimeSchema =
|
|
699
|
-
var RuntimeSchema = NodeRuntimeSchema.or(ContainerRuntimeSchema).or(
|
|
700
|
-
var ActionSchema =
|
|
701
|
-
var ActionsSchema =
|
|
702
|
-
var ArnSchema =
|
|
703
|
-
var WildcardSchema =
|
|
704
|
-
var ResourceSchema =
|
|
705
|
-
var ResourcesSchema =
|
|
706
|
-
var PermissionSchema =
|
|
707
|
-
effect:
|
|
832
|
+
var NodeRuntimeSchema = z14.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x"]);
|
|
833
|
+
var ContainerRuntimeSchema = z14.literal("container");
|
|
834
|
+
var RuntimeSchema = NodeRuntimeSchema.or(ContainerRuntimeSchema).or(z14.string()).describe("The identifier of the function's runtime.");
|
|
835
|
+
var ActionSchema = z14.string();
|
|
836
|
+
var ActionsSchema = z14.union([ActionSchema.transform((v) => [v]), ActionSchema.array()]);
|
|
837
|
+
var ArnSchema = z14.string().startsWith("arn:");
|
|
838
|
+
var WildcardSchema = z14.literal("*");
|
|
839
|
+
var ResourceSchema = z14.union([ArnSchema, WildcardSchema]);
|
|
840
|
+
var ResourcesSchema = z14.union([ResourceSchema.transform((v) => [v]), ResourceSchema.array()]);
|
|
841
|
+
var PermissionSchema = z14.object({
|
|
842
|
+
effect: z14.enum(["allow", "deny"]).default("allow"),
|
|
708
843
|
actions: ActionsSchema,
|
|
709
844
|
resources: ResourcesSchema
|
|
710
845
|
});
|
|
711
|
-
var PermissionsSchema =
|
|
712
|
-
var WarmSchema =
|
|
713
|
-
var VPCSchema =
|
|
714
|
-
var MinifySchema =
|
|
715
|
-
var HandlerSchema =
|
|
716
|
-
var DescriptionSchema =
|
|
846
|
+
var PermissionsSchema = z14.union([PermissionSchema.transform((v) => [v]), PermissionSchema.array()]).describe("Add IAM permissions to your function.");
|
|
847
|
+
var WarmSchema = z14.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.");
|
|
848
|
+
var VPCSchema = z14.boolean().describe("Put the function inside your global VPC.");
|
|
849
|
+
var MinifySchema = z14.boolean().describe("Minify the function code.");
|
|
850
|
+
var HandlerSchema = z14.string().describe("The name of the exported method within your code that Lambda calls to run your function.");
|
|
851
|
+
var DescriptionSchema = z14.string().describe("A description of the function.");
|
|
717
852
|
var validLogRetentionDays = [
|
|
718
853
|
...[1, 3, 5, 7, 14, 30, 60, 90, 120, 150],
|
|
719
854
|
...[180, 365, 400, 545, 731, 1096, 1827, 2192],
|
|
@@ -728,43 +863,43 @@ var LogRetentionSchema = DurationSchema.refine(
|
|
|
728
863
|
},
|
|
729
864
|
`Invalid log retention. Valid days are: ${validLogRetentionDays.map((days6) => `${days6}`).join(", ")}`
|
|
730
865
|
).describe("The log retention duration.");
|
|
731
|
-
var LogSchema =
|
|
732
|
-
|
|
866
|
+
var LogSchema = z14.union([
|
|
867
|
+
z14.boolean().transform((enabled) => ({ retention: enabled ? days(7) : days(0) })),
|
|
733
868
|
LogRetentionSchema.transform((retention) => ({ retention })),
|
|
734
|
-
|
|
869
|
+
z14.object({
|
|
735
870
|
// subscription: LogSubscriptionSchema.optional(),
|
|
736
871
|
retention: LogRetentionSchema.optional(),
|
|
737
|
-
format:
|
|
872
|
+
format: z14.enum(["text", "json"]).describe(
|
|
738
873
|
`The format in which Lambda sends your function's application and system logs to CloudWatch. Select between plain text and structured JSON.`
|
|
739
874
|
).optional(),
|
|
740
|
-
system:
|
|
875
|
+
system: z14.enum(["debug", "info", "warn"]).describe(
|
|
741
876
|
"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."
|
|
742
877
|
).optional(),
|
|
743
|
-
level:
|
|
878
|
+
level: z14.enum(["trace", "debug", "info", "warn", "error", "fatal"]).describe(
|
|
744
879
|
"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."
|
|
745
880
|
).optional()
|
|
746
881
|
})
|
|
747
882
|
]).describe("Enable logging to a CloudWatch log group. Providing a duration value will set the log retention time.");
|
|
748
|
-
var LayersSchema =
|
|
883
|
+
var LayersSchema = z14.string().array().describe(
|
|
749
884
|
// `A list of function layers to add to the function's execution environment..`
|
|
750
885
|
`A list of function layers to add to the function's execution environment. Specify each layer by its ARN, including the version.`
|
|
751
886
|
);
|
|
752
|
-
var FileCodeSchema =
|
|
887
|
+
var FileCodeSchema = z14.object({
|
|
753
888
|
file: LocalFileSchema.describe("The file path of the function code."),
|
|
754
889
|
minify: MinifySchema.optional().default(true),
|
|
755
|
-
external:
|
|
890
|
+
external: z14.string().array().optional().describe(`A list of external packages that won't be included in the bundle.`)
|
|
756
891
|
});
|
|
757
|
-
var BundleCodeSchema =
|
|
892
|
+
var BundleCodeSchema = z14.object({
|
|
758
893
|
bundle: LocalDirectorySchema.describe("The directory that needs to be bundled.")
|
|
759
894
|
});
|
|
760
|
-
var CodeSchema =
|
|
895
|
+
var CodeSchema = z14.union([
|
|
761
896
|
LocalFileSchema.transform((file) => ({
|
|
762
897
|
file
|
|
763
898
|
})).pipe(FileCodeSchema),
|
|
764
899
|
FileCodeSchema,
|
|
765
900
|
BundleCodeSchema
|
|
766
901
|
]).describe("Specify the code of your function.");
|
|
767
|
-
var FnSchema =
|
|
902
|
+
var FnSchema = z14.object({
|
|
768
903
|
code: CodeSchema,
|
|
769
904
|
// node
|
|
770
905
|
handler: HandlerSchema.optional(),
|
|
@@ -787,14 +922,14 @@ var FnSchema = z13.object({
|
|
|
787
922
|
environment: EnvironmentSchema.optional(),
|
|
788
923
|
permissions: PermissionsSchema.optional()
|
|
789
924
|
});
|
|
790
|
-
var FunctionSchema =
|
|
925
|
+
var FunctionSchema = z14.union([
|
|
791
926
|
LocalFileSchema.transform((code) => ({
|
|
792
927
|
code
|
|
793
928
|
})).pipe(FnSchema),
|
|
794
929
|
FnSchema
|
|
795
930
|
]);
|
|
796
|
-
var FunctionsSchema =
|
|
797
|
-
var FunctionDefaultSchema =
|
|
931
|
+
var FunctionsSchema = z14.record(ResourceIdSchema, FunctionSchema).optional().describe("Define the functions in your stack.");
|
|
932
|
+
var FunctionDefaultSchema = z14.object({
|
|
798
933
|
runtime: RuntimeSchema.default("nodejs20.x"),
|
|
799
934
|
// node
|
|
800
935
|
handler: HandlerSchema.default("index.default"),
|
|
@@ -823,25 +958,25 @@ var FunctionDefaultSchema = z13.object({
|
|
|
823
958
|
}).default({});
|
|
824
959
|
|
|
825
960
|
// src/feature/layer/schema.ts
|
|
826
|
-
import { z as
|
|
961
|
+
import { z as z16 } from "zod";
|
|
827
962
|
|
|
828
963
|
// src/config/schema/lambda.ts
|
|
829
|
-
import { z as
|
|
830
|
-
var ArchitectureSchema2 =
|
|
831
|
-
var NodeRuntimeSchema2 =
|
|
964
|
+
import { z as z15 } from "zod";
|
|
965
|
+
var ArchitectureSchema2 = z15.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the function supports.");
|
|
966
|
+
var NodeRuntimeSchema2 = z15.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x"]).describe("The identifier of the function's runtime.");
|
|
832
967
|
|
|
833
968
|
// src/feature/layer/schema.ts
|
|
834
|
-
var Schema =
|
|
969
|
+
var Schema = z16.object({
|
|
835
970
|
file: LocalFileSchema,
|
|
836
971
|
runtimes: NodeRuntimeSchema2.array().optional(),
|
|
837
972
|
architecture: ArchitectureSchema2.optional(),
|
|
838
|
-
packages:
|
|
973
|
+
packages: z16.string().array().optional().describe(
|
|
839
974
|
"Define the package names that are available bundled in the layer. Those packages are not bundled while bundling the lambda."
|
|
840
975
|
)
|
|
841
976
|
});
|
|
842
|
-
var LayerSchema =
|
|
843
|
-
|
|
844
|
-
|
|
977
|
+
var LayerSchema = z16.record(
|
|
978
|
+
z16.string(),
|
|
979
|
+
z16.union([
|
|
845
980
|
LocalFileSchema.transform((file) => ({
|
|
846
981
|
file,
|
|
847
982
|
description: void 0
|
|
@@ -856,28 +991,28 @@ var OnFailureDefaultSchema = FunctionSchema.optional().describe(
|
|
|
856
991
|
);
|
|
857
992
|
|
|
858
993
|
// src/feature/on-log/schema.ts
|
|
859
|
-
import { z as
|
|
860
|
-
var FilterSchema =
|
|
861
|
-
var OnLogDefaultSchema =
|
|
994
|
+
import { z as z17 } from "zod";
|
|
995
|
+
var FilterSchema = z17.enum(["trace", "debug", "info", "warn", "error", "fatal"]).array().describe("The log level that will gets delivered to the consumer.");
|
|
996
|
+
var OnLogDefaultSchema = z17.union([
|
|
862
997
|
FunctionSchema.transform((consumer) => ({
|
|
863
998
|
consumer,
|
|
864
999
|
filter: ["error", "fatal"]
|
|
865
1000
|
})),
|
|
866
|
-
|
|
1001
|
+
z17.object({
|
|
867
1002
|
consumer: FunctionSchema,
|
|
868
1003
|
filter: FilterSchema
|
|
869
1004
|
})
|
|
870
1005
|
]).optional().describe("Define a subscription on all Lambda functions logs.");
|
|
871
1006
|
|
|
872
1007
|
// src/feature/pubsub/schema.ts
|
|
873
|
-
import { z as
|
|
1008
|
+
import { z as z18 } from "zod";
|
|
874
1009
|
var DomainSchema = ResourceIdSchema.describe("The domain id to link your Pubsub API with.");
|
|
875
|
-
var PubSubDefaultSchema =
|
|
1010
|
+
var PubSubDefaultSchema = z18.record(
|
|
876
1011
|
ResourceIdSchema,
|
|
877
|
-
|
|
1012
|
+
z18.object({
|
|
878
1013
|
auth: FunctionSchema,
|
|
879
1014
|
domain: DomainSchema.optional(),
|
|
880
|
-
subDomain:
|
|
1015
|
+
subDomain: z18.string().optional()
|
|
881
1016
|
// auth: z.union([
|
|
882
1017
|
// ResourceIdSchema,
|
|
883
1018
|
// z.object({
|
|
@@ -893,11 +1028,11 @@ var PubSubDefaultSchema = z17.record(
|
|
|
893
1028
|
// .optional(),
|
|
894
1029
|
})
|
|
895
1030
|
).optional().describe("Define the pubsub subscriber in your stack.");
|
|
896
|
-
var PubSubSchema =
|
|
1031
|
+
var PubSubSchema = z18.record(
|
|
897
1032
|
ResourceIdSchema,
|
|
898
|
-
|
|
899
|
-
sql:
|
|
900
|
-
sqlVersion:
|
|
1033
|
+
z18.object({
|
|
1034
|
+
sql: z18.string().describe("The SQL statement used to query the IOT topic."),
|
|
1035
|
+
sqlVersion: z18.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."),
|
|
901
1036
|
consumer: FunctionSchema.describe("The consuming lambda function properties.")
|
|
902
1037
|
})
|
|
903
1038
|
).optional().describe("Define the pubsub subscriber in your stack.");
|
|
@@ -905,7 +1040,7 @@ var PubSubSchema = z17.record(
|
|
|
905
1040
|
// src/feature/queue/schema.ts
|
|
906
1041
|
import { days as days2, hours, minutes as minutes2, seconds as seconds2 } from "@awsless/duration";
|
|
907
1042
|
import { kibibytes } from "@awsless/size";
|
|
908
|
-
import { z as
|
|
1043
|
+
import { z as z19 } from "zod";
|
|
909
1044
|
var RetentionPeriodSchema = DurationSchema.refine(
|
|
910
1045
|
durationMin(minutes2(1)),
|
|
911
1046
|
"Minimum retention period is 1 minute"
|
|
@@ -933,10 +1068,10 @@ var ReceiveMessageWaitTimeSchema = DurationSchema.refine(
|
|
|
933
1068
|
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(
|
|
934
1069
|
"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."
|
|
935
1070
|
);
|
|
936
|
-
var BatchSizeSchema =
|
|
1071
|
+
var BatchSizeSchema = z19.number().int().min(1, "Minimum batch size is 1").max(1e4, "Maximum batch size is 10000").describe(
|
|
937
1072
|
"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."
|
|
938
1073
|
);
|
|
939
|
-
var MaxConcurrencySchema =
|
|
1074
|
+
var MaxConcurrencySchema = z19.number().int().min(2, "Minimum max concurrency is 2").max(1e3, "Maximum max concurrency is 1000").describe(
|
|
940
1075
|
"Limits the number of concurrent instances that the queue worker can invoke. You can specify an integer from 2 to 1000."
|
|
941
1076
|
);
|
|
942
1077
|
var MaxBatchingWindow = DurationSchema.refine(
|
|
@@ -945,7 +1080,7 @@ var MaxBatchingWindow = DurationSchema.refine(
|
|
|
945
1080
|
).describe(
|
|
946
1081
|
"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."
|
|
947
1082
|
);
|
|
948
|
-
var QueueDefaultSchema =
|
|
1083
|
+
var QueueDefaultSchema = z19.object({
|
|
949
1084
|
retentionPeriod: RetentionPeriodSchema.default("7 days"),
|
|
950
1085
|
visibilityTimeout: VisibilityTimeoutSchema.default("30 seconds"),
|
|
951
1086
|
deliveryDelay: DeliveryDelaySchema.default("0 seconds"),
|
|
@@ -955,7 +1090,7 @@ var QueueDefaultSchema = z18.object({
|
|
|
955
1090
|
maxConcurrency: MaxConcurrencySchema.optional(),
|
|
956
1091
|
maxBatchingWindow: MaxBatchingWindow.optional()
|
|
957
1092
|
}).default({});
|
|
958
|
-
var QueueSchema =
|
|
1093
|
+
var QueueSchema = z19.object({
|
|
959
1094
|
consumer: FunctionSchema.describe("The consuming lambda function properties."),
|
|
960
1095
|
retentionPeriod: RetentionPeriodSchema.optional(),
|
|
961
1096
|
visibilityTimeout: VisibilityTimeoutSchema.optional(),
|
|
@@ -966,9 +1101,9 @@ var QueueSchema = z18.object({
|
|
|
966
1101
|
maxConcurrency: MaxConcurrencySchema.optional(),
|
|
967
1102
|
maxBatchingWindow: MaxBatchingWindow.optional()
|
|
968
1103
|
});
|
|
969
|
-
var QueuesSchema =
|
|
1104
|
+
var QueuesSchema = z19.record(
|
|
970
1105
|
ResourceIdSchema,
|
|
971
|
-
|
|
1106
|
+
z19.union([
|
|
972
1107
|
LocalFileSchema.transform((consumer) => ({
|
|
973
1108
|
consumer
|
|
974
1109
|
})).pipe(QueueSchema),
|
|
@@ -977,26 +1112,26 @@ var QueuesSchema = z18.record(
|
|
|
977
1112
|
).optional().describe("Define the queues in your stack.");
|
|
978
1113
|
|
|
979
1114
|
// src/feature/rest/schema.ts
|
|
980
|
-
import { z as
|
|
1115
|
+
import { z as z21 } from "zod";
|
|
981
1116
|
|
|
982
1117
|
// src/config/schema/route.ts
|
|
983
|
-
import { z as
|
|
984
|
-
var RouteSchema =
|
|
985
|
-
|
|
986
|
-
|
|
1118
|
+
import { z as z20 } from "zod";
|
|
1119
|
+
var RouteSchema = z20.union([
|
|
1120
|
+
z20.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS|ANY)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route"),
|
|
1121
|
+
z20.literal("$default")
|
|
987
1122
|
]);
|
|
988
1123
|
|
|
989
1124
|
// src/feature/rest/schema.ts
|
|
990
|
-
var RestDefaultSchema =
|
|
1125
|
+
var RestDefaultSchema = z21.record(
|
|
991
1126
|
ResourceIdSchema,
|
|
992
|
-
|
|
1127
|
+
z21.object({
|
|
993
1128
|
domain: ResourceIdSchema.describe("The domain id to link your API with.").optional(),
|
|
994
|
-
subDomain:
|
|
1129
|
+
subDomain: z21.string().optional()
|
|
995
1130
|
})
|
|
996
1131
|
).optional().describe("Define your global REST API's.");
|
|
997
|
-
var RestSchema =
|
|
1132
|
+
var RestSchema = z21.record(
|
|
998
1133
|
ResourceIdSchema,
|
|
999
|
-
|
|
1134
|
+
z21.record(
|
|
1000
1135
|
RouteSchema.describe(
|
|
1001
1136
|
[
|
|
1002
1137
|
"The REST API route that is comprised by the http method and http path.",
|
|
@@ -1009,7 +1144,7 @@ var RestSchema = z20.record(
|
|
|
1009
1144
|
).optional().describe("Define routes in your stack for your global REST API.");
|
|
1010
1145
|
|
|
1011
1146
|
// src/feature/rpc/schema.ts
|
|
1012
|
-
import { z as
|
|
1147
|
+
import { z as z22 } from "zod";
|
|
1013
1148
|
import { minutes as minutes3, seconds as seconds3 } from "@awsless/duration";
|
|
1014
1149
|
var TimeoutSchema2 = DurationSchema.refine(durationMin(seconds3(10)), "Minimum timeout duration is 10 seconds").refine(durationMax(minutes3(5)), "Maximum timeout duration is 5 minutes").describe(
|
|
1015
1150
|
[
|
|
@@ -1018,21 +1153,21 @@ var TimeoutSchema2 = DurationSchema.refine(durationMin(seconds3(10)), "Minimum t
|
|
|
1018
1153
|
"The timeouts of all inner RPC functions will be capped at 80% of this timeout."
|
|
1019
1154
|
].join(" ")
|
|
1020
1155
|
);
|
|
1021
|
-
var RpcDefaultSchema =
|
|
1156
|
+
var RpcDefaultSchema = z22.record(
|
|
1022
1157
|
ResourceIdSchema,
|
|
1023
|
-
|
|
1158
|
+
z22.object({
|
|
1024
1159
|
domain: ResourceIdSchema.describe("The domain id to link your RPC API with.").optional(),
|
|
1025
|
-
subDomain:
|
|
1160
|
+
subDomain: z22.string().optional(),
|
|
1026
1161
|
auth: FunctionSchema.optional(),
|
|
1027
1162
|
log: LogSchema.optional(),
|
|
1028
1163
|
timeout: TimeoutSchema2.default("1 minutes"),
|
|
1029
|
-
geoRestrictions:
|
|
1164
|
+
geoRestrictions: z22.array(z22.string().length(2).toUpperCase()).default([]).describe("Specifies a blacklist of countries that should be blocked.")
|
|
1030
1165
|
})
|
|
1031
1166
|
).describe(`Define the global RPC API's.`).optional();
|
|
1032
|
-
var RpcSchema =
|
|
1167
|
+
var RpcSchema = z22.record(ResourceIdSchema, z22.record(z22.string(), FunctionSchema).describe("The queries for your global RPC API.")).describe("Define the schema in your stack for your global RPC API.").optional();
|
|
1033
1168
|
|
|
1034
1169
|
// src/config/schema/region.ts
|
|
1035
|
-
import { z as
|
|
1170
|
+
import { z as z23 } from "zod";
|
|
1036
1171
|
var US = ["us-east-2", "us-east-1", "us-west-1", "us-west-2"];
|
|
1037
1172
|
var AF = ["af-south-1"];
|
|
1038
1173
|
var AP = [
|
|
@@ -1061,16 +1196,16 @@ var EU = [
|
|
|
1061
1196
|
var ME = ["me-south-1", "me-central-1"];
|
|
1062
1197
|
var SA = ["sa-east-1"];
|
|
1063
1198
|
var regions = [...US, ...AF, ...AP, ...CA, ...EU, ...ME, ...SA];
|
|
1064
|
-
var RegionSchema =
|
|
1199
|
+
var RegionSchema = z23.enum(regions);
|
|
1065
1200
|
|
|
1066
1201
|
// src/config/app.ts
|
|
1067
|
-
var AppSchema =
|
|
1068
|
-
$schema:
|
|
1202
|
+
var AppSchema = z24.object({
|
|
1203
|
+
$schema: z24.string().optional(),
|
|
1069
1204
|
name: ResourceIdSchema.describe("App name."),
|
|
1070
1205
|
region: RegionSchema.describe("The AWS region to deploy to."),
|
|
1071
|
-
profile:
|
|
1072
|
-
protect:
|
|
1073
|
-
removal:
|
|
1206
|
+
profile: z24.string().describe("The AWS profile to deploy to."),
|
|
1207
|
+
protect: z24.boolean().default(false).describe("Protect your app & stacks from being deleted."),
|
|
1208
|
+
removal: z24.enum(["remove", "retain"]).default("remove").describe(
|
|
1074
1209
|
[
|
|
1075
1210
|
"Configure how your resources are handled when they have to be removed.",
|
|
1076
1211
|
"",
|
|
@@ -1084,7 +1219,7 @@ var AppSchema = z23.object({
|
|
|
1084
1219
|
// .default('prod')
|
|
1085
1220
|
// .describe('The deployment stage.'),
|
|
1086
1221
|
// onFailure: OnFailureSchema,
|
|
1087
|
-
defaults:
|
|
1222
|
+
defaults: z24.object({
|
|
1088
1223
|
onFailure: OnFailureDefaultSchema,
|
|
1089
1224
|
onLog: OnLogDefaultSchema,
|
|
1090
1225
|
auth: AuthDefaultSchema,
|
|
@@ -1106,11 +1241,11 @@ var AppSchema = z23.object({
|
|
|
1106
1241
|
});
|
|
1107
1242
|
|
|
1108
1243
|
// src/config/stack.ts
|
|
1109
|
-
import { z as
|
|
1244
|
+
import { z as z38 } from "zod";
|
|
1110
1245
|
|
|
1111
1246
|
// src/feature/cache/schema.ts
|
|
1112
1247
|
import { gibibytes as gibibytes2 } from "@awsless/size";
|
|
1113
|
-
import { z as
|
|
1248
|
+
import { z as z25 } from "zod";
|
|
1114
1249
|
var StorageSchema = SizeSchema.refine(sizeMin(gibibytes2(1)), "Minimum storage size is 1 GB").refine(
|
|
1115
1250
|
sizeMax(gibibytes2(5e3)),
|
|
1116
1251
|
"Maximum storage size is 5000 GB"
|
|
@@ -1121,31 +1256,31 @@ var MinimumStorageSchema = StorageSchema.describe(
|
|
|
1121
1256
|
var MaximumStorageSchema = StorageSchema.describe(
|
|
1122
1257
|
"The upper limit for data storage the cache is set to use. You can specify a size value from 1 GB to 5000 GB."
|
|
1123
1258
|
);
|
|
1124
|
-
var EcpuSchema =
|
|
1259
|
+
var EcpuSchema = z25.number().int().min(1e3).max(15e6);
|
|
1125
1260
|
var MinimumEcpuSchema = EcpuSchema.describe(
|
|
1126
1261
|
"The minimum number of ECPUs the cache can consume per second. You can specify a integer from 1,000 to 15,000,000."
|
|
1127
1262
|
);
|
|
1128
1263
|
var MaximumEcpuSchema = EcpuSchema.describe(
|
|
1129
1264
|
"The maximum number of ECPUs the cache can consume per second. You can specify a integer from 1,000 to 15,000,000."
|
|
1130
1265
|
);
|
|
1131
|
-
var CachesSchema =
|
|
1266
|
+
var CachesSchema = z25.record(
|
|
1132
1267
|
ResourceIdSchema,
|
|
1133
|
-
|
|
1268
|
+
z25.object({
|
|
1134
1269
|
minStorage: MinimumStorageSchema.optional(),
|
|
1135
1270
|
maxStorage: MaximumStorageSchema.optional(),
|
|
1136
1271
|
minECPU: MinimumEcpuSchema.optional(),
|
|
1137
1272
|
maxECPU: MaximumEcpuSchema.optional(),
|
|
1138
|
-
snapshotRetentionLimit:
|
|
1273
|
+
snapshotRetentionLimit: z25.number().int().positive().default(1)
|
|
1139
1274
|
})
|
|
1140
1275
|
).optional().describe("Define the caches in your stack. For access to the cache put your functions inside the global VPC.");
|
|
1141
1276
|
|
|
1142
1277
|
// src/feature/command/schema.ts
|
|
1143
|
-
import { z as
|
|
1144
|
-
var CommandSchema =
|
|
1145
|
-
|
|
1278
|
+
import { z as z26 } from "zod";
|
|
1279
|
+
var CommandSchema = z26.union([
|
|
1280
|
+
z26.object({
|
|
1146
1281
|
file: LocalFileSchema,
|
|
1147
|
-
handler:
|
|
1148
|
-
description:
|
|
1282
|
+
handler: z26.string().default("default").describe("The name of the handler that needs to run"),
|
|
1283
|
+
description: z26.string().optional().describe("A description of the command")
|
|
1149
1284
|
// options: z.record(ResourceIdSchema, OptionSchema).optional(),
|
|
1150
1285
|
// arguments: z.record(ResourceIdSchema, ArgumentSchema).optional(),
|
|
1151
1286
|
}),
|
|
@@ -1155,22 +1290,22 @@ var CommandSchema = z25.union([
|
|
|
1155
1290
|
description: void 0
|
|
1156
1291
|
}))
|
|
1157
1292
|
]);
|
|
1158
|
-
var CommandsSchema =
|
|
1293
|
+
var CommandsSchema = z26.record(ResourceIdSchema, CommandSchema).optional().describe("Define the custom commands for your stack.");
|
|
1159
1294
|
|
|
1160
1295
|
// src/feature/config/schema.ts
|
|
1161
|
-
import { z as
|
|
1162
|
-
var ConfigNameSchema =
|
|
1163
|
-
var ConfigsSchema =
|
|
1296
|
+
import { z as z27 } from "zod";
|
|
1297
|
+
var ConfigNameSchema = z27.string().regex(/[a-z0-9\-]/g, "Invalid config name");
|
|
1298
|
+
var ConfigsSchema = z27.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
|
|
1164
1299
|
|
|
1165
1300
|
// src/feature/cron/schema/index.ts
|
|
1166
|
-
import { z as
|
|
1301
|
+
import { z as z29 } from "zod";
|
|
1167
1302
|
|
|
1168
1303
|
// src/feature/cron/schema/schedule.ts
|
|
1169
|
-
import { z as
|
|
1304
|
+
import { z as z28 } from "zod";
|
|
1170
1305
|
import { awsCronExpressionValidator } from "aws-cron-expression-validator";
|
|
1171
|
-
var RateExpressionSchema =
|
|
1306
|
+
var RateExpressionSchema = z28.custom(
|
|
1172
1307
|
(value) => {
|
|
1173
|
-
return
|
|
1308
|
+
return z28.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
|
|
1174
1309
|
const [str] = rate.split(" ");
|
|
1175
1310
|
const number = parseInt(str);
|
|
1176
1311
|
return number > 0;
|
|
@@ -1186,9 +1321,9 @@ var RateExpressionSchema = z27.custom(
|
|
|
1186
1321
|
}
|
|
1187
1322
|
return `rate(${rate})`;
|
|
1188
1323
|
});
|
|
1189
|
-
var CronExpressionSchema =
|
|
1324
|
+
var CronExpressionSchema = z28.custom(
|
|
1190
1325
|
(value) => {
|
|
1191
|
-
return
|
|
1326
|
+
return z28.string().safeParse(value).success;
|
|
1192
1327
|
},
|
|
1193
1328
|
{ message: "Invalid cron expression" }
|
|
1194
1329
|
).superRefine((value, ctx) => {
|
|
@@ -1197,12 +1332,12 @@ var CronExpressionSchema = z27.custom(
|
|
|
1197
1332
|
} catch (error) {
|
|
1198
1333
|
if (error instanceof Error) {
|
|
1199
1334
|
ctx.addIssue({
|
|
1200
|
-
code:
|
|
1335
|
+
code: z28.ZodIssueCode.custom,
|
|
1201
1336
|
message: `Invalid cron expression: ${error.message}`
|
|
1202
1337
|
});
|
|
1203
1338
|
} else {
|
|
1204
1339
|
ctx.addIssue({
|
|
1205
|
-
code:
|
|
1340
|
+
code: z28.ZodIssueCode.custom,
|
|
1206
1341
|
message: "Invalid cron expression"
|
|
1207
1342
|
});
|
|
1208
1343
|
}
|
|
@@ -1213,23 +1348,23 @@ var CronExpressionSchema = z27.custom(
|
|
|
1213
1348
|
var ScheduleExpressionSchema = RateExpressionSchema.or(CronExpressionSchema);
|
|
1214
1349
|
|
|
1215
1350
|
// src/feature/cron/schema/index.ts
|
|
1216
|
-
var CronsSchema =
|
|
1351
|
+
var CronsSchema = z29.record(
|
|
1217
1352
|
ResourceIdSchema,
|
|
1218
|
-
|
|
1219
|
-
enabled:
|
|
1353
|
+
z29.object({
|
|
1354
|
+
enabled: z29.boolean().default(true).describe("If the cron is enabled."),
|
|
1220
1355
|
consumer: FunctionSchema.describe("The consuming lambda function properties."),
|
|
1221
1356
|
schedule: ScheduleExpressionSchema.describe(
|
|
1222
1357
|
'The scheduling expression.\n\nexample: "0 20 * * ? *"\nexample: "5 minutes"'
|
|
1223
1358
|
),
|
|
1224
|
-
payload:
|
|
1359
|
+
payload: z29.unknown().optional().describe("The JSON payload that will be passed to the consumer.")
|
|
1225
1360
|
})
|
|
1226
1361
|
).optional().describe(`Define the cron jobs in your stack.`);
|
|
1227
1362
|
|
|
1228
1363
|
// src/feature/search/schema.ts
|
|
1229
1364
|
import { gibibytes as gibibytes3 } from "@awsless/size";
|
|
1230
|
-
import { z as
|
|
1231
|
-
var VersionSchema =
|
|
1232
|
-
var TypeSchema =
|
|
1365
|
+
import { z as z30 } from "zod";
|
|
1366
|
+
var VersionSchema = z30.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]);
|
|
1367
|
+
var TypeSchema = z30.enum([
|
|
1233
1368
|
"t3.small",
|
|
1234
1369
|
"t3.medium",
|
|
1235
1370
|
"m3.medium",
|
|
@@ -1304,11 +1439,11 @@ var TypeSchema = z29.enum([
|
|
|
1304
1439
|
"r6gd.16xlarge"
|
|
1305
1440
|
]);
|
|
1306
1441
|
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.");
|
|
1307
|
-
var SearchsSchema =
|
|
1442
|
+
var SearchsSchema = z30.record(
|
|
1308
1443
|
ResourceIdSchema,
|
|
1309
|
-
|
|
1444
|
+
z30.object({
|
|
1310
1445
|
type: TypeSchema.default("t3.small"),
|
|
1311
|
-
count:
|
|
1446
|
+
count: z30.number().int().min(1).default(1),
|
|
1312
1447
|
version: VersionSchema.default("2.13"),
|
|
1313
1448
|
storage: StorageSizeSchema.default("10 GB")
|
|
1314
1449
|
// vpc: z.boolean().default(false),
|
|
@@ -1316,12 +1451,12 @@ var SearchsSchema = z29.record(
|
|
|
1316
1451
|
).optional().describe("Define the search instances in your stack. Backed by OpenSearch.");
|
|
1317
1452
|
|
|
1318
1453
|
// src/feature/site/schema.ts
|
|
1319
|
-
import { z as
|
|
1454
|
+
import { z as z32 } from "zod";
|
|
1320
1455
|
|
|
1321
1456
|
// src/config/schema/local-entry.ts
|
|
1322
1457
|
import { stat as stat3 } from "fs/promises";
|
|
1323
|
-
import { z as
|
|
1324
|
-
var LocalEntrySchema =
|
|
1458
|
+
import { z as z31 } from "zod";
|
|
1459
|
+
var LocalEntrySchema = z31.union([
|
|
1325
1460
|
RelativePathSchema.refine(async (path) => {
|
|
1326
1461
|
try {
|
|
1327
1462
|
const s = await stat3(path);
|
|
@@ -1330,7 +1465,7 @@ var LocalEntrySchema = z30.union([
|
|
|
1330
1465
|
return false;
|
|
1331
1466
|
}
|
|
1332
1467
|
}, `File or directory doesn't exist`),
|
|
1333
|
-
|
|
1468
|
+
z31.object({
|
|
1334
1469
|
nocheck: RelativePathSchema.describe(
|
|
1335
1470
|
"Specifies a local file or directory without checking if the file or directory exists."
|
|
1336
1471
|
)
|
|
@@ -1338,14 +1473,14 @@ var LocalEntrySchema = z30.union([
|
|
|
1338
1473
|
]);
|
|
1339
1474
|
|
|
1340
1475
|
// src/feature/site/schema.ts
|
|
1341
|
-
var ErrorResponsePathSchema =
|
|
1476
|
+
var ErrorResponsePathSchema = z32.string().describe(
|
|
1342
1477
|
[
|
|
1343
1478
|
"The path to the custom error page that you want to return to the viewer when your origin returns the HTTP status code specified.",
|
|
1344
1479
|
"- We recommend that you store custom error pages in an Amazon S3 bucket.",
|
|
1345
1480
|
"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."
|
|
1346
1481
|
].join("\n")
|
|
1347
1482
|
);
|
|
1348
|
-
var StatusCodeSchema =
|
|
1483
|
+
var StatusCodeSchema = z32.number().int().positive().optional().describe(
|
|
1349
1484
|
[
|
|
1350
1485
|
"The HTTP status code that you want CloudFront to return to the viewer along with the custom error page.",
|
|
1351
1486
|
"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:",
|
|
@@ -1358,19 +1493,19 @@ var StatusCodeSchema = z31.number().int().positive().optional().describe(
|
|
|
1358
1493
|
var MinTTLSchema = DurationSchema.describe(
|
|
1359
1494
|
"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."
|
|
1360
1495
|
);
|
|
1361
|
-
var ErrorResponseSchema =
|
|
1496
|
+
var ErrorResponseSchema = z32.union([
|
|
1362
1497
|
ErrorResponsePathSchema,
|
|
1363
|
-
|
|
1498
|
+
z32.object({
|
|
1364
1499
|
path: ErrorResponsePathSchema,
|
|
1365
1500
|
statusCode: StatusCodeSchema.optional(),
|
|
1366
1501
|
minTTL: MinTTLSchema.optional()
|
|
1367
1502
|
})
|
|
1368
1503
|
]).optional();
|
|
1369
|
-
var SitesSchema =
|
|
1504
|
+
var SitesSchema = z32.record(
|
|
1370
1505
|
ResourceIdSchema,
|
|
1371
|
-
|
|
1506
|
+
z32.object({
|
|
1372
1507
|
domain: ResourceIdSchema.describe("The domain id to link your site with.").optional(),
|
|
1373
|
-
subDomain:
|
|
1508
|
+
subDomain: z32.string().optional(),
|
|
1374
1509
|
// bind: z
|
|
1375
1510
|
// .object({
|
|
1376
1511
|
// auth: z.array(ResourceIdSchema),
|
|
@@ -1379,15 +1514,15 @@ var SitesSchema = z31.record(
|
|
|
1379
1514
|
// // rest: z.array(ResourceIdSchema),
|
|
1380
1515
|
// })
|
|
1381
1516
|
// .optional(),
|
|
1382
|
-
build:
|
|
1383
|
-
command:
|
|
1517
|
+
build: z32.object({
|
|
1518
|
+
command: z32.string().describe(
|
|
1384
1519
|
`Specifies the files and directories to generate the cache key for your custom build command.`
|
|
1385
1520
|
),
|
|
1386
|
-
cacheKey:
|
|
1521
|
+
cacheKey: z32.union([LocalEntrySchema.transform((v) => [v]), LocalEntrySchema.array()]).describe(
|
|
1387
1522
|
`Specifies the files and directories to generate the cache key for your custom build command.`
|
|
1388
1523
|
)
|
|
1389
1524
|
}).optional().describe(`Specifies the build process for sites that need a build step.`),
|
|
1390
|
-
static:
|
|
1525
|
+
static: z32.union([LocalDirectorySchema, z32.boolean()]).optional().describe(
|
|
1391
1526
|
"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."
|
|
1392
1527
|
),
|
|
1393
1528
|
ssr: FunctionSchema.optional().describe("Specifies the file that will render the site on the server."),
|
|
@@ -1408,7 +1543,7 @@ var SitesSchema = z31.record(
|
|
|
1408
1543
|
// build: z.string().optional(),
|
|
1409
1544
|
// }),
|
|
1410
1545
|
// ]),
|
|
1411
|
-
geoRestrictions:
|
|
1546
|
+
geoRestrictions: z32.array(z32.string().length(2).toUpperCase()).default([]).describe("Specifies a blacklist of countries that should be blocked."),
|
|
1412
1547
|
// forwardHost: z
|
|
1413
1548
|
// .boolean()
|
|
1414
1549
|
// .default(false)
|
|
@@ -1419,7 +1554,7 @@ var SitesSchema = z31.record(
|
|
|
1419
1554
|
// 'Keep in mind that this requires an extra CloudFront Function.',
|
|
1420
1555
|
// ].join('\n')
|
|
1421
1556
|
// ),
|
|
1422
|
-
errors:
|
|
1557
|
+
errors: z32.object({
|
|
1423
1558
|
400: ErrorResponseSchema.describe("Customize a `400 Bad Request` response."),
|
|
1424
1559
|
403: ErrorResponseSchema.describe("Customize a `403 Forbidden` response."),
|
|
1425
1560
|
404: ErrorResponseSchema.describe("Customize a `404 Not Found` response."),
|
|
@@ -1432,16 +1567,16 @@ var SitesSchema = z31.record(
|
|
|
1432
1567
|
503: ErrorResponseSchema.describe("Customize a `503 Service Unavailable` response."),
|
|
1433
1568
|
504: ErrorResponseSchema.describe("Customize a `504 Gateway Timeout` response.")
|
|
1434
1569
|
}).optional().describe("Customize the error responses for specific HTTP status codes."),
|
|
1435
|
-
cors:
|
|
1436
|
-
override:
|
|
1570
|
+
cors: z32.object({
|
|
1571
|
+
override: z32.boolean().default(false),
|
|
1437
1572
|
maxAge: DurationSchema.default("365 days"),
|
|
1438
|
-
exposeHeaders:
|
|
1439
|
-
credentials:
|
|
1440
|
-
headers:
|
|
1441
|
-
origins:
|
|
1442
|
-
methods:
|
|
1573
|
+
exposeHeaders: z32.string().array().optional(),
|
|
1574
|
+
credentials: z32.boolean().default(false),
|
|
1575
|
+
headers: z32.string().array().default(["*"]),
|
|
1576
|
+
origins: z32.string().array().default(["*"]),
|
|
1577
|
+
methods: z32.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
|
|
1443
1578
|
}).optional().describe("Specify the cors headers."),
|
|
1444
|
-
security:
|
|
1579
|
+
security: z32.object({
|
|
1445
1580
|
// contentSecurityPolicy: z.object({
|
|
1446
1581
|
// override: z.boolean().default(false),
|
|
1447
1582
|
// policy: z.string(),
|
|
@@ -1483,10 +1618,10 @@ var SitesSchema = z31.record(
|
|
|
1483
1618
|
// reportUri?: string
|
|
1484
1619
|
// }
|
|
1485
1620
|
}).optional().describe("Specify the security policy."),
|
|
1486
|
-
cache:
|
|
1487
|
-
cookies:
|
|
1488
|
-
headers:
|
|
1489
|
-
queries:
|
|
1621
|
+
cache: z32.object({
|
|
1622
|
+
cookies: z32.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
|
|
1623
|
+
headers: z32.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
|
|
1624
|
+
queries: z32.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
|
|
1490
1625
|
}).optional().describe(
|
|
1491
1626
|
"Specifies the cookies, headers, and query values that CloudFront includes in the cache key."
|
|
1492
1627
|
)
|
|
@@ -1494,22 +1629,22 @@ var SitesSchema = z31.record(
|
|
|
1494
1629
|
).optional().describe("Define the sites in your stack.");
|
|
1495
1630
|
|
|
1496
1631
|
// src/feature/store/schema.ts
|
|
1497
|
-
import { z as
|
|
1498
|
-
var StoresSchema =
|
|
1499
|
-
|
|
1632
|
+
import { z as z33 } from "zod";
|
|
1633
|
+
var StoresSchema = z33.union([
|
|
1634
|
+
z33.array(ResourceIdSchema).transform((list4) => {
|
|
1500
1635
|
const stores = {};
|
|
1501
1636
|
for (const key of list4) {
|
|
1502
1637
|
stores[key] = {};
|
|
1503
1638
|
}
|
|
1504
1639
|
return stores;
|
|
1505
1640
|
}),
|
|
1506
|
-
|
|
1641
|
+
z33.record(
|
|
1507
1642
|
ResourceIdSchema,
|
|
1508
|
-
|
|
1643
|
+
z33.object({
|
|
1509
1644
|
// cors: CorsSchema,
|
|
1510
1645
|
// deletionProtection: DeletionProtectionSchema.optional(),
|
|
1511
|
-
versioning:
|
|
1512
|
-
events:
|
|
1646
|
+
versioning: z33.boolean().default(false).describe("Enable versioning of your store."),
|
|
1647
|
+
events: z33.object({
|
|
1513
1648
|
// create
|
|
1514
1649
|
"created:*": FunctionSchema.optional().describe(
|
|
1515
1650
|
"Subscribe to notifications regardless of the API that was used to create an object."
|
|
@@ -1543,22 +1678,22 @@ var StoresSchema = z32.union([
|
|
|
1543
1678
|
|
|
1544
1679
|
// src/feature/table/schema.ts
|
|
1545
1680
|
import { minutes as minutes4, seconds as seconds4 } from "@awsless/duration";
|
|
1546
|
-
import { z as
|
|
1547
|
-
var KeySchema =
|
|
1548
|
-
var TablesSchema =
|
|
1681
|
+
import { z as z34 } from "zod";
|
|
1682
|
+
var KeySchema = z34.string().min(1).max(255);
|
|
1683
|
+
var TablesSchema = z34.record(
|
|
1549
1684
|
ResourceIdSchema,
|
|
1550
|
-
|
|
1685
|
+
z34.object({
|
|
1551
1686
|
hash: KeySchema.describe(
|
|
1552
1687
|
"Specifies the name of the partition / hash key that makes up the primary key for the table."
|
|
1553
1688
|
),
|
|
1554
1689
|
sort: KeySchema.optional().describe(
|
|
1555
1690
|
"Specifies the name of the range / sort key that makes up the primary key for the table."
|
|
1556
1691
|
),
|
|
1557
|
-
fields:
|
|
1692
|
+
fields: z34.record(z34.string(), z34.enum(["string", "number", "binary"])).optional().describe(
|
|
1558
1693
|
'A list of attributes that describe the key schema for the table and indexes. If no attribute field is defined we default to "string".'
|
|
1559
1694
|
),
|
|
1560
|
-
class:
|
|
1561
|
-
pointInTimeRecovery:
|
|
1695
|
+
class: z34.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
|
|
1696
|
+
pointInTimeRecovery: z34.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
|
|
1562
1697
|
ttl: KeySchema.optional().describe(
|
|
1563
1698
|
[
|
|
1564
1699
|
"The name of the TTL attribute used to store the expiration time for items in the table.",
|
|
@@ -1566,8 +1701,8 @@ var TablesSchema = z33.record(
|
|
|
1566
1701
|
].join("\n")
|
|
1567
1702
|
),
|
|
1568
1703
|
// deletionProtection: DeletionProtectionSchema.optional(),
|
|
1569
|
-
stream:
|
|
1570
|
-
type:
|
|
1704
|
+
stream: z34.object({
|
|
1705
|
+
type: z34.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
|
|
1571
1706
|
[
|
|
1572
1707
|
"When an item in the table is modified, you can determines what information is written to the stream for this table.",
|
|
1573
1708
|
"Valid values are:",
|
|
@@ -1577,7 +1712,7 @@ var TablesSchema = z33.record(
|
|
|
1577
1712
|
"- new-and-old-images - Both the new and the old item images of the item are written to the stream."
|
|
1578
1713
|
].join("\n")
|
|
1579
1714
|
),
|
|
1580
|
-
batchSize:
|
|
1715
|
+
batchSize: z34.number().min(1).max(1e4).default(1).describe(
|
|
1581
1716
|
[
|
|
1582
1717
|
"The maximum number of records in each batch that Lambda pulls from your stream and sends to your function.",
|
|
1583
1718
|
"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).",
|
|
@@ -1607,7 +1742,7 @@ var TablesSchema = z33.record(
|
|
|
1607
1742
|
// 'You can specify a number from -1 to 10000.',
|
|
1608
1743
|
// ].join('\n')
|
|
1609
1744
|
// ),
|
|
1610
|
-
retryAttempts:
|
|
1745
|
+
retryAttempts: z34.number().min(-1).max(1e4).default(-1).describe(
|
|
1611
1746
|
[
|
|
1612
1747
|
"Discard records after the specified number of retries.",
|
|
1613
1748
|
"The default value is -1, which sets the maximum number of retries to infinite.",
|
|
@@ -1615,7 +1750,7 @@ var TablesSchema = z33.record(
|
|
|
1615
1750
|
"You can specify a number from -1 to 10000."
|
|
1616
1751
|
].join("\n")
|
|
1617
1752
|
),
|
|
1618
|
-
concurrencyPerShard:
|
|
1753
|
+
concurrencyPerShard: z34.number().min(1).max(10).default(1).describe(
|
|
1619
1754
|
[
|
|
1620
1755
|
"The number of batches to process concurrently from each shard.",
|
|
1621
1756
|
"You can specify a number from 1 to 10."
|
|
@@ -1625,16 +1760,16 @@ var TablesSchema = z33.record(
|
|
|
1625
1760
|
}).optional().describe(
|
|
1626
1761
|
"The settings for the DynamoDB table stream, which capture changes to items stored in the table."
|
|
1627
1762
|
),
|
|
1628
|
-
indexes:
|
|
1629
|
-
|
|
1630
|
-
|
|
1763
|
+
indexes: z34.record(
|
|
1764
|
+
z34.string(),
|
|
1765
|
+
z34.object({
|
|
1631
1766
|
hash: KeySchema.describe(
|
|
1632
1767
|
"Specifies the name of the partition / hash key that makes up the primary key for the global secondary index."
|
|
1633
1768
|
),
|
|
1634
1769
|
sort: KeySchema.optional().describe(
|
|
1635
1770
|
"Specifies the name of the range / sort key that makes up the primary key for the global secondary index."
|
|
1636
1771
|
),
|
|
1637
|
-
projection:
|
|
1772
|
+
projection: z34.enum(["all", "keys-only"]).default("all").describe(
|
|
1638
1773
|
[
|
|
1639
1774
|
"The set of attributes that are projected into the index:",
|
|
1640
1775
|
"- all - All of the table attributes are projected into the index.",
|
|
@@ -1648,11 +1783,11 @@ var TablesSchema = z33.record(
|
|
|
1648
1783
|
).optional().describe("Define the tables in your stack.");
|
|
1649
1784
|
|
|
1650
1785
|
// src/feature/task/schema.ts
|
|
1651
|
-
import { z as
|
|
1652
|
-
var RetryAttemptsSchema2 =
|
|
1786
|
+
import { z as z35 } from "zod";
|
|
1787
|
+
var RetryAttemptsSchema2 = z35.number().int().min(0).max(2).describe(
|
|
1653
1788
|
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
|
|
1654
1789
|
);
|
|
1655
|
-
var TaskSchema =
|
|
1790
|
+
var TaskSchema = z35.union([
|
|
1656
1791
|
LocalFileSchema.transform((file) => ({
|
|
1657
1792
|
consumer: {
|
|
1658
1793
|
code: {
|
|
@@ -1663,33 +1798,33 @@ var TaskSchema = z34.union([
|
|
|
1663
1798
|
},
|
|
1664
1799
|
retryAttempts: void 0
|
|
1665
1800
|
})),
|
|
1666
|
-
|
|
1801
|
+
z35.object({
|
|
1667
1802
|
consumer: FunctionSchema,
|
|
1668
1803
|
retryAttempts: RetryAttemptsSchema2.optional()
|
|
1669
1804
|
})
|
|
1670
1805
|
]);
|
|
1671
|
-
var TasksSchema =
|
|
1806
|
+
var TasksSchema = z35.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
|
|
1672
1807
|
|
|
1673
1808
|
// src/feature/test/schema.ts
|
|
1674
|
-
import { z as
|
|
1675
|
-
var TestsSchema =
|
|
1809
|
+
import { z as z36 } from "zod";
|
|
1810
|
+
var TestsSchema = z36.union([LocalDirectorySchema.transform((v) => [v]), LocalDirectorySchema.array()]).describe("Define the location of your tests for your stack.").optional();
|
|
1676
1811
|
|
|
1677
1812
|
// src/feature/topic/schema.ts
|
|
1678
1813
|
import { kebabCase as kebabCase3 } from "change-case";
|
|
1679
|
-
import { z as
|
|
1680
|
-
var TopicNameSchema =
|
|
1681
|
-
var TopicsSchema =
|
|
1814
|
+
import { z as z37 } from "zod";
|
|
1815
|
+
var TopicNameSchema = z37.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => kebabCase3(value)).describe("Define event topic name.");
|
|
1816
|
+
var TopicsSchema = z37.array(TopicNameSchema).refine((topics) => {
|
|
1682
1817
|
return topics.length === new Set(topics).size;
|
|
1683
1818
|
}, "Must be a list of unique topic names").optional().describe("Define the event topics to publish too in your stack.");
|
|
1684
|
-
var SubscribersSchema =
|
|
1819
|
+
var SubscribersSchema = z37.record(TopicNameSchema, FunctionSchema).optional().describe("Define the event topics to subscribe too in your stack.");
|
|
1685
1820
|
|
|
1686
1821
|
// src/config/stack.ts
|
|
1687
1822
|
var DependsSchema = ResourceIdSchema.array().optional().describe("Define the stacks that this stack is depended on.");
|
|
1688
1823
|
var NameSchema = ResourceIdSchema.refine((name) => !["base", "hostedzones"].includes(name), {
|
|
1689
1824
|
message: `Stack name can't be a reserved name.`
|
|
1690
1825
|
}).describe("Stack name.");
|
|
1691
|
-
var StackSchema =
|
|
1692
|
-
$schema:
|
|
1826
|
+
var StackSchema = z38.object({
|
|
1827
|
+
$schema: z38.string().optional(),
|
|
1693
1828
|
name: NameSchema,
|
|
1694
1829
|
depends: DependsSchema,
|
|
1695
1830
|
commands: CommandsSchema,
|
|
@@ -1756,13 +1891,13 @@ var readConfigWithStage = async (file, stage) => {
|
|
|
1756
1891
|
};
|
|
1757
1892
|
|
|
1758
1893
|
// src/config/load/validate.ts
|
|
1759
|
-
import { z as
|
|
1894
|
+
import { z as z39 } from "zod";
|
|
1760
1895
|
var validateConfig = async (schema, file, data) => {
|
|
1761
1896
|
try {
|
|
1762
1897
|
const result = await schema.parseAsync(data);
|
|
1763
1898
|
return result;
|
|
1764
1899
|
} catch (error) {
|
|
1765
|
-
if (error instanceof
|
|
1900
|
+
if (error instanceof z39.ZodError) {
|
|
1766
1901
|
throw new ConfigError(file, error, data);
|
|
1767
1902
|
}
|
|
1768
1903
|
throw error;
|
|
@@ -4439,11 +4574,7 @@ var BLOCK_DIRECT_ACCESS_TO_CLOUDFRONT = `
|
|
|
4439
4574
|
if (event.request.headers.host.value.includes('cloudfront.net')) {
|
|
4440
4575
|
return {
|
|
4441
4576
|
statusCode: 403,
|
|
4442
|
-
statusDescription: 'Forbidden'
|
|
4443
|
-
body: {
|
|
4444
|
-
encoding: 'text',
|
|
4445
|
-
data: '<html><head><title>403 Forbidden</title></head><body><center><h1>403 Forbidden</h1></center></body></html>'
|
|
4446
|
-
}
|
|
4577
|
+
statusDescription: 'Forbidden'
|
|
4447
4578
|
};
|
|
4448
4579
|
}`;
|
|
4449
4580
|
var SET_S3_ORIGIN = `
|
|
@@ -4580,11 +4711,9 @@ var siteFeature = defineFeature({
|
|
|
4580
4711
|
comment: "Store for static assets"
|
|
4581
4712
|
});
|
|
4582
4713
|
const keys = [];
|
|
4583
|
-
new
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
resolve(keys);
|
|
4587
|
-
})
|
|
4714
|
+
new ImportKeys(group, "keys", {
|
|
4715
|
+
kvsArn: kvs.arn,
|
|
4716
|
+
keys
|
|
4588
4717
|
});
|
|
4589
4718
|
const versions = [];
|
|
4590
4719
|
let functionUrl;
|
|
@@ -7474,7 +7603,7 @@ var domain = (program2) => {
|
|
|
7474
7603
|
import { CloudWatchLogsClient, StartLiveTailCommand } from "@aws-sdk/client-cloudwatch-logs";
|
|
7475
7604
|
import { log as log15 } from "@clack/prompts";
|
|
7476
7605
|
import chalk7 from "chalk";
|
|
7477
|
-
import
|
|
7606
|
+
import chunk2 from "chunk";
|
|
7478
7607
|
import { formatDate } from "date-fns";
|
|
7479
7608
|
import wildstring6 from "wildstring";
|
|
7480
7609
|
var logs = (program2) => {
|
|
@@ -7516,7 +7645,7 @@ var logs = (program2) => {
|
|
|
7516
7645
|
});
|
|
7517
7646
|
const streams = await task("Connecting to the log stream...", async (update) => {
|
|
7518
7647
|
const result = await Promise.all(
|
|
7519
|
-
|
|
7648
|
+
chunk2(logGroupArns, 10).map(async (arns) => {
|
|
7520
7649
|
const command = new StartLiveTailCommand({
|
|
7521
7650
|
logGroupIdentifiers: arns
|
|
7522
7651
|
});
|