@base44-preview/cli 0.0.31-pr.211.25a2296 → 0.0.31-pr.211.cb90710

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 CHANGED
@@ -194298,15 +194298,60 @@ defineLazyProperty(apps, "safari", () => detectPlatformBinary({
194298
194298
  var open_default = open;
194299
194299
 
194300
194300
  // src/cli/commands/connectors/oauth-prompt.ts
194301
+ var POLL_INTERVAL_MS = 2000;
194302
+ var POLL_TIMEOUT_MS = 2 * 60 * 1000;
194301
194303
  function filterPendingOAuth(results) {
194302
194304
  return results.filter((r2) => r2.action === "needs_oauth" && !!r2.redirectUrl && !!r2.connectionId);
194303
194305
  }
194306
+ async function runOAuthFlowWithSkip(connector2) {
194307
+ await open_default(connector2.redirectUrl);
194308
+ let finalStatus = "PENDING";
194309
+ let skipped = false;
194310
+ const s = Y2();
194311
+ const originalExit = process.exit;
194312
+ process.exit = () => {
194313
+ skipped = true;
194314
+ s.stop(`${connector2.type} skipped`);
194315
+ };
194316
+ s.start(`Waiting for ${connector2.type} authorization... (Esc to skip)`);
194317
+ try {
194318
+ await pWaitFor(async () => {
194319
+ if (skipped) {
194320
+ finalStatus = "SKIPPED";
194321
+ return true;
194322
+ }
194323
+ const response = await getOAuthStatus(connector2.type, connector2.connectionId);
194324
+ finalStatus = response.status;
194325
+ return response.status !== "PENDING";
194326
+ }, {
194327
+ interval: POLL_INTERVAL_MS,
194328
+ timeout: POLL_TIMEOUT_MS
194329
+ });
194330
+ } catch (err) {
194331
+ if (err instanceof TimeoutError2) {
194332
+ finalStatus = "PENDING";
194333
+ } else {
194334
+ throw err;
194335
+ }
194336
+ } finally {
194337
+ process.exit = originalExit;
194338
+ if (!skipped) {
194339
+ if (finalStatus === "ACTIVE") {
194340
+ s.stop(`${connector2.type} authorization complete`);
194341
+ } else if (finalStatus === "FAILED") {
194342
+ s.stop(`${connector2.type} authorization failed`);
194343
+ } else {
194344
+ s.stop(`${connector2.type} authorization timed out`);
194345
+ }
194346
+ }
194347
+ }
194348
+ return finalStatus;
194349
+ }
194304
194350
  async function promptOAuthFlows(pending, options) {
194305
194351
  const outcomes = new Map;
194306
194352
  if (pending.length === 0) {
194307
194353
  return outcomes;
194308
194354
  }
194309
- M2.info("");
194310
194355
  M2.warn(`${pending.length} connector(s) require authorization in your browser:`);
194311
194356
  for (const connector2 of pending) {
194312
194357
  M2.info(` ${connector2.type}: ${theme.styles.dim(connector2.redirectUrl)}`);
@@ -194321,30 +194366,15 @@ async function promptOAuthFlows(pending, options) {
194321
194366
  return outcomes;
194322
194367
  }
194323
194368
  for (const connector2 of pending) {
194324
- M2.info(`
194369
+ try {
194370
+ M2.info(`
194325
194371
  Opening browser for ${connector2.type}...`);
194326
- await open_default(connector2.redirectUrl);
194327
- let finalStatus = "PENDING";
194328
- await runTask(`Waiting for ${connector2.type} authorization...`, async () => {
194329
- await pWaitFor(async () => {
194330
- const response = await getOAuthStatus(connector2.type, connector2.connectionId);
194331
- finalStatus = response.status;
194332
- return response.status !== "PENDING";
194333
- }, {
194334
- interval: 2000,
194335
- timeout: 2 * 60 * 1000
194336
- });
194337
- }, {
194338
- successMessage: `${connector2.type} authorization complete`,
194339
- errorMessage: `${connector2.type} authorization failed`
194340
- }).catch((err) => {
194341
- if (err instanceof TimeoutError2) {
194342
- finalStatus = "PENDING";
194343
- } else {
194344
- throw err;
194345
- }
194346
- });
194347
- outcomes.set(connector2.type, finalStatus);
194372
+ const status = await runOAuthFlowWithSkip(connector2);
194373
+ outcomes.set(connector2.type, status);
194374
+ } catch (err) {
194375
+ M2.error(`Failed to authorize ${connector2.type}: ${err instanceof Error ? err.message : String(err)}`);
194376
+ outcomes.set(connector2.type, "FAILED");
194377
+ }
194348
194378
  }
194349
194379
  return outcomes;
194350
194380
  }
@@ -194354,6 +194384,7 @@ function printSummary(results, oauthOutcomes) {
194354
194384
  const synced = [];
194355
194385
  const added = [];
194356
194386
  const removed = [];
194387
+ const skipped = [];
194357
194388
  const failed = [];
194358
194389
  for (const r2 of results) {
194359
194390
  const oauthStatus = oauthOutcomes.get(r2.type);
@@ -194366,6 +194397,8 @@ function printSummary(results, oauthOutcomes) {
194366
194397
  } else if (r2.action === "needs_oauth") {
194367
194398
  if (oauthStatus === "ACTIVE") {
194368
194399
  added.push(r2.type);
194400
+ } else if (oauthStatus === "SKIPPED") {
194401
+ skipped.push(r2.type);
194369
194402
  } else if (oauthStatus === "PENDING") {
194370
194403
  failed.push({ type: r2.type, error: "authorization timed out" });
194371
194404
  } else if (oauthStatus === "FAILED") {
@@ -194375,7 +194408,6 @@ function printSummary(results, oauthOutcomes) {
194375
194408
  }
194376
194409
  }
194377
194410
  }
194378
- M2.info("");
194379
194411
  M2.info(theme.styles.bold("Summary:"));
194380
194412
  if (synced.length > 0) {
194381
194413
  M2.success(`Synced: ${synced.join(", ")}`);
@@ -194386,6 +194418,9 @@ function printSummary(results, oauthOutcomes) {
194386
194418
  if (removed.length > 0) {
194387
194419
  M2.info(theme.styles.dim(`Removed: ${removed.join(", ")}`));
194388
194420
  }
194421
+ if (skipped.length > 0) {
194422
+ M2.warn(`Skipped: ${skipped.join(", ")}`);
194423
+ }
194389
194424
  for (const r2 of failed) {
194390
194425
  M2.error(`Failed: ${r2.type}${r2.error ? ` - ${r2.error}` : ""}`);
194391
194426
  }
@@ -199643,4 +199678,4 @@ export {
199643
199678
  CLIExitError
199644
199679
  };
199645
199680
 
199646
- //# debugId=CEF794213C64721E64756E2164756E21
199681
+ //# debugId=3B396D1D0D9A865164756E2164756E21