@awsless/awsless 0.0.441 → 0.0.442
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 +49 -17
- package/dist/prebuild/rpc/bundle.zip +0 -0
- package/package.json +13 -13
package/dist/bin.js
CHANGED
|
@@ -10803,7 +10803,7 @@ var createLambdaFunction = (group, ctx, ns, id, local2) => {
|
|
|
10803
10803
|
file: fileCode.file,
|
|
10804
10804
|
external: [
|
|
10805
10805
|
...fileCode.external ?? [],
|
|
10806
|
-
...
|
|
10806
|
+
...props.layers?.flatMap((id2) => ctx.shared.get(`layer-${id2}-packages`))
|
|
10807
10807
|
],
|
|
10808
10808
|
minify: fileCode.minify,
|
|
10809
10809
|
nativeDir: temp.path
|
|
@@ -10879,7 +10879,7 @@ var createLambdaFunction = (group, ctx, ns, id, local2) => {
|
|
|
10879
10879
|
role: role.arn,
|
|
10880
10880
|
code,
|
|
10881
10881
|
runtime: props.runtime === "container" ? void 0 : props.runtime,
|
|
10882
|
-
layers:
|
|
10882
|
+
layers: props.layers?.map((id2) => ctx.shared.get(`layer-${id2}-arn`)).filter((v) => !!v),
|
|
10883
10883
|
// Remove conflicting props.
|
|
10884
10884
|
vpc: void 0,
|
|
10885
10885
|
log: props.log
|
|
@@ -13159,24 +13159,29 @@ var siteFeature = defineFeature({
|
|
|
13159
13159
|
ctx.onBind((name2, value) => {
|
|
13160
13160
|
lambda.addEnvironment(name2, value);
|
|
13161
13161
|
});
|
|
13162
|
-
new aws19.lambda.Permission(group, "permission", {
|
|
13163
|
-
principal: "*",
|
|
13164
|
-
// principal: 'cloudfront.amazonaws.com',
|
|
13165
|
-
action: "lambda:InvokeFunctionUrl",
|
|
13166
|
-
functionArn: lambda.arn,
|
|
13167
|
-
urlAuthType: "none"
|
|
13168
|
-
// urlAuthType: 'aws-iam',
|
|
13169
|
-
// sourceArn: distribution.arn,
|
|
13170
|
-
});
|
|
13171
13162
|
const url = new aws19.lambda.Url(group, "url", {
|
|
13172
13163
|
targetArn: lambda.arn,
|
|
13173
|
-
authType: "
|
|
13174
|
-
|
|
13164
|
+
authType: "aws-iam"
|
|
13165
|
+
});
|
|
13166
|
+
const ssrAccessControl = new aws19.cloudFront.OriginAccessControl(group, `ssr-access`, {
|
|
13167
|
+
name,
|
|
13168
|
+
type: "lambda",
|
|
13169
|
+
behavior: "always",
|
|
13170
|
+
protocol: "sigv4"
|
|
13171
|
+
});
|
|
13172
|
+
new aws19.lambda.Permission(group, "ssr-permission", {
|
|
13173
|
+
principal: "cloudfront.amazonaws.com",
|
|
13174
|
+
action: "lambda:InvokeFunctionUrl",
|
|
13175
|
+
functionArn: lambda.arn,
|
|
13176
|
+
urlAuthType: "aws-iam",
|
|
13177
|
+
sourceArn: `arn:aws:cloudfront::${ctx.accountId}:distribution/*`
|
|
13175
13178
|
});
|
|
13179
|
+
ssrAccessControl.deletionPolicy = "after-deployment";
|
|
13176
13180
|
origins.push({
|
|
13177
13181
|
id: "ssr",
|
|
13178
13182
|
domainName: url.url.apply((url2) => url2.split("/")[2]),
|
|
13179
|
-
protocol: "https-only"
|
|
13183
|
+
protocol: "https-only",
|
|
13184
|
+
originAccessControlId: ssrAccessControl.id
|
|
13180
13185
|
});
|
|
13181
13186
|
}
|
|
13182
13187
|
if (props.static) {
|
|
@@ -13206,13 +13211,13 @@ var siteFeature = defineFeature({
|
|
|
13206
13211
|
policy.addStatement(bucket.permissions);
|
|
13207
13212
|
});
|
|
13208
13213
|
bucket.deletionPolicy = "after-deployment";
|
|
13209
|
-
const
|
|
13214
|
+
const s3AccessControl = new aws19.cloudFront.OriginAccessControl(group, `s3-access`, {
|
|
13210
13215
|
name,
|
|
13211
13216
|
type: "s3",
|
|
13212
13217
|
behavior: "always",
|
|
13213
13218
|
protocol: "sigv4"
|
|
13214
13219
|
});
|
|
13215
|
-
|
|
13220
|
+
s3AccessControl.deletionPolicy = "after-deployment";
|
|
13216
13221
|
if (typeof props.static === "string") {
|
|
13217
13222
|
const files = glob2.sync("**", {
|
|
13218
13223
|
cwd: props.static,
|
|
@@ -13233,7 +13238,7 @@ var siteFeature = defineFeature({
|
|
|
13233
13238
|
origins.push({
|
|
13234
13239
|
id: "static",
|
|
13235
13240
|
domainName: bucket.regionalDomainName,
|
|
13236
|
-
originAccessControlId:
|
|
13241
|
+
originAccessControlId: s3AccessControl.id
|
|
13237
13242
|
});
|
|
13238
13243
|
}
|
|
13239
13244
|
if (props.ssr && props.static) {
|
|
@@ -13935,6 +13940,22 @@ var alertFeature = defineFeature({
|
|
|
13935
13940
|
|
|
13936
13941
|
// src/feature/layer/index.ts
|
|
13937
13942
|
import { Asset as Asset7, aws as aws26, Node as Node26 } from "@awsless/formation";
|
|
13943
|
+
var stackSearch = (stack, key) => {
|
|
13944
|
+
let found = [];
|
|
13945
|
+
function search(obj) {
|
|
13946
|
+
if (typeof obj !== "object" || obj === null) return;
|
|
13947
|
+
if (obj[key]) {
|
|
13948
|
+
found.push(obj[key]);
|
|
13949
|
+
}
|
|
13950
|
+
for (let k in obj) {
|
|
13951
|
+
if (typeof obj[k] === "object") {
|
|
13952
|
+
search(obj[k]);
|
|
13953
|
+
}
|
|
13954
|
+
}
|
|
13955
|
+
}
|
|
13956
|
+
search(stack);
|
|
13957
|
+
return found;
|
|
13958
|
+
};
|
|
13938
13959
|
var layerFeature = defineFeature({
|
|
13939
13960
|
name: "layer",
|
|
13940
13961
|
onBefore(ctx) {
|
|
@@ -13955,6 +13976,17 @@ var layerFeature = defineFeature({
|
|
|
13955
13976
|
});
|
|
13956
13977
|
ctx.shared.set("layer-bucket-name", bucket.name);
|
|
13957
13978
|
},
|
|
13979
|
+
onValidate(ctx) {
|
|
13980
|
+
const layers = Object.keys(ctx.appConfig.defaults.layers ?? []);
|
|
13981
|
+
for (const stack of ctx.stackConfigs) {
|
|
13982
|
+
const stackLayers = stackSearch(stack, "layers").flat();
|
|
13983
|
+
for (const layer of stackLayers) {
|
|
13984
|
+
if (!layers.includes(layer)) {
|
|
13985
|
+
throw new FileError(stack.file, `Layer "${layer}" is not defined in app.json`);
|
|
13986
|
+
}
|
|
13987
|
+
}
|
|
13988
|
+
}
|
|
13989
|
+
},
|
|
13958
13990
|
onApp(ctx) {
|
|
13959
13991
|
const layers = Object.entries(ctx.appConfig.defaults.layers ?? {});
|
|
13960
13992
|
if (layers.length === 0) {
|
|
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.442",
|
|
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.7",
|
|
32
|
-
"@awsless/dynamodb": "^0.1.5",
|
|
33
|
-
"@awsless/lambda": "^0.0.30",
|
|
34
31
|
"@awsless/iot": "^0.0.3",
|
|
35
|
-
"@awsless/
|
|
32
|
+
"@awsless/dynamodb": "^0.1.5",
|
|
33
|
+
"@awsless/json": "^0.0.7",
|
|
36
34
|
"@awsless/open-search": "^0.0.17",
|
|
37
|
-
"@awsless/
|
|
35
|
+
"@awsless/lambda": "^0.0.30",
|
|
38
36
|
"@awsless/s3": "^0.0.20",
|
|
37
|
+
"@awsless/sns": "^0.0.10",
|
|
38
|
+
"@awsless/validate": "^0.0.17",
|
|
39
39
|
"@awsless/redis": "^0.0.13",
|
|
40
|
+
"@awsless/ssm": "^0.0.7",
|
|
40
41
|
"@awsless/weak-cache": "^0.0.1",
|
|
41
|
-
"@awsless/validate": "^0.0.17",
|
|
42
42
|
"@awsless/sqs": "^0.0.8",
|
|
43
|
-
"@awsless/
|
|
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/duration": "^0.0.1",
|
|
120
119
|
"@awsless/formation": "^0.0.59",
|
|
121
|
-
"@awsless/json": "^0.0.7",
|
|
122
|
-
"@awsless/size": "^0.0.1",
|
|
123
|
-
"@awsless/validate": "^0.0.17",
|
|
124
120
|
"@awsless/code": "^0.0.10",
|
|
121
|
+
"@awsless/duration": "^0.0.1",
|
|
122
|
+
"@awsless/json": "^0.0.7",
|
|
125
123
|
"@awsless/graphql": "^0.0.9",
|
|
126
|
-
"@awsless/
|
|
124
|
+
"@awsless/size": "^0.0.1",
|
|
125
|
+
"@awsless/ts-file-cache": "^0.0.12",
|
|
126
|
+
"@awsless/validate": "^0.0.17"
|
|
127
127
|
},
|
|
128
128
|
"devDependencies": {
|
|
129
129
|
"@node-rs/bcrypt": "^1.10.5"
|