@base44-preview/cli 0.0.24-pr.147.be1c0f9 → 0.0.25-pr.104.2d197bb
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +484 -119
- package/package.json +8 -2
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { EventEmitter, addAbortListener, on, once, setMaxListeners } from "node:
|
|
|
3
3
|
import childProcess, { ChildProcess, execFile, spawn, spawnSync } from "node:child_process";
|
|
4
4
|
import path, { basename, dirname, join, posix, resolve, win32 } from "node:path";
|
|
5
5
|
import fs, { appendFileSync, createReadStream, createWriteStream, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
6
|
-
import
|
|
6
|
+
import y, { execArgv, execPath, hrtime, platform, stdin, stdout } from "node:process";
|
|
7
7
|
import { aborted, callbackify, debuglog, inspect, promisify, stripVTControlCharacters } from "node:util";
|
|
8
8
|
import * as g from "node:readline";
|
|
9
9
|
import O from "node:readline";
|
|
@@ -893,7 +893,7 @@ var require_command = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
893
893
|
const childProcess$1 = __require("node:child_process");
|
|
894
894
|
const path$15 = __require("node:path");
|
|
895
895
|
const fs$10 = __require("node:fs");
|
|
896
|
-
const process$
|
|
896
|
+
const process$3 = __require("node:process");
|
|
897
897
|
const { Argument, humanReadableArgName } = require_argument();
|
|
898
898
|
const { CommanderError } = require_error$1();
|
|
899
899
|
const { Help } = require_help();
|
|
@@ -944,10 +944,10 @@ var require_command = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
944
944
|
this._showHelpAfterError = false;
|
|
945
945
|
this._showSuggestionAfterError = true;
|
|
946
946
|
this._outputConfiguration = {
|
|
947
|
-
writeOut: (str) => process$
|
|
948
|
-
writeErr: (str) => process$
|
|
949
|
-
getOutHelpWidth: () => process$
|
|
950
|
-
getErrHelpWidth: () => process$
|
|
947
|
+
writeOut: (str) => process$3.stdout.write(str),
|
|
948
|
+
writeErr: (str) => process$3.stderr.write(str),
|
|
949
|
+
getOutHelpWidth: () => process$3.stdout.isTTY ? process$3.stdout.columns : void 0,
|
|
950
|
+
getErrHelpWidth: () => process$3.stderr.isTTY ? process$3.stderr.columns : void 0,
|
|
951
951
|
outputError: (str, write) => write(str)
|
|
952
952
|
};
|
|
953
953
|
this._hidden = false;
|
|
@@ -1301,7 +1301,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1301
1301
|
*/
|
|
1302
1302
|
_exit(exitCode, code$1, message) {
|
|
1303
1303
|
if (this._exitCallback) this._exitCallback(new CommanderError(exitCode, code$1, message));
|
|
1304
|
-
process$
|
|
1304
|
+
process$3.exit(exitCode);
|
|
1305
1305
|
}
|
|
1306
1306
|
/**
|
|
1307
1307
|
* Register callback `fn` for the command.
|
|
@@ -1640,11 +1640,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1640
1640
|
if (argv !== void 0 && !Array.isArray(argv)) throw new Error("first parameter to parse must be array or undefined");
|
|
1641
1641
|
parseOptions = parseOptions || {};
|
|
1642
1642
|
if (argv === void 0 && parseOptions.from === void 0) {
|
|
1643
|
-
if (process$
|
|
1644
|
-
const execArgv$1 = process$
|
|
1643
|
+
if (process$3.versions?.electron) parseOptions.from = "electron";
|
|
1644
|
+
const execArgv$1 = process$3.execArgv ?? [];
|
|
1645
1645
|
if (execArgv$1.includes("-e") || execArgv$1.includes("--eval") || execArgv$1.includes("-p") || execArgv$1.includes("--print")) parseOptions.from = "eval";
|
|
1646
1646
|
}
|
|
1647
|
-
if (argv === void 0) argv = process$
|
|
1647
|
+
if (argv === void 0) argv = process$3.argv;
|
|
1648
1648
|
this.rawArgs = argv.slice();
|
|
1649
1649
|
let userArgs;
|
|
1650
1650
|
switch (parseOptions.from) {
|
|
@@ -1654,7 +1654,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1654
1654
|
userArgs = argv.slice(2);
|
|
1655
1655
|
break;
|
|
1656
1656
|
case "electron":
|
|
1657
|
-
if (process$
|
|
1657
|
+
if (process$3.defaultApp) {
|
|
1658
1658
|
this._scriptPath = argv[1];
|
|
1659
1659
|
userArgs = argv.slice(2);
|
|
1660
1660
|
} else userArgs = argv.slice(1);
|
|
@@ -1768,15 +1768,15 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1768
1768
|
}
|
|
1769
1769
|
launchWithNode = sourceExt.includes(path$15.extname(executableFile));
|
|
1770
1770
|
let proc$1;
|
|
1771
|
-
if (process$
|
|
1771
|
+
if (process$3.platform !== "win32") if (launchWithNode) {
|
|
1772
1772
|
args.unshift(executableFile);
|
|
1773
|
-
args = incrementNodeInspectorPort(process$
|
|
1774
|
-
proc$1 = childProcess$1.spawn(process$
|
|
1773
|
+
args = incrementNodeInspectorPort(process$3.execArgv).concat(args);
|
|
1774
|
+
proc$1 = childProcess$1.spawn(process$3.argv[0], args, { stdio: "inherit" });
|
|
1775
1775
|
} else proc$1 = childProcess$1.spawn(executableFile, args, { stdio: "inherit" });
|
|
1776
1776
|
else {
|
|
1777
1777
|
args.unshift(executableFile);
|
|
1778
|
-
args = incrementNodeInspectorPort(process$
|
|
1779
|
-
proc$1 = childProcess$1.spawn(process$
|
|
1778
|
+
args = incrementNodeInspectorPort(process$3.execArgv).concat(args);
|
|
1779
|
+
proc$1 = childProcess$1.spawn(process$3.execPath, args, { stdio: "inherit" });
|
|
1780
1780
|
}
|
|
1781
1781
|
if (!proc$1.killed) [
|
|
1782
1782
|
"SIGUSR1",
|
|
@@ -1785,14 +1785,14 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1785
1785
|
"SIGINT",
|
|
1786
1786
|
"SIGHUP"
|
|
1787
1787
|
].forEach((signal) => {
|
|
1788
|
-
process$
|
|
1788
|
+
process$3.on(signal, () => {
|
|
1789
1789
|
if (proc$1.killed === false && proc$1.exitCode === null) proc$1.kill(signal);
|
|
1790
1790
|
});
|
|
1791
1791
|
});
|
|
1792
1792
|
const exitCallback = this._exitCallback;
|
|
1793
1793
|
proc$1.on("close", (code$1) => {
|
|
1794
1794
|
code$1 = code$1 ?? 1;
|
|
1795
|
-
if (!exitCallback) process$
|
|
1795
|
+
if (!exitCallback) process$3.exit(code$1);
|
|
1796
1796
|
else exitCallback(new CommanderError(code$1, "commander.executeSubCommandAsync", "(close)"));
|
|
1797
1797
|
});
|
|
1798
1798
|
proc$1.on("error", (err) => {
|
|
@@ -1804,7 +1804,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1804
1804
|
- ${executableDirMessage}`;
|
|
1805
1805
|
throw new Error(executableMissing);
|
|
1806
1806
|
} else if (err.code === "EACCES") throw new Error(`'${executableFile}' not executable`);
|
|
1807
|
-
if (!exitCallback) process$
|
|
1807
|
+
if (!exitCallback) process$3.exit(1);
|
|
1808
1808
|
else {
|
|
1809
1809
|
const wrappedError = new CommanderError(1, "commander.executeSubCommandAsync", "(error)");
|
|
1810
1810
|
wrappedError.nestedError = err;
|
|
@@ -2210,13 +2210,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2210
2210
|
*/
|
|
2211
2211
|
_parseOptionsEnv() {
|
|
2212
2212
|
this.options.forEach((option) => {
|
|
2213
|
-
if (option.envVar && option.envVar in process$
|
|
2213
|
+
if (option.envVar && option.envVar in process$3.env) {
|
|
2214
2214
|
const optionKey = option.attributeName();
|
|
2215
2215
|
if (this.getOptionValue(optionKey) === void 0 || [
|
|
2216
2216
|
"default",
|
|
2217
2217
|
"config",
|
|
2218
2218
|
"env"
|
|
2219
|
-
].includes(this.getOptionValueSource(optionKey))) if (option.required || option.optional) this.emit(`optionEnv:${option.name()}`, process$
|
|
2219
|
+
].includes(this.getOptionValueSource(optionKey))) if (option.required || option.optional) this.emit(`optionEnv:${option.name()}`, process$3.env[option.envVar]);
|
|
2220
2220
|
else this.emit(`optionEnv:${option.name()}`);
|
|
2221
2221
|
}
|
|
2222
2222
|
});
|
|
@@ -2595,7 +2595,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2595
2595
|
*/
|
|
2596
2596
|
help(contextOptions) {
|
|
2597
2597
|
this.outputHelp(contextOptions);
|
|
2598
|
-
let exitCode = process$
|
|
2598
|
+
let exitCode = process$3.exitCode || 0;
|
|
2599
2599
|
if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) exitCode = 1;
|
|
2600
2600
|
this._exit(exitCode, "commander.help", "(outputHelp)");
|
|
2601
2601
|
}
|
|
@@ -2711,16 +2711,16 @@ var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2711
2711
|
const CSI = `${ESC}[`;
|
|
2712
2712
|
const beep = "\x07";
|
|
2713
2713
|
const cursor = {
|
|
2714
|
-
to(x$2, y$
|
|
2715
|
-
if (!y$
|
|
2716
|
-
return `${CSI}${y$
|
|
2714
|
+
to(x$2, y$2) {
|
|
2715
|
+
if (!y$2) return `${CSI}${x$2 + 1}G`;
|
|
2716
|
+
return `${CSI}${y$2 + 1};${x$2 + 1}H`;
|
|
2717
2717
|
},
|
|
2718
|
-
move(x$2, y$
|
|
2718
|
+
move(x$2, y$2) {
|
|
2719
2719
|
let ret = "";
|
|
2720
2720
|
if (x$2 < 0) ret += `${CSI}${-x$2}D`;
|
|
2721
2721
|
else if (x$2 > 0) ret += `${CSI}${x$2}C`;
|
|
2722
|
-
if (y$
|
|
2723
|
-
else if (y$
|
|
2722
|
+
if (y$2 < 0) ret += `${CSI}${-y$2}A`;
|
|
2723
|
+
else if (y$2 > 0) ret += `${CSI}${y$2}B`;
|
|
2724
2724
|
return ret;
|
|
2725
2725
|
},
|
|
2726
2726
|
up: (count$1 = 1) => `${CSI}${count$1}A`,
|
|
@@ -3030,13 +3030,13 @@ function rD() {
|
|
|
3030
3030
|
}
|
|
3031
3031
|
}), r;
|
|
3032
3032
|
}
|
|
3033
|
-
const ED = rD(), d$1 = new Set(["\x1B", ""]), oD = 39, y = "\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) => {
|
|
3033
|
+
const ED = rD(), d$1 = new Set(["\x1B", ""]), oD = 39, y$1 = "\x07", V$1 = "[", nD = "]", G$1 = "m", _$1 = `${nD}8;;`, z = (e$1) => `${d$1.values().next().value}${V$1}${e$1}${G$1}`, K$1 = (e$1) => `${d$1.values().next().value}${_$1}${e$1}${y$1}`, aD = (e$1) => e$1.split(" ").map((u$2) => p(u$2)), k$1 = (e$1, u$2, t) => {
|
|
3034
3034
|
const F$1 = [...u$2];
|
|
3035
3035
|
let s = !1, i$1 = !1, D$1 = p(P$1(e$1[e$1.length - 1]));
|
|
3036
3036
|
for (const [C$1, n$1] of F$1.entries()) {
|
|
3037
3037
|
const E = p(n$1);
|
|
3038
3038
|
if (D$1 + E <= t ? e$1[e$1.length - 1] += n$1 : (e$1.push(n$1), D$1 = 0), d$1.has(n$1) && (s = !0, i$1 = F$1.slice(C$1 + 1).join("").startsWith(_$1)), s) {
|
|
3039
|
-
i$1 ? n$1 === y && (s = !1, i$1 = !1) : n$1 === G$1 && (s = !1);
|
|
3039
|
+
i$1 ? n$1 === y$1 && (s = !1, i$1 = !1) : n$1 === G$1 && (s = !1);
|
|
3040
3040
|
continue;
|
|
3041
3041
|
}
|
|
3042
3042
|
D$1 += E, D$1 === t && C$1 < F$1.length - 1 && (e$1.push(""), D$1 = 0);
|
|
@@ -3078,7 +3078,7 @@ const ED = rD(), d$1 = new Set(["\x1B", ""]), oD = 39, y = "\x07", V$1 = "[",
|
|
|
3078
3078
|
`)];
|
|
3079
3079
|
for (const [E, a$1] of n$1.entries()) {
|
|
3080
3080
|
if (F$1 += a$1, d$1.has(a$1)) {
|
|
3081
|
-
const { groups: c$1 } = (/* @__PURE__ */ new RegExp(`(?:\\${V$1}(?<code>\\d+)m|\\${_$1}(?<uri>.*)${y})`)).exec(n$1.slice(E).join("")) || { groups: {} };
|
|
3081
|
+
const { groups: c$1 } = (/* @__PURE__ */ new RegExp(`(?:\\${V$1}(?<code>\\d+)m|\\${_$1}(?<uri>.*)${y$1})`)).exec(n$1.slice(E).join("")) || { groups: {} };
|
|
3082
3082
|
if (c$1.code !== void 0) {
|
|
3083
3083
|
const f = Number.parseFloat(c$1.code);
|
|
3084
3084
|
s = f === oD ? void 0 : f;
|
|
@@ -3479,7 +3479,7 @@ var RD = class extends x$1 {
|
|
|
3479
3479
|
//#endregion
|
|
3480
3480
|
//#region node_modules/@clack/prompts/dist/index.mjs
|
|
3481
3481
|
function ce() {
|
|
3482
|
-
return
|
|
3482
|
+
return y.platform !== "win32" ? y.env.TERM !== "linux" : !!y.env.CI || !!y.env.WT_SESSION || !!y.env.TERMINUS_SUBLIME || y.env.ConEmuTask === "{cmd::Cmder}" || y.env.TERM_PROGRAM === "Terminus-Sublime" || y.env.TERM_PROGRAM === "vscode" || y.env.TERM === "xterm-256color" || y.env.TERM === "alacritty" || y.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
3483
3483
|
}
|
|
3484
3484
|
const V = ce(), u$1 = (t, n$1) => V ? t : n$1, le = u$1("◆", "*"), L = u$1("■", "x"), W = u$1("▲", "x"), C = u$1("◇", "o"), ue = u$1("┌", "T"), o$1 = u$1("│", "|"), d = u$1("└", "—"), k = u$1("●", ">"), P = u$1("○", " "), A = u$1("◻", "[•]"), T = u$1("◼", "[+]"), F = u$1("◻", "[ ]"), $e = u$1("▪", "•"), _ = u$1("─", "-"), me = u$1("╮", "+"), de = u$1("├", "+"), pe = u$1("╯", "+"), q = u$1("●", "•"), D = u$1("◆", "*"), U = u$1("▲", "!"), K = u$1("■", "x"), b = (t) => {
|
|
3485
3485
|
switch (t) {
|
|
@@ -6744,7 +6744,7 @@ function initializeContext(params) {
|
|
|
6744
6744
|
external: params?.external ?? void 0
|
|
6745
6745
|
};
|
|
6746
6746
|
}
|
|
6747
|
-
function process$
|
|
6747
|
+
function process$2(schema, ctx, _params = {
|
|
6748
6748
|
path: [],
|
|
6749
6749
|
schemaPath: []
|
|
6750
6750
|
}) {
|
|
@@ -6781,7 +6781,7 @@ function process$3(schema, ctx, _params = {
|
|
|
6781
6781
|
const parent = schema._zod.parent;
|
|
6782
6782
|
if (parent) {
|
|
6783
6783
|
if (!result.ref) result.ref = parent;
|
|
6784
|
-
process$
|
|
6784
|
+
process$2(parent, ctx, params);
|
|
6785
6785
|
ctx.seen.get(parent).isParent = true;
|
|
6786
6786
|
}
|
|
6787
6787
|
}
|
|
@@ -6993,7 +6993,7 @@ const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
|
6993
6993
|
...params,
|
|
6994
6994
|
processors
|
|
6995
6995
|
});
|
|
6996
|
-
process$
|
|
6996
|
+
process$2(schema, ctx);
|
|
6997
6997
|
extractDefs(ctx, schema);
|
|
6998
6998
|
return finalize(ctx, schema);
|
|
6999
6999
|
};
|
|
@@ -7005,7 +7005,7 @@ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params)
|
|
|
7005
7005
|
io,
|
|
7006
7006
|
processors
|
|
7007
7007
|
});
|
|
7008
|
-
process$
|
|
7008
|
+
process$2(schema, ctx);
|
|
7009
7009
|
extractDefs(ctx, schema);
|
|
7010
7010
|
return finalize(ctx, schema);
|
|
7011
7011
|
};
|
|
@@ -7092,7 +7092,7 @@ const arrayProcessor = (schema, ctx, _json, params) => {
|
|
|
7092
7092
|
if (typeof minimum === "number") json.minItems = minimum;
|
|
7093
7093
|
if (typeof maximum === "number") json.maxItems = maximum;
|
|
7094
7094
|
json.type = "array";
|
|
7095
|
-
json.items = process$
|
|
7095
|
+
json.items = process$2(def.element, ctx, {
|
|
7096
7096
|
...params,
|
|
7097
7097
|
path: [...params.path, "items"]
|
|
7098
7098
|
});
|
|
@@ -7103,7 +7103,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
|
|
|
7103
7103
|
json.type = "object";
|
|
7104
7104
|
json.properties = {};
|
|
7105
7105
|
const shape = def.shape;
|
|
7106
|
-
for (const key in shape) json.properties[key] = process$
|
|
7106
|
+
for (const key in shape) json.properties[key] = process$2(shape[key], ctx, {
|
|
7107
7107
|
...params,
|
|
7108
7108
|
path: [
|
|
7109
7109
|
...params.path,
|
|
@@ -7121,7 +7121,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
|
|
|
7121
7121
|
if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
|
|
7122
7122
|
else if (!def.catchall) {
|
|
7123
7123
|
if (ctx.io === "output") json.additionalProperties = false;
|
|
7124
|
-
} else if (def.catchall) json.additionalProperties = process$
|
|
7124
|
+
} else if (def.catchall) json.additionalProperties = process$2(def.catchall, ctx, {
|
|
7125
7125
|
...params,
|
|
7126
7126
|
path: [...params.path, "additionalProperties"]
|
|
7127
7127
|
});
|
|
@@ -7129,7 +7129,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
|
|
|
7129
7129
|
const unionProcessor = (schema, ctx, json, params) => {
|
|
7130
7130
|
const def = schema._zod.def;
|
|
7131
7131
|
const isExclusive = def.inclusive === false;
|
|
7132
|
-
const options = def.options.map((x$2, i$1) => process$
|
|
7132
|
+
const options = def.options.map((x$2, i$1) => process$2(x$2, ctx, {
|
|
7133
7133
|
...params,
|
|
7134
7134
|
path: [
|
|
7135
7135
|
...params.path,
|
|
@@ -7142,7 +7142,7 @@ const unionProcessor = (schema, ctx, json, params) => {
|
|
|
7142
7142
|
};
|
|
7143
7143
|
const intersectionProcessor = (schema, ctx, json, params) => {
|
|
7144
7144
|
const def = schema._zod.def;
|
|
7145
|
-
const a$1 = process$
|
|
7145
|
+
const a$1 = process$2(def.left, ctx, {
|
|
7146
7146
|
...params,
|
|
7147
7147
|
path: [
|
|
7148
7148
|
...params.path,
|
|
@@ -7150,7 +7150,7 @@ const intersectionProcessor = (schema, ctx, json, params) => {
|
|
|
7150
7150
|
0
|
|
7151
7151
|
]
|
|
7152
7152
|
});
|
|
7153
|
-
const b$2 = process$
|
|
7153
|
+
const b$2 = process$2(def.right, ctx, {
|
|
7154
7154
|
...params,
|
|
7155
7155
|
path: [
|
|
7156
7156
|
...params.path,
|
|
@@ -7167,7 +7167,7 @@ const tupleProcessor = (schema, ctx, _json, params) => {
|
|
|
7167
7167
|
json.type = "array";
|
|
7168
7168
|
const prefixPath$1 = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
7169
7169
|
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
7170
|
-
const prefixItems = def.items.map((x$2, i$1) => process$
|
|
7170
|
+
const prefixItems = def.items.map((x$2, i$1) => process$2(x$2, ctx, {
|
|
7171
7171
|
...params,
|
|
7172
7172
|
path: [
|
|
7173
7173
|
...params.path,
|
|
@@ -7175,7 +7175,7 @@ const tupleProcessor = (schema, ctx, _json, params) => {
|
|
|
7175
7175
|
i$1
|
|
7176
7176
|
]
|
|
7177
7177
|
}));
|
|
7178
|
-
const rest = def.rest ? process$
|
|
7178
|
+
const rest = def.rest ? process$2(def.rest, ctx, {
|
|
7179
7179
|
...params,
|
|
7180
7180
|
path: [
|
|
7181
7181
|
...params.path,
|
|
@@ -7206,7 +7206,7 @@ const recordProcessor = (schema, ctx, _json, params) => {
|
|
|
7206
7206
|
const keyType = def.keyType;
|
|
7207
7207
|
const patterns = keyType._zod.bag?.patterns;
|
|
7208
7208
|
if (def.mode === "loose" && patterns && patterns.size > 0) {
|
|
7209
|
-
const valueSchema = process$
|
|
7209
|
+
const valueSchema = process$2(def.valueType, ctx, {
|
|
7210
7210
|
...params,
|
|
7211
7211
|
path: [
|
|
7212
7212
|
...params.path,
|
|
@@ -7217,11 +7217,11 @@ const recordProcessor = (schema, ctx, _json, params) => {
|
|
|
7217
7217
|
json.patternProperties = {};
|
|
7218
7218
|
for (const pattern of patterns) json.patternProperties[pattern.source] = valueSchema;
|
|
7219
7219
|
} else {
|
|
7220
|
-
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") json.propertyNames = process$
|
|
7220
|
+
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") json.propertyNames = process$2(def.keyType, ctx, {
|
|
7221
7221
|
...params,
|
|
7222
7222
|
path: [...params.path, "propertyNames"]
|
|
7223
7223
|
});
|
|
7224
|
-
json.additionalProperties = process$
|
|
7224
|
+
json.additionalProperties = process$2(def.valueType, ctx, {
|
|
7225
7225
|
...params,
|
|
7226
7226
|
path: [...params.path, "additionalProperties"]
|
|
7227
7227
|
});
|
|
@@ -7234,7 +7234,7 @@ const recordProcessor = (schema, ctx, _json, params) => {
|
|
|
7234
7234
|
};
|
|
7235
7235
|
const nullableProcessor = (schema, ctx, json, params) => {
|
|
7236
7236
|
const def = schema._zod.def;
|
|
7237
|
-
const inner = process$
|
|
7237
|
+
const inner = process$2(def.innerType, ctx, params);
|
|
7238
7238
|
const seen = ctx.seen.get(schema);
|
|
7239
7239
|
if (ctx.target === "openapi-3.0") {
|
|
7240
7240
|
seen.ref = def.innerType;
|
|
@@ -7243,27 +7243,27 @@ const nullableProcessor = (schema, ctx, json, params) => {
|
|
|
7243
7243
|
};
|
|
7244
7244
|
const nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
7245
7245
|
const def = schema._zod.def;
|
|
7246
|
-
process$
|
|
7246
|
+
process$2(def.innerType, ctx, params);
|
|
7247
7247
|
const seen = ctx.seen.get(schema);
|
|
7248
7248
|
seen.ref = def.innerType;
|
|
7249
7249
|
};
|
|
7250
7250
|
const defaultProcessor = (schema, ctx, json, params) => {
|
|
7251
7251
|
const def = schema._zod.def;
|
|
7252
|
-
process$
|
|
7252
|
+
process$2(def.innerType, ctx, params);
|
|
7253
7253
|
const seen = ctx.seen.get(schema);
|
|
7254
7254
|
seen.ref = def.innerType;
|
|
7255
7255
|
json.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
7256
7256
|
};
|
|
7257
7257
|
const prefaultProcessor = (schema, ctx, json, params) => {
|
|
7258
7258
|
const def = schema._zod.def;
|
|
7259
|
-
process$
|
|
7259
|
+
process$2(def.innerType, ctx, params);
|
|
7260
7260
|
const seen = ctx.seen.get(schema);
|
|
7261
7261
|
seen.ref = def.innerType;
|
|
7262
7262
|
if (ctx.io === "input") json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
7263
7263
|
};
|
|
7264
7264
|
const catchProcessor = (schema, ctx, json, params) => {
|
|
7265
7265
|
const def = schema._zod.def;
|
|
7266
|
-
process$
|
|
7266
|
+
process$2(def.innerType, ctx, params);
|
|
7267
7267
|
const seen = ctx.seen.get(schema);
|
|
7268
7268
|
seen.ref = def.innerType;
|
|
7269
7269
|
let catchValue;
|
|
@@ -7277,20 +7277,20 @@ const catchProcessor = (schema, ctx, json, params) => {
|
|
|
7277
7277
|
const pipeProcessor = (schema, ctx, _json, params) => {
|
|
7278
7278
|
const def = schema._zod.def;
|
|
7279
7279
|
const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
|
|
7280
|
-
process$
|
|
7280
|
+
process$2(innerType, ctx, params);
|
|
7281
7281
|
const seen = ctx.seen.get(schema);
|
|
7282
7282
|
seen.ref = innerType;
|
|
7283
7283
|
};
|
|
7284
7284
|
const readonlyProcessor = (schema, ctx, json, params) => {
|
|
7285
7285
|
const def = schema._zod.def;
|
|
7286
|
-
process$
|
|
7286
|
+
process$2(def.innerType, ctx, params);
|
|
7287
7287
|
const seen = ctx.seen.get(schema);
|
|
7288
7288
|
seen.ref = def.innerType;
|
|
7289
7289
|
json.readOnly = true;
|
|
7290
7290
|
};
|
|
7291
7291
|
const optionalProcessor = (schema, ctx, _json, params) => {
|
|
7292
7292
|
const def = schema._zod.def;
|
|
7293
|
-
process$
|
|
7293
|
+
process$2(def.innerType, ctx, params);
|
|
7294
7294
|
const seen = ctx.seen.get(schema);
|
|
7295
7295
|
seen.ref = def.innerType;
|
|
7296
7296
|
};
|
|
@@ -16335,7 +16335,7 @@ const createIgnorePredicate = (patterns, cwd, baseDir) => {
|
|
|
16335
16335
|
};
|
|
16336
16336
|
const normalizeOptions$2 = (options = {}) => {
|
|
16337
16337
|
const ignoreOption = options.ignore ? Array.isArray(options.ignore) ? options.ignore : [options.ignore] : [];
|
|
16338
|
-
const cwd = toPath$1(options.cwd) ??
|
|
16338
|
+
const cwd = toPath$1(options.cwd) ?? y.cwd();
|
|
16339
16339
|
const deep = typeof options.deep === "number" ? Math.max(0, options.deep) + 1 : Number.POSITIVE_INFINITY;
|
|
16340
16340
|
return {
|
|
16341
16341
|
cwd,
|
|
@@ -16432,7 +16432,7 @@ const getDirectoryGlob = ({ directoryPath, files, extensions }) => {
|
|
|
16432
16432
|
const extensionGlob = extensions?.length > 0 ? `.${extensions.length > 1 ? `{${extensions.join(",")}}` : extensions[0]}` : "";
|
|
16433
16433
|
return files ? files.map((file) => path.posix.join(directoryPath, `**/${path.extname(file) ? file : `${file}${extensionGlob}`}`)) : [path.posix.join(directoryPath, `**${extensionGlob ? `/*${extensionGlob}` : ""}`)];
|
|
16434
16434
|
};
|
|
16435
|
-
const directoryToGlob = async (directoryPaths, { cwd =
|
|
16435
|
+
const directoryToGlob = async (directoryPaths, { cwd = y.cwd(), files, extensions, fs: fsImplementation } = {}) => {
|
|
16436
16436
|
return (await Promise.all(directoryPaths.map(async (directoryPath) => {
|
|
16437
16437
|
if (shouldExpandGlobstarDirectory(isNegativePattern(directoryPath) ? directoryPath.slice(1) : directoryPath)) return getDirectoryGlob({
|
|
16438
16438
|
directoryPath,
|
|
@@ -16446,7 +16446,7 @@ const directoryToGlob = async (directoryPaths, { cwd = process$1.cwd(), files, e
|
|
|
16446
16446
|
}) : directoryPath;
|
|
16447
16447
|
}))).flat();
|
|
16448
16448
|
};
|
|
16449
|
-
const directoryToGlobSync = (directoryPaths, { cwd =
|
|
16449
|
+
const directoryToGlobSync = (directoryPaths, { cwd = y.cwd(), files, extensions, fs: fsImplementation } = {}) => directoryPaths.flatMap((directoryPath) => {
|
|
16450
16450
|
if (shouldExpandGlobstarDirectory(isNegativePattern(directoryPath) ? directoryPath.slice(1) : directoryPath)) return getDirectoryGlob({
|
|
16451
16451
|
directoryPath,
|
|
16452
16452
|
files,
|
|
@@ -16542,7 +16542,7 @@ const applyIgnoreFilesAndGetFilterSync = (options) => {
|
|
|
16542
16542
|
};
|
|
16543
16543
|
const createFilterFunction = (isIgnored, cwd) => {
|
|
16544
16544
|
const seen = /* @__PURE__ */ new Set();
|
|
16545
|
-
const basePath = cwd ||
|
|
16545
|
+
const basePath = cwd || y.cwd();
|
|
16546
16546
|
const pathCache = /* @__PURE__ */ new Map();
|
|
16547
16547
|
return (fastGlobResult) => {
|
|
16548
16548
|
const pathKey$1 = path.normalize(fastGlobResult.path ?? fastGlobResult);
|
|
@@ -16730,7 +16730,10 @@ const FunctionConfigSchema = object({
|
|
|
16730
16730
|
entry: string().min(1, "Entry point cannot be empty"),
|
|
16731
16731
|
triggers: tuple([]).optional()
|
|
16732
16732
|
});
|
|
16733
|
-
const FunctionSchema = FunctionConfigSchema.extend({
|
|
16733
|
+
const FunctionSchema = FunctionConfigSchema.extend({
|
|
16734
|
+
entryPath: string().min(1, "Entry path cannot be empty"),
|
|
16735
|
+
files: array(string()).min(1, "Files array cannot be empty")
|
|
16736
|
+
});
|
|
16734
16737
|
const DeployFunctionsResponseSchema = object({
|
|
16735
16738
|
deployed: array(string()),
|
|
16736
16739
|
deleted: array(string()),
|
|
@@ -16750,11 +16753,17 @@ async function readFunctionConfig(configPath) {
|
|
|
16750
16753
|
}
|
|
16751
16754
|
async function readFunction(configPath) {
|
|
16752
16755
|
const config$1 = await readFunctionConfig(configPath);
|
|
16753
|
-
const
|
|
16754
|
-
|
|
16756
|
+
const functionDir = dirname(configPath);
|
|
16757
|
+
const entryPath = join(functionDir, config$1.entry);
|
|
16758
|
+
if (!await pathExists(entryPath)) throw new Error(`Function entry file not found: ${entryPath} (referenced in ${configPath})`);
|
|
16759
|
+
const files = await globby("*.{js,ts,json}", {
|
|
16760
|
+
cwd: functionDir,
|
|
16761
|
+
absolute: true
|
|
16762
|
+
});
|
|
16755
16763
|
const functionData = {
|
|
16756
16764
|
...config$1,
|
|
16757
|
-
|
|
16765
|
+
entryPath,
|
|
16766
|
+
files
|
|
16758
16767
|
};
|
|
16759
16768
|
const result = FunctionSchema.safeParse(functionData);
|
|
16760
16769
|
if (!result.success) throw new Error(`Invalid function in ${configPath}: ${result.error.message}`);
|
|
@@ -16781,10 +16790,7 @@ function toDeployPayloadItem(fn) {
|
|
|
16781
16790
|
return {
|
|
16782
16791
|
name: fn.name,
|
|
16783
16792
|
entry: fn.entry,
|
|
16784
|
-
files:
|
|
16785
|
-
path: fn.entry,
|
|
16786
|
-
content: fn.code
|
|
16787
|
-
}]
|
|
16793
|
+
files: fn.files
|
|
16788
16794
|
};
|
|
16789
16795
|
}
|
|
16790
16796
|
async function deployFunctions(functions) {
|
|
@@ -16800,10 +16806,16 @@ async function deployFunctions(functions) {
|
|
|
16800
16806
|
//#endregion
|
|
16801
16807
|
//#region src/core/resources/function/deploy.ts
|
|
16802
16808
|
async function loadFunctionCode(fn) {
|
|
16803
|
-
const
|
|
16809
|
+
const loadedFiles = await Promise.all(fn.files.map(async (filePath) => {
|
|
16810
|
+
const content = await readTextFile(filePath);
|
|
16811
|
+
return {
|
|
16812
|
+
path: basename(filePath),
|
|
16813
|
+
content
|
|
16814
|
+
};
|
|
16815
|
+
}));
|
|
16804
16816
|
return {
|
|
16805
16817
|
...fn,
|
|
16806
|
-
|
|
16818
|
+
files: loadedFiles
|
|
16807
16819
|
};
|
|
16808
16820
|
}
|
|
16809
16821
|
async function pushFunctions(functions) {
|
|
@@ -16877,6 +16889,11 @@ async function writeAgents(agentsDir, remoteAgents) {
|
|
|
16877
16889
|
//#endregion
|
|
16878
16890
|
//#region src/core/resources/agent/api.ts
|
|
16879
16891
|
async function pushAgents(agents) {
|
|
16892
|
+
if (agents.length === 0) return {
|
|
16893
|
+
created: [],
|
|
16894
|
+
updated: [],
|
|
16895
|
+
deleted: []
|
|
16896
|
+
};
|
|
16880
16897
|
const response = await getAppClient().put("agent-configs", {
|
|
16881
16898
|
json: agents,
|
|
16882
16899
|
throwHttpErrors: false
|
|
@@ -30600,25 +30617,27 @@ async function createArchive(pathToArchive, targetArchivePath) {
|
|
|
30600
30617
|
* Checks if there are any resources to deploy in the project.
|
|
30601
30618
|
*
|
|
30602
30619
|
* @param projectData - The project configuration and resources
|
|
30603
|
-
* @returns true if there are entities, functions, or a configured site to deploy
|
|
30620
|
+
* @returns true if there are entities, functions, agents, or a configured site to deploy
|
|
30604
30621
|
*/
|
|
30605
30622
|
function hasResourcesToDeploy(projectData) {
|
|
30606
|
-
const { project, entities, functions } = projectData;
|
|
30623
|
+
const { project, entities, functions, agents } = projectData;
|
|
30607
30624
|
const hasSite = Boolean(project.site?.outputDirectory);
|
|
30608
30625
|
const hasEntities = entities.length > 0;
|
|
30609
30626
|
const hasFunctions = functions.length > 0;
|
|
30610
|
-
|
|
30627
|
+
const hasAgents = agents.length > 0;
|
|
30628
|
+
return hasEntities || hasFunctions || hasAgents || hasSite;
|
|
30611
30629
|
}
|
|
30612
30630
|
/**
|
|
30613
|
-
* Deploys all project resources (entities, functions, and site) to Base44.
|
|
30631
|
+
* Deploys all project resources (entities, functions, agents, and site) to Base44.
|
|
30614
30632
|
*
|
|
30615
30633
|
* @param projectData - The project configuration and resources to deploy
|
|
30616
30634
|
* @returns The deployment result including app URL if site was deployed
|
|
30617
30635
|
*/
|
|
30618
30636
|
async function deployAll(projectData) {
|
|
30619
|
-
const { project, entities, functions } = projectData;
|
|
30637
|
+
const { project, entities, functions, agents } = projectData;
|
|
30620
30638
|
await entityResource.push(entities);
|
|
30621
30639
|
await functionResource.push(functions);
|
|
30640
|
+
await agentResource.push(agents);
|
|
30622
30641
|
if (project.site?.outputDirectory) {
|
|
30623
30642
|
const { appUrl } = await deploySite(resolve(project.root, project.site.outputDirectory));
|
|
30624
30643
|
return { appUrl };
|
|
@@ -30630,11 +30649,31 @@ async function deployAll(projectData) {
|
|
|
30630
30649
|
//#region src/core/project/app-config.ts
|
|
30631
30650
|
let cache = null;
|
|
30632
30651
|
/**
|
|
30652
|
+
* Load app config from BASE44_CLI_TEST_OVERRIDES env var.
|
|
30653
|
+
* @returns true if override was applied, false otherwise
|
|
30654
|
+
*/
|
|
30655
|
+
function loadFromTestOverrides() {
|
|
30656
|
+
const overrides = process.env.BASE44_CLI_TEST_OVERRIDES;
|
|
30657
|
+
if (!overrides) return false;
|
|
30658
|
+
try {
|
|
30659
|
+
const data = JSON.parse(overrides);
|
|
30660
|
+
if (data.appConfig?.id && data.appConfig?.projectRoot) {
|
|
30661
|
+
cache = {
|
|
30662
|
+
id: data.appConfig.id,
|
|
30663
|
+
projectRoot: data.appConfig.projectRoot
|
|
30664
|
+
};
|
|
30665
|
+
return true;
|
|
30666
|
+
}
|
|
30667
|
+
} catch {}
|
|
30668
|
+
return false;
|
|
30669
|
+
}
|
|
30670
|
+
/**
|
|
30633
30671
|
* Initialize app config by reading from .app.jsonc.
|
|
30634
30672
|
* Must be called before using getAppConfig().
|
|
30635
30673
|
* @throws Error if no project found or .app.jsonc missing
|
|
30636
30674
|
*/
|
|
30637
30675
|
async function initAppConfig() {
|
|
30676
|
+
if (loadFromTestOverrides()) return;
|
|
30638
30677
|
if (cache) return;
|
|
30639
30678
|
const projectRoot = await findProjectRoot();
|
|
30640
30679
|
if (!projectRoot) throw new Error("No Base44 project found. Run this command from a project directory with a config.jsonc file.");
|
|
@@ -31014,13 +31053,13 @@ var ansi_styles_default = ansiStyles;
|
|
|
31014
31053
|
|
|
31015
31054
|
//#endregion
|
|
31016
31055
|
//#region node_modules/chalk/source/vendor/supports-color/index.js
|
|
31017
|
-
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args :
|
|
31056
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : y.argv) {
|
|
31018
31057
|
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
31019
31058
|
const position = argv.indexOf(prefix + flag);
|
|
31020
31059
|
const terminatorPosition = argv.indexOf("--");
|
|
31021
31060
|
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
31022
31061
|
}
|
|
31023
|
-
const { env } =
|
|
31062
|
+
const { env } = y;
|
|
31024
31063
|
let flagForceColor;
|
|
31025
31064
|
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) flagForceColor = 0;
|
|
31026
31065
|
else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) flagForceColor = 1;
|
|
@@ -31053,7 +31092,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
|
31053
31092
|
if (haveStream && !streamIsTTY && forceColor === void 0) return 0;
|
|
31054
31093
|
const min = forceColor || 0;
|
|
31055
31094
|
if (env.TERM === "dumb") return min;
|
|
31056
|
-
if (
|
|
31095
|
+
if (y.platform === "win32") {
|
|
31057
31096
|
const osRelease = os.release().split(".");
|
|
31058
31097
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
31059
31098
|
return 1;
|
|
@@ -31266,7 +31305,10 @@ const theme = {
|
|
|
31266
31305
|
base44OrangeBackground: source_default.bgHex("#E86B3C"),
|
|
31267
31306
|
shinyOrange: source_default.hex("#FFD700"),
|
|
31268
31307
|
links: source_default.hex("#00D4FF"),
|
|
31269
|
-
white: source_default.white
|
|
31308
|
+
white: source_default.white,
|
|
31309
|
+
success: source_default.green,
|
|
31310
|
+
warning: source_default.yellow,
|
|
31311
|
+
error: source_default.red
|
|
31270
31312
|
},
|
|
31271
31313
|
styles: {
|
|
31272
31314
|
header: source_default.dim,
|
|
@@ -31583,7 +31625,8 @@ const logoutCommand = new Command("logout").description("Logout from current dev
|
|
|
31583
31625
|
async function pushEntitiesAction() {
|
|
31584
31626
|
const { entities } = await readProjectConfig();
|
|
31585
31627
|
if (entities.length === 0) return { outroMessage: "No entities found in project" };
|
|
31586
|
-
|
|
31628
|
+
const entityNames = entities.map((e$1) => e$1.name).join(", ");
|
|
31629
|
+
M.info(`Found ${entities.length} entities to push: ${entityNames}`);
|
|
31587
31630
|
const result = await runTask("Pushing entities to Base44", async () => {
|
|
31588
31631
|
return await pushEntities(entities);
|
|
31589
31632
|
}, {
|
|
@@ -31843,9 +31886,9 @@ const getSubprocessResult = ({ stdout: stdout$1 }) => {
|
|
|
31843
31886
|
//#region node_modules/execa/lib/utils/standard-stream.js
|
|
31844
31887
|
const isStandardStream = (stream) => STANDARD_STREAMS.includes(stream);
|
|
31845
31888
|
const STANDARD_STREAMS = [
|
|
31846
|
-
|
|
31847
|
-
|
|
31848
|
-
|
|
31889
|
+
y.stdin,
|
|
31890
|
+
y.stdout,
|
|
31891
|
+
y.stderr
|
|
31849
31892
|
];
|
|
31850
31893
|
const STANDARD_STREAMS_ALIASES = [
|
|
31851
31894
|
"stdin",
|
|
@@ -31970,9 +32013,9 @@ const NO_ESCAPE_REGEXP = /^[\w./-]+$/;
|
|
|
31970
32013
|
//#endregion
|
|
31971
32014
|
//#region node_modules/is-unicode-supported/index.js
|
|
31972
32015
|
function isUnicodeSupported() {
|
|
31973
|
-
const { env: env$1 } =
|
|
32016
|
+
const { env: env$1 } = y;
|
|
31974
32017
|
const { TERM, TERM_PROGRAM } = env$1;
|
|
31975
|
-
if (
|
|
32018
|
+
if (y.platform !== "win32") return TERM !== "linux";
|
|
31976
32019
|
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";
|
|
31977
32020
|
}
|
|
31978
32021
|
|
|
@@ -32899,7 +32942,7 @@ const TEN_MEGABYTES_IN_BYTES = 10 * 1024 * 1024;
|
|
|
32899
32942
|
|
|
32900
32943
|
//#endregion
|
|
32901
32944
|
//#region node_modules/npm-run-path/index.js
|
|
32902
|
-
const npmRunPath = ({ cwd =
|
|
32945
|
+
const npmRunPath = ({ cwd = y.cwd(), path: pathOption = y.env[pathKey()], preferLocal = true, execPath: execPath$1 = y.execPath, addExecPath = true } = {}) => {
|
|
32903
32946
|
const cwdPath = path.resolve(toPath(cwd));
|
|
32904
32947
|
const result = [];
|
|
32905
32948
|
const pathParts = pathOption.split(path.delimiter);
|
|
@@ -32917,7 +32960,7 @@ const applyExecPath = (result, pathParts, execPath$1, cwdPath) => {
|
|
|
32917
32960
|
const pathPart = path.resolve(cwdPath, toPath(execPath$1), "..");
|
|
32918
32961
|
if (!pathParts.includes(pathPart)) result.push(pathPart);
|
|
32919
32962
|
};
|
|
32920
|
-
const npmRunPathEnv = ({ env: env$1 =
|
|
32963
|
+
const npmRunPathEnv = ({ env: env$1 = y.env, ...options } = {}) => {
|
|
32921
32964
|
env$1 = { ...env$1 };
|
|
32922
32965
|
const pathName = pathKey({ env: env$1 });
|
|
32923
32966
|
options.path = env$1[pathName];
|
|
@@ -34052,7 +34095,7 @@ const normalizeCwd = (cwd = getDefaultCwd()) => {
|
|
|
34052
34095
|
};
|
|
34053
34096
|
const getDefaultCwd = () => {
|
|
34054
34097
|
try {
|
|
34055
|
-
return
|
|
34098
|
+
return y.cwd();
|
|
34056
34099
|
} catch (error) {
|
|
34057
34100
|
error.message = `The current directory does not exist.\n${error.message}`;
|
|
34058
34101
|
throw error;
|
|
@@ -34087,7 +34130,7 @@ const normalizeOptions = (filePath, rawArguments, rawOptions) => {
|
|
|
34087
34130
|
options.killSignal = normalizeKillSignal(options.killSignal);
|
|
34088
34131
|
options.forceKillAfterDelay = normalizeForceKillAfterDelay(options.forceKillAfterDelay);
|
|
34089
34132
|
options.lines = options.lines.map((lines, fdNumber) => lines && !BINARY_ENCODINGS.has(options.encoding) && options.buffer[fdNumber]);
|
|
34090
|
-
if (
|
|
34133
|
+
if (y.platform === "win32" && path.basename(file, ".exe") === "cmd") commandArguments.unshift("/q");
|
|
34091
34134
|
return {
|
|
34092
34135
|
file,
|
|
34093
34136
|
commandArguments,
|
|
@@ -34114,7 +34157,7 @@ const addDefaultOptions = ({ extendEnv = true, preferLocal = false, cwd, localDi
|
|
|
34114
34157
|
});
|
|
34115
34158
|
const getEnv = ({ env: envOption, extendEnv, preferLocal, node, localDirectory, nodePath }) => {
|
|
34116
34159
|
const env$1 = extendEnv ? {
|
|
34117
|
-
...
|
|
34160
|
+
...y.env,
|
|
34118
34161
|
...envOption
|
|
34119
34162
|
} : envOption;
|
|
34120
34163
|
if (preferLocal || node) return npmRunPathEnv({
|
|
@@ -35114,12 +35157,12 @@ const guessStreamDirection = {
|
|
|
35114
35157
|
}
|
|
35115
35158
|
};
|
|
35116
35159
|
const getStandardStreamDirection = (value) => {
|
|
35117
|
-
if ([0,
|
|
35160
|
+
if ([0, y.stdin].includes(value)) return "input";
|
|
35118
35161
|
if ([
|
|
35119
35162
|
1,
|
|
35120
35163
|
2,
|
|
35121
|
-
|
|
35122
|
-
|
|
35164
|
+
y.stdout,
|
|
35165
|
+
y.stderr
|
|
35123
35166
|
].includes(value)) return "output";
|
|
35124
35167
|
};
|
|
35125
35168
|
const DEFAULT_DIRECTION = "output";
|
|
@@ -36183,9 +36226,9 @@ const addIpcMethods = (subprocess, { ipc }) => {
|
|
|
36183
36226
|
Object.assign(subprocess, getIpcMethods(subprocess, false, ipc));
|
|
36184
36227
|
};
|
|
36185
36228
|
const getIpcExport = () => {
|
|
36186
|
-
const anyProcess =
|
|
36229
|
+
const anyProcess = y;
|
|
36187
36230
|
const isSubprocess = true;
|
|
36188
|
-
const ipc =
|
|
36231
|
+
const ipc = y.channel !== void 0;
|
|
36189
36232
|
return {
|
|
36190
36233
|
...getIpcMethods(anyProcess, isSubprocess, ipc),
|
|
36191
36234
|
getCancelSignal: getCancelSignal$1.bind(void 0, {
|
|
@@ -36427,7 +36470,7 @@ if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SI
|
|
|
36427
36470
|
|
|
36428
36471
|
//#endregion
|
|
36429
36472
|
//#region node_modules/signal-exit/dist/mjs/index.js
|
|
36430
|
-
const processOk = (process$
|
|
36473
|
+
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";
|
|
36431
36474
|
const kExitEmitter = Symbol.for("signal-exit emitter");
|
|
36432
36475
|
const global$1 = globalThis;
|
|
36433
36476
|
const ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
@@ -36495,7 +36538,7 @@ var SignalExitFallback = class extends SignalExitBase {
|
|
|
36495
36538
|
};
|
|
36496
36539
|
var SignalExit = class extends SignalExitBase {
|
|
36497
36540
|
/* c8 ignore start */
|
|
36498
|
-
#hupSig = process$
|
|
36541
|
+
#hupSig = process$1.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
36499
36542
|
/* c8 ignore stop */
|
|
36500
36543
|
#emitter = new Emitter();
|
|
36501
36544
|
#process;
|
|
@@ -36503,15 +36546,15 @@ var SignalExit = class extends SignalExitBase {
|
|
|
36503
36546
|
#originalProcessReallyExit;
|
|
36504
36547
|
#sigListeners = {};
|
|
36505
36548
|
#loaded = false;
|
|
36506
|
-
constructor(process$
|
|
36549
|
+
constructor(process$4) {
|
|
36507
36550
|
super();
|
|
36508
|
-
this.#process = process$
|
|
36551
|
+
this.#process = process$4;
|
|
36509
36552
|
this.#sigListeners = {};
|
|
36510
36553
|
for (const sig of signals) this.#sigListeners[sig] = () => {
|
|
36511
36554
|
const listeners = this.#process.listeners(sig);
|
|
36512
36555
|
let { count: count$1 } = this.#emitter;
|
|
36513
36556
|
/* c8 ignore start */
|
|
36514
|
-
const p$1 = process$
|
|
36557
|
+
const p$1 = process$4;
|
|
36515
36558
|
if (typeof p$1.__signal_exit_emitter__ === "object" && typeof p$1.__signal_exit_emitter__.count === "number") count$1 += p$1.__signal_exit_emitter__.count;
|
|
36516
36559
|
/* c8 ignore stop */
|
|
36517
36560
|
if (listeners.length === count$1) {
|
|
@@ -36519,11 +36562,11 @@ var SignalExit = class extends SignalExitBase {
|
|
|
36519
36562
|
const ret = this.#emitter.emit("exit", null, sig);
|
|
36520
36563
|
/* c8 ignore start */
|
|
36521
36564
|
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
36522
|
-
if (!ret) process$
|
|
36565
|
+
if (!ret) process$4.kill(process$4.pid, s);
|
|
36523
36566
|
}
|
|
36524
36567
|
};
|
|
36525
|
-
this.#originalProcessReallyExit = process$
|
|
36526
|
-
this.#originalProcessEmit = process$
|
|
36568
|
+
this.#originalProcessReallyExit = process$4.reallyExit;
|
|
36569
|
+
this.#originalProcessEmit = process$4.emit;
|
|
36527
36570
|
}
|
|
36528
36571
|
onExit(cb, opts) {
|
|
36529
36572
|
/* c8 ignore start */
|
|
@@ -36590,8 +36633,8 @@ var SignalExit = class extends SignalExitBase {
|
|
|
36590
36633
|
} else return og.call(this.#process, ev, ...args);
|
|
36591
36634
|
}
|
|
36592
36635
|
};
|
|
36593
|
-
const process$
|
|
36594
|
-
const { onExit, load, unload } = signalExitWrap(processOk(process$
|
|
36636
|
+
const process$1 = globalThis.process;
|
|
36637
|
+
const { onExit, load, unload } = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
|
|
36595
36638
|
|
|
36596
36639
|
//#endregion
|
|
36597
36640
|
//#region node_modules/execa/lib/terminate/cleanup.js
|
|
@@ -38545,7 +38588,7 @@ function isInsideContainer() {
|
|
|
38545
38588
|
//#endregion
|
|
38546
38589
|
//#region node_modules/is-wsl/index.js
|
|
38547
38590
|
const isWsl = () => {
|
|
38548
|
-
if (
|
|
38591
|
+
if (y.platform !== "linux") return false;
|
|
38549
38592
|
if (os.release().toLowerCase().includes("microsoft")) {
|
|
38550
38593
|
if (isInsideContainer()) return false;
|
|
38551
38594
|
return true;
|
|
@@ -38556,12 +38599,12 @@ const isWsl = () => {
|
|
|
38556
38599
|
return false;
|
|
38557
38600
|
}
|
|
38558
38601
|
};
|
|
38559
|
-
var is_wsl_default =
|
|
38602
|
+
var is_wsl_default = y.env.__IS_WSL_TEST__ ? isWsl : isWsl();
|
|
38560
38603
|
|
|
38561
38604
|
//#endregion
|
|
38562
38605
|
//#region node_modules/powershell-utils/index.js
|
|
38563
38606
|
const execFile$2 = promisify(childProcess.execFile);
|
|
38564
|
-
const powerShellPath$1 = () => `${
|
|
38607
|
+
const powerShellPath$1 = () => `${y.env.SYSTEMROOT || y.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
|
|
38565
38608
|
const executePowerShell = async (command, options = {}) => {
|
|
38566
38609
|
const { powerShellPath: psPath, ...execFileOptions } = options;
|
|
38567
38610
|
const encodedCommand = executePowerShell.encodeCommand(command);
|
|
@@ -38672,7 +38715,7 @@ function defineLazyProperty(object$1, propertyName, valueGetter) {
|
|
|
38672
38715
|
//#region node_modules/default-browser-id/index.js
|
|
38673
38716
|
const execFileAsync$3 = promisify(execFile);
|
|
38674
38717
|
async function defaultBrowserId() {
|
|
38675
|
-
if (
|
|
38718
|
+
if (y.platform !== "darwin") throw new Error("macOS only");
|
|
38676
38719
|
const { stdout: stdout$1 } = await execFileAsync$3("defaults", [
|
|
38677
38720
|
"read",
|
|
38678
38721
|
"com.apple.LaunchServices/com.apple.launchservices.secure",
|
|
@@ -38687,7 +38730,7 @@ async function defaultBrowserId() {
|
|
|
38687
38730
|
//#region node_modules/run-applescript/index.js
|
|
38688
38731
|
const execFileAsync$2 = promisify(execFile);
|
|
38689
38732
|
async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
|
|
38690
|
-
if (
|
|
38733
|
+
if (y.platform !== "darwin") throw new Error("macOS only");
|
|
38691
38734
|
const outputArguments = humanReadableOutput ? [] : ["-ss"];
|
|
38692
38735
|
const execOptions = {};
|
|
38693
38736
|
if (signal) execOptions.signal = signal;
|
|
@@ -38796,14 +38839,14 @@ async function defaultBrowser$1(_execFileAsync = execFileAsync$1) {
|
|
|
38796
38839
|
const execFileAsync = promisify(execFile);
|
|
38797
38840
|
const titleize = (string$2) => string$2.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x$2) => x$2.toUpperCase());
|
|
38798
38841
|
async function defaultBrowser() {
|
|
38799
|
-
if (
|
|
38842
|
+
if (y.platform === "darwin") {
|
|
38800
38843
|
const id = await defaultBrowserId();
|
|
38801
38844
|
return {
|
|
38802
38845
|
name: await bundleName(id),
|
|
38803
38846
|
id
|
|
38804
38847
|
};
|
|
38805
38848
|
}
|
|
38806
|
-
if (
|
|
38849
|
+
if (y.platform === "linux") {
|
|
38807
38850
|
const { stdout: stdout$1 } = await execFileAsync("xdg-mime", [
|
|
38808
38851
|
"query",
|
|
38809
38852
|
"default",
|
|
@@ -38815,13 +38858,13 @@ async function defaultBrowser() {
|
|
|
38815
38858
|
id
|
|
38816
38859
|
};
|
|
38817
38860
|
}
|
|
38818
|
-
if (
|
|
38861
|
+
if (y.platform === "win32") return defaultBrowser$1();
|
|
38819
38862
|
throw new Error("Only macOS, Linux, and Windows are supported");
|
|
38820
38863
|
}
|
|
38821
38864
|
|
|
38822
38865
|
//#endregion
|
|
38823
38866
|
//#region node_modules/is-in-ssh/index.js
|
|
38824
|
-
const isInSsh = Boolean(
|
|
38867
|
+
const isInSsh = Boolean(y.env.SSH_CONNECTION || y.env.SSH_CLIENT || y.env.SSH_TTY);
|
|
38825
38868
|
var is_in_ssh_default = isInSsh;
|
|
38826
38869
|
|
|
38827
38870
|
//#endregion
|
|
@@ -38829,7 +38872,7 @@ var is_in_ssh_default = isInSsh;
|
|
|
38829
38872
|
const fallbackAttemptSymbol = Symbol("fallbackAttempt");
|
|
38830
38873
|
const __dirname = import.meta.url ? path.dirname(fileURLToPath(import.meta.url)) : "";
|
|
38831
38874
|
const localXdgOpenPath = path.join(__dirname, "xdg-open");
|
|
38832
|
-
const { platform: platform$1, arch } =
|
|
38875
|
+
const { platform: platform$1, arch } = y;
|
|
38833
38876
|
const tryEachApp = async (apps$1, opener) => {
|
|
38834
38877
|
if (apps$1.length === 0) return;
|
|
38835
38878
|
const errors = [];
|
|
@@ -38942,7 +38985,7 @@ const baseOpen = async (options) => {
|
|
|
38942
38985
|
await fs$1.access(localXdgOpenPath, constants$1.X_OK);
|
|
38943
38986
|
exeLocalXdgOpen = true;
|
|
38944
38987
|
} catch {}
|
|
38945
|
-
command =
|
|
38988
|
+
command = y.versions.electron ?? (platform$1 === "android" || isBundled || !exeLocalXdgOpen) ? "xdg-open" : localXdgOpenPath;
|
|
38946
38989
|
}
|
|
38947
38990
|
if (appArguments.length > 0) cliArguments.push(...appArguments);
|
|
38948
38991
|
if (!options.wait) {
|
|
@@ -39046,7 +39089,7 @@ var open_default = open;
|
|
|
39046
39089
|
//#region src/cli/commands/project/dashboard.ts
|
|
39047
39090
|
async function openDashboard() {
|
|
39048
39091
|
const dashboardUrl = getDashboardUrl();
|
|
39049
|
-
await open_default(dashboardUrl);
|
|
39092
|
+
if (!process.env.CI) await open_default(dashboardUrl);
|
|
39050
39093
|
return { outroMessage: `Dashboard opened at ${dashboardUrl}` };
|
|
39051
39094
|
}
|
|
39052
39095
|
const dashboardCommand = new Command("dashboard").description("Open the app dashboard in your browser").action(async () => {
|
|
@@ -39058,10 +39101,11 @@ const dashboardCommand = new Command("dashboard").description("Open the app dash
|
|
|
39058
39101
|
async function deployAction$1(options) {
|
|
39059
39102
|
const projectData = await readProjectConfig();
|
|
39060
39103
|
if (!hasResourcesToDeploy(projectData)) return { outroMessage: "No resources found to deploy" };
|
|
39061
|
-
const { project, entities, functions } = projectData;
|
|
39104
|
+
const { project, entities, functions, agents } = projectData;
|
|
39062
39105
|
const summaryLines = [];
|
|
39063
39106
|
if (entities.length > 0) summaryLines.push(` - ${entities.length} ${entities.length === 1 ? "entity" : "entities"}`);
|
|
39064
39107
|
if (functions.length > 0) summaryLines.push(` - ${functions.length} ${functions.length === 1 ? "function" : "functions"}`);
|
|
39108
|
+
if (agents.length > 0) summaryLines.push(` - ${agents.length} ${agents.length === 1 ? "agent" : "agents"}`);
|
|
39065
39109
|
if (project.site?.outputDirectory) summaryLines.push(` - Site from ${project.site.outputDirectory}`);
|
|
39066
39110
|
if (!options.yes) {
|
|
39067
39111
|
M.warn(`This will update your Base44 app with:\n${summaryLines.join("\n")}`);
|
|
@@ -39078,7 +39122,7 @@ async function deployAction$1(options) {
|
|
|
39078
39122
|
if (result.appUrl) M.message(`${theme.styles.header("App URL")}: ${theme.colors.links(result.appUrl)}`);
|
|
39079
39123
|
return { outroMessage: "App deployed successfully" };
|
|
39080
39124
|
}
|
|
39081
|
-
const deployCommand = new Command("deploy").description("Deploy all project resources (entities, functions, and site)").option("-y, --yes", "Skip confirmation prompt").action(async (options) => {
|
|
39125
|
+
const deployCommand = new Command("deploy").description("Deploy all project resources (entities, functions, agents, and site)").option("-y, --yes", "Skip confirmation prompt").action(async (options) => {
|
|
39082
39126
|
await runCommand(() => deployAction$1(options), { requireAuth: true });
|
|
39083
39127
|
});
|
|
39084
39128
|
|
|
@@ -39223,9 +39267,329 @@ const siteDeployCommand = new Command("site").description("Manage site deploymen
|
|
|
39223
39267
|
await runCommand(() => deployAction(options), { requireAuth: true });
|
|
39224
39268
|
}));
|
|
39225
39269
|
|
|
39270
|
+
//#endregion
|
|
39271
|
+
//#region src/core/connectors/schema.ts
|
|
39272
|
+
/**
|
|
39273
|
+
* Response from POST /api/apps/{app_id}/external-auth/initiate
|
|
39274
|
+
*/
|
|
39275
|
+
const InitiateResponseSchema = object({
|
|
39276
|
+
redirect_url: string().nullish(),
|
|
39277
|
+
connection_id: string().nullish(),
|
|
39278
|
+
already_authorized: boolean().nullish(),
|
|
39279
|
+
other_user_email: string().nullish(),
|
|
39280
|
+
error: string().nullish()
|
|
39281
|
+
}).transform((data) => ({
|
|
39282
|
+
redirectUrl: data.redirect_url,
|
|
39283
|
+
connectionId: data.connection_id,
|
|
39284
|
+
alreadyAuthorized: data.already_authorized,
|
|
39285
|
+
otherUserEmail: data.other_user_email,
|
|
39286
|
+
error: data.error
|
|
39287
|
+
}));
|
|
39288
|
+
/**
|
|
39289
|
+
* Response from GET /api/apps/{app_id}/external-auth/status
|
|
39290
|
+
*/
|
|
39291
|
+
const StatusResponseSchema = object({
|
|
39292
|
+
status: _enum([
|
|
39293
|
+
"ACTIVE",
|
|
39294
|
+
"PENDING",
|
|
39295
|
+
"FAILED"
|
|
39296
|
+
]),
|
|
39297
|
+
account_email: string().nullish(),
|
|
39298
|
+
error: string().nullish()
|
|
39299
|
+
}).transform((data) => ({
|
|
39300
|
+
status: data.status,
|
|
39301
|
+
accountEmail: data.account_email,
|
|
39302
|
+
error: data.error
|
|
39303
|
+
}));
|
|
39304
|
+
/**
|
|
39305
|
+
* A connected integration from the list endpoint
|
|
39306
|
+
*/
|
|
39307
|
+
const ConnectorSchema = object({
|
|
39308
|
+
integration_type: string(),
|
|
39309
|
+
status: string(),
|
|
39310
|
+
connected_at: string().nullish(),
|
|
39311
|
+
account_info: object({
|
|
39312
|
+
email: string().nullish(),
|
|
39313
|
+
name: string().nullish()
|
|
39314
|
+
}).nullish()
|
|
39315
|
+
}).transform((data) => ({
|
|
39316
|
+
integrationType: data.integration_type,
|
|
39317
|
+
status: data.status,
|
|
39318
|
+
connectedAt: data.connected_at,
|
|
39319
|
+
accountInfo: data.account_info
|
|
39320
|
+
}));
|
|
39321
|
+
/**
|
|
39322
|
+
* Response from GET /api/apps/{app_id}/external-auth/list
|
|
39323
|
+
*/
|
|
39324
|
+
const ListResponseSchema = object({ integrations: array(ConnectorSchema) });
|
|
39325
|
+
|
|
39326
|
+
//#endregion
|
|
39327
|
+
//#region src/core/connectors/api.ts
|
|
39328
|
+
/**
|
|
39329
|
+
* Initiates OAuth flow for a connector integration.
|
|
39330
|
+
* Returns a redirect URL to open in the browser.
|
|
39331
|
+
*/
|
|
39332
|
+
async function initiateOAuth(integrationType, scopes = null) {
|
|
39333
|
+
const json = await (await getAppClient().post("external-auth/initiate", { json: {
|
|
39334
|
+
integration_type: integrationType,
|
|
39335
|
+
scopes
|
|
39336
|
+
} })).json();
|
|
39337
|
+
return InitiateResponseSchema.parse(json);
|
|
39338
|
+
}
|
|
39339
|
+
/**
|
|
39340
|
+
* Checks the status of an OAuth connection attempt.
|
|
39341
|
+
*/
|
|
39342
|
+
async function checkOAuthStatus(integrationType, connectionId) {
|
|
39343
|
+
const json = await (await getAppClient().get("external-auth/status", { searchParams: {
|
|
39344
|
+
integration_type: integrationType,
|
|
39345
|
+
connection_id: connectionId
|
|
39346
|
+
} })).json();
|
|
39347
|
+
return StatusResponseSchema.parse(json);
|
|
39348
|
+
}
|
|
39349
|
+
/**
|
|
39350
|
+
* Lists all connected integrations for the current app.
|
|
39351
|
+
*/
|
|
39352
|
+
async function listConnectors() {
|
|
39353
|
+
const json = await (await getAppClient().get("external-auth/list")).json();
|
|
39354
|
+
return ListResponseSchema.parse(json).integrations;
|
|
39355
|
+
}
|
|
39356
|
+
/**
|
|
39357
|
+
* Disconnects (soft delete) a connector integration.
|
|
39358
|
+
*/
|
|
39359
|
+
async function disconnectConnector(integrationType) {
|
|
39360
|
+
await getAppClient().delete(`external-auth/integrations/${integrationType}`);
|
|
39361
|
+
}
|
|
39362
|
+
/**
|
|
39363
|
+
* Removes (hard delete) a connector integration.
|
|
39364
|
+
* This permanently removes the connector and cannot be undone.
|
|
39365
|
+
*/
|
|
39366
|
+
async function removeConnector(integrationType) {
|
|
39367
|
+
await getAppClient().delete(`external-auth/integrations/${integrationType}/remove`);
|
|
39368
|
+
}
|
|
39369
|
+
|
|
39370
|
+
//#endregion
|
|
39371
|
+
//#region src/core/connectors/consts.ts
|
|
39372
|
+
/**
|
|
39373
|
+
* Supported OAuth connector integrations.
|
|
39374
|
+
* Based on apper/backend/app/external_auth/models/constants.py
|
|
39375
|
+
*/
|
|
39376
|
+
const SUPPORTED_INTEGRATIONS = [
|
|
39377
|
+
"googlecalendar",
|
|
39378
|
+
"googledrive",
|
|
39379
|
+
"gmail",
|
|
39380
|
+
"googlesheets",
|
|
39381
|
+
"googledocs",
|
|
39382
|
+
"googleslides",
|
|
39383
|
+
"slack",
|
|
39384
|
+
"notion",
|
|
39385
|
+
"salesforce",
|
|
39386
|
+
"hubspot",
|
|
39387
|
+
"linkedin",
|
|
39388
|
+
"tiktok"
|
|
39389
|
+
];
|
|
39390
|
+
/**
|
|
39391
|
+
* Display names for integrations (for CLI output)
|
|
39392
|
+
*/
|
|
39393
|
+
const INTEGRATION_DISPLAY_NAMES = {
|
|
39394
|
+
googlecalendar: "Google Calendar",
|
|
39395
|
+
googledrive: "Google Drive",
|
|
39396
|
+
gmail: "Gmail",
|
|
39397
|
+
googlesheets: "Google Sheets",
|
|
39398
|
+
googledocs: "Google Docs",
|
|
39399
|
+
googleslides: "Google Slides",
|
|
39400
|
+
slack: "Slack",
|
|
39401
|
+
notion: "Notion",
|
|
39402
|
+
salesforce: "Salesforce",
|
|
39403
|
+
hubspot: "HubSpot",
|
|
39404
|
+
linkedin: "LinkedIn",
|
|
39405
|
+
tiktok: "TikTok"
|
|
39406
|
+
};
|
|
39407
|
+
function isValidIntegration(type) {
|
|
39408
|
+
return SUPPORTED_INTEGRATIONS.includes(type);
|
|
39409
|
+
}
|
|
39410
|
+
function getIntegrationDisplayName(type) {
|
|
39411
|
+
return INTEGRATION_DISPLAY_NAMES[type] ?? type;
|
|
39412
|
+
}
|
|
39413
|
+
|
|
39414
|
+
//#endregion
|
|
39415
|
+
//#region src/cli/commands/connectors/utils.ts
|
|
39416
|
+
const OAUTH_POLL_INTERVAL_MS = 2e3;
|
|
39417
|
+
const OAUTH_POLL_TIMEOUT_MS = 300 * 1e3;
|
|
39418
|
+
/**
|
|
39419
|
+
* Polls for OAuth completion status.
|
|
39420
|
+
* Returns when status becomes ACTIVE or FAILED, or times out.
|
|
39421
|
+
*/
|
|
39422
|
+
async function waitForOAuthCompletion(integrationType, connectionId, options) {
|
|
39423
|
+
let accountEmail;
|
|
39424
|
+
let error;
|
|
39425
|
+
try {
|
|
39426
|
+
await pWaitFor(async () => {
|
|
39427
|
+
const status = await checkOAuthStatus(integrationType, connectionId);
|
|
39428
|
+
if (status.status === "ACTIVE") {
|
|
39429
|
+
accountEmail = status.accountEmail ?? void 0;
|
|
39430
|
+
return true;
|
|
39431
|
+
}
|
|
39432
|
+
if (status.status === "FAILED") {
|
|
39433
|
+
error = status.error || "Authorization failed";
|
|
39434
|
+
throw new Error(error);
|
|
39435
|
+
}
|
|
39436
|
+
options?.onPending?.();
|
|
39437
|
+
return false;
|
|
39438
|
+
}, {
|
|
39439
|
+
interval: OAUTH_POLL_INTERVAL_MS,
|
|
39440
|
+
timeout: OAUTH_POLL_TIMEOUT_MS
|
|
39441
|
+
});
|
|
39442
|
+
return {
|
|
39443
|
+
success: true,
|
|
39444
|
+
accountEmail
|
|
39445
|
+
};
|
|
39446
|
+
} catch (err) {
|
|
39447
|
+
if (err instanceof Error && err.message.includes("timed out")) return {
|
|
39448
|
+
success: false,
|
|
39449
|
+
error: "Authorization timed out. Please try again."
|
|
39450
|
+
};
|
|
39451
|
+
return {
|
|
39452
|
+
success: false,
|
|
39453
|
+
error: error || (err instanceof Error ? err.message : "Unknown error")
|
|
39454
|
+
};
|
|
39455
|
+
}
|
|
39456
|
+
}
|
|
39457
|
+
/**
|
|
39458
|
+
* Asserts that a string is a valid integration type, throwing if not.
|
|
39459
|
+
*/
|
|
39460
|
+
function assertValidIntegrationType(type, supportedIntegrations) {
|
|
39461
|
+
if (!supportedIntegrations.includes(type)) {
|
|
39462
|
+
const supportedList = supportedIntegrations.join(", ");
|
|
39463
|
+
throw new Error(`Unsupported connector: ${type}\nSupported connectors: ${supportedList}`);
|
|
39464
|
+
}
|
|
39465
|
+
}
|
|
39466
|
+
|
|
39467
|
+
//#endregion
|
|
39468
|
+
//#region src/cli/commands/connectors/add.ts
|
|
39469
|
+
async function promptForIntegrationType() {
|
|
39470
|
+
const selected = await ve({
|
|
39471
|
+
message: "Select an integration to connect:",
|
|
39472
|
+
options: Object.entries(INTEGRATION_DISPLAY_NAMES).map(([type, displayName]) => ({
|
|
39473
|
+
value: type,
|
|
39474
|
+
label: displayName
|
|
39475
|
+
}))
|
|
39476
|
+
});
|
|
39477
|
+
if (pD(selected)) {
|
|
39478
|
+
xe("Operation cancelled.");
|
|
39479
|
+
process.exit(0);
|
|
39480
|
+
}
|
|
39481
|
+
return selected;
|
|
39482
|
+
}
|
|
39483
|
+
async function pollForOAuthCompletion(integrationType, connectionId) {
|
|
39484
|
+
return await runTask("Waiting for authorization...", async () => {
|
|
39485
|
+
return await waitForOAuthCompletion(integrationType, connectionId);
|
|
39486
|
+
}, {
|
|
39487
|
+
successMessage: "Authorization completed!",
|
|
39488
|
+
errorMessage: "Authorization failed"
|
|
39489
|
+
});
|
|
39490
|
+
}
|
|
39491
|
+
async function addConnector(integrationType) {
|
|
39492
|
+
let selectedType;
|
|
39493
|
+
if (integrationType) {
|
|
39494
|
+
assertValidIntegrationType(integrationType, SUPPORTED_INTEGRATIONS);
|
|
39495
|
+
selectedType = integrationType;
|
|
39496
|
+
} else selectedType = await promptForIntegrationType();
|
|
39497
|
+
const displayName = getIntegrationDisplayName(selectedType);
|
|
39498
|
+
const initiateResponse = await runTask(`Initiating ${displayName} connection...`, async () => {
|
|
39499
|
+
return await initiateOAuth(selectedType);
|
|
39500
|
+
}, {
|
|
39501
|
+
successMessage: `${displayName} OAuth initiated`,
|
|
39502
|
+
errorMessage: `Failed to initiate ${displayName} connection`
|
|
39503
|
+
});
|
|
39504
|
+
if (initiateResponse.alreadyAuthorized) return { outroMessage: `Already connected to ${theme.styles.bold(displayName)}` };
|
|
39505
|
+
if (initiateResponse.error === "different_user" && initiateResponse.otherUserEmail) throw new Error(`This app is already connected to ${displayName} by ${initiateResponse.otherUserEmail}`);
|
|
39506
|
+
if (!initiateResponse.redirectUrl || !initiateResponse.connectionId) throw new Error("Invalid response from server: missing redirect URL or connection ID");
|
|
39507
|
+
M.info(`Please authorize ${displayName} at:\n${theme.colors.links(initiateResponse.redirectUrl)}`);
|
|
39508
|
+
const result = await pollForOAuthCompletion(selectedType, initiateResponse.connectionId);
|
|
39509
|
+
if (!result.success) throw new Error(result.error || "Authorization failed");
|
|
39510
|
+
const accountInfo = result.accountEmail ? ` as ${theme.styles.bold(result.accountEmail)}` : "";
|
|
39511
|
+
return { outroMessage: `Successfully connected to ${theme.styles.bold(displayName)}${accountInfo}` };
|
|
39512
|
+
}
|
|
39513
|
+
const connectorsAddCommand = new Command("add").argument("[type]", "Integration type (e.g., slack, notion, googlecalendar)").description("Connect an OAuth integration").action(async (type) => {
|
|
39514
|
+
await runCommand(() => addConnector(type), {
|
|
39515
|
+
requireAuth: true,
|
|
39516
|
+
requireAppConfig: true
|
|
39517
|
+
});
|
|
39518
|
+
});
|
|
39519
|
+
|
|
39520
|
+
//#endregion
|
|
39521
|
+
//#region src/cli/commands/connectors/remove.ts
|
|
39522
|
+
function mapBackendConnectors(connectors) {
|
|
39523
|
+
return connectors.filter((c$1) => isValidIntegration(c$1.integrationType)).map((c$1) => ({
|
|
39524
|
+
type: c$1.integrationType,
|
|
39525
|
+
displayName: getIntegrationDisplayName(c$1.integrationType),
|
|
39526
|
+
accountEmail: (c$1.accountInfo?.email || c$1.accountInfo?.name) ?? void 0
|
|
39527
|
+
}));
|
|
39528
|
+
}
|
|
39529
|
+
function validateConnectorType(type, connectors) {
|
|
39530
|
+
if (!isValidIntegration(type)) throw new Error(`Invalid connector type: ${type}`);
|
|
39531
|
+
const connector = connectors.find((c$1) => c$1.type === type);
|
|
39532
|
+
if (!connector) throw new Error(`No ${getIntegrationDisplayName(type)} connector found`);
|
|
39533
|
+
return connector;
|
|
39534
|
+
}
|
|
39535
|
+
async function promptForConnectorToRemove(connectors) {
|
|
39536
|
+
const selected = await ve({
|
|
39537
|
+
message: "Select a connector to remove:",
|
|
39538
|
+
options: connectors.map((c$1) => {
|
|
39539
|
+
let label = c$1.displayName;
|
|
39540
|
+
if (c$1.accountEmail) label += ` (${c$1.accountEmail})`;
|
|
39541
|
+
return {
|
|
39542
|
+
value: c$1.type,
|
|
39543
|
+
label
|
|
39544
|
+
};
|
|
39545
|
+
})
|
|
39546
|
+
});
|
|
39547
|
+
if (pD(selected)) {
|
|
39548
|
+
xe("Operation cancelled.");
|
|
39549
|
+
process.exit(0);
|
|
39550
|
+
}
|
|
39551
|
+
return connectors.find((c$1) => c$1.type === selected);
|
|
39552
|
+
}
|
|
39553
|
+
async function removeConnectorCommand(integrationType, options = {}) {
|
|
39554
|
+
const isHardDelete = options.hard === true;
|
|
39555
|
+
const connectors = mapBackendConnectors(await runTask("Fetching connectors...", async () => listConnectors(), {
|
|
39556
|
+
successMessage: "Connectors loaded",
|
|
39557
|
+
errorMessage: "Failed to fetch connectors"
|
|
39558
|
+
}));
|
|
39559
|
+
if (connectors.length === 0) return { outroMessage: "No connectors to remove" };
|
|
39560
|
+
const selectedConnector = integrationType ? validateConnectorType(integrationType, connectors) : await promptForConnectorToRemove(connectors);
|
|
39561
|
+
const displayName = selectedConnector.displayName;
|
|
39562
|
+
const accountInfo = selectedConnector.accountEmail ? ` (${selectedConnector.accountEmail})` : "";
|
|
39563
|
+
if (!options.yes) {
|
|
39564
|
+
const shouldRemove = await ye({ message: `${isHardDelete ? "Permanently remove" : "Remove"} ${displayName}${accountInfo}?` });
|
|
39565
|
+
if (pD(shouldRemove) || !shouldRemove) {
|
|
39566
|
+
xe("Operation cancelled.");
|
|
39567
|
+
process.exit(0);
|
|
39568
|
+
}
|
|
39569
|
+
}
|
|
39570
|
+
await runTask(`Removing ${displayName}...`, async () => {
|
|
39571
|
+
if (isHardDelete) await removeConnector(selectedConnector.type);
|
|
39572
|
+
else await disconnectConnector(selectedConnector.type);
|
|
39573
|
+
}, {
|
|
39574
|
+
successMessage: `${displayName} removed`,
|
|
39575
|
+
errorMessage: `Failed to remove ${displayName}`
|
|
39576
|
+
});
|
|
39577
|
+
return { outroMessage: `Successfully removed ${theme.styles.bold(displayName)}` };
|
|
39578
|
+
}
|
|
39579
|
+
const connectorsRemoveCommand = new Command("remove").argument("[type]", "Integration type to remove (e.g., slack, notion)").option("--hard", "Permanently remove the connector (cannot be undone)").option("-y, --yes", "Skip confirmation prompt").description("Remove an OAuth integration").action(async (type, options) => {
|
|
39580
|
+
await runCommand(() => removeConnectorCommand(type, options), {
|
|
39581
|
+
requireAuth: true,
|
|
39582
|
+
requireAppConfig: true
|
|
39583
|
+
});
|
|
39584
|
+
});
|
|
39585
|
+
|
|
39586
|
+
//#endregion
|
|
39587
|
+
//#region src/cli/commands/connectors/index.ts
|
|
39588
|
+
const connectorsCommand = new Command("connectors").description("Manage OAuth connectors").addCommand(connectorsAddCommand).addCommand(connectorsRemoveCommand);
|
|
39589
|
+
|
|
39226
39590
|
//#endregion
|
|
39227
39591
|
//#region package.json
|
|
39228
|
-
var version = "0.0.
|
|
39592
|
+
var version = "0.0.25";
|
|
39229
39593
|
|
|
39230
39594
|
//#endregion
|
|
39231
39595
|
//#region src/cli/program.ts
|
|
@@ -39243,6 +39607,7 @@ program.addCommand(entitiesPushCommand);
|
|
|
39243
39607
|
program.addCommand(agentsCommand);
|
|
39244
39608
|
program.addCommand(functionsDeployCommand);
|
|
39245
39609
|
program.addCommand(siteDeployCommand);
|
|
39610
|
+
program.addCommand(connectorsCommand);
|
|
39246
39611
|
|
|
39247
39612
|
//#endregion
|
|
39248
39613
|
export { CLIExitError, program };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@base44-preview/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.25-pr.104.2d197bb",
|
|
4
4
|
"description": "Base44 CLI - Unified interface for managing Base44 applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"dev": "./bin/dev.js",
|
|
17
17
|
"start": "./bin/run.js",
|
|
18
18
|
"clean": "rm -rf dist",
|
|
19
|
-
"lint": "eslint src",
|
|
19
|
+
"lint": "eslint src tests",
|
|
20
20
|
"test": "vitest run",
|
|
21
21
|
"test:watch": "vitest"
|
|
22
22
|
},
|
|
@@ -52,9 +52,12 @@
|
|
|
52
52
|
"json5": "^2.2.3",
|
|
53
53
|
"ky": "^1.14.2",
|
|
54
54
|
"lodash.kebabcase": "^4.1.1",
|
|
55
|
+
"msw": "^2.12.7",
|
|
55
56
|
"open": "^11.0.0",
|
|
56
57
|
"p-wait-for": "^6.0.0",
|
|
58
|
+
"strip-ansi": "^7.1.2",
|
|
57
59
|
"tar": "^7.5.4",
|
|
60
|
+
"tmp-promise": "^3.0.3",
|
|
58
61
|
"tsdown": "^0.12.4",
|
|
59
62
|
"tsx": "^4.19.2",
|
|
60
63
|
"typescript": "^5.7.2",
|
|
@@ -64,5 +67,8 @@
|
|
|
64
67
|
},
|
|
65
68
|
"engines": {
|
|
66
69
|
"node": ">=20.19.0"
|
|
70
|
+
},
|
|
71
|
+
"optionalDependencies": {
|
|
72
|
+
"@rollup/rollup-linux-x64-gnu": "^4.56.0"
|
|
67
73
|
}
|
|
68
74
|
}
|