@awsless/awsless 0.0.267 → 0.0.270

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.
@@ -2,7 +2,10 @@
2
2
  import { zodToJsonSchema } from "zod-to-json-schema";
3
3
 
4
4
  // src/config/stack.ts
5
- import { z as z26 } from "zod";
5
+ import { z as z28 } from "zod";
6
+
7
+ // src/feature/auth/schema.ts
8
+ import { z as z7 } from "zod";
6
9
 
7
10
  // src/config/schema/resource-id.ts
8
11
  import { paramCase } from "change-case";
@@ -202,306 +205,121 @@ var FunctionDefaultSchema = z5.object({
202
205
  permissions: PermissionsSchema.optional()
203
206
  }).default({});
204
207
 
205
- // src/feature/on-failure/schema.ts
206
- var OnFailureSchema = FunctionSchema.optional().describe(
207
- "Defining a onFailure handler will add a global onFailure handler for the following resources:\n- Async lambda functions\n- SQS queues\n- DynamoDB streams"
208
- );
209
-
210
- // src/feature/config/schema.ts
208
+ // src/config/schema/email.ts
211
209
  import { z as z6 } from "zod";
212
- var ConfigNameSchema = z6.string().regex(/[a-z0-9\-]/g, "Invalid config name");
213
- var ConfigsSchema = z6.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
210
+ var EmailSchema = z6.string().email();
214
211
 
215
- // src/feature/graphql/schema.ts
216
- import { z as z7 } from "zod";
217
- var AuthorizerTtl = DurationSchema.describe(
218
- `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.`
219
- );
220
- var GraphQLDefaultSchema = z7.record(
212
+ // src/feature/auth/schema.ts
213
+ var TriggersSchema = z7.object({
214
+ beforeToken: FunctionSchema.optional().describe("A pre jwt token generation AWS Lambda trigger."),
215
+ beforeLogin: FunctionSchema.optional().describe("A pre user login AWS Lambda trigger."),
216
+ afterLogin: FunctionSchema.optional().describe("A post user login AWS Lambda trigger."),
217
+ beforeRegister: FunctionSchema.optional().describe("A pre user register AWS Lambda trigger."),
218
+ afterRegister: FunctionSchema.optional().describe("A post user register AWS Lambda trigger."),
219
+ customMessage: FunctionSchema.optional().describe("A custom message AWS Lambda trigger."),
220
+ // /** A custom email sender AWS Lambda trigger */
221
+ // emailSender: FunctionSchema.optional(),
222
+ defineChallenge: FunctionSchema.optional().describe("Defines the authentication challenge."),
223
+ createChallenge: FunctionSchema.optional().describe("Creates an authentication challenge."),
224
+ verifyChallenge: FunctionSchema.optional().describe("Verifies the authentication challenge response.")
225
+ }).describe("Specifies the configuration for AWS Lambda triggers.");
226
+ var AuthSchema = z7.record(
221
227
  ResourceIdSchema,
222
228
  z7.object({
223
- domain: ResourceIdSchema.describe("The domain id to link your API with.").optional(),
224
- subDomain: z7.string().optional(),
225
- auth: z7.union([
226
- ResourceIdSchema,
227
- z7.object({
228
- authorizer: FunctionSchema,
229
- ttl: AuthorizerTtl.default("1 hour")
230
- })
231
- ]).optional(),
232
- // authorization: z.object({
233
- // authorizer: FunctionSchema,
234
- // ttl: DurationSchema.default('1 hour'),
235
- // }).optional(),
236
- resolver: LocalFileSchema.optional()
229
+ access: z7.boolean().default(false).describe("Give access to every function in this stack to your cognito instance."),
230
+ triggers: TriggersSchema.optional()
237
231
  })
238
- ).describe(`Define the global GraphQL API's.`).optional();
239
- var GraphQLSchema = z7.record(
232
+ ).optional().describe("Define the auth triggers in your stack.");
233
+ var AuthDefaultSchema = z7.record(
240
234
  ResourceIdSchema,
241
235
  z7.object({
242
- // schema: z.union([LocalFileSchema.transform(v => [v]), z.array(LocalFileSchema).min(1)]).optional(),
243
- schema: LocalFileSchema.describe("The graphql schema file."),
244
- resolvers: z7.record(
245
- // TypeName
246
- z7.string(),
247
- z7.record(
248
- // FieldName
249
- z7.string(),
250
- z7.union([
251
- FunctionSchema.transform((consumer) => ({
252
- consumer
253
- })),
254
- z7.object({
255
- consumer: FunctionSchema,
256
- resolver: LocalFileSchema.optional()
257
- })
258
- ])
236
+ allowUserRegistration: z7.boolean().default(true).describe("Specifies whether users can create an user account or if only the administrator can."),
237
+ messaging: z7.object({
238
+ fromEmail: EmailSchema.describe("Specifies the sender's email address."),
239
+ fromName: z7.string().optional().describe("Specifies the sender's name."),
240
+ replyTo: EmailSchema.optional().describe(
241
+ "The destination to which the receiver of the email should reply."
259
242
  )
260
- ).describe("The resolvers for your global GraphQL API.").optional()
243
+ }).optional().describe("The email configuration for sending messages."),
244
+ // secret: z.boolean().default(false).describe('Specifies whether you want to generate a client secret.'),
245
+ username: z7.object({
246
+ emailAlias: z7.boolean().default(true).describe("Allow the user email to be used as username."),
247
+ caseSensitive: z7.boolean().default(false).describe(
248
+ "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."
249
+ )
250
+ }).default({}).describe("The username policy."),
251
+ password: z7.object({
252
+ minLength: z7.number().int().min(6).max(99).default(12).describe("Required users to have at least the minimum password length."),
253
+ uppercase: z7.boolean().default(true).describe("Required users to use at least one uppercase letter in their password."),
254
+ lowercase: z7.boolean().default(true).describe("Required users to use at least one lowercase letter in their password."),
255
+ numbers: z7.boolean().default(true).describe("Required users to use at least one number in their password."),
256
+ symbols: z7.boolean().default(true).describe("Required users to use at least one symbol in their password."),
257
+ temporaryPasswordValidity: DurationSchema.default("7 days").describe(
258
+ "The duration a temporary password is valid. If the user doesn't sign in during this time, an administrator must reset their password."
259
+ )
260
+ }).default({}).describe("The password policy."),
261
+ validity: z7.object({
262
+ idToken: DurationSchema.default("1 hour").describe(
263
+ "The ID token time limit. After this limit expires, your user can't use their ID token."
264
+ ),
265
+ accessToken: DurationSchema.default("1 hour").describe(
266
+ "The access token time limit. After this limit expires, your user can't use their access token."
267
+ ),
268
+ refreshToken: DurationSchema.default("365 days").describe(
269
+ "The refresh token time limit. After this limit expires, your user can't use their refresh token."
270
+ )
271
+ }).default({}).describe("Specifies the validity duration for every JWT token."),
272
+ triggers: TriggersSchema.optional()
261
273
  })
262
- ).describe("Define the schema & resolvers in your stack for your global GraphQL API.").optional();
274
+ ).default({}).describe("Define the authenticatable users in your app.");
263
275
 
264
- // src/feature/table/schema.ts
276
+ // src/feature/cache/schema.ts
265
277
  import { z as z8 } from "zod";
266
- var KeySchema = z8.string().min(1).max(255);
267
- var TablesSchema = z8.record(
278
+ var TypeSchema = z8.enum([
279
+ "t4g.small",
280
+ "t4g.medium",
281
+ "r6g.large",
282
+ "r6g.xlarge",
283
+ "r6g.2xlarge",
284
+ "r6g.4xlarge",
285
+ "r6g.8xlarge",
286
+ "r6g.12xlarge",
287
+ "r6g.16xlarge",
288
+ "r6gd.xlarge",
289
+ "r6gd.2xlarge",
290
+ "r6gd.4xlarge",
291
+ "r6gd.8xlarge"
292
+ ]);
293
+ var PortSchema = z8.number().int().min(1).max(5e4);
294
+ var ShardsSchema = z8.number().int().min(0).max(100);
295
+ var ReplicasPerShardSchema = z8.number().int().min(0).max(5);
296
+ var EngineSchema = z8.enum(["7.0", "6.2"]);
297
+ var CachesSchema = z8.record(
268
298
  ResourceIdSchema,
269
299
  z8.object({
270
- hash: KeySchema.describe(
271
- "Specifies the name of the partition / hash key that makes up the primary key for the table."
272
- ),
273
- sort: KeySchema.optional().describe(
274
- "Specifies the name of the range / sort key that makes up the primary key for the table."
275
- ),
276
- fields: z8.record(z8.string(), z8.enum(["string", "number", "binary"])).optional().describe(
277
- 'A list of attributes that describe the key schema for the table and indexes. If no attribute field is defined we default to "string".'
278
- ),
279
- class: z8.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
280
- pointInTimeRecovery: z8.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
281
- timeToLiveAttribute: KeySchema.optional().describe(
282
- "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."
283
- ),
284
- stream: z8.object({
285
- type: z8.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
286
- "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."
287
- ),
288
- consumer: FunctionSchema.describe("The consuming lambda function for the stream")
289
- }).optional().describe(
290
- "The settings for the DynamoDB table stream, which capture changes to items stored in the table."
291
- ),
292
- indexes: z8.record(
293
- z8.string(),
294
- z8.object({
295
- /** Specifies the name of the partition / hash key that makes up the primary key for the global secondary index. */
296
- hash: KeySchema,
297
- /** Specifies the name of the range / sort key that makes up the primary key for the global secondary index. */
298
- sort: KeySchema.optional(),
299
- /** The set of attributes that are projected into the index:
300
- * - all - All of the table attributes are projected into the index.
301
- * - keys-only - Only the index and primary keys are projected into the index.
302
- * @default 'all'
303
- */
304
- projection: z8.enum(["all", "keys-only"]).default("all")
305
- })
306
- ).optional().describe("Specifies the global secondary indexes to be created on the table.")
300
+ type: TypeSchema.default("t4g.small"),
301
+ port: PortSchema.default(6379),
302
+ shards: ShardsSchema.default(1),
303
+ replicasPerShard: ReplicasPerShardSchema.default(1),
304
+ engine: EngineSchema.default("7.0"),
305
+ dataTiering: z8.boolean().default(false)
307
306
  })
308
- ).optional().describe("Define the tables in your stack.");
307
+ ).optional().describe("Define the caches in your stack. For access to the cache put your functions inside the global VPC.");
309
308
 
