@base44-preview/cli 0.0.47-pr.439.4472b1f → 0.0.47-pr.441.3070a4f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +504 -425
- package/dist/cli/index.js.map +43 -41
- package/package.json +2 -1
package/dist/cli/index.js
CHANGED
|
@@ -46,6 +46,134 @@ var __export = (target, all) => {
|
|
|
46
46
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
47
47
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
48
48
|
|
|
49
|
+
// ../../node_modules/picocolors/picocolors.js
|
|
50
|
+
var require_picocolors = __commonJS((exports, module) => {
|
|
51
|
+
var p = process || {};
|
|
52
|
+
var argv = p.argv || [];
|
|
53
|
+
var env = p.env || {};
|
|
54
|
+
var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
55
|
+
var formatter = (open, close, replace = open) => (input) => {
|
|
56
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
57
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
58
|
+
};
|
|
59
|
+
var replaceClose = (string, close, replace, index) => {
|
|
60
|
+
let result = "", cursor = 0;
|
|
61
|
+
do {
|
|
62
|
+
result += string.substring(cursor, index) + replace;
|
|
63
|
+
cursor = index + close.length;
|
|
64
|
+
index = string.indexOf(close, cursor);
|
|
65
|
+
} while (~index);
|
|
66
|
+
return result + string.substring(cursor);
|
|
67
|
+
};
|
|
68
|
+
var createColors = (enabled = isColorSupported) => {
|
|
69
|
+
let f = enabled ? formatter : () => String;
|
|
70
|
+
return {
|
|
71
|
+
isColorSupported: enabled,
|
|
72
|
+
reset: f("\x1B[0m", "\x1B[0m"),
|
|
73
|
+
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
74
|
+
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
75
|
+
italic: f("\x1B[3m", "\x1B[23m"),
|
|
76
|
+
underline: f("\x1B[4m", "\x1B[24m"),
|
|
77
|
+
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
78
|
+
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
79
|
+
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
80
|
+
black: f("\x1B[30m", "\x1B[39m"),
|
|
81
|
+
red: f("\x1B[31m", "\x1B[39m"),
|
|
82
|
+
green: f("\x1B[32m", "\x1B[39m"),
|
|
83
|
+
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
84
|
+
blue: f("\x1B[34m", "\x1B[39m"),
|
|
85
|
+
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
86
|
+
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
87
|
+
white: f("\x1B[37m", "\x1B[39m"),
|
|
88
|
+
gray: f("\x1B[90m", "\x1B[39m"),
|
|
89
|
+
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
90
|
+
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
91
|
+
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
92
|
+
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
93
|
+
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
94
|
+
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
95
|
+
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
96
|
+
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
97
|
+
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
98
|
+
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
99
|
+
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
100
|
+
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
101
|
+
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
102
|
+
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
103
|
+
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
104
|
+
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
105
|
+
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
106
|
+
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
107
|
+
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
108
|
+
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
109
|
+
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
110
|
+
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
111
|
+
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
112
|
+
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
module.exports = createColors();
|
|
116
|
+
module.exports.createColors = createColors;
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
// ../../node_modules/sisteransi/src/index.js
|
|
120
|
+
var require_src = __commonJS((exports, module) => {
|
|
121
|
+
var ESC = "\x1B";
|
|
122
|
+
var CSI = `${ESC}[`;
|
|
123
|
+
var beep = "\x07";
|
|
124
|
+
var cursor = {
|
|
125
|
+
to(x, y) {
|
|
126
|
+
if (!y)
|
|
127
|
+
return `${CSI}${x + 1}G`;
|
|
128
|
+
return `${CSI}${y + 1};${x + 1}H`;
|
|
129
|
+
},
|
|
130
|
+
move(x, y) {
|
|
131
|
+
let ret = "";
|
|
132
|
+
if (x < 0)
|
|
133
|
+
ret += `${CSI}${-x}D`;
|
|
134
|
+
else if (x > 0)
|
|
135
|
+
ret += `${CSI}${x}C`;
|
|
136
|
+
if (y < 0)
|
|
137
|
+
ret += `${CSI}${-y}A`;
|
|
138
|
+
else if (y > 0)
|
|
139
|
+
ret += `${CSI}${y}B`;
|
|
140
|
+
return ret;
|
|
141
|
+
},
|
|
142
|
+
up: (count = 1) => `${CSI}${count}A`,
|
|
143
|
+
down: (count = 1) => `${CSI}${count}B`,
|
|
144
|
+
forward: (count = 1) => `${CSI}${count}C`,
|
|
145
|
+
backward: (count = 1) => `${CSI}${count}D`,
|
|
146
|
+
nextLine: (count = 1) => `${CSI}E`.repeat(count),
|
|
147
|
+
prevLine: (count = 1) => `${CSI}F`.repeat(count),
|
|
148
|
+
left: `${CSI}G`,
|
|
149
|
+
hide: `${CSI}?25l`,
|
|
150
|
+
show: `${CSI}?25h`,
|
|
151
|
+
save: `${ESC}7`,
|
|
152
|
+
restore: `${ESC}8`
|
|
153
|
+
};
|
|
154
|
+
var scroll = {
|
|
155
|
+
up: (count = 1) => `${CSI}S`.repeat(count),
|
|
156
|
+
down: (count = 1) => `${CSI}T`.repeat(count)
|
|
157
|
+
};
|
|
158
|
+
var erase = {
|
|
159
|
+
screen: `${CSI}2J`,
|
|
160
|
+
up: (count = 1) => `${CSI}1J`.repeat(count),
|
|
161
|
+
down: (count = 1) => `${CSI}J`.repeat(count),
|
|
162
|
+
line: `${CSI}2K`,
|
|
163
|
+
lineEnd: `${CSI}K`,
|
|
164
|
+
lineStart: `${CSI}1K`,
|
|
165
|
+
lines(count) {
|
|
166
|
+
let clear = "";
|
|
167
|
+
for (let i = 0;i < count; i++)
|
|
168
|
+
clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
169
|
+
if (count)
|
|
170
|
+
clear += cursor.left;
|
|
171
|
+
return clear;
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
module.exports = { cursor, scroll, erase, beep };
|
|
175
|
+
});
|
|
176
|
+
|
|
49
177
|
// ../../node_modules/commander/lib/error.js
|
|
50
178
|
var require_error = __commonJS((exports) => {
|
|
51
179
|
class CommanderError extends Error {
|
|
@@ -555,28 +683,28 @@ var require_suggestSimilar = __commonJS((exports) => {
|
|
|
555
683
|
function editDistance(a, b) {
|
|
556
684
|
if (Math.abs(a.length - b.length) > maxDistance)
|
|
557
685
|
return Math.max(a.length, b.length);
|
|
558
|
-
const
|
|
686
|
+
const d2 = [];
|
|
559
687
|
for (let i = 0;i <= a.length; i++) {
|
|
560
|
-
|
|
688
|
+
d2[i] = [i];
|
|
561
689
|
}
|
|
562
|
-
for (let
|
|
563
|
-
|
|
690
|
+
for (let j2 = 0;j2 <= b.length; j2++) {
|
|
691
|
+
d2[0][j2] = j2;
|
|
564
692
|
}
|
|
565
|
-
for (let
|
|
693
|
+
for (let j2 = 1;j2 <= b.length; j2++) {
|
|
566
694
|
for (let i = 1;i <= a.length; i++) {
|
|
567
695
|
let cost = 1;
|
|
568
|
-
if (a[i - 1] === b[
|
|
696
|
+
if (a[i - 1] === b[j2 - 1]) {
|
|
569
697
|
cost = 0;
|
|
570
698
|
} else {
|
|
571
699
|
cost = 1;
|
|
572
700
|
}
|
|
573
|
-
|
|
574
|
-
if (i > 1 &&
|
|
575
|
-
|
|
701
|
+
d2[i][j2] = Math.min(d2[i - 1][j2] + 1, d2[i][j2 - 1] + 1, d2[i - 1][j2 - 1] + cost);
|
|
702
|
+
if (i > 1 && j2 > 1 && a[i - 1] === b[j2 - 2] && a[i - 2] === b[j2 - 1]) {
|
|
703
|
+
d2[i][j2] = Math.min(d2[i][j2], d2[i - 2][j2 - 2] + 1);
|
|
576
704
|
}
|
|
577
705
|
}
|
|
578
706
|
}
|
|
579
|
-
return
|
|
707
|
+
return d2[a.length][b.length];
|
|
580
708
|
}
|
|
581
709
|
function suggestSimilar(word, candidates) {
|
|
582
710
|
if (!candidates || candidates.length === 0)
|
|
@@ -1885,134 +2013,6 @@ var require_commander = __commonJS((exports) => {
|
|
|
1885
2013
|
exports.InvalidOptionArgumentError = InvalidArgumentError;
|
|
1886
2014
|
});
|
|
1887
2015
|
|
|
1888
|
-
// ../../node_modules/picocolors/picocolors.js
|
|
1889
|
-
var require_picocolors = __commonJS((exports, module) => {
|
|
1890
|
-
var p = process || {};
|
|
1891
|
-
var argv = p.argv || [];
|
|
1892
|
-
var env = p.env || {};
|
|
1893
|
-
var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
1894
|
-
var formatter = (open, close, replace = open) => (input) => {
|
|
1895
|
-
let string = "" + input, index = string.indexOf(close, open.length);
|
|
1896
|
-
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
1897
|
-
};
|
|
1898
|
-
var replaceClose = (string, close, replace, index) => {
|
|
1899
|
-
let result = "", cursor = 0;
|
|
1900
|
-
do {
|
|
1901
|
-
result += string.substring(cursor, index) + replace;
|
|
1902
|
-
cursor = index + close.length;
|
|
1903
|
-
index = string.indexOf(close, cursor);
|
|
1904
|
-
} while (~index);
|
|
1905
|
-
return result + string.substring(cursor);
|
|
1906
|
-
};
|
|
1907
|
-
var createColors = (enabled = isColorSupported) => {
|
|
1908
|
-
let f = enabled ? formatter : () => String;
|
|
1909
|
-
return {
|
|
1910
|
-
isColorSupported: enabled,
|
|
1911
|
-
reset: f("\x1B[0m", "\x1B[0m"),
|
|
1912
|
-
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
1913
|
-
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
1914
|
-
italic: f("\x1B[3m", "\x1B[23m"),
|
|
1915
|
-
underline: f("\x1B[4m", "\x1B[24m"),
|
|
1916
|
-
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
1917
|
-
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
1918
|
-
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
1919
|
-
black: f("\x1B[30m", "\x1B[39m"),
|
|
1920
|
-
red: f("\x1B[31m", "\x1B[39m"),
|
|
1921
|
-
green: f("\x1B[32m", "\x1B[39m"),
|
|
1922
|
-
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
1923
|
-
blue: f("\x1B[34m", "\x1B[39m"),
|
|
1924
|
-
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
1925
|
-
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
1926
|
-
white: f("\x1B[37m", "\x1B[39m"),
|
|
1927
|
-
gray: f("\x1B[90m", "\x1B[39m"),
|
|
1928
|
-
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
1929
|
-
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
1930
|
-
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
1931
|
-
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
1932
|
-
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
1933
|
-
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
1934
|
-
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
1935
|
-
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
1936
|
-
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
1937
|
-
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
1938
|
-
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
1939
|
-
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
1940
|
-
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
1941
|
-
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
1942
|
-
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
1943
|
-
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
1944
|
-
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
1945
|
-
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
1946
|
-
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
1947
|
-
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
1948
|
-
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
1949
|
-
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
1950
|
-
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
1951
|
-
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
1952
|
-
};
|
|
1953
|
-
};
|
|
1954
|
-
module.exports = createColors();
|
|
1955
|
-
module.exports.createColors = createColors;
|
|
1956
|
-
});
|
|
1957
|
-
|
|
1958
|
-
// ../../node_modules/sisteransi/src/index.js
|
|
1959
|
-
var require_src = __commonJS((exports, module) => {
|
|
1960
|
-
var ESC = "\x1B";
|
|
1961
|
-
var CSI = `${ESC}[`;
|
|
1962
|
-
var beep = "\x07";
|
|
1963
|
-
var cursor = {
|
|
1964
|
-
to(x, y) {
|
|
1965
|
-
if (!y)
|
|
1966
|
-
return `${CSI}${x + 1}G`;
|
|
1967
|
-
return `${CSI}${y + 1};${x + 1}H`;
|
|
1968
|
-
},
|
|
1969
|
-
move(x, y) {
|
|
1970
|
-
let ret = "";
|
|
1971
|
-
if (x < 0)
|
|
1972
|
-
ret += `${CSI}${-x}D`;
|
|
1973
|
-
else if (x > 0)
|
|
1974
|
-
ret += `${CSI}${x}C`;
|
|
1975
|
-
if (y < 0)
|
|
1976
|
-
ret += `${CSI}${-y}A`;
|
|
1977
|
-
else if (y > 0)
|
|
1978
|
-
ret += `${CSI}${y}B`;
|
|
1979
|
-
return ret;
|
|
1980
|
-
},
|
|
1981
|
-
up: (count = 1) => `${CSI}${count}A`,
|
|
1982
|
-
down: (count = 1) => `${CSI}${count}B`,
|
|
1983
|
-
forward: (count = 1) => `${CSI}${count}C`,
|
|
1984
|
-
backward: (count = 1) => `${CSI}${count}D`,
|
|
1985
|
-
nextLine: (count = 1) => `${CSI}E`.repeat(count),
|
|
1986
|
-
prevLine: (count = 1) => `${CSI}F`.repeat(count),
|
|
1987
|
-
left: `${CSI}G`,
|
|
1988
|
-
hide: `${CSI}?25l`,
|
|
1989
|
-
show: `${CSI}?25h`,
|
|
1990
|
-
save: `${ESC}7`,
|
|
1991
|
-
restore: `${ESC}8`
|
|
1992
|
-
};
|
|
1993
|
-
var scroll = {
|
|
1994
|
-
up: (count = 1) => `${CSI}S`.repeat(count),
|
|
1995
|
-
down: (count = 1) => `${CSI}T`.repeat(count)
|
|
1996
|
-
};
|
|
1997
|
-
var erase = {
|
|
1998
|
-
screen: `${CSI}2J`,
|
|
1999
|
-
up: (count = 1) => `${CSI}1J`.repeat(count),
|
|
2000
|
-
down: (count = 1) => `${CSI}J`.repeat(count),
|
|
2001
|
-
line: `${CSI}2K`,
|
|
2002
|
-
lineEnd: `${CSI}K`,
|
|
2003
|
-
lineStart: `${CSI}1K`,
|
|
2004
|
-
lines(count) {
|
|
2005
|
-
let clear = "";
|
|
2006
|
-
for (let i = 0;i < count; i++)
|
|
2007
|
-
clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
2008
|
-
if (count)
|
|
2009
|
-
clear += cursor.left;
|
|
2010
|
-
return clear;
|
|
2011
|
-
}
|
|
2012
|
-
};
|
|
2013
|
-
module.exports = { cursor, scroll, erase, beep };
|
|
2014
|
-
});
|
|
2015
|
-
|
|
2016
2016
|
// ../../node_modules/json5/lib/unicode.js
|
|
2017
2017
|
var require_unicode = __commonJS((exports, module) => {
|
|
2018
2018
|
exports.Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
|
|
@@ -119126,7 +119126,7 @@ function inferParser(options8, fileInfo) {
|
|
|
119126
119126
|
return language?.parsers[0];
|
|
119127
119127
|
}
|
|
119128
119128
|
function normalizeOptions4(options8, optionInfos, {
|
|
119129
|
-
logger = false,
|
|
119129
|
+
logger: logger2 = false,
|
|
119130
119130
|
isCLI = false,
|
|
119131
119131
|
passThrough = false,
|
|
119132
119132
|
FlagSchema,
|
|
@@ -119161,11 +119161,11 @@ function normalizeOptions4(options8, optionInfos, {
|
|
|
119161
119161
|
FlagSchema
|
|
119162
119162
|
});
|
|
119163
119163
|
const normalizer = new Normalizer(schemas3, {
|
|
119164
|
-
logger,
|
|
119164
|
+
logger: logger2,
|
|
119165
119165
|
unknown: unknown2,
|
|
119166
119166
|
descriptor
|
|
119167
119167
|
});
|
|
119168
|
-
const shouldSuppressDuplicateDeprecationWarnings =
|
|
119168
|
+
const shouldSuppressDuplicateDeprecationWarnings = logger2 !== false;
|
|
119169
119169
|
if (shouldSuppressDuplicateDeprecationWarnings && hasDeprecationWarned) {
|
|
119170
119170
|
normalizer._hasDeprecationWarned = hasDeprecationWarned;
|
|
119171
119171
|
}
|
|
@@ -120760,7 +120760,7 @@ var require2, __filename2, __dirname3, __create2, __defProp3, __getOwnPropDesc,
|
|
|
120760
120760
|
`));
|
|
120761
120761
|
}
|
|
120762
120762
|
return chooseDescription(descriptions, utils3.loggerPrintWidth);
|
|
120763
|
-
}, import_picocolors32, levenUnknownHandler = (key2, value, { descriptor, logger, schemas: schemas3 }) => {
|
|
120763
|
+
}, import_picocolors32, levenUnknownHandler = (key2, value, { descriptor, logger: logger2, schemas: schemas3 }) => {
|
|
120764
120764
|
const messages2 = [
|
|
120765
120765
|
`Ignored unknown option ${import_picocolors32.default.yellow(descriptor.pair({ key: key2, value }))}.`
|
|
120766
120766
|
];
|
|
@@ -120768,7 +120768,7 @@ var require2, __filename2, __dirname3, __create2, __defProp3, __getOwnPropDesc,
|
|
|
120768
120768
|
if (suggestion) {
|
|
120769
120769
|
messages2.push(`Did you mean ${import_picocolors32.default.blue(descriptor.key(suggestion))}?`);
|
|
120770
120770
|
}
|
|
120771
|
-
|
|
120771
|
+
logger2.warn(messages2.join(" "));
|
|
120772
120772
|
}, HANDLER_KEYS, Schema2 = class {
|
|
120773
120773
|
static create(parameters) {
|
|
120774
120774
|
return createSchema(this, parameters);
|
|
@@ -120805,10 +120805,10 @@ var require2, __filename2, __dirname3, __create2, __defProp3, __getOwnPropDesc,
|
|
|
120805
120805
|
}
|
|
120806
120806
|
}, AliasSchema, AnySchema, ArraySchema, BooleanSchema, ChoiceSchema, NumberSchema, IntegerSchema, StringSchema, defaultDescriptor, defaultUnknownHandler, defaultInvalidHandler, defaultDeprecatedHandler, Normalizer = class {
|
|
120807
120807
|
constructor(schemas3, opts) {
|
|
120808
|
-
const { logger = console, loggerPrintWidth = 80, descriptor = defaultDescriptor, unknown: unknown2 = defaultUnknownHandler, invalid = defaultInvalidHandler, deprecated = defaultDeprecatedHandler, missing = () => false, required: required2 = () => false, preprocess: preprocess2 = (x10) => x10, postprocess = () => VALUE_UNCHANGED } = opts || {};
|
|
120808
|
+
const { logger: logger2 = console, loggerPrintWidth = 80, descriptor = defaultDescriptor, unknown: unknown2 = defaultUnknownHandler, invalid = defaultInvalidHandler, deprecated = defaultDeprecatedHandler, missing = () => false, required: required2 = () => false, preprocess: preprocess2 = (x10) => x10, postprocess = () => VALUE_UNCHANGED } = opts || {};
|
|
120809
120809
|
this._utils = {
|
|
120810
120810
|
descriptor,
|
|
120811
|
-
logger:
|
|
120811
|
+
logger: logger2 || { warn: () => {} },
|
|
120812
120812
|
loggerPrintWidth,
|
|
120813
120813
|
schemas: recordFromArray(schemas3, "name"),
|
|
120814
120814
|
normalizeDefaultResult,
|
|
@@ -166684,14 +166684,14 @@ var require_logger_plugin2 = __commonJS((exports) => {
|
|
|
166684
166684
|
var logger_1 = require_logger();
|
|
166685
166685
|
var logger_plugin_1 = require_logger_plugin();
|
|
166686
166686
|
var loggerPlugin = (proxyServer, options8) => {
|
|
166687
|
-
const
|
|
166687
|
+
const logger2 = (0, logger_1.getLogger)(options8);
|
|
166688
166688
|
proxyServer.on("error", (err, req, res, target) => {
|
|
166689
166689
|
const hostname3 = req?.headers?.host;
|
|
166690
166690
|
const requestHref = `${hostname3}${req?.url}`;
|
|
166691
166691
|
const targetHref = `${target?.href}`;
|
|
166692
166692
|
const errorMessage = "[HPM] Error occurred while proxying request %s to %s [%s] (%s)";
|
|
166693
166693
|
const errReference = "https://nodejs.org/api/errors.html#errors_common_system_errors";
|
|
166694
|
-
|
|
166694
|
+
logger2.error(errorMessage, requestHref, targetHref, err.code || err, errReference);
|
|
166695
166695
|
});
|
|
166696
166696
|
proxyServer.on("proxyRes", (proxyRes, req, res) => {
|
|
166697
166697
|
const originalUrl = req.originalUrl ?? `${req.baseUrl || ""}${req.url}`;
|
|
@@ -166713,13 +166713,13 @@ var require_logger_plugin2 = __commonJS((exports) => {
|
|
|
166713
166713
|
}
|
|
166714
166714
|
const targetUrl = target.toString();
|
|
166715
166715
|
const exchange = `[HPM] ${req.method} ${originalUrl} -> ${targetUrl} [${proxyRes.statusCode}]`;
|
|
166716
|
-
|
|
166716
|
+
logger2.info(exchange);
|
|
166717
166717
|
});
|
|
166718
166718
|
proxyServer.on("open", (socket) => {
|
|
166719
|
-
|
|
166719
|
+
logger2.info("[HPM] Client connected: %o", socket.address());
|
|
166720
166720
|
});
|
|
166721
166721
|
proxyServer.on("close", (req, proxySocket, proxyHead) => {
|
|
166722
|
-
|
|
166722
|
+
logger2.info("[HPM] Client disconnected: %o", proxySocket.address());
|
|
166723
166723
|
});
|
|
166724
166724
|
};
|
|
166725
166725
|
exports.loggerPlugin = loggerPlugin;
|
|
@@ -167296,7 +167296,7 @@ var require_options_adapter = __commonJS((exports) => {
|
|
|
167296
167296
|
};
|
|
167297
167297
|
function legacyOptionsAdapter(legacyContext, legacyOptions) {
|
|
167298
167298
|
let options8 = {};
|
|
167299
|
-
let
|
|
167299
|
+
let logger2;
|
|
167300
167300
|
if (typeof legacyContext === "string" && !!url3.parse(legacyContext).host) {
|
|
167301
167301
|
throw new Error(`Shorthand syntax is removed from legacyCreateProxyMiddleware().
|
|
167302
167302
|
Please use "legacyCreateProxyMiddleware({ target: 'http://www.example.org' })" instead.
|
|
@@ -167307,8 +167307,8 @@ var require_options_adapter = __commonJS((exports) => {
|
|
|
167307
167307
|
if (legacyContext && legacyOptions) {
|
|
167308
167308
|
debug("map legacy context/filter to options.pathFilter");
|
|
167309
167309
|
options8 = { ...legacyOptions, pathFilter: legacyContext };
|
|
167310
|
-
|
|
167311
|
-
|
|
167310
|
+
logger2 = getLegacyLogger(options8);
|
|
167311
|
+
logger2.warn(`[http-proxy-middleware] Legacy "context" argument is deprecated. Migrate your "context" to "options.pathFilter":
|
|
167312
167312
|
|
|
167313
167313
|
const options = {
|
|
167314
167314
|
pathFilter: '${legacyContext}',
|
|
@@ -167318,16 +167318,16 @@ var require_options_adapter = __commonJS((exports) => {
|
|
|
167318
167318
|
`);
|
|
167319
167319
|
} else if (legacyContext && !legacyOptions) {
|
|
167320
167320
|
options8 = { ...legacyContext };
|
|
167321
|
-
|
|
167321
|
+
logger2 = getLegacyLogger(options8);
|
|
167322
167322
|
} else {
|
|
167323
|
-
|
|
167323
|
+
logger2 = getLegacyLogger({});
|
|
167324
167324
|
}
|
|
167325
167325
|
Object.entries(proxyEventMap).forEach(([legacyEventName, proxyEventName]) => {
|
|
167326
167326
|
if (options8[legacyEventName]) {
|
|
167327
167327
|
options8.on = { ...options8.on };
|
|
167328
167328
|
options8.on[proxyEventName] = options8[legacyEventName];
|
|
167329
167329
|
debug('map legacy event "%s" to "on.%s"', legacyEventName, proxyEventName);
|
|
167330
|
-
|
|
167330
|
+
logger2.warn(`[http-proxy-middleware] Legacy "${legacyEventName}" is deprecated. Migrate to "options.on.${proxyEventName}":
|
|
167331
167331
|
|
|
167332
167332
|
const options = {
|
|
167333
167333
|
on: {
|
|
@@ -167345,7 +167345,7 @@ var require_options_adapter = __commonJS((exports) => {
|
|
|
167345
167345
|
debug("legacy logProvider: %O", logProvider);
|
|
167346
167346
|
if (typeof logLevel === "string" && logLevel !== "silent") {
|
|
167347
167347
|
debug('map "logProvider" to "logger"');
|
|
167348
|
-
|
|
167348
|
+
logger2.warn(`[http-proxy-middleware] Legacy "logLevel" and "logProvider" are deprecated. Migrate to "options.logger":
|
|
167349
167349
|
|
|
167350
167350
|
const options = {
|
|
167351
167351
|
logger: console,
|
|
@@ -218273,25 +218273,6 @@ var require_dist5 = __commonJS((exports, module) => {
|
|
|
218273
218273
|
import { dirname as dirname16, join as join21 } from "node:path";
|
|
218274
218274
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
218275
218275
|
|
|
218276
|
-
// ../../node_modules/commander/esm.mjs
|
|
218277
|
-
var import__ = __toESM(require_commander(), 1);
|
|
218278
|
-
var {
|
|
218279
|
-
program,
|
|
218280
|
-
createCommand,
|
|
218281
|
-
createArgument,
|
|
218282
|
-
createOption,
|
|
218283
|
-
CommanderError,
|
|
218284
|
-
InvalidArgumentError,
|
|
218285
|
-
InvalidOptionArgumentError,
|
|
218286
|
-
Command,
|
|
218287
|
-
Argument,
|
|
218288
|
-
Option,
|
|
218289
|
-
Help
|
|
218290
|
-
} = import__.default;
|
|
218291
|
-
|
|
218292
|
-
// src/cli/commands/agents/pull.ts
|
|
218293
|
-
import { dirname as dirname7, join as join11 } from "node:path";
|
|
218294
|
-
|
|
218295
218276
|
// ../../node_modules/@clack/core/dist/index.mjs
|
|
218296
218277
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
218297
218278
|
var import_sisteransi = __toESM(require_src(), 1);
|
|
@@ -219376,6 +219357,72 @@ ${l}
|
|
|
219376
219357
|
}
|
|
219377
219358
|
} }).prompt();
|
|
219378
219359
|
|
|
219360
|
+
// ../logger/src/ClackLogger.ts
|
|
219361
|
+
class ClackLogger {
|
|
219362
|
+
info(message) {
|
|
219363
|
+
R2.info(message);
|
|
219364
|
+
}
|
|
219365
|
+
success(message) {
|
|
219366
|
+
R2.success(message);
|
|
219367
|
+
}
|
|
219368
|
+
warn(message) {
|
|
219369
|
+
R2.warn(message);
|
|
219370
|
+
}
|
|
219371
|
+
error(message) {
|
|
219372
|
+
R2.error(message);
|
|
219373
|
+
}
|
|
219374
|
+
step(message) {
|
|
219375
|
+
R2.step(message);
|
|
219376
|
+
}
|
|
219377
|
+
message(message) {
|
|
219378
|
+
R2.message(message);
|
|
219379
|
+
}
|
|
219380
|
+
}
|
|
219381
|
+
// ../logger/src/SimpleLogger.ts
|
|
219382
|
+
class SimpleLogger {
|
|
219383
|
+
info(message) {
|
|
219384
|
+
process.stderr.write(`${message}
|
|
219385
|
+
`);
|
|
219386
|
+
}
|
|
219387
|
+
success(message) {
|
|
219388
|
+
process.stderr.write(`${message}
|
|
219389
|
+
`);
|
|
219390
|
+
}
|
|
219391
|
+
warn(message) {
|
|
219392
|
+
process.stderr.write(`Warning: ${message}
|
|
219393
|
+
`);
|
|
219394
|
+
}
|
|
219395
|
+
error(message) {
|
|
219396
|
+
process.stderr.write(`Error: ${message}
|
|
219397
|
+
`);
|
|
219398
|
+
}
|
|
219399
|
+
step(message) {
|
|
219400
|
+
process.stderr.write(`${message}
|
|
219401
|
+
`);
|
|
219402
|
+
}
|
|
219403
|
+
message(message) {
|
|
219404
|
+
process.stderr.write(`${message}
|
|
219405
|
+
`);
|
|
219406
|
+
}
|
|
219407
|
+
}
|
|
219408
|
+
// ../../node_modules/commander/esm.mjs
|
|
219409
|
+
var import__ = __toESM(require_commander(), 1);
|
|
219410
|
+
var {
|
|
219411
|
+
program,
|
|
219412
|
+
createCommand,
|
|
219413
|
+
createArgument,
|
|
219414
|
+
createOption,
|
|
219415
|
+
CommanderError,
|
|
219416
|
+
InvalidArgumentError,
|
|
219417
|
+
InvalidOptionArgumentError,
|
|
219418
|
+
Command,
|
|
219419
|
+
Argument,
|
|
219420
|
+
Option,
|
|
219421
|
+
Help
|
|
219422
|
+
} = import__.default;
|
|
219423
|
+
|
|
219424
|
+
// src/cli/commands/agents/pull.ts
|
|
219425
|
+
import { dirname as dirname7, join as join11 } from "node:path";
|
|
219379
219426
|
// ../../node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
219380
219427
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
219381
219428
|
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
@@ -242979,6 +243026,7 @@ var package_default = {
|
|
|
242979
243026
|
url: "https://github.com/base44/cli"
|
|
242980
243027
|
},
|
|
242981
243028
|
devDependencies: {
|
|
243029
|
+
"@base44-cli/logger": "workspace:*",
|
|
242982
243030
|
"@clack/prompts": "^1.0.1",
|
|
242983
243031
|
"@seald-io/nedb": "^4.1.2",
|
|
242984
243032
|
"@types/bun": "^1.2.15",
|
|
@@ -243388,18 +243436,18 @@ async function getUserInfo(accessToken) {
|
|
|
243388
243436
|
return result.data;
|
|
243389
243437
|
}
|
|
243390
243438
|
// src/cli/commands/auth/login-flow.ts
|
|
243391
|
-
async function generateAndDisplayDeviceCode() {
|
|
243439
|
+
async function generateAndDisplayDeviceCode(log, runTask) {
|
|
243392
243440
|
const deviceCodeResponse = await runTask("Generating device code...", async () => {
|
|
243393
243441
|
return await generateDeviceCode();
|
|
243394
243442
|
}, {
|
|
243395
243443
|
successMessage: "Device code generated",
|
|
243396
243444
|
errorMessage: "Failed to generate device code"
|
|
243397
243445
|
});
|
|
243398
|
-
|
|
243446
|
+
log.info(`Verification code: ${theme.styles.bold(deviceCodeResponse.userCode)}` + `
|
|
243399
243447
|
Please confirm this code at: ${deviceCodeResponse.verificationUri}`);
|
|
243400
243448
|
return deviceCodeResponse;
|
|
243401
243449
|
}
|
|
243402
|
-
async function waitForAuthentication(deviceCode, expiresIn, interval) {
|
|
243450
|
+
async function waitForAuthentication(deviceCode, expiresIn, interval, runTask) {
|
|
243403
243451
|
let tokenResponse;
|
|
243404
243452
|
try {
|
|
243405
243453
|
await runTask("Waiting for authentication...", async () => {
|
|
@@ -243439,9 +243487,12 @@ async function saveAuthData(response, userInfo) {
|
|
|
243439
243487
|
name: userInfo.name
|
|
243440
243488
|
});
|
|
243441
243489
|
}
|
|
243442
|
-
async function login(
|
|
243443
|
-
|
|
243444
|
-
|
|
243490
|
+
async function login({
|
|
243491
|
+
log,
|
|
243492
|
+
runTask
|
|
243493
|
+
}) {
|
|
243494
|
+
const deviceCodeResponse = await generateAndDisplayDeviceCode(log, runTask);
|
|
243495
|
+
const token = await waitForAuthentication(deviceCodeResponse.deviceCode, deviceCodeResponse.expiresIn, deviceCodeResponse.interval, runTask);
|
|
243445
243496
|
const userInfo = await getUserInfo(token.accessToken);
|
|
243446
243497
|
await saveAuthData(token, userInfo);
|
|
243447
243498
|
return {
|
|
@@ -243450,22 +243501,22 @@ async function login() {
|
|
|
243450
243501
|
}
|
|
243451
243502
|
|
|
243452
243503
|
// src/cli/utils/command/middleware.ts
|
|
243453
|
-
async function ensureAuth(
|
|
243504
|
+
async function ensureAuth(ctx) {
|
|
243454
243505
|
const loggedIn = await isLoggedIn();
|
|
243455
243506
|
if (!loggedIn) {
|
|
243456
|
-
|
|
243457
|
-
await login();
|
|
243507
|
+
ctx.log.info("You need to login first to continue.");
|
|
243508
|
+
await login(ctx);
|
|
243458
243509
|
}
|
|
243459
243510
|
try {
|
|
243460
243511
|
const userInfo = await readAuth();
|
|
243461
|
-
errorReporter.setContext({
|
|
243512
|
+
ctx.errorReporter.setContext({
|
|
243462
243513
|
user: { email: userInfo.email, name: userInfo.name }
|
|
243463
243514
|
});
|
|
243464
243515
|
} catch {}
|
|
243465
243516
|
}
|
|
243466
|
-
async function ensureAppConfig(
|
|
243517
|
+
async function ensureAppConfig(ctx) {
|
|
243467
243518
|
const appConfig = await initAppConfig();
|
|
243468
|
-
errorReporter.setContext({ appId: appConfig.id });
|
|
243519
|
+
ctx.errorReporter.setContext({ appId: appConfig.id });
|
|
243469
243520
|
}
|
|
243470
243521
|
|
|
243471
243522
|
// ../../node_modules/is-plain-obj/index.js
|
|
@@ -250111,9 +250162,6 @@ class Base44Command extends Command {
|
|
|
250111
250162
|
setContext(context) {
|
|
250112
250163
|
this._context = context;
|
|
250113
250164
|
}
|
|
250114
|
-
get isNonInteractive() {
|
|
250115
|
-
return this._context?.isNonInteractive ?? false;
|
|
250116
|
-
}
|
|
250117
250165
|
get context() {
|
|
250118
250166
|
if (!this._context) {
|
|
250119
250167
|
throw new Error("Base44Command context not set. Ensure the command is registered via createProgram().");
|
|
@@ -250129,12 +250177,12 @@ class Base44Command extends Command {
|
|
|
250129
250177
|
const upgradeCheckPromise = startUpgradeCheck();
|
|
250130
250178
|
try {
|
|
250131
250179
|
if (this._commandOptions.requireAuth) {
|
|
250132
|
-
await ensureAuth(this.context
|
|
250180
|
+
await ensureAuth(this.context);
|
|
250133
250181
|
}
|
|
250134
250182
|
if (this._commandOptions.requireAppConfig) {
|
|
250135
|
-
await ensureAppConfig(this.context
|
|
250183
|
+
await ensureAppConfig(this.context);
|
|
250136
250184
|
}
|
|
250137
|
-
const result = await fn(...args) ?? {};
|
|
250185
|
+
const result = await fn(this.context, ...args) ?? {};
|
|
250138
250186
|
if (!quiet) {
|
|
250139
250187
|
await showCommandEnd(result, upgradeCheckPromise, this.context.distribution);
|
|
250140
250188
|
} else {
|
|
@@ -250177,20 +250225,6 @@ var onPromptCancel = () => {
|
|
|
250177
250225
|
Ne("Operation cancelled.");
|
|
250178
250226
|
throw new CLIExitError(0);
|
|
250179
250227
|
};
|
|
250180
|
-
// src/cli/utils/runTask.ts
|
|
250181
|
-
async function runTask(startMessage, operation, options) {
|
|
250182
|
-
const s = bt2();
|
|
250183
|
-
s.start(startMessage);
|
|
250184
|
-
const updateMessage = (message) => s.message(message);
|
|
250185
|
-
try {
|
|
250186
|
-
const result = await operation(updateMessage);
|
|
250187
|
-
s.stop(options?.successMessage || startMessage);
|
|
250188
|
-
return result;
|
|
250189
|
-
} catch (error48) {
|
|
250190
|
-
s.error(options?.errorMessage || "Failed");
|
|
250191
|
-
throw error48;
|
|
250192
|
-
}
|
|
250193
|
-
}
|
|
250194
250228
|
// src/cli/utils/urls.ts
|
|
250195
250229
|
function getDashboardUrl(projectId) {
|
|
250196
250230
|
const id = projectId ?? getAppConfig().id;
|
|
@@ -250342,7 +250376,10 @@ async function parseEnvFile(filePath) {
|
|
|
250342
250376
|
return import_dotenv.parse(content);
|
|
250343
250377
|
}
|
|
250344
250378
|
// src/cli/commands/agents/pull.ts
|
|
250345
|
-
async function pullAgentsAction(
|
|
250379
|
+
async function pullAgentsAction({
|
|
250380
|
+
log,
|
|
250381
|
+
runTask
|
|
250382
|
+
}) {
|
|
250346
250383
|
const { project: project2 } = await readProjectConfig();
|
|
250347
250384
|
const configDir = dirname7(project2.configPath);
|
|
250348
250385
|
const agentsDir = join11(configDir, project2.agentsDir);
|
|
@@ -250359,13 +250396,13 @@ async function pullAgentsAction() {
|
|
|
250359
250396
|
errorMessage: "Failed to sync agent files"
|
|
250360
250397
|
});
|
|
250361
250398
|
if (written.length > 0) {
|
|
250362
|
-
|
|
250399
|
+
log.success(`Written: ${written.join(", ")}`);
|
|
250363
250400
|
}
|
|
250364
250401
|
if (deleted.length > 0) {
|
|
250365
|
-
|
|
250402
|
+
log.warn(`Deleted: ${deleted.join(", ")}`);
|
|
250366
250403
|
}
|
|
250367
250404
|
if (written.length === 0 && deleted.length === 0) {
|
|
250368
|
-
|
|
250405
|
+
log.info("All agents are already up to date");
|
|
250369
250406
|
}
|
|
250370
250407
|
return {
|
|
250371
250408
|
outroMessage: `Pulled ${remoteAgents.total} agents to ${agentsDir}`
|
|
@@ -250376,9 +250413,12 @@ function getAgentsPullCommand() {
|
|
|
250376
250413
|
}
|
|
250377
250414
|
|
|
250378
250415
|
// src/cli/commands/agents/push.ts
|
|
250379
|
-
async function pushAgentsAction(
|
|
250416
|
+
async function pushAgentsAction({
|
|
250417
|
+
log,
|
|
250418
|
+
runTask
|
|
250419
|
+
}) {
|
|
250380
250420
|
const { agents } = await readProjectConfig();
|
|
250381
|
-
|
|
250421
|
+
log.info(agents.length === 0 ? "No local agents found - this will delete all remote agents" : `Found ${agents.length} agents to push`);
|
|
250382
250422
|
const result = await runTask("Pushing agents to Base44", async () => {
|
|
250383
250423
|
return await pushAgents(agents);
|
|
250384
250424
|
}, {
|
|
@@ -250386,13 +250426,13 @@ async function pushAgentsAction() {
|
|
|
250386
250426
|
errorMessage: "Failed to push agents"
|
|
250387
250427
|
});
|
|
250388
250428
|
if (result.created.length > 0) {
|
|
250389
|
-
|
|
250429
|
+
log.success(`Created: ${result.created.join(", ")}`);
|
|
250390
250430
|
}
|
|
250391
250431
|
if (result.updated.length > 0) {
|
|
250392
|
-
|
|
250432
|
+
log.success(`Updated: ${result.updated.join(", ")}`);
|
|
250393
250433
|
}
|
|
250394
250434
|
if (result.deleted.length > 0) {
|
|
250395
|
-
|
|
250435
|
+
log.warn(`Deleted: ${result.deleted.join(", ")}`);
|
|
250396
250436
|
}
|
|
250397
250437
|
return { outroMessage: "Agents pushed to Base44" };
|
|
250398
250438
|
}
|
|
@@ -250414,7 +250454,7 @@ function getLoginCommand() {
|
|
|
250414
250454
|
}
|
|
250415
250455
|
|
|
250416
250456
|
// src/cli/commands/auth/logout.ts
|
|
250417
|
-
async function logout() {
|
|
250457
|
+
async function logout(_ctx) {
|
|
250418
250458
|
await deleteAuth();
|
|
250419
250459
|
return { outroMessage: "Logged out successfully" };
|
|
250420
250460
|
}
|
|
@@ -250426,7 +250466,7 @@ function getLogoutCommand() {
|
|
|
250426
250466
|
}
|
|
250427
250467
|
|
|
250428
250468
|
// src/cli/commands/auth/whoami.ts
|
|
250429
|
-
async function whoami() {
|
|
250469
|
+
async function whoami(_ctx) {
|
|
250430
250470
|
const auth2 = await readAuth();
|
|
250431
250471
|
return { outroMessage: `Logged in as: ${theme.styles.bold(auth2.email)}` };
|
|
250432
250472
|
}
|
|
@@ -250435,7 +250475,10 @@ function getWhoamiCommand() {
|
|
|
250435
250475
|
}
|
|
250436
250476
|
|
|
250437
250477
|
// src/cli/commands/connectors/list-available.ts
|
|
250438
|
-
async function listAvailableAction(
|
|
250478
|
+
async function listAvailableAction({
|
|
250479
|
+
log,
|
|
250480
|
+
runTask
|
|
250481
|
+
}) {
|
|
250439
250482
|
const { integrations } = await runTask("Fetching available integrations from Base44", async () => {
|
|
250440
250483
|
return await listAvailableIntegrations();
|
|
250441
250484
|
}, {
|
|
@@ -250448,7 +250491,7 @@ async function listAvailableAction() {
|
|
|
250448
250491
|
for (const { displayName, ...rest } of integrations) {
|
|
250449
250492
|
const yaml2 = formatYaml(rest);
|
|
250450
250493
|
const pad = " ".repeat(YAML_INDENT);
|
|
250451
|
-
|
|
250494
|
+
log.info(`${displayName}
|
|
250452
250495
|
${pad}${yaml2.replace(/\n/g, `
|
|
250453
250496
|
${pad}`)}`);
|
|
250454
250497
|
}
|
|
@@ -250462,7 +250505,10 @@ function getConnectorsListAvailableCommand() {
|
|
|
250462
250505
|
|
|
250463
250506
|
// src/cli/commands/connectors/pull.ts
|
|
250464
250507
|
import { dirname as dirname8, join as join12 } from "node:path";
|
|
250465
|
-
async function pullConnectorsAction(
|
|
250508
|
+
async function pullConnectorsAction({
|
|
250509
|
+
log,
|
|
250510
|
+
runTask
|
|
250511
|
+
}) {
|
|
250466
250512
|
const { project: project2 } = await readProjectConfig();
|
|
250467
250513
|
const configDir = dirname8(project2.configPath);
|
|
250468
250514
|
const connectorsDir = join12(configDir, project2.connectorsDir);
|
|
@@ -250479,13 +250525,13 @@ async function pullConnectorsAction() {
|
|
|
250479
250525
|
errorMessage: "Failed to sync connector files"
|
|
250480
250526
|
});
|
|
250481
250527
|
if (written.length > 0) {
|
|
250482
|
-
|
|
250528
|
+
log.success(`Written: ${written.join(", ")}`);
|
|
250483
250529
|
}
|
|
250484
250530
|
if (deleted.length > 0) {
|
|
250485
|
-
|
|
250531
|
+
log.warn(`Deleted: ${deleted.join(", ")}`);
|
|
250486
250532
|
}
|
|
250487
250533
|
if (written.length === 0 && deleted.length === 0) {
|
|
250488
|
-
|
|
250534
|
+
log.info("All connectors are already up to date");
|
|
250489
250535
|
}
|
|
250490
250536
|
return {
|
|
250491
250537
|
outroMessage: `Pulled ${remoteConnectors.length} connectors to ${connectorsDir}`
|
|
@@ -251154,14 +251200,14 @@ async function runOAuthFlowWithSkip(connector2) {
|
|
|
251154
251200
|
}
|
|
251155
251201
|
return finalStatus;
|
|
251156
251202
|
}
|
|
251157
|
-
async function promptOAuthFlows(pending, options) {
|
|
251203
|
+
async function promptOAuthFlows(pending, log, options) {
|
|
251158
251204
|
const outcomes = new Map;
|
|
251159
251205
|
if (pending.length === 0) {
|
|
251160
251206
|
return outcomes;
|
|
251161
251207
|
}
|
|
251162
|
-
|
|
251208
|
+
log.warn(`${pending.length} connector(s) require authorization in your browser:`);
|
|
251163
251209
|
for (const connector2 of pending) {
|
|
251164
|
-
|
|
251210
|
+
log.info(` ${connector2.type}: ${theme.styles.dim(connector2.redirectUrl)}`);
|
|
251165
251211
|
}
|
|
251166
251212
|
if (options?.skipPrompt) {
|
|
251167
251213
|
return outcomes;
|
|
@@ -251174,11 +251220,11 @@ async function promptOAuthFlows(pending, options) {
|
|
|
251174
251220
|
}
|
|
251175
251221
|
for (const connector2 of pending) {
|
|
251176
251222
|
try {
|
|
251177
|
-
|
|
251223
|
+
log.info(`Opening browser for ${connector2.type}...`);
|
|
251178
251224
|
const status = await runOAuthFlowWithSkip(connector2);
|
|
251179
251225
|
outcomes.set(connector2.type, status);
|
|
251180
251226
|
} catch (err) {
|
|
251181
|
-
|
|
251227
|
+
log.error(`Failed to authorize ${connector2.type}: ${err instanceof Error ? err.message : String(err)}`);
|
|
251182
251228
|
outcomes.set(connector2.type, "FAILED");
|
|
251183
251229
|
}
|
|
251184
251230
|
}
|
|
@@ -251186,7 +251232,7 @@ async function promptOAuthFlows(pending, options) {
|
|
|
251186
251232
|
}
|
|
251187
251233
|
|
|
251188
251234
|
// src/cli/commands/connectors/push.ts
|
|
251189
|
-
function printSummary(results, oauthOutcomes) {
|
|
251235
|
+
function printSummary(results, oauthOutcomes, log) {
|
|
251190
251236
|
const synced = [];
|
|
251191
251237
|
const added = [];
|
|
251192
251238
|
let provisioned;
|
|
@@ -251224,57 +251270,59 @@ function printSummary(results, oauthOutcomes) {
|
|
|
251224
251270
|
}
|
|
251225
251271
|
}
|
|
251226
251272
|
}
|
|
251227
|
-
|
|
251273
|
+
log.info(theme.styles.bold("Summary:"));
|
|
251228
251274
|
if (provisioned) {
|
|
251229
|
-
|
|
251275
|
+
log.success("Stripe sandbox provisioned");
|
|
251230
251276
|
if (provisioned.claimUrl) {
|
|
251231
|
-
|
|
251277
|
+
log.info(` Claim your Stripe sandbox: ${theme.colors.links(provisioned.claimUrl)}`);
|
|
251232
251278
|
}
|
|
251233
|
-
|
|
251279
|
+
log.info(` Connectors dashboard: ${theme.colors.links(getConnectorsUrl())}`);
|
|
251234
251280
|
}
|
|
251235
251281
|
if (synced.length > 0) {
|
|
251236
|
-
|
|
251282
|
+
log.success(`Synced: ${synced.join(", ")}`);
|
|
251237
251283
|
}
|
|
251238
251284
|
if (added.length > 0) {
|
|
251239
|
-
|
|
251285
|
+
log.success(`Added: ${added.join(", ")}`);
|
|
251240
251286
|
}
|
|
251241
251287
|
if (removed.length > 0) {
|
|
251242
|
-
|
|
251288
|
+
log.info(theme.styles.dim(`Removed: ${removed.join(", ")}`));
|
|
251243
251289
|
}
|
|
251244
251290
|
if (skipped.length > 0) {
|
|
251245
|
-
|
|
251291
|
+
log.warn(`Skipped: ${skipped.join(", ")}`);
|
|
251246
251292
|
}
|
|
251247
251293
|
for (const r of failed) {
|
|
251248
|
-
|
|
251294
|
+
log.error(`Failed: ${r.type} - ${r.error}`);
|
|
251249
251295
|
}
|
|
251250
251296
|
}
|
|
251251
|
-
async function pushConnectorsAction(
|
|
251297
|
+
async function pushConnectorsAction({
|
|
251298
|
+
isNonInteractive,
|
|
251299
|
+
log,
|
|
251300
|
+
runTask
|
|
251301
|
+
}) {
|
|
251252
251302
|
const { connectors } = await readProjectConfig();
|
|
251253
251303
|
if (connectors.length === 0) {
|
|
251254
|
-
|
|
251304
|
+
log.info("No local connectors found - checking for remote connectors to remove");
|
|
251255
251305
|
} else {
|
|
251256
251306
|
const connectorNames = connectors.map((c3) => c3.type).join(", ");
|
|
251257
|
-
|
|
251307
|
+
log.info(`Found ${connectors.length} connectors to push: ${connectorNames}`);
|
|
251258
251308
|
}
|
|
251259
251309
|
const { results } = await runTask("Pushing connectors to Base44", async () => {
|
|
251260
251310
|
return await pushConnectors(connectors);
|
|
251261
251311
|
});
|
|
251262
251312
|
const needsOAuth = filterPendingOAuth(results);
|
|
251263
251313
|
let outroMessage = "Connectors pushed to Base44";
|
|
251264
|
-
const oauthOutcomes = await promptOAuthFlows(needsOAuth, {
|
|
251314
|
+
const oauthOutcomes = await promptOAuthFlows(needsOAuth, log, {
|
|
251265
251315
|
skipPrompt: isNonInteractive
|
|
251266
251316
|
});
|
|
251267
251317
|
const allAuthorized = oauthOutcomes.size > 0 && [...oauthOutcomes.values()].every((s) => s === "ACTIVE");
|
|
251268
251318
|
if (needsOAuth.length > 0 && !allAuthorized) {
|
|
251269
251319
|
outroMessage = isNonInteractive ? "Skipped OAuth in non-interactive mode. Run 'base44 connectors push' locally or open the links above to authorize." : "Some connectors still require authorization. Run 'base44 connectors push' or open the links above to authorize.";
|
|
251270
251320
|
}
|
|
251271
|
-
printSummary(results, oauthOutcomes);
|
|
251321
|
+
printSummary(results, oauthOutcomes, log);
|
|
251272
251322
|
return { outroMessage };
|
|
251273
251323
|
}
|
|
251274
251324
|
function getConnectorsPushCommand() {
|
|
251275
|
-
return new Base44Command("push").description("Push local connectors to Base44 (overwrites connectors on Base44)").action(
|
|
251276
|
-
return await pushConnectorsAction(command2.isNonInteractive);
|
|
251277
|
-
});
|
|
251325
|
+
return new Base44Command("push").description("Push local connectors to Base44 (overwrites connectors on Base44)").action(pushConnectorsAction);
|
|
251278
251326
|
}
|
|
251279
251327
|
|
|
251280
251328
|
// src/cli/commands/connectors/index.ts
|
|
@@ -251283,7 +251331,9 @@ function getConnectorsCommand() {
|
|
|
251283
251331
|
}
|
|
251284
251332
|
|
|
251285
251333
|
// src/cli/commands/dashboard/open.ts
|
|
251286
|
-
async function openDashboard(
|
|
251334
|
+
async function openDashboard({
|
|
251335
|
+
isNonInteractive
|
|
251336
|
+
}) {
|
|
251287
251337
|
const dashboardUrl = getDashboardUrl();
|
|
251288
251338
|
if (!isNonInteractive) {
|
|
251289
251339
|
await open_default(dashboardUrl);
|
|
@@ -251291,9 +251341,7 @@ async function openDashboard(isNonInteractive) {
|
|
|
251291
251341
|
return { outroMessage: `Dashboard opened at ${dashboardUrl}` };
|
|
251292
251342
|
}
|
|
251293
251343
|
function getDashboardOpenCommand() {
|
|
251294
|
-
return new Base44Command("open").description("Open the app dashboard in your browser").action(
|
|
251295
|
-
return await openDashboard(command2.isNonInteractive);
|
|
251296
|
-
});
|
|
251344
|
+
return new Base44Command("open").description("Open the app dashboard in your browser").action(openDashboard);
|
|
251297
251345
|
}
|
|
251298
251346
|
|
|
251299
251347
|
// src/cli/commands/dashboard/index.ts
|
|
@@ -251302,13 +251350,16 @@ function getDashboardCommand() {
|
|
|
251302
251350
|
}
|
|
251303
251351
|
|
|
251304
251352
|
// src/cli/commands/entities/push.ts
|
|
251305
|
-
async function pushEntitiesAction(
|
|
251353
|
+
async function pushEntitiesAction({
|
|
251354
|
+
log,
|
|
251355
|
+
runTask
|
|
251356
|
+
}) {
|
|
251306
251357
|
const { entities } = await readProjectConfig();
|
|
251307
251358
|
if (entities.length === 0) {
|
|
251308
251359
|
return { outroMessage: "No entities found in project" };
|
|
251309
251360
|
}
|
|
251310
251361
|
const entityNames = entities.map((e2) => e2.name).join(", ");
|
|
251311
|
-
|
|
251362
|
+
log.info(`Found ${entities.length} entities to push: ${entityNames}`);
|
|
251312
251363
|
const result = await runTask("Pushing entities to Base44", async () => {
|
|
251313
251364
|
return await pushEntities(entities);
|
|
251314
251365
|
}, {
|
|
@@ -251316,13 +251367,13 @@ async function pushEntitiesAction() {
|
|
|
251316
251367
|
errorMessage: "Failed to push entities"
|
|
251317
251368
|
});
|
|
251318
251369
|
if (result.created.length > 0) {
|
|
251319
|
-
|
|
251370
|
+
log.success(`Created: ${result.created.join(", ")}`);
|
|
251320
251371
|
}
|
|
251321
251372
|
if (result.updated.length > 0) {
|
|
251322
|
-
|
|
251373
|
+
log.success(`Updated: ${result.updated.join(", ")}`);
|
|
251323
251374
|
}
|
|
251324
251375
|
if (result.deleted.length > 0) {
|
|
251325
|
-
|
|
251376
|
+
log.warn(`Deleted: ${result.deleted.join(", ")}`);
|
|
251326
251377
|
}
|
|
251327
251378
|
return { outroMessage: "Entities pushed to Base44" };
|
|
251328
251379
|
}
|
|
@@ -251331,7 +251382,7 @@ function getEntitiesPushCommand() {
|
|
|
251331
251382
|
}
|
|
251332
251383
|
|
|
251333
251384
|
// src/cli/commands/functions/delete.ts
|
|
251334
|
-
async function deleteFunctionsAction(names) {
|
|
251385
|
+
async function deleteFunctionsAction({ runTask }, names) {
|
|
251335
251386
|
let deleted = 0;
|
|
251336
251387
|
let notFound = 0;
|
|
251337
251388
|
let errors5 = 0;
|
|
@@ -251377,9 +251428,9 @@ function validateNames(command2) {
|
|
|
251377
251428
|
}
|
|
251378
251429
|
}
|
|
251379
251430
|
function getDeleteCommand() {
|
|
251380
|
-
return new Base44Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").hook("preAction", validateNames).action(async (rawNames) => {
|
|
251431
|
+
return new Base44Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").hook("preAction", validateNames).action(async (ctx, rawNames) => {
|
|
251381
251432
|
const names = parseNames(rawNames);
|
|
251382
|
-
return deleteFunctionsAction(names);
|
|
251433
|
+
return deleteFunctionsAction(ctx, names);
|
|
251383
251434
|
});
|
|
251384
251435
|
}
|
|
251385
251436
|
|
|
@@ -251387,15 +251438,15 @@ function getDeleteCommand() {
|
|
|
251387
251438
|
function formatDuration(ms) {
|
|
251388
251439
|
return `${(ms / 1000).toFixed(1)}s`;
|
|
251389
251440
|
}
|
|
251390
|
-
function formatDeployResult(result) {
|
|
251441
|
+
function formatDeployResult(result, log) {
|
|
251391
251442
|
const label = result.name.padEnd(25);
|
|
251392
251443
|
if (result.status === "deployed") {
|
|
251393
251444
|
const timing = result.durationMs ? theme.styles.dim(` (${formatDuration(result.durationMs)})`) : "";
|
|
251394
|
-
|
|
251445
|
+
log.success(`${label} deployed${timing}`);
|
|
251395
251446
|
} else if (result.status === "unchanged") {
|
|
251396
|
-
|
|
251447
|
+
log.success(`${label} unchanged`);
|
|
251397
251448
|
} else {
|
|
251398
|
-
|
|
251449
|
+
log.error(`${label} error: ${result.error}`);
|
|
251399
251450
|
}
|
|
251400
251451
|
}
|
|
251401
251452
|
|
|
@@ -251414,17 +251465,17 @@ function resolveFunctionsToDeploy(names, allFunctions) {
|
|
|
251414
251465
|
}
|
|
251415
251466
|
return allFunctions.filter((f) => names.includes(f.name));
|
|
251416
251467
|
}
|
|
251417
|
-
function formatPruneResult(pruneResult) {
|
|
251468
|
+
function formatPruneResult(pruneResult, log) {
|
|
251418
251469
|
if (pruneResult.deleted) {
|
|
251419
|
-
|
|
251470
|
+
log.success(`${pruneResult.name.padEnd(25)} deleted`);
|
|
251420
251471
|
} else {
|
|
251421
|
-
|
|
251472
|
+
log.error(`${pruneResult.name.padEnd(25)} error: ${pruneResult.error}`);
|
|
251422
251473
|
}
|
|
251423
251474
|
}
|
|
251424
|
-
function formatPruneSummary(pruneResults) {
|
|
251475
|
+
function formatPruneSummary(pruneResults, log) {
|
|
251425
251476
|
if (pruneResults.length > 0) {
|
|
251426
251477
|
const pruned = pruneResults.filter((r) => r.deleted).length;
|
|
251427
|
-
|
|
251478
|
+
log.info(`${pruned} deleted`);
|
|
251428
251479
|
}
|
|
251429
251480
|
}
|
|
251430
251481
|
function buildDeploySummary(results) {
|
|
@@ -251440,7 +251491,7 @@ function buildDeploySummary(results) {
|
|
|
251440
251491
|
parts.push(`${failed} error${failed !== 1 ? "s" : ""}`);
|
|
251441
251492
|
return parts.join(", ") || "No functions deployed";
|
|
251442
251493
|
}
|
|
251443
|
-
async function deployFunctionsAction(names, options) {
|
|
251494
|
+
async function deployFunctionsAction({ log }, names, options) {
|
|
251444
251495
|
if (options.force && names.length > 0) {
|
|
251445
251496
|
throw new InvalidInputError("--force cannot be used when specifying function names");
|
|
251446
251497
|
}
|
|
@@ -251451,17 +251502,17 @@ async function deployFunctionsAction(names, options) {
|
|
|
251451
251502
|
outroMessage: "No functions found. Create functions in the 'functions' directory."
|
|
251452
251503
|
};
|
|
251453
251504
|
}
|
|
251454
|
-
|
|
251505
|
+
log.info(`Found ${toDeploy.length} ${toDeploy.length === 1 ? "function" : "functions"} to deploy`);
|
|
251455
251506
|
let completed = 0;
|
|
251456
251507
|
const total = toDeploy.length;
|
|
251457
251508
|
const results = await deployFunctionsSequentially(toDeploy, {
|
|
251458
251509
|
onStart: (startNames) => {
|
|
251459
251510
|
const label = startNames.length === 1 ? startNames[0] : `${startNames.length} functions`;
|
|
251460
|
-
|
|
251511
|
+
log.step(theme.styles.dim(`[${completed + 1}/${total}] Deploying ${label}...`));
|
|
251461
251512
|
},
|
|
251462
251513
|
onResult: (result) => {
|
|
251463
251514
|
completed++;
|
|
251464
|
-
formatDeployResult(result);
|
|
251515
|
+
formatDeployResult(result, log);
|
|
251465
251516
|
}
|
|
251466
251517
|
});
|
|
251467
251518
|
if (options.force) {
|
|
@@ -251472,28 +251523,31 @@ async function deployFunctionsAction(names, options) {
|
|
|
251472
251523
|
onStart: (total2) => {
|
|
251473
251524
|
pruneTotal = total2;
|
|
251474
251525
|
if (total2 > 0) {
|
|
251475
|
-
|
|
251526
|
+
log.info(`Found ${total2} remote ${total2 === 1 ? "function" : "functions"} to delete`);
|
|
251476
251527
|
}
|
|
251477
251528
|
},
|
|
251478
251529
|
onBeforeDelete: (name2) => {
|
|
251479
251530
|
pruneCompleted++;
|
|
251480
|
-
|
|
251531
|
+
log.step(theme.styles.dim(`[${pruneCompleted}/${pruneTotal}] Deleting ${name2}...`));
|
|
251481
251532
|
},
|
|
251482
|
-
onResult: formatPruneResult
|
|
251533
|
+
onResult: (r) => formatPruneResult(r, log)
|
|
251483
251534
|
});
|
|
251484
|
-
formatPruneSummary(pruneResults);
|
|
251535
|
+
formatPruneSummary(pruneResults, log);
|
|
251485
251536
|
}
|
|
251486
251537
|
return { outroMessage: buildDeploySummary(results) };
|
|
251487
251538
|
}
|
|
251488
251539
|
function getDeployCommand() {
|
|
251489
|
-
return new Base44Command("deploy").description("Deploy functions to Base44").argument("[names...]", "Function names to deploy (deploys all if omitted)").option("--force", "Delete remote functions not found locally").action(async (rawNames, options) => {
|
|
251540
|
+
return new Base44Command("deploy").description("Deploy functions to Base44").argument("[names...]", "Function names to deploy (deploys all if omitted)").option("--force", "Delete remote functions not found locally").action(async (ctx, rawNames, options) => {
|
|
251490
251541
|
const names = parseNames2(rawNames);
|
|
251491
|
-
return deployFunctionsAction(names, options);
|
|
251542
|
+
return deployFunctionsAction(ctx, names, options);
|
|
251492
251543
|
});
|
|
251493
251544
|
}
|
|
251494
251545
|
|
|
251495
251546
|
// src/cli/commands/functions/list.ts
|
|
251496
|
-
async function listFunctionsAction(
|
|
251547
|
+
async function listFunctionsAction({
|
|
251548
|
+
log,
|
|
251549
|
+
runTask
|
|
251550
|
+
}) {
|
|
251497
251551
|
const { functions } = await runTask("Fetching functions...", async () => listDeployedFunctions(), { errorMessage: "Failed to fetch functions" });
|
|
251498
251552
|
if (functions.length === 0) {
|
|
251499
251553
|
return { outroMessage: "No functions on remote" };
|
|
@@ -251501,7 +251555,7 @@ async function listFunctionsAction() {
|
|
|
251501
251555
|
for (const fn of functions) {
|
|
251502
251556
|
const automationCount = fn.automations.length;
|
|
251503
251557
|
const automationLabel = automationCount > 0 ? theme.styles.dim(` (${automationCount} automation${automationCount > 1 ? "s" : ""})`) : "";
|
|
251504
|
-
|
|
251558
|
+
log.message(` ${fn.name}${automationLabel}`);
|
|
251505
251559
|
}
|
|
251506
251560
|
return {
|
|
251507
251561
|
outroMessage: `${functions.length} function${functions.length !== 1 ? "s" : ""} on remote`
|
|
@@ -251513,7 +251567,7 @@ function getListCommand() {
|
|
|
251513
251567
|
|
|
251514
251568
|
// src/cli/commands/functions/pull.ts
|
|
251515
251569
|
import { dirname as dirname9, join as join13 } from "node:path";
|
|
251516
|
-
async function pullFunctionsAction(name2) {
|
|
251570
|
+
async function pullFunctionsAction({ log, runTask }, name2) {
|
|
251517
251571
|
const { project: project2 } = await readProjectConfig();
|
|
251518
251572
|
const configDir = dirname9(project2.configPath);
|
|
251519
251573
|
const functionsDir = join13(configDir, project2.functionsDir);
|
|
@@ -251540,10 +251594,10 @@ async function pullFunctionsAction(name2) {
|
|
|
251540
251594
|
errorMessage: "Failed to write function files"
|
|
251541
251595
|
});
|
|
251542
251596
|
for (const name3 of written) {
|
|
251543
|
-
|
|
251597
|
+
log.success(`${name3.padEnd(25)} written`);
|
|
251544
251598
|
}
|
|
251545
251599
|
for (const name3 of skipped) {
|
|
251546
|
-
|
|
251600
|
+
log.info(`${name3.padEnd(25)} unchanged`);
|
|
251547
251601
|
}
|
|
251548
251602
|
return {
|
|
251549
251603
|
outroMessage: `Pulled ${toPull.length} function${toPull.length !== 1 ? "s" : ""} to ${functionsDir}`
|
|
@@ -251579,7 +251633,7 @@ function validateNonInteractiveFlags(command2) {
|
|
|
251579
251633
|
command2.error("--path requires a project name argument. Usage: base44 create <name> --path <path>");
|
|
251580
251634
|
}
|
|
251581
251635
|
}
|
|
251582
|
-
async function createInteractive(options) {
|
|
251636
|
+
async function createInteractive(options, ctx) {
|
|
251583
251637
|
const templates = await listTemplates();
|
|
251584
251638
|
const templateOptions = templates.map((t) => ({
|
|
251585
251639
|
value: t,
|
|
@@ -251621,10 +251675,10 @@ async function createInteractive(options) {
|
|
|
251621
251675
|
deploy: options.deploy,
|
|
251622
251676
|
skills: options.skills,
|
|
251623
251677
|
isInteractive: true
|
|
251624
|
-
});
|
|
251678
|
+
}, ctx);
|
|
251625
251679
|
}
|
|
251626
|
-
async function createNonInteractive(options) {
|
|
251627
|
-
|
|
251680
|
+
async function createNonInteractive(options, ctx) {
|
|
251681
|
+
ctx.log.info(`Creating a new project at ${resolve2(options.path)}`);
|
|
251628
251682
|
const template2 = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
|
|
251629
251683
|
return await executeCreate({
|
|
251630
251684
|
template: template2,
|
|
@@ -251633,7 +251687,7 @@ async function createNonInteractive(options) {
|
|
|
251633
251687
|
deploy: options.deploy,
|
|
251634
251688
|
skills: options.skills,
|
|
251635
251689
|
isInteractive: false
|
|
251636
|
-
});
|
|
251690
|
+
}, ctx);
|
|
251637
251691
|
}
|
|
251638
251692
|
async function executeCreate({
|
|
251639
251693
|
template: template2,
|
|
@@ -251643,7 +251697,7 @@ async function executeCreate({
|
|
|
251643
251697
|
deploy: deploy5,
|
|
251644
251698
|
skills,
|
|
251645
251699
|
isInteractive
|
|
251646
|
-
}) {
|
|
251700
|
+
}, { log, runTask }) {
|
|
251647
251701
|
const name2 = rawName.trim();
|
|
251648
251702
|
const resolvedPath = resolve2(projectPath);
|
|
251649
251703
|
const { projectId } = await runTask("Setting up your project...", async () => {
|
|
@@ -251718,13 +251772,33 @@ async function executeCreate({
|
|
|
251718
251772
|
});
|
|
251719
251773
|
} catch {}
|
|
251720
251774
|
}
|
|
251721
|
-
|
|
251722
|
-
|
|
251775
|
+
log.message(`${theme.styles.header("Project")}: ${theme.colors.base44Orange(name2)}`);
|
|
251776
|
+
log.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(projectId))}`);
|
|
251723
251777
|
if (finalAppUrl) {
|
|
251724
|
-
|
|
251778
|
+
log.message(`${theme.styles.header("Site")}: ${theme.colors.links(finalAppUrl)}`);
|
|
251725
251779
|
}
|
|
251726
251780
|
return { outroMessage: "Your project is set up and ready to use" };
|
|
251727
251781
|
}
|
|
251782
|
+
async function createAction({ log, runTask, isNonInteractive }, name2, options) {
|
|
251783
|
+
if (name2 && !options.path) {
|
|
251784
|
+
options.path = `./${import_kebabCase.default(name2)}`;
|
|
251785
|
+
}
|
|
251786
|
+
const skipPrompts = !!(options.name ?? name2) && !!options.path;
|
|
251787
|
+
if (!skipPrompts && isNonInteractive) {
|
|
251788
|
+
throw new InvalidInputError("Project name and --path are required in non-interactive mode", {
|
|
251789
|
+
hints: [
|
|
251790
|
+
{
|
|
251791
|
+
message: "Usage: base44 create <name> --path <path>"
|
|
251792
|
+
}
|
|
251793
|
+
]
|
|
251794
|
+
});
|
|
251795
|
+
}
|
|
251796
|
+
const ctx = { log, runTask };
|
|
251797
|
+
if (skipPrompts) {
|
|
251798
|
+
return await createNonInteractive({ name: options.name ?? name2, ...options }, ctx);
|
|
251799
|
+
}
|
|
251800
|
+
return await createInteractive({ name: name2, ...options }, ctx);
|
|
251801
|
+
}
|
|
251728
251802
|
function getCreateCommand() {
|
|
251729
251803
|
return new Base44Command("create", {
|
|
251730
251804
|
requireAppConfig: false,
|
|
@@ -251733,32 +251807,14 @@ function getCreateCommand() {
|
|
|
251733
251807
|
Examples:
|
|
251734
251808
|
$ base44 create my-app Creates a base44 project at ./my-app
|
|
251735
251809
|
$ base44 create my-todo-app --template backend-and-client Creates a base44 backend-and-client project at ./my-todo-app
|
|
251736
|
-
$ base44 create my-app --path ./projects/my-app --deploy Creates a base44 project at ./project/my-app and deploys it`).hook("preAction", validateNonInteractiveFlags).action(
|
|
251737
|
-
if (name2 && !options.path) {
|
|
251738
|
-
options.path = `./${import_kebabCase.default(name2)}`;
|
|
251739
|
-
}
|
|
251740
|
-
const skipPrompts = !!(options.name ?? name2) && !!options.path;
|
|
251741
|
-
if (!skipPrompts && command2.isNonInteractive) {
|
|
251742
|
-
throw new InvalidInputError("Project name and --path are required in non-interactive mode", {
|
|
251743
|
-
hints: [
|
|
251744
|
-
{
|
|
251745
|
-
message: "Usage: base44 create <name> --path <path>"
|
|
251746
|
-
}
|
|
251747
|
-
]
|
|
251748
|
-
});
|
|
251749
|
-
}
|
|
251750
|
-
if (skipPrompts) {
|
|
251751
|
-
return await createNonInteractive({
|
|
251752
|
-
name: options.name ?? name2,
|
|
251753
|
-
...options
|
|
251754
|
-
});
|
|
251755
|
-
}
|
|
251756
|
-
return await createInteractive({ name: name2, ...options });
|
|
251757
|
-
});
|
|
251810
|
+
$ base44 create my-app --path ./projects/my-app --deploy Creates a base44 project at ./project/my-app and deploys it`).hook("preAction", validateNonInteractiveFlags).action(createAction);
|
|
251758
251811
|
}
|
|
251759
251812
|
|
|
251760
251813
|
// src/cli/commands/project/deploy.ts
|
|
251761
|
-
async function deployAction(options) {
|
|
251814
|
+
async function deployAction({ isNonInteractive, log }, options = {}) {
|
|
251815
|
+
if (isNonInteractive && !options.yes) {
|
|
251816
|
+
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
251817
|
+
}
|
|
251762
251818
|
const projectData = await readProjectConfig(options.projectRoot);
|
|
251763
251819
|
if (!hasResourcesToDeploy(projectData)) {
|
|
251764
251820
|
return {
|
|
@@ -251783,7 +251839,7 @@ async function deployAction(options) {
|
|
|
251783
251839
|
summaryLines.push(` - Site from ${project2.site.outputDirectory}`);
|
|
251784
251840
|
}
|
|
251785
251841
|
if (!options.yes) {
|
|
251786
|
-
|
|
251842
|
+
log.warn(`This will update your Base44 app with:
|
|
251787
251843
|
${summaryLines.join(`
|
|
251788
251844
|
`)}`);
|
|
251789
251845
|
const shouldDeploy = await Re({
|
|
@@ -251793,7 +251849,7 @@ ${summaryLines.join(`
|
|
|
251793
251849
|
return { outroMessage: "Deployment cancelled" };
|
|
251794
251850
|
}
|
|
251795
251851
|
} else {
|
|
251796
|
-
|
|
251852
|
+
log.info(`Deploying:
|
|
251797
251853
|
${summaryLines.join(`
|
|
251798
251854
|
`)}`);
|
|
251799
251855
|
}
|
|
@@ -251802,54 +251858,46 @@ ${summaryLines.join(`
|
|
|
251802
251858
|
const result = await deployAll(projectData, {
|
|
251803
251859
|
onFunctionStart: (names) => {
|
|
251804
251860
|
const label = names.length === 1 ? names[0] : `${names.length} functions`;
|
|
251805
|
-
|
|
251861
|
+
log.step(theme.styles.dim(`[${functionCompleted + 1}/${functionTotal}] Deploying ${label}...`));
|
|
251806
251862
|
},
|
|
251807
251863
|
onFunctionResult: (r) => {
|
|
251808
251864
|
functionCompleted++;
|
|
251809
|
-
formatDeployResult(r);
|
|
251865
|
+
formatDeployResult(r, log);
|
|
251810
251866
|
}
|
|
251811
251867
|
});
|
|
251812
251868
|
const connectorResults = result.connectorResults ?? [];
|
|
251813
|
-
await handleOAuthConnectors(connectorResults, options);
|
|
251869
|
+
await handleOAuthConnectors(connectorResults, isNonInteractive, options, log);
|
|
251814
251870
|
const stripeResult = connectorResults.find((r) => r.type === "stripe");
|
|
251815
251871
|
if (stripeResult?.action === "provisioned") {
|
|
251816
|
-
printStripeResult(stripeResult);
|
|
251872
|
+
printStripeResult(stripeResult, log);
|
|
251817
251873
|
}
|
|
251818
|
-
|
|
251874
|
+
log.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl())}`);
|
|
251819
251875
|
if (result.appUrl) {
|
|
251820
|
-
|
|
251876
|
+
log.message(`${theme.styles.header("App URL")}: ${theme.colors.links(result.appUrl)}`);
|
|
251821
251877
|
}
|
|
251822
251878
|
return { outroMessage: "App deployed successfully" };
|
|
251823
251879
|
}
|
|
251824
251880
|
function getDeployCommand2() {
|
|
251825
|
-
return new Base44Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").action(
|
|
251826
|
-
if (command2.isNonInteractive && !options.yes) {
|
|
251827
|
-
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
251828
|
-
}
|
|
251829
|
-
return await deployAction({
|
|
251830
|
-
...options,
|
|
251831
|
-
isNonInteractive: command2.isNonInteractive
|
|
251832
|
-
});
|
|
251833
|
-
});
|
|
251881
|
+
return new Base44Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").action(deployAction);
|
|
251834
251882
|
}
|
|
251835
|
-
async function handleOAuthConnectors(connectorResults, options) {
|
|
251883
|
+
async function handleOAuthConnectors(connectorResults, isNonInteractive, options, log) {
|
|
251836
251884
|
const needsOAuth = filterPendingOAuth(connectorResults);
|
|
251837
251885
|
if (needsOAuth.length === 0)
|
|
251838
251886
|
return;
|
|
251839
|
-
const oauthOutcomes = await promptOAuthFlows(needsOAuth, {
|
|
251840
|
-
skipPrompt: options.yes ||
|
|
251887
|
+
const oauthOutcomes = await promptOAuthFlows(needsOAuth, log, {
|
|
251888
|
+
skipPrompt: options.yes || isNonInteractive
|
|
251841
251889
|
});
|
|
251842
251890
|
const allAuthorized = oauthOutcomes.size > 0 && [...oauthOutcomes.values()].every((s) => s === "ACTIVE");
|
|
251843
251891
|
if (!allAuthorized) {
|
|
251844
|
-
|
|
251892
|
+
log.info("Some connectors still require authorization. Run 'base44 connectors push' or open the links above in your browser.");
|
|
251845
251893
|
}
|
|
251846
251894
|
}
|
|
251847
|
-
function printStripeResult(r) {
|
|
251848
|
-
|
|
251895
|
+
function printStripeResult(r, log) {
|
|
251896
|
+
log.success("Stripe sandbox provisioned");
|
|
251849
251897
|
if (r.claimUrl) {
|
|
251850
|
-
|
|
251898
|
+
log.info(` Claim your Stripe sandbox: ${theme.colors.links(r.claimUrl)}`);
|
|
251851
251899
|
}
|
|
251852
|
-
|
|
251900
|
+
log.info(` Connectors dashboard: ${theme.colors.links(getConnectorsUrl())}`);
|
|
251853
251901
|
}
|
|
251854
251902
|
|
|
251855
251903
|
// src/cli/commands/project/link.ts
|
|
@@ -251925,7 +251973,12 @@ async function promptForExistingProject(linkableProjects) {
|
|
|
251925
251973
|
}
|
|
251926
251974
|
return selectedProject;
|
|
251927
251975
|
}
|
|
251928
|
-
async function link(options) {
|
|
251976
|
+
async function link(ctx, options) {
|
|
251977
|
+
const { log, runTask, isNonInteractive } = ctx;
|
|
251978
|
+
const skipPrompts = !!options.create || !!options.projectId;
|
|
251979
|
+
if (!skipPrompts && isNonInteractive) {
|
|
251980
|
+
throw new InvalidInputError("--create with --name, or --projectId, is required in non-interactive mode");
|
|
251981
|
+
}
|
|
251929
251982
|
const projectRoot = await findProjectRoot();
|
|
251930
251983
|
if (!projectRoot) {
|
|
251931
251984
|
throw new ConfigNotFoundError("No Base44 project found. Run this command from a project directory with a config.jsonc file.");
|
|
@@ -251989,17 +252042,11 @@ async function link(options) {
|
|
|
251989
252042
|
setAppConfig({ id: projectId, projectRoot: projectRoot.root });
|
|
251990
252043
|
finalProjectId = projectId;
|
|
251991
252044
|
}
|
|
251992
|
-
|
|
252045
|
+
log.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(finalProjectId))}`);
|
|
251993
252046
|
return { outroMessage: "Project linked" };
|
|
251994
252047
|
}
|
|
251995
252048
|
function getLinkCommand() {
|
|
251996
|
-
return new Base44Command("link", { requireAppConfig: false }).description("Link a local project to a Base44 project (create new or link existing)").option("-c, --create", "Create a new project (skip selection prompt)").option("-n, --name <name>", "Project name (required when --create is used)").option("-d, --description <description>", "Project description").option("-p, --projectId <id>", "Project ID to link to an existing project (skips selection prompt)").hook("preAction", validateNonInteractiveFlags2).action(
|
|
251997
|
-
const skipPrompts = !!options.create || !!options.projectId;
|
|
251998
|
-
if (!skipPrompts && command2.isNonInteractive) {
|
|
251999
|
-
throw new InvalidInputError("--create with --name, or --projectId, is required in non-interactive mode");
|
|
252000
|
-
}
|
|
252001
|
-
return await link(options);
|
|
252002
|
-
});
|
|
252049
|
+
return new Base44Command("link", { requireAppConfig: false }).description("Link a local project to a Base44 project (create new or link existing)").option("-c, --create", "Create a new project (skip selection prompt)").option("-n, --name <name>", "Project name (required when --create is used)").option("-d, --description <description>", "Project description").option("-p, --projectId <id>", "Project ID to link to an existing project (skips selection prompt)").hook("preAction", validateNonInteractiveFlags2).action(link);
|
|
252003
252050
|
}
|
|
252004
252051
|
|
|
252005
252052
|
// src/cli/commands/project/logs.ts
|
|
@@ -252101,7 +252148,7 @@ function validateLimit(limit) {
|
|
|
252101
252148
|
throw new InvalidInputError(`Invalid limit: "${limit}". Must be a number between 1 and 1000.`);
|
|
252102
252149
|
}
|
|
252103
252150
|
}
|
|
252104
|
-
async function logsAction(options) {
|
|
252151
|
+
async function logsAction(_ctx, options) {
|
|
252105
252152
|
validateLimit(options.limit);
|
|
252106
252153
|
const specifiedFunctions = parseFunctionNames(options.function);
|
|
252107
252154
|
const allProjectFunctions = await getAllFunctionNames();
|
|
@@ -252123,7 +252170,7 @@ function getLogsCommand() {
|
|
|
252123
252170
|
}
|
|
252124
252171
|
|
|
252125
252172
|
// src/cli/commands/secrets/delete.ts
|
|
252126
|
-
async function deleteSecretAction(key) {
|
|
252173
|
+
async function deleteSecretAction({ runTask }, key) {
|
|
252127
252174
|
await runTask(`Deleting secret "${key}"`, async () => {
|
|
252128
252175
|
return await deleteSecret(key);
|
|
252129
252176
|
}, {
|
|
@@ -252139,7 +252186,10 @@ function getSecretsDeleteCommand() {
|
|
|
252139
252186
|
}
|
|
252140
252187
|
|
|
252141
252188
|
// src/cli/commands/secrets/list.ts
|
|
252142
|
-
async function listSecretsAction(
|
|
252189
|
+
async function listSecretsAction({
|
|
252190
|
+
log,
|
|
252191
|
+
runTask
|
|
252192
|
+
}) {
|
|
252143
252193
|
const secrets = await runTask("Fetching secrets from Base44", async () => {
|
|
252144
252194
|
return await listSecrets();
|
|
252145
252195
|
}, {
|
|
@@ -252151,7 +252201,7 @@ async function listSecretsAction() {
|
|
|
252151
252201
|
return { outroMessage: "No secrets configured." };
|
|
252152
252202
|
}
|
|
252153
252203
|
for (const name2 of names) {
|
|
252154
|
-
|
|
252204
|
+
log.info(name2);
|
|
252155
252205
|
}
|
|
252156
252206
|
return {
|
|
252157
252207
|
outroMessage: `Found ${names.length} secrets.`
|
|
@@ -252189,7 +252239,7 @@ function validateInput(entries, options) {
|
|
|
252189
252239
|
throw new InvalidInputError("Provide KEY=VALUE pairs or --env-file, but not both.");
|
|
252190
252240
|
}
|
|
252191
252241
|
}
|
|
252192
|
-
async function setSecretsAction(entries, options) {
|
|
252242
|
+
async function setSecretsAction({ log, runTask }, entries, options) {
|
|
252193
252243
|
validateInput(entries, options);
|
|
252194
252244
|
let secrets;
|
|
252195
252245
|
if (options.envFile) {
|
|
@@ -252207,7 +252257,7 @@ async function setSecretsAction(entries, options) {
|
|
|
252207
252257
|
successMessage: `${names.length} secrets set successfully`,
|
|
252208
252258
|
errorMessage: "Failed to set secrets"
|
|
252209
252259
|
});
|
|
252210
|
-
|
|
252260
|
+
log.info(`Set: ${names.join(", ")}`);
|
|
252211
252261
|
return {
|
|
252212
252262
|
outroMessage: "Secrets set successfully."
|
|
252213
252263
|
};
|
|
@@ -252223,7 +252273,10 @@ function getSecretsCommand() {
|
|
|
252223
252273
|
|
|
252224
252274
|
// src/cli/commands/site/deploy.ts
|
|
252225
252275
|
import { resolve as resolve4 } from "node:path";
|
|
252226
|
-
async function deployAction2(options) {
|
|
252276
|
+
async function deployAction2({ isNonInteractive, runTask }, options) {
|
|
252277
|
+
if (isNonInteractive && !options.yes) {
|
|
252278
|
+
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
252279
|
+
}
|
|
252227
252280
|
const { project: project2 } = await readProjectConfig();
|
|
252228
252281
|
if (!project2.site?.outputDirectory) {
|
|
252229
252282
|
throw new ConfigNotFoundError("No site configuration found.", {
|
|
@@ -252252,19 +252305,13 @@ async function deployAction2(options) {
|
|
|
252252
252305
|
return { outroMessage: `Visit your site at: ${result.appUrl}` };
|
|
252253
252306
|
}
|
|
252254
252307
|
function getSiteDeployCommand() {
|
|
252255
|
-
return new Base44Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").action(
|
|
252256
|
-
if (command2.isNonInteractive && !options.yes) {
|
|
252257
|
-
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
252258
|
-
}
|
|
252259
|
-
return await deployAction2({
|
|
252260
|
-
...options,
|
|
252261
|
-
isNonInteractive: command2.isNonInteractive
|
|
252262
|
-
});
|
|
252263
|
-
});
|
|
252308
|
+
return new Base44Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").action(deployAction2);
|
|
252264
252309
|
}
|
|
252265
252310
|
|
|
252266
252311
|
// src/cli/commands/site/open.ts
|
|
252267
|
-
async function openAction(
|
|
252312
|
+
async function openAction({
|
|
252313
|
+
isNonInteractive
|
|
252314
|
+
}) {
|
|
252268
252315
|
const siteUrl = await getSiteUrl();
|
|
252269
252316
|
if (!isNonInteractive) {
|
|
252270
252317
|
await open_default(siteUrl);
|
|
@@ -252272,9 +252319,7 @@ async function openAction(isNonInteractive) {
|
|
|
252272
252319
|
return { outroMessage: `Site opened at ${siteUrl}` };
|
|
252273
252320
|
}
|
|
252274
252321
|
function getSiteOpenCommand() {
|
|
252275
|
-
return new Base44Command("open").description("Open the published site in your browser").action(
|
|
252276
|
-
return await openAction(command2.isNonInteractive);
|
|
252277
|
-
});
|
|
252322
|
+
return new Base44Command("open").description("Open the published site in your browser").action(openAction);
|
|
252278
252323
|
}
|
|
252279
252324
|
|
|
252280
252325
|
// src/cli/commands/site/index.ts
|
|
@@ -252392,7 +252437,9 @@ async function updateProjectConfig(projectRoot) {
|
|
|
252392
252437
|
}
|
|
252393
252438
|
// src/cli/commands/types/generate.ts
|
|
252394
252439
|
var TYPES_FILE_PATH = "base44/.types/types.d.ts";
|
|
252395
|
-
async function generateTypesAction(
|
|
252440
|
+
async function generateTypesAction({
|
|
252441
|
+
runTask
|
|
252442
|
+
}) {
|
|
252396
252443
|
const { entities, functions, agents, connectors, project: project2 } = await readProjectConfig();
|
|
252397
252444
|
await runTask("Generating types", async () => {
|
|
252398
252445
|
await generateTypesFile({ entities, functions, agents, connectors });
|
|
@@ -252412,9 +252459,9 @@ function getTypesCommand() {
|
|
|
252412
252459
|
}
|
|
252413
252460
|
|
|
252414
252461
|
// src/cli/dev/dev-server/main.ts
|
|
252415
|
-
import { dirname as dirname14, join as join20 } from "node:path";
|
|
252416
252462
|
var import_cors = __toESM(require_lib4(), 1);
|
|
252417
252463
|
var import_express5 = __toESM(require_express(), 1);
|
|
252464
|
+
import { dirname as dirname14, join as join20 } from "node:path";
|
|
252418
252465
|
|
|
252419
252466
|
// ../../node_modules/get-port/index.js
|
|
252420
252467
|
import net from "node:net";
|
|
@@ -252580,9 +252627,9 @@ class FunctionManager {
|
|
|
252580
252627
|
starting = new Map;
|
|
252581
252628
|
logger;
|
|
252582
252629
|
wrapperPath;
|
|
252583
|
-
constructor(functions,
|
|
252630
|
+
constructor(functions, logger2, wrapperPath) {
|
|
252584
252631
|
this.functions = new Map(functions.map((f7) => [f7.name, f7]));
|
|
252585
|
-
this.logger =
|
|
252632
|
+
this.logger = logger2;
|
|
252586
252633
|
this.wrapperPath = wrapperPath;
|
|
252587
252634
|
if (functions.length > 0) {
|
|
252588
252635
|
verifyDenoInstalled("to run backend functions locally");
|
|
@@ -252721,7 +252768,7 @@ class FunctionManager {
|
|
|
252721
252768
|
var import_express = __toESM(require_express(), 1);
|
|
252722
252769
|
var import_http_proxy_middleware = __toESM(require_dist2(), 1);
|
|
252723
252770
|
import { ServerResponse } from "node:http";
|
|
252724
|
-
function createFunctionRouter(manager,
|
|
252771
|
+
function createFunctionRouter(manager, logger2) {
|
|
252725
252772
|
const router = import_express.Router({ mergeParams: true });
|
|
252726
252773
|
const portsByRequest = new WeakMap;
|
|
252727
252774
|
const proxy = import_http_proxy_middleware.createProxyMiddleware({
|
|
@@ -252736,7 +252783,7 @@ function createFunctionRouter(manager, logger) {
|
|
|
252736
252783
|
proxyReq.setHeader("Base44-Api-Url", `${req.protocol}://${req.headers.host}`);
|
|
252737
252784
|
},
|
|
252738
252785
|
error: (err, _req, res) => {
|
|
252739
|
-
|
|
252786
|
+
logger2.error("Function proxy error:", err);
|
|
252740
252787
|
if (res instanceof ServerResponse && !res.headersSent) {
|
|
252741
252788
|
res.writeHead(502, { "Content-Type": "application/json" });
|
|
252742
252789
|
res.end(JSON.stringify({
|
|
@@ -252754,7 +252801,7 @@ function createFunctionRouter(manager, logger) {
|
|
|
252754
252801
|
portsByRequest.set(req, port);
|
|
252755
252802
|
next();
|
|
252756
252803
|
} catch (error48) {
|
|
252757
|
-
|
|
252804
|
+
logger2.error("Function error:", error48);
|
|
252758
252805
|
const message = error48 instanceof Error ? error48.message : String(error48);
|
|
252759
252806
|
res.status(500).json({ error: message });
|
|
252760
252807
|
}
|
|
@@ -253090,7 +253137,7 @@ var import_express3 = __toESM(require_express(), 1);
|
|
|
253090
253137
|
// src/cli/dev/dev-server/routes/entities/entities-user-router.ts
|
|
253091
253138
|
var import_express2 = __toESM(require_express(), 1);
|
|
253092
253139
|
var import_jsonwebtoken = __toESM(require_jsonwebtoken(), 1);
|
|
253093
|
-
function createUserRouter(db2,
|
|
253140
|
+
function createUserRouter(db2, logger2) {
|
|
253094
253141
|
const router = import_express2.Router({ mergeParams: true });
|
|
253095
253142
|
const parseBody = import_express2.json();
|
|
253096
253143
|
function withAuth(handler) {
|
|
@@ -253169,7 +253216,7 @@ function createUserRouter(db2, logger) {
|
|
|
253169
253216
|
res.status(422).json(error48.context);
|
|
253170
253217
|
return;
|
|
253171
253218
|
}
|
|
253172
|
-
|
|
253219
|
+
logger2.error(`Error in PUT /${USER_COLLECTION}/${req.params.id}:`, error48);
|
|
253173
253220
|
res.status(500).json({ error: "Internal server error" });
|
|
253174
253221
|
}
|
|
253175
253222
|
} else {
|
|
@@ -253205,7 +253252,7 @@ function parseFields(fields) {
|
|
|
253205
253252
|
}
|
|
253206
253253
|
return Object.keys(projection).length > 0 ? projection : undefined;
|
|
253207
253254
|
}
|
|
253208
|
-
async function createEntityRoutes(db2,
|
|
253255
|
+
async function createEntityRoutes(db2, logger2, broadcast) {
|
|
253209
253256
|
const router = import_express3.Router({ mergeParams: true });
|
|
253210
253257
|
const parseBody = import_express3.json();
|
|
253211
253258
|
function withCollection(handler) {
|
|
@@ -253233,7 +253280,7 @@ async function createEntityRoutes(db2, logger, broadcast) {
|
|
|
253233
253280
|
}
|
|
253234
253281
|
broadcast(appId, entityName, createData(data));
|
|
253235
253282
|
}
|
|
253236
|
-
const userRouter = createUserRouter(db2,
|
|
253283
|
+
const userRouter = createUserRouter(db2, logger2);
|
|
253237
253284
|
router.use("/User", userRouter);
|
|
253238
253285
|
router.get("/:entityName/:id", withCollection(async (req, res, collection) => {
|
|
253239
253286
|
const { entityName, id: id2 } = req.params;
|
|
@@ -253245,7 +253292,7 @@ async function createEntityRoutes(db2, logger, broadcast) {
|
|
|
253245
253292
|
}
|
|
253246
253293
|
res.json(stripInternalFields(doc2));
|
|
253247
253294
|
} catch (error48) {
|
|
253248
|
-
|
|
253295
|
+
logger2.error(`Error in GET /${entityName}/${id2}:`, error48);
|
|
253249
253296
|
res.status(500).json({ error: "Internal server error" });
|
|
253250
253297
|
}
|
|
253251
253298
|
}));
|
|
@@ -253286,7 +253333,7 @@ async function createEntityRoutes(db2, logger, broadcast) {
|
|
|
253286
253333
|
const docs = await cursor3;
|
|
253287
253334
|
res.json(stripInternalFields(docs));
|
|
253288
253335
|
} catch (error48) {
|
|
253289
|
-
|
|
253336
|
+
logger2.error(`Error in GET /${entityName}:`, error48);
|
|
253290
253337
|
res.status(500).json({ error: "Internal server error" });
|
|
253291
253338
|
}
|
|
253292
253339
|
}));
|
|
@@ -253311,7 +253358,7 @@ async function createEntityRoutes(db2, logger, broadcast) {
|
|
|
253311
253358
|
res.status(422).json(error48.context);
|
|
253312
253359
|
return;
|
|
253313
253360
|
}
|
|
253314
|
-
|
|
253361
|
+
logger2.error(`Error in POST /${entityName}:`, error48);
|
|
253315
253362
|
res.status(500).json({ error: "Internal server error" });
|
|
253316
253363
|
}
|
|
253317
253364
|
}));
|
|
@@ -253342,7 +253389,7 @@ async function createEntityRoutes(db2, logger, broadcast) {
|
|
|
253342
253389
|
res.status(422).json(error48.context);
|
|
253343
253390
|
return;
|
|
253344
253391
|
}
|
|
253345
|
-
|
|
253392
|
+
logger2.error(`Error in POST /${entityName}/bulk:`, error48);
|
|
253346
253393
|
res.status(500).json({ error: "Internal server error" });
|
|
253347
253394
|
}
|
|
253348
253395
|
}));
|
|
@@ -253369,7 +253416,7 @@ async function createEntityRoutes(db2, logger, broadcast) {
|
|
|
253369
253416
|
res.status(422).json(error48.context);
|
|
253370
253417
|
return;
|
|
253371
253418
|
}
|
|
253372
|
-
|
|
253419
|
+
logger2.error(`Error in PUT /${entityName}/${id2}:`, error48);
|
|
253373
253420
|
res.status(500).json({ error: "Internal server error" });
|
|
253374
253421
|
}
|
|
253375
253422
|
}));
|
|
@@ -253387,7 +253434,7 @@ async function createEntityRoutes(db2, logger, broadcast) {
|
|
|
253387
253434
|
}
|
|
253388
253435
|
res.json({ success: true });
|
|
253389
253436
|
} catch (error48) {
|
|
253390
|
-
|
|
253437
|
+
logger2.error(`Error in DELETE /${entityName}/${id2}:`, error48);
|
|
253391
253438
|
res.status(500).json({ error: "Internal server error" });
|
|
253392
253439
|
}
|
|
253393
253440
|
}));
|
|
@@ -253398,7 +253445,7 @@ async function createEntityRoutes(db2, logger, broadcast) {
|
|
|
253398
253445
|
const numRemoved = await collection.removeAsync(query, { multi: true });
|
|
253399
253446
|
res.json({ success: true, deleted: numRemoved });
|
|
253400
253447
|
} catch (error48) {
|
|
253401
|
-
|
|
253448
|
+
logger2.error(`Error in DELETE /${entityName}:`, error48);
|
|
253402
253449
|
res.status(500).json({ error: "Internal server error" });
|
|
253403
253450
|
}
|
|
253404
253451
|
}));
|
|
@@ -253414,7 +253461,7 @@ import path18 from "node:path";
|
|
|
253414
253461
|
function createFileToken(fileUri) {
|
|
253415
253462
|
return createHash("sha256").update(fileUri).digest("hex");
|
|
253416
253463
|
}
|
|
253417
|
-
function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy,
|
|
253464
|
+
function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger2) {
|
|
253418
253465
|
const router = import_express4.Router({ mergeParams: true });
|
|
253419
253466
|
const parseBody = import_express4.json();
|
|
253420
253467
|
const privateFilesDir = path18.join(mediaFilesDir, "private");
|
|
@@ -253467,12 +253514,12 @@ function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
|
|
|
253467
253514
|
res.json({ signed_url });
|
|
253468
253515
|
});
|
|
253469
253516
|
router.post("/Core/:endpointName", (req, res, next) => {
|
|
253470
|
-
|
|
253517
|
+
logger2.warn(`Core.${req.params.endpointName} is not supported in local development`);
|
|
253471
253518
|
req.url = req.originalUrl;
|
|
253472
253519
|
remoteProxy(req, res, next);
|
|
253473
253520
|
});
|
|
253474
253521
|
router.post("/installable/:packageName/integration-endpoints/:endpointName", (req, res, next) => {
|
|
253475
|
-
|
|
253522
|
+
logger2.warn(`${req.params.packageName}.${req.params.endpointName} is not supported in local development`);
|
|
253476
253523
|
req.url = req.originalUrl;
|
|
253477
253524
|
remoteProxy(req, res, next);
|
|
253478
253525
|
});
|
|
@@ -253485,10 +253532,10 @@ function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
|
|
|
253485
253532
|
});
|
|
253486
253533
|
return router;
|
|
253487
253534
|
}
|
|
253488
|
-
function createCustomIntegrationRoutes(remoteProxy,
|
|
253535
|
+
function createCustomIntegrationRoutes(remoteProxy, logger2) {
|
|
253489
253536
|
const router = import_express4.Router({ mergeParams: true });
|
|
253490
253537
|
router.post("/:slug/:operationId", (req, res, next) => {
|
|
253491
|
-
|
|
253538
|
+
logger2.warn(`"${req.originalUrl}" is not supported in local development, passing call to production`);
|
|
253492
253539
|
req.url = req.originalUrl;
|
|
253493
253540
|
remoteProxy(req, res, next);
|
|
253494
253541
|
});
|
|
@@ -255121,10 +255168,10 @@ class WatchBase44 extends EventEmitter4 {
|
|
|
255121
255168
|
entryNames;
|
|
255122
255169
|
watchers = new Map;
|
|
255123
255170
|
queueWaitForCreationTimeout = null;
|
|
255124
|
-
constructor(itemsToWatch,
|
|
255171
|
+
constructor(itemsToWatch, logger2) {
|
|
255125
255172
|
super();
|
|
255126
255173
|
this.itemsToWatch = itemsToWatch;
|
|
255127
|
-
this.logger =
|
|
255174
|
+
this.logger = logger2;
|
|
255128
255175
|
this.entryNames = Object.keys(itemsToWatch);
|
|
255129
255176
|
}
|
|
255130
255177
|
async start() {
|
|
@@ -255221,12 +255268,12 @@ async function createDevServer(options8) {
|
|
|
255221
255268
|
const functionRoutes = createFunctionRouter(functionManager, devLogger);
|
|
255222
255269
|
app.use("/api/apps/:appId/functions", functionRoutes);
|
|
255223
255270
|
if (functionManager.getFunctionNames().length > 0) {
|
|
255224
|
-
|
|
255271
|
+
options8.log.info(`Loaded functions: ${functionManager.getFunctionNames().join(", ")}`);
|
|
255225
255272
|
}
|
|
255226
255273
|
const db2 = new Database;
|
|
255227
255274
|
await db2.load(entities);
|
|
255228
255275
|
if (db2.getCollectionNames().length > 0) {
|
|
255229
|
-
|
|
255276
|
+
options8.log.info(`Loaded entities: ${db2.getCollectionNames().join(", ")}`);
|
|
255230
255277
|
}
|
|
255231
255278
|
let emitEntityEvent = () => {};
|
|
255232
255279
|
const entityRoutes = await createEntityRoutes(db2, devLogger, (...args) => emitEntityEvent(...args));
|
|
@@ -255322,9 +255369,10 @@ async function createDevServer(options8) {
|
|
|
255322
255369
|
}
|
|
255323
255370
|
|
|
255324
255371
|
// src/cli/commands/dev.ts
|
|
255325
|
-
async function devAction(options8) {
|
|
255372
|
+
async function devAction({ log }, options8) {
|
|
255326
255373
|
const port = options8.port ? Number(options8.port) : undefined;
|
|
255327
255374
|
const { port: resolvedPort } = await createDevServer({
|
|
255375
|
+
log,
|
|
255328
255376
|
port,
|
|
255329
255377
|
denoWrapperPath: getDenoWrapperPath(),
|
|
255330
255378
|
loadResources: async () => {
|
|
@@ -255422,15 +255470,22 @@ Examples:
|
|
|
255422
255470
|
$ cat ./script.ts | base44 exec
|
|
255423
255471
|
|
|
255424
255472
|
Inline script:
|
|
255425
|
-
$ echo "const users = await base44.entities.User.list()" | base44 exec`).action(async (
|
|
255426
|
-
return await execAction(
|
|
255473
|
+
$ echo "const users = await base44.entities.User.list()" | base44 exec`).action(async ({ isNonInteractive }) => {
|
|
255474
|
+
return await execAction(isNonInteractive);
|
|
255427
255475
|
});
|
|
255428
255476
|
}
|
|
255429
255477
|
|
|
255430
255478
|
// src/cli/commands/project/eject.ts
|
|
255431
255479
|
import { resolve as resolve8 } from "node:path";
|
|
255432
255480
|
var import_kebabCase2 = __toESM(require_kebabCase(), 1);
|
|
255433
|
-
async function eject(options8) {
|
|
255481
|
+
async function eject(ctx, options8) {
|
|
255482
|
+
const { log, runTask, isNonInteractive } = ctx;
|
|
255483
|
+
if (isNonInteractive && !options8.projectId) {
|
|
255484
|
+
throw new InvalidInputError("--project-id is required in non-interactive mode");
|
|
255485
|
+
}
|
|
255486
|
+
if (isNonInteractive && !options8.path) {
|
|
255487
|
+
throw new InvalidInputError("--path is required in non-interactive mode");
|
|
255488
|
+
}
|
|
255434
255489
|
const projects = await listProjects();
|
|
255435
255490
|
const ejectableProjects = projects.filter((p4) => p4.isManagedSourceCode !== false);
|
|
255436
255491
|
let selectedProject;
|
|
@@ -255446,7 +255501,7 @@ async function eject(options8) {
|
|
|
255446
255501
|
});
|
|
255447
255502
|
}
|
|
255448
255503
|
selectedProject = foundProject;
|
|
255449
|
-
|
|
255504
|
+
log.info(`Selected project: ${theme.styles.bold(selectedProject.name)}`);
|
|
255450
255505
|
} else {
|
|
255451
255506
|
if (ejectableProjects.length === 0) {
|
|
255452
255507
|
return { outroMessage: "No projects available to eject." };
|
|
@@ -255510,24 +255565,13 @@ async function eject(options8) {
|
|
|
255510
255565
|
successMessage: theme.colors.base44Orange("Project built successfully"),
|
|
255511
255566
|
errorMessage: "Failed to build project"
|
|
255512
255567
|
});
|
|
255513
|
-
await deployAction({ yes: true, projectRoot: resolvedPath });
|
|
255568
|
+
await deployAction(ctx, { yes: true, projectRoot: resolvedPath });
|
|
255514
255569
|
}
|
|
255515
255570
|
}
|
|
255516
255571
|
return { outroMessage: "Your new project is set and ready to use" };
|
|
255517
255572
|
}
|
|
255518
255573
|
function getEjectCommand() {
|
|
255519
|
-
return new Base44Command("eject", { requireAppConfig: false }).description("Download the code for an existing Base44 project").option("-p, --path <path>", "Path where to write the project").option("--project-id <id>", "Project ID to eject (skips interactive selection)").option("-y, --yes", "Skip confirmation prompts").action(
|
|
255520
|
-
if (command2.isNonInteractive && !options8.projectId) {
|
|
255521
|
-
throw new InvalidInputError("--project-id is required in non-interactive mode");
|
|
255522
|
-
}
|
|
255523
|
-
if (command2.isNonInteractive && !options8.path) {
|
|
255524
|
-
throw new InvalidInputError("--path is required in non-interactive mode");
|
|
255525
|
-
}
|
|
255526
|
-
return await eject({
|
|
255527
|
-
...options8,
|
|
255528
|
-
isNonInteractive: command2.isNonInteractive
|
|
255529
|
-
});
|
|
255530
|
-
});
|
|
255574
|
+
return new Base44Command("eject", { requireAppConfig: false }).description("Download the code for an existing Base44 project").option("-p, --path <path>", "Path where to write the project").option("--project-id <id>", "Project ID to eject (skips interactive selection)").option("-y, --yes", "Skip confirmation prompts").action(eject);
|
|
255531
255575
|
}
|
|
255532
255576
|
|
|
255533
255577
|
// src/cli/program.ts
|
|
@@ -256009,23 +256053,23 @@ function isInstanceOf(candidate, base) {
|
|
|
256009
256053
|
}
|
|
256010
256054
|
|
|
256011
256055
|
// ../../node_modules/@posthog/core/dist/utils/number-utils.mjs
|
|
256012
|
-
function clampToRange(value, min, max,
|
|
256056
|
+
function clampToRange(value, min, max, logger2, fallbackValue) {
|
|
256013
256057
|
if (min > max) {
|
|
256014
|
-
|
|
256058
|
+
logger2.warn("min cannot be greater than max.");
|
|
256015
256059
|
min = max;
|
|
256016
256060
|
}
|
|
256017
256061
|
if (isNumber(value))
|
|
256018
256062
|
if (value > max) {
|
|
256019
|
-
|
|
256063
|
+
logger2.warn(" cannot be greater than max: " + max + ". Using max value instead.");
|
|
256020
256064
|
return max;
|
|
256021
256065
|
} else {
|
|
256022
256066
|
if (!(value < min))
|
|
256023
256067
|
return value;
|
|
256024
|
-
|
|
256068
|
+
logger2.warn(" cannot be less than min: " + min + ". Using min value instead.");
|
|
256025
256069
|
return min;
|
|
256026
256070
|
}
|
|
256027
|
-
|
|
256028
|
-
return clampToRange(fallbackValue || max, min, max,
|
|
256071
|
+
logger2.warn(" must be a number. using max or fallback. max: " + max + ", fallback: " + fallbackValue);
|
|
256072
|
+
return clampToRange(fallbackValue || max, min, max, logger2);
|
|
256029
256073
|
}
|
|
256030
256074
|
|
|
256031
256075
|
// ../../node_modules/@posthog/core/dist/utils/bucketed-rate-limiter.mjs
|
|
@@ -256115,7 +256159,7 @@ var _createLogger = (prefix, maybeCall, consoleLike) => {
|
|
|
256115
256159
|
consoleMethod(prefix, ...args);
|
|
256116
256160
|
});
|
|
256117
256161
|
}
|
|
256118
|
-
const
|
|
256162
|
+
const logger2 = {
|
|
256119
256163
|
info: (...args) => {
|
|
256120
256164
|
_log("log", ...args);
|
|
256121
256165
|
},
|
|
@@ -256130,7 +256174,7 @@ var _createLogger = (prefix, maybeCall, consoleLike) => {
|
|
|
256130
256174
|
},
|
|
256131
256175
|
createLogger: (additionalPrefix) => _createLogger(`${prefix} ${additionalPrefix}`, maybeCall, consoleLike)
|
|
256132
256176
|
};
|
|
256133
|
-
return
|
|
256177
|
+
return logger2;
|
|
256134
256178
|
};
|
|
256135
256179
|
var passThrough = (fn9) => fn9();
|
|
256136
256180
|
function createLogger(prefix, maybeCall = passThrough) {
|
|
@@ -259765,6 +259809,37 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
|
|
|
259765
259809
|
});
|
|
259766
259810
|
});
|
|
259767
259811
|
}
|
|
259812
|
+
// src/cli/utils/runTask.ts
|
|
259813
|
+
function createInteractiveRunTask() {
|
|
259814
|
+
return async (startMessage, operation, options8) => {
|
|
259815
|
+
const s5 = bt2();
|
|
259816
|
+
s5.start(startMessage);
|
|
259817
|
+
const updateMessage = (message) => s5.message(message);
|
|
259818
|
+
try {
|
|
259819
|
+
const result = await operation(updateMessage);
|
|
259820
|
+
s5.stop(options8?.successMessage || startMessage);
|
|
259821
|
+
return result;
|
|
259822
|
+
} catch (error48) {
|
|
259823
|
+
s5.error(options8?.errorMessage || "Failed");
|
|
259824
|
+
throw error48;
|
|
259825
|
+
}
|
|
259826
|
+
};
|
|
259827
|
+
}
|
|
259828
|
+
function createSimpleRunTask(log) {
|
|
259829
|
+
return async (startMessage, operation, options8) => {
|
|
259830
|
+
log.info(startMessage);
|
|
259831
|
+
const updateMessage = (message) => log.info(message);
|
|
259832
|
+
try {
|
|
259833
|
+
const result = await operation(updateMessage);
|
|
259834
|
+
log.success(options8?.successMessage || startMessage);
|
|
259835
|
+
return result;
|
|
259836
|
+
} catch (error48) {
|
|
259837
|
+
log.error(options8?.errorMessage || "Failed");
|
|
259838
|
+
throw error48;
|
|
259839
|
+
}
|
|
259840
|
+
};
|
|
259841
|
+
}
|
|
259842
|
+
|
|
259768
259843
|
// src/cli/index.ts
|
|
259769
259844
|
var __dirname4 = dirname16(fileURLToPath6(import.meta.url));
|
|
259770
259845
|
async function runCLI(options8) {
|
|
@@ -259772,10 +259847,14 @@ async function runCLI(options8) {
|
|
|
259772
259847
|
const errorReporter = new ErrorReporter;
|
|
259773
259848
|
errorReporter.registerProcessErrorHandlers();
|
|
259774
259849
|
const isNonInteractive = !process.stdin.isTTY || !process.stdout.isTTY;
|
|
259850
|
+
const log = isNonInteractive ? new SimpleLogger : new ClackLogger;
|
|
259851
|
+
const runTask = isNonInteractive ? createSimpleRunTask(log) : createInteractiveRunTask();
|
|
259775
259852
|
const context = {
|
|
259776
259853
|
errorReporter,
|
|
259777
259854
|
isNonInteractive,
|
|
259778
|
-
distribution: options8?.distribution ?? "npm"
|
|
259855
|
+
distribution: options8?.distribution ?? "npm",
|
|
259856
|
+
log,
|
|
259857
|
+
runTask
|
|
259779
259858
|
};
|
|
259780
259859
|
const program2 = createProgram(context);
|
|
259781
259860
|
try {
|
|
@@ -259801,4 +259880,4 @@ export {
|
|
|
259801
259880
|
CLIExitError
|
|
259802
259881
|
};
|
|
259803
259882
|
|
|
259804
|
-
//# debugId=
|
|
259883
|
+
//# debugId=7426790ECCD5E42B64756E2164756E21
|