@effortless-aws/cli 0.2.1 → 0.2.2
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/cli/index.js +13 -37
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -1943,56 +1943,36 @@ var ensureFunctionUrl = (functionName) => Effect13.gen(function* () {
|
|
|
1943
1943
|
)
|
|
1944
1944
|
);
|
|
1945
1945
|
if (existing) {
|
|
1946
|
-
yield*
|
|
1946
|
+
yield* lambda_exports.make("update_function_url_config", {
|
|
1947
|
+
FunctionName: functionName,
|
|
1948
|
+
AuthType: "NONE"
|
|
1949
|
+
});
|
|
1947
1950
|
return { functionUrl: existing.FunctionUrl };
|
|
1948
1951
|
}
|
|
1949
1952
|
yield* Effect13.logDebug(`Creating Function URL for: ${functionName}`);
|
|
1950
1953
|
const result = yield* lambda_exports.make("create_function_url_config", {
|
|
1951
1954
|
FunctionName: functionName,
|
|
1952
|
-
AuthType: "
|
|
1955
|
+
AuthType: "NONE",
|
|
1953
1956
|
InvokeMode: "BUFFERED"
|
|
1954
1957
|
});
|
|
1955
1958
|
return { functionUrl: result.FunctionUrl };
|
|
1956
1959
|
});
|
|
1957
|
-
var
|
|
1960
|
+
var addFunctionUrlPublicAccess = (functionName) => Effect13.gen(function* () {
|
|
1958
1961
|
const statements = [
|
|
1959
|
-
{
|
|
1960
|
-
|
|
1961
|
-
action: "lambda:InvokeFunctionUrl",
|
|
1962
|
-
authType: "AWS_IAM"
|
|
1963
|
-
},
|
|
1964
|
-
{
|
|
1965
|
-
statementId: "cloudfront-oac-invoke",
|
|
1966
|
-
action: "lambda:InvokeFunction",
|
|
1967
|
-
authType: void 0
|
|
1968
|
-
}
|
|
1962
|
+
{ statementId: "function-url-public", action: "lambda:InvokeFunctionUrl", urlAuthType: "NONE" },
|
|
1963
|
+
{ statementId: "function-url-invoke", action: "lambda:InvokeFunction", urlAuthType: void 0 }
|
|
1969
1964
|
];
|
|
1970
1965
|
for (const stmt of statements) {
|
|
1971
1966
|
yield* lambda_exports.make("add_permission", {
|
|
1972
1967
|
FunctionName: functionName,
|
|
1973
1968
|
StatementId: stmt.statementId,
|
|
1974
1969
|
Action: stmt.action,
|
|
1975
|
-
Principal: "
|
|
1976
|
-
|
|
1977
|
-
...stmt.authType ? { FunctionUrlAuthType: stmt.authType } : {}
|
|
1970
|
+
Principal: "*",
|
|
1971
|
+
...stmt.urlAuthType ? { FunctionUrlAuthType: stmt.urlAuthType } : {}
|
|
1978
1972
|
}).pipe(
|
|
1979
1973
|
Effect13.catchIf(
|
|
1980
1974
|
(e) => e._tag === "LambdaError" && e.is("ResourceConflictException"),
|
|
1981
|
-
() => Effect13.
|
|
1982
|
-
yield* Effect13.logDebug(`Permission ${stmt.statementId} exists for ${functionName}, replacing...`);
|
|
1983
|
-
yield* lambda_exports.make("remove_permission", {
|
|
1984
|
-
FunctionName: functionName,
|
|
1985
|
-
StatementId: stmt.statementId
|
|
1986
|
-
});
|
|
1987
|
-
yield* lambda_exports.make("add_permission", {
|
|
1988
|
-
FunctionName: functionName,
|
|
1989
|
-
StatementId: stmt.statementId,
|
|
1990
|
-
Action: stmt.action,
|
|
1991
|
-
Principal: "cloudfront.amazonaws.com",
|
|
1992
|
-
SourceArn: distributionArn,
|
|
1993
|
-
...stmt.authType ? { FunctionUrlAuthType: stmt.authType } : {}
|
|
1994
|
-
});
|
|
1995
|
-
})
|
|
1975
|
+
() => Effect13.logDebug(`Permission ${stmt.statementId} already exists for ${functionName}`)
|
|
1996
1976
|
)
|
|
1997
1977
|
);
|
|
1998
1978
|
}
|
|
@@ -3627,7 +3607,7 @@ var ensureDistribution = (input) => Effect21.gen(function* () {
|
|
|
3627
3607
|
};
|
|
3628
3608
|
});
|
|
3629
3609
|
var ensureSsrDistribution = (input) => Effect21.gen(function* () {
|
|
3630
|
-
const { project, stage, handlerName, bucketName, bucketRegion, s3OacId, lambdaOriginDomain,
|
|
3610
|
+
const { project, stage, handlerName, bucketName, bucketRegion, s3OacId, lambdaOriginDomain, assetPatterns, tags, aliases, acmCertificateArn, apiOriginDomain, routePatterns } = input;
|
|
3631
3611
|
const comment = makeDistComment(project, stage, handlerName);
|
|
3632
3612
|
const lambdaOriginId = `Lambda-${project}-${stage}-${handlerName}`;
|
|
3633
3613
|
const s3OriginId = `S3-${bucketName}`;
|
|
@@ -3648,7 +3628,6 @@ var ensureSsrDistribution = (input) => Effect21.gen(function* () {
|
|
|
3648
3628
|
Id: lambdaOriginId,
|
|
3649
3629
|
DomainName: lambdaOriginDomain,
|
|
3650
3630
|
OriginPath: "",
|
|
3651
|
-
OriginAccessControlId: lambdaOacId,
|
|
3652
3631
|
CustomOriginConfig: {
|
|
3653
3632
|
HTTPPort: 80,
|
|
3654
3633
|
HTTPSPort: 443,
|
|
@@ -5009,8 +4988,6 @@ var deployApp = (input) => Effect29.gen(function* () {
|
|
|
5009
4988
|
});
|
|
5010
4989
|
const s3OacName = `${project}-${stage}-oac`;
|
|
5011
4990
|
const { oacId: s3OacId } = yield* ensureOAC({ name: s3OacName, originType: "s3" });
|
|
5012
|
-
const lambdaOacName = `${project}-${stage}-lambda-oac`;
|
|
5013
|
-
const { oacId: lambdaOacId } = yield* ensureOAC({ name: lambdaOacName, originType: "lambda" });
|
|
5014
4991
|
const assetsDir = path5.resolve(projectDir, config.assets);
|
|
5015
4992
|
const assetPatterns = detectAssetPatterns(assetsDir);
|
|
5016
4993
|
yield* Effect29.logDebug(`Detected ${assetPatterns.length} asset pattern(s): ${assetPatterns.join(", ")}`);
|
|
@@ -5030,14 +5007,13 @@ var deployApp = (input) => Effect29.gen(function* () {
|
|
|
5030
5007
|
bucketRegion: region,
|
|
5031
5008
|
s3OacId,
|
|
5032
5009
|
lambdaOriginDomain,
|
|
5033
|
-
lambdaOacId,
|
|
5034
5010
|
assetPatterns,
|
|
5035
5011
|
tags: makeTags(tagCtx, "cloudfront-distribution"),
|
|
5036
5012
|
aliases,
|
|
5037
5013
|
acmCertificateArn,
|
|
5038
5014
|
...input.apiOriginDomain && routePatterns.length > 0 ? { apiOriginDomain: input.apiOriginDomain, routePatterns } : {}
|
|
5039
5015
|
});
|
|
5040
|
-
yield*
|
|
5016
|
+
yield* addFunctionUrlPublicAccess(lambdaName);
|
|
5041
5017
|
yield* putBucketPolicyForOAC(bucketName, distributionArn);
|
|
5042
5018
|
yield* syncFiles({ bucketName, sourceDir: assetsDir });
|
|
5043
5019
|
yield* invalidateDistribution(distributionId);
|