@awsless/cli 0.0.44 → 0.0.46-next.0
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 +4246 -4069
- package/dist/build-json-schema.js +269 -444
- 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 +14 -20
- 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,14 +555,14 @@ 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:
|
|
562
|
+
subDomain: z16.string().optional(),
|
|
727
563
|
waf: WafSettingsSchema.optional(),
|
|
728
|
-
geoRestrictions:
|
|
729
|
-
errors:
|
|
564
|
+
geoRestrictions: z16.array(z16.string().length(2).toUpperCase()).default([]).describe("Specifies a blacklist of countries that should be blocked."),
|
|
565
|
+
errors: z16.object({
|
|
730
566
|
400: ErrorResponseSchema.describe("Customize a `400 Bad Request` response."),
|
|
731
567
|
403: ErrorResponseSchema.describe("Customize a `403 Forbidden` response."),
|
|
732
568
|
404: ErrorResponseSchema.describe("Customize a `404 Not Found` response."),
|
|
@@ -739,26 +575,26 @@ var RouterDefaultSchema = z17.record(
|
|
|
739
575
|
503: ErrorResponseSchema.describe("Customize a `503 Service Unavailable` response."),
|
|
740
576
|
504: ErrorResponseSchema.describe("Customize a `504 Gateway Timeout` response.")
|
|
741
577
|
}).optional().describe("Customize the error responses for specific HTTP status codes."),
|
|
742
|
-
cors:
|
|
743
|
-
override:
|
|
578
|
+
cors: z16.object({
|
|
579
|
+
override: z16.boolean().default(false),
|
|
744
580
|
maxAge: DurationSchema.default("365 days"),
|
|
745
|
-
exposeHeaders:
|
|
746
|
-
credentials:
|
|
747
|
-
headers:
|
|
748
|
-
origins:
|
|
749
|
-
methods:
|
|
581
|
+
exposeHeaders: z16.string().array().optional(),
|
|
582
|
+
credentials: z16.boolean().default(false),
|
|
583
|
+
headers: z16.string().array().default(["*"]),
|
|
584
|
+
origins: z16.string().array().default(["*"]),
|
|
585
|
+
methods: z16.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
|
|
750
586
|
}).optional().describe("Specify the cors headers."),
|
|
751
|
-
passwordAuth:
|
|
752
|
-
password:
|
|
587
|
+
passwordAuth: z16.object({
|
|
588
|
+
password: z16.string().describe("Password.")
|
|
753
589
|
}).optional().describe(
|
|
754
590
|
[
|
|
755
591
|
"Enable password authentication for the router.",
|
|
756
592
|
'You can authenicate by adding a "authorization" header with the value "Password [YOUR_PASSWORD]".'
|
|
757
593
|
].join("\n")
|
|
758
594
|
),
|
|
759
|
-
basicAuth:
|
|
760
|
-
username:
|
|
761
|
-
password:
|
|
595
|
+
basicAuth: z16.object({
|
|
596
|
+
username: z16.string().describe("Basic auth username."),
|
|
597
|
+
password: z16.string().describe("Basic auth password.")
|
|
762
598
|
}).optional().describe("Enable basic authentication for the router."),
|
|
763
599
|
// security: z
|
|
764
600
|
// .object({
|
|
@@ -805,10 +641,10 @@ var RouterDefaultSchema = z17.record(
|
|
|
805
641
|
// })
|
|
806
642
|
// .optional()
|
|
807
643
|
// .describe('Specify the security policy.'),
|
|
808
|
-
cache:
|
|
809
|
-
cookies:
|
|
810
|
-
headers:
|
|
811
|
-
queries:
|
|
644
|
+
cache: z16.object({
|
|
645
|
+
cookies: z16.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
|
|
646
|
+
headers: z16.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
|
|
647
|
+
queries: z16.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
|
|
812
648
|
}).optional().describe(
|
|
813
649
|
"Specifies the cookies, headers, and query values that CloudFront includes in the cache key."
|
|
814
650
|
)
|
|
@@ -816,9 +652,9 @@ var RouterDefaultSchema = z17.record(
|
|
|
816
652
|
).optional().describe(`Define the global Router. Backed by AWS CloudFront.`);
|
|
817
653
|
|
|
818
654
|
// src/feature/pubsub/schema.ts
|
|
819
|
-
var PubSubDefaultSchema =
|
|
655
|
+
var PubSubDefaultSchema = z17.record(
|
|
820
656
|
ResourceIdSchema,
|
|
821
|
-
|
|
657
|
+
z17.object({
|
|
822
658
|
auth: FunctionSchema.describe(
|
|
823
659
|
"The authorizer that validates the client auth token and returns the allowed topics."
|
|
824
660
|
),
|
|
@@ -829,9 +665,9 @@ var PubSubDefaultSchema = z18.record(
|
|
|
829
665
|
}))
|
|
830
666
|
})
|
|
831
667
|
).optional().describe("Define the pubsub API for your app. Backed by a websocket server on AWS Fargate.");
|
|
832
|
-
var PubSubSchema =
|
|
668
|
+
var PubSubSchema = z17.record(
|
|
833
669
|
ResourceIdSchema,
|
|
834
|
-
|
|
670
|
+
z17.object({
|
|
835
671
|
connected: FunctionSchema.optional().describe("Subscribe to the event when a client connects."),
|
|
836
672
|
disconnected: FunctionSchema.optional().describe("Subscribe to the event when a client disconnects."),
|
|
837
673
|
subscribed: FunctionSchema.optional().describe(
|
|
@@ -844,47 +680,35 @@ var PubSubSchema = z18.record(
|
|
|
844
680
|
).optional().describe("Define the pubsub event listeners in your stack.");
|
|
845
681
|
|
|
846
682
|
// src/feature/queue/schema.ts
|
|
847
|
-
import { days as days5,
|
|
683
|
+
import { days as days5, minutes as minutes3, seconds as seconds2 } from "@awsless/duration";
|
|
848
684
|
import { kibibytes } from "@awsless/size";
|
|
849
|
-
import { z as
|
|
685
|
+
import { z as z18 } from "zod";
|
|
850
686
|
var RetentionPeriodSchema = DurationSchema.refine(durationMin(minutes3(1)), "Minimum retention period is 1 minute").refine(durationMax(days5(14)), "Maximum retention period is 14 days").describe(
|
|
851
687
|
"The number of seconds that Amazon SQS retains a message. You can specify a duration from 1 minute to 14 days."
|
|
852
688
|
);
|
|
853
|
-
var VisibilityTimeoutSchema = DurationSchema.refine(
|
|
854
|
-
durationMax(hours(12)),
|
|
855
|
-
"Maximum visibility timeout is 12 hours"
|
|
856
|
-
).describe(
|
|
857
|
-
"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."
|
|
858
|
-
);
|
|
859
689
|
var ReceiveMessageWaitTimeSchema = DurationSchema.refine(
|
|
860
690
|
durationMin(seconds2(1)),
|
|
861
691
|
"Minimum receive message wait time is 1 second"
|
|
862
692
|
).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.");
|
|
863
693
|
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.");
|
|
864
|
-
var BatchSizeSchema =
|
|
865
|
-
var
|
|
866
|
-
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 999."
|
|
867
|
-
);
|
|
868
|
-
var QueueDefaultSchema = z19.object({
|
|
694
|
+
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.");
|
|
695
|
+
var QueueDefaultSchema = z18.object({
|
|
869
696
|
retentionPeriod: RetentionPeriodSchema.default("7 days"),
|
|
870
|
-
|
|
697
|
+
// The visibility timeout is derived from the bundle timeout.
|
|
871
698
|
receiveMessageWaitTime: ReceiveMessageWaitTimeSchema.optional(),
|
|
872
699
|
maxMessageSize: MaxMessageSizeSchema.default("256 KB"),
|
|
873
|
-
batchSize: BatchSizeSchema.default(10)
|
|
874
|
-
retryAttempts: RetryAttemptsSchema2.default(2)
|
|
700
|
+
batchSize: BatchSizeSchema.default(10)
|
|
875
701
|
}).default({});
|
|
876
|
-
var QueueSchema =
|
|
702
|
+
var QueueSchema = z18.object({
|
|
877
703
|
consumer: FunctionSchema.optional().describe("The consuming lambda function properties."),
|
|
878
704
|
retentionPeriod: RetentionPeriodSchema.optional(),
|
|
879
|
-
visibilityTimeout: VisibilityTimeoutSchema.optional(),
|
|
880
705
|
receiveMessageWaitTime: ReceiveMessageWaitTimeSchema.optional(),
|
|
881
706
|
maxMessageSize: MaxMessageSizeSchema.optional(),
|
|
882
|
-
batchSize: BatchSizeSchema.optional()
|
|
883
|
-
retryAttempts: RetryAttemptsSchema2.optional()
|
|
707
|
+
batchSize: BatchSizeSchema.optional()
|
|
884
708
|
});
|
|
885
|
-
var QueuesSchema =
|
|
709
|
+
var QueuesSchema = z18.record(
|
|
886
710
|
ResourceIdSchema,
|
|
887
|
-
|
|
711
|
+
z18.union([
|
|
888
712
|
LocalFileSchema.transform((consumer) => ({
|
|
889
713
|
consumer
|
|
890
714
|
})).pipe(QueueSchema),
|
|
@@ -895,26 +719,26 @@ var QueuesSchema = z19.record(
|
|
|
895
719
|
);
|
|
896
720
|
|
|
897
721
|
// src/feature/rest/schema.ts
|
|
898
|
-
import { z as
|
|
722
|
+
import { z as z20 } from "zod";
|
|
899
723
|
|
|
900
724
|
// src/config/schema/route.ts
|
|
901
|
-
import { z as
|
|
902
|
-
var RouteSchema2 =
|
|
903
|
-
|
|
904
|
-
|
|
725
|
+
import { z as z19 } from "zod";
|
|
726
|
+
var RouteSchema2 = z19.union([
|
|
727
|
+
z19.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS|ANY)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route"),
|
|
728
|
+
z19.literal("$default")
|
|
905
729
|
]);
|
|
906
730
|
|
|
907
731
|
// src/feature/rest/schema.ts
|
|
908
|
-
var RestDefaultSchema =
|
|
732
|
+
var RestDefaultSchema = z20.record(
|
|
909
733
|
ResourceIdSchema,
|
|
910
|
-
|
|
734
|
+
z20.object({
|
|
911
735
|
domain: ResourceIdSchema.describe("The domain id to link your API with.").optional(),
|
|
912
|
-
subDomain:
|
|
736
|
+
subDomain: z20.string().optional()
|
|
913
737
|
})
|
|
914
738
|
).optional().describe("Define your global REST API's.");
|
|
915
|
-
var RestSchema =
|
|
739
|
+
var RestSchema = z20.record(
|
|
916
740
|
ResourceIdSchema,
|
|
917
|
-
|
|
741
|
+
z20.record(
|
|
918
742
|
RouteSchema2.describe(
|
|
919
743
|
[
|
|
920
744
|
"The REST API route that is comprised by the http method and http path.",
|
|
@@ -927,40 +751,31 @@ var RestSchema = z21.record(
|
|
|
927
751
|
).optional().describe("Define routes in your stack for your global REST API.");
|
|
928
752
|
|
|
929
753
|
// src/feature/rpc/schema.ts
|
|
930
|
-
import {
|
|
931
|
-
|
|
932
|
-
var TimeoutSchema2 = DurationSchema.refine(durationMin(seconds3(10)), "Minimum timeout duration is 10 seconds").refine(durationMax(minutes4(5)), "Maximum timeout duration is 5 minutes").describe(
|
|
933
|
-
[
|
|
934
|
-
"The amount of time that the RPC lambda is allowed run before stopping it.",
|
|
935
|
-
"You can specify a timeout from 10 second to 5 minutes.",
|
|
936
|
-
"The timeouts of all inner RPC functions will be capped at 80% of this timeout."
|
|
937
|
-
].join(" ")
|
|
938
|
-
);
|
|
939
|
-
var RpcDefaultSchema = z22.record(
|
|
754
|
+
import { z as z21 } from "zod";
|
|
755
|
+
var RpcDefaultSchema = z21.record(
|
|
940
756
|
ResourceIdSchema,
|
|
941
|
-
|
|
757
|
+
z21.object({
|
|
942
758
|
// domain: ResourceIdSchema.describe('The domain id to link your RPC API with.').optional(),
|
|
943
759
|
// subDomain: z.string().optional(),
|
|
944
760
|
//
|
|
945
761
|
router: ResourceIdSchema.describe("The router id to link your RPC API with."),
|
|
946
762
|
path: RouteSchema.describe("The path inside the router to link your RPC API to."),
|
|
947
|
-
auth: FunctionSchema.optional().describe("The authentication handler for your RPC API.")
|
|
948
|
-
|
|
949
|
-
timeout: TimeoutSchema2.default("1 minutes")
|
|
763
|
+
auth: FunctionSchema.optional().describe("The authentication handler for your RPC API.")
|
|
764
|
+
// timeout: TimeoutSchema.default('1 minutes'),
|
|
950
765
|
})
|
|
951
766
|
).describe(`Define the global RPC API's.`).optional();
|
|
952
|
-
var RpcSchema =
|
|
767
|
+
var RpcSchema = z21.record(
|
|
953
768
|
ResourceIdSchema,
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
769
|
+
z21.record(
|
|
770
|
+
z21.string(),
|
|
771
|
+
z21.union([
|
|
957
772
|
FunctionSchema.transform((f) => ({
|
|
958
773
|
function: f,
|
|
959
774
|
lock: false
|
|
960
775
|
})),
|
|
961
|
-
|
|
776
|
+
z21.object({
|
|
962
777
|
function: FunctionSchema.describe("The RPC function to execute."),
|
|
963
|
-
lock:
|
|
778
|
+
lock: z21.boolean().describe(
|
|
964
779
|
[
|
|
965
780
|
"Specify if the function should be locked on the `lockKey` returned from the auth function.",
|
|
966
781
|
"An example would be returning the user ID as `lockKey`."
|
|
@@ -974,8 +789,8 @@ var RpcSchema = z22.record(
|
|
|
974
789
|
// src/feature/job/schema.ts
|
|
975
790
|
import { days as days6, toDays as toDays3 } from "@awsless/duration";
|
|
976
791
|
import { toMebibytes as toMebibytes2 } from "@awsless/size";
|
|
977
|
-
import { z as
|
|
978
|
-
var CpuSchema2 =
|
|
792
|
+
import { z as z22 } from "zod";
|
|
793
|
+
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.");
|
|
979
794
|
var validMemorySize2 = [
|
|
980
795
|
// 0.25 vCPU
|
|
981
796
|
512,
|
|
@@ -1013,20 +828,20 @@ var MemorySizeSchema3 = SizeSchema.refine(
|
|
|
1013
828
|
(s) => validMemorySize2.includes(toMebibytes2(s)),
|
|
1014
829
|
`Invalid memory size. Allowed sizes: ${validMemorySize2.join(", ")} MiB`
|
|
1015
830
|
).describe("The amount of memory (in MiB) used by the job. Valid memory values depend on the CPU configuration.");
|
|
1016
|
-
var EnvironmentSchema3 =
|
|
1017
|
-
var ArchitectureSchema4 =
|
|
1018
|
-
var ActionSchema3 =
|
|
1019
|
-
var ActionsSchema3 =
|
|
1020
|
-
var ArnSchema3 =
|
|
1021
|
-
var WildcardSchema3 =
|
|
1022
|
-
var ResourceSchema3 =
|
|
1023
|
-
var ResourcesSchema3 =
|
|
1024
|
-
var PermissionSchema3 =
|
|
1025
|
-
effect:
|
|
831
|
+
var EnvironmentSchema3 = z22.record(z22.string(), z22.string()).optional().describe("Environment variable key-value pairs.");
|
|
832
|
+
var ArchitectureSchema4 = z22.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the job supports.");
|
|
833
|
+
var ActionSchema3 = z22.string();
|
|
834
|
+
var ActionsSchema3 = z22.union([ActionSchema3.transform((v) => [v]), ActionSchema3.array()]);
|
|
835
|
+
var ArnSchema3 = z22.string().startsWith("arn:");
|
|
836
|
+
var WildcardSchema3 = z22.literal("*");
|
|
837
|
+
var ResourceSchema3 = z22.union([ArnSchema3, WildcardSchema3]);
|
|
838
|
+
var ResourcesSchema3 = z22.union([ResourceSchema3.transform((v) => [v]), ResourceSchema3.array()]);
|
|
839
|
+
var PermissionSchema3 = z22.object({
|
|
840
|
+
effect: z22.enum(["allow", "deny"]).default("allow"),
|
|
1026
841
|
actions: ActionsSchema3,
|
|
1027
842
|
resources: ResourcesSchema3
|
|
1028
843
|
});
|
|
1029
|
-
var PermissionsSchema3 =
|
|
844
|
+
var PermissionsSchema3 = z22.union([PermissionSchema3.transform((v) => [v]), PermissionSchema3.array()]).describe("Add IAM permissions to your job.");
|
|
1030
845
|
var validLogRetentionDays3 = [
|
|
1031
846
|
...[1, 3, 5, 7, 14, 30, 60, 90, 120, 150],
|
|
1032
847
|
...[180, 365, 400, 545, 731, 1096, 1827, 2192],
|
|
@@ -1041,27 +856,27 @@ var LogRetentionSchema3 = DurationSchema.refine(
|
|
|
1041
856
|
},
|
|
1042
857
|
`Invalid log retention. Valid days are: ${validLogRetentionDays3.map((days8) => `${days8}`).join(", ")}`
|
|
1043
858
|
).describe("The log retention duration.");
|
|
1044
|
-
var LogSchema3 =
|
|
1045
|
-
|
|
859
|
+
var LogSchema3 = z22.union([
|
|
860
|
+
z22.boolean().transform((enabled) => ({ retention: enabled ? days6(7) : days6(0) })),
|
|
1046
861
|
LogRetentionSchema3.transform((retention) => ({ retention })),
|
|
1047
|
-
|
|
862
|
+
z22.object({
|
|
1048
863
|
retention: LogRetentionSchema3.optional()
|
|
1049
864
|
})
|
|
1050
865
|
]).describe("Enable logging to a CloudWatch log group. Providing a duration value will set the log retention time.");
|
|
1051
|
-
var FileCodeSchema3 =
|
|
866
|
+
var FileCodeSchema3 = z22.object({
|
|
1052
867
|
file: LocalFileSchema.describe("The file path of the job code.")
|
|
1053
868
|
});
|
|
1054
|
-
var CodeSchema3 =
|
|
869
|
+
var CodeSchema3 = z22.union([
|
|
1055
870
|
LocalFileSchema.transform((file) => ({
|
|
1056
871
|
file
|
|
1057
872
|
})).pipe(FileCodeSchema3),
|
|
1058
873
|
FileCodeSchema3
|
|
1059
874
|
]).describe("Specify the code of your job.");
|
|
1060
|
-
var
|
|
1061
|
-
var ImageSchema2 =
|
|
1062
|
-
var PersistentStorageSchema =
|
|
1063
|
-
var StartupCommandSchema2 =
|
|
1064
|
-
var ASchema =
|
|
875
|
+
var TimeoutSchema2 = DurationSchema.describe("The maximum time the job is allowed to run before being stopped.");
|
|
876
|
+
var ImageSchema2 = z22.string().describe("The URL of the container image to use. Default: public.ecr.aws/aws-cli/aws-cli:{architecture}");
|
|
877
|
+
var PersistentStorageSchema = z22.boolean().describe("Mount persistent storage for the job at a fixed internal path.");
|
|
878
|
+
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.");
|
|
879
|
+
var ASchema = z22.object({
|
|
1065
880
|
code: CodeSchema3,
|
|
1066
881
|
image: ImageSchema2.optional(),
|
|
1067
882
|
persistentStorage: PersistentStorageSchema.optional(),
|
|
@@ -1072,16 +887,16 @@ var ASchema = z23.object({
|
|
|
1072
887
|
architecture: ArchitectureSchema4.optional(),
|
|
1073
888
|
environment: EnvironmentSchema3.optional(),
|
|
1074
889
|
permissions: PermissionsSchema3.optional(),
|
|
1075
|
-
timeout:
|
|
890
|
+
timeout: TimeoutSchema2.default("30 minutes").describe("The maximum time the job is allowed to run before being stopped. Default: 30 minutes.")
|
|
1076
891
|
});
|
|
1077
|
-
var JobSchema =
|
|
892
|
+
var JobSchema = z22.union([
|
|
1078
893
|
LocalFileSchema.transform((code) => ({
|
|
1079
894
|
code
|
|
1080
895
|
})).pipe(ASchema),
|
|
1081
896
|
ASchema
|
|
1082
897
|
]);
|
|
1083
|
-
var JobsSchema =
|
|
1084
|
-
var JobDefaultSchema =
|
|
898
|
+
var JobsSchema = z22.record(ResourceIdSchema, JobSchema).optional().describe("Define the jobs in your stack.");
|
|
899
|
+
var JobDefaultSchema = z22.object({
|
|
1085
900
|
image: ImageSchema2.optional(),
|
|
1086
901
|
persistentStorage: PersistentStorageSchema.optional(),
|
|
1087
902
|
cpu: CpuSchema2.default(0.25),
|
|
@@ -1089,7 +904,7 @@ var JobDefaultSchema = z23.object({
|
|
|
1089
904
|
architecture: ArchitectureSchema4.default("arm64"),
|
|
1090
905
|
environment: EnvironmentSchema3.optional(),
|
|
1091
906
|
permissions: PermissionsSchema3.optional(),
|
|
1092
|
-
timeout:
|
|
907
|
+
timeout: TimeoutSchema2.optional(),
|
|
1093
908
|
log: LogSchema3.default(true).transform((log) => ({
|
|
1094
909
|
retention: log.retention ?? days6(7)
|
|
1095
910
|
}))
|
|
@@ -1097,15 +912,15 @@ var JobDefaultSchema = z23.object({
|
|
|
1097
912
|
|
|
1098
913
|
// src/feature/topic/schema.ts
|
|
1099
914
|
import { kebabCase as kebabCase3 } from "change-case";
|
|
1100
|
-
import { z as
|
|
1101
|
-
var TopicNameSchema =
|
|
1102
|
-
var TopicsDefaultSchema =
|
|
915
|
+
import { z as z23 } from "zod";
|
|
916
|
+
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.");
|
|
917
|
+
var TopicsDefaultSchema = z23.array(TopicNameSchema).refine((topics) => {
|
|
1103
918
|
return topics.length === new Set(topics).size;
|
|
1104
919
|
}, "Must be a list of unique topic names").optional().describe("Define the event topics for your app.");
|
|
1105
|
-
var SubscribersSchema =
|
|
920
|
+
var SubscribersSchema = z23.record(TopicNameSchema, TaskSchema).optional().describe("Define the event topics to subscribe too in your stack.");
|
|
1106
921
|
|
|
1107
922
|
// src/config/schema/region.ts
|
|
1108
|
-
import { z as
|
|
923
|
+
import { z as z24 } from "zod";
|
|
1109
924
|
var US = ["us-east-2", "us-east-1", "us-west-1", "us-west-2"];
|
|
1110
925
|
var AF = ["af-south-1"];
|
|
1111
926
|
var AP = [
|
|
@@ -1134,16 +949,16 @@ var EU = [
|
|
|
1134
949
|
var ME = ["me-south-1", "me-central-1"];
|
|
1135
950
|
var SA = ["sa-east-1"];
|
|
1136
951
|
var regions = [...US, ...AF, ...AP, ...CA, ...EU, ...ME, ...SA];
|
|
1137
|
-
var RegionSchema =
|
|
952
|
+
var RegionSchema = z24.enum(regions);
|
|
1138
953
|
|
|
1139
954
|
// src/config/app.ts
|
|
1140
|
-
var AppSchema =
|
|
1141
|
-
$schema:
|
|
955
|
+
var AppSchema = z25.object({
|
|
956
|
+
$schema: z25.string().optional(),
|
|
1142
957
|
name: ResourceIdSchema.describe("App name."),
|
|
1143
958
|
region: RegionSchema.describe("The AWS region to deploy to."),
|
|
1144
|
-
profile:
|
|
1145
|
-
protect:
|
|
1146
|
-
removal:
|
|
959
|
+
profile: z25.string().describe("The AWS profile to deploy to."),
|
|
960
|
+
protect: z25.boolean().default(false).describe("Protect your app & stacks from being deleted."),
|
|
961
|
+
removal: z25.enum(["remove", "retain"]).default("remove").describe(
|
|
1147
962
|
[
|
|
1148
963
|
"Configure how your resources are handled when they have to be removed.",
|
|
1149
964
|
"",
|
|
@@ -1157,7 +972,7 @@ var AppSchema = z26.object({
|
|
|
1157
972
|
// .default('prod')
|
|
1158
973
|
// .describe('The deployment stage.'),
|
|
1159
974
|
// onFailure: OnFailureSchema,
|
|
1160
|
-
defaults:
|
|
975
|
+
defaults: z25.object({
|
|
1161
976
|
onFailure: OnFailureDefaultSchema,
|
|
1162
977
|
onErrorLog: OnErrorLogDefaultSchema,
|
|
1163
978
|
auth: AuthDefaultSchema,
|
|
@@ -1186,7 +1001,7 @@ import { z as z41 } from "zod";
|
|
|
1186
1001
|
|
|
1187
1002
|
// src/feature/cache/schema.ts
|
|
1188
1003
|
import { gibibytes as gibibytes2 } from "@awsless/size";
|
|
1189
|
-
import { z as
|
|
1004
|
+
import { z as z26 } from "zod";
|
|
1190
1005
|
var StorageSchema = SizeSchema.refine(sizeMin(gibibytes2(1)), "Minimum storage size is 1 GB").refine(
|
|
1191
1006
|
sizeMax(gibibytes2(5e3)),
|
|
1192
1007
|
"Maximum storage size is 5000 GB"
|
|
@@ -1197,31 +1012,31 @@ var MinimumStorageSchema = StorageSchema.describe(
|
|
|
1197
1012
|
var MaximumStorageSchema = StorageSchema.describe(
|
|
1198
1013
|
"The upper limit for data storage the cache is set to use. You can specify a size value from 1 GB to 5000 GB."
|
|
1199
1014
|
);
|
|
1200
|
-
var EcpuSchema =
|
|
1015
|
+
var EcpuSchema = z26.number().int().min(1e3).max(15e6);
|
|
1201
1016
|
var MinimumEcpuSchema = EcpuSchema.describe(
|
|
1202
1017
|
"The minimum number of ECPUs the cache can consume per second. You can specify a integer from 1,000 to 15,000,000."
|
|
1203
1018
|
);
|
|
1204
1019
|
var MaximumEcpuSchema = EcpuSchema.describe(
|
|
1205
1020
|
"The maximum number of ECPUs the cache can consume per second. You can specify a integer from 1,000 to 15,000,000."
|
|
1206
1021
|
);
|
|
1207
|
-
var CachesSchema =
|
|
1022
|
+
var CachesSchema = z26.record(
|
|
1208
1023
|
ResourceIdSchema,
|
|
1209
|
-
|
|
1024
|
+
z26.object({
|
|
1210
1025
|
minStorage: MinimumStorageSchema.optional(),
|
|
1211
1026
|
maxStorage: MaximumStorageSchema.optional(),
|
|
1212
1027
|
minECPU: MinimumEcpuSchema.optional(),
|
|
1213
1028
|
maxECPU: MaximumEcpuSchema.optional(),
|
|
1214
|
-
snapshotRetentionLimit:
|
|
1029
|
+
snapshotRetentionLimit: z26.number().int().positive().default(1)
|
|
1215
1030
|
})
|
|
1216
1031
|
).optional().describe("Define the caches in your stack. For access to the cache put your functions inside the global VPC.");
|
|
1217
1032
|
|
|
1218
1033
|
// src/feature/command/schema.ts
|
|
1219
|
-
import { z as
|
|
1220
|
-
var CommandSchema =
|
|
1221
|
-
|
|
1034
|
+
import { z as z27 } from "zod";
|
|
1035
|
+
var CommandSchema = z27.union([
|
|
1036
|
+
z27.object({
|
|
1222
1037
|
file: LocalFileSchema,
|
|
1223
|
-
handler:
|
|
1224
|
-
description:
|
|
1038
|
+
handler: z27.string().default("default").describe("The name of the handler that needs to run"),
|
|
1039
|
+
description: z27.string().optional().describe("A description of the command")
|
|
1225
1040
|
// options: z.record(ResourceIdSchema, OptionSchema).optional(),
|
|
1226
1041
|
// arguments: z.record(ResourceIdSchema, ArgumentSchema).optional(),
|
|
1227
1042
|
}),
|
|
@@ -1231,22 +1046,22 @@ var CommandSchema = z28.union([
|
|
|
1231
1046
|
description: void 0
|
|
1232
1047
|
}))
|
|
1233
1048
|
]);
|
|
1234
|
-
var CommandsSchema =
|
|
1049
|
+
var CommandsSchema = z27.record(ResourceIdSchema, CommandSchema).optional().describe("Define the custom commands for your stack.");
|
|
1235
1050
|
|
|
1236
1051
|
// src/feature/config/schema.ts
|
|
1237
|
-
import { z as
|
|
1238
|
-
var ConfigNameSchema =
|
|
1239
|
-
var ConfigsSchema =
|
|
1052
|
+
import { z as z28 } from "zod";
|
|
1053
|
+
var ConfigNameSchema = z28.string().regex(/[a-z0-9\-]/g, "Invalid config name");
|
|
1054
|
+
var ConfigsSchema = z28.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
|
|
1240
1055
|
|
|
1241
1056
|
// src/feature/cron/schema/index.ts
|
|
1242
|
-
import { z as
|
|
1057
|
+
import { z as z30 } from "zod";
|
|
1243
1058
|
|
|
1244
1059
|
// src/feature/cron/schema/schedule.ts
|
|
1245
|
-
import { z as
|
|
1060
|
+
import { z as z29 } from "zod";
|
|
1246
1061
|
import { awsCronExpressionValidator } from "aws-cron-expression-validator";
|
|
1247
|
-
var RateExpressionSchema =
|
|
1062
|
+
var RateExpressionSchema = z29.custom(
|
|
1248
1063
|
(value) => {
|
|
1249
|
-
return
|
|
1064
|
+
return z29.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
|
|
1250
1065
|
const [str] = rate.split(" ");
|
|
1251
1066
|
const number = parseInt(str);
|
|
1252
1067
|
return number > 0;
|
|
@@ -1262,9 +1077,9 @@ var RateExpressionSchema = z30.custom(
|
|
|
1262
1077
|
}
|
|
1263
1078
|
return `rate(${rate})`;
|
|
1264
1079
|
});
|
|
1265
|
-
var CronExpressionSchema =
|
|
1080
|
+
var CronExpressionSchema = z29.custom(
|
|
1266
1081
|
(value) => {
|
|
1267
|
-
return
|
|
1082
|
+
return z29.string().safeParse(value).success;
|
|
1268
1083
|
},
|
|
1269
1084
|
{ message: "Invalid cron expression" }
|
|
1270
1085
|
).superRefine((value, ctx) => {
|
|
@@ -1273,12 +1088,12 @@ var CronExpressionSchema = z30.custom(
|
|
|
1273
1088
|
} catch (error) {
|
|
1274
1089
|
if (error instanceof Error) {
|
|
1275
1090
|
ctx.addIssue({
|
|
1276
|
-
code:
|
|
1091
|
+
code: z29.ZodIssueCode.custom,
|
|
1277
1092
|
message: `Invalid cron expression: ${error.message}`
|
|
1278
1093
|
});
|
|
1279
1094
|
} else {
|
|
1280
1095
|
ctx.addIssue({
|
|
1281
|
-
code:
|
|
1096
|
+
code: z29.ZodIssueCode.custom,
|
|
1282
1097
|
message: "Invalid cron expression"
|
|
1283
1098
|
});
|
|
1284
1099
|
}
|
|
@@ -1289,32 +1104,28 @@ var CronExpressionSchema = z30.custom(
|
|
|
1289
1104
|
var ScheduleExpressionSchema = RateExpressionSchema.or(CronExpressionSchema);
|
|
1290
1105
|
|
|
1291
1106
|
// src/feature/cron/schema/index.ts
|
|
1292
|
-
var
|
|
1293
|
-
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
|
|
1294
|
-
);
|
|
1295
|
-
var CronsSchema = z31.record(
|
|
1107
|
+
var CronsSchema = z30.record(
|
|
1296
1108
|
ResourceIdSchema,
|
|
1297
|
-
|
|
1298
|
-
enabled:
|
|
1109
|
+
z30.object({
|
|
1110
|
+
enabled: z30.boolean().default(true).describe("If the cron is enabled."),
|
|
1299
1111
|
consumer: FunctionSchema.describe("The consuming lambda function properties."),
|
|
1300
1112
|
schedule: ScheduleExpressionSchema.describe(
|
|
1301
1113
|
'The scheduling expression.\n\nexample: "0 20 * * ? *"\nexample: "5 minutes"'
|
|
1302
1114
|
),
|
|
1303
|
-
payload:
|
|
1304
|
-
retryAttempts: RetryAttemptsSchema3.default(2)
|
|
1115
|
+
payload: z30.unknown().optional().describe("The JSON payload that will be passed to the consumer.")
|
|
1305
1116
|
})
|
|
1306
1117
|
).optional().describe(`Define the cron jobs in your stack.`);
|
|
1307
1118
|
|
|
1308
1119
|
// src/feature/search/schema.ts
|
|
1309
1120
|
import { gibibytes as gibibytes3 } from "@awsless/size";
|
|
1310
|
-
import { z as
|
|
1311
|
-
var VersionSchema =
|
|
1121
|
+
import { z as z31 } from "zod";
|
|
1122
|
+
var VersionSchema = z31.union([
|
|
1312
1123
|
//
|
|
1313
|
-
|
|
1314
|
-
|
|
1124
|
+
z31.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]),
|
|
1125
|
+
z31.string()
|
|
1315
1126
|
]).describe("Specify the OpenSearch engine version.");
|
|
1316
|
-
var TypeSchema =
|
|
1317
|
-
|
|
1127
|
+
var TypeSchema = z31.union([
|
|
1128
|
+
z31.enum([
|
|
1318
1129
|
"t3.small",
|
|
1319
1130
|
"t3.medium",
|
|
1320
1131
|
"m3.medium",
|
|
@@ -1388,13 +1199,13 @@ var TypeSchema = z32.union([
|
|
|
1388
1199
|
"r6gd.12xlarge",
|
|
1389
1200
|
"r6gd.16xlarge"
|
|
1390
1201
|
]),
|
|
1391
|
-
|
|
1202
|
+
z31.string()
|
|
1392
1203
|
]).describe("Instance type of data nodes in the cluster.");
|
|
1393
|
-
var CountSchema =
|
|
1204
|
+
var CountSchema = z31.number().int().min(1).describe("Number of instances in the cluster.");
|
|
1394
1205
|
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.");
|
|
1395
|
-
var SearchsSchema =
|
|
1206
|
+
var SearchsSchema = z31.record(
|
|
1396
1207
|
ResourceIdSchema,
|
|
1397
|
-
|
|
1208
|
+
z31.object({
|
|
1398
1209
|
type: TypeSchema.default("t3.small"),
|
|
1399
1210
|
count: CountSchema.default(1),
|
|
1400
1211
|
version: VersionSchema.default("2.13"),
|
|
@@ -1407,6 +1218,25 @@ var SearchsSchema = z32.record(
|
|
|
1407
1218
|
// src/feature/site/schema.ts
|
|
1408
1219
|
import { z as z34 } from "zod";
|
|
1409
1220
|
|
|
1221
|
+
// src/config/schema/local-directory.ts
|
|
1222
|
+
import { stat as stat2 } from "fs/promises";
|
|
1223
|
+
import { z as z32 } from "zod";
|
|
1224
|
+
var LocalDirectorySchema = z32.union([
|
|
1225
|
+
RelativePathSchema.refine(async (path) => {
|
|
1226
|
+
try {
|
|
1227
|
+
const s = await stat2(path);
|
|
1228
|
+
return s.isDirectory();
|
|
1229
|
+
} catch (error) {
|
|
1230
|
+
return false;
|
|
1231
|
+
}
|
|
1232
|
+
}, `Directory doesn't exist`),
|
|
1233
|
+
z32.object({
|
|
1234
|
+
nocheck: RelativePathSchema.describe(
|
|
1235
|
+
"Specifies a local directory without checking if the directory exists."
|
|
1236
|
+
)
|
|
1237
|
+
}).transform((v) => v.nocheck)
|
|
1238
|
+
]);
|
|
1239
|
+
|
|
1410
1240
|
// src/config/schema/local-entry.ts
|
|
1411
1241
|
import { stat as stat3 } from "fs/promises";
|
|
1412
1242
|
import { z as z33 } from "zod";
|
|
@@ -1469,7 +1299,6 @@ var StoresSchema = z35.union([
|
|
|
1469
1299
|
ResourceIdSchema,
|
|
1470
1300
|
z35.object({
|
|
1471
1301
|
static: LocalDirectorySchema.optional().describe("Specifies the path to the static files directory."),
|
|
1472
|
-
versioning: z35.boolean().default(false).describe("Enable versioning of your store."),
|
|
1473
1302
|
lifecycle: z35.array(LifecycleRuleSchema).optional().describe("S3 lifecycle rules for this store. Each rule expires objects matching an optional prefix."),
|
|
1474
1303
|
events: z35.object({
|
|
1475
1304
|
// create
|
|
@@ -1518,7 +1347,6 @@ var IconsSchema = z36.record(
|
|
|
1518
1347
|
// subDomain: z.string().optional(),
|
|
1519
1348
|
router: ResourceIdSchema.describe("The router id to link your icon proxy."),
|
|
1520
1349
|
path: RouteSchema.describe("The path inside the router to link your icon proxy to."),
|
|
1521
|
-
log: LogSchema.optional(),
|
|
1522
1350
|
cacheDuration: DurationSchema.optional().describe("The cache duration of the cached icons."),
|
|
1523
1351
|
preserveIds: z36.boolean().optional().default(false).describe("Preserve the IDs of the icons."),
|
|
1524
1352
|
symbols: z36.boolean().optional().default(false).describe(`Convert the SVG's to SVG symbols.`),
|
|
@@ -1575,7 +1403,6 @@ var ImagesSchema = z37.record(
|
|
|
1575
1403
|
// subDomain: z.string().optional(),
|
|
1576
1404
|
router: ResourceIdSchema.describe("The router id to link your image proxy."),
|
|
1577
1405
|
path: RouteSchema.describe("The path inside the router to link your image proxy to."),
|
|
1578
|
-
log: LogSchema.optional(),
|
|
1579
1406
|
cacheDuration: DurationSchema.optional().describe("Cache duration of the cached images."),
|
|
1580
1407
|
presets: z37.record(z37.string(), transformationOptionsSchema).describe("Named presets for image transformations"),
|
|
1581
1408
|
extensions: z37.object({
|
|
@@ -1661,7 +1488,7 @@ var MetricsSchema = z38.record(
|
|
|
1661
1488
|
).optional().describe("Define the metrics in your stack.");
|
|
1662
1489
|
|
|
1663
1490
|
// src/feature/table/schema.ts
|
|
1664
|
-
import { minutes as
|
|
1491
|
+
import { minutes as minutes4, seconds as seconds3 } from "@awsless/duration";
|
|
1665
1492
|
import { z as z39 } from "zod";
|
|
1666
1493
|
var KeySchema = z39.string().min(1).max(255);
|
|
1667
1494
|
var TablesSchema = z39.record(
|
|
@@ -1704,9 +1531,9 @@ var TablesSchema = z39.record(
|
|
|
1704
1531
|
].join("\n")
|
|
1705
1532
|
),
|
|
1706
1533
|
batchWindow: DurationSchema.refine(
|
|
1707
|
-
durationMin(
|
|
1534
|
+
durationMin(seconds3(1)),
|
|
1708
1535
|
"Minimum batch window duration is 1 second"
|
|
1709
|
-
).refine(durationMax(
|
|
1536
|
+
).refine(durationMax(minutes4(5)), "Maximum batch window duration is 5 minutes").optional().describe(
|
|
1710
1537
|
[
|
|
1711
1538
|
"The maximum amount of time that is spend gathering records before invoking the function.",
|
|
1712
1539
|
"You can specify a duration from 1 seconds to 5 minutes."
|
|
@@ -1788,7 +1615,6 @@ var StackSchema = z41.object({
|
|
|
1788
1615
|
// auth: AuthSchema,
|
|
1789
1616
|
// http: HttpSchema,
|
|
1790
1617
|
rest: RestSchema,
|
|
1791
|
-
routes: RoutesSchema,
|
|
1792
1618
|
rpc: RpcSchema,
|
|
1793
1619
|
configs: ConfigsSchema,
|
|
1794
1620
|
crons: CronsSchema,
|
|
@@ -2083,7 +1909,6 @@ var generateJsonSchema = (props) => {
|
|
|
2083
1909
|
var appendDefaults = (object) => {
|
|
2084
1910
|
if (Array.isArray(object)) {
|
|
2085
1911
|
object.forEach(appendDefaults);
|
|
2086
|
-
return;
|
|
2087
1912
|
}
|
|
2088
1913
|
if (typeof object === "object" && object !== null) {
|
|
2089
1914
|
if ("default" in object && "type" in object) {
|