@base44-preview/cli 0.0.17-pr.104.e7dd3a1 → 0.0.17-pr.108.483ba44

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.
Files changed (3) hide show
  1. package/README.md +0 -33
  2. package/dist/index.js +98 -950
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import { EventEmitter, addAbortListener, on, once, setMaxListeners } from "node:
3
3
  import childProcess, { ChildProcess, execFile, spawn, spawnSync } from "node:child_process";
4
4
  import path, { basename, dirname, join, posix, resolve, win32 } from "node:path";
5
5
  import fs, { appendFileSync, createReadStream, createWriteStream, readFileSync, statSync, writeFileSync } from "node:fs";
6
- import y, { execArgv, execPath, hrtime, platform, stdin, stdout } from "node:process";
6
+ import process$1, { execArgv, execPath, hrtime, platform, stdin, stdout } from "node:process";
7
7
  import { aborted, callbackify, debuglog, inspect, promisify, stripVTControlCharacters } from "node:util";
8
8
  import * as g from "node:readline";
9
9
  import O from "node:readline";
@@ -893,7 +893,7 @@ var require_command = /* @__PURE__ */ __commonJSMin(((exports) => {
893
893
  const childProcess$1 = __require("node:child_process");
894
894
  const path$15 = __require("node:path");
895
895
  const fs$10 = __require("node:fs");
896
- const process$3 = __require("node:process");
896
+ const process$4 = __require("node:process");
897
897
  const { Argument, humanReadableArgName } = require_argument();
898
898
  const { CommanderError } = require_error$1();
899
899
  const { Help } = require_help();
@@ -944,10 +944,10 @@ var require_command = /* @__PURE__ */ __commonJSMin(((exports) => {
944
944
  this._showHelpAfterError = false;
945
945
  this._showSuggestionAfterError = true;
946
946
  this._outputConfiguration = {
947
- writeOut: (str) => process$3.stdout.write(str),
948
- writeErr: (str) => process$3.stderr.write(str),
949
- getOutHelpWidth: () => process$3.stdout.isTTY ? process$3.stdout.columns : void 0,
950
- getErrHelpWidth: () => process$3.stderr.isTTY ? process$3.stderr.columns : void 0,
947
+ writeOut: (str) => process$4.stdout.write(str),
948
+ writeErr: (str) => process$4.stderr.write(str),
949
+ getOutHelpWidth: () => process$4.stdout.isTTY ? process$4.stdout.columns : void 0,
950
+ getErrHelpWidth: () => process$4.stderr.isTTY ? process$4.stderr.columns : void 0,
951
951
  outputError: (str, write) => write(str)
952
952
  };
953
953
  this._hidden = false;
@@ -1301,7 +1301,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1301
1301
  */
1302
1302
  _exit(exitCode, code$1, message) {
1303
1303
  if (this._exitCallback) this._exitCallback(new CommanderError(exitCode, code$1, message));
1304
- process$3.exit(exitCode);
1304
+ process$4.exit(exitCode);
1305
1305
  }
1306
1306
  /**
1307
1307
  * Register callback `fn` for the command.
@@ -1640,11 +1640,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
1640
1640
  if (argv !== void 0 && !Array.isArray(argv)) throw new Error("first parameter to parse must be array or undefined");
1641
1641
  parseOptions = parseOptions || {};
1642
1642
  if (argv === void 0 && parseOptions.from === void 0) {
1643
- if (process$3.versions?.electron) parseOptions.from = "electron";
1644
- const execArgv$1 = process$3.execArgv ?? [];
1643
+ if (process$4.versions?.electron) parseOptions.from = "electron";
1644
+ const execArgv$1 = process$4.execArgv ?? [];
1645
1645
  if (execArgv$1.includes("-e") || execArgv$1.includes("--eval") || execArgv$1.includes("-p") || execArgv$1.includes("--print")) parseOptions.from = "eval";
1646
1646
  }
1647
- if (argv === void 0) argv = process$3.argv;
1647
+ if (argv === void 0) argv = process$4.argv;
1648
1648
  this.rawArgs = argv.slice();
1649
1649
  let userArgs;
1650
1650
  switch (parseOptions.from) {
@@ -1654,7 +1654,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1654
1654
  userArgs = argv.slice(2);
1655
1655
  break;
1656
1656
  case "electron":
1657
- if (process$3.defaultApp) {
1657
+ if (process$4.defaultApp) {
1658
1658
  this._scriptPath = argv[1];
1659
1659
  userArgs = argv.slice(2);
1660
1660
  } else userArgs = argv.slice(1);
@@ -1768,15 +1768,15 @@ Expecting one of '${allowedValues.join("', '")}'`);
1768
1768
  }
1769
1769
  launchWithNode = sourceExt.includes(path$15.extname(executableFile));
1770
1770
  let proc$1;
1771
- if (process$3.platform !== "win32") if (launchWithNode) {
1771
+ if (process$4.platform !== "win32") if (launchWithNode) {
1772
1772
  args.unshift(executableFile);
1773
- args = incrementNodeInspectorPort(process$3.execArgv).concat(args);
1774
- proc$1 = childProcess$1.spawn(process$3.argv[0], args, { stdio: "inherit" });
1773
+ args = incrementNodeInspectorPort(process$4.execArgv).concat(args);
1774
+ proc$1 = childProcess$1.spawn(process$4.argv[0], args, { stdio: "inherit" });
1775
1775
  } else proc$1 = childProcess$1.spawn(executableFile, args, { stdio: "inherit" });
1776
1776
  else {
1777
1777
  args.unshift(executableFile);
1778
- args = incrementNodeInspectorPort(process$3.execArgv).concat(args);
1779
- proc$1 = childProcess$1.spawn(process$3.execPath, args, { stdio: "inherit" });
1778
+ args = incrementNodeInspectorPort(process$4.execArgv).concat(args);
1779
+ proc$1 = childProcess$1.spawn(process$4.execPath, args, { stdio: "inherit" });
1780
1780
  }
1781
1781
  if (!proc$1.killed) [
1782
1782
  "SIGUSR1",
@@ -1785,14 +1785,14 @@ Expecting one of '${allowedValues.join("', '")}'`);
1785
1785
  "SIGINT",
1786
1786
  "SIGHUP"
1787
1787
  ].forEach((signal) => {
1788
- process$3.on(signal, () => {
1788
+ process$4.on(signal, () => {
1789
1789
  if (proc$1.killed === false && proc$1.exitCode === null) proc$1.kill(signal);
1790
1790
  });
1791
1791
  });
1792
1792
  const exitCallback = this._exitCallback;
1793
1793
  proc$1.on("close", (code$1) => {
1794
1794
  code$1 = code$1 ?? 1;
1795
- if (!exitCallback) process$3.exit(code$1);
1795
+ if (!exitCallback) process$4.exit(code$1);
1796
1796
  else exitCallback(new CommanderError(code$1, "commander.executeSubCommandAsync", "(close)"));
1797
1797
  });
1798
1798
  proc$1.on("error", (err) => {
@@ -1804,7 +1804,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1804
1804
  - ${executableDirMessage}`;
1805
1805
  throw new Error(executableMissing);
1806
1806
  } else if (err.code === "EACCES") throw new Error(`'${executableFile}' not executable`);
1807
- if (!exitCallback) process$3.exit(1);
1807
+ if (!exitCallback) process$4.exit(1);
1808
1808
  else {
1809
1809
  const wrappedError = new CommanderError(1, "commander.executeSubCommandAsync", "(error)");
1810
1810
  wrappedError.nestedError = err;
@@ -2210,13 +2210,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
2210
2210
  */
2211
2211
  _parseOptionsEnv() {
2212
2212
  this.options.forEach((option) => {
2213
- if (option.envVar && option.envVar in process$3.env) {
2213
+ if (option.envVar && option.envVar in process$4.env) {
2214
2214
  const optionKey = option.attributeName();
2215
2215
  if (this.getOptionValue(optionKey) === void 0 || [
2216
2216
  "default",
2217
2217
  "config",
2218
2218
  "env"
2219
- ].includes(this.getOptionValueSource(optionKey))) if (option.required || option.optional) this.emit(`optionEnv:${option.name()}`, process$3.env[option.envVar]);
2219
+ ].includes(this.getOptionValueSource(optionKey))) if (option.required || option.optional) this.emit(`optionEnv:${option.name()}`, process$4.env[option.envVar]);
2220
2220
  else this.emit(`optionEnv:${option.name()}`);
2221
2221
  }
2222
2222
  });
@@ -2595,7 +2595,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2595
2595
  */
2596
2596
  help(contextOptions) {
2597
2597
  this.outputHelp(contextOptions);
2598
- let exitCode = process$3.exitCode || 0;
2598
+ let exitCode = process$4.exitCode || 0;
2599
2599
  if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) exitCode = 1;
2600
2600
  this._exit(exitCode, "commander.help", "(outputHelp)");
2601
2601
  }
@@ -2711,16 +2711,16 @@ var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2711
2711
  const CSI = `${ESC}[`;
2712
2712
  const beep = "\x07";
2713
2713
  const cursor = {
2714
- to(x$2, y$2) {
2715
- if (!y$2) return `${CSI}${x$2 + 1}G`;
2716
- return `${CSI}${y$2 + 1};${x$2 + 1}H`;
2714
+ to(x$2, y$1) {
2715
+ if (!y$1) return `${CSI}${x$2 + 1}G`;
2716
+ return `${CSI}${y$1 + 1};${x$2 + 1}H`;
2717
2717
  },
2718
- move(x$2, y$2) {
2718
+ move(x$2, y$1) {
2719
2719
  let ret = "";
2720
2720
  if (x$2 < 0) ret += `${CSI}${-x$2}D`;
2721
2721
  else if (x$2 > 0) ret += `${CSI}${x$2}C`;
2722
- if (y$2 < 0) ret += `${CSI}${-y$2}A`;
2723
- else if (y$2 > 0) ret += `${CSI}${y$2}B`;
2722
+ if (y$1 < 0) ret += `${CSI}${-y$1}A`;
2723
+ else if (y$1 > 0) ret += `${CSI}${y$1}B`;
2724
2724
  return ret;
2725
2725
  },
2726
2726
  up: (count$1 = 1) => `${CSI}${count$1}A`,
@@ -3030,13 +3030,13 @@ function rD() {
3030
3030
  }
3031
3031
  }), r;
3032
3032
  }
3033
- 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) => {
3033
+ 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
3034
  const F$1 = [...u$2];
3035
3035
  let s = !1, i$1 = !1, D$1 = p(P$1(e$1[e$1.length - 1]));
3036
3036
  for (const [C$1, n$1] of F$1.entries()) {
3037
3037
  const E = p(n$1);
3038
3038
  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) {
3039
- i$1 ? n$1 === y$1 && (s = !1, i$1 = !1) : n$1 === G$1 && (s = !1);
3039
+ i$1 ? n$1 === y && (s = !1, i$1 = !1) : n$1 === G$1 && (s = !1);
3040
3040
  continue;
3041
3041
  }
3042
3042
  D$1 += E, D$1 === t && C$1 < F$1.length - 1 && (e$1.push(""), D$1 = 0);
@@ -3078,7 +3078,7 @@ const ED = rD(), d$1 = new Set(["\x1B", "›"]), oD = 39, y$1 = "\x07", V$1 = "["
3078
3078
  `)];
3079
3079
  for (const [E, a$1] of n$1.entries()) {
3080
3080
  if (F$1 += a$1, d$1.has(a$1)) {
3081
- const { groups: c$1 } = (/* @__PURE__ */ new RegExp(`(?:\\${V$1}(?<code>\\d+)m|\\${_$1}(?<uri>.*)${y$1})`)).exec(n$1.slice(E).join("")) || { groups: {} };
3081
+ const { groups: c$1 } = (/* @__PURE__ */ new RegExp(`(?:\\${V$1}(?<code>\\d+)m|\\${_$1}(?<uri>.*)${y})`)).exec(n$1.slice(E).join("")) || { groups: {} };
3082
3082
  if (c$1.code !== void 0) {
3083
3083
  const f = Number.parseFloat(c$1.code);
3084
3084
  s = f === oD ? void 0 : f;
@@ -3479,7 +3479,7 @@ var RD = class extends x$1 {
3479
3479
  //#endregion
3480
3480
  //#region node_modules/@clack/prompts/dist/index.mjs
3481
3481
  function ce() {
3482
- 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";
3482
+ 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
3483
  }
3484
3484
  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) => {
3485
3485
  switch (t) {
@@ -5818,97 +5818,6 @@ function handleTupleResult(result, final, index) {
5818
5818
  if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
5819
5819
  final.value[index] = result.value;
5820
5820
  }
5821
- const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
5822
- $ZodType.init(inst, def);
5823
- inst._zod.parse = (payload, ctx) => {
5824
- const input = payload.value;
5825
- if (!isPlainObject$1(input)) {
5826
- payload.issues.push({
5827
- expected: "record",
5828
- code: "invalid_type",
5829
- input,
5830
- inst
5831
- });
5832
- return payload;
5833
- }
5834
- const proms = [];
5835
- const values = def.keyType._zod.values;
5836
- if (values) {
5837
- payload.value = {};
5838
- const recordKeys = /* @__PURE__ */ new Set();
5839
- for (const key of values) if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
5840
- recordKeys.add(typeof key === "number" ? key.toString() : key);
5841
- const result = def.valueType._zod.run({
5842
- value: input[key],
5843
- issues: []
5844
- }, ctx);
5845
- if (result instanceof Promise) proms.push(result.then((result$1) => {
5846
- if (result$1.issues.length) payload.issues.push(...prefixIssues(key, result$1.issues));
5847
- payload.value[key] = result$1.value;
5848
- }));
5849
- else {
5850
- if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
5851
- payload.value[key] = result.value;
5852
- }
5853
- }
5854
- let unrecognized;
5855
- for (const key in input) if (!recordKeys.has(key)) {
5856
- unrecognized = unrecognized ?? [];
5857
- unrecognized.push(key);
5858
- }
5859
- if (unrecognized && unrecognized.length > 0) payload.issues.push({
5860
- code: "unrecognized_keys",
5861
- input,
5862
- inst,
5863
- keys: unrecognized
5864
- });
5865
- } else {
5866
- payload.value = {};
5867
- for (const key of Reflect.ownKeys(input)) {
5868
- if (key === "__proto__") continue;
5869
- let keyResult = def.keyType._zod.run({
5870
- value: key,
5871
- issues: []
5872
- }, ctx);
5873
- if (keyResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
5874
- if (typeof key === "string" && number$1.test(key) && keyResult.issues.length && keyResult.issues.some((iss) => iss.code === "invalid_type" && iss.expected === "number")) {
5875
- const retryResult = def.keyType._zod.run({
5876
- value: Number(key),
5877
- issues: []
5878
- }, ctx);
5879
- if (retryResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
5880
- if (retryResult.issues.length === 0) keyResult = retryResult;
5881
- }
5882
- if (keyResult.issues.length) {
5883
- if (def.mode === "loose") payload.value[key] = input[key];
5884
- else payload.issues.push({
5885
- code: "invalid_key",
5886
- origin: "record",
5887
- issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
5888
- input: key,
5889
- path: [key],
5890
- inst
5891
- });
5892
- continue;
5893
- }
5894
- const result = def.valueType._zod.run({
5895
- value: input[key],
5896
- issues: []
5897
- }, ctx);
5898
- if (result instanceof Promise) proms.push(result.then((result$1) => {
5899
- if (result$1.issues.length) payload.issues.push(...prefixIssues(key, result$1.issues));
5900
- payload.value[keyResult.value] = result$1.value;
5901
- }));
5902
- else {
5903
- if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
5904
- payload.value[keyResult.value] = result.value;
5905
- }
5906
- }
5907
- }
5908
- if (proms.length) return Promise.all(proms).then(() => payload);
5909
- return payload;
5910
- };
5911
- });
5912
5821
  const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
5913
5822
  $ZodType.init(inst, def);
5914
5823
  const values = getEnumValues(def.entries);
@@ -6744,7 +6653,7 @@ function initializeContext(params) {
6744
6653
  external: params?.external ?? void 0
6745
6654
  };
6746
6655
  }
6747
- function process$2(schema, ctx, _params = {
6656
+ function process$3(schema, ctx, _params = {
6748
6657
  path: [],
6749
6658
  schemaPath: []
6750
6659
  }) {
@@ -6781,7 +6690,7 @@ function process$2(schema, ctx, _params = {
6781
6690
  const parent = schema._zod.parent;
6782
6691
  if (parent) {
6783
6692
  if (!result.ref) result.ref = parent;
6784
- process$2(parent, ctx, params);
6693
+ process$3(parent, ctx, params);
6785
6694
  ctx.seen.get(parent).isParent = true;
6786
6695
  }
6787
6696
  }
@@ -6993,7 +6902,7 @@ const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
6993
6902
  ...params,
6994
6903
  processors
6995
6904
  });
6996
- process$2(schema, ctx);
6905
+ process$3(schema, ctx);
6997
6906
  extractDefs(ctx, schema);
6998
6907
  return finalize(ctx, schema);
6999
6908
  };
@@ -7005,7 +6914,7 @@ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params)
7005
6914
  io,
7006
6915
  processors
7007
6916
  });
7008
- process$2(schema, ctx);
6917
+ process$3(schema, ctx);
7009
6918
  extractDefs(ctx, schema);
7010
6919
  return finalize(ctx, schema);
7011
6920
  };
@@ -7092,7 +7001,7 @@ const arrayProcessor = (schema, ctx, _json, params) => {
7092
7001
  if (typeof minimum === "number") json.minItems = minimum;
7093
7002
  if (typeof maximum === "number") json.maxItems = maximum;
7094
7003
  json.type = "array";
7095
- json.items = process$2(def.element, ctx, {
7004
+ json.items = process$3(def.element, ctx, {
7096
7005
  ...params,
7097
7006
  path: [...params.path, "items"]
7098
7007
  });
@@ -7103,7 +7012,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
7103
7012
  json.type = "object";
7104
7013
  json.properties = {};
7105
7014
  const shape = def.shape;
7106
- for (const key in shape) json.properties[key] = process$2(shape[key], ctx, {
7015
+ for (const key in shape) json.properties[key] = process$3(shape[key], ctx, {
7107
7016
  ...params,
7108
7017
  path: [
7109
7018
  ...params.path,
@@ -7121,7 +7030,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
7121
7030
  if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
7122
7031
  else if (!def.catchall) {
7123
7032
  if (ctx.io === "output") json.additionalProperties = false;
7124
- } else if (def.catchall) json.additionalProperties = process$2(def.catchall, ctx, {
7033
+ } else if (def.catchall) json.additionalProperties = process$3(def.catchall, ctx, {
7125
7034
  ...params,
7126
7035
  path: [...params.path, "additionalProperties"]
7127
7036
  });
@@ -7129,7 +7038,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
7129
7038
  const unionProcessor = (schema, ctx, json, params) => {
7130
7039
  const def = schema._zod.def;
7131
7040
  const isExclusive = def.inclusive === false;
7132
- const options = def.options.map((x$2, i$1) => process$2(x$2, ctx, {
7041
+ const options = def.options.map((x$2, i$1) => process$3(x$2, ctx, {
7133
7042
  ...params,
7134
7043
  path: [
7135
7044
  ...params.path,
@@ -7142,7 +7051,7 @@ const unionProcessor = (schema, ctx, json, params) => {
7142
7051
  };
7143
7052
  const intersectionProcessor = (schema, ctx, json, params) => {
7144
7053
  const def = schema._zod.def;
7145
- const a$1 = process$2(def.left, ctx, {
7054
+ const a$1 = process$3(def.left, ctx, {
7146
7055
  ...params,
7147
7056
  path: [
7148
7057
  ...params.path,
@@ -7150,7 +7059,7 @@ const intersectionProcessor = (schema, ctx, json, params) => {
7150
7059
  0
7151
7060
  ]
7152
7061
  });
7153
- const b$2 = process$2(def.right, ctx, {
7062
+ const b$2 = process$3(def.right, ctx, {
7154
7063
  ...params,
7155
7064
  path: [
7156
7065
  ...params.path,
@@ -7167,7 +7076,7 @@ const tupleProcessor = (schema, ctx, _json, params) => {
7167
7076
  json.type = "array";
7168
7077
  const prefixPath$1 = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
7169
7078
  const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
7170
- const prefixItems = def.items.map((x$2, i$1) => process$2(x$2, ctx, {
7079
+ const prefixItems = def.items.map((x$2, i$1) => process$3(x$2, ctx, {
7171
7080
  ...params,
7172
7081
  path: [
7173
7082
  ...params.path,
@@ -7175,7 +7084,7 @@ const tupleProcessor = (schema, ctx, _json, params) => {
7175
7084
  i$1
7176
7085
  ]
7177
7086
  }));
7178
- const rest = def.rest ? process$2(def.rest, ctx, {
7087
+ const rest = def.rest ? process$3(def.rest, ctx, {
7179
7088
  ...params,
7180
7089
  path: [
7181
7090
  ...params.path,
@@ -7199,42 +7108,9 @@ const tupleProcessor = (schema, ctx, _json, params) => {
7199
7108
  if (typeof minimum === "number") json.minItems = minimum;
7200
7109
  if (typeof maximum === "number") json.maxItems = maximum;
7201
7110
  };
7202
- const recordProcessor = (schema, ctx, _json, params) => {
7203
- const json = _json;
7204
- const def = schema._zod.def;
7205
- json.type = "object";
7206
- const keyType = def.keyType;
7207
- const patterns = keyType._zod.bag?.patterns;
7208
- if (def.mode === "loose" && patterns && patterns.size > 0) {
7209
- const valueSchema = process$2(def.valueType, ctx, {
7210
- ...params,
7211
- path: [
7212
- ...params.path,
7213
- "patternProperties",
7214
- "*"
7215
- ]
7216
- });
7217
- json.patternProperties = {};
7218
- for (const pattern of patterns) json.patternProperties[pattern.source] = valueSchema;
7219
- } else {
7220
- if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") json.propertyNames = process$2(def.keyType, ctx, {
7221
- ...params,
7222
- path: [...params.path, "propertyNames"]
7223
- });
7224
- json.additionalProperties = process$2(def.valueType, ctx, {
7225
- ...params,
7226
- path: [...params.path, "additionalProperties"]
7227
- });
7228
- }
7229
- const keyValues = keyType._zod.values;
7230
- if (keyValues) {
7231
- const validKeyValues = [...keyValues].filter((v$1) => typeof v$1 === "string" || typeof v$1 === "number");
7232
- if (validKeyValues.length > 0) json.required = validKeyValues;
7233
- }
7234
- };
7235
7111
  const nullableProcessor = (schema, ctx, json, params) => {
7236
7112
  const def = schema._zod.def;
7237
- const inner = process$2(def.innerType, ctx, params);
7113
+ const inner = process$3(def.innerType, ctx, params);
7238
7114
  const seen = ctx.seen.get(schema);
7239
7115
  if (ctx.target === "openapi-3.0") {
7240
7116
  seen.ref = def.innerType;
@@ -7243,27 +7119,27 @@ const nullableProcessor = (schema, ctx, json, params) => {
7243
7119
  };
7244
7120
  const nonoptionalProcessor = (schema, ctx, _json, params) => {
7245
7121
  const def = schema._zod.def;
7246
- process$2(def.innerType, ctx, params);
7122
+ process$3(def.innerType, ctx, params);
7247
7123
  const seen = ctx.seen.get(schema);
7248
7124
  seen.ref = def.innerType;
7249
7125
  };
7250
7126
  const defaultProcessor = (schema, ctx, json, params) => {
7251
7127
  const def = schema._zod.def;
7252
- process$2(def.innerType, ctx, params);
7128
+ process$3(def.innerType, ctx, params);
7253
7129
  const seen = ctx.seen.get(schema);
7254
7130
  seen.ref = def.innerType;
7255
7131
  json.default = JSON.parse(JSON.stringify(def.defaultValue));
7256
7132
  };
7257
7133
  const prefaultProcessor = (schema, ctx, json, params) => {
7258
7134
  const def = schema._zod.def;
7259
- process$2(def.innerType, ctx, params);
7135
+ process$3(def.innerType, ctx, params);
7260
7136
  const seen = ctx.seen.get(schema);
7261
7137
  seen.ref = def.innerType;
7262
7138
  if (ctx.io === "input") json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
7263
7139
  };
7264
7140
  const catchProcessor = (schema, ctx, json, params) => {
7265
7141
  const def = schema._zod.def;
7266
- process$2(def.innerType, ctx, params);
7142
+ process$3(def.innerType, ctx, params);
7267
7143
  const seen = ctx.seen.get(schema);
7268
7144
  seen.ref = def.innerType;
7269
7145
  let catchValue;
@@ -7277,20 +7153,20 @@ const catchProcessor = (schema, ctx, json, params) => {
7277
7153
  const pipeProcessor = (schema, ctx, _json, params) => {
7278
7154
  const def = schema._zod.def;
7279
7155
  const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
7280
- process$2(innerType, ctx, params);
7156
+ process$3(innerType, ctx, params);
7281
7157
  const seen = ctx.seen.get(schema);
7282
7158
  seen.ref = innerType;
7283
7159
  };
7284
7160
  const readonlyProcessor = (schema, ctx, json, params) => {
7285
7161
  const def = schema._zod.def;
7286
- process$2(def.innerType, ctx, params);
7162
+ process$3(def.innerType, ctx, params);
7287
7163
  const seen = ctx.seen.get(schema);
7288
7164
  seen.ref = def.innerType;
7289
7165
  json.readOnly = true;
7290
7166
  };
7291
7167
  const optionalProcessor = (schema, ctx, _json, params) => {
7292
7168
  const def = schema._zod.def;
7293
- process$2(def.innerType, ctx, params);
7169
+ process$3(def.innerType, ctx, params);
7294
7170
  const seen = ctx.seen.get(schema);
7295
7171
  seen.ref = def.innerType;
7296
7172
  };
@@ -7761,21 +7637,6 @@ function tuple(items, _paramsOrRest, _params) {
7761
7637
  ...normalizeParams(params)
7762
7638
  });
7763
7639
  }
7764
- const ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
7765
- $ZodRecord.init(inst, def);
7766
- ZodType.init(inst, def);
7767
- inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
7768
- inst.keyType = def.keyType;
7769
- inst.valueType = def.valueType;
7770
- });
7771
- function record(keyType, valueType, params) {
7772
- return new ZodRecord({
7773
- type: "record",
7774
- keyType,
7775
- valueType,
7776
- ...normalizeParams(params)
7777
- });
7778
- }
7779
7640
  const ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
7780
7641
  $ZodEnum.init(inst, def);
7781
7642
  ZodType.init(inst, def);
@@ -8038,19 +7899,6 @@ var AuthValidationError = class extends Error {
8038
7899
  this.name = "AuthValidationError";
8039
7900
  }
8040
7901
  };
8041
- var ConnectorApiError = class extends Error {
8042
- constructor(message, cause) {
8043
- super(message);
8044
- this.cause = cause;
8045
- this.name = "ConnectorApiError";
8046
- }
8047
- };
8048
- var ConnectorValidationError = class extends Error {
8049
- constructor(message) {
8050
- super(message);
8051
- this.name = "ConnectorValidationError";
8052
- }
8053
- };
8054
7902
 
8055
7903
  //#endregion
8056
7904
  //#region src/core/consts.ts
@@ -16344,7 +16192,7 @@ const createIgnorePredicate = (patterns, cwd, baseDir) => {
16344
16192
  };
16345
16193
  const normalizeOptions$2 = (options = {}) => {
16346
16194
  const ignoreOption = options.ignore ? Array.isArray(options.ignore) ? options.ignore : [options.ignore] : [];
16347
- const cwd = toPath$1(options.cwd) ?? y.cwd();
16195
+ const cwd = toPath$1(options.cwd) ?? process$1.cwd();
16348
16196
  const deep = typeof options.deep === "number" ? Math.max(0, options.deep) + 1 : Number.POSITIVE_INFINITY;
16349
16197
  return {
16350
16198
  cwd,
@@ -16441,7 +16289,7 @@ const getDirectoryGlob = ({ directoryPath, files, extensions }) => {
16441
16289
  const extensionGlob = extensions?.length > 0 ? `.${extensions.length > 1 ? `{${extensions.join(",")}}` : extensions[0]}` : "";
16442
16290
  return files ? files.map((file) => path.posix.join(directoryPath, `**/${path.extname(file) ? file : `${file}${extensionGlob}`}`)) : [path.posix.join(directoryPath, `**${extensionGlob ? `/*${extensionGlob}` : ""}`)];
16443
16291
  };
16444
- const directoryToGlob = async (directoryPaths, { cwd = y.cwd(), files, extensions, fs: fsImplementation } = {}) => {
16292
+ const directoryToGlob = async (directoryPaths, { cwd = process$1.cwd(), files, extensions, fs: fsImplementation } = {}) => {
16445
16293
  return (await Promise.all(directoryPaths.map(async (directoryPath) => {
16446
16294
  if (shouldExpandGlobstarDirectory(isNegativePattern(directoryPath) ? directoryPath.slice(1) : directoryPath)) return getDirectoryGlob({
16447
16295
  directoryPath,
@@ -16455,7 +16303,7 @@ const directoryToGlob = async (directoryPaths, { cwd = y.cwd(), files, extension
16455
16303
  }) : directoryPath;
16456
16304
  }))).flat();
16457
16305
  };
16458
- const directoryToGlobSync = (directoryPaths, { cwd = y.cwd(), files, extensions, fs: fsImplementation } = {}) => directoryPaths.flatMap((directoryPath) => {
16306
+ const directoryToGlobSync = (directoryPaths, { cwd = process$1.cwd(), files, extensions, fs: fsImplementation } = {}) => directoryPaths.flatMap((directoryPath) => {
16459
16307
  if (shouldExpandGlobstarDirectory(isNegativePattern(directoryPath) ? directoryPath.slice(1) : directoryPath)) return getDirectoryGlob({
16460
16308
  directoryPath,
16461
16309
  files,
@@ -16551,7 +16399,7 @@ const applyIgnoreFilesAndGetFilterSync = (options) => {
16551
16399
  };
16552
16400
  const createFilterFunction = (isIgnored, cwd) => {
16553
16401
  const seen = /* @__PURE__ */ new Set();
16554
- const basePath = cwd || y.cwd();
16402
+ const basePath = cwd || process$1.cwd();
16555
16403
  const pathCache = /* @__PURE__ */ new Map();
16556
16404
  return (fastGlobResult) => {
16557
16405
  const pathKey$1 = path.normalize(fastGlobResult.path ?? fastGlobResult);
@@ -16848,13 +16696,10 @@ const SiteConfigSchema = object({
16848
16696
  outputDirectory: string().optional(),
16849
16697
  installCommand: string().optional()
16850
16698
  });
16851
- const ConnectorConfigSchema = object({ scopes: array(string()).optional() });
16852
- const ConnectorsConfigSchema = record(string(), ConnectorConfigSchema);
16853
16699
  const ProjectConfigSchema = object({
16854
16700
  name: string().min(1, "App name cannot be empty"),
16855
16701
  description: string().optional(),
16856
16702
  site: SiteConfigSchema.optional(),
16857
- connectors: ConnectorsConfigSchema.optional(),
16858
16703
  entitiesDir: string().optional().default("entities"),
16859
16704
  functionsDir: string().optional().default("functions")
16860
16705
  });
@@ -30923,13 +30768,13 @@ var ansi_styles_default = ansiStyles;
30923
30768
 
30924
30769
  //#endregion
30925
30770
  //#region node_modules/chalk/source/vendor/supports-color/index.js
30926
- function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : y.argv) {
30771
+ function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process$1.argv) {
30927
30772
  const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
30928
30773
  const position = argv.indexOf(prefix + flag);
30929
30774
  const terminatorPosition = argv.indexOf("--");
30930
30775
  return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
30931
30776
  }
30932
- const { env } = y;
30777
+ const { env } = process$1;
30933
30778
  let flagForceColor;
30934
30779
  if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) flagForceColor = 0;
30935
30780
  else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) flagForceColor = 1;
@@ -30962,7 +30807,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
30962
30807
  if (haveStream && !streamIsTTY && forceColor === void 0) return 0;
30963
30808
  const min = forceColor || 0;
30964
30809
  if (env.TERM === "dumb") return min;
30965
- if (y.platform === "win32") {
30810
+ if (process$1.platform === "win32") {
30966
30811
  const osRelease = os.release().split(".");
30967
30812
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
30968
30813
  return 1;
@@ -31175,10 +31020,7 @@ const theme = {
31175
31020
  base44OrangeBackground: source_default.bgHex("#E86B3C"),
31176
31021
  shinyOrange: source_default.hex("#FFD700"),
31177
31022
  links: source_default.hex("#00D4FF"),
31178
- white: source_default.white,
31179
- success: source_default.green,
31180
- warning: source_default.yellow,
31181
- error: source_default.red
31023
+ white: source_default.white
31182
31024
  },
31183
31025
  styles: {
31184
31026
  header: source_default.dim,
@@ -31704,9 +31546,9 @@ const getSubprocessResult = ({ stdout: stdout$1 }) => {
31704
31546
  //#region node_modules/execa/lib/utils/standard-stream.js
31705
31547
  const isStandardStream = (stream) => STANDARD_STREAMS.includes(stream);
31706
31548
  const STANDARD_STREAMS = [
31707
- y.stdin,
31708
- y.stdout,
31709
- y.stderr
31549
+ process$1.stdin,
31550
+ process$1.stdout,
31551
+ process$1.stderr
31710
31552
  ];
31711
31553
  const STANDARD_STREAMS_ALIASES = [
31712
31554
  "stdin",
@@ -31831,9 +31673,9 @@ const NO_ESCAPE_REGEXP = /^[\w./-]+$/;
31831
31673
  //#endregion
31832
31674
  //#region node_modules/is-unicode-supported/index.js
31833
31675
  function isUnicodeSupported() {
31834
- const { env: env$1 } = y;
31676
+ const { env: env$1 } = process$1;
31835
31677
  const { TERM, TERM_PROGRAM } = env$1;
31836
- if (y.platform !== "win32") return TERM !== "linux";
31678
+ if (process$1.platform !== "win32") return TERM !== "linux";
31837
31679
  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";
31838
31680
  }
31839
31681
 
@@ -32760,7 +32602,7 @@ const TEN_MEGABYTES_IN_BYTES = 10 * 1024 * 1024;
32760
32602
 
32761
32603
  //#endregion
32762
32604
  //#region node_modules/npm-run-path/index.js
32763
- const npmRunPath = ({ cwd = y.cwd(), path: pathOption = y.env[pathKey()], preferLocal = true, execPath: execPath$1 = y.execPath, addExecPath = true } = {}) => {
32605
+ const npmRunPath = ({ cwd = process$1.cwd(), path: pathOption = process$1.env[pathKey()], preferLocal = true, execPath: execPath$1 = process$1.execPath, addExecPath = true } = {}) => {
32764
32606
  const cwdPath = path.resolve(toPath(cwd));
32765
32607
  const result = [];
32766
32608
  const pathParts = pathOption.split(path.delimiter);
@@ -32778,7 +32620,7 @@ const applyExecPath = (result, pathParts, execPath$1, cwdPath) => {
32778
32620
  const pathPart = path.resolve(cwdPath, toPath(execPath$1), "..");
32779
32621
  if (!pathParts.includes(pathPart)) result.push(pathPart);
32780
32622
  };
32781
- const npmRunPathEnv = ({ env: env$1 = y.env, ...options } = {}) => {
32623
+ const npmRunPathEnv = ({ env: env$1 = process$1.env, ...options } = {}) => {
32782
32624
  env$1 = { ...env$1 };
32783
32625
  const pathName = pathKey({ env: env$1 });
32784
32626
  options.path = env$1[pathName];
@@ -33913,7 +33755,7 @@ const normalizeCwd = (cwd = getDefaultCwd()) => {
33913
33755
  };
33914
33756
  const getDefaultCwd = () => {
33915
33757
  try {
33916
- return y.cwd();
33758
+ return process$1.cwd();
33917
33759
  } catch (error) {
33918
33760
  error.message = `The current directory does not exist.\n${error.message}`;
33919
33761
  throw error;
@@ -33948,7 +33790,7 @@ const normalizeOptions = (filePath, rawArguments, rawOptions) => {
33948
33790
  options.killSignal = normalizeKillSignal(options.killSignal);
33949
33791
  options.forceKillAfterDelay = normalizeForceKillAfterDelay(options.forceKillAfterDelay);
33950
33792
  options.lines = options.lines.map((lines, fdNumber) => lines && !BINARY_ENCODINGS.has(options.encoding) && options.buffer[fdNumber]);
33951
- if (y.platform === "win32" && path.basename(file, ".exe") === "cmd") commandArguments.unshift("/q");
33793
+ if (process$1.platform === "win32" && path.basename(file, ".exe") === "cmd") commandArguments.unshift("/q");
33952
33794
  return {
33953
33795
  file,
33954
33796
  commandArguments,
@@ -33975,7 +33817,7 @@ const addDefaultOptions = ({ extendEnv = true, preferLocal = false, cwd, localDi
33975
33817
  });
33976
33818
  const getEnv = ({ env: envOption, extendEnv, preferLocal, node, localDirectory, nodePath }) => {
33977
33819
  const env$1 = extendEnv ? {
33978
- ...y.env,
33820
+ ...process$1.env,
33979
33821
  ...envOption
33980
33822
  } : envOption;
33981
33823
  if (preferLocal || node) return npmRunPathEnv({
@@ -34975,12 +34817,12 @@ const guessStreamDirection = {
34975
34817
  }
34976
34818
  };
34977
34819
  const getStandardStreamDirection = (value) => {
34978
- if ([0, y.stdin].includes(value)) return "input";
34820
+ if ([0, process$1.stdin].includes(value)) return "input";
34979
34821
  if ([
34980
34822
  1,
34981
34823
  2,
34982
- y.stdout,
34983
- y.stderr
34824
+ process$1.stdout,
34825
+ process$1.stderr
34984
34826
  ].includes(value)) return "output";
34985
34827
  };
34986
34828
  const DEFAULT_DIRECTION = "output";
@@ -36044,9 +35886,9 @@ const addIpcMethods = (subprocess, { ipc }) => {
36044
35886
  Object.assign(subprocess, getIpcMethods(subprocess, false, ipc));
36045
35887
  };
36046
35888
  const getIpcExport = () => {
36047
- const anyProcess = y;
35889
+ const anyProcess = process$1;
36048
35890
  const isSubprocess = true;
36049
- const ipc = y.channel !== void 0;
35891
+ const ipc = process$1.channel !== void 0;
36050
35892
  return {
36051
35893
  ...getIpcMethods(anyProcess, isSubprocess, ipc),
36052
35894
  getCancelSignal: getCancelSignal$1.bind(void 0, {
@@ -36288,7 +36130,7 @@ if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SI
36288
36130
 
36289
36131
  //#endregion
36290
36132
  //#region node_modules/signal-exit/dist/mjs/index.js
36291
- 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";
36133
+ 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";
36292
36134
  const kExitEmitter = Symbol.for("signal-exit emitter");
36293
36135
  const global$1 = globalThis;
36294
36136
  const ObjectDefineProperty = Object.defineProperty.bind(Object);
@@ -36356,7 +36198,7 @@ var SignalExitFallback = class extends SignalExitBase {
36356
36198
  };
36357
36199
  var SignalExit = class extends SignalExitBase {
36358
36200
  /* c8 ignore start */
36359
- #hupSig = process$1.platform === "win32" ? "SIGINT" : "SIGHUP";
36201
+ #hupSig = process$2.platform === "win32" ? "SIGINT" : "SIGHUP";
36360
36202
  /* c8 ignore stop */
36361
36203
  #emitter = new Emitter();
36362
36204
  #process;
@@ -36364,15 +36206,15 @@ var SignalExit = class extends SignalExitBase {
36364
36206
  #originalProcessReallyExit;
36365
36207
  #sigListeners = {};
36366
36208
  #loaded = false;
36367
- constructor(process$4) {
36209
+ constructor(process$5) {
36368
36210
  super();
36369
- this.#process = process$4;
36211
+ this.#process = process$5;
36370
36212
  this.#sigListeners = {};
36371
36213
  for (const sig of signals) this.#sigListeners[sig] = () => {
36372
36214
  const listeners = this.#process.listeners(sig);
36373
36215
  let { count: count$1 } = this.#emitter;
36374
36216
  /* c8 ignore start */
36375
- const p$1 = process$4;
36217
+ const p$1 = process$5;
36376
36218
  if (typeof p$1.__signal_exit_emitter__ === "object" && typeof p$1.__signal_exit_emitter__.count === "number") count$1 += p$1.__signal_exit_emitter__.count;
36377
36219
  /* c8 ignore stop */
36378
36220
  if (listeners.length === count$1) {
@@ -36380,11 +36222,11 @@ var SignalExit = class extends SignalExitBase {
36380
36222
  const ret = this.#emitter.emit("exit", null, sig);
36381
36223
  /* c8 ignore start */
36382
36224
  const s = sig === "SIGHUP" ? this.#hupSig : sig;
36383
- if (!ret) process$4.kill(process$4.pid, s);
36225
+ if (!ret) process$5.kill(process$5.pid, s);
36384
36226
  }
36385
36227
  };
36386
- this.#originalProcessReallyExit = process$4.reallyExit;
36387
- this.#originalProcessEmit = process$4.emit;
36228
+ this.#originalProcessReallyExit = process$5.reallyExit;
36229
+ this.#originalProcessEmit = process$5.emit;
36388
36230
  }
36389
36231
  onExit(cb, opts) {
36390
36232
  /* c8 ignore start */
@@ -36451,8 +36293,8 @@ var SignalExit = class extends SignalExitBase {
36451
36293
  } else return og.call(this.#process, ev, ...args);
36452
36294
  }
36453
36295
  };
36454
- const process$1 = globalThis.process;
36455
- const { onExit, load, unload } = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
36296
+ const process$2 = globalThis.process;
36297
+ const { onExit, load, unload } = signalExitWrap(processOk(process$2) ? new SignalExit(process$2) : new SignalExitFallback());
36456
36298
 
36457
36299
  //#endregion
36458
36300
  //#region node_modules/execa/lib/terminate/cleanup.js
@@ -38203,13 +38045,6 @@ var require_lodash = /* @__PURE__ */ __commonJSMin(((exports, module) => {
38203
38045
  //#region src/cli/commands/project/create.ts
38204
38046
  var import_lodash = /* @__PURE__ */ __toESM(require_lodash(), 1);
38205
38047
  const DEFAULT_TEMPLATE_ID = "backend-only";
38206
- const SUPPORTED_AGENTS = [{
38207
- value: "cursor",
38208
- label: "Cursor"
38209
- }, {
38210
- value: "claude-code",
38211
- label: "Claude Code"
38212
- }];
38213
38048
  async function getTemplateById(templateId) {
38214
38049
  const templates = await listTemplates();
38215
38050
  const template = templates.find((t) => t.id === templateId);
@@ -38272,7 +38107,6 @@ async function createInteractive(options) {
38272
38107
  description: result.description || void 0,
38273
38108
  projectPath: result.projectPath,
38274
38109
  deploy: options.deploy,
38275
- skills: options.skills,
38276
38110
  isInteractive: true
38277
38111
  });
38278
38112
  }
@@ -38283,11 +38117,10 @@ async function createNonInteractive(options) {
38283
38117
  description: options.description,
38284
38118
  projectPath: options.path,
38285
38119
  deploy: options.deploy,
38286
- skills: options.skills,
38287
38120
  isInteractive: false
38288
38121
  });
38289
38122
  }
38290
- async function executeCreate({ template, name: rawName, description, projectPath, deploy, skills, isInteractive }) {
38123
+ async function executeCreate({ template, name: rawName, description, projectPath, deploy, isInteractive }) {
38291
38124
  const name$1 = rawName.trim();
38292
38125
  const resolvedPath = resolve(projectPath);
38293
38126
  const { projectId } = await runTask("Setting up your project...", async () => {
@@ -38347,45 +38180,12 @@ async function executeCreate({ template, name: rawName, description, projectPath
38347
38180
  finalAppUrl = appUrl;
38348
38181
  }
38349
38182
  }
38350
- let selectedAgents = [];
38351
- if (isInteractive) {
38352
- const result = await fe({
38353
- message: "Add AI agent skills? (Select agents to configure)",
38354
- options: SUPPORTED_AGENTS,
38355
- initialValues: SUPPORTED_AGENTS.map((agent) => agent.value),
38356
- required: false
38357
- });
38358
- if (!pD(result)) selectedAgents = result;
38359
- } else if (skills) selectedAgents = SUPPORTED_AGENTS.map((agent) => agent.value);
38360
- if (selectedAgents.length > 0) {
38361
- const agentArgs = selectedAgents.flatMap((agent) => ["-a", agent]);
38362
- M.step(`Installing skills for: ${selectedAgents.join(", ")}`);
38363
- await runTask(`Installing skills for: ${selectedAgents.join(", ")}`, async () => {
38364
- await execa("npx", [
38365
- "-y",
38366
- "add-skill",
38367
- "base44/skills",
38368
- "-y",
38369
- "-s",
38370
- "base44-cli",
38371
- "-s",
38372
- "base44-sdk",
38373
- ...agentArgs
38374
- ], {
38375
- cwd: resolvedPath,
38376
- stdio: "inherit"
38377
- });
38378
- }, {
38379
- successMessage: theme.colors.base44Orange("AI agent skills added successfully"),
38380
- errorMessage: "Failed to add AI agent skills - you can add them later with: npx add-skill base44/skills"
38381
- });
38382
- }
38383
38183
  M.message(`${theme.styles.header("Project")}: ${theme.colors.base44Orange(name$1)}`);
38384
38184
  M.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(projectId))}`);
38385
38185
  if (finalAppUrl) M.message(`${theme.styles.header("Site")}: ${theme.colors.links(finalAppUrl)}`);
38386
38186
  return { outroMessage: "Your project is set up and ready to use" };
38387
38187
  }
38388
- const createCommand = new Command("create").description("Create a new Base44 project").option("-n, --name <name>", "Project name").option("-d, --description <description>", "Project description").option("-p, --path <path>", "Path where to create the project").option("-t, --template <id>", "Template ID (e.g., backend-only, backend-and-client)").option("--deploy", "Build and deploy the site").option("--skills", "Add AI agent skills (Cursor, Claude Code)").hook("preAction", validateNonInteractiveFlags$1).action(async (options) => {
38188
+ const createCommand = new Command("create").description("Create a new Base44 project").option("-n, --name <name>", "Project name").option("-d, --description <description>", "Project description").option("-p, --path <path>", "Path where to create the project").option("-t, --template <id>", "Template ID (e.g., backend-only, backend-and-client)").option("--deploy", "Build and deploy the site").hook("preAction", validateNonInteractiveFlags$1).action(async (options) => {
38389
38189
  await chooseCreate(options);
38390
38190
  });
38391
38191
 
@@ -38431,7 +38231,7 @@ function isInsideContainer() {
38431
38231
  //#endregion
38432
38232
  //#region node_modules/is-wsl/index.js
38433
38233
  const isWsl = () => {
38434
- if (y.platform !== "linux") return false;
38234
+ if (process$1.platform !== "linux") return false;
38435
38235
  if (os.release().toLowerCase().includes("microsoft")) {
38436
38236
  if (isInsideContainer()) return false;
38437
38237
  return true;
@@ -38442,12 +38242,12 @@ const isWsl = () => {
38442
38242
  return false;
38443
38243
  }
38444
38244
  };
38445
- var is_wsl_default = y.env.__IS_WSL_TEST__ ? isWsl : isWsl();
38245
+ var is_wsl_default = process$1.env.__IS_WSL_TEST__ ? isWsl : isWsl();
38446
38246
 
38447
38247
  //#endregion
38448
38248
  //#region node_modules/powershell-utils/index.js
38449
38249
  const execFile$2 = promisify(childProcess.execFile);
38450
- const powerShellPath$1 = () => `${y.env.SYSTEMROOT || y.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
38250
+ const powerShellPath$1 = () => `${process$1.env.SYSTEMROOT || process$1.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
38451
38251
  const executePowerShell = async (command, options = {}) => {
38452
38252
  const { powerShellPath: psPath, ...execFileOptions } = options;
38453
38253
  const encodedCommand = executePowerShell.encodeCommand(command);
@@ -38558,7 +38358,7 @@ function defineLazyProperty(object$1, propertyName, valueGetter) {
38558
38358
  //#region node_modules/default-browser-id/index.js
38559
38359
  const execFileAsync$3 = promisify(execFile);
38560
38360
  async function defaultBrowserId() {
38561
- if (y.platform !== "darwin") throw new Error("macOS only");
38361
+ if (process$1.platform !== "darwin") throw new Error("macOS only");
38562
38362
  const { stdout: stdout$1 } = await execFileAsync$3("defaults", [
38563
38363
  "read",
38564
38364
  "com.apple.LaunchServices/com.apple.launchservices.secure",
@@ -38573,7 +38373,7 @@ async function defaultBrowserId() {
38573
38373
  //#region node_modules/run-applescript/index.js
38574
38374
  const execFileAsync$2 = promisify(execFile);
38575
38375
  async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
38576
- if (y.platform !== "darwin") throw new Error("macOS only");
38376
+ if (process$1.platform !== "darwin") throw new Error("macOS only");
38577
38377
  const outputArguments = humanReadableOutput ? [] : ["-ss"];
38578
38378
  const execOptions = {};
38579
38379
  if (signal) execOptions.signal = signal;
@@ -38682,14 +38482,14 @@ async function defaultBrowser$1(_execFileAsync = execFileAsync$1) {
38682
38482
  const execFileAsync = promisify(execFile);
38683
38483
  const titleize = (string$2) => string$2.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x$2) => x$2.toUpperCase());
38684
38484
  async function defaultBrowser() {
38685
- if (y.platform === "darwin") {
38485
+ if (process$1.platform === "darwin") {
38686
38486
  const id = await defaultBrowserId();
38687
38487
  return {
38688
38488
  name: await bundleName(id),
38689
38489
  id
38690
38490
  };
38691
38491
  }
38692
- if (y.platform === "linux") {
38492
+ if (process$1.platform === "linux") {
38693
38493
  const { stdout: stdout$1 } = await execFileAsync("xdg-mime", [
38694
38494
  "query",
38695
38495
  "default",
@@ -38701,13 +38501,13 @@ async function defaultBrowser() {
38701
38501
  id
38702
38502
  };
38703
38503
  }
38704
- if (y.platform === "win32") return defaultBrowser$1();
38504
+ if (process$1.platform === "win32") return defaultBrowser$1();
38705
38505
  throw new Error("Only macOS, Linux, and Windows are supported");
38706
38506
  }
38707
38507
 
38708
38508
  //#endregion
38709
38509
  //#region node_modules/is-in-ssh/index.js
38710
- const isInSsh = Boolean(y.env.SSH_CONNECTION || y.env.SSH_CLIENT || y.env.SSH_TTY);
38510
+ const isInSsh = Boolean(process$1.env.SSH_CONNECTION || process$1.env.SSH_CLIENT || process$1.env.SSH_TTY);
38711
38511
  var is_in_ssh_default = isInSsh;
38712
38512
 
38713
38513
  //#endregion
@@ -38715,7 +38515,7 @@ var is_in_ssh_default = isInSsh;
38715
38515
  const fallbackAttemptSymbol = Symbol("fallbackAttempt");
38716
38516
  const __dirname = import.meta.url ? path.dirname(fileURLToPath(import.meta.url)) : "";
38717
38517
  const localXdgOpenPath = path.join(__dirname, "xdg-open");
38718
- const { platform: platform$1, arch } = y;
38518
+ const { platform: platform$1, arch } = process$1;
38719
38519
  const tryEachApp = async (apps$1, opener) => {
38720
38520
  if (apps$1.length === 0) return;
38721
38521
  const errors = [];
@@ -38828,7 +38628,7 @@ const baseOpen = async (options) => {
38828
38628
  await fs$1.access(localXdgOpenPath, constants$1.X_OK);
38829
38629
  exeLocalXdgOpen = true;
38830
38630
  } catch {}
38831
- command = y.versions.electron ?? (platform$1 === "android" || isBundled || !exeLocalXdgOpen) ? "xdg-open" : localXdgOpenPath;
38631
+ command = process$1.versions.electron ?? (platform$1 === "android" || isBundled || !exeLocalXdgOpen) ? "xdg-open" : localXdgOpenPath;
38832
38632
  }
38833
38633
  if (appArguments.length > 0) cliArguments.push(...appArguments);
38834
38634
  if (!options.wait) {
@@ -39109,657 +38909,6 @@ const siteDeployCommand = new Command("site").description("Manage site deploymen
39109
38909
  await runCommand(() => deployAction(options), { requireAuth: true });
39110
38910
  }));
39111
38911
 
39112
- //#endregion
39113
- //#region src/core/connectors/schema.ts
39114
- /**
39115
- * Response from POST /api/apps/{app_id}/external-auth/initiate
39116
- */
39117
- const InitiateResponseSchema = object({
39118
- redirect_url: string().nullish(),
39119
- connection_id: string().nullish(),
39120
- already_authorized: boolean().nullish(),
39121
- other_user_email: string().nullish(),
39122
- error: string().nullish()
39123
- });
39124
- /**
39125
- * Response from GET /api/apps/{app_id}/external-auth/status
39126
- */
39127
- const StatusResponseSchema = object({
39128
- status: _enum([
39129
- "ACTIVE",
39130
- "PENDING",
39131
- "FAILED"
39132
- ]),
39133
- account_email: string().nullish(),
39134
- error: string().nullish()
39135
- }).transform((data) => ({
39136
- status: data.status,
39137
- accountEmail: data.account_email,
39138
- error: data.error
39139
- }));
39140
- /**
39141
- * A connected integration from the list endpoint
39142
- */
39143
- const ConnectorSchema = object({
39144
- integration_type: string(),
39145
- status: string(),
39146
- connected_at: string().nullish(),
39147
- account_info: object({
39148
- email: string().nullish(),
39149
- name: string().nullish()
39150
- }).nullish()
39151
- }).transform((data) => ({
39152
- integrationType: data.integration_type,
39153
- status: data.status,
39154
- connectedAt: data.connected_at,
39155
- accountInfo: data.account_info
39156
- }));
39157
- /**
39158
- * Response from GET /api/apps/{app_id}/external-auth/list
39159
- */
39160
- const ListResponseSchema = object({ integrations: array(ConnectorSchema) });
39161
- /**
39162
- * Generic API error response
39163
- */
39164
- const ApiErrorSchema = object({
39165
- error: string(),
39166
- detail: string().nullish()
39167
- });
39168
-
39169
- //#endregion
39170
- //#region src/core/connectors/api.ts
39171
- /**
39172
- * Initiates OAuth flow for a connector integration.
39173
- * Returns a redirect URL to open in the browser.
39174
- */
39175
- async function initiateOAuth(integrationType, scopes = null) {
39176
- const response = await getAppClient().post("external-auth/initiate", {
39177
- json: {
39178
- integration_type: integrationType,
39179
- scopes
39180
- },
39181
- throwHttpErrors: false
39182
- });
39183
- const json = await response.json();
39184
- if (!response.ok) {
39185
- const errorResult = ApiErrorSchema.safeParse(json);
39186
- if (errorResult.success) throw new ConnectorApiError(errorResult.data.error);
39187
- throw new ConnectorApiError(`Failed to initiate OAuth: ${response.status} ${response.statusText}`);
39188
- }
39189
- const result = InitiateResponseSchema.safeParse(json);
39190
- if (!result.success) throw new ConnectorValidationError(`Invalid initiate response from server: ${result.error.message}`);
39191
- return result.data;
39192
- }
39193
- /**
39194
- * Checks the status of an OAuth connection attempt.
39195
- */
39196
- async function checkOAuthStatus(integrationType, connectionId) {
39197
- const response = await getAppClient().get("external-auth/status", {
39198
- searchParams: {
39199
- integration_type: integrationType,
39200
- connection_id: connectionId
39201
- },
39202
- throwHttpErrors: false
39203
- });
39204
- const json = await response.json();
39205
- if (!response.ok) {
39206
- const errorResult = ApiErrorSchema.safeParse(json);
39207
- if (errorResult.success) throw new ConnectorApiError(errorResult.data.error);
39208
- throw new ConnectorApiError(`Failed to check OAuth status: ${response.status} ${response.statusText}`);
39209
- }
39210
- const result = StatusResponseSchema.safeParse(json);
39211
- if (!result.success) throw new ConnectorValidationError(`Invalid status response from server: ${result.error.message}`);
39212
- return result.data;
39213
- }
39214
- /**
39215
- * Lists all connected integrations for the current app.
39216
- */
39217
- async function listConnectors() {
39218
- const response = await getAppClient().get("external-auth/list", { throwHttpErrors: false });
39219
- const json = await response.json();
39220
- if (!response.ok) {
39221
- const errorResult = ApiErrorSchema.safeParse(json);
39222
- if (errorResult.success) throw new ConnectorApiError(errorResult.data.error);
39223
- throw new ConnectorApiError(`Failed to list connectors: ${response.status} ${response.statusText}`);
39224
- }
39225
- const result = ListResponseSchema.safeParse(json);
39226
- if (!result.success) throw new ConnectorValidationError(`Invalid list response from server: ${result.error.message}`);
39227
- return result.data.integrations;
39228
- }
39229
- /**
39230
- * Disconnects (soft delete) a connector integration.
39231
- */
39232
- async function disconnectConnector(integrationType) {
39233
- const response = await getAppClient().delete(`external-auth/integrations/${integrationType}`, { throwHttpErrors: false });
39234
- if (!response.ok) {
39235
- const json = await response.json();
39236
- const errorResult = ApiErrorSchema.safeParse(json);
39237
- if (errorResult.success) throw new ConnectorApiError(errorResult.data.error);
39238
- throw new ConnectorApiError(`Failed to disconnect connector: ${response.status} ${response.statusText}`);
39239
- }
39240
- }
39241
- /**
39242
- * Removes (hard delete) a connector integration.
39243
- * This permanently removes the connector and cannot be undone.
39244
- */
39245
- async function removeConnector(integrationType) {
39246
- const response = await getAppClient().delete(`external-auth/integrations/${integrationType}/remove`, { throwHttpErrors: false });
39247
- if (!response.ok) {
39248
- const json = await response.json();
39249
- const errorResult = ApiErrorSchema.safeParse(json);
39250
- if (errorResult.success) throw new ConnectorApiError(errorResult.data.error);
39251
- throw new ConnectorApiError(`Failed to remove connector: ${response.status} ${response.statusText}`);
39252
- }
39253
- }
39254
-
39255
- //#endregion
39256
- //#region src/core/connectors/constants.ts
39257
- /**
39258
- * OAuth polling configuration
39259
- */
39260
- const OAUTH_POLL_INTERVAL_MS = 2e3;
39261
- const OAUTH_POLL_TIMEOUT_MS = 300 * 1e3;
39262
- /**
39263
- * Supported OAuth connector integrations.
39264
- * Based on apper/backend/app/external_auth/models/constants.py
39265
- */
39266
- const SUPPORTED_INTEGRATIONS = [
39267
- "googlecalendar",
39268
- "googledrive",
39269
- "gmail",
39270
- "googlesheets",
39271
- "googledocs",
39272
- "googleslides",
39273
- "slack",
39274
- "notion",
39275
- "salesforce",
39276
- "hubspot",
39277
- "linkedin",
39278
- "tiktok"
39279
- ];
39280
- /**
39281
- * Display names for integrations (for CLI output)
39282
- */
39283
- const INTEGRATION_DISPLAY_NAMES = {
39284
- googlecalendar: "Google Calendar",
39285
- googledrive: "Google Drive",
39286
- gmail: "Gmail",
39287
- googlesheets: "Google Sheets",
39288
- googledocs: "Google Docs",
39289
- googleslides: "Google Slides",
39290
- slack: "Slack",
39291
- notion: "Notion",
39292
- salesforce: "Salesforce",
39293
- hubspot: "HubSpot",
39294
- linkedin: "LinkedIn",
39295
- tiktok: "TikTok"
39296
- };
39297
- function isValidIntegration(type) {
39298
- return SUPPORTED_INTEGRATIONS.includes(type);
39299
- }
39300
- function getIntegrationDisplayName(type) {
39301
- if (isValidIntegration(type)) return INTEGRATION_DISPLAY_NAMES[type];
39302
- return type;
39303
- }
39304
-
39305
- //#endregion
39306
- //#region src/core/connectors/oauth.ts
39307
- /**
39308
- * Polls for OAuth completion status.
39309
- * Returns when status becomes ACTIVE or FAILED, or times out.
39310
- */
39311
- async function waitForOAuthCompletion(integrationType, connectionId, options) {
39312
- let accountEmail;
39313
- let error;
39314
- try {
39315
- await pWaitFor(async () => {
39316
- const status = await checkOAuthStatus(integrationType, connectionId);
39317
- if (status.status === "ACTIVE") {
39318
- accountEmail = status.accountEmail ?? void 0;
39319
- return true;
39320
- }
39321
- if (status.status === "FAILED") {
39322
- error = status.error || "Authorization failed";
39323
- throw new Error(error);
39324
- }
39325
- options?.onPending?.();
39326
- return false;
39327
- }, {
39328
- interval: OAUTH_POLL_INTERVAL_MS,
39329
- timeout: OAUTH_POLL_TIMEOUT_MS
39330
- });
39331
- return {
39332
- success: true,
39333
- accountEmail
39334
- };
39335
- } catch (err) {
39336
- if (err instanceof Error && err.message.includes("timed out")) return {
39337
- success: false,
39338
- error: "Authorization timed out. Please try again."
39339
- };
39340
- return {
39341
- success: false,
39342
- error: error || (err instanceof Error ? err.message : "Unknown error")
39343
- };
39344
- }
39345
- }
39346
-
39347
- //#endregion
39348
- //#region src/core/connectors/config.ts
39349
- /**
39350
- * Read all connectors from the project config file
39351
- */
39352
- async function readLocalConnectors(projectRoot) {
39353
- const found = await findProjectRoot(projectRoot);
39354
- if (!found) return [];
39355
- const connectorsData = (await readJsonFile(found.configPath)).connectors;
39356
- if (!connectorsData) return [];
39357
- const connectors = [];
39358
- for (const [type, config$1] of Object.entries(connectorsData)) {
39359
- if (!isValidIntegration(type)) throw new Error(`Unknown connector type: ${type}`);
39360
- connectors.push({
39361
- type,
39362
- scopes: config$1.scopes
39363
- });
39364
- }
39365
- return connectors;
39366
- }
39367
- /**
39368
- * Write connectors to the project config file
39369
- */
39370
- async function writeLocalConnectors(connectors, projectRoot) {
39371
- const found = await findProjectRoot(projectRoot);
39372
- if (!found) throw new Error("Project config not found. Run this command from a Base44 project directory.");
39373
- const existingConfig = await readJsonFile(found.configPath);
39374
- const connectorsData = {};
39375
- for (const connector of connectors) connectorsData[connector.type] = { ...connector.scopes && { scopes: connector.scopes } };
39376
- const updatedConfig = {
39377
- ...existingConfig,
39378
- connectors: Object.keys(connectorsData).length > 0 ? connectorsData : void 0
39379
- };
39380
- if (!updatedConfig.connectors) delete updatedConfig.connectors;
39381
- await writeJsonFile(found.configPath, updatedConfig);
39382
- return found.configPath;
39383
- }
39384
- /**
39385
- * Add a connector to the project config file
39386
- */
39387
- async function addLocalConnector(type, scopes, projectRoot) {
39388
- const connectors = await readLocalConnectors(projectRoot);
39389
- const existing = connectors.find((c$1) => c$1.type === type);
39390
- if (existing) {
39391
- if (scopes) existing.scopes = scopes;
39392
- } else connectors.push({
39393
- type,
39394
- scopes
39395
- });
39396
- return await writeLocalConnectors(connectors, projectRoot);
39397
- }
39398
- /**
39399
- * Remove a connector from the project config file
39400
- */
39401
- async function removeLocalConnector(type, projectRoot) {
39402
- const connectors = await readLocalConnectors(projectRoot);
39403
- const filtered = connectors.filter((c$1) => c$1.type !== type);
39404
- if (filtered.length === connectors.length) return null;
39405
- return await writeLocalConnectors(filtered, projectRoot);
39406
- }
39407
-
39408
- //#endregion
39409
- //#region src/core/connectors/state.ts
39410
- /**
39411
- * Fetches both local config and backend connectors in parallel.
39412
- * Gracefully handles failures by returning empty arrays.
39413
- */
39414
- async function fetchConnectorState() {
39415
- const [local, backend] = await Promise.all([readLocalConnectors().catch(() => []), listConnectors().catch(() => [])]);
39416
- return {
39417
- local,
39418
- backend
39419
- };
39420
- }
39421
-
39422
- //#endregion
39423
- //#region src/cli/commands/connectors/add.ts
39424
- function validateIntegrationType(type) {
39425
- if (!isValidIntegration(type)) {
39426
- const supportedList = SUPPORTED_INTEGRATIONS.join(", ");
39427
- throw new Error(`Unsupported connector: ${type}\nSupported connectors: ${supportedList}`);
39428
- }
39429
- return type;
39430
- }
39431
- async function promptForIntegrationType() {
39432
- const selected = await ve({
39433
- message: "Select an integration to connect:",
39434
- options: SUPPORTED_INTEGRATIONS.map((type) => ({
39435
- value: type,
39436
- label: getIntegrationDisplayName(type)
39437
- }))
39438
- });
39439
- if (pD(selected)) {
39440
- xe("Operation cancelled.");
39441
- process.exit(0);
39442
- }
39443
- return selected;
39444
- }
39445
- async function addConnector(integrationType) {
39446
- const selectedType = integrationType ? validateIntegrationType(integrationType) : await promptForIntegrationType();
39447
- const displayName = getIntegrationDisplayName(selectedType);
39448
- const result = await runTask(`Initiating ${displayName} connection...`, async (updateMessage) => {
39449
- const initiateResponse = await initiateOAuth(selectedType);
39450
- if (initiateResponse.already_authorized) {
39451
- await addLocalConnector(selectedType);
39452
- return { alreadyAuthorized: true };
39453
- }
39454
- if (initiateResponse.error === "different_user" && initiateResponse.other_user_email) throw new Error(`This app is already connected to ${displayName} by ${initiateResponse.other_user_email}`);
39455
- if (!initiateResponse.redirect_url || !initiateResponse.connection_id) throw new Error("Invalid response from server: missing redirect URL or connection ID");
39456
- M.info(`Please authorize ${displayName} at:\n${theme.colors.links(initiateResponse.redirect_url)}`);
39457
- updateMessage("Waiting for authorization...");
39458
- const oauthResult = await waitForOAuthCompletion(selectedType, initiateResponse.connection_id);
39459
- if (!oauthResult.success) throw new Error(oauthResult.error || "Authorization failed");
39460
- await addLocalConnector(selectedType);
39461
- return {
39462
- alreadyAuthorized: false,
39463
- accountEmail: oauthResult.accountEmail
39464
- };
39465
- }, {
39466
- successMessage: "Authorization completed!",
39467
- errorMessage: `Failed to connect ${displayName}`
39468
- });
39469
- if (result.alreadyAuthorized) return { outroMessage: `Already connected to ${theme.styles.bold(displayName)} (added to config)` };
39470
- const accountInfo = result.accountEmail ? ` as ${theme.styles.bold(result.accountEmail)}` : "";
39471
- return { outroMessage: `Successfully connected to ${theme.styles.bold(displayName)}${accountInfo}` };
39472
- }
39473
- const connectorsAddCommand = new Command("add").argument("[type]", "Integration type (e.g., slack, notion, googlecalendar)").description("Connect an OAuth integration").action(async (type) => {
39474
- await runCommand(() => addConnector(type), {
39475
- requireAuth: true,
39476
- requireAppConfig: true
39477
- });
39478
- });
39479
-
39480
- //#endregion
39481
- //#region src/cli/commands/connectors/list.ts
39482
- function mergeConnectors(local, backend) {
39483
- const merged = /* @__PURE__ */ new Map();
39484
- for (const connector of local) merged.set(connector.type, {
39485
- type: connector.type,
39486
- displayName: getIntegrationDisplayName(connector.type),
39487
- inLocal: true,
39488
- inBackend: false
39489
- });
39490
- for (const connector of backend) {
39491
- const existing = merged.get(connector.integrationType);
39492
- const accountEmail = (connector.accountInfo?.email || connector.accountInfo?.name) ?? void 0;
39493
- if (existing) {
39494
- existing.inBackend = true;
39495
- existing.status = connector.status;
39496
- existing.accountEmail = accountEmail;
39497
- } else merged.set(connector.integrationType, {
39498
- type: connector.integrationType,
39499
- displayName: getIntegrationDisplayName(connector.integrationType),
39500
- inLocal: false,
39501
- inBackend: true,
39502
- status: connector.status,
39503
- accountEmail
39504
- });
39505
- }
39506
- return Array.from(merged.values());
39507
- }
39508
- function formatConnectorLine(connector) {
39509
- const { displayName, inLocal, inBackend, status, accountEmail } = connector;
39510
- const isConnected$1 = inBackend && status?.toLowerCase() === "active";
39511
- const isPending = inLocal && !inBackend;
39512
- const isOrphaned = inBackend && !inLocal;
39513
- let bullet;
39514
- let statusText = "";
39515
- if (isConnected$1) {
39516
- bullet = theme.colors.success("●");
39517
- if (accountEmail) statusText = ` - ${accountEmail}`;
39518
- } else if (isPending) {
39519
- bullet = theme.colors.warning("○");
39520
- statusText = theme.styles.dim(" (not connected)");
39521
- } else if (isOrphaned) {
39522
- bullet = theme.colors.error("○");
39523
- statusText = theme.styles.dim(" (not in local config)");
39524
- } else {
39525
- bullet = theme.colors.error("○");
39526
- statusText = theme.styles.dim(` (${status || "disconnected"})`);
39527
- }
39528
- return `${bullet} ${displayName}${statusText}`;
39529
- }
39530
- async function listConnectorsCommand() {
39531
- const { local: localConnectors, backend: backendConnectors } = await runTask("Fetching connectors...", fetchConnectorState, {
39532
- successMessage: "Connectors loaded",
39533
- errorMessage: "Failed to fetch connectors"
39534
- });
39535
- const merged = mergeConnectors(localConnectors, backendConnectors);
39536
- if (merged.length === 0) {
39537
- M.info("No connectors configured for this app.");
39538
- M.info(`Run ${theme.styles.bold("base44 connectors add")} to connect an integration.`);
39539
- return { outroMessage: "" };
39540
- }
39541
- console.log();
39542
- for (const connector of merged) console.log(formatConnectorLine(connector));
39543
- console.log();
39544
- const connected = merged.filter((c$1) => c$1.inBackend && c$1.status?.toLowerCase() === "active").length;
39545
- const pending = merged.filter((c$1) => c$1.inLocal && !c$1.inBackend).length;
39546
- let summary = `${connected} connected`;
39547
- if (pending > 0) {
39548
- summary += `, ${pending} pending`;
39549
- M.info(`Run ${theme.styles.bold("base44 connectors push")} to connect pending integrations.`);
39550
- }
39551
- return { outroMessage: summary };
39552
- }
39553
- const connectorsListCommand = new Command("list").description("List all connected OAuth integrations").action(async () => {
39554
- await runCommand(listConnectorsCommand, {
39555
- requireAuth: true,
39556
- requireAppConfig: true
39557
- });
39558
- });
39559
-
39560
- //#endregion
39561
- //#region src/cli/commands/connectors/push.ts
39562
- function findPendingConnectors(local, backend) {
39563
- const connectedTypes = new Set(backend.filter((c$1) => c$1.status.toLowerCase() === "active").map((c$1) => c$1.integrationType));
39564
- return local.filter((c$1) => !connectedTypes.has(c$1.type)).map((c$1) => ({
39565
- type: c$1.type,
39566
- displayName: getIntegrationDisplayName(c$1.type),
39567
- scopes: c$1.scopes
39568
- }));
39569
- }
39570
- function findOrphanedConnectors(local, backend) {
39571
- const localTypes = new Set(local.map((c$1) => c$1.type));
39572
- 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) => ({
39573
- type: c$1.integrationType,
39574
- displayName: getIntegrationDisplayName(c$1.integrationType),
39575
- accountEmail: (c$1.accountInfo?.email || c$1.accountInfo?.name) ?? void 0
39576
- }));
39577
- }
39578
- async function connectSingleConnector(connector) {
39579
- const { type, displayName, scopes } = connector;
39580
- return await runTask(`Initiating ${displayName} connection...`, async (updateMessage) => {
39581
- const initiateResponse = await initiateOAuth(type, scopes || null);
39582
- if (initiateResponse.already_authorized) return { success: true };
39583
- if (initiateResponse.error === "different_user") return {
39584
- success: false,
39585
- error: `Already connected by ${initiateResponse.other_user_email}`
39586
- };
39587
- if (!initiateResponse.redirect_url || !initiateResponse.connection_id) return {
39588
- success: false,
39589
- error: "Invalid response from server"
39590
- };
39591
- M.info(`Please authorize ${displayName} at:\n${theme.colors.links(initiateResponse.redirect_url)}`);
39592
- updateMessage("Waiting for authorization...");
39593
- return await waitForOAuthCompletion(type, initiateResponse.connection_id);
39594
- }, {
39595
- successMessage: "Authorization completed!",
39596
- errorMessage: "Authorization failed"
39597
- });
39598
- }
39599
- async function pushConnectorsCommand() {
39600
- const { local: localConnectors, backend: backendConnectors } = await runTask("Checking connector status...", fetchConnectorState, {
39601
- successMessage: "Status checked",
39602
- errorMessage: "Failed to check status"
39603
- });
39604
- const pending = findPendingConnectors(localConnectors, backendConnectors);
39605
- const orphaned = findOrphanedConnectors(localConnectors, backendConnectors);
39606
- if (pending.length === 0 && orphaned.length === 0) return { outroMessage: "All connectors are in sync" };
39607
- console.log();
39608
- if (pending.length > 0) {
39609
- M.info(`${pending.length} connector${pending.length === 1 ? "" : "s"} to connect:`);
39610
- for (const c$1 of pending) console.log(` ${theme.colors.success("+")} ${c$1.displayName}`);
39611
- }
39612
- if (orphaned.length > 0) {
39613
- M.info(`${orphaned.length} connector${orphaned.length === 1 ? "" : "s"} to remove:`);
39614
- for (const c$1 of orphaned) {
39615
- const accountInfo = c$1.accountEmail ? ` (${c$1.accountEmail})` : "";
39616
- console.log(` ${theme.colors.error("-")} ${c$1.displayName}${accountInfo}`);
39617
- }
39618
- }
39619
- console.log();
39620
- const totalChanges = pending.length + orphaned.length;
39621
- const shouldProceed = await ye({
39622
- message: `Apply ${totalChanges} change${totalChanges === 1 ? "" : "s"}?`,
39623
- initialValue: true
39624
- });
39625
- if (pD(shouldProceed) || !shouldProceed) return { outroMessage: "Cancelled" };
39626
- let connected = 0;
39627
- let removed = 0;
39628
- let failed = 0;
39629
- for (const connector of orphaned) try {
39630
- await disconnectConnector(connector.type);
39631
- M.success(`Removed ${connector.displayName}`);
39632
- removed++;
39633
- } catch (err) {
39634
- M.error(`Failed to remove ${connector.displayName}: ${err instanceof Error ? err.message : "Unknown error"}`);
39635
- failed++;
39636
- }
39637
- for (const connector of pending) {
39638
- console.log();
39639
- const result = await connectSingleConnector(connector);
39640
- if (result.success) {
39641
- const accountInfo = result.accountEmail ? ` as ${result.accountEmail}` : "";
39642
- M.success(`${connector.displayName} connected${accountInfo}`);
39643
- connected++;
39644
- } else {
39645
- M.error(`${connector.displayName} failed: ${result.error}`);
39646
- failed++;
39647
- }
39648
- }
39649
- console.log();
39650
- const parts = [];
39651
- if (connected > 0) parts.push(`${connected} connected`);
39652
- if (removed > 0) parts.push(`${removed} removed`);
39653
- if (failed > 0) parts.push(`${failed} failed`);
39654
- return { outroMessage: parts.join(", ") };
39655
- }
39656
- const connectorsPushCommand = new Command("push").description("Sync connectors with backend (connect new, remove missing)").action(async () => {
39657
- await runCommand(pushConnectorsCommand, {
39658
- requireAuth: true,
39659
- requireAppConfig: true
39660
- });
39661
- });
39662
-
39663
- //#endregion
39664
- //#region src/cli/commands/connectors/remove.ts
39665
- function mergeConnectorsForRemoval(local, backend) {
39666
- const merged = /* @__PURE__ */ new Map();
39667
- for (const connector of local) merged.set(connector.type, {
39668
- type: connector.type,
39669
- displayName: getIntegrationDisplayName(connector.type),
39670
- inLocal: true,
39671
- inBackend: false
39672
- });
39673
- for (const connector of backend) {
39674
- if (!isValidIntegration(connector.integrationType)) continue;
39675
- const existing = merged.get(connector.integrationType);
39676
- const accountEmail = (connector.accountInfo?.email || connector.accountInfo?.name) ?? void 0;
39677
- if (existing) {
39678
- existing.inBackend = true;
39679
- existing.accountEmail = accountEmail;
39680
- } else merged.set(connector.integrationType, {
39681
- type: connector.integrationType,
39682
- displayName: getIntegrationDisplayName(connector.integrationType),
39683
- inLocal: false,
39684
- inBackend: true,
39685
- accountEmail
39686
- });
39687
- }
39688
- return Array.from(merged.values());
39689
- }
39690
- function validateConnectorType(type, merged) {
39691
- if (!isValidIntegration(type)) throw new Error(`Invalid connector type: ${type}`);
39692
- const connector = merged.find((c$1) => c$1.type === type);
39693
- if (!connector) throw new Error(`No ${getIntegrationDisplayName(type)} connector found`);
39694
- return {
39695
- type,
39696
- connector
39697
- };
39698
- }
39699
- async function promptForConnectorToRemove(connectors) {
39700
- const selected = await ve({
39701
- message: "Select a connector to remove:",
39702
- options: connectors.map((c$1) => {
39703
- let label = c$1.displayName;
39704
- if (c$1.accountEmail) label += ` (${c$1.accountEmail})`;
39705
- else if (c$1.inLocal && !c$1.inBackend) label += " (not connected)";
39706
- return {
39707
- value: c$1.type,
39708
- label
39709
- };
39710
- })
39711
- });
39712
- if (pD(selected)) {
39713
- xe("Operation cancelled.");
39714
- process.exit(0);
39715
- }
39716
- return {
39717
- type: selected,
39718
- connector: connectors.find((c$1) => c$1.type === selected)
39719
- };
39720
- }
39721
- async function removeConnectorCommand(integrationType, options = {}) {
39722
- const isHardDelete = options.hard === true;
39723
- const { local: localConnectors, backend: backendConnectors } = await runTask("Fetching connectors...", fetchConnectorState, {
39724
- successMessage: "Connectors loaded",
39725
- errorMessage: "Failed to fetch connectors"
39726
- });
39727
- const merged = mergeConnectorsForRemoval(localConnectors, backendConnectors);
39728
- if (merged.length === 0) return { outroMessage: "No connectors to remove" };
39729
- const { type: selectedType, connector: selectedConnector } = integrationType ? validateConnectorType(integrationType, merged) : await promptForConnectorToRemove(merged);
39730
- const displayName = getIntegrationDisplayName(selectedType);
39731
- const accountInfo = selectedConnector.accountEmail ? ` (${selectedConnector.accountEmail})` : "";
39732
- if (!options.yes) {
39733
- const shouldRemove = await ye({
39734
- message: `${isHardDelete ? "Permanently remove" : "Remove"} ${displayName}${accountInfo}?`,
39735
- initialValue: false
39736
- });
39737
- if (pD(shouldRemove) || !shouldRemove) {
39738
- xe("Operation cancelled.");
39739
- process.exit(0);
39740
- }
39741
- }
39742
- await runTask(`Removing ${displayName}...`, async () => {
39743
- if (selectedConnector.inBackend) if (isHardDelete) await removeConnector(selectedType);
39744
- else await disconnectConnector(selectedType);
39745
- await removeLocalConnector(selectedType);
39746
- }, {
39747
- successMessage: `${displayName} removed`,
39748
- errorMessage: `Failed to remove ${displayName}`
39749
- });
39750
- return { outroMessage: `Successfully removed ${theme.styles.bold(displayName)}` };
39751
- }
39752
- const connectorsRemoveCommand = new Command("remove").argument("[type]", "Integration type to remove (e.g., slack, notion)").option("--hard", "Permanently remove the connector (cannot be undone)").option("-y, --yes", "Skip confirmation prompt").description("Remove an OAuth integration").action(async (type, options) => {
39753
- await runCommand(() => removeConnectorCommand(type, options), {
39754
- requireAuth: true,
39755
- requireAppConfig: true
39756
- });
39757
- });
39758
-
39759
- //#endregion
39760
- //#region src/cli/commands/connectors/index.ts
39761
- const connectorsCommand = new Command("connectors").description("Manage OAuth connectors").addCommand(connectorsAddCommand).addCommand(connectorsListCommand).addCommand(connectorsPushCommand).addCommand(connectorsRemoveCommand);
39762
-
39763
38912
  //#endregion
39764
38913
  //#region package.json
39765
38914
  var version = "0.0.17";
@@ -39779,7 +38928,6 @@ program.addCommand(linkCommand);
39779
38928
  program.addCommand(entitiesPushCommand);
39780
38929
  program.addCommand(functionsDeployCommand);
39781
38930
  program.addCommand(siteDeployCommand);
39782
- program.addCommand(connectorsCommand);
39783
38931
 
39784
38932
  //#endregion
39785
38933
  export { CLIExitError, program };