310
- // src/feature/store/schema.ts
309
+ // src/feature/config/schema.ts
311
310
  import { z as z9 } from "zod";
312
- var StoresSchema = z9.union([
313
- z9.array(ResourceIdSchema).transform((list) => {
314
- const stores = {};
315
- for (const key of list) {
316
- stores[key] = {};
317
- }
318
- return stores;
319
- }),
320
- z9.record(
321
- ResourceIdSchema,
322
- z9.object({
323
- // cors: CorsSchema,
324
- versioning: z9.boolean().default(false).describe("Enable versioning of your store."),
325
- events: z9.object({
326
- // create
327
- "created:*": FunctionSchema.optional().describe(
328
- "Subscribe to notifications regardless of the API that was used to create an object."
329
- ),
330
- "created:put": FunctionSchema.optional().describe(
331
- "Subscribe to notifications when an object is created using the PUT API operation."
332
- ),
333
- "created:post": FunctionSchema.optional().describe(
334
- "Subscribe to notifications when an object is created using the POST API operation."
335
- ),
336
- "created:copy": FunctionSchema.optional().describe(
337
- "Subscribe to notifications when an object is created using the COPY API operation."
338
- ),
339
- "created:upload": FunctionSchema.optional().describe(
340
- "Subscribe to notifications when an object multipart upload has been completed."
341
- ),
342
- // remove
343
- "removed:*": FunctionSchema.optional().describe(
344
- "Subscribe to notifications when an object is deleted or a delete marker for a versioned object is created."
345
- ),
346
- "removed:delete": FunctionSchema.optional().describe(
347
- "Subscribe to notifications when an object is deleted"
348
- ),
349
- "removed:marker": FunctionSchema.optional().describe(
350
- "Subscribe to notifications when a delete marker for a versioned object is created."
351
- )
352
- }).optional().describe("Describes the store events you want to subscribe too.")
353
- })
354
- )
355
- ]).optional().describe("Define the stores in your stack.");
356
-
357
- // src/feature/queue/schema.ts
358
- import { z as z10 } from "zod";
359
- import { days as days2, hours, minutes as minutes2, seconds as seconds2 } from "@awsless/duration";
360
- import { kibibytes } from "@awsless/size";
361
- var RetentionPeriodSchema = DurationSchema.refine(
362
- durationMin(minutes2(1)),
363
- "Minimum retention period is 1 minute"
364
- ).refine(durationMax(days2(14)), "Maximum retention period is 14 days").describe(
365
- "The number of seconds that Amazon SQS retains a message. You can specify a duration from 1 minute to 14 days."
366
- );
367
- var VisibilityTimeoutSchema = DurationSchema.refine(
368
- durationMax(hours(12)),
369
- "Maximum visibility timeout is 12 hours"
370
- ).describe(
371
- "The length of time during which a message will be unavailable after a message is delivered from the queue. This blocks other components from receiving the same message and gives the initial component time to process and delete the message from the queue. You can specify a duration from 0 to 12 hours."
372
- );
373
- var DeliveryDelaySchema = DurationSchema.refine(
374
- durationMax(minutes2(15)),
375
- "Maximum delivery delay is 15 minutes"
376
- ).describe(
377
- "The time in seconds for which the delivery of all messages in the queue is delayed. You can specify a duration from 0 to 15 minutes."
378
- );
379
- var ReceiveMessageWaitTimeSchema = DurationSchema.refine(
380
- durationMin(seconds2(1)),
381
- "Minimum receive message wait time is 1 second"
382
- ).refine(durationMax(seconds2(20)), "Maximum receive message wait time is 20 seconds").describe(
383
- "Specifies the duration, that the ReceiveMessage action call waits until a message is in the queue in order to include it in the response, rather than returning an empty response if a message isn't yet available. You can specify a duration from 1 to 20 seconds. Short polling is used as the default."
384
- );
385
- 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(
386
- "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."
387
- );
388
- var BatchSizeSchema = z10.number().int().min(1, "Minimum batch size is 1").max(1e4, "Maximum batch size is 10000").describe(
389
- "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."
390
- );
391
- var MaxConcurrencySchema = z10.number().int().min(2, "Minimum max concurrency is 2").max(1e3, "Maximum max concurrency is 1000").describe(
392
- "Limits the number of concurrent instances that the queue worker can invoke. You can specify an integer from 2 to 1000."
393
- );
394
- var MaxBatchingWindow = DurationSchema.refine(
395
- durationMax(minutes2(5)),
396
- "Maximum max batching window is 5 minutes"
397
- ).describe(
398
- "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."
399
- );
400
- var QueueDefaultSchema = z10.object({
401
- retentionPeriod: RetentionPeriodSchema.default("7 days"),
402
- visibilityTimeout: VisibilityTimeoutSchema.default("30 seconds"),
403
- deliveryDelay: DeliveryDelaySchema.default("0 seconds"),
404
- receiveMessageWaitTime: ReceiveMessageWaitTimeSchema.optional(),
405
- maxMessageSize: MaxMessageSizeSchema.default("256 KB"),
406
- batchSize: BatchSizeSchema.default(10),
407
- maxConcurrency: MaxConcurrencySchema.optional(),
408
- maxBatchingWindow: MaxBatchingWindow.optional()
409
- }).default({});
410
- var QueuesSchema = z10.record(
411
- ResourceIdSchema,
412
- z10.union([
413
- LocalFileSchema.transform((file) => ({
414
- consumer: {
415
- file
416
- }
417
- })),
418
- z10.object({
419
- consumer: FunctionSchema.describe("he consuming lambda function properties."),
420
- retentionPeriod: RetentionPeriodSchema.optional(),
421
- visibilityTimeout: VisibilityTimeoutSchema.optional(),
422
- deliveryDelay: DeliveryDelaySchema.optional(),
423
- receiveMessageWaitTime: ReceiveMessageWaitTimeSchema.optional(),
424
- maxMessageSize: MaxMessageSizeSchema.optional(),
425
- batchSize: BatchSizeSchema.optional(),
426
- maxConcurrency: MaxConcurrencySchema.optional(),
427
- maxBatchingWindow: MaxBatchingWindow.optional()
428
- })
429
- ])
430
- ).optional().describe("Define the queues in your stack.");
431
-
432
- // src/feature/pubsub/schema.ts
433
- import { z as z11 } from "zod";
434
- var PubSubSchema = z11.record(
435
- ResourceIdSchema,
436
- z11.object({
437
- sql: z11.string().describe("The SQL statement used to query the IOT topic."),
438
- sqlVersion: z11.enum(["2015-10-08", "2016-03-23", "beta"]).default("2016-03-23").describe("The version of the SQL rules engine to use when evaluating the rule."),
439
- consumer: FunctionSchema.describe("The consuming lambda function properties.")
440
- })
441
- ).optional().describe("Define the pubsub subscriber in your stack.");
442
-
443
- // src/feature/rest/schema.ts
444
- import { z as z13 } from "zod";
445
-
446
- // src/config/schema/route.ts
447
- import { z as z12 } from "zod";
448
- var RouteSchema = z12.union([
449
- z12.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route"),
450
- z12.literal("$default")
451
- ]);
452
-
453
- // src/feature/rest/schema.ts
454
- var RestDefaultSchema = z13.record(
455
- ResourceIdSchema,
456
- z13.object({
457
- domain: ResourceIdSchema.describe("The domain id to link your API with.").optional(),
458
- subDomain: z13.string().optional()
459
- })
460
- ).optional().describe("Define your global REST API's.");
461
- var RestSchema = z13.record(ResourceIdSchema, z13.record(RouteSchema, FunctionSchema)).optional().describe("Define routes in your stack for your global REST API.");
462
-
463
- // src/feature/test/schema.ts
464
- import { z as z15 } from "zod";
465
-
466
- // src/config/schema/local-directory.ts
467
- import { stat as stat2 } from "fs/promises";
468
- import { z as z14 } from "zod";
469
- var LocalDirectorySchema = z14.string().transform((path) => resolvePath(path)).refine(async (path) => {
470
- try {
471
- const s = await stat2(path);
472
- return s.isDirectory();
473
- } catch (error) {
474
- return false;
475
- }
476
- }, `Directory doesn't exist`);
477
-
478
- // src/feature/test/schema.ts
479
- var TestsSchema = z15.union([LocalDirectorySchema.transform((v) => [v]), LocalDirectorySchema.array()]).describe("Define the location of your tests for your stack.").optional();
480
-
481
- // src/feature/topic/schema.ts
482
- import { paramCase as paramCase2 } from "change-case";
483
- import { z as z17 } from "zod";
484
-
485
- // src/config/schema/email.ts
486
- import { z as z16 } from "zod";
487
- var EmailSchema = z16.string().email();
488
-
489
- // src/feature/topic/schema.ts
490
- var TopicNameSchema = z17.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => paramCase2(value)).describe("Define event topic name.");
491
- var TopicsSchema = z17.array(TopicNameSchema).refine((topics) => {
492
- return topics.length === new Set(topics).size;
493
- }, "Must be a list of unique topic names").optional().describe("Define the event topics to publish too in your stack.");
494
- var SubscribersSchema = z17.record(TopicNameSchema, z17.union([EmailSchema, FunctionSchema])).optional().describe("Define the event topics to subscribe too in your stack.");
311
+ var ConfigNameSchema = z9.string().regex(/[a-z0-9\-]/g, "Invalid config name");
312
+ var ConfigsSchema = z9.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
495
313
 
