@base44-preview/cli 0.1.12-pr.611.23d31b2 → 0.1.13-pr.584.f81051e
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 +1138 -757
- package/dist/cli/index.js.map +20 -17
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -23354,15 +23354,15 @@ var require_windows = __commonJS(function(exports, module) {
|
|
|
23354
23354
|
}
|
|
23355
23355
|
return false;
|
|
23356
23356
|
}
|
|
23357
|
-
function checkStat(
|
|
23358
|
-
if (!
|
|
23357
|
+
function checkStat(stat3, path11, options) {
|
|
23358
|
+
if (!stat3.isSymbolicLink() && !stat3.isFile()) {
|
|
23359
23359
|
return false;
|
|
23360
23360
|
}
|
|
23361
23361
|
return checkPathExt(path11, options);
|
|
23362
23362
|
}
|
|
23363
23363
|
function isexe(path11, options, cb) {
|
|
23364
|
-
fs14.stat(path11, function(er,
|
|
23365
|
-
cb(er, er ? false : checkStat(
|
|
23364
|
+
fs14.stat(path11, function(er, stat3) {
|
|
23365
|
+
cb(er, er ? false : checkStat(stat3, path11, options));
|
|
23366
23366
|
});
|
|
23367
23367
|
}
|
|
23368
23368
|
function sync(path11, options) {
|
|
@@ -23376,20 +23376,20 @@ var require_mode = __commonJS(function(exports, module) {
|
|
|
23376
23376
|
isexe.sync = sync;
|
|
23377
23377
|
var fs14 = __require("fs");
|
|
23378
23378
|
function isexe(path11, options, cb) {
|
|
23379
|
-
fs14.stat(path11, function(er,
|
|
23380
|
-
cb(er, er ? false : checkStat(
|
|
23379
|
+
fs14.stat(path11, function(er, stat3) {
|
|
23380
|
+
cb(er, er ? false : checkStat(stat3, options));
|
|
23381
23381
|
});
|
|
23382
23382
|
}
|
|
23383
23383
|
function sync(path11, options) {
|
|
23384
23384
|
return checkStat(fs14.statSync(path11), options);
|
|
23385
23385
|
}
|
|
23386
|
-
function checkStat(
|
|
23387
|
-
return
|
|
23386
|
+
function checkStat(stat3, options) {
|
|
23387
|
+
return stat3.isFile() && checkMode(stat3, options);
|
|
23388
23388
|
}
|
|
23389
|
-
function checkMode(
|
|
23390
|
-
var mod =
|
|
23391
|
-
var uid =
|
|
23392
|
-
var gid =
|
|
23389
|
+
function checkMode(stat3, options) {
|
|
23390
|
+
var mod = stat3.mode;
|
|
23391
|
+
var uid = stat3.uid;
|
|
23392
|
+
var gid = stat3.gid;
|
|
23393
23393
|
var myUid = options.uid !== undefined ? options.uid : process.getuid && process.getuid();
|
|
23394
23394
|
var myGid = options.gid !== undefined ? options.gid : process.getgid && process.getgid();
|
|
23395
23395
|
var u = parseInt("100", 8);
|
|
@@ -23421,12 +23421,12 @@ var require_isexe = __commonJS(function(exports, module) {
|
|
|
23421
23421
|
if (typeof Promise !== "function") {
|
|
23422
23422
|
throw new TypeError("callback not provided");
|
|
23423
23423
|
}
|
|
23424
|
-
return new Promise(function(
|
|
23424
|
+
return new Promise(function(resolve5, reject) {
|
|
23425
23425
|
isexe(path11, options || {}, function(er, is) {
|
|
23426
23426
|
if (er) {
|
|
23427
23427
|
reject(er);
|
|
23428
23428
|
} else {
|
|
23429
|
-
|
|
23429
|
+
resolve5(is);
|
|
23430
23430
|
}
|
|
23431
23431
|
});
|
|
23432
23432
|
});
|
|
@@ -23488,27 +23488,27 @@ var require_which = __commonJS(function(exports, module) {
|
|
|
23488
23488
|
opt = {};
|
|
23489
23489
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
23490
23490
|
const found = [];
|
|
23491
|
-
const step = (i) => new Promise((
|
|
23491
|
+
const step = (i) => new Promise((resolve5, reject) => {
|
|
23492
23492
|
if (i === pathEnv.length)
|
|
23493
|
-
return opt.all && found.length ?
|
|
23493
|
+
return opt.all && found.length ? resolve5(found) : reject(getNotFoundError(cmd));
|
|
23494
23494
|
const ppRaw = pathEnv[i];
|
|
23495
23495
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
23496
23496
|
const pCmd = path11.join(pathPart, cmd);
|
|
23497
23497
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
23498
|
-
|
|
23498
|
+
resolve5(subStep(p, i, 0));
|
|
23499
23499
|
});
|
|
23500
|
-
const subStep = (p, i, ii) => new Promise((
|
|
23500
|
+
const subStep = (p, i, ii) => new Promise((resolve5, reject) => {
|
|
23501
23501
|
if (ii === pathExt.length)
|
|
23502
|
-
return
|
|
23502
|
+
return resolve5(step(i + 1));
|
|
23503
23503
|
const ext = pathExt[ii];
|
|
23504
23504
|
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
23505
23505
|
if (!er && is) {
|
|
23506
23506
|
if (opt.all)
|
|
23507
23507
|
found.push(p + ext);
|
|
23508
23508
|
else
|
|
23509
|
-
return
|
|
23509
|
+
return resolve5(p + ext);
|
|
23510
23510
|
}
|
|
23511
|
-
return
|
|
23511
|
+
return resolve5(subStep(p, i, ii + 1));
|
|
23512
23512
|
});
|
|
23513
23513
|
});
|
|
23514
23514
|
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
@@ -27036,7 +27036,7 @@ var require_lodash8 = __commonJS(function(exports, module) {
|
|
|
27036
27036
|
}
|
|
27037
27037
|
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
|
|
27038
27038
|
});
|
|
27039
|
-
function
|
|
27039
|
+
function join18(array2, separator) {
|
|
27040
27040
|
return array2 == null ? "" : nativeJoin.call(array2, separator);
|
|
27041
27041
|
}
|
|
27042
27042
|
function last(array2) {
|
|
@@ -28968,7 +28968,7 @@ __p += '`;
|
|
|
28968
28968
|
lodash.isUndefined = isUndefined;
|
|
28969
28969
|
lodash.isWeakMap = isWeakMap;
|
|
28970
28970
|
lodash.isWeakSet = isWeakSet;
|
|
28971
|
-
lodash.join =
|
|
28971
|
+
lodash.join = join18;
|
|
28972
28972
|
lodash.kebabCase = kebabCase;
|
|
28973
28973
|
lodash.last = last;
|
|
28974
28974
|
lodash.lastIndexOf = lastIndexOf;
|
|
@@ -31178,7 +31178,7 @@ function cleanDoc(doc2) {
|
|
|
31178
31178
|
return mapDoc(doc2, (currentDoc) => cleanDocFn(currentDoc));
|
|
31179
31179
|
}
|
|
31180
31180
|
function replaceEndOfLine(doc2, replacement = literalline) {
|
|
31181
|
-
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
31181
|
+
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ? join27(replacement, currentDoc.split(`
|
|
31182
31182
|
`)) : currentDoc);
|
|
31183
31183
|
}
|
|
31184
31184
|
function canBreakFn(doc2) {
|
|
@@ -31258,7 +31258,7 @@ function indentIfBreak(contents, options) {
|
|
|
31258
31258
|
negate: options.negate
|
|
31259
31259
|
};
|
|
31260
31260
|
}
|
|
31261
|
-
function
|
|
31261
|
+
function join27(separator, docs) {
|
|
31262
31262
|
assertDoc(separator);
|
|
31263
31263
|
assertDocArray(docs);
|
|
31264
31264
|
const parts = [];
|
|
@@ -31969,7 +31969,7 @@ var init_doc = __esm(() => {
|
|
|
31969
31969
|
MODE_FLAT = Symbol("MODE_FLAT");
|
|
31970
31970
|
DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
|
|
31971
31971
|
builders = {
|
|
31972
|
-
join:
|
|
31972
|
+
join: join27,
|
|
31973
31973
|
line,
|
|
31974
31974
|
softline,
|
|
31975
31975
|
hardline,
|
|
@@ -120387,7 +120387,7 @@ function skipVoid(str, ptr, banNewLines, banComments) {
|
|
|
120387
120387
|
ptr++;
|
|
120388
120388
|
return banComments || c24 !== "#" ? ptr : skipVoid(str, skipComment(str, ptr), banNewLines);
|
|
120389
120389
|
}
|
|
120390
|
-
function skipUntil(str, ptr,
|
|
120390
|
+
function skipUntil(str, ptr, sep2, end, banNewLines = false) {
|
|
120391
120391
|
if (!end) {
|
|
120392
120392
|
ptr = indexOfNewline(str, ptr);
|
|
120393
120393
|
return ptr < 0 ? str.length : ptr;
|
|
@@ -120396,7 +120396,7 @@ function skipUntil(str, ptr, sep, end, banNewLines = false) {
|
|
|
120396
120396
|
let c24 = str[i5];
|
|
120397
120397
|
if (c24 === "#") {
|
|
120398
120398
|
i5 = indexOfNewline(str, i5);
|
|
120399
|
-
} else if (c24 ===
|
|
120399
|
+
} else if (c24 === sep2) {
|
|
120400
120400
|
return i5 + 1;
|
|
120401
120401
|
} else if (c24 === end || banNewLines && (c24 === `
|
|
120402
120402
|
` || c24 === "\r" && str[i5 + 1] === `
|
|
@@ -121176,7 +121176,7 @@ function getDataProtocolModuleFormat(parsed) {
|
|
|
121176
121176
|
const { 1: mime } = /^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec(parsed.pathname) || [null, null, null];
|
|
121177
121177
|
return mimeToFormat(mime);
|
|
121178
121178
|
}
|
|
121179
|
-
function
|
|
121179
|
+
function extname2(url3) {
|
|
121180
121180
|
const pathname = url3.pathname;
|
|
121181
121181
|
let index = pathname.length;
|
|
121182
121182
|
while (index--) {
|
|
@@ -121191,7 +121191,7 @@ function extname(url3) {
|
|
|
121191
121191
|
return "";
|
|
121192
121192
|
}
|
|
121193
121193
|
function getFileProtocolModuleFormat(url3, _context, ignoreErrors) {
|
|
121194
|
-
const value =
|
|
121194
|
+
const value = extname2(url3);
|
|
121195
121195
|
if (value === ".js") {
|
|
121196
121196
|
const packageType = getPackageType(url3);
|
|
121197
121197
|
if (packageType !== "none") {
|
|
@@ -123906,14 +123906,14 @@ async function printToDoc(originalText, options8) {
|
|
|
123906
123906
|
async function printDocToString2(doc2, options8) {
|
|
123907
123907
|
return printDocToStringWithoutNormalizeOptions(doc2, await normalize_format_options_default(options8));
|
|
123908
123908
|
}
|
|
123909
|
-
function createParsersAndPrinters(
|
|
123909
|
+
function createParsersAndPrinters(modules2) {
|
|
123910
123910
|
const parsers2 = /* @__PURE__ */ Object.create(null);
|
|
123911
123911
|
const printers2 = /* @__PURE__ */ Object.create(null);
|
|
123912
123912
|
for (const {
|
|
123913
123913
|
importPlugin: importPlugin2,
|
|
123914
123914
|
parsers: parserNames = [],
|
|
123915
123915
|
printers: printerNames = []
|
|
123916
|
-
} of
|
|
123916
|
+
} of modules2) {
|
|
123917
123917
|
const loadPlugin2 = async () => {
|
|
123918
123918
|
const plugin = await importPlugin2();
|
|
123919
123919
|
Object.assign(parsers2, plugin.parsers);
|
|
@@ -136883,7 +136883,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
136883
136883
|
return mapDoc2(doc2, (currentDoc) => cleanDocFn2(currentDoc));
|
|
136884
136884
|
}
|
|
136885
136885
|
function replaceEndOfLine2(doc2, replacement = literalline2) {
|
|
136886
|
-
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
136886
|
+
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ? join29(replacement, currentDoc.split(`
|
|
136887
136887
|
`)) : currentDoc);
|
|
136888
136888
|
}
|
|
136889
136889
|
function canBreakFn2(doc2) {
|
|
@@ -136969,7 +136969,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
136969
136969
|
negate: options8.negate
|
|
136970
136970
|
};
|
|
136971
136971
|
}
|
|
136972
|
-
function
|
|
136972
|
+
function join29(separator, docs) {
|
|
136973
136973
|
assertDoc2(separator);
|
|
136974
136974
|
assertDocArray2(docs);
|
|
136975
136975
|
const parts = [];
|
|
@@ -137634,7 +137634,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
137634
137634
|
}
|
|
137635
137635
|
}
|
|
137636
137636
|
var builders2 = {
|
|
137637
|
-
join:
|
|
137637
|
+
join: join29,
|
|
137638
137638
|
line: line3,
|
|
137639
137639
|
softline: softline2,
|
|
137640
137640
|
hardline: hardline4,
|
|
@@ -138289,11 +138289,11 @@ var require_prettier = __commonJS(function(exports, module) {
|
|
|
138289
138289
|
var require_formatter = __commonJS(function(exports) {
|
|
138290
138290
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
|
|
138291
138291
|
function adopt(value) {
|
|
138292
|
-
return value instanceof P9 ? value : new P9(function(
|
|
138293
|
-
|
|
138292
|
+
return value instanceof P9 ? value : new P9(function(resolve15) {
|
|
138293
|
+
resolve15(value);
|
|
138294
138294
|
});
|
|
138295
138295
|
}
|
|
138296
|
-
return new (P9 || (P9 = Promise))(function(
|
|
138296
|
+
return new (P9 || (P9 = Promise))(function(resolve15, reject) {
|
|
138297
138297
|
function fulfilled(value) {
|
|
138298
138298
|
try {
|
|
138299
138299
|
step(generator.next(value));
|
|
@@ -138309,7 +138309,7 @@ var require_formatter = __commonJS(function(exports) {
|
|
|
138309
138309
|
}
|
|
138310
138310
|
}
|
|
138311
138311
|
function step(result) {
|
|
138312
|
-
result.done ?
|
|
138312
|
+
result.done ? resolve15(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
138313
138313
|
}
|
|
138314
138314
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
138315
138315
|
});
|
|
@@ -142962,7 +142962,7 @@ var require_url = __commonJS(function(exports) {
|
|
|
142962
142962
|
};
|
|
142963
142963
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
142964
142964
|
exports.parse = undefined;
|
|
142965
|
-
exports.resolve =
|
|
142965
|
+
exports.resolve = resolve15;
|
|
142966
142966
|
exports.cwd = cwd;
|
|
142967
142967
|
exports.getProtocol = getProtocol;
|
|
142968
142968
|
exports.getExtension = getExtension;
|
|
@@ -142974,7 +142974,7 @@ var require_url = __commonJS(function(exports) {
|
|
|
142974
142974
|
exports.fromFileSystemPath = fromFileSystemPath;
|
|
142975
142975
|
exports.toFileSystemPath = toFileSystemPath;
|
|
142976
142976
|
exports.safePointerToPath = safePointerToPath;
|
|
142977
|
-
exports.relative =
|
|
142977
|
+
exports.relative = relative5;
|
|
142978
142978
|
var convert_path_to_posix_1 = __importDefault(require_convert_path_to_posix());
|
|
142979
142979
|
var path_1 = __importStar(__require("path"));
|
|
142980
142980
|
var forwardSlashPattern = /\//g;
|
|
@@ -142990,7 +142990,7 @@ var require_url = __commonJS(function(exports) {
|
|
|
142990
142990
|
var urlDecodePatterns = [/%23/g, "#", /%24/g, "$", /%26/g, "&", /%2C/g, ",", /%40/g, "@"];
|
|
142991
142991
|
var parse11 = (u4) => new URL(u4);
|
|
142992
142992
|
exports.parse = parse11;
|
|
142993
|
-
function
|
|
142993
|
+
function resolve15(from, to5) {
|
|
142994
142994
|
const fromUrl = new URL((0, convert_path_to_posix_1.default)(from), "https://aaa.nonexistanturl.com");
|
|
142995
142995
|
const resolvedUrl = new URL((0, convert_path_to_posix_1.default)(to5), fromUrl);
|
|
142996
142996
|
const endSpaces = to5.match(/(\s*)$/)?.[1] || "";
|
|
@@ -143124,9 +143124,9 @@ var require_url = __commonJS(function(exports) {
|
|
|
143124
143124
|
return decodeURIComponent(value).replace(jsonPointerSlash, "/").replace(jsonPointerTilde, "~");
|
|
143125
143125
|
});
|
|
143126
143126
|
}
|
|
143127
|
-
function
|
|
143127
|
+
function relative5(from, to5) {
|
|
143128
143128
|
if (!isFileSystemPath(from) || !isFileSystemPath(to5)) {
|
|
143129
|
-
return
|
|
143129
|
+
return resolve15(from, to5);
|
|
143130
143130
|
}
|
|
143131
143131
|
const fromDir = path_1.default.dirname(stripHash(from));
|
|
143132
143132
|
const toPath4 = stripHash(to5);
|
|
@@ -143802,7 +143802,7 @@ var require_plugins = __commonJS(function(exports) {
|
|
|
143802
143802
|
let plugin;
|
|
143803
143803
|
let lastError;
|
|
143804
143804
|
let index = 0;
|
|
143805
|
-
return new Promise((
|
|
143805
|
+
return new Promise((resolve15, reject) => {
|
|
143806
143806
|
runNextPlugin();
|
|
143807
143807
|
function runNextPlugin() {
|
|
143808
143808
|
plugin = plugins[index++];
|
|
@@ -143830,7 +143830,7 @@ var require_plugins = __commonJS(function(exports) {
|
|
|
143830
143830
|
}
|
|
143831
143831
|
}
|
|
143832
143832
|
function onSuccess(result) {
|
|
143833
|
-
|
|
143833
|
+
resolve15({
|
|
143834
143834
|
plugin,
|
|
143835
143835
|
result
|
|
143836
143836
|
});
|
|
@@ -145163,11 +145163,11 @@ var require_lib3 = __commonJS(function(exports) {
|
|
|
145163
145163
|
var require_resolver = __commonJS(function(exports) {
|
|
145164
145164
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
|
|
145165
145165
|
function adopt(value) {
|
|
145166
|
-
return value instanceof P9 ? value : new P9(function(
|
|
145167
|
-
|
|
145166
|
+
return value instanceof P9 ? value : new P9(function(resolve15) {
|
|
145167
|
+
resolve15(value);
|
|
145168
145168
|
});
|
|
145169
145169
|
}
|
|
145170
|
-
return new (P9 || (P9 = Promise))(function(
|
|
145170
|
+
return new (P9 || (P9 = Promise))(function(resolve15, reject) {
|
|
145171
145171
|
function fulfilled(value) {
|
|
145172
145172
|
try {
|
|
145173
145173
|
step(generator.next(value));
|
|
@@ -145183,7 +145183,7 @@ var require_resolver = __commonJS(function(exports) {
|
|
|
145183
145183
|
}
|
|
145184
145184
|
}
|
|
145185
145185
|
function step(result) {
|
|
145186
|
-
result.done ?
|
|
145186
|
+
result.done ? resolve15(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
145187
145187
|
}
|
|
145188
145188
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
145189
145189
|
});
|
|
@@ -145304,11 +145304,11 @@ var require_optionValidator = __commonJS(function(exports) {
|
|
|
145304
145304
|
var require_src3 = __commonJS(function(exports) {
|
|
145305
145305
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
|
|
145306
145306
|
function adopt(value) {
|
|
145307
|
-
return value instanceof P9 ? value : new P9(function(
|
|
145308
|
-
|
|
145307
|
+
return value instanceof P9 ? value : new P9(function(resolve15) {
|
|
145308
|
+
resolve15(value);
|
|
145309
145309
|
});
|
|
145310
145310
|
}
|
|
145311
|
-
return new (P9 || (P9 = Promise))(function(
|
|
145311
|
+
return new (P9 || (P9 = Promise))(function(resolve15, reject) {
|
|
145312
145312
|
function fulfilled(value) {
|
|
145313
145313
|
try {
|
|
145314
145314
|
step(generator.next(value));
|
|
@@ -145324,7 +145324,7 @@ var require_src3 = __commonJS(function(exports) {
|
|
|
145324
145324
|
}
|
|
145325
145325
|
}
|
|
145326
145326
|
function step(result) {
|
|
145327
|
-
result.done ?
|
|
145327
|
+
result.done ? resolve15(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
145328
145328
|
}
|
|
145329
145329
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
145330
145330
|
});
|
|
@@ -146453,7 +146453,7 @@ var require_depd = __commonJS(function(exports, module) {
|
|
|
146453
146453
|
* Copyright(c) 2014-2018 Douglas Christopher Wilson
|
|
146454
146454
|
* MIT Licensed
|
|
146455
146455
|
*/
|
|
146456
|
-
var
|
|
146456
|
+
var relative5 = __require("path").relative;
|
|
146457
146457
|
module.exports = depd;
|
|
146458
146458
|
var basePath = process.cwd();
|
|
146459
146459
|
function containsNamespace(str, namespace) {
|
|
@@ -146649,7 +146649,7 @@ var require_depd = __commonJS(function(exports, module) {
|
|
|
146649
146649
|
return formatted;
|
|
146650
146650
|
}
|
|
146651
146651
|
function formatLocation(callSite) {
|
|
146652
|
-
return
|
|
146652
|
+
return relative5(basePath, callSite[0]) + ":" + callSite[1] + ":" + callSite[2];
|
|
146653
146653
|
}
|
|
146654
146654
|
function getStack() {
|
|
146655
146655
|
var limit = Error.stackTraceLimit;
|
|
@@ -150645,7 +150645,7 @@ var require_dbcs_data = __commonJS(function(exports, module) {
|
|
|
150645
150645
|
// ../../node_modules/iconv-lite/encodings/index.js
|
|
150646
150646
|
var require_encodings = __commonJS(function(exports, module) {
|
|
150647
150647
|
var mergeModules = require_merge_exports();
|
|
150648
|
-
var
|
|
150648
|
+
var modules2 = [
|
|
150649
150649
|
require_internal(),
|
|
150650
150650
|
require_utf32(),
|
|
150651
150651
|
require_utf16(),
|
|
@@ -150656,8 +150656,8 @@ var require_encodings = __commonJS(function(exports, module) {
|
|
|
150656
150656
|
require_dbcs_codec(),
|
|
150657
150657
|
require_dbcs_data()
|
|
150658
150658
|
];
|
|
150659
|
-
for (i5 = 0;i5 <
|
|
150660
|
-
module =
|
|
150659
|
+
for (i5 = 0;i5 < modules2.length; i5++) {
|
|
150660
|
+
module = modules2[i5];
|
|
150661
150661
|
mergeModules(exports, module);
|
|
150662
150662
|
}
|
|
150663
150663
|
var module;
|
|
@@ -150986,11 +150986,11 @@ var require_raw_body = __commonJS(function(exports, module) {
|
|
|
150986
150986
|
if (done) {
|
|
150987
150987
|
return readStream(stream, encoding, length, limit, wrap(done));
|
|
150988
150988
|
}
|
|
150989
|
-
return new Promise(function executor(
|
|
150989
|
+
return new Promise(function executor(resolve15, reject) {
|
|
150990
150990
|
readStream(stream, encoding, length, limit, function onRead2(err, buf) {
|
|
150991
150991
|
if (err)
|
|
150992
150992
|
return reject(err);
|
|
150993
|
-
|
|
150993
|
+
resolve15(buf);
|
|
150994
150994
|
});
|
|
150995
150995
|
});
|
|
150996
150996
|
}
|
|
@@ -160794,7 +160794,7 @@ var require_mime_types = __commonJS(function(exports) {
|
|
|
160794
160794
|
* MIT Licensed
|
|
160795
160795
|
*/
|
|
160796
160796
|
var db2 = require_db();
|
|
160797
|
-
var
|
|
160797
|
+
var extname3 = __require("path").extname;
|
|
160798
160798
|
var mimeScore = require_mimeScore();
|
|
160799
160799
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
160800
160800
|
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
@@ -160851,7 +160851,7 @@ var require_mime_types = __commonJS(function(exports) {
|
|
|
160851
160851
|
if (!path18 || typeof path18 !== "string") {
|
|
160852
160852
|
return false;
|
|
160853
160853
|
}
|
|
160854
|
-
var extension2 =
|
|
160854
|
+
var extension2 = extname3("x." + path18).toLowerCase().slice(1);
|
|
160855
160855
|
if (!extension2) {
|
|
160856
160856
|
return false;
|
|
160857
160857
|
}
|
|
@@ -164111,16 +164111,16 @@ var require_view = __commonJS(function(exports, module) {
|
|
|
164111
164111
|
var debug = require_src4()("express:view");
|
|
164112
164112
|
var path18 = __require("node:path");
|
|
164113
164113
|
var fs28 = __require("node:fs");
|
|
164114
|
-
var
|
|
164114
|
+
var dirname21 = path18.dirname;
|
|
164115
164115
|
var basename7 = path18.basename;
|
|
164116
|
-
var
|
|
164117
|
-
var
|
|
164118
|
-
var
|
|
164116
|
+
var extname3 = path18.extname;
|
|
164117
|
+
var join30 = path18.join;
|
|
164118
|
+
var resolve15 = path18.resolve;
|
|
164119
164119
|
module.exports = View;
|
|
164120
164120
|
function View(name2, options8) {
|
|
164121
164121
|
var opts = options8 || {};
|
|
164122
164122
|
this.defaultEngine = opts.defaultEngine;
|
|
164123
|
-
this.ext =
|
|
164123
|
+
this.ext = extname3(name2);
|
|
164124
164124
|
this.name = name2;
|
|
164125
164125
|
this.root = opts.root;
|
|
164126
164126
|
if (!this.ext && !this.defaultEngine) {
|
|
@@ -164149,8 +164149,8 @@ var require_view = __commonJS(function(exports, module) {
|
|
|
164149
164149
|
debug('lookup "%s"', name2);
|
|
164150
164150
|
for (var i5 = 0;i5 < roots.length && !path19; i5++) {
|
|
164151
164151
|
var root2 = roots[i5];
|
|
164152
|
-
var loc =
|
|
164153
|
-
var dir =
|
|
164152
|
+
var loc = resolve15(root2, name2);
|
|
164153
|
+
var dir = dirname21(loc);
|
|
164154
164154
|
var file2 = basename7(loc);
|
|
164155
164155
|
path19 = this.resolve(dir, file2);
|
|
164156
164156
|
}
|
|
@@ -164174,16 +164174,16 @@ var require_view = __commonJS(function(exports, module) {
|
|
|
164174
164174
|
});
|
|
164175
164175
|
sync = false;
|
|
164176
164176
|
};
|
|
164177
|
-
View.prototype.resolve = function
|
|
164177
|
+
View.prototype.resolve = function resolve16(dir, file2) {
|
|
164178
164178
|
var ext = this.ext;
|
|
164179
|
-
var path19 =
|
|
164180
|
-
var
|
|
164181
|
-
if (
|
|
164179
|
+
var path19 = join30(dir, file2);
|
|
164180
|
+
var stat4 = tryStat(path19);
|
|
164181
|
+
if (stat4 && stat4.isFile()) {
|
|
164182
164182
|
return path19;
|
|
164183
164183
|
}
|
|
164184
|
-
path19 =
|
|
164185
|
-
|
|
164186
|
-
if (
|
|
164184
|
+
path19 = join30(dir, basename7(file2, ext), "index" + ext);
|
|
164185
|
+
stat4 = tryStat(path19);
|
|
164186
|
+
if (stat4 && stat4.isFile()) {
|
|
164187
164187
|
return path19;
|
|
164188
164188
|
}
|
|
164189
164189
|
};
|
|
@@ -164234,9 +164234,9 @@ var require_etag = __commonJS(function(exports, module) {
|
|
|
164234
164234
|
}
|
|
164235
164235
|
return obj && typeof obj === "object" && "ctime" in obj && toString2.call(obj.ctime) === "[object Date]" && "mtime" in obj && toString2.call(obj.mtime) === "[object Date]" && "ino" in obj && typeof obj.ino === "number" && "size" in obj && typeof obj.size === "number";
|
|
164236
164236
|
}
|
|
164237
|
-
function stattag(
|
|
164238
|
-
var mtime =
|
|
164239
|
-
var size =
|
|
164237
|
+
function stattag(stat4) {
|
|
164238
|
+
var mtime = stat4.mtime.getTime().toString(16);
|
|
164239
|
+
var size = stat4.size.toString(16);
|
|
164240
164240
|
return '"' + size + "-" + mtime + '"';
|
|
164241
164241
|
}
|
|
164242
164242
|
});
|
|
@@ -166333,7 +166333,7 @@ var require_application = __commonJS(function(exports, module) {
|
|
|
166333
166333
|
var compileETag = require_utils10().compileETag;
|
|
166334
166334
|
var compileQueryParser = require_utils10().compileQueryParser;
|
|
166335
166335
|
var compileTrust = require_utils10().compileTrust;
|
|
166336
|
-
var
|
|
166336
|
+
var resolve15 = __require("node:path").resolve;
|
|
166337
166337
|
var once9 = require_once();
|
|
166338
166338
|
var Router = require_router();
|
|
166339
166339
|
var slice = Array.prototype.slice;
|
|
@@ -166387,7 +166387,7 @@ var require_application = __commonJS(function(exports, module) {
|
|
|
166387
166387
|
this.mountpath = "/";
|
|
166388
166388
|
this.locals.settings = this.settings;
|
|
166389
166389
|
this.set("view", View);
|
|
166390
|
-
this.set("views",
|
|
166390
|
+
this.set("views", resolve15("views"));
|
|
166391
166391
|
this.set("jsonp callback name", "callback");
|
|
166392
166392
|
if (env4 === "production") {
|
|
166393
166393
|
this.enable("view cache");
|
|
@@ -167875,11 +167875,11 @@ var require_send = __commonJS(function(exports, module) {
|
|
|
167875
167875
|
var statuses = require_statuses();
|
|
167876
167876
|
var Stream2 = __require("stream");
|
|
167877
167877
|
var util2 = __require("util");
|
|
167878
|
-
var
|
|
167879
|
-
var
|
|
167878
|
+
var extname3 = path18.extname;
|
|
167879
|
+
var join30 = path18.join;
|
|
167880
167880
|
var normalize2 = path18.normalize;
|
|
167881
|
-
var
|
|
167882
|
-
var
|
|
167881
|
+
var resolve15 = path18.resolve;
|
|
167882
|
+
var sep2 = path18.sep;
|
|
167883
167883
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
167884
167884
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1000;
|
|
167885
167885
|
var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
|
|
@@ -167907,7 +167907,7 @@ var require_send = __commonJS(function(exports, module) {
|
|
|
167907
167907
|
this._maxage = opts.maxAge || opts.maxage;
|
|
167908
167908
|
this._maxage = typeof this._maxage === "string" ? ms9(this._maxage) : Number(this._maxage);
|
|
167909
167909
|
this._maxage = !isNaN(this._maxage) ? Math.min(Math.max(0, this._maxage), MAX_MAXAGE) : 0;
|
|
167910
|
-
this._root = opts.root ?
|
|
167910
|
+
this._root = opts.root ? resolve15(opts.root) : null;
|
|
167911
167911
|
}
|
|
167912
167912
|
util2.inherits(SendStream, Stream2);
|
|
167913
167913
|
SendStream.prototype.error = function error48(status, err) {
|
|
@@ -168040,23 +168040,23 @@ var require_send = __commonJS(function(exports, module) {
|
|
|
168040
168040
|
var parts;
|
|
168041
168041
|
if (root2 !== null) {
|
|
168042
168042
|
if (path19) {
|
|
168043
|
-
path19 = normalize2("." +
|
|
168043
|
+
path19 = normalize2("." + sep2 + path19);
|
|
168044
168044
|
}
|
|
168045
168045
|
if (UP_PATH_REGEXP.test(path19)) {
|
|
168046
168046
|
debug('malicious path "%s"', path19);
|
|
168047
168047
|
this.error(403);
|
|
168048
168048
|
return res;
|
|
168049
168049
|
}
|
|
168050
|
-
parts = path19.split(
|
|
168051
|
-
path19 = normalize2(
|
|
168050
|
+
parts = path19.split(sep2);
|
|
168051
|
+
path19 = normalize2(join30(root2, path19));
|
|
168052
168052
|
} else {
|
|
168053
168053
|
if (UP_PATH_REGEXP.test(path19)) {
|
|
168054
168054
|
debug('malicious path "%s"', path19);
|
|
168055
168055
|
this.error(403);
|
|
168056
168056
|
return res;
|
|
168057
168057
|
}
|
|
168058
|
-
parts = normalize2(path19).split(
|
|
168059
|
-
path19 =
|
|
168058
|
+
parts = normalize2(path19).split(sep2);
|
|
168059
|
+
path19 = resolve15(path19);
|
|
168060
168060
|
}
|
|
168061
168061
|
if (containsDotFile(parts)) {
|
|
168062
168062
|
debug('%s dotfile "%s"', this._dotfiles, path19);
|
|
@@ -168079,8 +168079,8 @@ var require_send = __commonJS(function(exports, module) {
|
|
|
168079
168079
|
this.sendFile(path19);
|
|
168080
168080
|
return res;
|
|
168081
168081
|
};
|
|
168082
|
-
SendStream.prototype.send = function send2(path19,
|
|
168083
|
-
var len =
|
|
168082
|
+
SendStream.prototype.send = function send2(path19, stat4) {
|
|
168083
|
+
var len = stat4.size;
|
|
168084
168084
|
var options8 = this.options;
|
|
168085
168085
|
var opts = {};
|
|
168086
168086
|
var res = this.res;
|
|
@@ -168092,7 +168092,7 @@ var require_send = __commonJS(function(exports, module) {
|
|
|
168092
168092
|
return;
|
|
168093
168093
|
}
|
|
168094
168094
|
debug('pipe "%s"', path19);
|
|
168095
|
-
this.setHeader(path19,
|
|
168095
|
+
this.setHeader(path19, stat4);
|
|
168096
168096
|
this.type(path19);
|
|
168097
168097
|
if (this.isConditionalGET()) {
|
|
168098
168098
|
if (this.isPreconditionFailure()) {
|
|
@@ -168149,19 +168149,19 @@ var require_send = __commonJS(function(exports, module) {
|
|
|
168149
168149
|
var i5 = 0;
|
|
168150
168150
|
var self2 = this;
|
|
168151
168151
|
debug('stat "%s"', path19);
|
|
168152
|
-
fs28.stat(path19, function onstat(err,
|
|
168153
|
-
var pathEndsWithSep = path19[path19.length - 1] ===
|
|
168154
|
-
if (err && err.code === "ENOENT" && !
|
|
168152
|
+
fs28.stat(path19, function onstat(err, stat4) {
|
|
168153
|
+
var pathEndsWithSep = path19[path19.length - 1] === sep2;
|
|
168154
|
+
if (err && err.code === "ENOENT" && !extname3(path19) && !pathEndsWithSep) {
|
|
168155
168155
|
return next(err);
|
|
168156
168156
|
}
|
|
168157
168157
|
if (err)
|
|
168158
168158
|
return self2.onStatError(err);
|
|
168159
|
-
if (
|
|
168159
|
+
if (stat4.isDirectory())
|
|
168160
168160
|
return self2.redirect(path19);
|
|
168161
168161
|
if (pathEndsWithSep)
|
|
168162
168162
|
return self2.error(404);
|
|
168163
|
-
self2.emit("file", path19,
|
|
168164
|
-
self2.send(path19,
|
|
168163
|
+
self2.emit("file", path19, stat4);
|
|
168164
|
+
self2.send(path19, stat4);
|
|
168165
168165
|
});
|
|
168166
168166
|
function next(err) {
|
|
168167
168167
|
if (self2._extensions.length <= i5) {
|
|
@@ -168169,13 +168169,13 @@ var require_send = __commonJS(function(exports, module) {
|
|
|
168169
168169
|
}
|
|
168170
168170
|
var p4 = path19 + "." + self2._extensions[i5++];
|
|
168171
168171
|
debug('stat "%s"', p4);
|
|
168172
|
-
fs28.stat(p4, function(err2,
|
|
168172
|
+
fs28.stat(p4, function(err2, stat4) {
|
|
168173
168173
|
if (err2)
|
|
168174
168174
|
return next(err2);
|
|
168175
|
-
if (
|
|
168175
|
+
if (stat4.isDirectory())
|
|
168176
168176
|
return next();
|
|
168177
|
-
self2.emit("file", p4,
|
|
168178
|
-
self2.send(p4,
|
|
168177
|
+
self2.emit("file", p4, stat4);
|
|
168178
|
+
self2.send(p4, stat4);
|
|
168179
168179
|
});
|
|
168180
168180
|
}
|
|
168181
168181
|
};
|
|
@@ -168188,15 +168188,15 @@ var require_send = __commonJS(function(exports, module) {
|
|
|
168188
168188
|
return self2.onStatError(err);
|
|
168189
168189
|
return self2.error(404);
|
|
168190
168190
|
}
|
|
168191
|
-
var p4 =
|
|
168191
|
+
var p4 = join30(path19, self2._index[i5]);
|
|
168192
168192
|
debug('stat "%s"', p4);
|
|
168193
|
-
fs28.stat(p4, function(err2,
|
|
168193
|
+
fs28.stat(p4, function(err2, stat4) {
|
|
168194
168194
|
if (err2)
|
|
168195
168195
|
return next(err2);
|
|
168196
|
-
if (
|
|
168196
|
+
if (stat4.isDirectory())
|
|
168197
168197
|
return next();
|
|
168198
|
-
self2.emit("file", p4,
|
|
168199
|
-
self2.send(p4,
|
|
168198
|
+
self2.emit("file", p4, stat4);
|
|
168199
|
+
self2.send(p4, stat4);
|
|
168200
168200
|
});
|
|
168201
168201
|
}
|
|
168202
168202
|
next();
|
|
@@ -168223,14 +168223,14 @@ var require_send = __commonJS(function(exports, module) {
|
|
|
168223
168223
|
var res = this.res;
|
|
168224
168224
|
if (res.getHeader("Content-Type"))
|
|
168225
168225
|
return;
|
|
168226
|
-
var ext =
|
|
168226
|
+
var ext = extname3(path19);
|
|
168227
168227
|
var type2 = mime.contentType(ext) || "application/octet-stream";
|
|
168228
168228
|
debug("content-type %s", type2);
|
|
168229
168229
|
res.setHeader("Content-Type", type2);
|
|
168230
168230
|
};
|
|
168231
|
-
SendStream.prototype.setHeader = function setHeader(path19,
|
|
168231
|
+
SendStream.prototype.setHeader = function setHeader(path19, stat4) {
|
|
168232
168232
|
var res = this.res;
|
|
168233
|
-
this.emit("headers", res, path19,
|
|
168233
|
+
this.emit("headers", res, path19, stat4);
|
|
168234
168234
|
if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
|
|
168235
168235
|
debug("accept ranges");
|
|
168236
168236
|
res.setHeader("Accept-Ranges", "bytes");
|
|
@@ -168244,12 +168244,12 @@ var require_send = __commonJS(function(exports, module) {
|
|
|
168244
168244
|
res.setHeader("Cache-Control", cacheControl);
|
|
168245
168245
|
}
|
|
168246
168246
|
if (this._lastModified && !res.getHeader("Last-Modified")) {
|
|
168247
|
-
var modified =
|
|
168247
|
+
var modified = stat4.mtime.toUTCString();
|
|
168248
168248
|
debug("modified %s", modified);
|
|
168249
168249
|
res.setHeader("Last-Modified", modified);
|
|
168250
168250
|
}
|
|
168251
168251
|
if (this._etag && !res.getHeader("ETag")) {
|
|
168252
|
-
var val = etag(
|
|
168252
|
+
var val = etag(stat4);
|
|
168253
168253
|
debug("etag %s", val);
|
|
168254
168254
|
res.setHeader("ETag", val);
|
|
168255
168255
|
}
|
|
@@ -168383,8 +168383,8 @@ var require_response = __commonJS(function(exports, module) {
|
|
|
168383
168383
|
var setCharset = require_utils10().setCharset;
|
|
168384
168384
|
var cookie = require_cookie();
|
|
168385
168385
|
var send = require_send();
|
|
168386
|
-
var
|
|
168387
|
-
var
|
|
168386
|
+
var extname3 = path18.extname;
|
|
168387
|
+
var resolve15 = path18.resolve;
|
|
168388
168388
|
var vary = require_vary();
|
|
168389
168389
|
var { Buffer: Buffer7 } = __require("node:buffer");
|
|
168390
168390
|
var res = Object.create(http.ServerResponse.prototype);
|
|
@@ -168593,7 +168593,7 @@ var require_response = __commonJS(function(exports, module) {
|
|
|
168593
168593
|
}
|
|
168594
168594
|
opts = Object.create(opts);
|
|
168595
168595
|
opts.headers = headers;
|
|
168596
|
-
var fullPath = !opts.root ?
|
|
168596
|
+
var fullPath = !opts.root ? resolve15(path19) : path19;
|
|
168597
168597
|
return this.sendFile(fullPath, opts, done);
|
|
168598
168598
|
};
|
|
168599
168599
|
res.contentType = res.type = function contentType(type) {
|
|
@@ -168624,7 +168624,7 @@ var require_response = __commonJS(function(exports, module) {
|
|
|
168624
168624
|
};
|
|
168625
168625
|
res.attachment = function attachment(filename) {
|
|
168626
168626
|
if (filename) {
|
|
168627
|
-
this.type(
|
|
168627
|
+
this.type(extname3(filename));
|
|
168628
168628
|
}
|
|
168629
168629
|
this.set("Content-Disposition", contentDisposition(filename));
|
|
168630
168630
|
return this;
|
|
@@ -168854,7 +168854,7 @@ var require_serve_static = __commonJS(function(exports, module) {
|
|
|
168854
168854
|
var encodeUrl = require_encodeurl();
|
|
168855
168855
|
var escapeHtml = require_escape_html();
|
|
168856
168856
|
var parseUrl = require_parseurl();
|
|
168857
|
-
var
|
|
168857
|
+
var resolve15 = __require("path").resolve;
|
|
168858
168858
|
var send = require_send();
|
|
168859
168859
|
var url3 = __require("url");
|
|
168860
168860
|
module.exports = serveStatic;
|
|
@@ -168873,7 +168873,7 @@ var require_serve_static = __commonJS(function(exports, module) {
|
|
|
168873
168873
|
throw new TypeError("option setHeaders must be function");
|
|
168874
168874
|
}
|
|
168875
168875
|
opts.maxage = opts.maxage || opts.maxAge || 0;
|
|
168876
|
-
opts.root =
|
|
168876
|
+
opts.root = resolve15(root2);
|
|
168877
168877
|
var onDirectory = redirect ? createRedirectDirectoryListener() : createNotFoundDirectoryListener();
|
|
168878
168878
|
return function serveStatic2(req, res, next) {
|
|
168879
168879
|
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
@@ -169797,8 +169797,8 @@ var require_follow_redirects = __commonJS(function(exports, module) {
|
|
|
169797
169797
|
}
|
|
169798
169798
|
return parsed;
|
|
169799
169799
|
}
|
|
169800
|
-
function resolveUrl(
|
|
169801
|
-
return useNativeURL ? new URL2(
|
|
169800
|
+
function resolveUrl(relative5, base) {
|
|
169801
|
+
return useNativeURL ? new URL2(relative5, base) : parseUrl(url3.resolve(base, relative5));
|
|
169802
169802
|
}
|
|
169803
169803
|
function validateUrl(input) {
|
|
169804
169804
|
if (/^\[/.test(input.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input.hostname)) {
|
|
@@ -172247,8 +172247,8 @@ var require_executor = __commonJS(function(exports, module) {
|
|
|
172247
172247
|
}
|
|
172248
172248
|
resetBuffer() {
|
|
172249
172249
|
this.buffer = new Waterfall;
|
|
172250
|
-
this.buffer.chain(new Promise((
|
|
172251
|
-
this._triggerBuffer =
|
|
172250
|
+
this.buffer.chain(new Promise((resolve15) => {
|
|
172251
|
+
this._triggerBuffer = resolve15;
|
|
172252
172252
|
}));
|
|
172253
172253
|
if (this.ready)
|
|
172254
172254
|
this._triggerBuffer();
|
|
@@ -173268,7 +173268,7 @@ var require_storage = __commonJS(function(exports, module) {
|
|
|
173268
173268
|
throw e8;
|
|
173269
173269
|
}
|
|
173270
173270
|
};
|
|
173271
|
-
var writeFileLinesAsync = (filename, lines, mode = DEFAULT_FILE_MODE) => new Promise((
|
|
173271
|
+
var writeFileLinesAsync = (filename, lines, mode = DEFAULT_FILE_MODE) => new Promise((resolve15, reject) => {
|
|
173272
173272
|
try {
|
|
173273
173273
|
const stream = writeFileStream(filename, { mode });
|
|
173274
173274
|
const readable2 = Readable6.from(lines);
|
|
@@ -173285,7 +173285,7 @@ var require_storage = __commonJS(function(exports, module) {
|
|
|
173285
173285
|
if (err)
|
|
173286
173286
|
reject(err);
|
|
173287
173287
|
else
|
|
173288
|
-
|
|
173288
|
+
resolve15();
|
|
173289
173289
|
});
|
|
173290
173290
|
});
|
|
173291
173291
|
readable2.on("error", (err) => {
|
|
@@ -173456,7 +173456,7 @@ var require_persistence = __commonJS(function(exports, module) {
|
|
|
173456
173456
|
return { data: tdata, indexes };
|
|
173457
173457
|
}
|
|
173458
173458
|
treatRawStreamAsync(rawStream) {
|
|
173459
|
-
return new Promise((
|
|
173459
|
+
return new Promise((resolve15, reject) => {
|
|
173460
173460
|
const dataById = {};
|
|
173461
173461
|
const indexes = {};
|
|
173462
173462
|
let corruptItems = 0;
|
|
@@ -173499,7 +173499,7 @@ var require_persistence = __commonJS(function(exports, module) {
|
|
|
173499
173499
|
}
|
|
173500
173500
|
}
|
|
173501
173501
|
const data = Object.values(dataById);
|
|
173502
|
-
|
|
173502
|
+
resolve15({ data, indexes });
|
|
173503
173503
|
});
|
|
173504
173504
|
lineStream.on("error", function(err) {
|
|
173505
173505
|
reject(err, null);
|
|
@@ -183032,7 +183032,7 @@ var require_mime_types2 = __commonJS(function(exports) {
|
|
|
183032
183032
|
* MIT Licensed
|
|
183033
183033
|
*/
|
|
183034
183034
|
var db2 = require_db2();
|
|
183035
|
-
var
|
|
183035
|
+
var extname3 = __require("path").extname;
|
|
183036
183036
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
183037
183037
|
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
183038
183038
|
exports.charset = charset;
|
|
@@ -183087,7 +183087,7 @@ var require_mime_types2 = __commonJS(function(exports) {
|
|
|
183087
183087
|
if (!path18 || typeof path18 !== "string") {
|
|
183088
183088
|
return false;
|
|
183089
183089
|
}
|
|
183090
|
-
var extension2 =
|
|
183090
|
+
var extension2 = extname3("x." + path18).toLowerCase().substr(1);
|
|
183091
183091
|
if (!extension2) {
|
|
183092
183092
|
return false;
|
|
183093
183093
|
}
|
|
@@ -193079,7 +193079,7 @@ var require_mime_types3 = __commonJS(function(exports) {
|
|
|
193079
193079
|
* MIT Licensed
|
|
193080
193080
|
*/
|
|
193081
193081
|
var db2 = require_db3();
|
|
193082
|
-
var
|
|
193082
|
+
var extname3 = __require("path").extname;
|
|
193083
193083
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
193084
193084
|
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
193085
193085
|
exports.charset = charset;
|
|
@@ -193134,7 +193134,7 @@ var require_mime_types3 = __commonJS(function(exports) {
|
|
|
193134
193134
|
if (!path18 || typeof path18 !== "string") {
|
|
193135
193135
|
return false;
|
|
193136
193136
|
}
|
|
193137
|
-
var extension2 =
|
|
193137
|
+
var extension2 = extname3("x." + path18).toLowerCase().substr(1);
|
|
193138
193138
|
if (!extension2) {
|
|
193139
193139
|
return false;
|
|
193140
193140
|
}
|
|
@@ -199110,13 +199110,13 @@ var require_broadcast_operator = __commonJS(function(exports) {
|
|
|
199110
199110
|
return true;
|
|
199111
199111
|
}
|
|
199112
199112
|
emitWithAck(ev2, ...args) {
|
|
199113
|
-
return new Promise((
|
|
199113
|
+
return new Promise((resolve15, reject) => {
|
|
199114
199114
|
args.push((err, responses) => {
|
|
199115
199115
|
if (err) {
|
|
199116
199116
|
err.responses = responses;
|
|
199117
199117
|
return reject(err);
|
|
199118
199118
|
} else {
|
|
199119
|
-
return
|
|
199119
|
+
return resolve15(responses);
|
|
199120
199120
|
}
|
|
199121
199121
|
});
|
|
199122
199122
|
this.emit(ev2, ...args);
|
|
@@ -199304,12 +199304,12 @@ var require_socket2 = __commonJS(function(exports) {
|
|
|
199304
199304
|
}
|
|
199305
199305
|
emitWithAck(ev2, ...args) {
|
|
199306
199306
|
const withErr = this.flags.timeout !== undefined;
|
|
199307
|
-
return new Promise((
|
|
199307
|
+
return new Promise((resolve15, reject) => {
|
|
199308
199308
|
args.push((arg1, arg2) => {
|
|
199309
199309
|
if (withErr) {
|
|
199310
|
-
return arg1 ? reject(arg1) :
|
|
199310
|
+
return arg1 ? reject(arg1) : resolve15(arg2);
|
|
199311
199311
|
} else {
|
|
199312
|
-
return
|
|
199312
|
+
return resolve15(arg1);
|
|
199313
199313
|
}
|
|
199314
199314
|
});
|
|
199315
199315
|
this.emit(ev2, ...args);
|
|
@@ -199764,13 +199764,13 @@ var require_namespace = __commonJS(function(exports) {
|
|
|
199764
199764
|
return true;
|
|
199765
199765
|
}
|
|
199766
199766
|
serverSideEmitWithAck(ev2, ...args) {
|
|
199767
|
-
return new Promise((
|
|
199767
|
+
return new Promise((resolve15, reject) => {
|
|
199768
199768
|
args.push((err, responses) => {
|
|
199769
199769
|
if (err) {
|
|
199770
199770
|
err.responses = responses;
|
|
199771
199771
|
return reject(err);
|
|
199772
199772
|
} else {
|
|
199773
|
-
return
|
|
199773
|
+
return resolve15(responses);
|
|
199774
199774
|
}
|
|
199775
199775
|
});
|
|
199776
199776
|
this.serverSideEmit(ev2, ...args);
|
|
@@ -203305,7 +203305,7 @@ var require_cluster_adapter = __commonJS(function(exports) {
|
|
|
203305
203305
|
return localSockets;
|
|
203306
203306
|
}
|
|
203307
203307
|
const requestId = randomId();
|
|
203308
|
-
return new Promise((
|
|
203308
|
+
return new Promise((resolve15, reject) => {
|
|
203309
203309
|
const timeout3 = setTimeout(() => {
|
|
203310
203310
|
const storedRequest2 = this.requests.get(requestId);
|
|
203311
203311
|
if (storedRequest2) {
|
|
@@ -203315,7 +203315,7 @@ var require_cluster_adapter = __commonJS(function(exports) {
|
|
|
203315
203315
|
}, opts.flags.timeout || DEFAULT_TIMEOUT);
|
|
203316
203316
|
const storedRequest = {
|
|
203317
203317
|
type: MessageType.FETCH_SOCKETS,
|
|
203318
|
-
resolve:
|
|
203318
|
+
resolve: resolve15,
|
|
203319
203319
|
timeout: timeout3,
|
|
203320
203320
|
current: 0,
|
|
203321
203321
|
expected: expectedResponseCount,
|
|
@@ -203525,7 +203525,7 @@ var require_cluster_adapter = __commonJS(function(exports) {
|
|
|
203525
203525
|
return localSockets;
|
|
203526
203526
|
}
|
|
203527
203527
|
const requestId = randomId();
|
|
203528
|
-
return new Promise((
|
|
203528
|
+
return new Promise((resolve15, reject) => {
|
|
203529
203529
|
const timeout3 = setTimeout(() => {
|
|
203530
203530
|
const storedRequest2 = this.customRequests.get(requestId);
|
|
203531
203531
|
if (storedRequest2) {
|
|
@@ -203535,7 +203535,7 @@ var require_cluster_adapter = __commonJS(function(exports) {
|
|
|
203535
203535
|
}, opts.flags.timeout || DEFAULT_TIMEOUT);
|
|
203536
203536
|
const storedRequest = {
|
|
203537
203537
|
type: MessageType.FETCH_SOCKETS,
|
|
203538
|
-
resolve:
|
|
203538
|
+
resolve: resolve15,
|
|
203539
203539
|
timeout: timeout3,
|
|
203540
203540
|
missingUids: new Set([...this.nodesMap.keys()]),
|
|
203541
203541
|
responses: localSockets
|
|
@@ -204264,13 +204264,13 @@ var require_dist4 = __commonJS(function(exports, module) {
|
|
|
204264
204264
|
this.engine.close();
|
|
204265
204265
|
(0, uws_1.restoreAdapter)();
|
|
204266
204266
|
if (this.httpServer) {
|
|
204267
|
-
return new Promise((
|
|
204267
|
+
return new Promise((resolve15) => {
|
|
204268
204268
|
this.httpServer.close((err) => {
|
|
204269
204269
|
fn9 && fn9(err);
|
|
204270
204270
|
if (err) {
|
|
204271
204271
|
debug("server was not running");
|
|
204272
204272
|
}
|
|
204273
|
-
|
|
204273
|
+
resolve15();
|
|
204274
204274
|
});
|
|
204275
204275
|
});
|
|
204276
204276
|
} else {
|
|
@@ -213006,7 +213006,7 @@ var require_mime_types4 = __commonJS(function(exports) {
|
|
|
213006
213006
|
* MIT Licensed
|
|
213007
213007
|
*/
|
|
213008
213008
|
var db2 = require_db4();
|
|
213009
|
-
var
|
|
213009
|
+
var extname3 = __require("path").extname;
|
|
213010
213010
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
213011
213011
|
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
213012
213012
|
exports.charset = charset;
|
|
@@ -213061,7 +213061,7 @@ var require_mime_types4 = __commonJS(function(exports) {
|
|
|
213061
213061
|
if (!path18 || typeof path18 !== "string") {
|
|
213062
213062
|
return false;
|
|
213063
213063
|
}
|
|
213064
|
-
var extension2 =
|
|
213064
|
+
var extension2 = extname3("x." + path18).toLowerCase().substr(1);
|
|
213065
213065
|
if (!extension2) {
|
|
213066
213066
|
return false;
|
|
213067
213067
|
}
|
|
@@ -217393,8 +217393,8 @@ var require_mkdirp = __commonJS(function(exports, module) {
|
|
|
217393
217393
|
});
|
|
217394
217394
|
break;
|
|
217395
217395
|
default:
|
|
217396
|
-
xfs.stat(p4, function(er22,
|
|
217397
|
-
if (er22 || !
|
|
217396
|
+
xfs.stat(p4, function(er22, stat4) {
|
|
217397
|
+
if (er22 || !stat4.isDirectory())
|
|
217398
217398
|
cb2(er10, made);
|
|
217399
217399
|
else
|
|
217400
217400
|
cb2(null, made);
|
|
@@ -217425,13 +217425,13 @@ var require_mkdirp = __commonJS(function(exports, module) {
|
|
|
217425
217425
|
sync(p4, opts, made);
|
|
217426
217426
|
break;
|
|
217427
217427
|
default:
|
|
217428
|
-
var
|
|
217428
|
+
var stat4;
|
|
217429
217429
|
try {
|
|
217430
|
-
|
|
217430
|
+
stat4 = xfs.statSync(p4);
|
|
217431
217431
|
} catch (err1) {
|
|
217432
217432
|
throw err0;
|
|
217433
217433
|
}
|
|
217434
|
-
if (!
|
|
217434
|
+
if (!stat4.isDirectory())
|
|
217435
217435
|
throw err0;
|
|
217436
217436
|
break;
|
|
217437
217437
|
}
|
|
@@ -217634,7 +217634,7 @@ var require_buffer_list = __commonJS(function(exports, module) {
|
|
|
217634
217634
|
}
|
|
217635
217635
|
}, {
|
|
217636
217636
|
key: "join",
|
|
217637
|
-
value: function
|
|
217637
|
+
value: function join33(s5) {
|
|
217638
217638
|
if (this.length === 0)
|
|
217639
217639
|
return "";
|
|
217640
217640
|
var p4 = this.head;
|
|
@@ -218932,14 +218932,14 @@ var require_async_iterator = __commonJS(function(exports, module) {
|
|
|
218932
218932
|
};
|
|
218933
218933
|
}
|
|
218934
218934
|
function readAndResolve(iter) {
|
|
218935
|
-
var
|
|
218936
|
-
if (
|
|
218935
|
+
var resolve15 = iter[kLastResolve];
|
|
218936
|
+
if (resolve15 !== null) {
|
|
218937
218937
|
var data = iter[kStream].read();
|
|
218938
218938
|
if (data !== null) {
|
|
218939
218939
|
iter[kLastPromise] = null;
|
|
218940
218940
|
iter[kLastResolve] = null;
|
|
218941
218941
|
iter[kLastReject] = null;
|
|
218942
|
-
|
|
218942
|
+
resolve15(createIterResult(data, false));
|
|
218943
218943
|
}
|
|
218944
218944
|
}
|
|
218945
218945
|
}
|
|
@@ -218947,13 +218947,13 @@ var require_async_iterator = __commonJS(function(exports, module) {
|
|
|
218947
218947
|
process.nextTick(readAndResolve, iter);
|
|
218948
218948
|
}
|
|
218949
218949
|
function wrapForNext(lastPromise, iter) {
|
|
218950
|
-
return function(
|
|
218950
|
+
return function(resolve15, reject) {
|
|
218951
218951
|
lastPromise.then(function() {
|
|
218952
218952
|
if (iter[kEnded]) {
|
|
218953
|
-
|
|
218953
|
+
resolve15(createIterResult(undefined, true));
|
|
218954
218954
|
return;
|
|
218955
218955
|
}
|
|
218956
|
-
iter[kHandlePromise](
|
|
218956
|
+
iter[kHandlePromise](resolve15, reject);
|
|
218957
218957
|
}, reject);
|
|
218958
218958
|
};
|
|
218959
218959
|
}
|
|
@@ -218972,12 +218972,12 @@ var require_async_iterator = __commonJS(function(exports, module) {
|
|
|
218972
218972
|
return Promise.resolve(createIterResult(undefined, true));
|
|
218973
218973
|
}
|
|
218974
218974
|
if (this[kStream].destroyed) {
|
|
218975
|
-
return new Promise(function(
|
|
218975
|
+
return new Promise(function(resolve15, reject) {
|
|
218976
218976
|
process.nextTick(function() {
|
|
218977
218977
|
if (_this[kError]) {
|
|
218978
218978
|
reject(_this[kError]);
|
|
218979
218979
|
} else {
|
|
218980
|
-
|
|
218980
|
+
resolve15(createIterResult(undefined, true));
|
|
218981
218981
|
}
|
|
218982
218982
|
});
|
|
218983
218983
|
});
|
|
@@ -219000,13 +219000,13 @@ var require_async_iterator = __commonJS(function(exports, module) {
|
|
|
219000
219000
|
return this;
|
|
219001
219001
|
}), _defineProperty(_Object$setPrototypeO, "return", function _return() {
|
|
219002
219002
|
var _this2 = this;
|
|
219003
|
-
return new Promise(function(
|
|
219003
|
+
return new Promise(function(resolve15, reject) {
|
|
219004
219004
|
_this2[kStream].destroy(null, function(err) {
|
|
219005
219005
|
if (err) {
|
|
219006
219006
|
reject(err);
|
|
219007
219007
|
return;
|
|
219008
219008
|
}
|
|
219009
|
-
|
|
219009
|
+
resolve15(createIterResult(undefined, true));
|
|
219010
219010
|
});
|
|
219011
219011
|
});
|
|
219012
219012
|
}), _Object$setPrototypeO), AsyncIteratorPrototype);
|
|
@@ -219028,15 +219028,15 @@ var require_async_iterator = __commonJS(function(exports, module) {
|
|
|
219028
219028
|
value: stream._readableState.endEmitted,
|
|
219029
219029
|
writable: true
|
|
219030
219030
|
}), _defineProperty(_Object$create, kHandlePromise, {
|
|
219031
|
-
value: function value(
|
|
219031
|
+
value: function value(resolve15, reject) {
|
|
219032
219032
|
var data = iterator[kStream].read();
|
|
219033
219033
|
if (data) {
|
|
219034
219034
|
iterator[kLastPromise] = null;
|
|
219035
219035
|
iterator[kLastResolve] = null;
|
|
219036
219036
|
iterator[kLastReject] = null;
|
|
219037
|
-
|
|
219037
|
+
resolve15(createIterResult(data, false));
|
|
219038
219038
|
} else {
|
|
219039
|
-
iterator[kLastResolve] =
|
|
219039
|
+
iterator[kLastResolve] = resolve15;
|
|
219040
219040
|
iterator[kLastReject] = reject;
|
|
219041
219041
|
}
|
|
219042
219042
|
},
|
|
@@ -219055,12 +219055,12 @@ var require_async_iterator = __commonJS(function(exports, module) {
|
|
|
219055
219055
|
iterator[kError] = err;
|
|
219056
219056
|
return;
|
|
219057
219057
|
}
|
|
219058
|
-
var
|
|
219059
|
-
if (
|
|
219058
|
+
var resolve15 = iterator[kLastResolve];
|
|
219059
|
+
if (resolve15 !== null) {
|
|
219060
219060
|
iterator[kLastPromise] = null;
|
|
219061
219061
|
iterator[kLastResolve] = null;
|
|
219062
219062
|
iterator[kLastReject] = null;
|
|
219063
|
-
|
|
219063
|
+
resolve15(createIterResult(undefined, true));
|
|
219064
219064
|
}
|
|
219065
219065
|
iterator[kEnded] = true;
|
|
219066
219066
|
});
|
|
@@ -219072,7 +219072,7 @@ var require_async_iterator = __commonJS(function(exports, module) {
|
|
|
219072
219072
|
|
|
219073
219073
|
// ../../node_modules/readable-stream/lib/internal/streams/from.js
|
|
219074
219074
|
var require_from = __commonJS(function(exports, module) {
|
|
219075
|
-
function asyncGeneratorStep(gen,
|
|
219075
|
+
function asyncGeneratorStep(gen, resolve15, reject, _next, _throw, key2, arg) {
|
|
219076
219076
|
try {
|
|
219077
219077
|
var info = gen[key2](arg);
|
|
219078
219078
|
var value = info.value;
|
|
@@ -219081,7 +219081,7 @@ var require_from = __commonJS(function(exports, module) {
|
|
|
219081
219081
|
return;
|
|
219082
219082
|
}
|
|
219083
219083
|
if (info.done) {
|
|
219084
|
-
|
|
219084
|
+
resolve15(value);
|
|
219085
219085
|
} else {
|
|
219086
219086
|
Promise.resolve(value).then(_next, _throw);
|
|
219087
219087
|
}
|
|
@@ -219089,13 +219089,13 @@ var require_from = __commonJS(function(exports, module) {
|
|
|
219089
219089
|
function _asyncToGenerator(fn9) {
|
|
219090
219090
|
return function() {
|
|
219091
219091
|
var self2 = this, args = arguments;
|
|
219092
|
-
return new Promise(function(
|
|
219092
|
+
return new Promise(function(resolve15, reject) {
|
|
219093
219093
|
var gen = fn9.apply(self2, args);
|
|
219094
219094
|
function _next(value) {
|
|
219095
|
-
asyncGeneratorStep(gen,
|
|
219095
|
+
asyncGeneratorStep(gen, resolve15, reject, _next, _throw, "next", value);
|
|
219096
219096
|
}
|
|
219097
219097
|
function _throw(err) {
|
|
219098
|
-
asyncGeneratorStep(gen,
|
|
219098
|
+
asyncGeneratorStep(gen, resolve15, reject, _next, _throw, "throw", err);
|
|
219099
219099
|
}
|
|
219100
219100
|
_next(undefined);
|
|
219101
219101
|
});
|
|
@@ -221222,7 +221222,7 @@ var require_dist5 = __commonJS(function(exports, module) {
|
|
|
221222
221222
|
determineAgent: () => determineAgent
|
|
221223
221223
|
});
|
|
221224
221224
|
module.exports = __toCommonJS2(src_exports);
|
|
221225
|
-
var
|
|
221225
|
+
var import_promises27 = __require("node:fs/promises");
|
|
221226
221226
|
var import_node_fs25 = __require("node:fs");
|
|
221227
221227
|
var DEVIN_LOCAL_PATH = "/opt/.devin";
|
|
221228
221228
|
var CURSOR2 = "cursor";
|
|
@@ -221280,7 +221280,7 @@ var require_dist5 = __commonJS(function(exports, module) {
|
|
|
221280
221280
|
return { isAgent: true, agent: { name: REPLIT } };
|
|
221281
221281
|
}
|
|
221282
221282
|
try {
|
|
221283
|
-
await (0,
|
|
221283
|
+
await (0, import_promises27.access)(DEVIN_LOCAL_PATH, import_node_fs25.constants.F_OK);
|
|
221284
221284
|
return { isAgent: true, agent: { name: DEVIN } };
|
|
221285
221285
|
} catch (error48) {}
|
|
221286
221286
|
return { isAgent: false, agent: undefined };
|
|
@@ -237842,7 +237842,7 @@ function normalizeBase44Env() {
|
|
|
237842
237842
|
loadProjectEnvFiles();
|
|
237843
237843
|
|
|
237844
237844
|
// src/cli/index.ts
|
|
237845
|
-
import { dirname as
|
|
237845
|
+
import { dirname as dirname26, join as join37 } from "node:path";
|
|
237846
237846
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
237847
237847
|
|
|
237848
237848
|
// ../../node_modules/@clack/core/dist/index.mjs
|
|
@@ -238926,7 +238926,7 @@ var {
|
|
|
238926
238926
|
} = import__.default;
|
|
238927
238927
|
|
|
238928
238928
|
// src/cli/commands/agent-skills/pull.ts
|
|
238929
|
-
import { dirname as
|
|
238929
|
+
import { dirname as dirname11, join as join18 } from "node:path";
|
|
238930
238930
|
// ../../node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
238931
238931
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
238932
238932
|
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
@@ -245542,19 +245542,27 @@ var PublishedUrlResponseSchema = exports_external.object({
|
|
|
245542
245542
|
var CreateDeploymentResponseSchema = exports_external.object({
|
|
245543
245543
|
deployment_id: exports_external.string(),
|
|
245544
245544
|
session_id: exports_external.string(),
|
|
245545
|
-
asset_uploads: exports_external.
|
|
245546
|
-
|
|
245547
|
-
|
|
245548
|
-
|
|
245549
|
-
|
|
245550
|
-
|
|
245551
|
-
|
|
245552
|
-
|
|
245553
|
-
|
|
245545
|
+
asset_uploads: exports_external.discriminatedUnion("type", [
|
|
245546
|
+
exports_external.object({
|
|
245547
|
+
type: exports_external.literal("cf"),
|
|
245548
|
+
url: exports_external.string(),
|
|
245549
|
+
jwt: exports_external.string(),
|
|
245550
|
+
buckets: exports_external.array(exports_external.array(exports_external.string()))
|
|
245551
|
+
}),
|
|
245552
|
+
exports_external.object({
|
|
245553
|
+
type: exports_external.literal("s3"),
|
|
245554
|
+
uploads: exports_external.array(exports_external.object({
|
|
245555
|
+
path: exports_external.string(),
|
|
245556
|
+
content_type: exports_external.string(),
|
|
245557
|
+
content_length: exports_external.number(),
|
|
245558
|
+
url: exports_external.string()
|
|
245559
|
+
}))
|
|
245560
|
+
})
|
|
245561
|
+
]).nullable().optional()
|
|
245554
245562
|
}).transform((data) => ({
|
|
245555
245563
|
deploymentId: data.deployment_id,
|
|
245556
245564
|
sessionId: data.session_id,
|
|
245557
|
-
assetUploads: data.asset_uploads == null ? null : {
|
|
245565
|
+
assetUploads: data.asset_uploads == null ? null : data.asset_uploads.type === "cf" ? data.asset_uploads : {
|
|
245558
245566
|
type: "s3",
|
|
245559
245567
|
uploads: data.asset_uploads.uploads.map((upload) => ({
|
|
245560
245568
|
path: upload.path,
|
|
@@ -245564,6 +245572,9 @@ var CreateDeploymentResponseSchema = exports_external.object({
|
|
|
245564
245572
|
}))
|
|
245565
245573
|
}
|
|
245566
245574
|
}));
|
|
245575
|
+
var AssetUploadResponseSchema = exports_external.looseObject({
|
|
245576
|
+
result: exports_external.looseObject({ jwt: exports_external.string().nullable().optional() }).nullable().optional()
|
|
245577
|
+
});
|
|
245567
245578
|
var FinalizeDeploymentResponseSchema = exports_external.object({
|
|
245568
245579
|
deployment_id: exports_external.string()
|
|
245569
245580
|
}).transform((data) => ({
|
|
@@ -247823,10 +247834,8 @@ async function* readLines(body) {
|
|
|
247823
247834
|
try {
|
|
247824
247835
|
while (true) {
|
|
247825
247836
|
const result = await readOrSilence(reader);
|
|
247826
|
-
if (result === "silence")
|
|
247827
|
-
await reader.cancel();
|
|
247837
|
+
if (result === "silence")
|
|
247828
247838
|
return;
|
|
247829
|
-
}
|
|
247830
247839
|
if (result.done || !result.value)
|
|
247831
247840
|
return;
|
|
247832
247841
|
buffered += decoder.decode(result.value, { stream: true });
|
|
@@ -247836,7 +247845,7 @@ async function* readLines(body) {
|
|
|
247836
247845
|
yield* lines;
|
|
247837
247846
|
}
|
|
247838
247847
|
} finally {
|
|
247839
|
-
reader.
|
|
247848
|
+
await reader.cancel().catch(() => {});
|
|
247840
247849
|
}
|
|
247841
247850
|
}
|
|
247842
247851
|
async function* readStreamEvents(body) {
|
|
@@ -247864,17 +247873,16 @@ async function* readStreamEvents(body) {
|
|
|
247864
247873
|
var STREAM_CONNECT_TIMEOUT_MS = 1e4;
|
|
247865
247874
|
var isWorthReconnecting = (status) => status >= 500;
|
|
247866
247875
|
async function openLogStream(filters) {
|
|
247876
|
+
const url2 = buildStreamUrl(filters);
|
|
247877
|
+
const headers = {
|
|
247878
|
+
Accept: "text/event-stream",
|
|
247879
|
+
...await buildStreamAuthHeaders()
|
|
247880
|
+
};
|
|
247867
247881
|
const connectPhase = new AbortController;
|
|
247868
247882
|
const connectTimer = setTimeout(() => connectPhase.abort(), STREAM_CONNECT_TIMEOUT_MS);
|
|
247869
247883
|
let response;
|
|
247870
247884
|
try {
|
|
247871
|
-
response = await fetch(
|
|
247872
|
-
headers: {
|
|
247873
|
-
Accept: "text/event-stream",
|
|
247874
|
-
...await buildStreamAuthHeaders()
|
|
247875
|
-
},
|
|
247876
|
-
signal: connectPhase.signal
|
|
247877
|
-
});
|
|
247885
|
+
response = await fetch(url2, { headers, signal: connectPhase.signal });
|
|
247878
247886
|
} catch {
|
|
247879
247887
|
return { kind: "transient" };
|
|
247880
247888
|
} finally {
|
|
@@ -248062,7 +248070,7 @@ import { join as join12 } from "node:path";
|
|
|
248062
248070
|
// package.json
|
|
248063
248071
|
var package_default = {
|
|
248064
248072
|
name: "base44",
|
|
248065
|
-
version: "0.1.
|
|
248073
|
+
version: "0.1.13",
|
|
248066
248074
|
description: "Base44 CLI - Unified interface for managing Base44 applications",
|
|
248067
248075
|
type: "module",
|
|
248068
248076
|
bin: {
|
|
@@ -248287,7 +248295,7 @@ async function createProjectFilesForExistingProject(options) {
|
|
|
248287
248295
|
};
|
|
248288
248296
|
}
|
|
248289
248297
|
// src/core/project/deploy.ts
|
|
248290
|
-
import { resolve as
|
|
248298
|
+
import { resolve as resolve5 } from "node:path";
|
|
248291
248299
|
|
|
248292
248300
|
// src/core/site/api.ts
|
|
248293
248301
|
async function uploadSite(archivePath) {
|
|
@@ -248311,6 +248319,13 @@ async function uploadSite(archivePath) {
|
|
|
248311
248319
|
}
|
|
248312
248320
|
return result.data;
|
|
248313
248321
|
}
|
|
248322
|
+
var MODULE_CONTENT_TYPES = {
|
|
248323
|
+
esm: "application/javascript+module",
|
|
248324
|
+
sourcemap: "application/source-map",
|
|
248325
|
+
wasm: "application/wasm",
|
|
248326
|
+
text: "text/plain",
|
|
248327
|
+
data: "application/octet-stream"
|
|
248328
|
+
};
|
|
248314
248329
|
async function createDeployment(request) {
|
|
248315
248330
|
const appClient = getAppClient();
|
|
248316
248331
|
let response;
|
|
@@ -248328,12 +248343,19 @@ async function createDeployment(request) {
|
|
|
248328
248343
|
}
|
|
248329
248344
|
return result.data;
|
|
248330
248345
|
}
|
|
248331
|
-
async function
|
|
248346
|
+
async function finalizeDeployment(deploymentId, sessionId, payload) {
|
|
248332
248347
|
const formData = new FormData;
|
|
248333
|
-
|
|
248334
|
-
|
|
248335
|
-
}
|
|
248336
|
-
|
|
248348
|
+
if ("indexHtml" in payload) {
|
|
248349
|
+
formData.append("index.html", new File([payload.indexHtml], "index.html", { type: "text/html" }));
|
|
248350
|
+
} else {
|
|
248351
|
+
formData.append("payload", JSON.stringify({ completion_jwt: payload.completionJwt }));
|
|
248352
|
+
for (const module of payload.modules) {
|
|
248353
|
+
const content = await readFile(module.absolutePath);
|
|
248354
|
+
formData.append(module.name, new File([new Uint8Array(content)], module.name, {
|
|
248355
|
+
type: MODULE_CONTENT_TYPES[module.type]
|
|
248356
|
+
}));
|
|
248357
|
+
}
|
|
248358
|
+
}
|
|
248337
248359
|
const appClient = getAppClient();
|
|
248338
248360
|
let response;
|
|
248339
248361
|
try {
|
|
@@ -248398,11 +248420,15 @@ async function createArchive(pathToArchive, targetArchivePath) {
|
|
|
248398
248420
|
cwd: pathToArchive
|
|
248399
248421
|
}, ["."]);
|
|
248400
248422
|
}
|
|
248423
|
+
// src/core/site/deployment.ts
|
|
248424
|
+
import { readFile as readFile3 } from "node:fs/promises";
|
|
248425
|
+
import { join as join17 } from "node:path";
|
|
248426
|
+
|
|
248401
248427
|
// src/core/site/manifest.ts
|
|
248402
248428
|
import { createHash } from "node:crypto";
|
|
248403
248429
|
import { createReadStream } from "node:fs";
|
|
248404
248430
|
import { stat } from "node:fs/promises";
|
|
248405
|
-
import { basename as basename4, join as join15 } from "node:path";
|
|
248431
|
+
import { basename as basename4, extname, join as join15 } from "node:path";
|
|
248406
248432
|
var MAX_ASSET_COUNT = 1e5;
|
|
248407
248433
|
var ASSETS_IGNORE_FILE = ".assetsignore";
|
|
248408
248434
|
var ALWAYS_IGNORED = new Set([
|
|
@@ -248410,6 +248436,39 @@ var ALWAYS_IGNORED = new Set([
|
|
|
248410
248436
|
"wrangler.json",
|
|
248411
248437
|
".dev.vars"
|
|
248412
248438
|
]);
|
|
248439
|
+
var MIME_TYPES = {
|
|
248440
|
+
".html": "text/html",
|
|
248441
|
+
".htm": "text/html",
|
|
248442
|
+
".css": "text/css",
|
|
248443
|
+
".js": "text/javascript",
|
|
248444
|
+
".mjs": "text/javascript",
|
|
248445
|
+
".json": "application/json",
|
|
248446
|
+
".map": "application/json",
|
|
248447
|
+
".txt": "text/plain",
|
|
248448
|
+
".xml": "application/xml",
|
|
248449
|
+
".svg": "image/svg+xml",
|
|
248450
|
+
".png": "image/png",
|
|
248451
|
+
".jpg": "image/jpeg",
|
|
248452
|
+
".jpeg": "image/jpeg",
|
|
248453
|
+
".gif": "image/gif",
|
|
248454
|
+
".webp": "image/webp",
|
|
248455
|
+
".avif": "image/avif",
|
|
248456
|
+
".ico": "image/x-icon",
|
|
248457
|
+
".woff": "font/woff",
|
|
248458
|
+
".woff2": "font/woff2",
|
|
248459
|
+
".ttf": "font/ttf",
|
|
248460
|
+
".otf": "font/otf",
|
|
248461
|
+
".eot": "application/vnd.ms-fontobject",
|
|
248462
|
+
".mp3": "audio/mpeg",
|
|
248463
|
+
".mp4": "video/mp4",
|
|
248464
|
+
".webm": "video/webm",
|
|
248465
|
+
".pdf": "application/pdf",
|
|
248466
|
+
".wasm": "application/wasm",
|
|
248467
|
+
".webmanifest": "application/manifest+json"
|
|
248468
|
+
};
|
|
248469
|
+
function getAssetContentType(filePath) {
|
|
248470
|
+
return MIME_TYPES[extname(filePath).toLowerCase()] ?? "application/octet-stream";
|
|
248471
|
+
}
|
|
248413
248472
|
async function hashAssetFile(appId, absolutePath) {
|
|
248414
248473
|
const hash2 = createHash("sha256").update(Buffer.from(appId, "utf8"));
|
|
248415
248474
|
for await (const chunk of createReadStream(absolutePath)) {
|
|
@@ -248437,14 +248496,111 @@ async function buildAssetManifest(assetsDir, appId) {
|
|
|
248437
248496
|
const hash2 = await hashAssetFile(appId, absolutePath);
|
|
248438
248497
|
manifest[`/${relativePath}`] = { hash: hash2, size };
|
|
248439
248498
|
if (!filesByHash.has(hash2)) {
|
|
248440
|
-
filesByHash.set(hash2, {
|
|
248499
|
+
filesByHash.set(hash2, {
|
|
248500
|
+
absolutePath,
|
|
248501
|
+
hash: hash2,
|
|
248502
|
+
size,
|
|
248503
|
+
contentType: getAssetContentType(absolutePath)
|
|
248504
|
+
});
|
|
248441
248505
|
}
|
|
248442
248506
|
}
|
|
248443
248507
|
return { manifest, filesByHash };
|
|
248444
248508
|
}
|
|
248445
|
-
|
|
248446
|
-
|
|
248447
|
-
import {
|
|
248509
|
+
|
|
248510
|
+
// src/core/site/modules.ts
|
|
248511
|
+
import { stat as stat2 } from "node:fs/promises";
|
|
248512
|
+
import { relative as relative3, resolve as resolve3, sep } from "node:path";
|
|
248513
|
+
var MAX_TOTAL_MODULE_BYTES = 40 * 1024 * 1024;
|
|
248514
|
+
var MODULE_IGNORE = ["wrangler.json", ".dev.vars"];
|
|
248515
|
+
var RULE_TYPE_TO_MODULE_TYPE = {
|
|
248516
|
+
ESModule: "esm",
|
|
248517
|
+
CompiledWasm: "wasm",
|
|
248518
|
+
Text: "text",
|
|
248519
|
+
Data: "data"
|
|
248520
|
+
};
|
|
248521
|
+
function toPosix(path11) {
|
|
248522
|
+
return path11.split(sep).join("/");
|
|
248523
|
+
}
|
|
248524
|
+
async function collectModules(config9) {
|
|
248525
|
+
const entryPath = resolve3(config9.configDir, config9.main);
|
|
248526
|
+
if (!await pathExists(entryPath)) {
|
|
248527
|
+
throw new InvalidInputError(`Worker entry module does not exist: ${entryPath} (from "main" in ${config9.configPath})`, {
|
|
248528
|
+
hints: [{ message: "Rebuild the project to regenerate the artifact" }]
|
|
248529
|
+
});
|
|
248530
|
+
}
|
|
248531
|
+
const modulesByName = new Map;
|
|
248532
|
+
const entryName = toPosix(relative3(config9.configDir, entryPath));
|
|
248533
|
+
modulesByName.set(entryName, {
|
|
248534
|
+
name: entryName,
|
|
248535
|
+
absolutePath: entryPath,
|
|
248536
|
+
size: 0,
|
|
248537
|
+
type: "esm"
|
|
248538
|
+
});
|
|
248539
|
+
const ignore = [...MODULE_IGNORE];
|
|
248540
|
+
if (config9.assetsDirectory?.startsWith(config9.configDir + sep)) {
|
|
248541
|
+
ignore.push(`${toPosix(relative3(config9.configDir, config9.assetsDirectory))}/**`);
|
|
248542
|
+
}
|
|
248543
|
+
for (const rule of config9.rules) {
|
|
248544
|
+
const type = RULE_TYPE_TO_MODULE_TYPE[rule.type];
|
|
248545
|
+
if (!type) {
|
|
248546
|
+
throw new InvalidInputError(`Unsupported module rule type "${rule.type}" in ${config9.configPath}. Supported: ${Object.keys(RULE_TYPE_TO_MODULE_TYPE).join(", ")}.`);
|
|
248547
|
+
}
|
|
248548
|
+
const matches = await globby(rule.globs, {
|
|
248549
|
+
cwd: config9.configDir,
|
|
248550
|
+
onlyFiles: true,
|
|
248551
|
+
dot: true,
|
|
248552
|
+
ignore
|
|
248553
|
+
});
|
|
248554
|
+
for (const match of matches.sort()) {
|
|
248555
|
+
if (!modulesByName.has(match)) {
|
|
248556
|
+
modulesByName.set(match, {
|
|
248557
|
+
name: match,
|
|
248558
|
+
absolutePath: resolve3(config9.configDir, match),
|
|
248559
|
+
size: 0,
|
|
248560
|
+
type
|
|
248561
|
+
});
|
|
248562
|
+
}
|
|
248563
|
+
}
|
|
248564
|
+
}
|
|
248565
|
+
if (config9.uploadSourceMaps) {
|
|
248566
|
+
const maps = await globby("**/*.map", {
|
|
248567
|
+
cwd: config9.configDir,
|
|
248568
|
+
onlyFiles: true,
|
|
248569
|
+
dot: true,
|
|
248570
|
+
ignore
|
|
248571
|
+
});
|
|
248572
|
+
for (const map2 of maps.sort()) {
|
|
248573
|
+
addSourcemap(modulesByName, config9.configDir, map2);
|
|
248574
|
+
}
|
|
248575
|
+
} else {
|
|
248576
|
+
for (const name2 of [...modulesByName.keys()]) {
|
|
248577
|
+
const mapName = `${name2}.map`;
|
|
248578
|
+
if (await pathExists(resolve3(config9.configDir, mapName))) {
|
|
248579
|
+
addSourcemap(modulesByName, config9.configDir, mapName);
|
|
248580
|
+
}
|
|
248581
|
+
}
|
|
248582
|
+
}
|
|
248583
|
+
const modules = [...modulesByName.values()];
|
|
248584
|
+
let totalBytes = 0;
|
|
248585
|
+
for (const module of modules) {
|
|
248586
|
+
module.size = (await stat2(module.absolutePath)).size;
|
|
248587
|
+
totalBytes += module.size;
|
|
248588
|
+
}
|
|
248589
|
+
if (totalBytes > MAX_TOTAL_MODULE_BYTES) {
|
|
248590
|
+
throw new InvalidInputError(`Worker modules total ${totalBytes} bytes, which exceeds the 40 MB limit for a Base44 deploy.`);
|
|
248591
|
+
}
|
|
248592
|
+
return modules;
|
|
248593
|
+
}
|
|
248594
|
+
function addSourcemap(modulesByName, configDir, name2) {
|
|
248595
|
+
if (modulesByName.has(name2))
|
|
248596
|
+
return;
|
|
248597
|
+
modulesByName.set(name2, {
|
|
248598
|
+
name: name2,
|
|
248599
|
+
absolutePath: resolve3(configDir, name2),
|
|
248600
|
+
size: 0,
|
|
248601
|
+
type: "sourcemap"
|
|
248602
|
+
});
|
|
248603
|
+
}
|
|
248448
248604
|
|
|
248449
248605
|
// src/core/site/upload.ts
|
|
248450
248606
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
@@ -248480,7 +248636,7 @@ async function pMap(iterable, mapper, {
|
|
|
248480
248636
|
const cleanup = () => {
|
|
248481
248637
|
signal?.removeEventListener("abort", signalListener);
|
|
248482
248638
|
};
|
|
248483
|
-
const
|
|
248639
|
+
const resolve4 = (value) => {
|
|
248484
248640
|
resolve_(value);
|
|
248485
248641
|
cleanup();
|
|
248486
248642
|
};
|
|
@@ -248513,7 +248669,7 @@ async function pMap(iterable, mapper, {
|
|
|
248513
248669
|
}
|
|
248514
248670
|
isResolved = true;
|
|
248515
248671
|
if (skippedIndexesMap.size === 0) {
|
|
248516
|
-
|
|
248672
|
+
resolve4(result);
|
|
248517
248673
|
return;
|
|
248518
248674
|
}
|
|
248519
248675
|
const pureResult = [];
|
|
@@ -248523,7 +248679,7 @@ async function pMap(iterable, mapper, {
|
|
|
248523
248679
|
}
|
|
248524
248680
|
pureResult.push(value);
|
|
248525
248681
|
}
|
|
248526
|
-
|
|
248682
|
+
resolve4(pureResult);
|
|
248527
248683
|
}
|
|
248528
248684
|
return;
|
|
248529
248685
|
}
|
|
@@ -248578,6 +248734,85 @@ var DEFAULT_UPLOAD_CONCURRENCY = 3;
|
|
|
248578
248734
|
var MAX_UPLOAD_CONCURRENCY = 50;
|
|
248579
248735
|
var MAX_UPLOAD_ATTEMPTS = 3;
|
|
248580
248736
|
var RETRY_BASE_DELAY_MS = 500;
|
|
248737
|
+
var UPLOAD_RETRY = {
|
|
248738
|
+
limit: MAX_UPLOAD_ATTEMPTS - 1,
|
|
248739
|
+
delay: (attempt) => RETRY_BASE_DELAY_MS * 2 ** (attempt - 1)
|
|
248740
|
+
};
|
|
248741
|
+
async function uploadDeploymentAssets(assetUploads, assets, options = {}) {
|
|
248742
|
+
const { concurrency, progress } = options;
|
|
248743
|
+
progress?.onAssets?.({
|
|
248744
|
+
totalAssets: Object.keys(assets.manifest).length,
|
|
248745
|
+
newAssets: countOwedAssets(assetUploads)
|
|
248746
|
+
});
|
|
248747
|
+
if (!assetUploads) {
|
|
248748
|
+
return null;
|
|
248749
|
+
}
|
|
248750
|
+
const uploadOptions = { concurrency, onProgress: progress?.onAssetUpload };
|
|
248751
|
+
switch (assetUploads.type) {
|
|
248752
|
+
case "cf":
|
|
248753
|
+
return await uploadAssetBuckets(assetUploads, assets.filesByHash, uploadOptions);
|
|
248754
|
+
case "s3":
|
|
248755
|
+
await uploadPresignedAssets(assetUploads.uploads, assets, uploadOptions);
|
|
248756
|
+
return null;
|
|
248757
|
+
}
|
|
248758
|
+
}
|
|
248759
|
+
function countOwedAssets(assetUploads) {
|
|
248760
|
+
if (!assetUploads)
|
|
248761
|
+
return 0;
|
|
248762
|
+
return assetUploads.type === "cf" ? new Set(assetUploads.buckets.flat()).size : assetUploads.uploads.length;
|
|
248763
|
+
}
|
|
248764
|
+
async function uploadAssetBuckets(target, filesByHash, options = {}) {
|
|
248765
|
+
const { concurrency = DEFAULT_UPLOAD_CONCURRENCY, onProgress } = options;
|
|
248766
|
+
const { buckets } = target;
|
|
248767
|
+
const totalFiles = buckets.reduce((sum, bucket) => sum + bucket.length, 0);
|
|
248768
|
+
let uploadedFiles = 0;
|
|
248769
|
+
let completionJwt = null;
|
|
248770
|
+
await pMap(buckets, async (bucket) => {
|
|
248771
|
+
const jwt3 = await uploadAssetBucket(target, bucket, filesByHash);
|
|
248772
|
+
if (jwt3) {
|
|
248773
|
+
completionJwt = jwt3;
|
|
248774
|
+
}
|
|
248775
|
+
uploadedFiles += bucket.length;
|
|
248776
|
+
onProgress?.({ uploadedFiles, totalFiles });
|
|
248777
|
+
}, { concurrency });
|
|
248778
|
+
if (!completionJwt) {
|
|
248779
|
+
throw new ApiError("Asset upload finished but the server did not return a completion token.");
|
|
248780
|
+
}
|
|
248781
|
+
return completionJwt;
|
|
248782
|
+
}
|
|
248783
|
+
async function uploadAssetBucket(target, bucket, filesByHash) {
|
|
248784
|
+
const formData = await buildBucketForm(bucket, filesByHash);
|
|
248785
|
+
let response;
|
|
248786
|
+
try {
|
|
248787
|
+
response = await distribution_default.post(target.url, {
|
|
248788
|
+
searchParams: { base64: "true" },
|
|
248789
|
+
headers: { Authorization: `Bearer ${target.jwt}` },
|
|
248790
|
+
body: formData,
|
|
248791
|
+
timeout: 120000,
|
|
248792
|
+
retry: { ...UPLOAD_RETRY, methods: ["post"] }
|
|
248793
|
+
});
|
|
248794
|
+
} catch (error48) {
|
|
248795
|
+
if (error48 instanceof HTTPError && (error48.response.status === 401 || error48.response.status === 403)) {
|
|
248796
|
+
throw new ApiError("This deploy's upload session has expired — rerun deploy. Already-uploaded assets are skipped on the next attempt.", { statusCode: error48.response.status, cause: error48 });
|
|
248797
|
+
}
|
|
248798
|
+
throw await ApiError.fromHttpError(error48, "uploading assets to Cloudflare");
|
|
248799
|
+
}
|
|
248800
|
+
const parsed = AssetUploadResponseSchema.safeParse(await response.json());
|
|
248801
|
+
const jwt3 = parsed.success ? parsed.data.result?.jwt : null;
|
|
248802
|
+
return jwt3 || null;
|
|
248803
|
+
}
|
|
248804
|
+
async function buildBucketForm(bucket, filesByHash) {
|
|
248805
|
+
const formData = new FormData;
|
|
248806
|
+
for (const hash2 of bucket) {
|
|
248807
|
+
const file2 = filesByHash.get(hash2);
|
|
248808
|
+
if (!file2) {
|
|
248809
|
+
throw new InternalError(`Server requested upload of unknown asset hash: ${hash2}`);
|
|
248810
|
+
}
|
|
248811
|
+
const content = await readFile2(file2.absolutePath);
|
|
248812
|
+
formData.append(hash2, new File([content.toString("base64")], hash2, { type: file2.contentType }));
|
|
248813
|
+
}
|
|
248814
|
+
return formData;
|
|
248815
|
+
}
|
|
248581
248816
|
async function uploadPresignedAssets(uploads, assets, options = {}) {
|
|
248582
248817
|
const { concurrency = DEFAULT_UPLOAD_CONCURRENCY, onProgress } = options;
|
|
248583
248818
|
let uploadedFiles = 0;
|
|
@@ -248599,375 +248834,159 @@ async function uploadPresignedAsset(upload, assets) {
|
|
|
248599
248834
|
body: new Uint8Array(content),
|
|
248600
248835
|
headers: { "Content-Type": upload.contentType },
|
|
248601
248836
|
timeout: 120000,
|
|
248602
|
-
retry:
|
|
248603
|
-
limit: MAX_UPLOAD_ATTEMPTS - 1,
|
|
248604
|
-
delay: (attempt) => RETRY_BASE_DELAY_MS * 2 ** (attempt - 1)
|
|
248605
|
-
}
|
|
248837
|
+
retry: UPLOAD_RETRY
|
|
248606
248838
|
});
|
|
248607
248839
|
} catch (error48) {
|
|
248608
248840
|
throw await ApiError.fromHttpError(error48, "uploading static assets");
|
|
248609
248841
|
}
|
|
248610
248842
|
}
|
|
248611
248843
|
|
|
248612
|
-
// src/core/site/
|
|
248613
|
-
|
|
248614
|
-
|
|
248615
|
-
|
|
248616
|
-
|
|
248617
|
-
|
|
248618
|
-
|
|
248619
|
-
|
|
248620
|
-
|
|
248621
|
-
|
|
248622
|
-
|
|
248623
|
-
|
|
248624
|
-
|
|
248625
|
-
|
|
248626
|
-
|
|
248627
|
-
|
|
248628
|
-
|
|
248629
|
-
|
|
248630
|
-
|
|
248631
|
-
|
|
248632
|
-
|
|
248633
|
-
|
|
248634
|
-
|
|
248635
|
-
|
|
248636
|
-
|
|
248637
|
-
|
|
248638
|
-
function hasResourcesToDeploy(projectData) {
|
|
248639
|
-
const {
|
|
248640
|
-
project,
|
|
248641
|
-
entities,
|
|
248642
|
-
functions,
|
|
248643
|
-
agents,
|
|
248644
|
-
agentSkills,
|
|
248645
|
-
connectors,
|
|
248646
|
-
authConfig
|
|
248647
|
-
} = projectData;
|
|
248648
|
-
const hasSite = Boolean(project.site?.outputDirectory);
|
|
248649
|
-
const hasEntities = entities.length > 0;
|
|
248650
|
-
const hasFunctions = functions.length > 0;
|
|
248651
|
-
const hasAgents = agents.length > 0;
|
|
248652
|
-
const hasAgentSkills = agentSkills.length > 0;
|
|
248653
|
-
const hasConnectors = connectors.length > 0;
|
|
248654
|
-
const hasAuthConfig = authConfig.length > 0;
|
|
248655
|
-
const hasVisibility = Boolean(project.visibility);
|
|
248656
|
-
return hasEntities || hasFunctions || hasAgents || hasAgentSkills || hasConnectors || hasAuthConfig || hasVisibility || hasSite;
|
|
248844
|
+
// src/core/site/wrangler-config.ts
|
|
248845
|
+
import { dirname as dirname10, join as join16, resolve as resolve4 } from "node:path";
|
|
248846
|
+
var WRANGLER_REDIRECT_PATH = join16(".wrangler", "deploy", "config.json");
|
|
248847
|
+
var RedirectConfigSchema = exports_external.looseObject({
|
|
248848
|
+
configPath: exports_external.string().min(1)
|
|
248849
|
+
});
|
|
248850
|
+
var WranglerConfigSchema = exports_external.looseObject({
|
|
248851
|
+
main: exports_external.string().min(1, "wrangler config is missing a 'main' entry module"),
|
|
248852
|
+
no_bundle: exports_external.boolean().optional(),
|
|
248853
|
+
rules: exports_external.array(exports_external.looseObject({ type: exports_external.string(), globs: exports_external.array(exports_external.string()) })).optional(),
|
|
248854
|
+
assets: exports_external.looseObject({
|
|
248855
|
+
directory: exports_external.string().optional(),
|
|
248856
|
+
html_handling: exports_external.string().optional(),
|
|
248857
|
+
not_found_handling: exports_external.string().optional(),
|
|
248858
|
+
run_worker_first: exports_external.union([exports_external.boolean(), exports_external.array(exports_external.string())]).optional(),
|
|
248859
|
+
headers: exports_external.string().optional(),
|
|
248860
|
+
redirects: exports_external.string().optional()
|
|
248861
|
+
}).optional(),
|
|
248862
|
+
compatibility_date: exports_external.string().optional(),
|
|
248863
|
+
compatibility_flags: exports_external.array(exports_external.string()).optional(),
|
|
248864
|
+
vars: exports_external.record(exports_external.string(), exports_external.unknown()).optional(),
|
|
248865
|
+
upload_source_maps: exports_external.boolean().optional()
|
|
248866
|
+
});
|
|
248867
|
+
async function detectFullStackArtifact(projectRoot) {
|
|
248868
|
+
const redirectPath = join16(projectRoot, WRANGLER_REDIRECT_PATH);
|
|
248869
|
+
return await pathExists(redirectPath) ? redirectPath : null;
|
|
248657
248870
|
}
|
|
248658
|
-
async function
|
|
248659
|
-
const
|
|
248660
|
-
|
|
248661
|
-
|
|
248662
|
-
|
|
248663
|
-
|
|
248664
|
-
agentSkills,
|
|
248665
|
-
connectors,
|
|
248666
|
-
authConfig
|
|
248667
|
-
} = projectData;
|
|
248668
|
-
await setAppVisibility(project.visibility);
|
|
248669
|
-
if (project.visibility) {
|
|
248670
|
-
options?.onVisibilitySet?.(project.visibility);
|
|
248671
|
-
}
|
|
248672
|
-
await entityResource.push(entities);
|
|
248673
|
-
await deployFunctionsSequentially(functions, {
|
|
248674
|
-
onStart: options?.onFunctionStart,
|
|
248675
|
-
onResult: options?.onFunctionResult
|
|
248676
|
-
});
|
|
248677
|
-
await agentSkillResource.push(agentSkills);
|
|
248678
|
-
await agentResource.push(agents);
|
|
248679
|
-
await authConfigResource.push(authConfig);
|
|
248680
|
-
const skipConnectorSync = connectors.length === 0 && hasWorkspaceApiKeyAuth();
|
|
248681
|
-
const connectorResults = skipConnectorSync ? [] : (await pushConnectors(connectors)).results;
|
|
248682
|
-
if (project.site?.outputDirectory) {
|
|
248683
|
-
const outputDir = resolve3(project.root, project.site.outputDirectory);
|
|
248684
|
-
const { appUrl } = await deploySite(outputDir);
|
|
248685
|
-
return { appUrl, connectorResults };
|
|
248871
|
+
async function resolveWranglerConfig(redirectPath) {
|
|
248872
|
+
const configPath = await resolveRedirectedConfigPath(redirectPath);
|
|
248873
|
+
const parsed = await readJsonFile(configPath);
|
|
248874
|
+
const result = WranglerConfigSchema.safeParse(parsed);
|
|
248875
|
+
if (!result.success) {
|
|
248876
|
+
throw new ConfigInvalidError(`Invalid wrangler config: ${exports_external.prettifyError(result.error)}`, configPath);
|
|
248686
248877
|
}
|
|
248687
|
-
|
|
248688
|
-
|
|
248689
|
-
|
|
248690
|
-
var retriedRequests = new WeakSet;
|
|
248691
|
-
async function captureRequestBody(request, options) {
|
|
248692
|
-
if (request.body == null) {
|
|
248693
|
-
return;
|
|
248878
|
+
const config9 = result.data;
|
|
248879
|
+
if (config9.no_bundle !== true) {
|
|
248880
|
+
throw new InvalidInputError("This framework's output requires bundling; not yet supported. Base44 only deploys pre-bundled Workers output (no_bundle: true).");
|
|
248694
248881
|
}
|
|
248695
|
-
|
|
248696
|
-
|
|
248697
|
-
|
|
248698
|
-
|
|
248699
|
-
|
|
248882
|
+
const configDir = dirname10(configPath);
|
|
248883
|
+
const assetsDirectory = config9.assets?.directory ? resolve4(configDir, config9.assets.directory) : null;
|
|
248884
|
+
return {
|
|
248885
|
+
configPath,
|
|
248886
|
+
configDir,
|
|
248887
|
+
main: config9.main,
|
|
248888
|
+
assetsDirectory,
|
|
248889
|
+
assetsConfig: config9.assets ? toResolvedAssetsConfig(config9.assets) : null,
|
|
248890
|
+
compatibilityDate: config9.compatibility_date ?? null,
|
|
248891
|
+
compatibilityFlags: config9.compatibility_flags ?? [],
|
|
248892
|
+
rules: (config9.rules ?? []).map((rule) => ({
|
|
248893
|
+
type: rule.type,
|
|
248894
|
+
globs: rule.globs
|
|
248895
|
+
})),
|
|
248896
|
+
uploadSourceMaps: config9.upload_source_maps ?? false
|
|
248897
|
+
};
|
|
248700
248898
|
}
|
|
248701
|
-
async function
|
|
248702
|
-
|
|
248703
|
-
|
|
248704
|
-
|
|
248705
|
-
|
|
248706
|
-
return;
|
|
248707
|
-
}
|
|
248708
|
-
if (retriedRequests.has(request)) {
|
|
248709
|
-
return;
|
|
248899
|
+
async function resolveRedirectedConfigPath(redirectPath) {
|
|
248900
|
+
const parsed = await readJsonFile(redirectPath);
|
|
248901
|
+
const result = RedirectConfigSchema.safeParse(parsed);
|
|
248902
|
+
if (!result.success) {
|
|
248903
|
+
throw new ConfigInvalidError(`Invalid deploy redirect file: ${exports_external.prettifyError(result.error)}`, redirectPath);
|
|
248710
248904
|
}
|
|
248711
|
-
const
|
|
248712
|
-
if (!
|
|
248713
|
-
|
|
248905
|
+
const configPath = resolve4(dirname10(redirectPath), result.data.configPath);
|
|
248906
|
+
if (!await pathExists(configPath)) {
|
|
248907
|
+
throw new ConfigInvalidError(`Wrangler config referenced by ${redirectPath} does not exist: ${configPath}`, redirectPath, {
|
|
248908
|
+
hints: [{ message: "Rebuild the project to regenerate the artifact" }]
|
|
248909
|
+
});
|
|
248714
248910
|
}
|
|
248715
|
-
|
|
248716
|
-
const requestId = request.headers.get("X-Request-ID");
|
|
248717
|
-
return distribution_default(request.clone(), {
|
|
248718
|
-
headers: {
|
|
248719
|
-
...requestId && { "X-Request-ID": requestId },
|
|
248720
|
-
Authorization: `Bearer ${newAccessToken}`
|
|
248721
|
-
}
|
|
248722
|
-
});
|
|
248911
|
+
return configPath;
|
|
248723
248912
|
}
|
|
248724
|
-
|
|
248725
|
-
|
|
248726
|
-
|
|
248727
|
-
|
|
248728
|
-
|
|
248729
|
-
|
|
248730
|
-
|
|
248731
|
-
|
|
248732
|
-
request.headers.set("X-Request-ID", randomUUID2());
|
|
248733
|
-
},
|
|
248734
|
-
captureRequestBody,
|
|
248735
|
-
async (request) => {
|
|
248736
|
-
const workspaceApiKey = getWorkspaceApiKeyFromEnv();
|
|
248737
|
-
if (workspaceApiKey && isWorkspaceApiKey(workspaceApiKey)) {
|
|
248738
|
-
request.headers.set("api_key", workspaceApiKey);
|
|
248739
|
-
return;
|
|
248740
|
-
}
|
|
248741
|
-
try {
|
|
248742
|
-
const auth = await readAuth();
|
|
248743
|
-
if (isTokenExpired(auth)) {
|
|
248744
|
-
const newAccessToken = await refreshAndSaveTokens();
|
|
248745
|
-
if (newAccessToken) {
|
|
248746
|
-
request.headers.set("Authorization", `Bearer ${newAccessToken}`);
|
|
248747
|
-
return;
|
|
248748
|
-
}
|
|
248749
|
-
}
|
|
248750
|
-
request.headers.set("Authorization", `Bearer ${auth.accessToken}`);
|
|
248751
|
-
} catch {}
|
|
248752
|
-
}
|
|
248753
|
-
],
|
|
248754
|
-
afterResponse: [handleUnauthorized]
|
|
248755
|
-
}
|
|
248756
|
-
});
|
|
248757
|
-
function getAppClient() {
|
|
248758
|
-
const { id } = getAppContext();
|
|
248759
|
-
return base44Client.extend({
|
|
248760
|
-
prefixUrl: new URL(`/api/apps/${id}/`, getBase44ApiUrl()).href
|
|
248761
|
-
});
|
|
248913
|
+
function toResolvedAssetsConfig(assets) {
|
|
248914
|
+
return {
|
|
248915
|
+
htmlHandling: assets.html_handling,
|
|
248916
|
+
notFoundHandling: assets.not_found_handling,
|
|
248917
|
+
runWorkerFirst: assets.run_worker_first,
|
|
248918
|
+
headers: assets.headers,
|
|
248919
|
+
redirects: assets.redirects
|
|
248920
|
+
};
|
|
248762
248921
|
}
|
|
248763
|
-
|
|
248764
|
-
|
|
248765
|
-
|
|
248766
|
-
|
|
248922
|
+
|
|
248923
|
+
// src/core/site/deployment.ts
|
|
248924
|
+
var NO_ASSETS = { manifest: {}, filesByHash: new Map };
|
|
248925
|
+
var DEPLOYMENTS_API_ENV = "BASE44_DEPLOYMENTS_API";
|
|
248926
|
+
function deploymentsApiEnabled(env2 = process.env) {
|
|
248927
|
+
const value = env2[DEPLOYMENTS_API_ENV];
|
|
248928
|
+
return value === "1" || value === "true";
|
|
248767
248929
|
}
|
|
248768
|
-
|
|
248769
|
-
|
|
248770
|
-
|
|
248771
|
-
|
|
248772
|
-
|
|
248773
|
-
|
|
248774
|
-
|
|
248775
|
-
|
|
248776
|
-
|
|
248777
|
-
|
|
248778
|
-
request.headers.set("X-Request-ID", randomUUID3());
|
|
248779
|
-
}
|
|
248780
|
-
]
|
|
248781
|
-
}
|
|
248782
|
-
});
|
|
248783
|
-
// src/core/auth/api.ts
|
|
248784
|
-
async function generateDeviceCode() {
|
|
248785
|
-
const response = await oauthClient.post("oauth/device/code", {
|
|
248786
|
-
json: {
|
|
248787
|
-
client_id: AUTH_CLIENT_ID,
|
|
248788
|
-
scope: "apps:read apps:write sandbox:write"
|
|
248789
|
-
},
|
|
248790
|
-
throwHttpErrors: false
|
|
248930
|
+
async function deployToDeployments(options) {
|
|
248931
|
+
const { projectRoot, outputDir, gitHash, concurrency, progress } = options;
|
|
248932
|
+
const worker = await resolveWorkerBuild(projectRoot, progress);
|
|
248933
|
+
const assetsDir = worker ? worker.assetsDir : outputDir;
|
|
248934
|
+
const assets = assetsDir ? await buildAssetManifest(assetsDir, getAppContext().id) : NO_ASSETS;
|
|
248935
|
+
const completion = worker ? { modules: worker.modules } : { indexHtml: await readIndexHtml(assetsDir, assets) };
|
|
248936
|
+
const created = await createDeployment({
|
|
248937
|
+
git_hash: gitHash,
|
|
248938
|
+
config: worker?.config,
|
|
248939
|
+
asset_manifest: assets.manifest
|
|
248791
248940
|
});
|
|
248792
|
-
|
|
248793
|
-
|
|
248941
|
+
const completionJwt = await uploadDeploymentAssets(created.assetUploads, assets, { concurrency, progress });
|
|
248942
|
+
if ("modules" in completion) {
|
|
248943
|
+
progress?.onWorker?.({ moduleCount: completion.modules.length });
|
|
248794
248944
|
}
|
|
248795
|
-
const
|
|
248796
|
-
|
|
248797
|
-
throw new SchemaValidationError("Invalid device code response from server", result.error);
|
|
248798
|
-
}
|
|
248799
|
-
return result.data;
|
|
248945
|
+
const finalized = await finalizeDeployment(created.deploymentId, created.sessionId, "modules" in completion ? { ...completion, completionJwt } : completion);
|
|
248946
|
+
return { deploymentId: finalized.deploymentId, gitHash };
|
|
248800
248947
|
}
|
|
248801
|
-
async function
|
|
248802
|
-
const
|
|
248803
|
-
|
|
248804
|
-
|
|
248805
|
-
searchParams.set("client_id", AUTH_CLIENT_ID);
|
|
248806
|
-
const response = await oauthClient.post("oauth/token", {
|
|
248807
|
-
body: searchParams.toString(),
|
|
248808
|
-
headers: {
|
|
248809
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
248810
|
-
},
|
|
248811
|
-
throwHttpErrors: false
|
|
248812
|
-
});
|
|
248813
|
-
const json2 = await response.json();
|
|
248814
|
-
if (!response.ok) {
|
|
248815
|
-
const errorResult = OAuthErrorSchema.safeParse(json2);
|
|
248816
|
-
if (!errorResult.success) {
|
|
248817
|
-
throw new SchemaValidationError("Token request failed", errorResult.error);
|
|
248818
|
-
}
|
|
248819
|
-
const { error: error48, error_description } = errorResult.data;
|
|
248820
|
-
if (error48 === "authorization_pending" || error48 === "slow_down") {
|
|
248821
|
-
return null;
|
|
248822
|
-
}
|
|
248823
|
-
throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
|
|
248824
|
-
statusCode: response.status
|
|
248825
|
-
});
|
|
248826
|
-
}
|
|
248827
|
-
const result = TokenResponseSchema.safeParse(json2);
|
|
248828
|
-
if (!result.success) {
|
|
248829
|
-
throw new SchemaValidationError("Invalid token response from server", result.error);
|
|
248948
|
+
async function resolveWorkerBuild(projectRoot, progress) {
|
|
248949
|
+
const redirectPath = await detectFullStackArtifact(projectRoot);
|
|
248950
|
+
if (!redirectPath) {
|
|
248951
|
+
return null;
|
|
248830
248952
|
}
|
|
248831
|
-
|
|
248832
|
-
|
|
248833
|
-
|
|
248834
|
-
|
|
248835
|
-
|
|
248836
|
-
|
|
248837
|
-
|
|
248838
|
-
|
|
248839
|
-
body: searchParams.toString(),
|
|
248840
|
-
headers: {
|
|
248841
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
248953
|
+
const config9 = await resolveWranglerConfig(redirectPath);
|
|
248954
|
+
const assetsDir = config9.assetsDirectory && await pathExists(config9.assetsDirectory) ? config9.assetsDirectory : null;
|
|
248955
|
+
return {
|
|
248956
|
+
config: {
|
|
248957
|
+
main: config9.main,
|
|
248958
|
+
compatibility_date: config9.compatibilityDate,
|
|
248959
|
+
compatibility_flags: config9.compatibilityFlags,
|
|
248960
|
+
assets: buildAssetsConfig(config9.assetsConfig, progress)
|
|
248842
248961
|
},
|
|
248843
|
-
|
|
248844
|
-
|
|
248845
|
-
|
|
248846
|
-
if (!response.ok) {
|
|
248847
|
-
const errorResult = OAuthErrorSchema.safeParse(json2);
|
|
248848
|
-
if (!errorResult.success) {
|
|
248849
|
-
throw new ApiError(`Token refresh failed: ${response.statusText}`, {
|
|
248850
|
-
statusCode: response.status
|
|
248851
|
-
});
|
|
248852
|
-
}
|
|
248853
|
-
const { error: error48, error_description } = errorResult.data;
|
|
248854
|
-
throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
|
|
248855
|
-
statusCode: response.status
|
|
248856
|
-
});
|
|
248857
|
-
}
|
|
248858
|
-
const result = TokenResponseSchema.safeParse(json2);
|
|
248859
|
-
if (!result.success) {
|
|
248860
|
-
throw new SchemaValidationError("Invalid token response from server", result.error);
|
|
248861
|
-
}
|
|
248862
|
-
return result.data;
|
|
248962
|
+
modules: await collectModules(config9),
|
|
248963
|
+
assetsDir
|
|
248964
|
+
};
|
|
248863
248965
|
}
|
|
248864
|
-
async function
|
|
248865
|
-
|
|
248866
|
-
|
|
248867
|
-
});
|
|
248868
|
-
if (!response.ok) {
|
|
248869
|
-
throw new ApiError(`Failed to fetch user info: ${response.status}`, {
|
|
248870
|
-
statusCode: response.status
|
|
248871
|
-
});
|
|
248966
|
+
async function readIndexHtml(assetsDir, assets) {
|
|
248967
|
+
if (!assetsDir || !assets.manifest["/index.html"]) {
|
|
248968
|
+
throw new InvalidInputError(`No index.html found in "${assetsDir ?? "the site output directory"}" — a static site needs one at the output directory root.`);
|
|
248872
248969
|
}
|
|
248873
|
-
|
|
248874
|
-
if (!result.success) {
|
|
248875
|
-
throw new SchemaValidationError("Invalid UserInfo response from server", result.error);
|
|
248876
|
-
}
|
|
248877
|
-
return result.data;
|
|
248970
|
+
return new Uint8Array(await readFile3(join17(assetsDir, "index.html")));
|
|
248878
248971
|
}
|
|
248879
|
-
|
|
248880
|
-
|
|
248881
|
-
|
|
248882
|
-
|
|
248883
|
-
|
|
248884
|
-
successMessage: "Device code generated",
|
|
248885
|
-
errorMessage: "Failed to generate device code"
|
|
248886
|
-
});
|
|
248887
|
-
log.info(`Verification code: ${theme.styles.bold(deviceCodeResponse.userCode)}` + `
|
|
248888
|
-
Please confirm this code at: ${deviceCodeResponse.verificationUri}`);
|
|
248889
|
-
return deviceCodeResponse;
|
|
248890
|
-
}
|
|
248891
|
-
async function waitForAuthentication(deviceCode, expiresIn, interval, runTask) {
|
|
248892
|
-
let tokenResponse;
|
|
248893
|
-
try {
|
|
248894
|
-
await runTask("Waiting for authentication...", async () => {
|
|
248895
|
-
await pWaitFor(async () => {
|
|
248896
|
-
const result = await getTokenFromDeviceCode(deviceCode);
|
|
248897
|
-
if (result !== null) {
|
|
248898
|
-
tokenResponse = result;
|
|
248899
|
-
return true;
|
|
248900
|
-
}
|
|
248901
|
-
return false;
|
|
248902
|
-
}, {
|
|
248903
|
-
interval: interval * 1000,
|
|
248904
|
-
timeout: expiresIn * 1000
|
|
248905
|
-
});
|
|
248906
|
-
}, {
|
|
248907
|
-
successMessage: "Authentication completed!",
|
|
248908
|
-
errorMessage: "Authentication failed"
|
|
248909
|
-
});
|
|
248910
|
-
} catch (error48) {
|
|
248911
|
-
if (error48 instanceof Error && error48.message.includes("timed out")) {
|
|
248912
|
-
throw new AuthExpiredError("Authentication timed out. Please try again.");
|
|
248913
|
-
}
|
|
248914
|
-
throw error48;
|
|
248972
|
+
function buildAssetsConfig(assetsConfig, progress) {
|
|
248973
|
+
if (!assetsConfig)
|
|
248974
|
+
return null;
|
|
248975
|
+
if (assetsConfig.headers || assetsConfig.redirects) {
|
|
248976
|
+
progress?.onWarning?.("_headers/_redirects files are not supported yet and were ignored for this deploy.");
|
|
248915
248977
|
}
|
|
248916
|
-
|
|
248917
|
-
|
|
248978
|
+
let runWorkerFirst;
|
|
248979
|
+
if (Array.isArray(assetsConfig.runWorkerFirst)) {
|
|
248980
|
+
progress?.onWarning?.("'run_worker_first' route patterns are not supported yet and were ignored for this deploy.");
|
|
248981
|
+
} else {
|
|
248982
|
+
runWorkerFirst = assetsConfig.runWorkerFirst;
|
|
248918
248983
|
}
|
|
248919
|
-
return tokenResponse;
|
|
248920
|
-
}
|
|
248921
|
-
async function saveAuthData(response, userInfo) {
|
|
248922
|
-
const expiresAt = Date.now() + response.expiresIn * 1000;
|
|
248923
|
-
await writeAuth({
|
|
248924
|
-
accessToken: response.accessToken,
|
|
248925
|
-
refreshToken: response.refreshToken,
|
|
248926
|
-
expiresAt,
|
|
248927
|
-
email: userInfo.email,
|
|
248928
|
-
name: userInfo.name
|
|
248929
|
-
});
|
|
248930
|
-
}
|
|
248931
|
-
async function login({
|
|
248932
|
-
log,
|
|
248933
|
-
runTask
|
|
248934
|
-
}) {
|
|
248935
|
-
const deviceCodeResponse = await generateAndDisplayDeviceCode(log, runTask);
|
|
248936
|
-
const token = await waitForAuthentication(deviceCodeResponse.deviceCode, deviceCodeResponse.expiresIn, deviceCodeResponse.interval, runTask);
|
|
248937
|
-
const userInfo = await getUserInfo(token.accessToken);
|
|
248938
|
-
await saveAuthData(token, userInfo);
|
|
248939
248984
|
return {
|
|
248940
|
-
|
|
248985
|
+
html_handling: assetsConfig.htmlHandling,
|
|
248986
|
+
not_found_handling: assetsConfig.notFoundHandling,
|
|
248987
|
+
run_worker_first: runWorkerFirst
|
|
248941
248988
|
};
|
|
248942
248989
|
}
|
|
248943
|
-
|
|
248944
|
-
// src/cli/utils/command/middleware.ts
|
|
248945
|
-
async function ensureAuth(ctx) {
|
|
248946
|
-
if (hasWorkspaceApiKeyAuth()) {
|
|
248947
|
-
ctx.errorReporter.setContext({
|
|
248948
|
-
user: { email: "workspace-api-key", name: "Workspace API key" }
|
|
248949
|
-
});
|
|
248950
|
-
return;
|
|
248951
|
-
}
|
|
248952
|
-
await seedAuthFromEnv();
|
|
248953
|
-
const loggedIn = await isLoggedIn();
|
|
248954
|
-
if (!loggedIn) {
|
|
248955
|
-
ctx.log.info("You need to login first to continue.");
|
|
248956
|
-
await login(ctx);
|
|
248957
|
-
}
|
|
248958
|
-
try {
|
|
248959
|
-
const userInfo = await readAuth();
|
|
248960
|
-
ctx.errorReporter.setContext({
|
|
248961
|
-
user: { email: userInfo.email, name: userInfo.name }
|
|
248962
|
-
});
|
|
248963
|
-
} catch {}
|
|
248964
|
-
}
|
|
248965
|
-
async function ensureAppContext(ctx, options = {}) {
|
|
248966
|
-
const appContext = await initAppContext(options);
|
|
248967
|
-
ctx.app = appContext;
|
|
248968
|
-
ctx.errorReporter.setContext({ appId: appContext.id });
|
|
248969
|
-
}
|
|
248970
|
-
|
|
248971
248990
|
// ../../node_modules/is-plain-obj/index.js
|
|
248972
248991
|
function isPlainObject2(value) {
|
|
248973
248992
|
if (typeof value !== "object" || value === null) {
|
|
@@ -249065,13 +249084,13 @@ var getJoinLength = (uint8Arrays) => {
|
|
|
249065
249084
|
var isTemplateString = (templates) => Array.isArray(templates) && Array.isArray(templates.raw);
|
|
249066
249085
|
var parseTemplates = (templates, expressions) => {
|
|
249067
249086
|
let tokens = [];
|
|
249068
|
-
for (const [index,
|
|
249087
|
+
for (const [index, template] of templates.entries()) {
|
|
249069
249088
|
tokens = parseTemplate({
|
|
249070
249089
|
templates,
|
|
249071
249090
|
expressions,
|
|
249072
249091
|
tokens,
|
|
249073
249092
|
index,
|
|
249074
|
-
template
|
|
249093
|
+
template
|
|
249075
249094
|
});
|
|
249076
249095
|
}
|
|
249077
249096
|
if (tokens.length === 0) {
|
|
@@ -249080,11 +249099,11 @@ var parseTemplates = (templates, expressions) => {
|
|
|
249080
249099
|
const [file2, ...commandArguments] = tokens;
|
|
249081
249100
|
return [file2, commandArguments, {}];
|
|
249082
249101
|
};
|
|
249083
|
-
var parseTemplate = ({ templates, expressions, tokens, index, template
|
|
249084
|
-
if (
|
|
249102
|
+
var parseTemplate = ({ templates, expressions, tokens, index, template }) => {
|
|
249103
|
+
if (template === undefined) {
|
|
249085
249104
|
throw new TypeError(`Invalid backslash sequence: ${templates.raw[index]}`);
|
|
249086
249105
|
}
|
|
249087
|
-
const { nextTokens, leadingWhitespaces, trailingWhitespaces } = splitByWhitespaces(
|
|
249106
|
+
const { nextTokens, leadingWhitespaces, trailingWhitespaces } = splitByWhitespaces(template, templates.raw[index]);
|
|
249088
249107
|
const newTokens = concatTokens(tokens, nextTokens, leadingWhitespaces);
|
|
249089
249108
|
if (index === expressions.length) {
|
|
249090
249109
|
return newTokens;
|
|
@@ -249093,18 +249112,18 @@ var parseTemplate = ({ templates, expressions, tokens, index, template: template
|
|
|
249093
249112
|
const expressionTokens = Array.isArray(expression) ? expression.map((expression2) => parseExpression(expression2)) : [parseExpression(expression)];
|
|
249094
249113
|
return concatTokens(newTokens, expressionTokens, trailingWhitespaces);
|
|
249095
249114
|
};
|
|
249096
|
-
var splitByWhitespaces = (
|
|
249115
|
+
var splitByWhitespaces = (template, rawTemplate) => {
|
|
249097
249116
|
if (rawTemplate.length === 0) {
|
|
249098
249117
|
return { nextTokens: [], leadingWhitespaces: false, trailingWhitespaces: false };
|
|
249099
249118
|
}
|
|
249100
249119
|
const nextTokens = [];
|
|
249101
249120
|
let templateStart = 0;
|
|
249102
249121
|
const leadingWhitespaces = DELIMITERS.has(rawTemplate[0]);
|
|
249103
|
-
for (let templateIndex = 0, rawIndex = 0;templateIndex <
|
|
249122
|
+
for (let templateIndex = 0, rawIndex = 0;templateIndex < template.length; templateIndex += 1, rawIndex += 1) {
|
|
249104
249123
|
const rawCharacter = rawTemplate[rawIndex];
|
|
249105
249124
|
if (DELIMITERS.has(rawCharacter)) {
|
|
249106
249125
|
if (templateStart !== templateIndex) {
|
|
249107
|
-
nextTokens.push(
|
|
249126
|
+
nextTokens.push(template.slice(templateStart, templateIndex));
|
|
249108
249127
|
}
|
|
249109
249128
|
templateStart = templateIndex + 1;
|
|
249110
249129
|
} else if (rawCharacter === "\\") {
|
|
@@ -249120,9 +249139,9 @@ var splitByWhitespaces = (template2, rawTemplate) => {
|
|
|
249120
249139
|
}
|
|
249121
249140
|
}
|
|
249122
249141
|
}
|
|
249123
|
-
const trailingWhitespaces = templateStart ===
|
|
249142
|
+
const trailingWhitespaces = templateStart === template.length;
|
|
249124
249143
|
if (!trailingWhitespaces) {
|
|
249125
|
-
nextTokens.push(
|
|
249144
|
+
nextTokens.push(template.slice(templateStart));
|
|
249126
249145
|
}
|
|
249127
249146
|
return { nextTokens, leadingWhitespaces, trailingWhitespaces };
|
|
249128
249147
|
};
|
|
@@ -250516,8 +250535,8 @@ var disconnect = (anyProcess) => {
|
|
|
250516
250535
|
// ../../node_modules/execa/lib/utils/deferred.js
|
|
250517
250536
|
var createDeferred = () => {
|
|
250518
250537
|
const methods = {};
|
|
250519
|
-
const promise2 = new Promise((
|
|
250520
|
-
Object.assign(methods, { resolve:
|
|
250538
|
+
const promise2 = new Promise((resolve5, reject) => {
|
|
250539
|
+
Object.assign(methods, { resolve: resolve5, reject });
|
|
250521
250540
|
});
|
|
250522
250541
|
return Object.assign(promise2, methods);
|
|
250523
250542
|
};
|
|
@@ -254881,11 +254900,11 @@ var addConcurrentStream = (concurrentStreams, stream, waitName) => {
|
|
|
254881
254900
|
const promises = weakMap.get(stream);
|
|
254882
254901
|
const promise2 = createDeferred();
|
|
254883
254902
|
promises.push(promise2);
|
|
254884
|
-
const
|
|
254885
|
-
return { resolve:
|
|
254903
|
+
const resolve5 = promise2.resolve.bind(promise2);
|
|
254904
|
+
return { resolve: resolve5, promises };
|
|
254886
254905
|
};
|
|
254887
|
-
var waitForConcurrentStreams = async ({ resolve:
|
|
254888
|
-
|
|
254906
|
+
var waitForConcurrentStreams = async ({ resolve: resolve5, promises }, subprocess) => {
|
|
254907
|
+
resolve5();
|
|
254889
254908
|
const [isSubprocessExit] = await Promise.race([
|
|
254890
254909
|
Promise.allSettled([true, subprocess]),
|
|
254891
254910
|
Promise.all([false, ...promises])
|
|
@@ -255464,6 +255483,370 @@ var {
|
|
|
255464
255483
|
getCancelSignal: getCancelSignal2
|
|
255465
255484
|
} = getIpcExport();
|
|
255466
255485
|
|
|
255486
|
+
// src/core/utils/git.ts
|
|
255487
|
+
var GIT_HASH_PATTERN = /^[a-fA-F0-9]{7,64}$/;
|
|
255488
|
+
function isGitCommitHash(value) {
|
|
255489
|
+
return GIT_HASH_PATTERN.test(value);
|
|
255490
|
+
}
|
|
255491
|
+
|
|
255492
|
+
// src/core/site/git-hash.ts
|
|
255493
|
+
async function resolveGitHash(projectRoot, explicit) {
|
|
255494
|
+
const hash2 = explicit ?? await gitHead(projectRoot);
|
|
255495
|
+
if (!hash2 || !isGitCommitHash(hash2)) {
|
|
255496
|
+
throw new InvalidInputError(explicit ? `'${explicit}' is not a git commit hash.` : "Deployments are addressed by the commit that produced the build, and no git commit was found.", {
|
|
255497
|
+
hints: [
|
|
255498
|
+
{
|
|
255499
|
+
message: "Run the deploy from a git checkout, or pass the commit explicitly with --git-hash."
|
|
255500
|
+
}
|
|
255501
|
+
]
|
|
255502
|
+
});
|
|
255503
|
+
}
|
|
255504
|
+
return hash2;
|
|
255505
|
+
}
|
|
255506
|
+
async function gitHead(projectRoot) {
|
|
255507
|
+
try {
|
|
255508
|
+
const { stdout } = await execa("git", ["rev-parse", "HEAD"], {
|
|
255509
|
+
cwd: projectRoot
|
|
255510
|
+
});
|
|
255511
|
+
return stdout.trim();
|
|
255512
|
+
} catch {
|
|
255513
|
+
return null;
|
|
255514
|
+
}
|
|
255515
|
+
}
|
|
255516
|
+
// src/core/project/deploy.ts
|
|
255517
|
+
function hasResourcesToDeploy(projectData) {
|
|
255518
|
+
const {
|
|
255519
|
+
project,
|
|
255520
|
+
entities,
|
|
255521
|
+
functions,
|
|
255522
|
+
agents,
|
|
255523
|
+
agentSkills,
|
|
255524
|
+
connectors,
|
|
255525
|
+
authConfig
|
|
255526
|
+
} = projectData;
|
|
255527
|
+
const hasSite = Boolean(project.site?.outputDirectory);
|
|
255528
|
+
const hasEntities = entities.length > 0;
|
|
255529
|
+
const hasFunctions = functions.length > 0;
|
|
255530
|
+
const hasAgents = agents.length > 0;
|
|
255531
|
+
const hasAgentSkills = agentSkills.length > 0;
|
|
255532
|
+
const hasConnectors = connectors.length > 0;
|
|
255533
|
+
const hasAuthConfig = authConfig.length > 0;
|
|
255534
|
+
const hasVisibility = Boolean(project.visibility);
|
|
255535
|
+
return hasEntities || hasFunctions || hasAgents || hasAgentSkills || hasConnectors || hasAuthConfig || hasVisibility || hasSite;
|
|
255536
|
+
}
|
|
255537
|
+
async function deployAll(projectData, options) {
|
|
255538
|
+
const {
|
|
255539
|
+
project,
|
|
255540
|
+
entities,
|
|
255541
|
+
functions,
|
|
255542
|
+
agents,
|
|
255543
|
+
agentSkills,
|
|
255544
|
+
connectors,
|
|
255545
|
+
authConfig
|
|
255546
|
+
} = projectData;
|
|
255547
|
+
await setAppVisibility(project.visibility);
|
|
255548
|
+
if (project.visibility) {
|
|
255549
|
+
options?.onVisibilitySet?.(project.visibility);
|
|
255550
|
+
}
|
|
255551
|
+
await entityResource.push(entities);
|
|
255552
|
+
await deployFunctionsSequentially(functions, {
|
|
255553
|
+
onStart: options?.onFunctionStart,
|
|
255554
|
+
onResult: options?.onFunctionResult
|
|
255555
|
+
});
|
|
255556
|
+
await agentSkillResource.push(agentSkills);
|
|
255557
|
+
await agentResource.push(agents);
|
|
255558
|
+
await authConfigResource.push(authConfig);
|
|
255559
|
+
const skipConnectorSync = connectors.length === 0 && hasWorkspaceApiKeyAuth();
|
|
255560
|
+
const connectorResults = skipConnectorSync ? [] : (await pushConnectors(connectors)).results;
|
|
255561
|
+
if (project.site?.outputDirectory) {
|
|
255562
|
+
const outputDir = resolve5(project.root, project.site.outputDirectory);
|
|
255563
|
+
const { appUrl } = await deploySite(outputDir);
|
|
255564
|
+
return { appUrl, connectorResults };
|
|
255565
|
+
}
|
|
255566
|
+
return { connectorResults };
|
|
255567
|
+
}
|
|
255568
|
+
// src/core/clients/base44-client.ts
|
|
255569
|
+
var retriedRequests = new WeakSet;
|
|
255570
|
+
async function captureRequestBody(request, options) {
|
|
255571
|
+
if (request.body == null) {
|
|
255572
|
+
return;
|
|
255573
|
+
}
|
|
255574
|
+
try {
|
|
255575
|
+
const cloned = request.clone();
|
|
255576
|
+
const text = await cloned.text();
|
|
255577
|
+
options.context.__requestBody = text;
|
|
255578
|
+
} catch {}
|
|
255579
|
+
}
|
|
255580
|
+
async function handleUnauthorized(request, _options, response) {
|
|
255581
|
+
if (response.status !== 401) {
|
|
255582
|
+
return;
|
|
255583
|
+
}
|
|
255584
|
+
if (hasWorkspaceApiKeyAuth()) {
|
|
255585
|
+
return;
|
|
255586
|
+
}
|
|
255587
|
+
if (retriedRequests.has(request)) {
|
|
255588
|
+
return;
|
|
255589
|
+
}
|
|
255590
|
+
const newAccessToken = await refreshAndSaveTokens();
|
|
255591
|
+
if (!newAccessToken) {
|
|
255592
|
+
return;
|
|
255593
|
+
}
|
|
255594
|
+
retriedRequests.add(request);
|
|
255595
|
+
const requestId = request.headers.get("X-Request-ID");
|
|
255596
|
+
return distribution_default(request.clone(), {
|
|
255597
|
+
headers: {
|
|
255598
|
+
...requestId && { "X-Request-ID": requestId },
|
|
255599
|
+
Authorization: `Bearer ${newAccessToken}`
|
|
255600
|
+
}
|
|
255601
|
+
});
|
|
255602
|
+
}
|
|
255603
|
+
var base44Client = distribution_default.create({
|
|
255604
|
+
prefixUrl: getBase44ApiUrl(),
|
|
255605
|
+
headers: {
|
|
255606
|
+
"User-Agent": "Base44 CLI"
|
|
255607
|
+
},
|
|
255608
|
+
hooks: {
|
|
255609
|
+
beforeRequest: [
|
|
255610
|
+
(request) => {
|
|
255611
|
+
request.headers.set("X-Request-ID", randomUUID2());
|
|
255612
|
+
},
|
|
255613
|
+
captureRequestBody,
|
|
255614
|
+
async (request) => {
|
|
255615
|
+
const workspaceApiKey = getWorkspaceApiKeyFromEnv();
|
|
255616
|
+
if (workspaceApiKey && isWorkspaceApiKey(workspaceApiKey)) {
|
|
255617
|
+
request.headers.set("api_key", workspaceApiKey);
|
|
255618
|
+
return;
|
|
255619
|
+
}
|
|
255620
|
+
try {
|
|
255621
|
+
const auth = await readAuth();
|
|
255622
|
+
if (isTokenExpired(auth)) {
|
|
255623
|
+
const newAccessToken = await refreshAndSaveTokens();
|
|
255624
|
+
if (newAccessToken) {
|
|
255625
|
+
request.headers.set("Authorization", `Bearer ${newAccessToken}`);
|
|
255626
|
+
return;
|
|
255627
|
+
}
|
|
255628
|
+
}
|
|
255629
|
+
request.headers.set("Authorization", `Bearer ${auth.accessToken}`);
|
|
255630
|
+
} catch {}
|
|
255631
|
+
}
|
|
255632
|
+
],
|
|
255633
|
+
afterResponse: [handleUnauthorized]
|
|
255634
|
+
}
|
|
255635
|
+
});
|
|
255636
|
+
function getAppClient() {
|
|
255637
|
+
const { id } = getAppContext();
|
|
255638
|
+
return base44Client.extend({
|
|
255639
|
+
prefixUrl: new URL(`/api/apps/${id}/`, getBase44ApiUrl()).href
|
|
255640
|
+
});
|
|
255641
|
+
}
|
|
255642
|
+
function getSandboxClient(appId) {
|
|
255643
|
+
return base44Client.extend({
|
|
255644
|
+
prefixUrl: new URL(`/api/apps/${appId}/sandbox-bridge/`, getBase44ApiUrl()).href
|
|
255645
|
+
});
|
|
255646
|
+
}
|
|
255647
|
+
// src/core/clients/oauth-client.ts
|
|
255648
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
255649
|
+
var oauthClient = distribution_default.create({
|
|
255650
|
+
prefixUrl: getBase44ApiUrl(),
|
|
255651
|
+
headers: {
|
|
255652
|
+
"User-Agent": "Base44 CLI"
|
|
255653
|
+
},
|
|
255654
|
+
hooks: {
|
|
255655
|
+
beforeRequest: [
|
|
255656
|
+
(request) => {
|
|
255657
|
+
request.headers.set("X-Request-ID", randomUUID3());
|
|
255658
|
+
}
|
|
255659
|
+
]
|
|
255660
|
+
}
|
|
255661
|
+
});
|
|
255662
|
+
// src/core/auth/api.ts
|
|
255663
|
+
async function generateDeviceCode() {
|
|
255664
|
+
const response = await oauthClient.post("oauth/device/code", {
|
|
255665
|
+
json: {
|
|
255666
|
+
client_id: AUTH_CLIENT_ID,
|
|
255667
|
+
scope: "apps:read apps:write sandbox:write"
|
|
255668
|
+
},
|
|
255669
|
+
throwHttpErrors: false
|
|
255670
|
+
});
|
|
255671
|
+
if (!response.ok) {
|
|
255672
|
+
throw new ApiError(`Failed to generate device code: ${response.status} ${response.statusText}`, { statusCode: response.status });
|
|
255673
|
+
}
|
|
255674
|
+
const result = DeviceCodeResponseSchema.safeParse(await response.json());
|
|
255675
|
+
if (!result.success) {
|
|
255676
|
+
throw new SchemaValidationError("Invalid device code response from server", result.error);
|
|
255677
|
+
}
|
|
255678
|
+
return result.data;
|
|
255679
|
+
}
|
|
255680
|
+
async function getTokenFromDeviceCode(deviceCode) {
|
|
255681
|
+
const searchParams = new URLSearchParams;
|
|
255682
|
+
searchParams.set("grant_type", "urn:ietf:params:oauth:grant-type:device_code");
|
|
255683
|
+
searchParams.set("device_code", deviceCode);
|
|
255684
|
+
searchParams.set("client_id", AUTH_CLIENT_ID);
|
|
255685
|
+
const response = await oauthClient.post("oauth/token", {
|
|
255686
|
+
body: searchParams.toString(),
|
|
255687
|
+
headers: {
|
|
255688
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
255689
|
+
},
|
|
255690
|
+
throwHttpErrors: false
|
|
255691
|
+
});
|
|
255692
|
+
const json2 = await response.json();
|
|
255693
|
+
if (!response.ok) {
|
|
255694
|
+
const errorResult = OAuthErrorSchema.safeParse(json2);
|
|
255695
|
+
if (!errorResult.success) {
|
|
255696
|
+
throw new SchemaValidationError("Token request failed", errorResult.error);
|
|
255697
|
+
}
|
|
255698
|
+
const { error: error48, error_description } = errorResult.data;
|
|
255699
|
+
if (error48 === "authorization_pending" || error48 === "slow_down") {
|
|
255700
|
+
return null;
|
|
255701
|
+
}
|
|
255702
|
+
throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
|
|
255703
|
+
statusCode: response.status
|
|
255704
|
+
});
|
|
255705
|
+
}
|
|
255706
|
+
const result = TokenResponseSchema.safeParse(json2);
|
|
255707
|
+
if (!result.success) {
|
|
255708
|
+
throw new SchemaValidationError("Invalid token response from server", result.error);
|
|
255709
|
+
}
|
|
255710
|
+
return result.data;
|
|
255711
|
+
}
|
|
255712
|
+
async function renewAccessToken(refreshToken) {
|
|
255713
|
+
const searchParams = new URLSearchParams;
|
|
255714
|
+
searchParams.set("grant_type", "refresh_token");
|
|
255715
|
+
searchParams.set("refresh_token", refreshToken);
|
|
255716
|
+
searchParams.set("client_id", AUTH_CLIENT_ID);
|
|
255717
|
+
const response = await oauthClient.post("oauth/token", {
|
|
255718
|
+
body: searchParams.toString(),
|
|
255719
|
+
headers: {
|
|
255720
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
255721
|
+
},
|
|
255722
|
+
throwHttpErrors: false
|
|
255723
|
+
});
|
|
255724
|
+
const json2 = await response.json();
|
|
255725
|
+
if (!response.ok) {
|
|
255726
|
+
const errorResult = OAuthErrorSchema.safeParse(json2);
|
|
255727
|
+
if (!errorResult.success) {
|
|
255728
|
+
throw new ApiError(`Token refresh failed: ${response.statusText}`, {
|
|
255729
|
+
statusCode: response.status
|
|
255730
|
+
});
|
|
255731
|
+
}
|
|
255732
|
+
const { error: error48, error_description } = errorResult.data;
|
|
255733
|
+
throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
|
|
255734
|
+
statusCode: response.status
|
|
255735
|
+
});
|
|
255736
|
+
}
|
|
255737
|
+
const result = TokenResponseSchema.safeParse(json2);
|
|
255738
|
+
if (!result.success) {
|
|
255739
|
+
throw new SchemaValidationError("Invalid token response from server", result.error);
|
|
255740
|
+
}
|
|
255741
|
+
return result.data;
|
|
255742
|
+
}
|
|
255743
|
+
async function getUserInfo(accessToken) {
|
|
255744
|
+
const response = await oauthClient.get("oauth/userinfo", {
|
|
255745
|
+
headers: { Authorization: `Bearer ${accessToken}` }
|
|
255746
|
+
});
|
|
255747
|
+
if (!response.ok) {
|
|
255748
|
+
throw new ApiError(`Failed to fetch user info: ${response.status}`, {
|
|
255749
|
+
statusCode: response.status
|
|
255750
|
+
});
|
|
255751
|
+
}
|
|
255752
|
+
const result = UserInfoSchema.safeParse(await response.json());
|
|
255753
|
+
if (!result.success) {
|
|
255754
|
+
throw new SchemaValidationError("Invalid UserInfo response from server", result.error);
|
|
255755
|
+
}
|
|
255756
|
+
return result.data;
|
|
255757
|
+
}
|
|
255758
|
+
// src/cli/commands/auth/login-flow.ts
|
|
255759
|
+
async function generateAndDisplayDeviceCode(log, runTask) {
|
|
255760
|
+
const deviceCodeResponse = await runTask("Generating device code...", async () => {
|
|
255761
|
+
return await generateDeviceCode();
|
|
255762
|
+
}, {
|
|
255763
|
+
successMessage: "Device code generated",
|
|
255764
|
+
errorMessage: "Failed to generate device code"
|
|
255765
|
+
});
|
|
255766
|
+
log.info(`Verification code: ${theme.styles.bold(deviceCodeResponse.userCode)}` + `
|
|
255767
|
+
Please confirm this code at: ${deviceCodeResponse.verificationUri}`);
|
|
255768
|
+
return deviceCodeResponse;
|
|
255769
|
+
}
|
|
255770
|
+
async function waitForAuthentication(deviceCode, expiresIn, interval, runTask) {
|
|
255771
|
+
let tokenResponse;
|
|
255772
|
+
try {
|
|
255773
|
+
await runTask("Waiting for authentication...", async () => {
|
|
255774
|
+
await pWaitFor(async () => {
|
|
255775
|
+
const result = await getTokenFromDeviceCode(deviceCode);
|
|
255776
|
+
if (result !== null) {
|
|
255777
|
+
tokenResponse = result;
|
|
255778
|
+
return true;
|
|
255779
|
+
}
|
|
255780
|
+
return false;
|
|
255781
|
+
}, {
|
|
255782
|
+
interval: interval * 1000,
|
|
255783
|
+
timeout: expiresIn * 1000
|
|
255784
|
+
});
|
|
255785
|
+
}, {
|
|
255786
|
+
successMessage: "Authentication completed!",
|
|
255787
|
+
errorMessage: "Authentication failed"
|
|
255788
|
+
});
|
|
255789
|
+
} catch (error48) {
|
|
255790
|
+
if (error48 instanceof Error && error48.message.includes("timed out")) {
|
|
255791
|
+
throw new AuthExpiredError("Authentication timed out. Please try again.");
|
|
255792
|
+
}
|
|
255793
|
+
throw error48;
|
|
255794
|
+
}
|
|
255795
|
+
if (tokenResponse === undefined) {
|
|
255796
|
+
throw new InternalError("Failed to retrieve authentication token.");
|
|
255797
|
+
}
|
|
255798
|
+
return tokenResponse;
|
|
255799
|
+
}
|
|
255800
|
+
async function saveAuthData(response, userInfo) {
|
|
255801
|
+
const expiresAt = Date.now() + response.expiresIn * 1000;
|
|
255802
|
+
await writeAuth({
|
|
255803
|
+
accessToken: response.accessToken,
|
|
255804
|
+
refreshToken: response.refreshToken,
|
|
255805
|
+
expiresAt,
|
|
255806
|
+
email: userInfo.email,
|
|
255807
|
+
name: userInfo.name
|
|
255808
|
+
});
|
|
255809
|
+
}
|
|
255810
|
+
async function login({
|
|
255811
|
+
log,
|
|
255812
|
+
runTask
|
|
255813
|
+
}) {
|
|
255814
|
+
const deviceCodeResponse = await generateAndDisplayDeviceCode(log, runTask);
|
|
255815
|
+
const token = await waitForAuthentication(deviceCodeResponse.deviceCode, deviceCodeResponse.expiresIn, deviceCodeResponse.interval, runTask);
|
|
255816
|
+
const userInfo = await getUserInfo(token.accessToken);
|
|
255817
|
+
await saveAuthData(token, userInfo);
|
|
255818
|
+
return {
|
|
255819
|
+
outroMessage: `Successfully logged in as ${theme.styles.bold(userInfo.email)}`
|
|
255820
|
+
};
|
|
255821
|
+
}
|
|
255822
|
+
|
|
255823
|
+
// src/cli/utils/command/middleware.ts
|
|
255824
|
+
async function ensureAuth(ctx) {
|
|
255825
|
+
if (hasWorkspaceApiKeyAuth()) {
|
|
255826
|
+
ctx.errorReporter.setContext({
|
|
255827
|
+
user: { email: "workspace-api-key", name: "Workspace API key" }
|
|
255828
|
+
});
|
|
255829
|
+
return;
|
|
255830
|
+
}
|
|
255831
|
+
await seedAuthFromEnv();
|
|
255832
|
+
const loggedIn = await isLoggedIn();
|
|
255833
|
+
if (!loggedIn) {
|
|
255834
|
+
ctx.log.info("You need to login first to continue.");
|
|
255835
|
+
await login(ctx);
|
|
255836
|
+
}
|
|
255837
|
+
try {
|
|
255838
|
+
const userInfo = await readAuth();
|
|
255839
|
+
ctx.errorReporter.setContext({
|
|
255840
|
+
user: { email: userInfo.email, name: userInfo.name }
|
|
255841
|
+
});
|
|
255842
|
+
} catch {}
|
|
255843
|
+
}
|
|
255844
|
+
async function ensureAppContext(ctx, options = {}) {
|
|
255845
|
+
const appContext = await initAppContext(options);
|
|
255846
|
+
ctx.app = appContext;
|
|
255847
|
+
ctx.errorReporter.setContext({ appId: appContext.id });
|
|
255848
|
+
}
|
|
255849
|
+
|
|
255467
255850
|
// src/cli/utils/version-check.ts
|
|
255468
255851
|
async function checkForUpgrade() {
|
|
255469
255852
|
const testLatestVersion = getTestOverrides()?.latestVersion;
|
|
@@ -255876,11 +256259,6 @@ function verifyDenoInstalled(context) {
|
|
|
255876
256259
|
});
|
|
255877
256260
|
}
|
|
255878
256261
|
}
|
|
255879
|
-
// src/core/utils/git.ts
|
|
255880
|
-
var GIT_HASH_PATTERN = /^[a-fA-F0-9]{7,64}$/;
|
|
255881
|
-
function isGitCommitHash(value) {
|
|
255882
|
-
return GIT_HASH_PATTERN.test(value);
|
|
255883
|
-
}
|
|
255884
256262
|
// src/core/workspace/schema.ts
|
|
255885
256263
|
var WorkspaceSchema = exports_external.object({
|
|
255886
256264
|
id: exports_external.string(),
|
|
@@ -255955,7 +256333,7 @@ async function pullAction({
|
|
|
255955
256333
|
runTask: runTask2
|
|
255956
256334
|
}) {
|
|
255957
256335
|
const { project: project2 } = await readProjectConfig();
|
|
255958
|
-
const dir =
|
|
256336
|
+
const dir = join18(dirname11(project2.configPath), project2.agentSkillsDir);
|
|
255959
256337
|
const remote = await runTask2("Fetching agent skills from Base44", () => fetchAgentSkills(), {
|
|
255960
256338
|
successMessage: "Agent skills fetched successfully",
|
|
255961
256339
|
errorMessage: "Failed to fetch agent skills"
|
|
@@ -256011,14 +256389,14 @@ function getAgentSkillsCommand() {
|
|
|
256011
256389
|
}
|
|
256012
256390
|
|
|
256013
256391
|
// src/cli/commands/agents/pull.ts
|
|
256014
|
-
import { dirname as
|
|
256392
|
+
import { dirname as dirname12, join as join19 } from "node:path";
|
|
256015
256393
|
async function pullAgentsAction({
|
|
256016
256394
|
log,
|
|
256017
256395
|
runTask: runTask2
|
|
256018
256396
|
}) {
|
|
256019
256397
|
const { project: project2 } = await readProjectConfig();
|
|
256020
|
-
const configDir =
|
|
256021
|
-
const agentsDir =
|
|
256398
|
+
const configDir = dirname12(project2.configPath);
|
|
256399
|
+
const agentsDir = join19(configDir, project2.agentsDir);
|
|
256022
256400
|
const remoteAgents = await runTask2("Fetching agents from Base44", async () => {
|
|
256023
256401
|
return await fetchAgents();
|
|
256024
256402
|
}, {
|
|
@@ -256088,12 +256466,12 @@ function getAgentsCommand() {
|
|
|
256088
256466
|
}
|
|
256089
256467
|
|
|
256090
256468
|
// src/cli/commands/auth/password-login.ts
|
|
256091
|
-
import { dirname as
|
|
256469
|
+
import { dirname as dirname13, join as join20 } from "node:path";
|
|
256092
256470
|
async function passwordLoginAction({ log, runTask: runTask2 }, action) {
|
|
256093
256471
|
const shouldEnable = action === "enable";
|
|
256094
256472
|
const { project: project2 } = await readProjectConfig();
|
|
256095
|
-
const configDir =
|
|
256096
|
-
const authDir =
|
|
256473
|
+
const configDir = dirname13(project2.configPath);
|
|
256474
|
+
const authDir = join20(configDir, project2.authDir);
|
|
256097
256475
|
const updated = await runTask2("Updating local auth config", async () => {
|
|
256098
256476
|
const current = await readAuthConfig(authDir) ?? DEFAULT_AUTH_CONFIG;
|
|
256099
256477
|
const merged = { ...current, enableUsernamePassword: shouldEnable };
|
|
@@ -256113,14 +256491,14 @@ function getPasswordLoginCommand() {
|
|
|
256113
256491
|
}
|
|
256114
256492
|
|
|
256115
256493
|
// src/cli/commands/auth/pull.ts
|
|
256116
|
-
import { dirname as
|
|
256494
|
+
import { dirname as dirname14, join as join21 } from "node:path";
|
|
256117
256495
|
async function pullAuthAction({
|
|
256118
256496
|
log,
|
|
256119
256497
|
runTask: runTask2
|
|
256120
256498
|
}) {
|
|
256121
256499
|
const { project: project2 } = await readProjectConfig();
|
|
256122
|
-
const configDir =
|
|
256123
|
-
const authDir =
|
|
256500
|
+
const configDir = dirname14(project2.configPath);
|
|
256501
|
+
const authDir = join21(configDir, project2.authDir);
|
|
256124
256502
|
const remoteConfig = await runTask2("Fetching auth config from Base44", async () => {
|
|
256125
256503
|
return await pullAuthConfig();
|
|
256126
256504
|
}, {
|
|
@@ -256184,7 +256562,7 @@ function getAuthPushCommand() {
|
|
|
256184
256562
|
}
|
|
256185
256563
|
|
|
256186
256564
|
// src/cli/commands/auth/social-login.ts
|
|
256187
|
-
import { dirname as
|
|
256565
|
+
import { dirname as dirname15, join as join22, resolve as resolve6 } from "node:path";
|
|
256188
256566
|
var PROVIDER_LABELS = {
|
|
256189
256567
|
google: "Google",
|
|
256190
256568
|
microsoft: "Microsoft",
|
|
@@ -256224,7 +256602,7 @@ async function socialLoginAction({ log, isNonInteractive, runTask: runTask2 }, p
|
|
|
256224
256602
|
let clientSecret;
|
|
256225
256603
|
if (useCustomOAuth && oauth && oauthCli && hasSecretOptions(options)) {
|
|
256226
256604
|
if (options.envFile) {
|
|
256227
|
-
const secrets = await parseEnvFile(
|
|
256605
|
+
const secrets = await parseEnvFile(resolve6(options.envFile));
|
|
256228
256606
|
const value = secrets[oauthCli.envVar];
|
|
256229
256607
|
if (!value) {
|
|
256230
256608
|
throw new InvalidInputError(`Key "${oauthCli.envVar}" not found in ${options.envFile}.`);
|
|
@@ -256254,8 +256632,8 @@ async function socialLoginAction({ log, isNonInteractive, runTask: runTask2 }, p
|
|
|
256254
256632
|
}
|
|
256255
256633
|
}
|
|
256256
256634
|
const { project: project2 } = await readProjectConfig();
|
|
256257
|
-
const configDir =
|
|
256258
|
-
const authDir =
|
|
256635
|
+
const configDir = dirname15(project2.configPath);
|
|
256636
|
+
const authDir = join22(configDir, project2.authDir);
|
|
256259
256637
|
const { config: updated } = await runTask2("Updating local auth config", async () => updateSocialLoginConfig(authDir, provider, shouldEnable, useCustomOAuth && options.clientId ? { clientId: options.clientId } : undefined));
|
|
256260
256638
|
if (clientSecret) {
|
|
256261
256639
|
await runTask2("Saving client secret", async () => pushCustomOAuthSecret(provider, clientSecret));
|
|
@@ -256280,7 +256658,7 @@ function getSocialLoginCommand() {
|
|
|
256280
256658
|
}
|
|
256281
256659
|
|
|
256282
256660
|
// src/cli/commands/auth/sso.ts
|
|
256283
|
-
import { dirname as
|
|
256661
|
+
import { dirname as dirname16, join as join23, resolve as resolve7 } from "node:path";
|
|
256284
256662
|
var SSOConfigFileSchema = exports_external.object({
|
|
256285
256663
|
provider: exports_external.enum(Object.values(KNOWN_SSO_PROVIDERS)),
|
|
256286
256664
|
clientId: exports_external.string(),
|
|
@@ -256296,7 +256674,7 @@ var SSOConfigFileSchema = exports_external.object({
|
|
|
256296
256674
|
ssoName: exports_external.string().optional()
|
|
256297
256675
|
});
|
|
256298
256676
|
async function loadSSOConfigFile(filePath) {
|
|
256299
|
-
const resolved =
|
|
256677
|
+
const resolved = resolve7(filePath);
|
|
256300
256678
|
const raw2 = await readJsonFile(resolved);
|
|
256301
256679
|
const result = SSOConfigFileSchema.safeParse(raw2);
|
|
256302
256680
|
if (!result.success) {
|
|
@@ -256384,7 +256762,7 @@ async function ssoEnableAction({ isNonInteractive, runTask: runTask2 }, options)
|
|
|
256384
256762
|
}
|
|
256385
256763
|
let clientSecret;
|
|
256386
256764
|
if (merged.envFile && !merged.clientSecret) {
|
|
256387
|
-
const secrets2 = await parseEnvFile(
|
|
256765
|
+
const secrets2 = await parseEnvFile(resolve7(merged.envFile));
|
|
256388
256766
|
const value = secrets2.sso_client_secret;
|
|
256389
256767
|
if (!value) {
|
|
256390
256768
|
throw new InvalidInputError(`Key "sso_client_secret" not found in ${merged.envFile}.`);
|
|
@@ -256443,8 +256821,8 @@ async function ssoEnableAction({ isNonInteractive, runTask: runTask2 }, options)
|
|
|
256443
256821
|
throw error48;
|
|
256444
256822
|
}
|
|
256445
256823
|
const { project: project2 } = await readProjectConfig();
|
|
256446
|
-
const configDir =
|
|
256447
|
-
const authDir =
|
|
256824
|
+
const configDir = dirname16(project2.configPath);
|
|
256825
|
+
const authDir = join23(configDir, project2.authDir);
|
|
256448
256826
|
await runTask2("Updating local auth config", async () => updateSSOConfig(authDir, provider, true));
|
|
256449
256827
|
await runTask2("Saving SSO credentials", async () => pushSSOSecrets(secrets));
|
|
256450
256828
|
return {
|
|
@@ -256459,8 +256837,8 @@ async function ssoDisableAction({ log, runTask: runTask2 }, options) {
|
|
|
256459
256837
|
throw new InvalidInputError("Configuration options cannot be used with disable. To disable SSO: base44 auth sso disable");
|
|
256460
256838
|
}
|
|
256461
256839
|
const { project: project2 } = await readProjectConfig();
|
|
256462
|
-
const configDir =
|
|
256463
|
-
const authDir =
|
|
256840
|
+
const configDir = dirname16(project2.configPath);
|
|
256841
|
+
const authDir = join23(configDir, project2.authDir);
|
|
256464
256842
|
const updated = await runTask2("Updating local auth config", async () => updateSSOConfig(authDir, null, false));
|
|
256465
256843
|
await runTask2("Removing SSO credentials", async () => deleteSSOSecrets());
|
|
256466
256844
|
if (!hasAnyLoginMethod(updated)) {
|
|
@@ -257022,19 +257400,19 @@ var baseOpen = async (options) => {
|
|
|
257022
257400
|
}
|
|
257023
257401
|
const subprocess = childProcess3.spawn(command2, cliArguments, childProcessOptions);
|
|
257024
257402
|
if (options.wait) {
|
|
257025
|
-
return new Promise((
|
|
257403
|
+
return new Promise((resolve8, reject) => {
|
|
257026
257404
|
subprocess.once("error", reject);
|
|
257027
257405
|
subprocess.once("close", (exitCode) => {
|
|
257028
257406
|
if (!options.allowNonzeroExitCode && exitCode !== 0) {
|
|
257029
257407
|
reject(new Error(`Exited with code ${exitCode}`));
|
|
257030
257408
|
return;
|
|
257031
257409
|
}
|
|
257032
|
-
|
|
257410
|
+
resolve8(subprocess);
|
|
257033
257411
|
});
|
|
257034
257412
|
});
|
|
257035
257413
|
}
|
|
257036
257414
|
if (isFallbackAttempt) {
|
|
257037
|
-
return new Promise((
|
|
257415
|
+
return new Promise((resolve8, reject) => {
|
|
257038
257416
|
subprocess.once("error", reject);
|
|
257039
257417
|
subprocess.once("spawn", () => {
|
|
257040
257418
|
subprocess.once("close", (exitCode) => {
|
|
@@ -257044,17 +257422,17 @@ var baseOpen = async (options) => {
|
|
|
257044
257422
|
return;
|
|
257045
257423
|
}
|
|
257046
257424
|
subprocess.unref();
|
|
257047
|
-
|
|
257425
|
+
resolve8(subprocess);
|
|
257048
257426
|
});
|
|
257049
257427
|
});
|
|
257050
257428
|
});
|
|
257051
257429
|
}
|
|
257052
257430
|
subprocess.unref();
|
|
257053
|
-
return new Promise((
|
|
257431
|
+
return new Promise((resolve8, reject) => {
|
|
257054
257432
|
subprocess.once("error", reject);
|
|
257055
257433
|
subprocess.once("spawn", () => {
|
|
257056
257434
|
subprocess.off("error", reject);
|
|
257057
|
-
|
|
257435
|
+
resolve8(subprocess);
|
|
257058
257436
|
});
|
|
257059
257437
|
});
|
|
257060
257438
|
};
|
|
@@ -257317,13 +257695,13 @@ function getConnectorsListAvailableCommand() {
|
|
|
257317
257695
|
}
|
|
257318
257696
|
|
|
257319
257697
|
// src/cli/commands/connectors/pull.ts
|
|
257320
|
-
import { dirname as
|
|
257698
|
+
import { dirname as dirname17, join as join24, resolve as resolve8 } from "node:path";
|
|
257321
257699
|
async function resolveConnectorsDir(options) {
|
|
257322
257700
|
if (!getAppContext().projectRoot) {
|
|
257323
|
-
return
|
|
257701
|
+
return resolve8(options.dir ?? "connectors");
|
|
257324
257702
|
}
|
|
257325
257703
|
const { project: project2 } = await readProjectConfig();
|
|
257326
|
-
return
|
|
257704
|
+
return join24(dirname17(project2.configPath), project2.connectorsDir);
|
|
257327
257705
|
}
|
|
257328
257706
|
async function pullConnectorsAction({ log, runTask: runTask2, jsonMode }, options) {
|
|
257329
257707
|
const connectorsDir = await resolveConnectorsDir(options);
|
|
@@ -257364,10 +257742,10 @@ function getConnectorsPullCommand() {
|
|
|
257364
257742
|
}
|
|
257365
257743
|
|
|
257366
257744
|
// src/cli/commands/connectors/push.ts
|
|
257367
|
-
import { resolve as
|
|
257745
|
+
import { resolve as resolve9 } from "node:path";
|
|
257368
257746
|
async function readConnectorsToPush(options) {
|
|
257369
257747
|
if (!getAppContext().projectRoot) {
|
|
257370
|
-
return readAllConnectors(
|
|
257748
|
+
return readAllConnectors(resolve9(options.dir ?? "connectors"));
|
|
257371
257749
|
}
|
|
257372
257750
|
const { connectors } = await readProjectConfig();
|
|
257373
257751
|
return connectors;
|
|
@@ -257731,11 +258109,11 @@ function getListCommand() {
|
|
|
257731
258109
|
}
|
|
257732
258110
|
|
|
257733
258111
|
// src/cli/commands/functions/pull.ts
|
|
257734
|
-
import { dirname as
|
|
258112
|
+
import { dirname as dirname18, join as join25 } from "node:path";
|
|
257735
258113
|
async function pullFunctionsAction({ log, runTask: runTask2 }, name2) {
|
|
257736
258114
|
const { project: project2, functions } = await readProjectConfig();
|
|
257737
|
-
const configDir =
|
|
257738
|
-
const functionsDir =
|
|
258115
|
+
const configDir = dirname18(project2.configPath);
|
|
258116
|
+
const functionsDir = join25(configDir, project2.functionsDir);
|
|
257739
258117
|
const pluginFunctionNames = new Set(functions.filter((fn) => fn.source.type === "plugin").map((fn) => fn.name));
|
|
257740
258118
|
const remoteFunctions = await runTask2("Fetching functions from Base44", async () => {
|
|
257741
258119
|
const { functions: functions2 } = await listDeployedFunctions();
|
|
@@ -257813,31 +258191,20 @@ async function runSiteBuild({ runTask: runTask2 }, { root, buildCommand, appId }
|
|
|
257813
258191
|
errorMessage: "Build failed"
|
|
257814
258192
|
});
|
|
257815
258193
|
}
|
|
257816
|
-
async function maybeBuildBeforeDeploy(ctx, project2,
|
|
258194
|
+
async function maybeBuildBeforeDeploy(ctx, project2, explicitBuild) {
|
|
257817
258195
|
if (!ctx.app) {
|
|
257818
258196
|
return;
|
|
257819
258197
|
}
|
|
257820
|
-
|
|
257821
|
-
await runSiteBuild(ctx, {
|
|
257822
|
-
root: project2.root,
|
|
257823
|
-
buildCommand: project2.site?.buildCommand,
|
|
257824
|
-
appId: ctx.app.id
|
|
257825
|
-
});
|
|
257826
|
-
return;
|
|
257827
|
-
}
|
|
257828
|
-
if (build === false || !project2.site?.outputDirectory) {
|
|
257829
|
-
return;
|
|
257830
|
-
}
|
|
257831
|
-
const shouldBuild = await shouldAskToBuild(ctx.isNonInteractive, project2.site.buildCommand);
|
|
258198
|
+
const shouldBuild = explicitBuild ?? await maybeAskToBuild(ctx.isNonInteractive, project2.site?.buildCommand);
|
|
257832
258199
|
if (shouldBuild) {
|
|
257833
258200
|
await runSiteBuild(ctx, {
|
|
257834
258201
|
root: project2.root,
|
|
257835
|
-
buildCommand: project2.site
|
|
258202
|
+
buildCommand: project2.site?.buildCommand,
|
|
257836
258203
|
appId: ctx.app.id
|
|
257837
258204
|
});
|
|
257838
258205
|
}
|
|
257839
258206
|
}
|
|
257840
|
-
async function
|
|
258207
|
+
async function maybeAskToBuild(isNonInteractive, buildCommand) {
|
|
257841
258208
|
if (!buildCommand || isNonInteractive) {
|
|
257842
258209
|
return false;
|
|
257843
258210
|
}
|
|
@@ -257868,11 +258235,11 @@ function getBuildCommand() {
|
|
|
257868
258235
|
}
|
|
257869
258236
|
|
|
257870
258237
|
// src/cli/commands/project/create.ts
|
|
257871
|
-
import { basename as basename5, resolve as
|
|
258238
|
+
import { basename as basename5, resolve as resolve10 } from "node:path";
|
|
257872
258239
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
257873
258240
|
|
|
257874
258241
|
// src/cli/commands/project/scaffold-shared.ts
|
|
257875
|
-
import { join as
|
|
258242
|
+
import { join as join26 } from "node:path";
|
|
257876
258243
|
var DEFAULT_TEMPLATE_ID = "backend-only";
|
|
257877
258244
|
async function getTemplateById(templateId) {
|
|
257878
258245
|
const templates = await listTemplates();
|
|
@@ -257935,7 +258302,7 @@ async function completeProjectSetup({
|
|
|
257935
258302
|
env: { VITE_BASE44_APP_ID: projectId }
|
|
257936
258303
|
})`${buildCommand}`;
|
|
257937
258304
|
updateMessage("Deploying site...");
|
|
257938
|
-
return await deploySite(
|
|
258305
|
+
return await deploySite(join26(resolvedPath, outputDirectory));
|
|
257939
258306
|
}, {
|
|
257940
258307
|
successMessage: theme.colors.base44Orange("Site deployed successfully"),
|
|
257941
258308
|
errorMessage: "Failed to deploy site"
|
|
@@ -258064,7 +258431,7 @@ async function createInteractive(options, ctx) {
|
|
|
258064
258431
|
}, ctx);
|
|
258065
258432
|
}
|
|
258066
258433
|
async function createNonInteractive(options, ctx) {
|
|
258067
|
-
ctx.log.info(`Creating a new project at ${
|
|
258434
|
+
ctx.log.info(`Creating a new project at ${resolve10(options.path)}`);
|
|
258068
258435
|
const template2 = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
|
|
258069
258436
|
return await executeCreate({
|
|
258070
258437
|
template: template2,
|
|
@@ -258088,7 +258455,7 @@ async function executeCreate({
|
|
|
258088
258455
|
}, ctx) {
|
|
258089
258456
|
const { log, runTask: runTask2 } = ctx;
|
|
258090
258457
|
const name2 = rawName.trim();
|
|
258091
|
-
const resolvedPath =
|
|
258458
|
+
const resolvedPath = resolve10(projectPath);
|
|
258092
258459
|
const organizationId = await resolveWorkspaceId(ctx, flagWorkspaceId, isInteractive);
|
|
258093
258460
|
const { projectId } = await runTask2("Setting up your project...", async () => {
|
|
258094
258461
|
return await createProjectFiles({
|
|
@@ -258413,6 +258780,7 @@ function getLinkCommand() {
|
|
|
258413
258780
|
}
|
|
258414
258781
|
|
|
258415
258782
|
// src/cli/commands/project/logs.ts
|
|
258783
|
+
import { setTimeout as delay2 } from "node:timers/promises";
|
|
258416
258784
|
function parseFunctionFilters(options) {
|
|
258417
258785
|
const filters = {};
|
|
258418
258786
|
if (options.since) {
|
|
@@ -258473,7 +258841,6 @@ function writeFollowLine(entry, jsonMode) {
|
|
|
258473
258841
|
process.stdout.write(`${line}
|
|
258474
258842
|
`);
|
|
258475
258843
|
}
|
|
258476
|
-
var delay2 = (ms2) => new Promise((resolve9) => setTimeout(resolve9, ms2));
|
|
258477
258844
|
function streamEventToLogEntry(event) {
|
|
258478
258845
|
return {
|
|
258479
258846
|
time: event.time,
|
|
@@ -258501,46 +258868,42 @@ async function printStreamUntilEnd(stream, levelFilter, jsonMode, startTime) {
|
|
|
258501
258868
|
} catch {}
|
|
258502
258869
|
return { lastTime, provedAlive, end: null };
|
|
258503
258870
|
}
|
|
258504
|
-
var
|
|
258505
|
-
var
|
|
258506
|
-
var
|
|
258507
|
-
|
|
258508
|
-
|
|
258509
|
-
|
|
258510
|
-
};
|
|
258511
|
-
var hasRunOutOfStrikes = (strikes) => strikes >= RECONNECT_DELAYS_MS.length;
|
|
258512
|
-
async function connectWithinStrikes(filters, strikes) {
|
|
258513
|
-
let spent = strikes;
|
|
258871
|
+
var STREAM_RECONNECT_DELAY_MS = 1000;
|
|
258872
|
+
var MAX_DROPS_SINCE_LAST_EVENT = 2;
|
|
258873
|
+
var CONNECT_RETRY_DELAYS_MS = [1000, 2000, 4000, 8000];
|
|
258874
|
+
var countDropTowardGivingUp = (dropsSinceLastEvent, provedAlive) => provedAlive ? 1 : dropsSinceLastEvent + 1;
|
|
258875
|
+
var shouldGiveUpStreaming = (dropsSinceLastEvent) => dropsSinceLastEvent >= MAX_DROPS_SINCE_LAST_EVENT;
|
|
258876
|
+
async function connectWhileTransientlyUnavailable(filters) {
|
|
258514
258877
|
let attempt = await openLogStream(filters);
|
|
258515
|
-
|
|
258516
|
-
|
|
258517
|
-
|
|
258518
|
-
|
|
258519
|
-
await delay2(RECONNECT_DELAYS_MS[spent - 1]);
|
|
258878
|
+
for (const retryDelay of CONNECT_RETRY_DELAYS_MS) {
|
|
258879
|
+
if (attempt.kind !== "transient")
|
|
258880
|
+
return attempt;
|
|
258881
|
+
await delay2(retryDelay);
|
|
258520
258882
|
attempt = await openLogStream(filters);
|
|
258521
258883
|
}
|
|
258522
|
-
|
|
258523
|
-
return { kind: "refused" };
|
|
258524
|
-
return { kind: "stream", events: attempt.events, strikes: spent };
|
|
258884
|
+
return attempt;
|
|
258525
258885
|
}
|
|
258526
258886
|
async function streamUntilExhausted(firstStream, filters, options, jsonMode) {
|
|
258527
258887
|
let events = firstStream;
|
|
258528
258888
|
let lastTime = "";
|
|
258529
|
-
let
|
|
258889
|
+
let dropsSinceLastEvent = 0;
|
|
258530
258890
|
while (true) {
|
|
258531
258891
|
const ending = await printStreamUntilEnd(events, options.level, jsonMode, lastTime);
|
|
258532
258892
|
lastTime = ending.lastTime;
|
|
258533
|
-
if (ending.end
|
|
258534
|
-
|
|
258535
|
-
|
|
258536
|
-
|
|
258537
|
-
|
|
258538
|
-
|
|
258539
|
-
|
|
258540
|
-
|
|
258893
|
+
if (ending.end) {
|
|
258894
|
+
if (!ending.end.retriable)
|
|
258895
|
+
return;
|
|
258896
|
+
dropsSinceLastEvent = 0;
|
|
258897
|
+
} else {
|
|
258898
|
+
dropsSinceLastEvent = countDropTowardGivingUp(dropsSinceLastEvent, ending.provedAlive);
|
|
258899
|
+
if (shouldGiveUpStreaming(dropsSinceLastEvent))
|
|
258900
|
+
return;
|
|
258901
|
+
}
|
|
258902
|
+
await delay2(STREAM_RECONNECT_DELAY_MS);
|
|
258903
|
+
const reopened = await connectWhileTransientlyUnavailable(filters);
|
|
258904
|
+
if (reopened.kind !== "stream")
|
|
258541
258905
|
return;
|
|
258542
|
-
events =
|
|
258543
|
-
strikes = reconnected.strikes;
|
|
258906
|
+
events = reopened.events;
|
|
258544
258907
|
}
|
|
258545
258908
|
}
|
|
258546
258909
|
function streamLostError() {
|
|
@@ -258559,7 +258922,14 @@ async function followLogs(functionNames, options, availableFunctionNames, jsonMo
|
|
|
258559
258922
|
functions: parseFunctionNames(options.function),
|
|
258560
258923
|
env: options.env
|
|
258561
258924
|
};
|
|
258562
|
-
|
|
258925
|
+
if (options.since) {
|
|
258926
|
+
logger2.warn("--since reads the past, so this run polls instead of streaming (lines may lag ~20-30s).");
|
|
258927
|
+
return pollLogs(functionNames, options, availableFunctionNames, jsonMode, {
|
|
258928
|
+
lastTime: "",
|
|
258929
|
+
boundaryKeys: new Set
|
|
258930
|
+
});
|
|
258931
|
+
}
|
|
258932
|
+
const opened = await connectWhileTransientlyUnavailable(filters);
|
|
258563
258933
|
if (opened.kind !== "stream") {
|
|
258564
258934
|
logger2.warn(opened.kind === "refused" ? "Realtime logs are not available for this app — falling back to polling (lines may lag ~20-30s)." : "Could not reach the realtime log stream — falling back to polling (lines may lag ~20-30s).");
|
|
258565
258935
|
return pollLogs(functionNames, options, availableFunctionNames, jsonMode, {
|
|
@@ -258674,9 +259044,6 @@ async function logsAction(ctx, options) {
|
|
|
258674
259044
|
return { outroMessage: "No functions found in this app." };
|
|
258675
259045
|
}
|
|
258676
259046
|
if (options.follow) {
|
|
258677
|
-
if (options.since) {
|
|
258678
|
-
throw new InvalidInputError("--since cannot be combined with --follow yet (the realtime stream starts from now).");
|
|
258679
|
-
}
|
|
258680
259047
|
if (options.until) {
|
|
258681
259048
|
throw new InvalidInputError("--until cannot be combined with --follow (a stream has no end).");
|
|
258682
259049
|
}
|
|
@@ -258707,7 +259074,7 @@ function getLogsCommand() {
|
|
|
258707
259074
|
}
|
|
258708
259075
|
|
|
258709
259076
|
// src/cli/commands/project/scaffold.ts
|
|
258710
|
-
import { basename as basename6, resolve as
|
|
259077
|
+
import { basename as basename6, resolve as resolve11 } from "node:path";
|
|
258711
259078
|
function resolveAppId(options) {
|
|
258712
259079
|
const appId = options.appId;
|
|
258713
259080
|
if (!appId) {
|
|
@@ -258723,7 +259090,7 @@ function resolveAppId(options) {
|
|
|
258723
259090
|
async function scaffoldAction(ctx, name2, options, command2) {
|
|
258724
259091
|
const { log, runTask: runTask2 } = ctx;
|
|
258725
259092
|
const appId = resolveAppId(command2.optsWithGlobals());
|
|
258726
|
-
const resolvedPath =
|
|
259093
|
+
const resolvedPath = resolve11("./");
|
|
258727
259094
|
const projectName = (name2 ?? basename6(resolvedPath)).trim();
|
|
258728
259095
|
const template2 = await getTemplateById("backend-only");
|
|
258729
259096
|
log.info(`Scaffolding project at ${resolvedPath}`);
|
|
@@ -259120,7 +259487,7 @@ function getSecretsListCommand() {
|
|
|
259120
259487
|
}
|
|
259121
259488
|
|
|
259122
259489
|
// src/cli/commands/secrets/set.ts
|
|
259123
|
-
import { resolve as
|
|
259490
|
+
import { resolve as resolve12 } from "node:path";
|
|
259124
259491
|
function parseEntries(entries) {
|
|
259125
259492
|
const secrets = {};
|
|
259126
259493
|
for (const entry of entries) {
|
|
@@ -259151,7 +259518,7 @@ async function setSecretsAction({ log, runTask: runTask2 }, entries, options) {
|
|
|
259151
259518
|
validateInput(entries, options);
|
|
259152
259519
|
let secrets;
|
|
259153
259520
|
if (options.envFile) {
|
|
259154
|
-
secrets = await parseEnvFile(
|
|
259521
|
+
secrets = await parseEnvFile(resolve12(options.envFile));
|
|
259155
259522
|
if (Object.keys(secrets).length === 0) {
|
|
259156
259523
|
throw new InvalidInputError("The env file contains no valid KEY=VALUE entries.");
|
|
259157
259524
|
}
|
|
@@ -259180,43 +259547,40 @@ function getSecretsCommand() {
|
|
|
259180
259547
|
}
|
|
259181
259548
|
|
|
259182
259549
|
// src/cli/commands/site/deploy.ts
|
|
259183
|
-
import { resolve as
|
|
259550
|
+
import { resolve as resolve13 } from "node:path";
|
|
259184
259551
|
async function deployAction2(ctx, options) {
|
|
259185
259552
|
const { isNonInteractive } = ctx;
|
|
259186
259553
|
if (isNonInteractive && !options.yes) {
|
|
259187
259554
|
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
259188
259555
|
}
|
|
259189
259556
|
const project2 = await readProjectSettings();
|
|
259190
|
-
|
|
259191
|
-
if (!outputDirectory) {
|
|
259192
|
-
throw new ConfigNotFoundError("No site configuration found.", {
|
|
259193
|
-
hints: [
|
|
259194
|
-
{
|
|
259195
|
-
message: `Add 'site.outputDirectory' to your config.jsonc (e.g., "site": { "outputDirectory": "dist" })`
|
|
259196
|
-
}
|
|
259197
|
-
]
|
|
259198
|
-
});
|
|
259199
|
-
}
|
|
259557
|
+
await maybeBuildBeforeDeploy(ctx, project2, options.build);
|
|
259200
259558
|
if (!options.yes) {
|
|
259559
|
+
const outputDirectory = project2.site?.outputDirectory;
|
|
259201
259560
|
const shouldDeploy = await Re({
|
|
259202
|
-
message: `Deploy site from ${outputDirectory}?`
|
|
259561
|
+
message: outputDirectory ? `Deploy site from ${outputDirectory}?` : "Deploy site?"
|
|
259203
259562
|
});
|
|
259204
259563
|
if (Ct(shouldDeploy) || !shouldDeploy) {
|
|
259205
259564
|
return { outroMessage: "Deployment cancelled" };
|
|
259206
259565
|
}
|
|
259207
259566
|
}
|
|
259208
|
-
await
|
|
259209
|
-
const outputDir = resolve11(project2.root, outputDirectory);
|
|
259210
|
-
const { gitHash, concurrency } = options;
|
|
259211
|
-
return gitHash ? await deployToDeploymentsApi(ctx, outputDir, gitHash, concurrency) : await deployTarball(ctx, outputDir);
|
|
259567
|
+
return deploymentsApiEnabled() ? await deployToDeploymentsApi(ctx, project2, options) : await deployTarball(ctx, project2);
|
|
259212
259568
|
}
|
|
259213
|
-
async function deployToDeploymentsApi(
|
|
259569
|
+
async function deployToDeploymentsApi(ctx, project2, options) {
|
|
259570
|
+
const { runTask: runTask2, log, jsonMode } = ctx;
|
|
259571
|
+
const projectRoot = project2.root;
|
|
259572
|
+
const gitHash = await resolveGitHash(projectRoot, options.gitHash);
|
|
259214
259573
|
const progressLines = [];
|
|
259215
|
-
const
|
|
259216
|
-
|
|
259574
|
+
const warnings = [];
|
|
259575
|
+
const { deploymentId } = await runTask2("Deploying site...", async (updateMessage) => await deployToDeployments({
|
|
259576
|
+
projectRoot,
|
|
259577
|
+
outputDir: siteOutputDir(project2),
|
|
259217
259578
|
gitHash,
|
|
259218
|
-
concurrency,
|
|
259579
|
+
concurrency: options.concurrency,
|
|
259219
259580
|
progress: {
|
|
259581
|
+
onWarning: (message) => {
|
|
259582
|
+
warnings.push(message);
|
|
259583
|
+
},
|
|
259220
259584
|
onAssets: ({ totalAssets, newAssets }) => {
|
|
259221
259585
|
const line = `Found ${totalAssets} static assets (${newAssets} new)`;
|
|
259222
259586
|
progressLines.push(line);
|
|
@@ -259224,38 +259588,59 @@ async function deployToDeploymentsApi({ runTask: runTask2, log, jsonMode }, outp
|
|
|
259224
259588
|
},
|
|
259225
259589
|
onAssetUpload: ({ uploadedFiles, totalFiles }) => {
|
|
259226
259590
|
updateMessage(`Uploaded ${uploadedFiles} of ${totalFiles} assets`);
|
|
259591
|
+
},
|
|
259592
|
+
onWorker: ({ moduleCount }) => {
|
|
259593
|
+
updateMessage(`Deploying worker (${moduleCount} modules)…`);
|
|
259227
259594
|
}
|
|
259228
259595
|
}
|
|
259229
259596
|
}), { successMessage: "Site deployed", errorMessage: "Site deploy failed" });
|
|
259230
259597
|
for (const line of progressLines) {
|
|
259231
259598
|
log.message(theme.styles.dim(line));
|
|
259232
259599
|
}
|
|
259600
|
+
for (const warning of warnings) {
|
|
259601
|
+
log.warn(warning);
|
|
259602
|
+
}
|
|
259233
259603
|
return {
|
|
259234
259604
|
outroMessage: `Deployment ${deploymentId} (commit ${gitHash.slice(0, 12)})`,
|
|
259235
259605
|
stdout: jsonMode ? `${JSON.stringify({ deploymentId, gitHash }, null, 2)}
|
|
259236
259606
|
` : undefined
|
|
259237
259607
|
};
|
|
259238
259608
|
}
|
|
259239
|
-
async function deployTarball({ runTask: runTask2 },
|
|
259609
|
+
async function deployTarball({ runTask: runTask2 }, project2) {
|
|
259610
|
+
const outputDir = siteOutputDir(project2);
|
|
259611
|
+
if (!outputDir) {
|
|
259612
|
+
throw new ConfigNotFoundError("No site configuration found.", {
|
|
259613
|
+
hints: [
|
|
259614
|
+
{
|
|
259615
|
+
message: `Add 'site.outputDirectory' to your config.jsonc (e.g., "site": { "outputDirectory": "dist" })`
|
|
259616
|
+
}
|
|
259617
|
+
]
|
|
259618
|
+
});
|
|
259619
|
+
}
|
|
259240
259620
|
const { appUrl } = await runTask2("Creating archive and deploying site...", async () => await deploySite(outputDir), {
|
|
259241
259621
|
successMessage: "Site deployed successfully",
|
|
259242
259622
|
errorMessage: "Deployment failed"
|
|
259243
259623
|
});
|
|
259244
259624
|
return { outroMessage: `Visit your site at: ${appUrl}` };
|
|
259245
259625
|
}
|
|
259626
|
+
function siteOutputDir(project2) {
|
|
259627
|
+
const outputDirectory = project2.site?.outputDirectory;
|
|
259628
|
+
return outputDirectory ? resolve13(project2.root, outputDirectory) : null;
|
|
259629
|
+
}
|
|
259246
259630
|
function getSiteDeployCommand() {
|
|
259247
259631
|
const command2 = new Base44Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").option("--build", "Build the site before deploying (skips the prompt)").option("--no-build", "Deploy without building (skips the prompt)");
|
|
259248
|
-
if (
|
|
259249
|
-
command2.addOption(new Option("--git-hash <hash>", "Commit the build came from
|
|
259250
|
-
if (!isGitCommitHash(value)) {
|
|
259251
|
-
throw new InvalidArgumentError("Expected a git commit hash (7-64 hex chars).");
|
|
259252
|
-
}
|
|
259253
|
-
return value;
|
|
259254
|
-
}));
|
|
259632
|
+
if (deploymentsApiEnabled()) {
|
|
259633
|
+
command2.addOption(new Option("--git-hash <hash>", "Commit the build came from (defaults to the checkout's HEAD)").argParser(parseGitHash));
|
|
259255
259634
|
command2.addOption(new Option("--concurrency <n>", "Parallel asset uploads").default(DEFAULT_UPLOAD_CONCURRENCY).argParser(parseConcurrency));
|
|
259256
259635
|
}
|
|
259257
259636
|
return command2.action(deployAction2);
|
|
259258
259637
|
}
|
|
259638
|
+
function parseGitHash(value) {
|
|
259639
|
+
if (!isGitCommitHash(value)) {
|
|
259640
|
+
throw new InvalidArgumentError("Expected a git commit hash (7-64 hex chars).");
|
|
259641
|
+
}
|
|
259642
|
+
return value;
|
|
259643
|
+
}
|
|
259259
259644
|
function parseConcurrency(value) {
|
|
259260
259645
|
const parsed = Number(value);
|
|
259261
259646
|
if (!Number.isInteger(parsed) || parsed < 1 || parsed > MAX_UPLOAD_CONCURRENCY) {
|
|
@@ -259263,10 +259648,6 @@ function parseConcurrency(value) {
|
|
|
259263
259648
|
}
|
|
259264
259649
|
return parsed;
|
|
259265
259650
|
}
|
|
259266
|
-
function staticDeploymentsEnabled(env3 = process.env) {
|
|
259267
|
-
const value = env3.BASE44_STATIC_DEPLOYMENTS;
|
|
259268
|
-
return value === "1" || value === "true";
|
|
259269
|
-
}
|
|
259270
259651
|
|
|
259271
259652
|
// src/cli/commands/site/open.ts
|
|
259272
259653
|
async function openAction({
|
|
@@ -259372,10 +259753,10 @@ function toPascalCase(name2) {
|
|
|
259372
259753
|
return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
|
|
259373
259754
|
}
|
|
259374
259755
|
// src/core/types/update-project.ts
|
|
259375
|
-
import { join as
|
|
259756
|
+
import { join as join29 } from "node:path";
|
|
259376
259757
|
var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
|
|
259377
259758
|
async function updateProjectConfig(projectRoot) {
|
|
259378
|
-
const tsconfigPath =
|
|
259759
|
+
const tsconfigPath = join29(projectRoot, "tsconfig.json");
|
|
259379
259760
|
if (!await pathExists(tsconfigPath)) {
|
|
259380
259761
|
return false;
|
|
259381
259762
|
}
|
|
@@ -259839,7 +260220,7 @@ function createDevLogger(label2, labelColor = theme.styles.dim) {
|
|
|
259839
260220
|
// src/cli/dev/dev-server/main.ts
|
|
259840
260221
|
var import_cors = __toESM(require_lib4(), 1);
|
|
259841
260222
|
var import_express6 = __toESM(require_express(), 1);
|
|
259842
|
-
import { dirname as
|
|
260223
|
+
import { dirname as dirname24, join as join36 } from "node:path";
|
|
259843
260224
|
|
|
259844
260225
|
// ../../node_modules/get-port/index.js
|
|
259845
260226
|
import net from "node:net";
|
|
@@ -259866,14 +260247,14 @@ var getLocalHosts = () => {
|
|
|
259866
260247
|
}
|
|
259867
260248
|
return results;
|
|
259868
260249
|
};
|
|
259869
|
-
var checkAvailablePort = (options8) => new Promise((
|
|
260250
|
+
var checkAvailablePort = (options8) => new Promise((resolve15, reject) => {
|
|
259870
260251
|
const server = net.createServer();
|
|
259871
260252
|
server.unref();
|
|
259872
260253
|
server.on("error", reject);
|
|
259873
260254
|
server.listen(options8, () => {
|
|
259874
260255
|
const { port } = server.address();
|
|
259875
260256
|
server.close(() => {
|
|
259876
|
-
|
|
260257
|
+
resolve15(port);
|
|
259877
260258
|
});
|
|
259878
260259
|
});
|
|
259879
260260
|
});
|
|
@@ -259974,7 +260355,7 @@ var $setGracefulCleanup = tmp.setGracefulCleanup;
|
|
|
259974
260355
|
|
|
259975
260356
|
// src/cli/dev/dev-server/function-manager.ts
|
|
259976
260357
|
import { spawn as spawn2 } from "node:child_process";
|
|
259977
|
-
import { dirname as
|
|
260358
|
+
import { dirname as dirname21, join as join30 } from "node:path";
|
|
259978
260359
|
import { pathToFileURL } from "node:url";
|
|
259979
260360
|
|
|
259980
260361
|
// src/cli/dev/dev-server/base-function-manager.ts
|
|
@@ -260079,7 +260460,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
260079
260460
|
}
|
|
260080
260461
|
spawnFunction(func, port) {
|
|
260081
260462
|
this.logger.log(`Spawning function "${func.name}" on port ${port}`);
|
|
260082
|
-
const importMapPath =
|
|
260463
|
+
const importMapPath = join30(dirname21(this.wrapperPath), "import-map.json");
|
|
260083
260464
|
const process23 = spawn2("deno", ["run", "--allow-all", "--import-map", importMapPath, this.wrapperPath], {
|
|
260084
260465
|
env: {
|
|
260085
260466
|
...globalThis.process.env,
|
|
@@ -260118,7 +260499,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
260118
260499
|
});
|
|
260119
260500
|
}
|
|
260120
260501
|
waitForReady(name2, runningFunc) {
|
|
260121
|
-
return new Promise((
|
|
260502
|
+
return new Promise((resolve15, reject) => {
|
|
260122
260503
|
runningFunc.process.on("exit", (code2) => {
|
|
260123
260504
|
if (!runningFunc.ready) {
|
|
260124
260505
|
clearTimeout(timeout3);
|
|
@@ -260141,7 +260522,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
260141
260522
|
runningFunc.ready = true;
|
|
260142
260523
|
clearTimeout(timeout3);
|
|
260143
260524
|
runningFunc.process.stdout?.off("data", onData);
|
|
260144
|
-
|
|
260525
|
+
resolve15(runningFunc.port);
|
|
260145
260526
|
}
|
|
260146
260527
|
};
|
|
260147
260528
|
runningFunc.process.stdout?.on("data", onData);
|
|
@@ -260153,7 +260534,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
260153
260534
|
import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
260154
260535
|
import { isBuiltin } from "node:module";
|
|
260155
260536
|
import { homedir as homedir3 } from "node:os";
|
|
260156
|
-
import { join as
|
|
260537
|
+
import { join as join31 } from "node:path";
|
|
260157
260538
|
import { pathToFileURL as pathToFileURL6 } from "node:url";
|
|
260158
260539
|
var depsPromise;
|
|
260159
260540
|
function loadDeps() {
|
|
@@ -260274,9 +260655,9 @@ export default {
|
|
|
260274
260655
|
};
|
|
260275
260656
|
`;
|
|
260276
260657
|
function ensureBundlerConfig() {
|
|
260277
|
-
const dir =
|
|
260658
|
+
const dir = join31(homedir3(), ".base44", "function-bundler");
|
|
260278
260659
|
mkdirSync2(dir, { recursive: true });
|
|
260279
|
-
const configPath =
|
|
260660
|
+
const configPath = join31(dir, "deno.json");
|
|
260280
260661
|
writeFileSync2(configPath, `${JSON.stringify({ nodeModulesDir: "auto" }, null, 2)}
|
|
260281
260662
|
`);
|
|
260282
260663
|
return configPath;
|
|
@@ -261746,16 +262127,16 @@ function createCustomIntegrationRoutes(remoteProxy, logger2) {
|
|
|
261746
262127
|
|
|
261747
262128
|
// src/cli/dev/dev-server/watcher.ts
|
|
261748
262129
|
import { EventEmitter as EventEmitter4 } from "node:events";
|
|
261749
|
-
import { relative as
|
|
262130
|
+
import { relative as relative7 } from "node:path";
|
|
261750
262131
|
|
|
261751
262132
|
// ../../node_modules/chokidar/index.js
|
|
261752
262133
|
import { EventEmitter as EventEmitter3 } from "node:events";
|
|
261753
262134
|
import { stat as statcb, Stats } from "node:fs";
|
|
261754
|
-
import { readdir as readdir3, stat as
|
|
262135
|
+
import { readdir as readdir3, stat as stat6 } from "node:fs/promises";
|
|
261755
262136
|
import * as sp3 from "node:path";
|
|
261756
262137
|
|
|
261757
262138
|
// ../../node_modules/readdirp/index.js
|
|
261758
|
-
import { lstat as lstat2, readdir as readdir2, realpath, stat as
|
|
262139
|
+
import { lstat as lstat2, readdir as readdir2, realpath, stat as stat4 } from "node:fs/promises";
|
|
261759
262140
|
import { join as pjoin, relative as prelative, resolve as presolve, sep as psep } from "node:path";
|
|
261760
262141
|
import { Readable as Readable6 } from "node:stream";
|
|
261761
262142
|
var EntryTypes = {
|
|
@@ -261837,7 +262218,7 @@ class ReaddirpStream extends Readable6 {
|
|
|
261837
262218
|
const { root: root2, type } = opts;
|
|
261838
262219
|
this._fileFilter = normalizeFilter(opts.fileFilter);
|
|
261839
262220
|
this._directoryFilter = normalizeFilter(opts.directoryFilter);
|
|
261840
|
-
const statMethod = opts.lstat ? lstat2 :
|
|
262221
|
+
const statMethod = opts.lstat ? lstat2 : stat4;
|
|
261841
262222
|
if (wantBigintFsStats) {
|
|
261842
262223
|
this._stat = (path19) => statMethod(path19, { bigint: true });
|
|
261843
262224
|
} else {
|
|
@@ -261990,7 +262371,7 @@ function readdirp(root2, options8 = {}) {
|
|
|
261990
262371
|
|
|
261991
262372
|
// ../../node_modules/chokidar/handler.js
|
|
261992
262373
|
import { watch as fs_watch, unwatchFile, watchFile } from "node:fs";
|
|
261993
|
-
import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as
|
|
262374
|
+
import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as stat5 } from "node:fs/promises";
|
|
261994
262375
|
import { type as osType } from "node:os";
|
|
261995
262376
|
import * as sp2 from "node:path";
|
|
261996
262377
|
var STR_DATA = "data";
|
|
@@ -262016,7 +262397,7 @@ var EVENTS = {
|
|
|
262016
262397
|
};
|
|
262017
262398
|
var EV = EVENTS;
|
|
262018
262399
|
var THROTTLE_MODE_WATCH = "watch";
|
|
262019
|
-
var statMethods = { lstat: lstat3, stat:
|
|
262400
|
+
var statMethods = { lstat: lstat3, stat: stat5 };
|
|
262020
262401
|
var KEY_LISTENERS = "listeners";
|
|
262021
262402
|
var KEY_ERR = "errHandlers";
|
|
262022
262403
|
var KEY_RAW = "rawEmitters";
|
|
@@ -262476,9 +262857,9 @@ class NodeFsHandler {
|
|
|
262476
262857
|
if (this.fsw.closed) {
|
|
262477
262858
|
return;
|
|
262478
262859
|
}
|
|
262479
|
-
const
|
|
262860
|
+
const dirname23 = sp2.dirname(file2);
|
|
262480
262861
|
const basename8 = sp2.basename(file2);
|
|
262481
|
-
const parent = this.fsw._getWatchedDir(
|
|
262862
|
+
const parent = this.fsw._getWatchedDir(dirname23);
|
|
262482
262863
|
let prevStats = stats;
|
|
262483
262864
|
if (parent.has(basename8))
|
|
262484
262865
|
return;
|
|
@@ -262487,7 +262868,7 @@ class NodeFsHandler {
|
|
|
262487
262868
|
return;
|
|
262488
262869
|
if (!newStats || newStats.mtimeMs === 0) {
|
|
262489
262870
|
try {
|
|
262490
|
-
const newStats2 = await
|
|
262871
|
+
const newStats2 = await stat5(file2);
|
|
262491
262872
|
if (this.fsw.closed)
|
|
262492
262873
|
return;
|
|
262493
262874
|
const at13 = newStats2.atimeMs;
|
|
@@ -262505,7 +262886,7 @@ class NodeFsHandler {
|
|
|
262505
262886
|
prevStats = newStats2;
|
|
262506
262887
|
}
|
|
262507
262888
|
} catch (error48) {
|
|
262508
|
-
this.fsw._remove(
|
|
262889
|
+
this.fsw._remove(dirname23, basename8);
|
|
262509
262890
|
}
|
|
262510
262891
|
} else if (parent.has(basename8)) {
|
|
262511
262892
|
const at13 = newStats.atimeMs;
|
|
@@ -262594,7 +262975,7 @@ class NodeFsHandler {
|
|
|
262594
262975
|
this._addToNodeFs(path19, initialAdd, wh2, depth + 1);
|
|
262595
262976
|
}
|
|
262596
262977
|
}).on(EV.ERROR, this._boundHandleError);
|
|
262597
|
-
return new Promise((
|
|
262978
|
+
return new Promise((resolve16, reject) => {
|
|
262598
262979
|
if (!stream)
|
|
262599
262980
|
return reject();
|
|
262600
262981
|
stream.once(STR_END, () => {
|
|
@@ -262603,7 +262984,7 @@ class NodeFsHandler {
|
|
|
262603
262984
|
return;
|
|
262604
262985
|
}
|
|
262605
262986
|
const wasThrottled = throttler ? throttler.clear() : false;
|
|
262606
|
-
|
|
262987
|
+
resolve16(undefined);
|
|
262607
262988
|
previous.getChildren().filter((item) => {
|
|
262608
262989
|
return item !== directory && !current.has(item);
|
|
262609
262990
|
}).forEach((item) => {
|
|
@@ -262728,11 +263109,11 @@ function createPattern(matcher) {
|
|
|
262728
263109
|
if (matcher.path === string4)
|
|
262729
263110
|
return true;
|
|
262730
263111
|
if (matcher.recursive) {
|
|
262731
|
-
const
|
|
262732
|
-
if (!
|
|
263112
|
+
const relative7 = sp3.relative(matcher.path, string4);
|
|
263113
|
+
if (!relative7) {
|
|
262733
263114
|
return false;
|
|
262734
263115
|
}
|
|
262735
|
-
return !
|
|
263116
|
+
return !relative7.startsWith("..") && !sp3.isAbsolute(relative7);
|
|
262736
263117
|
}
|
|
262737
263118
|
return false;
|
|
262738
263119
|
};
|
|
@@ -263159,7 +263540,7 @@ class FSWatcher extends EventEmitter3 {
|
|
|
263159
263540
|
const fullPath = opts.cwd ? sp3.join(opts.cwd, path19) : path19;
|
|
263160
263541
|
let stats2;
|
|
263161
263542
|
try {
|
|
263162
|
-
stats2 = await
|
|
263543
|
+
stats2 = await stat6(fullPath);
|
|
263163
263544
|
} catch (err) {}
|
|
263164
263545
|
if (!stats2 || this.closed)
|
|
263165
263546
|
return;
|
|
@@ -263263,8 +263644,8 @@ class FSWatcher extends EventEmitter3 {
|
|
|
263263
263644
|
}
|
|
263264
263645
|
return this._userIgnored(path19, stats);
|
|
263265
263646
|
}
|
|
263266
|
-
_isntIgnored(path19,
|
|
263267
|
-
return !this._isIgnored(path19,
|
|
263647
|
+
_isntIgnored(path19, stat7) {
|
|
263648
|
+
return !this._isIgnored(path19, stat7);
|
|
263268
263649
|
}
|
|
263269
263650
|
_getWatchHelpers(path19) {
|
|
263270
263651
|
return new WatchHelper(path19, this.options.followSymlinks, this);
|
|
@@ -263431,7 +263812,7 @@ class WatchBase44 extends EventEmitter4 {
|
|
|
263431
263812
|
ignoreInitial: true
|
|
263432
263813
|
});
|
|
263433
263814
|
watcher.on("all", import_debounce.default(async (_event, path19) => {
|
|
263434
|
-
this.emit("change", name2,
|
|
263815
|
+
this.emit("change", name2, relative7(targetPath, path19));
|
|
263435
263816
|
}, WATCH_DEBOUNCE_MS));
|
|
263436
263817
|
watcher.on("error", (err) => {
|
|
263437
263818
|
this.logger.error(`Watch handler failed for ${targetPath}`, err);
|
|
@@ -263520,7 +263901,7 @@ async function createDevServer(options8) {
|
|
|
263520
263901
|
}
|
|
263521
263902
|
remoteProxy(req, res, next);
|
|
263522
263903
|
});
|
|
263523
|
-
const server = await new Promise((
|
|
263904
|
+
const server = await new Promise((resolve17, reject) => {
|
|
263524
263905
|
const s5 = app.listen(port, "127.0.0.1", (err) => {
|
|
263525
263906
|
if (err) {
|
|
263526
263907
|
if ("code" in err && err.code === "EADDRINUSE") {
|
|
@@ -263529,7 +263910,7 @@ async function createDevServer(options8) {
|
|
|
263529
263910
|
reject(err);
|
|
263530
263911
|
}
|
|
263531
263912
|
} else {
|
|
263532
|
-
|
|
263913
|
+
resolve17(s5);
|
|
263533
263914
|
}
|
|
263534
263915
|
});
|
|
263535
263916
|
});
|
|
@@ -263538,8 +263919,8 @@ async function createDevServer(options8) {
|
|
|
263538
263919
|
broadcastEntityEvent(io6, appId, entityName, event);
|
|
263539
263920
|
};
|
|
263540
263921
|
const base44ConfigWatcher = new WatchBase44({
|
|
263541
|
-
functions:
|
|
263542
|
-
entities:
|
|
263922
|
+
functions: join36(dirname24(project2.configPath), project2.functionsDir),
|
|
263923
|
+
entities: join36(dirname24(project2.configPath), project2.entitiesDir)
|
|
263543
263924
|
}, devLogger);
|
|
263544
263925
|
base44ConfigWatcher.on("change", async (name2) => {
|
|
263545
263926
|
try {
|
|
@@ -263579,13 +263960,13 @@ async function createDevServer(options8) {
|
|
|
263579
263960
|
if (!server.listening) {
|
|
263580
263961
|
return;
|
|
263581
263962
|
}
|
|
263582
|
-
await new Promise((
|
|
263963
|
+
await new Promise((resolve17, reject) => {
|
|
263583
263964
|
server.close((error48) => {
|
|
263584
263965
|
if (error48) {
|
|
263585
263966
|
reject(error48);
|
|
263586
263967
|
return;
|
|
263587
263968
|
}
|
|
263588
|
-
|
|
263969
|
+
resolve17();
|
|
263589
263970
|
});
|
|
263590
263971
|
});
|
|
263591
263972
|
};
|
|
@@ -263656,15 +264037,15 @@ class ServeRunner {
|
|
|
263656
264037
|
return;
|
|
263657
264038
|
}
|
|
263658
264039
|
this.stopping = true;
|
|
263659
|
-
const exited = new Promise((
|
|
264040
|
+
const exited = new Promise((resolve17) => child.once("exit", () => resolve17()));
|
|
263660
264041
|
if (process23.platform === "win32" && child.pid) {
|
|
263661
264042
|
const taskkill = spawn3("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
|
|
263662
264043
|
stdio: "ignore",
|
|
263663
264044
|
windowsHide: true
|
|
263664
264045
|
});
|
|
263665
|
-
await new Promise((
|
|
263666
|
-
taskkill.once("exit", () =>
|
|
263667
|
-
taskkill.once("error", () =>
|
|
264046
|
+
await new Promise((resolve17) => {
|
|
264047
|
+
taskkill.once("exit", () => resolve17());
|
|
264048
|
+
taskkill.once("error", () => resolve17());
|
|
263668
264049
|
});
|
|
263669
264050
|
} else if (child.pid) {
|
|
263670
264051
|
try {
|
|
@@ -263859,13 +264240,13 @@ async function runScript(options8) {
|
|
|
263859
264240
|
}
|
|
263860
264241
|
// src/cli/commands/exec.ts
|
|
263861
264242
|
function readStdin2() {
|
|
263862
|
-
return new Promise((
|
|
264243
|
+
return new Promise((resolve17, reject) => {
|
|
263863
264244
|
let data = "";
|
|
263864
264245
|
process.stdin.setEncoding("utf-8");
|
|
263865
264246
|
process.stdin.on("data", (chunk) => {
|
|
263866
264247
|
data += chunk;
|
|
263867
264248
|
});
|
|
263868
|
-
process.stdin.on("end", () =>
|
|
264249
|
+
process.stdin.on("end", () => resolve17(data));
|
|
263869
264250
|
process.stdin.on("error", reject);
|
|
263870
264251
|
});
|
|
263871
264252
|
}
|
|
@@ -263936,7 +264317,7 @@ Examples:
|
|
|
263936
264317
|
}
|
|
263937
264318
|
|
|
263938
264319
|
// src/cli/commands/project/eject.ts
|
|
263939
|
-
import { resolve as
|
|
264320
|
+
import { resolve as resolve17 } from "node:path";
|
|
263940
264321
|
var import_kebabCase2 = __toESM(require_kebabCase(), 1);
|
|
263941
264322
|
async function eject(ctx, options8, command2) {
|
|
263942
264323
|
const { log, runTask: runTask2, isNonInteractive } = ctx;
|
|
@@ -264000,7 +264381,7 @@ async function eject(ctx, options8, command2) {
|
|
|
264000
264381
|
Ne("Operation cancelled.");
|
|
264001
264382
|
throw new CLIExitError(0);
|
|
264002
264383
|
}
|
|
264003
|
-
const resolvedPath =
|
|
264384
|
+
const resolvedPath = resolve17(selectedPath);
|
|
264004
264385
|
await runTask2("Downloading your project's code...", async (updateMessage) => {
|
|
264005
264386
|
await createProjectFilesForExistingProject({
|
|
264006
264387
|
projectId,
|
|
@@ -264094,7 +264475,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
|
|
|
264094
264475
|
import { release, type } from "node:os";
|
|
264095
264476
|
|
|
264096
264477
|
// ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
264097
|
-
import { dirname as
|
|
264478
|
+
import { dirname as dirname25, posix, sep as sep2 } from "path";
|
|
264098
264479
|
function createModulerModifier() {
|
|
264099
264480
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
264100
264481
|
return async (frames) => {
|
|
@@ -264103,7 +264484,7 @@ function createModulerModifier() {
|
|
|
264103
264484
|
return frames;
|
|
264104
264485
|
};
|
|
264105
264486
|
}
|
|
264106
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
264487
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname25(process.argv[1]) : process.cwd(), isWindows5 = sep2 === "\\") {
|
|
264107
264488
|
const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
|
|
264108
264489
|
return (filename) => {
|
|
264109
264490
|
if (!filename)
|
|
@@ -266381,14 +266762,14 @@ async function addSourceContext(frames) {
|
|
|
266381
266762
|
return frames;
|
|
266382
266763
|
}
|
|
266383
266764
|
function getContextLinesFromFile(path19, ranges, output) {
|
|
266384
|
-
return new Promise((
|
|
266765
|
+
return new Promise((resolve18) => {
|
|
266385
266766
|
const stream = createReadStream3(path19);
|
|
266386
266767
|
const lineReaded = createInterface2({
|
|
266387
266768
|
input: stream
|
|
266388
266769
|
});
|
|
266389
266770
|
function destroyStreamAndResolve() {
|
|
266390
266771
|
stream.destroy();
|
|
266391
|
-
|
|
266772
|
+
resolve18();
|
|
266392
266773
|
}
|
|
266393
266774
|
let lineNumber = 0;
|
|
266394
266775
|
let currentRangeIndex = 0;
|
|
@@ -267500,15 +267881,15 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
267500
267881
|
return true;
|
|
267501
267882
|
if (this.featureFlagsPoller === undefined)
|
|
267502
267883
|
return false;
|
|
267503
|
-
return new Promise((
|
|
267884
|
+
return new Promise((resolve18) => {
|
|
267504
267885
|
const timeout3 = setTimeout(() => {
|
|
267505
267886
|
cleanup();
|
|
267506
|
-
|
|
267887
|
+
resolve18(false);
|
|
267507
267888
|
}, timeoutMs);
|
|
267508
267889
|
const cleanup = this._events.on("localEvaluationFlagsLoaded", (count2) => {
|
|
267509
267890
|
clearTimeout(timeout3);
|
|
267510
267891
|
cleanup();
|
|
267511
|
-
|
|
267892
|
+
resolve18(count2 > 0);
|
|
267512
267893
|
});
|
|
267513
267894
|
});
|
|
267514
267895
|
}
|
|
@@ -268292,9 +268673,9 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
|
|
|
268292
268673
|
});
|
|
268293
268674
|
}
|
|
268294
268675
|
// src/cli/index.ts
|
|
268295
|
-
var __dirname4 =
|
|
268676
|
+
var __dirname4 = dirname26(fileURLToPath6(import.meta.url));
|
|
268296
268677
|
async function runCLI(options8) {
|
|
268297
|
-
ensureNpmAssets(
|
|
268678
|
+
ensureNpmAssets(join37(__dirname4, "../assets"));
|
|
268298
268679
|
const errorReporter = new ErrorReporter;
|
|
268299
268680
|
errorReporter.registerProcessErrorHandlers();
|
|
268300
268681
|
const jsonMode = process.argv.includes("--json");
|
|
@@ -268333,4 +268714,4 @@ export {
|
|
|
268333
268714
|
runCLI
|
|
268334
268715
|
};
|
|
268335
268716
|
|
|
268336
|
-
//# debugId=
|
|
268717
|
+
//# debugId=316B579166FEDD8464756E2164756E21
|