@base44-preview/cli 0.0.37-pr.365.600b1d5 → 0.0.38-pr.251.a2ee20c
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 +447 -241
- package/dist/cli/index.js.map +25 -26
- 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}`);
|
|
@@ -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;
|
|
@@ -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 = ({
|
|
@@ -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,7 +156272,7 @@ 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 dirname12 = path18.dirname;
|
|
156276
156276
|
var basename4 = path18.basename;
|
|
156277
156277
|
var extname2 = path18.extname;
|
|
156278
156278
|
var join15 = path18.join;
|
|
@@ -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 = dirname12(loc);
|
|
156315
156315
|
var file2 = basename4(loc);
|
|
156316
156316
|
path19 = this.resolve(dir, file2);
|
|
156317
156317
|
}
|
|
@@ -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;
|
|
@@ -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
|
}
|
|
@@ -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 join9 } from "node:path";
|
|
210675
210675
|
|
|
210676
210676
|
// node_modules/@clack/core/dist/index.mjs
|
|
210677
210677
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
@@ -225313,6 +225313,9 @@ var UserInfoSchema = exports_external.object({
|
|
|
225313
225313
|
name: exports_external.string()
|
|
225314
225314
|
});
|
|
225315
225315
|
|
|
225316
|
+
// src/core/clients/base44-client.ts
|
|
225317
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
225318
|
+
|
|
225316
225319
|
// node_modules/ky/distribution/errors/HTTPError.js
|
|
225317
225320
|
class HTTPError extends Error {
|
|
225318
225321
|
response;
|
|
@@ -226141,7 +226144,9 @@ import { fileURLToPath } from "node:url";
|
|
|
226141
226144
|
var PROJECT_SUBDIR = "base44";
|
|
226142
226145
|
var CONFIG_FILE_EXTENSION = "jsonc";
|
|
226143
226146
|
var CONFIG_FILE_EXTENSION_GLOB = "{json,jsonc}";
|
|
226144
|
-
var
|
|
226147
|
+
var FUNCTION_CONFIG_GLOB = `**/function.${CONFIG_FILE_EXTENSION_GLOB}`;
|
|
226148
|
+
var ENTRY_FILE_GLOB = "**/entry.{js,ts}";
|
|
226149
|
+
var ENTRY_IGNORE_DOT_PATHS = ["**/*.*/**"];
|
|
226145
226150
|
var APP_CONFIG_PATTERN = `**/.app.${CONFIG_FILE_EXTENSION_GLOB}`;
|
|
226146
226151
|
var PROJECT_CONFIG_PATTERNS = [
|
|
226147
226152
|
`${PROJECT_SUBDIR}/config.${CONFIG_FILE_EXTENSION_GLOB}`,
|
|
@@ -233170,7 +233175,7 @@ var generateGlobTasks = normalizeArguments(generateTasks);
|
|
|
233170
233175
|
var generateGlobTasksSync = normalizeArgumentsSync(generateTasksSync);
|
|
233171
233176
|
|
|
233172
233177
|
// src/core/project/config.ts
|
|
233173
|
-
import { dirname as
|
|
233178
|
+
import { dirname as dirname6, join as join6 } from "node:path";
|
|
233174
233179
|
|
|
233175
233180
|
// src/core/resources/agent/schema.ts
|
|
233176
233181
|
var EntityOperationSchema = exports_external.enum(["create", "update", "delete", "read"]);
|
|
@@ -233386,6 +233391,10 @@ var GoogleBigQueryConnectorSchema = exports_external.object({
|
|
|
233386
233391
|
type: exports_external.literal("googlebigquery"),
|
|
233387
233392
|
scopes: exports_external.array(exports_external.string()).default([])
|
|
233388
233393
|
});
|
|
233394
|
+
var StripeConnectorSchema = exports_external.object({
|
|
233395
|
+
type: exports_external.literal("stripe"),
|
|
233396
|
+
scopes: exports_external.array(exports_external.string()).default([])
|
|
233397
|
+
});
|
|
233389
233398
|
var CustomTypeSchema = exports_external.string().min(1).regex(/^[a-z0-9_-]+$/i);
|
|
233390
233399
|
var GenericConnectorSchema = exports_external.object({
|
|
233391
233400
|
type: CustomTypeSchema,
|
|
@@ -233405,6 +233414,7 @@ var ConnectorResourceSchema = exports_external.union([
|
|
|
233405
233414
|
HubspotConnectorSchema,
|
|
233406
233415
|
LinkedInConnectorSchema,
|
|
233407
233416
|
TikTokConnectorSchema,
|
|
233417
|
+
StripeConnectorSchema,
|
|
233408
233418
|
GenericConnectorSchema
|
|
233409
233419
|
]);
|
|
233410
233420
|
var KnownIntegrationTypes = [
|
|
@@ -233420,7 +233430,8 @@ var KnownIntegrationTypes = [
|
|
|
233420
233430
|
"salesforce",
|
|
233421
233431
|
"hubspot",
|
|
233422
233432
|
"linkedin",
|
|
233423
|
-
"tiktok"
|
|
233433
|
+
"tiktok",
|
|
233434
|
+
"stripe"
|
|
233424
233435
|
];
|
|
233425
233436
|
var IntegrationTypeSchema = exports_external.union([
|
|
233426
233437
|
exports_external.enum(KnownIntegrationTypes),
|
|
@@ -233473,6 +233484,18 @@ var RemoveConnectorResponseSchema = exports_external.object({
|
|
|
233473
233484
|
status: data.status,
|
|
233474
233485
|
integrationType: data.integration_type
|
|
233475
233486
|
}));
|
|
233487
|
+
var STRIPE_CONNECTOR_TYPE = "stripe";
|
|
233488
|
+
var InstallStripeResponseSchema = exports_external.object({
|
|
233489
|
+
already_installed: exports_external.boolean(),
|
|
233490
|
+
claim_url: exports_external.string().nullable()
|
|
233491
|
+
});
|
|
233492
|
+
var StripeStatusResponseSchema = exports_external.object({
|
|
233493
|
+
stripe_mode: exports_external.enum(["sandbox", "live"]).nullable(),
|
|
233494
|
+
sandbox_claim_url: exports_external.string().nullable().optional()
|
|
233495
|
+
});
|
|
233496
|
+
var RemoveStripeResponseSchema = exports_external.object({
|
|
233497
|
+
success: exports_external.boolean()
|
|
233498
|
+
});
|
|
233476
233499
|
|
|
233477
233500
|
// src/core/resources/connector/api.ts
|
|
233478
233501
|
async function listConnectors() {
|
|
@@ -233540,6 +233563,54 @@ async function removeConnector(integrationType) {
|
|
|
233540
233563
|
}
|
|
233541
233564
|
return result.data;
|
|
233542
233565
|
}
|
|
233566
|
+
async function installStripe() {
|
|
233567
|
+
const appClient = getAppClient();
|
|
233568
|
+
let response;
|
|
233569
|
+
try {
|
|
233570
|
+
response = await appClient.post("payments/stripe/install", {
|
|
233571
|
+
timeout: 60000
|
|
233572
|
+
});
|
|
233573
|
+
} catch (error48) {
|
|
233574
|
+
throw await ApiError.fromHttpError(error48, "installing Stripe");
|
|
233575
|
+
}
|
|
233576
|
+
const result = InstallStripeResponseSchema.safeParse(await response.json());
|
|
233577
|
+
if (!result.success) {
|
|
233578
|
+
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
233579
|
+
}
|
|
233580
|
+
return result.data;
|
|
233581
|
+
}
|
|
233582
|
+
async function getStripeStatus() {
|
|
233583
|
+
const appClient = getAppClient();
|
|
233584
|
+
let response;
|
|
233585
|
+
try {
|
|
233586
|
+
response = await appClient.get("payments/stripe/status", {
|
|
233587
|
+
timeout: 60000
|
|
233588
|
+
});
|
|
233589
|
+
} catch (error48) {
|
|
233590
|
+
throw await ApiError.fromHttpError(error48, "checking Stripe integration status");
|
|
233591
|
+
}
|
|
233592
|
+
const result = StripeStatusResponseSchema.safeParse(await response.json());
|
|
233593
|
+
if (!result.success) {
|
|
233594
|
+
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
233595
|
+
}
|
|
233596
|
+
return result.data;
|
|
233597
|
+
}
|
|
233598
|
+
async function removeStripe() {
|
|
233599
|
+
const appClient = getAppClient();
|
|
233600
|
+
let response;
|
|
233601
|
+
try {
|
|
233602
|
+
response = await appClient.delete("payments/stripe", {
|
|
233603
|
+
timeout: 60000
|
|
233604
|
+
});
|
|
233605
|
+
} catch (error48) {
|
|
233606
|
+
throw await ApiError.fromHttpError(error48, "removing Stripe integration");
|
|
233607
|
+
}
|
|
233608
|
+
const result = RemoveStripeResponseSchema.safeParse(await response.json());
|
|
233609
|
+
if (!result.success) {
|
|
233610
|
+
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
233611
|
+
}
|
|
233612
|
+
return result.data;
|
|
233613
|
+
}
|
|
233543
233614
|
// src/core/resources/connector/config.ts
|
|
233544
233615
|
import { join as join4 } from "node:path";
|
|
233545
233616
|
import { isDeepStrictEqual as isDeepStrictEqual2 } from "node:util";
|
|
@@ -233588,7 +233659,7 @@ async function readAllConnectors(connectorsDir) {
|
|
|
233588
233659
|
async function writeConnectors(connectorsDir, remoteConnectors) {
|
|
233589
233660
|
const entries = await readConnectorFiles(connectorsDir);
|
|
233590
233661
|
const typeToEntry = buildTypeToEntryMap(entries);
|
|
233591
|
-
const newTypes = new Set(remoteConnectors.map((c) => c.
|
|
233662
|
+
const newTypes = new Set(remoteConnectors.map((c) => c.type));
|
|
233592
233663
|
const deleted = [];
|
|
233593
233664
|
for (const [type, entry] of typeToEntry) {
|
|
233594
233665
|
if (!newTypes.has(type)) {
|
|
@@ -233598,22 +233669,44 @@ async function writeConnectors(connectorsDir, remoteConnectors) {
|
|
|
233598
233669
|
}
|
|
233599
233670
|
const written = [];
|
|
233600
233671
|
for (const connector of remoteConnectors) {
|
|
233601
|
-
const existing = typeToEntry.get(connector.
|
|
233602
|
-
|
|
233603
|
-
type: connector.integrationType,
|
|
233604
|
-
scopes: connector.scopes
|
|
233605
|
-
};
|
|
233606
|
-
if (existing && isDeepStrictEqual2(existing.data, localConnector)) {
|
|
233672
|
+
const existing = typeToEntry.get(connector.type);
|
|
233673
|
+
if (existing && isDeepStrictEqual2(existing.data, connector)) {
|
|
233607
233674
|
continue;
|
|
233608
233675
|
}
|
|
233609
|
-
const filePath = existing?.filePath ?? join4(connectorsDir, `${connector.
|
|
233610
|
-
await writeJsonFile(filePath,
|
|
233611
|
-
written.push(connector.
|
|
233676
|
+
const filePath = existing?.filePath ?? join4(connectorsDir, `${connector.type}.${CONFIG_FILE_EXTENSION}`);
|
|
233677
|
+
await writeJsonFile(filePath, connector);
|
|
233678
|
+
written.push(connector.type);
|
|
233612
233679
|
}
|
|
233613
233680
|
return { written, deleted };
|
|
233614
233681
|
}
|
|
233682
|
+
// src/core/resources/connector/pull.ts
|
|
233683
|
+
async function pullAllConnectors() {
|
|
233684
|
+
const [oauthResponse, stripeStatus] = await Promise.all([
|
|
233685
|
+
listConnectors(),
|
|
233686
|
+
getStripeStatus()
|
|
233687
|
+
]);
|
|
233688
|
+
const connectors = oauthResponse.integrations.map((i) => ({
|
|
233689
|
+
type: i.integrationType,
|
|
233690
|
+
scopes: i.scopes
|
|
233691
|
+
}));
|
|
233692
|
+
if (stripeStatus.stripe_mode !== null) {
|
|
233693
|
+
connectors.push({ type: STRIPE_CONNECTOR_TYPE, scopes: [] });
|
|
233694
|
+
}
|
|
233695
|
+
return connectors;
|
|
233696
|
+
}
|
|
233615
233697
|
// src/core/resources/connector/push.ts
|
|
233616
233698
|
async function pushConnectors(connectors) {
|
|
233699
|
+
const stripeConnector = connectors.find((c) => c.type === STRIPE_CONNECTOR_TYPE);
|
|
233700
|
+
const oauthConnectors = connectors.filter((c) => c.type !== STRIPE_CONNECTOR_TYPE);
|
|
233701
|
+
const oauthResults = await syncOAuthConnectors(oauthConnectors);
|
|
233702
|
+
const stripeResult = await syncStripeConnector(stripeConnector);
|
|
233703
|
+
const results = [...oauthResults];
|
|
233704
|
+
if (stripeResult) {
|
|
233705
|
+
results.push(stripeResult);
|
|
233706
|
+
}
|
|
233707
|
+
return { results };
|
|
233708
|
+
}
|
|
233709
|
+
async function syncOAuthConnectors(connectors) {
|
|
233617
233710
|
const results = [];
|
|
233618
233711
|
const upstream = await listConnectors();
|
|
233619
233712
|
const localTypes = new Set(connectors.map((c) => c.type));
|
|
@@ -233646,7 +233739,62 @@ async function pushConnectors(connectors) {
|
|
|
233646
233739
|
}
|
|
233647
233740
|
}
|
|
233648
233741
|
}
|
|
233649
|
-
return
|
|
233742
|
+
return results;
|
|
233743
|
+
}
|
|
233744
|
+
async function syncStripeConnector(localStripe) {
|
|
233745
|
+
const remoteStatus = await fetchStripeRemoteStatus();
|
|
233746
|
+
if (remoteStatus === "error") {
|
|
233747
|
+
return localStripe ? stripeError("Failed to check Stripe integration status") : null;
|
|
233748
|
+
}
|
|
233749
|
+
const isRemoteInstalled = remoteStatus.stripe_mode !== null;
|
|
233750
|
+
const needsInstall = localStripe && !isRemoteInstalled;
|
|
233751
|
+
const alreadySynced = localStripe && isRemoteInstalled;
|
|
233752
|
+
const needsRemoval = !localStripe && isRemoteInstalled;
|
|
233753
|
+
if (needsInstall) {
|
|
233754
|
+
return handleStripeInstall();
|
|
233755
|
+
}
|
|
233756
|
+
if (alreadySynced) {
|
|
233757
|
+
return stripeSynced();
|
|
233758
|
+
}
|
|
233759
|
+
if (needsRemoval) {
|
|
233760
|
+
return handleStripeRemoval();
|
|
233761
|
+
}
|
|
233762
|
+
return null;
|
|
233763
|
+
}
|
|
233764
|
+
async function fetchStripeRemoteStatus() {
|
|
233765
|
+
try {
|
|
233766
|
+
return await getStripeStatus();
|
|
233767
|
+
} catch {
|
|
233768
|
+
return "error";
|
|
233769
|
+
}
|
|
233770
|
+
}
|
|
233771
|
+
async function handleStripeInstall() {
|
|
233772
|
+
try {
|
|
233773
|
+
const result = await installStripe();
|
|
233774
|
+
return stripeProvisioned(result.claim_url ?? undefined);
|
|
233775
|
+
} catch (err) {
|
|
233776
|
+
return stripeError(err instanceof Error ? err.message : String(err));
|
|
233777
|
+
}
|
|
233778
|
+
}
|
|
233779
|
+
async function handleStripeRemoval() {
|
|
233780
|
+
try {
|
|
233781
|
+
await removeStripe();
|
|
233782
|
+
return stripeRemoved();
|
|
233783
|
+
} catch (err) {
|
|
233784
|
+
return stripeError(err instanceof Error ? err.message : String(err));
|
|
233785
|
+
}
|
|
233786
|
+
}
|
|
233787
|
+
function stripeSynced() {
|
|
233788
|
+
return { type: STRIPE_CONNECTOR_TYPE, action: "synced" };
|
|
233789
|
+
}
|
|
233790
|
+
function stripeProvisioned(claimUrl) {
|
|
233791
|
+
return { type: STRIPE_CONNECTOR_TYPE, action: "provisioned", claimUrl };
|
|
233792
|
+
}
|
|
233793
|
+
function stripeRemoved() {
|
|
233794
|
+
return { type: STRIPE_CONNECTOR_TYPE, action: "removed" };
|
|
233795
|
+
}
|
|
233796
|
+
function stripeError(error48) {
|
|
233797
|
+
return { type: STRIPE_CONNECTOR_TYPE, action: "error", error: error48 };
|
|
233650
233798
|
}
|
|
233651
233799
|
function getConnectorSyncResult(type, response) {
|
|
233652
233800
|
if (response.error === "different_user") {
|
|
@@ -233664,7 +233812,7 @@ function getConnectorSyncResult(type, response) {
|
|
|
233664
233812
|
type,
|
|
233665
233813
|
action: "needs_oauth",
|
|
233666
233814
|
redirectUrl: response.redirectUrl,
|
|
233667
|
-
connectionId: response.connectionId ??
|
|
233815
|
+
connectionId: response.connectionId ?? ""
|
|
233668
233816
|
};
|
|
233669
233817
|
}
|
|
233670
233818
|
return { type, action: "synced" };
|
|
@@ -233980,7 +234128,7 @@ async function fetchFunctionLogs(functionName, filters = {}) {
|
|
|
233980
234128
|
return result.data;
|
|
233981
234129
|
}
|
|
233982
234130
|
// src/core/resources/function/config.ts
|
|
233983
|
-
import { dirname as dirname4, join as join5 } from "node:path";
|
|
234131
|
+
import { basename as basename2, dirname as dirname4, join as join5, relative } from "node:path";
|
|
233984
234132
|
async function readFunctionConfig(configPath) {
|
|
233985
234133
|
const parsed = await readJsonFile(configPath);
|
|
233986
234134
|
const result = FunctionConfigSchema.safeParse(parsed);
|
|
@@ -233998,7 +234146,7 @@ async function readFunction(configPath) {
|
|
|
233998
234146
|
hints: [{ message: "Check the 'entry' field in your function config" }]
|
|
233999
234147
|
});
|
|
234000
234148
|
}
|
|
234001
|
-
const filePaths = await globby("
|
|
234149
|
+
const filePaths = await globby("**/*.{js,ts,json}", {
|
|
234002
234150
|
cwd: functionDir,
|
|
234003
234151
|
absolute: true
|
|
234004
234152
|
});
|
|
@@ -234009,26 +234157,61 @@ async function readAllFunctions(functionsDir) {
|
|
|
234009
234157
|
if (!await pathExists(functionsDir)) {
|
|
234010
234158
|
return [];
|
|
234011
234159
|
}
|
|
234012
|
-
const configFiles = await globby(
|
|
234160
|
+
const configFiles = await globby(FUNCTION_CONFIG_GLOB, {
|
|
234013
234161
|
cwd: functionsDir,
|
|
234014
234162
|
absolute: true
|
|
234015
234163
|
});
|
|
234016
|
-
const
|
|
234164
|
+
const entryFiles = await globby(ENTRY_FILE_GLOB, {
|
|
234165
|
+
cwd: functionsDir,
|
|
234166
|
+
absolute: true,
|
|
234167
|
+
ignore: ENTRY_IGNORE_DOT_PATHS
|
|
234168
|
+
});
|
|
234169
|
+
const configFilesDirs = new Set(configFiles.map((f) => dirname4(f)));
|
|
234170
|
+
const entryFilesWithoutConfig = entryFiles.filter((entryFile) => !configFilesDirs.has(dirname4(entryFile)));
|
|
234171
|
+
const functionsFromConfig = await Promise.all(configFiles.map((configPath) => readFunction(configPath)));
|
|
234172
|
+
const functionsWithoutConfig = await Promise.all(entryFilesWithoutConfig.map(async (entryFile) => {
|
|
234173
|
+
const functionDir = dirname4(entryFile);
|
|
234174
|
+
const filePaths = await globby("**/*.{js,ts,json}", {
|
|
234175
|
+
cwd: functionDir,
|
|
234176
|
+
absolute: true
|
|
234177
|
+
});
|
|
234178
|
+
const name2 = relative(functionsDir, functionDir).split(/[/\\]/).join("/");
|
|
234179
|
+
if (!name2) {
|
|
234180
|
+
throw new InvalidInputError("entry.ts found directly in the functions directory — it must be inside a named subfolder", {
|
|
234181
|
+
hints: [
|
|
234182
|
+
{
|
|
234183
|
+
message: `Move ${entryFile} into a subfolder (e.g. functions/myFunc/entry.ts)`
|
|
234184
|
+
}
|
|
234185
|
+
]
|
|
234186
|
+
});
|
|
234187
|
+
}
|
|
234188
|
+
const entry = basename2(entryFile);
|
|
234189
|
+
return { name: name2, entry, entryPath: entryFile, filePaths };
|
|
234190
|
+
}));
|
|
234191
|
+
const functions = [...functionsFromConfig, ...functionsWithoutConfig];
|
|
234017
234192
|
const names = new Set;
|
|
234018
234193
|
for (const fn of functions) {
|
|
234019
234194
|
if (names.has(fn.name)) {
|
|
234020
|
-
throw new
|
|
234195
|
+
throw new InvalidInputError(`Duplicate function name "${fn.name}"`, {
|
|
234196
|
+
hints: [
|
|
234197
|
+
{
|
|
234198
|
+
message: "Ensure each function has a unique name (or path for zero-config functions)."
|
|
234199
|
+
}
|
|
234200
|
+
]
|
|
234201
|
+
});
|
|
234021
234202
|
}
|
|
234022
234203
|
names.add(fn.name);
|
|
234023
234204
|
}
|
|
234024
234205
|
return functions;
|
|
234025
234206
|
}
|
|
234026
234207
|
// src/core/resources/function/deploy.ts
|
|
234027
|
-
import {
|
|
234208
|
+
import { dirname as dirname5, relative as relative2 } from "node:path";
|
|
234028
234209
|
async function loadFunctionCode(fn) {
|
|
234210
|
+
const functionDir = dirname5(fn.entryPath);
|
|
234029
234211
|
const loadedFiles = await Promise.all(fn.filePaths.map(async (filePath) => {
|
|
234030
234212
|
const content = await readTextFile(filePath);
|
|
234031
|
-
|
|
234213
|
+
const path11 = relative2(functionDir, filePath).split(/[/\\]/).join("/");
|
|
234214
|
+
return { path: path11, content };
|
|
234032
234215
|
}));
|
|
234033
234216
|
return { ...fn, files: loadedFiles };
|
|
234034
234217
|
}
|
|
@@ -234054,12 +234237,12 @@ async function findConfigInDir(dir) {
|
|
|
234054
234237
|
}
|
|
234055
234238
|
async function findProjectRoot(startPath) {
|
|
234056
234239
|
let current = startPath || process.cwd();
|
|
234057
|
-
while (current !==
|
|
234240
|
+
while (current !== dirname6(current)) {
|
|
234058
234241
|
const configPath = await findConfigInDir(current);
|
|
234059
234242
|
if (configPath) {
|
|
234060
234243
|
return { root: current, configPath };
|
|
234061
234244
|
}
|
|
234062
|
-
current =
|
|
234245
|
+
current = dirname6(current);
|
|
234063
234246
|
}
|
|
234064
234247
|
return null;
|
|
234065
234248
|
}
|
|
@@ -234081,7 +234264,7 @@ async function readProjectConfig(projectRoot) {
|
|
|
234081
234264
|
throw new SchemaValidationError("Invalid project configuration", result.error, configPath);
|
|
234082
234265
|
}
|
|
234083
234266
|
const project = result.data;
|
|
234084
|
-
const configDir =
|
|
234267
|
+
const configDir = dirname6(configPath);
|
|
234085
234268
|
const [entities, functions, agents, connectors] = await Promise.all([
|
|
234086
234269
|
entityResource.readAll(join6(configDir, project.entitiesDir)),
|
|
234087
234270
|
functionResource.readAll(join6(configDir, project.functionsDir)),
|
|
@@ -234183,7 +234366,7 @@ async function readAppConfig(projectRoot) {
|
|
|
234183
234366
|
// src/core/project/template.ts
|
|
234184
234367
|
var import_ejs = __toESM(require_ejs(), 1);
|
|
234185
234368
|
var import_front_matter = __toESM(require_front_matter(), 1);
|
|
234186
|
-
import { dirname as
|
|
234369
|
+
import { dirname as dirname7, join as join7 } from "node:path";
|
|
234187
234370
|
async function listTemplates() {
|
|
234188
234371
|
const parsed = await readJsonFile(getTemplatesIndexPath());
|
|
234189
234372
|
const result = TemplatesConfigSchema.safeParse(parsed);
|
|
@@ -234205,7 +234388,7 @@ async function renderTemplate(template, destPath, data) {
|
|
|
234205
234388
|
if (file2.endsWith(".ejs")) {
|
|
234206
234389
|
const rendered = await import_ejs.default.renderFile(srcPath, data);
|
|
234207
234390
|
const { attributes, body } = import_front_matter.default(rendered);
|
|
234208
|
-
const destFile = attributes.outputFileName ? join7(
|
|
234391
|
+
const destFile = attributes.outputFileName ? join7(dirname7(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
|
|
234209
234392
|
const destFilePath = join7(destPath, destFile);
|
|
234210
234393
|
await writeFile(destFilePath, body);
|
|
234211
234394
|
} else {
|
|
@@ -234391,8 +234574,12 @@ async function handleUnauthorized(request, _options, response) {
|
|
|
234391
234574
|
return;
|
|
234392
234575
|
}
|
|
234393
234576
|
retriedRequests.add(request);
|
|
234577
|
+
const requestId = request.headers.get("X-Request-ID");
|
|
234394
234578
|
return distribution_default(request.clone(), {
|
|
234395
|
-
headers: {
|
|
234579
|
+
headers: {
|
|
234580
|
+
...requestId && { "X-Request-ID": requestId },
|
|
234581
|
+
Authorization: `Bearer ${newAccessToken}`
|
|
234582
|
+
}
|
|
234396
234583
|
});
|
|
234397
234584
|
}
|
|
234398
234585
|
var base44Client = distribution_default.create({
|
|
@@ -234402,6 +234589,9 @@ var base44Client = distribution_default.create({
|
|
|
234402
234589
|
},
|
|
234403
234590
|
hooks: {
|
|
234404
234591
|
beforeRequest: [
|
|
234592
|
+
(request) => {
|
|
234593
|
+
request.headers.set("X-Request-ID", randomUUID2());
|
|
234594
|
+
},
|
|
234405
234595
|
captureRequestBody,
|
|
234406
234596
|
async (request) => {
|
|
234407
234597
|
try {
|
|
@@ -234427,10 +234617,18 @@ function getAppClient() {
|
|
|
234427
234617
|
});
|
|
234428
234618
|
}
|
|
234429
234619
|
// src/core/clients/oauth-client.ts
|
|
234620
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
234430
234621
|
var oauthClient = distribution_default.create({
|
|
234431
234622
|
prefixUrl: getBase44ApiUrl(),
|
|
234432
234623
|
headers: {
|
|
234433
234624
|
"User-Agent": "Base44 CLI"
|
|
234625
|
+
},
|
|
234626
|
+
hooks: {
|
|
234627
|
+
beforeRequest: [
|
|
234628
|
+
(request) => {
|
|
234629
|
+
request.headers.set("X-Request-ID", randomUUID3());
|
|
234630
|
+
}
|
|
234631
|
+
]
|
|
234434
234632
|
}
|
|
234435
234633
|
});
|
|
234436
234634
|
// src/core/auth/api.ts
|
|
@@ -234575,7 +234773,8 @@ async function deleteSecret(name2) {
|
|
|
234575
234773
|
let response;
|
|
234576
234774
|
try {
|
|
234577
234775
|
response = await appClient.delete("secrets", {
|
|
234578
|
-
searchParams: { secret_name: name2 }
|
|
234776
|
+
searchParams: { secret_name: name2 },
|
|
234777
|
+
timeout: false
|
|
234579
234778
|
});
|
|
234580
234779
|
} catch (error48) {
|
|
234581
234780
|
throw await ApiError.fromHttpError(error48, "deleting secret");
|
|
@@ -235383,24 +235582,6 @@ async function login() {
|
|
|
235383
235582
|
};
|
|
235384
235583
|
}
|
|
235385
235584
|
|
|
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
235585
|
// node_modules/is-plain-obj/index.js
|
|
235405
235586
|
function isPlainObject2(value) {
|
|
235406
235587
|
if (typeof value !== "object" || value === null) {
|
|
@@ -241899,7 +242080,7 @@ var {
|
|
|
241899
242080
|
// package.json
|
|
241900
242081
|
var package_default = {
|
|
241901
242082
|
name: "base44",
|
|
241902
|
-
version: "0.0.
|
|
242083
|
+
version: "0.0.38",
|
|
241903
242084
|
description: "Base44 CLI - Unified interface for managing Base44 applications",
|
|
241904
242085
|
type: "module",
|
|
241905
242086
|
bin: {
|
|
@@ -242017,35 +242198,16 @@ async function checkForUpgrade() {
|
|
|
242017
242198
|
}
|
|
242018
242199
|
|
|
242019
242200
|
// src/cli/utils/upgradeNotification.ts
|
|
242020
|
-
|
|
242021
|
-
function formatUpgradeBox(info) {
|
|
242201
|
+
function formatUpgradeMessage(info) {
|
|
242022
242202
|
const { shinyOrange } = theme.colors;
|
|
242023
242203
|
const { bold: bold2 } = theme.styles;
|
|
242024
|
-
|
|
242025
|
-
shinyOrange(`Update available! ${info.currentVersion} → ${bold2(info.latestVersion)}`),
|
|
242026
|
-
shinyOrange(`Run: ${bold2(UPGRADE_COMMAND)}`)
|
|
242027
|
-
];
|
|
242028
|
-
const maxVisualWidth = Math.max(...lines.map((l) => stripAnsi(l).length));
|
|
242029
|
-
const pad = (line) => {
|
|
242030
|
-
const visual = stripAnsi(line).length;
|
|
242031
|
-
return `${line}${" ".repeat(maxVisualWidth - visual)}`;
|
|
242032
|
-
};
|
|
242033
|
-
const top = `┌${"─".repeat(maxVisualWidth + 2)}┐`;
|
|
242034
|
-
const bottom = `└${"─".repeat(maxVisualWidth + 2)}┘`;
|
|
242035
|
-
const body = lines.map((l) => `│ ${pad(l)} │`).join(`
|
|
242036
|
-
`);
|
|
242037
|
-
return `${top}
|
|
242038
|
-
${body}
|
|
242039
|
-
${bottom}`;
|
|
242040
|
-
}
|
|
242041
|
-
function startUpgradeCheck() {
|
|
242042
|
-
return checkForUpgrade().catch(() => null);
|
|
242204
|
+
return `${shinyOrange("Update available!")} ${shinyOrange(`${info.currentVersion} → ${info.latestVersion}`)} ${shinyOrange("Run:")} ${bold2(shinyOrange("npm install -g base44@latest"))}`;
|
|
242043
242205
|
}
|
|
242044
|
-
async function
|
|
242206
|
+
async function printUpgradeNotificationIfAvailable() {
|
|
242045
242207
|
try {
|
|
242046
|
-
const upgradeInfo = await
|
|
242208
|
+
const upgradeInfo = await checkForUpgrade();
|
|
242047
242209
|
if (upgradeInfo) {
|
|
242048
|
-
R2.
|
|
242210
|
+
R2.message(formatUpgradeMessage(upgradeInfo));
|
|
242049
242211
|
}
|
|
242050
242212
|
} catch {}
|
|
242051
242213
|
}
|
|
@@ -242058,7 +242220,7 @@ async function runCommand(commandFn, options, context) {
|
|
|
242058
242220
|
} else {
|
|
242059
242221
|
We(theme.colors.base44OrangeBackground(" Base 44 "));
|
|
242060
242222
|
}
|
|
242061
|
-
|
|
242223
|
+
await printUpgradeNotificationIfAvailable();
|
|
242062
242224
|
try {
|
|
242063
242225
|
if (options?.requireAuth) {
|
|
242064
242226
|
const loggedIn = await isLoggedIn();
|
|
@@ -242078,14 +242240,12 @@ async function runCommand(commandFn, options, context) {
|
|
|
242078
242240
|
context.errorReporter.setContext({ appId: appConfig.id });
|
|
242079
242241
|
}
|
|
242080
242242
|
const result = await commandFn();
|
|
242081
|
-
await printUpgradeNotification(upgradeCheckPromise);
|
|
242082
242243
|
Le(result.outroMessage || "");
|
|
242083
242244
|
if (result.stdout) {
|
|
242084
242245
|
process.stdout.write(result.stdout);
|
|
242085
242246
|
}
|
|
242086
242247
|
} catch (error48) {
|
|
242087
242248
|
displayError(error48);
|
|
242088
|
-
await printUpgradeNotification(upgradeCheckPromise);
|
|
242089
242249
|
const errorContext = context.errorReporter.getErrorContext();
|
|
242090
242250
|
Le(theme.format.errorContext(errorContext));
|
|
242091
242251
|
throw error48;
|
|
@@ -242126,10 +242286,14 @@ function getDashboardUrl(projectId) {
|
|
|
242126
242286
|
const id = projectId ?? getAppConfig().id;
|
|
242127
242287
|
return `${getBase44ApiUrl()}/apps/${id}/editor/workspace/overview`;
|
|
242128
242288
|
}
|
|
242289
|
+
function getConnectorsUrl(projectId) {
|
|
242290
|
+
const id = projectId ?? getAppConfig().id;
|
|
242291
|
+
return `${getBase44ApiUrl()}/apps/${id}/editor/workspace/app-connections`;
|
|
242292
|
+
}
|
|
242129
242293
|
// src/cli/commands/agents/pull.ts
|
|
242130
242294
|
async function pullAgentsAction() {
|
|
242131
242295
|
const { project: project2 } = await readProjectConfig();
|
|
242132
|
-
const configDir =
|
|
242296
|
+
const configDir = dirname8(project2.configPath);
|
|
242133
242297
|
const agentsDir = join9(configDir, project2.agentsDir);
|
|
242134
242298
|
const remoteAgents = await runTask("Fetching agents from Base44", async () => {
|
|
242135
242299
|
return await fetchAgents();
|
|
@@ -242224,19 +242388,19 @@ function getWhoamiCommand(context) {
|
|
|
242224
242388
|
}
|
|
242225
242389
|
|
|
242226
242390
|
// src/cli/commands/connectors/pull.ts
|
|
242227
|
-
import { dirname as
|
|
242391
|
+
import { dirname as dirname9, join as join10 } from "node:path";
|
|
242228
242392
|
async function pullConnectorsAction() {
|
|
242229
242393
|
const { project: project2 } = await readProjectConfig();
|
|
242230
|
-
const configDir =
|
|
242394
|
+
const configDir = dirname9(project2.configPath);
|
|
242231
242395
|
const connectorsDir = join10(configDir, project2.connectorsDir);
|
|
242232
242396
|
const remoteConnectors = await runTask("Fetching connectors from Base44", async () => {
|
|
242233
|
-
return await
|
|
242397
|
+
return await pullAllConnectors();
|
|
242234
242398
|
}, {
|
|
242235
242399
|
successMessage: "Connectors fetched successfully",
|
|
242236
242400
|
errorMessage: "Failed to fetch connectors"
|
|
242237
242401
|
});
|
|
242238
242402
|
const { written, deleted } = await runTask("Syncing connector files", async () => {
|
|
242239
|
-
return await writeConnectors(connectorsDir, remoteConnectors
|
|
242403
|
+
return await writeConnectors(connectorsDir, remoteConnectors);
|
|
242240
242404
|
}, {
|
|
242241
242405
|
successMessage: "Connector files synced successfully",
|
|
242242
242406
|
errorMessage: "Failed to sync connector files"
|
|
@@ -242251,7 +242415,7 @@ async function pullConnectorsAction() {
|
|
|
242251
242415
|
R2.info("All connectors are already up to date");
|
|
242252
242416
|
}
|
|
242253
242417
|
return {
|
|
242254
|
-
outroMessage: `Pulled ${remoteConnectors.
|
|
242418
|
+
outroMessage: `Pulled ${remoteConnectors.length} connectors to ${connectorsDir}`
|
|
242255
242419
|
};
|
|
242256
242420
|
}
|
|
242257
242421
|
function getConnectorsPullCommand(context) {
|
|
@@ -242870,7 +243034,7 @@ var open_default = open;
|
|
|
242870
243034
|
var POLL_INTERVAL_MS = 2000;
|
|
242871
243035
|
var POLL_TIMEOUT_MS = 2 * 60 * 1000;
|
|
242872
243036
|
function filterPendingOAuth(results) {
|
|
242873
|
-
return results.filter((r) => r.action === "needs_oauth" && !!r.
|
|
243037
|
+
return results.filter((r) => r.action === "needs_oauth" && !!r.connectionId);
|
|
242874
243038
|
}
|
|
242875
243039
|
async function runOAuthFlowWithSkip(connector2) {
|
|
242876
243040
|
await open_default(connector2.redirectUrl);
|
|
@@ -242950,32 +243114,49 @@ async function promptOAuthFlows(pending, options) {
|
|
|
242950
243114
|
function printSummary(results, oauthOutcomes) {
|
|
242951
243115
|
const synced = [];
|
|
242952
243116
|
const added = [];
|
|
243117
|
+
let provisioned;
|
|
242953
243118
|
const removed = [];
|
|
242954
243119
|
const skipped = [];
|
|
242955
243120
|
const failed = [];
|
|
242956
243121
|
for (const r of results) {
|
|
242957
|
-
|
|
242958
|
-
|
|
242959
|
-
|
|
242960
|
-
|
|
242961
|
-
|
|
242962
|
-
|
|
242963
|
-
|
|
242964
|
-
|
|
242965
|
-
|
|
242966
|
-
|
|
242967
|
-
|
|
242968
|
-
|
|
242969
|
-
|
|
242970
|
-
|
|
242971
|
-
|
|
242972
|
-
|
|
242973
|
-
|
|
242974
|
-
|
|
243122
|
+
switch (r.action) {
|
|
243123
|
+
case "provisioned":
|
|
243124
|
+
provisioned = r;
|
|
243125
|
+
break;
|
|
243126
|
+
case "synced":
|
|
243127
|
+
synced.push(r.type);
|
|
243128
|
+
break;
|
|
243129
|
+
case "removed":
|
|
243130
|
+
removed.push(r.type);
|
|
243131
|
+
break;
|
|
243132
|
+
case "error":
|
|
243133
|
+
failed.push({ type: r.type, error: r.error });
|
|
243134
|
+
break;
|
|
243135
|
+
case "needs_oauth": {
|
|
243136
|
+
const oauthStatus = oauthOutcomes.get(r.type);
|
|
243137
|
+
if (oauthStatus === "ACTIVE") {
|
|
243138
|
+
added.push(r.type);
|
|
243139
|
+
} else if (oauthStatus === "SKIPPED") {
|
|
243140
|
+
skipped.push(r.type);
|
|
243141
|
+
} else if (oauthStatus === "PENDING") {
|
|
243142
|
+
failed.push({ type: r.type, error: "authorization timed out" });
|
|
243143
|
+
} else if (oauthStatus === "FAILED") {
|
|
243144
|
+
failed.push({ type: r.type, error: "authorization failed" });
|
|
243145
|
+
} else {
|
|
243146
|
+
failed.push({ type: r.type, error: "needs authorization" });
|
|
243147
|
+
}
|
|
243148
|
+
break;
|
|
242975
243149
|
}
|
|
242976
243150
|
}
|
|
242977
243151
|
}
|
|
242978
243152
|
R2.info(theme.styles.bold("Summary:"));
|
|
243153
|
+
if (provisioned) {
|
|
243154
|
+
R2.success("Stripe sandbox provisioned");
|
|
243155
|
+
if (provisioned.claimUrl) {
|
|
243156
|
+
R2.info(` Claim your Stripe sandbox: ${theme.colors.links(provisioned.claimUrl)}`);
|
|
243157
|
+
}
|
|
243158
|
+
R2.info(` Connectors dashboard: ${theme.colors.links(getConnectorsUrl())}`);
|
|
243159
|
+
}
|
|
242979
243160
|
if (synced.length > 0) {
|
|
242980
243161
|
R2.success(`Synced: ${synced.join(", ")}`);
|
|
242981
243162
|
}
|
|
@@ -242989,7 +243170,7 @@ function printSummary(results, oauthOutcomes) {
|
|
|
242989
243170
|
R2.warn(`Skipped: ${skipped.join(", ")}`);
|
|
242990
243171
|
}
|
|
242991
243172
|
for (const r of failed) {
|
|
242992
|
-
R2.error(`Failed: ${r.type}
|
|
243173
|
+
R2.error(`Failed: ${r.type} - ${r.error}`);
|
|
242993
243174
|
}
|
|
242994
243175
|
}
|
|
242995
243176
|
async function pushConnectorsAction(isNonInteractive) {
|
|
@@ -243023,7 +243204,7 @@ function getConnectorsPushCommand(context) {
|
|
|
243023
243204
|
|
|
243024
243205
|
// src/cli/commands/connectors/index.ts
|
|
243025
243206
|
function getConnectorsCommand(context) {
|
|
243026
|
-
return new Command("connectors").description("Manage project connectors
|
|
243207
|
+
return new Command("connectors").description("Manage project connectors").addCommand(getConnectorsPullCommand(context)).addCommand(getConnectorsPushCommand(context));
|
|
243027
243208
|
}
|
|
243028
243209
|
|
|
243029
243210
|
// src/cli/commands/dashboard/open.ts
|
|
@@ -243337,15 +243518,11 @@ ${summaryLines.join(`
|
|
|
243337
243518
|
successMessage: theme.colors.base44Orange("Deployment completed"),
|
|
243338
243519
|
errorMessage: "Deployment failed"
|
|
243339
243520
|
});
|
|
243340
|
-
const
|
|
243341
|
-
|
|
243342
|
-
|
|
243343
|
-
|
|
243344
|
-
|
|
243345
|
-
const allAuthorized = oauthOutcomes.size > 0 && [...oauthOutcomes.values()].every((s) => s === "ACTIVE");
|
|
243346
|
-
if (!allAuthorized) {
|
|
243347
|
-
R2.info("Some connectors still require authorization. Run 'base44 connectors push' or open the links above in your browser.");
|
|
243348
|
-
}
|
|
243521
|
+
const connectorResults = result.connectorResults ?? [];
|
|
243522
|
+
await handleOAuthConnectors(connectorResults, options);
|
|
243523
|
+
const stripeResult = connectorResults.find((r) => r.action === "provisioned");
|
|
243524
|
+
if (stripeResult) {
|
|
243525
|
+
printStripeResult(stripeResult);
|
|
243349
243526
|
}
|
|
243350
243527
|
R2.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl())}`);
|
|
243351
243528
|
if (result.appUrl) {
|
|
@@ -243361,6 +243538,25 @@ function getDeployCommand(context) {
|
|
|
243361
243538
|
}), { requireAuth: true }, context);
|
|
243362
243539
|
});
|
|
243363
243540
|
}
|
|
243541
|
+
async function handleOAuthConnectors(connectorResults, options) {
|
|
243542
|
+
const needsOAuth = filterPendingOAuth(connectorResults);
|
|
243543
|
+
if (needsOAuth.length === 0)
|
|
243544
|
+
return;
|
|
243545
|
+
const oauthOutcomes = await promptOAuthFlows(needsOAuth, {
|
|
243546
|
+
skipPrompt: options.yes || options.isNonInteractive
|
|
243547
|
+
});
|
|
243548
|
+
const allAuthorized = oauthOutcomes.size > 0 && [...oauthOutcomes.values()].every((s) => s === "ACTIVE");
|
|
243549
|
+
if (!allAuthorized) {
|
|
243550
|
+
R2.info("Some connectors still require authorization. Run 'base44 connectors push' or open the links above in your browser.");
|
|
243551
|
+
}
|
|
243552
|
+
}
|
|
243553
|
+
function printStripeResult(r) {
|
|
243554
|
+
R2.success("Stripe sandbox provisioned");
|
|
243555
|
+
if (r.claimUrl) {
|
|
243556
|
+
R2.info(` Claim your Stripe sandbox: ${theme.colors.links(r.claimUrl)}`);
|
|
243557
|
+
}
|
|
243558
|
+
R2.info(` Connectors dashboard: ${theme.colors.links(getConnectorsUrl())}`);
|
|
243559
|
+
}
|
|
243364
243560
|
|
|
243365
243561
|
// src/cli/commands/project/link.ts
|
|
243366
243562
|
function validateNonInteractiveFlags2(command) {
|
|
@@ -243923,7 +244119,7 @@ function getTypesCommand(context) {
|
|
|
243923
244119
|
}
|
|
243924
244120
|
|
|
243925
244121
|
// src/cli/dev/dev-server/main.ts
|
|
243926
|
-
import { dirname as
|
|
244122
|
+
import { dirname as dirname15, join as join18 } from "node:path";
|
|
243927
244123
|
var import_cors = __toESM(require_lib4(), 1);
|
|
243928
244124
|
var import_express4 = __toESM(require_express(), 1);
|
|
243929
244125
|
|
|
@@ -244082,9 +244278,9 @@ function createDevLogger() {
|
|
|
244082
244278
|
|
|
244083
244279
|
// src/cli/dev/dev-server/function-manager.ts
|
|
244084
244280
|
import { spawn as spawn2, spawnSync as spawnSync2 } from "node:child_process";
|
|
244085
|
-
import { dirname as
|
|
244281
|
+
import { dirname as dirname12, join as join15 } from "node:path";
|
|
244086
244282
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
244087
|
-
var __dirname5 =
|
|
244283
|
+
var __dirname5 = dirname12(fileURLToPath7(import.meta.url));
|
|
244088
244284
|
var WRAPPER_PATH = join15(__dirname5, "../deno-runtime/main.js");
|
|
244089
244285
|
var READY_TIMEOUT = 30000;
|
|
244090
244286
|
|
|
@@ -244286,9 +244482,8 @@ function createFunctionRouter(manager, logger) {
|
|
|
244286
244482
|
var import_nedb = __toESM(require_nedb(), 1);
|
|
244287
244483
|
|
|
244288
244484
|
class Database {
|
|
244289
|
-
collections;
|
|
244290
|
-
|
|
244291
|
-
this.collections = new Map;
|
|
244485
|
+
collections = new Map;
|
|
244486
|
+
load(entities) {
|
|
244292
244487
|
for (const entity2 of entities) {
|
|
244293
244488
|
this.collections.set(entity2.name, new import_nedb.default);
|
|
244294
244489
|
}
|
|
@@ -244299,6 +244494,12 @@ class Database {
|
|
|
244299
244494
|
getCollectionNames() {
|
|
244300
244495
|
return Array.from(this.collections.keys());
|
|
244301
244496
|
}
|
|
244497
|
+
dropAll() {
|
|
244498
|
+
for (const collection of this.collections.values()) {
|
|
244499
|
+
collection.remove({}, { multi: true });
|
|
244500
|
+
}
|
|
244501
|
+
this.collections.clear();
|
|
244502
|
+
}
|
|
244302
244503
|
}
|
|
244303
244504
|
|
|
244304
244505
|
// node_modules/socket.io/wrapper.mjs
|
|
@@ -244581,7 +244782,7 @@ function createEntityRoutes(db2, logger, remoteProxy, broadcast) {
|
|
|
244581
244782
|
// src/cli/dev/dev-server/routes/integrations.ts
|
|
244582
244783
|
var import_express3 = __toESM(require_express(), 1);
|
|
244583
244784
|
var import_multer = __toESM(require_multer(), 1);
|
|
244584
|
-
import { randomUUID as
|
|
244785
|
+
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
244585
244786
|
import fs28 from "node:fs";
|
|
244586
244787
|
import path18 from "node:path";
|
|
244587
244788
|
function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
|
|
@@ -244592,7 +244793,7 @@ function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
|
|
|
244592
244793
|
destination: mediaFilesDir,
|
|
244593
244794
|
filename: (_req, file2, cb2) => {
|
|
244594
244795
|
const ext = path18.extname(file2.originalname);
|
|
244595
|
-
cb2(null, `${
|
|
244796
|
+
cb2(null, `${randomUUID4()}${ext}`);
|
|
244596
244797
|
}
|
|
244597
244798
|
});
|
|
244598
244799
|
const MAX_FILE_SIZE = 50 * 1024 * 1024;
|
|
@@ -244619,7 +244820,7 @@ function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
|
|
|
244619
244820
|
res.status(400).json({ error: "file_uri is required" });
|
|
244620
244821
|
return;
|
|
244621
244822
|
}
|
|
244622
|
-
const signature =
|
|
244823
|
+
const signature = randomUUID4();
|
|
244623
244824
|
const signed_url = `${baseUrl}/media/${file_uri}?signature=${signature}`;
|
|
244624
244825
|
res.json({ signed_url });
|
|
244625
244826
|
});
|
|
@@ -244654,7 +244855,7 @@ function createCustomIntegrationRoutes(remoteProxy, logger) {
|
|
|
244654
244855
|
|
|
244655
244856
|
// src/cli/dev/dev-server/watcher.ts
|
|
244656
244857
|
import { EventEmitter as EventEmitter4 } from "node:events";
|
|
244657
|
-
import { relative as
|
|
244858
|
+
import { relative as relative6 } from "node:path";
|
|
244658
244859
|
|
|
244659
244860
|
// node_modules/chokidar/index.js
|
|
244660
244861
|
import { EventEmitter as EventEmitter3 } from "node:events";
|
|
@@ -245384,9 +245585,9 @@ class NodeFsHandler {
|
|
|
245384
245585
|
if (this.fsw.closed) {
|
|
245385
245586
|
return;
|
|
245386
245587
|
}
|
|
245387
|
-
const
|
|
245588
|
+
const dirname14 = sp2.dirname(file2);
|
|
245388
245589
|
const basename5 = sp2.basename(file2);
|
|
245389
|
-
const parent = this.fsw._getWatchedDir(
|
|
245590
|
+
const parent = this.fsw._getWatchedDir(dirname14);
|
|
245390
245591
|
let prevStats = stats;
|
|
245391
245592
|
if (parent.has(basename5))
|
|
245392
245593
|
return;
|
|
@@ -245413,7 +245614,7 @@ class NodeFsHandler {
|
|
|
245413
245614
|
prevStats = newStats2;
|
|
245414
245615
|
}
|
|
245415
245616
|
} catch (error48) {
|
|
245416
|
-
this.fsw._remove(
|
|
245617
|
+
this.fsw._remove(dirname14, basename5);
|
|
245417
245618
|
}
|
|
245418
245619
|
} else if (parent.has(basename5)) {
|
|
245419
245620
|
const at13 = newStats.atimeMs;
|
|
@@ -245636,11 +245837,11 @@ function createPattern(matcher) {
|
|
|
245636
245837
|
if (matcher.path === string4)
|
|
245637
245838
|
return true;
|
|
245638
245839
|
if (matcher.recursive) {
|
|
245639
|
-
const
|
|
245640
|
-
if (!
|
|
245840
|
+
const relative6 = sp3.relative(matcher.path, string4);
|
|
245841
|
+
if (!relative6) {
|
|
245641
245842
|
return false;
|
|
245642
245843
|
}
|
|
245643
|
-
return !
|
|
245844
|
+
return !relative6.startsWith("..") && !sp3.isAbsolute(relative6);
|
|
245644
245845
|
}
|
|
245645
245846
|
return false;
|
|
245646
245847
|
};
|
|
@@ -246275,79 +246476,74 @@ var WATCH_QUEUE_DELAY_MS = 500;
|
|
|
246275
246476
|
class WatchBase44 extends EventEmitter4 {
|
|
246276
246477
|
itemsToWatch;
|
|
246277
246478
|
logger;
|
|
246278
|
-
|
|
246279
|
-
|
|
246479
|
+
entryNames;
|
|
246480
|
+
watchers = new Map;
|
|
246280
246481
|
queueWaitForCreationTimeout = null;
|
|
246281
246482
|
constructor(itemsToWatch, logger) {
|
|
246282
246483
|
super();
|
|
246283
246484
|
this.itemsToWatch = itemsToWatch;
|
|
246284
246485
|
this.logger = logger;
|
|
246486
|
+
this.entryNames = Object.keys(itemsToWatch);
|
|
246285
246487
|
}
|
|
246286
246488
|
async start() {
|
|
246287
|
-
if (this.watchers.
|
|
246489
|
+
if (this.watchers.size > 0) {
|
|
246288
246490
|
return;
|
|
246289
246491
|
}
|
|
246290
|
-
for (const
|
|
246291
|
-
|
|
246292
|
-
|
|
246293
|
-
|
|
246294
|
-
this.queueWaitForCreation.push(item);
|
|
246492
|
+
for (const name2 of this.entryNames) {
|
|
246493
|
+
const targetPath = this.itemsToWatch[name2];
|
|
246494
|
+
if (await pathExists(targetPath)) {
|
|
246495
|
+
this.watchers.set(name2, this.watchTarget(name2, targetPath));
|
|
246295
246496
|
}
|
|
246296
246497
|
}
|
|
246297
|
-
this.
|
|
246498
|
+
this.watchEntries();
|
|
246298
246499
|
}
|
|
246299
246500
|
async close() {
|
|
246300
246501
|
if (this.queueWaitForCreationTimeout) {
|
|
246301
246502
|
clearTimeout(this.queueWaitForCreationTimeout);
|
|
246302
246503
|
this.queueWaitForCreationTimeout = null;
|
|
246303
246504
|
}
|
|
246304
|
-
for (const watcher of this.watchers) {
|
|
246505
|
+
for (const watcher of this.watchers.values()) {
|
|
246305
246506
|
await watcher.close();
|
|
246306
246507
|
}
|
|
246307
|
-
this.watchers
|
|
246308
|
-
this.queueWaitForCreation = [];
|
|
246508
|
+
this.watchers.clear();
|
|
246309
246509
|
}
|
|
246310
|
-
|
|
246510
|
+
watchEntries() {
|
|
246311
246511
|
if (this.queueWaitForCreationTimeout) {
|
|
246312
246512
|
clearTimeout(this.queueWaitForCreationTimeout);
|
|
246313
246513
|
}
|
|
246314
246514
|
this.queueWaitForCreationTimeout = setTimeout(async () => {
|
|
246315
|
-
const
|
|
246316
|
-
|
|
246317
|
-
|
|
246318
|
-
|
|
246319
|
-
|
|
246515
|
+
for (const name2 of this.entryNames) {
|
|
246516
|
+
const path19 = this.itemsToWatch[name2];
|
|
246517
|
+
const watchItem = this.watchers.get(name2);
|
|
246518
|
+
const exists = await pathExists(path19);
|
|
246519
|
+
if (!watchItem && exists) {
|
|
246520
|
+
this.emit("change", name2, path19);
|
|
246521
|
+
this.watchers.set(name2, this.watchTarget(name2, path19));
|
|
246522
|
+
} else if (watchItem && !exists) {
|
|
246523
|
+
await watchItem.close();
|
|
246524
|
+
this.emit("change", name2, path19);
|
|
246525
|
+
setTimeout(() => {
|
|
246526
|
+
this.watchers.forEach((watcher, watcherName) => {
|
|
246527
|
+
if (watcher.closed) {
|
|
246528
|
+
this.watchers.delete(watcherName);
|
|
246529
|
+
}
|
|
246530
|
+
});
|
|
246531
|
+
});
|
|
246320
246532
|
}
|
|
246321
246533
|
}
|
|
246322
|
-
this.
|
|
246323
|
-
|
|
246324
|
-
this.watchCreationQueue();
|
|
246325
|
-
} else {
|
|
246326
|
-
this.queueWaitForCreationTimeout = null;
|
|
246327
|
-
}
|
|
246534
|
+
this.queueWaitForCreationTimeout = null;
|
|
246535
|
+
this.watchEntries();
|
|
246328
246536
|
}, WATCH_QUEUE_DELAY_MS);
|
|
246329
246537
|
}
|
|
246330
|
-
watchTarget(
|
|
246331
|
-
const
|
|
246332
|
-
this.emit("change", item.name, relative4(item.path, path19));
|
|
246333
|
-
}, WATCH_DEBOUNCE_MS);
|
|
246334
|
-
const watcher = watch(item.path, {
|
|
246538
|
+
watchTarget(name2, targetPath) {
|
|
246539
|
+
const watcher = watch(targetPath, {
|
|
246335
246540
|
ignoreInitial: true
|
|
246336
246541
|
});
|
|
246337
|
-
watcher.on("all",
|
|
246338
|
-
|
|
246339
|
-
|
|
246340
|
-
return;
|
|
246341
|
-
}
|
|
246342
|
-
await watcher.close();
|
|
246343
|
-
this.queueWaitForCreation.push(item);
|
|
246344
|
-
this.watchCreationQueue();
|
|
246345
|
-
setTimeout(() => {
|
|
246346
|
-
this.watchers = this.watchers.filter((watcher2) => !watcher2.closed);
|
|
246347
|
-
});
|
|
246348
|
-
});
|
|
246542
|
+
watcher.on("all", import_debounce.default(async (_event, path19) => {
|
|
246543
|
+
this.emit("change", name2, relative6(targetPath, path19));
|
|
246544
|
+
}, WATCH_DEBOUNCE_MS));
|
|
246349
246545
|
watcher.on("error", (err) => {
|
|
246350
|
-
this.logger.error(`Watch handler failed for ${
|
|
246546
|
+
this.logger.error(`Watch handler failed for ${targetPath}`, err instanceof Error ? err : undefined);
|
|
246351
246547
|
});
|
|
246352
246548
|
return watcher;
|
|
246353
246549
|
}
|
|
@@ -246385,7 +246581,8 @@ async function createDevServer(options8) {
|
|
|
246385
246581
|
if (functionManager.getFunctionNames().length > 0) {
|
|
246386
246582
|
R2.info(`Loaded functions: ${functionManager.getFunctionNames().join(", ")}`);
|
|
246387
246583
|
}
|
|
246388
|
-
const db2 = new Database
|
|
246584
|
+
const db2 = new Database;
|
|
246585
|
+
db2.load(entities);
|
|
246389
246586
|
if (db2.getCollectionNames().length > 0) {
|
|
246390
246587
|
R2.info(`Loaded entities: ${db2.getCollectionNames().join(", ")}`);
|
|
246391
246588
|
}
|
|
@@ -246419,16 +246616,14 @@ async function createDevServer(options8) {
|
|
|
246419
246616
|
emitEntityEvent = (appId, entityName, event) => {
|
|
246420
246617
|
broadcastEntityEvent(io6, appId, entityName, event);
|
|
246421
246618
|
};
|
|
246422
|
-
const base44ConfigWatcher = new WatchBase44(
|
|
246423
|
-
|
|
246424
|
-
|
|
246425
|
-
|
|
246426
|
-
}
|
|
246427
|
-
], devLogger);
|
|
246619
|
+
const base44ConfigWatcher = new WatchBase44({
|
|
246620
|
+
functions: join18(dirname15(project2.configPath), project2.functionsDir),
|
|
246621
|
+
entities: join18(dirname15(project2.configPath), project2.entitiesDir)
|
|
246622
|
+
}, devLogger);
|
|
246428
246623
|
base44ConfigWatcher.on("change", async (name2) => {
|
|
246429
246624
|
try {
|
|
246625
|
+
const { functions: functions2, entities: entities2 } = await options8.loadResources();
|
|
246430
246626
|
if (name2 === "functions") {
|
|
246431
|
-
const { functions: functions2 } = await options8.loadResources();
|
|
246432
246627
|
const previousFunctionCount = functionManager.getFunctionNames().length;
|
|
246433
246628
|
functionManager.reload(functions2);
|
|
246434
246629
|
const names = functionManager.getFunctionNames();
|
|
@@ -246438,6 +246633,17 @@ async function createDevServer(options8) {
|
|
|
246438
246633
|
devLogger.log("All functions removed");
|
|
246439
246634
|
}
|
|
246440
246635
|
}
|
|
246636
|
+
if (name2 === "entities") {
|
|
246637
|
+
const previousEntityCount = db2.getCollectionNames().length;
|
|
246638
|
+
db2.dropAll();
|
|
246639
|
+
if (previousEntityCount > 0) {
|
|
246640
|
+
devLogger.log("Entities directory changed, clearing data...");
|
|
246641
|
+
}
|
|
246642
|
+
db2.load(entities2);
|
|
246643
|
+
if (db2.getCollectionNames().length > 0) {
|
|
246644
|
+
devLogger.log(`Loaded entities: ${db2.getCollectionNames().join(", ")}`);
|
|
246645
|
+
}
|
|
246646
|
+
}
|
|
246441
246647
|
} catch (error48) {
|
|
246442
246648
|
const errorMessage = error48 instanceof Error ? error48.message : String(error48);
|
|
246443
246649
|
devLogger.error(errorMessage);
|
|
@@ -246601,7 +246807,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
|
|
|
246601
246807
|
import { release, type } from "node:os";
|
|
246602
246808
|
|
|
246603
246809
|
// node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
246604
|
-
import { dirname as
|
|
246810
|
+
import { dirname as dirname16, posix, sep } from "path";
|
|
246605
246811
|
function createModulerModifier() {
|
|
246606
246812
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
246607
246813
|
return async (frames) => {
|
|
@@ -246610,7 +246816,7 @@ function createModulerModifier() {
|
|
|
246610
246816
|
return frames;
|
|
246611
246817
|
};
|
|
246612
246818
|
}
|
|
246613
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
246819
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname16(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
|
|
246614
246820
|
const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
|
|
246615
246821
|
return (filename) => {
|
|
246616
246822
|
if (!filename)
|
|
@@ -249814,9 +250020,9 @@ function matchPropertyGroup(propertyGroup, propertyValues, cohortProperties, deb
|
|
|
249814
250020
|
throw new InconclusiveMatchError("can't match cohort without a given cohort property value");
|
|
249815
250021
|
return propertyGroupType === "AND";
|
|
249816
250022
|
}
|
|
249817
|
-
function isValidRegex(
|
|
250023
|
+
function isValidRegex(regex) {
|
|
249818
250024
|
try {
|
|
249819
|
-
new RegExp(
|
|
250025
|
+
new RegExp(regex);
|
|
249820
250026
|
return true;
|
|
249821
250027
|
} catch (err) {
|
|
249822
250028
|
return false;
|
|
@@ -249834,8 +250040,8 @@ function convertToDateTime(value) {
|
|
|
249834
250040
|
throw new InconclusiveMatchError(`The date provided ${value} must be a string, number, or date object`);
|
|
249835
250041
|
}
|
|
249836
250042
|
function relativeDateParseForFeatureFlagMatching(value) {
|
|
249837
|
-
const
|
|
249838
|
-
const match = value.match(
|
|
250043
|
+
const regex = /^-?(?<number>[0-9]+)(?<interval>[a-z])$/;
|
|
250044
|
+
const match = value.match(regex);
|
|
249839
250045
|
const parsedDt = new Date(new Date().toISOString());
|
|
249840
250046
|
if (!match)
|
|
249841
250047
|
return null;
|
|
@@ -250828,4 +251034,4 @@ export {
|
|
|
250828
251034
|
CLIExitError
|
|
250829
251035
|
};
|
|
250830
251036
|
|
|
250831
|
-
//# debugId=
|
|
251037
|
+
//# debugId=213D2B84FD9C210664756E2164756E21
|