@base44-preview/cli 0.0.55-pr.546.2cca7dc → 0.0.56-pr.547.451bc1a
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/README.md +8 -0
- package/dist/cli/index.js +717 -223
- package/dist/cli/index.js.map +27 -14
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -120878,7 +120878,7 @@ function parse42(toml, { maxDepth = 1000, integersAsBigInt } = {}) {
|
|
|
120878
120878
|
}
|
|
120879
120879
|
return res;
|
|
120880
120880
|
}
|
|
120881
|
-
async function
|
|
120881
|
+
async function readFile3(file2) {
|
|
120882
120882
|
if (isUrlString(file2)) {
|
|
120883
120883
|
file2 = new URL(file2);
|
|
120884
120884
|
}
|
|
@@ -134672,7 +134672,7 @@ ${codeblock}`, options8);
|
|
|
134672
134672
|
"\\": "\\"
|
|
134673
134673
|
};
|
|
134674
134674
|
KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
|
|
134675
|
-
read_file_default =
|
|
134675
|
+
read_file_default = readFile3;
|
|
134676
134676
|
loadConfigFromPackageJson = process.versions.bun ? async function loadConfigFromBunPackageJson(file2) {
|
|
134677
134677
|
const { prettier } = await readBunPackageJson(file2);
|
|
134678
134678
|
return prettier;
|
|
@@ -138269,11 +138269,11 @@ var require_prettier = __commonJS((exports, module) => {
|
|
|
138269
138269
|
var require_formatter = __commonJS((exports) => {
|
|
138270
138270
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
|
|
138271
138271
|
function adopt(value) {
|
|
138272
|
-
return value instanceof P9 ? value : new P9(function(
|
|
138273
|
-
|
|
138272
|
+
return value instanceof P9 ? value : new P9(function(resolve12) {
|
|
138273
|
+
resolve12(value);
|
|
138274
138274
|
});
|
|
138275
138275
|
}
|
|
138276
|
-
return new (P9 || (P9 = Promise))(function(
|
|
138276
|
+
return new (P9 || (P9 = Promise))(function(resolve12, reject) {
|
|
138277
138277
|
function fulfilled(value) {
|
|
138278
138278
|
try {
|
|
138279
138279
|
step(generator.next(value));
|
|
@@ -138289,7 +138289,7 @@ var require_formatter = __commonJS((exports) => {
|
|
|
138289
138289
|
}
|
|
138290
138290
|
}
|
|
138291
138291
|
function step(result) {
|
|
138292
|
-
result.done ?
|
|
138292
|
+
result.done ? resolve12(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
138293
138293
|
}
|
|
138294
138294
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
138295
138295
|
});
|
|
@@ -142942,7 +142942,7 @@ var require_url = __commonJS((exports) => {
|
|
|
142942
142942
|
};
|
|
142943
142943
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
142944
142944
|
exports.parse = undefined;
|
|
142945
|
-
exports.resolve =
|
|
142945
|
+
exports.resolve = resolve12;
|
|
142946
142946
|
exports.cwd = cwd;
|
|
142947
142947
|
exports.getProtocol = getProtocol;
|
|
142948
142948
|
exports.getExtension = getExtension;
|
|
@@ -142970,7 +142970,7 @@ var require_url = __commonJS((exports) => {
|
|
|
142970
142970
|
var urlDecodePatterns = [/%23/g, "#", /%24/g, "$", /%26/g, "&", /%2C/g, ",", /%40/g, "@"];
|
|
142971
142971
|
var parse11 = (u4) => new URL(u4);
|
|
142972
142972
|
exports.parse = parse11;
|
|
142973
|
-
function
|
|
142973
|
+
function resolve12(from, to5) {
|
|
142974
142974
|
const fromUrl = new URL((0, convert_path_to_posix_1.default)(from), "https://aaa.nonexistanturl.com");
|
|
142975
142975
|
const resolvedUrl = new URL((0, convert_path_to_posix_1.default)(to5), fromUrl);
|
|
142976
142976
|
const endSpaces = to5.match(/(\s*)$/)?.[1] || "";
|
|
@@ -143106,7 +143106,7 @@ var require_url = __commonJS((exports) => {
|
|
|
143106
143106
|
}
|
|
143107
143107
|
function relative4(from, to5) {
|
|
143108
143108
|
if (!isFileSystemPath(from) || !isFileSystemPath(to5)) {
|
|
143109
|
-
return
|
|
143109
|
+
return resolve12(from, to5);
|
|
143110
143110
|
}
|
|
143111
143111
|
const fromDir = path_1.default.dirname(stripHash(from));
|
|
143112
143112
|
const toPath4 = stripHash(to5);
|
|
@@ -143782,7 +143782,7 @@ var require_plugins = __commonJS((exports) => {
|
|
|
143782
143782
|
let plugin;
|
|
143783
143783
|
let lastError;
|
|
143784
143784
|
let index = 0;
|
|
143785
|
-
return new Promise((
|
|
143785
|
+
return new Promise((resolve12, reject) => {
|
|
143786
143786
|
runNextPlugin();
|
|
143787
143787
|
function runNextPlugin() {
|
|
143788
143788
|
plugin = plugins[index++];
|
|
@@ -143810,7 +143810,7 @@ var require_plugins = __commonJS((exports) => {
|
|
|
143810
143810
|
}
|
|
143811
143811
|
}
|
|
143812
143812
|
function onSuccess(result) {
|
|
143813
|
-
|
|
143813
|
+
resolve12({
|
|
143814
143814
|
plugin,
|
|
143815
143815
|
result
|
|
143816
143816
|
});
|
|
@@ -143907,7 +143907,7 @@ var require_parse7 = __commonJS((exports) => {
|
|
|
143907
143907
|
extension: url3.getExtension(path18)
|
|
143908
143908
|
};
|
|
143909
143909
|
try {
|
|
143910
|
-
const resolver = await
|
|
143910
|
+
const resolver = await readFile4(file2, options8, $refs);
|
|
143911
143911
|
$ref.pathType = resolver.plugin.name;
|
|
143912
143912
|
file2.data = resolver.result;
|
|
143913
143913
|
const parser2 = await parseFile(file2, options8, $refs);
|
|
@@ -143920,7 +143920,7 @@ var require_parse7 = __commonJS((exports) => {
|
|
|
143920
143920
|
throw err;
|
|
143921
143921
|
}
|
|
143922
143922
|
}
|
|
143923
|
-
async function
|
|
143923
|
+
async function readFile4(file2, options8, $refs) {
|
|
143924
143924
|
let resolvers = plugins.all(options8.resolve);
|
|
143925
143925
|
resolvers = plugins.filter(resolvers, "canRead", file2);
|
|
143926
143926
|
plugins.sort(resolvers);
|
|
@@ -145143,11 +145143,11 @@ var require_lib3 = __commonJS((exports) => {
|
|
|
145143
145143
|
var require_resolver = __commonJS((exports) => {
|
|
145144
145144
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
|
|
145145
145145
|
function adopt(value) {
|
|
145146
|
-
return value instanceof P9 ? value : new P9(function(
|
|
145147
|
-
|
|
145146
|
+
return value instanceof P9 ? value : new P9(function(resolve12) {
|
|
145147
|
+
resolve12(value);
|
|
145148
145148
|
});
|
|
145149
145149
|
}
|
|
145150
|
-
return new (P9 || (P9 = Promise))(function(
|
|
145150
|
+
return new (P9 || (P9 = Promise))(function(resolve12, reject) {
|
|
145151
145151
|
function fulfilled(value) {
|
|
145152
145152
|
try {
|
|
145153
145153
|
step(generator.next(value));
|
|
@@ -145163,7 +145163,7 @@ var require_resolver = __commonJS((exports) => {
|
|
|
145163
145163
|
}
|
|
145164
145164
|
}
|
|
145165
145165
|
function step(result) {
|
|
145166
|
-
result.done ?
|
|
145166
|
+
result.done ? resolve12(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
145167
145167
|
}
|
|
145168
145168
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
145169
145169
|
});
|
|
@@ -145284,11 +145284,11 @@ var require_optionValidator = __commonJS((exports) => {
|
|
|
145284
145284
|
var require_src3 = __commonJS((exports) => {
|
|
145285
145285
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
|
|
145286
145286
|
function adopt(value) {
|
|
145287
|
-
return value instanceof P9 ? value : new P9(function(
|
|
145288
|
-
|
|
145287
|
+
return value instanceof P9 ? value : new P9(function(resolve12) {
|
|
145288
|
+
resolve12(value);
|
|
145289
145289
|
});
|
|
145290
145290
|
}
|
|
145291
|
-
return new (P9 || (P9 = Promise))(function(
|
|
145291
|
+
return new (P9 || (P9 = Promise))(function(resolve12, reject) {
|
|
145292
145292
|
function fulfilled(value) {
|
|
145293
145293
|
try {
|
|
145294
145294
|
step(generator.next(value));
|
|
@@ -145304,7 +145304,7 @@ var require_src3 = __commonJS((exports) => {
|
|
|
145304
145304
|
}
|
|
145305
145305
|
}
|
|
145306
145306
|
function step(result) {
|
|
145307
|
-
result.done ?
|
|
145307
|
+
result.done ? resolve12(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
145308
145308
|
}
|
|
145309
145309
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
145310
145310
|
});
|
|
@@ -150819,11 +150819,11 @@ var require_raw_body = __commonJS((exports, module) => {
|
|
|
150819
150819
|
if (done) {
|
|
150820
150820
|
return readStream(stream, encoding, length, limit, wrap(done));
|
|
150821
150821
|
}
|
|
150822
|
-
return new Promise(function executor(
|
|
150822
|
+
return new Promise(function executor(resolve12, reject) {
|
|
150823
150823
|
readStream(stream, encoding, length, limit, function onRead2(err, buf) {
|
|
150824
150824
|
if (err)
|
|
150825
150825
|
return reject(err);
|
|
150826
|
-
|
|
150826
|
+
resolve12(buf);
|
|
150827
150827
|
});
|
|
150828
150828
|
});
|
|
150829
150829
|
}
|
|
@@ -163948,7 +163948,7 @@ var require_view = __commonJS((exports, module) => {
|
|
|
163948
163948
|
var basename6 = path18.basename;
|
|
163949
163949
|
var extname2 = path18.extname;
|
|
163950
163950
|
var join25 = path18.join;
|
|
163951
|
-
var
|
|
163951
|
+
var resolve12 = path18.resolve;
|
|
163952
163952
|
module.exports = View;
|
|
163953
163953
|
function View(name2, options8) {
|
|
163954
163954
|
var opts = options8 || {};
|
|
@@ -163982,7 +163982,7 @@ var require_view = __commonJS((exports, module) => {
|
|
|
163982
163982
|
debug('lookup "%s"', name2);
|
|
163983
163983
|
for (var i5 = 0;i5 < roots.length && !path19; i5++) {
|
|
163984
163984
|
var root2 = roots[i5];
|
|
163985
|
-
var loc =
|
|
163985
|
+
var loc = resolve12(root2, name2);
|
|
163986
163986
|
var dir = dirname19(loc);
|
|
163987
163987
|
var file2 = basename6(loc);
|
|
163988
163988
|
path19 = this.resolve(dir, file2);
|
|
@@ -164007,7 +164007,7 @@ var require_view = __commonJS((exports, module) => {
|
|
|
164007
164007
|
});
|
|
164008
164008
|
sync = false;
|
|
164009
164009
|
};
|
|
164010
|
-
View.prototype.resolve = function
|
|
164010
|
+
View.prototype.resolve = function resolve13(dir, file2) {
|
|
164011
164011
|
var ext = this.ext;
|
|
164012
164012
|
var path19 = join25(dir, file2);
|
|
164013
164013
|
var stat2 = tryStat(path19);
|
|
@@ -166166,7 +166166,7 @@ var require_application = __commonJS((exports, module) => {
|
|
|
166166
166166
|
var compileETag = require_utils10().compileETag;
|
|
166167
166167
|
var compileQueryParser = require_utils10().compileQueryParser;
|
|
166168
166168
|
var compileTrust = require_utils10().compileTrust;
|
|
166169
|
-
var
|
|
166169
|
+
var resolve12 = __require("node:path").resolve;
|
|
166170
166170
|
var once9 = require_once();
|
|
166171
166171
|
var Router = require_router();
|
|
166172
166172
|
var slice = Array.prototype.slice;
|
|
@@ -166220,7 +166220,7 @@ var require_application = __commonJS((exports, module) => {
|
|
|
166220
166220
|
this.mountpath = "/";
|
|
166221
166221
|
this.locals.settings = this.settings;
|
|
166222
166222
|
this.set("view", View);
|
|
166223
|
-
this.set("views",
|
|
166223
|
+
this.set("views", resolve12("views"));
|
|
166224
166224
|
this.set("jsonp callback name", "callback");
|
|
166225
166225
|
if (env3 === "production") {
|
|
166226
166226
|
this.enable("view cache");
|
|
@@ -167711,7 +167711,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
167711
167711
|
var extname2 = path18.extname;
|
|
167712
167712
|
var join25 = path18.join;
|
|
167713
167713
|
var normalize2 = path18.normalize;
|
|
167714
|
-
var
|
|
167714
|
+
var resolve12 = path18.resolve;
|
|
167715
167715
|
var sep = path18.sep;
|
|
167716
167716
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
167717
167717
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1000;
|
|
@@ -167740,7 +167740,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
167740
167740
|
this._maxage = opts.maxAge || opts.maxage;
|
|
167741
167741
|
this._maxage = typeof this._maxage === "string" ? ms8(this._maxage) : Number(this._maxage);
|
|
167742
167742
|
this._maxage = !isNaN(this._maxage) ? Math.min(Math.max(0, this._maxage), MAX_MAXAGE) : 0;
|
|
167743
|
-
this._root = opts.root ?
|
|
167743
|
+
this._root = opts.root ? resolve12(opts.root) : null;
|
|
167744
167744
|
}
|
|
167745
167745
|
util2.inherits(SendStream, Stream2);
|
|
167746
167746
|
SendStream.prototype.error = function error48(status, err) {
|
|
@@ -167889,7 +167889,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
167889
167889
|
return res;
|
|
167890
167890
|
}
|
|
167891
167891
|
parts = normalize2(path19).split(sep);
|
|
167892
|
-
path19 =
|
|
167892
|
+
path19 = resolve12(path19);
|
|
167893
167893
|
}
|
|
167894
167894
|
if (containsDotFile(parts)) {
|
|
167895
167895
|
debug('%s dotfile "%s"', this._dotfiles, path19);
|
|
@@ -168217,7 +168217,7 @@ var require_response = __commonJS((exports, module) => {
|
|
|
168217
168217
|
var cookie = require_cookie();
|
|
168218
168218
|
var send = require_send();
|
|
168219
168219
|
var extname2 = path18.extname;
|
|
168220
|
-
var
|
|
168220
|
+
var resolve12 = path18.resolve;
|
|
168221
168221
|
var vary = require_vary();
|
|
168222
168222
|
var { Buffer: Buffer7 } = __require("node:buffer");
|
|
168223
168223
|
var res = Object.create(http.ServerResponse.prototype);
|
|
@@ -168426,7 +168426,7 @@ var require_response = __commonJS((exports, module) => {
|
|
|
168426
168426
|
}
|
|
168427
168427
|
opts = Object.create(opts);
|
|
168428
168428
|
opts.headers = headers;
|
|
168429
|
-
var fullPath = !opts.root ?
|
|
168429
|
+
var fullPath = !opts.root ? resolve12(path19) : path19;
|
|
168430
168430
|
return this.sendFile(fullPath, opts, done);
|
|
168431
168431
|
};
|
|
168432
168432
|
res.contentType = res.type = function contentType(type) {
|
|
@@ -168687,7 +168687,7 @@ var require_serve_static = __commonJS((exports, module) => {
|
|
|
168687
168687
|
var encodeUrl = require_encodeurl();
|
|
168688
168688
|
var escapeHtml = require_escape_html();
|
|
168689
168689
|
var parseUrl = require_parseurl();
|
|
168690
|
-
var
|
|
168690
|
+
var resolve12 = __require("path").resolve;
|
|
168691
168691
|
var send = require_send();
|
|
168692
168692
|
var url3 = __require("url");
|
|
168693
168693
|
module.exports = serveStatic;
|
|
@@ -168706,7 +168706,7 @@ var require_serve_static = __commonJS((exports, module) => {
|
|
|
168706
168706
|
throw new TypeError("option setHeaders must be function");
|
|
168707
168707
|
}
|
|
168708
168708
|
opts.maxage = opts.maxage || opts.maxAge || 0;
|
|
168709
|
-
opts.root =
|
|
168709
|
+
opts.root = resolve12(root2);
|
|
168710
168710
|
var onDirectory = redirect ? createRedirectDirectoryListener() : createNotFoundDirectoryListener();
|
|
168711
168711
|
return function serveStatic2(req, res, next) {
|
|
168712
168712
|
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
@@ -172080,8 +172080,8 @@ var require_executor = __commonJS((exports, module) => {
|
|
|
172080
172080
|
}
|
|
172081
172081
|
resetBuffer() {
|
|
172082
172082
|
this.buffer = new Waterfall;
|
|
172083
|
-
this.buffer.chain(new Promise((
|
|
172084
|
-
this._triggerBuffer =
|
|
172083
|
+
this.buffer.chain(new Promise((resolve12) => {
|
|
172084
|
+
this._triggerBuffer = resolve12;
|
|
172085
172085
|
}));
|
|
172086
172086
|
if (this.ready)
|
|
172087
172087
|
this._triggerBuffer();
|
|
@@ -173101,7 +173101,7 @@ var require_storage = __commonJS((exports, module) => {
|
|
|
173101
173101
|
throw e8;
|
|
173102
173102
|
}
|
|
173103
173103
|
};
|
|
173104
|
-
var writeFileLinesAsync = (filename, lines, mode = DEFAULT_FILE_MODE) => new Promise((
|
|
173104
|
+
var writeFileLinesAsync = (filename, lines, mode = DEFAULT_FILE_MODE) => new Promise((resolve12, reject) => {
|
|
173105
173105
|
try {
|
|
173106
173106
|
const stream = writeFileStream(filename, { mode });
|
|
173107
173107
|
const readable2 = Readable6.from(lines);
|
|
@@ -173118,7 +173118,7 @@ var require_storage = __commonJS((exports, module) => {
|
|
|
173118
173118
|
if (err)
|
|
173119
173119
|
reject(err);
|
|
173120
173120
|
else
|
|
173121
|
-
|
|
173121
|
+
resolve12();
|
|
173122
173122
|
});
|
|
173123
173123
|
});
|
|
173124
173124
|
readable2.on("error", (err) => {
|
|
@@ -173289,7 +173289,7 @@ var require_persistence = __commonJS((exports, module) => {
|
|
|
173289
173289
|
return { data: tdata, indexes };
|
|
173290
173290
|
}
|
|
173291
173291
|
treatRawStreamAsync(rawStream) {
|
|
173292
|
-
return new Promise((
|
|
173292
|
+
return new Promise((resolve12, reject) => {
|
|
173293
173293
|
const dataById = {};
|
|
173294
173294
|
const indexes = {};
|
|
173295
173295
|
let corruptItems = 0;
|
|
@@ -173332,7 +173332,7 @@ var require_persistence = __commonJS((exports, module) => {
|
|
|
173332
173332
|
}
|
|
173333
173333
|
}
|
|
173334
173334
|
const data = Object.values(dataById);
|
|
173335
|
-
|
|
173335
|
+
resolve12({ data, indexes });
|
|
173336
173336
|
});
|
|
173337
173337
|
lineStream.on("error", function(err) {
|
|
173338
173338
|
reject(err, null);
|
|
@@ -198943,13 +198943,13 @@ var require_broadcast_operator = __commonJS((exports) => {
|
|
|
198943
198943
|
return true;
|
|
198944
198944
|
}
|
|
198945
198945
|
emitWithAck(ev2, ...args) {
|
|
198946
|
-
return new Promise((
|
|
198946
|
+
return new Promise((resolve12, reject) => {
|
|
198947
198947
|
args.push((err, responses) => {
|
|
198948
198948
|
if (err) {
|
|
198949
198949
|
err.responses = responses;
|
|
198950
198950
|
return reject(err);
|
|
198951
198951
|
} else {
|
|
198952
|
-
return
|
|
198952
|
+
return resolve12(responses);
|
|
198953
198953
|
}
|
|
198954
198954
|
});
|
|
198955
198955
|
this.emit(ev2, ...args);
|
|
@@ -199137,12 +199137,12 @@ var require_socket2 = __commonJS((exports) => {
|
|
|
199137
199137
|
}
|
|
199138
199138
|
emitWithAck(ev2, ...args) {
|
|
199139
199139
|
const withErr = this.flags.timeout !== undefined;
|
|
199140
|
-
return new Promise((
|
|
199140
|
+
return new Promise((resolve12, reject) => {
|
|
199141
199141
|
args.push((arg1, arg2) => {
|
|
199142
199142
|
if (withErr) {
|
|
199143
|
-
return arg1 ? reject(arg1) :
|
|
199143
|
+
return arg1 ? reject(arg1) : resolve12(arg2);
|
|
199144
199144
|
} else {
|
|
199145
|
-
return
|
|
199145
|
+
return resolve12(arg1);
|
|
199146
199146
|
}
|
|
199147
199147
|
});
|
|
199148
199148
|
this.emit(ev2, ...args);
|
|
@@ -199597,13 +199597,13 @@ var require_namespace = __commonJS((exports) => {
|
|
|
199597
199597
|
return true;
|
|
199598
199598
|
}
|
|
199599
199599
|
serverSideEmitWithAck(ev2, ...args) {
|
|
199600
|
-
return new Promise((
|
|
199600
|
+
return new Promise((resolve12, reject) => {
|
|
199601
199601
|
args.push((err, responses) => {
|
|
199602
199602
|
if (err) {
|
|
199603
199603
|
err.responses = responses;
|
|
199604
199604
|
return reject(err);
|
|
199605
199605
|
} else {
|
|
199606
|
-
return
|
|
199606
|
+
return resolve12(responses);
|
|
199607
199607
|
}
|
|
199608
199608
|
});
|
|
199609
199609
|
this.serverSideEmit(ev2, ...args);
|
|
@@ -200287,7 +200287,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
200287
200287
|
return localSockets;
|
|
200288
200288
|
}
|
|
200289
200289
|
const requestId = randomId();
|
|
200290
|
-
return new Promise((
|
|
200290
|
+
return new Promise((resolve12, reject) => {
|
|
200291
200291
|
const timeout3 = setTimeout(() => {
|
|
200292
200292
|
const storedRequest2 = this.requests.get(requestId);
|
|
200293
200293
|
if (storedRequest2) {
|
|
@@ -200297,7 +200297,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
200297
200297
|
}, opts.flags.timeout || DEFAULT_TIMEOUT);
|
|
200298
200298
|
const storedRequest = {
|
|
200299
200299
|
type: MessageType.FETCH_SOCKETS,
|
|
200300
|
-
resolve:
|
|
200300
|
+
resolve: resolve12,
|
|
200301
200301
|
timeout: timeout3,
|
|
200302
200302
|
current: 0,
|
|
200303
200303
|
expected: expectedResponseCount,
|
|
@@ -200507,7 +200507,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
200507
200507
|
return localSockets;
|
|
200508
200508
|
}
|
|
200509
200509
|
const requestId = randomId();
|
|
200510
|
-
return new Promise((
|
|
200510
|
+
return new Promise((resolve12, reject) => {
|
|
200511
200511
|
const timeout3 = setTimeout(() => {
|
|
200512
200512
|
const storedRequest2 = this.customRequests.get(requestId);
|
|
200513
200513
|
if (storedRequest2) {
|
|
@@ -200517,7 +200517,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
200517
200517
|
}, opts.flags.timeout || DEFAULT_TIMEOUT);
|
|
200518
200518
|
const storedRequest = {
|
|
200519
200519
|
type: MessageType.FETCH_SOCKETS,
|
|
200520
|
-
resolve:
|
|
200520
|
+
resolve: resolve12,
|
|
200521
200521
|
timeout: timeout3,
|
|
200522
200522
|
missingUids: new Set([...this.nodesMap.keys()]),
|
|
200523
200523
|
responses: localSockets
|
|
@@ -201246,13 +201246,13 @@ var require_dist4 = __commonJS((exports, module) => {
|
|
|
201246
201246
|
this.engine.close();
|
|
201247
201247
|
(0, uws_1.restoreAdapter)();
|
|
201248
201248
|
if (this.httpServer) {
|
|
201249
|
-
return new Promise((
|
|
201249
|
+
return new Promise((resolve12) => {
|
|
201250
201250
|
this.httpServer.close((err) => {
|
|
201251
201251
|
fn9 && fn9(err);
|
|
201252
201252
|
if (err) {
|
|
201253
201253
|
debug("server was not running");
|
|
201254
201254
|
}
|
|
201255
|
-
|
|
201255
|
+
resolve12();
|
|
201256
201256
|
});
|
|
201257
201257
|
});
|
|
201258
201258
|
} else {
|
|
@@ -215914,14 +215914,14 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
215914
215914
|
};
|
|
215915
215915
|
}
|
|
215916
215916
|
function readAndResolve(iter) {
|
|
215917
|
-
var
|
|
215918
|
-
if (
|
|
215917
|
+
var resolve12 = iter[kLastResolve];
|
|
215918
|
+
if (resolve12 !== null) {
|
|
215919
215919
|
var data = iter[kStream].read();
|
|
215920
215920
|
if (data !== null) {
|
|
215921
215921
|
iter[kLastPromise] = null;
|
|
215922
215922
|
iter[kLastResolve] = null;
|
|
215923
215923
|
iter[kLastReject] = null;
|
|
215924
|
-
|
|
215924
|
+
resolve12(createIterResult(data, false));
|
|
215925
215925
|
}
|
|
215926
215926
|
}
|
|
215927
215927
|
}
|
|
@@ -215929,13 +215929,13 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
215929
215929
|
process.nextTick(readAndResolve, iter);
|
|
215930
215930
|
}
|
|
215931
215931
|
function wrapForNext(lastPromise, iter) {
|
|
215932
|
-
return function(
|
|
215932
|
+
return function(resolve12, reject) {
|
|
215933
215933
|
lastPromise.then(function() {
|
|
215934
215934
|
if (iter[kEnded]) {
|
|
215935
|
-
|
|
215935
|
+
resolve12(createIterResult(undefined, true));
|
|
215936
215936
|
return;
|
|
215937
215937
|
}
|
|
215938
|
-
iter[kHandlePromise](
|
|
215938
|
+
iter[kHandlePromise](resolve12, reject);
|
|
215939
215939
|
}, reject);
|
|
215940
215940
|
};
|
|
215941
215941
|
}
|
|
@@ -215954,12 +215954,12 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
215954
215954
|
return Promise.resolve(createIterResult(undefined, true));
|
|
215955
215955
|
}
|
|
215956
215956
|
if (this[kStream].destroyed) {
|
|
215957
|
-
return new Promise(function(
|
|
215957
|
+
return new Promise(function(resolve12, reject) {
|
|
215958
215958
|
process.nextTick(function() {
|
|
215959
215959
|
if (_this[kError]) {
|
|
215960
215960
|
reject(_this[kError]);
|
|
215961
215961
|
} else {
|
|
215962
|
-
|
|
215962
|
+
resolve12(createIterResult(undefined, true));
|
|
215963
215963
|
}
|
|
215964
215964
|
});
|
|
215965
215965
|
});
|
|
@@ -215982,13 +215982,13 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
215982
215982
|
return this;
|
|
215983
215983
|
}), _defineProperty(_Object$setPrototypeO, "return", function _return() {
|
|
215984
215984
|
var _this2 = this;
|
|
215985
|
-
return new Promise(function(
|
|
215985
|
+
return new Promise(function(resolve12, reject) {
|
|
215986
215986
|
_this2[kStream].destroy(null, function(err) {
|
|
215987
215987
|
if (err) {
|
|
215988
215988
|
reject(err);
|
|
215989
215989
|
return;
|
|
215990
215990
|
}
|
|
215991
|
-
|
|
215991
|
+
resolve12(createIterResult(undefined, true));
|
|
215992
215992
|
});
|
|
215993
215993
|
});
|
|
215994
215994
|
}), _Object$setPrototypeO), AsyncIteratorPrototype);
|
|
@@ -216010,15 +216010,15 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
216010
216010
|
value: stream._readableState.endEmitted,
|
|
216011
216011
|
writable: true
|
|
216012
216012
|
}), _defineProperty(_Object$create, kHandlePromise, {
|
|
216013
|
-
value: function value(
|
|
216013
|
+
value: function value(resolve12, reject) {
|
|
216014
216014
|
var data = iterator[kStream].read();
|
|
216015
216015
|
if (data) {
|
|
216016
216016
|
iterator[kLastPromise] = null;
|
|
216017
216017
|
iterator[kLastResolve] = null;
|
|
216018
216018
|
iterator[kLastReject] = null;
|
|
216019
|
-
|
|
216019
|
+
resolve12(createIterResult(data, false));
|
|
216020
216020
|
} else {
|
|
216021
|
-
iterator[kLastResolve] =
|
|
216021
|
+
iterator[kLastResolve] = resolve12;
|
|
216022
216022
|
iterator[kLastReject] = reject;
|
|
216023
216023
|
}
|
|
216024
216024
|
},
|
|
@@ -216037,12 +216037,12 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
216037
216037
|
iterator[kError] = err;
|
|
216038
216038
|
return;
|
|
216039
216039
|
}
|
|
216040
|
-
var
|
|
216041
|
-
if (
|
|
216040
|
+
var resolve12 = iterator[kLastResolve];
|
|
216041
|
+
if (resolve12 !== null) {
|
|
216042
216042
|
iterator[kLastPromise] = null;
|
|
216043
216043
|
iterator[kLastResolve] = null;
|
|
216044
216044
|
iterator[kLastReject] = null;
|
|
216045
|
-
|
|
216045
|
+
resolve12(createIterResult(undefined, true));
|
|
216046
216046
|
}
|
|
216047
216047
|
iterator[kEnded] = true;
|
|
216048
216048
|
});
|
|
@@ -216054,7 +216054,7 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
216054
216054
|
|
|
216055
216055
|
// ../../node_modules/readable-stream/lib/internal/streams/from.js
|
|
216056
216056
|
var require_from = __commonJS((exports, module) => {
|
|
216057
|
-
function asyncGeneratorStep(gen,
|
|
216057
|
+
function asyncGeneratorStep(gen, resolve12, reject, _next, _throw, key2, arg) {
|
|
216058
216058
|
try {
|
|
216059
216059
|
var info = gen[key2](arg);
|
|
216060
216060
|
var value = info.value;
|
|
@@ -216063,7 +216063,7 @@ var require_from = __commonJS((exports, module) => {
|
|
|
216063
216063
|
return;
|
|
216064
216064
|
}
|
|
216065
216065
|
if (info.done) {
|
|
216066
|
-
|
|
216066
|
+
resolve12(value);
|
|
216067
216067
|
} else {
|
|
216068
216068
|
Promise.resolve(value).then(_next, _throw);
|
|
216069
216069
|
}
|
|
@@ -216071,13 +216071,13 @@ var require_from = __commonJS((exports, module) => {
|
|
|
216071
216071
|
function _asyncToGenerator(fn9) {
|
|
216072
216072
|
return function() {
|
|
216073
216073
|
var self2 = this, args = arguments;
|
|
216074
|
-
return new Promise(function(
|
|
216074
|
+
return new Promise(function(resolve12, reject) {
|
|
216075
216075
|
var gen = fn9.apply(self2, args);
|
|
216076
216076
|
function _next(value) {
|
|
216077
|
-
asyncGeneratorStep(gen,
|
|
216077
|
+
asyncGeneratorStep(gen, resolve12, reject, _next, _throw, "next", value);
|
|
216078
216078
|
}
|
|
216079
216079
|
function _throw(err) {
|
|
216080
|
-
asyncGeneratorStep(gen,
|
|
216080
|
+
asyncGeneratorStep(gen, resolve12, reject, _next, _throw, "throw", err);
|
|
216081
216081
|
}
|
|
216082
216082
|
_next(undefined);
|
|
216083
216083
|
});
|
|
@@ -234018,7 +234018,7 @@ function normalizeBase44Env() {
|
|
|
234018
234018
|
loadProjectEnvFiles();
|
|
234019
234019
|
|
|
234020
234020
|
// src/cli/index.ts
|
|
234021
|
-
import { dirname as dirname23, join as
|
|
234021
|
+
import { dirname as dirname23, join as join28 } from "node:path";
|
|
234022
234022
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
234023
234023
|
|
|
234024
234024
|
// ../../node_modules/@clack/core/dist/index.mjs
|
|
@@ -243891,7 +243891,7 @@ import { join as join11 } from "node:path";
|
|
|
243891
243891
|
// package.json
|
|
243892
243892
|
var package_default = {
|
|
243893
243893
|
name: "base44",
|
|
243894
|
-
version: "0.0.
|
|
243894
|
+
version: "0.0.56",
|
|
243895
243895
|
description: "Base44 CLI - Unified interface for managing Base44 applications",
|
|
243896
243896
|
type: "module",
|
|
243897
243897
|
bin: {
|
|
@@ -244260,6 +244260,11 @@ function getAppClient() {
|
|
|
244260
244260
|
prefixUrl: new URL(`/api/apps/${id}/`, getBase44ApiUrl()).href
|
|
244261
244261
|
});
|
|
244262
244262
|
}
|
|
244263
|
+
function getSandboxClient(appId) {
|
|
244264
|
+
return base44Client.extend({
|
|
244265
|
+
prefixUrl: new URL(`/api/apps/${appId}/sandbox-bridge/`, getBase44ApiUrl()).href
|
|
244266
|
+
});
|
|
244267
|
+
}
|
|
244263
244268
|
// src/core/clients/oauth-client.ts
|
|
244264
244269
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
244265
244270
|
var oauthClient = distribution_default.create({
|
|
@@ -251195,7 +251200,7 @@ function createSimpleRunTask(log) {
|
|
|
251195
251200
|
};
|
|
251196
251201
|
}
|
|
251197
251202
|
// src/cli/utils/stdin.ts
|
|
251198
|
-
async function readStdin(flagName = "--stdin") {
|
|
251203
|
+
async function readStdin(flagName = "--stdin", options = {}) {
|
|
251199
251204
|
if (process.stdin.isTTY) {
|
|
251200
251205
|
throw new InvalidInputError(`${flagName} requires piped input (e.g., echo <value> | base44 ...)`);
|
|
251201
251206
|
}
|
|
@@ -251203,7 +251208,8 @@ async function readStdin(flagName = "--stdin") {
|
|
|
251203
251208
|
for await (const chunk of process.stdin) {
|
|
251204
251209
|
chunks.push(chunk);
|
|
251205
251210
|
}
|
|
251206
|
-
|
|
251211
|
+
const text = Buffer.concat(chunks).toString("utf-8");
|
|
251212
|
+
return options.trim === false ? text : text.trim();
|
|
251207
251213
|
}
|
|
251208
251214
|
|
|
251209
251215
|
// src/cli/utils/secret-input.ts
|
|
@@ -251829,73 +251835,6 @@ function getWhoamiCommand() {
|
|
|
251829
251835
|
return new Base44Command("whoami", { requireAppContext: false }).description("Display current authenticated user").action(whoami);
|
|
251830
251836
|
}
|
|
251831
251837
|
|
|
251832
|
-
// src/cli/commands/connectors/list-available.ts
|
|
251833
|
-
async function listAvailableAction({
|
|
251834
|
-
log,
|
|
251835
|
-
runTask: runTask2
|
|
251836
|
-
}) {
|
|
251837
|
-
const { integrations } = await runTask2("Fetching available integrations from Base44", async () => {
|
|
251838
|
-
return await listAvailableIntegrations();
|
|
251839
|
-
}, {
|
|
251840
|
-
successMessage: "Available integrations fetched successfully",
|
|
251841
|
-
errorMessage: "Failed to fetch available integrations"
|
|
251842
|
-
});
|
|
251843
|
-
if (integrations.length === 0) {
|
|
251844
|
-
return { outroMessage: "No available integrations found." };
|
|
251845
|
-
}
|
|
251846
|
-
for (const { displayName, ...rest } of integrations) {
|
|
251847
|
-
const yaml2 = formatYaml(rest);
|
|
251848
|
-
const pad = " ".repeat(YAML_INDENT);
|
|
251849
|
-
log.info(`${displayName}
|
|
251850
|
-
${pad}${yaml2.replace(/\n/g, `
|
|
251851
|
-
${pad}`)}`);
|
|
251852
|
-
}
|
|
251853
|
-
return {
|
|
251854
|
-
outroMessage: `Found ${integrations.length} available integrations.`
|
|
251855
|
-
};
|
|
251856
|
-
}
|
|
251857
|
-
function getConnectorsListAvailableCommand() {
|
|
251858
|
-
return new Base44Command("list-available").description("List all available integration types").action(listAvailableAction);
|
|
251859
|
-
}
|
|
251860
|
-
|
|
251861
|
-
// src/cli/commands/connectors/pull.ts
|
|
251862
|
-
import { dirname as dirname15, join as join19 } from "node:path";
|
|
251863
|
-
async function pullConnectorsAction({
|
|
251864
|
-
log,
|
|
251865
|
-
runTask: runTask2
|
|
251866
|
-
}) {
|
|
251867
|
-
const { project: project2 } = await readProjectConfig();
|
|
251868
|
-
const configDir = dirname15(project2.configPath);
|
|
251869
|
-
const connectorsDir = join19(configDir, project2.connectorsDir);
|
|
251870
|
-
const remoteConnectors = await runTask2("Fetching connectors from Base44", async () => {
|
|
251871
|
-
return await pullAllConnectors();
|
|
251872
|
-
}, {
|
|
251873
|
-
successMessage: "Connectors fetched successfully",
|
|
251874
|
-
errorMessage: "Failed to fetch connectors"
|
|
251875
|
-
});
|
|
251876
|
-
const { written, deleted } = await runTask2("Syncing connector files", async () => {
|
|
251877
|
-
return await writeConnectors(connectorsDir, remoteConnectors);
|
|
251878
|
-
}, {
|
|
251879
|
-
successMessage: "Connector files synced successfully",
|
|
251880
|
-
errorMessage: "Failed to sync connector files"
|
|
251881
|
-
});
|
|
251882
|
-
if (written.length > 0) {
|
|
251883
|
-
log.success(`Written: ${written.join(", ")}`);
|
|
251884
|
-
}
|
|
251885
|
-
if (deleted.length > 0) {
|
|
251886
|
-
log.warn(`Deleted: ${deleted.join(", ")}`);
|
|
251887
|
-
}
|
|
251888
|
-
if (written.length === 0 && deleted.length === 0) {
|
|
251889
|
-
log.info("All connectors are already up to date");
|
|
251890
|
-
}
|
|
251891
|
-
return {
|
|
251892
|
-
outroMessage: `Pulled ${remoteConnectors.length} connectors to ${connectorsDir}`
|
|
251893
|
-
};
|
|
251894
|
-
}
|
|
251895
|
-
function getConnectorsPullCommand() {
|
|
251896
|
-
return new Base44Command("pull").description("Pull connectors from Base44 to local files (replaces all local connector configs)").action(pullConnectorsAction);
|
|
251897
|
-
}
|
|
251898
|
-
|
|
251899
251838
|
// ../../node_modules/open/index.js
|
|
251900
251839
|
import process20 from "node:process";
|
|
251901
251840
|
import path16 from "node:path";
|
|
@@ -252586,7 +252525,138 @@ async function promptOAuthFlows(pending, log, options) {
|
|
|
252586
252525
|
return outcomes;
|
|
252587
252526
|
}
|
|
252588
252527
|
|
|
252528
|
+
// src/cli/commands/connectors/initiate.ts
|
|
252529
|
+
function parseIntegrationType(value) {
|
|
252530
|
+
const result = IntegrationTypeSchema.safeParse(value);
|
|
252531
|
+
if (!result.success) {
|
|
252532
|
+
throw new InvalidInputError("A valid --integration-type is required (e.g. googlecalendar, gmail, slack).");
|
|
252533
|
+
}
|
|
252534
|
+
return result.data;
|
|
252535
|
+
}
|
|
252536
|
+
function parseScopes(scopes) {
|
|
252537
|
+
return (scopes ?? []).flatMap((s) => s.split(",")).map((s) => s.trim()).filter(Boolean);
|
|
252538
|
+
}
|
|
252539
|
+
async function initiateAction(ctx, options) {
|
|
252540
|
+
const { log, runTask: runTask2, isNonInteractive } = ctx;
|
|
252541
|
+
const integrationType = parseIntegrationType(options.integrationType);
|
|
252542
|
+
const scopes = parseScopes(options.scopes);
|
|
252543
|
+
const response = await runTask2(`Initiating ${integrationType} connector`, () => setConnector(integrationType, scopes), {
|
|
252544
|
+
successMessage: `Connector ${integrationType} initialized`,
|
|
252545
|
+
errorMessage: `Failed to initialize ${integrationType}`
|
|
252546
|
+
});
|
|
252547
|
+
if (response.error) {
|
|
252548
|
+
const detail = response.error === "different_user" && response.otherUserEmail ? ` (already authorized by ${response.otherUserEmail})` : response.errorMessage ? ` (${response.errorMessage})` : "";
|
|
252549
|
+
throw new InvalidInputError(`Could not initiate ${integrationType}: ${response.error}${detail}`);
|
|
252550
|
+
}
|
|
252551
|
+
if (response.alreadyAuthorized || !response.redirectUrl) {
|
|
252552
|
+
return {
|
|
252553
|
+
outroMessage: `${integrationType} is already authorized. Run 'base44 connectors pull' to fetch its config.`
|
|
252554
|
+
};
|
|
252555
|
+
}
|
|
252556
|
+
log.info(`Authorize ${integrationType} here: ${theme.colors.links(response.redirectUrl)}`);
|
|
252557
|
+
const pending = {
|
|
252558
|
+
type: integrationType,
|
|
252559
|
+
action: "needs_oauth",
|
|
252560
|
+
redirectUrl: response.redirectUrl,
|
|
252561
|
+
connectionId: response.connectionId ?? undefined
|
|
252562
|
+
};
|
|
252563
|
+
const outcomes = await promptOAuthFlows([pending], log, {
|
|
252564
|
+
skipPrompt: isNonInteractive
|
|
252565
|
+
});
|
|
252566
|
+
if (outcomes.get(integrationType) === "ACTIVE") {
|
|
252567
|
+
return {
|
|
252568
|
+
outroMessage: `${integrationType} authorized. Run 'base44 connectors pull' to fetch its config.`
|
|
252569
|
+
};
|
|
252570
|
+
}
|
|
252571
|
+
return {
|
|
252572
|
+
outroMessage: `${integrationType} initialized. Open the link above to finish authorizing, then run 'base44 connectors pull'.`
|
|
252573
|
+
};
|
|
252574
|
+
}
|
|
252575
|
+
function getConnectorsInitiateCommand() {
|
|
252576
|
+
return new Base44Command("initiate").description("Initialize a connector on an app and start its OAuth flow (works with --app-id, no local project required)").requiredOption("--integration-type <type>", "Integration type to initiate (e.g. googlecalendar, gmail, slack)").option("--scopes <scopes...>", "OAuth scopes to request (space- or comma-separated)").addHelpText("after", `
|
|
252577
|
+
Examples:
|
|
252578
|
+
$ base44 connectors initiate --app-id app_123 --integration-type googlecalendar --scopes https://www.googleapis.com/auth/calendar
|
|
252579
|
+
$ base44 connectors initiate --integration-type gmail --scopes scope.a,scope.b`).action(initiateAction);
|
|
252580
|
+
}
|
|
252581
|
+
|
|
252582
|
+
// src/cli/commands/connectors/list-available.ts
|
|
252583
|
+
async function listAvailableAction({
|
|
252584
|
+
log,
|
|
252585
|
+
runTask: runTask2
|
|
252586
|
+
}) {
|
|
252587
|
+
const { integrations } = await runTask2("Fetching available integrations from Base44", async () => {
|
|
252588
|
+
return await listAvailableIntegrations();
|
|
252589
|
+
}, {
|
|
252590
|
+
successMessage: "Available integrations fetched successfully",
|
|
252591
|
+
errorMessage: "Failed to fetch available integrations"
|
|
252592
|
+
});
|
|
252593
|
+
if (integrations.length === 0) {
|
|
252594
|
+
return { outroMessage: "No available integrations found." };
|
|
252595
|
+
}
|
|
252596
|
+
for (const { displayName, ...rest } of integrations) {
|
|
252597
|
+
const yaml2 = formatYaml(rest);
|
|
252598
|
+
const pad = " ".repeat(YAML_INDENT);
|
|
252599
|
+
log.info(`${displayName}
|
|
252600
|
+
${pad}${yaml2.replace(/\n/g, `
|
|
252601
|
+
${pad}`)}`);
|
|
252602
|
+
}
|
|
252603
|
+
return {
|
|
252604
|
+
outroMessage: `Found ${integrations.length} available integrations.`
|
|
252605
|
+
};
|
|
252606
|
+
}
|
|
252607
|
+
function getConnectorsListAvailableCommand() {
|
|
252608
|
+
return new Base44Command("list-available").description("List all available integration types").action(listAvailableAction);
|
|
252609
|
+
}
|
|
252610
|
+
|
|
252611
|
+
// src/cli/commands/connectors/pull.ts
|
|
252612
|
+
import { dirname as dirname15, join as join19, resolve as resolve5 } from "node:path";
|
|
252613
|
+
async function resolveConnectorsDir(options) {
|
|
252614
|
+
if (!getAppContext().projectRoot) {
|
|
252615
|
+
return resolve5(options.dir ?? "connectors");
|
|
252616
|
+
}
|
|
252617
|
+
const { project: project2 } = await readProjectConfig();
|
|
252618
|
+
return join19(dirname15(project2.configPath), project2.connectorsDir);
|
|
252619
|
+
}
|
|
252620
|
+
async function pullConnectorsAction({ log, runTask: runTask2 }, options) {
|
|
252621
|
+
const connectorsDir = await resolveConnectorsDir(options);
|
|
252622
|
+
const remoteConnectors = await runTask2("Fetching connectors from Base44", async () => {
|
|
252623
|
+
return await pullAllConnectors();
|
|
252624
|
+
}, {
|
|
252625
|
+
successMessage: "Connectors fetched successfully",
|
|
252626
|
+
errorMessage: "Failed to fetch connectors"
|
|
252627
|
+
});
|
|
252628
|
+
const { written, deleted } = await runTask2("Syncing connector files", async () => {
|
|
252629
|
+
return await writeConnectors(connectorsDir, remoteConnectors);
|
|
252630
|
+
}, {
|
|
252631
|
+
successMessage: "Connector files synced successfully",
|
|
252632
|
+
errorMessage: "Failed to sync connector files"
|
|
252633
|
+
});
|
|
252634
|
+
if (written.length > 0) {
|
|
252635
|
+
log.success(`Written: ${written.join(", ")}`);
|
|
252636
|
+
}
|
|
252637
|
+
if (deleted.length > 0) {
|
|
252638
|
+
log.warn(`Deleted: ${deleted.join(", ")}`);
|
|
252639
|
+
}
|
|
252640
|
+
if (written.length === 0 && deleted.length === 0) {
|
|
252641
|
+
log.info("All connectors are already up to date");
|
|
252642
|
+
}
|
|
252643
|
+
return {
|
|
252644
|
+
outroMessage: `Pulled ${remoteConnectors.length} connectors to ${connectorsDir}`
|
|
252645
|
+
};
|
|
252646
|
+
}
|
|
252647
|
+
function getConnectorsPullCommand() {
|
|
252648
|
+
return new Base44Command("pull").description("Pull connectors from Base44 to local files (replaces all local connector configs)").option("--dir <path>", "Directory to write connector files to (default: ./connectors when using --app-id)").action(pullConnectorsAction);
|
|
252649
|
+
}
|
|
252650
|
+
|
|
252589
252651
|
// src/cli/commands/connectors/push.ts
|
|
252652
|
+
import { resolve as resolve6 } from "node:path";
|
|
252653
|
+
async function readConnectorsToPush(options) {
|
|
252654
|
+
if (!getAppContext().projectRoot) {
|
|
252655
|
+
return readAllConnectors(resolve6(options.dir ?? "connectors"));
|
|
252656
|
+
}
|
|
252657
|
+
const { connectors } = await readProjectConfig();
|
|
252658
|
+
return connectors;
|
|
252659
|
+
}
|
|
252590
252660
|
function printSummary(results, oauthOutcomes, log) {
|
|
252591
252661
|
const synced = [];
|
|
252592
252662
|
const added = [];
|
|
@@ -252649,12 +252719,8 @@ function printSummary(results, oauthOutcomes, log) {
|
|
|
252649
252719
|
log.error(`Failed: ${r.type} - ${r.error}`);
|
|
252650
252720
|
}
|
|
252651
252721
|
}
|
|
252652
|
-
async function pushConnectorsAction({
|
|
252653
|
-
|
|
252654
|
-
log,
|
|
252655
|
-
runTask: runTask2
|
|
252656
|
-
}) {
|
|
252657
|
-
const { connectors } = await readProjectConfig();
|
|
252722
|
+
async function pushConnectorsAction({ isNonInteractive, log, runTask: runTask2 }, options) {
|
|
252723
|
+
const connectors = await readConnectorsToPush(options);
|
|
252658
252724
|
if (connectors.length === 0) {
|
|
252659
252725
|
log.info("No local connectors found - checking for remote connectors to remove");
|
|
252660
252726
|
} else {
|
|
@@ -252677,12 +252743,12 @@ async function pushConnectorsAction({
|
|
|
252677
252743
|
return { outroMessage };
|
|
252678
252744
|
}
|
|
252679
252745
|
function getConnectorsPushCommand() {
|
|
252680
|
-
return new Base44Command("push").description("Push local connectors to Base44 (overwrites connectors on Base44)").action(pushConnectorsAction);
|
|
252746
|
+
return new Base44Command("push").description("Push local connectors to Base44 (overwrites connectors on Base44)").option("--dir <path>", "Directory to read connector files from (default: ./connectors when using --app-id)").action(pushConnectorsAction);
|
|
252681
252747
|
}
|
|
252682
252748
|
|
|
252683
252749
|
// src/cli/commands/connectors/index.ts
|
|
252684
252750
|
function getConnectorsCommand() {
|
|
252685
|
-
return new Command("connectors").description("Manage project connectors (OAuth integrations)").addCommand(getConnectorsListAvailableCommand()).addCommand(getConnectorsPullCommand()).addCommand(getConnectorsPushCommand());
|
|
252751
|
+
return new Command("connectors").description("Manage project connectors (OAuth integrations)").addCommand(getConnectorsListAvailableCommand()).addCommand(getConnectorsInitiateCommand()).addCommand(getConnectorsPullCommand()).addCommand(getConnectorsPushCommand());
|
|
252686
252752
|
}
|
|
252687
252753
|
|
|
252688
252754
|
// src/cli/commands/dashboard/open.ts
|
|
@@ -252989,7 +253055,7 @@ function getFunctionsCommand() {
|
|
|
252989
253055
|
}
|
|
252990
253056
|
|
|
252991
253057
|
// src/cli/commands/project/create.ts
|
|
252992
|
-
import { basename as basename4, resolve as
|
|
253058
|
+
import { basename as basename4, resolve as resolve7 } from "node:path";
|
|
252993
253059
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
252994
253060
|
|
|
252995
253061
|
// src/cli/commands/project/scaffold-shared.ts
|
|
@@ -253143,7 +253209,7 @@ async function createInteractive(options, ctx) {
|
|
|
253143
253209
|
}, ctx);
|
|
253144
253210
|
}
|
|
253145
253211
|
async function createNonInteractive(options, ctx) {
|
|
253146
|
-
ctx.log.info(`Creating a new project at ${
|
|
253212
|
+
ctx.log.info(`Creating a new project at ${resolve7(options.path)}`);
|
|
253147
253213
|
const template2 = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
|
|
253148
253214
|
return await executeCreate({
|
|
253149
253215
|
template: template2,
|
|
@@ -253165,7 +253231,7 @@ async function executeCreate({
|
|
|
253165
253231
|
}, ctx) {
|
|
253166
253232
|
const { log, runTask: runTask2 } = ctx;
|
|
253167
253233
|
const name2 = rawName.trim();
|
|
253168
|
-
const resolvedPath =
|
|
253234
|
+
const resolvedPath = resolve7(projectPath);
|
|
253169
253235
|
const { projectId } = await runTask2("Setting up your project...", async () => {
|
|
253170
253236
|
return await createProjectFiles({
|
|
253171
253237
|
name: name2,
|
|
@@ -253606,7 +253672,7 @@ function getLogsCommand() {
|
|
|
253606
253672
|
}
|
|
253607
253673
|
|
|
253608
253674
|
// src/cli/commands/project/scaffold.ts
|
|
253609
|
-
import { basename as basename5, resolve as
|
|
253675
|
+
import { basename as basename5, resolve as resolve8 } from "node:path";
|
|
253610
253676
|
function resolveAppId(options) {
|
|
253611
253677
|
const appId = options.appId;
|
|
253612
253678
|
if (!appId) {
|
|
@@ -253622,7 +253688,7 @@ function resolveAppId(options) {
|
|
|
253622
253688
|
async function scaffoldAction(ctx, name2, options, command2) {
|
|
253623
253689
|
const { log, runTask: runTask2 } = ctx;
|
|
253624
253690
|
const appId = resolveAppId(command2.optsWithGlobals());
|
|
253625
|
-
const resolvedPath =
|
|
253691
|
+
const resolvedPath = resolve8("./");
|
|
253626
253692
|
const projectName = (name2 ?? basename5(resolvedPath)).trim();
|
|
253627
253693
|
const template2 = await getTemplateById("backend-only");
|
|
253628
253694
|
log.info(`Scaffolding project at ${resolvedPath}`);
|
|
@@ -253659,6 +253725,287 @@ Examples:
|
|
|
253659
253725
|
$ base44 scaffold my-app --app-id app_123 Scaffolds the current dir, named "my-app"`).action(scaffoldAction);
|
|
253660
253726
|
}
|
|
253661
253727
|
|
|
253728
|
+
// src/core/resources/sandbox/schema.ts
|
|
253729
|
+
var FileErrorSchema = exports_external.object({
|
|
253730
|
+
code: exports_external.string(),
|
|
253731
|
+
message: exports_external.string()
|
|
253732
|
+
});
|
|
253733
|
+
var ReadFileEntrySchema = exports_external.object({
|
|
253734
|
+
path: exports_external.string(),
|
|
253735
|
+
content: exports_external.string().optional(),
|
|
253736
|
+
start_line: exports_external.number().optional(),
|
|
253737
|
+
end_line: exports_external.number().optional(),
|
|
253738
|
+
total_lines: exports_external.number().optional(),
|
|
253739
|
+
truncated: exports_external.boolean().optional(),
|
|
253740
|
+
error: FileErrorSchema.optional()
|
|
253741
|
+
}).transform((data) => ({
|
|
253742
|
+
path: data.path,
|
|
253743
|
+
content: data.content,
|
|
253744
|
+
startLine: data.start_line,
|
|
253745
|
+
endLine: data.end_line,
|
|
253746
|
+
totalLines: data.total_lines,
|
|
253747
|
+
truncated: data.truncated,
|
|
253748
|
+
error: data.error
|
|
253749
|
+
}));
|
|
253750
|
+
var ReadFileResponseSchema = exports_external.object({
|
|
253751
|
+
files: exports_external.array(ReadFileEntrySchema)
|
|
253752
|
+
});
|
|
253753
|
+
var WriteFileResponseSchema = exports_external.object({
|
|
253754
|
+
path: exports_external.string(),
|
|
253755
|
+
bytes_written: exports_external.number(),
|
|
253756
|
+
created: exports_external.boolean(),
|
|
253757
|
+
overwritten: exports_external.boolean()
|
|
253758
|
+
}).transform((data) => ({
|
|
253759
|
+
path: data.path,
|
|
253760
|
+
bytesWritten: data.bytes_written,
|
|
253761
|
+
created: data.created,
|
|
253762
|
+
overwritten: data.overwritten
|
|
253763
|
+
}));
|
|
253764
|
+
var EditFileResponseSchema = exports_external.object({
|
|
253765
|
+
path: exports_external.string(),
|
|
253766
|
+
diff: exports_external.string(),
|
|
253767
|
+
applied: exports_external.boolean()
|
|
253768
|
+
});
|
|
253769
|
+
var GrepMatchSchema = exports_external.object({
|
|
253770
|
+
path: exports_external.string().nullable(),
|
|
253771
|
+
line: exports_external.number().nullable(),
|
|
253772
|
+
text: exports_external.string()
|
|
253773
|
+
});
|
|
253774
|
+
var GrepResponseSchema = exports_external.object({
|
|
253775
|
+
matches: exports_external.array(GrepMatchSchema),
|
|
253776
|
+
truncated: exports_external.boolean(),
|
|
253777
|
+
returned_matches: exports_external.number()
|
|
253778
|
+
}).transform((data) => ({
|
|
253779
|
+
matches: data.matches,
|
|
253780
|
+
truncated: data.truncated,
|
|
253781
|
+
returnedMatches: data.returned_matches
|
|
253782
|
+
}));
|
|
253783
|
+
var DirectoryEntrySchema = exports_external.object({
|
|
253784
|
+
name: exports_external.string(),
|
|
253785
|
+
path: exports_external.string(),
|
|
253786
|
+
type: exports_external.enum(["file", "directory"]),
|
|
253787
|
+
size: exports_external.number().optional()
|
|
253788
|
+
});
|
|
253789
|
+
var ListDirectoryResponseSchema = exports_external.object({
|
|
253790
|
+
entries: exports_external.array(DirectoryEntrySchema),
|
|
253791
|
+
truncated: exports_external.boolean()
|
|
253792
|
+
});
|
|
253793
|
+
var RunCommandResponseSchema = exports_external.object({
|
|
253794
|
+
stdout: exports_external.string(),
|
|
253795
|
+
stderr: exports_external.string(),
|
|
253796
|
+
exit_code: exports_external.number(),
|
|
253797
|
+
truncated: exports_external.boolean(),
|
|
253798
|
+
duration_ms: exports_external.number()
|
|
253799
|
+
}).transform((data) => ({
|
|
253800
|
+
stdout: data.stdout,
|
|
253801
|
+
stderr: data.stderr,
|
|
253802
|
+
exitCode: data.exit_code,
|
|
253803
|
+
truncated: data.truncated,
|
|
253804
|
+
durationMs: data.duration_ms
|
|
253805
|
+
}));
|
|
253806
|
+
var ReleaseResponseSchema = exports_external.object({
|
|
253807
|
+
app_id: exports_external.string(),
|
|
253808
|
+
released: exports_external.boolean()
|
|
253809
|
+
}).transform((data) => ({
|
|
253810
|
+
appId: data.app_id,
|
|
253811
|
+
released: data.released
|
|
253812
|
+
}));
|
|
253813
|
+
|
|
253814
|
+
// src/core/resources/sandbox/api.ts
|
|
253815
|
+
async function callTool(appId, tool, payload, schema10, context, timeout2 = 60000) {
|
|
253816
|
+
const client = getSandboxClient(appId);
|
|
253817
|
+
let response;
|
|
253818
|
+
try {
|
|
253819
|
+
response = await client.post(tool, { json: payload, timeout: timeout2 });
|
|
253820
|
+
} catch (error48) {
|
|
253821
|
+
throw await ApiError.fromHttpError(error48, context);
|
|
253822
|
+
}
|
|
253823
|
+
const result = schema10.safeParse(await response.json());
|
|
253824
|
+
if (!result.success) {
|
|
253825
|
+
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
253826
|
+
}
|
|
253827
|
+
return result.data;
|
|
253828
|
+
}
|
|
253829
|
+
function listDirectory(appId, params) {
|
|
253830
|
+
return callTool(appId, "list_directory", { ...params }, ListDirectoryResponseSchema, "listing directory");
|
|
253831
|
+
}
|
|
253832
|
+
function readFile2(appId, params) {
|
|
253833
|
+
return callTool(appId, "read_file", { ...params }, ReadFileResponseSchema, "reading file");
|
|
253834
|
+
}
|
|
253835
|
+
function writeFile2(appId, params) {
|
|
253836
|
+
return callTool(appId, "write_file", { ...params }, WriteFileResponseSchema, `writing file "${params.path}"`);
|
|
253837
|
+
}
|
|
253838
|
+
function editFile(appId, params) {
|
|
253839
|
+
return callTool(appId, "edit_file", { ...params }, EditFileResponseSchema, `editing file "${params.path}"`);
|
|
253840
|
+
}
|
|
253841
|
+
function grep(appId, params) {
|
|
253842
|
+
return callTool(appId, "grep", { ...params }, GrepResponseSchema, "searching files");
|
|
253843
|
+
}
|
|
253844
|
+
function runCommand(appId, params) {
|
|
253845
|
+
return callTool(appId, "run_command", { ...params }, RunCommandResponseSchema, "running command", false);
|
|
253846
|
+
}
|
|
253847
|
+
function releaseSession(appId) {
|
|
253848
|
+
return callTool(appId, "release", {}, ReleaseResponseSchema, "releasing sandbox session");
|
|
253849
|
+
}
|
|
253850
|
+
|
|
253851
|
+
// src/cli/commands/sandbox/shared.ts
|
|
253852
|
+
async function resolveFlagOrStdin(flagValue, flagName) {
|
|
253853
|
+
if (flagValue !== undefined) {
|
|
253854
|
+
return flagValue;
|
|
253855
|
+
}
|
|
253856
|
+
if (process.stdin.isTTY) {
|
|
253857
|
+
throw new InvalidInputError(`Provide ${flagName} or pipe the value via stdin (e.g. echo <value> | base44 sandbox ...).`);
|
|
253858
|
+
}
|
|
253859
|
+
return readStdin(flagName, { trim: false });
|
|
253860
|
+
}
|
|
253861
|
+
function toJsonStdout(result) {
|
|
253862
|
+
return `${JSON.stringify(result, null, 2)}
|
|
253863
|
+
`;
|
|
253864
|
+
}
|
|
253865
|
+
function parsePositiveInt(value, flagName) {
|
|
253866
|
+
if (value === undefined) {
|
|
253867
|
+
return;
|
|
253868
|
+
}
|
|
253869
|
+
const n2 = Number.parseInt(value, 10);
|
|
253870
|
+
if (!Number.isInteger(n2) || n2 < 1) {
|
|
253871
|
+
throw new InvalidInputError(`${flagName} must be a positive integer.`);
|
|
253872
|
+
}
|
|
253873
|
+
return n2;
|
|
253874
|
+
}
|
|
253875
|
+
|
|
253876
|
+
// src/cli/commands/sandbox/edit-file.ts
|
|
253877
|
+
var EditsInputSchema = exports_external.array(exports_external.object({
|
|
253878
|
+
old_text: exports_external.string().min(1),
|
|
253879
|
+
new_text: exports_external.string(),
|
|
253880
|
+
replace_all: exports_external.boolean().optional()
|
|
253881
|
+
})).min(1);
|
|
253882
|
+
function parseEdits(raw2) {
|
|
253883
|
+
let parsed;
|
|
253884
|
+
try {
|
|
253885
|
+
parsed = JSON.parse(raw2);
|
|
253886
|
+
} catch {
|
|
253887
|
+
throw new InvalidInputError("--edits-json must be valid JSON (an array of { old_text, new_text, replace_all? }).");
|
|
253888
|
+
}
|
|
253889
|
+
const result = EditsInputSchema.safeParse(parsed);
|
|
253890
|
+
if (!result.success) {
|
|
253891
|
+
throw new InvalidInputError("Invalid edits: expected a non-empty array of { old_text (non-empty string), new_text (string), replace_all? (boolean) }.");
|
|
253892
|
+
}
|
|
253893
|
+
return result.data;
|
|
253894
|
+
}
|
|
253895
|
+
async function editFileAction({ runTask: runTask2 }, path17, options) {
|
|
253896
|
+
const { id: appId } = getAppContext();
|
|
253897
|
+
const raw2 = await resolveFlagOrStdin(options.editsJson, "--edits-json");
|
|
253898
|
+
const edits = parseEdits(raw2);
|
|
253899
|
+
const result = await runTask2(options.dryRun ? "Previewing edit" : "Editing file", () => editFile(appId, { path: path17, edits, dry_run: options.dryRun }));
|
|
253900
|
+
return {
|
|
253901
|
+
outroMessage: options.dryRun ? "Previewed edit" : "Edited file",
|
|
253902
|
+
stdout: toJsonStdout(result)
|
|
253903
|
+
};
|
|
253904
|
+
}
|
|
253905
|
+
function getSandboxEditFileCommand() {
|
|
253906
|
+
return new Base44Command("edit-file").description("Apply exact old→new string edits to a file in the sandbox").argument("<path>", "File path relative to the app root").option("--edits-json <json>", "JSON array of edits (if omitted, read from stdin)").option("--dry-run", "Return the unified diff without writing").addHelpText("after", `
|
|
253907
|
+
Each edit is { "old_text": "...", "new_text": "...", "replace_all"?: true }.
|
|
253908
|
+
|
|
253909
|
+
Examples:
|
|
253910
|
+
$ echo '[{"old_text":"foo","new_text":"bar"}]' | base44 sandbox edit-file src/x.ts
|
|
253911
|
+
$ base44 sandbox edit-file src/x.ts --dry-run --edits-json '[{"old_text":"a","new_text":"b","replace_all":true}]'`).action(editFileAction);
|
|
253912
|
+
}
|
|
253913
|
+
|
|
253914
|
+
// src/cli/commands/sandbox/grep.ts
|
|
253915
|
+
async function grepAction({ runTask: runTask2 }, pattern, options) {
|
|
253916
|
+
const { id: appId } = getAppContext();
|
|
253917
|
+
const maxResults = parsePositiveInt(options.maxResults, "--max-results");
|
|
253918
|
+
const result = await runTask2("Searching files", () => grep(appId, {
|
|
253919
|
+
pattern,
|
|
253920
|
+
path: options.path,
|
|
253921
|
+
is_regex: options.regex,
|
|
253922
|
+
case_sensitive: options.caseSensitive,
|
|
253923
|
+
glob: options.glob,
|
|
253924
|
+
max_results: maxResults
|
|
253925
|
+
}));
|
|
253926
|
+
return { outroMessage: "Searched files", stdout: toJsonStdout(result) };
|
|
253927
|
+
}
|
|
253928
|
+
function getSandboxGrepCommand() {
|
|
253929
|
+
return new Base44Command("grep").description("Search files for a pattern in an app's remote sandbox").argument("<pattern>", "Search pattern").option("--path <path>", "Subtree to search, relative to the app root").option("--no-regex", "Treat the pattern as a literal string, not a regex").option("--case-sensitive", "Case-sensitive match").option("--glob <glob>", 'File glob filter, e.g. "*.tsx"').option("--max-results <n>", "Maximum number of match lines to return").action(grepAction);
|
|
253930
|
+
}
|
|
253931
|
+
|
|
253932
|
+
// src/cli/commands/sandbox/list-directory.ts
|
|
253933
|
+
async function listDirectoryAction({ runTask: runTask2 }, path17, options) {
|
|
253934
|
+
const { id: appId } = getAppContext();
|
|
253935
|
+
const maxDepth = parsePositiveInt(options.maxDepth, "--max-depth");
|
|
253936
|
+
const result = await runTask2("Listing directory", () => listDirectory(appId, {
|
|
253937
|
+
path: path17,
|
|
253938
|
+
recursive: options.recursive,
|
|
253939
|
+
max_depth: maxDepth,
|
|
253940
|
+
include_hidden: options.includeHidden
|
|
253941
|
+
}));
|
|
253942
|
+
return { outroMessage: "Listed directory", stdout: toJsonStdout(result) };
|
|
253943
|
+
}
|
|
253944
|
+
function getSandboxListDirectoryCommand() {
|
|
253945
|
+
return new Base44Command("list-directory").description("List directory entries in an app's remote sandbox").argument("[path]", "Directory relative to the app root (default: app root)").option("--recursive", "List nested entries").option("--max-depth <n>", "Max depth when recursive (1-10, default 3)").option("--include-hidden", "Include dotfiles").action(listDirectoryAction);
|
|
253946
|
+
}
|
|
253947
|
+
|
|
253948
|
+
// src/cli/commands/sandbox/read-file.ts
|
|
253949
|
+
async function readFileAction({ runTask: runTask2 }, paths, options) {
|
|
253950
|
+
const { id: appId } = getAppContext();
|
|
253951
|
+
const offset = parsePositiveInt(options.offset, "--offset");
|
|
253952
|
+
const limit = parsePositiveInt(options.limit, "--limit");
|
|
253953
|
+
const result = await runTask2("Reading file", () => readFile2(appId, { paths, offset, limit }));
|
|
253954
|
+
return { outroMessage: "Read file", stdout: toJsonStdout(result) };
|
|
253955
|
+
}
|
|
253956
|
+
function getSandboxReadFileCommand() {
|
|
253957
|
+
return new Base44Command("read-file").description("Read file contents from an app's remote sandbox").argument("<paths...>", "One or more file paths relative to the app root").option("--offset <n>", "1-based start line").option("--limit <n>", "Max lines to return from offset").action(readFileAction);
|
|
253958
|
+
}
|
|
253959
|
+
|
|
253960
|
+
// src/cli/commands/sandbox/release.ts
|
|
253961
|
+
async function releaseAction({
|
|
253962
|
+
runTask: runTask2
|
|
253963
|
+
}) {
|
|
253964
|
+
const { id: appId } = getAppContext();
|
|
253965
|
+
const result = await runTask2("Releasing sandbox session", () => releaseSession(appId));
|
|
253966
|
+
return {
|
|
253967
|
+
outroMessage: "Released sandbox session",
|
|
253968
|
+
stdout: toJsonStdout(result)
|
|
253969
|
+
};
|
|
253970
|
+
}
|
|
253971
|
+
function getSandboxReleaseCommand() {
|
|
253972
|
+
return new Base44Command("release").description("Release the external-agent session so the in-app builder can resume").action(releaseAction);
|
|
253973
|
+
}
|
|
253974
|
+
|
|
253975
|
+
// src/cli/commands/sandbox/run-command.ts
|
|
253976
|
+
async function runCommandAction({ runTask: runTask2 }, commandParts, options) {
|
|
253977
|
+
const { id: appId } = getAppContext();
|
|
253978
|
+
const timeoutMs = parsePositiveInt(options.timeoutMs, "--timeout-ms");
|
|
253979
|
+
const command2 = commandParts.join(" ");
|
|
253980
|
+
const result = await runTask2("Running command", () => runCommand(appId, { command: command2, cwd: options.cwd, timeout_ms: timeoutMs }));
|
|
253981
|
+
return { outroMessage: "Ran command", stdout: toJsonStdout(result) };
|
|
253982
|
+
}
|
|
253983
|
+
function getSandboxRunCommandCommand() {
|
|
253984
|
+
return new Base44Command("run-command").description("Run a shell command in an app's remote sandbox").argument("<command...>", "Shell command to execute (quote to keep as one)").option("--cwd <path>", "Working directory relative to the app root").option("--timeout-ms <n>", "Timeout in milliseconds (default 120000, max 600000)").addHelpText("after", `
|
|
253985
|
+
Examples:
|
|
253986
|
+
$ base44 sandbox run-command "npm test"
|
|
253987
|
+
$ base44 sandbox run-command ls -la --cwd src`).action(runCommandAction);
|
|
253988
|
+
}
|
|
253989
|
+
|
|
253990
|
+
// src/cli/commands/sandbox/write-file.ts
|
|
253991
|
+
async function writeFileAction({ runTask: runTask2 }, path17, options) {
|
|
253992
|
+
const { id: appId } = getAppContext();
|
|
253993
|
+
const content = await resolveFlagOrStdin(options.content, "--content");
|
|
253994
|
+
const result = await runTask2("Writing file", () => writeFile2(appId, { path: path17, content, overwrite: options.overwrite }));
|
|
253995
|
+
return { outroMessage: "Wrote file", stdout: toJsonStdout(result) };
|
|
253996
|
+
}
|
|
253997
|
+
function getSandboxWriteFileCommand() {
|
|
253998
|
+
return new Base44Command("write-file").description("Create or overwrite a file in an app's remote sandbox").argument("<path>", "File path relative to the app root").option("--content <content>", "File content (if omitted, read from stdin)").option("--overwrite", "Overwrite the file if it already exists").addHelpText("after", `
|
|
253999
|
+
Examples:
|
|
254000
|
+
$ echo "hello" | base44 sandbox write-file notes.txt
|
|
254001
|
+
$ base44 sandbox write-file notes.txt --content "hello" --overwrite`).action(writeFileAction);
|
|
254002
|
+
}
|
|
254003
|
+
|
|
254004
|
+
// src/cli/commands/sandbox/index.ts
|
|
254005
|
+
function getSandboxCommand() {
|
|
254006
|
+
return new Command("sandbox").description("Develop an app remotely via its server-side sandbox").addCommand(getSandboxListDirectoryCommand()).addCommand(getSandboxReadFileCommand()).addCommand(getSandboxWriteFileCommand()).addCommand(getSandboxEditFileCommand()).addCommand(getSandboxGrepCommand()).addCommand(getSandboxRunCommandCommand()).addCommand(getSandboxReleaseCommand());
|
|
254007
|
+
}
|
|
254008
|
+
|
|
253662
254009
|
// src/cli/commands/secrets/delete.ts
|
|
253663
254010
|
async function deleteSecretAction({ runTask: runTask2 }, key) {
|
|
253664
254011
|
await runTask2(`Deleting secret "${key}"`, async () => {
|
|
@@ -253702,7 +254049,7 @@ function getSecretsListCommand() {
|
|
|
253702
254049
|
}
|
|
253703
254050
|
|
|
253704
254051
|
// src/cli/commands/secrets/set.ts
|
|
253705
|
-
import { resolve as
|
|
254052
|
+
import { resolve as resolve9 } from "node:path";
|
|
253706
254053
|
function parseEntries(entries) {
|
|
253707
254054
|
const secrets = {};
|
|
253708
254055
|
for (const entry of entries) {
|
|
@@ -253733,7 +254080,7 @@ async function setSecretsAction({ log, runTask: runTask2 }, entries, options) {
|
|
|
253733
254080
|
validateInput(entries, options);
|
|
253734
254081
|
let secrets;
|
|
253735
254082
|
if (options.envFile) {
|
|
253736
|
-
secrets = await parseEnvFile(
|
|
254083
|
+
secrets = await parseEnvFile(resolve9(options.envFile));
|
|
253737
254084
|
if (Object.keys(secrets).length === 0) {
|
|
253738
254085
|
throw new InvalidInputError("The env file contains no valid KEY=VALUE entries.");
|
|
253739
254086
|
}
|
|
@@ -253762,7 +254109,7 @@ function getSecretsCommand() {
|
|
|
253762
254109
|
}
|
|
253763
254110
|
|
|
253764
254111
|
// src/cli/commands/site/deploy.ts
|
|
253765
|
-
import { resolve as
|
|
254112
|
+
import { resolve as resolve10 } from "node:path";
|
|
253766
254113
|
async function deployAction2({ isNonInteractive, runTask: runTask2 }, options) {
|
|
253767
254114
|
if (isNonInteractive && !options.yes) {
|
|
253768
254115
|
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
@@ -253777,7 +254124,7 @@ async function deployAction2({ isNonInteractive, runTask: runTask2 }, options) {
|
|
|
253777
254124
|
]
|
|
253778
254125
|
});
|
|
253779
254126
|
}
|
|
253780
|
-
const outputDir =
|
|
254127
|
+
const outputDir = resolve10(project2.root, project2.site.outputDirectory);
|
|
253781
254128
|
if (!options.yes) {
|
|
253782
254129
|
const shouldDeploy = await Re({
|
|
253783
254130
|
message: `Deploy site from ${project2.site.outputDirectory}?`
|
|
@@ -253953,10 +254300,6 @@ function getTypesCommand() {
|
|
|
253953
254300
|
return new Command("types").description("Manage TypeScript type generation").addCommand(getTypesGenerateCommand());
|
|
253954
254301
|
}
|
|
253955
254302
|
|
|
253956
|
-
// src/cli/commands/dev.ts
|
|
253957
|
-
import { join as join28 } from "node:path";
|
|
253958
|
-
import process21 from "node:process";
|
|
253959
|
-
|
|
253960
254303
|
// src/cli/dev/dev-server/main.ts
|
|
253961
254304
|
var import_cors = __toESM(require_lib4(), 1);
|
|
253962
254305
|
var import_express6 = __toESM(require_express(), 1);
|
|
@@ -253987,14 +254330,14 @@ var getLocalHosts = () => {
|
|
|
253987
254330
|
}
|
|
253988
254331
|
return results;
|
|
253989
254332
|
};
|
|
253990
|
-
var checkAvailablePort = (options8) => new Promise((
|
|
254333
|
+
var checkAvailablePort = (options8) => new Promise((resolve12, reject) => {
|
|
253991
254334
|
const server = net.createServer();
|
|
253992
254335
|
server.unref();
|
|
253993
254336
|
server.on("error", reject);
|
|
253994
254337
|
server.listen(options8, () => {
|
|
253995
254338
|
const { port } = server.address();
|
|
253996
254339
|
server.close(() => {
|
|
253997
|
-
|
|
254340
|
+
resolve12(port);
|
|
253998
254341
|
});
|
|
253999
254342
|
});
|
|
254000
254343
|
});
|
|
@@ -254112,12 +254455,11 @@ var stringify = (item) => {
|
|
|
254112
254455
|
return String(item);
|
|
254113
254456
|
}
|
|
254114
254457
|
};
|
|
254115
|
-
function createDevLogger() {
|
|
254458
|
+
function createDevLogger(label2, labelColor = theme.styles.dim) {
|
|
254459
|
+
const prefix = label2 ? `${labelColor(`[${label2}]`)} ` : "";
|
|
254116
254460
|
const print = (type, ...args) => {
|
|
254117
254461
|
const colorize = colorByType[type];
|
|
254118
|
-
console[type](
|
|
254119
|
-
return colorize(stringify(item));
|
|
254120
|
-
}));
|
|
254462
|
+
console[type](prefix + args.map((item) => colorize(stringify(item))).join(" "));
|
|
254121
254463
|
};
|
|
254122
254464
|
return {
|
|
254123
254465
|
log: (...args) => print("log", ...args),
|
|
@@ -254254,7 +254596,7 @@ class FunctionManager {
|
|
|
254254
254596
|
});
|
|
254255
254597
|
}
|
|
254256
254598
|
waitForReady(name2, runningFunc) {
|
|
254257
|
-
return new Promise((
|
|
254599
|
+
return new Promise((resolve12, reject) => {
|
|
254258
254600
|
runningFunc.process.on("exit", (code2) => {
|
|
254259
254601
|
if (!runningFunc.ready) {
|
|
254260
254602
|
clearTimeout(timeout3);
|
|
@@ -254277,7 +254619,7 @@ class FunctionManager {
|
|
|
254277
254619
|
runningFunc.ready = true;
|
|
254278
254620
|
clearTimeout(timeout3);
|
|
254279
254621
|
runningFunc.process.stdout?.off("data", onData);
|
|
254280
|
-
|
|
254622
|
+
resolve12(runningFunc.port);
|
|
254281
254623
|
}
|
|
254282
254624
|
};
|
|
254283
254625
|
runningFunc.process.stdout?.on("data", onData);
|
|
@@ -255484,6 +255826,109 @@ function createCustomIntegrationRoutes(remoteProxy, logger2) {
|
|
|
255484
255826
|
return router;
|
|
255485
255827
|
}
|
|
255486
255828
|
|
|
255829
|
+
// src/cli/dev/dev-server/serve-runner.ts
|
|
255830
|
+
import { spawn as spawn3 } from "node:child_process";
|
|
255831
|
+
import process21 from "node:process";
|
|
255832
|
+
|
|
255833
|
+
class ServeRunner {
|
|
255834
|
+
command;
|
|
255835
|
+
cwd;
|
|
255836
|
+
env;
|
|
255837
|
+
logger;
|
|
255838
|
+
child;
|
|
255839
|
+
stopping = false;
|
|
255840
|
+
stopPromise;
|
|
255841
|
+
exitListeners = [];
|
|
255842
|
+
constructor(options8) {
|
|
255843
|
+
this.command = options8.command;
|
|
255844
|
+
this.cwd = options8.cwd;
|
|
255845
|
+
this.env = options8.env;
|
|
255846
|
+
this.logger = options8.logger;
|
|
255847
|
+
}
|
|
255848
|
+
start() {
|
|
255849
|
+
if (this.child) {
|
|
255850
|
+
return;
|
|
255851
|
+
}
|
|
255852
|
+
const stdin2 = process21.platform === "win32" ? "ignore" : "inherit";
|
|
255853
|
+
const child = spawn3(this.command, {
|
|
255854
|
+
cwd: this.cwd,
|
|
255855
|
+
shell: true,
|
|
255856
|
+
detached: process21.platform !== "win32",
|
|
255857
|
+
env: { ...process21.env, ...this.env },
|
|
255858
|
+
stdio: [stdin2, "pipe", "pipe"],
|
|
255859
|
+
windowsHide: true
|
|
255860
|
+
});
|
|
255861
|
+
this.child = child;
|
|
255862
|
+
this.setupHandlers(child);
|
|
255863
|
+
}
|
|
255864
|
+
onExit(listener) {
|
|
255865
|
+
this.exitListeners.push(listener);
|
|
255866
|
+
}
|
|
255867
|
+
async stop() {
|
|
255868
|
+
if (this.stopPromise) {
|
|
255869
|
+
return this.stopPromise;
|
|
255870
|
+
}
|
|
255871
|
+
this.stopPromise = this.stopChild();
|
|
255872
|
+
return this.stopPromise;
|
|
255873
|
+
}
|
|
255874
|
+
async stopChild() {
|
|
255875
|
+
const child = this.child;
|
|
255876
|
+
if (!child || child.exitCode !== null) {
|
|
255877
|
+
return;
|
|
255878
|
+
}
|
|
255879
|
+
this.stopping = true;
|
|
255880
|
+
const exited = new Promise((resolve12) => child.once("exit", () => resolve12()));
|
|
255881
|
+
if (process21.platform === "win32" && child.pid) {
|
|
255882
|
+
const taskkill = spawn3("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
|
|
255883
|
+
stdio: "ignore",
|
|
255884
|
+
windowsHide: true
|
|
255885
|
+
});
|
|
255886
|
+
await new Promise((resolve12) => {
|
|
255887
|
+
taskkill.once("exit", () => resolve12());
|
|
255888
|
+
taskkill.once("error", () => resolve12());
|
|
255889
|
+
});
|
|
255890
|
+
} else if (child.pid) {
|
|
255891
|
+
try {
|
|
255892
|
+
process21.kill(-child.pid, "SIGTERM");
|
|
255893
|
+
} catch {
|
|
255894
|
+
child.kill();
|
|
255895
|
+
}
|
|
255896
|
+
}
|
|
255897
|
+
await exited;
|
|
255898
|
+
}
|
|
255899
|
+
setupHandlers(child) {
|
|
255900
|
+
child.stdout?.on("data", (data) => this.emitLines(data, "log"));
|
|
255901
|
+
child.stderr?.on("data", (data) => this.emitLines(data, "error"));
|
|
255902
|
+
child.on("error", (error48) => {
|
|
255903
|
+
this.logger.error("Frontend dev server failed to start:", error48);
|
|
255904
|
+
this.notifyExit(null);
|
|
255905
|
+
});
|
|
255906
|
+
child.on("exit", (code2) => {
|
|
255907
|
+
if (this.stopping) {
|
|
255908
|
+
return;
|
|
255909
|
+
}
|
|
255910
|
+
this.logger.error(`Frontend dev server exited with code ${code2}`);
|
|
255911
|
+
this.notifyExit(code2);
|
|
255912
|
+
});
|
|
255913
|
+
}
|
|
255914
|
+
notifyExit(code2) {
|
|
255915
|
+
for (const listener of this.exitListeners) {
|
|
255916
|
+
listener(code2);
|
|
255917
|
+
}
|
|
255918
|
+
}
|
|
255919
|
+
emitLines(data, type) {
|
|
255920
|
+
const lines = data.toString().trimEnd().split(`
|
|
255921
|
+
`);
|
|
255922
|
+
for (const line3 of lines) {
|
|
255923
|
+
if (type === "error") {
|
|
255924
|
+
this.logger.error(line3);
|
|
255925
|
+
} else {
|
|
255926
|
+
this.logger.log(line3);
|
|
255927
|
+
}
|
|
255928
|
+
}
|
|
255929
|
+
}
|
|
255930
|
+
}
|
|
255931
|
+
|
|
255487
255932
|
// src/cli/dev/dev-server/watcher.ts
|
|
255488
255933
|
import { EventEmitter as EventEmitter4 } from "node:events";
|
|
255489
255934
|
import { relative as relative6 } from "node:path";
|
|
@@ -256334,7 +256779,7 @@ class NodeFsHandler {
|
|
|
256334
256779
|
this._addToNodeFs(path19, initialAdd, wh2, depth + 1);
|
|
256335
256780
|
}
|
|
256336
256781
|
}).on(EV.ERROR, this._boundHandleError);
|
|
256337
|
-
return new Promise((
|
|
256782
|
+
return new Promise((resolve13, reject) => {
|
|
256338
256783
|
if (!stream)
|
|
256339
256784
|
return reject();
|
|
256340
256785
|
stream.once(STR_END, () => {
|
|
@@ -256343,7 +256788,7 @@ class NodeFsHandler {
|
|
|
256343
256788
|
return;
|
|
256344
256789
|
}
|
|
256345
256790
|
const wasThrottled = throttler ? throttler.clear() : false;
|
|
256346
|
-
|
|
256791
|
+
resolve13(undefined);
|
|
256347
256792
|
previous.getChildren().filter((item) => {
|
|
256348
256793
|
return item !== directory && !current.has(item);
|
|
256349
256794
|
}).forEach((item) => {
|
|
@@ -257189,7 +257634,7 @@ async function createDevServer(options8) {
|
|
|
257189
257634
|
port: process.env.IS_TEST === "true" ? undefined : DEFAULT_PORT
|
|
257190
257635
|
});
|
|
257191
257636
|
const baseUrl = `http://localhost:${port}`;
|
|
257192
|
-
const { functions, entities, project: project2 } = await options8.loadResources();
|
|
257637
|
+
const { functions, entities, project: project2, siteUrl } = await options8.loadResources();
|
|
257193
257638
|
const app = import_express6.default();
|
|
257194
257639
|
const remoteProxy = import_http_proxy_middleware2.createProxyMiddleware({
|
|
257195
257640
|
target: BASE44_APP_URL,
|
|
@@ -257207,17 +257652,17 @@ async function createDevServer(options8) {
|
|
|
257207
257652
|
}
|
|
257208
257653
|
next();
|
|
257209
257654
|
});
|
|
257210
|
-
const devLogger = createDevLogger();
|
|
257655
|
+
const devLogger = createDevLogger("backend", theme.styles.info);
|
|
257211
257656
|
const functionManager = new FunctionManager(functions, devLogger, options8.denoWrapperPath);
|
|
257212
257657
|
const functionRoutes = createFunctionRouter(functionManager, devLogger);
|
|
257213
257658
|
app.use("/api/apps/:appId/functions", functionRoutes);
|
|
257214
257659
|
if (functionManager.getFunctionNames().length > 0) {
|
|
257215
|
-
|
|
257660
|
+
devLogger.log(`Loaded functions: ${functionManager.getFunctionNames().join(", ")}`);
|
|
257216
257661
|
}
|
|
257217
257662
|
const db2 = new Database;
|
|
257218
257663
|
await db2.load(entities);
|
|
257219
257664
|
if (db2.getCollectionNames().length > 0) {
|
|
257220
|
-
|
|
257665
|
+
devLogger.log(`Loaded entities: ${db2.getCollectionNames().join(", ")}`);
|
|
257221
257666
|
}
|
|
257222
257667
|
let emitEntityEvent = () => {};
|
|
257223
257668
|
const entityRoutes = await createEntityRoutes(db2, devLogger, (...args) => emitEntityEvent(...args));
|
|
@@ -257249,12 +257694,18 @@ async function createDevServer(options8) {
|
|
|
257249
257694
|
const customIntegrationRoutes = createCustomIntegrationRoutes(remoteProxy, devLogger);
|
|
257250
257695
|
app.use("/api/apps/:appId/integrations/custom", customIntegrationRoutes);
|
|
257251
257696
|
app.use((req, res, next) => {
|
|
257697
|
+
if (siteUrl && (req.path === "/login" || req.path.startsWith("/login/"))) {
|
|
257698
|
+
const targetUrl = new URL(req.originalUrl, siteUrl);
|
|
257699
|
+
devLogger.warn(`"${req.originalUrl}" requires hosted login, redirecting to ${targetUrl.toString()}`);
|
|
257700
|
+
res.redirect(targetUrl.toString());
|
|
257701
|
+
return;
|
|
257702
|
+
}
|
|
257252
257703
|
if (!req.originalUrl.endsWith("analytics/track/batch")) {
|
|
257253
257704
|
devLogger.warn(`"${req.originalUrl}" is not supported in local development, passing call to production`);
|
|
257254
257705
|
}
|
|
257255
257706
|
remoteProxy(req, res, next);
|
|
257256
257707
|
});
|
|
257257
|
-
const server = await new Promise((
|
|
257708
|
+
const server = await new Promise((resolve14, reject) => {
|
|
257258
257709
|
const s5 = app.listen(port, "127.0.0.1", (err) => {
|
|
257259
257710
|
if (err) {
|
|
257260
257711
|
if ("code" in err && err.code === "EADDRINUSE") {
|
|
@@ -257263,7 +257714,7 @@ async function createDevServer(options8) {
|
|
|
257263
257714
|
reject(err);
|
|
257264
257715
|
}
|
|
257265
257716
|
} else {
|
|
257266
|
-
|
|
257717
|
+
resolve14(s5);
|
|
257267
257718
|
}
|
|
257268
257719
|
});
|
|
257269
257720
|
});
|
|
@@ -257305,59 +257756,101 @@ async function createDevServer(options8) {
|
|
|
257305
257756
|
}
|
|
257306
257757
|
});
|
|
257307
257758
|
await base44ConfigWatcher.start();
|
|
257308
|
-
const
|
|
257759
|
+
const serveCommand = project2.site?.serveCommand;
|
|
257760
|
+
let serveRunner;
|
|
257761
|
+
if (options8.appId && serveCommand) {
|
|
257762
|
+
serveRunner = new ServeRunner({
|
|
257763
|
+
command: serveCommand,
|
|
257764
|
+
cwd: project2.root,
|
|
257765
|
+
env: {
|
|
257766
|
+
VITE_BASE44_APP_ID: options8.appId,
|
|
257767
|
+
VITE_BASE44_APP_BASE_URL: baseUrl
|
|
257768
|
+
},
|
|
257769
|
+
logger: createDevLogger("frontend", theme.colors.base44Orange)
|
|
257770
|
+
});
|
|
257771
|
+
}
|
|
257772
|
+
const handleShutdownError = (error48) => {
|
|
257773
|
+
const errorMessage = error48 instanceof Error ? error48.message : String(error48);
|
|
257774
|
+
devLogger.error(`Failed to shut down dev server: ${errorMessage}`);
|
|
257775
|
+
};
|
|
257776
|
+
const closeServerIfRunning = async () => {
|
|
257777
|
+
if (!server.listening) {
|
|
257778
|
+
return;
|
|
257779
|
+
}
|
|
257780
|
+
await new Promise((resolve14, reject) => {
|
|
257781
|
+
server.close((error48) => {
|
|
257782
|
+
if (error48) {
|
|
257783
|
+
reject(error48);
|
|
257784
|
+
return;
|
|
257785
|
+
}
|
|
257786
|
+
resolve14();
|
|
257787
|
+
});
|
|
257788
|
+
});
|
|
257789
|
+
};
|
|
257790
|
+
const runShutdown = async () => {
|
|
257309
257791
|
base44ConfigWatcher.close();
|
|
257310
|
-
io6.close();
|
|
257792
|
+
await io6.close();
|
|
257311
257793
|
await functionManager.stopAll();
|
|
257312
|
-
|
|
257794
|
+
await serveRunner?.stop();
|
|
257795
|
+
await closeServerIfRunning();
|
|
257796
|
+
};
|
|
257797
|
+
let shutdownPromise;
|
|
257798
|
+
const shutdown = () => {
|
|
257799
|
+
shutdownPromise ??= runShutdown().catch(handleShutdownError);
|
|
257800
|
+
return shutdownPromise;
|
|
257313
257801
|
};
|
|
257314
257802
|
process.on("SIGINT", shutdown);
|
|
257315
257803
|
process.on("SIGTERM", shutdown);
|
|
257316
|
-
|
|
257804
|
+
serveRunner?.onExit(() => {
|
|
257805
|
+
shutdown().finally(() => process.exit(1));
|
|
257806
|
+
});
|
|
257807
|
+
if (serveRunner) {
|
|
257808
|
+
devLogger.log(`Backend running on ${baseUrl}`);
|
|
257809
|
+
serveRunner.start();
|
|
257810
|
+
}
|
|
257811
|
+
return { port, server, isServingFrontend: serveRunner !== undefined };
|
|
257317
257812
|
}
|
|
257318
257813
|
|
|
257319
257814
|
// src/cli/commands/dev.ts
|
|
257320
257815
|
function localServerUrl(port) {
|
|
257321
257816
|
return `http://localhost:${port}`;
|
|
257322
257817
|
}
|
|
257323
|
-
|
|
257324
|
-
const
|
|
257325
|
-
if (
|
|
257326
|
-
|
|
257818
|
+
function validateDevOptions(command2) {
|
|
257819
|
+
const { appId } = command2.optsWithGlobals();
|
|
257820
|
+
if (appId !== undefined) {
|
|
257821
|
+
command2.error(`base44 dev cannot be used with --app-id or ${BASE44_APP_ID_ENV_VAR}.`);
|
|
257327
257822
|
}
|
|
257328
|
-
const { id: appId } = await initAppContext();
|
|
257329
|
-
await writeFile(envLocalPath, `VITE_BASE44_APP_ID=${appId}
|
|
257330
|
-
VITE_BASE44_APP_BASE_URL=${localServerUrl(port)}
|
|
257331
|
-
`);
|
|
257332
|
-
log.info("Created .env.local with app ID and dev server URL");
|
|
257333
257823
|
}
|
|
257334
|
-
async function devAction(
|
|
257824
|
+
async function devAction(ctx, options8) {
|
|
257825
|
+
const { log, app } = ctx;
|
|
257826
|
+
if (!app?.projectRoot) {
|
|
257827
|
+
throw new ConfigInvalidError("base44 dev requires a linked local project. Run it from a project with base44/.app.jsonc.");
|
|
257828
|
+
}
|
|
257335
257829
|
const port = options8.port ? Number(options8.port) : undefined;
|
|
257336
|
-
|
|
257337
|
-
const
|
|
257830
|
+
const appId = app.id;
|
|
257831
|
+
const siteUrlPromise = getSiteUrl().catch(() => {
|
|
257832
|
+
return;
|
|
257833
|
+
});
|
|
257834
|
+
const { port: resolvedPort, isServingFrontend } = await createDevServer({
|
|
257338
257835
|
log,
|
|
257339
257836
|
port,
|
|
257340
|
-
|
|
257837
|
+
appId,
|
|
257341
257838
|
denoWrapperPath: getDenoWrapperPath(),
|
|
257342
257839
|
loadResources: async () => {
|
|
257343
257840
|
const { functions, entities, project: project2 } = await readProjectConfig();
|
|
257344
|
-
|
|
257345
|
-
return { functions, entities, project: project2 };
|
|
257841
|
+
const siteUrl = await siteUrlPromise;
|
|
257842
|
+
return { functions, entities, project: project2, siteUrl };
|
|
257346
257843
|
}
|
|
257347
257844
|
});
|
|
257348
|
-
|
|
257349
|
-
|
|
257350
|
-
}
|
|
257351
|
-
return {
|
|
257352
|
-
outroMessage: `Dev server is available at ${theme.colors.links(localServerUrl(resolvedPort))}`
|
|
257353
|
-
};
|
|
257845
|
+
const outroMessage = isServingFrontend ? "Open your app using the frontend dev server URL" : `Dev server is available at ${theme.colors.links(localServerUrl(resolvedPort))}`;
|
|
257846
|
+
return { outroMessage };
|
|
257354
257847
|
}
|
|
257355
257848
|
function getDevCommand() {
|
|
257356
|
-
return new Base44Command("dev").description("Start the development server").option("-p, --port <number>", "Port for the development server").action(devAction);
|
|
257849
|
+
return new Base44Command("dev").description("Start the development server").option("-p, --port <number>", "Port for the development server").hook("preAction", validateDevOptions).action(devAction);
|
|
257357
257850
|
}
|
|
257358
257851
|
|
|
257359
257852
|
// src/core/exec/run-script.ts
|
|
257360
|
-
import { spawn as
|
|
257853
|
+
import { spawn as spawn4 } from "node:child_process";
|
|
257361
257854
|
import { copyFileSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
257362
257855
|
async function runScript(options8) {
|
|
257363
257856
|
const { appId, code: code2 } = options8;
|
|
@@ -257376,7 +257869,7 @@ async function runScript(options8) {
|
|
|
257376
257869
|
copyFileSync(getExecWrapperPath(), tempWrapper.path);
|
|
257377
257870
|
try {
|
|
257378
257871
|
const exitCode = await new Promise((resolvePromise) => {
|
|
257379
|
-
const child =
|
|
257872
|
+
const child = spawn4("deno", ["run", "--allow-all", "--node-modules-dir=auto", tempWrapper.path], {
|
|
257380
257873
|
env: {
|
|
257381
257874
|
...process.env,
|
|
257382
257875
|
SCRIPT_PATH: scriptPath,
|
|
@@ -257399,13 +257892,13 @@ async function runScript(options8) {
|
|
|
257399
257892
|
}
|
|
257400
257893
|
// src/cli/commands/exec.ts
|
|
257401
257894
|
function readStdin2() {
|
|
257402
|
-
return new Promise((
|
|
257895
|
+
return new Promise((resolve14, reject) => {
|
|
257403
257896
|
let data = "";
|
|
257404
257897
|
process.stdin.setEncoding("utf-8");
|
|
257405
257898
|
process.stdin.on("data", (chunk) => {
|
|
257406
257899
|
data += chunk;
|
|
257407
257900
|
});
|
|
257408
|
-
process.stdin.on("end", () =>
|
|
257901
|
+
process.stdin.on("end", () => resolve14(data));
|
|
257409
257902
|
process.stdin.on("error", reject);
|
|
257410
257903
|
});
|
|
257411
257904
|
}
|
|
@@ -257447,7 +257940,7 @@ Examples:
|
|
|
257447
257940
|
}
|
|
257448
257941
|
|
|
257449
257942
|
// src/cli/commands/project/eject.ts
|
|
257450
|
-
import { resolve as
|
|
257943
|
+
import { resolve as resolve14 } from "node:path";
|
|
257451
257944
|
var import_kebabCase2 = __toESM(require_kebabCase(), 1);
|
|
257452
257945
|
async function eject(ctx, options8, command2) {
|
|
257453
257946
|
const { log, runTask: runTask2, isNonInteractive } = ctx;
|
|
@@ -257511,7 +258004,7 @@ async function eject(ctx, options8, command2) {
|
|
|
257511
258004
|
Ne("Operation cancelled.");
|
|
257512
258005
|
throw new CLIExitError(0);
|
|
257513
258006
|
}
|
|
257514
|
-
const resolvedPath =
|
|
258007
|
+
const resolvedPath = resolve14(selectedPath);
|
|
257515
258008
|
await runTask2("Downloading your project's code...", async (updateMessage) => {
|
|
257516
258009
|
await createProjectFilesForExistingProject({
|
|
257517
258010
|
projectId,
|
|
@@ -257581,11 +258074,12 @@ function createProgram(context) {
|
|
|
257581
258074
|
program2.addCommand(getConnectorsCommand());
|
|
257582
258075
|
program2.addCommand(getFunctionsCommand());
|
|
257583
258076
|
program2.addCommand(getSecretsCommand());
|
|
258077
|
+
program2.addCommand(getSandboxCommand());
|
|
257584
258078
|
program2.addCommand(getAuthCommand());
|
|
257585
258079
|
program2.addCommand(getSiteCommand());
|
|
257586
258080
|
program2.addCommand(getTypesCommand());
|
|
257587
258081
|
program2.addCommand(getExecCommand());
|
|
257588
|
-
program2.addCommand(getDevCommand()
|
|
258082
|
+
program2.addCommand(getDevCommand());
|
|
257589
258083
|
program2.addCommand(getLogsCommand());
|
|
257590
258084
|
return program2;
|
|
257591
258085
|
}
|
|
@@ -259882,14 +260376,14 @@ async function addSourceContext(frames) {
|
|
|
259882
260376
|
return frames;
|
|
259883
260377
|
}
|
|
259884
260378
|
function getContextLinesFromFile(path19, ranges, output) {
|
|
259885
|
-
return new Promise((
|
|
260379
|
+
return new Promise((resolve15) => {
|
|
259886
260380
|
const stream = createReadStream2(path19);
|
|
259887
260381
|
const lineReaded = createInterface2({
|
|
259888
260382
|
input: stream
|
|
259889
260383
|
});
|
|
259890
260384
|
function destroyStreamAndResolve() {
|
|
259891
260385
|
stream.destroy();
|
|
259892
|
-
|
|
260386
|
+
resolve15();
|
|
259893
260387
|
}
|
|
259894
260388
|
let lineNumber = 0;
|
|
259895
260389
|
let currentRangeIndex = 0;
|
|
@@ -261001,15 +261495,15 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
261001
261495
|
return true;
|
|
261002
261496
|
if (this.featureFlagsPoller === undefined)
|
|
261003
261497
|
return false;
|
|
261004
|
-
return new Promise((
|
|
261498
|
+
return new Promise((resolve15) => {
|
|
261005
261499
|
const timeout3 = setTimeout(() => {
|
|
261006
261500
|
cleanup();
|
|
261007
|
-
|
|
261501
|
+
resolve15(false);
|
|
261008
261502
|
}, timeoutMs);
|
|
261009
261503
|
const cleanup = this._events.on("localEvaluationFlagsLoaded", (count2) => {
|
|
261010
261504
|
clearTimeout(timeout3);
|
|
261011
261505
|
cleanup();
|
|
261012
|
-
|
|
261506
|
+
resolve15(count2 > 0);
|
|
261013
261507
|
});
|
|
261014
261508
|
});
|
|
261015
261509
|
}
|
|
@@ -261795,7 +262289,7 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
|
|
|
261795
262289
|
// src/cli/index.ts
|
|
261796
262290
|
var __dirname4 = dirname23(fileURLToPath6(import.meta.url));
|
|
261797
262291
|
async function runCLI(options8) {
|
|
261798
|
-
ensureNpmAssets(
|
|
262292
|
+
ensureNpmAssets(join28(__dirname4, "../assets"));
|
|
261799
262293
|
const errorReporter = new ErrorReporter;
|
|
261800
262294
|
errorReporter.registerProcessErrorHandlers();
|
|
261801
262295
|
const isNonInteractive = !process.stdin.isTTY || !process.stdout.isTTY;
|
|
@@ -261832,4 +262326,4 @@ export {
|
|
|
261832
262326
|
CLIExitError
|
|
261833
262327
|
};
|
|
261834
262328
|
|
|
261835
|
-
//# debugId=
|
|
262329
|
+
//# debugId=680B4B248801421C64756E2164756E21
|