@awsless/awsless 0.0.83 → 0.0.85

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.js CHANGED
@@ -1642,17 +1642,20 @@ var cronPlugin = definePlugin({
1642
1642
  * }
1643
1643
  * }
1644
1644
  * */
1645
- crons: z7.record(ResourceIdSchema, z7.object({
1646
- /** The consuming lambda function properties. */
1647
- consumer: FunctionSchema,
1648
- /** The scheduling expression.
1649
- * @example '0 20 * * ? *'
1650
- * @example '5 minutes'
1651
- */
1652
- schedule: ScheduleExpressionSchema,
1653
- // Valid JSON passed to the consumer.
1654
- payload: z7.unknown().optional()
1655
- })).optional()
1645
+ crons: z7.record(
1646
+ ResourceIdSchema,
1647
+ z7.object({
1648
+ /** The consuming lambda function properties. */
1649
+ consumer: FunctionSchema,
1650
+ /** The scheduling expression.
1651
+ * @example '0 20 * * ? *'
1652
+ * @example '5 minutes'
1653
+ */
1654
+ schedule: ScheduleExpressionSchema,
1655
+ // Valid JSON passed to the consumer.
1656
+ payload: z7.unknown().optional()
1657
+ })
1658
+ ).optional()
1656
1659
  }).array()
1657
1660
  }),
