@base44-preview/cli 0.0.37-pr.365.290ff33 → 0.0.38-pr.330.d128357
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +609 -289
- package/dist/cli/index.js.map +25 -20
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -8933,10 +8933,10 @@ var require_ejs = __commonJS((exports) => {
|
|
|
8933
8933
|
exports.localsName = _DEFAULT_LOCALS_NAME;
|
|
8934
8934
|
exports.promiseImpl = new Function("return this;")().Promise;
|
|
8935
8935
|
exports.resolveInclude = function(name2, filename, isDir) {
|
|
8936
|
-
var
|
|
8936
|
+
var dirname7 = path11.dirname;
|
|
8937
8937
|
var extname = path11.extname;
|
|
8938
8938
|
var resolve = path11.resolve;
|
|
8939
|
-
var includePath = resolve(isDir ? filename :
|
|
8939
|
+
var includePath = resolve(isDir ? filename : dirname7(filename), name2);
|
|
8940
8940
|
var ext = extname(name2);
|
|
8941
8941
|
if (!ext) {
|
|
8942
8942
|
includePath += ".ejs";
|
|
@@ -12652,8 +12652,8 @@ var require_main = __commonJS((exports, module) => {
|
|
|
12652
12652
|
const shortPaths = [];
|
|
12653
12653
|
for (const filePath of optionPaths) {
|
|
12654
12654
|
try {
|
|
12655
|
-
const
|
|
12656
|
-
shortPaths.push(
|
|
12655
|
+
const relative3 = path11.relative(process.cwd(), filePath);
|
|
12656
|
+
shortPaths.push(relative3);
|
|
12657
12657
|
} catch (e2) {
|
|
12658
12658
|
if (debug) {
|
|
12659
12659
|
_debug(`Failed to load ${filePath} ${e2.message}`);
|
|
@@ -18040,7 +18040,7 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
18040
18040
|
}
|
|
18041
18041
|
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
|
|
18042
18042
|
});
|
|
18043
|
-
function
|
|
18043
|
+
function join14(array2, separator) {
|
|
18044
18044
|
return array2 == null ? "" : nativeJoin.call(array2, separator);
|
|
18045
18045
|
}
|
|
18046
18046
|
function last(array2) {
|
|
@@ -18062,7 +18062,7 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
18062
18062
|
function nth(array2, n2) {
|
|
18063
18063
|
return array2 && array2.length ? baseNth(array2, toInteger(n2)) : undefined2;
|
|
18064
18064
|
}
|
|
18065
|
-
var
|
|
18065
|
+
var pull2 = baseRest(pullAll);
|
|
18066
18066
|
function pullAll(array2, values2) {
|
|
18067
18067
|
return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2) : array2;
|
|
18068
18068
|
}
|
|
@@ -19827,7 +19827,7 @@ __p += '`;
|
|
|
19827
19827
|
lodash.pickBy = pickBy;
|
|
19828
19828
|
lodash.property = property;
|
|
19829
19829
|
lodash.propertyOf = propertyOf;
|
|
19830
|
-
lodash.pull =
|
|
19830
|
+
lodash.pull = pull2;
|
|
19831
19831
|
lodash.pullAll = pullAll;
|
|
19832
19832
|
lodash.pullAllBy = pullAllBy;
|
|
19833
19833
|
lodash.pullAllWith = pullAllWith;
|
|
@@ -19972,7 +19972,7 @@ __p += '`;
|
|
|
19972
19972
|
lodash.isUndefined = isUndefined;
|
|
19973
19973
|
lodash.isWeakMap = isWeakMap;
|
|
19974
19974
|
lodash.isWeakSet = isWeakSet;
|
|
19975
|
-
lodash.join =
|
|
19975
|
+
lodash.join = join14;
|
|
19976
19976
|
lodash.kebabCase = kebabCase2;
|
|
19977
19977
|
lodash.last = last;
|
|
19978
19978
|
lodash.lastIndexOf = lastIndexOf;
|
|
@@ -20601,7 +20601,7 @@ function cleanDoc(doc2) {
|
|
|
20601
20601
|
return mapDoc(doc2, (currentDoc) => cleanDocFn(currentDoc));
|
|
20602
20602
|
}
|
|
20603
20603
|
function replaceEndOfLine(doc2, replacement = literalline) {
|
|
20604
|
-
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
20604
|
+
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ? join14(replacement, currentDoc.split(`
|
|
20605
20605
|
`)) : currentDoc);
|
|
20606
20606
|
}
|
|
20607
20607
|
function canBreakFn(doc2) {
|
|
@@ -20681,7 +20681,7 @@ function indentIfBreak(contents, options) {
|
|
|
20681
20681
|
negate: options.negate
|
|
20682
20682
|
};
|
|
20683
20683
|
}
|
|
20684
|
-
function
|
|
20684
|
+
function join14(separator, docs) {
|
|
20685
20685
|
assertDoc(separator);
|
|
20686
20686
|
assertDocArray(docs);
|
|
20687
20687
|
const parts = [];
|
|
@@ -21392,7 +21392,7 @@ var init_doc = __esm(() => {
|
|
|
21392
21392
|
MODE_FLAT = Symbol("MODE_FLAT");
|
|
21393
21393
|
DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
|
|
21394
21394
|
builders = {
|
|
21395
|
-
join:
|
|
21395
|
+
join: join14,
|
|
21396
21396
|
line,
|
|
21397
21397
|
softline,
|
|
21398
21398
|
hardline,
|
|
@@ -110477,9 +110477,9 @@ function getMessage2(key2, parameters, self2) {
|
|
|
110477
110477
|
assert22.ok(message.length <= parameters.length, `Code: ${key2}; The provided arguments length (${parameters.length}) does not match the required ones (${message.length}).`);
|
|
110478
110478
|
return Reflect.apply(message, self2, parameters);
|
|
110479
110479
|
}
|
|
110480
|
-
const
|
|
110480
|
+
const regex = /%[dfijoOs]/g;
|
|
110481
110481
|
let expectedLength = 0;
|
|
110482
|
-
while (
|
|
110482
|
+
while (regex.exec(message) !== null)
|
|
110483
110483
|
expectedLength++;
|
|
110484
110484
|
assert22.ok(expectedLength === parameters.length, `Code: ${key2}; The provided arguments length (${parameters.length}) does not match the required ones (${expectedLength}).`);
|
|
110485
110485
|
if (parameters.length === 0)
|
|
@@ -111380,9 +111380,9 @@ function convertEndOfLineOptionToCharacter2(endOfLineOption) {
|
|
|
111380
111380
|
return endOfLineOption === OPTION_CR2 ? CHARACTER_CR2 : endOfLineOption === OPTION_CRLF2 ? CHARACTER_CRLF2 : DEFAULT_EOL2;
|
|
111381
111381
|
}
|
|
111382
111382
|
function countEndOfLineCharacters(text, endOfLineCharacter) {
|
|
111383
|
-
const
|
|
111383
|
+
const regex = regexps.get(endOfLineCharacter);
|
|
111384
111384
|
if (false) {}
|
|
111385
|
-
return text.match(
|
|
111385
|
+
return text.match(regex)?.length ?? 0;
|
|
111386
111386
|
}
|
|
111387
111387
|
function normalizeEndOfLine(text) {
|
|
111388
111388
|
return method_replace_all_default2(0, text, END_OF_LINE_REGEXP, CHARACTER_LF2);
|
|
@@ -113584,8 +113584,8 @@ function legacyIsNextLineEmpty(text, node, locEnd) {
|
|
|
113584
113584
|
}
|
|
113585
113585
|
function makeString(rawText, enclosingQuote, unescapeUnnecessaryEscapes) {
|
|
113586
113586
|
const otherQuote = enclosingQuote === '"' ? "'" : '"';
|
|
113587
|
-
const
|
|
113588
|
-
const raw2 = method_replace_all_default2(0, rawText,
|
|
113587
|
+
const regex = /\\(.)|(["'])/gsu;
|
|
113588
|
+
const raw2 = method_replace_all_default2(0, rawText, regex, (match, escaped, quote) => {
|
|
113589
113589
|
if (escaped === otherQuote) {
|
|
113590
113590
|
return escaped;
|
|
113591
113591
|
}
|
|
@@ -117006,17 +117006,17 @@ var init_prettier = __esm(() => {
|
|
|
117006
117006
|
}
|
|
117007
117007
|
const opts = options8 || {};
|
|
117008
117008
|
const posix = utils3.isWindows(options8);
|
|
117009
|
-
const
|
|
117010
|
-
const state =
|
|
117011
|
-
delete
|
|
117009
|
+
const regex = isState ? picomatch.compileRe(glob, options8) : picomatch.makeRe(glob, options8, false, true);
|
|
117010
|
+
const state = regex.state;
|
|
117011
|
+
delete regex.state;
|
|
117012
117012
|
let isIgnored2 = () => false;
|
|
117013
117013
|
if (opts.ignore) {
|
|
117014
117014
|
const ignoreOpts = { ...options8, ignore: null, onMatch: null, onResult: null };
|
|
117015
117015
|
isIgnored2 = picomatch(opts.ignore, ignoreOpts, returnState);
|
|
117016
117016
|
}
|
|
117017
117017
|
const matcher = (input, returnObject = false) => {
|
|
117018
|
-
const { isMatch, match, output } = picomatch.test(input,
|
|
117019
|
-
const result = { glob, state, regex
|
|
117018
|
+
const { isMatch, match, output } = picomatch.test(input, regex, options8, { glob, posix });
|
|
117019
|
+
const result = { glob, state, regex, posix, input, output, match, isMatch };
|
|
117020
117020
|
if (typeof opts.onResult === "function") {
|
|
117021
117021
|
opts.onResult(result);
|
|
117022
117022
|
}
|
|
@@ -117041,7 +117041,7 @@ var init_prettier = __esm(() => {
|
|
|
117041
117041
|
}
|
|
117042
117042
|
return matcher;
|
|
117043
117043
|
};
|
|
117044
|
-
picomatch.test = (input,
|
|
117044
|
+
picomatch.test = (input, regex, options8, { glob, posix } = {}) => {
|
|
117045
117045
|
if (typeof input !== "string") {
|
|
117046
117046
|
throw new TypeError("Expected input to be a string");
|
|
117047
117047
|
}
|
|
@@ -117058,16 +117058,16 @@ var init_prettier = __esm(() => {
|
|
|
117058
117058
|
}
|
|
117059
117059
|
if (match === false || opts.capture === true) {
|
|
117060
117060
|
if (opts.matchBase === true || opts.basename === true) {
|
|
117061
|
-
match = picomatch.matchBase(input,
|
|
117061
|
+
match = picomatch.matchBase(input, regex, options8, posix);
|
|
117062
117062
|
} else {
|
|
117063
|
-
match =
|
|
117063
|
+
match = regex.exec(output);
|
|
117064
117064
|
}
|
|
117065
117065
|
}
|
|
117066
117066
|
return { isMatch: Boolean(match), match, output };
|
|
117067
117067
|
};
|
|
117068
117068
|
picomatch.matchBase = (input, glob, options8, posix = utils3.isWindows(options8)) => {
|
|
117069
|
-
const
|
|
117070
|
-
return
|
|
117069
|
+
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options8);
|
|
117070
|
+
return regex.test(path152.basename(input));
|
|
117071
117071
|
};
|
|
117072
117072
|
picomatch.isMatch = (str, patterns, options8) => picomatch(patterns, options8)(str);
|
|
117073
117073
|
picomatch.parse = (pattern, options8) => {
|
|
@@ -117087,11 +117087,11 @@ var init_prettier = __esm(() => {
|
|
|
117087
117087
|
if (state && state.negated === true) {
|
|
117088
117088
|
source2 = `^(?!${source2}).*$`;
|
|
117089
117089
|
}
|
|
117090
|
-
const
|
|
117090
|
+
const regex = picomatch.toRegex(source2, options8);
|
|
117091
117091
|
if (returnState === true) {
|
|
117092
|
-
|
|
117092
|
+
regex.state = state;
|
|
117093
117093
|
}
|
|
117094
|
-
return
|
|
117094
|
+
return regex;
|
|
117095
117095
|
};
|
|
117096
117096
|
picomatch.makeRe = (input, options8 = {}, returnOutput = false, returnState = false) => {
|
|
117097
117097
|
if (!input || typeof input !== "string") {
|
|
@@ -117255,8 +117255,8 @@ var init_prettier = __esm(() => {
|
|
|
117255
117255
|
};
|
|
117256
117256
|
micromatch2.capture = (glob, input, options8) => {
|
|
117257
117257
|
let posix = utils3.isWindows(options8);
|
|
117258
|
-
let
|
|
117259
|
-
let match =
|
|
117258
|
+
let regex = picomatch.makeRe(String(glob), { ...options8, capture: true });
|
|
117259
|
+
let match = regex.exec(posix ? utils3.toPosixSlashes(input) : input);
|
|
117260
117260
|
if (match) {
|
|
117261
117261
|
return match.slice(1).map((v10) => v10 === undefined ? "" : v10);
|
|
117262
117262
|
}
|
|
@@ -117434,15 +117434,15 @@ var init_prettier = __esm(() => {
|
|
|
117434
117434
|
exports.removeDuplicateSlashes = removeDuplicateSlashes;
|
|
117435
117435
|
function partitionAbsoluteAndRelative(patterns) {
|
|
117436
117436
|
const absolute = [];
|
|
117437
|
-
const
|
|
117437
|
+
const relative22 = [];
|
|
117438
117438
|
for (const pattern of patterns) {
|
|
117439
117439
|
if (isAbsolute2(pattern)) {
|
|
117440
117440
|
absolute.push(pattern);
|
|
117441
117441
|
} else {
|
|
117442
|
-
|
|
117442
|
+
relative22.push(pattern);
|
|
117443
117443
|
}
|
|
117444
117444
|
}
|
|
117445
|
-
return [absolute,
|
|
117445
|
+
return [absolute, relative22];
|
|
117446
117446
|
}
|
|
117447
117447
|
exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
|
|
117448
117448
|
function isAbsolute2(pattern) {
|
|
@@ -121695,7 +121695,7 @@ globstar while`, file2, fr10, pattern, pr8, swallowee);
|
|
|
121695
121695
|
};
|
|
121696
121696
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
121697
121697
|
var fs42 = __importStar(__require2("fs"));
|
|
121698
|
-
var
|
|
121698
|
+
var regex = {
|
|
121699
121699
|
section: /^\s*\[(([^#;]|\\#|\\;)+)\]\s*([#;].*)?$/,
|
|
121700
121700
|
param: /^\s*([\w\.\-\_]+)\s*[=:]\s*(.*?)\s*([#;].*)?$/,
|
|
121701
121701
|
comment: /^\s*[#;].*$/
|
|
@@ -121727,14 +121727,14 @@ globstar while`, file2, fr10, pattern, pr8, swallowee);
|
|
|
121727
121727
|
var lines = data.split(/\r\n|\r|\n/);
|
|
121728
121728
|
lines.forEach(function(line3) {
|
|
121729
121729
|
var match;
|
|
121730
|
-
if (
|
|
121730
|
+
if (regex.comment.test(line3)) {
|
|
121731
121731
|
return;
|
|
121732
121732
|
}
|
|
121733
|
-
if (
|
|
121734
|
-
match = line3.match(
|
|
121733
|
+
if (regex.param.test(line3)) {
|
|
121734
|
+
match = line3.match(regex.param);
|
|
121735
121735
|
sectionBody[match[1]] = match[2];
|
|
121736
|
-
} else if (
|
|
121737
|
-
match = line3.match(
|
|
121736
|
+
} else if (regex.section.test(line3)) {
|
|
121737
|
+
match = line3.match(regex.section);
|
|
121738
121738
|
sectionName = match[1];
|
|
121739
121739
|
sectionBody = {};
|
|
121740
121740
|
value.push([sectionName, sectionBody]);
|
|
@@ -122820,8 +122820,8 @@ globstar while`, file2, fr10, pattern, pr8, swallowee);
|
|
|
122820
122820
|
}
|
|
122821
122821
|
_make(mode, key2) {
|
|
122822
122822
|
const str = this.regexPrefix.replace(REGEX_REPLACE_TRAILING_WILDCARD, TRAILING_WILD_CARD_REPLACERS[mode]);
|
|
122823
|
-
const
|
|
122824
|
-
return define2(this, key2,
|
|
122823
|
+
const regex = this.ignoreCase ? new RegExp(str, "i") : new RegExp(str);
|
|
122824
|
+
return define2(this, key2, regex);
|
|
122825
122825
|
}
|
|
122826
122826
|
};
|
|
122827
122827
|
var createRule = ({
|
|
@@ -126306,7 +126306,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
126306
126306
|
return mapDoc2(doc2, (currentDoc) => cleanDocFn2(currentDoc));
|
|
126307
126307
|
}
|
|
126308
126308
|
function replaceEndOfLine2(doc2, replacement = literalline2) {
|
|
126309
|
-
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
126309
|
+
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ? join16(replacement, currentDoc.split(`
|
|
126310
126310
|
`)) : currentDoc);
|
|
126311
126311
|
}
|
|
126312
126312
|
function canBreakFn2(doc2) {
|
|
@@ -126392,7 +126392,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
126392
126392
|
negate: options8.negate
|
|
126393
126393
|
};
|
|
126394
126394
|
}
|
|
126395
|
-
function
|
|
126395
|
+
function join16(separator, docs) {
|
|
126396
126396
|
assertDoc2(separator);
|
|
126397
126397
|
assertDocArray2(docs);
|
|
126398
126398
|
const parts = [];
|
|
@@ -127057,7 +127057,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
127057
127057
|
}
|
|
127058
127058
|
}
|
|
127059
127059
|
var builders2 = {
|
|
127060
|
-
join:
|
|
127060
|
+
join: join16,
|
|
127061
127061
|
line: line3,
|
|
127062
127062
|
softline: softline2,
|
|
127063
127063
|
hardline: hardline4,
|
|
@@ -127617,8 +127617,8 @@ var require_prettier = __commonJS((exports, module) => {
|
|
|
127617
127617
|
}
|
|
127618
127618
|
function makeString2(rawText, enclosingQuote, unescapeUnnecessaryEscapes) {
|
|
127619
127619
|
const otherQuote = enclosingQuote === '"' ? "'" : '"';
|
|
127620
|
-
const
|
|
127621
|
-
const raw2 = method_replace_all_default3(0, rawText,
|
|
127620
|
+
const regex = /\\(.)|(["'])/gsu;
|
|
127621
|
+
const raw2 = method_replace_all_default3(0, rawText, regex, (match, escaped, quote) => {
|
|
127622
127622
|
if (escaped === otherQuote) {
|
|
127623
127623
|
return escaped;
|
|
127624
127624
|
}
|
|
@@ -132397,7 +132397,7 @@ var require_url = __commonJS((exports) => {
|
|
|
132397
132397
|
exports.fromFileSystemPath = fromFileSystemPath;
|
|
132398
132398
|
exports.toFileSystemPath = toFileSystemPath;
|
|
132399
132399
|
exports.safePointerToPath = safePointerToPath;
|
|
132400
|
-
exports.relative =
|
|
132400
|
+
exports.relative = relative4;
|
|
132401
132401
|
var convert_path_to_posix_1 = __importDefault(require_convert_path_to_posix());
|
|
132402
132402
|
var path_1 = __importStar(__require("path"));
|
|
132403
132403
|
var forwardSlashPattern = /\//g;
|
|
@@ -132547,7 +132547,7 @@ var require_url = __commonJS((exports) => {
|
|
|
132547
132547
|
return decodeURIComponent(value).replace(jsonPointerSlash, "/").replace(jsonPointerTilde, "~");
|
|
132548
132548
|
});
|
|
132549
132549
|
}
|
|
132550
|
-
function
|
|
132550
|
+
function relative4(from, to5) {
|
|
132551
132551
|
if (!isFileSystemPath(from) || !isFileSystemPath(to5)) {
|
|
132552
132552
|
return resolve6(from, to5);
|
|
132553
132553
|
}
|
|
@@ -138614,7 +138614,7 @@ var require_depd = __commonJS((exports, module) => {
|
|
|
138614
138614
|
* Copyright(c) 2014-2018 Douglas Christopher Wilson
|
|
138615
138615
|
* MIT Licensed
|
|
138616
138616
|
*/
|
|
138617
|
-
var
|
|
138617
|
+
var relative4 = __require("path").relative;
|
|
138618
138618
|
module.exports = depd;
|
|
138619
138619
|
var basePath = process.cwd();
|
|
138620
138620
|
function containsNamespace(str, namespace) {
|
|
@@ -138810,7 +138810,7 @@ var require_depd = __commonJS((exports, module) => {
|
|
|
138810
138810
|
return formatted;
|
|
138811
138811
|
}
|
|
138812
138812
|
function formatLocation(callSite) {
|
|
138813
|
-
return
|
|
138813
|
+
return relative4(basePath, callSite[0]) + ":" + callSite[1] + ":" + callSite[2];
|
|
138814
138814
|
}
|
|
138815
138815
|
function getStack() {
|
|
138816
138816
|
var limit = Error.stackTraceLimit;
|
|
@@ -156272,10 +156272,10 @@ var require_view = __commonJS((exports, module) => {
|
|
|
156272
156272
|
var debug = require_src4()("express:view");
|
|
156273
156273
|
var path18 = __require("node:path");
|
|
156274
156274
|
var fs28 = __require("node:fs");
|
|
156275
|
-
var
|
|
156275
|
+
var dirname13 = path18.dirname;
|
|
156276
156276
|
var basename4 = path18.basename;
|
|
156277
156277
|
var extname2 = path18.extname;
|
|
156278
|
-
var
|
|
156278
|
+
var join17 = path18.join;
|
|
156279
156279
|
var resolve6 = path18.resolve;
|
|
156280
156280
|
module.exports = View;
|
|
156281
156281
|
function View(name2, options8) {
|
|
@@ -156311,7 +156311,7 @@ var require_view = __commonJS((exports, module) => {
|
|
|
156311
156311
|
for (var i5 = 0;i5 < roots.length && !path19; i5++) {
|
|
156312
156312
|
var root2 = roots[i5];
|
|
156313
156313
|
var loc = resolve6(root2, name2);
|
|
156314
|
-
var dir =
|
|
156314
|
+
var dir = dirname13(loc);
|
|
156315
156315
|
var file2 = basename4(loc);
|
|
156316
156316
|
path19 = this.resolve(dir, file2);
|
|
156317
156317
|
}
|
|
@@ -156337,12 +156337,12 @@ var require_view = __commonJS((exports, module) => {
|
|
|
156337
156337
|
};
|
|
156338
156338
|
View.prototype.resolve = function resolve7(dir, file2) {
|
|
156339
156339
|
var ext = this.ext;
|
|
156340
|
-
var path19 =
|
|
156340
|
+
var path19 = join17(dir, file2);
|
|
156341
156341
|
var stat2 = tryStat(path19);
|
|
156342
156342
|
if (stat2 && stat2.isFile()) {
|
|
156343
156343
|
return path19;
|
|
156344
156344
|
}
|
|
156345
|
-
path19 =
|
|
156345
|
+
path19 = join17(dir, basename4(file2, ext), "index" + ext);
|
|
156346
156346
|
stat2 = tryStat(path19);
|
|
156347
156347
|
if (stat2 && stat2.isFile()) {
|
|
156348
156348
|
return path19;
|
|
@@ -156661,12 +156661,12 @@ var require_ipaddr = __commonJS((exports, module) => {
|
|
|
156661
156661
|
return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/, "::");
|
|
156662
156662
|
};
|
|
156663
156663
|
IPv6.prototype.toRFC5952String = function() {
|
|
156664
|
-
var bestMatchIndex, bestMatchLength, match,
|
|
156665
|
-
|
|
156664
|
+
var bestMatchIndex, bestMatchLength, match, regex, string4;
|
|
156665
|
+
regex = /((^|:)(0(:|$)){2,})/g;
|
|
156666
156666
|
string4 = this.toNormalizedString();
|
|
156667
156667
|
bestMatchIndex = 0;
|
|
156668
156668
|
bestMatchLength = -1;
|
|
156669
|
-
while (match =
|
|
156669
|
+
while (match = regex.exec(string4)) {
|
|
156670
156670
|
if (match[0].length > bestMatchLength) {
|
|
156671
156671
|
bestMatchIndex = match.index;
|
|
156672
156672
|
bestMatchLength = match[0].length;
|
|
@@ -160037,7 +160037,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
160037
160037
|
var Stream2 = __require("stream");
|
|
160038
160038
|
var util2 = __require("util");
|
|
160039
160039
|
var extname2 = path18.extname;
|
|
160040
|
-
var
|
|
160040
|
+
var join17 = path18.join;
|
|
160041
160041
|
var normalize = path18.normalize;
|
|
160042
160042
|
var resolve6 = path18.resolve;
|
|
160043
160043
|
var sep = path18.sep;
|
|
@@ -160209,7 +160209,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
160209
160209
|
return res;
|
|
160210
160210
|
}
|
|
160211
160211
|
parts = path19.split(sep);
|
|
160212
|
-
path19 = normalize(
|
|
160212
|
+
path19 = normalize(join17(root2, path19));
|
|
160213
160213
|
} else {
|
|
160214
160214
|
if (UP_PATH_REGEXP.test(path19)) {
|
|
160215
160215
|
debug('malicious path "%s"', path19);
|
|
@@ -160349,7 +160349,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
160349
160349
|
return self2.onStatError(err);
|
|
160350
160350
|
return self2.error(404);
|
|
160351
160351
|
}
|
|
160352
|
-
var p4 =
|
|
160352
|
+
var p4 = join17(path19, self2._index[i5]);
|
|
160353
160353
|
debug('stat "%s"', p4);
|
|
160354
160354
|
fs28.stat(p4, function(err2, stat2) {
|
|
160355
160355
|
if (err2)
|
|
@@ -161958,8 +161958,8 @@ var require_follow_redirects = __commonJS((exports, module) => {
|
|
|
161958
161958
|
}
|
|
161959
161959
|
return parsed;
|
|
161960
161960
|
}
|
|
161961
|
-
function resolveUrl(
|
|
161962
|
-
return useNativeURL ? new URL2(
|
|
161961
|
+
function resolveUrl(relative4, base) {
|
|
161962
|
+
return useNativeURL ? new URL2(relative4, base) : parseUrl(url3.resolve(base, relative4));
|
|
161963
161963
|
}
|
|
161964
161964
|
function validateUrl(input) {
|
|
161965
161965
|
if (/^\[/.test(input.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input.hostname)) {
|
|
@@ -161984,10 +161984,10 @@ var require_follow_redirects = __commonJS((exports, module) => {
|
|
|
161984
161984
|
spread.path = spread.search ? spread.pathname + spread.search : spread.pathname;
|
|
161985
161985
|
return spread;
|
|
161986
161986
|
}
|
|
161987
|
-
function removeMatchingHeaders(
|
|
161987
|
+
function removeMatchingHeaders(regex, headers) {
|
|
161988
161988
|
var lastValue;
|
|
161989
161989
|
for (var header2 in headers) {
|
|
161990
|
-
if (
|
|
161990
|
+
if (regex.test(header2)) {
|
|
161991
161991
|
lastValue = headers[header2];
|
|
161992
161992
|
delete headers[header2];
|
|
161993
161993
|
}
|
|
@@ -193547,9 +193547,9 @@ var require_dist4 = __commonJS((exports, module) => {
|
|
|
193547
193547
|
name2 = "/" + name2;
|
|
193548
193548
|
let nsp = this._nsps.get(name2);
|
|
193549
193549
|
if (!nsp) {
|
|
193550
|
-
for (const [
|
|
193551
|
-
if (
|
|
193552
|
-
debug("attaching namespace %s to parent namespace %s", name2,
|
|
193550
|
+
for (const [regex, parentNamespace] of this.parentNamespacesFromRegExp) {
|
|
193551
|
+
if (regex.test(name2)) {
|
|
193552
|
+
debug("attaching namespace %s to parent namespace %s", name2, regex);
|
|
193553
193553
|
return parentNamespace.createChild(name2);
|
|
193554
193554
|
}
|
|
193555
193555
|
}
|
|
@@ -206944,7 +206944,7 @@ var require_buffer_list = __commonJS((exports, module) => {
|
|
|
206944
206944
|
}
|
|
206945
206945
|
}, {
|
|
206946
206946
|
key: "join",
|
|
206947
|
-
value: function
|
|
206947
|
+
value: function join18(s5) {
|
|
206948
206948
|
if (this.length === 0)
|
|
206949
206949
|
return "";
|
|
206950
206950
|
var p4 = this.head;
|
|
@@ -210671,7 +210671,7 @@ var {
|
|
|
210671
210671
|
} = import__.default;
|
|
210672
210672
|
|
|
210673
210673
|
// src/cli/commands/agents/pull.ts
|
|
210674
|
-
import { dirname as
|
|
210674
|
+
import { dirname as dirname8, join as join10 } from "node:path";
|
|
210675
210675
|
|
|
210676
210676
|
// node_modules/@clack/core/dist/index.mjs
|
|
210677
210677
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
@@ -226141,7 +226141,9 @@ import { fileURLToPath } from "node:url";
|
|
|
226141
226141
|
var PROJECT_SUBDIR = "base44";
|
|
226142
226142
|
var CONFIG_FILE_EXTENSION = "jsonc";
|
|
226143
226143
|
var CONFIG_FILE_EXTENSION_GLOB = "{json,jsonc}";
|
|
226144
|
-
var
|
|
226144
|
+
var FUNCTION_CONFIG_GLOB = `**/function.${CONFIG_FILE_EXTENSION_GLOB}`;
|
|
226145
|
+
var ENTRY_FILE_GLOB = "**/entry.{js,ts}";
|
|
226146
|
+
var ENTRY_IGNORE_DOT_PATHS = ["**/*.*/**"];
|
|
226145
226147
|
var APP_CONFIG_PATTERN = `**/.app.${CONFIG_FILE_EXTENSION_GLOB}`;
|
|
226146
226148
|
var PROJECT_CONFIG_PATTERNS = [
|
|
226147
226149
|
`${PROJECT_SUBDIR}/config.${CONFIG_FILE_EXTENSION_GLOB}`,
|
|
@@ -233170,7 +233172,7 @@ var generateGlobTasks = normalizeArguments(generateTasks);
|
|
|
233170
233172
|
var generateGlobTasksSync = normalizeArgumentsSync(generateTasksSync);
|
|
233171
233173
|
|
|
233172
233174
|
// src/core/project/config.ts
|
|
233173
|
-
import { dirname as
|
|
233175
|
+
import { dirname as dirname6, join as join7 } from "node:path";
|
|
233174
233176
|
|
|
233175
233177
|
// src/core/resources/agent/schema.ts
|
|
233176
233178
|
var EntityOperationSchema = exports_external.enum(["create", "update", "delete", "read"]);
|
|
@@ -233900,11 +233902,23 @@ var BackendFunctionSchema = FunctionConfigSchema.extend({
|
|
|
233900
233902
|
entryPath: exports_external.string().min(1, "Entry path cannot be empty"),
|
|
233901
233903
|
filePaths: exports_external.array(exports_external.string()).min(1, "Function must have at least one file")
|
|
233902
233904
|
});
|
|
233903
|
-
var
|
|
233904
|
-
|
|
233905
|
-
|
|
233906
|
-
|
|
233907
|
-
|
|
233905
|
+
var DeploySingleFunctionResponseSchema = exports_external.object({
|
|
233906
|
+
status: exports_external.enum(["deployed", "unchanged"])
|
|
233907
|
+
});
|
|
233908
|
+
var FunctionAutomationInfoSchema = exports_external.object({
|
|
233909
|
+
name: exports_external.string(),
|
|
233910
|
+
type: exports_external.string(),
|
|
233911
|
+
is_active: exports_external.boolean()
|
|
233912
|
+
});
|
|
233913
|
+
var FunctionInfoSchema = exports_external.object({
|
|
233914
|
+
name: exports_external.string(),
|
|
233915
|
+
deployment_id: exports_external.string(),
|
|
233916
|
+
entry: exports_external.string(),
|
|
233917
|
+
files: exports_external.array(FunctionFileSchema),
|
|
233918
|
+
automations: exports_external.array(FunctionAutomationInfoSchema)
|
|
233919
|
+
});
|
|
233920
|
+
var ListFunctionsResponseSchema = exports_external.object({
|
|
233921
|
+
functions: exports_external.array(FunctionInfoSchema)
|
|
233908
233922
|
});
|
|
233909
233923
|
var LogLevelSchema = exports_external.enum(["info", "warning", "error", "debug"]);
|
|
233910
233924
|
var FunctionLogEntrySchema = exports_external.object({
|
|
@@ -233915,29 +233929,37 @@ var FunctionLogEntrySchema = exports_external.object({
|
|
|
233915
233929
|
var FunctionLogsResponseSchema = exports_external.array(FunctionLogEntrySchema);
|
|
233916
233930
|
|
|
233917
233931
|
// src/core/resources/function/api.ts
|
|
233918
|
-
function
|
|
233919
|
-
|
|
233920
|
-
|
|
233921
|
-
|
|
233922
|
-
|
|
233923
|
-
|
|
233924
|
-
|
|
233932
|
+
async function deploySingleFunction(name2, payload) {
|
|
233933
|
+
const appClient = getAppClient();
|
|
233934
|
+
let response;
|
|
233935
|
+
try {
|
|
233936
|
+
response = await appClient.put(`backend-functions/${encodeURIComponent(name2)}`, { json: payload, timeout: false });
|
|
233937
|
+
} catch (error48) {
|
|
233938
|
+
throw await ApiError.fromHttpError(error48, `deploying function "${name2}"`);
|
|
233939
|
+
}
|
|
233940
|
+
const result = DeploySingleFunctionResponseSchema.safeParse(await response.json());
|
|
233941
|
+
if (!result.success) {
|
|
233942
|
+
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
233943
|
+
}
|
|
233944
|
+
return result.data;
|
|
233925
233945
|
}
|
|
233926
|
-
async function
|
|
233946
|
+
async function deleteSingleFunction(name2) {
|
|
233947
|
+
const appClient = getAppClient();
|
|
233948
|
+
try {
|
|
233949
|
+
await appClient.delete(`backend-functions/${encodeURIComponent(name2)}`, { timeout: 60000 });
|
|
233950
|
+
} catch (error48) {
|
|
233951
|
+
throw await ApiError.fromHttpError(error48, `deleting function "${name2}"`);
|
|
233952
|
+
}
|
|
233953
|
+
}
|
|
233954
|
+
async function listDeployedFunctions() {
|
|
233927
233955
|
const appClient = getAppClient();
|
|
233928
|
-
const payload = {
|
|
233929
|
-
functions: functions.map(toDeployPayloadItem)
|
|
233930
|
-
};
|
|
233931
233956
|
let response;
|
|
233932
233957
|
try {
|
|
233933
|
-
response = await appClient.
|
|
233934
|
-
json: payload,
|
|
233935
|
-
timeout: false
|
|
233936
|
-
});
|
|
233958
|
+
response = await appClient.get("backend-functions", { timeout: 30000 });
|
|
233937
233959
|
} catch (error48) {
|
|
233938
|
-
throw await ApiError.fromHttpError(error48, "
|
|
233960
|
+
throw await ApiError.fromHttpError(error48, "listing deployed functions");
|
|
233939
233961
|
}
|
|
233940
|
-
const result =
|
|
233962
|
+
const result = ListFunctionsResponseSchema.safeParse(await response.json());
|
|
233941
233963
|
if (!result.success) {
|
|
233942
233964
|
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
233943
233965
|
}
|
|
@@ -233980,7 +234002,7 @@ async function fetchFunctionLogs(functionName, filters = {}) {
|
|
|
233980
234002
|
return result.data;
|
|
233981
234003
|
}
|
|
233982
234004
|
// src/core/resources/function/config.ts
|
|
233983
|
-
import { dirname as dirname4, join as join5 } from "node:path";
|
|
234005
|
+
import { basename as basename2, dirname as dirname4, join as join5, relative } from "node:path";
|
|
233984
234006
|
async function readFunctionConfig(configPath) {
|
|
233985
234007
|
const parsed = await readJsonFile(configPath);
|
|
233986
234008
|
const result = FunctionConfigSchema.safeParse(parsed);
|
|
@@ -233998,7 +234020,7 @@ async function readFunction(configPath) {
|
|
|
233998
234020
|
hints: [{ message: "Check the 'entry' field in your function config" }]
|
|
233999
234021
|
});
|
|
234000
234022
|
}
|
|
234001
|
-
const filePaths = await globby("
|
|
234023
|
+
const filePaths = await globby("**/*.{js,ts,json}", {
|
|
234002
234024
|
cwd: functionDir,
|
|
234003
234025
|
absolute: true
|
|
234004
234026
|
});
|
|
@@ -234009,40 +234031,182 @@ async function readAllFunctions(functionsDir) {
|
|
|
234009
234031
|
if (!await pathExists(functionsDir)) {
|
|
234010
234032
|
return [];
|
|
234011
234033
|
}
|
|
234012
|
-
const configFiles = await globby(
|
|
234034
|
+
const configFiles = await globby(FUNCTION_CONFIG_GLOB, {
|
|
234013
234035
|
cwd: functionsDir,
|
|
234014
234036
|
absolute: true
|
|
234015
234037
|
});
|
|
234016
|
-
const
|
|
234038
|
+
const entryFiles = await globby(ENTRY_FILE_GLOB, {
|
|
234039
|
+
cwd: functionsDir,
|
|
234040
|
+
absolute: true,
|
|
234041
|
+
ignore: ENTRY_IGNORE_DOT_PATHS
|
|
234042
|
+
});
|
|
234043
|
+
const configFilesDirs = new Set(configFiles.map((f) => dirname4(f)));
|
|
234044
|
+
const entryFilesWithoutConfig = entryFiles.filter((entryFile) => !configFilesDirs.has(dirname4(entryFile)));
|
|
234045
|
+
const functionsFromConfig = await Promise.all(configFiles.map((configPath) => readFunction(configPath)));
|
|
234046
|
+
const functionsWithoutConfig = await Promise.all(entryFilesWithoutConfig.map(async (entryFile) => {
|
|
234047
|
+
const functionDir = dirname4(entryFile);
|
|
234048
|
+
const filePaths = await globby("**/*.{js,ts,json}", {
|
|
234049
|
+
cwd: functionDir,
|
|
234050
|
+
absolute: true
|
|
234051
|
+
});
|
|
234052
|
+
const name2 = relative(functionsDir, functionDir).split(/[/\\]/).join("/");
|
|
234053
|
+
if (!name2) {
|
|
234054
|
+
throw new InvalidInputError("entry.ts found directly in the functions directory — it must be inside a named subfolder", {
|
|
234055
|
+
hints: [
|
|
234056
|
+
{
|
|
234057
|
+
message: `Move ${entryFile} into a subfolder (e.g. functions/myFunc/entry.ts)`
|
|
234058
|
+
}
|
|
234059
|
+
]
|
|
234060
|
+
});
|
|
234061
|
+
}
|
|
234062
|
+
const entry = basename2(entryFile);
|
|
234063
|
+
return { name: name2, entry, entryPath: entryFile, filePaths };
|
|
234064
|
+
}));
|
|
234065
|
+
const functions = [...functionsFromConfig, ...functionsWithoutConfig];
|
|
234017
234066
|
const names = new Set;
|
|
234018
234067
|
for (const fn of functions) {
|
|
234019
234068
|
if (names.has(fn.name)) {
|
|
234020
|
-
throw new
|
|
234069
|
+
throw new InvalidInputError(`Duplicate function name "${fn.name}"`, {
|
|
234070
|
+
hints: [
|
|
234071
|
+
{
|
|
234072
|
+
message: "Ensure each function has a unique name (or path for zero-config functions)."
|
|
234073
|
+
}
|
|
234074
|
+
]
|
|
234075
|
+
});
|
|
234021
234076
|
}
|
|
234022
234077
|
names.add(fn.name);
|
|
234023
234078
|
}
|
|
234024
234079
|
return functions;
|
|
234025
234080
|
}
|
|
234026
234081
|
// src/core/resources/function/deploy.ts
|
|
234027
|
-
import {
|
|
234082
|
+
import { dirname as dirname5, relative as relative2 } from "node:path";
|
|
234028
234083
|
async function loadFunctionCode(fn) {
|
|
234029
|
-
const
|
|
234084
|
+
const functionDir = dirname5(fn.entryPath);
|
|
234085
|
+
const resolvedFiles = await Promise.all(fn.filePaths.map(async (filePath) => {
|
|
234030
234086
|
const content = await readTextFile(filePath);
|
|
234031
|
-
|
|
234087
|
+
const path11 = relative2(functionDir, filePath).split(/[/\\]/).join("/");
|
|
234088
|
+
return { path: path11, content };
|
|
234032
234089
|
}));
|
|
234033
|
-
return { ...fn, files:
|
|
234090
|
+
return { ...fn, files: resolvedFiles };
|
|
234034
234091
|
}
|
|
234035
|
-
async function
|
|
234036
|
-
|
|
234037
|
-
|
|
234092
|
+
async function deployOne(fn) {
|
|
234093
|
+
const start = Date.now();
|
|
234094
|
+
try {
|
|
234095
|
+
const functionWithCode = await loadFunctionCode(fn);
|
|
234096
|
+
const response = await deploySingleFunction(functionWithCode.name, {
|
|
234097
|
+
entry: functionWithCode.entry,
|
|
234098
|
+
files: functionWithCode.files,
|
|
234099
|
+
automations: functionWithCode.automations
|
|
234100
|
+
});
|
|
234101
|
+
return {
|
|
234102
|
+
name: functionWithCode.name,
|
|
234103
|
+
status: response.status,
|
|
234104
|
+
durationMs: Date.now() - start
|
|
234105
|
+
};
|
|
234106
|
+
} catch (error48) {
|
|
234107
|
+
return {
|
|
234108
|
+
name: fn.name,
|
|
234109
|
+
status: "error",
|
|
234110
|
+
error: error48 instanceof Error ? error48.message : String(error48)
|
|
234111
|
+
};
|
|
234112
|
+
}
|
|
234113
|
+
}
|
|
234114
|
+
async function deployFunctionsSequentially(functions, options) {
|
|
234115
|
+
if (functions.length === 0)
|
|
234116
|
+
return [];
|
|
234117
|
+
const results = [];
|
|
234118
|
+
for (const fn of functions) {
|
|
234119
|
+
options?.onStart?.([fn.name]);
|
|
234120
|
+
const result = await deployOne(fn);
|
|
234121
|
+
results.push(result);
|
|
234122
|
+
options?.onResult?.(result);
|
|
234123
|
+
}
|
|
234124
|
+
return results;
|
|
234125
|
+
}
|
|
234126
|
+
async function pruneRemovedFunctions(localFunctionNames) {
|
|
234127
|
+
const remote = await listDeployedFunctions();
|
|
234128
|
+
const localSet = new Set(localFunctionNames);
|
|
234129
|
+
const toDelete = remote.functions.filter((f) => !localSet.has(f.name));
|
|
234130
|
+
const results = [];
|
|
234131
|
+
for (const fn of toDelete) {
|
|
234132
|
+
try {
|
|
234133
|
+
await deleteSingleFunction(fn.name);
|
|
234134
|
+
results.push({ name: fn.name, deleted: true });
|
|
234135
|
+
} catch (error48) {
|
|
234136
|
+
results.push({
|
|
234137
|
+
name: fn.name,
|
|
234138
|
+
deleted: false,
|
|
234139
|
+
error: error48 instanceof Error ? error48.message : String(error48)
|
|
234140
|
+
});
|
|
234141
|
+
}
|
|
234142
|
+
}
|
|
234143
|
+
return results;
|
|
234144
|
+
}
|
|
234145
|
+
// src/core/resources/function/pull.ts
|
|
234146
|
+
import { join as join6 } from "node:path";
|
|
234147
|
+
async function writeFunctions(functionsDir, functions) {
|
|
234148
|
+
const written = [];
|
|
234149
|
+
const skipped = [];
|
|
234150
|
+
for (const fn of functions) {
|
|
234151
|
+
const functionDir = join6(functionsDir, fn.name);
|
|
234152
|
+
const configPath = join6(functionDir, "function.jsonc");
|
|
234153
|
+
if (await isFunctionUnchanged(functionDir, fn)) {
|
|
234154
|
+
skipped.push(fn.name);
|
|
234155
|
+
continue;
|
|
234156
|
+
}
|
|
234157
|
+
const config5 = {
|
|
234158
|
+
name: fn.name,
|
|
234159
|
+
entry: fn.entry
|
|
234160
|
+
};
|
|
234161
|
+
if (fn.automations.length > 0) {
|
|
234162
|
+
config5.automations = fn.automations;
|
|
234163
|
+
}
|
|
234164
|
+
await writeJsonFile(configPath, config5);
|
|
234165
|
+
for (const file2 of fn.files) {
|
|
234166
|
+
await writeFile(join6(functionDir, file2.path), file2.content);
|
|
234167
|
+
}
|
|
234168
|
+
written.push(fn.name);
|
|
234169
|
+
}
|
|
234170
|
+
return { written, skipped };
|
|
234171
|
+
}
|
|
234172
|
+
async function isFunctionUnchanged(functionDir, fn) {
|
|
234173
|
+
if (!await pathExists(functionDir)) {
|
|
234174
|
+
return false;
|
|
234175
|
+
}
|
|
234176
|
+
const configPath = join6(functionDir, "function.jsonc");
|
|
234177
|
+
try {
|
|
234178
|
+
const localConfig = await readJsonFile(configPath);
|
|
234179
|
+
if (localConfig.entry !== fn.entry) {
|
|
234180
|
+
return false;
|
|
234181
|
+
}
|
|
234182
|
+
const localAuto = JSON.stringify(localConfig.automations ?? []);
|
|
234183
|
+
const remoteAuto = JSON.stringify(fn.automations);
|
|
234184
|
+
if (localAuto !== remoteAuto) {
|
|
234185
|
+
return false;
|
|
234186
|
+
}
|
|
234187
|
+
} catch {
|
|
234188
|
+
return false;
|
|
234189
|
+
}
|
|
234190
|
+
for (const file2 of fn.files) {
|
|
234191
|
+
const filePath = join6(functionDir, file2.path);
|
|
234192
|
+
if (!await pathExists(filePath)) {
|
|
234193
|
+
return false;
|
|
234194
|
+
}
|
|
234195
|
+
try {
|
|
234196
|
+
const localContent = await readTextFile(filePath);
|
|
234197
|
+
if (localContent !== file2.content) {
|
|
234198
|
+
return false;
|
|
234199
|
+
}
|
|
234200
|
+
} catch {
|
|
234201
|
+
return false;
|
|
234202
|
+
}
|
|
234038
234203
|
}
|
|
234039
|
-
|
|
234040
|
-
return deployFunctions(functionsWithCode);
|
|
234204
|
+
return true;
|
|
234041
234205
|
}
|
|
234042
234206
|
// src/core/resources/function/resource.ts
|
|
234043
234207
|
var functionResource = {
|
|
234044
234208
|
readAll: readAllFunctions,
|
|
234045
|
-
push:
|
|
234209
|
+
push: (functions) => deployFunctionsSequentially(functions)
|
|
234046
234210
|
};
|
|
234047
234211
|
// src/core/project/config.ts
|
|
234048
234212
|
async function findConfigInDir(dir) {
|
|
@@ -234054,12 +234218,12 @@ async function findConfigInDir(dir) {
|
|
|
234054
234218
|
}
|
|
234055
234219
|
async function findProjectRoot(startPath) {
|
|
234056
234220
|
let current = startPath || process.cwd();
|
|
234057
|
-
while (current !==
|
|
234221
|
+
while (current !== dirname6(current)) {
|
|
234058
234222
|
const configPath = await findConfigInDir(current);
|
|
234059
234223
|
if (configPath) {
|
|
234060
234224
|
return { root: current, configPath };
|
|
234061
234225
|
}
|
|
234062
|
-
current =
|
|
234226
|
+
current = dirname6(current);
|
|
234063
234227
|
}
|
|
234064
234228
|
return null;
|
|
234065
234229
|
}
|
|
@@ -234081,12 +234245,12 @@ async function readProjectConfig(projectRoot) {
|
|
|
234081
234245
|
throw new SchemaValidationError("Invalid project configuration", result.error, configPath);
|
|
234082
234246
|
}
|
|
234083
234247
|
const project = result.data;
|
|
234084
|
-
const configDir =
|
|
234248
|
+
const configDir = dirname6(configPath);
|
|
234085
234249
|
const [entities, functions, agents, connectors] = await Promise.all([
|
|
234086
|
-
entityResource.readAll(
|
|
234087
|
-
functionResource.readAll(
|
|
234088
|
-
agentResource.readAll(
|
|
234089
|
-
connectorResource.readAll(
|
|
234250
|
+
entityResource.readAll(join7(configDir, project.entitiesDir)),
|
|
234251
|
+
functionResource.readAll(join7(configDir, project.functionsDir)),
|
|
234252
|
+
agentResource.readAll(join7(configDir, project.agentsDir)),
|
|
234253
|
+
connectorResource.readAll(join7(configDir, project.connectorsDir))
|
|
234090
234254
|
]);
|
|
234091
234255
|
return {
|
|
234092
234256
|
project: { ...project, root, configPath },
|
|
@@ -234183,7 +234347,7 @@ async function readAppConfig(projectRoot) {
|
|
|
234183
234347
|
// src/core/project/template.ts
|
|
234184
234348
|
var import_ejs = __toESM(require_ejs(), 1);
|
|
234185
234349
|
var import_front_matter = __toESM(require_front_matter(), 1);
|
|
234186
|
-
import { dirname as
|
|
234350
|
+
import { dirname as dirname7, join as join8 } from "node:path";
|
|
234187
234351
|
async function listTemplates() {
|
|
234188
234352
|
const parsed = await readJsonFile(getTemplatesIndexPath());
|
|
234189
234353
|
const result = TemplatesConfigSchema.safeParse(parsed);
|
|
@@ -234193,23 +234357,23 @@ async function listTemplates() {
|
|
|
234193
234357
|
return result.data.templates;
|
|
234194
234358
|
}
|
|
234195
234359
|
async function renderTemplate(template, destPath, data) {
|
|
234196
|
-
const templateDir =
|
|
234360
|
+
const templateDir = join8(getTemplatesDir(), template.path);
|
|
234197
234361
|
const files = await globby("**/*", {
|
|
234198
234362
|
cwd: templateDir,
|
|
234199
234363
|
dot: true,
|
|
234200
234364
|
onlyFiles: true
|
|
234201
234365
|
});
|
|
234202
234366
|
for (const file2 of files) {
|
|
234203
|
-
const srcPath =
|
|
234367
|
+
const srcPath = join8(templateDir, file2);
|
|
234204
234368
|
try {
|
|
234205
234369
|
if (file2.endsWith(".ejs")) {
|
|
234206
234370
|
const rendered = await import_ejs.default.renderFile(srcPath, data);
|
|
234207
234371
|
const { attributes, body } = import_front_matter.default(rendered);
|
|
234208
|
-
const destFile = attributes.outputFileName ?
|
|
234209
|
-
const destFilePath =
|
|
234372
|
+
const destFile = attributes.outputFileName ? join8(dirname7(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
|
|
234373
|
+
const destFilePath = join8(destPath, destFile);
|
|
234210
234374
|
await writeFile(destFilePath, body);
|
|
234211
234375
|
} else {
|
|
234212
|
-
const destFilePath =
|
|
234376
|
+
const destFilePath = join8(destPath, file2);
|
|
234213
234377
|
await copyFile(srcPath, destFilePath);
|
|
234214
234378
|
}
|
|
234215
234379
|
} catch (error48) {
|
|
@@ -234312,7 +234476,7 @@ async function getSiteFilePaths(outputDir) {
|
|
|
234312
234476
|
// src/core/site/deploy.ts
|
|
234313
234477
|
import { randomUUID } from "node:crypto";
|
|
234314
234478
|
import { tmpdir } from "node:os";
|
|
234315
|
-
import { join as
|
|
234479
|
+
import { join as join9 } from "node:path";
|
|
234316
234480
|
async function deploySite(siteOutputDir) {
|
|
234317
234481
|
if (!await pathExists(siteOutputDir)) {
|
|
234318
234482
|
throw new InvalidInputError(`Output directory does not exist: ${siteOutputDir}. Make sure to build your project first.`, {
|
|
@@ -234329,7 +234493,7 @@ async function deploySite(siteOutputDir) {
|
|
|
234329
234493
|
]
|
|
234330
234494
|
});
|
|
234331
234495
|
}
|
|
234332
|
-
const archivePath =
|
|
234496
|
+
const archivePath = join9(tmpdir(), `base44-site-${randomUUID()}.tar.gz`);
|
|
234333
234497
|
try {
|
|
234334
234498
|
await createArchive(siteOutputDir, archivePath);
|
|
234335
234499
|
return await uploadSite(archivePath);
|
|
@@ -234354,10 +234518,13 @@ function hasResourcesToDeploy(projectData) {
|
|
|
234354
234518
|
const hasConnectors = connectors.length > 0;
|
|
234355
234519
|
return hasEntities || hasFunctions || hasAgents || hasConnectors || hasSite;
|
|
234356
234520
|
}
|
|
234357
|
-
async function deployAll(projectData) {
|
|
234521
|
+
async function deployAll(projectData, options) {
|
|
234358
234522
|
const { project, entities, functions, agents, connectors } = projectData;
|
|
234359
234523
|
await entityResource.push(entities);
|
|
234360
|
-
await
|
|
234524
|
+
await deployFunctionsSequentially(functions, {
|
|
234525
|
+
onStart: options?.onFunctionStart,
|
|
234526
|
+
onResult: options?.onFunctionResult
|
|
234527
|
+
});
|
|
234361
234528
|
await agentResource.push(agents);
|
|
234362
234529
|
const { results: connectorResults } = await pushConnectors(connectors);
|
|
234363
234530
|
if (project.site?.outputDirectory) {
|
|
@@ -235383,24 +235550,6 @@ async function login() {
|
|
|
235383
235550
|
};
|
|
235384
235551
|
}
|
|
235385
235552
|
|
|
235386
|
-
// node_modules/ansi-regex/index.js
|
|
235387
|
-
function ansiRegex({ onlyFirst = false } = {}) {
|
|
235388
|
-
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
235389
|
-
const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`;
|
|
235390
|
-
const csi = "[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";
|
|
235391
|
-
const pattern = `${osc}|${csi}`;
|
|
235392
|
-
return new RegExp(pattern, onlyFirst ? undefined : "g");
|
|
235393
|
-
}
|
|
235394
|
-
|
|
235395
|
-
// node_modules/strip-ansi/index.js
|
|
235396
|
-
var regex = ansiRegex();
|
|
235397
|
-
function stripAnsi(string4) {
|
|
235398
|
-
if (typeof string4 !== "string") {
|
|
235399
|
-
throw new TypeError(`Expected a \`string\`, got \`${typeof string4}\``);
|
|
235400
|
-
}
|
|
235401
|
-
return string4.replace(regex, "");
|
|
235402
|
-
}
|
|
235403
|
-
|
|
235404
235553
|
// node_modules/is-plain-obj/index.js
|
|
235405
235554
|
function isPlainObject2(value) {
|
|
235406
235555
|
if (typeof value !== "object" || value === null) {
|
|
@@ -241899,7 +242048,7 @@ var {
|
|
|
241899
242048
|
// package.json
|
|
241900
242049
|
var package_default = {
|
|
241901
242050
|
name: "base44",
|
|
241902
|
-
version: "0.0.
|
|
242051
|
+
version: "0.0.38",
|
|
241903
242052
|
description: "Base44 CLI - Unified interface for managing Base44 applications",
|
|
241904
242053
|
type: "module",
|
|
241905
242054
|
bin: {
|
|
@@ -242017,38 +242166,16 @@ async function checkForUpgrade() {
|
|
|
242017
242166
|
}
|
|
242018
242167
|
|
|
242019
242168
|
// src/cli/utils/upgradeNotification.ts
|
|
242020
|
-
|
|
242021
|
-
function formatUpgradeBox(info) {
|
|
242169
|
+
function formatUpgradeMessage(info) {
|
|
242022
242170
|
const { shinyOrange } = theme.colors;
|
|
242023
242171
|
const { bold: bold2 } = theme.styles;
|
|
242024
|
-
|
|
242025
|
-
shinyOrange(`Update available! ${info.currentVersion} → ${bold2(info.latestVersion)}`),
|
|
242026
|
-
shinyOrange(`Run: ${bold2(UPGRADE_COMMAND)}`),
|
|
242027
|
-
"",
|
|
242028
|
-
"[Agent Hints]",
|
|
242029
|
-
` Run: ${UPGRADE_COMMAND}`
|
|
242030
|
-
];
|
|
242031
|
-
const maxVisualWidth = Math.max(...lines.map((l) => stripAnsi(l).length));
|
|
242032
|
-
const pad = (line) => {
|
|
242033
|
-
const visual = stripAnsi(line).length;
|
|
242034
|
-
return `${line}${" ".repeat(maxVisualWidth - visual)}`;
|
|
242035
|
-
};
|
|
242036
|
-
const top = `┌${"─".repeat(maxVisualWidth + 2)}┐`;
|
|
242037
|
-
const bottom = `└${"─".repeat(maxVisualWidth + 2)}┘`;
|
|
242038
|
-
const body = lines.map((l) => `│ ${pad(l)} │`).join(`
|
|
242039
|
-
`);
|
|
242040
|
-
return `${top}
|
|
242041
|
-
${body}
|
|
242042
|
-
${bottom}`;
|
|
242043
|
-
}
|
|
242044
|
-
function startUpgradeCheck() {
|
|
242045
|
-
return checkForUpgrade().catch(() => null);
|
|
242172
|
+
return `${shinyOrange("Update available!")} ${shinyOrange(`${info.currentVersion} → ${info.latestVersion}`)} ${shinyOrange("Run:")} ${bold2(shinyOrange("npm install -g base44@latest"))}`;
|
|
242046
242173
|
}
|
|
242047
|
-
async function
|
|
242174
|
+
async function printUpgradeNotificationIfAvailable() {
|
|
242048
242175
|
try {
|
|
242049
|
-
const upgradeInfo = await
|
|
242176
|
+
const upgradeInfo = await checkForUpgrade();
|
|
242050
242177
|
if (upgradeInfo) {
|
|
242051
|
-
R2.
|
|
242178
|
+
R2.message(formatUpgradeMessage(upgradeInfo));
|
|
242052
242179
|
}
|
|
242053
242180
|
} catch {}
|
|
242054
242181
|
}
|
|
@@ -242061,7 +242188,7 @@ async function runCommand(commandFn, options, context) {
|
|
|
242061
242188
|
} else {
|
|
242062
242189
|
We(theme.colors.base44OrangeBackground(" Base 44 "));
|
|
242063
242190
|
}
|
|
242064
|
-
|
|
242191
|
+
await printUpgradeNotificationIfAvailable();
|
|
242065
242192
|
try {
|
|
242066
242193
|
if (options?.requireAuth) {
|
|
242067
242194
|
const loggedIn = await isLoggedIn();
|
|
@@ -242081,14 +242208,12 @@ async function runCommand(commandFn, options, context) {
|
|
|
242081
242208
|
context.errorReporter.setContext({ appId: appConfig.id });
|
|
242082
242209
|
}
|
|
242083
242210
|
const result = await commandFn();
|
|
242084
|
-
await printUpgradeNotification(upgradeCheckPromise);
|
|
242085
242211
|
Le(result.outroMessage || "");
|
|
242086
242212
|
if (result.stdout) {
|
|
242087
242213
|
process.stdout.write(result.stdout);
|
|
242088
242214
|
}
|
|
242089
242215
|
} catch (error48) {
|
|
242090
242216
|
displayError(error48);
|
|
242091
|
-
await printUpgradeNotification(upgradeCheckPromise);
|
|
242092
242217
|
const errorContext = context.errorReporter.getErrorContext();
|
|
242093
242218
|
Le(theme.format.errorContext(errorContext));
|
|
242094
242219
|
throw error48;
|
|
@@ -242132,8 +242257,8 @@ function getDashboardUrl(projectId) {
|
|
|
242132
242257
|
// src/cli/commands/agents/pull.ts
|
|
242133
242258
|
async function pullAgentsAction() {
|
|
242134
242259
|
const { project: project2 } = await readProjectConfig();
|
|
242135
|
-
const configDir =
|
|
242136
|
-
const agentsDir =
|
|
242260
|
+
const configDir = dirname8(project2.configPath);
|
|
242261
|
+
const agentsDir = join10(configDir, project2.agentsDir);
|
|
242137
242262
|
const remoteAgents = await runTask("Fetching agents from Base44", async () => {
|
|
242138
242263
|
return await fetchAgents();
|
|
242139
242264
|
}, {
|
|
@@ -242227,11 +242352,11 @@ function getWhoamiCommand(context) {
|
|
|
242227
242352
|
}
|
|
242228
242353
|
|
|
242229
242354
|
// src/cli/commands/connectors/pull.ts
|
|
242230
|
-
import { dirname as
|
|
242355
|
+
import { dirname as dirname9, join as join11 } from "node:path";
|
|
242231
242356
|
async function pullConnectorsAction() {
|
|
242232
242357
|
const { project: project2 } = await readProjectConfig();
|
|
242233
|
-
const configDir =
|
|
242234
|
-
const connectorsDir =
|
|
242358
|
+
const configDir = dirname9(project2.configPath);
|
|
242359
|
+
const connectorsDir = join11(configDir, project2.connectorsDir);
|
|
242235
242360
|
const remoteConnectors = await runTask("Fetching connectors from Base44", async () => {
|
|
242236
242361
|
return await listConnectors();
|
|
242237
242362
|
}, {
|
|
@@ -243079,46 +243204,225 @@ function getEntitiesPushCommand(context) {
|
|
|
243079
243204
|
}));
|
|
243080
243205
|
}
|
|
243081
243206
|
|
|
243207
|
+
// src/cli/utils/parseNames.ts
|
|
243208
|
+
function parseNames(args) {
|
|
243209
|
+
return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
|
|
243210
|
+
}
|
|
243211
|
+
|
|
243212
|
+
// src/cli/commands/functions/delete.ts
|
|
243213
|
+
async function deleteFunctionsAction(names) {
|
|
243214
|
+
let deleted = 0;
|
|
243215
|
+
let notFound = 0;
|
|
243216
|
+
let errors4 = 0;
|
|
243217
|
+
let completed = 0;
|
|
243218
|
+
const total = names.length;
|
|
243219
|
+
for (const name2 of names) {
|
|
243220
|
+
R2.step(theme.styles.dim(`[${completed + 1}/${total}] Deleting ${name2}...`));
|
|
243221
|
+
try {
|
|
243222
|
+
await deleteSingleFunction(name2);
|
|
243223
|
+
R2.success(`${name2.padEnd(25)} deleted`);
|
|
243224
|
+
deleted++;
|
|
243225
|
+
} catch (error48) {
|
|
243226
|
+
if (error48 instanceof ApiError && error48.statusCode === 404) {
|
|
243227
|
+
R2.warn(`${name2.padEnd(25)} not found`);
|
|
243228
|
+
notFound++;
|
|
243229
|
+
} else {
|
|
243230
|
+
R2.error(`${name2.padEnd(25)} error: ${error48 instanceof Error ? error48.message : String(error48)}`);
|
|
243231
|
+
errors4++;
|
|
243232
|
+
}
|
|
243233
|
+
}
|
|
243234
|
+
completed++;
|
|
243235
|
+
}
|
|
243236
|
+
if (names.length === 1) {
|
|
243237
|
+
if (deleted)
|
|
243238
|
+
return { outroMessage: `Function "${names[0]}" deleted` };
|
|
243239
|
+
if (notFound)
|
|
243240
|
+
return { outroMessage: `Function "${names[0]}" not found` };
|
|
243241
|
+
return { outroMessage: `Failed to delete "${names[0]}"` };
|
|
243242
|
+
}
|
|
243243
|
+
const parts = [];
|
|
243244
|
+
if (deleted > 0)
|
|
243245
|
+
parts.push(`${deleted}/${total} deleted`);
|
|
243246
|
+
if (notFound > 0)
|
|
243247
|
+
parts.push(`${notFound} not found`);
|
|
243248
|
+
if (errors4 > 0)
|
|
243249
|
+
parts.push(`${errors4} error${errors4 !== 1 ? "s" : ""}`);
|
|
243250
|
+
return { outroMessage: parts.join(", ") };
|
|
243251
|
+
}
|
|
243252
|
+
function getDeleteCommand(context) {
|
|
243253
|
+
return new Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").action(async (rawNames) => {
|
|
243254
|
+
await runCommand(() => {
|
|
243255
|
+
const names = parseNames(rawNames);
|
|
243256
|
+
if (names.length === 0) {
|
|
243257
|
+
throw new InvalidInputError("At least one function name is required");
|
|
243258
|
+
}
|
|
243259
|
+
return deleteFunctionsAction(names);
|
|
243260
|
+
}, { requireAuth: true }, context);
|
|
243261
|
+
});
|
|
243262
|
+
}
|
|
243263
|
+
|
|
243264
|
+
// src/cli/utils/formatDeployResult.ts
|
|
243265
|
+
function formatDuration(ms) {
|
|
243266
|
+
return `${(ms / 1000).toFixed(1)}s`;
|
|
243267
|
+
}
|
|
243268
|
+
function formatDeployResult(result) {
|
|
243269
|
+
const label = result.name.padEnd(25);
|
|
243270
|
+
if (result.status === "deployed") {
|
|
243271
|
+
const timing = result.durationMs ? theme.styles.dim(` (${formatDuration(result.durationMs)})`) : "";
|
|
243272
|
+
R2.success(`${label} deployed${timing}`);
|
|
243273
|
+
} else if (result.status === "unchanged") {
|
|
243274
|
+
R2.success(`${label} unchanged`);
|
|
243275
|
+
} else {
|
|
243276
|
+
R2.error(`${label} error: ${result.error}`);
|
|
243277
|
+
}
|
|
243278
|
+
}
|
|
243279
|
+
|
|
243082
243280
|
// src/cli/commands/functions/deploy.ts
|
|
243083
|
-
|
|
243281
|
+
function resolveFunctionsToDeploy(names, allFunctions) {
|
|
243282
|
+
if (names.length === 0)
|
|
243283
|
+
return allFunctions;
|
|
243284
|
+
const notFound = names.filter((n2) => !allFunctions.some((f) => f.name === n2));
|
|
243285
|
+
if (notFound.length > 0) {
|
|
243286
|
+
throw new InvalidInputError(`Function${notFound.length > 1 ? "s" : ""} not found in project: ${notFound.join(", ")}`);
|
|
243287
|
+
}
|
|
243288
|
+
return allFunctions.filter((f) => names.includes(f.name));
|
|
243289
|
+
}
|
|
243290
|
+
function formatPruneResults(pruneResults) {
|
|
243291
|
+
for (const pruneResult of pruneResults) {
|
|
243292
|
+
if (pruneResult.deleted) {
|
|
243293
|
+
R2.success(`${pruneResult.name.padEnd(25)} deleted`);
|
|
243294
|
+
} else {
|
|
243295
|
+
R2.error(`${pruneResult.name.padEnd(25)} error: ${pruneResult.error}`);
|
|
243296
|
+
}
|
|
243297
|
+
}
|
|
243298
|
+
if (pruneResults.length > 0) {
|
|
243299
|
+
const pruned = pruneResults.filter((r) => r.deleted).length;
|
|
243300
|
+
R2.info(`${pruned} function${pruned !== 1 ? "s" : ""} removed`);
|
|
243301
|
+
}
|
|
243302
|
+
}
|
|
243303
|
+
function buildDeploySummary(results) {
|
|
243304
|
+
const deployed = results.filter((r) => r.status !== "error").length;
|
|
243305
|
+
const failed = results.filter((r) => r.status === "error").length;
|
|
243306
|
+
const parts = [];
|
|
243307
|
+
if (deployed > 0)
|
|
243308
|
+
parts.push(`${deployed}/${results.length} deployed`);
|
|
243309
|
+
if (failed > 0)
|
|
243310
|
+
parts.push(`${failed} error${failed !== 1 ? "s" : ""}`);
|
|
243311
|
+
return parts.join(", ") || "No functions deployed";
|
|
243312
|
+
}
|
|
243313
|
+
async function deployFunctionsAction(names, options) {
|
|
243314
|
+
if (options.force && names.length > 0) {
|
|
243315
|
+
throw new InvalidInputError("--force cannot be used when specifying function names");
|
|
243316
|
+
}
|
|
243084
243317
|
const { functions } = await readProjectConfig();
|
|
243085
|
-
|
|
243318
|
+
const toDeploy = resolveFunctionsToDeploy(names, functions);
|
|
243319
|
+
if (toDeploy.length === 0) {
|
|
243086
243320
|
return {
|
|
243087
243321
|
outroMessage: "No functions found. Create functions in the 'functions' directory."
|
|
243088
243322
|
};
|
|
243089
243323
|
}
|
|
243090
|
-
R2.info(`Found ${
|
|
243091
|
-
|
|
243092
|
-
|
|
243324
|
+
R2.info(`Found ${toDeploy.length} ${toDeploy.length === 1 ? "function" : "functions"} to deploy`);
|
|
243325
|
+
let completed = 0;
|
|
243326
|
+
const total = toDeploy.length;
|
|
243327
|
+
const results = await deployFunctionsSequentially(toDeploy, {
|
|
243328
|
+
onStart: (startNames) => {
|
|
243329
|
+
const label = startNames.length === 1 ? startNames[0] : `${startNames.length} functions`;
|
|
243330
|
+
R2.step(theme.styles.dim(`[${completed + 1}/${total}] Deploying ${label}...`));
|
|
243331
|
+
},
|
|
243332
|
+
onResult: (result) => {
|
|
243333
|
+
completed++;
|
|
243334
|
+
formatDeployResult(result);
|
|
243335
|
+
}
|
|
243336
|
+
});
|
|
243337
|
+
if (options.force) {
|
|
243338
|
+
R2.info("Removing remote functions not found locally...");
|
|
243339
|
+
const allLocalNames = functions.map((f) => f.name);
|
|
243340
|
+
const pruneResults = await pruneRemovedFunctions(allLocalNames);
|
|
243341
|
+
formatPruneResults(pruneResults);
|
|
243342
|
+
}
|
|
243343
|
+
return { outroMessage: buildDeploySummary(results) };
|
|
243344
|
+
}
|
|
243345
|
+
function getDeployCommand(context) {
|
|
243346
|
+
return new Command("deploy").description("Deploy functions to Base44").argument("[names...]", "Function names to deploy (deploys all if omitted)").option("--force", "Delete remote functions not found locally").action(async (rawNames, options) => {
|
|
243347
|
+
await runCommand(() => {
|
|
243348
|
+
const names = parseNames(rawNames);
|
|
243349
|
+
return deployFunctionsAction(names, options);
|
|
243350
|
+
}, { requireAuth: true }, context);
|
|
243351
|
+
});
|
|
243352
|
+
}
|
|
243353
|
+
|
|
243354
|
+
// src/cli/commands/functions/list.ts
|
|
243355
|
+
async function listFunctionsAction() {
|
|
243356
|
+
const { functions } = await listDeployedFunctions();
|
|
243357
|
+
if (functions.length === 0) {
|
|
243358
|
+
return { outroMessage: "No functions on remote" };
|
|
243359
|
+
}
|
|
243360
|
+
for (const fn of functions) {
|
|
243361
|
+
const autoCount = fn.automations.length;
|
|
243362
|
+
const autoLabel = autoCount > 0 ? theme.styles.dim(` (${autoCount} automation${autoCount > 1 ? "s" : ""})`) : "";
|
|
243363
|
+
R2.message(` ${fn.name}${autoLabel}`);
|
|
243364
|
+
}
|
|
243365
|
+
return {
|
|
243366
|
+
outroMessage: `${functions.length} function${functions.length !== 1 ? "s" : ""} on remote`
|
|
243367
|
+
};
|
|
243368
|
+
}
|
|
243369
|
+
function getListCommand(context) {
|
|
243370
|
+
return new Command("list").description("List all deployed functions").action(async () => {
|
|
243371
|
+
await runCommand(listFunctionsAction, { requireAuth: true }, context);
|
|
243372
|
+
});
|
|
243373
|
+
}
|
|
243374
|
+
|
|
243375
|
+
// src/cli/commands/functions/pull.ts
|
|
243376
|
+
import { dirname as dirname10, join as join12 } from "node:path";
|
|
243377
|
+
async function pullFunctionsAction(name2) {
|
|
243378
|
+
const { project: project2 } = await readProjectConfig();
|
|
243379
|
+
const configDir = dirname10(project2.configPath);
|
|
243380
|
+
const functionsDir = join12(configDir, project2.functionsDir);
|
|
243381
|
+
const remoteFunctions = await runTask("Fetching functions from Base44", async () => {
|
|
243382
|
+
const { functions } = await listDeployedFunctions();
|
|
243383
|
+
return functions;
|
|
243093
243384
|
}, {
|
|
243094
|
-
successMessage: "Functions
|
|
243095
|
-
errorMessage: "Failed to
|
|
243385
|
+
successMessage: "Functions fetched successfully",
|
|
243386
|
+
errorMessage: "Failed to fetch functions"
|
|
243096
243387
|
});
|
|
243097
|
-
|
|
243098
|
-
|
|
243388
|
+
const toPull = name2 ? remoteFunctions.filter((f) => f.name === name2) : remoteFunctions;
|
|
243389
|
+
if (name2 && toPull.length === 0) {
|
|
243390
|
+
return {
|
|
243391
|
+
outroMessage: `Function "${name2}" not found on remote`
|
|
243392
|
+
};
|
|
243099
243393
|
}
|
|
243100
|
-
if (
|
|
243101
|
-
|
|
243394
|
+
if (toPull.length === 0) {
|
|
243395
|
+
return { outroMessage: "No functions found on remote" };
|
|
243102
243396
|
}
|
|
243103
|
-
|
|
243104
|
-
|
|
243105
|
-
|
|
243106
|
-
|
|
243107
|
-
|
|
243108
|
-
|
|
243109
|
-
|
|
243110
|
-
});
|
|
243397
|
+
const { written, skipped } = await runTask("Writing function files", async () => {
|
|
243398
|
+
return await writeFunctions(functionsDir, toPull);
|
|
243399
|
+
}, {
|
|
243400
|
+
successMessage: "Function files written successfully",
|
|
243401
|
+
errorMessage: "Failed to write function files"
|
|
243402
|
+
});
|
|
243403
|
+
for (const name3 of written) {
|
|
243404
|
+
R2.success(`${name3.padEnd(25)} written`);
|
|
243405
|
+
}
|
|
243406
|
+
for (const name3 of skipped) {
|
|
243407
|
+
R2.info(`${name3.padEnd(25)} unchanged`);
|
|
243111
243408
|
}
|
|
243112
|
-
return {
|
|
243409
|
+
return {
|
|
243410
|
+
outroMessage: `Pulled ${toPull.length} function${toPull.length !== 1 ? "s" : ""} to ${functionsDir}`
|
|
243411
|
+
};
|
|
243113
243412
|
}
|
|
243114
|
-
function
|
|
243115
|
-
return new Command("
|
|
243116
|
-
await runCommand(
|
|
243117
|
-
})
|
|
243413
|
+
function getPullCommand(context) {
|
|
243414
|
+
return new Command("pull").description("Pull deployed functions from Base44").argument("[name]", "Pull a single function by name").action(async (name2) => {
|
|
243415
|
+
await runCommand(() => pullFunctionsAction(name2), { requireAuth: true }, context);
|
|
243416
|
+
});
|
|
243417
|
+
}
|
|
243418
|
+
|
|
243419
|
+
// src/cli/commands/functions/index.ts
|
|
243420
|
+
function getFunctionsCommand(context) {
|
|
243421
|
+
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getPullCommand(context)).addCommand(getListCommand(context)).addCommand(getDeleteCommand(context));
|
|
243118
243422
|
}
|
|
243119
243423
|
|
|
243120
243424
|
// src/cli/commands/project/create.ts
|
|
243121
|
-
import { basename as basename3, join as
|
|
243425
|
+
import { basename as basename3, join as join13, resolve as resolve2 } from "node:path";
|
|
243122
243426
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
243123
243427
|
var DEFAULT_TEMPLATE_ID = "backend-only";
|
|
243124
243428
|
async function getTemplateById(templateId) {
|
|
@@ -243254,7 +243558,7 @@ async function executeCreate({
|
|
|
243254
243558
|
updateMessage("Building project...");
|
|
243255
243559
|
await execa({ cwd: resolvedPath, shell: true })`${buildCommand}`;
|
|
243256
243560
|
updateMessage("Deploying site...");
|
|
243257
|
-
return await deploySite(
|
|
243561
|
+
return await deploySite(join13(resolvedPath, outputDirectory));
|
|
243258
243562
|
}, {
|
|
243259
243563
|
successMessage: theme.colors.base44Orange("Site deployed successfully"),
|
|
243260
243564
|
errorMessage: "Failed to deploy site"
|
|
@@ -243334,11 +243638,17 @@ ${summaryLines.join(`
|
|
|
243334
243638
|
${summaryLines.join(`
|
|
243335
243639
|
`)}`);
|
|
243336
243640
|
}
|
|
243337
|
-
|
|
243338
|
-
|
|
243339
|
-
|
|
243340
|
-
|
|
243341
|
-
|
|
243641
|
+
let functionCompleted = 0;
|
|
243642
|
+
const functionTotal = functions.length;
|
|
243643
|
+
const result = await deployAll(projectData, {
|
|
243644
|
+
onFunctionStart: (names) => {
|
|
243645
|
+
const label = names.length === 1 ? names[0] : `${names.length} functions`;
|
|
243646
|
+
R2.step(theme.styles.dim(`[${functionCompleted + 1}/${functionTotal}] Deploying ${label}...`));
|
|
243647
|
+
},
|
|
243648
|
+
onFunctionResult: (r) => {
|
|
243649
|
+
functionCompleted++;
|
|
243650
|
+
formatDeployResult(r);
|
|
243651
|
+
}
|
|
243342
243652
|
});
|
|
243343
243653
|
const needsOAuth = filterPendingOAuth(result.connectorResults ?? []);
|
|
243344
243654
|
if (needsOAuth.length > 0) {
|
|
@@ -243356,7 +243666,7 @@ ${summaryLines.join(`
|
|
|
243356
243666
|
}
|
|
243357
243667
|
return { outroMessage: "App deployed successfully" };
|
|
243358
243668
|
}
|
|
243359
|
-
function
|
|
243669
|
+
function getDeployCommand2(context) {
|
|
243360
243670
|
return new Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").action(async (options) => {
|
|
243361
243671
|
await runCommand(() => deployAction({
|
|
243362
243672
|
...options,
|
|
@@ -243880,10 +244190,10 @@ function toPascalCase(name2) {
|
|
|
243880
244190
|
return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
|
|
243881
244191
|
}
|
|
243882
244192
|
// src/core/types/update-project.ts
|
|
243883
|
-
import { join as
|
|
244193
|
+
import { join as join16 } from "node:path";
|
|
243884
244194
|
var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
|
|
243885
244195
|
async function updateProjectConfig(projectRoot) {
|
|
243886
|
-
const tsconfigPath =
|
|
244196
|
+
const tsconfigPath = join16(projectRoot, "tsconfig.json");
|
|
243887
244197
|
if (!await pathExists(tsconfigPath)) {
|
|
243888
244198
|
return false;
|
|
243889
244199
|
}
|
|
@@ -243926,7 +244236,7 @@ function getTypesCommand(context) {
|
|
|
243926
244236
|
}
|
|
243927
244237
|
|
|
243928
244238
|
// src/cli/dev/dev-server/main.ts
|
|
243929
|
-
import { dirname as
|
|
244239
|
+
import { dirname as dirname16, join as join20 } from "node:path";
|
|
243930
244240
|
var import_cors = __toESM(require_lib4(), 1);
|
|
243931
244241
|
var import_express4 = __toESM(require_express(), 1);
|
|
243932
244242
|
|
|
@@ -244085,10 +244395,10 @@ function createDevLogger() {
|
|
|
244085
244395
|
|
|
244086
244396
|
// src/cli/dev/dev-server/function-manager.ts
|
|
244087
244397
|
import { spawn as spawn2, spawnSync as spawnSync2 } from "node:child_process";
|
|
244088
|
-
import { dirname as
|
|
244398
|
+
import { dirname as dirname13, join as join17 } from "node:path";
|
|
244089
244399
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
244090
|
-
var __dirname5 =
|
|
244091
|
-
var WRAPPER_PATH =
|
|
244400
|
+
var __dirname5 = dirname13(fileURLToPath7(import.meta.url));
|
|
244401
|
+
var WRAPPER_PATH = join17(__dirname5, "../deno-runtime/main.js");
|
|
244092
244402
|
var READY_TIMEOUT = 30000;
|
|
244093
244403
|
|
|
244094
244404
|
class FunctionManager {
|
|
@@ -244289,9 +244599,8 @@ function createFunctionRouter(manager, logger) {
|
|
|
244289
244599
|
var import_nedb = __toESM(require_nedb(), 1);
|
|
244290
244600
|
|
|
244291
244601
|
class Database {
|
|
244292
|
-
collections;
|
|
244293
|
-
|
|
244294
|
-
this.collections = new Map;
|
|
244602
|
+
collections = new Map;
|
|
244603
|
+
load(entities) {
|
|
244295
244604
|
for (const entity2 of entities) {
|
|
244296
244605
|
this.collections.set(entity2.name, new import_nedb.default);
|
|
244297
244606
|
}
|
|
@@ -244302,6 +244611,12 @@ class Database {
|
|
|
244302
244611
|
getCollectionNames() {
|
|
244303
244612
|
return Array.from(this.collections.keys());
|
|
244304
244613
|
}
|
|
244614
|
+
dropAll() {
|
|
244615
|
+
for (const collection of this.collections.values()) {
|
|
244616
|
+
collection.remove({}, { multi: true });
|
|
244617
|
+
}
|
|
244618
|
+
this.collections.clear();
|
|
244619
|
+
}
|
|
244305
244620
|
}
|
|
244306
244621
|
|
|
244307
244622
|
// node_modules/socket.io/wrapper.mjs
|
|
@@ -244657,7 +244972,7 @@ function createCustomIntegrationRoutes(remoteProxy, logger) {
|
|
|
244657
244972
|
|
|
244658
244973
|
// src/cli/dev/dev-server/watcher.ts
|
|
244659
244974
|
import { EventEmitter as EventEmitter4 } from "node:events";
|
|
244660
|
-
import { relative as
|
|
244975
|
+
import { relative as relative6 } from "node:path";
|
|
244661
244976
|
|
|
244662
244977
|
// node_modules/chokidar/index.js
|
|
244663
244978
|
import { EventEmitter as EventEmitter3 } from "node:events";
|
|
@@ -245387,9 +245702,9 @@ class NodeFsHandler {
|
|
|
245387
245702
|
if (this.fsw.closed) {
|
|
245388
245703
|
return;
|
|
245389
245704
|
}
|
|
245390
|
-
const
|
|
245705
|
+
const dirname15 = sp2.dirname(file2);
|
|
245391
245706
|
const basename5 = sp2.basename(file2);
|
|
245392
|
-
const parent = this.fsw._getWatchedDir(
|
|
245707
|
+
const parent = this.fsw._getWatchedDir(dirname15);
|
|
245393
245708
|
let prevStats = stats;
|
|
245394
245709
|
if (parent.has(basename5))
|
|
245395
245710
|
return;
|
|
@@ -245416,7 +245731,7 @@ class NodeFsHandler {
|
|
|
245416
245731
|
prevStats = newStats2;
|
|
245417
245732
|
}
|
|
245418
245733
|
} catch (error48) {
|
|
245419
|
-
this.fsw._remove(
|
|
245734
|
+
this.fsw._remove(dirname15, basename5);
|
|
245420
245735
|
}
|
|
245421
245736
|
} else if (parent.has(basename5)) {
|
|
245422
245737
|
const at13 = newStats.atimeMs;
|
|
@@ -245639,11 +245954,11 @@ function createPattern(matcher) {
|
|
|
245639
245954
|
if (matcher.path === string4)
|
|
245640
245955
|
return true;
|
|
245641
245956
|
if (matcher.recursive) {
|
|
245642
|
-
const
|
|
245643
|
-
if (!
|
|
245957
|
+
const relative6 = sp3.relative(matcher.path, string4);
|
|
245958
|
+
if (!relative6) {
|
|
245644
245959
|
return false;
|
|
245645
245960
|
}
|
|
245646
|
-
return !
|
|
245961
|
+
return !relative6.startsWith("..") && !sp3.isAbsolute(relative6);
|
|
245647
245962
|
}
|
|
245648
245963
|
return false;
|
|
245649
245964
|
};
|
|
@@ -246278,79 +246593,74 @@ var WATCH_QUEUE_DELAY_MS = 500;
|
|
|
246278
246593
|
class WatchBase44 extends EventEmitter4 {
|
|
246279
246594
|
itemsToWatch;
|
|
246280
246595
|
logger;
|
|
246281
|
-
|
|
246282
|
-
|
|
246596
|
+
entryNames;
|
|
246597
|
+
watchers = new Map;
|
|
246283
246598
|
queueWaitForCreationTimeout = null;
|
|
246284
246599
|
constructor(itemsToWatch, logger) {
|
|
246285
246600
|
super();
|
|
246286
246601
|
this.itemsToWatch = itemsToWatch;
|
|
246287
246602
|
this.logger = logger;
|
|
246603
|
+
this.entryNames = Object.keys(itemsToWatch);
|
|
246288
246604
|
}
|
|
246289
246605
|
async start() {
|
|
246290
|
-
if (this.watchers.
|
|
246606
|
+
if (this.watchers.size > 0) {
|
|
246291
246607
|
return;
|
|
246292
246608
|
}
|
|
246293
|
-
for (const
|
|
246294
|
-
|
|
246295
|
-
|
|
246296
|
-
|
|
246297
|
-
this.queueWaitForCreation.push(item);
|
|
246609
|
+
for (const name2 of this.entryNames) {
|
|
246610
|
+
const targetPath = this.itemsToWatch[name2];
|
|
246611
|
+
if (await pathExists(targetPath)) {
|
|
246612
|
+
this.watchers.set(name2, this.watchTarget(name2, targetPath));
|
|
246298
246613
|
}
|
|
246299
246614
|
}
|
|
246300
|
-
this.
|
|
246615
|
+
this.watchEntries();
|
|
246301
246616
|
}
|
|
246302
246617
|
async close() {
|
|
246303
246618
|
if (this.queueWaitForCreationTimeout) {
|
|
246304
246619
|
clearTimeout(this.queueWaitForCreationTimeout);
|
|
246305
246620
|
this.queueWaitForCreationTimeout = null;
|
|
246306
246621
|
}
|
|
246307
|
-
for (const watcher of this.watchers) {
|
|
246622
|
+
for (const watcher of this.watchers.values()) {
|
|
246308
246623
|
await watcher.close();
|
|
246309
246624
|
}
|
|
246310
|
-
this.watchers
|
|
246311
|
-
this.queueWaitForCreation = [];
|
|
246625
|
+
this.watchers.clear();
|
|
246312
246626
|
}
|
|
246313
|
-
|
|
246627
|
+
watchEntries() {
|
|
246314
246628
|
if (this.queueWaitForCreationTimeout) {
|
|
246315
246629
|
clearTimeout(this.queueWaitForCreationTimeout);
|
|
246316
246630
|
}
|
|
246317
246631
|
this.queueWaitForCreationTimeout = setTimeout(async () => {
|
|
246318
|
-
const
|
|
246319
|
-
|
|
246320
|
-
|
|
246321
|
-
|
|
246322
|
-
|
|
246632
|
+
for (const name2 of this.entryNames) {
|
|
246633
|
+
const path19 = this.itemsToWatch[name2];
|
|
246634
|
+
const watchItem = this.watchers.get(name2);
|
|
246635
|
+
const exists = await pathExists(path19);
|
|
246636
|
+
if (!watchItem && exists) {
|
|
246637
|
+
this.emit("change", name2, path19);
|
|
246638
|
+
this.watchers.set(name2, this.watchTarget(name2, path19));
|
|
246639
|
+
} else if (watchItem && !exists) {
|
|
246640
|
+
await watchItem.close();
|
|
246641
|
+
this.emit("change", name2, path19);
|
|
246642
|
+
setTimeout(() => {
|
|
246643
|
+
this.watchers.forEach((watcher, watcherName) => {
|
|
246644
|
+
if (watcher.closed) {
|
|
246645
|
+
this.watchers.delete(watcherName);
|
|
246646
|
+
}
|
|
246647
|
+
});
|
|
246648
|
+
});
|
|
246323
246649
|
}
|
|
246324
246650
|
}
|
|
246325
|
-
this.
|
|
246326
|
-
|
|
246327
|
-
this.watchCreationQueue();
|
|
246328
|
-
} else {
|
|
246329
|
-
this.queueWaitForCreationTimeout = null;
|
|
246330
|
-
}
|
|
246651
|
+
this.queueWaitForCreationTimeout = null;
|
|
246652
|
+
this.watchEntries();
|
|
246331
246653
|
}, WATCH_QUEUE_DELAY_MS);
|
|
246332
246654
|
}
|
|
246333
|
-
watchTarget(
|
|
246334
|
-
const
|
|
246335
|
-
this.emit("change", item.name, relative4(item.path, path19));
|
|
246336
|
-
}, WATCH_DEBOUNCE_MS);
|
|
246337
|
-
const watcher = watch(item.path, {
|
|
246655
|
+
watchTarget(name2, targetPath) {
|
|
246656
|
+
const watcher = watch(targetPath, {
|
|
246338
246657
|
ignoreInitial: true
|
|
246339
246658
|
});
|
|
246340
|
-
watcher.on("all",
|
|
246341
|
-
|
|
246342
|
-
|
|
246343
|
-
return;
|
|
246344
|
-
}
|
|
246345
|
-
await watcher.close();
|
|
246346
|
-
this.queueWaitForCreation.push(item);
|
|
246347
|
-
this.watchCreationQueue();
|
|
246348
|
-
setTimeout(() => {
|
|
246349
|
-
this.watchers = this.watchers.filter((watcher2) => !watcher2.closed);
|
|
246350
|
-
});
|
|
246351
|
-
});
|
|
246659
|
+
watcher.on("all", import_debounce.default(async (_event, path19) => {
|
|
246660
|
+
this.emit("change", name2, relative6(targetPath, path19));
|
|
246661
|
+
}, WATCH_DEBOUNCE_MS));
|
|
246352
246662
|
watcher.on("error", (err) => {
|
|
246353
|
-
this.logger.error(`Watch handler failed for ${
|
|
246663
|
+
this.logger.error(`Watch handler failed for ${targetPath}`, err instanceof Error ? err : undefined);
|
|
246354
246664
|
});
|
|
246355
246665
|
return watcher;
|
|
246356
246666
|
}
|
|
@@ -246388,7 +246698,8 @@ async function createDevServer(options8) {
|
|
|
246388
246698
|
if (functionManager.getFunctionNames().length > 0) {
|
|
246389
246699
|
R2.info(`Loaded functions: ${functionManager.getFunctionNames().join(", ")}`);
|
|
246390
246700
|
}
|
|
246391
|
-
const db2 = new Database
|
|
246701
|
+
const db2 = new Database;
|
|
246702
|
+
db2.load(entities);
|
|
246392
246703
|
if (db2.getCollectionNames().length > 0) {
|
|
246393
246704
|
R2.info(`Loaded entities: ${db2.getCollectionNames().join(", ")}`);
|
|
246394
246705
|
}
|
|
@@ -246422,16 +246733,14 @@ async function createDevServer(options8) {
|
|
|
246422
246733
|
emitEntityEvent = (appId, entityName, event) => {
|
|
246423
246734
|
broadcastEntityEvent(io6, appId, entityName, event);
|
|
246424
246735
|
};
|
|
246425
|
-
const base44ConfigWatcher = new WatchBase44(
|
|
246426
|
-
|
|
246427
|
-
|
|
246428
|
-
|
|
246429
|
-
}
|
|
246430
|
-
], devLogger);
|
|
246736
|
+
const base44ConfigWatcher = new WatchBase44({
|
|
246737
|
+
functions: join20(dirname16(project2.configPath), project2.functionsDir),
|
|
246738
|
+
entities: join20(dirname16(project2.configPath), project2.entitiesDir)
|
|
246739
|
+
}, devLogger);
|
|
246431
246740
|
base44ConfigWatcher.on("change", async (name2) => {
|
|
246432
246741
|
try {
|
|
246742
|
+
const { functions: functions2, entities: entities2 } = await options8.loadResources();
|
|
246433
246743
|
if (name2 === "functions") {
|
|
246434
|
-
const { functions: functions2 } = await options8.loadResources();
|
|
246435
246744
|
const previousFunctionCount = functionManager.getFunctionNames().length;
|
|
246436
246745
|
functionManager.reload(functions2);
|
|
246437
246746
|
const names = functionManager.getFunctionNames();
|
|
@@ -246441,6 +246750,17 @@ async function createDevServer(options8) {
|
|
|
246441
246750
|
devLogger.log("All functions removed");
|
|
246442
246751
|
}
|
|
246443
246752
|
}
|
|
246753
|
+
if (name2 === "entities") {
|
|
246754
|
+
const previousEntityCount = db2.getCollectionNames().length;
|
|
246755
|
+
db2.dropAll();
|
|
246756
|
+
if (previousEntityCount > 0) {
|
|
246757
|
+
devLogger.log("Entities directory changed, clearing data...");
|
|
246758
|
+
}
|
|
246759
|
+
db2.load(entities2);
|
|
246760
|
+
if (db2.getCollectionNames().length > 0) {
|
|
246761
|
+
devLogger.log(`Loaded entities: ${db2.getCollectionNames().join(", ")}`);
|
|
246762
|
+
}
|
|
246763
|
+
}
|
|
246444
246764
|
} catch (error48) {
|
|
246445
246765
|
const errorMessage = error48 instanceof Error ? error48.message : String(error48);
|
|
246446
246766
|
devLogger.error(errorMessage);
|
|
@@ -246584,13 +246904,13 @@ function createProgram(context) {
|
|
|
246584
246904
|
program2.addCommand(getLogoutCommand(context));
|
|
246585
246905
|
program2.addCommand(getCreateCommand(context));
|
|
246586
246906
|
program2.addCommand(getDashboardCommand(context));
|
|
246587
|
-
program2.addCommand(
|
|
246907
|
+
program2.addCommand(getDeployCommand2(context));
|
|
246588
246908
|
program2.addCommand(getLinkCommand(context));
|
|
246589
246909
|
program2.addCommand(getEjectCommand(context));
|
|
246590
246910
|
program2.addCommand(getEntitiesPushCommand(context));
|
|
246591
246911
|
program2.addCommand(getAgentsCommand(context));
|
|
246592
246912
|
program2.addCommand(getConnectorsCommand(context));
|
|
246593
|
-
program2.addCommand(
|
|
246913
|
+
program2.addCommand(getFunctionsCommand(context));
|
|
246594
246914
|
program2.addCommand(getSecretsCommand(context));
|
|
246595
246915
|
program2.addCommand(getSiteCommand(context));
|
|
246596
246916
|
program2.addCommand(getTypesCommand(context));
|
|
@@ -246604,7 +246924,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
|
|
|
246604
246924
|
import { release, type } from "node:os";
|
|
246605
246925
|
|
|
246606
246926
|
// node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
246607
|
-
import { dirname as
|
|
246927
|
+
import { dirname as dirname17, posix, sep } from "path";
|
|
246608
246928
|
function createModulerModifier() {
|
|
246609
246929
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
246610
246930
|
return async (frames) => {
|
|
@@ -246613,7 +246933,7 @@ function createModulerModifier() {
|
|
|
246613
246933
|
return frames;
|
|
246614
246934
|
};
|
|
246615
246935
|
}
|
|
246616
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
246936
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname17(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
|
|
246617
246937
|
const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
|
|
246618
246938
|
return (filename) => {
|
|
246619
246939
|
if (!filename)
|
|
@@ -249817,9 +250137,9 @@ function matchPropertyGroup(propertyGroup, propertyValues, cohortProperties, deb
|
|
|
249817
250137
|
throw new InconclusiveMatchError("can't match cohort without a given cohort property value");
|
|
249818
250138
|
return propertyGroupType === "AND";
|
|
249819
250139
|
}
|
|
249820
|
-
function isValidRegex(
|
|
250140
|
+
function isValidRegex(regex) {
|
|
249821
250141
|
try {
|
|
249822
|
-
new RegExp(
|
|
250142
|
+
new RegExp(regex);
|
|
249823
250143
|
return true;
|
|
249824
250144
|
} catch (err) {
|
|
249825
250145
|
return false;
|
|
@@ -249837,8 +250157,8 @@ function convertToDateTime(value) {
|
|
|
249837
250157
|
throw new InconclusiveMatchError(`The date provided ${value} must be a string, number, or date object`);
|
|
249838
250158
|
}
|
|
249839
250159
|
function relativeDateParseForFeatureFlagMatching(value) {
|
|
249840
|
-
const
|
|
249841
|
-
const match = value.match(
|
|
250160
|
+
const regex = /^-?(?<number>[0-9]+)(?<interval>[a-z])$/;
|
|
250161
|
+
const match = value.match(regex);
|
|
249842
250162
|
const parsedDt = new Date(new Date().toISOString());
|
|
249843
250163
|
if (!match)
|
|
249844
250164
|
return null;
|
|
@@ -250831,4 +251151,4 @@ export {
|
|
|
250831
251151
|
CLIExitError
|
|
250832
251152
|
};
|
|
250833
251153
|
|
|
250834
|
-
//# debugId=
|
|
251154
|
+
//# debugId=0324A58C26AC18BA64756E2164756E21
|