@base44-preview/cli 0.1.8-pr.589.9d22ef2 → 0.1.9-pr.584.ee1769c
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/assets/templates/backend-and-client/package.json +2 -1
- package/dist/assets/templates/backend-and-client/src/api/base44Client.js +12 -0
- package/dist/assets/templates/backend-and-client/src/lib/app-params.js +28 -0
- package/dist/assets/templates/backend-and-client/vite.config.js +3 -8
- package/dist/cli/index.js +1492 -741
- package/dist/cli/index.js.map +38 -25
- package/package.json +1 -1
- package/dist/assets/templates/backend-and-client/src/api/base44Client.js.ejs +0 -5
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(stat3, path11, options) {
|
|
23356
|
+
if (!stat3.isSymbolicLink() && !stat3.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, stat3) {
|
|
23363
|
+
cb(er, er ? false : checkStat(stat3, 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, stat3) {
|
|
23378
|
+
cb(er, er ? false : checkStat(stat3, 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(stat3, options) {
|
|
23385
|
+
return stat3.isFile() && checkMode(stat3, options);
|
|
23386
23386
|
}
|
|
23387
|
-
function checkMode(
|
|
23388
|
-
var mod =
|
|
23389
|
-
var uid =
|
|
23390
|
-
var gid =
|
|
23387
|
+
function checkMode(stat3, options) {
|
|
23388
|
+
var mod = stat3.mode;
|
|
23389
|
+
var uid = stat3.uid;
|
|
23390
|
+
var gid = stat3.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(resolve6, reject) {
|
|
23423
23423
|
isexe(path11, options || {}, function(er, is) {
|
|
23424
23424
|
if (er) {
|
|
23425
23425
|
reject(er);
|
|
23426
23426
|
} else {
|
|
23427
|
-
|
|
23427
|
+
resolve6(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((resolve6, reject) => {
|
|
23490
23490
|
if (i === pathEnv.length)
|
|
23491
|
-
return opt.all && found.length ?
|
|
23491
|
+
return opt.all && found.length ? resolve6(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
|
+
resolve6(subStep(p, i, 0));
|
|
23497
23497
|
});
|
|
23498
|
-
const subStep = (p, i, ii) => new Promise((
|
|
23498
|
+
const subStep = (p, i, ii) => new Promise((resolve6, reject) => {
|
|
23499
23499
|
if (ii === pathExt.length)
|
|
23500
|
-
return
|
|
23500
|
+
return resolve6(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 resolve6(p + ext);
|
|
23508
23508
|
}
|
|
23509
|
-
return
|
|
23509
|
+
return resolve6(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 join18(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 = join18;
|
|
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" ? join27(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 join27(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: join27,
|
|
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, sep2, 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, sep, 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 === sep2) {
|
|
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 extname2(url3) {
|
|
121178
121178
|
const pathname = url3.pathname;
|
|
121179
121179
|
let index = pathname.length;
|
|
121180
121180
|
while (index--) {
|
|
@@ -121189,7 +121189,7 @@ function extname(url3) {
|
|
|
121189
121189
|
return "";
|
|
121190
121190
|
}
|
|
121191
121191
|
function getFileProtocolModuleFormat(url3, _context, ignoreErrors) {
|
|
121192
|
-
const value =
|
|
121192
|
+
const value = extname2(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(modules2) {
|
|
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 modules2) {
|
|
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" ? join29(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 join29(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: join29,
|
|
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(resolve15) {
|
|
138291
|
+
resolve15(value);
|
|
138292
138292
|
});
|
|
138293
138293
|
}
|
|
138294
|
-
return new (P9 || (P9 = Promise))(function(
|
|
138294
|
+
return new (P9 || (P9 = Promise))(function(resolve15, 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 ? resolve15(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 = resolve15;
|
|
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 = relative5;
|
|
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 resolve15(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 relative5(from, to5) {
|
|
143126
143126
|
if (!isFileSystemPath(from) || !isFileSystemPath(to5)) {
|
|
143127
|
-
return
|
|
143127
|
+
return resolve15(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((resolve15, 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
|
+
resolve15({
|
|
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(resolve15) {
|
|
145165
|
+
resolve15(value);
|
|
145166
145166
|
});
|
|
145167
145167
|
}
|
|
145168
|
-
return new (P9 || (P9 = Promise))(function(
|
|
145168
|
+
return new (P9 || (P9 = Promise))(function(resolve15, 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 ? resolve15(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(resolve15) {
|
|
145306
|
+
resolve15(value);
|
|
145307
145307
|
});
|
|
145308
145308
|
}
|
|
145309
|
-
return new (P9 || (P9 = Promise))(function(
|
|
145309
|
+
return new (P9 || (P9 = Promise))(function(resolve15, 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 ? resolve15(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 relative5 = __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 relative5(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 modules2 = [
|
|
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 < modules2.length; i5++) {
|
|
150658
|
+
module = modules2[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(resolve15, reject) {
|
|
150988
150988
|
readStream(stream, encoding, length, limit, function onRead2(err, buf) {
|
|
150989
150989
|
if (err)
|
|
150990
150990
|
return reject(err);
|
|
150991
|
-
|
|
150991
|
+
resolve15(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 extname3 = __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 = extname3("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 dirname21 = path18.dirname;
|
|
164113
164113
|
var basename7 = path18.basename;
|
|
164114
|
-
var
|
|
164115
|
-
var
|
|
164116
|
-
var
|
|
164114
|
+
var extname3 = path18.extname;
|
|
164115
|
+
var join30 = path18.join;
|
|
164116
|
+
var resolve15 = 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 = extname3(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 = resolve15(root2, name2);
|
|
164151
|
+
var dir = dirname21(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 resolve16(dir, file2) {
|
|
164176
164176
|
var ext = this.ext;
|
|
164177
|
-
var path19 =
|
|
164178
|
-
var
|
|
164179
|
-
if (
|
|
164177
|
+
var path19 = join30(dir, file2);
|
|
164178
|
+
var stat4 = tryStat(path19);
|
|
164179
|
+
if (stat4 && stat4.isFile()) {
|
|
164180
164180
|
return path19;
|
|
164181
164181
|
}
|
|
164182
|
-
path19 =
|
|
164183
|
-
|
|
164184
|
-
if (
|
|
164182
|
+
path19 = join30(dir, basename7(file2, ext), "index" + ext);
|
|
164183
|
+
stat4 = tryStat(path19);
|
|
164184
|
+
if (stat4 && stat4.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(stat4) {
|
|
164236
|
+
var mtime = stat4.mtime.getTime().toString(16);
|
|
164237
|
+
var size = stat4.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 resolve15 = __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", resolve15("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 extname3 = path18.extname;
|
|
167877
|
+
var join30 = path18.join;
|
|
167878
167878
|
var normalize2 = path18.normalize;
|
|
167879
|
-
var
|
|
167880
|
-
var
|
|
167879
|
+
var resolve15 = path18.resolve;
|
|
167880
|
+
var sep2 = 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 ? resolve15(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("." + sep2 + 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(sep2);
|
|
168049
|
+
path19 = normalize2(join30(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(sep2);
|
|
168057
|
+
path19 = resolve15(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, stat4) {
|
|
168081
|
+
var len = stat4.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, stat4);
|
|
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, stat4) {
|
|
168151
|
+
var pathEndsWithSep = path19[path19.length - 1] === sep2;
|
|
168152
|
+
if (err && err.code === "ENOENT" && !extname3(path19) && !pathEndsWithSep) {
|
|
168153
168153
|
return next(err);
|
|
168154
168154
|
}
|
|
168155
168155
|
if (err)
|
|
168156
168156
|
return self2.onStatError(err);
|
|
168157
|
-
if (
|
|
168157
|
+
if (stat4.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, stat4);
|
|
168162
|
+
self2.send(path19, stat4);
|
|
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, stat4) {
|
|
168171
168171
|
if (err2)
|
|
168172
168172
|
return next(err2);
|
|
168173
|
-
if (
|
|
168173
|
+
if (stat4.isDirectory())
|
|
168174
168174
|
return next();
|
|
168175
|
-
self2.emit("file", p4,
|
|
168176
|
-
self2.send(p4,
|
|
168175
|
+
self2.emit("file", p4, stat4);
|
|
168176
|
+
self2.send(p4, stat4);
|
|
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 = join30(path19, self2._index[i5]);
|
|
168190
168190
|
debug('stat "%s"', p4);
|
|
168191
|
-
fs28.stat(p4, function(err2,
|
|
168191
|
+
fs28.stat(p4, function(err2, stat4) {
|
|
168192
168192
|
if (err2)
|
|
168193
168193
|
return next(err2);
|
|
168194
|
-
if (
|
|
168194
|
+
if (stat4.isDirectory())
|
|
168195
168195
|
return next();
|
|
168196
|
-
self2.emit("file", p4,
|
|
168197
|
-
self2.send(p4,
|
|
168196
|
+
self2.emit("file", p4, stat4);
|
|
168197
|
+
self2.send(p4, stat4);
|
|
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 = extname3(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, stat4) {
|
|
168230
168230
|
var res = this.res;
|
|
168231
|
-
this.emit("headers", res, path19,
|
|
168231
|
+
this.emit("headers", res, path19, stat4);
|
|
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 = stat4.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(stat4);
|
|
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 extname3 = path18.extname;
|
|
168385
|
+
var resolve15 = 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 ? resolve15(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(extname3(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 resolve15 = __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 = resolve15(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(relative5, base) {
|
|
169799
|
+
return useNativeURL ? new URL2(relative5, base) : parseUrl(url3.resolve(base, relative5));
|
|
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((resolve15) => {
|
|
172249
|
+
this._triggerBuffer = resolve15;
|
|
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((resolve15, 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
|
+
resolve15();
|
|
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((resolve15, 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
|
+
resolve15({ 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 extname3 = __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 = extname3("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 extname3 = __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 = extname3("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((resolve15, 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 resolve15(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((resolve15, reject) => {
|
|
199306
199306
|
args.push((arg1, arg2) => {
|
|
199307
199307
|
if (withErr) {
|
|
199308
|
-
return arg1 ? reject(arg1) :
|
|
199308
|
+
return arg1 ? reject(arg1) : resolve15(arg2);
|
|
199309
199309
|
} else {
|
|
199310
|
-
return
|
|
199310
|
+
return resolve15(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((resolve15, 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 resolve15(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((resolve15, 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: resolve15,
|
|
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((resolve15, 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: resolve15,
|
|
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((resolve15) => {
|
|
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
|
+
resolve15();
|
|
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 extname3 = __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 = extname3("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, stat4) {
|
|
217395
|
+
if (er22 || !stat4.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 stat4;
|
|
217427
217427
|
try {
|
|
217428
|
-
|
|
217428
|
+
stat4 = xfs.statSync(p4);
|
|
217429
217429
|
} catch (err1) {
|
|
217430
217430
|
throw err0;
|
|
217431
217431
|
}
|
|
217432
|
-
if (!
|
|
217432
|
+
if (!stat4.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 join33(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 resolve15 = iter[kLastResolve];
|
|
218934
|
+
if (resolve15 !== 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
|
+
resolve15(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(resolve15, reject) {
|
|
218949
218949
|
lastPromise.then(function() {
|
|
218950
218950
|
if (iter[kEnded]) {
|
|
218951
|
-
|
|
218951
|
+
resolve15(createIterResult(undefined, true));
|
|
218952
218952
|
return;
|
|
218953
218953
|
}
|
|
218954
|
-
iter[kHandlePromise](
|
|
218954
|
+
iter[kHandlePromise](resolve15, 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(resolve15, reject) {
|
|
218974
218974
|
process.nextTick(function() {
|
|
218975
218975
|
if (_this[kError]) {
|
|
218976
218976
|
reject(_this[kError]);
|
|
218977
218977
|
} else {
|
|
218978
|
-
|
|
218978
|
+
resolve15(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(resolve15, reject) {
|
|
219002
219002
|
_this2[kStream].destroy(null, function(err) {
|
|
219003
219003
|
if (err) {
|
|
219004
219004
|
reject(err);
|
|
219005
219005
|
return;
|
|
219006
219006
|
}
|
|
219007
|
-
|
|
219007
|
+
resolve15(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(resolve15, 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
|
+
resolve15(createIterResult(data, false));
|
|
219036
219036
|
} else {
|
|
219037
|
-
iterator[kLastResolve] =
|
|
219037
|
+
iterator[kLastResolve] = resolve15;
|
|
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 resolve15 = iterator[kLastResolve];
|
|
219057
|
+
if (resolve15 !== null) {
|
|
219058
219058
|
iterator[kLastPromise] = null;
|
|
219059
219059
|
iterator[kLastResolve] = null;
|
|
219060
219060
|
iterator[kLastReject] = null;
|
|
219061
|
-
|
|
219061
|
+
resolve15(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, resolve15, 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
|
+
resolve15(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(resolve15, reject) {
|
|
219091
219091
|
var gen = fn9.apply(self2, args);
|
|
219092
219092
|
function _next(value) {
|
|
219093
|
-
asyncGeneratorStep(gen,
|
|
219093
|
+
asyncGeneratorStep(gen, resolve15, reject, _next, _throw, "next", value);
|
|
219094
219094
|
}
|
|
219095
219095
|
function _throw(err) {
|
|
219096
|
-
asyncGeneratorStep(gen,
|
|
219096
|
+
asyncGeneratorStep(gen, resolve15, 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_promises26 = __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_promises26.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 dirname26, join as join37 } 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 dirname11, join as join18 } 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,18 +245663,26 @@ 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
|
-
|
|
245668
|
-
|
|
245669
|
-
|
|
245670
|
-
|
|
245671
|
-
|
|
245672
|
-
|
|
245673
|
-
|
|
245674
|
-
|
|
245666
|
+
asset_uploads: exports_external.discriminatedUnion("type", [
|
|
245667
|
+
exports_external.object({
|
|
245668
|
+
type: exports_external.literal("cf"),
|
|
245669
|
+
url: exports_external.string(),
|
|
245670
|
+
jwt: exports_external.string(),
|
|
245671
|
+
buckets: exports_external.array(exports_external.array(exports_external.string()))
|
|
245672
|
+
}),
|
|
245673
|
+
exports_external.object({
|
|
245674
|
+
type: exports_external.literal("s3"),
|
|
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()
|
|
245675
245683
|
}).transform((data) => ({
|
|
245676
245684
|
deploymentId: data.deployment_id,
|
|
245677
|
-
assetUploads: data.asset_uploads == null ? null : {
|
|
245685
|
+
assetUploads: data.asset_uploads == null ? null : data.asset_uploads.type === "cf" ? data.asset_uploads : {
|
|
245678
245686
|
type: "s3",
|
|
245679
245687
|
uploads: data.asset_uploads.uploads.map((upload) => ({
|
|
245680
245688
|
path: upload.path,
|
|
@@ -245684,6 +245692,9 @@ var CreateDeploymentResponseSchema = exports_external.object({
|
|
|
245684
245692
|
}))
|
|
245685
245693
|
}
|
|
245686
245694
|
}));
|
|
245695
|
+
var AssetUploadResponseSchema = exports_external.looseObject({
|
|
245696
|
+
result: exports_external.looseObject({ jwt: exports_external.string().nullable().optional() }).nullable().optional()
|
|
245697
|
+
});
|
|
245687
245698
|
var FinalizeDeploymentResponseSchema = exports_external.object({
|
|
245688
245699
|
deployment_id: exports_external.string()
|
|
245689
245700
|
}).transform((data) => ({
|
|
@@ -247201,24 +247212,33 @@ var ResourceSourceSchema = exports_external.discriminatedUnion("type", [
|
|
|
247201
247212
|
]);
|
|
247202
247213
|
|
|
247203
247214
|
// src/core/resources/entity/schema.ts
|
|
247204
|
-
var
|
|
247205
|
-
|
|
247206
|
-
|
|
247207
|
-
|
|
247208
|
-
|
|
247209
|
-
|
|
247210
|
-
|
|
247211
|
-
|
|
247212
|
-
|
|
247213
|
-
|
|
247214
|
-
|
|
247215
|
+
var fieldConditionOperators = new Set([
|
|
247216
|
+
"$eq",
|
|
247217
|
+
"$ne",
|
|
247218
|
+
"$in",
|
|
247219
|
+
"$nin",
|
|
247220
|
+
"$gt",
|
|
247221
|
+
"$gte",
|
|
247222
|
+
"$lt",
|
|
247223
|
+
"$lte",
|
|
247224
|
+
"$exists",
|
|
247225
|
+
"$all",
|
|
247226
|
+
"$size",
|
|
247227
|
+
"$elemMatch"
|
|
247215
247228
|
]);
|
|
247216
|
-
var
|
|
247217
|
-
var
|
|
247218
|
-
|
|
247219
|
-
|
|
247220
|
-
|
|
247221
|
-
|
|
247229
|
+
var isScalar = (value) => value === null || ["string", "number", "boolean"].includes(typeof value);
|
|
247230
|
+
var isValidFieldCondition = (value) => {
|
|
247231
|
+
if (isScalar(value)) {
|
|
247232
|
+
return true;
|
|
247233
|
+
}
|
|
247234
|
+
if (typeof value === "object" && !Array.isArray(value)) {
|
|
247235
|
+
return Object.keys(value).every((k2) => fieldConditionOperators.has(k2));
|
|
247236
|
+
}
|
|
247237
|
+
return false;
|
|
247238
|
+
};
|
|
247239
|
+
var supportedOperators = [...fieldConditionOperators].sort().join(", ");
|
|
247240
|
+
var FieldConditionSchema = exports_external.union([exports_external.string(), exports_external.number(), exports_external.boolean(), exports_external.null(), exports_external.looseObject({})]).refine(isValidFieldCondition, `Field condition values must be a primitive or an operator object (${supportedOperators})`);
|
|
247241
|
+
var UserConditionSchema = exports_external.looseObject({}).refine((val) => Object.keys(val).length > 0 && Object.entries(val).every(([key, value]) => !key.startsWith("$") && isScalar(value)), "user_condition compares user attributes by exact equality: a non-empty object of attribute: scalar pairs, no operators");
|
|
247222
247242
|
var rlsConditionAllowedKeys = new Set([
|
|
247223
247243
|
"user_condition",
|
|
247224
247244
|
"created_by",
|
|
@@ -247250,18 +247270,13 @@ var RLSConditionSchema = exports_external.looseObject({
|
|
|
247250
247270
|
return exports_external.array(RefineRLSConditionSchema).optional();
|
|
247251
247271
|
}
|
|
247252
247272
|
});
|
|
247253
|
-
var
|
|
247254
|
-
var
|
|
247255
|
-
|
|
247256
|
-
|
|
247257
|
-
|
|
247258
|
-
|
|
247259
|
-
|
|
247260
|
-
}
|
|
247261
|
-
return false;
|
|
247262
|
-
};
|
|
247263
|
-
var RefineRLSConditionSchema = RLSConditionSchema.refine((val) => Object.entries(val).every(([key, value]) => rlsConditionAllowedKeys.has(key) || isValidFieldCondition(value)), "Field condition values must be a primitive or an operator object ($in, $nin, $ne, $all)");
|
|
247264
|
-
var RLSRuleSchema = exports_external.union([exports_external.boolean(), RefineRLSConditionSchema]);
|
|
247273
|
+
var RefineRLSConditionSchema = RLSConditionSchema.refine((val) => Object.entries(val).every(([key, value]) => rlsConditionAllowedKeys.has(key) || isValidFieldCondition(value)), `Field condition values must be a primitive or an operator object (${supportedOperators})`);
|
|
247274
|
+
var RLSRuleSchema = exports_external.union([
|
|
247275
|
+
exports_external.boolean(),
|
|
247276
|
+
exports_external.null(),
|
|
247277
|
+
exports_external.literal(""),
|
|
247278
|
+
RefineRLSConditionSchema
|
|
247279
|
+
]);
|
|
247265
247280
|
var EntityRLSSchema = exports_external.looseObject({
|
|
247266
247281
|
create: RLSRuleSchema.optional(),
|
|
247267
247282
|
read: RLSRuleSchema.optional(),
|
|
@@ -247277,7 +247292,7 @@ var FieldRLSSchema = exports_external.looseObject({
|
|
|
247277
247292
|
delete: RLSRuleSchema.optional()
|
|
247278
247293
|
});
|
|
247279
247294
|
var PropertyDefinitionSchema = exports_external.looseObject({
|
|
247280
|
-
type: exports_external.string(),
|
|
247295
|
+
type: exports_external.union([exports_external.string(), exports_external.array(exports_external.string())]),
|
|
247281
247296
|
title: exports_external.string().optional(),
|
|
247282
247297
|
description: exports_external.string().optional(),
|
|
247283
247298
|
minLength: exports_external.number().int().min(0).optional(),
|
|
@@ -247301,7 +247316,7 @@ var PropertyDefinitionSchema = exports_external.looseObject({
|
|
|
247301
247316
|
});
|
|
247302
247317
|
var EntitySchema = exports_external.looseObject({
|
|
247303
247318
|
type: exports_external.literal("object").default("object"),
|
|
247304
|
-
name: exports_external.string().min(1).regex(
|
|
247319
|
+
name: exports_external.string().min(1).regex(/^\w+$/, "Entity name must contain only letters, numbers, and underscores"),
|
|
247305
247320
|
title: exports_external.string().optional(),
|
|
247306
247321
|
description: exports_external.string().optional(),
|
|
247307
247322
|
properties: exports_external.record(exports_external.string(), PropertyDefinitionSchema).default({}),
|
|
@@ -247871,10 +247886,15 @@ var functionResource = {
|
|
|
247871
247886
|
// src/core/project/config.ts
|
|
247872
247887
|
class ProjectConfigReader {
|
|
247873
247888
|
pluginSourceByNamespace = new Map;
|
|
247874
|
-
async
|
|
247889
|
+
async readProjectSettings(projectRoot) {
|
|
247875
247890
|
const { root, configPath } = await this.findConfigOrThrow(projectRoot);
|
|
247876
247891
|
const project = await this.readConfigFile(configPath);
|
|
247877
247892
|
this.assertPluginProjectDoesNotLoadPlugins(project, configPath);
|
|
247893
|
+
return { ...project, root, configPath };
|
|
247894
|
+
}
|
|
247895
|
+
async readProjectConfig(projectRoot) {
|
|
247896
|
+
const project = await this.readProjectSettings(projectRoot);
|
|
247897
|
+
const { configPath } = project;
|
|
247878
247898
|
const localResources = await this.readProjectResources(configPath, project);
|
|
247879
247899
|
const pluginResources = await this.readPlugins(project.plugins, configPath);
|
|
247880
247900
|
const entities = mergeProjectAndPluginEntities(localResources.entities, pluginResources.entities, configPath);
|
|
@@ -247884,7 +247904,7 @@ class ProjectConfigReader {
|
|
|
247884
247904
|
];
|
|
247885
247905
|
this.validateFunctionNames(functions, configPath);
|
|
247886
247906
|
return {
|
|
247887
|
-
project
|
|
247907
|
+
project,
|
|
247888
247908
|
entities,
|
|
247889
247909
|
functions,
|
|
247890
247910
|
agents: localResources.agents,
|
|
@@ -248022,6 +248042,10 @@ async function readProjectConfig(projectRoot) {
|
|
|
248022
248042
|
const reader = new ProjectConfigReader;
|
|
248023
248043
|
return await reader.readProjectConfig(projectRoot);
|
|
248024
248044
|
}
|
|
248045
|
+
async function readProjectSettings(projectRoot) {
|
|
248046
|
+
const reader = new ProjectConfigReader;
|
|
248047
|
+
return await reader.readProjectSettings(projectRoot);
|
|
248048
|
+
}
|
|
248025
248049
|
// src/core/project/template.ts
|
|
248026
248050
|
var import_ejs = __toESM(require_ejs(), 1);
|
|
248027
248051
|
var import_front_matter2 = __toESM(require_front_matter(), 1);
|
|
@@ -248034,7 +248058,7 @@ import { join as join12 } from "node:path";
|
|
|
248034
248058
|
// package.json
|
|
248035
248059
|
var package_default = {
|
|
248036
248060
|
name: "base44",
|
|
248037
|
-
version: "0.1.
|
|
248061
|
+
version: "0.1.9",
|
|
248038
248062
|
description: "Base44 CLI - Unified interface for managing Base44 applications",
|
|
248039
248063
|
type: "module",
|
|
248040
248064
|
bin: {
|
|
@@ -248259,7 +248283,7 @@ async function createProjectFilesForExistingProject(options) {
|
|
|
248259
248283
|
};
|
|
248260
248284
|
}
|
|
248261
248285
|
// src/core/project/deploy.ts
|
|
248262
|
-
import { resolve as
|
|
248286
|
+
import { resolve as resolve6 } from "node:path";
|
|
248263
248287
|
|
|
248264
248288
|
// src/core/site/api.ts
|
|
248265
248289
|
async function uploadSite(archivePath) {
|
|
@@ -248283,6 +248307,13 @@ async function uploadSite(archivePath) {
|
|
|
248283
248307
|
}
|
|
248284
248308
|
return result.data;
|
|
248285
248309
|
}
|
|
248310
|
+
var MODULE_CONTENT_TYPES = {
|
|
248311
|
+
esm: "application/javascript+module",
|
|
248312
|
+
sourcemap: "application/source-map",
|
|
248313
|
+
wasm: "application/wasm",
|
|
248314
|
+
text: "text/plain",
|
|
248315
|
+
data: "application/octet-stream"
|
|
248316
|
+
};
|
|
248286
248317
|
async function createDeployment(request) {
|
|
248287
248318
|
const appClient = getAppClient();
|
|
248288
248319
|
let response;
|
|
@@ -248300,6 +248331,17 @@ async function createDeployment(request) {
|
|
|
248300
248331
|
}
|
|
248301
248332
|
return result.data;
|
|
248302
248333
|
}
|
|
248334
|
+
async function finalizeDeployment(deploymentId, completionJwt, modules) {
|
|
248335
|
+
const formData = new FormData;
|
|
248336
|
+
formData.append("payload", JSON.stringify({ completion_jwt: completionJwt }));
|
|
248337
|
+
for (const module of modules) {
|
|
248338
|
+
const content = await readFile(module.absolutePath);
|
|
248339
|
+
formData.append(module.name, new File([new Uint8Array(content)], module.name, {
|
|
248340
|
+
type: MODULE_CONTENT_TYPES[module.type]
|
|
248341
|
+
}));
|
|
248342
|
+
}
|
|
248343
|
+
return await postFinalize(deploymentId, formData);
|
|
248344
|
+
}
|
|
248303
248345
|
async function finalizeStaticDeployment(deploymentId, indexHtml) {
|
|
248304
248346
|
const formData = new FormData;
|
|
248305
248347
|
formData.append("index.html", new File([indexHtml], "index.html", { type: "text/html" }));
|
|
@@ -248335,7 +248377,9 @@ async function deploySite(siteOutputDir) {
|
|
|
248335
248377
|
if (!await pathExists(siteOutputDir)) {
|
|
248336
248378
|
throw new InvalidInputError(`Output directory does not exist: ${siteOutputDir}. Make sure to build your project first.`, {
|
|
248337
248379
|
hints: [
|
|
248338
|
-
{
|
|
248380
|
+
{
|
|
248381
|
+
message: "Run 'base44 build' first (it injects your app id; a bare 'npm run build' does not)"
|
|
248382
|
+
}
|
|
248339
248383
|
]
|
|
248340
248384
|
});
|
|
248341
248385
|
}
|
|
@@ -248343,7 +248387,9 @@ async function deploySite(siteOutputDir) {
|
|
|
248343
248387
|
if (filePaths.length === 0) {
|
|
248344
248388
|
throw new ConfigInvalidError(`No files found in output directory: ${siteOutputDir}. Make sure to build your project first.`, siteOutputDir, {
|
|
248345
248389
|
hints: [
|
|
248346
|
-
{
|
|
248390
|
+
{
|
|
248391
|
+
message: "Run 'base44 build' first (it injects your app id; a bare 'npm run build' does not)"
|
|
248392
|
+
}
|
|
248347
248393
|
]
|
|
248348
248394
|
});
|
|
248349
248395
|
}
|
|
@@ -248362,10 +248408,17 @@ async function createArchive(pathToArchive, targetArchivePath) {
|
|
|
248362
248408
|
cwd: pathToArchive
|
|
248363
248409
|
}, ["."]);
|
|
248364
248410
|
}
|
|
248411
|
+
// src/core/site/deploy-app.ts
|
|
248412
|
+
import { resolve as resolve4 } from "node:path";
|
|
248413
|
+
|
|
248414
|
+
// src/core/site/static-site.ts
|
|
248415
|
+
import { readFile as readFile4 } from "node:fs/promises";
|
|
248416
|
+
import { join as join16 } from "node:path";
|
|
248417
|
+
|
|
248365
248418
|
// src/core/site/manifest.ts
|
|
248366
248419
|
import { createHash } from "node:crypto";
|
|
248367
248420
|
import { readFile as readFile2, stat } from "node:fs/promises";
|
|
248368
|
-
import { basename as basename4, join as join15 } from "node:path";
|
|
248421
|
+
import { basename as basename4, extname, join as join15 } from "node:path";
|
|
248369
248422
|
var MAX_ASSET_SIZE_BYTES = 25 * 1024 * 1024;
|
|
248370
248423
|
var MAX_ASSET_COUNT = 1e5;
|
|
248371
248424
|
var ASSETS_IGNORE_FILE = ".assetsignore";
|
|
@@ -248374,6 +248427,39 @@ var ALWAYS_IGNORED = new Set([
|
|
|
248374
248427
|
"wrangler.json",
|
|
248375
248428
|
".dev.vars"
|
|
248376
248429
|
]);
|
|
248430
|
+
var MIME_TYPES = {
|
|
248431
|
+
".html": "text/html",
|
|
248432
|
+
".htm": "text/html",
|
|
248433
|
+
".css": "text/css",
|
|
248434
|
+
".js": "text/javascript",
|
|
248435
|
+
".mjs": "text/javascript",
|
|
248436
|
+
".json": "application/json",
|
|
248437
|
+
".map": "application/json",
|
|
248438
|
+
".txt": "text/plain",
|
|
248439
|
+
".xml": "application/xml",
|
|
248440
|
+
".svg": "image/svg+xml",
|
|
248441
|
+
".png": "image/png",
|
|
248442
|
+
".jpg": "image/jpeg",
|
|
248443
|
+
".jpeg": "image/jpeg",
|
|
248444
|
+
".gif": "image/gif",
|
|
248445
|
+
".webp": "image/webp",
|
|
248446
|
+
".avif": "image/avif",
|
|
248447
|
+
".ico": "image/x-icon",
|
|
248448
|
+
".woff": "font/woff",
|
|
248449
|
+
".woff2": "font/woff2",
|
|
248450
|
+
".ttf": "font/ttf",
|
|
248451
|
+
".otf": "font/otf",
|
|
248452
|
+
".eot": "application/vnd.ms-fontobject",
|
|
248453
|
+
".mp3": "audio/mpeg",
|
|
248454
|
+
".mp4": "video/mp4",
|
|
248455
|
+
".webm": "video/webm",
|
|
248456
|
+
".pdf": "application/pdf",
|
|
248457
|
+
".wasm": "application/wasm",
|
|
248458
|
+
".webmanifest": "application/manifest+json"
|
|
248459
|
+
};
|
|
248460
|
+
function getAssetContentType(filePath) {
|
|
248461
|
+
return MIME_TYPES[extname(filePath).toLowerCase()] ?? "application/octet-stream";
|
|
248462
|
+
}
|
|
248377
248463
|
function hashAsset(appId, content) {
|
|
248378
248464
|
return createHash("sha256").update(Buffer.from(appId, "utf8")).update(content).digest("hex").slice(0, 32);
|
|
248379
248465
|
}
|
|
@@ -248401,14 +248487,16 @@ async function buildAssetManifest(assetsDir, appId) {
|
|
|
248401
248487
|
const hash2 = hashAsset(appId, content);
|
|
248402
248488
|
manifest[`/${relativePath}`] = { hash: hash2, size };
|
|
248403
248489
|
if (!filesByHash.has(hash2)) {
|
|
248404
|
-
filesByHash.set(hash2, {
|
|
248490
|
+
filesByHash.set(hash2, {
|
|
248491
|
+
absolutePath,
|
|
248492
|
+
hash: hash2,
|
|
248493
|
+
size,
|
|
248494
|
+
contentType: getAssetContentType(absolutePath)
|
|
248495
|
+
});
|
|
248405
248496
|
}
|
|
248406
248497
|
}
|
|
248407
248498
|
return { manifest, filesByHash };
|
|
248408
248499
|
}
|
|
248409
|
-
// src/core/site/static-site.ts
|
|
248410
|
-
import { readFile as readFile4 } from "node:fs/promises";
|
|
248411
|
-
import { join as join16 } from "node:path";
|
|
248412
248500
|
|
|
248413
248501
|
// src/core/site/upload.ts
|
|
248414
248502
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
@@ -248542,6 +248630,62 @@ var DEFAULT_UPLOAD_CONCURRENCY = 3;
|
|
|
248542
248630
|
var MAX_UPLOAD_CONCURRENCY = 50;
|
|
248543
248631
|
var MAX_UPLOAD_ATTEMPTS = 3;
|
|
248544
248632
|
var RETRY_BASE_DELAY_MS = 500;
|
|
248633
|
+
var UPLOAD_RETRY = {
|
|
248634
|
+
limit: MAX_UPLOAD_ATTEMPTS - 1,
|
|
248635
|
+
delay: (attempt) => RETRY_BASE_DELAY_MS * 2 ** (attempt - 1)
|
|
248636
|
+
};
|
|
248637
|
+
async function uploadAssetBuckets(target, filesByHash, options = {}) {
|
|
248638
|
+
const { concurrency = DEFAULT_UPLOAD_CONCURRENCY, onProgress } = options;
|
|
248639
|
+
const { buckets } = target;
|
|
248640
|
+
const totalFiles = buckets.reduce((sum, bucket) => sum + bucket.length, 0);
|
|
248641
|
+
let uploadedFiles = 0;
|
|
248642
|
+
let completionJwt = null;
|
|
248643
|
+
await pMap(buckets, async (bucket) => {
|
|
248644
|
+
const jwt3 = await uploadAssetBucket(target, bucket, filesByHash);
|
|
248645
|
+
if (jwt3) {
|
|
248646
|
+
completionJwt = jwt3;
|
|
248647
|
+
}
|
|
248648
|
+
uploadedFiles += bucket.length;
|
|
248649
|
+
onProgress?.({ uploadedFiles, totalFiles });
|
|
248650
|
+
}, { concurrency });
|
|
248651
|
+
if (!completionJwt) {
|
|
248652
|
+
throw new ApiError("Asset upload finished but the server did not return a completion token.");
|
|
248653
|
+
}
|
|
248654
|
+
return completionJwt;
|
|
248655
|
+
}
|
|
248656
|
+
async function uploadAssetBucket(target, bucket, filesByHash) {
|
|
248657
|
+
const formData = await buildBucketForm(bucket, filesByHash);
|
|
248658
|
+
let response;
|
|
248659
|
+
try {
|
|
248660
|
+
response = await distribution_default.post(target.url, {
|
|
248661
|
+
searchParams: { base64: "true" },
|
|
248662
|
+
headers: { Authorization: `Bearer ${target.jwt}` },
|
|
248663
|
+
body: formData,
|
|
248664
|
+
timeout: 120000,
|
|
248665
|
+
retry: { ...UPLOAD_RETRY, methods: ["post"] }
|
|
248666
|
+
});
|
|
248667
|
+
} catch (error48) {
|
|
248668
|
+
if (error48 instanceof HTTPError && (error48.response.status === 401 || error48.response.status === 403)) {
|
|
248669
|
+
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 });
|
|
248670
|
+
}
|
|
248671
|
+
throw await ApiError.fromHttpError(error48, "uploading assets to Cloudflare");
|
|
248672
|
+
}
|
|
248673
|
+
const parsed = AssetUploadResponseSchema.safeParse(await response.json());
|
|
248674
|
+
const jwt3 = parsed.success ? parsed.data.result?.jwt : null;
|
|
248675
|
+
return jwt3 || null;
|
|
248676
|
+
}
|
|
248677
|
+
async function buildBucketForm(bucket, filesByHash) {
|
|
248678
|
+
const formData = new FormData;
|
|
248679
|
+
for (const hash2 of bucket) {
|
|
248680
|
+
const file2 = filesByHash.get(hash2);
|
|
248681
|
+
if (!file2) {
|
|
248682
|
+
throw new InternalError(`Server requested upload of unknown asset hash: ${hash2}`);
|
|
248683
|
+
}
|
|
248684
|
+
const content = await readFile3(file2.absolutePath);
|
|
248685
|
+
formData.append(hash2, new File([content.toString("base64")], hash2, { type: file2.contentType }));
|
|
248686
|
+
}
|
|
248687
|
+
return formData;
|
|
248688
|
+
}
|
|
248545
248689
|
async function uploadPresignedAssets(uploads, assets, options = {}) {
|
|
248546
248690
|
const { concurrency = DEFAULT_UPLOAD_CONCURRENCY, onProgress } = options;
|
|
248547
248691
|
let uploadedFiles = 0;
|
|
@@ -248563,10 +248707,7 @@ async function uploadPresignedAsset(upload, assets) {
|
|
|
248563
248707
|
body: new Uint8Array(content),
|
|
248564
248708
|
headers: { "Content-Type": upload.contentType },
|
|
248565
248709
|
timeout: 120000,
|
|
248566
|
-
retry:
|
|
248567
|
-
limit: MAX_UPLOAD_ATTEMPTS - 1,
|
|
248568
|
-
delay: (attempt) => RETRY_BASE_DELAY_MS * 2 ** (attempt - 1)
|
|
248569
|
-
}
|
|
248710
|
+
retry: UPLOAD_RETRY
|
|
248570
248711
|
});
|
|
248571
248712
|
} catch (error48) {
|
|
248572
248713
|
throw await ApiError.fromHttpError(error48, "uploading static assets");
|
|
@@ -248574,6 +248715,11 @@ async function uploadPresignedAsset(upload, assets) {
|
|
|
248574
248715
|
}
|
|
248575
248716
|
|
|
248576
248717
|
// src/core/site/static-site.ts
|
|
248718
|
+
var STATIC_DEPLOYMENTS_ENV = "BASE44_STATIC_DEPLOYMENTS";
|
|
248719
|
+
function staticDeploymentsEnabled(env2 = process.env) {
|
|
248720
|
+
const value = env2[STATIC_DEPLOYMENTS_ENV];
|
|
248721
|
+
return value === "1" || value === "true";
|
|
248722
|
+
}
|
|
248577
248723
|
async function deployStaticSite(options) {
|
|
248578
248724
|
const { outputDir, gitHash, concurrency, progress } = options;
|
|
248579
248725
|
const assets = await buildAssetManifest(outputDir, getAppContext().id);
|
|
@@ -248584,6 +248730,9 @@ async function deployStaticSite(options) {
|
|
|
248584
248730
|
git_hash: gitHash,
|
|
248585
248731
|
asset_manifest: assets.manifest
|
|
248586
248732
|
});
|
|
248733
|
+
if (created.assetUploads && created.assetUploads.type !== "s3") {
|
|
248734
|
+
throw new ApiError(`The server answered a static-site deploy with the "${created.assetUploads.type}" upload target.`);
|
|
248735
|
+
}
|
|
248587
248736
|
progress?.onAssets?.({
|
|
248588
248737
|
totalAssets: Object.keys(assets.manifest).length,
|
|
248589
248738
|
newAssets: created.assetUploads?.uploads.length ?? 0
|
|
@@ -248596,342 +248745,259 @@ async function deployStaticSite(options) {
|
|
|
248596
248745
|
}
|
|
248597
248746
|
const indexHtml = await readFile4(join16(outputDir, "index.html"));
|
|
248598
248747
|
const finalized = await finalizeStaticDeployment(created.deploymentId, new Uint8Array(indexHtml));
|
|
248599
|
-
return { deploymentId: finalized.deploymentId };
|
|
248600
|
-
}
|
|
248601
|
-
|
|
248602
|
-
|
|
248603
|
-
|
|
248604
|
-
|
|
248605
|
-
|
|
248606
|
-
|
|
248607
|
-
|
|
248608
|
-
|
|
248609
|
-
|
|
248610
|
-
|
|
248611
|
-
|
|
248612
|
-
|
|
248613
|
-
|
|
248614
|
-
|
|
248615
|
-
|
|
248616
|
-
|
|
248617
|
-
|
|
248618
|
-
|
|
248619
|
-
|
|
248620
|
-
|
|
248621
|
-
|
|
248622
|
-
|
|
248623
|
-
|
|
248624
|
-
|
|
248625
|
-
|
|
248626
|
-
|
|
248627
|
-
|
|
248628
|
-
|
|
248629
|
-
|
|
248630
|
-
|
|
248631
|
-
|
|
248632
|
-
|
|
248633
|
-
|
|
248634
|
-
|
|
248748
|
+
return { deploymentId: finalized.deploymentId, gitHash };
|
|
248749
|
+
}
|
|
248750
|
+
|
|
248751
|
+
// src/core/site/wrangler-config.ts
|
|
248752
|
+
import { dirname as dirname10, join as join17, resolve as resolve3 } from "node:path";
|
|
248753
|
+
var WRANGLER_REDIRECT_PATH = join17(".wrangler", "deploy", "config.json");
|
|
248754
|
+
var RedirectConfigSchema = exports_external.looseObject({
|
|
248755
|
+
configPath: exports_external.string().min(1)
|
|
248756
|
+
});
|
|
248757
|
+
var WranglerConfigSchema = exports_external.looseObject({
|
|
248758
|
+
main: exports_external.string().min(1, "wrangler config is missing a 'main' entry module"),
|
|
248759
|
+
no_bundle: exports_external.boolean().optional(),
|
|
248760
|
+
rules: exports_external.array(exports_external.looseObject({ type: exports_external.string(), globs: exports_external.array(exports_external.string()) })).optional(),
|
|
248761
|
+
assets: exports_external.looseObject({
|
|
248762
|
+
directory: exports_external.string().optional(),
|
|
248763
|
+
html_handling: exports_external.string().optional(),
|
|
248764
|
+
not_found_handling: exports_external.string().optional(),
|
|
248765
|
+
run_worker_first: exports_external.union([exports_external.boolean(), exports_external.array(exports_external.string())]).optional(),
|
|
248766
|
+
headers: exports_external.string().optional(),
|
|
248767
|
+
redirects: exports_external.string().optional()
|
|
248768
|
+
}).optional(),
|
|
248769
|
+
compatibility_date: exports_external.string().optional(),
|
|
248770
|
+
compatibility_flags: exports_external.array(exports_external.string()).optional(),
|
|
248771
|
+
vars: exports_external.record(exports_external.string(), exports_external.unknown()).optional(),
|
|
248772
|
+
upload_source_maps: exports_external.boolean().optional()
|
|
248773
|
+
});
|
|
248774
|
+
async function detectFullStackArtifact(projectRoot) {
|
|
248775
|
+
const redirectPath = join17(projectRoot, WRANGLER_REDIRECT_PATH);
|
|
248776
|
+
return await pathExists(redirectPath) ? redirectPath : null;
|
|
248777
|
+
}
|
|
248778
|
+
async function resolveWranglerConfig(projectRoot) {
|
|
248779
|
+
const redirectPath = await detectFullStackArtifact(projectRoot);
|
|
248780
|
+
if (!redirectPath) {
|
|
248781
|
+
throw new InvalidInputError("No full-stack build artifact found. Expected a .wrangler/deploy/config.json redirect file.", {
|
|
248782
|
+
hints: [{ message: "Run your framework's build command first" }]
|
|
248783
|
+
});
|
|
248635
248784
|
}
|
|
248636
|
-
await
|
|
248637
|
-
await
|
|
248638
|
-
|
|
248639
|
-
|
|
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 };
|
|
248785
|
+
const configPath = await resolveRedirectedConfigPath(redirectPath);
|
|
248786
|
+
const parsed = await readJsonFile(configPath);
|
|
248787
|
+
const result = WranglerConfigSchema.safeParse(parsed);
|
|
248788
|
+
if (!result.success) {
|
|
248789
|
+
throw new ConfigInvalidError(`Invalid wrangler config: ${exports_external.prettifyError(result.error)}`, configPath);
|
|
248650
248790
|
}
|
|
248651
|
-
|
|
248652
|
-
|
|
248653
|
-
|
|
248654
|
-
var retriedRequests = new WeakSet;
|
|
248655
|
-
async function captureRequestBody(request, options) {
|
|
248656
|
-
if (request.body == null) {
|
|
248657
|
-
return;
|
|
248791
|
+
const config9 = result.data;
|
|
248792
|
+
if (config9.no_bundle !== true) {
|
|
248793
|
+
throw new InvalidInputError("This framework's output requires bundling; not yet supported. Base44 full-stack deploys only support pre-bundled Workers output (no_bundle: true).");
|
|
248658
248794
|
}
|
|
248659
|
-
|
|
248660
|
-
|
|
248661
|
-
|
|
248662
|
-
|
|
248663
|
-
|
|
248795
|
+
const configDir = dirname10(configPath);
|
|
248796
|
+
const assetsDirectory = config9.assets?.directory ? resolve3(configDir, config9.assets.directory) : null;
|
|
248797
|
+
return {
|
|
248798
|
+
configPath,
|
|
248799
|
+
configDir,
|
|
248800
|
+
main: config9.main,
|
|
248801
|
+
assetsDirectory,
|
|
248802
|
+
assetsConfig: config9.assets ? toResolvedAssetsConfig(config9.assets) : null,
|
|
248803
|
+
compatibilityDate: config9.compatibility_date ?? null,
|
|
248804
|
+
compatibilityFlags: config9.compatibility_flags ?? [],
|
|
248805
|
+
vars: config9.vars ?? {},
|
|
248806
|
+
rules: (config9.rules ?? []).map((rule) => ({
|
|
248807
|
+
type: rule.type,
|
|
248808
|
+
globs: rule.globs
|
|
248809
|
+
})),
|
|
248810
|
+
uploadSourceMaps: config9.upload_source_maps ?? false
|
|
248811
|
+
};
|
|
248664
248812
|
}
|
|
248665
|
-
async function
|
|
248666
|
-
|
|
248667
|
-
|
|
248668
|
-
|
|
248669
|
-
|
|
248670
|
-
return;
|
|
248671
|
-
}
|
|
248672
|
-
if (retriedRequests.has(request)) {
|
|
248673
|
-
return;
|
|
248674
|
-
}
|
|
248675
|
-
const newAccessToken = await refreshAndSaveTokens();
|
|
248676
|
-
if (!newAccessToken) {
|
|
248677
|
-
return;
|
|
248813
|
+
async function resolveRedirectedConfigPath(redirectPath) {
|
|
248814
|
+
const parsed = await readJsonFile(redirectPath);
|
|
248815
|
+
const result = RedirectConfigSchema.safeParse(parsed);
|
|
248816
|
+
if (!result.success) {
|
|
248817
|
+
throw new ConfigInvalidError(`Invalid deploy redirect file: ${exports_external.prettifyError(result.error)}`, redirectPath);
|
|
248678
248818
|
}
|
|
248679
|
-
|
|
248680
|
-
|
|
248681
|
-
|
|
248682
|
-
|
|
248683
|
-
|
|
248684
|
-
Authorization: `Bearer ${newAccessToken}`
|
|
248685
|
-
}
|
|
248686
|
-
});
|
|
248687
|
-
}
|
|
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]
|
|
248819
|
+
const configPath = resolve3(dirname10(redirectPath), result.data.configPath);
|
|
248820
|
+
if (!await pathExists(configPath)) {
|
|
248821
|
+
throw new ConfigInvalidError(`Wrangler config referenced by ${redirectPath} does not exist: ${configPath}`, redirectPath, {
|
|
248822
|
+
hints: [{ message: "Rebuild the project to regenerate the artifact" }]
|
|
248823
|
+
});
|
|
248719
248824
|
}
|
|
248720
|
-
|
|
248721
|
-
function getAppClient() {
|
|
248722
|
-
const { id } = getAppContext();
|
|
248723
|
-
return base44Client.extend({
|
|
248724
|
-
prefixUrl: new URL(`/api/apps/${id}/`, getBase44ApiUrl()).href
|
|
248725
|
-
});
|
|
248825
|
+
return configPath;
|
|
248726
248826
|
}
|
|
248727
|
-
function
|
|
248728
|
-
return
|
|
248729
|
-
|
|
248730
|
-
|
|
248827
|
+
function toResolvedAssetsConfig(assets) {
|
|
248828
|
+
return {
|
|
248829
|
+
htmlHandling: assets.html_handling,
|
|
248830
|
+
notFoundHandling: assets.not_found_handling,
|
|
248831
|
+
runWorkerFirst: assets.run_worker_first,
|
|
248832
|
+
headers: assets.headers,
|
|
248833
|
+
redirects: assets.redirects
|
|
248834
|
+
};
|
|
248731
248835
|
}
|
|
248732
|
-
|
|
248733
|
-
|
|
248734
|
-
|
|
248735
|
-
|
|
248736
|
-
|
|
248737
|
-
"User-Agent": "Base44 CLI"
|
|
248738
|
-
},
|
|
248739
|
-
hooks: {
|
|
248740
|
-
beforeRequest: [
|
|
248741
|
-
(request) => {
|
|
248742
|
-
request.headers.set("X-Request-ID", randomUUID3());
|
|
248743
|
-
}
|
|
248744
|
-
]
|
|
248745
|
-
}
|
|
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 });
|
|
248758
|
-
}
|
|
248759
|
-
const result = DeviceCodeResponseSchema.safeParse(await response.json());
|
|
248760
|
-
if (!result.success) {
|
|
248761
|
-
throw new SchemaValidationError("Invalid device code response from server", result.error);
|
|
248836
|
+
|
|
248837
|
+
// src/core/site/deploy-app.ts
|
|
248838
|
+
async function planAppDeploy(target) {
|
|
248839
|
+
if (await detectFullStackArtifact(target.root)) {
|
|
248840
|
+
return { kind: "full-stack" };
|
|
248762
248841
|
}
|
|
248763
|
-
|
|
248842
|
+
const outputDirectory = target.site?.outputDirectory;
|
|
248843
|
+
if (!outputDirectory) {
|
|
248844
|
+
return { kind: "none" };
|
|
248845
|
+
}
|
|
248846
|
+
const outputDir = resolve4(target.root, outputDirectory);
|
|
248847
|
+
return staticDeploymentsEnabled() ? { kind: "static-deployment", outputDir } : { kind: "static", outputDir };
|
|
248848
|
+
}
|
|
248849
|
+
// src/core/site/modules.ts
|
|
248850
|
+
import { stat as stat2 } from "node:fs/promises";
|
|
248851
|
+
import { relative as relative3, resolve as resolve5, sep } from "node:path";
|
|
248852
|
+
var MAX_TOTAL_MODULE_BYTES = 40 * 1024 * 1024;
|
|
248853
|
+
var MODULE_IGNORE = ["wrangler.json", ".dev.vars"];
|
|
248854
|
+
var RULE_TYPE_TO_MODULE_TYPE = {
|
|
248855
|
+
ESModule: "esm",
|
|
248856
|
+
CompiledWasm: "wasm",
|
|
248857
|
+
Text: "text",
|
|
248858
|
+
Data: "data"
|
|
248859
|
+
};
|
|
248860
|
+
function toPosix(path11) {
|
|
248861
|
+
return path11.split(sep).join("/");
|
|
248764
248862
|
}
|
|
248765
|
-
async function
|
|
248766
|
-
const
|
|
248767
|
-
|
|
248768
|
-
|
|
248769
|
-
|
|
248770
|
-
const response = await oauthClient.post("oauth/token", {
|
|
248771
|
-
body: searchParams.toString(),
|
|
248772
|
-
headers: {
|
|
248773
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
248774
|
-
},
|
|
248775
|
-
throwHttpErrors: false
|
|
248776
|
-
});
|
|
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
|
|
248863
|
+
async function collectModules(config9) {
|
|
248864
|
+
const entryPath = resolve5(config9.configDir, config9.main);
|
|
248865
|
+
if (!await pathExists(entryPath)) {
|
|
248866
|
+
throw new InvalidInputError(`Worker entry module does not exist: ${entryPath} (from "main" in ${config9.configPath})`, {
|
|
248867
|
+
hints: [{ message: "Rebuild the project to regenerate the artifact" }]
|
|
248789
248868
|
});
|
|
248790
248869
|
}
|
|
248791
|
-
const
|
|
248792
|
-
|
|
248793
|
-
|
|
248794
|
-
|
|
248795
|
-
|
|
248796
|
-
|
|
248797
|
-
|
|
248798
|
-
|
|
248799
|
-
|
|
248800
|
-
|
|
248801
|
-
|
|
248802
|
-
|
|
248803
|
-
|
|
248804
|
-
|
|
248805
|
-
|
|
248806
|
-
|
|
248807
|
-
|
|
248808
|
-
|
|
248809
|
-
|
|
248810
|
-
|
|
248811
|
-
|
|
248812
|
-
|
|
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
|
|
248870
|
+
const modulesByName = new Map;
|
|
248871
|
+
const entryName = toPosix(relative3(config9.configDir, entryPath));
|
|
248872
|
+
modulesByName.set(entryName, {
|
|
248873
|
+
name: entryName,
|
|
248874
|
+
absolutePath: entryPath,
|
|
248875
|
+
size: 0,
|
|
248876
|
+
type: "esm"
|
|
248877
|
+
});
|
|
248878
|
+
const ignore = [...MODULE_IGNORE];
|
|
248879
|
+
if (config9.assetsDirectory?.startsWith(config9.configDir + sep)) {
|
|
248880
|
+
ignore.push(`${toPosix(relative3(config9.configDir, config9.assetsDirectory))}/**`);
|
|
248881
|
+
}
|
|
248882
|
+
for (const rule of config9.rules) {
|
|
248883
|
+
const type = RULE_TYPE_TO_MODULE_TYPE[rule.type];
|
|
248884
|
+
if (!type) {
|
|
248885
|
+
throw new InvalidInputError(`Unsupported module rule type "${rule.type}" in ${config9.configPath}. Supported: ${Object.keys(RULE_TYPE_TO_MODULE_TYPE).join(", ")}.`);
|
|
248886
|
+
}
|
|
248887
|
+
const matches = await globby(rule.globs, {
|
|
248888
|
+
cwd: config9.configDir,
|
|
248889
|
+
onlyFiles: true,
|
|
248890
|
+
dot: true,
|
|
248891
|
+
ignore
|
|
248820
248892
|
});
|
|
248893
|
+
for (const match of matches.sort()) {
|
|
248894
|
+
if (!modulesByName.has(match)) {
|
|
248895
|
+
modulesByName.set(match, {
|
|
248896
|
+
name: match,
|
|
248897
|
+
absolutePath: resolve5(config9.configDir, match),
|
|
248898
|
+
size: 0,
|
|
248899
|
+
type
|
|
248900
|
+
});
|
|
248901
|
+
}
|
|
248902
|
+
}
|
|
248821
248903
|
}
|
|
248822
|
-
|
|
248823
|
-
|
|
248824
|
-
|
|
248825
|
-
|
|
248826
|
-
|
|
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
|
|
248904
|
+
if (config9.uploadSourceMaps) {
|
|
248905
|
+
const maps = await globby("**/*.map", {
|
|
248906
|
+
cwd: config9.configDir,
|
|
248907
|
+
onlyFiles: true,
|
|
248908
|
+
dot: true,
|
|
248909
|
+
ignore
|
|
248835
248910
|
});
|
|
248911
|
+
for (const map2 of maps.sort()) {
|
|
248912
|
+
addSourcemap(modulesByName, config9.configDir, map2);
|
|
248913
|
+
}
|
|
248914
|
+
} else {
|
|
248915
|
+
for (const name2 of [...modulesByName.keys()]) {
|
|
248916
|
+
const mapName = `${name2}.map`;
|
|
248917
|
+
if (await pathExists(resolve5(config9.configDir, mapName))) {
|
|
248918
|
+
addSourcemap(modulesByName, config9.configDir, mapName);
|
|
248919
|
+
}
|
|
248920
|
+
}
|
|
248836
248921
|
}
|
|
248837
|
-
const
|
|
248838
|
-
|
|
248839
|
-
|
|
248922
|
+
const modules = [...modulesByName.values()];
|
|
248923
|
+
let totalBytes = 0;
|
|
248924
|
+
for (const module of modules) {
|
|
248925
|
+
module.size = (await stat2(module.absolutePath)).size;
|
|
248926
|
+
totalBytes += module.size;
|
|
248840
248927
|
}
|
|
248841
|
-
|
|
248928
|
+
if (totalBytes > MAX_TOTAL_MODULE_BYTES) {
|
|
248929
|
+
throw new InvalidInputError(`Worker modules total ${totalBytes} bytes, which exceeds the 40 MB limit for Base44 full-stack deploys.`);
|
|
248930
|
+
}
|
|
248931
|
+
return modules;
|
|
248842
248932
|
}
|
|
248843
|
-
|
|
248844
|
-
|
|
248845
|
-
|
|
248846
|
-
|
|
248847
|
-
|
|
248848
|
-
|
|
248849
|
-
|
|
248933
|
+
function addSourcemap(modulesByName, configDir, name2) {
|
|
248934
|
+
if (modulesByName.has(name2))
|
|
248935
|
+
return;
|
|
248936
|
+
modulesByName.set(name2, {
|
|
248937
|
+
name: name2,
|
|
248938
|
+
absolutePath: resolve5(configDir, name2),
|
|
248939
|
+
size: 0,
|
|
248940
|
+
type: "sourcemap"
|
|
248850
248941
|
});
|
|
248851
|
-
log.info(`Verification code: ${theme.styles.bold(deviceCodeResponse.userCode)}` + `
|
|
248852
|
-
Please confirm this code at: ${deviceCodeResponse.verificationUri}`);
|
|
248853
|
-
return deviceCodeResponse;
|
|
248854
248942
|
}
|
|
248855
|
-
|
|
248856
|
-
|
|
248857
|
-
|
|
248858
|
-
|
|
248859
|
-
|
|
248860
|
-
|
|
248861
|
-
|
|
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;
|
|
248943
|
+
|
|
248944
|
+
// src/core/site/full-stack.ts
|
|
248945
|
+
async function deployFullStack(options) {
|
|
248946
|
+
const { projectRoot, gitHash, concurrency, progress } = options;
|
|
248947
|
+
const config9 = await resolveWranglerConfig(projectRoot);
|
|
248948
|
+
if (!config9.compatibilityFlags.includes("nodejs_compat")) {
|
|
248949
|
+
progress?.onWarning?.("The wrangler config has no 'nodejs_compat' compatibility flag; Node.js built-ins will be unavailable at runtime. Enable it in your framework's Cloudflare adapter settings if your server code needs Node APIs.");
|
|
248879
248950
|
}
|
|
248880
|
-
if (
|
|
248881
|
-
|
|
248951
|
+
if (config9.vars && Object.keys(config9.vars).length > 0) {
|
|
248952
|
+
progress?.onWarning?.("wrangler 'vars' are not supported and were ignored — a worker's environment comes from the app's secrets (base44 secrets set).");
|
|
248882
248953
|
}
|
|
248883
|
-
|
|
248884
|
-
}
|
|
248885
|
-
|
|
248886
|
-
|
|
248887
|
-
|
|
248888
|
-
|
|
248889
|
-
|
|
248890
|
-
|
|
248891
|
-
|
|
248892
|
-
|
|
248954
|
+
const modules = await collectModules(config9);
|
|
248955
|
+
let assets = { manifest: {}, filesByHash: new Map };
|
|
248956
|
+
if (config9.assetsDirectory && await pathExists(config9.assetsDirectory)) {
|
|
248957
|
+
assets = await buildAssetManifest(config9.assetsDirectory, getAppContext().id);
|
|
248958
|
+
}
|
|
248959
|
+
const created = await createDeployment({
|
|
248960
|
+
git_hash: gitHash,
|
|
248961
|
+
config: {
|
|
248962
|
+
main: config9.main,
|
|
248963
|
+
compatibility_date: config9.compatibilityDate,
|
|
248964
|
+
compatibility_flags: config9.compatibilityFlags,
|
|
248965
|
+
assets: buildAssetsConfig(config9.assetsConfig, progress)
|
|
248966
|
+
},
|
|
248967
|
+
asset_manifest: assets.manifest
|
|
248893
248968
|
});
|
|
248969
|
+
if (created.assetUploads && created.assetUploads.type !== "cf") {
|
|
248970
|
+
throw new ApiError(`The server answered a full-stack deploy with the "${created.assetUploads.type}" upload target.`);
|
|
248971
|
+
}
|
|
248972
|
+
const totalAssets = Object.keys(assets.manifest).length;
|
|
248973
|
+
const newAssets = created.assetUploads ? new Set(created.assetUploads.buckets.flat()).size : 0;
|
|
248974
|
+
progress?.onAssets?.({ totalAssets, newAssets });
|
|
248975
|
+
const completionJwt = created.assetUploads ? await uploadAssetBuckets(created.assetUploads, assets.filesByHash, {
|
|
248976
|
+
concurrency,
|
|
248977
|
+
onProgress: progress?.onAssetUpload
|
|
248978
|
+
}) : null;
|
|
248979
|
+
progress?.onWorker?.({ moduleCount: modules.length });
|
|
248980
|
+
const finalized = await finalizeDeployment(created.deploymentId, completionJwt, modules);
|
|
248981
|
+
return { deploymentId: finalized.deploymentId, gitHash };
|
|
248894
248982
|
}
|
|
248895
|
-
|
|
248896
|
-
|
|
248897
|
-
|
|
248898
|
-
|
|
248899
|
-
|
|
248900
|
-
const token = await waitForAuthentication(deviceCodeResponse.deviceCode, deviceCodeResponse.expiresIn, deviceCodeResponse.interval, runTask);
|
|
248901
|
-
const userInfo = await getUserInfo(token.accessToken);
|
|
248902
|
-
await saveAuthData(token, userInfo);
|
|
248903
|
-
return {
|
|
248904
|
-
outroMessage: `Successfully logged in as ${theme.styles.bold(userInfo.email)}`
|
|
248905
|
-
};
|
|
248906
|
-
}
|
|
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;
|
|
248983
|
+
function buildAssetsConfig(assetsConfig, progress) {
|
|
248984
|
+
if (!assetsConfig)
|
|
248985
|
+
return null;
|
|
248986
|
+
if (assetsConfig.headers || assetsConfig.redirects) {
|
|
248987
|
+
progress?.onWarning?.("_headers/_redirects files are not supported yet and were ignored for this deploy.");
|
|
248915
248988
|
}
|
|
248916
|
-
|
|
248917
|
-
|
|
248918
|
-
|
|
248919
|
-
|
|
248920
|
-
|
|
248989
|
+
let runWorkerFirst;
|
|
248990
|
+
if (Array.isArray(assetsConfig.runWorkerFirst)) {
|
|
248991
|
+
progress?.onWarning?.("'run_worker_first' route patterns are not supported yet and were ignored for this deploy.");
|
|
248992
|
+
} else {
|
|
248993
|
+
runWorkerFirst = assetsConfig.runWorkerFirst;
|
|
248921
248994
|
}
|
|
248922
|
-
|
|
248923
|
-
|
|
248924
|
-
|
|
248925
|
-
|
|
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 });
|
|
248995
|
+
return {
|
|
248996
|
+
html_handling: assetsConfig.htmlHandling,
|
|
248997
|
+
not_found_handling: assetsConfig.notFoundHandling,
|
|
248998
|
+
run_worker_first: runWorkerFirst
|
|
248999
|
+
};
|
|
248933
249000
|
}
|
|
248934
|
-
|
|
248935
249001
|
// ../../node_modules/is-plain-obj/index.js
|
|
248936
249002
|
function isPlainObject2(value) {
|
|
248937
249003
|
if (typeof value !== "object" || value === null) {
|
|
@@ -249029,13 +249095,13 @@ var getJoinLength = (uint8Arrays) => {
|
|
|
249029
249095
|
var isTemplateString = (templates) => Array.isArray(templates) && Array.isArray(templates.raw);
|
|
249030
249096
|
var parseTemplates = (templates, expressions) => {
|
|
249031
249097
|
let tokens = [];
|
|
249032
|
-
for (const [index,
|
|
249098
|
+
for (const [index, template] of templates.entries()) {
|
|
249033
249099
|
tokens = parseTemplate({
|
|
249034
249100
|
templates,
|
|
249035
249101
|
expressions,
|
|
249036
249102
|
tokens,
|
|
249037
249103
|
index,
|
|
249038
|
-
template
|
|
249104
|
+
template
|
|
249039
249105
|
});
|
|
249040
249106
|
}
|
|
249041
249107
|
if (tokens.length === 0) {
|
|
@@ -249044,11 +249110,11 @@ var parseTemplates = (templates, expressions) => {
|
|
|
249044
249110
|
const [file2, ...commandArguments] = tokens;
|
|
249045
249111
|
return [file2, commandArguments, {}];
|
|
249046
249112
|
};
|
|
249047
|
-
var parseTemplate = ({ templates, expressions, tokens, index, template
|
|
249048
|
-
if (
|
|
249113
|
+
var parseTemplate = ({ templates, expressions, tokens, index, template }) => {
|
|
249114
|
+
if (template === undefined) {
|
|
249049
249115
|
throw new TypeError(`Invalid backslash sequence: ${templates.raw[index]}`);
|
|
249050
249116
|
}
|
|
249051
|
-
const { nextTokens, leadingWhitespaces, trailingWhitespaces } = splitByWhitespaces(
|
|
249117
|
+
const { nextTokens, leadingWhitespaces, trailingWhitespaces } = splitByWhitespaces(template, templates.raw[index]);
|
|
249052
249118
|
const newTokens = concatTokens(tokens, nextTokens, leadingWhitespaces);
|
|
249053
249119
|
if (index === expressions.length) {
|
|
249054
249120
|
return newTokens;
|
|
@@ -249057,18 +249123,18 @@ var parseTemplate = ({ templates, expressions, tokens, index, template: template
|
|
|
249057
249123
|
const expressionTokens = Array.isArray(expression) ? expression.map((expression2) => parseExpression(expression2)) : [parseExpression(expression)];
|
|
249058
249124
|
return concatTokens(newTokens, expressionTokens, trailingWhitespaces);
|
|
249059
249125
|
};
|
|
249060
|
-
var splitByWhitespaces = (
|
|
249126
|
+
var splitByWhitespaces = (template, rawTemplate) => {
|
|
249061
249127
|
if (rawTemplate.length === 0) {
|
|
249062
249128
|
return { nextTokens: [], leadingWhitespaces: false, trailingWhitespaces: false };
|
|
249063
249129
|
}
|
|
249064
249130
|
const nextTokens = [];
|
|
249065
249131
|
let templateStart = 0;
|
|
249066
249132
|
const leadingWhitespaces = DELIMITERS.has(rawTemplate[0]);
|
|
249067
|
-
for (let templateIndex = 0, rawIndex = 0;templateIndex <
|
|
249133
|
+
for (let templateIndex = 0, rawIndex = 0;templateIndex < template.length; templateIndex += 1, rawIndex += 1) {
|
|
249068
249134
|
const rawCharacter = rawTemplate[rawIndex];
|
|
249069
249135
|
if (DELIMITERS.has(rawCharacter)) {
|
|
249070
249136
|
if (templateStart !== templateIndex) {
|
|
249071
|
-
nextTokens.push(
|
|
249137
|
+
nextTokens.push(template.slice(templateStart, templateIndex));
|
|
249072
249138
|
}
|
|
249073
249139
|
templateStart = templateIndex + 1;
|
|
249074
249140
|
} else if (rawCharacter === "\\") {
|
|
@@ -249084,9 +249150,9 @@ var splitByWhitespaces = (template2, rawTemplate) => {
|
|
|
249084
249150
|
}
|
|
249085
249151
|
}
|
|
249086
249152
|
}
|
|
249087
|
-
const trailingWhitespaces = templateStart ===
|
|
249153
|
+
const trailingWhitespaces = templateStart === template.length;
|
|
249088
249154
|
if (!trailingWhitespaces) {
|
|
249089
|
-
nextTokens.push(
|
|
249155
|
+
nextTokens.push(template.slice(templateStart));
|
|
249090
249156
|
}
|
|
249091
249157
|
return { nextTokens, leadingWhitespaces, trailingWhitespaces };
|
|
249092
249158
|
};
|
|
@@ -250480,8 +250546,8 @@ var disconnect = (anyProcess) => {
|
|
|
250480
250546
|
// ../../node_modules/execa/lib/utils/deferred.js
|
|
250481
250547
|
var createDeferred = () => {
|
|
250482
250548
|
const methods = {};
|
|
250483
|
-
const promise2 = new Promise((
|
|
250484
|
-
Object.assign(methods, { resolve:
|
|
250549
|
+
const promise2 = new Promise((resolve6, reject) => {
|
|
250550
|
+
Object.assign(methods, { resolve: resolve6, reject });
|
|
250485
250551
|
});
|
|
250486
250552
|
return Object.assign(promise2, methods);
|
|
250487
250553
|
};
|
|
@@ -254845,11 +254911,11 @@ var addConcurrentStream = (concurrentStreams, stream, waitName) => {
|
|
|
254845
254911
|
const promises = weakMap.get(stream);
|
|
254846
254912
|
const promise2 = createDeferred();
|
|
254847
254913
|
promises.push(promise2);
|
|
254848
|
-
const
|
|
254849
|
-
return { resolve:
|
|
254914
|
+
const resolve6 = promise2.resolve.bind(promise2);
|
|
254915
|
+
return { resolve: resolve6, promises };
|
|
254850
254916
|
};
|
|
254851
|
-
var waitForConcurrentStreams = async ({ resolve:
|
|
254852
|
-
|
|
254917
|
+
var waitForConcurrentStreams = async ({ resolve: resolve6, promises }, subprocess) => {
|
|
254918
|
+
resolve6();
|
|
254853
254919
|
const [isSubprocessExit] = await Promise.race([
|
|
254854
254920
|
Promise.allSettled([true, subprocess]),
|
|
254855
254921
|
Promise.all([false, ...promises])
|
|
@@ -255428,6 +255494,370 @@ var {
|
|
|
255428
255494
|
getCancelSignal: getCancelSignal2
|
|
255429
255495
|
} = getIpcExport();
|
|
255430
255496
|
|
|
255497
|
+
// src/core/utils/git.ts
|
|
255498
|
+
var GIT_HASH_PATTERN = /^[a-fA-F0-9]{7,64}$/;
|
|
255499
|
+
function isGitCommitHash(value) {
|
|
255500
|
+
return GIT_HASH_PATTERN.test(value);
|
|
255501
|
+
}
|
|
255502
|
+
|
|
255503
|
+
// src/core/site/git-hash.ts
|
|
255504
|
+
async function resolveGitHash(projectRoot, explicit) {
|
|
255505
|
+
const hash2 = explicit ?? await gitHead(projectRoot);
|
|
255506
|
+
if (!hash2 || !isGitCommitHash(hash2)) {
|
|
255507
|
+
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.", {
|
|
255508
|
+
hints: [
|
|
255509
|
+
{
|
|
255510
|
+
message: "Run the deploy from a git checkout, or pass the commit explicitly with --git-hash."
|
|
255511
|
+
}
|
|
255512
|
+
]
|
|
255513
|
+
});
|
|
255514
|
+
}
|
|
255515
|
+
return hash2;
|
|
255516
|
+
}
|
|
255517
|
+
async function gitHead(projectRoot) {
|
|
255518
|
+
try {
|
|
255519
|
+
const { stdout } = await execa("git", ["rev-parse", "HEAD"], {
|
|
255520
|
+
cwd: projectRoot
|
|
255521
|
+
});
|
|
255522
|
+
return stdout.trim();
|
|
255523
|
+
} catch {
|
|
255524
|
+
return null;
|
|
255525
|
+
}
|
|
255526
|
+
}
|
|
255527
|
+
// src/core/project/deploy.ts
|
|
255528
|
+
function hasResourcesToDeploy(projectData) {
|
|
255529
|
+
const {
|
|
255530
|
+
project,
|
|
255531
|
+
entities,
|
|
255532
|
+
functions,
|
|
255533
|
+
agents,
|
|
255534
|
+
agentSkills,
|
|
255535
|
+
connectors,
|
|
255536
|
+
authConfig
|
|
255537
|
+
} = projectData;
|
|
255538
|
+
const hasSite = Boolean(project.site?.outputDirectory);
|
|
255539
|
+
const hasEntities = entities.length > 0;
|
|
255540
|
+
const hasFunctions = functions.length > 0;
|
|
255541
|
+
const hasAgents = agents.length > 0;
|
|
255542
|
+
const hasAgentSkills = agentSkills.length > 0;
|
|
255543
|
+
const hasConnectors = connectors.length > 0;
|
|
255544
|
+
const hasAuthConfig = authConfig.length > 0;
|
|
255545
|
+
const hasVisibility = Boolean(project.visibility);
|
|
255546
|
+
return hasEntities || hasFunctions || hasAgents || hasAgentSkills || hasConnectors || hasAuthConfig || hasVisibility || hasSite;
|
|
255547
|
+
}
|
|
255548
|
+
async function deployAll(projectData, options) {
|
|
255549
|
+
const {
|
|
255550
|
+
project,
|
|
255551
|
+
entities,
|
|
255552
|
+
functions,
|
|
255553
|
+
agents,
|
|
255554
|
+
agentSkills,
|
|
255555
|
+
connectors,
|
|
255556
|
+
authConfig
|
|
255557
|
+
} = projectData;
|
|
255558
|
+
await setAppVisibility(project.visibility);
|
|
255559
|
+
if (project.visibility) {
|
|
255560
|
+
options?.onVisibilitySet?.(project.visibility);
|
|
255561
|
+
}
|
|
255562
|
+
await entityResource.push(entities);
|
|
255563
|
+
await deployFunctionsSequentially(functions, {
|
|
255564
|
+
onStart: options?.onFunctionStart,
|
|
255565
|
+
onResult: options?.onFunctionResult
|
|
255566
|
+
});
|
|
255567
|
+
await agentSkillResource.push(agentSkills);
|
|
255568
|
+
await agentResource.push(agents);
|
|
255569
|
+
await authConfigResource.push(authConfig);
|
|
255570
|
+
const skipConnectorSync = connectors.length === 0 && hasWorkspaceApiKeyAuth();
|
|
255571
|
+
const connectorResults = skipConnectorSync ? [] : (await pushConnectors(connectors)).results;
|
|
255572
|
+
if (project.site?.outputDirectory) {
|
|
255573
|
+
const outputDir = resolve6(project.root, project.site.outputDirectory);
|
|
255574
|
+
const { appUrl } = await deploySite(outputDir);
|
|
255575
|
+
return { appUrl, connectorResults };
|
|
255576
|
+
}
|
|
255577
|
+
return { connectorResults };
|
|
255578
|
+
}
|
|
255579
|
+
// src/core/clients/base44-client.ts
|
|
255580
|
+
var retriedRequests = new WeakSet;
|
|
255581
|
+
async function captureRequestBody(request, options) {
|
|
255582
|
+
if (request.body == null) {
|
|
255583
|
+
return;
|
|
255584
|
+
}
|
|
255585
|
+
try {
|
|
255586
|
+
const cloned = request.clone();
|
|
255587
|
+
const text = await cloned.text();
|
|
255588
|
+
options.context.__requestBody = text;
|
|
255589
|
+
} catch {}
|
|
255590
|
+
}
|
|
255591
|
+
async function handleUnauthorized(request, _options, response) {
|
|
255592
|
+
if (response.status !== 401) {
|
|
255593
|
+
return;
|
|
255594
|
+
}
|
|
255595
|
+
if (hasWorkspaceApiKeyAuth()) {
|
|
255596
|
+
return;
|
|
255597
|
+
}
|
|
255598
|
+
if (retriedRequests.has(request)) {
|
|
255599
|
+
return;
|
|
255600
|
+
}
|
|
255601
|
+
const newAccessToken = await refreshAndSaveTokens();
|
|
255602
|
+
if (!newAccessToken) {
|
|
255603
|
+
return;
|
|
255604
|
+
}
|
|
255605
|
+
retriedRequests.add(request);
|
|
255606
|
+
const requestId = request.headers.get("X-Request-ID");
|
|
255607
|
+
return distribution_default(request.clone(), {
|
|
255608
|
+
headers: {
|
|
255609
|
+
...requestId && { "X-Request-ID": requestId },
|
|
255610
|
+
Authorization: `Bearer ${newAccessToken}`
|
|
255611
|
+
}
|
|
255612
|
+
});
|
|
255613
|
+
}
|
|
255614
|
+
var base44Client = distribution_default.create({
|
|
255615
|
+
prefixUrl: getBase44ApiUrl(),
|
|
255616
|
+
headers: {
|
|
255617
|
+
"User-Agent": "Base44 CLI"
|
|
255618
|
+
},
|
|
255619
|
+
hooks: {
|
|
255620
|
+
beforeRequest: [
|
|
255621
|
+
(request) => {
|
|
255622
|
+
request.headers.set("X-Request-ID", randomUUID2());
|
|
255623
|
+
},
|
|
255624
|
+
captureRequestBody,
|
|
255625
|
+
async (request) => {
|
|
255626
|
+
const workspaceApiKey = getWorkspaceApiKeyFromEnv();
|
|
255627
|
+
if (workspaceApiKey && isWorkspaceApiKey(workspaceApiKey)) {
|
|
255628
|
+
request.headers.set("api_key", workspaceApiKey);
|
|
255629
|
+
return;
|
|
255630
|
+
}
|
|
255631
|
+
try {
|
|
255632
|
+
const auth = await readAuth();
|
|
255633
|
+
if (isTokenExpired(auth)) {
|
|
255634
|
+
const newAccessToken = await refreshAndSaveTokens();
|
|
255635
|
+
if (newAccessToken) {
|
|
255636
|
+
request.headers.set("Authorization", `Bearer ${newAccessToken}`);
|
|
255637
|
+
return;
|
|
255638
|
+
}
|
|
255639
|
+
}
|
|
255640
|
+
request.headers.set("Authorization", `Bearer ${auth.accessToken}`);
|
|
255641
|
+
} catch {}
|
|
255642
|
+
}
|
|
255643
|
+
],
|
|
255644
|
+
afterResponse: [handleUnauthorized]
|
|
255645
|
+
}
|
|
255646
|
+
});
|
|
255647
|
+
function getAppClient() {
|
|
255648
|
+
const { id } = getAppContext();
|
|
255649
|
+
return base44Client.extend({
|
|
255650
|
+
prefixUrl: new URL(`/api/apps/${id}/`, getBase44ApiUrl()).href
|
|
255651
|
+
});
|
|
255652
|
+
}
|
|
255653
|
+
function getSandboxClient(appId) {
|
|
255654
|
+
return base44Client.extend({
|
|
255655
|
+
prefixUrl: new URL(`/api/apps/${appId}/sandbox-bridge/`, getBase44ApiUrl()).href
|
|
255656
|
+
});
|
|
255657
|
+
}
|
|
255658
|
+
// src/core/clients/oauth-client.ts
|
|
255659
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
255660
|
+
var oauthClient = distribution_default.create({
|
|
255661
|
+
prefixUrl: getBase44ApiUrl(),
|
|
255662
|
+
headers: {
|
|
255663
|
+
"User-Agent": "Base44 CLI"
|
|
255664
|
+
},
|
|
255665
|
+
hooks: {
|
|
255666
|
+
beforeRequest: [
|
|
255667
|
+
(request) => {
|
|
255668
|
+
request.headers.set("X-Request-ID", randomUUID3());
|
|
255669
|
+
}
|
|
255670
|
+
]
|
|
255671
|
+
}
|
|
255672
|
+
});
|
|
255673
|
+
// src/core/auth/api.ts
|
|
255674
|
+
async function generateDeviceCode() {
|
|
255675
|
+
const response = await oauthClient.post("oauth/device/code", {
|
|
255676
|
+
json: {
|
|
255677
|
+
client_id: AUTH_CLIENT_ID,
|
|
255678
|
+
scope: "apps:read apps:write sandbox:write"
|
|
255679
|
+
},
|
|
255680
|
+
throwHttpErrors: false
|
|
255681
|
+
});
|
|
255682
|
+
if (!response.ok) {
|
|
255683
|
+
throw new ApiError(`Failed to generate device code: ${response.status} ${response.statusText}`, { statusCode: response.status });
|
|
255684
|
+
}
|
|
255685
|
+
const result = DeviceCodeResponseSchema.safeParse(await response.json());
|
|
255686
|
+
if (!result.success) {
|
|
255687
|
+
throw new SchemaValidationError("Invalid device code response from server", result.error);
|
|
255688
|
+
}
|
|
255689
|
+
return result.data;
|
|
255690
|
+
}
|
|
255691
|
+
async function getTokenFromDeviceCode(deviceCode) {
|
|
255692
|
+
const searchParams = new URLSearchParams;
|
|
255693
|
+
searchParams.set("grant_type", "urn:ietf:params:oauth:grant-type:device_code");
|
|
255694
|
+
searchParams.set("device_code", deviceCode);
|
|
255695
|
+
searchParams.set("client_id", AUTH_CLIENT_ID);
|
|
255696
|
+
const response = await oauthClient.post("oauth/token", {
|
|
255697
|
+
body: searchParams.toString(),
|
|
255698
|
+
headers: {
|
|
255699
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
255700
|
+
},
|
|
255701
|
+
throwHttpErrors: false
|
|
255702
|
+
});
|
|
255703
|
+
const json2 = await response.json();
|
|
255704
|
+
if (!response.ok) {
|
|
255705
|
+
const errorResult = OAuthErrorSchema.safeParse(json2);
|
|
255706
|
+
if (!errorResult.success) {
|
|
255707
|
+
throw new SchemaValidationError("Token request failed", errorResult.error);
|
|
255708
|
+
}
|
|
255709
|
+
const { error: error48, error_description } = errorResult.data;
|
|
255710
|
+
if (error48 === "authorization_pending" || error48 === "slow_down") {
|
|
255711
|
+
return null;
|
|
255712
|
+
}
|
|
255713
|
+
throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
|
|
255714
|
+
statusCode: response.status
|
|
255715
|
+
});
|
|
255716
|
+
}
|
|
255717
|
+
const result = TokenResponseSchema.safeParse(json2);
|
|
255718
|
+
if (!result.success) {
|
|
255719
|
+
throw new SchemaValidationError("Invalid token response from server", result.error);
|
|
255720
|
+
}
|
|
255721
|
+
return result.data;
|
|
255722
|
+
}
|
|
255723
|
+
async function renewAccessToken(refreshToken) {
|
|
255724
|
+
const searchParams = new URLSearchParams;
|
|
255725
|
+
searchParams.set("grant_type", "refresh_token");
|
|
255726
|
+
searchParams.set("refresh_token", refreshToken);
|
|
255727
|
+
searchParams.set("client_id", AUTH_CLIENT_ID);
|
|
255728
|
+
const response = await oauthClient.post("oauth/token", {
|
|
255729
|
+
body: searchParams.toString(),
|
|
255730
|
+
headers: {
|
|
255731
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
255732
|
+
},
|
|
255733
|
+
throwHttpErrors: false
|
|
255734
|
+
});
|
|
255735
|
+
const json2 = await response.json();
|
|
255736
|
+
if (!response.ok) {
|
|
255737
|
+
const errorResult = OAuthErrorSchema.safeParse(json2);
|
|
255738
|
+
if (!errorResult.success) {
|
|
255739
|
+
throw new ApiError(`Token refresh failed: ${response.statusText}`, {
|
|
255740
|
+
statusCode: response.status
|
|
255741
|
+
});
|
|
255742
|
+
}
|
|
255743
|
+
const { error: error48, error_description } = errorResult.data;
|
|
255744
|
+
throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
|
|
255745
|
+
statusCode: response.status
|
|
255746
|
+
});
|
|
255747
|
+
}
|
|
255748
|
+
const result = TokenResponseSchema.safeParse(json2);
|
|
255749
|
+
if (!result.success) {
|
|
255750
|
+
throw new SchemaValidationError("Invalid token response from server", result.error);
|
|
255751
|
+
}
|
|
255752
|
+
return result.data;
|
|
255753
|
+
}
|
|
255754
|
+
async function getUserInfo(accessToken) {
|
|
255755
|
+
const response = await oauthClient.get("oauth/userinfo", {
|
|
255756
|
+
headers: { Authorization: `Bearer ${accessToken}` }
|
|
255757
|
+
});
|
|
255758
|
+
if (!response.ok) {
|
|
255759
|
+
throw new ApiError(`Failed to fetch user info: ${response.status}`, {
|
|
255760
|
+
statusCode: response.status
|
|
255761
|
+
});
|
|
255762
|
+
}
|
|
255763
|
+
const result = UserInfoSchema.safeParse(await response.json());
|
|
255764
|
+
if (!result.success) {
|
|
255765
|
+
throw new SchemaValidationError("Invalid UserInfo response from server", result.error);
|
|
255766
|
+
}
|
|
255767
|
+
return result.data;
|
|
255768
|
+
}
|
|
255769
|
+
// src/cli/commands/auth/login-flow.ts
|
|
255770
|
+
async function generateAndDisplayDeviceCode(log, runTask) {
|
|
255771
|
+
const deviceCodeResponse = await runTask("Generating device code...", async () => {
|
|
255772
|
+
return await generateDeviceCode();
|
|
255773
|
+
}, {
|
|
255774
|
+
successMessage: "Device code generated",
|
|
255775
|
+
errorMessage: "Failed to generate device code"
|
|
255776
|
+
});
|
|
255777
|
+
log.info(`Verification code: ${theme.styles.bold(deviceCodeResponse.userCode)}` + `
|
|
255778
|
+
Please confirm this code at: ${deviceCodeResponse.verificationUri}`);
|
|
255779
|
+
return deviceCodeResponse;
|
|
255780
|
+
}
|
|
255781
|
+
async function waitForAuthentication(deviceCode, expiresIn, interval, runTask) {
|
|
255782
|
+
let tokenResponse;
|
|
255783
|
+
try {
|
|
255784
|
+
await runTask("Waiting for authentication...", async () => {
|
|
255785
|
+
await pWaitFor(async () => {
|
|
255786
|
+
const result = await getTokenFromDeviceCode(deviceCode);
|
|
255787
|
+
if (result !== null) {
|
|
255788
|
+
tokenResponse = result;
|
|
255789
|
+
return true;
|
|
255790
|
+
}
|
|
255791
|
+
return false;
|
|
255792
|
+
}, {
|
|
255793
|
+
interval: interval * 1000,
|
|
255794
|
+
timeout: expiresIn * 1000
|
|
255795
|
+
});
|
|
255796
|
+
}, {
|
|
255797
|
+
successMessage: "Authentication completed!",
|
|
255798
|
+
errorMessage: "Authentication failed"
|
|
255799
|
+
});
|
|
255800
|
+
} catch (error48) {
|
|
255801
|
+
if (error48 instanceof Error && error48.message.includes("timed out")) {
|
|
255802
|
+
throw new AuthExpiredError("Authentication timed out. Please try again.");
|
|
255803
|
+
}
|
|
255804
|
+
throw error48;
|
|
255805
|
+
}
|
|
255806
|
+
if (tokenResponse === undefined) {
|
|
255807
|
+
throw new InternalError("Failed to retrieve authentication token.");
|
|
255808
|
+
}
|
|
255809
|
+
return tokenResponse;
|
|
255810
|
+
}
|
|
255811
|
+
async function saveAuthData(response, userInfo) {
|
|
255812
|
+
const expiresAt = Date.now() + response.expiresIn * 1000;
|
|
255813
|
+
await writeAuth({
|
|
255814
|
+
accessToken: response.accessToken,
|
|
255815
|
+
refreshToken: response.refreshToken,
|
|
255816
|
+
expiresAt,
|
|
255817
|
+
email: userInfo.email,
|
|
255818
|
+
name: userInfo.name
|
|
255819
|
+
});
|
|
255820
|
+
}
|
|
255821
|
+
async function login({
|
|
255822
|
+
log,
|
|
255823
|
+
runTask
|
|
255824
|
+
}) {
|
|
255825
|
+
const deviceCodeResponse = await generateAndDisplayDeviceCode(log, runTask);
|
|
255826
|
+
const token = await waitForAuthentication(deviceCodeResponse.deviceCode, deviceCodeResponse.expiresIn, deviceCodeResponse.interval, runTask);
|
|
255827
|
+
const userInfo = await getUserInfo(token.accessToken);
|
|
255828
|
+
await saveAuthData(token, userInfo);
|
|
255829
|
+
return {
|
|
255830
|
+
outroMessage: `Successfully logged in as ${theme.styles.bold(userInfo.email)}`
|
|
255831
|
+
};
|
|
255832
|
+
}
|
|
255833
|
+
|
|
255834
|
+
// src/cli/utils/command/middleware.ts
|
|
255835
|
+
async function ensureAuth(ctx) {
|
|
255836
|
+
if (hasWorkspaceApiKeyAuth()) {
|
|
255837
|
+
ctx.errorReporter.setContext({
|
|
255838
|
+
user: { email: "workspace-api-key", name: "Workspace API key" }
|
|
255839
|
+
});
|
|
255840
|
+
return;
|
|
255841
|
+
}
|
|
255842
|
+
await seedAuthFromEnv();
|
|
255843
|
+
const loggedIn = await isLoggedIn();
|
|
255844
|
+
if (!loggedIn) {
|
|
255845
|
+
ctx.log.info("You need to login first to continue.");
|
|
255846
|
+
await login(ctx);
|
|
255847
|
+
}
|
|
255848
|
+
try {
|
|
255849
|
+
const userInfo = await readAuth();
|
|
255850
|
+
ctx.errorReporter.setContext({
|
|
255851
|
+
user: { email: userInfo.email, name: userInfo.name }
|
|
255852
|
+
});
|
|
255853
|
+
} catch {}
|
|
255854
|
+
}
|
|
255855
|
+
async function ensureAppContext(ctx, options = {}) {
|
|
255856
|
+
const appContext = await initAppContext(options);
|
|
255857
|
+
ctx.app = appContext;
|
|
255858
|
+
ctx.errorReporter.setContext({ appId: appContext.id });
|
|
255859
|
+
}
|
|
255860
|
+
|
|
255431
255861
|
// src/cli/utils/version-check.ts
|
|
255432
255862
|
async function checkForUpgrade() {
|
|
255433
255863
|
const testLatestVersion = getTestOverrides()?.latestVersion;
|
|
@@ -255586,6 +256016,14 @@ function writeJsonError(error48) {
|
|
|
255586
256016
|
envelope.hints = error48.hints;
|
|
255587
256017
|
}
|
|
255588
256018
|
}
|
|
256019
|
+
if (error48 instanceof ApiError) {
|
|
256020
|
+
if (error48.statusCode !== undefined) {
|
|
256021
|
+
envelope.statusCode = error48.statusCode;
|
|
256022
|
+
}
|
|
256023
|
+
if (error48.requestId !== undefined) {
|
|
256024
|
+
envelope.requestId = error48.requestId;
|
|
256025
|
+
}
|
|
256026
|
+
}
|
|
255589
256027
|
process.stdout.write(`${JSON.stringify(envelope)}
|
|
255590
256028
|
`);
|
|
255591
256029
|
}
|
|
@@ -255682,6 +256120,18 @@ async function confirmPush({
|
|
|
255682
256120
|
});
|
|
255683
256121
|
return !Ct(proceed) && proceed;
|
|
255684
256122
|
}
|
|
256123
|
+
// src/cli/utils/datetime.ts
|
|
256124
|
+
var import_ms2 = __toESM(require_ms(), 1);
|
|
256125
|
+
var HAS_TIMEZONE_SUFFIX = /Z$|[+-]\d{2}:\d{2}$/;
|
|
256126
|
+
function normalizeDatetime(value) {
|
|
256127
|
+
const duration3 = import_ms2.default(value);
|
|
256128
|
+
if (duration3 !== undefined) {
|
|
256129
|
+
return new Date(Date.now() - duration3).toISOString();
|
|
256130
|
+
}
|
|
256131
|
+
if (HAS_TIMEZONE_SUFFIX.test(value))
|
|
256132
|
+
return value;
|
|
256133
|
+
return `${value}Z`;
|
|
256134
|
+
}
|
|
255685
256135
|
// src/cli/utils/json.ts
|
|
255686
256136
|
function toJsonStdout(result) {
|
|
255687
256137
|
return `${JSON.stringify(result, null, 2)}
|
|
@@ -255820,11 +256270,6 @@ function verifyDenoInstalled(context) {
|
|
|
255820
256270
|
});
|
|
255821
256271
|
}
|
|
255822
256272
|
}
|
|
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
|
-
}
|
|
255828
256273
|
// src/core/workspace/schema.ts
|
|
255829
256274
|
var WorkspaceSchema = exports_external.object({
|
|
255830
256275
|
id: exports_external.string(),
|
|
@@ -255899,7 +256344,7 @@ async function pullAction({
|
|
|
255899
256344
|
runTask: runTask2
|
|
255900
256345
|
}) {
|
|
255901
256346
|
const { project: project2 } = await readProjectConfig();
|
|
255902
|
-
const dir =
|
|
256347
|
+
const dir = join18(dirname11(project2.configPath), project2.agentSkillsDir);
|
|
255903
256348
|
const remote = await runTask2("Fetching agent skills from Base44", () => fetchAgentSkills(), {
|
|
255904
256349
|
successMessage: "Agent skills fetched successfully",
|
|
255905
256350
|
errorMessage: "Failed to fetch agent skills"
|
|
@@ -255955,14 +256400,14 @@ function getAgentSkillsCommand() {
|
|
|
255955
256400
|
}
|
|
255956
256401
|
|
|
255957
256402
|
// src/cli/commands/agents/pull.ts
|
|
255958
|
-
import { dirname as
|
|
256403
|
+
import { dirname as dirname12, join as join19 } from "node:path";
|
|
255959
256404
|
async function pullAgentsAction({
|
|
255960
256405
|
log,
|
|
255961
256406
|
runTask: runTask2
|
|
255962
256407
|
}) {
|
|
255963
256408
|
const { project: project2 } = await readProjectConfig();
|
|
255964
|
-
const configDir =
|
|
255965
|
-
const agentsDir =
|
|
256409
|
+
const configDir = dirname12(project2.configPath);
|
|
256410
|
+
const agentsDir = join19(configDir, project2.agentsDir);
|
|
255966
256411
|
const remoteAgents = await runTask2("Fetching agents from Base44", async () => {
|
|
255967
256412
|
return await fetchAgents();
|
|
255968
256413
|
}, {
|
|
@@ -256032,12 +256477,12 @@ function getAgentsCommand() {
|
|
|
256032
256477
|
}
|
|
256033
256478
|
|
|
256034
256479
|
// src/cli/commands/auth/password-login.ts
|
|
256035
|
-
import { dirname as
|
|
256480
|
+
import { dirname as dirname13, join as join20 } from "node:path";
|
|
256036
256481
|
async function passwordLoginAction({ log, runTask: runTask2 }, action) {
|
|
256037
256482
|
const shouldEnable = action === "enable";
|
|
256038
256483
|
const { project: project2 } = await readProjectConfig();
|
|
256039
|
-
const configDir =
|
|
256040
|
-
const authDir =
|
|
256484
|
+
const configDir = dirname13(project2.configPath);
|
|
256485
|
+
const authDir = join20(configDir, project2.authDir);
|
|
256041
256486
|
const updated = await runTask2("Updating local auth config", async () => {
|
|
256042
256487
|
const current = await readAuthConfig(authDir) ?? DEFAULT_AUTH_CONFIG;
|
|
256043
256488
|
const merged = { ...current, enableUsernamePassword: shouldEnable };
|
|
@@ -256057,14 +256502,14 @@ function getPasswordLoginCommand() {
|
|
|
256057
256502
|
}
|
|
256058
256503
|
|
|
256059
256504
|
// src/cli/commands/auth/pull.ts
|
|
256060
|
-
import { dirname as
|
|
256505
|
+
import { dirname as dirname14, join as join21 } from "node:path";
|
|
256061
256506
|
async function pullAuthAction({
|
|
256062
256507
|
log,
|
|
256063
256508
|
runTask: runTask2
|
|
256064
256509
|
}) {
|
|
256065
256510
|
const { project: project2 } = await readProjectConfig();
|
|
256066
|
-
const configDir =
|
|
256067
|
-
const authDir =
|
|
256511
|
+
const configDir = dirname14(project2.configPath);
|
|
256512
|
+
const authDir = join21(configDir, project2.authDir);
|
|
256068
256513
|
const remoteConfig = await runTask2("Fetching auth config from Base44", async () => {
|
|
256069
256514
|
return await pullAuthConfig();
|
|
256070
256515
|
}, {
|
|
@@ -256128,7 +256573,7 @@ function getAuthPushCommand() {
|
|
|
256128
256573
|
}
|
|
256129
256574
|
|
|
256130
256575
|
// src/cli/commands/auth/social-login.ts
|
|
256131
|
-
import { dirname as
|
|
256576
|
+
import { dirname as dirname15, join as join22, resolve as resolve7 } from "node:path";
|
|
256132
256577
|
var PROVIDER_LABELS = {
|
|
256133
256578
|
google: "Google",
|
|
256134
256579
|
microsoft: "Microsoft",
|
|
@@ -256168,7 +256613,7 @@ async function socialLoginAction({ log, isNonInteractive, runTask: runTask2 }, p
|
|
|
256168
256613
|
let clientSecret;
|
|
256169
256614
|
if (useCustomOAuth && oauth && oauthCli && hasSecretOptions(options)) {
|
|
256170
256615
|
if (options.envFile) {
|
|
256171
|
-
const secrets = await parseEnvFile(
|
|
256616
|
+
const secrets = await parseEnvFile(resolve7(options.envFile));
|
|
256172
256617
|
const value = secrets[oauthCli.envVar];
|
|
256173
256618
|
if (!value) {
|
|
256174
256619
|
throw new InvalidInputError(`Key "${oauthCli.envVar}" not found in ${options.envFile}.`);
|
|
@@ -256198,8 +256643,8 @@ async function socialLoginAction({ log, isNonInteractive, runTask: runTask2 }, p
|
|
|
256198
256643
|
}
|
|
256199
256644
|
}
|
|
256200
256645
|
const { project: project2 } = await readProjectConfig();
|
|
256201
|
-
const configDir =
|
|
256202
|
-
const authDir =
|
|
256646
|
+
const configDir = dirname15(project2.configPath);
|
|
256647
|
+
const authDir = join22(configDir, project2.authDir);
|
|
256203
256648
|
const { config: updated } = await runTask2("Updating local auth config", async () => updateSocialLoginConfig(authDir, provider, shouldEnable, useCustomOAuth && options.clientId ? { clientId: options.clientId } : undefined));
|
|
256204
256649
|
if (clientSecret) {
|
|
256205
256650
|
await runTask2("Saving client secret", async () => pushCustomOAuthSecret(provider, clientSecret));
|
|
@@ -256224,7 +256669,7 @@ function getSocialLoginCommand() {
|
|
|
256224
256669
|
}
|
|
256225
256670
|
|
|
256226
256671
|
// src/cli/commands/auth/sso.ts
|
|
256227
|
-
import { dirname as
|
|
256672
|
+
import { dirname as dirname16, join as join23, resolve as resolve8 } from "node:path";
|
|
256228
256673
|
var SSOConfigFileSchema = exports_external.object({
|
|
256229
256674
|
provider: exports_external.enum(Object.values(KNOWN_SSO_PROVIDERS)),
|
|
256230
256675
|
clientId: exports_external.string(),
|
|
@@ -256240,7 +256685,7 @@ var SSOConfigFileSchema = exports_external.object({
|
|
|
256240
256685
|
ssoName: exports_external.string().optional()
|
|
256241
256686
|
});
|
|
256242
256687
|
async function loadSSOConfigFile(filePath) {
|
|
256243
|
-
const resolved =
|
|
256688
|
+
const resolved = resolve8(filePath);
|
|
256244
256689
|
const raw2 = await readJsonFile(resolved);
|
|
256245
256690
|
const result = SSOConfigFileSchema.safeParse(raw2);
|
|
256246
256691
|
if (!result.success) {
|
|
@@ -256328,7 +256773,7 @@ async function ssoEnableAction({ isNonInteractive, runTask: runTask2 }, options)
|
|
|
256328
256773
|
}
|
|
256329
256774
|
let clientSecret;
|
|
256330
256775
|
if (merged.envFile && !merged.clientSecret) {
|
|
256331
|
-
const secrets2 = await parseEnvFile(
|
|
256776
|
+
const secrets2 = await parseEnvFile(resolve8(merged.envFile));
|
|
256332
256777
|
const value = secrets2.sso_client_secret;
|
|
256333
256778
|
if (!value) {
|
|
256334
256779
|
throw new InvalidInputError(`Key "sso_client_secret" not found in ${merged.envFile}.`);
|
|
@@ -256387,8 +256832,8 @@ async function ssoEnableAction({ isNonInteractive, runTask: runTask2 }, options)
|
|
|
256387
256832
|
throw error48;
|
|
256388
256833
|
}
|
|
256389
256834
|
const { project: project2 } = await readProjectConfig();
|
|
256390
|
-
const configDir =
|
|
256391
|
-
const authDir =
|
|
256835
|
+
const configDir = dirname16(project2.configPath);
|
|
256836
|
+
const authDir = join23(configDir, project2.authDir);
|
|
256392
256837
|
await runTask2("Updating local auth config", async () => updateSSOConfig(authDir, provider, true));
|
|
256393
256838
|
await runTask2("Saving SSO credentials", async () => pushSSOSecrets(secrets));
|
|
256394
256839
|
return {
|
|
@@ -256403,8 +256848,8 @@ async function ssoDisableAction({ log, runTask: runTask2 }, options) {
|
|
|
256403
256848
|
throw new InvalidInputError("Configuration options cannot be used with disable. To disable SSO: base44 auth sso disable");
|
|
256404
256849
|
}
|
|
256405
256850
|
const { project: project2 } = await readProjectConfig();
|
|
256406
|
-
const configDir =
|
|
256407
|
-
const authDir =
|
|
256851
|
+
const configDir = dirname16(project2.configPath);
|
|
256852
|
+
const authDir = join23(configDir, project2.authDir);
|
|
256408
256853
|
const updated = await runTask2("Updating local auth config", async () => updateSSOConfig(authDir, null, false));
|
|
256409
256854
|
await runTask2("Removing SSO credentials", async () => deleteSSOSecrets());
|
|
256410
256855
|
if (!hasAnyLoginMethod(updated)) {
|
|
@@ -256966,19 +257411,19 @@ var baseOpen = async (options) => {
|
|
|
256966
257411
|
}
|
|
256967
257412
|
const subprocess = childProcess3.spawn(command2, cliArguments, childProcessOptions);
|
|
256968
257413
|
if (options.wait) {
|
|
256969
|
-
return new Promise((
|
|
257414
|
+
return new Promise((resolve9, reject) => {
|
|
256970
257415
|
subprocess.once("error", reject);
|
|
256971
257416
|
subprocess.once("close", (exitCode) => {
|
|
256972
257417
|
if (!options.allowNonzeroExitCode && exitCode !== 0) {
|
|
256973
257418
|
reject(new Error(`Exited with code ${exitCode}`));
|
|
256974
257419
|
return;
|
|
256975
257420
|
}
|
|
256976
|
-
|
|
257421
|
+
resolve9(subprocess);
|
|
256977
257422
|
});
|
|
256978
257423
|
});
|
|
256979
257424
|
}
|
|
256980
257425
|
if (isFallbackAttempt) {
|
|
256981
|
-
return new Promise((
|
|
257426
|
+
return new Promise((resolve9, reject) => {
|
|
256982
257427
|
subprocess.once("error", reject);
|
|
256983
257428
|
subprocess.once("spawn", () => {
|
|
256984
257429
|
subprocess.once("close", (exitCode) => {
|
|
@@ -256988,17 +257433,17 @@ var baseOpen = async (options) => {
|
|
|
256988
257433
|
return;
|
|
256989
257434
|
}
|
|
256990
257435
|
subprocess.unref();
|
|
256991
|
-
|
|
257436
|
+
resolve9(subprocess);
|
|
256992
257437
|
});
|
|
256993
257438
|
});
|
|
256994
257439
|
});
|
|
256995
257440
|
}
|
|
256996
257441
|
subprocess.unref();
|
|
256997
|
-
return new Promise((
|
|
257442
|
+
return new Promise((resolve9, reject) => {
|
|
256998
257443
|
subprocess.once("error", reject);
|
|
256999
257444
|
subprocess.once("spawn", () => {
|
|
257000
257445
|
subprocess.off("error", reject);
|
|
257001
|
-
|
|
257446
|
+
resolve9(subprocess);
|
|
257002
257447
|
});
|
|
257003
257448
|
});
|
|
257004
257449
|
};
|
|
@@ -257261,13 +257706,13 @@ function getConnectorsListAvailableCommand() {
|
|
|
257261
257706
|
}
|
|
257262
257707
|
|
|
257263
257708
|
// src/cli/commands/connectors/pull.ts
|
|
257264
|
-
import { dirname as
|
|
257709
|
+
import { dirname as dirname17, join as join24, resolve as resolve9 } from "node:path";
|
|
257265
257710
|
async function resolveConnectorsDir(options) {
|
|
257266
257711
|
if (!getAppContext().projectRoot) {
|
|
257267
|
-
return
|
|
257712
|
+
return resolve9(options.dir ?? "connectors");
|
|
257268
257713
|
}
|
|
257269
257714
|
const { project: project2 } = await readProjectConfig();
|
|
257270
|
-
return
|
|
257715
|
+
return join24(dirname17(project2.configPath), project2.connectorsDir);
|
|
257271
257716
|
}
|
|
257272
257717
|
async function pullConnectorsAction({ log, runTask: runTask2, jsonMode }, options) {
|
|
257273
257718
|
const connectorsDir = await resolveConnectorsDir(options);
|
|
@@ -257308,10 +257753,10 @@ function getConnectorsPullCommand() {
|
|
|
257308
257753
|
}
|
|
257309
257754
|
|
|
257310
257755
|
// src/cli/commands/connectors/push.ts
|
|
257311
|
-
import { resolve as
|
|
257756
|
+
import { resolve as resolve10 } from "node:path";
|
|
257312
257757
|
async function readConnectorsToPush(options) {
|
|
257313
257758
|
if (!getAppContext().projectRoot) {
|
|
257314
|
-
return readAllConnectors(
|
|
257759
|
+
return readAllConnectors(resolve10(options.dir ?? "connectors"));
|
|
257315
257760
|
}
|
|
257316
257761
|
const { connectors } = await readProjectConfig();
|
|
257317
257762
|
return connectors;
|
|
@@ -257539,8 +257984,8 @@ function getDeleteCommand() {
|
|
|
257539
257984
|
}
|
|
257540
257985
|
|
|
257541
257986
|
// src/cli/commands/functions/formatDeployResult.ts
|
|
257542
|
-
function formatDuration(
|
|
257543
|
-
return `${(
|
|
257987
|
+
function formatDuration(ms2) {
|
|
257988
|
+
return `${(ms2 / 1000).toFixed(1)}s`;
|
|
257544
257989
|
}
|
|
257545
257990
|
function formatDeployResult(result, log) {
|
|
257546
257991
|
const label = result.name.padEnd(25);
|
|
@@ -257675,11 +258120,11 @@ function getListCommand() {
|
|
|
257675
258120
|
}
|
|
257676
258121
|
|
|
257677
258122
|
// src/cli/commands/functions/pull.ts
|
|
257678
|
-
import { dirname as
|
|
258123
|
+
import { dirname as dirname18, join as join25 } from "node:path";
|
|
257679
258124
|
async function pullFunctionsAction({ log, runTask: runTask2 }, name2) {
|
|
257680
258125
|
const { project: project2, functions } = await readProjectConfig();
|
|
257681
|
-
const configDir =
|
|
257682
|
-
const functionsDir =
|
|
258126
|
+
const configDir = dirname18(project2.configPath);
|
|
258127
|
+
const functionsDir = join25(configDir, project2.functionsDir);
|
|
257683
258128
|
const pluginFunctionNames = new Set(functions.filter((fn) => fn.source.type === "plugin").map((fn) => fn.name));
|
|
257684
258129
|
const remoteFunctions = await runTask2("Fetching functions from Base44", async () => {
|
|
257685
258130
|
const { functions: functions2 } = await listDeployedFunctions();
|
|
@@ -257812,11 +258257,11 @@ function getBuildCommand() {
|
|
|
257812
258257
|
}
|
|
257813
258258
|
|
|
257814
258259
|
// src/cli/commands/project/create.ts
|
|
257815
|
-
import { basename as basename5, resolve as
|
|
258260
|
+
import { basename as basename5, resolve as resolve11 } from "node:path";
|
|
257816
258261
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
257817
258262
|
|
|
257818
258263
|
// src/cli/commands/project/scaffold-shared.ts
|
|
257819
|
-
import { join as
|
|
258264
|
+
import { join as join26 } from "node:path";
|
|
257820
258265
|
var DEFAULT_TEMPLATE_ID = "backend-only";
|
|
257821
258266
|
async function getTemplateById(templateId) {
|
|
257822
258267
|
const templates = await listTemplates();
|
|
@@ -257873,9 +258318,13 @@ async function completeProjectSetup({
|
|
|
257873
258318
|
const { appUrl } = await runTask2("Installing dependencies...", async (updateMessage) => {
|
|
257874
258319
|
await execa({ cwd: resolvedPath, shell: true })`${installCommand}`;
|
|
257875
258320
|
updateMessage("Building project...");
|
|
257876
|
-
await execa({
|
|
258321
|
+
await execa({
|
|
258322
|
+
cwd: resolvedPath,
|
|
258323
|
+
shell: true,
|
|
258324
|
+
env: { VITE_BASE44_APP_ID: projectId }
|
|
258325
|
+
})`${buildCommand}`;
|
|
257877
258326
|
updateMessage("Deploying site...");
|
|
257878
|
-
return await deploySite(
|
|
258327
|
+
return await deploySite(join26(resolvedPath, outputDirectory));
|
|
257879
258328
|
}, {
|
|
257880
258329
|
successMessage: theme.colors.base44Orange("Site deployed successfully"),
|
|
257881
258330
|
errorMessage: "Failed to deploy site"
|
|
@@ -258004,7 +258453,7 @@ async function createInteractive(options, ctx) {
|
|
|
258004
258453
|
}, ctx);
|
|
258005
258454
|
}
|
|
258006
258455
|
async function createNonInteractive(options, ctx) {
|
|
258007
|
-
ctx.log.info(`Creating a new project at ${
|
|
258456
|
+
ctx.log.info(`Creating a new project at ${resolve11(options.path)}`);
|
|
258008
258457
|
const template2 = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
|
|
258009
258458
|
return await executeCreate({
|
|
258010
258459
|
template: template2,
|
|
@@ -258028,7 +258477,7 @@ async function executeCreate({
|
|
|
258028
258477
|
}, ctx) {
|
|
258029
258478
|
const { log, runTask: runTask2 } = ctx;
|
|
258030
258479
|
const name2 = rawName.trim();
|
|
258031
|
-
const resolvedPath =
|
|
258480
|
+
const resolvedPath = resolve11(projectPath);
|
|
258032
258481
|
const organizationId = await resolveWorkspaceId(ctx, flagWorkspaceId, isInteractive);
|
|
258033
258482
|
const { projectId } = await runTask2("Setting up your project...", async () => {
|
|
258034
258483
|
return await createProjectFiles({
|
|
@@ -258353,7 +258802,6 @@ function getLinkCommand() {
|
|
|
258353
258802
|
}
|
|
258354
258803
|
|
|
258355
258804
|
// src/cli/commands/project/logs.ts
|
|
258356
|
-
var import_ms2 = __toESM(require_ms(), 1);
|
|
258357
258805
|
function parseFunctionFilters(options) {
|
|
258358
258806
|
const filters = {};
|
|
258359
258807
|
if (options.since) {
|
|
@@ -258381,15 +258829,6 @@ function parseFunctionNames(option) {
|
|
|
258381
258829
|
return [];
|
|
258382
258830
|
return option.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
258383
258831
|
}
|
|
258384
|
-
function normalizeDatetime(value) {
|
|
258385
|
-
const duration3 = import_ms2.default(value);
|
|
258386
|
-
if (duration3 !== undefined) {
|
|
258387
|
-
return new Date(Date.now() - duration3).toISOString();
|
|
258388
|
-
}
|
|
258389
|
-
if (/Z$|[+-]\d{2}:\d{2}$/.test(value))
|
|
258390
|
-
return value;
|
|
258391
|
-
return `${value}Z`;
|
|
258392
|
-
}
|
|
258393
258832
|
function formatEntry(entry) {
|
|
258394
258833
|
const time3 = entry.time.substring(0, 19).replace("T", " ");
|
|
258395
258834
|
const level = entry.level.toUpperCase().padEnd(5);
|
|
@@ -258435,7 +258874,7 @@ async function followLogs(functionNames, options, availableFunctionNames, jsonMo
|
|
|
258435
258874
|
for (const entry of fresh)
|
|
258436
258875
|
writeFollowLine(entry, jsonMode);
|
|
258437
258876
|
first = false;
|
|
258438
|
-
await new Promise((
|
|
258877
|
+
await new Promise((resolve12) => setTimeout(resolve12, 2000));
|
|
258439
258878
|
}
|
|
258440
258879
|
}
|
|
258441
258880
|
function formatLogs(entries, env3) {
|
|
@@ -258551,7 +258990,7 @@ function getLogsCommand() {
|
|
|
258551
258990
|
}
|
|
258552
258991
|
|
|
258553
258992
|
// src/cli/commands/project/scaffold.ts
|
|
258554
|
-
import { basename as basename6, resolve as
|
|
258993
|
+
import { basename as basename6, resolve as resolve12 } from "node:path";
|
|
258555
258994
|
function resolveAppId(options) {
|
|
258556
258995
|
const appId = options.appId;
|
|
258557
258996
|
if (!appId) {
|
|
@@ -258567,7 +259006,7 @@ function resolveAppId(options) {
|
|
|
258567
259006
|
async function scaffoldAction(ctx, name2, options, command2) {
|
|
258568
259007
|
const { log, runTask: runTask2 } = ctx;
|
|
258569
259008
|
const appId = resolveAppId(command2.optsWithGlobals());
|
|
258570
|
-
const resolvedPath =
|
|
259009
|
+
const resolvedPath = resolve12("./");
|
|
258571
259010
|
const projectName = (name2 ?? basename6(resolvedPath)).trim();
|
|
258572
259011
|
const template2 = await getTemplateById("backend-only");
|
|
258573
259012
|
log.info(`Scaffolding project at ${resolvedPath}`);
|
|
@@ -258964,7 +259403,7 @@ function getSecretsListCommand() {
|
|
|
258964
259403
|
}
|
|
258965
259404
|
|
|
258966
259405
|
// src/cli/commands/secrets/set.ts
|
|
258967
|
-
import { resolve as
|
|
259406
|
+
import { resolve as resolve13 } from "node:path";
|
|
258968
259407
|
function parseEntries(entries) {
|
|
258969
259408
|
const secrets = {};
|
|
258970
259409
|
for (const entry of entries) {
|
|
@@ -258995,7 +259434,7 @@ async function setSecretsAction({ log, runTask: runTask2 }, entries, options) {
|
|
|
258995
259434
|
validateInput(entries, options);
|
|
258996
259435
|
let secrets;
|
|
258997
259436
|
if (options.envFile) {
|
|
258998
|
-
secrets = await parseEnvFile(
|
|
259437
|
+
secrets = await parseEnvFile(resolve13(options.envFile));
|
|
258999
259438
|
if (Object.keys(secrets).length === 0) {
|
|
259000
259439
|
throw new InvalidInputError("The env file contains no valid KEY=VALUE entries.");
|
|
259001
259440
|
}
|
|
@@ -259024,81 +259463,123 @@ function getSecretsCommand() {
|
|
|
259024
259463
|
}
|
|
259025
259464
|
|
|
259026
259465
|
// src/cli/commands/site/deploy.ts
|
|
259027
|
-
import { resolve as resolve11 } from "node:path";
|
|
259028
259466
|
async function deployAction2(ctx, options) {
|
|
259029
259467
|
const { isNonInteractive } = ctx;
|
|
259030
259468
|
if (isNonInteractive && !options.yes) {
|
|
259031
259469
|
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
259032
259470
|
}
|
|
259033
|
-
const
|
|
259034
|
-
const
|
|
259035
|
-
if (
|
|
259471
|
+
const project2 = await readProjectSettings();
|
|
259472
|
+
const planned = await planAppDeploy(project2);
|
|
259473
|
+
if (planned.kind === "none") {
|
|
259036
259474
|
throw new ConfigNotFoundError("No site configuration found.", {
|
|
259037
259475
|
hints: [
|
|
259038
259476
|
{
|
|
259039
259477
|
message: `Add 'site.outputDirectory' to your config.jsonc (e.g., "site": { "outputDirectory": "dist" })`
|
|
259478
|
+
},
|
|
259479
|
+
{
|
|
259480
|
+
message: "Full-stack apps ship from their build artifact — run your framework's build first"
|
|
259040
259481
|
}
|
|
259041
259482
|
]
|
|
259042
259483
|
});
|
|
259043
259484
|
}
|
|
259044
259485
|
if (!options.yes) {
|
|
259045
259486
|
const shouldDeploy = await Re({
|
|
259046
|
-
message: `Deploy site from ${outputDirectory}?`
|
|
259487
|
+
message: planned.kind === "full-stack" ? "Deploy full-stack app?" : `Deploy site from ${project2.site?.outputDirectory}?`
|
|
259047
259488
|
});
|
|
259048
259489
|
if (Ct(shouldDeploy) || !shouldDeploy) {
|
|
259049
259490
|
return { outroMessage: "Deployment cancelled" };
|
|
259050
259491
|
}
|
|
259051
259492
|
}
|
|
259052
259493
|
await maybeBuildBeforeDeploy(ctx, project2, options.build);
|
|
259053
|
-
const
|
|
259054
|
-
|
|
259055
|
-
|
|
259056
|
-
|
|
259057
|
-
|
|
259058
|
-
|
|
259059
|
-
|
|
259494
|
+
const plan = await planAppDeploy(project2);
|
|
259495
|
+
switch (plan.kind) {
|
|
259496
|
+
case "full-stack":
|
|
259497
|
+
return await deployFullStackApp(ctx, project2.root, options);
|
|
259498
|
+
case "static-deployment":
|
|
259499
|
+
return await deployToDeploymentsApi(ctx, project2.root, plan.outputDir, options);
|
|
259500
|
+
case "static":
|
|
259501
|
+
return await deployTarball(ctx, plan.outputDir);
|
|
259502
|
+
case "none":
|
|
259503
|
+
return { outroMessage: "Nothing to deploy" };
|
|
259504
|
+
}
|
|
259505
|
+
}
|
|
259506
|
+
async function deployFullStackApp(ctx, projectRoot, options) {
|
|
259507
|
+
const gitHash = await resolveGitHash(projectRoot, options.gitHash);
|
|
259508
|
+
const { deploymentId } = await runDeployTask(ctx, {
|
|
259509
|
+
start: "Deploying full-stack app...",
|
|
259510
|
+
success: theme.colors.base44Orange("Full-stack app deployed"),
|
|
259511
|
+
error: "Full-stack deploy failed"
|
|
259512
|
+
}, async (progress) => await deployFullStack({
|
|
259513
|
+
projectRoot,
|
|
259514
|
+
gitHash,
|
|
259515
|
+
concurrency: options.concurrency,
|
|
259516
|
+
progress
|
|
259517
|
+
}));
|
|
259518
|
+
return deploymentResult(ctx, deploymentId, gitHash);
|
|
259519
|
+
}
|
|
259520
|
+
async function deployToDeploymentsApi(ctx, projectRoot, outputDir, options) {
|
|
259521
|
+
const gitHash = await resolveGitHash(projectRoot, options.gitHash);
|
|
259522
|
+
const { deploymentId } = await runDeployTask(ctx, {
|
|
259523
|
+
start: "Deploying site...",
|
|
259524
|
+
success: "Site deployed",
|
|
259525
|
+
error: "Site deploy failed"
|
|
259526
|
+
}, async (progress) => await deployStaticSite({
|
|
259060
259527
|
outputDir,
|
|
259061
259528
|
gitHash,
|
|
259062
|
-
concurrency,
|
|
259063
|
-
progress
|
|
259064
|
-
|
|
259065
|
-
|
|
259066
|
-
|
|
259067
|
-
|
|
259068
|
-
|
|
259069
|
-
|
|
259070
|
-
|
|
259071
|
-
|
|
259529
|
+
concurrency: options.concurrency,
|
|
259530
|
+
progress
|
|
259531
|
+
}));
|
|
259532
|
+
return deploymentResult(ctx, deploymentId, gitHash);
|
|
259533
|
+
}
|
|
259534
|
+
async function deployTarball({ runTask: runTask2 }, outputDir) {
|
|
259535
|
+
const { appUrl } = await runTask2("Creating archive and deploying site...", async () => await deploySite(outputDir), {
|
|
259536
|
+
successMessage: "Site deployed successfully",
|
|
259537
|
+
errorMessage: "Deployment failed"
|
|
259538
|
+
});
|
|
259539
|
+
return { outroMessage: `Visit your site at: ${appUrl}` };
|
|
259540
|
+
}
|
|
259541
|
+
async function runDeployTask({ runTask: runTask2, log }, labels, deploy5) {
|
|
259542
|
+
const progressLines = [];
|
|
259543
|
+
const warnings = [];
|
|
259544
|
+
const result = await runTask2(labels.start, async (updateMessage) => await deploy5({
|
|
259545
|
+
onWarning: (message) => {
|
|
259546
|
+
warnings.push(message);
|
|
259547
|
+
},
|
|
259548
|
+
onAssets: ({ totalAssets, newAssets }) => {
|
|
259549
|
+
const line = `Found ${totalAssets} static assets (${newAssets} new)`;
|
|
259550
|
+
progressLines.push(line);
|
|
259551
|
+
updateMessage(line);
|
|
259552
|
+
},
|
|
259553
|
+
onAssetUpload: ({ uploadedFiles, totalFiles }) => {
|
|
259554
|
+
updateMessage(`Uploaded ${uploadedFiles} of ${totalFiles} assets`);
|
|
259555
|
+
},
|
|
259556
|
+
onWorker: ({ moduleCount }) => {
|
|
259557
|
+
updateMessage(`Deploying worker (${moduleCount} modules)…`);
|
|
259072
259558
|
}
|
|
259073
|
-
}), { successMessage:
|
|
259559
|
+
}), { successMessage: labels.success, errorMessage: labels.error });
|
|
259074
259560
|
for (const line of progressLines) {
|
|
259075
259561
|
log.message(theme.styles.dim(line));
|
|
259076
259562
|
}
|
|
259563
|
+
for (const warning of warnings) {
|
|
259564
|
+
log.warn(warning);
|
|
259565
|
+
}
|
|
259566
|
+
return result;
|
|
259567
|
+
}
|
|
259568
|
+
function deploymentResult({ jsonMode }, deploymentId, gitHash) {
|
|
259077
259569
|
return {
|
|
259078
259570
|
outroMessage: `Deployment ${deploymentId} (commit ${gitHash.slice(0, 12)})`,
|
|
259079
259571
|
stdout: jsonMode ? `${JSON.stringify({ deploymentId, gitHash }, null, 2)}
|
|
259080
259572
|
` : undefined
|
|
259081
259573
|
};
|
|
259082
259574
|
}
|
|
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
259575
|
function getSiteDeployCommand() {
|
|
259091
|
-
|
|
259092
|
-
|
|
259093
|
-
|
|
259094
|
-
|
|
259095
|
-
|
|
259096
|
-
}
|
|
259097
|
-
return value;
|
|
259098
|
-
}));
|
|
259099
|
-
command2.addOption(new Option("--concurrency <n>", "Parallel asset uploads").default(DEFAULT_UPLOAD_CONCURRENCY).argParser(parseConcurrency));
|
|
259576
|
+
return new Base44Command("deploy").description("Deploy the built site to Base44 hosting (full-stack apps deploy their Workers build)").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)").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)).action(deployAction2);
|
|
259577
|
+
}
|
|
259578
|
+
function parseGitHash(value) {
|
|
259579
|
+
if (!isGitCommitHash(value)) {
|
|
259580
|
+
throw new InvalidArgumentError("Expected a git commit hash (7-64 hex chars).");
|
|
259100
259581
|
}
|
|
259101
|
-
return
|
|
259582
|
+
return value;
|
|
259102
259583
|
}
|
|
259103
259584
|
function parseConcurrency(value) {
|
|
259104
259585
|
const parsed = Number(value);
|
|
@@ -259107,10 +259588,6 @@ function parseConcurrency(value) {
|
|
|
259107
259588
|
}
|
|
259108
259589
|
return parsed;
|
|
259109
259590
|
}
|
|
259110
|
-
function staticDeploymentsEnabled(env3 = process.env) {
|
|
259111
|
-
const value = env3.BASE44_STATIC_DEPLOYMENTS;
|
|
259112
|
-
return value === "1" || value === "true";
|
|
259113
|
-
}
|
|
259114
259591
|
|
|
259115
259592
|
// src/cli/commands/site/open.ts
|
|
259116
259593
|
async function openAction({
|
|
@@ -259216,10 +259693,10 @@ function toPascalCase(name2) {
|
|
|
259216
259693
|
return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
|
|
259217
259694
|
}
|
|
259218
259695
|
// src/core/types/update-project.ts
|
|
259219
|
-
import { join as
|
|
259696
|
+
import { join as join29 } from "node:path";
|
|
259220
259697
|
var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
|
|
259221
259698
|
async function updateProjectConfig(projectRoot) {
|
|
259222
|
-
const tsconfigPath =
|
|
259699
|
+
const tsconfigPath = join29(projectRoot, "tsconfig.json");
|
|
259223
259700
|
if (!await pathExists(tsconfigPath)) {
|
|
259224
259701
|
return false;
|
|
259225
259702
|
}
|
|
@@ -259267,6 +259744,235 @@ function getTypesCommand() {
|
|
|
259267
259744
|
return new Command("types").description("Manage TypeScript type generation").addCommand(getTypesGenerateCommand());
|
|
259268
259745
|
}
|
|
259269
259746
|
|
|
259747
|
+
// src/core/resources/workflow/schema.ts
|
|
259748
|
+
var WorkflowRunStatusSchema = exports_external.enum([
|
|
259749
|
+
"running",
|
|
259750
|
+
"completed",
|
|
259751
|
+
"failed",
|
|
259752
|
+
"cancelled"
|
|
259753
|
+
]);
|
|
259754
|
+
var WorkflowListItemSchema = exports_external.object({
|
|
259755
|
+
id: exports_external.string(),
|
|
259756
|
+
name: exports_external.string(),
|
|
259757
|
+
description: exports_external.string().nullable().optional(),
|
|
259758
|
+
status: exports_external.string(),
|
|
259759
|
+
status_reason: exports_external.string().nullable().optional(),
|
|
259760
|
+
total_runs: exports_external.number().default(0),
|
|
259761
|
+
consecutive_failures: exports_external.number().default(0),
|
|
259762
|
+
last_run_at: exports_external.string().nullable().optional(),
|
|
259763
|
+
last_run_status: exports_external.string().nullable().optional()
|
|
259764
|
+
}).transform((data) => ({
|
|
259765
|
+
id: data.id,
|
|
259766
|
+
name: data.name,
|
|
259767
|
+
description: data.description ?? null,
|
|
259768
|
+
status: data.status,
|
|
259769
|
+
statusReason: data.status_reason ?? null,
|
|
259770
|
+
totalRuns: data.total_runs,
|
|
259771
|
+
consecutiveFailures: data.consecutive_failures,
|
|
259772
|
+
lastRunAt: data.last_run_at ?? null,
|
|
259773
|
+
lastRunStatus: data.last_run_status ?? null
|
|
259774
|
+
}));
|
|
259775
|
+
var ListWorkflowsResponseSchema = exports_external.array(WorkflowListItemSchema);
|
|
259776
|
+
var WorkflowRunSchema = exports_external.object({
|
|
259777
|
+
run_id: exports_external.string(),
|
|
259778
|
+
workflow_id: exports_external.string(),
|
|
259779
|
+
workflow_name: exports_external.string().default(""),
|
|
259780
|
+
trigger_type: exports_external.string().default(""),
|
|
259781
|
+
status: exports_external.string(),
|
|
259782
|
+
started_at: exports_external.string().nullable().optional(),
|
|
259783
|
+
completed_at: exports_external.string().nullable().optional(),
|
|
259784
|
+
duration_ms: exports_external.number().default(0),
|
|
259785
|
+
steps_count: exports_external.number().default(0),
|
|
259786
|
+
error_message: exports_external.string().nullable().optional(),
|
|
259787
|
+
is_test_run: exports_external.boolean().default(false),
|
|
259788
|
+
status_reason: exports_external.string().default("")
|
|
259789
|
+
}).transform((data) => ({
|
|
259790
|
+
runId: data.run_id,
|
|
259791
|
+
workflowId: data.workflow_id,
|
|
259792
|
+
workflowName: data.workflow_name,
|
|
259793
|
+
triggerType: data.trigger_type,
|
|
259794
|
+
status: data.status,
|
|
259795
|
+
startedAt: data.started_at ?? null,
|
|
259796
|
+
completedAt: data.completed_at ?? null,
|
|
259797
|
+
durationMs: data.duration_ms,
|
|
259798
|
+
stepsCount: data.steps_count,
|
|
259799
|
+
errorMessage: data.error_message ?? null,
|
|
259800
|
+
isTestRun: data.is_test_run,
|
|
259801
|
+
statusReason: data.status_reason
|
|
259802
|
+
}));
|
|
259803
|
+
var ListWorkflowRunsResponseSchema = exports_external.array(WorkflowRunSchema);
|
|
259804
|
+
|
|
259805
|
+
// src/core/resources/workflow/api.ts
|
|
259806
|
+
async function listWorkflows(limit) {
|
|
259807
|
+
const appClient = getAppClient();
|
|
259808
|
+
const searchParams = new URLSearchParams;
|
|
259809
|
+
if (limit !== undefined) {
|
|
259810
|
+
searchParams.set("limit", String(limit));
|
|
259811
|
+
}
|
|
259812
|
+
let response;
|
|
259813
|
+
try {
|
|
259814
|
+
response = await appClient.get("workflows", { searchParams });
|
|
259815
|
+
} catch (error48) {
|
|
259816
|
+
throw await ApiError.fromHttpError(error48, "listing workflows");
|
|
259817
|
+
}
|
|
259818
|
+
const result = ListWorkflowsResponseSchema.safeParse(await response.json());
|
|
259819
|
+
if (!result.success) {
|
|
259820
|
+
throw new SchemaValidationError("Invalid workflows response from server", result.error);
|
|
259821
|
+
}
|
|
259822
|
+
return result.data;
|
|
259823
|
+
}
|
|
259824
|
+
function buildRunsQueryString(filters) {
|
|
259825
|
+
const params = new URLSearchParams;
|
|
259826
|
+
if (filters.status) {
|
|
259827
|
+
params.set("status", filters.status);
|
|
259828
|
+
}
|
|
259829
|
+
if (filters.since) {
|
|
259830
|
+
params.set("since", filters.since);
|
|
259831
|
+
}
|
|
259832
|
+
if (filters.limit !== undefined) {
|
|
259833
|
+
params.set("limit", String(filters.limit));
|
|
259834
|
+
}
|
|
259835
|
+
return params;
|
|
259836
|
+
}
|
|
259837
|
+
async function listWorkflowRuns(filters = {}) {
|
|
259838
|
+
const appClient = getAppClient();
|
|
259839
|
+
let response;
|
|
259840
|
+
try {
|
|
259841
|
+
response = await appClient.get("workflows/runs", {
|
|
259842
|
+
searchParams: buildRunsQueryString(filters)
|
|
259843
|
+
});
|
|
259844
|
+
} catch (error48) {
|
|
259845
|
+
throw await ApiError.fromHttpError(error48, "listing workflow runs");
|
|
259846
|
+
}
|
|
259847
|
+
const result = ListWorkflowRunsResponseSchema.safeParse(await response.json());
|
|
259848
|
+
if (!result.success) {
|
|
259849
|
+
throw new SchemaValidationError("Invalid workflow runs response from server", result.error);
|
|
259850
|
+
}
|
|
259851
|
+
return result.data;
|
|
259852
|
+
}
|
|
259853
|
+
// src/cli/commands/workflows/legacy-app.ts
|
|
259854
|
+
var isWorkflowsNotEnabled = (error48) => error48 instanceof ApiError && error48.statusCode === 403;
|
|
259855
|
+
function rethrowLegacyAppAsExplanation(error48) {
|
|
259856
|
+
if (isWorkflowsNotEnabled(error48)) {
|
|
259857
|
+
throw new InvalidInputError("Workflows are not enabled for this app — it predates the Workflows system, so its automation runs are not readable via this command.");
|
|
259858
|
+
}
|
|
259859
|
+
throw error48;
|
|
259860
|
+
}
|
|
259861
|
+
|
|
259862
|
+
// src/cli/commands/workflows/limit.ts
|
|
259863
|
+
var MAX_LIMIT = 200;
|
|
259864
|
+
function parseLimit(limit) {
|
|
259865
|
+
if (limit === undefined)
|
|
259866
|
+
return;
|
|
259867
|
+
const parsed = Number.parseInt(limit, 10);
|
|
259868
|
+
if (Number.isNaN(parsed) || parsed < 1 || parsed > MAX_LIMIT) {
|
|
259869
|
+
throw new InvalidInputError(`Invalid limit: "${limit}". Must be a number between 1 and ${MAX_LIMIT}.`);
|
|
259870
|
+
}
|
|
259871
|
+
return parsed;
|
|
259872
|
+
}
|
|
259873
|
+
|
|
259874
|
+
// src/cli/commands/workflows/list.ts
|
|
259875
|
+
function formatWorkflowLine(workflow) {
|
|
259876
|
+
const lastRun = workflow.lastRunAt ? `last run ${workflow.lastRunStatus ?? "unknown"} at ${workflow.lastRunAt}` : "never ran";
|
|
259877
|
+
const failures = workflow.consecutiveFailures > 0 ? ` (${workflow.consecutiveFailures} consecutive failures)` : "";
|
|
259878
|
+
return `${workflow.name} [${workflow.status}] runs: ${workflow.totalRuns}, ${lastRun}${failures}`;
|
|
259879
|
+
}
|
|
259880
|
+
async function listAction({ log, runTask: runTask2, jsonMode }, options8) {
|
|
259881
|
+
const limit = parseLimit(options8.limit);
|
|
259882
|
+
const workflows = await runTask2("Fetching workflows from Base44", async () => listWorkflows(limit).catch(rethrowLegacyAppAsExplanation), {
|
|
259883
|
+
successMessage: "Workflows fetched successfully",
|
|
259884
|
+
errorMessage: "Failed to fetch workflows"
|
|
259885
|
+
});
|
|
259886
|
+
if (jsonMode) {
|
|
259887
|
+
return {
|
|
259888
|
+
outroMessage: `Found ${workflows.length} workflows.`,
|
|
259889
|
+
stdout: `${JSON.stringify({ workflows }, null, 2)}
|
|
259890
|
+
`
|
|
259891
|
+
};
|
|
259892
|
+
}
|
|
259893
|
+
if (workflows.length === 0) {
|
|
259894
|
+
return { outroMessage: "This app has no workflows." };
|
|
259895
|
+
}
|
|
259896
|
+
for (const workflow of workflows) {
|
|
259897
|
+
log.info(formatWorkflowLine(workflow));
|
|
259898
|
+
}
|
|
259899
|
+
return { outroMessage: `Found ${workflows.length} workflows.` };
|
|
259900
|
+
}
|
|
259901
|
+
function getWorkflowsListCommand() {
|
|
259902
|
+
return new Base44Command("list").description("List this app's workflows").option("-n, --limit <n>", `Number of workflows to return (1-${MAX_LIMIT}, default: 30)`).action(listAction);
|
|
259903
|
+
}
|
|
259904
|
+
|
|
259905
|
+
// src/cli/commands/workflows/runs.ts
|
|
259906
|
+
function formatDuration2(durationMs) {
|
|
259907
|
+
if (durationMs === 0)
|
|
259908
|
+
return "";
|
|
259909
|
+
return ` ${(durationMs / 1000).toFixed(1)}s`;
|
|
259910
|
+
}
|
|
259911
|
+
function formatRunTags(run) {
|
|
259912
|
+
const tags = [run.triggerType, run.isTestRun ? "test" : null].filter(Boolean);
|
|
259913
|
+
return tags.length > 0 ? ` (${tags.join(", ")})` : "";
|
|
259914
|
+
}
|
|
259915
|
+
function formatFailureDetail(run) {
|
|
259916
|
+
const reason = run.statusReason ? ` [${run.statusReason}]` : "";
|
|
259917
|
+
const message = run.errorMessage ? `
|
|
259918
|
+
${run.errorMessage}` : "";
|
|
259919
|
+
return `${reason}${message}`;
|
|
259920
|
+
}
|
|
259921
|
+
function formatRunLine(run) {
|
|
259922
|
+
const time3 = (run.startedAt ?? "").substring(0, 19).replace("T", " ");
|
|
259923
|
+
const status = run.status.toUpperCase().padEnd(9);
|
|
259924
|
+
const base = `${time3} ${status} ${run.workflowName}${formatRunTags(run)}${formatDuration2(run.durationMs)}`;
|
|
259925
|
+
const failureDetail = run.status === "failed" || run.status === "cancelled" ? formatFailureDetail(run) : "";
|
|
259926
|
+
return `${base}${failureDetail}`;
|
|
259927
|
+
}
|
|
259928
|
+
async function describeEmptyResult(hasFilters) {
|
|
259929
|
+
const workflows = await listWorkflows().catch(() => null);
|
|
259930
|
+
if (workflows === null) {
|
|
259931
|
+
return "No runs found.";
|
|
259932
|
+
}
|
|
259933
|
+
if (workflows.length === 0) {
|
|
259934
|
+
return "This app has no workflows, so there are no runs.";
|
|
259935
|
+
}
|
|
259936
|
+
const names = workflows.map((workflow) => workflow.name).join(", ");
|
|
259937
|
+
return hasFilters ? `No runs match your filters. Workflows in this app: ${names}.` : `No runs yet. Workflows in this app: ${names}.`;
|
|
259938
|
+
}
|
|
259939
|
+
async function runsAction(ctx, options8) {
|
|
259940
|
+
const limit = parseLimit(options8.limit);
|
|
259941
|
+
const runs = await ctx.runTask("Fetching workflow runs from Base44", async () => listWorkflowRuns({
|
|
259942
|
+
status: options8.status,
|
|
259943
|
+
since: options8.since,
|
|
259944
|
+
limit
|
|
259945
|
+
}).catch(rethrowLegacyAppAsExplanation), {
|
|
259946
|
+
successMessage: "Workflow runs fetched successfully",
|
|
259947
|
+
errorMessage: "Failed to fetch workflow runs"
|
|
259948
|
+
});
|
|
259949
|
+
if (ctx.jsonMode) {
|
|
259950
|
+
return {
|
|
259951
|
+
outroMessage: `Found ${runs.length} runs.`,
|
|
259952
|
+
stdout: `${JSON.stringify({ runs }, null, 2)}
|
|
259953
|
+
`
|
|
259954
|
+
};
|
|
259955
|
+
}
|
|
259956
|
+
if (runs.length === 0) {
|
|
259957
|
+
const hasFilters = Boolean(options8.status || options8.since);
|
|
259958
|
+
return { outroMessage: await describeEmptyResult(hasFilters) };
|
|
259959
|
+
}
|
|
259960
|
+
for (const run of runs) {
|
|
259961
|
+
ctx.log.info(formatRunLine(run));
|
|
259962
|
+
}
|
|
259963
|
+
return { outroMessage: `Found ${runs.length} runs.` };
|
|
259964
|
+
}
|
|
259965
|
+
function getWorkflowsRunsCommand() {
|
|
259966
|
+
return new Base44Command("runs").description("List workflow runs for this app, newest first (includes scheduled, manual, and test runs)").addOption(new Option("--status <status>", "Filter by run status").choices([
|
|
259967
|
+
...WorkflowRunStatusSchema.options
|
|
259968
|
+
])).option("--since <datetime>", "Show runs started after this time. ISO datetime or relative shorthand (e.g. 1h, 30m, 2d)", normalizeDatetime).option("-n, --limit <n>", `Number of runs to return (1-${MAX_LIMIT}, default: 30)`).action(runsAction);
|
|
259969
|
+
}
|
|
259970
|
+
|
|
259971
|
+
// src/cli/commands/workflows/index.ts
|
|
259972
|
+
function getWorkflowsCommand() {
|
|
259973
|
+
return new Command("workflows").description("Inspect this app's workflows and their runs").addCommand(getWorkflowsListCommand()).addCommand(getWorkflowsRunsCommand());
|
|
259974
|
+
}
|
|
259975
|
+
|
|
259270
259976
|
// src/cli/commands/workspace/shared.ts
|
|
259271
259977
|
function workspaceTag(workspace2) {
|
|
259272
259978
|
const role = workspace2.userRole ?? "member";
|
|
@@ -259454,7 +260160,7 @@ function createDevLogger(label2, labelColor = theme.styles.dim) {
|
|
|
259454
260160
|
// src/cli/dev/dev-server/main.ts
|
|
259455
260161
|
var import_cors = __toESM(require_lib4(), 1);
|
|
259456
260162
|
var import_express6 = __toESM(require_express(), 1);
|
|
259457
|
-
import { dirname as
|
|
260163
|
+
import { dirname as dirname24, join as join36 } from "node:path";
|
|
259458
260164
|
|
|
259459
260165
|
// ../../node_modules/get-port/index.js
|
|
259460
260166
|
import net from "node:net";
|
|
@@ -259481,14 +260187,14 @@ var getLocalHosts = () => {
|
|
|
259481
260187
|
}
|
|
259482
260188
|
return results;
|
|
259483
260189
|
};
|
|
259484
|
-
var checkAvailablePort = (options8) => new Promise((
|
|
260190
|
+
var checkAvailablePort = (options8) => new Promise((resolve15, reject) => {
|
|
259485
260191
|
const server = net.createServer();
|
|
259486
260192
|
server.unref();
|
|
259487
260193
|
server.on("error", reject);
|
|
259488
260194
|
server.listen(options8, () => {
|
|
259489
260195
|
const { port } = server.address();
|
|
259490
260196
|
server.close(() => {
|
|
259491
|
-
|
|
260197
|
+
resolve15(port);
|
|
259492
260198
|
});
|
|
259493
260199
|
});
|
|
259494
260200
|
});
|
|
@@ -259589,7 +260295,7 @@ var $setGracefulCleanup = tmp.setGracefulCleanup;
|
|
|
259589
260295
|
|
|
259590
260296
|
// src/cli/dev/dev-server/function-manager.ts
|
|
259591
260297
|
import { spawn as spawn2 } from "node:child_process";
|
|
259592
|
-
import { dirname as
|
|
260298
|
+
import { dirname as dirname21, join as join30 } from "node:path";
|
|
259593
260299
|
import { pathToFileURL } from "node:url";
|
|
259594
260300
|
|
|
259595
260301
|
// src/cli/dev/dev-server/base-function-manager.ts
|
|
@@ -259694,7 +260400,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
259694
260400
|
}
|
|
259695
260401
|
spawnFunction(func, port) {
|
|
259696
260402
|
this.logger.log(`Spawning function "${func.name}" on port ${port}`);
|
|
259697
|
-
const importMapPath =
|
|
260403
|
+
const importMapPath = join30(dirname21(this.wrapperPath), "import-map.json");
|
|
259698
260404
|
const process23 = spawn2("deno", ["run", "--allow-all", "--import-map", importMapPath, this.wrapperPath], {
|
|
259699
260405
|
env: {
|
|
259700
260406
|
...globalThis.process.env,
|
|
@@ -259733,7 +260439,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
259733
260439
|
});
|
|
259734
260440
|
}
|
|
259735
260441
|
waitForReady(name2, runningFunc) {
|
|
259736
|
-
return new Promise((
|
|
260442
|
+
return new Promise((resolve15, reject) => {
|
|
259737
260443
|
runningFunc.process.on("exit", (code2) => {
|
|
259738
260444
|
if (!runningFunc.ready) {
|
|
259739
260445
|
clearTimeout(timeout3);
|
|
@@ -259756,7 +260462,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
259756
260462
|
runningFunc.ready = true;
|
|
259757
260463
|
clearTimeout(timeout3);
|
|
259758
260464
|
runningFunc.process.stdout?.off("data", onData);
|
|
259759
|
-
|
|
260465
|
+
resolve15(runningFunc.port);
|
|
259760
260466
|
}
|
|
259761
260467
|
};
|
|
259762
260468
|
runningFunc.process.stdout?.on("data", onData);
|
|
@@ -259768,7 +260474,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
259768
260474
|
import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
259769
260475
|
import { isBuiltin } from "node:module";
|
|
259770
260476
|
import { homedir as homedir3 } from "node:os";
|
|
259771
|
-
import { join as
|
|
260477
|
+
import { join as join31 } from "node:path";
|
|
259772
260478
|
import { pathToFileURL as pathToFileURL6 } from "node:url";
|
|
259773
260479
|
var depsPromise;
|
|
259774
260480
|
function loadDeps() {
|
|
@@ -259889,9 +260595,9 @@ export default {
|
|
|
259889
260595
|
};
|
|
259890
260596
|
`;
|
|
259891
260597
|
function ensureBundlerConfig() {
|
|
259892
|
-
const dir =
|
|
260598
|
+
const dir = join31(homedir3(), ".base44", "function-bundler");
|
|
259893
260599
|
mkdirSync2(dir, { recursive: true });
|
|
259894
|
-
const configPath =
|
|
260600
|
+
const configPath = join31(dir, "deno.json");
|
|
259895
260601
|
writeFileSync2(configPath, `${JSON.stringify({ nodeModulesDir: "auto" }, null, 2)}
|
|
259896
260602
|
`);
|
|
259897
260603
|
return configPath;
|
|
@@ -260261,7 +260967,8 @@ var fieldTypes = [
|
|
|
260261
260967
|
"number",
|
|
260262
260968
|
"boolean",
|
|
260263
260969
|
"array",
|
|
260264
|
-
"object"
|
|
260970
|
+
"object",
|
|
260971
|
+
"null"
|
|
260265
260972
|
];
|
|
260266
260973
|
|
|
260267
260974
|
class Validator {
|
|
@@ -260321,6 +261028,14 @@ class Validator {
|
|
|
260321
261028
|
if (!property) {
|
|
260322
261029
|
return { hasError: false };
|
|
260323
261030
|
}
|
|
261031
|
+
if (Array.isArray(property.type)) {
|
|
261032
|
+
const types = property.type;
|
|
261033
|
+
const matched = types.some((type) => !this.validateValue(value, { ...property, type }, fieldPath).hasError);
|
|
261034
|
+
return matched ? { hasError: false } : {
|
|
261035
|
+
hasError: true,
|
|
261036
|
+
error: this.createValidationError(`Error in field ${fieldPath}: Input should be a valid ${types.join(" or ")}`)
|
|
261037
|
+
};
|
|
261038
|
+
}
|
|
260324
261039
|
const propertyType = property.type;
|
|
260325
261040
|
if (!fieldTypes.includes(propertyType)) {
|
|
260326
261041
|
return {
|
|
@@ -260361,6 +261076,14 @@ class Validator {
|
|
|
260361
261076
|
}
|
|
260362
261077
|
}
|
|
260363
261078
|
break;
|
|
261079
|
+
case "null":
|
|
261080
|
+
if (value !== null) {
|
|
261081
|
+
return {
|
|
261082
|
+
hasError: true,
|
|
261083
|
+
error: this.createValidationError(`Error in field ${fieldPath}: Input should be null`)
|
|
261084
|
+
};
|
|
261085
|
+
}
|
|
261086
|
+
break;
|
|
260364
261087
|
case "integer":
|
|
260365
261088
|
if (!Number.isInteger(value)) {
|
|
260366
261089
|
return {
|
|
@@ -260780,7 +261503,9 @@ function evaluateCondition(condition, record2, user) {
|
|
|
260780
261503
|
function checkRLS(rule, record2, user) {
|
|
260781
261504
|
if (user?.is_service === true)
|
|
260782
261505
|
return true;
|
|
260783
|
-
if (rule === undefined)
|
|
261506
|
+
if (rule === undefined || rule === null || rule === "")
|
|
261507
|
+
return true;
|
|
261508
|
+
if (typeof rule === "object" && Object.keys(rule).length === 0)
|
|
260784
261509
|
return true;
|
|
260785
261510
|
if (typeof rule === "boolean")
|
|
260786
261511
|
return rule;
|
|
@@ -261342,16 +262067,16 @@ function createCustomIntegrationRoutes(remoteProxy, logger2) {
|
|
|
261342
262067
|
|
|
261343
262068
|
// src/cli/dev/dev-server/watcher.ts
|
|
261344
262069
|
import { EventEmitter as EventEmitter4 } from "node:events";
|
|
261345
|
-
import { relative as
|
|
262070
|
+
import { relative as relative7 } from "node:path";
|
|
261346
262071
|
|
|
261347
262072
|
// ../../node_modules/chokidar/index.js
|
|
261348
262073
|
import { EventEmitter as EventEmitter3 } from "node:events";
|
|
261349
262074
|
import { stat as statcb, Stats } from "node:fs";
|
|
261350
|
-
import { readdir as readdir3, stat as
|
|
262075
|
+
import { readdir as readdir3, stat as stat6 } from "node:fs/promises";
|
|
261351
262076
|
import * as sp3 from "node:path";
|
|
261352
262077
|
|
|
261353
262078
|
// ../../node_modules/readdirp/index.js
|
|
261354
|
-
import { lstat as lstat2, readdir as readdir2, realpath, stat as
|
|
262079
|
+
import { lstat as lstat2, readdir as readdir2, realpath, stat as stat4 } from "node:fs/promises";
|
|
261355
262080
|
import { join as pjoin, relative as prelative, resolve as presolve, sep as psep } from "node:path";
|
|
261356
262081
|
import { Readable as Readable6 } from "node:stream";
|
|
261357
262082
|
var EntryTypes = {
|
|
@@ -261433,7 +262158,7 @@ class ReaddirpStream extends Readable6 {
|
|
|
261433
262158
|
const { root: root2, type } = opts;
|
|
261434
262159
|
this._fileFilter = normalizeFilter(opts.fileFilter);
|
|
261435
262160
|
this._directoryFilter = normalizeFilter(opts.directoryFilter);
|
|
261436
|
-
const statMethod = opts.lstat ? lstat2 :
|
|
262161
|
+
const statMethod = opts.lstat ? lstat2 : stat4;
|
|
261437
262162
|
if (wantBigintFsStats) {
|
|
261438
262163
|
this._stat = (path19) => statMethod(path19, { bigint: true });
|
|
261439
262164
|
} else {
|
|
@@ -261586,7 +262311,7 @@ function readdirp(root2, options8 = {}) {
|
|
|
261586
262311
|
|
|
261587
262312
|
// ../../node_modules/chokidar/handler.js
|
|
261588
262313
|
import { watch as fs_watch, unwatchFile, watchFile } from "node:fs";
|
|
261589
|
-
import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as
|
|
262314
|
+
import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as stat5 } from "node:fs/promises";
|
|
261590
262315
|
import { type as osType } from "node:os";
|
|
261591
262316
|
import * as sp2 from "node:path";
|
|
261592
262317
|
var STR_DATA = "data";
|
|
@@ -261612,7 +262337,7 @@ var EVENTS = {
|
|
|
261612
262337
|
};
|
|
261613
262338
|
var EV = EVENTS;
|
|
261614
262339
|
var THROTTLE_MODE_WATCH = "watch";
|
|
261615
|
-
var statMethods = { lstat: lstat3, stat:
|
|
262340
|
+
var statMethods = { lstat: lstat3, stat: stat5 };
|
|
261616
262341
|
var KEY_LISTENERS = "listeners";
|
|
261617
262342
|
var KEY_ERR = "errHandlers";
|
|
261618
262343
|
var KEY_RAW = "rawEmitters";
|
|
@@ -262072,9 +262797,9 @@ class NodeFsHandler {
|
|
|
262072
262797
|
if (this.fsw.closed) {
|
|
262073
262798
|
return;
|
|
262074
262799
|
}
|
|
262075
|
-
const
|
|
262800
|
+
const dirname23 = sp2.dirname(file2);
|
|
262076
262801
|
const basename8 = sp2.basename(file2);
|
|
262077
|
-
const parent = this.fsw._getWatchedDir(
|
|
262802
|
+
const parent = this.fsw._getWatchedDir(dirname23);
|
|
262078
262803
|
let prevStats = stats;
|
|
262079
262804
|
if (parent.has(basename8))
|
|
262080
262805
|
return;
|
|
@@ -262083,7 +262808,7 @@ class NodeFsHandler {
|
|
|
262083
262808
|
return;
|
|
262084
262809
|
if (!newStats || newStats.mtimeMs === 0) {
|
|
262085
262810
|
try {
|
|
262086
|
-
const newStats2 = await
|
|
262811
|
+
const newStats2 = await stat5(file2);
|
|
262087
262812
|
if (this.fsw.closed)
|
|
262088
262813
|
return;
|
|
262089
262814
|
const at13 = newStats2.atimeMs;
|
|
@@ -262101,7 +262826,7 @@ class NodeFsHandler {
|
|
|
262101
262826
|
prevStats = newStats2;
|
|
262102
262827
|
}
|
|
262103
262828
|
} catch (error48) {
|
|
262104
|
-
this.fsw._remove(
|
|
262829
|
+
this.fsw._remove(dirname23, basename8);
|
|
262105
262830
|
}
|
|
262106
262831
|
} else if (parent.has(basename8)) {
|
|
262107
262832
|
const at13 = newStats.atimeMs;
|
|
@@ -262190,7 +262915,7 @@ class NodeFsHandler {
|
|
|
262190
262915
|
this._addToNodeFs(path19, initialAdd, wh2, depth + 1);
|
|
262191
262916
|
}
|
|
262192
262917
|
}).on(EV.ERROR, this._boundHandleError);
|
|
262193
|
-
return new Promise((
|
|
262918
|
+
return new Promise((resolve16, reject) => {
|
|
262194
262919
|
if (!stream)
|
|
262195
262920
|
return reject();
|
|
262196
262921
|
stream.once(STR_END, () => {
|
|
@@ -262199,7 +262924,7 @@ class NodeFsHandler {
|
|
|
262199
262924
|
return;
|
|
262200
262925
|
}
|
|
262201
262926
|
const wasThrottled = throttler ? throttler.clear() : false;
|
|
262202
|
-
|
|
262927
|
+
resolve16(undefined);
|
|
262203
262928
|
previous.getChildren().filter((item) => {
|
|
262204
262929
|
return item !== directory && !current.has(item);
|
|
262205
262930
|
}).forEach((item) => {
|
|
@@ -262324,11 +263049,11 @@ function createPattern(matcher) {
|
|
|
262324
263049
|
if (matcher.path === string4)
|
|
262325
263050
|
return true;
|
|
262326
263051
|
if (matcher.recursive) {
|
|
262327
|
-
const
|
|
262328
|
-
if (!
|
|
263052
|
+
const relative7 = sp3.relative(matcher.path, string4);
|
|
263053
|
+
if (!relative7) {
|
|
262329
263054
|
return false;
|
|
262330
263055
|
}
|
|
262331
|
-
return !
|
|
263056
|
+
return !relative7.startsWith("..") && !sp3.isAbsolute(relative7);
|
|
262332
263057
|
}
|
|
262333
263058
|
return false;
|
|
262334
263059
|
};
|
|
@@ -262755,7 +263480,7 @@ class FSWatcher extends EventEmitter3 {
|
|
|
262755
263480
|
const fullPath = opts.cwd ? sp3.join(opts.cwd, path19) : path19;
|
|
262756
263481
|
let stats2;
|
|
262757
263482
|
try {
|
|
262758
|
-
stats2 = await
|
|
263483
|
+
stats2 = await stat6(fullPath);
|
|
262759
263484
|
} catch (err) {}
|
|
262760
263485
|
if (!stats2 || this.closed)
|
|
262761
263486
|
return;
|
|
@@ -262859,8 +263584,8 @@ class FSWatcher extends EventEmitter3 {
|
|
|
262859
263584
|
}
|
|
262860
263585
|
return this._userIgnored(path19, stats);
|
|
262861
263586
|
}
|
|
262862
|
-
_isntIgnored(path19,
|
|
262863
|
-
return !this._isIgnored(path19,
|
|
263587
|
+
_isntIgnored(path19, stat7) {
|
|
263588
|
+
return !this._isIgnored(path19, stat7);
|
|
262864
263589
|
}
|
|
262865
263590
|
_getWatchHelpers(path19) {
|
|
262866
263591
|
return new WatchHelper(path19, this.options.followSymlinks, this);
|
|
@@ -263027,7 +263752,7 @@ class WatchBase44 extends EventEmitter4 {
|
|
|
263027
263752
|
ignoreInitial: true
|
|
263028
263753
|
});
|
|
263029
263754
|
watcher.on("all", import_debounce.default(async (_event, path19) => {
|
|
263030
|
-
this.emit("change", name2,
|
|
263755
|
+
this.emit("change", name2, relative7(targetPath, path19));
|
|
263031
263756
|
}, WATCH_DEBOUNCE_MS));
|
|
263032
263757
|
watcher.on("error", (err) => {
|
|
263033
263758
|
this.logger.error(`Watch handler failed for ${targetPath}`, err);
|
|
@@ -263116,7 +263841,7 @@ async function createDevServer(options8) {
|
|
|
263116
263841
|
}
|
|
263117
263842
|
remoteProxy(req, res, next);
|
|
263118
263843
|
});
|
|
263119
|
-
const server = await new Promise((
|
|
263844
|
+
const server = await new Promise((resolve17, reject) => {
|
|
263120
263845
|
const s5 = app.listen(port, "127.0.0.1", (err) => {
|
|
263121
263846
|
if (err) {
|
|
263122
263847
|
if ("code" in err && err.code === "EADDRINUSE") {
|
|
@@ -263125,7 +263850,7 @@ async function createDevServer(options8) {
|
|
|
263125
263850
|
reject(err);
|
|
263126
263851
|
}
|
|
263127
263852
|
} else {
|
|
263128
|
-
|
|
263853
|
+
resolve17(s5);
|
|
263129
263854
|
}
|
|
263130
263855
|
});
|
|
263131
263856
|
});
|
|
@@ -263134,8 +263859,8 @@ async function createDevServer(options8) {
|
|
|
263134
263859
|
broadcastEntityEvent(io6, appId, entityName, event);
|
|
263135
263860
|
};
|
|
263136
263861
|
const base44ConfigWatcher = new WatchBase44({
|
|
263137
|
-
functions:
|
|
263138
|
-
entities:
|
|
263862
|
+
functions: join36(dirname24(project2.configPath), project2.functionsDir),
|
|
263863
|
+
entities: join36(dirname24(project2.configPath), project2.entitiesDir)
|
|
263139
263864
|
}, devLogger);
|
|
263140
263865
|
base44ConfigWatcher.on("change", async (name2) => {
|
|
263141
263866
|
try {
|
|
@@ -263175,13 +263900,13 @@ async function createDevServer(options8) {
|
|
|
263175
263900
|
if (!server.listening) {
|
|
263176
263901
|
return;
|
|
263177
263902
|
}
|
|
263178
|
-
await new Promise((
|
|
263903
|
+
await new Promise((resolve17, reject) => {
|
|
263179
263904
|
server.close((error48) => {
|
|
263180
263905
|
if (error48) {
|
|
263181
263906
|
reject(error48);
|
|
263182
263907
|
return;
|
|
263183
263908
|
}
|
|
263184
|
-
|
|
263909
|
+
resolve17();
|
|
263185
263910
|
});
|
|
263186
263911
|
});
|
|
263187
263912
|
};
|
|
@@ -263252,15 +263977,15 @@ class ServeRunner {
|
|
|
263252
263977
|
return;
|
|
263253
263978
|
}
|
|
263254
263979
|
this.stopping = true;
|
|
263255
|
-
const exited = new Promise((
|
|
263980
|
+
const exited = new Promise((resolve17) => child.once("exit", () => resolve17()));
|
|
263256
263981
|
if (process23.platform === "win32" && child.pid) {
|
|
263257
263982
|
const taskkill = spawn3("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
|
|
263258
263983
|
stdio: "ignore",
|
|
263259
263984
|
windowsHide: true
|
|
263260
263985
|
});
|
|
263261
|
-
await new Promise((
|
|
263262
|
-
taskkill.once("exit", () =>
|
|
263263
|
-
taskkill.once("error", () =>
|
|
263986
|
+
await new Promise((resolve17) => {
|
|
263987
|
+
taskkill.once("exit", () => resolve17());
|
|
263988
|
+
taskkill.once("error", () => resolve17());
|
|
263264
263989
|
});
|
|
263265
263990
|
} else if (child.pid) {
|
|
263266
263991
|
try {
|
|
@@ -263331,6 +264056,10 @@ function validateDevOptions(command2) {
|
|
|
263331
264056
|
if (appId !== undefined) {
|
|
263332
264057
|
command2.error(`base44 dev cannot be used with --app-id or ${BASE44_APP_ID_ENV_VAR}.`);
|
|
263333
264058
|
}
|
|
264059
|
+
const { port, remote } = command2.opts();
|
|
264060
|
+
if (remote && port !== undefined) {
|
|
264061
|
+
command2.error("--port applies to the local backend, which --remote does not start.");
|
|
264062
|
+
}
|
|
263334
264063
|
}
|
|
263335
264064
|
function requireLinkedProject({ app }) {
|
|
263336
264065
|
if (!app?.projectRoot) {
|
|
@@ -263338,31 +264067,44 @@ function requireLinkedProject({ app }) {
|
|
|
263338
264067
|
}
|
|
263339
264068
|
return { id: app.id, projectRoot: app.projectRoot };
|
|
263340
264069
|
}
|
|
263341
|
-
async function
|
|
264070
|
+
async function resolveConfiguredSite(app) {
|
|
263342
264071
|
const { project: project2 } = await readProjectConfig(app.projectRoot);
|
|
263343
264072
|
const serveCommand = project2.site?.serveCommand;
|
|
263344
|
-
|
|
263345
|
-
return;
|
|
263346
|
-
}
|
|
263347
|
-
return createServeCommandRunner({
|
|
263348
|
-
serveCommand,
|
|
263349
|
-
projectRoot: project2.root,
|
|
263350
|
-
appId: app.id,
|
|
263351
|
-
appBaseUrl: backendUrl
|
|
263352
|
-
});
|
|
264073
|
+
return serveCommand ? { serveCommand, projectRoot: project2.root } : undefined;
|
|
263353
264074
|
}
|
|
263354
|
-
function
|
|
264075
|
+
function stopRunnerOnProcessSignals(runner) {
|
|
263355
264076
|
const stop2 = () => void runner.stop();
|
|
263356
264077
|
process.on("SIGINT", stop2);
|
|
263357
264078
|
process.on("SIGTERM", stop2);
|
|
264079
|
+
}
|
|
264080
|
+
function startServeCommand(runner, backend) {
|
|
264081
|
+
stopRunnerOnProcessSignals(runner);
|
|
263358
264082
|
runner.onExit(() => {
|
|
263359
264083
|
backend.shutdown().finally(() => process.exit(1));
|
|
263360
264084
|
});
|
|
263361
264085
|
createDevLogger("backend", theme.styles.info).log(`Backend running on ${backend.url}`);
|
|
263362
264086
|
runner.start();
|
|
263363
264087
|
}
|
|
263364
|
-
async function
|
|
263365
|
-
const
|
|
264088
|
+
async function remoteDevAction(app) {
|
|
264089
|
+
const site2 = await resolveConfiguredSite(app);
|
|
264090
|
+
if (!site2) {
|
|
264091
|
+
throw new ConfigInvalidError("base44 dev --remote serves the frontend against the production backend, but this project has no site.serveCommand in base44/config.jsonc.");
|
|
264092
|
+
}
|
|
264093
|
+
const appBaseUrl = await getSiteUrl();
|
|
264094
|
+
const runner = createServeCommandRunner({
|
|
264095
|
+
...site2,
|
|
264096
|
+
appId: app.id,
|
|
264097
|
+
appBaseUrl
|
|
264098
|
+
});
|
|
264099
|
+
stopRunnerOnProcessSignals(runner);
|
|
264100
|
+
runner.onExit((code2) => process.exit(code2 ?? 1));
|
|
264101
|
+
runner.start();
|
|
264102
|
+
return {
|
|
264103
|
+
outroMessage: `Frontend dev server targets ${theme.styles.bold(appBaseUrl)} — every write hits your live app`
|
|
264104
|
+
};
|
|
264105
|
+
}
|
|
264106
|
+
async function localDevAction(ctx, app, options8) {
|
|
264107
|
+
const site2 = await resolveConfiguredSite(app);
|
|
263366
264108
|
const siteUrlPromise = getSiteUrl().catch(() => {
|
|
263367
264109
|
return;
|
|
263368
264110
|
});
|
|
@@ -263377,15 +264119,23 @@ async function devAction(ctx, options8) {
|
|
|
263377
264119
|
}
|
|
263378
264120
|
});
|
|
263379
264121
|
const backendUrl = localServerUrl(backend.port);
|
|
263380
|
-
|
|
263381
|
-
|
|
264122
|
+
if (site2) {
|
|
264123
|
+
const runner = createServeCommandRunner({
|
|
264124
|
+
...site2,
|
|
264125
|
+
appId: app.id,
|
|
264126
|
+
appBaseUrl: backendUrl
|
|
264127
|
+
});
|
|
263382
264128
|
startServeCommand(runner, { url: backendUrl, shutdown: backend.shutdown });
|
|
263383
264129
|
}
|
|
263384
|
-
const outroMessage =
|
|
264130
|
+
const outroMessage = site2 ? "Open your app using the frontend dev server URL" : `Dev server is available at ${theme.colors.links(backendUrl)}`;
|
|
263385
264131
|
return { outroMessage };
|
|
263386
264132
|
}
|
|
264133
|
+
async function devAction(ctx, options8) {
|
|
264134
|
+
const app = requireLinkedProject(ctx);
|
|
264135
|
+
return options8.remote ? remoteDevAction(app) : localDevAction(ctx, app, options8);
|
|
264136
|
+
}
|
|
263387
264137
|
function getDevCommand() {
|
|
263388
|
-
return new Base44Command("dev").description("Start the development server").option("-p, --port <number>", "Port for the development server").hook("preAction", validateDevOptions).action(devAction);
|
|
264138
|
+
return new Base44Command("dev").description("Start the development server").option("-p, --port <number>", "Port for the development server").option("--remote", "Serve the frontend against the production backend instead of a local one").hook("preAction", validateDevOptions).action(devAction);
|
|
263389
264139
|
}
|
|
263390
264140
|
|
|
263391
264141
|
// src/core/exec/run-script.ts
|
|
@@ -263430,13 +264180,13 @@ async function runScript(options8) {
|
|
|
263430
264180
|
}
|
|
263431
264181
|
// src/cli/commands/exec.ts
|
|
263432
264182
|
function readStdin2() {
|
|
263433
|
-
return new Promise((
|
|
264183
|
+
return new Promise((resolve17, reject) => {
|
|
263434
264184
|
let data = "";
|
|
263435
264185
|
process.stdin.setEncoding("utf-8");
|
|
263436
264186
|
process.stdin.on("data", (chunk) => {
|
|
263437
264187
|
data += chunk;
|
|
263438
264188
|
});
|
|
263439
|
-
process.stdin.on("end", () =>
|
|
264189
|
+
process.stdin.on("end", () => resolve17(data));
|
|
263440
264190
|
process.stdin.on("error", reject);
|
|
263441
264191
|
});
|
|
263442
264192
|
}
|
|
@@ -263507,7 +264257,7 @@ Examples:
|
|
|
263507
264257
|
}
|
|
263508
264258
|
|
|
263509
264259
|
// src/cli/commands/project/eject.ts
|
|
263510
|
-
import { resolve as
|
|
264260
|
+
import { resolve as resolve17 } from "node:path";
|
|
263511
264261
|
var import_kebabCase2 = __toESM(require_kebabCase(), 1);
|
|
263512
264262
|
async function eject(ctx, options8, command2) {
|
|
263513
264263
|
const { log, runTask: runTask2, isNonInteractive } = ctx;
|
|
@@ -263571,7 +264321,7 @@ async function eject(ctx, options8, command2) {
|
|
|
263571
264321
|
Ne("Operation cancelled.");
|
|
263572
264322
|
throw new CLIExitError(0);
|
|
263573
264323
|
}
|
|
263574
|
-
const resolvedPath =
|
|
264324
|
+
const resolvedPath = resolve17(selectedPath);
|
|
263575
264325
|
await runTask2("Downloading your project's code...", async (updateMessage) => {
|
|
263576
264326
|
await createProjectFilesForExistingProject({
|
|
263577
264327
|
projectId,
|
|
@@ -263648,6 +264398,7 @@ function createProgram(context) {
|
|
|
263648
264398
|
program2.addCommand(getAgentSkillsCommand());
|
|
263649
264399
|
program2.addCommand(getConnectorsCommand());
|
|
263650
264400
|
program2.addCommand(getFunctionsCommand());
|
|
264401
|
+
program2.addCommand(getWorkflowsCommand());
|
|
263651
264402
|
program2.addCommand(getSecretsCommand());
|
|
263652
264403
|
program2.addCommand(getSandboxCommand());
|
|
263653
264404
|
program2.addCommand(getAuthCommand());
|
|
@@ -263664,7 +264415,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
|
|
|
263664
264415
|
import { release, type } from "node:os";
|
|
263665
264416
|
|
|
263666
264417
|
// ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
263667
|
-
import { dirname as
|
|
264418
|
+
import { dirname as dirname25, posix, sep as sep2 } from "path";
|
|
263668
264419
|
function createModulerModifier() {
|
|
263669
264420
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
263670
264421
|
return async (frames) => {
|
|
@@ -263673,7 +264424,7 @@ function createModulerModifier() {
|
|
|
263673
264424
|
return frames;
|
|
263674
264425
|
};
|
|
263675
264426
|
}
|
|
263676
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
264427
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname25(process.argv[1]) : process.cwd(), isWindows5 = sep2 === "\\") {
|
|
263677
264428
|
const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
|
|
263678
264429
|
return (filename) => {
|
|
263679
264430
|
if (!filename)
|
|
@@ -265951,14 +266702,14 @@ async function addSourceContext(frames) {
|
|
|
265951
266702
|
return frames;
|
|
265952
266703
|
}
|
|
265953
266704
|
function getContextLinesFromFile(path19, ranges, output) {
|
|
265954
|
-
return new Promise((
|
|
266705
|
+
return new Promise((resolve18) => {
|
|
265955
266706
|
const stream = createReadStream2(path19);
|
|
265956
266707
|
const lineReaded = createInterface2({
|
|
265957
266708
|
input: stream
|
|
265958
266709
|
});
|
|
265959
266710
|
function destroyStreamAndResolve() {
|
|
265960
266711
|
stream.destroy();
|
|
265961
|
-
|
|
266712
|
+
resolve18();
|
|
265962
266713
|
}
|
|
265963
266714
|
let lineNumber = 0;
|
|
265964
266715
|
let currentRangeIndex = 0;
|
|
@@ -267070,15 +267821,15 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
267070
267821
|
return true;
|
|
267071
267822
|
if (this.featureFlagsPoller === undefined)
|
|
267072
267823
|
return false;
|
|
267073
|
-
return new Promise((
|
|
267824
|
+
return new Promise((resolve18) => {
|
|
267074
267825
|
const timeout3 = setTimeout(() => {
|
|
267075
267826
|
cleanup();
|
|
267076
|
-
|
|
267827
|
+
resolve18(false);
|
|
267077
267828
|
}, timeoutMs);
|
|
267078
267829
|
const cleanup = this._events.on("localEvaluationFlagsLoaded", (count2) => {
|
|
267079
267830
|
clearTimeout(timeout3);
|
|
267080
267831
|
cleanup();
|
|
267081
|
-
|
|
267832
|
+
resolve18(count2 > 0);
|
|
267082
267833
|
});
|
|
267083
267834
|
});
|
|
267084
267835
|
}
|
|
@@ -267862,9 +268613,9 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
|
|
|
267862
268613
|
});
|
|
267863
268614
|
}
|
|
267864
268615
|
// src/cli/index.ts
|
|
267865
|
-
var __dirname4 =
|
|
268616
|
+
var __dirname4 = dirname26(fileURLToPath6(import.meta.url));
|
|
267866
268617
|
async function runCLI(options8) {
|
|
267867
|
-
ensureNpmAssets(
|
|
268618
|
+
ensureNpmAssets(join37(__dirname4, "../assets"));
|
|
267868
268619
|
const errorReporter = new ErrorReporter;
|
|
267869
268620
|
errorReporter.registerProcessErrorHandlers();
|
|
267870
268621
|
const jsonMode = process.argv.includes("--json");
|
|
@@ -267903,4 +268654,4 @@ export {
|
|
|
267903
268654
|
CLIExitError
|
|
267904
268655
|
};
|
|
267905
268656
|
|
|
267906
|
-
//# debugId=
|
|
268657
|
+
//# debugId=E23804C9C857B3A464756E2164756E21
|