@awsless/awsless 0.0.441 → 0.0.443

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.
@@ -1,26 +1,47 @@
1
1
  // cli/build-json-schema.ts
2
+ import { writeFileSync } from "node:fs";
3
+ import { join as join2 } from "node:path";
2
4
  import { zodToJsonSchema } from "zod-to-json-schema";
3
5
 
4
- // src/config/stack.ts
5
- import { z as z29 } from "zod";
6
+ // src/config/app.ts
7
+ import { z as z24 } from "zod";
8
+
9
+ // src/feature/alert/schema.ts
10
+ import { paramCase } from "change-case";
11
+ import { z as z2 } from "zod";
12
+
13
+ // src/config/schema/email.ts
14
+ import { z } from "zod";
15
+ var EmailSchema = z.string().email();
16
+
17
+ // src/feature/alert/schema.ts
18
+ 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.");
19
+ var AlertsDefaultSchema = z2.record(
20
+ AlertNameSchema,
21
+ z2.union([
22
+ //
23
+ EmailSchema.transform((v) => [v]),
24
+ EmailSchema.array()
25
+ ])
26
+ ).optional().describe("Define the alerts in your app. Alerts are a way to send messages to one or more email addresses.");
6
27
 
7
28
  // src/feature/auth/schema.ts
8
- import { z as z7 } from "zod";
29
+ import { z as z8 } from "zod";
9
30
 
10
31
  // src/config/schema/resource-id.ts
11
- import { paramCase } from "change-case";
12
- import { z } from "zod";
13
- var ResourceIdSchema = z.string().min(3).max(24).regex(/^[a-z0-9\-]+$/i, "Invalid resource ID").transform((value) => paramCase(value));
32
+ import { paramCase as paramCase2 } from "change-case";
33
+ import { z as z3 } from "zod";
34
+ var ResourceIdSchema = z3.string().min(3).max(24).regex(/^[a-z0-9\-]+$/i, "Invalid resource ID").transform((value) => paramCase2(value));
14
35
 
15
36
  // src/feature/function/schema.ts
16
37
  import { days, minutes, seconds, toDays } from "@awsless/duration";
17
38
  import { gibibytes, mebibytes } from "@awsless/size";
18
- import { z as z5 } from "zod";
39
+ import { z as z7 } from "zod";
19
40
 
20
41
  // src/config/schema/duration.ts
21
- import { z as z2 } from "zod";
42
+ import { z as z4 } from "zod";
22
43
  import { parse } from "@awsless/duration";