1658
1661
  onStack(ctx) {
@@ -2360,7 +2363,7 @@ var storePlugin = definePlugin({
2360
2363
  });
2361
2364
 
2362
2365
  // src/plugins/topic.ts
2363
- import { z as z11 } from "zod";
2366
+ import { z as z12 } from "zod";
2364
2367
 
2365
2368
  // src/formation/resource/sns/topic.ts
2366
2369
  var Topic = class extends Resource {
@@ -2427,6 +2430,15 @@ var SnsEventSource = class extends Group {
2427
2430
  }
2428
2431
  };
2429
2432
 
2433
+ // src/schema/email.ts
2434
+ import { z as z11 } from "zod";
2435
+ var EmailSchema = z11.custom((value) => {
2436
+ return z11.string().email().safeParse(value).success;
2437
+ });
2438
+ var isEmail = (value) => {
2439
+ return z11.string().email().safeParse(value).success;
2440
+ };
2441
+
2430
2442
  // src/plugins/topic.ts
2431
2443
  var typeGenCode3 = `
2432
2444
  import { PublishOptions } from '@awsless/sns'
@@ -2437,26 +2449,30 @@ type Publish<Name extends string> = {
2437
2449
  }`;
2438
2450
  var topicPlugin = definePlugin({
2439
2451
  name: "topic",
2440
- schema: z11.object({
2441
- stacks: z11.object({
2452
+ schema: z12.object({
2453
+ stacks: z12.object({
2442
2454
  /** Define the events to publish too in your stack.
2443
2455
  * @example
2444
2456
  * {
2445
2457
  * topics: [ 'TOPIC_NAME' ]
2446
2458
  * }
2447
2459
  */
2448
- topics: z11.array(ResourceIdSchema).refine((topics) => {
2460
+ topics: z12.array(ResourceIdSchema).refine((topics) => {
2449
2461
  return topics.length === new Set(topics).size;
2450
2462
  }, "Must be a list of unique topic names").optional(),
2451
2463
  /** Define the events to subscribe too in your stack.
2452
2464
  * @example
2453
2465
  * {
2454
- * subscribers: {
2455
- * TOPIC_NAME: 'function.ts'
2466
+ * subscribers: {
2467
+ * // Subscribe to a lambda function.
2468
+ * TOPIC_NAME: 'function.ts',
2469
+ *
2470
+ * // Subscribe to an email address.
2471
+ * TOPIC_NAME: 'example@gmail.com',
2456
2472
  * }
2457
2473
  * }
2458
2474
  */
2459
- subscribers: z11.record(ResourceIdSchema, FunctionSchema).optional()
2475
+ subscribers: z12.record(ResourceIdSchema, z12.union([EmailSchema, FunctionSchema])).optional()
2460
2476
  }).array().superRefine((stacks, ctx) => {
2461
2477
  const topics = [];
2462
2478
  for (const stack of stacks) {
@@ -2467,7 +2483,7 @@ var topicPlugin = definePlugin({
2467
2483
  for (const sub2 of Object.keys(stack.subscribers || {})) {
2468
2484
  if (!topics.includes(sub2)) {
2469
2485
  ctx.addIssue({
2470
- code: z11.ZodIssueCode.custom,
2486
+ code: z12.ZodIssueCode.custom,
2471
2487
  message: `Topic subscription to "${sub2}" is undefined`,
2472
2488
  path: [Number(index), "subscribers"]
2473
2489
  });
@@ -2514,25 +2530,34 @@ var topicPlugin = definePlugin({
2514
2530
  });
2515
2531
  }
2516
2532
  for (const [id, props] of Object.entries(stackConfig.subscribers || {})) {
2517
- const lambda = toLambdaFunction(ctx, `topic-${id}`, props);
2518
- const source = new SnsEventSource(id, lambda, {
2519
- topicArn: bootstrap2.import(`topic-${id}-arn`)
2520
- });
2521
- stack.add(lambda, source);
2533
+ if (typeof props === "string" && isEmail(props)) {
2534
+ const subscription = new Subscription(id, {
2535
+ topicArn: bootstrap2.import(`topic-${id}-arn`),
2536
+ protocol: "email",
2537
+ endpoint: props
2538
+ });
2539
+ stack.add(subscription);
2540
+ } else {
2541
+ const lambda = toLambdaFunction(ctx, `topic-${id}`, props);
2542
+ const source = new SnsEventSource(id, lambda, {
2543
+ topicArn: bootstrap2.import(`topic-${id}-arn`)
2544
+ });
2545
+ stack.add(lambda, source);
2546
+ }
2522
2547
  }
2523
2548
  }
2524
2549
  });
2525
2550
 
2526
2551
  // src/plugins/extend.ts
2527
- import { z as z12 } from "zod";
2552
+ import { z as z13 } from "zod";
2528
2553
  var extendPlugin = definePlugin({
2529
2554
  name: "extend",
2530
- schema: z12.object({
2555
+ schema: z13.object({
2531
2556
  /** Extend your app with custom resources. */
2532
- extend: z12.custom().optional(),
2533
- stacks: z12.object({
2557
+ extend: z13.custom().optional(),
2558
+ stacks: z13.object({
2534
2559
  /** Extend your stack with custom resources. */
2535
- extend: z12.custom().optional()
2560
+ extend: z13.custom().optional()
2536
2561
  }).array()
2537
2562
  }),
2538
2563
  onApp(ctx) {
@@ -2544,7 +2569,7 @@ var extendPlugin = definePlugin({
2544
2569
  });
2545
2570
 
2546
2571
  // src/plugins/pubsub.ts
2547
- import { z as z13 } from "zod";
2572
+ import { z as z14 } from "zod";
2548
2573
 
2549
2574
  // src/formation/resource/iot/topic-rule.ts
2550
2575
  import { snakeCase } from "change-case";
@@ -2595,8 +2620,8 @@ var IotEventSource = class extends Group {
2595
2620
  // src/plugins/pubsub.ts
2596
2621
  var pubsubPlugin = definePlugin({
2597
2622
  name: "pubsub",
2598
- schema: z13.object({
2599
- stacks: z13.object({
2623
+ schema: z14.object({
2624
+ stacks: z14.object({
2600
2625
  /** Define the pubsub subscriber in your stack.
2601
2626
  * @example
2602
2627
  * {
@@ -2608,14 +2633,17 @@ var pubsubPlugin = definePlugin({
2608
2633
  * }
2609
2634
  * }
2610
2635
  */
2611
- pubsub: z13.record(ResourceIdSchema, z13.object({
2612
- /** The SQL statement used to query the iot topic. */
2613
- sql: z13.string(),
2614
- /** The version of the SQL rules engine to use when evaluating the rule. */
2615
- sqlVersion: z13.enum(["2015-10-08", "2016-03-23", "beta"]).default("2016-03-23"),
2616
- /** The consuming lambda function properties. */
2617
- consumer: FunctionSchema
2618
- })).optional()
2636
+ pubsub: z14.record(
2637
+ ResourceIdSchema,
2638
+ z14.object({
2639
+ /** The SQL statement used to query the IOT topic. */
2640
+ sql: z14.string(),
2641
+ /** The version of the SQL rules engine to use when evaluating the rule. */
2642
+ sqlVersion: z14.enum(["2015-10-08", "2016-03-23", "beta"]).default("2016-03-23"),
2643
+ /** The consuming lambda function properties. */
2644
+ consumer: FunctionSchema
2645
+ })
2646
+ ).optional()
2619
2647
  }).array()
2620
2648
  }),
2621
2649
  onApp({ bind }) {
@@ -2641,7 +2669,7 @@ var pubsubPlugin = definePlugin({
2641
2669
  });
2642
2670
 
2643
2671
  // src/plugins/graphql.ts
2644
- import { z as z14 } from "zod";
2672
+ import { z as z15 } from "zod";
2645
2673
 
2646
2674
  // src/util/array.ts
2647
2675
  var toArray = (value) => {
@@ -3041,41 +3069,44 @@ export function response(ctx) {
3041
3069
  `;
3042
3070
  var graphqlPlugin = definePlugin({
3043
3071
  name: "graphql",
3044
- schema: z14.object({
3045
- defaults: z14.object({
3046
- graphql: z14.record(ResourceIdSchema, z14.object({
3047
- domain: z14.string().optional(),
3048
- subDomain: z14.string().optional(),
3049
- auth: ResourceIdSchema.optional(),
3050
- // authorization: z.object({
3051
- // authorizer: FunctionSchema,
3052
- // ttl: DurationSchema.default('1 hour'),
3053
- // }).optional(),
3054
- resolver: LocalFileSchema.optional()
3055
- })).optional()
3072
+ schema: z15.object({
3073
+ defaults: z15.object({
3074
+ graphql: z15.record(
3075
+ ResourceIdSchema,
3076
+ z15.object({
3077
+ domain: z15.string().optional(),
3078
+ subDomain: z15.string().optional(),
3079
+ auth: ResourceIdSchema.optional(),
3080
+ // authorization: z.object({
3081
+ // authorizer: FunctionSchema,
3082
+ // ttl: DurationSchema.default('1 hour'),
3083
+ // }).optional(),
3084
+ resolver: LocalFileSchema.optional()
3085
+ })
3086
+ ).optional()
3056
3087
  }).default({}),
3057
- stacks: z14.object({
3058
- graphql: z14.record(ResourceIdSchema, z14.object({
3059
- schema: z14.union([
3060
- LocalFileSchema,
3061
- z14.array(LocalFileSchema).min(1)
3062
- ]).optional(),
3063
- resolvers: z14.record(
3064
- // TypeName
3065
- z14.string(),
3066
- z14.record(
3067
- // FieldName
3068
- z14.string(),
3069
- z14.union([
3070
- FunctionSchema,
3071
- z14.object({
3072
- consumer: FunctionSchema,
3073
- resolver: LocalFileSchema
3074
- })
3075
- ])
3076
- )
3077
- ).optional()
3078
- })).optional()
3088
+ stacks: z15.object({
3089
+ graphql: z15.record(
3090
+ ResourceIdSchema,
3091
+ z15.object({
3092
+ schema: z15.union([LocalFileSchema, z15.array(LocalFileSchema).min(1)]).optional(),
3093
+ resolvers: z15.record(
3094
+ // TypeName
3095
+ z15.string(),
3096
+ z15.record(
3097
+ // FieldName
3098
+ z15.string(),
3099
+ z15.union([
3100
+ FunctionSchema,
3101
+ z15.object({
3102
+ consumer: FunctionSchema,
3103
+ resolver: LocalFileSchema
3104
+ })
3105
+ ])
3106
+ )
3107
+ ).optional()
3108
+ })
3109
+ ).optional()
3079
3110
  }).array()
3080
3111
  }),
3081
3112
  onApp(ctx) {
@@ -3106,17 +3137,18 @@ var graphqlPlugin = definePlugin({
3106
3137
  continue;
3107
3138
  }
3108
3139
  if (props.auth) {
3109
- api.setDefaultAuthorization(GraphQLAuthorization.withCognito({
3110
- userPoolId: bootstrap2.import(`auth-${props.auth}-user-pool-id`),
3111
- region: bootstrap2.region,
3112
- defaultAction: "ALLOW"
3113
- }));
3140
+ api.setDefaultAuthorization(
3141
+ GraphQLAuthorization.withCognito({
3142
+ userPoolId: bootstrap2.import(`auth-${props.auth}-user-pool-id`),
3143
+ region: bootstrap2.region,
3144
+ defaultAction: "ALLOW"
3145
+ })
3146
+ );
3114
3147
  }
3115
3148
  if (props.domain) {
3116
3149
  const domainName = props.subDomain ? `${props.subDomain}.${props.domain}` : props.domain;
3117
3150
  const hostedZoneId = bootstrap2.import(`hosted-zone-${props.domain}-id`);
3118
3151
  const certificateArn = bootstrap2.import(`us-east-certificate-${props.domain}-arn`);
3119
- debug("DEBUG CERT", certificateArn);
3120
3152
  const domain = new DomainName(id, {
3121
3153
  domainName,
3122
3154
  certificateArn
@@ -3161,7 +3193,7 @@ var graphqlPlugin = definePlugin({
3161
3193
  });
3162
3194
 
3163
3195
  // src/plugins/domain.ts
3164
- import { z as z15 } from "zod";
3196
+ import { z as z16 } from "zod";
3165
3197
 
3166
3198
  // src/formation/resource/route53/hosted-zone.ts
3167
3199
  var HostedZone = class extends Resource {
@@ -3261,11 +3293,11 @@ var GlobalExports = class extends Group {
3261
3293
  };
3262
3294
 
3263
3295
  // src/plugins/domain.ts
3264
- var DomainNameSchema = z15.string().regex(/[a-z\-\_\.]/g, "Invalid domain name");
3296
+ var DomainNameSchema = z16.string().regex(/[a-z\-\_\.]/g, "Invalid domain name");
3265
3297
  var domainPlugin = definePlugin({
3266
3298
  name: "domain",
3267
- schema: z15.object({
3268
- defaults: z15.object({
3299
+ schema: z16.object({
3300
+ defaults: z16.object({
3269
3301
  /** Define the domains for your application.
3270
3302
  * @example
3271
3303
  * {
@@ -3279,20 +3311,37 @@ var domainPlugin = definePlugin({
3279
3311
  * }
3280
3312
  * }
3281
3313
  */
3282
- domains: z15.record(DomainNameSchema, z15.object({
3283
- /** Enter a fully qualified domain name, for example, www.example.com.
3284
- * You can optionally include a trailing dot.
3285
- * If you omit the trailing dot, Amazon Route 53 assumes that the domain name that you specify is fully qualified.
3286
- * This means that Route 53 treats www.example.com (without a trailing dot) and www.example.com. (with a trailing dot) as identical.
3287
- */
3288
- name: DomainNameSchema.optional(),
3289
- /** The DNS record type. */
3290
- type: z15.enum(["A", "AAAA", "CAA", "CNAME", "DS", "MX", "NAPTR", "NS", "PTR", "SOA", "SPF", "SRV", "TXT"]),
3291
- /** The resource record cache time to live (TTL). */
3292
- ttl: DurationSchema,
3293
- /** One or more values that correspond with the value that you specified for the Type property. */
3294
- records: z15.string().array()
3295
- }).array()).optional()
3314
+ domains: z16.record(
3315
+ DomainNameSchema,
3316
+ z16.object({
3317
+ /** Enter a fully qualified domain name, for example, www.example.com.
3318
+ * You can optionally include a trailing dot.
3319
+ * If you omit the trailing dot, Amazon Route 53 assumes that the domain name that you specify is fully qualified.
3320
+ * This means that Route 53 treats www.example.com (without a trailing dot) and www.example.com. (with a trailing dot) as identical.
3321
+ */
3322
+ name: DomainNameSchema.optional(),
3323
+ /** The DNS record type. */
3324
+ type: z16.enum([
3325
+ "A",
3326
+ "AAAA",
3327
+ "CAA",
3328
+ "CNAME",
3329
+ "DS",
3330
+ "MX",
3331
+ "NAPTR",
3332
+ "NS",
3333
+ "PTR",
3334
+ "SOA",
3335
+ "SPF",
3336
+ "SRV",
3337
+ "TXT"
3338
+ ]),
3339
+ /** The resource record cache time to live (TTL). */
3340
+ ttl: DurationSchema,
3341
+ /** One or more values that correspond with the value that you specified for the Type property. */
3342
+ records: z16.string().array()
3343
+ }).array()
3344
+ ).optional()
3296
3345
  }).default({})
3297
3346
  }),
3298
3347
  onApp({ config, bootstrap: bootstrap2, usEastBootstrap }) {
@@ -3304,10 +3353,7 @@ var domainPlugin = definePlugin({
3304
3353
  name: `${config.name}-delete-hosted-zone`,
3305
3354
  code: Code.fromInlineFeature("delete-hosted-zone")
3306
3355
  }).enableLogs(Duration.days(3)).addPermissions({
3307
- actions: [
3308
- "route53:ListResourceRecordSets",
3309
- "route53:ChangeResourceRecordSets"
3310
- ],
3356
+ actions: ["route53:ListResourceRecordSets", "route53:ChangeResourceRecordSets"],
3311
3357
  resources: ["*"]
3312
3358
  });
3313
3359
  usEastBootstrap.add(deleteHostedZoneLambda);
@@ -3345,11 +3391,11 @@ var domainPlugin = definePlugin({
3345
3391
  });
3346
3392
 
3347
3393
  // src/plugins/on-failure/index.ts
3348
- import { z as z16 } from "zod";
3394
+ import { z as z17 } from "zod";
3349
3395
  var onFailurePlugin = definePlugin({
3350
3396
  name: "on-failure",
3351
- schema: z16.object({
3352
- stacks: z16.object({
3397
+ schema: z17.object({
3398
+ stacks: z17.object({
3353
3399
  /** Defining a onFailure handler will add a global onFailure handler for the following resources:
3354
3400
  * - Async lambda functions
3355
3401
  * - SQS queues
@@ -3383,12 +3429,7 @@ var onFailurePlugin = definePlugin({
3383
3429
  queueArn
3384
3430
  });
3385
3431
  lambda.addPermissions({
3386
- actions: [
3387
- "sqs:SendMessage",
3388
- "sqs:ReceiveMessage",
3389
- "sqs:GetQueueUrl",
3390
- "sqs:GetQueueAttributes"
3391
- ],
3432
+ actions: ["sqs:SendMessage", "sqs:ReceiveMessage", "sqs:GetQueueUrl", "sqs:GetQueueAttributes"],
3392
3433
  resources: [queueArn]
3393
3434
  });
3394
3435
  stack.add(lambda, source);
@@ -3586,14 +3627,7 @@ var vpcPlugin = definePlugin({
3586
3627
  }).dependsOn(gateway, publicRouteTable);
3587
3628
  bootstrap2.export("vpc-security-group-id", vpc.defaultSecurityGroup);
3588
3629
  bootstrap2.export(`vpc-id`, vpc.id);
3589
- bootstrap2.add(
3590
- vpc,
3591
- privateRouteTable,
3592
- publicRouteTable,
3593
- gateway,
3594
- attachment,
3595
- route
3596
- );
3630
+ bootstrap2.add(vpc, privateRouteTable, publicRouteTable, gateway, attachment, route);
3597
3631
  const zones = ["a", "b"];
3598
3632
  const tables = [privateRouteTable, publicRouteTable];
3599
3633
  let block = 0;
@@ -3610,17 +3644,14 @@ var vpcPlugin = definePlugin({
3610
3644
  subnetId: subnet.id
3611
3645
  }).dependsOn(subnet, table);
3612
3646
  bootstrap2.export(`${table.name}-subnet-${Number(i) + 1}`, subnet.id);
3613
- bootstrap2.add(
3614
- subnet,
3615
- association
3616
- );
3647
+ bootstrap2.add(subnet, association);
3617
3648
  }
3618
3649
  }
3619
3650
  }
3620
3651
  });
3621
3652
 
3622
3653
  // src/plugins/http.ts
3623
- import { z as z17 } from "zod";
3654
+ import { z as z18 } from "zod";
3624
3655
 
3625
3656
  // src/formation/resource/ec2/security-group.ts
3626
3657
  var SecurityGroup = class extends Resource {
@@ -3960,8 +3991,8 @@ var ElbEventSource = class extends Group {
3960
3991
  };
3961
3992
 
3962
3993
  // src/plugins/http.ts
3963
- var RouteSchema = z17.custom((route) => {
3964
- return z17.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS)(\s\/[a-z0-9\+\_\-\/]*)$/ig).safeParse(route).success;
3994
+ var RouteSchema = z18.custom((route) => {
3995
+ return z18.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS)(\s\/[a-z0-9\+\_\-\/]*)$/ig).safeParse(route).success;
3965
3996
  }, "Invalid route");
3966
3997
  var parseRoute = (route) => {
3967
3998
  const [method, ...paths] = route.split(" ");
@@ -3979,8 +4010,8 @@ var generatePriority = (stackName, route) => {
3979
4010
  };
3980
4011
  var httpPlugin = definePlugin({
3981
4012
  name: "http",
3982
- schema: z17.object({
3983
- defaults: z17.object({
4013
+ schema: z18.object({
4014
+ defaults: z18.object({
3984
4015
  /** Define your global http api's.
3985
4016
  * @example
3986
4017
  * {
@@ -3992,17 +4023,17 @@ var httpPlugin = definePlugin({
3992
4023
  * }
3993
4024
  * }
3994
4025
  */
3995
- http: z17.record(
4026
+ http: z18.record(
3996
4027
  ResourceIdSchema,
3997
- z17.object({
4028
+ z18.object({
3998
4029
  /** The domain to link your api with. */
3999
- domain: z17.string(),
4000
- subDomain: z17.string().optional(),
4030
+ domain: z18.string(),
4031
+ subDomain: z18.string().optional(),
4001
4032
  auth: ResourceIdSchema.optional()
4002
4033
  })
4003
4034
  ).optional()
4004
4035
  }).default({}),
4005
- stacks: z17.object({
4036
+ stacks: z18.object({
4006
4037
  /** Define routes in your stack for your global http api.
4007
4038
  * @example
4008
4039
  * {
@@ -4014,9 +4045,9 @@ var httpPlugin = definePlugin({
4014
4045
  * }
4015
4046
  * }
4016
4047
  */
4017
- http: z17.record(
4048
+ http: z18.record(
4018
4049
  ResourceIdSchema,
4019
- z17.record(RouteSchema, FunctionSchema)
4050
+ z18.record(RouteSchema, FunctionSchema)
4020
4051
  ).optional()
4021
4052
  }).array()
4022
4053
  }),
@@ -4101,7 +4132,7 @@ var httpPlugin = definePlugin({
4101
4132
  });
4102
4133
 
4103
4134
  // src/plugins/search.ts
4104
- import { z as z18 } from "zod";
4135
+ import { z as z19 } from "zod";
4105
4136
 
4106
4137
  // src/formation/resource/open-search-serverless/collection.ts
4107
4138
  var Collection = class extends Resource {
@@ -4145,9 +4176,9 @@ var Collection = class extends Resource {
4145
4176
  // src/plugins/search.ts
4146
4177
  var searchPlugin = definePlugin({
4147
4178
  name: "search",
4148
- schema: z18.object({
4149
- stacks: z18.object({
4150
- searchs: z18.array(ResourceIdSchema).optional()
4179
+ schema: z19.object({
4180
+ stacks: z19.object({
4181
+ searchs: z19.array(ResourceIdSchema).optional()
4151
4182
  }).array()
4152
4183
  }),
4153
4184
  onTypeGen({ config }) {
@@ -4176,7 +4207,7 @@ var searchPlugin = definePlugin({
4176
4207
  });
4177
4208
 
4178
4209
  // src/plugins/cache.ts
4179
- import { z as z19 } from "zod";
4210
+ import { z as z20 } from "zod";
4180
4211
 
4181
4212
  // src/formation/resource/memorydb/cluster.ts
4182
4213
  var Cluster = class extends Resource {
@@ -4244,7 +4275,7 @@ var SubnetGroup = class extends Resource {
4244
4275
 
4245
4276
  // src/plugins/cache.ts
4246
4277
  import { constantCase as constantCase8 } from "change-case";
4247
- var TypeSchema = z19.enum([
4278
+ var TypeSchema = z20.enum([
4248
4279
  "t4g.small",
4249
4280
  "t4g.medium",
4250
4281
  "r6g.large",
@@ -4259,14 +4290,14 @@ var TypeSchema = z19.enum([
4259
4290
  "r6gd.4xlarge",
4260
4291
  "r6gd.8xlarge"
4261
4292
  ]);
4262
- var PortSchema = z19.number().int().min(1).max(5e4);
4263
- var ShardsSchema = z19.number().int().min(0).max(100);
4264
- var ReplicasPerShardSchema = z19.number().int().min(0).max(5);
4265
- var EngineSchema = z19.enum(["7.0", "6.2"]);
4293
+ var PortSchema = z20.number().int().min(1).max(5e4);
4294
+ var ShardsSchema = z20.number().int().min(0).max(100);
4295
+ var ReplicasPerShardSchema = z20.number().int().min(0).max(5);
4296
+ var EngineSchema = z20.enum(["7.0", "6.2"]);
4266
4297
  var cachePlugin = definePlugin({
4267
4298
  name: "cache",
4268
- schema: z19.object({
4269
- stacks: z19.object({
4299
+ schema: z20.object({
4300
+ stacks: z20.object({
4270
4301
  /** Define the caches in your stack.
4271
4302
  * For access to the cache put your functions inside the global VPC.
4272
4303
  * @example
@@ -4278,15 +4309,15 @@ var cachePlugin = definePlugin({
4278
4309
  * }
4279
4310
  * }
4280
4311
  */
4281
- caches: z19.record(
4312
+ caches: z20.record(
4282
4313
  ResourceIdSchema,
4283
- z19.object({
4314
+ z20.object({
4284
4315
  type: TypeSchema.default("t4g.small"),
4285
4316
  port: PortSchema.default(6379),
4286
4317
  shards: ShardsSchema.default(1),
4287
4318
  replicasPerShard: ReplicasPerShardSchema.default(1),
4288
4319
  engine: EngineSchema.default("7.0"),
4289
- dataTiering: z19.boolean().default(false)
4320
+ dataTiering: z20.boolean().default(false)
4290
4321
  })
4291
4322
  ).optional()
4292
4323
  }).array()
@@ -4307,10 +4338,7 @@ var cachePlugin = definePlugin({
4307
4338
  const name = `${config.name}-${stack.name}-${id}`;
4308
4339
  const subnetGroup = new SubnetGroup(id, {
4309
4340
  name,
4310
- subnetIds: [
4311
- bootstrap2.import(`private-subnet-1`),
4312
- bootstrap2.import(`private-subnet-2`)
4313
- ]
4341
+ subnetIds: [bootstrap2.import(`private-subnet-1`), bootstrap2.import(`private-subnet-2`)]
4314
4342
  });
4315
4343
  const securityGroup = new SecurityGroup(id, {
4316
4344
  name,
@@ -4329,19 +4357,22 @@ var cachePlugin = definePlugin({
4329
4357
  }).dependsOn(subnetGroup, securityGroup);
4330
4358
  stack.add(subnetGroup, securityGroup, cluster);
4331
4359
  bind((lambda) => {
4332
- lambda.addEnvironment(`CACHE_${constantCase8(stack.name)}_${constantCase8(id)}_HOST`, cluster.address).addEnvironment(`CACHE_${constantCase8(stack.name)}_${constantCase8(id)}_PORT`, props.port.toString());
4360
+ lambda.addEnvironment(`CACHE_${constantCase8(stack.name)}_${constantCase8(id)}_HOST`, cluster.address).addEnvironment(
4361
+ `CACHE_${constantCase8(stack.name)}_${constantCase8(id)}_PORT`,
4362
+ props.port.toString()
4363
+ );
4333
4364
  });
4334
4365
  }
4335
4366
  }
4336
4367
  });
4337
4368
 
4338
4369
  // src/plugins/rest.ts
4339
- import { z as z21 } from "zod";
4370
+ import { z as z22 } from "zod";
4340
4371
 
4341
4372
  // src/schema/route.ts
4342
- import { z as z20 } from "zod";
4343
- var RouteSchema2 = z20.custom((route) => {
4344
- return z20.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/ig).safeParse(route).success;
4373
+ import { z as z21 } from "zod";
4374
+ var RouteSchema2 = z21.custom((route) => {
4375
+ return z21.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/ig).safeParse(route).success;
4345
4376
  }, "Invalid route");
4346
4377
 
4347
4378
  // src/formation/resource/api-gateway-v2/api.ts
@@ -4507,8 +4538,8 @@ var ApiMapping = class extends Resource {
4507
4538
  // src/plugins/rest.ts
4508
4539
  var restPlugin = definePlugin({
4509
4540
  name: "rest",
4510
- schema: z21.object({
4511
- defaults: z21.object({
4541
+ schema: z22.object({
4542
+ defaults: z22.object({
4512
4543
  /** Define your global REST API's.
4513
4544
  * @example
4514
4545
  * {
@@ -4520,16 +4551,16 @@ var restPlugin = definePlugin({
4520
4551
  * }
4521
4552
  * }
4522
4553
  */
4523
- rest: z21.record(
4554
+ rest: z22.record(
4524
4555
  ResourceIdSchema,
4525
- z21.object({
4556
+ z22.object({
4526
4557
  /** The domain to link your API with. */
4527
- domain: z21.string(),
4528
- subDomain: z21.string().optional()
4558
+ domain: z22.string(),
4559
+ subDomain: z22.string().optional()
4529
4560
  })
4530
4561
  ).optional()
4531
4562
  }).default({}),
4532
- stacks: z21.object({
4563
+ stacks: z22.object({
4533
4564
  /** Define routes in your stack for your global REST API.
4534
4565
  * @example
4535
4566
  * {
@@ -4541,9 +4572,9 @@ var restPlugin = definePlugin({
4541
4572
  * }
4542
4573
  * }
4543
4574
  */
4544
- rest: z21.record(
4575
+ rest: z22.record(
4545
4576
  ResourceIdSchema,
4546
- z21.record(RouteSchema2, FunctionSchema)
4577
+ z22.record(RouteSchema2, FunctionSchema)
4547
4578
  ).optional()
4548
4579
  }).array()
4549
4580
  }),
@@ -4600,7 +4631,7 @@ var restPlugin = definePlugin({
4600
4631
  });
4601
4632
 
4602
4633
  // src/plugins/config.ts
4603
- import { z as z22 } from "zod";
4634
+ import { z as z23 } from "zod";
4604
4635
 
4605
4636
  // src/util/param.ts
4606
4637
  import { DeleteParameterCommand, GetParameterCommand, GetParametersByPathCommand, ParameterType, PutParameterCommand, SSMClient } from "@aws-sdk/client-ssm";
@@ -4688,11 +4719,11 @@ var Params = class {
4688
4719
 
4689
4720
  // src/plugins/config.ts
4690
4721
  import { paramCase as paramCase5 } from "change-case";
4691
- var ConfigNameSchema = z22.string().regex(/[a-z0-9\-]/g, "Invalid config name");
4722
+ var ConfigNameSchema = z23.string().regex(/[a-z0-9\-]/g, "Invalid config name");
4692
4723
  var configPlugin = definePlugin({
4693
4724
  name: "config",
4694
- schema: z22.object({
4695
- stacks: z22.object({
4725
+ schema: z23.object({
4726
+ stacks: z23.object({
4696
4727
  /** Define the config values for your stack.
4697
4728
  * @example
4698
4729
  * ```
@@ -4709,7 +4740,7 @@ var configPlugin = definePlugin({
4709
4740
  * Config.YOUR_SECRET
4710
4741
  * ```
4711
4742
  */
4712
- configs: z22.array(ConfigNameSchema).optional()
4743
+ configs: z23.array(ConfigNameSchema).optional()
4713
4744
  }).array()
4714
4745
  }),
4715
4746
  onTypeGen({ config }) {
@@ -4727,11 +4758,7 @@ var configPlugin = definePlugin({
4727
4758
  if (configs && configs.length) {
4728
4759
  lambda.addEnvironment("CONFIG", configs.join(","));
4729
4760
  lambda.addPermissions({
4730
- actions: [
4731
- "ssm:GetParameter",
4732
- "ssm:GetParameters",
4733
- "ssm:GetParametersByPath"
4734
- ],
4761
+ actions: ["ssm:GetParameter", "ssm:GetParameters", "ssm:GetParametersByPath"],
4735
4762
  resources: configs.map((name) => {
4736
4763
  return formatArn({
4737
4764
  service: "ssm",
@@ -4747,7 +4774,7 @@ var configPlugin = definePlugin({
4747
4774
  });
4748
4775
 
4749
4776
  // src/plugins/site.ts
4750
- import { z as z24 } from "zod";
4777
+ import { z as z25 } from "zod";
4751
4778
 
4752
4779
  // src/formation/resource/cloud-front/distribution.ts
4753
4780
  var Distribution = class extends Resource {
@@ -4874,8 +4901,8 @@ var OriginGroup = class {
4874
4901
 
4875
4902
  // src/schema/local-directory.ts
4876
4903
  import { stat as stat2 } from "fs/promises";
4877
- import { z as z23 } from "zod";
4878
- var LocalDirectorySchema = z23.string().refine(async (path) => {
4904
+ import { z as z24 } from "zod";
4905
+ var LocalDirectorySchema = z24.string().refine(async (path) => {
4879
4906
  try {
4880
4907
  const s = await stat2(path);
4881
4908
  return s.isDirectory();
@@ -5151,9 +5178,9 @@ var ResponseHeadersPolicy = class extends Resource {
5151
5178
  };
5152
5179
 
5153
5180
  // src/plugins/site.ts
5154
- var ErrorResponseSchema = z24.union([
5155
- z24.string(),
5156
- z24.object({
5181
+ var ErrorResponseSchema = z25.union([
5182
+ z25.string(),
5183
+ z25.object({
5157
5184
  /** The path to the custom error page that you want to return to the viewer when your origin returns the HTTP status code specified.
5158
5185
  * @example ```
5159
5186
  * "/404.html"
@@ -5163,7 +5190,7 @@ var ErrorResponseSchema = z24.union([
5163
5190
  * If you store custom error pages on an HTTP server and the server starts to return 5xx errors,
5164
5191
  * CloudFront can't get the files that you want to return to viewers because the origin server is unavailable.
5165
5192
  */
5166
- path: z24.string(),
5193
+ path: z25.string(),
5167
5194
  /** The HTTP status code that you want CloudFront to return to the viewer along with the custom error page.
5168
5195
  * 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:
5169
5196
  * - 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.
@@ -5171,7 +5198,7 @@ var ErrorResponseSchema = z24.union([
5171
5198
  * - 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.
5172
5199
  * - You might want to return a 200 status code (OK) and static website so your customers don't know that your website is down.
5173
5200
  */
5174
- statusCode: z24.number().int().positive().optional(),
5201
+ statusCode: z25.number().int().positive().optional(),
5175
5202
  /** The minimum amount of time, that you want to cache the error response.
5176
5203
  * 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.
5177
5204
  * @example
@@ -5182,8 +5209,8 @@ var ErrorResponseSchema = z24.union([
5182
5209
  ]).optional();
5183
5210
  var sitePlugin = definePlugin({
5184
5211
  name: "site",
5185
- schema: z24.object({
5186
- stacks: z24.object({
5212
+ schema: z25.object({
5213
+ stacks: z25.object({
5187
5214
  /** Define the sites in your stack.
5188
5215
  * @example
5189
5216
  * {
@@ -5196,18 +5223,18 @@ var sitePlugin = definePlugin({
5196
5223
  * }
5197
5224
  * }
5198
5225
  */
5199
- sites: z24.record(
5226
+ sites: z25.record(
5200
5227
  ResourceIdSchema,
5201
- z24.object({
5228
+ z25.object({
5202
5229
  /** The domain to link your site with. */
5203
- domain: z24.string(),
5204
- subDomain: z24.string().optional(),
5230
+ domain: z25.string(),
5231
+ subDomain: z25.string().optional(),
5205
5232
  /** Specifies the path to the static files directory. */
5206
5233
  static: LocalDirectorySchema.optional(),
5207
5234
  /** Specifies the ssr file. */
5208
5235
  ssr: FunctionSchema.optional(),
5209
5236
  /** Customize the error responses for specific HTTP status codes. */
5210
- errors: z24.object({
5237
+ errors: z25.object({
5211
5238
  /** Customize a `400 Bad Request` response */
5212
5239
  400: ErrorResponseSchema,
5213
5240
  /** Customize a `403 Forbidden` response. */
@@ -5232,17 +5259,17 @@ var sitePlugin = definePlugin({
5232
5259
  504: ErrorResponseSchema
5233
5260
  }).optional(),
5234
5261
  /** Define the cors headers. */
5235
- cors: z24.object({
5236
- override: z24.boolean().default(false),
5262
+ cors: z25.object({
5263
+ override: z25.boolean().default(false),
5237
5264
  maxAge: DurationSchema.default("365 days"),
5238
- exposeHeaders: z24.string().array().optional(),
5239
- credentials: z24.boolean().default(false),
5240
- headers: z24.string().array().default(["*"]),
5241
- origins: z24.string().array().default(["*"]),
5242
- methods: z24.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
5265
+ exposeHeaders: z25.string().array().optional(),
5266
+ credentials: z25.boolean().default(false),
5267
+ headers: z25.string().array().default(["*"]),
5268
+ origins: z25.string().array().default(["*"]),
5269
+ methods: z25.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
5243
5270
  }).optional(),
5244
5271
  /** Define the cors headers. */
5245
- security: z24.object({
5272
+ security: z25.object({
5246
5273
  // contentSecurityPolicy: z.object({
5247
5274
  // override: z.boolean().default(false),
5248
5275
  // policy: z.string(),
@@ -5285,13 +5312,13 @@ var sitePlugin = definePlugin({
5285
5312
  // }
5286
5313
  }).optional(),
5287
5314
  /** Specifies the cookies, headers, and query values that CloudFront includes in the cache key. */
5288
- cache: z24.object({
5315
+ cache: z25.object({
5289
5316
  /** Specifies the cookies that CloudFront includes in the cache key. */
5290
- cookies: z24.string().array().optional(),
5317
+ cookies: z25.string().array().optional(),
5291
5318
  /** Specifies the headers that CloudFront includes in the cache key. */
5292
- headers: z24.string().array().optional(),
5319
+ headers: z25.string().array().optional(),
5293
5320
  /** Specifies the query values that CloudFront includes in the cache key. */
5294
- queries: z24.string().array().optional()
5321
+ queries: z25.string().array().optional()
5295
5322
  }).optional()
5296
5323
  })
5297
5324
  ).optional()
@@ -5492,17 +5519,13 @@ var featurePlugin = definePlugin({
5492
5519
  actions: ["cloudfront:*"],
5493
5520
  resources: ["*"]
5494
5521
  });
5495
- bootstrap2.add(
5496
- deleteBucketLambda,
5497
- uploadBucketAssetLambda,
5498
- invalidateCacheLambda
5499
- );
5522
+ bootstrap2.add(deleteBucketLambda, uploadBucketAssetLambda, invalidateCacheLambda);
5500
5523
  bootstrap2.export("feature-delete-bucket", deleteBucketLambda.arn).export("feature-upload-bucket-asset", uploadBucketAssetLambda.arn).export("feature-invalidate-cache", invalidateCacheLambda.arn);
5501
5524
  }
5502
5525
  });
5503
5526
 
5504
5527
  // src/plugins/auth.ts
5505
- import { z as z25 } from "zod";
5528
+ import { z as z26 } from "zod";
5506
5529
 
5507
5530
  // src/formation/resource/cognito/user-pool.ts
5508
5531
  import { constantCase as constantCase9 } from "change-case";
@@ -5726,7 +5749,7 @@ var UserPool = class extends Resource {
5726
5749
 
5727
5750
  // src/plugins/auth.ts
5728
5751
  import { constantCase as constantCase10 } from "change-case";
5729
- var TriggersSchema = z25.object({
5752
+ var TriggersSchema = z26.object({
5730
5753
  /** A pre jwt token generation AWS Lambda trigger. */
5731
5754
  beforeToken: FunctionSchema.optional(),
5732
5755
  /** A pre user login AWS Lambda trigger. */
@@ -5748,8 +5771,8 @@ var TriggersSchema = z25.object({
5748
5771
  });
5749
5772
  var authPlugin = definePlugin({
5750
5773
  name: "auth",
5751
- schema: z25.object({
5752
- defaults: z25.object({
5774
+ schema: z26.object({
5775
+ defaults: z26.object({
5753
5776
  /** Define the authenticatable users in your app.
5754
5777
  * @example
5755
5778
  * {
@@ -5765,48 +5788,48 @@ var authPlugin = definePlugin({
5765
5788
  * }
5766
5789
  * }
5767
5790
  */
5768
- auth: z25.record(
5791
+ auth: z26.record(
5769
5792
  ResourceIdSchema,
5770
- z25.object({
5793
+ z26.object({
5771
5794
  /** Specifies whether users can create an user account or if only the administrator can.
5772
5795
  * @default true
5773
5796
  */
5774
- allowUserRegistration: z25.boolean().default(true),
5797
+ allowUserRegistration: z26.boolean().default(true),
5775
5798
  /** The username policy. */
5776
- username: z25.object({
5799
+ username: z26.object({
5777
5800
  /** Allow the user email to be used as username.
5778
5801
  * @default true
5779
5802
  */
5780
- emailAlias: z25.boolean().default(true),
5803
+ emailAlias: z26.boolean().default(true),
5781
5804
  /** Specifies whether username case sensitivity will be enabled.
5782
5805
  * When usernames and email addresses are case insensitive,
5783
5806
  * users can sign in as the same user when they enter a different capitalization of their user name.
5784
5807
  * @default false
5785
5808
  */
5786
- caseSensitive: z25.boolean().default(false)
5809
+ caseSensitive: z26.boolean().default(false)
5787
5810
  }).default({}),
5788
5811
  /** The password policy. */
5789
- password: z25.object({
5812
+ password: z26.object({
5790
5813
  /** Required users to have at least the minimum password length.
5791
5814
  * @default 8
5792
5815
  */
5793
- minLength: z25.number().int().min(6).max(99).default(8),
5816
+ minLength: z26.number().int().min(6).max(99).default(8),
5794
5817
  /** Required users to use at least one uppercase letter in their password.
5795
5818
  * @default true
5796
5819
  */
5797
- uppercase: z25.boolean().default(true),
5820
+ uppercase: z26.boolean().default(true),
5798
5821
  /** Required users to use at least one lowercase letter in their password.
5799
5822
  * @default true
5800
5823
  */
5801
- lowercase: z25.boolean().default(true),
5824
+ lowercase: z26.boolean().default(true),
5802
5825
  /** Required users to use at least one number in their password.
5803
5826
  * @default true
5804
5827
  */
5805
- numbers: z25.boolean().default(true),
5828
+ numbers: z26.boolean().default(true),
5806
5829
  /** Required users to use at least one symbol in their password.
5807
5830
  * @default true
5808
5831
  */
5809
- symbols: z25.boolean().default(true),
5832
+ symbols: z26.boolean().default(true),
5810
5833
  /** The duration a temporary password is valid.
5811
5834
  * If the user doesn't sign in during this time, an administrator must reset their password.
5812
5835
  * @default '7 days'
@@ -5814,7 +5837,7 @@ var authPlugin = definePlugin({
5814
5837
  temporaryPasswordValidity: DurationSchema.default("7 days")
5815
5838
  }).default({}),
5816
5839
  /** Specifies the validity duration for every JWT token. */
5817
- validity: z25.object({
5840
+ validity: z26.object({
5818
5841
  /** The ID token time limit.
5819
5842
  * After this limit expires, your user can't use their ID token.
5820
5843
  * @default '1 hour'
@@ -5836,7 +5859,7 @@ var authPlugin = definePlugin({
5836
5859
  })
5837
5860
  ).default({})
5838
5861
  }).default({}),
5839
- stacks: z25.object({
5862
+ stacks: z26.object({
5840
5863
  /** Define the auth triggers in your stack.
5841
5864
  * @example
5842
5865
  * {
@@ -5849,13 +5872,13 @@ var authPlugin = definePlugin({
5849
5872
  * }
5850
5873
  * }
5851
5874
  */
5852
- auth: z25.record(
5875
+ auth: z26.record(
5853
5876
  ResourceIdSchema,
5854
- z25.object({
5877
+ z26.object({
5855
5878
  /** Give access to every function in this stack to your cognito instance.
5856
5879
  * @default false
5857
5880
  */
5858
- access: z25.boolean().default(false),
5881
+ access: z26.boolean().default(false),
5859
5882
  /** Specifies the configuration for AWS Lambda triggers. */
5860
5883
  triggers: TriggersSchema.optional()
5861
5884
  })
@@ -5958,6 +5981,7 @@ var defaultPlugins = [
5958
5981
  queuePlugin,
5959
5982
  tablePlugin,
5960
5983
  storePlugin,
5984
+ // alertPlugin,
5961
5985
  topicPlugin,
5962
5986
  pubsubPlugin,
5963
5987
  searchPlugin,
@@ -6118,17 +6142,17 @@ var getCredentials = (profile) => {
6118
6142
  };
6119
6143
 
6120
6144
  // src/schema/app.ts
6121
- import { z as z29 } from "zod";
6145
+ import { z as z30 } from "zod";
6122
6146
 
6123
6147
  // src/schema/stack.ts
6124
- import { z as z26 } from "zod";
6125
- var StackSchema = z26.object({
6148
+ import { z as z27 } from "zod";
6149
+ var StackSchema = z27.object({
6126
6150
  name: ResourceIdSchema,
6127
- depends: z26.array(z26.lazy(() => StackSchema)).optional()
6151
+ depends: z27.array(z27.lazy(() => StackSchema)).optional()
6128
6152
  });
6129
6153
 
6130
6154
  // src/schema/region.ts
6131
- import { z as z27 } from "zod";
6155
+ import { z as z28 } from "zod";
6132
6156
  var US = ["us-east-2", "us-east-1", "us-west-1", "us-west-2"];
6133
6157
  var AF = ["af-south-1"];
6134
6158
  var AP = ["ap-east-1", "ap-south-2", "ap-southeast-3", "ap-southeast-4", "ap-south-1", "ap-northeast-3", "ap-northeast-2", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1"];
@@ -6145,41 +6169,41 @@ var regions = [
6145
6169
  ...ME,
6146
6170
  ...SA
6147
6171
  ];
6148
- var RegionSchema = z27.enum(regions);
6172
+ var RegionSchema = z28.enum(regions);
6149
6173
 
6150
6174
  // src/schema/plugin.ts
6151
- import { z as z28 } from "zod";
6152
- var PluginSchema = z28.object({
6153
- name: z28.string(),
6154
- schema: z28.custom().optional(),
6175
+ import { z as z29 } from "zod";
6176
+ var PluginSchema = z29.object({
6177
+ name: z29.string(),
6178
+ schema: z29.custom().optional(),
6155
6179
  // depends: z.array(z.lazy(() => PluginSchema)).optional(),
6156
- onApp: z28.function().returns(z28.void()).optional(),
6157
- onStack: z28.function().returns(z28.any()).optional(),
6158
- onResource: z28.function().returns(z28.any()).optional()
6180
+ onApp: z29.function().returns(z29.void()).optional(),
6181
+ onStack: z29.function().returns(z29.any()).optional(),
6182
+ onResource: z29.function().returns(z29.any()).optional()
6159
6183
  // bind: z.function().optional(),
6160
6184
  });
6161
6185
 
6162
6186
  // src/schema/app.ts
6163
- var AppSchema = z29.object({
6187
+ var AppSchema = z30.object({
6164
6188
  /** App name */
6165
6189
  name: ResourceIdSchema,
6166
6190
  /** The AWS region to deploy to. */
6167
6191
  region: RegionSchema,
6168
6192
  /** The AWS profile to deploy to. */
6169
- profile: z29.string(),
6193
+ profile: z30.string(),
6170
6194
  /** The deployment stage.
6171
6195
  * @default 'prod'
6172
6196
  */
6173
- stage: z29.string().regex(/^[a-z]+$/).default("prod"),
6197
+ stage: z30.string().regex(/^[a-z]+$/).default("prod"),
6174
6198
  /** Default properties. */
6175
- defaults: z29.object({}).default({}),
6199
+ defaults: z30.object({}).default({}),
6176
6200
  /** The application stacks. */
6177
- stacks: z29.array(StackSchema).min(1).refine((stacks) => {
6201
+ stacks: z30.array(StackSchema).min(1).refine((stacks) => {
6178
6202
  const unique = new Set(stacks.map((stack) => stack.name));
6179
6203
  return unique.size === stacks.length;
6180
6204
  }, "Must be an array of unique stacks"),
6181
6205
  /** Custom plugins. */
6182
- plugins: z29.array(PluginSchema).optional()
6206
+ plugins: z30.array(PluginSchema).optional()
6183
6207
  });
6184
6208
 
6185
6209
  // src/util/import.ts
@@ -6197,7 +6221,8 @@ var importFile = async (path) => {
6197
6221
  },
6198
6222
  plugins: [
6199
6223
  replace({
6200
- __dirname: (id) => `'${dirname2(id)}'`
6224
+ __dirname: (id) => `'${dirname2(id)}'`,
6225
+ "defineStackConfig({": (id) => `defineStackConfig({ cwd: '${dirname2(id)}',`
6201
6226
  }),
6202
6227
  swc2({
6203
6228
  minify: false,
@@ -6220,63 +6245,67 @@ var importFile = async (path) => {
6220
6245
  return import(outputFile);
6221
6246
  };
6222
6247
  var watchFile = (path) => {
6223
- return new EventIterator((queue2) => {
6224
- const watcher = watch({
6225
- watch: {
6226
- skipWrite: true
6227
- },
6228
- input: path,
6229
- onwarn: (error) => {
6230
- debugError(error.message);
6231
- },
6232
- plugins: [
6233
- replace({
6234
- __dirname: (id) => `'${dirname2(id)}'`
6235
- }),
6236
- swc2({
6237
- minify: false,
6238
- jsc: {
6239
- baseUrl: dirname2(path)
6240
- }
6241
- })
6242
- ]
6243
- });
6244
- let resume;
6245
- queue2.on("lowWater", () => {
6246
- resume?.(true);
6247
- });
6248
- watcher.on("close", queue2.stop);
6249
- watcher.on("event", async (event) => {
6250
- if (event.code === "ERROR") {
6251
- queue2.fail(new Error(event.error.message));
6252
- }
6253
- if (event.code === "BUNDLE_END") {
6254
- const result = await event.result.generate({
6255
- format: "esm",
6256
- exports: "default"
6257
- });
6258
- event.result.close();
6259
- const output = result.output[0];
6260
- const code = output.code;
6261
- const outputFile = join5(directories.cache, "config.js");
6262
- await mkdir2(directories.cache, { recursive: true });
6263
- await writeFile2(outputFile, code);
6264
- debug("Save config file:", style.info(outputFile));
6265
- const config = await import(`${outputFile}?${Date.now()}`);
6266
- queue2.push(config);
6267
- }
6268
- });
6269
- return () => {
6270
- watcher.close();
6271
- };
6272
- }, {
6273
- highWaterMark: 1,
6274
- lowWaterMark: 0
6275
- });
6248
+ return new EventIterator(
6249
+ (queue2) => {
6250
+ const watcher = watch({
6251
+ watch: {
6252
+ skipWrite: true
6253
+ },
6254
+ input: path,
6255
+ onwarn: (error) => {
6256
+ debugError(error.message);
6257
+ },
6258
+ plugins: [
6259
+ replace({
6260
+ __dirname: (id) => `'${dirname2(id)}'`,
6261
+ "defineStackConfig({": (id) => `defineStackConfig({ cwd: '${dirname2(id)}',`
6262
+ }),
6263
+ swc2({
6264
+ minify: false,
6265
+ jsc: {
6266
+ baseUrl: dirname2(path)
6267
+ }
6268
+ })
6269
+ ]
6270
+ });
6271
+ let resume;
6272
+ queue2.on("lowWater", () => {
6273
+ resume?.(true);
6274
+ });
6275
+ watcher.on("close", queue2.stop);
6276
+ watcher.on("event", async (event) => {
6277
+ if (event.code === "ERROR") {
6278
+ queue2.fail(new Error(event.error.message));
6279
+ }
6280
+ if (event.code === "BUNDLE_END") {
6281
+ const result = await event.result.generate({
6282
+ format: "esm",
6283
+ exports: "default"
6284
+ });
6285
+ event.result.close();
6286
+ const output = result.output[0];
6287
+ const code = output.code;
6288
+ const outputFile = join5(directories.cache, "config.js");
6289
+ await mkdir2(directories.cache, { recursive: true });
6290
+ await writeFile2(outputFile, code);
6291
+ debug("Save config file:", style.info(outputFile));
6292
+ const config = await import(`${outputFile}?${Date.now()}`);
6293
+ queue2.push(config);
6294
+ }
6295
+ });
6296
+ return () => {
6297
+ watcher.close();
6298
+ };
6299
+ },
6300
+ {
6301
+ highWaterMark: 1,
6302
+ lowWaterMark: 0
6303
+ }
6304
+ );
6276
6305
  };
6277
6306
 
6278
6307
  // src/config.ts
6279
- import { z as z30 } from "zod";
6308
+ import { z as z31 } from "zod";
6280
6309
  var ConfigError = class extends Error {
6281
6310
  constructor(error, data) {
6282
6311
  super(error.message);
@@ -6309,7 +6338,7 @@ var importConfig = async (options) => {
6309
6338
  try {
6310
6339
  config = await schema2.parseAsync(appConfig);
6311
6340
  } catch (error) {
6312
- if (error instanceof z30.ZodError) {
6341
+ if (error instanceof z31.ZodError) {
6313
6342
  throw new ConfigError(error, appConfig);
6314
6343
  }
6315
6344
  throw error;
@@ -6350,7 +6379,7 @@ var watchConfig = async (options, resolve, reject) => {
6350
6379
  try {
6351
6380
  config = await schema2.parseAsync(appConfig);
6352
6381
  } catch (error) {
6353
- if (error instanceof z30.ZodError) {
6382
+ if (error instanceof z31.ZodError) {
6354
6383
  reject(new ConfigError(error, appConfig));
6355
6384
  continue;
6356
6385
  }
package/dist/index.d.ts CHANGED
@@ -2329,7 +2329,7 @@ declare const defaultPlugins: (Plugin<zod.ZodObject<{
2329
2329
  }>> | Plugin<zod.ZodObject<{
2330
2330
  stacks: zod.ZodEffects<zod.ZodArray<zod.ZodObject<{
2331
2331
  topics: zod.ZodOptional<zod.ZodEffects<zod.ZodArray<zod.ZodEffects<zod.ZodString, string, string>, "many">, string[], string[]>>;
2332
- subscribers: zod.ZodOptional<zod.ZodRecord<zod.ZodEffects<zod.ZodString, string, string>, zod.ZodUnion<[zod.ZodEffects<zod.ZodString, string, string>, zod.ZodObject<{
2332
+ subscribers: zod.ZodOptional<zod.ZodRecord<zod.ZodEffects<zod.ZodString, string, string>, zod.ZodUnion<[zod.ZodType<`${string}@${string}.${string}`, zod.ZodTypeDef, `${string}@${string}.${string}`>, zod.ZodUnion<[zod.ZodEffects<zod.ZodString, string, string>, zod.ZodObject<{
2333
2333
  file: zod.ZodEffects<zod.ZodString, string, string>;
2334
2334
  handler: zod.ZodOptional<zod.ZodString>;
2335
2335
  minify: zod.ZodOptional<zod.ZodBoolean>;
@@ -2417,7 +2417,7 @@ declare const defaultPlugins: (Plugin<zod.ZodObject<{
2417
2417
  resources: string[];
2418
2418
  effect?: "allow" | "deny" | undefined;
2419
2419
  }[] | undefined;
2420
- }>]>>>;
2420
+ }>]>]>>>;
2421
2421
  }, "strip", zod.ZodTypeAny, {
2422
2422
  topics?: string[] | undefined;
2423
2423
  subscribers?: Record<string, string | {
@@ -10962,7 +10962,7 @@ declare const defaultPlugins: (Plugin<zod.ZodObject<{
10962
10962
  } | undefined;
10963
10963
  }[];
10964
10964
  }>>)[];
10965
- type CombinedDefaultPluginsConfigInput = ExtendedConfigInput<typeof defaultPlugins[number]['schema']>;
10965
+ type CombinedDefaultPluginsConfigInput = ExtendedConfigInput<(typeof defaultPlugins)[number]['schema']>;
10966
10966
 
10967
10967
  type BaseConfig = AppConfigOutput & {
10968
10968
  account: string;
@@ -11132,11 +11132,17 @@ declare const getFunctionName: <S extends string, N extends string>(stack: S, na
11132
11132
  interface FunctionResources {
11133
11133
  }
11134
11134
  declare const Function: FunctionResources;
11135
+ declare const Fn: FunctionResources;
11135
11136
 
11136
11137
  declare const getAuthName: <N extends string>(name: N) => `app-${N}`;
11137
11138
  interface AuthResources {
11138
11139
  }
11139
11140
  declare const Auth: AuthResources;
11141
+ declare const getAuthProps: (name: string) => {
11142
+ readonly name: `app-${string}`;
11143
+ readonly userPoolId: string;
11144
+ readonly clientId: string;
11145
+ };
11140
11146
 
11141
11147
  declare const getTableName: <N extends string, S extends string = "stack">(name: N, stack?: S) => `app-${S}-${N}`;
11142
11148
  interface TableResources {
@@ -11977,4 +11983,4 @@ declare const defineStackConfig: (config: StackConfig) => StackConfig$1 | (Stack
11977
11983
  });
11978
11984
  declare const defineAppConfig: (config: AppConfig | AppConfigFactory<AppConfig>) => CombinedDefaultPluginsConfigInput | AppConfigFactory<CombinedDefaultPluginsConfigInput>;
11979
11985
 
11980
- export { APP, AppConfig, Auth, AuthResources, Cache, CacheResources, Config, ConfigResources, Function, FunctionResources, Plugin, Queue, QueueResources, STACK, Search, SearchResources, StackConfig, Store, StoreResources, Table, TableResources, Topic, TopicResources, defineAppConfig, definePlugin, defineStackConfig, getAuthName, getCacheProps, getConfigName, getFunctionName, getGlobalResourceName, getLocalResourceName, getQueueName, getSearchName, getStoreName, getTableName, getTopicName };
11986
+ export { APP, AppConfig, Auth, AuthResources, Cache, CacheResources, Config, ConfigResources, Fn, Function, FunctionResources, Plugin, Queue, QueueResources, STACK, Search, SearchResources, StackConfig, Store, StoreResources, Table, TableResources, Topic, TopicResources, defineAppConfig, definePlugin, defineStackConfig, getAuthName, getAuthProps, getCacheProps, getConfigName, getFunctionName, getGlobalResourceName, getLocalResourceName, getQueueName, getSearchName, getStoreName, getTableName, getTopicName };
package/dist/index.js CHANGED
@@ -58,6 +58,7 @@ var Function = /* @__PURE__ */ createProxy((stackName) => {
58
58
  return call;
59
59
  });
60
60
  });
61
+ var Fn = Function;
61
62
 
62
63
  // src/node/auth.ts
63
64
  import { constantCase } from "change-case";
@@ -86,18 +87,18 @@ var Table = /* @__PURE__ */ createProxy((stack) => {
86
87
  // src/node/topic.ts
87
88
  import { publish } from "@awsless/sns";
88
89
  var getTopicName = getGlobalResourceName;
89
- var Topic = /* @__PURE__ */ createProxy((topic) => {
90
- const name = getTopicName(topic);
90
+ var Topic = /* @__PURE__ */ createProxy((name) => {
91
+ const topic = getTopicName(name);
91
92
  const ctx = {
92
- [name]: (payload, options = {}) => {
93
- return publish({
93
+ [topic]: async (payload, options = {}) => {
94
+ await publish({
94
95
  ...options,
95
- topic: name,
96
+ topic,
96
97
  payload
97
98
  });
98
99
  }
99
100
  };
100
- const call = ctx[name];
101
+ const call = ctx[topic];
101
102
  return call;
102
103
  });
103
104
 
@@ -232,6 +233,7 @@ export {
232
233
  Auth,
233
234
  Cache,
234
235
  Config,
236
+ Fn,
235
237
  Function,
236
238
  Queue,
237
239
  STACK,
@@ -243,6 +245,7 @@ export {
243
245
  definePlugin,
244
246
  defineStackConfig,
245
247
  getAuthName,
248
+ getAuthProps,
246
249
  getCacheProps,
247
250
  getConfigName,
248
251
  getFunctionName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/awsless",
3
- "version": "0.0.83",
3
+ "version": "0.0.85",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,