496
314
  // src/feature/cron/schema/index.ts
497
- import { z as z19 } from "zod";
315
+ import { z as z11 } from "zod";
498
316
 
499
317
  // src/feature/cron/schema/schedule.ts
500
- import { z as z18 } from "zod";
318
+ import { z as z10 } from "zod";
501
319
  import { awsCronExpressionValidator } from "aws-cron-expression-validator";
502
- var RateExpressionSchema = z18.custom(
320
+ var RateExpressionSchema = z10.custom(
503
321
  (value) => {
504
- return z18.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
322
+ return z10.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
505
323
  const [str] = rate.split(" ");
506
324
  const number = parseInt(str);
507
325
  return number > 0;
@@ -517,9 +335,9 @@ var RateExpressionSchema = z18.custom(
517
335
  }
518
336
  return `rate(${rate})`;
519
337
  });
520
- var CronExpressionSchema = z18.custom(
338
+ var CronExpressionSchema = z10.custom(
521
339
  (value) => {
522
- return z18.string().safeParse(value).success;
340
+ return z10.string().safeParse(value).success;
523
341
  },
524
342
  { message: "Invalid cron expression" }
525
343
  ).superRefine((value, ctx) => {
@@ -528,12 +346,12 @@ var CronExpressionSchema = z18.custom(
528
346
  } catch (error) {
529
347
  if (error instanceof Error) {
530
348
  ctx.addIssue({
531
- code: z18.ZodIssueCode.custom,
349
+ code: z10.ZodIssueCode.custom,
532
350
  message: `Invalid cron expression: ${error.message}`
533
351
  });
534
352
  } else {
535
353
  ctx.addIssue({
536
- code: z18.ZodIssueCode.custom,
354
+ code: z10.ZodIssueCode.custom,
537
355
  message: "Invalid cron expression"
538
356
  });
539
357
  }
@@ -544,134 +362,248 @@ var CronExpressionSchema = z18.custom(
544
362
  var ScheduleExpressionSchema = RateExpressionSchema.or(CronExpressionSchema);
545
363
 
546
364
  // src/feature/cron/schema/index.ts
547
- var CronsSchema = z19.record(
365
+ var CronsSchema = z11.record(
548
366
  ResourceIdSchema,
549
- z19.object({
550
- enabled: z19.boolean().default(true).describe("If the cron is enabled."),
367
+ z11.object({
368
+ enabled: z11.boolean().default(true).describe("If the cron is enabled."),
551
369
  consumer: FunctionSchema.describe("The consuming lambda function properties."),
552
370
  schedule: ScheduleExpressionSchema.describe(
553
371
  'The scheduling expression.\n\nexample: "0 20 * * ? *"\nexample: "5 minutes"'
554
372
  ),
555
- payload: z19.unknown().optional().describe("The JSON payload that will be passed to the consumer.")
373
+ payload: z11.unknown().optional().describe("The JSON payload that will be passed to the consumer.")
556
374
  })
557
375
  ).optional();
558
376
 
559
- // src/feature/cache/schema.ts
560
- import { z as z20 } from "zod";
561
- var TypeSchema = z20.enum([
562
- "t4g.small",
563
- "t4g.medium",
564
- "r6g.large",
565
- "r6g.xlarge",
566
- "r6g.2xlarge",
567
- "r6g.4xlarge",
568
- "r6g.8xlarge",
569
- "r6g.12xlarge",
570
- "r6g.16xlarge",
571
- "r6gd.xlarge",
572
- "r6gd.2xlarge",
573
- "r6gd.4xlarge",
574
- "r6gd.8xlarge"
575
- ]);
576
- var PortSchema = z20.number().int().min(1).max(5e4);
577
- var ShardsSchema = z20.number().int().min(0).max(100);
578
- var ReplicasPerShardSchema = z20.number().int().min(0).max(5);
579
- var EngineSchema = z20.enum(["7.0", "6.2"]);
580
- var CachesSchema = z20.record(
581
- ResourceIdSchema,
582
- z20.object({
583
- type: TypeSchema.default("t4g.small"),
584
- port: PortSchema.default(6379),
585
- shards: ShardsSchema.default(1),
586
- replicasPerShard: ReplicasPerShardSchema.default(1),
587
- engine: EngineSchema.default("7.0"),
588
- dataTiering: z20.boolean().default(false)
589
- })
590
- ).optional().describe("Define the caches in your stack. For access to the cache put your functions inside the global VPC.");
591
-
592
- // src/feature/auth/schema.ts
593
- import { z as z21 } from "zod";
594
- var TriggersSchema = z21.object({
595
- beforeToken: FunctionSchema.optional().describe("A pre jwt token generation AWS Lambda trigger."),
596
- beforeLogin: FunctionSchema.optional().describe("A pre user login AWS Lambda trigger."),
597
- afterLogin: FunctionSchema.optional().describe("A post user login AWS Lambda trigger."),
598
- beforeRegister: FunctionSchema.optional().describe("A pre user register AWS Lambda trigger."),
599
- afterRegister: FunctionSchema.optional().describe("A post user register AWS Lambda trigger."),
600
- customMessage: FunctionSchema.optional().describe("A custom message AWS Lambda trigger."),
601
- // /** A custom email sender AWS Lambda trigger */
602
- // emailSender: FunctionSchema.optional(),
603
- defineChallenge: FunctionSchema.optional().describe("Defines the authentication challenge."),
604
- createChallenge: FunctionSchema.optional().describe("Creates an authentication challenge."),
605
- verifyChallenge: FunctionSchema.optional().describe("Verifies the authentication challenge response.")
606
- }).describe("Specifies the configuration for AWS Lambda triggers.");
607
- var AuthSchema = z21.record(
377
+ // src/feature/graphql/schema.ts
378
+ import { z as z12 } from "zod";
379
+ var AuthorizerTtl = DurationSchema.describe(
380
+ `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.`
381
+ );
382
+ var GraphQLDefaultSchema = z12.record(
608
383
  ResourceIdSchema,
609
- z21.object({
610
- access: z21.boolean().default(false).describe("Give access to every function in this stack to your cognito instance."),
611
- triggers: TriggersSchema.optional()
384
+ z12.object({
385
+ domain: ResourceIdSchema.describe("The domain id to link your API with.").optional(),
386
+ subDomain: z12.string().optional(),
387
+ auth: z12.union([
388
+ ResourceIdSchema,
389
+ z12.object({
390
+ authorizer: FunctionSchema,
391
+ ttl: AuthorizerTtl.default("1 hour")
392
+ })
393
+ ]).optional(),
394
+ // authorization: z.object({
395
+ // authorizer: FunctionSchema,
396
+ // ttl: DurationSchema.default('1 hour'),
397
+ // }).optional(),
398
+ resolver: LocalFileSchema.optional()
612
399
  })
613
- ).optional().describe("Define the auth triggers in your stack.");
614
- var AuthDefaultSchema = z21.record(
400
+ ).describe(`Define the global GraphQL API's.`).optional();
401
+ var GraphQLSchema = z12.record(
615
402
  ResourceIdSchema,
616
- z21.object({
617
- allowUserRegistration: z21.boolean().default(true).describe("Specifies whether users can create an user account or if only the administrator can."),
618
- messaging: z21.object({
619
- fromEmail: EmailSchema.describe("Specifies the sender's email address."),
620
- fromName: z21.string().optional().describe("Specifies the sender's name."),
621
- replyTo: EmailSchema.optional().describe(
622
- "The destination to which the receiver of the email should reply."
623
- )
624
- }).optional().describe("The email configuration for sending messages."),
625
- // secret: z.boolean().default(false).describe('Specifies whether you want to generate a client secret.'),
626
- username: z21.object({
627
- emailAlias: z21.boolean().default(true).describe("Allow the user email to be used as username."),
628
- caseSensitive: z21.boolean().default(false).describe(
629
- "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."
630
- )
631
- }).default({}).describe("The username policy."),
632
- password: z21.object({
633
- minLength: z21.number().int().min(6).max(99).default(12).describe("Required users to have at least the minimum password length."),
634
- uppercase: z21.boolean().default(true).describe("Required users to use at least one uppercase letter in their password."),
635
- lowercase: z21.boolean().default(true).describe("Required users to use at least one lowercase letter in their password."),
636
- numbers: z21.boolean().default(true).describe("Required users to use at least one number in their password."),
637
- symbols: z21.boolean().default(true).describe("Required users to use at least one symbol in their password."),
638
- temporaryPasswordValidity: DurationSchema.default("7 days").describe(
639
- "The duration a temporary password is valid. If the user doesn't sign in during this time, an administrator must reset their password."
640
- )
641
- }).default({}).describe("The password policy."),
642
- validity: z21.object({
643
- idToken: DurationSchema.default("1 hour").describe(
644
- "The ID token time limit. After this limit expires, your user can't use their ID token."
645
- ),
646
- accessToken: DurationSchema.default("1 hour").describe(
647
- "The access token time limit. After this limit expires, your user can't use their access token."
648
- ),
649
- refreshToken: DurationSchema.default("365 days").describe(
650
- "The refresh token time limit. After this limit expires, your user can't use their refresh token."
403
+ z12.object({
404
+ // schema: z.union([LocalFileSchema.transform(v => [v]), z.array(LocalFileSchema).min(1)]).optional(),
405
+ schema: LocalFileSchema.describe("The graphql schema file."),
406
+ resolvers: z12.record(
407
+ // TypeName
408
+ z12.string(),
409
+ z12.record(
410
+ // FieldName
411
+ z12.string(),
412
+ z12.union([
413
+ FunctionSchema.transform((consumer) => ({
414
+ consumer
415
+ })),
416
+ z12.object({
417
+ consumer: FunctionSchema,
418
+ resolver: LocalFileSchema.optional()
419
+ })
420
+ ])
651
421
  )
652
- }).default({}).describe("Specifies the validity duration for every JWT token."),
653
- triggers: TriggersSchema.optional()
422
+ ).describe("The resolvers for your global GraphQL API.").optional()
654
423
  })
655
- ).default({}).describe("Define the authenticatable users in your app.");
424
+ ).describe("Define the schema & resolvers in your stack for your global GraphQL API.").optional();
656
425
 
657
426
  // src/feature/http/schema.ts
658
- import { z as z22 } from "zod";
659
- var RouteSchema2 = z22.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route").transform((v) => v);
660
- var HttpDefaultSchema = z22.record(
427
+ import { z as z13 } from "zod";
428
+ var RouteSchema = z13.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route").transform((v) => v);
429
+ var HttpDefaultSchema = z13.record(
661
430
  ResourceIdSchema,
662
- z22.object({
431
+ z13.object({
663
432
  domain: ResourceIdSchema.describe("The domain id to link your API with."),
664
- subDomain: z22.string().optional()
433
+ subDomain: z13.string().optional()
665
434
  // auth: ResourceIdSchema.optional(),
666
435
  })
667
436
  ).optional().describe("Define your global HTTP API's.");
668
- var HttpSchema = z22.record(ResourceIdSchema, z22.record(RouteSchema2, FunctionSchema)).optional().describe("Define routes in your stack for your global HTTP API.");
437
+ var HttpSchema = z13.record(ResourceIdSchema, z13.record(RouteSchema, FunctionSchema)).optional().describe("Define routes in your stack for your global HTTP API.");
438
+
439
+ // src/feature/instance/schema.ts
440
+ import { z as z15 } from "zod";
441
+
442
+ // src/config/schema/local-directory.ts
443
+ import { stat as stat2 } from "fs/promises";
444
+ import { z as z14 } from "zod";
445
+ var LocalDirectorySchema = z14.string().transform((path) => resolvePath(path)).refine(async (path) => {
446
+ try {
447
+ const s = await stat2(path);
448
+ return s.isDirectory();
449
+ } catch (error) {
450
+ return false;
451
+ }
452
+ }, `Directory doesn't exist`);
453
+
454
+ // src/feature/instance/schema.ts
455
+ var ImageSchema = z15.string().regex(/^ami\-[0-9a-f]+/).describe("The ID of the AMI.");
456
+ var TypeSchema2 = z15.enum([
457
+ "t3.nano",
458
+ "t3.micro",
459
+ "t3.small",
460
+ "t3.medium",
461
+ "t3.large",
462
+ "t3.xlarge",
463
+ "t3.2xlarge",
464
+ "t4g.nano",
465
+ "t4g.micro",
466
+ "t4g.small",
467
+ "t4g.medium",
468
+ "t4g.large",
469
+ "t4g.xlarge",
470
+ "t4g.2xlarge",
471
+ "g4ad.xlarge"
472
+ ]).describe(`The instance type.`);
473
+ var CommandSchema = z15.string().describe(`The script you want to execute when the instance starts up.`);
474
+ var CodeSchema = LocalDirectorySchema.describe(`The code directory that will be deployed to your instance.`);
475
+ var ConnectSchema = z15.boolean().describe("Allows you to connect to all instances with an Instance Connect Endpoint.");
476
+ var EnvironmentSchema2 = z15.record(z15.string(), z15.string()).optional().describe("Environment variable key-value pairs.");
477
+ var InstanceDefaultSchema = z15.object({
478
+ connect: ConnectSchema.default(false)
479
+ }).default({}).describe("Define the default settings for all instances in your stacks.");
480
+ var InstancesSchema = z15.record(
481
+ ResourceIdSchema,
482
+ z15.object({
483
+ image: ImageSchema,
484
+ type: TypeSchema2,
485
+ code: CodeSchema,
486
+ command: CommandSchema.optional(),
487
+ environment: EnvironmentSchema2.optional()
488
+ })
489
+ ).optional().describe("Define the instances in your stack.");
490
+
491
+ // src/feature/on-failure/schema.ts
492
+ var OnFailureSchema = FunctionSchema.optional().describe(
493
+ "Defining a onFailure handler will add a global onFailure handler for the following resources:\n- Async lambda functions\n- SQS queues\n- DynamoDB streams"
494
+ );
495
+
496
+ // src/feature/pubsub/schema.ts
497
+ import { z as z16 } from "zod";
498
+ var PubSubSchema = z16.record(
499
+ ResourceIdSchema,
500
+ z16.object({
501
+ sql: z16.string().describe("The SQL statement used to query the IOT topic."),
502
+ sqlVersion: z16.enum(["2015-10-08", "2016-03-23", "beta"]).default("2016-03-23").describe("The version of the SQL rules engine to use when evaluating the rule."),
503
+ consumer: FunctionSchema.describe("The consuming lambda function properties.")
504
+ })
505
+ ).optional().describe("Define the pubsub subscriber in your stack.");
506
+
507
+ // src/feature/queue/schema.ts
508
+ import { z as z17 } from "zod";
509
+ import { days as days2, hours, minutes as minutes2, seconds as seconds2 } from "@awsless/duration";
510
+ import { kibibytes } from "@awsless/size";
511
+ var RetentionPeriodSchema = DurationSchema.refine(
512
+ durationMin(minutes2(1)),
513
+ "Minimum retention period is 1 minute"
514
+ ).refine(durationMax(days2(14)), "Maximum retention period is 14 days").describe(
515
+ "The number of seconds that Amazon SQS retains a message. You can specify a duration from 1 minute to 14 days."
516
+ );
517
+ var VisibilityTimeoutSchema = DurationSchema.refine(
518
+ durationMax(hours(12)),
519
+ "Maximum visibility timeout is 12 hours"
520
+ ).describe(
521
+ "The length of time during which a message will be unavailable after a message is delivered from the queue. This blocks other components from receiving the same message and gives the initial component time to process and delete the message from the queue. You can specify a duration from 0 to 12 hours."
522
+ );
523
+ var DeliveryDelaySchema = DurationSchema.refine(
524
+ durationMax(minutes2(15)),
525
+ "Maximum delivery delay is 15 minutes"
526
+ ).describe(
527
+ "The time in seconds for which the delivery of all messages in the queue is delayed. You can specify a duration from 0 to 15 minutes."
528
+ );
529
+ var ReceiveMessageWaitTimeSchema = DurationSchema.refine(
530
+ durationMin(seconds2(1)),
531
+ "Minimum receive message wait time is 1 second"
532
+ ).refine(durationMax(seconds2(20)), "Maximum receive message wait time is 20 seconds").describe(
533
+ "Specifies the duration, that the ReceiveMessage action call waits until a message is in the queue in order to include it in the response, rather than returning an empty response if a message isn't yet available. You can specify a duration from 1 to 20 seconds. Short polling is used as the default."
534
+ );
535
+ 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(
536
+ "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."
537
+ );
538
+ var BatchSizeSchema = z17.number().int().min(1, "Minimum batch size is 1").max(1e4, "Maximum batch size is 10000").describe(
539
+ "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."
540
+ );
541
+ var MaxConcurrencySchema = z17.number().int().min(2, "Minimum max concurrency is 2").max(1e3, "Maximum max concurrency is 1000").describe(
542
+ "Limits the number of concurrent instances that the queue worker can invoke. You can specify an integer from 2 to 1000."
543
+ );
544
+ var MaxBatchingWindow = DurationSchema.refine(
545
+ durationMax(minutes2(5)),
546
+ "Maximum max batching window is 5 minutes"
547
+ ).describe(
548
+ "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."
549
+ );
550
+ var QueueDefaultSchema = z17.object({
551
+ retentionPeriod: RetentionPeriodSchema.default("7 days"),
552
+ visibilityTimeout: VisibilityTimeoutSchema.default("30 seconds"),
553
+ deliveryDelay: DeliveryDelaySchema.default("0 seconds"),
554
+ receiveMessageWaitTime: ReceiveMessageWaitTimeSchema.optional(),
555
+ maxMessageSize: MaxMessageSizeSchema.default("256 KB"),
556
+ batchSize: BatchSizeSchema.default(10),
557
+ maxConcurrency: MaxConcurrencySchema.optional(),
558
+ maxBatchingWindow: MaxBatchingWindow.optional()
559
+ }).default({});
560
+ var QueuesSchema = z17.record(
561
+ ResourceIdSchema,
562
+ z17.union([
563
+ LocalFileSchema.transform((file) => ({
564
+ consumer: {
565
+ file
566
+ }
567
+ })),
568
+ z17.object({
569
+ consumer: FunctionSchema.describe("he consuming lambda function properties."),
570
+ retentionPeriod: RetentionPeriodSchema.optional(),
571
+ visibilityTimeout: VisibilityTimeoutSchema.optional(),
572
+ deliveryDelay: DeliveryDelaySchema.optional(),
573
+ receiveMessageWaitTime: ReceiveMessageWaitTimeSchema.optional(),
574
+ maxMessageSize: MaxMessageSizeSchema.optional(),
575
+ batchSize: BatchSizeSchema.optional(),
576
+ maxConcurrency: MaxConcurrencySchema.optional(),
577
+ maxBatchingWindow: MaxBatchingWindow.optional()
578
+ })
579
+ ])
580
+ ).optional().describe("Define the queues in your stack.");
581
+
582
+ // src/feature/rest/schema.ts
583
+ import { z as z19 } from "zod";
584
+
585
+ // src/config/schema/route.ts
586
+ import { z as z18 } from "zod";
587
+ var RouteSchema2 = z18.union([
588
+ z18.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route"),
589
+ z18.literal("$default")
590
+ ]);
591
+
592
+ // src/feature/rest/schema.ts
593
+ var RestDefaultSchema = z19.record(
594
+ ResourceIdSchema,
595
+ z19.object({
596
+ domain: ResourceIdSchema.describe("The domain id to link your API with.").optional(),
597
+ subDomain: z19.string().optional()
598
+ })
599
+ ).optional().describe("Define your global REST API's.");
600
+ var RestSchema = z19.record(ResourceIdSchema, z19.record(RouteSchema2, FunctionSchema)).optional().describe("Define routes in your stack for your global REST API.");
669
601
 
670
602
  // src/feature/search/schema.ts
671
- import { z as z23 } from "zod";
603
+ import { z as z20 } from "zod";
672
604
  import { gibibytes as gibibytes2 } from "@awsless/size";
673
- var VersionSchema = z23.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]);
674
- var TypeSchema2 = z23.enum([
605
+ var VersionSchema = z20.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]);
606
+ var TypeSchema3 = z20.enum([
675
607
  "t3.small",
676
608
  "t3.medium",
677
609
  "t3.large",
@@ -772,41 +704,41 @@ var TypeSchema2 = z23.enum([
772
704
  "r6gd.16xlarge"
773
705
  ]);
774
706
  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.");
775
- var SearchsSchema = z23.record(
707
+ var SearchsSchema = z20.record(
776
708
  ResourceIdSchema,
777
- z23.object({
778
- type: TypeSchema2.default("t3.small"),
779
- count: z23.number().int().min(1).default(1),
709
+ z20.object({
710
+ type: TypeSchema3.default("t3.small"),
711
+ count: z20.number().int().min(1).default(1),
780
712
  version: VersionSchema.default("2.13"),
781
713
  storage: StorageSizeSchema.default("10 GB"),
782
- vpc: z23.boolean().default(false)
714
+ vpc: z20.boolean().default(false)
783
715
  })
784
716
  ).optional().describe("Define the search instances in your stack. Backed by OpenSearch.");
785
717
 
786
718
  // src/feature/site/schema.ts
787
- import { z as z24 } from "zod";
788
- var ErrorResponsePathSchema = z24.string().describe(
719
+ import { z as z21 } from "zod";
720
+ var ErrorResponsePathSchema = z21.string().describe(
789
721
  "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."
790
722
  );
791
- var StatusCodeSchema = z24.number().int().positive().optional().describe(
723
+ var StatusCodeSchema = z21.number().int().positive().optional().describe(
792
724
  "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."
793
725
  );
794
726
  var MinTTLSchema = DurationSchema.describe(
795
727
  "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."
796
728
  );
797
- var ErrorResponseSchema = z24.union([
729
+ var ErrorResponseSchema = z21.union([
798
730
  ErrorResponsePathSchema,
799
- z24.object({
731
+ z21.object({
800
732
  path: ErrorResponsePathSchema,
801
733
  statusCode: StatusCodeSchema.optional(),
802
734
  minTTL: MinTTLSchema.optional()
803
735
  })
804
736
  ]).optional();
805
- var SitesSchema = z24.record(
737
+ var SitesSchema = z21.record(
806
738
  ResourceIdSchema,
807
- z24.object({
739
+ z21.object({
808
740
  domain: ResourceIdSchema.describe("The domain id to link your site with."),
809
- subDomain: z24.string().optional(),
741
+ subDomain: z21.string().optional(),
810
742
  // bind: z
811
743
  // .object({
812
744
  // auth: z.array(ResourceIdSchema),
@@ -829,7 +761,7 @@ var SitesSchema = z24.record(
829
761
  // build: z.string().optional(),
830
762
  // }),
831
763
  // ]),
832
- errors: z24.object({
764
+ errors: z21.object({
833
765
  400: ErrorResponseSchema.describe("Customize a `400 Bad Request` response."),
834
766
  403: ErrorResponseSchema.describe("Customize a `403 Forbidden` response."),
835
767
  404: ErrorResponseSchema.describe("Customize a `404 Not Found` response."),
@@ -842,16 +774,16 @@ var SitesSchema = z24.record(
842
774
  503: ErrorResponseSchema.describe("Customize a `503 Service Unavailable` response."),
843
775
  504: ErrorResponseSchema.describe("Customize a `504 Gateway Timeout` response.")
844
776
  }).optional().describe("Customize the error responses for specific HTTP status codes."),
845
- cors: z24.object({
846
- override: z24.boolean().default(false),
777
+ cors: z21.object({
778
+ override: z21.boolean().default(false),
847
779
  maxAge: DurationSchema.default("365 days"),
848
- exposeHeaders: z24.string().array().optional(),
849
- credentials: z24.boolean().default(false),
850
- headers: z24.string().array().default(["*"]),
851
- origins: z24.string().array().default(["*"]),
852
- methods: z24.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
780
+ exposeHeaders: z21.string().array().optional(),
781
+ credentials: z21.boolean().default(false),
782
+ headers: z21.string().array().default(["*"]),
783
+ origins: z21.string().array().default(["*"]),
784
+ methods: z21.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
853
785
  }).optional().describe("Define the cors headers."),
854
- security: z24.object({
786
+ security: z21.object({
855
787
  // contentSecurityPolicy: z.object({
856
788
  // override: z.boolean().default(false),
857
789
  // policy: z.string(),
@@ -893,16 +825,132 @@ var SitesSchema = z24.record(
893
825
  // reportUri?: string
894
826
  // }
895
827
  }).optional().describe("Define the security policy."),
896
- cache: z24.object({
897
- cookies: z24.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
898
- headers: z24.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
899
- queries: z24.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
828
+ cache: z21.object({
829
+ cookies: z21.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
830
+ headers: z21.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
831
+ queries: z21.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
900
832
  }).optional().describe(
901
833
  "Specifies the cookies, headers, and query values that CloudFront includes in the cache key."
902
834
  )
903
835
  })
904
836
  ).optional().describe("Define the sites in your stack.");
905
837
 
838
+ // src/feature/store/schema.ts
839
+ import { z as z22 } from "zod";
840
+ var StoresSchema = z22.union([
841
+ z22.array(ResourceIdSchema).transform((list) => {
842
+ const stores = {};
843
+ for (const key of list) {
844
+ stores[key] = {};
845
+ }
846
+ return stores;
847
+ }),
848
+ z22.record(
849
+ ResourceIdSchema,
850
+ z22.object({
851
+ // cors: CorsSchema,
852
+ versioning: z22.boolean().default(false).describe("Enable versioning of your store."),
853
+ events: z22.object({
854
+ // create
855
+ "created:*": FunctionSchema.optional().describe(
856
+ "Subscribe to notifications regardless of the API that was used to create an object."
857
+ ),
858
+ "created:put": FunctionSchema.optional().describe(
859
+ "Subscribe to notifications when an object is created using the PUT API operation."
860
+ ),
861
+ "created:post": FunctionSchema.optional().describe(
862
+ "Subscribe to notifications when an object is created using the POST API operation."
863
+ ),
864
+ "created:copy": FunctionSchema.optional().describe(
865
+ "Subscribe to notifications when an object is created using the COPY API operation."
866
+ ),
867
+ "created:upload": FunctionSchema.optional().describe(
868
+ "Subscribe to notifications when an object multipart upload has been completed."
869
+ ),
870
+ // remove
871
+ "removed:*": FunctionSchema.optional().describe(
872
+ "Subscribe to notifications when an object is deleted or a delete marker for a versioned object is created."
873
+ ),
874
+ "removed:delete": FunctionSchema.optional().describe(
875
+ "Subscribe to notifications when an object is deleted"
876
+ ),
877
+ "removed:marker": FunctionSchema.optional().describe(
878
+ "Subscribe to notifications when a delete marker for a versioned object is created."
879
+ )
880
+ }).optional().describe("Describes the store events you want to subscribe too.")
881
+ })
882
+ )
883
+ ]).optional().describe("Define the stores in your stack.");
884
+
885
+ // src/feature/stream/schema.ts
886
+ import { z as z23 } from "zod";
887
+ var LatencyModeSchema = z23.enum(["low", "normal"]).describe(
888
+ `Channel latency mode. Valid values:
889
+ - normal: Use "normal" to broadcast and deliver live video up to Full HD.
890
+ - low: Use "low" for near real-time interactions with viewers.`
891
+ );
892
+ var TypeSchema4 = z23.enum(["standard", "basic", "advanced-sd", "advanced-hd"]).describe(`The channel type, which determines the allowable resolution and bitrate.
893
+ If you exceed the allowable resolution or bitrate, the stream probably will disconnect immediately. Valid values:
894
+ - 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.
895
+ - 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.
896
+ - 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.
897
+ - 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.
898
+ `);
899
+ var StreamsSchema = z23.record(
900
+ ResourceIdSchema,
901
+ z23.object({
902
+ type: TypeSchema4.default("standard"),
903
+ // preset: PresetSchema.optional(),
904
+ latencyMode: LatencyModeSchema.default("low")
905
+ })
906
+ ).optional().describe("Define the streams in your stack.");
907
+
908
+ // src/feature/table/schema.ts
909
+ import { z as z24 } from "zod";
910
+ var KeySchema = z24.string().min(1).max(255);
911
+ var TablesSchema = z24.record(
912
+ ResourceIdSchema,
913
+ z24.object({
914
+ hash: KeySchema.describe(
915
+ "Specifies the name of the partition / hash key that makes up the primary key for the table."
916
+ ),
917
+ sort: KeySchema.optional().describe(
918
+ "Specifies the name of the range / sort key that makes up the primary key for the table."
919
+ ),
920
+ fields: z24.record(z24.string(), z24.enum(["string", "number", "binary"])).optional().describe(
921
+ 'A list of attributes that describe the key schema for the table and indexes. If no attribute field is defined we default to "string".'
922
+ ),
923
+ class: z24.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
924
+ pointInTimeRecovery: z24.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
925
+ timeToLiveAttribute: KeySchema.optional().describe(
926
+ "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."
927
+ ),
928
+ stream: z24.object({
929
+ type: z24.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
930
+ "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."
931
+ ),
932
+ consumer: FunctionSchema.describe("The consuming lambda function for the stream")
933
+ }).optional().describe(
934
+ "The settings for the DynamoDB table stream, which capture changes to items stored in the table."
935
+ ),
936
+ indexes: z24.record(
937
+ z24.string(),
938
+ z24.object({
939
+ /** Specifies the name of the partition / hash key that makes up the primary key for the global secondary index. */
940
+ hash: KeySchema,
941
+ /** Specifies the name of the range / sort key that makes up the primary key for the global secondary index. */
942
+ sort: KeySchema.optional(),
943
+ /** The set of attributes that are projected into the index:
944
+ * - all - All of the table attributes are projected into the index.
945
+ * - keys-only - Only the index and primary keys are projected into the index.
946
+ * @default 'all'
947
+ */
948
+ projection: z24.enum(["all", "keys-only"]).default("all")
949
+ })
950
+ ).optional().describe("Specifies the global secondary indexes to be created on the table.")
951
+ })
952
+ ).optional().describe("Define the tables in your stack.");
953
+
906
954
  // src/feature/task/schema.ts
907
955
  import { z as z25 } from "zod";
908
956
  var RetryAttemptsSchema2 = z25.number().int().min(0).max(2).describe(
@@ -920,13 +968,26 @@ var TaskSchema = z25.union([
920
968
  ]);
921
969
  var TasksSchema = z25.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
922
970
 
971
+ // src/feature/test/schema.ts
972
+ import { z as z26 } from "zod";
973
+ var TestsSchema = z26.union([LocalDirectorySchema.transform((v) => [v]), LocalDirectorySchema.array()]).describe("Define the location of your tests for your stack.").optional();
974
+
975
+ // src/feature/topic/schema.ts
976
+ import { paramCase as paramCase2 } from "change-case";
977
+ import { z as z27 } from "zod";
978
+ var TopicNameSchema = z27.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => paramCase2(value)).describe("Define event topic name.");
979
+ var TopicsSchema = z27.array(TopicNameSchema).refine((topics) => {
980
+ return topics.length === new Set(topics).size;
981
+ }, "Must be a list of unique topic names").optional().describe("Define the event topics to publish too in your stack.");
982
+ var SubscribersSchema = z27.record(TopicNameSchema, z27.union([EmailSchema, FunctionSchema])).optional().describe("Define the event topics to subscribe too in your stack.");
983
+
923
984
  // src/config/stack.ts
924
985
  var DependsSchema = ResourceIdSchema.array().optional().describe("Define the stacks that this stack is depended on.");
925
986
  var NameSchema = ResourceIdSchema.refine((name) => !["base"].includes(name), {
926
987
  message: `Stack name can't be a reserved name.`
927
988
  }).describe("Stack name.");
928
- var StackSchema = z26.object({
929
- $schema: z26.string().optional(),
989
+ var StackSchema = z28.object({
990
+ $schema: z28.string().optional(),
930
991
  name: NameSchema,
931
992
  depends: DependsSchema,
932
993
  onFailure: OnFailureSchema,
@@ -940,9 +1001,11 @@ var StackSchema = z26.object({
940
1001
  topics: TopicsSchema,
941
1002
  subscribers: SubscribersSchema,
942
1003
  functions: FunctionsSchema,
1004
+ instances: InstancesSchema,
943
1005
  tasks: TasksSchema,
944
1006
  tables: TablesSchema,
945
1007
  stores: StoresSchema,
1008
+ streams: StreamsSchema,
946
1009
  queues: QueuesSchema,
947
1010
  pubsub: PubSubSchema,
948
1011
  searchs: SearchsSchema,
@@ -951,10 +1014,31 @@ var StackSchema = z26.object({
951
1014
  });
952
1015
 
953
1016
  // src/config/app.ts
1017
+ import { z as z31 } from "zod";
1018
+
1019
+ // src/feature/domain/schema.ts
954
1020
  import { z as z29 } from "zod";
1021
+ var DomainNameSchema = z29.string().regex(/[a-z\-\_\.]/g, "Invalid domain name").describe(
1022
+ "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."
1023
+ );
1024
+ var DNSTypeSchema = z29.enum(["A", "AAAA", "CAA", "CNAME", "DS", "MX", "NAPTR", "NS", "PTR", "SOA", "SPF", "SRV", "TXT"]).describe("The DNS record type.");
1025
+ var TTLSchema = DurationSchema.describe("The resource record cache time to live (TTL).");
1026
+ var RecordsSchema = z29.string().array().describe("One or more values that correspond with the value that you specified for the Type property.");
1027
+ var DomainsDefaultSchema = z29.record(
1028
+ ResourceIdSchema,
1029
+ z29.object({
1030
+ domain: DomainNameSchema.describe("Define the domain name"),
1031
+ dns: z29.object({
1032
+ name: DomainNameSchema.optional(),
1033
+ type: DNSTypeSchema,
1034
+ ttl: TTLSchema,
1035
+ records: RecordsSchema
1036
+ }).array().optional().describe("Define the domain dns records")
1037
+ })
1038
+ ).optional().describe("Define the domains for your application.");
955
1039
 
956
1040
  // src/config/schema/region.ts
957
- import { z as z27 } from "zod";
1041
+ import { z as z30 } from "zod";
958
1042
  var US = ["us-east-2", "us-east-1", "us-west-1", "us-west-2"];
959
1043
  var AF = ["af-south-1"];
960
1044
  var AP = [
@@ -983,44 +1067,24 @@ var EU = [
983
1067
  var ME = ["me-south-1", "me-central-1"];
984
1068
  var SA = ["sa-east-1"];
985
1069
  var regions = [...US, ...AF, ...AP, ...CA, ...EU, ...ME, ...SA];
986
- var RegionSchema = z27.enum(regions);
987
-
988
- // src/feature/domain/schema.ts
989
- import { z as z28 } from "zod";
990
- var DomainNameSchema = z28.string().regex(/[a-z\-\_\.]/g, "Invalid domain name").describe(
991
- "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."
992
- );
993
- var DNSTypeSchema = z28.enum(["A", "AAAA", "CAA", "CNAME", "DS", "MX", "NAPTR", "NS", "PTR", "SOA", "SPF", "SRV", "TXT"]).describe("The DNS record type.");
994
- var TTLSchema = DurationSchema.describe("The resource record cache time to live (TTL).");
995
- var RecordsSchema = z28.string().array().describe("One or more values that correspond with the value that you specified for the Type property.");
996
- var DomainsDefaultSchema = z28.record(
997
- ResourceIdSchema,
998
- z28.object({
999
- domain: DomainNameSchema.describe("Define the domain name"),
1000
- dns: z28.object({
1001
- name: DomainNameSchema.optional(),
1002
- type: DNSTypeSchema,
1003
- ttl: TTLSchema,
1004
- records: RecordsSchema
1005
- }).array().optional().describe("Define the domain dns records")
1006
- })
1007
- ).optional().describe("Define the domains for your application.");
1070
+ var RegionSchema = z30.enum(regions);
1008
1071
 
1009
1072
  // src/config/app.ts
1010
- var AppSchema = z29.object({
1011
- $schema: z29.string().optional(),
1073
+ var AppSchema = z31.object({
1074
+ $schema: z31.string().optional(),
1012
1075
  name: ResourceIdSchema.describe("App name."),
1013
1076
  region: RegionSchema.describe("The AWS region to deploy to."),
1014
- profile: z29.string().describe("The AWS profile to deploy to."),
1077
+ profile: z31.string().describe("The AWS profile to deploy to."),
1015
1078
  // stage: z
1016
1079
  // .string()
1017
1080
  // .regex(/^[a-z]+$/)
1018
1081
  // .default('prod')
1019
1082
  // .describe('The deployment stage.'),
1020
- defaults: z29.object({
1083
+ defaults: z31.object({
1021
1084
  auth: AuthDefaultSchema,
1022
1085
  domains: DomainsDefaultSchema,
1023
1086
  function: FunctionDefaultSchema,
1087
+ instance: InstanceDefaultSchema,
1024
1088
  queue: QueueDefaultSchema,
1025
1089
  graphql: GraphQLDefaultSchema,
1026
1090
  http: HttpDefaultSchema,