@base44-preview/cli 0.0.15-pr.104.dcaa6b4 → 0.0.15-pr.106.8dd9e6e

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
@@ -4,7 +4,7 @@ import { EventEmitter, addAbortListener, on, once, setMaxListeners } from "node:
4
4
  import childProcess, { ChildProcess, execFile, spawn, spawnSync } from "node:child_process";
5
5
  import path, { basename, dirname, join, posix, resolve, win32 } from "node:path";
6
6
  import fs, { appendFileSync, createReadStream, createWriteStream, readFileSync, statSync, writeFileSync } from "node:fs";
7
- import process$1, { execArgv, execPath, hrtime, platform, stdin, stdout } from "node:process";
7
+ import y, { execArgv, execPath, hrtime, platform, stdin, stdout } from "node:process";
8
8
  import { aborted, callbackify, debuglog, inspect, promisify, stripVTControlCharacters } from "node:util";
9
9
  import * as g from "node:readline";
10
10
  import O from "node:readline";
@@ -894,7 +894,7 @@ var require_command = /* @__PURE__ */ __commonJSMin(((exports) => {
894
894
  const childProcess$1 = __require("node:child_process");
895
895
  const path$15 = __require("node:path");
896
896
  const fs$10 = __require("node:fs");
897
- const process$4 = __require("node:process");
897
+ const process$3 = __require("node:process");
898
898
  const { Argument, humanReadableArgName } = require_argument();
899
899
  const { CommanderError } = require_error$1();
900
900
  const { Help } = require_help();
@@ -945,10 +945,10 @@ var require_command = /* @__PURE__ */ __commonJSMin(((exports) => {
945
945
  this._showHelpAfterError = false;
946
946
  this._showSuggestionAfterError = true;
947
947
  this._outputConfiguration = {
948
- writeOut: (str) => process$4.stdout.write(str),
949
- writeErr: (str) => process$4.stderr.write(str),
950
- getOutHelpWidth: () => process$4.stdout.isTTY ? process$4.stdout.columns : void 0,
951
- getErrHelpWidth: () => process$4.stderr.isTTY ? process$4.stderr.columns : void 0,
948
+ writeOut: (str) => process$3.stdout.write(str),
949
+ writeErr: (str) => process$3.stderr.write(str),
950
+ getOutHelpWidth: () => process$3.stdout.isTTY ? process$3.stdout.columns : void 0,
951
+ getErrHelpWidth: () => process$3.stderr.isTTY ? process$3.stderr.columns : void 0,
952
952
  outputError: (str, write) => write(str)
953
953
  };
954
954
  this._hidden = false;
@@ -1302,7 +1302,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1302
1302
  */
1303
1303
  _exit(exitCode, code$1, message) {
1304
1304
  if (this._exitCallback) this._exitCallback(new CommanderError(exitCode, code$1, message));
1305
- process$4.exit(exitCode);
1305
+ process$3.exit(exitCode);
1306
1306
  }
1307
1307
  /**
1308
1308
  * Register callback `fn` for the command.
@@ -1641,11 +1641,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
1641
1641
  if (argv !== void 0 && !Array.isArray(argv)) throw new Error("first parameter to parse must be array or undefined");
1642
1642
  parseOptions = parseOptions || {};
1643
1643
  if (argv === void 0 && parseOptions.from === void 0) {
1644
- if (process$4.versions?.electron) parseOptions.from = "electron";
1645
- const execArgv$1 = process$4.execArgv ?? [];
1644
+ if (process$3.versions?.electron) parseOptions.from = "electron";
1645
+ const execArgv$1 = process$3.execArgv ?? [];
1646
1646
  if (execArgv$1.includes("-e") || execArgv$1.includes("--eval") || execArgv$1.includes("-p") || execArgv$1.includes("--print")) parseOptions.from = "eval";
1647
1647
  }
1648
- if (argv === void 0) argv = process$4.argv;
1648
+ if (argv === void 0) argv = process$3.argv;
1649
1649
  this.rawArgs = argv.slice();
1650
1650
  let userArgs;
1651
1651
  switch (parseOptions.from) {
@@ -1655,7 +1655,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1655
1655
  userArgs = argv.slice(2);
1656
1656
  break;
1657
1657
  case "electron":
1658
- if (process$4.defaultApp) {
1658
+ if (process$3.defaultApp) {
1659
1659
  this._scriptPath = argv[1];
1660
1660
  userArgs = argv.slice(2);
1661
1661
  } else userArgs = argv.slice(1);
@@ -1769,15 +1769,15 @@ Expecting one of '${allowedValues.join("', '")}'`);
1769
1769
  }
1770
1770
  launchWithNode = sourceExt.includes(path$15.extname(executableFile));
1771
1771
  let proc$1;
1772
- if (process$4.platform !== "win32") if (launchWithNode) {
1772
+ if (process$3.platform !== "win32") if (launchWithNode) {
1773
1773
  args.unshift(executableFile);
1774
- args = incrementNodeInspectorPort(process$4.execArgv).concat(args);
1775
- proc$1 = childProcess$1.spawn(process$4.argv[0], args, { stdio: "inherit" });
1774
+ args = incrementNodeInspectorPort(process$3.execArgv).concat(args);
1775
+ proc$1 = childProcess$1.spawn(process$3.argv[0], args, { stdio: "inherit" });
1776
1776
  } else proc$1 = childProcess$1.spawn(executableFile, args, { stdio: "inherit" });
1777
1777
  else {
1778
1778
  args.unshift(executableFile);
1779
- args = incrementNodeInspectorPort(process$4.execArgv).concat(args);
1780
- proc$1 = childProcess$1.spawn(process$4.execPath, args, { stdio: "inherit" });
1779
+ args = incrementNodeInspectorPort(process$3.execArgv).concat(args);
1780
+ proc$1 = childProcess$1.spawn(process$3.execPath, args, { stdio: "inherit" });
1781
1781
  }
1782
1782
  if (!proc$1.killed) [
1783
1783
  "SIGUSR1",
@@ -1786,14 +1786,14 @@ Expecting one of '${allowedValues.join("', '")}'`);
1786
1786
  "SIGINT",
1787
1787
  "SIGHUP"
1788
1788
  ].forEach((signal) => {
1789
- process$4.on(signal, () => {
1789
+ process$3.on(signal, () => {
1790
1790
  if (proc$1.killed === false && proc$1.exitCode === null) proc$1.kill(signal);
1791
1791
  });
1792
1792
  });
1793
1793
  const exitCallback = this._exitCallback;
1794
1794
  proc$1.on("close", (code$1) => {
1795
1795
  code$1 = code$1 ?? 1;
1796
- if (!exitCallback) process$4.exit(code$1);
1796
+ if (!exitCallback) process$3.exit(code$1);
1797
1797
  else exitCallback(new CommanderError(code$1, "commander.executeSubCommandAsync", "(close)"));
1798
1798
  });
1799
1799
  proc$1.on("error", (err) => {
@@ -1805,7 +1805,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1805
1805
  - ${executableDirMessage}`;
1806
1806
  throw new Error(executableMissing);
1807
1807
  } else if (err.code === "EACCES") throw new Error(`'${executableFile}' not executable`);
1808
- if (!exitCallback) process$4.exit(1);
1808
+ if (!exitCallback) process$3.exit(1);
1809
1809
  else {
1810
1810
  const wrappedError = new CommanderError(1, "commander.executeSubCommandAsync", "(error)");
1811
1811
  wrappedError.nestedError = err;
@@ -2211,13 +2211,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
2211
2211
  */
2212
2212
  _parseOptionsEnv() {
2213
2213
  this.options.forEach((option) => {
2214
- if (option.envVar && option.envVar in process$4.env) {
2214
+ if (option.envVar && option.envVar in process$3.env) {
2215
2215
  const optionKey = option.attributeName();
2216
2216
  if (this.getOptionValue(optionKey) === void 0 || [
2217
2217
  "default",
2218
2218
  "config",
2219
2219
  "env"
2220
- ].includes(this.getOptionValueSource(optionKey))) if (option.required || option.optional) this.emit(`optionEnv:${option.name()}`, process$4.env[option.envVar]);
2220
+ ].includes(this.getOptionValueSource(optionKey))) if (option.required || option.optional) this.emit(`optionEnv:${option.name()}`, process$3.env[option.envVar]);
2221
2221
  else this.emit(`optionEnv:${option.name()}`);
2222
2222
  }
2223
2223
  });
@@ -2596,7 +2596,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2596
2596
  */
2597
2597
  help(contextOptions) {
2598
2598
  this.outputHelp(contextOptions);
2599
- let exitCode = process$4.exitCode || 0;
2599
+ let exitCode = process$3.exitCode || 0;
2600
2600
  if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) exitCode = 1;
2601
2601
  this._exit(exitCode, "commander.help", "(outputHelp)");
2602
2602
  }
@@ -2712,16 +2712,16 @@ var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2712
2712
  const CSI = `${ESC}[`;
2713
2713
  const beep = "\x07";
2714
2714
  const cursor = {
2715
- to(x$2, y$1) {
2716
- if (!y$1) return `${CSI}${x$2 + 1}G`;
2717
- return `${CSI}${y$1 + 1};${x$2 + 1}H`;
2715
+ to(x$2, y$2) {
2716
+ if (!y$2) return `${CSI}${x$2 + 1}G`;
2717
+ return `${CSI}${y$2 + 1};${x$2 + 1}H`;
2718
2718
  },
2719
- move(x$2, y$1) {
2719
+ move(x$2, y$2) {
2720
2720
  let ret = "";
2721
2721
  if (x$2 < 0) ret += `${CSI}${-x$2}D`;
2722
2722
  else if (x$2 > 0) ret += `${CSI}${x$2}C`;
2723
- if (y$1 < 0) ret += `${CSI}${-y$1}A`;
2724
- else if (y$1 > 0) ret += `${CSI}${y$1}B`;
2723
+ if (y$2 < 0) ret += `${CSI}${-y$2}A`;
2724
+ else if (y$2 > 0) ret += `${CSI}${y$2}B`;
2725
2725
  return ret;
2726
2726
  },
2727
2727
  up: (count$1 = 1) => `${CSI}${count$1}A`,
@@ -3031,13 +3031,13 @@ function rD() {
3031
3031
  }
3032
3032
  }), r;
3033
3033
  }
3034
- const ED = rD(), d$1 = new Set(["\x1B", "›"]), oD = 39, y = "\x07", V$1 = "[", nD = "]", G$1 = "m", _$1 = `${nD}8;;`, z = (e$1) => `${d$1.values().next().value}${V$1}${e$1}${G$1}`, K$1 = (e$1) => `${d$1.values().next().value}${_$1}${e$1}${y}`, aD = (e$1) => e$1.split(" ").map((u$2) => p(u$2)), k$1 = (e$1, u$2, t) => {
3034
+ const ED = rD(), d$1 = new Set(["\x1B", "›"]), oD = 39, y$1 = "\x07", V$1 = "[", nD = "]", G$1 = "m", _$1 = `${nD}8;;`, z = (e$1) => `${d$1.values().next().value}${V$1}${e$1}${G$1}`, K$1 = (e$1) => `${d$1.values().next().value}${_$1}${e$1}${y$1}`, aD = (e$1) => e$1.split(" ").map((u$2) => p(u$2)), k$1 = (e$1, u$2, t) => {
3035
3035
  const F$1 = [...u$2];
3036
3036
  let s = !1, i$1 = !1, D$1 = p(P$1(e$1[e$1.length - 1]));
3037
3037
  for (const [C$1, n$1] of F$1.entries()) {
3038
3038
  const E = p(n$1);
3039
3039
  if (D$1 + E <= t ? e$1[e$1.length - 1] += n$1 : (e$1.push(n$1), D$1 = 0), d$1.has(n$1) && (s = !0, i$1 = F$1.slice(C$1 + 1).join("").startsWith(_$1)), s) {
3040
- i$1 ? n$1 === y && (s = !1, i$1 = !1) : n$1 === G$1 && (s = !1);
3040
+ i$1 ? n$1 === y$1 && (s = !1, i$1 = !1) : n$1 === G$1 && (s = !1);
3041
3041
  continue;
3042
3042
  }
3043
3043
  D$1 += E, D$1 === t && C$1 < F$1.length - 1 && (e$1.push(""), D$1 = 0);
@@ -3079,7 +3079,7 @@ const ED = rD(), d$1 = new Set(["\x1B", "›"]), oD = 39, y = "\x07", V$1 = "[",
3079
3079
  `)];
3080
3080
  for (const [E, a$1] of n$1.entries()) {
3081
3081
  if (F$1 += a$1, d$1.has(a$1)) {
3082
- const { groups: c$1 } = (/* @__PURE__ */ new RegExp(`(?:\\${V$1}(?<code>\\d+)m|\\${_$1}(?<uri>.*)${y})`)).exec(n$1.slice(E).join("")) || { groups: {} };
3082
+ const { groups: c$1 } = (/* @__PURE__ */ new RegExp(`(?:\\${V$1}(?<code>\\d+)m|\\${_$1}(?<uri>.*)${y$1})`)).exec(n$1.slice(E).join("")) || { groups: {} };
3083
3083
  if (c$1.code !== void 0) {
3084
3084
  const f = Number.parseFloat(c$1.code);
3085
3085
  s = f === oD ? void 0 : f;
@@ -3480,7 +3480,7 @@ var RD = class extends x$1 {
3480
3480
  //#endregion
3481
3481
  //#region node_modules/@clack/prompts/dist/index.mjs
3482
3482
  function ce() {
3483
- return process$1.platform !== "win32" ? process$1.env.TERM !== "linux" : !!process$1.env.CI || !!process$1.env.WT_SESSION || !!process$1.env.TERMINUS_SUBLIME || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
3483
+ return y.platform !== "win32" ? y.env.TERM !== "linux" : !!y.env.CI || !!y.env.WT_SESSION || !!y.env.TERMINUS_SUBLIME || y.env.ConEmuTask === "{cmd::Cmder}" || y.env.TERM_PROGRAM === "Terminus-Sublime" || y.env.TERM_PROGRAM === "vscode" || y.env.TERM === "xterm-256color" || y.env.TERM === "alacritty" || y.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
3484
3484
  }
3485
3485
  const V = ce(), u$1 = (t, n$1) => V ? t : n$1, le = u$1("◆", "*"), L = u$1("■", "x"), W = u$1("▲", "x"), C = u$1("◇", "o"), ue = u$1("┌", "T"), o$1 = u$1("│", "|"), d = u$1("└", "—"), k = u$1("●", ">"), P = u$1("○", " "), A = u$1("◻", "[•]"), T = u$1("◼", "[+]"), F = u$1("◻", "[ ]"), $e = u$1("▪", "•"), _ = u$1("─", "-"), me = u$1("╮", "+"), de = u$1("├", "+"), pe = u$1("╯", "+"), q = u$1("●", "•"), D = u$1("◆", "*"), U = u$1("▲", "!"), K = u$1("■", "x"), b = (t) => {
3486
3486
  switch (t) {
@@ -4547,7 +4547,6 @@ const string$1 = (params) => {
4547
4547
  };
4548
4548
  const integer = /^-?\d+$/;
4549
4549
  const number$1 = /^-?\d+(?:\.\d+)?$/;
4550
- const boolean$1 = /^(?:true|false)$/i;
4551
4550
  const lowercase = /^[^A-Z]*$/;
4552
4551
  const uppercase = /^[^a-z]*$/;
4553
4552
 
@@ -5326,24 +5325,6 @@ const $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst,
5326
5325
  $ZodCheckNumberFormat.init(inst, def);
5327
5326
  $ZodNumber.init(inst, def);
5328
5327
  });
5329
- const $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
5330
- $ZodType.init(inst, def);
5331
- inst._zod.pattern = boolean$1;
5332
- inst._zod.parse = (payload, _ctx) => {
5333
- if (def.coerce) try {
5334
- payload.value = Boolean(payload.value);
5335
- } catch (_$2) {}
5336
- const input = payload.value;
5337
- if (typeof input === "boolean") return payload;
5338
- payload.issues.push({
5339
- expected: "boolean",
5340
- code: "invalid_type",
5341
- input,
5342
- inst
5343
- });
5344
- return payload;
5345
- };
5346
- });
5347
5328
  const $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
5348
5329
  $ZodType.init(inst, def);
5349
5330
  inst._zod.parse = (payload) => payload;
@@ -5819,97 +5800,6 @@ function handleTupleResult(result, final, index) {
5819
5800
  if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
5820
5801
  final.value[index] = result.value;
5821
5802
  }
5822
- const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
5823
- $ZodType.init(inst, def);
5824
- inst._zod.parse = (payload, ctx) => {
5825
- const input = payload.value;
5826
- if (!isPlainObject$1(input)) {
5827
- payload.issues.push({
5828
- expected: "record",
5829
- code: "invalid_type",
5830
- input,
5831
- inst
5832
- });
5833
- return payload;
5834
- }
5835
- const proms = [];
5836
- const values = def.keyType._zod.values;
5837
- if (values) {
5838
- payload.value = {};
5839
- const recordKeys = /* @__PURE__ */ new Set();
5840
- for (const key of values) if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
5841
- recordKeys.add(typeof key === "number" ? key.toString() : key);
5842
- const result = def.valueType._zod.run({
5843
- value: input[key],
5844
- issues: []
5845
- }, ctx);
5846
- if (result instanceof Promise) proms.push(result.then((result$1) => {
5847
- if (result$1.issues.length) payload.issues.push(...prefixIssues(key, result$1.issues));
5848
- payload.value[key] = result$1.value;
5849
- }));
5850
- else {
5851
- if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
5852
- payload.value[key] = result.value;
5853
- }
5854
- }
5855
- let unrecognized;
5856
- for (const key in input) if (!recordKeys.has(key)) {
5857
- unrecognized = unrecognized ?? [];
5858
- unrecognized.push(key);
5859
- }
5860
- if (unrecognized && unrecognized.length > 0) payload.issues.push({
5861
- code: "unrecognized_keys",
5862
- input,
5863
- inst,
5864
- keys: unrecognized
5865
- });
5866
- } else {
5867
- payload.value = {};
5868
- for (const key of Reflect.ownKeys(input)) {
5869
- if (key === "__proto__") continue;
5870
- let keyResult = def.keyType._zod.run({
5871
- value: key,
5872
- issues: []
5873
- }, ctx);
5874
- if (keyResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
5875
- if (typeof key === "string" && number$1.test(key) && keyResult.issues.length && keyResult.issues.some((iss) => iss.code === "invalid_type" && iss.expected === "number")) {
5876
- const retryResult = def.keyType._zod.run({
5877
- value: Number(key),
5878
- issues: []
5879
- }, ctx);
5880
- if (retryResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
5881
- if (retryResult.issues.length === 0) keyResult = retryResult;
5882
- }
5883
- if (keyResult.issues.length) {
5884
- if (def.mode === "loose") payload.value[key] = input[key];
5885
- else payload.issues.push({
5886
- code: "invalid_key",
5887
- origin: "record",
5888
- issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
5889
- input: key,
5890
- path: [key],
5891
- inst
5892
- });
5893
- continue;
5894
- }
5895
- const result = def.valueType._zod.run({
5896
- value: input[key],
5897
- issues: []
5898
- }, ctx);
5899
- if (result instanceof Promise) proms.push(result.then((result$1) => {
5900
- if (result$1.issues.length) payload.issues.push(...prefixIssues(key, result$1.issues));
5901
- payload.value[keyResult.value] = result$1.value;
5902
- }));
5903
- else {
5904
- if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
5905
- payload.value[keyResult.value] = result.value;
5906
- }
5907
- }
5908
- }
5909
- if (proms.length) return Promise.all(proms).then(() => payload);
5910
- return payload;
5911
- };
5912
- });
5913
5803
  const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
5914
5804
  $ZodType.init(inst, def);
5915
5805
  const values = getEnumValues(def.entries);
@@ -6489,13 +6379,6 @@ function _int(Class, params) {
6489
6379
  });
6490
6380
  }
6491
6381
  /* @__NO_SIDE_EFFECTS__ */
6492
- function _boolean(Class, params) {
6493
- return new Class({
6494
- type: "boolean",
6495
- ...normalizeParams(params)
6496
- });
6497
- }
6498
- /* @__NO_SIDE_EFFECTS__ */
6499
6382
  function _unknown(Class) {
6500
6383
  return new Class({ type: "unknown" });
6501
6384
  }
@@ -6745,7 +6628,7 @@ function initializeContext(params) {
6745
6628
  external: params?.external ?? void 0
6746
6629
  };
6747
6630
  }
6748
- function process$3(schema, ctx, _params = {
6631
+ function process$2(schema, ctx, _params = {
6749
6632
  path: [],
6750
6633
  schemaPath: []
6751
6634
  }) {
@@ -6782,7 +6665,7 @@ function process$3(schema, ctx, _params = {
6782
6665
  const parent = schema._zod.parent;
6783
6666
  if (parent) {
6784
6667
  if (!result.ref) result.ref = parent;
6785
- process$3(parent, ctx, params);
6668
+ process$2(parent, ctx, params);
6786
6669
  ctx.seen.get(parent).isParent = true;
6787
6670
  }
6788
6671
  }
@@ -6994,7 +6877,7 @@ const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
6994
6877
  ...params,
6995
6878
  processors
6996
6879
  });
6997
- process$3(schema, ctx);
6880
+ process$2(schema, ctx);
6998
6881
  extractDefs(ctx, schema);
6999
6882
  return finalize(ctx, schema);
7000
6883
  };
@@ -7006,7 +6889,7 @@ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params)
7006
6889
  io,
7007
6890
  processors
7008
6891
  });
7009
- process$3(schema, ctx);
6892
+ process$2(schema, ctx);
7010
6893
  extractDefs(ctx, schema);
7011
6894
  return finalize(ctx, schema);
7012
6895
  };
@@ -7066,9 +6949,6 @@ const numberProcessor = (schema, ctx, _json, _params) => {
7066
6949
  }
7067
6950
  if (typeof multipleOf === "number") json.multipleOf = multipleOf;
7068
6951
  };
7069
- const booleanProcessor = (_schema, _ctx, json, _params) => {
7070
- json.type = "boolean";
7071
- };
7072
6952
  const neverProcessor = (_schema, _ctx, json, _params) => {
7073
6953
  json.not = {};
7074
6954
  };
@@ -7093,7 +6973,7 @@ const arrayProcessor = (schema, ctx, _json, params) => {
7093
6973
  if (typeof minimum === "number") json.minItems = minimum;
7094
6974
  if (typeof maximum === "number") json.maxItems = maximum;
7095
6975
  json.type = "array";
7096
- json.items = process$3(def.element, ctx, {
6976
+ json.items = process$2(def.element, ctx, {
7097
6977
  ...params,
7098
6978
  path: [...params.path, "items"]
7099
6979
  });
@@ -7104,7 +6984,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
7104
6984
  json.type = "object";
7105
6985
  json.properties = {};
7106
6986
  const shape = def.shape;
7107
- for (const key in shape) json.properties[key] = process$3(shape[key], ctx, {
6987
+ for (const key in shape) json.properties[key] = process$2(shape[key], ctx, {
7108
6988
  ...params,
7109
6989
  path: [
7110
6990
  ...params.path,
@@ -7122,7 +7002,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
7122
7002
  if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
7123
7003
  else if (!def.catchall) {
7124
7004
  if (ctx.io === "output") json.additionalProperties = false;
7125
- } else if (def.catchall) json.additionalProperties = process$3(def.catchall, ctx, {
7005
+ } else if (def.catchall) json.additionalProperties = process$2(def.catchall, ctx, {
7126
7006
  ...params,
7127
7007
  path: [...params.path, "additionalProperties"]
7128
7008
  });
@@ -7130,7 +7010,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
7130
7010
  const unionProcessor = (schema, ctx, json, params) => {
7131
7011
  const def = schema._zod.def;
7132
7012
  const isExclusive = def.inclusive === false;
7133
- const options = def.options.map((x$2, i$1) => process$3(x$2, ctx, {
7013
+ const options = def.options.map((x$2, i$1) => process$2(x$2, ctx, {
7134
7014
  ...params,
7135
7015
  path: [
7136
7016
  ...params.path,
@@ -7143,7 +7023,7 @@ const unionProcessor = (schema, ctx, json, params) => {
7143
7023
  };
7144
7024
  const intersectionProcessor = (schema, ctx, json, params) => {
7145
7025
  const def = schema._zod.def;
7146
- const a$1 = process$3(def.left, ctx, {
7026
+ const a$1 = process$2(def.left, ctx, {
7147
7027
  ...params,
7148
7028
  path: [
7149
7029
  ...params.path,
@@ -7151,7 +7031,7 @@ const intersectionProcessor = (schema, ctx, json, params) => {
7151
7031
  0
7152
7032
  ]
7153
7033
  });
7154
- const b$2 = process$3(def.right, ctx, {
7034
+ const b$2 = process$2(def.right, ctx, {
7155
7035
  ...params,
7156
7036
  path: [
7157
7037
  ...params.path,
@@ -7168,7 +7048,7 @@ const tupleProcessor = (schema, ctx, _json, params) => {
7168
7048
  json.type = "array";
7169
7049
  const prefixPath$1 = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
7170
7050
  const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
7171
- const prefixItems = def.items.map((x$2, i$1) => process$3(x$2, ctx, {
7051
+ const prefixItems = def.items.map((x$2, i$1) => process$2(x$2, ctx, {
7172
7052
  ...params,
7173
7053
  path: [
7174
7054
  ...params.path,
@@ -7176,7 +7056,7 @@ const tupleProcessor = (schema, ctx, _json, params) => {
7176
7056
  i$1
7177
7057
  ]
7178
7058
  }));
7179
- const rest = def.rest ? process$3(def.rest, ctx, {
7059
+ const rest = def.rest ? process$2(def.rest, ctx, {
7180
7060
  ...params,
7181
7061
  path: [
7182
7062
  ...params.path,
@@ -7200,42 +7080,9 @@ const tupleProcessor = (schema, ctx, _json, params) => {
7200
7080
  if (typeof minimum === "number") json.minItems = minimum;
7201
7081
  if (typeof maximum === "number") json.maxItems = maximum;
7202
7082
  };
7203
- const recordProcessor = (schema, ctx, _json, params) => {
7204
- const json = _json;
7205
- const def = schema._zod.def;
7206
- json.type = "object";
7207
- const keyType = def.keyType;
7208
- const patterns = keyType._zod.bag?.patterns;
7209
- if (def.mode === "loose" && patterns && patterns.size > 0) {
7210
- const valueSchema = process$3(def.valueType, ctx, {
7211
- ...params,
7212
- path: [
7213
- ...params.path,
7214
- "patternProperties",
7215
- "*"
7216
- ]
7217
- });
7218
- json.patternProperties = {};
7219
- for (const pattern of patterns) json.patternProperties[pattern.source] = valueSchema;
7220
- } else {
7221
- if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") json.propertyNames = process$3(def.keyType, ctx, {
7222
- ...params,
7223
- path: [...params.path, "propertyNames"]
7224
- });
7225
- json.additionalProperties = process$3(def.valueType, ctx, {
7226
- ...params,
7227
- path: [...params.path, "additionalProperties"]
7228
- });
7229
- }
7230
- const keyValues = keyType._zod.values;
7231
- if (keyValues) {
7232
- const validKeyValues = [...keyValues].filter((v$1) => typeof v$1 === "string" || typeof v$1 === "number");
7233
- if (validKeyValues.length > 0) json.required = validKeyValues;
7234
- }
7235
- };
7236
7083
  const nullableProcessor = (schema, ctx, json, params) => {
7237
7084
  const def = schema._zod.def;
7238
- const inner = process$3(def.innerType, ctx, params);
7085
+ const inner = process$2(def.innerType, ctx, params);
7239
7086
  const seen = ctx.seen.get(schema);
7240
7087
  if (ctx.target === "openapi-3.0") {
7241
7088
  seen.ref = def.innerType;
@@ -7244,27 +7091,27 @@ const nullableProcessor = (schema, ctx, json, params) => {
7244
7091
  };
7245
7092
  const nonoptionalProcessor = (schema, ctx, _json, params) => {
7246
7093
  const def = schema._zod.def;
7247
- process$3(def.innerType, ctx, params);
7094
+ process$2(def.innerType, ctx, params);
7248
7095
  const seen = ctx.seen.get(schema);
7249
7096
  seen.ref = def.innerType;
7250
7097
  };
7251
7098
  const defaultProcessor = (schema, ctx, json, params) => {
7252
7099
  const def = schema._zod.def;
7253
- process$3(def.innerType, ctx, params);
7100
+ process$2(def.innerType, ctx, params);
7254
7101
  const seen = ctx.seen.get(schema);
7255
7102
  seen.ref = def.innerType;
7256
7103
  json.default = JSON.parse(JSON.stringify(def.defaultValue));
7257
7104
  };
7258
7105
  const prefaultProcessor = (schema, ctx, json, params) => {
7259
7106
  const def = schema._zod.def;
7260
- process$3(def.innerType, ctx, params);
7107
+ process$2(def.innerType, ctx, params);
7261
7108
  const seen = ctx.seen.get(schema);
7262
7109
  seen.ref = def.innerType;
7263
7110
  if (ctx.io === "input") json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
7264
7111
  };
7265
7112
  const catchProcessor = (schema, ctx, json, params) => {
7266
7113
  const def = schema._zod.def;
7267
- process$3(def.innerType, ctx, params);
7114
+ process$2(def.innerType, ctx, params);
7268
7115
  const seen = ctx.seen.get(schema);
7269
7116
  seen.ref = def.innerType;
7270
7117
  let catchValue;
@@ -7278,20 +7125,20 @@ const catchProcessor = (schema, ctx, json, params) => {
7278
7125
  const pipeProcessor = (schema, ctx, _json, params) => {
7279
7126
  const def = schema._zod.def;
7280
7127
  const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
7281
- process$3(innerType, ctx, params);
7128
+ process$2(innerType, ctx, params);
7282
7129
  const seen = ctx.seen.get(schema);
7283
7130
  seen.ref = innerType;
7284
7131
  };
7285
7132
  const readonlyProcessor = (schema, ctx, json, params) => {
7286
7133
  const def = schema._zod.def;
7287
- process$3(def.innerType, ctx, params);
7134
+ process$2(def.innerType, ctx, params);
7288
7135
  const seen = ctx.seen.get(schema);
7289
7136
  seen.ref = def.innerType;
7290
7137
  json.readOnly = true;
7291
7138
  };
7292
7139
  const optionalProcessor = (schema, ctx, _json, params) => {
7293
7140
  const def = schema._zod.def;
7294
- process$3(def.innerType, ctx, params);
7141
+ process$2(def.innerType, ctx, params);
7295
7142
  const seen = ctx.seen.get(schema);
7296
7143
  seen.ref = def.innerType;
7297
7144
  };
@@ -7625,14 +7472,6 @@ const ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, d
7625
7472
  function int(params) {
7626
7473
  return _int(ZodNumberFormat, params);
7627
7474
  }
7628
- const ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
7629
- $ZodBoolean.init(inst, def);
7630
- ZodType.init(inst, def);
7631
- inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
7632
- });
7633
- function boolean(params) {
7634
- return _boolean(ZodBoolean, params);
7635
- }
7636
7475
  const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
7637
7476
  $ZodUnknown.init(inst, def);
7638
7477
  ZodType.init(inst, def);
@@ -7762,21 +7601,6 @@ function tuple(items, _paramsOrRest, _params) {
7762
7601
  ...normalizeParams(params)
7763
7602
  });
7764
7603
  }
7765
- const ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
7766
- $ZodRecord.init(inst, def);
7767
- ZodType.init(inst, def);
7768
- inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
7769
- inst.keyType = def.keyType;
7770
- inst.valueType = def.valueType;
7771
- });
7772
- function record(keyType, valueType, params) {
7773
- return new ZodRecord({
7774
- type: "record",
7775
- keyType,
7776
- valueType,
7777
- ...normalizeParams(params)
7778
- });
7779
- }
7780
7604
  const ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
7781
7605
  $ZodEnum.init(inst, def);
7782
7606
  ZodType.init(inst, def);
@@ -8039,19 +7863,6 @@ var AuthValidationError = class extends Error {
8039
7863
  this.name = "AuthValidationError";
8040
7864
  }
8041
7865
  };
8042
- var ConnectorApiError = class extends Error {
8043
- constructor(message, cause) {
8044
- super(message);
8045
- this.cause = cause;
8046
- this.name = "ConnectorApiError";
8047
- }
8048
- };
8049
- var ConnectorValidationError = class extends Error {
8050
- constructor(message) {
8051
- super(message);
8052
- this.name = "ConnectorValidationError";
8053
- }
8054
- };
8055
7866
 
8056
7867
  //#endregion
8057
7868
  //#region src/core/consts.ts
@@ -16345,7 +16156,7 @@ const createIgnorePredicate = (patterns, cwd, baseDir) => {
16345
16156
  };
16346
16157
  const normalizeOptions$2 = (options = {}) => {
16347
16158
  const ignoreOption = options.ignore ? Array.isArray(options.ignore) ? options.ignore : [options.ignore] : [];
16348
- const cwd = toPath$1(options.cwd) ?? process$1.cwd();
16159
+ const cwd = toPath$1(options.cwd) ?? y.cwd();
16349
16160
  const deep = typeof options.deep === "number" ? Math.max(0, options.deep) + 1 : Number.POSITIVE_INFINITY;
16350
16161
  return {
16351
16162
  cwd,
@@ -16442,7 +16253,7 @@ const getDirectoryGlob = ({ directoryPath, files, extensions }) => {
16442
16253
  const extensionGlob = extensions?.length > 0 ? `.${extensions.length > 1 ? `{${extensions.join(",")}}` : extensions[0]}` : "";
16443
16254
  return files ? files.map((file) => path.posix.join(directoryPath, `**/${path.extname(file) ? file : `${file}${extensionGlob}`}`)) : [path.posix.join(directoryPath, `**${extensionGlob ? `/*${extensionGlob}` : ""}`)];
16444
16255
  };
16445
- const directoryToGlob = async (directoryPaths, { cwd = process$1.cwd(), files, extensions, fs: fsImplementation } = {}) => {
16256
+ const directoryToGlob = async (directoryPaths, { cwd = y.cwd(), files, extensions, fs: fsImplementation } = {}) => {
16446
16257
  return (await Promise.all(directoryPaths.map(async (directoryPath) => {
16447
16258
  if (shouldExpandGlobstarDirectory(isNegativePattern(directoryPath) ? directoryPath.slice(1) : directoryPath)) return getDirectoryGlob({
16448
16259
  directoryPath,
@@ -16456,7 +16267,7 @@ const directoryToGlob = async (directoryPaths, { cwd = process$1.cwd(), files, e
16456
16267
  }) : directoryPath;
16457
16268
  }))).flat();
16458
16269
  };
16459
- const directoryToGlobSync = (directoryPaths, { cwd = process$1.cwd(), files, extensions, fs: fsImplementation } = {}) => directoryPaths.flatMap((directoryPath) => {
16270
+ const directoryToGlobSync = (directoryPaths, { cwd = y.cwd(), files, extensions, fs: fsImplementation } = {}) => directoryPaths.flatMap((directoryPath) => {
16460
16271
  if (shouldExpandGlobstarDirectory(isNegativePattern(directoryPath) ? directoryPath.slice(1) : directoryPath)) return getDirectoryGlob({
16461
16272
  directoryPath,
16462
16273
  files,
@@ -16552,7 +16363,7 @@ const applyIgnoreFilesAndGetFilterSync = (options) => {
16552
16363
  };
16553
16364
  const createFilterFunction = (isIgnored, cwd) => {
16554
16365
  const seen = /* @__PURE__ */ new Set();
16555
- const basePath = cwd || process$1.cwd();
16366
+ const basePath = cwd || y.cwd();
16556
16367
  const pathCache = /* @__PURE__ */ new Map();
16557
16368
  return (fastGlobResult) => {
16558
16369
  const pathKey$1 = path.normalize(fastGlobResult.path ?? fastGlobResult);
@@ -16849,13 +16660,10 @@ const SiteConfigSchema = object({
16849
16660
  outputDirectory: string().optional(),
16850
16661
  installCommand: string().optional()
16851
16662
  });
16852
- const ConnectorConfigSchema = object({ scopes: array(string()).optional() });
16853
- const ConnectorsConfigSchema = record(string(), ConnectorConfigSchema);
16854
16663
  const ProjectConfigSchema = object({
16855
16664
  name: string().min(1, "App name cannot be empty"),
16856
16665
  description: string().optional(),
16857
16666
  site: SiteConfigSchema.optional(),
16858
- connectors: ConnectorsConfigSchema.optional(),
16859
16667
  entitiesDir: string().optional().default("entities"),
16860
16668
  functionsDir: string().optional().default("functions")
16861
16669
  });
@@ -30895,13 +30703,13 @@ var ansi_styles_default = ansiStyles;
30895
30703
 
30896
30704
  //#endregion
30897
30705
  //#region node_modules/chalk/source/vendor/supports-color/index.js
30898
- function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process$1.argv) {
30706
+ function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : y.argv) {
30899
30707
  const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
30900
30708
  const position = argv.indexOf(prefix + flag);
30901
30709
  const terminatorPosition = argv.indexOf("--");
30902
30710
  return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
30903
30711
  }
30904
- const { env } = process$1;
30712
+ const { env } = y;
30905
30713
  let flagForceColor;
30906
30714
  if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) flagForceColor = 0;
30907
30715
  else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) flagForceColor = 1;
@@ -30934,7 +30742,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
30934
30742
  if (haveStream && !streamIsTTY && forceColor === void 0) return 0;
30935
30743
  const min = forceColor || 0;
30936
30744
  if (env.TERM === "dumb") return min;
30937
- if (process$1.platform === "win32") {
30745
+ if (y.platform === "win32") {
30938
30746
  const osRelease = os.release().split(".");
30939
30747
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
30940
30748
  return 1;
@@ -31147,10 +30955,7 @@ const theme = {
31147
30955
  base44OrangeBackground: source_default.bgHex("#E86B3C"),
31148
30956
  shinyOrange: source_default.hex("#FFD700"),
31149
30957
  links: source_default.hex("#00D4FF"),
31150
- white: source_default.white,
31151
- success: source_default.green,
31152
- warning: source_default.yellow,
31153
- error: source_default.red
30958
+ white: source_default.white
31154
30959
  },
31155
30960
  styles: {
31156
30961
  header: source_default.dim,
@@ -31676,9 +31481,9 @@ const getSubprocessResult = ({ stdout: stdout$1 }) => {
31676
31481
  //#region node_modules/execa/lib/utils/standard-stream.js
31677
31482
  const isStandardStream = (stream) => STANDARD_STREAMS.includes(stream);
31678
31483
  const STANDARD_STREAMS = [
31679
- process$1.stdin,
31680
- process$1.stdout,
31681
- process$1.stderr
31484
+ y.stdin,
31485
+ y.stdout,
31486
+ y.stderr
31682
31487
  ];
31683
31488
  const STANDARD_STREAMS_ALIASES = [
31684
31489
  "stdin",
@@ -31803,9 +31608,9 @@ const NO_ESCAPE_REGEXP = /^[\w./-]+$/;
31803
31608
  //#endregion
31804
31609
  //#region node_modules/is-unicode-supported/index.js
31805
31610
  function isUnicodeSupported() {
31806
- const { env: env$1 } = process$1;
31611
+ const { env: env$1 } = y;
31807
31612
  const { TERM, TERM_PROGRAM } = env$1;
31808
- if (process$1.platform !== "win32") return TERM !== "linux";
31613
+ if (y.platform !== "win32") return TERM !== "linux";
31809
31614
  return Boolean(env$1.WT_SESSION) || Boolean(env$1.TERMINUS_SUBLIME) || env$1.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env$1.TERMINAL_EMULATOR === "JetBrains-JediTerm";
31810
31615
  }
31811
31616
 
@@ -32732,7 +32537,7 @@ const TEN_MEGABYTES_IN_BYTES = 10 * 1024 * 1024;
32732
32537
 
32733
32538
  //#endregion
32734
32539
  //#region node_modules/npm-run-path/index.js
32735
- const npmRunPath = ({ cwd = process$1.cwd(), path: pathOption = process$1.env[pathKey()], preferLocal = true, execPath: execPath$1 = process$1.execPath, addExecPath = true } = {}) => {
32540
+ const npmRunPath = ({ cwd = y.cwd(), path: pathOption = y.env[pathKey()], preferLocal = true, execPath: execPath$1 = y.execPath, addExecPath = true } = {}) => {
32736
32541
  const cwdPath = path.resolve(toPath(cwd));
32737
32542
  const result = [];
32738
32543
  const pathParts = pathOption.split(path.delimiter);
@@ -32750,7 +32555,7 @@ const applyExecPath = (result, pathParts, execPath$1, cwdPath) => {
32750
32555
  const pathPart = path.resolve(cwdPath, toPath(execPath$1), "..");
32751
32556
  if (!pathParts.includes(pathPart)) result.push(pathPart);
32752
32557
  };
32753
- const npmRunPathEnv = ({ env: env$1 = process$1.env, ...options } = {}) => {
32558
+ const npmRunPathEnv = ({ env: env$1 = y.env, ...options } = {}) => {
32754
32559
  env$1 = { ...env$1 };
32755
32560
  const pathName = pathKey({ env: env$1 });
32756
32561
  options.path = env$1[pathName];
@@ -33885,7 +33690,7 @@ const normalizeCwd = (cwd = getDefaultCwd()) => {
33885
33690
  };
33886
33691
  const getDefaultCwd = () => {
33887
33692
  try {
33888
- return process$1.cwd();
33693
+ return y.cwd();
33889
33694
  } catch (error) {
33890
33695
  error.message = `The current directory does not exist.\n${error.message}`;
33891
33696
  throw error;
@@ -33920,7 +33725,7 @@ const normalizeOptions = (filePath, rawArguments, rawOptions) => {
33920
33725
  options.killSignal = normalizeKillSignal(options.killSignal);
33921
33726
  options.forceKillAfterDelay = normalizeForceKillAfterDelay(options.forceKillAfterDelay);
33922
33727
  options.lines = options.lines.map((lines, fdNumber) => lines && !BINARY_ENCODINGS.has(options.encoding) && options.buffer[fdNumber]);
33923
- if (process$1.platform === "win32" && path.basename(file, ".exe") === "cmd") commandArguments.unshift("/q");
33728
+ if (y.platform === "win32" && path.basename(file, ".exe") === "cmd") commandArguments.unshift("/q");
33924
33729
  return {
33925
33730
  file,
33926
33731
  commandArguments,
@@ -33947,7 +33752,7 @@ const addDefaultOptions = ({ extendEnv = true, preferLocal = false, cwd, localDi
33947
33752
  });
33948
33753
  const getEnv = ({ env: envOption, extendEnv, preferLocal, node, localDirectory, nodePath }) => {
33949
33754
  const env$1 = extendEnv ? {
33950
- ...process$1.env,
33755
+ ...y.env,
33951
33756
  ...envOption
33952
33757
  } : envOption;
33953
33758
  if (preferLocal || node) return npmRunPathEnv({
@@ -34947,12 +34752,12 @@ const guessStreamDirection = {
34947
34752
  }
34948
34753
  };
34949
34754
  const getStandardStreamDirection = (value) => {
34950
- if ([0, process$1.stdin].includes(value)) return "input";
34755
+ if ([0, y.stdin].includes(value)) return "input";
34951
34756
  if ([
34952
34757
  1,
34953
34758
  2,
34954
- process$1.stdout,
34955
- process$1.stderr
34759
+ y.stdout,
34760
+ y.stderr
34956
34761
  ].includes(value)) return "output";
34957
34762
  };
34958
34763
  const DEFAULT_DIRECTION = "output";
@@ -36016,9 +35821,9 @@ const addIpcMethods = (subprocess, { ipc }) => {
36016
35821
  Object.assign(subprocess, getIpcMethods(subprocess, false, ipc));
36017
35822
  };
36018
35823
  const getIpcExport = () => {
36019
- const anyProcess = process$1;
35824
+ const anyProcess = y;
36020
35825
  const isSubprocess = true;
36021
- const ipc = process$1.channel !== void 0;
35826
+ const ipc = y.channel !== void 0;
36022
35827
  return {
36023
35828
  ...getIpcMethods(anyProcess, isSubprocess, ipc),
36024
35829
  getCancelSignal: getCancelSignal$1.bind(void 0, {
@@ -36260,7 +36065,7 @@ if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SI
36260
36065
 
36261
36066
  //#endregion
36262
36067
  //#region node_modules/signal-exit/dist/mjs/index.js
36263
- const processOk = (process$5) => !!process$5 && typeof process$5 === "object" && typeof process$5.removeListener === "function" && typeof process$5.emit === "function" && typeof process$5.reallyExit === "function" && typeof process$5.listeners === "function" && typeof process$5.kill === "function" && typeof process$5.pid === "number" && typeof process$5.on === "function";
36068
+ const processOk = (process$4) => !!process$4 && typeof process$4 === "object" && typeof process$4.removeListener === "function" && typeof process$4.emit === "function" && typeof process$4.reallyExit === "function" && typeof process$4.listeners === "function" && typeof process$4.kill === "function" && typeof process$4.pid === "number" && typeof process$4.on === "function";
36264
36069
  const kExitEmitter = Symbol.for("signal-exit emitter");
36265
36070
  const global$1 = globalThis;
36266
36071
  const ObjectDefineProperty = Object.defineProperty.bind(Object);
@@ -36328,7 +36133,7 @@ var SignalExitFallback = class extends SignalExitBase {
36328
36133
  };
36329
36134
  var SignalExit = class extends SignalExitBase {
36330
36135
  /* c8 ignore start */
36331
- #hupSig = process$2.platform === "win32" ? "SIGINT" : "SIGHUP";
36136
+ #hupSig = process$1.platform === "win32" ? "SIGINT" : "SIGHUP";
36332
36137
  /* c8 ignore stop */
36333
36138
  #emitter = new Emitter();
36334
36139
  #process;
@@ -36336,15 +36141,15 @@ var SignalExit = class extends SignalExitBase {
36336
36141
  #originalProcessReallyExit;
36337
36142
  #sigListeners = {};
36338
36143
  #loaded = false;
36339
- constructor(process$5) {
36144
+ constructor(process$4) {
36340
36145
  super();
36341
- this.#process = process$5;
36146
+ this.#process = process$4;
36342
36147
  this.#sigListeners = {};
36343
36148
  for (const sig of signals) this.#sigListeners[sig] = () => {
36344
36149
  const listeners = this.#process.listeners(sig);
36345
36150
  let { count: count$1 } = this.#emitter;
36346
36151
  /* c8 ignore start */
36347
- const p$1 = process$5;
36152
+ const p$1 = process$4;
36348
36153
  if (typeof p$1.__signal_exit_emitter__ === "object" && typeof p$1.__signal_exit_emitter__.count === "number") count$1 += p$1.__signal_exit_emitter__.count;
36349
36154
  /* c8 ignore stop */
36350
36155
  if (listeners.length === count$1) {
@@ -36352,11 +36157,11 @@ var SignalExit = class extends SignalExitBase {
36352
36157
  const ret = this.#emitter.emit("exit", null, sig);
36353
36158
  /* c8 ignore start */
36354
36159
  const s = sig === "SIGHUP" ? this.#hupSig : sig;
36355
- if (!ret) process$5.kill(process$5.pid, s);
36160
+ if (!ret) process$4.kill(process$4.pid, s);
36356
36161
  }
36357
36162
  };
36358
- this.#originalProcessReallyExit = process$5.reallyExit;
36359
- this.#originalProcessEmit = process$5.emit;
36163
+ this.#originalProcessReallyExit = process$4.reallyExit;
36164
+ this.#originalProcessEmit = process$4.emit;
36360
36165
  }
36361
36166
  onExit(cb, opts) {
36362
36167
  /* c8 ignore start */
@@ -36423,8 +36228,8 @@ var SignalExit = class extends SignalExitBase {
36423
36228
  } else return og.call(this.#process, ev, ...args);
36424
36229
  }
36425
36230
  };
36426
- const process$2 = globalThis.process;
36427
- const { onExit, load, unload } = signalExitWrap(processOk(process$2) ? new SignalExit(process$2) : new SignalExitFallback());
36231
+ const process$1 = globalThis.process;
36232
+ const { onExit, load, unload } = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
36428
36233
 
36429
36234
  //#endregion
36430
36235
  //#region node_modules/execa/lib/terminate/cleanup.js
@@ -38361,7 +38166,7 @@ function isInsideContainer() {
38361
38166
  //#endregion
38362
38167
  //#region node_modules/is-wsl/index.js
38363
38168
  const isWsl = () => {
38364
- if (process$1.platform !== "linux") return false;
38169
+ if (y.platform !== "linux") return false;
38365
38170
  if (os.release().toLowerCase().includes("microsoft")) {
38366
38171
  if (isInsideContainer()) return false;
38367
38172
  return true;
@@ -38372,12 +38177,12 @@ const isWsl = () => {
38372
38177
  return false;
38373
38178
  }
38374
38179
  };
38375
- var is_wsl_default = process$1.env.__IS_WSL_TEST__ ? isWsl : isWsl();
38180
+ var is_wsl_default = y.env.__IS_WSL_TEST__ ? isWsl : isWsl();
38376
38181
 
38377
38182
  //#endregion
38378
38183
  //#region node_modules/powershell-utils/index.js
38379
38184
  const execFile$2 = promisify(childProcess.execFile);
38380
- const powerShellPath$1 = () => `${process$1.env.SYSTEMROOT || process$1.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
38185
+ const powerShellPath$1 = () => `${y.env.SYSTEMROOT || y.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
38381
38186
  const executePowerShell = async (command, options = {}) => {
38382
38187
  const { powerShellPath: psPath, ...execFileOptions } = options;
38383
38188
  const encodedCommand = executePowerShell.encodeCommand(command);
@@ -38488,7 +38293,7 @@ function defineLazyProperty(object$1, propertyName, valueGetter) {
38488
38293
  //#region node_modules/default-browser-id/index.js
38489
38294
  const execFileAsync$3 = promisify(execFile);
38490
38295
  async function defaultBrowserId() {
38491
- if (process$1.platform !== "darwin") throw new Error("macOS only");
38296
+ if (y.platform !== "darwin") throw new Error("macOS only");
38492
38297
  const { stdout: stdout$1 } = await execFileAsync$3("defaults", [
38493
38298
  "read",
38494
38299
  "com.apple.LaunchServices/com.apple.launchservices.secure",
@@ -38503,7 +38308,7 @@ async function defaultBrowserId() {
38503
38308
  //#region node_modules/run-applescript/index.js
38504
38309
  const execFileAsync$2 = promisify(execFile);
38505
38310
  async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
38506
- if (process$1.platform !== "darwin") throw new Error("macOS only");
38311
+ if (y.platform !== "darwin") throw new Error("macOS only");
38507
38312
  const outputArguments = humanReadableOutput ? [] : ["-ss"];
38508
38313
  const execOptions = {};
38509
38314
  if (signal) execOptions.signal = signal;
@@ -38612,14 +38417,14 @@ async function defaultBrowser$1(_execFileAsync = execFileAsync$1) {
38612
38417
  const execFileAsync = promisify(execFile);
38613
38418
  const titleize = (string$2) => string$2.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x$2) => x$2.toUpperCase());
38614
38419
  async function defaultBrowser() {
38615
- if (process$1.platform === "darwin") {
38420
+ if (y.platform === "darwin") {
38616
38421
  const id = await defaultBrowserId();
38617
38422
  return {
38618
38423
  name: await bundleName(id),
38619
38424
  id
38620
38425
  };
38621
38426
  }
38622
- if (process$1.platform === "linux") {
38427
+ if (y.platform === "linux") {
38623
38428
  const { stdout: stdout$1 } = await execFileAsync("xdg-mime", [
38624
38429
  "query",
38625
38430
  "default",
@@ -38631,13 +38436,13 @@ async function defaultBrowser() {
38631
38436
  id
38632
38437
  };
38633
38438
  }
38634
- if (process$1.platform === "win32") return defaultBrowser$1();
38439
+ if (y.platform === "win32") return defaultBrowser$1();
38635
38440
  throw new Error("Only macOS, Linux, and Windows are supported");
38636
38441
  }
38637
38442
 
38638
38443
  //#endregion
38639
38444
  //#region node_modules/is-in-ssh/index.js
38640
- const isInSsh = Boolean(process$1.env.SSH_CONNECTION || process$1.env.SSH_CLIENT || process$1.env.SSH_TTY);
38445
+ const isInSsh = Boolean(y.env.SSH_CONNECTION || y.env.SSH_CLIENT || y.env.SSH_TTY);
38641
38446
  var is_in_ssh_default = isInSsh;
38642
38447
 
38643
38448
  //#endregion
@@ -38645,7 +38450,7 @@ var is_in_ssh_default = isInSsh;
38645
38450
  const fallbackAttemptSymbol = Symbol("fallbackAttempt");
38646
38451
  const __dirname = import.meta.url ? path.dirname(fileURLToPath(import.meta.url)) : "";
38647
38452
  const localXdgOpenPath = path.join(__dirname, "xdg-open");
38648
- const { platform: platform$1, arch } = process$1;
38453
+ const { platform: platform$1, arch } = y;
38649
38454
  const tryEachApp = async (apps$1, opener) => {
38650
38455
  if (apps$1.length === 0) return;
38651
38456
  const errors = [];
@@ -38758,7 +38563,7 @@ const baseOpen = async (options) => {
38758
38563
  await fs$1.access(localXdgOpenPath, constants$1.X_OK);
38759
38564
  exeLocalXdgOpen = true;
38760
38565
  } catch {}
38761
- command = process$1.versions.electron ?? (platform$1 === "android" || isBundled || !exeLocalXdgOpen) ? "xdg-open" : localXdgOpenPath;
38566
+ command = y.versions.electron ?? (platform$1 === "android" || isBundled || !exeLocalXdgOpen) ? "xdg-open" : localXdgOpenPath;
38762
38567
  }
38763
38568
  if (appArguments.length > 0) cliArguments.push(...appArguments);
38764
38569
  if (!options.wait) {
@@ -38984,663 +38789,6 @@ const siteDeployCommand = new Command("site").description("Manage site deploymen
38984
38789
  await runCommand(() => deployAction(options), { requireAuth: true });
38985
38790
  }));
38986
38791
 
38987
- //#endregion
38988
- //#region src/core/connectors/schema.ts
38989
- /**
38990
- * Response from POST /api/apps/{app_id}/external-auth/initiate
38991
- */
38992
- const InitiateResponseSchema = object({
38993
- redirect_url: string().nullish(),
38994
- connection_id: string().nullish(),
38995
- already_authorized: boolean().nullish(),
38996
- other_user_email: string().nullish(),
38997
- error: string().nullish()
38998
- });
38999
- /**
39000
- * Response from GET /api/apps/{app_id}/external-auth/status
39001
- */
39002
- const StatusResponseSchema = object({
39003
- status: _enum([
39004
- "ACTIVE",
39005
- "PENDING",
39006
- "FAILED"
39007
- ]),
39008
- account_email: string().nullish(),
39009
- error: string().nullish()
39010
- }).transform((data) => ({
39011
- status: data.status,
39012
- accountEmail: data.account_email,
39013
- error: data.error
39014
- }));
39015
- /**
39016
- * A connected integration from the list endpoint
39017
- */
39018
- const ConnectorSchema = object({
39019
- integration_type: string(),
39020
- status: string(),
39021
- connected_at: string().nullish(),
39022
- account_info: object({
39023
- email: string().nullish(),
39024
- name: string().nullish()
39025
- }).nullish()
39026
- }).transform((data) => ({
39027
- integrationType: data.integration_type,
39028
- status: data.status,
39029
- connectedAt: data.connected_at,
39030
- accountInfo: data.account_info
39031
- }));
39032
- /**
39033
- * Response from GET /api/apps/{app_id}/external-auth/list
39034
- */
39035
- const ListResponseSchema = object({ integrations: array(ConnectorSchema) });
39036
- /**
39037
- * Generic API error response
39038
- */
39039
- const ApiErrorSchema = object({
39040
- error: string(),
39041
- detail: string().nullish()
39042
- });
39043
-
39044
- //#endregion
39045
- //#region src/core/connectors/api.ts
39046
- /**
39047
- * Initiates OAuth flow for a connector integration.
39048
- * Returns a redirect URL to open in the browser.
39049
- */
39050
- async function initiateOAuth(integrationType, scopes = null) {
39051
- const response = await getAppClient().post("external-auth/initiate", {
39052
- json: {
39053
- integration_type: integrationType,
39054
- scopes
39055
- },
39056
- throwHttpErrors: false
39057
- });
39058
- const json = await response.json();
39059
- if (!response.ok) {
39060
- const errorResult = ApiErrorSchema.safeParse(json);
39061
- if (errorResult.success) throw new ConnectorApiError(errorResult.data.error);
39062
- throw new ConnectorApiError(`Failed to initiate OAuth: ${response.status} ${response.statusText}`);
39063
- }
39064
- const result = InitiateResponseSchema.safeParse(json);
39065
- if (!result.success) throw new ConnectorValidationError(`Invalid initiate response from server: ${result.error.message}`);
39066
- return result.data;
39067
- }
39068
- /**
39069
- * Checks the status of an OAuth connection attempt.
39070
- */
39071
- async function checkOAuthStatus(integrationType, connectionId) {
39072
- const response = await getAppClient().get("external-auth/status", {
39073
- searchParams: {
39074
- integration_type: integrationType,
39075
- connection_id: connectionId
39076
- },
39077
- throwHttpErrors: false
39078
- });
39079
- const json = await response.json();
39080
- if (!response.ok) {
39081
- const errorResult = ApiErrorSchema.safeParse(json);
39082
- if (errorResult.success) throw new ConnectorApiError(errorResult.data.error);
39083
- throw new ConnectorApiError(`Failed to check OAuth status: ${response.status} ${response.statusText}`);
39084
- }
39085
- const result = StatusResponseSchema.safeParse(json);
39086
- if (!result.success) throw new ConnectorValidationError(`Invalid status response from server: ${result.error.message}`);
39087
- return result.data;
39088
- }
39089
- /**
39090
- * Lists all connected integrations for the current app.
39091
- */
39092
- async function listConnectors() {
39093
- const response = await getAppClient().get("external-auth/list", { throwHttpErrors: false });
39094
- const json = await response.json();
39095
- if (!response.ok) {
39096
- const errorResult = ApiErrorSchema.safeParse(json);
39097
- if (errorResult.success) throw new ConnectorApiError(errorResult.data.error);
39098
- throw new ConnectorApiError(`Failed to list connectors: ${response.status} ${response.statusText}`);
39099
- }
39100
- const result = ListResponseSchema.safeParse(json);
39101
- if (!result.success) throw new ConnectorValidationError(`Invalid list response from server: ${result.error.message}`);
39102
- return result.data.integrations;
39103
- }
39104
- /**
39105
- * Disconnects (soft delete) a connector integration.
39106
- */
39107
- async function disconnectConnector(integrationType) {
39108
- const response = await getAppClient().delete(`external-auth/integrations/${integrationType}`, { throwHttpErrors: false });
39109
- if (!response.ok) {
39110
- const json = await response.json();
39111
- const errorResult = ApiErrorSchema.safeParse(json);
39112
- if (errorResult.success) throw new ConnectorApiError(errorResult.data.error);
39113
- throw new ConnectorApiError(`Failed to disconnect connector: ${response.status} ${response.statusText}`);
39114
- }
39115
- }
39116
- /**
39117
- * Removes (hard delete) a connector integration.
39118
- * This permanently removes the connector and cannot be undone.
39119
- */
39120
- async function removeConnector(integrationType) {
39121
- const response = await getAppClient().delete(`external-auth/integrations/${integrationType}/remove`, { throwHttpErrors: false });
39122
- if (!response.ok) {
39123
- const json = await response.json();
39124
- const errorResult = ApiErrorSchema.safeParse(json);
39125
- if (errorResult.success) throw new ConnectorApiError(errorResult.data.error);
39126
- throw new ConnectorApiError(`Failed to remove connector: ${response.status} ${response.statusText}`);
39127
- }
39128
- }
39129
-
39130
- //#endregion
39131
- //#region src/core/connectors/constants.ts
39132
- /**
39133
- * Supported OAuth connector integrations.
39134
- * Based on apper/backend/app/external_auth/models/constants.py
39135
- */
39136
- const SUPPORTED_INTEGRATIONS = [
39137
- "googlecalendar",
39138
- "googledrive",
39139
- "gmail",
39140
- "googlesheets",
39141
- "googledocs",
39142
- "googleslides",
39143
- "slack",
39144
- "notion",
39145
- "salesforce",
39146
- "hubspot",
39147
- "linkedin",
39148
- "tiktok"
39149
- ];
39150
- /**
39151
- * Display names for integrations (for CLI output)
39152
- */
39153
- const INTEGRATION_DISPLAY_NAMES = {
39154
- googlecalendar: "Google Calendar",
39155
- googledrive: "Google Drive",
39156
- gmail: "Gmail",
39157
- googlesheets: "Google Sheets",
39158
- googledocs: "Google Docs",
39159
- googleslides: "Google Slides",
39160
- slack: "Slack",
39161
- notion: "Notion",
39162
- salesforce: "Salesforce",
39163
- hubspot: "HubSpot",
39164
- linkedin: "LinkedIn",
39165
- tiktok: "TikTok"
39166
- };
39167
- function isValidIntegration(type) {
39168
- return SUPPORTED_INTEGRATIONS.includes(type);
39169
- }
39170
- function getIntegrationDisplayName(type) {
39171
- if (isValidIntegration(type)) return INTEGRATION_DISPLAY_NAMES[type];
39172
- return type;
39173
- }
39174
-
39175
- //#endregion
39176
- //#region src/core/connectors/config.ts
39177
- /**
39178
- * Read all connectors from the project config file
39179
- */
39180
- async function readLocalConnectors(projectRoot) {
39181
- const found = await findProjectRoot(projectRoot);
39182
- if (!found) return [];
39183
- const connectorsData = (await readJsonFile(found.configPath)).connectors;
39184
- if (!connectorsData) return [];
39185
- const connectors = [];
39186
- for (const [type, config$1] of Object.entries(connectorsData)) {
39187
- if (!isValidIntegration(type)) throw new Error(`Unknown connector type: ${type}`);
39188
- connectors.push({
39189
- type,
39190
- scopes: config$1.scopes
39191
- });
39192
- }
39193
- return connectors;
39194
- }
39195
- /**
39196
- * Write connectors to the project config file
39197
- */
39198
- async function writeLocalConnectors(connectors, projectRoot) {
39199
- const found = await findProjectRoot(projectRoot);
39200
- if (!found) throw new Error("Project config not found. Run this command from a Base44 project directory.");
39201
- const existingConfig = await readJsonFile(found.configPath);
39202
- const connectorsData = {};
39203
- for (const connector of connectors) connectorsData[connector.type] = { ...connector.scopes && { scopes: connector.scopes } };
39204
- const updatedConfig = {
39205
- ...existingConfig,
39206
- connectors: Object.keys(connectorsData).length > 0 ? connectorsData : void 0
39207
- };
39208
- if (!updatedConfig.connectors) delete updatedConfig.connectors;
39209
- await writeJsonFile(found.configPath, updatedConfig);
39210
- return found.configPath;
39211
- }
39212
- /**
39213
- * Add a connector to the project config file
39214
- */
39215
- async function addLocalConnector(type, scopes, projectRoot) {
39216
- const connectors = await readLocalConnectors(projectRoot);
39217
- const existing = connectors.find((c$1) => c$1.type === type);
39218
- if (existing) {
39219
- if (scopes) existing.scopes = scopes;
39220
- } else connectors.push({
39221
- type,
39222
- scopes
39223
- });
39224
- return await writeLocalConnectors(connectors, projectRoot);
39225
- }
39226
- /**
39227
- * Remove a connector from the project config file
39228
- */
39229
- async function removeLocalConnector(type, projectRoot) {
39230
- const connectors = await readLocalConnectors(projectRoot);
39231
- const filtered = connectors.filter((c$1) => c$1.type !== type);
39232
- if (filtered.length === connectors.length) return null;
39233
- return await writeLocalConnectors(filtered, projectRoot);
39234
- }
39235
-
39236
- //#endregion
39237
- //#region src/cli/commands/connectors/add.ts
39238
- const POLL_INTERVAL_MS$1 = 2e3;
39239
- const POLL_TIMEOUT_MS$1 = 300 * 1e3;
39240
- async function promptForIntegrationType() {
39241
- const selected = await ve({
39242
- message: "Select an integration to connect:",
39243
- options: SUPPORTED_INTEGRATIONS.map((type) => ({
39244
- value: type,
39245
- label: getIntegrationDisplayName(type)
39246
- }))
39247
- });
39248
- if (pD(selected)) return null;
39249
- return selected;
39250
- }
39251
- async function waitForOAuthCompletion(integrationType, connectionId) {
39252
- let accountEmail;
39253
- let error;
39254
- try {
39255
- await runTask("Waiting for authorization...", async (updateMessage) => {
39256
- await pWaitFor(async () => {
39257
- const status = await checkOAuthStatus(integrationType, connectionId);
39258
- if (status.status === "ACTIVE") {
39259
- accountEmail = status.accountEmail ?? void 0;
39260
- return true;
39261
- }
39262
- if (status.status === "FAILED") {
39263
- error = status.error || "Authorization failed";
39264
- throw new Error(error);
39265
- }
39266
- updateMessage("Waiting for authorization in browser...");
39267
- return false;
39268
- }, {
39269
- interval: POLL_INTERVAL_MS$1,
39270
- timeout: POLL_TIMEOUT_MS$1
39271
- });
39272
- }, {
39273
- successMessage: "Authorization completed!",
39274
- errorMessage: "Authorization failed"
39275
- });
39276
- return {
39277
- success: true,
39278
- accountEmail
39279
- };
39280
- } catch (err) {
39281
- if (err instanceof Error && err.message.includes("timed out")) return {
39282
- success: false,
39283
- error: "Authorization timed out. Please try again."
39284
- };
39285
- return {
39286
- success: false,
39287
- error: error || (err instanceof Error ? err.message : "Unknown error")
39288
- };
39289
- }
39290
- }
39291
- async function addConnector(integrationType) {
39292
- let selectedType;
39293
- if (!integrationType) {
39294
- const prompted = await promptForIntegrationType();
39295
- if (!prompted) return { outroMessage: "Cancelled" };
39296
- selectedType = prompted;
39297
- } else {
39298
- if (!isValidIntegration(integrationType)) {
39299
- const supportedList = SUPPORTED_INTEGRATIONS.join(", ");
39300
- throw new Error(`Unsupported connector: ${integrationType}\nSupported connectors: ${supportedList}`);
39301
- }
39302
- selectedType = integrationType;
39303
- }
39304
- const displayName = getIntegrationDisplayName(selectedType);
39305
- const initiateResponse = await runTask(`Initiating ${displayName} connection...`, async () => {
39306
- return await initiateOAuth(selectedType);
39307
- }, {
39308
- successMessage: `${displayName} OAuth initiated`,
39309
- errorMessage: `Failed to initiate ${displayName} connection`
39310
- });
39311
- if (initiateResponse.already_authorized) {
39312
- await addLocalConnector(selectedType);
39313
- return { outroMessage: `Already connected to ${theme.styles.bold(displayName)} (added to config)` };
39314
- }
39315
- if (initiateResponse.error === "different_user" && initiateResponse.other_user_email) throw new Error(`This app is already connected to ${displayName} by ${initiateResponse.other_user_email}`);
39316
- if (!initiateResponse.redirect_url || !initiateResponse.connection_id) throw new Error("Invalid response from server: missing redirect URL or connection ID");
39317
- M.info(`Please authorize ${displayName} at:\n${theme.colors.links(initiateResponse.redirect_url)}`);
39318
- const result = await waitForOAuthCompletion(selectedType, initiateResponse.connection_id);
39319
- if (!result.success) throw new Error(result.error || "Authorization failed");
39320
- await addLocalConnector(selectedType);
39321
- const accountInfo = result.accountEmail ? ` as ${theme.styles.bold(result.accountEmail)}` : "";
39322
- return { outroMessage: `Successfully connected to ${theme.styles.bold(displayName)}${accountInfo}` };
39323
- }
39324
- const connectorsAddCommand = new Command("add").argument("[type]", "Integration type (e.g., slack, notion, googlecalendar)").description("Connect an OAuth integration").action(async (type) => {
39325
- await runCommand(() => addConnector(type), {
39326
- requireAuth: true,
39327
- requireAppConfig: true
39328
- });
39329
- });
39330
-
39331
- //#endregion
39332
- //#region src/cli/commands/connectors/list.ts
39333
- function mergeConnectors(local, backend) {
39334
- const merged = /* @__PURE__ */ new Map();
39335
- for (const connector of local) merged.set(connector.type, {
39336
- type: connector.type,
39337
- displayName: getIntegrationDisplayName(connector.type),
39338
- inLocal: true,
39339
- inBackend: false
39340
- });
39341
- for (const connector of backend) {
39342
- const existing = merged.get(connector.integrationType);
39343
- const accountEmail = (connector.accountInfo?.email || connector.accountInfo?.name) ?? void 0;
39344
- if (existing) {
39345
- existing.inBackend = true;
39346
- existing.status = connector.status;
39347
- existing.accountEmail = accountEmail;
39348
- } else merged.set(connector.integrationType, {
39349
- type: connector.integrationType,
39350
- displayName: getIntegrationDisplayName(connector.integrationType),
39351
- inLocal: false,
39352
- inBackend: true,
39353
- status: connector.status,
39354
- accountEmail
39355
- });
39356
- }
39357
- return Array.from(merged.values());
39358
- }
39359
- function formatConnectorLine(connector) {
39360
- const { displayName, inLocal, inBackend, status, accountEmail } = connector;
39361
- const isConnected$1 = inBackend && status?.toLowerCase() === "active";
39362
- const isPending = inLocal && !inBackend;
39363
- const isOrphaned = inBackend && !inLocal;
39364
- let bullet;
39365
- let statusText = "";
39366
- if (isConnected$1) {
39367
- bullet = theme.colors.success("●");
39368
- if (accountEmail) statusText = ` - ${accountEmail}`;
39369
- } else if (isPending) {
39370
- bullet = theme.colors.warning("○");
39371
- statusText = theme.styles.dim(" (not connected)");
39372
- } else if (isOrphaned) {
39373
- bullet = theme.colors.error("○");
39374
- statusText = theme.styles.dim(" (not in local config)");
39375
- } else {
39376
- bullet = theme.colors.error("○");
39377
- statusText = theme.styles.dim(` (${status || "disconnected"})`);
39378
- }
39379
- return `${bullet} ${displayName}${statusText}`;
39380
- }
39381
- async function listConnectorsCommand() {
39382
- const [localConnectors, backendConnectors] = await runTask("Fetching connectors...", async () => {
39383
- const [local, backend] = await Promise.all([readLocalConnectors().catch(() => []), listConnectors().catch(() => [])]);
39384
- return [local, backend];
39385
- }, {
39386
- successMessage: "Connectors loaded",
39387
- errorMessage: "Failed to fetch connectors"
39388
- });
39389
- const merged = mergeConnectors(localConnectors, backendConnectors);
39390
- if (merged.length === 0) {
39391
- M.info("No connectors configured for this app.");
39392
- M.info(`Run ${theme.styles.bold("base44 connectors add")} to connect an integration.`);
39393
- return { outroMessage: "" };
39394
- }
39395
- console.log();
39396
- for (const connector of merged) console.log(formatConnectorLine(connector));
39397
- console.log();
39398
- const connected = merged.filter((c$1) => c$1.inBackend && c$1.status?.toLowerCase() === "active").length;
39399
- const pending = merged.filter((c$1) => c$1.inLocal && !c$1.inBackend).length;
39400
- let summary = `${connected} connected`;
39401
- if (pending > 0) {
39402
- summary += `, ${pending} pending`;
39403
- M.info(`Run ${theme.styles.bold("base44 connectors push")} to connect pending integrations.`);
39404
- }
39405
- return { outroMessage: summary };
39406
- }
39407
- const connectorsListCommand = new Command("list").description("List all connected OAuth integrations").action(async () => {
39408
- await runCommand(listConnectorsCommand, {
39409
- requireAuth: true,
39410
- requireAppConfig: true
39411
- });
39412
- });
39413
-
39414
- //#endregion
39415
- //#region src/cli/commands/connectors/push.ts
39416
- const POLL_INTERVAL_MS = 2e3;
39417
- const POLL_TIMEOUT_MS = 300 * 1e3;
39418
- function findPendingConnectors(local, backend) {
39419
- const connectedTypes = new Set(backend.filter((c$1) => c$1.status.toLowerCase() === "active").map((c$1) => c$1.integrationType));
39420
- return local.filter((c$1) => !connectedTypes.has(c$1.type)).map((c$1) => ({
39421
- type: c$1.type,
39422
- displayName: getIntegrationDisplayName(c$1.type),
39423
- scopes: c$1.scopes
39424
- }));
39425
- }
39426
- function findOrphanedConnectors(local, backend) {
39427
- const localTypes = new Set(local.map((c$1) => c$1.type));
39428
- return backend.filter((c$1) => c$1.status.toLowerCase() === "active").filter((c$1) => !localTypes.has(c$1.integrationType)).filter((c$1) => isValidIntegration(c$1.integrationType)).map((c$1) => ({
39429
- type: c$1.integrationType,
39430
- displayName: getIntegrationDisplayName(c$1.integrationType),
39431
- accountEmail: (c$1.accountInfo?.email || c$1.accountInfo?.name) ?? void 0
39432
- }));
39433
- }
39434
- async function connectSingleConnector(connector) {
39435
- const { type, displayName, scopes } = connector;
39436
- const initiateResponse = await initiateOAuth(type, scopes || null);
39437
- if (initiateResponse.already_authorized) return { success: true };
39438
- if (initiateResponse.error === "different_user") return {
39439
- success: false,
39440
- error: `Already connected by ${initiateResponse.other_user_email}`
39441
- };
39442
- if (!initiateResponse.redirect_url || !initiateResponse.connection_id) return {
39443
- success: false,
39444
- error: "Invalid response from server"
39445
- };
39446
- M.info(`Please authorize ${displayName} at:\n${theme.colors.links(initiateResponse.redirect_url)}`);
39447
- let accountEmail;
39448
- try {
39449
- await runTask("Waiting for authorization...", async () => {
39450
- await pWaitFor(async () => {
39451
- const status = await checkOAuthStatus(type, initiateResponse.connection_id);
39452
- if (status.status === "ACTIVE") {
39453
- accountEmail = status.accountEmail ?? void 0;
39454
- return true;
39455
- }
39456
- if (status.status === "FAILED") throw new Error(status.error || "Authorization failed");
39457
- return false;
39458
- }, {
39459
- interval: POLL_INTERVAL_MS,
39460
- timeout: POLL_TIMEOUT_MS
39461
- });
39462
- }, {
39463
- successMessage: "Authorization completed!",
39464
- errorMessage: "Authorization failed"
39465
- });
39466
- return {
39467
- success: true,
39468
- accountEmail
39469
- };
39470
- } catch (err) {
39471
- if (err instanceof Error && err.message.includes("timed out")) return {
39472
- success: false,
39473
- error: "Authorization timed out. Please try again."
39474
- };
39475
- return {
39476
- success: false,
39477
- error: err instanceof Error ? err.message : "Unknown error"
39478
- };
39479
- }
39480
- }
39481
- async function pushConnectorsCommand() {
39482
- const [localConnectors, backendConnectors] = await runTask("Checking connector status...", async () => {
39483
- const [local, backend] = await Promise.all([readLocalConnectors(), listConnectors().catch(() => [])]);
39484
- return [local, backend];
39485
- }, {
39486
- successMessage: "Status checked",
39487
- errorMessage: "Failed to check status"
39488
- });
39489
- const pending = findPendingConnectors(localConnectors, backendConnectors);
39490
- const orphaned = findOrphanedConnectors(localConnectors, backendConnectors);
39491
- if (pending.length === 0 && orphaned.length === 0) return { outroMessage: "All connectors are in sync" };
39492
- console.log();
39493
- if (pending.length > 0) {
39494
- M.info(`${pending.length} connector${pending.length === 1 ? "" : "s"} to connect:`);
39495
- for (const c$1 of pending) console.log(` ${theme.colors.success("+")} ${c$1.displayName}`);
39496
- }
39497
- if (orphaned.length > 0) {
39498
- M.info(`${orphaned.length} connector${orphaned.length === 1 ? "" : "s"} to remove:`);
39499
- for (const c$1 of orphaned) {
39500
- const accountInfo = c$1.accountEmail ? ` (${c$1.accountEmail})` : "";
39501
- console.log(` ${theme.colors.error("-")} ${c$1.displayName}${accountInfo}`);
39502
- }
39503
- }
39504
- console.log();
39505
- const totalChanges = pending.length + orphaned.length;
39506
- const shouldProceed = await ye({
39507
- message: `Apply ${totalChanges} change${totalChanges === 1 ? "" : "s"}?`,
39508
- initialValue: true
39509
- });
39510
- if (pD(shouldProceed) || !shouldProceed) return { outroMessage: "Cancelled" };
39511
- let connected = 0;
39512
- let removed = 0;
39513
- let failed = 0;
39514
- for (const connector of orphaned) try {
39515
- await disconnectConnector(connector.type);
39516
- M.success(`Removed ${connector.displayName}`);
39517
- removed++;
39518
- } catch (err) {
39519
- M.error(`Failed to remove ${connector.displayName}: ${err instanceof Error ? err.message : "Unknown error"}`);
39520
- failed++;
39521
- }
39522
- for (const connector of pending) {
39523
- console.log();
39524
- M.info(`Connecting ${theme.styles.bold(connector.displayName)}...`);
39525
- const result = await connectSingleConnector(connector);
39526
- if (result.success) {
39527
- const accountInfo = result.accountEmail ? ` as ${result.accountEmail}` : "";
39528
- M.success(`${connector.displayName} connected${accountInfo}`);
39529
- connected++;
39530
- } else {
39531
- M.error(`${connector.displayName} failed: ${result.error}`);
39532
- failed++;
39533
- }
39534
- }
39535
- console.log();
39536
- const parts = [];
39537
- if (connected > 0) parts.push(`${connected} connected`);
39538
- if (removed > 0) parts.push(`${removed} removed`);
39539
- if (failed > 0) parts.push(`${failed} failed`);
39540
- return { outroMessage: parts.join(", ") };
39541
- }
39542
- const connectorsPushCommand = new Command("push").description("Sync connectors with backend (connect new, remove missing)").action(async () => {
39543
- await runCommand(pushConnectorsCommand, {
39544
- requireAuth: true,
39545
- requireAppConfig: true
39546
- });
39547
- });
39548
-
39549
- //#endregion
39550
- //#region src/cli/commands/connectors/remove.ts
39551
- function mergeConnectorsForRemoval(local, backend) {
39552
- const merged = /* @__PURE__ */ new Map();
39553
- for (const connector of local) merged.set(connector.type, {
39554
- type: connector.type,
39555
- displayName: getIntegrationDisplayName(connector.type),
39556
- inLocal: true,
39557
- inBackend: false
39558
- });
39559
- for (const connector of backend) {
39560
- if (!isValidIntegration(connector.integrationType)) continue;
39561
- const existing = merged.get(connector.integrationType);
39562
- const accountEmail = (connector.accountInfo?.email || connector.accountInfo?.name) ?? void 0;
39563
- if (existing) {
39564
- existing.inBackend = true;
39565
- existing.accountEmail = accountEmail;
39566
- } else merged.set(connector.integrationType, {
39567
- type: connector.integrationType,
39568
- displayName: getIntegrationDisplayName(connector.integrationType),
39569
- inLocal: false,
39570
- inBackend: true,
39571
- accountEmail
39572
- });
39573
- }
39574
- return Array.from(merged.values());
39575
- }
39576
- async function promptForConnectorToRemove(connectors) {
39577
- const selected = await ve({
39578
- message: "Select a connector to remove:",
39579
- options: connectors.map((c$1) => {
39580
- let label = c$1.displayName;
39581
- if (c$1.accountEmail) label += ` (${c$1.accountEmail})`;
39582
- else if (c$1.inLocal && !c$1.inBackend) label += " (not connected)";
39583
- return {
39584
- value: c$1.type,
39585
- label
39586
- };
39587
- })
39588
- });
39589
- if (pD(selected)) return null;
39590
- return selected;
39591
- }
39592
- async function removeConnectorCommand(integrationType, options = {}) {
39593
- const isHardDelete = options.hard === true;
39594
- const [localConnectors, backendConnectors] = await runTask("Fetching connectors...", async () => {
39595
- const [local, backend] = await Promise.all([readLocalConnectors().catch(() => []), listConnectors().catch(() => [])]);
39596
- return [local, backend];
39597
- }, {
39598
- successMessage: "Connectors loaded",
39599
- errorMessage: "Failed to fetch connectors"
39600
- });
39601
- const merged = mergeConnectorsForRemoval(localConnectors, backendConnectors);
39602
- if (merged.length === 0) return { outroMessage: "No connectors to remove" };
39603
- let selectedType;
39604
- let selectedConnector;
39605
- if (!integrationType) {
39606
- const prompted = await promptForConnectorToRemove(merged);
39607
- if (!prompted) return { outroMessage: "Cancelled" };
39608
- selectedType = prompted;
39609
- selectedConnector = merged.find((c$1) => c$1.type === selectedType);
39610
- } else {
39611
- if (!isValidIntegration(integrationType)) throw new Error(`Invalid connector type: ${integrationType}`);
39612
- selectedConnector = merged.find((c$1) => c$1.type === integrationType);
39613
- if (!selectedConnector) throw new Error(`No ${getIntegrationDisplayName(integrationType)} connector found`);
39614
- selectedType = integrationType;
39615
- }
39616
- const displayName = getIntegrationDisplayName(selectedType);
39617
- const accountInfo = selectedConnector?.accountEmail ? ` (${selectedConnector.accountEmail})` : "";
39618
- const shouldRemove = await ye({
39619
- message: `${isHardDelete ? "Permanently remove" : "Remove"} ${displayName}${accountInfo}?`,
39620
- initialValue: false
39621
- });
39622
- if (pD(shouldRemove) || !shouldRemove) return { outroMessage: "Cancelled" };
39623
- await runTask(isHardDelete ? `Removing ${displayName}...` : `Removing ${displayName}...`, async () => {
39624
- if (selectedConnector?.inBackend) if (isHardDelete) await removeConnector(selectedType);
39625
- else await disconnectConnector(selectedType);
39626
- await removeLocalConnector(selectedType);
39627
- }, {
39628
- successMessage: `${displayName} removed`,
39629
- errorMessage: `Failed to remove ${displayName}`
39630
- });
39631
- return { outroMessage: `Successfully removed ${theme.styles.bold(displayName)}` };
39632
- }
39633
- const connectorsRemoveCommand = new Command("remove").argument("[type]", "Integration type to remove (e.g., slack, notion)").option("--hard", "Permanently remove the connector (cannot be undone)").description("Remove an OAuth integration").action(async (type, options) => {
39634
- await runCommand(() => removeConnectorCommand(type, options), {
39635
- requireAuth: true,
39636
- requireAppConfig: true
39637
- });
39638
- });
39639
-
39640
- //#endregion
39641
- //#region src/cli/commands/connectors/index.ts
39642
- const connectorsCommand = new Command("connectors").description("Manage OAuth connectors").addCommand(connectorsAddCommand).addCommand(connectorsListCommand).addCommand(connectorsPushCommand).addCommand(connectorsRemoveCommand);
39643
-
39644
38792
  //#endregion
39645
38793
  //#region package.json
39646
38794
  var version = "0.0.15";
@@ -39660,7 +38808,6 @@ program.addCommand(linkCommand);
39660
38808
  program.addCommand(entitiesPushCommand);
39661
38809
  program.addCommand(functionsDeployCommand);
39662
38810
  program.addCommand(siteDeployCommand);
39663
- program.addCommand(connectorsCommand);
39664
38811
  program.parse();
39665
38812
 
39666
38813
  //#endregion