@wraps.dev/cli 2.22.3 → 2.22.5

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.
Binary file
package/dist/cli.js CHANGED
@@ -32099,6 +32099,9 @@ init_events();
32099
32099
  init_esm_shims();
32100
32100
  init_metadata();
32101
32101
  var SELFHOST_API_FUNCTION_NAME = "wraps-selfhost-api";
32102
+ function normalizeApiUrl(url) {
32103
+ return url.replace(/\/+$/, "");
32104
+ }
32102
32105
  async function resolveSelfhostApiUrl(region) {
32103
32106
  try {
32104
32107
  const { LambdaClient: LambdaClient3, GetFunctionUrlConfigCommand } = await import("@aws-sdk/client-lambda");
@@ -32108,7 +32111,7 @@ async function resolveSelfhostApiUrl(region) {
32108
32111
  FunctionName: SELFHOST_API_FUNCTION_NAME
32109
32112
  })
32110
32113
  );
32111
- return result.FunctionUrl ?? null;
32114
+ return result.FunctionUrl ? normalizeApiUrl(result.FunctionUrl) : null;
32112
32115
  } catch {
32113
32116
  return null;
32114
32117
  }
@@ -32119,7 +32122,7 @@ async function reconcileSelfhostApiUrl(metadata, region) {
32119
32122
  return null;
32120
32123
  }
32121
32124
  if (selfhost.apiUrl) {
32122
- return selfhost.apiUrl;
32125
+ return normalizeApiUrl(selfhost.apiUrl);
32123
32126
  }
32124
32127
  const recovered = await resolveSelfhostApiUrl(region);
32125
32128
  if (!recovered) {
@@ -32576,7 +32579,7 @@ Run ${pc44.cyan("wraps selfhost deploy")} to finish deploying the self-hosted co
32576
32579
  );
32577
32580
  process.exit(1);
32578
32581
  }
32579
- const apiBaseUrl = selfhosted && selfhostService ? selfhostService.apiUrl : getApiBaseUrl();
32582
+ const apiBaseUrl = selfhosted && selfhostService ? normalizeApiUrl(selfhostService.apiUrl) : getApiBaseUrl();
32580
32583
  const dashboardUrl = selfhosted && selfhostService ? selfhostService.config.appUrl : getAppBaseUrl();
32581
32584
  const hasEmail = !!metadata.services.email?.config;
32582
32585
  let token;
@@ -34306,22 +34309,51 @@ The deployment may have failed partway through. Re-run ${pc48.cyan("wraps selfho
34306
34309
  "# ============================================================================="
34307
34310
  );
34308
34311
  console.log("#");
34309
- console.log("# 1. In Vercel: Project Settings \u2192 Cloud \u2192 Configure AWS");
34312
+ console.log("# 1. In AWS IAM \u2192 Identity providers \u2192 Add provider:");
34313
+ console.log("# Provider type: OpenID Connect");
34314
+ console.log("# Provider URL: https://oidc.vercel.com/<team-slug>");
34315
+ console.log("# Audience: https://vercel.com/<team-slug>");
34316
+ console.log("#");
34310
34317
  console.log(
34311
- "# Copy the OIDC Provider URL (looks like https://oidc.vercel.com/<team-id>)"
34318
+ "# 3. Create an IAM role in this account with the following trust policy,"
34312
34319
  );
34320
+ console.log("# replacing <team-slug> with your Vercel team slug:");
34313
34321
  console.log("#");
34314
- console.log("# 2. In AWS IAM \u2192 Identity providers \u2192 Add provider:");
34315
- console.log("# Provider type: OpenID Connect");
34316
- console.log("# Provider URL: <your Vercel OIDC URL from step 1>");
34317
- console.log("# Audience: sts.amazonaws.com");
34318
- console.log("#");
34322
+ console.log("# {");
34323
+ console.log(`# "Version": "2012-10-17",`);
34324
+ console.log(`# "Statement": [{`);
34325
+ console.log(`# "Effect": "Allow",`);
34326
+ console.log(`# "Principal": {`);
34319
34327
  console.log(
34320
- "# 3. Create an IAM role that trusts that OIDC provider, with this permission:"
34328
+ `# "Federated": "arn:aws:iam::${identity.accountId}:oidc-provider/oidc.vercel.com/<team-slug>"`
34321
34329
  );
34330
+ console.log("# },");
34331
+ console.log(`# "Action": "sts:AssumeRoleWithWebIdentity",`);
34332
+ console.log(`# "Condition": {`);
34333
+ console.log(`# "StringEquals": {`);
34334
+ console.log(
34335
+ `# "oidc.vercel.com/<team-slug>:aud": "https://vercel.com/<team-slug>",`
34336
+ );
34337
+ console.log(
34338
+ `# "oidc.vercel.com/<team-slug>:sub": "owner:<team-slug>:project:<project-name>:environment:production"`
34339
+ );
34340
+ console.log("# }");
34341
+ console.log("# }");
34342
+ console.log("# }]");
34343
+ console.log("# }");
34344
+ console.log("#");
34345
+ console.log("# Attach this permission policy to the role:");
34346
+ console.log("#");
34347
+ console.log("# {");
34348
+ console.log(`# "Version": "2012-10-17",`);
34349
+ console.log(`# "Statement": [{`);
34350
+ console.log(`# "Effect": "Allow",`);
34351
+ console.log(`# "Action": "sts:AssumeRole",`);
34322
34352
  console.log(
34323
- `# sts:AssumeRole on arn:aws:iam::${identity.accountId}:role/wraps-console-access-role`
34353
+ `# "Resource": "arn:aws:iam::*:role/wraps-console-access-role"`
34324
34354
  );
34355
+ console.log("# }]");
34356
+ console.log("# }");
34325
34357
  console.log("#");
34326
34358
  console.log("# 4. Set AWS_ROLE_ARN to that role's ARN in Vercel:");
34327
34359
  console.log(