@awsless/awsless 0.0.470 → 0.0.472
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.json +1 -1
- package/dist/bin.js +424 -369
- package/dist/build-json-schema.js +232 -198
- package/dist/prebuild/rpc/HASH +1 -1
- package/dist/prebuild/rpc/bundle.zip +0 -0
- package/dist/prebuild.js +21 -24
- package/dist/stack.json +1 -1
- package/package.json +12 -12
|
@@ -4,7 +4,7 @@ import { join as join2 } from "node: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 z21 } from "zod";
|
|
8
8
|
|
|
9
9
|
// src/feature/alert/schema.ts
|
|
10
10
|
import { kebabCase } from "change-case";
|
|
@@ -119,10 +119,11 @@ var DomainsDefaultSchema = z6.record(
|
|
|
119
119
|
// src/feature/function/schema.ts
|
|
120
120
|
import { days, minutes, seconds, toDays } from "@awsless/duration";
|
|
121
121
|
import { gibibytes, mebibytes } from "@awsless/size";
|
|
122
|
-
import { z as
|
|
122
|
+
import { z as z11 } from "zod";
|
|
123
123
|
|
|
124
124
|
// src/config/schema/local-directory.ts
|
|
125
125
|
import { stat } from "fs/promises";
|
|
126
|
+
import { z as z8 } from "zod";
|
|
126
127
|
|
|
127
128
|
// src/config/schema/relative-path.ts
|
|
128
129
|
import { join } from "path";
|
|
@@ -137,30 +138,41 @@ var resolvePath = (path) => {
|
|
|
137
138
|
var RelativePathSchema = z7.string().transform((path) => resolvePath(path));
|
|
138
139
|
|
|
139
140
|
// src/config/schema/local-directory.ts
|
|
140
|
-
var LocalDirectorySchema =
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
141
|
+
var LocalDirectorySchema = z8.union([
|
|
142
|
+
RelativePathSchema.refine(async (path) => {
|
|
143
|
+
try {
|
|
144
|
+
const s = await stat(path);
|
|
145
|
+
return s.isDirectory();
|
|
146
|
+
} catch (error) {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
}, `Directory doesn't exist`),
|
|
150
|
+
z8.object({
|
|
151
|
+
nocheck: z8.string().describe("Specifies a local directory without checking if the directory exists.")
|
|
152
|
+
}).transform((v) => v.nocheck)
|
|
153
|
+
]);
|
|
148
154
|
|
|
149
155
|
// src/config/schema/local-file.ts
|
|
150
156
|
import { stat as stat2 } from "fs/promises";
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
157
|
+
import { z as z9 } from "zod";
|
|
158
|
+
var LocalFileSchema = z9.union([
|
|
159
|
+
RelativePathSchema.refine(async (path) => {
|
|
160
|
+
try {
|
|
161
|
+
const s = await stat2(path);
|
|
162
|
+
return s.isFile();
|
|
163
|
+
} catch (error) {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
}, `File doesn't exist`),
|
|
167
|
+
z9.object({
|
|
168
|
+
nocheck: z9.string().describe("Specifies a local file without checking if the file exists.")
|
|
169
|
+
}).transform((v) => v.nocheck)
|
|
170
|
+
]);
|
|
159
171
|
|
|
160
172
|
// src/config/schema/size.ts
|
|
161
173
|
import { parse as parse2 } from "@awsless/size";
|
|
162
|
-
import { z as
|
|
163
|
-
var SizeSchema =
|
|
174
|
+
import { z as z10 } from "zod";
|
|
175
|
+
var SizeSchema = z10.string().regex(/^[0-9]+ (B|KB|MB|GB|TB|PB)$/, "Invalid size").transform((v) => parse2(v));
|
|
164
176
|
var sizeMin = (min) => {
|
|
165
177
|
return (size) => {
|
|
166
178
|
return size.value >= min.value;
|
|
@@ -183,32 +195,32 @@ var EphemeralStorageSizeSchema = SizeSchema.refine(
|
|
|
183
195
|
sizeMin(mebibytes(512)),
|
|
184
196
|
"Minimum ephemeral storage size is 512 MB"
|
|
185
197
|
).refine(sizeMax(gibibytes(10)), "Minimum ephemeral storage size is 10 GB").describe("The size of the function's /tmp directory. You can specify a size value from 512 MB to 10 GB.");
|
|
186
|
-
var ReservedConcurrentExecutionsSchema =
|
|
187
|
-
var EnvironmentSchema =
|
|
188
|
-
var ArchitectureSchema =
|
|
189
|
-
var RetryAttemptsSchema =
|
|
198
|
+
var ReservedConcurrentExecutionsSchema = z11.number().int().min(0).describe("The number of simultaneous executions to reserve for the function. You can specify a number from 0.");
|
|
199
|
+
var EnvironmentSchema = z11.record(z11.string(), z11.string()).optional().describe("Environment variable key-value pairs.");
|
|
200
|
+
var ArchitectureSchema = z11.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the function supports.");
|
|
201
|
+
var RetryAttemptsSchema = z11.number().int().min(0).max(2).describe(
|
|
190
202
|
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
|
|
191
203
|
);
|
|
192
|
-
var NodeRuntimeSchema =
|
|
193
|
-
var ContainerRuntimeSchema =
|
|
204
|
+
var NodeRuntimeSchema = z11.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x"]);
|
|
205
|
+
var ContainerRuntimeSchema = z11.literal("container");
|
|
194
206
|
var RuntimeSchema = NodeRuntimeSchema.or(ContainerRuntimeSchema).describe("The identifier of the function's runtime.");
|
|
195
|
-
var ActionSchema =
|
|
196
|
-
var ActionsSchema =
|
|
197
|
-
var ArnSchema =
|
|
198
|
-
var WildcardSchema =
|
|
199
|
-
var ResourceSchema =
|
|
200
|
-
var ResourcesSchema =
|
|
201
|
-
var PermissionSchema =
|
|
202
|
-
effect:
|
|
207
|
+
var ActionSchema = z11.string();
|
|
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"),
|
|
203
215
|
actions: ActionsSchema,
|
|
204
216
|
resources: ResourcesSchema
|
|
205
217
|
});
|
|
206
|
-
var PermissionsSchema =
|
|
207
|
-
var WarmSchema =
|
|
208
|
-
var VPCSchema =
|
|
209
|
-
var MinifySchema =
|
|
210
|
-
var HandlerSchema =
|
|
211
|
-
var DescriptionSchema =
|
|
218
|
+
var PermissionsSchema = z11.union([PermissionSchema.transform((v) => [v]), PermissionSchema.array()]).describe("Add IAM permissions to your function.");
|
|
219
|
+
var WarmSchema = z11.number().int().min(0).max(10).describe("Specify how many functions you want to warm up each 5 minutes. You can specify a number from 0 to 10.");
|
|
220
|
+
var VPCSchema = z11.boolean().describe("Put the function inside your global VPC.");
|
|
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.");
|
|
212
224
|
var validLogRetentionDays = [
|
|
213
225
|
...[1, 3, 5, 7, 14, 30, 60, 90, 120, 150],
|
|
214
226
|
...[180, 365, 400, 545, 731, 1096, 1827, 2192],
|
|
@@ -223,43 +235,43 @@ var LogRetentionSchema = DurationSchema.refine(
|
|
|
223
235
|
},
|
|
224
236
|
`Invalid log retention. Valid days are: ${validLogRetentionDays.map((days3) => `${days3}`).join(", ")}`
|
|
225
237
|
).describe("The log retention duration.");
|
|
226
|
-
var LogSchema =
|
|
227
|
-
|
|
238
|
+
var LogSchema = z11.union([
|
|
239
|
+
z11.boolean().transform((enabled) => ({ retention: enabled ? days(7) : days(0) })),
|
|
228
240
|
LogRetentionSchema.transform((retention) => ({ retention })),
|
|
229
|
-
|
|
241
|
+
z11.object({
|
|
230
242
|
// subscription: LogSubscriptionSchema.optional(),
|
|
231
243
|
retention: LogRetentionSchema.optional(),
|
|
232
|
-
format:
|
|
244
|
+
format: z11.enum(["text", "json"]).describe(
|
|
233
245
|
`The format in which Lambda sends your function's application and system logs to CloudWatch. Select between plain text and structured JSON.`
|
|
234
246
|
).optional(),
|
|
235
|
-
system:
|
|
247
|
+
system: z11.enum(["debug", "info", "warn"]).describe(
|
|
236
248
|
"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."
|
|
237
249
|
).optional(),
|
|
238
|
-
level:
|
|
250
|
+
level: z11.enum(["trace", "debug", "info", "warn", "error", "fatal"]).describe(
|
|
239
251
|
"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."
|
|
240
252
|
).optional()
|
|
241
253
|
})
|
|
242
254
|
]).describe("Enable logging to a CloudWatch log group. Providing a duration value will set the log retention time.");
|
|
243
|
-
var LayersSchema =
|
|
255
|
+
var LayersSchema = z11.string().array().describe(
|
|
244
256
|
// `A list of function layers to add to the function's execution environment..`
|
|
245
257
|
`A list of function layers to add to the function's execution environment. Specify each layer by its ARN, including the version.`
|
|
246
258
|
);
|
|
247
|
-
var FileCodeSchema =
|
|
259
|
+
var FileCodeSchema = z11.object({
|
|
248
260
|
file: LocalFileSchema.describe("The file path of the function code."),
|
|
249
261
|
minify: MinifySchema.optional().default(true),
|
|
250
|
-
external:
|
|
262
|
+
external: z11.string().array().optional().describe(`A list of external packages that won't be included in the bundle.`)
|
|
251
263
|
});
|
|
252
|
-
var BundleCodeSchema =
|
|
264
|
+
var BundleCodeSchema = z11.object({
|
|
253
265
|
bundle: LocalDirectorySchema.describe("The directory that needs to be bundled.")
|
|
254
266
|
});
|
|
255
|
-
var CodeSchema =
|
|
267
|
+
var CodeSchema = z11.union([
|
|
256
268
|
LocalFileSchema.transform((file) => ({
|
|
257
269
|
file
|
|
258
270
|
})).pipe(FileCodeSchema),
|
|
259
271
|
FileCodeSchema,
|
|
260
272
|
BundleCodeSchema
|
|
261
273
|
]).describe("Specify the code of your function.");
|
|
262
|
-
var FnSchema =
|
|
274
|
+
var FnSchema = z11.object({
|
|
263
275
|
code: CodeSchema,
|
|
264
276
|
// node
|
|
265
277
|
handler: HandlerSchema.optional(),
|
|
@@ -282,14 +294,14 @@ var FnSchema = z9.object({
|
|
|
282
294
|
environment: EnvironmentSchema.optional(),
|
|
283
295
|
permissions: PermissionsSchema.optional()
|
|
284
296
|
});
|
|
285
|
-
var FunctionSchema =
|
|
297
|
+
var FunctionSchema = z11.union([
|
|
286
298
|
LocalFileSchema.transform((code) => ({
|
|
287
299
|
code
|
|
288
300
|
})).pipe(FnSchema),
|
|
289
301
|
FnSchema
|
|
290
302
|
]);
|
|
291
|
-
var FunctionsSchema =
|
|
292
|
-
var FunctionDefaultSchema =
|
|
303
|
+
var FunctionsSchema = z11.record(ResourceIdSchema, FunctionSchema).optional().describe("Define the functions in your stack.");
|
|
304
|
+
var FunctionDefaultSchema = z11.object({
|
|
293
305
|
runtime: RuntimeSchema.default("nodejs20.x"),
|
|
294
306
|
// node
|
|
295
307
|
handler: HandlerSchema.default("index.default"),
|
|
@@ -318,25 +330,25 @@ var FunctionDefaultSchema = z9.object({
|
|
|
318
330
|
}).default({});
|
|
319
331
|
|
|
320
332
|
// src/feature/layer/schema.ts
|
|
321
|
-
import { z as
|
|
333
|
+
import { z as z13 } from "zod";
|
|
322
334
|
|
|
323
335
|
// src/config/schema/lambda.ts
|
|
324
|
-
import { z as
|
|
325
|
-
var ArchitectureSchema2 =
|
|
326
|
-
var NodeRuntimeSchema2 =
|
|
336
|
+
import { z as z12 } from "zod";
|
|
337
|
+
var ArchitectureSchema2 = z12.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the function supports.");
|
|
338
|
+
var NodeRuntimeSchema2 = z12.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x"]).describe("The identifier of the function's runtime.");
|
|
327
339
|
|
|
328
340
|
// src/feature/layer/schema.ts
|
|
329
|
-
var Schema =
|
|
341
|
+
var Schema = z13.object({
|
|
330
342
|
file: LocalFileSchema,
|
|
331
343
|
runtimes: NodeRuntimeSchema2.array().optional(),
|
|
332
344
|
architecture: ArchitectureSchema2.optional(),
|
|
333
|
-
packages:
|
|
345
|
+
packages: z13.string().array().optional().describe(
|
|
334
346
|
"Define the package names that are available bundled in the layer. Those packages are not bundled while bundling the lambda."
|
|
335
347
|
)
|
|
336
348
|
});
|
|
337
|
-
var LayerSchema =
|
|
338
|
-
|
|
339
|
-
|
|
349
|
+
var LayerSchema = z13.record(
|
|
350
|
+
z13.string(),
|
|
351
|
+
z13.union([
|
|
340
352
|
LocalFileSchema.transform((file) => ({
|
|
341
353
|
file,
|
|
342
354
|
description: void 0
|
|
@@ -351,28 +363,28 @@ var OnFailureDefaultSchema = FunctionSchema.optional().describe(
|
|
|
351
363
|
);
|
|
352
364
|
|
|
353
365
|
// src/feature/on-log/schema.ts
|
|
354
|
-
import { z as
|
|
355
|
-
var FilterSchema =
|
|
356
|
-
var OnLogDefaultSchema =
|
|
366
|
+
import { z as z14 } from "zod";
|
|
367
|
+
var FilterSchema = z14.enum(["trace", "debug", "info", "warn", "error", "fatal"]).array().describe("The log level that will gets delivered to the consumer.");
|
|
368
|
+
var OnLogDefaultSchema = z14.union([
|
|
357
369
|
FunctionSchema.transform((consumer) => ({
|
|
358
370
|
consumer,
|
|
359
371
|
filter: ["error", "fatal"]
|
|
360
372
|
})),
|
|
361
|
-
|
|
373
|
+
z14.object({
|
|
362
374
|
consumer: FunctionSchema,
|
|
363
375
|
filter: FilterSchema
|
|
364
376
|
})
|
|
365
377
|
]).optional().describe("Define a subscription on all Lambda functions logs.");
|
|
366
378
|
|
|
367
379
|
// src/feature/pubsub/schema.ts
|
|
368
|
-
import { z as
|
|
380
|
+
import { z as z15 } from "zod";
|
|
369
381
|
var DomainSchema = ResourceIdSchema.describe("The domain id to link your Pubsub API with.");
|
|
370
|
-
var PubSubDefaultSchema =
|
|
382
|
+
var PubSubDefaultSchema = z15.record(
|
|
371
383
|
ResourceIdSchema,
|
|
372
|
-
|
|
384
|
+
z15.object({
|
|
373
385
|
auth: FunctionSchema,
|
|
374
386
|
domain: DomainSchema.optional(),
|
|
375
|
-
subDomain:
|
|
387
|
+
subDomain: z15.string().optional()
|
|
376
388
|
// auth: z.union([
|
|
377
389
|
// ResourceIdSchema,
|
|
378
390
|
// z.object({
|
|
@@ -388,11 +400,11 @@ var PubSubDefaultSchema = z13.record(
|
|
|
388
400
|
// .optional(),
|
|
389
401
|
})
|
|
390
402
|
).optional().describe("Define the pubsub subscriber in your stack.");
|
|
391
|
-
var PubSubSchema =
|
|
403
|
+
var PubSubSchema = z15.record(
|
|
392
404
|
ResourceIdSchema,
|
|
393
|
-
|
|
394
|
-
sql:
|
|
395
|
-
sqlVersion:
|
|
405
|
+
z15.object({
|
|
406
|
+
sql: z15.string().describe("The SQL statement used to query the IOT topic."),
|
|
407
|
+
sqlVersion: z15.enum(["2015-10-08", "2016-03-23", "beta"]).default("2016-03-23").describe("The version of the SQL rules engine to use when evaluating the rule."),
|
|
396
408
|
consumer: FunctionSchema.describe("The consuming lambda function properties.")
|
|
397
409
|
})
|
|
398
410
|
).optional().describe("Define the pubsub subscriber in your stack.");
|
|
@@ -400,7 +412,7 @@ var PubSubSchema = z13.record(
|
|
|
400
412
|
// src/feature/queue/schema.ts
|
|
401
413
|
import { days as days2, hours, minutes as minutes2, seconds as seconds2 } from "@awsless/duration";
|
|
402
414
|
import { kibibytes } from "@awsless/size";
|
|
403
|
-
import { z as
|
|
415
|
+
import { z as z16 } from "zod";
|
|
404
416
|
var RetentionPeriodSchema = DurationSchema.refine(
|
|
405
417
|
durationMin(minutes2(1)),
|
|
406
418
|
"Minimum retention period is 1 minute"
|
|
@@ -428,10 +440,10 @@ var ReceiveMessageWaitTimeSchema = DurationSchema.refine(
|
|
|
428
440
|
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(
|
|
429
441
|
"The limit of how many bytes that a message can contain before Amazon SQS rejects it. You can specify an size from 1 KB to 256 KB."
|
|
430
442
|
);
|
|
431
|
-
var BatchSizeSchema =
|
|
443
|
+
var BatchSizeSchema = z16.number().int().min(1, "Minimum batch size is 1").max(1e4, "Maximum batch size is 10000").describe(
|
|
432
444
|
"The maximum number of records in each batch that Lambda pulls from your queue and sends to your function. Lambda passes all of the records in the batch to the function in a single call, up to the payload limit for synchronous invocation (6 MB). You can specify an integer from 1 to 10000."
|
|
433
445
|
);
|
|
434
|
-
var MaxConcurrencySchema =
|
|
446
|
+
var MaxConcurrencySchema = z16.number().int().min(2, "Minimum max concurrency is 2").max(1e3, "Maximum max concurrency is 1000").describe(
|
|
435
447
|
"Limits the number of concurrent instances that the queue worker can invoke. You can specify an integer from 2 to 1000."
|
|
436
448
|
);
|
|
437
449
|
var MaxBatchingWindow = DurationSchema.refine(
|
|
@@ -440,7 +452,7 @@ var MaxBatchingWindow = DurationSchema.refine(
|
|
|
440
452
|
).describe(
|
|
441
453
|
"The maximum amount of time, that Lambda spends gathering records before invoking the function. You can specify an duration from 0 seconds to 5 minutes."
|
|
442
454
|
);
|
|
443
|
-
var QueueDefaultSchema =
|
|
455
|
+
var QueueDefaultSchema = z16.object({
|
|
444
456
|
retentionPeriod: RetentionPeriodSchema.default("7 days"),
|
|
445
457
|
visibilityTimeout: VisibilityTimeoutSchema.default("30 seconds"),
|
|
446
458
|
deliveryDelay: DeliveryDelaySchema.default("0 seconds"),
|
|
@@ -450,7 +462,7 @@ var QueueDefaultSchema = z14.object({
|
|
|
450
462
|
maxConcurrency: MaxConcurrencySchema.optional(),
|
|
451
463
|
maxBatchingWindow: MaxBatchingWindow.optional()
|
|
452
464
|
}).default({});
|
|
453
|
-
var QueueSchema =
|
|
465
|
+
var QueueSchema = z16.object({
|
|
454
466
|
consumer: FunctionSchema.describe("The consuming lambda function properties."),
|
|
455
467
|
retentionPeriod: RetentionPeriodSchema.optional(),
|
|
456
468
|
visibilityTimeout: VisibilityTimeoutSchema.optional(),
|
|
@@ -461,9 +473,9 @@ var QueueSchema = z14.object({
|
|
|
461
473
|
maxConcurrency: MaxConcurrencySchema.optional(),
|
|
462
474
|
maxBatchingWindow: MaxBatchingWindow.optional()
|
|
463
475
|
});
|
|
464
|
-
var QueuesSchema =
|
|
476
|
+
var QueuesSchema = z16.record(
|
|
465
477
|
ResourceIdSchema,
|
|
466
|
-
|
|
478
|
+
z16.union([
|
|
467
479
|
LocalFileSchema.transform((consumer) => ({
|
|
468
480
|
consumer
|
|
469
481
|
})).pipe(QueueSchema),
|
|
@@ -472,41 +484,50 @@ var QueuesSchema = z14.record(
|
|
|
472
484
|
).optional().describe("Define the queues in your stack.");
|
|
473
485
|
|
|
474
486
|
// src/feature/rest/schema.ts
|
|
475
|
-
import { z as
|
|
487
|
+
import { z as z18 } from "zod";
|
|
476
488
|
|
|
477
489
|
// src/config/schema/route.ts
|
|
478
|
-
import { z as
|
|
479
|
-
var RouteSchema =
|
|
480
|
-
|
|
481
|
-
|
|
490
|
+
import { z as z17 } from "zod";
|
|
491
|
+
var RouteSchema = z17.union([
|
|
492
|
+
z17.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route"),
|
|
493
|
+
z17.literal("$default")
|
|
482
494
|
]);
|
|
483
495
|
|
|
484
496
|
// src/feature/rest/schema.ts
|
|
485
|
-
var RestDefaultSchema =
|
|
497
|
+
var RestDefaultSchema = z18.record(
|
|
486
498
|
ResourceIdSchema,
|
|
487
|
-
|
|
499
|
+
z18.object({
|
|
488
500
|
domain: ResourceIdSchema.describe("The domain id to link your API with.").optional(),
|
|
489
|
-
subDomain:
|
|
501
|
+
subDomain: z18.string().optional()
|
|
490
502
|
})
|
|
491
503
|
).optional().describe("Define your global REST API's.");
|
|
492
|
-
var RestSchema =
|
|
504
|
+
var RestSchema = z18.record(ResourceIdSchema, z18.record(RouteSchema, FunctionSchema)).optional().describe("Define routes in your stack for your global REST API.");
|
|
493
505
|
|
|
494
506
|
// src/feature/rpc/schema.ts
|
|
495
|
-
import { z as
|
|
496
|
-
|
|
507
|
+
import { z as z19 } from "zod";
|
|
508
|
+
import { minutes as minutes3, seconds as seconds3 } from "@awsless/duration";
|
|
509
|
+
var TimeoutSchema2 = DurationSchema.refine(durationMin(seconds3(10)), "Minimum timeout duration is 10 seconds").refine(durationMax(minutes3(5)), "Maximum timeout duration is 5 minutes").describe(
|
|
510
|
+
[
|
|
511
|
+
"The amount of time that the RPC lambda is allowed run before stopping it.",
|
|
512
|
+
"You can specify a size value from 1 second to 5 minutes.",
|
|
513
|
+
"The timeouts of all inner RPC functions will be capped at 80% of this timeout."
|
|
514
|
+
].join(" ")
|
|
515
|
+
);
|
|
516
|
+
var RpcDefaultSchema = z19.record(
|
|
497
517
|
ResourceIdSchema,
|
|
498
|
-
|
|
518
|
+
z19.object({
|
|
499
519
|
domain: ResourceIdSchema.describe("The domain id to link your RPC API with.").optional(),
|
|
500
|
-
subDomain:
|
|
520
|
+
subDomain: z19.string().optional(),
|
|
501
521
|
auth: FunctionSchema.optional(),
|
|
502
522
|
log: LogSchema.optional(),
|
|
503
|
-
|
|
523
|
+
timeout: TimeoutSchema2.default("1 minutes"),
|
|
524
|
+
geoRestrictions: z19.array(z19.string().length(2).toUpperCase()).default([]).describe("Specifies a blacklist of countries that should be blocked.")
|
|
504
525
|
})
|
|
505
526
|
).describe(`Define the global RPC API's.`).optional();
|
|
506
|
-
var RpcSchema =
|
|
527
|
+
var RpcSchema = z19.record(ResourceIdSchema, z19.record(z19.string(), FunctionSchema).describe("The queries for your global RPC API.")).describe("Define the schema in your stack for your global RPC API.").optional();
|
|
507
528
|
|
|
508
529
|
// src/config/schema/region.ts
|
|
509
|
-
import { z as
|
|
530
|
+
import { z as z20 } from "zod";
|
|
510
531
|
var US = ["us-east-2", "us-east-1", "us-west-1", "us-west-2"];
|
|
511
532
|
var AF = ["af-south-1"];
|
|
512
533
|
var AP = [
|
|
@@ -535,16 +556,16 @@ var EU = [
|
|
|
535
556
|
var ME = ["me-south-1", "me-central-1"];
|
|
536
557
|
var SA = ["sa-east-1"];
|
|
537
558
|
var regions = [...US, ...AF, ...AP, ...CA, ...EU, ...ME, ...SA];
|
|
538
|
-
var RegionSchema =
|
|
559
|
+
var RegionSchema = z20.enum(regions);
|
|
539
560
|
|
|
540
561
|
// src/config/app.ts
|
|
541
|
-
var AppSchema =
|
|
542
|
-
$schema:
|
|
562
|
+
var AppSchema = z21.object({
|
|
563
|
+
$schema: z21.string().optional(),
|
|
543
564
|
name: ResourceIdSchema.describe("App name."),
|
|
544
565
|
region: RegionSchema.describe("The AWS region to deploy to."),
|
|
545
|
-
profile:
|
|
546
|
-
protect:
|
|
547
|
-
removal:
|
|
566
|
+
profile: z21.string().describe("The AWS profile to deploy to."),
|
|
567
|
+
protect: z21.boolean().default(false).describe("Protect your app & stacks from being deleted."),
|
|
568
|
+
removal: z21.enum(["remove", "retain"]).default("remove").describe(
|
|
548
569
|
[
|
|
549
570
|
"Configure how your resources are handled when they have to be removed.",
|
|
550
571
|
"",
|
|
@@ -558,7 +579,7 @@ var AppSchema = z19.object({
|
|
|
558
579
|
// .default('prod')
|
|
559
580
|
// .describe('The deployment stage.'),
|
|
560
581
|
// onFailure: OnFailureSchema,
|
|
561
|
-
defaults:
|
|
582
|
+
defaults: z21.object({
|
|
562
583
|
onFailure: OnFailureDefaultSchema,
|
|
563
584
|
onLog: OnLogDefaultSchema,
|
|
564
585
|
auth: AuthDefaultSchema,
|
|
@@ -580,11 +601,11 @@ var AppSchema = z19.object({
|
|
|
580
601
|
});
|
|
581
602
|
|
|
582
603
|
// src/config/stack.ts
|
|
583
|
-
import { z as
|
|
604
|
+
import { z as z34 } from "zod";
|
|
584
605
|
|
|
585
606
|
// src/feature/cache/schema.ts
|
|
586
607
|
import { gibibytes as gibibytes2 } from "@awsless/size";
|
|
587
|
-
import { z as
|
|
608
|
+
import { z as z22 } from "zod";
|
|
588
609
|
var StorageSchema = SizeSchema.refine(sizeMin(gibibytes2(1)), "Minimum storage size is 1 GB").refine(
|
|
589
610
|
sizeMax(gibibytes2(5e3)),
|
|
590
611
|
"Maximum storage size is 5000 GB"
|
|
@@ -595,31 +616,31 @@ var MinimumStorageSchema = StorageSchema.describe(
|
|
|
595
616
|
var MaximumStorageSchema = StorageSchema.describe(
|
|
596
617
|
"The upper limit for data storage the cache is set to use. You can specify a size value from 1 GB to 5000 GB."
|
|
597
618
|
);
|
|
598
|
-
var EcpuSchema =
|
|
619
|
+
var EcpuSchema = z22.number().int().min(1e3).max(15e6);
|
|
599
620
|
var MinimumEcpuSchema = EcpuSchema.describe(
|
|
600
621
|
"The minimum number of ECPUs the cache can consume per second. You can specify a integer from 1,000 to 15,000,000."
|
|
601
622
|
);
|
|
602
623
|
var MaximumEcpuSchema = EcpuSchema.describe(
|
|
603
624
|
"The maximum number of ECPUs the cache can consume per second. You can specify a integer from 1,000 to 15,000,000."
|
|
604
625
|
);
|
|
605
|
-
var CachesSchema =
|
|
626
|
+
var CachesSchema = z22.record(
|
|
606
627
|
ResourceIdSchema,
|
|
607
|
-
|
|
628
|
+
z22.object({
|
|
608
629
|
minStorage: MinimumStorageSchema.optional(),
|
|
609
630
|
maxStorage: MaximumStorageSchema.optional(),
|
|
610
631
|
minECPU: MinimumEcpuSchema.optional(),
|
|
611
632
|
maxECPU: MaximumEcpuSchema.optional(),
|
|
612
|
-
snapshotRetentionLimit:
|
|
633
|
+
snapshotRetentionLimit: z22.number().int().positive().default(1)
|
|
613
634
|
})
|
|
614
635
|
).optional().describe("Define the caches in your stack. For access to the cache put your functions inside the global VPC.");
|
|
615
636
|
|
|
616
637
|
// src/feature/command/schema.ts
|
|
617
|
-
import { z as
|
|
618
|
-
var CommandSchema =
|
|
619
|
-
|
|
638
|
+
import { z as z23 } from "zod";
|
|
639
|
+
var CommandSchema = z23.union([
|
|
640
|
+
z23.object({
|
|
620
641
|
file: LocalFileSchema,
|
|
621
|
-
handler:
|
|
622
|
-
description:
|
|
642
|
+
handler: z23.string().default("default").describe("The name of the handler that needs to run"),
|
|
643
|
+
description: z23.string().optional().describe("A description of the command")
|
|
623
644
|
// options: z.record(ResourceIdSchema, OptionSchema).optional(),
|
|
624
645
|
// arguments: z.record(ResourceIdSchema, ArgumentSchema).optional(),
|
|
625
646
|
}),
|
|
@@ -629,22 +650,22 @@ var CommandSchema = z21.union([
|
|
|
629
650
|
description: void 0
|
|
630
651
|
}))
|
|
631
652
|
]);
|
|
632
|
-
var CommandsSchema =
|
|
653
|
+
var CommandsSchema = z23.record(ResourceIdSchema, CommandSchema).optional().describe("Define the custom commands for your stack.");
|
|
633
654
|
|
|
634
655
|
// src/feature/config/schema.ts
|
|
635
|
-
import { z as
|
|
636
|
-
var ConfigNameSchema =
|
|
637
|
-
var ConfigsSchema =
|
|
656
|
+
import { z as z24 } from "zod";
|
|
657
|
+
var ConfigNameSchema = z24.string().regex(/[a-z0-9\-]/g, "Invalid config name");
|
|
658
|
+
var ConfigsSchema = z24.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
|
|
638
659
|
|
|
639
660
|
// src/feature/cron/schema/index.ts
|
|
640
|
-
import { z as
|
|
661
|
+
import { z as z26 } from "zod";
|
|
641
662
|
|
|
642
663
|
// src/feature/cron/schema/schedule.ts
|
|
643
|
-
import { z as
|
|
664
|
+
import { z as z25 } from "zod";
|
|
644
665
|
import { awsCronExpressionValidator } from "aws-cron-expression-validator";
|
|
645
|
-
var RateExpressionSchema =
|
|
666
|
+
var RateExpressionSchema = z25.custom(
|
|
646
667
|
(value) => {
|
|
647
|
-
return
|
|
668
|
+
return z25.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
|
|
648
669
|
const [str] = rate.split(" ");
|
|
649
670
|
const number = parseInt(str);
|
|
650
671
|
return number > 0;
|
|
@@ -660,9 +681,9 @@ var RateExpressionSchema = z23.custom(
|
|
|
660
681
|
}
|
|
661
682
|
return `rate(${rate})`;
|
|
662
683
|
});
|
|
663
|
-
var CronExpressionSchema =
|
|
684
|
+
var CronExpressionSchema = z25.custom(
|
|
664
685
|
(value) => {
|
|
665
|
-
return
|
|
686
|
+
return z25.string().safeParse(value).success;
|
|
666
687
|
},
|
|
667
688
|
{ message: "Invalid cron expression" }
|
|
668
689
|
).superRefine((value, ctx) => {
|
|
@@ -671,12 +692,12 @@ var CronExpressionSchema = z23.custom(
|
|
|
671
692
|
} catch (error) {
|
|
672
693
|
if (error instanceof Error) {
|
|
673
694
|
ctx.addIssue({
|
|
674
|
-
code:
|
|
695
|
+
code: z25.ZodIssueCode.custom,
|
|
675
696
|
message: `Invalid cron expression: ${error.message}`
|
|
676
697
|
});
|
|
677
698
|
} else {
|
|
678
699
|
ctx.addIssue({
|
|
679
|
-
code:
|
|
700
|
+
code: z25.ZodIssueCode.custom,
|
|
680
701
|
message: "Invalid cron expression"
|
|
681
702
|
});
|
|
682
703
|
}
|
|
@@ -687,23 +708,23 @@ var CronExpressionSchema = z23.custom(
|
|
|
687
708
|
var ScheduleExpressionSchema = RateExpressionSchema.or(CronExpressionSchema);
|
|
688
709
|
|
|
689
710
|
// src/feature/cron/schema/index.ts
|
|
690
|
-
var CronsSchema =
|
|
711
|
+
var CronsSchema = z26.record(
|
|
691
712
|
ResourceIdSchema,
|
|
692
|
-
|
|
693
|
-
enabled:
|
|
713
|
+
z26.object({
|
|
714
|
+
enabled: z26.boolean().default(true).describe("If the cron is enabled."),
|
|
694
715
|
consumer: FunctionSchema.describe("The consuming lambda function properties."),
|
|
695
716
|
schedule: ScheduleExpressionSchema.describe(
|
|
696
717
|
'The scheduling expression.\n\nexample: "0 20 * * ? *"\nexample: "5 minutes"'
|
|
697
718
|
),
|
|
698
|
-
payload:
|
|
719
|
+
payload: z26.unknown().optional().describe("The JSON payload that will be passed to the consumer.")
|
|
699
720
|
})
|
|
700
721
|
).optional().describe(`Define the cron jobs in your stack.`);
|
|
701
722
|
|
|
702
723
|
// src/feature/search/schema.ts
|
|
703
724
|
import { gibibytes as gibibytes3 } from "@awsless/size";
|
|
704
|
-
import { z as
|
|
705
|
-
var VersionSchema =
|
|
706
|
-
var TypeSchema =
|
|
725
|
+
import { z as z27 } from "zod";
|
|
726
|
+
var VersionSchema = z27.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]);
|
|
727
|
+
var TypeSchema = z27.enum([
|
|
707
728
|
"t3.small",
|
|
708
729
|
"t3.medium",
|
|
709
730
|
"m3.medium",
|
|
@@ -778,11 +799,11 @@ var TypeSchema = z25.enum([
|
|
|
778
799
|
"r6gd.16xlarge"
|
|
779
800
|
]);
|
|
780
801
|
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.");
|
|
781
|
-
var SearchsSchema =
|
|
802
|
+
var SearchsSchema = z27.record(
|
|
782
803
|
ResourceIdSchema,
|
|
783
|
-
|
|
804
|
+
z27.object({
|
|
784
805
|
type: TypeSchema.default("t3.small"),
|
|
785
|
-
count:
|
|
806
|
+
count: z27.number().int().min(1).default(1),
|
|
786
807
|
version: VersionSchema.default("2.13"),
|
|
787
808
|
storage: StorageSizeSchema.default("10 GB")
|
|
788
809
|
// vpc: z.boolean().default(false),
|
|
@@ -790,29 +811,29 @@ var SearchsSchema = z25.record(
|
|
|
790
811
|
).optional().describe("Define the search instances in your stack. Backed by OpenSearch.");
|
|
791
812
|
|
|
792
813
|
// src/feature/site/schema.ts
|
|
793
|
-
import { z as
|
|
794
|
-
var ErrorResponsePathSchema =
|
|
814
|
+
import { z as z28 } from "zod";
|
|
815
|
+
var ErrorResponsePathSchema = z28.string().describe(
|
|
795
816
|
"The path to the custom error page that you want to return to the viewer when your origin returns the HTTP status code specified.\n - We recommend that you store custom error pages in an Amazon S3 bucket. If you store custom error pages on an HTTP server and the server starts to return 5xx errors, CloudFront can't get the files that you want to return to viewers because the origin server is unavailable."
|
|
796
817
|
);
|
|
797
|
-
var StatusCodeSchema =
|
|
818
|
+
var StatusCodeSchema = z28.number().int().positive().optional().describe(
|
|
798
819
|
"The HTTP status code that you want CloudFront to return to the viewer along with the custom error page. There are a variety of reasons that you might want CloudFront to return a status code different from the status code that your origin returned to CloudFront, for example:\n- Some Internet devices (some firewalls and corporate proxies, for example) intercept HTTP 4xx and 5xx and prevent the response from being returned to the viewer. If you substitute 200, the response typically won't be intercepted.\n- If you don't care about distinguishing among different client errors or server errors, you can specify 400 or 500 as the ResponseCode for all 4xx or 5xx errors.\n- You might want to return a 200 status code (OK) and static website so your customers don't know that your website is down."
|
|
799
820
|
);
|
|
800
821
|
var MinTTLSchema = DurationSchema.describe(
|
|
801
822
|
"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."
|
|
802
823
|
);
|
|
803
|
-
var ErrorResponseSchema =
|
|
824
|
+
var ErrorResponseSchema = z28.union([
|
|
804
825
|
ErrorResponsePathSchema,
|
|
805
|
-
|
|
826
|
+
z28.object({
|
|
806
827
|
path: ErrorResponsePathSchema,
|
|
807
828
|
statusCode: StatusCodeSchema.optional(),
|
|
808
829
|
minTTL: MinTTLSchema.optional()
|
|
809
830
|
})
|
|
810
831
|
]).optional();
|
|
811
|
-
var SitesSchema =
|
|
832
|
+
var SitesSchema = z28.record(
|
|
812
833
|
ResourceIdSchema,
|
|
813
|
-
|
|
834
|
+
z28.object({
|
|
814
835
|
domain: ResourceIdSchema.describe("The domain id to link your site with.").optional(),
|
|
815
|
-
subDomain:
|
|
836
|
+
subDomain: z28.string().optional(),
|
|
816
837
|
// bind: z
|
|
817
838
|
// .object({
|
|
818
839
|
// auth: z.array(ResourceIdSchema),
|
|
@@ -821,11 +842,24 @@ var SitesSchema = z26.record(
|
|
|
821
842
|
// // rest: z.array(ResourceIdSchema),
|
|
822
843
|
// })
|
|
823
844
|
// .optional(),
|
|
824
|
-
|
|
845
|
+
build: z28.object({
|
|
846
|
+
command: z28.string().describe(
|
|
847
|
+
`Specifies the files and directories to generate the cache key for your custom build command.`
|
|
848
|
+
),
|
|
849
|
+
cacheKey: z28.union([
|
|
850
|
+
LocalFileSchema.transform((v) => [v]),
|
|
851
|
+
LocalFileSchema.array(),
|
|
852
|
+
LocalDirectorySchema.transform((v) => [v]),
|
|
853
|
+
LocalDirectorySchema.array()
|
|
854
|
+
]).describe(
|
|
855
|
+
`Specifies the files and directories to generate the cache key for your custom build command.`
|
|
856
|
+
)
|
|
857
|
+
}).optional().describe(`Specifies the build process for sites that need a build step.`),
|
|
858
|
+
static: z28.union([LocalDirectorySchema, z28.boolean()]).optional().describe(
|
|
825
859
|
"Specifies the path to the static files directory. Additionally you can also pass `true` when you don't have local static files, but still want to make an S3 bucket."
|
|
826
860
|
),
|
|
827
861
|
ssr: FunctionSchema.optional().describe("Specifies the ssr file."),
|
|
828
|
-
origin:
|
|
862
|
+
origin: z28.enum(["ssr-first", "static-first"]).default("static-first").describe("Specifies the origin fallback ordering."),
|
|
829
863
|
// bind: z.object({
|
|
830
864
|
// auth:
|
|
831
865
|
// h
|
|
@@ -838,11 +872,11 @@ var SitesSchema = z26.record(
|
|
|
838
872
|
// build: z.string().optional(),
|
|
839
873
|
// }),
|
|
840
874
|
// ]),
|
|
841
|
-
geoRestrictions:
|
|
842
|
-
forwardHost:
|
|
843
|
-
"Specify if the host header
|
|
875
|
+
geoRestrictions: z28.array(z28.string().length(2).toUpperCase()).default([]).describe("Specifies a blacklist of countries that should be blocked."),
|
|
876
|
+
forwardHost: z28.boolean().default(false).describe(
|
|
877
|
+
"Specify if the host header should be forwarded to the SSR function. Keep in mind that this requires an extra CloudFront Function."
|
|
844
878
|
),
|
|
845
|
-
errors:
|
|
879
|
+
errors: z28.object({
|
|
846
880
|
400: ErrorResponseSchema.describe("Customize a `400 Bad Request` response."),
|
|
847
881
|
403: ErrorResponseSchema.describe("Customize a `403 Forbidden` response."),
|
|
848
882
|
404: ErrorResponseSchema.describe("Customize a `404 Not Found` response."),
|
|
@@ -855,16 +889,16 @@ var SitesSchema = z26.record(
|
|
|
855
889
|
503: ErrorResponseSchema.describe("Customize a `503 Service Unavailable` response."),
|
|
856
890
|
504: ErrorResponseSchema.describe("Customize a `504 Gateway Timeout` response.")
|
|
857
891
|
}).optional().describe("Customize the error responses for specific HTTP status codes."),
|
|
858
|
-
cors:
|
|
859
|
-
override:
|
|
892
|
+
cors: z28.object({
|
|
893
|
+
override: z28.boolean().default(false),
|
|
860
894
|
maxAge: DurationSchema.default("365 days"),
|
|
861
|
-
exposeHeaders:
|
|
862
|
-
credentials:
|
|
863
|
-
headers:
|
|
864
|
-
origins:
|
|
865
|
-
methods:
|
|
895
|
+
exposeHeaders: z28.string().array().optional(),
|
|
896
|
+
credentials: z28.boolean().default(false),
|
|
897
|
+
headers: z28.string().array().default(["*"]),
|
|
898
|
+
origins: z28.string().array().default(["*"]),
|
|
899
|
+
methods: z28.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
|
|
866
900
|
}).optional().describe("Define the cors headers."),
|
|
867
|
-
security:
|
|
901
|
+
security: z28.object({
|
|
868
902
|
// contentSecurityPolicy: z.object({
|
|
869
903
|
// override: z.boolean().default(false),
|
|
870
904
|
// policy: z.string(),
|
|
@@ -906,10 +940,10 @@ var SitesSchema = z26.record(
|
|
|
906
940
|
// reportUri?: string
|
|
907
941
|
// }
|
|
908
942
|
}).optional().describe("Define the security policy."),
|
|
909
|
-
cache:
|
|
910
|
-
cookies:
|
|
911
|
-
headers:
|
|
912
|
-
queries:
|
|
943
|
+
cache: z28.object({
|
|
944
|
+
cookies: z28.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
|
|
945
|
+
headers: z28.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
|
|
946
|
+
queries: z28.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
|
|
913
947
|
}).optional().describe(
|
|
914
948
|
"Specifies the cookies, headers, and query values that CloudFront includes in the cache key."
|
|
915
949
|
)
|
|
@@ -917,22 +951,22 @@ var SitesSchema = z26.record(
|
|
|
917
951
|
).optional().describe("Define the sites in your stack.");
|
|
918
952
|
|
|
919
953
|
// src/feature/store/schema.ts
|
|
920
|
-
import { z as
|
|
921
|
-
var StoresSchema =
|
|
922
|
-
|
|
954
|
+
import { z as z29 } from "zod";
|
|
955
|
+
var StoresSchema = z29.union([
|
|
956
|
+
z29.array(ResourceIdSchema).transform((list) => {
|
|
923
957
|
const stores = {};
|
|
924
958
|
for (const key of list) {
|
|
925
959
|
stores[key] = {};
|
|
926
960
|
}
|
|
927
961
|
return stores;
|
|
928
962
|
}),
|
|
929
|
-
|
|
963
|
+
z29.record(
|
|
930
964
|
ResourceIdSchema,
|
|
931
|
-
|
|
965
|
+
z29.object({
|
|
932
966
|
// cors: CorsSchema,
|
|
933
967
|
// deletionProtection: DeletionProtectionSchema.optional(),
|
|
934
|
-
versioning:
|
|
935
|
-
events:
|
|
968
|
+
versioning: z29.boolean().default(false).describe("Enable versioning of your store."),
|
|
969
|
+
events: z29.object({
|
|
936
970
|
// create
|
|
937
971
|
"created:*": FunctionSchema.optional().describe(
|
|
938
972
|
"Subscribe to notifications regardless of the API that was used to create an object."
|
|
@@ -965,44 +999,44 @@ var StoresSchema = z27.union([
|
|
|
965
999
|
]).optional().describe("Define the stores in your stack.");
|
|
966
1000
|
|
|
967
1001
|
// src/feature/table/schema.ts
|
|
968
|
-
import { z as
|
|
969
|
-
var KeySchema =
|
|
970
|
-
var TablesSchema =
|
|
1002
|
+
import { z as z30 } from "zod";
|
|
1003
|
+
var KeySchema = z30.string().min(1).max(255);
|
|
1004
|
+
var TablesSchema = z30.record(
|
|
971
1005
|
ResourceIdSchema,
|
|
972
|
-
|
|
1006
|
+
z30.object({
|
|
973
1007
|
hash: KeySchema.describe(
|
|
974
1008
|
"Specifies the name of the partition / hash key that makes up the primary key for the table."
|
|
975
1009
|
),
|
|
976
1010
|
sort: KeySchema.optional().describe(
|
|
977
1011
|
"Specifies the name of the range / sort key that makes up the primary key for the table."
|
|
978
1012
|
),
|
|
979
|
-
fields:
|
|
1013
|
+
fields: z30.record(z30.string(), z30.enum(["string", "number", "binary"])).optional().describe(
|
|
980
1014
|
'A list of attributes that describe the key schema for the table and indexes. If no attribute field is defined we default to "string".'
|
|
981
1015
|
),
|
|
982
|
-
class:
|
|
983
|
-
pointInTimeRecovery:
|
|
1016
|
+
class: z30.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
|
|
1017
|
+
pointInTimeRecovery: z30.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
|
|
984
1018
|
timeToLiveAttribute: KeySchema.optional().describe(
|
|
985
1019
|
"The name of the TTL attribute used to store the expiration time for items in the table. To update this property, you must first disable TTL and then enable TTL with the new attribute name."
|
|
986
1020
|
),
|
|
987
1021
|
// deletionProtection: DeletionProtectionSchema.optional(),
|
|
988
|
-
stream:
|
|
989
|
-
type:
|
|
1022
|
+
stream: z30.object({
|
|
1023
|
+
type: z30.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
|
|
990
1024
|
"When an item in the table is modified, stream.type determines what information is written to the stream for this table. Valid values are:\n- keys-only - Only the key attributes of the modified item are written to the stream.\n- new-image - The entire item, as it appears after it was modified, is written to the stream.\n- old-image - The entire item, as it appeared before it was modified, is written to the stream.\n- new-and-old-images - Both the new and the old item images of the item are written to the stream."
|
|
991
1025
|
),
|
|
992
1026
|
consumer: FunctionSchema.describe("The consuming lambda function for the stream")
|
|
993
1027
|
}).optional().describe(
|
|
994
1028
|
"The settings for the DynamoDB table stream, which capture changes to items stored in the table."
|
|
995
1029
|
),
|
|
996
|
-
indexes:
|
|
997
|
-
|
|
998
|
-
|
|
1030
|
+
indexes: z30.record(
|
|
1031
|
+
z30.string(),
|
|
1032
|
+
z30.object({
|
|
999
1033
|
hash: KeySchema.describe(
|
|
1000
1034
|
"Specifies the name of the partition / hash key that makes up the primary key for the global secondary index."
|
|
1001
1035
|
),
|
|
1002
1036
|
sort: KeySchema.optional().describe(
|
|
1003
1037
|
"Specifies the name of the range / sort key that makes up the primary key for the global secondary index."
|
|
1004
1038
|
),
|
|
1005
|
-
projection:
|
|
1039
|
+
projection: z30.enum(["all", "keys-only"]).default("all").describe(
|
|
1006
1040
|
[
|
|
1007
1041
|
"The set of attributes that are projected into the index:",
|
|
1008
1042
|
"- all - All of the table attributes are projected into the index.",
|
|
@@ -1016,11 +1050,11 @@ var TablesSchema = z28.record(
|
|
|
1016
1050
|
).optional().describe("Define the tables in your stack.");
|
|
1017
1051
|
|
|
1018
1052
|
// src/feature/task/schema.ts
|
|
1019
|
-
import { z as
|
|
1020
|
-
var RetryAttemptsSchema2 =
|
|
1053
|
+
import { z as z31 } from "zod";
|
|
1054
|
+
var RetryAttemptsSchema2 = z31.number().int().min(0).max(2).describe(
|
|
1021
1055
|
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
|
|
1022
1056
|
);
|
|
1023
|
-
var TaskSchema =
|
|
1057
|
+
var TaskSchema = z31.union([
|
|
1024
1058
|
LocalFileSchema.transform((file) => ({
|
|
1025
1059
|
consumer: {
|
|
1026
1060
|
code: {
|
|
@@ -1031,33 +1065,33 @@ var TaskSchema = z29.union([
|
|
|
1031
1065
|
},
|
|
1032
1066
|
retryAttempts: void 0
|
|
1033
1067
|
})),
|
|
1034
|
-
|
|
1068
|
+
z31.object({
|
|
1035
1069
|
consumer: FunctionSchema,
|
|
1036
1070
|
retryAttempts: RetryAttemptsSchema2.optional()
|
|
1037
1071
|
})
|
|
1038
1072
|
]);
|
|
1039
|
-
var TasksSchema =
|
|
1073
|
+
var TasksSchema = z31.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
|
|
1040
1074
|
|
|
1041
1075
|
// src/feature/test/schema.ts
|
|
1042
|
-
import { z as
|
|
1043
|
-
var TestsSchema =
|
|
1076
|
+
import { z as z32 } from "zod";
|
|
1077
|
+
var TestsSchema = z32.union([LocalDirectorySchema.transform((v) => [v]), LocalDirectorySchema.array()]).describe("Define the location of your tests for your stack.").optional();
|
|
1044
1078
|
|
|
1045
1079
|
// src/feature/topic/schema.ts
|
|
1046
1080
|
import { kebabCase as kebabCase3 } from "change-case";
|
|
1047
|
-
import { z as
|
|
1048
|
-
var TopicNameSchema =
|
|
1049
|
-
var TopicsSchema =
|
|
1081
|
+
import { z as z33 } from "zod";
|
|
1082
|
+
var TopicNameSchema = z33.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => kebabCase3(value)).describe("Define event topic name.");
|
|
1083
|
+
var TopicsSchema = z33.array(TopicNameSchema).refine((topics) => {
|
|
1050
1084
|
return topics.length === new Set(topics).size;
|
|
1051
1085
|
}, "Must be a list of unique topic names").optional().describe("Define the event topics to publish too in your stack.");
|
|
1052
|
-
var SubscribersSchema =
|
|
1086
|
+
var SubscribersSchema = z33.record(TopicNameSchema, FunctionSchema).optional().describe("Define the event topics to subscribe too in your stack.");
|
|
1053
1087
|
|
|
1054
1088
|
// src/config/stack.ts
|
|
1055
1089
|
var DependsSchema = ResourceIdSchema.array().optional().describe("Define the stacks that this stack is depended on.");
|
|
1056
1090
|
var NameSchema = ResourceIdSchema.refine((name) => !["base", "hostedzones"].includes(name), {
|
|
1057
1091
|
message: `Stack name can't be a reserved name.`
|
|
1058
1092
|
}).describe("Stack name.");
|
|
1059
|
-
var StackSchema =
|
|
1060
|
-
$schema:
|
|
1093
|
+
var StackSchema = z34.object({
|
|
1094
|
+
$schema: z34.string().optional(),
|
|
1061
1095
|
name: NameSchema,
|
|
1062
1096
|
depends: DependsSchema,
|
|
1063
1097
|
commands: CommandsSchema,
|