@awsless/cli 0.0.31 → 0.0.32
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 +1440 -824
- package/dist/build-json-schema.js +336 -343
- package/dist/prebuild/icon/bundle.zip +0 -0
- package/dist/prebuild/image/bundle.zip +0 -0
- package/dist/prebuild/on-error-log/bundle.zip +0 -0
- package/dist/prebuild/on-failure/bundle.zip +0 -0
- package/dist/prebuild/pubsub-publisher/HASH +1 -0
- package/dist/prebuild/pubsub-publisher/bundle.zip +0 -0
- package/dist/prebuild/pubsub-server/HASH +1 -0
- package/dist/prebuild/pubsub-server/index.mjs +236 -0
- package/dist/prebuild/rpc/bundle.zip +0 -0
- package/dist/prebuild.js +24 -2
- package/dist/stack.json +1 -1
- package/dist/stack.stage.json +1 -1
- package/package.json +15 -14
|
@@ -233,7 +233,7 @@ var LogRetentionSchema = DurationSchema.refine(
|
|
|
233
233
|
(duration) => {
|
|
234
234
|
return validLogRetentionDays.includes(toDays(duration));
|
|
235
235
|
},
|
|
236
|
-
`Invalid log retention. Valid days are: ${validLogRetentionDays.map((
|
|
236
|
+
`Invalid log retention. Valid days are: ${validLogRetentionDays.map((days8) => `${days8}`).join(", ")}`
|
|
237
237
|
).describe("The log retention duration.");
|
|
238
238
|
var LogSchema = z11.union([
|
|
239
239
|
z11.boolean().transform((enabled) => ({ retention: enabled ? days(7) : days(0) })),
|
|
@@ -413,140 +413,159 @@ var OnFailureDefaultSchema = z15.union([
|
|
|
413
413
|
);
|
|
414
414
|
|
|
415
415
|
// src/feature/pubsub/schema.ts
|
|
416
|
+
import { days as days4 } from "@awsless/duration";
|
|
417
|
+
import { z as z18 } from "zod";
|
|
418
|
+
|
|
419
|
+
// src/feature/instance/schema.ts
|
|
420
|
+
import { days as days2, toDays as toDays2 } from "@awsless/duration";
|
|
421
|
+
import { toMebibytes } from "@awsless/size";
|
|
416
422
|
import { z as z16 } from "zod";
|
|
417
|
-
var
|
|
418
|
-
|
|
419
|
-
ResourceIdSchema,
|
|
420
|
-
z16.object({
|
|
421
|
-
auth: FunctionSchema,
|
|
422
|
-
domain: DomainSchema.optional(),
|
|
423
|
-
subDomain: z16.string().optional()
|
|
424
|
-
// auth: z.union([
|
|
425
|
-
// ResourceIdSchema,
|
|
426
|
-
// z.object({
|
|
427
|
-
// authorizer: FunctionSchema,
|
|
428
|
-
// // ttl: AuthorizerTtl.default('1 hour'),
|
|
429
|
-
// }),
|
|
430
|
-
// ]),
|
|
431
|
-
// policy: z
|
|
432
|
-
// .object({
|
|
433
|
-
// publish: z.array(z.string()).optional(),
|
|
434
|
-
// subscribe: z.array(z.string()).optional(),
|
|
435
|
-
// })
|
|
436
|
-
// .optional(),
|
|
437
|
-
})
|
|
438
|
-
).optional().describe("Define the pubsub subscriber in your stack.");
|
|
439
|
-
var RetryAttemptsSchema2 = z16.number().int().min(0).max(2).describe(
|
|
440
|
-
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
|
|
423
|
+
var CpuSchema = z16.union([z16.literal(0.25), z16.literal(0.5), z16.literal(1), z16.literal(2), z16.literal(4), z16.literal(8), z16.literal(16)]).transform((v) => `${v} vCPU`).describe(
|
|
424
|
+
"The number of virtual CPU units (vCPU) used by the instance. Valid values: 0.25, 0.5, 1, 2, 4, 8, 16 vCPU."
|
|
441
425
|
);
|
|
442
|
-
var
|
|
443
|
-
|
|
426
|
+
var validMemorySize = [
|
|
427
|
+
// 0.25 vCPU
|
|
428
|
+
512,
|
|
429
|
+
1024,
|
|
430
|
+
2048,
|
|
431
|
+
// 0.5 vCPU
|
|
432
|
+
1024,
|
|
433
|
+
2048,
|
|
434
|
+
3072,
|
|
435
|
+
4096,
|
|
436
|
+
// 1 vCPU
|
|
437
|
+
2048,
|
|
438
|
+
3072,
|
|
439
|
+
4096,
|
|
440
|
+
5120,
|
|
441
|
+
6144,
|
|
442
|
+
7168,
|
|
443
|
+
8192,
|
|
444
|
+
// 2 vCPU
|
|
445
|
+
4096,
|
|
446
|
+
5120,
|
|
447
|
+
6144,
|
|
448
|
+
7168,
|
|
449
|
+
8192,
|
|
450
|
+
9216,
|
|
451
|
+
10240,
|
|
452
|
+
11264,
|
|
453
|
+
12288,
|
|
454
|
+
13312,
|
|
455
|
+
14336,
|
|
456
|
+
15360,
|
|
457
|
+
16384
|
|
458
|
+
];
|
|
459
|
+
var MemorySizeSchema2 = SizeSchema.refine(
|
|
460
|
+
(s) => validMemorySize.includes(toMebibytes(s)),
|
|
461
|
+
`Invalid memory size. Allowed sizes: ${validMemorySize.join(", ")} MiB`
|
|
462
|
+
).describe("The amount of memory (in MiB) used by the instance. Valid memory values depend on the CPU configuration.");
|
|
463
|
+
var HealthCheckSchema = z16.object({
|
|
464
|
+
path: z16.string().describe("The path that the container runs to determine if it is healthy."),
|
|
465
|
+
interval: DurationSchema.describe("The time period in seconds between each health check execution."),
|
|
466
|
+
retries: z16.number().int().min(1).max(10).describe(
|
|
467
|
+
"The number of times to retry a failed health check before the container is considered unhealthy."
|
|
468
|
+
),
|
|
469
|
+
startPeriod: DurationSchema.describe(
|
|
470
|
+
"The optional grace period to provide containers time to bootstrap before failed health checks count towards the maximum number of retries."
|
|
471
|
+
),
|
|
472
|
+
timeout: DurationSchema.describe(
|
|
473
|
+
"The time period in seconds to wait for a health check to succeed before it is considered a failure."
|
|
474
|
+
)
|
|
475
|
+
}).describe("The health check command and associated configuration parameters for the container.");
|
|
476
|
+
var EnvironmentSchema2 = z16.record(z16.string(), z16.string()).optional().describe("Environment variable key-value pairs.");
|
|
477
|
+
var ArchitectureSchema3 = z16.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the instance supports.");
|
|
478
|
+
var ActionSchema2 = z16.string();
|
|
479
|
+
var ActionsSchema2 = z16.union([ActionSchema2.transform((v) => [v]), ActionSchema2.array()]);
|
|
480
|
+
var ArnSchema2 = z16.string().startsWith("arn:");
|
|
481
|
+
var WildcardSchema2 = z16.literal("*");
|
|
482
|
+
var ResourceSchema2 = z16.union([ArnSchema2, WildcardSchema2]);
|
|
483
|
+
var ResourcesSchema2 = z16.union([ResourceSchema2.transform((v) => [v]), ResourceSchema2.array()]);
|
|
484
|
+
var PermissionSchema2 = z16.object({
|
|
485
|
+
effect: z16.enum(["allow", "deny"]).default("allow"),
|
|
486
|
+
actions: ActionsSchema2,
|
|
487
|
+
resources: ResourcesSchema2
|
|
488
|
+
});
|
|
489
|
+
var PermissionsSchema2 = z16.union([PermissionSchema2.transform((v) => [v]), PermissionSchema2.array()]).describe("Add IAM permissions to your instance.");
|
|
490
|
+
var DescriptionSchema2 = z16.string().describe("A description of the instance.");
|
|
491
|
+
var ImageSchema = z16.string().optional().describe("The URL of the container image to use. Default: public.ecr.aws/aws-cli/aws-cli:{architecture}");
|
|
492
|
+
var validLogRetentionDays2 = [
|
|
493
|
+
...[1, 3, 5, 7, 14, 30, 60, 90, 120, 150],
|
|
494
|
+
...[180, 365, 400, 545, 731, 1096, 1827, 2192],
|
|
495
|
+
...[2557, 2922, 3288, 3653]
|
|
496
|
+
];
|
|
497
|
+
var LogRetentionSchema2 = DurationSchema.refine(
|
|
498
|
+
durationMin(days2(0)),
|
|
499
|
+
"Minimum log retention is 0 day, which will disable logging."
|
|
500
|
+
).refine(
|
|
501
|
+
(duration) => {
|
|
502
|
+
return validLogRetentionDays2.includes(toDays2(duration));
|
|
503
|
+
},
|
|
504
|
+
`Invalid log retention. Valid days are: ${validLogRetentionDays2.map((days8) => `${days8}`).join(", ")}`
|
|
505
|
+
).describe("The log retention duration.");
|
|
506
|
+
var LogSchema2 = z16.union([
|
|
507
|
+
z16.boolean().transform((enabled) => ({ retention: enabled ? days2(7) : days2(0) })),
|
|
508
|
+
LogRetentionSchema2.transform((retention) => ({ retention })),
|
|
444
509
|
z16.object({
|
|
445
|
-
|
|
446
|
-
sqlVersion: z16.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."),
|
|
447
|
-
consumer: FunctionSchema.describe("The consuming lambda function properties."),
|
|
448
|
-
retryAttempts: RetryAttemptsSchema2.default(2)
|
|
510
|
+
retention: LogRetentionSchema2.optional()
|
|
449
511
|
})
|
|
450
|
-
).
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
import { days as days2, hours, minutes as minutes2, seconds as seconds2 } from "@awsless/duration";
|
|
454
|
-
import { kibibytes } from "@awsless/size";
|
|
455
|
-
import { z as z17 } from "zod";
|
|
456
|
-
var RetentionPeriodSchema = DurationSchema.refine(durationMin(minutes2(1)), "Minimum retention period is 1 minute").refine(durationMax(days2(14)), "Maximum retention period is 14 days").describe(
|
|
457
|
-
"The number of seconds that Amazon SQS retains a message. You can specify a duration from 1 minute to 14 days."
|
|
458
|
-
);
|
|
459
|
-
var VisibilityTimeoutSchema = DurationSchema.refine(
|
|
460
|
-
durationMax(hours(12)),
|
|
461
|
-
"Maximum visibility timeout is 12 hours"
|
|
462
|
-
).describe(
|
|
463
|
-
"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."
|
|
464
|
-
);
|
|
465
|
-
var ReceiveMessageWaitTimeSchema = DurationSchema.refine(
|
|
466
|
-
durationMin(seconds2(1)),
|
|
467
|
-
"Minimum receive message wait time is 1 second"
|
|
468
|
-
).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.");
|
|
469
|
-
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.");
|
|
470
|
-
var BatchSizeSchema = z17.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.");
|
|
471
|
-
var RetryAttemptsSchema3 = z17.number().int().min(0).max(999).describe(
|
|
472
|
-
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 999."
|
|
473
|
-
);
|
|
474
|
-
var QueueDefaultSchema = z17.object({
|
|
475
|
-
retentionPeriod: RetentionPeriodSchema.default("7 days"),
|
|
476
|
-
visibilityTimeout: VisibilityTimeoutSchema.default("2 minutes"),
|
|
477
|
-
receiveMessageWaitTime: ReceiveMessageWaitTimeSchema.optional(),
|
|
478
|
-
maxMessageSize: MaxMessageSizeSchema.default("256 KB"),
|
|
479
|
-
batchSize: BatchSizeSchema.default(10),
|
|
480
|
-
retryAttempts: RetryAttemptsSchema3.default(2)
|
|
481
|
-
}).default({});
|
|
482
|
-
var QueueSchema = z17.object({
|
|
483
|
-
consumer: FunctionSchema.optional().describe("The consuming lambda function properties."),
|
|
484
|
-
retentionPeriod: RetentionPeriodSchema.optional(),
|
|
485
|
-
visibilityTimeout: VisibilityTimeoutSchema.optional(),
|
|
486
|
-
receiveMessageWaitTime: ReceiveMessageWaitTimeSchema.optional(),
|
|
487
|
-
maxMessageSize: MaxMessageSizeSchema.optional(),
|
|
488
|
-
batchSize: BatchSizeSchema.optional(),
|
|
489
|
-
retryAttempts: RetryAttemptsSchema3.optional()
|
|
512
|
+
]).describe("Enable logging to a CloudWatch log group. Providing a duration value will set the log retention time.");
|
|
513
|
+
var FileCodeSchema2 = z16.object({
|
|
514
|
+
file: LocalFileSchema.describe("The file path of the instance code.")
|
|
490
515
|
});
|
|
491
|
-
var
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
)
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
516
|
+
var CodeSchema2 = z16.union([
|
|
517
|
+
LocalFileSchema.transform((file) => ({
|
|
518
|
+
file
|
|
519
|
+
})).pipe(FileCodeSchema2),
|
|
520
|
+
FileCodeSchema2
|
|
521
|
+
]).describe("Specify the code of your instance.");
|
|
522
|
+
var StartupCommandSchema = z16.union([z16.string().transform((v) => [v]), z16.string().array()]).describe("Optional shell commands to run before the instance program starts.");
|
|
523
|
+
var ISchema = z16.object({
|
|
524
|
+
code: CodeSchema2,
|
|
525
|
+
description: DescriptionSchema2.optional(),
|
|
526
|
+
image: ImageSchema.optional(),
|
|
527
|
+
startupCommand: StartupCommandSchema.optional(),
|
|
528
|
+
log: LogSchema2.optional(),
|
|
529
|
+
cpu: CpuSchema.optional(),
|
|
530
|
+
memorySize: MemorySizeSchema2.optional(),
|
|
531
|
+
architecture: ArchitectureSchema3.optional(),
|
|
532
|
+
environment: EnvironmentSchema2.optional(),
|
|
533
|
+
permissions: PermissionsSchema2.optional(),
|
|
534
|
+
healthCheck: HealthCheckSchema.optional()
|
|
535
|
+
// restartPolicy: RestartPolicySchema.optional(),
|
|
536
|
+
});
|
|
537
|
+
var InstanceSchema = z16.union([
|
|
538
|
+
LocalFileSchema.transform((code) => ({
|
|
539
|
+
code
|
|
540
|
+
})).pipe(ISchema),
|
|
541
|
+
ISchema
|
|
511
542
|
]);
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
"The REST API route that is comprised by the http method and http path.",
|
|
527
|
-
"The possible http methods are POST, GET,PUT, DELETE, HEAD, OPTIONS, ANY.",
|
|
528
|
-
"Example: GET /posts/{id}"
|
|
529
|
-
].join("\n")
|
|
530
|
-
),
|
|
531
|
-
FunctionSchema
|
|
532
|
-
)
|
|
533
|
-
).optional().describe("Define routes in your stack for your global REST API.");
|
|
534
|
-
|
|
535
|
-
// src/feature/rpc/schema.ts
|
|
536
|
-
import { minutes as minutes4, seconds as seconds3 } from "@awsless/duration";
|
|
537
|
-
import { z as z21 } from "zod";
|
|
543
|
+
var InstancesSchema = z16.record(ResourceIdSchema, InstanceSchema).optional().describe("Define the instances in your stack.");
|
|
544
|
+
var InstanceDefaultSchema = z16.object({
|
|
545
|
+
image: ImageSchema.optional(),
|
|
546
|
+
cpu: CpuSchema.default(0.25),
|
|
547
|
+
memorySize: MemorySizeSchema2.default("512 MB"),
|
|
548
|
+
architecture: ArchitectureSchema3.default("arm64"),
|
|
549
|
+
environment: EnvironmentSchema2.optional(),
|
|
550
|
+
permissions: PermissionsSchema2.optional(),
|
|
551
|
+
healthCheck: HealthCheckSchema.optional(),
|
|
552
|
+
// restartPolicy: RestartPolicySchema.default({ enabled: true }),
|
|
553
|
+
log: LogSchema2.default(true).transform((log) => ({
|
|
554
|
+
retention: log.retention ?? days2(7)
|
|
555
|
+
}))
|
|
556
|
+
}).default({});
|
|
538
557
|
|
|
539
558
|
// src/feature/router/schema.ts
|
|
540
|
-
import { days as days3, minutes as
|
|
541
|
-
import { z as
|
|
542
|
-
var ErrorResponsePathSchema =
|
|
559
|
+
import { days as days3, minutes as minutes2, parse as parse3 } from "@awsless/duration";
|
|
560
|
+
import { z as z17 } from "zod";
|
|
561
|
+
var ErrorResponsePathSchema = z17.string().describe(
|
|
543
562
|
[
|
|
544
563
|
"The path to the custom error page that you want to return to the viewer when your origin returns the HTTP status code specified.",
|
|
545
564
|
"- We recommend that you store custom error pages in an Amazon S3 bucket.",
|
|
546
565
|
"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."
|
|
547
566
|
].join("\n")
|
|
548
567
|
);
|
|
549
|
-
var StatusCodeSchema =
|
|
568
|
+
var StatusCodeSchema = z17.number().int().positive().optional().describe(
|
|
550
569
|
[
|
|
551
570
|
"The HTTP status code that you want CloudFront to return to the viewer along with the custom error page.",
|
|
552
571
|
"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:",
|
|
@@ -559,26 +578,26 @@ var StatusCodeSchema = z20.number().int().positive().optional().describe(
|
|
|
559
578
|
var MinTTLSchema = DurationSchema.describe(
|
|
560
579
|
"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."
|
|
561
580
|
);
|
|
562
|
-
var ErrorResponseSchema =
|
|
581
|
+
var ErrorResponseSchema = z17.union([
|
|
563
582
|
ErrorResponsePathSchema,
|
|
564
|
-
|
|
583
|
+
z17.object({
|
|
565
584
|
path: ErrorResponsePathSchema,
|
|
566
585
|
statusCode: StatusCodeSchema.optional(),
|
|
567
586
|
minTTL: MinTTLSchema.optional()
|
|
568
587
|
})
|
|
569
588
|
]).optional();
|
|
570
|
-
var
|
|
571
|
-
var VisibilitySchema =
|
|
572
|
-
var WafSettingsSchema =
|
|
573
|
-
rateLimiter:
|
|
574
|
-
limit:
|
|
589
|
+
var RouteSchema = z17.string().regex(/^\//, "Route must start with a slash (/)");
|
|
590
|
+
var VisibilitySchema = z17.boolean().default(false).describe("Whether to enable CloudWatch metrics for the WAF rule.");
|
|
591
|
+
var WafSettingsSchema = z17.object({
|
|
592
|
+
rateLimiter: z17.object({
|
|
593
|
+
limit: z17.number().min(10).max(2e9).default(10).describe(
|
|
575
594
|
"The limit on requests during the specified evaluation window for a single aggregation instance for the rate-based rule."
|
|
576
595
|
),
|
|
577
|
-
window:
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
596
|
+
window: z17.union([
|
|
597
|
+
z17.literal("1 minute"),
|
|
598
|
+
z17.literal("2 minutes"),
|
|
599
|
+
z17.literal("5 minutes"),
|
|
600
|
+
z17.literal("10 minutes")
|
|
582
601
|
]).default("5 minutes").transform((v) => parse3(v)).describe(
|
|
583
602
|
"The amount of time, in seconds, that AWS WAF should include in its request counts, looking back from the current time."
|
|
584
603
|
),
|
|
@@ -586,39 +605,39 @@ var WafSettingsSchema = z20.object({
|
|
|
586
605
|
}).optional().describe(
|
|
587
606
|
"A rate-based rule counts incoming requests and rate limits requests when they are coming at too fast a rate."
|
|
588
607
|
),
|
|
589
|
-
ddosProtection:
|
|
590
|
-
sensitivity:
|
|
591
|
-
challenge:
|
|
592
|
-
block:
|
|
608
|
+
ddosProtection: z17.object({
|
|
609
|
+
sensitivity: z17.object({
|
|
610
|
+
challenge: z17.enum(["low", "medium", "high"]).default("low").transform((v) => v.toUpperCase()).describe("The sensitivity level for challenge requests."),
|
|
611
|
+
block: z17.enum(["low", "medium", "high"]).default("low").transform((v) => v.toUpperCase()).describe("The sensitivity level for block requests.")
|
|
593
612
|
}),
|
|
594
|
-
exemptUriRegex:
|
|
613
|
+
exemptUriRegex: z17.string().default("^$"),
|
|
595
614
|
visibility: VisibilitySchema
|
|
596
615
|
}).optional().describe(
|
|
597
616
|
"Provides protection against DDoS attacks targeting the application layer, also known as Layer 7 attacks. Uses 50 WCU."
|
|
598
617
|
),
|
|
599
|
-
botProtection:
|
|
600
|
-
inspectionLevel:
|
|
618
|
+
botProtection: z17.object({
|
|
619
|
+
inspectionLevel: z17.enum(["common", "targeted"]).default("common").transform((v) => v.toUpperCase()),
|
|
601
620
|
visibility: VisibilitySchema
|
|
602
621
|
}).optional().describe(
|
|
603
622
|
"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."
|
|
604
623
|
),
|
|
605
|
-
captchaImmunityTime: DurationSchema.refine(durationMin(
|
|
624
|
+
captchaImmunityTime: DurationSchema.refine(durationMin(minutes2(1)), "Minimum timeout duration is 1 minute").refine(durationMax(days3(3)), "Maximum timeout duration is 3 days").default("5 minutes").describe(
|
|
606
625
|
"The amount of time that a CAPTCHA timestamp is considered valid by AWS WAF. The default setting is 5 minutes."
|
|
607
626
|
),
|
|
608
|
-
challengeImmunityTime: DurationSchema.refine(durationMin(
|
|
627
|
+
challengeImmunityTime: DurationSchema.refine(durationMin(minutes2(1)), "Minimum timeout duration is 1 minute").refine(durationMax(days3(3)), "Maximum timeout duration is 3 days").default("5 minutes").describe(
|
|
609
628
|
"The amount of time that a challenge timestamp is considered valid by AWS WAF. The default setting is 5 minutes."
|
|
610
629
|
)
|
|
611
630
|
}).describe(
|
|
612
631
|
"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."
|
|
613
632
|
);
|
|
614
|
-
var RouterDefaultSchema =
|
|
633
|
+
var RouterDefaultSchema = z17.record(
|
|
615
634
|
ResourceIdSchema,
|
|
616
|
-
|
|
635
|
+
z17.object({
|
|
617
636
|
domain: ResourceIdSchema.describe("The domain id to link your Router.").optional(),
|
|
618
|
-
subDomain:
|
|
637
|
+
subDomain: z17.string().optional(),
|
|
619
638
|
waf: WafSettingsSchema.optional(),
|
|
620
|
-
geoRestrictions:
|
|
621
|
-
errors:
|
|
639
|
+
geoRestrictions: z17.array(z17.string().length(2).toUpperCase()).default([]).describe("Specifies a blacklist of countries that should be blocked."),
|
|
640
|
+
errors: z17.object({
|
|
622
641
|
400: ErrorResponseSchema.describe("Customize a `400 Bad Request` response."),
|
|
623
642
|
403: ErrorResponseSchema.describe("Customize a `403 Forbidden` response."),
|
|
624
643
|
404: ErrorResponseSchema.describe("Customize a `404 Not Found` response."),
|
|
@@ -631,26 +650,26 @@ var RouterDefaultSchema = z20.record(
|
|
|
631
650
|
503: ErrorResponseSchema.describe("Customize a `503 Service Unavailable` response."),
|
|
632
651
|
504: ErrorResponseSchema.describe("Customize a `504 Gateway Timeout` response.")
|
|
633
652
|
}).optional().describe("Customize the error responses for specific HTTP status codes."),
|
|
634
|
-
cors:
|
|
635
|
-
override:
|
|
653
|
+
cors: z17.object({
|
|
654
|
+
override: z17.boolean().default(false),
|
|
636
655
|
maxAge: DurationSchema.default("365 days"),
|
|
637
|
-
exposeHeaders:
|
|
638
|
-
credentials:
|
|
639
|
-
headers:
|
|
640
|
-
origins:
|
|
641
|
-
methods:
|
|
656
|
+
exposeHeaders: z17.string().array().optional(),
|
|
657
|
+
credentials: z17.boolean().default(false),
|
|
658
|
+
headers: z17.string().array().default(["*"]),
|
|
659
|
+
origins: z17.string().array().default(["*"]),
|
|
660
|
+
methods: z17.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
|
|
642
661
|
}).optional().describe("Specify the cors headers."),
|
|
643
|
-
passwordAuth:
|
|
644
|
-
password:
|
|
662
|
+
passwordAuth: z17.object({
|
|
663
|
+
password: z17.string().describe("Password.")
|
|
645
664
|
}).optional().describe(
|
|
646
665
|
[
|
|
647
666
|
"Enable password authentication for the router.",
|
|
648
667
|
'You can authenicate by adding a "authorization" header with the value "Password [YOUR_PASSWORD]".'
|
|
649
668
|
].join("\n")
|
|
650
669
|
),
|
|
651
|
-
basicAuth:
|
|
652
|
-
username:
|
|
653
|
-
password:
|
|
670
|
+
basicAuth: z17.object({
|
|
671
|
+
username: z17.string().describe("Basic auth username."),
|
|
672
|
+
password: z17.string().describe("Basic auth password.")
|
|
654
673
|
}).optional().describe("Enable basic authentication for the router."),
|
|
655
674
|
// security: z
|
|
656
675
|
// .object({
|
|
@@ -697,17 +716,130 @@ var RouterDefaultSchema = z20.record(
|
|
|
697
716
|
// })
|
|
698
717
|
// .optional()
|
|
699
718
|
// .describe('Specify the security policy.'),
|
|
700
|
-
cache:
|
|
701
|
-
cookies:
|
|
702
|
-
headers:
|
|
703
|
-
queries:
|
|
719
|
+
cache: z17.object({
|
|
720
|
+
cookies: z17.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
|
|
721
|
+
headers: z17.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
|
|
722
|
+
queries: z17.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
|
|
704
723
|
}).optional().describe(
|
|
705
724
|
"Specifies the cookies, headers, and query values that CloudFront includes in the cache key."
|
|
706
725
|
)
|
|
707
726
|
})
|
|
708
727
|
).optional().describe(`Define the global Router. Backed by AWS CloudFront.`);
|
|
709
728
|
|
|
729
|
+
// src/feature/pubsub/schema.ts
|
|
730
|
+
var PubSubDefaultSchema = z18.record(
|
|
731
|
+
ResourceIdSchema,
|
|
732
|
+
z18.object({
|
|
733
|
+
auth: FunctionSchema.describe(
|
|
734
|
+
"The authorizer that validates the client auth token and returns the allowed topics."
|
|
735
|
+
),
|
|
736
|
+
router: ResourceIdSchema.describe("The router id to route pubsub traffic through."),
|
|
737
|
+
path: RouteSchema.default("/ws").describe("The base path on the router that exposes the pubsub endpoint."),
|
|
738
|
+
log: LogSchema2.default(true).transform((log) => ({
|
|
739
|
+
retention: log.retention ?? days4(7)
|
|
740
|
+
}))
|
|
741
|
+
})
|
|
742
|
+
).optional().describe("Define the pubsub API for your app. Backed by a websocket server on AWS Fargate.");
|
|
743
|
+
var PubSubSchema = z18.record(
|
|
744
|
+
ResourceIdSchema,
|
|
745
|
+
z18.object({
|
|
746
|
+
connected: FunctionSchema.optional().describe("Subscribe to the event when a client connects."),
|
|
747
|
+
disconnected: FunctionSchema.optional().describe("Subscribe to the event when a client disconnects."),
|
|
748
|
+
subscribed: FunctionSchema.optional().describe(
|
|
749
|
+
"Subscribe to the event when a client subscribes to topics."
|
|
750
|
+
),
|
|
751
|
+
unsubscribed: FunctionSchema.optional().describe(
|
|
752
|
+
"Subscribe to the event when a client unsubscribes from topics."
|
|
753
|
+
)
|
|
754
|
+
})
|
|
755
|
+
).optional().describe("Define the pubsub event listeners in your stack.");
|
|
756
|
+
|
|
757
|
+
// src/feature/queue/schema.ts
|
|
758
|
+
import { days as days5, hours, minutes as minutes3, seconds as seconds2 } from "@awsless/duration";
|
|
759
|
+
import { kibibytes } from "@awsless/size";
|
|
760
|
+
import { z as z19 } from "zod";
|
|
761
|
+
var RetentionPeriodSchema = DurationSchema.refine(durationMin(minutes3(1)), "Minimum retention period is 1 minute").refine(durationMax(days5(14)), "Maximum retention period is 14 days").describe(
|
|
762
|
+
"The number of seconds that Amazon SQS retains a message. You can specify a duration from 1 minute to 14 days."
|
|
763
|
+
);
|
|
764
|
+
var VisibilityTimeoutSchema = DurationSchema.refine(
|
|
765
|
+
durationMax(hours(12)),
|
|
766
|
+
"Maximum visibility timeout is 12 hours"
|
|
767
|
+
).describe(
|
|
768
|
+
"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."
|
|
769
|
+
);
|
|
770
|
+
var ReceiveMessageWaitTimeSchema = DurationSchema.refine(
|
|
771
|
+
durationMin(seconds2(1)),
|
|
772
|
+
"Minimum receive message wait time is 1 second"
|
|
773
|
+
).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.");
|
|
774
|
+
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.");
|
|
775
|
+
var BatchSizeSchema = z19.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.");
|
|
776
|
+
var RetryAttemptsSchema2 = z19.number().int().min(0).max(999).describe(
|
|
777
|
+
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 999."
|
|
778
|
+
);
|
|
779
|
+
var QueueDefaultSchema = z19.object({
|
|
780
|
+
retentionPeriod: RetentionPeriodSchema.default("7 days"),
|
|
781
|
+
visibilityTimeout: VisibilityTimeoutSchema.default("2 minutes"),
|
|
782
|
+
receiveMessageWaitTime: ReceiveMessageWaitTimeSchema.optional(),
|
|
783
|
+
maxMessageSize: MaxMessageSizeSchema.default("256 KB"),
|
|
784
|
+
batchSize: BatchSizeSchema.default(10),
|
|
785
|
+
retryAttempts: RetryAttemptsSchema2.default(2)
|
|
786
|
+
}).default({});
|
|
787
|
+
var QueueSchema = z19.object({
|
|
788
|
+
consumer: FunctionSchema.optional().describe("The consuming lambda function properties."),
|
|
789
|
+
retentionPeriod: RetentionPeriodSchema.optional(),
|
|
790
|
+
visibilityTimeout: VisibilityTimeoutSchema.optional(),
|
|
791
|
+
receiveMessageWaitTime: ReceiveMessageWaitTimeSchema.optional(),
|
|
792
|
+
maxMessageSize: MaxMessageSizeSchema.optional(),
|
|
793
|
+
batchSize: BatchSizeSchema.optional(),
|
|
794
|
+
retryAttempts: RetryAttemptsSchema2.optional()
|
|
795
|
+
});
|
|
796
|
+
var QueuesSchema = z19.record(
|
|
797
|
+
ResourceIdSchema,
|
|
798
|
+
z19.union([
|
|
799
|
+
LocalFileSchema.transform((consumer) => ({
|
|
800
|
+
consumer
|
|
801
|
+
})).pipe(QueueSchema),
|
|
802
|
+
QueueSchema
|
|
803
|
+
])
|
|
804
|
+
).optional().describe(
|
|
805
|
+
"Define the queues in your stack. Queues are FIFO with required per-message groupId: messages with the same groupId are processed strictly in order; different groupIds parallelize."
|
|
806
|
+
);
|
|
807
|
+
|
|
808
|
+
// src/feature/rest/schema.ts
|
|
809
|
+
import { z as z21 } from "zod";
|
|
810
|
+
|
|
811
|
+
// src/config/schema/route.ts
|
|
812
|
+
import { z as z20 } from "zod";
|
|
813
|
+
var RouteSchema2 = z20.union([
|
|
814
|
+
z20.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS|ANY)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route"),
|
|
815
|
+
z20.literal("$default")
|
|
816
|
+
]);
|
|
817
|
+
|
|
818
|
+
// src/feature/rest/schema.ts
|
|
819
|
+
var RestDefaultSchema = z21.record(
|
|
820
|
+
ResourceIdSchema,
|
|
821
|
+
z21.object({
|
|
822
|
+
domain: ResourceIdSchema.describe("The domain id to link your API with.").optional(),
|
|
823
|
+
subDomain: z21.string().optional()
|
|
824
|
+
})
|
|
825
|
+
).optional().describe("Define your global REST API's.");
|
|
826
|
+
var RestSchema = z21.record(
|
|
827
|
+
ResourceIdSchema,
|
|
828
|
+
z21.record(
|
|
829
|
+
RouteSchema2.describe(
|
|
830
|
+
[
|
|
831
|
+
"The REST API route that is comprised by the http method and http path.",
|
|
832
|
+
"The possible http methods are POST, GET,PUT, DELETE, HEAD, OPTIONS, ANY.",
|
|
833
|
+
"Example: GET /posts/{id}"
|
|
834
|
+
].join("\n")
|
|
835
|
+
),
|
|
836
|
+
FunctionSchema
|
|
837
|
+
)
|
|
838
|
+
).optional().describe("Define routes in your stack for your global REST API.");
|
|
839
|
+
|
|
710
840
|
// src/feature/rpc/schema.ts
|
|
841
|
+
import { minutes as minutes4, seconds as seconds3 } from "@awsless/duration";
|
|
842
|
+
import { z as z22 } from "zod";
|
|
711
843
|
var TimeoutSchema2 = DurationSchema.refine(durationMin(seconds3(10)), "Minimum timeout duration is 10 seconds").refine(durationMax(minutes4(5)), "Maximum timeout duration is 5 minutes").describe(
|
|
712
844
|
[
|
|
713
845
|
"The amount of time that the RPC lambda is allowed run before stopping it.",
|
|
@@ -715,31 +847,31 @@ var TimeoutSchema2 = DurationSchema.refine(durationMin(seconds3(10)), "Minimum t
|
|
|
715
847
|
"The timeouts of all inner RPC functions will be capped at 80% of this timeout."
|
|
716
848
|
].join(" ")
|
|
717
849
|
);
|
|
718
|
-
var RpcDefaultSchema =
|
|
850
|
+
var RpcDefaultSchema = z22.record(
|
|
719
851
|
ResourceIdSchema,
|
|
720
|
-
|
|
852
|
+
z22.object({
|
|
721
853
|
// domain: ResourceIdSchema.describe('The domain id to link your RPC API with.').optional(),
|
|
722
854
|
// subDomain: z.string().optional(),
|
|
723
855
|
//
|
|
724
856
|
router: ResourceIdSchema.describe("The router id to link your RPC API with."),
|
|
725
|
-
path:
|
|
857
|
+
path: RouteSchema.describe("The path inside the router to link your RPC API to."),
|
|
726
858
|
auth: FunctionSchema.optional().describe("The authentication handler for your RPC API."),
|
|
727
859
|
log: LogSchema.optional(),
|
|
728
860
|
timeout: TimeoutSchema2.default("1 minutes")
|
|
729
861
|
})
|
|
730
862
|
).describe(`Define the global RPC API's.`).optional();
|
|
731
|
-
var RpcSchema =
|
|
863
|
+
var RpcSchema = z22.record(
|
|
732
864
|
ResourceIdSchema,
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
865
|
+
z22.record(
|
|
866
|
+
z22.string(),
|
|
867
|
+
z22.union([
|
|
736
868
|
FunctionSchema.transform((f) => ({
|
|
737
869
|
function: f,
|
|
738
870
|
lock: false
|
|
739
871
|
})),
|
|
740
|
-
|
|
872
|
+
z22.object({
|
|
741
873
|
function: FunctionSchema.describe("The RPC function to execute."),
|
|
742
|
-
lock:
|
|
874
|
+
lock: z22.boolean().describe(
|
|
743
875
|
[
|
|
744
876
|
"Specify if the function should be locked on the `lockKey` returned from the auth function.",
|
|
745
877
|
"An example would be returning the user ID as `lockKey`."
|
|
@@ -751,136 +883,10 @@ var RpcSchema = z21.record(
|
|
|
751
883
|
).describe("Define the schema in your stack for your global RPC API.").optional();
|
|
752
884
|
|
|
753
885
|
// src/feature/job/schema.ts
|
|
754
|
-
import { days as
|
|
755
|
-
import { toMebibytes } from "@awsless/size";
|
|
756
|
-
import { z as z22 } from "zod";
|
|
757
|
-
var CpuSchema = 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.");
|
|
758
|
-
var validMemorySize = [
|
|
759
|
-
// 0.25 vCPU
|
|
760
|
-
512,
|
|
761
|
-
1024,
|
|
762
|
-
2048,
|
|
763
|
-
// 0.5 vCPU
|
|
764
|
-
1024,
|
|
765
|
-
2048,
|
|
766
|
-
3072,
|
|
767
|
-
4096,
|
|
768
|
-
// 1 vCPU
|
|
769
|
-
2048,
|
|
770
|
-
3072,
|
|
771
|
-
4096,
|
|
772
|
-
5120,
|
|
773
|
-
6144,
|
|
774
|
-
7168,
|
|
775
|
-
8192,
|
|
776
|
-
// 2 vCPU
|
|
777
|
-
4096,
|
|
778
|
-
5120,
|
|
779
|
-
6144,
|
|
780
|
-
7168,
|
|
781
|
-
8192,
|
|
782
|
-
9216,
|
|
783
|
-
10240,
|
|
784
|
-
11264,
|
|
785
|
-
12288,
|
|
786
|
-
13312,
|
|
787
|
-
14336,
|
|
788
|
-
15360,
|
|
789
|
-
16384
|
|
790
|
-
];
|
|
791
|
-
var MemorySizeSchema2 = SizeSchema.refine(
|
|
792
|
-
(s) => validMemorySize.includes(toMebibytes(s)),
|
|
793
|
-
`Invalid memory size. Allowed sizes: ${validMemorySize.join(", ")} MiB`
|
|
794
|
-
).describe("The amount of memory (in MiB) used by the job. Valid memory values depend on the CPU configuration.");
|
|
795
|
-
var EnvironmentSchema2 = z22.record(z22.string(), z22.string()).optional().describe("Environment variable key-value pairs.");
|
|
796
|
-
var ArchitectureSchema3 = z22.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the job supports.");
|
|
797
|
-
var ActionSchema2 = z22.string();
|
|
798
|
-
var ActionsSchema2 = z22.union([ActionSchema2.transform((v) => [v]), ActionSchema2.array()]);
|
|
799
|
-
var ArnSchema2 = z22.string().startsWith("arn:");
|
|
800
|
-
var WildcardSchema2 = z22.literal("*");
|
|
801
|
-
var ResourceSchema2 = z22.union([ArnSchema2, WildcardSchema2]);
|
|
802
|
-
var ResourcesSchema2 = z22.union([ResourceSchema2.transform((v) => [v]), ResourceSchema2.array()]);
|
|
803
|
-
var PermissionSchema2 = z22.object({
|
|
804
|
-
effect: z22.enum(["allow", "deny"]).default("allow"),
|
|
805
|
-
actions: ActionsSchema2,
|
|
806
|
-
resources: ResourcesSchema2
|
|
807
|
-
});
|
|
808
|
-
var PermissionsSchema2 = z22.union([PermissionSchema2.transform((v) => [v]), PermissionSchema2.array()]).describe("Add IAM permissions to your job.");
|
|
809
|
-
var validLogRetentionDays2 = [
|
|
810
|
-
...[1, 3, 5, 7, 14, 30, 60, 90, 120, 150],
|
|
811
|
-
...[180, 365, 400, 545, 731, 1096, 1827, 2192],
|
|
812
|
-
...[2557, 2922, 3288, 3653]
|
|
813
|
-
];
|
|
814
|
-
var LogRetentionSchema2 = DurationSchema.refine(
|
|
815
|
-
durationMin(days4(0)),
|
|
816
|
-
"Minimum log retention is 0 day, which will disable logging."
|
|
817
|
-
).refine(
|
|
818
|
-
(duration) => {
|
|
819
|
-
return validLogRetentionDays2.includes(toDays2(duration));
|
|
820
|
-
},
|
|
821
|
-
`Invalid log retention. Valid days are: ${validLogRetentionDays2.map((days7) => `${days7}`).join(", ")}`
|
|
822
|
-
).describe("The log retention duration.");
|
|
823
|
-
var LogSchema2 = z22.union([
|
|
824
|
-
z22.boolean().transform((enabled) => ({ retention: enabled ? days4(7) : days4(0) })),
|
|
825
|
-
LogRetentionSchema2.transform((retention) => ({ retention })),
|
|
826
|
-
z22.object({
|
|
827
|
-
retention: LogRetentionSchema2.optional()
|
|
828
|
-
})
|
|
829
|
-
]).describe("Enable logging to a CloudWatch log group. Providing a duration value will set the log retention time.");
|
|
830
|
-
var FileCodeSchema2 = z22.object({
|
|
831
|
-
file: LocalFileSchema.describe("The file path of the job code.")
|
|
832
|
-
});
|
|
833
|
-
var CodeSchema2 = z22.union([
|
|
834
|
-
LocalFileSchema.transform((file) => ({
|
|
835
|
-
file
|
|
836
|
-
})).pipe(FileCodeSchema2),
|
|
837
|
-
FileCodeSchema2
|
|
838
|
-
]).describe("Specify the code of your job.");
|
|
839
|
-
var TimeoutSchema3 = DurationSchema.describe("The maximum time the job is allowed to run before being stopped.");
|
|
840
|
-
var ImageSchema = z22.string().describe("The URL of the container image to use. Default: public.ecr.aws/aws-cli/aws-cli:{architecture}");
|
|
841
|
-
var PersistentStorageSchema = z22.boolean().describe("Mount persistent storage for the job at a fixed internal path.");
|
|
842
|
-
var StartupCommandSchema = z22.union([z22.string().transform((v) => [v]), z22.string().array()]).describe("Optional shell commands to run before the job executable is downloaded and started.");
|
|
843
|
-
var ASchema = z22.object({
|
|
844
|
-
code: CodeSchema2,
|
|
845
|
-
image: ImageSchema.optional(),
|
|
846
|
-
persistentStorage: PersistentStorageSchema.optional(),
|
|
847
|
-
startupCommand: StartupCommandSchema.optional(),
|
|
848
|
-
log: LogSchema2.optional(),
|
|
849
|
-
cpu: CpuSchema.optional(),
|
|
850
|
-
memorySize: MemorySizeSchema2.optional(),
|
|
851
|
-
architecture: ArchitectureSchema3.optional(),
|
|
852
|
-
environment: EnvironmentSchema2.optional(),
|
|
853
|
-
permissions: PermissionsSchema2.optional(),
|
|
854
|
-
timeout: TimeoutSchema3.default("30 minutes").describe("The maximum time the job is allowed to run before being stopped. Default: 30 minutes.")
|
|
855
|
-
});
|
|
856
|
-
var JobSchema = z22.union([
|
|
857
|
-
LocalFileSchema.transform((code) => ({
|
|
858
|
-
code
|
|
859
|
-
})).pipe(ASchema),
|
|
860
|
-
ASchema
|
|
861
|
-
]);
|
|
862
|
-
var JobsSchema = z22.record(ResourceIdSchema, JobSchema).optional().describe("Define the jobs in your stack.");
|
|
863
|
-
var JobDefaultSchema = z22.object({
|
|
864
|
-
image: ImageSchema.optional(),
|
|
865
|
-
persistentStorage: PersistentStorageSchema.optional(),
|
|
866
|
-
cpu: CpuSchema.default(0.25),
|
|
867
|
-
memorySize: MemorySizeSchema2.default("512 MB"),
|
|
868
|
-
architecture: ArchitectureSchema3.default("arm64"),
|
|
869
|
-
environment: EnvironmentSchema2.optional(),
|
|
870
|
-
permissions: PermissionsSchema2.optional(),
|
|
871
|
-
timeout: TimeoutSchema3.optional(),
|
|
872
|
-
log: LogSchema2.default(true).transform((log) => ({
|
|
873
|
-
retention: log.retention ?? days4(7)
|
|
874
|
-
}))
|
|
875
|
-
}).default({});
|
|
876
|
-
|
|
877
|
-
// src/feature/instance/schema.ts
|
|
878
|
-
import { days as days5, toDays as toDays3 } from "@awsless/duration";
|
|
886
|
+
import { days as days6, toDays as toDays3 } from "@awsless/duration";
|
|
879
887
|
import { toMebibytes as toMebibytes2 } from "@awsless/size";
|
|
880
888
|
import { z as z23 } from "zod";
|
|
881
|
-
var CpuSchema2 = z23.union([z23.literal(0.25), z23.literal(0.5), z23.literal(1), z23.literal(2), z23.literal(4), z23.literal(8), z23.literal(16)]).transform((v) => `${v} vCPU`).describe(
|
|
882
|
-
"The number of virtual CPU units (vCPU) used by the instance. Valid values: 0.25, 0.5, 1, 2, 4, 8, 16 vCPU."
|
|
883
|
-
);
|
|
889
|
+
var CpuSchema2 = z23.union([z23.literal(0.25), z23.literal(0.5), z23.literal(1), z23.literal(2), z23.literal(4), z23.literal(8), z23.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.");
|
|
884
890
|
var validMemorySize2 = [
|
|
885
891
|
// 0.25 vCPU
|
|
886
892
|
512,
|
|
@@ -917,22 +923,9 @@ var validMemorySize2 = [
|
|
|
917
923
|
var MemorySizeSchema3 = SizeSchema.refine(
|
|
918
924
|
(s) => validMemorySize2.includes(toMebibytes2(s)),
|
|
919
925
|
`Invalid memory size. Allowed sizes: ${validMemorySize2.join(", ")} MiB`
|
|
920
|
-
).describe("The amount of memory (in MiB) used by the
|
|
921
|
-
var HealthCheckSchema = z23.object({
|
|
922
|
-
path: z23.string().describe("The path that the container runs to determine if it is healthy."),
|
|
923
|
-
interval: DurationSchema.describe("The time period in seconds between each health check execution."),
|
|
924
|
-
retries: z23.number().int().min(1).max(10).describe(
|
|
925
|
-
"The number of times to retry a failed health check before the container is considered unhealthy."
|
|
926
|
-
),
|
|
927
|
-
startPeriod: DurationSchema.describe(
|
|
928
|
-
"The optional grace period to provide containers time to bootstrap before failed health checks count towards the maximum number of retries."
|
|
929
|
-
),
|
|
930
|
-
timeout: DurationSchema.describe(
|
|
931
|
-
"The time period in seconds to wait for a health check to succeed before it is considered a failure."
|
|
932
|
-
)
|
|
933
|
-
}).describe("The health check command and associated configuration parameters for the container.");
|
|
926
|
+
).describe("The amount of memory (in MiB) used by the job. Valid memory values depend on the CPU configuration.");
|
|
934
927
|
var EnvironmentSchema3 = z23.record(z23.string(), z23.string()).optional().describe("Environment variable key-value pairs.");
|
|
935
|
-
var ArchitectureSchema4 = z23.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the
|
|
928
|
+
var ArchitectureSchema4 = z23.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the job supports.");
|
|
936
929
|
var ActionSchema3 = z23.string();
|
|
937
930
|
var ActionsSchema3 = z23.union([ActionSchema3.transform((v) => [v]), ActionSchema3.array()]);
|
|
938
931
|
var ArnSchema3 = z23.string().startsWith("arn:");
|
|
@@ -944,44 +937,45 @@ var PermissionSchema3 = z23.object({
|
|
|
944
937
|
actions: ActionsSchema3,
|
|
945
938
|
resources: ResourcesSchema3
|
|
946
939
|
});
|
|
947
|
-
var PermissionsSchema3 = z23.union([PermissionSchema3.transform((v) => [v]), PermissionSchema3.array()]).describe("Add IAM permissions to your
|
|
948
|
-
var DescriptionSchema2 = z23.string().describe("A description of the instance.");
|
|
949
|
-
var ImageSchema2 = z23.string().optional().describe("The URL of the container image to use. Default: public.ecr.aws/aws-cli/aws-cli:{architecture}");
|
|
940
|
+
var PermissionsSchema3 = z23.union([PermissionSchema3.transform((v) => [v]), PermissionSchema3.array()]).describe("Add IAM permissions to your job.");
|
|
950
941
|
var validLogRetentionDays3 = [
|
|
951
942
|
...[1, 3, 5, 7, 14, 30, 60, 90, 120, 150],
|
|
952
943
|
...[180, 365, 400, 545, 731, 1096, 1827, 2192],
|
|
953
944
|
...[2557, 2922, 3288, 3653]
|
|
954
945
|
];
|
|
955
946
|
var LogRetentionSchema3 = DurationSchema.refine(
|
|
956
|
-
durationMin(
|
|
947
|
+
durationMin(days6(0)),
|
|
957
948
|
"Minimum log retention is 0 day, which will disable logging."
|
|
958
949
|
).refine(
|
|
959
950
|
(duration) => {
|
|
960
951
|
return validLogRetentionDays3.includes(toDays3(duration));
|
|
961
952
|
},
|
|
962
|
-
`Invalid log retention. Valid days are: ${validLogRetentionDays3.map((
|
|
953
|
+
`Invalid log retention. Valid days are: ${validLogRetentionDays3.map((days8) => `${days8}`).join(", ")}`
|
|
963
954
|
).describe("The log retention duration.");
|
|
964
955
|
var LogSchema3 = z23.union([
|
|
965
|
-
z23.boolean().transform((enabled) => ({ retention: enabled ?
|
|
956
|
+
z23.boolean().transform((enabled) => ({ retention: enabled ? days6(7) : days6(0) })),
|
|
966
957
|
LogRetentionSchema3.transform((retention) => ({ retention })),
|
|
967
958
|
z23.object({
|
|
968
959
|
retention: LogRetentionSchema3.optional()
|
|
969
960
|
})
|
|
970
961
|
]).describe("Enable logging to a CloudWatch log group. Providing a duration value will set the log retention time.");
|
|
971
962
|
var FileCodeSchema3 = z23.object({
|
|
972
|
-
file: LocalFileSchema.describe("The file path of the
|
|
963
|
+
file: LocalFileSchema.describe("The file path of the job code.")
|
|
973
964
|
});
|
|
974
965
|
var CodeSchema3 = z23.union([
|
|
975
966
|
LocalFileSchema.transform((file) => ({
|
|
976
967
|
file
|
|
977
968
|
})).pipe(FileCodeSchema3),
|
|
978
969
|
FileCodeSchema3
|
|
979
|
-
]).describe("Specify the code of your
|
|
980
|
-
var
|
|
981
|
-
var
|
|
970
|
+
]).describe("Specify the code of your job.");
|
|
971
|
+
var TimeoutSchema3 = DurationSchema.describe("The maximum time the job is allowed to run before being stopped.");
|
|
972
|
+
var ImageSchema2 = z23.string().describe("The URL of the container image to use. Default: public.ecr.aws/aws-cli/aws-cli:{architecture}");
|
|
973
|
+
var PersistentStorageSchema = z23.boolean().describe("Mount persistent storage for the job at a fixed internal path.");
|
|
974
|
+
var StartupCommandSchema2 = z23.union([z23.string().transform((v) => [v]), z23.string().array()]).describe("Optional shell commands to run before the job executable is downloaded and started.");
|
|
975
|
+
var ASchema = z23.object({
|
|
982
976
|
code: CodeSchema3,
|
|
983
|
-
description: DescriptionSchema2.optional(),
|
|
984
977
|
image: ImageSchema2.optional(),
|
|
978
|
+
persistentStorage: PersistentStorageSchema.optional(),
|
|
985
979
|
startupCommand: StartupCommandSchema2.optional(),
|
|
986
980
|
log: LogSchema3.optional(),
|
|
987
981
|
cpu: CpuSchema2.optional(),
|
|
@@ -989,27 +983,26 @@ var ISchema = z23.object({
|
|
|
989
983
|
architecture: ArchitectureSchema4.optional(),
|
|
990
984
|
environment: EnvironmentSchema3.optional(),
|
|
991
985
|
permissions: PermissionsSchema3.optional(),
|
|
992
|
-
|
|
993
|
-
// restartPolicy: RestartPolicySchema.optional(),
|
|
986
|
+
timeout: TimeoutSchema3.default("30 minutes").describe("The maximum time the job is allowed to run before being stopped. Default: 30 minutes.")
|
|
994
987
|
});
|
|
995
|
-
var
|
|
988
|
+
var JobSchema = z23.union([
|
|
996
989
|
LocalFileSchema.transform((code) => ({
|
|
997
990
|
code
|
|
998
|
-
})).pipe(
|
|
999
|
-
|
|
991
|
+
})).pipe(ASchema),
|
|
992
|
+
ASchema
|
|
1000
993
|
]);
|
|
1001
|
-
var
|
|
1002
|
-
var
|
|
994
|
+
var JobsSchema = z23.record(ResourceIdSchema, JobSchema).optional().describe("Define the jobs in your stack.");
|
|
995
|
+
var JobDefaultSchema = z23.object({
|
|
1003
996
|
image: ImageSchema2.optional(),
|
|
997
|
+
persistentStorage: PersistentStorageSchema.optional(),
|
|
1004
998
|
cpu: CpuSchema2.default(0.25),
|
|
1005
999
|
memorySize: MemorySizeSchema3.default("512 MB"),
|
|
1006
1000
|
architecture: ArchitectureSchema4.default("arm64"),
|
|
1007
1001
|
environment: EnvironmentSchema3.optional(),
|
|
1008
1002
|
permissions: PermissionsSchema3.optional(),
|
|
1009
|
-
|
|
1010
|
-
// restartPolicy: RestartPolicySchema.default({ enabled: true }),
|
|
1003
|
+
timeout: TimeoutSchema3.optional(),
|
|
1011
1004
|
log: LogSchema3.default(true).transform((log) => ({
|
|
1012
|
-
retention: log.retention ??
|
|
1005
|
+
retention: log.retention ?? days6(7)
|
|
1013
1006
|
}))
|
|
1014
1007
|
}).default({});
|
|
1015
1008
|
|
|
@@ -1207,7 +1200,7 @@ var CronExpressionSchema = z30.custom(
|
|
|
1207
1200
|
var ScheduleExpressionSchema = RateExpressionSchema.or(CronExpressionSchema);
|
|
1208
1201
|
|
|
1209
1202
|
// src/feature/cron/schema/index.ts
|
|
1210
|
-
var
|
|
1203
|
+
var RetryAttemptsSchema3 = z31.number().int().min(0).max(2).describe(
|
|
1211
1204
|
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
|
|
1212
1205
|
);
|
|
1213
1206
|
var CronsSchema = z31.record(
|
|
@@ -1219,7 +1212,7 @@ var CronsSchema = z31.record(
|
|
|
1219
1212
|
'The scheduling expression.\n\nexample: "0 20 * * ? *"\nexample: "5 minutes"'
|
|
1220
1213
|
),
|
|
1221
1214
|
payload: z31.unknown().optional().describe("The JSON payload that will be passed to the consumer."),
|
|
1222
|
-
retryAttempts:
|
|
1215
|
+
retryAttempts: RetryAttemptsSchema3.default(2)
|
|
1223
1216
|
})
|
|
1224
1217
|
).optional().describe(`Define the cron jobs in your stack.`);
|
|
1225
1218
|
|
|
@@ -1349,7 +1342,7 @@ var SitesSchema = z34.record(
|
|
|
1349
1342
|
ResourceIdSchema,
|
|
1350
1343
|
z34.object({
|
|
1351
1344
|
router: ResourceIdSchema.describe("The router id to link your site with."),
|
|
1352
|
-
path:
|
|
1345
|
+
path: RouteSchema.describe("The path inside the router to link your site to."),
|
|
1353
1346
|
build: z34.object({
|
|
1354
1347
|
command: z34.string().describe(
|
|
1355
1348
|
`Specifies the files and directories to generate the cache key for your custom build command.`
|
|
@@ -1367,11 +1360,11 @@ var SitesSchema = z34.record(
|
|
|
1367
1360
|
).optional().describe("Define the sites in your stack.");
|
|
1368
1361
|
|
|
1369
1362
|
// src/feature/store/schema.ts
|
|
1370
|
-
import { days as
|
|
1363
|
+
import { days as days7 } from "@awsless/duration";
|
|
1371
1364
|
import { z as z35 } from "zod";
|
|
1372
1365
|
var LifecycleRuleSchema = z35.object({
|
|
1373
1366
|
prefix: z35.string().optional().describe("Object-key prefix this rule applies to. Omit to apply bucket-wide."),
|
|
1374
|
-
expiration: DurationSchema.refine(durationMin(
|
|
1367
|
+
expiration: DurationSchema.refine(durationMin(days7(1)), "Minimum expiration is 1 day").describe(
|
|
1375
1368
|
"How long objects matching this rule live before S3 deletes them."
|
|
1376
1369
|
)
|
|
1377
1370
|
});
|
|
@@ -1435,7 +1428,7 @@ var IconsSchema = z36.record(
|
|
|
1435
1428
|
// domain: ResourceIdSchema.describe('The domain id to link your site with.').optional(),
|
|
1436
1429
|
// subDomain: z.string().optional(),
|
|
1437
1430
|
router: ResourceIdSchema.describe("The router id to link your icon proxy."),
|
|
1438
|
-
path:
|
|
1431
|
+
path: RouteSchema.describe("The path inside the router to link your icon proxy to."),
|
|
1439
1432
|
log: LogSchema.optional(),
|
|
1440
1433
|
cacheDuration: DurationSchema.optional().describe("The cache duration of the cached icons."),
|
|
1441
1434
|
preserveIds: z36.boolean().optional().default(false).describe("Preserve the IDs of the icons."),
|
|
@@ -1492,7 +1485,7 @@ var ImagesSchema = z37.record(
|
|
|
1492
1485
|
// domain: ResourceIdSchema.describe('The domain id to link your site with.').optional(),
|
|
1493
1486
|
// subDomain: z.string().optional(),
|
|
1494
1487
|
router: ResourceIdSchema.describe("The router id to link your image proxy."),
|
|
1495
|
-
path:
|
|
1488
|
+
path: RouteSchema.describe("The path inside the router to link your image proxy to."),
|
|
1496
1489
|
log: LogSchema.optional(),
|
|
1497
1490
|
cacheDuration: DurationSchema.optional().describe("Cache duration of the cached images."),
|
|
1498
1491
|
presets: z37.record(z37.string(), transformationOptionsSchema).describe("Named presets for image transformations"),
|