@base44-preview/cli 0.1.7-pr.584.aff66d4 → 0.1.7-pr.584.c04fce8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +1077 -1030
- package/dist/cli/index.js.map +19 -17
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -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(resolve3, reject) {
|
|
23423
23423
|
isexe(path11, options || {}, function(er, is) {
|
|
23424
23424
|
if (er) {
|
|
23425
23425
|
reject(er);
|
|
23426
23426
|
} else {
|
|
23427
|
-
|
|
23427
|
+
resolve3(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((resolve3, reject) => {
|
|
23490
23490
|
if (i === pathEnv.length)
|
|
23491
|
-
return opt.all && found.length ?
|
|
23491
|
+
return opt.all && found.length ? resolve3(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
|
+
resolve3(subStep(p, i, 0));
|
|
23497
23497
|
});
|
|
23498
|
-
const subStep = (p, i, ii) => new Promise((
|
|
23498
|
+
const subStep = (p, i, ii) => new Promise((resolve3, reject) => {
|
|
23499
23499
|
if (ii === pathExt.length)
|
|
23500
|
-
return
|
|
23500
|
+
return resolve3(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 resolve3(p + ext);
|
|
23508
23508
|
}
|
|
23509
|
-
return
|
|
23509
|
+
return resolve3(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;
|
|
@@ -138287,11 +138287,11 @@ var require_prettier = __commonJS((exports, module) => {
|
|
|
138287
138287
|
var require_formatter = __commonJS((exports) => {
|
|
138288
138288
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
|
|
138289
138289
|
function adopt(value) {
|
|
138290
|
-
return value instanceof P9 ? value : new P9(function(
|
|
138291
|
-
|
|
138290
|
+
return value instanceof P9 ? value : new P9(function(resolve15) {
|
|
138291
|
+
resolve15(value);
|
|
138292
138292
|
});
|
|
138293
138293
|
}
|
|
138294
|
-
return new (P9 || (P9 = Promise))(function(
|
|
138294
|
+
return new (P9 || (P9 = Promise))(function(resolve15, reject) {
|
|
138295
138295
|
function fulfilled(value) {
|
|
138296
138296
|
try {
|
|
138297
138297
|
step(generator.next(value));
|
|
@@ -138307,7 +138307,7 @@ var require_formatter = __commonJS((exports) => {
|
|
|
138307
138307
|
}
|
|
138308
138308
|
}
|
|
138309
138309
|
function step(result) {
|
|
138310
|
-
result.done ?
|
|
138310
|
+
result.done ? resolve15(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
138311
138311
|
}
|
|
138312
138312
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
138313
138313
|
});
|
|
@@ -142960,7 +142960,7 @@ var require_url = __commonJS((exports) => {
|
|
|
142960
142960
|
};
|
|
142961
142961
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
142962
142962
|
exports.parse = undefined;
|
|
142963
|
-
exports.resolve =
|
|
142963
|
+
exports.resolve = resolve15;
|
|
142964
142964
|
exports.cwd = cwd;
|
|
142965
142965
|
exports.getProtocol = getProtocol;
|
|
142966
142966
|
exports.getExtension = getExtension;
|
|
@@ -142988,7 +142988,7 @@ var require_url = __commonJS((exports) => {
|
|
|
142988
142988
|
var urlDecodePatterns = [/%23/g, "#", /%24/g, "$", /%26/g, "&", /%2C/g, ",", /%40/g, "@"];
|
|
142989
142989
|
var parse11 = (u4) => new URL(u4);
|
|
142990
142990
|
exports.parse = parse11;
|
|
142991
|
-
function
|
|
142991
|
+
function resolve15(from, to5) {
|
|
142992
142992
|
const fromUrl = new URL((0, convert_path_to_posix_1.default)(from), "https://aaa.nonexistanturl.com");
|
|
142993
142993
|
const resolvedUrl = new URL((0, convert_path_to_posix_1.default)(to5), fromUrl);
|
|
142994
142994
|
const endSpaces = to5.match(/(\s*)$/)?.[1] || "";
|
|
@@ -143124,7 +143124,7 @@ var require_url = __commonJS((exports) => {
|
|
|
143124
143124
|
}
|
|
143125
143125
|
function relative5(from, to5) {
|
|
143126
143126
|
if (!isFileSystemPath(from) || !isFileSystemPath(to5)) {
|
|
143127
|
-
return
|
|
143127
|
+
return resolve15(from, to5);
|
|
143128
143128
|
}
|
|
143129
143129
|
const fromDir = path_1.default.dirname(stripHash(from));
|
|
143130
143130
|
const toPath4 = stripHash(to5);
|
|
@@ -143800,7 +143800,7 @@ var require_plugins = __commonJS((exports) => {
|
|
|
143800
143800
|
let plugin;
|
|
143801
143801
|
let lastError;
|
|
143802
143802
|
let index = 0;
|
|
143803
|
-
return new Promise((
|
|
143803
|
+
return new Promise((resolve15, reject) => {
|
|
143804
143804
|
runNextPlugin();
|
|
143805
143805
|
function runNextPlugin() {
|
|
143806
143806
|
plugin = plugins[index++];
|
|
@@ -143828,7 +143828,7 @@ var require_plugins = __commonJS((exports) => {
|
|
|
143828
143828
|
}
|
|
143829
143829
|
}
|
|
143830
143830
|
function onSuccess(result) {
|
|
143831
|
-
|
|
143831
|
+
resolve15({
|
|
143832
143832
|
plugin,
|
|
143833
143833
|
result
|
|
143834
143834
|
});
|
|
@@ -145161,11 +145161,11 @@ var require_lib3 = __commonJS((exports) => {
|
|
|
145161
145161
|
var require_resolver = __commonJS((exports) => {
|
|
145162
145162
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
|
|
145163
145163
|
function adopt(value) {
|
|
145164
|
-
return value instanceof P9 ? value : new P9(function(
|
|
145165
|
-
|
|
145164
|
+
return value instanceof P9 ? value : new P9(function(resolve15) {
|
|
145165
|
+
resolve15(value);
|
|
145166
145166
|
});
|
|
145167
145167
|
}
|
|
145168
|
-
return new (P9 || (P9 = Promise))(function(
|
|
145168
|
+
return new (P9 || (P9 = Promise))(function(resolve15, reject) {
|
|
145169
145169
|
function fulfilled(value) {
|
|
145170
145170
|
try {
|
|
145171
145171
|
step(generator.next(value));
|
|
@@ -145181,7 +145181,7 @@ var require_resolver = __commonJS((exports) => {
|
|
|
145181
145181
|
}
|
|
145182
145182
|
}
|
|
145183
145183
|
function step(result) {
|
|
145184
|
-
result.done ?
|
|
145184
|
+
result.done ? resolve15(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
145185
145185
|
}
|
|
145186
145186
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
145187
145187
|
});
|
|
@@ -145302,11 +145302,11 @@ var require_optionValidator = __commonJS((exports) => {
|
|
|
145302
145302
|
var require_src3 = __commonJS((exports) => {
|
|
145303
145303
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
|
|
145304
145304
|
function adopt(value) {
|
|
145305
|
-
return value instanceof P9 ? value : new P9(function(
|
|
145306
|
-
|
|
145305
|
+
return value instanceof P9 ? value : new P9(function(resolve15) {
|
|
145306
|
+
resolve15(value);
|
|
145307
145307
|
});
|
|
145308
145308
|
}
|
|
145309
|
-
return new (P9 || (P9 = Promise))(function(
|
|
145309
|
+
return new (P9 || (P9 = Promise))(function(resolve15, reject) {
|
|
145310
145310
|
function fulfilled(value) {
|
|
145311
145311
|
try {
|
|
145312
145312
|
step(generator.next(value));
|
|
@@ -145322,7 +145322,7 @@ var require_src3 = __commonJS((exports) => {
|
|
|
145322
145322
|
}
|
|
145323
145323
|
}
|
|
145324
145324
|
function step(result) {
|
|
145325
|
-
result.done ?
|
|
145325
|
+
result.done ? resolve15(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
145326
145326
|
}
|
|
145327
145327
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
145328
145328
|
});
|
|
@@ -150984,11 +150984,11 @@ var require_raw_body = __commonJS((exports, module) => {
|
|
|
150984
150984
|
if (done) {
|
|
150985
150985
|
return readStream(stream, encoding, length, limit, wrap(done));
|
|
150986
150986
|
}
|
|
150987
|
-
return new Promise(function executor(
|
|
150987
|
+
return new Promise(function executor(resolve15, reject) {
|
|
150988
150988
|
readStream(stream, encoding, length, limit, function onRead2(err, buf) {
|
|
150989
150989
|
if (err)
|
|
150990
150990
|
return reject(err);
|
|
150991
|
-
|
|
150991
|
+
resolve15(buf);
|
|
150992
150992
|
});
|
|
150993
150993
|
});
|
|
150994
150994
|
}
|
|
@@ -164113,7 +164113,7 @@ var require_view = __commonJS((exports, module) => {
|
|
|
164113
164113
|
var basename6 = path18.basename;
|
|
164114
164114
|
var extname3 = path18.extname;
|
|
164115
164115
|
var join29 = path18.join;
|
|
164116
|
-
var
|
|
164116
|
+
var resolve15 = path18.resolve;
|
|
164117
164117
|
module.exports = View;
|
|
164118
164118
|
function View(name2, options8) {
|
|
164119
164119
|
var opts = options8 || {};
|
|
@@ -164147,7 +164147,7 @@ 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 =
|
|
164150
|
+
var loc = resolve15(root2, name2);
|
|
164151
164151
|
var dir = dirname21(loc);
|
|
164152
164152
|
var file2 = basename6(loc);
|
|
164153
164153
|
path19 = this.resolve(dir, file2);
|
|
@@ -164172,7 +164172,7 @@ var require_view = __commonJS((exports, module) => {
|
|
|
164172
164172
|
});
|
|
164173
164173
|
sync = false;
|
|
164174
164174
|
};
|
|
164175
|
-
View.prototype.resolve = function
|
|
164175
|
+
View.prototype.resolve = function resolve16(dir, file2) {
|
|
164176
164176
|
var ext = this.ext;
|
|
164177
164177
|
var path19 = join29(dir, file2);
|
|
164178
164178
|
var stat4 = tryStat(path19);
|
|
@@ -166331,7 +166331,7 @@ var require_application = __commonJS((exports, module) => {
|
|
|
166331
166331
|
var compileETag = require_utils10().compileETag;
|
|
166332
166332
|
var compileQueryParser = require_utils10().compileQueryParser;
|
|
166333
166333
|
var compileTrust = require_utils10().compileTrust;
|
|
166334
|
-
var
|
|
166334
|
+
var resolve15 = __require("node:path").resolve;
|
|
166335
166335
|
var once9 = require_once();
|
|
166336
166336
|
var Router = require_router();
|
|
166337
166337
|
var slice = Array.prototype.slice;
|
|
@@ -166385,7 +166385,7 @@ var require_application = __commonJS((exports, module) => {
|
|
|
166385
166385
|
this.mountpath = "/";
|
|
166386
166386
|
this.locals.settings = this.settings;
|
|
166387
166387
|
this.set("view", View);
|
|
166388
|
-
this.set("views",
|
|
166388
|
+
this.set("views", resolve15("views"));
|
|
166389
166389
|
this.set("jsonp callback name", "callback");
|
|
166390
166390
|
if (env4 === "production") {
|
|
166391
166391
|
this.enable("view cache");
|
|
@@ -167876,7 +167876,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
167876
167876
|
var extname3 = path18.extname;
|
|
167877
167877
|
var join29 = path18.join;
|
|
167878
167878
|
var normalize2 = path18.normalize;
|
|
167879
|
-
var
|
|
167879
|
+
var resolve15 = path18.resolve;
|
|
167880
167880
|
var sep2 = path18.sep;
|
|
167881
167881
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
167882
167882
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1000;
|
|
@@ -167905,7 +167905,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
167905
167905
|
this._maxage = opts.maxAge || opts.maxage;
|
|
167906
167906
|
this._maxage = typeof this._maxage === "string" ? ms9(this._maxage) : Number(this._maxage);
|
|
167907
167907
|
this._maxage = !isNaN(this._maxage) ? Math.min(Math.max(0, this._maxage), MAX_MAXAGE) : 0;
|
|
167908
|
-
this._root = opts.root ?
|
|
167908
|
+
this._root = opts.root ? resolve15(opts.root) : null;
|
|
167909
167909
|
}
|
|
167910
167910
|
util2.inherits(SendStream, Stream2);
|
|
167911
167911
|
SendStream.prototype.error = function error48(status, err) {
|
|
@@ -168054,7 +168054,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
168054
168054
|
return res;
|
|
168055
168055
|
}
|
|
168056
168056
|
parts = normalize2(path19).split(sep2);
|
|
168057
|
-
path19 =
|
|
168057
|
+
path19 = resolve15(path19);
|
|
168058
168058
|
}
|
|
168059
168059
|
if (containsDotFile(parts)) {
|
|
168060
168060
|
debug('%s dotfile "%s"', this._dotfiles, path19);
|
|
@@ -168382,7 +168382,7 @@ var require_response = __commonJS((exports, module) => {
|
|
|
168382
168382
|
var cookie = require_cookie();
|
|
168383
168383
|
var send = require_send();
|
|
168384
168384
|
var extname3 = path18.extname;
|
|
168385
|
-
var
|
|
168385
|
+
var resolve15 = path18.resolve;
|
|
168386
168386
|
var vary = require_vary();
|
|
168387
168387
|
var { Buffer: Buffer7 } = __require("node:buffer");
|
|
168388
168388
|
var res = Object.create(http.ServerResponse.prototype);
|
|
@@ -168591,7 +168591,7 @@ var require_response = __commonJS((exports, module) => {
|
|
|
168591
168591
|
}
|
|
168592
168592
|
opts = Object.create(opts);
|
|
168593
168593
|
opts.headers = headers;
|
|
168594
|
-
var fullPath = !opts.root ?
|
|
168594
|
+
var fullPath = !opts.root ? resolve15(path19) : path19;
|
|
168595
168595
|
return this.sendFile(fullPath, opts, done);
|
|
168596
168596
|
};
|
|
168597
168597
|
res.contentType = res.type = function contentType(type) {
|
|
@@ -168852,7 +168852,7 @@ var require_serve_static = __commonJS((exports, module) => {
|
|
|
168852
168852
|
var encodeUrl = require_encodeurl();
|
|
168853
168853
|
var escapeHtml = require_escape_html();
|
|
168854
168854
|
var parseUrl = require_parseurl();
|
|
168855
|
-
var
|
|
168855
|
+
var resolve15 = __require("path").resolve;
|
|
168856
168856
|
var send = require_send();
|
|
168857
168857
|
var url3 = __require("url");
|
|
168858
168858
|
module.exports = serveStatic;
|
|
@@ -168871,7 +168871,7 @@ var require_serve_static = __commonJS((exports, module) => {
|
|
|
168871
168871
|
throw new TypeError("option setHeaders must be function");
|
|
168872
168872
|
}
|
|
168873
168873
|
opts.maxage = opts.maxage || opts.maxAge || 0;
|
|
168874
|
-
opts.root =
|
|
168874
|
+
opts.root = resolve15(root2);
|
|
168875
168875
|
var onDirectory = redirect ? createRedirectDirectoryListener() : createNotFoundDirectoryListener();
|
|
168876
168876
|
return function serveStatic2(req, res, next) {
|
|
168877
168877
|
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
@@ -172245,8 +172245,8 @@ var require_executor = __commonJS((exports, module) => {
|
|
|
172245
172245
|
}
|
|
172246
172246
|
resetBuffer() {
|
|
172247
172247
|
this.buffer = new Waterfall;
|
|
172248
|
-
this.buffer.chain(new Promise((
|
|
172249
|
-
this._triggerBuffer =
|
|
172248
|
+
this.buffer.chain(new Promise((resolve15) => {
|
|
172249
|
+
this._triggerBuffer = resolve15;
|
|
172250
172250
|
}));
|
|
172251
172251
|
if (this.ready)
|
|
172252
172252
|
this._triggerBuffer();
|
|
@@ -173266,7 +173266,7 @@ var require_storage = __commonJS((exports, module) => {
|
|
|
173266
173266
|
throw e8;
|
|
173267
173267
|
}
|
|
173268
173268
|
};
|
|
173269
|
-
var writeFileLinesAsync = (filename, lines, mode = DEFAULT_FILE_MODE) => new Promise((
|
|
173269
|
+
var writeFileLinesAsync = (filename, lines, mode = DEFAULT_FILE_MODE) => new Promise((resolve15, reject) => {
|
|
173270
173270
|
try {
|
|
173271
173271
|
const stream = writeFileStream(filename, { mode });
|
|
173272
173272
|
const readable2 = Readable6.from(lines);
|
|
@@ -173283,7 +173283,7 @@ var require_storage = __commonJS((exports, module) => {
|
|
|
173283
173283
|
if (err)
|
|
173284
173284
|
reject(err);
|
|
173285
173285
|
else
|
|
173286
|
-
|
|
173286
|
+
resolve15();
|
|
173287
173287
|
});
|
|
173288
173288
|
});
|
|
173289
173289
|
readable2.on("error", (err) => {
|
|
@@ -173454,7 +173454,7 @@ var require_persistence = __commonJS((exports, module) => {
|
|
|
173454
173454
|
return { data: tdata, indexes };
|
|
173455
173455
|
}
|
|
173456
173456
|
treatRawStreamAsync(rawStream) {
|
|
173457
|
-
return new Promise((
|
|
173457
|
+
return new Promise((resolve15, reject) => {
|
|
173458
173458
|
const dataById = {};
|
|
173459
173459
|
const indexes = {};
|
|
173460
173460
|
let corruptItems = 0;
|
|
@@ -173497,7 +173497,7 @@ var require_persistence = __commonJS((exports, module) => {
|
|
|
173497
173497
|
}
|
|
173498
173498
|
}
|
|
173499
173499
|
const data = Object.values(dataById);
|
|
173500
|
-
|
|
173500
|
+
resolve15({ data, indexes });
|
|
173501
173501
|
});
|
|
173502
173502
|
lineStream.on("error", function(err) {
|
|
173503
173503
|
reject(err, null);
|
|
@@ -199108,13 +199108,13 @@ var require_broadcast_operator = __commonJS((exports) => {
|
|
|
199108
199108
|
return true;
|
|
199109
199109
|
}
|
|
199110
199110
|
emitWithAck(ev2, ...args) {
|
|
199111
|
-
return new Promise((
|
|
199111
|
+
return new Promise((resolve15, reject) => {
|
|
199112
199112
|
args.push((err, responses) => {
|
|
199113
199113
|
if (err) {
|
|
199114
199114
|
err.responses = responses;
|
|
199115
199115
|
return reject(err);
|
|
199116
199116
|
} else {
|
|
199117
|
-
return
|
|
199117
|
+
return resolve15(responses);
|
|
199118
199118
|
}
|
|
199119
199119
|
});
|
|
199120
199120
|
this.emit(ev2, ...args);
|
|
@@ -199302,12 +199302,12 @@ var require_socket2 = __commonJS((exports) => {
|
|
|
199302
199302
|
}
|
|
199303
199303
|
emitWithAck(ev2, ...args) {
|
|
199304
199304
|
const withErr = this.flags.timeout !== undefined;
|
|
199305
|
-
return new Promise((
|
|
199305
|
+
return new Promise((resolve15, reject) => {
|
|
199306
199306
|
args.push((arg1, arg2) => {
|
|
199307
199307
|
if (withErr) {
|
|
199308
|
-
return arg1 ? reject(arg1) :
|
|
199308
|
+
return arg1 ? reject(arg1) : resolve15(arg2);
|
|
199309
199309
|
} else {
|
|
199310
|
-
return
|
|
199310
|
+
return resolve15(arg1);
|
|
199311
199311
|
}
|
|
199312
199312
|
});
|
|
199313
199313
|
this.emit(ev2, ...args);
|
|
@@ -199762,13 +199762,13 @@ var require_namespace = __commonJS((exports) => {
|
|
|
199762
199762
|
return true;
|
|
199763
199763
|
}
|
|
199764
199764
|
serverSideEmitWithAck(ev2, ...args) {
|
|
199765
|
-
return new Promise((
|
|
199765
|
+
return new Promise((resolve15, reject) => {
|
|
199766
199766
|
args.push((err, responses) => {
|
|
199767
199767
|
if (err) {
|
|
199768
199768
|
err.responses = responses;
|
|
199769
199769
|
return reject(err);
|
|
199770
199770
|
} else {
|
|
199771
|
-
return
|
|
199771
|
+
return resolve15(responses);
|
|
199772
199772
|
}
|
|
199773
199773
|
});
|
|
199774
199774
|
this.serverSideEmit(ev2, ...args);
|
|
@@ -203303,7 +203303,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
203303
203303
|
return localSockets;
|
|
203304
203304
|
}
|
|
203305
203305
|
const requestId = randomId();
|
|
203306
|
-
return new Promise((
|
|
203306
|
+
return new Promise((resolve15, reject) => {
|
|
203307
203307
|
const timeout3 = setTimeout(() => {
|
|
203308
203308
|
const storedRequest2 = this.requests.get(requestId);
|
|
203309
203309
|
if (storedRequest2) {
|
|
@@ -203313,7 +203313,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
203313
203313
|
}, opts.flags.timeout || DEFAULT_TIMEOUT);
|
|
203314
203314
|
const storedRequest = {
|
|
203315
203315
|
type: MessageType.FETCH_SOCKETS,
|
|
203316
|
-
resolve:
|
|
203316
|
+
resolve: resolve15,
|
|
203317
203317
|
timeout: timeout3,
|
|
203318
203318
|
current: 0,
|
|
203319
203319
|
expected: expectedResponseCount,
|
|
@@ -203523,7 +203523,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
203523
203523
|
return localSockets;
|
|
203524
203524
|
}
|
|
203525
203525
|
const requestId = randomId();
|
|
203526
|
-
return new Promise((
|
|
203526
|
+
return new Promise((resolve15, reject) => {
|
|
203527
203527
|
const timeout3 = setTimeout(() => {
|
|
203528
203528
|
const storedRequest2 = this.customRequests.get(requestId);
|
|
203529
203529
|
if (storedRequest2) {
|
|
@@ -203533,7 +203533,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
203533
203533
|
}, opts.flags.timeout || DEFAULT_TIMEOUT);
|
|
203534
203534
|
const storedRequest = {
|
|
203535
203535
|
type: MessageType.FETCH_SOCKETS,
|
|
203536
|
-
resolve:
|
|
203536
|
+
resolve: resolve15,
|
|
203537
203537
|
timeout: timeout3,
|
|
203538
203538
|
missingUids: new Set([...this.nodesMap.keys()]),
|
|
203539
203539
|
responses: localSockets
|
|
@@ -204262,13 +204262,13 @@ var require_dist4 = __commonJS((exports, module) => {
|
|
|
204262
204262
|
this.engine.close();
|
|
204263
204263
|
(0, uws_1.restoreAdapter)();
|
|
204264
204264
|
if (this.httpServer) {
|
|
204265
|
-
return new Promise((
|
|
204265
|
+
return new Promise((resolve15) => {
|
|
204266
204266
|
this.httpServer.close((err) => {
|
|
204267
204267
|
fn9 && fn9(err);
|
|
204268
204268
|
if (err) {
|
|
204269
204269
|
debug("server was not running");
|
|
204270
204270
|
}
|
|
204271
|
-
|
|
204271
|
+
resolve15();
|
|
204272
204272
|
});
|
|
204273
204273
|
});
|
|
204274
204274
|
} else {
|
|
@@ -218930,14 +218930,14 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
218930
218930
|
};
|
|
218931
218931
|
}
|
|
218932
218932
|
function readAndResolve(iter) {
|
|
218933
|
-
var
|
|
218934
|
-
if (
|
|
218933
|
+
var resolve15 = iter[kLastResolve];
|
|
218934
|
+
if (resolve15 !== null) {
|
|
218935
218935
|
var data = iter[kStream].read();
|
|
218936
218936
|
if (data !== null) {
|
|
218937
218937
|
iter[kLastPromise] = null;
|
|
218938
218938
|
iter[kLastResolve] = null;
|
|
218939
218939
|
iter[kLastReject] = null;
|
|
218940
|
-
|
|
218940
|
+
resolve15(createIterResult(data, false));
|
|
218941
218941
|
}
|
|
218942
218942
|
}
|
|
218943
218943
|
}
|
|
@@ -218945,13 +218945,13 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
218945
218945
|
process.nextTick(readAndResolve, iter);
|
|
218946
218946
|
}
|
|
218947
218947
|
function wrapForNext(lastPromise, iter) {
|
|
218948
|
-
return function(
|
|
218948
|
+
return function(resolve15, reject) {
|
|
218949
218949
|
lastPromise.then(function() {
|
|
218950
218950
|
if (iter[kEnded]) {
|
|
218951
|
-
|
|
218951
|
+
resolve15(createIterResult(undefined, true));
|
|
218952
218952
|
return;
|
|
218953
218953
|
}
|
|
218954
|
-
iter[kHandlePromise](
|
|
218954
|
+
iter[kHandlePromise](resolve15, reject);
|
|
218955
218955
|
}, reject);
|
|
218956
218956
|
};
|
|
218957
218957
|
}
|
|
@@ -218970,12 +218970,12 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
218970
218970
|
return Promise.resolve(createIterResult(undefined, true));
|
|
218971
218971
|
}
|
|
218972
218972
|
if (this[kStream].destroyed) {
|
|
218973
|
-
return new Promise(function(
|
|
218973
|
+
return new Promise(function(resolve15, reject) {
|
|
218974
218974
|
process.nextTick(function() {
|
|
218975
218975
|
if (_this[kError]) {
|
|
218976
218976
|
reject(_this[kError]);
|
|
218977
218977
|
} else {
|
|
218978
|
-
|
|
218978
|
+
resolve15(createIterResult(undefined, true));
|
|
218979
218979
|
}
|
|
218980
218980
|
});
|
|
218981
218981
|
});
|
|
@@ -218998,13 +218998,13 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
218998
218998
|
return this;
|
|
218999
218999
|
}), _defineProperty(_Object$setPrototypeO, "return", function _return() {
|
|
219000
219000
|
var _this2 = this;
|
|
219001
|
-
return new Promise(function(
|
|
219001
|
+
return new Promise(function(resolve15, reject) {
|
|
219002
219002
|
_this2[kStream].destroy(null, function(err) {
|
|
219003
219003
|
if (err) {
|
|
219004
219004
|
reject(err);
|
|
219005
219005
|
return;
|
|
219006
219006
|
}
|
|
219007
|
-
|
|
219007
|
+
resolve15(createIterResult(undefined, true));
|
|
219008
219008
|
});
|
|
219009
219009
|
});
|
|
219010
219010
|
}), _Object$setPrototypeO), AsyncIteratorPrototype);
|
|
@@ -219026,15 +219026,15 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
219026
219026
|
value: stream._readableState.endEmitted,
|
|
219027
219027
|
writable: true
|
|
219028
219028
|
}), _defineProperty(_Object$create, kHandlePromise, {
|
|
219029
|
-
value: function value(
|
|
219029
|
+
value: function value(resolve15, reject) {
|
|
219030
219030
|
var data = iterator[kStream].read();
|
|
219031
219031
|
if (data) {
|
|
219032
219032
|
iterator[kLastPromise] = null;
|
|
219033
219033
|
iterator[kLastResolve] = null;
|
|
219034
219034
|
iterator[kLastReject] = null;
|
|
219035
|
-
|
|
219035
|
+
resolve15(createIterResult(data, false));
|
|
219036
219036
|
} else {
|
|
219037
|
-
iterator[kLastResolve] =
|
|
219037
|
+
iterator[kLastResolve] = resolve15;
|
|
219038
219038
|
iterator[kLastReject] = reject;
|
|
219039
219039
|
}
|
|
219040
219040
|
},
|
|
@@ -219053,12 +219053,12 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
219053
219053
|
iterator[kError] = err;
|
|
219054
219054
|
return;
|
|
219055
219055
|
}
|
|
219056
|
-
var
|
|
219057
|
-
if (
|
|
219056
|
+
var resolve15 = iterator[kLastResolve];
|
|
219057
|
+
if (resolve15 !== null) {
|
|
219058
219058
|
iterator[kLastPromise] = null;
|
|
219059
219059
|
iterator[kLastResolve] = null;
|
|
219060
219060
|
iterator[kLastReject] = null;
|
|
219061
|
-
|
|
219061
|
+
resolve15(createIterResult(undefined, true));
|
|
219062
219062
|
}
|
|
219063
219063
|
iterator[kEnded] = true;
|
|
219064
219064
|
});
|
|
@@ -219070,7 +219070,7 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
219070
219070
|
|
|
219071
219071
|
// ../../node_modules/readable-stream/lib/internal/streams/from.js
|
|
219072
219072
|
var require_from = __commonJS((exports, module) => {
|
|
219073
|
-
function asyncGeneratorStep(gen,
|
|
219073
|
+
function asyncGeneratorStep(gen, resolve15, reject, _next, _throw, key2, arg) {
|
|
219074
219074
|
try {
|
|
219075
219075
|
var info = gen[key2](arg);
|
|
219076
219076
|
var value = info.value;
|
|
@@ -219079,7 +219079,7 @@ var require_from = __commonJS((exports, module) => {
|
|
|
219079
219079
|
return;
|
|
219080
219080
|
}
|
|
219081
219081
|
if (info.done) {
|
|
219082
|
-
|
|
219082
|
+
resolve15(value);
|
|
219083
219083
|
} else {
|
|
219084
219084
|
Promise.resolve(value).then(_next, _throw);
|
|
219085
219085
|
}
|
|
@@ -219087,13 +219087,13 @@ var require_from = __commonJS((exports, module) => {
|
|
|
219087
219087
|
function _asyncToGenerator(fn9) {
|
|
219088
219088
|
return function() {
|
|
219089
219089
|
var self2 = this, args = arguments;
|
|
219090
|
-
return new Promise(function(
|
|
219090
|
+
return new Promise(function(resolve15, reject) {
|
|
219091
219091
|
var gen = fn9.apply(self2, args);
|
|
219092
219092
|
function _next(value) {
|
|
219093
|
-
asyncGeneratorStep(gen,
|
|
219093
|
+
asyncGeneratorStep(gen, resolve15, reject, _next, _throw, "next", value);
|
|
219094
219094
|
}
|
|
219095
219095
|
function _throw(err) {
|
|
219096
|
-
asyncGeneratorStep(gen,
|
|
219096
|
+
asyncGeneratorStep(gen, resolve15, reject, _next, _throw, "throw", err);
|
|
219097
219097
|
}
|
|
219098
219098
|
_next(undefined);
|
|
219099
219099
|
});
|
|
@@ -247439,7 +247439,7 @@ async function createProjectFilesForExistingProject(options) {
|
|
|
247439
247439
|
};
|
|
247440
247440
|
}
|
|
247441
247441
|
// src/core/project/deploy.ts
|
|
247442
|
-
import { resolve as
|
|
247442
|
+
import { resolve as resolve6 } from "node:path";
|
|
247443
247443
|
|
|
247444
247444
|
// src/core/site/api.ts
|
|
247445
247445
|
async function uploadSite(archivePath) {
|
|
@@ -247506,340 +247506,89 @@ async function createArchive(pathToArchive, targetArchivePath) {
|
|
|
247506
247506
|
cwd: pathToArchive
|
|
247507
247507
|
}, ["."]);
|
|
247508
247508
|
}
|
|
247509
|
-
// src/core/
|
|
247510
|
-
|
|
247511
|
-
|
|
247512
|
-
|
|
247513
|
-
|
|
247514
|
-
|
|
247515
|
-
|
|
247516
|
-
|
|
247517
|
-
|
|
247518
|
-
|
|
247519
|
-
|
|
247520
|
-
|
|
247521
|
-
|
|
247522
|
-
|
|
247523
|
-
|
|
247524
|
-
|
|
247525
|
-
|
|
247526
|
-
const hasAuthConfig = authConfig.length > 0;
|
|
247527
|
-
const hasVisibility = Boolean(project.visibility);
|
|
247528
|
-
return hasEntities || hasFunctions || hasAgents || hasAgentSkills || hasConnectors || hasAuthConfig || hasVisibility || hasSite;
|
|
247529
|
-
}
|
|
247530
|
-
async function deployAll(projectData, options) {
|
|
247531
|
-
const {
|
|
247532
|
-
project,
|
|
247533
|
-
entities,
|
|
247534
|
-
functions,
|
|
247535
|
-
agents,
|
|
247536
|
-
agentSkills,
|
|
247537
|
-
connectors,
|
|
247538
|
-
authConfig
|
|
247539
|
-
} = projectData;
|
|
247540
|
-
await setAppVisibility(project.visibility);
|
|
247541
|
-
if (project.visibility) {
|
|
247542
|
-
options?.onVisibilitySet?.(project.visibility);
|
|
247543
|
-
}
|
|
247544
|
-
await entityResource.push(entities);
|
|
247545
|
-
await deployFunctionsSequentially(functions, {
|
|
247546
|
-
onStart: options?.onFunctionStart,
|
|
247547
|
-
onResult: options?.onFunctionResult
|
|
247548
|
-
});
|
|
247549
|
-
await agentSkillResource.push(agentSkills);
|
|
247550
|
-
await agentResource.push(agents);
|
|
247551
|
-
await authConfigResource.push(authConfig);
|
|
247552
|
-
const skipConnectorSync = connectors.length === 0 && hasWorkspaceApiKeyAuth();
|
|
247553
|
-
const connectorResults = skipConnectorSync ? [] : (await pushConnectors(connectors)).results;
|
|
247554
|
-
if ((options?.site ?? true) && project.site?.outputDirectory) {
|
|
247555
|
-
const outputDir = resolve3(project.root, project.site.outputDirectory);
|
|
247556
|
-
const { appUrl } = await deploySite(outputDir);
|
|
247557
|
-
return { appUrl, connectorResults };
|
|
247558
|
-
}
|
|
247559
|
-
return { connectorResults };
|
|
247560
|
-
}
|
|
247561
|
-
// src/core/clients/base44-client.ts
|
|
247562
|
-
var retriedRequests = new WeakSet;
|
|
247563
|
-
async function captureRequestBody(request, options) {
|
|
247564
|
-
if (request.body == null) {
|
|
247565
|
-
return;
|
|
247566
|
-
}
|
|
247567
|
-
try {
|
|
247568
|
-
const cloned = request.clone();
|
|
247569
|
-
const text = await cloned.text();
|
|
247570
|
-
options.context.__requestBody = text;
|
|
247571
|
-
} catch {}
|
|
247572
|
-
}
|
|
247573
|
-
async function handleUnauthorized(request, _options, response) {
|
|
247574
|
-
if (response.status !== 401) {
|
|
247575
|
-
return;
|
|
247576
|
-
}
|
|
247577
|
-
if (hasWorkspaceApiKeyAuth()) {
|
|
247578
|
-
return;
|
|
247579
|
-
}
|
|
247580
|
-
if (retriedRequests.has(request)) {
|
|
247581
|
-
return;
|
|
247582
|
-
}
|
|
247583
|
-
const newAccessToken = await refreshAndSaveTokens();
|
|
247584
|
-
if (!newAccessToken) {
|
|
247585
|
-
return;
|
|
247586
|
-
}
|
|
247587
|
-
retriedRequests.add(request);
|
|
247588
|
-
const requestId = request.headers.get("X-Request-ID");
|
|
247589
|
-
return distribution_default(request.clone(), {
|
|
247590
|
-
headers: {
|
|
247591
|
-
...requestId && { "X-Request-ID": requestId },
|
|
247592
|
-
Authorization: `Bearer ${newAccessToken}`
|
|
247593
|
-
}
|
|
247594
|
-
});
|
|
247595
|
-
}
|
|
247596
|
-
var base44Client = distribution_default.create({
|
|
247597
|
-
prefixUrl: getBase44ApiUrl(),
|
|
247598
|
-
headers: {
|
|
247599
|
-
"User-Agent": "Base44 CLI"
|
|
247600
|
-
},
|
|
247601
|
-
hooks: {
|
|
247602
|
-
beforeRequest: [
|
|
247603
|
-
(request) => {
|
|
247604
|
-
request.headers.set("X-Request-ID", randomUUID2());
|
|
247605
|
-
},
|
|
247606
|
-
captureRequestBody,
|
|
247607
|
-
async (request) => {
|
|
247608
|
-
const workspaceApiKey = getWorkspaceApiKeyFromEnv();
|
|
247609
|
-
if (workspaceApiKey && isWorkspaceApiKey(workspaceApiKey)) {
|
|
247610
|
-
request.headers.set("api_key", workspaceApiKey);
|
|
247611
|
-
return;
|
|
247612
|
-
}
|
|
247613
|
-
try {
|
|
247614
|
-
const auth = await readAuth();
|
|
247615
|
-
if (isTokenExpired(auth)) {
|
|
247616
|
-
const newAccessToken = await refreshAndSaveTokens();
|
|
247617
|
-
if (newAccessToken) {
|
|
247618
|
-
request.headers.set("Authorization", `Bearer ${newAccessToken}`);
|
|
247619
|
-
return;
|
|
247620
|
-
}
|
|
247621
|
-
}
|
|
247622
|
-
request.headers.set("Authorization", `Bearer ${auth.accessToken}`);
|
|
247623
|
-
} catch {}
|
|
247624
|
-
}
|
|
247625
|
-
],
|
|
247626
|
-
afterResponse: [handleUnauthorized]
|
|
247627
|
-
}
|
|
247628
|
-
});
|
|
247629
|
-
function getAppClient() {
|
|
247630
|
-
const { id } = getAppContext();
|
|
247631
|
-
return base44Client.extend({
|
|
247632
|
-
prefixUrl: new URL(`/api/apps/${id}/`, getBase44ApiUrl()).href
|
|
247633
|
-
});
|
|
247634
|
-
}
|
|
247635
|
-
function getSandboxClient(appId) {
|
|
247636
|
-
return base44Client.extend({
|
|
247637
|
-
prefixUrl: new URL(`/api/apps/${appId}/sandbox-bridge/`, getBase44ApiUrl()).href
|
|
247638
|
-
});
|
|
247639
|
-
}
|
|
247640
|
-
// src/core/clients/oauth-client.ts
|
|
247641
|
-
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
247642
|
-
var oauthClient = distribution_default.create({
|
|
247643
|
-
prefixUrl: getBase44ApiUrl(),
|
|
247644
|
-
headers: {
|
|
247645
|
-
"User-Agent": "Base44 CLI"
|
|
247646
|
-
},
|
|
247647
|
-
hooks: {
|
|
247648
|
-
beforeRequest: [
|
|
247649
|
-
(request) => {
|
|
247650
|
-
request.headers.set("X-Request-ID", randomUUID3());
|
|
247651
|
-
}
|
|
247652
|
-
]
|
|
247653
|
-
}
|
|
247509
|
+
// src/core/site/deploy-app.ts
|
|
247510
|
+
import { resolve as resolve5 } from "node:path";
|
|
247511
|
+
|
|
247512
|
+
// src/core/deployments/api.ts
|
|
247513
|
+
import { readFile as readFile2 } from "node:fs/promises";
|
|
247514
|
+
|
|
247515
|
+
// src/core/deployments/schema.ts
|
|
247516
|
+
var GIT_HASH_PATTERN = /^[a-fA-F0-9]{7,64}$/;
|
|
247517
|
+
var CreateDeploymentResponseSchema = exports_external.object({
|
|
247518
|
+
deployment_id: exports_external.string(),
|
|
247519
|
+
asset_buckets: exports_external.array(exports_external.array(exports_external.string()))
|
|
247520
|
+
}).transform((data) => ({
|
|
247521
|
+
deploymentId: data.deployment_id,
|
|
247522
|
+
assetBuckets: data.asset_buckets
|
|
247523
|
+
}));
|
|
247524
|
+
var AssetUploadResponseSchema = exports_external.looseObject({
|
|
247525
|
+
result: exports_external.looseObject({ jwt: exports_external.string().nullable().optional() }).nullable().optional()
|
|
247654
247526
|
});
|
|
247655
|
-
|
|
247656
|
-
|
|
247657
|
-
|
|
247658
|
-
|
|
247659
|
-
|
|
247660
|
-
|
|
247661
|
-
|
|
247662
|
-
|
|
247663
|
-
|
|
247664
|
-
|
|
247665
|
-
|
|
247666
|
-
|
|
247667
|
-
|
|
247668
|
-
|
|
247669
|
-
|
|
247670
|
-
|
|
247671
|
-
|
|
247672
|
-
|
|
247673
|
-
|
|
247674
|
-
|
|
247675
|
-
|
|
247676
|
-
searchParams.set("device_code", deviceCode);
|
|
247677
|
-
searchParams.set("client_id", AUTH_CLIENT_ID);
|
|
247678
|
-
const response = await oauthClient.post("oauth/token", {
|
|
247679
|
-
body: searchParams.toString(),
|
|
247680
|
-
headers: {
|
|
247681
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
247682
|
-
},
|
|
247683
|
-
throwHttpErrors: false
|
|
247684
|
-
});
|
|
247685
|
-
const json2 = await response.json();
|
|
247686
|
-
if (!response.ok) {
|
|
247687
|
-
const errorResult = OAuthErrorSchema.safeParse(json2);
|
|
247688
|
-
if (!errorResult.success) {
|
|
247689
|
-
throw new SchemaValidationError("Token request failed", errorResult.error);
|
|
247690
|
-
}
|
|
247691
|
-
const { error: error48, error_description } = errorResult.data;
|
|
247692
|
-
if (error48 === "authorization_pending" || error48 === "slow_down") {
|
|
247693
|
-
return null;
|
|
247694
|
-
}
|
|
247695
|
-
throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
|
|
247696
|
-
statusCode: response.status
|
|
247527
|
+
var FinalizeDeploymentResponseSchema = exports_external.object({
|
|
247528
|
+
deployment_id: exports_external.string()
|
|
247529
|
+
}).transform((data) => ({
|
|
247530
|
+
deploymentId: data.deployment_id
|
|
247531
|
+
}));
|
|
247532
|
+
|
|
247533
|
+
// src/core/deployments/api.ts
|
|
247534
|
+
var MODULE_CONTENT_TYPES = {
|
|
247535
|
+
esm: "application/javascript+module",
|
|
247536
|
+
sourcemap: "application/source-map",
|
|
247537
|
+
wasm: "application/wasm",
|
|
247538
|
+
text: "text/plain",
|
|
247539
|
+
data: "application/octet-stream"
|
|
247540
|
+
};
|
|
247541
|
+
async function createDeployment(request) {
|
|
247542
|
+
const appClient = getAppClient();
|
|
247543
|
+
let response;
|
|
247544
|
+
try {
|
|
247545
|
+
response = await appClient.post("deployments", {
|
|
247546
|
+
json: request,
|
|
247547
|
+
timeout: 120000
|
|
247697
247548
|
});
|
|
247549
|
+
} catch (error48) {
|
|
247550
|
+
throw await ApiError.fromHttpError(error48, "creating deployment");
|
|
247698
247551
|
}
|
|
247699
|
-
const result =
|
|
247552
|
+
const result = CreateDeploymentResponseSchema.safeParse(await response.json());
|
|
247700
247553
|
if (!result.success) {
|
|
247701
|
-
throw new SchemaValidationError("Invalid
|
|
247554
|
+
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
247702
247555
|
}
|
|
247703
247556
|
return result.data;
|
|
247704
247557
|
}
|
|
247705
|
-
async function
|
|
247706
|
-
const
|
|
247707
|
-
|
|
247708
|
-
|
|
247709
|
-
|
|
247710
|
-
|
|
247711
|
-
|
|
247712
|
-
headers: {
|
|
247713
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
247714
|
-
},
|
|
247715
|
-
throwHttpErrors: false
|
|
247558
|
+
async function uploadAssetBucket(deploymentId, formData) {
|
|
247559
|
+
const appClient = getAppClient();
|
|
247560
|
+
const response = await appClient.post(`deployments/${encodeURIComponent(deploymentId)}/assets`, {
|
|
247561
|
+
searchParams: { base64: "true" },
|
|
247562
|
+
body: formData,
|
|
247563
|
+
timeout: 120000,
|
|
247564
|
+
retry: 0
|
|
247716
247565
|
});
|
|
247717
|
-
const
|
|
247718
|
-
|
|
247719
|
-
|
|
247720
|
-
if (!errorResult.success) {
|
|
247721
|
-
throw new ApiError(`Token refresh failed: ${response.statusText}`, {
|
|
247722
|
-
statusCode: response.status
|
|
247723
|
-
});
|
|
247724
|
-
}
|
|
247725
|
-
const { error: error48, error_description } = errorResult.data;
|
|
247726
|
-
throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
|
|
247727
|
-
statusCode: response.status
|
|
247728
|
-
});
|
|
247729
|
-
}
|
|
247730
|
-
const result = TokenResponseSchema.safeParse(json2);
|
|
247731
|
-
if (!result.success) {
|
|
247732
|
-
throw new SchemaValidationError("Invalid token response from server", result.error);
|
|
247733
|
-
}
|
|
247734
|
-
return result.data;
|
|
247566
|
+
const parsed = AssetUploadResponseSchema.safeParse(await response.json());
|
|
247567
|
+
const jwt3 = parsed.success ? parsed.data.result?.jwt : null;
|
|
247568
|
+
return jwt3 || null;
|
|
247735
247569
|
}
|
|
247736
|
-
async function
|
|
247737
|
-
const
|
|
247738
|
-
|
|
247739
|
-
});
|
|
247740
|
-
|
|
247741
|
-
|
|
247742
|
-
|
|
247743
|
-
|
|
247744
|
-
|
|
247745
|
-
const result = UserInfoSchema.safeParse(await response.json());
|
|
247746
|
-
if (!result.success) {
|
|
247747
|
-
throw new SchemaValidationError("Invalid UserInfo response from server", result.error);
|
|
247570
|
+
async function finalizeDeployment(deploymentId, completionJwt, modules) {
|
|
247571
|
+
const appClient = getAppClient();
|
|
247572
|
+
const formData = new FormData;
|
|
247573
|
+
formData.append("payload", JSON.stringify({ completion_jwt: completionJwt }));
|
|
247574
|
+
for (const module of modules) {
|
|
247575
|
+
const content = await readFile2(module.absolutePath);
|
|
247576
|
+
formData.append(module.name, new File([new Uint8Array(content)], module.name, {
|
|
247577
|
+
type: MODULE_CONTENT_TYPES[module.type]
|
|
247578
|
+
}));
|
|
247748
247579
|
}
|
|
247749
|
-
|
|
247750
|
-
}
|
|
247751
|
-
// src/cli/commands/auth/login-flow.ts
|
|
247752
|
-
async function generateAndDisplayDeviceCode(log, runTask) {
|
|
247753
|
-
const deviceCodeResponse = await runTask("Generating device code...", async () => {
|
|
247754
|
-
return await generateDeviceCode();
|
|
247755
|
-
}, {
|
|
247756
|
-
successMessage: "Device code generated",
|
|
247757
|
-
errorMessage: "Failed to generate device code"
|
|
247758
|
-
});
|
|
247759
|
-
log.info(`Verification code: ${theme.styles.bold(deviceCodeResponse.userCode)}` + `
|
|
247760
|
-
Please confirm this code at: ${deviceCodeResponse.verificationUri}`);
|
|
247761
|
-
return deviceCodeResponse;
|
|
247762
|
-
}
|
|
247763
|
-
async function waitForAuthentication(deviceCode, expiresIn, interval, runTask) {
|
|
247764
|
-
let tokenResponse;
|
|
247580
|
+
let response;
|
|
247765
247581
|
try {
|
|
247766
|
-
await
|
|
247767
|
-
await pWaitFor(async () => {
|
|
247768
|
-
const result = await getTokenFromDeviceCode(deviceCode);
|
|
247769
|
-
if (result !== null) {
|
|
247770
|
-
tokenResponse = result;
|
|
247771
|
-
return true;
|
|
247772
|
-
}
|
|
247773
|
-
return false;
|
|
247774
|
-
}, {
|
|
247775
|
-
interval: interval * 1000,
|
|
247776
|
-
timeout: expiresIn * 1000
|
|
247777
|
-
});
|
|
247778
|
-
}, {
|
|
247779
|
-
successMessage: "Authentication completed!",
|
|
247780
|
-
errorMessage: "Authentication failed"
|
|
247781
|
-
});
|
|
247582
|
+
response = await appClient.post(`deployments/${encodeURIComponent(deploymentId)}/finalize`, { body: formData, timeout: 180000 });
|
|
247782
247583
|
} catch (error48) {
|
|
247783
|
-
|
|
247784
|
-
throw new AuthExpiredError("Authentication timed out. Please try again.");
|
|
247785
|
-
}
|
|
247786
|
-
throw error48;
|
|
247787
|
-
}
|
|
247788
|
-
if (tokenResponse === undefined) {
|
|
247789
|
-
throw new InternalError("Failed to retrieve authentication token.");
|
|
247790
|
-
}
|
|
247791
|
-
return tokenResponse;
|
|
247792
|
-
}
|
|
247793
|
-
async function saveAuthData(response, userInfo) {
|
|
247794
|
-
const expiresAt = Date.now() + response.expiresIn * 1000;
|
|
247795
|
-
await writeAuth({
|
|
247796
|
-
accessToken: response.accessToken,
|
|
247797
|
-
refreshToken: response.refreshToken,
|
|
247798
|
-
expiresAt,
|
|
247799
|
-
email: userInfo.email,
|
|
247800
|
-
name: userInfo.name
|
|
247801
|
-
});
|
|
247802
|
-
}
|
|
247803
|
-
async function login({
|
|
247804
|
-
log,
|
|
247805
|
-
runTask
|
|
247806
|
-
}) {
|
|
247807
|
-
const deviceCodeResponse = await generateAndDisplayDeviceCode(log, runTask);
|
|
247808
|
-
const token = await waitForAuthentication(deviceCodeResponse.deviceCode, deviceCodeResponse.expiresIn, deviceCodeResponse.interval, runTask);
|
|
247809
|
-
const userInfo = await getUserInfo(token.accessToken);
|
|
247810
|
-
await saveAuthData(token, userInfo);
|
|
247811
|
-
return {
|
|
247812
|
-
outroMessage: `Successfully logged in as ${theme.styles.bold(userInfo.email)}`
|
|
247813
|
-
};
|
|
247814
|
-
}
|
|
247815
|
-
|
|
247816
|
-
// src/cli/utils/command/middleware.ts
|
|
247817
|
-
async function ensureAuth(ctx) {
|
|
247818
|
-
if (hasWorkspaceApiKeyAuth()) {
|
|
247819
|
-
ctx.errorReporter.setContext({
|
|
247820
|
-
user: { email: "workspace-api-key", name: "Workspace API key" }
|
|
247821
|
-
});
|
|
247822
|
-
return;
|
|
247584
|
+
throw await ApiError.fromHttpError(error48, "finalizing deployment");
|
|
247823
247585
|
}
|
|
247824
|
-
await
|
|
247825
|
-
|
|
247826
|
-
|
|
247827
|
-
ctx.log.info("You need to login first to continue.");
|
|
247828
|
-
await login(ctx);
|
|
247586
|
+
const result = FinalizeDeploymentResponseSchema.safeParse(await response.json());
|
|
247587
|
+
if (!result.success) {
|
|
247588
|
+
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
247829
247589
|
}
|
|
247830
|
-
|
|
247831
|
-
const userInfo = await readAuth();
|
|
247832
|
-
ctx.errorReporter.setContext({
|
|
247833
|
-
user: { email: userInfo.email, name: userInfo.name }
|
|
247834
|
-
});
|
|
247835
|
-
} catch {}
|
|
247836
|
-
}
|
|
247837
|
-
async function ensureAppContext(ctx, options = {}) {
|
|
247838
|
-
const appContext = await initAppContext(options);
|
|
247839
|
-
ctx.app = appContext;
|
|
247840
|
-
ctx.errorReporter.setContext({ appId: appContext.id });
|
|
247590
|
+
return result.data;
|
|
247841
247591
|
}
|
|
247842
|
-
|
|
247843
247592
|
// ../../node_modules/is-plain-obj/index.js
|
|
247844
247593
|
function isPlainObject2(value) {
|
|
247845
247594
|
if (typeof value !== "object" || value === null) {
|
|
@@ -247937,13 +247686,13 @@ var getJoinLength = (uint8Arrays) => {
|
|
|
247937
247686
|
var isTemplateString = (templates) => Array.isArray(templates) && Array.isArray(templates.raw);
|
|
247938
247687
|
var parseTemplates = (templates, expressions) => {
|
|
247939
247688
|
let tokens = [];
|
|
247940
|
-
for (const [index,
|
|
247689
|
+
for (const [index, template] of templates.entries()) {
|
|
247941
247690
|
tokens = parseTemplate({
|
|
247942
247691
|
templates,
|
|
247943
247692
|
expressions,
|
|
247944
247693
|
tokens,
|
|
247945
247694
|
index,
|
|
247946
|
-
template
|
|
247695
|
+
template
|
|
247947
247696
|
});
|
|
247948
247697
|
}
|
|
247949
247698
|
if (tokens.length === 0) {
|
|
@@ -247952,11 +247701,11 @@ var parseTemplates = (templates, expressions) => {
|
|
|
247952
247701
|
const [file2, ...commandArguments] = tokens;
|
|
247953
247702
|
return [file2, commandArguments, {}];
|
|
247954
247703
|
};
|
|
247955
|
-
var parseTemplate = ({ templates, expressions, tokens, index, template
|
|
247956
|
-
if (
|
|
247704
|
+
var parseTemplate = ({ templates, expressions, tokens, index, template }) => {
|
|
247705
|
+
if (template === undefined) {
|
|
247957
247706
|
throw new TypeError(`Invalid backslash sequence: ${templates.raw[index]}`);
|
|
247958
247707
|
}
|
|
247959
|
-
const { nextTokens, leadingWhitespaces, trailingWhitespaces } = splitByWhitespaces(
|
|
247708
|
+
const { nextTokens, leadingWhitespaces, trailingWhitespaces } = splitByWhitespaces(template, templates.raw[index]);
|
|
247960
247709
|
const newTokens = concatTokens(tokens, nextTokens, leadingWhitespaces);
|
|
247961
247710
|
if (index === expressions.length) {
|
|
247962
247711
|
return newTokens;
|
|
@@ -247965,18 +247714,18 @@ var parseTemplate = ({ templates, expressions, tokens, index, template: template
|
|
|
247965
247714
|
const expressionTokens = Array.isArray(expression) ? expression.map((expression2) => parseExpression(expression2)) : [parseExpression(expression)];
|
|
247966
247715
|
return concatTokens(newTokens, expressionTokens, trailingWhitespaces);
|
|
247967
247716
|
};
|
|
247968
|
-
var splitByWhitespaces = (
|
|
247717
|
+
var splitByWhitespaces = (template, rawTemplate) => {
|
|
247969
247718
|
if (rawTemplate.length === 0) {
|
|
247970
247719
|
return { nextTokens: [], leadingWhitespaces: false, trailingWhitespaces: false };
|
|
247971
247720
|
}
|
|
247972
247721
|
const nextTokens = [];
|
|
247973
247722
|
let templateStart = 0;
|
|
247974
247723
|
const leadingWhitespaces = DELIMITERS.has(rawTemplate[0]);
|
|
247975
|
-
for (let templateIndex = 0, rawIndex = 0;templateIndex <
|
|
247724
|
+
for (let templateIndex = 0, rawIndex = 0;templateIndex < template.length; templateIndex += 1, rawIndex += 1) {
|
|
247976
247725
|
const rawCharacter = rawTemplate[rawIndex];
|
|
247977
247726
|
if (DELIMITERS.has(rawCharacter)) {
|
|
247978
247727
|
if (templateStart !== templateIndex) {
|
|
247979
|
-
nextTokens.push(
|
|
247728
|
+
nextTokens.push(template.slice(templateStart, templateIndex));
|
|
247980
247729
|
}
|
|
247981
247730
|
templateStart = templateIndex + 1;
|
|
247982
247731
|
} else if (rawCharacter === "\\") {
|
|
@@ -247992,9 +247741,9 @@ var splitByWhitespaces = (template2, rawTemplate) => {
|
|
|
247992
247741
|
}
|
|
247993
247742
|
}
|
|
247994
247743
|
}
|
|
247995
|
-
const trailingWhitespaces = templateStart ===
|
|
247744
|
+
const trailingWhitespaces = templateStart === template.length;
|
|
247996
247745
|
if (!trailingWhitespaces) {
|
|
247997
|
-
nextTokens.push(
|
|
247746
|
+
nextTokens.push(template.slice(templateStart));
|
|
247998
247747
|
}
|
|
247999
247748
|
return { nextTokens, leadingWhitespaces, trailingWhitespaces };
|
|
248000
247749
|
};
|
|
@@ -249388,8 +249137,8 @@ var disconnect = (anyProcess) => {
|
|
|
249388
249137
|
// ../../node_modules/execa/lib/utils/deferred.js
|
|
249389
249138
|
var createDeferred = () => {
|
|
249390
249139
|
const methods = {};
|
|
249391
|
-
const promise2 = new Promise((
|
|
249392
|
-
Object.assign(methods, { resolve:
|
|
249140
|
+
const promise2 = new Promise((resolve3, reject) => {
|
|
249141
|
+
Object.assign(methods, { resolve: resolve3, reject });
|
|
249393
249142
|
});
|
|
249394
249143
|
return Object.assign(promise2, methods);
|
|
249395
249144
|
};
|
|
@@ -253753,11 +253502,11 @@ var addConcurrentStream = (concurrentStreams, stream, waitName) => {
|
|
|
253753
253502
|
const promises = weakMap.get(stream);
|
|
253754
253503
|
const promise2 = createDeferred();
|
|
253755
253504
|
promises.push(promise2);
|
|
253756
|
-
const
|
|
253757
|
-
return { resolve:
|
|
253505
|
+
const resolve3 = promise2.resolve.bind(promise2);
|
|
253506
|
+
return { resolve: resolve3, promises };
|
|
253758
253507
|
};
|
|
253759
|
-
var waitForConcurrentStreams = async ({ resolve:
|
|
253760
|
-
|
|
253508
|
+
var waitForConcurrentStreams = async ({ resolve: resolve3, promises }, subprocess) => {
|
|
253509
|
+
resolve3();
|
|
253761
253510
|
const [isSubprocessExit] = await Promise.race([
|
|
253762
253511
|
Promise.allSettled([true, subprocess]),
|
|
253763
253512
|
Promise.all([false, ...promises])
|
|
@@ -254336,464 +254085,6 @@ var {
|
|
|
254336
254085
|
getCancelSignal: getCancelSignal2
|
|
254337
254086
|
} = getIpcExport();
|
|
254338
254087
|
|
|
254339
|
-
// src/cli/utils/version-check.ts
|
|
254340
|
-
async function checkForUpgrade() {
|
|
254341
|
-
const testLatestVersion = getTestOverrides()?.latestVersion;
|
|
254342
|
-
if (testLatestVersion !== undefined) {
|
|
254343
|
-
if (testLatestVersion === null) {
|
|
254344
|
-
return null;
|
|
254345
|
-
}
|
|
254346
|
-
const currentVersion = package_default.version;
|
|
254347
|
-
if (testLatestVersion !== currentVersion) {
|
|
254348
|
-
return { currentVersion, latestVersion: testLatestVersion };
|
|
254349
|
-
}
|
|
254350
|
-
return null;
|
|
254351
|
-
}
|
|
254352
|
-
try {
|
|
254353
|
-
const { stdout } = await execa("npm", ["view", "base44", "version"], {
|
|
254354
|
-
timeout: 1000,
|
|
254355
|
-
shell: true,
|
|
254356
|
-
env: { CI: "1" }
|
|
254357
|
-
});
|
|
254358
|
-
const latestVersion = stdout.trim();
|
|
254359
|
-
const currentVersion = package_default.version;
|
|
254360
|
-
if (latestVersion !== currentVersion) {
|
|
254361
|
-
return { currentVersion, latestVersion };
|
|
254362
|
-
}
|
|
254363
|
-
return null;
|
|
254364
|
-
} catch {
|
|
254365
|
-
return null;
|
|
254366
|
-
}
|
|
254367
|
-
}
|
|
254368
|
-
|
|
254369
|
-
// src/cli/utils/upgradeNotification.ts
|
|
254370
|
-
function detectInstallMethod(distribution) {
|
|
254371
|
-
if (distribution !== "binary") {
|
|
254372
|
-
return "npm";
|
|
254373
|
-
}
|
|
254374
|
-
const execPath2 = process.execPath.toLowerCase();
|
|
254375
|
-
if (execPath2.includes("/homebrew/") || execPath2.includes("/cellar/")) {
|
|
254376
|
-
return "brew";
|
|
254377
|
-
}
|
|
254378
|
-
return "binary";
|
|
254379
|
-
}
|
|
254380
|
-
function getUpgradeInstruction(method) {
|
|
254381
|
-
switch (method) {
|
|
254382
|
-
case "npm":
|
|
254383
|
-
return "Run: npm install -g base44@latest";
|
|
254384
|
-
case "brew":
|
|
254385
|
-
return "Run: brew upgrade base44";
|
|
254386
|
-
case "binary":
|
|
254387
|
-
return "Download Base44 CLI from: https://github.com/base44/cli/releases/latest";
|
|
254388
|
-
}
|
|
254389
|
-
}
|
|
254390
|
-
function startUpgradeCheck() {
|
|
254391
|
-
return checkForUpgrade().catch(() => null);
|
|
254392
|
-
}
|
|
254393
|
-
function formatUpgradeMessage(info, distribution) {
|
|
254394
|
-
const { shinyOrange } = theme.colors;
|
|
254395
|
-
const { bold: bold2 } = theme.styles;
|
|
254396
|
-
const instruction = getUpgradeInstruction(detectInstallMethod(distribution));
|
|
254397
|
-
return [
|
|
254398
|
-
shinyOrange(`Update available! ${info.currentVersion} → ${bold2(info.latestVersion)}`),
|
|
254399
|
-
shinyOrange(instruction)
|
|
254400
|
-
].join(`
|
|
254401
|
-
`);
|
|
254402
|
-
}
|
|
254403
|
-
function formatPlainUpgradeMessage(info, distribution) {
|
|
254404
|
-
const instruction = getUpgradeInstruction(detectInstallMethod(distribution));
|
|
254405
|
-
return `Update available: ${info.currentVersion} → ${info.latestVersion}. ${instruction}`;
|
|
254406
|
-
}
|
|
254407
|
-
async function printUpgradeNotification(upgradeCheckPromise, distribution) {
|
|
254408
|
-
try {
|
|
254409
|
-
const upgradeInfo = await upgradeCheckPromise;
|
|
254410
|
-
if (upgradeInfo) {
|
|
254411
|
-
Ve(formatUpgradeMessage(upgradeInfo, distribution));
|
|
254412
|
-
}
|
|
254413
|
-
} catch {}
|
|
254414
|
-
}
|
|
254415
|
-
|
|
254416
|
-
// src/cli/utils/command/render.ts
|
|
254417
|
-
async function showCommandStart(fullBanner) {
|
|
254418
|
-
if (fullBanner) {
|
|
254419
|
-
await printBanner();
|
|
254420
|
-
We("");
|
|
254421
|
-
} else {
|
|
254422
|
-
We(theme.colors.base44OrangeBackground(" Base 44 "));
|
|
254423
|
-
}
|
|
254424
|
-
}
|
|
254425
|
-
async function showCommandEnd(result, upgradeCheckPromise, distribution) {
|
|
254426
|
-
await printUpgradeNotification(upgradeCheckPromise, distribution);
|
|
254427
|
-
Le(result.outroMessage || "");
|
|
254428
|
-
if (result.stdout) {
|
|
254429
|
-
process.stdout.write(result.stdout);
|
|
254430
|
-
}
|
|
254431
|
-
}
|
|
254432
|
-
function showThemedError(error48, context) {
|
|
254433
|
-
const errorMessage = error48 instanceof Error ? error48.message : String(error48);
|
|
254434
|
-
R2.error(errorMessage);
|
|
254435
|
-
if (isCLIError(error48)) {
|
|
254436
|
-
if (error48.details.length > 0) {
|
|
254437
|
-
R2.info(theme.format.details(error48.details));
|
|
254438
|
-
}
|
|
254439
|
-
const hints = theme.format.agentHints(error48.hints);
|
|
254440
|
-
if (hints) {
|
|
254441
|
-
R2.error(hints);
|
|
254442
|
-
}
|
|
254443
|
-
}
|
|
254444
|
-
if (process.env.DEBUG === "1" && error48 instanceof Error && error48.stack) {
|
|
254445
|
-
R2.error(theme.styles.dim(error48.stack));
|
|
254446
|
-
}
|
|
254447
|
-
const errorContext = context.errorReporter.getErrorContext();
|
|
254448
|
-
Le(theme.format.errorContext(errorContext));
|
|
254449
|
-
}
|
|
254450
|
-
function showPlainError(error48) {
|
|
254451
|
-
const errorMessage = error48 instanceof Error ? error48.message : String(error48);
|
|
254452
|
-
process.stderr.write(`Error: ${errorMessage}
|
|
254453
|
-
`);
|
|
254454
|
-
if (isCLIError(error48)) {
|
|
254455
|
-
for (const detail of error48.details) {
|
|
254456
|
-
process.stderr.write(` ${detail}
|
|
254457
|
-
`);
|
|
254458
|
-
}
|
|
254459
|
-
for (const hint of error48.hints) {
|
|
254460
|
-
const cmd = hint.command ? ` (${hint.command})` : "";
|
|
254461
|
-
process.stderr.write(` Hint: ${hint.message}${cmd}
|
|
254462
|
-
`);
|
|
254463
|
-
}
|
|
254464
|
-
}
|
|
254465
|
-
if (process.env.DEBUG === "1" && error48 instanceof Error && error48.stack) {
|
|
254466
|
-
process.stderr.write(`${error48.stack}
|
|
254467
|
-
`);
|
|
254468
|
-
}
|
|
254469
|
-
}
|
|
254470
|
-
|
|
254471
|
-
// src/cli/utils/command/Base44Command.ts
|
|
254472
|
-
function writeJsonSuccess(result) {
|
|
254473
|
-
if (result.stdout) {
|
|
254474
|
-
if (result.outroMessage) {
|
|
254475
|
-
process.stderr.write(`${result.outroMessage}
|
|
254476
|
-
`);
|
|
254477
|
-
}
|
|
254478
|
-
process.stdout.write(result.stdout);
|
|
254479
|
-
return;
|
|
254480
|
-
}
|
|
254481
|
-
process.stdout.write(`${JSON.stringify({ output: stripAnsi(result.outroMessage ?? "") })}
|
|
254482
|
-
`);
|
|
254483
|
-
}
|
|
254484
|
-
function writeJsonError(error48) {
|
|
254485
|
-
const envelope = {
|
|
254486
|
-
error: error48 instanceof Error ? error48.message : String(error48)
|
|
254487
|
-
};
|
|
254488
|
-
if (isCLIError(error48)) {
|
|
254489
|
-
envelope.code = error48.code;
|
|
254490
|
-
if (error48.details.length > 0) {
|
|
254491
|
-
envelope.details = error48.details;
|
|
254492
|
-
}
|
|
254493
|
-
if (error48.hints.length > 0) {
|
|
254494
|
-
envelope.hints = error48.hints;
|
|
254495
|
-
}
|
|
254496
|
-
}
|
|
254497
|
-
process.stdout.write(`${JSON.stringify(envelope)}
|
|
254498
|
-
`);
|
|
254499
|
-
}
|
|
254500
|
-
|
|
254501
|
-
class Base44Command extends Command {
|
|
254502
|
-
_context;
|
|
254503
|
-
_commandOptions;
|
|
254504
|
-
constructor(name2, options) {
|
|
254505
|
-
super(name2);
|
|
254506
|
-
this._commandOptions = {
|
|
254507
|
-
requireAuth: options?.requireAuth ?? true,
|
|
254508
|
-
requireAppContext: options?.requireAppContext ?? true,
|
|
254509
|
-
fullBanner: options?.fullBanner ?? false
|
|
254510
|
-
};
|
|
254511
|
-
}
|
|
254512
|
-
setContext(context) {
|
|
254513
|
-
this._context = context;
|
|
254514
|
-
}
|
|
254515
|
-
get context() {
|
|
254516
|
-
if (!this._context) {
|
|
254517
|
-
throw new Error("Base44Command context not set. Ensure the command is registered via createProgram().");
|
|
254518
|
-
}
|
|
254519
|
-
return this._context;
|
|
254520
|
-
}
|
|
254521
|
-
action(fn) {
|
|
254522
|
-
return super.action(async (...args) => {
|
|
254523
|
-
const jsonMode = this.context.jsonMode;
|
|
254524
|
-
const quiet = this.context.isNonInteractive || jsonMode;
|
|
254525
|
-
if (!quiet) {
|
|
254526
|
-
await showCommandStart(this._commandOptions.fullBanner);
|
|
254527
|
-
}
|
|
254528
|
-
const upgradeCheckPromise = startUpgradeCheck();
|
|
254529
|
-
try {
|
|
254530
|
-
if (this._commandOptions.requireAuth) {
|
|
254531
|
-
await ensureAuth(this.context);
|
|
254532
|
-
}
|
|
254533
|
-
if (this._commandOptions.requireAppContext) {
|
|
254534
|
-
const { appId } = this.optsWithGlobals();
|
|
254535
|
-
await ensureAppContext(this.context, { appId });
|
|
254536
|
-
}
|
|
254537
|
-
const result = await fn(this.context, ...args) ?? {};
|
|
254538
|
-
if (!quiet) {
|
|
254539
|
-
await showCommandEnd(result, upgradeCheckPromise, this.context.distribution);
|
|
254540
|
-
} else if (jsonMode) {
|
|
254541
|
-
writeJsonSuccess(result);
|
|
254542
|
-
const upgradeInfo = await upgradeCheckPromise;
|
|
254543
|
-
if (upgradeInfo) {
|
|
254544
|
-
process.stderr.write(`${formatPlainUpgradeMessage(upgradeInfo, this.context.distribution)}
|
|
254545
|
-
`);
|
|
254546
|
-
}
|
|
254547
|
-
} else {
|
|
254548
|
-
if (result.outroMessage) {
|
|
254549
|
-
process.stdout.write(`${result.outroMessage}
|
|
254550
|
-
`);
|
|
254551
|
-
}
|
|
254552
|
-
if (result.stdout) {
|
|
254553
|
-
process.stdout.write(result.stdout);
|
|
254554
|
-
}
|
|
254555
|
-
const upgradeInfo = await upgradeCheckPromise;
|
|
254556
|
-
if (upgradeInfo) {
|
|
254557
|
-
process.stderr.write(`${formatPlainUpgradeMessage(upgradeInfo, this.context.distribution)}
|
|
254558
|
-
`);
|
|
254559
|
-
}
|
|
254560
|
-
}
|
|
254561
|
-
} catch (error48) {
|
|
254562
|
-
if (jsonMode) {
|
|
254563
|
-
writeJsonError(error48);
|
|
254564
|
-
} else if (quiet) {
|
|
254565
|
-
showPlainError(error48);
|
|
254566
|
-
} else {
|
|
254567
|
-
showThemedError(error48, this.context);
|
|
254568
|
-
}
|
|
254569
|
-
throw error48;
|
|
254570
|
-
}
|
|
254571
|
-
});
|
|
254572
|
-
}
|
|
254573
|
-
}
|
|
254574
|
-
// src/cli/utils/confirm-push.ts
|
|
254575
|
-
async function confirmPush({
|
|
254576
|
-
isNonInteractive,
|
|
254577
|
-
yes,
|
|
254578
|
-
log,
|
|
254579
|
-
warning
|
|
254580
|
-
}) {
|
|
254581
|
-
if (isNonInteractive && !yes) {
|
|
254582
|
-
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
254583
|
-
}
|
|
254584
|
-
if (yes) {
|
|
254585
|
-
return true;
|
|
254586
|
-
}
|
|
254587
|
-
log.warn(warning);
|
|
254588
|
-
const proceed = await Re({
|
|
254589
|
-
message: "Are you sure you want to continue?"
|
|
254590
|
-
});
|
|
254591
|
-
return !Ct(proceed) && proceed;
|
|
254592
|
-
}
|
|
254593
|
-
// src/cli/utils/json.ts
|
|
254594
|
-
function toJsonStdout(result) {
|
|
254595
|
-
return `${JSON.stringify(result, null, 2)}
|
|
254596
|
-
`;
|
|
254597
|
-
}
|
|
254598
|
-
// src/cli/errors.ts
|
|
254599
|
-
class CLIExitError extends Error {
|
|
254600
|
-
code;
|
|
254601
|
-
constructor(code2) {
|
|
254602
|
-
super(`CLI exited with code ${code2}`);
|
|
254603
|
-
this.code = code2;
|
|
254604
|
-
this.name = "CLIExitError";
|
|
254605
|
-
}
|
|
254606
|
-
}
|
|
254607
|
-
|
|
254608
|
-
// src/cli/utils/prompts.ts
|
|
254609
|
-
var onPromptCancel = () => {
|
|
254610
|
-
Ne("Operation cancelled.");
|
|
254611
|
-
throw new CLIExitError(0);
|
|
254612
|
-
};
|
|
254613
|
-
// src/cli/utils/runTask.ts
|
|
254614
|
-
function createInteractiveRunTask() {
|
|
254615
|
-
return async (startMessage, operation, options) => {
|
|
254616
|
-
const s = bt2();
|
|
254617
|
-
s.start(startMessage);
|
|
254618
|
-
const updateMessage = (message) => s.message(message);
|
|
254619
|
-
try {
|
|
254620
|
-
const result = await operation(updateMessage);
|
|
254621
|
-
s.stop(options?.successMessage || startMessage);
|
|
254622
|
-
return result;
|
|
254623
|
-
} catch (error48) {
|
|
254624
|
-
s.error(options?.errorMessage || "Failed");
|
|
254625
|
-
throw error48;
|
|
254626
|
-
}
|
|
254627
|
-
};
|
|
254628
|
-
}
|
|
254629
|
-
function createSimpleRunTask(log) {
|
|
254630
|
-
return async (startMessage, operation, options) => {
|
|
254631
|
-
log.info(startMessage);
|
|
254632
|
-
const updateMessage = (message) => log.info(message);
|
|
254633
|
-
try {
|
|
254634
|
-
const result = await operation(updateMessage);
|
|
254635
|
-
log.success(options?.successMessage || startMessage);
|
|
254636
|
-
return result;
|
|
254637
|
-
} catch (error48) {
|
|
254638
|
-
log.error(options?.errorMessage || "Failed");
|
|
254639
|
-
throw error48;
|
|
254640
|
-
}
|
|
254641
|
-
};
|
|
254642
|
-
}
|
|
254643
|
-
// src/cli/utils/stdin.ts
|
|
254644
|
-
async function readStdin(flagName = "--stdin", options = {}) {
|
|
254645
|
-
if (process.stdin.isTTY) {
|
|
254646
|
-
throw new InvalidInputError(`${flagName} requires piped input (e.g., echo <value> | base44 ...)`);
|
|
254647
|
-
}
|
|
254648
|
-
const chunks = [];
|
|
254649
|
-
for await (const chunk of process.stdin) {
|
|
254650
|
-
chunks.push(chunk);
|
|
254651
|
-
}
|
|
254652
|
-
const text = Buffer.concat(chunks).toString("utf-8");
|
|
254653
|
-
return options.trim === false ? text : text.trim();
|
|
254654
|
-
}
|
|
254655
|
-
|
|
254656
|
-
// src/cli/utils/secret-input.ts
|
|
254657
|
-
async function resolveSecret(options) {
|
|
254658
|
-
if (options.fromStdin) {
|
|
254659
|
-
const value = await readStdin("--client-secret-stdin");
|
|
254660
|
-
if (value)
|
|
254661
|
-
return value;
|
|
254662
|
-
}
|
|
254663
|
-
if (options.flagValue) {
|
|
254664
|
-
return options.flagValue;
|
|
254665
|
-
}
|
|
254666
|
-
if (options.envVar) {
|
|
254667
|
-
const envValue = process.env[options.envVar];
|
|
254668
|
-
if (envValue)
|
|
254669
|
-
return envValue;
|
|
254670
|
-
}
|
|
254671
|
-
if (!options.isNonInteractive) {
|
|
254672
|
-
const value = await He({
|
|
254673
|
-
message: options.promptMessage,
|
|
254674
|
-
validate: (v) => {
|
|
254675
|
-
if (!v || v.trim().length === 0) {
|
|
254676
|
-
return `${options.name} is required`;
|
|
254677
|
-
}
|
|
254678
|
-
}
|
|
254679
|
-
});
|
|
254680
|
-
if (Ct(value)) {
|
|
254681
|
-
throw new CLIExitError(0);
|
|
254682
|
-
}
|
|
254683
|
-
return value;
|
|
254684
|
-
}
|
|
254685
|
-
throw new InvalidInputError(`Missing required ${options.name}.`, {
|
|
254686
|
-
hints: options.hints ?? [
|
|
254687
|
-
{
|
|
254688
|
-
message: `Provide the ${options.name} via flag, stdin, or environment variable (${options.envVar ?? "N/A"})`
|
|
254689
|
-
}
|
|
254690
|
-
]
|
|
254691
|
-
});
|
|
254692
|
-
}
|
|
254693
|
-
// src/cli/utils/urls.ts
|
|
254694
|
-
function getDashboardUrl(projectId) {
|
|
254695
|
-
const id = projectId ?? getAppContext().id;
|
|
254696
|
-
return `${getBase44ApiUrl()}/apps/${id}/editor/workspace/overview`;
|
|
254697
|
-
}
|
|
254698
|
-
function getConnectorsUrl(projectId) {
|
|
254699
|
-
const id = projectId ?? getAppContext().id;
|
|
254700
|
-
return `${getBase44ApiUrl()}/apps/${id}/editor/workspace/app-connections`;
|
|
254701
|
-
}
|
|
254702
|
-
// src/cli/utils/yaml.ts
|
|
254703
|
-
var import_lodash = __toESM(require_lodash8(), 1);
|
|
254704
|
-
var YAML_INDENT = 2;
|
|
254705
|
-
var stripEmptyReplacer = (_key, value) => {
|
|
254706
|
-
if (typeof value === "number" || typeof value === "boolean")
|
|
254707
|
-
return value;
|
|
254708
|
-
if (import_lodash.isEmpty(value))
|
|
254709
|
-
return;
|
|
254710
|
-
return value;
|
|
254711
|
-
};
|
|
254712
|
-
function formatYaml(data, options = {}) {
|
|
254713
|
-
const { stripEmpty = true } = options;
|
|
254714
|
-
const replacer = stripEmpty ? stripEmptyReplacer : undefined;
|
|
254715
|
-
return $stringify(data, replacer, { indent: YAML_INDENT }).trimEnd();
|
|
254716
|
-
}
|
|
254717
|
-
// src/core/deployments/api.ts
|
|
254718
|
-
import { readFile as readFile2 } from "node:fs/promises";
|
|
254719
|
-
|
|
254720
|
-
// src/core/deployments/schema.ts
|
|
254721
|
-
var GIT_HASH_PATTERN = /^[a-fA-F0-9]{7,64}$/;
|
|
254722
|
-
var CreateDeploymentResponseSchema = exports_external.object({
|
|
254723
|
-
deployment_id: exports_external.string(),
|
|
254724
|
-
asset_buckets: exports_external.array(exports_external.array(exports_external.string()))
|
|
254725
|
-
}).transform((data) => ({
|
|
254726
|
-
deploymentId: data.deployment_id,
|
|
254727
|
-
assetBuckets: data.asset_buckets
|
|
254728
|
-
}));
|
|
254729
|
-
var AssetUploadResponseSchema = exports_external.looseObject({
|
|
254730
|
-
result: exports_external.looseObject({ jwt: exports_external.string().nullable().optional() }).nullable().optional()
|
|
254731
|
-
});
|
|
254732
|
-
var FinalizeDeploymentResponseSchema = exports_external.object({
|
|
254733
|
-
deployment_id: exports_external.string()
|
|
254734
|
-
}).transform((data) => ({
|
|
254735
|
-
deploymentId: data.deployment_id
|
|
254736
|
-
}));
|
|
254737
|
-
|
|
254738
|
-
// src/core/deployments/api.ts
|
|
254739
|
-
var MODULE_CONTENT_TYPES = {
|
|
254740
|
-
esm: "application/javascript+module",
|
|
254741
|
-
sourcemap: "application/source-map",
|
|
254742
|
-
wasm: "application/wasm",
|
|
254743
|
-
text: "text/plain",
|
|
254744
|
-
data: "application/octet-stream"
|
|
254745
|
-
};
|
|
254746
|
-
async function createDeployment(request) {
|
|
254747
|
-
const appClient = getAppClient();
|
|
254748
|
-
let response;
|
|
254749
|
-
try {
|
|
254750
|
-
response = await appClient.post("deployments", {
|
|
254751
|
-
json: request,
|
|
254752
|
-
timeout: 120000
|
|
254753
|
-
});
|
|
254754
|
-
} catch (error48) {
|
|
254755
|
-
throw await ApiError.fromHttpError(error48, "creating deployment");
|
|
254756
|
-
}
|
|
254757
|
-
const result = CreateDeploymentResponseSchema.safeParse(await response.json());
|
|
254758
|
-
if (!result.success) {
|
|
254759
|
-
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
254760
|
-
}
|
|
254761
|
-
return result.data;
|
|
254762
|
-
}
|
|
254763
|
-
async function uploadAssetBucket(deploymentId, formData) {
|
|
254764
|
-
const appClient = getAppClient();
|
|
254765
|
-
const response = await appClient.post(`deployments/${encodeURIComponent(deploymentId)}/assets`, {
|
|
254766
|
-
searchParams: { base64: "true" },
|
|
254767
|
-
body: formData,
|
|
254768
|
-
timeout: 120000,
|
|
254769
|
-
retry: 0
|
|
254770
|
-
});
|
|
254771
|
-
const parsed = AssetUploadResponseSchema.safeParse(await response.json());
|
|
254772
|
-
const jwt3 = parsed.success ? parsed.data.result?.jwt : null;
|
|
254773
|
-
return jwt3 || null;
|
|
254774
|
-
}
|
|
254775
|
-
async function finalizeDeployment(deploymentId, completionJwt, modules) {
|
|
254776
|
-
const appClient = getAppClient();
|
|
254777
|
-
const formData = new FormData;
|
|
254778
|
-
formData.append("payload", JSON.stringify({ completion_jwt: completionJwt }));
|
|
254779
|
-
for (const module of modules) {
|
|
254780
|
-
const content = await readFile2(module.absolutePath);
|
|
254781
|
-
formData.append(module.name, new File([new Uint8Array(content)], module.name, {
|
|
254782
|
-
type: MODULE_CONTENT_TYPES[module.type]
|
|
254783
|
-
}));
|
|
254784
|
-
}
|
|
254785
|
-
let response;
|
|
254786
|
-
try {
|
|
254787
|
-
response = await appClient.post(`deployments/${encodeURIComponent(deploymentId)}/finalize`, { body: formData, timeout: 180000 });
|
|
254788
|
-
} catch (error48) {
|
|
254789
|
-
throw await ApiError.fromHttpError(error48, "finalizing deployment");
|
|
254790
|
-
}
|
|
254791
|
-
const result = FinalizeDeploymentResponseSchema.safeParse(await response.json());
|
|
254792
|
-
if (!result.success) {
|
|
254793
|
-
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
254794
|
-
}
|
|
254795
|
-
return result.data;
|
|
254796
|
-
}
|
|
254797
254088
|
// src/core/deployments/manifest.ts
|
|
254798
254089
|
import { createHash } from "node:crypto";
|
|
254799
254090
|
import { readdir as readdir2, readFile as readFile3, stat } from "node:fs/promises";
|
|
@@ -254946,7 +254237,7 @@ async function collectFilePaths(dir, relativeDir, isIgnored) {
|
|
|
254946
254237
|
|
|
254947
254238
|
// src/core/deployments/modules.ts
|
|
254948
254239
|
import { stat as stat2 } from "node:fs/promises";
|
|
254949
|
-
import { relative as relative3, resolve as
|
|
254240
|
+
import { relative as relative3, resolve as resolve3, sep } from "node:path";
|
|
254950
254241
|
var MAX_TOTAL_MODULE_BYTES = 40 * 1024 * 1024;
|
|
254951
254242
|
var MODULE_IGNORE = ["wrangler.json", ".dev.vars"];
|
|
254952
254243
|
var RULE_TYPE_TO_MODULE_TYPE = {
|
|
@@ -254958,15 +254249,15 @@ var RULE_TYPE_TO_MODULE_TYPE = {
|
|
|
254958
254249
|
function toPosix(path16) {
|
|
254959
254250
|
return path16.split(sep).join("/");
|
|
254960
254251
|
}
|
|
254961
|
-
async function collectModules(
|
|
254962
|
-
const entryPath =
|
|
254252
|
+
async function collectModules(config9) {
|
|
254253
|
+
const entryPath = resolve3(config9.configDir, config9.main);
|
|
254963
254254
|
if (!await pathExists(entryPath)) {
|
|
254964
|
-
throw new InvalidInputError(`Worker entry module does not exist: ${entryPath} (from "main" in ${
|
|
254255
|
+
throw new InvalidInputError(`Worker entry module does not exist: ${entryPath} (from "main" in ${config9.configPath})`, {
|
|
254965
254256
|
hints: [{ message: "Rebuild the project to regenerate the artifact" }]
|
|
254966
254257
|
});
|
|
254967
254258
|
}
|
|
254968
254259
|
const modulesByName = new Map;
|
|
254969
|
-
const entryName = toPosix(relative3(
|
|
254260
|
+
const entryName = toPosix(relative3(config9.configDir, entryPath));
|
|
254970
254261
|
modulesByName.set(entryName, {
|
|
254971
254262
|
name: entryName,
|
|
254972
254263
|
absolutePath: entryPath,
|
|
@@ -254974,16 +254265,16 @@ async function collectModules(config12) {
|
|
|
254974
254265
|
type: "esm"
|
|
254975
254266
|
});
|
|
254976
254267
|
const ignore = [...MODULE_IGNORE];
|
|
254977
|
-
if (
|
|
254978
|
-
ignore.push(`${toPosix(relative3(
|
|
254268
|
+
if (config9.assetsDirectory?.startsWith(config9.configDir + sep)) {
|
|
254269
|
+
ignore.push(`${toPosix(relative3(config9.configDir, config9.assetsDirectory))}/**`);
|
|
254979
254270
|
}
|
|
254980
|
-
for (const rule of
|
|
254271
|
+
for (const rule of config9.rules) {
|
|
254981
254272
|
const type = RULE_TYPE_TO_MODULE_TYPE[rule.type];
|
|
254982
254273
|
if (!type) {
|
|
254983
|
-
throw new InvalidInputError(`Unsupported module rule type "${rule.type}" in ${
|
|
254274
|
+
throw new InvalidInputError(`Unsupported module rule type "${rule.type}" in ${config9.configPath}. Supported: ${Object.keys(RULE_TYPE_TO_MODULE_TYPE).join(", ")}.`);
|
|
254984
254275
|
}
|
|
254985
254276
|
const matches = await globby(rule.globs, {
|
|
254986
|
-
cwd:
|
|
254277
|
+
cwd: config9.configDir,
|
|
254987
254278
|
onlyFiles: true,
|
|
254988
254279
|
dot: true,
|
|
254989
254280
|
ignore
|
|
@@ -254992,28 +254283,28 @@ async function collectModules(config12) {
|
|
|
254992
254283
|
if (!modulesByName.has(match)) {
|
|
254993
254284
|
modulesByName.set(match, {
|
|
254994
254285
|
name: match,
|
|
254995
|
-
absolutePath:
|
|
254286
|
+
absolutePath: resolve3(config9.configDir, match),
|
|
254996
254287
|
size: 0,
|
|
254997
254288
|
type
|
|
254998
254289
|
});
|
|
254999
254290
|
}
|
|
255000
254291
|
}
|
|
255001
254292
|
}
|
|
255002
|
-
if (
|
|
254293
|
+
if (config9.uploadSourceMaps) {
|
|
255003
254294
|
const maps = await globby("**/*.map", {
|
|
255004
|
-
cwd:
|
|
254295
|
+
cwd: config9.configDir,
|
|
255005
254296
|
onlyFiles: true,
|
|
255006
254297
|
dot: true,
|
|
255007
254298
|
ignore
|
|
255008
254299
|
});
|
|
255009
254300
|
for (const map2 of maps.sort()) {
|
|
255010
|
-
addSourcemap(modulesByName,
|
|
254301
|
+
addSourcemap(modulesByName, config9.configDir, map2);
|
|
255011
254302
|
}
|
|
255012
254303
|
} else {
|
|
255013
254304
|
for (const name2 of [...modulesByName.keys()]) {
|
|
255014
254305
|
const mapName = `${name2}.map`;
|
|
255015
|
-
if (await pathExists(
|
|
255016
|
-
addSourcemap(modulesByName,
|
|
254306
|
+
if (await pathExists(resolve3(config9.configDir, mapName))) {
|
|
254307
|
+
addSourcemap(modulesByName, config9.configDir, mapName);
|
|
255017
254308
|
}
|
|
255018
254309
|
}
|
|
255019
254310
|
}
|
|
@@ -255033,7 +254324,7 @@ function addSourcemap(modulesByName, configDir, name2) {
|
|
|
255033
254324
|
return;
|
|
255034
254325
|
modulesByName.set(name2, {
|
|
255035
254326
|
name: name2,
|
|
255036
|
-
absolutePath:
|
|
254327
|
+
absolutePath: resolve3(configDir, name2),
|
|
255037
254328
|
size: 0,
|
|
255038
254329
|
type: "sourcemap"
|
|
255039
254330
|
});
|
|
@@ -255116,11 +254407,11 @@ async function buildBucketForm(bucket, filesByHash) {
|
|
|
255116
254407
|
return formData;
|
|
255117
254408
|
}
|
|
255118
254409
|
function sleep3(ms) {
|
|
255119
|
-
return new Promise((
|
|
254410
|
+
return new Promise((resolve4) => setTimeout(resolve4, ms));
|
|
255120
254411
|
}
|
|
255121
254412
|
|
|
255122
254413
|
// src/core/deployments/wrangler-config.ts
|
|
255123
|
-
import { dirname as dirname10, join as join16, resolve as
|
|
254414
|
+
import { dirname as dirname10, join as join16, resolve as resolve4 } from "node:path";
|
|
255124
254415
|
var WRANGLER_REDIRECT_PATH = join16(".wrangler", "deploy", "config.json");
|
|
255125
254416
|
var RedirectConfigSchema = exports_external.looseObject({
|
|
255126
254417
|
configPath: exports_external.string().min(1)
|
|
@@ -255175,26 +254466,26 @@ async function resolveWranglerConfig(projectRoot) {
|
|
|
255175
254466
|
if (!result.success) {
|
|
255176
254467
|
throw new ConfigInvalidError(`Invalid wrangler config: ${exports_external.prettifyError(result.error)}`, configPath);
|
|
255177
254468
|
}
|
|
255178
|
-
const
|
|
255179
|
-
if (
|
|
254469
|
+
const config9 = result.data;
|
|
254470
|
+
if (config9.no_bundle !== true) {
|
|
255180
254471
|
throw new InvalidInputError("This framework's output requires bundling; not yet supported. Base44 full-stack deploys only support pre-bundled Workers output (no_bundle: true).");
|
|
255181
254472
|
}
|
|
255182
254473
|
const configDir = dirname10(configPath);
|
|
255183
|
-
const assetsDirectory =
|
|
254474
|
+
const assetsDirectory = config9.assets?.directory ? resolve4(configDir, config9.assets.directory) : null;
|
|
255184
254475
|
return {
|
|
255185
254476
|
configPath,
|
|
255186
254477
|
configDir,
|
|
255187
|
-
main:
|
|
254478
|
+
main: config9.main,
|
|
255188
254479
|
assetsDirectory,
|
|
255189
|
-
assetsConfig:
|
|
255190
|
-
compatibilityDate:
|
|
255191
|
-
compatibilityFlags:
|
|
255192
|
-
vars:
|
|
255193
|
-
rules: (
|
|
254480
|
+
assetsConfig: config9.assets ? toResolvedAssetsConfig(config9.assets) : null,
|
|
254481
|
+
compatibilityDate: config9.compatibility_date ?? null,
|
|
254482
|
+
compatibilityFlags: config9.compatibility_flags ?? [],
|
|
254483
|
+
vars: config9.vars ?? {},
|
|
254484
|
+
rules: (config9.rules ?? []).map((rule) => ({
|
|
255194
254485
|
type: rule.type,
|
|
255195
254486
|
globs: rule.globs
|
|
255196
254487
|
})),
|
|
255197
|
-
uploadSourceMaps:
|
|
254488
|
+
uploadSourceMaps: config9.upload_source_maps ?? false
|
|
255198
254489
|
};
|
|
255199
254490
|
}
|
|
255200
254491
|
async function resolveRedirectedConfigPath(redirectPath) {
|
|
@@ -255203,7 +254494,7 @@ async function resolveRedirectedConfigPath(redirectPath) {
|
|
|
255203
254494
|
if (!result.success) {
|
|
255204
254495
|
throw new ConfigInvalidError(`Invalid deploy redirect file: ${exports_external.prettifyError(result.error)}`, redirectPath);
|
|
255205
254496
|
}
|
|
255206
|
-
const configPath =
|
|
254497
|
+
const configPath = resolve4(dirname10(redirectPath), result.data.configPath);
|
|
255207
254498
|
if (!await pathExists(configPath)) {
|
|
255208
254499
|
throw new ConfigInvalidError(`Wrangler config referenced by ${redirectPath} does not exist: ${configPath}`, redirectPath, {
|
|
255209
254500
|
hints: [{ message: "Rebuild the project to regenerate the artifact" }]
|
|
@@ -255247,25 +254538,25 @@ async function gitHead(projectRoot) {
|
|
|
255247
254538
|
}
|
|
255248
254539
|
async function deployFullStack(options) {
|
|
255249
254540
|
const { projectRoot, gitHash, progress } = options;
|
|
255250
|
-
const
|
|
255251
|
-
if (!
|
|
254541
|
+
const config9 = await resolveWranglerConfig(projectRoot);
|
|
254542
|
+
if (!config9.compatibilityFlags.includes("nodejs_compat")) {
|
|
255252
254543
|
progress?.onWarning?.("The wrangler config has no 'nodejs_compat' compatibility flag; Node.js built-ins will be unavailable at runtime. Enable it in your framework's Cloudflare adapter settings if your server code needs Node APIs.");
|
|
255253
254544
|
}
|
|
255254
|
-
if (
|
|
254545
|
+
if (config9.vars && Object.keys(config9.vars).length > 0) {
|
|
255255
254546
|
progress?.onWarning?.("wrangler 'vars' are not supported and were ignored — a worker's environment comes from the app's secrets (base44 secrets set).");
|
|
255256
254547
|
}
|
|
255257
|
-
const modules = await collectModules(
|
|
254548
|
+
const modules = await collectModules(config9);
|
|
255258
254549
|
let assets = { manifest: {}, filesByHash: new Map };
|
|
255259
|
-
if (
|
|
255260
|
-
assets = await buildAssetManifest(
|
|
254550
|
+
if (config9.assetsDirectory && await pathExists(config9.assetsDirectory)) {
|
|
254551
|
+
assets = await buildAssetManifest(config9.assetsDirectory, getAppContext().id);
|
|
255261
254552
|
}
|
|
255262
254553
|
const created = await createDeployment({
|
|
255263
254554
|
git_hash: gitHash,
|
|
255264
254555
|
config: {
|
|
255265
|
-
main:
|
|
255266
|
-
compatibility_date:
|
|
255267
|
-
compatibility_flags:
|
|
255268
|
-
assets: buildAssetsConfig(
|
|
254556
|
+
main: config9.main,
|
|
254557
|
+
compatibility_date: config9.compatibilityDate,
|
|
254558
|
+
compatibility_flags: config9.compatibilityFlags,
|
|
254559
|
+
assets: buildAssetsConfig(config9.assetsConfig, progress)
|
|
255269
254560
|
},
|
|
255270
254561
|
asset_manifest: assets.manifest
|
|
255271
254562
|
});
|
|
@@ -255295,6 +254586,757 @@ function buildAssetsConfig(assetsConfig, progress) {
|
|
|
255295
254586
|
run_worker_first: runWorkerFirst
|
|
255296
254587
|
};
|
|
255297
254588
|
}
|
|
254589
|
+
// src/core/site/deploy-app.ts
|
|
254590
|
+
async function planAppDeploy(target) {
|
|
254591
|
+
if (await detectFullStackArtifact(target.root)) {
|
|
254592
|
+
return { kind: "full-stack" };
|
|
254593
|
+
}
|
|
254594
|
+
const outputDirectory = target.site?.outputDirectory;
|
|
254595
|
+
return outputDirectory ? { kind: "static", outputDir: resolve5(target.root, outputDirectory) } : { kind: "none" };
|
|
254596
|
+
}
|
|
254597
|
+
async function detectAppDeployKind(target) {
|
|
254598
|
+
return (await planAppDeploy(target)).kind;
|
|
254599
|
+
}
|
|
254600
|
+
async function hasBuiltArtifact(target) {
|
|
254601
|
+
const plan = await planAppDeploy(target);
|
|
254602
|
+
if (plan.kind === "full-stack")
|
|
254603
|
+
return true;
|
|
254604
|
+
if (plan.kind === "none")
|
|
254605
|
+
return false;
|
|
254606
|
+
return await pathExists(plan.outputDir);
|
|
254607
|
+
}
|
|
254608
|
+
async function deployAppSite(target, options = {}) {
|
|
254609
|
+
const plan = await planAppDeploy(target);
|
|
254610
|
+
switch (plan.kind) {
|
|
254611
|
+
case "full-stack": {
|
|
254612
|
+
const gitHash = await resolveGitHash(target.root, options.gitHash);
|
|
254613
|
+
const { deploymentId } = await deployFullStack({
|
|
254614
|
+
projectRoot: target.root,
|
|
254615
|
+
gitHash,
|
|
254616
|
+
progress: options.progress
|
|
254617
|
+
});
|
|
254618
|
+
return { kind: "full-stack", deploymentId, gitHash };
|
|
254619
|
+
}
|
|
254620
|
+
case "static": {
|
|
254621
|
+
const { appUrl } = await deploySite(plan.outputDir);
|
|
254622
|
+
return { kind: "static", appUrl };
|
|
254623
|
+
}
|
|
254624
|
+
case "none":
|
|
254625
|
+
return { kind: "none" };
|
|
254626
|
+
}
|
|
254627
|
+
}
|
|
254628
|
+
// src/core/project/deploy.ts
|
|
254629
|
+
function hasResourcesToDeploy(projectData) {
|
|
254630
|
+
const {
|
|
254631
|
+
project,
|
|
254632
|
+
entities,
|
|
254633
|
+
functions,
|
|
254634
|
+
agents,
|
|
254635
|
+
agentSkills,
|
|
254636
|
+
connectors,
|
|
254637
|
+
authConfig
|
|
254638
|
+
} = projectData;
|
|
254639
|
+
const hasSite = Boolean(project.site?.outputDirectory || project.site?.buildCommand);
|
|
254640
|
+
const hasEntities = entities.length > 0;
|
|
254641
|
+
const hasFunctions = functions.length > 0;
|
|
254642
|
+
const hasAgents = agents.length > 0;
|
|
254643
|
+
const hasAgentSkills = agentSkills.length > 0;
|
|
254644
|
+
const hasConnectors = connectors.length > 0;
|
|
254645
|
+
const hasAuthConfig = authConfig.length > 0;
|
|
254646
|
+
const hasVisibility = Boolean(project.visibility);
|
|
254647
|
+
return hasEntities || hasFunctions || hasAgents || hasAgentSkills || hasConnectors || hasAuthConfig || hasVisibility || hasSite;
|
|
254648
|
+
}
|
|
254649
|
+
async function deployAll(projectData, options) {
|
|
254650
|
+
const {
|
|
254651
|
+
project,
|
|
254652
|
+
entities,
|
|
254653
|
+
functions,
|
|
254654
|
+
agents,
|
|
254655
|
+
agentSkills,
|
|
254656
|
+
connectors,
|
|
254657
|
+
authConfig
|
|
254658
|
+
} = projectData;
|
|
254659
|
+
await setAppVisibility(project.visibility);
|
|
254660
|
+
if (project.visibility) {
|
|
254661
|
+
options?.onVisibilitySet?.(project.visibility);
|
|
254662
|
+
}
|
|
254663
|
+
await entityResource.push(entities);
|
|
254664
|
+
await deployFunctionsSequentially(functions, {
|
|
254665
|
+
onStart: options?.onFunctionStart,
|
|
254666
|
+
onResult: options?.onFunctionResult
|
|
254667
|
+
});
|
|
254668
|
+
await agentSkillResource.push(agentSkills);
|
|
254669
|
+
await agentResource.push(agents);
|
|
254670
|
+
await authConfigResource.push(authConfig);
|
|
254671
|
+
const skipConnectorSync = connectors.length === 0 && hasWorkspaceApiKeyAuth();
|
|
254672
|
+
const connectorResults = skipConnectorSync ? [] : (await pushConnectors(connectors)).results;
|
|
254673
|
+
if ((options?.site ?? true) && project.site?.outputDirectory) {
|
|
254674
|
+
const outputDir = resolve6(project.root, project.site.outputDirectory);
|
|
254675
|
+
const { appUrl } = await deploySite(outputDir);
|
|
254676
|
+
return { appUrl, connectorResults };
|
|
254677
|
+
}
|
|
254678
|
+
return { connectorResults };
|
|
254679
|
+
}
|
|
254680
|
+
// src/core/clients/base44-client.ts
|
|
254681
|
+
var retriedRequests = new WeakSet;
|
|
254682
|
+
async function captureRequestBody(request, options) {
|
|
254683
|
+
if (request.body == null) {
|
|
254684
|
+
return;
|
|
254685
|
+
}
|
|
254686
|
+
try {
|
|
254687
|
+
const cloned = request.clone();
|
|
254688
|
+
const text = await cloned.text();
|
|
254689
|
+
options.context.__requestBody = text;
|
|
254690
|
+
} catch {}
|
|
254691
|
+
}
|
|
254692
|
+
async function handleUnauthorized(request, _options, response) {
|
|
254693
|
+
if (response.status !== 401) {
|
|
254694
|
+
return;
|
|
254695
|
+
}
|
|
254696
|
+
if (hasWorkspaceApiKeyAuth()) {
|
|
254697
|
+
return;
|
|
254698
|
+
}
|
|
254699
|
+
if (retriedRequests.has(request)) {
|
|
254700
|
+
return;
|
|
254701
|
+
}
|
|
254702
|
+
const newAccessToken = await refreshAndSaveTokens();
|
|
254703
|
+
if (!newAccessToken) {
|
|
254704
|
+
return;
|
|
254705
|
+
}
|
|
254706
|
+
retriedRequests.add(request);
|
|
254707
|
+
const requestId = request.headers.get("X-Request-ID");
|
|
254708
|
+
return distribution_default(request.clone(), {
|
|
254709
|
+
headers: {
|
|
254710
|
+
...requestId && { "X-Request-ID": requestId },
|
|
254711
|
+
Authorization: `Bearer ${newAccessToken}`
|
|
254712
|
+
}
|
|
254713
|
+
});
|
|
254714
|
+
}
|
|
254715
|
+
var base44Client = distribution_default.create({
|
|
254716
|
+
prefixUrl: getBase44ApiUrl(),
|
|
254717
|
+
headers: {
|
|
254718
|
+
"User-Agent": "Base44 CLI"
|
|
254719
|
+
},
|
|
254720
|
+
hooks: {
|
|
254721
|
+
beforeRequest: [
|
|
254722
|
+
(request) => {
|
|
254723
|
+
request.headers.set("X-Request-ID", randomUUID2());
|
|
254724
|
+
},
|
|
254725
|
+
captureRequestBody,
|
|
254726
|
+
async (request) => {
|
|
254727
|
+
const workspaceApiKey = getWorkspaceApiKeyFromEnv();
|
|
254728
|
+
if (workspaceApiKey && isWorkspaceApiKey(workspaceApiKey)) {
|
|
254729
|
+
request.headers.set("api_key", workspaceApiKey);
|
|
254730
|
+
return;
|
|
254731
|
+
}
|
|
254732
|
+
try {
|
|
254733
|
+
const auth = await readAuth();
|
|
254734
|
+
if (isTokenExpired(auth)) {
|
|
254735
|
+
const newAccessToken = await refreshAndSaveTokens();
|
|
254736
|
+
if (newAccessToken) {
|
|
254737
|
+
request.headers.set("Authorization", `Bearer ${newAccessToken}`);
|
|
254738
|
+
return;
|
|
254739
|
+
}
|
|
254740
|
+
}
|
|
254741
|
+
request.headers.set("Authorization", `Bearer ${auth.accessToken}`);
|
|
254742
|
+
} catch {}
|
|
254743
|
+
}
|
|
254744
|
+
],
|
|
254745
|
+
afterResponse: [handleUnauthorized]
|
|
254746
|
+
}
|
|
254747
|
+
});
|
|
254748
|
+
function getAppClient() {
|
|
254749
|
+
const { id } = getAppContext();
|
|
254750
|
+
return base44Client.extend({
|
|
254751
|
+
prefixUrl: new URL(`/api/apps/${id}/`, getBase44ApiUrl()).href
|
|
254752
|
+
});
|
|
254753
|
+
}
|
|
254754
|
+
function getSandboxClient(appId) {
|
|
254755
|
+
return base44Client.extend({
|
|
254756
|
+
prefixUrl: new URL(`/api/apps/${appId}/sandbox-bridge/`, getBase44ApiUrl()).href
|
|
254757
|
+
});
|
|
254758
|
+
}
|
|
254759
|
+
// src/core/clients/oauth-client.ts
|
|
254760
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
254761
|
+
var oauthClient = distribution_default.create({
|
|
254762
|
+
prefixUrl: getBase44ApiUrl(),
|
|
254763
|
+
headers: {
|
|
254764
|
+
"User-Agent": "Base44 CLI"
|
|
254765
|
+
},
|
|
254766
|
+
hooks: {
|
|
254767
|
+
beforeRequest: [
|
|
254768
|
+
(request) => {
|
|
254769
|
+
request.headers.set("X-Request-ID", randomUUID3());
|
|
254770
|
+
}
|
|
254771
|
+
]
|
|
254772
|
+
}
|
|
254773
|
+
});
|
|
254774
|
+
// src/core/auth/api.ts
|
|
254775
|
+
async function generateDeviceCode() {
|
|
254776
|
+
const response = await oauthClient.post("oauth/device/code", {
|
|
254777
|
+
json: {
|
|
254778
|
+
client_id: AUTH_CLIENT_ID,
|
|
254779
|
+
scope: "apps:read apps:write sandbox:write"
|
|
254780
|
+
},
|
|
254781
|
+
throwHttpErrors: false
|
|
254782
|
+
});
|
|
254783
|
+
if (!response.ok) {
|
|
254784
|
+
throw new ApiError(`Failed to generate device code: ${response.status} ${response.statusText}`, { statusCode: response.status });
|
|
254785
|
+
}
|
|
254786
|
+
const result = DeviceCodeResponseSchema.safeParse(await response.json());
|
|
254787
|
+
if (!result.success) {
|
|
254788
|
+
throw new SchemaValidationError("Invalid device code response from server", result.error);
|
|
254789
|
+
}
|
|
254790
|
+
return result.data;
|
|
254791
|
+
}
|
|
254792
|
+
async function getTokenFromDeviceCode(deviceCode) {
|
|
254793
|
+
const searchParams = new URLSearchParams;
|
|
254794
|
+
searchParams.set("grant_type", "urn:ietf:params:oauth:grant-type:device_code");
|
|
254795
|
+
searchParams.set("device_code", deviceCode);
|
|
254796
|
+
searchParams.set("client_id", AUTH_CLIENT_ID);
|
|
254797
|
+
const response = await oauthClient.post("oauth/token", {
|
|
254798
|
+
body: searchParams.toString(),
|
|
254799
|
+
headers: {
|
|
254800
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
254801
|
+
},
|
|
254802
|
+
throwHttpErrors: false
|
|
254803
|
+
});
|
|
254804
|
+
const json2 = await response.json();
|
|
254805
|
+
if (!response.ok) {
|
|
254806
|
+
const errorResult = OAuthErrorSchema.safeParse(json2);
|
|
254807
|
+
if (!errorResult.success) {
|
|
254808
|
+
throw new SchemaValidationError("Token request failed", errorResult.error);
|
|
254809
|
+
}
|
|
254810
|
+
const { error: error48, error_description } = errorResult.data;
|
|
254811
|
+
if (error48 === "authorization_pending" || error48 === "slow_down") {
|
|
254812
|
+
return null;
|
|
254813
|
+
}
|
|
254814
|
+
throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
|
|
254815
|
+
statusCode: response.status
|
|
254816
|
+
});
|
|
254817
|
+
}
|
|
254818
|
+
const result = TokenResponseSchema.safeParse(json2);
|
|
254819
|
+
if (!result.success) {
|
|
254820
|
+
throw new SchemaValidationError("Invalid token response from server", result.error);
|
|
254821
|
+
}
|
|
254822
|
+
return result.data;
|
|
254823
|
+
}
|
|
254824
|
+
async function renewAccessToken(refreshToken) {
|
|
254825
|
+
const searchParams = new URLSearchParams;
|
|
254826
|
+
searchParams.set("grant_type", "refresh_token");
|
|
254827
|
+
searchParams.set("refresh_token", refreshToken);
|
|
254828
|
+
searchParams.set("client_id", AUTH_CLIENT_ID);
|
|
254829
|
+
const response = await oauthClient.post("oauth/token", {
|
|
254830
|
+
body: searchParams.toString(),
|
|
254831
|
+
headers: {
|
|
254832
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
254833
|
+
},
|
|
254834
|
+
throwHttpErrors: false
|
|
254835
|
+
});
|
|
254836
|
+
const json2 = await response.json();
|
|
254837
|
+
if (!response.ok) {
|
|
254838
|
+
const errorResult = OAuthErrorSchema.safeParse(json2);
|
|
254839
|
+
if (!errorResult.success) {
|
|
254840
|
+
throw new ApiError(`Token refresh failed: ${response.statusText}`, {
|
|
254841
|
+
statusCode: response.status
|
|
254842
|
+
});
|
|
254843
|
+
}
|
|
254844
|
+
const { error: error48, error_description } = errorResult.data;
|
|
254845
|
+
throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
|
|
254846
|
+
statusCode: response.status
|
|
254847
|
+
});
|
|
254848
|
+
}
|
|
254849
|
+
const result = TokenResponseSchema.safeParse(json2);
|
|
254850
|
+
if (!result.success) {
|
|
254851
|
+
throw new SchemaValidationError("Invalid token response from server", result.error);
|
|
254852
|
+
}
|
|
254853
|
+
return result.data;
|
|
254854
|
+
}
|
|
254855
|
+
async function getUserInfo(accessToken) {
|
|
254856
|
+
const response = await oauthClient.get("oauth/userinfo", {
|
|
254857
|
+
headers: { Authorization: `Bearer ${accessToken}` }
|
|
254858
|
+
});
|
|
254859
|
+
if (!response.ok) {
|
|
254860
|
+
throw new ApiError(`Failed to fetch user info: ${response.status}`, {
|
|
254861
|
+
statusCode: response.status
|
|
254862
|
+
});
|
|
254863
|
+
}
|
|
254864
|
+
const result = UserInfoSchema.safeParse(await response.json());
|
|
254865
|
+
if (!result.success) {
|
|
254866
|
+
throw new SchemaValidationError("Invalid UserInfo response from server", result.error);
|
|
254867
|
+
}
|
|
254868
|
+
return result.data;
|
|
254869
|
+
}
|
|
254870
|
+
// src/cli/commands/auth/login-flow.ts
|
|
254871
|
+
async function generateAndDisplayDeviceCode(log, runTask) {
|
|
254872
|
+
const deviceCodeResponse = await runTask("Generating device code...", async () => {
|
|
254873
|
+
return await generateDeviceCode();
|
|
254874
|
+
}, {
|
|
254875
|
+
successMessage: "Device code generated",
|
|
254876
|
+
errorMessage: "Failed to generate device code"
|
|
254877
|
+
});
|
|
254878
|
+
log.info(`Verification code: ${theme.styles.bold(deviceCodeResponse.userCode)}` + `
|
|
254879
|
+
Please confirm this code at: ${deviceCodeResponse.verificationUri}`);
|
|
254880
|
+
return deviceCodeResponse;
|
|
254881
|
+
}
|
|
254882
|
+
async function waitForAuthentication(deviceCode, expiresIn, interval, runTask) {
|
|
254883
|
+
let tokenResponse;
|
|
254884
|
+
try {
|
|
254885
|
+
await runTask("Waiting for authentication...", async () => {
|
|
254886
|
+
await pWaitFor(async () => {
|
|
254887
|
+
const result = await getTokenFromDeviceCode(deviceCode);
|
|
254888
|
+
if (result !== null) {
|
|
254889
|
+
tokenResponse = result;
|
|
254890
|
+
return true;
|
|
254891
|
+
}
|
|
254892
|
+
return false;
|
|
254893
|
+
}, {
|
|
254894
|
+
interval: interval * 1000,
|
|
254895
|
+
timeout: expiresIn * 1000
|
|
254896
|
+
});
|
|
254897
|
+
}, {
|
|
254898
|
+
successMessage: "Authentication completed!",
|
|
254899
|
+
errorMessage: "Authentication failed"
|
|
254900
|
+
});
|
|
254901
|
+
} catch (error48) {
|
|
254902
|
+
if (error48 instanceof Error && error48.message.includes("timed out")) {
|
|
254903
|
+
throw new AuthExpiredError("Authentication timed out. Please try again.");
|
|
254904
|
+
}
|
|
254905
|
+
throw error48;
|
|
254906
|
+
}
|
|
254907
|
+
if (tokenResponse === undefined) {
|
|
254908
|
+
throw new InternalError("Failed to retrieve authentication token.");
|
|
254909
|
+
}
|
|
254910
|
+
return tokenResponse;
|
|
254911
|
+
}
|
|
254912
|
+
async function saveAuthData(response, userInfo) {
|
|
254913
|
+
const expiresAt = Date.now() + response.expiresIn * 1000;
|
|
254914
|
+
await writeAuth({
|
|
254915
|
+
accessToken: response.accessToken,
|
|
254916
|
+
refreshToken: response.refreshToken,
|
|
254917
|
+
expiresAt,
|
|
254918
|
+
email: userInfo.email,
|
|
254919
|
+
name: userInfo.name
|
|
254920
|
+
});
|
|
254921
|
+
}
|
|
254922
|
+
async function login({
|
|
254923
|
+
log,
|
|
254924
|
+
runTask
|
|
254925
|
+
}) {
|
|
254926
|
+
const deviceCodeResponse = await generateAndDisplayDeviceCode(log, runTask);
|
|
254927
|
+
const token = await waitForAuthentication(deviceCodeResponse.deviceCode, deviceCodeResponse.expiresIn, deviceCodeResponse.interval, runTask);
|
|
254928
|
+
const userInfo = await getUserInfo(token.accessToken);
|
|
254929
|
+
await saveAuthData(token, userInfo);
|
|
254930
|
+
return {
|
|
254931
|
+
outroMessage: `Successfully logged in as ${theme.styles.bold(userInfo.email)}`
|
|
254932
|
+
};
|
|
254933
|
+
}
|
|
254934
|
+
|
|
254935
|
+
// src/cli/utils/command/middleware.ts
|
|
254936
|
+
async function ensureAuth(ctx) {
|
|
254937
|
+
if (hasWorkspaceApiKeyAuth()) {
|
|
254938
|
+
ctx.errorReporter.setContext({
|
|
254939
|
+
user: { email: "workspace-api-key", name: "Workspace API key" }
|
|
254940
|
+
});
|
|
254941
|
+
return;
|
|
254942
|
+
}
|
|
254943
|
+
await seedAuthFromEnv();
|
|
254944
|
+
const loggedIn = await isLoggedIn();
|
|
254945
|
+
if (!loggedIn) {
|
|
254946
|
+
ctx.log.info("You need to login first to continue.");
|
|
254947
|
+
await login(ctx);
|
|
254948
|
+
}
|
|
254949
|
+
try {
|
|
254950
|
+
const userInfo = await readAuth();
|
|
254951
|
+
ctx.errorReporter.setContext({
|
|
254952
|
+
user: { email: userInfo.email, name: userInfo.name }
|
|
254953
|
+
});
|
|
254954
|
+
} catch {}
|
|
254955
|
+
}
|
|
254956
|
+
async function ensureAppContext(ctx, options = {}) {
|
|
254957
|
+
const appContext = await initAppContext(options);
|
|
254958
|
+
ctx.app = appContext;
|
|
254959
|
+
ctx.errorReporter.setContext({ appId: appContext.id });
|
|
254960
|
+
}
|
|
254961
|
+
|
|
254962
|
+
// src/cli/utils/version-check.ts
|
|
254963
|
+
async function checkForUpgrade() {
|
|
254964
|
+
const testLatestVersion = getTestOverrides()?.latestVersion;
|
|
254965
|
+
if (testLatestVersion !== undefined) {
|
|
254966
|
+
if (testLatestVersion === null) {
|
|
254967
|
+
return null;
|
|
254968
|
+
}
|
|
254969
|
+
const currentVersion = package_default.version;
|
|
254970
|
+
if (testLatestVersion !== currentVersion) {
|
|
254971
|
+
return { currentVersion, latestVersion: testLatestVersion };
|
|
254972
|
+
}
|
|
254973
|
+
return null;
|
|
254974
|
+
}
|
|
254975
|
+
try {
|
|
254976
|
+
const { stdout } = await execa("npm", ["view", "base44", "version"], {
|
|
254977
|
+
timeout: 1000,
|
|
254978
|
+
shell: true,
|
|
254979
|
+
env: { CI: "1" }
|
|
254980
|
+
});
|
|
254981
|
+
const latestVersion = stdout.trim();
|
|
254982
|
+
const currentVersion = package_default.version;
|
|
254983
|
+
if (latestVersion !== currentVersion) {
|
|
254984
|
+
return { currentVersion, latestVersion };
|
|
254985
|
+
}
|
|
254986
|
+
return null;
|
|
254987
|
+
} catch {
|
|
254988
|
+
return null;
|
|
254989
|
+
}
|
|
254990
|
+
}
|
|
254991
|
+
|
|
254992
|
+
// src/cli/utils/upgradeNotification.ts
|
|
254993
|
+
function detectInstallMethod(distribution) {
|
|
254994
|
+
if (distribution !== "binary") {
|
|
254995
|
+
return "npm";
|
|
254996
|
+
}
|
|
254997
|
+
const execPath2 = process.execPath.toLowerCase();
|
|
254998
|
+
if (execPath2.includes("/homebrew/") || execPath2.includes("/cellar/")) {
|
|
254999
|
+
return "brew";
|
|
255000
|
+
}
|
|
255001
|
+
return "binary";
|
|
255002
|
+
}
|
|
255003
|
+
function getUpgradeInstruction(method) {
|
|
255004
|
+
switch (method) {
|
|
255005
|
+
case "npm":
|
|
255006
|
+
return "Run: npm install -g base44@latest";
|
|
255007
|
+
case "brew":
|
|
255008
|
+
return "Run: brew upgrade base44";
|
|
255009
|
+
case "binary":
|
|
255010
|
+
return "Download Base44 CLI from: https://github.com/base44/cli/releases/latest";
|
|
255011
|
+
}
|
|
255012
|
+
}
|
|
255013
|
+
function startUpgradeCheck() {
|
|
255014
|
+
return checkForUpgrade().catch(() => null);
|
|
255015
|
+
}
|
|
255016
|
+
function formatUpgradeMessage(info, distribution) {
|
|
255017
|
+
const { shinyOrange } = theme.colors;
|
|
255018
|
+
const { bold: bold2 } = theme.styles;
|
|
255019
|
+
const instruction = getUpgradeInstruction(detectInstallMethod(distribution));
|
|
255020
|
+
return [
|
|
255021
|
+
shinyOrange(`Update available! ${info.currentVersion} → ${bold2(info.latestVersion)}`),
|
|
255022
|
+
shinyOrange(instruction)
|
|
255023
|
+
].join(`
|
|
255024
|
+
`);
|
|
255025
|
+
}
|
|
255026
|
+
function formatPlainUpgradeMessage(info, distribution) {
|
|
255027
|
+
const instruction = getUpgradeInstruction(detectInstallMethod(distribution));
|
|
255028
|
+
return `Update available: ${info.currentVersion} → ${info.latestVersion}. ${instruction}`;
|
|
255029
|
+
}
|
|
255030
|
+
async function printUpgradeNotification(upgradeCheckPromise, distribution) {
|
|
255031
|
+
try {
|
|
255032
|
+
const upgradeInfo = await upgradeCheckPromise;
|
|
255033
|
+
if (upgradeInfo) {
|
|
255034
|
+
Ve(formatUpgradeMessage(upgradeInfo, distribution));
|
|
255035
|
+
}
|
|
255036
|
+
} catch {}
|
|
255037
|
+
}
|
|
255038
|
+
|
|
255039
|
+
// src/cli/utils/command/render.ts
|
|
255040
|
+
async function showCommandStart(fullBanner) {
|
|
255041
|
+
if (fullBanner) {
|
|
255042
|
+
await printBanner();
|
|
255043
|
+
We("");
|
|
255044
|
+
} else {
|
|
255045
|
+
We(theme.colors.base44OrangeBackground(" Base 44 "));
|
|
255046
|
+
}
|
|
255047
|
+
}
|
|
255048
|
+
async function showCommandEnd(result, upgradeCheckPromise, distribution) {
|
|
255049
|
+
await printUpgradeNotification(upgradeCheckPromise, distribution);
|
|
255050
|
+
Le(result.outroMessage || "");
|
|
255051
|
+
if (result.stdout) {
|
|
255052
|
+
process.stdout.write(result.stdout);
|
|
255053
|
+
}
|
|
255054
|
+
}
|
|
255055
|
+
function showThemedError(error48, context) {
|
|
255056
|
+
const errorMessage = error48 instanceof Error ? error48.message : String(error48);
|
|
255057
|
+
R2.error(errorMessage);
|
|
255058
|
+
if (isCLIError(error48)) {
|
|
255059
|
+
if (error48.details.length > 0) {
|
|
255060
|
+
R2.info(theme.format.details(error48.details));
|
|
255061
|
+
}
|
|
255062
|
+
const hints = theme.format.agentHints(error48.hints);
|
|
255063
|
+
if (hints) {
|
|
255064
|
+
R2.error(hints);
|
|
255065
|
+
}
|
|
255066
|
+
}
|
|
255067
|
+
if (process.env.DEBUG === "1" && error48 instanceof Error && error48.stack) {
|
|
255068
|
+
R2.error(theme.styles.dim(error48.stack));
|
|
255069
|
+
}
|
|
255070
|
+
const errorContext = context.errorReporter.getErrorContext();
|
|
255071
|
+
Le(theme.format.errorContext(errorContext));
|
|
255072
|
+
}
|
|
255073
|
+
function showPlainError(error48) {
|
|
255074
|
+
const errorMessage = error48 instanceof Error ? error48.message : String(error48);
|
|
255075
|
+
process.stderr.write(`Error: ${errorMessage}
|
|
255076
|
+
`);
|
|
255077
|
+
if (isCLIError(error48)) {
|
|
255078
|
+
for (const detail of error48.details) {
|
|
255079
|
+
process.stderr.write(` ${detail}
|
|
255080
|
+
`);
|
|
255081
|
+
}
|
|
255082
|
+
for (const hint of error48.hints) {
|
|
255083
|
+
const cmd = hint.command ? ` (${hint.command})` : "";
|
|
255084
|
+
process.stderr.write(` Hint: ${hint.message}${cmd}
|
|
255085
|
+
`);
|
|
255086
|
+
}
|
|
255087
|
+
}
|
|
255088
|
+
if (process.env.DEBUG === "1" && error48 instanceof Error && error48.stack) {
|
|
255089
|
+
process.stderr.write(`${error48.stack}
|
|
255090
|
+
`);
|
|
255091
|
+
}
|
|
255092
|
+
}
|
|
255093
|
+
|
|
255094
|
+
// src/cli/utils/command/Base44Command.ts
|
|
255095
|
+
function writeJsonSuccess(result) {
|
|
255096
|
+
if (result.stdout) {
|
|
255097
|
+
if (result.outroMessage) {
|
|
255098
|
+
process.stderr.write(`${result.outroMessage}
|
|
255099
|
+
`);
|
|
255100
|
+
}
|
|
255101
|
+
process.stdout.write(result.stdout);
|
|
255102
|
+
return;
|
|
255103
|
+
}
|
|
255104
|
+
process.stdout.write(`${JSON.stringify({ output: stripAnsi(result.outroMessage ?? "") })}
|
|
255105
|
+
`);
|
|
255106
|
+
}
|
|
255107
|
+
function writeJsonError(error48) {
|
|
255108
|
+
const envelope = {
|
|
255109
|
+
error: error48 instanceof Error ? error48.message : String(error48)
|
|
255110
|
+
};
|
|
255111
|
+
if (isCLIError(error48)) {
|
|
255112
|
+
envelope.code = error48.code;
|
|
255113
|
+
if (error48.details.length > 0) {
|
|
255114
|
+
envelope.details = error48.details;
|
|
255115
|
+
}
|
|
255116
|
+
if (error48.hints.length > 0) {
|
|
255117
|
+
envelope.hints = error48.hints;
|
|
255118
|
+
}
|
|
255119
|
+
}
|
|
255120
|
+
process.stdout.write(`${JSON.stringify(envelope)}
|
|
255121
|
+
`);
|
|
255122
|
+
}
|
|
255123
|
+
|
|
255124
|
+
class Base44Command extends Command {
|
|
255125
|
+
_context;
|
|
255126
|
+
_commandOptions;
|
|
255127
|
+
constructor(name2, options) {
|
|
255128
|
+
super(name2);
|
|
255129
|
+
this._commandOptions = {
|
|
255130
|
+
requireAuth: options?.requireAuth ?? true,
|
|
255131
|
+
requireAppContext: options?.requireAppContext ?? true,
|
|
255132
|
+
fullBanner: options?.fullBanner ?? false
|
|
255133
|
+
};
|
|
255134
|
+
}
|
|
255135
|
+
setContext(context) {
|
|
255136
|
+
this._context = context;
|
|
255137
|
+
}
|
|
255138
|
+
get context() {
|
|
255139
|
+
if (!this._context) {
|
|
255140
|
+
throw new Error("Base44Command context not set. Ensure the command is registered via createProgram().");
|
|
255141
|
+
}
|
|
255142
|
+
return this._context;
|
|
255143
|
+
}
|
|
255144
|
+
action(fn) {
|
|
255145
|
+
return super.action(async (...args) => {
|
|
255146
|
+
const jsonMode = this.context.jsonMode;
|
|
255147
|
+
const quiet = this.context.isNonInteractive || jsonMode;
|
|
255148
|
+
if (!quiet) {
|
|
255149
|
+
await showCommandStart(this._commandOptions.fullBanner);
|
|
255150
|
+
}
|
|
255151
|
+
const upgradeCheckPromise = startUpgradeCheck();
|
|
255152
|
+
try {
|
|
255153
|
+
if (this._commandOptions.requireAuth) {
|
|
255154
|
+
await ensureAuth(this.context);
|
|
255155
|
+
}
|
|
255156
|
+
if (this._commandOptions.requireAppContext) {
|
|
255157
|
+
const { appId } = this.optsWithGlobals();
|
|
255158
|
+
await ensureAppContext(this.context, { appId });
|
|
255159
|
+
}
|
|
255160
|
+
const result = await fn(this.context, ...args) ?? {};
|
|
255161
|
+
if (!quiet) {
|
|
255162
|
+
await showCommandEnd(result, upgradeCheckPromise, this.context.distribution);
|
|
255163
|
+
} else if (jsonMode) {
|
|
255164
|
+
writeJsonSuccess(result);
|
|
255165
|
+
const upgradeInfo = await upgradeCheckPromise;
|
|
255166
|
+
if (upgradeInfo) {
|
|
255167
|
+
process.stderr.write(`${formatPlainUpgradeMessage(upgradeInfo, this.context.distribution)}
|
|
255168
|
+
`);
|
|
255169
|
+
}
|
|
255170
|
+
} else {
|
|
255171
|
+
if (result.outroMessage) {
|
|
255172
|
+
process.stdout.write(`${result.outroMessage}
|
|
255173
|
+
`);
|
|
255174
|
+
}
|
|
255175
|
+
if (result.stdout) {
|
|
255176
|
+
process.stdout.write(result.stdout);
|
|
255177
|
+
}
|
|
255178
|
+
const upgradeInfo = await upgradeCheckPromise;
|
|
255179
|
+
if (upgradeInfo) {
|
|
255180
|
+
process.stderr.write(`${formatPlainUpgradeMessage(upgradeInfo, this.context.distribution)}
|
|
255181
|
+
`);
|
|
255182
|
+
}
|
|
255183
|
+
}
|
|
255184
|
+
} catch (error48) {
|
|
255185
|
+
if (jsonMode) {
|
|
255186
|
+
writeJsonError(error48);
|
|
255187
|
+
} else if (quiet) {
|
|
255188
|
+
showPlainError(error48);
|
|
255189
|
+
} else {
|
|
255190
|
+
showThemedError(error48, this.context);
|
|
255191
|
+
}
|
|
255192
|
+
throw error48;
|
|
255193
|
+
}
|
|
255194
|
+
});
|
|
255195
|
+
}
|
|
255196
|
+
}
|
|
255197
|
+
// src/cli/utils/confirm-push.ts
|
|
255198
|
+
async function confirmPush({
|
|
255199
|
+
isNonInteractive,
|
|
255200
|
+
yes,
|
|
255201
|
+
log,
|
|
255202
|
+
warning
|
|
255203
|
+
}) {
|
|
255204
|
+
if (isNonInteractive && !yes) {
|
|
255205
|
+
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
255206
|
+
}
|
|
255207
|
+
if (yes) {
|
|
255208
|
+
return true;
|
|
255209
|
+
}
|
|
255210
|
+
log.warn(warning);
|
|
255211
|
+
const proceed = await Re({
|
|
255212
|
+
message: "Are you sure you want to continue?"
|
|
255213
|
+
});
|
|
255214
|
+
return !Ct(proceed) && proceed;
|
|
255215
|
+
}
|
|
255216
|
+
// src/cli/utils/json.ts
|
|
255217
|
+
function toJsonStdout(result) {
|
|
255218
|
+
return `${JSON.stringify(result, null, 2)}
|
|
255219
|
+
`;
|
|
255220
|
+
}
|
|
255221
|
+
// src/cli/errors.ts
|
|
255222
|
+
class CLIExitError extends Error {
|
|
255223
|
+
code;
|
|
255224
|
+
constructor(code2) {
|
|
255225
|
+
super(`CLI exited with code ${code2}`);
|
|
255226
|
+
this.code = code2;
|
|
255227
|
+
this.name = "CLIExitError";
|
|
255228
|
+
}
|
|
255229
|
+
}
|
|
255230
|
+
|
|
255231
|
+
// src/cli/utils/prompts.ts
|
|
255232
|
+
var onPromptCancel = () => {
|
|
255233
|
+
Ne("Operation cancelled.");
|
|
255234
|
+
throw new CLIExitError(0);
|
|
255235
|
+
};
|
|
255236
|
+
// src/cli/utils/runTask.ts
|
|
255237
|
+
function createInteractiveRunTask() {
|
|
255238
|
+
return async (startMessage, operation, options) => {
|
|
255239
|
+
const s = bt2();
|
|
255240
|
+
s.start(startMessage);
|
|
255241
|
+
const updateMessage = (message) => s.message(message);
|
|
255242
|
+
try {
|
|
255243
|
+
const result = await operation(updateMessage);
|
|
255244
|
+
s.stop(options?.successMessage || startMessage);
|
|
255245
|
+
return result;
|
|
255246
|
+
} catch (error48) {
|
|
255247
|
+
s.error(options?.errorMessage || "Failed");
|
|
255248
|
+
throw error48;
|
|
255249
|
+
}
|
|
255250
|
+
};
|
|
255251
|
+
}
|
|
255252
|
+
function createSimpleRunTask(log) {
|
|
255253
|
+
return async (startMessage, operation, options) => {
|
|
255254
|
+
log.info(startMessage);
|
|
255255
|
+
const updateMessage = (message) => log.info(message);
|
|
255256
|
+
try {
|
|
255257
|
+
const result = await operation(updateMessage);
|
|
255258
|
+
log.success(options?.successMessage || startMessage);
|
|
255259
|
+
return result;
|
|
255260
|
+
} catch (error48) {
|
|
255261
|
+
log.error(options?.errorMessage || "Failed");
|
|
255262
|
+
throw error48;
|
|
255263
|
+
}
|
|
255264
|
+
};
|
|
255265
|
+
}
|
|
255266
|
+
// src/cli/utils/stdin.ts
|
|
255267
|
+
async function readStdin(flagName = "--stdin", options = {}) {
|
|
255268
|
+
if (process.stdin.isTTY) {
|
|
255269
|
+
throw new InvalidInputError(`${flagName} requires piped input (e.g., echo <value> | base44 ...)`);
|
|
255270
|
+
}
|
|
255271
|
+
const chunks = [];
|
|
255272
|
+
for await (const chunk of process.stdin) {
|
|
255273
|
+
chunks.push(chunk);
|
|
255274
|
+
}
|
|
255275
|
+
const text = Buffer.concat(chunks).toString("utf-8");
|
|
255276
|
+
return options.trim === false ? text : text.trim();
|
|
255277
|
+
}
|
|
255278
|
+
|
|
255279
|
+
// src/cli/utils/secret-input.ts
|
|
255280
|
+
async function resolveSecret(options) {
|
|
255281
|
+
if (options.fromStdin) {
|
|
255282
|
+
const value = await readStdin("--client-secret-stdin");
|
|
255283
|
+
if (value)
|
|
255284
|
+
return value;
|
|
255285
|
+
}
|
|
255286
|
+
if (options.flagValue) {
|
|
255287
|
+
return options.flagValue;
|
|
255288
|
+
}
|
|
255289
|
+
if (options.envVar) {
|
|
255290
|
+
const envValue = process.env[options.envVar];
|
|
255291
|
+
if (envValue)
|
|
255292
|
+
return envValue;
|
|
255293
|
+
}
|
|
255294
|
+
if (!options.isNonInteractive) {
|
|
255295
|
+
const value = await He({
|
|
255296
|
+
message: options.promptMessage,
|
|
255297
|
+
validate: (v) => {
|
|
255298
|
+
if (!v || v.trim().length === 0) {
|
|
255299
|
+
return `${options.name} is required`;
|
|
255300
|
+
}
|
|
255301
|
+
}
|
|
255302
|
+
});
|
|
255303
|
+
if (Ct(value)) {
|
|
255304
|
+
throw new CLIExitError(0);
|
|
255305
|
+
}
|
|
255306
|
+
return value;
|
|
255307
|
+
}
|
|
255308
|
+
throw new InvalidInputError(`Missing required ${options.name}.`, {
|
|
255309
|
+
hints: options.hints ?? [
|
|
255310
|
+
{
|
|
255311
|
+
message: `Provide the ${options.name} via flag, stdin, or environment variable (${options.envVar ?? "N/A"})`
|
|
255312
|
+
}
|
|
255313
|
+
]
|
|
255314
|
+
});
|
|
255315
|
+
}
|
|
255316
|
+
// src/cli/utils/urls.ts
|
|
255317
|
+
function getDashboardUrl(projectId) {
|
|
255318
|
+
const id = projectId ?? getAppContext().id;
|
|
255319
|
+
return `${getBase44ApiUrl()}/apps/${id}/editor/workspace/overview`;
|
|
255320
|
+
}
|
|
255321
|
+
function getConnectorsUrl(projectId) {
|
|
255322
|
+
const id = projectId ?? getAppContext().id;
|
|
255323
|
+
return `${getBase44ApiUrl()}/apps/${id}/editor/workspace/app-connections`;
|
|
255324
|
+
}
|
|
255325
|
+
// src/cli/utils/yaml.ts
|
|
255326
|
+
var import_lodash = __toESM(require_lodash8(), 1);
|
|
255327
|
+
var YAML_INDENT = 2;
|
|
255328
|
+
var stripEmptyReplacer = (_key, value) => {
|
|
255329
|
+
if (typeof value === "number" || typeof value === "boolean")
|
|
255330
|
+
return value;
|
|
255331
|
+
if (import_lodash.isEmpty(value))
|
|
255332
|
+
return;
|
|
255333
|
+
return value;
|
|
255334
|
+
};
|
|
255335
|
+
function formatYaml(data, options = {}) {
|
|
255336
|
+
const { stripEmpty = true } = options;
|
|
255337
|
+
const replacer = stripEmpty ? stripEmptyReplacer : undefined;
|
|
255338
|
+
return $stringify(data, replacer, { indent: YAML_INDENT }).trimEnd();
|
|
255339
|
+
}
|
|
255298
255340
|
// src/core/utils/dependencies.ts
|
|
255299
255341
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
255300
255342
|
function verifyDenoInstalled(context) {
|
|
@@ -255612,7 +255654,7 @@ function getAuthPushCommand() {
|
|
|
255612
255654
|
}
|
|
255613
255655
|
|
|
255614
255656
|
// src/cli/commands/auth/social-login.ts
|
|
255615
|
-
import { dirname as dirname15, join as join21, resolve as
|
|
255657
|
+
import { dirname as dirname15, join as join21, resolve as resolve7 } from "node:path";
|
|
255616
255658
|
var PROVIDER_LABELS = {
|
|
255617
255659
|
google: "Google",
|
|
255618
255660
|
microsoft: "Microsoft",
|
|
@@ -255652,7 +255694,7 @@ async function socialLoginAction({ log, isNonInteractive, runTask: runTask2 }, p
|
|
|
255652
255694
|
let clientSecret;
|
|
255653
255695
|
if (useCustomOAuth && oauth && oauthCli && hasSecretOptions(options)) {
|
|
255654
255696
|
if (options.envFile) {
|
|
255655
|
-
const secrets = await parseEnvFile(
|
|
255697
|
+
const secrets = await parseEnvFile(resolve7(options.envFile));
|
|
255656
255698
|
const value = secrets[oauthCli.envVar];
|
|
255657
255699
|
if (!value) {
|
|
255658
255700
|
throw new InvalidInputError(`Key "${oauthCli.envVar}" not found in ${options.envFile}.`);
|
|
@@ -255708,7 +255750,7 @@ function getSocialLoginCommand() {
|
|
|
255708
255750
|
}
|
|
255709
255751
|
|
|
255710
255752
|
// src/cli/commands/auth/sso.ts
|
|
255711
|
-
import { dirname as dirname16, join as join22, resolve as
|
|
255753
|
+
import { dirname as dirname16, join as join22, resolve as resolve8 } from "node:path";
|
|
255712
255754
|
var SSOConfigFileSchema = exports_external.object({
|
|
255713
255755
|
provider: exports_external.enum(Object.values(KNOWN_SSO_PROVIDERS)),
|
|
255714
255756
|
clientId: exports_external.string(),
|
|
@@ -255724,7 +255766,7 @@ var SSOConfigFileSchema = exports_external.object({
|
|
|
255724
255766
|
ssoName: exports_external.string().optional()
|
|
255725
255767
|
});
|
|
255726
255768
|
async function loadSSOConfigFile(filePath) {
|
|
255727
|
-
const resolved =
|
|
255769
|
+
const resolved = resolve8(filePath);
|
|
255728
255770
|
const raw2 = await readJsonFile(resolved);
|
|
255729
255771
|
const result = SSOConfigFileSchema.safeParse(raw2);
|
|
255730
255772
|
if (!result.success) {
|
|
@@ -255812,7 +255854,7 @@ async function ssoEnableAction({ isNonInteractive, runTask: runTask2 }, options)
|
|
|
255812
255854
|
}
|
|
255813
255855
|
let clientSecret;
|
|
255814
255856
|
if (merged.envFile && !merged.clientSecret) {
|
|
255815
|
-
const secrets2 = await parseEnvFile(
|
|
255857
|
+
const secrets2 = await parseEnvFile(resolve8(merged.envFile));
|
|
255816
255858
|
const value = secrets2.sso_client_secret;
|
|
255817
255859
|
if (!value) {
|
|
255818
255860
|
throw new InvalidInputError(`Key "sso_client_secret" not found in ${merged.envFile}.`);
|
|
@@ -256450,19 +256492,19 @@ var baseOpen = async (options) => {
|
|
|
256450
256492
|
}
|
|
256451
256493
|
const subprocess = childProcess3.spawn(command2, cliArguments, childProcessOptions);
|
|
256452
256494
|
if (options.wait) {
|
|
256453
|
-
return new Promise((
|
|
256495
|
+
return new Promise((resolve9, reject) => {
|
|
256454
256496
|
subprocess.once("error", reject);
|
|
256455
256497
|
subprocess.once("close", (exitCode) => {
|
|
256456
256498
|
if (!options.allowNonzeroExitCode && exitCode !== 0) {
|
|
256457
256499
|
reject(new Error(`Exited with code ${exitCode}`));
|
|
256458
256500
|
return;
|
|
256459
256501
|
}
|
|
256460
|
-
|
|
256502
|
+
resolve9(subprocess);
|
|
256461
256503
|
});
|
|
256462
256504
|
});
|
|
256463
256505
|
}
|
|
256464
256506
|
if (isFallbackAttempt) {
|
|
256465
|
-
return new Promise((
|
|
256507
|
+
return new Promise((resolve9, reject) => {
|
|
256466
256508
|
subprocess.once("error", reject);
|
|
256467
256509
|
subprocess.once("spawn", () => {
|
|
256468
256510
|
subprocess.once("close", (exitCode) => {
|
|
@@ -256472,17 +256514,17 @@ var baseOpen = async (options) => {
|
|
|
256472
256514
|
return;
|
|
256473
256515
|
}
|
|
256474
256516
|
subprocess.unref();
|
|
256475
|
-
|
|
256517
|
+
resolve9(subprocess);
|
|
256476
256518
|
});
|
|
256477
256519
|
});
|
|
256478
256520
|
});
|
|
256479
256521
|
}
|
|
256480
256522
|
subprocess.unref();
|
|
256481
|
-
return new Promise((
|
|
256523
|
+
return new Promise((resolve9, reject) => {
|
|
256482
256524
|
subprocess.once("error", reject);
|
|
256483
256525
|
subprocess.once("spawn", () => {
|
|
256484
256526
|
subprocess.off("error", reject);
|
|
256485
|
-
|
|
256527
|
+
resolve9(subprocess);
|
|
256486
256528
|
});
|
|
256487
256529
|
});
|
|
256488
256530
|
};
|
|
@@ -256745,10 +256787,10 @@ function getConnectorsListAvailableCommand() {
|
|
|
256745
256787
|
}
|
|
256746
256788
|
|
|
256747
256789
|
// src/cli/commands/connectors/pull.ts
|
|
256748
|
-
import { dirname as dirname17, join as join23, resolve as
|
|
256790
|
+
import { dirname as dirname17, join as join23, resolve as resolve9 } from "node:path";
|
|
256749
256791
|
async function resolveConnectorsDir(options) {
|
|
256750
256792
|
if (!getAppContext().projectRoot) {
|
|
256751
|
-
return
|
|
256793
|
+
return resolve9(options.dir ?? "connectors");
|
|
256752
256794
|
}
|
|
256753
256795
|
const { project: project2 } = await readProjectConfig();
|
|
256754
256796
|
return join23(dirname17(project2.configPath), project2.connectorsDir);
|
|
@@ -256792,10 +256834,10 @@ function getConnectorsPullCommand() {
|
|
|
256792
256834
|
}
|
|
256793
256835
|
|
|
256794
256836
|
// src/cli/commands/connectors/push.ts
|
|
256795
|
-
import { resolve as
|
|
256837
|
+
import { resolve as resolve10 } from "node:path";
|
|
256796
256838
|
async function readConnectorsToPush(options) {
|
|
256797
256839
|
if (!getAppContext().projectRoot) {
|
|
256798
|
-
return readAllConnectors(
|
|
256840
|
+
return readAllConnectors(resolve10(options.dir ?? "connectors"));
|
|
256799
256841
|
}
|
|
256800
256842
|
const { connectors } = await readProjectConfig();
|
|
256801
256843
|
return connectors;
|
|
@@ -257222,7 +257264,7 @@ function getFunctionsCommand() {
|
|
|
257222
257264
|
}
|
|
257223
257265
|
|
|
257224
257266
|
// src/cli/commands/project/create.ts
|
|
257225
|
-
import { basename as basename4, resolve as
|
|
257267
|
+
import { basename as basename4, resolve as resolve11 } from "node:path";
|
|
257226
257268
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
257227
257269
|
|
|
257228
257270
|
// src/cli/commands/project/scaffold-shared.ts
|
|
@@ -257414,7 +257456,7 @@ async function createInteractive(options, ctx) {
|
|
|
257414
257456
|
}, ctx);
|
|
257415
257457
|
}
|
|
257416
257458
|
async function createNonInteractive(options, ctx) {
|
|
257417
|
-
ctx.log.info(`Creating a new project at ${
|
|
257459
|
+
ctx.log.info(`Creating a new project at ${resolve11(options.path)}`);
|
|
257418
257460
|
const template2 = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
|
|
257419
257461
|
return await executeCreate({
|
|
257420
257462
|
template: template2,
|
|
@@ -257438,7 +257480,7 @@ async function executeCreate({
|
|
|
257438
257480
|
}, ctx) {
|
|
257439
257481
|
const { log, runTask: runTask2 } = ctx;
|
|
257440
257482
|
const name2 = rawName.trim();
|
|
257441
|
-
const resolvedPath =
|
|
257483
|
+
const resolvedPath = resolve11(projectPath);
|
|
257442
257484
|
const organizationId = await resolveWorkspaceId(ctx, flagWorkspaceId, isInteractive);
|
|
257443
257485
|
const { projectId } = await runTask2("Setting up your project...", async () => {
|
|
257444
257486
|
return await createProjectFiles({
|
|
@@ -257488,8 +257530,46 @@ Examples:
|
|
|
257488
257530
|
$ base44 create my-app --workspace 507f1f77bcf86cd799439011 Creates a base44 project in the given workspace`).hook("preAction", validateCreateOptions).action(createAction);
|
|
257489
257531
|
}
|
|
257490
257532
|
|
|
257533
|
+
// src/cli/commands/site/run-app-deploy.ts
|
|
257534
|
+
async function runAppSiteDeploy({ runTask: runTask2, log }, target, options = {}) {
|
|
257535
|
+
const kind = await detectAppDeployKind(target);
|
|
257536
|
+
if (kind === "none")
|
|
257537
|
+
return { kind: "none" };
|
|
257538
|
+
const isFullStack = kind === "full-stack";
|
|
257539
|
+
const progressLines = [];
|
|
257540
|
+
const warnings = [];
|
|
257541
|
+
const result = await runTask2(isFullStack ? "Deploying full-stack app..." : "Creating archive and deploying site...", async (updateMessage) => await deployAppSite(target, {
|
|
257542
|
+
gitHash: options.gitHash,
|
|
257543
|
+
progress: {
|
|
257544
|
+
onWarning: (message) => {
|
|
257545
|
+
warnings.push(message);
|
|
257546
|
+
},
|
|
257547
|
+
onAssets: ({ totalAssets, newAssets }) => {
|
|
257548
|
+
const line = `Found ${totalAssets} static assets (${newAssets} new)`;
|
|
257549
|
+
progressLines.push(line);
|
|
257550
|
+
updateMessage(line);
|
|
257551
|
+
},
|
|
257552
|
+
onAssetUpload: ({ uploadedFiles, totalFiles }) => {
|
|
257553
|
+
updateMessage(`Uploaded ${uploadedFiles} of ${totalFiles} assets`);
|
|
257554
|
+
},
|
|
257555
|
+
onWorker: ({ moduleCount }) => {
|
|
257556
|
+
updateMessage(`Deploying worker (${moduleCount} modules)…`);
|
|
257557
|
+
}
|
|
257558
|
+
}
|
|
257559
|
+
}), {
|
|
257560
|
+
successMessage: isFullStack ? theme.colors.base44Orange("Full-stack app deployed") : "Site deployed successfully",
|
|
257561
|
+
errorMessage: isFullStack ? "Full-stack deploy failed" : "Deployment failed"
|
|
257562
|
+
});
|
|
257563
|
+
for (const line of progressLines) {
|
|
257564
|
+
log.message(theme.styles.dim(line));
|
|
257565
|
+
}
|
|
257566
|
+
for (const warning of warnings) {
|
|
257567
|
+
log.warn(warning);
|
|
257568
|
+
}
|
|
257569
|
+
return result;
|
|
257570
|
+
}
|
|
257571
|
+
|
|
257491
257572
|
// src/cli/commands/project/deploy.ts
|
|
257492
|
-
import { resolve as resolve11 } from "node:path";
|
|
257493
257573
|
async function deployAction(ctx, options = {}) {
|
|
257494
257574
|
const { isNonInteractive, log } = ctx;
|
|
257495
257575
|
if (isNonInteractive && !options.yes) {
|
|
@@ -257500,9 +257580,8 @@ async function deployAction(ctx, options = {}) {
|
|
|
257500
257580
|
}
|
|
257501
257581
|
const projectData = await readProjectConfig(options.projectRoot);
|
|
257502
257582
|
const { project: project2, entities, functions, agents, connectors, authConfig } = projectData;
|
|
257503
|
-
|
|
257504
|
-
|
|
257505
|
-
if (!hasResourcesToDeploy(projectData) && !isFullStackCandidate) {
|
|
257583
|
+
const plannedSite = await detectAppDeployKind(project2);
|
|
257584
|
+
if (!hasResourcesToDeploy(projectData) && plannedSite === "none") {
|
|
257506
257585
|
return {
|
|
257507
257586
|
outroMessage: "No resources found to deploy"
|
|
257508
257587
|
};
|
|
@@ -257526,7 +257605,7 @@ async function deployAction(ctx, options = {}) {
|
|
|
257526
257605
|
if (project2.visibility) {
|
|
257527
257606
|
summaryLines.push(` - Visibility: ${project2.visibility}`);
|
|
257528
257607
|
}
|
|
257529
|
-
if (
|
|
257608
|
+
if (plannedSite === "full-stack") {
|
|
257530
257609
|
summaryLines.push(" - Full-stack app");
|
|
257531
257610
|
} else if (project2.site?.outputDirectory) {
|
|
257532
257611
|
summaryLines.push(` - Site from ${project2.site.outputDirectory}`);
|
|
@@ -257562,16 +257641,10 @@ ${summaryLines.join(`
|
|
|
257562
257641
|
formatDeployResult(r, log);
|
|
257563
257642
|
}
|
|
257564
257643
|
});
|
|
257565
|
-
await buildSiteIfNeeded(ctx, projectData, options
|
|
257566
|
-
|
|
257567
|
-
|
|
257568
|
-
|
|
257569
|
-
if (fullStackArtifact) {
|
|
257570
|
-
fullStackResult = await runFullStackDeploy(ctx, project2.root, options);
|
|
257571
|
-
} else if (project2.site?.outputDirectory) {
|
|
257572
|
-
const outputDir = resolve11(project2.root, project2.site.outputDirectory);
|
|
257573
|
-
({ appUrl } = await deploySite(outputDir));
|
|
257574
|
-
}
|
|
257644
|
+
await buildSiteIfNeeded(ctx, projectData, options);
|
|
257645
|
+
const siteResult = await runAppSiteDeploy(ctx, project2, {
|
|
257646
|
+
gitHash: options.gitHash
|
|
257647
|
+
});
|
|
257575
257648
|
const connectorResults = result.connectorResults ?? [];
|
|
257576
257649
|
await handleOAuthConnectors(connectorResults, isNonInteractive, options, log);
|
|
257577
257650
|
const stripeResult = connectorResults.find((r) => r.type === "stripe");
|
|
@@ -257579,27 +257652,26 @@ ${summaryLines.join(`
|
|
|
257579
257652
|
printStripeResult(stripeResult, log);
|
|
257580
257653
|
}
|
|
257581
257654
|
log.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl())}`);
|
|
257582
|
-
if (
|
|
257583
|
-
log.message(`${theme.styles.header("App URL")}: ${theme.colors.links(appUrl)}`);
|
|
257655
|
+
if (siteResult.kind === "static") {
|
|
257656
|
+
log.message(`${theme.styles.header("App URL")}: ${theme.colors.links(siteResult.appUrl)}`);
|
|
257584
257657
|
}
|
|
257585
|
-
if (
|
|
257586
|
-
printFullStackSummary(
|
|
257658
|
+
if (siteResult.kind === "full-stack") {
|
|
257659
|
+
printFullStackSummary(siteResult, log);
|
|
257587
257660
|
}
|
|
257588
257661
|
return {
|
|
257589
257662
|
outroMessage: "App deployed successfully",
|
|
257590
|
-
stdout: ctx.jsonMode &&
|
|
257591
|
-
deploymentId:
|
|
257592
|
-
gitHash:
|
|
257663
|
+
stdout: ctx.jsonMode && siteResult.kind === "full-stack" ? `${JSON.stringify({
|
|
257664
|
+
deploymentId: siteResult.deploymentId,
|
|
257665
|
+
gitHash: siteResult.gitHash
|
|
257593
257666
|
}, null, 2)}
|
|
257594
257667
|
` : undefined
|
|
257595
257668
|
};
|
|
257596
257669
|
}
|
|
257597
|
-
async function buildSiteIfNeeded({ runTask: runTask2 }, { project: project2 }, options
|
|
257670
|
+
async function buildSiteIfNeeded({ runTask: runTask2 }, { project: project2 }, options) {
|
|
257598
257671
|
const site2 = project2.site;
|
|
257599
257672
|
if (!site2?.buildCommand || options.prebuilt)
|
|
257600
257673
|
return;
|
|
257601
|
-
|
|
257602
|
-
if (artifactPresent && !options.build)
|
|
257674
|
+
if (await hasBuiltArtifact(project2) && !options.build)
|
|
257603
257675
|
return;
|
|
257604
257676
|
const { installCommand, buildCommand } = site2;
|
|
257605
257677
|
await runTask2(installCommand ? "Installing dependencies..." : "Building project...", async (updateMessage) => {
|
|
@@ -257613,41 +257685,6 @@ async function buildSiteIfNeeded({ runTask: runTask2 }, { project: project2 }, o
|
|
|
257613
257685
|
errorMessage: "Failed to build project"
|
|
257614
257686
|
});
|
|
257615
257687
|
}
|
|
257616
|
-
async function runFullStackDeploy({ runTask: runTask2, log }, projectRoot, options) {
|
|
257617
|
-
const gitHash = await resolveGitHash(projectRoot, options.gitHash);
|
|
257618
|
-
const progressLines = [];
|
|
257619
|
-
const warnings = [];
|
|
257620
|
-
const deployment = await runTask2("Deploying full-stack app...", async (updateMessage) => await deployFullStack({
|
|
257621
|
-
projectRoot,
|
|
257622
|
-
gitHash,
|
|
257623
|
-
progress: {
|
|
257624
|
-
onWarning: (message) => {
|
|
257625
|
-
warnings.push(message);
|
|
257626
|
-
},
|
|
257627
|
-
onAssets: ({ totalAssets, newAssets }) => {
|
|
257628
|
-
const line = `Found ${totalAssets} static assets (${newAssets} new)`;
|
|
257629
|
-
progressLines.push(line);
|
|
257630
|
-
updateMessage(line);
|
|
257631
|
-
},
|
|
257632
|
-
onAssetUpload: ({ uploadedFiles, totalFiles }) => {
|
|
257633
|
-
updateMessage(`Uploaded ${uploadedFiles} of ${totalFiles} assets`);
|
|
257634
|
-
},
|
|
257635
|
-
onWorker: ({ moduleCount }) => {
|
|
257636
|
-
updateMessage(`Deploying worker (${moduleCount} modules)…`);
|
|
257637
|
-
}
|
|
257638
|
-
}
|
|
257639
|
-
}), {
|
|
257640
|
-
successMessage: theme.colors.base44Orange("Full-stack app deployed"),
|
|
257641
|
-
errorMessage: "Full-stack deploy failed"
|
|
257642
|
-
});
|
|
257643
|
-
for (const line of progressLines) {
|
|
257644
|
-
log.message(theme.styles.dim(line));
|
|
257645
|
-
}
|
|
257646
|
-
for (const warning of warnings) {
|
|
257647
|
-
log.warn(warning);
|
|
257648
|
-
}
|
|
257649
|
-
return deployment;
|
|
257650
|
-
}
|
|
257651
257688
|
function printFullStackSummary(deployment, log) {
|
|
257652
257689
|
log.message(`${theme.styles.header("Deployment")}: ${deployment.deploymentId} ${theme.styles.dim(`(commit ${deployment.gitHash.slice(0, 12)})`)}`);
|
|
257653
257690
|
}
|
|
@@ -258517,40 +258554,50 @@ function getSecretsCommand() {
|
|
|
258517
258554
|
}
|
|
258518
258555
|
|
|
258519
258556
|
// src/cli/commands/site/deploy.ts
|
|
258520
|
-
|
|
258521
|
-
|
|
258557
|
+
async function deployAction2(ctx, options) {
|
|
258558
|
+
const { isNonInteractive } = ctx;
|
|
258522
258559
|
if (isNonInteractive && !options.yes) {
|
|
258523
258560
|
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
258524
258561
|
}
|
|
258525
258562
|
const { project: project2 } = await readProjectConfig();
|
|
258526
|
-
|
|
258563
|
+
const kind = await detectAppDeployKind(project2);
|
|
258564
|
+
if (kind === "none") {
|
|
258527
258565
|
throw new ConfigNotFoundError("No site configuration found.", {
|
|
258528
258566
|
hints: [
|
|
258529
258567
|
{
|
|
258530
258568
|
message: `Add 'site.outputDirectory' to your config.jsonc (e.g., "site": { "outputDirectory": "dist" })`
|
|
258569
|
+
},
|
|
258570
|
+
{
|
|
258571
|
+
message: "Full-stack apps ship from their build artifact — run your framework's build first"
|
|
258531
258572
|
}
|
|
258532
258573
|
]
|
|
258533
258574
|
});
|
|
258534
258575
|
}
|
|
258535
|
-
const outputDir = resolve14(project2.root, project2.site.outputDirectory);
|
|
258536
258576
|
if (!options.yes) {
|
|
258537
258577
|
const shouldDeploy = await Re({
|
|
258538
|
-
message: `Deploy site from ${project2.site
|
|
258578
|
+
message: kind === "full-stack" ? "Deploy full-stack app?" : `Deploy site from ${project2.site?.outputDirectory}?`
|
|
258539
258579
|
});
|
|
258540
258580
|
if (Ct(shouldDeploy) || !shouldDeploy) {
|
|
258541
258581
|
return { outroMessage: "Deployment cancelled" };
|
|
258542
258582
|
}
|
|
258543
258583
|
}
|
|
258544
|
-
const result = await
|
|
258545
|
-
|
|
258546
|
-
}, {
|
|
258547
|
-
successMessage: "Site deployed successfully",
|
|
258548
|
-
errorMessage: "Deployment failed"
|
|
258584
|
+
const result = await runAppSiteDeploy(ctx, project2, {
|
|
258585
|
+
gitHash: options.gitHash
|
|
258549
258586
|
});
|
|
258550
|
-
|
|
258587
|
+
if (result.kind === "full-stack") {
|
|
258588
|
+
return {
|
|
258589
|
+
outroMessage: `Deployment ${result.deploymentId} (commit ${result.gitHash.slice(0, 12)})`,
|
|
258590
|
+
stdout: ctx.jsonMode ? `${JSON.stringify({ deploymentId: result.deploymentId, gitHash: result.gitHash }, null, 2)}
|
|
258591
|
+
` : undefined
|
|
258592
|
+
};
|
|
258593
|
+
}
|
|
258594
|
+
if (result.kind === "static") {
|
|
258595
|
+
return { outroMessage: `Visit your site at: ${result.appUrl}` };
|
|
258596
|
+
}
|
|
258597
|
+
return { outroMessage: "Nothing to deploy" };
|
|
258551
258598
|
}
|
|
258552
258599
|
function getSiteDeployCommand() {
|
|
258553
|
-
return new Base44Command("deploy").description("Deploy built site
|
|
258600
|
+
return new Base44Command("deploy").description("Deploy the built site to Base44 hosting (full-stack apps deploy their Workers build)").option("-y, --yes", "Skip confirmation prompt").option("--git-hash <hash>", "Commit the full-stack build came from (defaults to the checkout's HEAD)").action(deployAction2);
|
|
258554
258601
|
}
|
|
258555
258602
|
|
|
258556
258603
|
// src/cli/commands/site/open.ts
|
|
@@ -258922,14 +258969,14 @@ var getLocalHosts = () => {
|
|
|
258922
258969
|
}
|
|
258923
258970
|
return results;
|
|
258924
258971
|
};
|
|
258925
|
-
var checkAvailablePort = (options8) => new Promise((
|
|
258972
|
+
var checkAvailablePort = (options8) => new Promise((resolve15, reject) => {
|
|
258926
258973
|
const server = net.createServer();
|
|
258927
258974
|
server.unref();
|
|
258928
258975
|
server.on("error", reject);
|
|
258929
258976
|
server.listen(options8, () => {
|
|
258930
258977
|
const { port } = server.address();
|
|
258931
258978
|
server.close(() => {
|
|
258932
|
-
|
|
258979
|
+
resolve15(port);
|
|
258933
258980
|
});
|
|
258934
258981
|
});
|
|
258935
258982
|
});
|
|
@@ -259174,7 +259221,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
259174
259221
|
});
|
|
259175
259222
|
}
|
|
259176
259223
|
waitForReady(name2, runningFunc) {
|
|
259177
|
-
return new Promise((
|
|
259224
|
+
return new Promise((resolve15, reject) => {
|
|
259178
259225
|
runningFunc.process.on("exit", (code2) => {
|
|
259179
259226
|
if (!runningFunc.ready) {
|
|
259180
259227
|
clearTimeout(timeout3);
|
|
@@ -259197,7 +259244,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
259197
259244
|
runningFunc.ready = true;
|
|
259198
259245
|
clearTimeout(timeout3);
|
|
259199
259246
|
runningFunc.process.stdout?.off("data", onData);
|
|
259200
|
-
|
|
259247
|
+
resolve15(runningFunc.port);
|
|
259201
259248
|
}
|
|
259202
259249
|
};
|
|
259203
259250
|
runningFunc.process.stdout?.on("data", onData);
|
|
@@ -261631,7 +261678,7 @@ class NodeFsHandler {
|
|
|
261631
261678
|
this._addToNodeFs(path19, initialAdd, wh2, depth + 1);
|
|
261632
261679
|
}
|
|
261633
261680
|
}).on(EV.ERROR, this._boundHandleError);
|
|
261634
|
-
return new Promise((
|
|
261681
|
+
return new Promise((resolve16, reject) => {
|
|
261635
261682
|
if (!stream)
|
|
261636
261683
|
return reject();
|
|
261637
261684
|
stream.once(STR_END, () => {
|
|
@@ -261640,7 +261687,7 @@ class NodeFsHandler {
|
|
|
261640
261687
|
return;
|
|
261641
261688
|
}
|
|
261642
261689
|
const wasThrottled = throttler ? throttler.clear() : false;
|
|
261643
|
-
|
|
261690
|
+
resolve16(undefined);
|
|
261644
261691
|
previous.getChildren().filter((item) => {
|
|
261645
261692
|
return item !== directory && !current.has(item);
|
|
261646
261693
|
}).forEach((item) => {
|
|
@@ -262557,7 +262604,7 @@ async function createDevServer(options8) {
|
|
|
262557
262604
|
}
|
|
262558
262605
|
remoteProxy(req, res, next);
|
|
262559
262606
|
});
|
|
262560
|
-
const server = await new Promise((
|
|
262607
|
+
const server = await new Promise((resolve17, reject) => {
|
|
262561
262608
|
const s5 = app.listen(port, "127.0.0.1", (err) => {
|
|
262562
262609
|
if (err) {
|
|
262563
262610
|
if ("code" in err && err.code === "EADDRINUSE") {
|
|
@@ -262566,7 +262613,7 @@ async function createDevServer(options8) {
|
|
|
262566
262613
|
reject(err);
|
|
262567
262614
|
}
|
|
262568
262615
|
} else {
|
|
262569
|
-
|
|
262616
|
+
resolve17(s5);
|
|
262570
262617
|
}
|
|
262571
262618
|
});
|
|
262572
262619
|
});
|
|
@@ -262616,13 +262663,13 @@ async function createDevServer(options8) {
|
|
|
262616
262663
|
if (!server.listening) {
|
|
262617
262664
|
return;
|
|
262618
262665
|
}
|
|
262619
|
-
await new Promise((
|
|
262666
|
+
await new Promise((resolve17, reject) => {
|
|
262620
262667
|
server.close((error48) => {
|
|
262621
262668
|
if (error48) {
|
|
262622
262669
|
reject(error48);
|
|
262623
262670
|
return;
|
|
262624
262671
|
}
|
|
262625
|
-
|
|
262672
|
+
resolve17();
|
|
262626
262673
|
});
|
|
262627
262674
|
});
|
|
262628
262675
|
};
|
|
@@ -262693,15 +262740,15 @@ class ServeRunner {
|
|
|
262693
262740
|
return;
|
|
262694
262741
|
}
|
|
262695
262742
|
this.stopping = true;
|
|
262696
|
-
const exited = new Promise((
|
|
262743
|
+
const exited = new Promise((resolve17) => child.once("exit", () => resolve17()));
|
|
262697
262744
|
if (process23.platform === "win32" && child.pid) {
|
|
262698
262745
|
const taskkill = spawn3("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
|
|
262699
262746
|
stdio: "ignore",
|
|
262700
262747
|
windowsHide: true
|
|
262701
262748
|
});
|
|
262702
|
-
await new Promise((
|
|
262703
|
-
taskkill.once("exit", () =>
|
|
262704
|
-
taskkill.once("error", () =>
|
|
262749
|
+
await new Promise((resolve17) => {
|
|
262750
|
+
taskkill.once("exit", () => resolve17());
|
|
262751
|
+
taskkill.once("error", () => resolve17());
|
|
262705
262752
|
});
|
|
262706
262753
|
} else if (child.pid) {
|
|
262707
262754
|
try {
|
|
@@ -262871,13 +262918,13 @@ async function runScript(options8) {
|
|
|
262871
262918
|
}
|
|
262872
262919
|
// src/cli/commands/exec.ts
|
|
262873
262920
|
function readStdin2() {
|
|
262874
|
-
return new Promise((
|
|
262921
|
+
return new Promise((resolve17, reject) => {
|
|
262875
262922
|
let data = "";
|
|
262876
262923
|
process.stdin.setEncoding("utf-8");
|
|
262877
262924
|
process.stdin.on("data", (chunk) => {
|
|
262878
262925
|
data += chunk;
|
|
262879
262926
|
});
|
|
262880
|
-
process.stdin.on("end", () =>
|
|
262927
|
+
process.stdin.on("end", () => resolve17(data));
|
|
262881
262928
|
process.stdin.on("error", reject);
|
|
262882
262929
|
});
|
|
262883
262930
|
}
|
|
@@ -262948,7 +262995,7 @@ Examples:
|
|
|
262948
262995
|
}
|
|
262949
262996
|
|
|
262950
262997
|
// src/cli/commands/project/eject.ts
|
|
262951
|
-
import { resolve as
|
|
262998
|
+
import { resolve as resolve17 } from "node:path";
|
|
262952
262999
|
var import_kebabCase2 = __toESM(require_kebabCase(), 1);
|
|
262953
263000
|
async function eject(ctx, options8, command2) {
|
|
262954
263001
|
const { log, runTask: runTask2, isNonInteractive } = ctx;
|
|
@@ -263012,7 +263059,7 @@ async function eject(ctx, options8, command2) {
|
|
|
263012
263059
|
Ne("Operation cancelled.");
|
|
263013
263060
|
throw new CLIExitError(0);
|
|
263014
263061
|
}
|
|
263015
|
-
const resolvedPath =
|
|
263062
|
+
const resolvedPath = resolve17(selectedPath);
|
|
263016
263063
|
await runTask2("Downloading your project's code...", async (updateMessage) => {
|
|
263017
263064
|
await createProjectFilesForExistingProject({
|
|
263018
263065
|
projectId,
|
|
@@ -265387,14 +265434,14 @@ async function addSourceContext(frames) {
|
|
|
265387
265434
|
return frames;
|
|
265388
265435
|
}
|
|
265389
265436
|
function getContextLinesFromFile(path19, ranges, output) {
|
|
265390
|
-
return new Promise((
|
|
265437
|
+
return new Promise((resolve18) => {
|
|
265391
265438
|
const stream = createReadStream2(path19);
|
|
265392
265439
|
const lineReaded = createInterface2({
|
|
265393
265440
|
input: stream
|
|
265394
265441
|
});
|
|
265395
265442
|
function destroyStreamAndResolve() {
|
|
265396
265443
|
stream.destroy();
|
|
265397
|
-
|
|
265444
|
+
resolve18();
|
|
265398
265445
|
}
|
|
265399
265446
|
let lineNumber = 0;
|
|
265400
265447
|
let currentRangeIndex = 0;
|
|
@@ -266506,15 +266553,15 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
266506
266553
|
return true;
|
|
266507
266554
|
if (this.featureFlagsPoller === undefined)
|
|
266508
266555
|
return false;
|
|
266509
|
-
return new Promise((
|
|
266556
|
+
return new Promise((resolve18) => {
|
|
266510
266557
|
const timeout3 = setTimeout(() => {
|
|
266511
266558
|
cleanup();
|
|
266512
|
-
|
|
266559
|
+
resolve18(false);
|
|
266513
266560
|
}, timeoutMs);
|
|
266514
266561
|
const cleanup = this._events.on("localEvaluationFlagsLoaded", (count2) => {
|
|
266515
266562
|
clearTimeout(timeout3);
|
|
266516
266563
|
cleanup();
|
|
266517
|
-
|
|
266564
|
+
resolve18(count2 > 0);
|
|
266518
266565
|
});
|
|
266519
266566
|
});
|
|
266520
266567
|
}
|
|
@@ -267339,4 +267386,4 @@ export {
|
|
|
267339
267386
|
CLIExitError
|
|
267340
267387
|
};
|
|
267341
267388
|
|
|
267342
|
-
//# debugId=
|
|
267389
|
+
//# debugId=FB9E6446856AEBA564756E2164756E21
|