@base44-preview/cli 0.0.15-pr.102.d2fdfed → 0.0.15-pr.104.3f5c540
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/README.md +40 -78
- package/dist/cli/index.js +824 -426
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { EventEmitter, addAbortListener, on, once, setMaxListeners } from "node:events";
|
|
4
4
|
import childProcess, { ChildProcess, execFile, spawn, spawnSync } from "node:child_process";
|
|
5
|
-
import path, { basename, dirname, join, posix,
|
|
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
|
|
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$
|
|
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$
|
|
949
|
-
writeErr: (str) => process$
|
|
950
|
-
getOutHelpWidth: () => process$
|
|
951
|
-
getErrHelpWidth: () => process$
|
|
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$
|
|
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$
|
|
1645
|
-
const execArgv$1 = process$
|
|
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$
|
|
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$
|
|
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$
|
|
1772
|
+
if (process$3.platform !== "win32") if (launchWithNode) {
|
|
1773
1773
|
args.unshift(executableFile);
|
|
1774
|
-
args = incrementNodeInspectorPort(process$
|
|
1775
|
-
proc$1 = childProcess$1.spawn(process$
|
|
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$
|
|
1780
|
-
proc$1 = childProcess$1.spawn(process$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
2716
|
-
if (!y$
|
|
2717
|
-
return `${CSI}${y$
|
|
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$
|
|
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$
|
|
2724
|
-
else if (y$
|
|
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
|
|
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,6 +4547,7 @@ 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;
|
|
4550
4551
|
const lowercase = /^[^A-Z]*$/;
|
|
4551
4552
|
const uppercase = /^[^a-z]*$/;
|
|
4552
4553
|
|
|
@@ -5325,6 +5326,24 @@ const $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst,
|
|
|
5325
5326
|
$ZodCheckNumberFormat.init(inst, def);
|
|
5326
5327
|
$ZodNumber.init(inst, def);
|
|
5327
5328
|
});
|
|
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
|
+
});
|
|
5328
5347
|
const $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
|
|
5329
5348
|
$ZodType.init(inst, def);
|
|
5330
5349
|
inst._zod.parse = (payload) => payload;
|
|
@@ -5909,24 +5928,6 @@ const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
|
5909
5928
|
return payload;
|
|
5910
5929
|
};
|
|
5911
5930
|
});
|
|
5912
|
-
const $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
5913
|
-
$ZodType.init(inst, def);
|
|
5914
|
-
if (def.values.length === 0) throw new Error("Cannot create literal schema with no valid values");
|
|
5915
|
-
const values = new Set(def.values);
|
|
5916
|
-
inst._zod.values = values;
|
|
5917
|
-
inst._zod.pattern = /* @__PURE__ */ new RegExp(`^(${def.values.map((o$2) => typeof o$2 === "string" ? escapeRegex(o$2) : o$2 ? escapeRegex(o$2.toString()) : String(o$2)).join("|")})$`);
|
|
5918
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
5919
|
-
const input = payload.value;
|
|
5920
|
-
if (values.has(input)) return payload;
|
|
5921
|
-
payload.issues.push({
|
|
5922
|
-
code: "invalid_value",
|
|
5923
|
-
values: def.values,
|
|
5924
|
-
input,
|
|
5925
|
-
inst
|
|
5926
|
-
});
|
|
5927
|
-
return payload;
|
|
5928
|
-
};
|
|
5929
|
-
});
|
|
5930
5931
|
const $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
|
|
5931
5932
|
$ZodType.init(inst, def);
|
|
5932
5933
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -6488,6 +6489,13 @@ function _int(Class, params) {
|
|
|
6488
6489
|
});
|
|
6489
6490
|
}
|
|
6490
6491
|
/* @__NO_SIDE_EFFECTS__ */
|
|
6492
|
+
function _boolean(Class, params) {
|
|
6493
|
+
return new Class({
|
|
6494
|
+
type: "boolean",
|
|
6495
|
+
...normalizeParams(params)
|
|
6496
|
+
});
|
|
6497
|
+
}
|
|
6498
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
6491
6499
|
function _unknown(Class) {
|
|
6492
6500
|
return new Class({ type: "unknown" });
|
|
6493
6501
|
}
|
|
@@ -6737,7 +6745,7 @@ function initializeContext(params) {
|
|
|
6737
6745
|
external: params?.external ?? void 0
|
|
6738
6746
|
};
|
|
6739
6747
|
}
|
|
6740
|
-
function process$
|
|
6748
|
+
function process$2(schema, ctx, _params = {
|
|
6741
6749
|
path: [],
|
|
6742
6750
|
schemaPath: []
|
|
6743
6751
|
}) {
|
|
@@ -6774,7 +6782,7 @@ function process$3(schema, ctx, _params = {
|
|
|
6774
6782
|
const parent = schema._zod.parent;
|
|
6775
6783
|
if (parent) {
|
|
6776
6784
|
if (!result.ref) result.ref = parent;
|
|
6777
|
-
process$
|
|
6785
|
+
process$2(parent, ctx, params);
|
|
6778
6786
|
ctx.seen.get(parent).isParent = true;
|
|
6779
6787
|
}
|
|
6780
6788
|
}
|
|
@@ -6986,7 +6994,7 @@ const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
|
6986
6994
|
...params,
|
|
6987
6995
|
processors
|
|
6988
6996
|
});
|
|
6989
|
-
process$
|
|
6997
|
+
process$2(schema, ctx);
|
|
6990
6998
|
extractDefs(ctx, schema);
|
|
6991
6999
|
return finalize(ctx, schema);
|
|
6992
7000
|
};
|
|
@@ -6998,7 +7006,7 @@ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params)
|
|
|
6998
7006
|
io,
|
|
6999
7007
|
processors
|
|
7000
7008
|
});
|
|
7001
|
-
process$
|
|
7009
|
+
process$2(schema, ctx);
|
|
7002
7010
|
extractDefs(ctx, schema);
|
|
7003
7011
|
return finalize(ctx, schema);
|
|
7004
7012
|
};
|
|
@@ -7058,6 +7066,9 @@ const numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
7058
7066
|
}
|
|
7059
7067
|
if (typeof multipleOf === "number") json.multipleOf = multipleOf;
|
|
7060
7068
|
};
|
|
7069
|
+
const booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
7070
|
+
json.type = "boolean";
|
|
7071
|
+
};
|
|
7061
7072
|
const neverProcessor = (_schema, _ctx, json, _params) => {
|
|
7062
7073
|
json.not = {};
|
|
7063
7074
|
};
|
|
@@ -7069,27 +7080,6 @@ const enumProcessor = (schema, _ctx, json, _params) => {
|
|
|
7069
7080
|
if (values.every((v$1) => typeof v$1 === "string")) json.type = "string";
|
|
7070
7081
|
json.enum = values;
|
|
7071
7082
|
};
|
|
7072
|
-
const literalProcessor = (schema, ctx, json, _params) => {
|
|
7073
|
-
const def = schema._zod.def;
|
|
7074
|
-
const vals = [];
|
|
7075
|
-
for (const val of def.values) if (val === void 0) {
|
|
7076
|
-
if (ctx.unrepresentable === "throw") throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
7077
|
-
} else if (typeof val === "bigint") if (ctx.unrepresentable === "throw") throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
7078
|
-
else vals.push(Number(val));
|
|
7079
|
-
else vals.push(val);
|
|
7080
|
-
if (vals.length === 0) {} else if (vals.length === 1) {
|
|
7081
|
-
const val = vals[0];
|
|
7082
|
-
json.type = val === null ? "null" : typeof val;
|
|
7083
|
-
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") json.enum = [val];
|
|
7084
|
-
else json.const = val;
|
|
7085
|
-
} else {
|
|
7086
|
-
if (vals.every((v$1) => typeof v$1 === "number")) json.type = "number";
|
|
7087
|
-
if (vals.every((v$1) => typeof v$1 === "string")) json.type = "string";
|
|
7088
|
-
if (vals.every((v$1) => typeof v$1 === "boolean")) json.type = "boolean";
|
|
7089
|
-
if (vals.every((v$1) => v$1 === null)) json.type = "null";
|
|
7090
|
-
json.enum = vals;
|
|
7091
|
-
}
|
|
7092
|
-
};
|
|
7093
7083
|
const customProcessor = (_schema, ctx, _json, _params) => {
|
|
7094
7084
|
if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
|
|
7095
7085
|
};
|
|
@@ -7103,7 +7093,7 @@ const arrayProcessor = (schema, ctx, _json, params) => {
|
|
|
7103
7093
|
if (typeof minimum === "number") json.minItems = minimum;
|
|
7104
7094
|
if (typeof maximum === "number") json.maxItems = maximum;
|
|
7105
7095
|
json.type = "array";
|
|
7106
|
-
json.items = process$
|
|
7096
|
+
json.items = process$2(def.element, ctx, {
|
|
7107
7097
|
...params,
|
|
7108
7098
|
path: [...params.path, "items"]
|
|
7109
7099
|
});
|
|
@@ -7114,7 +7104,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
|
|
|
7114
7104
|
json.type = "object";
|
|
7115
7105
|
json.properties = {};
|
|
7116
7106
|
const shape = def.shape;
|
|
7117
|
-
for (const key in shape) json.properties[key] = process$
|
|
7107
|
+
for (const key in shape) json.properties[key] = process$2(shape[key], ctx, {
|
|
7118
7108
|
...params,
|
|
7119
7109
|
path: [
|
|
7120
7110
|
...params.path,
|
|
@@ -7132,7 +7122,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
|
|
|
7132
7122
|
if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
|
|
7133
7123
|
else if (!def.catchall) {
|
|
7134
7124
|
if (ctx.io === "output") json.additionalProperties = false;
|
|
7135
|
-
} else if (def.catchall) json.additionalProperties = process$
|
|
7125
|
+
} else if (def.catchall) json.additionalProperties = process$2(def.catchall, ctx, {
|
|
7136
7126
|
...params,
|
|
7137
7127
|
path: [...params.path, "additionalProperties"]
|
|
7138
7128
|
});
|
|
@@ -7140,7 +7130,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
|
|
|
7140
7130
|
const unionProcessor = (schema, ctx, json, params) => {
|
|
7141
7131
|
const def = schema._zod.def;
|
|
7142
7132
|
const isExclusive = def.inclusive === false;
|
|
7143
|
-
const options = def.options.map((x$2, i$1) => process$
|
|
7133
|
+
const options = def.options.map((x$2, i$1) => process$2(x$2, ctx, {
|
|
7144
7134
|
...params,
|
|
7145
7135
|
path: [
|
|
7146
7136
|
...params.path,
|
|
@@ -7153,7 +7143,7 @@ const unionProcessor = (schema, ctx, json, params) => {
|
|
|
7153
7143
|
};
|
|
7154
7144
|
const intersectionProcessor = (schema, ctx, json, params) => {
|
|
7155
7145
|
const def = schema._zod.def;
|
|
7156
|
-
const a$1 = process$
|
|
7146
|
+
const a$1 = process$2(def.left, ctx, {
|
|
7157
7147
|
...params,
|
|
7158
7148
|
path: [
|
|
7159
7149
|
...params.path,
|
|
@@ -7161,7 +7151,7 @@ const intersectionProcessor = (schema, ctx, json, params) => {
|
|
|
7161
7151
|
0
|
|
7162
7152
|
]
|
|
7163
7153
|
});
|
|
7164
|
-
const b$2 = process$
|
|
7154
|
+
const b$2 = process$2(def.right, ctx, {
|
|
7165
7155
|
...params,
|
|
7166
7156
|
path: [
|
|
7167
7157
|
...params.path,
|
|
@@ -7178,7 +7168,7 @@ const tupleProcessor = (schema, ctx, _json, params) => {
|
|
|
7178
7168
|
json.type = "array";
|
|
7179
7169
|
const prefixPath$1 = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
7180
7170
|
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
7181
|
-
const prefixItems = def.items.map((x$2, i$1) => process$
|
|
7171
|
+
const prefixItems = def.items.map((x$2, i$1) => process$2(x$2, ctx, {
|
|
7182
7172
|
...params,
|
|
7183
7173
|
path: [
|
|
7184
7174
|
...params.path,
|
|
@@ -7186,7 +7176,7 @@ const tupleProcessor = (schema, ctx, _json, params) => {
|
|
|
7186
7176
|
i$1
|
|
7187
7177
|
]
|
|
7188
7178
|
}));
|
|
7189
|
-
const rest = def.rest ? process$
|
|
7179
|
+
const rest = def.rest ? process$2(def.rest, ctx, {
|
|
7190
7180
|
...params,
|
|
7191
7181
|
path: [
|
|
7192
7182
|
...params.path,
|
|
@@ -7217,7 +7207,7 @@ const recordProcessor = (schema, ctx, _json, params) => {
|
|
|
7217
7207
|
const keyType = def.keyType;
|
|
7218
7208
|
const patterns = keyType._zod.bag?.patterns;
|
|
7219
7209
|
if (def.mode === "loose" && patterns && patterns.size > 0) {
|
|
7220
|
-
const valueSchema = process$
|
|
7210
|
+
const valueSchema = process$2(def.valueType, ctx, {
|
|
7221
7211
|
...params,
|
|
7222
7212
|
path: [
|
|
7223
7213
|
...params.path,
|
|
@@ -7228,11 +7218,11 @@ const recordProcessor = (schema, ctx, _json, params) => {
|
|
|
7228
7218
|
json.patternProperties = {};
|
|
7229
7219
|
for (const pattern of patterns) json.patternProperties[pattern.source] = valueSchema;
|
|
7230
7220
|
} else {
|
|
7231
|
-
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") json.propertyNames = process$
|
|
7221
|
+
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") json.propertyNames = process$2(def.keyType, ctx, {
|
|
7232
7222
|
...params,
|
|
7233
7223
|
path: [...params.path, "propertyNames"]
|
|
7234
7224
|
});
|
|
7235
|
-
json.additionalProperties = process$
|
|
7225
|
+
json.additionalProperties = process$2(def.valueType, ctx, {
|
|
7236
7226
|
...params,
|
|
7237
7227
|
path: [...params.path, "additionalProperties"]
|
|
7238
7228
|
});
|
|
@@ -7245,7 +7235,7 @@ const recordProcessor = (schema, ctx, _json, params) => {
|
|
|
7245
7235
|
};
|
|
7246
7236
|
const nullableProcessor = (schema, ctx, json, params) => {
|
|
7247
7237
|
const def = schema._zod.def;
|
|
7248
|
-
const inner = process$
|
|
7238
|
+
const inner = process$2(def.innerType, ctx, params);
|
|
7249
7239
|
const seen = ctx.seen.get(schema);
|
|
7250
7240
|
if (ctx.target === "openapi-3.0") {
|
|
7251
7241
|
seen.ref = def.innerType;
|
|
@@ -7254,27 +7244,27 @@ const nullableProcessor = (schema, ctx, json, params) => {
|
|
|
7254
7244
|
};
|
|
7255
7245
|
const nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
7256
7246
|
const def = schema._zod.def;
|
|
7257
|
-
process$
|
|
7247
|
+
process$2(def.innerType, ctx, params);
|
|
7258
7248
|
const seen = ctx.seen.get(schema);
|
|
7259
7249
|
seen.ref = def.innerType;
|
|
7260
7250
|
};
|
|
7261
7251
|
const defaultProcessor = (schema, ctx, json, params) => {
|
|
7262
7252
|
const def = schema._zod.def;
|
|
7263
|
-
process$
|
|
7253
|
+
process$2(def.innerType, ctx, params);
|
|
7264
7254
|
const seen = ctx.seen.get(schema);
|
|
7265
7255
|
seen.ref = def.innerType;
|
|
7266
7256
|
json.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
7267
7257
|
};
|
|
7268
7258
|
const prefaultProcessor = (schema, ctx, json, params) => {
|
|
7269
7259
|
const def = schema._zod.def;
|
|
7270
|
-
process$
|
|
7260
|
+
process$2(def.innerType, ctx, params);
|
|
7271
7261
|
const seen = ctx.seen.get(schema);
|
|
7272
7262
|
seen.ref = def.innerType;
|
|
7273
7263
|
if (ctx.io === "input") json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
7274
7264
|
};
|
|
7275
7265
|
const catchProcessor = (schema, ctx, json, params) => {
|
|
7276
7266
|
const def = schema._zod.def;
|
|
7277
|
-
process$
|
|
7267
|
+
process$2(def.innerType, ctx, params);
|
|
7278
7268
|
const seen = ctx.seen.get(schema);
|
|
7279
7269
|
seen.ref = def.innerType;
|
|
7280
7270
|
let catchValue;
|
|
@@ -7288,20 +7278,20 @@ const catchProcessor = (schema, ctx, json, params) => {
|
|
|
7288
7278
|
const pipeProcessor = (schema, ctx, _json, params) => {
|
|
7289
7279
|
const def = schema._zod.def;
|
|
7290
7280
|
const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
|
|
7291
|
-
process$
|
|
7281
|
+
process$2(innerType, ctx, params);
|
|
7292
7282
|
const seen = ctx.seen.get(schema);
|
|
7293
7283
|
seen.ref = innerType;
|
|
7294
7284
|
};
|
|
7295
7285
|
const readonlyProcessor = (schema, ctx, json, params) => {
|
|
7296
7286
|
const def = schema._zod.def;
|
|
7297
|
-
process$
|
|
7287
|
+
process$2(def.innerType, ctx, params);
|
|
7298
7288
|
const seen = ctx.seen.get(schema);
|
|
7299
7289
|
seen.ref = def.innerType;
|
|
7300
7290
|
json.readOnly = true;
|
|
7301
7291
|
};
|
|
7302
7292
|
const optionalProcessor = (schema, ctx, _json, params) => {
|
|
7303
7293
|
const def = schema._zod.def;
|
|
7304
|
-
process$
|
|
7294
|
+
process$2(def.innerType, ctx, params);
|
|
7305
7295
|
const seen = ctx.seen.get(schema);
|
|
7306
7296
|
seen.ref = def.innerType;
|
|
7307
7297
|
};
|
|
@@ -7635,6 +7625,14 @@ const ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, d
|
|
|
7635
7625
|
function int(params) {
|
|
7636
7626
|
return _int(ZodNumberFormat, params);
|
|
7637
7627
|
}
|
|
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
|
+
}
|
|
7638
7636
|
const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
7639
7637
|
$ZodUnknown.init(inst, def);
|
|
7640
7638
|
ZodType.init(inst, def);
|
|
@@ -7816,23 +7814,6 @@ function _enum(values, params) {
|
|
|
7816
7814
|
...normalizeParams(params)
|
|
7817
7815
|
});
|
|
7818
7816
|
}
|
|
7819
|
-
const ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
|
|
7820
|
-
$ZodLiteral.init(inst, def);
|
|
7821
|
-
ZodType.init(inst, def);
|
|
7822
|
-
inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
|
|
7823
|
-
inst.values = new Set(def.values);
|
|
7824
|
-
Object.defineProperty(inst, "value", { get() {
|
|
7825
|
-
if (def.values.length > 1) throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
7826
|
-
return def.values[0];
|
|
7827
|
-
} });
|
|
7828
|
-
});
|
|
7829
|
-
function literal(value, params) {
|
|
7830
|
-
return new ZodLiteral({
|
|
7831
|
-
type: "literal",
|
|
7832
|
-
values: Array.isArray(value) ? value : [value],
|
|
7833
|
-
...normalizeParams(params)
|
|
7834
|
-
});
|
|
7835
|
-
}
|
|
7836
7817
|
const ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
7837
7818
|
$ZodTransform.init(inst, def);
|
|
7838
7819
|
ZodType.init(inst, def);
|
|
@@ -8058,6 +8039,19 @@ var AuthValidationError = class extends Error {
|
|
|
8058
8039
|
this.name = "AuthValidationError";
|
|
8059
8040
|
}
|
|
8060
8041
|
};
|
|
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
|
+
};
|
|
8061
8055
|
|
|
8062
8056
|
//#endregion
|
|
8063
8057
|
//#region src/core/consts.ts
|
|
@@ -13782,10 +13776,10 @@ var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
13782
13776
|
exports.removeDuplicateSlashes = removeDuplicateSlashes;
|
|
13783
13777
|
function partitionAbsoluteAndRelative(patterns) {
|
|
13784
13778
|
const absolute = [];
|
|
13785
|
-
const relative
|
|
13779
|
+
const relative = [];
|
|
13786
13780
|
for (const pattern of patterns) if (isAbsolute(pattern)) absolute.push(pattern);
|
|
13787
|
-
else relative
|
|
13788
|
-
return [absolute, relative
|
|
13781
|
+
else relative.push(pattern);
|
|
13782
|
+
return [absolute, relative];
|
|
13789
13783
|
}
|
|
13790
13784
|
exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
|
|
13791
13785
|
function isAbsolute(pattern) {
|
|
@@ -16351,7 +16345,7 @@ const createIgnorePredicate = (patterns, cwd, baseDir) => {
|
|
|
16351
16345
|
};
|
|
16352
16346
|
const normalizeOptions$2 = (options = {}) => {
|
|
16353
16347
|
const ignoreOption = options.ignore ? Array.isArray(options.ignore) ? options.ignore : [options.ignore] : [];
|
|
16354
|
-
const cwd = toPath$1(options.cwd) ??
|
|
16348
|
+
const cwd = toPath$1(options.cwd) ?? y.cwd();
|
|
16355
16349
|
const deep = typeof options.deep === "number" ? Math.max(0, options.deep) + 1 : Number.POSITIVE_INFINITY;
|
|
16356
16350
|
return {
|
|
16357
16351
|
cwd,
|
|
@@ -16448,7 +16442,7 @@ const getDirectoryGlob = ({ directoryPath, files, extensions }) => {
|
|
|
16448
16442
|
const extensionGlob = extensions?.length > 0 ? `.${extensions.length > 1 ? `{${extensions.join(",")}}` : extensions[0]}` : "";
|
|
16449
16443
|
return files ? files.map((file) => path.posix.join(directoryPath, `**/${path.extname(file) ? file : `${file}${extensionGlob}`}`)) : [path.posix.join(directoryPath, `**${extensionGlob ? `/*${extensionGlob}` : ""}`)];
|
|
16450
16444
|
};
|
|
16451
|
-
const directoryToGlob = async (directoryPaths, { cwd =
|
|
16445
|
+
const directoryToGlob = async (directoryPaths, { cwd = y.cwd(), files, extensions, fs: fsImplementation } = {}) => {
|
|
16452
16446
|
return (await Promise.all(directoryPaths.map(async (directoryPath) => {
|
|
16453
16447
|
if (shouldExpandGlobstarDirectory(isNegativePattern(directoryPath) ? directoryPath.slice(1) : directoryPath)) return getDirectoryGlob({
|
|
16454
16448
|
directoryPath,
|
|
@@ -16462,7 +16456,7 @@ const directoryToGlob = async (directoryPaths, { cwd = process$1.cwd(), files, e
|
|
|
16462
16456
|
}) : directoryPath;
|
|
16463
16457
|
}))).flat();
|
|
16464
16458
|
};
|
|
16465
|
-
const directoryToGlobSync = (directoryPaths, { cwd =
|
|
16459
|
+
const directoryToGlobSync = (directoryPaths, { cwd = y.cwd(), files, extensions, fs: fsImplementation } = {}) => directoryPaths.flatMap((directoryPath) => {
|
|
16466
16460
|
if (shouldExpandGlobstarDirectory(isNegativePattern(directoryPath) ? directoryPath.slice(1) : directoryPath)) return getDirectoryGlob({
|
|
16467
16461
|
directoryPath,
|
|
16468
16462
|
files,
|
|
@@ -16558,7 +16552,7 @@ const applyIgnoreFilesAndGetFilterSync = (options) => {
|
|
|
16558
16552
|
};
|
|
16559
16553
|
const createFilterFunction = (isIgnored, cwd) => {
|
|
16560
16554
|
const seen = /* @__PURE__ */ new Set();
|
|
16561
|
-
const basePath = cwd ||
|
|
16555
|
+
const basePath = cwd || y.cwd();
|
|
16562
16556
|
const pathCache = /* @__PURE__ */ new Map();
|
|
16563
16557
|
return (fastGlobResult) => {
|
|
16564
16558
|
const pathKey$1 = path.normalize(fastGlobResult.path ?? fastGlobResult);
|
|
@@ -16855,10 +16849,13 @@ const SiteConfigSchema = object({
|
|
|
16855
16849
|
outputDirectory: string().optional(),
|
|
16856
16850
|
installCommand: string().optional()
|
|
16857
16851
|
});
|
|
16852
|
+
const ConnectorConfigSchema = object({ scopes: array(string()).optional() });
|
|
16853
|
+
const ConnectorsConfigSchema = record(string(), ConnectorConfigSchema);
|
|
16858
16854
|
const ProjectConfigSchema = object({
|
|
16859
16855
|
name: string().min(1, "App name cannot be empty"),
|
|
16860
16856
|
description: string().optional(),
|
|
16861
16857
|
site: SiteConfigSchema.optional(),
|
|
16858
|
+
connectors: ConnectorsConfigSchema.optional(),
|
|
16862
16859
|
entitiesDir: string().optional().default("entities"),
|
|
16863
16860
|
functionsDir: string().optional().default("functions")
|
|
16864
16861
|
});
|
|
@@ -28210,7 +28207,7 @@ const FILE$1 = Symbol("file");
|
|
|
28210
28207
|
const DIRECTORY$1 = Symbol("directory");
|
|
28211
28208
|
const SYMLINK$1 = Symbol("symlink");
|
|
28212
28209
|
const HARDLINK$1 = Symbol("hardlink");
|
|
28213
|
-
const HEADER
|
|
28210
|
+
const HEADER = Symbol("header");
|
|
28214
28211
|
const READ = Symbol("read");
|
|
28215
28212
|
const LSTAT = Symbol("lstat");
|
|
28216
28213
|
const ONLSTAT = Symbol("onlstat");
|
|
@@ -28329,7 +28326,7 @@ var WriteEntry = class extends Minipass {
|
|
|
28329
28326
|
[PREFIX](path$16) {
|
|
28330
28327
|
return prefixPath(path$16, this.prefix);
|
|
28331
28328
|
}
|
|
28332
|
-
[HEADER
|
|
28329
|
+
[HEADER]() {
|
|
28333
28330
|
/* c8 ignore start */
|
|
28334
28331
|
if (!this.stat) throw new Error("cannot write header before stat");
|
|
28335
28332
|
/* c8 ignore stop */
|
|
@@ -28374,7 +28371,7 @@ var WriteEntry = class extends Minipass {
|
|
|
28374
28371
|
/* c8 ignore stop */
|
|
28375
28372
|
if (this.path.slice(-1) !== "/") this.path += "/";
|
|
28376
28373
|
this.stat.size = 0;
|
|
28377
|
-
this[HEADER
|
|
28374
|
+
this[HEADER]();
|
|
28378
28375
|
this.end();
|
|
28379
28376
|
}
|
|
28380
28377
|
[SYMLINK$1]() {
|
|
@@ -28385,7 +28382,7 @@ var WriteEntry = class extends Minipass {
|
|
|
28385
28382
|
}
|
|
28386
28383
|
[ONREADLINK](linkpath) {
|
|
28387
28384
|
this.linkpath = normalizeWindowsPath(linkpath);
|
|
28388
|
-
this[HEADER
|
|
28385
|
+
this[HEADER]();
|
|
28389
28386
|
this.end();
|
|
28390
28387
|
}
|
|
28391
28388
|
[HARDLINK$1](linkpath) {
|
|
@@ -28395,7 +28392,7 @@ var WriteEntry = class extends Minipass {
|
|
|
28395
28392
|
this.type = "Link";
|
|
28396
28393
|
this.linkpath = normalizeWindowsPath(path$1.relative(this.cwd, linkpath));
|
|
28397
28394
|
this.stat.size = 0;
|
|
28398
|
-
this[HEADER
|
|
28395
|
+
this[HEADER]();
|
|
28399
28396
|
this.end();
|
|
28400
28397
|
}
|
|
28401
28398
|
[FILE$1]() {
|
|
@@ -28408,7 +28405,7 @@ var WriteEntry = class extends Minipass {
|
|
|
28408
28405
|
if (linkpath?.indexOf(this.cwd) === 0) return this[HARDLINK$1](linkpath);
|
|
28409
28406
|
this.linkCache.set(linkKey, this.absolute);
|
|
28410
28407
|
}
|
|
28411
|
-
this[HEADER
|
|
28408
|
+
this[HEADER]();
|
|
28412
28409
|
if (this.stat.size === 0) return this.end();
|
|
28413
28410
|
this[OPENFILE]();
|
|
28414
28411
|
}
|
|
@@ -30898,13 +30895,13 @@ var ansi_styles_default = ansiStyles;
|
|
|
30898
30895
|
|
|
30899
30896
|
//#endregion
|
|
30900
30897
|
//#region node_modules/chalk/source/vendor/supports-color/index.js
|
|
30901
|
-
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args :
|
|
30898
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : y.argv) {
|
|
30902
30899
|
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
30903
30900
|
const position = argv.indexOf(prefix + flag);
|
|
30904
30901
|
const terminatorPosition = argv.indexOf("--");
|
|
30905
30902
|
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
30906
30903
|
}
|
|
30907
|
-
const { env } =
|
|
30904
|
+
const { env } = y;
|
|
30908
30905
|
let flagForceColor;
|
|
30909
30906
|
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) flagForceColor = 0;
|
|
30910
30907
|
else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) flagForceColor = 1;
|
|
@@ -30937,7 +30934,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
|
30937
30934
|
if (haveStream && !streamIsTTY && forceColor === void 0) return 0;
|
|
30938
30935
|
const min = forceColor || 0;
|
|
30939
30936
|
if (env.TERM === "dumb") return min;
|
|
30940
|
-
if (
|
|
30937
|
+
if (y.platform === "win32") {
|
|
30941
30938
|
const osRelease = os.release().split(".");
|
|
30942
30939
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
30943
30940
|
return 1;
|
|
@@ -31150,7 +31147,10 @@ const theme = {
|
|
|
31150
31147
|
base44OrangeBackground: source_default.bgHex("#E86B3C"),
|
|
31151
31148
|
shinyOrange: source_default.hex("#FFD700"),
|
|
31152
31149
|
links: source_default.hex("#00D4FF"),
|
|
31153
|
-
white: source_default.white
|
|
31150
|
+
white: source_default.white,
|
|
31151
|
+
success: source_default.green,
|
|
31152
|
+
warning: source_default.yellow,
|
|
31153
|
+
error: source_default.red
|
|
31154
31154
|
},
|
|
31155
31155
|
styles: {
|
|
31156
31156
|
header: source_default.dim,
|
|
@@ -31461,237 +31461,6 @@ const logoutCommand = new Command("logout").description("Logout from current dev
|
|
|
31461
31461
|
await runCommand(logout, { requireAppConfig: false });
|
|
31462
31462
|
});
|
|
31463
31463
|
|
|
31464
|
-
//#endregion
|
|
31465
|
-
//#region src/core/generate/schema.ts
|
|
31466
|
-
/**
|
|
31467
|
-
* Schema for a full entity definition
|
|
31468
|
-
* Uses loose validation to allow JSON Schema flexibility
|
|
31469
|
-
*/
|
|
31470
|
-
const EntityDefinitionSchema = object({
|
|
31471
|
-
name: string().min(1, "Entity name cannot be empty"),
|
|
31472
|
-
type: literal("object").optional(),
|
|
31473
|
-
properties: record(string(), unknown()).optional(),
|
|
31474
|
-
required: array(string()).optional()
|
|
31475
|
-
}).passthrough();
|
|
31476
|
-
|
|
31477
|
-
//#endregion
|
|
31478
|
-
//#region src/core/generate/generator.ts
|
|
31479
|
-
const HEADER = `// Auto-generated by Base44 CLI - DO NOT EDIT
|
|
31480
|
-
// Regenerate with: base44 types
|
|
31481
|
-
`;
|
|
31482
|
-
/**
|
|
31483
|
-
* Convert a JSON Schema type to TypeScript type
|
|
31484
|
-
*/
|
|
31485
|
-
function fieldToTypeScript(field, required$1) {
|
|
31486
|
-
let tsType;
|
|
31487
|
-
if (field.enum && field.enum.length > 0) tsType = field.enum.map((v$1) => `'${v$1}'`).join(" | ");
|
|
31488
|
-
else switch (field.type) {
|
|
31489
|
-
case "string":
|
|
31490
|
-
tsType = "string";
|
|
31491
|
-
break;
|
|
31492
|
-
case "number":
|
|
31493
|
-
tsType = "number";
|
|
31494
|
-
break;
|
|
31495
|
-
case "boolean":
|
|
31496
|
-
tsType = "boolean";
|
|
31497
|
-
break;
|
|
31498
|
-
case "array":
|
|
31499
|
-
if (field.items) tsType = `${fieldToTypeScript(field.items, true)}[]`;
|
|
31500
|
-
else tsType = "unknown[]";
|
|
31501
|
-
break;
|
|
31502
|
-
case "object":
|
|
31503
|
-
if (field.properties) tsType = `{ ${Object.entries(field.properties).map(([name$1, prop]) => {
|
|
31504
|
-
const isRequired = field.required?.includes(name$1) ?? false;
|
|
31505
|
-
const propType = fieldToTypeScript(prop, isRequired);
|
|
31506
|
-
return `${name$1}${isRequired ? "" : "?"}: ${propType}`;
|
|
31507
|
-
}).join("; ")} }`;
|
|
31508
|
-
else tsType = "Record<string, unknown>";
|
|
31509
|
-
break;
|
|
31510
|
-
default: tsType = "unknown";
|
|
31511
|
-
}
|
|
31512
|
-
return tsType;
|
|
31513
|
-
}
|
|
31514
|
-
/**
|
|
31515
|
-
* Generate interface fields for an entity
|
|
31516
|
-
*/
|
|
31517
|
-
function generateInterfaceFields(entity, options = {}) {
|
|
31518
|
-
if (!entity.properties) return "";
|
|
31519
|
-
const requiredFields = new Set(entity.required ?? []);
|
|
31520
|
-
return Object.entries(entity.properties).map(([fieldName, field]) => {
|
|
31521
|
-
const isRequired = options.allOptional ? false : requiredFields.has(fieldName);
|
|
31522
|
-
const tsType = fieldToTypeScript(field, isRequired);
|
|
31523
|
-
const optional$1 = isRequired ? "" : "?";
|
|
31524
|
-
return `${field.description ? ` /** ${field.description} */\n` : ""} ${fieldName}${optional$1}: ${tsType};`;
|
|
31525
|
-
}).join("\n");
|
|
31526
|
-
}
|
|
31527
|
-
/**
|
|
31528
|
-
* Generate TypeScript interfaces for a single entity
|
|
31529
|
-
*/
|
|
31530
|
-
function generateEntityTypes(entity) {
|
|
31531
|
-
const name$1 = entity.name;
|
|
31532
|
-
return `
|
|
31533
|
-
/** ${name$1} entity */
|
|
31534
|
-
export interface ${name$1} extends BaseEntity {
|
|
31535
|
-
${generateInterfaceFields(entity)}
|
|
31536
|
-
}
|
|
31537
|
-
|
|
31538
|
-
/** Input for creating a ${name$1} */
|
|
31539
|
-
export interface ${name$1}CreateInput {
|
|
31540
|
-
${generateInterfaceFields(entity)}
|
|
31541
|
-
}
|
|
31542
|
-
|
|
31543
|
-
/** Input for updating a ${name$1} (all fields optional) */
|
|
31544
|
-
export interface ${name$1}UpdateInput {
|
|
31545
|
-
${generateInterfaceFields(entity, { allOptional: true })}
|
|
31546
|
-
}
|
|
31547
|
-
|
|
31548
|
-
/** Filter query for ${name$1} */
|
|
31549
|
-
export interface ${name$1}Filter {
|
|
31550
|
-
${generateInterfaceFields(entity, { allOptional: true })}
|
|
31551
|
-
}
|
|
31552
|
-
`;
|
|
31553
|
-
}
|
|
31554
|
-
/**
|
|
31555
|
-
* Generate the entities.ts file content
|
|
31556
|
-
*/
|
|
31557
|
-
function generateEntitiesFile(entities) {
|
|
31558
|
-
const baseEntity = `
|
|
31559
|
-
/** System fields present on all entities */
|
|
31560
|
-
export interface BaseEntity {
|
|
31561
|
-
id: string;
|
|
31562
|
-
created_date: string;
|
|
31563
|
-
updated_date: string;
|
|
31564
|
-
}
|
|
31565
|
-
`;
|
|
31566
|
-
const entityTypes = entities.map(generateEntityTypes).join("\n");
|
|
31567
|
-
const entityNames = entities.map((e$1) => `'${e$1.name}'`).join(" | ");
|
|
31568
|
-
const entityNamesType = entities.length > 0 ? `\n/** All entity names in this project */\nexport type EntityName = ${entityNames};\n` : "";
|
|
31569
|
-
return HEADER + baseEntity + entityTypes + entityNamesType;
|
|
31570
|
-
}
|
|
31571
|
-
/**
|
|
31572
|
-
* Generate the client.ts file content with typed SDK wrapper
|
|
31573
|
-
*/
|
|
31574
|
-
function generateClientFile(entities) {
|
|
31575
|
-
if (entities.length === 0) return HEADER + "\n// No entities found\nexport {};\n";
|
|
31576
|
-
return `${HEADER}
|
|
31577
|
-
import type {
|
|
31578
|
-
${entities.map((e$1) => `${e$1.name}, ${e$1.name}CreateInput, ${e$1.name}UpdateInput, ${e$1.name}Filter`).join(",\n ")}
|
|
31579
|
-
} from './entities.js';
|
|
31580
|
-
|
|
31581
|
-
/** Response for list/filter operations */
|
|
31582
|
-
export interface ListResponse<T> {
|
|
31583
|
-
items: T[];
|
|
31584
|
-
total: number;
|
|
31585
|
-
}
|
|
31586
|
-
|
|
31587
|
-
/** Real-time subscription event */
|
|
31588
|
-
export interface RealtimeEvent<T> {
|
|
31589
|
-
type: 'create' | 'update' | 'delete';
|
|
31590
|
-
data: T;
|
|
31591
|
-
id: string;
|
|
31592
|
-
timestamp: string;
|
|
31593
|
-
}
|
|
31594
|
-
|
|
31595
|
-
/** Entity handler with CRUD operations */
|
|
31596
|
-
export interface EntityHandler<T, TCreate, TUpdate, TFilter> {
|
|
31597
|
-
/** Get all records with optional pagination */
|
|
31598
|
-
list(sort?: string, limit?: number, skip?: number, fields?: (keyof T)[]): Promise<ListResponse<T>>;
|
|
31599
|
-
/** Get records matching filter criteria */
|
|
31600
|
-
filter(query: TFilter, sort?: string, limit?: number, skip?: number, fields?: (keyof T)[]): Promise<ListResponse<T>>;
|
|
31601
|
-
/** Get a single record by ID */
|
|
31602
|
-
get(id: string): Promise<T>;
|
|
31603
|
-
/** Create a new record */
|
|
31604
|
-
create(data: TCreate): Promise<T>;
|
|
31605
|
-
/** Update an existing record */
|
|
31606
|
-
update(id: string, data: TUpdate): Promise<T>;
|
|
31607
|
-
/** Delete a record */
|
|
31608
|
-
delete(id: string): Promise<void>;
|
|
31609
|
-
/** Delete multiple records matching filter */
|
|
31610
|
-
deleteMany(query: TFilter): Promise<void>;
|
|
31611
|
-
/** Create multiple records at once */
|
|
31612
|
-
bulkCreate(data: TCreate[]): Promise<T[]>;
|
|
31613
|
-
/** Subscribe to real-time updates */
|
|
31614
|
-
subscribe(callback: (event: RealtimeEvent<T>) => void): () => void;
|
|
31615
|
-
}
|
|
31616
|
-
|
|
31617
|
-
/** Typed entities interface for Base44 SDK */
|
|
31618
|
-
export interface TypedEntities {
|
|
31619
|
-
${entities.map((e$1) => ` ${e$1.name}: EntityHandler<${e$1.name}, ${e$1.name}CreateInput, ${e$1.name}UpdateInput, ${e$1.name}Filter>;`).join("\n")}
|
|
31620
|
-
}
|
|
31621
|
-
|
|
31622
|
-
/**
|
|
31623
|
-
* Typed Base44 client interface.
|
|
31624
|
-
* Use with the Base44 SDK for type-safe entity access.
|
|
31625
|
-
*
|
|
31626
|
-
* @example
|
|
31627
|
-
* import { createClient } from '@base44/sdk';
|
|
31628
|
-
* import type { TypedBase44Client } from './base44/client';
|
|
31629
|
-
*
|
|
31630
|
-
* const base44 = createClient({ appId: 'your-app-id' }) as TypedBase44Client;
|
|
31631
|
-
* const tasks = await base44.entities.Task.list();
|
|
31632
|
-
*/
|
|
31633
|
-
export interface TypedBase44Client {
|
|
31634
|
-
entities: TypedEntities;
|
|
31635
|
-
}
|
|
31636
|
-
`;
|
|
31637
|
-
}
|
|
31638
|
-
/**
|
|
31639
|
-
* Generate the index.ts barrel file
|
|
31640
|
-
*/
|
|
31641
|
-
function generateIndexFile() {
|
|
31642
|
-
return `${HEADER}
|
|
31643
|
-
export * from './entities.js';
|
|
31644
|
-
export * from './client.js';
|
|
31645
|
-
`;
|
|
31646
|
-
}
|
|
31647
|
-
|
|
31648
|
-
//#endregion
|
|
31649
|
-
//#region src/core/generate/types.ts
|
|
31650
|
-
/**
|
|
31651
|
-
* Parse entities into EntityDefinition format for type generation
|
|
31652
|
-
*/
|
|
31653
|
-
function parseEntities(entities) {
|
|
31654
|
-
return entities.map((entity) => {
|
|
31655
|
-
const result = EntityDefinitionSchema.safeParse(entity);
|
|
31656
|
-
if (result.success) return result.data;
|
|
31657
|
-
const entityName = entity.name ?? "unknown";
|
|
31658
|
-
console.warn(`Skipping invalid entity "${entityName}": ${result.error.issues.map((i$1) => `${i$1.path.join(".")}: ${i$1.message}`).join(", ")}`);
|
|
31659
|
-
return null;
|
|
31660
|
-
}).filter((e$1) => e$1 !== null);
|
|
31661
|
-
}
|
|
31662
|
-
/**
|
|
31663
|
-
* Generate TypeScript types from local entity schemas
|
|
31664
|
-
*/
|
|
31665
|
-
async function generateTypes(options = {}) {
|
|
31666
|
-
const { output = "src/base44", entitiesOnly = false } = options;
|
|
31667
|
-
const projectRoot = await findProjectRoot();
|
|
31668
|
-
if (!projectRoot) throw new Error("Project root not found. Please run this command from within a Base44 project.");
|
|
31669
|
-
const { entities } = await readProjectConfig(projectRoot.root);
|
|
31670
|
-
const parsedEntities = parseEntities(entities);
|
|
31671
|
-
const outputDir = join(projectRoot.root, output);
|
|
31672
|
-
await mkdir(outputDir, { recursive: true });
|
|
31673
|
-
const files = [];
|
|
31674
|
-
const entitiesContent = generateEntitiesFile(parsedEntities);
|
|
31675
|
-
const entitiesPath = join(outputDir, "entities.ts");
|
|
31676
|
-
await writeFile(entitiesPath, entitiesContent, "utf-8");
|
|
31677
|
-
files.push(entitiesPath);
|
|
31678
|
-
if (!entitiesOnly) {
|
|
31679
|
-
const clientContent = generateClientFile(parsedEntities);
|
|
31680
|
-
const clientPath = join(outputDir, "client.ts");
|
|
31681
|
-
await writeFile(clientPath, clientContent, "utf-8");
|
|
31682
|
-
files.push(clientPath);
|
|
31683
|
-
const indexContent = generateIndexFile();
|
|
31684
|
-
const indexPath = join(outputDir, "index.ts");
|
|
31685
|
-
await writeFile(indexPath, indexContent, "utf-8");
|
|
31686
|
-
files.push(indexPath);
|
|
31687
|
-
}
|
|
31688
|
-
return {
|
|
31689
|
-
entityCount: parsedEntities.length,
|
|
31690
|
-
files,
|
|
31691
|
-
outputDir
|
|
31692
|
-
};
|
|
31693
|
-
}
|
|
31694
|
-
|
|
31695
31464
|
//#endregion
|
|
31696
31465
|
//#region src/cli/commands/entities/push.ts
|
|
31697
31466
|
async function pushEntitiesAction() {
|
|
@@ -31737,35 +31506,6 @@ const functionsDeployCommand = new Command("functions").description("Manage proj
|
|
|
31737
31506
|
await runCommand(deployFunctionsAction, { requireAuth: true });
|
|
31738
31507
|
}));
|
|
31739
31508
|
|
|
31740
|
-
//#endregion
|
|
31741
|
-
//#region src/cli/commands/types/generate.ts
|
|
31742
|
-
async function generateTypesAction(options) {
|
|
31743
|
-
const result = await runTask("Generating TypeScript types", async () => {
|
|
31744
|
-
return await generateTypes({
|
|
31745
|
-
output: options.output,
|
|
31746
|
-
entitiesOnly: options.entitiesOnly
|
|
31747
|
-
});
|
|
31748
|
-
}, {
|
|
31749
|
-
successMessage: "Types generated successfully",
|
|
31750
|
-
errorMessage: "Failed to generate types"
|
|
31751
|
-
});
|
|
31752
|
-
if (result.entityCount === 0) {
|
|
31753
|
-
M.warn("No entities found in project");
|
|
31754
|
-
return { outroMessage: "No types generated" };
|
|
31755
|
-
}
|
|
31756
|
-
M.info(`Generated types for ${result.entityCount} entities`);
|
|
31757
|
-
M.info(`Output directory: ${result.outputDir}`);
|
|
31758
|
-
const fileList = result.files.map((f) => ` - ${relative(process.cwd(), f)}`).join("\n");
|
|
31759
|
-
M.info(`Files:\n${fileList}`);
|
|
31760
|
-
return { outroMessage: "Types generated successfully!" };
|
|
31761
|
-
}
|
|
31762
|
-
const typesGenerateCommand = new Command("types").description("Generate TypeScript types from entity schemas").option("-o, --output <dir>", "Output directory", "src/base44").option("--entities-only", "Only generate entity types, skip client types").action(async (options) => {
|
|
31763
|
-
await runCommand(() => generateTypesAction(options), {
|
|
31764
|
-
requireAuth: false,
|
|
31765
|
-
requireAppConfig: false
|
|
31766
|
-
});
|
|
31767
|
-
});
|
|
31768
|
-
|
|
31769
31509
|
//#endregion
|
|
31770
31510
|
//#region node_modules/is-plain-obj/index.js
|
|
31771
31511
|
function isPlainObject(value) {
|
|
@@ -31936,9 +31676,9 @@ const getSubprocessResult = ({ stdout: stdout$1 }) => {
|
|
|
31936
31676
|
//#region node_modules/execa/lib/utils/standard-stream.js
|
|
31937
31677
|
const isStandardStream = (stream) => STANDARD_STREAMS.includes(stream);
|
|
31938
31678
|
const STANDARD_STREAMS = [
|
|
31939
|
-
|
|
31940
|
-
|
|
31941
|
-
|
|
31679
|
+
y.stdin,
|
|
31680
|
+
y.stdout,
|
|
31681
|
+
y.stderr
|
|
31942
31682
|
];
|
|
31943
31683
|
const STANDARD_STREAMS_ALIASES = [
|
|
31944
31684
|
"stdin",
|
|
@@ -32063,9 +31803,9 @@ const NO_ESCAPE_REGEXP = /^[\w./-]+$/;
|
|
|
32063
31803
|
//#endregion
|
|
32064
31804
|
//#region node_modules/is-unicode-supported/index.js
|
|
32065
31805
|
function isUnicodeSupported() {
|
|
32066
|
-
const { env: env$1 } =
|
|
31806
|
+
const { env: env$1 } = y;
|
|
32067
31807
|
const { TERM, TERM_PROGRAM } = env$1;
|
|
32068
|
-
if (
|
|
31808
|
+
if (y.platform !== "win32") return TERM !== "linux";
|
|
32069
31809
|
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";
|
|
32070
31810
|
}
|
|
32071
31811
|
|
|
@@ -32992,7 +32732,7 @@ const TEN_MEGABYTES_IN_BYTES = 10 * 1024 * 1024;
|
|
|
32992
32732
|
|
|
32993
32733
|
//#endregion
|
|
32994
32734
|
//#region node_modules/npm-run-path/index.js
|
|
32995
|
-
const npmRunPath = ({ cwd =
|
|
32735
|
+
const npmRunPath = ({ cwd = y.cwd(), path: pathOption = y.env[pathKey()], preferLocal = true, execPath: execPath$1 = y.execPath, addExecPath = true } = {}) => {
|
|
32996
32736
|
const cwdPath = path.resolve(toPath(cwd));
|
|
32997
32737
|
const result = [];
|
|
32998
32738
|
const pathParts = pathOption.split(path.delimiter);
|
|
@@ -33010,7 +32750,7 @@ const applyExecPath = (result, pathParts, execPath$1, cwdPath) => {
|
|
|
33010
32750
|
const pathPart = path.resolve(cwdPath, toPath(execPath$1), "..");
|
|
33011
32751
|
if (!pathParts.includes(pathPart)) result.push(pathPart);
|
|
33012
32752
|
};
|
|
33013
|
-
const npmRunPathEnv = ({ env: env$1 =
|
|
32753
|
+
const npmRunPathEnv = ({ env: env$1 = y.env, ...options } = {}) => {
|
|
33014
32754
|
env$1 = { ...env$1 };
|
|
33015
32755
|
const pathName = pathKey({ env: env$1 });
|
|
33016
32756
|
options.path = env$1[pathName];
|
|
@@ -34145,7 +33885,7 @@ const normalizeCwd = (cwd = getDefaultCwd()) => {
|
|
|
34145
33885
|
};
|
|
34146
33886
|
const getDefaultCwd = () => {
|
|
34147
33887
|
try {
|
|
34148
|
-
return
|
|
33888
|
+
return y.cwd();
|
|
34149
33889
|
} catch (error) {
|
|
34150
33890
|
error.message = `The current directory does not exist.\n${error.message}`;
|
|
34151
33891
|
throw error;
|
|
@@ -34180,7 +33920,7 @@ const normalizeOptions = (filePath, rawArguments, rawOptions) => {
|
|
|
34180
33920
|
options.killSignal = normalizeKillSignal(options.killSignal);
|
|
34181
33921
|
options.forceKillAfterDelay = normalizeForceKillAfterDelay(options.forceKillAfterDelay);
|
|
34182
33922
|
options.lines = options.lines.map((lines, fdNumber) => lines && !BINARY_ENCODINGS.has(options.encoding) && options.buffer[fdNumber]);
|
|
34183
|
-
if (
|
|
33923
|
+
if (y.platform === "win32" && path.basename(file, ".exe") === "cmd") commandArguments.unshift("/q");
|
|
34184
33924
|
return {
|
|
34185
33925
|
file,
|
|
34186
33926
|
commandArguments,
|
|
@@ -34207,7 +33947,7 @@ const addDefaultOptions = ({ extendEnv = true, preferLocal = false, cwd, localDi
|
|
|
34207
33947
|
});
|
|
34208
33948
|
const getEnv = ({ env: envOption, extendEnv, preferLocal, node, localDirectory, nodePath }) => {
|
|
34209
33949
|
const env$1 = extendEnv ? {
|
|
34210
|
-
...
|
|
33950
|
+
...y.env,
|
|
34211
33951
|
...envOption
|
|
34212
33952
|
} : envOption;
|
|
34213
33953
|
if (preferLocal || node) return npmRunPathEnv({
|
|
@@ -35207,12 +34947,12 @@ const guessStreamDirection = {
|
|
|
35207
34947
|
}
|
|
35208
34948
|
};
|
|
35209
34949
|
const getStandardStreamDirection = (value) => {
|
|
35210
|
-
if ([0,
|
|
34950
|
+
if ([0, y.stdin].includes(value)) return "input";
|
|
35211
34951
|
if ([
|
|
35212
34952
|
1,
|
|
35213
34953
|
2,
|
|
35214
|
-
|
|
35215
|
-
|
|
34954
|
+
y.stdout,
|
|
34955
|
+
y.stderr
|
|
35216
34956
|
].includes(value)) return "output";
|
|
35217
34957
|
};
|
|
35218
34958
|
const DEFAULT_DIRECTION = "output";
|
|
@@ -36276,9 +36016,9 @@ const addIpcMethods = (subprocess, { ipc }) => {
|
|
|
36276
36016
|
Object.assign(subprocess, getIpcMethods(subprocess, false, ipc));
|
|
36277
36017
|
};
|
|
36278
36018
|
const getIpcExport = () => {
|
|
36279
|
-
const anyProcess =
|
|
36019
|
+
const anyProcess = y;
|
|
36280
36020
|
const isSubprocess = true;
|
|
36281
|
-
const ipc =
|
|
36021
|
+
const ipc = y.channel !== void 0;
|
|
36282
36022
|
return {
|
|
36283
36023
|
...getIpcMethods(anyProcess, isSubprocess, ipc),
|
|
36284
36024
|
getCancelSignal: getCancelSignal$1.bind(void 0, {
|
|
@@ -36520,7 +36260,7 @@ if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SI
|
|
|
36520
36260
|
|
|
36521
36261
|
//#endregion
|
|
36522
36262
|
//#region node_modules/signal-exit/dist/mjs/index.js
|
|
36523
|
-
const processOk = (process$
|
|
36263
|
+
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";
|
|
36524
36264
|
const kExitEmitter = Symbol.for("signal-exit emitter");
|
|
36525
36265
|
const global$1 = globalThis;
|
|
36526
36266
|
const ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
@@ -36588,7 +36328,7 @@ var SignalExitFallback = class extends SignalExitBase {
|
|
|
36588
36328
|
};
|
|
36589
36329
|
var SignalExit = class extends SignalExitBase {
|
|
36590
36330
|
/* c8 ignore start */
|
|
36591
|
-
#hupSig = process$
|
|
36331
|
+
#hupSig = process$1.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
36592
36332
|
/* c8 ignore stop */
|
|
36593
36333
|
#emitter = new Emitter();
|
|
36594
36334
|
#process;
|
|
@@ -36596,15 +36336,15 @@ var SignalExit = class extends SignalExitBase {
|
|
|
36596
36336
|
#originalProcessReallyExit;
|
|
36597
36337
|
#sigListeners = {};
|
|
36598
36338
|
#loaded = false;
|
|
36599
|
-
constructor(process$
|
|
36339
|
+
constructor(process$4) {
|
|
36600
36340
|
super();
|
|
36601
|
-
this.#process = process$
|
|
36341
|
+
this.#process = process$4;
|
|
36602
36342
|
this.#sigListeners = {};
|
|
36603
36343
|
for (const sig of signals) this.#sigListeners[sig] = () => {
|
|
36604
36344
|
const listeners = this.#process.listeners(sig);
|
|
36605
36345
|
let { count: count$1 } = this.#emitter;
|
|
36606
36346
|
/* c8 ignore start */
|
|
36607
|
-
const p$1 = process$
|
|
36347
|
+
const p$1 = process$4;
|
|
36608
36348
|
if (typeof p$1.__signal_exit_emitter__ === "object" && typeof p$1.__signal_exit_emitter__.count === "number") count$1 += p$1.__signal_exit_emitter__.count;
|
|
36609
36349
|
/* c8 ignore stop */
|
|
36610
36350
|
if (listeners.length === count$1) {
|
|
@@ -36612,11 +36352,11 @@ var SignalExit = class extends SignalExitBase {
|
|
|
36612
36352
|
const ret = this.#emitter.emit("exit", null, sig);
|
|
36613
36353
|
/* c8 ignore start */
|
|
36614
36354
|
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
36615
|
-
if (!ret) process$
|
|
36355
|
+
if (!ret) process$4.kill(process$4.pid, s);
|
|
36616
36356
|
}
|
|
36617
36357
|
};
|
|
36618
|
-
this.#originalProcessReallyExit = process$
|
|
36619
|
-
this.#originalProcessEmit = process$
|
|
36358
|
+
this.#originalProcessReallyExit = process$4.reallyExit;
|
|
36359
|
+
this.#originalProcessEmit = process$4.emit;
|
|
36620
36360
|
}
|
|
36621
36361
|
onExit(cb, opts) {
|
|
36622
36362
|
/* c8 ignore start */
|
|
@@ -36683,8 +36423,8 @@ var SignalExit = class extends SignalExitBase {
|
|
|
36683
36423
|
} else return og.call(this.#process, ev, ...args);
|
|
36684
36424
|
}
|
|
36685
36425
|
};
|
|
36686
|
-
const process$
|
|
36687
|
-
const { onExit, load, unload } = signalExitWrap(processOk(process$
|
|
36426
|
+
const process$1 = globalThis.process;
|
|
36427
|
+
const { onExit, load, unload } = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
|
|
36688
36428
|
|
|
36689
36429
|
//#endregion
|
|
36690
36430
|
//#region node_modules/execa/lib/terminate/cleanup.js
|
|
@@ -38621,7 +38361,7 @@ function isInsideContainer() {
|
|
|
38621
38361
|
//#endregion
|
|
38622
38362
|
//#region node_modules/is-wsl/index.js
|
|
38623
38363
|
const isWsl = () => {
|
|
38624
|
-
if (
|
|
38364
|
+
if (y.platform !== "linux") return false;
|
|
38625
38365
|
if (os.release().toLowerCase().includes("microsoft")) {
|
|
38626
38366
|
if (isInsideContainer()) return false;
|
|
38627
38367
|
return true;
|
|
@@ -38632,12 +38372,12 @@ const isWsl = () => {
|
|
|
38632
38372
|
return false;
|
|
38633
38373
|
}
|
|
38634
38374
|
};
|
|
38635
|
-
var is_wsl_default =
|
|
38375
|
+
var is_wsl_default = y.env.__IS_WSL_TEST__ ? isWsl : isWsl();
|
|
38636
38376
|
|
|
38637
38377
|
//#endregion
|
|
38638
38378
|
//#region node_modules/powershell-utils/index.js
|
|
38639
38379
|
const execFile$2 = promisify(childProcess.execFile);
|
|
38640
|
-
const powerShellPath$1 = () => `${
|
|
38380
|
+
const powerShellPath$1 = () => `${y.env.SYSTEMROOT || y.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
|
|
38641
38381
|
const executePowerShell = async (command, options = {}) => {
|
|
38642
38382
|
const { powerShellPath: psPath, ...execFileOptions } = options;
|
|
38643
38383
|
const encodedCommand = executePowerShell.encodeCommand(command);
|
|
@@ -38748,7 +38488,7 @@ function defineLazyProperty(object$1, propertyName, valueGetter) {
|
|
|
38748
38488
|
//#region node_modules/default-browser-id/index.js
|
|
38749
38489
|
const execFileAsync$3 = promisify(execFile);
|
|
38750
38490
|
async function defaultBrowserId() {
|
|
38751
|
-
if (
|
|
38491
|
+
if (y.platform !== "darwin") throw new Error("macOS only");
|
|
38752
38492
|
const { stdout: stdout$1 } = await execFileAsync$3("defaults", [
|
|
38753
38493
|
"read",
|
|
38754
38494
|
"com.apple.LaunchServices/com.apple.launchservices.secure",
|
|
@@ -38763,7 +38503,7 @@ async function defaultBrowserId() {
|
|
|
38763
38503
|
//#region node_modules/run-applescript/index.js
|
|
38764
38504
|
const execFileAsync$2 = promisify(execFile);
|
|
38765
38505
|
async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
|
|
38766
|
-
if (
|
|
38506
|
+
if (y.platform !== "darwin") throw new Error("macOS only");
|
|
38767
38507
|
const outputArguments = humanReadableOutput ? [] : ["-ss"];
|
|
38768
38508
|
const execOptions = {};
|
|
38769
38509
|
if (signal) execOptions.signal = signal;
|
|
@@ -38872,14 +38612,14 @@ async function defaultBrowser$1(_execFileAsync = execFileAsync$1) {
|
|
|
38872
38612
|
const execFileAsync = promisify(execFile);
|
|
38873
38613
|
const titleize = (string$2) => string$2.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x$2) => x$2.toUpperCase());
|
|
38874
38614
|
async function defaultBrowser() {
|
|
38875
|
-
if (
|
|
38615
|
+
if (y.platform === "darwin") {
|
|
38876
38616
|
const id = await defaultBrowserId();
|
|
38877
38617
|
return {
|
|
38878
38618
|
name: await bundleName(id),
|
|
38879
38619
|
id
|
|
38880
38620
|
};
|
|
38881
38621
|
}
|
|
38882
|
-
if (
|
|
38622
|
+
if (y.platform === "linux") {
|
|
38883
38623
|
const { stdout: stdout$1 } = await execFileAsync("xdg-mime", [
|
|
38884
38624
|
"query",
|
|
38885
38625
|
"default",
|
|
@@ -38891,13 +38631,13 @@ async function defaultBrowser() {
|
|
|
38891
38631
|
id
|
|
38892
38632
|
};
|
|
38893
38633
|
}
|
|
38894
|
-
if (
|
|
38634
|
+
if (y.platform === "win32") return defaultBrowser$1();
|
|
38895
38635
|
throw new Error("Only macOS, Linux, and Windows are supported");
|
|
38896
38636
|
}
|
|
38897
38637
|
|
|
38898
38638
|
//#endregion
|
|
38899
38639
|
//#region node_modules/is-in-ssh/index.js
|
|
38900
|
-
const isInSsh = Boolean(
|
|
38640
|
+
const isInSsh = Boolean(y.env.SSH_CONNECTION || y.env.SSH_CLIENT || y.env.SSH_TTY);
|
|
38901
38641
|
var is_in_ssh_default = isInSsh;
|
|
38902
38642
|
|
|
38903
38643
|
//#endregion
|
|
@@ -38905,7 +38645,7 @@ var is_in_ssh_default = isInSsh;
|
|
|
38905
38645
|
const fallbackAttemptSymbol = Symbol("fallbackAttempt");
|
|
38906
38646
|
const __dirname = import.meta.url ? path.dirname(fileURLToPath(import.meta.url)) : "";
|
|
38907
38647
|
const localXdgOpenPath = path.join(__dirname, "xdg-open");
|
|
38908
|
-
const { platform: platform$1, arch } =
|
|
38648
|
+
const { platform: platform$1, arch } = y;
|
|
38909
38649
|
const tryEachApp = async (apps$1, opener) => {
|
|
38910
38650
|
if (apps$1.length === 0) return;
|
|
38911
38651
|
const errors = [];
|
|
@@ -39018,7 +38758,7 @@ const baseOpen = async (options) => {
|
|
|
39018
38758
|
await fs$1.access(localXdgOpenPath, constants$1.X_OK);
|
|
39019
38759
|
exeLocalXdgOpen = true;
|
|
39020
38760
|
} catch {}
|
|
39021
|
-
command =
|
|
38761
|
+
command = y.versions.electron ?? (platform$1 === "android" || isBundled || !exeLocalXdgOpen) ? "xdg-open" : localXdgOpenPath;
|
|
39022
38762
|
}
|
|
39023
38763
|
if (appArguments.length > 0) cliArguments.push(...appArguments);
|
|
39024
38764
|
if (!options.wait) {
|
|
@@ -39244,6 +38984,664 @@ const siteDeployCommand = new Command("site").description("Manage site deploymen
|
|
|
39244
38984
|
await runCommand(() => deployAction(options), { requireAuth: true });
|
|
39245
38985
|
}));
|
|
39246
38986
|
|
|
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
|
+
* OAuth polling configuration
|
|
39134
|
+
*/
|
|
39135
|
+
const OAUTH_POLL_INTERVAL_MS = 2e3;
|
|
39136
|
+
const OAUTH_POLL_TIMEOUT_MS = 300 * 1e3;
|
|
39137
|
+
/**
|
|
39138
|
+
* Supported OAuth connector integrations.
|
|
39139
|
+
* Based on apper/backend/app/external_auth/models/constants.py
|
|
39140
|
+
*/
|
|
39141
|
+
const SUPPORTED_INTEGRATIONS = [
|
|
39142
|
+
"googlecalendar",
|
|
39143
|
+
"googledrive",
|
|
39144
|
+
"gmail",
|
|
39145
|
+
"googlesheets",
|
|
39146
|
+
"googledocs",
|
|
39147
|
+
"googleslides",
|
|
39148
|
+
"slack",
|
|
39149
|
+
"notion",
|
|
39150
|
+
"salesforce",
|
|
39151
|
+
"hubspot",
|
|
39152
|
+
"linkedin",
|
|
39153
|
+
"tiktok"
|
|
39154
|
+
];
|
|
39155
|
+
/**
|
|
39156
|
+
* Display names for integrations (for CLI output)
|
|
39157
|
+
*/
|
|
39158
|
+
const INTEGRATION_DISPLAY_NAMES = {
|
|
39159
|
+
googlecalendar: "Google Calendar",
|
|
39160
|
+
googledrive: "Google Drive",
|
|
39161
|
+
gmail: "Gmail",
|
|
39162
|
+
googlesheets: "Google Sheets",
|
|
39163
|
+
googledocs: "Google Docs",
|
|
39164
|
+
googleslides: "Google Slides",
|
|
39165
|
+
slack: "Slack",
|
|
39166
|
+
notion: "Notion",
|
|
39167
|
+
salesforce: "Salesforce",
|
|
39168
|
+
hubspot: "HubSpot",
|
|
39169
|
+
linkedin: "LinkedIn",
|
|
39170
|
+
tiktok: "TikTok"
|
|
39171
|
+
};
|
|
39172
|
+
function isValidIntegration(type) {
|
|
39173
|
+
return SUPPORTED_INTEGRATIONS.includes(type);
|
|
39174
|
+
}
|
|
39175
|
+
function getIntegrationDisplayName(type) {
|
|
39176
|
+
if (isValidIntegration(type)) return INTEGRATION_DISPLAY_NAMES[type];
|
|
39177
|
+
return type;
|
|
39178
|
+
}
|
|
39179
|
+
|
|
39180
|
+
//#endregion
|
|
39181
|
+
//#region src/core/connectors/config.ts
|
|
39182
|
+
/**
|
|
39183
|
+
* Read all connectors from the project config file
|
|
39184
|
+
*/
|
|
39185
|
+
async function readLocalConnectors(projectRoot) {
|
|
39186
|
+
const found = await findProjectRoot(projectRoot);
|
|
39187
|
+
if (!found) return [];
|
|
39188
|
+
const connectorsData = (await readJsonFile(found.configPath)).connectors;
|
|
39189
|
+
if (!connectorsData) return [];
|
|
39190
|
+
const connectors = [];
|
|
39191
|
+
for (const [type, config$1] of Object.entries(connectorsData)) {
|
|
39192
|
+
if (!isValidIntegration(type)) throw new Error(`Unknown connector type: ${type}`);
|
|
39193
|
+
connectors.push({
|
|
39194
|
+
type,
|
|
39195
|
+
scopes: config$1.scopes
|
|
39196
|
+
});
|
|
39197
|
+
}
|
|
39198
|
+
return connectors;
|
|
39199
|
+
}
|
|
39200
|
+
/**
|
|
39201
|
+
* Write connectors to the project config file
|
|
39202
|
+
*/
|
|
39203
|
+
async function writeLocalConnectors(connectors, projectRoot) {
|
|
39204
|
+
const found = await findProjectRoot(projectRoot);
|
|
39205
|
+
if (!found) throw new Error("Project config not found. Run this command from a Base44 project directory.");
|
|
39206
|
+
const existingConfig = await readJsonFile(found.configPath);
|
|
39207
|
+
const connectorsData = {};
|
|
39208
|
+
for (const connector of connectors) connectorsData[connector.type] = { ...connector.scopes && { scopes: connector.scopes } };
|
|
39209
|
+
const updatedConfig = {
|
|
39210
|
+
...existingConfig,
|
|
39211
|
+
connectors: Object.keys(connectorsData).length > 0 ? connectorsData : void 0
|
|
39212
|
+
};
|
|
39213
|
+
if (!updatedConfig.connectors) delete updatedConfig.connectors;
|
|
39214
|
+
await writeJsonFile(found.configPath, updatedConfig);
|
|
39215
|
+
return found.configPath;
|
|
39216
|
+
}
|
|
39217
|
+
/**
|
|
39218
|
+
* Add a connector to the project config file
|
|
39219
|
+
*/
|
|
39220
|
+
async function addLocalConnector(type, scopes, projectRoot) {
|
|
39221
|
+
const connectors = await readLocalConnectors(projectRoot);
|
|
39222
|
+
const existing = connectors.find((c$1) => c$1.type === type);
|
|
39223
|
+
if (existing) {
|
|
39224
|
+
if (scopes) existing.scopes = scopes;
|
|
39225
|
+
} else connectors.push({
|
|
39226
|
+
type,
|
|
39227
|
+
scopes
|
|
39228
|
+
});
|
|
39229
|
+
return await writeLocalConnectors(connectors, projectRoot);
|
|
39230
|
+
}
|
|
39231
|
+
/**
|
|
39232
|
+
* Remove a connector from the project config file
|
|
39233
|
+
*/
|
|
39234
|
+
async function removeLocalConnector(type, projectRoot) {
|
|
39235
|
+
const connectors = await readLocalConnectors(projectRoot);
|
|
39236
|
+
const filtered = connectors.filter((c$1) => c$1.type !== type);
|
|
39237
|
+
if (filtered.length === connectors.length) return null;
|
|
39238
|
+
return await writeLocalConnectors(filtered, projectRoot);
|
|
39239
|
+
}
|
|
39240
|
+
|
|
39241
|
+
//#endregion
|
|
39242
|
+
//#region src/cli/commands/connectors/add.ts
|
|
39243
|
+
async function promptForIntegrationType() {
|
|
39244
|
+
const selected = await ve({
|
|
39245
|
+
message: "Select an integration to connect:",
|
|
39246
|
+
options: SUPPORTED_INTEGRATIONS.map((type) => ({
|
|
39247
|
+
value: type,
|
|
39248
|
+
label: getIntegrationDisplayName(type)
|
|
39249
|
+
}))
|
|
39250
|
+
});
|
|
39251
|
+
if (pD(selected)) return null;
|
|
39252
|
+
return selected;
|
|
39253
|
+
}
|
|
39254
|
+
async function waitForOAuthCompletion(integrationType, connectionId) {
|
|
39255
|
+
let accountEmail;
|
|
39256
|
+
let error;
|
|
39257
|
+
try {
|
|
39258
|
+
await runTask("Waiting for authorization...", async (updateMessage) => {
|
|
39259
|
+
await pWaitFor(async () => {
|
|
39260
|
+
const status = await checkOAuthStatus(integrationType, connectionId);
|
|
39261
|
+
if (status.status === "ACTIVE") {
|
|
39262
|
+
accountEmail = status.accountEmail ?? void 0;
|
|
39263
|
+
return true;
|
|
39264
|
+
}
|
|
39265
|
+
if (status.status === "FAILED") {
|
|
39266
|
+
error = status.error || "Authorization failed";
|
|
39267
|
+
throw new Error(error);
|
|
39268
|
+
}
|
|
39269
|
+
updateMessage("Waiting for authorization in browser...");
|
|
39270
|
+
return false;
|
|
39271
|
+
}, {
|
|
39272
|
+
interval: OAUTH_POLL_INTERVAL_MS,
|
|
39273
|
+
timeout: OAUTH_POLL_TIMEOUT_MS
|
|
39274
|
+
});
|
|
39275
|
+
}, {
|
|
39276
|
+
successMessage: "Authorization completed!",
|
|
39277
|
+
errorMessage: "Authorization failed"
|
|
39278
|
+
});
|
|
39279
|
+
return {
|
|
39280
|
+
success: true,
|
|
39281
|
+
accountEmail
|
|
39282
|
+
};
|
|
39283
|
+
} catch (err) {
|
|
39284
|
+
if (err instanceof Error && err.message.includes("timed out")) return {
|
|
39285
|
+
success: false,
|
|
39286
|
+
error: "Authorization timed out. Please try again."
|
|
39287
|
+
};
|
|
39288
|
+
return {
|
|
39289
|
+
success: false,
|
|
39290
|
+
error: error || (err instanceof Error ? err.message : "Unknown error")
|
|
39291
|
+
};
|
|
39292
|
+
}
|
|
39293
|
+
}
|
|
39294
|
+
async function addConnector(integrationType) {
|
|
39295
|
+
let selectedType;
|
|
39296
|
+
if (!integrationType) {
|
|
39297
|
+
const prompted = await promptForIntegrationType();
|
|
39298
|
+
if (!prompted) return { outroMessage: "Cancelled" };
|
|
39299
|
+
selectedType = prompted;
|
|
39300
|
+
} else {
|
|
39301
|
+
if (!isValidIntegration(integrationType)) {
|
|
39302
|
+
const supportedList = SUPPORTED_INTEGRATIONS.join(", ");
|
|
39303
|
+
throw new Error(`Unsupported connector: ${integrationType}\nSupported connectors: ${supportedList}`);
|
|
39304
|
+
}
|
|
39305
|
+
selectedType = integrationType;
|
|
39306
|
+
}
|
|
39307
|
+
const displayName = getIntegrationDisplayName(selectedType);
|
|
39308
|
+
const initiateResponse = await runTask(`Initiating ${displayName} connection...`, async () => {
|
|
39309
|
+
return await initiateOAuth(selectedType);
|
|
39310
|
+
}, {
|
|
39311
|
+
successMessage: `${displayName} OAuth initiated`,
|
|
39312
|
+
errorMessage: `Failed to initiate ${displayName} connection`
|
|
39313
|
+
});
|
|
39314
|
+
if (initiateResponse.already_authorized) {
|
|
39315
|
+
await addLocalConnector(selectedType);
|
|
39316
|
+
return { outroMessage: `Already connected to ${theme.styles.bold(displayName)} (added to config)` };
|
|
39317
|
+
}
|
|
39318
|
+
if (initiateResponse.error === "different_user" && initiateResponse.other_user_email) throw new Error(`This app is already connected to ${displayName} by ${initiateResponse.other_user_email}`);
|
|
39319
|
+
if (!initiateResponse.redirect_url || !initiateResponse.connection_id) throw new Error("Invalid response from server: missing redirect URL or connection ID");
|
|
39320
|
+
M.info(`Please authorize ${displayName} at:\n${theme.colors.links(initiateResponse.redirect_url)}`);
|
|
39321
|
+
const result = await waitForOAuthCompletion(selectedType, initiateResponse.connection_id);
|
|
39322
|
+
if (!result.success) throw new Error(result.error || "Authorization failed");
|
|
39323
|
+
await addLocalConnector(selectedType);
|
|
39324
|
+
const accountInfo = result.accountEmail ? ` as ${theme.styles.bold(result.accountEmail)}` : "";
|
|
39325
|
+
return { outroMessage: `Successfully connected to ${theme.styles.bold(displayName)}${accountInfo}` };
|
|
39326
|
+
}
|
|
39327
|
+
const connectorsAddCommand = new Command("add").argument("[type]", "Integration type (e.g., slack, notion, googlecalendar)").description("Connect an OAuth integration").action(async (type) => {
|
|
39328
|
+
await runCommand(() => addConnector(type), {
|
|
39329
|
+
requireAuth: true,
|
|
39330
|
+
requireAppConfig: true
|
|
39331
|
+
});
|
|
39332
|
+
});
|
|
39333
|
+
|
|
39334
|
+
//#endregion
|
|
39335
|
+
//#region src/cli/commands/connectors/list.ts
|
|
39336
|
+
function mergeConnectors(local, backend) {
|
|
39337
|
+
const merged = /* @__PURE__ */ new Map();
|
|
39338
|
+
for (const connector of local) merged.set(connector.type, {
|
|
39339
|
+
type: connector.type,
|
|
39340
|
+
displayName: getIntegrationDisplayName(connector.type),
|
|
39341
|
+
inLocal: true,
|
|
39342
|
+
inBackend: false
|
|
39343
|
+
});
|
|
39344
|
+
for (const connector of backend) {
|
|
39345
|
+
const existing = merged.get(connector.integrationType);
|
|
39346
|
+
const accountEmail = (connector.accountInfo?.email || connector.accountInfo?.name) ?? void 0;
|
|
39347
|
+
if (existing) {
|
|
39348
|
+
existing.inBackend = true;
|
|
39349
|
+
existing.status = connector.status;
|
|
39350
|
+
existing.accountEmail = accountEmail;
|
|
39351
|
+
} else merged.set(connector.integrationType, {
|
|
39352
|
+
type: connector.integrationType,
|
|
39353
|
+
displayName: getIntegrationDisplayName(connector.integrationType),
|
|
39354
|
+
inLocal: false,
|
|
39355
|
+
inBackend: true,
|
|
39356
|
+
status: connector.status,
|
|
39357
|
+
accountEmail
|
|
39358
|
+
});
|
|
39359
|
+
}
|
|
39360
|
+
return Array.from(merged.values());
|
|
39361
|
+
}
|
|
39362
|
+
function formatConnectorLine(connector) {
|
|
39363
|
+
const { displayName, inLocal, inBackend, status, accountEmail } = connector;
|
|
39364
|
+
const isConnected$1 = inBackend && status?.toLowerCase() === "active";
|
|
39365
|
+
const isPending = inLocal && !inBackend;
|
|
39366
|
+
const isOrphaned = inBackend && !inLocal;
|
|
39367
|
+
let bullet;
|
|
39368
|
+
let statusText = "";
|
|
39369
|
+
if (isConnected$1) {
|
|
39370
|
+
bullet = theme.colors.success("●");
|
|
39371
|
+
if (accountEmail) statusText = ` - ${accountEmail}`;
|
|
39372
|
+
} else if (isPending) {
|
|
39373
|
+
bullet = theme.colors.warning("○");
|
|
39374
|
+
statusText = theme.styles.dim(" (not connected)");
|
|
39375
|
+
} else if (isOrphaned) {
|
|
39376
|
+
bullet = theme.colors.error("○");
|
|
39377
|
+
statusText = theme.styles.dim(" (not in local config)");
|
|
39378
|
+
} else {
|
|
39379
|
+
bullet = theme.colors.error("○");
|
|
39380
|
+
statusText = theme.styles.dim(` (${status || "disconnected"})`);
|
|
39381
|
+
}
|
|
39382
|
+
return `${bullet} ${displayName}${statusText}`;
|
|
39383
|
+
}
|
|
39384
|
+
async function listConnectorsCommand() {
|
|
39385
|
+
const [localConnectors, backendConnectors] = await runTask("Fetching connectors...", async () => {
|
|
39386
|
+
const [local, backend] = await Promise.all([readLocalConnectors().catch(() => []), listConnectors().catch(() => [])]);
|
|
39387
|
+
return [local, backend];
|
|
39388
|
+
}, {
|
|
39389
|
+
successMessage: "Connectors loaded",
|
|
39390
|
+
errorMessage: "Failed to fetch connectors"
|
|
39391
|
+
});
|
|
39392
|
+
const merged = mergeConnectors(localConnectors, backendConnectors);
|
|
39393
|
+
if (merged.length === 0) {
|
|
39394
|
+
M.info("No connectors configured for this app.");
|
|
39395
|
+
M.info(`Run ${theme.styles.bold("base44 connectors add")} to connect an integration.`);
|
|
39396
|
+
return { outroMessage: "" };
|
|
39397
|
+
}
|
|
39398
|
+
console.log();
|
|
39399
|
+
for (const connector of merged) console.log(formatConnectorLine(connector));
|
|
39400
|
+
console.log();
|
|
39401
|
+
const connected = merged.filter((c$1) => c$1.inBackend && c$1.status?.toLowerCase() === "active").length;
|
|
39402
|
+
const pending = merged.filter((c$1) => c$1.inLocal && !c$1.inBackend).length;
|
|
39403
|
+
let summary = `${connected} connected`;
|
|
39404
|
+
if (pending > 0) {
|
|
39405
|
+
summary += `, ${pending} pending`;
|
|
39406
|
+
M.info(`Run ${theme.styles.bold("base44 connectors push")} to connect pending integrations.`);
|
|
39407
|
+
}
|
|
39408
|
+
return { outroMessage: summary };
|
|
39409
|
+
}
|
|
39410
|
+
const connectorsListCommand = new Command("list").description("List all connected OAuth integrations").action(async () => {
|
|
39411
|
+
await runCommand(listConnectorsCommand, {
|
|
39412
|
+
requireAuth: true,
|
|
39413
|
+
requireAppConfig: true
|
|
39414
|
+
});
|
|
39415
|
+
});
|
|
39416
|
+
|
|
39417
|
+
//#endregion
|
|
39418
|
+
//#region src/cli/commands/connectors/push.ts
|
|
39419
|
+
function findPendingConnectors(local, backend) {
|
|
39420
|
+
const connectedTypes = new Set(backend.filter((c$1) => c$1.status.toLowerCase() === "active").map((c$1) => c$1.integrationType));
|
|
39421
|
+
return local.filter((c$1) => !connectedTypes.has(c$1.type)).map((c$1) => ({
|
|
39422
|
+
type: c$1.type,
|
|
39423
|
+
displayName: getIntegrationDisplayName(c$1.type),
|
|
39424
|
+
scopes: c$1.scopes
|
|
39425
|
+
}));
|
|
39426
|
+
}
|
|
39427
|
+
function findOrphanedConnectors(local, backend) {
|
|
39428
|
+
const localTypes = new Set(local.map((c$1) => c$1.type));
|
|
39429
|
+
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) => ({
|
|
39430
|
+
type: c$1.integrationType,
|
|
39431
|
+
displayName: getIntegrationDisplayName(c$1.integrationType),
|
|
39432
|
+
accountEmail: (c$1.accountInfo?.email || c$1.accountInfo?.name) ?? void 0
|
|
39433
|
+
}));
|
|
39434
|
+
}
|
|
39435
|
+
async function connectSingleConnector(connector) {
|
|
39436
|
+
const { type, displayName, scopes } = connector;
|
|
39437
|
+
const initiateResponse = await initiateOAuth(type, scopes || null);
|
|
39438
|
+
if (initiateResponse.already_authorized) return { success: true };
|
|
39439
|
+
if (initiateResponse.error === "different_user") return {
|
|
39440
|
+
success: false,
|
|
39441
|
+
error: `Already connected by ${initiateResponse.other_user_email}`
|
|
39442
|
+
};
|
|
39443
|
+
if (!initiateResponse.redirect_url || !initiateResponse.connection_id) return {
|
|
39444
|
+
success: false,
|
|
39445
|
+
error: "Invalid response from server"
|
|
39446
|
+
};
|
|
39447
|
+
M.info(`Please authorize ${displayName} at:\n${theme.colors.links(initiateResponse.redirect_url)}`);
|
|
39448
|
+
let accountEmail;
|
|
39449
|
+
try {
|
|
39450
|
+
await runTask("Waiting for authorization...", async () => {
|
|
39451
|
+
await pWaitFor(async () => {
|
|
39452
|
+
const status = await checkOAuthStatus(type, initiateResponse.connection_id);
|
|
39453
|
+
if (status.status === "ACTIVE") {
|
|
39454
|
+
accountEmail = status.accountEmail ?? void 0;
|
|
39455
|
+
return true;
|
|
39456
|
+
}
|
|
39457
|
+
if (status.status === "FAILED") throw new Error(status.error || "Authorization failed");
|
|
39458
|
+
return false;
|
|
39459
|
+
}, {
|
|
39460
|
+
interval: OAUTH_POLL_INTERVAL_MS,
|
|
39461
|
+
timeout: OAUTH_POLL_TIMEOUT_MS
|
|
39462
|
+
});
|
|
39463
|
+
}, {
|
|
39464
|
+
successMessage: "Authorization completed!",
|
|
39465
|
+
errorMessage: "Authorization failed"
|
|
39466
|
+
});
|
|
39467
|
+
return {
|
|
39468
|
+
success: true,
|
|
39469
|
+
accountEmail
|
|
39470
|
+
};
|
|
39471
|
+
} catch (err) {
|
|
39472
|
+
if (err instanceof Error && err.message.includes("timed out")) return {
|
|
39473
|
+
success: false,
|
|
39474
|
+
error: "Authorization timed out. Please try again."
|
|
39475
|
+
};
|
|
39476
|
+
return {
|
|
39477
|
+
success: false,
|
|
39478
|
+
error: err instanceof Error ? err.message : "Unknown error"
|
|
39479
|
+
};
|
|
39480
|
+
}
|
|
39481
|
+
}
|
|
39482
|
+
async function pushConnectorsCommand() {
|
|
39483
|
+
const [localConnectors, backendConnectors] = await runTask("Checking connector status...", async () => {
|
|
39484
|
+
const [local, backend] = await Promise.all([readLocalConnectors(), listConnectors().catch(() => [])]);
|
|
39485
|
+
return [local, backend];
|
|
39486
|
+
}, {
|
|
39487
|
+
successMessage: "Status checked",
|
|
39488
|
+
errorMessage: "Failed to check status"
|
|
39489
|
+
});
|
|
39490
|
+
const pending = findPendingConnectors(localConnectors, backendConnectors);
|
|
39491
|
+
const orphaned = findOrphanedConnectors(localConnectors, backendConnectors);
|
|
39492
|
+
if (pending.length === 0 && orphaned.length === 0) return { outroMessage: "All connectors are in sync" };
|
|
39493
|
+
console.log();
|
|
39494
|
+
if (pending.length > 0) {
|
|
39495
|
+
M.info(`${pending.length} connector${pending.length === 1 ? "" : "s"} to connect:`);
|
|
39496
|
+
for (const c$1 of pending) console.log(` ${theme.colors.success("+")} ${c$1.displayName}`);
|
|
39497
|
+
}
|
|
39498
|
+
if (orphaned.length > 0) {
|
|
39499
|
+
M.info(`${orphaned.length} connector${orphaned.length === 1 ? "" : "s"} to remove:`);
|
|
39500
|
+
for (const c$1 of orphaned) {
|
|
39501
|
+
const accountInfo = c$1.accountEmail ? ` (${c$1.accountEmail})` : "";
|
|
39502
|
+
console.log(` ${theme.colors.error("-")} ${c$1.displayName}${accountInfo}`);
|
|
39503
|
+
}
|
|
39504
|
+
}
|
|
39505
|
+
console.log();
|
|
39506
|
+
const totalChanges = pending.length + orphaned.length;
|
|
39507
|
+
const shouldProceed = await ye({
|
|
39508
|
+
message: `Apply ${totalChanges} change${totalChanges === 1 ? "" : "s"}?`,
|
|
39509
|
+
initialValue: true
|
|
39510
|
+
});
|
|
39511
|
+
if (pD(shouldProceed) || !shouldProceed) return { outroMessage: "Cancelled" };
|
|
39512
|
+
let connected = 0;
|
|
39513
|
+
let removed = 0;
|
|
39514
|
+
let failed = 0;
|
|
39515
|
+
for (const connector of orphaned) try {
|
|
39516
|
+
await disconnectConnector(connector.type);
|
|
39517
|
+
M.success(`Removed ${connector.displayName}`);
|
|
39518
|
+
removed++;
|
|
39519
|
+
} catch (err) {
|
|
39520
|
+
M.error(`Failed to remove ${connector.displayName}: ${err instanceof Error ? err.message : "Unknown error"}`);
|
|
39521
|
+
failed++;
|
|
39522
|
+
}
|
|
39523
|
+
for (const connector of pending) {
|
|
39524
|
+
console.log();
|
|
39525
|
+
M.info(`Connecting ${theme.styles.bold(connector.displayName)}...`);
|
|
39526
|
+
const result = await connectSingleConnector(connector);
|
|
39527
|
+
if (result.success) {
|
|
39528
|
+
const accountInfo = result.accountEmail ? ` as ${result.accountEmail}` : "";
|
|
39529
|
+
M.success(`${connector.displayName} connected${accountInfo}`);
|
|
39530
|
+
connected++;
|
|
39531
|
+
} else {
|
|
39532
|
+
M.error(`${connector.displayName} failed: ${result.error}`);
|
|
39533
|
+
failed++;
|
|
39534
|
+
}
|
|
39535
|
+
}
|
|
39536
|
+
console.log();
|
|
39537
|
+
const parts = [];
|
|
39538
|
+
if (connected > 0) parts.push(`${connected} connected`);
|
|
39539
|
+
if (removed > 0) parts.push(`${removed} removed`);
|
|
39540
|
+
if (failed > 0) parts.push(`${failed} failed`);
|
|
39541
|
+
return { outroMessage: parts.join(", ") };
|
|
39542
|
+
}
|
|
39543
|
+
const connectorsPushCommand = new Command("push").description("Sync connectors with backend (connect new, remove missing)").action(async () => {
|
|
39544
|
+
await runCommand(pushConnectorsCommand, {
|
|
39545
|
+
requireAuth: true,
|
|
39546
|
+
requireAppConfig: true
|
|
39547
|
+
});
|
|
39548
|
+
});
|
|
39549
|
+
|
|
39550
|
+
//#endregion
|
|
39551
|
+
//#region src/cli/commands/connectors/remove.ts
|
|
39552
|
+
function mergeConnectorsForRemoval(local, backend) {
|
|
39553
|
+
const merged = /* @__PURE__ */ new Map();
|
|
39554
|
+
for (const connector of local) merged.set(connector.type, {
|
|
39555
|
+
type: connector.type,
|
|
39556
|
+
displayName: getIntegrationDisplayName(connector.type),
|
|
39557
|
+
inLocal: true,
|
|
39558
|
+
inBackend: false
|
|
39559
|
+
});
|
|
39560
|
+
for (const connector of backend) {
|
|
39561
|
+
if (!isValidIntegration(connector.integrationType)) continue;
|
|
39562
|
+
const existing = merged.get(connector.integrationType);
|
|
39563
|
+
const accountEmail = (connector.accountInfo?.email || connector.accountInfo?.name) ?? void 0;
|
|
39564
|
+
if (existing) {
|
|
39565
|
+
existing.inBackend = true;
|
|
39566
|
+
existing.accountEmail = accountEmail;
|
|
39567
|
+
} else merged.set(connector.integrationType, {
|
|
39568
|
+
type: connector.integrationType,
|
|
39569
|
+
displayName: getIntegrationDisplayName(connector.integrationType),
|
|
39570
|
+
inLocal: false,
|
|
39571
|
+
inBackend: true,
|
|
39572
|
+
accountEmail
|
|
39573
|
+
});
|
|
39574
|
+
}
|
|
39575
|
+
return Array.from(merged.values());
|
|
39576
|
+
}
|
|
39577
|
+
async function promptForConnectorToRemove(connectors) {
|
|
39578
|
+
const selected = await ve({
|
|
39579
|
+
message: "Select a connector to remove:",
|
|
39580
|
+
options: connectors.map((c$1) => {
|
|
39581
|
+
let label = c$1.displayName;
|
|
39582
|
+
if (c$1.accountEmail) label += ` (${c$1.accountEmail})`;
|
|
39583
|
+
else if (c$1.inLocal && !c$1.inBackend) label += " (not connected)";
|
|
39584
|
+
return {
|
|
39585
|
+
value: c$1.type,
|
|
39586
|
+
label
|
|
39587
|
+
};
|
|
39588
|
+
})
|
|
39589
|
+
});
|
|
39590
|
+
if (pD(selected)) return null;
|
|
39591
|
+
return selected;
|
|
39592
|
+
}
|
|
39593
|
+
async function removeConnectorCommand(integrationType, options = {}) {
|
|
39594
|
+
const isHardDelete = options.hard === true;
|
|
39595
|
+
const [localConnectors, backendConnectors] = await runTask("Fetching connectors...", async () => {
|
|
39596
|
+
const [local, backend] = await Promise.all([readLocalConnectors().catch(() => []), listConnectors().catch(() => [])]);
|
|
39597
|
+
return [local, backend];
|
|
39598
|
+
}, {
|
|
39599
|
+
successMessage: "Connectors loaded",
|
|
39600
|
+
errorMessage: "Failed to fetch connectors"
|
|
39601
|
+
});
|
|
39602
|
+
const merged = mergeConnectorsForRemoval(localConnectors, backendConnectors);
|
|
39603
|
+
if (merged.length === 0) return { outroMessage: "No connectors to remove" };
|
|
39604
|
+
let selectedType;
|
|
39605
|
+
let selectedConnector;
|
|
39606
|
+
if (!integrationType) {
|
|
39607
|
+
const prompted = await promptForConnectorToRemove(merged);
|
|
39608
|
+
if (!prompted) return { outroMessage: "Cancelled" };
|
|
39609
|
+
selectedType = prompted;
|
|
39610
|
+
selectedConnector = merged.find((c$1) => c$1.type === selectedType);
|
|
39611
|
+
} else {
|
|
39612
|
+
if (!isValidIntegration(integrationType)) throw new Error(`Invalid connector type: ${integrationType}`);
|
|
39613
|
+
selectedConnector = merged.find((c$1) => c$1.type === integrationType);
|
|
39614
|
+
if (!selectedConnector) throw new Error(`No ${getIntegrationDisplayName(integrationType)} connector found`);
|
|
39615
|
+
selectedType = integrationType;
|
|
39616
|
+
}
|
|
39617
|
+
const displayName = getIntegrationDisplayName(selectedType);
|
|
39618
|
+
const accountInfo = selectedConnector?.accountEmail ? ` (${selectedConnector.accountEmail})` : "";
|
|
39619
|
+
const shouldRemove = await ye({
|
|
39620
|
+
message: `${isHardDelete ? "Permanently remove" : "Remove"} ${displayName}${accountInfo}?`,
|
|
39621
|
+
initialValue: false
|
|
39622
|
+
});
|
|
39623
|
+
if (pD(shouldRemove) || !shouldRemove) return { outroMessage: "Cancelled" };
|
|
39624
|
+
await runTask(isHardDelete ? `Removing ${displayName}...` : `Removing ${displayName}...`, async () => {
|
|
39625
|
+
if (selectedConnector?.inBackend) if (isHardDelete) await removeConnector(selectedType);
|
|
39626
|
+
else await disconnectConnector(selectedType);
|
|
39627
|
+
await removeLocalConnector(selectedType);
|
|
39628
|
+
}, {
|
|
39629
|
+
successMessage: `${displayName} removed`,
|
|
39630
|
+
errorMessage: `Failed to remove ${displayName}`
|
|
39631
|
+
});
|
|
39632
|
+
return { outroMessage: `Successfully removed ${theme.styles.bold(displayName)}` };
|
|
39633
|
+
}
|
|
39634
|
+
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) => {
|
|
39635
|
+
await runCommand(() => removeConnectorCommand(type, options), {
|
|
39636
|
+
requireAuth: true,
|
|
39637
|
+
requireAppConfig: true
|
|
39638
|
+
});
|
|
39639
|
+
});
|
|
39640
|
+
|
|
39641
|
+
//#endregion
|
|
39642
|
+
//#region src/cli/commands/connectors/index.ts
|
|
39643
|
+
const connectorsCommand = new Command("connectors").description("Manage OAuth connectors").addCommand(connectorsAddCommand).addCommand(connectorsListCommand).addCommand(connectorsPushCommand).addCommand(connectorsRemoveCommand);
|
|
39644
|
+
|
|
39247
39645
|
//#endregion
|
|
39248
39646
|
//#region package.json
|
|
39249
39647
|
var version = "0.0.15";
|
|
@@ -39262,8 +39660,8 @@ program.addCommand(deployCommand);
|
|
|
39262
39660
|
program.addCommand(linkCommand);
|
|
39263
39661
|
program.addCommand(entitiesPushCommand);
|
|
39264
39662
|
program.addCommand(functionsDeployCommand);
|
|
39265
|
-
program.addCommand(typesGenerateCommand);
|
|
39266
39663
|
program.addCommand(siteDeployCommand);
|
|
39664
|
+
program.addCommand(connectorsCommand);
|
|
39267
39665
|
program.parse();
|
|
39268
39666
|
|
|
39269
39667
|
//#endregion
|