23
- var DurationSchema = z2.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/, "Invalid duration").transform((v) => parse(v));
44
+ var DurationSchema = z4.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/, "Invalid duration").transform((v) => parse(v));
24
45
  var durationMin = (min) => {
25
46
  return (duration) => {
26
47
  return duration.value >= min.value;
@@ -37,7 +58,7 @@ import { stat } from "fs/promises";
37
58
 
38
59
  // src/config/schema/relative-path.ts
39
60
  import { join } from "path";
40
- import { z as z3 } from "zod";
61
+ import { z as z5 } from "zod";
41
62
  var basePath;
42
63
  var resolvePath = (path) => {
43
64
  if (path.startsWith(".") && basePath) {
@@ -45,7 +66,7 @@ var resolvePath = (path) => {
45
66
  }
46
67
  return path;
47
68
  };
48
- var RelativePathSchema = z3.string().transform((path) => resolvePath(path));
69
+ var RelativePathSchema = z5.string().transform((path) => resolvePath(path));
49
70
 
50
71
  // src/config/schema/local-directory.ts
51
72
  var LocalDirectorySchema = RelativePathSchema.refine(async (path) => {
@@ -69,9 +90,9 @@ var LocalFileSchema = RelativePathSchema.refine(async (path) => {
69
90
  }, `File doesn't exist`);
70
91
 
71
92
  // src/config/schema/size.ts
72
- import { z as z4 } from "zod";
93
+ import { z as z6 } from "zod";
73
94
  import { parse as parse2 } from "@awsless/size";
74
- var SizeSchema = z4.string().regex(/^[0-9]+ (B|KB|MB|GB|TB|PB)$/, "Invalid size").transform((v) => parse2(v));
95
+ var SizeSchema = z6.string().regex(/^[0-9]+ (B|KB|MB|GB|TB|PB)$/, "Invalid size").transform((v) => parse2(v));
75
96
  var sizeMin = (min) => {
76
97
  return (size) => {
77
98
  return size.value >= min.value;
@@ -94,32 +115,32 @@ var EphemeralStorageSizeSchema = SizeSchema.refine(
94
115
  sizeMin(mebibytes(512)),
95
116
  "Minimum ephemeral storage size is 512 MB"
96
117
  ).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.");
97
- 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.");
98
- var EnvironmentSchema = z5.record(z5.string(), z5.string()).optional().describe("Environment variable key-value pairs.");
99
- var ArchitectureSchema = z5.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the function supports.");
100
- var RetryAttemptsSchema = z5.number().int().min(0).max(2).describe(
118
+ 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.");
119
+ var EnvironmentSchema = z7.record(z7.string(), z7.string()).optional().describe("Environment variable key-value pairs.");
120
+ var ArchitectureSchema = z7.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the function supports.");
121
+ var RetryAttemptsSchema = z7.number().int().min(0).max(2).describe(
101
122
  "The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
102
123
  );
103
- var NodeRuntimeSchema = z5.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x"]);
104
- var ContainerRuntimeSchema = z5.literal("container");
124
+ var NodeRuntimeSchema = z7.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x"]);
125
+ var ContainerRuntimeSchema = z7.literal("container");
105
126
  var RuntimeSchema = NodeRuntimeSchema.or(ContainerRuntimeSchema).describe("The identifier of the function's runtime.");
106
- var ActionSchema = z5.string();
107
- var ActionsSchema = z5.union([ActionSchema.transform((v) => [v]), ActionSchema.array()]);
108
- var ArnSchema = z5.string().startsWith("arn:").transform((v) => v);
109
- var WildcardSchema = z5.literal("*");
110
- var ResourceSchema = z5.union([ArnSchema, WildcardSchema]);
111
- var ResourcesSchema = z5.union([ResourceSchema.transform((v) => [v]), ResourceSchema.array()]);
112
- var PermissionSchema = z5.object({
113
- effect: z5.enum(["allow", "deny"]).default("allow"),
127
+ var ActionSchema = z7.string();
128
+ var ActionsSchema = z7.union([ActionSchema.transform((v) => [v]), ActionSchema.array()]);
129
+ var ArnSchema = z7.string().startsWith("arn:").transform((v) => v);
130
+ var WildcardSchema = z7.literal("*");
131
+ var ResourceSchema = z7.union([ArnSchema, WildcardSchema]);
132
+ var ResourcesSchema = z7.union([ResourceSchema.transform((v) => [v]), ResourceSchema.array()]);
133
+ var PermissionSchema = z7.object({
134
+ effect: z7.enum(["allow", "deny"]).default("allow"),
114
135
  actions: ActionsSchema,
115
136
  resources: ResourcesSchema
116
137
  });
117
- var PermissionsSchema = z5.union([PermissionSchema.transform((v) => [v]), PermissionSchema.array()]).describe("Add IAM permissions to your function.");
118
- 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.");
119
- var VPCSchema = z5.boolean().describe("Put the function inside your global VPC.");
120
- var MinifySchema = z5.boolean().describe("Minify the function code.");
121
- var HandlerSchema = z5.string().describe("The name of the exported method within your code that Lambda calls to run your function.");
122
- var DescriptionSchema = z5.string().describe("A description of the function.");
138
+ var PermissionsSchema = z7.union([PermissionSchema.transform((v) => [v]), PermissionSchema.array()]).describe("Add IAM permissions to your function.");
139
+ 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.");
140
+ var VPCSchema = z7.boolean().describe("Put the function inside your global VPC.");
141
+ var MinifySchema = z7.boolean().describe("Minify the function code.");
142
+ var HandlerSchema = z7.string().describe("The name of the exported method within your code that Lambda calls to run your function.");
143
+ var DescriptionSchema = z7.string().describe("A description of the function.");
123
144
  var validLogRetentionDays = [
124
145
  ...[1n, 3n, 5n, 7n, 14n, 30n, 60n, 90n, 120n, 150n],
125
146
  ...[180n, 365n, 400n, 545n, 731n, 1096n, 1827n, 2192n],
@@ -134,54 +155,54 @@ var LogRetentionSchema = DurationSchema.refine(
134
155
  },
135
156
  `Invalid log retention. Valid days are: ${validLogRetentionDays.map((days3) => `${days3}`).join(", ")}`
136
157
  ).describe("The log retention duration.");
137
- var LogSubscriptionSchema = z5.union([
158
+ var LogSubscriptionSchema = z7.union([
138
159
  LocalFileSchema.transform((file) => ({
139
160
  file
140
161
  })),
141
- z5.object({
162
+ z7.object({
142
163
  subscriber: LocalFileSchema,
143
- filter: z5.string().optional()
164
+ filter: z7.string().optional()
144
165
  })
145
166
  ]).describe(
146
167
  "Log Subscription allow you to subscribe to a real-time stream of log events and have them delivered to a specific destination"
147
168
  );
148
- var LogSchema = z5.union([
149
- z5.boolean().transform((enabled) => ({ retention: enabled ? days(7) : days(0) })),
169
+ var LogSchema = z7.union([
170
+ z7.boolean().transform((enabled) => ({ retention: enabled ? days(7) : days(0) })),
150
171
  LogRetentionSchema.transform((retention) => ({ retention })),
151
- z5.object({
172
+ z7.object({
152
173
  subscription: LogSubscriptionSchema.optional(),
153
174
  retention: LogRetentionSchema.optional(),
154
- format: z5.enum(["text", "json"]).describe(
175
+ format: z7.enum(["text", "json"]).describe(
155
176
  `The format in which Lambda sends your function's application and system logs to CloudWatch. Select between plain text and structured JSON.`
156
177
  ).optional(),
157
- system: z5.enum(["debug", "info", "warn"]).describe(
178
+ system: z7.enum(["debug", "info", "warn"]).describe(
158
179
  "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."
159
180
  ).optional(),
160
- level: z5.enum(["trace", "debug", "info", "warn", "error", "fatal"]).describe(
181
+ level: z7.enum(["trace", "debug", "info", "warn", "error", "fatal"]).describe(
161
182
  "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."
162
183
  ).optional()
163
184
  })
164
185
  ]).describe("Enable logging to a CloudWatch log group. Providing a duration value will set the log retention time.");
165
- var LayersSchema = z5.string().array().describe(
186
+ var LayersSchema = z7.string().array().describe(
166
187
  // `A list of function layers to add to the function's execution environment..`
167
188
  `A list of function layers to add to the function's execution environment. Specify each layer by its ARN, including the version.`
168
189
  );
169
- var FileCodeSchema = z5.object({
190
+ var FileCodeSchema = z7.object({
170
191
  file: LocalFileSchema.describe("The file path of the function code."),
171
192
  minify: MinifySchema.optional().default(true),
172
- external: z5.string().array().optional().describe(`A list of external packages that won't be included in the bundle.`)
193
+ external: z7.string().array().optional().describe(`A list of external packages that won't be included in the bundle.`)
173
194
  });
174
- var BundleCodeSchema = z5.object({
195
+ var BundleCodeSchema = z7.object({
175
196
  bundle: LocalDirectorySchema.describe("The directory that needs to be bundled.")
176
197
  });
177
- var CodeSchema = z5.union([
198
+ var CodeSchema = z7.union([
178
199
  LocalFileSchema.transform((file) => ({
179
200
  file
180
201
  })).pipe(FileCodeSchema),
181
202
  FileCodeSchema,
182
203
  BundleCodeSchema
183
204
  ]).describe("Specify the code of your function.");
184
- var FnSchema = z5.object({
205
+ var FnSchema = z7.object({
185
206
  code: CodeSchema,
186
207
  // node
187
208
  handler: HandlerSchema.optional(),
@@ -204,14 +225,14 @@ var FnSchema = z5.object({
204
225
  environment: EnvironmentSchema.optional(),
205
226
  permissions: PermissionsSchema.optional()
206
227
  });
207
- var FunctionSchema = z5.union([
228
+ var FunctionSchema = z7.union([
208
229
  LocalFileSchema.transform((code) => ({
209
230
  code
210
231
  })).pipe(FnSchema),
211
232
  FnSchema
212
233
  ]);
213
- var FunctionsSchema = z5.record(ResourceIdSchema, FunctionSchema).optional().describe("Define the functions in your stack.");
214
- var FunctionDefaultSchema = z5.object({
234
+ var FunctionsSchema = z7.record(ResourceIdSchema, FunctionSchema).optional().describe("Define the functions in your stack.");
235
+ var FunctionDefaultSchema = z7.object({
215
236
  runtime: RuntimeSchema.default("nodejs20.x"),
216
237
  // node
217
238
  handler: HandlerSchema.default("index.default"),
@@ -239,12 +260,8 @@ var FunctionDefaultSchema = z5.object({
239
260
  permissions: PermissionsSchema.optional()
240
261
  }).default({});
241
262
 
242
- // src/config/schema/email.ts
243
- import { z as z6 } from "zod";
244
- var EmailSchema = z6.string().email();
245
-
246
263
  // src/feature/auth/schema.ts
247
- var TriggersSchema = z7.object({
264
+ var TriggersSchema = z8.object({
248
265
  beforeToken: FunctionSchema.optional().describe("A pre jwt token generation AWS Lambda trigger."),
249
266
  beforeLogin: FunctionSchema.optional().describe("A pre user login AWS Lambda trigger."),
250
267
  afterLogin: FunctionSchema.optional().describe("A post user login AWS Lambda trigger."),
@@ -257,42 +274,42 @@ var TriggersSchema = z7.object({
257
274
  createChallenge: FunctionSchema.optional().describe("Creates an authentication challenge."),
258
275
  verifyChallenge: FunctionSchema.optional().describe("Verifies the authentication challenge response.")
259
276
  }).describe("Specifies the configuration for AWS Lambda triggers.");
260
- var AuthSchema = z7.record(
277
+ var AuthSchema = z8.record(
261
278
  ResourceIdSchema,
262
- z7.object({
263
- access: z7.boolean().default(false).describe("Give access to every function in this stack to your cognito instance."),
279
+ z8.object({
280
+ access: z8.boolean().default(false).describe("Give access to every function in this stack to your cognito instance."),
264
281
  triggers: TriggersSchema.optional()
265
282
  })
266
283
  ).optional().describe("Define the auth triggers in your stack.");
267
- var AuthDefaultSchema = z7.record(
284
+ var AuthDefaultSchema = z8.record(
268
285
  ResourceIdSchema,
269
- z7.object({
270
- allowUserRegistration: z7.boolean().default(true).describe("Specifies whether users can create an user account or if only the administrator can."),
271
- messaging: z7.object({
286
+ z8.object({
287
+ allowUserRegistration: z8.boolean().default(true).describe("Specifies whether users can create an user account or if only the administrator can."),
288
+ messaging: z8.object({
272
289
  fromEmail: EmailSchema.describe("Specifies the sender's email address."),
273
- fromName: z7.string().optional().describe("Specifies the sender's name."),
290
+ fromName: z8.string().optional().describe("Specifies the sender's name."),
274
291
  replyTo: EmailSchema.optional().describe(
275
292
  "The destination to which the receiver of the email should reply."
276
293
  )
277
294
  }).optional().describe("The email configuration for sending messages."),
278
295
  // secret: z.boolean().default(false).describe('Specifies whether you want to generate a client secret.'),
279
- username: z7.object({
280
- emailAlias: z7.boolean().default(true).describe("Allow the user email to be used as username."),
281
- caseSensitive: z7.boolean().default(false).describe(
296
+ username: z8.object({
297
+ emailAlias: z8.boolean().default(true).describe("Allow the user email to be used as username."),
298
+ caseSensitive: z8.boolean().default(false).describe(
282
299
  "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."
283
300
  )
284
301
  }).default({}).describe("The username policy."),
285
- password: z7.object({
286
- minLength: z7.number().int().min(6).max(99).default(12).describe("Required users to have at least the minimum password length."),
287
- uppercase: z7.boolean().default(true).describe("Required users to use at least one uppercase letter in their password."),
288
- lowercase: z7.boolean().default(true).describe("Required users to use at least one lowercase letter in their password."),
289
- numbers: z7.boolean().default(true).describe("Required users to use at least one number in their password."),
290
- symbols: z7.boolean().default(true).describe("Required users to use at least one symbol in their password."),
302
+ password: z8.object({
303
+ minLength: z8.number().int().min(6).max(99).default(12).describe("Required users to have at least the minimum password length."),
304
+ uppercase: z8.boolean().default(true).describe("Required users to use at least one uppercase letter in their password."),
305
+ lowercase: z8.boolean().default(true).describe("Required users to use at least one lowercase letter in their password."),
306
+ numbers: z8.boolean().default(true).describe("Required users to use at least one number in their password."),
307
+ symbols: z8.boolean().default(true).describe("Required users to use at least one symbol in their password."),
291
308
  temporaryPasswordValidity: DurationSchema.default("7 days").describe(
292
309
  "The duration a temporary password is valid. If the user doesn't sign in during this time, an administrator must reset their password."
293
310
  )
294
311
  }).default({}).describe("The password policy."),
295
- validity: z7.object({
312
+ validity: z8.object({
296
313
  idToken: DurationSchema.default("1 hour").describe(
297
314
  "The ID token time limit. After this limit expires, your user can't use their ID token."
298
315
  ),
@@ -307,138 +324,40 @@ var AuthDefaultSchema = z7.record(
307
324
  })
308
325
  ).default({}).describe("Define the authenticatable users in your app.");
309
326
 
310
- // src/feature/cache/schema.ts
311
- import { z as z8 } from "zod";
312
- var TypeSchema = z8.enum([
313
- "t4g.small",
314
- "t4g.medium",
315
- "r6g.large",
316
- "r6g.xlarge",
317
- "r6g.2xlarge",
318
- "r6g.4xlarge",
319
- "r6g.8xlarge",
320
- "r6g.12xlarge",
321
- "r6g.16xlarge",
322
- "r6gd.xlarge",
323
- "r6gd.2xlarge",
324
- "r6gd.4xlarge",
325
- "r6gd.8xlarge"
326
- ]);
327
- var PortSchema = z8.number().int().min(1).max(5e4);
328
- var ShardsSchema = z8.number().int().min(0).max(100);
329
- var ReplicasPerShardSchema = z8.number().int().min(0).max(5);
330
- var EngineSchema = z8.enum(["7.0", "6.2"]);
331
- var CachesSchema = z8.record(
332
- ResourceIdSchema,
333
- z8.object({
334
- type: TypeSchema.default("t4g.small"),
335
- port: PortSchema.default(6379),
336
- shards: ShardsSchema.default(1),
337
- replicasPerShard: ReplicasPerShardSchema.default(1),
338
- engine: EngineSchema.default("7.0"),
339
- dataTiering: z8.boolean().default(false)
340
- })
341
- ).optional().describe("Define the caches in your stack. For access to the cache put your functions inside the global VPC.");
342
-
343
- // src/feature/command/schema.ts
327
+ // src/feature/domain/schema.ts
344
328
  import { z as z9 } from "zod";
345
- var CommandSchema = z9.union([
346
- z9.object({
347
- file: LocalFileSchema,
348
- handler: z9.string().default("default").describe("The name of the handler that needs to run"),
349
- description: z9.string().optional().describe("A description of the command")
350
- // options: z.record(ResourceIdSchema, OptionSchema).optional(),
351
- // arguments: z.record(ResourceIdSchema, ArgumentSchema).optional(),
352
- }),
353
- LocalFileSchema.transform((file) => ({
354
- file,
355
- handler: "default",
356
- description: void 0
357
- }))
358
- ]);
359
- var CommandsSchema = z9.record(ResourceIdSchema, CommandSchema).optional().describe("Define the custom commands for your stack.");
360
-
361
- // src/feature/config/schema.ts
362
- import { z as z10 } from "zod";
363
- var ConfigNameSchema = z10.string().regex(/[a-z0-9\-]/g, "Invalid config name");
364
- var ConfigsSchema = z10.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
365
-
366
- // src/feature/cron/schema/index.ts
367
- import { z as z12 } from "zod";
368
-
369
- // src/feature/cron/schema/schedule.ts
370
- import { z as z11 } from "zod";
371
- import { awsCronExpressionValidator } from "aws-cron-expression-validator";
372
- var RateExpressionSchema = z11.custom(
373
- (value) => {
374
- return z11.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
375
- const [str] = rate.split(" ");
376
- const number = parseInt(str);
377
- return number > 0;
378
- }).safeParse(value).success;
379
- },
380
- { message: "Invalid rate expression" }
381
- ).transform((rate) => {
382
- const [str] = rate.split(" ");
383
- const number = parseInt(str);
384
- const more = rate.endsWith("s");
385
- if (more && number === 1) {
386
- return `rate(${rate.substring(0, rate.length - 1)})`;
387
- }
388
- return `rate(${rate})`;
389
- });
390
- var CronExpressionSchema = z11.custom(
391
- (value) => {
392
- return z11.string().safeParse(value).success;
393
- },
394
- { message: "Invalid cron expression" }
395
- ).superRefine((value, ctx) => {
396
- try {
397
- awsCronExpressionValidator(value);
398
- } catch (error) {
399
- if (error instanceof Error) {
400
- ctx.addIssue({
401
- code: z11.ZodIssueCode.custom,
402
- message: `Invalid cron expression: ${error.message}`
403
- });
404
- } else {
405
- ctx.addIssue({
406
- code: z11.ZodIssueCode.custom,
407
- message: "Invalid cron expression"
408
- });
409
- }
410
- }
411
- }).transform((value) => {
412
- return `cron(${value.trim()})`;
413
- });
414
- var ScheduleExpressionSchema = RateExpressionSchema.or(CronExpressionSchema);
415
-
416
- // src/feature/cron/schema/index.ts
417
- var CronsSchema = z12.record(
329
+ var DomainNameSchema = z9.string().regex(/[a-z\-\_\.]/g, "Invalid domain name").describe(
330
+ "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."
331
+ );
332
+ var DNSTypeSchema = z9.enum(["A", "AAAA", "CAA", "CNAME", "DS", "MX", "NAPTR", "NS", "PTR", "SOA", "SPF", "SRV", "TXT"]).describe("The DNS record type.");
333
+ var TTLSchema = DurationSchema.describe("The resource record cache time to live (TTL).");
334
+ var RecordsSchema = z9.string().array().describe("One or more values that correspond with the value that you specified for the Type property.");
335
+ var DomainsDefaultSchema = z9.record(
418
336
  ResourceIdSchema,
419
- z12.object({
420
- enabled: z12.boolean().default(true).describe("If the cron is enabled."),
421
- consumer: FunctionSchema.describe("The consuming lambda function properties."),
422
- schedule: ScheduleExpressionSchema.describe(
423
- 'The scheduling expression.\n\nexample: "0 20 * * ? *"\nexample: "5 minutes"'
424
- ),
425
- payload: z12.unknown().optional().describe("The JSON payload that will be passed to the consumer.")
337
+ z9.object({
338
+ domain: DomainNameSchema.describe("Define the domain name"),
339
+ dns: z9.object({
340
+ name: DomainNameSchema.optional(),
341
+ type: DNSTypeSchema,
342
+ ttl: TTLSchema,
343
+ records: RecordsSchema
344
+ }).array().optional().describe("Define the domain dns records")
426
345
  })
427
- ).optional().describe(`Define the cron jobs in your stack.`);
346
+ ).optional().describe("Define the domains for your application.");
428
347
 
429
348
  // src/feature/graphql/schema.ts
430
- import { z as z13 } from "zod";
349
+ import { z as z10 } from "zod";
431
350
  var AuthorizerTtl = DurationSchema.describe(
432
351
  `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.`
433
352
  );
434
- var GraphQLDefaultSchema = z13.record(
353
+ var GraphQLDefaultSchema = z10.record(
435
354
  ResourceIdSchema,
436
- z13.object({
355
+ z10.object({
437
356
  domain: ResourceIdSchema.describe("The domain id to link your API with.").optional(),
438
- subDomain: z13.string().optional(),
439
- auth: z13.union([
357
+ subDomain: z10.string().optional(),
358
+ auth: z10.union([
440
359
  ResourceIdSchema,
441
- z13.object({
360
+ z10.object({
442
361
  authorizer: FunctionSchema,
443
362
  ttl: AuthorizerTtl.default("1 hour")
444
363
  })
@@ -450,22 +369,22 @@ var GraphQLDefaultSchema = z13.record(
450
369
  resolver: LocalFileSchema.optional()
451
370
  })
452
371
  ).describe(`Define the global GraphQL API's.`).optional();
453
- var GraphQLSchema = z13.record(
372
+ var GraphQLSchema = z10.record(
454
373
  ResourceIdSchema,
455
- z13.object({
374
+ z10.object({
456
375
  // schema: z.union([LocalFileSchema.transform(v => [v]), z.array(LocalFileSchema).min(1)]).optional(),
457
376
  schema: LocalFileSchema.describe("The graphql schema file."),
458
- resolvers: z13.record(
377
+ resolvers: z10.record(
459
378
  // TypeName
460
- z13.string(),
461
- z13.record(
379
+ z10.string(),
380
+ z10.record(
462
381
  // FieldName
463
- z13.string(),
464
- z13.union([
382
+ z10.string(),
383
+ z10.union([
465
384
  FunctionSchema.transform((consumer) => ({
466
385
  consumer
467
386
  })),
468
- z13.object({
387
+ z10.object({
469
388
  consumer: FunctionSchema,
470
389
  resolver: LocalFileSchema.optional()
471
390
  })
@@ -476,22 +395,22 @@ var GraphQLSchema = z13.record(
476
395
  ).describe("Define the schema & resolvers in your stack for your global GraphQL API.").optional();
477
396
 
478
397
  // src/feature/http/schema.ts
479
- import { z as z14 } from "zod";
480
- var RouteSchema = z14.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route").transform((v) => v);
481
- var HttpDefaultSchema = z14.record(
398
+ import { z as z11 } from "zod";
399
+ var RouteSchema = z11.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route").transform((v) => v);
400
+ var HttpDefaultSchema = z11.record(
482
401
  ResourceIdSchema,
483
- z14.object({
402
+ z11.object({
484
403
  domain: ResourceIdSchema.describe("The domain id to link your API with."),
485
- subDomain: z14.string().optional()
404
+ subDomain: z11.string().optional()
486
405
  // auth: ResourceIdSchema.optional(),
487
406
  })
488
407
  ).optional().describe("Define your global HTTP API's.");
489
- var HttpSchema = z14.record(ResourceIdSchema, z14.record(RouteSchema, FunctionSchema)).optional().describe("Define routes in your stack for your global HTTP API.");
408
+ var HttpSchema = z11.record(ResourceIdSchema, z11.record(RouteSchema, FunctionSchema)).optional().describe("Define routes in your stack for your global HTTP API.");
490
409
 
491
410
  // src/feature/instance/schema.ts
492
- import { z as z15 } from "zod";
493
- var ImageSchema = z15.string().regex(/^ami\-[0-9a-f]+/).describe("The ID of the AMI.");
494
- var TypeSchema2 = z15.enum([
411
+ import { z as z12 } from "zod";
412
+ var ImageSchema = z12.string().regex(/^ami\-[0-9a-f]+/).describe("The ID of the AMI.");
413
+ var TypeSchema = z12.enum([
495
414
  "t3.nano",
496
415
  "t3.micro",
497
416
  "t3.small",
@@ -509,39 +428,86 @@ var TypeSchema2 = z15.enum([
509
428
  "g4ad.xlarge",
510
429
  "g4dn.xlarge"
511
430
  ]).describe(`The instance type.`);
512
- var CommandSchema2 = z15.string().describe(`The script you want to execute when the instance starts up.`);
431
+ var CommandSchema = z12.string().describe(`The script you want to execute when the instance starts up.`);
513
432
  var CodeSchema2 = LocalDirectorySchema.describe(`The code directory that will be deployed to your instance.`);
514
- var ConnectSchema = z15.boolean().describe("Allows you to connect to all instances with an Instance Connect Endpoint.");
515
- var EnvironmentSchema2 = z15.record(z15.string(), z15.string()).optional().describe("Environment variable key-value pairs.");
516
- var ActionSchema2 = z15.string();
517
- var ActionsSchema2 = z15.union([ActionSchema2.transform((v) => [v]), ActionSchema2.array()]);
518
- var ArnSchema2 = z15.string().startsWith("arn:");
519
- var WildcardSchema2 = z15.literal("*");
520
- var ResourceSchema2 = z15.union([ArnSchema2, WildcardSchema2]).transform((v) => v);
521
- var ResourcesSchema2 = z15.union([ResourceSchema2.transform((v) => [v]), ResourceSchema2.array()]);
522
- var PermissionSchema2 = z15.object({
523
- effect: z15.enum(["allow", "deny"]).default("allow"),
433
+ var ConnectSchema = z12.boolean().describe("Allows you to connect to all instances with an Instance Connect Endpoint.");
434
+ var EnvironmentSchema2 = z12.record(z12.string(), z12.string()).optional().describe("Environment variable key-value pairs.");
435
+ var ActionSchema2 = z12.string();
436
+ var ActionsSchema2 = z12.union([ActionSchema2.transform((v) => [v]), ActionSchema2.array()]);
437
+ var ArnSchema2 = z12.string().startsWith("arn:");
438
+ var WildcardSchema2 = z12.literal("*");
439
+ var ResourceSchema2 = z12.union([ArnSchema2, WildcardSchema2]).transform((v) => v);
440
+ var ResourcesSchema2 = z12.union([ResourceSchema2.transform((v) => [v]), ResourceSchema2.array()]);
441
+ var PermissionSchema2 = z12.object({
442
+ effect: z12.enum(["allow", "deny"]).default("allow"),
524
443
  actions: ActionsSchema2,
525
444
  resources: ResourcesSchema2
526
445
  });
527
- var PermissionsSchema2 = z15.union([PermissionSchema2.transform((v) => [v]), PermissionSchema2.array()]).describe("Add IAM permissions to your instance.");
528
- var InstanceDefaultSchema = z15.object({
446
+ var PermissionsSchema2 = z12.union([PermissionSchema2.transform((v) => [v]), PermissionSchema2.array()]).describe("Add IAM permissions to your instance.");
447
+ var InstanceDefaultSchema = z12.object({
529
448
  connect: ConnectSchema.default(false)
530
449
  }).default({}).describe("Define the default settings for all instances in your stacks.");
531
- var InstancesSchema = z15.record(
450
+ var InstancesSchema = z12.record(
532
451
  ResourceIdSchema,
533
- z15.object({
452
+ z12.object({
534
453
  image: ImageSchema,
535
- type: TypeSchema2,
454
+ type: TypeSchema,
536
455
  code: CodeSchema2,
537
- user: z15.string().default("ec2-user"),
538
- command: CommandSchema2.optional(),
456
+ user: z12.string().default("ec2-user"),
457
+ command: CommandSchema.optional(),
539
458
  environment: EnvironmentSchema2.optional(),
540
459
  permissions: PermissionsSchema2.optional(),
541
- waitForTermination: z15.boolean().default(true)
460
+ waitForTermination: z12.boolean().default(true)
542
461
  })
543
462
  ).optional().describe("Define the instances in your stack.");
544
463
 
464
+ // src/feature/layer/schema.ts
465
+ import { z as z14 } from "zod";
466
+
467
+ // src/config/schema/lambda.ts
468
+ import { z as z13 } from "zod";
469
+ var ArchitectureSchema2 = z13.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the function supports.");
470
+ var NodeRuntimeSchema2 = z13.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x"]).describe("The identifier of the function's runtime.");
471
+
472
+ // src/feature/layer/schema.ts
473
+ var Schema = z14.object({
474
+ file: LocalFileSchema,
475
+ runtimes: NodeRuntimeSchema2.array().optional(),
476
+ architecture: ArchitectureSchema2.optional(),
477
+ packages: z14.string().array().optional().describe(
478
+ "Define the package names that are available bundled in the layer. Those packages are not bundled while bundling the lambda."
479
+ )
480
+ });
481
+ var LayerSchema = z14.record(
482
+ z14.string(),
483
+ z14.union([
484
+ LocalFileSchema.transform((file) => ({
485
+ file,
486
+ description: void 0
487
+ })),
488
+ Schema
489
+ ])
490
+ ).optional().describe("Define the lambda layers in your stack.");
491
+
492
+ // src/feature/on-failure/schema.ts
493
+ var OnFailureDefaultSchema = FunctionSchema.optional().describe(
494
+ "Defining a onFailure handler will add a global onFailure handler for the following resources:\n- Async lambda functions\n- SQS queues\n- DynamoDB streams"
495
+ );
496
+
497
+ // src/feature/on-log/schema.ts
498
+ import { z as z15 } from "zod";
499
+ var FilterSchema = z15.enum(["trace", "debug", "info", "warn", "error", "fatal"]).array().describe("The log level that will gets delivered to the consumer.");
500
+ var OnLogDefaultSchema = z15.union([
501
+ FunctionSchema.transform((consumer) => ({
502
+ consumer,
503
+ filter: ["error", "fatal"]
504
+ })),
505
+ z15.object({
506
+ consumer: FunctionSchema,
507
+ filter: FilterSchema
508
+ })
509
+ ]).optional().describe("Define a subscription on all Lambda functions logs.");
510
+
545
511
  // src/feature/pubsub/schema.ts
546
512
  import { z as z16 } from "zod";
547
513
  var DomainSchema = ResourceIdSchema.describe("The domain id to link your Pubsub API with.");
@@ -682,70 +648,360 @@ var RpcDefaultSchema = z20.record(
682
648
  ).describe(`Define the global RPC API's.`).optional();
683
649
  var RpcSchema = z20.record(ResourceIdSchema, z20.record(z20.string(), FunctionSchema).describe("The queries for your global RPC API.")).describe("Define the schema in your stack for your global RPC API.").optional();
684
650
 
685
- // src/feature/search/schema.ts
686
- import { gibibytes as gibibytes2 } from "@awsless/size";
651
+ // src/feature/store/schema.ts
687
652
  import { z as z21 } from "zod";
688
- var VersionSchema = z21.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]);
689
- var TypeSchema3 = z21.enum([
690
- "t3.small",
691
- "t3.medium",
692
- "m3.medium",
693
- "m3.large",
694
- "m3.xlarge",
695
- "m3.2xlarge",
696
- "m4.large",
697
- "m4.xlarge",
698
- "m4.2xlarge",
699
- "m4.4xlarge",
700
- "m4.10xlarge",
701
- "m5.large",
702
- "m5.xlarge",
703
- "m5.2xlarge",
704
- "m5.4xlarge",
705
- "m5.12xlarge",
706
- "m5.24xlarge",
707
- "r5.large",
708
- "r5.xlarge",
709
- "r5.2xlarge",
710
- "r5.4xlarge",
711
- "r5.12xlarge",
712
- "r5.24xlarge",
713
- "c5.large",
714
- "c5.xlarge",
715
- "c5.2xlarge",
716
- "c5.4xlarge",
717
- "c5.9xlarge",
718
- "c5.18xlarge",
719
- "or1.medium",
720
- "or1.large",
721
- "or1.xlarge",
722
- "or1.2xlarge",
723
- "or1.4xlarge",
724
- "or1.8xlarge",
725
- "or1.12xlarge",
726
- "or1.16xlarge",
727
- "ultrawarm1.medium",
728
- "ultrawarm1.large",
729
- "ultrawarm1.xlarge",
730
- "r3.large",
731
- "r3.xlarge",
732
- "r3.2xlarge",
733
- "r3.4xlarge",
734
- "r3.8xlarge",
735
- "i2.xlarge",
736
- "i2.2xlarge",
737
- "i3.large",
738
- "i3.xlarge",
739
- "i3.2xlarge",
740
- "i3.4xlarge",
741
- "i3.8xlarge",
742
- "i3.16xlarge",
743
- "r6g.large",
744
- "r6g.xlarge",
745
- "r6g.2xlarge",
746
- "r6g.4xlarge",
747
- "r6g.8xlarge",
748
- "r6g.12xlarge",
653
+ var DeletionProtectionSchema = z21.boolean().describe("Specifies if you want to protect the store from being deleted by awsless.");
654
+ var StoreDefaultSchema = z21.object({
655
+ deletionProtection: DeletionProtectionSchema.optional()
656
+ }).optional();
657
+ var StoresSchema = z21.union([
658
+ z21.array(ResourceIdSchema).transform((list) => {
659
+ const stores = {};
660
+ for (const key of list) {
661
+ stores[key] = {};
662
+ }
663
+ return stores;
664
+ }),
665
+ z21.record(
666
+ ResourceIdSchema,
667
+ z21.object({
668
+ // cors: CorsSchema,
669
+ deletionProtection: DeletionProtectionSchema.optional(),
670
+ versioning: z21.boolean().default(false).describe("Enable versioning of your store."),
671
+ events: z21.object({
672
+ // create
673
+ "created:*": FunctionSchema.optional().describe(
674
+ "Subscribe to notifications regardless of the API that was used to create an object."
675
+ ),
676
+ "created:put": FunctionSchema.optional().describe(
677
+ "Subscribe to notifications when an object is created using the PUT API operation."
678
+ ),
679
+ "created:post": FunctionSchema.optional().describe(
680
+ "Subscribe to notifications when an object is created using the POST API operation."
681
+ ),
682
+ "created:copy": FunctionSchema.optional().describe(
683
+ "Subscribe to notifications when an object is created using the COPY API operation."
684
+ ),
685
+ "created:upload": FunctionSchema.optional().describe(
686
+ "Subscribe to notifications when an object multipart upload has been completed."
687
+ ),
688
+ // remove
689
+ "removed:*": FunctionSchema.optional().describe(
690
+ "Subscribe to notifications when an object is deleted or a delete marker for a versioned object is created."
691
+ ),
692
+ "removed:delete": FunctionSchema.optional().describe(
693
+ "Subscribe to notifications when an object is deleted"
694
+ ),
695
+ "removed:marker": FunctionSchema.optional().describe(
696
+ "Subscribe to notifications when a delete marker for a versioned object is created."
697
+ )
698
+ }).optional().describe("Describes the store events you want to subscribe too.")
699
+ })
700
+ )
701
+ ]).optional().describe("Define the stores in your stack.");
702
+
703
+ // src/feature/table/schema.ts
704
+ import { z as z22 } from "zod";
705
+ var KeySchema = z22.string().min(1).max(255);
706
+ var DeletionProtectionSchema2 = z22.boolean().describe("Specifies if you want to protect the table from being deleted by awsless.");
707
+ var TableDefaultSchema = z22.object({
708
+ deletionProtection: DeletionProtectionSchema2.optional()
709
+ }).optional();
710
+ var TablesSchema = z22.record(
711
+ ResourceIdSchema,
712
+ z22.object({
713
+ hash: KeySchema.describe(
714
+ "Specifies the name of the partition / hash key that makes up the primary key for the table."
715
+ ),
716
+ sort: KeySchema.optional().describe(
717
+ "Specifies the name of the range / sort key that makes up the primary key for the table."
718
+ ),
719
+ fields: z22.record(z22.string(), z22.enum(["string", "number", "binary"])).optional().describe(
720
+ 'A list of attributes that describe the key schema for the table and indexes. If no attribute field is defined we default to "string".'
721
+ ),
722
+ class: z22.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
723
+ pointInTimeRecovery: z22.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
724
+ timeToLiveAttribute: KeySchema.optional().describe(
725
+ "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."
726
+ ),
727
+ deletionProtection: DeletionProtectionSchema2.optional(),
728
+ stream: z22.object({
729
+ type: z22.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
730
+ "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."
731
+ ),
732
+ consumer: FunctionSchema.describe("The consuming lambda function for the stream")
733
+ }).optional().describe(
734
+ "The settings for the DynamoDB table stream, which capture changes to items stored in the table."
735
+ ),
736
+ indexes: z22.record(
737
+ z22.string(),
738
+ z22.object({
739
+ /** Specifies the name of the partition / hash key that makes up the primary key for the global secondary index. */
740
+ hash: KeySchema,
741
+ /** Specifies the name of the range / sort key that makes up the primary key for the global secondary index. */
742
+ sort: KeySchema.optional(),
743
+ /** The set of attributes that are projected into the index:
744
+ * - all - All of the table attributes are projected into the index.
745
+ * - keys-only - Only the index and primary keys are projected into the index.
746
+ * @default 'all'
747
+ */
748
+ projection: z22.enum(["all", "keys-only"]).default("all")
749
+ })
750
+ ).optional().describe("Specifies the global secondary indexes to be created on the table.")
751
+ })
752
+ ).optional().describe("Define the tables in your stack.");
753
+
754
+ // src/config/schema/region.ts
755
+ import { z as z23 } from "zod";
756
+ var US = ["us-east-2", "us-east-1", "us-west-1", "us-west-2"];
757
+ var AF = ["af-south-1"];
758
+ var AP = [
759
+ "ap-east-1",
760
+ "ap-south-2",
761
+ "ap-southeast-3",
762
+ "ap-southeast-4",
763
+ "ap-south-1",
764
+ "ap-northeast-3",
765
+ "ap-northeast-2",
766
+ "ap-southeast-1",
767
+ "ap-southeast-2",
768
+ "ap-northeast-1"
769
+ ];
770
+ var CA = ["ca-central-1"];
771
+ var EU = [
772
+ "eu-central-1",
773
+ "eu-west-1",
774
+ "eu-west-2",
775
+ "eu-south-1",
776
+ "eu-west-3",
777
+ "eu-south-2",
778
+ "eu-north-1",
779
+ "eu-central-2"
780
+ ];
781
+ var ME = ["me-south-1", "me-central-1"];
782
+ var SA = ["sa-east-1"];
783
+ var regions = [...US, ...AF, ...AP, ...CA, ...EU, ...ME, ...SA];
784
+ var RegionSchema = z23.enum(regions);
785
+
786
+ // src/config/app.ts
787
+ var AppSchema = z24.object({
788
+ $schema: z24.string().optional(),
789
+ name: ResourceIdSchema.describe("App name."),
790
+ region: RegionSchema.describe("The AWS region to deploy to."),
791
+ profile: z24.string().describe("The AWS profile to deploy to."),
792
+ // stage: z
793
+ // .string()
794
+ // .regex(/^[a-z]+$/)
795
+ // .default('prod')
796
+ // .describe('The deployment stage.'),
797
+ // onFailure: OnFailureSchema,
798
+ defaults: z24.object({
799
+ onFailure: OnFailureDefaultSchema,
800
+ onLog: OnLogDefaultSchema,
801
+ auth: AuthDefaultSchema,
802
+ domains: DomainsDefaultSchema,
803
+ function: FunctionDefaultSchema,
804
+ instance: InstanceDefaultSchema,
805
+ queue: QueueDefaultSchema,
806
+ graphql: GraphQLDefaultSchema,
807
+ http: HttpDefaultSchema,
808
+ rest: RestDefaultSchema,
809
+ rpc: RpcDefaultSchema,
810
+ pubsub: PubSubDefaultSchema,
811
+ table: TableDefaultSchema,
812
+ store: StoreDefaultSchema,
813
+ alerts: AlertsDefaultSchema,
814
+ layers: LayerSchema
815
+ // dataRetention: z.boolean().describe('Configure how your resources are handled on delete.').default(false),
816
+ }).default({}).describe("Default properties")
817
+ });
818
+
819
+ // src/config/stack.ts
820
+ import { z as z36 } from "zod";
821
+
822
+ // src/feature/cache/schema.ts
823
+ import { z as z25 } from "zod";
824
+ var TypeSchema2 = z25.enum([
825
+ "t4g.small",
826
+ "t4g.medium",
827
+ "r6g.large",
828
+ "r6g.xlarge",
829
+ "r6g.2xlarge",
830
+ "r6g.4xlarge",
831
+ "r6g.8xlarge",
832
+ "r6g.12xlarge",
833
+ "r6g.16xlarge",
834
+ "r6gd.xlarge",
835
+ "r6gd.2xlarge",
836
+ "r6gd.4xlarge",
837
+ "r6gd.8xlarge"
838
+ ]);
839
+ var PortSchema = z25.number().int().min(1).max(5e4);
840
+ var ShardsSchema = z25.number().int().min(0).max(100);
841
+ var ReplicasPerShardSchema = z25.number().int().min(0).max(5);
842
+ var EngineSchema = z25.enum(["7.0", "6.2"]);
843
+ var CachesSchema = z25.record(
844
+ ResourceIdSchema,
845
+ z25.object({
846
+ type: TypeSchema2.default("t4g.small"),
847
+ port: PortSchema.default(6379),
848
+ shards: ShardsSchema.default(1),
849
+ replicasPerShard: ReplicasPerShardSchema.default(1),
850
+ engine: EngineSchema.default("7.0"),
851
+ dataTiering: z25.boolean().default(false)
852
+ })
853
+ ).optional().describe("Define the caches in your stack. For access to the cache put your functions inside the global VPC.");
854
+
855
+ // src/feature/command/schema.ts
856
+ import { z as z26 } from "zod";
857
+ var CommandSchema2 = z26.union([
858
+ z26.object({
859
+ file: LocalFileSchema,
860
+ handler: z26.string().default("default").describe("The name of the handler that needs to run"),
861
+ description: z26.string().optional().describe("A description of the command")
862
+ // options: z.record(ResourceIdSchema, OptionSchema).optional(),
863
+ // arguments: z.record(ResourceIdSchema, ArgumentSchema).optional(),
864
+ }),
865
+ LocalFileSchema.transform((file) => ({
866
+ file,
867
+ handler: "default",
868
+ description: void 0
869
+ }))
870
+ ]);
871
+ var CommandsSchema = z26.record(ResourceIdSchema, CommandSchema2).optional().describe("Define the custom commands for your stack.");
872
+
873
+ // src/feature/config/schema.ts
874
+ import { z as z27 } from "zod";
875
+ var ConfigNameSchema = z27.string().regex(/[a-z0-9\-]/g, "Invalid config name");
876
+ var ConfigsSchema = z27.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
877
+
878
+ // src/feature/cron/schema/index.ts
879
+ import { z as z29 } from "zod";
880
+
881
+ // src/feature/cron/schema/schedule.ts
882
+ import { z as z28 } from "zod";
883
+ import { awsCronExpressionValidator } from "aws-cron-expression-validator";
884
+ var RateExpressionSchema = z28.custom(
885
+ (value) => {
886
+ return z28.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
887
+ const [str] = rate.split(" ");
888
+ const number = parseInt(str);
889
+ return number > 0;
890
+ }).safeParse(value).success;
891
+ },
892
+ { message: "Invalid rate expression" }
893
+ ).transform((rate) => {
894
+ const [str] = rate.split(" ");
895
+ const number = parseInt(str);
896
+ const more = rate.endsWith("s");
897
+ if (more && number === 1) {
898
+ return `rate(${rate.substring(0, rate.length - 1)})`;
899
+ }
900
+ return `rate(${rate})`;
901
+ });
902
+ var CronExpressionSchema = z28.custom(
903
+ (value) => {
904
+ return z28.string().safeParse(value).success;
905
+ },
906
+ { message: "Invalid cron expression" }
907
+ ).superRefine((value, ctx) => {
908
+ try {
909
+ awsCronExpressionValidator(value);
910
+ } catch (error) {
911
+ if (error instanceof Error) {
912
+ ctx.addIssue({
913
+ code: z28.ZodIssueCode.custom,
914
+ message: `Invalid cron expression: ${error.message}`
915
+ });
916
+ } else {
917
+ ctx.addIssue({
918
+ code: z28.ZodIssueCode.custom,
919
+ message: "Invalid cron expression"
920
+ });
921
+ }
922
+ }
923
+ }).transform((value) => {
924
+ return `cron(${value.trim()})`;
925
+ });
926
+ var ScheduleExpressionSchema = RateExpressionSchema.or(CronExpressionSchema);
927
+
928
+ // src/feature/cron/schema/index.ts
929
+ var CronsSchema = z29.record(
930
+ ResourceIdSchema,
931
+ z29.object({
932
+ enabled: z29.boolean().default(true).describe("If the cron is enabled."),
933
+ consumer: FunctionSchema.describe("The consuming lambda function properties."),
934
+ schedule: ScheduleExpressionSchema.describe(
935
+ 'The scheduling expression.\n\nexample: "0 20 * * ? *"\nexample: "5 minutes"'
936
+ ),
937
+ payload: z29.unknown().optional().describe("The JSON payload that will be passed to the consumer.")
938
+ })
939
+ ).optional().describe(`Define the cron jobs in your stack.`);
940
+
941
+ // src/feature/search/schema.ts
942
+ import { gibibytes as gibibytes2 } from "@awsless/size";
943
+ import { z as z30 } from "zod";
944
+ var VersionSchema = z30.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]);
945
+ var TypeSchema3 = z30.enum([
946
+ "t3.small",
947
+ "t3.medium",
948
+ "m3.medium",
949
+ "m3.large",
950
+ "m3.xlarge",
951
+ "m3.2xlarge",
952
+ "m4.large",
953
+ "m4.xlarge",
954
+ "m4.2xlarge",
955
+ "m4.4xlarge",
956
+ "m4.10xlarge",
957
+ "m5.large",
958
+ "m5.xlarge",
959
+ "m5.2xlarge",
960
+ "m5.4xlarge",
961
+ "m5.12xlarge",
962
+ "m5.24xlarge",
963
+ "r5.large",
964
+ "r5.xlarge",
965
+ "r5.2xlarge",
966
+ "r5.4xlarge",
967
+ "r5.12xlarge",
968
+ "r5.24xlarge",
969
+ "c5.large",
970
+ "c5.xlarge",
971
+ "c5.2xlarge",
972
+ "c5.4xlarge",
973
+ "c5.9xlarge",
974
+ "c5.18xlarge",
975
+ "or1.medium",
976
+ "or1.large",
977
+ "or1.xlarge",
978
+ "or1.2xlarge",
979
+ "or1.4xlarge",
980
+ "or1.8xlarge",
981
+ "or1.12xlarge",
982
+ "or1.16xlarge",
983
+ "ultrawarm1.medium",
984
+ "ultrawarm1.large",
985
+ "ultrawarm1.xlarge",
986
+ "r3.large",
987
+ "r3.xlarge",
988
+ "r3.2xlarge",
989
+ "r3.4xlarge",
990
+ "r3.8xlarge",
991
+ "i2.xlarge",
992
+ "i2.2xlarge",
993
+ "i3.large",
994
+ "i3.xlarge",
995
+ "i3.2xlarge",
996
+ "i3.4xlarge",
997
+ "i3.8xlarge",
998
+ "i3.16xlarge",
999
+ "r6g.large",
1000
+ "r6g.xlarge",
1001
+ "r6g.2xlarge",
1002
+ "r6g.4xlarge",
1003
+ "r6g.8xlarge",
1004
+ "r6g.12xlarge",
749
1005
  "m6g.large",
750
1006
  "m6g.xlarge",
751
1007
  "m6g.2xlarge",
@@ -761,11 +1017,11 @@ var TypeSchema3 = z21.enum([
761
1017
  "r6gd.16xlarge"
762
1018
  ]);
763
1019
  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.");
764
- var SearchsSchema = z21.record(
1020
+ var SearchsSchema = z30.record(
765
1021
  ResourceIdSchema,
766
- z21.object({
1022
+ z30.object({
767
1023
  type: TypeSchema3.default("t3.small"),
768
- count: z21.number().int().min(1).default(1),
1024
+ count: z30.number().int().min(1).default(1),
769
1025
  version: VersionSchema.default("2.13"),
770
1026
  storage: StorageSizeSchema.default("10 GB")
771
1027
  // vpc: z.boolean().default(false),
@@ -773,29 +1029,29 @@ var SearchsSchema = z21.record(
773
1029
  ).optional().describe("Define the search instances in your stack. Backed by OpenSearch.");
774
1030
 
775
1031
  // src/feature/site/schema.ts
776
- import { z as z22 } from "zod";
777
- var ErrorResponsePathSchema = z22.string().describe(
1032
+ import { z as z31 } from "zod";
1033
+ var ErrorResponsePathSchema = z31.string().describe(
778
1034
  "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."
779
1035
  );
780
- var StatusCodeSchema = z22.number().int().positive().optional().describe(
1036
+ var StatusCodeSchema = z31.number().int().positive().optional().describe(
781
1037
  "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."
782
1038
  );
783
1039
  var MinTTLSchema = DurationSchema.describe(
784
1040
  "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."
785
1041
  );
786
- var ErrorResponseSchema = z22.union([
1042
+ var ErrorResponseSchema = z31.union([
787
1043
  ErrorResponsePathSchema,
788
- z22.object({
1044
+ z31.object({
789
1045
  path: ErrorResponsePathSchema,
790
1046
  statusCode: StatusCodeSchema.optional(),
791
1047
  minTTL: MinTTLSchema.optional()
792
1048
  })
793
1049
  ]).optional();
794
- var SitesSchema = z22.record(
1050
+ var SitesSchema = z31.record(
795
1051
  ResourceIdSchema,
796
- z22.object({
1052
+ z31.object({
797
1053
  domain: ResourceIdSchema.describe("The domain id to link your site with.").optional(),
798
- subDomain: z22.string().optional(),
1054
+ subDomain: z31.string().optional(),
799
1055
  // bind: z
800
1056
  // .object({
801
1057
  // auth: z.array(ResourceIdSchema),
@@ -804,11 +1060,11 @@ var SitesSchema = z22.record(
804
1060
  // // rest: z.array(ResourceIdSchema),
805
1061
  // })
806
1062
  // .optional(),
807
- static: z22.union([LocalDirectorySchema, z22.boolean()]).optional().describe(
1063
+ static: z31.union([LocalDirectorySchema, z31.boolean()]).optional().describe(
808
1064
  "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."
809
1065
  ),
810
1066
  ssr: FunctionSchema.optional().describe("Specifies the ssr file."),
811
- origin: z22.enum(["ssr-first", "static-first"]).default("static-first").describe("Specifies the origin fallback ordering."),
1067
+ origin: z31.enum(["ssr-first", "static-first"]).default("static-first").describe("Specifies the origin fallback ordering."),
812
1068
  // bind: z.object({
813
1069
  // auth:
814
1070
  // h
@@ -821,7 +1077,7 @@ var SitesSchema = z22.record(
821
1077
  // build: z.string().optional(),
822
1078
  // }),
823
1079
  // ]),
824
- errors: z22.object({
1080
+ errors: z31.object({
825
1081
  400: ErrorResponseSchema.describe("Customize a `400 Bad Request` response."),
826
1082
  403: ErrorResponseSchema.describe("Customize a `403 Forbidden` response."),
827
1083
  404: ErrorResponseSchema.describe("Customize a `404 Not Found` response."),
@@ -834,16 +1090,16 @@ var SitesSchema = z22.record(
834
1090
  503: ErrorResponseSchema.describe("Customize a `503 Service Unavailable` response."),
835
1091
  504: ErrorResponseSchema.describe("Customize a `504 Gateway Timeout` response.")
836
1092
  }).optional().describe("Customize the error responses for specific HTTP status codes."),
837
- cors: z22.object({
838
- override: z22.boolean().default(false),
1093
+ cors: z31.object({
1094
+ override: z31.boolean().default(false),
839
1095
  maxAge: DurationSchema.default("365 days"),
840
- exposeHeaders: z22.string().array().optional(),
841
- credentials: z22.boolean().default(false),
842
- headers: z22.string().array().default(["*"]),
843
- origins: z22.string().array().default(["*"]),
844
- methods: z22.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
1096
+ exposeHeaders: z31.string().array().optional(),
1097
+ credentials: z31.boolean().default(false),
1098
+ headers: z31.string().array().default(["*"]),
1099
+ origins: z31.string().array().default(["*"]),
1100
+ methods: z31.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
845
1101
  }).optional().describe("Define the cors headers."),
846
- security: z22.object({
1102
+ security: z31.object({
847
1103
  // contentSecurityPolicy: z.object({
848
1104
  // override: z.boolean().default(false),
849
1105
  // policy: z.string(),
@@ -885,148 +1141,45 @@ var SitesSchema = z22.record(
885
1141
  // reportUri?: string
886
1142
  // }
887
1143
  }).optional().describe("Define the security policy."),
888
- cache: z22.object({
889
- cookies: z22.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
890
- headers: z22.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
891
- queries: z22.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
1144
+ cache: z31.object({
1145
+ cookies: z31.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
1146
+ headers: z31.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
1147
+ queries: z31.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
892
1148
  }).optional().describe(
893
1149
  "Specifies the cookies, headers, and query values that CloudFront includes in the cache key."
894
1150
  )
895
1151
  })
896
1152
  ).optional().describe("Define the sites in your stack.");
897
1153
 
898
- // src/feature/store/schema.ts
899
- import { z as z23 } from "zod";
900
- var DeletionProtectionSchema = z23.boolean().describe("Specifies if you want to protect the store from being deleted by awsless.");
901
- var StoreDefaultSchema = z23.object({
902
- deletionProtection: DeletionProtectionSchema.optional()
903
- }).optional();
904
- var StoresSchema = z23.union([
905
- z23.array(ResourceIdSchema).transform((list) => {
906
- const stores = {};
907
- for (const key of list) {
908
- stores[key] = {};
909
- }
910
- return stores;
911
- }),
912
- z23.record(
913
- ResourceIdSchema,
914
- z23.object({
915
- // cors: CorsSchema,
916
- deletionProtection: DeletionProtectionSchema.optional(),
917
- versioning: z23.boolean().default(false).describe("Enable versioning of your store."),
918
- events: z23.object({
919
- // create
920
- "created:*": FunctionSchema.optional().describe(
921
- "Subscribe to notifications regardless of the API that was used to create an object."
922
- ),
923
- "created:put": FunctionSchema.optional().describe(
924
- "Subscribe to notifications when an object is created using the PUT API operation."
925
- ),
926
- "created:post": FunctionSchema.optional().describe(
927
- "Subscribe to notifications when an object is created using the POST API operation."
928
- ),
929
- "created:copy": FunctionSchema.optional().describe(
930
- "Subscribe to notifications when an object is created using the COPY API operation."
931
- ),
932
- "created:upload": FunctionSchema.optional().describe(
933
- "Subscribe to notifications when an object multipart upload has been completed."
934
- ),
935
- // remove
936
- "removed:*": FunctionSchema.optional().describe(
937
- "Subscribe to notifications when an object is deleted or a delete marker for a versioned object is created."
938
- ),
939
- "removed:delete": FunctionSchema.optional().describe(
940
- "Subscribe to notifications when an object is deleted"
941
- ),
942
- "removed:marker": FunctionSchema.optional().describe(
943
- "Subscribe to notifications when a delete marker for a versioned object is created."
944
- )
945
- }).optional().describe("Describes the store events you want to subscribe too.")
946
- })
947
- )
948
- ]).optional().describe("Define the stores in your stack.");
949
-
950
1154
  // src/feature/stream/schema.ts
951
- import { z as z24 } from "zod";
952
- var LatencyModeSchema = z24.enum(["low", "normal"]).describe(
1155
+ import { z as z32 } from "zod";
1156
+ var LatencyModeSchema = z32.enum(["low", "normal"]).describe(
953
1157
  `Channel latency mode. Valid values:
954
1158
  - normal: Use "normal" to broadcast and deliver live video up to Full HD.
955
1159
  - low: Use "low" for near real-time interactions with viewers.`
956
1160
  );
957
- var TypeSchema4 = z24.enum(["standard", "basic", "advanced-sd", "advanced-hd"]).describe(`The channel type, which determines the allowable resolution and bitrate.
1161
+ var TypeSchema4 = z32.enum(["standard", "basic", "advanced-sd", "advanced-hd"]).describe(`The channel type, which determines the allowable resolution and bitrate.
958
1162
  If you exceed the allowable resolution or bitrate, the stream probably will disconnect immediately. Valid values:
959
1163
  - 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.
960
1164
  - 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.
961
1165
  - 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.
962
1166
  - 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.
963
1167
  `);
964
- var StreamsSchema = z24.record(
1168
+ var StreamsSchema = z32.record(
965
1169
  ResourceIdSchema,
966
- z24.object({
1170
+ z32.object({
967
1171
  type: TypeSchema4.default("standard"),
968
1172
  // preset: PresetSchema.optional(),
969
1173
  latencyMode: LatencyModeSchema.default("low")
970
1174
  })
971
1175
  ).optional().describe("Define the streams in your stack.");
972
1176
 
973
- // src/feature/table/schema.ts
974
- import { z as z25 } from "zod";
975
- var KeySchema = z25.string().min(1).max(255);
976
- var DeletionProtectionSchema2 = z25.boolean().describe("Specifies if you want to protect the table from being deleted by awsless.");
977
- var TableDefaultSchema = z25.object({
978
- deletionProtection: DeletionProtectionSchema2.optional()
979
- }).optional();
980
- var TablesSchema = z25.record(
981
- ResourceIdSchema,
982
- z25.object({
983
- hash: KeySchema.describe(
984
- "Specifies the name of the partition / hash key that makes up the primary key for the table."
985
- ),
986
- sort: KeySchema.optional().describe(
987
- "Specifies the name of the range / sort key that makes up the primary key for the table."
988
- ),
989
- fields: z25.record(z25.string(), z25.enum(["string", "number", "binary"])).optional().describe(
990
- 'A list of attributes that describe the key schema for the table and indexes. If no attribute field is defined we default to "string".'
991
- ),
992
- class: z25.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
993
- pointInTimeRecovery: z25.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
994
- timeToLiveAttribute: KeySchema.optional().describe(
995
- "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."
996
- ),
997
- deletionProtection: DeletionProtectionSchema2.optional(),
998
- stream: z25.object({
999
- type: z25.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
1000
- "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."
1001
- ),
1002
- consumer: FunctionSchema.describe("The consuming lambda function for the stream")
1003
- }).optional().describe(
1004
- "The settings for the DynamoDB table stream, which capture changes to items stored in the table."
1005
- ),
1006
- indexes: z25.record(
1007
- z25.string(),
1008
- z25.object({
1009
- /** Specifies the name of the partition / hash key that makes up the primary key for the global secondary index. */
1010
- hash: KeySchema,
1011
- /** Specifies the name of the range / sort key that makes up the primary key for the global secondary index. */
1012
- sort: KeySchema.optional(),
1013
- /** The set of attributes that are projected into the index:
1014
- * - all - All of the table attributes are projected into the index.
1015
- * - keys-only - Only the index and primary keys are projected into the index.
1016
- * @default 'all'
1017
- */
1018
- projection: z25.enum(["all", "keys-only"]).default("all")
1019
- })
1020
- ).optional().describe("Specifies the global secondary indexes to be created on the table.")
1021
- })
1022
- ).optional().describe("Define the tables in your stack.");
1023
-
1024
1177
  // src/feature/task/schema.ts
1025
- import { z as z26 } from "zod";
1026
- var RetryAttemptsSchema2 = z26.number().int().min(0).max(2).describe(
1178
+ import { z as z33 } from "zod";
1179
+ var RetryAttemptsSchema2 = z33.number().int().min(0).max(2).describe(
1027
1180
  "The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
1028
1181
  );
1029
- var TaskSchema = z26.union([
1182
+ var TaskSchema = z33.union([
1030
1183
  LocalFileSchema.transform((file) => ({
1031
1184
  consumer: {
1032
1185
  code: {
@@ -1037,33 +1190,33 @@ var TaskSchema = z26.union([
1037
1190
  },
1038
1191
  retryAttempts: void 0
1039
1192
  })),
1040
- z26.object({
1193
+ z33.object({
1041
1194
  consumer: FunctionSchema,
1042
1195
  retryAttempts: RetryAttemptsSchema2.optional()
1043
1196
  })
1044
1197
  ]);
1045
- var TasksSchema = z26.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
1198
+ var TasksSchema = z33.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
1046
1199
 
1047
1200
  // src/feature/test/schema.ts
1048
- import { z as z27 } from "zod";
1049
- var TestsSchema = z27.union([LocalDirectorySchema.transform((v) => [v]), LocalDirectorySchema.array()]).describe("Define the location of your tests for your stack.").optional();
1201
+ import { z as z34 } from "zod";
1202
+ var TestsSchema = z34.union([LocalDirectorySchema.transform((v) => [v]), LocalDirectorySchema.array()]).describe("Define the location of your tests for your stack.").optional();
1050
1203
 
1051
1204
  // src/feature/topic/schema.ts
1052
- import { paramCase as paramCase2 } from "change-case";
1053
- import { z as z28 } from "zod";
1054
- var TopicNameSchema = z28.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => paramCase2(value)).describe("Define event topic name.");
1055
- var TopicsSchema = z28.array(TopicNameSchema).refine((topics) => {
1205
+ import { paramCase as paramCase3 } from "change-case";
1206
+ import { z as z35 } from "zod";
1207
+ var TopicNameSchema = z35.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => paramCase3(value)).describe("Define event topic name.");
1208
+ var TopicsSchema = z35.array(TopicNameSchema).refine((topics) => {
1056
1209
  return topics.length === new Set(topics).size;
1057
1210
  }, "Must be a list of unique topic names").optional().describe("Define the event topics to publish too in your stack.");
1058
- var SubscribersSchema = z28.record(TopicNameSchema, FunctionSchema).optional().describe("Define the event topics to subscribe too in your stack.");
1211
+ var SubscribersSchema = z35.record(TopicNameSchema, FunctionSchema).optional().describe("Define the event topics to subscribe too in your stack.");
1059
1212
 
1060
1213
  // src/config/stack.ts
1061
1214
  var DependsSchema = ResourceIdSchema.array().optional().describe("Define the stacks that this stack is depended on.");
1062
1215
  var NameSchema = ResourceIdSchema.refine((name) => !["base"].includes(name), {
1063
1216
  message: `Stack name can't be a reserved name.`
1064
1217
  }).describe("Stack name.");
1065
- var StackSchema = z29.object({
1066
- $schema: z29.string().optional(),
1218
+ var StackSchema = z36.object({
1219
+ $schema: z36.string().optional(),
1067
1220
  name: NameSchema,
1068
1221
  depends: DependsSchema,
1069
1222
  commands: CommandsSchema,
@@ -1091,164 +1244,14 @@ var StackSchema = z29.object({
1091
1244
  tests: TestsSchema
1092
1245
  });
1093
1246
 
1094
- // src/config/app.ts
1095
- import { z as z36 } from "zod";
1096
-
1097
- // src/feature/alert/schema.ts
1098
- import { paramCase as paramCase3 } from "change-case";
1099
- import { z as z30 } from "zod";
1100
- var AlertNameSchema = z30.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid alert name").transform((value) => paramCase3(value)).describe("Define event topic name.");
1101
- var AlertsDefaultSchema = z30.record(
1102
- AlertNameSchema,
1103
- z30.union([
1104
- //
1105
- EmailSchema.transform((v) => [v]),
1106
- EmailSchema.array()
1107
- ])
1108
- ).optional().describe("Define the alerts in your app. Alerts are a way to send messages to one or more email addresses.");
1109
-
1110
- // src/feature/domain/schema.ts
1111
- import { z as z31 } from "zod";
1112
- var DomainNameSchema = z31.string().regex(/[a-z\-\_\.]/g, "Invalid domain name").describe(
1113
- "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."
1114
- );
1115
- var DNSTypeSchema = z31.enum(["A", "AAAA", "CAA", "CNAME", "DS", "MX", "NAPTR", "NS", "PTR", "SOA", "SPF", "SRV", "TXT"]).describe("The DNS record type.");
1116
- var TTLSchema = DurationSchema.describe("The resource record cache time to live (TTL).");
1117
- var RecordsSchema = z31.string().array().describe("One or more values that correspond with the value that you specified for the Type property.");
1118
- var DomainsDefaultSchema = z31.record(
1119
- ResourceIdSchema,
1120
- z31.object({
1121
- domain: DomainNameSchema.describe("Define the domain name"),
1122
- dns: z31.object({
1123
- name: DomainNameSchema.optional(),
1124
- type: DNSTypeSchema,
1125
- ttl: TTLSchema,
1126
- records: RecordsSchema
1127
- }).array().optional().describe("Define the domain dns records")
1128
- })
1129
- ).optional().describe("Define the domains for your application.");
1130
-
1131
- // src/feature/layer/schema.ts
1132
- import { z as z33 } from "zod";
1133
-
1134
- // src/config/schema/lambda.ts
1135
- import { z as z32 } from "zod";
1136
- var ArchitectureSchema2 = z32.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the function supports.");
1137
- var NodeRuntimeSchema2 = z32.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x"]).describe("The identifier of the function's runtime.");
1138
-
1139
- // src/feature/layer/schema.ts
1140
- var Schema = z33.object({
1141
- file: LocalFileSchema,
1142
- runtimes: NodeRuntimeSchema2.array().optional(),
1143
- architecture: ArchitectureSchema2.optional(),
1144
- packages: z33.string().array().optional().describe(
1145
- "Define the package names that are available bundled in the layer. Those packages are not bundled while bundling the lambda."
1146
- )
1147
- });
1148
- var LayerSchema = z33.record(
1149
- z33.string(),
1150
- z33.union([
1151
- LocalFileSchema.transform((file) => ({
1152
- file,
1153
- description: void 0
1154
- })),
1155
- Schema
1156
- ])
1157
- ).optional().describe("Define the lambda layers in your stack.");
1158
-
1159
- // src/feature/on-failure/schema.ts
1160
- var OnFailureDefaultSchema = FunctionSchema.optional().describe(
1161
- "Defining a onFailure handler will add a global onFailure handler for the following resources:\n- Async lambda functions\n- SQS queues\n- DynamoDB streams"
1162
- );
1163
-
1164
- // src/feature/on-log/schema.ts
1165
- import { z as z34 } from "zod";
1166
- var FilterSchema = z34.enum(["trace", "debug", "info", "warn", "error", "fatal"]).array().describe("The log level that will gets delivered to the consumer.");
1167
- var OnLogDefaultSchema = z34.union([
1168
- FunctionSchema.transform((consumer) => ({
1169
- consumer,
1170
- filter: ["error", "fatal"]
1171
- })),
1172
- z34.object({
1173
- consumer: FunctionSchema,
1174
- filter: FilterSchema
1175
- })
1176
- ]).optional().describe("Define a subscription on all Lambda functions logs.");
1177
-
1178
- // src/config/schema/region.ts
1179
- import { z as z35 } from "zod";
1180
- var US = ["us-east-2", "us-east-1", "us-west-1", "us-west-2"];
1181
- var AF = ["af-south-1"];
1182
- var AP = [
1183
- "ap-east-1",
1184
- "ap-south-2",
1185
- "ap-southeast-3",
1186
- "ap-southeast-4",
1187
- "ap-south-1",
1188
- "ap-northeast-3",
1189
- "ap-northeast-2",
1190
- "ap-southeast-1",
1191
- "ap-southeast-2",
1192
- "ap-northeast-1"
1193
- ];
1194
- var CA = ["ca-central-1"];
1195
- var EU = [
1196
- "eu-central-1",
1197
- "eu-west-1",
1198
- "eu-west-2",
1199
- "eu-south-1",
1200
- "eu-west-3",
1201
- "eu-south-2",
1202
- "eu-north-1",
1203
- "eu-central-2"
1204
- ];
1205
- var ME = ["me-south-1", "me-central-1"];
1206
- var SA = ["sa-east-1"];
1207
- var regions = [...US, ...AF, ...AP, ...CA, ...EU, ...ME, ...SA];
1208
- var RegionSchema = z35.enum(regions);
1209
-
1210
- // src/config/app.ts
1211
- var AppSchema = z36.object({
1212
- $schema: z36.string().optional(),
1213
- name: ResourceIdSchema.describe("App name."),
1214
- region: RegionSchema.describe("The AWS region to deploy to."),
1215
- profile: z36.string().describe("The AWS profile to deploy to."),
1216
- // stage: z
1217
- // .string()
1218
- // .regex(/^[a-z]+$/)
1219
- // .default('prod')
1220
- // .describe('The deployment stage.'),
1221
- // onFailure: OnFailureSchema,
1222
- defaults: z36.object({
1223
- onFailure: OnFailureDefaultSchema,
1224
- onLog: OnLogDefaultSchema,
1225
- auth: AuthDefaultSchema,
1226
- domains: DomainsDefaultSchema,
1227
- function: FunctionDefaultSchema,
1228
- instance: InstanceDefaultSchema,
1229
- queue: QueueDefaultSchema,
1230
- graphql: GraphQLDefaultSchema,
1231
- http: HttpDefaultSchema,
1232
- rest: RestDefaultSchema,
1233
- rpc: RpcDefaultSchema,
1234
- pubsub: PubSubDefaultSchema,
1235
- table: TableDefaultSchema,
1236
- store: StoreDefaultSchema,
1237
- alerts: AlertsDefaultSchema,
1238
- layers: LayerSchema
1239
- // dataRetention: z.boolean().describe('Configure how your resources are handled on delete.').default(false),
1240
- }).default({}).describe("Default properties")
1241
- });
1242
-
1243
1247
  // cli/build-json-schema.ts
1244
- import { writeFileSync } from "node:fs";
1245
- import { join as join2 } from "node:path";
1246
1248
  var generateJsonSchema = (props) => {
1247
1249
  const file = join2(process.cwd(), `dist/${props.name}.json`);
1248
1250
  const schema = zodToJsonSchema(props.schema, {
1249
1251
  name: props.name,
1250
1252
  // errorMessages: true,
1251
1253
  markdownDescription: true,
1254
+ pipeStrategy: "input",
1252
1255
  $refStrategy: "none"
1253
1256
  });
1254
1257
  appendDefaults(schema);