@base44-preview/cli 0.1.8-pr.584.c8b5c9f → 0.1.8-pr.600.002d9ac
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 +1103 -1297
- package/dist/cli/index.js.map +35 -34
- 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(stat2, path11, options) {
|
|
23356
|
+
if (!stat2.isSymbolicLink() && !stat2.isFile()) {
|
|
23357
23357
|
return false;
|
|
23358
23358
|
}
|
|
23359
23359
|
return checkPathExt(path11, options);
|
|
23360
23360
|
}
|
|
23361
23361
|
function isexe(path11, options, cb) {
|
|
23362
|
-
fs14.stat(path11, function(er,
|
|
23363
|
-
cb(er, er ? false : checkStat(
|
|
23362
|
+
fs14.stat(path11, function(er, stat2) {
|
|
23363
|
+
cb(er, er ? false : checkStat(stat2, path11, options));
|
|
23364
23364
|
});
|
|
23365
23365
|
}
|
|
23366
23366
|
function sync(path11, options) {
|
|
@@ -23374,20 +23374,20 @@ var require_mode = __commonJS((exports, module) => {
|
|
|
23374
23374
|
isexe.sync = sync;
|
|
23375
23375
|
var fs14 = __require("fs");
|
|
23376
23376
|
function isexe(path11, options, cb) {
|
|
23377
|
-
fs14.stat(path11, function(er,
|
|
23378
|
-
cb(er, er ? false : checkStat(
|
|
23377
|
+
fs14.stat(path11, function(er, stat2) {
|
|
23378
|
+
cb(er, er ? false : checkStat(stat2, options));
|
|
23379
23379
|
});
|
|
23380
23380
|
}
|
|
23381
23381
|
function sync(path11, options) {
|
|
23382
23382
|
return checkStat(fs14.statSync(path11), options);
|
|
23383
23383
|
}
|
|
23384
|
-
function checkStat(
|
|
23385
|
-
return
|
|
23384
|
+
function checkStat(stat2, options) {
|
|
23385
|
+
return stat2.isFile() && checkMode(stat2, options);
|
|
23386
23386
|
}
|
|
23387
|
-
function checkMode(
|
|
23388
|
-
var mod =
|
|
23389
|
-
var uid =
|
|
23390
|
-
var gid =
|
|
23387
|
+
function checkMode(stat2, options) {
|
|
23388
|
+
var mod = stat2.mode;
|
|
23389
|
+
var uid = stat2.uid;
|
|
23390
|
+
var gid = stat2.gid;
|
|
23391
23391
|
var myUid = options.uid !== undefined ? options.uid : process.getuid && process.getuid();
|
|
23392
23392
|
var myGid = options.gid !== undefined ? options.gid : process.getgid && process.getgid();
|
|
23393
23393
|
var u = parseInt("100", 8);
|
|
@@ -23419,12 +23419,12 @@ var require_isexe = __commonJS((exports, module) => {
|
|
|
23419
23419
|
if (typeof Promise !== "function") {
|
|
23420
23420
|
throw new TypeError("callback not provided");
|
|
23421
23421
|
}
|
|
23422
|
-
return new Promise(function(
|
|
23422
|
+
return new Promise(function(resolve4, reject) {
|
|
23423
23423
|
isexe(path11, options || {}, function(er, is) {
|
|
23424
23424
|
if (er) {
|
|
23425
23425
|
reject(er);
|
|
23426
23426
|
} else {
|
|
23427
|
-
|
|
23427
|
+
resolve4(is);
|
|
23428
23428
|
}
|
|
23429
23429
|
});
|
|
23430
23430
|
});
|
|
@@ -23486,27 +23486,27 @@ var require_which = __commonJS((exports, module) => {
|
|
|
23486
23486
|
opt = {};
|
|
23487
23487
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
23488
23488
|
const found = [];
|
|
23489
|
-
const step = (i) => new Promise((
|
|
23489
|
+
const step = (i) => new Promise((resolve4, reject) => {
|
|
23490
23490
|
if (i === pathEnv.length)
|
|
23491
|
-
return opt.all && found.length ?
|
|
23491
|
+
return opt.all && found.length ? resolve4(found) : reject(getNotFoundError(cmd));
|
|
23492
23492
|
const ppRaw = pathEnv[i];
|
|
23493
23493
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
23494
23494
|
const pCmd = path11.join(pathPart, cmd);
|
|
23495
23495
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
23496
|
-
|
|
23496
|
+
resolve4(subStep(p, i, 0));
|
|
23497
23497
|
});
|
|
23498
|
-
const subStep = (p, i, ii) => new Promise((
|
|
23498
|
+
const subStep = (p, i, ii) => new Promise((resolve4, reject) => {
|
|
23499
23499
|
if (ii === pathExt.length)
|
|
23500
|
-
return
|
|
23500
|
+
return resolve4(step(i + 1));
|
|
23501
23501
|
const ext = pathExt[ii];
|
|
23502
23502
|
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
23503
23503
|
if (!er && is) {
|
|
23504
23504
|
if (opt.all)
|
|
23505
23505
|
found.push(p + ext);
|
|
23506
23506
|
else
|
|
23507
|
-
return
|
|
23507
|
+
return resolve4(p + ext);
|
|
23508
23508
|
}
|
|
23509
|
-
return
|
|
23509
|
+
return resolve4(subStep(p, i, ii + 1));
|
|
23510
23510
|
});
|
|
23511
23511
|
});
|
|
23512
23512
|
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
@@ -27034,7 +27034,7 @@ var require_lodash8 = __commonJS((exports, module) => {
|
|
|
27034
27034
|
}
|
|
27035
27035
|
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
|
|
27036
27036
|
});
|
|
27037
|
-
function
|
|
27037
|
+
function join17(array2, separator) {
|
|
27038
27038
|
return array2 == null ? "" : nativeJoin.call(array2, separator);
|
|
27039
27039
|
}
|
|
27040
27040
|
function last(array2) {
|
|
@@ -28966,7 +28966,7 @@ __p += '`;
|
|
|
28966
28966
|
lodash.isUndefined = isUndefined;
|
|
28967
28967
|
lodash.isWeakMap = isWeakMap;
|
|
28968
28968
|
lodash.isWeakSet = isWeakSet;
|
|
28969
|
-
lodash.join =
|
|
28969
|
+
lodash.join = join17;
|
|
28970
28970
|
lodash.kebabCase = kebabCase;
|
|
28971
28971
|
lodash.last = last;
|
|
28972
28972
|
lodash.lastIndexOf = lastIndexOf;
|
|
@@ -31176,7 +31176,7 @@ function cleanDoc(doc2) {
|
|
|
31176
31176
|
return mapDoc(doc2, (currentDoc) => cleanDocFn(currentDoc));
|
|
31177
31177
|
}
|
|
31178
31178
|
function replaceEndOfLine(doc2, replacement = literalline) {
|
|
31179
|
-
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
31179
|
+
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ? join26(replacement, currentDoc.split(`
|
|
31180
31180
|
`)) : currentDoc);
|
|
31181
31181
|
}
|
|
31182
31182
|
function canBreakFn(doc2) {
|
|
@@ -31256,7 +31256,7 @@ function indentIfBreak(contents, options) {
|
|
|
31256
31256
|
negate: options.negate
|
|
31257
31257
|
};
|
|
31258
31258
|
}
|
|
31259
|
-
function
|
|
31259
|
+
function join26(separator, docs) {
|
|
31260
31260
|
assertDoc(separator);
|
|
31261
31261
|
assertDocArray(docs);
|
|
31262
31262
|
const parts = [];
|
|
@@ -31967,7 +31967,7 @@ var init_doc = __esm(() => {
|
|
|
31967
31967
|
MODE_FLAT = Symbol("MODE_FLAT");
|
|
31968
31968
|
DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
|
|
31969
31969
|
builders = {
|
|
31970
|
-
join:
|
|
31970
|
+
join: join26,
|
|
31971
31971
|
line,
|
|
31972
31972
|
softline,
|
|
31973
31973
|
hardline,
|
|
@@ -120385,7 +120385,7 @@ function skipVoid(str, ptr, banNewLines, banComments) {
|
|
|
120385
120385
|
ptr++;
|
|
120386
120386
|
return banComments || c24 !== "#" ? ptr : skipVoid(str, skipComment(str, ptr), banNewLines);
|
|
120387
120387
|
}
|
|
120388
|
-
function skipUntil(str, ptr,
|
|
120388
|
+
function skipUntil(str, ptr, sep, end, banNewLines = false) {
|
|
120389
120389
|
if (!end) {
|
|
120390
120390
|
ptr = indexOfNewline(str, ptr);
|
|
120391
120391
|
return ptr < 0 ? str.length : ptr;
|
|
@@ -120394,7 +120394,7 @@ function skipUntil(str, ptr, sep2, end, banNewLines = false) {
|
|
|
120394
120394
|
let c24 = str[i5];
|
|
120395
120395
|
if (c24 === "#") {
|
|
120396
120396
|
i5 = indexOfNewline(str, i5);
|
|
120397
|
-
} else if (c24 ===
|
|
120397
|
+
} else if (c24 === sep) {
|
|
120398
120398
|
return i5 + 1;
|
|
120399
120399
|
} else if (c24 === end || banNewLines && (c24 === `
|
|
120400
120400
|
` || c24 === "\r" && str[i5 + 1] === `
|
|
@@ -121174,7 +121174,7 @@ function getDataProtocolModuleFormat(parsed) {
|
|
|
121174
121174
|
const { 1: mime } = /^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec(parsed.pathname) || [null, null, null];
|
|
121175
121175
|
return mimeToFormat(mime);
|
|
121176
121176
|
}
|
|
121177
|
-
function
|
|
121177
|
+
function extname(url3) {
|
|
121178
121178
|
const pathname = url3.pathname;
|
|
121179
121179
|
let index = pathname.length;
|
|
121180
121180
|
while (index--) {
|
|
@@ -121189,7 +121189,7 @@ function extname2(url3) {
|
|
|
121189
121189
|
return "";
|
|
121190
121190
|
}
|
|
121191
121191
|
function getFileProtocolModuleFormat(url3, _context, ignoreErrors) {
|
|
121192
|
-
const value =
|
|
121192
|
+
const value = extname(url3);
|
|
121193
121193
|
if (value === ".js") {
|
|
121194
121194
|
const packageType = getPackageType(url3);
|
|
121195
121195
|
if (packageType !== "none") {
|
|
@@ -123904,14 +123904,14 @@ async function printToDoc(originalText, options8) {
|
|
|
123904
123904
|
async function printDocToString2(doc2, options8) {
|
|
123905
123905
|
return printDocToStringWithoutNormalizeOptions(doc2, await normalize_format_options_default(options8));
|
|
123906
123906
|
}
|
|
123907
|
-
function createParsersAndPrinters(
|
|
123907
|
+
function createParsersAndPrinters(modules) {
|
|
123908
123908
|
const parsers2 = /* @__PURE__ */ Object.create(null);
|
|
123909
123909
|
const printers2 = /* @__PURE__ */ Object.create(null);
|
|
123910
123910
|
for (const {
|
|
123911
123911
|
importPlugin: importPlugin2,
|
|
123912
123912
|
parsers: parserNames = [],
|
|
123913
123913
|
printers: printerNames = []
|
|
123914
|
-
} of
|
|
123914
|
+
} of modules) {
|
|
123915
123915
|
const loadPlugin2 = async () => {
|
|
123916
123916
|
const plugin = await importPlugin2();
|
|
123917
123917
|
Object.assign(parsers2, plugin.parsers);
|
|
@@ -136881,7 +136881,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
136881
136881
|
return mapDoc2(doc2, (currentDoc) => cleanDocFn2(currentDoc));
|
|
136882
136882
|
}
|
|
136883
136883
|
function replaceEndOfLine2(doc2, replacement = literalline2) {
|
|
136884
|
-
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
136884
|
+
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ? join28(replacement, currentDoc.split(`
|
|
136885
136885
|
`)) : currentDoc);
|
|
136886
136886
|
}
|
|
136887
136887
|
function canBreakFn2(doc2) {
|
|
@@ -136967,7 +136967,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
136967
136967
|
negate: options8.negate
|
|
136968
136968
|
};
|
|
136969
136969
|
}
|
|
136970
|
-
function
|
|
136970
|
+
function join28(separator, docs) {
|
|
136971
136971
|
assertDoc2(separator);
|
|
136972
136972
|
assertDocArray2(docs);
|
|
136973
136973
|
const parts = [];
|
|
@@ -137632,7 +137632,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
137632
137632
|
}
|
|
137633
137633
|
}
|
|
137634
137634
|
var builders2 = {
|
|
137635
|
-
join:
|
|
137635
|
+
join: join28,
|
|
137636
137636
|
line: line3,
|
|
137637
137637
|
softline: softline2,
|
|
137638
137638
|
hardline: hardline4,
|
|
@@ -138287,11 +138287,11 @@ var require_prettier = __commonJS((exports, module) => {
|
|
|
138287
138287
|
var require_formatter = __commonJS((exports) => {
|
|
138288
138288
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
|
|
138289
138289
|
function adopt(value) {
|
|
138290
|
-
return value instanceof P9 ? value : new P9(function(
|
|
138291
|
-
|
|
138290
|
+
return value instanceof P9 ? value : new P9(function(resolve13) {
|
|
138291
|
+
resolve13(value);
|
|
138292
138292
|
});
|
|
138293
138293
|
}
|
|
138294
|
-
return new (P9 || (P9 = Promise))(function(
|
|
138294
|
+
return new (P9 || (P9 = Promise))(function(resolve13, reject) {
|
|
138295
138295
|
function fulfilled(value) {
|
|
138296
138296
|
try {
|
|
138297
138297
|
step(generator.next(value));
|
|
@@ -138307,7 +138307,7 @@ var require_formatter = __commonJS((exports) => {
|
|
|
138307
138307
|
}
|
|
138308
138308
|
}
|
|
138309
138309
|
function step(result) {
|
|
138310
|
-
result.done ?
|
|
138310
|
+
result.done ? resolve13(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
138311
138311
|
}
|
|
138312
138312
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
138313
138313
|
});
|
|
@@ -142960,7 +142960,7 @@ var require_url = __commonJS((exports) => {
|
|
|
142960
142960
|
};
|
|
142961
142961
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
142962
142962
|
exports.parse = undefined;
|
|
142963
|
-
exports.resolve =
|
|
142963
|
+
exports.resolve = resolve13;
|
|
142964
142964
|
exports.cwd = cwd;
|
|
142965
142965
|
exports.getProtocol = getProtocol;
|
|
142966
142966
|
exports.getExtension = getExtension;
|
|
@@ -142972,7 +142972,7 @@ var require_url = __commonJS((exports) => {
|
|
|
142972
142972
|
exports.fromFileSystemPath = fromFileSystemPath;
|
|
142973
142973
|
exports.toFileSystemPath = toFileSystemPath;
|
|
142974
142974
|
exports.safePointerToPath = safePointerToPath;
|
|
142975
|
-
exports.relative =
|
|
142975
|
+
exports.relative = relative4;
|
|
142976
142976
|
var convert_path_to_posix_1 = __importDefault(require_convert_path_to_posix());
|
|
142977
142977
|
var path_1 = __importStar(__require("path"));
|
|
142978
142978
|
var forwardSlashPattern = /\//g;
|
|
@@ -142988,7 +142988,7 @@ var require_url = __commonJS((exports) => {
|
|
|
142988
142988
|
var urlDecodePatterns = [/%23/g, "#", /%24/g, "$", /%26/g, "&", /%2C/g, ",", /%40/g, "@"];
|
|
142989
142989
|
var parse11 = (u4) => new URL(u4);
|
|
142990
142990
|
exports.parse = parse11;
|
|
142991
|
-
function
|
|
142991
|
+
function resolve13(from, to5) {
|
|
142992
142992
|
const fromUrl = new URL((0, convert_path_to_posix_1.default)(from), "https://aaa.nonexistanturl.com");
|
|
142993
142993
|
const resolvedUrl = new URL((0, convert_path_to_posix_1.default)(to5), fromUrl);
|
|
142994
142994
|
const endSpaces = to5.match(/(\s*)$/)?.[1] || "";
|
|
@@ -143122,9 +143122,9 @@ var require_url = __commonJS((exports) => {
|
|
|
143122
143122
|
return decodeURIComponent(value).replace(jsonPointerSlash, "/").replace(jsonPointerTilde, "~");
|
|
143123
143123
|
});
|
|
143124
143124
|
}
|
|
143125
|
-
function
|
|
143125
|
+
function relative4(from, to5) {
|
|
143126
143126
|
if (!isFileSystemPath(from) || !isFileSystemPath(to5)) {
|
|
143127
|
-
return
|
|
143127
|
+
return resolve13(from, to5);
|
|
143128
143128
|
}
|
|
143129
143129
|
const fromDir = path_1.default.dirname(stripHash(from));
|
|
143130
143130
|
const toPath4 = stripHash(to5);
|
|
@@ -143800,7 +143800,7 @@ var require_plugins = __commonJS((exports) => {
|
|
|
143800
143800
|
let plugin;
|
|
143801
143801
|
let lastError;
|
|
143802
143802
|
let index = 0;
|
|
143803
|
-
return new Promise((
|
|
143803
|
+
return new Promise((resolve13, reject) => {
|
|
143804
143804
|
runNextPlugin();
|
|
143805
143805
|
function runNextPlugin() {
|
|
143806
143806
|
plugin = plugins[index++];
|
|
@@ -143828,7 +143828,7 @@ var require_plugins = __commonJS((exports) => {
|
|
|
143828
143828
|
}
|
|
143829
143829
|
}
|
|
143830
143830
|
function onSuccess(result) {
|
|
143831
|
-
|
|
143831
|
+
resolve13({
|
|
143832
143832
|
plugin,
|
|
143833
143833
|
result
|
|
143834
143834
|
});
|
|
@@ -145161,11 +145161,11 @@ var require_lib3 = __commonJS((exports) => {
|
|
|
145161
145161
|
var require_resolver = __commonJS((exports) => {
|
|
145162
145162
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
|
|
145163
145163
|
function adopt(value) {
|
|
145164
|
-
return value instanceof P9 ? value : new P9(function(
|
|
145165
|
-
|
|
145164
|
+
return value instanceof P9 ? value : new P9(function(resolve13) {
|
|
145165
|
+
resolve13(value);
|
|
145166
145166
|
});
|
|
145167
145167
|
}
|
|
145168
|
-
return new (P9 || (P9 = Promise))(function(
|
|
145168
|
+
return new (P9 || (P9 = Promise))(function(resolve13, reject) {
|
|
145169
145169
|
function fulfilled(value) {
|
|
145170
145170
|
try {
|
|
145171
145171
|
step(generator.next(value));
|
|
@@ -145181,7 +145181,7 @@ var require_resolver = __commonJS((exports) => {
|
|
|
145181
145181
|
}
|
|
145182
145182
|
}
|
|
145183
145183
|
function step(result) {
|
|
145184
|
-
result.done ?
|
|
145184
|
+
result.done ? resolve13(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
145185
145185
|
}
|
|
145186
145186
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
145187
145187
|
});
|
|
@@ -145302,11 +145302,11 @@ var require_optionValidator = __commonJS((exports) => {
|
|
|
145302
145302
|
var require_src3 = __commonJS((exports) => {
|
|
145303
145303
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
|
|
145304
145304
|
function adopt(value) {
|
|
145305
|
-
return value instanceof P9 ? value : new P9(function(
|
|
145306
|
-
|
|
145305
|
+
return value instanceof P9 ? value : new P9(function(resolve13) {
|
|
145306
|
+
resolve13(value);
|
|
145307
145307
|
});
|
|
145308
145308
|
}
|
|
145309
|
-
return new (P9 || (P9 = Promise))(function(
|
|
145309
|
+
return new (P9 || (P9 = Promise))(function(resolve13, reject) {
|
|
145310
145310
|
function fulfilled(value) {
|
|
145311
145311
|
try {
|
|
145312
145312
|
step(generator.next(value));
|
|
@@ -145322,7 +145322,7 @@ var require_src3 = __commonJS((exports) => {
|
|
|
145322
145322
|
}
|
|
145323
145323
|
}
|
|
145324
145324
|
function step(result) {
|
|
145325
|
-
result.done ?
|
|
145325
|
+
result.done ? resolve13(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
145326
145326
|
}
|
|
145327
145327
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
145328
145328
|
});
|
|
@@ -146451,7 +146451,7 @@ var require_depd = __commonJS((exports, module) => {
|
|
|
146451
146451
|
* Copyright(c) 2014-2018 Douglas Christopher Wilson
|
|
146452
146452
|
* MIT Licensed
|
|
146453
146453
|
*/
|
|
146454
|
-
var
|
|
146454
|
+
var relative4 = __require("path").relative;
|
|
146455
146455
|
module.exports = depd;
|
|
146456
146456
|
var basePath = process.cwd();
|
|
146457
146457
|
function containsNamespace(str, namespace) {
|
|
@@ -146647,7 +146647,7 @@ var require_depd = __commonJS((exports, module) => {
|
|
|
146647
146647
|
return formatted;
|
|
146648
146648
|
}
|
|
146649
146649
|
function formatLocation(callSite) {
|
|
146650
|
-
return
|
|
146650
|
+
return relative4(basePath, callSite[0]) + ":" + callSite[1] + ":" + callSite[2];
|
|
146651
146651
|
}
|
|
146652
146652
|
function getStack() {
|
|
146653
146653
|
var limit = Error.stackTraceLimit;
|
|
@@ -150643,7 +150643,7 @@ var require_dbcs_data = __commonJS((exports, module) => {
|
|
|
150643
150643
|
// ../../node_modules/iconv-lite/encodings/index.js
|
|
150644
150644
|
var require_encodings = __commonJS((exports, module) => {
|
|
150645
150645
|
var mergeModules = require_merge_exports();
|
|
150646
|
-
var
|
|
150646
|
+
var modules = [
|
|
150647
150647
|
require_internal(),
|
|
150648
150648
|
require_utf32(),
|
|
150649
150649
|
require_utf16(),
|
|
@@ -150654,8 +150654,8 @@ var require_encodings = __commonJS((exports, module) => {
|
|
|
150654
150654
|
require_dbcs_codec(),
|
|
150655
150655
|
require_dbcs_data()
|
|
150656
150656
|
];
|
|
150657
|
-
for (i5 = 0;i5 <
|
|
150658
|
-
module =
|
|
150657
|
+
for (i5 = 0;i5 < modules.length; i5++) {
|
|
150658
|
+
module = modules[i5];
|
|
150659
150659
|
mergeModules(exports, module);
|
|
150660
150660
|
}
|
|
150661
150661
|
var module;
|
|
@@ -150984,11 +150984,11 @@ var require_raw_body = __commonJS((exports, module) => {
|
|
|
150984
150984
|
if (done) {
|
|
150985
150985
|
return readStream(stream, encoding, length, limit, wrap(done));
|
|
150986
150986
|
}
|
|
150987
|
-
return new Promise(function executor(
|
|
150987
|
+
return new Promise(function executor(resolve13, reject) {
|
|
150988
150988
|
readStream(stream, encoding, length, limit, function onRead2(err, buf) {
|
|
150989
150989
|
if (err)
|
|
150990
150990
|
return reject(err);
|
|
150991
|
-
|
|
150991
|
+
resolve13(buf);
|
|
150992
150992
|
});
|
|
150993
150993
|
});
|
|
150994
150994
|
}
|
|
@@ -160792,7 +160792,7 @@ var require_mime_types = __commonJS((exports) => {
|
|
|
160792
160792
|
* MIT Licensed
|
|
160793
160793
|
*/
|
|
160794
160794
|
var db2 = require_db();
|
|
160795
|
-
var
|
|
160795
|
+
var extname2 = __require("path").extname;
|
|
160796
160796
|
var mimeScore = require_mimeScore();
|
|
160797
160797
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
160798
160798
|
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
@@ -160849,7 +160849,7 @@ var require_mime_types = __commonJS((exports) => {
|
|
|
160849
160849
|
if (!path18 || typeof path18 !== "string") {
|
|
160850
160850
|
return false;
|
|
160851
160851
|
}
|
|
160852
|
-
var extension2 =
|
|
160852
|
+
var extension2 = extname2("x." + path18).toLowerCase().slice(1);
|
|
160853
160853
|
if (!extension2) {
|
|
160854
160854
|
return false;
|
|
160855
160855
|
}
|
|
@@ -164109,16 +164109,16 @@ var require_view = __commonJS((exports, module) => {
|
|
|
164109
164109
|
var debug = require_src4()("express:view");
|
|
164110
164110
|
var path18 = __require("node:path");
|
|
164111
164111
|
var fs28 = __require("node:fs");
|
|
164112
|
-
var
|
|
164112
|
+
var dirname20 = path18.dirname;
|
|
164113
164113
|
var basename7 = path18.basename;
|
|
164114
|
-
var
|
|
164115
|
-
var
|
|
164116
|
-
var
|
|
164114
|
+
var extname2 = path18.extname;
|
|
164115
|
+
var join29 = path18.join;
|
|
164116
|
+
var resolve13 = path18.resolve;
|
|
164117
164117
|
module.exports = View;
|
|
164118
164118
|
function View(name2, options8) {
|
|
164119
164119
|
var opts = options8 || {};
|
|
164120
164120
|
this.defaultEngine = opts.defaultEngine;
|
|
164121
|
-
this.ext =
|
|
164121
|
+
this.ext = extname2(name2);
|
|
164122
164122
|
this.name = name2;
|
|
164123
164123
|
this.root = opts.root;
|
|
164124
164124
|
if (!this.ext && !this.defaultEngine) {
|
|
@@ -164147,8 +164147,8 @@ var require_view = __commonJS((exports, module) => {
|
|
|
164147
164147
|
debug('lookup "%s"', name2);
|
|
164148
164148
|
for (var i5 = 0;i5 < roots.length && !path19; i5++) {
|
|
164149
164149
|
var root2 = roots[i5];
|
|
164150
|
-
var loc =
|
|
164151
|
-
var dir =
|
|
164150
|
+
var loc = resolve13(root2, name2);
|
|
164151
|
+
var dir = dirname20(loc);
|
|
164152
164152
|
var file2 = basename7(loc);
|
|
164153
164153
|
path19 = this.resolve(dir, file2);
|
|
164154
164154
|
}
|
|
@@ -164172,16 +164172,16 @@ var require_view = __commonJS((exports, module) => {
|
|
|
164172
164172
|
});
|
|
164173
164173
|
sync = false;
|
|
164174
164174
|
};
|
|
164175
|
-
View.prototype.resolve = function
|
|
164175
|
+
View.prototype.resolve = function resolve14(dir, file2) {
|
|
164176
164176
|
var ext = this.ext;
|
|
164177
|
-
var path19 =
|
|
164178
|
-
var
|
|
164179
|
-
if (
|
|
164177
|
+
var path19 = join29(dir, file2);
|
|
164178
|
+
var stat3 = tryStat(path19);
|
|
164179
|
+
if (stat3 && stat3.isFile()) {
|
|
164180
164180
|
return path19;
|
|
164181
164181
|
}
|
|
164182
|
-
path19 =
|
|
164183
|
-
|
|
164184
|
-
if (
|
|
164182
|
+
path19 = join29(dir, basename7(file2, ext), "index" + ext);
|
|
164183
|
+
stat3 = tryStat(path19);
|
|
164184
|
+
if (stat3 && stat3.isFile()) {
|
|
164185
164185
|
return path19;
|
|
164186
164186
|
}
|
|
164187
164187
|
};
|
|
@@ -164232,9 +164232,9 @@ var require_etag = __commonJS((exports, module) => {
|
|
|
164232
164232
|
}
|
|
164233
164233
|
return obj && typeof obj === "object" && "ctime" in obj && toString2.call(obj.ctime) === "[object Date]" && "mtime" in obj && toString2.call(obj.mtime) === "[object Date]" && "ino" in obj && typeof obj.ino === "number" && "size" in obj && typeof obj.size === "number";
|
|
164234
164234
|
}
|
|
164235
|
-
function stattag(
|
|
164236
|
-
var mtime =
|
|
164237
|
-
var size =
|
|
164235
|
+
function stattag(stat3) {
|
|
164236
|
+
var mtime = stat3.mtime.getTime().toString(16);
|
|
164237
|
+
var size = stat3.size.toString(16);
|
|
164238
164238
|
return '"' + size + "-" + mtime + '"';
|
|
164239
164239
|
}
|
|
164240
164240
|
});
|
|
@@ -166331,7 +166331,7 @@ var require_application = __commonJS((exports, module) => {
|
|
|
166331
166331
|
var compileETag = require_utils10().compileETag;
|
|
166332
166332
|
var compileQueryParser = require_utils10().compileQueryParser;
|
|
166333
166333
|
var compileTrust = require_utils10().compileTrust;
|
|
166334
|
-
var
|
|
166334
|
+
var resolve13 = __require("node:path").resolve;
|
|
166335
166335
|
var once9 = require_once();
|
|
166336
166336
|
var Router = require_router();
|
|
166337
166337
|
var slice = Array.prototype.slice;
|
|
@@ -166385,7 +166385,7 @@ var require_application = __commonJS((exports, module) => {
|
|
|
166385
166385
|
this.mountpath = "/";
|
|
166386
166386
|
this.locals.settings = this.settings;
|
|
166387
166387
|
this.set("view", View);
|
|
166388
|
-
this.set("views",
|
|
166388
|
+
this.set("views", resolve13("views"));
|
|
166389
166389
|
this.set("jsonp callback name", "callback");
|
|
166390
166390
|
if (env4 === "production") {
|
|
166391
166391
|
this.enable("view cache");
|
|
@@ -167873,11 +167873,11 @@ var require_send = __commonJS((exports, module) => {
|
|
|
167873
167873
|
var statuses = require_statuses();
|
|
167874
167874
|
var Stream2 = __require("stream");
|
|
167875
167875
|
var util2 = __require("util");
|
|
167876
|
-
var
|
|
167877
|
-
var
|
|
167876
|
+
var extname2 = path18.extname;
|
|
167877
|
+
var join29 = path18.join;
|
|
167878
167878
|
var normalize2 = path18.normalize;
|
|
167879
|
-
var
|
|
167880
|
-
var
|
|
167879
|
+
var resolve13 = path18.resolve;
|
|
167880
|
+
var sep = path18.sep;
|
|
167881
167881
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
167882
167882
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1000;
|
|
167883
167883
|
var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
|
|
@@ -167905,7 +167905,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
167905
167905
|
this._maxage = opts.maxAge || opts.maxage;
|
|
167906
167906
|
this._maxage = typeof this._maxage === "string" ? ms9(this._maxage) : Number(this._maxage);
|
|
167907
167907
|
this._maxage = !isNaN(this._maxage) ? Math.min(Math.max(0, this._maxage), MAX_MAXAGE) : 0;
|
|
167908
|
-
this._root = opts.root ?
|
|
167908
|
+
this._root = opts.root ? resolve13(opts.root) : null;
|
|
167909
167909
|
}
|
|
167910
167910
|
util2.inherits(SendStream, Stream2);
|
|
167911
167911
|
SendStream.prototype.error = function error48(status, err) {
|
|
@@ -168038,23 +168038,23 @@ var require_send = __commonJS((exports, module) => {
|
|
|
168038
168038
|
var parts;
|
|
168039
168039
|
if (root2 !== null) {
|
|
168040
168040
|
if (path19) {
|
|
168041
|
-
path19 = normalize2("." +
|
|
168041
|
+
path19 = normalize2("." + sep + path19);
|
|
168042
168042
|
}
|
|
168043
168043
|
if (UP_PATH_REGEXP.test(path19)) {
|
|
168044
168044
|
debug('malicious path "%s"', path19);
|
|
168045
168045
|
this.error(403);
|
|
168046
168046
|
return res;
|
|
168047
168047
|
}
|
|
168048
|
-
parts = path19.split(
|
|
168049
|
-
path19 = normalize2(
|
|
168048
|
+
parts = path19.split(sep);
|
|
168049
|
+
path19 = normalize2(join29(root2, path19));
|
|
168050
168050
|
} else {
|
|
168051
168051
|
if (UP_PATH_REGEXP.test(path19)) {
|
|
168052
168052
|
debug('malicious path "%s"', path19);
|
|
168053
168053
|
this.error(403);
|
|
168054
168054
|
return res;
|
|
168055
168055
|
}
|
|
168056
|
-
parts = normalize2(path19).split(
|
|
168057
|
-
path19 =
|
|
168056
|
+
parts = normalize2(path19).split(sep);
|
|
168057
|
+
path19 = resolve13(path19);
|
|
168058
168058
|
}
|
|
168059
168059
|
if (containsDotFile(parts)) {
|
|
168060
168060
|
debug('%s dotfile "%s"', this._dotfiles, path19);
|
|
@@ -168077,8 +168077,8 @@ var require_send = __commonJS((exports, module) => {
|
|
|
168077
168077
|
this.sendFile(path19);
|
|
168078
168078
|
return res;
|
|
168079
168079
|
};
|
|
168080
|
-
SendStream.prototype.send = function send2(path19,
|
|
168081
|
-
var len =
|
|
168080
|
+
SendStream.prototype.send = function send2(path19, stat3) {
|
|
168081
|
+
var len = stat3.size;
|
|
168082
168082
|
var options8 = this.options;
|
|
168083
168083
|
var opts = {};
|
|
168084
168084
|
var res = this.res;
|
|
@@ -168090,7 +168090,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
168090
168090
|
return;
|
|
168091
168091
|
}
|
|
168092
168092
|
debug('pipe "%s"', path19);
|
|
168093
|
-
this.setHeader(path19,
|
|
168093
|
+
this.setHeader(path19, stat3);
|
|
168094
168094
|
this.type(path19);
|
|
168095
168095
|
if (this.isConditionalGET()) {
|
|
168096
168096
|
if (this.isPreconditionFailure()) {
|
|
@@ -168147,19 +168147,19 @@ var require_send = __commonJS((exports, module) => {
|
|
|
168147
168147
|
var i5 = 0;
|
|
168148
168148
|
var self2 = this;
|
|
168149
168149
|
debug('stat "%s"', path19);
|
|
168150
|
-
fs28.stat(path19, function onstat(err,
|
|
168151
|
-
var pathEndsWithSep = path19[path19.length - 1] ===
|
|
168152
|
-
if (err && err.code === "ENOENT" && !
|
|
168150
|
+
fs28.stat(path19, function onstat(err, stat3) {
|
|
168151
|
+
var pathEndsWithSep = path19[path19.length - 1] === sep;
|
|
168152
|
+
if (err && err.code === "ENOENT" && !extname2(path19) && !pathEndsWithSep) {
|
|
168153
168153
|
return next(err);
|
|
168154
168154
|
}
|
|
168155
168155
|
if (err)
|
|
168156
168156
|
return self2.onStatError(err);
|
|
168157
|
-
if (
|
|
168157
|
+
if (stat3.isDirectory())
|
|
168158
168158
|
return self2.redirect(path19);
|
|
168159
168159
|
if (pathEndsWithSep)
|
|
168160
168160
|
return self2.error(404);
|
|
168161
|
-
self2.emit("file", path19,
|
|
168162
|
-
self2.send(path19,
|
|
168161
|
+
self2.emit("file", path19, stat3);
|
|
168162
|
+
self2.send(path19, stat3);
|
|
168163
168163
|
});
|
|
168164
168164
|
function next(err) {
|
|
168165
168165
|
if (self2._extensions.length <= i5) {
|
|
@@ -168167,13 +168167,13 @@ var require_send = __commonJS((exports, module) => {
|
|
|
168167
168167
|
}
|
|
168168
168168
|
var p4 = path19 + "." + self2._extensions[i5++];
|
|
168169
168169
|
debug('stat "%s"', p4);
|
|
168170
|
-
fs28.stat(p4, function(err2,
|
|
168170
|
+
fs28.stat(p4, function(err2, stat3) {
|
|
168171
168171
|
if (err2)
|
|
168172
168172
|
return next(err2);
|
|
168173
|
-
if (
|
|
168173
|
+
if (stat3.isDirectory())
|
|
168174
168174
|
return next();
|
|
168175
|
-
self2.emit("file", p4,
|
|
168176
|
-
self2.send(p4,
|
|
168175
|
+
self2.emit("file", p4, stat3);
|
|
168176
|
+
self2.send(p4, stat3);
|
|
168177
168177
|
});
|
|
168178
168178
|
}
|
|
168179
168179
|
};
|
|
@@ -168186,15 +168186,15 @@ var require_send = __commonJS((exports, module) => {
|
|
|
168186
168186
|
return self2.onStatError(err);
|
|
168187
168187
|
return self2.error(404);
|
|
168188
168188
|
}
|
|
168189
|
-
var p4 =
|
|
168189
|
+
var p4 = join29(path19, self2._index[i5]);
|
|
168190
168190
|
debug('stat "%s"', p4);
|
|
168191
|
-
fs28.stat(p4, function(err2,
|
|
168191
|
+
fs28.stat(p4, function(err2, stat3) {
|
|
168192
168192
|
if (err2)
|
|
168193
168193
|
return next(err2);
|
|
168194
|
-
if (
|
|
168194
|
+
if (stat3.isDirectory())
|
|
168195
168195
|
return next();
|
|
168196
|
-
self2.emit("file", p4,
|
|
168197
|
-
self2.send(p4,
|
|
168196
|
+
self2.emit("file", p4, stat3);
|
|
168197
|
+
self2.send(p4, stat3);
|
|
168198
168198
|
});
|
|
168199
168199
|
}
|
|
168200
168200
|
next();
|
|
@@ -168221,14 +168221,14 @@ var require_send = __commonJS((exports, module) => {
|
|
|
168221
168221
|
var res = this.res;
|
|
168222
168222
|
if (res.getHeader("Content-Type"))
|
|
168223
168223
|
return;
|
|
168224
|
-
var ext =
|
|
168224
|
+
var ext = extname2(path19);
|
|
168225
168225
|
var type2 = mime.contentType(ext) || "application/octet-stream";
|
|
168226
168226
|
debug("content-type %s", type2);
|
|
168227
168227
|
res.setHeader("Content-Type", type2);
|
|
168228
168228
|
};
|
|
168229
|
-
SendStream.prototype.setHeader = function setHeader(path19,
|
|
168229
|
+
SendStream.prototype.setHeader = function setHeader(path19, stat3) {
|
|
168230
168230
|
var res = this.res;
|
|
168231
|
-
this.emit("headers", res, path19,
|
|
168231
|
+
this.emit("headers", res, path19, stat3);
|
|
168232
168232
|
if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
|
|
168233
168233
|
debug("accept ranges");
|
|
168234
168234
|
res.setHeader("Accept-Ranges", "bytes");
|
|
@@ -168242,12 +168242,12 @@ var require_send = __commonJS((exports, module) => {
|
|
|
168242
168242
|
res.setHeader("Cache-Control", cacheControl);
|
|
168243
168243
|
}
|
|
168244
168244
|
if (this._lastModified && !res.getHeader("Last-Modified")) {
|
|
168245
|
-
var modified =
|
|
168245
|
+
var modified = stat3.mtime.toUTCString();
|
|
168246
168246
|
debug("modified %s", modified);
|
|
168247
168247
|
res.setHeader("Last-Modified", modified);
|
|
168248
168248
|
}
|
|
168249
168249
|
if (this._etag && !res.getHeader("ETag")) {
|
|
168250
|
-
var val = etag(
|
|
168250
|
+
var val = etag(stat3);
|
|
168251
168251
|
debug("etag %s", val);
|
|
168252
168252
|
res.setHeader("ETag", val);
|
|
168253
168253
|
}
|
|
@@ -168381,8 +168381,8 @@ var require_response = __commonJS((exports, module) => {
|
|
|
168381
168381
|
var setCharset = require_utils10().setCharset;
|
|
168382
168382
|
var cookie = require_cookie();
|
|
168383
168383
|
var send = require_send();
|
|
168384
|
-
var
|
|
168385
|
-
var
|
|
168384
|
+
var extname2 = path18.extname;
|
|
168385
|
+
var resolve13 = path18.resolve;
|
|
168386
168386
|
var vary = require_vary();
|
|
168387
168387
|
var { Buffer: Buffer7 } = __require("node:buffer");
|
|
168388
168388
|
var res = Object.create(http.ServerResponse.prototype);
|
|
@@ -168591,7 +168591,7 @@ var require_response = __commonJS((exports, module) => {
|
|
|
168591
168591
|
}
|
|
168592
168592
|
opts = Object.create(opts);
|
|
168593
168593
|
opts.headers = headers;
|
|
168594
|
-
var fullPath = !opts.root ?
|
|
168594
|
+
var fullPath = !opts.root ? resolve13(path19) : path19;
|
|
168595
168595
|
return this.sendFile(fullPath, opts, done);
|
|
168596
168596
|
};
|
|
168597
168597
|
res.contentType = res.type = function contentType(type) {
|
|
@@ -168622,7 +168622,7 @@ var require_response = __commonJS((exports, module) => {
|
|
|
168622
168622
|
};
|
|
168623
168623
|
res.attachment = function attachment(filename) {
|
|
168624
168624
|
if (filename) {
|
|
168625
|
-
this.type(
|
|
168625
|
+
this.type(extname2(filename));
|
|
168626
168626
|
}
|
|
168627
168627
|
this.set("Content-Disposition", contentDisposition(filename));
|
|
168628
168628
|
return this;
|
|
@@ -168852,7 +168852,7 @@ var require_serve_static = __commonJS((exports, module) => {
|
|
|
168852
168852
|
var encodeUrl = require_encodeurl();
|
|
168853
168853
|
var escapeHtml = require_escape_html();
|
|
168854
168854
|
var parseUrl = require_parseurl();
|
|
168855
|
-
var
|
|
168855
|
+
var resolve13 = __require("path").resolve;
|
|
168856
168856
|
var send = require_send();
|
|
168857
168857
|
var url3 = __require("url");
|
|
168858
168858
|
module.exports = serveStatic;
|
|
@@ -168871,7 +168871,7 @@ var require_serve_static = __commonJS((exports, module) => {
|
|
|
168871
168871
|
throw new TypeError("option setHeaders must be function");
|
|
168872
168872
|
}
|
|
168873
168873
|
opts.maxage = opts.maxage || opts.maxAge || 0;
|
|
168874
|
-
opts.root =
|
|
168874
|
+
opts.root = resolve13(root2);
|
|
168875
168875
|
var onDirectory = redirect ? createRedirectDirectoryListener() : createNotFoundDirectoryListener();
|
|
168876
168876
|
return function serveStatic2(req, res, next) {
|
|
168877
168877
|
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
@@ -169795,8 +169795,8 @@ var require_follow_redirects = __commonJS((exports, module) => {
|
|
|
169795
169795
|
}
|
|
169796
169796
|
return parsed;
|
|
169797
169797
|
}
|
|
169798
|
-
function resolveUrl(
|
|
169799
|
-
return useNativeURL ? new URL2(
|
|
169798
|
+
function resolveUrl(relative4, base) {
|
|
169799
|
+
return useNativeURL ? new URL2(relative4, base) : parseUrl(url3.resolve(base, relative4));
|
|
169800
169800
|
}
|
|
169801
169801
|
function validateUrl(input) {
|
|
169802
169802
|
if (/^\[/.test(input.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input.hostname)) {
|
|
@@ -172245,8 +172245,8 @@ var require_executor = __commonJS((exports, module) => {
|
|
|
172245
172245
|
}
|
|
172246
172246
|
resetBuffer() {
|
|
172247
172247
|
this.buffer = new Waterfall;
|
|
172248
|
-
this.buffer.chain(new Promise((
|
|
172249
|
-
this._triggerBuffer =
|
|
172248
|
+
this.buffer.chain(new Promise((resolve13) => {
|
|
172249
|
+
this._triggerBuffer = resolve13;
|
|
172250
172250
|
}));
|
|
172251
172251
|
if (this.ready)
|
|
172252
172252
|
this._triggerBuffer();
|
|
@@ -173266,7 +173266,7 @@ var require_storage = __commonJS((exports, module) => {
|
|
|
173266
173266
|
throw e8;
|
|
173267
173267
|
}
|
|
173268
173268
|
};
|
|
173269
|
-
var writeFileLinesAsync = (filename, lines, mode = DEFAULT_FILE_MODE) => new Promise((
|
|
173269
|
+
var writeFileLinesAsync = (filename, lines, mode = DEFAULT_FILE_MODE) => new Promise((resolve13, reject) => {
|
|
173270
173270
|
try {
|
|
173271
173271
|
const stream = writeFileStream(filename, { mode });
|
|
173272
173272
|
const readable2 = Readable6.from(lines);
|
|
@@ -173283,7 +173283,7 @@ var require_storage = __commonJS((exports, module) => {
|
|
|
173283
173283
|
if (err)
|
|
173284
173284
|
reject(err);
|
|
173285
173285
|
else
|
|
173286
|
-
|
|
173286
|
+
resolve13();
|
|
173287
173287
|
});
|
|
173288
173288
|
});
|
|
173289
173289
|
readable2.on("error", (err) => {
|
|
@@ -173454,7 +173454,7 @@ var require_persistence = __commonJS((exports, module) => {
|
|
|
173454
173454
|
return { data: tdata, indexes };
|
|
173455
173455
|
}
|
|
173456
173456
|
treatRawStreamAsync(rawStream) {
|
|
173457
|
-
return new Promise((
|
|
173457
|
+
return new Promise((resolve13, reject) => {
|
|
173458
173458
|
const dataById = {};
|
|
173459
173459
|
const indexes = {};
|
|
173460
173460
|
let corruptItems = 0;
|
|
@@ -173497,7 +173497,7 @@ var require_persistence = __commonJS((exports, module) => {
|
|
|
173497
173497
|
}
|
|
173498
173498
|
}
|
|
173499
173499
|
const data = Object.values(dataById);
|
|
173500
|
-
|
|
173500
|
+
resolve13({ data, indexes });
|
|
173501
173501
|
});
|
|
173502
173502
|
lineStream.on("error", function(err) {
|
|
173503
173503
|
reject(err, null);
|
|
@@ -183030,7 +183030,7 @@ var require_mime_types2 = __commonJS((exports) => {
|
|
|
183030
183030
|
* MIT Licensed
|
|
183031
183031
|
*/
|
|
183032
183032
|
var db2 = require_db2();
|
|
183033
|
-
var
|
|
183033
|
+
var extname2 = __require("path").extname;
|
|
183034
183034
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
183035
183035
|
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
183036
183036
|
exports.charset = charset;
|
|
@@ -183085,7 +183085,7 @@ var require_mime_types2 = __commonJS((exports) => {
|
|
|
183085
183085
|
if (!path18 || typeof path18 !== "string") {
|
|
183086
183086
|
return false;
|
|
183087
183087
|
}
|
|
183088
|
-
var extension2 =
|
|
183088
|
+
var extension2 = extname2("x." + path18).toLowerCase().substr(1);
|
|
183089
183089
|
if (!extension2) {
|
|
183090
183090
|
return false;
|
|
183091
183091
|
}
|
|
@@ -193077,7 +193077,7 @@ var require_mime_types3 = __commonJS((exports) => {
|
|
|
193077
193077
|
* MIT Licensed
|
|
193078
193078
|
*/
|
|
193079
193079
|
var db2 = require_db3();
|
|
193080
|
-
var
|
|
193080
|
+
var extname2 = __require("path").extname;
|
|
193081
193081
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
193082
193082
|
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
193083
193083
|
exports.charset = charset;
|
|
@@ -193132,7 +193132,7 @@ var require_mime_types3 = __commonJS((exports) => {
|
|
|
193132
193132
|
if (!path18 || typeof path18 !== "string") {
|
|
193133
193133
|
return false;
|
|
193134
193134
|
}
|
|
193135
|
-
var extension2 =
|
|
193135
|
+
var extension2 = extname2("x." + path18).toLowerCase().substr(1);
|
|
193136
193136
|
if (!extension2) {
|
|
193137
193137
|
return false;
|
|
193138
193138
|
}
|
|
@@ -199108,13 +199108,13 @@ var require_broadcast_operator = __commonJS((exports) => {
|
|
|
199108
199108
|
return true;
|
|
199109
199109
|
}
|
|
199110
199110
|
emitWithAck(ev2, ...args) {
|
|
199111
|
-
return new Promise((
|
|
199111
|
+
return new Promise((resolve13, reject) => {
|
|
199112
199112
|
args.push((err, responses) => {
|
|
199113
199113
|
if (err) {
|
|
199114
199114
|
err.responses = responses;
|
|
199115
199115
|
return reject(err);
|
|
199116
199116
|
} else {
|
|
199117
|
-
return
|
|
199117
|
+
return resolve13(responses);
|
|
199118
199118
|
}
|
|
199119
199119
|
});
|
|
199120
199120
|
this.emit(ev2, ...args);
|
|
@@ -199302,12 +199302,12 @@ var require_socket2 = __commonJS((exports) => {
|
|
|
199302
199302
|
}
|
|
199303
199303
|
emitWithAck(ev2, ...args) {
|
|
199304
199304
|
const withErr = this.flags.timeout !== undefined;
|
|
199305
|
-
return new Promise((
|
|
199305
|
+
return new Promise((resolve13, reject) => {
|
|
199306
199306
|
args.push((arg1, arg2) => {
|
|
199307
199307
|
if (withErr) {
|
|
199308
|
-
return arg1 ? reject(arg1) :
|
|
199308
|
+
return arg1 ? reject(arg1) : resolve13(arg2);
|
|
199309
199309
|
} else {
|
|
199310
|
-
return
|
|
199310
|
+
return resolve13(arg1);
|
|
199311
199311
|
}
|
|
199312
199312
|
});
|
|
199313
199313
|
this.emit(ev2, ...args);
|
|
@@ -199762,13 +199762,13 @@ var require_namespace = __commonJS((exports) => {
|
|
|
199762
199762
|
return true;
|
|
199763
199763
|
}
|
|
199764
199764
|
serverSideEmitWithAck(ev2, ...args) {
|
|
199765
|
-
return new Promise((
|
|
199765
|
+
return new Promise((resolve13, reject) => {
|
|
199766
199766
|
args.push((err, responses) => {
|
|
199767
199767
|
if (err) {
|
|
199768
199768
|
err.responses = responses;
|
|
199769
199769
|
return reject(err);
|
|
199770
199770
|
} else {
|
|
199771
|
-
return
|
|
199771
|
+
return resolve13(responses);
|
|
199772
199772
|
}
|
|
199773
199773
|
});
|
|
199774
199774
|
this.serverSideEmit(ev2, ...args);
|
|
@@ -203303,7 +203303,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
203303
203303
|
return localSockets;
|
|
203304
203304
|
}
|
|
203305
203305
|
const requestId = randomId();
|
|
203306
|
-
return new Promise((
|
|
203306
|
+
return new Promise((resolve13, reject) => {
|
|
203307
203307
|
const timeout3 = setTimeout(() => {
|
|
203308
203308
|
const storedRequest2 = this.requests.get(requestId);
|
|
203309
203309
|
if (storedRequest2) {
|
|
@@ -203313,7 +203313,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
203313
203313
|
}, opts.flags.timeout || DEFAULT_TIMEOUT);
|
|
203314
203314
|
const storedRequest = {
|
|
203315
203315
|
type: MessageType.FETCH_SOCKETS,
|
|
203316
|
-
resolve:
|
|
203316
|
+
resolve: resolve13,
|
|
203317
203317
|
timeout: timeout3,
|
|
203318
203318
|
current: 0,
|
|
203319
203319
|
expected: expectedResponseCount,
|
|
@@ -203523,7 +203523,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
203523
203523
|
return localSockets;
|
|
203524
203524
|
}
|
|
203525
203525
|
const requestId = randomId();
|
|
203526
|
-
return new Promise((
|
|
203526
|
+
return new Promise((resolve13, reject) => {
|
|
203527
203527
|
const timeout3 = setTimeout(() => {
|
|
203528
203528
|
const storedRequest2 = this.customRequests.get(requestId);
|
|
203529
203529
|
if (storedRequest2) {
|
|
@@ -203533,7 +203533,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
203533
203533
|
}, opts.flags.timeout || DEFAULT_TIMEOUT);
|
|
203534
203534
|
const storedRequest = {
|
|
203535
203535
|
type: MessageType.FETCH_SOCKETS,
|
|
203536
|
-
resolve:
|
|
203536
|
+
resolve: resolve13,
|
|
203537
203537
|
timeout: timeout3,
|
|
203538
203538
|
missingUids: new Set([...this.nodesMap.keys()]),
|
|
203539
203539
|
responses: localSockets
|
|
@@ -204262,13 +204262,13 @@ var require_dist4 = __commonJS((exports, module) => {
|
|
|
204262
204262
|
this.engine.close();
|
|
204263
204263
|
(0, uws_1.restoreAdapter)();
|
|
204264
204264
|
if (this.httpServer) {
|
|
204265
|
-
return new Promise((
|
|
204265
|
+
return new Promise((resolve13) => {
|
|
204266
204266
|
this.httpServer.close((err) => {
|
|
204267
204267
|
fn9 && fn9(err);
|
|
204268
204268
|
if (err) {
|
|
204269
204269
|
debug("server was not running");
|
|
204270
204270
|
}
|
|
204271
|
-
|
|
204271
|
+
resolve13();
|
|
204272
204272
|
});
|
|
204273
204273
|
});
|
|
204274
204274
|
} else {
|
|
@@ -213004,7 +213004,7 @@ var require_mime_types4 = __commonJS((exports) => {
|
|
|
213004
213004
|
* MIT Licensed
|
|
213005
213005
|
*/
|
|
213006
213006
|
var db2 = require_db4();
|
|
213007
|
-
var
|
|
213007
|
+
var extname2 = __require("path").extname;
|
|
213008
213008
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
213009
213009
|
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
213010
213010
|
exports.charset = charset;
|
|
@@ -213059,7 +213059,7 @@ var require_mime_types4 = __commonJS((exports) => {
|
|
|
213059
213059
|
if (!path18 || typeof path18 !== "string") {
|
|
213060
213060
|
return false;
|
|
213061
213061
|
}
|
|
213062
|
-
var extension2 =
|
|
213062
|
+
var extension2 = extname2("x." + path18).toLowerCase().substr(1);
|
|
213063
213063
|
if (!extension2) {
|
|
213064
213064
|
return false;
|
|
213065
213065
|
}
|
|
@@ -217391,8 +217391,8 @@ var require_mkdirp = __commonJS((exports, module) => {
|
|
|
217391
217391
|
});
|
|
217392
217392
|
break;
|
|
217393
217393
|
default:
|
|
217394
|
-
xfs.stat(p4, function(er22,
|
|
217395
|
-
if (er22 || !
|
|
217394
|
+
xfs.stat(p4, function(er22, stat3) {
|
|
217395
|
+
if (er22 || !stat3.isDirectory())
|
|
217396
217396
|
cb2(er10, made);
|
|
217397
217397
|
else
|
|
217398
217398
|
cb2(null, made);
|
|
@@ -217423,13 +217423,13 @@ var require_mkdirp = __commonJS((exports, module) => {
|
|
|
217423
217423
|
sync(p4, opts, made);
|
|
217424
217424
|
break;
|
|
217425
217425
|
default:
|
|
217426
|
-
var
|
|
217426
|
+
var stat3;
|
|
217427
217427
|
try {
|
|
217428
|
-
|
|
217428
|
+
stat3 = xfs.statSync(p4);
|
|
217429
217429
|
} catch (err1) {
|
|
217430
217430
|
throw err0;
|
|
217431
217431
|
}
|
|
217432
|
-
if (!
|
|
217432
|
+
if (!stat3.isDirectory())
|
|
217433
217433
|
throw err0;
|
|
217434
217434
|
break;
|
|
217435
217435
|
}
|
|
@@ -217632,7 +217632,7 @@ var require_buffer_list = __commonJS((exports, module) => {
|
|
|
217632
217632
|
}
|
|
217633
217633
|
}, {
|
|
217634
217634
|
key: "join",
|
|
217635
|
-
value: function
|
|
217635
|
+
value: function join31(s5) {
|
|
217636
217636
|
if (this.length === 0)
|
|
217637
217637
|
return "";
|
|
217638
217638
|
var p4 = this.head;
|
|
@@ -218930,14 +218930,14 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
218930
218930
|
};
|
|
218931
218931
|
}
|
|
218932
218932
|
function readAndResolve(iter) {
|
|
218933
|
-
var
|
|
218934
|
-
if (
|
|
218933
|
+
var resolve13 = iter[kLastResolve];
|
|
218934
|
+
if (resolve13 !== null) {
|
|
218935
218935
|
var data = iter[kStream].read();
|
|
218936
218936
|
if (data !== null) {
|
|
218937
218937
|
iter[kLastPromise] = null;
|
|
218938
218938
|
iter[kLastResolve] = null;
|
|
218939
218939
|
iter[kLastReject] = null;
|
|
218940
|
-
|
|
218940
|
+
resolve13(createIterResult(data, false));
|
|
218941
218941
|
}
|
|
218942
218942
|
}
|
|
218943
218943
|
}
|
|
@@ -218945,13 +218945,13 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
218945
218945
|
process.nextTick(readAndResolve, iter);
|
|
218946
218946
|
}
|
|
218947
218947
|
function wrapForNext(lastPromise, iter) {
|
|
218948
|
-
return function(
|
|
218948
|
+
return function(resolve13, reject) {
|
|
218949
218949
|
lastPromise.then(function() {
|
|
218950
218950
|
if (iter[kEnded]) {
|
|
218951
|
-
|
|
218951
|
+
resolve13(createIterResult(undefined, true));
|
|
218952
218952
|
return;
|
|
218953
218953
|
}
|
|
218954
|
-
iter[kHandlePromise](
|
|
218954
|
+
iter[kHandlePromise](resolve13, reject);
|
|
218955
218955
|
}, reject);
|
|
218956
218956
|
};
|
|
218957
218957
|
}
|
|
@@ -218970,12 +218970,12 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
218970
218970
|
return Promise.resolve(createIterResult(undefined, true));
|
|
218971
218971
|
}
|
|
218972
218972
|
if (this[kStream].destroyed) {
|
|
218973
|
-
return new Promise(function(
|
|
218973
|
+
return new Promise(function(resolve13, reject) {
|
|
218974
218974
|
process.nextTick(function() {
|
|
218975
218975
|
if (_this[kError]) {
|
|
218976
218976
|
reject(_this[kError]);
|
|
218977
218977
|
} else {
|
|
218978
|
-
|
|
218978
|
+
resolve13(createIterResult(undefined, true));
|
|
218979
218979
|
}
|
|
218980
218980
|
});
|
|
218981
218981
|
});
|
|
@@ -218998,13 +218998,13 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
218998
218998
|
return this;
|
|
218999
218999
|
}), _defineProperty(_Object$setPrototypeO, "return", function _return() {
|
|
219000
219000
|
var _this2 = this;
|
|
219001
|
-
return new Promise(function(
|
|
219001
|
+
return new Promise(function(resolve13, reject) {
|
|
219002
219002
|
_this2[kStream].destroy(null, function(err) {
|
|
219003
219003
|
if (err) {
|
|
219004
219004
|
reject(err);
|
|
219005
219005
|
return;
|
|
219006
219006
|
}
|
|
219007
|
-
|
|
219007
|
+
resolve13(createIterResult(undefined, true));
|
|
219008
219008
|
});
|
|
219009
219009
|
});
|
|
219010
219010
|
}), _Object$setPrototypeO), AsyncIteratorPrototype);
|
|
@@ -219026,15 +219026,15 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
219026
219026
|
value: stream._readableState.endEmitted,
|
|
219027
219027
|
writable: true
|
|
219028
219028
|
}), _defineProperty(_Object$create, kHandlePromise, {
|
|
219029
|
-
value: function value(
|
|
219029
|
+
value: function value(resolve13, reject) {
|
|
219030
219030
|
var data = iterator[kStream].read();
|
|
219031
219031
|
if (data) {
|
|
219032
219032
|
iterator[kLastPromise] = null;
|
|
219033
219033
|
iterator[kLastResolve] = null;
|
|
219034
219034
|
iterator[kLastReject] = null;
|
|
219035
|
-
|
|
219035
|
+
resolve13(createIterResult(data, false));
|
|
219036
219036
|
} else {
|
|
219037
|
-
iterator[kLastResolve] =
|
|
219037
|
+
iterator[kLastResolve] = resolve13;
|
|
219038
219038
|
iterator[kLastReject] = reject;
|
|
219039
219039
|
}
|
|
219040
219040
|
},
|
|
@@ -219053,12 +219053,12 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
219053
219053
|
iterator[kError] = err;
|
|
219054
219054
|
return;
|
|
219055
219055
|
}
|
|
219056
|
-
var
|
|
219057
|
-
if (
|
|
219056
|
+
var resolve13 = iterator[kLastResolve];
|
|
219057
|
+
if (resolve13 !== null) {
|
|
219058
219058
|
iterator[kLastPromise] = null;
|
|
219059
219059
|
iterator[kLastResolve] = null;
|
|
219060
219060
|
iterator[kLastReject] = null;
|
|
219061
|
-
|
|
219061
|
+
resolve13(createIterResult(undefined, true));
|
|
219062
219062
|
}
|
|
219063
219063
|
iterator[kEnded] = true;
|
|
219064
219064
|
});
|
|
@@ -219070,7 +219070,7 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
219070
219070
|
|
|
219071
219071
|
// ../../node_modules/readable-stream/lib/internal/streams/from.js
|
|
219072
219072
|
var require_from = __commonJS((exports, module) => {
|
|
219073
|
-
function asyncGeneratorStep(gen,
|
|
219073
|
+
function asyncGeneratorStep(gen, resolve13, reject, _next, _throw, key2, arg) {
|
|
219074
219074
|
try {
|
|
219075
219075
|
var info = gen[key2](arg);
|
|
219076
219076
|
var value = info.value;
|
|
@@ -219079,7 +219079,7 @@ var require_from = __commonJS((exports, module) => {
|
|
|
219079
219079
|
return;
|
|
219080
219080
|
}
|
|
219081
219081
|
if (info.done) {
|
|
219082
|
-
|
|
219082
|
+
resolve13(value);
|
|
219083
219083
|
} else {
|
|
219084
219084
|
Promise.resolve(value).then(_next, _throw);
|
|
219085
219085
|
}
|
|
@@ -219087,13 +219087,13 @@ var require_from = __commonJS((exports, module) => {
|
|
|
219087
219087
|
function _asyncToGenerator(fn9) {
|
|
219088
219088
|
return function() {
|
|
219089
219089
|
var self2 = this, args = arguments;
|
|
219090
|
-
return new Promise(function(
|
|
219090
|
+
return new Promise(function(resolve13, reject) {
|
|
219091
219091
|
var gen = fn9.apply(self2, args);
|
|
219092
219092
|
function _next(value) {
|
|
219093
|
-
asyncGeneratorStep(gen,
|
|
219093
|
+
asyncGeneratorStep(gen, resolve13, reject, _next, _throw, "next", value);
|
|
219094
219094
|
}
|
|
219095
219095
|
function _throw(err) {
|
|
219096
|
-
asyncGeneratorStep(gen,
|
|
219096
|
+
asyncGeneratorStep(gen, resolve13, reject, _next, _throw, "throw", err);
|
|
219097
219097
|
}
|
|
219098
219098
|
_next(undefined);
|
|
219099
219099
|
});
|
|
@@ -221220,7 +221220,7 @@ var require_dist5 = __commonJS((exports, module) => {
|
|
|
221220
221220
|
determineAgent: () => determineAgent
|
|
221221
221221
|
});
|
|
221222
221222
|
module.exports = __toCommonJS2(src_exports);
|
|
221223
|
-
var
|
|
221223
|
+
var import_promises25 = __require("node:fs/promises");
|
|
221224
221224
|
var import_node_fs24 = __require("node:fs");
|
|
221225
221225
|
var DEVIN_LOCAL_PATH = "/opt/.devin";
|
|
221226
221226
|
var CURSOR2 = "cursor";
|
|
@@ -221278,7 +221278,7 @@ var require_dist5 = __commonJS((exports, module) => {
|
|
|
221278
221278
|
return { isAgent: true, agent: { name: REPLIT } };
|
|
221279
221279
|
}
|
|
221280
221280
|
try {
|
|
221281
|
-
await (0,
|
|
221281
|
+
await (0, import_promises25.access)(DEVIN_LOCAL_PATH, import_node_fs24.constants.F_OK);
|
|
221282
221282
|
return { isAgent: true, agent: { name: DEVIN } };
|
|
221283
221283
|
} catch (error48) {}
|
|
221284
221284
|
return { isAgent: false, agent: undefined };
|
|
@@ -237840,7 +237840,7 @@ function normalizeBase44Env() {
|
|
|
237840
237840
|
loadProjectEnvFiles();
|
|
237841
237841
|
|
|
237842
237842
|
// src/cli/index.ts
|
|
237843
|
-
import { dirname as
|
|
237843
|
+
import { dirname as dirname25, join as join36 } from "node:path";
|
|
237844
237844
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
237845
237845
|
|
|
237846
237846
|
// ../../node_modules/@clack/core/dist/index.mjs
|
|
@@ -239048,7 +239048,7 @@ var {
|
|
|
239048
239048
|
} = import__.default;
|
|
239049
239049
|
|
|
239050
239050
|
// src/cli/commands/agent-skills/pull.ts
|
|
239051
|
-
import { dirname as
|
|
239051
|
+
import { dirname as dirname10, join as join17 } from "node:path";
|
|
239052
239052
|
// ../../node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
239053
239053
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
239054
239054
|
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
@@ -245663,26 +245663,18 @@ var PublishedUrlResponseSchema = exports_external.object({
|
|
|
245663
245663
|
});
|
|
245664
245664
|
var CreateDeploymentResponseSchema = exports_external.object({
|
|
245665
245665
|
deployment_id: exports_external.string(),
|
|
245666
|
-
asset_uploads: exports_external.
|
|
245667
|
-
exports_external.
|
|
245668
|
-
|
|
245669
|
-
|
|
245670
|
-
|
|
245671
|
-
|
|
245672
|
-
|
|
245673
|
-
|
|
245674
|
-
|
|
245675
|
-
uploads: exports_external.array(exports_external.object({
|
|
245676
|
-
path: exports_external.string(),
|
|
245677
|
-
content_type: exports_external.string(),
|
|
245678
|
-
content_length: exports_external.number(),
|
|
245679
|
-
url: exports_external.string()
|
|
245680
|
-
}))
|
|
245681
|
-
})
|
|
245682
|
-
]).nullable().optional()
|
|
245666
|
+
asset_uploads: exports_external.object({
|
|
245667
|
+
type: exports_external.literal("s3"),
|
|
245668
|
+
uploads: exports_external.array(exports_external.object({
|
|
245669
|
+
path: exports_external.string(),
|
|
245670
|
+
content_type: exports_external.string(),
|
|
245671
|
+
content_length: exports_external.number(),
|
|
245672
|
+
url: exports_external.string()
|
|
245673
|
+
}))
|
|
245674
|
+
}).nullable().optional()
|
|
245683
245675
|
}).transform((data) => ({
|
|
245684
245676
|
deploymentId: data.deployment_id,
|
|
245685
|
-
assetUploads: data.asset_uploads == null ? null :
|
|
245677
|
+
assetUploads: data.asset_uploads == null ? null : {
|
|
245686
245678
|
type: "s3",
|
|
245687
245679
|
uploads: data.asset_uploads.uploads.map((upload) => ({
|
|
245688
245680
|
path: upload.path,
|
|
@@ -245692,9 +245684,6 @@ var CreateDeploymentResponseSchema = exports_external.object({
|
|
|
245692
245684
|
}))
|
|
245693
245685
|
}
|
|
245694
245686
|
}));
|
|
245695
|
-
var AssetUploadResponseSchema = exports_external.looseObject({
|
|
245696
|
-
result: exports_external.looseObject({ jwt: exports_external.string().nullable().optional() }).nullable().optional()
|
|
245697
|
-
});
|
|
245698
245687
|
var FinalizeDeploymentResponseSchema = exports_external.object({
|
|
245699
245688
|
deployment_id: exports_external.string()
|
|
245700
245689
|
}).transform((data) => ({
|
|
@@ -247212,24 +247201,33 @@ var ResourceSourceSchema = exports_external.discriminatedUnion("type", [
|
|
|
247212
247201
|
]);
|
|
247213
247202
|
|
|
247214
247203
|
// src/core/resources/entity/schema.ts
|
|
247215
|
-
var
|
|
247216
|
-
|
|
247217
|
-
|
|
247218
|
-
|
|
247219
|
-
|
|
247220
|
-
|
|
247221
|
-
|
|
247222
|
-
|
|
247223
|
-
|
|
247224
|
-
|
|
247225
|
-
|
|
247204
|
+
var fieldConditionOperators = new Set([
|
|
247205
|
+
"$eq",
|
|
247206
|
+
"$ne",
|
|
247207
|
+
"$in",
|
|
247208
|
+
"$nin",
|
|
247209
|
+
"$gt",
|
|
247210
|
+
"$gte",
|
|
247211
|
+
"$lt",
|
|
247212
|
+
"$lte",
|
|
247213
|
+
"$exists",
|
|
247214
|
+
"$all",
|
|
247215
|
+
"$size",
|
|
247216
|
+
"$elemMatch"
|
|
247226
247217
|
]);
|
|
247227
|
-
var
|
|
247228
|
-
var
|
|
247229
|
-
|
|
247230
|
-
|
|
247231
|
-
|
|
247232
|
-
|
|
247218
|
+
var isScalar = (value) => value === null || ["string", "number", "boolean"].includes(typeof value);
|
|
247219
|
+
var isValidFieldCondition = (value) => {
|
|
247220
|
+
if (isScalar(value)) {
|
|
247221
|
+
return true;
|
|
247222
|
+
}
|
|
247223
|
+
if (typeof value === "object" && !Array.isArray(value)) {
|
|
247224
|
+
return Object.keys(value).every((k2) => fieldConditionOperators.has(k2));
|
|
247225
|
+
}
|
|
247226
|
+
return false;
|
|
247227
|
+
};
|
|
247228
|
+
var supportedOperators = [...fieldConditionOperators].sort().join(", ");
|
|
247229
|
+
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})`);
|
|
247230
|
+
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");
|
|
247233
247231
|
var rlsConditionAllowedKeys = new Set([
|
|
247234
247232
|
"user_condition",
|
|
247235
247233
|
"created_by",
|
|
@@ -247261,18 +247259,13 @@ var RLSConditionSchema = exports_external.looseObject({
|
|
|
247261
247259
|
return exports_external.array(RefineRLSConditionSchema).optional();
|
|
247262
247260
|
}
|
|
247263
247261
|
});
|
|
247264
|
-
var
|
|
247265
|
-
var
|
|
247266
|
-
|
|
247267
|
-
|
|
247268
|
-
|
|
247269
|
-
|
|
247270
|
-
|
|
247271
|
-
}
|
|
247272
|
-
return false;
|
|
247273
|
-
};
|
|
247274
|
-
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)");
|
|
247275
|
-
var RLSRuleSchema = exports_external.union([exports_external.boolean(), RefineRLSConditionSchema]);
|
|
247262
|
+
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})`);
|
|
247263
|
+
var RLSRuleSchema = exports_external.union([
|
|
247264
|
+
exports_external.boolean(),
|
|
247265
|
+
exports_external.null(),
|
|
247266
|
+
exports_external.literal(""),
|
|
247267
|
+
RefineRLSConditionSchema
|
|
247268
|
+
]);
|
|
247276
247269
|
var EntityRLSSchema = exports_external.looseObject({
|
|
247277
247270
|
create: RLSRuleSchema.optional(),
|
|
247278
247271
|
read: RLSRuleSchema.optional(),
|
|
@@ -247288,7 +247281,7 @@ var FieldRLSSchema = exports_external.looseObject({
|
|
|
247288
247281
|
delete: RLSRuleSchema.optional()
|
|
247289
247282
|
});
|
|
247290
247283
|
var PropertyDefinitionSchema = exports_external.looseObject({
|
|
247291
|
-
type: exports_external.string(),
|
|
247284
|
+
type: exports_external.union([exports_external.string(), exports_external.array(exports_external.string())]),
|
|
247292
247285
|
title: exports_external.string().optional(),
|
|
247293
247286
|
description: exports_external.string().optional(),
|
|
247294
247287
|
minLength: exports_external.number().int().min(0).optional(),
|
|
@@ -247312,7 +247305,7 @@ var PropertyDefinitionSchema = exports_external.looseObject({
|
|
|
247312
247305
|
});
|
|
247313
247306
|
var EntitySchema = exports_external.looseObject({
|
|
247314
247307
|
type: exports_external.literal("object").default("object"),
|
|
247315
|
-
name: exports_external.string().min(1).regex(
|
|
247308
|
+
name: exports_external.string().min(1).regex(/^\w+$/, "Entity name must contain only letters, numbers, and underscores"),
|
|
247316
247309
|
title: exports_external.string().optional(),
|
|
247317
247310
|
description: exports_external.string().optional(),
|
|
247318
247311
|
properties: exports_external.record(exports_external.string(), PropertyDefinitionSchema).default({}),
|
|
@@ -247882,10 +247875,15 @@ var functionResource = {
|
|
|
247882
247875
|
// src/core/project/config.ts
|
|
247883
247876
|
class ProjectConfigReader {
|
|
247884
247877
|
pluginSourceByNamespace = new Map;
|
|
247885
|
-
async
|
|
247878
|
+
async readProjectSettings(projectRoot) {
|
|
247886
247879
|
const { root, configPath } = await this.findConfigOrThrow(projectRoot);
|
|
247887
247880
|
const project = await this.readConfigFile(configPath);
|
|
247888
247881
|
this.assertPluginProjectDoesNotLoadPlugins(project, configPath);
|
|
247882
|
+
return { ...project, root, configPath };
|
|
247883
|
+
}
|
|
247884
|
+
async readProjectConfig(projectRoot) {
|
|
247885
|
+
const project = await this.readProjectSettings(projectRoot);
|
|
247886
|
+
const { configPath } = project;
|
|
247889
247887
|
const localResources = await this.readProjectResources(configPath, project);
|
|
247890
247888
|
const pluginResources = await this.readPlugins(project.plugins, configPath);
|
|
247891
247889
|
const entities = mergeProjectAndPluginEntities(localResources.entities, pluginResources.entities, configPath);
|
|
@@ -247895,7 +247893,7 @@ class ProjectConfigReader {
|
|
|
247895
247893
|
];
|
|
247896
247894
|
this.validateFunctionNames(functions, configPath);
|
|
247897
247895
|
return {
|
|
247898
|
-
project
|
|
247896
|
+
project,
|
|
247899
247897
|
entities,
|
|
247900
247898
|
functions,
|
|
247901
247899
|
agents: localResources.agents,
|
|
@@ -248033,6 +248031,10 @@ async function readProjectConfig(projectRoot) {
|
|
|
248033
248031
|
const reader = new ProjectConfigReader;
|
|
248034
248032
|
return await reader.readProjectConfig(projectRoot);
|
|
248035
248033
|
}
|
|
248034
|
+
async function readProjectSettings(projectRoot) {
|
|
248035
|
+
const reader = new ProjectConfigReader;
|
|
248036
|
+
return await reader.readProjectSettings(projectRoot);
|
|
248037
|
+
}
|
|
248036
248038
|
// src/core/project/template.ts
|
|
248037
248039
|
var import_ejs = __toESM(require_ejs(), 1);
|
|
248038
248040
|
var import_front_matter2 = __toESM(require_front_matter(), 1);
|
|
@@ -248270,7 +248272,7 @@ async function createProjectFilesForExistingProject(options) {
|
|
|
248270
248272
|
};
|
|
248271
248273
|
}
|
|
248272
248274
|
// src/core/project/deploy.ts
|
|
248273
|
-
import { resolve as
|
|
248275
|
+
import { resolve as resolve3 } from "node:path";
|
|
248274
248276
|
|
|
248275
248277
|
// src/core/site/api.ts
|
|
248276
248278
|
async function uploadSite(archivePath) {
|
|
@@ -248294,13 +248296,6 @@ async function uploadSite(archivePath) {
|
|
|
248294
248296
|
}
|
|
248295
248297
|
return result.data;
|
|
248296
248298
|
}
|
|
248297
|
-
var MODULE_CONTENT_TYPES = {
|
|
248298
|
-
esm: "application/javascript+module",
|
|
248299
|
-
sourcemap: "application/source-map",
|
|
248300
|
-
wasm: "application/wasm",
|
|
248301
|
-
text: "text/plain",
|
|
248302
|
-
data: "application/octet-stream"
|
|
248303
|
-
};
|
|
248304
248299
|
async function createDeployment(request) {
|
|
248305
248300
|
const appClient = getAppClient();
|
|
248306
248301
|
let response;
|
|
@@ -248318,17 +248313,6 @@ async function createDeployment(request) {
|
|
|
248318
248313
|
}
|
|
248319
248314
|
return result.data;
|
|
248320
248315
|
}
|
|
248321
|
-
async function finalizeDeployment(deploymentId, completionJwt, modules) {
|
|
248322
|
-
const formData = new FormData;
|
|
248323
|
-
formData.append("payload", JSON.stringify({ completion_jwt: completionJwt }));
|
|
248324
|
-
for (const module of modules) {
|
|
248325
|
-
const content = await readFile(module.absolutePath);
|
|
248326
|
-
formData.append(module.name, new File([new Uint8Array(content)], module.name, {
|
|
248327
|
-
type: MODULE_CONTENT_TYPES[module.type]
|
|
248328
|
-
}));
|
|
248329
|
-
}
|
|
248330
|
-
return await postFinalize(deploymentId, formData);
|
|
248331
|
-
}
|
|
248332
248316
|
async function finalizeStaticDeployment(deploymentId, indexHtml) {
|
|
248333
248317
|
const formData = new FormData;
|
|
248334
248318
|
formData.append("index.html", new File([indexHtml], "index.html", { type: "text/html" }));
|
|
@@ -248364,7 +248348,9 @@ async function deploySite(siteOutputDir) {
|
|
|
248364
248348
|
if (!await pathExists(siteOutputDir)) {
|
|
248365
248349
|
throw new InvalidInputError(`Output directory does not exist: ${siteOutputDir}. Make sure to build your project first.`, {
|
|
248366
248350
|
hints: [
|
|
248367
|
-
{
|
|
248351
|
+
{
|
|
248352
|
+
message: "Run 'base44 build' first (it injects your app id; a bare 'npm run build' does not)"
|
|
248353
|
+
}
|
|
248368
248354
|
]
|
|
248369
248355
|
});
|
|
248370
248356
|
}
|
|
@@ -248372,7 +248358,9 @@ async function deploySite(siteOutputDir) {
|
|
|
248372
248358
|
if (filePaths.length === 0) {
|
|
248373
248359
|
throw new ConfigInvalidError(`No files found in output directory: ${siteOutputDir}. Make sure to build your project first.`, siteOutputDir, {
|
|
248374
248360
|
hints: [
|
|
248375
|
-
{
|
|
248361
|
+
{
|
|
248362
|
+
message: "Run 'base44 build' first (it injects your app id; a bare 'npm run build' does not)"
|
|
248363
|
+
}
|
|
248376
248364
|
]
|
|
248377
248365
|
});
|
|
248378
248366
|
}
|
|
@@ -248391,13 +248379,10 @@ async function createArchive(pathToArchive, targetArchivePath) {
|
|
|
248391
248379
|
cwd: pathToArchive
|
|
248392
248380
|
}, ["."]);
|
|
248393
248381
|
}
|
|
248394
|
-
// src/core/site/deploy-app.ts
|
|
248395
|
-
import { resolve as resolve5 } from "node:path";
|
|
248396
|
-
|
|
248397
248382
|
// src/core/site/manifest.ts
|
|
248398
248383
|
import { createHash } from "node:crypto";
|
|
248399
248384
|
import { readFile as readFile2, stat } from "node:fs/promises";
|
|
248400
|
-
import { basename as basename4,
|
|
248385
|
+
import { basename as basename4, join as join15 } from "node:path";
|
|
248401
248386
|
var MAX_ASSET_SIZE_BYTES = 25 * 1024 * 1024;
|
|
248402
248387
|
var MAX_ASSET_COUNT = 1e5;
|
|
248403
248388
|
var ASSETS_IGNORE_FILE = ".assetsignore";
|
|
@@ -248406,39 +248391,6 @@ var ALWAYS_IGNORED = new Set([
|
|
|
248406
248391
|
"wrangler.json",
|
|
248407
248392
|
".dev.vars"
|
|
248408
248393
|
]);
|
|
248409
|
-
var MIME_TYPES = {
|
|
248410
|
-
".html": "text/html",
|
|
248411
|
-
".htm": "text/html",
|
|
248412
|
-
".css": "text/css",
|
|
248413
|
-
".js": "text/javascript",
|
|
248414
|
-
".mjs": "text/javascript",
|
|
248415
|
-
".json": "application/json",
|
|
248416
|
-
".map": "application/json",
|
|
248417
|
-
".txt": "text/plain",
|
|
248418
|
-
".xml": "application/xml",
|
|
248419
|
-
".svg": "image/svg+xml",
|
|
248420
|
-
".png": "image/png",
|
|
248421
|
-
".jpg": "image/jpeg",
|
|
248422
|
-
".jpeg": "image/jpeg",
|
|
248423
|
-
".gif": "image/gif",
|
|
248424
|
-
".webp": "image/webp",
|
|
248425
|
-
".avif": "image/avif",
|
|
248426
|
-
".ico": "image/x-icon",
|
|
248427
|
-
".woff": "font/woff",
|
|
248428
|
-
".woff2": "font/woff2",
|
|
248429
|
-
".ttf": "font/ttf",
|
|
248430
|
-
".otf": "font/otf",
|
|
248431
|
-
".eot": "application/vnd.ms-fontobject",
|
|
248432
|
-
".mp3": "audio/mpeg",
|
|
248433
|
-
".mp4": "video/mp4",
|
|
248434
|
-
".webm": "video/webm",
|
|
248435
|
-
".pdf": "application/pdf",
|
|
248436
|
-
".wasm": "application/wasm",
|
|
248437
|
-
".webmanifest": "application/manifest+json"
|
|
248438
|
-
};
|
|
248439
|
-
function getAssetContentType(filePath) {
|
|
248440
|
-
return MIME_TYPES[extname(filePath).toLowerCase()] ?? "application/octet-stream";
|
|
248441
|
-
}
|
|
248442
248394
|
function hashAsset(appId, content) {
|
|
248443
248395
|
return createHash("sha256").update(Buffer.from(appId, "utf8")).update(content).digest("hex").slice(0, 32);
|
|
248444
248396
|
}
|
|
@@ -248466,111 +248418,14 @@ async function buildAssetManifest(assetsDir, appId) {
|
|
|
248466
248418
|
const hash2 = hashAsset(appId, content);
|
|
248467
248419
|
manifest[`/${relativePath}`] = { hash: hash2, size };
|
|
248468
248420
|
if (!filesByHash.has(hash2)) {
|
|
248469
|
-
filesByHash.set(hash2, {
|
|
248470
|
-
absolutePath,
|
|
248471
|
-
hash: hash2,
|
|
248472
|
-
size,
|
|
248473
|
-
contentType: getAssetContentType(absolutePath)
|
|
248474
|
-
});
|
|
248421
|
+
filesByHash.set(hash2, { absolutePath, hash: hash2, size });
|
|
248475
248422
|
}
|
|
248476
248423
|
}
|
|
248477
248424
|
return { manifest, filesByHash };
|
|
248478
248425
|
}
|
|
248479
|
-
|
|
248480
|
-
|
|
248481
|
-
import {
|
|
248482
|
-
import { relative as relative3, resolve as resolve3, sep } from "node:path";
|
|
248483
|
-
var MAX_TOTAL_MODULE_BYTES = 40 * 1024 * 1024;
|
|
248484
|
-
var MODULE_IGNORE = ["wrangler.json", ".dev.vars"];
|
|
248485
|
-
var RULE_TYPE_TO_MODULE_TYPE = {
|
|
248486
|
-
ESModule: "esm",
|
|
248487
|
-
CompiledWasm: "wasm",
|
|
248488
|
-
Text: "text",
|
|
248489
|
-
Data: "data"
|
|
248490
|
-
};
|
|
248491
|
-
function toPosix(path11) {
|
|
248492
|
-
return path11.split(sep).join("/");
|
|
248493
|
-
}
|
|
248494
|
-
async function collectModules(config9) {
|
|
248495
|
-
const entryPath = resolve3(config9.configDir, config9.main);
|
|
248496
|
-
if (!await pathExists(entryPath)) {
|
|
248497
|
-
throw new InvalidInputError(`Worker entry module does not exist: ${entryPath} (from "main" in ${config9.configPath})`, {
|
|
248498
|
-
hints: [{ message: "Rebuild the project to regenerate the artifact" }]
|
|
248499
|
-
});
|
|
248500
|
-
}
|
|
248501
|
-
const modulesByName = new Map;
|
|
248502
|
-
const entryName = toPosix(relative3(config9.configDir, entryPath));
|
|
248503
|
-
modulesByName.set(entryName, {
|
|
248504
|
-
name: entryName,
|
|
248505
|
-
absolutePath: entryPath,
|
|
248506
|
-
size: 0,
|
|
248507
|
-
type: "esm"
|
|
248508
|
-
});
|
|
248509
|
-
const ignore = [...MODULE_IGNORE];
|
|
248510
|
-
if (config9.assetsDirectory?.startsWith(config9.configDir + sep)) {
|
|
248511
|
-
ignore.push(`${toPosix(relative3(config9.configDir, config9.assetsDirectory))}/**`);
|
|
248512
|
-
}
|
|
248513
|
-
for (const rule of config9.rules) {
|
|
248514
|
-
const type = RULE_TYPE_TO_MODULE_TYPE[rule.type];
|
|
248515
|
-
if (!type) {
|
|
248516
|
-
throw new InvalidInputError(`Unsupported module rule type "${rule.type}" in ${config9.configPath}. Supported: ${Object.keys(RULE_TYPE_TO_MODULE_TYPE).join(", ")}.`);
|
|
248517
|
-
}
|
|
248518
|
-
const matches = await globby(rule.globs, {
|
|
248519
|
-
cwd: config9.configDir,
|
|
248520
|
-
onlyFiles: true,
|
|
248521
|
-
dot: true,
|
|
248522
|
-
ignore
|
|
248523
|
-
});
|
|
248524
|
-
for (const match of matches.sort()) {
|
|
248525
|
-
if (!modulesByName.has(match)) {
|
|
248526
|
-
modulesByName.set(match, {
|
|
248527
|
-
name: match,
|
|
248528
|
-
absolutePath: resolve3(config9.configDir, match),
|
|
248529
|
-
size: 0,
|
|
248530
|
-
type
|
|
248531
|
-
});
|
|
248532
|
-
}
|
|
248533
|
-
}
|
|
248534
|
-
}
|
|
248535
|
-
if (config9.uploadSourceMaps) {
|
|
248536
|
-
const maps = await globby("**/*.map", {
|
|
248537
|
-
cwd: config9.configDir,
|
|
248538
|
-
onlyFiles: true,
|
|
248539
|
-
dot: true,
|
|
248540
|
-
ignore
|
|
248541
|
-
});
|
|
248542
|
-
for (const map2 of maps.sort()) {
|
|
248543
|
-
addSourcemap(modulesByName, config9.configDir, map2);
|
|
248544
|
-
}
|
|
248545
|
-
} else {
|
|
248546
|
-
for (const name2 of [...modulesByName.keys()]) {
|
|
248547
|
-
const mapName = `${name2}.map`;
|
|
248548
|
-
if (await pathExists(resolve3(config9.configDir, mapName))) {
|
|
248549
|
-
addSourcemap(modulesByName, config9.configDir, mapName);
|
|
248550
|
-
}
|
|
248551
|
-
}
|
|
248552
|
-
}
|
|
248553
|
-
const modules = [...modulesByName.values()];
|
|
248554
|
-
let totalBytes = 0;
|
|
248555
|
-
for (const module of modules) {
|
|
248556
|
-
module.size = (await stat2(module.absolutePath)).size;
|
|
248557
|
-
totalBytes += module.size;
|
|
248558
|
-
}
|
|
248559
|
-
if (totalBytes > MAX_TOTAL_MODULE_BYTES) {
|
|
248560
|
-
throw new InvalidInputError(`Worker modules total ${totalBytes} bytes, which exceeds the 40 MB limit for Base44 full-stack deploys.`);
|
|
248561
|
-
}
|
|
248562
|
-
return modules;
|
|
248563
|
-
}
|
|
248564
|
-
function addSourcemap(modulesByName, configDir, name2) {
|
|
248565
|
-
if (modulesByName.has(name2))
|
|
248566
|
-
return;
|
|
248567
|
-
modulesByName.set(name2, {
|
|
248568
|
-
name: name2,
|
|
248569
|
-
absolutePath: resolve3(configDir, name2),
|
|
248570
|
-
size: 0,
|
|
248571
|
-
type: "sourcemap"
|
|
248572
|
-
});
|
|
248573
|
-
}
|
|
248426
|
+
// src/core/site/static-site.ts
|
|
248427
|
+
import { readFile as readFile4 } from "node:fs/promises";
|
|
248428
|
+
import { join as join16 } from "node:path";
|
|
248574
248429
|
|
|
248575
248430
|
// src/core/site/upload.ts
|
|
248576
248431
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
@@ -248606,7 +248461,7 @@ async function pMap(iterable, mapper, {
|
|
|
248606
248461
|
const cleanup = () => {
|
|
248607
248462
|
signal?.removeEventListener("abort", signalListener);
|
|
248608
248463
|
};
|
|
248609
|
-
const
|
|
248464
|
+
const resolve3 = (value) => {
|
|
248610
248465
|
resolve_(value);
|
|
248611
248466
|
cleanup();
|
|
248612
248467
|
};
|
|
@@ -248639,7 +248494,7 @@ async function pMap(iterable, mapper, {
|
|
|
248639
248494
|
}
|
|
248640
248495
|
isResolved = true;
|
|
248641
248496
|
if (skippedIndexesMap.size === 0) {
|
|
248642
|
-
|
|
248497
|
+
resolve3(result);
|
|
248643
248498
|
return;
|
|
248644
248499
|
}
|
|
248645
248500
|
const pureResult = [];
|
|
@@ -248649,7 +248504,7 @@ async function pMap(iterable, mapper, {
|
|
|
248649
248504
|
}
|
|
248650
248505
|
pureResult.push(value);
|
|
248651
248506
|
}
|
|
248652
|
-
|
|
248507
|
+
resolve3(pureResult);
|
|
248653
248508
|
}
|
|
248654
248509
|
return;
|
|
248655
248510
|
}
|
|
@@ -248704,62 +248559,6 @@ var DEFAULT_UPLOAD_CONCURRENCY = 3;
|
|
|
248704
248559
|
var MAX_UPLOAD_CONCURRENCY = 50;
|
|
248705
248560
|
var MAX_UPLOAD_ATTEMPTS = 3;
|
|
248706
248561
|
var RETRY_BASE_DELAY_MS = 500;
|
|
248707
|
-
var UPLOAD_RETRY = {
|
|
248708
|
-
limit: MAX_UPLOAD_ATTEMPTS - 1,
|
|
248709
|
-
delay: (attempt) => RETRY_BASE_DELAY_MS * 2 ** (attempt - 1)
|
|
248710
|
-
};
|
|
248711
|
-
async function uploadAssetBuckets(target, filesByHash, options = {}) {
|
|
248712
|
-
const { concurrency = DEFAULT_UPLOAD_CONCURRENCY, onProgress } = options;
|
|
248713
|
-
const { buckets } = target;
|
|
248714
|
-
const totalFiles = buckets.reduce((sum, bucket) => sum + bucket.length, 0);
|
|
248715
|
-
let uploadedFiles = 0;
|
|
248716
|
-
let completionJwt = null;
|
|
248717
|
-
await pMap(buckets, async (bucket) => {
|
|
248718
|
-
const jwt3 = await uploadAssetBucket(target, bucket, filesByHash);
|
|
248719
|
-
if (jwt3) {
|
|
248720
|
-
completionJwt = jwt3;
|
|
248721
|
-
}
|
|
248722
|
-
uploadedFiles += bucket.length;
|
|
248723
|
-
onProgress?.({ uploadedFiles, totalFiles });
|
|
248724
|
-
}, { concurrency });
|
|
248725
|
-
if (!completionJwt) {
|
|
248726
|
-
throw new ApiError("Asset upload finished but the server did not return a completion token.");
|
|
248727
|
-
}
|
|
248728
|
-
return completionJwt;
|
|
248729
|
-
}
|
|
248730
|
-
async function uploadAssetBucket(target, bucket, filesByHash) {
|
|
248731
|
-
const formData = await buildBucketForm(bucket, filesByHash);
|
|
248732
|
-
let response;
|
|
248733
|
-
try {
|
|
248734
|
-
response = await distribution_default.post(target.url, {
|
|
248735
|
-
searchParams: { base64: "true" },
|
|
248736
|
-
headers: { Authorization: `Bearer ${target.jwt}` },
|
|
248737
|
-
body: formData,
|
|
248738
|
-
timeout: 120000,
|
|
248739
|
-
retry: { ...UPLOAD_RETRY, methods: ["post"] }
|
|
248740
|
-
});
|
|
248741
|
-
} catch (error48) {
|
|
248742
|
-
if (error48 instanceof HTTPError && (error48.response.status === 401 || error48.response.status === 403)) {
|
|
248743
|
-
throw new ApiError("This deploy's upload session has expired — rerun deploy. Already-uploaded assets are skipped on the next attempt.", { statusCode: error48.response.status, cause: error48 });
|
|
248744
|
-
}
|
|
248745
|
-
throw await ApiError.fromHttpError(error48, "uploading assets to Cloudflare");
|
|
248746
|
-
}
|
|
248747
|
-
const parsed = AssetUploadResponseSchema.safeParse(await response.json());
|
|
248748
|
-
const jwt3 = parsed.success ? parsed.data.result?.jwt : null;
|
|
248749
|
-
return jwt3 || null;
|
|
248750
|
-
}
|
|
248751
|
-
async function buildBucketForm(bucket, filesByHash) {
|
|
248752
|
-
const formData = new FormData;
|
|
248753
|
-
for (const hash2 of bucket) {
|
|
248754
|
-
const file2 = filesByHash.get(hash2);
|
|
248755
|
-
if (!file2) {
|
|
248756
|
-
throw new InternalError(`Server requested upload of unknown asset hash: ${hash2}`);
|
|
248757
|
-
}
|
|
248758
|
-
const content = await readFile3(file2.absolutePath);
|
|
248759
|
-
formData.append(hash2, new File([content.toString("base64")], hash2, { type: file2.contentType }));
|
|
248760
|
-
}
|
|
248761
|
-
return formData;
|
|
248762
|
-
}
|
|
248763
248562
|
async function uploadPresignedAssets(uploads, assets, options = {}) {
|
|
248764
248563
|
const { concurrency = DEFAULT_UPLOAD_CONCURRENCY, onProgress } = options;
|
|
248765
248564
|
let uploadedFiles = 0;
|
|
@@ -248781,157 +248580,375 @@ async function uploadPresignedAsset(upload, assets) {
|
|
|
248781
248580
|
body: new Uint8Array(content),
|
|
248782
248581
|
headers: { "Content-Type": upload.contentType },
|
|
248783
248582
|
timeout: 120000,
|
|
248784
|
-
retry:
|
|
248583
|
+
retry: {
|
|
248584
|
+
limit: MAX_UPLOAD_ATTEMPTS - 1,
|
|
248585
|
+
delay: (attempt) => RETRY_BASE_DELAY_MS * 2 ** (attempt - 1)
|
|
248586
|
+
}
|
|
248785
248587
|
});
|
|
248786
248588
|
} catch (error48) {
|
|
248787
248589
|
throw await ApiError.fromHttpError(error48, "uploading static assets");
|
|
248788
248590
|
}
|
|
248789
248591
|
}
|
|
248790
248592
|
|
|
248791
|
-
// src/core/site/
|
|
248792
|
-
|
|
248793
|
-
|
|
248794
|
-
|
|
248795
|
-
|
|
248796
|
-
});
|
|
248797
|
-
|
|
248798
|
-
|
|
248799
|
-
|
|
248800
|
-
|
|
248801
|
-
|
|
248802
|
-
|
|
248803
|
-
|
|
248804
|
-
|
|
248805
|
-
|
|
248806
|
-
|
|
248807
|
-
|
|
248808
|
-
|
|
248809
|
-
|
|
248810
|
-
compatibility_flags: exports_external.array(exports_external.string()).optional(),
|
|
248811
|
-
vars: exports_external.record(exports_external.string(), exports_external.unknown()).optional(),
|
|
248812
|
-
upload_source_maps: exports_external.boolean().optional()
|
|
248813
|
-
});
|
|
248814
|
-
async function detectFullStackArtifact(projectRoot) {
|
|
248815
|
-
const redirectPath = join16(projectRoot, WRANGLER_REDIRECT_PATH);
|
|
248816
|
-
return await pathExists(redirectPath) ? redirectPath : null;
|
|
248817
|
-
}
|
|
248818
|
-
async function resolveWranglerConfig(projectRoot) {
|
|
248819
|
-
const redirectPath = await detectFullStackArtifact(projectRoot);
|
|
248820
|
-
if (!redirectPath) {
|
|
248821
|
-
throw new InvalidInputError("No full-stack build artifact found. Expected a .wrangler/deploy/config.json redirect file.", {
|
|
248822
|
-
hints: [{ message: "Run your framework's build command first" }]
|
|
248593
|
+
// src/core/site/static-site.ts
|
|
248594
|
+
async function deployStaticSite(options) {
|
|
248595
|
+
const { outputDir, gitHash, concurrency, progress } = options;
|
|
248596
|
+
const assets = await buildAssetManifest(outputDir, getAppContext().id);
|
|
248597
|
+
if (!assets.manifest["/index.html"]) {
|
|
248598
|
+
throw new InvalidInputError(`No index.html found in "${outputDir}" — a static site needs one at the output directory root.`);
|
|
248599
|
+
}
|
|
248600
|
+
const created = await createDeployment({
|
|
248601
|
+
git_hash: gitHash,
|
|
248602
|
+
asset_manifest: assets.manifest
|
|
248603
|
+
});
|
|
248604
|
+
progress?.onAssets?.({
|
|
248605
|
+
totalAssets: Object.keys(assets.manifest).length,
|
|
248606
|
+
newAssets: created.assetUploads?.uploads.length ?? 0
|
|
248607
|
+
});
|
|
248608
|
+
if (created.assetUploads) {
|
|
248609
|
+
await uploadPresignedAssets(created.assetUploads.uploads, assets, {
|
|
248610
|
+
concurrency,
|
|
248611
|
+
onProgress: progress?.onAssetUpload
|
|
248823
248612
|
});
|
|
248824
248613
|
}
|
|
248825
|
-
const
|
|
248826
|
-
const
|
|
248827
|
-
|
|
248828
|
-
|
|
248829
|
-
|
|
248614
|
+
const indexHtml = await readFile4(join16(outputDir, "index.html"));
|
|
248615
|
+
const finalized = await finalizeStaticDeployment(created.deploymentId, new Uint8Array(indexHtml));
|
|
248616
|
+
return { deploymentId: finalized.deploymentId };
|
|
248617
|
+
}
|
|
248618
|
+
// src/core/project/deploy.ts
|
|
248619
|
+
function hasResourcesToDeploy(projectData) {
|
|
248620
|
+
const {
|
|
248621
|
+
project,
|
|
248622
|
+
entities,
|
|
248623
|
+
functions,
|
|
248624
|
+
agents,
|
|
248625
|
+
agentSkills,
|
|
248626
|
+
connectors,
|
|
248627
|
+
authConfig
|
|
248628
|
+
} = projectData;
|
|
248629
|
+
const hasSite = Boolean(project.site?.outputDirectory);
|
|
248630
|
+
const hasEntities = entities.length > 0;
|
|
248631
|
+
const hasFunctions = functions.length > 0;
|
|
248632
|
+
const hasAgents = agents.length > 0;
|
|
248633
|
+
const hasAgentSkills = agentSkills.length > 0;
|
|
248634
|
+
const hasConnectors = connectors.length > 0;
|
|
248635
|
+
const hasAuthConfig = authConfig.length > 0;
|
|
248636
|
+
const hasVisibility = Boolean(project.visibility);
|
|
248637
|
+
return hasEntities || hasFunctions || hasAgents || hasAgentSkills || hasConnectors || hasAuthConfig || hasVisibility || hasSite;
|
|
248638
|
+
}
|
|
248639
|
+
async function deployAll(projectData, options) {
|
|
248640
|
+
const {
|
|
248641
|
+
project,
|
|
248642
|
+
entities,
|
|
248643
|
+
functions,
|
|
248644
|
+
agents,
|
|
248645
|
+
agentSkills,
|
|
248646
|
+
connectors,
|
|
248647
|
+
authConfig
|
|
248648
|
+
} = projectData;
|
|
248649
|
+
await setAppVisibility(project.visibility);
|
|
248650
|
+
if (project.visibility) {
|
|
248651
|
+
options?.onVisibilitySet?.(project.visibility);
|
|
248830
248652
|
}
|
|
248831
|
-
|
|
248832
|
-
|
|
248833
|
-
|
|
248653
|
+
await entityResource.push(entities);
|
|
248654
|
+
await deployFunctionsSequentially(functions, {
|
|
248655
|
+
onStart: options?.onFunctionStart,
|
|
248656
|
+
onResult: options?.onFunctionResult
|
|
248657
|
+
});
|
|
248658
|
+
await agentSkillResource.push(agentSkills);
|
|
248659
|
+
await agentResource.push(agents);
|
|
248660
|
+
await authConfigResource.push(authConfig);
|
|
248661
|
+
const skipConnectorSync = connectors.length === 0 && hasWorkspaceApiKeyAuth();
|
|
248662
|
+
const connectorResults = skipConnectorSync ? [] : (await pushConnectors(connectors)).results;
|
|
248663
|
+
if (project.site?.outputDirectory) {
|
|
248664
|
+
const outputDir = resolve3(project.root, project.site.outputDirectory);
|
|
248665
|
+
const { appUrl } = await deploySite(outputDir);
|
|
248666
|
+
return { appUrl, connectorResults };
|
|
248834
248667
|
}
|
|
248835
|
-
|
|
248836
|
-
const assetsDirectory = config9.assets?.directory ? resolve4(configDir, config9.assets.directory) : null;
|
|
248837
|
-
return {
|
|
248838
|
-
configPath,
|
|
248839
|
-
configDir,
|
|
248840
|
-
main: config9.main,
|
|
248841
|
-
assetsDirectory,
|
|
248842
|
-
assetsConfig: config9.assets ? toResolvedAssetsConfig(config9.assets) : null,
|
|
248843
|
-
compatibilityDate: config9.compatibility_date ?? null,
|
|
248844
|
-
compatibilityFlags: config9.compatibility_flags ?? [],
|
|
248845
|
-
vars: config9.vars ?? {},
|
|
248846
|
-
rules: (config9.rules ?? []).map((rule) => ({
|
|
248847
|
-
type: rule.type,
|
|
248848
|
-
globs: rule.globs
|
|
248849
|
-
})),
|
|
248850
|
-
uploadSourceMaps: config9.upload_source_maps ?? false
|
|
248851
|
-
};
|
|
248668
|
+
return { connectorResults };
|
|
248852
248669
|
}
|
|
248853
|
-
|
|
248854
|
-
|
|
248855
|
-
|
|
248856
|
-
if (
|
|
248857
|
-
|
|
248670
|
+
// src/core/clients/base44-client.ts
|
|
248671
|
+
var retriedRequests = new WeakSet;
|
|
248672
|
+
async function captureRequestBody(request, options) {
|
|
248673
|
+
if (request.body == null) {
|
|
248674
|
+
return;
|
|
248858
248675
|
}
|
|
248859
|
-
|
|
248860
|
-
|
|
248861
|
-
|
|
248862
|
-
|
|
248863
|
-
|
|
248676
|
+
try {
|
|
248677
|
+
const cloned = request.clone();
|
|
248678
|
+
const text = await cloned.text();
|
|
248679
|
+
options.context.__requestBody = text;
|
|
248680
|
+
} catch {}
|
|
248681
|
+
}
|
|
248682
|
+
async function handleUnauthorized(request, _options, response) {
|
|
248683
|
+
if (response.status !== 401) {
|
|
248684
|
+
return;
|
|
248864
248685
|
}
|
|
248865
|
-
|
|
248686
|
+
if (hasWorkspaceApiKeyAuth()) {
|
|
248687
|
+
return;
|
|
248688
|
+
}
|
|
248689
|
+
if (retriedRequests.has(request)) {
|
|
248690
|
+
return;
|
|
248691
|
+
}
|
|
248692
|
+
const newAccessToken = await refreshAndSaveTokens();
|
|
248693
|
+
if (!newAccessToken) {
|
|
248694
|
+
return;
|
|
248695
|
+
}
|
|
248696
|
+
retriedRequests.add(request);
|
|
248697
|
+
const requestId = request.headers.get("X-Request-ID");
|
|
248698
|
+
return distribution_default(request.clone(), {
|
|
248699
|
+
headers: {
|
|
248700
|
+
...requestId && { "X-Request-ID": requestId },
|
|
248701
|
+
Authorization: `Bearer ${newAccessToken}`
|
|
248702
|
+
}
|
|
248703
|
+
});
|
|
248866
248704
|
}
|
|
248867
|
-
|
|
248868
|
-
|
|
248869
|
-
|
|
248870
|
-
|
|
248871
|
-
|
|
248872
|
-
|
|
248873
|
-
|
|
248874
|
-
|
|
248705
|
+
var base44Client = distribution_default.create({
|
|
248706
|
+
prefixUrl: getBase44ApiUrl(),
|
|
248707
|
+
headers: {
|
|
248708
|
+
"User-Agent": "Base44 CLI"
|
|
248709
|
+
},
|
|
248710
|
+
hooks: {
|
|
248711
|
+
beforeRequest: [
|
|
248712
|
+
(request) => {
|
|
248713
|
+
request.headers.set("X-Request-ID", randomUUID2());
|
|
248714
|
+
},
|
|
248715
|
+
captureRequestBody,
|
|
248716
|
+
async (request) => {
|
|
248717
|
+
const workspaceApiKey = getWorkspaceApiKeyFromEnv();
|
|
248718
|
+
if (workspaceApiKey && isWorkspaceApiKey(workspaceApiKey)) {
|
|
248719
|
+
request.headers.set("api_key", workspaceApiKey);
|
|
248720
|
+
return;
|
|
248721
|
+
}
|
|
248722
|
+
try {
|
|
248723
|
+
const auth = await readAuth();
|
|
248724
|
+
if (isTokenExpired(auth)) {
|
|
248725
|
+
const newAccessToken = await refreshAndSaveTokens();
|
|
248726
|
+
if (newAccessToken) {
|
|
248727
|
+
request.headers.set("Authorization", `Bearer ${newAccessToken}`);
|
|
248728
|
+
return;
|
|
248729
|
+
}
|
|
248730
|
+
}
|
|
248731
|
+
request.headers.set("Authorization", `Bearer ${auth.accessToken}`);
|
|
248732
|
+
} catch {}
|
|
248733
|
+
}
|
|
248734
|
+
],
|
|
248735
|
+
afterResponse: [handleUnauthorized]
|
|
248736
|
+
}
|
|
248737
|
+
});
|
|
248738
|
+
function getAppClient() {
|
|
248739
|
+
const { id } = getAppContext();
|
|
248740
|
+
return base44Client.extend({
|
|
248741
|
+
prefixUrl: new URL(`/api/apps/${id}/`, getBase44ApiUrl()).href
|
|
248742
|
+
});
|
|
248875
248743
|
}
|
|
248876
|
-
|
|
248877
|
-
|
|
248878
|
-
|
|
248879
|
-
|
|
248880
|
-
|
|
248881
|
-
|
|
248882
|
-
|
|
248744
|
+
function getSandboxClient(appId) {
|
|
248745
|
+
return base44Client.extend({
|
|
248746
|
+
prefixUrl: new URL(`/api/apps/${appId}/sandbox-bridge/`, getBase44ApiUrl()).href
|
|
248747
|
+
});
|
|
248748
|
+
}
|
|
248749
|
+
// src/core/clients/oauth-client.ts
|
|
248750
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
248751
|
+
var oauthClient = distribution_default.create({
|
|
248752
|
+
prefixUrl: getBase44ApiUrl(),
|
|
248753
|
+
headers: {
|
|
248754
|
+
"User-Agent": "Base44 CLI"
|
|
248755
|
+
},
|
|
248756
|
+
hooks: {
|
|
248757
|
+
beforeRequest: [
|
|
248758
|
+
(request) => {
|
|
248759
|
+
request.headers.set("X-Request-ID", randomUUID3());
|
|
248760
|
+
}
|
|
248761
|
+
]
|
|
248883
248762
|
}
|
|
248884
|
-
|
|
248885
|
-
|
|
248763
|
+
});
|
|
248764
|
+
// src/core/auth/api.ts
|
|
248765
|
+
async function generateDeviceCode() {
|
|
248766
|
+
const response = await oauthClient.post("oauth/device/code", {
|
|
248767
|
+
json: {
|
|
248768
|
+
client_id: AUTH_CLIENT_ID,
|
|
248769
|
+
scope: "apps:read apps:write sandbox:write"
|
|
248770
|
+
},
|
|
248771
|
+
throwHttpErrors: false
|
|
248772
|
+
});
|
|
248773
|
+
if (!response.ok) {
|
|
248774
|
+
throw new ApiError(`Failed to generate device code: ${response.status} ${response.statusText}`, { statusCode: response.status });
|
|
248886
248775
|
}
|
|
248887
|
-
const
|
|
248888
|
-
|
|
248889
|
-
|
|
248890
|
-
assets = await buildAssetManifest(config9.assetsDirectory, getAppContext().id);
|
|
248776
|
+
const result = DeviceCodeResponseSchema.safeParse(await response.json());
|
|
248777
|
+
if (!result.success) {
|
|
248778
|
+
throw new SchemaValidationError("Invalid device code response from server", result.error);
|
|
248891
248779
|
}
|
|
248892
|
-
|
|
248893
|
-
|
|
248894
|
-
|
|
248895
|
-
|
|
248896
|
-
|
|
248897
|
-
|
|
248898
|
-
|
|
248780
|
+
return result.data;
|
|
248781
|
+
}
|
|
248782
|
+
async function getTokenFromDeviceCode(deviceCode) {
|
|
248783
|
+
const searchParams = new URLSearchParams;
|
|
248784
|
+
searchParams.set("grant_type", "urn:ietf:params:oauth:grant-type:device_code");
|
|
248785
|
+
searchParams.set("device_code", deviceCode);
|
|
248786
|
+
searchParams.set("client_id", AUTH_CLIENT_ID);
|
|
248787
|
+
const response = await oauthClient.post("oauth/token", {
|
|
248788
|
+
body: searchParams.toString(),
|
|
248789
|
+
headers: {
|
|
248790
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
248899
248791
|
},
|
|
248900
|
-
|
|
248792
|
+
throwHttpErrors: false
|
|
248901
248793
|
});
|
|
248902
|
-
|
|
248903
|
-
|
|
248794
|
+
const json2 = await response.json();
|
|
248795
|
+
if (!response.ok) {
|
|
248796
|
+
const errorResult = OAuthErrorSchema.safeParse(json2);
|
|
248797
|
+
if (!errorResult.success) {
|
|
248798
|
+
throw new SchemaValidationError("Token request failed", errorResult.error);
|
|
248799
|
+
}
|
|
248800
|
+
const { error: error48, error_description } = errorResult.data;
|
|
248801
|
+
if (error48 === "authorization_pending" || error48 === "slow_down") {
|
|
248802
|
+
return null;
|
|
248803
|
+
}
|
|
248804
|
+
throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
|
|
248805
|
+
statusCode: response.status
|
|
248806
|
+
});
|
|
248904
248807
|
}
|
|
248905
|
-
const
|
|
248906
|
-
|
|
248907
|
-
|
|
248908
|
-
|
|
248909
|
-
|
|
248910
|
-
onProgress: progress?.onAssetUpload
|
|
248911
|
-
}) : null;
|
|
248912
|
-
progress?.onWorker?.({ moduleCount: modules.length });
|
|
248913
|
-
const finalized = await finalizeDeployment(created.deploymentId, completionJwt, modules);
|
|
248914
|
-
return { deploymentId: finalized.deploymentId, gitHash };
|
|
248808
|
+
const result = TokenResponseSchema.safeParse(json2);
|
|
248809
|
+
if (!result.success) {
|
|
248810
|
+
throw new SchemaValidationError("Invalid token response from server", result.error);
|
|
248811
|
+
}
|
|
248812
|
+
return result.data;
|
|
248915
248813
|
}
|
|
248916
|
-
function
|
|
248917
|
-
|
|
248918
|
-
|
|
248919
|
-
|
|
248920
|
-
|
|
248814
|
+
async function renewAccessToken(refreshToken) {
|
|
248815
|
+
const searchParams = new URLSearchParams;
|
|
248816
|
+
searchParams.set("grant_type", "refresh_token");
|
|
248817
|
+
searchParams.set("refresh_token", refreshToken);
|
|
248818
|
+
searchParams.set("client_id", AUTH_CLIENT_ID);
|
|
248819
|
+
const response = await oauthClient.post("oauth/token", {
|
|
248820
|
+
body: searchParams.toString(),
|
|
248821
|
+
headers: {
|
|
248822
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
248823
|
+
},
|
|
248824
|
+
throwHttpErrors: false
|
|
248825
|
+
});
|
|
248826
|
+
const json2 = await response.json();
|
|
248827
|
+
if (!response.ok) {
|
|
248828
|
+
const errorResult = OAuthErrorSchema.safeParse(json2);
|
|
248829
|
+
if (!errorResult.success) {
|
|
248830
|
+
throw new ApiError(`Token refresh failed: ${response.statusText}`, {
|
|
248831
|
+
statusCode: response.status
|
|
248832
|
+
});
|
|
248833
|
+
}
|
|
248834
|
+
const { error: error48, error_description } = errorResult.data;
|
|
248835
|
+
throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
|
|
248836
|
+
statusCode: response.status
|
|
248837
|
+
});
|
|
248921
248838
|
}
|
|
248922
|
-
|
|
248923
|
-
if (
|
|
248924
|
-
|
|
248925
|
-
}
|
|
248926
|
-
|
|
248839
|
+
const result = TokenResponseSchema.safeParse(json2);
|
|
248840
|
+
if (!result.success) {
|
|
248841
|
+
throw new SchemaValidationError("Invalid token response from server", result.error);
|
|
248842
|
+
}
|
|
248843
|
+
return result.data;
|
|
248844
|
+
}
|
|
248845
|
+
async function getUserInfo(accessToken) {
|
|
248846
|
+
const response = await oauthClient.get("oauth/userinfo", {
|
|
248847
|
+
headers: { Authorization: `Bearer ${accessToken}` }
|
|
248848
|
+
});
|
|
248849
|
+
if (!response.ok) {
|
|
248850
|
+
throw new ApiError(`Failed to fetch user info: ${response.status}`, {
|
|
248851
|
+
statusCode: response.status
|
|
248852
|
+
});
|
|
248853
|
+
}
|
|
248854
|
+
const result = UserInfoSchema.safeParse(await response.json());
|
|
248855
|
+
if (!result.success) {
|
|
248856
|
+
throw new SchemaValidationError("Invalid UserInfo response from server", result.error);
|
|
248857
|
+
}
|
|
248858
|
+
return result.data;
|
|
248859
|
+
}
|
|
248860
|
+
// src/cli/commands/auth/login-flow.ts
|
|
248861
|
+
async function generateAndDisplayDeviceCode(log, runTask) {
|
|
248862
|
+
const deviceCodeResponse = await runTask("Generating device code...", async () => {
|
|
248863
|
+
return await generateDeviceCode();
|
|
248864
|
+
}, {
|
|
248865
|
+
successMessage: "Device code generated",
|
|
248866
|
+
errorMessage: "Failed to generate device code"
|
|
248867
|
+
});
|
|
248868
|
+
log.info(`Verification code: ${theme.styles.bold(deviceCodeResponse.userCode)}` + `
|
|
248869
|
+
Please confirm this code at: ${deviceCodeResponse.verificationUri}`);
|
|
248870
|
+
return deviceCodeResponse;
|
|
248871
|
+
}
|
|
248872
|
+
async function waitForAuthentication(deviceCode, expiresIn, interval, runTask) {
|
|
248873
|
+
let tokenResponse;
|
|
248874
|
+
try {
|
|
248875
|
+
await runTask("Waiting for authentication...", async () => {
|
|
248876
|
+
await pWaitFor(async () => {
|
|
248877
|
+
const result = await getTokenFromDeviceCode(deviceCode);
|
|
248878
|
+
if (result !== null) {
|
|
248879
|
+
tokenResponse = result;
|
|
248880
|
+
return true;
|
|
248881
|
+
}
|
|
248882
|
+
return false;
|
|
248883
|
+
}, {
|
|
248884
|
+
interval: interval * 1000,
|
|
248885
|
+
timeout: expiresIn * 1000
|
|
248886
|
+
});
|
|
248887
|
+
}, {
|
|
248888
|
+
successMessage: "Authentication completed!",
|
|
248889
|
+
errorMessage: "Authentication failed"
|
|
248890
|
+
});
|
|
248891
|
+
} catch (error48) {
|
|
248892
|
+
if (error48 instanceof Error && error48.message.includes("timed out")) {
|
|
248893
|
+
throw new AuthExpiredError("Authentication timed out. Please try again.");
|
|
248894
|
+
}
|
|
248895
|
+
throw error48;
|
|
248896
|
+
}
|
|
248897
|
+
if (tokenResponse === undefined) {
|
|
248898
|
+
throw new InternalError("Failed to retrieve authentication token.");
|
|
248927
248899
|
}
|
|
248900
|
+
return tokenResponse;
|
|
248901
|
+
}
|
|
248902
|
+
async function saveAuthData(response, userInfo) {
|
|
248903
|
+
const expiresAt = Date.now() + response.expiresIn * 1000;
|
|
248904
|
+
await writeAuth({
|
|
248905
|
+
accessToken: response.accessToken,
|
|
248906
|
+
refreshToken: response.refreshToken,
|
|
248907
|
+
expiresAt,
|
|
248908
|
+
email: userInfo.email,
|
|
248909
|
+
name: userInfo.name
|
|
248910
|
+
});
|
|
248911
|
+
}
|
|
248912
|
+
async function login({
|
|
248913
|
+
log,
|
|
248914
|
+
runTask
|
|
248915
|
+
}) {
|
|
248916
|
+
const deviceCodeResponse = await generateAndDisplayDeviceCode(log, runTask);
|
|
248917
|
+
const token = await waitForAuthentication(deviceCodeResponse.deviceCode, deviceCodeResponse.expiresIn, deviceCodeResponse.interval, runTask);
|
|
248918
|
+
const userInfo = await getUserInfo(token.accessToken);
|
|
248919
|
+
await saveAuthData(token, userInfo);
|
|
248928
248920
|
return {
|
|
248929
|
-
|
|
248930
|
-
not_found_handling: assetsConfig.notFoundHandling,
|
|
248931
|
-
run_worker_first: runWorkerFirst
|
|
248921
|
+
outroMessage: `Successfully logged in as ${theme.styles.bold(userInfo.email)}`
|
|
248932
248922
|
};
|
|
248933
248923
|
}
|
|
248934
248924
|
|
|
248925
|
+
// src/cli/utils/command/middleware.ts
|
|
248926
|
+
async function ensureAuth(ctx) {
|
|
248927
|
+
if (hasWorkspaceApiKeyAuth()) {
|
|
248928
|
+
ctx.errorReporter.setContext({
|
|
248929
|
+
user: { email: "workspace-api-key", name: "Workspace API key" }
|
|
248930
|
+
});
|
|
248931
|
+
return;
|
|
248932
|
+
}
|
|
248933
|
+
await seedAuthFromEnv();
|
|
248934
|
+
const loggedIn = await isLoggedIn();
|
|
248935
|
+
if (!loggedIn) {
|
|
248936
|
+
ctx.log.info("You need to login first to continue.");
|
|
248937
|
+
await login(ctx);
|
|
248938
|
+
}
|
|
248939
|
+
try {
|
|
248940
|
+
const userInfo = await readAuth();
|
|
248941
|
+
ctx.errorReporter.setContext({
|
|
248942
|
+
user: { email: userInfo.email, name: userInfo.name }
|
|
248943
|
+
});
|
|
248944
|
+
} catch {}
|
|
248945
|
+
}
|
|
248946
|
+
async function ensureAppContext(ctx, options = {}) {
|
|
248947
|
+
const appContext = await initAppContext(options);
|
|
248948
|
+
ctx.app = appContext;
|
|
248949
|
+
ctx.errorReporter.setContext({ appId: appContext.id });
|
|
248950
|
+
}
|
|
248951
|
+
|
|
248935
248952
|
// ../../node_modules/is-plain-obj/index.js
|
|
248936
248953
|
function isPlainObject2(value) {
|
|
248937
248954
|
if (typeof value !== "object" || value === null) {
|
|
@@ -249029,13 +249046,13 @@ var getJoinLength = (uint8Arrays) => {
|
|
|
249029
249046
|
var isTemplateString = (templates) => Array.isArray(templates) && Array.isArray(templates.raw);
|
|
249030
249047
|
var parseTemplates = (templates, expressions) => {
|
|
249031
249048
|
let tokens = [];
|
|
249032
|
-
for (const [index,
|
|
249049
|
+
for (const [index, template2] of templates.entries()) {
|
|
249033
249050
|
tokens = parseTemplate({
|
|
249034
249051
|
templates,
|
|
249035
249052
|
expressions,
|
|
249036
249053
|
tokens,
|
|
249037
249054
|
index,
|
|
249038
|
-
template
|
|
249055
|
+
template: template2
|
|
249039
249056
|
});
|
|
249040
249057
|
}
|
|
249041
249058
|
if (tokens.length === 0) {
|
|
@@ -249044,11 +249061,11 @@ var parseTemplates = (templates, expressions) => {
|
|
|
249044
249061
|
const [file2, ...commandArguments] = tokens;
|
|
249045
249062
|
return [file2, commandArguments, {}];
|
|
249046
249063
|
};
|
|
249047
|
-
var parseTemplate = ({ templates, expressions, tokens, index, template }) => {
|
|
249048
|
-
if (
|
|
249064
|
+
var parseTemplate = ({ templates, expressions, tokens, index, template: template2 }) => {
|
|
249065
|
+
if (template2 === undefined) {
|
|
249049
249066
|
throw new TypeError(`Invalid backslash sequence: ${templates.raw[index]}`);
|
|
249050
249067
|
}
|
|
249051
|
-
const { nextTokens, leadingWhitespaces, trailingWhitespaces } = splitByWhitespaces(
|
|
249068
|
+
const { nextTokens, leadingWhitespaces, trailingWhitespaces } = splitByWhitespaces(template2, templates.raw[index]);
|
|
249052
249069
|
const newTokens = concatTokens(tokens, nextTokens, leadingWhitespaces);
|
|
249053
249070
|
if (index === expressions.length) {
|
|
249054
249071
|
return newTokens;
|
|
@@ -249057,18 +249074,18 @@ var parseTemplate = ({ templates, expressions, tokens, index, template }) => {
|
|
|
249057
249074
|
const expressionTokens = Array.isArray(expression) ? expression.map((expression2) => parseExpression(expression2)) : [parseExpression(expression)];
|
|
249058
249075
|
return concatTokens(newTokens, expressionTokens, trailingWhitespaces);
|
|
249059
249076
|
};
|
|
249060
|
-
var splitByWhitespaces = (
|
|
249077
|
+
var splitByWhitespaces = (template2, rawTemplate) => {
|
|
249061
249078
|
if (rawTemplate.length === 0) {
|
|
249062
249079
|
return { nextTokens: [], leadingWhitespaces: false, trailingWhitespaces: false };
|
|
249063
249080
|
}
|
|
249064
249081
|
const nextTokens = [];
|
|
249065
249082
|
let templateStart = 0;
|
|
249066
249083
|
const leadingWhitespaces = DELIMITERS.has(rawTemplate[0]);
|
|
249067
|
-
for (let templateIndex = 0, rawIndex = 0;templateIndex <
|
|
249084
|
+
for (let templateIndex = 0, rawIndex = 0;templateIndex < template2.length; templateIndex += 1, rawIndex += 1) {
|
|
249068
249085
|
const rawCharacter = rawTemplate[rawIndex];
|
|
249069
249086
|
if (DELIMITERS.has(rawCharacter)) {
|
|
249070
249087
|
if (templateStart !== templateIndex) {
|
|
249071
|
-
nextTokens.push(
|
|
249088
|
+
nextTokens.push(template2.slice(templateStart, templateIndex));
|
|
249072
249089
|
}
|
|
249073
249090
|
templateStart = templateIndex + 1;
|
|
249074
249091
|
} else if (rawCharacter === "\\") {
|
|
@@ -249084,9 +249101,9 @@ var splitByWhitespaces = (template, rawTemplate) => {
|
|
|
249084
249101
|
}
|
|
249085
249102
|
}
|
|
249086
249103
|
}
|
|
249087
|
-
const trailingWhitespaces = templateStart ===
|
|
249104
|
+
const trailingWhitespaces = templateStart === template2.length;
|
|
249088
249105
|
if (!trailingWhitespaces) {
|
|
249089
|
-
nextTokens.push(
|
|
249106
|
+
nextTokens.push(template2.slice(templateStart));
|
|
249090
249107
|
}
|
|
249091
249108
|
return { nextTokens, leadingWhitespaces, trailingWhitespaces };
|
|
249092
249109
|
};
|
|
@@ -250480,8 +250497,8 @@ var disconnect = (anyProcess) => {
|
|
|
250480
250497
|
// ../../node_modules/execa/lib/utils/deferred.js
|
|
250481
250498
|
var createDeferred = () => {
|
|
250482
250499
|
const methods = {};
|
|
250483
|
-
const promise2 = new Promise((
|
|
250484
|
-
Object.assign(methods, { resolve:
|
|
250500
|
+
const promise2 = new Promise((resolve4, reject) => {
|
|
250501
|
+
Object.assign(methods, { resolve: resolve4, reject });
|
|
250485
250502
|
});
|
|
250486
250503
|
return Object.assign(promise2, methods);
|
|
250487
250504
|
};
|
|
@@ -254845,11 +254862,11 @@ var addConcurrentStream = (concurrentStreams, stream, waitName) => {
|
|
|
254845
254862
|
const promises = weakMap.get(stream);
|
|
254846
254863
|
const promise2 = createDeferred();
|
|
254847
254864
|
promises.push(promise2);
|
|
254848
|
-
const
|
|
254849
|
-
return { resolve:
|
|
254865
|
+
const resolve4 = promise2.resolve.bind(promise2);
|
|
254866
|
+
return { resolve: resolve4, promises };
|
|
254850
254867
|
};
|
|
254851
|
-
var waitForConcurrentStreams = async ({ resolve:
|
|
254852
|
-
|
|
254868
|
+
var waitForConcurrentStreams = async ({ resolve: resolve4, promises }, subprocess) => {
|
|
254869
|
+
resolve4();
|
|
254853
254870
|
const [isSubprocessExit] = await Promise.race([
|
|
254854
254871
|
Promise.allSettled([true, subprocess]),
|
|
254855
254872
|
Promise.all([false, ...promises])
|
|
@@ -255428,453 +255445,6 @@ var {
|
|
|
255428
255445
|
getCancelSignal: getCancelSignal2
|
|
255429
255446
|
} = getIpcExport();
|
|
255430
255447
|
|
|
255431
|
-
// src/core/utils/git.ts
|
|
255432
|
-
var GIT_HASH_PATTERN = /^[a-fA-F0-9]{7,64}$/;
|
|
255433
|
-
function isGitCommitHash(value) {
|
|
255434
|
-
return GIT_HASH_PATTERN.test(value);
|
|
255435
|
-
}
|
|
255436
|
-
|
|
255437
|
-
// src/core/site/git-hash.ts
|
|
255438
|
-
async function resolveGitHash(projectRoot, explicit) {
|
|
255439
|
-
const hash2 = explicit ?? await gitHead(projectRoot);
|
|
255440
|
-
if (!hash2 || !isGitCommitHash(hash2)) {
|
|
255441
|
-
throw new InvalidInputError(explicit ? `'${explicit}' is not a git commit hash.` : "Deployments are addressed by the commit that produced the build, and no git commit was found.", {
|
|
255442
|
-
hints: [
|
|
255443
|
-
{
|
|
255444
|
-
message: "Run the deploy from a git checkout, or pass the commit explicitly with --git-hash."
|
|
255445
|
-
}
|
|
255446
|
-
]
|
|
255447
|
-
});
|
|
255448
|
-
}
|
|
255449
|
-
return hash2;
|
|
255450
|
-
}
|
|
255451
|
-
async function gitHead(projectRoot) {
|
|
255452
|
-
try {
|
|
255453
|
-
const { stdout } = await execa("git", ["rev-parse", "HEAD"], {
|
|
255454
|
-
cwd: projectRoot
|
|
255455
|
-
});
|
|
255456
|
-
return stdout.trim();
|
|
255457
|
-
} catch {
|
|
255458
|
-
return null;
|
|
255459
|
-
}
|
|
255460
|
-
}
|
|
255461
|
-
|
|
255462
|
-
// src/core/site/static-site.ts
|
|
255463
|
-
import { readFile as readFile4 } from "node:fs/promises";
|
|
255464
|
-
import { join as join17 } from "node:path";
|
|
255465
|
-
var STATIC_DEPLOYMENTS_ENV = "BASE44_STATIC_DEPLOYMENTS";
|
|
255466
|
-
function staticDeploymentsEnabled(env2 = process.env) {
|
|
255467
|
-
const value = env2[STATIC_DEPLOYMENTS_ENV];
|
|
255468
|
-
return value === "1" || value === "true";
|
|
255469
|
-
}
|
|
255470
|
-
async function deployStaticSite(options) {
|
|
255471
|
-
const { outputDir, gitHash, concurrency, progress } = options;
|
|
255472
|
-
const assets = await buildAssetManifest(outputDir, getAppContext().id);
|
|
255473
|
-
if (!assets.manifest["/index.html"]) {
|
|
255474
|
-
throw new InvalidInputError(`No index.html found in "${outputDir}" — a static site needs one at the output directory root.`);
|
|
255475
|
-
}
|
|
255476
|
-
const created = await createDeployment({
|
|
255477
|
-
git_hash: gitHash,
|
|
255478
|
-
asset_manifest: assets.manifest
|
|
255479
|
-
});
|
|
255480
|
-
if (created.assetUploads && created.assetUploads.type !== "s3") {
|
|
255481
|
-
throw new ApiError(`The server answered a static-site deploy with the "${created.assetUploads.type}" upload target.`);
|
|
255482
|
-
}
|
|
255483
|
-
progress?.onAssets?.({
|
|
255484
|
-
totalAssets: Object.keys(assets.manifest).length,
|
|
255485
|
-
newAssets: created.assetUploads?.uploads.length ?? 0
|
|
255486
|
-
});
|
|
255487
|
-
if (created.assetUploads) {
|
|
255488
|
-
await uploadPresignedAssets(created.assetUploads.uploads, assets, {
|
|
255489
|
-
concurrency,
|
|
255490
|
-
onProgress: progress?.onAssetUpload
|
|
255491
|
-
});
|
|
255492
|
-
}
|
|
255493
|
-
const indexHtml = await readFile4(join17(outputDir, "index.html"));
|
|
255494
|
-
const finalized = await finalizeStaticDeployment(created.deploymentId, new Uint8Array(indexHtml));
|
|
255495
|
-
return { deploymentId: finalized.deploymentId, gitHash };
|
|
255496
|
-
}
|
|
255497
|
-
|
|
255498
|
-
// src/core/site/deploy-app.ts
|
|
255499
|
-
async function planAppDeploy(target) {
|
|
255500
|
-
if (await detectFullStackArtifact(target.root)) {
|
|
255501
|
-
return { kind: "full-stack" };
|
|
255502
|
-
}
|
|
255503
|
-
const outputDirectory = target.site?.outputDirectory;
|
|
255504
|
-
if (!outputDirectory) {
|
|
255505
|
-
return { kind: "none" };
|
|
255506
|
-
}
|
|
255507
|
-
const outputDir = resolve5(target.root, outputDirectory);
|
|
255508
|
-
return staticDeploymentsEnabled() ? { kind: "static-deployment", outputDir } : { kind: "static", outputDir };
|
|
255509
|
-
}
|
|
255510
|
-
async function detectAppDeployKind(target) {
|
|
255511
|
-
return (await planAppDeploy(target)).kind;
|
|
255512
|
-
}
|
|
255513
|
-
async function deployAppSite(target, options = {}) {
|
|
255514
|
-
const plan = await planAppDeploy(target);
|
|
255515
|
-
switch (plan.kind) {
|
|
255516
|
-
case "full-stack": {
|
|
255517
|
-
const gitHash = await resolveGitHash(target.root, options.gitHash);
|
|
255518
|
-
const { deploymentId } = await deployFullStack({
|
|
255519
|
-
projectRoot: target.root,
|
|
255520
|
-
gitHash,
|
|
255521
|
-
concurrency: options.concurrency,
|
|
255522
|
-
progress: options.progress
|
|
255523
|
-
});
|
|
255524
|
-
return { kind: "full-stack", deploymentId, gitHash };
|
|
255525
|
-
}
|
|
255526
|
-
case "static-deployment": {
|
|
255527
|
-
const gitHash = await resolveGitHash(target.root, options.gitHash);
|
|
255528
|
-
const { deploymentId } = await deployStaticSite({
|
|
255529
|
-
outputDir: plan.outputDir,
|
|
255530
|
-
gitHash,
|
|
255531
|
-
concurrency: options.concurrency,
|
|
255532
|
-
progress: options.progress
|
|
255533
|
-
});
|
|
255534
|
-
return { kind: "static-deployment", deploymentId, gitHash };
|
|
255535
|
-
}
|
|
255536
|
-
case "static": {
|
|
255537
|
-
const { appUrl } = await deploySite(plan.outputDir);
|
|
255538
|
-
return { kind: "static", appUrl };
|
|
255539
|
-
}
|
|
255540
|
-
case "none":
|
|
255541
|
-
return { kind: "none" };
|
|
255542
|
-
}
|
|
255543
|
-
}
|
|
255544
|
-
// src/core/project/deploy.ts
|
|
255545
|
-
function hasResourcesToDeploy(projectData) {
|
|
255546
|
-
const {
|
|
255547
|
-
project,
|
|
255548
|
-
entities,
|
|
255549
|
-
functions,
|
|
255550
|
-
agents,
|
|
255551
|
-
agentSkills,
|
|
255552
|
-
connectors,
|
|
255553
|
-
authConfig
|
|
255554
|
-
} = projectData;
|
|
255555
|
-
const hasSite = Boolean(project.site?.outputDirectory || project.site?.buildCommand);
|
|
255556
|
-
const hasEntities = entities.length > 0;
|
|
255557
|
-
const hasFunctions = functions.length > 0;
|
|
255558
|
-
const hasAgents = agents.length > 0;
|
|
255559
|
-
const hasAgentSkills = agentSkills.length > 0;
|
|
255560
|
-
const hasConnectors = connectors.length > 0;
|
|
255561
|
-
const hasAuthConfig = authConfig.length > 0;
|
|
255562
|
-
const hasVisibility = Boolean(project.visibility);
|
|
255563
|
-
return hasEntities || hasFunctions || hasAgents || hasAgentSkills || hasConnectors || hasAuthConfig || hasVisibility || hasSite;
|
|
255564
|
-
}
|
|
255565
|
-
async function deployAll(projectData, options) {
|
|
255566
|
-
const {
|
|
255567
|
-
project,
|
|
255568
|
-
entities,
|
|
255569
|
-
functions,
|
|
255570
|
-
agents,
|
|
255571
|
-
agentSkills,
|
|
255572
|
-
connectors,
|
|
255573
|
-
authConfig
|
|
255574
|
-
} = projectData;
|
|
255575
|
-
await setAppVisibility(project.visibility);
|
|
255576
|
-
if (project.visibility) {
|
|
255577
|
-
options?.onVisibilitySet?.(project.visibility);
|
|
255578
|
-
}
|
|
255579
|
-
await entityResource.push(entities);
|
|
255580
|
-
await deployFunctionsSequentially(functions, {
|
|
255581
|
-
onStart: options?.onFunctionStart,
|
|
255582
|
-
onResult: options?.onFunctionResult
|
|
255583
|
-
});
|
|
255584
|
-
await agentSkillResource.push(agentSkills);
|
|
255585
|
-
await agentResource.push(agents);
|
|
255586
|
-
await authConfigResource.push(authConfig);
|
|
255587
|
-
const skipConnectorSync = connectors.length === 0 && hasWorkspaceApiKeyAuth();
|
|
255588
|
-
const connectorResults = skipConnectorSync ? [] : (await pushConnectors(connectors)).results;
|
|
255589
|
-
if ((options?.site ?? true) && project.site?.outputDirectory) {
|
|
255590
|
-
const outputDir = resolve6(project.root, project.site.outputDirectory);
|
|
255591
|
-
const { appUrl } = await deploySite(outputDir);
|
|
255592
|
-
return { appUrl, connectorResults };
|
|
255593
|
-
}
|
|
255594
|
-
return { connectorResults };
|
|
255595
|
-
}
|
|
255596
|
-
// src/core/clients/base44-client.ts
|
|
255597
|
-
var retriedRequests = new WeakSet;
|
|
255598
|
-
async function captureRequestBody(request, options) {
|
|
255599
|
-
if (request.body == null) {
|
|
255600
|
-
return;
|
|
255601
|
-
}
|
|
255602
|
-
try {
|
|
255603
|
-
const cloned = request.clone();
|
|
255604
|
-
const text = await cloned.text();
|
|
255605
|
-
options.context.__requestBody = text;
|
|
255606
|
-
} catch {}
|
|
255607
|
-
}
|
|
255608
|
-
async function handleUnauthorized(request, _options, response) {
|
|
255609
|
-
if (response.status !== 401) {
|
|
255610
|
-
return;
|
|
255611
|
-
}
|
|
255612
|
-
if (hasWorkspaceApiKeyAuth()) {
|
|
255613
|
-
return;
|
|
255614
|
-
}
|
|
255615
|
-
if (retriedRequests.has(request)) {
|
|
255616
|
-
return;
|
|
255617
|
-
}
|
|
255618
|
-
const newAccessToken = await refreshAndSaveTokens();
|
|
255619
|
-
if (!newAccessToken) {
|
|
255620
|
-
return;
|
|
255621
|
-
}
|
|
255622
|
-
retriedRequests.add(request);
|
|
255623
|
-
const requestId = request.headers.get("X-Request-ID");
|
|
255624
|
-
return distribution_default(request.clone(), {
|
|
255625
|
-
headers: {
|
|
255626
|
-
...requestId && { "X-Request-ID": requestId },
|
|
255627
|
-
Authorization: `Bearer ${newAccessToken}`
|
|
255628
|
-
}
|
|
255629
|
-
});
|
|
255630
|
-
}
|
|
255631
|
-
var base44Client = distribution_default.create({
|
|
255632
|
-
prefixUrl: getBase44ApiUrl(),
|
|
255633
|
-
headers: {
|
|
255634
|
-
"User-Agent": "Base44 CLI"
|
|
255635
|
-
},
|
|
255636
|
-
hooks: {
|
|
255637
|
-
beforeRequest: [
|
|
255638
|
-
(request) => {
|
|
255639
|
-
request.headers.set("X-Request-ID", randomUUID2());
|
|
255640
|
-
},
|
|
255641
|
-
captureRequestBody,
|
|
255642
|
-
async (request) => {
|
|
255643
|
-
const workspaceApiKey = getWorkspaceApiKeyFromEnv();
|
|
255644
|
-
if (workspaceApiKey && isWorkspaceApiKey(workspaceApiKey)) {
|
|
255645
|
-
request.headers.set("api_key", workspaceApiKey);
|
|
255646
|
-
return;
|
|
255647
|
-
}
|
|
255648
|
-
try {
|
|
255649
|
-
const auth = await readAuth();
|
|
255650
|
-
if (isTokenExpired(auth)) {
|
|
255651
|
-
const newAccessToken = await refreshAndSaveTokens();
|
|
255652
|
-
if (newAccessToken) {
|
|
255653
|
-
request.headers.set("Authorization", `Bearer ${newAccessToken}`);
|
|
255654
|
-
return;
|
|
255655
|
-
}
|
|
255656
|
-
}
|
|
255657
|
-
request.headers.set("Authorization", `Bearer ${auth.accessToken}`);
|
|
255658
|
-
} catch {}
|
|
255659
|
-
}
|
|
255660
|
-
],
|
|
255661
|
-
afterResponse: [handleUnauthorized]
|
|
255662
|
-
}
|
|
255663
|
-
});
|
|
255664
|
-
function getAppClient() {
|
|
255665
|
-
const { id } = getAppContext();
|
|
255666
|
-
return base44Client.extend({
|
|
255667
|
-
prefixUrl: new URL(`/api/apps/${id}/`, getBase44ApiUrl()).href
|
|
255668
|
-
});
|
|
255669
|
-
}
|
|
255670
|
-
function getSandboxClient(appId) {
|
|
255671
|
-
return base44Client.extend({
|
|
255672
|
-
prefixUrl: new URL(`/api/apps/${appId}/sandbox-bridge/`, getBase44ApiUrl()).href
|
|
255673
|
-
});
|
|
255674
|
-
}
|
|
255675
|
-
// src/core/clients/oauth-client.ts
|
|
255676
|
-
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
255677
|
-
var oauthClient = distribution_default.create({
|
|
255678
|
-
prefixUrl: getBase44ApiUrl(),
|
|
255679
|
-
headers: {
|
|
255680
|
-
"User-Agent": "Base44 CLI"
|
|
255681
|
-
},
|
|
255682
|
-
hooks: {
|
|
255683
|
-
beforeRequest: [
|
|
255684
|
-
(request) => {
|
|
255685
|
-
request.headers.set("X-Request-ID", randomUUID3());
|
|
255686
|
-
}
|
|
255687
|
-
]
|
|
255688
|
-
}
|
|
255689
|
-
});
|
|
255690
|
-
// src/core/auth/api.ts
|
|
255691
|
-
async function generateDeviceCode() {
|
|
255692
|
-
const response = await oauthClient.post("oauth/device/code", {
|
|
255693
|
-
json: {
|
|
255694
|
-
client_id: AUTH_CLIENT_ID,
|
|
255695
|
-
scope: "apps:read apps:write sandbox:write"
|
|
255696
|
-
},
|
|
255697
|
-
throwHttpErrors: false
|
|
255698
|
-
});
|
|
255699
|
-
if (!response.ok) {
|
|
255700
|
-
throw new ApiError(`Failed to generate device code: ${response.status} ${response.statusText}`, { statusCode: response.status });
|
|
255701
|
-
}
|
|
255702
|
-
const result = DeviceCodeResponseSchema.safeParse(await response.json());
|
|
255703
|
-
if (!result.success) {
|
|
255704
|
-
throw new SchemaValidationError("Invalid device code response from server", result.error);
|
|
255705
|
-
}
|
|
255706
|
-
return result.data;
|
|
255707
|
-
}
|
|
255708
|
-
async function getTokenFromDeviceCode(deviceCode) {
|
|
255709
|
-
const searchParams = new URLSearchParams;
|
|
255710
|
-
searchParams.set("grant_type", "urn:ietf:params:oauth:grant-type:device_code");
|
|
255711
|
-
searchParams.set("device_code", deviceCode);
|
|
255712
|
-
searchParams.set("client_id", AUTH_CLIENT_ID);
|
|
255713
|
-
const response = await oauthClient.post("oauth/token", {
|
|
255714
|
-
body: searchParams.toString(),
|
|
255715
|
-
headers: {
|
|
255716
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
255717
|
-
},
|
|
255718
|
-
throwHttpErrors: false
|
|
255719
|
-
});
|
|
255720
|
-
const json2 = await response.json();
|
|
255721
|
-
if (!response.ok) {
|
|
255722
|
-
const errorResult = OAuthErrorSchema.safeParse(json2);
|
|
255723
|
-
if (!errorResult.success) {
|
|
255724
|
-
throw new SchemaValidationError("Token request failed", errorResult.error);
|
|
255725
|
-
}
|
|
255726
|
-
const { error: error48, error_description } = errorResult.data;
|
|
255727
|
-
if (error48 === "authorization_pending" || error48 === "slow_down") {
|
|
255728
|
-
return null;
|
|
255729
|
-
}
|
|
255730
|
-
throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
|
|
255731
|
-
statusCode: response.status
|
|
255732
|
-
});
|
|
255733
|
-
}
|
|
255734
|
-
const result = TokenResponseSchema.safeParse(json2);
|
|
255735
|
-
if (!result.success) {
|
|
255736
|
-
throw new SchemaValidationError("Invalid token response from server", result.error);
|
|
255737
|
-
}
|
|
255738
|
-
return result.data;
|
|
255739
|
-
}
|
|
255740
|
-
async function renewAccessToken(refreshToken) {
|
|
255741
|
-
const searchParams = new URLSearchParams;
|
|
255742
|
-
searchParams.set("grant_type", "refresh_token");
|
|
255743
|
-
searchParams.set("refresh_token", refreshToken);
|
|
255744
|
-
searchParams.set("client_id", AUTH_CLIENT_ID);
|
|
255745
|
-
const response = await oauthClient.post("oauth/token", {
|
|
255746
|
-
body: searchParams.toString(),
|
|
255747
|
-
headers: {
|
|
255748
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
255749
|
-
},
|
|
255750
|
-
throwHttpErrors: false
|
|
255751
|
-
});
|
|
255752
|
-
const json2 = await response.json();
|
|
255753
|
-
if (!response.ok) {
|
|
255754
|
-
const errorResult = OAuthErrorSchema.safeParse(json2);
|
|
255755
|
-
if (!errorResult.success) {
|
|
255756
|
-
throw new ApiError(`Token refresh failed: ${response.statusText}`, {
|
|
255757
|
-
statusCode: response.status
|
|
255758
|
-
});
|
|
255759
|
-
}
|
|
255760
|
-
const { error: error48, error_description } = errorResult.data;
|
|
255761
|
-
throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
|
|
255762
|
-
statusCode: response.status
|
|
255763
|
-
});
|
|
255764
|
-
}
|
|
255765
|
-
const result = TokenResponseSchema.safeParse(json2);
|
|
255766
|
-
if (!result.success) {
|
|
255767
|
-
throw new SchemaValidationError("Invalid token response from server", result.error);
|
|
255768
|
-
}
|
|
255769
|
-
return result.data;
|
|
255770
|
-
}
|
|
255771
|
-
async function getUserInfo(accessToken) {
|
|
255772
|
-
const response = await oauthClient.get("oauth/userinfo", {
|
|
255773
|
-
headers: { Authorization: `Bearer ${accessToken}` }
|
|
255774
|
-
});
|
|
255775
|
-
if (!response.ok) {
|
|
255776
|
-
throw new ApiError(`Failed to fetch user info: ${response.status}`, {
|
|
255777
|
-
statusCode: response.status
|
|
255778
|
-
});
|
|
255779
|
-
}
|
|
255780
|
-
const result = UserInfoSchema.safeParse(await response.json());
|
|
255781
|
-
if (!result.success) {
|
|
255782
|
-
throw new SchemaValidationError("Invalid UserInfo response from server", result.error);
|
|
255783
|
-
}
|
|
255784
|
-
return result.data;
|
|
255785
|
-
}
|
|
255786
|
-
// src/cli/commands/auth/login-flow.ts
|
|
255787
|
-
async function generateAndDisplayDeviceCode(log, runTask) {
|
|
255788
|
-
const deviceCodeResponse = await runTask("Generating device code...", async () => {
|
|
255789
|
-
return await generateDeviceCode();
|
|
255790
|
-
}, {
|
|
255791
|
-
successMessage: "Device code generated",
|
|
255792
|
-
errorMessage: "Failed to generate device code"
|
|
255793
|
-
});
|
|
255794
|
-
log.info(`Verification code: ${theme.styles.bold(deviceCodeResponse.userCode)}` + `
|
|
255795
|
-
Please confirm this code at: ${deviceCodeResponse.verificationUri}`);
|
|
255796
|
-
return deviceCodeResponse;
|
|
255797
|
-
}
|
|
255798
|
-
async function waitForAuthentication(deviceCode, expiresIn, interval, runTask) {
|
|
255799
|
-
let tokenResponse;
|
|
255800
|
-
try {
|
|
255801
|
-
await runTask("Waiting for authentication...", async () => {
|
|
255802
|
-
await pWaitFor(async () => {
|
|
255803
|
-
const result = await getTokenFromDeviceCode(deviceCode);
|
|
255804
|
-
if (result !== null) {
|
|
255805
|
-
tokenResponse = result;
|
|
255806
|
-
return true;
|
|
255807
|
-
}
|
|
255808
|
-
return false;
|
|
255809
|
-
}, {
|
|
255810
|
-
interval: interval * 1000,
|
|
255811
|
-
timeout: expiresIn * 1000
|
|
255812
|
-
});
|
|
255813
|
-
}, {
|
|
255814
|
-
successMessage: "Authentication completed!",
|
|
255815
|
-
errorMessage: "Authentication failed"
|
|
255816
|
-
});
|
|
255817
|
-
} catch (error48) {
|
|
255818
|
-
if (error48 instanceof Error && error48.message.includes("timed out")) {
|
|
255819
|
-
throw new AuthExpiredError("Authentication timed out. Please try again.");
|
|
255820
|
-
}
|
|
255821
|
-
throw error48;
|
|
255822
|
-
}
|
|
255823
|
-
if (tokenResponse === undefined) {
|
|
255824
|
-
throw new InternalError("Failed to retrieve authentication token.");
|
|
255825
|
-
}
|
|
255826
|
-
return tokenResponse;
|
|
255827
|
-
}
|
|
255828
|
-
async function saveAuthData(response, userInfo) {
|
|
255829
|
-
const expiresAt = Date.now() + response.expiresIn * 1000;
|
|
255830
|
-
await writeAuth({
|
|
255831
|
-
accessToken: response.accessToken,
|
|
255832
|
-
refreshToken: response.refreshToken,
|
|
255833
|
-
expiresAt,
|
|
255834
|
-
email: userInfo.email,
|
|
255835
|
-
name: userInfo.name
|
|
255836
|
-
});
|
|
255837
|
-
}
|
|
255838
|
-
async function login({
|
|
255839
|
-
log,
|
|
255840
|
-
runTask
|
|
255841
|
-
}) {
|
|
255842
|
-
const deviceCodeResponse = await generateAndDisplayDeviceCode(log, runTask);
|
|
255843
|
-
const token = await waitForAuthentication(deviceCodeResponse.deviceCode, deviceCodeResponse.expiresIn, deviceCodeResponse.interval, runTask);
|
|
255844
|
-
const userInfo = await getUserInfo(token.accessToken);
|
|
255845
|
-
await saveAuthData(token, userInfo);
|
|
255846
|
-
return {
|
|
255847
|
-
outroMessage: `Successfully logged in as ${theme.styles.bold(userInfo.email)}`
|
|
255848
|
-
};
|
|
255849
|
-
}
|
|
255850
|
-
|
|
255851
|
-
// src/cli/utils/command/middleware.ts
|
|
255852
|
-
async function ensureAuth(ctx) {
|
|
255853
|
-
if (hasWorkspaceApiKeyAuth()) {
|
|
255854
|
-
ctx.errorReporter.setContext({
|
|
255855
|
-
user: { email: "workspace-api-key", name: "Workspace API key" }
|
|
255856
|
-
});
|
|
255857
|
-
return;
|
|
255858
|
-
}
|
|
255859
|
-
await seedAuthFromEnv();
|
|
255860
|
-
const loggedIn = await isLoggedIn();
|
|
255861
|
-
if (!loggedIn) {
|
|
255862
|
-
ctx.log.info("You need to login first to continue.");
|
|
255863
|
-
await login(ctx);
|
|
255864
|
-
}
|
|
255865
|
-
try {
|
|
255866
|
-
const userInfo = await readAuth();
|
|
255867
|
-
ctx.errorReporter.setContext({
|
|
255868
|
-
user: { email: userInfo.email, name: userInfo.name }
|
|
255869
|
-
});
|
|
255870
|
-
} catch {}
|
|
255871
|
-
}
|
|
255872
|
-
async function ensureAppContext(ctx, options = {}) {
|
|
255873
|
-
const appContext = await initAppContext(options);
|
|
255874
|
-
ctx.app = appContext;
|
|
255875
|
-
ctx.errorReporter.setContext({ appId: appContext.id });
|
|
255876
|
-
}
|
|
255877
|
-
|
|
255878
255448
|
// src/cli/utils/version-check.ts
|
|
255879
255449
|
async function checkForUpgrade() {
|
|
255880
255450
|
const testLatestVersion = getTestOverrides()?.latestVersion;
|
|
@@ -256033,6 +255603,14 @@ function writeJsonError(error48) {
|
|
|
256033
255603
|
envelope.hints = error48.hints;
|
|
256034
255604
|
}
|
|
256035
255605
|
}
|
|
255606
|
+
if (error48 instanceof ApiError) {
|
|
255607
|
+
if (error48.statusCode !== undefined) {
|
|
255608
|
+
envelope.statusCode = error48.statusCode;
|
|
255609
|
+
}
|
|
255610
|
+
if (error48.requestId !== undefined) {
|
|
255611
|
+
envelope.requestId = error48.requestId;
|
|
255612
|
+
}
|
|
255613
|
+
}
|
|
256036
255614
|
process.stdout.write(`${JSON.stringify(envelope)}
|
|
256037
255615
|
`);
|
|
256038
255616
|
}
|
|
@@ -256129,6 +255707,18 @@ async function confirmPush({
|
|
|
256129
255707
|
});
|
|
256130
255708
|
return !Ct(proceed) && proceed;
|
|
256131
255709
|
}
|
|
255710
|
+
// src/cli/utils/datetime.ts
|
|
255711
|
+
var import_ms2 = __toESM(require_ms(), 1);
|
|
255712
|
+
var HAS_TIMEZONE_SUFFIX = /Z$|[+-]\d{2}:\d{2}$/;
|
|
255713
|
+
function normalizeDatetime(value) {
|
|
255714
|
+
const duration3 = import_ms2.default(value);
|
|
255715
|
+
if (duration3 !== undefined) {
|
|
255716
|
+
return new Date(Date.now() - duration3).toISOString();
|
|
255717
|
+
}
|
|
255718
|
+
if (HAS_TIMEZONE_SUFFIX.test(value))
|
|
255719
|
+
return value;
|
|
255720
|
+
return `${value}Z`;
|
|
255721
|
+
}
|
|
256132
255722
|
// src/cli/utils/json.ts
|
|
256133
255723
|
function toJsonStdout(result) {
|
|
256134
255724
|
return `${JSON.stringify(result, null, 2)}
|
|
@@ -256267,6 +255857,11 @@ function verifyDenoInstalled(context) {
|
|
|
256267
255857
|
});
|
|
256268
255858
|
}
|
|
256269
255859
|
}
|
|
255860
|
+
// src/core/utils/git.ts
|
|
255861
|
+
var GIT_HASH_PATTERN = /^[a-fA-F0-9]{7,64}$/;
|
|
255862
|
+
function isGitCommitHash(value) {
|
|
255863
|
+
return GIT_HASH_PATTERN.test(value);
|
|
255864
|
+
}
|
|
256270
255865
|
// src/core/workspace/schema.ts
|
|
256271
255866
|
var WorkspaceSchema = exports_external.object({
|
|
256272
255867
|
id: exports_external.string(),
|
|
@@ -256341,7 +255936,7 @@ async function pullAction({
|
|
|
256341
255936
|
runTask: runTask2
|
|
256342
255937
|
}) {
|
|
256343
255938
|
const { project: project2 } = await readProjectConfig();
|
|
256344
|
-
const dir =
|
|
255939
|
+
const dir = join17(dirname10(project2.configPath), project2.agentSkillsDir);
|
|
256345
255940
|
const remote = await runTask2("Fetching agent skills from Base44", () => fetchAgentSkills(), {
|
|
256346
255941
|
successMessage: "Agent skills fetched successfully",
|
|
256347
255942
|
errorMessage: "Failed to fetch agent skills"
|
|
@@ -256397,14 +255992,14 @@ function getAgentSkillsCommand() {
|
|
|
256397
255992
|
}
|
|
256398
255993
|
|
|
256399
255994
|
// src/cli/commands/agents/pull.ts
|
|
256400
|
-
import { dirname as
|
|
255995
|
+
import { dirname as dirname11, join as join18 } from "node:path";
|
|
256401
255996
|
async function pullAgentsAction({
|
|
256402
255997
|
log,
|
|
256403
255998
|
runTask: runTask2
|
|
256404
255999
|
}) {
|
|
256405
256000
|
const { project: project2 } = await readProjectConfig();
|
|
256406
|
-
const configDir =
|
|
256407
|
-
const agentsDir =
|
|
256001
|
+
const configDir = dirname11(project2.configPath);
|
|
256002
|
+
const agentsDir = join18(configDir, project2.agentsDir);
|
|
256408
256003
|
const remoteAgents = await runTask2("Fetching agents from Base44", async () => {
|
|
256409
256004
|
return await fetchAgents();
|
|
256410
256005
|
}, {
|
|
@@ -256474,12 +256069,12 @@ function getAgentsCommand() {
|
|
|
256474
256069
|
}
|
|
256475
256070
|
|
|
256476
256071
|
// src/cli/commands/auth/password-login.ts
|
|
256477
|
-
import { dirname as
|
|
256072
|
+
import { dirname as dirname12, join as join19 } from "node:path";
|
|
256478
256073
|
async function passwordLoginAction({ log, runTask: runTask2 }, action) {
|
|
256479
256074
|
const shouldEnable = action === "enable";
|
|
256480
256075
|
const { project: project2 } = await readProjectConfig();
|
|
256481
|
-
const configDir =
|
|
256482
|
-
const authDir =
|
|
256076
|
+
const configDir = dirname12(project2.configPath);
|
|
256077
|
+
const authDir = join19(configDir, project2.authDir);
|
|
256483
256078
|
const updated = await runTask2("Updating local auth config", async () => {
|
|
256484
256079
|
const current = await readAuthConfig(authDir) ?? DEFAULT_AUTH_CONFIG;
|
|
256485
256080
|
const merged = { ...current, enableUsernamePassword: shouldEnable };
|
|
@@ -256499,14 +256094,14 @@ function getPasswordLoginCommand() {
|
|
|
256499
256094
|
}
|
|
256500
256095
|
|
|
256501
256096
|
// src/cli/commands/auth/pull.ts
|
|
256502
|
-
import { dirname as
|
|
256097
|
+
import { dirname as dirname13, join as join20 } from "node:path";
|
|
256503
256098
|
async function pullAuthAction({
|
|
256504
256099
|
log,
|
|
256505
256100
|
runTask: runTask2
|
|
256506
256101
|
}) {
|
|
256507
256102
|
const { project: project2 } = await readProjectConfig();
|
|
256508
|
-
const configDir =
|
|
256509
|
-
const authDir =
|
|
256103
|
+
const configDir = dirname13(project2.configPath);
|
|
256104
|
+
const authDir = join20(configDir, project2.authDir);
|
|
256510
256105
|
const remoteConfig = await runTask2("Fetching auth config from Base44", async () => {
|
|
256511
256106
|
return await pullAuthConfig();
|
|
256512
256107
|
}, {
|
|
@@ -256570,7 +256165,7 @@ function getAuthPushCommand() {
|
|
|
256570
256165
|
}
|
|
256571
256166
|
|
|
256572
256167
|
// src/cli/commands/auth/social-login.ts
|
|
256573
|
-
import { dirname as
|
|
256168
|
+
import { dirname as dirname14, join as join21, resolve as resolve4 } from "node:path";
|
|
256574
256169
|
var PROVIDER_LABELS = {
|
|
256575
256170
|
google: "Google",
|
|
256576
256171
|
microsoft: "Microsoft",
|
|
@@ -256610,7 +256205,7 @@ async function socialLoginAction({ log, isNonInteractive, runTask: runTask2 }, p
|
|
|
256610
256205
|
let clientSecret;
|
|
256611
256206
|
if (useCustomOAuth && oauth && oauthCli && hasSecretOptions(options)) {
|
|
256612
256207
|
if (options.envFile) {
|
|
256613
|
-
const secrets = await parseEnvFile(
|
|
256208
|
+
const secrets = await parseEnvFile(resolve4(options.envFile));
|
|
256614
256209
|
const value = secrets[oauthCli.envVar];
|
|
256615
256210
|
if (!value) {
|
|
256616
256211
|
throw new InvalidInputError(`Key "${oauthCli.envVar}" not found in ${options.envFile}.`);
|
|
@@ -256640,8 +256235,8 @@ async function socialLoginAction({ log, isNonInteractive, runTask: runTask2 }, p
|
|
|
256640
256235
|
}
|
|
256641
256236
|
}
|
|
256642
256237
|
const { project: project2 } = await readProjectConfig();
|
|
256643
|
-
const configDir =
|
|
256644
|
-
const authDir =
|
|
256238
|
+
const configDir = dirname14(project2.configPath);
|
|
256239
|
+
const authDir = join21(configDir, project2.authDir);
|
|
256645
256240
|
const { config: updated } = await runTask2("Updating local auth config", async () => updateSocialLoginConfig(authDir, provider, shouldEnable, useCustomOAuth && options.clientId ? { clientId: options.clientId } : undefined));
|
|
256646
256241
|
if (clientSecret) {
|
|
256647
256242
|
await runTask2("Saving client secret", async () => pushCustomOAuthSecret(provider, clientSecret));
|
|
@@ -256666,7 +256261,7 @@ function getSocialLoginCommand() {
|
|
|
256666
256261
|
}
|
|
256667
256262
|
|
|
256668
256263
|
// src/cli/commands/auth/sso.ts
|
|
256669
|
-
import { dirname as
|
|
256264
|
+
import { dirname as dirname15, join as join22, resolve as resolve5 } from "node:path";
|
|
256670
256265
|
var SSOConfigFileSchema = exports_external.object({
|
|
256671
256266
|
provider: exports_external.enum(Object.values(KNOWN_SSO_PROVIDERS)),
|
|
256672
256267
|
clientId: exports_external.string(),
|
|
@@ -256682,7 +256277,7 @@ var SSOConfigFileSchema = exports_external.object({
|
|
|
256682
256277
|
ssoName: exports_external.string().optional()
|
|
256683
256278
|
});
|
|
256684
256279
|
async function loadSSOConfigFile(filePath) {
|
|
256685
|
-
const resolved =
|
|
256280
|
+
const resolved = resolve5(filePath);
|
|
256686
256281
|
const raw2 = await readJsonFile(resolved);
|
|
256687
256282
|
const result = SSOConfigFileSchema.safeParse(raw2);
|
|
256688
256283
|
if (!result.success) {
|
|
@@ -256770,7 +256365,7 @@ async function ssoEnableAction({ isNonInteractive, runTask: runTask2 }, options)
|
|
|
256770
256365
|
}
|
|
256771
256366
|
let clientSecret;
|
|
256772
256367
|
if (merged.envFile && !merged.clientSecret) {
|
|
256773
|
-
const secrets2 = await parseEnvFile(
|
|
256368
|
+
const secrets2 = await parseEnvFile(resolve5(merged.envFile));
|
|
256774
256369
|
const value = secrets2.sso_client_secret;
|
|
256775
256370
|
if (!value) {
|
|
256776
256371
|
throw new InvalidInputError(`Key "sso_client_secret" not found in ${merged.envFile}.`);
|
|
@@ -256829,8 +256424,8 @@ async function ssoEnableAction({ isNonInteractive, runTask: runTask2 }, options)
|
|
|
256829
256424
|
throw error48;
|
|
256830
256425
|
}
|
|
256831
256426
|
const { project: project2 } = await readProjectConfig();
|
|
256832
|
-
const configDir =
|
|
256833
|
-
const authDir =
|
|
256427
|
+
const configDir = dirname15(project2.configPath);
|
|
256428
|
+
const authDir = join22(configDir, project2.authDir);
|
|
256834
256429
|
await runTask2("Updating local auth config", async () => updateSSOConfig(authDir, provider, true));
|
|
256835
256430
|
await runTask2("Saving SSO credentials", async () => pushSSOSecrets(secrets));
|
|
256836
256431
|
return {
|
|
@@ -256845,8 +256440,8 @@ async function ssoDisableAction({ log, runTask: runTask2 }, options) {
|
|
|
256845
256440
|
throw new InvalidInputError("Configuration options cannot be used with disable. To disable SSO: base44 auth sso disable");
|
|
256846
256441
|
}
|
|
256847
256442
|
const { project: project2 } = await readProjectConfig();
|
|
256848
|
-
const configDir =
|
|
256849
|
-
const authDir =
|
|
256443
|
+
const configDir = dirname15(project2.configPath);
|
|
256444
|
+
const authDir = join22(configDir, project2.authDir);
|
|
256850
256445
|
const updated = await runTask2("Updating local auth config", async () => updateSSOConfig(authDir, null, false));
|
|
256851
256446
|
await runTask2("Removing SSO credentials", async () => deleteSSOSecrets());
|
|
256852
256447
|
if (!hasAnyLoginMethod(updated)) {
|
|
@@ -257408,19 +257003,19 @@ var baseOpen = async (options) => {
|
|
|
257408
257003
|
}
|
|
257409
257004
|
const subprocess = childProcess3.spawn(command2, cliArguments, childProcessOptions);
|
|
257410
257005
|
if (options.wait) {
|
|
257411
|
-
return new Promise((
|
|
257006
|
+
return new Promise((resolve6, reject) => {
|
|
257412
257007
|
subprocess.once("error", reject);
|
|
257413
257008
|
subprocess.once("close", (exitCode) => {
|
|
257414
257009
|
if (!options.allowNonzeroExitCode && exitCode !== 0) {
|
|
257415
257010
|
reject(new Error(`Exited with code ${exitCode}`));
|
|
257416
257011
|
return;
|
|
257417
257012
|
}
|
|
257418
|
-
|
|
257013
|
+
resolve6(subprocess);
|
|
257419
257014
|
});
|
|
257420
257015
|
});
|
|
257421
257016
|
}
|
|
257422
257017
|
if (isFallbackAttempt) {
|
|
257423
|
-
return new Promise((
|
|
257018
|
+
return new Promise((resolve6, reject) => {
|
|
257424
257019
|
subprocess.once("error", reject);
|
|
257425
257020
|
subprocess.once("spawn", () => {
|
|
257426
257021
|
subprocess.once("close", (exitCode) => {
|
|
@@ -257430,17 +257025,17 @@ var baseOpen = async (options) => {
|
|
|
257430
257025
|
return;
|
|
257431
257026
|
}
|
|
257432
257027
|
subprocess.unref();
|
|
257433
|
-
|
|
257028
|
+
resolve6(subprocess);
|
|
257434
257029
|
});
|
|
257435
257030
|
});
|
|
257436
257031
|
});
|
|
257437
257032
|
}
|
|
257438
257033
|
subprocess.unref();
|
|
257439
|
-
return new Promise((
|
|
257034
|
+
return new Promise((resolve6, reject) => {
|
|
257440
257035
|
subprocess.once("error", reject);
|
|
257441
257036
|
subprocess.once("spawn", () => {
|
|
257442
257037
|
subprocess.off("error", reject);
|
|
257443
|
-
|
|
257038
|
+
resolve6(subprocess);
|
|
257444
257039
|
});
|
|
257445
257040
|
});
|
|
257446
257041
|
};
|
|
@@ -257703,13 +257298,13 @@ function getConnectorsListAvailableCommand() {
|
|
|
257703
257298
|
}
|
|
257704
257299
|
|
|
257705
257300
|
// src/cli/commands/connectors/pull.ts
|
|
257706
|
-
import { dirname as
|
|
257301
|
+
import { dirname as dirname16, join as join23, resolve as resolve6 } from "node:path";
|
|
257707
257302
|
async function resolveConnectorsDir(options) {
|
|
257708
257303
|
if (!getAppContext().projectRoot) {
|
|
257709
|
-
return
|
|
257304
|
+
return resolve6(options.dir ?? "connectors");
|
|
257710
257305
|
}
|
|
257711
257306
|
const { project: project2 } = await readProjectConfig();
|
|
257712
|
-
return
|
|
257307
|
+
return join23(dirname16(project2.configPath), project2.connectorsDir);
|
|
257713
257308
|
}
|
|
257714
257309
|
async function pullConnectorsAction({ log, runTask: runTask2, jsonMode }, options) {
|
|
257715
257310
|
const connectorsDir = await resolveConnectorsDir(options);
|
|
@@ -257750,10 +257345,10 @@ function getConnectorsPullCommand() {
|
|
|
257750
257345
|
}
|
|
257751
257346
|
|
|
257752
257347
|
// src/cli/commands/connectors/push.ts
|
|
257753
|
-
import { resolve as
|
|
257348
|
+
import { resolve as resolve7 } from "node:path";
|
|
257754
257349
|
async function readConnectorsToPush(options) {
|
|
257755
257350
|
if (!getAppContext().projectRoot) {
|
|
257756
|
-
return readAllConnectors(
|
|
257351
|
+
return readAllConnectors(resolve7(options.dir ?? "connectors"));
|
|
257757
257352
|
}
|
|
257758
257353
|
const { connectors } = await readProjectConfig();
|
|
257759
257354
|
return connectors;
|
|
@@ -257981,8 +257576,8 @@ function getDeleteCommand() {
|
|
|
257981
257576
|
}
|
|
257982
257577
|
|
|
257983
257578
|
// src/cli/commands/functions/formatDeployResult.ts
|
|
257984
|
-
function formatDuration(
|
|
257985
|
-
return `${(
|
|
257579
|
+
function formatDuration(ms2) {
|
|
257580
|
+
return `${(ms2 / 1000).toFixed(1)}s`;
|
|
257986
257581
|
}
|
|
257987
257582
|
function formatDeployResult(result, log) {
|
|
257988
257583
|
const label = result.name.padEnd(25);
|
|
@@ -258117,11 +257712,11 @@ function getListCommand() {
|
|
|
258117
257712
|
}
|
|
258118
257713
|
|
|
258119
257714
|
// src/cli/commands/functions/pull.ts
|
|
258120
|
-
import { dirname as
|
|
257715
|
+
import { dirname as dirname17, join as join24 } from "node:path";
|
|
258121
257716
|
async function pullFunctionsAction({ log, runTask: runTask2 }, name2) {
|
|
258122
257717
|
const { project: project2, functions } = await readProjectConfig();
|
|
258123
|
-
const configDir =
|
|
258124
|
-
const functionsDir =
|
|
257718
|
+
const configDir = dirname17(project2.configPath);
|
|
257719
|
+
const functionsDir = join24(configDir, project2.functionsDir);
|
|
258125
257720
|
const pluginFunctionNames = new Set(functions.filter((fn) => fn.source.type === "plugin").map((fn) => fn.name));
|
|
258126
257721
|
const remoteFunctions = await runTask2("Fetching functions from Base44", async () => {
|
|
258127
257722
|
const { functions: functions2 } = await listDeployedFunctions();
|
|
@@ -258254,11 +257849,11 @@ function getBuildCommand() {
|
|
|
258254
257849
|
}
|
|
258255
257850
|
|
|
258256
257851
|
// src/cli/commands/project/create.ts
|
|
258257
|
-
import { basename as basename5, resolve as
|
|
257852
|
+
import { basename as basename5, resolve as resolve8 } from "node:path";
|
|
258258
257853
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
258259
257854
|
|
|
258260
257855
|
// src/cli/commands/project/scaffold-shared.ts
|
|
258261
|
-
import { join as
|
|
257856
|
+
import { join as join25 } from "node:path";
|
|
258262
257857
|
var DEFAULT_TEMPLATE_ID = "backend-only";
|
|
258263
257858
|
async function getTemplateById(templateId) {
|
|
258264
257859
|
const templates = await listTemplates();
|
|
@@ -258315,9 +257910,13 @@ async function completeProjectSetup({
|
|
|
258315
257910
|
const { appUrl } = await runTask2("Installing dependencies...", async (updateMessage) => {
|
|
258316
257911
|
await execa({ cwd: resolvedPath, shell: true })`${installCommand}`;
|
|
258317
257912
|
updateMessage("Building project...");
|
|
258318
|
-
await execa({
|
|
257913
|
+
await execa({
|
|
257914
|
+
cwd: resolvedPath,
|
|
257915
|
+
shell: true,
|
|
257916
|
+
env: { VITE_BASE44_APP_ID: projectId }
|
|
257917
|
+
})`${buildCommand}`;
|
|
258319
257918
|
updateMessage("Deploying site...");
|
|
258320
|
-
return await deploySite(
|
|
257919
|
+
return await deploySite(join25(resolvedPath, outputDirectory));
|
|
258321
257920
|
}, {
|
|
258322
257921
|
successMessage: theme.colors.base44Orange("Site deployed successfully"),
|
|
258323
257922
|
errorMessage: "Failed to deploy site"
|
|
@@ -258446,7 +258045,7 @@ async function createInteractive(options, ctx) {
|
|
|
258446
258045
|
}, ctx);
|
|
258447
258046
|
}
|
|
258448
258047
|
async function createNonInteractive(options, ctx) {
|
|
258449
|
-
ctx.log.info(`Creating a new project at ${
|
|
258048
|
+
ctx.log.info(`Creating a new project at ${resolve8(options.path)}`);
|
|
258450
258049
|
const template2 = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
|
|
258451
258050
|
return await executeCreate({
|
|
258452
258051
|
template: template2,
|
|
@@ -258470,7 +258069,7 @@ async function executeCreate({
|
|
|
258470
258069
|
}, ctx) {
|
|
258471
258070
|
const { log, runTask: runTask2 } = ctx;
|
|
258472
258071
|
const name2 = rawName.trim();
|
|
258473
|
-
const resolvedPath =
|
|
258072
|
+
const resolvedPath = resolve8(projectPath);
|
|
258474
258073
|
const organizationId = await resolveWorkspaceId(ctx, flagWorkspaceId, isInteractive);
|
|
258475
258074
|
const { projectId } = await runTask2("Setting up your project...", async () => {
|
|
258476
258075
|
return await createProjectFiles({
|
|
@@ -258520,81 +258119,6 @@ Examples:
|
|
|
258520
258119
|
$ base44 create my-app --workspace 507f1f77bcf86cd799439011 Creates a base44 project in the given workspace`).hook("preAction", validateCreateOptions).action(createAction);
|
|
258521
258120
|
}
|
|
258522
258121
|
|
|
258523
|
-
// src/cli/commands/site/deploy-options.ts
|
|
258524
|
-
function addDeploymentOptions(command2) {
|
|
258525
|
-
return command2.addOption(new Option("--git-hash <hash>", "Commit the build came from (defaults to the checkout's HEAD)").argParser(parseGitHash)).addOption(new Option("--concurrency <n>", "Parallel asset uploads").default(DEFAULT_UPLOAD_CONCURRENCY).argParser(parseConcurrency));
|
|
258526
|
-
}
|
|
258527
|
-
function parseGitHash(value) {
|
|
258528
|
-
if (!isGitCommitHash(value)) {
|
|
258529
|
-
throw new InvalidArgumentError("Expected a git commit hash (7-64 hex chars).");
|
|
258530
|
-
}
|
|
258531
|
-
return value;
|
|
258532
|
-
}
|
|
258533
|
-
function parseConcurrency(value) {
|
|
258534
|
-
const parsed = Number(value);
|
|
258535
|
-
if (!Number.isInteger(parsed) || parsed < 1 || parsed > MAX_UPLOAD_CONCURRENCY) {
|
|
258536
|
-
throw new InvalidArgumentError(`Expected a whole number between 1 and ${MAX_UPLOAD_CONCURRENCY}.`);
|
|
258537
|
-
}
|
|
258538
|
-
return parsed;
|
|
258539
|
-
}
|
|
258540
|
-
|
|
258541
|
-
// src/cli/commands/site/run-app-deploy.ts
|
|
258542
|
-
var TASK_LABELS = {
|
|
258543
|
-
"full-stack": {
|
|
258544
|
-
start: "Deploying full-stack app...",
|
|
258545
|
-
success: theme.colors.base44Orange("Full-stack app deployed"),
|
|
258546
|
-
error: "Full-stack deploy failed"
|
|
258547
|
-
},
|
|
258548
|
-
"static-deployment": {
|
|
258549
|
-
start: "Deploying site...",
|
|
258550
|
-
success: "Site deployed",
|
|
258551
|
-
error: "Site deploy failed"
|
|
258552
|
-
},
|
|
258553
|
-
static: {
|
|
258554
|
-
start: "Creating archive and deploying site...",
|
|
258555
|
-
success: "Site deployed successfully",
|
|
258556
|
-
error: "Deployment failed"
|
|
258557
|
-
}
|
|
258558
|
-
};
|
|
258559
|
-
async function runAppSiteDeploy({ runTask: runTask2, log }, target, options = {}) {
|
|
258560
|
-
const kind = await detectAppDeployKind(target);
|
|
258561
|
-
if (kind === "none")
|
|
258562
|
-
return { kind: "none" };
|
|
258563
|
-
const labels = TASK_LABELS[kind];
|
|
258564
|
-
const progressLines = [];
|
|
258565
|
-
const warnings = [];
|
|
258566
|
-
const result = await runTask2(labels.start, async (updateMessage) => await deployAppSite(target, {
|
|
258567
|
-
gitHash: options.gitHash,
|
|
258568
|
-
concurrency: options.concurrency,
|
|
258569
|
-
progress: {
|
|
258570
|
-
onWarning: (message) => {
|
|
258571
|
-
warnings.push(message);
|
|
258572
|
-
},
|
|
258573
|
-
onAssets: ({ totalAssets, newAssets }) => {
|
|
258574
|
-
const line = `Found ${totalAssets} static assets (${newAssets} new)`;
|
|
258575
|
-
progressLines.push(line);
|
|
258576
|
-
updateMessage(line);
|
|
258577
|
-
},
|
|
258578
|
-
onAssetUpload: ({ uploadedFiles, totalFiles }) => {
|
|
258579
|
-
updateMessage(`Uploaded ${uploadedFiles} of ${totalFiles} assets`);
|
|
258580
|
-
},
|
|
258581
|
-
onWorker: ({ moduleCount }) => {
|
|
258582
|
-
updateMessage(`Deploying worker (${moduleCount} modules)…`);
|
|
258583
|
-
}
|
|
258584
|
-
}
|
|
258585
|
-
}), {
|
|
258586
|
-
successMessage: labels.success,
|
|
258587
|
-
errorMessage: labels.error
|
|
258588
|
-
});
|
|
258589
|
-
for (const line of progressLines) {
|
|
258590
|
-
log.message(theme.styles.dim(line));
|
|
258591
|
-
}
|
|
258592
|
-
for (const warning of warnings) {
|
|
258593
|
-
log.warn(warning);
|
|
258594
|
-
}
|
|
258595
|
-
return result;
|
|
258596
|
-
}
|
|
258597
|
-
|
|
258598
258122
|
// src/cli/commands/project/deploy.ts
|
|
258599
258123
|
async function deployAction(ctx, options = {}) {
|
|
258600
258124
|
const { isNonInteractive, log } = ctx;
|
|
@@ -258602,13 +258126,12 @@ async function deployAction(ctx, options = {}) {
|
|
|
258602
258126
|
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
258603
258127
|
}
|
|
258604
258128
|
const projectData = await readProjectConfig(options.projectRoot);
|
|
258605
|
-
|
|
258606
|
-
const plannedSite = await detectAppDeployKind(project2);
|
|
258607
|
-
if (!hasResourcesToDeploy(projectData) && plannedSite === "none") {
|
|
258129
|
+
if (!hasResourcesToDeploy(projectData)) {
|
|
258608
258130
|
return {
|
|
258609
258131
|
outroMessage: "No resources found to deploy"
|
|
258610
258132
|
};
|
|
258611
258133
|
}
|
|
258134
|
+
const { project: project2, entities, functions, agents, connectors, authConfig } = projectData;
|
|
258612
258135
|
const summaryLines = [];
|
|
258613
258136
|
if (entities.length > 0) {
|
|
258614
258137
|
summaryLines.push(` - ${entities.length} ${entities.length === 1 ? "entity" : "entities"}`);
|
|
@@ -258628,9 +258151,7 @@ async function deployAction(ctx, options = {}) {
|
|
|
258628
258151
|
if (project2.visibility) {
|
|
258629
258152
|
summaryLines.push(` - Visibility: ${project2.visibility}`);
|
|
258630
258153
|
}
|
|
258631
|
-
if (
|
|
258632
|
-
summaryLines.push(" - Full-stack app");
|
|
258633
|
-
} else if (project2.site?.outputDirectory) {
|
|
258154
|
+
if (project2.site?.outputDirectory) {
|
|
258634
258155
|
summaryLines.push(` - Site from ${project2.site.outputDirectory}`);
|
|
258635
258156
|
}
|
|
258636
258157
|
if (!options.yes) {
|
|
@@ -258652,7 +258173,6 @@ ${summaryLines.join(`
|
|
|
258652
258173
|
let functionCompleted = 0;
|
|
258653
258174
|
const functionTotal = functions.length;
|
|
258654
258175
|
const result = await deployAll(projectData, {
|
|
258655
|
-
site: false,
|
|
258656
258176
|
onVisibilitySet: (level) => {
|
|
258657
258177
|
log.success(`App visibility set to ${level}`);
|
|
258658
258178
|
},
|
|
@@ -258665,10 +258185,6 @@ ${summaryLines.join(`
|
|
|
258665
258185
|
formatDeployResult(r, log);
|
|
258666
258186
|
}
|
|
258667
258187
|
});
|
|
258668
|
-
const siteResult = await runAppSiteDeploy(ctx, project2, {
|
|
258669
|
-
gitHash: options.gitHash,
|
|
258670
|
-
concurrency: options.concurrency
|
|
258671
|
-
});
|
|
258672
258188
|
const connectorResults = result.connectorResults ?? [];
|
|
258673
258189
|
await handleOAuthConnectors(connectorResults, isNonInteractive, options, log);
|
|
258674
258190
|
const stripeResult = connectorResults.find((r) => r.type === "stripe");
|
|
@@ -258676,28 +258192,13 @@ ${summaryLines.join(`
|
|
|
258676
258192
|
printStripeResult(stripeResult, log);
|
|
258677
258193
|
}
|
|
258678
258194
|
log.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl())}`);
|
|
258679
|
-
if (
|
|
258680
|
-
log.message(`${theme.styles.header("App URL")}: ${theme.colors.links(
|
|
258195
|
+
if (result.appUrl) {
|
|
258196
|
+
log.message(`${theme.styles.header("App URL")}: ${theme.colors.links(result.appUrl)}`);
|
|
258681
258197
|
}
|
|
258682
|
-
|
|
258683
|
-
if (deployment) {
|
|
258684
|
-
printDeploymentSummary(deployment, log);
|
|
258685
|
-
}
|
|
258686
|
-
return {
|
|
258687
|
-
outroMessage: "App deployed successfully",
|
|
258688
|
-
stdout: ctx.jsonMode && deployment ? `${JSON.stringify({
|
|
258689
|
-
deploymentId: deployment.deploymentId,
|
|
258690
|
-
gitHash: deployment.gitHash
|
|
258691
|
-
}, null, 2)}
|
|
258692
|
-
` : undefined
|
|
258693
|
-
};
|
|
258694
|
-
}
|
|
258695
|
-
function printDeploymentSummary(deployment, log) {
|
|
258696
|
-
log.message(`${theme.styles.header("Deployment")}: ${deployment.deploymentId} ${theme.styles.dim(`(commit ${deployment.gitHash.slice(0, 12)})`)}`);
|
|
258198
|
+
return { outroMessage: "App deployed successfully" };
|
|
258697
258199
|
}
|
|
258698
258200
|
function getDeployCommand2() {
|
|
258699
|
-
|
|
258700
|
-
return addDeploymentOptions(command2).action(deployAction);
|
|
258201
|
+
return new Base44Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").option("--build", "Build the site before deploying (skips the prompt)").option("--no-build", "Deploy without building (skips the prompt)").action(deployAction);
|
|
258701
258202
|
}
|
|
258702
258203
|
async function handleOAuthConnectors(connectorResults, isNonInteractive, options, log) {
|
|
258703
258204
|
const needsOAuth = filterPendingOAuth(connectorResults);
|
|
@@ -258893,7 +258394,6 @@ function getLinkCommand() {
|
|
|
258893
258394
|
}
|
|
258894
258395
|
|
|
258895
258396
|
// src/cli/commands/project/logs.ts
|
|
258896
|
-
var import_ms2 = __toESM(require_ms(), 1);
|
|
258897
258397
|
function parseFunctionFilters(options) {
|
|
258898
258398
|
const filters = {};
|
|
258899
258399
|
if (options.since) {
|
|
@@ -258921,15 +258421,6 @@ function parseFunctionNames(option) {
|
|
|
258921
258421
|
return [];
|
|
258922
258422
|
return option.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
258923
258423
|
}
|
|
258924
|
-
function normalizeDatetime(value) {
|
|
258925
|
-
const duration3 = import_ms2.default(value);
|
|
258926
|
-
if (duration3 !== undefined) {
|
|
258927
|
-
return new Date(Date.now() - duration3).toISOString();
|
|
258928
|
-
}
|
|
258929
|
-
if (/Z$|[+-]\d{2}:\d{2}$/.test(value))
|
|
258930
|
-
return value;
|
|
258931
|
-
return `${value}Z`;
|
|
258932
|
-
}
|
|
258933
258424
|
function formatEntry(entry) {
|
|
258934
258425
|
const time3 = entry.time.substring(0, 19).replace("T", " ");
|
|
258935
258426
|
const level = entry.level.toUpperCase().padEnd(5);
|
|
@@ -258975,7 +258466,7 @@ async function followLogs(functionNames, options, availableFunctionNames, jsonMo
|
|
|
258975
258466
|
for (const entry of fresh)
|
|
258976
258467
|
writeFollowLine(entry, jsonMode);
|
|
258977
258468
|
first = false;
|
|
258978
|
-
await new Promise((
|
|
258469
|
+
await new Promise((resolve9) => setTimeout(resolve9, 2000));
|
|
258979
258470
|
}
|
|
258980
258471
|
}
|
|
258981
258472
|
function formatLogs(entries, env3) {
|
|
@@ -259085,11 +258576,13 @@ async function logsAction(ctx, options) {
|
|
|
259085
258576
|
};
|
|
259086
258577
|
}
|
|
259087
258578
|
function getLogsCommand() {
|
|
259088
|
-
return new Base44Command("logs").description("Fetch function logs for this app").option("--function <names>", "Filter by function name(s), comma-separated. If omitted, fetches logs for all project functions").option("--since <datetime>", "Show logs from this time. ISO datetime or relative shorthand (e.g. 1h, 30m, 2d)", normalizeDatetime).option("--until <datetime>", "Show logs until this time. ISO datetime or relative shorthand (e.g. 1h, 30m, 2d)", normalizeDatetime).addOption(new Option("--level <level>", "Filter by log level").choices([
|
|
258579
|
+
return new Base44Command("logs").description("Fetch function logs for this app").option("--function <names>", "Filter by function name(s), comma-separated. If omitted, fetches logs for all project functions").option("--since <datetime>", "Show logs from this time. ISO datetime or relative shorthand (e.g. 1h, 30m, 2d)", normalizeDatetime).option("--until <datetime>", "Show logs until this time. ISO datetime or relative shorthand (e.g. 1h, 30m, 2d)", normalizeDatetime).addOption(new Option("--level <level>", "Filter by log level").choices([
|
|
258580
|
+
...LogLevelSchema.options
|
|
258581
|
+
])).option("-n, --limit <n>", "Results per page (1-1000, default: 50)").option("-f, --follow", "Stream new logs as they arrive").addOption(new Option("--order <order>", "Sort order").choices(["asc", "desc"])).addOption(new Option("--env <env>", "Which deployment to read logs from: preview (current draft) or prod (published). Default: preview").choices([...LogEnvSchema.options])).action(logsAction);
|
|
259089
258582
|
}
|
|
259090
258583
|
|
|
259091
258584
|
// src/cli/commands/project/scaffold.ts
|
|
259092
|
-
import { basename as basename6, resolve as
|
|
258585
|
+
import { basename as basename6, resolve as resolve9 } from "node:path";
|
|
259093
258586
|
function resolveAppId(options) {
|
|
259094
258587
|
const appId = options.appId;
|
|
259095
258588
|
if (!appId) {
|
|
@@ -259105,7 +258598,7 @@ function resolveAppId(options) {
|
|
|
259105
258598
|
async function scaffoldAction(ctx, name2, options, command2) {
|
|
259106
258599
|
const { log, runTask: runTask2 } = ctx;
|
|
259107
258600
|
const appId = resolveAppId(command2.optsWithGlobals());
|
|
259108
|
-
const resolvedPath =
|
|
258601
|
+
const resolvedPath = resolve9("./");
|
|
259109
258602
|
const projectName = (name2 ?? basename6(resolvedPath)).trim();
|
|
259110
258603
|
const template2 = await getTemplateById("backend-only");
|
|
259111
258604
|
log.info(`Scaffolding project at ${resolvedPath}`);
|
|
@@ -259502,7 +258995,7 @@ function getSecretsListCommand() {
|
|
|
259502
258995
|
}
|
|
259503
258996
|
|
|
259504
258997
|
// src/cli/commands/secrets/set.ts
|
|
259505
|
-
import { resolve as
|
|
258998
|
+
import { resolve as resolve10 } from "node:path";
|
|
259506
258999
|
function parseEntries(entries) {
|
|
259507
259000
|
const secrets = {};
|
|
259508
259001
|
for (const entry of entries) {
|
|
@@ -259533,7 +259026,7 @@ async function setSecretsAction({ log, runTask: runTask2 }, entries, options) {
|
|
|
259533
259026
|
validateInput(entries, options);
|
|
259534
259027
|
let secrets;
|
|
259535
259028
|
if (options.envFile) {
|
|
259536
|
-
secrets = await parseEnvFile(
|
|
259029
|
+
secrets = await parseEnvFile(resolve10(options.envFile));
|
|
259537
259030
|
if (Object.keys(secrets).length === 0) {
|
|
259538
259031
|
throw new InvalidInputError("The env file contains no valid KEY=VALUE entries.");
|
|
259539
259032
|
}
|
|
@@ -259562,53 +259055,92 @@ function getSecretsCommand() {
|
|
|
259562
259055
|
}
|
|
259563
259056
|
|
|
259564
259057
|
// src/cli/commands/site/deploy.ts
|
|
259058
|
+
import { resolve as resolve11 } from "node:path";
|
|
259565
259059
|
async function deployAction2(ctx, options) {
|
|
259566
259060
|
const { isNonInteractive } = ctx;
|
|
259567
259061
|
if (isNonInteractive && !options.yes) {
|
|
259568
259062
|
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
259569
259063
|
}
|
|
259570
|
-
const
|
|
259571
|
-
const
|
|
259572
|
-
if (
|
|
259064
|
+
const project2 = await readProjectSettings();
|
|
259065
|
+
const outputDirectory = project2.site?.outputDirectory;
|
|
259066
|
+
if (!outputDirectory) {
|
|
259573
259067
|
throw new ConfigNotFoundError("No site configuration found.", {
|
|
259574
259068
|
hints: [
|
|
259575
259069
|
{
|
|
259576
259070
|
message: `Add 'site.outputDirectory' to your config.jsonc (e.g., "site": { "outputDirectory": "dist" })`
|
|
259577
|
-
},
|
|
259578
|
-
{
|
|
259579
|
-
message: "Full-stack apps ship from their build artifact — run your framework's build first"
|
|
259580
259071
|
}
|
|
259581
259072
|
]
|
|
259582
259073
|
});
|
|
259583
259074
|
}
|
|
259584
259075
|
if (!options.yes) {
|
|
259585
259076
|
const shouldDeploy = await Re({
|
|
259586
|
-
message:
|
|
259077
|
+
message: `Deploy site from ${outputDirectory}?`
|
|
259587
259078
|
});
|
|
259588
259079
|
if (Ct(shouldDeploy) || !shouldDeploy) {
|
|
259589
259080
|
return { outroMessage: "Deployment cancelled" };
|
|
259590
259081
|
}
|
|
259591
259082
|
}
|
|
259592
259083
|
await maybeBuildBeforeDeploy(ctx, project2, options.build);
|
|
259593
|
-
const
|
|
259594
|
-
|
|
259595
|
-
|
|
259596
|
-
|
|
259597
|
-
|
|
259598
|
-
|
|
259599
|
-
|
|
259600
|
-
|
|
259084
|
+
const outputDir = resolve11(project2.root, outputDirectory);
|
|
259085
|
+
const { gitHash, concurrency } = options;
|
|
259086
|
+
return gitHash ? await deployToDeploymentsApi(ctx, outputDir, gitHash, concurrency) : await deployTarball(ctx, outputDir);
|
|
259087
|
+
}
|
|
259088
|
+
async function deployToDeploymentsApi({ runTask: runTask2, log, jsonMode }, outputDir, gitHash, concurrency) {
|
|
259089
|
+
const progressLines = [];
|
|
259090
|
+
const { deploymentId } = await runTask2("Deploying site...", async (updateMessage) => await deployStaticSite({
|
|
259091
|
+
outputDir,
|
|
259092
|
+
gitHash,
|
|
259093
|
+
concurrency,
|
|
259094
|
+
progress: {
|
|
259095
|
+
onAssets: ({ totalAssets, newAssets }) => {
|
|
259096
|
+
const line = `Found ${totalAssets} static assets (${newAssets} new)`;
|
|
259097
|
+
progressLines.push(line);
|
|
259098
|
+
updateMessage(line);
|
|
259099
|
+
},
|
|
259100
|
+
onAssetUpload: ({ uploadedFiles, totalFiles }) => {
|
|
259101
|
+
updateMessage(`Uploaded ${uploadedFiles} of ${totalFiles} assets`);
|
|
259102
|
+
}
|
|
259103
|
+
}
|
|
259104
|
+
}), { successMessage: "Site deployed", errorMessage: "Site deploy failed" });
|
|
259105
|
+
for (const line of progressLines) {
|
|
259106
|
+
log.message(theme.styles.dim(line));
|
|
259107
|
+
}
|
|
259108
|
+
return {
|
|
259109
|
+
outroMessage: `Deployment ${deploymentId} (commit ${gitHash.slice(0, 12)})`,
|
|
259110
|
+
stdout: jsonMode ? `${JSON.stringify({ deploymentId, gitHash }, null, 2)}
|
|
259601
259111
|
` : undefined
|
|
259602
|
-
|
|
259112
|
+
};
|
|
259113
|
+
}
|
|
259114
|
+
async function deployTarball({ runTask: runTask2 }, outputDir) {
|
|
259115
|
+
const { appUrl } = await runTask2("Creating archive and deploying site...", async () => await deploySite(outputDir), {
|
|
259116
|
+
successMessage: "Site deployed successfully",
|
|
259117
|
+
errorMessage: "Deployment failed"
|
|
259118
|
+
});
|
|
259119
|
+
return { outroMessage: `Visit your site at: ${appUrl}` };
|
|
259120
|
+
}
|
|
259121
|
+
function getSiteDeployCommand() {
|
|
259122
|
+
const command2 = new Base44Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").option("--build", "Build the site before deploying (skips the prompt)").option("--no-build", "Deploy without building (skips the prompt)");
|
|
259123
|
+
if (staticDeploymentsEnabled()) {
|
|
259124
|
+
command2.addOption(new Option("--git-hash <hash>", "Commit the build came from — deploys through the deployments API").argParser((value) => {
|
|
259125
|
+
if (!isGitCommitHash(value)) {
|
|
259126
|
+
throw new InvalidArgumentError("Expected a git commit hash (7-64 hex chars).");
|
|
259127
|
+
}
|
|
259128
|
+
return value;
|
|
259129
|
+
}));
|
|
259130
|
+
command2.addOption(new Option("--concurrency <n>", "Parallel asset uploads").default(DEFAULT_UPLOAD_CONCURRENCY).argParser(parseConcurrency));
|
|
259603
259131
|
}
|
|
259604
|
-
|
|
259605
|
-
|
|
259132
|
+
return command2.action(deployAction2);
|
|
259133
|
+
}
|
|
259134
|
+
function parseConcurrency(value) {
|
|
259135
|
+
const parsed = Number(value);
|
|
259136
|
+
if (!Number.isInteger(parsed) || parsed < 1 || parsed > MAX_UPLOAD_CONCURRENCY) {
|
|
259137
|
+
throw new InvalidArgumentError(`Expected a whole number between 1 and ${MAX_UPLOAD_CONCURRENCY}.`);
|
|
259606
259138
|
}
|
|
259607
|
-
return
|
|
259139
|
+
return parsed;
|
|
259608
259140
|
}
|
|
259609
|
-
function
|
|
259610
|
-
const
|
|
259611
|
-
return
|
|
259141
|
+
function staticDeploymentsEnabled(env3 = process.env) {
|
|
259142
|
+
const value = env3.BASE44_STATIC_DEPLOYMENTS;
|
|
259143
|
+
return value === "1" || value === "true";
|
|
259612
259144
|
}
|
|
259613
259145
|
|
|
259614
259146
|
// src/cli/commands/site/open.ts
|
|
@@ -259715,10 +259247,10 @@ function toPascalCase(name2) {
|
|
|
259715
259247
|
return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
|
|
259716
259248
|
}
|
|
259717
259249
|
// src/core/types/update-project.ts
|
|
259718
|
-
import { join as
|
|
259250
|
+
import { join as join28 } from "node:path";
|
|
259719
259251
|
var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
|
|
259720
259252
|
async function updateProjectConfig(projectRoot) {
|
|
259721
|
-
const tsconfigPath =
|
|
259253
|
+
const tsconfigPath = join28(projectRoot, "tsconfig.json");
|
|
259722
259254
|
if (!await pathExists(tsconfigPath)) {
|
|
259723
259255
|
return false;
|
|
259724
259256
|
}
|
|
@@ -259766,6 +259298,235 @@ function getTypesCommand() {
|
|
|
259766
259298
|
return new Command("types").description("Manage TypeScript type generation").addCommand(getTypesGenerateCommand());
|
|
259767
259299
|
}
|
|
259768
259300
|
|
|
259301
|
+
// src/core/resources/workflow/schema.ts
|
|
259302
|
+
var WorkflowRunStatusSchema = exports_external.enum([
|
|
259303
|
+
"running",
|
|
259304
|
+
"completed",
|
|
259305
|
+
"failed",
|
|
259306
|
+
"cancelled"
|
|
259307
|
+
]);
|
|
259308
|
+
var WorkflowListItemSchema = exports_external.object({
|
|
259309
|
+
id: exports_external.string(),
|
|
259310
|
+
name: exports_external.string(),
|
|
259311
|
+
description: exports_external.string().nullable().optional(),
|
|
259312
|
+
status: exports_external.string(),
|
|
259313
|
+
status_reason: exports_external.string().nullable().optional(),
|
|
259314
|
+
total_runs: exports_external.number().default(0),
|
|
259315
|
+
consecutive_failures: exports_external.number().default(0),
|
|
259316
|
+
last_run_at: exports_external.string().nullable().optional(),
|
|
259317
|
+
last_run_status: exports_external.string().nullable().optional()
|
|
259318
|
+
}).transform((data) => ({
|
|
259319
|
+
id: data.id,
|
|
259320
|
+
name: data.name,
|
|
259321
|
+
description: data.description ?? null,
|
|
259322
|
+
status: data.status,
|
|
259323
|
+
statusReason: data.status_reason ?? null,
|
|
259324
|
+
totalRuns: data.total_runs,
|
|
259325
|
+
consecutiveFailures: data.consecutive_failures,
|
|
259326
|
+
lastRunAt: data.last_run_at ?? null,
|
|
259327
|
+
lastRunStatus: data.last_run_status ?? null
|
|
259328
|
+
}));
|
|
259329
|
+
var ListWorkflowsResponseSchema = exports_external.array(WorkflowListItemSchema);
|
|
259330
|
+
var WorkflowRunSchema = exports_external.object({
|
|
259331
|
+
run_id: exports_external.string(),
|
|
259332
|
+
workflow_id: exports_external.string(),
|
|
259333
|
+
workflow_name: exports_external.string().default(""),
|
|
259334
|
+
trigger_type: exports_external.string().default(""),
|
|
259335
|
+
status: exports_external.string(),
|
|
259336
|
+
started_at: exports_external.string().nullable().optional(),
|
|
259337
|
+
completed_at: exports_external.string().nullable().optional(),
|
|
259338
|
+
duration_ms: exports_external.number().default(0),
|
|
259339
|
+
steps_count: exports_external.number().default(0),
|
|
259340
|
+
error_message: exports_external.string().nullable().optional(),
|
|
259341
|
+
is_test_run: exports_external.boolean().default(false),
|
|
259342
|
+
status_reason: exports_external.string().default("")
|
|
259343
|
+
}).transform((data) => ({
|
|
259344
|
+
runId: data.run_id,
|
|
259345
|
+
workflowId: data.workflow_id,
|
|
259346
|
+
workflowName: data.workflow_name,
|
|
259347
|
+
triggerType: data.trigger_type,
|
|
259348
|
+
status: data.status,
|
|
259349
|
+
startedAt: data.started_at ?? null,
|
|
259350
|
+
completedAt: data.completed_at ?? null,
|
|
259351
|
+
durationMs: data.duration_ms,
|
|
259352
|
+
stepsCount: data.steps_count,
|
|
259353
|
+
errorMessage: data.error_message ?? null,
|
|
259354
|
+
isTestRun: data.is_test_run,
|
|
259355
|
+
statusReason: data.status_reason
|
|
259356
|
+
}));
|
|
259357
|
+
var ListWorkflowRunsResponseSchema = exports_external.array(WorkflowRunSchema);
|
|
259358
|
+
|
|
259359
|
+
// src/core/resources/workflow/api.ts
|
|
259360
|
+
async function listWorkflows(limit) {
|
|
259361
|
+
const appClient = getAppClient();
|
|
259362
|
+
const searchParams = new URLSearchParams;
|
|
259363
|
+
if (limit !== undefined) {
|
|
259364
|
+
searchParams.set("limit", String(limit));
|
|
259365
|
+
}
|
|
259366
|
+
let response;
|
|
259367
|
+
try {
|
|
259368
|
+
response = await appClient.get("workflows", { searchParams });
|
|
259369
|
+
} catch (error48) {
|
|
259370
|
+
throw await ApiError.fromHttpError(error48, "listing workflows");
|
|
259371
|
+
}
|
|
259372
|
+
const result = ListWorkflowsResponseSchema.safeParse(await response.json());
|
|
259373
|
+
if (!result.success) {
|
|
259374
|
+
throw new SchemaValidationError("Invalid workflows response from server", result.error);
|
|
259375
|
+
}
|
|
259376
|
+
return result.data;
|
|
259377
|
+
}
|
|
259378
|
+
function buildRunsQueryString(filters) {
|
|
259379
|
+
const params = new URLSearchParams;
|
|
259380
|
+
if (filters.status) {
|
|
259381
|
+
params.set("status", filters.status);
|
|
259382
|
+
}
|
|
259383
|
+
if (filters.since) {
|
|
259384
|
+
params.set("since", filters.since);
|
|
259385
|
+
}
|
|
259386
|
+
if (filters.limit !== undefined) {
|
|
259387
|
+
params.set("limit", String(filters.limit));
|
|
259388
|
+
}
|
|
259389
|
+
return params;
|
|
259390
|
+
}
|
|
259391
|
+
async function listWorkflowRuns(filters = {}) {
|
|
259392
|
+
const appClient = getAppClient();
|
|
259393
|
+
let response;
|
|
259394
|
+
try {
|
|
259395
|
+
response = await appClient.get("workflows/runs", {
|
|
259396
|
+
searchParams: buildRunsQueryString(filters)
|
|
259397
|
+
});
|
|
259398
|
+
} catch (error48) {
|
|
259399
|
+
throw await ApiError.fromHttpError(error48, "listing workflow runs");
|
|
259400
|
+
}
|
|
259401
|
+
const result = ListWorkflowRunsResponseSchema.safeParse(await response.json());
|
|
259402
|
+
if (!result.success) {
|
|
259403
|
+
throw new SchemaValidationError("Invalid workflow runs response from server", result.error);
|
|
259404
|
+
}
|
|
259405
|
+
return result.data;
|
|
259406
|
+
}
|
|
259407
|
+
// src/cli/commands/workflows/legacy-app.ts
|
|
259408
|
+
var isWorkflowsNotEnabled = (error48) => error48 instanceof ApiError && error48.statusCode === 403;
|
|
259409
|
+
function rethrowLegacyAppAsExplanation(error48) {
|
|
259410
|
+
if (isWorkflowsNotEnabled(error48)) {
|
|
259411
|
+
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.");
|
|
259412
|
+
}
|
|
259413
|
+
throw error48;
|
|
259414
|
+
}
|
|
259415
|
+
|
|
259416
|
+
// src/cli/commands/workflows/limit.ts
|
|
259417
|
+
var MAX_LIMIT = 200;
|
|
259418
|
+
function parseLimit(limit) {
|
|
259419
|
+
if (limit === undefined)
|
|
259420
|
+
return;
|
|
259421
|
+
const parsed = Number.parseInt(limit, 10);
|
|
259422
|
+
if (Number.isNaN(parsed) || parsed < 1 || parsed > MAX_LIMIT) {
|
|
259423
|
+
throw new InvalidInputError(`Invalid limit: "${limit}". Must be a number between 1 and ${MAX_LIMIT}.`);
|
|
259424
|
+
}
|
|
259425
|
+
return parsed;
|
|
259426
|
+
}
|
|
259427
|
+
|
|
259428
|
+
// src/cli/commands/workflows/list.ts
|
|
259429
|
+
function formatWorkflowLine(workflow) {
|
|
259430
|
+
const lastRun = workflow.lastRunAt ? `last run ${workflow.lastRunStatus ?? "unknown"} at ${workflow.lastRunAt}` : "never ran";
|
|
259431
|
+
const failures = workflow.consecutiveFailures > 0 ? ` (${workflow.consecutiveFailures} consecutive failures)` : "";
|
|
259432
|
+
return `${workflow.name} [${workflow.status}] runs: ${workflow.totalRuns}, ${lastRun}${failures}`;
|
|
259433
|
+
}
|
|
259434
|
+
async function listAction({ log, runTask: runTask2, jsonMode }, options8) {
|
|
259435
|
+
const limit = parseLimit(options8.limit);
|
|
259436
|
+
const workflows = await runTask2("Fetching workflows from Base44", async () => listWorkflows(limit).catch(rethrowLegacyAppAsExplanation), {
|
|
259437
|
+
successMessage: "Workflows fetched successfully",
|
|
259438
|
+
errorMessage: "Failed to fetch workflows"
|
|
259439
|
+
});
|
|
259440
|
+
if (jsonMode) {
|
|
259441
|
+
return {
|
|
259442
|
+
outroMessage: `Found ${workflows.length} workflows.`,
|
|
259443
|
+
stdout: `${JSON.stringify({ workflows }, null, 2)}
|
|
259444
|
+
`
|
|
259445
|
+
};
|
|
259446
|
+
}
|
|
259447
|
+
if (workflows.length === 0) {
|
|
259448
|
+
return { outroMessage: "This app has no workflows." };
|
|
259449
|
+
}
|
|
259450
|
+
for (const workflow of workflows) {
|
|
259451
|
+
log.info(formatWorkflowLine(workflow));
|
|
259452
|
+
}
|
|
259453
|
+
return { outroMessage: `Found ${workflows.length} workflows.` };
|
|
259454
|
+
}
|
|
259455
|
+
function getWorkflowsListCommand() {
|
|
259456
|
+
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);
|
|
259457
|
+
}
|
|
259458
|
+
|
|
259459
|
+
// src/cli/commands/workflows/runs.ts
|
|
259460
|
+
function formatDuration2(durationMs) {
|
|
259461
|
+
if (durationMs === 0)
|
|
259462
|
+
return "";
|
|
259463
|
+
return ` ${(durationMs / 1000).toFixed(1)}s`;
|
|
259464
|
+
}
|
|
259465
|
+
function formatRunTags(run) {
|
|
259466
|
+
const tags = [run.triggerType, run.isTestRun ? "test" : null].filter(Boolean);
|
|
259467
|
+
return tags.length > 0 ? ` (${tags.join(", ")})` : "";
|
|
259468
|
+
}
|
|
259469
|
+
function formatFailureDetail(run) {
|
|
259470
|
+
const reason = run.statusReason ? ` [${run.statusReason}]` : "";
|
|
259471
|
+
const message = run.errorMessage ? `
|
|
259472
|
+
${run.errorMessage}` : "";
|
|
259473
|
+
return `${reason}${message}`;
|
|
259474
|
+
}
|
|
259475
|
+
function formatRunLine(run) {
|
|
259476
|
+
const time3 = (run.startedAt ?? "").substring(0, 19).replace("T", " ");
|
|
259477
|
+
const status = run.status.toUpperCase().padEnd(9);
|
|
259478
|
+
const base = `${time3} ${status} ${run.workflowName}${formatRunTags(run)}${formatDuration2(run.durationMs)}`;
|
|
259479
|
+
const failureDetail = run.status === "failed" || run.status === "cancelled" ? formatFailureDetail(run) : "";
|
|
259480
|
+
return `${base}${failureDetail}`;
|
|
259481
|
+
}
|
|
259482
|
+
async function describeEmptyResult(hasFilters) {
|
|
259483
|
+
const workflows = await listWorkflows().catch(() => null);
|
|
259484
|
+
if (workflows === null) {
|
|
259485
|
+
return "No runs found.";
|
|
259486
|
+
}
|
|
259487
|
+
if (workflows.length === 0) {
|
|
259488
|
+
return "This app has no workflows, so there are no runs.";
|
|
259489
|
+
}
|
|
259490
|
+
const names = workflows.map((workflow) => workflow.name).join(", ");
|
|
259491
|
+
return hasFilters ? `No runs match your filters. Workflows in this app: ${names}.` : `No runs yet. Workflows in this app: ${names}.`;
|
|
259492
|
+
}
|
|
259493
|
+
async function runsAction(ctx, options8) {
|
|
259494
|
+
const limit = parseLimit(options8.limit);
|
|
259495
|
+
const runs = await ctx.runTask("Fetching workflow runs from Base44", async () => listWorkflowRuns({
|
|
259496
|
+
status: options8.status,
|
|
259497
|
+
since: options8.since,
|
|
259498
|
+
limit
|
|
259499
|
+
}).catch(rethrowLegacyAppAsExplanation), {
|
|
259500
|
+
successMessage: "Workflow runs fetched successfully",
|
|
259501
|
+
errorMessage: "Failed to fetch workflow runs"
|
|
259502
|
+
});
|
|
259503
|
+
if (ctx.jsonMode) {
|
|
259504
|
+
return {
|
|
259505
|
+
outroMessage: `Found ${runs.length} runs.`,
|
|
259506
|
+
stdout: `${JSON.stringify({ runs }, null, 2)}
|
|
259507
|
+
`
|
|
259508
|
+
};
|
|
259509
|
+
}
|
|
259510
|
+
if (runs.length === 0) {
|
|
259511
|
+
const hasFilters = Boolean(options8.status || options8.since);
|
|
259512
|
+
return { outroMessage: await describeEmptyResult(hasFilters) };
|
|
259513
|
+
}
|
|
259514
|
+
for (const run of runs) {
|
|
259515
|
+
ctx.log.info(formatRunLine(run));
|
|
259516
|
+
}
|
|
259517
|
+
return { outroMessage: `Found ${runs.length} runs.` };
|
|
259518
|
+
}
|
|
259519
|
+
function getWorkflowsRunsCommand() {
|
|
259520
|
+
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([
|
|
259521
|
+
...WorkflowRunStatusSchema.options
|
|
259522
|
+
])).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);
|
|
259523
|
+
}
|
|
259524
|
+
|
|
259525
|
+
// src/cli/commands/workflows/index.ts
|
|
259526
|
+
function getWorkflowsCommand() {
|
|
259527
|
+
return new Command("workflows").description("Inspect this app's workflows and their runs").addCommand(getWorkflowsListCommand()).addCommand(getWorkflowsRunsCommand());
|
|
259528
|
+
}
|
|
259529
|
+
|
|
259769
259530
|
// src/cli/commands/workspace/shared.ts
|
|
259770
259531
|
function workspaceTag(workspace2) {
|
|
259771
259532
|
const role = workspace2.userRole ?? "member";
|
|
@@ -259953,7 +259714,7 @@ function createDevLogger(label2, labelColor = theme.styles.dim) {
|
|
|
259953
259714
|
// src/cli/dev/dev-server/main.ts
|
|
259954
259715
|
var import_cors = __toESM(require_lib4(), 1);
|
|
259955
259716
|
var import_express6 = __toESM(require_express(), 1);
|
|
259956
|
-
import { dirname as
|
|
259717
|
+
import { dirname as dirname23, join as join35 } from "node:path";
|
|
259957
259718
|
|
|
259958
259719
|
// ../../node_modules/get-port/index.js
|
|
259959
259720
|
import net from "node:net";
|
|
@@ -259980,14 +259741,14 @@ var getLocalHosts = () => {
|
|
|
259980
259741
|
}
|
|
259981
259742
|
return results;
|
|
259982
259743
|
};
|
|
259983
|
-
var checkAvailablePort = (options8) => new Promise((
|
|
259744
|
+
var checkAvailablePort = (options8) => new Promise((resolve13, reject) => {
|
|
259984
259745
|
const server = net.createServer();
|
|
259985
259746
|
server.unref();
|
|
259986
259747
|
server.on("error", reject);
|
|
259987
259748
|
server.listen(options8, () => {
|
|
259988
259749
|
const { port } = server.address();
|
|
259989
259750
|
server.close(() => {
|
|
259990
|
-
|
|
259751
|
+
resolve13(port);
|
|
259991
259752
|
});
|
|
259992
259753
|
});
|
|
259993
259754
|
});
|
|
@@ -260088,7 +259849,7 @@ var $setGracefulCleanup = tmp.setGracefulCleanup;
|
|
|
260088
259849
|
|
|
260089
259850
|
// src/cli/dev/dev-server/function-manager.ts
|
|
260090
259851
|
import { spawn as spawn2 } from "node:child_process";
|
|
260091
|
-
import { dirname as
|
|
259852
|
+
import { dirname as dirname20, join as join29 } from "node:path";
|
|
260092
259853
|
import { pathToFileURL } from "node:url";
|
|
260093
259854
|
|
|
260094
259855
|
// src/cli/dev/dev-server/base-function-manager.ts
|
|
@@ -260193,7 +259954,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
260193
259954
|
}
|
|
260194
259955
|
spawnFunction(func, port) {
|
|
260195
259956
|
this.logger.log(`Spawning function "${func.name}" on port ${port}`);
|
|
260196
|
-
const importMapPath =
|
|
259957
|
+
const importMapPath = join29(dirname20(this.wrapperPath), "import-map.json");
|
|
260197
259958
|
const process23 = spawn2("deno", ["run", "--allow-all", "--import-map", importMapPath, this.wrapperPath], {
|
|
260198
259959
|
env: {
|
|
260199
259960
|
...globalThis.process.env,
|
|
@@ -260232,7 +259993,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
260232
259993
|
});
|
|
260233
259994
|
}
|
|
260234
259995
|
waitForReady(name2, runningFunc) {
|
|
260235
|
-
return new Promise((
|
|
259996
|
+
return new Promise((resolve13, reject) => {
|
|
260236
259997
|
runningFunc.process.on("exit", (code2) => {
|
|
260237
259998
|
if (!runningFunc.ready) {
|
|
260238
259999
|
clearTimeout(timeout3);
|
|
@@ -260255,7 +260016,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
260255
260016
|
runningFunc.ready = true;
|
|
260256
260017
|
clearTimeout(timeout3);
|
|
260257
260018
|
runningFunc.process.stdout?.off("data", onData);
|
|
260258
|
-
|
|
260019
|
+
resolve13(runningFunc.port);
|
|
260259
260020
|
}
|
|
260260
260021
|
};
|
|
260261
260022
|
runningFunc.process.stdout?.on("data", onData);
|
|
@@ -260267,7 +260028,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
260267
260028
|
import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
260268
260029
|
import { isBuiltin } from "node:module";
|
|
260269
260030
|
import { homedir as homedir3 } from "node:os";
|
|
260270
|
-
import { join as
|
|
260031
|
+
import { join as join30 } from "node:path";
|
|
260271
260032
|
import { pathToFileURL as pathToFileURL6 } from "node:url";
|
|
260272
260033
|
var depsPromise;
|
|
260273
260034
|
function loadDeps() {
|
|
@@ -260388,9 +260149,9 @@ export default {
|
|
|
260388
260149
|
};
|
|
260389
260150
|
`;
|
|
260390
260151
|
function ensureBundlerConfig() {
|
|
260391
|
-
const dir =
|
|
260152
|
+
const dir = join30(homedir3(), ".base44", "function-bundler");
|
|
260392
260153
|
mkdirSync2(dir, { recursive: true });
|
|
260393
|
-
const configPath =
|
|
260154
|
+
const configPath = join30(dir, "deno.json");
|
|
260394
260155
|
writeFileSync2(configPath, `${JSON.stringify({ nodeModulesDir: "auto" }, null, 2)}
|
|
260395
260156
|
`);
|
|
260396
260157
|
return configPath;
|
|
@@ -260760,7 +260521,8 @@ var fieldTypes = [
|
|
|
260760
260521
|
"number",
|
|
260761
260522
|
"boolean",
|
|
260762
260523
|
"array",
|
|
260763
|
-
"object"
|
|
260524
|
+
"object",
|
|
260525
|
+
"null"
|
|
260764
260526
|
];
|
|
260765
260527
|
|
|
260766
260528
|
class Validator {
|
|
@@ -260820,6 +260582,14 @@ class Validator {
|
|
|
260820
260582
|
if (!property) {
|
|
260821
260583
|
return { hasError: false };
|
|
260822
260584
|
}
|
|
260585
|
+
if (Array.isArray(property.type)) {
|
|
260586
|
+
const types = property.type;
|
|
260587
|
+
const matched = types.some((type) => !this.validateValue(value, { ...property, type }, fieldPath).hasError);
|
|
260588
|
+
return matched ? { hasError: false } : {
|
|
260589
|
+
hasError: true,
|
|
260590
|
+
error: this.createValidationError(`Error in field ${fieldPath}: Input should be a valid ${types.join(" or ")}`)
|
|
260591
|
+
};
|
|
260592
|
+
}
|
|
260823
260593
|
const propertyType = property.type;
|
|
260824
260594
|
if (!fieldTypes.includes(propertyType)) {
|
|
260825
260595
|
return {
|
|
@@ -260860,6 +260630,14 @@ class Validator {
|
|
|
260860
260630
|
}
|
|
260861
260631
|
}
|
|
260862
260632
|
break;
|
|
260633
|
+
case "null":
|
|
260634
|
+
if (value !== null) {
|
|
260635
|
+
return {
|
|
260636
|
+
hasError: true,
|
|
260637
|
+
error: this.createValidationError(`Error in field ${fieldPath}: Input should be null`)
|
|
260638
|
+
};
|
|
260639
|
+
}
|
|
260640
|
+
break;
|
|
260863
260641
|
case "integer":
|
|
260864
260642
|
if (!Number.isInteger(value)) {
|
|
260865
260643
|
return {
|
|
@@ -261279,7 +261057,9 @@ function evaluateCondition(condition, record2, user) {
|
|
|
261279
261057
|
function checkRLS(rule, record2, user) {
|
|
261280
261058
|
if (user?.is_service === true)
|
|
261281
261059
|
return true;
|
|
261282
|
-
if (rule === undefined)
|
|
261060
|
+
if (rule === undefined || rule === null || rule === "")
|
|
261061
|
+
return true;
|
|
261062
|
+
if (typeof rule === "object" && Object.keys(rule).length === 0)
|
|
261283
261063
|
return true;
|
|
261284
261064
|
if (typeof rule === "boolean")
|
|
261285
261065
|
return rule;
|
|
@@ -261841,16 +261621,16 @@ function createCustomIntegrationRoutes(remoteProxy, logger2) {
|
|
|
261841
261621
|
|
|
261842
261622
|
// src/cli/dev/dev-server/watcher.ts
|
|
261843
261623
|
import { EventEmitter as EventEmitter4 } from "node:events";
|
|
261844
|
-
import { relative as
|
|
261624
|
+
import { relative as relative6 } from "node:path";
|
|
261845
261625
|
|
|
261846
261626
|
// ../../node_modules/chokidar/index.js
|
|
261847
261627
|
import { EventEmitter as EventEmitter3 } from "node:events";
|
|
261848
261628
|
import { stat as statcb, Stats } from "node:fs";
|
|
261849
|
-
import { readdir as readdir3, stat as
|
|
261629
|
+
import { readdir as readdir3, stat as stat5 } from "node:fs/promises";
|
|
261850
261630
|
import * as sp3 from "node:path";
|
|
261851
261631
|
|
|
261852
261632
|
// ../../node_modules/readdirp/index.js
|
|
261853
|
-
import { lstat as lstat2, readdir as readdir2, realpath, stat as
|
|
261633
|
+
import { lstat as lstat2, readdir as readdir2, realpath, stat as stat3 } from "node:fs/promises";
|
|
261854
261634
|
import { join as pjoin, relative as prelative, resolve as presolve, sep as psep } from "node:path";
|
|
261855
261635
|
import { Readable as Readable6 } from "node:stream";
|
|
261856
261636
|
var EntryTypes = {
|
|
@@ -261932,7 +261712,7 @@ class ReaddirpStream extends Readable6 {
|
|
|
261932
261712
|
const { root: root2, type } = opts;
|
|
261933
261713
|
this._fileFilter = normalizeFilter(opts.fileFilter);
|
|
261934
261714
|
this._directoryFilter = normalizeFilter(opts.directoryFilter);
|
|
261935
|
-
const statMethod = opts.lstat ? lstat2 :
|
|
261715
|
+
const statMethod = opts.lstat ? lstat2 : stat3;
|
|
261936
261716
|
if (wantBigintFsStats) {
|
|
261937
261717
|
this._stat = (path19) => statMethod(path19, { bigint: true });
|
|
261938
261718
|
} else {
|
|
@@ -262085,7 +261865,7 @@ function readdirp(root2, options8 = {}) {
|
|
|
262085
261865
|
|
|
262086
261866
|
// ../../node_modules/chokidar/handler.js
|
|
262087
261867
|
import { watch as fs_watch, unwatchFile, watchFile } from "node:fs";
|
|
262088
|
-
import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as
|
|
261868
|
+
import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as stat4 } from "node:fs/promises";
|
|
262089
261869
|
import { type as osType } from "node:os";
|
|
262090
261870
|
import * as sp2 from "node:path";
|
|
262091
261871
|
var STR_DATA = "data";
|
|
@@ -262111,7 +261891,7 @@ var EVENTS = {
|
|
|
262111
261891
|
};
|
|
262112
261892
|
var EV = EVENTS;
|
|
262113
261893
|
var THROTTLE_MODE_WATCH = "watch";
|
|
262114
|
-
var statMethods = { lstat: lstat3, stat:
|
|
261894
|
+
var statMethods = { lstat: lstat3, stat: stat4 };
|
|
262115
261895
|
var KEY_LISTENERS = "listeners";
|
|
262116
261896
|
var KEY_ERR = "errHandlers";
|
|
262117
261897
|
var KEY_RAW = "rawEmitters";
|
|
@@ -262571,9 +262351,9 @@ class NodeFsHandler {
|
|
|
262571
262351
|
if (this.fsw.closed) {
|
|
262572
262352
|
return;
|
|
262573
262353
|
}
|
|
262574
|
-
const
|
|
262354
|
+
const dirname22 = sp2.dirname(file2);
|
|
262575
262355
|
const basename8 = sp2.basename(file2);
|
|
262576
|
-
const parent = this.fsw._getWatchedDir(
|
|
262356
|
+
const parent = this.fsw._getWatchedDir(dirname22);
|
|
262577
262357
|
let prevStats = stats;
|
|
262578
262358
|
if (parent.has(basename8))
|
|
262579
262359
|
return;
|
|
@@ -262582,7 +262362,7 @@ class NodeFsHandler {
|
|
|
262582
262362
|
return;
|
|
262583
262363
|
if (!newStats || newStats.mtimeMs === 0) {
|
|
262584
262364
|
try {
|
|
262585
|
-
const newStats2 = await
|
|
262365
|
+
const newStats2 = await stat4(file2);
|
|
262586
262366
|
if (this.fsw.closed)
|
|
262587
262367
|
return;
|
|
262588
262368
|
const at13 = newStats2.atimeMs;
|
|
@@ -262600,7 +262380,7 @@ class NodeFsHandler {
|
|
|
262600
262380
|
prevStats = newStats2;
|
|
262601
262381
|
}
|
|
262602
262382
|
} catch (error48) {
|
|
262603
|
-
this.fsw._remove(
|
|
262383
|
+
this.fsw._remove(dirname22, basename8);
|
|
262604
262384
|
}
|
|
262605
262385
|
} else if (parent.has(basename8)) {
|
|
262606
262386
|
const at13 = newStats.atimeMs;
|
|
@@ -262689,7 +262469,7 @@ class NodeFsHandler {
|
|
|
262689
262469
|
this._addToNodeFs(path19, initialAdd, wh2, depth + 1);
|
|
262690
262470
|
}
|
|
262691
262471
|
}).on(EV.ERROR, this._boundHandleError);
|
|
262692
|
-
return new Promise((
|
|
262472
|
+
return new Promise((resolve14, reject) => {
|
|
262693
262473
|
if (!stream)
|
|
262694
262474
|
return reject();
|
|
262695
262475
|
stream.once(STR_END, () => {
|
|
@@ -262698,7 +262478,7 @@ class NodeFsHandler {
|
|
|
262698
262478
|
return;
|
|
262699
262479
|
}
|
|
262700
262480
|
const wasThrottled = throttler ? throttler.clear() : false;
|
|
262701
|
-
|
|
262481
|
+
resolve14(undefined);
|
|
262702
262482
|
previous.getChildren().filter((item) => {
|
|
262703
262483
|
return item !== directory && !current.has(item);
|
|
262704
262484
|
}).forEach((item) => {
|
|
@@ -262823,11 +262603,11 @@ function createPattern(matcher) {
|
|
|
262823
262603
|
if (matcher.path === string4)
|
|
262824
262604
|
return true;
|
|
262825
262605
|
if (matcher.recursive) {
|
|
262826
|
-
const
|
|
262827
|
-
if (!
|
|
262606
|
+
const relative6 = sp3.relative(matcher.path, string4);
|
|
262607
|
+
if (!relative6) {
|
|
262828
262608
|
return false;
|
|
262829
262609
|
}
|
|
262830
|
-
return !
|
|
262610
|
+
return !relative6.startsWith("..") && !sp3.isAbsolute(relative6);
|
|
262831
262611
|
}
|
|
262832
262612
|
return false;
|
|
262833
262613
|
};
|
|
@@ -263254,7 +263034,7 @@ class FSWatcher extends EventEmitter3 {
|
|
|
263254
263034
|
const fullPath = opts.cwd ? sp3.join(opts.cwd, path19) : path19;
|
|
263255
263035
|
let stats2;
|
|
263256
263036
|
try {
|
|
263257
|
-
stats2 = await
|
|
263037
|
+
stats2 = await stat5(fullPath);
|
|
263258
263038
|
} catch (err) {}
|
|
263259
263039
|
if (!stats2 || this.closed)
|
|
263260
263040
|
return;
|
|
@@ -263358,8 +263138,8 @@ class FSWatcher extends EventEmitter3 {
|
|
|
263358
263138
|
}
|
|
263359
263139
|
return this._userIgnored(path19, stats);
|
|
263360
263140
|
}
|
|
263361
|
-
_isntIgnored(path19,
|
|
263362
|
-
return !this._isIgnored(path19,
|
|
263141
|
+
_isntIgnored(path19, stat6) {
|
|
263142
|
+
return !this._isIgnored(path19, stat6);
|
|
263363
263143
|
}
|
|
263364
263144
|
_getWatchHelpers(path19) {
|
|
263365
263145
|
return new WatchHelper(path19, this.options.followSymlinks, this);
|
|
@@ -263526,7 +263306,7 @@ class WatchBase44 extends EventEmitter4 {
|
|
|
263526
263306
|
ignoreInitial: true
|
|
263527
263307
|
});
|
|
263528
263308
|
watcher.on("all", import_debounce.default(async (_event, path19) => {
|
|
263529
|
-
this.emit("change", name2,
|
|
263309
|
+
this.emit("change", name2, relative6(targetPath, path19));
|
|
263530
263310
|
}, WATCH_DEBOUNCE_MS));
|
|
263531
263311
|
watcher.on("error", (err) => {
|
|
263532
263312
|
this.logger.error(`Watch handler failed for ${targetPath}`, err);
|
|
@@ -263615,7 +263395,7 @@ async function createDevServer(options8) {
|
|
|
263615
263395
|
}
|
|
263616
263396
|
remoteProxy(req, res, next);
|
|
263617
263397
|
});
|
|
263618
|
-
const server = await new Promise((
|
|
263398
|
+
const server = await new Promise((resolve15, reject) => {
|
|
263619
263399
|
const s5 = app.listen(port, "127.0.0.1", (err) => {
|
|
263620
263400
|
if (err) {
|
|
263621
263401
|
if ("code" in err && err.code === "EADDRINUSE") {
|
|
@@ -263624,7 +263404,7 @@ async function createDevServer(options8) {
|
|
|
263624
263404
|
reject(err);
|
|
263625
263405
|
}
|
|
263626
263406
|
} else {
|
|
263627
|
-
|
|
263407
|
+
resolve15(s5);
|
|
263628
263408
|
}
|
|
263629
263409
|
});
|
|
263630
263410
|
});
|
|
@@ -263633,8 +263413,8 @@ async function createDevServer(options8) {
|
|
|
263633
263413
|
broadcastEntityEvent(io6, appId, entityName, event);
|
|
263634
263414
|
};
|
|
263635
263415
|
const base44ConfigWatcher = new WatchBase44({
|
|
263636
|
-
functions:
|
|
263637
|
-
entities:
|
|
263416
|
+
functions: join35(dirname23(project2.configPath), project2.functionsDir),
|
|
263417
|
+
entities: join35(dirname23(project2.configPath), project2.entitiesDir)
|
|
263638
263418
|
}, devLogger);
|
|
263639
263419
|
base44ConfigWatcher.on("change", async (name2) => {
|
|
263640
263420
|
try {
|
|
@@ -263674,13 +263454,13 @@ async function createDevServer(options8) {
|
|
|
263674
263454
|
if (!server.listening) {
|
|
263675
263455
|
return;
|
|
263676
263456
|
}
|
|
263677
|
-
await new Promise((
|
|
263457
|
+
await new Promise((resolve15, reject) => {
|
|
263678
263458
|
server.close((error48) => {
|
|
263679
263459
|
if (error48) {
|
|
263680
263460
|
reject(error48);
|
|
263681
263461
|
return;
|
|
263682
263462
|
}
|
|
263683
|
-
|
|
263463
|
+
resolve15();
|
|
263684
263464
|
});
|
|
263685
263465
|
});
|
|
263686
263466
|
};
|
|
@@ -263751,15 +263531,15 @@ class ServeRunner {
|
|
|
263751
263531
|
return;
|
|
263752
263532
|
}
|
|
263753
263533
|
this.stopping = true;
|
|
263754
|
-
const exited = new Promise((
|
|
263534
|
+
const exited = new Promise((resolve15) => child.once("exit", () => resolve15()));
|
|
263755
263535
|
if (process23.platform === "win32" && child.pid) {
|
|
263756
263536
|
const taskkill = spawn3("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
|
|
263757
263537
|
stdio: "ignore",
|
|
263758
263538
|
windowsHide: true
|
|
263759
263539
|
});
|
|
263760
|
-
await new Promise((
|
|
263761
|
-
taskkill.once("exit", () =>
|
|
263762
|
-
taskkill.once("error", () =>
|
|
263540
|
+
await new Promise((resolve15) => {
|
|
263541
|
+
taskkill.once("exit", () => resolve15());
|
|
263542
|
+
taskkill.once("error", () => resolve15());
|
|
263763
263543
|
});
|
|
263764
263544
|
} else if (child.pid) {
|
|
263765
263545
|
try {
|
|
@@ -263830,6 +263610,10 @@ function validateDevOptions(command2) {
|
|
|
263830
263610
|
if (appId !== undefined) {
|
|
263831
263611
|
command2.error(`base44 dev cannot be used with --app-id or ${BASE44_APP_ID_ENV_VAR}.`);
|
|
263832
263612
|
}
|
|
263613
|
+
const { port, remote } = command2.opts();
|
|
263614
|
+
if (remote && port !== undefined) {
|
|
263615
|
+
command2.error("--port applies to the local backend, which --remote does not start.");
|
|
263616
|
+
}
|
|
263833
263617
|
}
|
|
263834
263618
|
function requireLinkedProject({ app }) {
|
|
263835
263619
|
if (!app?.projectRoot) {
|
|
@@ -263837,31 +263621,44 @@ function requireLinkedProject({ app }) {
|
|
|
263837
263621
|
}
|
|
263838
263622
|
return { id: app.id, projectRoot: app.projectRoot };
|
|
263839
263623
|
}
|
|
263840
|
-
async function
|
|
263624
|
+
async function resolveConfiguredSite(app) {
|
|
263841
263625
|
const { project: project2 } = await readProjectConfig(app.projectRoot);
|
|
263842
263626
|
const serveCommand = project2.site?.serveCommand;
|
|
263843
|
-
|
|
263844
|
-
return;
|
|
263845
|
-
}
|
|
263846
|
-
return createServeCommandRunner({
|
|
263847
|
-
serveCommand,
|
|
263848
|
-
projectRoot: project2.root,
|
|
263849
|
-
appId: app.id,
|
|
263850
|
-
appBaseUrl: backendUrl
|
|
263851
|
-
});
|
|
263627
|
+
return serveCommand ? { serveCommand, projectRoot: project2.root } : undefined;
|
|
263852
263628
|
}
|
|
263853
|
-
function
|
|
263629
|
+
function stopRunnerOnProcessSignals(runner) {
|
|
263854
263630
|
const stop2 = () => void runner.stop();
|
|
263855
263631
|
process.on("SIGINT", stop2);
|
|
263856
263632
|
process.on("SIGTERM", stop2);
|
|
263633
|
+
}
|
|
263634
|
+
function startServeCommand(runner, backend) {
|
|
263635
|
+
stopRunnerOnProcessSignals(runner);
|
|
263857
263636
|
runner.onExit(() => {
|
|
263858
263637
|
backend.shutdown().finally(() => process.exit(1));
|
|
263859
263638
|
});
|
|
263860
263639
|
createDevLogger("backend", theme.styles.info).log(`Backend running on ${backend.url}`);
|
|
263861
263640
|
runner.start();
|
|
263862
263641
|
}
|
|
263863
|
-
async function
|
|
263864
|
-
const
|
|
263642
|
+
async function remoteDevAction(app) {
|
|
263643
|
+
const site2 = await resolveConfiguredSite(app);
|
|
263644
|
+
if (!site2) {
|
|
263645
|
+
throw new ConfigInvalidError("base44 dev --remote serves the frontend against the production backend, but this project has no site.serveCommand in base44/config.jsonc.");
|
|
263646
|
+
}
|
|
263647
|
+
const appBaseUrl = await getSiteUrl();
|
|
263648
|
+
const runner = createServeCommandRunner({
|
|
263649
|
+
...site2,
|
|
263650
|
+
appId: app.id,
|
|
263651
|
+
appBaseUrl
|
|
263652
|
+
});
|
|
263653
|
+
stopRunnerOnProcessSignals(runner);
|
|
263654
|
+
runner.onExit((code2) => process.exit(code2 ?? 1));
|
|
263655
|
+
runner.start();
|
|
263656
|
+
return {
|
|
263657
|
+
outroMessage: `Frontend dev server targets ${theme.styles.bold(appBaseUrl)} — every write hits your live app`
|
|
263658
|
+
};
|
|
263659
|
+
}
|
|
263660
|
+
async function localDevAction(ctx, app, options8) {
|
|
263661
|
+
const site2 = await resolveConfiguredSite(app);
|
|
263865
263662
|
const siteUrlPromise = getSiteUrl().catch(() => {
|
|
263866
263663
|
return;
|
|
263867
263664
|
});
|
|
@@ -263876,15 +263673,23 @@ async function devAction(ctx, options8) {
|
|
|
263876
263673
|
}
|
|
263877
263674
|
});
|
|
263878
263675
|
const backendUrl = localServerUrl(backend.port);
|
|
263879
|
-
|
|
263880
|
-
|
|
263676
|
+
if (site2) {
|
|
263677
|
+
const runner = createServeCommandRunner({
|
|
263678
|
+
...site2,
|
|
263679
|
+
appId: app.id,
|
|
263680
|
+
appBaseUrl: backendUrl
|
|
263681
|
+
});
|
|
263881
263682
|
startServeCommand(runner, { url: backendUrl, shutdown: backend.shutdown });
|
|
263882
263683
|
}
|
|
263883
|
-
const outroMessage =
|
|
263684
|
+
const outroMessage = site2 ? "Open your app using the frontend dev server URL" : `Dev server is available at ${theme.colors.links(backendUrl)}`;
|
|
263884
263685
|
return { outroMessage };
|
|
263885
263686
|
}
|
|
263687
|
+
async function devAction(ctx, options8) {
|
|
263688
|
+
const app = requireLinkedProject(ctx);
|
|
263689
|
+
return options8.remote ? remoteDevAction(app) : localDevAction(ctx, app, options8);
|
|
263690
|
+
}
|
|
263886
263691
|
function getDevCommand() {
|
|
263887
|
-
return new Base44Command("dev").description("Start the development server").option("-p, --port <number>", "Port for the development server").hook("preAction", validateDevOptions).action(devAction);
|
|
263692
|
+
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);
|
|
263888
263693
|
}
|
|
263889
263694
|
|
|
263890
263695
|
// src/core/exec/run-script.ts
|
|
@@ -263929,13 +263734,13 @@ async function runScript(options8) {
|
|
|
263929
263734
|
}
|
|
263930
263735
|
// src/cli/commands/exec.ts
|
|
263931
263736
|
function readStdin2() {
|
|
263932
|
-
return new Promise((
|
|
263737
|
+
return new Promise((resolve15, reject) => {
|
|
263933
263738
|
let data = "";
|
|
263934
263739
|
process.stdin.setEncoding("utf-8");
|
|
263935
263740
|
process.stdin.on("data", (chunk) => {
|
|
263936
263741
|
data += chunk;
|
|
263937
263742
|
});
|
|
263938
|
-
process.stdin.on("end", () =>
|
|
263743
|
+
process.stdin.on("end", () => resolve15(data));
|
|
263939
263744
|
process.stdin.on("error", reject);
|
|
263940
263745
|
});
|
|
263941
263746
|
}
|
|
@@ -264006,7 +263811,7 @@ Examples:
|
|
|
264006
263811
|
}
|
|
264007
263812
|
|
|
264008
263813
|
// src/cli/commands/project/eject.ts
|
|
264009
|
-
import { resolve as
|
|
263814
|
+
import { resolve as resolve15 } from "node:path";
|
|
264010
263815
|
var import_kebabCase2 = __toESM(require_kebabCase(), 1);
|
|
264011
263816
|
async function eject(ctx, options8, command2) {
|
|
264012
263817
|
const { log, runTask: runTask2, isNonInteractive } = ctx;
|
|
@@ -264070,7 +263875,7 @@ async function eject(ctx, options8, command2) {
|
|
|
264070
263875
|
Ne("Operation cancelled.");
|
|
264071
263876
|
throw new CLIExitError(0);
|
|
264072
263877
|
}
|
|
264073
|
-
const resolvedPath =
|
|
263878
|
+
const resolvedPath = resolve15(selectedPath);
|
|
264074
263879
|
await runTask2("Downloading your project's code...", async (updateMessage) => {
|
|
264075
263880
|
await createProjectFilesForExistingProject({
|
|
264076
263881
|
projectId,
|
|
@@ -264147,6 +263952,7 @@ function createProgram(context) {
|
|
|
264147
263952
|
program2.addCommand(getAgentSkillsCommand());
|
|
264148
263953
|
program2.addCommand(getConnectorsCommand());
|
|
264149
263954
|
program2.addCommand(getFunctionsCommand());
|
|
263955
|
+
program2.addCommand(getWorkflowsCommand());
|
|
264150
263956
|
program2.addCommand(getSecretsCommand());
|
|
264151
263957
|
program2.addCommand(getSandboxCommand());
|
|
264152
263958
|
program2.addCommand(getAuthCommand());
|
|
@@ -264163,7 +263969,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
|
|
|
264163
263969
|
import { release, type } from "node:os";
|
|
264164
263970
|
|
|
264165
263971
|
// ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
264166
|
-
import { dirname as
|
|
263972
|
+
import { dirname as dirname24, posix, sep } from "path";
|
|
264167
263973
|
function createModulerModifier() {
|
|
264168
263974
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
264169
263975
|
return async (frames) => {
|
|
@@ -264172,7 +263978,7 @@ function createModulerModifier() {
|
|
|
264172
263978
|
return frames;
|
|
264173
263979
|
};
|
|
264174
263980
|
}
|
|
264175
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
263981
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname24(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
|
|
264176
263982
|
const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
|
|
264177
263983
|
return (filename) => {
|
|
264178
263984
|
if (!filename)
|
|
@@ -266450,14 +266256,14 @@ async function addSourceContext(frames) {
|
|
|
266450
266256
|
return frames;
|
|
266451
266257
|
}
|
|
266452
266258
|
function getContextLinesFromFile(path19, ranges, output) {
|
|
266453
|
-
return new Promise((
|
|
266259
|
+
return new Promise((resolve16) => {
|
|
266454
266260
|
const stream = createReadStream2(path19);
|
|
266455
266261
|
const lineReaded = createInterface2({
|
|
266456
266262
|
input: stream
|
|
266457
266263
|
});
|
|
266458
266264
|
function destroyStreamAndResolve() {
|
|
266459
266265
|
stream.destroy();
|
|
266460
|
-
|
|
266266
|
+
resolve16();
|
|
266461
266267
|
}
|
|
266462
266268
|
let lineNumber = 0;
|
|
266463
266269
|
let currentRangeIndex = 0;
|
|
@@ -267569,15 +267375,15 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
267569
267375
|
return true;
|
|
267570
267376
|
if (this.featureFlagsPoller === undefined)
|
|
267571
267377
|
return false;
|
|
267572
|
-
return new Promise((
|
|
267378
|
+
return new Promise((resolve16) => {
|
|
267573
267379
|
const timeout3 = setTimeout(() => {
|
|
267574
267380
|
cleanup();
|
|
267575
|
-
|
|
267381
|
+
resolve16(false);
|
|
267576
267382
|
}, timeoutMs);
|
|
267577
267383
|
const cleanup = this._events.on("localEvaluationFlagsLoaded", (count2) => {
|
|
267578
267384
|
clearTimeout(timeout3);
|
|
267579
267385
|
cleanup();
|
|
267580
|
-
|
|
267386
|
+
resolve16(count2 > 0);
|
|
267581
267387
|
});
|
|
267582
267388
|
});
|
|
267583
267389
|
}
|
|
@@ -268361,9 +268167,9 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
|
|
|
268361
268167
|
});
|
|
268362
268168
|
}
|
|
268363
268169
|
// src/cli/index.ts
|
|
268364
|
-
var __dirname4 =
|
|
268170
|
+
var __dirname4 = dirname25(fileURLToPath6(import.meta.url));
|
|
268365
268171
|
async function runCLI(options8) {
|
|
268366
|
-
ensureNpmAssets(
|
|
268172
|
+
ensureNpmAssets(join36(__dirname4, "../assets"));
|
|
268367
268173
|
const errorReporter = new ErrorReporter;
|
|
268368
268174
|
errorReporter.registerProcessErrorHandlers();
|
|
268369
268175
|
const jsonMode = process.argv.includes("--json");
|
|
@@ -268402,4 +268208,4 @@ export {
|
|
|
268402
268208
|
CLIExitError
|
|
268403
268209
|
};
|
|
268404
268210
|
|
|
268405
|
-
//# debugId=
|
|
268211
|
+
//# debugId=BD8B328810C7720964756E2164756E21
|