@awsless/cli 0.0.45 → 0.0.46-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.json +1 -1
- package/dist/app.stage.json +1 -1
- package/dist/bin.js +4410 -4215
- package/dist/build-json-schema.js +272 -447
- package/dist/handlers/bundle.mjs +534 -0
- package/dist/handlers/icon.mjs +104 -0
- package/dist/handlers/image.mjs +136 -0
- package/dist/handlers/on-error-log.mjs +177 -0
- package/dist/handlers/on-failure.mjs +138 -0
- package/dist/handlers/pubsub-publisher.mjs +43 -0
- package/dist/handlers/pubsub-server.mjs +63196 -0
- package/dist/handlers/rpc.mjs +465 -0
- package/dist/stack.json +1 -1
- package/dist/stack.stage.json +1 -1
- package/dist/test-global-setup.js +1 -0
- package/package.json +18 -24
- package/dist/prebuild/icon/HASH +0 -1
- package/dist/prebuild/icon/bundle.zip +0 -0
- package/dist/prebuild/image/HASH +0 -1
- package/dist/prebuild/image/bundle.zip +0 -0
- package/dist/prebuild/on-error-log/HASH +0 -1
- package/dist/prebuild/on-error-log/bundle.zip +0 -0
- package/dist/prebuild/on-failure/HASH +0 -1
- package/dist/prebuild/on-failure/bundle.zip +0 -0
- package/dist/prebuild/pubsub-publisher/HASH +0 -1
- package/dist/prebuild/pubsub-publisher/bundle.zip +0 -0
- package/dist/prebuild/pubsub-server/HASH +0 -1
- package/dist/prebuild/pubsub-server/index.mjs +0 -236
- package/dist/prebuild/rpc/HASH +0 -1
- package/dist/prebuild/rpc/bundle.zip +0 -0
- package/dist/prebuild.js +0 -192
|
@@ -4,7 +4,7 @@ import { join as join2 } from "path";
|
|
|
4
4
|
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
5
5
|
|
|
6
6
|
// src/config/app.ts
|
|
7
|
-
import { z as
|
|
7
|
+
import { z as z25 } from "zod";
|
|
8
8
|
|
|
9
9
|
// src/feature/alert/schema.ts
|
|
10
10
|
import { kebabCase } from "change-case";
|
|
@@ -120,9 +120,9 @@ var DomainsDefaultSchema = z6.record(
|
|
|
120
120
|
// src/feature/function/schema.ts
|
|
121
121
|
import { days, minutes, seconds, toDays } from "@awsless/duration";
|
|
122
122
|
import { gibibytes, mebibytes } from "@awsless/size";
|
|
123
|
-
import { z as
|
|
123
|
+
import { z as z10 } from "zod";
|
|
124
124
|
|
|
125
|
-
// src/config/schema/local-
|
|
125
|
+
// src/config/schema/local-file.ts
|
|
126
126
|
import { stat } from "fs/promises";
|
|
127
127
|
import { z as z8 } from "zod";
|
|
128
128
|
|
|
@@ -138,44 +138,25 @@ var resolvePath = (path) => {
|
|
|
138
138
|
};
|
|
139
139
|
var RelativePathSchema = z7.string().transform((path) => resolvePath(path));
|
|
140
140
|
|
|
141
|
-
// src/config/schema/local-directory.ts
|
|
142
|
-
var LocalDirectorySchema = z8.union([
|
|
143
|
-
RelativePathSchema.refine(async (path) => {
|
|
144
|
-
try {
|
|
145
|
-
const s = await stat(path);
|
|
146
|
-
return s.isDirectory();
|
|
147
|
-
} catch (error) {
|
|
148
|
-
return false;
|
|
149
|
-
}
|
|
150
|
-
}, `Directory doesn't exist`),
|
|
151
|
-
z8.object({
|
|
152
|
-
nocheck: RelativePathSchema.describe(
|
|
153
|
-
"Specifies a local directory without checking if the directory exists."
|
|
154
|
-
)
|
|
155
|
-
}).transform((v) => v.nocheck)
|
|
156
|
-
]);
|
|
157
|
-
|
|
158
141
|
// src/config/schema/local-file.ts
|
|
159
|
-
|
|
160
|
-
import { z as z9 } from "zod";
|
|
161
|
-
var LocalFileSchema = z9.union([
|
|
142
|
+
var LocalFileSchema = z8.union([
|
|
162
143
|
RelativePathSchema.refine(async (path) => {
|
|
163
144
|
try {
|
|
164
|
-
const s = await
|
|
145
|
+
const s = await stat(path);
|
|
165
146
|
return s.isFile();
|
|
166
147
|
} catch (error) {
|
|
167
148
|
return false;
|
|
168
149
|
}
|
|
169
150
|
}, `File doesn't exist`),
|
|
170
|
-
|
|
151
|
+
z8.object({
|
|
171
152
|
nocheck: RelativePathSchema.describe("Specifies a local file without checking if the file exists.")
|
|
172
153
|
}).transform((v) => v.nocheck)
|
|
173
154
|
]);
|
|
174
155
|
|
|
175
156
|
// src/config/schema/size.ts
|
|
176
157
|
import { parse as parse2 } from "@awsless/size";
|
|
177
|
-
import { z as
|
|
178
|
-
var SizeSchema =
|
|
158
|
+
import { z as z9 } from "zod";
|
|
159
|
+
var SizeSchema = z9.string().regex(/^[0-9]+ (B|KB|MB|GB|TB|PB)$/, "Invalid size").transform((v) => parse2(v));
|
|
179
160
|
var sizeMin = (min) => {
|
|
180
161
|
return (size) => {
|
|
181
162
|
return size.value >= min.value;
|
|
@@ -194,33 +175,23 @@ var MemorySizeSchema = SizeSchema.refine(sizeMin(mebibytes(128)), "Minimum memor
|
|
|
194
175
|
var TimeoutSchema = DurationSchema.refine(durationMin(seconds(10)), "Minimum timeout duration is 10 seconds").refine(durationMax(minutes(15)), "Maximum timeout duration is 15 minutes").describe(
|
|
195
176
|
"The amount of time that Lambda allows a function to run before stopping it. You can specify a size value from 1 second to 15 minutes."
|
|
196
177
|
);
|
|
197
|
-
var
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
var
|
|
202
|
-
var
|
|
203
|
-
var
|
|
204
|
-
var
|
|
205
|
-
var
|
|
206
|
-
var
|
|
207
|
-
|
|
208
|
-
var ActionsSchema = z11.union([ActionSchema.transform((v) => [v]), ActionSchema.array()]);
|
|
209
|
-
var ArnSchema = z11.string().startsWith("arn:");
|
|
210
|
-
var WildcardSchema = z11.literal("*");
|
|
211
|
-
var ResourceSchema = z11.union([ArnSchema, WildcardSchema]);
|
|
212
|
-
var ResourcesSchema = z11.union([ResourceSchema.transform((v) => [v]), ResourceSchema.array()]);
|
|
213
|
-
var PermissionSchema = z11.object({
|
|
214
|
-
effect: z11.enum(["allow", "deny"]).default("allow"),
|
|
178
|
+
var EnvironmentSchema = z10.record(z10.string(), z10.string()).optional().describe("Environment variable key-value pairs.");
|
|
179
|
+
var ArchitectureSchema = z10.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the function supports.");
|
|
180
|
+
var RuntimeSchema = z10.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x", "nodejs24.x"]).or(z10.literal("container")).or(z10.string()).describe("The identifier of the function's runtime.");
|
|
181
|
+
var ActionSchema = z10.string();
|
|
182
|
+
var ActionsSchema = z10.union([ActionSchema.transform((v) => [v]), ActionSchema.array()]);
|
|
183
|
+
var ArnSchema = z10.string().startsWith("arn:");
|
|
184
|
+
var WildcardSchema = z10.literal("*");
|
|
185
|
+
var ResourceSchema = z10.union([ArnSchema, WildcardSchema]);
|
|
186
|
+
var ResourcesSchema = z10.union([ResourceSchema.transform((v) => [v]), ResourceSchema.array()]);
|
|
187
|
+
var PermissionSchema = z10.object({
|
|
188
|
+
effect: z10.enum(["allow", "deny"]).default("allow"),
|
|
215
189
|
actions: ActionsSchema,
|
|
216
190
|
resources: ResourcesSchema
|
|
217
191
|
});
|
|
218
|
-
var PermissionsSchema =
|
|
219
|
-
var
|
|
220
|
-
var
|
|
221
|
-
var MinifySchema = z11.boolean().describe("Minify the function code.");
|
|
222
|
-
var HandlerSchema = z11.string().describe("The name of the exported method within your code that Lambda calls to run your function.");
|
|
223
|
-
var DescriptionSchema = z11.string().describe("A description of the function.");
|
|
192
|
+
var PermissionsSchema = z10.union([PermissionSchema.transform((v) => [v]), PermissionSchema.array()]).describe("Add IAM permissions to your function.");
|
|
193
|
+
var MinifySchema = z10.boolean().describe("Minify the function code.");
|
|
194
|
+
var HandlerSchema = z10.string().describe("The name of the exported method within your code that Lambda calls to run your function.");
|
|
224
195
|
var validLogRetentionDays = [
|
|
225
196
|
...[1, 3, 5, 7, 14, 30, 60, 90, 120, 150],
|
|
226
197
|
...[180, 365, 400, 545, 731, 1096, 1827, 2192],
|
|
@@ -235,128 +206,84 @@ var LogRetentionSchema = DurationSchema.refine(
|
|
|
235
206
|
},
|
|
236
207
|
`Invalid log retention. Valid days are: ${validLogRetentionDays.map((days8) => `${days8}`).join(", ")}`
|
|
237
208
|
).describe("The log retention duration.");
|
|
238
|
-
var LogSchema =
|
|
239
|
-
|
|
209
|
+
var LogSchema = z10.union([
|
|
210
|
+
z10.boolean().transform((enabled) => ({ retention: enabled ? days(7) : days(0) })),
|
|
240
211
|
LogRetentionSchema.transform((retention) => ({ retention })),
|
|
241
|
-
|
|
242
|
-
// subscription: LogSubscriptionSchema.optional(),
|
|
212
|
+
z10.object({
|
|
243
213
|
retention: LogRetentionSchema.optional(),
|
|
244
|
-
format:
|
|
214
|
+
format: z10.enum(["text", "json"]).describe(
|
|
245
215
|
`The format in which Lambda sends your function's application and system logs to CloudWatch. Select between plain text and structured JSON.`
|
|
246
216
|
).optional(),
|
|
247
|
-
system:
|
|
217
|
+
system: z10.enum(["debug", "info", "warn"]).describe(
|
|
248
218
|
"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."
|
|
249
219
|
).optional(),
|
|
250
|
-
level:
|
|
220
|
+
level: z10.enum(["trace", "debug", "info", "warn", "error", "fatal"]).describe(
|
|
251
221
|
"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."
|
|
252
222
|
).optional()
|
|
253
223
|
})
|
|
254
224
|
]).describe("Enable logging to a CloudWatch log group. Providing a duration value will set the log retention time.");
|
|
255
|
-
var
|
|
256
|
-
// `A list of function layers to add to the function's execution environment..`
|
|
257
|
-
`A list of function layers to add to the function's execution environment. Specify each layer by its ARN, including the version.`
|
|
258
|
-
);
|
|
259
|
-
var FileCodeSchema = z11.object({
|
|
225
|
+
var FileCodeSchema = z10.object({
|
|
260
226
|
file: LocalFileSchema.describe("The file path of the function code."),
|
|
261
227
|
minify: MinifySchema.optional().default(true),
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
),
|
|
265
|
-
external: z11.string().array().optional().describe(`A list of external packages that won't be included in the bundle.`),
|
|
266
|
-
importAsString: z11.string().array().optional().describe(`A list of glob patterns, which specifies the files that should be imported as string.`)
|
|
267
|
-
});
|
|
268
|
-
var BundleCodeSchema = z11.object({
|
|
269
|
-
bundle: LocalDirectorySchema.describe("The directory that needs to be bundled.")
|
|
270
|
-
// dir: z.string(),
|
|
271
|
-
// build: z.string(),
|
|
272
|
-
// run: z.string(),
|
|
273
|
-
// cacheKey:
|
|
228
|
+
external: z10.string().array().optional().describe(`A list of external packages that won't be included in the bundle.`),
|
|
229
|
+
importAsString: z10.string().array().optional().describe(`A list of glob patterns, which specifies the files that should be imported as string.`)
|
|
274
230
|
});
|
|
275
|
-
var CodeSchema =
|
|
231
|
+
var CodeSchema = z10.union([
|
|
276
232
|
LocalFileSchema.transform((file) => ({
|
|
277
233
|
file
|
|
278
234
|
})).pipe(FileCodeSchema),
|
|
279
|
-
FileCodeSchema
|
|
280
|
-
BundleCodeSchema
|
|
235
|
+
FileCodeSchema
|
|
281
236
|
]).describe("Specify the code of your function.");
|
|
282
|
-
var FnSchema =
|
|
237
|
+
var FnSchema = z10.object({
|
|
283
238
|
code: CodeSchema,
|
|
284
|
-
|
|
285
|
-
handler: HandlerSchema.optional(),
|
|
286
|
-
// build: BuildSchema.optional(),
|
|
287
|
-
// bundle: BundleSchema.optional(),
|
|
288
|
-
// container
|
|
289
|
-
// ...
|
|
290
|
-
runtime: RuntimeSchema.optional(),
|
|
291
|
-
description: DescriptionSchema.optional(),
|
|
292
|
-
warm: WarmSchema.optional(),
|
|
293
|
-
vpc: VPCSchema.optional(),
|
|
294
|
-
log: LogSchema.optional(),
|
|
295
|
-
timeout: TimeoutSchema.optional(),
|
|
296
|
-
memorySize: MemorySizeSchema.optional(),
|
|
297
|
-
architecture: ArchitectureSchema.optional(),
|
|
298
|
-
ephemeralStorageSize: EphemeralStorageSizeSchema.optional(),
|
|
299
|
-
// retryAttempts: RetryAttemptsSchema.optional(),
|
|
300
|
-
reserved: ReservedConcurrentExecutionsSchema.optional(),
|
|
301
|
-
layers: LayersSchema.optional(),
|
|
302
|
-
environment: EnvironmentSchema.optional(),
|
|
303
|
-
permissions: PermissionsSchema.optional()
|
|
239
|
+
handler: HandlerSchema.optional()
|
|
304
240
|
});
|
|
305
|
-
var FunctionSchema =
|
|
241
|
+
var FunctionSchema = z10.union([
|
|
306
242
|
LocalFileSchema.transform((code) => ({
|
|
307
243
|
code
|
|
308
244
|
})).pipe(FnSchema),
|
|
309
245
|
FnSchema
|
|
310
246
|
]);
|
|
311
|
-
var FunctionsSchema =
|
|
312
|
-
var FunctionDefaultSchema =
|
|
247
|
+
var FunctionsSchema = z10.record(ResourceIdSchema, FunctionSchema).optional().describe("Define the functions in your stack.");
|
|
248
|
+
var FunctionDefaultSchema = z10.object({
|
|
313
249
|
runtime: RuntimeSchema.default("nodejs24.x"),
|
|
314
|
-
// node
|
|
315
250
|
handler: HandlerSchema.default("index.default"),
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
// minify: true,
|
|
319
|
-
// }),
|
|
320
|
-
// container
|
|
321
|
-
warm: WarmSchema.default(0),
|
|
322
|
-
vpc: VPCSchema.default(false),
|
|
251
|
+
minify: MinifySchema.default(true),
|
|
252
|
+
external: z10.string().array().optional().describe(`A list of external packages that won't be included in the bundle.`),
|
|
323
253
|
log: LogSchema.default(true).transform((log) => ({
|
|
324
254
|
retention: log.retention ?? days(7),
|
|
325
255
|
level: "level" in log ? log.level : "error",
|
|
326
256
|
system: "system" in log ? log.system : "warn",
|
|
327
257
|
format: "format" in log ? log.format : "json"
|
|
328
258
|
})),
|
|
329
|
-
|
|
330
|
-
|
|
259
|
+
// The defaults size the shared bundle lambda, which also serves queues, crons & tasks.
|
|
260
|
+
timeout: TimeoutSchema.default("15 minutes"),
|
|
261
|
+
memorySize: MemorySizeSchema.default("1024 MB"),
|
|
331
262
|
architecture: ArchitectureSchema.default("arm64"),
|
|
332
|
-
ephemeralStorageSize: EphemeralStorageSizeSchema.default("512 MB"),
|
|
333
|
-
// retryAttempts: RetryAttemptsSchema.default(2),
|
|
334
|
-
reserved: ReservedConcurrentExecutionsSchema.optional(),
|
|
335
|
-
layers: LayersSchema.optional(),
|
|
336
263
|
environment: EnvironmentSchema.optional(),
|
|
337
264
|
permissions: PermissionsSchema.optional()
|
|
338
265
|
}).default({});
|
|
339
266
|
|
|
340
267
|
// src/feature/layer/schema.ts
|
|
341
|
-
import { z as
|
|
268
|
+
import { z as z12 } from "zod";
|
|
342
269
|
|
|
343
270
|
// src/config/schema/lambda.ts
|
|
344
|
-
import { z as
|
|
345
|
-
var ArchitectureSchema2 =
|
|
346
|
-
var
|
|
271
|
+
import { z as z11 } from "zod";
|
|
272
|
+
var ArchitectureSchema2 = z11.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the function supports.");
|
|
273
|
+
var NodeRuntimeSchema = z11.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x"]).describe("The identifier of the function's runtime.");
|
|
347
274
|
|
|
348
275
|
// src/feature/layer/schema.ts
|
|
349
|
-
var Schema =
|
|
276
|
+
var Schema = z12.object({
|
|
350
277
|
file: LocalFileSchema,
|
|
351
|
-
runtimes:
|
|
278
|
+
runtimes: NodeRuntimeSchema.array().optional(),
|
|
352
279
|
architecture: ArchitectureSchema2.optional(),
|
|
353
|
-
packages:
|
|
280
|
+
packages: z12.string().array().optional().describe(
|
|
354
281
|
"Define the package names that are available bundled in the layer. Those packages are not bundled while bundling the lambda."
|
|
355
282
|
)
|
|
356
283
|
});
|
|
357
|
-
var LayerSchema =
|
|
358
|
-
|
|
359
|
-
|
|
284
|
+
var LayerSchema = z12.record(
|
|
285
|
+
z12.string(),
|
|
286
|
+
z12.union([
|
|
360
287
|
LocalFileSchema.transform((file) => ({
|
|
361
288
|
file,
|
|
362
289
|
description: void 0
|
|
@@ -366,21 +293,16 @@ var LayerSchema = z13.record(
|
|
|
366
293
|
).optional().describe("Define the lambda layers in your stack.");
|
|
367
294
|
|
|
368
295
|
// src/feature/task/schema.ts
|
|
369
|
-
import { z as
|
|
370
|
-
var
|
|
371
|
-
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
|
|
372
|
-
);
|
|
373
|
-
var TaskSchema = z14.union([
|
|
296
|
+
import { z as z13 } from "zod";
|
|
297
|
+
var TaskSchema = z13.union([
|
|
374
298
|
FunctionSchema.transform((consumer) => ({
|
|
375
|
-
consumer
|
|
376
|
-
retryAttempts: 2
|
|
299
|
+
consumer
|
|
377
300
|
})),
|
|
378
|
-
|
|
379
|
-
consumer: FunctionSchema
|
|
380
|
-
retryAttempts: RetryAttemptsSchema.default(2)
|
|
301
|
+
z13.object({
|
|
302
|
+
consumer: FunctionSchema
|
|
381
303
|
})
|
|
382
304
|
]);
|
|
383
|
-
var TasksSchema =
|
|
305
|
+
var TasksSchema = z13.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
|
|
384
306
|
|
|
385
307
|
// src/feature/on-error-log/schema.ts
|
|
386
308
|
var OnErrorLogDefaultSchema = TaskSchema.optional().describe(
|
|
@@ -388,18 +310,18 @@ var OnErrorLogDefaultSchema = TaskSchema.optional().describe(
|
|
|
388
310
|
);
|
|
389
311
|
|
|
390
312
|
// src/feature/on-failure/schema.ts
|
|
391
|
-
import { z as
|
|
392
|
-
var NotifySchema =
|
|
313
|
+
import { z as z14 } from "zod";
|
|
314
|
+
var NotifySchema = z14.union([
|
|
393
315
|
//
|
|
394
316
|
EmailSchema.transform((v) => [v]),
|
|
395
317
|
EmailSchema.array()
|
|
396
318
|
]).describe("Receive an email notification when consuming failure entries goes wrong.");
|
|
397
|
-
var OnFailureDefaultSchema =
|
|
319
|
+
var OnFailureDefaultSchema = z14.union([
|
|
398
320
|
FunctionSchema.transform((consumer) => ({
|
|
399
321
|
consumer,
|
|
400
322
|
notify: []
|
|
401
323
|
})),
|
|
402
|
-
|
|
324
|
+
z14.object({
|
|
403
325
|
consumer: FunctionSchema,
|
|
404
326
|
notify: NotifySchema.optional()
|
|
405
327
|
})
|
|
@@ -417,13 +339,13 @@ var OnFailureDefaultSchema = z15.union([
|
|
|
417
339
|
|
|
418
340
|
// src/feature/pubsub/schema.ts
|
|
419
341
|
import { days as days4 } from "@awsless/duration";
|
|
420
|
-
import { z as
|
|
342
|
+
import { z as z17 } from "zod";
|
|
421
343
|
|
|
422
344
|
// src/feature/instance/schema.ts
|
|
423
345
|
import { days as days2, toDays as toDays2 } from "@awsless/duration";
|
|
424
346
|
import { toMebibytes } from "@awsless/size";
|
|
425
|
-
import { z as
|
|
426
|
-
var CpuSchema =
|
|
347
|
+
import { z as z15 } from "zod";
|
|
348
|
+
var CpuSchema = z15.union([z15.literal(0.25), z15.literal(0.5), z15.literal(1), z15.literal(2), z15.literal(4), z15.literal(8), z15.literal(16)]).transform((v) => `${v} vCPU`).describe(
|
|
427
349
|
"The number of virtual CPU units (vCPU) used by the instance. Valid values: 0.25, 0.5, 1, 2, 4, 8, 16 vCPU."
|
|
428
350
|
);
|
|
429
351
|
var validMemorySize = [
|
|
@@ -463,10 +385,10 @@ var MemorySizeSchema2 = SizeSchema.refine(
|
|
|
463
385
|
(s) => validMemorySize.includes(toMebibytes(s)),
|
|
464
386
|
`Invalid memory size. Allowed sizes: ${validMemorySize.join(", ")} MiB`
|
|
465
387
|
).describe("The amount of memory (in MiB) used by the instance. Valid memory values depend on the CPU configuration.");
|
|
466
|
-
var HealthCheckSchema =
|
|
467
|
-
path:
|
|
388
|
+
var HealthCheckSchema = z15.object({
|
|
389
|
+
path: z15.string().describe("The path that the container runs to determine if it is healthy."),
|
|
468
390
|
interval: DurationSchema.describe("The time period in seconds between each health check execution."),
|
|
469
|
-
retries:
|
|
391
|
+
retries: z15.number().int().min(1).max(10).describe(
|
|
470
392
|
"The number of times to retry a failed health check before the container is considered unhealthy."
|
|
471
393
|
),
|
|
472
394
|
startPeriod: DurationSchema.describe(
|
|
@@ -476,22 +398,22 @@ var HealthCheckSchema = z16.object({
|
|
|
476
398
|
"The time period in seconds to wait for a health check to succeed before it is considered a failure."
|
|
477
399
|
)
|
|
478
400
|
}).describe("The health check command and associated configuration parameters for the container.");
|
|
479
|
-
var EnvironmentSchema2 =
|
|
480
|
-
var ArchitectureSchema3 =
|
|
481
|
-
var ActionSchema2 =
|
|
482
|
-
var ActionsSchema2 =
|
|
483
|
-
var ArnSchema2 =
|
|
484
|
-
var WildcardSchema2 =
|
|
485
|
-
var ResourceSchema2 =
|
|
486
|
-
var ResourcesSchema2 =
|
|
487
|
-
var PermissionSchema2 =
|
|
488
|
-
effect:
|
|
401
|
+
var EnvironmentSchema2 = z15.record(z15.string(), z15.string()).optional().describe("Environment variable key-value pairs.");
|
|
402
|
+
var ArchitectureSchema3 = z15.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the instance supports.");
|
|
403
|
+
var ActionSchema2 = z15.string();
|
|
404
|
+
var ActionsSchema2 = z15.union([ActionSchema2.transform((v) => [v]), ActionSchema2.array()]);
|
|
405
|
+
var ArnSchema2 = z15.string().startsWith("arn:");
|
|
406
|
+
var WildcardSchema2 = z15.literal("*");
|
|
407
|
+
var ResourceSchema2 = z15.union([ArnSchema2, WildcardSchema2]);
|
|
408
|
+
var ResourcesSchema2 = z15.union([ResourceSchema2.transform((v) => [v]), ResourceSchema2.array()]);
|
|
409
|
+
var PermissionSchema2 = z15.object({
|
|
410
|
+
effect: z15.enum(["allow", "deny"]).default("allow"),
|
|
489
411
|
actions: ActionsSchema2,
|
|
490
412
|
resources: ResourcesSchema2
|
|
491
413
|
});
|
|
492
|
-
var PermissionsSchema2 =
|
|
493
|
-
var
|
|
494
|
-
var ImageSchema =
|
|
414
|
+
var PermissionsSchema2 = z15.union([PermissionSchema2.transform((v) => [v]), PermissionSchema2.array()]).describe("Add IAM permissions to your instance.");
|
|
415
|
+
var DescriptionSchema = z15.string().describe("A description of the instance.");
|
|
416
|
+
var ImageSchema = z15.string().optional().describe("The URL of the container image to use. Default: public.ecr.aws/aws-cli/aws-cli:{architecture}");
|
|
495
417
|
var validLogRetentionDays2 = [
|
|
496
418
|
...[1, 3, 5, 7, 14, 30, 60, 90, 120, 150],
|
|
497
419
|
...[180, 365, 400, 545, 731, 1096, 1827, 2192],
|
|
@@ -506,26 +428,26 @@ var LogRetentionSchema2 = DurationSchema.refine(
|
|
|
506
428
|
},
|
|
507
429
|
`Invalid log retention. Valid days are: ${validLogRetentionDays2.map((days8) => `${days8}`).join(", ")}`
|
|
508
430
|
).describe("The log retention duration.");
|
|
509
|
-
var LogSchema2 =
|
|
510
|
-
|
|
431
|
+
var LogSchema2 = z15.union([
|
|
432
|
+
z15.boolean().transform((enabled) => ({ retention: enabled ? days2(7) : days2(0) })),
|
|
511
433
|
LogRetentionSchema2.transform((retention) => ({ retention })),
|
|
512
|
-
|
|
434
|
+
z15.object({
|
|
513
435
|
retention: LogRetentionSchema2.optional()
|
|
514
436
|
})
|
|
515
437
|
]).describe("Enable logging to a CloudWatch log group. Providing a duration value will set the log retention time.");
|
|
516
|
-
var FileCodeSchema2 =
|
|
438
|
+
var FileCodeSchema2 = z15.object({
|
|
517
439
|
file: LocalFileSchema.describe("The file path of the instance code.")
|
|
518
440
|
});
|
|
519
|
-
var CodeSchema2 =
|
|
441
|
+
var CodeSchema2 = z15.union([
|
|
520
442
|
LocalFileSchema.transform((file) => ({
|
|
521
443
|
file
|
|
522
444
|
})).pipe(FileCodeSchema2),
|
|
523
445
|
FileCodeSchema2
|
|
524
446
|
]).describe("Specify the code of your instance.");
|
|
525
|
-
var StartupCommandSchema =
|
|
526
|
-
var ISchema =
|
|
447
|
+
var StartupCommandSchema = z15.union([z15.string().transform((v) => [v]), z15.string().array()]).describe("Optional shell commands to run before the instance program starts.");
|
|
448
|
+
var ISchema = z15.object({
|
|
527
449
|
code: CodeSchema2,
|
|
528
|
-
description:
|
|
450
|
+
description: DescriptionSchema.optional(),
|
|
529
451
|
image: ImageSchema.optional(),
|
|
530
452
|
startupCommand: StartupCommandSchema.optional(),
|
|
531
453
|
log: LogSchema2.optional(),
|
|
@@ -537,14 +459,14 @@ var ISchema = z16.object({
|
|
|
537
459
|
healthCheck: HealthCheckSchema.optional()
|
|
538
460
|
// restartPolicy: RestartPolicySchema.optional(),
|
|
539
461
|
});
|
|
540
|
-
var InstanceSchema =
|
|
462
|
+
var InstanceSchema = z15.union([
|
|
541
463
|
LocalFileSchema.transform((code) => ({
|
|
542
464
|
code
|
|
543
465
|
})).pipe(ISchema),
|
|
544
466
|
ISchema
|
|
545
467
|
]);
|
|
546
|
-
var InstancesSchema =
|
|
547
|
-
var InstanceDefaultSchema =
|
|
468
|
+
var InstancesSchema = z15.record(ResourceIdSchema, InstanceSchema).optional().describe("Define the instances in your stack.");
|
|
469
|
+
var InstanceDefaultSchema = z15.object({
|
|
548
470
|
image: ImageSchema.optional(),
|
|
549
471
|
cpu: CpuSchema.default(0.25),
|
|
550
472
|
memorySize: MemorySizeSchema2.default("512 MB"),
|
|
@@ -560,79 +482,15 @@ var InstanceDefaultSchema = z16.object({
|
|
|
560
482
|
|
|
561
483
|
// src/feature/router/schema.ts
|
|
562
484
|
import { days as days3, minutes as minutes2, parse as parse3 } from "@awsless/duration";
|
|
563
|
-
import { z as
|
|
564
|
-
|
|
565
|
-
// src/error.ts
|
|
566
|
-
var ExpectedError = class extends Error {
|
|
567
|
-
};
|
|
568
|
-
|
|
569
|
-
// src/feature/router/pattern.ts
|
|
570
|
-
var PARAM_TOKEN = /\{([a-zA-Z_][a-zA-Z0-9_]*)\}|\*/g;
|
|
571
|
-
var escapeRegex = (value) => {
|
|
572
|
-
return value.replace(/[|\\{}()[\]^$+*?.\-]/g, "\\$&");
|
|
573
|
-
};
|
|
574
|
-
var compileRoutePattern = (pattern) => {
|
|
575
|
-
if (!pattern.startsWith("/")) {
|
|
576
|
-
throw new ExpectedError(`Route pattern "${pattern}" must start with a slash (/)`);
|
|
577
|
-
}
|
|
578
|
-
if (pattern === "/*") {
|
|
579
|
-
return { key: pattern };
|
|
580
|
-
}
|
|
581
|
-
const params = [];
|
|
582
|
-
let regex = "";
|
|
583
|
-
let stars = 0;
|
|
584
|
-
let last = 0;
|
|
585
|
-
let token;
|
|
586
|
-
PARAM_TOKEN.lastIndex = 0;
|
|
587
|
-
while (token = PARAM_TOKEN.exec(pattern)) {
|
|
588
|
-
regex += escapeRegex(pattern.slice(last, token.index));
|
|
589
|
-
const param = token[1];
|
|
590
|
-
if (param) {
|
|
591
|
-
if (params.includes(param)) {
|
|
592
|
-
throw new ExpectedError(`Duplicate param "${param}" in route pattern "${pattern}"`);
|
|
593
|
-
}
|
|
594
|
-
params.push(param);
|
|
595
|
-
regex += "([^/]+)";
|
|
596
|
-
} else {
|
|
597
|
-
stars++;
|
|
598
|
-
regex += ".*";
|
|
599
|
-
}
|
|
600
|
-
last = PARAM_TOKEN.lastIndex;
|
|
601
|
-
}
|
|
602
|
-
if (params.length === 0 && stars === 0) {
|
|
603
|
-
return { key: pattern };
|
|
604
|
-
}
|
|
605
|
-
regex += escapeRegex(pattern.slice(last));
|
|
606
|
-
const root = pattern.split("/")[1] ?? "";
|
|
607
|
-
if (root === "" || root.includes("*") || root.includes("{")) {
|
|
608
|
-
throw new ExpectedError(
|
|
609
|
-
`The first path segment of route pattern "${pattern}" must be static when the pattern contains params or wildcards.`
|
|
610
|
-
);
|
|
611
|
-
}
|
|
612
|
-
if (root.includes(".")) {
|
|
613
|
-
throw new ExpectedError(
|
|
614
|
-
`The first path segment of route pattern "${pattern}" can't contain a dot when the pattern contains params or wildcards.`
|
|
615
|
-
);
|
|
616
|
-
}
|
|
617
|
-
if (params.length === 0 && pattern === `/${root}/*`) {
|
|
618
|
-
return { key: pattern };
|
|
619
|
-
}
|
|
620
|
-
return {
|
|
621
|
-
key: `/${root}/*`,
|
|
622
|
-
match: `^${regex}$`,
|
|
623
|
-
params: params.length > 0 ? params : void 0
|
|
624
|
-
};
|
|
625
|
-
};
|
|
626
|
-
|
|
627
|
-
// src/feature/router/schema.ts
|
|
628
|
-
var ErrorResponsePathSchema = z17.string().describe(
|
|
485
|
+
import { z as z16 } from "zod";
|
|
486
|
+
var ErrorResponsePathSchema = z16.string().describe(
|
|
629
487
|
[
|
|
630
488
|
"The path to the custom error page that you want to return to the viewer when your origin returns the HTTP status code specified.",
|
|
631
489
|
"- We recommend that you store custom error pages in an Amazon S3 bucket.",
|
|
632
490
|
"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."
|
|
633
491
|
].join("\n")
|
|
634
492
|
);
|
|
635
|
-
var StatusCodeSchema =
|
|
493
|
+
var StatusCodeSchema = z16.number().int().positive().optional().describe(
|
|
636
494
|
[
|
|
637
495
|
"The HTTP status code that you want CloudFront to return to the viewer along with the custom error page.",
|
|
638
496
|
"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:",
|
|
@@ -645,48 +503,26 @@ var StatusCodeSchema = z17.number().int().positive().optional().describe(
|
|
|
645
503
|
var MinTTLSchema = DurationSchema.describe(
|
|
646
504
|
"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."
|
|
647
505
|
);
|
|
648
|
-
var ErrorResponseSchema =
|
|
506
|
+
var ErrorResponseSchema = z16.union([
|
|
649
507
|
ErrorResponsePathSchema,
|
|
650
|
-
|
|
508
|
+
z16.object({
|
|
651
509
|
path: ErrorResponsePathSchema,
|
|
652
510
|
statusCode: StatusCodeSchema.optional(),
|
|
653
511
|
minTTL: MinTTLSchema.optional()
|
|
654
512
|
})
|
|
655
513
|
]).optional();
|
|
656
|
-
var RouteSchema =
|
|
657
|
-
var
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
try {
|
|
662
|
-
compileRoutePattern(pattern);
|
|
663
|
-
} catch (error) {
|
|
664
|
-
ctx.addIssue({
|
|
665
|
-
code: z17.ZodIssueCode.custom,
|
|
666
|
-
path: [pattern],
|
|
667
|
-
message: error instanceof Error ? error.message : `Invalid route pattern: ${pattern}`
|
|
668
|
-
});
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
}).describe(
|
|
672
|
-
[
|
|
673
|
-
"Define the routes and the lambda function that should handle them.",
|
|
674
|
-
'Routes can be an exact path like "/sitemap.xml", a wildcard like "/sitemap/*", or contain params like "/sitemap/{locale}/{page}.xml".',
|
|
675
|
-
'Param values are passed to the function as "x-param-[NAME]" request headers.'
|
|
676
|
-
].join("\n")
|
|
677
|
-
)
|
|
678
|
-
).optional().describe("Add routes to your global Router that link a path pattern to a lambda function.");
|
|
679
|
-
var VisibilitySchema = z17.boolean().default(false).describe("Whether to enable CloudWatch metrics for the WAF rule.");
|
|
680
|
-
var WafSettingsSchema = z17.object({
|
|
681
|
-
rateLimiter: z17.object({
|
|
682
|
-
limit: z17.number().min(10).max(2e9).default(10).describe(
|
|
514
|
+
var RouteSchema = z16.string().regex(/^\//, "Route must start with a slash (/)");
|
|
515
|
+
var VisibilitySchema = z16.boolean().default(false).describe("Whether to enable CloudWatch metrics for the WAF rule.");
|
|
516
|
+
var WafSettingsSchema = z16.object({
|
|
517
|
+
rateLimiter: z16.object({
|
|
518
|
+
limit: z16.number().min(10).max(2e9).default(10).describe(
|
|
683
519
|
"The limit on requests during the specified evaluation window for a single aggregation instance for the rate-based rule."
|
|
684
520
|
),
|
|
685
|
-
window:
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
521
|
+
window: z16.union([
|
|
522
|
+
z16.literal("1 minute"),
|
|
523
|
+
z16.literal("2 minutes"),
|
|
524
|
+
z16.literal("5 minutes"),
|
|
525
|
+
z16.literal("10 minutes")
|
|
690
526
|
]).default("5 minutes").transform((v) => parse3(v)).describe(
|
|
691
527
|
"The amount of time, in seconds, that AWS WAF should include in its request counts, looking back from the current time."
|
|
692
528
|
),
|
|
@@ -694,18 +530,18 @@ var WafSettingsSchema = z17.object({
|
|
|
694
530
|
}).optional().describe(
|
|
695
531
|
"A rate-based rule counts incoming requests and rate limits requests when they are coming at too fast a rate."
|
|
696
532
|
),
|
|
697
|
-
ddosProtection:
|
|
698
|
-
sensitivity:
|
|
699
|
-
challenge:
|
|
700
|
-
block:
|
|
533
|
+
ddosProtection: z16.object({
|
|
534
|
+
sensitivity: z16.object({
|
|
535
|
+
challenge: z16.enum(["low", "medium", "high"]).default("low").transform((v) => v.toUpperCase()).describe("The sensitivity level for challenge requests."),
|
|
536
|
+
block: z16.enum(["low", "medium", "high"]).default("low").transform((v) => v.toUpperCase()).describe("The sensitivity level for block requests.")
|
|
701
537
|
}),
|
|
702
|
-
exemptUriRegex:
|
|
538
|
+
exemptUriRegex: z16.string().default("^$"),
|
|
703
539
|
visibility: VisibilitySchema
|
|
704
540
|
}).optional().describe(
|
|
705
541
|
"Provides protection against DDoS attacks targeting the application layer, also known as Layer 7 attacks. Uses 50 WCU."
|
|
706
542
|
),
|
|
707
|
-
botProtection:
|
|
708
|
-
inspectionLevel:
|
|
543
|
+
botProtection: z16.object({
|
|
544
|
+
inspectionLevel: z16.enum(["common", "targeted"]).default("common").transform((v) => v.toUpperCase()),
|
|
709
545
|
visibility: VisibilitySchema
|
|
710
546
|
}).optional().describe(
|
|
711
547
|
"Provides protection against automated bots that can consume excess resources, skew business metrics, cause downtime, or perform malicious activities. Bot Control provides additional visibility through Amazon CloudWatch and generates labels that you can use to control bot traffic to your applications. Uses 50 WCU."
|
|
@@ -719,15 +555,15 @@ var WafSettingsSchema = z17.object({
|
|
|
719
555
|
}).describe(
|
|
720
556
|
"WAF settings for the router. Each rule consumes Web ACL capacity units (WCUs). The total WCUs for a web ACL can't exceed 5000. Using over 1500 WCUs affects your costs."
|
|
721
557
|
);
|
|
722
|
-
var RouterDefaultSchema =
|
|
558
|
+
var RouterDefaultSchema = z16.record(
|
|
723
559
|
ResourceIdSchema,
|
|
724
|
-
|
|
560
|
+
z16.object({
|
|
725
561
|
domain: ResourceIdSchema.describe("The domain id to link your Router.").optional(),
|
|
726
|
-
subDomain:
|
|
727
|
-
redirectWww:
|
|
562
|
+
subDomain: z16.string().optional(),
|
|
563
|
+
redirectWww: z16.boolean().default(false).describe("Redirect all www subdomain requests to your root domain."),
|
|
728
564
|
waf: WafSettingsSchema.optional(),
|
|
729
|
-
geoRestrictions:
|
|
730
|
-
errors:
|
|
565
|
+
geoRestrictions: z16.array(z16.string().length(2).toUpperCase()).default([]).describe("Specifies a blacklist of countries that should be blocked."),
|
|
566
|
+
errors: z16.object({
|
|
731
567
|
400: ErrorResponseSchema.describe("Customize a `400 Bad Request` response."),
|
|
732
568
|
403: ErrorResponseSchema.describe("Customize a `403 Forbidden` response."),
|
|
733
569
|
404: ErrorResponseSchema.describe("Customize a `404 Not Found` response."),
|
|
@@ -740,26 +576,26 @@ var RouterDefaultSchema = z17.record(
|
|
|
740
576
|
503: ErrorResponseSchema.describe("Customize a `503 Service Unavailable` response."),
|
|
741
577
|
504: ErrorResponseSchema.describe("Customize a `504 Gateway Timeout` response.")
|
|
742
578
|
}).optional().describe("Customize the error responses for specific HTTP status codes."),
|
|
743
|
-
cors:
|
|
744
|
-
override:
|
|
579
|
+
cors: z16.object({
|
|
580
|
+
override: z16.boolean().default(false),
|
|
745
581
|
maxAge: DurationSchema.default("365 days"),
|
|
746
|
-
exposeHeaders:
|
|
747
|
-
credentials:
|
|
748
|
-
headers:
|
|
749
|
-
origins:
|
|
750
|
-
methods:
|
|
582
|
+
exposeHeaders: z16.string().array().optional(),
|
|
583
|
+
credentials: z16.boolean().default(false),
|
|
584
|
+
headers: z16.string().array().default(["*"]),
|
|
585
|
+
origins: z16.string().array().default(["*"]),
|
|
586
|
+
methods: z16.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
|
|
751
587
|
}).optional().describe("Specify the cors headers."),
|
|
752
|
-
passwordAuth:
|
|
753
|
-
password:
|
|
588
|
+
passwordAuth: z16.object({
|
|
589
|
+
password: z16.string().describe("Password.")
|
|
754
590
|
}).optional().describe(
|
|
755
591
|
[
|
|
756
592
|
"Enable password authentication for the router.",
|
|
757
593
|
'You can authenicate by adding a "authorization" header with the value "Password [YOUR_PASSWORD]".'
|
|
758
594
|
].join("\n")
|
|
759
595
|
),
|
|
760
|
-
basicAuth:
|
|
761
|
-
username:
|
|
762
|
-
password:
|
|
596
|
+
basicAuth: z16.object({
|
|
597
|
+
username: z16.string().describe("Basic auth username."),
|
|
598
|
+
password: z16.string().describe("Basic auth password.")
|
|
763
599
|
}).optional().describe("Enable basic authentication for the router."),
|
|
764
600
|
// security: z
|
|
765
601
|
// .object({
|
|
@@ -806,24 +642,24 @@ var RouterDefaultSchema = z17.record(
|
|
|
806
642
|
// })
|
|
807
643
|
// .optional()
|
|
808
644
|
// .describe('Specify the security policy.'),
|
|
809
|
-
cache:
|
|
810
|
-
cookies:
|
|
811
|
-
headers:
|
|
812
|
-
queries:
|
|
645
|
+
cache: z16.object({
|
|
646
|
+
cookies: z16.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
|
|
647
|
+
headers: z16.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
|
|
648
|
+
queries: z16.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
|
|
813
649
|
}).optional().describe(
|
|
814
650
|
"Specifies the cookies, headers, and query values that CloudFront includes in the cache key."
|
|
815
651
|
)
|
|
816
652
|
}).superRefine((props, ctx) => {
|
|
817
653
|
if (props.redirectWww && !props.domain) {
|
|
818
654
|
ctx.addIssue({
|
|
819
|
-
code:
|
|
655
|
+
code: z16.ZodIssueCode.custom,
|
|
820
656
|
path: ["redirectWww"],
|
|
821
657
|
message: "The redirectWww option requires a domain to be set."
|
|
822
658
|
});
|
|
823
659
|
}
|
|
824
660
|
if (props.redirectWww && props.subDomain) {
|
|
825
661
|
ctx.addIssue({
|
|
826
|
-
code:
|
|
662
|
+
code: z16.ZodIssueCode.custom,
|
|
827
663
|
path: ["redirectWww"],
|
|
828
664
|
message: `The redirectWww option can't be combined with a subDomain, because the domain certificate only covers single level subdomains.`
|
|
829
665
|
});
|
|
@@ -832,9 +668,9 @@ var RouterDefaultSchema = z17.record(
|
|
|
832
668
|
).optional().describe(`Define the global Router. Backed by AWS CloudFront.`);
|
|
833
669
|
|
|
834
670
|
// src/feature/pubsub/schema.ts
|
|
835
|
-
var PubSubDefaultSchema =
|
|
671
|
+
var PubSubDefaultSchema = z17.record(
|
|
836
672
|
ResourceIdSchema,
|
|
837
|
-
|
|
673
|
+
z17.object({
|
|
838
674
|
auth: FunctionSchema.describe(
|
|
839
675
|
"The authorizer that validates the client auth token and returns the allowed topics."
|
|
840
676
|
),
|
|
@@ -845,9 +681,9 @@ var PubSubDefaultSchema = z18.record(
|
|
|
845
681
|
}))
|
|
846
682
|
})
|
|
847
683
|
).optional().describe("Define the pubsub API for your app. Backed by a websocket server on AWS Fargate.");
|
|
848
|
-
var PubSubSchema =
|
|
684
|
+
var PubSubSchema = z17.record(
|
|
849
685
|
ResourceIdSchema,
|
|
850
|
-
|
|
686
|
+
z17.object({
|
|
851
687
|
connected: FunctionSchema.optional().describe("Subscribe to the event when a client connects."),
|
|
852
688
|
disconnected: FunctionSchema.optional().describe("Subscribe to the event when a client disconnects."),
|
|
853
689
|
subscribed: FunctionSchema.optional().describe(
|
|
@@ -860,47 +696,35 @@ var PubSubSchema = z18.record(
|
|
|
860
696
|
).optional().describe("Define the pubsub event listeners in your stack.");
|
|
861
697
|
|
|
862
698
|
// src/feature/queue/schema.ts
|
|
863
|
-
import { days as days5,
|
|
699
|
+
import { days as days5, minutes as minutes3, seconds as seconds2 } from "@awsless/duration";
|
|
864
700
|
import { kibibytes } from "@awsless/size";
|
|
865
|
-
import { z as
|
|
701
|
+
import { z as z18 } from "zod";
|
|
866
702
|
var RetentionPeriodSchema = DurationSchema.refine(durationMin(minutes3(1)), "Minimum retention period is 1 minute").refine(durationMax(days5(14)), "Maximum retention period is 14 days").describe(
|
|
867
703
|
"The number of seconds that Amazon SQS retains a message. You can specify a duration from 1 minute to 14 days."
|
|
868
704
|
);
|
|
869
|
-
var VisibilityTimeoutSchema = DurationSchema.refine(
|
|
870
|
-
durationMax(hours(12)),
|
|
871
|
-
"Maximum visibility timeout is 12 hours"
|
|
872
|
-
).describe(
|
|
873
|
-
"The length of time during which a message will be unavailable after a message is delivered from the queue. You can specify a duration from 0 to 12 hours."
|
|
874
|
-
);
|
|
875
705
|
var ReceiveMessageWaitTimeSchema = DurationSchema.refine(
|
|
876
706
|
durationMin(seconds2(1)),
|
|
877
707
|
"Minimum receive message wait time is 1 second"
|
|
878
708
|
).refine(durationMax(seconds2(20)), "Maximum receive message wait time is 20 seconds").describe("Long-polling wait time. You can specify a duration from 1 to 20 seconds.");
|
|
879
709
|
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("Message size limit. You can specify a size from 1 KB to 256 KB.");
|
|
880
|
-
var BatchSizeSchema =
|
|
881
|
-
var
|
|
882
|
-
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 999."
|
|
883
|
-
);
|
|
884
|
-
var QueueDefaultSchema = z19.object({
|
|
710
|
+
var BatchSizeSchema = z18.number().int().min(1, "Minimum batch size is 1").max(10, "FIFO queues support a maximum batch size of 10").describe("The maximum number of records per batch. FIFO queues are capped at 10.");
|
|
711
|
+
var QueueDefaultSchema = z18.object({
|
|
885
712
|
retentionPeriod: RetentionPeriodSchema.default("7 days"),
|
|
886
|
-
|
|
713
|
+
// The visibility timeout is derived from the bundle timeout.
|
|
887
714
|
receiveMessageWaitTime: ReceiveMessageWaitTimeSchema.optional(),
|
|
888
715
|
maxMessageSize: MaxMessageSizeSchema.default("256 KB"),
|
|
889
|
-
batchSize: BatchSizeSchema.default(10)
|
|
890
|
-
retryAttempts: RetryAttemptsSchema2.default(2)
|
|
716
|
+
batchSize: BatchSizeSchema.default(10)
|
|
891
717
|
}).default({});
|
|
892
|
-
var QueueSchema =
|
|
718
|
+
var QueueSchema = z18.object({
|
|
893
719
|
consumer: FunctionSchema.optional().describe("The consuming lambda function properties."),
|
|
894
720
|
retentionPeriod: RetentionPeriodSchema.optional(),
|
|
895
|
-
visibilityTimeout: VisibilityTimeoutSchema.optional(),
|
|
896
721
|
receiveMessageWaitTime: ReceiveMessageWaitTimeSchema.optional(),
|
|
897
722
|
maxMessageSize: MaxMessageSizeSchema.optional(),
|
|
898
|
-
batchSize: BatchSizeSchema.optional()
|
|
899
|
-
retryAttempts: RetryAttemptsSchema2.optional()
|
|
723
|
+
batchSize: BatchSizeSchema.optional()
|
|
900
724
|
});
|
|
901
|
-
var QueuesSchema =
|
|
725
|
+
var QueuesSchema = z18.record(
|
|
902
726
|
ResourceIdSchema,
|
|
903
|
-
|
|
727
|
+
z18.union([
|
|
904
728
|
LocalFileSchema.transform((consumer) => ({
|
|
905
729
|
consumer
|
|
906
730
|
})).pipe(QueueSchema),
|
|
@@ -911,26 +735,26 @@ var QueuesSchema = z19.record(
|
|
|
911
735
|
);
|
|
912
736
|
|
|
913
737
|
// src/feature/rest/schema.ts
|
|
914
|
-
import { z as
|
|
738
|
+
import { z as z20 } from "zod";
|
|
915
739
|
|
|
916
740
|
// src/config/schema/route.ts
|
|
917
|
-
import { z as
|
|
918
|
-
var RouteSchema2 =
|
|
919
|
-
|
|
920
|
-
|
|
741
|
+
import { z as z19 } from "zod";
|
|
742
|
+
var RouteSchema2 = z19.union([
|
|
743
|
+
z19.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS|ANY)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route"),
|
|
744
|
+
z19.literal("$default")
|
|
921
745
|
]);
|
|
922
746
|
|
|
923
747
|
// src/feature/rest/schema.ts
|
|
924
|
-
var RestDefaultSchema =
|
|
748
|
+
var RestDefaultSchema = z20.record(
|
|
925
749
|
ResourceIdSchema,
|
|
926
|
-
|
|
750
|
+
z20.object({
|
|
927
751
|
domain: ResourceIdSchema.describe("The domain id to link your API with.").optional(),
|
|
928
|
-
subDomain:
|
|
752
|
+
subDomain: z20.string().optional()
|
|
929
753
|
})
|
|
930
754
|
).optional().describe("Define your global REST API's.");
|
|
931
|
-
var RestSchema =
|
|
755
|
+
var RestSchema = z20.record(
|
|
932
756
|
ResourceIdSchema,
|
|
933
|
-
|
|
757
|
+
z20.record(
|
|
934
758
|
RouteSchema2.describe(
|
|
935
759
|
[
|
|
936
760
|
"The REST API route that is comprised by the http method and http path.",
|
|
@@ -943,40 +767,31 @@ var RestSchema = z21.record(
|
|
|
943
767
|
).optional().describe("Define routes in your stack for your global REST API.");
|
|
944
768
|
|
|
945
769
|
// src/feature/rpc/schema.ts
|
|
946
|
-
import {
|
|
947
|
-
|
|
948
|
-
var TimeoutSchema2 = DurationSchema.refine(durationMin(seconds3(10)), "Minimum timeout duration is 10 seconds").refine(durationMax(minutes4(5)), "Maximum timeout duration is 5 minutes").describe(
|
|
949
|
-
[
|
|
950
|
-
"The amount of time that the RPC lambda is allowed run before stopping it.",
|
|
951
|
-
"You can specify a timeout from 10 second to 5 minutes.",
|
|
952
|
-
"The timeouts of all inner RPC functions will be capped at 80% of this timeout."
|
|
953
|
-
].join(" ")
|
|
954
|
-
);
|
|
955
|
-
var RpcDefaultSchema = z22.record(
|
|
770
|
+
import { z as z21 } from "zod";
|
|
771
|
+
var RpcDefaultSchema = z21.record(
|
|
956
772
|
ResourceIdSchema,
|
|
957
|
-
|
|
773
|
+
z21.object({
|
|
958
774
|
// domain: ResourceIdSchema.describe('The domain id to link your RPC API with.').optional(),
|
|
959
775
|
// subDomain: z.string().optional(),
|
|
960
776
|
//
|
|
961
777
|
router: ResourceIdSchema.describe("The router id to link your RPC API with."),
|
|
962
778
|
path: RouteSchema.describe("The path inside the router to link your RPC API to."),
|
|
963
|
-
auth: FunctionSchema.optional().describe("The authentication handler for your RPC API.")
|
|
964
|
-
|
|
965
|
-
timeout: TimeoutSchema2.default("1 minutes")
|
|
779
|
+
auth: FunctionSchema.optional().describe("The authentication handler for your RPC API.")
|
|
780
|
+
// timeout: TimeoutSchema.default('1 minutes'),
|
|
966
781
|
})
|
|
967
782
|
).describe(`Define the global RPC API's.`).optional();
|
|
968
|
-
var RpcSchema =
|
|
783
|
+
var RpcSchema = z21.record(
|
|
969
784
|
ResourceIdSchema,
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
785
|
+
z21.record(
|
|
786
|
+
z21.string(),
|
|
787
|
+
z21.union([
|
|
973
788
|
FunctionSchema.transform((f) => ({
|
|
974
789
|
function: f,
|
|
975
790
|
lock: false
|
|
976
791
|
})),
|
|
977
|
-
|
|
792
|
+
z21.object({
|
|
978
793
|
function: FunctionSchema.describe("The RPC function to execute."),
|
|
979
|
-
lock:
|
|
794
|
+
lock: z21.boolean().describe(
|
|
980
795
|
[
|
|
981
796
|
"Specify if the function should be locked on the `lockKey` returned from the auth function.",
|
|
982
797
|
"An example would be returning the user ID as `lockKey`."
|
|
@@ -990,8 +805,8 @@ var RpcSchema = z22.record(
|
|
|
990
805
|
// src/feature/job/schema.ts
|
|
991
806
|
import { days as days6, toDays as toDays3 } from "@awsless/duration";
|
|
992
807
|
import { toMebibytes as toMebibytes2 } from "@awsless/size";
|
|
993
|
-
import { z as
|
|
994
|
-
var CpuSchema2 =
|
|
808
|
+
import { z as z22 } from "zod";
|
|
809
|
+
var CpuSchema2 = z22.union([z22.literal(0.25), z22.literal(0.5), z22.literal(1), z22.literal(2), z22.literal(4), z22.literal(8), z22.literal(16)]).transform((v) => `${v} vCPU`).describe("The number of virtual CPU units (vCPU) used by the job. Valid values: 0.25, 0.5, 1, 2, 4, 8, 16 vCPU.");
|
|
995
810
|
var validMemorySize2 = [
|
|
996
811
|
// 0.25 vCPU
|
|
997
812
|
512,
|
|
@@ -1029,20 +844,20 @@ var MemorySizeSchema3 = SizeSchema.refine(
|
|
|
1029
844
|
(s) => validMemorySize2.includes(toMebibytes2(s)),
|
|
1030
845
|
`Invalid memory size. Allowed sizes: ${validMemorySize2.join(", ")} MiB`
|
|
1031
846
|
).describe("The amount of memory (in MiB) used by the job. Valid memory values depend on the CPU configuration.");
|
|
1032
|
-
var EnvironmentSchema3 =
|
|
1033
|
-
var ArchitectureSchema4 =
|
|
1034
|
-
var ActionSchema3 =
|
|
1035
|
-
var ActionsSchema3 =
|
|
1036
|
-
var ArnSchema3 =
|
|
1037
|
-
var WildcardSchema3 =
|
|
1038
|
-
var ResourceSchema3 =
|
|
1039
|
-
var ResourcesSchema3 =
|
|
1040
|
-
var PermissionSchema3 =
|
|
1041
|
-
effect:
|
|
847
|
+
var EnvironmentSchema3 = z22.record(z22.string(), z22.string()).optional().describe("Environment variable key-value pairs.");
|
|
848
|
+
var ArchitectureSchema4 = z22.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the job supports.");
|
|
849
|
+
var ActionSchema3 = z22.string();
|
|
850
|
+
var ActionsSchema3 = z22.union([ActionSchema3.transform((v) => [v]), ActionSchema3.array()]);
|
|
851
|
+
var ArnSchema3 = z22.string().startsWith("arn:");
|
|
852
|
+
var WildcardSchema3 = z22.literal("*");
|
|
853
|
+
var ResourceSchema3 = z22.union([ArnSchema3, WildcardSchema3]);
|
|
854
|
+
var ResourcesSchema3 = z22.union([ResourceSchema3.transform((v) => [v]), ResourceSchema3.array()]);
|
|
855
|
+
var PermissionSchema3 = z22.object({
|
|
856
|
+
effect: z22.enum(["allow", "deny"]).default("allow"),
|
|
1042
857
|
actions: ActionsSchema3,
|
|
1043
858
|
resources: ResourcesSchema3
|
|
1044
859
|
});
|
|
1045
|
-
var PermissionsSchema3 =
|
|
860
|
+
var PermissionsSchema3 = z22.union([PermissionSchema3.transform((v) => [v]), PermissionSchema3.array()]).describe("Add IAM permissions to your job.");
|
|
1046
861
|
var validLogRetentionDays3 = [
|
|
1047
862
|
...[1, 3, 5, 7, 14, 30, 60, 90, 120, 150],
|
|
1048
863
|
...[180, 365, 400, 545, 731, 1096, 1827, 2192],
|
|
@@ -1057,27 +872,27 @@ var LogRetentionSchema3 = DurationSchema.refine(
|
|
|
1057
872
|
},
|
|
1058
873
|
`Invalid log retention. Valid days are: ${validLogRetentionDays3.map((days8) => `${days8}`).join(", ")}`
|
|
1059
874
|
).describe("The log retention duration.");
|
|
1060
|
-
var LogSchema3 =
|
|
1061
|
-
|
|
875
|
+
var LogSchema3 = z22.union([
|
|
876
|
+
z22.boolean().transform((enabled) => ({ retention: enabled ? days6(7) : days6(0) })),
|
|
1062
877
|
LogRetentionSchema3.transform((retention) => ({ retention })),
|
|
1063
|
-
|
|
878
|
+
z22.object({
|
|
1064
879
|
retention: LogRetentionSchema3.optional()
|
|
1065
880
|
})
|
|
1066
881
|
]).describe("Enable logging to a CloudWatch log group. Providing a duration value will set the log retention time.");
|
|
1067
|
-
var FileCodeSchema3 =
|
|
882
|
+
var FileCodeSchema3 = z22.object({
|
|
1068
883
|
file: LocalFileSchema.describe("The file path of the job code.")
|
|
1069
884
|
});
|
|
1070
|
-
var CodeSchema3 =
|
|
885
|
+
var CodeSchema3 = z22.union([
|
|
1071
886
|
LocalFileSchema.transform((file) => ({
|
|
1072
887
|
file
|
|
1073
888
|
})).pipe(FileCodeSchema3),
|
|
1074
889
|
FileCodeSchema3
|
|
1075
890
|
]).describe("Specify the code of your job.");
|
|
1076
|
-
var
|
|
1077
|
-
var ImageSchema2 =
|
|
1078
|
-
var PersistentStorageSchema =
|
|
1079
|
-
var StartupCommandSchema2 =
|
|
1080
|
-
var ASchema =
|
|
891
|
+
var TimeoutSchema2 = DurationSchema.describe("The maximum time the job is allowed to run before being stopped.");
|
|
892
|
+
var ImageSchema2 = z22.string().describe("The URL of the container image to use. Default: public.ecr.aws/aws-cli/aws-cli:{architecture}");
|
|
893
|
+
var PersistentStorageSchema = z22.boolean().describe("Mount persistent storage for the job at a fixed internal path.");
|
|
894
|
+
var StartupCommandSchema2 = z22.union([z22.string().transform((v) => [v]), z22.string().array()]).describe("Optional shell commands to run before the job executable is downloaded and started.");
|
|
895
|
+
var ASchema = z22.object({
|
|
1081
896
|
code: CodeSchema3,
|
|
1082
897
|
image: ImageSchema2.optional(),
|
|
1083
898
|
persistentStorage: PersistentStorageSchema.optional(),
|
|
@@ -1088,16 +903,16 @@ var ASchema = z23.object({
|
|
|
1088
903
|
architecture: ArchitectureSchema4.optional(),
|
|
1089
904
|
environment: EnvironmentSchema3.optional(),
|
|
1090
905
|
permissions: PermissionsSchema3.optional(),
|
|
1091
|
-
timeout:
|
|
906
|
+
timeout: TimeoutSchema2.default("30 minutes").describe("The maximum time the job is allowed to run before being stopped. Default: 30 minutes.")
|
|
1092
907
|
});
|
|
1093
|
-
var JobSchema =
|
|
908
|
+
var JobSchema = z22.union([
|
|
1094
909
|
LocalFileSchema.transform((code) => ({
|
|
1095
910
|
code
|
|
1096
911
|
})).pipe(ASchema),
|
|
1097
912
|
ASchema
|
|
1098
913
|
]);
|
|
1099
|
-
var JobsSchema =
|
|
1100
|
-
var JobDefaultSchema =
|
|
914
|
+
var JobsSchema = z22.record(ResourceIdSchema, JobSchema).optional().describe("Define the jobs in your stack.");
|
|
915
|
+
var JobDefaultSchema = z22.object({
|
|
1101
916
|
image: ImageSchema2.optional(),
|
|
1102
917
|
persistentStorage: PersistentStorageSchema.optional(),
|
|
1103
918
|
cpu: CpuSchema2.default(0.25),
|
|
@@ -1105,7 +920,7 @@ var JobDefaultSchema = z23.object({
|
|
|
1105
920
|
architecture: ArchitectureSchema4.default("arm64"),
|
|
1106
921
|
environment: EnvironmentSchema3.optional(),
|
|
1107
922
|
permissions: PermissionsSchema3.optional(),
|
|
1108
|
-
timeout:
|
|
923
|
+
timeout: TimeoutSchema2.optional(),
|
|
1109
924
|
log: LogSchema3.default(true).transform((log) => ({
|
|
1110
925
|
retention: log.retention ?? days6(7)
|
|
1111
926
|
}))
|
|
@@ -1113,15 +928,15 @@ var JobDefaultSchema = z23.object({
|
|
|
1113
928
|
|
|
1114
929
|
// src/feature/topic/schema.ts
|
|
1115
930
|
import { kebabCase as kebabCase3 } from "change-case";
|
|
1116
|
-
import { z as
|
|
1117
|
-
var TopicNameSchema =
|
|
1118
|
-
var TopicsDefaultSchema =
|
|
931
|
+
import { z as z23 } from "zod";
|
|
932
|
+
var TopicNameSchema = z23.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => kebabCase3(value)).describe("Define event topic name.");
|
|
933
|
+
var TopicsDefaultSchema = z23.array(TopicNameSchema).refine((topics) => {
|
|
1119
934
|
return topics.length === new Set(topics).size;
|
|
1120
935
|
}, "Must be a list of unique topic names").optional().describe("Define the event topics for your app.");
|
|
1121
|
-
var SubscribersSchema =
|
|
936
|
+
var SubscribersSchema = z23.record(TopicNameSchema, TaskSchema).optional().describe("Define the event topics to subscribe too in your stack.");
|
|
1122
937
|
|
|
1123
938
|
// src/config/schema/region.ts
|
|
1124
|
-
import { z as
|
|
939
|
+
import { z as z24 } from "zod";
|
|
1125
940
|
var US = ["us-east-2", "us-east-1", "us-west-1", "us-west-2"];
|
|
1126
941
|
var AF = ["af-south-1"];
|
|
1127
942
|
var AP = [
|
|
@@ -1150,16 +965,16 @@ var EU = [
|
|
|
1150
965
|
var ME = ["me-south-1", "me-central-1"];
|
|
1151
966
|
var SA = ["sa-east-1"];
|
|
1152
967
|
var regions = [...US, ...AF, ...AP, ...CA, ...EU, ...ME, ...SA];
|
|
1153
|
-
var RegionSchema =
|
|
968
|
+
var RegionSchema = z24.enum(regions);
|
|
1154
969
|
|
|
1155
970
|
// src/config/app.ts
|
|
1156
|
-
var AppSchema =
|
|
1157
|
-
$schema:
|
|
971
|
+
var AppSchema = z25.object({
|
|
972
|
+
$schema: z25.string().optional(),
|
|
1158
973
|
name: ResourceIdSchema.describe("App name."),
|
|
1159
974
|
region: RegionSchema.describe("The AWS region to deploy to."),
|
|
1160
|
-
profile:
|
|
1161
|
-
protect:
|
|
1162
|
-
removal:
|
|
975
|
+
profile: z25.string().describe("The AWS profile to deploy to."),
|
|
976
|
+
protect: z25.boolean().default(false).describe("Protect your app & stacks from being deleted."),
|
|
977
|
+
removal: z25.enum(["remove", "retain"]).default("remove").describe(
|
|
1163
978
|
[
|
|
1164
979
|
"Configure how your resources are handled when they have to be removed.",
|
|
1165
980
|
"",
|
|
@@ -1173,7 +988,7 @@ var AppSchema = z26.object({
|
|
|
1173
988
|
// .default('prod')
|
|
1174
989
|
// .describe('The deployment stage.'),
|
|
1175
990
|
// onFailure: OnFailureSchema,
|
|
1176
|
-
defaults:
|
|
991
|
+
defaults: z25.object({
|
|
1177
992
|
onFailure: OnFailureDefaultSchema,
|
|
1178
993
|
onErrorLog: OnErrorLogDefaultSchema,
|
|
1179
994
|
auth: AuthDefaultSchema,
|
|
@@ -1202,7 +1017,7 @@ import { z as z41 } from "zod";
|
|
|
1202
1017
|
|
|
1203
1018
|
// src/feature/cache/schema.ts
|
|
1204
1019
|
import { gibibytes as gibibytes2 } from "@awsless/size";
|
|
1205
|
-
import { z as
|
|
1020
|
+
import { z as z26 } from "zod";
|
|
1206
1021
|
var StorageSchema = SizeSchema.refine(sizeMin(gibibytes2(1)), "Minimum storage size is 1 GB").refine(
|
|
1207
1022
|
sizeMax(gibibytes2(5e3)),
|
|
1208
1023
|
"Maximum storage size is 5000 GB"
|
|
@@ -1213,31 +1028,31 @@ var MinimumStorageSchema = StorageSchema.describe(
|
|
|
1213
1028
|
var MaximumStorageSchema = StorageSchema.describe(
|
|
1214
1029
|
"The upper limit for data storage the cache is set to use. You can specify a size value from 1 GB to 5000 GB."
|
|
1215
1030
|
);
|
|
1216
|
-
var EcpuSchema =
|
|
1031
|
+
var EcpuSchema = z26.number().int().min(1e3).max(15e6);
|
|
1217
1032
|
var MinimumEcpuSchema = EcpuSchema.describe(
|
|
1218
1033
|
"The minimum number of ECPUs the cache can consume per second. You can specify a integer from 1,000 to 15,000,000."
|
|
1219
1034
|
);
|
|
1220
1035
|
var MaximumEcpuSchema = EcpuSchema.describe(
|
|
1221
1036
|
"The maximum number of ECPUs the cache can consume per second. You can specify a integer from 1,000 to 15,000,000."
|
|
1222
1037
|
);
|
|
1223
|
-
var CachesSchema =
|
|
1038
|
+
var CachesSchema = z26.record(
|
|
1224
1039
|
ResourceIdSchema,
|
|
1225
|
-
|
|
1040
|
+
z26.object({
|
|
1226
1041
|
minStorage: MinimumStorageSchema.optional(),
|
|
1227
1042
|
maxStorage: MaximumStorageSchema.optional(),
|
|
1228
1043
|
minECPU: MinimumEcpuSchema.optional(),
|
|
1229
1044
|
maxECPU: MaximumEcpuSchema.optional(),
|
|
1230
|
-
snapshotRetentionLimit:
|
|
1045
|
+
snapshotRetentionLimit: z26.number().int().positive().default(1)
|
|
1231
1046
|
})
|
|
1232
1047
|
).optional().describe("Define the caches in your stack. For access to the cache put your functions inside the global VPC.");
|
|
1233
1048
|
|
|
1234
1049
|
// src/feature/command/schema.ts
|
|
1235
|
-
import { z as
|
|
1236
|
-
var CommandSchema =
|
|
1237
|
-
|
|
1050
|
+
import { z as z27 } from "zod";
|
|
1051
|
+
var CommandSchema = z27.union([
|
|
1052
|
+
z27.object({
|
|
1238
1053
|
file: LocalFileSchema,
|
|
1239
|
-
handler:
|
|
1240
|
-
description:
|
|
1054
|
+
handler: z27.string().default("default").describe("The name of the handler that needs to run"),
|
|
1055
|
+
description: z27.string().optional().describe("A description of the command")
|
|
1241
1056
|
// options: z.record(ResourceIdSchema, OptionSchema).optional(),
|
|
1242
1057
|
// arguments: z.record(ResourceIdSchema, ArgumentSchema).optional(),
|
|
1243
1058
|
}),
|
|
@@ -1247,22 +1062,22 @@ var CommandSchema = z28.union([
|
|
|
1247
1062
|
description: void 0
|
|
1248
1063
|
}))
|
|
1249
1064
|
]);
|
|
1250
|
-
var CommandsSchema =
|
|
1065
|
+
var CommandsSchema = z27.record(ResourceIdSchema, CommandSchema).optional().describe("Define the custom commands for your stack.");
|
|
1251
1066
|
|
|
1252
1067
|
// src/feature/config/schema.ts
|
|
1253
|
-
import { z as
|
|
1254
|
-
var ConfigNameSchema =
|
|
1255
|
-
var ConfigsSchema =
|
|
1068
|
+
import { z as z28 } from "zod";
|
|
1069
|
+
var ConfigNameSchema = z28.string().regex(/[a-z0-9\-]/g, "Invalid config name");
|
|
1070
|
+
var ConfigsSchema = z28.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
|
|
1256
1071
|
|
|
1257
1072
|
// src/feature/cron/schema/index.ts
|
|
1258
|
-
import { z as
|
|
1073
|
+
import { z as z30 } from "zod";
|
|
1259
1074
|
|
|
1260
1075
|
// src/feature/cron/schema/schedule.ts
|
|
1261
|
-
import { z as
|
|
1076
|
+
import { z as z29 } from "zod";
|
|
1262
1077
|
import { awsCronExpressionValidator } from "aws-cron-expression-validator";
|
|
1263
|
-
var RateExpressionSchema =
|
|
1078
|
+
var RateExpressionSchema = z29.custom(
|
|
1264
1079
|
(value) => {
|
|
1265
|
-
return
|
|
1080
|
+
return z29.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
|
|
1266
1081
|
const [str] = rate.split(" ");
|
|
1267
1082
|
const number = parseInt(str);
|
|
1268
1083
|
return number > 0;
|
|
@@ -1278,9 +1093,9 @@ var RateExpressionSchema = z30.custom(
|
|
|
1278
1093
|
}
|
|
1279
1094
|
return `rate(${rate})`;
|
|
1280
1095
|
});
|
|
1281
|
-
var CronExpressionSchema =
|
|
1096
|
+
var CronExpressionSchema = z29.custom(
|
|
1282
1097
|
(value) => {
|
|
1283
|
-
return
|
|
1098
|
+
return z29.string().safeParse(value).success;
|
|
1284
1099
|
},
|
|
1285
1100
|
{ message: "Invalid cron expression" }
|
|
1286
1101
|
).superRefine((value, ctx) => {
|
|
@@ -1289,12 +1104,12 @@ var CronExpressionSchema = z30.custom(
|
|
|
1289
1104
|
} catch (error) {
|
|
1290
1105
|
if (error instanceof Error) {
|
|
1291
1106
|
ctx.addIssue({
|
|
1292
|
-
code:
|
|
1107
|
+
code: z29.ZodIssueCode.custom,
|
|
1293
1108
|
message: `Invalid cron expression: ${error.message}`
|
|
1294
1109
|
});
|
|
1295
1110
|
} else {
|
|
1296
1111
|
ctx.addIssue({
|
|
1297
|
-
code:
|
|
1112
|
+
code: z29.ZodIssueCode.custom,
|
|
1298
1113
|
message: "Invalid cron expression"
|
|
1299
1114
|
});
|
|
1300
1115
|
}
|
|
@@ -1305,32 +1120,28 @@ var CronExpressionSchema = z30.custom(
|
|
|
1305
1120
|
var ScheduleExpressionSchema = RateExpressionSchema.or(CronExpressionSchema);
|
|
1306
1121
|
|
|
1307
1122
|
// src/feature/cron/schema/index.ts
|
|
1308
|
-
var
|
|
1309
|
-
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
|
|
1310
|
-
);
|
|
1311
|
-
var CronsSchema = z31.record(
|
|
1123
|
+
var CronsSchema = z30.record(
|
|
1312
1124
|
ResourceIdSchema,
|
|
1313
|
-
|
|
1314
|
-
enabled:
|
|
1125
|
+
z30.object({
|
|
1126
|
+
enabled: z30.boolean().default(true).describe("If the cron is enabled."),
|
|
1315
1127
|
consumer: FunctionSchema.describe("The consuming lambda function properties."),
|
|
1316
1128
|
schedule: ScheduleExpressionSchema.describe(
|
|
1317
1129
|
'The scheduling expression.\n\nexample: "0 20 * * ? *"\nexample: "5 minutes"'
|
|
1318
1130
|
),
|
|
1319
|
-
payload:
|
|
1320
|
-
retryAttempts: RetryAttemptsSchema3.default(2)
|
|
1131
|
+
payload: z30.unknown().optional().describe("The JSON payload that will be passed to the consumer.")
|
|
1321
1132
|
})
|
|
1322
1133
|
).optional().describe(`Define the cron jobs in your stack.`);
|
|
1323
1134
|
|
|
1324
1135
|
// src/feature/search/schema.ts
|
|
1325
1136
|
import { gibibytes as gibibytes3 } from "@awsless/size";
|
|
1326
|
-
import { z as
|
|
1327
|
-
var VersionSchema =
|
|
1137
|
+
import { z as z31 } from "zod";
|
|
1138
|
+
var VersionSchema = z31.union([
|
|
1328
1139
|
//
|
|
1329
|
-
|
|
1330
|
-
|
|
1140
|
+
z31.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]),
|
|
1141
|
+
z31.string()
|
|
1331
1142
|
]).describe("Specify the OpenSearch engine version.");
|
|
1332
|
-
var TypeSchema =
|
|
1333
|
-
|
|
1143
|
+
var TypeSchema = z31.union([
|
|
1144
|
+
z31.enum([
|
|
1334
1145
|
"t3.small",
|
|
1335
1146
|
"t3.medium",
|
|
1336
1147
|
"m3.medium",
|
|
@@ -1404,13 +1215,13 @@ var TypeSchema = z32.union([
|
|
|
1404
1215
|
"r6gd.12xlarge",
|
|
1405
1216
|
"r6gd.16xlarge"
|
|
1406
1217
|
]),
|
|
1407
|
-
|
|
1218
|
+
z31.string()
|
|
1408
1219
|
]).describe("Instance type of data nodes in the cluster.");
|
|
1409
|
-
var CountSchema =
|
|
1220
|
+
var CountSchema = z31.number().int().min(1).describe("Number of instances in the cluster.");
|
|
1410
1221
|
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.");
|
|
1411
|
-
var SearchsSchema =
|
|
1222
|
+
var SearchsSchema = z31.record(
|
|
1412
1223
|
ResourceIdSchema,
|
|
1413
|
-
|
|
1224
|
+
z31.object({
|
|
1414
1225
|
type: TypeSchema.default("t3.small"),
|
|
1415
1226
|
count: CountSchema.default(1),
|
|
1416
1227
|
version: VersionSchema.default("2.13"),
|
|
@@ -1423,6 +1234,25 @@ var SearchsSchema = z32.record(
|
|
|
1423
1234
|
// src/feature/site/schema.ts
|
|
1424
1235
|
import { z as z34 } from "zod";
|
|
1425
1236
|
|
|
1237
|
+
// src/config/schema/local-directory.ts
|
|
1238
|
+
import { stat as stat2 } from "fs/promises";
|
|
1239
|
+
import { z as z32 } from "zod";
|
|
1240
|
+
var LocalDirectorySchema = z32.union([
|
|
1241
|
+
RelativePathSchema.refine(async (path) => {
|
|
1242
|
+
try {
|
|
1243
|
+
const s = await stat2(path);
|
|
1244
|
+
return s.isDirectory();
|
|
1245
|
+
} catch (error) {
|
|
1246
|
+
return false;
|
|
1247
|
+
}
|
|
1248
|
+
}, `Directory doesn't exist`),
|
|
1249
|
+
z32.object({
|
|
1250
|
+
nocheck: RelativePathSchema.describe(
|
|
1251
|
+
"Specifies a local directory without checking if the directory exists."
|
|
1252
|
+
)
|
|
1253
|
+
}).transform((v) => v.nocheck)
|
|
1254
|
+
]);
|
|
1255
|
+
|
|
1426
1256
|
// src/config/schema/local-entry.ts
|
|
1427
1257
|
import { stat as stat3 } from "fs/promises";
|
|
1428
1258
|
import { z as z33 } from "zod";
|
|
@@ -1485,7 +1315,6 @@ var StoresSchema = z35.union([
|
|
|
1485
1315
|
ResourceIdSchema,
|
|
1486
1316
|
z35.object({
|
|
1487
1317
|
static: LocalDirectorySchema.optional().describe("Specifies the path to the static files directory."),
|
|
1488
|
-
versioning: z35.boolean().default(false).describe("Enable versioning of your store."),
|
|
1489
1318
|
lifecycle: z35.array(LifecycleRuleSchema).optional().describe("S3 lifecycle rules for this store. Each rule expires objects matching an optional prefix."),
|
|
1490
1319
|
events: z35.object({
|
|
1491
1320
|
// create
|
|
@@ -1534,7 +1363,6 @@ var IconsSchema = z36.record(
|
|
|
1534
1363
|
// subDomain: z.string().optional(),
|
|
1535
1364
|
router: ResourceIdSchema.describe("The router id to link your icon proxy."),
|
|
1536
1365
|
path: RouteSchema.describe("The path inside the router to link your icon proxy to."),
|
|
1537
|
-
log: LogSchema.optional(),
|
|
1538
1366
|
cacheDuration: DurationSchema.optional().describe("The cache duration of the cached icons."),
|
|
1539
1367
|
preserveIds: z36.boolean().optional().default(false).describe("Preserve the IDs of the icons."),
|
|
1540
1368
|
symbols: z36.boolean().optional().default(false).describe(`Convert the SVG's to SVG symbols.`),
|
|
@@ -1591,7 +1419,6 @@ var ImagesSchema = z37.record(
|
|
|
1591
1419
|
// subDomain: z.string().optional(),
|
|
1592
1420
|
router: ResourceIdSchema.describe("The router id to link your image proxy."),
|
|
1593
1421
|
path: RouteSchema.describe("The path inside the router to link your image proxy to."),
|
|
1594
|
-
log: LogSchema.optional(),
|
|
1595
1422
|
cacheDuration: DurationSchema.optional().describe("Cache duration of the cached images."),
|
|
1596
1423
|
presets: z37.record(z37.string(), transformationOptionsSchema).describe("Named presets for image transformations"),
|
|
1597
1424
|
extensions: z37.object({
|
|
@@ -1677,7 +1504,7 @@ var MetricsSchema = z38.record(
|
|
|
1677
1504
|
).optional().describe("Define the metrics in your stack.");
|
|
1678
1505
|
|
|
1679
1506
|
// src/feature/table/schema.ts
|
|
1680
|
-
import { minutes as
|
|
1507
|
+
import { minutes as minutes4, seconds as seconds3 } from "@awsless/duration";
|
|
1681
1508
|
import { z as z39 } from "zod";
|
|
1682
1509
|
var KeySchema = z39.string().min(1).max(255);
|
|
1683
1510
|
var TablesSchema = z39.record(
|
|
@@ -1720,9 +1547,9 @@ var TablesSchema = z39.record(
|
|
|
1720
1547
|
].join("\n")
|
|
1721
1548
|
),
|
|
1722
1549
|
batchWindow: DurationSchema.refine(
|
|
1723
|
-
durationMin(
|
|
1550
|
+
durationMin(seconds3(1)),
|
|
1724
1551
|
"Minimum batch window duration is 1 second"
|
|
1725
|
-
).refine(durationMax(
|
|
1552
|
+
).refine(durationMax(minutes4(5)), "Maximum batch window duration is 5 minutes").optional().describe(
|
|
1726
1553
|
[
|
|
1727
1554
|
"The maximum amount of time that is spend gathering records before invoking the function.",
|
|
1728
1555
|
"You can specify a duration from 1 seconds to 5 minutes."
|
|
@@ -1804,7 +1631,6 @@ var StackSchema = z41.object({
|
|
|
1804
1631
|
// auth: AuthSchema,
|
|
1805
1632
|
// http: HttpSchema,
|
|
1806
1633
|
rest: RestSchema,
|
|
1807
|
-
routes: RoutesSchema,
|
|
1808
1634
|
rpc: RpcSchema,
|
|
1809
1635
|
configs: ConfigsSchema,
|
|
1810
1636
|
crons: CronsSchema,
|
|
@@ -2099,7 +1925,6 @@ var generateJsonSchema = (props) => {
|
|
|
2099
1925
|
var appendDefaults = (object) => {
|
|
2100
1926
|
if (Array.isArray(object)) {
|
|
2101
1927
|
object.forEach(appendDefaults);
|
|
2102
|
-
return;
|
|
2103
1928
|
}
|
|
2104
1929
|
if (typeof object === "object" && object !== null) {
|
|
2105
1930
|
if ("default" in object && "type" in object) {
|