@awsless/awsless 0.0.441 → 0.0.443
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.json +1 -1
- package/dist/bin.js +46 -11
- package/dist/build-json-schema.js +596 -593
- package/dist/prebuild/rpc/bundle.zip +0 -0
- package/dist/stack.json +1 -1
- package/package.json +13 -13
|
@@ -1,26 +1,47 @@
|
|
|
1
1
|
// cli/build-json-schema.ts
|
|
2
|
+
import { writeFileSync } from "node:fs";
|
|
3
|
+
import { join as join2 } from "node:path";
|
|
2
4
|
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
3
5
|
|
|
4
|
-
// src/config/
|
|
5
|
-
import { z as
|
|
6
|
+
// src/config/app.ts
|
|
7
|
+
import { z as z24 } from "zod";
|
|
8
|
+
|
|
9
|
+
// src/feature/alert/schema.ts
|
|
10
|
+
import { paramCase } from "change-case";
|
|
11
|
+
import { z as z2 } from "zod";
|
|
12
|
+
|
|
13
|
+
// src/config/schema/email.ts
|
|
14
|
+
import { z } from "zod";
|
|
15
|
+
var EmailSchema = z.string().email();
|
|
16
|
+
|
|
17
|
+
// src/feature/alert/schema.ts
|
|
18
|
+
var AlertNameSchema = z2.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid alert name").transform((value) => paramCase(value)).describe("Define event topic name.");
|
|
19
|
+
var AlertsDefaultSchema = z2.record(
|
|
20
|
+
AlertNameSchema,
|
|
21
|
+
z2.union([
|
|
22
|
+
//
|
|
23
|
+
EmailSchema.transform((v) => [v]),
|
|
24
|
+
EmailSchema.array()
|
|
25
|
+
])
|
|
26
|
+
).optional().describe("Define the alerts in your app. Alerts are a way to send messages to one or more email addresses.");
|
|
6
27
|
|
|
7
28
|
// src/feature/auth/schema.ts
|
|
8
|
-
import { z as
|
|
29
|
+
import { z as z8 } from "zod";
|
|
9
30
|
|
|
10
31
|
// src/config/schema/resource-id.ts
|
|
11
|
-
import { paramCase } from "change-case";
|
|
12
|
-
import { z } from "zod";
|
|
13
|
-
var ResourceIdSchema =
|
|
32
|
+
import { paramCase as paramCase2 } from "change-case";
|
|
33
|
+
import { z as z3 } from "zod";
|
|
34
|
+
var ResourceIdSchema = z3.string().min(3).max(24).regex(/^[a-z0-9\-]+$/i, "Invalid resource ID").transform((value) => paramCase2(value));
|
|
14
35
|
|
|
15
36
|
// src/feature/function/schema.ts
|
|
16
37
|
import { days, minutes, seconds, toDays } from "@awsless/duration";
|
|
17
38
|
import { gibibytes, mebibytes } from "@awsless/size";
|
|
18
|
-
import { z as
|
|
39
|
+
import { z as z7 } from "zod";
|
|
19
40
|
|
|
20
41
|
// src/config/schema/duration.ts
|
|
21
|
-
import { z as
|
|
42
|
+
import { z as z4 } from "zod";
|
|
22
43
|
import { parse } from "@awsless/duration";
|
|
23
|
-
var DurationSchema =
|
|
44
|
+
var DurationSchema = z4.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/, "Invalid duration").transform((v) => parse(v));
|
|
24
45
|
var durationMin = (min) => {
|
|
25
46
|
return (duration) => {
|
|
26
47
|
return duration.value >= min.value;
|
|
@@ -37,7 +58,7 @@ import { stat } from "fs/promises";
|
|
|
37
58
|
|
|
38
59
|
// src/config/schema/relative-path.ts
|
|
39
60
|
import { join } from "path";
|
|
40
|
-
import { z as
|
|
61
|
+
import { z as z5 } from "zod";
|
|
41
62
|
var basePath;
|
|
42
63
|
var resolvePath = (path) => {
|
|
43
64
|
if (path.startsWith(".") && basePath) {
|
|
@@ -45,7 +66,7 @@ var resolvePath = (path) => {
|
|
|
45
66
|
}
|
|
46
67
|
return path;
|
|
47
68
|
};
|
|
48
|
-
var RelativePathSchema =
|
|
69
|
+
var RelativePathSchema = z5.string().transform((path) => resolvePath(path));
|
|
49
70
|
|
|
50
71
|
// src/config/schema/local-directory.ts
|
|
51
72
|
var LocalDirectorySchema = RelativePathSchema.refine(async (path) => {
|
|
@@ -69,9 +90,9 @@ var LocalFileSchema = RelativePathSchema.refine(async (path) => {
|
|
|
69
90
|
}, `File doesn't exist`);
|
|
70
91
|
|
|
71
92
|
// src/config/schema/size.ts
|
|
72
|
-
import { z as
|
|
93
|
+
import { z as z6 } from "zod";
|
|
73
94
|
import { parse as parse2 } from "@awsless/size";
|
|
74
|
-
var SizeSchema =
|
|
95
|
+
var SizeSchema = z6.string().regex(/^[0-9]+ (B|KB|MB|GB|TB|PB)$/, "Invalid size").transform((v) => parse2(v));
|
|
75
96
|
var sizeMin = (min) => {
|
|
76
97
|
return (size) => {
|
|
77
98
|
return size.value >= min.value;
|
|
@@ -94,32 +115,32 @@ var EphemeralStorageSizeSchema = SizeSchema.refine(
|
|
|
94
115
|
sizeMin(mebibytes(512)),
|
|
95
116
|
"Minimum ephemeral storage size is 512 MB"
|
|
96
117
|
).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.");
|
|
97
|
-
var ReservedConcurrentExecutionsSchema =
|
|
98
|
-
var EnvironmentSchema =
|
|
99
|
-
var ArchitectureSchema =
|
|
100
|
-
var RetryAttemptsSchema =
|
|
118
|
+
var ReservedConcurrentExecutionsSchema = z7.number().int().min(0).describe("The number of simultaneous executions to reserve for the function. You can specify a number from 0.");
|
|
119
|
+
var EnvironmentSchema = z7.record(z7.string(), z7.string()).optional().describe("Environment variable key-value pairs.");
|
|
120
|
+
var ArchitectureSchema = z7.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the function supports.");
|
|
121
|
+
var RetryAttemptsSchema = z7.number().int().min(0).max(2).describe(
|
|
101
122
|
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
|
|
102
123
|
);
|
|
103
|
-
var NodeRuntimeSchema =
|
|
104
|
-
var ContainerRuntimeSchema =
|
|
124
|
+
var NodeRuntimeSchema = z7.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x"]);
|
|
125
|
+
var ContainerRuntimeSchema = z7.literal("container");
|
|
105
126
|
var RuntimeSchema = NodeRuntimeSchema.or(ContainerRuntimeSchema).describe("The identifier of the function's runtime.");
|
|
106
|
-
var ActionSchema =
|
|
107
|
-
var ActionsSchema =
|
|
108
|
-
var ArnSchema =
|
|
109
|
-
var WildcardSchema =
|
|
110
|
-
var ResourceSchema =
|
|
111
|
-
var ResourcesSchema =
|
|
112
|
-
var PermissionSchema =
|
|
113
|
-
effect:
|
|
127
|
+
var ActionSchema = z7.string();
|
|
128
|
+
var ActionsSchema = z7.union([ActionSchema.transform((v) => [v]), ActionSchema.array()]);
|
|
129
|
+
var ArnSchema = z7.string().startsWith("arn:").transform((v) => v);
|
|
130
|
+
var WildcardSchema = z7.literal("*");
|
|
131
|
+
var ResourceSchema = z7.union([ArnSchema, WildcardSchema]);
|
|
132
|
+
var ResourcesSchema = z7.union([ResourceSchema.transform((v) => [v]), ResourceSchema.array()]);
|
|
133
|
+
var PermissionSchema = z7.object({
|
|
134
|
+
effect: z7.enum(["allow", "deny"]).default("allow"),
|
|
114
135
|
actions: ActionsSchema,
|
|
115
136
|
resources: ResourcesSchema
|
|
116
137
|
});
|
|
117
|
-
var PermissionsSchema =
|
|
118
|
-
var WarmSchema =
|
|
119
|
-
var VPCSchema =
|
|
120
|
-
var MinifySchema =
|
|
121
|
-
var HandlerSchema =
|
|
122
|
-
var DescriptionSchema =
|
|
138
|
+
var PermissionsSchema = z7.union([PermissionSchema.transform((v) => [v]), PermissionSchema.array()]).describe("Add IAM permissions to your function.");
|
|
139
|
+
var WarmSchema = z7.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.");
|
|
140
|
+
var VPCSchema = z7.boolean().describe("Put the function inside your global VPC.");
|
|
141
|
+
var MinifySchema = z7.boolean().describe("Minify the function code.");
|
|
142
|
+
var HandlerSchema = z7.string().describe("The name of the exported method within your code that Lambda calls to run your function.");
|
|
143
|
+
var DescriptionSchema = z7.string().describe("A description of the function.");
|
|
123
144
|
var validLogRetentionDays = [
|
|
124
145
|
...[1n, 3n, 5n, 7n, 14n, 30n, 60n, 90n, 120n, 150n],
|
|
125
146
|
...[180n, 365n, 400n, 545n, 731n, 1096n, 1827n, 2192n],
|
|
@@ -134,54 +155,54 @@ var LogRetentionSchema = DurationSchema.refine(
|
|
|
134
155
|
},
|
|
135
156
|
`Invalid log retention. Valid days are: ${validLogRetentionDays.map((days3) => `${days3}`).join(", ")}`
|
|
136
157
|
).describe("The log retention duration.");
|
|
137
|
-
var LogSubscriptionSchema =
|
|
158
|
+
var LogSubscriptionSchema = z7.union([
|
|
138
159
|
LocalFileSchema.transform((file) => ({
|
|
139
160
|
file
|
|
140
161
|
})),
|
|
141
|
-
|
|
162
|
+
z7.object({
|
|
142
163
|
subscriber: LocalFileSchema,
|
|
143
|
-
filter:
|
|
164
|
+
filter: z7.string().optional()
|
|
144
165
|
})
|
|
145
166
|
]).describe(
|
|
146
167
|
"Log Subscription allow you to subscribe to a real-time stream of log events and have them delivered to a specific destination"
|
|
147
168
|
);
|
|
148
|
-
var LogSchema =
|
|
149
|
-
|
|
169
|
+
var LogSchema = z7.union([
|
|
170
|
+
z7.boolean().transform((enabled) => ({ retention: enabled ? days(7) : days(0) })),
|
|
150
171
|
LogRetentionSchema.transform((retention) => ({ retention })),
|
|
151
|
-
|
|
172
|
+
z7.object({
|
|
152
173
|
subscription: LogSubscriptionSchema.optional(),
|
|
153
174
|
retention: LogRetentionSchema.optional(),
|
|
154
|
-
format:
|
|
175
|
+
format: z7.enum(["text", "json"]).describe(
|
|
155
176
|
`The format in which Lambda sends your function's application and system logs to CloudWatch. Select between plain text and structured JSON.`
|
|
156
177
|
).optional(),
|
|
157
|
-
system:
|
|
178
|
+
system: z7.enum(["debug", "info", "warn"]).describe(
|
|
158
179
|
"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."
|
|
159
180
|
).optional(),
|
|
160
|
-
level:
|
|
181
|
+
level: z7.enum(["trace", "debug", "info", "warn", "error", "fatal"]).describe(
|
|
161
182
|
"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."
|
|
162
183
|
).optional()
|
|
163
184
|
})
|
|
164
185
|
]).describe("Enable logging to a CloudWatch log group. Providing a duration value will set the log retention time.");
|
|
165
|
-
var LayersSchema =
|
|
186
|
+
var LayersSchema = z7.string().array().describe(
|
|
166
187
|
// `A list of function layers to add to the function's execution environment..`
|
|
167
188
|
`A list of function layers to add to the function's execution environment. Specify each layer by its ARN, including the version.`
|
|
168
189
|
);
|
|
169
|
-
var FileCodeSchema =
|
|
190
|
+
var FileCodeSchema = z7.object({
|
|
170
191
|
file: LocalFileSchema.describe("The file path of the function code."),
|
|
171
192
|
minify: MinifySchema.optional().default(true),
|
|
172
|
-
external:
|
|
193
|
+
external: z7.string().array().optional().describe(`A list of external packages that won't be included in the bundle.`)
|
|
173
194
|
});
|
|
174
|
-
var BundleCodeSchema =
|
|
195
|
+
var BundleCodeSchema = z7.object({
|
|
175
196
|
bundle: LocalDirectorySchema.describe("The directory that needs to be bundled.")
|
|
176
197
|
});
|
|
177
|
-
var CodeSchema =
|
|
198
|
+
var CodeSchema = z7.union([
|
|
178
199
|
LocalFileSchema.transform((file) => ({
|
|
179
200
|
file
|
|
180
201
|
})).pipe(FileCodeSchema),
|
|
181
202
|
FileCodeSchema,
|
|
182
203
|
BundleCodeSchema
|
|
183
204
|
]).describe("Specify the code of your function.");
|
|
184
|
-
var FnSchema =
|
|
205
|
+
var FnSchema = z7.object({
|
|
185
206
|
code: CodeSchema,
|
|
186
207
|
// node
|
|
187
208
|
handler: HandlerSchema.optional(),
|
|
@@ -204,14 +225,14 @@ var FnSchema = z5.object({
|
|
|
204
225
|
environment: EnvironmentSchema.optional(),
|
|
205
226
|
permissions: PermissionsSchema.optional()
|
|
206
227
|
});
|
|
207
|
-
var FunctionSchema =
|
|
228
|
+
var FunctionSchema = z7.union([
|
|
208
229
|
LocalFileSchema.transform((code) => ({
|
|
209
230
|
code
|
|
210
231
|
})).pipe(FnSchema),
|
|
211
232
|
FnSchema
|
|
212
233
|
]);
|
|
213
|
-
var FunctionsSchema =
|
|
214
|
-
var FunctionDefaultSchema =
|
|
234
|
+
var FunctionsSchema = z7.record(ResourceIdSchema, FunctionSchema).optional().describe("Define the functions in your stack.");
|
|
235
|
+
var FunctionDefaultSchema = z7.object({
|
|
215
236
|
runtime: RuntimeSchema.default("nodejs20.x"),
|
|
216
237
|
// node
|
|
217
238
|
handler: HandlerSchema.default("index.default"),
|
|
@@ -239,12 +260,8 @@ var FunctionDefaultSchema = z5.object({
|
|
|
239
260
|
permissions: PermissionsSchema.optional()
|
|
240
261
|
}).default({});
|
|
241
262
|
|
|
242
|
-
// src/config/schema/email.ts
|
|
243
|
-
import { z as z6 } from "zod";
|
|
244
|
-
var EmailSchema = z6.string().email();
|
|
245
|
-
|
|
246
263
|
// src/feature/auth/schema.ts
|
|
247
|
-
var TriggersSchema =
|
|
264
|
+
var TriggersSchema = z8.object({
|
|
248
265
|
beforeToken: FunctionSchema.optional().describe("A pre jwt token generation AWS Lambda trigger."),
|
|
249
266
|
beforeLogin: FunctionSchema.optional().describe("A pre user login AWS Lambda trigger."),
|
|
250
267
|
afterLogin: FunctionSchema.optional().describe("A post user login AWS Lambda trigger."),
|
|
@@ -257,42 +274,42 @@ var TriggersSchema = z7.object({
|
|
|
257
274
|
createChallenge: FunctionSchema.optional().describe("Creates an authentication challenge."),
|
|
258
275
|
verifyChallenge: FunctionSchema.optional().describe("Verifies the authentication challenge response.")
|
|
259
276
|
}).describe("Specifies the configuration for AWS Lambda triggers.");
|
|
260
|
-
var AuthSchema =
|
|
277
|
+
var AuthSchema = z8.record(
|
|
261
278
|
ResourceIdSchema,
|
|
262
|
-
|
|
263
|
-
access:
|
|
279
|
+
z8.object({
|
|
280
|
+
access: z8.boolean().default(false).describe("Give access to every function in this stack to your cognito instance."),
|
|
264
281
|
triggers: TriggersSchema.optional()
|
|
265
282
|
})
|
|
266
283
|
).optional().describe("Define the auth triggers in your stack.");
|
|
267
|
-
var AuthDefaultSchema =
|
|
284
|
+
var AuthDefaultSchema = z8.record(
|
|
268
285
|
ResourceIdSchema,
|
|
269
|
-
|
|
270
|
-
allowUserRegistration:
|
|
271
|
-
messaging:
|
|
286
|
+
z8.object({
|
|
287
|
+
allowUserRegistration: z8.boolean().default(true).describe("Specifies whether users can create an user account or if only the administrator can."),
|
|
288
|
+
messaging: z8.object({
|
|
272
289
|
fromEmail: EmailSchema.describe("Specifies the sender's email address."),
|
|
273
|
-
fromName:
|
|
290
|
+
fromName: z8.string().optional().describe("Specifies the sender's name."),
|
|
274
291
|
replyTo: EmailSchema.optional().describe(
|
|
275
292
|
"The destination to which the receiver of the email should reply."
|
|
276
293
|
)
|
|
277
294
|
}).optional().describe("The email configuration for sending messages."),
|
|
278
295
|
// secret: z.boolean().default(false).describe('Specifies whether you want to generate a client secret.'),
|
|
279
|
-
username:
|
|
280
|
-
emailAlias:
|
|
281
|
-
caseSensitive:
|
|
296
|
+
username: z8.object({
|
|
297
|
+
emailAlias: z8.boolean().default(true).describe("Allow the user email to be used as username."),
|
|
298
|
+
caseSensitive: z8.boolean().default(false).describe(
|
|
282
299
|
"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."
|
|
283
300
|
)
|
|
284
301
|
}).default({}).describe("The username policy."),
|
|
285
|
-
password:
|
|
286
|
-
minLength:
|
|
287
|
-
uppercase:
|
|
288
|
-
lowercase:
|
|
289
|
-
numbers:
|
|
290
|
-
symbols:
|
|
302
|
+
password: z8.object({
|
|
303
|
+
minLength: z8.number().int().min(6).max(99).default(12).describe("Required users to have at least the minimum password length."),
|
|
304
|
+
uppercase: z8.boolean().default(true).describe("Required users to use at least one uppercase letter in their password."),
|
|
305
|
+
lowercase: z8.boolean().default(true).describe("Required users to use at least one lowercase letter in their password."),
|
|
306
|
+
numbers: z8.boolean().default(true).describe("Required users to use at least one number in their password."),
|
|
307
|
+
symbols: z8.boolean().default(true).describe("Required users to use at least one symbol in their password."),
|
|
291
308
|
temporaryPasswordValidity: DurationSchema.default("7 days").describe(
|
|
292
309
|
"The duration a temporary password is valid. If the user doesn't sign in during this time, an administrator must reset their password."
|
|
293
310
|
)
|
|
294
311
|
}).default({}).describe("The password policy."),
|
|
295
|
-
validity:
|
|
312
|
+
validity: z8.object({
|
|
296
313
|
idToken: DurationSchema.default("1 hour").describe(
|
|
297
314
|
"The ID token time limit. After this limit expires, your user can't use their ID token."
|
|
298
315
|
),
|
|
@@ -307,138 +324,40 @@ var AuthDefaultSchema = z7.record(
|
|
|
307
324
|
})
|
|
308
325
|
).default({}).describe("Define the authenticatable users in your app.");
|
|
309
326
|
|
|
310
|
-
// src/feature/
|
|
311
|
-
import { z as z8 } from "zod";
|
|
312
|
-
var TypeSchema = z8.enum([
|
|
313
|
-
"t4g.small",
|
|
314
|
-
"t4g.medium",
|
|
315
|
-
"r6g.large",
|
|
316
|
-
"r6g.xlarge",
|
|
317
|
-
"r6g.2xlarge",
|
|
318
|
-
"r6g.4xlarge",
|
|
319
|
-
"r6g.8xlarge",
|
|
320
|
-
"r6g.12xlarge",
|
|
321
|
-
"r6g.16xlarge",
|
|
322
|
-
"r6gd.xlarge",
|
|
323
|
-
"r6gd.2xlarge",
|
|
324
|
-
"r6gd.4xlarge",
|
|
325
|
-
"r6gd.8xlarge"
|
|
326
|
-
]);
|
|
327
|
-
var PortSchema = z8.number().int().min(1).max(5e4);
|
|
328
|
-
var ShardsSchema = z8.number().int().min(0).max(100);
|
|
329
|
-
var ReplicasPerShardSchema = z8.number().int().min(0).max(5);
|
|
330
|
-
var EngineSchema = z8.enum(["7.0", "6.2"]);
|
|
331
|
-
var CachesSchema = z8.record(
|
|
332
|
-
ResourceIdSchema,
|
|
333
|
-
z8.object({
|
|
334
|
-
type: TypeSchema.default("t4g.small"),
|
|
335
|
-
port: PortSchema.default(6379),
|
|
336
|
-
shards: ShardsSchema.default(1),
|
|
337
|
-
replicasPerShard: ReplicasPerShardSchema.default(1),
|
|
338
|
-
engine: EngineSchema.default("7.0"),
|
|
339
|
-
dataTiering: z8.boolean().default(false)
|
|
340
|
-
})
|
|
341
|
-
).optional().describe("Define the caches in your stack. For access to the cache put your functions inside the global VPC.");
|
|
342
|
-
|
|
343
|
-
// src/feature/command/schema.ts
|
|
327
|
+
// src/feature/domain/schema.ts
|
|
344
328
|
import { z as z9 } from "zod";
|
|
345
|
-
var
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
}),
|
|
353
|
-
LocalFileSchema.transform((file) => ({
|
|
354
|
-
file,
|
|
355
|
-
handler: "default",
|
|
356
|
-
description: void 0
|
|
357
|
-
}))
|
|
358
|
-
]);
|
|
359
|
-
var CommandsSchema = z9.record(ResourceIdSchema, CommandSchema).optional().describe("Define the custom commands for your stack.");
|
|
360
|
-
|
|
361
|
-
// src/feature/config/schema.ts
|
|
362
|
-
import { z as z10 } from "zod";
|
|
363
|
-
var ConfigNameSchema = z10.string().regex(/[a-z0-9\-]/g, "Invalid config name");
|
|
364
|
-
var ConfigsSchema = z10.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
|
|
365
|
-
|
|
366
|
-
// src/feature/cron/schema/index.ts
|
|
367
|
-
import { z as z12 } from "zod";
|
|
368
|
-
|
|
369
|
-
// src/feature/cron/schema/schedule.ts
|
|
370
|
-
import { z as z11 } from "zod";
|
|
371
|
-
import { awsCronExpressionValidator } from "aws-cron-expression-validator";
|
|
372
|
-
var RateExpressionSchema = z11.custom(
|
|
373
|
-
(value) => {
|
|
374
|
-
return z11.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
|
|
375
|
-
const [str] = rate.split(" ");
|
|
376
|
-
const number = parseInt(str);
|
|
377
|
-
return number > 0;
|
|
378
|
-
}).safeParse(value).success;
|
|
379
|
-
},
|
|
380
|
-
{ message: "Invalid rate expression" }
|
|
381
|
-
).transform((rate) => {
|
|
382
|
-
const [str] = rate.split(" ");
|
|
383
|
-
const number = parseInt(str);
|
|
384
|
-
const more = rate.endsWith("s");
|
|
385
|
-
if (more && number === 1) {
|
|
386
|
-
return `rate(${rate.substring(0, rate.length - 1)})`;
|
|
387
|
-
}
|
|
388
|
-
return `rate(${rate})`;
|
|
389
|
-
});
|
|
390
|
-
var CronExpressionSchema = z11.custom(
|
|
391
|
-
(value) => {
|
|
392
|
-
return z11.string().safeParse(value).success;
|
|
393
|
-
},
|
|
394
|
-
{ message: "Invalid cron expression" }
|
|
395
|
-
).superRefine((value, ctx) => {
|
|
396
|
-
try {
|
|
397
|
-
awsCronExpressionValidator(value);
|
|
398
|
-
} catch (error) {
|
|
399
|
-
if (error instanceof Error) {
|
|
400
|
-
ctx.addIssue({
|
|
401
|
-
code: z11.ZodIssueCode.custom,
|
|
402
|
-
message: `Invalid cron expression: ${error.message}`
|
|
403
|
-
});
|
|
404
|
-
} else {
|
|
405
|
-
ctx.addIssue({
|
|
406
|
-
code: z11.ZodIssueCode.custom,
|
|
407
|
-
message: "Invalid cron expression"
|
|
408
|
-
});
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
}).transform((value) => {
|
|
412
|
-
return `cron(${value.trim()})`;
|
|
413
|
-
});
|
|
414
|
-
var ScheduleExpressionSchema = RateExpressionSchema.or(CronExpressionSchema);
|
|
415
|
-
|
|
416
|
-
// src/feature/cron/schema/index.ts
|
|
417
|
-
var CronsSchema = z12.record(
|
|
329
|
+
var DomainNameSchema = z9.string().regex(/[a-z\-\_\.]/g, "Invalid domain name").describe(
|
|
330
|
+
"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."
|
|
331
|
+
);
|
|
332
|
+
var DNSTypeSchema = z9.enum(["A", "AAAA", "CAA", "CNAME", "DS", "MX", "NAPTR", "NS", "PTR", "SOA", "SPF", "SRV", "TXT"]).describe("The DNS record type.");
|
|
333
|
+
var TTLSchema = DurationSchema.describe("The resource record cache time to live (TTL).");
|
|
334
|
+
var RecordsSchema = z9.string().array().describe("One or more values that correspond with the value that you specified for the Type property.");
|
|
335
|
+
var DomainsDefaultSchema = z9.record(
|
|
418
336
|
ResourceIdSchema,
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
337
|
+
z9.object({
|
|
338
|
+
domain: DomainNameSchema.describe("Define the domain name"),
|
|
339
|
+
dns: z9.object({
|
|
340
|
+
name: DomainNameSchema.optional(),
|
|
341
|
+
type: DNSTypeSchema,
|
|
342
|
+
ttl: TTLSchema,
|
|
343
|
+
records: RecordsSchema
|
|
344
|
+
}).array().optional().describe("Define the domain dns records")
|
|
426
345
|
})
|
|
427
|
-
).optional().describe(
|
|
346
|
+
).optional().describe("Define the domains for your application.");
|
|
428
347
|
|
|
429
348
|
// src/feature/graphql/schema.ts
|
|
430
|
-
import { z as
|
|
349
|
+
import { z as z10 } from "zod";
|
|
431
350
|
var AuthorizerTtl = DurationSchema.describe(
|
|
432
351
|
`The number of seconds a response should be cached for. The maximum value is one hour (3600 seconds). The Lambda function can override this by returning a ttlOverride key in its response.`
|
|
433
352
|
);
|
|
434
|
-
var GraphQLDefaultSchema =
|
|
353
|
+
var GraphQLDefaultSchema = z10.record(
|
|
435
354
|
ResourceIdSchema,
|
|
436
|
-
|
|
355
|
+
z10.object({
|
|
437
356
|
domain: ResourceIdSchema.describe("The domain id to link your API with.").optional(),
|
|
438
|
-
subDomain:
|
|
439
|
-
auth:
|
|
357
|
+
subDomain: z10.string().optional(),
|
|
358
|
+
auth: z10.union([
|
|
440
359
|
ResourceIdSchema,
|
|
441
|
-
|
|
360
|
+
z10.object({
|
|
442
361
|
authorizer: FunctionSchema,
|
|
443
362
|
ttl: AuthorizerTtl.default("1 hour")
|
|
444
363
|
})
|
|
@@ -450,22 +369,22 @@ var GraphQLDefaultSchema = z13.record(
|
|
|
450
369
|
resolver: LocalFileSchema.optional()
|
|
451
370
|
})
|
|
452
371
|
).describe(`Define the global GraphQL API's.`).optional();
|
|
453
|
-
var GraphQLSchema =
|
|
372
|
+
var GraphQLSchema = z10.record(
|
|
454
373
|
ResourceIdSchema,
|
|
455
|
-
|
|
374
|
+
z10.object({
|
|
456
375
|
// schema: z.union([LocalFileSchema.transform(v => [v]), z.array(LocalFileSchema).min(1)]).optional(),
|
|
457
376
|
schema: LocalFileSchema.describe("The graphql schema file."),
|
|
458
|
-
resolvers:
|
|
377
|
+
resolvers: z10.record(
|
|
459
378
|
// TypeName
|
|
460
|
-
|
|
461
|
-
|
|
379
|
+
z10.string(),
|
|
380
|
+
z10.record(
|
|
462
381
|
// FieldName
|
|
463
|
-
|
|
464
|
-
|
|
382
|
+
z10.string(),
|
|
383
|
+
z10.union([
|
|
465
384
|
FunctionSchema.transform((consumer) => ({
|
|
466
385
|
consumer
|
|
467
386
|
})),
|
|
468
|
-
|
|
387
|
+
z10.object({
|
|
469
388
|
consumer: FunctionSchema,
|
|
470
389
|
resolver: LocalFileSchema.optional()
|
|
471
390
|
})
|
|
@@ -476,22 +395,22 @@ var GraphQLSchema = z13.record(
|
|
|
476
395
|
).describe("Define the schema & resolvers in your stack for your global GraphQL API.").optional();
|
|
477
396
|
|
|
478
397
|
// src/feature/http/schema.ts
|
|
479
|
-
import { z as
|
|
480
|
-
var RouteSchema =
|
|
481
|
-
var HttpDefaultSchema =
|
|
398
|
+
import { z as z11 } from "zod";
|
|
399
|
+
var RouteSchema = z11.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route").transform((v) => v);
|
|
400
|
+
var HttpDefaultSchema = z11.record(
|
|
482
401
|
ResourceIdSchema,
|
|
483
|
-
|
|
402
|
+
z11.object({
|
|
484
403
|
domain: ResourceIdSchema.describe("The domain id to link your API with."),
|
|
485
|
-
subDomain:
|
|
404
|
+
subDomain: z11.string().optional()
|
|
486
405
|
// auth: ResourceIdSchema.optional(),
|
|
487
406
|
})
|
|
488
407
|
).optional().describe("Define your global HTTP API's.");
|
|
489
|
-
var HttpSchema =
|
|
408
|
+
var HttpSchema = z11.record(ResourceIdSchema, z11.record(RouteSchema, FunctionSchema)).optional().describe("Define routes in your stack for your global HTTP API.");
|
|
490
409
|
|
|
491
410
|
// src/feature/instance/schema.ts
|
|
492
|
-
import { z as
|
|
493
|
-
var ImageSchema =
|
|
494
|
-
var
|
|
411
|
+
import { z as z12 } from "zod";
|
|
412
|
+
var ImageSchema = z12.string().regex(/^ami\-[0-9a-f]+/).describe("The ID of the AMI.");
|
|
413
|
+
var TypeSchema = z12.enum([
|
|
495
414
|
"t3.nano",
|
|
496
415
|
"t3.micro",
|
|
497
416
|
"t3.small",
|
|
@@ -509,39 +428,86 @@ var TypeSchema2 = z15.enum([
|
|
|
509
428
|
"g4ad.xlarge",
|
|
510
429
|
"g4dn.xlarge"
|
|
511
430
|
]).describe(`The instance type.`);
|
|
512
|
-
var
|
|
431
|
+
var CommandSchema = z12.string().describe(`The script you want to execute when the instance starts up.`);
|
|
513
432
|
var CodeSchema2 = LocalDirectorySchema.describe(`The code directory that will be deployed to your instance.`);
|
|
514
|
-
var ConnectSchema =
|
|
515
|
-
var EnvironmentSchema2 =
|
|
516
|
-
var ActionSchema2 =
|
|
517
|
-
var ActionsSchema2 =
|
|
518
|
-
var ArnSchema2 =
|
|
519
|
-
var WildcardSchema2 =
|
|
520
|
-
var ResourceSchema2 =
|
|
521
|
-
var ResourcesSchema2 =
|
|
522
|
-
var PermissionSchema2 =
|
|
523
|
-
effect:
|
|
433
|
+
var ConnectSchema = z12.boolean().describe("Allows you to connect to all instances with an Instance Connect Endpoint.");
|
|
434
|
+
var EnvironmentSchema2 = z12.record(z12.string(), z12.string()).optional().describe("Environment variable key-value pairs.");
|
|
435
|
+
var ActionSchema2 = z12.string();
|
|
436
|
+
var ActionsSchema2 = z12.union([ActionSchema2.transform((v) => [v]), ActionSchema2.array()]);
|
|
437
|
+
var ArnSchema2 = z12.string().startsWith("arn:");
|
|
438
|
+
var WildcardSchema2 = z12.literal("*");
|
|
439
|
+
var ResourceSchema2 = z12.union([ArnSchema2, WildcardSchema2]).transform((v) => v);
|
|
440
|
+
var ResourcesSchema2 = z12.union([ResourceSchema2.transform((v) => [v]), ResourceSchema2.array()]);
|
|
441
|
+
var PermissionSchema2 = z12.object({
|
|
442
|
+
effect: z12.enum(["allow", "deny"]).default("allow"),
|
|
524
443
|
actions: ActionsSchema2,
|
|
525
444
|
resources: ResourcesSchema2
|
|
526
445
|
});
|
|
527
|
-
var PermissionsSchema2 =
|
|
528
|
-
var InstanceDefaultSchema =
|
|
446
|
+
var PermissionsSchema2 = z12.union([PermissionSchema2.transform((v) => [v]), PermissionSchema2.array()]).describe("Add IAM permissions to your instance.");
|
|
447
|
+
var InstanceDefaultSchema = z12.object({
|
|
529
448
|
connect: ConnectSchema.default(false)
|
|
530
449
|
}).default({}).describe("Define the default settings for all instances in your stacks.");
|
|
531
|
-
var InstancesSchema =
|
|
450
|
+
var InstancesSchema = z12.record(
|
|
532
451
|
ResourceIdSchema,
|
|
533
|
-
|
|
452
|
+
z12.object({
|
|
534
453
|
image: ImageSchema,
|
|
535
|
-
type:
|
|
454
|
+
type: TypeSchema,
|
|
536
455
|
code: CodeSchema2,
|
|
537
|
-
user:
|
|
538
|
-
command:
|
|
456
|
+
user: z12.string().default("ec2-user"),
|
|
457
|
+
command: CommandSchema.optional(),
|
|
539
458
|
environment: EnvironmentSchema2.optional(),
|
|
540
459
|
permissions: PermissionsSchema2.optional(),
|
|
541
|
-
waitForTermination:
|
|
460
|
+
waitForTermination: z12.boolean().default(true)
|
|
542
461
|
})
|
|
543
462
|
).optional().describe("Define the instances in your stack.");
|
|
544
463
|
|
|
464
|
+
// src/feature/layer/schema.ts
|
|
465
|
+
import { z as z14 } from "zod";
|
|
466
|
+
|
|
467
|
+
// src/config/schema/lambda.ts
|
|
468
|
+
import { z as z13 } from "zod";
|
|
469
|
+
var ArchitectureSchema2 = z13.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the function supports.");
|
|
470
|
+
var NodeRuntimeSchema2 = z13.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x"]).describe("The identifier of the function's runtime.");
|
|
471
|
+
|
|
472
|
+
// src/feature/layer/schema.ts
|
|
473
|
+
var Schema = z14.object({
|
|
474
|
+
file: LocalFileSchema,
|
|
475
|
+
runtimes: NodeRuntimeSchema2.array().optional(),
|
|
476
|
+
architecture: ArchitectureSchema2.optional(),
|
|
477
|
+
packages: z14.string().array().optional().describe(
|
|
478
|
+
"Define the package names that are available bundled in the layer. Those packages are not bundled while bundling the lambda."
|
|
479
|
+
)
|
|
480
|
+
});
|
|
481
|
+
var LayerSchema = z14.record(
|
|
482
|
+
z14.string(),
|
|
483
|
+
z14.union([
|
|
484
|
+
LocalFileSchema.transform((file) => ({
|
|
485
|
+
file,
|
|
486
|
+
description: void 0
|
|
487
|
+
})),
|
|
488
|
+
Schema
|
|
489
|
+
])
|
|
490
|
+
).optional().describe("Define the lambda layers in your stack.");
|
|
491
|
+
|
|
492
|
+
// src/feature/on-failure/schema.ts
|
|
493
|
+
var OnFailureDefaultSchema = FunctionSchema.optional().describe(
|
|
494
|
+
"Defining a onFailure handler will add a global onFailure handler for the following resources:\n- Async lambda functions\n- SQS queues\n- DynamoDB streams"
|
|
495
|
+
);
|
|
496
|
+
|
|
497
|
+
// src/feature/on-log/schema.ts
|
|
498
|
+
import { z as z15 } from "zod";
|
|
499
|
+
var FilterSchema = z15.enum(["trace", "debug", "info", "warn", "error", "fatal"]).array().describe("The log level that will gets delivered to the consumer.");
|
|
500
|
+
var OnLogDefaultSchema = z15.union([
|
|
501
|
+
FunctionSchema.transform((consumer) => ({
|
|
502
|
+
consumer,
|
|
503
|
+
filter: ["error", "fatal"]
|
|
504
|
+
})),
|
|
505
|
+
z15.object({
|
|
506
|
+
consumer: FunctionSchema,
|
|
507
|
+
filter: FilterSchema
|
|
508
|
+
})
|
|
509
|
+
]).optional().describe("Define a subscription on all Lambda functions logs.");
|
|
510
|
+
|
|
545
511
|
// src/feature/pubsub/schema.ts
|
|
546
512
|
import { z as z16 } from "zod";
|
|
547
513
|
var DomainSchema = ResourceIdSchema.describe("The domain id to link your Pubsub API with.");
|
|
@@ -682,70 +648,360 @@ var RpcDefaultSchema = z20.record(
|
|
|
682
648
|
).describe(`Define the global RPC API's.`).optional();
|
|
683
649
|
var RpcSchema = z20.record(ResourceIdSchema, z20.record(z20.string(), FunctionSchema).describe("The queries for your global RPC API.")).describe("Define the schema in your stack for your global RPC API.").optional();
|
|
684
650
|
|
|
685
|
-
// src/feature/
|
|
686
|
-
import { gibibytes as gibibytes2 } from "@awsless/size";
|
|
651
|
+
// src/feature/store/schema.ts
|
|
687
652
|
import { z as z21 } from "zod";
|
|
688
|
-
var
|
|
689
|
-
var
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
653
|
+
var DeletionProtectionSchema = z21.boolean().describe("Specifies if you want to protect the store from being deleted by awsless.");
|
|
654
|
+
var StoreDefaultSchema = z21.object({
|
|
655
|
+
deletionProtection: DeletionProtectionSchema.optional()
|
|
656
|
+
}).optional();
|
|
657
|
+
var StoresSchema = z21.union([
|
|
658
|
+
z21.array(ResourceIdSchema).transform((list) => {
|
|
659
|
+
const stores = {};
|
|
660
|
+
for (const key of list) {
|
|
661
|
+
stores[key] = {};
|
|
662
|
+
}
|
|
663
|
+
return stores;
|
|
664
|
+
}),
|
|
665
|
+
z21.record(
|
|
666
|
+
ResourceIdSchema,
|
|
667
|
+
z21.object({
|
|
668
|
+
// cors: CorsSchema,
|
|
669
|
+
deletionProtection: DeletionProtectionSchema.optional(),
|
|
670
|
+
versioning: z21.boolean().default(false).describe("Enable versioning of your store."),
|
|
671
|
+
events: z21.object({
|
|
672
|
+
// create
|
|
673
|
+
"created:*": FunctionSchema.optional().describe(
|
|
674
|
+
"Subscribe to notifications regardless of the API that was used to create an object."
|
|
675
|
+
),
|
|
676
|
+
"created:put": FunctionSchema.optional().describe(
|
|
677
|
+
"Subscribe to notifications when an object is created using the PUT API operation."
|
|
678
|
+
),
|
|
679
|
+
"created:post": FunctionSchema.optional().describe(
|
|
680
|
+
"Subscribe to notifications when an object is created using the POST API operation."
|
|
681
|
+
),
|
|
682
|
+
"created:copy": FunctionSchema.optional().describe(
|
|
683
|
+
"Subscribe to notifications when an object is created using the COPY API operation."
|
|
684
|
+
),
|
|
685
|
+
"created:upload": FunctionSchema.optional().describe(
|
|
686
|
+
"Subscribe to notifications when an object multipart upload has been completed."
|
|
687
|
+
),
|
|
688
|
+
// remove
|
|
689
|
+
"removed:*": FunctionSchema.optional().describe(
|
|
690
|
+
"Subscribe to notifications when an object is deleted or a delete marker for a versioned object is created."
|
|
691
|
+
),
|
|
692
|
+
"removed:delete": FunctionSchema.optional().describe(
|
|
693
|
+
"Subscribe to notifications when an object is deleted"
|
|
694
|
+
),
|
|
695
|
+
"removed:marker": FunctionSchema.optional().describe(
|
|
696
|
+
"Subscribe to notifications when a delete marker for a versioned object is created."
|
|
697
|
+
)
|
|
698
|
+
}).optional().describe("Describes the store events you want to subscribe too.")
|
|
699
|
+
})
|
|
700
|
+
)
|
|
701
|
+
]).optional().describe("Define the stores in your stack.");
|
|
702
|
+
|
|
703
|
+
// src/feature/table/schema.ts
|
|
704
|
+
import { z as z22 } from "zod";
|
|
705
|
+
var KeySchema = z22.string().min(1).max(255);
|
|
706
|
+
var DeletionProtectionSchema2 = z22.boolean().describe("Specifies if you want to protect the table from being deleted by awsless.");
|
|
707
|
+
var TableDefaultSchema = z22.object({
|
|
708
|
+
deletionProtection: DeletionProtectionSchema2.optional()
|
|
709
|
+
}).optional();
|
|
710
|
+
var TablesSchema = z22.record(
|
|
711
|
+
ResourceIdSchema,
|
|
712
|
+
z22.object({
|
|
713
|
+
hash: KeySchema.describe(
|
|
714
|
+
"Specifies the name of the partition / hash key that makes up the primary key for the table."
|
|
715
|
+
),
|
|
716
|
+
sort: KeySchema.optional().describe(
|
|
717
|
+
"Specifies the name of the range / sort key that makes up the primary key for the table."
|
|
718
|
+
),
|
|
719
|
+
fields: z22.record(z22.string(), z22.enum(["string", "number", "binary"])).optional().describe(
|
|
720
|
+
'A list of attributes that describe the key schema for the table and indexes. If no attribute field is defined we default to "string".'
|
|
721
|
+
),
|
|
722
|
+
class: z22.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
|
|
723
|
+
pointInTimeRecovery: z22.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
|
|
724
|
+
timeToLiveAttribute: KeySchema.optional().describe(
|
|
725
|
+
"The name of the TTL attribute used to store the expiration time for items in the table. To update this property, you must first disable TTL and then enable TTL with the new attribute name."
|
|
726
|
+
),
|
|
727
|
+
deletionProtection: DeletionProtectionSchema2.optional(),
|
|
728
|
+
stream: z22.object({
|
|
729
|
+
type: z22.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
|
|
730
|
+
"When an item in the table is modified, stream.type determines what information is written to the stream for this table. Valid values are:\n- keys-only - Only the key attributes of the modified item are written to the stream.\n- new-image - The entire item, as it appears after it was modified, is written to the stream.\n- old-image - The entire item, as it appeared before it was modified, is written to the stream.\n- new-and-old-images - Both the new and the old item images of the item are written to the stream."
|
|
731
|
+
),
|
|
732
|
+
consumer: FunctionSchema.describe("The consuming lambda function for the stream")
|
|
733
|
+
}).optional().describe(
|
|
734
|
+
"The settings for the DynamoDB table stream, which capture changes to items stored in the table."
|
|
735
|
+
),
|
|
736
|
+
indexes: z22.record(
|
|
737
|
+
z22.string(),
|
|
738
|
+
z22.object({
|
|
739
|
+
/** Specifies the name of the partition / hash key that makes up the primary key for the global secondary index. */
|
|
740
|
+
hash: KeySchema,
|
|
741
|
+
/** Specifies the name of the range / sort key that makes up the primary key for the global secondary index. */
|
|
742
|
+
sort: KeySchema.optional(),
|
|
743
|
+
/** The set of attributes that are projected into the index:
|
|
744
|
+
* - all - All of the table attributes are projected into the index.
|
|
745
|
+
* - keys-only - Only the index and primary keys are projected into the index.
|
|
746
|
+
* @default 'all'
|
|
747
|
+
*/
|
|
748
|
+
projection: z22.enum(["all", "keys-only"]).default("all")
|
|
749
|
+
})
|
|
750
|
+
).optional().describe("Specifies the global secondary indexes to be created on the table.")
|
|
751
|
+
})
|
|
752
|
+
).optional().describe("Define the tables in your stack.");
|
|
753
|
+
|
|
754
|
+
// src/config/schema/region.ts
|
|
755
|
+
import { z as z23 } from "zod";
|
|
756
|
+
var US = ["us-east-2", "us-east-1", "us-west-1", "us-west-2"];
|
|
757
|
+
var AF = ["af-south-1"];
|
|
758
|
+
var AP = [
|
|
759
|
+
"ap-east-1",
|
|
760
|
+
"ap-south-2",
|
|
761
|
+
"ap-southeast-3",
|
|
762
|
+
"ap-southeast-4",
|
|
763
|
+
"ap-south-1",
|
|
764
|
+
"ap-northeast-3",
|
|
765
|
+
"ap-northeast-2",
|
|
766
|
+
"ap-southeast-1",
|
|
767
|
+
"ap-southeast-2",
|
|
768
|
+
"ap-northeast-1"
|
|
769
|
+
];
|
|
770
|
+
var CA = ["ca-central-1"];
|
|
771
|
+
var EU = [
|
|
772
|
+
"eu-central-1",
|
|
773
|
+
"eu-west-1",
|
|
774
|
+
"eu-west-2",
|
|
775
|
+
"eu-south-1",
|
|
776
|
+
"eu-west-3",
|
|
777
|
+
"eu-south-2",
|
|
778
|
+
"eu-north-1",
|
|
779
|
+
"eu-central-2"
|
|
780
|
+
];
|
|
781
|
+
var ME = ["me-south-1", "me-central-1"];
|
|
782
|
+
var SA = ["sa-east-1"];
|
|
783
|
+
var regions = [...US, ...AF, ...AP, ...CA, ...EU, ...ME, ...SA];
|
|
784
|
+
var RegionSchema = z23.enum(regions);
|
|
785
|
+
|
|
786
|
+
// src/config/app.ts
|
|
787
|
+
var AppSchema = z24.object({
|
|
788
|
+
$schema: z24.string().optional(),
|
|
789
|
+
name: ResourceIdSchema.describe("App name."),
|
|
790
|
+
region: RegionSchema.describe("The AWS region to deploy to."),
|
|
791
|
+
profile: z24.string().describe("The AWS profile to deploy to."),
|
|
792
|
+
// stage: z
|
|
793
|
+
// .string()
|
|
794
|
+
// .regex(/^[a-z]+$/)
|
|
795
|
+
// .default('prod')
|
|
796
|
+
// .describe('The deployment stage.'),
|
|
797
|
+
// onFailure: OnFailureSchema,
|
|
798
|
+
defaults: z24.object({
|
|
799
|
+
onFailure: OnFailureDefaultSchema,
|
|
800
|
+
onLog: OnLogDefaultSchema,
|
|
801
|
+
auth: AuthDefaultSchema,
|
|
802
|
+
domains: DomainsDefaultSchema,
|
|
803
|
+
function: FunctionDefaultSchema,
|
|
804
|
+
instance: InstanceDefaultSchema,
|
|
805
|
+
queue: QueueDefaultSchema,
|
|
806
|
+
graphql: GraphQLDefaultSchema,
|
|
807
|
+
http: HttpDefaultSchema,
|
|
808
|
+
rest: RestDefaultSchema,
|
|
809
|
+
rpc: RpcDefaultSchema,
|
|
810
|
+
pubsub: PubSubDefaultSchema,
|
|
811
|
+
table: TableDefaultSchema,
|
|
812
|
+
store: StoreDefaultSchema,
|
|
813
|
+
alerts: AlertsDefaultSchema,
|
|
814
|
+
layers: LayerSchema
|
|
815
|
+
// dataRetention: z.boolean().describe('Configure how your resources are handled on delete.').default(false),
|
|
816
|
+
}).default({}).describe("Default properties")
|
|
817
|
+
});
|
|
818
|
+
|
|
819
|
+
// src/config/stack.ts
|
|
820
|
+
import { z as z36 } from "zod";
|
|
821
|
+
|
|
822
|
+
// src/feature/cache/schema.ts
|
|
823
|
+
import { z as z25 } from "zod";
|
|
824
|
+
var TypeSchema2 = z25.enum([
|
|
825
|
+
"t4g.small",
|
|
826
|
+
"t4g.medium",
|
|
827
|
+
"r6g.large",
|
|
828
|
+
"r6g.xlarge",
|
|
829
|
+
"r6g.2xlarge",
|
|
830
|
+
"r6g.4xlarge",
|
|
831
|
+
"r6g.8xlarge",
|
|
832
|
+
"r6g.12xlarge",
|
|
833
|
+
"r6g.16xlarge",
|
|
834
|
+
"r6gd.xlarge",
|
|
835
|
+
"r6gd.2xlarge",
|
|
836
|
+
"r6gd.4xlarge",
|
|
837
|
+
"r6gd.8xlarge"
|
|
838
|
+
]);
|
|
839
|
+
var PortSchema = z25.number().int().min(1).max(5e4);
|
|
840
|
+
var ShardsSchema = z25.number().int().min(0).max(100);
|
|
841
|
+
var ReplicasPerShardSchema = z25.number().int().min(0).max(5);
|
|
842
|
+
var EngineSchema = z25.enum(["7.0", "6.2"]);
|
|
843
|
+
var CachesSchema = z25.record(
|
|
844
|
+
ResourceIdSchema,
|
|
845
|
+
z25.object({
|
|
846
|
+
type: TypeSchema2.default("t4g.small"),
|
|
847
|
+
port: PortSchema.default(6379),
|
|
848
|
+
shards: ShardsSchema.default(1),
|
|
849
|
+
replicasPerShard: ReplicasPerShardSchema.default(1),
|
|
850
|
+
engine: EngineSchema.default("7.0"),
|
|
851
|
+
dataTiering: z25.boolean().default(false)
|
|
852
|
+
})
|
|
853
|
+
).optional().describe("Define the caches in your stack. For access to the cache put your functions inside the global VPC.");
|
|
854
|
+
|
|
855
|
+
// src/feature/command/schema.ts
|
|
856
|
+
import { z as z26 } from "zod";
|
|
857
|
+
var CommandSchema2 = z26.union([
|
|
858
|
+
z26.object({
|
|
859
|
+
file: LocalFileSchema,
|
|
860
|
+
handler: z26.string().default("default").describe("The name of the handler that needs to run"),
|
|
861
|
+
description: z26.string().optional().describe("A description of the command")
|
|
862
|
+
// options: z.record(ResourceIdSchema, OptionSchema).optional(),
|
|
863
|
+
// arguments: z.record(ResourceIdSchema, ArgumentSchema).optional(),
|
|
864
|
+
}),
|
|
865
|
+
LocalFileSchema.transform((file) => ({
|
|
866
|
+
file,
|
|
867
|
+
handler: "default",
|
|
868
|
+
description: void 0
|
|
869
|
+
}))
|
|
870
|
+
]);
|
|
871
|
+
var CommandsSchema = z26.record(ResourceIdSchema, CommandSchema2).optional().describe("Define the custom commands for your stack.");
|
|
872
|
+
|
|
873
|
+
// src/feature/config/schema.ts
|
|
874
|
+
import { z as z27 } from "zod";
|
|
875
|
+
var ConfigNameSchema = z27.string().regex(/[a-z0-9\-]/g, "Invalid config name");
|
|
876
|
+
var ConfigsSchema = z27.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
|
|
877
|
+
|
|
878
|
+
// src/feature/cron/schema/index.ts
|
|
879
|
+
import { z as z29 } from "zod";
|
|
880
|
+
|
|
881
|
+
// src/feature/cron/schema/schedule.ts
|
|
882
|
+
import { z as z28 } from "zod";
|
|
883
|
+
import { awsCronExpressionValidator } from "aws-cron-expression-validator";
|
|
884
|
+
var RateExpressionSchema = z28.custom(
|
|
885
|
+
(value) => {
|
|
886
|
+
return z28.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
|
|
887
|
+
const [str] = rate.split(" ");
|
|
888
|
+
const number = parseInt(str);
|
|
889
|
+
return number > 0;
|
|
890
|
+
}).safeParse(value).success;
|
|
891
|
+
},
|
|
892
|
+
{ message: "Invalid rate expression" }
|
|
893
|
+
).transform((rate) => {
|
|
894
|
+
const [str] = rate.split(" ");
|
|
895
|
+
const number = parseInt(str);
|
|
896
|
+
const more = rate.endsWith("s");
|
|
897
|
+
if (more && number === 1) {
|
|
898
|
+
return `rate(${rate.substring(0, rate.length - 1)})`;
|
|
899
|
+
}
|
|
900
|
+
return `rate(${rate})`;
|
|
901
|
+
});
|
|
902
|
+
var CronExpressionSchema = z28.custom(
|
|
903
|
+
(value) => {
|
|
904
|
+
return z28.string().safeParse(value).success;
|
|
905
|
+
},
|
|
906
|
+
{ message: "Invalid cron expression" }
|
|
907
|
+
).superRefine((value, ctx) => {
|
|
908
|
+
try {
|
|
909
|
+
awsCronExpressionValidator(value);
|
|
910
|
+
} catch (error) {
|
|
911
|
+
if (error instanceof Error) {
|
|
912
|
+
ctx.addIssue({
|
|
913
|
+
code: z28.ZodIssueCode.custom,
|
|
914
|
+
message: `Invalid cron expression: ${error.message}`
|
|
915
|
+
});
|
|
916
|
+
} else {
|
|
917
|
+
ctx.addIssue({
|
|
918
|
+
code: z28.ZodIssueCode.custom,
|
|
919
|
+
message: "Invalid cron expression"
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
}).transform((value) => {
|
|
924
|
+
return `cron(${value.trim()})`;
|
|
925
|
+
});
|
|
926
|
+
var ScheduleExpressionSchema = RateExpressionSchema.or(CronExpressionSchema);
|
|
927
|
+
|
|
928
|
+
// src/feature/cron/schema/index.ts
|
|
929
|
+
var CronsSchema = z29.record(
|
|
930
|
+
ResourceIdSchema,
|
|
931
|
+
z29.object({
|
|
932
|
+
enabled: z29.boolean().default(true).describe("If the cron is enabled."),
|
|
933
|
+
consumer: FunctionSchema.describe("The consuming lambda function properties."),
|
|
934
|
+
schedule: ScheduleExpressionSchema.describe(
|
|
935
|
+
'The scheduling expression.\n\nexample: "0 20 * * ? *"\nexample: "5 minutes"'
|
|
936
|
+
),
|
|
937
|
+
payload: z29.unknown().optional().describe("The JSON payload that will be passed to the consumer.")
|
|
938
|
+
})
|
|
939
|
+
).optional().describe(`Define the cron jobs in your stack.`);
|
|
940
|
+
|
|
941
|
+
// src/feature/search/schema.ts
|
|
942
|
+
import { gibibytes as gibibytes2 } from "@awsless/size";
|
|
943
|
+
import { z as z30 } from "zod";
|
|
944
|
+
var VersionSchema = z30.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]);
|
|
945
|
+
var TypeSchema3 = z30.enum([
|
|
946
|
+
"t3.small",
|
|
947
|
+
"t3.medium",
|
|
948
|
+
"m3.medium",
|
|
949
|
+
"m3.large",
|
|
950
|
+
"m3.xlarge",
|
|
951
|
+
"m3.2xlarge",
|
|
952
|
+
"m4.large",
|
|
953
|
+
"m4.xlarge",
|
|
954
|
+
"m4.2xlarge",
|
|
955
|
+
"m4.4xlarge",
|
|
956
|
+
"m4.10xlarge",
|
|
957
|
+
"m5.large",
|
|
958
|
+
"m5.xlarge",
|
|
959
|
+
"m5.2xlarge",
|
|
960
|
+
"m5.4xlarge",
|
|
961
|
+
"m5.12xlarge",
|
|
962
|
+
"m5.24xlarge",
|
|
963
|
+
"r5.large",
|
|
964
|
+
"r5.xlarge",
|
|
965
|
+
"r5.2xlarge",
|
|
966
|
+
"r5.4xlarge",
|
|
967
|
+
"r5.12xlarge",
|
|
968
|
+
"r5.24xlarge",
|
|
969
|
+
"c5.large",
|
|
970
|
+
"c5.xlarge",
|
|
971
|
+
"c5.2xlarge",
|
|
972
|
+
"c5.4xlarge",
|
|
973
|
+
"c5.9xlarge",
|
|
974
|
+
"c5.18xlarge",
|
|
975
|
+
"or1.medium",
|
|
976
|
+
"or1.large",
|
|
977
|
+
"or1.xlarge",
|
|
978
|
+
"or1.2xlarge",
|
|
979
|
+
"or1.4xlarge",
|
|
980
|
+
"or1.8xlarge",
|
|
981
|
+
"or1.12xlarge",
|
|
982
|
+
"or1.16xlarge",
|
|
983
|
+
"ultrawarm1.medium",
|
|
984
|
+
"ultrawarm1.large",
|
|
985
|
+
"ultrawarm1.xlarge",
|
|
986
|
+
"r3.large",
|
|
987
|
+
"r3.xlarge",
|
|
988
|
+
"r3.2xlarge",
|
|
989
|
+
"r3.4xlarge",
|
|
990
|
+
"r3.8xlarge",
|
|
991
|
+
"i2.xlarge",
|
|
992
|
+
"i2.2xlarge",
|
|
993
|
+
"i3.large",
|
|
994
|
+
"i3.xlarge",
|
|
995
|
+
"i3.2xlarge",
|
|
996
|
+
"i3.4xlarge",
|
|
997
|
+
"i3.8xlarge",
|
|
998
|
+
"i3.16xlarge",
|
|
999
|
+
"r6g.large",
|
|
1000
|
+
"r6g.xlarge",
|
|
1001
|
+
"r6g.2xlarge",
|
|
1002
|
+
"r6g.4xlarge",
|
|
1003
|
+
"r6g.8xlarge",
|
|
1004
|
+
"r6g.12xlarge",
|
|
749
1005
|
"m6g.large",
|
|
750
1006
|
"m6g.xlarge",
|
|
751
1007
|
"m6g.2xlarge",
|
|
@@ -761,11 +1017,11 @@ var TypeSchema3 = z21.enum([
|
|
|
761
1017
|
"r6gd.16xlarge"
|
|
762
1018
|
]);
|
|
763
1019
|
var StorageSizeSchema = SizeSchema.refine(sizeMin(gibibytes2(10)), "Minimum storage size is 10 GB").refine(sizeMax(gibibytes2(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.");
|
|
764
|
-
var SearchsSchema =
|
|
1020
|
+
var SearchsSchema = z30.record(
|
|
765
1021
|
ResourceIdSchema,
|
|
766
|
-
|
|
1022
|
+
z30.object({
|
|
767
1023
|
type: TypeSchema3.default("t3.small"),
|
|
768
|
-
count:
|
|
1024
|
+
count: z30.number().int().min(1).default(1),
|
|
769
1025
|
version: VersionSchema.default("2.13"),
|
|
770
1026
|
storage: StorageSizeSchema.default("10 GB")
|
|
771
1027
|
// vpc: z.boolean().default(false),
|
|
@@ -773,29 +1029,29 @@ var SearchsSchema = z21.record(
|
|
|
773
1029
|
).optional().describe("Define the search instances in your stack. Backed by OpenSearch.");
|
|
774
1030
|
|
|
775
1031
|
// src/feature/site/schema.ts
|
|
776
|
-
import { z as
|
|
777
|
-
var ErrorResponsePathSchema =
|
|
1032
|
+
import { z as z31 } from "zod";
|
|
1033
|
+
var ErrorResponsePathSchema = z31.string().describe(
|
|
778
1034
|
"The path to the custom error page that you want to return to the viewer when your origin returns the HTTP status code specified.\n - We recommend that you store custom error pages in an Amazon S3 bucket. If you store custom error pages on an HTTP server and the server starts to return 5xx errors, CloudFront can't get the files that you want to return to viewers because the origin server is unavailable."
|
|
779
1035
|
);
|
|
780
|
-
var StatusCodeSchema =
|
|
1036
|
+
var StatusCodeSchema = z31.number().int().positive().optional().describe(
|
|
781
1037
|
"The HTTP status code that you want CloudFront to return to the viewer along with the custom error page. There are a variety of reasons that you might want CloudFront to return a status code different from the status code that your origin returned to CloudFront, for example:\n- Some Internet devices (some firewalls and corporate proxies, for example) intercept HTTP 4xx and 5xx and prevent the response from being returned to the viewer. If you substitute 200, the response typically won't be intercepted.\n- If you don't care about distinguishing among different client errors or server errors, you can specify 400 or 500 as the ResponseCode for all 4xx or 5xx errors.\n- You might want to return a 200 status code (OK) and static website so your customers don't know that your website is down."
|
|
782
1038
|
);
|
|
783
1039
|
var MinTTLSchema = DurationSchema.describe(
|
|
784
1040
|
"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."
|
|
785
1041
|
);
|
|
786
|
-
var ErrorResponseSchema =
|
|
1042
|
+
var ErrorResponseSchema = z31.union([
|
|
787
1043
|
ErrorResponsePathSchema,
|
|
788
|
-
|
|
1044
|
+
z31.object({
|
|
789
1045
|
path: ErrorResponsePathSchema,
|
|
790
1046
|
statusCode: StatusCodeSchema.optional(),
|
|
791
1047
|
minTTL: MinTTLSchema.optional()
|
|
792
1048
|
})
|
|
793
1049
|
]).optional();
|
|
794
|
-
var SitesSchema =
|
|
1050
|
+
var SitesSchema = z31.record(
|
|
795
1051
|
ResourceIdSchema,
|
|
796
|
-
|
|
1052
|
+
z31.object({
|
|
797
1053
|
domain: ResourceIdSchema.describe("The domain id to link your site with.").optional(),
|
|
798
|
-
subDomain:
|
|
1054
|
+
subDomain: z31.string().optional(),
|
|
799
1055
|
// bind: z
|
|
800
1056
|
// .object({
|
|
801
1057
|
// auth: z.array(ResourceIdSchema),
|
|
@@ -804,11 +1060,11 @@ var SitesSchema = z22.record(
|
|
|
804
1060
|
// // rest: z.array(ResourceIdSchema),
|
|
805
1061
|
// })
|
|
806
1062
|
// .optional(),
|
|
807
|
-
static:
|
|
1063
|
+
static: z31.union([LocalDirectorySchema, z31.boolean()]).optional().describe(
|
|
808
1064
|
"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."
|
|
809
1065
|
),
|
|
810
1066
|
ssr: FunctionSchema.optional().describe("Specifies the ssr file."),
|
|
811
|
-
origin:
|
|
1067
|
+
origin: z31.enum(["ssr-first", "static-first"]).default("static-first").describe("Specifies the origin fallback ordering."),
|
|
812
1068
|
// bind: z.object({
|
|
813
1069
|
// auth:
|
|
814
1070
|
// h
|
|
@@ -821,7 +1077,7 @@ var SitesSchema = z22.record(
|
|
|
821
1077
|
// build: z.string().optional(),
|
|
822
1078
|
// }),
|
|
823
1079
|
// ]),
|
|
824
|
-
errors:
|
|
1080
|
+
errors: z31.object({
|
|
825
1081
|
400: ErrorResponseSchema.describe("Customize a `400 Bad Request` response."),
|
|
826
1082
|
403: ErrorResponseSchema.describe("Customize a `403 Forbidden` response."),
|
|
827
1083
|
404: ErrorResponseSchema.describe("Customize a `404 Not Found` response."),
|
|
@@ -834,16 +1090,16 @@ var SitesSchema = z22.record(
|
|
|
834
1090
|
503: ErrorResponseSchema.describe("Customize a `503 Service Unavailable` response."),
|
|
835
1091
|
504: ErrorResponseSchema.describe("Customize a `504 Gateway Timeout` response.")
|
|
836
1092
|
}).optional().describe("Customize the error responses for specific HTTP status codes."),
|
|
837
|
-
cors:
|
|
838
|
-
override:
|
|
1093
|
+
cors: z31.object({
|
|
1094
|
+
override: z31.boolean().default(false),
|
|
839
1095
|
maxAge: DurationSchema.default("365 days"),
|
|
840
|
-
exposeHeaders:
|
|
841
|
-
credentials:
|
|
842
|
-
headers:
|
|
843
|
-
origins:
|
|
844
|
-
methods:
|
|
1096
|
+
exposeHeaders: z31.string().array().optional(),
|
|
1097
|
+
credentials: z31.boolean().default(false),
|
|
1098
|
+
headers: z31.string().array().default(["*"]),
|
|
1099
|
+
origins: z31.string().array().default(["*"]),
|
|
1100
|
+
methods: z31.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
|
|
845
1101
|
}).optional().describe("Define the cors headers."),
|
|
846
|
-
security:
|
|
1102
|
+
security: z31.object({
|
|
847
1103
|
// contentSecurityPolicy: z.object({
|
|
848
1104
|
// override: z.boolean().default(false),
|
|
849
1105
|
// policy: z.string(),
|
|
@@ -885,148 +1141,45 @@ var SitesSchema = z22.record(
|
|
|
885
1141
|
// reportUri?: string
|
|
886
1142
|
// }
|
|
887
1143
|
}).optional().describe("Define the security policy."),
|
|
888
|
-
cache:
|
|
889
|
-
cookies:
|
|
890
|
-
headers:
|
|
891
|
-
queries:
|
|
1144
|
+
cache: z31.object({
|
|
1145
|
+
cookies: z31.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
|
|
1146
|
+
headers: z31.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
|
|
1147
|
+
queries: z31.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
|
|
892
1148
|
}).optional().describe(
|
|
893
1149
|
"Specifies the cookies, headers, and query values that CloudFront includes in the cache key."
|
|
894
1150
|
)
|
|
895
1151
|
})
|
|
896
1152
|
).optional().describe("Define the sites in your stack.");
|
|
897
1153
|
|
|
898
|
-
// src/feature/store/schema.ts
|
|
899
|
-
import { z as z23 } from "zod";
|
|
900
|
-
var DeletionProtectionSchema = z23.boolean().describe("Specifies if you want to protect the store from being deleted by awsless.");
|
|
901
|
-
var StoreDefaultSchema = z23.object({
|
|
902
|
-
deletionProtection: DeletionProtectionSchema.optional()
|
|
903
|
-
}).optional();
|
|
904
|
-
var StoresSchema = z23.union([
|
|
905
|
-
z23.array(ResourceIdSchema).transform((list) => {
|
|
906
|
-
const stores = {};
|
|
907
|
-
for (const key of list) {
|
|
908
|
-
stores[key] = {};
|
|
909
|
-
}
|
|
910
|
-
return stores;
|
|
911
|
-
}),
|
|
912
|
-
z23.record(
|
|
913
|
-
ResourceIdSchema,
|
|
914
|
-
z23.object({
|
|
915
|
-
// cors: CorsSchema,
|
|
916
|
-
deletionProtection: DeletionProtectionSchema.optional(),
|
|
917
|
-
versioning: z23.boolean().default(false).describe("Enable versioning of your store."),
|
|
918
|
-
events: z23.object({
|
|
919
|
-
// create
|
|
920
|
-
"created:*": FunctionSchema.optional().describe(
|
|
921
|
-
"Subscribe to notifications regardless of the API that was used to create an object."
|
|
922
|
-
),
|
|
923
|
-
"created:put": FunctionSchema.optional().describe(
|
|
924
|
-
"Subscribe to notifications when an object is created using the PUT API operation."
|
|
925
|
-
),
|
|
926
|
-
"created:post": FunctionSchema.optional().describe(
|
|
927
|
-
"Subscribe to notifications when an object is created using the POST API operation."
|
|
928
|
-
),
|
|
929
|
-
"created:copy": FunctionSchema.optional().describe(
|
|
930
|
-
"Subscribe to notifications when an object is created using the COPY API operation."
|
|
931
|
-
),
|
|
932
|
-
"created:upload": FunctionSchema.optional().describe(
|
|
933
|
-
"Subscribe to notifications when an object multipart upload has been completed."
|
|
934
|
-
),
|
|
935
|
-
// remove
|
|
936
|
-
"removed:*": FunctionSchema.optional().describe(
|
|
937
|
-
"Subscribe to notifications when an object is deleted or a delete marker for a versioned object is created."
|
|
938
|
-
),
|
|
939
|
-
"removed:delete": FunctionSchema.optional().describe(
|
|
940
|
-
"Subscribe to notifications when an object is deleted"
|
|
941
|
-
),
|
|
942
|
-
"removed:marker": FunctionSchema.optional().describe(
|
|
943
|
-
"Subscribe to notifications when a delete marker for a versioned object is created."
|
|
944
|
-
)
|
|
945
|
-
}).optional().describe("Describes the store events you want to subscribe too.")
|
|
946
|
-
})
|
|
947
|
-
)
|
|
948
|
-
]).optional().describe("Define the stores in your stack.");
|
|
949
|
-
|
|
950
1154
|
// src/feature/stream/schema.ts
|
|
951
|
-
import { z as
|
|
952
|
-
var LatencyModeSchema =
|
|
1155
|
+
import { z as z32 } from "zod";
|
|
1156
|
+
var LatencyModeSchema = z32.enum(["low", "normal"]).describe(
|
|
953
1157
|
`Channel latency mode. Valid values:
|
|
954
1158
|
- normal: Use "normal" to broadcast and deliver live video up to Full HD.
|
|
955
1159
|
- low: Use "low" for near real-time interactions with viewers.`
|
|
956
1160
|
);
|
|
957
|
-
var TypeSchema4 =
|
|
1161
|
+
var TypeSchema4 = z32.enum(["standard", "basic", "advanced-sd", "advanced-hd"]).describe(`The channel type, which determines the allowable resolution and bitrate.
|
|
958
1162
|
If you exceed the allowable resolution or bitrate, the stream probably will disconnect immediately. Valid values:
|
|
959
1163
|
- standard: Video is transcoded: multiple qualities are generated from the original input to automatically give viewers the best experience for their devices and network conditions. Transcoding allows higher playback quality across a range of download speeds. Resolution can be up to 1080p and bitrate can be up to 8.5 Mbps. Audio is transcoded only for renditions 360p and below; above that, audio is passed through.
|
|
960
1164
|
- basic: Video is transmuxed: Amazon IVS delivers the original input to viewers. The viewer's video-quality choice is limited to the original input. Resolution can be up to 1080p and bitrate can be up to 1.5 Mbps for 480p and up to 3.5 Mbps for resolutions between 480p and 1080p.
|
|
961
1165
|
- advanced-sd: Video is transcoded; multiple qualities are generated from the original input, to automatically give viewers the best experience for their devices and network conditions. Input resolution can be up to 1080p and bitrate can be up to 8.5 Mbps; output is capped at SD quality (480p). You can select an optional transcode preset (see below). Audio for all renditions is transcoded, and an audio-only rendition is available.
|
|
962
1166
|
- advanced-hd: Video is transcoded; multiple qualities are generated from the original input, to automatically give viewers the best experience for their devices and network conditions. Input resolution can be up to 1080p and bitrate can be up to 8.5 Mbps; output is capped at HD quality (720p). You can select an optional transcode preset (see below). Audio for all renditions is transcoded, and an audio-only rendition is available.
|
|
963
1167
|
`);
|
|
964
|
-
var StreamsSchema =
|
|
1168
|
+
var StreamsSchema = z32.record(
|
|
965
1169
|
ResourceIdSchema,
|
|
966
|
-
|
|
1170
|
+
z32.object({
|
|
967
1171
|
type: TypeSchema4.default("standard"),
|
|
968
1172
|
// preset: PresetSchema.optional(),
|
|
969
1173
|
latencyMode: LatencyModeSchema.default("low")
|
|
970
1174
|
})
|
|
971
1175
|
).optional().describe("Define the streams in your stack.");
|
|
972
1176
|
|
|
973
|
-
// src/feature/table/schema.ts
|
|
974
|
-
import { z as z25 } from "zod";
|
|
975
|
-
var KeySchema = z25.string().min(1).max(255);
|
|
976
|
-
var DeletionProtectionSchema2 = z25.boolean().describe("Specifies if you want to protect the table from being deleted by awsless.");
|
|
977
|
-
var TableDefaultSchema = z25.object({
|
|
978
|
-
deletionProtection: DeletionProtectionSchema2.optional()
|
|
979
|
-
}).optional();
|
|
980
|
-
var TablesSchema = z25.record(
|
|
981
|
-
ResourceIdSchema,
|
|
982
|
-
z25.object({
|
|
983
|
-
hash: KeySchema.describe(
|
|
984
|
-
"Specifies the name of the partition / hash key that makes up the primary key for the table."
|
|
985
|
-
),
|
|
986
|
-
sort: KeySchema.optional().describe(
|
|
987
|
-
"Specifies the name of the range / sort key that makes up the primary key for the table."
|
|
988
|
-
),
|
|
989
|
-
fields: z25.record(z25.string(), z25.enum(["string", "number", "binary"])).optional().describe(
|
|
990
|
-
'A list of attributes that describe the key schema for the table and indexes. If no attribute field is defined we default to "string".'
|
|
991
|
-
),
|
|
992
|
-
class: z25.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
|
|
993
|
-
pointInTimeRecovery: z25.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
|
|
994
|
-
timeToLiveAttribute: KeySchema.optional().describe(
|
|
995
|
-
"The name of the TTL attribute used to store the expiration time for items in the table. To update this property, you must first disable TTL and then enable TTL with the new attribute name."
|
|
996
|
-
),
|
|
997
|
-
deletionProtection: DeletionProtectionSchema2.optional(),
|
|
998
|
-
stream: z25.object({
|
|
999
|
-
type: z25.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
|
|
1000
|
-
"When an item in the table is modified, stream.type determines what information is written to the stream for this table. Valid values are:\n- keys-only - Only the key attributes of the modified item are written to the stream.\n- new-image - The entire item, as it appears after it was modified, is written to the stream.\n- old-image - The entire item, as it appeared before it was modified, is written to the stream.\n- new-and-old-images - Both the new and the old item images of the item are written to the stream."
|
|
1001
|
-
),
|
|
1002
|
-
consumer: FunctionSchema.describe("The consuming lambda function for the stream")
|
|
1003
|
-
}).optional().describe(
|
|
1004
|
-
"The settings for the DynamoDB table stream, which capture changes to items stored in the table."
|
|
1005
|
-
),
|
|
1006
|
-
indexes: z25.record(
|
|
1007
|
-
z25.string(),
|
|
1008
|
-
z25.object({
|
|
1009
|
-
/** Specifies the name of the partition / hash key that makes up the primary key for the global secondary index. */
|
|
1010
|
-
hash: KeySchema,
|
|
1011
|
-
/** Specifies the name of the range / sort key that makes up the primary key for the global secondary index. */
|
|
1012
|
-
sort: KeySchema.optional(),
|
|
1013
|
-
/** The set of attributes that are projected into the index:
|
|
1014
|
-
* - all - All of the table attributes are projected into the index.
|
|
1015
|
-
* - keys-only - Only the index and primary keys are projected into the index.
|
|
1016
|
-
* @default 'all'
|
|
1017
|
-
*/
|
|
1018
|
-
projection: z25.enum(["all", "keys-only"]).default("all")
|
|
1019
|
-
})
|
|
1020
|
-
).optional().describe("Specifies the global secondary indexes to be created on the table.")
|
|
1021
|
-
})
|
|
1022
|
-
).optional().describe("Define the tables in your stack.");
|
|
1023
|
-
|
|
1024
1177
|
// src/feature/task/schema.ts
|
|
1025
|
-
import { z as
|
|
1026
|
-
var RetryAttemptsSchema2 =
|
|
1178
|
+
import { z as z33 } from "zod";
|
|
1179
|
+
var RetryAttemptsSchema2 = z33.number().int().min(0).max(2).describe(
|
|
1027
1180
|
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
|
|
1028
1181
|
);
|
|
1029
|
-
var TaskSchema =
|
|
1182
|
+
var TaskSchema = z33.union([
|
|
1030
1183
|
LocalFileSchema.transform((file) => ({
|
|
1031
1184
|
consumer: {
|
|
1032
1185
|
code: {
|
|
@@ -1037,33 +1190,33 @@ var TaskSchema = z26.union([
|
|
|
1037
1190
|
},
|
|
1038
1191
|
retryAttempts: void 0
|
|
1039
1192
|
})),
|
|
1040
|
-
|
|
1193
|
+
z33.object({
|
|
1041
1194
|
consumer: FunctionSchema,
|
|
1042
1195
|
retryAttempts: RetryAttemptsSchema2.optional()
|
|
1043
1196
|
})
|
|
1044
1197
|
]);
|
|
1045
|
-
var TasksSchema =
|
|
1198
|
+
var TasksSchema = z33.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
|
|
1046
1199
|
|
|
1047
1200
|
// src/feature/test/schema.ts
|
|
1048
|
-
import { z as
|
|
1049
|
-
var TestsSchema =
|
|
1201
|
+
import { z as z34 } from "zod";
|
|
1202
|
+
var TestsSchema = z34.union([LocalDirectorySchema.transform((v) => [v]), LocalDirectorySchema.array()]).describe("Define the location of your tests for your stack.").optional();
|
|
1050
1203
|
|
|
1051
1204
|
// src/feature/topic/schema.ts
|
|
1052
|
-
import { paramCase as
|
|
1053
|
-
import { z as
|
|
1054
|
-
var TopicNameSchema =
|
|
1055
|
-
var TopicsSchema =
|
|
1205
|
+
import { paramCase as paramCase3 } from "change-case";
|
|
1206
|
+
import { z as z35 } from "zod";
|
|
1207
|
+
var TopicNameSchema = z35.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => paramCase3(value)).describe("Define event topic name.");
|
|
1208
|
+
var TopicsSchema = z35.array(TopicNameSchema).refine((topics) => {
|
|
1056
1209
|
return topics.length === new Set(topics).size;
|
|
1057
1210
|
}, "Must be a list of unique topic names").optional().describe("Define the event topics to publish too in your stack.");
|
|
1058
|
-
var SubscribersSchema =
|
|
1211
|
+
var SubscribersSchema = z35.record(TopicNameSchema, FunctionSchema).optional().describe("Define the event topics to subscribe too in your stack.");
|
|
1059
1212
|
|
|
1060
1213
|
// src/config/stack.ts
|
|
1061
1214
|
var DependsSchema = ResourceIdSchema.array().optional().describe("Define the stacks that this stack is depended on.");
|
|
1062
1215
|
var NameSchema = ResourceIdSchema.refine((name) => !["base"].includes(name), {
|
|
1063
1216
|
message: `Stack name can't be a reserved name.`
|
|
1064
1217
|
}).describe("Stack name.");
|
|
1065
|
-
var StackSchema =
|
|
1066
|
-
$schema:
|
|
1218
|
+
var StackSchema = z36.object({
|
|
1219
|
+
$schema: z36.string().optional(),
|
|
1067
1220
|
name: NameSchema,
|
|
1068
1221
|
depends: DependsSchema,
|
|
1069
1222
|
commands: CommandsSchema,
|
|
@@ -1091,164 +1244,14 @@ var StackSchema = z29.object({
|
|
|
1091
1244
|
tests: TestsSchema
|
|
1092
1245
|
});
|
|
1093
1246
|
|
|
1094
|
-
// src/config/app.ts
|
|
1095
|
-
import { z as z36 } from "zod";
|
|
1096
|
-
|
|
1097
|
-
// src/feature/alert/schema.ts
|
|
1098
|
-
import { paramCase as paramCase3 } from "change-case";
|
|
1099
|
-
import { z as z30 } from "zod";
|
|
1100
|
-
var AlertNameSchema = z30.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid alert name").transform((value) => paramCase3(value)).describe("Define event topic name.");
|
|
1101
|
-
var AlertsDefaultSchema = z30.record(
|
|
1102
|
-
AlertNameSchema,
|
|
1103
|
-
z30.union([
|
|
1104
|
-
//
|
|
1105
|
-
EmailSchema.transform((v) => [v]),
|
|
1106
|
-
EmailSchema.array()
|
|
1107
|
-
])
|
|
1108
|
-
).optional().describe("Define the alerts in your app. Alerts are a way to send messages to one or more email addresses.");
|
|
1109
|
-
|
|
1110
|
-
// src/feature/domain/schema.ts
|
|
1111
|
-
import { z as z31 } from "zod";
|
|
1112
|
-
var DomainNameSchema = z31.string().regex(/[a-z\-\_\.]/g, "Invalid domain name").describe(
|
|
1113
|
-
"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."
|
|
1114
|
-
);
|
|
1115
|
-
var DNSTypeSchema = z31.enum(["A", "AAAA", "CAA", "CNAME", "DS", "MX", "NAPTR", "NS", "PTR", "SOA", "SPF", "SRV", "TXT"]).describe("The DNS record type.");
|
|
1116
|
-
var TTLSchema = DurationSchema.describe("The resource record cache time to live (TTL).");
|
|
1117
|
-
var RecordsSchema = z31.string().array().describe("One or more values that correspond with the value that you specified for the Type property.");
|
|
1118
|
-
var DomainsDefaultSchema = z31.record(
|
|
1119
|
-
ResourceIdSchema,
|
|
1120
|
-
z31.object({
|
|
1121
|
-
domain: DomainNameSchema.describe("Define the domain name"),
|
|
1122
|
-
dns: z31.object({
|
|
1123
|
-
name: DomainNameSchema.optional(),
|
|
1124
|
-
type: DNSTypeSchema,
|
|
1125
|
-
ttl: TTLSchema,
|
|
1126
|
-
records: RecordsSchema
|
|
1127
|
-
}).array().optional().describe("Define the domain dns records")
|
|
1128
|
-
})
|
|
1129
|
-
).optional().describe("Define the domains for your application.");
|
|
1130
|
-
|
|
1131
|
-
// src/feature/layer/schema.ts
|
|
1132
|
-
import { z as z33 } from "zod";
|
|
1133
|
-
|
|
1134
|
-
// src/config/schema/lambda.ts
|
|
1135
|
-
import { z as z32 } from "zod";
|
|
1136
|
-
var ArchitectureSchema2 = z32.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the function supports.");
|
|
1137
|
-
var NodeRuntimeSchema2 = z32.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x"]).describe("The identifier of the function's runtime.");
|
|
1138
|
-
|
|
1139
|
-
// src/feature/layer/schema.ts
|
|
1140
|
-
var Schema = z33.object({
|
|
1141
|
-
file: LocalFileSchema,
|
|
1142
|
-
runtimes: NodeRuntimeSchema2.array().optional(),
|
|
1143
|
-
architecture: ArchitectureSchema2.optional(),
|
|
1144
|
-
packages: z33.string().array().optional().describe(
|
|
1145
|
-
"Define the package names that are available bundled in the layer. Those packages are not bundled while bundling the lambda."
|
|
1146
|
-
)
|
|
1147
|
-
});
|
|
1148
|
-
var LayerSchema = z33.record(
|
|
1149
|
-
z33.string(),
|
|
1150
|
-
z33.union([
|
|
1151
|
-
LocalFileSchema.transform((file) => ({
|
|
1152
|
-
file,
|
|
1153
|
-
description: void 0
|
|
1154
|
-
})),
|
|
1155
|
-
Schema
|
|
1156
|
-
])
|
|
1157
|
-
).optional().describe("Define the lambda layers in your stack.");
|
|
1158
|
-
|
|
1159
|
-
// src/feature/on-failure/schema.ts
|
|
1160
|
-
var OnFailureDefaultSchema = FunctionSchema.optional().describe(
|
|
1161
|
-
"Defining a onFailure handler will add a global onFailure handler for the following resources:\n- Async lambda functions\n- SQS queues\n- DynamoDB streams"
|
|
1162
|
-
);
|
|
1163
|
-
|
|
1164
|
-
// src/feature/on-log/schema.ts
|
|
1165
|
-
import { z as z34 } from "zod";
|
|
1166
|
-
var FilterSchema = z34.enum(["trace", "debug", "info", "warn", "error", "fatal"]).array().describe("The log level that will gets delivered to the consumer.");
|
|
1167
|
-
var OnLogDefaultSchema = z34.union([
|
|
1168
|
-
FunctionSchema.transform((consumer) => ({
|
|
1169
|
-
consumer,
|
|
1170
|
-
filter: ["error", "fatal"]
|
|
1171
|
-
})),
|
|
1172
|
-
z34.object({
|
|
1173
|
-
consumer: FunctionSchema,
|
|
1174
|
-
filter: FilterSchema
|
|
1175
|
-
})
|
|
1176
|
-
]).optional().describe("Define a subscription on all Lambda functions logs.");
|
|
1177
|
-
|
|
1178
|
-
// src/config/schema/region.ts
|
|
1179
|
-
import { z as z35 } from "zod";
|
|
1180
|
-
var US = ["us-east-2", "us-east-1", "us-west-1", "us-west-2"];
|
|
1181
|
-
var AF = ["af-south-1"];
|
|
1182
|
-
var AP = [
|
|
1183
|
-
"ap-east-1",
|
|
1184
|
-
"ap-south-2",
|
|
1185
|
-
"ap-southeast-3",
|
|
1186
|
-
"ap-southeast-4",
|
|
1187
|
-
"ap-south-1",
|
|
1188
|
-
"ap-northeast-3",
|
|
1189
|
-
"ap-northeast-2",
|
|
1190
|
-
"ap-southeast-1",
|
|
1191
|
-
"ap-southeast-2",
|
|
1192
|
-
"ap-northeast-1"
|
|
1193
|
-
];
|
|
1194
|
-
var CA = ["ca-central-1"];
|
|
1195
|
-
var EU = [
|
|
1196
|
-
"eu-central-1",
|
|
1197
|
-
"eu-west-1",
|
|
1198
|
-
"eu-west-2",
|
|
1199
|
-
"eu-south-1",
|
|
1200
|
-
"eu-west-3",
|
|
1201
|
-
"eu-south-2",
|
|
1202
|
-
"eu-north-1",
|
|
1203
|
-
"eu-central-2"
|
|
1204
|
-
];
|
|
1205
|
-
var ME = ["me-south-1", "me-central-1"];
|
|
1206
|
-
var SA = ["sa-east-1"];
|
|
1207
|
-
var regions = [...US, ...AF, ...AP, ...CA, ...EU, ...ME, ...SA];
|
|
1208
|
-
var RegionSchema = z35.enum(regions);
|
|
1209
|
-
|
|
1210
|
-
// src/config/app.ts
|
|
1211
|
-
var AppSchema = z36.object({
|
|
1212
|
-
$schema: z36.string().optional(),
|
|
1213
|
-
name: ResourceIdSchema.describe("App name."),
|
|
1214
|
-
region: RegionSchema.describe("The AWS region to deploy to."),
|
|
1215
|
-
profile: z36.string().describe("The AWS profile to deploy to."),
|
|
1216
|
-
// stage: z
|
|
1217
|
-
// .string()
|
|
1218
|
-
// .regex(/^[a-z]+$/)
|
|
1219
|
-
// .default('prod')
|
|
1220
|
-
// .describe('The deployment stage.'),
|
|
1221
|
-
// onFailure: OnFailureSchema,
|
|
1222
|
-
defaults: z36.object({
|
|
1223
|
-
onFailure: OnFailureDefaultSchema,
|
|
1224
|
-
onLog: OnLogDefaultSchema,
|
|
1225
|
-
auth: AuthDefaultSchema,
|
|
1226
|
-
domains: DomainsDefaultSchema,
|
|
1227
|
-
function: FunctionDefaultSchema,
|
|
1228
|
-
instance: InstanceDefaultSchema,
|
|
1229
|
-
queue: QueueDefaultSchema,
|
|
1230
|
-
graphql: GraphQLDefaultSchema,
|
|
1231
|
-
http: HttpDefaultSchema,
|
|
1232
|
-
rest: RestDefaultSchema,
|
|
1233
|
-
rpc: RpcDefaultSchema,
|
|
1234
|
-
pubsub: PubSubDefaultSchema,
|
|
1235
|
-
table: TableDefaultSchema,
|
|
1236
|
-
store: StoreDefaultSchema,
|
|
1237
|
-
alerts: AlertsDefaultSchema,
|
|
1238
|
-
layers: LayerSchema
|
|
1239
|
-
// dataRetention: z.boolean().describe('Configure how your resources are handled on delete.').default(false),
|
|
1240
|
-
}).default({}).describe("Default properties")
|
|
1241
|
-
});
|
|
1242
|
-
|
|
1243
1247
|
// cli/build-json-schema.ts
|
|
1244
|
-
import { writeFileSync } from "node:fs";
|
|
1245
|
-
import { join as join2 } from "node:path";
|
|
1246
1248
|
var generateJsonSchema = (props) => {
|
|
1247
1249
|
const file = join2(process.cwd(), `dist/${props.name}.json`);
|
|
1248
1250
|
const schema = zodToJsonSchema(props.schema, {
|
|
1249
1251
|
name: props.name,
|
|
1250
1252
|
// errorMessages: true,
|
|
1251
1253
|
markdownDescription: true,
|
|
1254
|
+
pipeStrategy: "input",
|
|
1252
1255
|
$refStrategy: "none"
|
|
1253
1256
|
});
|
|
1254
1257
|
appendDefaults(schema);
|