@awsless/awsless 0.0.426 → 0.0.428
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/app.json +1 -1
- package/dist/bin.js +47 -37
- package/dist/build-json-schema.js +15 -8
- package/dist/prebuild/rpc/bundle.zip +0 -0
- package/package.json +11 -11
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
|
|
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 =
|
|
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
|
|
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
|
|
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
|
|
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 =
|
|
7170
|
+
exports.Schema = Schema2.Schema;
|
|
7171
7171
|
exports.YAMLError = errors.YAMLError;
|
|
7172
7172
|
exports.YAMLParseError = errors.YAMLParseError;
|
|
7173
7173
|
exports.YAMLWarning = errors.YAMLWarning;
|
|
@@ -8013,6 +8013,7 @@ var InstancesSchema = z13.record(
|
|
|
8013
8013
|
).optional().describe("Define the instances in your stack.");
|
|
8014
8014
|
|
|
8015
8015
|
// src/feature/layer/schema.ts
|
|
8016
|
+
import { paramCase as paramCase3 } from "change-case";
|
|
8016
8017
|
import { z as z15 } from "zod";
|
|
8017
8018
|
|
|
8018
8019
|
// src/config/schema/lambda.ts
|
|
@@ -8021,18 +8022,24 @@ var ArchitectureSchema2 = z14.enum(["x86_64", "arm64"]).describe("The instructio
|
|
|
8021
8022
|
var NodeRuntimeSchema2 = z14.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x"]).describe("The identifier of the function's runtime.");
|
|
8022
8023
|
|
|
8023
8024
|
// src/feature/layer/schema.ts
|
|
8025
|
+
var Schema = z15.object({
|
|
8026
|
+
file: LocalFileSchema,
|
|
8027
|
+
description: z15.string().optional().describe("A description of the lambda layer."),
|
|
8028
|
+
runtimes: NodeRuntimeSchema2.array().optional(),
|
|
8029
|
+
architecture: ArchitectureSchema2.optional(),
|
|
8030
|
+
packages: z15.string().array().optional().describe(
|
|
8031
|
+
"Define the package names that are available bundled in the layer. Those packages are not bundled while bundling the lambda."
|
|
8032
|
+
)
|
|
8033
|
+
});
|
|
8034
|
+
var LayerIdSchema = z15.string().min(2).max(214).regex(/^[a-z0-9\-@.]+$/i, "Invalid layer ID").transform((value) => paramCase3(value));
|
|
8024
8035
|
var LayerSchema = z15.record(
|
|
8025
|
-
|
|
8036
|
+
LayerIdSchema,
|
|
8026
8037
|
z15.union([
|
|
8027
8038
|
LocalFileSchema.transform((file) => ({
|
|
8028
|
-
file
|
|
8039
|
+
file,
|
|
8040
|
+
description: void 0
|
|
8029
8041
|
})),
|
|
8030
|
-
|
|
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
|
-
})
|
|
8042
|
+
Schema
|
|
8036
8043
|
])
|
|
8037
8044
|
).optional().describe("Define the lambda layers in your stack.");
|
|
8038
8045
|
|
|
@@ -8744,9 +8751,9 @@ import { z as z35 } from "zod";
|
|
|
8744
8751
|
var TestsSchema = z35.union([LocalDirectorySchema.transform((v) => [v]), LocalDirectorySchema.array()]).describe("Define the location of your tests for your stack.").optional();
|
|
8745
8752
|
|
|
8746
8753
|
// src/feature/topic/schema.ts
|
|
8747
|
-
import { paramCase as
|
|
8754
|
+
import { paramCase as paramCase4 } from "change-case";
|
|
8748
8755
|
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) =>
|
|
8756
|
+
var TopicNameSchema = z36.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => paramCase4(value)).describe("Define event topic name.");
|
|
8750
8757
|
var TopicsSchema = z36.array(TopicNameSchema).refine((topics) => {
|
|
8751
8758
|
return topics.length === new Set(topics).size;
|
|
8752
8759
|
}, "Must be a list of unique topic names").optional().describe("Define the event topics to publish too in your stack.");
|
|
@@ -8993,7 +9000,7 @@ var TypeObject = class {
|
|
|
8993
9000
|
};
|
|
8994
9001
|
|
|
8995
9002
|
// src/util/name.ts
|
|
8996
|
-
import { paramCase as
|
|
9003
|
+
import { paramCase as paramCase5 } from "change-case";
|
|
8997
9004
|
import { createHmac } from "crypto";
|
|
8998
9005
|
var formatGlobalResourceName = (opt) => {
|
|
8999
9006
|
return [
|
|
@@ -9003,7 +9010,7 @@ var formatGlobalResourceName = (opt) => {
|
|
|
9003
9010
|
opt.resourceType,
|
|
9004
9011
|
opt.resourceName,
|
|
9005
9012
|
opt.postfix
|
|
9006
|
-
].filter((v) => typeof v === "string").map((v) =>
|
|
9013
|
+
].filter((v) => typeof v === "string").map((v) => paramCase5(v) || v).join(opt.seperator ?? "--");
|
|
9007
9014
|
};
|
|
9008
9015
|
var formatLocalResourceName = (opt) => {
|
|
9009
9016
|
return [
|
|
@@ -9014,7 +9021,7 @@ var formatLocalResourceName = (opt) => {
|
|
|
9014
9021
|
opt.resourceType,
|
|
9015
9022
|
opt.resourceName,
|
|
9016
9023
|
opt.postfix
|
|
9017
|
-
].filter((v) => typeof v === "string").map((v) =>
|
|
9024
|
+
].filter((v) => typeof v === "string").map((v) => paramCase5(v) || v).join(opt.seperator ?? "--");
|
|
9018
9025
|
};
|
|
9019
9026
|
var generateGlobalAppId = (opt) => {
|
|
9020
9027
|
return createHmac("sha1", "awsless").update(opt.accountId).update(opt.region).update(opt.appName).digest("hex").substring(0, 8);
|
|
@@ -10701,7 +10708,10 @@ var createLambdaFunction = (group, ctx, ns, id, local2) => {
|
|
|
10701
10708
|
const temp = await createTempFolder(`function--${name}`);
|
|
10702
10709
|
const bundle = await bundleTypeScript({
|
|
10703
10710
|
file: local2.file,
|
|
10704
|
-
external: [
|
|
10711
|
+
external: [
|
|
10712
|
+
...props.build.external ?? [],
|
|
10713
|
+
...(props.layers ?? []).flatMap((id2) => ctx.shared.get(`layer-${id2}-packages`))
|
|
10714
|
+
],
|
|
10705
10715
|
minify: props.build.minify,
|
|
10706
10716
|
nativeDir: temp.path
|
|
10707
10717
|
});
|
|
@@ -11087,7 +11097,7 @@ var commandFeature = defineFeature({
|
|
|
11087
11097
|
});
|
|
11088
11098
|
|
|
11089
11099
|
// src/feature/config/index.ts
|
|
11090
|
-
import { paramCase as
|
|
11100
|
+
import { paramCase as paramCase6 } from "change-case";
|
|
11091
11101
|
|
|
11092
11102
|
// src/util/ssm.ts
|
|
11093
11103
|
import {
|
|
@@ -11248,7 +11258,7 @@ var configFeature = defineFeature({
|
|
|
11248
11258
|
resources: configs.map(
|
|
11249
11259
|
(name) => `arn:aws:ssm:${ctx.appConfig.region}:${ctx.accountId}:parameter${configParameterPrefix(
|
|
11250
11260
|
ctx.app.name
|
|
11251
|
-
)}/${
|
|
11261
|
+
)}/${paramCase6(name)}`
|
|
11252
11262
|
)
|
|
11253
11263
|
});
|
|
11254
11264
|
});
|
|
@@ -11523,7 +11533,7 @@ var functionFeature = defineFeature({
|
|
|
11523
11533
|
});
|
|
11524
11534
|
|
|
11525
11535
|
// src/feature/graphql/index.ts
|
|
11526
|
-
import { constantCase as constantCase5, paramCase as
|
|
11536
|
+
import { constantCase as constantCase5, paramCase as paramCase7 } from "change-case";
|
|
11527
11537
|
import { generate } from "@awsless/graphql";
|
|
11528
11538
|
import { mergeTypeDefs } from "@graphql-tools/merge";
|
|
11529
11539
|
import { readFile as readFile5 } from "fs/promises";
|
|
@@ -11816,7 +11826,7 @@ var graphqlFeature = defineFeature({
|
|
|
11816
11826
|
for (const [fieldName, props2] of Object.entries(fields ?? {})) {
|
|
11817
11827
|
const name = `${typeName}__${fieldName}`;
|
|
11818
11828
|
const resolverGroup = new Node7(group, "resolver", name);
|
|
11819
|
-
const entryId =
|
|
11829
|
+
const entryId = paramCase7(`${id}-${shortId(`${typeName}-${fieldName}`)}`);
|
|
11820
11830
|
const { lambda } = createLambdaFunction(resolverGroup, ctx, `graphql`, entryId, {
|
|
11821
11831
|
...props2.consumer,
|
|
11822
11832
|
description: `${id} ${typeName}.${fieldName}`
|
|
@@ -12592,7 +12602,7 @@ var restFeature = defineFeature({
|
|
|
12592
12602
|
});
|
|
12593
12603
|
|
|
12594
12604
|
// src/feature/rpc/index.ts
|
|
12595
|
-
import { camelCase as camelCase6, constantCase as constantCase10, paramCase as
|
|
12605
|
+
import { camelCase as camelCase6, constantCase as constantCase10, paramCase as paramCase8 } from "change-case";
|
|
12596
12606
|
import { Asset as Asset5, aws as aws17, Node as Node16 } from "@awsless/formation";
|
|
12597
12607
|
import { mebibytes as mebibytes2 } from "@awsless/size";
|
|
12598
12608
|
import { dirname as dirname10, join as join9, relative as relative5 } from "path";
|
|
@@ -12894,7 +12904,7 @@ var rpcFeature = defineFeature({
|
|
|
12894
12904
|
const group = new Node16(ctx.stack, "rpc", id);
|
|
12895
12905
|
for (const [name, props] of Object.entries(queries ?? {})) {
|
|
12896
12906
|
const queryGroup = new Node16(group, "query", name);
|
|
12897
|
-
const entryId =
|
|
12907
|
+
const entryId = paramCase8(`${id}-${shortId(name)}`);
|
|
12898
12908
|
createLambdaFunction(queryGroup, ctx, `rpc`, entryId, {
|
|
12899
12909
|
...props,
|
|
12900
12910
|
description: `${id} ${name}`
|
|
@@ -13213,7 +13223,7 @@ var siteFeature = defineFeature({
|
|
|
13213
13223
|
|
|
13214
13224
|
// src/feature/store/index.ts
|
|
13215
13225
|
import { aws as aws20, Node as Node19 } from "@awsless/formation";
|
|
13216
|
-
import { paramCase as
|
|
13226
|
+
import { paramCase as paramCase9 } from "change-case";
|
|
13217
13227
|
var typeGenCode5 = `
|
|
13218
13228
|
import { Body, PutObjectProps, BodyStream } from '@awsless/s3'
|
|
13219
13229
|
|
|
@@ -13297,7 +13307,7 @@ var storeFeature = defineFeature({
|
|
|
13297
13307
|
};
|
|
13298
13308
|
for (const [event, funcProps] of Object.entries(props.events ?? {})) {
|
|
13299
13309
|
const eventGroup = new Node19(group, "event", event);
|
|
13300
|
-
const eventId =
|
|
13310
|
+
const eventId = paramCase9(`${id}-${shortId(event)}`);
|
|
13301
13311
|
const { lambda } = createAsyncLambdaFunction(eventGroup, ctx, `store`, eventId, {
|
|
13302
13312
|
...funcProps,
|
|
13303
13313
|
description: `${id} event "${event}"`
|
|
@@ -13804,6 +13814,10 @@ import { Asset as Asset7, aws as aws26, Node as Node26 } from "@awsless/formatio
|
|
|
13804
13814
|
var layerFeature = defineFeature({
|
|
13805
13815
|
name: "layer",
|
|
13806
13816
|
onBefore(ctx) {
|
|
13817
|
+
const layers = Object.entries(ctx.appConfig.defaults.layers ?? {});
|
|
13818
|
+
if (layers.length === 0) {
|
|
13819
|
+
return;
|
|
13820
|
+
}
|
|
13807
13821
|
const group = new Node26(ctx.base, "layer", "asset");
|
|
13808
13822
|
const bucket = new aws26.s3.Bucket(group, "bucket", {
|
|
13809
13823
|
name: formatGlobalResourceName({
|
|
@@ -13822,8 +13836,9 @@ var layerFeature = defineFeature({
|
|
|
13822
13836
|
if (layers.length === 0) {
|
|
13823
13837
|
return;
|
|
13824
13838
|
}
|
|
13825
|
-
for (const [id,
|
|
13826
|
-
const
|
|
13839
|
+
for (const [id, _props] of layers) {
|
|
13840
|
+
const props = _props;
|
|
13841
|
+
const group = new Node26(ctx.base, "layer", id);
|
|
13827
13842
|
const item = new aws26.s3.BucketObject(group, "code", {
|
|
13828
13843
|
bucket: ctx.shared.get("layer-bucket-name"),
|
|
13829
13844
|
key: `/layer/${id}.zip`,
|
|
@@ -13837,7 +13852,7 @@ var layerFeature = defineFeature({
|
|
|
13837
13852
|
resourceName: id
|
|
13838
13853
|
}),
|
|
13839
13854
|
description: props.description,
|
|
13840
|
-
architectures: props.
|
|
13855
|
+
architectures: props.architecture ? [props.architecture] : void 0,
|
|
13841
13856
|
runtimes: props.runtimes,
|
|
13842
13857
|
code: {
|
|
13843
13858
|
bucket: item.bucket,
|
|
@@ -13845,13 +13860,8 @@ var layerFeature = defineFeature({
|
|
|
13845
13860
|
}
|
|
13846
13861
|
}).dependsOn(item);
|
|
13847
13862
|
ctx.shared.set(`layer-${id}-arn`, layer.arn);
|
|
13863
|
+
ctx.shared.set(`layer-${id}-packages`, props.packages ?? [id]);
|
|
13848
13864
|
}
|
|
13849
|
-
ctx.onGlobalPolicy((policy) => {
|
|
13850
|
-
policy.addStatement({
|
|
13851
|
-
actions: ["lambda:InvokeFunction", "lambda:InvokeAsync"],
|
|
13852
|
-
resources: [`arn:aws:lambda:*:*:function:${ctx.appConfig.name}--*`]
|
|
13853
|
-
});
|
|
13854
|
-
});
|
|
13855
13865
|
}
|
|
13856
13866
|
});
|
|
13857
13867
|
|
|
@@ -1143,6 +1143,7 @@ var DomainsDefaultSchema = z32.record(
|
|
|
1143
1143
|
).optional().describe("Define the domains for your application.");
|
|
1144
1144
|
|
|
1145
1145
|
// src/feature/layer/schema.ts
|
|
1146
|
+
import { paramCase as paramCase4 } from "change-case";
|
|
1146
1147
|
import { z as z34 } from "zod";
|
|
1147
1148
|
|
|
1148
1149
|
// src/config/schema/lambda.ts
|
|
@@ -1151,18 +1152,24 @@ var ArchitectureSchema2 = z33.enum(["x86_64", "arm64"]).describe("The instructio
|
|
|
1151
1152
|
var NodeRuntimeSchema2 = z33.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x"]).describe("The identifier of the function's runtime.");
|
|
1152
1153
|
|
|
1153
1154
|
// src/feature/layer/schema.ts
|
|
1155
|
+
var Schema = z34.object({
|
|
1156
|
+
file: LocalFileSchema,
|
|
1157
|
+
description: z34.string().optional().describe("A description of the lambda layer."),
|
|
1158
|
+
runtimes: NodeRuntimeSchema2.array().optional(),
|
|
1159
|
+
architecture: ArchitectureSchema2.optional(),
|
|
1160
|
+
packages: z34.string().array().optional().describe(
|
|
1161
|
+
"Define the package names that are available bundled in the layer. Those packages are not bundled while bundling the lambda."
|
|
1162
|
+
)
|
|
1163
|
+
});
|
|
1164
|
+
var LayerIdSchema = z34.string().min(2).max(214).regex(/^[a-z0-9\-@.]+$/i, "Invalid layer ID").transform((value) => paramCase4(value));
|
|
1154
1165
|
var LayerSchema = z34.record(
|
|
1155
|
-
|
|
1166
|
+
LayerIdSchema,
|
|
1156
1167
|
z34.union([
|
|
1157
1168
|
LocalFileSchema.transform((file) => ({
|
|
1158
|
-
file
|
|
1169
|
+
file,
|
|
1170
|
+
description: void 0
|
|
1159
1171
|
})),
|
|
1160
|
-
|
|
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
|
-
})
|
|
1172
|
+
Schema
|
|
1166
1173
|
])
|
|
1167
1174
|
).optional().describe("Define the lambda layers in your stack.");
|
|
1168
1175
|
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/awsless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.428",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -28,19 +28,19 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
+
"@awsless/json": "^0.0.6",
|
|
31
32
|
"@awsless/dynamodb": "^0.1.5",
|
|
32
33
|
"@awsless/iot": "^0.0.3",
|
|
33
|
-
"@awsless/json": "^0.0.6",
|
|
34
34
|
"@awsless/lambda": "^0.0.30",
|
|
35
35
|
"@awsless/open-search": "^0.0.17",
|
|
36
|
-
"@awsless/s3": "^0.0.20",
|
|
37
36
|
"@awsless/redis": "^0.0.13",
|
|
37
|
+
"@awsless/sns": "^0.0.10",
|
|
38
|
+
"@awsless/sqs": "^0.0.8",
|
|
38
39
|
"@awsless/validate": "^0.0.17",
|
|
39
|
-
"@awsless/weak-cache": "^0.0.1",
|
|
40
40
|
"@awsless/ssm": "^0.0.7",
|
|
41
|
-
"@awsless/
|
|
42
|
-
"@awsless/
|
|
43
|
-
"@awsless/
|
|
41
|
+
"@awsless/weak-cache": "^0.0.1",
|
|
42
|
+
"@awsless/s3": "^0.0.20",
|
|
43
|
+
"@awsless/mqtt": "^0.0.2"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@arcanyx/cidr-slicer": "^0.3.0",
|
|
@@ -117,13 +117,13 @@
|
|
|
117
117
|
"zod": "^3.21.4",
|
|
118
118
|
"zod-to-json-schema": "^3.22.3",
|
|
119
119
|
"@awsless/code": "^0.0.10",
|
|
120
|
-
"@awsless/graphql": "^0.0.9",
|
|
121
120
|
"@awsless/duration": "^0.0.1",
|
|
122
|
-
"@awsless/formation": "^0.0.59",
|
|
123
121
|
"@awsless/json": "^0.0.6",
|
|
122
|
+
"@awsless/formation": "^0.0.59",
|
|
123
|
+
"@awsless/graphql": "^0.0.9",
|
|
124
124
|
"@awsless/size": "^0.0.1",
|
|
125
|
-
"@awsless/
|
|
126
|
-
"@awsless/
|
|
125
|
+
"@awsless/validate": "^0.0.17",
|
|
126
|
+
"@awsless/ts-file-cache": "^0.0.10"
|
|
127
127
|
},
|
|
128
128
|
"devDependencies": {
|
|
129
129
|
"@node-rs/bcrypt": "^1.10.5"
|