@base44-preview/cli 0.0.47-pr.422.2b2e7e7 → 0.0.47-pr.422.cab311c
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 +472 -418
- package/dist/cli/index.js.map +45 -42
- 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 dirname18, join as join24 } 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 join12 } 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 join12 } 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`;
|
|
@@ -241768,6 +241815,16 @@ async function pushAuthConfig(config3) {
|
|
|
241768
241815
|
}
|
|
241769
241816
|
await pushAuthConfigToApi(config3);
|
|
241770
241817
|
}
|
|
241818
|
+
// src/core/resources/auth-config/resource.ts
|
|
241819
|
+
var authConfigResource = {
|
|
241820
|
+
readAll: async (dir) => {
|
|
241821
|
+
const config3 = await readAuthConfig(dir);
|
|
241822
|
+
return config3 ? [config3] : [];
|
|
241823
|
+
},
|
|
241824
|
+
push: async (items) => {
|
|
241825
|
+
await pushAuthConfig(items[0] ?? null);
|
|
241826
|
+
}
|
|
241827
|
+
};
|
|
241771
241828
|
// src/core/resources/connector/schema.ts
|
|
241772
241829
|
var GoogleCalendarConnectorSchema = exports_external.object({
|
|
241773
241830
|
type: exports_external.literal("googlecalendar"),
|
|
@@ -242893,7 +242950,7 @@ async function readProjectConfig(projectRoot) {
|
|
|
242893
242950
|
functionResource.readAll(join8(configDir, project.functionsDir)),
|
|
242894
242951
|
agentResource.readAll(join8(configDir, project.agentsDir)),
|
|
242895
242952
|
connectorResource.readAll(join8(configDir, project.connectorsDir)),
|
|
242896
|
-
|
|
242953
|
+
authConfigResource.readAll(join8(configDir, project.authDir))
|
|
242897
242954
|
]);
|
|
242898
242955
|
return {
|
|
242899
242956
|
project: { ...project, root, configPath },
|
|
@@ -243127,6 +243184,7 @@ var package_default = {
|
|
|
243127
243184
|
url: "https://github.com/base44/cli"
|
|
243128
243185
|
},
|
|
243129
243186
|
devDependencies: {
|
|
243187
|
+
"@base44-cli/logger": "workspace:*",
|
|
243130
243188
|
"@clack/prompts": "^1.0.1",
|
|
243131
243189
|
"@seald-io/nedb": "^4.1.2",
|
|
243132
243190
|
"@types/bun": "^1.2.15",
|
|
@@ -243340,7 +243398,7 @@ function hasResourcesToDeploy(projectData) {
|
|
|
243340
243398
|
const hasFunctions = functions.length > 0;
|
|
243341
243399
|
const hasAgents = agents.length > 0;
|
|
243342
243400
|
const hasConnectors = connectors.length > 0;
|
|
243343
|
-
const hasAuthConfig = authConfig
|
|
243401
|
+
const hasAuthConfig = authConfig.length > 0;
|
|
243344
243402
|
return hasEntities || hasFunctions || hasAgents || hasConnectors || hasAuthConfig || hasSite;
|
|
243345
243403
|
}
|
|
243346
243404
|
async function deployAll(projectData, options) {
|
|
@@ -243351,9 +243409,7 @@ async function deployAll(projectData, options) {
|
|
|
243351
243409
|
onResult: options?.onFunctionResult
|
|
243352
243410
|
});
|
|
243353
243411
|
await agentResource.push(agents);
|
|
243354
|
-
|
|
243355
|
-
await pushAuthConfig(authConfig);
|
|
243356
|
-
}
|
|
243412
|
+
await authConfigResource.push(authConfig);
|
|
243357
243413
|
const { results: connectorResults } = await pushConnectors(connectors);
|
|
243358
243414
|
if (project.site?.outputDirectory) {
|
|
243359
243415
|
const outputDir = resolve(project.root, project.site.outputDirectory);
|
|
@@ -243540,14 +243596,14 @@ async function getUserInfo(accessToken) {
|
|
|
243540
243596
|
return result.data;
|
|
243541
243597
|
}
|
|
243542
243598
|
// src/cli/commands/auth/login-flow.ts
|
|
243543
|
-
async function generateAndDisplayDeviceCode() {
|
|
243599
|
+
async function generateAndDisplayDeviceCode(log) {
|
|
243544
243600
|
const deviceCodeResponse = await runTask("Generating device code...", async () => {
|
|
243545
243601
|
return await generateDeviceCode();
|
|
243546
243602
|
}, {
|
|
243547
243603
|
successMessage: "Device code generated",
|
|
243548
243604
|
errorMessage: "Failed to generate device code"
|
|
243549
243605
|
});
|
|
243550
|
-
|
|
243606
|
+
log.info(`Verification code: ${theme.styles.bold(deviceCodeResponse.userCode)}` + `
|
|
243551
243607
|
Please confirm this code at: ${deviceCodeResponse.verificationUri}`);
|
|
243552
243608
|
return deviceCodeResponse;
|
|
243553
243609
|
}
|
|
@@ -243591,8 +243647,8 @@ async function saveAuthData(response, userInfo) {
|
|
|
243591
243647
|
name: userInfo.name
|
|
243592
243648
|
});
|
|
243593
243649
|
}
|
|
243594
|
-
async function login() {
|
|
243595
|
-
const deviceCodeResponse = await generateAndDisplayDeviceCode();
|
|
243650
|
+
async function login({ log }) {
|
|
243651
|
+
const deviceCodeResponse = await generateAndDisplayDeviceCode(log);
|
|
243596
243652
|
const token = await waitForAuthentication(deviceCodeResponse.deviceCode, deviceCodeResponse.expiresIn, deviceCodeResponse.interval);
|
|
243597
243653
|
const userInfo = await getUserInfo(token.accessToken);
|
|
243598
243654
|
await saveAuthData(token, userInfo);
|
|
@@ -243602,22 +243658,22 @@ async function login() {
|
|
|
243602
243658
|
}
|
|
243603
243659
|
|
|
243604
243660
|
// src/cli/utils/command/middleware.ts
|
|
243605
|
-
async function ensureAuth(
|
|
243661
|
+
async function ensureAuth(ctx) {
|
|
243606
243662
|
const loggedIn = await isLoggedIn();
|
|
243607
243663
|
if (!loggedIn) {
|
|
243608
|
-
|
|
243609
|
-
await login();
|
|
243664
|
+
ctx.log.info("You need to login first to continue.");
|
|
243665
|
+
await login(ctx);
|
|
243610
243666
|
}
|
|
243611
243667
|
try {
|
|
243612
243668
|
const userInfo = await readAuth();
|
|
243613
|
-
errorReporter.setContext({
|
|
243669
|
+
ctx.errorReporter.setContext({
|
|
243614
243670
|
user: { email: userInfo.email, name: userInfo.name }
|
|
243615
243671
|
});
|
|
243616
243672
|
} catch {}
|
|
243617
243673
|
}
|
|
243618
|
-
async function ensureAppConfig(
|
|
243674
|
+
async function ensureAppConfig(ctx) {
|
|
243619
243675
|
const appConfig = await initAppConfig();
|
|
243620
|
-
errorReporter.setContext({ appId: appConfig.id });
|
|
243676
|
+
ctx.errorReporter.setContext({ appId: appConfig.id });
|
|
243621
243677
|
}
|
|
243622
243678
|
|
|
243623
243679
|
// ../../node_modules/is-plain-obj/index.js
|
|
@@ -250263,9 +250319,6 @@ class Base44Command extends Command {
|
|
|
250263
250319
|
setContext(context) {
|
|
250264
250320
|
this._context = context;
|
|
250265
250321
|
}
|
|
250266
|
-
get isNonInteractive() {
|
|
250267
|
-
return this._context?.isNonInteractive ?? false;
|
|
250268
|
-
}
|
|
250269
250322
|
get context() {
|
|
250270
250323
|
if (!this._context) {
|
|
250271
250324
|
throw new Error("Base44Command context not set. Ensure the command is registered via createProgram().");
|
|
@@ -250281,12 +250334,12 @@ class Base44Command extends Command {
|
|
|
250281
250334
|
const upgradeCheckPromise = startUpgradeCheck();
|
|
250282
250335
|
try {
|
|
250283
250336
|
if (this._commandOptions.requireAuth) {
|
|
250284
|
-
await ensureAuth(this.context
|
|
250337
|
+
await ensureAuth(this.context);
|
|
250285
250338
|
}
|
|
250286
250339
|
if (this._commandOptions.requireAppConfig) {
|
|
250287
|
-
await ensureAppConfig(this.context
|
|
250340
|
+
await ensureAppConfig(this.context);
|
|
250288
250341
|
}
|
|
250289
|
-
const result = await fn(...args) ?? {};
|
|
250342
|
+
const result = await fn(this.context, ...args) ?? {};
|
|
250290
250343
|
if (!quiet) {
|
|
250291
250344
|
await showCommandEnd(result, upgradeCheckPromise, this.context.distribution);
|
|
250292
250345
|
} else {
|
|
@@ -250494,7 +250547,9 @@ async function parseEnvFile(filePath) {
|
|
|
250494
250547
|
return import_dotenv.parse(content);
|
|
250495
250548
|
}
|
|
250496
250549
|
// src/cli/commands/agents/pull.ts
|
|
250497
|
-
async function pullAgentsAction(
|
|
250550
|
+
async function pullAgentsAction({
|
|
250551
|
+
log
|
|
250552
|
+
}) {
|
|
250498
250553
|
const { project: project2 } = await readProjectConfig();
|
|
250499
250554
|
const configDir = dirname7(project2.configPath);
|
|
250500
250555
|
const agentsDir = join12(configDir, project2.agentsDir);
|
|
@@ -250511,13 +250566,13 @@ async function pullAgentsAction() {
|
|
|
250511
250566
|
errorMessage: "Failed to sync agent files"
|
|
250512
250567
|
});
|
|
250513
250568
|
if (written.length > 0) {
|
|
250514
|
-
|
|
250569
|
+
log.success(`Written: ${written.join(", ")}`);
|
|
250515
250570
|
}
|
|
250516
250571
|
if (deleted.length > 0) {
|
|
250517
|
-
|
|
250572
|
+
log.warn(`Deleted: ${deleted.join(", ")}`);
|
|
250518
250573
|
}
|
|
250519
250574
|
if (written.length === 0 && deleted.length === 0) {
|
|
250520
|
-
|
|
250575
|
+
log.info("All agents are already up to date");
|
|
250521
250576
|
}
|
|
250522
250577
|
return {
|
|
250523
250578
|
outroMessage: `Pulled ${remoteAgents.total} agents to ${agentsDir}`
|
|
@@ -250528,9 +250583,11 @@ function getAgentsPullCommand() {
|
|
|
250528
250583
|
}
|
|
250529
250584
|
|
|
250530
250585
|
// src/cli/commands/agents/push.ts
|
|
250531
|
-
async function pushAgentsAction(
|
|
250586
|
+
async function pushAgentsAction({
|
|
250587
|
+
log
|
|
250588
|
+
}) {
|
|
250532
250589
|
const { agents } = await readProjectConfig();
|
|
250533
|
-
|
|
250590
|
+
log.info(agents.length === 0 ? "No local agents found - this will delete all remote agents" : `Found ${agents.length} agents to push`);
|
|
250534
250591
|
const result = await runTask("Pushing agents to Base44", async () => {
|
|
250535
250592
|
return await pushAgents(agents);
|
|
250536
250593
|
}, {
|
|
@@ -250538,13 +250595,13 @@ async function pushAgentsAction() {
|
|
|
250538
250595
|
errorMessage: "Failed to push agents"
|
|
250539
250596
|
});
|
|
250540
250597
|
if (result.created.length > 0) {
|
|
250541
|
-
|
|
250598
|
+
log.success(`Created: ${result.created.join(", ")}`);
|
|
250542
250599
|
}
|
|
250543
250600
|
if (result.updated.length > 0) {
|
|
250544
|
-
|
|
250601
|
+
log.success(`Updated: ${result.updated.join(", ")}`);
|
|
250545
250602
|
}
|
|
250546
250603
|
if (result.deleted.length > 0) {
|
|
250547
|
-
|
|
250604
|
+
log.warn(`Deleted: ${result.deleted.join(", ")}`);
|
|
250548
250605
|
}
|
|
250549
250606
|
return { outroMessage: "Agents pushed to Base44" };
|
|
250550
250607
|
}
|
|
@@ -250635,13 +250692,13 @@ function getAuthPullCommand() {
|
|
|
250635
250692
|
// src/cli/commands/auth/push.ts
|
|
250636
250693
|
async function pushAuthAction(options, command2) {
|
|
250637
250694
|
const { authConfig } = await readProjectConfig();
|
|
250638
|
-
if (
|
|
250695
|
+
if (authConfig.length === 0) {
|
|
250639
250696
|
R2.info("No local auth config found");
|
|
250640
250697
|
return {
|
|
250641
250698
|
outroMessage: "No auth config to push. Run `base44 auth pull` to fetch the remote config first."
|
|
250642
250699
|
};
|
|
250643
250700
|
}
|
|
250644
|
-
if (!hasAnyLoginMethod(authConfig)) {
|
|
250701
|
+
if (!hasAnyLoginMethod(authConfig[0])) {
|
|
250645
250702
|
R2.warn("This config has no login methods enabled. Pushing it will lock out all users.");
|
|
250646
250703
|
}
|
|
250647
250704
|
if (!options.yes) {
|
|
@@ -250656,7 +250713,7 @@ async function pushAuthAction(options, command2) {
|
|
|
250656
250713
|
}
|
|
250657
250714
|
}
|
|
250658
250715
|
await runTask("Pushing auth config to Base44", async () => {
|
|
250659
|
-
return await pushAuthConfig(authConfig);
|
|
250716
|
+
return await pushAuthConfig(authConfig[0] ?? null);
|
|
250660
250717
|
}, {
|
|
250661
250718
|
successMessage: "Auth config pushed successfully",
|
|
250662
250719
|
errorMessage: "Failed to push auth config"
|
|
@@ -250685,7 +250742,7 @@ function getLoginCommand() {
|
|
|
250685
250742
|
}
|
|
250686
250743
|
|
|
250687
250744
|
// src/cli/commands/auth/logout.ts
|
|
250688
|
-
async function logout() {
|
|
250745
|
+
async function logout(_ctx) {
|
|
250689
250746
|
await deleteAuth();
|
|
250690
250747
|
return { outroMessage: "Logged out successfully" };
|
|
250691
250748
|
}
|
|
@@ -250697,7 +250754,7 @@ function getLogoutCommand() {
|
|
|
250697
250754
|
}
|
|
250698
250755
|
|
|
250699
250756
|
// src/cli/commands/auth/whoami.ts
|
|
250700
|
-
async function whoami() {
|
|
250757
|
+
async function whoami(_ctx) {
|
|
250701
250758
|
const auth2 = await readAuth();
|
|
250702
250759
|
return { outroMessage: `Logged in as: ${theme.styles.bold(auth2.email)}` };
|
|
250703
250760
|
}
|
|
@@ -250706,7 +250763,9 @@ function getWhoamiCommand() {
|
|
|
250706
250763
|
}
|
|
250707
250764
|
|
|
250708
250765
|
// src/cli/commands/connectors/list-available.ts
|
|
250709
|
-
async function listAvailableAction(
|
|
250766
|
+
async function listAvailableAction({
|
|
250767
|
+
log
|
|
250768
|
+
}) {
|
|
250710
250769
|
const { integrations } = await runTask("Fetching available integrations from Base44", async () => {
|
|
250711
250770
|
return await listAvailableIntegrations();
|
|
250712
250771
|
}, {
|
|
@@ -250719,7 +250778,7 @@ async function listAvailableAction() {
|
|
|
250719
250778
|
for (const { displayName, ...rest } of integrations) {
|
|
250720
250779
|
const yaml2 = formatYaml(rest);
|
|
250721
250780
|
const pad = " ".repeat(YAML_INDENT);
|
|
250722
|
-
|
|
250781
|
+
log.info(`${displayName}
|
|
250723
250782
|
${pad}${yaml2.replace(/\n/g, `
|
|
250724
250783
|
${pad}`)}`);
|
|
250725
250784
|
}
|
|
@@ -250733,7 +250792,9 @@ function getConnectorsListAvailableCommand() {
|
|
|
250733
250792
|
|
|
250734
250793
|
// src/cli/commands/connectors/pull.ts
|
|
250735
250794
|
import { dirname as dirname10, join as join15 } from "node:path";
|
|
250736
|
-
async function pullConnectorsAction(
|
|
250795
|
+
async function pullConnectorsAction({
|
|
250796
|
+
log
|
|
250797
|
+
}) {
|
|
250737
250798
|
const { project: project2 } = await readProjectConfig();
|
|
250738
250799
|
const configDir = dirname10(project2.configPath);
|
|
250739
250800
|
const connectorsDir = join15(configDir, project2.connectorsDir);
|
|
@@ -250750,13 +250811,13 @@ async function pullConnectorsAction() {
|
|
|
250750
250811
|
errorMessage: "Failed to sync connector files"
|
|
250751
250812
|
});
|
|
250752
250813
|
if (written.length > 0) {
|
|
250753
|
-
|
|
250814
|
+
log.success(`Written: ${written.join(", ")}`);
|
|
250754
250815
|
}
|
|
250755
250816
|
if (deleted.length > 0) {
|
|
250756
|
-
|
|
250817
|
+
log.warn(`Deleted: ${deleted.join(", ")}`);
|
|
250757
250818
|
}
|
|
250758
250819
|
if (written.length === 0 && deleted.length === 0) {
|
|
250759
|
-
|
|
250820
|
+
log.info("All connectors are already up to date");
|
|
250760
250821
|
}
|
|
250761
250822
|
return {
|
|
250762
250823
|
outroMessage: `Pulled ${remoteConnectors.length} connectors to ${connectorsDir}`
|
|
@@ -251425,14 +251486,14 @@ async function runOAuthFlowWithSkip(connector2) {
|
|
|
251425
251486
|
}
|
|
251426
251487
|
return finalStatus;
|
|
251427
251488
|
}
|
|
251428
|
-
async function promptOAuthFlows(pending, options) {
|
|
251489
|
+
async function promptOAuthFlows(pending, log, options) {
|
|
251429
251490
|
const outcomes = new Map;
|
|
251430
251491
|
if (pending.length === 0) {
|
|
251431
251492
|
return outcomes;
|
|
251432
251493
|
}
|
|
251433
|
-
|
|
251494
|
+
log.warn(`${pending.length} connector(s) require authorization in your browser:`);
|
|
251434
251495
|
for (const connector2 of pending) {
|
|
251435
|
-
|
|
251496
|
+
log.info(` ${connector2.type}: ${theme.styles.dim(connector2.redirectUrl)}`);
|
|
251436
251497
|
}
|
|
251437
251498
|
if (options?.skipPrompt) {
|
|
251438
251499
|
return outcomes;
|
|
@@ -251445,11 +251506,11 @@ async function promptOAuthFlows(pending, options) {
|
|
|
251445
251506
|
}
|
|
251446
251507
|
for (const connector2 of pending) {
|
|
251447
251508
|
try {
|
|
251448
|
-
|
|
251509
|
+
log.info(`Opening browser for ${connector2.type}...`);
|
|
251449
251510
|
const status = await runOAuthFlowWithSkip(connector2);
|
|
251450
251511
|
outcomes.set(connector2.type, status);
|
|
251451
251512
|
} catch (err) {
|
|
251452
|
-
|
|
251513
|
+
log.error(`Failed to authorize ${connector2.type}: ${err instanceof Error ? err.message : String(err)}`);
|
|
251453
251514
|
outcomes.set(connector2.type, "FAILED");
|
|
251454
251515
|
}
|
|
251455
251516
|
}
|
|
@@ -251457,7 +251518,7 @@ async function promptOAuthFlows(pending, options) {
|
|
|
251457
251518
|
}
|
|
251458
251519
|
|
|
251459
251520
|
// src/cli/commands/connectors/push.ts
|
|
251460
|
-
function printSummary(results, oauthOutcomes) {
|
|
251521
|
+
function printSummary(results, oauthOutcomes, log) {
|
|
251461
251522
|
const synced = [];
|
|
251462
251523
|
const added = [];
|
|
251463
251524
|
let provisioned;
|
|
@@ -251495,57 +251556,58 @@ function printSummary(results, oauthOutcomes) {
|
|
|
251495
251556
|
}
|
|
251496
251557
|
}
|
|
251497
251558
|
}
|
|
251498
|
-
|
|
251559
|
+
log.info(theme.styles.bold("Summary:"));
|
|
251499
251560
|
if (provisioned) {
|
|
251500
|
-
|
|
251561
|
+
log.success("Stripe sandbox provisioned");
|
|
251501
251562
|
if (provisioned.claimUrl) {
|
|
251502
|
-
|
|
251563
|
+
log.info(` Claim your Stripe sandbox: ${theme.colors.links(provisioned.claimUrl)}`);
|
|
251503
251564
|
}
|
|
251504
|
-
|
|
251565
|
+
log.info(` Connectors dashboard: ${theme.colors.links(getConnectorsUrl())}`);
|
|
251505
251566
|
}
|
|
251506
251567
|
if (synced.length > 0) {
|
|
251507
|
-
|
|
251568
|
+
log.success(`Synced: ${synced.join(", ")}`);
|
|
251508
251569
|
}
|
|
251509
251570
|
if (added.length > 0) {
|
|
251510
|
-
|
|
251571
|
+
log.success(`Added: ${added.join(", ")}`);
|
|
251511
251572
|
}
|
|
251512
251573
|
if (removed.length > 0) {
|
|
251513
|
-
|
|
251574
|
+
log.info(theme.styles.dim(`Removed: ${removed.join(", ")}`));
|
|
251514
251575
|
}
|
|
251515
251576
|
if (skipped.length > 0) {
|
|
251516
|
-
|
|
251577
|
+
log.warn(`Skipped: ${skipped.join(", ")}`);
|
|
251517
251578
|
}
|
|
251518
251579
|
for (const r of failed) {
|
|
251519
|
-
|
|
251580
|
+
log.error(`Failed: ${r.type} - ${r.error}`);
|
|
251520
251581
|
}
|
|
251521
251582
|
}
|
|
251522
|
-
async function pushConnectorsAction(
|
|
251583
|
+
async function pushConnectorsAction({
|
|
251584
|
+
isNonInteractive,
|
|
251585
|
+
log
|
|
251586
|
+
}) {
|
|
251523
251587
|
const { connectors } = await readProjectConfig();
|
|
251524
251588
|
if (connectors.length === 0) {
|
|
251525
|
-
|
|
251589
|
+
log.info("No local connectors found - checking for remote connectors to remove");
|
|
251526
251590
|
} else {
|
|
251527
251591
|
const connectorNames = connectors.map((c3) => c3.type).join(", ");
|
|
251528
|
-
|
|
251592
|
+
log.info(`Found ${connectors.length} connectors to push: ${connectorNames}`);
|
|
251529
251593
|
}
|
|
251530
251594
|
const { results } = await runTask("Pushing connectors to Base44", async () => {
|
|
251531
251595
|
return await pushConnectors(connectors);
|
|
251532
251596
|
});
|
|
251533
251597
|
const needsOAuth = filterPendingOAuth(results);
|
|
251534
251598
|
let outroMessage = "Connectors pushed to Base44";
|
|
251535
|
-
const oauthOutcomes = await promptOAuthFlows(needsOAuth, {
|
|
251599
|
+
const oauthOutcomes = await promptOAuthFlows(needsOAuth, log, {
|
|
251536
251600
|
skipPrompt: isNonInteractive
|
|
251537
251601
|
});
|
|
251538
251602
|
const allAuthorized = oauthOutcomes.size > 0 && [...oauthOutcomes.values()].every((s) => s === "ACTIVE");
|
|
251539
251603
|
if (needsOAuth.length > 0 && !allAuthorized) {
|
|
251540
251604
|
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.";
|
|
251541
251605
|
}
|
|
251542
|
-
printSummary(results, oauthOutcomes);
|
|
251606
|
+
printSummary(results, oauthOutcomes, log);
|
|
251543
251607
|
return { outroMessage };
|
|
251544
251608
|
}
|
|
251545
251609
|
function getConnectorsPushCommand() {
|
|
251546
|
-
return new Base44Command("push").description("Push local connectors to Base44 (overwrites connectors on Base44)").action(
|
|
251547
|
-
return await pushConnectorsAction(command2.isNonInteractive);
|
|
251548
|
-
});
|
|
251610
|
+
return new Base44Command("push").description("Push local connectors to Base44 (overwrites connectors on Base44)").action(pushConnectorsAction);
|
|
251549
251611
|
}
|
|
251550
251612
|
|
|
251551
251613
|
// src/cli/commands/connectors/index.ts
|
|
@@ -251554,7 +251616,9 @@ function getConnectorsCommand() {
|
|
|
251554
251616
|
}
|
|
251555
251617
|
|
|
251556
251618
|
// src/cli/commands/dashboard/open.ts
|
|
251557
|
-
async function openDashboard(
|
|
251619
|
+
async function openDashboard({
|
|
251620
|
+
isNonInteractive
|
|
251621
|
+
}) {
|
|
251558
251622
|
const dashboardUrl = getDashboardUrl();
|
|
251559
251623
|
if (!isNonInteractive) {
|
|
251560
251624
|
await open_default(dashboardUrl);
|
|
@@ -251562,9 +251626,7 @@ async function openDashboard(isNonInteractive) {
|
|
|
251562
251626
|
return { outroMessage: `Dashboard opened at ${dashboardUrl}` };
|
|
251563
251627
|
}
|
|
251564
251628
|
function getDashboardOpenCommand() {
|
|
251565
|
-
return new Base44Command("open").description("Open the app dashboard in your browser").action(
|
|
251566
|
-
return await openDashboard(command2.isNonInteractive);
|
|
251567
|
-
});
|
|
251629
|
+
return new Base44Command("open").description("Open the app dashboard in your browser").action(openDashboard);
|
|
251568
251630
|
}
|
|
251569
251631
|
|
|
251570
251632
|
// src/cli/commands/dashboard/index.ts
|
|
@@ -251573,13 +251635,15 @@ function getDashboardCommand() {
|
|
|
251573
251635
|
}
|
|
251574
251636
|
|
|
251575
251637
|
// src/cli/commands/entities/push.ts
|
|
251576
|
-
async function pushEntitiesAction(
|
|
251638
|
+
async function pushEntitiesAction({
|
|
251639
|
+
log
|
|
251640
|
+
}) {
|
|
251577
251641
|
const { entities } = await readProjectConfig();
|
|
251578
251642
|
if (entities.length === 0) {
|
|
251579
251643
|
return { outroMessage: "No entities found in project" };
|
|
251580
251644
|
}
|
|
251581
251645
|
const entityNames = entities.map((e2) => e2.name).join(", ");
|
|
251582
|
-
|
|
251646
|
+
log.info(`Found ${entities.length} entities to push: ${entityNames}`);
|
|
251583
251647
|
const result = await runTask("Pushing entities to Base44", async () => {
|
|
251584
251648
|
return await pushEntities(entities);
|
|
251585
251649
|
}, {
|
|
@@ -251587,13 +251651,13 @@ async function pushEntitiesAction() {
|
|
|
251587
251651
|
errorMessage: "Failed to push entities"
|
|
251588
251652
|
});
|
|
251589
251653
|
if (result.created.length > 0) {
|
|
251590
|
-
|
|
251654
|
+
log.success(`Created: ${result.created.join(", ")}`);
|
|
251591
251655
|
}
|
|
251592
251656
|
if (result.updated.length > 0) {
|
|
251593
|
-
|
|
251657
|
+
log.success(`Updated: ${result.updated.join(", ")}`);
|
|
251594
251658
|
}
|
|
251595
251659
|
if (result.deleted.length > 0) {
|
|
251596
|
-
|
|
251660
|
+
log.warn(`Deleted: ${result.deleted.join(", ")}`);
|
|
251597
251661
|
}
|
|
251598
251662
|
return { outroMessage: "Entities pushed to Base44" };
|
|
251599
251663
|
}
|
|
@@ -251602,7 +251666,7 @@ function getEntitiesPushCommand() {
|
|
|
251602
251666
|
}
|
|
251603
251667
|
|
|
251604
251668
|
// src/cli/commands/functions/delete.ts
|
|
251605
|
-
async function deleteFunctionsAction(names) {
|
|
251669
|
+
async function deleteFunctionsAction(_ctx, names) {
|
|
251606
251670
|
let deleted = 0;
|
|
251607
251671
|
let notFound = 0;
|
|
251608
251672
|
let errors5 = 0;
|
|
@@ -251648,9 +251712,9 @@ function validateNames(command2) {
|
|
|
251648
251712
|
}
|
|
251649
251713
|
}
|
|
251650
251714
|
function getDeleteCommand() {
|
|
251651
|
-
return new Base44Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").hook("preAction", validateNames).action(async (rawNames) => {
|
|
251715
|
+
return new Base44Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").hook("preAction", validateNames).action(async (ctx, rawNames) => {
|
|
251652
251716
|
const names = parseNames(rawNames);
|
|
251653
|
-
return deleteFunctionsAction(names);
|
|
251717
|
+
return deleteFunctionsAction(ctx, names);
|
|
251654
251718
|
});
|
|
251655
251719
|
}
|
|
251656
251720
|
|
|
@@ -251658,15 +251722,15 @@ function getDeleteCommand() {
|
|
|
251658
251722
|
function formatDuration(ms) {
|
|
251659
251723
|
return `${(ms / 1000).toFixed(1)}s`;
|
|
251660
251724
|
}
|
|
251661
|
-
function formatDeployResult(result) {
|
|
251725
|
+
function formatDeployResult(result, log) {
|
|
251662
251726
|
const label = result.name.padEnd(25);
|
|
251663
251727
|
if (result.status === "deployed") {
|
|
251664
251728
|
const timing = result.durationMs ? theme.styles.dim(` (${formatDuration(result.durationMs)})`) : "";
|
|
251665
|
-
|
|
251729
|
+
log.success(`${label} deployed${timing}`);
|
|
251666
251730
|
} else if (result.status === "unchanged") {
|
|
251667
|
-
|
|
251731
|
+
log.success(`${label} unchanged`);
|
|
251668
251732
|
} else {
|
|
251669
|
-
|
|
251733
|
+
log.error(`${label} error: ${result.error}`);
|
|
251670
251734
|
}
|
|
251671
251735
|
}
|
|
251672
251736
|
|
|
@@ -251685,17 +251749,17 @@ function resolveFunctionsToDeploy(names, allFunctions) {
|
|
|
251685
251749
|
}
|
|
251686
251750
|
return allFunctions.filter((f) => names.includes(f.name));
|
|
251687
251751
|
}
|
|
251688
|
-
function formatPruneResult(pruneResult) {
|
|
251752
|
+
function formatPruneResult(pruneResult, log) {
|
|
251689
251753
|
if (pruneResult.deleted) {
|
|
251690
|
-
|
|
251754
|
+
log.success(`${pruneResult.name.padEnd(25)} deleted`);
|
|
251691
251755
|
} else {
|
|
251692
|
-
|
|
251756
|
+
log.error(`${pruneResult.name.padEnd(25)} error: ${pruneResult.error}`);
|
|
251693
251757
|
}
|
|
251694
251758
|
}
|
|
251695
|
-
function formatPruneSummary(pruneResults) {
|
|
251759
|
+
function formatPruneSummary(pruneResults, log) {
|
|
251696
251760
|
if (pruneResults.length > 0) {
|
|
251697
251761
|
const pruned = pruneResults.filter((r) => r.deleted).length;
|
|
251698
|
-
|
|
251762
|
+
log.info(`${pruned} deleted`);
|
|
251699
251763
|
}
|
|
251700
251764
|
}
|
|
251701
251765
|
function buildDeploySummary(results) {
|
|
@@ -251711,7 +251775,7 @@ function buildDeploySummary(results) {
|
|
|
251711
251775
|
parts.push(`${failed} error${failed !== 1 ? "s" : ""}`);
|
|
251712
251776
|
return parts.join(", ") || "No functions deployed";
|
|
251713
251777
|
}
|
|
251714
|
-
async function deployFunctionsAction(names, options) {
|
|
251778
|
+
async function deployFunctionsAction({ log }, names, options) {
|
|
251715
251779
|
if (options.force && names.length > 0) {
|
|
251716
251780
|
throw new InvalidInputError("--force cannot be used when specifying function names");
|
|
251717
251781
|
}
|
|
@@ -251722,17 +251786,17 @@ async function deployFunctionsAction(names, options) {
|
|
|
251722
251786
|
outroMessage: "No functions found. Create functions in the 'functions' directory."
|
|
251723
251787
|
};
|
|
251724
251788
|
}
|
|
251725
|
-
|
|
251789
|
+
log.info(`Found ${toDeploy.length} ${toDeploy.length === 1 ? "function" : "functions"} to deploy`);
|
|
251726
251790
|
let completed = 0;
|
|
251727
251791
|
const total = toDeploy.length;
|
|
251728
251792
|
const results = await deployFunctionsSequentially(toDeploy, {
|
|
251729
251793
|
onStart: (startNames) => {
|
|
251730
251794
|
const label = startNames.length === 1 ? startNames[0] : `${startNames.length} functions`;
|
|
251731
|
-
|
|
251795
|
+
log.step(theme.styles.dim(`[${completed + 1}/${total}] Deploying ${label}...`));
|
|
251732
251796
|
},
|
|
251733
251797
|
onResult: (result) => {
|
|
251734
251798
|
completed++;
|
|
251735
|
-
formatDeployResult(result);
|
|
251799
|
+
formatDeployResult(result, log);
|
|
251736
251800
|
}
|
|
251737
251801
|
});
|
|
251738
251802
|
if (options.force) {
|
|
@@ -251743,28 +251807,30 @@ async function deployFunctionsAction(names, options) {
|
|
|
251743
251807
|
onStart: (total2) => {
|
|
251744
251808
|
pruneTotal = total2;
|
|
251745
251809
|
if (total2 > 0) {
|
|
251746
|
-
|
|
251810
|
+
log.info(`Found ${total2} remote ${total2 === 1 ? "function" : "functions"} to delete`);
|
|
251747
251811
|
}
|
|
251748
251812
|
},
|
|
251749
251813
|
onBeforeDelete: (name2) => {
|
|
251750
251814
|
pruneCompleted++;
|
|
251751
|
-
|
|
251815
|
+
log.step(theme.styles.dim(`[${pruneCompleted}/${pruneTotal}] Deleting ${name2}...`));
|
|
251752
251816
|
},
|
|
251753
|
-
onResult: formatPruneResult
|
|
251817
|
+
onResult: (r) => formatPruneResult(r, log)
|
|
251754
251818
|
});
|
|
251755
|
-
formatPruneSummary(pruneResults);
|
|
251819
|
+
formatPruneSummary(pruneResults, log);
|
|
251756
251820
|
}
|
|
251757
251821
|
return { outroMessage: buildDeploySummary(results) };
|
|
251758
251822
|
}
|
|
251759
251823
|
function getDeployCommand() {
|
|
251760
|
-
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) => {
|
|
251824
|
+
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) => {
|
|
251761
251825
|
const names = parseNames2(rawNames);
|
|
251762
|
-
return deployFunctionsAction(names, options);
|
|
251826
|
+
return deployFunctionsAction(ctx, names, options);
|
|
251763
251827
|
});
|
|
251764
251828
|
}
|
|
251765
251829
|
|
|
251766
251830
|
// src/cli/commands/functions/list.ts
|
|
251767
|
-
async function listFunctionsAction(
|
|
251831
|
+
async function listFunctionsAction({
|
|
251832
|
+
log
|
|
251833
|
+
}) {
|
|
251768
251834
|
const { functions } = await runTask("Fetching functions...", async () => listDeployedFunctions(), { errorMessage: "Failed to fetch functions" });
|
|
251769
251835
|
if (functions.length === 0) {
|
|
251770
251836
|
return { outroMessage: "No functions on remote" };
|
|
@@ -251772,7 +251838,7 @@ async function listFunctionsAction() {
|
|
|
251772
251838
|
for (const fn of functions) {
|
|
251773
251839
|
const automationCount = fn.automations.length;
|
|
251774
251840
|
const automationLabel = automationCount > 0 ? theme.styles.dim(` (${automationCount} automation${automationCount > 1 ? "s" : ""})`) : "";
|
|
251775
|
-
|
|
251841
|
+
log.message(` ${fn.name}${automationLabel}`);
|
|
251776
251842
|
}
|
|
251777
251843
|
return {
|
|
251778
251844
|
outroMessage: `${functions.length} function${functions.length !== 1 ? "s" : ""} on remote`
|
|
@@ -251784,7 +251850,7 @@ function getListCommand() {
|
|
|
251784
251850
|
|
|
251785
251851
|
// src/cli/commands/functions/pull.ts
|
|
251786
251852
|
import { dirname as dirname11, join as join16 } from "node:path";
|
|
251787
|
-
async function pullFunctionsAction(name2) {
|
|
251853
|
+
async function pullFunctionsAction({ log }, name2) {
|
|
251788
251854
|
const { project: project2 } = await readProjectConfig();
|
|
251789
251855
|
const configDir = dirname11(project2.configPath);
|
|
251790
251856
|
const functionsDir = join16(configDir, project2.functionsDir);
|
|
@@ -251811,10 +251877,10 @@ async function pullFunctionsAction(name2) {
|
|
|
251811
251877
|
errorMessage: "Failed to write function files"
|
|
251812
251878
|
});
|
|
251813
251879
|
for (const name3 of written) {
|
|
251814
|
-
|
|
251880
|
+
log.success(`${name3.padEnd(25)} written`);
|
|
251815
251881
|
}
|
|
251816
251882
|
for (const name3 of skipped) {
|
|
251817
|
-
|
|
251883
|
+
log.info(`${name3.padEnd(25)} unchanged`);
|
|
251818
251884
|
}
|
|
251819
251885
|
return {
|
|
251820
251886
|
outroMessage: `Pulled ${toPull.length} function${toPull.length !== 1 ? "s" : ""} to ${functionsDir}`
|
|
@@ -251850,7 +251916,7 @@ function validateNonInteractiveFlags(command2) {
|
|
|
251850
251916
|
command2.error("--path requires a project name argument. Usage: base44 create <name> --path <path>");
|
|
251851
251917
|
}
|
|
251852
251918
|
}
|
|
251853
|
-
async function createInteractive(options) {
|
|
251919
|
+
async function createInteractive(options, log) {
|
|
251854
251920
|
const templates = await listTemplates();
|
|
251855
251921
|
const templateOptions = templates.map((t) => ({
|
|
251856
251922
|
value: t,
|
|
@@ -251892,10 +251958,10 @@ async function createInteractive(options) {
|
|
|
251892
251958
|
deploy: options.deploy,
|
|
251893
251959
|
skills: options.skills,
|
|
251894
251960
|
isInteractive: true
|
|
251895
|
-
});
|
|
251961
|
+
}, log);
|
|
251896
251962
|
}
|
|
251897
|
-
async function createNonInteractive(options) {
|
|
251898
|
-
|
|
251963
|
+
async function createNonInteractive(options, log) {
|
|
251964
|
+
log.info(`Creating a new project at ${resolve2(options.path)}`);
|
|
251899
251965
|
const template2 = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
|
|
251900
251966
|
return await executeCreate({
|
|
251901
251967
|
template: template2,
|
|
@@ -251904,7 +251970,7 @@ async function createNonInteractive(options) {
|
|
|
251904
251970
|
deploy: options.deploy,
|
|
251905
251971
|
skills: options.skills,
|
|
251906
251972
|
isInteractive: false
|
|
251907
|
-
});
|
|
251973
|
+
}, log);
|
|
251908
251974
|
}
|
|
251909
251975
|
async function executeCreate({
|
|
251910
251976
|
template: template2,
|
|
@@ -251914,7 +251980,7 @@ async function executeCreate({
|
|
|
251914
251980
|
deploy: deploy5,
|
|
251915
251981
|
skills,
|
|
251916
251982
|
isInteractive
|
|
251917
|
-
}) {
|
|
251983
|
+
}, log) {
|
|
251918
251984
|
const name2 = rawName.trim();
|
|
251919
251985
|
const resolvedPath = resolve2(projectPath);
|
|
251920
251986
|
const { projectId } = await runTask("Setting up your project...", async () => {
|
|
@@ -251989,13 +252055,32 @@ async function executeCreate({
|
|
|
251989
252055
|
});
|
|
251990
252056
|
} catch {}
|
|
251991
252057
|
}
|
|
251992
|
-
|
|
251993
|
-
|
|
252058
|
+
log.message(`${theme.styles.header("Project")}: ${theme.colors.base44Orange(name2)}`);
|
|
252059
|
+
log.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(projectId))}`);
|
|
251994
252060
|
if (finalAppUrl) {
|
|
251995
|
-
|
|
252061
|
+
log.message(`${theme.styles.header("Site")}: ${theme.colors.links(finalAppUrl)}`);
|
|
251996
252062
|
}
|
|
251997
252063
|
return { outroMessage: "Your project is set up and ready to use" };
|
|
251998
252064
|
}
|
|
252065
|
+
async function createAction({ log, isNonInteractive }, name2, options) {
|
|
252066
|
+
if (name2 && !options.path) {
|
|
252067
|
+
options.path = `./${import_kebabCase.default(name2)}`;
|
|
252068
|
+
}
|
|
252069
|
+
const skipPrompts = !!(options.name ?? name2) && !!options.path;
|
|
252070
|
+
if (!skipPrompts && isNonInteractive) {
|
|
252071
|
+
throw new InvalidInputError("Project name and --path are required in non-interactive mode", {
|
|
252072
|
+
hints: [
|
|
252073
|
+
{
|
|
252074
|
+
message: "Usage: base44 create <name> --path <path>"
|
|
252075
|
+
}
|
|
252076
|
+
]
|
|
252077
|
+
});
|
|
252078
|
+
}
|
|
252079
|
+
if (skipPrompts) {
|
|
252080
|
+
return await createNonInteractive({ name: options.name ?? name2, ...options }, log);
|
|
252081
|
+
}
|
|
252082
|
+
return await createInteractive({ name: name2, ...options }, log);
|
|
252083
|
+
}
|
|
251999
252084
|
function getCreateCommand() {
|
|
252000
252085
|
return new Base44Command("create", {
|
|
252001
252086
|
requireAppConfig: false,
|
|
@@ -252004,32 +252089,14 @@ function getCreateCommand() {
|
|
|
252004
252089
|
Examples:
|
|
252005
252090
|
$ base44 create my-app Creates a base44 project at ./my-app
|
|
252006
252091
|
$ base44 create my-todo-app --template backend-and-client Creates a base44 backend-and-client project at ./my-todo-app
|
|
252007
|
-
$ base44 create my-app --path ./projects/my-app --deploy Creates a base44 project at ./project/my-app and deploys it`).hook("preAction", validateNonInteractiveFlags).action(
|
|
252008
|
-
if (name2 && !options.path) {
|
|
252009
|
-
options.path = `./${import_kebabCase.default(name2)}`;
|
|
252010
|
-
}
|
|
252011
|
-
const skipPrompts = !!(options.name ?? name2) && !!options.path;
|
|
252012
|
-
if (!skipPrompts && command2.isNonInteractive) {
|
|
252013
|
-
throw new InvalidInputError("Project name and --path are required in non-interactive mode", {
|
|
252014
|
-
hints: [
|
|
252015
|
-
{
|
|
252016
|
-
message: "Usage: base44 create <name> --path <path>"
|
|
252017
|
-
}
|
|
252018
|
-
]
|
|
252019
|
-
});
|
|
252020
|
-
}
|
|
252021
|
-
if (skipPrompts) {
|
|
252022
|
-
return await createNonInteractive({
|
|
252023
|
-
name: options.name ?? name2,
|
|
252024
|
-
...options
|
|
252025
|
-
});
|
|
252026
|
-
}
|
|
252027
|
-
return await createInteractive({ name: name2, ...options });
|
|
252028
|
-
});
|
|
252092
|
+
$ 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);
|
|
252029
252093
|
}
|
|
252030
252094
|
|
|
252031
252095
|
// src/cli/commands/project/deploy.ts
|
|
252032
|
-
async function deployAction(options) {
|
|
252096
|
+
async function deployAction({ isNonInteractive, log }, options = {}) {
|
|
252097
|
+
if (isNonInteractive && !options.yes) {
|
|
252098
|
+
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
252099
|
+
}
|
|
252033
252100
|
const projectData = await readProjectConfig(options.projectRoot);
|
|
252034
252101
|
if (!hasResourcesToDeploy(projectData)) {
|
|
252035
252102
|
return {
|
|
@@ -252050,14 +252117,14 @@ async function deployAction(options) {
|
|
|
252050
252117
|
if (connectors.length > 0) {
|
|
252051
252118
|
summaryLines.push(` - ${connectors.length} ${connectors.length === 1 ? "connector" : "connectors"}`);
|
|
252052
252119
|
}
|
|
252053
|
-
if (authConfig) {
|
|
252120
|
+
if (authConfig.length > 0) {
|
|
252054
252121
|
summaryLines.push(" - Auth config");
|
|
252055
252122
|
}
|
|
252056
252123
|
if (project2.site?.outputDirectory) {
|
|
252057
252124
|
summaryLines.push(` - Site from ${project2.site.outputDirectory}`);
|
|
252058
252125
|
}
|
|
252059
252126
|
if (!options.yes) {
|
|
252060
|
-
|
|
252127
|
+
log.warn(`This will update your Base44 app with:
|
|
252061
252128
|
${summaryLines.join(`
|
|
252062
252129
|
`)}`);
|
|
252063
252130
|
const shouldDeploy = await Re({
|
|
@@ -252067,7 +252134,7 @@ ${summaryLines.join(`
|
|
|
252067
252134
|
return { outroMessage: "Deployment cancelled" };
|
|
252068
252135
|
}
|
|
252069
252136
|
} else {
|
|
252070
|
-
|
|
252137
|
+
log.info(`Deploying:
|
|
252071
252138
|
${summaryLines.join(`
|
|
252072
252139
|
`)}`);
|
|
252073
252140
|
}
|
|
@@ -252076,54 +252143,46 @@ ${summaryLines.join(`
|
|
|
252076
252143
|
const result = await deployAll(projectData, {
|
|
252077
252144
|
onFunctionStart: (names) => {
|
|
252078
252145
|
const label = names.length === 1 ? names[0] : `${names.length} functions`;
|
|
252079
|
-
|
|
252146
|
+
log.step(theme.styles.dim(`[${functionCompleted + 1}/${functionTotal}] Deploying ${label}...`));
|
|
252080
252147
|
},
|
|
252081
252148
|
onFunctionResult: (r) => {
|
|
252082
252149
|
functionCompleted++;
|
|
252083
|
-
formatDeployResult(r);
|
|
252150
|
+
formatDeployResult(r, log);
|
|
252084
252151
|
}
|
|
252085
252152
|
});
|
|
252086
252153
|
const connectorResults = result.connectorResults ?? [];
|
|
252087
|
-
await handleOAuthConnectors(connectorResults, options);
|
|
252154
|
+
await handleOAuthConnectors(connectorResults, isNonInteractive, options, log);
|
|
252088
252155
|
const stripeResult = connectorResults.find((r) => r.type === "stripe");
|
|
252089
252156
|
if (stripeResult?.action === "provisioned") {
|
|
252090
|
-
printStripeResult(stripeResult);
|
|
252157
|
+
printStripeResult(stripeResult, log);
|
|
252091
252158
|
}
|
|
252092
|
-
|
|
252159
|
+
log.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl())}`);
|
|
252093
252160
|
if (result.appUrl) {
|
|
252094
|
-
|
|
252161
|
+
log.message(`${theme.styles.header("App URL")}: ${theme.colors.links(result.appUrl)}`);
|
|
252095
252162
|
}
|
|
252096
252163
|
return { outroMessage: "App deployed successfully" };
|
|
252097
252164
|
}
|
|
252098
252165
|
function getDeployCommand2() {
|
|
252099
|
-
return new Base44Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").action(
|
|
252100
|
-
if (command2.isNonInteractive && !options.yes) {
|
|
252101
|
-
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
252102
|
-
}
|
|
252103
|
-
return await deployAction({
|
|
252104
|
-
...options,
|
|
252105
|
-
isNonInteractive: command2.isNonInteractive
|
|
252106
|
-
});
|
|
252107
|
-
});
|
|
252166
|
+
return new Base44Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").action(deployAction);
|
|
252108
252167
|
}
|
|
252109
|
-
async function handleOAuthConnectors(connectorResults, options) {
|
|
252168
|
+
async function handleOAuthConnectors(connectorResults, isNonInteractive, options, log) {
|
|
252110
252169
|
const needsOAuth = filterPendingOAuth(connectorResults);
|
|
252111
252170
|
if (needsOAuth.length === 0)
|
|
252112
252171
|
return;
|
|
252113
|
-
const oauthOutcomes = await promptOAuthFlows(needsOAuth, {
|
|
252114
|
-
skipPrompt: options.yes ||
|
|
252172
|
+
const oauthOutcomes = await promptOAuthFlows(needsOAuth, log, {
|
|
252173
|
+
skipPrompt: options.yes || isNonInteractive
|
|
252115
252174
|
});
|
|
252116
252175
|
const allAuthorized = oauthOutcomes.size > 0 && [...oauthOutcomes.values()].every((s) => s === "ACTIVE");
|
|
252117
252176
|
if (!allAuthorized) {
|
|
252118
|
-
|
|
252177
|
+
log.info("Some connectors still require authorization. Run 'base44 connectors push' or open the links above in your browser.");
|
|
252119
252178
|
}
|
|
252120
252179
|
}
|
|
252121
|
-
function printStripeResult(r) {
|
|
252122
|
-
|
|
252180
|
+
function printStripeResult(r, log) {
|
|
252181
|
+
log.success("Stripe sandbox provisioned");
|
|
252123
252182
|
if (r.claimUrl) {
|
|
252124
|
-
|
|
252183
|
+
log.info(` Claim your Stripe sandbox: ${theme.colors.links(r.claimUrl)}`);
|
|
252125
252184
|
}
|
|
252126
|
-
|
|
252185
|
+
log.info(` Connectors dashboard: ${theme.colors.links(getConnectorsUrl())}`);
|
|
252127
252186
|
}
|
|
252128
252187
|
|
|
252129
252188
|
// src/cli/commands/project/link.ts
|
|
@@ -252199,7 +252258,12 @@ async function promptForExistingProject(linkableProjects) {
|
|
|
252199
252258
|
}
|
|
252200
252259
|
return selectedProject;
|
|
252201
252260
|
}
|
|
252202
|
-
async function link(options) {
|
|
252261
|
+
async function link(ctx, options) {
|
|
252262
|
+
const { log, isNonInteractive } = ctx;
|
|
252263
|
+
const skipPrompts = !!options.create || !!options.projectId;
|
|
252264
|
+
if (!skipPrompts && isNonInteractive) {
|
|
252265
|
+
throw new InvalidInputError("--create with --name, or --projectId, is required in non-interactive mode");
|
|
252266
|
+
}
|
|
252203
252267
|
const projectRoot = await findProjectRoot();
|
|
252204
252268
|
if (!projectRoot) {
|
|
252205
252269
|
throw new ConfigNotFoundError("No Base44 project found. Run this command from a project directory with a config.jsonc file.");
|
|
@@ -252263,17 +252327,11 @@ async function link(options) {
|
|
|
252263
252327
|
setAppConfig({ id: projectId, projectRoot: projectRoot.root });
|
|
252264
252328
|
finalProjectId = projectId;
|
|
252265
252329
|
}
|
|
252266
|
-
|
|
252330
|
+
log.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(finalProjectId))}`);
|
|
252267
252331
|
return { outroMessage: "Project linked" };
|
|
252268
252332
|
}
|
|
252269
252333
|
function getLinkCommand() {
|
|
252270
|
-
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(
|
|
252271
|
-
const skipPrompts = !!options.create || !!options.projectId;
|
|
252272
|
-
if (!skipPrompts && command2.isNonInteractive) {
|
|
252273
|
-
throw new InvalidInputError("--create with --name, or --projectId, is required in non-interactive mode");
|
|
252274
|
-
}
|
|
252275
|
-
return await link(options);
|
|
252276
|
-
});
|
|
252334
|
+
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);
|
|
252277
252335
|
}
|
|
252278
252336
|
|
|
252279
252337
|
// src/cli/commands/project/logs.ts
|
|
@@ -252375,7 +252433,7 @@ function validateLimit(limit) {
|
|
|
252375
252433
|
throw new InvalidInputError(`Invalid limit: "${limit}". Must be a number between 1 and 1000.`);
|
|
252376
252434
|
}
|
|
252377
252435
|
}
|
|
252378
|
-
async function logsAction(options) {
|
|
252436
|
+
async function logsAction(_ctx, options) {
|
|
252379
252437
|
validateLimit(options.limit);
|
|
252380
252438
|
const specifiedFunctions = parseFunctionNames(options.function);
|
|
252381
252439
|
const allProjectFunctions = await getAllFunctionNames();
|
|
@@ -252397,7 +252455,7 @@ function getLogsCommand() {
|
|
|
252397
252455
|
}
|
|
252398
252456
|
|
|
252399
252457
|
// src/cli/commands/secrets/delete.ts
|
|
252400
|
-
async function deleteSecretAction(key) {
|
|
252458
|
+
async function deleteSecretAction(_ctx, key) {
|
|
252401
252459
|
await runTask(`Deleting secret "${key}"`, async () => {
|
|
252402
252460
|
return await deleteSecret(key);
|
|
252403
252461
|
}, {
|
|
@@ -252413,7 +252471,9 @@ function getSecretsDeleteCommand() {
|
|
|
252413
252471
|
}
|
|
252414
252472
|
|
|
252415
252473
|
// src/cli/commands/secrets/list.ts
|
|
252416
|
-
async function listSecretsAction(
|
|
252474
|
+
async function listSecretsAction({
|
|
252475
|
+
log
|
|
252476
|
+
}) {
|
|
252417
252477
|
const secrets = await runTask("Fetching secrets from Base44", async () => {
|
|
252418
252478
|
return await listSecrets();
|
|
252419
252479
|
}, {
|
|
@@ -252425,7 +252485,7 @@ async function listSecretsAction() {
|
|
|
252425
252485
|
return { outroMessage: "No secrets configured." };
|
|
252426
252486
|
}
|
|
252427
252487
|
for (const name2 of names) {
|
|
252428
|
-
|
|
252488
|
+
log.info(name2);
|
|
252429
252489
|
}
|
|
252430
252490
|
return {
|
|
252431
252491
|
outroMessage: `Found ${names.length} secrets.`
|
|
@@ -252463,7 +252523,7 @@ function validateInput(entries, options) {
|
|
|
252463
252523
|
throw new InvalidInputError("Provide KEY=VALUE pairs or --env-file, but not both.");
|
|
252464
252524
|
}
|
|
252465
252525
|
}
|
|
252466
|
-
async function setSecretsAction(entries, options) {
|
|
252526
|
+
async function setSecretsAction({ log }, entries, options) {
|
|
252467
252527
|
validateInput(entries, options);
|
|
252468
252528
|
let secrets;
|
|
252469
252529
|
if (options.envFile) {
|
|
@@ -252481,7 +252541,7 @@ async function setSecretsAction(entries, options) {
|
|
|
252481
252541
|
successMessage: `${names.length} secrets set successfully`,
|
|
252482
252542
|
errorMessage: "Failed to set secrets"
|
|
252483
252543
|
});
|
|
252484
|
-
|
|
252544
|
+
log.info(`Set: ${names.join(", ")}`);
|
|
252485
252545
|
return {
|
|
252486
252546
|
outroMessage: "Secrets set successfully."
|
|
252487
252547
|
};
|
|
@@ -252497,7 +252557,10 @@ function getSecretsCommand() {
|
|
|
252497
252557
|
|
|
252498
252558
|
// src/cli/commands/site/deploy.ts
|
|
252499
252559
|
import { resolve as resolve4 } from "node:path";
|
|
252500
|
-
async function deployAction2(options) {
|
|
252560
|
+
async function deployAction2({ isNonInteractive }, options) {
|
|
252561
|
+
if (isNonInteractive && !options.yes) {
|
|
252562
|
+
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
252563
|
+
}
|
|
252501
252564
|
const { project: project2 } = await readProjectConfig();
|
|
252502
252565
|
if (!project2.site?.outputDirectory) {
|
|
252503
252566
|
throw new ConfigNotFoundError("No site configuration found.", {
|
|
@@ -252526,19 +252589,13 @@ async function deployAction2(options) {
|
|
|
252526
252589
|
return { outroMessage: `Visit your site at: ${result.appUrl}` };
|
|
252527
252590
|
}
|
|
252528
252591
|
function getSiteDeployCommand() {
|
|
252529
|
-
return new Base44Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").action(
|
|
252530
|
-
if (command2.isNonInteractive && !options.yes) {
|
|
252531
|
-
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
252532
|
-
}
|
|
252533
|
-
return await deployAction2({
|
|
252534
|
-
...options,
|
|
252535
|
-
isNonInteractive: command2.isNonInteractive
|
|
252536
|
-
});
|
|
252537
|
-
});
|
|
252592
|
+
return new Base44Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").action(deployAction2);
|
|
252538
252593
|
}
|
|
252539
252594
|
|
|
252540
252595
|
// src/cli/commands/site/open.ts
|
|
252541
|
-
async function openAction(
|
|
252596
|
+
async function openAction({
|
|
252597
|
+
isNonInteractive
|
|
252598
|
+
}) {
|
|
252542
252599
|
const siteUrl = await getSiteUrl();
|
|
252543
252600
|
if (!isNonInteractive) {
|
|
252544
252601
|
await open_default(siteUrl);
|
|
@@ -252546,9 +252603,7 @@ async function openAction(isNonInteractive) {
|
|
|
252546
252603
|
return { outroMessage: `Site opened at ${siteUrl}` };
|
|
252547
252604
|
}
|
|
252548
252605
|
function getSiteOpenCommand() {
|
|
252549
|
-
return new Base44Command("open").description("Open the published site in your browser").action(
|
|
252550
|
-
return await openAction(command2.isNonInteractive);
|
|
252551
|
-
});
|
|
252606
|
+
return new Base44Command("open").description("Open the published site in your browser").action(openAction);
|
|
252552
252607
|
}
|
|
252553
252608
|
|
|
252554
252609
|
// src/cli/commands/site/index.ts
|
|
@@ -252666,7 +252721,7 @@ async function updateProjectConfig(projectRoot) {
|
|
|
252666
252721
|
}
|
|
252667
252722
|
// src/cli/commands/types/generate.ts
|
|
252668
252723
|
var TYPES_FILE_PATH = "base44/.types/types.d.ts";
|
|
252669
|
-
async function generateTypesAction() {
|
|
252724
|
+
async function generateTypesAction(_ctx) {
|
|
252670
252725
|
const { entities, functions, agents, connectors, project: project2 } = await readProjectConfig();
|
|
252671
252726
|
await runTask("Generating types", async () => {
|
|
252672
252727
|
await generateTypesFile({ entities, functions, agents, connectors });
|
|
@@ -252686,9 +252741,9 @@ function getTypesCommand() {
|
|
|
252686
252741
|
}
|
|
252687
252742
|
|
|
252688
252743
|
// src/cli/dev/dev-server/main.ts
|
|
252689
|
-
import { dirname as dirname16, join as join23 } from "node:path";
|
|
252690
252744
|
var import_cors = __toESM(require_lib4(), 1);
|
|
252691
252745
|
var import_express5 = __toESM(require_express(), 1);
|
|
252746
|
+
import { dirname as dirname16, join as join23 } from "node:path";
|
|
252692
252747
|
|
|
252693
252748
|
// ../../node_modules/get-port/index.js
|
|
252694
252749
|
import net from "node:net";
|
|
@@ -252854,9 +252909,9 @@ class FunctionManager {
|
|
|
252854
252909
|
starting = new Map;
|
|
252855
252910
|
logger;
|
|
252856
252911
|
wrapperPath;
|
|
252857
|
-
constructor(functions,
|
|
252912
|
+
constructor(functions, logger2, wrapperPath) {
|
|
252858
252913
|
this.functions = new Map(functions.map((f7) => [f7.name, f7]));
|
|
252859
|
-
this.logger =
|
|
252914
|
+
this.logger = logger2;
|
|
252860
252915
|
this.wrapperPath = wrapperPath;
|
|
252861
252916
|
if (functions.length > 0) {
|
|
252862
252917
|
verifyDenoInstalled("to run backend functions locally");
|
|
@@ -252995,7 +253050,7 @@ class FunctionManager {
|
|
|
252995
253050
|
var import_express = __toESM(require_express(), 1);
|
|
252996
253051
|
var import_http_proxy_middleware = __toESM(require_dist2(), 1);
|
|
252997
253052
|
import { ServerResponse } from "node:http";
|
|
252998
|
-
function createFunctionRouter(manager,
|
|
253053
|
+
function createFunctionRouter(manager, logger2) {
|
|
252999
253054
|
const router = import_express.Router({ mergeParams: true });
|
|
253000
253055
|
const portsByRequest = new WeakMap;
|
|
253001
253056
|
const proxy = import_http_proxy_middleware.createProxyMiddleware({
|
|
@@ -253010,7 +253065,7 @@ function createFunctionRouter(manager, logger) {
|
|
|
253010
253065
|
proxyReq.setHeader("Base44-Api-Url", `${req.protocol}://${req.headers.host}`);
|
|
253011
253066
|
},
|
|
253012
253067
|
error: (err, _req, res) => {
|
|
253013
|
-
|
|
253068
|
+
logger2.error("Function proxy error:", err);
|
|
253014
253069
|
if (res instanceof ServerResponse && !res.headersSent) {
|
|
253015
253070
|
res.writeHead(502, { "Content-Type": "application/json" });
|
|
253016
253071
|
res.end(JSON.stringify({
|
|
@@ -253028,7 +253083,7 @@ function createFunctionRouter(manager, logger) {
|
|
|
253028
253083
|
portsByRequest.set(req, port);
|
|
253029
253084
|
next();
|
|
253030
253085
|
} catch (error48) {
|
|
253031
|
-
|
|
253086
|
+
logger2.error("Function error:", error48);
|
|
253032
253087
|
const message = error48 instanceof Error ? error48.message : String(error48);
|
|
253033
253088
|
res.status(500).json({ error: message });
|
|
253034
253089
|
}
|
|
@@ -253364,7 +253419,7 @@ var import_express3 = __toESM(require_express(), 1);
|
|
|
253364
253419
|
// src/cli/dev/dev-server/routes/entities/entities-user-router.ts
|
|
253365
253420
|
var import_express2 = __toESM(require_express(), 1);
|
|
253366
253421
|
var import_jsonwebtoken = __toESM(require_jsonwebtoken(), 1);
|
|
253367
|
-
function createUserRouter(db2,
|
|
253422
|
+
function createUserRouter(db2, logger2) {
|
|
253368
253423
|
const router = import_express2.Router({ mergeParams: true });
|
|
253369
253424
|
const parseBody = import_express2.json();
|
|
253370
253425
|
function withAuth(handler) {
|
|
@@ -253443,7 +253498,7 @@ function createUserRouter(db2, logger) {
|
|
|
253443
253498
|
res.status(422).json(error48.context);
|
|
253444
253499
|
return;
|
|
253445
253500
|
}
|
|
253446
|
-
|
|
253501
|
+
logger2.error(`Error in PUT /${USER_COLLECTION}/${req.params.id}:`, error48);
|
|
253447
253502
|
res.status(500).json({ error: "Internal server error" });
|
|
253448
253503
|
}
|
|
253449
253504
|
} else {
|
|
@@ -253479,7 +253534,7 @@ function parseFields(fields) {
|
|
|
253479
253534
|
}
|
|
253480
253535
|
return Object.keys(projection).length > 0 ? projection : undefined;
|
|
253481
253536
|
}
|
|
253482
|
-
async function createEntityRoutes(db2,
|
|
253537
|
+
async function createEntityRoutes(db2, logger2, broadcast) {
|
|
253483
253538
|
const router = import_express3.Router({ mergeParams: true });
|
|
253484
253539
|
const parseBody = import_express3.json();
|
|
253485
253540
|
function withCollection(handler) {
|
|
@@ -253507,7 +253562,7 @@ async function createEntityRoutes(db2, logger, broadcast) {
|
|
|
253507
253562
|
}
|
|
253508
253563
|
broadcast(appId, entityName, createData(data));
|
|
253509
253564
|
}
|
|
253510
|
-
const userRouter = createUserRouter(db2,
|
|
253565
|
+
const userRouter = createUserRouter(db2, logger2);
|
|
253511
253566
|
router.use("/User", userRouter);
|
|
253512
253567
|
router.get("/:entityName/:id", withCollection(async (req, res, collection) => {
|
|
253513
253568
|
const { entityName, id: id2 } = req.params;
|
|
@@ -253519,7 +253574,7 @@ async function createEntityRoutes(db2, logger, broadcast) {
|
|
|
253519
253574
|
}
|
|
253520
253575
|
res.json(stripInternalFields(doc2));
|
|
253521
253576
|
} catch (error48) {
|
|
253522
|
-
|
|
253577
|
+
logger2.error(`Error in GET /${entityName}/${id2}:`, error48);
|
|
253523
253578
|
res.status(500).json({ error: "Internal server error" });
|
|
253524
253579
|
}
|
|
253525
253580
|
}));
|
|
@@ -253560,7 +253615,7 @@ async function createEntityRoutes(db2, logger, broadcast) {
|
|
|
253560
253615
|
const docs = await cursor3;
|
|
253561
253616
|
res.json(stripInternalFields(docs));
|
|
253562
253617
|
} catch (error48) {
|
|
253563
|
-
|
|
253618
|
+
logger2.error(`Error in GET /${entityName}:`, error48);
|
|
253564
253619
|
res.status(500).json({ error: "Internal server error" });
|
|
253565
253620
|
}
|
|
253566
253621
|
}));
|
|
@@ -253585,7 +253640,7 @@ async function createEntityRoutes(db2, logger, broadcast) {
|
|
|
253585
253640
|
res.status(422).json(error48.context);
|
|
253586
253641
|
return;
|
|
253587
253642
|
}
|
|
253588
|
-
|
|
253643
|
+
logger2.error(`Error in POST /${entityName}:`, error48);
|
|
253589
253644
|
res.status(500).json({ error: "Internal server error" });
|
|
253590
253645
|
}
|
|
253591
253646
|
}));
|
|
@@ -253616,7 +253671,7 @@ async function createEntityRoutes(db2, logger, broadcast) {
|
|
|
253616
253671
|
res.status(422).json(error48.context);
|
|
253617
253672
|
return;
|
|
253618
253673
|
}
|
|
253619
|
-
|
|
253674
|
+
logger2.error(`Error in POST /${entityName}/bulk:`, error48);
|
|
253620
253675
|
res.status(500).json({ error: "Internal server error" });
|
|
253621
253676
|
}
|
|
253622
253677
|
}));
|
|
@@ -253643,7 +253698,7 @@ async function createEntityRoutes(db2, logger, broadcast) {
|
|
|
253643
253698
|
res.status(422).json(error48.context);
|
|
253644
253699
|
return;
|
|
253645
253700
|
}
|
|
253646
|
-
|
|
253701
|
+
logger2.error(`Error in PUT /${entityName}/${id2}:`, error48);
|
|
253647
253702
|
res.status(500).json({ error: "Internal server error" });
|
|
253648
253703
|
}
|
|
253649
253704
|
}));
|
|
@@ -253661,7 +253716,7 @@ async function createEntityRoutes(db2, logger, broadcast) {
|
|
|
253661
253716
|
}
|
|
253662
253717
|
res.json({ success: true });
|
|
253663
253718
|
} catch (error48) {
|
|
253664
|
-
|
|
253719
|
+
logger2.error(`Error in DELETE /${entityName}/${id2}:`, error48);
|
|
253665
253720
|
res.status(500).json({ error: "Internal server error" });
|
|
253666
253721
|
}
|
|
253667
253722
|
}));
|
|
@@ -253672,7 +253727,7 @@ async function createEntityRoutes(db2, logger, broadcast) {
|
|
|
253672
253727
|
const numRemoved = await collection.removeAsync(query, { multi: true });
|
|
253673
253728
|
res.json({ success: true, deleted: numRemoved });
|
|
253674
253729
|
} catch (error48) {
|
|
253675
|
-
|
|
253730
|
+
logger2.error(`Error in DELETE /${entityName}:`, error48);
|
|
253676
253731
|
res.status(500).json({ error: "Internal server error" });
|
|
253677
253732
|
}
|
|
253678
253733
|
}));
|
|
@@ -253688,7 +253743,7 @@ import path18 from "node:path";
|
|
|
253688
253743
|
function createFileToken(fileUri) {
|
|
253689
253744
|
return createHash("sha256").update(fileUri).digest("hex");
|
|
253690
253745
|
}
|
|
253691
|
-
function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy,
|
|
253746
|
+
function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger2) {
|
|
253692
253747
|
const router = import_express4.Router({ mergeParams: true });
|
|
253693
253748
|
const parseBody = import_express4.json();
|
|
253694
253749
|
const privateFilesDir = path18.join(mediaFilesDir, "private");
|
|
@@ -253741,12 +253796,12 @@ function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
|
|
|
253741
253796
|
res.json({ signed_url });
|
|
253742
253797
|
});
|
|
253743
253798
|
router.post("/Core/:endpointName", (req, res, next) => {
|
|
253744
|
-
|
|
253799
|
+
logger2.warn(`Core.${req.params.endpointName} is not supported in local development`);
|
|
253745
253800
|
req.url = req.originalUrl;
|
|
253746
253801
|
remoteProxy(req, res, next);
|
|
253747
253802
|
});
|
|
253748
253803
|
router.post("/installable/:packageName/integration-endpoints/:endpointName", (req, res, next) => {
|
|
253749
|
-
|
|
253804
|
+
logger2.warn(`${req.params.packageName}.${req.params.endpointName} is not supported in local development`);
|
|
253750
253805
|
req.url = req.originalUrl;
|
|
253751
253806
|
remoteProxy(req, res, next);
|
|
253752
253807
|
});
|
|
@@ -253759,10 +253814,10 @@ function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
|
|
|
253759
253814
|
});
|
|
253760
253815
|
return router;
|
|
253761
253816
|
}
|
|
253762
|
-
function createCustomIntegrationRoutes(remoteProxy,
|
|
253817
|
+
function createCustomIntegrationRoutes(remoteProxy, logger2) {
|
|
253763
253818
|
const router = import_express4.Router({ mergeParams: true });
|
|
253764
253819
|
router.post("/:slug/:operationId", (req, res, next) => {
|
|
253765
|
-
|
|
253820
|
+
logger2.warn(`"${req.originalUrl}" is not supported in local development, passing call to production`);
|
|
253766
253821
|
req.url = req.originalUrl;
|
|
253767
253822
|
remoteProxy(req, res, next);
|
|
253768
253823
|
});
|
|
@@ -255395,10 +255450,10 @@ class WatchBase44 extends EventEmitter4 {
|
|
|
255395
255450
|
entryNames;
|
|
255396
255451
|
watchers = new Map;
|
|
255397
255452
|
queueWaitForCreationTimeout = null;
|
|
255398
|
-
constructor(itemsToWatch,
|
|
255453
|
+
constructor(itemsToWatch, logger2) {
|
|
255399
255454
|
super();
|
|
255400
255455
|
this.itemsToWatch = itemsToWatch;
|
|
255401
|
-
this.logger =
|
|
255456
|
+
this.logger = logger2;
|
|
255402
255457
|
this.entryNames = Object.keys(itemsToWatch);
|
|
255403
255458
|
}
|
|
255404
255459
|
async start() {
|
|
@@ -255495,12 +255550,12 @@ async function createDevServer(options8) {
|
|
|
255495
255550
|
const functionRoutes = createFunctionRouter(functionManager, devLogger);
|
|
255496
255551
|
app.use("/api/apps/:appId/functions", functionRoutes);
|
|
255497
255552
|
if (functionManager.getFunctionNames().length > 0) {
|
|
255498
|
-
|
|
255553
|
+
options8.log.info(`Loaded functions: ${functionManager.getFunctionNames().join(", ")}`);
|
|
255499
255554
|
}
|
|
255500
255555
|
const db2 = new Database;
|
|
255501
255556
|
await db2.load(entities);
|
|
255502
255557
|
if (db2.getCollectionNames().length > 0) {
|
|
255503
|
-
|
|
255558
|
+
options8.log.info(`Loaded entities: ${db2.getCollectionNames().join(", ")}`);
|
|
255504
255559
|
}
|
|
255505
255560
|
let emitEntityEvent = () => {};
|
|
255506
255561
|
const entityRoutes = await createEntityRoutes(db2, devLogger, (...args) => emitEntityEvent(...args));
|
|
@@ -255596,9 +255651,10 @@ async function createDevServer(options8) {
|
|
|
255596
255651
|
}
|
|
255597
255652
|
|
|
255598
255653
|
// src/cli/commands/dev.ts
|
|
255599
|
-
async function devAction(options8) {
|
|
255654
|
+
async function devAction({ log }, options8) {
|
|
255600
255655
|
const port = options8.port ? Number(options8.port) : undefined;
|
|
255601
255656
|
const { port: resolvedPort } = await createDevServer({
|
|
255657
|
+
log,
|
|
255602
255658
|
port,
|
|
255603
255659
|
denoWrapperPath: getDenoWrapperPath(),
|
|
255604
255660
|
loadResources: async () => {
|
|
@@ -255696,15 +255752,22 @@ Examples:
|
|
|
255696
255752
|
$ cat ./script.ts | base44 exec
|
|
255697
255753
|
|
|
255698
255754
|
Inline script:
|
|
255699
|
-
$ echo "const users = await base44.entities.User.list()" | base44 exec`).action(async (
|
|
255700
|
-
return await execAction(
|
|
255755
|
+
$ echo "const users = await base44.entities.User.list()" | base44 exec`).action(async ({ isNonInteractive }) => {
|
|
255756
|
+
return await execAction(isNonInteractive);
|
|
255701
255757
|
});
|
|
255702
255758
|
}
|
|
255703
255759
|
|
|
255704
255760
|
// src/cli/commands/project/eject.ts
|
|
255705
255761
|
import { resolve as resolve8 } from "node:path";
|
|
255706
255762
|
var import_kebabCase2 = __toESM(require_kebabCase(), 1);
|
|
255707
|
-
async function eject(options8) {
|
|
255763
|
+
async function eject(ctx, options8) {
|
|
255764
|
+
const { log, isNonInteractive } = ctx;
|
|
255765
|
+
if (isNonInteractive && !options8.projectId) {
|
|
255766
|
+
throw new InvalidInputError("--project-id is required in non-interactive mode");
|
|
255767
|
+
}
|
|
255768
|
+
if (isNonInteractive && !options8.path) {
|
|
255769
|
+
throw new InvalidInputError("--path is required in non-interactive mode");
|
|
255770
|
+
}
|
|
255708
255771
|
const projects = await listProjects();
|
|
255709
255772
|
const ejectableProjects = projects.filter((p4) => p4.isManagedSourceCode !== false);
|
|
255710
255773
|
let selectedProject;
|
|
@@ -255720,7 +255783,7 @@ async function eject(options8) {
|
|
|
255720
255783
|
});
|
|
255721
255784
|
}
|
|
255722
255785
|
selectedProject = foundProject;
|
|
255723
|
-
|
|
255786
|
+
log.info(`Selected project: ${theme.styles.bold(selectedProject.name)}`);
|
|
255724
255787
|
} else {
|
|
255725
255788
|
if (ejectableProjects.length === 0) {
|
|
255726
255789
|
return { outroMessage: "No projects available to eject." };
|
|
@@ -255784,24 +255847,13 @@ async function eject(options8) {
|
|
|
255784
255847
|
successMessage: theme.colors.base44Orange("Project built successfully"),
|
|
255785
255848
|
errorMessage: "Failed to build project"
|
|
255786
255849
|
});
|
|
255787
|
-
await deployAction({ yes: true, projectRoot: resolvedPath });
|
|
255850
|
+
await deployAction(ctx, { yes: true, projectRoot: resolvedPath });
|
|
255788
255851
|
}
|
|
255789
255852
|
}
|
|
255790
255853
|
return { outroMessage: "Your new project is set and ready to use" };
|
|
255791
255854
|
}
|
|
255792
255855
|
function getEjectCommand() {
|
|
255793
|
-
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(
|
|
255794
|
-
if (command2.isNonInteractive && !options8.projectId) {
|
|
255795
|
-
throw new InvalidInputError("--project-id is required in non-interactive mode");
|
|
255796
|
-
}
|
|
255797
|
-
if (command2.isNonInteractive && !options8.path) {
|
|
255798
|
-
throw new InvalidInputError("--path is required in non-interactive mode");
|
|
255799
|
-
}
|
|
255800
|
-
return await eject({
|
|
255801
|
-
...options8,
|
|
255802
|
-
isNonInteractive: command2.isNonInteractive
|
|
255803
|
-
});
|
|
255804
|
-
});
|
|
255856
|
+
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);
|
|
255805
255857
|
}
|
|
255806
255858
|
|
|
255807
255859
|
// src/cli/program.ts
|
|
@@ -256284,23 +256336,23 @@ function isInstanceOf(candidate, base) {
|
|
|
256284
256336
|
}
|
|
256285
256337
|
|
|
256286
256338
|
// ../../node_modules/@posthog/core/dist/utils/number-utils.mjs
|
|
256287
|
-
function clampToRange(value, min, max,
|
|
256339
|
+
function clampToRange(value, min, max, logger2, fallbackValue) {
|
|
256288
256340
|
if (min > max) {
|
|
256289
|
-
|
|
256341
|
+
logger2.warn("min cannot be greater than max.");
|
|
256290
256342
|
min = max;
|
|
256291
256343
|
}
|
|
256292
256344
|
if (isNumber(value))
|
|
256293
256345
|
if (value > max) {
|
|
256294
|
-
|
|
256346
|
+
logger2.warn(" cannot be greater than max: " + max + ". Using max value instead.");
|
|
256295
256347
|
return max;
|
|
256296
256348
|
} else {
|
|
256297
256349
|
if (!(value < min))
|
|
256298
256350
|
return value;
|
|
256299
|
-
|
|
256351
|
+
logger2.warn(" cannot be less than min: " + min + ". Using min value instead.");
|
|
256300
256352
|
return min;
|
|
256301
256353
|
}
|
|
256302
|
-
|
|
256303
|
-
return clampToRange(fallbackValue || max, min, max,
|
|
256354
|
+
logger2.warn(" must be a number. using max or fallback. max: " + max + ", fallback: " + fallbackValue);
|
|
256355
|
+
return clampToRange(fallbackValue || max, min, max, logger2);
|
|
256304
256356
|
}
|
|
256305
256357
|
|
|
256306
256358
|
// ../../node_modules/@posthog/core/dist/utils/bucketed-rate-limiter.mjs
|
|
@@ -256390,7 +256442,7 @@ var _createLogger = (prefix, maybeCall, consoleLike) => {
|
|
|
256390
256442
|
consoleMethod(prefix, ...args);
|
|
256391
256443
|
});
|
|
256392
256444
|
}
|
|
256393
|
-
const
|
|
256445
|
+
const logger2 = {
|
|
256394
256446
|
info: (...args) => {
|
|
256395
256447
|
_log("log", ...args);
|
|
256396
256448
|
},
|
|
@@ -256405,7 +256457,7 @@ var _createLogger = (prefix, maybeCall, consoleLike) => {
|
|
|
256405
256457
|
},
|
|
256406
256458
|
createLogger: (additionalPrefix) => _createLogger(`${prefix} ${additionalPrefix}`, maybeCall, consoleLike)
|
|
256407
256459
|
};
|
|
256408
|
-
return
|
|
256460
|
+
return logger2;
|
|
256409
256461
|
};
|
|
256410
256462
|
var passThrough = (fn9) => fn9();
|
|
256411
256463
|
function createLogger(prefix, maybeCall = passThrough) {
|
|
@@ -260047,10 +260099,12 @@ async function runCLI(options8) {
|
|
|
260047
260099
|
const errorReporter = new ErrorReporter;
|
|
260048
260100
|
errorReporter.registerProcessErrorHandlers();
|
|
260049
260101
|
const isNonInteractive = !process.stdin.isTTY || !process.stdout.isTTY;
|
|
260102
|
+
const log = isNonInteractive ? new SimpleLogger : new ClackLogger;
|
|
260050
260103
|
const context = {
|
|
260051
260104
|
errorReporter,
|
|
260052
260105
|
isNonInteractive,
|
|
260053
|
-
distribution: options8?.distribution ?? "npm"
|
|
260106
|
+
distribution: options8?.distribution ?? "npm",
|
|
260107
|
+
log
|
|
260054
260108
|
};
|
|
260055
260109
|
const program2 = createProgram(context);
|
|
260056
260110
|
try {
|
|
@@ -260076,4 +260130,4 @@ export {
|
|
|
260076
260130
|
CLIExitError
|
|
260077
260131
|
};
|
|
260078
260132
|
|
|
260079
|
-
//# debugId=
|
|
260133
|
+
//# debugId=A24F743E2AEBCF2A64756E2164756E21
|