@base44-preview/cli 0.0.31-pr.231.dabd461 → 0.0.31-pr.236.3a66999

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
@@ -17446,7 +17446,7 @@ var require_lodash2 = __commonJS((exports, module) => {
17446
17446
  }
17447
17447
  return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
17448
17448
  });
17449
- function join10(array2, separator) {
17449
+ function join12(array2, separator) {
17450
17450
  return array2 == null ? "" : nativeJoin.call(array2, separator);
17451
17451
  }
17452
17452
  function last(array2) {
@@ -19378,7 +19378,7 @@ __p += '`;
19378
19378
  lodash.isUndefined = isUndefined;
19379
19379
  lodash.isWeakMap = isWeakMap;
19380
19380
  lodash.isWeakSet = isWeakSet;
19381
- lodash.join = join10;
19381
+ lodash.join = join12;
19382
19382
  lodash.kebabCase = kebabCase2;
19383
19383
  lodash.last = last;
19384
19384
  lodash.lastIndexOf = lastIndexOf;
@@ -20007,7 +20007,7 @@ function cleanDoc(doc2) {
20007
20007
  return mapDoc(doc2, (currentDoc) => cleanDocFn(currentDoc));
20008
20008
  }
20009
20009
  function replaceEndOfLine(doc2, replacement = literalline) {
20010
- return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ? join10(replacement, currentDoc.split(`
20010
+ return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ? join12(replacement, currentDoc.split(`
20011
20011
  `)) : currentDoc);
20012
20012
  }
20013
20013
  function canBreakFn(doc2) {
@@ -20087,7 +20087,7 @@ function indentIfBreak(contents, options) {
20087
20087
  negate: options.negate
20088
20088
  };
20089
20089
  }
20090
- function join10(separator, docs) {
20090
+ function join12(separator, docs) {
20091
20091
  assertDoc(separator);
20092
20092
  assertDocArray(docs);
20093
20093
  const parts = [];
@@ -20798,7 +20798,7 @@ var init_doc = __esm(() => {
20798
20798
  MODE_FLAT = Symbol("MODE_FLAT");
20799
20799
  DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
20800
20800
  builders = {
20801
- join: join10,
20801
+ join: join12,
20802
20802
  line,
20803
20803
  softline,
20804
20804
  hardline,
@@ -125712,7 +125712,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
125712
125712
  return mapDoc2(doc2, (currentDoc) => cleanDocFn2(currentDoc));
125713
125713
  }
125714
125714
  function replaceEndOfLine2(doc2, replacement = literalline2) {
125715
- return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ? join12(replacement, currentDoc.split(`
125715
+ return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ? join14(replacement, currentDoc.split(`
125716
125716
  `)) : currentDoc);
125717
125717
  }
125718
125718
  function canBreakFn2(doc2) {
@@ -125798,7 +125798,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
125798
125798
  negate: options8.negate
125799
125799
  };
125800
125800
  }
125801
- function join12(separator, docs) {
125801
+ function join14(separator, docs) {
125802
125802
  assertDoc2(separator);
125803
125803
  assertDocArray2(docs);
125804
125804
  const parts = [];
@@ -126463,7 +126463,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
126463
126463
  }
126464
126464
  }
126465
126465
  var builders2 = {
126466
- join: join12,
126466
+ join: join14,
126467
126467
  line: line3,
126468
126468
  softline: softline2,
126469
126469
  hardline: hardline4,
@@ -155678,10 +155678,10 @@ var require_view = __commonJS((exports, module) => {
155678
155678
  var debug = require_src4()("express:view");
155679
155679
  var path18 = __require("node:path");
155680
155680
  var fs28 = __require("node:fs");
155681
- var dirname10 = path18.dirname;
155681
+ var dirname11 = path18.dirname;
155682
155682
  var basename4 = path18.basename;
155683
155683
  var extname2 = path18.extname;
155684
- var join13 = path18.join;
155684
+ var join15 = path18.join;
155685
155685
  var resolve5 = path18.resolve;
155686
155686
  module.exports = View;
155687
155687
  function View(name2, options8) {
@@ -155717,7 +155717,7 @@ var require_view = __commonJS((exports, module) => {
155717
155717
  for (var i5 = 0;i5 < roots.length && !path19; i5++) {
155718
155718
  var root2 = roots[i5];
155719
155719
  var loc = resolve5(root2, name2);
155720
- var dir = dirname10(loc);
155720
+ var dir = dirname11(loc);
155721
155721
  var file2 = basename4(loc);
155722
155722
  path19 = this.resolve(dir, file2);
155723
155723
  }
@@ -155743,12 +155743,12 @@ var require_view = __commonJS((exports, module) => {
155743
155743
  };
155744
155744
  View.prototype.resolve = function resolve6(dir, file2) {
155745
155745
  var ext = this.ext;
155746
- var path19 = join13(dir, file2);
155746
+ var path19 = join15(dir, file2);
155747
155747
  var stat2 = tryStat(path19);
155748
155748
  if (stat2 && stat2.isFile()) {
155749
155749
  return path19;
155750
155750
  }
155751
- path19 = join13(dir, basename4(file2, ext), "index" + ext);
155751
+ path19 = join15(dir, basename4(file2, ext), "index" + ext);
155752
155752
  stat2 = tryStat(path19);
155753
155753
  if (stat2 && stat2.isFile()) {
155754
155754
  return path19;
@@ -159443,7 +159443,7 @@ var require_send = __commonJS((exports, module) => {
159443
159443
  var Stream2 = __require("stream");
159444
159444
  var util2 = __require("util");
159445
159445
  var extname2 = path18.extname;
159446
- var join13 = path18.join;
159446
+ var join15 = path18.join;
159447
159447
  var normalize = path18.normalize;
159448
159448
  var resolve5 = path18.resolve;
159449
159449
  var sep = path18.sep;
@@ -159615,7 +159615,7 @@ var require_send = __commonJS((exports, module) => {
159615
159615
  return res;
159616
159616
  }
159617
159617
  parts = path19.split(sep);
159618
- path19 = normalize(join13(root2, path19));
159618
+ path19 = normalize(join15(root2, path19));
159619
159619
  } else {
159620
159620
  if (UP_PATH_REGEXP.test(path19)) {
159621
159621
  debug('malicious path "%s"', path19);
@@ -159755,7 +159755,7 @@ var require_send = __commonJS((exports, module) => {
159755
159755
  return self2.onStatError(err);
159756
159756
  return self2.error(404);
159757
159757
  }
159758
- var p4 = join13(path19, self2._index[i5]);
159758
+ var p4 = join15(path19, self2._index[i5]);
159759
159759
  debug('stat "%s"', p4);
159760
159760
  fs28.stat(p4, function(err2, stat2) {
159761
159761
  if (err2)
@@ -162834,7 +162834,7 @@ var {
162834
162834
  } = import__.default;
162835
162835
 
162836
162836
  // src/cli/commands/agents/pull.ts
162837
- import { dirname as dirname7, join as join8 } from "node:path";
162837
+ import { dirname as dirname7, join as join9 } from "node:path";
162838
162838
 
162839
162839
  // node_modules/@clack/core/dist/index.mjs
162840
162840
  var import_sisteransi = __toESM(require_src(), 1);
@@ -184871,7 +184871,7 @@ var generateGlobTasks = normalizeArguments(generateTasks);
184871
184871
  var generateGlobTasksSync = normalizeArgumentsSync(generateTasksSync);
184872
184872
 
184873
184873
  // src/core/project/config.ts
184874
- import { dirname as dirname5, join as join5 } from "node:path";
184874
+ import { dirname as dirname5, join as join6 } from "node:path";
184875
184875
 
184876
184876
  // src/core/resources/agent/schema.ts
184877
184877
  var EntityOperationSchema = exports_external.enum(["create", "update", "delete", "read"]);
@@ -185203,6 +185203,8 @@ async function removeConnector(integrationType) {
185203
185203
  return result.data;
185204
185204
  }
185205
185205
  // src/core/resources/connector/config.ts
185206
+ import { join as join4 } from "node:path";
185207
+ import { isDeepStrictEqual } from "node:util";
185206
185208
  async function readConnectorFile(connectorPath) {
185207
185209
  const parsed = await readJsonFile(connectorPath);
185208
185210
  const result = ConnectorResourceSchema.safeParse(parsed);
@@ -185211,7 +185213,7 @@ async function readConnectorFile(connectorPath) {
185211
185213
  }
185212
185214
  return result.data;
185213
185215
  }
185214
- async function readAllConnectors(connectorsDir) {
185216
+ async function readConnectorFiles(connectorsDir) {
185215
185217
  if (!await pathExists(connectorsDir)) {
185216
185218
  return [];
185217
185219
  }
@@ -185219,24 +185221,58 @@ async function readAllConnectors(connectorsDir) {
185219
185221
  cwd: connectorsDir,
185220
185222
  absolute: true
185221
185223
  });
185222
- const connectors = await Promise.all(files.map((filePath) => readConnectorFile(filePath)));
185223
- assertNoDuplicateConnectors(connectors);
185224
- return connectors;
185224
+ return await Promise.all(files.map(async (filePath) => ({
185225
+ data: await readConnectorFile(filePath),
185226
+ filePath
185227
+ })));
185225
185228
  }
185226
- function assertNoDuplicateConnectors(connectors) {
185227
- const types = new Set;
185228
- for (const connector of connectors) {
185229
- if (types.has(connector.type)) {
185230
- throw new InvalidInputError(`Duplicate connector type "${connector.type}"`, {
185229
+ function buildTypeToEntryMap(entries) {
185230
+ const typeToEntry = new Map;
185231
+ for (const entry of entries) {
185232
+ if (typeToEntry.has(entry.data.type)) {
185233
+ throw new InvalidInputError(`Duplicate connector type "${entry.data.type}"`, {
185231
185234
  hints: [
185232
185235
  {
185233
- message: `Remove duplicate connectors with type "${connector.type}" - only one connector per type is allowed`
185236
+ message: `Remove duplicate connectors with type "${entry.data.type}" - only one connector per type is allowed`
185234
185237
  }
185235
185238
  ]
185236
185239
  });
185237
185240
  }
185238
- types.add(connector.type);
185241
+ typeToEntry.set(entry.data.type, entry);
185239
185242
  }
185243
+ return typeToEntry;
185244
+ }
185245
+ async function readAllConnectors(connectorsDir) {
185246
+ const entries = await readConnectorFiles(connectorsDir);
185247
+ const typeToEntry = buildTypeToEntryMap(entries);
185248
+ return [...typeToEntry.values()].map((e2) => e2.data);
185249
+ }
185250
+ async function writeConnectors(connectorsDir, remoteConnectors) {
185251
+ const entries = await readConnectorFiles(connectorsDir);
185252
+ const typeToEntry = buildTypeToEntryMap(entries);
185253
+ const newTypes = new Set(remoteConnectors.map((c) => c.integrationType));
185254
+ const deleted = [];
185255
+ for (const [type, entry] of typeToEntry) {
185256
+ if (!newTypes.has(type)) {
185257
+ await deleteFile(entry.filePath);
185258
+ deleted.push(type);
185259
+ }
185260
+ }
185261
+ const written = [];
185262
+ for (const connector of remoteConnectors) {
185263
+ const existing = typeToEntry.get(connector.integrationType);
185264
+ const localConnector = {
185265
+ type: connector.integrationType,
185266
+ scopes: connector.scopes
185267
+ };
185268
+ if (existing && isDeepStrictEqual(existing.data, localConnector)) {
185269
+ continue;
185270
+ }
185271
+ const filePath = existing?.filePath ?? join4(connectorsDir, `${connector.integrationType}.${CONFIG_FILE_EXTENSION}`);
185272
+ await writeJsonFile(filePath, localConnector);
185273
+ written.push(connector.integrationType);
185274
+ }
185275
+ return { written, deleted };
185240
185276
  }
185241
185277
  // src/core/resources/connector/push.ts
185242
185278
  async function pushConnectors(connectors) {
@@ -185578,7 +185614,7 @@ async function deployFunctions(functions) {
185578
185614
  return result.data;
185579
185615
  }
185580
185616
  // src/core/resources/function/config.ts
185581
- import { dirname as dirname4, join as join4 } from "node:path";
185617
+ import { dirname as dirname4, join as join5 } from "node:path";
185582
185618
  async function readFunctionConfig(configPath) {
185583
185619
  const parsed = await readJsonFile(configPath);
185584
185620
  const result = FunctionConfigSchema.safeParse(parsed);
@@ -185590,7 +185626,7 @@ async function readFunctionConfig(configPath) {
185590
185626
  async function readFunction(configPath) {
185591
185627
  const config5 = await readFunctionConfig(configPath);
185592
185628
  const functionDir = dirname4(configPath);
185593
- const entryPath = join4(functionDir, config5.entry);
185629
+ const entryPath = join5(functionDir, config5.entry);
185594
185630
  if (!await pathExists(entryPath)) {
185595
185631
  throw new FileNotFoundError(`Function entry file not found: ${entryPath} (referenced in ${configPath})`);
185596
185632
  }
@@ -185679,10 +185715,10 @@ async function readProjectConfig(projectRoot) {
185679
185715
  const project = result.data;
185680
185716
  const configDir = dirname5(configPath);
185681
185717
  const [entities, functions, agents, connectors] = await Promise.all([
185682
- entityResource.readAll(join5(configDir, project.entitiesDir)),
185683
- functionResource.readAll(join5(configDir, project.functionsDir)),
185684
- agentResource.readAll(join5(configDir, project.agentsDir)),
185685
- connectorResource.readAll(join5(configDir, project.connectorsDir))
185718
+ entityResource.readAll(join6(configDir, project.entitiesDir)),
185719
+ functionResource.readAll(join6(configDir, project.functionsDir)),
185720
+ agentResource.readAll(join6(configDir, project.agentsDir)),
185721
+ connectorResource.readAll(join6(configDir, project.connectorsDir))
185686
185722
  ]);
185687
185723
  return {
185688
185724
  project: { ...project, root, configPath },
@@ -185779,7 +185815,7 @@ async function readAppConfig(projectRoot) {
185779
185815
  // src/core/project/template.ts
185780
185816
  var import_ejs = __toESM(require_ejs(), 1);
185781
185817
  var import_front_matter = __toESM(require_front_matter(), 1);
185782
- import { dirname as dirname6, join as join6 } from "node:path";
185818
+ import { dirname as dirname6, join as join7 } from "node:path";
185783
185819
  async function listTemplates() {
185784
185820
  const parsed = await readJsonFile(getTemplatesIndexPath());
185785
185821
  const result = TemplatesConfigSchema.safeParse(parsed);
@@ -185789,23 +185825,23 @@ async function listTemplates() {
185789
185825
  return result.data.templates;
185790
185826
  }
185791
185827
  async function renderTemplate(template, destPath, data) {
185792
- const templateDir = join6(getTemplatesDir(), template.path);
185828
+ const templateDir = join7(getTemplatesDir(), template.path);
185793
185829
  const files = await globby("**/*", {
185794
185830
  cwd: templateDir,
185795
185831
  dot: true,
185796
185832
  onlyFiles: true
185797
185833
  });
185798
185834
  for (const file2 of files) {
185799
- const srcPath = join6(templateDir, file2);
185835
+ const srcPath = join7(templateDir, file2);
185800
185836
  try {
185801
185837
  if (file2.endsWith(".ejs")) {
185802
185838
  const rendered = await import_ejs.default.renderFile(srcPath, data);
185803
185839
  const { attributes, body } = import_front_matter.default(rendered);
185804
- const destFile = attributes.outputFileName ? join6(dirname6(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
185805
- const destFilePath = join6(destPath, destFile);
185840
+ const destFile = attributes.outputFileName ? join7(dirname6(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
185841
+ const destFilePath = join7(destPath, destFile);
185806
185842
  await writeFile(destFilePath, body);
185807
185843
  } else {
185808
- const destFilePath = join6(destPath, file2);
185844
+ const destFilePath = join7(destPath, file2);
185809
185845
  await copyFile(srcPath, destFilePath);
185810
185846
  }
185811
185847
  } catch (error48) {
@@ -185908,7 +185944,7 @@ async function getSiteFilePaths(outputDir) {
185908
185944
  // src/core/site/deploy.ts
185909
185945
  import { randomUUID } from "node:crypto";
185910
185946
  import { tmpdir } from "node:os";
185911
- import { join as join7 } from "node:path";
185947
+ import { join as join8 } from "node:path";
185912
185948
  async function deploySite(siteOutputDir) {
185913
185949
  if (!await pathExists(siteOutputDir)) {
185914
185950
  throw new FileNotFoundError(`Output directory does not exist: ${siteOutputDir}. Make sure to build your project first.`, {
@@ -185925,7 +185961,7 @@ async function deploySite(siteOutputDir) {
185925
185961
  ]
185926
185962
  });
185927
185963
  }
185928
- const archivePath = join7(tmpdir(), `base44-site-${randomUUID()}.tar.gz`);
185964
+ const archivePath = join8(tmpdir(), `base44-site-${randomUUID()}.tar.gz`);
185929
185965
  try {
185930
185966
  await createArchive(siteOutputDir, archivePath);
185931
185967
  return await uploadSite(archivePath);
@@ -185942,24 +185978,26 @@ async function createArchive(pathToArchive, targetArchivePath) {
185942
185978
  }
185943
185979
  // src/core/project/deploy.ts
185944
185980
  function hasResourcesToDeploy(projectData) {
185945
- const { project, entities, functions, agents } = projectData;
185981
+ const { project, entities, functions, agents, connectors } = projectData;
185946
185982
  const hasSite = Boolean(project.site?.outputDirectory);
185947
185983
  const hasEntities = entities.length > 0;
185948
185984
  const hasFunctions = functions.length > 0;
185949
185985
  const hasAgents = agents.length > 0;
185950
- return hasEntities || hasFunctions || hasAgents || hasSite;
185986
+ const hasConnectors = connectors.length > 0;
185987
+ return hasEntities || hasFunctions || hasAgents || hasConnectors || hasSite;
185951
185988
  }
185952
185989
  async function deployAll(projectData) {
185953
- const { project, entities, functions, agents } = projectData;
185990
+ const { project, entities, functions, agents, connectors } = projectData;
185954
185991
  await entityResource.push(entities);
185955
185992
  await functionResource.push(functions);
185956
185993
  await agentResource.push(agents);
185994
+ const { results: connectorResults } = await pushConnectors(connectors);
185957
185995
  if (project.site?.outputDirectory) {
185958
185996
  const outputDir = resolve(project.root, project.site.outputDirectory);
185959
185997
  const { appUrl } = await deploySite(outputDir);
185960
- return { appUrl };
185998
+ return { appUrl, connectorResults };
185961
185999
  }
185962
- return {};
186000
+ return { connectorResults };
185963
186001
  }
185964
186002
  // src/core/clients/base44-client.ts
185965
186003
  var retriedRequests = new WeakSet;
@@ -193601,7 +193639,7 @@ function getDashboardUrl(projectId) {
193601
193639
  async function pullAgentsAction() {
193602
193640
  const { project: project2 } = await readProjectConfig();
193603
193641
  const configDir = dirname7(project2.configPath);
193604
- const agentsDir = join8(configDir, project2.agentsDir);
193642
+ const agentsDir = join9(configDir, project2.agentsDir);
193605
193643
  const remoteAgents = await runTask("Fetching agents from Base44", async () => {
193606
193644
  return await fetchAgents();
193607
193645
  }, {
@@ -193694,6 +193732,43 @@ function getWhoamiCommand(context) {
193694
193732
  });
193695
193733
  }
193696
193734
 
193735
+ // src/cli/commands/connectors/pull.ts
193736
+ import { dirname as dirname8, join as join10 } from "node:path";
193737
+ async function pullConnectorsAction() {
193738
+ const { project: project2 } = await readProjectConfig();
193739
+ const configDir = dirname8(project2.configPath);
193740
+ const connectorsDir = join10(configDir, project2.connectorsDir);
193741
+ const remoteConnectors = await runTask("Fetching connectors from Base44", async () => {
193742
+ return await listConnectors();
193743
+ }, {
193744
+ successMessage: "Connectors fetched successfully",
193745
+ errorMessage: "Failed to fetch connectors"
193746
+ });
193747
+ const { written, deleted } = await runTask("Syncing connector files", async () => {
193748
+ return await writeConnectors(connectorsDir, remoteConnectors.integrations);
193749
+ }, {
193750
+ successMessage: "Connector files synced successfully",
193751
+ errorMessage: "Failed to sync connector files"
193752
+ });
193753
+ if (written.length > 0) {
193754
+ M2.success(`Written: ${written.join(", ")}`);
193755
+ }
193756
+ if (deleted.length > 0) {
193757
+ M2.warn(`Deleted: ${deleted.join(", ")}`);
193758
+ }
193759
+ if (written.length === 0 && deleted.length === 0) {
193760
+ M2.info("All connectors are already up to date");
193761
+ }
193762
+ return {
193763
+ outroMessage: `Pulled ${remoteConnectors.integrations.length} connectors to ${connectorsDir}`
193764
+ };
193765
+ }
193766
+ function getConnectorsPullCommand(context) {
193767
+ return new Command("pull").description("Pull connectors from Base44 to local files (replaces all local connector configs)").action(async () => {
193768
+ await runCommand(pullConnectorsAction, { requireAuth: true }, context);
193769
+ });
193770
+ }
193771
+
193697
193772
  // node_modules/open/index.js
193698
193773
  import process20 from "node:process";
193699
193774
  import path16 from "node:path";
@@ -194300,27 +194375,30 @@ defineLazyProperty(apps, "safari", () => detectPlatformBinary({
194300
194375
  }));
194301
194376
  var open_default = open;
194302
194377
 
194303
- // src/cli/commands/connectors/push.ts
194378
+ // src/cli/commands/connectors/oauth-prompt.ts
194304
194379
  var POLL_INTERVAL_MS = 2000;
194305
194380
  var POLL_TIMEOUT_MS = 2 * 60 * 1000;
194306
- async function runOAuthFlowWithSkip(params) {
194307
- await open_default(params.redirectUrl);
194381
+ function filterPendingOAuth(results) {
194382
+ return results.filter((r2) => r2.action === "needs_oauth" && !!r2.redirectUrl && !!r2.connectionId);
194383
+ }
194384
+ async function runOAuthFlowWithSkip(connector2) {
194385
+ await open_default(connector2.redirectUrl);
194308
194386
  let finalStatus = "PENDING";
194309
194387
  let skipped = false;
194310
194388
  const s = Y2();
194311
194389
  const originalExit = process.exit;
194312
194390
  process.exit = () => {
194313
194391
  skipped = true;
194314
- s.stop(`${params.type} skipped`);
194392
+ s.stop(`${connector2.type} skipped`);
194315
194393
  };
194316
- s.start(`Waiting for ${params.type} authorization... (Esc to skip)`);
194394
+ s.start(`Waiting for ${connector2.type} authorization... (Esc to skip)`);
194317
194395
  try {
194318
194396
  await pWaitFor(async () => {
194319
194397
  if (skipped) {
194320
194398
  finalStatus = "SKIPPED";
194321
194399
  return true;
194322
194400
  }
194323
- const response = await getOAuthStatus(params.type, params.connectionId);
194401
+ const response = await getOAuthStatus(connector2.type, connector2.connectionId);
194324
194402
  finalStatus = response.status;
194325
194403
  return response.status !== "PENDING";
194326
194404
  }, {
@@ -194337,19 +194415,49 @@ async function runOAuthFlowWithSkip(params) {
194337
194415
  process.exit = originalExit;
194338
194416
  if (!skipped) {
194339
194417
  if (finalStatus === "ACTIVE") {
194340
- s.stop(`${params.type} authorization complete`);
194418
+ s.stop(`${connector2.type} authorization complete`);
194341
194419
  } else if (finalStatus === "FAILED") {
194342
- s.stop(`${params.type} authorization failed`);
194420
+ s.stop(`${connector2.type} authorization failed`);
194343
194421
  } else {
194344
- s.stop(`${params.type} authorization timed out`);
194422
+ s.stop(`${connector2.type} authorization timed out`);
194345
194423
  }
194346
194424
  }
194347
194425
  }
194348
- return { type: params.type, status: finalStatus };
194426
+ return finalStatus;
194349
194427
  }
194350
- function isPendingOAuth(r2) {
194351
- return r2.action === "needs_oauth" && !!r2.redirectUrl && !!r2.connectionId;
194428
+ async function promptOAuthFlows(pending, options) {
194429
+ const outcomes = new Map;
194430
+ if (pending.length === 0) {
194431
+ return outcomes;
194432
+ }
194433
+ M2.warn(`${pending.length} connector(s) require authorization in your browser:`);
194434
+ for (const connector2 of pending) {
194435
+ M2.info(` ${connector2.type}: ${theme.styles.dim(connector2.redirectUrl)}`);
194436
+ }
194437
+ if (options?.skipPrompt) {
194438
+ return outcomes;
194439
+ }
194440
+ const shouldAuth = await ye({
194441
+ message: "Open browser to authorize now?"
194442
+ });
194443
+ if (pD(shouldAuth) || !shouldAuth) {
194444
+ return outcomes;
194445
+ }
194446
+ for (const connector2 of pending) {
194447
+ try {
194448
+ M2.info(`
194449
+ Opening browser for ${connector2.type}...`);
194450
+ const status = await runOAuthFlowWithSkip(connector2);
194451
+ outcomes.set(connector2.type, status);
194452
+ } catch (err) {
194453
+ M2.error(`Failed to authorize ${connector2.type}: ${err instanceof Error ? err.message : String(err)}`);
194454
+ outcomes.set(connector2.type, "FAILED");
194455
+ }
194456
+ }
194457
+ return outcomes;
194352
194458
  }
194459
+
194460
+ // src/cli/commands/connectors/push.ts
194353
194461
  function printSummary(results, oauthOutcomes) {
194354
194462
  const synced = [];
194355
194463
  const added = [];
@@ -194378,7 +194486,6 @@ function printSummary(results, oauthOutcomes) {
194378
194486
  }
194379
194487
  }
194380
194488
  }
194381
- M2.info("");
194382
194489
  M2.info(theme.styles.bold("Summary:"));
194383
194490
  if (synced.length > 0) {
194384
194491
  M2.success(`Synced: ${synced.join(", ")}`);
@@ -194407,43 +194514,14 @@ async function pushConnectorsAction() {
194407
194514
  const { results } = await runTask("Pushing connectors to Base44", async () => {
194408
194515
  return await pushConnectors(connectors);
194409
194516
  });
194410
- const oauthOutcomes = new Map;
194411
- const needsOAuth = results.filter(isPendingOAuth);
194517
+ const needsOAuth = filterPendingOAuth(results);
194412
194518
  let outroMessage = "Connectors pushed to Base44";
194413
- if (needsOAuth.length === 0) {
194414
- printSummary(results, oauthOutcomes);
194415
- return { outroMessage };
194416
- }
194417
- M2.warn(`${needsOAuth.length} connector(s) require authorization in your browser:`);
194418
- for (const connector2 of needsOAuth) {
194419
- M2.info(` '${connector2.type}': ${theme.styles.dim(connector2.redirectUrl)}`);
194420
- }
194421
- const pending = needsOAuth.map((c3) => c3.type).join(", ");
194422
- if (process.env.CI) {
194423
- outroMessage = `Skipped OAuth in CI. Pending: ${pending}. Run 'base44 connectors push' locally to authorize.`;
194424
- } else {
194425
- const shouldAuth = await ye({
194426
- message: "Open browser to authorize now?"
194427
- });
194428
- if (pD(shouldAuth) || !shouldAuth) {
194429
- outroMessage = `Authorization skipped. Pending: ${pending}. Run 'base44 connectors push' again to complete.`;
194430
- } else {
194431
- for (const connector2 of needsOAuth) {
194432
- try {
194433
- M2.info(`
194434
- Opening browser for '${connector2.type}'...`);
194435
- const oauthResult = await runOAuthFlowWithSkip({
194436
- type: connector2.type,
194437
- redirectUrl: connector2.redirectUrl,
194438
- connectionId: connector2.connectionId
194439
- });
194440
- oauthOutcomes.set(connector2.type, oauthResult.status);
194441
- } catch (err) {
194442
- M2.error(`Failed to authorize '${connector2.type}': ${err instanceof Error ? err.message : String(err)}`);
194443
- oauthOutcomes.set(connector2.type, "FAILED");
194444
- }
194445
- }
194446
- }
194519
+ const oauthOutcomes = await promptOAuthFlows(needsOAuth, {
194520
+ skipPrompt: !!process.env.CI
194521
+ });
194522
+ const allAuthorized = oauthOutcomes.size > 0 && [...oauthOutcomes.values()].every((s) => s === "ACTIVE");
194523
+ if (needsOAuth.length > 0 && !allAuthorized) {
194524
+ outroMessage = process.env.CI ? "Skipped OAuth in CI. Run 'base44 connectors push' locally or open the links above to authorize." : "Some connectors still require authorization. Run 'base44 connectors push' or open the links above to authorize.";
194447
194525
  }
194448
194526
  printSummary(results, oauthOutcomes);
194449
194527
  return { outroMessage };
@@ -194456,7 +194534,7 @@ function getConnectorsPushCommand(context) {
194456
194534
 
194457
194535
  // src/cli/commands/connectors/index.ts
194458
194536
  function getConnectorsCommand(context) {
194459
- return new Command("connectors").description("Manage project connectors (OAuth integrations)").addCommand(getConnectorsPushCommand(context));
194537
+ return new Command("connectors").description("Manage project connectors (OAuth integrations)").addCommand(getConnectorsPullCommand(context)).addCommand(getConnectorsPushCommand(context));
194460
194538
  }
194461
194539
 
194462
194540
  // src/cli/commands/dashboard/open.ts
@@ -194550,7 +194628,7 @@ function getFunctionsDeployCommand(context) {
194550
194628
  }
194551
194629
 
194552
194630
  // src/cli/commands/project/create.ts
194553
- import { basename as basename3, join as join9, resolve as resolve2 } from "node:path";
194631
+ import { basename as basename3, join as join11, resolve as resolve2 } from "node:path";
194554
194632
  var import_lodash = __toESM(require_lodash(), 1);
194555
194633
  var DEFAULT_TEMPLATE_ID = "backend-only";
194556
194634
  async function getTemplateById(templateId) {
@@ -194686,7 +194764,7 @@ async function executeCreate({
194686
194764
  updateMessage("Building project...");
194687
194765
  await execa({ cwd: resolvedPath, shell: true })`${buildCommand}`;
194688
194766
  updateMessage("Deploying site...");
194689
- return await deploySite(join9(resolvedPath, outputDirectory));
194767
+ return await deploySite(join11(resolvedPath, outputDirectory));
194690
194768
  }, {
194691
194769
  successMessage: theme.colors.base44Orange("Site deployed successfully"),
194692
194770
  errorMessage: "Failed to deploy site"
@@ -194734,7 +194812,7 @@ async function deployAction(options) {
194734
194812
  outroMessage: "No resources found to deploy"
194735
194813
  };
194736
194814
  }
194737
- const { project: project2, entities, functions, agents } = projectData;
194815
+ const { project: project2, entities, functions, agents, connectors } = projectData;
194738
194816
  const summaryLines = [];
194739
194817
  if (entities.length > 0) {
194740
194818
  summaryLines.push(` - ${entities.length} ${entities.length === 1 ? "entity" : "entities"}`);
@@ -194745,6 +194823,9 @@ async function deployAction(options) {
194745
194823
  if (agents.length > 0) {
194746
194824
  summaryLines.push(` - ${agents.length} ${agents.length === 1 ? "agent" : "agents"}`);
194747
194825
  }
194826
+ if (connectors.length > 0) {
194827
+ summaryLines.push(` - ${connectors.length} ${connectors.length === 1 ? "connector" : "connectors"}`);
194828
+ }
194748
194829
  if (project2.site?.outputDirectory) {
194749
194830
  summaryLines.push(` - Site from ${project2.site.outputDirectory}`);
194750
194831
  }
@@ -194769,6 +194850,16 @@ ${summaryLines.join(`
194769
194850
  successMessage: theme.colors.base44Orange("Deployment completed"),
194770
194851
  errorMessage: "Deployment failed"
194771
194852
  });
194853
+ const needsOAuth = filterPendingOAuth(result.connectorResults ?? []);
194854
+ if (needsOAuth.length > 0) {
194855
+ const oauthOutcomes = await promptOAuthFlows(needsOAuth, {
194856
+ skipPrompt: options.yes || !!process.env.CI
194857
+ });
194858
+ const allAuthorized = oauthOutcomes.size > 0 && [...oauthOutcomes.values()].every((s) => s === "ACTIVE");
194859
+ if (!allAuthorized) {
194860
+ M2.info("Some connectors still require authorization. Run 'base44 connectors push' or open the links above in your browser.");
194861
+ }
194862
+ }
194772
194863
  M2.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl())}`);
194773
194864
  if (result.appUrl) {
194774
194865
  M2.message(`${theme.styles.header("App URL")}: ${theme.colors.links(result.appUrl)}`);
@@ -194776,7 +194867,7 @@ ${summaryLines.join(`
194776
194867
  return { outroMessage: "App deployed successfully" };
194777
194868
  }
194778
194869
  function getDeployCommand(context) {
194779
- return new Command("deploy").description("Deploy all project resources (entities, functions, agents, and site)").option("-y, --yes", "Skip confirmation prompt").action(async (options) => {
194870
+ return new Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").action(async (options) => {
194780
194871
  await runCommand(() => deployAction(options), { requireAuth: true }, context);
194781
194872
  });
194782
194873
  }
@@ -194993,8 +195084,8 @@ var EMPTY_TEMPLATE = import_common_tags.stripIndent`
194993
195084
  // Auto-generated by Base44 CLI - DO NOT EDIT
194994
195085
  // Regenerate with: base44 types
194995
195086
  //
194996
- // No entities, functions, or agents found in project.
194997
- // Add resources to base44/entities/, base44/functions/, or base44/agents/
195087
+ // No entities, functions, agents, or connectors found in project.
195088
+ // Add resources to base44/entities/, base44/functions/, base44/agents/, or base44/connectors/
194998
195089
  // and run \`base44 types generate\` again.
194999
195090
 
195000
195091
  declare module '@base44/sdk' {
@@ -195007,8 +195098,8 @@ async function generateTypesFile(input) {
195007
195098
  await writeFile(getTypesOutputPath(projectRoot), content);
195008
195099
  }
195009
195100
  async function generateContent(input) {
195010
- const { entities, functions, agents } = input;
195011
- if (!entities.length && !functions.length && !agents.length) {
195101
+ const { entities, functions, agents, connectors } = input;
195102
+ if (!entities.length && !functions.length && !agents.length && !connectors.length) {
195012
195103
  return EMPTY_TEMPLATE;
195013
195104
  }
195014
195105
  const entityInterfaces = await Promise.all(entities.map((e8) => compileEntity(e8)));
@@ -195018,7 +195109,8 @@ async function generateContent(input) {
195018
195109
  entities.map((e8) => `"${e8.name}": ${toPascalCase(e8.name)};`)
195019
195110
  ],
195020
195111
  ["FunctionNameRegistry", functions.map((f7) => `"${f7.name}": true;`)],
195021
- ["AgentNameRegistry", agents.map((a5) => `"${a5.name}": true;`)]
195112
+ ["AgentNameRegistry", agents.map((a5) => `"${a5.name}": true;`)],
195113
+ ["ConnectorTypeRegistry", connectors.map((c8) => `"${c8.type}": true;`)]
195022
195114
  ];
195023
195115
  const registries2 = registryEntries.filter(([, entries]) => entries.length > 0).map(([name2, entries]) => registry2(name2, entries));
195024
195116
  return [
@@ -195067,10 +195159,10 @@ function toPascalCase(name2) {
195067
195159
  return name2.split(/[-_\s]+/).map((w9) => w9.charAt(0).toUpperCase() + w9.slice(1)).join("");
195068
195160
  }
195069
195161
  // src/core/types/update-project.ts
195070
- import { join as join12 } from "node:path";
195162
+ import { join as join14 } from "node:path";
195071
195163
  var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
195072
195164
  async function updateProjectConfig(projectRoot) {
195073
- const tsconfigPath = join12(projectRoot, "tsconfig.json");
195165
+ const tsconfigPath = join14(projectRoot, "tsconfig.json");
195074
195166
  if (!await pathExists(tsconfigPath)) {
195075
195167
  return false;
195076
195168
  }
@@ -195092,9 +195184,9 @@ async function updateProjectConfig(projectRoot) {
195092
195184
  // src/cli/commands/types/generate.ts
195093
195185
  var TYPES_FILE_PATH = "base44/.types/types.d.ts";
195094
195186
  async function generateTypesAction() {
195095
- const { entities, functions, agents, project: project2 } = await readProjectConfig();
195187
+ const { entities, functions, agents, connectors, project: project2 } = await readProjectConfig();
195096
195188
  await runTask("Generating types", async () => {
195097
- await generateTypesFile({ entities, functions, agents });
195189
+ await generateTypesFile({ entities, functions, agents, connectors });
195098
195190
  });
195099
195191
  const tsconfigUpdated = await updateProjectConfig(project2.root);
195100
195192
  return {
@@ -195399,7 +195491,7 @@ function createProgram(context) {
195399
195491
  program2.addCommand(getConnectorsCommand(context));
195400
195492
  program2.addCommand(getFunctionsDeployCommand(context));
195401
195493
  program2.addCommand(getSiteCommand(context));
195402
- program2.addCommand(getTypesCommand(context), { hidden: true });
195494
+ program2.addCommand(getTypesCommand(context));
195403
195495
  program2.addCommand(getDevCommand(context), { hidden: true });
195404
195496
  return program2;
195405
195497
  }
@@ -195439,7 +195531,7 @@ function nanoid3(size = 21) {
195439
195531
  }
195440
195532
 
195441
195533
  // node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
195442
- import { dirname as dirname10, posix, sep } from "path";
195534
+ import { dirname as dirname11, posix, sep } from "path";
195443
195535
  function createModulerModifier() {
195444
195536
  const getModuleFromFileName = createGetModuleFromFilename();
195445
195537
  return async (frames) => {
@@ -195448,7 +195540,7 @@ function createModulerModifier() {
195448
195540
  return frames;
195449
195541
  };
195450
195542
  }
195451
- function createGetModuleFromFilename(basePath = process.argv[1] ? dirname10(process.argv[1]) : process.cwd(), isWindows4 = sep === "\\") {
195543
+ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname11(process.argv[1]) : process.cwd(), isWindows4 = sep === "\\") {
195452
195544
  const normalizedBase = isWindows4 ? normalizeWindowsPath2(basePath) : basePath;
195453
195545
  return (filename) => {
195454
195546
  if (!filename)
@@ -199667,4 +199759,4 @@ export {
199667
199759
  CLIExitError
199668
199760
  };
199669
199761
 
199670
- //# debugId=1C2B8FF0CEEF724F64756E2164756E21
199762
+ //# debugId=8EF8E2ED7EA34D9964756E2164756E21