@effortless-aws/cli 0.2.1 → 0.2.3

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.
Files changed (2) hide show
  1. package/dist/cli/index.js +17 -40
  2. 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* Effect13.logDebug(`Function URL already exists: ${existing.FunctionUrl}`);
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: "AWS_IAM",
1955
+ AuthType: "NONE",
1953
1956
  InvokeMode: "BUFFERED"
1954
1957
  });
1955
1958
  return { functionUrl: result.FunctionUrl };
1956
1959
  });
1957
- var addCloudFrontPermission = (functionName, distributionArn) => Effect13.gen(function* () {
1960
+ var addFunctionUrlPublicAccess = (functionName) => Effect13.gen(function* () {
1958
1961
  const statements = [
1959
- {
1960
- statementId: "cloudfront-oac",
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: "cloudfront.amazonaws.com",
1976
- SourceArn: distributionArn,
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.gen(function* () {
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
  }
@@ -2604,7 +2584,7 @@ var computeLockfileHash = (projectDir) => Effect18.gen(function* () {
2604
2584
  }
2605
2585
  const { packages: allPackages, resolvedPaths } = collectTransitiveDeps(projectDir, prodDeps);
2606
2586
  const packageVersions = [];
2607
- for (const pkgName of Array.from(allPackages).sort()) {
2587
+ for (const pkgName of Array.from(allPackages).filter((p) => !isAwsRuntime(p)).sort()) {
2608
2588
  const pkgPath = resolvedPaths.get(pkgName) ?? findInPnpmStore(projectDir, pkgName) ?? getPackageRealPath(projectDir, pkgName);
2609
2589
  if (pkgPath) {
2610
2590
  const version2 = getPackageVersion(pkgPath);
@@ -2805,7 +2785,7 @@ var collectTransitiveDeps = (projectDir, rootDeps, searchPath = path.join(projec
2805
2785
  }
2806
2786
  return { packages: visited, resolvedPaths, warnings };
2807
2787
  };
2808
- var isAwsRuntime = (pkg) => pkg.startsWith("@aws-sdk/") || pkg.startsWith("@smithy/");
2788
+ var isAwsRuntime = (pkg) => pkg.startsWith("@aws-sdk/") || pkg.startsWith("@smithy/") || pkg.startsWith("@aws-crypto/") || pkg.startsWith("@aws/");
2809
2789
  var collectLayerPackages = (projectDir, dependencies) => {
2810
2790
  if (dependencies.length === 0) return { packages: [], resolvedPaths: /* @__PURE__ */ new Map(), warnings: [] };
2811
2791
  const { packages, resolvedPaths, warnings } = collectTransitiveDeps(projectDir, dependencies);
@@ -2846,7 +2826,8 @@ var collectLayerPackages = (projectDir, dependencies) => {
2846
2826
  }
2847
2827
  }
2848
2828
  }
2849
- return { packages: Array.from(packages), resolvedPaths, warnings };
2829
+ const filtered = Array.from(packages).filter((pkg) => !isAwsRuntime(pkg));
2830
+ return { packages: filtered, resolvedPaths, warnings };
2850
2831
  };
2851
2832
  var findPackagePath = (projectDir, pkgName) => {
2852
2833
  const rootPath = getPackageRealPath(projectDir, pkgName);
@@ -3627,7 +3608,7 @@ var ensureDistribution = (input) => Effect21.gen(function* () {
3627
3608
  };
3628
3609
  });
3629
3610
  var ensureSsrDistribution = (input) => Effect21.gen(function* () {
3630
- const { project, stage, handlerName, bucketName, bucketRegion, s3OacId, lambdaOriginDomain, lambdaOacId, assetPatterns, tags, aliases, acmCertificateArn, apiOriginDomain, routePatterns } = input;
3611
+ const { project, stage, handlerName, bucketName, bucketRegion, s3OacId, lambdaOriginDomain, assetPatterns, tags, aliases, acmCertificateArn, apiOriginDomain, routePatterns } = input;
3631
3612
  const comment = makeDistComment(project, stage, handlerName);
3632
3613
  const lambdaOriginId = `Lambda-${project}-${stage}-${handlerName}`;
3633
3614
  const s3OriginId = `S3-${bucketName}`;
@@ -3648,7 +3629,6 @@ var ensureSsrDistribution = (input) => Effect21.gen(function* () {
3648
3629
  Id: lambdaOriginId,
3649
3630
  DomainName: lambdaOriginDomain,
3650
3631
  OriginPath: "",
3651
- OriginAccessControlId: lambdaOacId,
3652
3632
  CustomOriginConfig: {
3653
3633
  HTTPPort: 80,
3654
3634
  HTTPSPort: 443,
@@ -5009,8 +4989,6 @@ var deployApp = (input) => Effect29.gen(function* () {
5009
4989
  });
5010
4990
  const s3OacName = `${project}-${stage}-oac`;
5011
4991
  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
4992
  const assetsDir = path5.resolve(projectDir, config.assets);
5015
4993
  const assetPatterns = detectAssetPatterns(assetsDir);
5016
4994
  yield* Effect29.logDebug(`Detected ${assetPatterns.length} asset pattern(s): ${assetPatterns.join(", ")}`);
@@ -5030,14 +5008,13 @@ var deployApp = (input) => Effect29.gen(function* () {
5030
5008
  bucketRegion: region,
5031
5009
  s3OacId,
5032
5010
  lambdaOriginDomain,
5033
- lambdaOacId,
5034
5011
  assetPatterns,
5035
5012
  tags: makeTags(tagCtx, "cloudfront-distribution"),
5036
5013
  aliases,
5037
5014
  acmCertificateArn,
5038
5015
  ...input.apiOriginDomain && routePatterns.length > 0 ? { apiOriginDomain: input.apiOriginDomain, routePatterns } : {}
5039
5016
  });
5040
- yield* addCloudFrontPermission(lambdaName, distributionArn);
5017
+ yield* addFunctionUrlPublicAccess(lambdaName);
5041
5018
  yield* putBucketPolicyForOAC(bucketName, distributionArn);
5042
5019
  yield* syncFiles({ bucketName, sourceDir: assetsDir });
5043
5020
  yield* invalidateDistribution(distributionId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effortless-aws/cli",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "CLI and deploy tooling for effortless-aws",