@awsless/awsless 0.0.425 → 0.0.427

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
@@ -3189,7 +3189,7 @@ var require_Schema = __commonJS({
3189
3189
  var string = require_string();
3190
3190
  var tags = require_tags();
3191
3191
  var sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
3192
- var Schema = class _Schema {
3192
+ var Schema2 = class _Schema {
3193
3193
  constructor({ compat, customTags, merge: merge2, resolveKnownTags, schema, sortMapEntries, toStringDefaults }) {
3194
3194
  this.compat = Array.isArray(compat) ? tags.getTags(compat, "compat") : compat ? tags.getTags(null, compat) : null;
3195
3195
  this.merge = !!merge2;
@@ -3208,7 +3208,7 @@ var require_Schema = __commonJS({
3208
3208
  return copy;
3209
3209
  }
3210
3210
  };
3211
- exports.Schema = Schema;
3211
+ exports.Schema = Schema2;
3212
3212
  }
3213
3213
  });
3214
3214
 
@@ -3301,7 +3301,7 @@ var require_Document = __commonJS({
3301
3301
  var identity = require_identity();
3302
3302
  var Pair = require_Pair();
3303
3303
  var toJS = require_toJS();
3304
- var Schema = require_Schema();
3304
+ var Schema2 = require_Schema();
3305
3305
  var stringifyDocument = require_stringifyDocument();
3306
3306
  var anchors = require_anchors();
3307
3307
  var applyReviver = require_applyReviver();
@@ -3551,7 +3551,7 @@ var require_Document = __commonJS({
3551
3551
  if (options.schema instanceof Object)
3552
3552
  this.schema = options.schema;
3553
3553
  else if (opt)
3554
- this.schema = new Schema.Schema(Object.assign(opt, options));
3554
+ this.schema = new Schema2.Schema(Object.assign(opt, options));
3555
3555
  else
3556
3556
  throw new Error(`With a null YAML version, the { schema: Schema } option is required`);
3557
3557
  }
@@ -7151,7 +7151,7 @@ var require_dist = __commonJS({
7151
7151
  "use strict";
7152
7152
  var composer = require_composer();
7153
7153
  var Document = require_Document();
7154
- var Schema = require_Schema();
7154
+ var Schema2 = require_Schema();
7155
7155
  var errors = require_errors();
7156
7156
  var Alias = require_Alias();
7157
7157
  var identity = require_identity();
@@ -7167,7 +7167,7 @@ var require_dist = __commonJS({
7167
7167
  var visit = require_visit();
7168
7168
  exports.Composer = composer.Composer;
7169
7169
  exports.Document = Document.Document;
7170
- exports.Schema = Schema.Schema;
7170
+ exports.Schema = Schema2.Schema;
7171
7171
  exports.YAMLError = errors.YAMLError;
7172
7172
  exports.YAMLParseError = errors.YAMLParseError;
7173
7173
  exports.YAMLWarning = errors.YAMLWarning;
@@ -8021,18 +8021,22 @@ var ArchitectureSchema2 = z14.enum(["x86_64", "arm64"]).describe("The instructio
8021
8021
  var NodeRuntimeSchema2 = z14.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x"]).describe("The identifier of the function's runtime.");
8022
8022
 
8023
8023
  // src/feature/layer/schema.ts
8024
+ var Schema = z15.object({
8025
+ file: LocalFileSchema,
8026
+ description: z15.string().optional().describe("A description of the lambda layer."),
8027
+ runtimes: NodeRuntimeSchema2.array().optional(),
8028
+ architectures: ArchitectureSchema2.array().optional(),
8029
+ packages: z15.string().array().optional().describe(
8030
+ "Define the package names that are available bundled in the layer. Those packages are not bundled while bundling the lambda."
8031
+ )
8032
+ });
8024
8033
  var LayerSchema = z15.record(
8025
8034
  ResourceIdSchema,
8026
8035
  z15.union([
8027
8036
  LocalFileSchema.transform((file) => ({
8028
8037
  file
8029
8038
  })),
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
- })
8039
+ Schema
8036
8040
  ])
8037
8041
  ).optional().describe("Define the lambda layers in your stack.");
8038
8042
 
@@ -10701,7 +10705,10 @@ var createLambdaFunction = (group, ctx, ns, id, local2) => {
10701
10705
  const temp = await createTempFolder(`function--${name}`);
10702
10706
  const bundle = await bundleTypeScript({
10703
10707
  file: local2.file,
10704
- external: [...props.build.external ?? [], ...props.layers ?? []],
10708
+ external: [
10709
+ ...props.build.external ?? [],
10710
+ ...(props.layers ?? []).flatMap((id2) => ctx.shared.get(`layer-${id2}-packages`))
10711
+ ],
10705
10712
  minify: props.build.minify,
10706
10713
  nativeDir: temp.path
10707
10714
  });
@@ -13822,7 +13829,8 @@ var layerFeature = defineFeature({
13822
13829
  if (layers.length === 0) {
13823
13830
  return;
13824
13831
  }
13825
- for (const [id, props] of layers) {
13832
+ for (const [id, _props] of layers) {
13833
+ const props = _props;
13826
13834
  const group = new Node26(ctx.base, "lambda-layer", id);
13827
13835
  const item = new aws26.s3.BucketObject(group, "code", {
13828
13836
  bucket: ctx.shared.get("layer-bucket-name"),
@@ -13831,7 +13839,11 @@ var layerFeature = defineFeature({
13831
13839
  contentType: "application/zip"
13832
13840
  });
13833
13841
  const layer = new aws26.lambda.Layer(group, "layer", {
13834
- name: id,
13842
+ name: formatGlobalResourceName({
13843
+ appName: ctx.appConfig.name,
13844
+ resourceType: "layer",
13845
+ resourceName: id
13846
+ }),
13835
13847
  description: props.description,
13836
13848
  architectures: props.architectures,
13837
13849
  runtimes: props.runtimes,
@@ -13841,13 +13853,8 @@ var layerFeature = defineFeature({
13841
13853
  }
13842
13854
  }).dependsOn(item);
13843
13855
  ctx.shared.set(`layer-${id}-arn`, layer.arn);
13856
+ ctx.shared.set(`layer-${id}-packages`, props.packages ?? [id]);
13844
13857
  }
13845
- ctx.onGlobalPolicy((policy) => {
13846
- policy.addStatement({
13847
- actions: ["lambda:InvokeFunction", "lambda:InvokeAsync"],
13848
- resources: [`arn:aws:lambda:*:*:function:${ctx.appConfig.name}--*`]
13849
- });
13850
- });
13851
13858
  }
13852
13859
  });
13853
13860
 
@@ -1151,18 +1151,22 @@ var ArchitectureSchema2 = z33.enum(["x86_64", "arm64"]).describe("The instructio
1151
1151
  var NodeRuntimeSchema2 = z33.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x"]).describe("The identifier of the function's runtime.");
1152
1152
 
1153
1153
  // src/feature/layer/schema.ts
1154
+ var Schema = z34.object({
1155
+ file: LocalFileSchema,
1156
+ description: z34.string().optional().describe("A description of the lambda layer."),
1157
+ runtimes: NodeRuntimeSchema2.array().optional(),
1158
+ architectures: ArchitectureSchema2.array().optional(),
1159
+ packages: z34.string().array().optional().describe(
1160
+ "Define the package names that are available bundled in the layer. Those packages are not bundled while bundling the lambda."
1161
+ )
1162
+ });
1154
1163
  var LayerSchema = z34.record(
1155
1164
  ResourceIdSchema,
1156
1165
  z34.union([
1157
1166
  LocalFileSchema.transform((file) => ({
1158
1167
  file
1159
1168
  })),
1160
- z34.object({
1161
- file: LocalFileSchema,
1162
- description: z34.string().optional().describe("A description of the lambda layer."),
1163
- runtimes: NodeRuntimeSchema2.array().optional(),
1164
- architectures: ArchitectureSchema2.array().optional()
1165
- })
1169
+ Schema
1166
1170
  ])
1167
1171
  ).optional().describe("Define the lambda layers in your stack.");
1168
1172
 
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/awsless",
3
- "version": "0.0.425",
3
+ "version": "0.0.427",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -29,18 +29,18 @@
29
29
  },
30
30
  "peerDependencies": {
31
31
  "@awsless/dynamodb": "^0.1.5",
32
- "@awsless/iot": "^0.0.3",
33
32
  "@awsless/json": "^0.0.6",
34
33
  "@awsless/lambda": "^0.0.30",
35
- "@awsless/open-search": "^0.0.17",
36
- "@awsless/redis": "^0.0.13",
34
+ "@awsless/s3": "^0.0.20",
37
35
  "@awsless/sns": "^0.0.10",
38
36
  "@awsless/sqs": "^0.0.8",
37
+ "@awsless/iot": "^0.0.3",
38
+ "@awsless/open-search": "^0.0.17",
39
+ "@awsless/redis": "^0.0.13",
39
40
  "@awsless/validate": "^0.0.17",
40
41
  "@awsless/ssm": "^0.0.7",
41
- "@awsless/mqtt": "^0.0.2",
42
42
  "@awsless/weak-cache": "^0.0.1",
43
- "@awsless/s3": "^0.0.20"
43
+ "@awsless/mqtt": "^0.0.2"
44
44
  },
45
45
  "dependencies": {
46
46
  "@arcanyx/cidr-slicer": "^0.3.0",
@@ -116,14 +116,14 @@
116
116
  "zip-a-folder": "^3.1.6",
117
117
  "zod": "^3.21.4",
118
118
  "zod-to-json-schema": "^3.22.3",
119
- "@awsless/code": "^0.0.10",
120
- "@awsless/duration": "^0.0.1",
121
119
  "@awsless/formation": "^0.0.59",
122
120
  "@awsless/graphql": "^0.0.9",
121
+ "@awsless/duration": "^0.0.1",
123
122
  "@awsless/json": "^0.0.6",
124
123
  "@awsless/size": "^0.0.1",
125
124
  "@awsless/validate": "^0.0.17",
126
- "@awsless/ts-file-cache": "^0.0.10"
125
+ "@awsless/ts-file-cache": "^0.0.10",
126
+ "@awsless/code": "^0.0.10"
127
127
  },
128
128
  "devDependencies": {
129
129
  "@node-rs/bcrypt": "^1.10.5"