@base44-preview/cli 0.0.30-pr.211.a31cce0 → 0.0.30-pr.211.da98bee

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
@@ -162253,13 +162253,13 @@ async function deployAll(projectData) {
162253
162253
  await entityResource.push(entities);
162254
162254
  await functionResource.push(functions);
162255
162255
  await agentResource.push(agents);
162256
- await connectorResource.push(connectors);
162256
+ const { results: connectorResults } = await pushConnectors(connectors);
162257
162257
  if (project.site?.outputDirectory) {
162258
162258
  const outputDir = resolve(project.root, project.site.outputDirectory);
162259
162259
  const { appUrl } = await deploySite(outputDir);
162260
- return { appUrl };
162260
+ return { appUrl, connectorResults };
162261
162261
  }
162262
- return {};
162262
+ return { connectorResults };
162263
162263
  }
162264
162264
  // src/core/clients/base44-client.ts
162265
162265
  var retriedRequests = new WeakSet;
@@ -169889,10 +169889,48 @@ function getWhoamiCommand(context) {
169889
169889
  });
169890
169890
  }
169891
169891
 
169892
- // src/cli/commands/connectors/push.ts
169893
- function isPendingOAuth(r2) {
169894
- return r2.action === "needs_oauth" && !!r2.redirectUrl && !!r2.connectionId;
169892
+ // src/cli/commands/connectors/oauth-prompt.ts
169893
+ function filterPendingOAuth(results) {
169894
+ return results.filter((r2) => r2.action === "needs_oauth" && !!r2.redirectUrl && !!r2.connectionId);
169895
+ }
169896
+ async function promptOAuthFlows(pending, options) {
169897
+ const outcomes = new Map;
169898
+ if (pending.length === 0) {
169899
+ return outcomes;
169900
+ }
169901
+ M2.info("");
169902
+ M2.warn(`${pending.length} connector(s) require authorization in your browser:`);
169903
+ for (const connector2 of pending) {
169904
+ M2.info(` ${connector2.type}: ${theme.styles.dim(connector2.redirectUrl)}`);
169905
+ }
169906
+ if (options?.skipPrompt) {
169907
+ return outcomes;
169908
+ }
169909
+ const shouldAuth = await ye({
169910
+ message: "Open browser to authorize now?"
169911
+ });
169912
+ if (pD(shouldAuth) || !shouldAuth) {
169913
+ return outcomes;
169914
+ }
169915
+ for (const connector2 of pending) {
169916
+ M2.info(`
169917
+ Opening browser for ${connector2.type}...`);
169918
+ const oauthResult = await runTask(`Waiting for ${connector2.type} authorization...`, async () => {
169919
+ return await runOAuthFlow({
169920
+ type: connector2.type,
169921
+ redirectUrl: connector2.redirectUrl,
169922
+ connectionId: connector2.connectionId
169923
+ });
169924
+ }, {
169925
+ successMessage: `${connector2.type} authorization complete`,
169926
+ errorMessage: `${connector2.type} authorization failed`
169927
+ });
169928
+ outcomes.set(connector2.type, oauthResult.status);
169929
+ }
169930
+ return outcomes;
169895
169931
  }
169932
+
169933
+ // src/cli/commands/connectors/push.ts
169896
169934
  function printSummary(results, oauthOutcomes) {
169897
169935
  const synced = [];
169898
169936
  const added = [];
@@ -169944,42 +169982,14 @@ async function pushConnectorsAction() {
169944
169982
  const { results } = await runTask("Pushing connectors to Base44", async () => {
169945
169983
  return await pushConnectors(connectors);
169946
169984
  });
169947
- const oauthOutcomes = new Map;
169948
- const needsOAuth = results.filter(isPendingOAuth);
169985
+ const needsOAuth = filterPendingOAuth(results);
169949
169986
  let outroMessage = "Connectors pushed to Base44";
169950
- if (needsOAuth.length > 0) {
169951
- M2.info("");
169952
- M2.warn(`${needsOAuth.length} connector(s) require authorization in your browser:`);
169953
- for (const connector2 of needsOAuth) {
169954
- M2.info(` ${connector2.type}: ${theme.styles.dim(connector2.redirectUrl)}`);
169955
- }
169987
+ const oauthOutcomes = await promptOAuthFlows(needsOAuth, {
169988
+ skipPrompt: !!process.env.CI
169989
+ });
169990
+ if (needsOAuth.length > 0 && oauthOutcomes.size === 0) {
169956
169991
  const pending = needsOAuth.map((c3) => c3.type).join(", ");
169957
- if (process.env.CI) {
169958
- outroMessage = `Skipped OAuth in CI. Pending: ${pending}. Run 'base44 connectors push' locally to authorize.`;
169959
- } else {
169960
- const shouldAuth = await ye({
169961
- message: "Open browser to authorize now?"
169962
- });
169963
- if (pD(shouldAuth) || !shouldAuth) {
169964
- outroMessage = `Authorization skipped. Pending: ${pending}. Run 'base44 connectors push' again to complete.`;
169965
- } else {
169966
- for (const connector2 of needsOAuth) {
169967
- M2.info(`
169968
- Opening browser for ${connector2.type}...`);
169969
- const oauthResult = await runTask(`Waiting for ${connector2.type} authorization...`, async () => {
169970
- return await runOAuthFlow({
169971
- type: connector2.type,
169972
- redirectUrl: connector2.redirectUrl,
169973
- connectionId: connector2.connectionId
169974
- });
169975
- }, {
169976
- successMessage: `${connector2.type} authorization complete`,
169977
- errorMessage: `${connector2.type} authorization failed`
169978
- });
169979
- oauthOutcomes.set(connector2.type, oauthResult.status);
169980
- }
169981
- }
169982
- }
169992
+ outroMessage = process.env.CI ? `Skipped OAuth in CI. Pending: ${pending}. Run 'base44 connectors push' locally to authorize.` : `Authorization skipped. Pending: ${pending}. Run 'base44 connectors push' again to complete.`;
169983
169993
  }
169984
169994
  printSummary(results, oauthOutcomes);
169985
169995
  return { outroMessage };
@@ -170308,6 +170318,16 @@ ${summaryLines.join(`
170308
170318
  successMessage: theme.colors.base44Orange("Deployment completed"),
170309
170319
  errorMessage: "Deployment failed"
170310
170320
  });
170321
+ const needsOAuth = filterPendingOAuth(result.connectorResults ?? []);
170322
+ if (needsOAuth.length > 0) {
170323
+ const oauthOutcomes = await promptOAuthFlows(needsOAuth, {
170324
+ skipPrompt: options.yes || !!process.env.CI
170325
+ });
170326
+ if (oauthOutcomes.size === 0) {
170327
+ const pending = needsOAuth.map((c3) => c3.type).join(", ");
170328
+ M2.info(`To authorize, run 'base44 connectors push' or open the links above in your browser.`);
170329
+ }
170330
+ }
170311
170331
  M2.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl())}`);
170312
170332
  if (result.appUrl) {
170313
170333
  M2.message(`${theme.styles.header("App URL")}: ${theme.colors.links(result.appUrl)}`);
@@ -174937,4 +174957,4 @@ export {
174937
174957
  CLIExitError
174938
174958
  };
174939
174959
 
174940
- //# debugId=B111445572F1B3F064756E2164756E21
174960
+ //# debugId=FE2096E0AA93AA9664756E2164756E21