@awsless/awsless 0.0.548 → 0.0.550

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.
@@ -4,7 +4,7 @@ import { join as join2 } from "node:path";
4
4
  import { zodToJsonSchema } from "zod-to-json-schema";
5
5
 
6
6
  // src/config/app.ts
7
- import { z as z22 } from "zod";
7
+ import { z as z23 } from "zod";
8
8
 
9
9
  // src/feature/alert/schema.ts
10
10
  import { kebabCase } from "change-case";
@@ -361,7 +361,13 @@ var LayerSchema = z13.record(
361
361
 
362
362
  // src/feature/on-failure/schema.ts
363
363
  var OnFailureDefaultSchema = FunctionSchema.optional().describe(
364
- "Defining a onFailure handler will add a global onFailure handler for the following resources:\n- Async lambda functions\n- SQS queues\n- DynamoDB streams"
364
+ [
365
+ "Defining a onFailure handler will add a global onFailure handler for the following resources:",
366
+ "- CloudWatch Scheduler",
367
+ "- Async lambda functions",
368
+ "- SQS queues",
369
+ "- DynamoDB streams"
370
+ ].join("\n")
365
371
  );
366
372
 
367
373
  // src/feature/on-log/schema.ts
@@ -384,32 +390,30 @@ var DomainSchema = ResourceIdSchema.describe("The domain id to link your Pubsub
384
390
  var PubSubDefaultSchema = z15.record(
385
391
  ResourceIdSchema,
386
392
  z15.object({
387
- auth: FunctionSchema,
393
+ auth: FunctionSchema.describe("The authentication function for the pubsub API."),
388
394
  domain: DomainSchema.optional(),
389
- subDomain: z15.string().optional()
390
- // auth: z.union([
391
- // ResourceIdSchema,
392
- // z.object({
393
- // authorizer: FunctionSchema,
394
- // // ttl: AuthorizerTtl.default('1 hour'),
395
- // }),
396
- // ]),
397
- // policy: z
398
- // .object({
399
- // publish: z.array(z.string()).optional(),
400
- // subscribe: z.array(z.string()).optional(),
401
- // })
402
- // .optional(),
395
+ subDomain: z15.string().optional(),
396
+ namespaces: z15.array(z15.string()).optional().describe('The namespaces for the PubSub API. If not set, a single "default" namespace is created.'),
397
+ logLevel: z15.enum(["none", "info", "error", "debug", "all"]).optional().describe("The logging level for AppSync API. When set, logging is enabled.")
403
398
  })
404
- ).optional().describe("Define the pubsub subscriber in your stack.");
399
+ ).optional().describe("Define the pubsub API configuration in your stack.");
405
400
  var PubSubSchema = z15.record(
406
401
  ResourceIdSchema,
407
402
  z15.object({
408
- sql: z15.string().describe("The SQL statement used to query the IOT topic."),
409
- 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."),
410
- consumer: FunctionSchema.describe("The consuming lambda function properties.")
403
+ channels: z15.array(z15.string()).describe("The event channels this subscriber listens to."),
404
+ filter: z15.object({
405
+ eventType: z15.string().optional().describe("Filter events by event type.")
406
+ // Add more filter options as needed
407
+ // userId: z.string().optional(),
408
+ // custom: z.record(z.string(), z.any()).optional(),
409
+ }).optional().describe("Event filtering options."),
410
+ consumer: FunctionSchema.describe("The consuming lambda function properties."),
411
+ batchSize: z15.number().int().min(1).max(100).default(1).describe("Number of events to batch before invoking the consumer function."),
412
+ retryPolicy: z15.object({
413
+ maxRetries: z15.number().int().min(0).max(3).default(2).describe("Maximum number of retry attempts.")
414
+ }).optional().describe("Retry policy for failed event processing.")
411
415
  })
412
- ).optional().describe("Define the pubsub subscriber in your stack.");
416
+ ).optional().describe("Define the pubsub event subscribers in your stack.");
413
417
 
414
418
  // src/feature/queue/schema.ts
415
419
  import { days as days2, hours, minutes as minutes2, seconds as seconds2 } from "@awsless/duration";
@@ -677,8 +681,17 @@ var InstanceDefaultSchema = z20.object({
677
681
  }))
678
682
  }).default({});
679
683
 
680
- // src/config/schema/region.ts
684
+ // src/feature/topic/schema.ts
685
+ import { kebabCase as kebabCase3 } from "change-case";
681
686
  import { z as z21 } from "zod";
687
+ var TopicNameSchema = z21.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => kebabCase3(value)).describe("Define event topic name.");
688
+ var TopicsDefaultSchema = z21.array(TopicNameSchema).refine((topics) => {
689
+ return topics.length === new Set(topics).size;
690
+ }, "Must be a list of unique topic names").optional().describe("Define the event topics for your app.");
691
+ var SubscribersSchema = z21.record(TopicNameSchema, FunctionSchema).optional().describe("Define the event topics to subscribe too in your stack.");
692
+
693
+ // src/config/schema/region.ts
694
+ import { z as z22 } from "zod";
682
695
  var US = ["us-east-2", "us-east-1", "us-west-1", "us-west-2"];
683
696
  var AF = ["af-south-1"];
