@base44-preview/cli 0.1.8-pr.584.c8b5c9f → 0.1.8-pr.589.9d22ef2
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 +730 -1229
- package/dist/cli/index.js.map +17 -24
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -23352,15 +23352,15 @@ var require_windows = __commonJS((exports, module) => {
|
|
|
23352
23352
|
}
|
|
23353
23353
|
return false;
|
|
23354
23354
|
}
|
|
23355
|
-
function checkStat(
|
|
23356
|
-
if (!
|
|
23355
|
+
function checkStat(stat2, path11, options) {
|
|
23356
|
+
if (!stat2.isSymbolicLink() && !stat2.isFile()) {
|
|
23357
23357
|
return false;
|
|
23358
23358
|
}
|
|
23359
23359
|
return checkPathExt(path11, options);
|
|
23360
23360
|
}
|
|
23361
23361
|
function isexe(path11, options, cb) {
|
|
23362
|
-
fs14.stat(path11, function(er,
|
|
23363
|
-
cb(er, er ? false : checkStat(
|
|
23362
|
+
fs14.stat(path11, function(er, stat2) {
|
|
23363
|
+
cb(er, er ? false : checkStat(stat2, path11, options));
|
|
23364
23364
|
});
|
|
23365
23365
|
}
|
|
23366
23366
|
function sync(path11, options) {
|
|
@@ -23374,20 +23374,20 @@ var require_mode = __commonJS((exports, module) => {
|
|
|
23374
23374
|
isexe.sync = sync;
|
|
23375
23375
|
var fs14 = __require("fs");
|
|
23376
23376
|
function isexe(path11, options, cb) {
|
|
23377
|
-
fs14.stat(path11, function(er,
|
|
23378
|
-
cb(er, er ? false : checkStat(
|
|
23377
|
+
fs14.stat(path11, function(er, stat2) {
|
|
23378
|
+
cb(er, er ? false : checkStat(stat2, options));
|
|
23379
23379
|
});
|
|
23380
23380
|
}
|
|
23381
23381
|
function sync(path11, options) {
|
|
23382
23382
|
return checkStat(fs14.statSync(path11), options);
|
|
23383
23383
|
}
|
|
23384
|
-
function checkStat(
|
|
23385
|
-
return
|
|
23384
|
+
function checkStat(stat2, options) {
|
|
23385
|
+
return stat2.isFile() && checkMode(stat2, options);
|
|
23386
23386
|
}
|
|
23387
|
-
function checkMode(
|
|
23388
|
-
var mod =
|
|
23389
|
-
var uid =
|
|
23390
|
-
var gid =
|
|
23387
|
+
function checkMode(stat2, options) {
|
|
23388
|
+
var mod = stat2.mode;
|
|
23389
|
+
var uid = stat2.uid;
|
|
23390
|
+
var gid = stat2.gid;
|
|
23391
23391
|
var myUid = options.uid !== undefined ? options.uid : process.getuid && process.getuid();
|
|
23392
23392
|
var myGid = options.gid !== undefined ? options.gid : process.getgid && process.getgid();
|
|
23393
23393
|
var u = parseInt("100", 8);
|
|
@@ -23419,12 +23419,12 @@ var require_isexe = __commonJS((exports, module) => {
|
|
|
23419
23419
|
if (typeof Promise !== "function") {
|
|
23420
23420
|
throw new TypeError("callback not provided");
|
|
23421
23421
|
}
|
|
23422
|
-
return new Promise(function(
|
|
23422
|
+
return new Promise(function(resolve4, reject) {
|
|
23423
23423
|
isexe(path11, options || {}, function(er, is) {
|
|
23424
23424
|
if (er) {
|
|
23425
23425
|
reject(er);
|
|
23426
23426
|
} else {
|
|
23427
|
-
|
|
23427
|
+
resolve4(is);
|
|
23428
23428
|
}
|
|
23429
23429
|
});
|
|
23430
23430
|
});
|
|
@@ -23486,27 +23486,27 @@ var require_which = __commonJS((exports, module) => {
|
|
|
23486
23486
|
opt = {};
|
|
23487
23487
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
23488
23488
|
const found = [];
|
|
23489
|
-
const step = (i) => new Promise((
|
|
23489
|
+
const step = (i) => new Promise((resolve4, reject) => {
|
|
23490
23490
|
if (i === pathEnv.length)
|
|
23491
|
-
return opt.all && found.length ?
|
|
23491
|
+
return opt.all && found.length ? resolve4(found) : reject(getNotFoundError(cmd));
|
|
23492
23492
|
const ppRaw = pathEnv[i];
|
|
23493
23493
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
23494
23494
|
const pCmd = path11.join(pathPart, cmd);
|
|
23495
23495
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
23496
|
-
|
|
23496
|
+
resolve4(subStep(p, i, 0));
|
|
23497
23497
|
});
|
|
23498
|
-
const subStep = (p, i, ii) => new Promise((
|
|
23498
|
+
const subStep = (p, i, ii) => new Promise((resolve4, reject) => {
|
|
23499
23499
|
if (ii === pathExt.length)
|
|
23500
|
-
return
|
|
23500
|
+
return resolve4(step(i + 1));
|
|
23501
23501
|
const ext = pathExt[ii];
|
|
23502
23502
|
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
23503
23503
|
if (!er && is) {
|
|
23504
23504
|
if (opt.all)
|
|
23505
23505
|
found.push(p + ext);
|
|
23506
23506
|
else
|
|
23507
|
-
return
|
|
23507
|
+
return resolve4(p + ext);
|
|
23508
23508
|
}
|
|
23509
|
-
return
|
|
23509
|
+
return resolve4(subStep(p, i, ii + 1));
|
|
23510
23510
|
});
|
|
23511
23511
|
});
|
|
23512
23512
|
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
@@ -27034,7 +27034,7 @@ var require_lodash8 = __commonJS((exports, module) => {
|
|
|
27034
27034
|
}
|
|
27035
27035
|
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
|
|
27036
27036
|
});
|
|
27037
|
-
function
|
|
27037
|
+
function join17(array2, separator) {
|
|
27038
27038
|
return array2 == null ? "" : nativeJoin.call(array2, separator);
|
|
27039
27039
|
}
|
|
27040
27040
|
function last(array2) {
|
|
@@ -28966,7 +28966,7 @@ __p += '`;
|
|
|
28966
28966
|
lodash.isUndefined = isUndefined;
|
|
28967
28967
|
lodash.isWeakMap = isWeakMap;
|
|
28968
28968
|
lodash.isWeakSet = isWeakSet;
|
|
28969
|
-
lodash.join =
|
|
28969
|
+
lodash.join = join17;
|
|
28970
28970
|
lodash.kebabCase = kebabCase;
|
|
28971
28971
|
lodash.last = last;
|
|
28972
28972
|
lodash.lastIndexOf = lastIndexOf;
|
|
@@ -31176,7 +31176,7 @@ function cleanDoc(doc2) {
|
|
|
31176
31176
|
return mapDoc(doc2, (currentDoc) => cleanDocFn(currentDoc));
|
|
31177
31177
|
}
|
|
31178
31178
|
function replaceEndOfLine(doc2, replacement = literalline) {
|
|
31179
|
-
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
31179
|
+
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ? join26(replacement, currentDoc.split(`
|
|
31180
31180
|
`)) : currentDoc);
|
|
31181
31181
|
}
|
|
31182
31182
|
function canBreakFn(doc2) {
|
|
@@ -31256,7 +31256,7 @@ function indentIfBreak(contents, options) {
|
|
|
31256
31256
|
negate: options.negate
|
|
31257
31257
|
};
|
|
31258
31258
|
}
|
|
31259
|
-
function
|
|
31259
|
+
function join26(separator, docs) {
|
|
31260
31260
|
assertDoc(separator);
|
|
31261
31261
|
assertDocArray(docs);
|
|
31262
31262
|
const parts = [];
|
|
@@ -31967,7 +31967,7 @@ var init_doc = __esm(() => {
|
|
|
31967
31967
|
MODE_FLAT = Symbol("MODE_FLAT");
|
|
31968
31968
|
DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
|
|
31969
31969
|
builders = {
|
|
31970
|
-
join:
|
|
31970
|
+
join: join26,
|
|
31971
31971
|
line,
|
|
31972
31972
|
softline,
|
|
31973
31973
|
hardline,
|
|
@@ -120385,7 +120385,7 @@ function skipVoid(str, ptr, banNewLines, banComments) {
|
|
|
120385
120385
|
ptr++;
|
|
120386
120386
|
return banComments || c24 !== "#" ? ptr : skipVoid(str, skipComment(str, ptr), banNewLines);
|
|
120387
120387
|
}
|
|
120388
|
-
function skipUntil(str, ptr,
|
|
120388
|
+
function skipUntil(str, ptr, sep, end, banNewLines = false) {
|
|
120389
120389
|
if (!end) {
|
|
120390
120390
|
ptr = indexOfNewline(str, ptr);
|
|
120391
120391
|
return ptr < 0 ? str.length : ptr;
|
|
@@ -120394,7 +120394,7 @@ function skipUntil(str, ptr, sep2, end, banNewLines = false) {
|
|
|
120394
120394
|
let c24 = str[i5];
|
|
120395
120395
|
if (c24 === "#") {
|
|
120396
120396
|
i5 = indexOfNewline(str, i5);
|
|
120397
|
-
} else if (c24 ===
|
|
120397
|
+
} else if (c24 === sep) {
|
|
120398
120398
|
return i5 + 1;
|
|
120399
120399
|
} else if (c24 === end || banNewLines && (c24 === `
|
|
120400
120400
|
` || c24 === "\r" && str[i5 + 1] === `
|
|
@@ -121174,7 +121174,7 @@ function getDataProtocolModuleFormat(parsed) {
|
|
|
121174
121174
|
const { 1: mime } = /^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec(parsed.pathname) || [null, null, null];
|
|
121175
121175
|
return mimeToFormat(mime);
|
|
121176
121176
|
}
|
|
121177
|
-
function
|
|
121177
|
+
function extname(url3) {
|
|
121178
121178
|
const pathname = url3.pathname;
|
|
121179
121179
|
let index = pathname.length;
|
|
121180
121180
|
while (index--) {
|
|
@@ -121189,7 +121189,7 @@ function extname2(url3) {
|
|
|
121189
121189
|
return "";
|
|
121190
121190
|
}
|
|
121191
121191
|
function getFileProtocolModuleFormat(url3, _context, ignoreErrors) {
|
|
121192
|
-
const value =
|
|
121192
|
+
const value = extname(url3);
|
|
121193
121193
|
if (value === ".js") {
|
|
121194
121194
|
const packageType = getPackageType(url3);
|
|
121195
121195
|
if (packageType !== "none") {
|
|
@@ -123904,14 +123904,14 @@ async function printToDoc(originalText, options8) {
|
|
|
123904
123904
|
async function printDocToString2(doc2, options8) {
|
|
123905
123905
|
return printDocToStringWithoutNormalizeOptions(doc2, await normalize_format_options_default(options8));
|
|
123906
123906
|
}
|
|
123907
|
-
function createParsersAndPrinters(
|
|
123907
|
+
function createParsersAndPrinters(modules) {
|
|
123908
123908
|
const parsers2 = /* @__PURE__ */ Object.create(null);
|
|
123909
123909
|
const printers2 = /* @__PURE__ */ Object.create(null);
|
|
123910
123910
|
for (const {
|
|
123911
123911
|
importPlugin: importPlugin2,
|
|
123912
123912
|
parsers: parserNames = [],
|
|
123913
123913
|
printers: printerNames = []
|
|
123914
|
-
} of
|
|
123914
|
+
} of modules) {
|
|
123915
123915
|
const loadPlugin2 = async () => {
|
|
123916
123916
|
const plugin = await importPlugin2();
|
|
123917
123917
|
Object.assign(parsers2, plugin.parsers);
|
|
@@ -136881,7 +136881,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
136881
136881
|
return mapDoc2(doc2, (currentDoc) => cleanDocFn2(currentDoc));
|
|
136882
136882
|
}
|
|
136883
136883
|
function replaceEndOfLine2(doc2, replacement = literalline2) {
|
|
136884
|
-
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
136884
|
+
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ? join28(replacement, currentDoc.split(`
|
|
136885
136885
|
`)) : currentDoc);
|
|
136886
136886
|
}
|
|
136887
136887
|
function canBreakFn2(doc2) {
|
|
@@ -136967,7 +136967,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
136967
136967
|
negate: options8.negate
|
|
136968
136968
|
};
|
|
136969
136969
|
}
|
|
136970
|
-
function
|
|
136970
|
+
function join28(separator, docs) {
|
|
136971
136971
|
assertDoc2(separator);
|
|
136972
136972
|
assertDocArray2(docs);
|
|
136973
136973
|
const parts = [];
|
|
@@ -137632,7 +137632,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
137632
137632
|
}
|
|
137633
137633
|
}
|
|
137634
137634
|
var builders2 = {
|
|
137635
|
-
join:
|
|
137635
|
+
join: join28,
|
|
137636
137636
|
line: line3,
|
|
137637
137637
|
softline: softline2,
|
|
137638
137638
|
hardline: hardline4,
|
|
@@ -138287,11 +138287,11 @@ var require_prettier = __commonJS((exports, module) => {
|
|
|
138287
138287
|
var require_formatter = __commonJS((exports) => {
|
|
138288
138288
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
|
|
138289
138289
|
function adopt(value) {
|
|
138290
|
-
return value instanceof P9 ? value : new P9(function(
|
|
138291
|
-
|
|
138290
|
+
return value instanceof P9 ? value : new P9(function(resolve13) {
|
|
138291
|
+
resolve13(value);
|
|
138292
138292
|
});
|
|
138293
138293
|
}
|
|
138294
|
-
return new (P9 || (P9 = Promise))(function(
|
|
138294
|
+
return new (P9 || (P9 = Promise))(function(resolve13, reject) {
|
|
138295
138295
|
function fulfilled(value) {
|
|
138296
138296
|
try {
|
|
138297
138297
|
step(generator.next(value));
|
|
@@ -138307,7 +138307,7 @@ var require_formatter = __commonJS((exports) => {
|
|
|
138307
138307
|
}
|
|
138308
138308
|
}
|
|
138309
138309
|
function step(result) {
|
|
138310
|
-
result.done ?
|
|
138310
|
+
result.done ? resolve13(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
138311
138311
|
}
|
|
138312
138312
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
138313
138313
|
});
|
|
@@ -142960,7 +142960,7 @@ var require_url = __commonJS((exports) => {
|
|
|
142960
142960
|
};
|
|
142961
142961
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
142962
142962
|
exports.parse = undefined;
|
|
142963
|
-
exports.resolve =
|
|
142963
|
+
exports.resolve = resolve13;
|
|
142964
142964
|
exports.cwd = cwd;
|
|
142965
142965
|
exports.getProtocol = getProtocol;
|
|
142966
142966
|
exports.getExtension = getExtension;
|
|
@@ -142972,7 +142972,7 @@ var require_url = __commonJS((exports) => {
|
|
|
142972
142972
|
exports.fromFileSystemPath = fromFileSystemPath;
|
|
142973
142973
|
exports.toFileSystemPath = toFileSystemPath;
|
|
142974
142974
|
exports.safePointerToPath = safePointerToPath;
|
|
142975
|
-
exports.relative =
|
|
142975
|
+
exports.relative = relative4;
|
|
142976
142976
|
var convert_path_to_posix_1 = __importDefault(require_convert_path_to_posix());
|
|
142977
142977
|
var path_1 = __importStar(__require("path"));
|
|
142978
142978
|
var forwardSlashPattern = /\//g;
|
|
@@ -142988,7 +142988,7 @@ var require_url = __commonJS((exports) => {
|
|
|
142988
142988
|
var urlDecodePatterns = [/%23/g, "#", /%24/g, "$", /%26/g, "&", /%2C/g, ",", /%40/g, "@"];
|
|
142989
142989
|
var parse11 = (u4) => new URL(u4);
|
|
142990
142990
|
exports.parse = parse11;
|
|
142991
|
-
function
|
|
142991
|
+
function resolve13(from, to5) {
|
|
142992
142992
|
const fromUrl = new URL((0, convert_path_to_posix_1.default)(from), "https://aaa.nonexistanturl.com");
|
|
142993
142993
|
const resolvedUrl = new URL((0, convert_path_to_posix_1.default)(to5), fromUrl);
|
|
142994
142994
|
const endSpaces = to5.match(/(\s*)$/)?.[1] || "";
|
|
@@ -143122,9 +143122,9 @@ var require_url = __commonJS((exports) => {
|
|
|
143122
143122
|
return decodeURIComponent(value).replace(jsonPointerSlash, "/").replace(jsonPointerTilde, "~");
|
|
143123
143123
|
});
|
|
143124
143124
|
}
|
|
143125
|
-
function
|
|
143125
|
+
function relative4(from, to5) {
|
|
143126
143126
|
if (!isFileSystemPath(from) || !isFileSystemPath(to5)) {
|
|
143127
|
-
return
|
|
143127
|
+
return resolve13(from, to5);
|
|
143128
143128
|
}
|
|
143129
143129
|
const fromDir = path_1.default.dirname(stripHash(from));
|
|
143130
143130
|
const toPath4 = stripHash(to5);
|
|
@@ -143800,7 +143800,7 @@ var require_plugins = __commonJS((exports) => {
|
|
|
143800
143800
|
let plugin;
|
|
143801
143801
|
let lastError;
|
|
143802
143802
|
let index = 0;
|
|
143803
|
-
return new Promise((
|
|
143803
|
+
return new Promise((resolve13, reject) => {
|
|
143804
143804
|
runNextPlugin();
|
|
143805
143805
|
function runNextPlugin() {
|
|
143806
143806
|
plugin = plugins[index++];
|
|
@@ -143828,7 +143828,7 @@ var require_plugins = __commonJS((exports) => {
|
|
|
143828
143828
|
}
|
|
143829
143829
|
}
|
|
143830
143830
|
function onSuccess(result) {
|
|
143831
|
-
|
|
143831
|
+
resolve13({
|
|
143832
143832
|
plugin,
|
|
143833
143833
|
result
|
|
143834
143834
|
});
|
|
@@ -145161,11 +145161,11 @@ var require_lib3 = __commonJS((exports) => {
|
|
|
145161
145161
|
var require_resolver = __commonJS((exports) => {
|
|
145162
145162
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
|
|
145163
145163
|
function adopt(value) {
|
|
145164
|
-
return value instanceof P9 ? value : new P9(function(
|
|
145165
|
-
|
|
145164
|
+
return value instanceof P9 ? value : new P9(function(resolve13) {
|
|
145165
|
+
resolve13(value);
|
|
145166
145166
|
});
|
|
145167
145167
|
}
|
|
145168
|
-
return new (P9 || (P9 = Promise))(function(
|
|
145168
|
+
return new (P9 || (P9 = Promise))(function(resolve13, reject) {
|
|
145169
145169
|
function fulfilled(value) {
|
|
145170
145170
|
try {
|
|
145171
145171
|
step(generator.next(value));
|
|
@@ -145181,7 +145181,7 @@ var require_resolver = __commonJS((exports) => {
|
|
|
145181
145181
|
}
|
|
145182
145182
|
}
|
|
145183
145183
|
function step(result) {
|
|
145184
|
-
result.done ?
|
|
145184
|
+
result.done ? resolve13(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
145185
145185
|
}
|
|
145186
145186
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
145187
145187
|
});
|
|
@@ -145302,11 +145302,11 @@ var require_optionValidator = __commonJS((exports) => {
|
|
|
145302
145302
|
var require_src3 = __commonJS((exports) => {
|
|
145303
145303
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
|
|
145304
145304
|
function adopt(value) {
|
|
145305
|
-
return value instanceof P9 ? value : new P9(function(
|
|
145306
|
-
|
|
145305
|
+
return value instanceof P9 ? value : new P9(function(resolve13) {
|
|
145306
|
+
resolve13(value);
|
|
145307
145307
|
});
|
|
145308
145308
|
}
|
|
145309
|
-
return new (P9 || (P9 = Promise))(function(
|
|
145309
|
+
return new (P9 || (P9 = Promise))(function(resolve13, reject) {
|
|
145310
145310
|
function fulfilled(value) {
|
|
145311
145311
|
try {
|
|
145312
145312
|
step(generator.next(value));
|
|
@@ -145322,7 +145322,7 @@ var require_src3 = __commonJS((exports) => {
|
|
|
145322
145322
|
}
|
|
145323
145323
|
}
|
|
145324
145324
|
function step(result) {
|
|
145325
|
-
result.done ?
|
|
145325
|
+
result.done ? resolve13(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
145326
145326
|
}
|
|
145327
145327
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
145328
145328
|
});
|
|
@@ -146451,7 +146451,7 @@ var require_depd = __commonJS((exports, module) => {
|
|
|
146451
146451
|
* Copyright(c) 2014-2018 Douglas Christopher Wilson
|
|
146452
146452
|
* MIT Licensed
|
|
146453
146453
|
*/
|
|
146454
|
-
var
|
|
146454
|
+
var relative4 = __require("path").relative;
|
|
146455
146455
|
module.exports = depd;
|
|
146456
146456
|
var basePath = process.cwd();
|
|
146457
146457
|
function containsNamespace(str, namespace) {
|
|
@@ -146647,7 +146647,7 @@ var require_depd = __commonJS((exports, module) => {
|
|
|
146647
146647
|
return formatted;
|
|
146648
146648
|
}
|
|
146649
146649
|
function formatLocation(callSite) {
|
|
146650
|
-
return
|
|
146650
|
+
return relative4(basePath, callSite[0]) + ":" + callSite[1] + ":" + callSite[2];
|
|
146651
146651
|
}
|
|
146652
146652
|
function getStack() {
|
|
146653
146653
|
var limit = Error.stackTraceLimit;
|
|
@@ -150643,7 +150643,7 @@ var require_dbcs_data = __commonJS((exports, module) => {
|
|
|
150643
150643
|
// ../../node_modules/iconv-lite/encodings/index.js
|
|
150644
150644
|
var require_encodings = __commonJS((exports, module) => {
|
|
150645
150645
|
var mergeModules = require_merge_exports();
|
|
150646
|
-
var
|
|
150646
|
+
var modules = [
|
|
150647
150647
|
require_internal(),
|
|
150648
150648
|
require_utf32(),
|
|
150649
150649
|
require_utf16(),
|
|
@@ -150654,8 +150654,8 @@ var require_encodings = __commonJS((exports, module) => {
|
|
|
150654
150654
|
require_dbcs_codec(),
|
|
150655
150655
|
require_dbcs_data()
|
|
150656
150656
|
];
|
|
150657
|
-
for (i5 = 0;i5 <
|
|
150658
|
-
module =
|
|
150657
|
+
for (i5 = 0;i5 < modules.length; i5++) {
|
|
150658
|
+
module = modules[i5];
|
|
150659
150659
|
mergeModules(exports, module);
|
|
150660
150660
|
}
|
|
150661
150661
|
var module;
|
|
@@ -150984,11 +150984,11 @@ var require_raw_body = __commonJS((exports, module) => {
|
|
|
150984
150984
|
if (done) {
|
|
150985
150985
|
return readStream(stream, encoding, length, limit, wrap(done));
|
|
150986
150986
|
}
|
|
150987
|
-
return new Promise(function executor(
|
|
150987
|
+
return new Promise(function executor(resolve13, reject) {
|
|
150988
150988
|
readStream(stream, encoding, length, limit, function onRead2(err, buf) {
|
|
150989
150989
|
if (err)
|
|
150990
150990
|
return reject(err);
|
|
150991
|
-
|
|
150991
|
+
resolve13(buf);
|
|
150992
150992
|
});
|
|
150993
150993
|
});
|
|
150994
150994
|
}
|
|
@@ -160792,7 +160792,7 @@ var require_mime_types = __commonJS((exports) => {
|
|
|
160792
160792
|
* MIT Licensed
|
|
160793
160793
|
*/
|
|
160794
160794
|
var db2 = require_db();
|
|
160795
|
-
var
|
|
160795
|
+
var extname2 = __require("path").extname;
|
|
160796
160796
|
var mimeScore = require_mimeScore();
|
|
160797
160797
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
160798
160798
|
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
@@ -160849,7 +160849,7 @@ var require_mime_types = __commonJS((exports) => {
|
|
|
160849
160849
|
if (!path18 || typeof path18 !== "string") {
|
|
160850
160850
|
return false;
|
|
160851
160851
|
}
|
|
160852
|
-
var extension2 =
|
|
160852
|
+
var extension2 = extname2("x." + path18).toLowerCase().slice(1);
|
|
160853
160853
|
if (!extension2) {
|
|
160854
160854
|
return false;
|
|
160855
160855
|
}
|
|
@@ -164109,16 +164109,16 @@ var require_view = __commonJS((exports, module) => {
|
|
|
164109
164109
|
var debug = require_src4()("express:view");
|
|
164110
164110
|
var path18 = __require("node:path");
|
|
164111
164111
|
var fs28 = __require("node:fs");
|
|
164112
|
-
var
|
|
164112
|
+
var dirname20 = path18.dirname;
|
|
164113
164113
|
var basename7 = path18.basename;
|
|
164114
|
-
var
|
|
164115
|
-
var
|
|
164116
|
-
var
|
|
164114
|
+
var extname2 = path18.extname;
|
|
164115
|
+
var join29 = path18.join;
|
|
164116
|
+
var resolve13 = path18.resolve;
|
|
164117
164117
|
module.exports = View;
|
|
164118
164118
|
function View(name2, options8) {
|
|
164119
164119
|
var opts = options8 || {};
|
|
164120
164120
|
this.defaultEngine = opts.defaultEngine;
|
|
164121
|
-
this.ext =
|
|
164121
|
+
this.ext = extname2(name2);
|
|
164122
164122
|
this.name = name2;
|
|
164123
164123
|
this.root = opts.root;
|
|
164124
164124
|
if (!this.ext && !this.defaultEngine) {
|
|
@@ -164147,8 +164147,8 @@ var require_view = __commonJS((exports, module) => {
|
|
|
164147
164147
|
debug('lookup "%s"', name2);
|
|
164148
164148
|
for (var i5 = 0;i5 < roots.length && !path19; i5++) {
|
|
164149
164149
|
var root2 = roots[i5];
|
|
164150
|
-
var loc =
|
|
164151
|
-
var dir =
|
|
164150
|
+
var loc = resolve13(root2, name2);
|
|
164151
|
+
var dir = dirname20(loc);
|
|
164152
164152
|
var file2 = basename7(loc);
|
|
164153
164153
|
path19 = this.resolve(dir, file2);
|
|
164154
164154
|
}
|
|
@@ -164172,16 +164172,16 @@ var require_view = __commonJS((exports, module) => {
|
|
|
164172
164172
|
});
|
|
164173
164173
|
sync = false;
|
|
164174
164174
|
};
|
|
164175
|
-
View.prototype.resolve = function
|
|
164175
|
+
View.prototype.resolve = function resolve14(dir, file2) {
|
|
164176
164176
|
var ext = this.ext;
|
|
164177
|
-
var path19 =
|
|
164178
|
-
var
|
|
164179
|
-
if (
|
|
164177
|
+
var path19 = join29(dir, file2);
|
|
164178
|
+
var stat3 = tryStat(path19);
|
|
164179
|
+
if (stat3 && stat3.isFile()) {
|
|
164180
164180
|
return path19;
|
|
164181
164181
|
}
|
|
164182
|
-
path19 =
|
|
164183
|
-
|
|
164184
|
-
if (
|
|
164182
|
+
path19 = join29(dir, basename7(file2, ext), "index" + ext);
|
|
164183
|
+
stat3 = tryStat(path19);
|
|
164184
|
+
if (stat3 && stat3.isFile()) {
|
|
164185
164185
|
return path19;
|
|
164186
164186
|
}
|
|
164187
164187
|
};
|
|
@@ -164232,9 +164232,9 @@ var require_etag = __commonJS((exports, module) => {
|
|
|
164232
164232
|
}
|
|
164233
164233
|
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";
|
|
164234
164234
|
}
|
|
164235
|
-
function stattag(
|
|
164236
|
-
var mtime =
|
|
164237
|
-
var size =
|
|
164235
|
+
function stattag(stat3) {
|
|
164236
|
+
var mtime = stat3.mtime.getTime().toString(16);
|
|
164237
|
+
var size = stat3.size.toString(16);
|
|
164238
164238
|
return '"' + size + "-" + mtime + '"';
|
|
164239
164239
|
}
|
|
164240
164240
|
});
|
|
@@ -166331,7 +166331,7 @@ var require_application = __commonJS((exports, module) => {
|
|
|
166331
166331
|
var compileETag = require_utils10().compileETag;
|
|
166332
166332
|
var compileQueryParser = require_utils10().compileQueryParser;
|
|
166333
166333
|
var compileTrust = require_utils10().compileTrust;
|
|
166334
|
-
var
|
|
166334
|
+
var resolve13 = __require("node:path").resolve;
|
|
166335
166335
|
var once9 = require_once();
|
|
166336
166336
|
var Router = require_router();
|
|
166337
166337
|
var slice = Array.prototype.slice;
|
|
@@ -166385,7 +166385,7 @@ var require_application = __commonJS((exports, module) => {
|
|
|
166385
166385
|
this.mountpath = "/";
|
|
166386
166386
|
this.locals.settings = this.settings;
|
|
166387
166387
|
this.set("view", View);
|
|
166388
|
-
this.set("views",
|
|
166388
|
+
this.set("views", resolve13("views"));
|
|
166389
166389
|
this.set("jsonp callback name", "callback");
|
|
166390
166390
|
if (env4 === "production") {
|
|
166391
166391
|
this.enable("view cache");
|
|
@@ -167873,11 +167873,11 @@ var require_send = __commonJS((exports, module) => {
|
|
|
167873
167873
|
var statuses = require_statuses();
|
|
167874
167874
|
var Stream2 = __require("stream");
|
|
167875
167875
|
var util2 = __require("util");
|
|
167876
|
-
var
|
|
167877
|
-
var
|
|
167876
|
+
var extname2 = path18.extname;
|
|
167877
|
+
var join29 = path18.join;
|
|
167878
167878
|
var normalize2 = path18.normalize;
|
|
167879
|
-
var
|
|
167880
|
-
var
|
|
167879
|
+
var resolve13 = path18.resolve;
|
|
167880
|
+
var sep = path18.sep;
|
|
167881
167881
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
167882
167882
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1000;
|
|
167883
167883
|
var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
|
|
@@ -167905,7 +167905,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
167905
167905
|
this._maxage = opts.maxAge || opts.maxage;
|
|
167906
167906
|
this._maxage = typeof this._maxage === "string" ? ms9(this._maxage) : Number(this._maxage);
|
|
167907
167907
|
this._maxage = !isNaN(this._maxage) ? Math.min(Math.max(0, this._maxage), MAX_MAXAGE) : 0;
|
|
167908
|
-
this._root = opts.root ?
|
|
167908
|
+
this._root = opts.root ? resolve13(opts.root) : null;
|
|
167909
167909
|
}
|
|
167910
167910
|
util2.inherits(SendStream, Stream2);
|
|
167911
167911
|
SendStream.prototype.error = function error48(status, err) {
|
|
@@ -168038,23 +168038,23 @@ var require_send = __commonJS((exports, module) => {
|
|
|
168038
168038
|
var parts;
|
|
168039
168039
|
if (root2 !== null) {
|
|
168040
168040
|
if (path19) {
|
|
168041
|
-
path19 = normalize2("." +
|
|
168041
|
+
path19 = normalize2("." + sep + path19);
|
|
168042
168042
|
}
|
|
168043
168043
|
if (UP_PATH_REGEXP.test(path19)) {
|
|
168044
168044
|
debug('malicious path "%s"', path19);
|
|
168045
168045
|
this.error(403);
|
|
168046
168046
|
return res;
|
|
168047
168047
|
}
|
|
168048
|
-
parts = path19.split(
|
|
168049
|
-
path19 = normalize2(
|
|
168048
|
+
parts = path19.split(sep);
|
|
168049
|
+
path19 = normalize2(join29(root2, path19));
|
|
168050
168050
|
} else {
|
|
168051
168051
|
if (UP_PATH_REGEXP.test(path19)) {
|
|
168052
168052
|
debug('malicious path "%s"', path19);
|
|
168053
168053
|
this.error(403);
|
|
168054
168054
|
return res;
|
|
168055
168055
|
}
|
|
168056
|
-
parts = normalize2(path19).split(
|
|
168057
|
-
path19 =
|
|
168056
|
+
parts = normalize2(path19).split(sep);
|
|
168057
|
+
path19 = resolve13(path19);
|
|
168058
168058
|
}
|
|
168059
168059
|
if (containsDotFile(parts)) {
|
|
168060
168060
|
debug('%s dotfile "%s"', this._dotfiles, path19);
|
|
@@ -168077,8 +168077,8 @@ var require_send = __commonJS((exports, module) => {
|
|
|
168077
168077
|
this.sendFile(path19);
|
|
168078
168078
|
return res;
|
|
168079
168079
|
};
|
|
168080
|
-
SendStream.prototype.send = function send2(path19,
|
|
168081
|
-
var len =
|
|
168080
|
+
SendStream.prototype.send = function send2(path19, stat3) {
|
|
168081
|
+
var len = stat3.size;
|
|
168082
168082
|
var options8 = this.options;
|
|
168083
168083
|
var opts = {};
|
|
168084
168084
|
var res = this.res;
|
|
@@ -168090,7 +168090,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
168090
168090
|
return;
|
|
168091
168091
|
}
|
|
168092
168092
|
debug('pipe "%s"', path19);
|
|
168093
|
-
this.setHeader(path19,
|
|
168093
|
+
this.setHeader(path19, stat3);
|
|
168094
168094
|
this.type(path19);
|
|
168095
168095
|
if (this.isConditionalGET()) {
|
|
168096
168096
|
if (this.isPreconditionFailure()) {
|
|
@@ -168147,19 +168147,19 @@ var require_send = __commonJS((exports, module) => {
|
|
|
168147
168147
|
var i5 = 0;
|
|
168148
168148
|
var self2 = this;
|
|
168149
168149
|
debug('stat "%s"', path19);
|
|
168150
|
-
fs28.stat(path19, function onstat(err,
|
|
168151
|
-
var pathEndsWithSep = path19[path19.length - 1] ===
|
|
168152
|
-
if (err && err.code === "ENOENT" && !
|
|
168150
|
+
fs28.stat(path19, function onstat(err, stat3) {
|
|
168151
|
+
var pathEndsWithSep = path19[path19.length - 1] === sep;
|
|
168152
|
+
if (err && err.code === "ENOENT" && !extname2(path19) && !pathEndsWithSep) {
|
|
168153
168153
|
return next(err);
|
|
168154
168154
|
}
|
|
168155
168155
|
if (err)
|
|
168156
168156
|
return self2.onStatError(err);
|
|
168157
|
-
if (
|
|
168157
|
+
if (stat3.isDirectory())
|
|
168158
168158
|
return self2.redirect(path19);
|
|
168159
168159
|
if (pathEndsWithSep)
|
|
168160
168160
|
return self2.error(404);
|
|
168161
|
-
self2.emit("file", path19,
|
|
168162
|
-
self2.send(path19,
|
|
168161
|
+
self2.emit("file", path19, stat3);
|
|
168162
|
+
self2.send(path19, stat3);
|
|
168163
168163
|
});
|
|
168164
168164
|
function next(err) {
|
|
168165
168165
|
if (self2._extensions.length <= i5) {
|
|
@@ -168167,13 +168167,13 @@ var require_send = __commonJS((exports, module) => {
|
|
|
168167
168167
|
}
|
|
168168
168168
|
var p4 = path19 + "." + self2._extensions[i5++];
|
|
168169
168169
|
debug('stat "%s"', p4);
|
|
168170
|
-
fs28.stat(p4, function(err2,
|
|
168170
|
+
fs28.stat(p4, function(err2, stat3) {
|
|
168171
168171
|
if (err2)
|
|
168172
168172
|
return next(err2);
|
|
168173
|
-
if (
|
|
168173
|
+
if (stat3.isDirectory())
|
|
168174
168174
|
return next();
|
|
168175
|
-
self2.emit("file", p4,
|
|
168176
|
-
self2.send(p4,
|
|
168175
|
+
self2.emit("file", p4, stat3);
|
|
168176
|
+
self2.send(p4, stat3);
|
|
168177
168177
|
});
|
|
168178
168178
|
}
|
|
168179
168179
|
};
|
|
@@ -168186,15 +168186,15 @@ var require_send = __commonJS((exports, module) => {
|
|
|
168186
168186
|
return self2.onStatError(err);
|
|
168187
168187
|
return self2.error(404);
|
|
168188
168188
|
}
|
|
168189
|
-
var p4 =
|
|
168189
|
+
var p4 = join29(path19, self2._index[i5]);
|
|
168190
168190
|
debug('stat "%s"', p4);
|
|
168191
|
-
fs28.stat(p4, function(err2,
|
|
168191
|
+
fs28.stat(p4, function(err2, stat3) {
|
|
168192
168192
|
if (err2)
|
|
168193
168193
|
return next(err2);
|
|
168194
|
-
if (
|
|
168194
|
+
if (stat3.isDirectory())
|
|
168195
168195
|
return next();
|
|
168196
|
-
self2.emit("file", p4,
|
|
168197
|
-
self2.send(p4,
|
|
168196
|
+
self2.emit("file", p4, stat3);
|
|
168197
|
+
self2.send(p4, stat3);
|
|
168198
168198
|
});
|
|
168199
168199
|
}
|
|
168200
168200
|
next();
|
|
@@ -168221,14 +168221,14 @@ var require_send = __commonJS((exports, module) => {
|
|
|
168221
168221
|
var res = this.res;
|
|
168222
168222
|
if (res.getHeader("Content-Type"))
|
|
168223
168223
|
return;
|
|
168224
|
-
var ext =
|
|
168224
|
+
var ext = extname2(path19);
|
|
168225
168225
|
var type2 = mime.contentType(ext) || "application/octet-stream";
|
|
168226
168226
|
debug("content-type %s", type2);
|
|
168227
168227
|
res.setHeader("Content-Type", type2);
|
|
168228
168228
|
};
|
|
168229
|
-
SendStream.prototype.setHeader = function setHeader(path19,
|
|
168229
|
+
SendStream.prototype.setHeader = function setHeader(path19, stat3) {
|
|
168230
168230
|
var res = this.res;
|
|
168231
|
-
this.emit("headers", res, path19,
|
|
168231
|
+
this.emit("headers", res, path19, stat3);
|
|
168232
168232
|
if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
|
|
168233
168233
|
debug("accept ranges");
|
|
168234
168234
|
res.setHeader("Accept-Ranges", "bytes");
|
|
@@ -168242,12 +168242,12 @@ var require_send = __commonJS((exports, module) => {
|
|
|
168242
168242
|
res.setHeader("Cache-Control", cacheControl);
|
|
168243
168243
|
}
|
|
168244
168244
|
if (this._lastModified && !res.getHeader("Last-Modified")) {
|
|
168245
|
-
var modified =
|
|
168245
|
+
var modified = stat3.mtime.toUTCString();
|
|
168246
168246
|
debug("modified %s", modified);
|
|
168247
168247
|
res.setHeader("Last-Modified", modified);
|
|
168248
168248
|
}
|
|
168249
168249
|
if (this._etag && !res.getHeader("ETag")) {
|
|
168250
|
-
var val = etag(
|
|
168250
|
+
var val = etag(stat3);
|
|
168251
168251
|
debug("etag %s", val);
|
|
168252
168252
|
res.setHeader("ETag", val);
|
|
168253
168253
|
}
|
|
@@ -168381,8 +168381,8 @@ var require_response = __commonJS((exports, module) => {
|
|
|
168381
168381
|
var setCharset = require_utils10().setCharset;
|
|
168382
168382
|
var cookie = require_cookie();
|
|
168383
168383
|
var send = require_send();
|
|
168384
|
-
var
|
|
168385
|
-
var
|
|
168384
|
+
var extname2 = path18.extname;
|
|
168385
|
+
var resolve13 = path18.resolve;
|
|
168386
168386
|
var vary = require_vary();
|
|
168387
168387
|
var { Buffer: Buffer7 } = __require("node:buffer");
|
|
168388
168388
|
var res = Object.create(http.ServerResponse.prototype);
|
|
@@ -168591,7 +168591,7 @@ var require_response = __commonJS((exports, module) => {
|
|
|
168591
168591
|
}
|
|
168592
168592
|
opts = Object.create(opts);
|
|
168593
168593
|
opts.headers = headers;
|
|
168594
|
-
var fullPath = !opts.root ?
|
|
168594
|
+
var fullPath = !opts.root ? resolve13(path19) : path19;
|
|
168595
168595
|
return this.sendFile(fullPath, opts, done);
|
|
168596
168596
|
};
|
|
168597
168597
|
res.contentType = res.type = function contentType(type) {
|
|
@@ -168622,7 +168622,7 @@ var require_response = __commonJS((exports, module) => {
|
|
|
168622
168622
|
};
|
|
168623
168623
|
res.attachment = function attachment(filename) {
|
|
168624
168624
|
if (filename) {
|
|
168625
|
-
this.type(
|
|
168625
|
+
this.type(extname2(filename));
|
|
168626
168626
|
}
|
|
168627
168627
|
this.set("Content-Disposition", contentDisposition(filename));
|
|
168628
168628
|
return this;
|
|
@@ -168852,7 +168852,7 @@ var require_serve_static = __commonJS((exports, module) => {
|
|
|
168852
168852
|
var encodeUrl = require_encodeurl();
|
|
168853
168853
|
var escapeHtml = require_escape_html();
|
|
168854
168854
|
var parseUrl = require_parseurl();
|
|
168855
|
-
var
|
|
168855
|
+
var resolve13 = __require("path").resolve;
|
|
168856
168856
|
var send = require_send();
|
|
168857
168857
|
var url3 = __require("url");
|
|
168858
168858
|
module.exports = serveStatic;
|
|
@@ -168871,7 +168871,7 @@ var require_serve_static = __commonJS((exports, module) => {
|
|
|
168871
168871
|
throw new TypeError("option setHeaders must be function");
|
|
168872
168872
|
}
|
|
168873
168873
|
opts.maxage = opts.maxage || opts.maxAge || 0;
|
|
168874
|
-
opts.root =
|
|
168874
|
+
opts.root = resolve13(root2);
|
|
168875
168875
|
var onDirectory = redirect ? createRedirectDirectoryListener() : createNotFoundDirectoryListener();
|
|
168876
168876
|
return function serveStatic2(req, res, next) {
|
|
168877
168877
|
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
@@ -169795,8 +169795,8 @@ var require_follow_redirects = __commonJS((exports, module) => {
|
|
|
169795
169795
|
}
|
|
169796
169796
|
return parsed;
|
|
169797
169797
|
}
|
|
169798
|
-
function resolveUrl(
|
|
169799
|
-
return useNativeURL ? new URL2(
|
|
169798
|
+
function resolveUrl(relative4, base) {
|
|
169799
|
+
return useNativeURL ? new URL2(relative4, base) : parseUrl(url3.resolve(base, relative4));
|
|
169800
169800
|
}
|
|
169801
169801
|
function validateUrl(input) {
|
|
169802
169802
|
if (/^\[/.test(input.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input.hostname)) {
|
|
@@ -172245,8 +172245,8 @@ var require_executor = __commonJS((exports, module) => {
|
|
|
172245
172245
|
}
|
|
172246
172246
|
resetBuffer() {
|
|
172247
172247
|
this.buffer = new Waterfall;
|
|
172248
|
-
this.buffer.chain(new Promise((
|
|
172249
|
-
this._triggerBuffer =
|
|
172248
|
+
this.buffer.chain(new Promise((resolve13) => {
|
|
172249
|
+
this._triggerBuffer = resolve13;
|
|
172250
172250
|
}));
|
|
172251
172251
|
if (this.ready)
|
|
172252
172252
|
this._triggerBuffer();
|
|
@@ -173266,7 +173266,7 @@ var require_storage = __commonJS((exports, module) => {
|
|
|
173266
173266
|
throw e8;
|
|
173267
173267
|
}
|
|
173268
173268
|
};
|
|
173269
|
-
var writeFileLinesAsync = (filename, lines, mode = DEFAULT_FILE_MODE) => new Promise((
|
|
173269
|
+
var writeFileLinesAsync = (filename, lines, mode = DEFAULT_FILE_MODE) => new Promise((resolve13, reject) => {
|
|
173270
173270
|
try {
|
|
173271
173271
|
const stream = writeFileStream(filename, { mode });
|
|
173272
173272
|
const readable2 = Readable6.from(lines);
|
|
@@ -173283,7 +173283,7 @@ var require_storage = __commonJS((exports, module) => {
|
|
|
173283
173283
|
if (err)
|
|
173284
173284
|
reject(err);
|
|
173285
173285
|
else
|
|
173286
|
-
|
|
173286
|
+
resolve13();
|
|
173287
173287
|
});
|
|
173288
173288
|
});
|
|
173289
173289
|
readable2.on("error", (err) => {
|
|
@@ -173454,7 +173454,7 @@ var require_persistence = __commonJS((exports, module) => {
|
|
|
173454
173454
|
return { data: tdata, indexes };
|
|
173455
173455
|
}
|
|
173456
173456
|
treatRawStreamAsync(rawStream) {
|
|
173457
|
-
return new Promise((
|
|
173457
|
+
return new Promise((resolve13, reject) => {
|
|
173458
173458
|
const dataById = {};
|
|
173459
173459
|
const indexes = {};
|
|
173460
173460
|
let corruptItems = 0;
|
|
@@ -173497,7 +173497,7 @@ var require_persistence = __commonJS((exports, module) => {
|
|
|
173497
173497
|
}
|
|
173498
173498
|
}
|
|
173499
173499
|
const data = Object.values(dataById);
|
|
173500
|
-
|
|
173500
|
+
resolve13({ data, indexes });
|
|
173501
173501
|
});
|
|
173502
173502
|
lineStream.on("error", function(err) {
|
|
173503
173503
|
reject(err, null);
|
|
@@ -183030,7 +183030,7 @@ var require_mime_types2 = __commonJS((exports) => {
|
|
|
183030
183030
|
* MIT Licensed
|
|
183031
183031
|
*/
|
|
183032
183032
|
var db2 = require_db2();
|
|
183033
|
-
var
|
|
183033
|
+
var extname2 = __require("path").extname;
|
|
183034
183034
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
183035
183035
|
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
183036
183036
|
exports.charset = charset;
|
|
@@ -183085,7 +183085,7 @@ var require_mime_types2 = __commonJS((exports) => {
|
|
|
183085
183085
|
if (!path18 || typeof path18 !== "string") {
|
|
183086
183086
|
return false;
|
|
183087
183087
|
}
|
|
183088
|
-
var extension2 =
|
|
183088
|
+
var extension2 = extname2("x." + path18).toLowerCase().substr(1);
|
|
183089
183089
|
if (!extension2) {
|
|
183090
183090
|
return false;
|
|
183091
183091
|
}
|
|
@@ -193077,7 +193077,7 @@ var require_mime_types3 = __commonJS((exports) => {
|
|
|
193077
193077
|
* MIT Licensed
|
|
193078
193078
|
*/
|
|
193079
193079
|
var db2 = require_db3();
|
|
193080
|
-
var
|
|
193080
|
+
var extname2 = __require("path").extname;
|
|
193081
193081
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
193082
193082
|
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
193083
193083
|
exports.charset = charset;
|
|
@@ -193132,7 +193132,7 @@ var require_mime_types3 = __commonJS((exports) => {
|
|
|
193132
193132
|
if (!path18 || typeof path18 !== "string") {
|
|
193133
193133
|
return false;
|
|
193134
193134
|
}
|
|
193135
|
-
var extension2 =
|
|
193135
|
+
var extension2 = extname2("x." + path18).toLowerCase().substr(1);
|
|
193136
193136
|
if (!extension2) {
|
|
193137
193137
|
return false;
|
|
193138
193138
|
}
|
|
@@ -199108,13 +199108,13 @@ var require_broadcast_operator = __commonJS((exports) => {
|
|
|
199108
199108
|
return true;
|
|
199109
199109
|
}
|
|
199110
199110
|
emitWithAck(ev2, ...args) {
|
|
199111
|
-
return new Promise((
|
|
199111
|
+
return new Promise((resolve13, reject) => {
|
|
199112
199112
|
args.push((err, responses) => {
|
|
199113
199113
|
if (err) {
|
|
199114
199114
|
err.responses = responses;
|
|
199115
199115
|
return reject(err);
|
|
199116
199116
|
} else {
|
|
199117
|
-
return
|
|
199117
|
+
return resolve13(responses);
|
|
199118
199118
|
}
|
|
199119
199119
|
});
|
|
199120
199120
|
this.emit(ev2, ...args);
|
|
@@ -199302,12 +199302,12 @@ var require_socket2 = __commonJS((exports) => {
|
|
|
199302
199302
|
}
|
|
199303
199303
|
emitWithAck(ev2, ...args) {
|
|
199304
199304
|
const withErr = this.flags.timeout !== undefined;
|
|
199305
|
-
return new Promise((
|
|
199305
|
+
return new Promise((resolve13, reject) => {
|
|
199306
199306
|
args.push((arg1, arg2) => {
|
|
199307
199307
|
if (withErr) {
|
|
199308
|
-
return arg1 ? reject(arg1) :
|
|
199308
|
+
return arg1 ? reject(arg1) : resolve13(arg2);
|
|
199309
199309
|
} else {
|
|
199310
|
-
return
|
|
199310
|
+
return resolve13(arg1);
|
|
199311
199311
|
}
|
|
199312
199312
|
});
|
|
199313
199313
|
this.emit(ev2, ...args);
|
|
@@ -199762,13 +199762,13 @@ var require_namespace = __commonJS((exports) => {
|
|
|
199762
199762
|
return true;
|
|
199763
199763
|
}
|
|
199764
199764
|
serverSideEmitWithAck(ev2, ...args) {
|
|
199765
|
-
return new Promise((
|
|
199765
|
+
return new Promise((resolve13, reject) => {
|
|
199766
199766
|
args.push((err, responses) => {
|
|
199767
199767
|
if (err) {
|
|
199768
199768
|
err.responses = responses;
|
|
199769
199769
|
return reject(err);
|
|
199770
199770
|
} else {
|
|
199771
|
-
return
|
|
199771
|
+
return resolve13(responses);
|
|
199772
199772
|
}
|
|
199773
199773
|
});
|
|
199774
199774
|
this.serverSideEmit(ev2, ...args);
|
|
@@ -203303,7 +203303,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
203303
203303
|
return localSockets;
|
|
203304
203304
|
}
|
|
203305
203305
|
const requestId = randomId();
|
|
203306
|
-
return new Promise((
|
|
203306
|
+
return new Promise((resolve13, reject) => {
|
|
203307
203307
|
const timeout3 = setTimeout(() => {
|
|
203308
203308
|
const storedRequest2 = this.requests.get(requestId);
|
|
203309
203309
|
if (storedRequest2) {
|
|
@@ -203313,7 +203313,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
203313
203313
|
}, opts.flags.timeout || DEFAULT_TIMEOUT);
|
|
203314
203314
|
const storedRequest = {
|
|
203315
203315
|
type: MessageType.FETCH_SOCKETS,
|
|
203316
|
-
resolve:
|
|
203316
|
+
resolve: resolve13,
|
|
203317
203317
|
timeout: timeout3,
|
|
203318
203318
|
current: 0,
|
|
203319
203319
|
expected: expectedResponseCount,
|
|
@@ -203523,7 +203523,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
203523
203523
|
return localSockets;
|
|
203524
203524
|
}
|
|
203525
203525
|
const requestId = randomId();
|
|
203526
|
-
return new Promise((
|
|
203526
|
+
return new Promise((resolve13, reject) => {
|
|
203527
203527
|
const timeout3 = setTimeout(() => {
|
|
203528
203528
|
const storedRequest2 = this.customRequests.get(requestId);
|
|
203529
203529
|
if (storedRequest2) {
|
|
@@ -203533,7 +203533,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
203533
203533
|
}, opts.flags.timeout || DEFAULT_TIMEOUT);
|
|
203534
203534
|
const storedRequest = {
|
|
203535
203535
|
type: MessageType.FETCH_SOCKETS,
|
|
203536
|
-
resolve:
|
|
203536
|
+
resolve: resolve13,
|
|
203537
203537
|
timeout: timeout3,
|
|
203538
203538
|
missingUids: new Set([...this.nodesMap.keys()]),
|
|
203539
203539
|
responses: localSockets
|
|
@@ -204262,13 +204262,13 @@ var require_dist4 = __commonJS((exports, module) => {
|
|
|
204262
204262
|
this.engine.close();
|
|
204263
204263
|
(0, uws_1.restoreAdapter)();
|
|
204264
204264
|
if (this.httpServer) {
|
|
204265
|
-
return new Promise((
|
|
204265
|
+
return new Promise((resolve13) => {
|
|
204266
204266
|
this.httpServer.close((err) => {
|
|
204267
204267
|
fn9 && fn9(err);
|
|
204268
204268
|
if (err) {
|
|
204269
204269
|
debug("server was not running");
|
|
204270
204270
|
}
|
|
204271
|
-
|
|
204271
|
+
resolve13();
|
|
204272
204272
|
});
|
|
204273
204273
|
});
|
|
204274
204274
|
} else {
|
|
@@ -213004,7 +213004,7 @@ var require_mime_types4 = __commonJS((exports) => {
|
|
|
213004
213004
|
* MIT Licensed
|
|
213005
213005
|
*/
|
|
213006
213006
|
var db2 = require_db4();
|
|
213007
|
-
var
|
|
213007
|
+
var extname2 = __require("path").extname;
|
|
213008
213008
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
213009
213009
|
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
213010
213010
|
exports.charset = charset;
|
|
@@ -213059,7 +213059,7 @@ var require_mime_types4 = __commonJS((exports) => {
|
|
|
213059
213059
|
if (!path18 || typeof path18 !== "string") {
|
|
213060
213060
|
return false;
|
|
213061
213061
|
}
|
|
213062
|
-
var extension2 =
|
|
213062
|
+
var extension2 = extname2("x." + path18).toLowerCase().substr(1);
|
|
213063
213063
|
if (!extension2) {
|
|
213064
213064
|
return false;
|
|
213065
213065
|
}
|
|
@@ -217391,8 +217391,8 @@ var require_mkdirp = __commonJS((exports, module) => {
|
|
|
217391
217391
|
});
|
|
217392
217392
|
break;
|
|
217393
217393
|
default:
|
|
217394
|
-
xfs.stat(p4, function(er22,
|
|
217395
|
-
if (er22 || !
|
|
217394
|
+
xfs.stat(p4, function(er22, stat3) {
|
|
217395
|
+
if (er22 || !stat3.isDirectory())
|
|
217396
217396
|
cb2(er10, made);
|
|
217397
217397
|
else
|
|
217398
217398
|
cb2(null, made);
|
|
@@ -217423,13 +217423,13 @@ var require_mkdirp = __commonJS((exports, module) => {
|
|
|
217423
217423
|
sync(p4, opts, made);
|
|
217424
217424
|
break;
|
|
217425
217425
|
default:
|
|
217426
|
-
var
|
|
217426
|
+
var stat3;
|
|
217427
217427
|
try {
|
|
217428
|
-
|
|
217428
|
+
stat3 = xfs.statSync(p4);
|
|
217429
217429
|
} catch (err1) {
|
|
217430
217430
|
throw err0;
|
|
217431
217431
|
}
|
|
217432
|
-
if (!
|
|
217432
|
+
if (!stat3.isDirectory())
|
|
217433
217433
|
throw err0;
|
|
217434
217434
|
break;
|
|
217435
217435
|
}
|
|
@@ -217632,7 +217632,7 @@ var require_buffer_list = __commonJS((exports, module) => {
|
|
|
217632
217632
|
}
|
|
217633
217633
|
}, {
|
|
217634
217634
|
key: "join",
|
|
217635
|
-
value: function
|
|
217635
|
+
value: function join31(s5) {
|
|
217636
217636
|
if (this.length === 0)
|
|
217637
217637
|
return "";
|
|
217638
217638
|
var p4 = this.head;
|
|
@@ -218930,14 +218930,14 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
218930
218930
|
};
|
|
218931
218931
|
}
|
|
218932
218932
|
function readAndResolve(iter) {
|
|
218933
|
-
var
|
|
218934
|
-
if (
|
|
218933
|
+
var resolve13 = iter[kLastResolve];
|
|
218934
|
+
if (resolve13 !== null) {
|
|
218935
218935
|
var data = iter[kStream].read();
|
|
218936
218936
|
if (data !== null) {
|
|
218937
218937
|
iter[kLastPromise] = null;
|
|
218938
218938
|
iter[kLastResolve] = null;
|
|
218939
218939
|
iter[kLastReject] = null;
|
|
218940
|
-
|
|
218940
|
+
resolve13(createIterResult(data, false));
|
|
218941
218941
|
}
|
|
218942
218942
|
}
|
|
218943
218943
|
}
|
|
@@ -218945,13 +218945,13 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
218945
218945
|
process.nextTick(readAndResolve, iter);
|
|
218946
218946
|
}
|
|
218947
218947
|
function wrapForNext(lastPromise, iter) {
|
|
218948
|
-
return function(
|
|
218948
|
+
return function(resolve13, reject) {
|
|
218949
218949
|
lastPromise.then(function() {
|
|
218950
218950
|
if (iter[kEnded]) {
|
|
218951
|
-
|
|
218951
|
+
resolve13(createIterResult(undefined, true));
|
|
218952
218952
|
return;
|
|
218953
218953
|
}
|
|
218954
|
-
iter[kHandlePromise](
|
|
218954
|
+
iter[kHandlePromise](resolve13, reject);
|
|
218955
218955
|
}, reject);
|
|
218956
218956
|
};
|
|
218957
218957
|
}
|
|
@@ -218970,12 +218970,12 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
218970
218970
|
return Promise.resolve(createIterResult(undefined, true));
|
|
218971
218971
|
}
|
|
218972
218972
|
if (this[kStream].destroyed) {
|
|
218973
|
-
return new Promise(function(
|
|
218973
|
+
return new Promise(function(resolve13, reject) {
|
|
218974
218974
|
process.nextTick(function() {
|
|
218975
218975
|
if (_this[kError]) {
|
|
218976
218976
|
reject(_this[kError]);
|
|
218977
218977
|
} else {
|
|
218978
|
-
|
|
218978
|
+
resolve13(createIterResult(undefined, true));
|
|
218979
218979
|
}
|
|
218980
218980
|
});
|
|
218981
218981
|
});
|
|
@@ -218998,13 +218998,13 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
218998
218998
|
return this;
|
|
218999
218999
|
}), _defineProperty(_Object$setPrototypeO, "return", function _return() {
|
|
219000
219000
|
var _this2 = this;
|
|
219001
|
-
return new Promise(function(
|
|
219001
|
+
return new Promise(function(resolve13, reject) {
|
|
219002
219002
|
_this2[kStream].destroy(null, function(err) {
|
|
219003
219003
|
if (err) {
|
|
219004
219004
|
reject(err);
|
|
219005
219005
|
return;
|
|
219006
219006
|
}
|
|
219007
|
-
|
|
219007
|
+
resolve13(createIterResult(undefined, true));
|
|
219008
219008
|
});
|
|
219009
219009
|
});
|
|
219010
219010
|
}), _Object$setPrototypeO), AsyncIteratorPrototype);
|
|
@@ -219026,15 +219026,15 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
219026
219026
|
value: stream._readableState.endEmitted,
|
|
219027
219027
|
writable: true
|
|
219028
219028
|
}), _defineProperty(_Object$create, kHandlePromise, {
|
|
219029
|
-
value: function value(
|
|
219029
|
+
value: function value(resolve13, reject) {
|
|
219030
219030
|
var data = iterator[kStream].read();
|
|
219031
219031
|
if (data) {
|
|
219032
219032
|
iterator[kLastPromise] = null;
|
|
219033
219033
|
iterator[kLastResolve] = null;
|
|
219034
219034
|
iterator[kLastReject] = null;
|
|
219035
|
-
|
|
219035
|
+
resolve13(createIterResult(data, false));
|
|
219036
219036
|
} else {
|
|
219037
|
-
iterator[kLastResolve] =
|
|
219037
|
+
iterator[kLastResolve] = resolve13;
|
|
219038
219038
|
iterator[kLastReject] = reject;
|
|
219039
219039
|
}
|
|
219040
219040
|
},
|
|
@@ -219053,12 +219053,12 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
219053
219053
|
iterator[kError] = err;
|
|
219054
219054
|
return;
|
|
219055
219055
|
}
|
|
219056
|
-
var
|
|
219057
|
-
if (
|
|
219056
|
+
var resolve13 = iterator[kLastResolve];
|
|
219057
|
+
if (resolve13 !== null) {
|
|
219058
219058
|
iterator[kLastPromise] = null;
|
|
219059
219059
|
iterator[kLastResolve] = null;
|
|
219060
219060
|
iterator[kLastReject] = null;
|
|
219061
|
-
|
|
219061
|
+
resolve13(createIterResult(undefined, true));
|
|
219062
219062
|
}
|
|
219063
219063
|
iterator[kEnded] = true;
|
|
219064
219064
|
});
|
|
@@ -219070,7 +219070,7 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
219070
219070
|
|
|
219071
219071
|
// ../../node_modules/readable-stream/lib/internal/streams/from.js
|
|
219072
219072
|
var require_from = __commonJS((exports, module) => {
|
|
219073
|
-
function asyncGeneratorStep(gen,
|
|
219073
|
+
function asyncGeneratorStep(gen, resolve13, reject, _next, _throw, key2, arg) {
|
|
219074
219074
|
try {
|
|
219075
219075
|
var info = gen[key2](arg);
|
|
219076
219076
|
var value = info.value;
|
|
@@ -219079,7 +219079,7 @@ var require_from = __commonJS((exports, module) => {
|
|
|
219079
219079
|
return;
|
|
219080
219080
|
}
|
|
219081
219081
|
if (info.done) {
|
|
219082
|
-
|
|
219082
|
+
resolve13(value);
|
|
219083
219083
|
} else {
|
|
219084
219084
|
Promise.resolve(value).then(_next, _throw);
|
|
219085
219085
|
}
|
|
@@ -219087,13 +219087,13 @@ var require_from = __commonJS((exports, module) => {
|
|
|
219087
219087
|
function _asyncToGenerator(fn9) {
|
|
219088
219088
|
return function() {
|
|
219089
219089
|
var self2 = this, args = arguments;
|
|
219090
|
-
return new Promise(function(
|
|
219090
|
+
return new Promise(function(resolve13, reject) {
|
|
219091
219091
|
var gen = fn9.apply(self2, args);
|
|
219092
219092
|
function _next(value) {
|
|
219093
|
-
asyncGeneratorStep(gen,
|
|
219093
|
+
asyncGeneratorStep(gen, resolve13, reject, _next, _throw, "next", value);
|
|
219094
219094
|
}
|
|
219095
219095
|
function _throw(err) {
|
|
219096
|
-
asyncGeneratorStep(gen,
|
|
219096
|
+
asyncGeneratorStep(gen, resolve13, reject, _next, _throw, "throw", err);
|
|
219097
219097
|
}
|
|
219098
219098
|
_next(undefined);
|
|
219099
219099
|
});
|
|
@@ -221220,7 +221220,7 @@ var require_dist5 = __commonJS((exports, module) => {
|
|
|
221220
221220
|
determineAgent: () => determineAgent
|
|
221221
221221
|
});
|
|
221222
221222
|
module.exports = __toCommonJS2(src_exports);
|
|
221223
|
-
var
|
|
221223
|
+
var import_promises25 = __require("node:fs/promises");
|
|
221224
221224
|
var import_node_fs24 = __require("node:fs");
|
|
221225
221225
|
var DEVIN_LOCAL_PATH = "/opt/.devin";
|
|
221226
221226
|
var CURSOR2 = "cursor";
|
|
@@ -221278,7 +221278,7 @@ var require_dist5 = __commonJS((exports, module) => {
|
|
|
221278
221278
|
return { isAgent: true, agent: { name: REPLIT } };
|
|
221279
221279
|
}
|
|
221280
221280
|
try {
|
|
221281
|
-
await (0,
|
|
221281
|
+
await (0, import_promises25.access)(DEVIN_LOCAL_PATH, import_node_fs24.constants.F_OK);
|
|
221282
221282
|
return { isAgent: true, agent: { name: DEVIN } };
|
|
221283
221283
|
} catch (error48) {}
|
|
221284
221284
|
return { isAgent: false, agent: undefined };
|
|
@@ -237840,7 +237840,7 @@ function normalizeBase44Env() {
|
|
|
237840
237840
|
loadProjectEnvFiles();
|
|
237841
237841
|
|
|
237842
237842
|
// src/cli/index.ts
|
|
237843
|
-
import { dirname as
|
|
237843
|
+
import { dirname as dirname25, join as join36 } from "node:path";
|
|
237844
237844
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
237845
237845
|
|
|
237846
237846
|
// ../../node_modules/@clack/core/dist/index.mjs
|
|
@@ -239048,7 +239048,7 @@ var {
|
|
|
239048
239048
|
} = import__.default;
|
|
239049
239049
|
|
|
239050
239050
|
// src/cli/commands/agent-skills/pull.ts
|
|
239051
|
-
import { dirname as
|
|
239051
|
+
import { dirname as dirname10, join as join17 } from "node:path";
|
|
239052
239052
|
// ../../node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
239053
239053
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
239054
239054
|
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
@@ -245663,26 +245663,18 @@ var PublishedUrlResponseSchema = exports_external.object({
|
|
|
245663
245663
|
});
|
|
245664
245664
|
var CreateDeploymentResponseSchema = exports_external.object({
|
|
245665
245665
|
deployment_id: exports_external.string(),
|
|
245666
|
-
asset_uploads: exports_external.
|
|
245667
|
-
exports_external.
|
|
245668
|
-
|
|
245669
|
-
|
|
245670
|
-
|
|
245671
|
-
|
|
245672
|
-
|
|
245673
|
-
|
|
245674
|
-
|
|
245675
|
-
uploads: exports_external.array(exports_external.object({
|
|
245676
|
-
path: exports_external.string(),
|
|
245677
|
-
content_type: exports_external.string(),
|
|
245678
|
-
content_length: exports_external.number(),
|
|
245679
|
-
url: exports_external.string()
|
|
245680
|
-
}))
|
|
245681
|
-
})
|
|
245682
|
-
]).nullable().optional()
|
|
245666
|
+
asset_uploads: exports_external.object({
|
|
245667
|
+
type: exports_external.literal("s3"),
|
|
245668
|
+
uploads: exports_external.array(exports_external.object({
|
|
245669
|
+
path: exports_external.string(),
|
|
245670
|
+
content_type: exports_external.string(),
|
|
245671
|
+
content_length: exports_external.number(),
|
|
245672
|
+
url: exports_external.string()
|
|
245673
|
+
}))
|
|
245674
|
+
}).nullable().optional()
|
|
245683
245675
|
}).transform((data) => ({
|
|
245684
245676
|
deploymentId: data.deployment_id,
|
|
245685
|
-
assetUploads: data.asset_uploads == null ? null :
|
|
245677
|
+
assetUploads: data.asset_uploads == null ? null : {
|
|
245686
245678
|
type: "s3",
|
|
245687
245679
|
uploads: data.asset_uploads.uploads.map((upload) => ({
|
|
245688
245680
|
path: upload.path,
|
|
@@ -245692,9 +245684,6 @@ var CreateDeploymentResponseSchema = exports_external.object({
|
|
|
245692
245684
|
}))
|
|
245693
245685
|
}
|
|
245694
245686
|
}));
|
|
245695
|
-
var AssetUploadResponseSchema = exports_external.looseObject({
|
|
245696
|
-
result: exports_external.looseObject({ jwt: exports_external.string().nullable().optional() }).nullable().optional()
|
|
245697
|
-
});
|
|
245698
245687
|
var FinalizeDeploymentResponseSchema = exports_external.object({
|
|
245699
245688
|
deployment_id: exports_external.string()
|
|
245700
245689
|
}).transform((data) => ({
|
|
@@ -248270,7 +248259,7 @@ async function createProjectFilesForExistingProject(options) {
|
|
|
248270
248259
|
};
|
|
248271
248260
|
}
|
|
248272
248261
|
// src/core/project/deploy.ts
|
|
248273
|
-
import { resolve as
|
|
248262
|
+
import { resolve as resolve3 } from "node:path";
|
|
248274
248263
|
|
|
248275
248264
|
// src/core/site/api.ts
|
|
248276
248265
|
async function uploadSite(archivePath) {
|
|
@@ -248294,13 +248283,6 @@ async function uploadSite(archivePath) {
|
|
|
248294
248283
|
}
|
|
248295
248284
|
return result.data;
|
|
248296
248285
|
}
|
|
248297
|
-
var MODULE_CONTENT_TYPES = {
|
|
248298
|
-
esm: "application/javascript+module",
|
|
248299
|
-
sourcemap: "application/source-map",
|
|
248300
|
-
wasm: "application/wasm",
|
|
248301
|
-
text: "text/plain",
|
|
248302
|
-
data: "application/octet-stream"
|
|
248303
|
-
};
|
|
248304
248286
|
async function createDeployment(request) {
|
|
248305
248287
|
const appClient = getAppClient();
|
|
248306
248288
|
let response;
|
|
@@ -248318,17 +248300,6 @@ async function createDeployment(request) {
|
|
|
248318
248300
|
}
|
|
248319
248301
|
return result.data;
|
|
248320
248302
|
}
|
|
248321
|
-
async function finalizeDeployment(deploymentId, completionJwt, modules) {
|
|
248322
|
-
const formData = new FormData;
|
|
248323
|
-
formData.append("payload", JSON.stringify({ completion_jwt: completionJwt }));
|
|
248324
|
-
for (const module of modules) {
|
|
248325
|
-
const content = await readFile(module.absolutePath);
|
|
248326
|
-
formData.append(module.name, new File([new Uint8Array(content)], module.name, {
|
|
248327
|
-
type: MODULE_CONTENT_TYPES[module.type]
|
|
248328
|
-
}));
|
|
248329
|
-
}
|
|
248330
|
-
return await postFinalize(deploymentId, formData);
|
|
248331
|
-
}
|
|
248332
248303
|
async function finalizeStaticDeployment(deploymentId, indexHtml) {
|
|
248333
248304
|
const formData = new FormData;
|
|
248334
248305
|
formData.append("index.html", new File([indexHtml], "index.html", { type: "text/html" }));
|
|
@@ -248391,13 +248362,10 @@ async function createArchive(pathToArchive, targetArchivePath) {
|
|
|
248391
248362
|
cwd: pathToArchive
|
|
248392
248363
|
}, ["."]);
|
|
248393
248364
|
}
|
|
248394
|
-
// src/core/site/deploy-app.ts
|
|
248395
|
-
import { resolve as resolve5 } from "node:path";
|
|
248396
|
-
|
|
248397
248365
|
// src/core/site/manifest.ts
|
|
248398
248366
|
import { createHash } from "node:crypto";
|
|
248399
248367
|
import { readFile as readFile2, stat } from "node:fs/promises";
|
|
248400
|
-
import { basename as basename4,
|
|
248368
|
+
import { basename as basename4, join as join15 } from "node:path";
|
|
248401
248369
|
var MAX_ASSET_SIZE_BYTES = 25 * 1024 * 1024;
|
|
248402
248370
|
var MAX_ASSET_COUNT = 1e5;
|
|
248403
248371
|
var ASSETS_IGNORE_FILE = ".assetsignore";
|
|
@@ -248406,39 +248374,6 @@ var ALWAYS_IGNORED = new Set([
|
|
|
248406
248374
|
"wrangler.json",
|
|
248407
248375
|
".dev.vars"
|
|
248408
248376
|
]);
|
|
248409
|
-
var MIME_TYPES = {
|
|
248410
|
-
".html": "text/html",
|
|
248411
|
-
".htm": "text/html",
|
|
248412
|
-
".css": "text/css",
|
|
248413
|
-
".js": "text/javascript",
|
|
248414
|
-
".mjs": "text/javascript",
|
|
248415
|
-
".json": "application/json",
|
|
248416
|
-
".map": "application/json",
|
|
248417
|
-
".txt": "text/plain",
|
|
248418
|
-
".xml": "application/xml",
|
|
248419
|
-
".svg": "image/svg+xml",
|
|
248420
|
-
".png": "image/png",
|
|
248421
|
-
".jpg": "image/jpeg",
|
|
248422
|
-
".jpeg": "image/jpeg",
|
|
248423
|
-
".gif": "image/gif",
|
|
248424
|
-
".webp": "image/webp",
|
|
248425
|
-
".avif": "image/avif",
|
|
248426
|
-
".ico": "image/x-icon",
|
|
248427
|
-
".woff": "font/woff",
|
|
248428
|
-
".woff2": "font/woff2",
|
|
248429
|
-
".ttf": "font/ttf",
|
|
248430
|
-
".otf": "font/otf",
|
|
248431
|
-
".eot": "application/vnd.ms-fontobject",
|
|
248432
|
-
".mp3": "audio/mpeg",
|
|
248433
|
-
".mp4": "video/mp4",
|
|
248434
|
-
".webm": "video/webm",
|
|
248435
|
-
".pdf": "application/pdf",
|
|
248436
|
-
".wasm": "application/wasm",
|
|
248437
|
-
".webmanifest": "application/manifest+json"
|
|
248438
|
-
};
|
|
248439
|
-
function getAssetContentType(filePath) {
|
|
248440
|
-
return MIME_TYPES[extname(filePath).toLowerCase()] ?? "application/octet-stream";
|
|
248441
|
-
}
|
|
248442
248377
|
function hashAsset(appId, content) {
|
|
248443
248378
|
return createHash("sha256").update(Buffer.from(appId, "utf8")).update(content).digest("hex").slice(0, 32);
|
|
248444
248379
|
}
|
|
@@ -248466,111 +248401,14 @@ async function buildAssetManifest(assetsDir, appId) {
|
|
|
248466
248401
|
const hash2 = hashAsset(appId, content);
|
|
248467
248402
|
manifest[`/${relativePath}`] = { hash: hash2, size };
|
|
248468
248403
|
if (!filesByHash.has(hash2)) {
|
|
248469
|
-
filesByHash.set(hash2, {
|
|
248470
|
-
absolutePath,
|
|
248471
|
-
hash: hash2,
|
|
248472
|
-
size,
|
|
248473
|
-
contentType: getAssetContentType(absolutePath)
|
|
248474
|
-
});
|
|
248404
|
+
filesByHash.set(hash2, { absolutePath, hash: hash2, size });
|
|
248475
248405
|
}
|
|
248476
248406
|
}
|
|
248477
248407
|
return { manifest, filesByHash };
|
|
248478
248408
|
}
|
|
248479
|
-
|
|
248480
|
-
|
|
248481
|
-
import {
|
|
248482
|
-
import { relative as relative3, resolve as resolve3, sep } from "node:path";
|
|
248483
|
-
var MAX_TOTAL_MODULE_BYTES = 40 * 1024 * 1024;
|
|
248484
|
-
var MODULE_IGNORE = ["wrangler.json", ".dev.vars"];
|
|
248485
|
-
var RULE_TYPE_TO_MODULE_TYPE = {
|
|
248486
|
-
ESModule: "esm",
|
|
248487
|
-
CompiledWasm: "wasm",
|
|
248488
|
-
Text: "text",
|
|
248489
|
-
Data: "data"
|
|
248490
|
-
};
|
|
248491
|
-
function toPosix(path11) {
|
|
248492
|
-
return path11.split(sep).join("/");
|
|
248493
|
-
}
|
|
248494
|
-
async function collectModules(config9) {
|
|
248495
|
-
const entryPath = resolve3(config9.configDir, config9.main);
|
|
248496
|
-
if (!await pathExists(entryPath)) {
|
|
248497
|
-
throw new InvalidInputError(`Worker entry module does not exist: ${entryPath} (from "main" in ${config9.configPath})`, {
|
|
248498
|
-
hints: [{ message: "Rebuild the project to regenerate the artifact" }]
|
|
248499
|
-
});
|
|
248500
|
-
}
|
|
248501
|
-
const modulesByName = new Map;
|
|
248502
|
-
const entryName = toPosix(relative3(config9.configDir, entryPath));
|
|
248503
|
-
modulesByName.set(entryName, {
|
|
248504
|
-
name: entryName,
|
|
248505
|
-
absolutePath: entryPath,
|
|
248506
|
-
size: 0,
|
|
248507
|
-
type: "esm"
|
|
248508
|
-
});
|
|
248509
|
-
const ignore = [...MODULE_IGNORE];
|
|
248510
|
-
if (config9.assetsDirectory?.startsWith(config9.configDir + sep)) {
|
|
248511
|
-
ignore.push(`${toPosix(relative3(config9.configDir, config9.assetsDirectory))}/**`);
|
|
248512
|
-
}
|
|
248513
|
-
for (const rule of config9.rules) {
|
|
248514
|
-
const type = RULE_TYPE_TO_MODULE_TYPE[rule.type];
|
|
248515
|
-
if (!type) {
|
|
248516
|
-
throw new InvalidInputError(`Unsupported module rule type "${rule.type}" in ${config9.configPath}. Supported: ${Object.keys(RULE_TYPE_TO_MODULE_TYPE).join(", ")}.`);
|
|
248517
|
-
}
|
|
248518
|
-
const matches = await globby(rule.globs, {
|
|
248519
|
-
cwd: config9.configDir,
|
|
248520
|
-
onlyFiles: true,
|
|
248521
|
-
dot: true,
|
|
248522
|
-
ignore
|
|
248523
|
-
});
|
|
248524
|
-
for (const match of matches.sort()) {
|
|
248525
|
-
if (!modulesByName.has(match)) {
|
|
248526
|
-
modulesByName.set(match, {
|
|
248527
|
-
name: match,
|
|
248528
|
-
absolutePath: resolve3(config9.configDir, match),
|
|
248529
|
-
size: 0,
|
|
248530
|
-
type
|
|
248531
|
-
});
|
|
248532
|
-
}
|
|
248533
|
-
}
|
|
248534
|
-
}
|
|
248535
|
-
if (config9.uploadSourceMaps) {
|
|
248536
|
-
const maps = await globby("**/*.map", {
|
|
248537
|
-
cwd: config9.configDir,
|
|
248538
|
-
onlyFiles: true,
|
|
248539
|
-
dot: true,
|
|
248540
|
-
ignore
|
|
248541
|
-
});
|
|
248542
|
-
for (const map2 of maps.sort()) {
|
|
248543
|
-
addSourcemap(modulesByName, config9.configDir, map2);
|
|
248544
|
-
}
|
|
248545
|
-
} else {
|
|
248546
|
-
for (const name2 of [...modulesByName.keys()]) {
|
|
248547
|
-
const mapName = `${name2}.map`;
|
|
248548
|
-
if (await pathExists(resolve3(config9.configDir, mapName))) {
|
|
248549
|
-
addSourcemap(modulesByName, config9.configDir, mapName);
|
|
248550
|
-
}
|
|
248551
|
-
}
|
|
248552
|
-
}
|
|
248553
|
-
const modules = [...modulesByName.values()];
|
|
248554
|
-
let totalBytes = 0;
|
|
248555
|
-
for (const module of modules) {
|
|
248556
|
-
module.size = (await stat2(module.absolutePath)).size;
|
|
248557
|
-
totalBytes += module.size;
|
|
248558
|
-
}
|
|
248559
|
-
if (totalBytes > MAX_TOTAL_MODULE_BYTES) {
|
|
248560
|
-
throw new InvalidInputError(`Worker modules total ${totalBytes} bytes, which exceeds the 40 MB limit for Base44 full-stack deploys.`);
|
|
248561
|
-
}
|
|
248562
|
-
return modules;
|
|
248563
|
-
}
|
|
248564
|
-
function addSourcemap(modulesByName, configDir, name2) {
|
|
248565
|
-
if (modulesByName.has(name2))
|
|
248566
|
-
return;
|
|
248567
|
-
modulesByName.set(name2, {
|
|
248568
|
-
name: name2,
|
|
248569
|
-
absolutePath: resolve3(configDir, name2),
|
|
248570
|
-
size: 0,
|
|
248571
|
-
type: "sourcemap"
|
|
248572
|
-
});
|
|
248573
|
-
}
|
|
248409
|
+
// src/core/site/static-site.ts
|
|
248410
|
+
import { readFile as readFile4 } from "node:fs/promises";
|
|
248411
|
+
import { join as join16 } from "node:path";
|
|
248574
248412
|
|
|
248575
248413
|
// src/core/site/upload.ts
|
|
248576
248414
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
@@ -248606,7 +248444,7 @@ async function pMap(iterable, mapper, {
|
|
|
248606
248444
|
const cleanup = () => {
|
|
248607
248445
|
signal?.removeEventListener("abort", signalListener);
|
|
248608
248446
|
};
|
|
248609
|
-
const
|
|
248447
|
+
const resolve3 = (value) => {
|
|
248610
248448
|
resolve_(value);
|
|
248611
248449
|
cleanup();
|
|
248612
248450
|
};
|
|
@@ -248639,7 +248477,7 @@ async function pMap(iterable, mapper, {
|
|
|
248639
248477
|
}
|
|
248640
248478
|
isResolved = true;
|
|
248641
248479
|
if (skippedIndexesMap.size === 0) {
|
|
248642
|
-
|
|
248480
|
+
resolve3(result);
|
|
248643
248481
|
return;
|
|
248644
248482
|
}
|
|
248645
248483
|
const pureResult = [];
|
|
@@ -248649,7 +248487,7 @@ async function pMap(iterable, mapper, {
|
|
|
248649
248487
|
}
|
|
248650
248488
|
pureResult.push(value);
|
|
248651
248489
|
}
|
|
248652
|
-
|
|
248490
|
+
resolve3(pureResult);
|
|
248653
248491
|
}
|
|
248654
248492
|
return;
|
|
248655
248493
|
}
|
|
@@ -248704,62 +248542,6 @@ var DEFAULT_UPLOAD_CONCURRENCY = 3;
|
|
|
248704
248542
|
var MAX_UPLOAD_CONCURRENCY = 50;
|
|
248705
248543
|
var MAX_UPLOAD_ATTEMPTS = 3;
|
|
248706
248544
|
var RETRY_BASE_DELAY_MS = 500;
|
|
248707
|
-
var UPLOAD_RETRY = {
|
|
248708
|
-
limit: MAX_UPLOAD_ATTEMPTS - 1,
|
|
248709
|
-
delay: (attempt) => RETRY_BASE_DELAY_MS * 2 ** (attempt - 1)
|
|
248710
|
-
};
|
|
248711
|
-
async function uploadAssetBuckets(target, filesByHash, options = {}) {
|
|
248712
|
-
const { concurrency = DEFAULT_UPLOAD_CONCURRENCY, onProgress } = options;
|
|
248713
|
-
const { buckets } = target;
|
|
248714
|
-
const totalFiles = buckets.reduce((sum, bucket) => sum + bucket.length, 0);
|
|
248715
|
-
let uploadedFiles = 0;
|
|
248716
|
-
let completionJwt = null;
|
|
248717
|
-
await pMap(buckets, async (bucket) => {
|
|
248718
|
-
const jwt3 = await uploadAssetBucket(target, bucket, filesByHash);
|
|
248719
|
-
if (jwt3) {
|
|
248720
|
-
completionJwt = jwt3;
|
|
248721
|
-
}
|
|
248722
|
-
uploadedFiles += bucket.length;
|
|
248723
|
-
onProgress?.({ uploadedFiles, totalFiles });
|
|
248724
|
-
}, { concurrency });
|
|
248725
|
-
if (!completionJwt) {
|
|
248726
|
-
throw new ApiError("Asset upload finished but the server did not return a completion token.");
|
|
248727
|
-
}
|
|
248728
|
-
return completionJwt;
|
|
248729
|
-
}
|
|
248730
|
-
async function uploadAssetBucket(target, bucket, filesByHash) {
|
|
248731
|
-
const formData = await buildBucketForm(bucket, filesByHash);
|
|
248732
|
-
let response;
|
|
248733
|
-
try {
|
|
248734
|
-
response = await distribution_default.post(target.url, {
|
|
248735
|
-
searchParams: { base64: "true" },
|
|
248736
|
-
headers: { Authorization: `Bearer ${target.jwt}` },
|
|
248737
|
-
body: formData,
|
|
248738
|
-
timeout: 120000,
|
|
248739
|
-
retry: { ...UPLOAD_RETRY, methods: ["post"] }
|
|
248740
|
-
});
|
|
248741
|
-
} catch (error48) {
|
|
248742
|
-
if (error48 instanceof HTTPError && (error48.response.status === 401 || error48.response.status === 403)) {
|
|
248743
|
-
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 });
|
|
248744
|
-
}
|
|
248745
|
-
throw await ApiError.fromHttpError(error48, "uploading assets to Cloudflare");
|
|
248746
|
-
}
|
|
248747
|
-
const parsed = AssetUploadResponseSchema.safeParse(await response.json());
|
|
248748
|
-
const jwt3 = parsed.success ? parsed.data.result?.jwt : null;
|
|
248749
|
-
return jwt3 || null;
|
|
248750
|
-
}
|
|
248751
|
-
async function buildBucketForm(bucket, filesByHash) {
|
|
248752
|
-
const formData = new FormData;
|
|
248753
|
-
for (const hash2 of bucket) {
|
|
248754
|
-
const file2 = filesByHash.get(hash2);
|
|
248755
|
-
if (!file2) {
|
|
248756
|
-
throw new InternalError(`Server requested upload of unknown asset hash: ${hash2}`);
|
|
248757
|
-
}
|
|
248758
|
-
const content = await readFile3(file2.absolutePath);
|
|
248759
|
-
formData.append(hash2, new File([content.toString("base64")], hash2, { type: file2.contentType }));
|
|
248760
|
-
}
|
|
248761
|
-
return formData;
|
|
248762
|
-
}
|
|
248763
248545
|
async function uploadPresignedAssets(uploads, assets, options = {}) {
|
|
248764
248546
|
const { concurrency = DEFAULT_UPLOAD_CONCURRENCY, onProgress } = options;
|
|
248765
248547
|
let uploadedFiles = 0;
|
|
@@ -248781,157 +248563,375 @@ async function uploadPresignedAsset(upload, assets) {
|
|
|
248781
248563
|
body: new Uint8Array(content),
|
|
248782
248564
|
headers: { "Content-Type": upload.contentType },
|
|
248783
248565
|
timeout: 120000,
|
|
248784
|
-
retry:
|
|
248566
|
+
retry: {
|
|
248567
|
+
limit: MAX_UPLOAD_ATTEMPTS - 1,
|
|
248568
|
+
delay: (attempt) => RETRY_BASE_DELAY_MS * 2 ** (attempt - 1)
|
|
248569
|
+
}
|
|
248785
248570
|
});
|
|
248786
248571
|
} catch (error48) {
|
|
248787
248572
|
throw await ApiError.fromHttpError(error48, "uploading static assets");
|
|
248788
248573
|
}
|
|
248789
248574
|
}
|
|
248790
248575
|
|
|
248791
|
-
// src/core/site/
|
|
248792
|
-
|
|
248793
|
-
|
|
248794
|
-
|
|
248795
|
-
|
|
248796
|
-
});
|
|
248797
|
-
|
|
248798
|
-
|
|
248799
|
-
|
|
248800
|
-
|
|
248801
|
-
|
|
248802
|
-
|
|
248803
|
-
|
|
248804
|
-
|
|
248805
|
-
|
|
248806
|
-
|
|
248807
|
-
|
|
248808
|
-
|
|
248809
|
-
|
|
248810
|
-
compatibility_flags: exports_external.array(exports_external.string()).optional(),
|
|
248811
|
-
vars: exports_external.record(exports_external.string(), exports_external.unknown()).optional(),
|
|
248812
|
-
upload_source_maps: exports_external.boolean().optional()
|
|
248813
|
-
});
|
|
248814
|
-
async function detectFullStackArtifact(projectRoot) {
|
|
248815
|
-
const redirectPath = join16(projectRoot, WRANGLER_REDIRECT_PATH);
|
|
248816
|
-
return await pathExists(redirectPath) ? redirectPath : null;
|
|
248817
|
-
}
|
|
248818
|
-
async function resolveWranglerConfig(projectRoot) {
|
|
248819
|
-
const redirectPath = await detectFullStackArtifact(projectRoot);
|
|
248820
|
-
if (!redirectPath) {
|
|
248821
|
-
throw new InvalidInputError("No full-stack build artifact found. Expected a .wrangler/deploy/config.json redirect file.", {
|
|
248822
|
-
hints: [{ message: "Run your framework's build command first" }]
|
|
248576
|
+
// src/core/site/static-site.ts
|
|
248577
|
+
async function deployStaticSite(options) {
|
|
248578
|
+
const { outputDir, gitHash, concurrency, progress } = options;
|
|
248579
|
+
const assets = await buildAssetManifest(outputDir, getAppContext().id);
|
|
248580
|
+
if (!assets.manifest["/index.html"]) {
|
|
248581
|
+
throw new InvalidInputError(`No index.html found in "${outputDir}" — a static site needs one at the output directory root.`);
|
|
248582
|
+
}
|
|
248583
|
+
const created = await createDeployment({
|
|
248584
|
+
git_hash: gitHash,
|
|
248585
|
+
asset_manifest: assets.manifest
|
|
248586
|
+
});
|
|
248587
|
+
progress?.onAssets?.({
|
|
248588
|
+
totalAssets: Object.keys(assets.manifest).length,
|
|
248589
|
+
newAssets: created.assetUploads?.uploads.length ?? 0
|
|
248590
|
+
});
|
|
248591
|
+
if (created.assetUploads) {
|
|
248592
|
+
await uploadPresignedAssets(created.assetUploads.uploads, assets, {
|
|
248593
|
+
concurrency,
|
|
248594
|
+
onProgress: progress?.onAssetUpload
|
|
248823
248595
|
});
|
|
248824
248596
|
}
|
|
248825
|
-
const
|
|
248826
|
-
const
|
|
248827
|
-
|
|
248828
|
-
|
|
248829
|
-
|
|
248597
|
+
const indexHtml = await readFile4(join16(outputDir, "index.html"));
|
|
248598
|
+
const finalized = await finalizeStaticDeployment(created.deploymentId, new Uint8Array(indexHtml));
|
|
248599
|
+
return { deploymentId: finalized.deploymentId };
|
|
248600
|
+
}
|
|
248601
|
+
// src/core/project/deploy.ts
|
|
248602
|
+
function hasResourcesToDeploy(projectData) {
|
|
248603
|
+
const {
|
|
248604
|
+
project,
|
|
248605
|
+
entities,
|
|
248606
|
+
functions,
|
|
248607
|
+
agents,
|
|
248608
|
+
agentSkills,
|
|
248609
|
+
connectors,
|
|
248610
|
+
authConfig
|
|
248611
|
+
} = projectData;
|
|
248612
|
+
const hasSite = Boolean(project.site?.outputDirectory);
|
|
248613
|
+
const hasEntities = entities.length > 0;
|
|
248614
|
+
const hasFunctions = functions.length > 0;
|
|
248615
|
+
const hasAgents = agents.length > 0;
|
|
248616
|
+
const hasAgentSkills = agentSkills.length > 0;
|
|
248617
|
+
const hasConnectors = connectors.length > 0;
|
|
248618
|
+
const hasAuthConfig = authConfig.length > 0;
|
|
248619
|
+
const hasVisibility = Boolean(project.visibility);
|
|
248620
|
+
return hasEntities || hasFunctions || hasAgents || hasAgentSkills || hasConnectors || hasAuthConfig || hasVisibility || hasSite;
|
|
248621
|
+
}
|
|
248622
|
+
async function deployAll(projectData, options) {
|
|
248623
|
+
const {
|
|
248624
|
+
project,
|
|
248625
|
+
entities,
|
|
248626
|
+
functions,
|
|
248627
|
+
agents,
|
|
248628
|
+
agentSkills,
|
|
248629
|
+
connectors,
|
|
248630
|
+
authConfig
|
|
248631
|
+
} = projectData;
|
|
248632
|
+
await setAppVisibility(project.visibility);
|
|
248633
|
+
if (project.visibility) {
|
|
248634
|
+
options?.onVisibilitySet?.(project.visibility);
|
|
248635
|
+
}
|
|
248636
|
+
await entityResource.push(entities);
|
|
248637
|
+
await deployFunctionsSequentially(functions, {
|
|
248638
|
+
onStart: options?.onFunctionStart,
|
|
248639
|
+
onResult: options?.onFunctionResult
|
|
248640
|
+
});
|
|
248641
|
+
await agentSkillResource.push(agentSkills);
|
|
248642
|
+
await agentResource.push(agents);
|
|
248643
|
+
await authConfigResource.push(authConfig);
|
|
248644
|
+
const skipConnectorSync = connectors.length === 0 && hasWorkspaceApiKeyAuth();
|
|
248645
|
+
const connectorResults = skipConnectorSync ? [] : (await pushConnectors(connectors)).results;
|
|
248646
|
+
if (project.site?.outputDirectory) {
|
|
248647
|
+
const outputDir = resolve3(project.root, project.site.outputDirectory);
|
|
248648
|
+
const { appUrl } = await deploySite(outputDir);
|
|
248649
|
+
return { appUrl, connectorResults };
|
|
248830
248650
|
}
|
|
248831
|
-
|
|
248832
|
-
|
|
248833
|
-
|
|
248651
|
+
return { connectorResults };
|
|
248652
|
+
}
|
|
248653
|
+
// src/core/clients/base44-client.ts
|
|
248654
|
+
var retriedRequests = new WeakSet;
|
|
248655
|
+
async function captureRequestBody(request, options) {
|
|
248656
|
+
if (request.body == null) {
|
|
248657
|
+
return;
|
|
248834
248658
|
}
|
|
248835
|
-
|
|
248836
|
-
|
|
248837
|
-
|
|
248838
|
-
|
|
248839
|
-
|
|
248840
|
-
main: config9.main,
|
|
248841
|
-
assetsDirectory,
|
|
248842
|
-
assetsConfig: config9.assets ? toResolvedAssetsConfig(config9.assets) : null,
|
|
248843
|
-
compatibilityDate: config9.compatibility_date ?? null,
|
|
248844
|
-
compatibilityFlags: config9.compatibility_flags ?? [],
|
|
248845
|
-
vars: config9.vars ?? {},
|
|
248846
|
-
rules: (config9.rules ?? []).map((rule) => ({
|
|
248847
|
-
type: rule.type,
|
|
248848
|
-
globs: rule.globs
|
|
248849
|
-
})),
|
|
248850
|
-
uploadSourceMaps: config9.upload_source_maps ?? false
|
|
248851
|
-
};
|
|
248659
|
+
try {
|
|
248660
|
+
const cloned = request.clone();
|
|
248661
|
+
const text = await cloned.text();
|
|
248662
|
+
options.context.__requestBody = text;
|
|
248663
|
+
} catch {}
|
|
248852
248664
|
}
|
|
248853
|
-
async function
|
|
248854
|
-
|
|
248855
|
-
|
|
248856
|
-
if (!result.success) {
|
|
248857
|
-
throw new ConfigInvalidError(`Invalid deploy redirect file: ${exports_external.prettifyError(result.error)}`, redirectPath);
|
|
248665
|
+
async function handleUnauthorized(request, _options, response) {
|
|
248666
|
+
if (response.status !== 401) {
|
|
248667
|
+
return;
|
|
248858
248668
|
}
|
|
248859
|
-
|
|
248860
|
-
|
|
248861
|
-
throw new ConfigInvalidError(`Wrangler config referenced by ${redirectPath} does not exist: ${configPath}`, redirectPath, {
|
|
248862
|
-
hints: [{ message: "Rebuild the project to regenerate the artifact" }]
|
|
248863
|
-
});
|
|
248669
|
+
if (hasWorkspaceApiKeyAuth()) {
|
|
248670
|
+
return;
|
|
248864
248671
|
}
|
|
248865
|
-
|
|
248672
|
+
if (retriedRequests.has(request)) {
|
|
248673
|
+
return;
|
|
248674
|
+
}
|
|
248675
|
+
const newAccessToken = await refreshAndSaveTokens();
|
|
248676
|
+
if (!newAccessToken) {
|
|
248677
|
+
return;
|
|
248678
|
+
}
|
|
248679
|
+
retriedRequests.add(request);
|
|
248680
|
+
const requestId = request.headers.get("X-Request-ID");
|
|
248681
|
+
return distribution_default(request.clone(), {
|
|
248682
|
+
headers: {
|
|
248683
|
+
...requestId && { "X-Request-ID": requestId },
|
|
248684
|
+
Authorization: `Bearer ${newAccessToken}`
|
|
248685
|
+
}
|
|
248686
|
+
});
|
|
248866
248687
|
}
|
|
248867
|
-
|
|
248868
|
-
|
|
248869
|
-
|
|
248870
|
-
|
|
248871
|
-
|
|
248872
|
-
|
|
248873
|
-
|
|
248874
|
-
|
|
248688
|
+
var base44Client = distribution_default.create({
|
|
248689
|
+
prefixUrl: getBase44ApiUrl(),
|
|
248690
|
+
headers: {
|
|
248691
|
+
"User-Agent": "Base44 CLI"
|
|
248692
|
+
},
|
|
248693
|
+
hooks: {
|
|
248694
|
+
beforeRequest: [
|
|
248695
|
+
(request) => {
|
|
248696
|
+
request.headers.set("X-Request-ID", randomUUID2());
|
|
248697
|
+
},
|
|
248698
|
+
captureRequestBody,
|
|
248699
|
+
async (request) => {
|
|
248700
|
+
const workspaceApiKey = getWorkspaceApiKeyFromEnv();
|
|
248701
|
+
if (workspaceApiKey && isWorkspaceApiKey(workspaceApiKey)) {
|
|
248702
|
+
request.headers.set("api_key", workspaceApiKey);
|
|
248703
|
+
return;
|
|
248704
|
+
}
|
|
248705
|
+
try {
|
|
248706
|
+
const auth = await readAuth();
|
|
248707
|
+
if (isTokenExpired(auth)) {
|
|
248708
|
+
const newAccessToken = await refreshAndSaveTokens();
|
|
248709
|
+
if (newAccessToken) {
|
|
248710
|
+
request.headers.set("Authorization", `Bearer ${newAccessToken}`);
|
|
248711
|
+
return;
|
|
248712
|
+
}
|
|
248713
|
+
}
|
|
248714
|
+
request.headers.set("Authorization", `Bearer ${auth.accessToken}`);
|
|
248715
|
+
} catch {}
|
|
248716
|
+
}
|
|
248717
|
+
],
|
|
248718
|
+
afterResponse: [handleUnauthorized]
|
|
248719
|
+
}
|
|
248720
|
+
});
|
|
248721
|
+
function getAppClient() {
|
|
248722
|
+
const { id } = getAppContext();
|
|
248723
|
+
return base44Client.extend({
|
|
248724
|
+
prefixUrl: new URL(`/api/apps/${id}/`, getBase44ApiUrl()).href
|
|
248725
|
+
});
|
|
248875
248726
|
}
|
|
248876
|
-
|
|
248877
|
-
|
|
248878
|
-
|
|
248879
|
-
|
|
248880
|
-
|
|
248881
|
-
|
|
248882
|
-
|
|
248727
|
+
function getSandboxClient(appId) {
|
|
248728
|
+
return base44Client.extend({
|
|
248729
|
+
prefixUrl: new URL(`/api/apps/${appId}/sandbox-bridge/`, getBase44ApiUrl()).href
|
|
248730
|
+
});
|
|
248731
|
+
}
|
|
248732
|
+
// src/core/clients/oauth-client.ts
|
|
248733
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
248734
|
+
var oauthClient = distribution_default.create({
|
|
248735
|
+
prefixUrl: getBase44ApiUrl(),
|
|
248736
|
+
headers: {
|
|
248737
|
+
"User-Agent": "Base44 CLI"
|
|
248738
|
+
},
|
|
248739
|
+
hooks: {
|
|
248740
|
+
beforeRequest: [
|
|
248741
|
+
(request) => {
|
|
248742
|
+
request.headers.set("X-Request-ID", randomUUID3());
|
|
248743
|
+
}
|
|
248744
|
+
]
|
|
248883
248745
|
}
|
|
248884
|
-
|
|
248885
|
-
|
|
248746
|
+
});
|
|
248747
|
+
// src/core/auth/api.ts
|
|
248748
|
+
async function generateDeviceCode() {
|
|
248749
|
+
const response = await oauthClient.post("oauth/device/code", {
|
|
248750
|
+
json: {
|
|
248751
|
+
client_id: AUTH_CLIENT_ID,
|
|
248752
|
+
scope: "apps:read apps:write sandbox:write"
|
|
248753
|
+
},
|
|
248754
|
+
throwHttpErrors: false
|
|
248755
|
+
});
|
|
248756
|
+
if (!response.ok) {
|
|
248757
|
+
throw new ApiError(`Failed to generate device code: ${response.status} ${response.statusText}`, { statusCode: response.status });
|
|
248886
248758
|
}
|
|
248887
|
-
const
|
|
248888
|
-
|
|
248889
|
-
|
|
248890
|
-
assets = await buildAssetManifest(config9.assetsDirectory, getAppContext().id);
|
|
248759
|
+
const result = DeviceCodeResponseSchema.safeParse(await response.json());
|
|
248760
|
+
if (!result.success) {
|
|
248761
|
+
throw new SchemaValidationError("Invalid device code response from server", result.error);
|
|
248891
248762
|
}
|
|
248892
|
-
|
|
248893
|
-
|
|
248894
|
-
|
|
248895
|
-
|
|
248896
|
-
|
|
248897
|
-
|
|
248898
|
-
|
|
248763
|
+
return result.data;
|
|
248764
|
+
}
|
|
248765
|
+
async function getTokenFromDeviceCode(deviceCode) {
|
|
248766
|
+
const searchParams = new URLSearchParams;
|
|
248767
|
+
searchParams.set("grant_type", "urn:ietf:params:oauth:grant-type:device_code");
|
|
248768
|
+
searchParams.set("device_code", deviceCode);
|
|
248769
|
+
searchParams.set("client_id", AUTH_CLIENT_ID);
|
|
248770
|
+
const response = await oauthClient.post("oauth/token", {
|
|
248771
|
+
body: searchParams.toString(),
|
|
248772
|
+
headers: {
|
|
248773
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
248899
248774
|
},
|
|
248900
|
-
|
|
248775
|
+
throwHttpErrors: false
|
|
248901
248776
|
});
|
|
248902
|
-
|
|
248903
|
-
|
|
248777
|
+
const json2 = await response.json();
|
|
248778
|
+
if (!response.ok) {
|
|
248779
|
+
const errorResult = OAuthErrorSchema.safeParse(json2);
|
|
248780
|
+
if (!errorResult.success) {
|
|
248781
|
+
throw new SchemaValidationError("Token request failed", errorResult.error);
|
|
248782
|
+
}
|
|
248783
|
+
const { error: error48, error_description } = errorResult.data;
|
|
248784
|
+
if (error48 === "authorization_pending" || error48 === "slow_down") {
|
|
248785
|
+
return null;
|
|
248786
|
+
}
|
|
248787
|
+
throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
|
|
248788
|
+
statusCode: response.status
|
|
248789
|
+
});
|
|
248904
248790
|
}
|
|
248905
|
-
const
|
|
248906
|
-
|
|
248907
|
-
|
|
248908
|
-
|
|
248909
|
-
|
|
248910
|
-
onProgress: progress?.onAssetUpload
|
|
248911
|
-
}) : null;
|
|
248912
|
-
progress?.onWorker?.({ moduleCount: modules.length });
|
|
248913
|
-
const finalized = await finalizeDeployment(created.deploymentId, completionJwt, modules);
|
|
248914
|
-
return { deploymentId: finalized.deploymentId, gitHash };
|
|
248791
|
+
const result = TokenResponseSchema.safeParse(json2);
|
|
248792
|
+
if (!result.success) {
|
|
248793
|
+
throw new SchemaValidationError("Invalid token response from server", result.error);
|
|
248794
|
+
}
|
|
248795
|
+
return result.data;
|
|
248915
248796
|
}
|
|
248916
|
-
function
|
|
248917
|
-
|
|
248918
|
-
|
|
248919
|
-
|
|
248920
|
-
|
|
248797
|
+
async function renewAccessToken(refreshToken) {
|
|
248798
|
+
const searchParams = new URLSearchParams;
|
|
248799
|
+
searchParams.set("grant_type", "refresh_token");
|
|
248800
|
+
searchParams.set("refresh_token", refreshToken);
|
|
248801
|
+
searchParams.set("client_id", AUTH_CLIENT_ID);
|
|
248802
|
+
const response = await oauthClient.post("oauth/token", {
|
|
248803
|
+
body: searchParams.toString(),
|
|
248804
|
+
headers: {
|
|
248805
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
248806
|
+
},
|
|
248807
|
+
throwHttpErrors: false
|
|
248808
|
+
});
|
|
248809
|
+
const json2 = await response.json();
|
|
248810
|
+
if (!response.ok) {
|
|
248811
|
+
const errorResult = OAuthErrorSchema.safeParse(json2);
|
|
248812
|
+
if (!errorResult.success) {
|
|
248813
|
+
throw new ApiError(`Token refresh failed: ${response.statusText}`, {
|
|
248814
|
+
statusCode: response.status
|
|
248815
|
+
});
|
|
248816
|
+
}
|
|
248817
|
+
const { error: error48, error_description } = errorResult.data;
|
|
248818
|
+
throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
|
|
248819
|
+
statusCode: response.status
|
|
248820
|
+
});
|
|
248921
248821
|
}
|
|
248922
|
-
|
|
248923
|
-
if (
|
|
248924
|
-
|
|
248925
|
-
}
|
|
248926
|
-
|
|
248822
|
+
const result = TokenResponseSchema.safeParse(json2);
|
|
248823
|
+
if (!result.success) {
|
|
248824
|
+
throw new SchemaValidationError("Invalid token response from server", result.error);
|
|
248825
|
+
}
|
|
248826
|
+
return result.data;
|
|
248827
|
+
}
|
|
248828
|
+
async function getUserInfo(accessToken) {
|
|
248829
|
+
const response = await oauthClient.get("oauth/userinfo", {
|
|
248830
|
+
headers: { Authorization: `Bearer ${accessToken}` }
|
|
248831
|
+
});
|
|
248832
|
+
if (!response.ok) {
|
|
248833
|
+
throw new ApiError(`Failed to fetch user info: ${response.status}`, {
|
|
248834
|
+
statusCode: response.status
|
|
248835
|
+
});
|
|
248836
|
+
}
|
|
248837
|
+
const result = UserInfoSchema.safeParse(await response.json());
|
|
248838
|
+
if (!result.success) {
|
|
248839
|
+
throw new SchemaValidationError("Invalid UserInfo response from server", result.error);
|
|
248840
|
+
}
|
|
248841
|
+
return result.data;
|
|
248842
|
+
}
|
|
248843
|
+
// src/cli/commands/auth/login-flow.ts
|
|
248844
|
+
async function generateAndDisplayDeviceCode(log, runTask) {
|
|
248845
|
+
const deviceCodeResponse = await runTask("Generating device code...", async () => {
|
|
248846
|
+
return await generateDeviceCode();
|
|
248847
|
+
}, {
|
|
248848
|
+
successMessage: "Device code generated",
|
|
248849
|
+
errorMessage: "Failed to generate device code"
|
|
248850
|
+
});
|
|
248851
|
+
log.info(`Verification code: ${theme.styles.bold(deviceCodeResponse.userCode)}` + `
|
|
248852
|
+
Please confirm this code at: ${deviceCodeResponse.verificationUri}`);
|
|
248853
|
+
return deviceCodeResponse;
|
|
248854
|
+
}
|
|
248855
|
+
async function waitForAuthentication(deviceCode, expiresIn, interval, runTask) {
|
|
248856
|
+
let tokenResponse;
|
|
248857
|
+
try {
|
|
248858
|
+
await runTask("Waiting for authentication...", async () => {
|
|
248859
|
+
await pWaitFor(async () => {
|
|
248860
|
+
const result = await getTokenFromDeviceCode(deviceCode);
|
|
248861
|
+
if (result !== null) {
|
|
248862
|
+
tokenResponse = result;
|
|
248863
|
+
return true;
|
|
248864
|
+
}
|
|
248865
|
+
return false;
|
|
248866
|
+
}, {
|
|
248867
|
+
interval: interval * 1000,
|
|
248868
|
+
timeout: expiresIn * 1000
|
|
248869
|
+
});
|
|
248870
|
+
}, {
|
|
248871
|
+
successMessage: "Authentication completed!",
|
|
248872
|
+
errorMessage: "Authentication failed"
|
|
248873
|
+
});
|
|
248874
|
+
} catch (error48) {
|
|
248875
|
+
if (error48 instanceof Error && error48.message.includes("timed out")) {
|
|
248876
|
+
throw new AuthExpiredError("Authentication timed out. Please try again.");
|
|
248877
|
+
}
|
|
248878
|
+
throw error48;
|
|
248927
248879
|
}
|
|
248880
|
+
if (tokenResponse === undefined) {
|
|
248881
|
+
throw new InternalError("Failed to retrieve authentication token.");
|
|
248882
|
+
}
|
|
248883
|
+
return tokenResponse;
|
|
248884
|
+
}
|
|
248885
|
+
async function saveAuthData(response, userInfo) {
|
|
248886
|
+
const expiresAt = Date.now() + response.expiresIn * 1000;
|
|
248887
|
+
await writeAuth({
|
|
248888
|
+
accessToken: response.accessToken,
|
|
248889
|
+
refreshToken: response.refreshToken,
|
|
248890
|
+
expiresAt,
|
|
248891
|
+
email: userInfo.email,
|
|
248892
|
+
name: userInfo.name
|
|
248893
|
+
});
|
|
248894
|
+
}
|
|
248895
|
+
async function login({
|
|
248896
|
+
log,
|
|
248897
|
+
runTask
|
|
248898
|
+
}) {
|
|
248899
|
+
const deviceCodeResponse = await generateAndDisplayDeviceCode(log, runTask);
|
|
248900
|
+
const token = await waitForAuthentication(deviceCodeResponse.deviceCode, deviceCodeResponse.expiresIn, deviceCodeResponse.interval, runTask);
|
|
248901
|
+
const userInfo = await getUserInfo(token.accessToken);
|
|
248902
|
+
await saveAuthData(token, userInfo);
|
|
248928
248903
|
return {
|
|
248929
|
-
|
|
248930
|
-
not_found_handling: assetsConfig.notFoundHandling,
|
|
248931
|
-
run_worker_first: runWorkerFirst
|
|
248904
|
+
outroMessage: `Successfully logged in as ${theme.styles.bold(userInfo.email)}`
|
|
248932
248905
|
};
|
|
248933
248906
|
}
|
|
248934
248907
|
|
|
248908
|
+
// src/cli/utils/command/middleware.ts
|
|
248909
|
+
async function ensureAuth(ctx) {
|
|
248910
|
+
if (hasWorkspaceApiKeyAuth()) {
|
|
248911
|
+
ctx.errorReporter.setContext({
|
|
248912
|
+
user: { email: "workspace-api-key", name: "Workspace API key" }
|
|
248913
|
+
});
|
|
248914
|
+
return;
|
|
248915
|
+
}
|
|
248916
|
+
await seedAuthFromEnv();
|
|
248917
|
+
const loggedIn = await isLoggedIn();
|
|
248918
|
+
if (!loggedIn) {
|
|
248919
|
+
ctx.log.info("You need to login first to continue.");
|
|
248920
|
+
await login(ctx);
|
|
248921
|
+
}
|
|
248922
|
+
try {
|
|
248923
|
+
const userInfo = await readAuth();
|
|
248924
|
+
ctx.errorReporter.setContext({
|
|
248925
|
+
user: { email: userInfo.email, name: userInfo.name }
|
|
248926
|
+
});
|
|
248927
|
+
} catch {}
|
|
248928
|
+
}
|
|
248929
|
+
async function ensureAppContext(ctx, options = {}) {
|
|
248930
|
+
const appContext = await initAppContext(options);
|
|
248931
|
+
ctx.app = appContext;
|
|
248932
|
+
ctx.errorReporter.setContext({ appId: appContext.id });
|
|
248933
|
+
}
|
|
248934
|
+
|
|
248935
248935
|
// ../../node_modules/is-plain-obj/index.js
|
|
248936
248936
|
function isPlainObject2(value) {
|
|
248937
248937
|
if (typeof value !== "object" || value === null) {
|
|
@@ -249029,13 +249029,13 @@ var getJoinLength = (uint8Arrays) => {
|
|
|
249029
249029
|
var isTemplateString = (templates) => Array.isArray(templates) && Array.isArray(templates.raw);
|
|
249030
249030
|
var parseTemplates = (templates, expressions) => {
|
|
249031
249031
|
let tokens = [];
|
|
249032
|
-
for (const [index,
|
|
249032
|
+
for (const [index, template2] of templates.entries()) {
|
|
249033
249033
|
tokens = parseTemplate({
|
|
249034
249034
|
templates,
|
|
249035
249035
|
expressions,
|
|
249036
249036
|
tokens,
|
|
249037
249037
|
index,
|
|
249038
|
-
template
|
|
249038
|
+
template: template2
|
|
249039
249039
|
});
|
|
249040
249040
|
}
|
|
249041
249041
|
if (tokens.length === 0) {
|
|
@@ -249044,11 +249044,11 @@ var parseTemplates = (templates, expressions) => {
|
|
|
249044
249044
|
const [file2, ...commandArguments] = tokens;
|
|
249045
249045
|
return [file2, commandArguments, {}];
|
|
249046
249046
|
};
|
|
249047
|
-
var parseTemplate = ({ templates, expressions, tokens, index, template }) => {
|
|
249048
|
-
if (
|
|
249047
|
+
var parseTemplate = ({ templates, expressions, tokens, index, template: template2 }) => {
|
|
249048
|
+
if (template2 === undefined) {
|
|
249049
249049
|
throw new TypeError(`Invalid backslash sequence: ${templates.raw[index]}`);
|
|
249050
249050
|
}
|
|
249051
|
-
const { nextTokens, leadingWhitespaces, trailingWhitespaces } = splitByWhitespaces(
|
|
249051
|
+
const { nextTokens, leadingWhitespaces, trailingWhitespaces } = splitByWhitespaces(template2, templates.raw[index]);
|
|
249052
249052
|
const newTokens = concatTokens(tokens, nextTokens, leadingWhitespaces);
|
|
249053
249053
|
if (index === expressions.length) {
|
|
249054
249054
|
return newTokens;
|
|
@@ -249057,18 +249057,18 @@ var parseTemplate = ({ templates, expressions, tokens, index, template }) => {
|
|
|
249057
249057
|
const expressionTokens = Array.isArray(expression) ? expression.map((expression2) => parseExpression(expression2)) : [parseExpression(expression)];
|
|
249058
249058
|
return concatTokens(newTokens, expressionTokens, trailingWhitespaces);
|
|
249059
249059
|
};
|
|
249060
|
-
var splitByWhitespaces = (
|
|
249060
|
+
var splitByWhitespaces = (template2, rawTemplate) => {
|
|
249061
249061
|
if (rawTemplate.length === 0) {
|
|
249062
249062
|
return { nextTokens: [], leadingWhitespaces: false, trailingWhitespaces: false };
|
|
249063
249063
|
}
|
|
249064
249064
|
const nextTokens = [];
|
|
249065
249065
|
let templateStart = 0;
|
|
249066
249066
|
const leadingWhitespaces = DELIMITERS.has(rawTemplate[0]);
|
|
249067
|
-
for (let templateIndex = 0, rawIndex = 0;templateIndex <
|
|
249067
|
+
for (let templateIndex = 0, rawIndex = 0;templateIndex < template2.length; templateIndex += 1, rawIndex += 1) {
|
|
249068
249068
|
const rawCharacter = rawTemplate[rawIndex];
|
|
249069
249069
|
if (DELIMITERS.has(rawCharacter)) {
|
|
249070
249070
|
if (templateStart !== templateIndex) {
|
|
249071
|
-
nextTokens.push(
|
|
249071
|
+
nextTokens.push(template2.slice(templateStart, templateIndex));
|
|
249072
249072
|
}
|
|
249073
249073
|
templateStart = templateIndex + 1;
|
|
249074
249074
|
} else if (rawCharacter === "\\") {
|
|
@@ -249084,9 +249084,9 @@ var splitByWhitespaces = (template, rawTemplate) => {
|
|
|
249084
249084
|
}
|
|
249085
249085
|
}
|
|
249086
249086
|
}
|
|
249087
|
-
const trailingWhitespaces = templateStart ===
|
|
249087
|
+
const trailingWhitespaces = templateStart === template2.length;
|
|
249088
249088
|
if (!trailingWhitespaces) {
|
|
249089
|
-
nextTokens.push(
|
|
249089
|
+
nextTokens.push(template2.slice(templateStart));
|
|
249090
249090
|
}
|
|
249091
249091
|
return { nextTokens, leadingWhitespaces, trailingWhitespaces };
|
|
249092
249092
|
};
|
|
@@ -250480,8 +250480,8 @@ var disconnect = (anyProcess) => {
|
|
|
250480
250480
|
// ../../node_modules/execa/lib/utils/deferred.js
|
|
250481
250481
|
var createDeferred = () => {
|
|
250482
250482
|
const methods = {};
|
|
250483
|
-
const promise2 = new Promise((
|
|
250484
|
-
Object.assign(methods, { resolve:
|
|
250483
|
+
const promise2 = new Promise((resolve4, reject) => {
|
|
250484
|
+
Object.assign(methods, { resolve: resolve4, reject });
|
|
250485
250485
|
});
|
|
250486
250486
|
return Object.assign(promise2, methods);
|
|
250487
250487
|
};
|
|
@@ -254845,11 +254845,11 @@ var addConcurrentStream = (concurrentStreams, stream, waitName) => {
|
|
|
254845
254845
|
const promises = weakMap.get(stream);
|
|
254846
254846
|
const promise2 = createDeferred();
|
|
254847
254847
|
promises.push(promise2);
|
|
254848
|
-
const
|
|
254849
|
-
return { resolve:
|
|
254848
|
+
const resolve4 = promise2.resolve.bind(promise2);
|
|
254849
|
+
return { resolve: resolve4, promises };
|
|
254850
254850
|
};
|
|
254851
|
-
var waitForConcurrentStreams = async ({ resolve:
|
|
254852
|
-
|
|
254851
|
+
var waitForConcurrentStreams = async ({ resolve: resolve4, promises }, subprocess) => {
|
|
254852
|
+
resolve4();
|
|
254853
254853
|
const [isSubprocessExit] = await Promise.race([
|
|
254854
254854
|
Promise.allSettled([true, subprocess]),
|
|
254855
254855
|
Promise.all([false, ...promises])
|
|
@@ -255428,453 +255428,6 @@ var {
|
|
|
255428
255428
|
getCancelSignal: getCancelSignal2
|
|
255429
255429
|
} = getIpcExport();
|
|
255430
255430
|
|
|
255431
|
-
// src/core/utils/git.ts
|
|
255432
|
-
var GIT_HASH_PATTERN = /^[a-fA-F0-9]{7,64}$/;
|
|
255433
|
-
function isGitCommitHash(value) {
|
|
255434
|
-
return GIT_HASH_PATTERN.test(value);
|
|
255435
|
-
}
|
|
255436
|
-
|
|
255437
|
-
// src/core/site/git-hash.ts
|
|
255438
|
-
async function resolveGitHash(projectRoot, explicit) {
|
|
255439
|
-
const hash2 = explicit ?? await gitHead(projectRoot);
|
|
255440
|
-
if (!hash2 || !isGitCommitHash(hash2)) {
|
|
255441
|
-
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.", {
|
|
255442
|
-
hints: [
|
|
255443
|
-
{
|
|
255444
|
-
message: "Run the deploy from a git checkout, or pass the commit explicitly with --git-hash."
|
|
255445
|
-
}
|
|
255446
|
-
]
|
|
255447
|
-
});
|
|
255448
|
-
}
|
|
255449
|
-
return hash2;
|
|
255450
|
-
}
|
|
255451
|
-
async function gitHead(projectRoot) {
|
|
255452
|
-
try {
|
|
255453
|
-
const { stdout } = await execa("git", ["rev-parse", "HEAD"], {
|
|
255454
|
-
cwd: projectRoot
|
|
255455
|
-
});
|
|
255456
|
-
return stdout.trim();
|
|
255457
|
-
} catch {
|
|
255458
|
-
return null;
|
|
255459
|
-
}
|
|
255460
|
-
}
|
|
255461
|
-
|
|
255462
|
-
// src/core/site/static-site.ts
|
|
255463
|
-
import { readFile as readFile4 } from "node:fs/promises";
|
|
255464
|
-
import { join as join17 } from "node:path";
|
|
255465
|
-
var STATIC_DEPLOYMENTS_ENV = "BASE44_STATIC_DEPLOYMENTS";
|
|
255466
|
-
function staticDeploymentsEnabled(env2 = process.env) {
|
|
255467
|
-
const value = env2[STATIC_DEPLOYMENTS_ENV];
|
|
255468
|
-
return value === "1" || value === "true";
|
|
255469
|
-
}
|
|
255470
|
-
async function deployStaticSite(options) {
|
|
255471
|
-
const { outputDir, gitHash, concurrency, progress } = options;
|
|
255472
|
-
const assets = await buildAssetManifest(outputDir, getAppContext().id);
|
|
255473
|
-
if (!assets.manifest["/index.html"]) {
|
|
255474
|
-
throw new InvalidInputError(`No index.html found in "${outputDir}" — a static site needs one at the output directory root.`);
|
|
255475
|
-
}
|
|
255476
|
-
const created = await createDeployment({
|
|
255477
|
-
git_hash: gitHash,
|
|
255478
|
-
asset_manifest: assets.manifest
|
|
255479
|
-
});
|
|
255480
|
-
if (created.assetUploads && created.assetUploads.type !== "s3") {
|
|
255481
|
-
throw new ApiError(`The server answered a static-site deploy with the "${created.assetUploads.type}" upload target.`);
|
|
255482
|
-
}
|
|
255483
|
-
progress?.onAssets?.({
|
|
255484
|
-
totalAssets: Object.keys(assets.manifest).length,
|
|
255485
|
-
newAssets: created.assetUploads?.uploads.length ?? 0
|
|
255486
|
-
});
|
|
255487
|
-
if (created.assetUploads) {
|
|
255488
|
-
await uploadPresignedAssets(created.assetUploads.uploads, assets, {
|
|
255489
|
-
concurrency,
|
|
255490
|
-
onProgress: progress?.onAssetUpload
|
|
255491
|
-
});
|
|
255492
|
-
}
|
|
255493
|
-
const indexHtml = await readFile4(join17(outputDir, "index.html"));
|
|
255494
|
-
const finalized = await finalizeStaticDeployment(created.deploymentId, new Uint8Array(indexHtml));
|
|
255495
|
-
return { deploymentId: finalized.deploymentId, gitHash };
|
|
255496
|
-
}
|
|
255497
|
-
|
|
255498
|
-
// src/core/site/deploy-app.ts
|
|
255499
|
-
async function planAppDeploy(target) {
|
|
255500
|
-
if (await detectFullStackArtifact(target.root)) {
|
|
255501
|
-
return { kind: "full-stack" };
|
|
255502
|
-
}
|
|
255503
|
-
const outputDirectory = target.site?.outputDirectory;
|
|
255504
|
-
if (!outputDirectory) {
|
|
255505
|
-
return { kind: "none" };
|
|
255506
|
-
}
|
|
255507
|
-
const outputDir = resolve5(target.root, outputDirectory);
|
|
255508
|
-
return staticDeploymentsEnabled() ? { kind: "static-deployment", outputDir } : { kind: "static", outputDir };
|
|
255509
|
-
}
|
|
255510
|
-
async function detectAppDeployKind(target) {
|
|
255511
|
-
return (await planAppDeploy(target)).kind;
|
|
255512
|
-
}
|
|
255513
|
-
async function deployAppSite(target, options = {}) {
|
|
255514
|
-
const plan = await planAppDeploy(target);
|
|
255515
|
-
switch (plan.kind) {
|
|
255516
|
-
case "full-stack": {
|
|
255517
|
-
const gitHash = await resolveGitHash(target.root, options.gitHash);
|
|
255518
|
-
const { deploymentId } = await deployFullStack({
|
|
255519
|
-
projectRoot: target.root,
|
|
255520
|
-
gitHash,
|
|
255521
|
-
concurrency: options.concurrency,
|
|
255522
|
-
progress: options.progress
|
|
255523
|
-
});
|
|
255524
|
-
return { kind: "full-stack", deploymentId, gitHash };
|
|
255525
|
-
}
|
|
255526
|
-
case "static-deployment": {
|
|
255527
|
-
const gitHash = await resolveGitHash(target.root, options.gitHash);
|
|
255528
|
-
const { deploymentId } = await deployStaticSite({
|
|
255529
|
-
outputDir: plan.outputDir,
|
|
255530
|
-
gitHash,
|
|
255531
|
-
concurrency: options.concurrency,
|
|
255532
|
-
progress: options.progress
|
|
255533
|
-
});
|
|
255534
|
-
return { kind: "static-deployment", deploymentId, gitHash };
|
|
255535
|
-
}
|
|
255536
|
-
case "static": {
|
|
255537
|
-
const { appUrl } = await deploySite(plan.outputDir);
|
|
255538
|
-
return { kind: "static", appUrl };
|
|
255539
|
-
}
|
|
255540
|
-
case "none":
|
|
255541
|
-
return { kind: "none" };
|
|
255542
|
-
}
|
|
255543
|
-
}
|
|
255544
|
-
// src/core/project/deploy.ts
|
|
255545
|
-
function hasResourcesToDeploy(projectData) {
|
|
255546
|
-
const {
|
|
255547
|
-
project,
|
|
255548
|
-
entities,
|
|
255549
|
-
functions,
|
|
255550
|
-
agents,
|
|
255551
|
-
agentSkills,
|
|
255552
|
-
connectors,
|
|
255553
|
-
authConfig
|
|
255554
|
-
} = projectData;
|
|
255555
|
-
const hasSite = Boolean(project.site?.outputDirectory || project.site?.buildCommand);
|
|
255556
|
-
const hasEntities = entities.length > 0;
|
|
255557
|
-
const hasFunctions = functions.length > 0;
|
|
255558
|
-
const hasAgents = agents.length > 0;
|
|
255559
|
-
const hasAgentSkills = agentSkills.length > 0;
|
|
255560
|
-
const hasConnectors = connectors.length > 0;
|
|
255561
|
-
const hasAuthConfig = authConfig.length > 0;
|
|
255562
|
-
const hasVisibility = Boolean(project.visibility);
|
|
255563
|
-
return hasEntities || hasFunctions || hasAgents || hasAgentSkills || hasConnectors || hasAuthConfig || hasVisibility || hasSite;
|
|
255564
|
-
}
|
|
255565
|
-
async function deployAll(projectData, options) {
|
|
255566
|
-
const {
|
|
255567
|
-
project,
|
|
255568
|
-
entities,
|
|
255569
|
-
functions,
|
|
255570
|
-
agents,
|
|
255571
|
-
agentSkills,
|
|
255572
|
-
connectors,
|
|
255573
|
-
authConfig
|
|
255574
|
-
} = projectData;
|
|
255575
|
-
await setAppVisibility(project.visibility);
|
|
255576
|
-
if (project.visibility) {
|
|
255577
|
-
options?.onVisibilitySet?.(project.visibility);
|
|
255578
|
-
}
|
|
255579
|
-
await entityResource.push(entities);
|
|
255580
|
-
await deployFunctionsSequentially(functions, {
|
|
255581
|
-
onStart: options?.onFunctionStart,
|
|
255582
|
-
onResult: options?.onFunctionResult
|
|
255583
|
-
});
|
|
255584
|
-
await agentSkillResource.push(agentSkills);
|
|
255585
|
-
await agentResource.push(agents);
|
|
255586
|
-
await authConfigResource.push(authConfig);
|
|
255587
|
-
const skipConnectorSync = connectors.length === 0 && hasWorkspaceApiKeyAuth();
|
|
255588
|
-
const connectorResults = skipConnectorSync ? [] : (await pushConnectors(connectors)).results;
|
|
255589
|
-
if ((options?.site ?? true) && project.site?.outputDirectory) {
|
|
255590
|
-
const outputDir = resolve6(project.root, project.site.outputDirectory);
|
|
255591
|
-
const { appUrl } = await deploySite(outputDir);
|
|
255592
|
-
return { appUrl, connectorResults };
|
|
255593
|
-
}
|
|
255594
|
-
return { connectorResults };
|
|
255595
|
-
}
|
|
255596
|
-
// src/core/clients/base44-client.ts
|
|
255597
|
-
var retriedRequests = new WeakSet;
|
|
255598
|
-
async function captureRequestBody(request, options) {
|
|
255599
|
-
if (request.body == null) {
|
|
255600
|
-
return;
|
|
255601
|
-
}
|
|
255602
|
-
try {
|
|
255603
|
-
const cloned = request.clone();
|
|
255604
|
-
const text = await cloned.text();
|
|
255605
|
-
options.context.__requestBody = text;
|
|
255606
|
-
} catch {}
|
|
255607
|
-
}
|
|
255608
|
-
async function handleUnauthorized(request, _options, response) {
|
|
255609
|
-
if (response.status !== 401) {
|
|
255610
|
-
return;
|
|
255611
|
-
}
|
|
255612
|
-
if (hasWorkspaceApiKeyAuth()) {
|
|
255613
|
-
return;
|
|
255614
|
-
}
|
|
255615
|
-
if (retriedRequests.has(request)) {
|
|
255616
|
-
return;
|
|
255617
|
-
}
|
|
255618
|
-
const newAccessToken = await refreshAndSaveTokens();
|
|
255619
|
-
if (!newAccessToken) {
|
|
255620
|
-
return;
|
|
255621
|
-
}
|
|
255622
|
-
retriedRequests.add(request);
|
|
255623
|
-
const requestId = request.headers.get("X-Request-ID");
|
|
255624
|
-
return distribution_default(request.clone(), {
|
|
255625
|
-
headers: {
|
|
255626
|
-
...requestId && { "X-Request-ID": requestId },
|
|
255627
|
-
Authorization: `Bearer ${newAccessToken}`
|
|
255628
|
-
}
|
|
255629
|
-
});
|
|
255630
|
-
}
|
|
255631
|
-
var base44Client = distribution_default.create({
|
|
255632
|
-
prefixUrl: getBase44ApiUrl(),
|
|
255633
|
-
headers: {
|
|
255634
|
-
"User-Agent": "Base44 CLI"
|
|
255635
|
-
},
|
|
255636
|
-
hooks: {
|
|
255637
|
-
beforeRequest: [
|
|
255638
|
-
(request) => {
|
|
255639
|
-
request.headers.set("X-Request-ID", randomUUID2());
|
|
255640
|
-
},
|
|
255641
|
-
captureRequestBody,
|
|
255642
|
-
async (request) => {
|
|
255643
|
-
const workspaceApiKey = getWorkspaceApiKeyFromEnv();
|
|
255644
|
-
if (workspaceApiKey && isWorkspaceApiKey(workspaceApiKey)) {
|
|
255645
|
-
request.headers.set("api_key", workspaceApiKey);
|
|
255646
|
-
return;
|
|
255647
|
-
}
|
|
255648
|
-
try {
|
|
255649
|
-
const auth = await readAuth();
|
|
255650
|
-
if (isTokenExpired(auth)) {
|
|
255651
|
-
const newAccessToken = await refreshAndSaveTokens();
|
|
255652
|
-
if (newAccessToken) {
|
|
255653
|
-
request.headers.set("Authorization", `Bearer ${newAccessToken}`);
|
|
255654
|
-
return;
|
|
255655
|
-
}
|
|
255656
|
-
}
|
|
255657
|
-
request.headers.set("Authorization", `Bearer ${auth.accessToken}`);
|
|
255658
|
-
} catch {}
|
|
255659
|
-
}
|
|
255660
|
-
],
|
|
255661
|
-
afterResponse: [handleUnauthorized]
|
|
255662
|
-
}
|
|
255663
|
-
});
|
|
255664
|
-
function getAppClient() {
|
|
255665
|
-
const { id } = getAppContext();
|
|
255666
|
-
return base44Client.extend({
|
|
255667
|
-
prefixUrl: new URL(`/api/apps/${id}/`, getBase44ApiUrl()).href
|
|
255668
|
-
});
|
|
255669
|
-
}
|
|
255670
|
-
function getSandboxClient(appId) {
|
|
255671
|
-
return base44Client.extend({
|
|
255672
|
-
prefixUrl: new URL(`/api/apps/${appId}/sandbox-bridge/`, getBase44ApiUrl()).href
|
|
255673
|
-
});
|
|
255674
|
-
}
|
|
255675
|
-
// src/core/clients/oauth-client.ts
|
|
255676
|
-
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
255677
|
-
var oauthClient = distribution_default.create({
|
|
255678
|
-
prefixUrl: getBase44ApiUrl(),
|
|
255679
|
-
headers: {
|
|
255680
|
-
"User-Agent": "Base44 CLI"
|
|
255681
|
-
},
|
|
255682
|
-
hooks: {
|
|
255683
|
-
beforeRequest: [
|
|
255684
|
-
(request) => {
|
|
255685
|
-
request.headers.set("X-Request-ID", randomUUID3());
|
|
255686
|
-
}
|
|
255687
|
-
]
|
|
255688
|
-
}
|
|
255689
|
-
});
|
|
255690
|
-
// src/core/auth/api.ts
|
|
255691
|
-
async function generateDeviceCode() {
|
|
255692
|
-
const response = await oauthClient.post("oauth/device/code", {
|
|
255693
|
-
json: {
|
|
255694
|
-
client_id: AUTH_CLIENT_ID,
|
|
255695
|
-
scope: "apps:read apps:write sandbox:write"
|
|
255696
|
-
},
|
|
255697
|
-
throwHttpErrors: false
|
|
255698
|
-
});
|
|
255699
|
-
if (!response.ok) {
|
|
255700
|
-
throw new ApiError(`Failed to generate device code: ${response.status} ${response.statusText}`, { statusCode: response.status });
|
|
255701
|
-
}
|
|
255702
|
-
const result = DeviceCodeResponseSchema.safeParse(await response.json());
|
|
255703
|
-
if (!result.success) {
|
|
255704
|
-
throw new SchemaValidationError("Invalid device code response from server", result.error);
|
|
255705
|
-
}
|
|
255706
|
-
return result.data;
|
|
255707
|
-
}
|
|
255708
|
-
async function getTokenFromDeviceCode(deviceCode) {
|
|
255709
|
-
const searchParams = new URLSearchParams;
|
|
255710
|
-
searchParams.set("grant_type", "urn:ietf:params:oauth:grant-type:device_code");
|
|
255711
|
-
searchParams.set("device_code", deviceCode);
|
|
255712
|
-
searchParams.set("client_id", AUTH_CLIENT_ID);
|
|
255713
|
-
const response = await oauthClient.post("oauth/token", {
|
|
255714
|
-
body: searchParams.toString(),
|
|
255715
|
-
headers: {
|
|
255716
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
255717
|
-
},
|
|
255718
|
-
throwHttpErrors: false
|
|
255719
|
-
});
|
|
255720
|
-
const json2 = await response.json();
|
|
255721
|
-
if (!response.ok) {
|
|
255722
|
-
const errorResult = OAuthErrorSchema.safeParse(json2);
|
|
255723
|
-
if (!errorResult.success) {
|
|
255724
|
-
throw new SchemaValidationError("Token request failed", errorResult.error);
|
|
255725
|
-
}
|
|
255726
|
-
const { error: error48, error_description } = errorResult.data;
|
|
255727
|
-
if (error48 === "authorization_pending" || error48 === "slow_down") {
|
|
255728
|
-
return null;
|
|
255729
|
-
}
|
|
255730
|
-
throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
|
|
255731
|
-
statusCode: response.status
|
|
255732
|
-
});
|
|
255733
|
-
}
|
|
255734
|
-
const result = TokenResponseSchema.safeParse(json2);
|
|
255735
|
-
if (!result.success) {
|
|
255736
|
-
throw new SchemaValidationError("Invalid token response from server", result.error);
|
|
255737
|
-
}
|
|
255738
|
-
return result.data;
|
|
255739
|
-
}
|
|
255740
|
-
async function renewAccessToken(refreshToken) {
|
|
255741
|
-
const searchParams = new URLSearchParams;
|
|
255742
|
-
searchParams.set("grant_type", "refresh_token");
|
|
255743
|
-
searchParams.set("refresh_token", refreshToken);
|
|
255744
|
-
searchParams.set("client_id", AUTH_CLIENT_ID);
|
|
255745
|
-
const response = await oauthClient.post("oauth/token", {
|
|
255746
|
-
body: searchParams.toString(),
|
|
255747
|
-
headers: {
|
|
255748
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
255749
|
-
},
|
|
255750
|
-
throwHttpErrors: false
|
|
255751
|
-
});
|
|
255752
|
-
const json2 = await response.json();
|
|
255753
|
-
if (!response.ok) {
|
|
255754
|
-
const errorResult = OAuthErrorSchema.safeParse(json2);
|
|
255755
|
-
if (!errorResult.success) {
|
|
255756
|
-
throw new ApiError(`Token refresh failed: ${response.statusText}`, {
|
|
255757
|
-
statusCode: response.status
|
|
255758
|
-
});
|
|
255759
|
-
}
|
|
255760
|
-
const { error: error48, error_description } = errorResult.data;
|
|
255761
|
-
throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
|
|
255762
|
-
statusCode: response.status
|
|
255763
|
-
});
|
|
255764
|
-
}
|
|
255765
|
-
const result = TokenResponseSchema.safeParse(json2);
|
|
255766
|
-
if (!result.success) {
|
|
255767
|
-
throw new SchemaValidationError("Invalid token response from server", result.error);
|
|
255768
|
-
}
|
|
255769
|
-
return result.data;
|
|
255770
|
-
}
|
|
255771
|
-
async function getUserInfo(accessToken) {
|
|
255772
|
-
const response = await oauthClient.get("oauth/userinfo", {
|
|
255773
|
-
headers: { Authorization: `Bearer ${accessToken}` }
|
|
255774
|
-
});
|
|
255775
|
-
if (!response.ok) {
|
|
255776
|
-
throw new ApiError(`Failed to fetch user info: ${response.status}`, {
|
|
255777
|
-
statusCode: response.status
|
|
255778
|
-
});
|
|
255779
|
-
}
|
|
255780
|
-
const result = UserInfoSchema.safeParse(await response.json());
|
|
255781
|
-
if (!result.success) {
|
|
255782
|
-
throw new SchemaValidationError("Invalid UserInfo response from server", result.error);
|
|
255783
|
-
}
|
|
255784
|
-
return result.data;
|
|
255785
|
-
}
|
|
255786
|
-
// src/cli/commands/auth/login-flow.ts
|
|
255787
|
-
async function generateAndDisplayDeviceCode(log, runTask) {
|
|
255788
|
-
const deviceCodeResponse = await runTask("Generating device code...", async () => {
|
|
255789
|
-
return await generateDeviceCode();
|
|
255790
|
-
}, {
|
|
255791
|
-
successMessage: "Device code generated",
|
|
255792
|
-
errorMessage: "Failed to generate device code"
|
|
255793
|
-
});
|
|
255794
|
-
log.info(`Verification code: ${theme.styles.bold(deviceCodeResponse.userCode)}` + `
|
|
255795
|
-
Please confirm this code at: ${deviceCodeResponse.verificationUri}`);
|
|
255796
|
-
return deviceCodeResponse;
|
|
255797
|
-
}
|
|
255798
|
-
async function waitForAuthentication(deviceCode, expiresIn, interval, runTask) {
|
|
255799
|
-
let tokenResponse;
|
|
255800
|
-
try {
|
|
255801
|
-
await runTask("Waiting for authentication...", async () => {
|
|
255802
|
-
await pWaitFor(async () => {
|
|
255803
|
-
const result = await getTokenFromDeviceCode(deviceCode);
|
|
255804
|
-
if (result !== null) {
|
|
255805
|
-
tokenResponse = result;
|
|
255806
|
-
return true;
|
|
255807
|
-
}
|
|
255808
|
-
return false;
|
|
255809
|
-
}, {
|
|
255810
|
-
interval: interval * 1000,
|
|
255811
|
-
timeout: expiresIn * 1000
|
|
255812
|
-
});
|
|
255813
|
-
}, {
|
|
255814
|
-
successMessage: "Authentication completed!",
|
|
255815
|
-
errorMessage: "Authentication failed"
|
|
255816
|
-
});
|
|
255817
|
-
} catch (error48) {
|
|
255818
|
-
if (error48 instanceof Error && error48.message.includes("timed out")) {
|
|
255819
|
-
throw new AuthExpiredError("Authentication timed out. Please try again.");
|
|
255820
|
-
}
|
|
255821
|
-
throw error48;
|
|
255822
|
-
}
|
|
255823
|
-
if (tokenResponse === undefined) {
|
|
255824
|
-
throw new InternalError("Failed to retrieve authentication token.");
|
|
255825
|
-
}
|
|
255826
|
-
return tokenResponse;
|
|
255827
|
-
}
|
|
255828
|
-
async function saveAuthData(response, userInfo) {
|
|
255829
|
-
const expiresAt = Date.now() + response.expiresIn * 1000;
|
|
255830
|
-
await writeAuth({
|
|
255831
|
-
accessToken: response.accessToken,
|
|
255832
|
-
refreshToken: response.refreshToken,
|
|
255833
|
-
expiresAt,
|
|
255834
|
-
email: userInfo.email,
|
|
255835
|
-
name: userInfo.name
|
|
255836
|
-
});
|
|
255837
|
-
}
|
|
255838
|
-
async function login({
|
|
255839
|
-
log,
|
|
255840
|
-
runTask
|
|
255841
|
-
}) {
|
|
255842
|
-
const deviceCodeResponse = await generateAndDisplayDeviceCode(log, runTask);
|
|
255843
|
-
const token = await waitForAuthentication(deviceCodeResponse.deviceCode, deviceCodeResponse.expiresIn, deviceCodeResponse.interval, runTask);
|
|
255844
|
-
const userInfo = await getUserInfo(token.accessToken);
|
|
255845
|
-
await saveAuthData(token, userInfo);
|
|
255846
|
-
return {
|
|
255847
|
-
outroMessage: `Successfully logged in as ${theme.styles.bold(userInfo.email)}`
|
|
255848
|
-
};
|
|
255849
|
-
}
|
|
255850
|
-
|
|
255851
|
-
// src/cli/utils/command/middleware.ts
|
|
255852
|
-
async function ensureAuth(ctx) {
|
|
255853
|
-
if (hasWorkspaceApiKeyAuth()) {
|
|
255854
|
-
ctx.errorReporter.setContext({
|
|
255855
|
-
user: { email: "workspace-api-key", name: "Workspace API key" }
|
|
255856
|
-
});
|
|
255857
|
-
return;
|
|
255858
|
-
}
|
|
255859
|
-
await seedAuthFromEnv();
|
|
255860
|
-
const loggedIn = await isLoggedIn();
|
|
255861
|
-
if (!loggedIn) {
|
|
255862
|
-
ctx.log.info("You need to login first to continue.");
|
|
255863
|
-
await login(ctx);
|
|
255864
|
-
}
|
|
255865
|
-
try {
|
|
255866
|
-
const userInfo = await readAuth();
|
|
255867
|
-
ctx.errorReporter.setContext({
|
|
255868
|
-
user: { email: userInfo.email, name: userInfo.name }
|
|
255869
|
-
});
|
|
255870
|
-
} catch {}
|
|
255871
|
-
}
|
|
255872
|
-
async function ensureAppContext(ctx, options = {}) {
|
|
255873
|
-
const appContext = await initAppContext(options);
|
|
255874
|
-
ctx.app = appContext;
|
|
255875
|
-
ctx.errorReporter.setContext({ appId: appContext.id });
|
|
255876
|
-
}
|
|
255877
|
-
|
|
255878
255431
|
// src/cli/utils/version-check.ts
|
|
255879
255432
|
async function checkForUpgrade() {
|
|
255880
255433
|
const testLatestVersion = getTestOverrides()?.latestVersion;
|
|
@@ -256267,6 +255820,11 @@ function verifyDenoInstalled(context) {
|
|
|
256267
255820
|
});
|
|
256268
255821
|
}
|
|
256269
255822
|
}
|
|
255823
|
+
// src/core/utils/git.ts
|
|
255824
|
+
var GIT_HASH_PATTERN = /^[a-fA-F0-9]{7,64}$/;
|
|
255825
|
+
function isGitCommitHash(value) {
|
|
255826
|
+
return GIT_HASH_PATTERN.test(value);
|
|
255827
|
+
}
|
|
256270
255828
|
// src/core/workspace/schema.ts
|
|
256271
255829
|
var WorkspaceSchema = exports_external.object({
|
|
256272
255830
|
id: exports_external.string(),
|
|
@@ -256341,7 +255899,7 @@ async function pullAction({
|
|
|
256341
255899
|
runTask: runTask2
|
|
256342
255900
|
}) {
|
|
256343
255901
|
const { project: project2 } = await readProjectConfig();
|
|
256344
|
-
const dir =
|
|
255902
|
+
const dir = join17(dirname10(project2.configPath), project2.agentSkillsDir);
|
|
256345
255903
|
const remote = await runTask2("Fetching agent skills from Base44", () => fetchAgentSkills(), {
|
|
256346
255904
|
successMessage: "Agent skills fetched successfully",
|
|
256347
255905
|
errorMessage: "Failed to fetch agent skills"
|
|
@@ -256397,14 +255955,14 @@ function getAgentSkillsCommand() {
|
|
|
256397
255955
|
}
|
|
256398
255956
|
|
|
256399
255957
|
// src/cli/commands/agents/pull.ts
|
|
256400
|
-
import { dirname as
|
|
255958
|
+
import { dirname as dirname11, join as join18 } from "node:path";
|
|
256401
255959
|
async function pullAgentsAction({
|
|
256402
255960
|
log,
|
|
256403
255961
|
runTask: runTask2
|
|
256404
255962
|
}) {
|
|
256405
255963
|
const { project: project2 } = await readProjectConfig();
|
|
256406
|
-
const configDir =
|
|
256407
|
-
const agentsDir =
|
|
255964
|
+
const configDir = dirname11(project2.configPath);
|
|
255965
|
+
const agentsDir = join18(configDir, project2.agentsDir);
|
|
256408
255966
|
const remoteAgents = await runTask2("Fetching agents from Base44", async () => {
|
|
256409
255967
|
return await fetchAgents();
|
|
256410
255968
|
}, {
|
|
@@ -256474,12 +256032,12 @@ function getAgentsCommand() {
|
|
|
256474
256032
|
}
|
|
256475
256033
|
|
|
256476
256034
|
// src/cli/commands/auth/password-login.ts
|
|
256477
|
-
import { dirname as
|
|
256035
|
+
import { dirname as dirname12, join as join19 } from "node:path";
|
|
256478
256036
|
async function passwordLoginAction({ log, runTask: runTask2 }, action) {
|
|
256479
256037
|
const shouldEnable = action === "enable";
|
|
256480
256038
|
const { project: project2 } = await readProjectConfig();
|
|
256481
|
-
const configDir =
|
|
256482
|
-
const authDir =
|
|
256039
|
+
const configDir = dirname12(project2.configPath);
|
|
256040
|
+
const authDir = join19(configDir, project2.authDir);
|
|
256483
256041
|
const updated = await runTask2("Updating local auth config", async () => {
|
|
256484
256042
|
const current = await readAuthConfig(authDir) ?? DEFAULT_AUTH_CONFIG;
|
|
256485
256043
|
const merged = { ...current, enableUsernamePassword: shouldEnable };
|
|
@@ -256499,14 +256057,14 @@ function getPasswordLoginCommand() {
|
|
|
256499
256057
|
}
|
|
256500
256058
|
|
|
256501
256059
|
// src/cli/commands/auth/pull.ts
|
|
256502
|
-
import { dirname as
|
|
256060
|
+
import { dirname as dirname13, join as join20 } from "node:path";
|
|
256503
256061
|
async function pullAuthAction({
|
|
256504
256062
|
log,
|
|
256505
256063
|
runTask: runTask2
|
|
256506
256064
|
}) {
|
|
256507
256065
|
const { project: project2 } = await readProjectConfig();
|
|
256508
|
-
const configDir =
|
|
256509
|
-
const authDir =
|
|
256066
|
+
const configDir = dirname13(project2.configPath);
|
|
256067
|
+
const authDir = join20(configDir, project2.authDir);
|
|
256510
256068
|
const remoteConfig = await runTask2("Fetching auth config from Base44", async () => {
|
|
256511
256069
|
return await pullAuthConfig();
|
|
256512
256070
|
}, {
|
|
@@ -256570,7 +256128,7 @@ function getAuthPushCommand() {
|
|
|
256570
256128
|
}
|
|
256571
256129
|
|
|
256572
256130
|
// src/cli/commands/auth/social-login.ts
|
|
256573
|
-
import { dirname as
|
|
256131
|
+
import { dirname as dirname14, join as join21, resolve as resolve4 } from "node:path";
|
|
256574
256132
|
var PROVIDER_LABELS = {
|
|
256575
256133
|
google: "Google",
|
|
256576
256134
|
microsoft: "Microsoft",
|
|
@@ -256610,7 +256168,7 @@ async function socialLoginAction({ log, isNonInteractive, runTask: runTask2 }, p
|
|
|
256610
256168
|
let clientSecret;
|
|
256611
256169
|
if (useCustomOAuth && oauth && oauthCli && hasSecretOptions(options)) {
|
|
256612
256170
|
if (options.envFile) {
|
|
256613
|
-
const secrets = await parseEnvFile(
|
|
256171
|
+
const secrets = await parseEnvFile(resolve4(options.envFile));
|
|
256614
256172
|
const value = secrets[oauthCli.envVar];
|
|
256615
256173
|
if (!value) {
|
|
256616
256174
|
throw new InvalidInputError(`Key "${oauthCli.envVar}" not found in ${options.envFile}.`);
|
|
@@ -256640,8 +256198,8 @@ async function socialLoginAction({ log, isNonInteractive, runTask: runTask2 }, p
|
|
|
256640
256198
|
}
|
|
256641
256199
|
}
|
|
256642
256200
|
const { project: project2 } = await readProjectConfig();
|
|
256643
|
-
const configDir =
|
|
256644
|
-
const authDir =
|
|
256201
|
+
const configDir = dirname14(project2.configPath);
|
|
256202
|
+
const authDir = join21(configDir, project2.authDir);
|
|
256645
256203
|
const { config: updated } = await runTask2("Updating local auth config", async () => updateSocialLoginConfig(authDir, provider, shouldEnable, useCustomOAuth && options.clientId ? { clientId: options.clientId } : undefined));
|
|
256646
256204
|
if (clientSecret) {
|
|
256647
256205
|
await runTask2("Saving client secret", async () => pushCustomOAuthSecret(provider, clientSecret));
|
|
@@ -256666,7 +256224,7 @@ function getSocialLoginCommand() {
|
|
|
256666
256224
|
}
|
|
256667
256225
|
|
|
256668
256226
|
// src/cli/commands/auth/sso.ts
|
|
256669
|
-
import { dirname as
|
|
256227
|
+
import { dirname as dirname15, join as join22, resolve as resolve5 } from "node:path";
|
|
256670
256228
|
var SSOConfigFileSchema = exports_external.object({
|
|
256671
256229
|
provider: exports_external.enum(Object.values(KNOWN_SSO_PROVIDERS)),
|
|
256672
256230
|
clientId: exports_external.string(),
|
|
@@ -256682,7 +256240,7 @@ var SSOConfigFileSchema = exports_external.object({
|
|
|
256682
256240
|
ssoName: exports_external.string().optional()
|
|
256683
256241
|
});
|
|
256684
256242
|
async function loadSSOConfigFile(filePath) {
|
|
256685
|
-
const resolved =
|
|
256243
|
+
const resolved = resolve5(filePath);
|
|
256686
256244
|
const raw2 = await readJsonFile(resolved);
|
|
256687
256245
|
const result = SSOConfigFileSchema.safeParse(raw2);
|
|
256688
256246
|
if (!result.success) {
|
|
@@ -256770,7 +256328,7 @@ async function ssoEnableAction({ isNonInteractive, runTask: runTask2 }, options)
|
|
|
256770
256328
|
}
|
|
256771
256329
|
let clientSecret;
|
|
256772
256330
|
if (merged.envFile && !merged.clientSecret) {
|
|
256773
|
-
const secrets2 = await parseEnvFile(
|
|
256331
|
+
const secrets2 = await parseEnvFile(resolve5(merged.envFile));
|
|
256774
256332
|
const value = secrets2.sso_client_secret;
|
|
256775
256333
|
if (!value) {
|
|
256776
256334
|
throw new InvalidInputError(`Key "sso_client_secret" not found in ${merged.envFile}.`);
|
|
@@ -256829,8 +256387,8 @@ async function ssoEnableAction({ isNonInteractive, runTask: runTask2 }, options)
|
|
|
256829
256387
|
throw error48;
|
|
256830
256388
|
}
|
|
256831
256389
|
const { project: project2 } = await readProjectConfig();
|
|
256832
|
-
const configDir =
|
|
256833
|
-
const authDir =
|
|
256390
|
+
const configDir = dirname15(project2.configPath);
|
|
256391
|
+
const authDir = join22(configDir, project2.authDir);
|
|
256834
256392
|
await runTask2("Updating local auth config", async () => updateSSOConfig(authDir, provider, true));
|
|
256835
256393
|
await runTask2("Saving SSO credentials", async () => pushSSOSecrets(secrets));
|
|
256836
256394
|
return {
|
|
@@ -256845,8 +256403,8 @@ async function ssoDisableAction({ log, runTask: runTask2 }, options) {
|
|
|
256845
256403
|
throw new InvalidInputError("Configuration options cannot be used with disable. To disable SSO: base44 auth sso disable");
|
|
256846
256404
|
}
|
|
256847
256405
|
const { project: project2 } = await readProjectConfig();
|
|
256848
|
-
const configDir =
|
|
256849
|
-
const authDir =
|
|
256406
|
+
const configDir = dirname15(project2.configPath);
|
|
256407
|
+
const authDir = join22(configDir, project2.authDir);
|
|
256850
256408
|
const updated = await runTask2("Updating local auth config", async () => updateSSOConfig(authDir, null, false));
|
|
256851
256409
|
await runTask2("Removing SSO credentials", async () => deleteSSOSecrets());
|
|
256852
256410
|
if (!hasAnyLoginMethod(updated)) {
|
|
@@ -257408,19 +256966,19 @@ var baseOpen = async (options) => {
|
|
|
257408
256966
|
}
|
|
257409
256967
|
const subprocess = childProcess3.spawn(command2, cliArguments, childProcessOptions);
|
|
257410
256968
|
if (options.wait) {
|
|
257411
|
-
return new Promise((
|
|
256969
|
+
return new Promise((resolve6, reject) => {
|
|
257412
256970
|
subprocess.once("error", reject);
|
|
257413
256971
|
subprocess.once("close", (exitCode) => {
|
|
257414
256972
|
if (!options.allowNonzeroExitCode && exitCode !== 0) {
|
|
257415
256973
|
reject(new Error(`Exited with code ${exitCode}`));
|
|
257416
256974
|
return;
|
|
257417
256975
|
}
|
|
257418
|
-
|
|
256976
|
+
resolve6(subprocess);
|
|
257419
256977
|
});
|
|
257420
256978
|
});
|
|
257421
256979
|
}
|
|
257422
256980
|
if (isFallbackAttempt) {
|
|
257423
|
-
return new Promise((
|
|
256981
|
+
return new Promise((resolve6, reject) => {
|
|
257424
256982
|
subprocess.once("error", reject);
|
|
257425
256983
|
subprocess.once("spawn", () => {
|
|
257426
256984
|
subprocess.once("close", (exitCode) => {
|
|
@@ -257430,17 +256988,17 @@ var baseOpen = async (options) => {
|
|
|
257430
256988
|
return;
|
|
257431
256989
|
}
|
|
257432
256990
|
subprocess.unref();
|
|
257433
|
-
|
|
256991
|
+
resolve6(subprocess);
|
|
257434
256992
|
});
|
|
257435
256993
|
});
|
|
257436
256994
|
});
|
|
257437
256995
|
}
|
|
257438
256996
|
subprocess.unref();
|
|
257439
|
-
return new Promise((
|
|
256997
|
+
return new Promise((resolve6, reject) => {
|
|
257440
256998
|
subprocess.once("error", reject);
|
|
257441
256999
|
subprocess.once("spawn", () => {
|
|
257442
257000
|
subprocess.off("error", reject);
|
|
257443
|
-
|
|
257001
|
+
resolve6(subprocess);
|
|
257444
257002
|
});
|
|
257445
257003
|
});
|
|
257446
257004
|
};
|
|
@@ -257703,13 +257261,13 @@ function getConnectorsListAvailableCommand() {
|
|
|
257703
257261
|
}
|
|
257704
257262
|
|
|
257705
257263
|
// src/cli/commands/connectors/pull.ts
|
|
257706
|
-
import { dirname as
|
|
257264
|
+
import { dirname as dirname16, join as join23, resolve as resolve6 } from "node:path";
|
|
257707
257265
|
async function resolveConnectorsDir(options) {
|
|
257708
257266
|
if (!getAppContext().projectRoot) {
|
|
257709
|
-
return
|
|
257267
|
+
return resolve6(options.dir ?? "connectors");
|
|
257710
257268
|
}
|
|
257711
257269
|
const { project: project2 } = await readProjectConfig();
|
|
257712
|
-
return
|
|
257270
|
+
return join23(dirname16(project2.configPath), project2.connectorsDir);
|
|
257713
257271
|
}
|
|
257714
257272
|
async function pullConnectorsAction({ log, runTask: runTask2, jsonMode }, options) {
|
|
257715
257273
|
const connectorsDir = await resolveConnectorsDir(options);
|
|
@@ -257750,10 +257308,10 @@ function getConnectorsPullCommand() {
|
|
|
257750
257308
|
}
|
|
257751
257309
|
|
|
257752
257310
|
// src/cli/commands/connectors/push.ts
|
|
257753
|
-
import { resolve as
|
|
257311
|
+
import { resolve as resolve7 } from "node:path";
|
|
257754
257312
|
async function readConnectorsToPush(options) {
|
|
257755
257313
|
if (!getAppContext().projectRoot) {
|
|
257756
|
-
return readAllConnectors(
|
|
257314
|
+
return readAllConnectors(resolve7(options.dir ?? "connectors"));
|
|
257757
257315
|
}
|
|
257758
257316
|
const { connectors } = await readProjectConfig();
|
|
257759
257317
|
return connectors;
|
|
@@ -258117,11 +257675,11 @@ function getListCommand() {
|
|
|
258117
257675
|
}
|
|
258118
257676
|
|
|
258119
257677
|
// src/cli/commands/functions/pull.ts
|
|
258120
|
-
import { dirname as
|
|
257678
|
+
import { dirname as dirname17, join as join24 } from "node:path";
|
|
258121
257679
|
async function pullFunctionsAction({ log, runTask: runTask2 }, name2) {
|
|
258122
257680
|
const { project: project2, functions } = await readProjectConfig();
|
|
258123
|
-
const configDir =
|
|
258124
|
-
const functionsDir =
|
|
257681
|
+
const configDir = dirname17(project2.configPath);
|
|
257682
|
+
const functionsDir = join24(configDir, project2.functionsDir);
|
|
258125
257683
|
const pluginFunctionNames = new Set(functions.filter((fn) => fn.source.type === "plugin").map((fn) => fn.name));
|
|
258126
257684
|
const remoteFunctions = await runTask2("Fetching functions from Base44", async () => {
|
|
258127
257685
|
const { functions: functions2 } = await listDeployedFunctions();
|
|
@@ -258254,11 +257812,11 @@ function getBuildCommand() {
|
|
|
258254
257812
|
}
|
|
258255
257813
|
|
|
258256
257814
|
// src/cli/commands/project/create.ts
|
|
258257
|
-
import { basename as basename5, resolve as
|
|
257815
|
+
import { basename as basename5, resolve as resolve8 } from "node:path";
|
|
258258
257816
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
258259
257817
|
|
|
258260
257818
|
// src/cli/commands/project/scaffold-shared.ts
|
|
258261
|
-
import { join as
|
|
257819
|
+
import { join as join25 } from "node:path";
|
|
258262
257820
|
var DEFAULT_TEMPLATE_ID = "backend-only";
|
|
258263
257821
|
async function getTemplateById(templateId) {
|
|
258264
257822
|
const templates = await listTemplates();
|
|
@@ -258317,7 +257875,7 @@ async function completeProjectSetup({
|
|
|
258317
257875
|
updateMessage("Building project...");
|
|
258318
257876
|
await execa({ cwd: resolvedPath, shell: true })`${buildCommand}`;
|
|
258319
257877
|
updateMessage("Deploying site...");
|
|
258320
|
-
return await deploySite(
|
|
257878
|
+
return await deploySite(join25(resolvedPath, outputDirectory));
|
|
258321
257879
|
}, {
|
|
258322
257880
|
successMessage: theme.colors.base44Orange("Site deployed successfully"),
|
|
258323
257881
|
errorMessage: "Failed to deploy site"
|
|
@@ -258446,7 +258004,7 @@ async function createInteractive(options, ctx) {
|
|
|
258446
258004
|
}, ctx);
|
|
258447
258005
|
}
|
|
258448
258006
|
async function createNonInteractive(options, ctx) {
|
|
258449
|
-
ctx.log.info(`Creating a new project at ${
|
|
258007
|
+
ctx.log.info(`Creating a new project at ${resolve8(options.path)}`);
|
|
258450
258008
|
const template2 = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
|
|
258451
258009
|
return await executeCreate({
|
|
258452
258010
|
template: template2,
|
|
@@ -258470,7 +258028,7 @@ async function executeCreate({
|
|
|
258470
258028
|
}, ctx) {
|
|
258471
258029
|
const { log, runTask: runTask2 } = ctx;
|
|
258472
258030
|
const name2 = rawName.trim();
|
|
258473
|
-
const resolvedPath =
|
|
258031
|
+
const resolvedPath = resolve8(projectPath);
|
|
258474
258032
|
const organizationId = await resolveWorkspaceId(ctx, flagWorkspaceId, isInteractive);
|
|
258475
258033
|
const { projectId } = await runTask2("Setting up your project...", async () => {
|
|
258476
258034
|
return await createProjectFiles({
|
|
@@ -258520,81 +258078,6 @@ Examples:
|
|
|
258520
258078
|
$ base44 create my-app --workspace 507f1f77bcf86cd799439011 Creates a base44 project in the given workspace`).hook("preAction", validateCreateOptions).action(createAction);
|
|
258521
258079
|
}
|
|
258522
258080
|
|
|
258523
|
-
// src/cli/commands/site/deploy-options.ts
|
|
258524
|
-
function addDeploymentOptions(command2) {
|
|
258525
|
-
return command2.addOption(new Option("--git-hash <hash>", "Commit the build came from (defaults to the checkout's HEAD)").argParser(parseGitHash)).addOption(new Option("--concurrency <n>", "Parallel asset uploads").default(DEFAULT_UPLOAD_CONCURRENCY).argParser(parseConcurrency));
|
|
258526
|
-
}
|
|
258527
|
-
function parseGitHash(value) {
|
|
258528
|
-
if (!isGitCommitHash(value)) {
|
|
258529
|
-
throw new InvalidArgumentError("Expected a git commit hash (7-64 hex chars).");
|
|
258530
|
-
}
|
|
258531
|
-
return value;
|
|
258532
|
-
}
|
|
258533
|
-
function parseConcurrency(value) {
|
|
258534
|
-
const parsed = Number(value);
|
|
258535
|
-
if (!Number.isInteger(parsed) || parsed < 1 || parsed > MAX_UPLOAD_CONCURRENCY) {
|
|
258536
|
-
throw new InvalidArgumentError(`Expected a whole number between 1 and ${MAX_UPLOAD_CONCURRENCY}.`);
|
|
258537
|
-
}
|
|
258538
|
-
return parsed;
|
|
258539
|
-
}
|
|
258540
|
-
|
|
258541
|
-
// src/cli/commands/site/run-app-deploy.ts
|
|
258542
|
-
var TASK_LABELS = {
|
|
258543
|
-
"full-stack": {
|
|
258544
|
-
start: "Deploying full-stack app...",
|
|
258545
|
-
success: theme.colors.base44Orange("Full-stack app deployed"),
|
|
258546
|
-
error: "Full-stack deploy failed"
|
|
258547
|
-
},
|
|
258548
|
-
"static-deployment": {
|
|
258549
|
-
start: "Deploying site...",
|
|
258550
|
-
success: "Site deployed",
|
|
258551
|
-
error: "Site deploy failed"
|
|
258552
|
-
},
|
|
258553
|
-
static: {
|
|
258554
|
-
start: "Creating archive and deploying site...",
|
|
258555
|
-
success: "Site deployed successfully",
|
|
258556
|
-
error: "Deployment failed"
|
|
258557
|
-
}
|
|
258558
|
-
};
|
|
258559
|
-
async function runAppSiteDeploy({ runTask: runTask2, log }, target, options = {}) {
|
|
258560
|
-
const kind = await detectAppDeployKind(target);
|
|
258561
|
-
if (kind === "none")
|
|
258562
|
-
return { kind: "none" };
|
|
258563
|
-
const labels = TASK_LABELS[kind];
|
|
258564
|
-
const progressLines = [];
|
|
258565
|
-
const warnings = [];
|
|
258566
|
-
const result = await runTask2(labels.start, async (updateMessage) => await deployAppSite(target, {
|
|
258567
|
-
gitHash: options.gitHash,
|
|
258568
|
-
concurrency: options.concurrency,
|
|
258569
|
-
progress: {
|
|
258570
|
-
onWarning: (message) => {
|
|
258571
|
-
warnings.push(message);
|
|
258572
|
-
},
|
|
258573
|
-
onAssets: ({ totalAssets, newAssets }) => {
|
|
258574
|
-
const line = `Found ${totalAssets} static assets (${newAssets} new)`;
|
|
258575
|
-
progressLines.push(line);
|
|
258576
|
-
updateMessage(line);
|
|
258577
|
-
},
|
|
258578
|
-
onAssetUpload: ({ uploadedFiles, totalFiles }) => {
|
|
258579
|
-
updateMessage(`Uploaded ${uploadedFiles} of ${totalFiles} assets`);
|
|
258580
|
-
},
|
|
258581
|
-
onWorker: ({ moduleCount }) => {
|
|
258582
|
-
updateMessage(`Deploying worker (${moduleCount} modules)…`);
|
|
258583
|
-
}
|
|
258584
|
-
}
|
|
258585
|
-
}), {
|
|
258586
|
-
successMessage: labels.success,
|
|
258587
|
-
errorMessage: labels.error
|
|
258588
|
-
});
|
|
258589
|
-
for (const line of progressLines) {
|
|
258590
|
-
log.message(theme.styles.dim(line));
|
|
258591
|
-
}
|
|
258592
|
-
for (const warning of warnings) {
|
|
258593
|
-
log.warn(warning);
|
|
258594
|
-
}
|
|
258595
|
-
return result;
|
|
258596
|
-
}
|
|
258597
|
-
|
|
258598
258081
|
// src/cli/commands/project/deploy.ts
|
|
258599
258082
|
async function deployAction(ctx, options = {}) {
|
|
258600
258083
|
const { isNonInteractive, log } = ctx;
|
|
@@ -258602,13 +258085,12 @@ async function deployAction(ctx, options = {}) {
|
|
|
258602
258085
|
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
258603
258086
|
}
|
|
258604
258087
|
const projectData = await readProjectConfig(options.projectRoot);
|
|
258605
|
-
|
|
258606
|
-
const plannedSite = await detectAppDeployKind(project2);
|
|
258607
|
-
if (!hasResourcesToDeploy(projectData) && plannedSite === "none") {
|
|
258088
|
+
if (!hasResourcesToDeploy(projectData)) {
|
|
258608
258089
|
return {
|
|
258609
258090
|
outroMessage: "No resources found to deploy"
|
|
258610
258091
|
};
|
|
258611
258092
|
}
|
|
258093
|
+
const { project: project2, entities, functions, agents, connectors, authConfig } = projectData;
|
|
258612
258094
|
const summaryLines = [];
|
|
258613
258095
|
if (entities.length > 0) {
|
|
258614
258096
|
summaryLines.push(` - ${entities.length} ${entities.length === 1 ? "entity" : "entities"}`);
|
|
@@ -258628,9 +258110,7 @@ async function deployAction(ctx, options = {}) {
|
|
|
258628
258110
|
if (project2.visibility) {
|
|
258629
258111
|
summaryLines.push(` - Visibility: ${project2.visibility}`);
|
|
258630
258112
|
}
|
|
258631
|
-
if (
|
|
258632
|
-
summaryLines.push(" - Full-stack app");
|
|
258633
|
-
} else if (project2.site?.outputDirectory) {
|
|
258113
|
+
if (project2.site?.outputDirectory) {
|
|
258634
258114
|
summaryLines.push(` - Site from ${project2.site.outputDirectory}`);
|
|
258635
258115
|
}
|
|
258636
258116
|
if (!options.yes) {
|
|
@@ -258652,7 +258132,6 @@ ${summaryLines.join(`
|
|
|
258652
258132
|
let functionCompleted = 0;
|
|
258653
258133
|
const functionTotal = functions.length;
|
|
258654
258134
|
const result = await deployAll(projectData, {
|
|
258655
|
-
site: false,
|
|
258656
258135
|
onVisibilitySet: (level) => {
|
|
258657
258136
|
log.success(`App visibility set to ${level}`);
|
|
258658
258137
|
},
|
|
@@ -258665,10 +258144,6 @@ ${summaryLines.join(`
|
|
|
258665
258144
|
formatDeployResult(r, log);
|
|
258666
258145
|
}
|
|
258667
258146
|
});
|
|
258668
|
-
const siteResult = await runAppSiteDeploy(ctx, project2, {
|
|
258669
|
-
gitHash: options.gitHash,
|
|
258670
|
-
concurrency: options.concurrency
|
|
258671
|
-
});
|
|
258672
258147
|
const connectorResults = result.connectorResults ?? [];
|
|
258673
258148
|
await handleOAuthConnectors(connectorResults, isNonInteractive, options, log);
|
|
258674
258149
|
const stripeResult = connectorResults.find((r) => r.type === "stripe");
|
|
@@ -258676,28 +258151,13 @@ ${summaryLines.join(`
|
|
|
258676
258151
|
printStripeResult(stripeResult, log);
|
|
258677
258152
|
}
|
|
258678
258153
|
log.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl())}`);
|
|
258679
|
-
if (
|
|
258680
|
-
log.message(`${theme.styles.header("App URL")}: ${theme.colors.links(
|
|
258681
|
-
}
|
|
258682
|
-
const deployment = siteResult.kind === "full-stack" || siteResult.kind === "static-deployment" ? siteResult : undefined;
|
|
258683
|
-
if (deployment) {
|
|
258684
|
-
printDeploymentSummary(deployment, log);
|
|
258154
|
+
if (result.appUrl) {
|
|
258155
|
+
log.message(`${theme.styles.header("App URL")}: ${theme.colors.links(result.appUrl)}`);
|
|
258685
258156
|
}
|
|
258686
|
-
return {
|
|
258687
|
-
outroMessage: "App deployed successfully",
|
|
258688
|
-
stdout: ctx.jsonMode && deployment ? `${JSON.stringify({
|
|
258689
|
-
deploymentId: deployment.deploymentId,
|
|
258690
|
-
gitHash: deployment.gitHash
|
|
258691
|
-
}, null, 2)}
|
|
258692
|
-
` : undefined
|
|
258693
|
-
};
|
|
258694
|
-
}
|
|
258695
|
-
function printDeploymentSummary(deployment, log) {
|
|
258696
|
-
log.message(`${theme.styles.header("Deployment")}: ${deployment.deploymentId} ${theme.styles.dim(`(commit ${deployment.gitHash.slice(0, 12)})`)}`);
|
|
258157
|
+
return { outroMessage: "App deployed successfully" };
|
|
258697
258158
|
}
|
|
258698
258159
|
function getDeployCommand2() {
|
|
258699
|
-
|
|
258700
|
-
return addDeploymentOptions(command2).action(deployAction);
|
|
258160
|
+
return new Base44Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").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)").action(deployAction);
|
|
258701
258161
|
}
|
|
258702
258162
|
async function handleOAuthConnectors(connectorResults, isNonInteractive, options, log) {
|
|
258703
258163
|
const needsOAuth = filterPendingOAuth(connectorResults);
|
|
@@ -258975,7 +258435,7 @@ async function followLogs(functionNames, options, availableFunctionNames, jsonMo
|
|
|
258975
258435
|
for (const entry of fresh)
|
|
258976
258436
|
writeFollowLine(entry, jsonMode);
|
|
258977
258437
|
first = false;
|
|
258978
|
-
await new Promise((
|
|
258438
|
+
await new Promise((resolve9) => setTimeout(resolve9, 2000));
|
|
258979
258439
|
}
|
|
258980
258440
|
}
|
|
258981
258441
|
function formatLogs(entries, env3) {
|
|
@@ -259085,11 +258545,13 @@ async function logsAction(ctx, options) {
|
|
|
259085
258545
|
};
|
|
259086
258546
|
}
|
|
259087
258547
|
function getLogsCommand() {
|
|
259088
|
-
return new Base44Command("logs").description("Fetch function logs for this app").option("--function <names>", "Filter by function name(s), comma-separated. If omitted, fetches logs for all project functions").option("--since <datetime>", "Show logs from this time. ISO datetime or relative shorthand (e.g. 1h, 30m, 2d)", normalizeDatetime).option("--until <datetime>", "Show logs until this time. ISO datetime or relative shorthand (e.g. 1h, 30m, 2d)", normalizeDatetime).addOption(new Option("--level <level>", "Filter by log level").choices([
|
|
258548
|
+
return new Base44Command("logs").description("Fetch function logs for this app").option("--function <names>", "Filter by function name(s), comma-separated. If omitted, fetches logs for all project functions").option("--since <datetime>", "Show logs from this time. ISO datetime or relative shorthand (e.g. 1h, 30m, 2d)", normalizeDatetime).option("--until <datetime>", "Show logs until this time. ISO datetime or relative shorthand (e.g. 1h, 30m, 2d)", normalizeDatetime).addOption(new Option("--level <level>", "Filter by log level").choices([
|
|
258549
|
+
...LogLevelSchema.options
|
|
258550
|
+
])).option("-n, --limit <n>", "Results per page (1-1000, default: 50)").option("-f, --follow", "Stream new logs as they arrive").addOption(new Option("--order <order>", "Sort order").choices(["asc", "desc"])).addOption(new Option("--env <env>", "Which deployment to read logs from: preview (current draft) or prod (published). Default: preview").choices([...LogEnvSchema.options])).action(logsAction);
|
|
259089
258551
|
}
|
|
259090
258552
|
|
|
259091
258553
|
// src/cli/commands/project/scaffold.ts
|
|
259092
|
-
import { basename as basename6, resolve as
|
|
258554
|
+
import { basename as basename6, resolve as resolve9 } from "node:path";
|
|
259093
258555
|
function resolveAppId(options) {
|
|
259094
258556
|
const appId = options.appId;
|
|
259095
258557
|
if (!appId) {
|
|
@@ -259105,7 +258567,7 @@ function resolveAppId(options) {
|
|
|
259105
258567
|
async function scaffoldAction(ctx, name2, options, command2) {
|
|
259106
258568
|
const { log, runTask: runTask2 } = ctx;
|
|
259107
258569
|
const appId = resolveAppId(command2.optsWithGlobals());
|
|
259108
|
-
const resolvedPath =
|
|
258570
|
+
const resolvedPath = resolve9("./");
|
|
259109
258571
|
const projectName = (name2 ?? basename6(resolvedPath)).trim();
|
|
259110
258572
|
const template2 = await getTemplateById("backend-only");
|
|
259111
258573
|
log.info(`Scaffolding project at ${resolvedPath}`);
|
|
@@ -259502,7 +258964,7 @@ function getSecretsListCommand() {
|
|
|
259502
258964
|
}
|
|
259503
258965
|
|
|
259504
258966
|
// src/cli/commands/secrets/set.ts
|
|
259505
|
-
import { resolve as
|
|
258967
|
+
import { resolve as resolve10 } from "node:path";
|
|
259506
258968
|
function parseEntries(entries) {
|
|
259507
258969
|
const secrets = {};
|
|
259508
258970
|
for (const entry of entries) {
|
|
@@ -259533,7 +258995,7 @@ async function setSecretsAction({ log, runTask: runTask2 }, entries, options) {
|
|
|
259533
258995
|
validateInput(entries, options);
|
|
259534
258996
|
let secrets;
|
|
259535
258997
|
if (options.envFile) {
|
|
259536
|
-
secrets = await parseEnvFile(
|
|
258998
|
+
secrets = await parseEnvFile(resolve10(options.envFile));
|
|
259537
258999
|
if (Object.keys(secrets).length === 0) {
|
|
259538
259000
|
throw new InvalidInputError("The env file contains no valid KEY=VALUE entries.");
|
|
259539
259001
|
}
|
|
@@ -259562,53 +259024,92 @@ function getSecretsCommand() {
|
|
|
259562
259024
|
}
|
|
259563
259025
|
|
|
259564
259026
|
// src/cli/commands/site/deploy.ts
|
|
259027
|
+
import { resolve as resolve11 } from "node:path";
|
|
259565
259028
|
async function deployAction2(ctx, options) {
|
|
259566
259029
|
const { isNonInteractive } = ctx;
|
|
259567
259030
|
if (isNonInteractive && !options.yes) {
|
|
259568
259031
|
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
259569
259032
|
}
|
|
259570
259033
|
const { project: project2 } = await readProjectConfig();
|
|
259571
|
-
const
|
|
259572
|
-
if (
|
|
259034
|
+
const outputDirectory = project2.site?.outputDirectory;
|
|
259035
|
+
if (!outputDirectory) {
|
|
259573
259036
|
throw new ConfigNotFoundError("No site configuration found.", {
|
|
259574
259037
|
hints: [
|
|
259575
259038
|
{
|
|
259576
259039
|
message: `Add 'site.outputDirectory' to your config.jsonc (e.g., "site": { "outputDirectory": "dist" })`
|
|
259577
|
-
},
|
|
259578
|
-
{
|
|
259579
|
-
message: "Full-stack apps ship from their build artifact — run your framework's build first"
|
|
259580
259040
|
}
|
|
259581
259041
|
]
|
|
259582
259042
|
});
|
|
259583
259043
|
}
|
|
259584
259044
|
if (!options.yes) {
|
|
259585
259045
|
const shouldDeploy = await Re({
|
|
259586
|
-
message:
|
|
259046
|
+
message: `Deploy site from ${outputDirectory}?`
|
|
259587
259047
|
});
|
|
259588
259048
|
if (Ct(shouldDeploy) || !shouldDeploy) {
|
|
259589
259049
|
return { outroMessage: "Deployment cancelled" };
|
|
259590
259050
|
}
|
|
259591
259051
|
}
|
|
259592
259052
|
await maybeBuildBeforeDeploy(ctx, project2, options.build);
|
|
259593
|
-
const
|
|
259594
|
-
|
|
259595
|
-
|
|
259596
|
-
|
|
259597
|
-
|
|
259598
|
-
|
|
259599
|
-
|
|
259600
|
-
|
|
259053
|
+
const outputDir = resolve11(project2.root, outputDirectory);
|
|
259054
|
+
const { gitHash, concurrency } = options;
|
|
259055
|
+
return gitHash ? await deployToDeploymentsApi(ctx, outputDir, gitHash, concurrency) : await deployTarball(ctx, outputDir);
|
|
259056
|
+
}
|
|
259057
|
+
async function deployToDeploymentsApi({ runTask: runTask2, log, jsonMode }, outputDir, gitHash, concurrency) {
|
|
259058
|
+
const progressLines = [];
|
|
259059
|
+
const { deploymentId } = await runTask2("Deploying site...", async (updateMessage) => await deployStaticSite({
|
|
259060
|
+
outputDir,
|
|
259061
|
+
gitHash,
|
|
259062
|
+
concurrency,
|
|
259063
|
+
progress: {
|
|
259064
|
+
onAssets: ({ totalAssets, newAssets }) => {
|
|
259065
|
+
const line = `Found ${totalAssets} static assets (${newAssets} new)`;
|
|
259066
|
+
progressLines.push(line);
|
|
259067
|
+
updateMessage(line);
|
|
259068
|
+
},
|
|
259069
|
+
onAssetUpload: ({ uploadedFiles, totalFiles }) => {
|
|
259070
|
+
updateMessage(`Uploaded ${uploadedFiles} of ${totalFiles} assets`);
|
|
259071
|
+
}
|
|
259072
|
+
}
|
|
259073
|
+
}), { successMessage: "Site deployed", errorMessage: "Site deploy failed" });
|
|
259074
|
+
for (const line of progressLines) {
|
|
259075
|
+
log.message(theme.styles.dim(line));
|
|
259076
|
+
}
|
|
259077
|
+
return {
|
|
259078
|
+
outroMessage: `Deployment ${deploymentId} (commit ${gitHash.slice(0, 12)})`,
|
|
259079
|
+
stdout: jsonMode ? `${JSON.stringify({ deploymentId, gitHash }, null, 2)}
|
|
259601
259080
|
` : undefined
|
|
259602
|
-
|
|
259081
|
+
};
|
|
259082
|
+
}
|
|
259083
|
+
async function deployTarball({ runTask: runTask2 }, outputDir) {
|
|
259084
|
+
const { appUrl } = await runTask2("Creating archive and deploying site...", async () => await deploySite(outputDir), {
|
|
259085
|
+
successMessage: "Site deployed successfully",
|
|
259086
|
+
errorMessage: "Deployment failed"
|
|
259087
|
+
});
|
|
259088
|
+
return { outroMessage: `Visit your site at: ${appUrl}` };
|
|
259089
|
+
}
|
|
259090
|
+
function getSiteDeployCommand() {
|
|
259091
|
+
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)");
|
|
259092
|
+
if (staticDeploymentsEnabled()) {
|
|
259093
|
+
command2.addOption(new Option("--git-hash <hash>", "Commit the build came from — deploys through the deployments API").argParser((value) => {
|
|
259094
|
+
if (!isGitCommitHash(value)) {
|
|
259095
|
+
throw new InvalidArgumentError("Expected a git commit hash (7-64 hex chars).");
|
|
259096
|
+
}
|
|
259097
|
+
return value;
|
|
259098
|
+
}));
|
|
259099
|
+
command2.addOption(new Option("--concurrency <n>", "Parallel asset uploads").default(DEFAULT_UPLOAD_CONCURRENCY).argParser(parseConcurrency));
|
|
259603
259100
|
}
|
|
259604
|
-
|
|
259605
|
-
|
|
259101
|
+
return command2.action(deployAction2);
|
|
259102
|
+
}
|
|
259103
|
+
function parseConcurrency(value) {
|
|
259104
|
+
const parsed = Number(value);
|
|
259105
|
+
if (!Number.isInteger(parsed) || parsed < 1 || parsed > MAX_UPLOAD_CONCURRENCY) {
|
|
259106
|
+
throw new InvalidArgumentError(`Expected a whole number between 1 and ${MAX_UPLOAD_CONCURRENCY}.`);
|
|
259606
259107
|
}
|
|
259607
|
-
return
|
|
259108
|
+
return parsed;
|
|
259608
259109
|
}
|
|
259609
|
-
function
|
|
259610
|
-
const
|
|
259611
|
-
return
|
|
259110
|
+
function staticDeploymentsEnabled(env3 = process.env) {
|
|
259111
|
+
const value = env3.BASE44_STATIC_DEPLOYMENTS;
|
|
259112
|
+
return value === "1" || value === "true";
|
|
259612
259113
|
}
|
|
259613
259114
|
|
|
259614
259115
|
// src/cli/commands/site/open.ts
|
|
@@ -259715,10 +259216,10 @@ function toPascalCase(name2) {
|
|
|
259715
259216
|
return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
|
|
259716
259217
|
}
|
|
259717
259218
|
// src/core/types/update-project.ts
|
|
259718
|
-
import { join as
|
|
259219
|
+
import { join as join28 } from "node:path";
|
|
259719
259220
|
var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
|
|
259720
259221
|
async function updateProjectConfig(projectRoot) {
|
|
259721
|
-
const tsconfigPath =
|
|
259222
|
+
const tsconfigPath = join28(projectRoot, "tsconfig.json");
|
|
259722
259223
|
if (!await pathExists(tsconfigPath)) {
|
|
259723
259224
|
return false;
|
|
259724
259225
|
}
|
|
@@ -259953,7 +259454,7 @@ function createDevLogger(label2, labelColor = theme.styles.dim) {
|
|
|
259953
259454
|
// src/cli/dev/dev-server/main.ts
|
|
259954
259455
|
var import_cors = __toESM(require_lib4(), 1);
|
|
259955
259456
|
var import_express6 = __toESM(require_express(), 1);
|
|
259956
|
-
import { dirname as
|
|
259457
|
+
import { dirname as dirname23, join as join35 } from "node:path";
|
|
259957
259458
|
|
|
259958
259459
|
// ../../node_modules/get-port/index.js
|
|
259959
259460
|
import net from "node:net";
|
|
@@ -259980,14 +259481,14 @@ var getLocalHosts = () => {
|
|
|
259980
259481
|
}
|
|
259981
259482
|
return results;
|
|
259982
259483
|
};
|
|
259983
|
-
var checkAvailablePort = (options8) => new Promise((
|
|
259484
|
+
var checkAvailablePort = (options8) => new Promise((resolve13, reject) => {
|
|
259984
259485
|
const server = net.createServer();
|
|
259985
259486
|
server.unref();
|
|
259986
259487
|
server.on("error", reject);
|
|
259987
259488
|
server.listen(options8, () => {
|
|
259988
259489
|
const { port } = server.address();
|
|
259989
259490
|
server.close(() => {
|
|
259990
|
-
|
|
259491
|
+
resolve13(port);
|
|
259991
259492
|
});
|
|
259992
259493
|
});
|
|
259993
259494
|
});
|
|
@@ -260088,7 +259589,7 @@ var $setGracefulCleanup = tmp.setGracefulCleanup;
|
|
|
260088
259589
|
|
|
260089
259590
|
// src/cli/dev/dev-server/function-manager.ts
|
|
260090
259591
|
import { spawn as spawn2 } from "node:child_process";
|
|
260091
|
-
import { dirname as
|
|
259592
|
+
import { dirname as dirname20, join as join29 } from "node:path";
|
|
260092
259593
|
import { pathToFileURL } from "node:url";
|
|
260093
259594
|
|
|
260094
259595
|
// src/cli/dev/dev-server/base-function-manager.ts
|
|
@@ -260193,7 +259694,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
260193
259694
|
}
|
|
260194
259695
|
spawnFunction(func, port) {
|
|
260195
259696
|
this.logger.log(`Spawning function "${func.name}" on port ${port}`);
|
|
260196
|
-
const importMapPath =
|
|
259697
|
+
const importMapPath = join29(dirname20(this.wrapperPath), "import-map.json");
|
|
260197
259698
|
const process23 = spawn2("deno", ["run", "--allow-all", "--import-map", importMapPath, this.wrapperPath], {
|
|
260198
259699
|
env: {
|
|
260199
259700
|
...globalThis.process.env,
|
|
@@ -260232,7 +259733,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
260232
259733
|
});
|
|
260233
259734
|
}
|
|
260234
259735
|
waitForReady(name2, runningFunc) {
|
|
260235
|
-
return new Promise((
|
|
259736
|
+
return new Promise((resolve13, reject) => {
|
|
260236
259737
|
runningFunc.process.on("exit", (code2) => {
|
|
260237
259738
|
if (!runningFunc.ready) {
|
|
260238
259739
|
clearTimeout(timeout3);
|
|
@@ -260255,7 +259756,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
260255
259756
|
runningFunc.ready = true;
|
|
260256
259757
|
clearTimeout(timeout3);
|
|
260257
259758
|
runningFunc.process.stdout?.off("data", onData);
|
|
260258
|
-
|
|
259759
|
+
resolve13(runningFunc.port);
|
|
260259
259760
|
}
|
|
260260
259761
|
};
|
|
260261
259762
|
runningFunc.process.stdout?.on("data", onData);
|
|
@@ -260267,7 +259768,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
260267
259768
|
import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
260268
259769
|
import { isBuiltin } from "node:module";
|
|
260269
259770
|
import { homedir as homedir3 } from "node:os";
|
|
260270
|
-
import { join as
|
|
259771
|
+
import { join as join30 } from "node:path";
|
|
260271
259772
|
import { pathToFileURL as pathToFileURL6 } from "node:url";
|
|
260272
259773
|
var depsPromise;
|
|
260273
259774
|
function loadDeps() {
|
|
@@ -260388,9 +259889,9 @@ export default {
|
|
|
260388
259889
|
};
|
|
260389
259890
|
`;
|
|
260390
259891
|
function ensureBundlerConfig() {
|
|
260391
|
-
const dir =
|
|
259892
|
+
const dir = join30(homedir3(), ".base44", "function-bundler");
|
|
260392
259893
|
mkdirSync2(dir, { recursive: true });
|
|
260393
|
-
const configPath =
|
|
259894
|
+
const configPath = join30(dir, "deno.json");
|
|
260394
259895
|
writeFileSync2(configPath, `${JSON.stringify({ nodeModulesDir: "auto" }, null, 2)}
|
|
260395
259896
|
`);
|
|
260396
259897
|
return configPath;
|
|
@@ -261841,16 +261342,16 @@ function createCustomIntegrationRoutes(remoteProxy, logger2) {
|
|
|
261841
261342
|
|
|
261842
261343
|
// src/cli/dev/dev-server/watcher.ts
|
|
261843
261344
|
import { EventEmitter as EventEmitter4 } from "node:events";
|
|
261844
|
-
import { relative as
|
|
261345
|
+
import { relative as relative6 } from "node:path";
|
|
261845
261346
|
|
|
261846
261347
|
// ../../node_modules/chokidar/index.js
|
|
261847
261348
|
import { EventEmitter as EventEmitter3 } from "node:events";
|
|
261848
261349
|
import { stat as statcb, Stats } from "node:fs";
|
|
261849
|
-
import { readdir as readdir3, stat as
|
|
261350
|
+
import { readdir as readdir3, stat as stat5 } from "node:fs/promises";
|
|
261850
261351
|
import * as sp3 from "node:path";
|
|
261851
261352
|
|
|
261852
261353
|
// ../../node_modules/readdirp/index.js
|
|
261853
|
-
import { lstat as lstat2, readdir as readdir2, realpath, stat as
|
|
261354
|
+
import { lstat as lstat2, readdir as readdir2, realpath, stat as stat3 } from "node:fs/promises";
|
|
261854
261355
|
import { join as pjoin, relative as prelative, resolve as presolve, sep as psep } from "node:path";
|
|
261855
261356
|
import { Readable as Readable6 } from "node:stream";
|
|
261856
261357
|
var EntryTypes = {
|
|
@@ -261932,7 +261433,7 @@ class ReaddirpStream extends Readable6 {
|
|
|
261932
261433
|
const { root: root2, type } = opts;
|
|
261933
261434
|
this._fileFilter = normalizeFilter(opts.fileFilter);
|
|
261934
261435
|
this._directoryFilter = normalizeFilter(opts.directoryFilter);
|
|
261935
|
-
const statMethod = opts.lstat ? lstat2 :
|
|
261436
|
+
const statMethod = opts.lstat ? lstat2 : stat3;
|
|
261936
261437
|
if (wantBigintFsStats) {
|
|
261937
261438
|
this._stat = (path19) => statMethod(path19, { bigint: true });
|
|
261938
261439
|
} else {
|
|
@@ -262085,7 +261586,7 @@ function readdirp(root2, options8 = {}) {
|
|
|
262085
261586
|
|
|
262086
261587
|
// ../../node_modules/chokidar/handler.js
|
|
262087
261588
|
import { watch as fs_watch, unwatchFile, watchFile } from "node:fs";
|
|
262088
|
-
import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as
|
|
261589
|
+
import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as stat4 } from "node:fs/promises";
|
|
262089
261590
|
import { type as osType } from "node:os";
|
|
262090
261591
|
import * as sp2 from "node:path";
|
|
262091
261592
|
var STR_DATA = "data";
|
|
@@ -262111,7 +261612,7 @@ var EVENTS = {
|
|
|
262111
261612
|
};
|
|
262112
261613
|
var EV = EVENTS;
|
|
262113
261614
|
var THROTTLE_MODE_WATCH = "watch";
|
|
262114
|
-
var statMethods = { lstat: lstat3, stat:
|
|
261615
|
+
var statMethods = { lstat: lstat3, stat: stat4 };
|
|
262115
261616
|
var KEY_LISTENERS = "listeners";
|
|
262116
261617
|
var KEY_ERR = "errHandlers";
|
|
262117
261618
|
var KEY_RAW = "rawEmitters";
|
|
@@ -262571,9 +262072,9 @@ class NodeFsHandler {
|
|
|
262571
262072
|
if (this.fsw.closed) {
|
|
262572
262073
|
return;
|
|
262573
262074
|
}
|
|
262574
|
-
const
|
|
262075
|
+
const dirname22 = sp2.dirname(file2);
|
|
262575
262076
|
const basename8 = sp2.basename(file2);
|
|
262576
|
-
const parent = this.fsw._getWatchedDir(
|
|
262077
|
+
const parent = this.fsw._getWatchedDir(dirname22);
|
|
262577
262078
|
let prevStats = stats;
|
|
262578
262079
|
if (parent.has(basename8))
|
|
262579
262080
|
return;
|
|
@@ -262582,7 +262083,7 @@ class NodeFsHandler {
|
|
|
262582
262083
|
return;
|
|
262583
262084
|
if (!newStats || newStats.mtimeMs === 0) {
|
|
262584
262085
|
try {
|
|
262585
|
-
const newStats2 = await
|
|
262086
|
+
const newStats2 = await stat4(file2);
|
|
262586
262087
|
if (this.fsw.closed)
|
|
262587
262088
|
return;
|
|
262588
262089
|
const at13 = newStats2.atimeMs;
|
|
@@ -262600,7 +262101,7 @@ class NodeFsHandler {
|
|
|
262600
262101
|
prevStats = newStats2;
|
|
262601
262102
|
}
|
|
262602
262103
|
} catch (error48) {
|
|
262603
|
-
this.fsw._remove(
|
|
262104
|
+
this.fsw._remove(dirname22, basename8);
|
|
262604
262105
|
}
|
|
262605
262106
|
} else if (parent.has(basename8)) {
|
|
262606
262107
|
const at13 = newStats.atimeMs;
|
|
@@ -262689,7 +262190,7 @@ class NodeFsHandler {
|
|
|
262689
262190
|
this._addToNodeFs(path19, initialAdd, wh2, depth + 1);
|
|
262690
262191
|
}
|
|
262691
262192
|
}).on(EV.ERROR, this._boundHandleError);
|
|
262692
|
-
return new Promise((
|
|
262193
|
+
return new Promise((resolve14, reject) => {
|
|
262693
262194
|
if (!stream)
|
|
262694
262195
|
return reject();
|
|
262695
262196
|
stream.once(STR_END, () => {
|
|
@@ -262698,7 +262199,7 @@ class NodeFsHandler {
|
|
|
262698
262199
|
return;
|
|
262699
262200
|
}
|
|
262700
262201
|
const wasThrottled = throttler ? throttler.clear() : false;
|
|
262701
|
-
|
|
262202
|
+
resolve14(undefined);
|
|
262702
262203
|
previous.getChildren().filter((item) => {
|
|
262703
262204
|
return item !== directory && !current.has(item);
|
|
262704
262205
|
}).forEach((item) => {
|
|
@@ -262823,11 +262324,11 @@ function createPattern(matcher) {
|
|
|
262823
262324
|
if (matcher.path === string4)
|
|
262824
262325
|
return true;
|
|
262825
262326
|
if (matcher.recursive) {
|
|
262826
|
-
const
|
|
262827
|
-
if (!
|
|
262327
|
+
const relative6 = sp3.relative(matcher.path, string4);
|
|
262328
|
+
if (!relative6) {
|
|
262828
262329
|
return false;
|
|
262829
262330
|
}
|
|
262830
|
-
return !
|
|
262331
|
+
return !relative6.startsWith("..") && !sp3.isAbsolute(relative6);
|
|
262831
262332
|
}
|
|
262832
262333
|
return false;
|
|
262833
262334
|
};
|
|
@@ -263254,7 +262755,7 @@ class FSWatcher extends EventEmitter3 {
|
|
|
263254
262755
|
const fullPath = opts.cwd ? sp3.join(opts.cwd, path19) : path19;
|
|
263255
262756
|
let stats2;
|
|
263256
262757
|
try {
|
|
263257
|
-
stats2 = await
|
|
262758
|
+
stats2 = await stat5(fullPath);
|
|
263258
262759
|
} catch (err) {}
|
|
263259
262760
|
if (!stats2 || this.closed)
|
|
263260
262761
|
return;
|
|
@@ -263358,8 +262859,8 @@ class FSWatcher extends EventEmitter3 {
|
|
|
263358
262859
|
}
|
|
263359
262860
|
return this._userIgnored(path19, stats);
|
|
263360
262861
|
}
|
|
263361
|
-
_isntIgnored(path19,
|
|
263362
|
-
return !this._isIgnored(path19,
|
|
262862
|
+
_isntIgnored(path19, stat6) {
|
|
262863
|
+
return !this._isIgnored(path19, stat6);
|
|
263363
262864
|
}
|
|
263364
262865
|
_getWatchHelpers(path19) {
|
|
263365
262866
|
return new WatchHelper(path19, this.options.followSymlinks, this);
|
|
@@ -263526,7 +263027,7 @@ class WatchBase44 extends EventEmitter4 {
|
|
|
263526
263027
|
ignoreInitial: true
|
|
263527
263028
|
});
|
|
263528
263029
|
watcher.on("all", import_debounce.default(async (_event, path19) => {
|
|
263529
|
-
this.emit("change", name2,
|
|
263030
|
+
this.emit("change", name2, relative6(targetPath, path19));
|
|
263530
263031
|
}, WATCH_DEBOUNCE_MS));
|
|
263531
263032
|
watcher.on("error", (err) => {
|
|
263532
263033
|
this.logger.error(`Watch handler failed for ${targetPath}`, err);
|
|
@@ -263615,7 +263116,7 @@ async function createDevServer(options8) {
|
|
|
263615
263116
|
}
|
|
263616
263117
|
remoteProxy(req, res, next);
|
|
263617
263118
|
});
|
|
263618
|
-
const server = await new Promise((
|
|
263119
|
+
const server = await new Promise((resolve15, reject) => {
|
|
263619
263120
|
const s5 = app.listen(port, "127.0.0.1", (err) => {
|
|
263620
263121
|
if (err) {
|
|
263621
263122
|
if ("code" in err && err.code === "EADDRINUSE") {
|
|
@@ -263624,7 +263125,7 @@ async function createDevServer(options8) {
|
|
|
263624
263125
|
reject(err);
|
|
263625
263126
|
}
|
|
263626
263127
|
} else {
|
|
263627
|
-
|
|
263128
|
+
resolve15(s5);
|
|
263628
263129
|
}
|
|
263629
263130
|
});
|
|
263630
263131
|
});
|
|
@@ -263633,8 +263134,8 @@ async function createDevServer(options8) {
|
|
|
263633
263134
|
broadcastEntityEvent(io6, appId, entityName, event);
|
|
263634
263135
|
};
|
|
263635
263136
|
const base44ConfigWatcher = new WatchBase44({
|
|
263636
|
-
functions:
|
|
263637
|
-
entities:
|
|
263137
|
+
functions: join35(dirname23(project2.configPath), project2.functionsDir),
|
|
263138
|
+
entities: join35(dirname23(project2.configPath), project2.entitiesDir)
|
|
263638
263139
|
}, devLogger);
|
|
263639
263140
|
base44ConfigWatcher.on("change", async (name2) => {
|
|
263640
263141
|
try {
|
|
@@ -263674,13 +263175,13 @@ async function createDevServer(options8) {
|
|
|
263674
263175
|
if (!server.listening) {
|
|
263675
263176
|
return;
|
|
263676
263177
|
}
|
|
263677
|
-
await new Promise((
|
|
263178
|
+
await new Promise((resolve15, reject) => {
|
|
263678
263179
|
server.close((error48) => {
|
|
263679
263180
|
if (error48) {
|
|
263680
263181
|
reject(error48);
|
|
263681
263182
|
return;
|
|
263682
263183
|
}
|
|
263683
|
-
|
|
263184
|
+
resolve15();
|
|
263684
263185
|
});
|
|
263685
263186
|
});
|
|
263686
263187
|
};
|
|
@@ -263751,15 +263252,15 @@ class ServeRunner {
|
|
|
263751
263252
|
return;
|
|
263752
263253
|
}
|
|
263753
263254
|
this.stopping = true;
|
|
263754
|
-
const exited = new Promise((
|
|
263255
|
+
const exited = new Promise((resolve15) => child.once("exit", () => resolve15()));
|
|
263755
263256
|
if (process23.platform === "win32" && child.pid) {
|
|
263756
263257
|
const taskkill = spawn3("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
|
|
263757
263258
|
stdio: "ignore",
|
|
263758
263259
|
windowsHide: true
|
|
263759
263260
|
});
|
|
263760
|
-
await new Promise((
|
|
263761
|
-
taskkill.once("exit", () =>
|
|
263762
|
-
taskkill.once("error", () =>
|
|
263261
|
+
await new Promise((resolve15) => {
|
|
263262
|
+
taskkill.once("exit", () => resolve15());
|
|
263263
|
+
taskkill.once("error", () => resolve15());
|
|
263763
263264
|
});
|
|
263764
263265
|
} else if (child.pid) {
|
|
263765
263266
|
try {
|
|
@@ -263929,13 +263430,13 @@ async function runScript(options8) {
|
|
|
263929
263430
|
}
|
|
263930
263431
|
// src/cli/commands/exec.ts
|
|
263931
263432
|
function readStdin2() {
|
|
263932
|
-
return new Promise((
|
|
263433
|
+
return new Promise((resolve15, reject) => {
|
|
263933
263434
|
let data = "";
|
|
263934
263435
|
process.stdin.setEncoding("utf-8");
|
|
263935
263436
|
process.stdin.on("data", (chunk) => {
|
|
263936
263437
|
data += chunk;
|
|
263937
263438
|
});
|
|
263938
|
-
process.stdin.on("end", () =>
|
|
263439
|
+
process.stdin.on("end", () => resolve15(data));
|
|
263939
263440
|
process.stdin.on("error", reject);
|
|
263940
263441
|
});
|
|
263941
263442
|
}
|
|
@@ -264006,7 +263507,7 @@ Examples:
|
|
|
264006
263507
|
}
|
|
264007
263508
|
|
|
264008
263509
|
// src/cli/commands/project/eject.ts
|
|
264009
|
-
import { resolve as
|
|
263510
|
+
import { resolve as resolve15 } from "node:path";
|
|
264010
263511
|
var import_kebabCase2 = __toESM(require_kebabCase(), 1);
|
|
264011
263512
|
async function eject(ctx, options8, command2) {
|
|
264012
263513
|
const { log, runTask: runTask2, isNonInteractive } = ctx;
|
|
@@ -264070,7 +263571,7 @@ async function eject(ctx, options8, command2) {
|
|
|
264070
263571
|
Ne("Operation cancelled.");
|
|
264071
263572
|
throw new CLIExitError(0);
|
|
264072
263573
|
}
|
|
264073
|
-
const resolvedPath =
|
|
263574
|
+
const resolvedPath = resolve15(selectedPath);
|
|
264074
263575
|
await runTask2("Downloading your project's code...", async (updateMessage) => {
|
|
264075
263576
|
await createProjectFilesForExistingProject({
|
|
264076
263577
|
projectId,
|
|
@@ -264163,7 +263664,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
|
|
|
264163
263664
|
import { release, type } from "node:os";
|
|
264164
263665
|
|
|
264165
263666
|
// ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
264166
|
-
import { dirname as
|
|
263667
|
+
import { dirname as dirname24, posix, sep } from "path";
|
|
264167
263668
|
function createModulerModifier() {
|
|
264168
263669
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
264169
263670
|
return async (frames) => {
|
|
@@ -264172,7 +263673,7 @@ function createModulerModifier() {
|
|
|
264172
263673
|
return frames;
|
|
264173
263674
|
};
|
|
264174
263675
|
}
|
|
264175
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
263676
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname24(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
|
|
264176
263677
|
const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
|
|
264177
263678
|
return (filename) => {
|
|
264178
263679
|
if (!filename)
|
|
@@ -266450,14 +265951,14 @@ async function addSourceContext(frames) {
|
|
|
266450
265951
|
return frames;
|
|
266451
265952
|
}
|
|
266452
265953
|
function getContextLinesFromFile(path19, ranges, output) {
|
|
266453
|
-
return new Promise((
|
|
265954
|
+
return new Promise((resolve16) => {
|
|
266454
265955
|
const stream = createReadStream2(path19);
|
|
266455
265956
|
const lineReaded = createInterface2({
|
|
266456
265957
|
input: stream
|
|
266457
265958
|
});
|
|
266458
265959
|
function destroyStreamAndResolve() {
|
|
266459
265960
|
stream.destroy();
|
|
266460
|
-
|
|
265961
|
+
resolve16();
|
|
266461
265962
|
}
|
|
266462
265963
|
let lineNumber = 0;
|
|
266463
265964
|
let currentRangeIndex = 0;
|
|
@@ -267569,15 +267070,15 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
267569
267070
|
return true;
|
|
267570
267071
|
if (this.featureFlagsPoller === undefined)
|
|
267571
267072
|
return false;
|
|
267572
|
-
return new Promise((
|
|
267073
|
+
return new Promise((resolve16) => {
|
|
267573
267074
|
const timeout3 = setTimeout(() => {
|
|
267574
267075
|
cleanup();
|
|
267575
|
-
|
|
267076
|
+
resolve16(false);
|
|
267576
267077
|
}, timeoutMs);
|
|
267577
267078
|
const cleanup = this._events.on("localEvaluationFlagsLoaded", (count2) => {
|
|
267578
267079
|
clearTimeout(timeout3);
|
|
267579
267080
|
cleanup();
|
|
267580
|
-
|
|
267081
|
+
resolve16(count2 > 0);
|
|
267581
267082
|
});
|
|
267582
267083
|
});
|
|
267583
267084
|
}
|
|
@@ -268361,9 +267862,9 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
|
|
|
268361
267862
|
});
|
|
268362
267863
|
}
|
|
268363
267864
|
// src/cli/index.ts
|
|
268364
|
-
var __dirname4 =
|
|
267865
|
+
var __dirname4 = dirname25(fileURLToPath6(import.meta.url));
|
|
268365
267866
|
async function runCLI(options8) {
|
|
268366
|
-
ensureNpmAssets(
|
|
267867
|
+
ensureNpmAssets(join36(__dirname4, "../assets"));
|
|
268367
267868
|
const errorReporter = new ErrorReporter;
|
|
268368
267869
|
errorReporter.registerProcessErrorHandlers();
|
|
268369
267870
|
const jsonMode = process.argv.includes("--json");
|
|
@@ -268402,4 +267903,4 @@ export {
|
|
|
268402
267903
|
CLIExitError
|
|
268403
267904
|
};
|
|
268404
267905
|
|
|
268405
|
-
//# debugId=
|
|
267906
|
+
//# debugId=D124AF9A61B7AEE264756E2164756E21
|