@awsless/awsless 0.0.421 → 0.0.423

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.js CHANGED
@@ -596,9 +596,9 @@ var require_Alias = __commonJS({
596
596
  var anchors = require_anchors();
597
597
  var visit = require_visit();
598
598
  var identity = require_identity();
599
- var Node26 = require_Node();
599
+ var Node27 = require_Node();
600
600
  var toJS = require_toJS();
601
- var Alias = class extends Node26.NodeBase {
601
+ var Alias = class extends Node27.NodeBase {
602
602
  constructor(source) {
603
603
  super(identity.ALIAS);
604
604
  this.source = source;
@@ -696,10 +696,10 @@ var require_Scalar = __commonJS({
696
696
  "../../node_modules/.pnpm/yaml@2.5.0/node_modules/yaml/dist/nodes/Scalar.js"(exports) {
697
697
  "use strict";
698
698
  var identity = require_identity();
699
- var Node26 = require_Node();
699
+ var Node27 = require_Node();
700
700
  var toJS = require_toJS();
701
701
  var isScalarValue = (value) => !value || typeof value !== "function" && typeof value !== "object";
702
- var Scalar = class extends Node26.NodeBase {
702
+ var Scalar = class extends Node27.NodeBase {
703
703
  constructor(value) {
704
704
  super(identity.SCALAR);
705
705
  this.value = value;
@@ -803,7 +803,7 @@ var require_Collection = __commonJS({
803
803
  "use strict";
804
804
  var createNode = require_createNode();
805
805
  var identity = require_identity();
806
- var Node26 = require_Node();
806
+ var Node27 = require_Node();
807
807
  function collectionFromPath(schema, path, value) {
808
808
  let v = value;
809
809
  for (let i = path.length - 1; i >= 0; --i) {
@@ -827,7 +827,7 @@ var require_Collection = __commonJS({
827
827
  });
828
828
  }
829
829
  var isEmptyPath = (path) => path == null || typeof path === "object" && !!path[Symbol.iterator]().next().done;
830
- var Collection = class extends Node26.NodeBase {
830
+ var Collection = class extends Node27.NodeBase {
831
831
  constructor(type, schema) {
832
832
  super(type);
833
833
  Object.defineProperty(this, "schema", {
@@ -7566,7 +7566,7 @@ var debug = (...parts) => {
7566
7566
  };
7567
7567
 
7568
7568
  // src/config/app.ts
7569
- import { z as z23 } from "zod";
7569
+ import { z as z25 } from "zod";
7570
7570
 
7571
7571
  // src/feature/alert/schema.ts
7572
7572
  import { paramCase } from "change-case";
@@ -7617,8 +7617,8 @@ var durationMax = (max) => {
7617
7617
 
7618
7618
  // src/config/schema/local-file.ts
7619
7619
  import { stat } from "fs/promises";
7620
- import { z as z5 } from "zod";
7621
7620
  import { join as join3 } from "path";
7621
+ import { z as z5 } from "zod";
7622
7622
  var basePath;
7623
7623
  var setLocalBasePath = (path) => {
7624
7624
  basePath = path;
@@ -7733,8 +7733,9 @@ var LogSchema = z7.union([
7733
7733
  ).optional()
7734
7734
  })
7735
7735
  ]).describe("Enable logging to a CloudWatch log group. Providing a duration value will set the log retention time.");
7736
- var LayersSchema = ArnSchema.array().describe(
7737
- `A list of function layers to add to the function's execution environment. Specify each layer by its ARN, including the version.`
7736
+ var LayersSchema = ResourceIdSchema.array().describe(
7737
+ `A list of function layers to add to the function's execution environment.`
7738
+ // `A list of function layers to add to the function's execution environment. Specify each layer by its ARN, including the version.`
7738
7739
  );
7739
7740
  var BuildSchema = z7.object({
7740
7741
  minify: MinifySchema.default(true),
@@ -8011,34 +8012,58 @@ var InstancesSchema = z13.record(
8011
8012
  })
8012
8013
  ).optional().describe("Define the instances in your stack.");
8013
8014
 
8015
+ // src/feature/layer/schema.ts
8016
+ import { z as z15 } from "zod";
8017
+
8018
+ // src/config/schema/lambda.ts
8019
+ import { z as z14 } from "zod";
8020
+ var ArchitectureSchema2 = z14.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the function supports.");
8021
+ var NodeRuntimeSchema2 = z14.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x"]).describe("The identifier of the function's runtime.");
8022
+
8023
+ // src/feature/layer/schema.ts
8024
+ var LayerSchema = z15.record(
8025
+ ResourceIdSchema,
8026
+ z15.union([
8027
+ LocalFileSchema.transform((file) => ({
8028
+ file
8029
+ })),
8030
+ z15.object({
8031
+ file: LocalFileSchema,
8032
+ description: z15.string().optional().describe("A description of the lambda layer."),
8033
+ runtimes: NodeRuntimeSchema2.array().optional(),
8034
+ architectures: ArchitectureSchema2.array().optional()
8035
+ })
8036
+ ])
8037
+ ).optional().describe("Define the lambda layers in your stack.");
8038
+
8014
8039
  // src/feature/on-failure/schema.ts
8015
8040
  var OnFailureDefaultSchema = FunctionSchema.optional().describe(
8016
8041
  "Defining a onFailure handler will add a global onFailure handler for the following resources:\n- Async lambda functions\n- SQS queues\n- DynamoDB streams"
8017
8042
  );
8018
8043
 
8019
8044
  // src/feature/on-log/schema.ts
8020
- import { z as z14 } from "zod";
8021
- var FilterSchema = z14.enum(["trace", "debug", "info", "warn", "error", "fatal"]).array().describe("The log level that will gets delivered to the consumer.");
8022
- var OnLogDefaultSchema = z14.union([
8045
+ import { z as z16 } from "zod";
8046
+ var FilterSchema = z16.enum(["trace", "debug", "info", "warn", "error", "fatal"]).array().describe("The log level that will gets delivered to the consumer.");
8047
+ var OnLogDefaultSchema = z16.union([
8023
8048
  FunctionSchema.transform((consumer) => ({
8024
8049
  consumer,
8025
8050
  filter: ["error", "fatal"]
8026
8051
  })),
8027
- z14.object({
8052
+ z16.object({
8028
8053
  consumer: FunctionSchema,
8029
8054
  filter: FilterSchema
8030
8055
  })
8031
8056
  ]).optional().describe("Define a subscription on all Lambda functions logs.");
8032
8057
 
8033
8058
  // src/feature/pubsub/schema.ts
8034
- import { z as z15 } from "zod";
8059
+ import { z as z17 } from "zod";
8035
8060
  var DomainSchema = ResourceIdSchema.describe("The domain id to link your Pubsub API with.");
8036
- var PubSubDefaultSchema = z15.record(
8061
+ var PubSubDefaultSchema = z17.record(
8037
8062
  ResourceIdSchema,
8038
- z15.object({
8063
+ z17.object({
8039
8064
  auth: FunctionSchema,
8040
8065
  domain: DomainSchema.optional(),
8041
- subDomain: z15.string().optional()
8066
+ subDomain: z17.string().optional()
8042
8067
  // auth: z.union([
8043
8068
  // ResourceIdSchema,
8044
8069
  // z.object({
@@ -8054,11 +8079,11 @@ var PubSubDefaultSchema = z15.record(
8054
8079
  // .optional(),
8055
8080
  })
8056
8081
  ).optional().describe("Define the pubsub subscriber in your stack.");
8057
- var PubSubSchema = z15.record(
8082
+ var PubSubSchema = z17.record(
8058
8083
  ResourceIdSchema,
8059
- z15.object({
8060
- sql: z15.string().describe("The SQL statement used to query the IOT topic."),
8061
- sqlVersion: z15.enum(["2015-10-08", "2016-03-23", "beta"]).default("2016-03-23").describe("The version of the SQL rules engine to use when evaluating the rule."),
8084
+ z17.object({
8085
+ sql: z17.string().describe("The SQL statement used to query the IOT topic."),
8086
+ sqlVersion: z17.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."),
8062
8087
  consumer: FunctionSchema.describe("The consuming lambda function properties.")
8063
8088
  })
8064
8089
  ).optional().describe("Define the pubsub subscriber in your stack.");
@@ -8066,7 +8091,7 @@ var PubSubSchema = z15.record(
8066
8091
  // src/feature/queue/schema.ts
8067
8092
  import { days as days2, hours, minutes as minutes3, seconds as seconds2 } from "@awsless/duration";
8068
8093
  import { kibibytes } from "@awsless/size";
8069
- import { z as z16 } from "zod";
8094
+ import { z as z18 } from "zod";
8070
8095
  var RetentionPeriodSchema = DurationSchema.refine(
8071
8096
  durationMin(minutes3(1)),
8072
8097
  "Minimum retention period is 1 minute"
@@ -8094,10 +8119,10 @@ var ReceiveMessageWaitTimeSchema = DurationSchema.refine(
8094
8119
  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(
8095
8120
  "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."
8096
8121
  );
8097
- var BatchSizeSchema = z16.number().int().min(1, "Minimum batch size is 1").max(1e4, "Maximum batch size is 10000").describe(
8122
+ var BatchSizeSchema = z18.number().int().min(1, "Minimum batch size is 1").max(1e4, "Maximum batch size is 10000").describe(
8098
8123
  "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."
8099
8124
  );
8100
- var MaxConcurrencySchema = z16.number().int().min(2, "Minimum max concurrency is 2").max(1e3, "Maximum max concurrency is 1000").describe(
8125
+ var MaxConcurrencySchema = z18.number().int().min(2, "Minimum max concurrency is 2").max(1e3, "Maximum max concurrency is 1000").describe(
8101
8126
  "Limits the number of concurrent instances that the queue worker can invoke. You can specify an integer from 2 to 1000."
8102
8127
  );
8103
8128
  var MaxBatchingWindow = DurationSchema.refine(
@@ -8106,7 +8131,7 @@ var MaxBatchingWindow = DurationSchema.refine(
8106
8131
  ).describe(
8107
8132
  "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."
8108
8133
  );
8109
- var QueueDefaultSchema = z16.object({
8134
+ var QueueDefaultSchema = z18.object({
8110
8135
  retentionPeriod: RetentionPeriodSchema.default("7 days"),
8111
8136
  visibilityTimeout: VisibilityTimeoutSchema.default("30 seconds"),
8112
8137
  deliveryDelay: DeliveryDelaySchema.default("0 seconds"),
@@ -8116,15 +8141,15 @@ var QueueDefaultSchema = z16.object({
8116
8141
  maxConcurrency: MaxConcurrencySchema.optional(),
8117
8142
  maxBatchingWindow: MaxBatchingWindow.optional()
8118
8143
  }).default({});
8119
- var QueuesSchema = z16.record(
8144
+ var QueuesSchema = z18.record(
8120
8145
  ResourceIdSchema,
8121
- z16.union([
8146
+ z18.union([
8122
8147
  LocalFileSchema.transform((file) => ({
8123
8148
  consumer: {
8124
8149
  file
8125
8150
  }
8126
8151
  })),
8127
- z16.object({
8152
+ z18.object({
8128
8153
  consumer: FunctionSchema.describe("The consuming lambda function properties."),
8129
8154
  retentionPeriod: RetentionPeriodSchema.optional(),
8130
8155
  visibilityTimeout: VisibilityTimeoutSchema.optional(),
@@ -8139,59 +8164,59 @@ var QueuesSchema = z16.record(
8139
8164
  ).optional().describe("Define the queues in your stack.");
8140
8165
 
8141
8166
  // src/feature/rest/schema.ts
8142
- import { z as z18 } from "zod";
8167
+ import { z as z20 } from "zod";
8143
8168
 
8144
8169
  // src/config/schema/route.ts
8145
- import { z as z17 } from "zod";
8146
- var RouteSchema2 = z17.union([
8147
- z17.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route"),
8148
- z17.literal("$default")
8170
+ import { z as z19 } from "zod";
8171
+ var RouteSchema2 = z19.union([
8172
+ z19.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route"),
8173
+ z19.literal("$default")
8149
8174
  ]);
8150
8175
 
8151
8176
  // src/feature/rest/schema.ts
8152
- var RestDefaultSchema = z18.record(
8177
+ var RestDefaultSchema = z20.record(
8153
8178
  ResourceIdSchema,
8154
- z18.object({
8179
+ z20.object({
8155
8180
  domain: ResourceIdSchema.describe("The domain id to link your API with.").optional(),
8156
- subDomain: z18.string().optional()
8181
+ subDomain: z20.string().optional()
8157
8182
  })
8158
8183
  ).optional().describe("Define your global REST API's.");
8159
- var RestSchema = z18.record(ResourceIdSchema, z18.record(RouteSchema2, FunctionSchema)).optional().describe("Define routes in your stack for your global REST API.");
8184
+ var RestSchema = z20.record(ResourceIdSchema, z20.record(RouteSchema2, FunctionSchema)).optional().describe("Define routes in your stack for your global REST API.");
8160
8185
 
8161
8186
  // src/feature/rpc/schema.ts
8162
- import { z as z19 } from "zod";
8163
- var RpcDefaultSchema = z19.record(
8187
+ import { z as z21 } from "zod";
8188
+ var RpcDefaultSchema = z21.record(
8164
8189
  ResourceIdSchema,
8165
- z19.object({
8190
+ z21.object({
8166
8191
  domain: ResourceIdSchema.describe("The domain id to link your RPC API with.").optional(),
8167
- subDomain: z19.string().optional(),
8192
+ subDomain: z21.string().optional(),
8168
8193
  auth: FunctionSchema.optional(),
8169
8194
  log: LogSchema.optional()
8170
8195
  })
8171
8196
  ).describe(`Define the global RPC API's.`).optional();
8172
- var RpcSchema = z19.record(ResourceIdSchema, z19.record(z19.string(), FunctionSchema).describe("The queries for your global RPC API.")).describe("Define the schema in your stack for your global RPC API.").optional();
8197
+ var RpcSchema = z21.record(ResourceIdSchema, z21.record(z21.string(), FunctionSchema).describe("The queries for your global RPC API.")).describe("Define the schema in your stack for your global RPC API.").optional();
8173
8198
 
8174
8199
  // src/feature/store/schema.ts
8175
- import { z as z20 } from "zod";
8176
- var DeletionProtectionSchema = z20.boolean().describe("Specifies if you want to protect the store from being deleted by awsless.");
8177
- var StoreDefaultSchema = z20.object({
8200
+ import { z as z22 } from "zod";
8201
+ var DeletionProtectionSchema = z22.boolean().describe("Specifies if you want to protect the store from being deleted by awsless.");
8202
+ var StoreDefaultSchema = z22.object({
8178
8203
  deletionProtection: DeletionProtectionSchema.optional()
8179
8204
  }).optional();
8180
- var StoresSchema = z20.union([
8181
- z20.array(ResourceIdSchema).transform((list4) => {
8205
+ var StoresSchema = z22.union([
8206
+ z22.array(ResourceIdSchema).transform((list4) => {
8182
8207
  const stores = {};
8183
8208
  for (const key of list4) {
8184
8209
  stores[key] = {};
8185
8210
  }
8186
8211
  return stores;
8187
8212
  }),
8188
- z20.record(
8213
+ z22.record(
8189
8214
  ResourceIdSchema,
8190
- z20.object({
8215
+ z22.object({
8191
8216
  // cors: CorsSchema,
8192
8217
  deletionProtection: DeletionProtectionSchema.optional(),
8193
- versioning: z20.boolean().default(false).describe("Enable versioning of your store."),
8194
- events: z20.object({
8218
+ versioning: z22.boolean().default(false).describe("Enable versioning of your store."),
8219
+ events: z22.object({
8195
8220
  // create
8196
8221
  "created:*": FunctionSchema.optional().describe(
8197
8222
  "Subscribe to notifications regardless of the API that was used to create an object."
@@ -8224,41 +8249,41 @@ var StoresSchema = z20.union([
8224
8249
  ]).optional().describe("Define the stores in your stack.");
8225
8250
 
8226
8251
  // src/feature/table/schema.ts
8227
- import { z as z21 } from "zod";
8228
- var KeySchema = z21.string().min(1).max(255);
8229
- var DeletionProtectionSchema2 = z21.boolean().describe("Specifies if you want to protect the table from being deleted by awsless.");
8230
- var TableDefaultSchema = z21.object({
8252
+ import { z as z23 } from "zod";
8253
+ var KeySchema = z23.string().min(1).max(255);
8254
+ var DeletionProtectionSchema2 = z23.boolean().describe("Specifies if you want to protect the table from being deleted by awsless.");
8255
+ var TableDefaultSchema = z23.object({
8231
8256
  deletionProtection: DeletionProtectionSchema2.optional()
8232
8257
  }).optional();
8233
- var TablesSchema = z21.record(
8258
+ var TablesSchema = z23.record(
8234
8259
  ResourceIdSchema,
8235
- z21.object({
8260
+ z23.object({
8236
8261
  hash: KeySchema.describe(
8237
8262
  "Specifies the name of the partition / hash key that makes up the primary key for the table."
8238
8263
  ),
8239
8264
  sort: KeySchema.optional().describe(
8240
8265
  "Specifies the name of the range / sort key that makes up the primary key for the table."
8241
8266
  ),
8242
- fields: z21.record(z21.string(), z21.enum(["string", "number", "binary"])).optional().describe(
8267
+ fields: z23.record(z23.string(), z23.enum(["string", "number", "binary"])).optional().describe(
8243
8268
  'A list of attributes that describe the key schema for the table and indexes. If no attribute field is defined we default to "string".'
8244
8269
  ),
8245
- class: z21.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
8246
- pointInTimeRecovery: z21.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
8270
+ class: z23.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
8271
+ pointInTimeRecovery: z23.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
8247
8272
  timeToLiveAttribute: KeySchema.optional().describe(
8248
8273
  "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."
8249
8274
  ),
8250
8275
  deletionProtection: DeletionProtectionSchema2.optional(),
8251
- stream: z21.object({
8252
- type: z21.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
8276
+ stream: z23.object({
8277
+ type: z23.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
8253
8278
  "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."
8254
8279
  ),
8255
8280
  consumer: FunctionSchema.describe("The consuming lambda function for the stream")
8256
8281
  }).optional().describe(
8257
8282
  "The settings for the DynamoDB table stream, which capture changes to items stored in the table."
8258
8283
  ),
8259
- indexes: z21.record(
8260
- z21.string(),
8261
- z21.object({
8284
+ indexes: z23.record(
8285
+ z23.string(),
8286
+ z23.object({
8262
8287
  /** Specifies the name of the partition / hash key that makes up the primary key for the global secondary index. */
8263
8288
  hash: KeySchema,
8264
8289
  /** Specifies the name of the range / sort key that makes up the primary key for the global secondary index. */
@@ -8268,14 +8293,14 @@ var TablesSchema = z21.record(
8268
8293
  * - keys-only - Only the index and primary keys are projected into the index.
8269
8294
  * @default 'all'
8270
8295
  */
8271
- projection: z21.enum(["all", "keys-only"]).default("all")
8296
+ projection: z23.enum(["all", "keys-only"]).default("all")
8272
8297
  })
8273
8298
  ).optional().describe("Specifies the global secondary indexes to be created on the table.")
8274
8299
  })
8275
8300
  ).optional().describe("Define the tables in your stack.");
8276
8301
 
8277
8302
  // src/config/schema/region.ts
8278
- import { z as z22 } from "zod";
8303
+ import { z as z24 } from "zod";
8279
8304
  var US = ["us-east-2", "us-east-1", "us-west-1", "us-west-2"];
8280
8305
  var AF = ["af-south-1"];
8281
8306
  var AP = [
@@ -8304,21 +8329,21 @@ var EU = [
8304
8329
  var ME = ["me-south-1", "me-central-1"];
8305
8330
  var SA = ["sa-east-1"];
8306
8331
  var regions = [...US, ...AF, ...AP, ...CA, ...EU, ...ME, ...SA];
8307
- var RegionSchema = z22.enum(regions);
8332
+ var RegionSchema = z24.enum(regions);
8308
8333
 
8309
8334
  // src/config/app.ts
8310
- var AppSchema = z23.object({
8311
- $schema: z23.string().optional(),
8335
+ var AppSchema = z25.object({
8336
+ $schema: z25.string().optional(),
8312
8337
  name: ResourceIdSchema.describe("App name."),
8313
8338
  region: RegionSchema.describe("The AWS region to deploy to."),
8314
- profile: z23.string().describe("The AWS profile to deploy to."),
8339
+ profile: z25.string().describe("The AWS profile to deploy to."),
8315
8340
  // stage: z
8316
8341
  // .string()
8317
8342
  // .regex(/^[a-z]+$/)
8318
8343
  // .default('prod')
8319
8344
  // .describe('The deployment stage.'),
8320
8345
  // onFailure: OnFailureSchema,
8321
- defaults: z23.object({
8346
+ defaults: z25.object({
8322
8347
  onFailure: OnFailureDefaultSchema,
8323
8348
  onLog: OnLogDefaultSchema,
8324
8349
  auth: AuthDefaultSchema,
@@ -8333,17 +8358,18 @@ var AppSchema = z23.object({
8333
8358
  pubsub: PubSubDefaultSchema,
8334
8359
  table: TableDefaultSchema,
8335
8360
  store: StoreDefaultSchema,
8336
- alerts: AlertsDefaultSchema
8361
+ alerts: AlertsDefaultSchema,
8362
+ layers: LayerSchema
8337
8363
  // dataRetention: z.boolean().describe('Configure how your resources are handled on delete.').default(false),
8338
8364
  }).default({}).describe("Default properties")
8339
8365
  });
8340
8366
 
8341
8367
  // src/config/stack.ts
8342
- import { z as z35 } from "zod";
8368
+ import { z as z37 } from "zod";
8343
8369
 
8344
8370
  // src/feature/cache/schema.ts
8345
- import { z as z24 } from "zod";
8346
- var TypeSchema2 = z24.enum([
8371
+ import { z as z26 } from "zod";
8372
+ var TypeSchema2 = z26.enum([
8347
8373
  "t4g.small",
8348
8374
  "t4g.medium",
8349
8375
  "r6g.large",
@@ -8358,29 +8384,29 @@ var TypeSchema2 = z24.enum([
8358
8384
  "r6gd.4xlarge",
8359
8385
  "r6gd.8xlarge"
8360
8386
  ]);
8361
- var PortSchema = z24.number().int().min(1).max(5e4);
8362
- var ShardsSchema = z24.number().int().min(0).max(100);
8363
- var ReplicasPerShardSchema = z24.number().int().min(0).max(5);
8364
- var EngineSchema = z24.enum(["7.0", "6.2"]);
8365
- var CachesSchema = z24.record(
8387
+ var PortSchema = z26.number().int().min(1).max(5e4);
8388
+ var ShardsSchema = z26.number().int().min(0).max(100);
8389
+ var ReplicasPerShardSchema = z26.number().int().min(0).max(5);
8390
+ var EngineSchema = z26.enum(["7.0", "6.2"]);
8391
+ var CachesSchema = z26.record(
8366
8392
  ResourceIdSchema,
8367
- z24.object({
8393
+ z26.object({
8368
8394
  type: TypeSchema2.default("t4g.small"),
8369
8395
  port: PortSchema.default(6379),
8370
8396
  shards: ShardsSchema.default(1),
8371
8397
  replicasPerShard: ReplicasPerShardSchema.default(1),
8372
8398
  engine: EngineSchema.default("7.0"),
8373
- dataTiering: z24.boolean().default(false)
8399
+ dataTiering: z26.boolean().default(false)
8374
8400
  })
8375
8401
  ).optional().describe("Define the caches in your stack. For access to the cache put your functions inside the global VPC.");
8376
8402
 
8377
8403
  // src/feature/command/schema.ts
8378
- import { z as z25 } from "zod";
8379
- var CommandSchema2 = z25.union([
8380
- z25.object({
8404
+ import { z as z27 } from "zod";
8405
+ var CommandSchema2 = z27.union([
8406
+ z27.object({
8381
8407
  file: LocalFileSchema,
8382
- handler: z25.string().default("default").describe("The name of the handler that needs to run"),
8383
- description: z25.string().optional().describe("A description of the command")
8408
+ handler: z27.string().default("default").describe("The name of the handler that needs to run"),
8409
+ description: z27.string().optional().describe("A description of the command")
8384
8410
  // options: z.record(ResourceIdSchema, OptionSchema).optional(),
8385
8411
  // arguments: z.record(ResourceIdSchema, ArgumentSchema).optional(),
8386
8412
  }),
@@ -8390,22 +8416,22 @@ var CommandSchema2 = z25.union([
8390
8416
  description: void 0
8391
8417
  }))
8392
8418
  ]);
8393
- var CommandsSchema = z25.record(ResourceIdSchema, CommandSchema2).optional().describe("Define the custom commands for your stack.");
8419
+ var CommandsSchema = z27.record(ResourceIdSchema, CommandSchema2).optional().describe("Define the custom commands for your stack.");
8394
8420
 
8395
8421
  // src/feature/config/schema.ts
8396
- import { z as z26 } from "zod";
8397
- var ConfigNameSchema = z26.string().regex(/[a-z0-9\-]/g, "Invalid config name");
8398
- var ConfigsSchema = z26.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
8422
+ import { z as z28 } from "zod";
8423
+ var ConfigNameSchema = z28.string().regex(/[a-z0-9\-]/g, "Invalid config name");
8424
+ var ConfigsSchema = z28.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
8399
8425
 
8400
8426
  // src/feature/cron/schema/index.ts
8401
- import { z as z28 } from "zod";
8427
+ import { z as z30 } from "zod";
8402
8428
 
8403
8429
  // src/feature/cron/schema/schedule.ts
8404
- import { z as z27 } from "zod";
8430
+ import { z as z29 } from "zod";
8405
8431
  import { awsCronExpressionValidator } from "aws-cron-expression-validator";
8406
- var RateExpressionSchema = z27.custom(
8432
+ var RateExpressionSchema = z29.custom(
8407
8433
  (value) => {
8408
- return z27.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
8434
+ return z29.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
8409
8435
  const [str] = rate.split(" ");
8410
8436
  const number = parseInt(str);
8411
8437
  return number > 0;
@@ -8421,9 +8447,9 @@ var RateExpressionSchema = z27.custom(
8421
8447
  }
8422
8448
  return `rate(${rate})`;
8423
8449
  });
8424
- var CronExpressionSchema = z27.custom(
8450
+ var CronExpressionSchema = z29.custom(
8425
8451
  (value) => {
8426
- return z27.string().safeParse(value).success;
8452
+ return z29.string().safeParse(value).success;
8427
8453
  },
8428
8454
  { message: "Invalid cron expression" }
8429
8455
  ).superRefine((value, ctx) => {
@@ -8432,12 +8458,12 @@ var CronExpressionSchema = z27.custom(
8432
8458
  } catch (error) {
8433
8459
  if (error instanceof Error) {
8434
8460
  ctx.addIssue({
8435
- code: z27.ZodIssueCode.custom,
8461
+ code: z29.ZodIssueCode.custom,
8436
8462
  message: `Invalid cron expression: ${error.message}`
8437
8463
  });
8438
8464
  } else {
8439
8465
  ctx.addIssue({
8440
- code: z27.ZodIssueCode.custom,
8466
+ code: z29.ZodIssueCode.custom,
8441
8467
  message: "Invalid cron expression"
8442
8468
  });
8443
8469
  }
@@ -8448,23 +8474,23 @@ var CronExpressionSchema = z27.custom(
8448
8474
  var ScheduleExpressionSchema = RateExpressionSchema.or(CronExpressionSchema);
8449
8475
 
8450
8476
  // src/feature/cron/schema/index.ts
8451
- var CronsSchema = z28.record(
8477
+ var CronsSchema = z30.record(
8452
8478
  ResourceIdSchema,
8453
- z28.object({
8454
- enabled: z28.boolean().default(true).describe("If the cron is enabled."),
8479
+ z30.object({
8480
+ enabled: z30.boolean().default(true).describe("If the cron is enabled."),
8455
8481
  consumer: FunctionSchema.describe("The consuming lambda function properties."),
8456
8482
  schedule: ScheduleExpressionSchema.describe(
8457
8483
  'The scheduling expression.\n\nexample: "0 20 * * ? *"\nexample: "5 minutes"'
8458
8484
  ),
8459
- payload: z28.unknown().optional().describe("The JSON payload that will be passed to the consumer.")
8485
+ payload: z30.unknown().optional().describe("The JSON payload that will be passed to the consumer.")
8460
8486
  })
8461
8487
  ).optional().describe(`Define the cron jobs in your stack.`);
8462
8488
 
8463
8489
  // src/feature/search/schema.ts
8464
8490
  import { gibibytes as gibibytes2 } from "@awsless/size";
8465
- import { z as z29 } from "zod";
8466
- var VersionSchema = z29.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]);
8467
- var TypeSchema3 = z29.enum([
8491
+ import { z as z31 } from "zod";
8492
+ var VersionSchema = z31.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]);
8493
+ var TypeSchema3 = z31.enum([
8468
8494
  "t3.small",
8469
8495
  "t3.medium",
8470
8496
  "m3.medium",
@@ -8539,11 +8565,11 @@ var TypeSchema3 = z29.enum([
8539
8565
  "r6gd.16xlarge"
8540
8566
  ]);
8541
8567
  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.");
8542
- var SearchsSchema = z29.record(
8568
+ var SearchsSchema = z31.record(
8543
8569
  ResourceIdSchema,
8544
- z29.object({
8570
+ z31.object({
8545
8571
  type: TypeSchema3.default("t3.small"),
8546
- count: z29.number().int().min(1).default(1),
8572
+ count: z31.number().int().min(1).default(1),
8547
8573
  version: VersionSchema.default("2.13"),
8548
8574
  storage: StorageSizeSchema.default("10 GB")
8549
8575
  // vpc: z.boolean().default(false),
@@ -8551,29 +8577,29 @@ var SearchsSchema = z29.record(
8551
8577
  ).optional().describe("Define the search instances in your stack. Backed by OpenSearch.");
8552
8578
 
8553
8579
  // src/feature/site/schema.ts
8554
- import { z as z30 } from "zod";
8555
- var ErrorResponsePathSchema = z30.string().describe(
8580
+ import { z as z32 } from "zod";
8581
+ var ErrorResponsePathSchema = z32.string().describe(
8556
8582
  "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."
8557
8583
  );
8558
- var StatusCodeSchema = z30.number().int().positive().optional().describe(
8584
+ var StatusCodeSchema = z32.number().int().positive().optional().describe(
8559
8585
  "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."
8560
8586
  );
8561
8587
  var MinTTLSchema = DurationSchema.describe(
8562
8588
  "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."
8563
8589
  );
8564
- var ErrorResponseSchema = z30.union([
8590
+ var ErrorResponseSchema = z32.union([
8565
8591
  ErrorResponsePathSchema,
8566
- z30.object({
8592
+ z32.object({
8567
8593
  path: ErrorResponsePathSchema,
8568
8594
  statusCode: StatusCodeSchema.optional(),
8569
8595
  minTTL: MinTTLSchema.optional()
8570
8596
  })
8571
8597
  ]).optional();
8572
- var SitesSchema = z30.record(
8598
+ var SitesSchema = z32.record(
8573
8599
  ResourceIdSchema,
8574
- z30.object({
8600
+ z32.object({
8575
8601
  domain: ResourceIdSchema.describe("The domain id to link your site with.").optional(),
8576
- subDomain: z30.string().optional(),
8602
+ subDomain: z32.string().optional(),
8577
8603
  // bind: z
8578
8604
  // .object({
8579
8605
  // auth: z.array(ResourceIdSchema),
@@ -8582,11 +8608,11 @@ var SitesSchema = z30.record(
8582
8608
  // // rest: z.array(ResourceIdSchema),
8583
8609
  // })
8584
8610
  // .optional(),
8585
- static: z30.union([LocalDirectorySchema, z30.boolean()]).optional().describe(
8611
+ static: z32.union([LocalDirectorySchema, z32.boolean()]).optional().describe(
8586
8612
  "Specifies the path to the static files directory. Additionally you can also pass `true` when you don't have local static files, but still want to make an S3 bucket."
8587
8613
  ),
8588
8614
  ssr: FunctionSchema.optional().describe("Specifies the ssr file."),
8589
- origin: z30.enum(["ssr-first", "static-first"]).default("static-first").describe("Specifies the origin fallback ordering."),
8615
+ origin: z32.enum(["ssr-first", "static-first"]).default("static-first").describe("Specifies the origin fallback ordering."),
8590
8616
  // bind: z.object({
8591
8617
  // auth:
8592
8618
  // h
@@ -8599,7 +8625,7 @@ var SitesSchema = z30.record(
8599
8625
  // build: z.string().optional(),
8600
8626
  // }),
8601
8627
  // ]),
8602
- errors: z30.object({
8628
+ errors: z32.object({
8603
8629
  400: ErrorResponseSchema.describe("Customize a `400 Bad Request` response."),
8604
8630
  403: ErrorResponseSchema.describe("Customize a `403 Forbidden` response."),
8605
8631
  404: ErrorResponseSchema.describe("Customize a `404 Not Found` response."),
@@ -8612,16 +8638,16 @@ var SitesSchema = z30.record(
8612
8638
  503: ErrorResponseSchema.describe("Customize a `503 Service Unavailable` response."),
8613
8639
  504: ErrorResponseSchema.describe("Customize a `504 Gateway Timeout` response.")
8614
8640
  }).optional().describe("Customize the error responses for specific HTTP status codes."),
8615
- cors: z30.object({
8616
- override: z30.boolean().default(false),
8641
+ cors: z32.object({
8642
+ override: z32.boolean().default(false),
8617
8643
  maxAge: DurationSchema.default("365 days"),
8618
- exposeHeaders: z30.string().array().optional(),
8619
- credentials: z30.boolean().default(false),
8620
- headers: z30.string().array().default(["*"]),
8621
- origins: z30.string().array().default(["*"]),
8622
- methods: z30.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
8644
+ exposeHeaders: z32.string().array().optional(),
8645
+ credentials: z32.boolean().default(false),
8646
+ headers: z32.string().array().default(["*"]),
8647
+ origins: z32.string().array().default(["*"]),
8648
+ methods: z32.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
8623
8649
  }).optional().describe("Define the cors headers."),
8624
- security: z30.object({
8650
+ security: z32.object({
8625
8651
  // contentSecurityPolicy: z.object({
8626
8652
  // override: z.boolean().default(false),
8627
8653
  // policy: z.string(),
@@ -8663,10 +8689,10 @@ var SitesSchema = z30.record(
8663
8689
  // reportUri?: string
8664
8690
  // }
8665
8691
  }).optional().describe("Define the security policy."),
8666
- cache: z30.object({
8667
- cookies: z30.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
8668
- headers: z30.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
8669
- queries: z30.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
8692
+ cache: z32.object({
8693
+ cookies: z32.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
8694
+ headers: z32.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
8695
+ queries: z32.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
8670
8696
  }).optional().describe(
8671
8697
  "Specifies the cookies, headers, and query values that CloudFront includes in the cache key."
8672
8698
  )
@@ -8674,22 +8700,22 @@ var SitesSchema = z30.record(
8674
8700
  ).optional().describe("Define the sites in your stack.");
8675
8701
 
8676
8702
  // src/feature/stream/schema.ts
8677
- import { z as z31 } from "zod";
8678
- var LatencyModeSchema = z31.enum(["low", "normal"]).describe(
8703
+ import { z as z33 } from "zod";
8704
+ var LatencyModeSchema = z33.enum(["low", "normal"]).describe(
8679
8705
  `Channel latency mode. Valid values:
8680
8706
  - normal: Use "normal" to broadcast and deliver live video up to Full HD.
8681
8707
  - low: Use "low" for near real-time interactions with viewers.`
8682
8708
  );
8683
- var TypeSchema4 = z31.enum(["standard", "basic", "advanced-sd", "advanced-hd"]).describe(`The channel type, which determines the allowable resolution and bitrate.
8709
+ var TypeSchema4 = z33.enum(["standard", "basic", "advanced-sd", "advanced-hd"]).describe(`The channel type, which determines the allowable resolution and bitrate.
8684
8710
  If you exceed the allowable resolution or bitrate, the stream probably will disconnect immediately. Valid values:
8685
8711
  - 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.
8686
8712
  - 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.
8687
8713
  - 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.
8688
8714
  - 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.
8689
8715
  `);
8690
- var StreamsSchema = z31.record(
8716
+ var StreamsSchema = z33.record(
8691
8717
  ResourceIdSchema,
8692
- z31.object({
8718
+ z33.object({
8693
8719
  type: TypeSchema4.default("standard"),
8694
8720
  // preset: PresetSchema.optional(),
8695
8721
  latencyMode: LatencyModeSchema.default("low")
@@ -8697,42 +8723,42 @@ var StreamsSchema = z31.record(
8697
8723
  ).optional().describe("Define the streams in your stack.");
8698
8724
 
8699
8725
  // src/feature/task/schema.ts
8700
- import { z as z32 } from "zod";
8701
- var RetryAttemptsSchema2 = z32.number().int().min(0).max(2).describe(
8726
+ import { z as z34 } from "zod";
8727
+ var RetryAttemptsSchema2 = z34.number().int().min(0).max(2).describe(
8702
8728
  "The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
8703
8729
  );
8704
- var TaskSchema = z32.union([
8730
+ var TaskSchema = z34.union([
8705
8731
  LocalFileSchema.transform((file) => ({
8706
8732
  consumer: { file },
8707
8733
  retryAttempts: void 0
8708
8734
  })),
8709
- z32.object({
8735
+ z34.object({
8710
8736
  consumer: FunctionSchema,
8711
8737
  retryAttempts: RetryAttemptsSchema2.optional()
8712
8738
  })
8713
8739
  ]);
8714
- var TasksSchema = z32.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
8740
+ var TasksSchema = z34.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
8715
8741
 
8716
8742
  // src/feature/test/schema.ts
8717
- import { z as z33 } from "zod";
8718
- var TestsSchema = z33.union([LocalDirectorySchema.transform((v) => [v]), LocalDirectorySchema.array()]).describe("Define the location of your tests for your stack.").optional();
8743
+ import { z as z35 } from "zod";
8744
+ var TestsSchema = z35.union([LocalDirectorySchema.transform((v) => [v]), LocalDirectorySchema.array()]).describe("Define the location of your tests for your stack.").optional();
8719
8745
 
8720
8746
  // src/feature/topic/schema.ts
8721
8747
  import { paramCase as paramCase3 } from "change-case";
8722
- import { z as z34 } from "zod";
8723
- var TopicNameSchema = z34.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => paramCase3(value)).describe("Define event topic name.");
8724
- var TopicsSchema = z34.array(TopicNameSchema).refine((topics) => {
8748
+ import { z as z36 } from "zod";
8749
+ var TopicNameSchema = z36.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => paramCase3(value)).describe("Define event topic name.");
8750
+ var TopicsSchema = z36.array(TopicNameSchema).refine((topics) => {
8725
8751
  return topics.length === new Set(topics).size;
8726
8752
  }, "Must be a list of unique topic names").optional().describe("Define the event topics to publish too in your stack.");
8727
- var SubscribersSchema = z34.record(TopicNameSchema, FunctionSchema).optional().describe("Define the event topics to subscribe too in your stack.");
8753
+ var SubscribersSchema = z36.record(TopicNameSchema, FunctionSchema).optional().describe("Define the event topics to subscribe too in your stack.");
8728
8754
 
8729
8755
  // src/config/stack.ts
8730
8756
  var DependsSchema = ResourceIdSchema.array().optional().describe("Define the stacks that this stack is depended on.");
8731
8757
  var NameSchema = ResourceIdSchema.refine((name) => !["base"].includes(name), {
8732
8758
  message: `Stack name can't be a reserved name.`
8733
8759
  }).describe("Stack name.");
8734
- var StackSchema = z35.object({
8735
- $schema: z35.string().optional(),
8760
+ var StackSchema = z37.object({
8761
+ $schema: z37.string().optional(),
8736
8762
  name: NameSchema,
8737
8763
  depends: DependsSchema,
8738
8764
  commands: CommandsSchema,
@@ -8799,13 +8825,13 @@ var readConfigWithStage = async (file, stage) => {
8799
8825
  };
8800
8826
 
8801
8827
  // src/config/load/validate.ts
8802
- import { z as z36 } from "zod";
8828
+ import { z as z38 } from "zod";
8803
8829
  var validateConfig = async (schema, file, data) => {
8804
8830
  try {
8805
8831
  const result = await schema.parseAsync(data);
8806
8832
  return result;
8807
8833
  } catch (error) {
8808
- if (error instanceof z36.ZodError) {
8834
+ if (error instanceof z38.ZodError) {
8809
8835
  throw new ConfigError(file, error, data);
8810
8836
  }
8811
8837
  throw error;
@@ -10673,9 +10699,10 @@ var createLambdaFunction = (group, ctx, ns, id, local2) => {
10673
10699
  const version = await generateFileHash(workspace, local2.file);
10674
10700
  return build3(version, async (write) => {
10675
10701
  const temp = await createTempFolder(`function--${name}`);
10702
+ const external = [...props.build.external ?? [], ...props.layers.map((id2) => id2)];
10676
10703
  const bundle = await bundleTypeScript({
10677
10704
  file: local2.file,
10678
- external: props.build.external,
10705
+ external,
10679
10706
  minify: props.build.minify,
10680
10707
  nativeDir: temp.path
10681
10708
  });
@@ -10728,6 +10755,7 @@ var createLambdaFunction = (group, ctx, ns, id, local2) => {
10728
10755
  role: role.arn,
10729
10756
  code,
10730
10757
  runtime: props.runtime === "container" ? void 0 : props.runtime,
10758
+ layers: props.layers.map((id2) => ctx.shared.get(`layer-${id2}-arn`)),
10731
10759
  // Remove conflicting props.
10732
10760
  vpc: void 0,
10733
10761
  log: props.log
@@ -13772,6 +13800,59 @@ var alertFeature = defineFeature({
13772
13800
  }
13773
13801
  });
13774
13802
 
13803
+ // src/feature/layer/index.ts
13804
+ import { Asset as Asset7, aws as aws26, Node as Node26 } from "@awsless/formation";
13805
+ var layerFeature = defineFeature({
13806
+ name: "layer",
13807
+ onBefore(ctx) {
13808
+ const group = new Node26(ctx.base, "layer", "asset");
13809
+ const bucket = new aws26.s3.Bucket(group, "bucket", {
13810
+ name: formatGlobalResourceName({
13811
+ appName: ctx.app.name,
13812
+ resourceType: "layer",
13813
+ resourceName: "assets",
13814
+ postfix: ctx.appId
13815
+ }),
13816
+ // versioning: true,
13817
+ forceDelete: true
13818
+ });
13819
+ ctx.shared.set("layer-bucket-name", bucket.name);
13820
+ },
13821
+ onApp(ctx) {
13822
+ const layers = Object.entries(ctx.appConfig.defaults.layers ?? {});
13823
+ if (layers.length === 0) {
13824
+ return;
13825
+ }
13826
+ for (const [id, props] of layers) {
13827
+ console.log(id, props);
13828
+ const group = new Node26(ctx.base, "lambda-layer", id);
13829
+ const item = new aws26.s3.BucketObject(group, "code", {
13830
+ bucket: ctx.shared.get("layer-bucket-name"),
13831
+ key: `/layer/${id}.zip`,
13832
+ body: Asset7.fromFile(props.file),
13833
+ contentType: "application/zip"
13834
+ });
13835
+ const layer = new aws26.lambda.Layer(group, "layer", {
13836
+ name: id,
13837
+ description: props.description,
13838
+ architectures: props.architectures,
13839
+ runtimes: props.runtimes,
13840
+ code: {
13841
+ bucket: item.bucket,
13842
+ key: item.key
13843
+ }
13844
+ }).dependsOn(item);
13845
+ ctx.shared.set(`layer-${id}-arn`, layer.arn);
13846
+ }
13847
+ ctx.onGlobalPolicy((policy) => {
13848
+ policy.addStatement({
13849
+ actions: ["lambda:InvokeFunction", "lambda:InvokeAsync"],
13850
+ resources: [`arn:aws:lambda:*:*:function:${ctx.appConfig.name}--*`]
13851
+ });
13852
+ });
13853
+ }
13854
+ });
13855
+
13775
13856
  // src/feature/index.ts
13776
13857
  var features = [
13777
13858
  // 1
@@ -13780,6 +13861,7 @@ var features = [
13780
13861
  commandFeature,
13781
13862
  onFailureFeature,
13782
13863
  onLogFeature,
13864
+ layerFeature,
13783
13865
  // 2
13784
13866
  authFeature,
13785
13867
  // 3
@@ -14108,7 +14190,9 @@ var assertDepsExists = (stack, stacks) => {
14108
14190
  };
14109
14191
  var createApp = (props) => {
14110
14192
  const app = new App2(props.appConfig.name);
14193
+ app.setTag("app", app.name);
14111
14194
  const base2 = new Stack(app, "base");
14195
+ base2.setTag("stack", base2.name);
14112
14196
  const shared = new SharedData();
14113
14197
  const appId = generateGlobalAppId({
14114
14198
  accountId: props.accountId,
@@ -14191,6 +14275,7 @@ var createApp = (props) => {
14191
14275
  }
14192
14276
  for (const stackConfig of props.stackConfigs) {
14193
14277
  const stack = new Stack(app, stackConfig.name);
14278
+ stack.setTag("stack", stack.name);
14194
14279
  const stackPolicyListeners = [];
14195
14280
  const stackPolicies = [];
14196
14281
  const localEnvListeners = [];