@awsless/awsless 0.0.658 → 0.0.659
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 +479 -450
- package/dist/build-json-schema.js +256 -265
- package/dist/prebuild/icon/HASH +1 -1
- package/dist/prebuild/icon/bundle.zip +0 -0
- package/dist/prebuild/image/HASH +1 -1
- package/dist/prebuild/image/bundle.zip +0 -0
- package/dist/prebuild/on-error-log/HASH +1 -0
- package/dist/prebuild/on-error-log/bundle.zip +0 -0
- package/dist/prebuild/on-failure/HASH +1 -1
- package/dist/prebuild/on-failure/bundle.zip +0 -0
- package/dist/prebuild/rpc/HASH +1 -1
- package/dist/prebuild/rpc/bundle.zip +0 -0
- package/dist/prebuild.js +2 -1
- package/dist/server.d.ts +15 -2
- package/dist/server.js +20 -5
- package/package.json +13 -13
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// cli/build-json-schema.ts
|
|
2
|
-
import { writeFileSync } from "
|
|
3
|
-
import { join as join2 } from "
|
|
2
|
+
import { writeFileSync } from "fs";
|
|
3
|
+
import { join as join2 } from "path";
|
|
4
4
|
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
5
5
|
|
|
6
6
|
// src/config/app.ts
|
|
7
|
-
import { z as
|
|
7
|
+
import { z as z25 } from "zod";
|
|
8
8
|
|
|
9
9
|
// src/feature/alert/schema.ts
|
|
10
10
|
import { kebabCase } from "change-case";
|
|
@@ -362,6 +362,11 @@ var LayerSchema = z13.record(
|
|
|
362
362
|
])
|
|
363
363
|
).optional().describe("Define the lambda layers in your stack.");
|
|
364
364
|
|
|
365
|
+
// src/feature/on-error-log/schema.ts
|
|
366
|
+
var OnErrorLogDefaultSchema = FunctionSchema.optional().describe(
|
|
367
|
+
"Define a subscription on all Lambda functions logs."
|
|
368
|
+
);
|
|
369
|
+
|
|
365
370
|
// src/feature/on-failure/schema.ts
|
|
366
371
|
import { z as z14 } from "zod";
|
|
367
372
|
var NotifySchema = z14.union([
|
|
@@ -390,29 +395,15 @@ var OnFailureDefaultSchema = z14.union([
|
|
|
390
395
|
].join("\n")
|
|
391
396
|
);
|
|
392
397
|
|
|
393
|
-
// src/feature/on-log/schema.ts
|
|
394
|
-
import { z as z15 } from "zod";
|
|
395
|
-
var FilterSchema = z15.enum(["trace", "debug", "info", "warn", "error", "fatal"]).array().describe("The log level that will gets delivered to the consumer.");
|
|
396
|
-
var OnLogDefaultSchema = z15.union([
|
|
397
|
-
FunctionSchema.transform((consumer) => ({
|
|
398
|
-
consumer,
|
|
399
|
-
filter: ["error", "fatal"]
|
|
400
|
-
})),
|
|
401
|
-
z15.object({
|
|
402
|
-
consumer: FunctionSchema,
|
|
403
|
-
filter: FilterSchema
|
|
404
|
-
})
|
|
405
|
-
]).optional().describe("Define a subscription on all Lambda functions logs.");
|
|
406
|
-
|
|
407
398
|
// src/feature/pubsub/schema.ts
|
|
408
|
-
import { z as
|
|
399
|
+
import { z as z15 } from "zod";
|
|
409
400
|
var DomainSchema = ResourceIdSchema.describe("The domain id to link your Pubsub API with.");
|
|
410
|
-
var PubSubDefaultSchema =
|
|
401
|
+
var PubSubDefaultSchema = z15.record(
|
|
411
402
|
ResourceIdSchema,
|
|
412
|
-
|
|
403
|
+
z15.object({
|
|
413
404
|
auth: FunctionSchema,
|
|
414
405
|
domain: DomainSchema.optional(),
|
|
415
|
-
subDomain:
|
|
406
|
+
subDomain: z15.string().optional()
|
|
416
407
|
// auth: z.union([
|
|
417
408
|
// ResourceIdSchema,
|
|
418
409
|
// z.object({
|
|
@@ -428,14 +419,14 @@ var PubSubDefaultSchema = z16.record(
|
|
|
428
419
|
// .optional(),
|
|
429
420
|
})
|
|
430
421
|
).optional().describe("Define the pubsub subscriber in your stack.");
|
|
431
|
-
var RetryAttemptsSchema =
|
|
422
|
+
var RetryAttemptsSchema = z15.number().int().min(0).max(2).describe(
|
|
432
423
|
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
|
|
433
424
|
);
|
|
434
|
-
var PubSubSchema =
|
|
425
|
+
var PubSubSchema = z15.record(
|
|
435
426
|
ResourceIdSchema,
|
|
436
|
-
|
|
437
|
-
sql:
|
|
438
|
-
sqlVersion:
|
|
427
|
+
z15.object({
|
|
428
|
+
sql: z15.string().describe("The SQL statement used to query the IOT topic."),
|
|
429
|
+
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."),
|
|
439
430
|
consumer: FunctionSchema.describe("The consuming lambda function properties."),
|
|
440
431
|
retryAttempts: RetryAttemptsSchema.default(2)
|
|
441
432
|
})
|
|
@@ -444,7 +435,7 @@ var PubSubSchema = z16.record(
|
|
|
444
435
|
// src/feature/queue/schema.ts
|
|
445
436
|
import { days as days2, hours, minutes as minutes2, seconds as seconds2 } from "@awsless/duration";
|
|
446
437
|
import { kibibytes } from "@awsless/size";
|
|
447
|
-
import { z as
|
|
438
|
+
import { z as z16 } from "zod";
|
|
448
439
|
var RetentionPeriodSchema = DurationSchema.refine(
|
|
449
440
|
durationMin(minutes2(1)),
|
|
450
441
|
"Minimum retention period is 1 minute"
|
|
@@ -472,10 +463,10 @@ var ReceiveMessageWaitTimeSchema = DurationSchema.refine(
|
|
|
472
463
|
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(
|
|
473
464
|
"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."
|
|
474
465
|
);
|
|
475
|
-
var BatchSizeSchema =
|
|
466
|
+
var BatchSizeSchema = z16.number().int().min(1, "Minimum batch size is 1").max(1e4, "Maximum batch size is 10000").describe(
|
|
476
467
|
"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."
|
|
477
468
|
);
|
|
478
|
-
var MaxConcurrencySchema =
|
|
469
|
+
var MaxConcurrencySchema = z16.number().int().min(2, "Minimum max concurrency is 2").max(1e3, "Maximum max concurrency is 1000").describe(
|
|
479
470
|
"Limits the number of concurrent instances that the queue worker can invoke. You can specify an integer from 2 to 1000."
|
|
480
471
|
);
|
|
481
472
|
var MaxBatchingWindow = DurationSchema.refine(
|
|
@@ -484,10 +475,10 @@ var MaxBatchingWindow = DurationSchema.refine(
|
|
|
484
475
|
).describe(
|
|
485
476
|
"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."
|
|
486
477
|
);
|
|
487
|
-
var RetryAttemptsSchema2 =
|
|
478
|
+
var RetryAttemptsSchema2 = z16.number().int().min(0).max(999).describe(
|
|
488
479
|
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 999."
|
|
489
480
|
);
|
|
490
|
-
var QueueDefaultSchema =
|
|
481
|
+
var QueueDefaultSchema = z16.object({
|
|
491
482
|
retentionPeriod: RetentionPeriodSchema.default("7 days"),
|
|
492
483
|
visibilityTimeout: VisibilityTimeoutSchema.default("30 seconds"),
|
|
493
484
|
deliveryDelay: DeliveryDelaySchema.default("0 seconds"),
|
|
@@ -498,7 +489,7 @@ var QueueDefaultSchema = z17.object({
|
|
|
498
489
|
maxBatchingWindow: MaxBatchingWindow.optional(),
|
|
499
490
|
retryAttempts: RetryAttemptsSchema2.default(2)
|
|
500
491
|
}).default({});
|
|
501
|
-
var QueueSchema =
|
|
492
|
+
var QueueSchema = z16.object({
|
|
502
493
|
consumer: FunctionSchema.optional().describe("The consuming lambda function properties."),
|
|
503
494
|
retentionPeriod: RetentionPeriodSchema.optional(),
|
|
504
495
|
visibilityTimeout: VisibilityTimeoutSchema.optional(),
|
|
@@ -510,9 +501,9 @@ var QueueSchema = z17.object({
|
|
|
510
501
|
maxBatchingWindow: MaxBatchingWindow.optional(),
|
|
511
502
|
retryAttempts: RetryAttemptsSchema2.optional()
|
|
512
503
|
});
|
|
513
|
-
var QueuesSchema =
|
|
504
|
+
var QueuesSchema = z16.record(
|
|
514
505
|
ResourceIdSchema,
|
|
515
|
-
|
|
506
|
+
z16.union([
|
|
516
507
|
LocalFileSchema.transform((consumer) => ({
|
|
517
508
|
consumer
|
|
518
509
|
})).pipe(QueueSchema),
|
|
@@ -521,26 +512,26 @@ var QueuesSchema = z17.record(
|
|
|
521
512
|
).optional().describe("Define the queues in your stack.");
|
|
522
513
|
|
|
523
514
|
// src/feature/rest/schema.ts
|
|
524
|
-
import { z as
|
|
515
|
+
import { z as z18 } from "zod";
|
|
525
516
|
|
|
526
517
|
// src/config/schema/route.ts
|
|
527
|
-
import { z as
|
|
528
|
-
var RouteSchema =
|
|
529
|
-
|
|
530
|
-
|
|
518
|
+
import { z as z17 } from "zod";
|
|
519
|
+
var RouteSchema = z17.union([
|
|
520
|
+
z17.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS|ANY)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route"),
|
|
521
|
+
z17.literal("$default")
|
|
531
522
|
]);
|
|
532
523
|
|
|
533
524
|
// src/feature/rest/schema.ts
|
|
534
|
-
var RestDefaultSchema =
|
|
525
|
+
var RestDefaultSchema = z18.record(
|
|
535
526
|
ResourceIdSchema,
|
|
536
|
-
|
|
527
|
+
z18.object({
|
|
537
528
|
domain: ResourceIdSchema.describe("The domain id to link your API with.").optional(),
|
|
538
|
-
subDomain:
|
|
529
|
+
subDomain: z18.string().optional()
|
|
539
530
|
})
|
|
540
531
|
).optional().describe("Define your global REST API's.");
|
|
541
|
-
var RestSchema =
|
|
532
|
+
var RestSchema = z18.record(
|
|
542
533
|
ResourceIdSchema,
|
|
543
|
-
|
|
534
|
+
z18.record(
|
|
544
535
|
RouteSchema.describe(
|
|
545
536
|
[
|
|
546
537
|
"The REST API route that is comprised by the http method and http path.",
|
|
@@ -554,19 +545,19 @@ var RestSchema = z19.record(
|
|
|
554
545
|
|
|
555
546
|
// src/feature/rpc/schema.ts
|
|
556
547
|
import { minutes as minutes4, seconds as seconds3 } from "@awsless/duration";
|
|
557
|
-
import { z as
|
|
548
|
+
import { z as z20 } from "zod";
|
|
558
549
|
|
|
559
550
|
// src/feature/router/schema.ts
|
|
560
551
|
import { days as days3, minutes as minutes3, parse as parse3 } from "@awsless/duration";
|
|
561
|
-
import { z as
|
|
562
|
-
var ErrorResponsePathSchema =
|
|
552
|
+
import { z as z19 } from "zod";
|
|
553
|
+
var ErrorResponsePathSchema = z19.string().describe(
|
|
563
554
|
[
|
|
564
555
|
"The path to the custom error page that you want to return to the viewer when your origin returns the HTTP status code specified.",
|
|
565
556
|
"- We recommend that you store custom error pages in an Amazon S3 bucket.",
|
|
566
557
|
"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."
|
|
567
558
|
].join("\n")
|
|
568
559
|
);
|
|
569
|
-
var StatusCodeSchema =
|
|
560
|
+
var StatusCodeSchema = z19.number().int().positive().optional().describe(
|
|
570
561
|
[
|
|
571
562
|
"The HTTP status code that you want CloudFront to return to the viewer along with the custom error page.",
|
|
572
563
|
"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:",
|
|
@@ -579,26 +570,26 @@ var StatusCodeSchema = z20.number().int().positive().optional().describe(
|
|
|
579
570
|
var MinTTLSchema = DurationSchema.describe(
|
|
580
571
|
"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."
|
|
581
572
|
);
|
|
582
|
-
var ErrorResponseSchema =
|
|
573
|
+
var ErrorResponseSchema = z19.union([
|
|
583
574
|
ErrorResponsePathSchema,
|
|
584
|
-
|
|
575
|
+
z19.object({
|
|
585
576
|
path: ErrorResponsePathSchema,
|
|
586
577
|
statusCode: StatusCodeSchema.optional(),
|
|
587
578
|
minTTL: MinTTLSchema.optional()
|
|
588
579
|
})
|
|
589
580
|
]).optional();
|
|
590
|
-
var RouteSchema2 =
|
|
591
|
-
var VisibilitySchema =
|
|
592
|
-
var WafSettingsSchema =
|
|
593
|
-
rateLimiter:
|
|
594
|
-
limit:
|
|
581
|
+
var RouteSchema2 = z19.string().regex(/^\//, "Route must start with a slash (/)");
|
|
582
|
+
var VisibilitySchema = z19.boolean().default(false).describe("Whether to enable CloudWatch metrics for the WAF rule.");
|
|
583
|
+
var WafSettingsSchema = z19.object({
|
|
584
|
+
rateLimiter: z19.object({
|
|
585
|
+
limit: z19.number().min(10).max(2e9).default(10).describe(
|
|
595
586
|
"The limit on requests during the specified evaluation window for a single aggregation instance for the rate-based rule."
|
|
596
587
|
),
|
|
597
|
-
window:
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
588
|
+
window: z19.union([
|
|
589
|
+
z19.literal("1 minute"),
|
|
590
|
+
z19.literal("2 minutes"),
|
|
591
|
+
z19.literal("5 minutes"),
|
|
592
|
+
z19.literal("10 minutes")
|
|
602
593
|
]).default("5 minutes").transform((v) => parse3(v)).describe(
|
|
603
594
|
"The amount of time, in seconds, that AWS WAF should include in its request counts, looking back from the current time."
|
|
604
595
|
),
|
|
@@ -606,18 +597,18 @@ var WafSettingsSchema = z20.object({
|
|
|
606
597
|
}).optional().describe(
|
|
607
598
|
"A rate-based rule counts incoming requests and rate limits requests when they are coming at too fast a rate."
|
|
608
599
|
),
|
|
609
|
-
ddosProtection:
|
|
610
|
-
sensitivity:
|
|
611
|
-
challenge:
|
|
612
|
-
block:
|
|
600
|
+
ddosProtection: z19.object({
|
|
601
|
+
sensitivity: z19.object({
|
|
602
|
+
challenge: z19.enum(["low", "medium", "high"]).default("low").transform((v) => v.toUpperCase()).describe("The sensitivity level for challenge requests."),
|
|
603
|
+
block: z19.enum(["low", "medium", "high"]).default("low").transform((v) => v.toUpperCase()).describe("The sensitivity level for block requests.")
|
|
613
604
|
}),
|
|
614
|
-
exemptUriRegex:
|
|
605
|
+
exemptUriRegex: z19.string().default("^$"),
|
|
615
606
|
visibility: VisibilitySchema
|
|
616
607
|
}).optional().describe(
|
|
617
608
|
"Provides protection against DDoS attacks targeting the application layer, also known as Layer 7 attacks. Uses 50 WCU."
|
|
618
609
|
),
|
|
619
|
-
botProtection:
|
|
620
|
-
inspectionLevel:
|
|
610
|
+
botProtection: z19.object({
|
|
611
|
+
inspectionLevel: z19.enum(["common", "targeted"]).default("common").transform((v) => v.toUpperCase()),
|
|
621
612
|
visibility: VisibilitySchema
|
|
622
613
|
}).optional().describe(
|
|
623
614
|
"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."
|
|
@@ -631,14 +622,14 @@ var WafSettingsSchema = z20.object({
|
|
|
631
622
|
}).describe(
|
|
632
623
|
"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."
|
|
633
624
|
);
|
|
634
|
-
var RouterDefaultSchema =
|
|
625
|
+
var RouterDefaultSchema = z19.record(
|
|
635
626
|
ResourceIdSchema,
|
|
636
|
-
|
|
627
|
+
z19.object({
|
|
637
628
|
domain: ResourceIdSchema.describe("The domain id to link your Router.").optional(),
|
|
638
|
-
subDomain:
|
|
629
|
+
subDomain: z19.string().optional(),
|
|
639
630
|
waf: WafSettingsSchema.optional(),
|
|
640
|
-
geoRestrictions:
|
|
641
|
-
errors:
|
|
631
|
+
geoRestrictions: z19.array(z19.string().length(2).toUpperCase()).default([]).describe("Specifies a blacklist of countries that should be blocked."),
|
|
632
|
+
errors: z19.object({
|
|
642
633
|
400: ErrorResponseSchema.describe("Customize a `400 Bad Request` response."),
|
|
643
634
|
403: ErrorResponseSchema.describe("Customize a `403 Forbidden` response."),
|
|
644
635
|
404: ErrorResponseSchema.describe("Customize a `404 Not Found` response."),
|
|
@@ -651,21 +642,21 @@ var RouterDefaultSchema = z20.record(
|
|
|
651
642
|
503: ErrorResponseSchema.describe("Customize a `503 Service Unavailable` response."),
|
|
652
643
|
504: ErrorResponseSchema.describe("Customize a `504 Gateway Timeout` response.")
|
|
653
644
|
}).optional().describe("Customize the error responses for specific HTTP status codes."),
|
|
654
|
-
cors:
|
|
655
|
-
override:
|
|
645
|
+
cors: z19.object({
|
|
646
|
+
override: z19.boolean().default(false),
|
|
656
647
|
maxAge: DurationSchema.default("365 days"),
|
|
657
|
-
exposeHeaders:
|
|
658
|
-
credentials:
|
|
659
|
-
headers:
|
|
660
|
-
origins:
|
|
661
|
-
methods:
|
|
648
|
+
exposeHeaders: z19.string().array().optional(),
|
|
649
|
+
credentials: z19.boolean().default(false),
|
|
650
|
+
headers: z19.string().array().default(["*"]),
|
|
651
|
+
origins: z19.string().array().default(["*"]),
|
|
652
|
+
methods: z19.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
|
|
662
653
|
}).optional().describe("Specify the cors headers."),
|
|
663
|
-
passwordAuth:
|
|
664
|
-
password:
|
|
654
|
+
passwordAuth: z19.object({
|
|
655
|
+
password: z19.string().describe("Password.")
|
|
665
656
|
}).optional().describe("Enable password authentication for the router."),
|
|
666
|
-
basicAuth:
|
|
667
|
-
username:
|
|
668
|
-
password:
|
|
657
|
+
basicAuth: z19.object({
|
|
658
|
+
username: z19.string().describe("Basic auth username."),
|
|
659
|
+
password: z19.string().describe("Basic auth password.")
|
|
669
660
|
}).optional().describe("Enable basic authentication for the router."),
|
|
670
661
|
// security: z
|
|
671
662
|
// .object({
|
|
@@ -712,10 +703,10 @@ var RouterDefaultSchema = z20.record(
|
|
|
712
703
|
// })
|
|
713
704
|
// .optional()
|
|
714
705
|
// .describe('Specify the security policy.'),
|
|
715
|
-
cache:
|
|
716
|
-
cookies:
|
|
717
|
-
headers:
|
|
718
|
-
queries:
|
|
706
|
+
cache: z19.object({
|
|
707
|
+
cookies: z19.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
|
|
708
|
+
headers: z19.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
|
|
709
|
+
queries: z19.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
|
|
719
710
|
}).optional().describe(
|
|
720
711
|
"Specifies the cookies, headers, and query values that CloudFront includes in the cache key."
|
|
721
712
|
)
|
|
@@ -730,9 +721,9 @@ var TimeoutSchema2 = DurationSchema.refine(durationMin(seconds3(10)), "Minimum t
|
|
|
730
721
|
"The timeouts of all inner RPC functions will be capped at 80% of this timeout."
|
|
731
722
|
].join(" ")
|
|
732
723
|
);
|
|
733
|
-
var RpcDefaultSchema =
|
|
724
|
+
var RpcDefaultSchema = z20.record(
|
|
734
725
|
ResourceIdSchema,
|
|
735
|
-
|
|
726
|
+
z20.object({
|
|
736
727
|
// domain: ResourceIdSchema.describe('The domain id to link your RPC API with.').optional(),
|
|
737
728
|
// subDomain: z.string().optional(),
|
|
738
729
|
//
|
|
@@ -743,18 +734,18 @@ var RpcDefaultSchema = z21.record(
|
|
|
743
734
|
timeout: TimeoutSchema2.default("1 minutes")
|
|
744
735
|
})
|
|
745
736
|
).describe(`Define the global RPC API's.`).optional();
|
|
746
|
-
var RpcSchema =
|
|
737
|
+
var RpcSchema = z20.record(
|
|
747
738
|
ResourceIdSchema,
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
739
|
+
z20.record(
|
|
740
|
+
z20.string(),
|
|
741
|
+
z20.union([
|
|
751
742
|
FunctionSchema.transform((f) => ({
|
|
752
743
|
function: f,
|
|
753
744
|
lock: false
|
|
754
745
|
})),
|
|
755
|
-
|
|
746
|
+
z20.object({
|
|
756
747
|
function: FunctionSchema.describe("The RPC function to execute."),
|
|
757
|
-
lock:
|
|
748
|
+
lock: z20.boolean().describe(
|
|
758
749
|
[
|
|
759
750
|
"Specify if the function should be locked on the `lockKey` returned from the auth function.",
|
|
760
751
|
"An example would be returning the user ID as `lockKey`."
|
|
@@ -768,8 +759,8 @@ var RpcSchema = z21.record(
|
|
|
768
759
|
// src/feature/instance/schema.ts
|
|
769
760
|
import { days as days4, toDays as toDays2 } from "@awsless/duration";
|
|
770
761
|
import { toMebibytes } from "@awsless/size";
|
|
771
|
-
import { z as
|
|
772
|
-
var CpuSchema =
|
|
762
|
+
import { z as z21 } from "zod";
|
|
763
|
+
var CpuSchema = z21.union([z21.literal(0.25), z21.literal(0.5), z21.literal(1), z21.literal(2), z21.literal(4), z21.literal(8), z21.literal(16)]).transform((v) => `${v} vCPU`).describe(
|
|
773
764
|
"The number of virtual CPU units (vCPU) used by the instance. Valid values: 0.25, 0.5, 1, 2, 4, 8, 16 vCPU."
|
|
774
765
|
);
|
|
775
766
|
var validMemorySize = [
|
|
@@ -809,10 +800,10 @@ var MemorySizeSchema2 = SizeSchema.refine(
|
|
|
809
800
|
(s) => validMemorySize.includes(toMebibytes(s)),
|
|
810
801
|
`Invalid memory size. Allowed sizes: ${validMemorySize.join(", ")} MiB`
|
|
811
802
|
).describe("The amount of memory (in MiB) used by the instance. Valid memory values depend on the CPU configuration.");
|
|
812
|
-
var HealthCheckSchema =
|
|
813
|
-
path:
|
|
803
|
+
var HealthCheckSchema = z21.object({
|
|
804
|
+
path: z21.string().describe("The path that the container runs to determine if it is healthy."),
|
|
814
805
|
interval: DurationSchema.describe("The time period in seconds between each health check execution."),
|
|
815
|
-
retries:
|
|
806
|
+
retries: z21.number().int().min(1).max(10).describe(
|
|
816
807
|
"The number of times to retry a failed health check before the container is considered unhealthy."
|
|
817
808
|
),
|
|
818
809
|
startPeriod: DurationSchema.describe(
|
|
@@ -822,22 +813,22 @@ var HealthCheckSchema = z22.object({
|
|
|
822
813
|
"The time period in seconds to wait for a health check to succeed before it is considered a failure."
|
|
823
814
|
)
|
|
824
815
|
}).describe("The health check command and associated configuration parameters for the container.");
|
|
825
|
-
var EnvironmentSchema2 =
|
|
826
|
-
var ArchitectureSchema3 =
|
|
827
|
-
var ActionSchema2 =
|
|
828
|
-
var ActionsSchema2 =
|
|
829
|
-
var ArnSchema2 =
|
|
830
|
-
var WildcardSchema2 =
|
|
831
|
-
var ResourceSchema2 =
|
|
832
|
-
var ResourcesSchema2 =
|
|
833
|
-
var PermissionSchema2 =
|
|
834
|
-
effect:
|
|
816
|
+
var EnvironmentSchema2 = z21.record(z21.string(), z21.string()).optional().describe("Environment variable key-value pairs.");
|
|
817
|
+
var ArchitectureSchema3 = z21.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the instance supports.");
|
|
818
|
+
var ActionSchema2 = z21.string();
|
|
819
|
+
var ActionsSchema2 = z21.union([ActionSchema2.transform((v) => [v]), ActionSchema2.array()]);
|
|
820
|
+
var ArnSchema2 = z21.string().startsWith("arn:");
|
|
821
|
+
var WildcardSchema2 = z21.literal("*");
|
|
822
|
+
var ResourceSchema2 = z21.union([ArnSchema2, WildcardSchema2]);
|
|
823
|
+
var ResourcesSchema2 = z21.union([ResourceSchema2.transform((v) => [v]), ResourceSchema2.array()]);
|
|
824
|
+
var PermissionSchema2 = z21.object({
|
|
825
|
+
effect: z21.enum(["allow", "deny"]).default("allow"),
|
|
835
826
|
actions: ActionsSchema2,
|
|
836
827
|
resources: ResourcesSchema2
|
|
837
828
|
});
|
|
838
|
-
var PermissionsSchema2 =
|
|
839
|
-
var DescriptionSchema2 =
|
|
840
|
-
var ImageSchema =
|
|
829
|
+
var PermissionsSchema2 = z21.union([PermissionSchema2.transform((v) => [v]), PermissionSchema2.array()]).describe("Add IAM permissions to your instance.");
|
|
830
|
+
var DescriptionSchema2 = z21.string().describe("A description of the instance.");
|
|
831
|
+
var ImageSchema = z21.string().optional().describe("The URL of the container image to use.");
|
|
841
832
|
var validLogRetentionDays2 = [
|
|
842
833
|
...[1, 3, 5, 7, 14, 30, 60, 90, 120, 150],
|
|
843
834
|
...[180, 365, 400, 545, 731, 1096, 1827, 2192],
|
|
@@ -852,23 +843,23 @@ var LogRetentionSchema2 = DurationSchema.refine(
|
|
|
852
843
|
},
|
|
853
844
|
`Invalid log retention. Valid days are: ${validLogRetentionDays2.map((days5) => `${days5}`).join(", ")}`
|
|
854
845
|
).describe("The log retention duration.");
|
|
855
|
-
var LogSchema2 =
|
|
856
|
-
|
|
846
|
+
var LogSchema2 = z21.union([
|
|
847
|
+
z21.boolean().transform((enabled) => ({ retention: enabled ? days4(7) : days4(0) })),
|
|
857
848
|
LogRetentionSchema2.transform((retention) => ({ retention })),
|
|
858
|
-
|
|
849
|
+
z21.object({
|
|
859
850
|
retention: LogRetentionSchema2.optional()
|
|
860
851
|
})
|
|
861
852
|
]).describe("Enable logging to a CloudWatch log group. Providing a duration value will set the log retention time.");
|
|
862
|
-
var FileCodeSchema2 =
|
|
853
|
+
var FileCodeSchema2 = z21.object({
|
|
863
854
|
file: LocalFileSchema.describe("The file path of the instance code.")
|
|
864
855
|
});
|
|
865
|
-
var CodeSchema2 =
|
|
856
|
+
var CodeSchema2 = z21.union([
|
|
866
857
|
LocalFileSchema.transform((file) => ({
|
|
867
858
|
file
|
|
868
859
|
})).pipe(FileCodeSchema2),
|
|
869
860
|
FileCodeSchema2
|
|
870
861
|
]).describe("Specify the code of your instance.");
|
|
871
|
-
var ISchema =
|
|
862
|
+
var ISchema = z21.object({
|
|
872
863
|
code: CodeSchema2,
|
|
873
864
|
description: DescriptionSchema2.optional(),
|
|
874
865
|
image: ImageSchema.optional(),
|
|
@@ -881,14 +872,14 @@ var ISchema = z22.object({
|
|
|
881
872
|
healthCheck: HealthCheckSchema.optional()
|
|
882
873
|
// restartPolicy: RestartPolicySchema.optional(),
|
|
883
874
|
});
|
|
884
|
-
var InstanceSchema =
|
|
875
|
+
var InstanceSchema = z21.union([
|
|
885
876
|
LocalFileSchema.transform((code) => ({
|
|
886
877
|
code
|
|
887
878
|
})).pipe(ISchema),
|
|
888
879
|
ISchema
|
|
889
880
|
]);
|
|
890
|
-
var InstancesSchema =
|
|
891
|
-
var InstanceDefaultSchema =
|
|
881
|
+
var InstancesSchema = z21.record(ResourceIdSchema, InstanceSchema).optional().describe("Define the instances in your stack.");
|
|
882
|
+
var InstanceDefaultSchema = z21.object({
|
|
892
883
|
image: ImageSchema.optional(),
|
|
893
884
|
cpu: CpuSchema.default(0.25),
|
|
894
885
|
memorySize: MemorySizeSchema2.default("512 MB"),
|
|
@@ -904,34 +895,34 @@ var InstanceDefaultSchema = z22.object({
|
|
|
904
895
|
|
|
905
896
|
// src/feature/topic/schema.ts
|
|
906
897
|
import { kebabCase as kebabCase3 } from "change-case";
|
|
907
|
-
import { z as
|
|
898
|
+
import { z as z23 } from "zod";
|
|
908
899
|
|
|
909
900
|
// src/feature/task/schema.ts
|
|
910
|
-
import { z as
|
|
911
|
-
var RetryAttemptsSchema3 =
|
|
901
|
+
import { z as z22 } from "zod";
|
|
902
|
+
var RetryAttemptsSchema3 = z22.number().int().min(0).max(2).describe(
|
|
912
903
|
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
|
|
913
904
|
);
|
|
914
|
-
var TaskSchema =
|
|
905
|
+
var TaskSchema = z22.union([
|
|
915
906
|
FunctionSchema.transform((consumer) => ({
|
|
916
907
|
consumer,
|
|
917
908
|
retryAttempts: 2
|
|
918
909
|
})),
|
|
919
|
-
|
|
910
|
+
z22.object({
|
|
920
911
|
consumer: FunctionSchema,
|
|
921
912
|
retryAttempts: RetryAttemptsSchema3.default(2)
|
|
922
913
|
})
|
|
923
914
|
]);
|
|
924
|
-
var TasksSchema =
|
|
915
|
+
var TasksSchema = z22.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
|
|
925
916
|
|
|
926
917
|
// src/feature/topic/schema.ts
|
|
927
|
-
var TopicNameSchema =
|
|
928
|
-
var TopicsDefaultSchema =
|
|
918
|
+
var TopicNameSchema = z23.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => kebabCase3(value)).describe("Define event topic name.");
|
|
919
|
+
var TopicsDefaultSchema = z23.array(TopicNameSchema).refine((topics) => {
|
|
929
920
|
return topics.length === new Set(topics).size;
|
|
930
921
|
}, "Must be a list of unique topic names").optional().describe("Define the event topics for your app.");
|
|
931
|
-
var SubscribersSchema =
|
|
922
|
+
var SubscribersSchema = z23.record(TopicNameSchema, TaskSchema).optional().describe("Define the event topics to subscribe too in your stack.");
|
|
932
923
|
|
|
933
924
|
// src/config/schema/region.ts
|
|
934
|
-
import { z as
|
|
925
|
+
import { z as z24 } from "zod";
|
|
935
926
|
var US = ["us-east-2", "us-east-1", "us-west-1", "us-west-2"];
|
|
936
927
|
var AF = ["af-south-1"];
|
|
937
928
|
var AP = [
|
|
@@ -960,16 +951,16 @@ var EU = [
|
|
|
960
951
|
var ME = ["me-south-1", "me-central-1"];
|
|
961
952
|
var SA = ["sa-east-1"];
|
|
962
953
|
var regions = [...US, ...AF, ...AP, ...CA, ...EU, ...ME, ...SA];
|
|
963
|
-
var RegionSchema =
|
|
954
|
+
var RegionSchema = z24.enum(regions);
|
|
964
955
|
|
|
965
956
|
// src/config/app.ts
|
|
966
|
-
var AppSchema =
|
|
967
|
-
$schema:
|
|
957
|
+
var AppSchema = z25.object({
|
|
958
|
+
$schema: z25.string().optional(),
|
|
968
959
|
name: ResourceIdSchema.describe("App name."),
|
|
969
960
|
region: RegionSchema.describe("The AWS region to deploy to."),
|
|
970
|
-
profile:
|
|
971
|
-
protect:
|
|
972
|
-
removal:
|
|
961
|
+
profile: z25.string().describe("The AWS profile to deploy to."),
|
|
962
|
+
protect: z25.boolean().default(false).describe("Protect your app & stacks from being deleted."),
|
|
963
|
+
removal: z25.enum(["remove", "retain"]).default("remove").describe(
|
|
973
964
|
[
|
|
974
965
|
"Configure how your resources are handled when they have to be removed.",
|
|
975
966
|
"",
|
|
@@ -983,9 +974,9 @@ var AppSchema = z26.object({
|
|
|
983
974
|
// .default('prod')
|
|
984
975
|
// .describe('The deployment stage.'),
|
|
985
976
|
// onFailure: OnFailureSchema,
|
|
986
|
-
defaults:
|
|
977
|
+
defaults: z25.object({
|
|
987
978
|
onFailure: OnFailureDefaultSchema,
|
|
988
|
-
|
|
979
|
+
onErrorLog: OnErrorLogDefaultSchema,
|
|
989
980
|
auth: AuthDefaultSchema,
|
|
990
981
|
domains: DomainsDefaultSchema,
|
|
991
982
|
function: FunctionDefaultSchema,
|
|
@@ -1260,11 +1251,11 @@ var createStagePatchJsonSchema = (baseSchema, title) => {
|
|
|
1260
1251
|
};
|
|
1261
1252
|
|
|
1262
1253
|
// src/config/stack.ts
|
|
1263
|
-
import { z as
|
|
1254
|
+
import { z as z40 } from "zod";
|
|
1264
1255
|
|
|
1265
1256
|
// src/feature/cache/schema.ts
|
|
1266
1257
|
import { gibibytes as gibibytes2 } from "@awsless/size";
|
|
1267
|
-
import { z as
|
|
1258
|
+
import { z as z26 } from "zod";
|
|
1268
1259
|
var StorageSchema = SizeSchema.refine(sizeMin(gibibytes2(1)), "Minimum storage size is 1 GB").refine(
|
|
1269
1260
|
sizeMax(gibibytes2(5e3)),
|
|
1270
1261
|
"Maximum storage size is 5000 GB"
|
|
@@ -1275,31 +1266,31 @@ var MinimumStorageSchema = StorageSchema.describe(
|
|
|
1275
1266
|
var MaximumStorageSchema = StorageSchema.describe(
|
|
1276
1267
|
"The upper limit for data storage the cache is set to use. You can specify a size value from 1 GB to 5000 GB."
|
|
1277
1268
|
);
|
|
1278
|
-
var EcpuSchema =
|
|
1269
|
+
var EcpuSchema = z26.number().int().min(1e3).max(15e6);
|
|
1279
1270
|
var MinimumEcpuSchema = EcpuSchema.describe(
|
|
1280
1271
|
"The minimum number of ECPUs the cache can consume per second. You can specify a integer from 1,000 to 15,000,000."
|
|
1281
1272
|
);
|
|
1282
1273
|
var MaximumEcpuSchema = EcpuSchema.describe(
|
|
1283
1274
|
"The maximum number of ECPUs the cache can consume per second. You can specify a integer from 1,000 to 15,000,000."
|
|
1284
1275
|
);
|
|
1285
|
-
var CachesSchema =
|
|
1276
|
+
var CachesSchema = z26.record(
|
|
1286
1277
|
ResourceIdSchema,
|
|
1287
|
-
|
|
1278
|
+
z26.object({
|
|
1288
1279
|
minStorage: MinimumStorageSchema.optional(),
|
|
1289
1280
|
maxStorage: MaximumStorageSchema.optional(),
|
|
1290
1281
|
minECPU: MinimumEcpuSchema.optional(),
|
|
1291
1282
|
maxECPU: MaximumEcpuSchema.optional(),
|
|
1292
|
-
snapshotRetentionLimit:
|
|
1283
|
+
snapshotRetentionLimit: z26.number().int().positive().default(1)
|
|
1293
1284
|
})
|
|
1294
1285
|
).optional().describe("Define the caches in your stack. For access to the cache put your functions inside the global VPC.");
|
|
1295
1286
|
|
|
1296
1287
|
// src/feature/command/schema.ts
|
|
1297
|
-
import { z as
|
|
1298
|
-
var CommandSchema =
|
|
1299
|
-
|
|
1288
|
+
import { z as z27 } from "zod";
|
|
1289
|
+
var CommandSchema = z27.union([
|
|
1290
|
+
z27.object({
|
|
1300
1291
|
file: LocalFileSchema,
|
|
1301
|
-
handler:
|
|
1302
|
-
description:
|
|
1292
|
+
handler: z27.string().default("default").describe("The name of the handler that needs to run"),
|
|
1293
|
+
description: z27.string().optional().describe("A description of the command")
|
|
1303
1294
|
// options: z.record(ResourceIdSchema, OptionSchema).optional(),
|
|
1304
1295
|
// arguments: z.record(ResourceIdSchema, ArgumentSchema).optional(),
|
|
1305
1296
|
}),
|
|
@@ -1309,22 +1300,22 @@ var CommandSchema = z28.union([
|
|
|
1309
1300
|
description: void 0
|
|
1310
1301
|
}))
|
|
1311
1302
|
]);
|
|
1312
|
-
var CommandsSchema =
|
|
1303
|
+
var CommandsSchema = z27.record(ResourceIdSchema, CommandSchema).optional().describe("Define the custom commands for your stack.");
|
|
1313
1304
|
|
|
1314
1305
|
// src/feature/config/schema.ts
|
|
1315
|
-
import { z as
|
|
1316
|
-
var ConfigNameSchema =
|
|
1317
|
-
var ConfigsSchema =
|
|
1306
|
+
import { z as z28 } from "zod";
|
|
1307
|
+
var ConfigNameSchema = z28.string().regex(/[a-z0-9\-]/g, "Invalid config name");
|
|
1308
|
+
var ConfigsSchema = z28.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
|
|
1318
1309
|
|
|
1319
1310
|
// src/feature/cron/schema/index.ts
|
|
1320
|
-
import { z as
|
|
1311
|
+
import { z as z30 } from "zod";
|
|
1321
1312
|
|
|
1322
1313
|
// src/feature/cron/schema/schedule.ts
|
|
1323
|
-
import { z as
|
|
1314
|
+
import { z as z29 } from "zod";
|
|
1324
1315
|
import { awsCronExpressionValidator } from "aws-cron-expression-validator";
|
|
1325
|
-
var RateExpressionSchema =
|
|
1316
|
+
var RateExpressionSchema = z29.custom(
|
|
1326
1317
|
(value) => {
|
|
1327
|
-
return
|
|
1318
|
+
return z29.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
|
|
1328
1319
|
const [str] = rate.split(" ");
|
|
1329
1320
|
const number = parseInt(str);
|
|
1330
1321
|
return number > 0;
|
|
@@ -1340,9 +1331,9 @@ var RateExpressionSchema = z30.custom(
|
|
|
1340
1331
|
}
|
|
1341
1332
|
return `rate(${rate})`;
|
|
1342
1333
|
});
|
|
1343
|
-
var CronExpressionSchema =
|
|
1334
|
+
var CronExpressionSchema = z29.custom(
|
|
1344
1335
|
(value) => {
|
|
1345
|
-
return
|
|
1336
|
+
return z29.string().safeParse(value).success;
|
|
1346
1337
|
},
|
|
1347
1338
|
{ message: "Invalid cron expression" }
|
|
1348
1339
|
).superRefine((value, ctx) => {
|
|
@@ -1351,12 +1342,12 @@ var CronExpressionSchema = z30.custom(
|
|
|
1351
1342
|
} catch (error) {
|
|
1352
1343
|
if (error instanceof Error) {
|
|
1353
1344
|
ctx.addIssue({
|
|
1354
|
-
code:
|
|
1345
|
+
code: z29.ZodIssueCode.custom,
|
|
1355
1346
|
message: `Invalid cron expression: ${error.message}`
|
|
1356
1347
|
});
|
|
1357
1348
|
} else {
|
|
1358
1349
|
ctx.addIssue({
|
|
1359
|
-
code:
|
|
1350
|
+
code: z29.ZodIssueCode.custom,
|
|
1360
1351
|
message: "Invalid cron expression"
|
|
1361
1352
|
});
|
|
1362
1353
|
}
|
|
@@ -1367,32 +1358,32 @@ var CronExpressionSchema = z30.custom(
|
|
|
1367
1358
|
var ScheduleExpressionSchema = RateExpressionSchema.or(CronExpressionSchema);
|
|
1368
1359
|
|
|
1369
1360
|
// src/feature/cron/schema/index.ts
|
|
1370
|
-
var RetryAttemptsSchema4 =
|
|
1361
|
+
var RetryAttemptsSchema4 = z30.number().int().min(0).max(2).describe(
|
|
1371
1362
|
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
|
|
1372
1363
|
);
|
|
1373
|
-
var CronsSchema =
|
|
1364
|
+
var CronsSchema = z30.record(
|
|
1374
1365
|
ResourceIdSchema,
|
|
1375
|
-
|
|
1376
|
-
enabled:
|
|
1366
|
+
z30.object({
|
|
1367
|
+
enabled: z30.boolean().default(true).describe("If the cron is enabled."),
|
|
1377
1368
|
consumer: FunctionSchema.describe("The consuming lambda function properties."),
|
|
1378
1369
|
schedule: ScheduleExpressionSchema.describe(
|
|
1379
1370
|
'The scheduling expression.\n\nexample: "0 20 * * ? *"\nexample: "5 minutes"'
|
|
1380
1371
|
),
|
|
1381
|
-
payload:
|
|
1372
|
+
payload: z30.unknown().optional().describe("The JSON payload that will be passed to the consumer."),
|
|
1382
1373
|
retryAttempts: RetryAttemptsSchema4.default(2)
|
|
1383
1374
|
})
|
|
1384
1375
|
).optional().describe(`Define the cron jobs in your stack.`);
|
|
1385
1376
|
|
|
1386
1377
|
// src/feature/search/schema.ts
|
|
1387
1378
|
import { gibibytes as gibibytes3 } from "@awsless/size";
|
|
1388
|
-
import { z as
|
|
1389
|
-
var VersionSchema =
|
|
1379
|
+
import { z as z31 } from "zod";
|
|
1380
|
+
var VersionSchema = z31.union([
|
|
1390
1381
|
//
|
|
1391
|
-
|
|
1392
|
-
|
|
1382
|
+
z31.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]),
|
|
1383
|
+
z31.string()
|
|
1393
1384
|
]).describe("Specify the OpenSearch engine version.");
|
|
1394
|
-
var TypeSchema =
|
|
1395
|
-
|
|
1385
|
+
var TypeSchema = z31.union([
|
|
1386
|
+
z31.enum([
|
|
1396
1387
|
"t3.small",
|
|
1397
1388
|
"t3.medium",
|
|
1398
1389
|
"m3.medium",
|
|
@@ -1466,13 +1457,13 @@ var TypeSchema = z32.union([
|
|
|
1466
1457
|
"r6gd.12xlarge",
|
|
1467
1458
|
"r6gd.16xlarge"
|
|
1468
1459
|
]),
|
|
1469
|
-
|
|
1460
|
+
z31.string()
|
|
1470
1461
|
]).describe("Instance type of data nodes in the cluster.");
|
|
1471
|
-
var CountSchema =
|
|
1462
|
+
var CountSchema = z31.number().int().min(1).describe("Number of instances in the cluster.");
|
|
1472
1463
|
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.");
|
|
1473
|
-
var SearchsSchema =
|
|
1464
|
+
var SearchsSchema = z31.record(
|
|
1474
1465
|
ResourceIdSchema,
|
|
1475
|
-
|
|
1466
|
+
z31.object({
|
|
1476
1467
|
type: TypeSchema.default("t3.small"),
|
|
1477
1468
|
count: CountSchema.default(1),
|
|
1478
1469
|
version: VersionSchema.default("2.13"),
|
|
@@ -1483,12 +1474,12 @@ var SearchsSchema = z32.record(
|
|
|
1483
1474
|
).optional().describe("Define the search instances in your stack. Backed by OpenSearch.");
|
|
1484
1475
|
|
|
1485
1476
|
// src/feature/site/schema.ts
|
|
1486
|
-
import { z as
|
|
1477
|
+
import { z as z33 } from "zod";
|
|
1487
1478
|
|
|
1488
1479
|
// src/config/schema/local-entry.ts
|
|
1489
1480
|
import { stat as stat3 } from "fs/promises";
|
|
1490
|
-
import { z as
|
|
1491
|
-
var LocalEntrySchema =
|
|
1481
|
+
import { z as z32 } from "zod";
|
|
1482
|
+
var LocalEntrySchema = z32.union([
|
|
1492
1483
|
RelativePathSchema.refine(async (path) => {
|
|
1493
1484
|
try {
|
|
1494
1485
|
const s = await stat3(path);
|
|
@@ -1497,7 +1488,7 @@ var LocalEntrySchema = z33.union([
|
|
|
1497
1488
|
return false;
|
|
1498
1489
|
}
|
|
1499
1490
|
}, `File or directory doesn't exist`),
|
|
1500
|
-
|
|
1491
|
+
z32.object({
|
|
1501
1492
|
nocheck: RelativePathSchema.describe(
|
|
1502
1493
|
"Specifies a local file or directory without checking if the file or directory exists."
|
|
1503
1494
|
)
|
|
@@ -1505,21 +1496,21 @@ var LocalEntrySchema = z33.union([
|
|
|
1505
1496
|
]);
|
|
1506
1497
|
|
|
1507
1498
|
// src/feature/site/schema.ts
|
|
1508
|
-
var SitesSchema =
|
|
1499
|
+
var SitesSchema = z33.record(
|
|
1509
1500
|
ResourceIdSchema,
|
|
1510
|
-
|
|
1501
|
+
z33.object({
|
|
1511
1502
|
router: ResourceIdSchema.describe("The router id to link your site with."),
|
|
1512
1503
|
path: RouteSchema2.describe("The path inside the router to link your site to."),
|
|
1513
|
-
build:
|
|
1514
|
-
command:
|
|
1504
|
+
build: z33.object({
|
|
1505
|
+
command: z33.string().describe(
|
|
1515
1506
|
`Specifies the files and directories to generate the cache key for your custom build command.`
|
|
1516
1507
|
),
|
|
1517
|
-
cacheKey:
|
|
1508
|
+
cacheKey: z33.union([LocalEntrySchema.transform((v) => [v]), LocalEntrySchema.array()]).describe(
|
|
1518
1509
|
`Specifies the files and directories to generate the cache key for your custom build command.`
|
|
1519
1510
|
),
|
|
1520
|
-
configs:
|
|
1511
|
+
configs: z33.string().array().optional().describe("Define the config values for your build command.")
|
|
1521
1512
|
}).optional().describe(`Specifies the build process for sites that need a build step.`),
|
|
1522
|
-
static:
|
|
1513
|
+
static: z33.union([LocalDirectorySchema, z33.boolean()]).optional().describe(
|
|
1523
1514
|
"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."
|
|
1524
1515
|
),
|
|
1525
1516
|
ssr: FunctionSchema.optional().describe("Specifies the file that will render the site on the server.")
|
|
@@ -1527,21 +1518,21 @@ var SitesSchema = z34.record(
|
|
|
1527
1518
|
).optional().describe("Define the sites in your stack.");
|
|
1528
1519
|
|
|
1529
1520
|
// src/feature/store/schema.ts
|
|
1530
|
-
import { z as
|
|
1531
|
-
var StoresSchema =
|
|
1532
|
-
|
|
1521
|
+
import { z as z34 } from "zod";
|
|
1522
|
+
var StoresSchema = z34.union([
|
|
1523
|
+
z34.array(ResourceIdSchema).transform((list) => {
|
|
1533
1524
|
const stores = {};
|
|
1534
1525
|
for (const key of list) {
|
|
1535
1526
|
stores[key] = {};
|
|
1536
1527
|
}
|
|
1537
1528
|
return stores;
|
|
1538
1529
|
}),
|
|
1539
|
-
|
|
1530
|
+
z34.record(
|
|
1540
1531
|
ResourceIdSchema,
|
|
1541
|
-
|
|
1532
|
+
z34.object({
|
|
1542
1533
|
static: LocalDirectorySchema.optional().describe("Specifies the path to the static files directory."),
|
|
1543
|
-
versioning:
|
|
1544
|
-
events:
|
|
1534
|
+
versioning: z34.boolean().default(false).describe("Enable versioning of your store."),
|
|
1535
|
+
events: z34.object({
|
|
1545
1536
|
// create
|
|
1546
1537
|
"created:*": TaskSchema.optional().describe(
|
|
1547
1538
|
"Subscribe to notifications regardless of the API that was used to create an object."
|
|
@@ -1574,30 +1565,30 @@ var StoresSchema = z35.union([
|
|
|
1574
1565
|
]).optional().describe("Define the stores in your stack.");
|
|
1575
1566
|
|
|
1576
1567
|
// src/feature/icon/schema.ts
|
|
1577
|
-
import { z as
|
|
1568
|
+
import { z as z35 } from "zod";
|
|
1578
1569
|
var staticOriginSchema = LocalDirectorySchema.describe(
|
|
1579
1570
|
"Specifies the path to a local image directory that will be uploaded in S3."
|
|
1580
1571
|
);
|
|
1581
1572
|
var functionOriginSchema = FunctionSchema.describe(
|
|
1582
1573
|
"Specifies the file that will be called when an image isn't found in the (cache) bucket."
|
|
1583
1574
|
);
|
|
1584
|
-
var IconsSchema =
|
|
1575
|
+
var IconsSchema = z35.record(
|
|
1585
1576
|
ResourceIdSchema,
|
|
1586
|
-
|
|
1577
|
+
z35.object({
|
|
1587
1578
|
// domain: ResourceIdSchema.describe('The domain id to link your site with.').optional(),
|
|
1588
1579
|
// subDomain: z.string().optional(),
|
|
1589
1580
|
router: ResourceIdSchema.describe("The router id to link your icon proxy."),
|
|
1590
1581
|
path: RouteSchema2.describe("The path inside the router to link your icon proxy to."),
|
|
1591
1582
|
log: LogSchema.optional(),
|
|
1592
1583
|
cacheDuration: DurationSchema.optional().describe("The cache duration of the cached icons."),
|
|
1593
|
-
preserveIds:
|
|
1594
|
-
symbols:
|
|
1595
|
-
origin:
|
|
1596
|
-
|
|
1584
|
+
preserveIds: z35.boolean().optional().default(false).describe("Preserve the IDs of the icons."),
|
|
1585
|
+
symbols: z35.boolean().optional().default(false).describe(`Convert the SVG's to SVG symbols.`),
|
|
1586
|
+
origin: z35.union([
|
|
1587
|
+
z35.object({
|
|
1597
1588
|
static: staticOriginSchema,
|
|
1598
1589
|
function: functionOriginSchema.optional()
|
|
1599
1590
|
}),
|
|
1600
|
-
|
|
1591
|
+
z35.object({
|
|
1601
1592
|
static: staticOriginSchema.optional(),
|
|
1602
1593
|
function: functionOriginSchema
|
|
1603
1594
|
})
|
|
@@ -1624,13 +1615,13 @@ var IconsSchema = z36.record(
|
|
|
1624
1615
|
).optional().describe("Define an svg icon proxy in your stack. Store, optimize, and deliver svg icons at scale.");
|
|
1625
1616
|
|
|
1626
1617
|
// src/feature/image/schema.ts
|
|
1627
|
-
import { z as
|
|
1628
|
-
var transformationOptionsSchema =
|
|
1629
|
-
width:
|
|
1630
|
-
height:
|
|
1631
|
-
fit:
|
|
1632
|
-
position:
|
|
1633
|
-
quality:
|
|
1618
|
+
import { z as z36 } from "zod";
|
|
1619
|
+
var transformationOptionsSchema = z36.object({
|
|
1620
|
+
width: z36.number().int().positive().optional(),
|
|
1621
|
+
height: z36.number().int().positive().optional(),
|
|
1622
|
+
fit: z36.enum(["cover", "contain", "fill", "inside", "outside"]).optional(),
|
|
1623
|
+
position: z36.enum(["top", "right top", "right", "right bottom", "bottom", "left bottom", "left", "left top", "center"]).optional(),
|
|
1624
|
+
quality: z36.number().int().min(1).max(100).optional()
|
|
1634
1625
|
});
|
|
1635
1626
|
var staticOriginSchema2 = LocalDirectorySchema.describe(
|
|
1636
1627
|
"Specifies the path to a local image directory that will be uploaded in S3."
|
|
@@ -1638,38 +1629,38 @@ var staticOriginSchema2 = LocalDirectorySchema.describe(
|
|
|
1638
1629
|
var functionOriginSchema2 = FunctionSchema.describe(
|
|
1639
1630
|
"Specifies the file that will be called when an image isn't found in the (cache) bucket."
|
|
1640
1631
|
);
|
|
1641
|
-
var ImagesSchema =
|
|
1632
|
+
var ImagesSchema = z36.record(
|
|
1642
1633
|
ResourceIdSchema,
|
|
1643
|
-
|
|
1634
|
+
z36.object({
|
|
1644
1635
|
// domain: ResourceIdSchema.describe('The domain id to link your site with.').optional(),
|
|
1645
1636
|
// subDomain: z.string().optional(),
|
|
1646
1637
|
router: ResourceIdSchema.describe("The router id to link your image proxy."),
|
|
1647
1638
|
path: RouteSchema2.describe("The path inside the router to link your image proxy to."),
|
|
1648
1639
|
log: LogSchema.optional(),
|
|
1649
1640
|
cacheDuration: DurationSchema.optional().describe("Cache duration of the cached images."),
|
|
1650
|
-
presets:
|
|
1651
|
-
extensions:
|
|
1652
|
-
jpg:
|
|
1653
|
-
mozjpeg:
|
|
1654
|
-
progressive:
|
|
1641
|
+
presets: z36.record(z36.string(), transformationOptionsSchema).describe("Named presets for image transformations"),
|
|
1642
|
+
extensions: z36.object({
|
|
1643
|
+
jpg: z36.object({
|
|
1644
|
+
mozjpeg: z36.boolean().optional(),
|
|
1645
|
+
progressive: z36.boolean().optional()
|
|
1655
1646
|
}).optional(),
|
|
1656
|
-
webp:
|
|
1657
|
-
effort:
|
|
1658
|
-
lossless:
|
|
1659
|
-
nearLossless:
|
|
1647
|
+
webp: z36.object({
|
|
1648
|
+
effort: z36.number().int().min(1).max(10).default(7).optional(),
|
|
1649
|
+
lossless: z36.boolean().optional(),
|
|
1650
|
+
nearLossless: z36.boolean().optional()
|
|
1660
1651
|
}).optional(),
|
|
1661
|
-
png:
|
|
1662
|
-
compressionLevel:
|
|
1652
|
+
png: z36.object({
|
|
1653
|
+
compressionLevel: z36.number().int().min(0).max(9).default(6).optional()
|
|
1663
1654
|
}).optional()
|
|
1664
1655
|
}).refine((data) => {
|
|
1665
1656
|
return Object.keys(data).length > 0;
|
|
1666
1657
|
}, "At least one extension must be defined.").describe("Specify the allowed extensions."),
|
|
1667
|
-
origin:
|
|
1668
|
-
|
|
1658
|
+
origin: z36.union([
|
|
1659
|
+
z36.object({
|
|
1669
1660
|
static: staticOriginSchema2,
|
|
1670
1661
|
function: functionOriginSchema2.optional()
|
|
1671
1662
|
}),
|
|
1672
|
-
|
|
1663
|
+
z36.object({
|
|
1673
1664
|
static: staticOriginSchema2.optional(),
|
|
1674
1665
|
function: functionOriginSchema2
|
|
1675
1666
|
})
|
|
@@ -1684,7 +1675,7 @@ var ImagesSchema = z37.record(
|
|
|
1684
1675
|
).optional().describe("Define an image proxy in your stack. Store, transform, optimize, and deliver images at scale.");
|
|
1685
1676
|
|
|
1686
1677
|
// src/feature/metric/schema.ts
|
|
1687
|
-
import { z as
|
|
1678
|
+
import { z as z37 } from "zod";
|
|
1688
1679
|
var ops = {
|
|
1689
1680
|
">": "GreaterThanThreshold",
|
|
1690
1681
|
">=": "GreaterThanOrEqualToThreshold",
|
|
@@ -1698,15 +1689,15 @@ var stats = {
|
|
|
1698
1689
|
min: "Minimum",
|
|
1699
1690
|
max: "Maximum"
|
|
1700
1691
|
};
|
|
1701
|
-
var WhereSchema =
|
|
1702
|
-
|
|
1692
|
+
var WhereSchema = z37.union([
|
|
1693
|
+
z37.string().regex(/(count|avg|sum|min|max) (>|>=|<|<=) (\d)/, "Invalid where query").transform((where) => {
|
|
1703
1694
|
const [stat4, op, value] = where.split(" ");
|
|
1704
1695
|
return { stat: stat4, op, value: parseFloat(value) };
|
|
1705
1696
|
}),
|
|
1706
|
-
|
|
1707
|
-
stat:
|
|
1708
|
-
op:
|
|
1709
|
-
value:
|
|
1697
|
+
z37.object({
|
|
1698
|
+
stat: z37.enum(["count", "avg", "sum", "min", "max"]),
|
|
1699
|
+
op: z37.enum([">", ">=", "<", "<="]),
|
|
1700
|
+
value: z37.number()
|
|
1710
1701
|
})
|
|
1711
1702
|
]).transform((where) => {
|
|
1712
1703
|
return {
|
|
@@ -1715,39 +1706,39 @@ var WhereSchema = z38.union([
|
|
|
1715
1706
|
value: where.value
|
|
1716
1707
|
};
|
|
1717
1708
|
});
|
|
1718
|
-
var AlarmSchema =
|
|
1719
|
-
description:
|
|
1709
|
+
var AlarmSchema = z37.object({
|
|
1710
|
+
description: z37.string().optional(),
|
|
1720
1711
|
where: WhereSchema,
|
|
1721
1712
|
period: DurationSchema,
|
|
1722
|
-
minDataPoints:
|
|
1723
|
-
trigger:
|
|
1713
|
+
minDataPoints: z37.number().int().default(1),
|
|
1714
|
+
trigger: z37.union([EmailSchema.transform((v) => [v]), EmailSchema.array(), FunctionSchema])
|
|
1724
1715
|
});
|
|
1725
|
-
var MetricsSchema =
|
|
1716
|
+
var MetricsSchema = z37.record(
|
|
1726
1717
|
ResourceIdSchema,
|
|
1727
|
-
|
|
1728
|
-
type:
|
|
1718
|
+
z37.object({
|
|
1719
|
+
type: z37.enum(["number", "size", "duration"]),
|
|
1729
1720
|
alarms: AlarmSchema.array().optional()
|
|
1730
1721
|
})
|
|
1731
1722
|
).optional().describe("Define the metrics in your stack.");
|
|
1732
1723
|
|
|
1733
1724
|
// src/feature/table/schema.ts
|
|
1734
1725
|
import { minutes as minutes5, seconds as seconds4 } from "@awsless/duration";
|
|
1735
|
-
import { z as
|
|
1736
|
-
var KeySchema =
|
|
1737
|
-
var TablesSchema =
|
|
1726
|
+
import { z as z38 } from "zod";
|
|
1727
|
+
var KeySchema = z38.string().min(1).max(255);
|
|
1728
|
+
var TablesSchema = z38.record(
|
|
1738
1729
|
ResourceIdSchema,
|
|
1739
|
-
|
|
1730
|
+
z38.object({
|
|
1740
1731
|
hash: KeySchema.describe(
|
|
1741
1732
|
"Specifies the name of the partition / hash key that makes up the primary key for the table."
|
|
1742
1733
|
),
|
|
1743
1734
|
sort: KeySchema.optional().describe(
|
|
1744
1735
|
"Specifies the name of the range / sort key that makes up the primary key for the table."
|
|
1745
1736
|
),
|
|
1746
|
-
fields:
|
|
1737
|
+
fields: z38.record(z38.string(), z38.enum(["string", "number", "binary"])).optional().describe(
|
|
1747
1738
|
'A list of attributes that describe the key schema for the table and indexes. If no attribute field is defined we default to "string".'
|
|
1748
1739
|
),
|
|
1749
|
-
class:
|
|
1750
|
-
pointInTimeRecovery:
|
|
1740
|
+
class: z38.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
|
|
1741
|
+
pointInTimeRecovery: z38.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
|
|
1751
1742
|
ttl: KeySchema.optional().describe(
|
|
1752
1743
|
[
|
|
1753
1744
|
"The name of the TTL attribute used to store the expiration time for items in the table.",
|
|
@@ -1755,8 +1746,8 @@ var TablesSchema = z39.record(
|
|
|
1755
1746
|
].join("\n")
|
|
1756
1747
|
),
|
|
1757
1748
|
// deletionProtection: DeletionProtectionSchema.optional(),
|
|
1758
|
-
stream:
|
|
1759
|
-
type:
|
|
1749
|
+
stream: z38.object({
|
|
1750
|
+
type: z38.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
|
|
1760
1751
|
[
|
|
1761
1752
|
"When an item in the table is modified, you can determines what information is written to the stream for this table.",
|
|
1762
1753
|
"Valid values are:",
|
|
@@ -1766,7 +1757,7 @@ var TablesSchema = z39.record(
|
|
|
1766
1757
|
"- new-and-old-images - Both the new and the old item images of the item are written to the stream."
|
|
1767
1758
|
].join("\n")
|
|
1768
1759
|
),
|
|
1769
|
-
batchSize:
|
|
1760
|
+
batchSize: z38.number().min(1).max(1e4).default(1).describe(
|
|
1770
1761
|
[
|
|
1771
1762
|
"The maximum number of records in each batch that Lambda pulls from your stream and sends to your function.",
|
|
1772
1763
|
"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).",
|
|
@@ -1795,7 +1786,7 @@ var TablesSchema = z39.record(
|
|
|
1795
1786
|
// 'The default value is 60s',
|
|
1796
1787
|
// ].join('\n')
|
|
1797
1788
|
// ),
|
|
1798
|
-
retryAttempts:
|
|
1789
|
+
retryAttempts: z38.number().min(-1).max(1e4).default(2).describe(
|
|
1799
1790
|
[
|
|
1800
1791
|
"Discard records after the specified number of retries.",
|
|
1801
1792
|
"-1 will sets the maximum number of retries to infinite.",
|
|
@@ -1804,7 +1795,7 @@ var TablesSchema = z39.record(
|
|
|
1804
1795
|
"The default value is 2"
|
|
1805
1796
|
].join("\n")
|
|
1806
1797
|
),
|
|
1807
|
-
concurrencyPerShard:
|
|
1798
|
+
concurrencyPerShard: z38.number().min(1).max(10).default(1).describe(
|
|
1808
1799
|
[
|
|
1809
1800
|
"The number of batches to process concurrently from each shard.",
|
|
1810
1801
|
"You can specify a number from 1 to 10."
|
|
@@ -1814,16 +1805,16 @@ var TablesSchema = z39.record(
|
|
|
1814
1805
|
}).optional().describe(
|
|
1815
1806
|
"The settings for the DynamoDB table stream, which capture changes to items stored in the table."
|
|
1816
1807
|
),
|
|
1817
|
-
indexes:
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
hash:
|
|
1808
|
+
indexes: z38.record(
|
|
1809
|
+
z38.string(),
|
|
1810
|
+
z38.object({
|
|
1811
|
+
hash: z38.union([KeySchema.transform((v) => [v]), KeySchema.array()]).describe(
|
|
1821
1812
|
"Specifies the name of the partition / hash key that makes up the primary key for the global secondary index."
|
|
1822
1813
|
),
|
|
1823
|
-
sort:
|
|
1814
|
+
sort: z38.union([KeySchema.transform((v) => [v]), KeySchema.array()]).optional().describe(
|
|
1824
1815
|
"Specifies the name of the range / sort key that makes up the primary key for the global secondary index."
|
|
1825
1816
|
),
|
|
1826
|
-
projection:
|
|
1817
|
+
projection: z38.enum(["all", "keys-only"]).default("all").describe(
|
|
1827
1818
|
[
|
|
1828
1819
|
"The set of attributes that are projected into the index:",
|
|
1829
1820
|
"- all - All of the table attributes are projected into the index.",
|
|
@@ -1837,12 +1828,12 @@ var TablesSchema = z39.record(
|
|
|
1837
1828
|
).optional().describe("Define the tables in your stack.");
|
|
1838
1829
|
|
|
1839
1830
|
// src/feature/test/schema.ts
|
|
1840
|
-
import { z as
|
|
1841
|
-
var TestsSchema =
|
|
1831
|
+
import { z as z39 } from "zod";
|
|
1832
|
+
var TestsSchema = z39.union([
|
|
1842
1833
|
//
|
|
1843
1834
|
LocalDirectorySchema.transform((v) => [v]),
|
|
1844
1835
|
LocalDirectorySchema.array(),
|
|
1845
|
-
|
|
1836
|
+
z39.literal(false)
|
|
1846
1837
|
]).describe("Define the location of your tests for your stack.").optional();
|
|
1847
1838
|
|
|
1848
1839
|
// src/config/stack.ts
|
|
@@ -1850,8 +1841,8 @@ var DependsSchema = ResourceIdSchema.array().optional().describe("Define the sta
|
|
|
1850
1841
|
var NameSchema = ResourceIdSchema.refine((name) => !["base", "hostedzones"].includes(name), {
|
|
1851
1842
|
message: `Stack name can't be a reserved name.`
|
|
1852
1843
|
}).describe("Stack name.");
|
|
1853
|
-
var StackSchema =
|
|
1854
|
-
$schema:
|
|
1844
|
+
var StackSchema = z40.object({
|
|
1845
|
+
$schema: z40.string().optional(),
|
|
1855
1846
|
name: NameSchema,
|
|
1856
1847
|
depends: DependsSchema,
|
|
1857
1848
|
commands: CommandsSchema,
|