@base44-preview/cli 0.0.55-pr.547.7e43787 → 0.0.56-pr.547.19f8df8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -6
- package/dist/cli/index.js +772 -387
- package/dist/cli/index.js.map +41 -36
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -16349,7 +16349,7 @@ var require_front_matter = __commonJS((exports, module) => {
|
|
|
16349
16349
|
var optionalByteOrderMark = "\\ufeff?";
|
|
16350
16350
|
var platform5 = typeof process !== "undefined" ? process.platform : "";
|
|
16351
16351
|
var pattern = "^(" + optionalByteOrderMark + "(= yaml =|---)" + "$([\\s\\S]*?)" + "^(?:\\2|\\.\\.\\.)\\s*" + "$" + (platform5 === "win32" ? "\\r?" : "") + "(?:\\n)?)";
|
|
16352
|
-
var
|
|
16352
|
+
var regex2 = new RegExp(pattern, "m");
|
|
16353
16353
|
module.exports = extractor;
|
|
16354
16354
|
module.exports.test = test;
|
|
16355
16355
|
function extractor(string4, options) {
|
|
@@ -16384,7 +16384,7 @@ var require_front_matter = __commonJS((exports, module) => {
|
|
|
16384
16384
|
return line;
|
|
16385
16385
|
}
|
|
16386
16386
|
function parse10(string4, allowUnsafe) {
|
|
16387
|
-
var match =
|
|
16387
|
+
var match = regex2.exec(string4);
|
|
16388
16388
|
if (!match) {
|
|
16389
16389
|
return {
|
|
16390
16390
|
attributes: {},
|
|
@@ -16406,7 +16406,7 @@ var require_front_matter = __commonJS((exports, module) => {
|
|
|
16406
16406
|
}
|
|
16407
16407
|
function test(string4) {
|
|
16408
16408
|
string4 = string4 || "";
|
|
16409
|
-
return
|
|
16409
|
+
return regex2.test(string4);
|
|
16410
16410
|
}
|
|
16411
16411
|
});
|
|
16412
16412
|
|
|
@@ -121034,9 +121034,9 @@ function getMessage2(key2, parameters, self2) {
|
|
|
121034
121034
|
assert22.ok(message.length <= parameters.length, `Code: ${key2}; The provided arguments length (${parameters.length}) does not match the required ones (${message.length}).`);
|
|
121035
121035
|
return Reflect.apply(message, self2, parameters);
|
|
121036
121036
|
}
|
|
121037
|
-
const
|
|
121037
|
+
const regex2 = /%[dfijoOs]/g;
|
|
121038
121038
|
let expectedLength = 0;
|
|
121039
|
-
while (
|
|
121039
|
+
while (regex2.exec(message) !== null)
|
|
121040
121040
|
expectedLength++;
|
|
121041
121041
|
assert22.ok(expectedLength === parameters.length, `Code: ${key2}; The provided arguments length (${parameters.length}) does not match the required ones (${expectedLength}).`);
|
|
121042
121042
|
if (parameters.length === 0)
|
|
@@ -121937,9 +121937,9 @@ function convertEndOfLineOptionToCharacter2(endOfLineOption) {
|
|
|
121937
121937
|
return endOfLineOption === OPTION_CR2 ? CHARACTER_CR2 : endOfLineOption === OPTION_CRLF2 ? CHARACTER_CRLF2 : DEFAULT_EOL2;
|
|
121938
121938
|
}
|
|
121939
121939
|
function countEndOfLineCharacters(text, endOfLineCharacter) {
|
|
121940
|
-
const
|
|
121940
|
+
const regex2 = regexps.get(endOfLineCharacter);
|
|
121941
121941
|
if (false) {}
|
|
121942
|
-
return text.match(
|
|
121942
|
+
return text.match(regex2)?.length ?? 0;
|
|
121943
121943
|
}
|
|
121944
121944
|
function normalizeEndOfLine(text) {
|
|
121945
121945
|
return method_replace_all_default2(0, text, END_OF_LINE_REGEXP, CHARACTER_LF2);
|
|
@@ -124141,8 +124141,8 @@ function legacyIsNextLineEmpty(text, node, locEnd) {
|
|
|
124141
124141
|
}
|
|
124142
124142
|
function makeString(rawText, enclosingQuote, unescapeUnnecessaryEscapes) {
|
|
124143
124143
|
const otherQuote = enclosingQuote === '"' ? "'" : '"';
|
|
124144
|
-
const
|
|
124145
|
-
const raw2 = method_replace_all_default2(0, rawText,
|
|
124144
|
+
const regex2 = /\\(.)|(["'])/gsu;
|
|
124145
|
+
const raw2 = method_replace_all_default2(0, rawText, regex2, (match, escaped, quote) => {
|
|
124146
124146
|
if (escaped === otherQuote) {
|
|
124147
124147
|
return escaped;
|
|
124148
124148
|
}
|
|
@@ -127563,17 +127563,17 @@ var init_prettier = __esm(() => {
|
|
|
127563
127563
|
}
|
|
127564
127564
|
const opts = options8 || {};
|
|
127565
127565
|
const posix = utils3.isWindows(options8);
|
|
127566
|
-
const
|
|
127567
|
-
const state =
|
|
127568
|
-
delete
|
|
127566
|
+
const regex2 = isState ? picomatch.compileRe(glob, options8) : picomatch.makeRe(glob, options8, false, true);
|
|
127567
|
+
const state = regex2.state;
|
|
127568
|
+
delete regex2.state;
|
|
127569
127569
|
let isIgnored2 = () => false;
|
|
127570
127570
|
if (opts.ignore) {
|
|
127571
127571
|
const ignoreOpts = { ...options8, ignore: null, onMatch: null, onResult: null };
|
|
127572
127572
|
isIgnored2 = picomatch(opts.ignore, ignoreOpts, returnState);
|
|
127573
127573
|
}
|
|
127574
127574
|
const matcher = (input, returnObject = false) => {
|
|
127575
|
-
const { isMatch, match, output } = picomatch.test(input,
|
|
127576
|
-
const result = { glob, state, regex, posix, input, output, match, isMatch };
|
|
127575
|
+
const { isMatch, match, output } = picomatch.test(input, regex2, options8, { glob, posix });
|
|
127576
|
+
const result = { glob, state, regex: regex2, posix, input, output, match, isMatch };
|
|
127577
127577
|
if (typeof opts.onResult === "function") {
|
|
127578
127578
|
opts.onResult(result);
|
|
127579
127579
|
}
|
|
@@ -127598,7 +127598,7 @@ var init_prettier = __esm(() => {
|
|
|
127598
127598
|
}
|
|
127599
127599
|
return matcher;
|
|
127600
127600
|
};
|
|
127601
|
-
picomatch.test = (input,
|
|
127601
|
+
picomatch.test = (input, regex2, options8, { glob, posix } = {}) => {
|
|
127602
127602
|
if (typeof input !== "string") {
|
|
127603
127603
|
throw new TypeError("Expected input to be a string");
|
|
127604
127604
|
}
|
|
@@ -127615,16 +127615,16 @@ var init_prettier = __esm(() => {
|
|
|
127615
127615
|
}
|
|
127616
127616
|
if (match === false || opts.capture === true) {
|
|
127617
127617
|
if (opts.matchBase === true || opts.basename === true) {
|
|
127618
|
-
match = picomatch.matchBase(input,
|
|
127618
|
+
match = picomatch.matchBase(input, regex2, options8, posix);
|
|
127619
127619
|
} else {
|
|
127620
|
-
match =
|
|
127620
|
+
match = regex2.exec(output);
|
|
127621
127621
|
}
|
|
127622
127622
|
}
|
|
127623
127623
|
return { isMatch: Boolean(match), match, output };
|
|
127624
127624
|
};
|
|
127625
127625
|
picomatch.matchBase = (input, glob, options8, posix = utils3.isWindows(options8)) => {
|
|
127626
|
-
const
|
|
127627
|
-
return
|
|
127626
|
+
const regex2 = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options8);
|
|
127627
|
+
return regex2.test(path152.basename(input));
|
|
127628
127628
|
};
|
|
127629
127629
|
picomatch.isMatch = (str, patterns, options8) => picomatch(patterns, options8)(str);
|
|
127630
127630
|
picomatch.parse = (pattern, options8) => {
|
|
@@ -127644,11 +127644,11 @@ var init_prettier = __esm(() => {
|
|
|
127644
127644
|
if (state && state.negated === true) {
|
|
127645
127645
|
source2 = `^(?!${source2}).*$`;
|
|
127646
127646
|
}
|
|
127647
|
-
const
|
|
127647
|
+
const regex2 = picomatch.toRegex(source2, options8);
|
|
127648
127648
|
if (returnState === true) {
|
|
127649
|
-
|
|
127649
|
+
regex2.state = state;
|
|
127650
127650
|
}
|
|
127651
|
-
return
|
|
127651
|
+
return regex2;
|
|
127652
127652
|
};
|
|
127653
127653
|
picomatch.makeRe = (input, options8 = {}, returnOutput = false, returnState = false) => {
|
|
127654
127654
|
if (!input || typeof input !== "string") {
|
|
@@ -127812,8 +127812,8 @@ var init_prettier = __esm(() => {
|
|
|
127812
127812
|
};
|
|
127813
127813
|
micromatch2.capture = (glob, input, options8) => {
|
|
127814
127814
|
let posix = utils3.isWindows(options8);
|
|
127815
|
-
let
|
|
127816
|
-
let match =
|
|
127815
|
+
let regex2 = picomatch.makeRe(String(glob), { ...options8, capture: true });
|
|
127816
|
+
let match = regex2.exec(posix ? utils3.toPosixSlashes(input) : input);
|
|
127817
127817
|
if (match) {
|
|
127818
127818
|
return match.slice(1).map((v10) => v10 === undefined ? "" : v10);
|
|
127819
127819
|
}
|
|
@@ -132252,7 +132252,7 @@ globstar while`, file2, fr10, pattern, pr8, swallowee);
|
|
|
132252
132252
|
};
|
|
132253
132253
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
132254
132254
|
var fs42 = __importStar(__require2("fs"));
|
|
132255
|
-
var
|
|
132255
|
+
var regex2 = {
|
|
132256
132256
|
section: /^\s*\[(([^#;]|\\#|\\;)+)\]\s*([#;].*)?$/,
|
|
132257
132257
|
param: /^\s*([\w\.\-\_]+)\s*[=:]\s*(.*?)\s*([#;].*)?$/,
|
|
132258
132258
|
comment: /^\s*[#;].*$/
|
|
@@ -132284,14 +132284,14 @@ globstar while`, file2, fr10, pattern, pr8, swallowee);
|
|
|
132284
132284
|
var lines = data.split(/\r\n|\r|\n/);
|
|
132285
132285
|
lines.forEach(function(line3) {
|
|
132286
132286
|
var match;
|
|
132287
|
-
if (
|
|
132287
|
+
if (regex2.comment.test(line3)) {
|
|
132288
132288
|
return;
|
|
132289
132289
|
}
|
|
132290
|
-
if (
|
|
132291
|
-
match = line3.match(
|
|
132290
|
+
if (regex2.param.test(line3)) {
|
|
132291
|
+
match = line3.match(regex2.param);
|
|
132292
132292
|
sectionBody[match[1]] = match[2];
|
|
132293
|
-
} else if (
|
|
132294
|
-
match = line3.match(
|
|
132293
|
+
} else if (regex2.section.test(line3)) {
|
|
132294
|
+
match = line3.match(regex2.section);
|
|
132295
132295
|
sectionName = match[1];
|
|
132296
132296
|
sectionBody = {};
|
|
132297
132297
|
value.push([sectionName, sectionBody]);
|
|
@@ -133377,8 +133377,8 @@ globstar while`, file2, fr10, pattern, pr8, swallowee);
|
|
|
133377
133377
|
}
|
|
133378
133378
|
_make(mode, key2) {
|
|
133379
133379
|
const str = this.regexPrefix.replace(REGEX_REPLACE_TRAILING_WILDCARD, TRAILING_WILD_CARD_REPLACERS[mode]);
|
|
133380
|
-
const
|
|
133381
|
-
return define2(this, key2,
|
|
133380
|
+
const regex2 = this.ignoreCase ? new RegExp(str, "i") : new RegExp(str);
|
|
133381
|
+
return define2(this, key2, regex2);
|
|
133382
133382
|
}
|
|
133383
133383
|
};
|
|
133384
133384
|
var createRule = ({
|
|
@@ -138174,8 +138174,8 @@ var require_prettier = __commonJS((exports, module) => {
|
|
|
138174
138174
|
}
|
|
138175
138175
|
function makeString2(rawText, enclosingQuote, unescapeUnnecessaryEscapes) {
|
|
138176
138176
|
const otherQuote = enclosingQuote === '"' ? "'" : '"';
|
|
138177
|
-
const
|
|
138178
|
-
const raw2 = method_replace_all_default3(0, rawText,
|
|
138177
|
+
const regex2 = /\\(.)|(["'])/gsu;
|
|
138178
|
+
const raw2 = method_replace_all_default3(0, rawText, regex2, (match, escaped, quote) => {
|
|
138179
138179
|
if (escaped === otherQuote) {
|
|
138180
138180
|
return escaped;
|
|
138181
138181
|
}
|
|
@@ -138269,11 +138269,11 @@ var require_prettier = __commonJS((exports, module) => {
|
|
|
138269
138269
|
var require_formatter = __commonJS((exports) => {
|
|
138270
138270
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
|
|
138271
138271
|
function adopt(value) {
|
|
138272
|
-
return value instanceof P9 ? value : new P9(function(
|
|
138273
|
-
|
|
138272
|
+
return value instanceof P9 ? value : new P9(function(resolve12) {
|
|
138273
|
+
resolve12(value);
|
|
138274
138274
|
});
|
|
138275
138275
|
}
|
|
138276
|
-
return new (P9 || (P9 = Promise))(function(
|
|
138276
|
+
return new (P9 || (P9 = Promise))(function(resolve12, reject) {
|
|
138277
138277
|
function fulfilled(value) {
|
|
138278
138278
|
try {
|
|
138279
138279
|
step(generator.next(value));
|
|
@@ -138289,7 +138289,7 @@ var require_formatter = __commonJS((exports) => {
|
|
|
138289
138289
|
}
|
|
138290
138290
|
}
|
|
138291
138291
|
function step(result) {
|
|
138292
|
-
result.done ?
|
|
138292
|
+
result.done ? resolve12(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
138293
138293
|
}
|
|
138294
138294
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
138295
138295
|
});
|
|
@@ -142942,7 +142942,7 @@ var require_url = __commonJS((exports) => {
|
|
|
142942
142942
|
};
|
|
142943
142943
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
142944
142944
|
exports.parse = undefined;
|
|
142945
|
-
exports.resolve =
|
|
142945
|
+
exports.resolve = resolve12;
|
|
142946
142946
|
exports.cwd = cwd;
|
|
142947
142947
|
exports.getProtocol = getProtocol;
|
|
142948
142948
|
exports.getExtension = getExtension;
|
|
@@ -142970,7 +142970,7 @@ var require_url = __commonJS((exports) => {
|
|
|
142970
142970
|
var urlDecodePatterns = [/%23/g, "#", /%24/g, "$", /%26/g, "&", /%2C/g, ",", /%40/g, "@"];
|
|
142971
142971
|
var parse11 = (u4) => new URL(u4);
|
|
142972
142972
|
exports.parse = parse11;
|
|
142973
|
-
function
|
|
142973
|
+
function resolve12(from, to5) {
|
|
142974
142974
|
const fromUrl = new URL((0, convert_path_to_posix_1.default)(from), "https://aaa.nonexistanturl.com");
|
|
142975
142975
|
const resolvedUrl = new URL((0, convert_path_to_posix_1.default)(to5), fromUrl);
|
|
142976
142976
|
const endSpaces = to5.match(/(\s*)$/)?.[1] || "";
|
|
@@ -143106,7 +143106,7 @@ var require_url = __commonJS((exports) => {
|
|
|
143106
143106
|
}
|
|
143107
143107
|
function relative4(from, to5) {
|
|
143108
143108
|
if (!isFileSystemPath(from) || !isFileSystemPath(to5)) {
|
|
143109
|
-
return
|
|
143109
|
+
return resolve12(from, to5);
|
|
143110
143110
|
}
|
|
143111
143111
|
const fromDir = path_1.default.dirname(stripHash(from));
|
|
143112
143112
|
const toPath4 = stripHash(to5);
|
|
@@ -143782,7 +143782,7 @@ var require_plugins = __commonJS((exports) => {
|
|
|
143782
143782
|
let plugin;
|
|
143783
143783
|
let lastError;
|
|
143784
143784
|
let index = 0;
|
|
143785
|
-
return new Promise((
|
|
143785
|
+
return new Promise((resolve12, reject) => {
|
|
143786
143786
|
runNextPlugin();
|
|
143787
143787
|
function runNextPlugin() {
|
|
143788
143788
|
plugin = plugins[index++];
|
|
@@ -143810,7 +143810,7 @@ var require_plugins = __commonJS((exports) => {
|
|
|
143810
143810
|
}
|
|
143811
143811
|
}
|
|
143812
143812
|
function onSuccess(result) {
|
|
143813
|
-
|
|
143813
|
+
resolve12({
|
|
143814
143814
|
plugin,
|
|
143815
143815
|
result
|
|
143816
143816
|
});
|
|
@@ -145143,11 +145143,11 @@ var require_lib3 = __commonJS((exports) => {
|
|
|
145143
145143
|
var require_resolver = __commonJS((exports) => {
|
|
145144
145144
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
|
|
145145
145145
|
function adopt(value) {
|
|
145146
|
-
return value instanceof P9 ? value : new P9(function(
|
|
145147
|
-
|
|
145146
|
+
return value instanceof P9 ? value : new P9(function(resolve12) {
|
|
145147
|
+
resolve12(value);
|
|
145148
145148
|
});
|
|
145149
145149
|
}
|
|
145150
|
-
return new (P9 || (P9 = Promise))(function(
|
|
145150
|
+
return new (P9 || (P9 = Promise))(function(resolve12, reject) {
|
|
145151
145151
|
function fulfilled(value) {
|
|
145152
145152
|
try {
|
|
145153
145153
|
step(generator.next(value));
|
|
@@ -145163,7 +145163,7 @@ var require_resolver = __commonJS((exports) => {
|
|
|
145163
145163
|
}
|
|
145164
145164
|
}
|
|
145165
145165
|
function step(result) {
|
|
145166
|
-
result.done ?
|
|
145166
|
+
result.done ? resolve12(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
145167
145167
|
}
|
|
145168
145168
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
145169
145169
|
});
|
|
@@ -145284,11 +145284,11 @@ var require_optionValidator = __commonJS((exports) => {
|
|
|
145284
145284
|
var require_src3 = __commonJS((exports) => {
|
|
145285
145285
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
|
|
145286
145286
|
function adopt(value) {
|
|
145287
|
-
return value instanceof P9 ? value : new P9(function(
|
|
145288
|
-
|
|
145287
|
+
return value instanceof P9 ? value : new P9(function(resolve12) {
|
|
145288
|
+
resolve12(value);
|
|
145289
145289
|
});
|
|
145290
145290
|
}
|
|
145291
|
-
return new (P9 || (P9 = Promise))(function(
|
|
145291
|
+
return new (P9 || (P9 = Promise))(function(resolve12, reject) {
|
|
145292
145292
|
function fulfilled(value) {
|
|
145293
145293
|
try {
|
|
145294
145294
|
step(generator.next(value));
|
|
@@ -145304,7 +145304,7 @@ var require_src3 = __commonJS((exports) => {
|
|
|
145304
145304
|
}
|
|
145305
145305
|
}
|
|
145306
145306
|
function step(result) {
|
|
145307
|
-
result.done ?
|
|
145307
|
+
result.done ? resolve12(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
145308
145308
|
}
|
|
145309
145309
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
145310
145310
|
});
|
|
@@ -150819,11 +150819,11 @@ var require_raw_body = __commonJS((exports, module) => {
|
|
|
150819
150819
|
if (done) {
|
|
150820
150820
|
return readStream(stream, encoding, length, limit, wrap(done));
|
|
150821
150821
|
}
|
|
150822
|
-
return new Promise(function executor(
|
|
150822
|
+
return new Promise(function executor(resolve12, reject) {
|
|
150823
150823
|
readStream(stream, encoding, length, limit, function onRead2(err, buf) {
|
|
150824
150824
|
if (err)
|
|
150825
150825
|
return reject(err);
|
|
150826
|
-
|
|
150826
|
+
resolve12(buf);
|
|
150827
150827
|
});
|
|
150828
150828
|
});
|
|
150829
150829
|
}
|
|
@@ -163948,7 +163948,7 @@ var require_view = __commonJS((exports, module) => {
|
|
|
163948
163948
|
var basename6 = path18.basename;
|
|
163949
163949
|
var extname2 = path18.extname;
|
|
163950
163950
|
var join25 = path18.join;
|
|
163951
|
-
var
|
|
163951
|
+
var resolve12 = path18.resolve;
|
|
163952
163952
|
module.exports = View;
|
|
163953
163953
|
function View(name2, options8) {
|
|
163954
163954
|
var opts = options8 || {};
|
|
@@ -163982,7 +163982,7 @@ var require_view = __commonJS((exports, module) => {
|
|
|
163982
163982
|
debug('lookup "%s"', name2);
|
|
163983
163983
|
for (var i5 = 0;i5 < roots.length && !path19; i5++) {
|
|
163984
163984
|
var root2 = roots[i5];
|
|
163985
|
-
var loc =
|
|
163985
|
+
var loc = resolve12(root2, name2);
|
|
163986
163986
|
var dir = dirname19(loc);
|
|
163987
163987
|
var file2 = basename6(loc);
|
|
163988
163988
|
path19 = this.resolve(dir, file2);
|
|
@@ -164007,7 +164007,7 @@ var require_view = __commonJS((exports, module) => {
|
|
|
164007
164007
|
});
|
|
164008
164008
|
sync = false;
|
|
164009
164009
|
};
|
|
164010
|
-
View.prototype.resolve = function
|
|
164010
|
+
View.prototype.resolve = function resolve13(dir, file2) {
|
|
164011
164011
|
var ext = this.ext;
|
|
164012
164012
|
var path19 = join25(dir, file2);
|
|
164013
164013
|
var stat2 = tryStat(path19);
|
|
@@ -164333,12 +164333,12 @@ var require_ipaddr = __commonJS((exports, module) => {
|
|
|
164333
164333
|
return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/, "::");
|
|
164334
164334
|
};
|
|
164335
164335
|
IPv6.prototype.toRFC5952String = function() {
|
|
164336
|
-
var bestMatchIndex, bestMatchLength, match,
|
|
164337
|
-
|
|
164336
|
+
var bestMatchIndex, bestMatchLength, match, regex2, string4;
|
|
164337
|
+
regex2 = /((^|:)(0(:|$)){2,})/g;
|
|
164338
164338
|
string4 = this.toNormalizedString();
|
|
164339
164339
|
bestMatchIndex = 0;
|
|
164340
164340
|
bestMatchLength = -1;
|
|
164341
|
-
while (match =
|
|
164341
|
+
while (match = regex2.exec(string4)) {
|
|
164342
164342
|
if (match[0].length > bestMatchLength) {
|
|
164343
164343
|
bestMatchIndex = match.index;
|
|
164344
164344
|
bestMatchLength = match[0].length;
|
|
@@ -166166,7 +166166,7 @@ var require_application = __commonJS((exports, module) => {
|
|
|
166166
166166
|
var compileETag = require_utils10().compileETag;
|
|
166167
166167
|
var compileQueryParser = require_utils10().compileQueryParser;
|
|
166168
166168
|
var compileTrust = require_utils10().compileTrust;
|
|
166169
|
-
var
|
|
166169
|
+
var resolve12 = __require("node:path").resolve;
|
|
166170
166170
|
var once9 = require_once();
|
|
166171
166171
|
var Router = require_router();
|
|
166172
166172
|
var slice = Array.prototype.slice;
|
|
@@ -166220,7 +166220,7 @@ var require_application = __commonJS((exports, module) => {
|
|
|
166220
166220
|
this.mountpath = "/";
|
|
166221
166221
|
this.locals.settings = this.settings;
|
|
166222
166222
|
this.set("view", View);
|
|
166223
|
-
this.set("views",
|
|
166223
|
+
this.set("views", resolve12("views"));
|
|
166224
166224
|
this.set("jsonp callback name", "callback");
|
|
166225
166225
|
if (env3 === "production") {
|
|
166226
166226
|
this.enable("view cache");
|
|
@@ -167711,7 +167711,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
167711
167711
|
var extname2 = path18.extname;
|
|
167712
167712
|
var join25 = path18.join;
|
|
167713
167713
|
var normalize2 = path18.normalize;
|
|
167714
|
-
var
|
|
167714
|
+
var resolve12 = path18.resolve;
|
|
167715
167715
|
var sep = path18.sep;
|
|
167716
167716
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
167717
167717
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1000;
|
|
@@ -167740,7 +167740,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
167740
167740
|
this._maxage = opts.maxAge || opts.maxage;
|
|
167741
167741
|
this._maxage = typeof this._maxage === "string" ? ms8(this._maxage) : Number(this._maxage);
|
|
167742
167742
|
this._maxage = !isNaN(this._maxage) ? Math.min(Math.max(0, this._maxage), MAX_MAXAGE) : 0;
|
|
167743
|
-
this._root = opts.root ?
|
|
167743
|
+
this._root = opts.root ? resolve12(opts.root) : null;
|
|
167744
167744
|
}
|
|
167745
167745
|
util2.inherits(SendStream, Stream2);
|
|
167746
167746
|
SendStream.prototype.error = function error48(status, err) {
|
|
@@ -167889,7 +167889,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
167889
167889
|
return res;
|
|
167890
167890
|
}
|
|
167891
167891
|
parts = normalize2(path19).split(sep);
|
|
167892
|
-
path19 =
|
|
167892
|
+
path19 = resolve12(path19);
|
|
167893
167893
|
}
|
|
167894
167894
|
if (containsDotFile(parts)) {
|
|
167895
167895
|
debug('%s dotfile "%s"', this._dotfiles, path19);
|
|
@@ -168217,7 +168217,7 @@ var require_response = __commonJS((exports, module) => {
|
|
|
168217
168217
|
var cookie = require_cookie();
|
|
168218
168218
|
var send = require_send();
|
|
168219
168219
|
var extname2 = path18.extname;
|
|
168220
|
-
var
|
|
168220
|
+
var resolve12 = path18.resolve;
|
|
168221
168221
|
var vary = require_vary();
|
|
168222
168222
|
var { Buffer: Buffer7 } = __require("node:buffer");
|
|
168223
168223
|
var res = Object.create(http.ServerResponse.prototype);
|
|
@@ -168426,7 +168426,7 @@ var require_response = __commonJS((exports, module) => {
|
|
|
168426
168426
|
}
|
|
168427
168427
|
opts = Object.create(opts);
|
|
168428
168428
|
opts.headers = headers;
|
|
168429
|
-
var fullPath = !opts.root ?
|
|
168429
|
+
var fullPath = !opts.root ? resolve12(path19) : path19;
|
|
168430
168430
|
return this.sendFile(fullPath, opts, done);
|
|
168431
168431
|
};
|
|
168432
168432
|
res.contentType = res.type = function contentType(type) {
|
|
@@ -168687,7 +168687,7 @@ var require_serve_static = __commonJS((exports, module) => {
|
|
|
168687
168687
|
var encodeUrl = require_encodeurl();
|
|
168688
168688
|
var escapeHtml = require_escape_html();
|
|
168689
168689
|
var parseUrl = require_parseurl();
|
|
168690
|
-
var
|
|
168690
|
+
var resolve12 = __require("path").resolve;
|
|
168691
168691
|
var send = require_send();
|
|
168692
168692
|
var url3 = __require("url");
|
|
168693
168693
|
module.exports = serveStatic;
|
|
@@ -168706,7 +168706,7 @@ var require_serve_static = __commonJS((exports, module) => {
|
|
|
168706
168706
|
throw new TypeError("option setHeaders must be function");
|
|
168707
168707
|
}
|
|
168708
168708
|
opts.maxage = opts.maxage || opts.maxAge || 0;
|
|
168709
|
-
opts.root =
|
|
168709
|
+
opts.root = resolve12(root2);
|
|
168710
168710
|
var onDirectory = redirect ? createRedirectDirectoryListener() : createNotFoundDirectoryListener();
|
|
168711
168711
|
return function serveStatic2(req, res, next) {
|
|
168712
168712
|
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
@@ -169656,10 +169656,10 @@ var require_follow_redirects = __commonJS((exports, module) => {
|
|
|
169656
169656
|
spread.path = spread.search ? spread.pathname + spread.search : spread.pathname;
|
|
169657
169657
|
return spread;
|
|
169658
169658
|
}
|
|
169659
|
-
function removeMatchingHeaders(
|
|
169659
|
+
function removeMatchingHeaders(regex2, headers) {
|
|
169660
169660
|
var lastValue;
|
|
169661
169661
|
for (var header2 in headers) {
|
|
169662
|
-
if (
|
|
169662
|
+
if (regex2.test(header2)) {
|
|
169663
169663
|
lastValue = headers[header2];
|
|
169664
169664
|
delete headers[header2];
|
|
169665
169665
|
}
|
|
@@ -172080,8 +172080,8 @@ var require_executor = __commonJS((exports, module) => {
|
|
|
172080
172080
|
}
|
|
172081
172081
|
resetBuffer() {
|
|
172082
172082
|
this.buffer = new Waterfall;
|
|
172083
|
-
this.buffer.chain(new Promise((
|
|
172084
|
-
this._triggerBuffer =
|
|
172083
|
+
this.buffer.chain(new Promise((resolve12) => {
|
|
172084
|
+
this._triggerBuffer = resolve12;
|
|
172085
172085
|
}));
|
|
172086
172086
|
if (this.ready)
|
|
172087
172087
|
this._triggerBuffer();
|
|
@@ -173101,7 +173101,7 @@ var require_storage = __commonJS((exports, module) => {
|
|
|
173101
173101
|
throw e8;
|
|
173102
173102
|
}
|
|
173103
173103
|
};
|
|
173104
|
-
var writeFileLinesAsync = (filename, lines, mode = DEFAULT_FILE_MODE) => new Promise((
|
|
173104
|
+
var writeFileLinesAsync = (filename, lines, mode = DEFAULT_FILE_MODE) => new Promise((resolve12, reject) => {
|
|
173105
173105
|
try {
|
|
173106
173106
|
const stream = writeFileStream(filename, { mode });
|
|
173107
173107
|
const readable2 = Readable6.from(lines);
|
|
@@ -173118,7 +173118,7 @@ var require_storage = __commonJS((exports, module) => {
|
|
|
173118
173118
|
if (err)
|
|
173119
173119
|
reject(err);
|
|
173120
173120
|
else
|
|
173121
|
-
|
|
173121
|
+
resolve12();
|
|
173122
173122
|
});
|
|
173123
173123
|
});
|
|
173124
173124
|
readable2.on("error", (err) => {
|
|
@@ -173289,7 +173289,7 @@ var require_persistence = __commonJS((exports, module) => {
|
|
|
173289
173289
|
return { data: tdata, indexes };
|
|
173290
173290
|
}
|
|
173291
173291
|
treatRawStreamAsync(rawStream) {
|
|
173292
|
-
return new Promise((
|
|
173292
|
+
return new Promise((resolve12, reject) => {
|
|
173293
173293
|
const dataById = {};
|
|
173294
173294
|
const indexes = {};
|
|
173295
173295
|
let corruptItems = 0;
|
|
@@ -173332,7 +173332,7 @@ var require_persistence = __commonJS((exports, module) => {
|
|
|
173332
173332
|
}
|
|
173333
173333
|
}
|
|
173334
173334
|
const data = Object.values(dataById);
|
|
173335
|
-
|
|
173335
|
+
resolve12({ data, indexes });
|
|
173336
173336
|
});
|
|
173337
173337
|
lineStream.on("error", function(err) {
|
|
173338
173338
|
reject(err, null);
|
|
@@ -198943,13 +198943,13 @@ var require_broadcast_operator = __commonJS((exports) => {
|
|
|
198943
198943
|
return true;
|
|
198944
198944
|
}
|
|
198945
198945
|
emitWithAck(ev2, ...args) {
|
|
198946
|
-
return new Promise((
|
|
198946
|
+
return new Promise((resolve12, reject) => {
|
|
198947
198947
|
args.push((err, responses) => {
|
|
198948
198948
|
if (err) {
|
|
198949
198949
|
err.responses = responses;
|
|
198950
198950
|
return reject(err);
|
|
198951
198951
|
} else {
|
|
198952
|
-
return
|
|
198952
|
+
return resolve12(responses);
|
|
198953
198953
|
}
|
|
198954
198954
|
});
|
|
198955
198955
|
this.emit(ev2, ...args);
|
|
@@ -199137,12 +199137,12 @@ var require_socket2 = __commonJS((exports) => {
|
|
|
199137
199137
|
}
|
|
199138
199138
|
emitWithAck(ev2, ...args) {
|
|
199139
199139
|
const withErr = this.flags.timeout !== undefined;
|
|
199140
|
-
return new Promise((
|
|
199140
|
+
return new Promise((resolve12, reject) => {
|
|
199141
199141
|
args.push((arg1, arg2) => {
|
|
199142
199142
|
if (withErr) {
|
|
199143
|
-
return arg1 ? reject(arg1) :
|
|
199143
|
+
return arg1 ? reject(arg1) : resolve12(arg2);
|
|
199144
199144
|
} else {
|
|
199145
|
-
return
|
|
199145
|
+
return resolve12(arg1);
|
|
199146
199146
|
}
|
|
199147
199147
|
});
|
|
199148
199148
|
this.emit(ev2, ...args);
|
|
@@ -199597,13 +199597,13 @@ var require_namespace = __commonJS((exports) => {
|
|
|
199597
199597
|
return true;
|
|
199598
199598
|
}
|
|
199599
199599
|
serverSideEmitWithAck(ev2, ...args) {
|
|
199600
|
-
return new Promise((
|
|
199600
|
+
return new Promise((resolve12, reject) => {
|
|
199601
199601
|
args.push((err, responses) => {
|
|
199602
199602
|
if (err) {
|
|
199603
199603
|
err.responses = responses;
|
|
199604
199604
|
return reject(err);
|
|
199605
199605
|
} else {
|
|
199606
|
-
return
|
|
199606
|
+
return resolve12(responses);
|
|
199607
199607
|
}
|
|
199608
199608
|
});
|
|
199609
199609
|
this.serverSideEmit(ev2, ...args);
|
|
@@ -200287,7 +200287,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
200287
200287
|
return localSockets;
|
|
200288
200288
|
}
|
|
200289
200289
|
const requestId = randomId();
|
|
200290
|
-
return new Promise((
|
|
200290
|
+
return new Promise((resolve12, reject) => {
|
|
200291
200291
|
const timeout3 = setTimeout(() => {
|
|
200292
200292
|
const storedRequest2 = this.requests.get(requestId);
|
|
200293
200293
|
if (storedRequest2) {
|
|
@@ -200297,7 +200297,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
200297
200297
|
}, opts.flags.timeout || DEFAULT_TIMEOUT);
|
|
200298
200298
|
const storedRequest = {
|
|
200299
200299
|
type: MessageType.FETCH_SOCKETS,
|
|
200300
|
-
resolve:
|
|
200300
|
+
resolve: resolve12,
|
|
200301
200301
|
timeout: timeout3,
|
|
200302
200302
|
current: 0,
|
|
200303
200303
|
expected: expectedResponseCount,
|
|
@@ -200507,7 +200507,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
200507
200507
|
return localSockets;
|
|
200508
200508
|
}
|
|
200509
200509
|
const requestId = randomId();
|
|
200510
|
-
return new Promise((
|
|
200510
|
+
return new Promise((resolve12, reject) => {
|
|
200511
200511
|
const timeout3 = setTimeout(() => {
|
|
200512
200512
|
const storedRequest2 = this.customRequests.get(requestId);
|
|
200513
200513
|
if (storedRequest2) {
|
|
@@ -200517,7 +200517,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
200517
200517
|
}, opts.flags.timeout || DEFAULT_TIMEOUT);
|
|
200518
200518
|
const storedRequest = {
|
|
200519
200519
|
type: MessageType.FETCH_SOCKETS,
|
|
200520
|
-
resolve:
|
|
200520
|
+
resolve: resolve12,
|
|
200521
200521
|
timeout: timeout3,
|
|
200522
200522
|
missingUids: new Set([...this.nodesMap.keys()]),
|
|
200523
200523
|
responses: localSockets
|
|
@@ -201219,9 +201219,9 @@ var require_dist4 = __commonJS((exports, module) => {
|
|
|
201219
201219
|
name2 = "/" + name2;
|
|
201220
201220
|
let nsp = this._nsps.get(name2);
|
|
201221
201221
|
if (!nsp) {
|
|
201222
|
-
for (const [
|
|
201223
|
-
if (
|
|
201224
|
-
debug("attaching namespace %s to parent namespace %s", name2,
|
|
201222
|
+
for (const [regex2, parentNamespace] of this.parentNamespacesFromRegExp) {
|
|
201223
|
+
if (regex2.test(name2)) {
|
|
201224
|
+
debug("attaching namespace %s to parent namespace %s", name2, regex2);
|
|
201225
201225
|
return parentNamespace.createChild(name2);
|
|
201226
201226
|
}
|
|
201227
201227
|
}
|
|
@@ -201246,13 +201246,13 @@ var require_dist4 = __commonJS((exports, module) => {
|
|
|
201246
201246
|
this.engine.close();
|
|
201247
201247
|
(0, uws_1.restoreAdapter)();
|
|
201248
201248
|
if (this.httpServer) {
|
|
201249
|
-
return new Promise((
|
|
201249
|
+
return new Promise((resolve12) => {
|
|
201250
201250
|
this.httpServer.close((err) => {
|
|
201251
201251
|
fn9 && fn9(err);
|
|
201252
201252
|
if (err) {
|
|
201253
201253
|
debug("server was not running");
|
|
201254
201254
|
}
|
|
201255
|
-
|
|
201255
|
+
resolve12();
|
|
201256
201256
|
});
|
|
201257
201257
|
});
|
|
201258
201258
|
} else {
|
|
@@ -215914,14 +215914,14 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
215914
215914
|
};
|
|
215915
215915
|
}
|
|
215916
215916
|
function readAndResolve(iter) {
|
|
215917
|
-
var
|
|
215918
|
-
if (
|
|
215917
|
+
var resolve12 = iter[kLastResolve];
|
|
215918
|
+
if (resolve12 !== null) {
|
|
215919
215919
|
var data = iter[kStream].read();
|
|
215920
215920
|
if (data !== null) {
|
|
215921
215921
|
iter[kLastPromise] = null;
|
|
215922
215922
|
iter[kLastResolve] = null;
|
|
215923
215923
|
iter[kLastReject] = null;
|
|
215924
|
-
|
|
215924
|
+
resolve12(createIterResult(data, false));
|
|
215925
215925
|
}
|
|
215926
215926
|
}
|
|
215927
215927
|
}
|
|
@@ -215929,13 +215929,13 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
215929
215929
|
process.nextTick(readAndResolve, iter);
|
|
215930
215930
|
}
|
|
215931
215931
|
function wrapForNext(lastPromise, iter) {
|
|
215932
|
-
return function(
|
|
215932
|
+
return function(resolve12, reject) {
|
|
215933
215933
|
lastPromise.then(function() {
|
|
215934
215934
|
if (iter[kEnded]) {
|
|
215935
|
-
|
|
215935
|
+
resolve12(createIterResult(undefined, true));
|
|
215936
215936
|
return;
|
|
215937
215937
|
}
|
|
215938
|
-
iter[kHandlePromise](
|
|
215938
|
+
iter[kHandlePromise](resolve12, reject);
|
|
215939
215939
|
}, reject);
|
|
215940
215940
|
};
|
|
215941
215941
|
}
|
|
@@ -215954,12 +215954,12 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
215954
215954
|
return Promise.resolve(createIterResult(undefined, true));
|
|
215955
215955
|
}
|
|
215956
215956
|
if (this[kStream].destroyed) {
|
|
215957
|
-
return new Promise(function(
|
|
215957
|
+
return new Promise(function(resolve12, reject) {
|
|
215958
215958
|
process.nextTick(function() {
|
|
215959
215959
|
if (_this[kError]) {
|
|
215960
215960
|
reject(_this[kError]);
|
|
215961
215961
|
} else {
|
|
215962
|
-
|
|
215962
|
+
resolve12(createIterResult(undefined, true));
|
|
215963
215963
|
}
|
|
215964
215964
|
});
|
|
215965
215965
|
});
|
|
@@ -215982,13 +215982,13 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
215982
215982
|
return this;
|
|
215983
215983
|
}), _defineProperty(_Object$setPrototypeO, "return", function _return() {
|
|
215984
215984
|
var _this2 = this;
|
|
215985
|
-
return new Promise(function(
|
|
215985
|
+
return new Promise(function(resolve12, reject) {
|
|
215986
215986
|
_this2[kStream].destroy(null, function(err) {
|
|
215987
215987
|
if (err) {
|
|
215988
215988
|
reject(err);
|
|
215989
215989
|
return;
|
|
215990
215990
|
}
|
|
215991
|
-
|
|
215991
|
+
resolve12(createIterResult(undefined, true));
|
|
215992
215992
|
});
|
|
215993
215993
|
});
|
|
215994
215994
|
}), _Object$setPrototypeO), AsyncIteratorPrototype);
|
|
@@ -216010,15 +216010,15 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
216010
216010
|
value: stream._readableState.endEmitted,
|
|
216011
216011
|
writable: true
|
|
216012
216012
|
}), _defineProperty(_Object$create, kHandlePromise, {
|
|
216013
|
-
value: function value(
|
|
216013
|
+
value: function value(resolve12, reject) {
|
|
216014
216014
|
var data = iterator[kStream].read();
|
|
216015
216015
|
if (data) {
|
|
216016
216016
|
iterator[kLastPromise] = null;
|
|
216017
216017
|
iterator[kLastResolve] = null;
|
|
216018
216018
|
iterator[kLastReject] = null;
|
|
216019
|
-
|
|
216019
|
+
resolve12(createIterResult(data, false));
|
|
216020
216020
|
} else {
|
|
216021
|
-
iterator[kLastResolve] =
|
|
216021
|
+
iterator[kLastResolve] = resolve12;
|
|
216022
216022
|
iterator[kLastReject] = reject;
|
|
216023
216023
|
}
|
|
216024
216024
|
},
|
|
@@ -216037,12 +216037,12 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
216037
216037
|
iterator[kError] = err;
|
|
216038
216038
|
return;
|
|
216039
216039
|
}
|
|
216040
|
-
var
|
|
216041
|
-
if (
|
|
216040
|
+
var resolve12 = iterator[kLastResolve];
|
|
216041
|
+
if (resolve12 !== null) {
|
|
216042
216042
|
iterator[kLastPromise] = null;
|
|
216043
216043
|
iterator[kLastResolve] = null;
|
|
216044
216044
|
iterator[kLastReject] = null;
|
|
216045
|
-
|
|
216045
|
+
resolve12(createIterResult(undefined, true));
|
|
216046
216046
|
}
|
|
216047
216047
|
iterator[kEnded] = true;
|
|
216048
216048
|
});
|
|
@@ -216054,7 +216054,7 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
216054
216054
|
|
|
216055
216055
|
// ../../node_modules/readable-stream/lib/internal/streams/from.js
|
|
216056
216056
|
var require_from = __commonJS((exports, module) => {
|
|
216057
|
-
function asyncGeneratorStep(gen,
|
|
216057
|
+
function asyncGeneratorStep(gen, resolve12, reject, _next, _throw, key2, arg) {
|
|
216058
216058
|
try {
|
|
216059
216059
|
var info = gen[key2](arg);
|
|
216060
216060
|
var value = info.value;
|
|
@@ -216063,7 +216063,7 @@ var require_from = __commonJS((exports, module) => {
|
|
|
216063
216063
|
return;
|
|
216064
216064
|
}
|
|
216065
216065
|
if (info.done) {
|
|
216066
|
-
|
|
216066
|
+
resolve12(value);
|
|
216067
216067
|
} else {
|
|
216068
216068
|
Promise.resolve(value).then(_next, _throw);
|
|
216069
216069
|
}
|
|
@@ -216071,13 +216071,13 @@ var require_from = __commonJS((exports, module) => {
|
|
|
216071
216071
|
function _asyncToGenerator(fn9) {
|
|
216072
216072
|
return function() {
|
|
216073
216073
|
var self2 = this, args = arguments;
|
|
216074
|
-
return new Promise(function(
|
|
216074
|
+
return new Promise(function(resolve12, reject) {
|
|
216075
216075
|
var gen = fn9.apply(self2, args);
|
|
216076
216076
|
function _next(value) {
|
|
216077
|
-
asyncGeneratorStep(gen,
|
|
216077
|
+
asyncGeneratorStep(gen, resolve12, reject, _next, _throw, "next", value);
|
|
216078
216078
|
}
|
|
216079
216079
|
function _throw(err) {
|
|
216080
|
-
asyncGeneratorStep(gen,
|
|
216080
|
+
asyncGeneratorStep(gen, resolve12, reject, _next, _throw, "throw", err);
|
|
216081
216081
|
}
|
|
216082
216082
|
_next(undefined);
|
|
216083
216083
|
});
|
|
@@ -218285,6 +218285,7 @@ var PROJECT_CONFIG_PATTERNS = [
|
|
|
218285
218285
|
`${PROJECT_SUBDIR}/config.${CONFIG_FILE_EXTENSION_GLOB}`,
|
|
218286
218286
|
`config.${CONFIG_FILE_EXTENSION_GLOB}`
|
|
218287
218287
|
];
|
|
218288
|
+
var BASE44_APP_ID_ENV_VAR = "BASE44_APP_ID";
|
|
218288
218289
|
var TYPES_OUTPUT_SUBDIR = ".types";
|
|
218289
218290
|
var TYPES_FILENAME = "types.d.ts";
|
|
218290
218291
|
var AUTH_CLIENT_ID = "base44_cli";
|
|
@@ -233980,7 +233981,7 @@ async function parseEnvFile(filePath) {
|
|
|
233980
233981
|
}
|
|
233981
233982
|
var STRIPE_ENV_PREFIX = "BASE44_PROJECTS_";
|
|
233982
233983
|
var BASE44_ENV_KEYS = [
|
|
233983
|
-
|
|
233984
|
+
BASE44_APP_ID_ENV_VAR,
|
|
233984
233985
|
"BASE44_ACCESS_TOKEN",
|
|
233985
233986
|
"BASE44_REFRESH_TOKEN",
|
|
233986
233987
|
"BASE44_API_URL"
|
|
@@ -234017,7 +234018,7 @@ function normalizeBase44Env() {
|
|
|
234017
234018
|
loadProjectEnvFiles();
|
|
234018
234019
|
|
|
234019
234020
|
// src/cli/index.ts
|
|
234020
|
-
import { dirname as dirname23, join as
|
|
234021
|
+
import { dirname as dirname23, join as join28 } from "node:path";
|
|
234021
234022
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
234022
234023
|
|
|
234023
234024
|
// ../../node_modules/@clack/core/dist/index.mjs
|
|
@@ -235839,6 +235840,24 @@ var BANNER_LINES = [
|
|
|
235839
235840
|
async function printBanner() {
|
|
235840
235841
|
await printAnimatedLines(BANNER_LINES);
|
|
235841
235842
|
}
|
|
235843
|
+
// ../../node_modules/ansi-regex/index.js
|
|
235844
|
+
function ansiRegex({ onlyFirst = false } = {}) {
|
|
235845
|
+
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
235846
|
+
const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`;
|
|
235847
|
+
const csi = "[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";
|
|
235848
|
+
const pattern = `${osc}|${csi}`;
|
|
235849
|
+
return new RegExp(pattern, onlyFirst ? undefined : "g");
|
|
235850
|
+
}
|
|
235851
|
+
|
|
235852
|
+
// ../../node_modules/strip-ansi/index.js
|
|
235853
|
+
var regex = ansiRegex();
|
|
235854
|
+
function stripAnsi(string4) {
|
|
235855
|
+
if (typeof string4 !== "string") {
|
|
235856
|
+
throw new TypeError(`Expected a \`string\`, got \`${typeof string4}\``);
|
|
235857
|
+
}
|
|
235858
|
+
return string4.replace(regex, "");
|
|
235859
|
+
}
|
|
235860
|
+
|
|
235842
235861
|
// ../../node_modules/p-wait-for/index.js
|
|
235843
235862
|
var resolveValue = Symbol("resolveValue");
|
|
235844
235863
|
var sleep2 = (ms, signal) => new Promise((resolve, reject) => {
|
|
@@ -241694,18 +241713,35 @@ function loadFromTestOverrides() {
|
|
|
241694
241713
|
}
|
|
241695
241714
|
return null;
|
|
241696
241715
|
}
|
|
241697
|
-
async function initAppContext() {
|
|
241716
|
+
async function initAppContext(options = {}) {
|
|
241698
241717
|
const testConfig = loadFromTestOverrides();
|
|
241699
241718
|
if (testConfig) {
|
|
241700
241719
|
cache2 = testConfig;
|
|
241701
241720
|
return cache2;
|
|
241702
241721
|
}
|
|
241722
|
+
const projectRoot = findProjectRoot();
|
|
241723
|
+
if (options.appId !== undefined) {
|
|
241724
|
+
const id = options.appId.trim();
|
|
241725
|
+
if (!id) {
|
|
241726
|
+
throw new InvalidInputError("App id cannot be empty.");
|
|
241727
|
+
}
|
|
241728
|
+
cache2 = { id };
|
|
241729
|
+
return cache2;
|
|
241730
|
+
}
|
|
241703
241731
|
if (cache2) {
|
|
241704
241732
|
return cache2;
|
|
241705
241733
|
}
|
|
241706
|
-
const projectRoot = findProjectRoot();
|
|
241707
241734
|
if (!projectRoot) {
|
|
241708
|
-
throw new ConfigNotFoundError(
|
|
241735
|
+
throw new ConfigNotFoundError(`No Base44 app ID found. Pass --app-id, set ${BASE44_APP_ID_ENV_VAR}, or run this command from a linked project with base44/.app.jsonc.`, {
|
|
241736
|
+
hints: [
|
|
241737
|
+
{ message: "Pass an app ID explicitly with --app-id <id>" },
|
|
241738
|
+
{ message: `Set ${BASE44_APP_ID_ENV_VAR} in your environment` },
|
|
241739
|
+
{
|
|
241740
|
+
message: "Run from a linked Base44 project with base44/.app.jsonc, or run 'base44 link'",
|
|
241741
|
+
command: "base44 link"
|
|
241742
|
+
}
|
|
241743
|
+
]
|
|
241744
|
+
});
|
|
241709
241745
|
}
|
|
241710
241746
|
const config3 = await readAppConfig(projectRoot.root);
|
|
241711
241747
|
const appConfigPath = await findAppConfigPath(projectRoot.root);
|
|
@@ -243408,7 +243444,7 @@ var ListFunctionsResponseSchema = exports_external.object({
|
|
|
243408
243444
|
var LogLevelSchema = exports_external.enum(["info", "warning", "error", "debug"]);
|
|
243409
243445
|
var FunctionLogEntrySchema = exports_external.object({
|
|
243410
243446
|
time: exports_external.string(),
|
|
243411
|
-
level: LogLevelSchema,
|
|
243447
|
+
level: exports_external.preprocess((v) => v === "warn" ? "warning" : !v || v === "log" ? "info" : v, LogLevelSchema),
|
|
243412
243448
|
message: exports_external.string()
|
|
243413
243449
|
});
|
|
243414
243450
|
var FunctionLogsResponseSchema = exports_external.array(FunctionLogEntrySchema);
|
|
@@ -243873,7 +243909,7 @@ import { join as join11 } from "node:path";
|
|
|
243873
243909
|
// package.json
|
|
243874
243910
|
var package_default = {
|
|
243875
243911
|
name: "base44",
|
|
243876
|
-
version: "0.0.
|
|
243912
|
+
version: "0.0.56",
|
|
243877
243913
|
description: "Base44 CLI - Unified interface for managing Base44 applications",
|
|
243878
243914
|
type: "module",
|
|
243879
243915
|
bin: {
|
|
@@ -244267,7 +244303,7 @@ async function generateDeviceCode() {
|
|
|
244267
244303
|
const response = await oauthClient.post("oauth/device/code", {
|
|
244268
244304
|
json: {
|
|
244269
244305
|
client_id: AUTH_CLIENT_ID,
|
|
244270
|
-
scope: "apps:read apps:write"
|
|
244306
|
+
scope: "apps:read apps:write sandbox:write"
|
|
244271
244307
|
},
|
|
244272
244308
|
throwHttpErrors: false
|
|
244273
244309
|
});
|
|
@@ -244438,8 +244474,8 @@ async function ensureAuth(ctx) {
|
|
|
244438
244474
|
});
|
|
244439
244475
|
} catch {}
|
|
244440
244476
|
}
|
|
244441
|
-
async function ensureAppContext(ctx) {
|
|
244442
|
-
const appContext = await initAppContext();
|
|
244477
|
+
async function ensureAppContext(ctx, options = {}) {
|
|
244478
|
+
const appContext = await initAppContext(options);
|
|
244443
244479
|
ctx.app = appContext;
|
|
244444
244480
|
ctx.errorReporter.setContext({ appId: appContext.id });
|
|
244445
244481
|
}
|
|
@@ -251073,6 +251109,35 @@ function showPlainError(error48) {
|
|
|
251073
251109
|
}
|
|
251074
251110
|
|
|
251075
251111
|
// src/cli/utils/command/Base44Command.ts
|
|
251112
|
+
function writeJsonSuccess(result) {
|
|
251113
|
+
if (result.stdout) {
|
|
251114
|
+
if (result.outroMessage) {
|
|
251115
|
+
process.stderr.write(`${result.outroMessage}
|
|
251116
|
+
`);
|
|
251117
|
+
}
|
|
251118
|
+
process.stdout.write(result.stdout);
|
|
251119
|
+
return;
|
|
251120
|
+
}
|
|
251121
|
+
process.stdout.write(`${JSON.stringify({ output: stripAnsi(result.outroMessage ?? "") })}
|
|
251122
|
+
`);
|
|
251123
|
+
}
|
|
251124
|
+
function writeJsonError(error48) {
|
|
251125
|
+
const envelope = {
|
|
251126
|
+
error: error48 instanceof Error ? error48.message : String(error48)
|
|
251127
|
+
};
|
|
251128
|
+
if (isCLIError(error48)) {
|
|
251129
|
+
envelope.code = error48.code;
|
|
251130
|
+
if (error48.details.length > 0) {
|
|
251131
|
+
envelope.details = error48.details;
|
|
251132
|
+
}
|
|
251133
|
+
if (error48.hints.length > 0) {
|
|
251134
|
+
envelope.hints = error48.hints;
|
|
251135
|
+
}
|
|
251136
|
+
}
|
|
251137
|
+
process.stdout.write(`${JSON.stringify(envelope)}
|
|
251138
|
+
`);
|
|
251139
|
+
}
|
|
251140
|
+
|
|
251076
251141
|
class Base44Command extends Command {
|
|
251077
251142
|
_context;
|
|
251078
251143
|
_commandOptions;
|
|
@@ -251095,7 +251160,8 @@ class Base44Command extends Command {
|
|
|
251095
251160
|
}
|
|
251096
251161
|
action(fn) {
|
|
251097
251162
|
return super.action(async (...args) => {
|
|
251098
|
-
const
|
|
251163
|
+
const jsonMode = this.context.jsonMode;
|
|
251164
|
+
const quiet = this.context.isNonInteractive || jsonMode;
|
|
251099
251165
|
if (!quiet) {
|
|
251100
251166
|
await showCommandStart(this._commandOptions.fullBanner);
|
|
251101
251167
|
}
|
|
@@ -251105,11 +251171,19 @@ class Base44Command extends Command {
|
|
|
251105
251171
|
await ensureAuth(this.context);
|
|
251106
251172
|
}
|
|
251107
251173
|
if (this._commandOptions.requireAppContext) {
|
|
251108
|
-
|
|
251174
|
+
const { appId } = this.optsWithGlobals();
|
|
251175
|
+
await ensureAppContext(this.context, { appId });
|
|
251109
251176
|
}
|
|
251110
251177
|
const result = await fn(this.context, ...args) ?? {};
|
|
251111
251178
|
if (!quiet) {
|
|
251112
251179
|
await showCommandEnd(result, upgradeCheckPromise, this.context.distribution);
|
|
251180
|
+
} else if (jsonMode) {
|
|
251181
|
+
writeJsonSuccess(result);
|
|
251182
|
+
const upgradeInfo = await upgradeCheckPromise;
|
|
251183
|
+
if (upgradeInfo) {
|
|
251184
|
+
process.stderr.write(`${formatPlainUpgradeMessage(upgradeInfo, this.context.distribution)}
|
|
251185
|
+
`);
|
|
251186
|
+
}
|
|
251113
251187
|
} else {
|
|
251114
251188
|
if (result.outroMessage) {
|
|
251115
251189
|
process.stdout.write(`${result.outroMessage}
|
|
@@ -251125,7 +251199,9 @@ class Base44Command extends Command {
|
|
|
251125
251199
|
}
|
|
251126
251200
|
}
|
|
251127
251201
|
} catch (error48) {
|
|
251128
|
-
if (
|
|
251202
|
+
if (jsonMode) {
|
|
251203
|
+
writeJsonError(error48);
|
|
251204
|
+
} else if (quiet) {
|
|
251129
251205
|
showPlainError(error48);
|
|
251130
251206
|
} else {
|
|
251131
251207
|
showThemedError(error48, this.context);
|
|
@@ -251816,73 +251892,6 @@ function getWhoamiCommand() {
|
|
|
251816
251892
|
return new Base44Command("whoami", { requireAppContext: false }).description("Display current authenticated user").action(whoami);
|
|
251817
251893
|
}
|
|
251818
251894
|
|
|
251819
|
-
// src/cli/commands/connectors/list-available.ts
|
|
251820
|
-
async function listAvailableAction({
|
|
251821
|
-
log,
|
|
251822
|
-
runTask: runTask2
|
|
251823
|
-
}) {
|
|
251824
|
-
const { integrations } = await runTask2("Fetching available integrations from Base44", async () => {
|
|
251825
|
-
return await listAvailableIntegrations();
|
|
251826
|
-
}, {
|
|
251827
|
-
successMessage: "Available integrations fetched successfully",
|
|
251828
|
-
errorMessage: "Failed to fetch available integrations"
|
|
251829
|
-
});
|
|
251830
|
-
if (integrations.length === 0) {
|
|
251831
|
-
return { outroMessage: "No available integrations found." };
|
|
251832
|
-
}
|
|
251833
|
-
for (const { displayName, ...rest } of integrations) {
|
|
251834
|
-
const yaml2 = formatYaml(rest);
|
|
251835
|
-
const pad = " ".repeat(YAML_INDENT);
|
|
251836
|
-
log.info(`${displayName}
|
|
251837
|
-
${pad}${yaml2.replace(/\n/g, `
|
|
251838
|
-
${pad}`)}`);
|
|
251839
|
-
}
|
|
251840
|
-
return {
|
|
251841
|
-
outroMessage: `Found ${integrations.length} available integrations.`
|
|
251842
|
-
};
|
|
251843
|
-
}
|
|
251844
|
-
function getConnectorsListAvailableCommand() {
|
|
251845
|
-
return new Base44Command("list-available").description("List all available integration types").action(listAvailableAction);
|
|
251846
|
-
}
|
|
251847
|
-
|
|
251848
|
-
// src/cli/commands/connectors/pull.ts
|
|
251849
|
-
import { dirname as dirname15, join as join19 } from "node:path";
|
|
251850
|
-
async function pullConnectorsAction({
|
|
251851
|
-
log,
|
|
251852
|
-
runTask: runTask2
|
|
251853
|
-
}) {
|
|
251854
|
-
const { project: project2 } = await readProjectConfig();
|
|
251855
|
-
const configDir = dirname15(project2.configPath);
|
|
251856
|
-
const connectorsDir = join19(configDir, project2.connectorsDir);
|
|
251857
|
-
const remoteConnectors = await runTask2("Fetching connectors from Base44", async () => {
|
|
251858
|
-
return await pullAllConnectors();
|
|
251859
|
-
}, {
|
|
251860
|
-
successMessage: "Connectors fetched successfully",
|
|
251861
|
-
errorMessage: "Failed to fetch connectors"
|
|
251862
|
-
});
|
|
251863
|
-
const { written, deleted } = await runTask2("Syncing connector files", async () => {
|
|
251864
|
-
return await writeConnectors(connectorsDir, remoteConnectors);
|
|
251865
|
-
}, {
|
|
251866
|
-
successMessage: "Connector files synced successfully",
|
|
251867
|
-
errorMessage: "Failed to sync connector files"
|
|
251868
|
-
});
|
|
251869
|
-
if (written.length > 0) {
|
|
251870
|
-
log.success(`Written: ${written.join(", ")}`);
|
|
251871
|
-
}
|
|
251872
|
-
if (deleted.length > 0) {
|
|
251873
|
-
log.warn(`Deleted: ${deleted.join(", ")}`);
|
|
251874
|
-
}
|
|
251875
|
-
if (written.length === 0 && deleted.length === 0) {
|
|
251876
|
-
log.info("All connectors are already up to date");
|
|
251877
|
-
}
|
|
251878
|
-
return {
|
|
251879
|
-
outroMessage: `Pulled ${remoteConnectors.length} connectors to ${connectorsDir}`
|
|
251880
|
-
};
|
|
251881
|
-
}
|
|
251882
|
-
function getConnectorsPullCommand() {
|
|
251883
|
-
return new Base44Command("pull").description("Pull connectors from Base44 to local files (replaces all local connector configs)").action(pullConnectorsAction);
|
|
251884
|
-
}
|
|
251885
|
-
|
|
251886
251895
|
// ../../node_modules/open/index.js
|
|
251887
251896
|
import process20 from "node:process";
|
|
251888
251897
|
import path16 from "node:path";
|
|
@@ -252573,7 +252582,165 @@ async function promptOAuthFlows(pending, log, options) {
|
|
|
252573
252582
|
return outcomes;
|
|
252574
252583
|
}
|
|
252575
252584
|
|
|
252585
|
+
// src/cli/commands/connectors/initiate.ts
|
|
252586
|
+
function parseIntegrationType(value) {
|
|
252587
|
+
const result = IntegrationTypeSchema.safeParse(value);
|
|
252588
|
+
if (!result.success) {
|
|
252589
|
+
throw new InvalidInputError("A valid --integration-type is required (e.g. googlecalendar, gmail, slack).");
|
|
252590
|
+
}
|
|
252591
|
+
return result.data;
|
|
252592
|
+
}
|
|
252593
|
+
function parseScopes(scopes) {
|
|
252594
|
+
return (scopes ?? []).flatMap((s) => s.split(",")).map((s) => s.trim()).filter(Boolean);
|
|
252595
|
+
}
|
|
252596
|
+
async function initiateAction(ctx, options) {
|
|
252597
|
+
const { log, runTask: runTask2, isNonInteractive, jsonMode } = ctx;
|
|
252598
|
+
const integrationType = parseIntegrationType(options.integrationType);
|
|
252599
|
+
const scopes = parseScopes(options.scopes);
|
|
252600
|
+
const response = await runTask2(`Initiating ${integrationType} connector`, () => setConnector(integrationType, scopes), {
|
|
252601
|
+
successMessage: `Connector ${integrationType} initialized`,
|
|
252602
|
+
errorMessage: `Failed to initialize ${integrationType}`
|
|
252603
|
+
});
|
|
252604
|
+
if (response.error) {
|
|
252605
|
+
const detail = response.error === "different_user" && response.otherUserEmail ? ` (already authorized by ${response.otherUserEmail})` : response.errorMessage ? ` (${response.errorMessage})` : "";
|
|
252606
|
+
throw new InvalidInputError(`Could not initiate ${integrationType}: ${response.error}${detail}`);
|
|
252607
|
+
}
|
|
252608
|
+
if (jsonMode) {
|
|
252609
|
+
return {
|
|
252610
|
+
outroMessage: response.alreadyAuthorized ? `${integrationType} already authorized` : `${integrationType} initialized`,
|
|
252611
|
+
stdout: `${JSON.stringify({
|
|
252612
|
+
integrationType,
|
|
252613
|
+
alreadyAuthorized: response.alreadyAuthorized,
|
|
252614
|
+
redirectUrl: response.redirectUrl,
|
|
252615
|
+
connectionId: response.connectionId
|
|
252616
|
+
}, null, 2)}
|
|
252617
|
+
`
|
|
252618
|
+
};
|
|
252619
|
+
}
|
|
252620
|
+
if (response.alreadyAuthorized || !response.redirectUrl) {
|
|
252621
|
+
return {
|
|
252622
|
+
outroMessage: `${integrationType} is already authorized. Run 'base44 connectors pull' to fetch its config.`
|
|
252623
|
+
};
|
|
252624
|
+
}
|
|
252625
|
+
log.info(`Authorize ${integrationType} here: ${theme.colors.links(response.redirectUrl)}`);
|
|
252626
|
+
const pending = {
|
|
252627
|
+
type: integrationType,
|
|
252628
|
+
action: "needs_oauth",
|
|
252629
|
+
redirectUrl: response.redirectUrl,
|
|
252630
|
+
connectionId: response.connectionId ?? undefined
|
|
252631
|
+
};
|
|
252632
|
+
const outcomes = await promptOAuthFlows([pending], log, {
|
|
252633
|
+
skipPrompt: isNonInteractive
|
|
252634
|
+
});
|
|
252635
|
+
if (outcomes.get(integrationType) === "ACTIVE") {
|
|
252636
|
+
return {
|
|
252637
|
+
outroMessage: `${integrationType} authorized. Run 'base44 connectors pull' to fetch its config.`
|
|
252638
|
+
};
|
|
252639
|
+
}
|
|
252640
|
+
return {
|
|
252641
|
+
outroMessage: `${integrationType} initialized. Open the link above to finish authorizing, then run 'base44 connectors pull'.`
|
|
252642
|
+
};
|
|
252643
|
+
}
|
|
252644
|
+
function getConnectorsInitiateCommand() {
|
|
252645
|
+
return new Base44Command("initiate").description("Initialize a connector on an app and start its OAuth flow (works with --app-id, no local project required)").requiredOption("--integration-type <type>", "Integration type to initiate (e.g. googlecalendar, gmail, slack)").option("--scopes <scopes...>", "OAuth scopes to request (space- or comma-separated)").addHelpText("after", `
|
|
252646
|
+
Examples:
|
|
252647
|
+
$ base44 connectors initiate --app-id app_123 --integration-type googlecalendar --scopes https://www.googleapis.com/auth/calendar
|
|
252648
|
+
$ base44 connectors initiate --integration-type gmail --scopes scope.a,scope.b`).action(initiateAction);
|
|
252649
|
+
}
|
|
252650
|
+
|
|
252651
|
+
// src/cli/commands/connectors/list-available.ts
|
|
252652
|
+
async function listAvailableAction({
|
|
252653
|
+
log,
|
|
252654
|
+
runTask: runTask2,
|
|
252655
|
+
jsonMode
|
|
252656
|
+
}) {
|
|
252657
|
+
const { integrations } = await runTask2("Fetching available integrations from Base44", async () => {
|
|
252658
|
+
return await listAvailableIntegrations();
|
|
252659
|
+
}, {
|
|
252660
|
+
successMessage: "Available integrations fetched successfully",
|
|
252661
|
+
errorMessage: "Failed to fetch available integrations"
|
|
252662
|
+
});
|
|
252663
|
+
if (jsonMode) {
|
|
252664
|
+
return {
|
|
252665
|
+
outroMessage: `Found ${integrations.length} available integrations.`,
|
|
252666
|
+
stdout: `${JSON.stringify({ integrations }, null, 2)}
|
|
252667
|
+
`
|
|
252668
|
+
};
|
|
252669
|
+
}
|
|
252670
|
+
if (integrations.length === 0) {
|
|
252671
|
+
return { outroMessage: "No available integrations found." };
|
|
252672
|
+
}
|
|
252673
|
+
for (const { displayName, ...rest } of integrations) {
|
|
252674
|
+
const yaml2 = formatYaml(rest);
|
|
252675
|
+
const pad = " ".repeat(YAML_INDENT);
|
|
252676
|
+
log.info(`${displayName}
|
|
252677
|
+
${pad}${yaml2.replace(/\n/g, `
|
|
252678
|
+
${pad}`)}`);
|
|
252679
|
+
}
|
|
252680
|
+
return {
|
|
252681
|
+
outroMessage: `Found ${integrations.length} available integrations.`
|
|
252682
|
+
};
|
|
252683
|
+
}
|
|
252684
|
+
function getConnectorsListAvailableCommand() {
|
|
252685
|
+
return new Base44Command("list-available").description("List all available integration types").action(listAvailableAction);
|
|
252686
|
+
}
|
|
252687
|
+
|
|
252688
|
+
// src/cli/commands/connectors/pull.ts
|
|
252689
|
+
import { dirname as dirname15, join as join19, resolve as resolve5 } from "node:path";
|
|
252690
|
+
async function resolveConnectorsDir(options) {
|
|
252691
|
+
if (!getAppContext().projectRoot) {
|
|
252692
|
+
return resolve5(options.dir ?? "connectors");
|
|
252693
|
+
}
|
|
252694
|
+
const { project: project2 } = await readProjectConfig();
|
|
252695
|
+
return join19(dirname15(project2.configPath), project2.connectorsDir);
|
|
252696
|
+
}
|
|
252697
|
+
async function pullConnectorsAction({ log, runTask: runTask2, jsonMode }, options) {
|
|
252698
|
+
const connectorsDir = await resolveConnectorsDir(options);
|
|
252699
|
+
const remoteConnectors = await runTask2("Fetching connectors from Base44", async () => {
|
|
252700
|
+
return await pullAllConnectors();
|
|
252701
|
+
}, {
|
|
252702
|
+
successMessage: "Connectors fetched successfully",
|
|
252703
|
+
errorMessage: "Failed to fetch connectors"
|
|
252704
|
+
});
|
|
252705
|
+
const { written, deleted } = await runTask2("Syncing connector files", async () => {
|
|
252706
|
+
return await writeConnectors(connectorsDir, remoteConnectors);
|
|
252707
|
+
}, {
|
|
252708
|
+
successMessage: "Connector files synced successfully",
|
|
252709
|
+
errorMessage: "Failed to sync connector files"
|
|
252710
|
+
});
|
|
252711
|
+
if (jsonMode) {
|
|
252712
|
+
return {
|
|
252713
|
+
outroMessage: `Pulled ${remoteConnectors.length} connectors to ${connectorsDir}`,
|
|
252714
|
+
stdout: `${JSON.stringify({ connectorsDir, pulled: remoteConnectors.length, written, deleted }, null, 2)}
|
|
252715
|
+
`
|
|
252716
|
+
};
|
|
252717
|
+
}
|
|
252718
|
+
if (written.length > 0) {
|
|
252719
|
+
log.success(`Written: ${written.join(", ")}`);
|
|
252720
|
+
}
|
|
252721
|
+
if (deleted.length > 0) {
|
|
252722
|
+
log.warn(`Deleted: ${deleted.join(", ")}`);
|
|
252723
|
+
}
|
|
252724
|
+
if (written.length === 0 && deleted.length === 0) {
|
|
252725
|
+
log.info("All connectors are already up to date");
|
|
252726
|
+
}
|
|
252727
|
+
return {
|
|
252728
|
+
outroMessage: `Pulled ${remoteConnectors.length} connectors to ${connectorsDir}`
|
|
252729
|
+
};
|
|
252730
|
+
}
|
|
252731
|
+
function getConnectorsPullCommand() {
|
|
252732
|
+
return new Base44Command("pull").description("Pull connectors from Base44 to local files (replaces all local connector configs)").option("--dir <path>", "Directory to write connector files to (default: ./connectors when using --app-id)").action(pullConnectorsAction);
|
|
252733
|
+
}
|
|
252734
|
+
|
|
252576
252735
|
// src/cli/commands/connectors/push.ts
|
|
252736
|
+
import { resolve as resolve6 } from "node:path";
|
|
252737
|
+
async function readConnectorsToPush(options) {
|
|
252738
|
+
if (!getAppContext().projectRoot) {
|
|
252739
|
+
return readAllConnectors(resolve6(options.dir ?? "connectors"));
|
|
252740
|
+
}
|
|
252741
|
+
const { connectors } = await readProjectConfig();
|
|
252742
|
+
return connectors;
|
|
252743
|
+
}
|
|
252577
252744
|
function printSummary(results, oauthOutcomes, log) {
|
|
252578
252745
|
const synced = [];
|
|
252579
252746
|
const added = [];
|
|
@@ -252636,17 +252803,15 @@ function printSummary(results, oauthOutcomes, log) {
|
|
|
252636
252803
|
log.error(`Failed: ${r.type} - ${r.error}`);
|
|
252637
252804
|
}
|
|
252638
252805
|
}
|
|
252639
|
-
async function pushConnectorsAction({
|
|
252640
|
-
|
|
252641
|
-
|
|
252642
|
-
|
|
252643
|
-
|
|
252644
|
-
|
|
252645
|
-
|
|
252646
|
-
|
|
252647
|
-
|
|
252648
|
-
const connectorNames = connectors.map((c3) => c3.type).join(", ");
|
|
252649
|
-
log.info(`Found ${connectors.length} connectors to push: ${connectorNames}`);
|
|
252806
|
+
async function pushConnectorsAction({ isNonInteractive, log, runTask: runTask2, jsonMode }, options) {
|
|
252807
|
+
const connectors = await readConnectorsToPush(options);
|
|
252808
|
+
if (!jsonMode) {
|
|
252809
|
+
if (connectors.length === 0) {
|
|
252810
|
+
log.info("No local connectors found - checking for remote connectors to remove");
|
|
252811
|
+
} else {
|
|
252812
|
+
const connectorNames = connectors.map((c3) => c3.type).join(", ");
|
|
252813
|
+
log.info(`Found ${connectors.length} connectors to push: ${connectorNames}`);
|
|
252814
|
+
}
|
|
252650
252815
|
}
|
|
252651
252816
|
const { results } = await runTask2("Pushing connectors to Base44", async () => {
|
|
252652
252817
|
return await pushConnectors(connectors);
|
|
@@ -252660,16 +252825,23 @@ async function pushConnectorsAction({
|
|
|
252660
252825
|
if (needsOAuth.length > 0 && !allAuthorized) {
|
|
252661
252826
|
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.";
|
|
252662
252827
|
}
|
|
252828
|
+
if (jsonMode) {
|
|
252829
|
+
return {
|
|
252830
|
+
outroMessage,
|
|
252831
|
+
stdout: `${JSON.stringify({ results, oauth: Object.fromEntries(oauthOutcomes) }, null, 2)}
|
|
252832
|
+
`
|
|
252833
|
+
};
|
|
252834
|
+
}
|
|
252663
252835
|
printSummary(results, oauthOutcomes, log);
|
|
252664
252836
|
return { outroMessage };
|
|
252665
252837
|
}
|
|
252666
252838
|
function getConnectorsPushCommand() {
|
|
252667
|
-
return new Base44Command("push").description("Push local connectors to Base44 (overwrites connectors on Base44)").action(pushConnectorsAction);
|
|
252839
|
+
return new Base44Command("push").description("Push local connectors to Base44 (overwrites connectors on Base44)").option("--dir <path>", "Directory to read connector files from (default: ./connectors when using --app-id)").action(pushConnectorsAction);
|
|
252668
252840
|
}
|
|
252669
252841
|
|
|
252670
252842
|
// src/cli/commands/connectors/index.ts
|
|
252671
252843
|
function getConnectorsCommand() {
|
|
252672
|
-
return new Command("connectors").description("Manage project connectors (OAuth integrations)").addCommand(getConnectorsListAvailableCommand()).addCommand(getConnectorsPullCommand()).addCommand(getConnectorsPushCommand());
|
|
252844
|
+
return new Command("connectors").description("Manage project connectors (OAuth integrations)").addCommand(getConnectorsListAvailableCommand()).addCommand(getConnectorsInitiateCommand()).addCommand(getConnectorsPullCommand()).addCommand(getConnectorsPushCommand());
|
|
252673
252845
|
}
|
|
252674
252846
|
|
|
252675
252847
|
// src/cli/commands/dashboard/open.ts
|
|
@@ -252976,7 +253148,7 @@ function getFunctionsCommand() {
|
|
|
252976
253148
|
}
|
|
252977
253149
|
|
|
252978
253150
|
// src/cli/commands/project/create.ts
|
|
252979
|
-
import { basename as basename4, resolve as
|
|
253151
|
+
import { basename as basename4, resolve as resolve7 } from "node:path";
|
|
252980
253152
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
252981
253153
|
|
|
252982
253154
|
// src/cli/commands/project/scaffold-shared.ts
|
|
@@ -253075,7 +253247,11 @@ function printProjectSummary({ name: name2, dashboardUrl, appUrl }, log) {
|
|
|
253075
253247
|
}
|
|
253076
253248
|
|
|
253077
253249
|
// src/cli/commands/project/create.ts
|
|
253078
|
-
function
|
|
253250
|
+
function validateCreateOptions(command2) {
|
|
253251
|
+
const { appId } = command2.optsWithGlobals();
|
|
253252
|
+
if (appId !== undefined) {
|
|
253253
|
+
command2.error(`base44 create cannot be used with --app-id or ${BASE44_APP_ID_ENV_VAR}.`);
|
|
253254
|
+
}
|
|
253079
253255
|
const { path: path17 } = command2.opts();
|
|
253080
253256
|
if (path17 && !command2.args.length) {
|
|
253081
253257
|
command2.error("--path requires a project name argument. Usage: base44 create <name> --path <path>");
|
|
@@ -253126,7 +253302,7 @@ async function createInteractive(options, ctx) {
|
|
|
253126
253302
|
}, ctx);
|
|
253127
253303
|
}
|
|
253128
253304
|
async function createNonInteractive(options, ctx) {
|
|
253129
|
-
ctx.log.info(`Creating a new project at ${
|
|
253305
|
+
ctx.log.info(`Creating a new project at ${resolve7(options.path)}`);
|
|
253130
253306
|
const template2 = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
|
|
253131
253307
|
return await executeCreate({
|
|
253132
253308
|
template: template2,
|
|
@@ -253148,7 +253324,7 @@ async function executeCreate({
|
|
|
253148
253324
|
}, ctx) {
|
|
253149
253325
|
const { log, runTask: runTask2 } = ctx;
|
|
253150
253326
|
const name2 = rawName.trim();
|
|
253151
|
-
const resolvedPath =
|
|
253327
|
+
const resolvedPath = resolve7(projectPath);
|
|
253152
253328
|
const { projectId } = await runTask2("Setting up your project...", async () => {
|
|
253153
253329
|
return await createProjectFiles({
|
|
253154
253330
|
name: name2,
|
|
@@ -253192,7 +253368,7 @@ function getCreateCommand() {
|
|
|
253192
253368
|
Examples:
|
|
253193
253369
|
$ base44 create my-app Creates a base44 project at ./my-app
|
|
253194
253370
|
$ base44 create my-todo-app --template backend-and-client Creates a base44 backend-and-client project at ./my-todo-app
|
|
253195
|
-
$ base44 create my-app --path ./projects/my-app --deploy Creates a base44 project at ./project/my-app and deploys it`).hook("preAction",
|
|
253371
|
+
$ base44 create my-app --path ./projects/my-app --deploy Creates a base44 project at ./project/my-app and deploys it`).hook("preAction", validateCreateOptions).action(createAction);
|
|
253196
253372
|
}
|
|
253197
253373
|
|
|
253198
253374
|
// src/cli/commands/project/deploy.ts
|
|
@@ -253288,11 +253464,32 @@ function printStripeResult(r, log) {
|
|
|
253288
253464
|
log.info(` Connectors dashboard: ${theme.colors.links(getConnectorsUrl())}`);
|
|
253289
253465
|
}
|
|
253290
253466
|
|
|
253467
|
+
// src/cli/commands/project/app-id-options.ts
|
|
253468
|
+
function readExplicitAppId(command2) {
|
|
253469
|
+
const { appId } = command2.optsWithGlobals();
|
|
253470
|
+
const { projectId } = command2.opts();
|
|
253471
|
+
const explicitAppId = command2.getOptionValueSourceWithGlobals("appId") === "cli" ? appId : undefined;
|
|
253472
|
+
const legacyProjectId = command2.getOptionValueSource("projectId") === "cli" ? projectId : undefined;
|
|
253473
|
+
return {
|
|
253474
|
+
appId: explicitAppId,
|
|
253475
|
+
legacyProjectId,
|
|
253476
|
+
value: explicitAppId ?? legacyProjectId
|
|
253477
|
+
};
|
|
253478
|
+
}
|
|
253479
|
+
|
|
253291
253480
|
// src/cli/commands/project/link.ts
|
|
253292
|
-
function
|
|
253293
|
-
const { create: create4, name: name2
|
|
253294
|
-
|
|
253295
|
-
|
|
253481
|
+
function validateNonInteractiveFlags(command2) {
|
|
253482
|
+
const { create: create4, name: name2 } = command2.opts();
|
|
253483
|
+
const {
|
|
253484
|
+
appId,
|
|
253485
|
+
legacyProjectId,
|
|
253486
|
+
value: selectedAppId
|
|
253487
|
+
} = readExplicitAppId(command2);
|
|
253488
|
+
if (appId && legacyProjectId) {
|
|
253489
|
+
command2.error("--app-id and --project-id cannot be used together");
|
|
253490
|
+
}
|
|
253491
|
+
if (create4 && selectedAppId) {
|
|
253492
|
+
command2.error("--create and --app-id cannot be used together");
|
|
253296
253493
|
}
|
|
253297
253494
|
if (create4 && !name2) {
|
|
253298
253495
|
command2.error("--name is required when using --create");
|
|
@@ -253361,11 +253558,12 @@ async function promptForExistingProject(linkableProjects) {
|
|
|
253361
253558
|
}
|
|
253362
253559
|
return selectedProject;
|
|
253363
253560
|
}
|
|
253364
|
-
async function link(ctx, options) {
|
|
253561
|
+
async function link(ctx, options, command2) {
|
|
253365
253562
|
const { log, runTask: runTask2, isNonInteractive } = ctx;
|
|
253366
|
-
const
|
|
253563
|
+
const appId = readExplicitAppId(command2).value;
|
|
253564
|
+
const skipPrompts = !!options.create || !!appId;
|
|
253367
253565
|
if (!skipPrompts && isNonInteractive) {
|
|
253368
|
-
throw new InvalidInputError("--create with --name, or --
|
|
253566
|
+
throw new InvalidInputError("--create with --name, or --app-id, is required in non-interactive mode");
|
|
253369
253567
|
}
|
|
253370
253568
|
const projectRoot = findProjectRoot();
|
|
253371
253569
|
if (!projectRoot) {
|
|
@@ -253380,8 +253578,8 @@ async function link(ctx, options) {
|
|
|
253380
253578
|
]
|
|
253381
253579
|
});
|
|
253382
253580
|
}
|
|
253383
|
-
let
|
|
253384
|
-
const action =
|
|
253581
|
+
let finalAppId;
|
|
253582
|
+
const action = appId ? "choose" : options.create ? "create" : await promptForLinkAction();
|
|
253385
253583
|
if (action === "choose") {
|
|
253386
253584
|
const projects = await runTask2("Fetching projects...", async () => listProjects(), {
|
|
253387
253585
|
successMessage: "Projects fetched",
|
|
@@ -253391,32 +253589,32 @@ async function link(ctx, options) {
|
|
|
253391
253589
|
if (!linkableProjects.length) {
|
|
253392
253590
|
return { outroMessage: "No projects available for linking" };
|
|
253393
253591
|
}
|
|
253394
|
-
let
|
|
253395
|
-
if (
|
|
253396
|
-
const project2 = linkableProjects.find((p) => p.id ===
|
|
253592
|
+
let linkedAppId;
|
|
253593
|
+
if (appId) {
|
|
253594
|
+
const project2 = linkableProjects.find((p) => p.id === appId);
|
|
253397
253595
|
if (!project2) {
|
|
253398
|
-
throw new InvalidInputError(`
|
|
253596
|
+
throw new InvalidInputError(`App with ID "${appId}" not found or not available for linking.`, {
|
|
253399
253597
|
hints: [
|
|
253400
|
-
{ message: "Check the
|
|
253598
|
+
{ message: "Check the app ID is correct" },
|
|
253401
253599
|
{
|
|
253402
|
-
message: "Use 'base44 link' without --
|
|
253600
|
+
message: "Use 'base44 link' without --app-id to see available projects"
|
|
253403
253601
|
}
|
|
253404
253602
|
]
|
|
253405
253603
|
});
|
|
253406
253604
|
}
|
|
253407
|
-
|
|
253605
|
+
linkedAppId = appId;
|
|
253408
253606
|
} else {
|
|
253409
253607
|
const selectedProject = await promptForExistingProject(linkableProjects);
|
|
253410
|
-
|
|
253608
|
+
linkedAppId = selectedProject.id;
|
|
253411
253609
|
}
|
|
253412
253610
|
await runTask2("Linking project...", async () => {
|
|
253413
|
-
await writeAppConfig(projectRoot.root,
|
|
253414
|
-
setAppContext({ id:
|
|
253611
|
+
await writeAppConfig(projectRoot.root, linkedAppId);
|
|
253612
|
+
setAppContext({ id: linkedAppId, projectRoot: projectRoot.root });
|
|
253415
253613
|
}, {
|
|
253416
253614
|
successMessage: "Project linked successfully",
|
|
253417
253615
|
errorMessage: "Failed to link project"
|
|
253418
253616
|
});
|
|
253419
|
-
|
|
253617
|
+
finalAppId = linkedAppId;
|
|
253420
253618
|
}
|
|
253421
253619
|
if (action === "create") {
|
|
253422
253620
|
const { name: name2, description } = options.create ? { name: options.name.trim(), description: options.description?.trim() } : await promptForNewProjectDetails();
|
|
@@ -253428,13 +253626,15 @@ async function link(ctx, options) {
|
|
|
253428
253626
|
});
|
|
253429
253627
|
await writeAppConfig(projectRoot.root, projectId);
|
|
253430
253628
|
setAppContext({ id: projectId, projectRoot: projectRoot.root });
|
|
253431
|
-
|
|
253629
|
+
finalAppId = projectId;
|
|
253432
253630
|
}
|
|
253433
|
-
log.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(
|
|
253631
|
+
log.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(finalAppId))}`);
|
|
253434
253632
|
return { outroMessage: "Project linked" };
|
|
253435
253633
|
}
|
|
253436
253634
|
function getLinkCommand() {
|
|
253437
|
-
return new Base44Command("link", {
|
|
253635
|
+
return new Base44Command("link", {
|
|
253636
|
+
requireAppContext: false
|
|
253637
|
+
}).description("Link a local project to a Base44 project (create new or link existing)").configureHelp({ showGlobalOptions: true }).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").addOption(new Option("-p, --project-id <id>", "Project ID to link to an existing project").hideHelp()).addOption(new Option("--projectId <id>", "Project ID to link to an existing project").hideHelp()).hook("preAction", validateNonInteractiveFlags).action(link);
|
|
253438
253638
|
}
|
|
253439
253639
|
|
|
253440
253640
|
// src/cli/commands/project/logs.ts
|
|
@@ -253524,8 +253724,12 @@ async function fetchLogsForFunctions(functionNames, options, availableFunctionNa
|
|
|
253524
253724
|
}
|
|
253525
253725
|
return allEntries;
|
|
253526
253726
|
}
|
|
253527
|
-
async function
|
|
253528
|
-
const { functions } = await readProjectConfig();
|
|
253727
|
+
async function getProjectFunctionNames(projectRoot) {
|
|
253728
|
+
const { functions } = await readProjectConfig(projectRoot);
|
|
253729
|
+
return functions.map((fn) => fn.name);
|
|
253730
|
+
}
|
|
253731
|
+
async function getRemoteFunctionNames() {
|
|
253732
|
+
const { functions } = await listDeployedFunctions();
|
|
253529
253733
|
return functions.map((fn) => fn.name);
|
|
253530
253734
|
}
|
|
253531
253735
|
function validateLimit(limit) {
|
|
@@ -253536,15 +253740,18 @@ function validateLimit(limit) {
|
|
|
253536
253740
|
throw new InvalidInputError(`Invalid limit: "${limit}". Must be a number between 1 and 1000.`);
|
|
253537
253741
|
}
|
|
253538
253742
|
}
|
|
253539
|
-
async function logsAction(
|
|
253743
|
+
async function logsAction(ctx, options) {
|
|
253540
253744
|
validateLimit(options.limit);
|
|
253541
253745
|
const specifiedFunctions = parseFunctionNames(options.function);
|
|
253542
|
-
const
|
|
253543
|
-
const
|
|
253746
|
+
const localProjectRoot = ctx.app?.projectRoot;
|
|
253747
|
+
const availableFunctionNames = localProjectRoot ? await getProjectFunctionNames(localProjectRoot) : await getRemoteFunctionNames();
|
|
253748
|
+
const functionNames = specifiedFunctions.length > 0 ? specifiedFunctions : availableFunctionNames;
|
|
253544
253749
|
if (functionNames.length === 0) {
|
|
253545
|
-
return {
|
|
253750
|
+
return {
|
|
253751
|
+
outroMessage: localProjectRoot ? "No functions found in this project." : "No functions found in this app."
|
|
253752
|
+
};
|
|
253546
253753
|
}
|
|
253547
|
-
let entries = await fetchLogsForFunctions(functionNames, options,
|
|
253754
|
+
let entries = await fetchLogsForFunctions(functionNames, options, availableFunctionNames);
|
|
253548
253755
|
const limit = options.limit ? Number.parseInt(options.limit, 10) : undefined;
|
|
253549
253756
|
if (limit !== undefined && entries.length > limit) {
|
|
253550
253757
|
entries = entries.slice(0, limit);
|
|
@@ -253558,20 +253765,23 @@ function getLogsCommand() {
|
|
|
253558
253765
|
}
|
|
253559
253766
|
|
|
253560
253767
|
// src/cli/commands/project/scaffold.ts
|
|
253561
|
-
import { basename as basename5, resolve as
|
|
253768
|
+
import { basename as basename5, resolve as resolve8 } from "node:path";
|
|
253562
253769
|
function resolveAppId(options) {
|
|
253563
|
-
const appId = options.appId
|
|
253770
|
+
const appId = options.appId;
|
|
253564
253771
|
if (!appId) {
|
|
253565
253772
|
throw new InvalidInputError("No app ID found. `base44 scaffold` sets up a local project for an existing Base44 app.", {
|
|
253566
|
-
hints: [
|
|
253773
|
+
hints: [
|
|
253774
|
+
{ message: "Pass it explicitly with --app-id <id>" },
|
|
253775
|
+
{ message: `Set ${BASE44_APP_ID_ENV_VAR} in your environment` }
|
|
253776
|
+
]
|
|
253567
253777
|
});
|
|
253568
253778
|
}
|
|
253569
253779
|
return appId;
|
|
253570
253780
|
}
|
|
253571
|
-
async function scaffoldAction(ctx, name2, options) {
|
|
253781
|
+
async function scaffoldAction(ctx, name2, options, command2) {
|
|
253572
253782
|
const { log, runTask: runTask2 } = ctx;
|
|
253573
|
-
const appId = resolveAppId(
|
|
253574
|
-
const resolvedPath =
|
|
253783
|
+
const appId = resolveAppId(command2.optsWithGlobals());
|
|
253784
|
+
const resolvedPath = resolve8("./");
|
|
253575
253785
|
const projectName = (name2 ?? basename5(resolvedPath)).trim();
|
|
253576
253786
|
const template2 = await getTemplateById("backend-only");
|
|
253577
253787
|
log.info(`Scaffolding project at ${resolvedPath}`);
|
|
@@ -253602,7 +253812,7 @@ function getScaffoldCommand() {
|
|
|
253602
253812
|
return new Base44Command("scaffold", {
|
|
253603
253813
|
requireAppContext: false,
|
|
253604
253814
|
fullBanner: true
|
|
253605
|
-
}).description("Scaffold a local project for an existing Base44 app").addArgument(new Argument("name", "Project name").argOptional()).option("--
|
|
253815
|
+
}).description("Scaffold a local project for an existing Base44 app").addArgument(new Argument("name", "Project name").argOptional()).option("--no-skills", "Skip AI agent skills installation").addHelpText("after", `
|
|
253606
253816
|
Examples:
|
|
253607
253817
|
$ base44 scaffold --app-id app_123 Scaffolds the current dir for the given app
|
|
253608
253818
|
$ base44 scaffold my-app --app-id app_123 Scaffolds the current dir, named "my-app"`).action(scaffoldAction);
|
|
@@ -253686,22 +253896,53 @@ var RunCommandResponseSchema = exports_external.object({
|
|
|
253686
253896
|
truncated: data.truncated,
|
|
253687
253897
|
durationMs: data.duration_ms
|
|
253688
253898
|
}));
|
|
253689
|
-
var
|
|
253690
|
-
|
|
253691
|
-
|
|
253899
|
+
var CreateCheckpointResponseSchema = exports_external.object({
|
|
253900
|
+
checkpoint_id: exports_external.string(),
|
|
253901
|
+
name: exports_external.string().nullable(),
|
|
253902
|
+
git_commit_hash: exports_external.string().nullable()
|
|
253692
253903
|
}).transform((data) => ({
|
|
253693
|
-
|
|
253694
|
-
|
|
253904
|
+
checkpointId: data.checkpoint_id,
|
|
253905
|
+
name: data.name,
|
|
253906
|
+
gitCommitHash: data.git_commit_hash
|
|
253695
253907
|
}));
|
|
253696
253908
|
|
|
253697
253909
|
// src/core/resources/sandbox/api.ts
|
|
253910
|
+
function isMissingSandboxScope(error48) {
|
|
253911
|
+
if (error48.statusCode !== 401 && error48.statusCode !== 403) {
|
|
253912
|
+
return false;
|
|
253913
|
+
}
|
|
253914
|
+
const text = `${error48.message} ${JSON.stringify(error48.responseBody ?? "")}`;
|
|
253915
|
+
return /sandbox:write/i.test(text) || /granting sandbox access/i.test(text);
|
|
253916
|
+
}
|
|
253917
|
+
function withSandboxAuthHint(error48) {
|
|
253918
|
+
if (!isMissingSandboxScope(error48)) {
|
|
253919
|
+
return error48;
|
|
253920
|
+
}
|
|
253921
|
+
return new ApiError(error48.message, {
|
|
253922
|
+
statusCode: error48.statusCode,
|
|
253923
|
+
requestUrl: error48.requestUrl,
|
|
253924
|
+
requestMethod: error48.requestMethod,
|
|
253925
|
+
requestBody: error48.requestBody,
|
|
253926
|
+
responseBody: error48.responseBody,
|
|
253927
|
+
requestId: error48.requestId,
|
|
253928
|
+
details: error48.details,
|
|
253929
|
+
hints: [
|
|
253930
|
+
...error48.hints,
|
|
253931
|
+
{
|
|
253932
|
+
message: "Run 'base44 login' again to grant sandbox access (the sandbox:write scope is only granted at login).",
|
|
253933
|
+
command: "base44 login"
|
|
253934
|
+
}
|
|
253935
|
+
],
|
|
253936
|
+
cause: error48
|
|
253937
|
+
});
|
|
253938
|
+
}
|
|
253698
253939
|
async function callTool(appId, tool, payload, schema10, context, timeout2 = 60000) {
|
|
253699
253940
|
const client = getSandboxClient(appId);
|
|
253700
253941
|
let response;
|
|
253701
253942
|
try {
|
|
253702
253943
|
response = await client.post(tool, { json: payload, timeout: timeout2 });
|
|
253703
253944
|
} catch (error48) {
|
|
253704
|
-
throw await ApiError.fromHttpError(error48, context);
|
|
253945
|
+
throw withSandboxAuthHint(await ApiError.fromHttpError(error48, context));
|
|
253705
253946
|
}
|
|
253706
253947
|
const result = schema10.safeParse(await response.json());
|
|
253707
253948
|
if (!result.success) {
|
|
@@ -253727,28 +253968,11 @@ function grep(appId, params) {
|
|
|
253727
253968
|
function runCommand(appId, params) {
|
|
253728
253969
|
return callTool(appId, "run_command", { ...params }, RunCommandResponseSchema, "running command", false);
|
|
253729
253970
|
}
|
|
253730
|
-
function
|
|
253731
|
-
return callTool(appId, "
|
|
253971
|
+
function createCheckpoint(appId, params) {
|
|
253972
|
+
return callTool(appId, "create_checkpoint", { ...params }, CreateCheckpointResponseSchema, "creating checkpoint");
|
|
253732
253973
|
}
|
|
253733
253974
|
|
|
253734
253975
|
// src/cli/commands/sandbox/shared.ts
|
|
253735
|
-
async function resolveAppId2(options) {
|
|
253736
|
-
const explicit = options.appId ?? process.env.BASE44_APP_ID;
|
|
253737
|
-
if (explicit) {
|
|
253738
|
-
return explicit;
|
|
253739
|
-
}
|
|
253740
|
-
try {
|
|
253741
|
-
const { id } = await initAppContext();
|
|
253742
|
-
return id;
|
|
253743
|
-
} catch {
|
|
253744
|
-
throw new InvalidInputError("No app ID found. Sandbox commands operate on a remote app.", {
|
|
253745
|
-
hints: [
|
|
253746
|
-
{ message: "Pass it explicitly with --app-id <id>" },
|
|
253747
|
-
{ message: "Or run from a linked Base44 project directory" }
|
|
253748
|
-
]
|
|
253749
|
-
});
|
|
253750
|
-
}
|
|
253751
|
-
}
|
|
253752
253976
|
async function resolveFlagOrStdin(flagValue, flagName) {
|
|
253753
253977
|
if (flagValue !== undefined) {
|
|
253754
253978
|
return flagValue;
|
|
@@ -253773,6 +253997,19 @@ function parsePositiveInt(value, flagName) {
|
|
|
253773
253997
|
return n2;
|
|
253774
253998
|
}
|
|
253775
253999
|
|
|
254000
|
+
// src/cli/commands/sandbox/checkpoint.ts
|
|
254001
|
+
async function checkpointAction({ runTask: runTask2 }, options) {
|
|
254002
|
+
const { id: appId } = getAppContext();
|
|
254003
|
+
const result = await runTask2("Creating checkpoint", () => createCheckpoint(appId, { name: options.name }));
|
|
254004
|
+
return { outroMessage: "Created checkpoint", stdout: toJsonStdout(result) };
|
|
254005
|
+
}
|
|
254006
|
+
function getSandboxCheckpointCommand() {
|
|
254007
|
+
return new Base44Command("checkpoint").description("Create a restore-point checkpoint of an app's remote sandbox").option("--name <name>", "Optional message/title for the checkpoint (defaults to an auto-generated title)").addHelpText("after", `
|
|
254008
|
+
Examples:
|
|
254009
|
+
$ base44 sandbox checkpoint
|
|
254010
|
+
$ base44 sandbox checkpoint --name "before refactor"`).action(checkpointAction);
|
|
254011
|
+
}
|
|
254012
|
+
|
|
253776
254013
|
// src/cli/commands/sandbox/edit-file.ts
|
|
253777
254014
|
var EditsInputSchema = exports_external.array(exports_external.object({
|
|
253778
254015
|
old_text: exports_external.string().min(1),
|
|
@@ -253793,7 +254030,7 @@ function parseEdits(raw2) {
|
|
|
253793
254030
|
return result.data;
|
|
253794
254031
|
}
|
|
253795
254032
|
async function editFileAction({ runTask: runTask2 }, path17, options) {
|
|
253796
|
-
const appId =
|
|
254033
|
+
const { id: appId } = getAppContext();
|
|
253797
254034
|
const raw2 = await resolveFlagOrStdin(options.editsJson, "--edits-json");
|
|
253798
254035
|
const edits = parseEdits(raw2);
|
|
253799
254036
|
const result = await runTask2(options.dryRun ? "Previewing edit" : "Editing file", () => editFile(appId, { path: path17, edits, dry_run: options.dryRun }));
|
|
@@ -253803,17 +254040,17 @@ async function editFileAction({ runTask: runTask2 }, path17, options) {
|
|
|
253803
254040
|
};
|
|
253804
254041
|
}
|
|
253805
254042
|
function getSandboxEditFileCommand() {
|
|
253806
|
-
return new Base44Command("edit
|
|
254043
|
+
return new Base44Command("edit").description("Apply exact old→new string edits to a file in the sandbox").argument("<path>", "File path relative to the app root").option("--edits-json <json>", "JSON array of edits (if omitted, read from stdin)").option("--dry-run", "Return the unified diff without writing").addHelpText("after", `
|
|
253807
254044
|
Each edit is { "old_text": "...", "new_text": "...", "replace_all"?: true }.
|
|
253808
254045
|
|
|
253809
254046
|
Examples:
|
|
253810
|
-
$ echo '[{"old_text":"foo","new_text":"bar"}]' | base44 sandbox edit
|
|
253811
|
-
$ base44 sandbox edit
|
|
254047
|
+
$ echo '[{"old_text":"foo","new_text":"bar"}]' | base44 sandbox edit src/x.ts
|
|
254048
|
+
$ base44 sandbox edit src/x.ts --dry-run --edits-json '[{"old_text":"a","new_text":"b","replace_all":true}]'`).action(editFileAction);
|
|
253812
254049
|
}
|
|
253813
254050
|
|
|
253814
254051
|
// src/cli/commands/sandbox/grep.ts
|
|
253815
254052
|
async function grepAction({ runTask: runTask2 }, pattern, options) {
|
|
253816
|
-
const appId =
|
|
254053
|
+
const { id: appId } = getAppContext();
|
|
253817
254054
|
const maxResults = parsePositiveInt(options.maxResults, "--max-results");
|
|
253818
254055
|
const result = await runTask2("Searching files", () => grep(appId, {
|
|
253819
254056
|
pattern,
|
|
@@ -253826,12 +254063,12 @@ async function grepAction({ runTask: runTask2 }, pattern, options) {
|
|
|
253826
254063
|
return { outroMessage: "Searched files", stdout: toJsonStdout(result) };
|
|
253827
254064
|
}
|
|
253828
254065
|
function getSandboxGrepCommand() {
|
|
253829
|
-
return new Base44Command("grep"
|
|
254066
|
+
return new Base44Command("grep").description("Search files for a pattern in an app's remote sandbox").argument("<pattern>", "Search pattern").option("--path <path>", "Subtree to search, relative to the app root").option("--no-regex", "Treat the pattern as a literal string, not a regex").option("--case-sensitive", "Case-sensitive match").option("--glob <glob>", 'File glob filter, e.g. "*.tsx"').option("--max-results <n>", "Maximum number of match lines to return").action(grepAction);
|
|
253830
254067
|
}
|
|
253831
254068
|
|
|
253832
254069
|
// src/cli/commands/sandbox/list-directory.ts
|
|
253833
254070
|
async function listDirectoryAction({ runTask: runTask2 }, path17, options) {
|
|
253834
|
-
const appId =
|
|
254071
|
+
const { id: appId } = getAppContext();
|
|
253835
254072
|
const maxDepth = parsePositiveInt(options.maxDepth, "--max-depth");
|
|
253836
254073
|
const result = await runTask2("Listing directory", () => listDirectory(appId, {
|
|
253837
254074
|
path: path17,
|
|
@@ -253842,66 +254079,53 @@ async function listDirectoryAction({ runTask: runTask2 }, path17, options) {
|
|
|
253842
254079
|
return { outroMessage: "Listed directory", stdout: toJsonStdout(result) };
|
|
253843
254080
|
}
|
|
253844
254081
|
function getSandboxListDirectoryCommand() {
|
|
253845
|
-
return new Base44Command("
|
|
254082
|
+
return new Base44Command("ls").description("List directory entries in an app's remote sandbox").argument("[path]", "Directory relative to the app root (default: app root)").option("--recursive", "List nested entries").option("--max-depth <n>", "Max depth when recursive (1-10, default 3)").option("--include-hidden", "Include dotfiles").action(listDirectoryAction);
|
|
253846
254083
|
}
|
|
253847
254084
|
|
|
253848
254085
|
// src/cli/commands/sandbox/read-file.ts
|
|
253849
254086
|
async function readFileAction({ runTask: runTask2 }, paths, options) {
|
|
253850
|
-
const appId =
|
|
254087
|
+
const { id: appId } = getAppContext();
|
|
253851
254088
|
const offset = parsePositiveInt(options.offset, "--offset");
|
|
253852
254089
|
const limit = parsePositiveInt(options.limit, "--limit");
|
|
253853
254090
|
const result = await runTask2("Reading file", () => readFile2(appId, { paths, offset, limit }));
|
|
253854
254091
|
return { outroMessage: "Read file", stdout: toJsonStdout(result) };
|
|
253855
254092
|
}
|
|
253856
254093
|
function getSandboxReadFileCommand() {
|
|
253857
|
-
return new Base44Command("read
|
|
253858
|
-
}
|
|
253859
|
-
|
|
253860
|
-
// src/cli/commands/sandbox/release.ts
|
|
253861
|
-
async function releaseAction({ runTask: runTask2 }, options) {
|
|
253862
|
-
const appId = await resolveAppId2(options);
|
|
253863
|
-
const result = await runTask2("Releasing sandbox session", () => releaseSession(appId));
|
|
253864
|
-
return {
|
|
253865
|
-
outroMessage: "Released sandbox session",
|
|
253866
|
-
stdout: toJsonStdout(result)
|
|
253867
|
-
};
|
|
253868
|
-
}
|
|
253869
|
-
function getSandboxReleaseCommand() {
|
|
253870
|
-
return new Base44Command("release", { requireAppContext: false }).description("Release the external-agent session so the in-app builder can resume").option("--app-id <id>", "Target app ID (defaults to the current app)").action(releaseAction);
|
|
254094
|
+
return new Base44Command("read").description("Read file contents from an app's remote sandbox").argument("<paths...>", "One or more file paths relative to the app root").option("--offset <n>", "1-based start line").option("--limit <n>", "Max lines to return from offset").action(readFileAction);
|
|
253871
254095
|
}
|
|
253872
254096
|
|
|
253873
254097
|
// src/cli/commands/sandbox/run-command.ts
|
|
253874
254098
|
async function runCommandAction({ runTask: runTask2 }, commandParts, options) {
|
|
253875
|
-
const appId =
|
|
254099
|
+
const { id: appId } = getAppContext();
|
|
253876
254100
|
const timeoutMs = parsePositiveInt(options.timeoutMs, "--timeout-ms");
|
|
253877
254101
|
const command2 = commandParts.join(" ");
|
|
253878
254102
|
const result = await runTask2("Running command", () => runCommand(appId, { command: command2, cwd: options.cwd, timeout_ms: timeoutMs }));
|
|
253879
254103
|
return { outroMessage: "Ran command", stdout: toJsonStdout(result) };
|
|
253880
254104
|
}
|
|
253881
254105
|
function getSandboxRunCommandCommand() {
|
|
253882
|
-
return new Base44Command("run
|
|
254106
|
+
return new Base44Command("run").description("Run a shell command in an app's remote sandbox").argument("<command...>", "Shell command to execute (quote to keep as one)").option("--cwd <path>", "Working directory relative to the app root").option("--timeout-ms <n>", "Timeout in milliseconds (default 120000, max 600000)").addHelpText("after", `
|
|
253883
254107
|
Examples:
|
|
253884
|
-
$ base44 sandbox run
|
|
253885
|
-
$ base44 sandbox run
|
|
254108
|
+
$ base44 sandbox run "npm test"
|
|
254109
|
+
$ base44 sandbox run ls -la --cwd src`).action(runCommandAction);
|
|
253886
254110
|
}
|
|
253887
254111
|
|
|
253888
254112
|
// src/cli/commands/sandbox/write-file.ts
|
|
253889
254113
|
async function writeFileAction({ runTask: runTask2 }, path17, options) {
|
|
253890
|
-
const appId =
|
|
254114
|
+
const { id: appId } = getAppContext();
|
|
253891
254115
|
const content = await resolveFlagOrStdin(options.content, "--content");
|
|
253892
254116
|
const result = await runTask2("Writing file", () => writeFile2(appId, { path: path17, content, overwrite: options.overwrite }));
|
|
253893
254117
|
return { outroMessage: "Wrote file", stdout: toJsonStdout(result) };
|
|
253894
254118
|
}
|
|
253895
254119
|
function getSandboxWriteFileCommand() {
|
|
253896
|
-
return new Base44Command("write
|
|
254120
|
+
return new Base44Command("write").description("Create or overwrite a file in an app's remote sandbox").argument("<path>", "File path relative to the app root").option("--content <content>", "File content (if omitted, read from stdin)").option("--overwrite", "Overwrite the file if it already exists").addHelpText("after", `
|
|
253897
254121
|
Examples:
|
|
253898
|
-
$ echo "hello" | base44 sandbox write
|
|
253899
|
-
$ base44 sandbox write
|
|
254122
|
+
$ echo "hello" | base44 sandbox write notes.txt
|
|
254123
|
+
$ base44 sandbox write notes.txt --content "hello" --overwrite`).action(writeFileAction);
|
|
253900
254124
|
}
|
|
253901
254125
|
|
|
253902
254126
|
// src/cli/commands/sandbox/index.ts
|
|
253903
254127
|
function getSandboxCommand() {
|
|
253904
|
-
return new Command("sandbox").description("Develop an app remotely via its server-side sandbox").addCommand(getSandboxListDirectoryCommand()).addCommand(getSandboxReadFileCommand()).addCommand(getSandboxWriteFileCommand()).addCommand(getSandboxEditFileCommand()).addCommand(getSandboxGrepCommand()).addCommand(getSandboxRunCommandCommand()).addCommand(
|
|
254128
|
+
return new Command("sandbox").description("Develop an app remotely via its server-side sandbox").addCommand(getSandboxListDirectoryCommand()).addCommand(getSandboxReadFileCommand()).addCommand(getSandboxWriteFileCommand()).addCommand(getSandboxEditFileCommand()).addCommand(getSandboxGrepCommand()).addCommand(getSandboxRunCommandCommand()).addCommand(getSandboxCheckpointCommand());
|
|
253905
254129
|
}
|
|
253906
254130
|
|
|
253907
254131
|
// src/cli/commands/secrets/delete.ts
|
|
@@ -253947,7 +254171,7 @@ function getSecretsListCommand() {
|
|
|
253947
254171
|
}
|
|
253948
254172
|
|
|
253949
254173
|
// src/cli/commands/secrets/set.ts
|
|
253950
|
-
import { resolve as
|
|
254174
|
+
import { resolve as resolve9 } from "node:path";
|
|
253951
254175
|
function parseEntries(entries) {
|
|
253952
254176
|
const secrets = {};
|
|
253953
254177
|
for (const entry of entries) {
|
|
@@ -253978,7 +254202,7 @@ async function setSecretsAction({ log, runTask: runTask2 }, entries, options) {
|
|
|
253978
254202
|
validateInput(entries, options);
|
|
253979
254203
|
let secrets;
|
|
253980
254204
|
if (options.envFile) {
|
|
253981
|
-
secrets = await parseEnvFile(
|
|
254205
|
+
secrets = await parseEnvFile(resolve9(options.envFile));
|
|
253982
254206
|
if (Object.keys(secrets).length === 0) {
|
|
253983
254207
|
throw new InvalidInputError("The env file contains no valid KEY=VALUE entries.");
|
|
253984
254208
|
}
|
|
@@ -254007,7 +254231,7 @@ function getSecretsCommand() {
|
|
|
254007
254231
|
}
|
|
254008
254232
|
|
|
254009
254233
|
// src/cli/commands/site/deploy.ts
|
|
254010
|
-
import { resolve as
|
|
254234
|
+
import { resolve as resolve10 } from "node:path";
|
|
254011
254235
|
async function deployAction2({ isNonInteractive, runTask: runTask2 }, options) {
|
|
254012
254236
|
if (isNonInteractive && !options.yes) {
|
|
254013
254237
|
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
@@ -254022,7 +254246,7 @@ async function deployAction2({ isNonInteractive, runTask: runTask2 }, options) {
|
|
|
254022
254246
|
]
|
|
254023
254247
|
});
|
|
254024
254248
|
}
|
|
254025
|
-
const outputDir =
|
|
254249
|
+
const outputDir = resolve10(project2.root, project2.site.outputDirectory);
|
|
254026
254250
|
if (!options.yes) {
|
|
254027
254251
|
const shouldDeploy = await Re({
|
|
254028
254252
|
message: `Deploy site from ${project2.site.outputDirectory}?`
|
|
@@ -254198,10 +254422,6 @@ function getTypesCommand() {
|
|
|
254198
254422
|
return new Command("types").description("Manage TypeScript type generation").addCommand(getTypesGenerateCommand());
|
|
254199
254423
|
}
|
|
254200
254424
|
|
|
254201
|
-
// src/cli/commands/dev.ts
|
|
254202
|
-
import { join as join28 } from "node:path";
|
|
254203
|
-
import process21 from "node:process";
|
|
254204
|
-
|
|
254205
254425
|
// src/cli/dev/dev-server/main.ts
|
|
254206
254426
|
var import_cors = __toESM(require_lib4(), 1);
|
|
254207
254427
|
var import_express6 = __toESM(require_express(), 1);
|
|
@@ -254232,14 +254452,14 @@ var getLocalHosts = () => {
|
|
|
254232
254452
|
}
|
|
254233
254453
|
return results;
|
|
254234
254454
|
};
|
|
254235
|
-
var checkAvailablePort = (options8) => new Promise((
|
|
254455
|
+
var checkAvailablePort = (options8) => new Promise((resolve12, reject) => {
|
|
254236
254456
|
const server = net.createServer();
|
|
254237
254457
|
server.unref();
|
|
254238
254458
|
server.on("error", reject);
|
|
254239
254459
|
server.listen(options8, () => {
|
|
254240
254460
|
const { port } = server.address();
|
|
254241
254461
|
server.close(() => {
|
|
254242
|
-
|
|
254462
|
+
resolve12(port);
|
|
254243
254463
|
});
|
|
254244
254464
|
});
|
|
254245
254465
|
});
|
|
@@ -254357,12 +254577,11 @@ var stringify = (item) => {
|
|
|
254357
254577
|
return String(item);
|
|
254358
254578
|
}
|
|
254359
254579
|
};
|
|
254360
|
-
function createDevLogger() {
|
|
254580
|
+
function createDevLogger(label2, labelColor = theme.styles.dim) {
|
|
254581
|
+
const prefix = label2 ? `${labelColor(`[${label2}]`)} ` : "";
|
|
254361
254582
|
const print = (type, ...args) => {
|
|
254362
254583
|
const colorize = colorByType[type];
|
|
254363
|
-
console[type](
|
|
254364
|
-
return colorize(stringify(item));
|
|
254365
|
-
}));
|
|
254584
|
+
console[type](prefix + args.map((item) => colorize(stringify(item))).join(" "));
|
|
254366
254585
|
};
|
|
254367
254586
|
return {
|
|
254368
254587
|
log: (...args) => print("log", ...args),
|
|
@@ -254499,7 +254718,7 @@ class FunctionManager {
|
|
|
254499
254718
|
});
|
|
254500
254719
|
}
|
|
254501
254720
|
waitForReady(name2, runningFunc) {
|
|
254502
|
-
return new Promise((
|
|
254721
|
+
return new Promise((resolve12, reject) => {
|
|
254503
254722
|
runningFunc.process.on("exit", (code2) => {
|
|
254504
254723
|
if (!runningFunc.ready) {
|
|
254505
254724
|
clearTimeout(timeout3);
|
|
@@ -254522,7 +254741,7 @@ class FunctionManager {
|
|
|
254522
254741
|
runningFunc.ready = true;
|
|
254523
254742
|
clearTimeout(timeout3);
|
|
254524
254743
|
runningFunc.process.stdout?.off("data", onData);
|
|
254525
|
-
|
|
254744
|
+
resolve12(runningFunc.port);
|
|
254526
254745
|
}
|
|
254527
254746
|
};
|
|
254528
254747
|
runningFunc.process.stdout?.on("data", onData);
|
|
@@ -255729,6 +255948,109 @@ function createCustomIntegrationRoutes(remoteProxy, logger2) {
|
|
|
255729
255948
|
return router;
|
|
255730
255949
|
}
|
|
255731
255950
|
|
|
255951
|
+
// src/cli/dev/dev-server/serve-runner.ts
|
|
255952
|
+
import { spawn as spawn3 } from "node:child_process";
|
|
255953
|
+
import process21 from "node:process";
|
|
255954
|
+
|
|
255955
|
+
class ServeRunner {
|
|
255956
|
+
command;
|
|
255957
|
+
cwd;
|
|
255958
|
+
env;
|
|
255959
|
+
logger;
|
|
255960
|
+
child;
|
|
255961
|
+
stopping = false;
|
|
255962
|
+
stopPromise;
|
|
255963
|
+
exitListeners = [];
|
|
255964
|
+
constructor(options8) {
|
|
255965
|
+
this.command = options8.command;
|
|
255966
|
+
this.cwd = options8.cwd;
|
|
255967
|
+
this.env = options8.env;
|
|
255968
|
+
this.logger = options8.logger;
|
|
255969
|
+
}
|
|
255970
|
+
start() {
|
|
255971
|
+
if (this.child) {
|
|
255972
|
+
return;
|
|
255973
|
+
}
|
|
255974
|
+
const stdin2 = process21.platform === "win32" ? "ignore" : "inherit";
|
|
255975
|
+
const child = spawn3(this.command, {
|
|
255976
|
+
cwd: this.cwd,
|
|
255977
|
+
shell: true,
|
|
255978
|
+
detached: process21.platform !== "win32",
|
|
255979
|
+
env: { ...process21.env, ...this.env },
|
|
255980
|
+
stdio: [stdin2, "pipe", "pipe"],
|
|
255981
|
+
windowsHide: true
|
|
255982
|
+
});
|
|
255983
|
+
this.child = child;
|
|
255984
|
+
this.setupHandlers(child);
|
|
255985
|
+
}
|
|
255986
|
+
onExit(listener) {
|
|
255987
|
+
this.exitListeners.push(listener);
|
|
255988
|
+
}
|
|
255989
|
+
async stop() {
|
|
255990
|
+
if (this.stopPromise) {
|
|
255991
|
+
return this.stopPromise;
|
|
255992
|
+
}
|
|
255993
|
+
this.stopPromise = this.stopChild();
|
|
255994
|
+
return this.stopPromise;
|
|
255995
|
+
}
|
|
255996
|
+
async stopChild() {
|
|
255997
|
+
const child = this.child;
|
|
255998
|
+
if (!child || child.exitCode !== null) {
|
|
255999
|
+
return;
|
|
256000
|
+
}
|
|
256001
|
+
this.stopping = true;
|
|
256002
|
+
const exited = new Promise((resolve12) => child.once("exit", () => resolve12()));
|
|
256003
|
+
if (process21.platform === "win32" && child.pid) {
|
|
256004
|
+
const taskkill = spawn3("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
|
|
256005
|
+
stdio: "ignore",
|
|
256006
|
+
windowsHide: true
|
|
256007
|
+
});
|
|
256008
|
+
await new Promise((resolve12) => {
|
|
256009
|
+
taskkill.once("exit", () => resolve12());
|
|
256010
|
+
taskkill.once("error", () => resolve12());
|
|
256011
|
+
});
|
|
256012
|
+
} else if (child.pid) {
|
|
256013
|
+
try {
|
|
256014
|
+
process21.kill(-child.pid, "SIGTERM");
|
|
256015
|
+
} catch {
|
|
256016
|
+
child.kill();
|
|
256017
|
+
}
|
|
256018
|
+
}
|
|
256019
|
+
await exited;
|
|
256020
|
+
}
|
|
256021
|
+
setupHandlers(child) {
|
|
256022
|
+
child.stdout?.on("data", (data) => this.emitLines(data, "log"));
|
|
256023
|
+
child.stderr?.on("data", (data) => this.emitLines(data, "error"));
|
|
256024
|
+
child.on("error", (error48) => {
|
|
256025
|
+
this.logger.error("Frontend dev server failed to start:", error48);
|
|
256026
|
+
this.notifyExit(null);
|
|
256027
|
+
});
|
|
256028
|
+
child.on("exit", (code2) => {
|
|
256029
|
+
if (this.stopping) {
|
|
256030
|
+
return;
|
|
256031
|
+
}
|
|
256032
|
+
this.logger.error(`Frontend dev server exited with code ${code2}`);
|
|
256033
|
+
this.notifyExit(code2);
|
|
256034
|
+
});
|
|
256035
|
+
}
|
|
256036
|
+
notifyExit(code2) {
|
|
256037
|
+
for (const listener of this.exitListeners) {
|
|
256038
|
+
listener(code2);
|
|
256039
|
+
}
|
|
256040
|
+
}
|
|
256041
|
+
emitLines(data, type) {
|
|
256042
|
+
const lines = data.toString().trimEnd().split(`
|
|
256043
|
+
`);
|
|
256044
|
+
for (const line3 of lines) {
|
|
256045
|
+
if (type === "error") {
|
|
256046
|
+
this.logger.error(line3);
|
|
256047
|
+
} else {
|
|
256048
|
+
this.logger.log(line3);
|
|
256049
|
+
}
|
|
256050
|
+
}
|
|
256051
|
+
}
|
|
256052
|
+
}
|
|
256053
|
+
|
|
255732
256054
|
// src/cli/dev/dev-server/watcher.ts
|
|
255733
256055
|
import { EventEmitter as EventEmitter4 } from "node:events";
|
|
255734
256056
|
import { relative as relative6 } from "node:path";
|
|
@@ -256579,7 +256901,7 @@ class NodeFsHandler {
|
|
|
256579
256901
|
this._addToNodeFs(path19, initialAdd, wh2, depth + 1);
|
|
256580
256902
|
}
|
|
256581
256903
|
}).on(EV.ERROR, this._boundHandleError);
|
|
256582
|
-
return new Promise((
|
|
256904
|
+
return new Promise((resolve13, reject) => {
|
|
256583
256905
|
if (!stream)
|
|
256584
256906
|
return reject();
|
|
256585
256907
|
stream.once(STR_END, () => {
|
|
@@ -256588,7 +256910,7 @@ class NodeFsHandler {
|
|
|
256588
256910
|
return;
|
|
256589
256911
|
}
|
|
256590
256912
|
const wasThrottled = throttler ? throttler.clear() : false;
|
|
256591
|
-
|
|
256913
|
+
resolve13(undefined);
|
|
256592
256914
|
previous.getChildren().filter((item) => {
|
|
256593
256915
|
return item !== directory && !current.has(item);
|
|
256594
256916
|
}).forEach((item) => {
|
|
@@ -257434,7 +257756,7 @@ async function createDevServer(options8) {
|
|
|
257434
257756
|
port: process.env.IS_TEST === "true" ? undefined : DEFAULT_PORT
|
|
257435
257757
|
});
|
|
257436
257758
|
const baseUrl = `http://localhost:${port}`;
|
|
257437
|
-
const { functions, entities, project: project2 } = await options8.loadResources();
|
|
257759
|
+
const { functions, entities, project: project2, siteUrl } = await options8.loadResources();
|
|
257438
257760
|
const app = import_express6.default();
|
|
257439
257761
|
const remoteProxy = import_http_proxy_middleware2.createProxyMiddleware({
|
|
257440
257762
|
target: BASE44_APP_URL,
|
|
@@ -257452,17 +257774,17 @@ async function createDevServer(options8) {
|
|
|
257452
257774
|
}
|
|
257453
257775
|
next();
|
|
257454
257776
|
});
|
|
257455
|
-
const devLogger = createDevLogger();
|
|
257777
|
+
const devLogger = createDevLogger("backend", theme.styles.info);
|
|
257456
257778
|
const functionManager = new FunctionManager(functions, devLogger, options8.denoWrapperPath);
|
|
257457
257779
|
const functionRoutes = createFunctionRouter(functionManager, devLogger);
|
|
257458
257780
|
app.use("/api/apps/:appId/functions", functionRoutes);
|
|
257459
257781
|
if (functionManager.getFunctionNames().length > 0) {
|
|
257460
|
-
|
|
257782
|
+
devLogger.log(`Loaded functions: ${functionManager.getFunctionNames().join(", ")}`);
|
|
257461
257783
|
}
|
|
257462
257784
|
const db2 = new Database;
|
|
257463
257785
|
await db2.load(entities);
|
|
257464
257786
|
if (db2.getCollectionNames().length > 0) {
|
|
257465
|
-
|
|
257787
|
+
devLogger.log(`Loaded entities: ${db2.getCollectionNames().join(", ")}`);
|
|
257466
257788
|
}
|
|
257467
257789
|
let emitEntityEvent = () => {};
|
|
257468
257790
|
const entityRoutes = await createEntityRoutes(db2, devLogger, (...args) => emitEntityEvent(...args));
|
|
@@ -257494,12 +257816,18 @@ async function createDevServer(options8) {
|
|
|
257494
257816
|
const customIntegrationRoutes = createCustomIntegrationRoutes(remoteProxy, devLogger);
|
|
257495
257817
|
app.use("/api/apps/:appId/integrations/custom", customIntegrationRoutes);
|
|
257496
257818
|
app.use((req, res, next) => {
|
|
257819
|
+
if (siteUrl && (req.path === "/login" || req.path.startsWith("/login/"))) {
|
|
257820
|
+
const targetUrl = new URL(req.originalUrl, siteUrl);
|
|
257821
|
+
devLogger.warn(`"${req.originalUrl}" requires hosted login, redirecting to ${targetUrl.toString()}`);
|
|
257822
|
+
res.redirect(targetUrl.toString());
|
|
257823
|
+
return;
|
|
257824
|
+
}
|
|
257497
257825
|
if (!req.originalUrl.endsWith("analytics/track/batch")) {
|
|
257498
257826
|
devLogger.warn(`"${req.originalUrl}" is not supported in local development, passing call to production`);
|
|
257499
257827
|
}
|
|
257500
257828
|
remoteProxy(req, res, next);
|
|
257501
257829
|
});
|
|
257502
|
-
const server = await new Promise((
|
|
257830
|
+
const server = await new Promise((resolve14, reject) => {
|
|
257503
257831
|
const s5 = app.listen(port, "127.0.0.1", (err) => {
|
|
257504
257832
|
if (err) {
|
|
257505
257833
|
if ("code" in err && err.code === "EADDRINUSE") {
|
|
@@ -257508,7 +257836,7 @@ async function createDevServer(options8) {
|
|
|
257508
257836
|
reject(err);
|
|
257509
257837
|
}
|
|
257510
257838
|
} else {
|
|
257511
|
-
|
|
257839
|
+
resolve14(s5);
|
|
257512
257840
|
}
|
|
257513
257841
|
});
|
|
257514
257842
|
});
|
|
@@ -257550,59 +257878,101 @@ async function createDevServer(options8) {
|
|
|
257550
257878
|
}
|
|
257551
257879
|
});
|
|
257552
257880
|
await base44ConfigWatcher.start();
|
|
257553
|
-
const
|
|
257881
|
+
const serveCommand = project2.site?.serveCommand;
|
|
257882
|
+
let serveRunner;
|
|
257883
|
+
if (options8.appId && serveCommand) {
|
|
257884
|
+
serveRunner = new ServeRunner({
|
|
257885
|
+
command: serveCommand,
|
|
257886
|
+
cwd: project2.root,
|
|
257887
|
+
env: {
|
|
257888
|
+
VITE_BASE44_APP_ID: options8.appId,
|
|
257889
|
+
VITE_BASE44_APP_BASE_URL: baseUrl
|
|
257890
|
+
},
|
|
257891
|
+
logger: createDevLogger("frontend", theme.colors.base44Orange)
|
|
257892
|
+
});
|
|
257893
|
+
}
|
|
257894
|
+
const handleShutdownError = (error48) => {
|
|
257895
|
+
const errorMessage = error48 instanceof Error ? error48.message : String(error48);
|
|
257896
|
+
devLogger.error(`Failed to shut down dev server: ${errorMessage}`);
|
|
257897
|
+
};
|
|
257898
|
+
const closeServerIfRunning = async () => {
|
|
257899
|
+
if (!server.listening) {
|
|
257900
|
+
return;
|
|
257901
|
+
}
|
|
257902
|
+
await new Promise((resolve14, reject) => {
|
|
257903
|
+
server.close((error48) => {
|
|
257904
|
+
if (error48) {
|
|
257905
|
+
reject(error48);
|
|
257906
|
+
return;
|
|
257907
|
+
}
|
|
257908
|
+
resolve14();
|
|
257909
|
+
});
|
|
257910
|
+
});
|
|
257911
|
+
};
|
|
257912
|
+
const runShutdown = async () => {
|
|
257554
257913
|
base44ConfigWatcher.close();
|
|
257555
|
-
io6.close();
|
|
257914
|
+
await io6.close();
|
|
257556
257915
|
await functionManager.stopAll();
|
|
257557
|
-
|
|
257916
|
+
await serveRunner?.stop();
|
|
257917
|
+
await closeServerIfRunning();
|
|
257918
|
+
};
|
|
257919
|
+
let shutdownPromise;
|
|
257920
|
+
const shutdown = () => {
|
|
257921
|
+
shutdownPromise ??= runShutdown().catch(handleShutdownError);
|
|
257922
|
+
return shutdownPromise;
|
|
257558
257923
|
};
|
|
257559
257924
|
process.on("SIGINT", shutdown);
|
|
257560
257925
|
process.on("SIGTERM", shutdown);
|
|
257561
|
-
|
|
257926
|
+
serveRunner?.onExit(() => {
|
|
257927
|
+
shutdown().finally(() => process.exit(1));
|
|
257928
|
+
});
|
|
257929
|
+
if (serveRunner) {
|
|
257930
|
+
devLogger.log(`Backend running on ${baseUrl}`);
|
|
257931
|
+
serveRunner.start();
|
|
257932
|
+
}
|
|
257933
|
+
return { port, server, isServingFrontend: serveRunner !== undefined };
|
|
257562
257934
|
}
|
|
257563
257935
|
|
|
257564
257936
|
// src/cli/commands/dev.ts
|
|
257565
257937
|
function localServerUrl(port) {
|
|
257566
257938
|
return `http://localhost:${port}`;
|
|
257567
257939
|
}
|
|
257568
|
-
|
|
257569
|
-
const
|
|
257570
|
-
if (
|
|
257571
|
-
|
|
257940
|
+
function validateDevOptions(command2) {
|
|
257941
|
+
const { appId } = command2.optsWithGlobals();
|
|
257942
|
+
if (appId !== undefined) {
|
|
257943
|
+
command2.error(`base44 dev cannot be used with --app-id or ${BASE44_APP_ID_ENV_VAR}.`);
|
|
257572
257944
|
}
|
|
257573
|
-
const { id: appId } = await initAppContext();
|
|
257574
|
-
await writeFile(envLocalPath, `VITE_BASE44_APP_ID=${appId}
|
|
257575
|
-
VITE_BASE44_APP_BASE_URL=${localServerUrl(port)}
|
|
257576
|
-
`);
|
|
257577
|
-
log.info("Created .env.local with app ID and dev server URL");
|
|
257578
257945
|
}
|
|
257579
|
-
async function devAction(
|
|
257946
|
+
async function devAction(ctx, options8) {
|
|
257947
|
+
const { log, app } = ctx;
|
|
257948
|
+
if (!app?.projectRoot) {
|
|
257949
|
+
throw new ConfigInvalidError("base44 dev requires a linked local project. Run it from a project with base44/.app.jsonc.");
|
|
257950
|
+
}
|
|
257580
257951
|
const port = options8.port ? Number(options8.port) : undefined;
|
|
257581
|
-
|
|
257582
|
-
const
|
|
257952
|
+
const appId = app.id;
|
|
257953
|
+
const siteUrlPromise = getSiteUrl().catch(() => {
|
|
257954
|
+
return;
|
|
257955
|
+
});
|
|
257956
|
+
const { port: resolvedPort, isServingFrontend } = await createDevServer({
|
|
257583
257957
|
log,
|
|
257584
257958
|
port,
|
|
257585
|
-
|
|
257959
|
+
appId,
|
|
257586
257960
|
denoWrapperPath: getDenoWrapperPath(),
|
|
257587
257961
|
loadResources: async () => {
|
|
257588
257962
|
const { functions, entities, project: project2 } = await readProjectConfig();
|
|
257589
|
-
|
|
257590
|
-
return { functions, entities, project: project2 };
|
|
257963
|
+
const siteUrl = await siteUrlPromise;
|
|
257964
|
+
return { functions, entities, project: project2, siteUrl };
|
|
257591
257965
|
}
|
|
257592
257966
|
});
|
|
257593
|
-
|
|
257594
|
-
|
|
257595
|
-
}
|
|
257596
|
-
return {
|
|
257597
|
-
outroMessage: `Dev server is available at ${theme.colors.links(localServerUrl(resolvedPort))}`
|
|
257598
|
-
};
|
|
257967
|
+
const outroMessage = isServingFrontend ? "Open your app using the frontend dev server URL" : `Dev server is available at ${theme.colors.links(localServerUrl(resolvedPort))}`;
|
|
257968
|
+
return { outroMessage };
|
|
257599
257969
|
}
|
|
257600
257970
|
function getDevCommand() {
|
|
257601
|
-
return new Base44Command("dev").description("Start the development server").option("-p, --port <number>", "Port for the development server").action(devAction);
|
|
257971
|
+
return new Base44Command("dev").description("Start the development server").option("-p, --port <number>", "Port for the development server").hook("preAction", validateDevOptions).action(devAction);
|
|
257602
257972
|
}
|
|
257603
257973
|
|
|
257604
257974
|
// src/core/exec/run-script.ts
|
|
257605
|
-
import { spawn as
|
|
257975
|
+
import { spawn as spawn4 } from "node:child_process";
|
|
257606
257976
|
import { copyFileSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
257607
257977
|
async function runScript(options8) {
|
|
257608
257978
|
const { appId, code: code2 } = options8;
|
|
@@ -257621,7 +257991,7 @@ async function runScript(options8) {
|
|
|
257621
257991
|
copyFileSync(getExecWrapperPath(), tempWrapper.path);
|
|
257622
257992
|
try {
|
|
257623
257993
|
const exitCode = await new Promise((resolvePromise) => {
|
|
257624
|
-
const child =
|
|
257994
|
+
const child = spawn4("deno", ["run", "--allow-all", "--node-modules-dir=auto", tempWrapper.path], {
|
|
257625
257995
|
env: {
|
|
257626
257996
|
...process.env,
|
|
257627
257997
|
SCRIPT_PATH: scriptPath,
|
|
@@ -257644,17 +258014,20 @@ async function runScript(options8) {
|
|
|
257644
258014
|
}
|
|
257645
258015
|
// src/cli/commands/exec.ts
|
|
257646
258016
|
function readStdin2() {
|
|
257647
|
-
return new Promise((
|
|
258017
|
+
return new Promise((resolve14, reject) => {
|
|
257648
258018
|
let data = "";
|
|
257649
258019
|
process.stdin.setEncoding("utf-8");
|
|
257650
258020
|
process.stdin.on("data", (chunk) => {
|
|
257651
258021
|
data += chunk;
|
|
257652
258022
|
});
|
|
257653
|
-
process.stdin.on("end", () =>
|
|
258023
|
+
process.stdin.on("end", () => resolve14(data));
|
|
257654
258024
|
process.stdin.on("error", reject);
|
|
257655
258025
|
});
|
|
257656
258026
|
}
|
|
257657
|
-
async function execAction(
|
|
258027
|
+
async function execAction({
|
|
258028
|
+
app,
|
|
258029
|
+
isNonInteractive
|
|
258030
|
+
}) {
|
|
257658
258031
|
const noInputError = new InvalidInputError("No input provided. Pipe a script to stdin.", {
|
|
257659
258032
|
hints: [
|
|
257660
258033
|
{ message: "File: cat ./script.ts | base44 exec" },
|
|
@@ -257670,7 +258043,7 @@ async function execAction(isNonInteractive) {
|
|
|
257670
258043
|
if (!code2.trim()) {
|
|
257671
258044
|
throw noInputError;
|
|
257672
258045
|
}
|
|
257673
|
-
const { exitCode } = await runScript({ appId:
|
|
258046
|
+
const { exitCode } = await runScript({ appId: app.id, code: code2 });
|
|
257674
258047
|
if (exitCode !== 0) {
|
|
257675
258048
|
process.exitCode = exitCode;
|
|
257676
258049
|
}
|
|
@@ -257683,18 +258056,26 @@ Examples:
|
|
|
257683
258056
|
$ cat ./script.ts | base44 exec
|
|
257684
258057
|
|
|
257685
258058
|
Inline script:
|
|
257686
|
-
$ echo "const users = await base44.entities.User.list()" | base44 exec`).action(async (
|
|
257687
|
-
return await execAction(
|
|
258059
|
+
$ echo "const users = await base44.entities.User.list()" | base44 exec`).action(async (ctx) => {
|
|
258060
|
+
return await execAction(ctx);
|
|
257688
258061
|
});
|
|
257689
258062
|
}
|
|
257690
258063
|
|
|
257691
258064
|
// src/cli/commands/project/eject.ts
|
|
257692
|
-
import { resolve as
|
|
258065
|
+
import { resolve as resolve14 } from "node:path";
|
|
257693
258066
|
var import_kebabCase2 = __toESM(require_kebabCase(), 1);
|
|
257694
|
-
async function eject(ctx, options8) {
|
|
258067
|
+
async function eject(ctx, options8, command2) {
|
|
257695
258068
|
const { log, runTask: runTask2, isNonInteractive } = ctx;
|
|
257696
|
-
|
|
257697
|
-
|
|
258069
|
+
const {
|
|
258070
|
+
appId,
|
|
258071
|
+
legacyProjectId,
|
|
258072
|
+
value: selectedAppId
|
|
258073
|
+
} = readExplicitAppId(command2);
|
|
258074
|
+
if (appId && legacyProjectId) {
|
|
258075
|
+
throw new InvalidInputError("--app-id and --project-id cannot be used together");
|
|
258076
|
+
}
|
|
258077
|
+
if (isNonInteractive && !selectedAppId) {
|
|
258078
|
+
throw new InvalidInputError("--app-id is required in non-interactive mode");
|
|
257698
258079
|
}
|
|
257699
258080
|
if (isNonInteractive && !options8.path) {
|
|
257700
258081
|
throw new InvalidInputError("--path is required in non-interactive mode");
|
|
@@ -257702,13 +258083,13 @@ async function eject(ctx, options8) {
|
|
|
257702
258083
|
const projects = await listProjects();
|
|
257703
258084
|
const ejectableProjects = projects.filter((p4) => p4.isManagedSourceCode !== false);
|
|
257704
258085
|
let selectedProject;
|
|
257705
|
-
if (
|
|
257706
|
-
const foundProject = ejectableProjects.find((p4) => p4.id ===
|
|
258086
|
+
if (selectedAppId) {
|
|
258087
|
+
const foundProject = ejectableProjects.find((p4) => p4.id === selectedAppId);
|
|
257707
258088
|
if (!foundProject) {
|
|
257708
|
-
throw new InvalidInputError(`
|
|
258089
|
+
throw new InvalidInputError(`App with ID "${selectedAppId}" not found or not ejectable`, {
|
|
257709
258090
|
hints: [
|
|
257710
258091
|
{
|
|
257711
|
-
message: "Run 'base44 eject' without --
|
|
258092
|
+
message: "Run 'base44 eject' without --app-id to see available projects"
|
|
257712
258093
|
}
|
|
257713
258094
|
]
|
|
257714
258095
|
});
|
|
@@ -257745,7 +258126,7 @@ async function eject(ctx, options8) {
|
|
|
257745
258126
|
Ne("Operation cancelled.");
|
|
257746
258127
|
throw new CLIExitError(0);
|
|
257747
258128
|
}
|
|
257748
|
-
const resolvedPath =
|
|
258129
|
+
const resolvedPath = resolve14(selectedPath);
|
|
257749
258130
|
await runTask2("Downloading your project's code...", async (updateMessage) => {
|
|
257750
258131
|
await createProjectFilesForExistingProject({
|
|
257751
258132
|
projectId,
|
|
@@ -257784,13 +258165,15 @@ async function eject(ctx, options8) {
|
|
|
257784
258165
|
return { outroMessage: "Your new project is set and ready to use" };
|
|
257785
258166
|
}
|
|
257786
258167
|
function getEjectCommand() {
|
|
257787
|
-
return new Base44Command("eject", {
|
|
258168
|
+
return new Base44Command("eject", {
|
|
258169
|
+
requireAppContext: false
|
|
258170
|
+
}).description("Download the code for an existing Base44 project").configureHelp({ showGlobalOptions: true }).option("-p, --path <path>", "Path where to write the project").option("-y, --yes", "Skip confirmation prompts").addOption(new Option("--project-id <id>", "Project ID to eject (skips interactive selection)").hideHelp()).action(eject);
|
|
257788
258171
|
}
|
|
257789
258172
|
|
|
257790
258173
|
// src/cli/program.ts
|
|
257791
258174
|
function createProgram(context) {
|
|
257792
258175
|
const program2 = new Command;
|
|
257793
|
-
program2.name("base44").description("Base44 CLI - Unified interface for managing Base44 applications").version(package_default.version);
|
|
258176
|
+
program2.name("base44").description("Base44 CLI - Unified interface for managing Base44 applications").version(package_default.version).addOption(new Option("--app-id <id>", "Base44 app ID to use").env(BASE44_APP_ID_ENV_VAR)).addOption(new Option("--json", "Output machine-readable JSON to stdout (status/logs go to stderr)"));
|
|
257794
258177
|
program2.configureHelp({
|
|
257795
258178
|
sortSubcommands: true
|
|
257796
258179
|
});
|
|
@@ -257818,7 +258201,7 @@ function createProgram(context) {
|
|
|
257818
258201
|
program2.addCommand(getSiteCommand());
|
|
257819
258202
|
program2.addCommand(getTypesCommand());
|
|
257820
258203
|
program2.addCommand(getExecCommand());
|
|
257821
|
-
program2.addCommand(getDevCommand()
|
|
258204
|
+
program2.addCommand(getDevCommand());
|
|
257822
258205
|
program2.addCommand(getLogsCommand());
|
|
257823
258206
|
return program2;
|
|
257824
258207
|
}
|
|
@@ -260115,14 +260498,14 @@ async function addSourceContext(frames) {
|
|
|
260115
260498
|
return frames;
|
|
260116
260499
|
}
|
|
260117
260500
|
function getContextLinesFromFile(path19, ranges, output) {
|
|
260118
|
-
return new Promise((
|
|
260501
|
+
return new Promise((resolve15) => {
|
|
260119
260502
|
const stream = createReadStream2(path19);
|
|
260120
260503
|
const lineReaded = createInterface2({
|
|
260121
260504
|
input: stream
|
|
260122
260505
|
});
|
|
260123
260506
|
function destroyStreamAndResolve() {
|
|
260124
260507
|
stream.destroy();
|
|
260125
|
-
|
|
260508
|
+
resolve15();
|
|
260126
260509
|
}
|
|
260127
260510
|
let lineNumber = 0;
|
|
260128
260511
|
let currentRangeIndex = 0;
|
|
@@ -261041,9 +261424,9 @@ function matchPropertyGroup(propertyGroup, propertyValues, cohortProperties, deb
|
|
|
261041
261424
|
throw new InconclusiveMatchError("can't match cohort without a given cohort property value");
|
|
261042
261425
|
return propertyGroupType === "AND";
|
|
261043
261426
|
}
|
|
261044
|
-
function isValidRegex(
|
|
261427
|
+
function isValidRegex(regex2) {
|
|
261045
261428
|
try {
|
|
261046
|
-
new RegExp(
|
|
261429
|
+
new RegExp(regex2);
|
|
261047
261430
|
return true;
|
|
261048
261431
|
} catch (err) {
|
|
261049
261432
|
return false;
|
|
@@ -261061,8 +261444,8 @@ function convertToDateTime(value) {
|
|
|
261061
261444
|
throw new InconclusiveMatchError(`The date provided ${value} must be a string, number, or date object`);
|
|
261062
261445
|
}
|
|
261063
261446
|
function relativeDateParseForFeatureFlagMatching(value) {
|
|
261064
|
-
const
|
|
261065
|
-
const match = value.match(
|
|
261447
|
+
const regex2 = /^-?(?<number>[0-9]+)(?<interval>[a-z])$/;
|
|
261448
|
+
const match = value.match(regex2);
|
|
261066
261449
|
const parsedDt = new Date(new Date().toISOString());
|
|
261067
261450
|
if (!match)
|
|
261068
261451
|
return null;
|
|
@@ -261234,15 +261617,15 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
261234
261617
|
return true;
|
|
261235
261618
|
if (this.featureFlagsPoller === undefined)
|
|
261236
261619
|
return false;
|
|
261237
|
-
return new Promise((
|
|
261620
|
+
return new Promise((resolve15) => {
|
|
261238
261621
|
const timeout3 = setTimeout(() => {
|
|
261239
261622
|
cleanup();
|
|
261240
|
-
|
|
261623
|
+
resolve15(false);
|
|
261241
261624
|
}, timeoutMs);
|
|
261242
261625
|
const cleanup = this._events.on("localEvaluationFlagsLoaded", (count2) => {
|
|
261243
261626
|
clearTimeout(timeout3);
|
|
261244
261627
|
cleanup();
|
|
261245
|
-
|
|
261628
|
+
resolve15(count2 > 0);
|
|
261246
261629
|
});
|
|
261247
261630
|
});
|
|
261248
261631
|
}
|
|
@@ -262028,15 +262411,17 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
|
|
|
262028
262411
|
// src/cli/index.ts
|
|
262029
262412
|
var __dirname4 = dirname23(fileURLToPath6(import.meta.url));
|
|
262030
262413
|
async function runCLI(options8) {
|
|
262031
|
-
ensureNpmAssets(
|
|
262414
|
+
ensureNpmAssets(join28(__dirname4, "../assets"));
|
|
262032
262415
|
const errorReporter = new ErrorReporter;
|
|
262033
262416
|
errorReporter.registerProcessErrorHandlers();
|
|
262034
|
-
const
|
|
262417
|
+
const jsonMode = process.argv.includes("--json");
|
|
262418
|
+
const isNonInteractive = !process.stdin.isTTY || !process.stdout.isTTY || jsonMode;
|
|
262035
262419
|
const log = isNonInteractive ? new SimpleLogger : new ClackLogger;
|
|
262036
262420
|
const runTask2 = isNonInteractive ? createSimpleRunTask(log) : createInteractiveRunTask();
|
|
262037
262421
|
const context = {
|
|
262038
262422
|
errorReporter,
|
|
262039
262423
|
isNonInteractive,
|
|
262424
|
+
jsonMode,
|
|
262040
262425
|
distribution: options8?.distribution ?? "npm",
|
|
262041
262426
|
log,
|
|
262042
262427
|
runTask: runTask2
|
|
@@ -262065,4 +262450,4 @@ export {
|
|
|
262065
262450
|
CLIExitError
|
|
262066
262451
|
};
|
|
262067
262452
|
|
|
262068
|
-
//# debugId=
|
|
262453
|
+
//# debugId=C107ED30593A378964756E2164756E21
|