@base44-preview/cli 0.0.41-pr.382.5e7988f → 0.0.41-pr.382.5f81bb2

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
@@ -16481,7 +16481,7 @@ var require_lodash = __commonJS((exports, module) => {
16481
16481
  function nth(array2, n2) {
16482
16482
  return array2 && array2.length ? baseNth(array2, toInteger(n2)) : undefined2;
16483
16483
  }
16484
- var pull3 = baseRest(pullAll);
16484
+ var pull2 = baseRest(pullAll);
16485
16485
  function pullAll(array2, values2) {
16486
16486
  return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2) : array2;
16487
16487
  }
@@ -18246,7 +18246,7 @@ __p += '`;
18246
18246
  lodash.pickBy = pickBy;
18247
18247
  lodash.property = property;
18248
18248
  lodash.propertyOf = propertyOf;
18249
- lodash.pull = pull3;
18249
+ lodash.pull = pull2;
18250
18250
  lodash.pullAll = pullAll;
18251
18251
  lodash.pullAllBy = pullAllBy;
18252
18252
  lodash.pullAllWith = pullAllWith;
@@ -237514,10 +237514,6 @@ var GoogleBigQueryConnectorSchema = exports_external.object({
237514
237514
  type: exports_external.literal("googlebigquery"),
237515
237515
  scopes: exports_external.array(exports_external.string()).default([])
237516
237516
  });
237517
- var StripeConnectorSchema = exports_external.object({
237518
- type: exports_external.literal("stripe"),
237519
- scopes: exports_external.array(exports_external.string()).default([])
237520
- });
237521
237517
  var CustomTypeSchema = exports_external.string().min(1).regex(/^[a-z0-9_-]+$/i);
237522
237518
  var GenericConnectorSchema = exports_external.object({
237523
237519
  type: CustomTypeSchema,
@@ -237537,7 +237533,6 @@ var ConnectorResourceSchema = exports_external.union([
237537
237533
  HubspotConnectorSchema,
237538
237534
  LinkedInConnectorSchema,
237539
237535
  TikTokConnectorSchema,
237540
- StripeConnectorSchema,
237541
237536
  GenericConnectorSchema
237542
237537
  ]);
237543
237538
  var KnownIntegrationTypes = [
@@ -237553,8 +237548,7 @@ var KnownIntegrationTypes = [
237553
237548
  "salesforce",
237554
237549
  "hubspot",
237555
237550
  "linkedin",
237556
- "tiktok",
237557
- "stripe"
237551
+ "tiktok"
237558
237552
  ];
237559
237553
  var IntegrationTypeSchema = exports_external.union([
237560
237554
  exports_external.enum(KnownIntegrationTypes),
@@ -237607,24 +237601,6 @@ var RemoveConnectorResponseSchema = exports_external.object({
237607
237601
  status: data.status,
237608
237602
  integrationType: data.integration_type
237609
237603
  }));
237610
- var STRIPE_CONNECTOR_TYPE = "stripe";
237611
- var InstallStripeResponseSchema = exports_external.object({
237612
- already_installed: exports_external.boolean(),
237613
- claim_url: exports_external.string().nullable()
237614
- }).transform((data) => ({
237615
- alreadyInstalled: data.already_installed,
237616
- claimUrl: data.claim_url
237617
- }));
237618
- var StripeStatusResponseSchema = exports_external.object({
237619
- stripe_mode: exports_external.enum(["sandbox", "live"]).nullable(),
237620
- sandbox_claim_url: exports_external.string().nullable().optional()
237621
- }).transform((data) => ({
237622
- stripeMode: data.stripe_mode,
237623
- sandboxClaimUrl: data.sandbox_claim_url
237624
- }));
237625
- var RemoveStripeResponseSchema = exports_external.object({
237626
- success: exports_external.boolean()
237627
- });
237628
237604
  var ConnectionConfigFieldSchema = exports_external.object({
237629
237605
  name: exports_external.string(),
237630
237606
  display_name: exports_external.string(),
@@ -237739,54 +237715,6 @@ async function removeConnector(integrationType) {
237739
237715
  }
237740
237716
  return result.data;
237741
237717
  }
237742
- async function installStripe() {
237743
- const appClient = getAppClient();
237744
- let response;
237745
- try {
237746
- response = await appClient.post("payments/stripe/install", {
237747
- timeout: 60000
237748
- });
237749
- } catch (error48) {
237750
- throw await ApiError.fromHttpError(error48, "installing Stripe");
237751
- }
237752
- const result = InstallStripeResponseSchema.safeParse(await response.json());
237753
- if (!result.success) {
237754
- throw new SchemaValidationError("Invalid response from server", result.error);
237755
- }
237756
- return result.data;
237757
- }
237758
- async function getStripeStatus() {
237759
- const appClient = getAppClient();
237760
- let response;
237761
- try {
237762
- response = await appClient.get("payments/stripe/status", {
237763
- timeout: 60000
237764
- });
237765
- } catch (error48) {
237766
- throw await ApiError.fromHttpError(error48, "checking Stripe integration status");
237767
- }
237768
- const result = StripeStatusResponseSchema.safeParse(await response.json());
237769
- if (!result.success) {
237770
- throw new SchemaValidationError("Invalid response from server", result.error);
237771
- }
237772
- return result.data;
237773
- }
237774
- async function removeStripe() {
237775
- const appClient = getAppClient();
237776
- let response;
237777
- try {
237778
- response = await appClient.delete("payments/stripe", {
237779
- timeout: 60000
237780
- });
237781
- } catch (error48) {
237782
- throw await ApiError.fromHttpError(error48, "removing Stripe integration");
237783
- }
237784
- const result = RemoveStripeResponseSchema.safeParse(await response.json());
237785
- if (!result.success) {
237786
- throw new SchemaValidationError("Invalid response from server", result.error);
237787
- }
237788
- return result.data;
237789
- }
237790
237718
  // src/core/resources/connector/config.ts
237791
237719
  import { join as join4 } from "node:path";
237792
237720
  import { isDeepStrictEqual as isDeepStrictEqual2 } from "node:util";
@@ -237835,7 +237763,7 @@ async function readAllConnectors(connectorsDir) {
237835
237763
  async function writeConnectors(connectorsDir, remoteConnectors) {
237836
237764
  const entries = await readConnectorFiles(connectorsDir);
237837
237765
  const typeToEntry = buildTypeToEntryMap(entries);
237838
- const newTypes = new Set(remoteConnectors.map((c) => c.type));
237766
+ const newTypes = new Set(remoteConnectors.map((c) => c.integrationType));
237839
237767
  const deleted = [];
237840
237768
  for (const [type, entry] of typeToEntry) {
237841
237769
  if (!newTypes.has(type)) {
@@ -237845,105 +237773,22 @@ async function writeConnectors(connectorsDir, remoteConnectors) {
237845
237773
  }
237846
237774
  const written = [];
237847
237775
  for (const connector of remoteConnectors) {
237848
- const existing = typeToEntry.get(connector.type);
237849
- if (existing && isDeepStrictEqual2(existing.data, connector)) {
237776
+ const existing = typeToEntry.get(connector.integrationType);
237777
+ const localConnector = {
237778
+ type: connector.integrationType,
237779
+ scopes: connector.scopes
237780
+ };
237781
+ if (existing && isDeepStrictEqual2(existing.data, localConnector)) {
237850
237782
  continue;
237851
237783
  }
237852
- const filePath = existing?.filePath ?? join4(connectorsDir, `${connector.type}.${CONFIG_FILE_EXTENSION}`);
237853
- await writeJsonFile(filePath, connector);
237854
- written.push(connector.type);
237784
+ const filePath = existing?.filePath ?? join4(connectorsDir, `${connector.integrationType}.${CONFIG_FILE_EXTENSION}`);
237785
+ await writeJsonFile(filePath, localConnector);
237786
+ written.push(connector.integrationType);
237855
237787
  }
237856
237788
  return { written, deleted };
237857
237789
  }
237858
- // src/core/resources/connector/stripe.ts
237859
- async function syncStripeConnector(localStripe) {
237860
- const remoteStatus = await fetchStripeRemoteStatus();
237861
- if (remoteStatus === "error") {
237862
- return localStripe ? stripeError("Failed to check Stripe integration status") : null;
237863
- }
237864
- const isRemoteInstalled = remoteStatus.stripeMode !== null;
237865
- const needsInstall = localStripe && !isRemoteInstalled;
237866
- const alreadySynced = localStripe && isRemoteInstalled;
237867
- const needsRemoval = !localStripe && isRemoteInstalled;
237868
- if (needsInstall) {
237869
- return handleStripeInstall();
237870
- }
237871
- if (alreadySynced) {
237872
- return stripeSynced();
237873
- }
237874
- if (needsRemoval) {
237875
- return handleStripeRemoval();
237876
- }
237877
- return null;
237878
- }
237879
- async function isStripeInstalled() {
237880
- const status = await getStripeStatus();
237881
- return status.stripeMode !== null;
237882
- }
237883
- async function fetchStripeRemoteStatus() {
237884
- try {
237885
- return await getStripeStatus();
237886
- } catch {
237887
- return "error";
237888
- }
237889
- }
237890
- async function handleStripeInstall() {
237891
- try {
237892
- const result = await installStripe();
237893
- return stripeProvisioned(result.claimUrl ?? undefined);
237894
- } catch (err) {
237895
- return stripeError(err instanceof Error ? err.message : String(err));
237896
- }
237897
- }
237898
- async function handleStripeRemoval() {
237899
- try {
237900
- await removeStripe();
237901
- return stripeRemoved();
237902
- } catch (err) {
237903
- return stripeError(err instanceof Error ? err.message : String(err));
237904
- }
237905
- }
237906
- function stripeSynced() {
237907
- return { type: STRIPE_CONNECTOR_TYPE, action: "synced" };
237908
- }
237909
- function stripeProvisioned(claimUrl) {
237910
- return { type: STRIPE_CONNECTOR_TYPE, action: "provisioned", claimUrl };
237911
- }
237912
- function stripeRemoved() {
237913
- return { type: STRIPE_CONNECTOR_TYPE, action: "removed" };
237914
- }
237915
- function stripeError(error48) {
237916
- return { type: STRIPE_CONNECTOR_TYPE, action: "error", error: error48 };
237917
- }
237918
-
237919
- // src/core/resources/connector/pull.ts
237920
- async function pullAllConnectors() {
237921
- const [oauthResponse, stripeInstalled] = await Promise.all([
237922
- listConnectors(),
237923
- isStripeInstalled()
237924
- ]);
237925
- const connectors = oauthResponse.integrations.map((i) => ({
237926
- type: i.integrationType,
237927
- scopes: i.scopes
237928
- }));
237929
- if (stripeInstalled) {
237930
- connectors.push({ type: STRIPE_CONNECTOR_TYPE, scopes: [] });
237931
- }
237932
- return connectors;
237933
- }
237934
237790
  // src/core/resources/connector/push.ts
237935
237791
  async function pushConnectors(connectors) {
237936
- const stripeConnector = connectors.find((c) => c.type === STRIPE_CONNECTOR_TYPE);
237937
- const oauthConnectors = connectors.filter((c) => c.type !== STRIPE_CONNECTOR_TYPE);
237938
- const oauthResults = await syncOAuthConnectors(oauthConnectors);
237939
- const stripeResult = await syncStripeConnector(stripeConnector);
237940
- const results = [...oauthResults];
237941
- if (stripeResult) {
237942
- results.push(stripeResult);
237943
- }
237944
- return { results };
237945
- }
237946
- async function syncOAuthConnectors(connectors) {
237947
237792
  const results = [];
237948
237793
  const upstream = await listConnectors();
237949
237794
  const localTypes = new Set(connectors.map((c) => c.type));
@@ -237976,7 +237821,7 @@ async function syncOAuthConnectors(connectors) {
237976
237821
  }
237977
237822
  }
237978
237823
  }
237979
- return results;
237824
+ return { results };
237980
237825
  }
237981
237826
  function getConnectorSyncResult(type, response) {
237982
237827
  if (response.error === "different_user") {
@@ -238445,7 +238290,6 @@ async function pushFunctions(functions) {
238445
238290
  }
238446
238291
  // src/core/resources/function/pull.ts
238447
238292
  import { join as join6 } from "node:path";
238448
- import { isDeepStrictEqual as isDeepStrictEqual3 } from "node:util";
238449
238293
  async function writeFunctions(functionsDir, functions) {
238450
238294
  const written = [];
238451
238295
  const skipped = [];
@@ -238481,7 +238325,9 @@ async function isFunctionUnchanged(functionDir, fn) {
238481
238325
  if (localConfig.entry !== fn.entry) {
238482
238326
  return false;
238483
238327
  }
238484
- if (!isDeepStrictEqual3(localConfig.automations ?? [], fn.automations)) {
238328
+ const localAuto = JSON.stringify(localConfig.automations ?? []);
238329
+ const remoteAuto = JSON.stringify(fn.automations);
238330
+ if (localAuto !== remoteAuto) {
238485
238331
  return false;
238486
238332
  }
238487
238333
  } catch {
@@ -246591,10 +246437,6 @@ function getDashboardUrl(projectId) {
246591
246437
  const id = projectId ?? getAppConfig().id;
246592
246438
  return `${getBase44ApiUrl()}/apps/${id}/editor/workspace/overview`;
246593
246439
  }
246594
- function getConnectorsUrl(projectId) {
246595
- const id = projectId ?? getAppConfig().id;
246596
- return `${getBase44ApiUrl()}/apps/${id}/editor/workspace/app-connections`;
246597
- }
246598
246440
  // src/cli/utils/yaml.ts
246599
246441
  var import_lodash = __toESM(require_lodash(), 1);
246600
246442
 
@@ -246790,13 +246632,13 @@ async function pullConnectorsAction() {
246790
246632
  const configDir = dirname8(project2.configPath);
246791
246633
  const connectorsDir = join12(configDir, project2.connectorsDir);
246792
246634
  const remoteConnectors = await runTask("Fetching connectors from Base44", async () => {
246793
- return await pullAllConnectors();
246635
+ return await listConnectors();
246794
246636
  }, {
246795
246637
  successMessage: "Connectors fetched successfully",
246796
246638
  errorMessage: "Failed to fetch connectors"
246797
246639
  });
246798
246640
  const { written, deleted } = await runTask("Syncing connector files", async () => {
246799
- return await writeConnectors(connectorsDir, remoteConnectors);
246641
+ return await writeConnectors(connectorsDir, remoteConnectors.integrations);
246800
246642
  }, {
246801
246643
  successMessage: "Connector files synced successfully",
246802
246644
  errorMessage: "Failed to sync connector files"
@@ -246811,7 +246653,7 @@ async function pullConnectorsAction() {
246811
246653
  R2.info("All connectors are already up to date");
246812
246654
  }
246813
246655
  return {
246814
- outroMessage: `Pulled ${remoteConnectors.length} connectors to ${connectorsDir}`
246656
+ outroMessage: `Pulled ${remoteConnectors.integrations.length} connectors to ${connectorsDir}`
246815
246657
  };
246816
246658
  }
246817
246659
  function getConnectorsPullCommand(context) {
@@ -247430,7 +247272,7 @@ var open_default = open;
247430
247272
  var POLL_INTERVAL_MS = 2000;
247431
247273
  var POLL_TIMEOUT_MS = 2 * 60 * 1000;
247432
247274
  function filterPendingOAuth(results) {
247433
- return results.filter((r) => r.action === "needs_oauth" && !!r.connectionId);
247275
+ return results.filter((r) => r.action === "needs_oauth" && !!r.redirectUrl && !!r.connectionId);
247434
247276
  }
247435
247277
  async function runOAuthFlowWithSkip(connector2) {
247436
247278
  await open_default(connector2.redirectUrl);
@@ -247448,10 +247290,6 @@ async function runOAuthFlowWithSkip(connector2) {
247448
247290
  finalStatus = "SKIPPED";
247449
247291
  return true;
247450
247292
  }
247451
- if (!connector2.connectionId) {
247452
- finalStatus = "FAILED";
247453
- return true;
247454
- }
247455
247293
  const response = await getOAuthStatus(connector2.type, connector2.connectionId);
247456
247294
  finalStatus = response.status;
247457
247295
  return response.status !== "PENDING";
@@ -247514,49 +247352,32 @@ async function promptOAuthFlows(pending, options) {
247514
247352
  function printSummary(results, oauthOutcomes) {
247515
247353
  const synced = [];
247516
247354
  const added = [];
247517
- let provisioned;
247518
247355
  const removed = [];
247519
247356
  const skipped = [];
247520
247357
  const failed = [];
247521
247358
  for (const r of results) {
247522
- switch (r.action) {
247523
- case "provisioned":
247524
- provisioned = r;
247525
- break;
247526
- case "synced":
247527
- synced.push(r.type);
247528
- break;
247529
- case "removed":
247530
- removed.push(r.type);
247531
- break;
247532
- case "error":
247533
- failed.push({ type: r.type, error: r.error });
247534
- break;
247535
- case "needs_oauth": {
247536
- const oauthStatus = oauthOutcomes.get(r.type);
247537
- if (oauthStatus === "ACTIVE") {
247538
- added.push(r.type);
247539
- } else if (oauthStatus === "SKIPPED") {
247540
- skipped.push(r.type);
247541
- } else if (oauthStatus === "PENDING") {
247542
- failed.push({ type: r.type, error: "authorization timed out" });
247543
- } else if (oauthStatus === "FAILED") {
247544
- failed.push({ type: r.type, error: "authorization failed" });
247545
- } else {
247546
- failed.push({ type: r.type, error: "needs authorization" });
247547
- }
247548
- break;
247359
+ const oauthStatus = oauthOutcomes.get(r.type);
247360
+ if (r.action === "synced") {
247361
+ synced.push(r.type);
247362
+ } else if (r.action === "removed") {
247363
+ removed.push(r.type);
247364
+ } else if (r.action === "error") {
247365
+ failed.push({ type: r.type, error: r.error });
247366
+ } else if (r.action === "needs_oauth") {
247367
+ if (oauthStatus === "ACTIVE") {
247368
+ added.push(r.type);
247369
+ } else if (oauthStatus === "SKIPPED") {
247370
+ skipped.push(r.type);
247371
+ } else if (oauthStatus === "PENDING") {
247372
+ failed.push({ type: r.type, error: "authorization timed out" });
247373
+ } else if (oauthStatus === "FAILED") {
247374
+ failed.push({ type: r.type, error: "authorization failed" });
247375
+ } else {
247376
+ failed.push({ type: r.type, error: "needs authorization" });
247549
247377
  }
247550
247378
  }
247551
247379
  }
247552
247380
  R2.info(theme.styles.bold("Summary:"));
247553
- if (provisioned) {
247554
- R2.success("Stripe sandbox provisioned");
247555
- if (provisioned.claimUrl) {
247556
- R2.info(` Claim your Stripe sandbox: ${theme.colors.links(provisioned.claimUrl)}`);
247557
- }
247558
- R2.info(` Connectors dashboard: ${theme.colors.links(getConnectorsUrl())}`);
247559
- }
247560
247381
  if (synced.length > 0) {
247561
247382
  R2.success(`Synced: ${synced.join(", ")}`);
247562
247383
  }
@@ -247570,7 +247391,7 @@ function printSummary(results, oauthOutcomes) {
247570
247391
  R2.warn(`Skipped: ${skipped.join(", ")}`);
247571
247392
  }
247572
247393
  for (const r of failed) {
247573
- R2.error(`Failed: ${r.type} - ${r.error}`);
247394
+ R2.error(`Failed: ${r.type}${r.error ? ` - ${r.error}` : ""}`);
247574
247395
  }
247575
247396
  }
247576
247397
  async function pushConnectorsAction(isNonInteractive) {
@@ -247967,11 +247788,15 @@ ${summaryLines.join(`
247967
247788
  successMessage: theme.colors.base44Orange("Deployment completed"),
247968
247789
  errorMessage: "Deployment failed"
247969
247790
  });
247970
- const connectorResults = result.connectorResults ?? [];
247971
- await handleOAuthConnectors(connectorResults, options);
247972
- const stripeResult = connectorResults.find((r) => r.type === "stripe");
247973
- if (stripeResult?.action === "provisioned") {
247974
- printStripeResult(stripeResult);
247791
+ const needsOAuth = filterPendingOAuth(result.connectorResults ?? []);
247792
+ if (needsOAuth.length > 0) {
247793
+ const oauthOutcomes = await promptOAuthFlows(needsOAuth, {
247794
+ skipPrompt: options.yes || options.isNonInteractive
247795
+ });
247796
+ const allAuthorized = oauthOutcomes.size > 0 && [...oauthOutcomes.values()].every((s) => s === "ACTIVE");
247797
+ if (!allAuthorized) {
247798
+ R2.info("Some connectors still require authorization. Run 'base44 connectors push' or open the links above in your browser.");
247799
+ }
247975
247800
  }
247976
247801
  R2.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl())}`);
247977
247802
  if (result.appUrl) {
@@ -247987,25 +247812,6 @@ function getDeployCommand2(context) {
247987
247812
  }), { requireAuth: true }, context);
247988
247813
  });
247989
247814
  }
247990
- async function handleOAuthConnectors(connectorResults, options) {
247991
- const needsOAuth = filterPendingOAuth(connectorResults);
247992
- if (needsOAuth.length === 0)
247993
- return;
247994
- const oauthOutcomes = await promptOAuthFlows(needsOAuth, {
247995
- skipPrompt: options.yes || options.isNonInteractive
247996
- });
247997
- const allAuthorized = oauthOutcomes.size > 0 && [...oauthOutcomes.values()].every((s) => s === "ACTIVE");
247998
- if (!allAuthorized) {
247999
- R2.info("Some connectors still require authorization. Run 'base44 connectors push' or open the links above in your browser.");
248000
- }
248001
- }
248002
- function printStripeResult(r) {
248003
- R2.success("Stripe sandbox provisioned");
248004
- if (r.claimUrl) {
248005
- R2.info(` Claim your Stripe sandbox: ${theme.colors.links(r.claimUrl)}`);
248006
- }
248007
- R2.info(` Connectors dashboard: ${theme.colors.links(getConnectorsUrl())}`);
248008
- }
248009
247815
 
248010
247816
  // src/cli/commands/project/link.ts
248011
247817
  function validateNonInteractiveFlags2(command) {
@@ -255523,4 +255329,4 @@ export {
255523
255329
  CLIExitError
255524
255330
  };
255525
255331
 
255526
- //# debugId=0427AEEF5EF1A0DD64756E2164756E21
255332
+ //# debugId=AC227C160FCE9CC164756E2164756E21