@wraps.dev/cli 2.22.1 → 2.22.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.
Binary file
package/dist/cli.js CHANGED
@@ -32060,6 +32060,44 @@ import { confirm as confirm19, intro as intro36, isCancel as isCancel27, log as
32060
32060
  import * as pulumi24 from "@pulumi/pulumi";
32061
32061
  import pc44 from "picocolors";
32062
32062
  init_events();
32063
+
32064
+ // src/utils/selfhost/api-url.ts
32065
+ init_esm_shims();
32066
+ init_metadata();
32067
+ var SELFHOST_API_FUNCTION_NAME = "wraps-selfhost-api";
32068
+ async function resolveSelfhostApiUrl(region) {
32069
+ try {
32070
+ const { LambdaClient: LambdaClient3, GetFunctionUrlConfigCommand } = await import("@aws-sdk/client-lambda");
32071
+ const lambda5 = new LambdaClient3({ region });
32072
+ const result = await lambda5.send(
32073
+ new GetFunctionUrlConfigCommand({
32074
+ FunctionName: SELFHOST_API_FUNCTION_NAME
32075
+ })
32076
+ );
32077
+ return result.FunctionUrl ?? null;
32078
+ } catch {
32079
+ return null;
32080
+ }
32081
+ }
32082
+ async function reconcileSelfhostApiUrl(metadata, region) {
32083
+ const selfhost = metadata.services.selfhost;
32084
+ if (!selfhost) {
32085
+ return null;
32086
+ }
32087
+ if (selfhost.apiUrl) {
32088
+ return selfhost.apiUrl;
32089
+ }
32090
+ const recovered = await resolveSelfhostApiUrl(region);
32091
+ if (!recovered) {
32092
+ return null;
32093
+ }
32094
+ selfhost.apiUrl = recovered;
32095
+ metadata.timestamp = (/* @__PURE__ */ new Date()).toISOString();
32096
+ await saveConnectionMetadata(metadata);
32097
+ return recovered;
32098
+ }
32099
+
32100
+ // src/commands/platform/connect.ts
32063
32101
  init_aws();
32064
32102
  init_config();
32065
32103
  init_errors();
@@ -32491,6 +32529,9 @@ async function authenticatedConnect(token, options) {
32491
32529
  progress
32492
32530
  );
32493
32531
  const selfhostService = metadata.services.selfhost;
32532
+ if (selfhosted && selfhostService) {
32533
+ await reconcileSelfhostApiUrl(metadata, region);
32534
+ }
32494
32535
  if (selfhosted && !selfhostService?.apiUrl) {
32495
32536
  progress.stop();
32496
32537
  log38.error(
@@ -33959,12 +34000,13 @@ async function selfhostDeploy(options) {
33959
34000
  timestamp: deployedAt,
33960
34001
  services: {}
33961
34002
  };
34003
+ const priorApiUrl = savedMetadata.services.selfhost?.apiUrl ?? "";
33962
34004
  savedMetadata.services.selfhost = {
33963
34005
  deployedAt,
33964
34006
  pulumiStackName: stackName,
33965
34007
  config: selfhostConfig,
33966
- apiUrl: ""
33967
- // Updated with real URL after Pulumi succeeds
34008
+ apiUrl: priorApiUrl
34009
+ // Refreshed from Pulumi outputs after deploy succeeds
33968
34010
  };
33969
34011
  savedMetadata.timestamp = deployedAt;
33970
34012
  await saveConnectionMetadata(savedMetadata);
@@ -34130,12 +34172,12 @@ async function selfhostDeploy(options) {
34130
34172
  // src/commands/selfhost/env.ts
34131
34173
  init_esm_shims();
34132
34174
  init_events();
34175
+ import * as clack45 from "@clack/prompts";
34176
+ import pc48 from "picocolors";
34133
34177
  init_aws();
34134
34178
  init_json_output();
34135
34179
  init_metadata();
34136
34180
  init_region_resolver();
34137
- import * as clack45 from "@clack/prompts";
34138
- import pc48 from "picocolors";
34139
34181
  async function selfhostEnv(options) {
34140
34182
  const startTime = Date.now();
34141
34183
  if (!isJsonMode()) {
@@ -34159,7 +34201,8 @@ Run ${pc48.cyan("wraps selfhost deploy")} to deploy the self-hosted control plan
34159
34201
  process.exit(1);
34160
34202
  return;
34161
34203
  }
34162
- const { config: config2, apiUrl } = metadata.services.selfhost;
34204
+ const { config: config2 } = metadata.services.selfhost;
34205
+ const apiUrl = await reconcileSelfhostApiUrl(metadata, region);
34163
34206
  if (!apiUrl) {
34164
34207
  clack45.log.error(
34165
34208
  "Self-hosted deployment is incomplete \u2014 API URL is not available yet."
@@ -34384,13 +34427,13 @@ Run ${pc49.cyan("wraps selfhost deploy")} to deploy the self-hosted control plan
34384
34427
  // src/commands/selfhost/status.ts
34385
34428
  init_esm_shims();
34386
34429
  init_events();
34430
+ import * as clack47 from "@clack/prompts";
34431
+ import pc50 from "picocolors";
34387
34432
  init_aws();
34388
34433
  init_json_output();
34389
34434
  init_metadata();
34390
34435
  init_output();
34391
34436
  init_region_resolver();
34392
- import * as clack47 from "@clack/prompts";
34393
- import pc50 from "picocolors";
34394
34437
  function displaySelfhostStatus(options) {
34395
34438
  const lines = [];
34396
34439
  lines.push(pc50.bold(pc50.green("Self-Hosted Control Plane Active")));
@@ -34438,9 +34481,10 @@ Run ${pc50.cyan("wraps selfhost deploy")} to deploy the self-hosted control plan
34438
34481
  progress.stop();
34439
34482
  const selfhostService = metadata.services.selfhost;
34440
34483
  const config2 = selfhostService.config;
34484
+ const apiUrl = await reconcileSelfhostApiUrl(metadata, region) ?? selfhostService.apiUrl;
34441
34485
  const statusData = {
34442
34486
  region,
34443
- apiUrl: selfhostService.apiUrl,
34487
+ apiUrl,
34444
34488
  deployedAt: selfhostService.deployedAt,
34445
34489
  neonProjectId: config2.neonProjectId,
34446
34490
  appUrl: config2.appUrl,