@awsless/awsless 0.0.441 → 0.0.443
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 +46 -11
- package/dist/build-json-schema.js +596 -593
- package/dist/prebuild/rpc/bundle.zip +0 -0
- package/dist/stack.json +1 -1
- package/package.json +13 -13
package/dist/bin.js
CHANGED
|
@@ -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',
|
|
13162
|
+
new aws19.lambda.Permission(group, "ssr-permission", {
|
|
13163
|
+
principal: "cloudfront.amazonaws.com",
|
|
13165
13164
|
action: "lambda:InvokeFunctionUrl",
|
|
13166
13165
|
functionArn: lambda.arn,
|
|
13167
|
-
urlAuthType: "
|
|
13168
|
-
|
|
13169
|
-
// sourceArn: distribution.arn,
|
|
13166
|
+
urlAuthType: "aws-iam",
|
|
13167
|
+
sourceArn: `arn:aws:cloudfront::${ctx.accountId}:distribution/*`
|
|
13170
13168
|
});
|
|
13171
13169
|
const url = new aws19.lambda.Url(group, "url", {
|
|
13172
13170
|
targetArn: lambda.arn,
|
|
13173
|
-
authType: "
|
|
13174
|
-
|
|
13171
|
+
authType: "aws-iam"
|
|
13172
|
+
});
|
|
13173
|
+
const ssrAccessControl = new aws19.cloudFront.OriginAccessControl(group, "ssr-access", {
|
|
13174
|
+
name: `${name}-ssr`,
|
|
13175
|
+
type: "lambda",
|
|
13176
|
+
behavior: "always",
|
|
13177
|
+
protocol: "sigv4"
|
|
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) {
|
|
@@ -13233,7 +13238,9 @@ var siteFeature = defineFeature({
|
|
|
13233
13238
|
origins.push({
|
|
13234
13239
|
id: "static",
|
|
13235
13240
|
domainName: bucket.regionalDomainName,
|
|
13236
|
-
originAccessControlId: accessControl.id
|
|
13241
|
+
originAccessControlId: accessControl.id,
|
|
13242
|
+
originAccessIdentityId: ""
|
|
13243
|
+
// is required to have an value for s3 origins when using origin access control
|
|
13237
13244
|
});
|
|
13238
13245
|
}
|
|
13239
13246
|
if (props.ssr && props.static) {
|
|
@@ -13935,6 +13942,22 @@ var alertFeature = defineFeature({
|
|
|
13935
13942
|
|
|
13936
13943
|
// src/feature/layer/index.ts
|
|
13937
13944
|
import { Asset as Asset7, aws as aws26, Node as Node26 } from "@awsless/formation";
|
|
13945
|
+
var stackSearch = (stack, key) => {
|
|
13946
|
+
let found = [];
|
|
13947
|
+
function search(obj) {
|
|
13948
|
+
if (typeof obj !== "object" || obj === null) return;
|
|
13949
|
+
if (obj[key]) {
|
|
13950
|
+
found.push(obj[key]);
|
|
13951
|
+
}
|
|
13952
|
+
for (let k in obj) {
|
|
13953
|
+
if (typeof obj[k] === "object") {
|
|
13954
|
+
search(obj[k]);
|
|
13955
|
+
}
|
|
13956
|
+
}
|
|
13957
|
+
}
|
|
13958
|
+
search(stack);
|
|
13959
|
+
return found;
|
|
13960
|
+
};
|
|
13938
13961
|
var layerFeature = defineFeature({
|
|
13939
13962
|
name: "layer",
|
|
13940
13963
|
onBefore(ctx) {
|
|
@@ -13955,6 +13978,17 @@ var layerFeature = defineFeature({
|
|
|
13955
13978
|
});
|
|
13956
13979
|
ctx.shared.set("layer-bucket-name", bucket.name);
|
|
13957
13980
|
},
|
|
13981
|
+
onValidate(ctx) {
|
|
13982
|
+
const layers = Object.keys(ctx.appConfig.defaults.layers ?? []);
|
|
13983
|
+
for (const stack of ctx.stackConfigs) {
|
|
13984
|
+
const stackLayers = stackSearch(stack, "layers").flat();
|
|
13985
|
+
for (const layer of stackLayers) {
|
|
13986
|
+
if (!layers.includes(layer)) {
|
|
13987
|
+
throw new FileError(stack.file, `Layer "${layer}" is not defined in app.json`);
|
|
13988
|
+
}
|
|
13989
|
+
}
|
|
13990
|
+
}
|
|
13991
|
+
},
|
|
13958
13992
|
onApp(ctx) {
|
|
13959
13993
|
const layers = Object.entries(ctx.appConfig.defaults.layers ?? {});
|
|
13960
13994
|
if (layers.length === 0) {
|
|
@@ -14582,6 +14616,7 @@ var buildAssets = async (builders, stackFilters, showResult = false) => {
|
|
|
14582
14616
|
});
|
|
14583
14617
|
results.push({ ...builder, result });
|
|
14584
14618
|
} catch (error) {
|
|
14619
|
+
console.log(error);
|
|
14585
14620
|
logError(new Error(`Build failed for: ${builder.type} ${builder.name}`));
|
|
14586
14621
|
throw error;
|
|
14587
14622
|
}
|