684
697
  var AP = [
@@ -707,16 +720,16 @@ var EU = [
707
720
  var ME = ["me-south-1", "me-central-1"];
708
721
  var SA = ["sa-east-1"];
709
722
  var regions = [...US, ...AF, ...AP, ...CA, ...EU, ...ME, ...SA];
710
- var RegionSchema = z21.enum(regions);
723
+ var RegionSchema = z22.enum(regions);
711
724
 
712
725
  // src/config/app.ts
713
- var AppSchema = z22.object({
714
- $schema: z22.string().optional(),
726
+ var AppSchema = z23.object({
727
+ $schema: z23.string().optional(),
715
728
  name: ResourceIdSchema.describe("App name."),
716
729
  region: RegionSchema.describe("The AWS region to deploy to."),
717
- profile: z22.string().describe("The AWS profile to deploy to."),
718
- protect: z22.boolean().default(false).describe("Protect your app & stacks from being deleted."),
719
- removal: z22.enum(["remove", "retain"]).default("remove").describe(
730
+ profile: z23.string().describe("The AWS profile to deploy to."),
731
+ protect: z23.boolean().default(false).describe("Protect your app & stacks from being deleted."),
732
+ removal: z23.enum(["remove", "retain"]).default("remove").describe(
720
733
  [
721
734
  "Configure how your resources are handled when they have to be removed.",
722
735
  "",
@@ -730,7 +743,7 @@ var AppSchema = z22.object({
730
743
  // .default('prod')
731
744
  // .describe('The deployment stage.'),
732
745
  // onFailure: OnFailureSchema,
733
- defaults: z22.object({
746
+ defaults: z23.object({
734
747
  onFailure: OnFailureDefaultSchema,
735
748
  onLog: OnLogDefaultSchema,
736
749
  auth: AuthDefaultSchema,
@@ -746,17 +759,18 @@ var AppSchema = z22.object({
746
759
  // table: TableDefaultSchema,
747
760
  // store: StoreDefaultSchema,
748
761
  alerts: AlertsDefaultSchema,
762
+ topics: TopicsDefaultSchema,
749
763
  layers: LayerSchema
750
764
  // dataRetention: z.boolean().describe('Configure how your resources are handled on delete.').default(false),
751
765
  }).default({}).describe("Default properties")
752
766
  });
753
767
 
754
768
  // src/config/stack.ts
755
- import { z as z38 } from "zod";
769
+ import { z as z39 } from "zod";
756
770
 
757
771
  // src/feature/cache/schema.ts
758
772
  import { gibibytes as gibibytes2 } from "@awsless/size";
759
- import { z as z23 } from "zod";
773
+ import { z as z24 } from "zod";
760
774
  var StorageSchema = SizeSchema.refine(sizeMin(gibibytes2(1)), "Minimum storage size is 1 GB").refine(
761
775
  sizeMax(gibibytes2(5e3)),
762
776
  "Maximum storage size is 5000 GB"
@@ -767,31 +781,31 @@ var MinimumStorageSchema = StorageSchema.describe(
767
781
  var MaximumStorageSchema = StorageSchema.describe(
768
782
  "The upper limit for data storage the cache is set to use. You can specify a size value from 1 GB to 5000 GB."
769
783
  );
770
- var EcpuSchema = z23.number().int().min(1e3).max(15e6);
784
+ var EcpuSchema = z24.number().int().min(1e3).max(15e6);
771
785
  var MinimumEcpuSchema = EcpuSchema.describe(
772
786
  "The minimum number of ECPUs the cache can consume per second. You can specify a integer from 1,000 to 15,000,000."
773
787
  );
774
788
  var MaximumEcpuSchema = EcpuSchema.describe(
775
789
  "The maximum number of ECPUs the cache can consume per second. You can specify a integer from 1,000 to 15,000,000."
776
790
  );
777
- var CachesSchema = z23.record(
791
+ var CachesSchema = z24.record(
778
792
  ResourceIdSchema,
779
- z23.object({
793
+ z24.object({
780
794
  minStorage: MinimumStorageSchema.optional(),
781
795
  maxStorage: MaximumStorageSchema.optional(),
782
796
  minECPU: MinimumEcpuSchema.optional(),
783
797
  maxECPU: MaximumEcpuSchema.optional(),
784
- snapshotRetentionLimit: z23.number().int().positive().default(1)
798
+ snapshotRetentionLimit: z24.number().int().positive().default(1)
785
799
  })
786
800
  ).optional().describe("Define the caches in your stack. For access to the cache put your functions inside the global VPC.");
787
801
 
788
802
  // src/feature/command/schema.ts
789
- import { z as z24 } from "zod";
790
- var CommandSchema = z24.union([
791
- z24.object({
803
+ import { z as z25 } from "zod";
804
+ var CommandSchema = z25.union([
805
+ z25.object({
792
806
  file: LocalFileSchema,
793
- handler: z24.string().default("default").describe("The name of the handler that needs to run"),
794
- description: z24.string().optional().describe("A description of the command")
807
+ handler: z25.string().default("default").describe("The name of the handler that needs to run"),
808
+ description: z25.string().optional().describe("A description of the command")
795
809
  // options: z.record(ResourceIdSchema, OptionSchema).optional(),
796
810
  // arguments: z.record(ResourceIdSchema, ArgumentSchema).optional(),
797
811
  }),
@@ -801,22 +815,22 @@ var CommandSchema = z24.union([
801
815
  description: void 0
802
816
  }))
803
817
  ]);
804
- var CommandsSchema = z24.record(ResourceIdSchema, CommandSchema).optional().describe("Define the custom commands for your stack.");
818
+ var CommandsSchema = z25.record(ResourceIdSchema, CommandSchema).optional().describe("Define the custom commands for your stack.");
805
819
 
806
820
  // src/feature/config/schema.ts
807
- import { z as z25 } from "zod";
808
- var ConfigNameSchema = z25.string().regex(/[a-z0-9\-]/g, "Invalid config name");
809
- var ConfigsSchema = z25.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
821
+ import { z as z26 } from "zod";
822
+ var ConfigNameSchema = z26.string().regex(/[a-z0-9\-]/g, "Invalid config name");
823
+ var ConfigsSchema = z26.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
810
824
 
811
825
  // src/feature/cron/schema/index.ts
812
- import { z as z27 } from "zod";
826
+ import { z as z28 } from "zod";
813
827
 
814
828
  // src/feature/cron/schema/schedule.ts
815
- import { z as z26 } from "zod";
829
+ import { z as z27 } from "zod";
816
830
  import { awsCronExpressionValidator } from "aws-cron-expression-validator";
817
- var RateExpressionSchema = z26.custom(
831
+ var RateExpressionSchema = z27.custom(
818
832
  (value) => {
819
- return z26.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
833
+ return z27.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
820
834
  const [str] = rate.split(" ");
821
835
  const number = parseInt(str);
822
836
  return number > 0;
@@ -832,9 +846,9 @@ var RateExpressionSchema = z26.custom(
832
846
  }
833
847
  return `rate(${rate})`;
834
848
  });
835
- var CronExpressionSchema = z26.custom(
849
+ var CronExpressionSchema = z27.custom(
836
850
  (value) => {
837
- return z26.string().safeParse(value).success;
851
+ return z27.string().safeParse(value).success;
838
852
  },
839
853
  { message: "Invalid cron expression" }
840
854
  ).superRefine((value, ctx) => {
@@ -843,12 +857,12 @@ var CronExpressionSchema = z26.custom(
843
857
  } catch (error) {
844
858
  if (error instanceof Error) {
845
859
  ctx.addIssue({
846
- code: z26.ZodIssueCode.custom,
860
+ code: z27.ZodIssueCode.custom,
847
861
  message: `Invalid cron expression: ${error.message}`
848
862
  });
849
863
  } else {
850
864
  ctx.addIssue({
851
- code: z26.ZodIssueCode.custom,
865
+ code: z27.ZodIssueCode.custom,
852
866
  message: "Invalid cron expression"
853
867
  });
854
868
  }
@@ -859,28 +873,28 @@ var CronExpressionSchema = z26.custom(
859
873
  var ScheduleExpressionSchema = RateExpressionSchema.or(CronExpressionSchema);
860
874
 
861
875
  // src/feature/cron/schema/index.ts
862
- var CronsSchema = z27.record(
876
+ var CronsSchema = z28.record(
863
877
  ResourceIdSchema,
864
- z27.object({
865
- enabled: z27.boolean().default(true).describe("If the cron is enabled."),
878
+ z28.object({
879
+ enabled: z28.boolean().default(true).describe("If the cron is enabled."),
866
880
  consumer: FunctionSchema.describe("The consuming lambda function properties."),
867
881
  schedule: ScheduleExpressionSchema.describe(
868
882
  'The scheduling expression.\n\nexample: "0 20 * * ? *"\nexample: "5 minutes"'
869
883
  ),
870
- payload: z27.unknown().optional().describe("The JSON payload that will be passed to the consumer.")
884
+ payload: z28.unknown().optional().describe("The JSON payload that will be passed to the consumer.")
871
885
  })
872
886
  ).optional().describe(`Define the cron jobs in your stack.`);
873
887
 
874
888
  // src/feature/search/schema.ts
875
889
  import { gibibytes as gibibytes3 } from "@awsless/size";
876
- import { z as z28 } from "zod";
877
- var VersionSchema = z28.union([
890
+ import { z as z29 } from "zod";
891
+ var VersionSchema = z29.union([
878
892
  //
879
- z28.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]),
880
- z28.string()
893
+ z29.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]),
894
+ z29.string()
881
895
  ]).describe("Specify the OpenSearch engine version.");
882
- var TypeSchema = z28.union([
883
- z28.enum([
896
+ var TypeSchema = z29.union([
897
+ z29.enum([
884
898
  "t3.small",
885
899
  "t3.medium",
886
900
  "m3.medium",
@@ -954,13 +968,13 @@ var TypeSchema = z28.union([
954
968
  "r6gd.12xlarge",
955
969
  "r6gd.16xlarge"
956
970
  ]),
957
- z28.string()
971
+ z29.string()
958
972
  ]).describe("Instance type of data nodes in the cluster.");
959
- var CountSchema = z28.number().int().min(1).describe("Number of instances in the cluster.");
973
+ var CountSchema = z29.number().int().min(1).describe("Number of instances in the cluster.");
960
974
  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.");
961
- var SearchsSchema = z28.record(
975
+ var SearchsSchema = z29.record(
962
976
  ResourceIdSchema,
963
- z28.object({
977
+ z29.object({
964
978
  type: TypeSchema.default("t3.small"),
965
979
  count: CountSchema.default(1),
966
980
  version: VersionSchema.default("2.13"),
@@ -971,12 +985,12 @@ var SearchsSchema = z28.record(
971
985
  ).optional().describe("Define the search instances in your stack. Backed by OpenSearch.");
972
986
 
973
987
  // src/feature/site/schema.ts
974
- import { z as z30 } from "zod";
988
+ import { z as z31 } from "zod";
975
989
 
976
990
  // src/config/schema/local-entry.ts
977
991
  import { stat as stat3 } from "fs/promises";
978
- import { z as z29 } from "zod";
979
- var LocalEntrySchema = z29.union([
992
+ import { z as z30 } from "zod";
993
+ var LocalEntrySchema = z30.union([
980
994
  RelativePathSchema.refine(async (path) => {
981
995
  try {
982
996
  const s = await stat3(path);
@@ -985,7 +999,7 @@ var LocalEntrySchema = z29.union([
985
999
  return false;
986
1000
  }
987
1001
  }, `File or directory doesn't exist`),
988
- z29.object({
1002
+ z30.object({
989
1003
  nocheck: RelativePathSchema.describe(
990
1004
  "Specifies a local file or directory without checking if the file or directory exists."
991
1005
  )
@@ -993,14 +1007,14 @@ var LocalEntrySchema = z29.union([
993
1007
  ]);
994
1008
 
995
1009
  // src/feature/site/schema.ts
996
- var ErrorResponsePathSchema = z30.string().describe(
1010
+ var ErrorResponsePathSchema = z31.string().describe(
997
1011
  [
998
1012
  "The path to the custom error page that you want to return to the viewer when your origin returns the HTTP status code specified.",
999
1013
  "- We recommend that you store custom error pages in an Amazon S3 bucket.",
1000
1014
  "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."
1001
1015
  ].join("\n")
1002
1016
  );
1003
- var StatusCodeSchema = z30.number().int().positive().optional().describe(
1017
+ var StatusCodeSchema = z31.number().int().positive().optional().describe(
1004
1018
  [
1005
1019
  "The HTTP status code that you want CloudFront to return to the viewer along with the custom error page.",
1006
1020
  "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:",
@@ -1013,19 +1027,19 @@ var StatusCodeSchema = z30.number().int().positive().optional().describe(
1013
1027
  var MinTTLSchema = DurationSchema.describe(
1014
1028
  "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."
1015
1029
  );
1016
- var ErrorResponseSchema = z30.union([
1030
+ var ErrorResponseSchema = z31.union([
1017
1031
  ErrorResponsePathSchema,
1018
- z30.object({
1032
+ z31.object({
1019
1033
  path: ErrorResponsePathSchema,
1020
1034
  statusCode: StatusCodeSchema.optional(),
1021
1035
  minTTL: MinTTLSchema.optional()
1022
1036
  })
1023
1037
  ]).optional();
1024
- var SitesSchema = z30.record(
1038
+ var SitesSchema = z31.record(
1025
1039
  ResourceIdSchema,
1026
- z30.object({
1040
+ z31.object({
1027
1041
  domain: ResourceIdSchema.describe("The domain id to link your site with.").optional(),
1028
- subDomain: z30.string().optional(),
1042
+ subDomain: z31.string().optional(),
1029
1043
  // bind: z
1030
1044
  // .object({
1031
1045
  // auth: z.array(ResourceIdSchema),
@@ -1034,16 +1048,16 @@ var SitesSchema = z30.record(
1034
1048
  // // rest: z.array(ResourceIdSchema),
1035
1049
  // })
1036
1050
  // .optional(),
1037
- build: z30.object({
1038
- command: z30.string().describe(
1051
+ build: z31.object({
1052
+ command: z31.string().describe(
1039
1053
  `Specifies the files and directories to generate the cache key for your custom build command.`
1040
1054
  ),
1041
- cacheKey: z30.union([LocalEntrySchema.transform((v) => [v]), LocalEntrySchema.array()]).describe(
1055
+ cacheKey: z31.union([LocalEntrySchema.transform((v) => [v]), LocalEntrySchema.array()]).describe(
1042
1056
  `Specifies the files and directories to generate the cache key for your custom build command.`
1043
1057
  ),
1044
- configs: z30.string().array().describe("Define the config values for your build command.")
1058
+ configs: z31.string().array().describe("Define the config values for your build command.")
1045
1059
  }).optional().describe(`Specifies the build process for sites that need a build step.`),
1046
- static: z30.union([LocalDirectorySchema, z30.boolean()]).optional().describe(
1060
+ static: z31.union([LocalDirectorySchema, z31.boolean()]).optional().describe(
1047
1061
  "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."
1048
1062
  ),
1049
1063
  ssr: FunctionSchema.optional().describe("Specifies the file that will render the site on the server."),
@@ -1064,7 +1078,7 @@ var SitesSchema = z30.record(
1064
1078
  // build: z.string().optional(),
1065
1079
  // }),
1066
1080
  // ]),
1067
- geoRestrictions: z30.array(z30.string().length(2).toUpperCase()).default([]).describe("Specifies a blacklist of countries that should be blocked."),
1081
+ geoRestrictions: z31.array(z31.string().length(2).toUpperCase()).default([]).describe("Specifies a blacklist of countries that should be blocked."),
1068
1082
  // forwardHost: z
1069
1083
  // .boolean()
1070
1084
  // .default(false)
@@ -1075,7 +1089,7 @@ var SitesSchema = z30.record(
1075
1089
  // 'Keep in mind that this requires an extra CloudFront Function.',
1076
1090
  // ].join('\n')
1077
1091
  // ),
1078
- errors: z30.object({
1092
+ errors: z31.object({
1079
1093
  400: ErrorResponseSchema.describe("Customize a `400 Bad Request` response."),
1080
1094
  403: ErrorResponseSchema.describe("Customize a `403 Forbidden` response."),
1081
1095
  404: ErrorResponseSchema.describe("Customize a `404 Not Found` response."),
@@ -1088,20 +1102,20 @@ var SitesSchema = z30.record(
1088
1102
  503: ErrorResponseSchema.describe("Customize a `503 Service Unavailable` response."),
1089
1103
  504: ErrorResponseSchema.describe("Customize a `504 Gateway Timeout` response.")
1090
1104
  }).optional().describe("Customize the error responses for specific HTTP status codes."),
1091
- cors: z30.object({
1092
- override: z30.boolean().default(false),
1105
+ cors: z31.object({
1106
+ override: z31.boolean().default(false),
1093
1107
  maxAge: DurationSchema.default("365 days"),
1094
- exposeHeaders: z30.string().array().optional(),
1095
- credentials: z30.boolean().default(false),
1096
- headers: z30.string().array().default(["*"]),
1097
- origins: z30.string().array().default(["*"]),
1098
- methods: z30.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
1108
+ exposeHeaders: z31.string().array().optional(),
1109
+ credentials: z31.boolean().default(false),
1110
+ headers: z31.string().array().default(["*"]),
1111
+ origins: z31.string().array().default(["*"]),
1112
+ methods: z31.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
1099
1113
  }).optional().describe("Specify the cors headers."),
1100
- auth: z30.object({
1101
- username: z30.string().describe("Basic auth username"),
1102
- password: z30.string().describe("Basic auth password")
1114
+ auth: z31.object({
1115
+ username: z31.string().describe("Basic auth username"),
1116
+ password: z31.string().describe("Basic auth password")
1103
1117
  }).optional().describe("Enable basic authentication for the site"),
1104
- security: z30.object({
1118
+ security: z31.object({
1105
1119
  // contentSecurityPolicy: z.object({
1106
1120
  // override: z.boolean().default(false),
1107
1121
  // policy: z.string(),
@@ -1143,10 +1157,10 @@ var SitesSchema = z30.record(
1143
1157
  // reportUri?: string
1144
1158
  // }
1145
1159
  }).optional().describe("Specify the security policy."),
1146
- cache: z30.object({
1147
- cookies: z30.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
1148
- headers: z30.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
1149
- queries: z30.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
1160
+ cache: z31.object({
1161
+ cookies: z31.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
1162
+ headers: z31.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
1163
+ queries: z31.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
1150
1164
  }).optional().describe(
1151
1165
  "Specifies the cookies, headers, and query values that CloudFront includes in the cache key."
1152
1166
  )
@@ -1154,22 +1168,21 @@ var SitesSchema = z30.record(
1154
1168
  ).optional().describe("Define the sites in your stack.");
1155
1169
 
1156
1170
  // src/feature/store/schema.ts
1157
- import { z as z31 } from "zod";
1158
- var StoresSchema = z31.union([
1159
- z31.array(ResourceIdSchema).transform((list) => {
1171
+ import { z as z32 } from "zod";
1172
+ var StoresSchema = z32.union([
1173
+ z32.array(ResourceIdSchema).transform((list) => {
1160
1174
  const stores = {};
1161
1175
  for (const key of list) {
1162
1176
  stores[key] = {};
1163
1177
  }
1164
1178
  return stores;
1165
1179
  }),
1166
- z31.record(
1180
+ z32.record(
1167
1181
  ResourceIdSchema,
1168
- z31.object({
1169
- // cors: CorsSchema,
1170
- // deletionProtection: DeletionProtectionSchema.optional(),
1171
- versioning: z31.boolean().default(false).describe("Enable versioning of your store."),
1172
- events: z31.object({
1182
+ z32.object({
1183
+ static: LocalDirectorySchema.optional().describe("Specifies the path to the static files directory."),
1184
+ versioning: z32.boolean().default(false).describe("Enable versioning of your store."),
1185
+ events: z32.object({
1173
1186
  // create
1174
1187
  "created:*": FunctionSchema.optional().describe(
1175
1188
  "Subscribe to notifications regardless of the API that was used to create an object."
@@ -1202,58 +1215,58 @@ var StoresSchema = z31.union([
1202
1215
  ]).optional().describe("Define the stores in your stack.");
1203
1216
 
1204
1217
  // src/feature/icon/schema.ts
1205
- import { z as z32 } from "zod";
1218
+ import { z as z33 } from "zod";
1206
1219
  var staticOriginSchema = LocalDirectorySchema.describe(
1207
1220
  "Specifies the path to a local image directory that will be uploaded in S3."
1208
1221
  );
1209
1222
  var functionOriginSchema = FunctionSchema.describe(
1210
1223
  "Specifies the file that will be called when an image isn't found in the (cache) bucket."
1211
1224
  );
1212
- var IconsSchema = z32.record(
1225
+ var IconsSchema = z33.record(
1213
1226
  ResourceIdSchema,
1214
- z32.object({
1227
+ z33.object({
1215
1228
  domain: ResourceIdSchema.describe("The domain id to link your site with.").optional(),
1216
- subDomain: z32.string().optional(),
1229
+ subDomain: z33.string().optional(),
1217
1230
  log: LogSchema.optional(),
1218
1231
  cacheDuration: DurationSchema.optional().describe("The cache duration of the cached icons."),
1219
- preserveId: z32.boolean().optional().default(false).describe("Preserve the IDs of the icons."),
1220
- symbols: z32.boolean().optional().default(false).describe("Use SVG symbols for icons."),
1221
- origin: z32.union([
1222
- z32.object({
1232
+ preserveId: z33.boolean().optional().default(false).describe("Preserve the IDs of the icons."),
1233
+ symbols: z33.boolean().optional().default(false).describe("Use SVG symbols for icons."),
1234
+ origin: z33.union([
1235
+ z33.object({
1223
1236
  static: staticOriginSchema,
1224
1237
  function: functionOriginSchema.optional()
1225
1238
  }),
1226
- z32.object({
1239
+ z33.object({
1227
1240
  static: staticOriginSchema.optional(),
1228
1241
  function: functionOriginSchema
1229
1242
  }),
1230
- z32.object({
1243
+ z33.object({
1231
1244
  static: staticOriginSchema,
1232
1245
  function: functionOriginSchema
1233
1246
  })
1234
1247
  ]).describe(
1235
1248
  "Image transformation will be applied from a base image. Base images orginates from a local directory that will be uploaded to S3 or from a lambda function."
1236
1249
  ),
1237
- cors: z32.object({
1238
- override: z32.boolean().default(true),
1250
+ cors: z33.object({
1251
+ override: z33.boolean().default(true),
1239
1252
  maxAge: DurationSchema.default("365 days"),
1240
- exposeHeaders: z32.string().array().optional(),
1241
- credentials: z32.boolean().default(false),
1242
- headers: z32.string().array().default(["*"]),
1243
- origins: z32.string().array().default(["*"])
1253
+ exposeHeaders: z33.string().array().optional(),
1254
+ credentials: z33.boolean().default(false),
1255
+ headers: z33.string().array().default(["*"]),
1256
+ origins: z33.string().array().default(["*"])
1244
1257
  }).optional().describe("Specify the cors headers.")
1245
1258
  // version: z.number().int().min(1).optional().describe('Version of the icon configuration.'),
1246
1259
  })
1247
1260
  ).optional().describe("Define an icon proxy in your stack. Store, optimize, and deliver icons at scale.");
1248
1261
 
1249
1262
  // src/feature/image/schema.ts
1250
- import { z as z33 } from "zod";
1251
- var transformationOptionsSchema = z33.object({
1252
- width: z33.number().int().positive().optional(),
1253
- height: z33.number().int().positive().optional(),
1254
- fit: z33.enum(["cover", "contain", "fill", "inside", "outside"]).optional(),
1255
- position: z33.enum(["top", "right top", "right", "right bottom", "bottom", "left bottom", "left", "left top", "center"]).optional(),
1256
- quality: z33.number().int().min(1).max(100).optional()
1263
+ import { z as z34 } from "zod";
1264
+ var transformationOptionsSchema = z34.object({
1265
+ width: z34.number().int().positive().optional(),
1266
+ height: z34.number().int().positive().optional(),
1267
+ fit: z34.enum(["cover", "contain", "fill", "inside", "outside"]).optional(),
1268
+ position: z34.enum(["top", "right top", "right", "right bottom", "bottom", "left bottom", "left", "left top", "center"]).optional(),
1269
+ quality: z34.number().int().min(1).max(100).optional()
1257
1270
  });
1258
1271
  var staticOriginSchema2 = LocalDirectorySchema.describe(
1259
1272
  "Specifies the path to a local image directory that will be uploaded in S3."
@@ -1261,68 +1274,115 @@ var staticOriginSchema2 = LocalDirectorySchema.describe(
1261
1274
  var functionOriginSchema2 = FunctionSchema.describe(
1262
1275
  "Specifies the file that will be called when an image isn't found in the (cache) bucket."
1263
1276
  );
1264
- var ImagesSchema = z33.record(
1277
+ var ImagesSchema = z34.record(
1265
1278
  ResourceIdSchema,
1266
- z33.object({
1279
+ z34.object({
1267
1280
  domain: ResourceIdSchema.describe("The domain id to link your site with.").optional(),
1268
- subDomain: z33.string().optional(),
1281
+ subDomain: z34.string().optional(),
1269
1282
  log: LogSchema.optional(),
1270
1283
  cacheDuration: DurationSchema.optional().describe("Cache duration of the cached images."),
1271
- presets: z33.record(z33.string(), transformationOptionsSchema).describe("Named presets for image transformations"),
1272
- extensions: z33.object({
1273
- jpeg: z33.object({
1274
- mozjpeg: z33.boolean().optional(),
1275
- progressive: z33.boolean().optional()
1284
+ presets: z34.record(z34.string(), transformationOptionsSchema).describe("Named presets for image transformations"),
1285
+ extensions: z34.object({
1286
+ jpeg: z34.object({
1287
+ mozjpeg: z34.boolean().optional(),
1288
+ progressive: z34.boolean().optional()
1276
1289
  }).optional(),
1277
- webp: z33.object({
1278
- effort: z33.number().int().min(1).max(10).default(7).optional(),
1279
- lossless: z33.boolean().optional(),
1280
- nearLossless: z33.boolean().optional()
1290
+ webp: z34.object({
1291
+ effort: z34.number().int().min(1).max(10).default(7).optional(),
1292
+ lossless: z34.boolean().optional(),
1293
+ nearLossless: z34.boolean().optional()
1281
1294
  }).optional(),
1282
- png: z33.object({
1283
- compressionLevel: z33.number().int().min(0).max(9).default(6).optional()
1295
+ png: z34.object({
1296
+ compressionLevel: z34.number().int().min(0).max(9).default(6).optional()
1284
1297
  }).optional()
1285
1298
  }).refine((data) => {
1286
1299
  return Object.keys(data).length > 0;
1287
1300
  }, "At least one extension must be defined.").describe("Specify the allowed extensions."),
1288
- origin: z33.union([
1289
- z33.object({
1301
+ origin: z34.union([
1302
+ z34.object({
1290
1303
  static: staticOriginSchema2,
1291
1304
  function: functionOriginSchema2.optional()
1292
1305
  }),
1293
- z33.object({
1306
+ z34.object({
1294
1307
  static: staticOriginSchema2.optional(),
1295
1308
  function: functionOriginSchema2
1296
1309
  }),
1297
- z33.object({
1310
+ z34.object({
1298
1311
  static: staticOriginSchema2,
1299
1312
  function: functionOriginSchema2
1300
1313
  })
1301
1314
  ]).describe(
1302
1315
  "Specify the origin of your images. Image transformation will be applied from a base image. Base images can be loaded from a S3 bucket (that is synced from a local directory) or dynamicly from a lambda function."
1303
1316
  ),
1304
- version: z33.number().int().min(1).optional().describe("Version of the image configuration.")
1317
+ version: z34.number().int().min(1).optional().describe("Version of the image configuration.")
1305
1318
  })
1306
1319
  ).optional().describe("Define an image proxy in your stack. Store, transform, optimize, and deliver images at scale.");
1307
1320
 
1321
+ // src/feature/metric/schema.ts
1322
+ import { z as z35 } from "zod";
1323
+ var ops = {
1324
+ ">": "GreaterThanThreshold",
1325
+ ">=": "GreaterThanOrEqualToThreshold",
1326
+ "<": "LessThanThreshold",
1327
+ "<=": "LessThanOrEqualToThreshold"
1328
+ };
1329
+ var stats = {
1330
+ count: "SampleCount",
1331
+ avg: "Average",
1332
+ sum: "Sum",
1333
+ min: "Minimum",
1334
+ max: "Maximum"
1335
+ };
1336
+ var WhereSchema = z35.union([
1337
+ z35.string().regex(/(count|avg|sum|min|max) (>|>=|<|<=) (\d)/, "Invalid where query").transform((where) => {
1338
+ const [stat4, op, value] = where.split(" ");
1339
+ return { stat: stat4, op, value: parseFloat(value) };
1340
+ }),
1341
+ z35.object({
1342
+ stat: z35.enum(["count", "avg", "sum", "min", "max"]),
1343
+ op: z35.enum([">", ">=", "<", "<="]),
1344
+ value: z35.number()
1345
+ })
1346
+ ]).transform((where) => {
1347
+ return {
1348
+ stat: stats[where.stat],
1349
+ op: ops[where.op],
1350
+ value: where.value
1351
+ };
1352
+ });
1353
+ var AlarmSchema = z35.object({
1354
+ description: z35.string().optional(),
1355
+ where: WhereSchema,
1356
+ period: DurationSchema,
1357
+ minDataPoints: z35.number().int().default(1),
1358
+ trigger: z35.union([EmailSchema.transform((v) => [v]), EmailSchema.array(), FunctionSchema])
1359
+ });
1360
+ var MetricsSchema = z35.record(
1361
+ ResourceIdSchema,
1362
+ z35.object({
1363
+ type: z35.enum(["number", "size", "duration"]),
1364
+ alarms: AlarmSchema.array().optional()
1365
+ })
1366
+ ).optional().describe("Define the metrics in your stack.");
1367
+
1308
1368
  // src/feature/table/schema.ts
1309
1369
  import { minutes as minutes4, seconds as seconds4 } from "@awsless/duration";
1310
- import { z as z34 } from "zod";
1311
- var KeySchema = z34.string().min(1).max(255);
1312
- var TablesSchema = z34.record(
1370
+ import { z as z36 } from "zod";
1371
+ var KeySchema = z36.string().min(1).max(255);
1372
+ var TablesSchema = z36.record(
1313
1373
  ResourceIdSchema,
1314
- z34.object({
1374
+ z36.object({
1315
1375
  hash: KeySchema.describe(
1316
1376
  "Specifies the name of the partition / hash key that makes up the primary key for the table."
1317
1377
  ),
1318
1378
  sort: KeySchema.optional().describe(
1319
1379
  "Specifies the name of the range / sort key that makes up the primary key for the table."
1320
1380
  ),
1321
- fields: z34.record(z34.string(), z34.enum(["string", "number", "binary"])).optional().describe(
1381
+ fields: z36.record(z36.string(), z36.enum(["string", "number", "binary"])).optional().describe(
1322
1382
  'A list of attributes that describe the key schema for the table and indexes. If no attribute field is defined we default to "string".'
1323
1383
  ),
1324
- class: z34.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
1325
- pointInTimeRecovery: z34.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
1384
+ class: z36.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
1385
+ pointInTimeRecovery: z36.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
1326
1386
  ttl: KeySchema.optional().describe(
1327
1387
  [
1328
1388
  "The name of the TTL attribute used to store the expiration time for items in the table.",
@@ -1330,8 +1390,8 @@ var TablesSchema = z34.record(
1330
1390
  ].join("\n")
1331
1391
  ),
1332
1392
  // deletionProtection: DeletionProtectionSchema.optional(),
1333
- stream: z34.object({
1334
- type: z34.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
1393
+ stream: z36.object({
1394
+ type: z36.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
1335
1395
  [
1336
1396
  "When an item in the table is modified, you can determines what information is written to the stream for this table.",
1337
1397
  "Valid values are:",
@@ -1341,7 +1401,7 @@ var TablesSchema = z34.record(
1341
1401
  "- new-and-old-images - Both the new and the old item images of the item are written to the stream."
1342
1402
  ].join("\n")
1343
1403
  ),
1344
- batchSize: z34.number().min(1).max(1e4).default(1).describe(
1404
+ batchSize: z36.number().min(1).max(1e4).default(1).describe(
1345
1405
  [
1346
1406
  "The maximum number of records in each batch that Lambda pulls from your stream and sends to your function.",
1347
1407
  "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).",
@@ -1371,7 +1431,7 @@ var TablesSchema = z34.record(
1371
1431
  // 'You can specify a number from -1 to 10000.',
1372
1432
  // ].join('\n')
1373
1433
  // ),
1374
- retryAttempts: z34.number().min(-1).max(1e4).default(-1).describe(
1434
+ retryAttempts: z36.number().min(-1).max(1e4).default(-1).describe(
1375
1435
  [
1376
1436
  "Discard records after the specified number of retries.",
1377
1437
  "The default value is -1, which sets the maximum number of retries to infinite.",
@@ -1379,7 +1439,7 @@ var TablesSchema = z34.record(
1379
1439
  "You can specify a number from -1 to 10000."
1380
1440
  ].join("\n")
1381
1441
  ),
1382
- concurrencyPerShard: z34.number().min(1).max(10).default(1).describe(
1442
+ concurrencyPerShard: z36.number().min(1).max(10).default(1).describe(
1383
1443
  [
1384
1444
  "The number of batches to process concurrently from each shard.",
1385
1445
  "You can specify a number from 1 to 10."
@@ -1389,16 +1449,16 @@ var TablesSchema = z34.record(
1389
1449
  }).optional().describe(
1390
1450
  "The settings for the DynamoDB table stream, which capture changes to items stored in the table."
1391
1451
  ),
1392
- indexes: z34.record(
1393
- z34.string(),
1394
- z34.object({
1452
+ indexes: z36.record(
1453
+ z36.string(),
1454
+ z36.object({
1395
1455
  hash: KeySchema.describe(
1396
1456
  "Specifies the name of the partition / hash key that makes up the primary key for the global secondary index."
1397
1457
  ),
1398
1458
  sort: KeySchema.optional().describe(
1399
1459
  "Specifies the name of the range / sort key that makes up the primary key for the global secondary index."
1400
1460
  ),
1401
- projection: z34.enum(["all", "keys-only"]).default("all").describe(
1461
+ projection: z36.enum(["all", "keys-only"]).default("all").describe(
1402
1462
  [
1403
1463
  "The set of attributes that are projected into the index:",
1404
1464
  "- all - All of the table attributes are projected into the index.",
@@ -1412,11 +1472,11 @@ var TablesSchema = z34.record(
1412
1472
  ).optional().describe("Define the tables in your stack.");
1413
1473
 
1414
1474
  // src/feature/task/schema.ts
1415
- import { z as z35 } from "zod";
1416
- var RetryAttemptsSchema2 = z35.number().int().min(0).max(2).describe(
1475
+ import { z as z37 } from "zod";
1476
+ var RetryAttemptsSchema2 = z37.number().int().min(0).max(2).describe(
1417
1477
  "The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
1418
1478
  );
1419
- var TaskSchema = z35.union([
1479
+ var TaskSchema = z37.union([
1420
1480
  LocalFileSchema.transform((file) => ({
1421
1481
  consumer: {
1422
1482
  code: {
@@ -1427,33 +1487,24 @@ var TaskSchema = z35.union([
1427
1487
  },
1428
1488
  retryAttempts: void 0
1429
1489
  })),
1430
- z35.object({
1490
+ z37.object({
1431
1491
  consumer: FunctionSchema,
1432
1492
  retryAttempts: RetryAttemptsSchema2.optional()
1433
1493
  })
1434
1494
  ]);
1435
- var TasksSchema = z35.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
1495
+ var TasksSchema = z37.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
1436
1496
 
1437
1497
  // src/feature/test/schema.ts
1438
- import { z as z36 } from "zod";
1439
- var TestsSchema = z36.union([LocalDirectorySchema.transform((v) => [v]), LocalDirectorySchema.array()]).describe("Define the location of your tests for your stack.").optional();
1440
-
1441
- // src/feature/topic/schema.ts
1442
- import { kebabCase as kebabCase3 } from "change-case";
1443
- import { z as z37 } from "zod";
1444
- var TopicNameSchema = z37.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => kebabCase3(value)).describe("Define event topic name.");
1445
- var TopicsSchema = z37.array(TopicNameSchema).refine((topics) => {
1446
- return topics.length === new Set(topics).size;
1447
- }, "Must be a list of unique topic names").optional().describe("Define the event topics to publish too in your stack.");
1448
- var SubscribersSchema = z37.record(TopicNameSchema, FunctionSchema).optional().describe("Define the event topics to subscribe too in your stack.");
1498
+ import { z as z38 } from "zod";
1499
+ var TestsSchema = z38.union([LocalDirectorySchema.transform((v) => [v]), LocalDirectorySchema.array()]).describe("Define the location of your tests for your stack.").optional();
1449
1500
 
1450
1501
  // src/config/stack.ts
1451
1502
  var DependsSchema = ResourceIdSchema.array().optional().describe("Define the stacks that this stack is depended on.");
1452
1503
  var NameSchema = ResourceIdSchema.refine((name) => !["base", "hostedzones"].includes(name), {
1453
1504
  message: `Stack name can't be a reserved name.`
1454
1505
  }).describe("Stack name.");
1455
- var StackSchema = z38.object({
1456
- $schema: z38.string().optional(),
1506
+ var StackSchema = z39.object({
1507
+ $schema: z39.string().optional(),
1457
1508
  name: NameSchema,
1458
1509
  depends: DependsSchema,
1459
1510
  commands: CommandsSchema,
@@ -1466,7 +1517,7 @@ var StackSchema = z38.object({
1466
1517
  configs: ConfigsSchema,
1467
1518
  crons: CronsSchema,
1468
1519
  caches: CachesSchema,
1469
- topics: TopicsSchema,
1520
+ // topics: TopicsSchema,
1470
1521
  subscribers: SubscribersSchema,
1471
1522
  functions: FunctionsSchema,
1472
1523
  instances: InstancesSchema,
@@ -1480,7 +1531,8 @@ var StackSchema = z38.object({
1480
1531
  sites: SitesSchema,
1481
1532
  tests: TestsSchema,
1482
1533
  images: ImagesSchema,
1483
- icons: IconsSchema
1534
+ icons: IconsSchema,
1535
+ metrics: MetricsSchema
1484
1536
  });
1485
1537
 
1486
1538
  // cli/build-json-schema.ts