@awsless/awsless 0.0.411 → 0.0.413

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/bin.js CHANGED
@@ -596,9 +596,9 @@ var require_Alias = __commonJS({
596
596
  var anchors = require_anchors();
597
597
  var visit = require_visit();
598
598
  var identity = require_identity();
599
- var Node25 = require_Node();
599
+ var Node26 = require_Node();
600
600
  var toJS = require_toJS();
601
- var Alias = class extends Node25.NodeBase {
601
+ var Alias = class extends Node26.NodeBase {
602
602
  constructor(source) {
603
603
  super(identity.ALIAS);
604
604
  this.source = source;
@@ -696,10 +696,10 @@ var require_Scalar = __commonJS({
696
696
  "../../node_modules/.pnpm/yaml@2.5.0/node_modules/yaml/dist/nodes/Scalar.js"(exports) {
697
697
  "use strict";
698
698
  var identity = require_identity();
699
- var Node25 = require_Node();
699
+ var Node26 = require_Node();
700
700
  var toJS = require_toJS();
701
701
  var isScalarValue = (value) => !value || typeof value !== "function" && typeof value !== "object";
702
- var Scalar = class extends Node25.NodeBase {
702
+ var Scalar = class extends Node26.NodeBase {
703
703
  constructor(value) {
704
704
  super(identity.SCALAR);
705
705
  this.value = value;
@@ -803,7 +803,7 @@ var require_Collection = __commonJS({
803
803
  "use strict";
804
804
  var createNode = require_createNode();
805
805
  var identity = require_identity();
806
- var Node25 = require_Node();
806
+ var Node26 = require_Node();
807
807
  function collectionFromPath(schema, path, value) {
808
808
  let v = value;
809
809
  for (let i = path.length - 1; i >= 0; --i) {
@@ -827,7 +827,7 @@ var require_Collection = __commonJS({
827
827
  });
828
828
  }
829
829
  var isEmptyPath = (path) => path == null || typeof path === "object" && !!path[Symbol.iterator]().next().done;
830
- var Collection = class extends Node25.NodeBase {
830
+ var Collection = class extends Node26.NodeBase {
831
831
  constructor(type, schema) {
832
832
  super(type);
833
833
  Object.defineProperty(this, "schema", {
@@ -7566,25 +7566,44 @@ var debug = (...parts) => {
7566
7566
  };
7567
7567
 
7568
7568
  // src/config/app.ts
7569
- import { z as z22 } from "zod";
7569
+ import { z as z23 } from "zod";
7570
+
7571
+ // src/feature/alert/schema.ts
7572
+ import { paramCase } from "change-case";
7573
+ import { z as z2 } from "zod";
7574
+
7575
+ // src/config/schema/email.ts
7576
+ import { z } from "zod";
7577
+ var EmailSchema = z.string().email();
7578
+
7579
+ // src/feature/alert/schema.ts
7580
+ var AlertNameSchema = z2.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid alert name").transform((value) => paramCase(value)).describe("Define event topic name.");
7581
+ var AlertsDefaultSchema = z2.record(
7582
+ AlertNameSchema,
7583
+ z2.union([
7584
+ //
7585
+ EmailSchema.transform((v) => [v]),
7586
+ EmailSchema.array()
7587
+ ])
7588
+ ).optional().describe("Define the alerts in your app. Alerts are a way to send messages to one or more email addresses.");
7570
7589
 
7571
7590
  // src/feature/auth/schema.ts
7572
- import { z as z7 } from "zod";
7591
+ import { z as z8 } from "zod";
7573
7592
 
7574
7593
  // src/config/schema/resource-id.ts
7575
- import { paramCase } from "change-case";
7576
- import { z } from "zod";
7577
- var ResourceIdSchema = z.string().min(3).max(24).regex(/^[a-z0-9\-]+$/i, "Invalid resource ID").transform((value) => paramCase(value));
7594
+ import { paramCase as paramCase2 } from "change-case";
7595
+ import { z as z3 } from "zod";
7596
+ var ResourceIdSchema = z3.string().min(3).max(24).regex(/^[a-z0-9\-]+$/i, "Invalid resource ID").transform((value) => paramCase2(value));
7578
7597
 
7579
7598
  // src/feature/function/schema.ts
7580
7599
  import { days, minutes as minutes2, seconds, toDays } from "@awsless/duration";
7581
7600
  import { gibibytes, mebibytes } from "@awsless/size";
7582
- import { z as z5 } from "zod";
7601
+ import { z as z7 } from "zod";
7583
7602
 
7584
7603
  // src/config/schema/duration.ts
7585
- import { z as z2 } from "zod";
7604
+ import { z as z4 } from "zod";
7586
7605
  import { parse } from "@awsless/duration";
7587
- var DurationSchema = z2.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/, "Invalid duration").transform((v) => parse(v));
7606
+ var DurationSchema = z4.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/, "Invalid duration").transform((v) => parse(v));
7588
7607
  var durationMin = (min) => {
7589
7608
  return (duration) => {
7590
7609
  return duration.value >= min.value;
@@ -7598,7 +7617,7 @@ var durationMax = (max) => {
7598
7617
 
7599
7618
  // src/config/schema/local-file.ts
7600
7619
  import { stat } from "fs/promises";
7601
- import { z as z3 } from "zod";
7620
+ import { z as z5 } from "zod";
7602
7621
  import { join as join3 } from "path";
7603
7622
  var basePath;
7604
7623
  var setLocalBasePath = (path) => {
@@ -7610,7 +7629,7 @@ var resolvePath = (path) => {
7610
7629
  }
7611
7630
  return join3(directories.root, path);
7612
7631
  };
7613
- var LocalFileSchema = z3.string().transform((path) => resolvePath(path)).refine(async (path) => {
7632
+ var LocalFileSchema = z5.string().transform((path) => resolvePath(path)).refine(async (path) => {
7614
7633
  try {
7615
7634
  const s = await stat(path);
7616
7635
  return s.isFile();
@@ -7620,9 +7639,9 @@ var LocalFileSchema = z3.string().transform((path) => resolvePath(path)).refine(
7620
7639
  }, `File doesn't exist`);
7621
7640
 
7622
7641
  // src/config/schema/size.ts
7623
- import { z as z4 } from "zod";
7642
+ import { z as z6 } from "zod";
7624
7643
  import { parse as parse2 } from "@awsless/size";
7625
- var SizeSchema = z4.string().regex(/^[0-9]+ (B|KB|MB|GB|TB|PB)$/, "Invalid size").transform((v) => parse2(v));
7644
+ var SizeSchema = z6.string().regex(/^[0-9]+ (B|KB|MB|GB|TB|PB)$/, "Invalid size").transform((v) => parse2(v));
7626
7645
  var sizeMin = (min) => {
7627
7646
  return (size) => {
7628
7647
  return size.value >= min.value;
@@ -7645,33 +7664,33 @@ var EphemeralStorageSizeSchema = SizeSchema.refine(
7645
7664
  sizeMin(mebibytes(512)),
7646
7665
  "Minimum ephemeral storage size is 512 MB"
7647
7666
  ).refine(sizeMax(gibibytes(10)), "Minimum ephemeral storage size is 10 GB").describe("The size of the function's /tmp directory. You can specify a size value from 512 MB to 10 GB.");
7648
- var ReservedConcurrentExecutionsSchema = z5.number().int().min(0).describe("The number of simultaneous executions to reserve for the function. You can specify a number from 0.");
7649
- var EnvironmentSchema = z5.record(z5.string(), z5.string()).optional().describe("Environment variable key-value pairs.");
7650
- var ArchitectureSchema = z5.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the function supports.");
7651
- var RetryAttemptsSchema = z5.number().int().min(0).max(2).describe(
7667
+ var ReservedConcurrentExecutionsSchema = z7.number().int().min(0).describe("The number of simultaneous executions to reserve for the function. You can specify a number from 0.");
7668
+ var EnvironmentSchema = z7.record(z7.string(), z7.string()).optional().describe("Environment variable key-value pairs.");
7669
+ var ArchitectureSchema = z7.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the function supports.");
7670
+ var RetryAttemptsSchema = z7.number().int().min(0).max(2).describe(
7652
7671
  "The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
7653
7672
  );
7654
- var NodeRuntimeSchema = z5.enum(["nodejs18.x", "nodejs20.x"]).describe("The identifier of the function's runtime.");
7655
- var ContainerRuntimeSchema = z5.literal("container").describe("The identifier of the function's runtime.");
7673
+ var NodeRuntimeSchema = z7.enum(["nodejs18.x", "nodejs20.x"]).describe("The identifier of the function's runtime.");
7674
+ var ContainerRuntimeSchema = z7.literal("container").describe("The identifier of the function's runtime.");
7656
7675
  var RuntimeSchema = NodeRuntimeSchema.or(ContainerRuntimeSchema);
7657
- var ActionSchema = z5.string();
7658
- var ActionsSchema = z5.union([ActionSchema.transform((v) => [v]), ActionSchema.array()]);
7659
- var ArnSchema = z5.string().startsWith("arn:").transform((v) => v);
7660
- var WildcardSchema = z5.literal("*");
7661
- var ResourceSchema = z5.union([ArnSchema, WildcardSchema]);
7662
- var ResourcesSchema = z5.union([ResourceSchema.transform((v) => [v]), ResourceSchema.array()]);
7663
- var PermissionSchema = z5.object({
7664
- effect: z5.enum(["allow", "deny"]).default("allow"),
7676
+ var ActionSchema = z7.string();
7677
+ var ActionsSchema = z7.union([ActionSchema.transform((v) => [v]), ActionSchema.array()]);
7678
+ var ArnSchema = z7.string().startsWith("arn:").transform((v) => v);
7679
+ var WildcardSchema = z7.literal("*");
7680
+ var ResourceSchema = z7.union([ArnSchema, WildcardSchema]);
7681
+ var ResourcesSchema = z7.union([ResourceSchema.transform((v) => [v]), ResourceSchema.array()]);
7682
+ var PermissionSchema = z7.object({
7683
+ effect: z7.enum(["allow", "deny"]).default("allow"),
7665
7684
  actions: ActionsSchema,
7666
7685
  resources: ResourcesSchema
7667
7686
  });
7668
- var PermissionsSchema = z5.union([PermissionSchema.transform((v) => [v]), PermissionSchema.array()]).describe("Add IAM permissions to your function.");
7669
- var WarmSchema = z5.number().int().min(0).max(10).describe("Specify how many functions you want to warm up each 5 minutes. You can specify a number from 0 to 10.");
7670
- var VPCSchema = z5.boolean().describe("Put the function inside your global VPC.");
7671
- var MinifySchema = z5.boolean().describe("Minify the function code.");
7672
- var HandlerSchema = z5.string().describe("The name of the exported method within your code that Lambda calls to run your function.");
7687
+ var PermissionsSchema = z7.union([PermissionSchema.transform((v) => [v]), PermissionSchema.array()]).describe("Add IAM permissions to your function.");
7688
+ var WarmSchema = z7.number().int().min(0).max(10).describe("Specify how many functions you want to warm up each 5 minutes. You can specify a number from 0 to 10.");
7689
+ var VPCSchema = z7.boolean().describe("Put the function inside your global VPC.");
7690
+ var MinifySchema = z7.boolean().describe("Minify the function code.");
7691
+ var HandlerSchema = z7.string().describe("The name of the exported method within your code that Lambda calls to run your function.");
7673
7692
  var FileSchema = LocalFileSchema.describe("The file path of the function code.");
7674
- var DescriptionSchema = z5.string().describe("A description of the function.");
7693
+ var DescriptionSchema = z7.string().describe("A description of the function.");
7675
7694
  var validLogRetentionDays = [
7676
7695
  ...[1n, 3n, 5n, 7n, 14n, 30n, 60n, 90n, 120n, 150n],
7677
7696
  ...[180n, 365n, 400n, 545n, 731n, 1096n, 1827n, 2192n],
@@ -7686,30 +7705,30 @@ var LogRetentionSchema = DurationSchema.refine(
7686
7705
  },
7687
7706
  `Invalid log retention. Valid days are: ${validLogRetentionDays.map((days7) => `${days7}`).join(", ")}`
7688
7707
  ).describe("The log retention duration.");
7689
- var LogSubscriptionSchema = z5.union([
7708
+ var LogSubscriptionSchema = z7.union([
7690
7709
  LocalFileSchema.transform((file) => ({
7691
7710
  file
7692
7711
  })),
7693
- z5.object({
7712
+ z7.object({
7694
7713
  subscriber: LocalFileSchema,
7695
- filter: z5.string().optional()
7714
+ filter: z7.string().optional()
7696
7715
  })
7697
7716
  ]).describe(
7698
7717
  "Log Subscription allow you to subscribe to a real-time stream of log events and have them delivered to a specific destination"
7699
7718
  );
7700
- var LogSchema = z5.union([
7701
- z5.boolean().transform((enabled) => ({ retention: enabled ? days(7) : days(0) })),
7719
+ var LogSchema = z7.union([
7720
+ z7.boolean().transform((enabled) => ({ retention: enabled ? days(7) : days(0) })),
7702
7721
  LogRetentionSchema.transform((retention) => ({ retention })),
7703
- z5.object({
7722
+ z7.object({
7704
7723
  subscription: LogSubscriptionSchema.optional(),
7705
7724
  retention: LogRetentionSchema.optional(),
7706
- format: z5.enum(["text", "json"]).describe(
7725
+ format: z7.enum(["text", "json"]).describe(
7707
7726
  `The format in which Lambda sends your function's application and system logs to CloudWatch. Select between plain text and structured JSON.`
7708
7727
  ).optional(),
7709
- system: z5.enum(["debug", "info", "warn"]).describe(
7728
+ system: z7.enum(["debug", "info", "warn"]).describe(
7710
7729
  "Set this property to filter the system logs for your function that Lambda sends to CloudWatch. Lambda only sends system logs at the selected level of detail and lower, where DEBUG is the highest level and WARN is the lowest."
7711
7730
  ).optional(),
7712
- level: z5.enum(["trace", "debug", "info", "warn", "error", "fatal"]).describe(
7731
+ level: z7.enum(["trace", "debug", "info", "warn", "error", "fatal"]).describe(
7713
7732
  "Set this property to filter the application logs for your function that Lambda sends to CloudWatch. Lambda only sends application logs at the selected level of detail and lower, where TRACE is the highest level and FATAL is the lowest."
7714
7733
  ).optional()
7715
7734
  })
@@ -7717,11 +7736,11 @@ var LogSchema = z5.union([
7717
7736
  var LayersSchema = ArnSchema.array().describe(
7718
7737
  `A list of function layers to add to the function's execution environment. Specify each layer by its ARN, including the version.`
7719
7738
  );
7720
- var BuildSchema = z5.object({
7739
+ var BuildSchema = z7.object({
7721
7740
  minify: MinifySchema.default(true),
7722
- external: z5.string().array().optional().describe(`A list of external packages that won't be included in the bundle.`)
7741
+ external: z7.string().array().optional().describe(`A list of external packages that won't be included in the bundle.`)
7723
7742
  }).describe(`Options for the function bundler`);
7724
- var FnSchema = z5.object({
7743
+ var FnSchema = z7.object({
7725
7744
  file: FileSchema,
7726
7745
  // node
7727
7746
  handler: HandlerSchema.optional(),
@@ -7743,14 +7762,14 @@ var FnSchema = z5.object({
7743
7762
  environment: EnvironmentSchema.optional(),
7744
7763
  permissions: PermissionsSchema.optional()
7745
7764
  });
7746
- var FunctionSchema = z5.union([
7765
+ var FunctionSchema = z7.union([
7747
7766
  LocalFileSchema.transform((file) => ({
7748
7767
  file
7749
7768
  })),
7750
7769
  FnSchema
7751
7770
  ]);
7752
- var FunctionsSchema = z5.record(ResourceIdSchema, FunctionSchema).optional().describe("Define the functions in your stack.");
7753
- var FunctionDefaultSchema = z5.object({
7771
+ var FunctionsSchema = z7.record(ResourceIdSchema, FunctionSchema).optional().describe("Define the functions in your stack.");
7772
+ var FunctionDefaultSchema = z7.object({
7754
7773
  runtime: RuntimeSchema.default("nodejs20.x"),
7755
7774
  // node
7756
7775
  handler: HandlerSchema.default("index.default"),
@@ -7777,15 +7796,8 @@ var FunctionDefaultSchema = z5.object({
7777
7796
  permissions: PermissionsSchema.optional()
7778
7797
  }).default({});
7779
7798
 
7780
- // src/config/schema/email.ts
7781
- import { z as z6 } from "zod";
7782
- var EmailSchema = z6.string().email();
7783
- var isEmail = (value) => {
7784
- return EmailSchema.safeParse(value).success;
7785
- };
7786
-
7787
7799
  // src/feature/auth/schema.ts
7788
- var TriggersSchema = z7.object({
7800
+ var TriggersSchema = z8.object({
7789
7801
  beforeToken: FunctionSchema.optional().describe("A pre jwt token generation AWS Lambda trigger."),
7790
7802
  beforeLogin: FunctionSchema.optional().describe("A pre user login AWS Lambda trigger."),
7791
7803
  afterLogin: FunctionSchema.optional().describe("A post user login AWS Lambda trigger."),
@@ -7798,42 +7810,42 @@ var TriggersSchema = z7.object({
7798
7810
  createChallenge: FunctionSchema.optional().describe("Creates an authentication challenge."),
7799
7811
  verifyChallenge: FunctionSchema.optional().describe("Verifies the authentication challenge response.")
7800
7812
  }).describe("Specifies the configuration for AWS Lambda triggers.");
7801
- var AuthSchema = z7.record(
7813
+ var AuthSchema = z8.record(
7802
7814
  ResourceIdSchema,
7803
- z7.object({
7804
- access: z7.boolean().default(false).describe("Give access to every function in this stack to your cognito instance."),
7815
+ z8.object({
7816
+ access: z8.boolean().default(false).describe("Give access to every function in this stack to your cognito instance."),
7805
7817
  triggers: TriggersSchema.optional()
7806
7818
  })
7807
7819
  ).optional().describe("Define the auth triggers in your stack.");
7808
- var AuthDefaultSchema = z7.record(
7820
+ var AuthDefaultSchema = z8.record(
7809
7821
  ResourceIdSchema,
7810
- z7.object({
7811
- allowUserRegistration: z7.boolean().default(true).describe("Specifies whether users can create an user account or if only the administrator can."),
7812
- messaging: z7.object({
7822
+ z8.object({
7823
+ allowUserRegistration: z8.boolean().default(true).describe("Specifies whether users can create an user account or if only the administrator can."),
7824
+ messaging: z8.object({
7813
7825
  fromEmail: EmailSchema.describe("Specifies the sender's email address."),
7814
- fromName: z7.string().optional().describe("Specifies the sender's name."),
7826
+ fromName: z8.string().optional().describe("Specifies the sender's name."),
7815
7827
  replyTo: EmailSchema.optional().describe(
7816
7828
  "The destination to which the receiver of the email should reply."
7817
7829
  )
7818
7830
  }).optional().describe("The email configuration for sending messages."),
7819
7831
  // secret: z.boolean().default(false).describe('Specifies whether you want to generate a client secret.'),
7820
- username: z7.object({
7821
- emailAlias: z7.boolean().default(true).describe("Allow the user email to be used as username."),
7822
- caseSensitive: z7.boolean().default(false).describe(
7832
+ username: z8.object({
7833
+ emailAlias: z8.boolean().default(true).describe("Allow the user email to be used as username."),
7834
+ caseSensitive: z8.boolean().default(false).describe(
7823
7835
  "Specifies whether username case sensitivity will be enabled. When usernames and email addresses are case insensitive, users can sign in as the same user when they enter a different capitalization of their user name."
7824
7836
  )
7825
7837
  }).default({}).describe("The username policy."),
7826
- password: z7.object({
7827
- minLength: z7.number().int().min(6).max(99).default(12).describe("Required users to have at least the minimum password length."),
7828
- uppercase: z7.boolean().default(true).describe("Required users to use at least one uppercase letter in their password."),
7829
- lowercase: z7.boolean().default(true).describe("Required users to use at least one lowercase letter in their password."),
7830
- numbers: z7.boolean().default(true).describe("Required users to use at least one number in their password."),
7831
- symbols: z7.boolean().default(true).describe("Required users to use at least one symbol in their password."),
7838
+ password: z8.object({
7839
+ minLength: z8.number().int().min(6).max(99).default(12).describe("Required users to have at least the minimum password length."),
7840
+ uppercase: z8.boolean().default(true).describe("Required users to use at least one uppercase letter in their password."),
7841
+ lowercase: z8.boolean().default(true).describe("Required users to use at least one lowercase letter in their password."),
7842
+ numbers: z8.boolean().default(true).describe("Required users to use at least one number in their password."),
7843
+ symbols: z8.boolean().default(true).describe("Required users to use at least one symbol in their password."),
7832
7844
  temporaryPasswordValidity: DurationSchema.default("7 days").describe(
7833
7845
  "The duration a temporary password is valid. If the user doesn't sign in during this time, an administrator must reset their password."
7834
7846
  )
7835
7847
  }).default({}).describe("The password policy."),
7836
- validity: z7.object({
7848
+ validity: z8.object({
7837
7849
  idToken: DurationSchema.default("1 hour").describe(
7838
7850
  "The ID token time limit. After this limit expires, your user can't use their ID token."
7839
7851
  ),
@@ -7849,18 +7861,18 @@ var AuthDefaultSchema = z7.record(
7849
7861
  ).default({}).describe("Define the authenticatable users in your app.");
7850
7862
 
7851
7863
  // src/feature/domain/schema.ts
7852
- import { z as z8 } from "zod";
7853
- var DomainNameSchema = z8.string().regex(/[a-z\-\_\.]/g, "Invalid domain name").describe(
7864
+ import { z as z9 } from "zod";
7865
+ var DomainNameSchema = z9.string().regex(/[a-z\-\_\.]/g, "Invalid domain name").describe(
7854
7866
  "Enter a fully qualified domain name, for example, www.example.com. You can optionally include a trailing dot. If you omit the trailing dot, Amazon Route 53 assumes that the domain name that you specify is fully qualified. This means that Route 53 treats www.example.com (without a trailing dot) and www.example.com. (with a trailing dot) as identical."
7855
7867
  );
7856
- var DNSTypeSchema = z8.enum(["A", "AAAA", "CAA", "CNAME", "DS", "MX", "NAPTR", "NS", "PTR", "SOA", "SPF", "SRV", "TXT"]).describe("The DNS record type.");
7868
+ var DNSTypeSchema = z9.enum(["A", "AAAA", "CAA", "CNAME", "DS", "MX", "NAPTR", "NS", "PTR", "SOA", "SPF", "SRV", "TXT"]).describe("The DNS record type.");
7857
7869
  var TTLSchema = DurationSchema.describe("The resource record cache time to live (TTL).");
7858
- var RecordsSchema = z8.string().array().describe("One or more values that correspond with the value that you specified for the Type property.");
7859
- var DomainsDefaultSchema = z8.record(
7870
+ var RecordsSchema = z9.string().array().describe("One or more values that correspond with the value that you specified for the Type property.");
7871
+ var DomainsDefaultSchema = z9.record(
7860
7872
  ResourceIdSchema,
7861
- z8.object({
7873
+ z9.object({
7862
7874
  domain: DomainNameSchema.describe("Define the domain name"),
7863
- dns: z8.object({
7875
+ dns: z9.object({
7864
7876
  name: DomainNameSchema.optional(),
7865
7877
  type: DNSTypeSchema,
7866
7878
  ttl: TTLSchema,
@@ -7870,18 +7882,18 @@ var DomainsDefaultSchema = z8.record(
7870
7882
  ).optional().describe("Define the domains for your application.");
7871
7883
 
7872
7884
  // src/feature/graphql/schema.ts
7873
- import { z as z9 } from "zod";
7885
+ import { z as z10 } from "zod";
7874
7886
  var AuthorizerTtl = DurationSchema.describe(
7875
7887
  `The number of seconds a response should be cached for. The maximum value is one hour (3600 seconds). The Lambda function can override this by returning a ttlOverride key in its response.`
7876
7888
  );
7877
- var GraphQLDefaultSchema = z9.record(
7889
+ var GraphQLDefaultSchema = z10.record(
7878
7890
  ResourceIdSchema,
7879
- z9.object({
7891
+ z10.object({
7880
7892
  domain: ResourceIdSchema.describe("The domain id to link your API with.").optional(),
7881
- subDomain: z9.string().optional(),
7882
- auth: z9.union([
7893
+ subDomain: z10.string().optional(),
7894
+ auth: z10.union([
7883
7895
  ResourceIdSchema,
7884
- z9.object({
7896
+ z10.object({
7885
7897
  authorizer: FunctionSchema,
7886
7898
  ttl: AuthorizerTtl.default("1 hour")
7887
7899
  })
@@ -7893,22 +7905,22 @@ var GraphQLDefaultSchema = z9.record(
7893
7905
  resolver: LocalFileSchema.optional()
7894
7906
  })
7895
7907
  ).describe(`Define the global GraphQL API's.`).optional();
7896
- var GraphQLSchema = z9.record(
7908
+ var GraphQLSchema = z10.record(
7897
7909
  ResourceIdSchema,
7898
- z9.object({
7910
+ z10.object({
7899
7911
  // schema: z.union([LocalFileSchema.transform(v => [v]), z.array(LocalFileSchema).min(1)]).optional(),
7900
7912
  schema: LocalFileSchema.describe("The graphql schema file."),
7901
- resolvers: z9.record(
7913
+ resolvers: z10.record(
7902
7914
  // TypeName
7903
- z9.string(),
7904
- z9.record(
7915
+ z10.string(),
7916
+ z10.record(
7905
7917
  // FieldName
7906
- z9.string(),
7907
- z9.union([
7918
+ z10.string(),
7919
+ z10.union([
7908
7920
  FunctionSchema.transform((consumer) => ({
7909
7921
  consumer
7910
7922
  })),
7911
- z9.object({
7923
+ z10.object({
7912
7924
  consumer: FunctionSchema,
7913
7925
  resolver: LocalFileSchema.optional()
7914
7926
  })
@@ -7919,25 +7931,25 @@ var GraphQLSchema = z9.record(
7919
7931
  ).describe("Define the schema & resolvers in your stack for your global GraphQL API.").optional();
7920
7932
 
7921
7933
  // src/feature/http/schema.ts
7922
- import { z as z10 } from "zod";
7923
- var RouteSchema = z10.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route").transform((v) => v);
7924
- var HttpDefaultSchema = z10.record(
7934
+ import { z as z11 } from "zod";
7935
+ var RouteSchema = z11.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route").transform((v) => v);
7936
+ var HttpDefaultSchema = z11.record(
7925
7937
  ResourceIdSchema,
7926
- z10.object({
7938
+ z11.object({
7927
7939
  domain: ResourceIdSchema.describe("The domain id to link your API with."),
7928
- subDomain: z10.string().optional()
7940
+ subDomain: z11.string().optional()
7929
7941
  // auth: ResourceIdSchema.optional(),
7930
7942
  })
7931
7943
  ).optional().describe("Define your global HTTP API's.");
7932
- var HttpSchema = z10.record(ResourceIdSchema, z10.record(RouteSchema, FunctionSchema)).optional().describe("Define routes in your stack for your global HTTP API.");
7944
+ var HttpSchema = z11.record(ResourceIdSchema, z11.record(RouteSchema, FunctionSchema)).optional().describe("Define routes in your stack for your global HTTP API.");
7933
7945
 
7934
7946
  // src/feature/instance/schema.ts
7935
- import { z as z12 } from "zod";
7947
+ import { z as z13 } from "zod";
7936
7948
 
7937
7949
  // src/config/schema/local-directory.ts
7938
7950
  import { stat as stat2 } from "fs/promises";
7939
- import { z as z11 } from "zod";
7940
- var LocalDirectorySchema = z11.string().transform((path) => resolvePath(path)).refine(async (path) => {
7951
+ import { z as z12 } from "zod";
7952
+ var LocalDirectorySchema = z12.string().transform((path) => resolvePath(path)).refine(async (path) => {
7941
7953
  try {
7942
7954
  const s = await stat2(path);
7943
7955
  return s.isDirectory();
@@ -7947,8 +7959,8 @@ var LocalDirectorySchema = z11.string().transform((path) => resolvePath(path)).r
7947
7959
  }, `Directory doesn't exist`);
7948
7960
 
7949
7961
  // src/feature/instance/schema.ts
7950
- var ImageSchema = z12.string().regex(/^ami\-[0-9a-f]+/).describe("The ID of the AMI.");
7951
- var TypeSchema = z12.enum([
7962
+ var ImageSchema = z13.string().regex(/^ami\-[0-9a-f]+/).describe("The ID of the AMI.");
7963
+ var TypeSchema = z13.enum([
7952
7964
  "t3.nano",
7953
7965
  "t3.micro",
7954
7966
  "t3.small",
@@ -7966,36 +7978,36 @@ var TypeSchema = z12.enum([
7966
7978
  "g4ad.xlarge",
7967
7979
  "g4dn.xlarge"
7968
7980
  ]).describe(`The instance type.`);
7969
- var CommandSchema = z12.string().describe(`The script you want to execute when the instance starts up.`);
7981
+ var CommandSchema = z13.string().describe(`The script you want to execute when the instance starts up.`);
7970
7982
  var CodeSchema = LocalDirectorySchema.describe(`The code directory that will be deployed to your instance.`);
7971
- var ConnectSchema = z12.boolean().describe("Allows you to connect to all instances with an Instance Connect Endpoint.");
7972
- var EnvironmentSchema2 = z12.record(z12.string(), z12.string()).optional().describe("Environment variable key-value pairs.");
7973
- var ActionSchema2 = z12.string();
7974
- var ActionsSchema2 = z12.union([ActionSchema2.transform((v) => [v]), ActionSchema2.array()]);
7975
- var ArnSchema2 = z12.string().startsWith("arn:");
7976
- var WildcardSchema2 = z12.literal("*");
7977
- var ResourceSchema2 = z12.union([ArnSchema2, WildcardSchema2]).transform((v) => v);
7978
- var ResourcesSchema2 = z12.union([ResourceSchema2.transform((v) => [v]), ResourceSchema2.array()]);
7979
- var PermissionSchema2 = z12.object({
7980
- effect: z12.enum(["allow", "deny"]).default("allow"),
7983
+ var ConnectSchema = z13.boolean().describe("Allows you to connect to all instances with an Instance Connect Endpoint.");
7984
+ var EnvironmentSchema2 = z13.record(z13.string(), z13.string()).optional().describe("Environment variable key-value pairs.");
7985
+ var ActionSchema2 = z13.string();
7986
+ var ActionsSchema2 = z13.union([ActionSchema2.transform((v) => [v]), ActionSchema2.array()]);
7987
+ var ArnSchema2 = z13.string().startsWith("arn:");
7988
+ var WildcardSchema2 = z13.literal("*");
7989
+ var ResourceSchema2 = z13.union([ArnSchema2, WildcardSchema2]).transform((v) => v);
7990
+ var ResourcesSchema2 = z13.union([ResourceSchema2.transform((v) => [v]), ResourceSchema2.array()]);
7991
+ var PermissionSchema2 = z13.object({
7992
+ effect: z13.enum(["allow", "deny"]).default("allow"),
7981
7993
  actions: ActionsSchema2,
7982
7994
  resources: ResourcesSchema2
7983
7995
  });
7984
- var PermissionsSchema2 = z12.union([PermissionSchema2.transform((v) => [v]), PermissionSchema2.array()]).describe("Add IAM permissions to your instance.");
7985
- var InstanceDefaultSchema = z12.object({
7996
+ var PermissionsSchema2 = z13.union([PermissionSchema2.transform((v) => [v]), PermissionSchema2.array()]).describe("Add IAM permissions to your instance.");
7997
+ var InstanceDefaultSchema = z13.object({
7986
7998
  connect: ConnectSchema.default(false)
7987
7999
  }).default({}).describe("Define the default settings for all instances in your stacks.");
7988
- var InstancesSchema = z12.record(
8000
+ var InstancesSchema = z13.record(
7989
8001
  ResourceIdSchema,
7990
- z12.object({
8002
+ z13.object({
7991
8003
  image: ImageSchema,
7992
8004
  type: TypeSchema,
7993
8005
  code: CodeSchema,
7994
- user: z12.string().default("ec2-user"),
8006
+ user: z13.string().default("ec2-user"),
7995
8007
  command: CommandSchema.optional(),
7996
8008
  environment: EnvironmentSchema2.optional(),
7997
8009
  permissions: PermissionsSchema2.optional(),
7998
- waitForTermination: z12.boolean().default(true)
8010
+ waitForTermination: z13.boolean().default(true)
7999
8011
  })
8000
8012
  ).optional().describe("Define the instances in your stack.");
8001
8013
 
@@ -8005,28 +8017,28 @@ var OnFailureDefaultSchema = FunctionSchema.optional().describe(
8005
8017
  );
8006
8018
 
8007
8019
  // src/feature/on-log/schema.ts
8008
- import { z as z13 } from "zod";
8009
- var FilterSchema = z13.enum(["trace", "debug", "info", "warn", "error", "fatal"]).array().describe("The log level that will gets delivered to the consumer.");
8010
- var OnLogDefaultSchema = z13.union([
8020
+ import { z as z14 } from "zod";
8021
+ var FilterSchema = z14.enum(["trace", "debug", "info", "warn", "error", "fatal"]).array().describe("The log level that will gets delivered to the consumer.");
8022
+ var OnLogDefaultSchema = z14.union([
8011
8023
  FunctionSchema.transform((consumer) => ({
8012
8024
  consumer,
8013
8025
  filter: ["error", "fatal"]
8014
8026
  })),
8015
- z13.object({
8027
+ z14.object({
8016
8028
  consumer: FunctionSchema,
8017
8029
  filter: FilterSchema
8018
8030
  })
8019
8031
  ]).optional().describe("Define a subscription on all Lambda functions logs.");
8020
8032
 
8021
8033
  // src/feature/pubsub/schema.ts
8022
- import { z as z14 } from "zod";
8034
+ import { z as z15 } from "zod";
8023
8035
  var DomainSchema = ResourceIdSchema.describe("The domain id to link your Pubsub API with.");
8024
- var PubSubDefaultSchema = z14.record(
8036
+ var PubSubDefaultSchema = z15.record(
8025
8037
  ResourceIdSchema,
8026
- z14.object({
8038
+ z15.object({
8027
8039
  auth: FunctionSchema,
8028
8040
  domain: DomainSchema.optional(),
8029
- subDomain: z14.string().optional()
8041
+ subDomain: z15.string().optional()
8030
8042
  // auth: z.union([
8031
8043
  // ResourceIdSchema,
8032
8044
  // z.object({
@@ -8042,11 +8054,11 @@ var PubSubDefaultSchema = z14.record(
8042
8054
  // .optional(),
8043
8055
  })
8044
8056
  ).optional().describe("Define the pubsub subscriber in your stack.");
8045
- var PubSubSchema = z14.record(
8057
+ var PubSubSchema = z15.record(
8046
8058
  ResourceIdSchema,
8047
- z14.object({
8048
- sql: z14.string().describe("The SQL statement used to query the IOT topic."),
8049
- sqlVersion: z14.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."),
8059
+ z15.object({
8060
+ sql: z15.string().describe("The SQL statement used to query the IOT topic."),
8061
+ 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."),
8050
8062
  consumer: FunctionSchema.describe("The consuming lambda function properties.")
8051
8063
  })
8052
8064
  ).optional().describe("Define the pubsub subscriber in your stack.");
@@ -8054,7 +8066,7 @@ var PubSubSchema = z14.record(
8054
8066
  // src/feature/queue/schema.ts
8055
8067
  import { days as days2, hours, minutes as minutes3, seconds as seconds2 } from "@awsless/duration";
8056
8068
  import { kibibytes } from "@awsless/size";
8057
- import { z as z15 } from "zod";
8069
+ import { z as z16 } from "zod";
8058
8070
  var RetentionPeriodSchema = DurationSchema.refine(
8059
8071
  durationMin(minutes3(1)),
8060
8072
  "Minimum retention period is 1 minute"
@@ -8082,10 +8094,10 @@ var ReceiveMessageWaitTimeSchema = DurationSchema.refine(
8082
8094
  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(
8083
8095
  "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."
8084
8096
  );
8085
- var BatchSizeSchema = z15.number().int().min(1, "Minimum batch size is 1").max(1e4, "Maximum batch size is 10000").describe(
8097
+ var BatchSizeSchema = z16.number().int().min(1, "Minimum batch size is 1").max(1e4, "Maximum batch size is 10000").describe(
8086
8098
  "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."
8087
8099
  );
8088
- var MaxConcurrencySchema = z15.number().int().min(2, "Minimum max concurrency is 2").max(1e3, "Maximum max concurrency is 1000").describe(
8100
+ var MaxConcurrencySchema = z16.number().int().min(2, "Minimum max concurrency is 2").max(1e3, "Maximum max concurrency is 1000").describe(
8089
8101
  "Limits the number of concurrent instances that the queue worker can invoke. You can specify an integer from 2 to 1000."
8090
8102
  );
8091
8103
  var MaxBatchingWindow = DurationSchema.refine(
@@ -8094,7 +8106,7 @@ var MaxBatchingWindow = DurationSchema.refine(
8094
8106
  ).describe(
8095
8107
  "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."
8096
8108
  );
8097
- var QueueDefaultSchema = z15.object({
8109
+ var QueueDefaultSchema = z16.object({
8098
8110
  retentionPeriod: RetentionPeriodSchema.default("7 days"),
8099
8111
  visibilityTimeout: VisibilityTimeoutSchema.default("30 seconds"),
8100
8112
  deliveryDelay: DeliveryDelaySchema.default("0 seconds"),
@@ -8104,15 +8116,15 @@ var QueueDefaultSchema = z15.object({
8104
8116
  maxConcurrency: MaxConcurrencySchema.optional(),
8105
8117
  maxBatchingWindow: MaxBatchingWindow.optional()
8106
8118
  }).default({});
8107
- var QueuesSchema = z15.record(
8119
+ var QueuesSchema = z16.record(
8108
8120
  ResourceIdSchema,
8109
- z15.union([
8121
+ z16.union([
8110
8122
  LocalFileSchema.transform((file) => ({
8111
8123
  consumer: {
8112
8124
  file
8113
8125
  }
8114
8126
  })),
8115
- z15.object({
8127
+ z16.object({
8116
8128
  consumer: FunctionSchema.describe("The consuming lambda function properties."),
8117
8129
  retentionPeriod: RetentionPeriodSchema.optional(),
8118
8130
  visibilityTimeout: VisibilityTimeoutSchema.optional(),
@@ -8127,59 +8139,59 @@ var QueuesSchema = z15.record(
8127
8139
  ).optional().describe("Define the queues in your stack.");
8128
8140
 
8129
8141
  // src/feature/rest/schema.ts
8130
- import { z as z17 } from "zod";
8142
+ import { z as z18 } from "zod";
8131
8143
 
8132
8144
  // src/config/schema/route.ts
8133
- import { z as z16 } from "zod";
8134
- var RouteSchema2 = z16.union([
8135
- z16.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route"),
8136
- z16.literal("$default")
8145
+ import { z as z17 } from "zod";
8146
+ var RouteSchema2 = z17.union([
8147
+ z17.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route"),
8148
+ z17.literal("$default")
8137
8149
  ]);
8138
8150
 
8139
8151
  // src/feature/rest/schema.ts
8140
- var RestDefaultSchema = z17.record(
8152
+ var RestDefaultSchema = z18.record(
8141
8153
  ResourceIdSchema,
8142
- z17.object({
8154
+ z18.object({
8143
8155
  domain: ResourceIdSchema.describe("The domain id to link your API with.").optional(),
8144
- subDomain: z17.string().optional()
8156
+ subDomain: z18.string().optional()
8145
8157
  })
8146
8158
  ).optional().describe("Define your global REST API's.");
8147
- var RestSchema = z17.record(ResourceIdSchema, z17.record(RouteSchema2, FunctionSchema)).optional().describe("Define routes in your stack for your global REST API.");
8159
+ var RestSchema = z18.record(ResourceIdSchema, z18.record(RouteSchema2, FunctionSchema)).optional().describe("Define routes in your stack for your global REST API.");
8148
8160
 
8149
8161
  // src/feature/rpc/schema.ts
8150
- import { z as z18 } from "zod";
8151
- var RpcDefaultSchema = z18.record(
8162
+ import { z as z19 } from "zod";
8163
+ var RpcDefaultSchema = z19.record(
8152
8164
  ResourceIdSchema,
8153
- z18.object({
8165
+ z19.object({
8154
8166
  domain: ResourceIdSchema.describe("The domain id to link your RPC API with.").optional(),
8155
- subDomain: z18.string().optional(),
8167
+ subDomain: z19.string().optional(),
8156
8168
  auth: FunctionSchema.optional(),
8157
8169
  log: LogSchema.optional()
8158
8170
  })
8159
8171
  ).describe(`Define the global RPC API's.`).optional();
8160
- var RpcSchema = z18.record(ResourceIdSchema, z18.record(z18.string(), FunctionSchema).describe("The queries for your global RPC API.")).describe("Define the schema in your stack for your global RPC API.").optional();
8172
+ var RpcSchema = z19.record(ResourceIdSchema, z19.record(z19.string(), FunctionSchema).describe("The queries for your global RPC API.")).describe("Define the schema in your stack for your global RPC API.").optional();
8161
8173
 
8162
8174
  // src/feature/store/schema.ts
8163
- import { z as z19 } from "zod";
8164
- var DeletionProtectionSchema = z19.boolean().describe("Specifies if you want to protect the store from being deleted by awsless.");
8165
- var StoreDefaultSchema = z19.object({
8175
+ import { z as z20 } from "zod";
8176
+ var DeletionProtectionSchema = z20.boolean().describe("Specifies if you want to protect the store from being deleted by awsless.");
8177
+ var StoreDefaultSchema = z20.object({
8166
8178
  deletionProtection: DeletionProtectionSchema.optional()
8167
8179
  }).optional();
8168
- var StoresSchema = z19.union([
8169
- z19.array(ResourceIdSchema).transform((list4) => {
8180
+ var StoresSchema = z20.union([
8181
+ z20.array(ResourceIdSchema).transform((list4) => {
8170
8182
  const stores = {};
8171
8183
  for (const key of list4) {
8172
8184
  stores[key] = {};
8173
8185
  }
8174
8186
  return stores;
8175
8187
  }),
8176
- z19.record(
8188
+ z20.record(
8177
8189
  ResourceIdSchema,
8178
- z19.object({
8190
+ z20.object({
8179
8191
  // cors: CorsSchema,
8180
8192
  deletionProtection: DeletionProtectionSchema.optional(),
8181
- versioning: z19.boolean().default(false).describe("Enable versioning of your store."),
8182
- events: z19.object({
8193
+ versioning: z20.boolean().default(false).describe("Enable versioning of your store."),
8194
+ events: z20.object({
8183
8195
  // create
8184
8196
  "created:*": FunctionSchema.optional().describe(
8185
8197
  "Subscribe to notifications regardless of the API that was used to create an object."
@@ -8212,41 +8224,41 @@ var StoresSchema = z19.union([
8212
8224
  ]).optional().describe("Define the stores in your stack.");
8213
8225
 
8214
8226
  // src/feature/table/schema.ts
8215
- import { z as z20 } from "zod";
8216
- var KeySchema = z20.string().min(1).max(255);
8217
- var DeletionProtectionSchema2 = z20.boolean().describe("Specifies if you want to protect the table from being deleted by awsless.");
8218
- var TableDefaultSchema = z20.object({
8227
+ import { z as z21 } from "zod";
8228
+ var KeySchema = z21.string().min(1).max(255);
8229
+ var DeletionProtectionSchema2 = z21.boolean().describe("Specifies if you want to protect the table from being deleted by awsless.");
8230
+ var TableDefaultSchema = z21.object({
8219
8231
  deletionProtection: DeletionProtectionSchema2.optional()
8220
8232
  }).optional();
8221
- var TablesSchema = z20.record(
8233
+ var TablesSchema = z21.record(
8222
8234
  ResourceIdSchema,
8223
- z20.object({
8235
+ z21.object({
8224
8236
  hash: KeySchema.describe(
8225
8237
  "Specifies the name of the partition / hash key that makes up the primary key for the table."
8226
8238
  ),
8227
8239
  sort: KeySchema.optional().describe(
8228
8240
  "Specifies the name of the range / sort key that makes up the primary key for the table."
8229
8241
  ),
8230
- fields: z20.record(z20.string(), z20.enum(["string", "number", "binary"])).optional().describe(
8242
+ fields: z21.record(z21.string(), z21.enum(["string", "number", "binary"])).optional().describe(
8231
8243
  'A list of attributes that describe the key schema for the table and indexes. If no attribute field is defined we default to "string".'
8232
8244
  ),
8233
- class: z20.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
8234
- pointInTimeRecovery: z20.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
8245
+ class: z21.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
8246
+ pointInTimeRecovery: z21.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
8235
8247
  timeToLiveAttribute: KeySchema.optional().describe(
8236
8248
  "The name of the TTL attribute used to store the expiration time for items in the table. To update this property, you must first disable TTL and then enable TTL with the new attribute name."
8237
8249
  ),
8238
8250
  deletionProtection: DeletionProtectionSchema2.optional(),
8239
- stream: z20.object({
8240
- type: z20.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
8251
+ stream: z21.object({
8252
+ type: z21.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
8241
8253
  "When an item in the table is modified, stream.type determines what information is written to the stream for this table. Valid values are:\n- keys-only - Only the key attributes of the modified item are written to the stream.\n- new-image - The entire item, as it appears after it was modified, is written to the stream.\n- old-image - The entire item, as it appeared before it was modified, is written to the stream.\n- new-and-old-images - Both the new and the old item images of the item are written to the stream."
8242
8254
  ),
8243
8255
  consumer: FunctionSchema.describe("The consuming lambda function for the stream")
8244
8256
  }).optional().describe(
8245
8257
  "The settings for the DynamoDB table stream, which capture changes to items stored in the table."
8246
8258
  ),
8247
- indexes: z20.record(
8248
- z20.string(),
8249
- z20.object({
8259
+ indexes: z21.record(
8260
+ z21.string(),
8261
+ z21.object({
8250
8262
  /** Specifies the name of the partition / hash key that makes up the primary key for the global secondary index. */
8251
8263
  hash: KeySchema,
8252
8264
  /** Specifies the name of the range / sort key that makes up the primary key for the global secondary index. */
@@ -8256,14 +8268,14 @@ var TablesSchema = z20.record(
8256
8268
  * - keys-only - Only the index and primary keys are projected into the index.
8257
8269
  * @default 'all'
8258
8270
  */
8259
- projection: z20.enum(["all", "keys-only"]).default("all")
8271
+ projection: z21.enum(["all", "keys-only"]).default("all")
8260
8272
  })
8261
8273
  ).optional().describe("Specifies the global secondary indexes to be created on the table.")
8262
8274
  })
8263
8275
  ).optional().describe("Define the tables in your stack.");
8264
8276
 
8265
8277
  // src/config/schema/region.ts
8266
- import { z as z21 } from "zod";
8278
+ import { z as z22 } from "zod";
8267
8279
  var US = ["us-east-2", "us-east-1", "us-west-1", "us-west-2"];
8268
8280
  var AF = ["af-south-1"];
8269
8281
  var AP = [
@@ -8292,21 +8304,21 @@ var EU = [
8292
8304
  var ME = ["me-south-1", "me-central-1"];
8293
8305
  var SA = ["sa-east-1"];
8294
8306
  var regions = [...US, ...AF, ...AP, ...CA, ...EU, ...ME, ...SA];
8295
- var RegionSchema = z21.enum(regions);
8307
+ var RegionSchema = z22.enum(regions);
8296
8308
 
8297
8309
  // src/config/app.ts
8298
- var AppSchema = z22.object({
8299
- $schema: z22.string().optional(),
8310
+ var AppSchema = z23.object({
8311
+ $schema: z23.string().optional(),
8300
8312
  name: ResourceIdSchema.describe("App name."),
8301
8313
  region: RegionSchema.describe("The AWS region to deploy to."),
8302
- profile: z22.string().describe("The AWS profile to deploy to."),
8314
+ profile: z23.string().describe("The AWS profile to deploy to."),
8303
8315
  // stage: z
8304
8316
  // .string()
8305
8317
  // .regex(/^[a-z]+$/)
8306
8318
  // .default('prod')
8307
8319
  // .describe('The deployment stage.'),
8308
8320
  // onFailure: OnFailureSchema,
8309
- defaults: z22.object({
8321
+ defaults: z23.object({
8310
8322
  onFailure: OnFailureDefaultSchema,
8311
8323
  onLog: OnLogDefaultSchema,
8312
8324
  auth: AuthDefaultSchema,
@@ -8320,17 +8332,18 @@ var AppSchema = z22.object({
8320
8332
  rpc: RpcDefaultSchema,
8321
8333
  pubsub: PubSubDefaultSchema,
8322
8334
  table: TableDefaultSchema,
8323
- store: StoreDefaultSchema
8335
+ store: StoreDefaultSchema,
8336
+ alerts: AlertsDefaultSchema
8324
8337
  // dataRetention: z.boolean().describe('Configure how your resources are handled on delete.').default(false),
8325
8338
  }).default({}).describe("Default properties")
8326
8339
  });
8327
8340
 
8328
8341
  // src/config/stack.ts
8329
- import { z as z34 } from "zod";
8342
+ import { z as z35 } from "zod";
8330
8343
 
8331
8344
  // src/feature/cache/schema.ts
8332
- import { z as z23 } from "zod";
8333
- var TypeSchema2 = z23.enum([
8345
+ import { z as z24 } from "zod";
8346
+ var TypeSchema2 = z24.enum([
8334
8347
  "t4g.small",
8335
8348
  "t4g.medium",
8336
8349
  "r6g.large",
@@ -8345,29 +8358,29 @@ var TypeSchema2 = z23.enum([
8345
8358
  "r6gd.4xlarge",
8346
8359
  "r6gd.8xlarge"
8347
8360
  ]);
8348
- var PortSchema = z23.number().int().min(1).max(5e4);
8349
- var ShardsSchema = z23.number().int().min(0).max(100);
8350
- var ReplicasPerShardSchema = z23.number().int().min(0).max(5);
8351
- var EngineSchema = z23.enum(["7.0", "6.2"]);
8352
- var CachesSchema = z23.record(
8361
+ var PortSchema = z24.number().int().min(1).max(5e4);
8362
+ var ShardsSchema = z24.number().int().min(0).max(100);
8363
+ var ReplicasPerShardSchema = z24.number().int().min(0).max(5);
8364
+ var EngineSchema = z24.enum(["7.0", "6.2"]);
8365
+ var CachesSchema = z24.record(
8353
8366
  ResourceIdSchema,
8354
- z23.object({
8367
+ z24.object({
8355
8368
  type: TypeSchema2.default("t4g.small"),
8356
8369
  port: PortSchema.default(6379),
8357
8370
  shards: ShardsSchema.default(1),
8358
8371
  replicasPerShard: ReplicasPerShardSchema.default(1),
8359
8372
  engine: EngineSchema.default("7.0"),
8360
- dataTiering: z23.boolean().default(false)
8373
+ dataTiering: z24.boolean().default(false)
8361
8374
  })
8362
8375
  ).optional().describe("Define the caches in your stack. For access to the cache put your functions inside the global VPC.");
8363
8376
 
8364
8377
  // src/feature/command/schema.ts
8365
- import { z as z24 } from "zod";
8366
- var CommandSchema2 = z24.union([
8367
- z24.object({
8378
+ import { z as z25 } from "zod";
8379
+ var CommandSchema2 = z25.union([
8380
+ z25.object({
8368
8381
  file: LocalFileSchema,
8369
- handler: z24.string().default("default").describe("The name of the handler that needs to run"),
8370
- description: z24.string().optional().describe("A description of the command")
8382
+ handler: z25.string().default("default").describe("The name of the handler that needs to run"),
8383
+ description: z25.string().optional().describe("A description of the command")
8371
8384
  // options: z.record(ResourceIdSchema, OptionSchema).optional(),
8372
8385
  // arguments: z.record(ResourceIdSchema, ArgumentSchema).optional(),
8373
8386
  }),
@@ -8377,22 +8390,22 @@ var CommandSchema2 = z24.union([
8377
8390
  description: void 0
8378
8391
  }))
8379
8392
  ]);
8380
- var CommandsSchema = z24.record(ResourceIdSchema, CommandSchema2).optional().describe("Define the custom commands for your stack.");
8393
+ var CommandsSchema = z25.record(ResourceIdSchema, CommandSchema2).optional().describe("Define the custom commands for your stack.");
8381
8394
 
8382
8395
  // src/feature/config/schema.ts
8383
- import { z as z25 } from "zod";
8384
- var ConfigNameSchema = z25.string().regex(/[a-z0-9\-]/g, "Invalid config name");
8385
- var ConfigsSchema = z25.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
8396
+ import { z as z26 } from "zod";
8397
+ var ConfigNameSchema = z26.string().regex(/[a-z0-9\-]/g, "Invalid config name");
8398
+ var ConfigsSchema = z26.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
8386
8399
 
8387
8400
  // src/feature/cron/schema/index.ts
8388
- import { z as z27 } from "zod";
8401
+ import { z as z28 } from "zod";
8389
8402
 
8390
8403
  // src/feature/cron/schema/schedule.ts
8391
- import { z as z26 } from "zod";
8404
+ import { z as z27 } from "zod";
8392
8405
  import { awsCronExpressionValidator } from "aws-cron-expression-validator";
8393
- var RateExpressionSchema = z26.custom(
8406
+ var RateExpressionSchema = z27.custom(
8394
8407
  (value) => {
8395
- return z26.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
8408
+ return z27.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
8396
8409
  const [str] = rate.split(" ");
8397
8410
  const number = parseInt(str);
8398
8411
  return number > 0;
@@ -8408,9 +8421,9 @@ var RateExpressionSchema = z26.custom(
8408
8421
  }
8409
8422
  return `rate(${rate})`;
8410
8423
  });
8411
- var CronExpressionSchema = z26.custom(
8424
+ var CronExpressionSchema = z27.custom(
8412
8425
  (value) => {
8413
- return z26.string().safeParse(value).success;
8426
+ return z27.string().safeParse(value).success;
8414
8427
  },
8415
8428
  { message: "Invalid cron expression" }
8416
8429
  ).superRefine((value, ctx) => {
@@ -8419,12 +8432,12 @@ var CronExpressionSchema = z26.custom(
8419
8432
  } catch (error) {
8420
8433
  if (error instanceof Error) {
8421
8434
  ctx.addIssue({
8422
- code: z26.ZodIssueCode.custom,
8435
+ code: z27.ZodIssueCode.custom,
8423
8436
  message: `Invalid cron expression: ${error.message}`
8424
8437
  });
8425
8438
  } else {
8426
8439
  ctx.addIssue({
8427
- code: z26.ZodIssueCode.custom,
8440
+ code: z27.ZodIssueCode.custom,
8428
8441
  message: "Invalid cron expression"
8429
8442
  });
8430
8443
  }
@@ -8435,23 +8448,23 @@ var CronExpressionSchema = z26.custom(
8435
8448
  var ScheduleExpressionSchema = RateExpressionSchema.or(CronExpressionSchema);
8436
8449
 
8437
8450
  // src/feature/cron/schema/index.ts
8438
- var CronsSchema = z27.record(
8451
+ var CronsSchema = z28.record(
8439
8452
  ResourceIdSchema,
8440
- z27.object({
8441
- enabled: z27.boolean().default(true).describe("If the cron is enabled."),
8453
+ z28.object({
8454
+ enabled: z28.boolean().default(true).describe("If the cron is enabled."),
8442
8455
  consumer: FunctionSchema.describe("The consuming lambda function properties."),
8443
8456
  schedule: ScheduleExpressionSchema.describe(
8444
8457
  'The scheduling expression.\n\nexample: "0 20 * * ? *"\nexample: "5 minutes"'
8445
8458
  ),
8446
- payload: z27.unknown().optional().describe("The JSON payload that will be passed to the consumer.")
8459
+ payload: z28.unknown().optional().describe("The JSON payload that will be passed to the consumer.")
8447
8460
  })
8448
8461
  ).optional().describe(`Define the cron jobs in your stack.`);
8449
8462
 
8450
8463
  // src/feature/search/schema.ts
8451
8464
  import { gibibytes as gibibytes2 } from "@awsless/size";
8452
- import { z as z28 } from "zod";
8453
- var VersionSchema = z28.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]);
8454
- var TypeSchema3 = z28.enum([
8465
+ import { z as z29 } from "zod";
8466
+ var VersionSchema = z29.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]);
8467
+ var TypeSchema3 = z29.enum([
8455
8468
  "t3.small",
8456
8469
  "t3.medium",
8457
8470
  "m3.medium",
@@ -8526,41 +8539,41 @@ var TypeSchema3 = z28.enum([
8526
8539
  "r6gd.16xlarge"
8527
8540
  ]);
8528
8541
  var StorageSizeSchema = SizeSchema.refine(sizeMin(gibibytes2(10)), "Minimum storage size is 10 GB").refine(sizeMax(gibibytes2(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.");
8529
- var SearchsSchema = z28.record(
8542
+ var SearchsSchema = z29.record(
8530
8543
  ResourceIdSchema,
8531
- z28.object({
8544
+ z29.object({
8532
8545
  type: TypeSchema3.default("t3.small"),
8533
- count: z28.number().int().min(1).default(1),
8546
+ count: z29.number().int().min(1).default(1),
8534
8547
  version: VersionSchema.default("2.13"),
8535
- storage: StorageSizeSchema.default("10 GB"),
8536
- vpc: z28.boolean().default(false)
8548
+ storage: StorageSizeSchema.default("10 GB")
8549
+ // vpc: z.boolean().default(false),
8537
8550
  })
8538
8551
  ).optional().describe("Define the search instances in your stack. Backed by OpenSearch.");
8539
8552
 
8540
8553
  // src/feature/site/schema.ts
8541
- import { z as z29 } from "zod";
8542
- var ErrorResponsePathSchema = z29.string().describe(
8554
+ import { z as z30 } from "zod";
8555
+ var ErrorResponsePathSchema = z30.string().describe(
8543
8556
  "The path to the custom error page that you want to return to the viewer when your origin returns the HTTP status code specified.\n - We recommend that you store custom error pages in an Amazon S3 bucket. If you store custom error pages on an HTTP server and the server starts to return 5xx errors, CloudFront can't get the files that you want to return to viewers because the origin server is unavailable."
8544
8557
  );
8545
- var StatusCodeSchema = z29.number().int().positive().optional().describe(
8558
+ var StatusCodeSchema = z30.number().int().positive().optional().describe(
8546
8559
  "The HTTP status code that you want CloudFront to return to the viewer along with the custom error page. There are a variety of reasons that you might want CloudFront to return a status code different from the status code that your origin returned to CloudFront, for example:\n- Some Internet devices (some firewalls and corporate proxies, for example) intercept HTTP 4xx and 5xx and prevent the response from being returned to the viewer. If you substitute 200, the response typically won't be intercepted.\n- If you don't care about distinguishing among different client errors or server errors, you can specify 400 or 500 as the ResponseCode for all 4xx or 5xx errors.\n- You might want to return a 200 status code (OK) and static website so your customers don't know that your website is down."
8547
8560
  );
8548
8561
  var MinTTLSchema = DurationSchema.describe(
8549
8562
  "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."
8550
8563
  );
8551
- var ErrorResponseSchema = z29.union([
8564
+ var ErrorResponseSchema = z30.union([
8552
8565
  ErrorResponsePathSchema,
8553
- z29.object({
8566
+ z30.object({
8554
8567
  path: ErrorResponsePathSchema,
8555
8568
  statusCode: StatusCodeSchema.optional(),
8556
8569
  minTTL: MinTTLSchema.optional()
8557
8570
  })
8558
8571
  ]).optional();
8559
- var SitesSchema = z29.record(
8572
+ var SitesSchema = z30.record(
8560
8573
  ResourceIdSchema,
8561
- z29.object({
8574
+ z30.object({
8562
8575
  domain: ResourceIdSchema.describe("The domain id to link your site with.").optional(),
8563
- subDomain: z29.string().optional(),
8576
+ subDomain: z30.string().optional(),
8564
8577
  // bind: z
8565
8578
  // .object({
8566
8579
  // auth: z.array(ResourceIdSchema),
@@ -8569,8 +8582,11 @@ var SitesSchema = z29.record(
8569
8582
  // // rest: z.array(ResourceIdSchema),
8570
8583
  // })
8571
8584
  // .optional(),
8572
- static: LocalDirectorySchema.optional().describe("Specifies the path to the static files directory."),
8585
+ static: z30.union([LocalDirectorySchema, z30.boolean()]).optional().describe(
8586
+ "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."
8587
+ ),
8573
8588
  ssr: FunctionSchema.optional().describe("Specifies the ssr file."),
8589
+ origin: z30.enum(["ssr-first", "static-first"]).default("static-first").describe("Specifies the origin fallback ordering."),
8574
8590
  // bind: z.object({
8575
8591
  // auth:
8576
8592
  // h
@@ -8583,7 +8599,7 @@ var SitesSchema = z29.record(
8583
8599
  // build: z.string().optional(),
8584
8600
  // }),
8585
8601
  // ]),
8586
- errors: z29.object({
8602
+ errors: z30.object({
8587
8603
  400: ErrorResponseSchema.describe("Customize a `400 Bad Request` response."),
8588
8604
  403: ErrorResponseSchema.describe("Customize a `403 Forbidden` response."),
8589
8605
  404: ErrorResponseSchema.describe("Customize a `404 Not Found` response."),
@@ -8596,16 +8612,16 @@ var SitesSchema = z29.record(
8596
8612
  503: ErrorResponseSchema.describe("Customize a `503 Service Unavailable` response."),
8597
8613
  504: ErrorResponseSchema.describe("Customize a `504 Gateway Timeout` response.")
8598
8614
  }).optional().describe("Customize the error responses for specific HTTP status codes."),
8599
- cors: z29.object({
8600
- override: z29.boolean().default(false),
8615
+ cors: z30.object({
8616
+ override: z30.boolean().default(false),
8601
8617
  maxAge: DurationSchema.default("365 days"),
8602
- exposeHeaders: z29.string().array().optional(),
8603
- credentials: z29.boolean().default(false),
8604
- headers: z29.string().array().default(["*"]),
8605
- origins: z29.string().array().default(["*"]),
8606
- methods: z29.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
8618
+ exposeHeaders: z30.string().array().optional(),
8619
+ credentials: z30.boolean().default(false),
8620
+ headers: z30.string().array().default(["*"]),
8621
+ origins: z30.string().array().default(["*"]),
8622
+ methods: z30.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
8607
8623
  }).optional().describe("Define the cors headers."),
8608
- security: z29.object({
8624
+ security: z30.object({
8609
8625
  // contentSecurityPolicy: z.object({
8610
8626
  // override: z.boolean().default(false),
8611
8627
  // policy: z.string(),
@@ -8647,10 +8663,10 @@ var SitesSchema = z29.record(
8647
8663
  // reportUri?: string
8648
8664
  // }
8649
8665
  }).optional().describe("Define the security policy."),
8650
- cache: z29.object({
8651
- cookies: z29.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
8652
- headers: z29.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
8653
- queries: z29.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
8666
+ cache: z30.object({
8667
+ cookies: z30.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
8668
+ headers: z30.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
8669
+ queries: z30.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
8654
8670
  }).optional().describe(
8655
8671
  "Specifies the cookies, headers, and query values that CloudFront includes in the cache key."
8656
8672
  )
@@ -8658,22 +8674,22 @@ var SitesSchema = z29.record(
8658
8674
  ).optional().describe("Define the sites in your stack.");
8659
8675
 
8660
8676
  // src/feature/stream/schema.ts
8661
- import { z as z30 } from "zod";
8662
- var LatencyModeSchema = z30.enum(["low", "normal"]).describe(
8677
+ import { z as z31 } from "zod";
8678
+ var LatencyModeSchema = z31.enum(["low", "normal"]).describe(
8663
8679
  `Channel latency mode. Valid values:
8664
8680
  - normal: Use "normal" to broadcast and deliver live video up to Full HD.
8665
8681
  - low: Use "low" for near real-time interactions with viewers.`
8666
8682
  );
8667
- var TypeSchema4 = z30.enum(["standard", "basic", "advanced-sd", "advanced-hd"]).describe(`The channel type, which determines the allowable resolution and bitrate.
8683
+ var TypeSchema4 = z31.enum(["standard", "basic", "advanced-sd", "advanced-hd"]).describe(`The channel type, which determines the allowable resolution and bitrate.
8668
8684
  If you exceed the allowable resolution or bitrate, the stream probably will disconnect immediately. Valid values:
8669
8685
  - standard: Video is transcoded: multiple qualities are generated from the original input to automatically give viewers the best experience for their devices and network conditions. Transcoding allows higher playback quality across a range of download speeds. Resolution can be up to 1080p and bitrate can be up to 8.5 Mbps. Audio is transcoded only for renditions 360p and below; above that, audio is passed through.
8670
8686
  - basic: Video is transmuxed: Amazon IVS delivers the original input to viewers. The viewer's video-quality choice is limited to the original input. Resolution can be up to 1080p and bitrate can be up to 1.5 Mbps for 480p and up to 3.5 Mbps for resolutions between 480p and 1080p.
8671
8687
  - advanced-sd: Video is transcoded; multiple qualities are generated from the original input, to automatically give viewers the best experience for their devices and network conditions. Input resolution can be up to 1080p and bitrate can be up to 8.5 Mbps; output is capped at SD quality (480p). You can select an optional transcode preset (see below). Audio for all renditions is transcoded, and an audio-only rendition is available.
8672
8688
  - advanced-hd: Video is transcoded; multiple qualities are generated from the original input, to automatically give viewers the best experience for their devices and network conditions. Input resolution can be up to 1080p and bitrate can be up to 8.5 Mbps; output is capped at HD quality (720p). You can select an optional transcode preset (see below). Audio for all renditions is transcoded, and an audio-only rendition is available.
8673
8689
  `);
8674
- var StreamsSchema = z30.record(
8690
+ var StreamsSchema = z31.record(
8675
8691
  ResourceIdSchema,
8676
- z30.object({
8692
+ z31.object({
8677
8693
  type: TypeSchema4.default("standard"),
8678
8694
  // preset: PresetSchema.optional(),
8679
8695
  latencyMode: LatencyModeSchema.default("low")
@@ -8681,42 +8697,42 @@ var StreamsSchema = z30.record(
8681
8697
  ).optional().describe("Define the streams in your stack.");
8682
8698
 
8683
8699
  // src/feature/task/schema.ts
8684
- import { z as z31 } from "zod";
8685
- var RetryAttemptsSchema2 = z31.number().int().min(0).max(2).describe(
8700
+ import { z as z32 } from "zod";
8701
+ var RetryAttemptsSchema2 = z32.number().int().min(0).max(2).describe(
8686
8702
  "The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
8687
8703
  );
8688
- var TaskSchema = z31.union([
8704
+ var TaskSchema = z32.union([
8689
8705
  LocalFileSchema.transform((file) => ({
8690
8706
  consumer: { file },
8691
8707
  retryAttempts: void 0
8692
8708
  })),
8693
- z31.object({
8709
+ z32.object({
8694
8710
  consumer: FunctionSchema,
8695
8711
  retryAttempts: RetryAttemptsSchema2.optional()
8696
8712
  })
8697
8713
  ]);
8698
- var TasksSchema = z31.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
8714
+ var TasksSchema = z32.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
8699
8715
 
8700
8716
  // src/feature/test/schema.ts
8701
- import { z as z32 } from "zod";
8702
- var TestsSchema = z32.union([LocalDirectorySchema.transform((v) => [v]), LocalDirectorySchema.array()]).describe("Define the location of your tests for your stack.").optional();
8717
+ import { z as z33 } from "zod";
8718
+ var TestsSchema = z33.union([LocalDirectorySchema.transform((v) => [v]), LocalDirectorySchema.array()]).describe("Define the location of your tests for your stack.").optional();
8703
8719
 
8704
8720
  // src/feature/topic/schema.ts
8705
- import { paramCase as paramCase2 } from "change-case";
8706
- import { z as z33 } from "zod";
8707
- var TopicNameSchema = z33.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => paramCase2(value)).describe("Define event topic name.");
8708
- var TopicsSchema = z33.array(TopicNameSchema).refine((topics) => {
8721
+ import { paramCase as paramCase3 } from "change-case";
8722
+ import { z as z34 } from "zod";
8723
+ var TopicNameSchema = z34.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => paramCase3(value)).describe("Define event topic name.");
8724
+ var TopicsSchema = z34.array(TopicNameSchema).refine((topics) => {
8709
8725
  return topics.length === new Set(topics).size;
8710
8726
  }, "Must be a list of unique topic names").optional().describe("Define the event topics to publish too in your stack.");
8711
- var SubscribersSchema = z33.record(TopicNameSchema, z33.union([EmailSchema, FunctionSchema])).optional().describe("Define the event topics to subscribe too in your stack.");
8727
+ var SubscribersSchema = z34.record(TopicNameSchema, FunctionSchema).optional().describe("Define the event topics to subscribe too in your stack.");
8712
8728
 
8713
8729
  // src/config/stack.ts
8714
8730
  var DependsSchema = ResourceIdSchema.array().optional().describe("Define the stacks that this stack is depended on.");
8715
8731
  var NameSchema = ResourceIdSchema.refine((name) => !["base"].includes(name), {
8716
8732
  message: `Stack name can't be a reserved name.`
8717
8733
  }).describe("Stack name.");
8718
- var StackSchema = z34.object({
8719
- $schema: z34.string().optional(),
8734
+ var StackSchema = z35.object({
8735
+ $schema: z35.string().optional(),
8720
8736
  name: NameSchema,
8721
8737
  depends: DependsSchema,
8722
8738
  commands: CommandsSchema,
@@ -8783,13 +8799,13 @@ var readConfigWithStage = async (file, stage) => {
8783
8799
  };
8784
8800
 
8785
8801
  // src/config/load/validate.ts
8786
- import { z as z35 } from "zod";
8802
+ import { z as z36 } from "zod";
8787
8803
  var validateConfig = async (schema, file, data) => {
8788
8804
  try {
8789
8805
  const result = await schema.parseAsync(data);
8790
8806
  return result;
8791
8807
  } catch (error) {
8792
- if (error instanceof z35.ZodError) {
8808
+ if (error instanceof z36.ZodError) {
8793
8809
  throw new ConfigError(file, error, data);
8794
8810
  }
8795
8811
  throw error;
@@ -8951,7 +8967,7 @@ var TypeObject = class {
8951
8967
  };
8952
8968
 
8953
8969
  // src/util/name.ts
8954
- import { paramCase as paramCase3 } from "change-case";
8970
+ import { paramCase as paramCase4 } from "change-case";
8955
8971
  import { createHmac } from "crypto";
8956
8972
  var formatGlobalResourceName = (opt) => {
8957
8973
  return [
@@ -8961,7 +8977,7 @@ var formatGlobalResourceName = (opt) => {
8961
8977
  opt.resourceType,
8962
8978
  opt.resourceName,
8963
8979
  opt.postfix
8964
- ].filter((v) => typeof v === "string").map((v) => paramCase3(v) || v).join(opt.seperator ?? "--");
8980
+ ].filter((v) => typeof v === "string").map((v) => paramCase4(v) || v).join(opt.seperator ?? "--");
8965
8981
  };
8966
8982
  var formatLocalResourceName = (opt) => {
8967
8983
  return [
@@ -8972,7 +8988,7 @@ var formatLocalResourceName = (opt) => {
8972
8988
  opt.resourceType,
8973
8989
  opt.resourceName,
8974
8990
  opt.postfix
8975
- ].filter((v) => typeof v === "string").map((v) => paramCase3(v) || v).join(opt.seperator ?? "--");
8991
+ ].filter((v) => typeof v === "string").map((v) => paramCase4(v) || v).join(opt.seperator ?? "--");
8976
8992
  };
8977
8993
  var generateGlobalAppId = (opt) => {
8978
8994
  return createHmac("sha1", "awsless").update(opt.accountId).update(opt.region).update(opt.appName).digest("hex").substring(0, 8);
@@ -11044,7 +11060,7 @@ var commandFeature = defineFeature({
11044
11060
  });
11045
11061
 
11046
11062
  // src/feature/config/index.ts
11047
- import { paramCase as paramCase4 } from "change-case";
11063
+ import { paramCase as paramCase5 } from "change-case";
11048
11064
 
11049
11065
  // src/util/ssm.ts
11050
11066
  import {
@@ -11205,7 +11221,7 @@ var configFeature = defineFeature({
11205
11221
  resources: configs.map(
11206
11222
  (name) => `arn:aws:ssm:${ctx.appConfig.region}:${ctx.accountId}:parameter${configParameterPrefix(
11207
11223
  ctx.app.name
11208
- )}/${paramCase4(name)}`
11224
+ )}/${paramCase5(name)}`
11209
11225
  )
11210
11226
  });
11211
11227
  });
@@ -11480,7 +11496,7 @@ var functionFeature = defineFeature({
11480
11496
  });
11481
11497
 
11482
11498
  // src/feature/graphql/index.ts
11483
- import { constantCase as constantCase5, paramCase as paramCase5 } from "change-case";
11499
+ import { constantCase as constantCase5, paramCase as paramCase6 } from "change-case";
11484
11500
  import { generate } from "@awsless/graphql";
11485
11501
  import { mergeTypeDefs } from "@graphql-tools/merge";
11486
11502
  import { readFile as readFile5 } from "fs/promises";
@@ -11773,7 +11789,7 @@ var graphqlFeature = defineFeature({
11773
11789
  for (const [fieldName, props2] of Object.entries(fields ?? {})) {
11774
11790
  const name = `${typeName}__${fieldName}`;
11775
11791
  const resolverGroup = new Node7(group, "resolver", name);
11776
- const entryId = paramCase5(`${id}-${shortId(`${typeName}-${fieldName}`)}`);
11792
+ const entryId = paramCase6(`${id}-${shortId(`${typeName}-${fieldName}`)}`);
11777
11793
  const { lambda } = createLambdaFunction(resolverGroup, ctx, `graphql`, entryId, {
11778
11794
  ...props2.consumer,
11779
11795
  description: `${id} ${typeName}.${fieldName}`
@@ -12549,7 +12565,7 @@ var restFeature = defineFeature({
12549
12565
  });
12550
12566
 
12551
12567
  // src/feature/rpc/index.ts
12552
- import { camelCase as camelCase6, constantCase as constantCase10, paramCase as paramCase6 } from "change-case";
12568
+ import { camelCase as camelCase6, constantCase as constantCase10, paramCase as paramCase7 } from "change-case";
12553
12569
  import { Asset as Asset5, aws as aws17, Node as Node16 } from "@awsless/formation";
12554
12570
  import { mebibytes as mebibytes2 } from "@awsless/size";
12555
12571
  import { dirname as dirname10, join as join9, relative as relative5 } from "path";
@@ -12851,7 +12867,7 @@ var rpcFeature = defineFeature({
12851
12867
  const group = new Node16(ctx.stack, "rpc", id);
12852
12868
  for (const [name, props] of Object.entries(queries ?? {})) {
12853
12869
  const queryGroup = new Node16(group, "query", name);
12854
- const entryId = paramCase6(`${id}-${shortId(name)}`);
12870
+ const entryId = paramCase7(`${id}-${shortId(name)}`);
12855
12871
  createLambdaFunction(queryGroup, ctx, `rpc`, entryId, {
12856
12872
  ...props,
12857
12873
  description: `${id} ${name}`
@@ -12922,15 +12938,6 @@ var searchFeature = defineFeature({
12922
12938
  ]
12923
12939
  }
12924
12940
  });
12925
- if (props.vpc) {
12926
- openSearch.setVpc({
12927
- securityGroupIds: [ctx.shared.get(`vpc-security-group-id`)],
12928
- subnetIds: [
12929
- ctx.shared.get("vpc-private-subnet-id-1"),
12930
- ctx.shared.get("vpc-private-subnet-id-2")
12931
- ]
12932
- });
12933
- }
12934
12941
  ctx.addEnv(`SEARCH_${constantCase11(ctx.stack.name)}_${constantCase11(id)}_DOMAIN`, openSearch.domainEndpoint);
12935
12942
  ctx.onStackPolicy((policy) => {
12936
12943
  policy.addStatement({
@@ -13047,20 +13054,22 @@ var siteFeature = defineFeature({
13047
13054
  protocol: "sigv4"
13048
13055
  });
13049
13056
  accessControl.deletionPolicy = "after-deployment";
13050
- const files = glob2.sync("**", {
13051
- cwd: props.static,
13052
- nodir: true
13053
- });
13054
- for (const file of files) {
13055
- const object = new aws19.s3.BucketObject(group, file, {
13056
- bucket: bucket.name,
13057
- key: file,
13058
- body: Asset6.fromFile(join10(props.static, file)),
13059
- cacheControl: getCacheControl(file),
13060
- contentType: getContentType(file)
13057
+ if (typeof props.static === "string") {
13058
+ const files = glob2.sync("**", {
13059
+ cwd: props.static,
13060
+ nodir: true
13061
13061
  });
13062
- versions.push(object.key);
13063
- versions.push(object.etag);
13062
+ for (const file of files) {
13063
+ const object = new aws19.s3.BucketObject(group, file, {
13064
+ bucket: bucket.name,
13065
+ key: file,
13066
+ body: Asset6.fromFile(join10(props.static, file)),
13067
+ cacheControl: getCacheControl(file),
13068
+ contentType: getContentType(file)
13069
+ });
13070
+ versions.push(object.key);
13071
+ versions.push(object.etag);
13072
+ }
13064
13073
  }
13065
13074
  origins.push({
13066
13075
  id: "static",
@@ -13071,7 +13080,7 @@ var siteFeature = defineFeature({
13071
13080
  if (props.ssr && props.static) {
13072
13081
  originGroups.push({
13073
13082
  id: "group",
13074
- members: ["ssr", "static"],
13083
+ members: props.origin === "ssr-first" ? ["ssr", "static"] : ["static", "ssr"],
13075
13084
  statusCodes: [403, 404]
13076
13085
  });
13077
13086
  }
@@ -13177,7 +13186,7 @@ var siteFeature = defineFeature({
13177
13186
 
13178
13187
  // src/feature/store/index.ts
13179
13188
  import { aws as aws20, Node as Node19 } from "@awsless/formation";
13180
- import { paramCase as paramCase7 } from "change-case";
13189
+ import { paramCase as paramCase8 } from "change-case";
13181
13190
  var typeGenCode5 = `
13182
13191
  import { Body, PutObjectProps, BodyStream } from '@awsless/s3'
13183
13192
 
@@ -13261,7 +13270,7 @@ var storeFeature = defineFeature({
13261
13270
  };
13262
13271
  for (const [event, funcProps] of Object.entries(props.events ?? {})) {
13263
13272
  const eventGroup = new Node19(group, "event", event);
13264
- const eventId = paramCase7(`${id}-${shortId(event)}`);
13273
+ const eventId = paramCase8(`${id}-${shortId(event)}`);
13265
13274
  const { lambda } = createAsyncLambdaFunction(eventGroup, ctx, `store`, eventId, {
13266
13275
  ...funcProps,
13267
13276
  description: `${id} event "${event}"`
@@ -13609,26 +13618,18 @@ var topicFeature = defineFeature({
13609
13618
  for (const [id, props] of Object.entries(ctx.stackConfig.subscribers ?? {})) {
13610
13619
  const group = new Node23(ctx.stack, "topic", id);
13611
13620
  const topicArn = ctx.shared.get(`topic-${id}-arn`);
13612
- if (typeof props === "string" && isEmail(props)) {
13613
- new aws23.sns.Subscription(group, id, {
13614
- topicArn,
13615
- protocol: "email",
13616
- endpoint: props
13617
- });
13618
- } else if (typeof props === "object") {
13619
- const { lambda } = createAsyncLambdaFunction(group, ctx, `topic`, id, props);
13620
- new aws23.sns.Subscription(group, id, {
13621
- topicArn,
13622
- protocol: "lambda",
13623
- endpoint: lambda.arn
13624
- });
13625
- new aws23.lambda.Permission(group, id, {
13626
- action: "lambda:InvokeFunction",
13627
- principal: "sns.amazonaws.com",
13628
- functionArn: lambda.arn,
13629
- sourceArn: topicArn
13630
- });
13631
- }
13621
+ const { lambda } = createAsyncLambdaFunction(group, ctx, `topic`, id, props);
13622
+ new aws23.sns.Subscription(group, id, {
13623
+ topicArn,
13624
+ protocol: "lambda",
13625
+ endpoint: lambda.arn
13626
+ });
13627
+ new aws23.lambda.Permission(group, id, {
13628
+ action: "lambda:InvokeFunction",
13629
+ principal: "sns.amazonaws.com",
13630
+ functionArn: lambda.arn,
13631
+ sourceArn: topicArn
13632
+ });
13632
13633
  }
13633
13634
  }
13634
13635
  });
@@ -13702,6 +13703,67 @@ var vpcFeature = defineFeature({
13702
13703
  }
13703
13704
  });
13704
13705
 
13706
+ // src/feature/alert/index.ts
13707
+ import { aws as aws25, Node as Node25 } from "@awsless/formation";
13708
+ var typeGenCode8 = `
13709
+ import type { PublishOptions } from '@awsless/sns'
13710
+
13711
+ type Publish<Name extends string> = {
13712
+ readonly name: Name
13713
+ (payload: string, options?: Omit<PublishOptions, 'topic' | 'payload'>): Promise<void>
13714
+ }
13715
+ `;
13716
+ var alertFeature = defineFeature({
13717
+ name: "alert",
13718
+ async onTypeGen(ctx) {
13719
+ const gen = new TypeFile("@awsless/awsless");
13720
+ const resources = new TypeObject(1);
13721
+ for (const alert of Object.keys(ctx.appConfig.defaults.alerts ?? {})) {
13722
+ const name = formatGlobalResourceName({
13723
+ appName: ctx.appConfig.name,
13724
+ resourceType: "alert",
13725
+ resourceName: alert
13726
+ });
13727
+ resources.addType(alert, `Publish<'${name}'>`);
13728
+ }
13729
+ gen.addCode(typeGenCode8);
13730
+ gen.addInterface("AlertResources", resources);
13731
+ await ctx.write("alert.d.ts", gen, true);
13732
+ },
13733
+ onApp(ctx) {
13734
+ for (const [id, emails] of Object.entries(ctx.appConfig.defaults.alerts ?? {})) {
13735
+ const group = new Node25(ctx.base, "topic", id);
13736
+ const name = formatGlobalResourceName({
13737
+ appName: ctx.appConfig.name,
13738
+ resourceType: "alert",
13739
+ resourceName: id
13740
+ });
13741
+ const topic = new aws25.sns.Topic(group, "topic", {
13742
+ name
13743
+ });
13744
+ for (const email of emails) {
13745
+ new aws25.sns.Subscription(group, id, {
13746
+ topicArn: topic.arn,
13747
+ protocol: "email",
13748
+ endpoint: email
13749
+ });
13750
+ }
13751
+ }
13752
+ ctx.onAppPolicy((policy) => {
13753
+ policy.addStatement({
13754
+ actions: ["sns:Publish"],
13755
+ resources: [
13756
+ `arn:aws:sns:${ctx.appConfig.region}:${ctx.accountId}:${formatGlobalResourceName({
13757
+ appName: ctx.app.name,
13758
+ resourceType: "alert",
13759
+ resourceName: "*"
13760
+ })}`
13761
+ ]
13762
+ });
13763
+ });
13764
+ }
13765
+ });
13766
+
13705
13767
  // src/feature/index.ts
13706
13768
  var features = [
13707
13769
  // 1
@@ -13722,6 +13784,7 @@ var features = [
13722
13784
  streamFeature,
13723
13785
  tableFeature,
13724
13786
  topicFeature,
13787
+ alertFeature,
13725
13788
  queueFeature,
13726
13789
  storeFeature,
13727
13790
  cacheFeature,