@base44-preview/cli 0.0.44-pr.417.2c58950 → 0.0.45-pr.357.f38fab3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/deno-runtime/main.ts +72 -0
- package/dist/cli/index.js +843 -198
- package/dist/cli/index.js.map +27 -17
- package/package.json +1 -1
- package/dist/assets/deno-runtime/main.js +0 -31
- package/dist/assets/deno-runtime/main.js.map +0 -10
package/dist/cli/index.js
CHANGED
|
@@ -16459,7 +16459,7 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
16459
16459
|
}
|
|
16460
16460
|
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
|
|
16461
16461
|
});
|
|
16462
|
-
function
|
|
16462
|
+
function join11(array2, separator) {
|
|
16463
16463
|
return array2 == null ? "" : nativeJoin.call(array2, separator);
|
|
16464
16464
|
}
|
|
16465
16465
|
function last(array2) {
|
|
@@ -16481,7 +16481,7 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
16481
16481
|
function nth(array2, n2) {
|
|
16482
16482
|
return array2 && array2.length ? baseNth(array2, toInteger(n2)) : undefined2;
|
|
16483
16483
|
}
|
|
16484
|
-
var
|
|
16484
|
+
var pull3 = baseRest(pullAll);
|
|
16485
16485
|
function pullAll(array2, values2) {
|
|
16486
16486
|
return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2) : array2;
|
|
16487
16487
|
}
|
|
@@ -18246,7 +18246,7 @@ __p += '`;
|
|
|
18246
18246
|
lodash.pickBy = pickBy;
|
|
18247
18247
|
lodash.property = property;
|
|
18248
18248
|
lodash.propertyOf = propertyOf;
|
|
18249
|
-
lodash.pull =
|
|
18249
|
+
lodash.pull = pull3;
|
|
18250
18250
|
lodash.pullAll = pullAll;
|
|
18251
18251
|
lodash.pullAllBy = pullAllBy;
|
|
18252
18252
|
lodash.pullAllWith = pullAllWith;
|
|
@@ -18391,7 +18391,7 @@ __p += '`;
|
|
|
18391
18391
|
lodash.isUndefined = isUndefined;
|
|
18392
18392
|
lodash.isWeakMap = isWeakMap;
|
|
18393
18393
|
lodash.isWeakSet = isWeakSet;
|
|
18394
|
-
lodash.join =
|
|
18394
|
+
lodash.join = join11;
|
|
18395
18395
|
lodash.kebabCase = kebabCase;
|
|
18396
18396
|
lodash.last = last;
|
|
18397
18397
|
lodash.lastIndexOf = lastIndexOf;
|
|
@@ -27503,7 +27503,7 @@ function cleanDoc(doc2) {
|
|
|
27503
27503
|
return mapDoc(doc2, (currentDoc) => cleanDocFn(currentDoc));
|
|
27504
27504
|
}
|
|
27505
27505
|
function replaceEndOfLine(doc2, replacement = literalline) {
|
|
27506
|
-
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
27506
|
+
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ? join15(replacement, currentDoc.split(`
|
|
27507
27507
|
`)) : currentDoc);
|
|
27508
27508
|
}
|
|
27509
27509
|
function canBreakFn(doc2) {
|
|
@@ -27583,7 +27583,7 @@ function indentIfBreak(contents, options) {
|
|
|
27583
27583
|
negate: options.negate
|
|
27584
27584
|
};
|
|
27585
27585
|
}
|
|
27586
|
-
function
|
|
27586
|
+
function join15(separator, docs) {
|
|
27587
27587
|
assertDoc(separator);
|
|
27588
27588
|
assertDocArray(docs);
|
|
27589
27589
|
const parts = [];
|
|
@@ -28294,7 +28294,7 @@ var init_doc = __esm(() => {
|
|
|
28294
28294
|
MODE_FLAT = Symbol("MODE_FLAT");
|
|
28295
28295
|
DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
|
|
28296
28296
|
builders = {
|
|
28297
|
-
join:
|
|
28297
|
+
join: join15,
|
|
28298
28298
|
line,
|
|
28299
28299
|
softline,
|
|
28300
28300
|
hardline,
|
|
@@ -133208,7 +133208,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
133208
133208
|
return mapDoc2(doc2, (currentDoc) => cleanDocFn2(currentDoc));
|
|
133209
133209
|
}
|
|
133210
133210
|
function replaceEndOfLine2(doc2, replacement = literalline2) {
|
|
133211
|
-
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
133211
|
+
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ? join17(replacement, currentDoc.split(`
|
|
133212
133212
|
`)) : currentDoc);
|
|
133213
133213
|
}
|
|
133214
133214
|
function canBreakFn2(doc2) {
|
|
@@ -133294,7 +133294,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
133294
133294
|
negate: options8.negate
|
|
133295
133295
|
};
|
|
133296
133296
|
}
|
|
133297
|
-
function
|
|
133297
|
+
function join17(separator, docs) {
|
|
133298
133298
|
assertDoc2(separator);
|
|
133299
133299
|
assertDocArray2(docs);
|
|
133300
133300
|
const parts = [];
|
|
@@ -133959,7 +133959,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
133959
133959
|
}
|
|
133960
133960
|
}
|
|
133961
133961
|
var builders2 = {
|
|
133962
|
-
join:
|
|
133962
|
+
join: join17,
|
|
133963
133963
|
line: line3,
|
|
133964
133964
|
softline: softline2,
|
|
133965
133965
|
hardline: hardline4,
|
|
@@ -160399,10 +160399,10 @@ var require_view = __commonJS((exports, module) => {
|
|
|
160399
160399
|
var debug = require_src4()("express:view");
|
|
160400
160400
|
var path18 = __require("node:path");
|
|
160401
160401
|
var fs28 = __require("node:fs");
|
|
160402
|
-
var
|
|
160402
|
+
var dirname12 = path18.dirname;
|
|
160403
160403
|
var basename4 = path18.basename;
|
|
160404
160404
|
var extname2 = path18.extname;
|
|
160405
|
-
var
|
|
160405
|
+
var join18 = path18.join;
|
|
160406
160406
|
var resolve6 = path18.resolve;
|
|
160407
160407
|
module.exports = View;
|
|
160408
160408
|
function View(name2, options8) {
|
|
@@ -160438,7 +160438,7 @@ var require_view = __commonJS((exports, module) => {
|
|
|
160438
160438
|
for (var i5 = 0;i5 < roots.length && !path19; i5++) {
|
|
160439
160439
|
var root2 = roots[i5];
|
|
160440
160440
|
var loc = resolve6(root2, name2);
|
|
160441
|
-
var dir =
|
|
160441
|
+
var dir = dirname12(loc);
|
|
160442
160442
|
var file2 = basename4(loc);
|
|
160443
160443
|
path19 = this.resolve(dir, file2);
|
|
160444
160444
|
}
|
|
@@ -160464,12 +160464,12 @@ var require_view = __commonJS((exports, module) => {
|
|
|
160464
160464
|
};
|
|
160465
160465
|
View.prototype.resolve = function resolve7(dir, file2) {
|
|
160466
160466
|
var ext = this.ext;
|
|
160467
|
-
var path19 =
|
|
160467
|
+
var path19 = join18(dir, file2);
|
|
160468
160468
|
var stat2 = tryStat(path19);
|
|
160469
160469
|
if (stat2 && stat2.isFile()) {
|
|
160470
160470
|
return path19;
|
|
160471
160471
|
}
|
|
160472
|
-
path19 =
|
|
160472
|
+
path19 = join18(dir, basename4(file2, ext), "index" + ext);
|
|
160473
160473
|
stat2 = tryStat(path19);
|
|
160474
160474
|
if (stat2 && stat2.isFile()) {
|
|
160475
160475
|
return path19;
|
|
@@ -164164,7 +164164,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
164164
164164
|
var Stream2 = __require("stream");
|
|
164165
164165
|
var util2 = __require("util");
|
|
164166
164166
|
var extname2 = path18.extname;
|
|
164167
|
-
var
|
|
164167
|
+
var join18 = path18.join;
|
|
164168
164168
|
var normalize = path18.normalize;
|
|
164169
164169
|
var resolve6 = path18.resolve;
|
|
164170
164170
|
var sep = path18.sep;
|
|
@@ -164336,7 +164336,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
164336
164336
|
return res;
|
|
164337
164337
|
}
|
|
164338
164338
|
parts = path19.split(sep);
|
|
164339
|
-
path19 = normalize(
|
|
164339
|
+
path19 = normalize(join18(root2, path19));
|
|
164340
164340
|
} else {
|
|
164341
164341
|
if (UP_PATH_REGEXP.test(path19)) {
|
|
164342
164342
|
debug('malicious path "%s"', path19);
|
|
@@ -164476,7 +164476,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
164476
164476
|
return self2.onStatError(err);
|
|
164477
164477
|
return self2.error(404);
|
|
164478
164478
|
}
|
|
164479
|
-
var p4 =
|
|
164479
|
+
var p4 = join18(path19, self2._index[i5]);
|
|
164480
164480
|
debug('stat "%s"', p4);
|
|
164481
164481
|
fs28.stat(p4, function(err2, stat2) {
|
|
164482
164482
|
if (err2)
|
|
@@ -168535,8 +168535,8 @@ var require_executor = __commonJS((exports, module) => {
|
|
|
168535
168535
|
}
|
|
168536
168536
|
resetBuffer() {
|
|
168537
168537
|
this.buffer = new Waterfall;
|
|
168538
|
-
this.buffer.chain(new Promise((
|
|
168539
|
-
this._triggerBuffer =
|
|
168538
|
+
this.buffer.chain(new Promise((resolve7) => {
|
|
168539
|
+
this._triggerBuffer = resolve7;
|
|
168540
168540
|
}));
|
|
168541
168541
|
if (this.ready)
|
|
168542
168542
|
this._triggerBuffer();
|
|
@@ -169556,7 +169556,7 @@ var require_storage = __commonJS((exports, module) => {
|
|
|
169556
169556
|
throw e8;
|
|
169557
169557
|
}
|
|
169558
169558
|
};
|
|
169559
|
-
var writeFileLinesAsync = (filename, lines, mode = DEFAULT_FILE_MODE) => new Promise((
|
|
169559
|
+
var writeFileLinesAsync = (filename, lines, mode = DEFAULT_FILE_MODE) => new Promise((resolve7, reject) => {
|
|
169560
169560
|
try {
|
|
169561
169561
|
const stream = writeFileStream(filename, { mode });
|
|
169562
169562
|
const readable2 = Readable6.from(lines);
|
|
@@ -169573,7 +169573,7 @@ var require_storage = __commonJS((exports, module) => {
|
|
|
169573
169573
|
if (err)
|
|
169574
169574
|
reject(err);
|
|
169575
169575
|
else
|
|
169576
|
-
|
|
169576
|
+
resolve7();
|
|
169577
169577
|
});
|
|
169578
169578
|
});
|
|
169579
169579
|
readable2.on("error", (err) => {
|
|
@@ -169744,7 +169744,7 @@ var require_persistence = __commonJS((exports, module) => {
|
|
|
169744
169744
|
return { data: tdata, indexes };
|
|
169745
169745
|
}
|
|
169746
169746
|
treatRawStreamAsync(rawStream) {
|
|
169747
|
-
return new Promise((
|
|
169747
|
+
return new Promise((resolve7, reject) => {
|
|
169748
169748
|
const dataById = {};
|
|
169749
169749
|
const indexes = {};
|
|
169750
169750
|
let corruptItems = 0;
|
|
@@ -169787,7 +169787,7 @@ var require_persistence = __commonJS((exports, module) => {
|
|
|
169787
169787
|
}
|
|
169788
169788
|
}
|
|
169789
169789
|
const data = Object.values(dataById);
|
|
169790
|
-
|
|
169790
|
+
resolve7({ data, indexes });
|
|
169791
169791
|
});
|
|
169792
169792
|
lineStream.on("error", function(err) {
|
|
169793
169793
|
reject(err, null);
|
|
@@ -195398,13 +195398,13 @@ var require_broadcast_operator = __commonJS((exports) => {
|
|
|
195398
195398
|
return true;
|
|
195399
195399
|
}
|
|
195400
195400
|
emitWithAck(ev2, ...args) {
|
|
195401
|
-
return new Promise((
|
|
195401
|
+
return new Promise((resolve7, reject) => {
|
|
195402
195402
|
args.push((err, responses) => {
|
|
195403
195403
|
if (err) {
|
|
195404
195404
|
err.responses = responses;
|
|
195405
195405
|
return reject(err);
|
|
195406
195406
|
} else {
|
|
195407
|
-
return
|
|
195407
|
+
return resolve7(responses);
|
|
195408
195408
|
}
|
|
195409
195409
|
});
|
|
195410
195410
|
this.emit(ev2, ...args);
|
|
@@ -195592,12 +195592,12 @@ var require_socket2 = __commonJS((exports) => {
|
|
|
195592
195592
|
}
|
|
195593
195593
|
emitWithAck(ev2, ...args) {
|
|
195594
195594
|
const withErr = this.flags.timeout !== undefined;
|
|
195595
|
-
return new Promise((
|
|
195595
|
+
return new Promise((resolve7, reject) => {
|
|
195596
195596
|
args.push((arg1, arg2) => {
|
|
195597
195597
|
if (withErr) {
|
|
195598
|
-
return arg1 ? reject(arg1) :
|
|
195598
|
+
return arg1 ? reject(arg1) : resolve7(arg2);
|
|
195599
195599
|
} else {
|
|
195600
|
-
return
|
|
195600
|
+
return resolve7(arg1);
|
|
195601
195601
|
}
|
|
195602
195602
|
});
|
|
195603
195603
|
this.emit(ev2, ...args);
|
|
@@ -196052,13 +196052,13 @@ var require_namespace = __commonJS((exports) => {
|
|
|
196052
196052
|
return true;
|
|
196053
196053
|
}
|
|
196054
196054
|
serverSideEmitWithAck(ev2, ...args) {
|
|
196055
|
-
return new Promise((
|
|
196055
|
+
return new Promise((resolve7, reject) => {
|
|
196056
196056
|
args.push((err, responses) => {
|
|
196057
196057
|
if (err) {
|
|
196058
196058
|
err.responses = responses;
|
|
196059
196059
|
return reject(err);
|
|
196060
196060
|
} else {
|
|
196061
|
-
return
|
|
196061
|
+
return resolve7(responses);
|
|
196062
196062
|
}
|
|
196063
196063
|
});
|
|
196064
196064
|
this.serverSideEmit(ev2, ...args);
|
|
@@ -196742,7 +196742,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
196742
196742
|
return localSockets;
|
|
196743
196743
|
}
|
|
196744
196744
|
const requestId = randomId();
|
|
196745
|
-
return new Promise((
|
|
196745
|
+
return new Promise((resolve7, reject) => {
|
|
196746
196746
|
const timeout3 = setTimeout(() => {
|
|
196747
196747
|
const storedRequest2 = this.requests.get(requestId);
|
|
196748
196748
|
if (storedRequest2) {
|
|
@@ -196752,7 +196752,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
196752
196752
|
}, opts.flags.timeout || DEFAULT_TIMEOUT);
|
|
196753
196753
|
const storedRequest = {
|
|
196754
196754
|
type: MessageType.FETCH_SOCKETS,
|
|
196755
|
-
resolve:
|
|
196755
|
+
resolve: resolve7,
|
|
196756
196756
|
timeout: timeout3,
|
|
196757
196757
|
current: 0,
|
|
196758
196758
|
expected: expectedResponseCount,
|
|
@@ -196962,7 +196962,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
196962
196962
|
return localSockets;
|
|
196963
196963
|
}
|
|
196964
196964
|
const requestId = randomId();
|
|
196965
|
-
return new Promise((
|
|
196965
|
+
return new Promise((resolve7, reject) => {
|
|
196966
196966
|
const timeout3 = setTimeout(() => {
|
|
196967
196967
|
const storedRequest2 = this.customRequests.get(requestId);
|
|
196968
196968
|
if (storedRequest2) {
|
|
@@ -196972,7 +196972,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
196972
196972
|
}, opts.flags.timeout || DEFAULT_TIMEOUT);
|
|
196973
196973
|
const storedRequest = {
|
|
196974
196974
|
type: MessageType.FETCH_SOCKETS,
|
|
196975
|
-
resolve:
|
|
196975
|
+
resolve: resolve7,
|
|
196976
196976
|
timeout: timeout3,
|
|
196977
196977
|
missingUids: new Set([...this.nodesMap.keys()]),
|
|
196978
196978
|
responses: localSockets
|
|
@@ -197701,13 +197701,13 @@ var require_dist4 = __commonJS((exports, module) => {
|
|
|
197701
197701
|
this.engine.close();
|
|
197702
197702
|
(0, uws_1.restoreAdapter)();
|
|
197703
197703
|
if (this.httpServer) {
|
|
197704
|
-
return new Promise((
|
|
197704
|
+
return new Promise((resolve7) => {
|
|
197705
197705
|
this.httpServer.close((err) => {
|
|
197706
197706
|
fn9 && fn9(err);
|
|
197707
197707
|
if (err) {
|
|
197708
197708
|
debug("server was not running");
|
|
197709
197709
|
}
|
|
197710
|
-
|
|
197710
|
+
resolve7();
|
|
197711
197711
|
});
|
|
197712
197712
|
});
|
|
197713
197713
|
} else {
|
|
@@ -211071,7 +211071,7 @@ var require_buffer_list = __commonJS((exports, module) => {
|
|
|
211071
211071
|
}
|
|
211072
211072
|
}, {
|
|
211073
211073
|
key: "join",
|
|
211074
|
-
value: function
|
|
211074
|
+
value: function join18(s5) {
|
|
211075
211075
|
if (this.length === 0)
|
|
211076
211076
|
return "";
|
|
211077
211077
|
var p4 = this.head;
|
|
@@ -212426,14 +212426,14 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
212426
212426
|
};
|
|
212427
212427
|
}
|
|
212428
212428
|
function readAndResolve(iter) {
|
|
212429
|
-
var
|
|
212430
|
-
if (
|
|
212429
|
+
var resolve7 = iter[kLastResolve];
|
|
212430
|
+
if (resolve7 !== null) {
|
|
212431
212431
|
var data = iter[kStream].read();
|
|
212432
212432
|
if (data !== null) {
|
|
212433
212433
|
iter[kLastPromise] = null;
|
|
212434
212434
|
iter[kLastResolve] = null;
|
|
212435
212435
|
iter[kLastReject] = null;
|
|
212436
|
-
|
|
212436
|
+
resolve7(createIterResult(data, false));
|
|
212437
212437
|
}
|
|
212438
212438
|
}
|
|
212439
212439
|
}
|
|
@@ -212441,13 +212441,13 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
212441
212441
|
process.nextTick(readAndResolve, iter);
|
|
212442
212442
|
}
|
|
212443
212443
|
function wrapForNext(lastPromise, iter) {
|
|
212444
|
-
return function(
|
|
212444
|
+
return function(resolve7, reject) {
|
|
212445
212445
|
lastPromise.then(function() {
|
|
212446
212446
|
if (iter[kEnded]) {
|
|
212447
|
-
|
|
212447
|
+
resolve7(createIterResult(undefined, true));
|
|
212448
212448
|
return;
|
|
212449
212449
|
}
|
|
212450
|
-
iter[kHandlePromise](
|
|
212450
|
+
iter[kHandlePromise](resolve7, reject);
|
|
212451
212451
|
}, reject);
|
|
212452
212452
|
};
|
|
212453
212453
|
}
|
|
@@ -212466,12 +212466,12 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
212466
212466
|
return Promise.resolve(createIterResult(undefined, true));
|
|
212467
212467
|
}
|
|
212468
212468
|
if (this[kStream].destroyed) {
|
|
212469
|
-
return new Promise(function(
|
|
212469
|
+
return new Promise(function(resolve7, reject) {
|
|
212470
212470
|
process.nextTick(function() {
|
|
212471
212471
|
if (_this[kError]) {
|
|
212472
212472
|
reject(_this[kError]);
|
|
212473
212473
|
} else {
|
|
212474
|
-
|
|
212474
|
+
resolve7(createIterResult(undefined, true));
|
|
212475
212475
|
}
|
|
212476
212476
|
});
|
|
212477
212477
|
});
|
|
@@ -212494,13 +212494,13 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
212494
212494
|
return this;
|
|
212495
212495
|
}), _defineProperty(_Object$setPrototypeO, "return", function _return() {
|
|
212496
212496
|
var _this2 = this;
|
|
212497
|
-
return new Promise(function(
|
|
212497
|
+
return new Promise(function(resolve7, reject) {
|
|
212498
212498
|
_this2[kStream].destroy(null, function(err) {
|
|
212499
212499
|
if (err) {
|
|
212500
212500
|
reject(err);
|
|
212501
212501
|
return;
|
|
212502
212502
|
}
|
|
212503
|
-
|
|
212503
|
+
resolve7(createIterResult(undefined, true));
|
|
212504
212504
|
});
|
|
212505
212505
|
});
|
|
212506
212506
|
}), _Object$setPrototypeO), AsyncIteratorPrototype);
|
|
@@ -212522,15 +212522,15 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
212522
212522
|
value: stream._readableState.endEmitted,
|
|
212523
212523
|
writable: true
|
|
212524
212524
|
}), _defineProperty(_Object$create, kHandlePromise, {
|
|
212525
|
-
value: function value(
|
|
212525
|
+
value: function value(resolve7, reject) {
|
|
212526
212526
|
var data = iterator[kStream].read();
|
|
212527
212527
|
if (data) {
|
|
212528
212528
|
iterator[kLastPromise] = null;
|
|
212529
212529
|
iterator[kLastResolve] = null;
|
|
212530
212530
|
iterator[kLastReject] = null;
|
|
212531
|
-
|
|
212531
|
+
resolve7(createIterResult(data, false));
|
|
212532
212532
|
} else {
|
|
212533
|
-
iterator[kLastResolve] =
|
|
212533
|
+
iterator[kLastResolve] = resolve7;
|
|
212534
212534
|
iterator[kLastReject] = reject;
|
|
212535
212535
|
}
|
|
212536
212536
|
},
|
|
@@ -212549,12 +212549,12 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
212549
212549
|
iterator[kError] = err;
|
|
212550
212550
|
return;
|
|
212551
212551
|
}
|
|
212552
|
-
var
|
|
212553
|
-
if (
|
|
212552
|
+
var resolve7 = iterator[kLastResolve];
|
|
212553
|
+
if (resolve7 !== null) {
|
|
212554
212554
|
iterator[kLastPromise] = null;
|
|
212555
212555
|
iterator[kLastResolve] = null;
|
|
212556
212556
|
iterator[kLastReject] = null;
|
|
212557
|
-
|
|
212557
|
+
resolve7(createIterResult(undefined, true));
|
|
212558
212558
|
}
|
|
212559
212559
|
iterator[kEnded] = true;
|
|
212560
212560
|
});
|
|
@@ -212566,7 +212566,7 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
212566
212566
|
|
|
212567
212567
|
// ../../node_modules/readable-stream/lib/internal/streams/from.js
|
|
212568
212568
|
var require_from = __commonJS((exports, module) => {
|
|
212569
|
-
function asyncGeneratorStep(gen,
|
|
212569
|
+
function asyncGeneratorStep(gen, resolve7, reject, _next, _throw, key2, arg) {
|
|
212570
212570
|
try {
|
|
212571
212571
|
var info = gen[key2](arg);
|
|
212572
212572
|
var value = info.value;
|
|
@@ -212575,7 +212575,7 @@ var require_from = __commonJS((exports, module) => {
|
|
|
212575
212575
|
return;
|
|
212576
212576
|
}
|
|
212577
212577
|
if (info.done) {
|
|
212578
|
-
|
|
212578
|
+
resolve7(value);
|
|
212579
212579
|
} else {
|
|
212580
212580
|
Promise.resolve(value).then(_next, _throw);
|
|
212581
212581
|
}
|
|
@@ -212583,13 +212583,13 @@ var require_from = __commonJS((exports, module) => {
|
|
|
212583
212583
|
function _asyncToGenerator(fn9) {
|
|
212584
212584
|
return function() {
|
|
212585
212585
|
var self2 = this, args = arguments;
|
|
212586
|
-
return new Promise(function(
|
|
212586
|
+
return new Promise(function(resolve7, reject) {
|
|
212587
212587
|
var gen = fn9.apply(self2, args);
|
|
212588
212588
|
function _next(value) {
|
|
212589
|
-
asyncGeneratorStep(gen,
|
|
212589
|
+
asyncGeneratorStep(gen, resolve7, reject, _next, _throw, "next", value);
|
|
212590
212590
|
}
|
|
212591
212591
|
function _throw(err) {
|
|
212592
|
-
asyncGeneratorStep(gen,
|
|
212592
|
+
asyncGeneratorStep(gen, resolve7, reject, _next, _throw, "throw", err);
|
|
212593
212593
|
}
|
|
212594
212594
|
_next(undefined);
|
|
212595
212595
|
});
|
|
@@ -214717,7 +214717,7 @@ var require_dist5 = __commonJS((exports, module) => {
|
|
|
214717
214717
|
});
|
|
214718
214718
|
module.exports = __toCommonJS(src_exports);
|
|
214719
214719
|
var import_promises22 = __require("node:fs/promises");
|
|
214720
|
-
var
|
|
214720
|
+
var import_node_fs23 = __require("node:fs");
|
|
214721
214721
|
var DEVIN_LOCAL_PATH = "/opt/.devin";
|
|
214722
214722
|
var CURSOR2 = "cursor";
|
|
214723
214723
|
var CURSOR_CLI = "cursor-cli";
|
|
@@ -214774,7 +214774,7 @@ var require_dist5 = __commonJS((exports, module) => {
|
|
|
214774
214774
|
return { isAgent: true, agent: { name: REPLIT } };
|
|
214775
214775
|
}
|
|
214776
214776
|
try {
|
|
214777
|
-
await (0, import_promises22.access)(DEVIN_LOCAL_PATH,
|
|
214777
|
+
await (0, import_promises22.access)(DEVIN_LOCAL_PATH, import_node_fs23.constants.F_OK);
|
|
214778
214778
|
return { isAgent: true, agent: { name: DEVIN } };
|
|
214779
214779
|
} catch (error48) {}
|
|
214780
214780
|
return { isAgent: false, agent: undefined };
|
|
@@ -214782,8 +214782,8 @@ var require_dist5 = __commonJS((exports, module) => {
|
|
|
214782
214782
|
});
|
|
214783
214783
|
|
|
214784
214784
|
// src/cli/index.ts
|
|
214785
|
-
import { dirname as
|
|
214786
|
-
import { fileURLToPath as
|
|
214785
|
+
import { dirname as dirname17, join as join22 } from "node:path";
|
|
214786
|
+
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
214787
214787
|
|
|
214788
214788
|
// ../../node_modules/commander/esm.mjs
|
|
214789
214789
|
var import__ = __toESM(require_commander(), 1);
|
|
@@ -214802,7 +214802,7 @@ var {
|
|
|
214802
214802
|
} = import__.default;
|
|
214803
214803
|
|
|
214804
214804
|
// src/cli/commands/agents/pull.ts
|
|
214805
|
-
import { dirname as dirname7, join as
|
|
214805
|
+
import { dirname as dirname7, join as join11 } from "node:path";
|
|
214806
214806
|
|
|
214807
214807
|
// ../../node_modules/@clack/core/dist/index.mjs
|
|
214808
214808
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
@@ -237317,7 +237317,7 @@ var generateGlobTasks = normalizeArguments(generateTasks);
|
|
|
237317
237317
|
var generateGlobTasksSync = normalizeArgumentsSync(generateTasksSync);
|
|
237318
237318
|
|
|
237319
237319
|
// src/core/project/config.ts
|
|
237320
|
-
import { dirname as dirname5, join as
|
|
237320
|
+
import { dirname as dirname5, join as join7 } from "node:path";
|
|
237321
237321
|
|
|
237322
237322
|
// src/core/resources/agent/schema.ts
|
|
237323
237323
|
var EntityOperationSchema = exports_external.enum(["create", "update", "delete", "read"]);
|
|
@@ -238100,7 +238100,7 @@ var FieldRLSSchema = exports_external.looseObject({
|
|
|
238100
238100
|
delete: RLSRuleSchema.optional()
|
|
238101
238101
|
});
|
|
238102
238102
|
var PropertyDefinitionSchema = exports_external.looseObject({
|
|
238103
|
-
type: exports_external.string()
|
|
238103
|
+
type: exports_external.string(),
|
|
238104
238104
|
title: exports_external.string().optional(),
|
|
238105
238105
|
description: exports_external.string().optional(),
|
|
238106
238106
|
minLength: exports_external.number().int().min(0).optional(),
|
|
@@ -238249,11 +238249,24 @@ var BackendFunctionSchema = FunctionConfigSchema.extend({
|
|
|
238249
238249
|
entryPath: exports_external.string().min(1, "Entry path cannot be empty"),
|
|
238250
238250
|
filePaths: exports_external.array(exports_external.string()).min(1, "Function must have at least one file")
|
|
238251
238251
|
});
|
|
238252
|
-
var
|
|
238253
|
-
|
|
238254
|
-
|
|
238255
|
-
|
|
238256
|
-
|
|
238252
|
+
var DeploySingleFunctionResponseSchema = exports_external.object({
|
|
238253
|
+
status: exports_external.enum(["deployed", "unchanged"])
|
|
238254
|
+
});
|
|
238255
|
+
var FunctionInfoSchema = exports_external.object({
|
|
238256
|
+
name: exports_external.string(),
|
|
238257
|
+
deployment_id: exports_external.string(),
|
|
238258
|
+
entry: exports_external.string(),
|
|
238259
|
+
files: exports_external.array(FunctionFileSchema),
|
|
238260
|
+
automations: exports_external.array(AutomationSchema)
|
|
238261
|
+
}).transform((data) => ({
|
|
238262
|
+
name: data.name,
|
|
238263
|
+
deploymentId: data.deployment_id,
|
|
238264
|
+
entry: data.entry,
|
|
238265
|
+
files: data.files,
|
|
238266
|
+
automations: data.automations
|
|
238267
|
+
}));
|
|
238268
|
+
var ListFunctionsResponseSchema = exports_external.object({
|
|
238269
|
+
functions: exports_external.array(FunctionInfoSchema)
|
|
238257
238270
|
});
|
|
238258
238271
|
var LogLevelSchema = exports_external.enum(["info", "warning", "error", "debug"]);
|
|
238259
238272
|
var FunctionLogEntrySchema = exports_external.object({
|
|
@@ -238264,29 +238277,39 @@ var FunctionLogEntrySchema = exports_external.object({
|
|
|
238264
238277
|
var FunctionLogsResponseSchema = exports_external.array(FunctionLogEntrySchema);
|
|
238265
238278
|
|
|
238266
238279
|
// src/core/resources/function/api.ts
|
|
238267
|
-
function
|
|
238268
|
-
return {
|
|
238269
|
-
name: fn.name,
|
|
238270
|
-
entry: fn.entry,
|
|
238271
|
-
files: fn.files,
|
|
238272
|
-
automations: fn.automations
|
|
238273
|
-
};
|
|
238274
|
-
}
|
|
238275
|
-
async function deployFunctions(functions) {
|
|
238280
|
+
async function deploySingleFunction(name2, payload) {
|
|
238276
238281
|
const appClient = getAppClient();
|
|
238277
|
-
const payload = {
|
|
238278
|
-
functions: functions.map(toDeployPayloadItem)
|
|
238279
|
-
};
|
|
238280
238282
|
let response;
|
|
238281
238283
|
try {
|
|
238282
|
-
response = await appClient.put(
|
|
238283
|
-
|
|
238284
|
-
|
|
238284
|
+
response = await appClient.put(`backend-functions/${encodeURIComponent(name2)}`, { json: payload, timeout: false });
|
|
238285
|
+
} catch (error48) {
|
|
238286
|
+
throw await ApiError.fromHttpError(error48, `deploying function "${name2}"`);
|
|
238287
|
+
}
|
|
238288
|
+
const result = DeploySingleFunctionResponseSchema.safeParse(await response.json());
|
|
238289
|
+
if (!result.success) {
|
|
238290
|
+
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
238291
|
+
}
|
|
238292
|
+
return result.data;
|
|
238293
|
+
}
|
|
238294
|
+
async function deleteSingleFunction(name2) {
|
|
238295
|
+
const appClient = getAppClient();
|
|
238296
|
+
try {
|
|
238297
|
+
await appClient.delete(`backend-functions/${encodeURIComponent(name2)}`, {
|
|
238298
|
+
timeout: 60000
|
|
238285
238299
|
});
|
|
238286
238300
|
} catch (error48) {
|
|
238287
|
-
throw await ApiError.fromHttpError(error48,
|
|
238301
|
+
throw await ApiError.fromHttpError(error48, `deleting function "${name2}"`);
|
|
238302
|
+
}
|
|
238303
|
+
}
|
|
238304
|
+
async function listDeployedFunctions() {
|
|
238305
|
+
const appClient = getAppClient();
|
|
238306
|
+
let response;
|
|
238307
|
+
try {
|
|
238308
|
+
response = await appClient.get("backend-functions", { timeout: 30000 });
|
|
238309
|
+
} catch (error48) {
|
|
238310
|
+
throw await ApiError.fromHttpError(error48, "listing deployed functions");
|
|
238288
238311
|
}
|
|
238289
|
-
const result =
|
|
238312
|
+
const result = ListFunctionsResponseSchema.safeParse(await response.json());
|
|
238290
238313
|
if (!result.success) {
|
|
238291
238314
|
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
238292
238315
|
}
|
|
@@ -238409,24 +238432,135 @@ async function readAllFunctions(functionsDir) {
|
|
|
238409
238432
|
import { dirname as dirname4, relative as relative2 } from "node:path";
|
|
238410
238433
|
async function loadFunctionCode(fn) {
|
|
238411
238434
|
const functionDir = dirname4(fn.entryPath);
|
|
238412
|
-
const
|
|
238435
|
+
const resolvedFiles = await Promise.all(fn.filePaths.map(async (filePath) => {
|
|
238413
238436
|
const content = await readTextFile(filePath);
|
|
238414
238437
|
const path11 = relative2(functionDir, filePath).split(/[/\\]/).join("/");
|
|
238415
238438
|
return { path: path11, content };
|
|
238416
238439
|
}));
|
|
238417
|
-
return { ...fn, files:
|
|
238440
|
+
return { ...fn, files: resolvedFiles };
|
|
238418
238441
|
}
|
|
238419
|
-
async function
|
|
238420
|
-
|
|
238421
|
-
|
|
238442
|
+
async function deployOne(fn) {
|
|
238443
|
+
const start = Date.now();
|
|
238444
|
+
try {
|
|
238445
|
+
const functionWithCode = await loadFunctionCode(fn);
|
|
238446
|
+
const response = await deploySingleFunction(functionWithCode.name, {
|
|
238447
|
+
entry: functionWithCode.entry,
|
|
238448
|
+
files: functionWithCode.files,
|
|
238449
|
+
automations: functionWithCode.automations
|
|
238450
|
+
});
|
|
238451
|
+
return {
|
|
238452
|
+
name: functionWithCode.name,
|
|
238453
|
+
status: response.status,
|
|
238454
|
+
durationMs: Date.now() - start
|
|
238455
|
+
};
|
|
238456
|
+
} catch (error48) {
|
|
238457
|
+
return {
|
|
238458
|
+
name: fn.name,
|
|
238459
|
+
status: "error",
|
|
238460
|
+
error: error48 instanceof Error ? error48.message : String(error48)
|
|
238461
|
+
};
|
|
238462
|
+
}
|
|
238463
|
+
}
|
|
238464
|
+
async function deployFunctionsSequentially(functions, options) {
|
|
238465
|
+
if (functions.length === 0)
|
|
238466
|
+
return [];
|
|
238467
|
+
const results = [];
|
|
238468
|
+
for (const fn of functions) {
|
|
238469
|
+
options?.onStart?.([fn.name]);
|
|
238470
|
+
const result = await deployOne(fn);
|
|
238471
|
+
results.push(result);
|
|
238472
|
+
options?.onResult?.(result);
|
|
238473
|
+
}
|
|
238474
|
+
return results;
|
|
238475
|
+
}
|
|
238476
|
+
async function pruneRemovedFunctions(localFunctionNames, options) {
|
|
238477
|
+
const remote = await listDeployedFunctions();
|
|
238478
|
+
const localSet = new Set(localFunctionNames);
|
|
238479
|
+
const toDelete = remote.functions.filter((f) => !localSet.has(f.name));
|
|
238480
|
+
options?.onStart?.(toDelete.length);
|
|
238481
|
+
const results = [];
|
|
238482
|
+
for (const fn of toDelete) {
|
|
238483
|
+
options?.onBeforeDelete?.(fn.name);
|
|
238484
|
+
let result;
|
|
238485
|
+
try {
|
|
238486
|
+
await deleteSingleFunction(fn.name);
|
|
238487
|
+
result = { name: fn.name, deleted: true };
|
|
238488
|
+
} catch (error48) {
|
|
238489
|
+
result = {
|
|
238490
|
+
name: fn.name,
|
|
238491
|
+
deleted: false,
|
|
238492
|
+
error: error48 instanceof Error ? error48.message : String(error48)
|
|
238493
|
+
};
|
|
238494
|
+
}
|
|
238495
|
+
results.push(result);
|
|
238496
|
+
options?.onResult?.(result);
|
|
238497
|
+
}
|
|
238498
|
+
return results;
|
|
238499
|
+
}
|
|
238500
|
+
// src/core/resources/function/pull.ts
|
|
238501
|
+
import { join as join6 } from "node:path";
|
|
238502
|
+
import { isDeepStrictEqual as isDeepStrictEqual3 } from "node:util";
|
|
238503
|
+
async function writeFunctions(functionsDir, functions) {
|
|
238504
|
+
const written = [];
|
|
238505
|
+
const skipped = [];
|
|
238506
|
+
for (const fn of functions) {
|
|
238507
|
+
const functionDir = join6(functionsDir, fn.name);
|
|
238508
|
+
const configPath = join6(functionDir, "function.jsonc");
|
|
238509
|
+
if (await isFunctionUnchanged(functionDir, fn)) {
|
|
238510
|
+
skipped.push(fn.name);
|
|
238511
|
+
continue;
|
|
238512
|
+
}
|
|
238513
|
+
const config5 = {
|
|
238514
|
+
name: fn.name,
|
|
238515
|
+
entry: fn.entry
|
|
238516
|
+
};
|
|
238517
|
+
if (fn.automations.length > 0) {
|
|
238518
|
+
config5.automations = fn.automations;
|
|
238519
|
+
}
|
|
238520
|
+
await writeJsonFile(configPath, config5);
|
|
238521
|
+
for (const file2 of fn.files) {
|
|
238522
|
+
await writeFile(join6(functionDir, file2.path), file2.content);
|
|
238523
|
+
}
|
|
238524
|
+
written.push(fn.name);
|
|
238525
|
+
}
|
|
238526
|
+
return { written, skipped };
|
|
238527
|
+
}
|
|
238528
|
+
async function isFunctionUnchanged(functionDir, fn) {
|
|
238529
|
+
if (!await pathExists(functionDir)) {
|
|
238530
|
+
return false;
|
|
238531
|
+
}
|
|
238532
|
+
const configPath = join6(functionDir, "function.jsonc");
|
|
238533
|
+
try {
|
|
238534
|
+
const localConfig = await readJsonFile(configPath);
|
|
238535
|
+
if (localConfig.entry !== fn.entry) {
|
|
238536
|
+
return false;
|
|
238537
|
+
}
|
|
238538
|
+
if (!isDeepStrictEqual3(localConfig.automations ?? [], fn.automations)) {
|
|
238539
|
+
return false;
|
|
238540
|
+
}
|
|
238541
|
+
} catch {
|
|
238542
|
+
return false;
|
|
238543
|
+
}
|
|
238544
|
+
for (const file2 of fn.files) {
|
|
238545
|
+
const filePath = join6(functionDir, file2.path);
|
|
238546
|
+
if (!await pathExists(filePath)) {
|
|
238547
|
+
return false;
|
|
238548
|
+
}
|
|
238549
|
+
try {
|
|
238550
|
+
const localContent = await readTextFile(filePath);
|
|
238551
|
+
if (localContent !== file2.content) {
|
|
238552
|
+
return false;
|
|
238553
|
+
}
|
|
238554
|
+
} catch {
|
|
238555
|
+
return false;
|
|
238556
|
+
}
|
|
238422
238557
|
}
|
|
238423
|
-
|
|
238424
|
-
return deployFunctions(functionsWithCode);
|
|
238558
|
+
return true;
|
|
238425
238559
|
}
|
|
238426
238560
|
// src/core/resources/function/resource.ts
|
|
238427
238561
|
var functionResource = {
|
|
238428
238562
|
readAll: readAllFunctions,
|
|
238429
|
-
push:
|
|
238563
|
+
push: (functions) => deployFunctionsSequentially(functions)
|
|
238430
238564
|
};
|
|
238431
238565
|
// src/core/project/config.ts
|
|
238432
238566
|
async function findConfigInDir(dir) {
|
|
@@ -238467,10 +238601,10 @@ async function readProjectConfig(projectRoot) {
|
|
|
238467
238601
|
const project = result.data;
|
|
238468
238602
|
const configDir = dirname5(configPath);
|
|
238469
238603
|
const [entities, functions, agents, connectors] = await Promise.all([
|
|
238470
|
-
entityResource.readAll(
|
|
238471
|
-
functionResource.readAll(
|
|
238472
|
-
agentResource.readAll(
|
|
238473
|
-
connectorResource.readAll(
|
|
238604
|
+
entityResource.readAll(join7(configDir, project.entitiesDir)),
|
|
238605
|
+
functionResource.readAll(join7(configDir, project.functionsDir)),
|
|
238606
|
+
agentResource.readAll(join7(configDir, project.agentsDir)),
|
|
238607
|
+
connectorResource.readAll(join7(configDir, project.connectorsDir))
|
|
238474
238608
|
]);
|
|
238475
238609
|
return {
|
|
238476
238610
|
project: { ...project, root, configPath },
|
|
@@ -238567,16 +238701,16 @@ async function readAppConfig(projectRoot) {
|
|
|
238567
238701
|
// src/core/project/template.ts
|
|
238568
238702
|
var import_ejs = __toESM(require_ejs(), 1);
|
|
238569
238703
|
var import_front_matter = __toESM(require_front_matter(), 1);
|
|
238570
|
-
import { dirname as dirname6, join as
|
|
238704
|
+
import { dirname as dirname6, join as join9 } from "node:path";
|
|
238571
238705
|
|
|
238572
238706
|
// src/core/assets.ts
|
|
238573
238707
|
import { cpSync, existsSync } from "node:fs";
|
|
238574
238708
|
import { homedir as homedir2 } from "node:os";
|
|
238575
|
-
import { join as
|
|
238709
|
+
import { join as join8 } from "node:path";
|
|
238576
238710
|
// package.json
|
|
238577
238711
|
var package_default = {
|
|
238578
238712
|
name: "base44",
|
|
238579
|
-
version: "0.0.
|
|
238713
|
+
version: "0.0.45",
|
|
238580
238714
|
description: "Base44 CLI - Unified interface for managing Base44 applications",
|
|
238581
238715
|
type: "module",
|
|
238582
238716
|
bin: {
|
|
@@ -238665,15 +238799,15 @@ var package_default = {
|
|
|
238665
238799
|
};
|
|
238666
238800
|
|
|
238667
238801
|
// src/core/assets.ts
|
|
238668
|
-
var ASSETS_DIR =
|
|
238802
|
+
var ASSETS_DIR = join8(homedir2(), ".base44", "assets", package_default.version);
|
|
238669
238803
|
function getTemplatesDir() {
|
|
238670
|
-
return
|
|
238804
|
+
return join8(ASSETS_DIR, "templates");
|
|
238671
238805
|
}
|
|
238672
238806
|
function getTemplatesIndexPath() {
|
|
238673
|
-
return
|
|
238807
|
+
return join8(ASSETS_DIR, "templates", "templates.json");
|
|
238674
238808
|
}
|
|
238675
238809
|
function getDenoWrapperPath() {
|
|
238676
|
-
return
|
|
238810
|
+
return join8(ASSETS_DIR, "deno-runtime", "main.ts");
|
|
238677
238811
|
}
|
|
238678
238812
|
function ensureNpmAssets(sourceDir) {
|
|
238679
238813
|
if (existsSync(ASSETS_DIR))
|
|
@@ -238694,23 +238828,23 @@ async function listTemplates() {
|
|
|
238694
238828
|
return result.data.templates;
|
|
238695
238829
|
}
|
|
238696
238830
|
async function renderTemplate(template, destPath, data) {
|
|
238697
|
-
const templateDir =
|
|
238831
|
+
const templateDir = join9(getTemplatesDir(), template.path);
|
|
238698
238832
|
const files = await globby("**/*", {
|
|
238699
238833
|
cwd: templateDir,
|
|
238700
238834
|
dot: true,
|
|
238701
238835
|
onlyFiles: true
|
|
238702
238836
|
});
|
|
238703
238837
|
for (const file2 of files) {
|
|
238704
|
-
const srcPath =
|
|
238838
|
+
const srcPath = join9(templateDir, file2);
|
|
238705
238839
|
try {
|
|
238706
238840
|
if (file2.endsWith(".ejs")) {
|
|
238707
238841
|
const rendered = await import_ejs.default.renderFile(srcPath, data);
|
|
238708
238842
|
const { attributes, body } = import_front_matter.default(rendered);
|
|
238709
|
-
const destFile = attributes.outputFileName ?
|
|
238710
|
-
const destFilePath =
|
|
238843
|
+
const destFile = attributes.outputFileName ? join9(dirname6(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
|
|
238844
|
+
const destFilePath = join9(destPath, destFile);
|
|
238711
238845
|
await writeFile(destFilePath, body);
|
|
238712
238846
|
} else {
|
|
238713
|
-
const destFilePath =
|
|
238847
|
+
const destFilePath = join9(destPath, file2);
|
|
238714
238848
|
await copyFile(srcPath, destFilePath);
|
|
238715
238849
|
}
|
|
238716
238850
|
} catch (error48) {
|
|
@@ -238809,7 +238943,7 @@ async function getSiteFilePaths(outputDir) {
|
|
|
238809
238943
|
// src/core/site/deploy.ts
|
|
238810
238944
|
import { randomUUID } from "node:crypto";
|
|
238811
238945
|
import { tmpdir } from "node:os";
|
|
238812
|
-
import { join as
|
|
238946
|
+
import { join as join10 } from "node:path";
|
|
238813
238947
|
async function deploySite(siteOutputDir) {
|
|
238814
238948
|
if (!await pathExists(siteOutputDir)) {
|
|
238815
238949
|
throw new InvalidInputError(`Output directory does not exist: ${siteOutputDir}. Make sure to build your project first.`, {
|
|
@@ -238826,7 +238960,7 @@ async function deploySite(siteOutputDir) {
|
|
|
238826
238960
|
]
|
|
238827
238961
|
});
|
|
238828
238962
|
}
|
|
238829
|
-
const archivePath =
|
|
238963
|
+
const archivePath = join10(tmpdir(), `base44-site-${randomUUID()}.tar.gz`);
|
|
238830
238964
|
try {
|
|
238831
238965
|
await createArchive(siteOutputDir, archivePath);
|
|
238832
238966
|
return await uploadSite(archivePath);
|
|
@@ -238851,10 +238985,13 @@ function hasResourcesToDeploy(projectData) {
|
|
|
238851
238985
|
const hasConnectors = connectors.length > 0;
|
|
238852
238986
|
return hasEntities || hasFunctions || hasAgents || hasConnectors || hasSite;
|
|
238853
238987
|
}
|
|
238854
|
-
async function deployAll(projectData) {
|
|
238988
|
+
async function deployAll(projectData, options) {
|
|
238855
238989
|
const { project, entities, functions, agents, connectors } = projectData;
|
|
238856
238990
|
await entityResource.push(entities);
|
|
238857
|
-
await
|
|
238991
|
+
await deployFunctionsSequentially(functions, {
|
|
238992
|
+
onStart: options?.onFunctionStart,
|
|
238993
|
+
onResult: options?.onFunctionResult
|
|
238994
|
+
});
|
|
238858
238995
|
await agentResource.push(agents);
|
|
238859
238996
|
const { results: connectorResults } = await pushConnectors(connectors);
|
|
238860
238997
|
if (project.site?.outputDirectory) {
|
|
@@ -246611,7 +246748,7 @@ function formatYaml(data, options = {}) {
|
|
|
246611
246748
|
async function pullAgentsAction() {
|
|
246612
246749
|
const { project: project2 } = await readProjectConfig();
|
|
246613
246750
|
const configDir = dirname7(project2.configPath);
|
|
246614
|
-
const agentsDir =
|
|
246751
|
+
const agentsDir = join11(configDir, project2.agentsDir);
|
|
246615
246752
|
const remoteAgents = await runTask("Fetching agents from Base44", async () => {
|
|
246616
246753
|
return await fetchAgents();
|
|
246617
246754
|
}, {
|
|
@@ -246733,11 +246870,11 @@ function getConnectorsListAvailableCommand(context) {
|
|
|
246733
246870
|
}
|
|
246734
246871
|
|
|
246735
246872
|
// src/cli/commands/connectors/pull.ts
|
|
246736
|
-
import { dirname as dirname8, join as
|
|
246873
|
+
import { dirname as dirname8, join as join12 } from "node:path";
|
|
246737
246874
|
async function pullConnectorsAction() {
|
|
246738
246875
|
const { project: project2 } = await readProjectConfig();
|
|
246739
246876
|
const configDir = dirname8(project2.configPath);
|
|
246740
|
-
const connectorsDir =
|
|
246877
|
+
const connectorsDir = join12(configDir, project2.connectorsDir);
|
|
246741
246878
|
const remoteConnectors = await runTask("Fetching connectors from Base44", async () => {
|
|
246742
246879
|
return await pullAllConnectors();
|
|
246743
246880
|
}, {
|
|
@@ -247606,46 +247743,242 @@ function getEntitiesPushCommand(context) {
|
|
|
247606
247743
|
}));
|
|
247607
247744
|
}
|
|
247608
247745
|
|
|
247746
|
+
// src/cli/commands/functions/delete.ts
|
|
247747
|
+
async function deleteFunctionsAction(names) {
|
|
247748
|
+
let deleted = 0;
|
|
247749
|
+
let notFound = 0;
|
|
247750
|
+
let errors5 = 0;
|
|
247751
|
+
for (const name2 of names) {
|
|
247752
|
+
try {
|
|
247753
|
+
await runTask(`Deleting ${name2}...`, () => deleteSingleFunction(name2), {
|
|
247754
|
+
successMessage: `${name2} deleted`,
|
|
247755
|
+
errorMessage: `Failed to delete ${name2}`
|
|
247756
|
+
});
|
|
247757
|
+
deleted++;
|
|
247758
|
+
} catch (error48) {
|
|
247759
|
+
if (error48 instanceof ApiError && error48.statusCode === 404) {
|
|
247760
|
+
notFound++;
|
|
247761
|
+
} else {
|
|
247762
|
+
errors5++;
|
|
247763
|
+
}
|
|
247764
|
+
}
|
|
247765
|
+
}
|
|
247766
|
+
if (names.length === 1) {
|
|
247767
|
+
if (deleted)
|
|
247768
|
+
return { outroMessage: `Function "${names[0]}" deleted` };
|
|
247769
|
+
if (notFound)
|
|
247770
|
+
return { outroMessage: `Function "${names[0]}" not found` };
|
|
247771
|
+
return { outroMessage: `Failed to delete "${names[0]}"` };
|
|
247772
|
+
}
|
|
247773
|
+
const total = names.length;
|
|
247774
|
+
const parts = [];
|
|
247775
|
+
if (deleted > 0)
|
|
247776
|
+
parts.push(`${deleted}/${total} deleted`);
|
|
247777
|
+
if (notFound > 0)
|
|
247778
|
+
parts.push(`${notFound} not found`);
|
|
247779
|
+
if (errors5 > 0)
|
|
247780
|
+
parts.push(`${errors5} error${errors5 !== 1 ? "s" : ""}`);
|
|
247781
|
+
return { outroMessage: parts.join(", ") };
|
|
247782
|
+
}
|
|
247783
|
+
function parseNames(args) {
|
|
247784
|
+
return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
|
|
247785
|
+
}
|
|
247786
|
+
function validateNames(command) {
|
|
247787
|
+
const names = parseNames(command.args);
|
|
247788
|
+
if (names.length === 0) {
|
|
247789
|
+
command.error("At least one function name is required");
|
|
247790
|
+
}
|
|
247791
|
+
}
|
|
247792
|
+
function getDeleteCommand(context) {
|
|
247793
|
+
return new Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").hook("preAction", validateNames).action(async (rawNames) => {
|
|
247794
|
+
const names = parseNames(rawNames);
|
|
247795
|
+
await runCommand(() => deleteFunctionsAction(names), { requireAuth: true }, context);
|
|
247796
|
+
});
|
|
247797
|
+
}
|
|
247798
|
+
|
|
247799
|
+
// src/cli/commands/functions/formatDeployResult.ts
|
|
247800
|
+
function formatDuration(ms) {
|
|
247801
|
+
return `${(ms / 1000).toFixed(1)}s`;
|
|
247802
|
+
}
|
|
247803
|
+
function formatDeployResult(result) {
|
|
247804
|
+
const label = result.name.padEnd(25);
|
|
247805
|
+
if (result.status === "deployed") {
|
|
247806
|
+
const timing = result.durationMs ? theme.styles.dim(` (${formatDuration(result.durationMs)})`) : "";
|
|
247807
|
+
R2.success(`${label} deployed${timing}`);
|
|
247808
|
+
} else if (result.status === "unchanged") {
|
|
247809
|
+
R2.success(`${label} unchanged`);
|
|
247810
|
+
} else {
|
|
247811
|
+
R2.error(`${label} error: ${result.error}`);
|
|
247812
|
+
}
|
|
247813
|
+
}
|
|
247814
|
+
|
|
247815
|
+
// src/cli/commands/functions/parseNames.ts
|
|
247816
|
+
function parseNames2(args) {
|
|
247817
|
+
return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
|
|
247818
|
+
}
|
|
247819
|
+
|
|
247609
247820
|
// src/cli/commands/functions/deploy.ts
|
|
247610
|
-
|
|
247821
|
+
function resolveFunctionsToDeploy(names, allFunctions) {
|
|
247822
|
+
if (names.length === 0)
|
|
247823
|
+
return allFunctions;
|
|
247824
|
+
const notFound = names.filter((n2) => !allFunctions.some((f) => f.name === n2));
|
|
247825
|
+
if (notFound.length > 0) {
|
|
247826
|
+
throw new InvalidInputError(`Function${notFound.length > 1 ? "s" : ""} not found in project: ${notFound.join(", ")}`);
|
|
247827
|
+
}
|
|
247828
|
+
return allFunctions.filter((f) => names.includes(f.name));
|
|
247829
|
+
}
|
|
247830
|
+
function formatPruneResult(pruneResult) {
|
|
247831
|
+
if (pruneResult.deleted) {
|
|
247832
|
+
R2.success(`${pruneResult.name.padEnd(25)} deleted`);
|
|
247833
|
+
} else {
|
|
247834
|
+
R2.error(`${pruneResult.name.padEnd(25)} error: ${pruneResult.error}`);
|
|
247835
|
+
}
|
|
247836
|
+
}
|
|
247837
|
+
function formatPruneSummary(pruneResults) {
|
|
247838
|
+
if (pruneResults.length > 0) {
|
|
247839
|
+
const pruned = pruneResults.filter((r) => r.deleted).length;
|
|
247840
|
+
R2.info(`${pruned} deleted`);
|
|
247841
|
+
}
|
|
247842
|
+
}
|
|
247843
|
+
function buildDeploySummary(results) {
|
|
247844
|
+
const deployed = results.filter((r) => r.status === "deployed").length;
|
|
247845
|
+
const unchanged = results.filter((r) => r.status === "unchanged").length;
|
|
247846
|
+
const failed = results.filter((r) => r.status === "error").length;
|
|
247847
|
+
const parts = [];
|
|
247848
|
+
if (deployed > 0)
|
|
247849
|
+
parts.push(`${deployed} deployed`);
|
|
247850
|
+
if (unchanged > 0)
|
|
247851
|
+
parts.push(`${unchanged} unchanged`);
|
|
247852
|
+
if (failed > 0)
|
|
247853
|
+
parts.push(`${failed} error${failed !== 1 ? "s" : ""}`);
|
|
247854
|
+
return parts.join(", ") || "No functions deployed";
|
|
247855
|
+
}
|
|
247856
|
+
async function deployFunctionsAction(names, options) {
|
|
247857
|
+
if (options.force && names.length > 0) {
|
|
247858
|
+
throw new InvalidInputError("--force cannot be used when specifying function names");
|
|
247859
|
+
}
|
|
247611
247860
|
const { functions } = await readProjectConfig();
|
|
247612
|
-
|
|
247861
|
+
const toDeploy = resolveFunctionsToDeploy(names, functions);
|
|
247862
|
+
if (toDeploy.length === 0) {
|
|
247613
247863
|
return {
|
|
247614
247864
|
outroMessage: "No functions found. Create functions in the 'functions' directory."
|
|
247615
247865
|
};
|
|
247616
247866
|
}
|
|
247617
|
-
R2.info(`Found ${
|
|
247618
|
-
|
|
247619
|
-
|
|
247867
|
+
R2.info(`Found ${toDeploy.length} ${toDeploy.length === 1 ? "function" : "functions"} to deploy`);
|
|
247868
|
+
let completed = 0;
|
|
247869
|
+
const total = toDeploy.length;
|
|
247870
|
+
const results = await deployFunctionsSequentially(toDeploy, {
|
|
247871
|
+
onStart: (startNames) => {
|
|
247872
|
+
const label = startNames.length === 1 ? startNames[0] : `${startNames.length} functions`;
|
|
247873
|
+
R2.step(theme.styles.dim(`[${completed + 1}/${total}] Deploying ${label}...`));
|
|
247874
|
+
},
|
|
247875
|
+
onResult: (result) => {
|
|
247876
|
+
completed++;
|
|
247877
|
+
formatDeployResult(result);
|
|
247878
|
+
}
|
|
247879
|
+
});
|
|
247880
|
+
if (options.force) {
|
|
247881
|
+
const allLocalNames = functions.map((f) => f.name);
|
|
247882
|
+
let pruneCompleted = 0;
|
|
247883
|
+
let pruneTotal = 0;
|
|
247884
|
+
const pruneResults = await pruneRemovedFunctions(allLocalNames, {
|
|
247885
|
+
onStart: (total2) => {
|
|
247886
|
+
pruneTotal = total2;
|
|
247887
|
+
if (total2 > 0) {
|
|
247888
|
+
R2.info(`Found ${total2} remote ${total2 === 1 ? "function" : "functions"} to delete`);
|
|
247889
|
+
}
|
|
247890
|
+
},
|
|
247891
|
+
onBeforeDelete: (name2) => {
|
|
247892
|
+
pruneCompleted++;
|
|
247893
|
+
R2.step(theme.styles.dim(`[${pruneCompleted}/${pruneTotal}] Deleting ${name2}...`));
|
|
247894
|
+
},
|
|
247895
|
+
onResult: formatPruneResult
|
|
247896
|
+
});
|
|
247897
|
+
formatPruneSummary(pruneResults);
|
|
247898
|
+
}
|
|
247899
|
+
return { outroMessage: buildDeploySummary(results) };
|
|
247900
|
+
}
|
|
247901
|
+
function getDeployCommand(context) {
|
|
247902
|
+
return new Command("deploy").description("Deploy functions to Base44").argument("[names...]", "Function names to deploy (deploys all if omitted)").option("--force", "Delete remote functions not found locally").action(async (rawNames, options) => {
|
|
247903
|
+
await runCommand(() => {
|
|
247904
|
+
const names = parseNames2(rawNames);
|
|
247905
|
+
return deployFunctionsAction(names, options);
|
|
247906
|
+
}, { requireAuth: true }, context);
|
|
247907
|
+
});
|
|
247908
|
+
}
|
|
247909
|
+
|
|
247910
|
+
// src/cli/commands/functions/list.ts
|
|
247911
|
+
async function listFunctionsAction() {
|
|
247912
|
+
const { functions } = await runTask("Fetching functions...", async () => listDeployedFunctions(), { errorMessage: "Failed to fetch functions" });
|
|
247913
|
+
if (functions.length === 0) {
|
|
247914
|
+
return { outroMessage: "No functions on remote" };
|
|
247915
|
+
}
|
|
247916
|
+
for (const fn of functions) {
|
|
247917
|
+
const automationCount = fn.automations.length;
|
|
247918
|
+
const automationLabel = automationCount > 0 ? theme.styles.dim(` (${automationCount} automation${automationCount > 1 ? "s" : ""})`) : "";
|
|
247919
|
+
R2.message(` ${fn.name}${automationLabel}`);
|
|
247920
|
+
}
|
|
247921
|
+
return {
|
|
247922
|
+
outroMessage: `${functions.length} function${functions.length !== 1 ? "s" : ""} on remote`
|
|
247923
|
+
};
|
|
247924
|
+
}
|
|
247925
|
+
function getListCommand(context) {
|
|
247926
|
+
return new Command("list").description("List all deployed functions").action(async () => {
|
|
247927
|
+
await runCommand(listFunctionsAction, { requireAuth: true }, context);
|
|
247928
|
+
});
|
|
247929
|
+
}
|
|
247930
|
+
|
|
247931
|
+
// src/cli/commands/functions/pull.ts
|
|
247932
|
+
import { dirname as dirname9, join as join13 } from "node:path";
|
|
247933
|
+
async function pullFunctionsAction(name2) {
|
|
247934
|
+
const { project: project2 } = await readProjectConfig();
|
|
247935
|
+
const configDir = dirname9(project2.configPath);
|
|
247936
|
+
const functionsDir = join13(configDir, project2.functionsDir);
|
|
247937
|
+
const remoteFunctions = await runTask("Fetching functions from Base44", async () => {
|
|
247938
|
+
const { functions } = await listDeployedFunctions();
|
|
247939
|
+
return functions;
|
|
247620
247940
|
}, {
|
|
247621
|
-
successMessage: "Functions
|
|
247622
|
-
errorMessage: "Failed to
|
|
247941
|
+
successMessage: "Functions fetched successfully",
|
|
247942
|
+
errorMessage: "Failed to fetch functions"
|
|
247623
247943
|
});
|
|
247624
|
-
|
|
247625
|
-
|
|
247944
|
+
const toPull = name2 ? remoteFunctions.filter((f) => f.name === name2) : remoteFunctions;
|
|
247945
|
+
if (name2 && toPull.length === 0) {
|
|
247946
|
+
return {
|
|
247947
|
+
outroMessage: `Function "${name2}" not found on remote`
|
|
247948
|
+
};
|
|
247626
247949
|
}
|
|
247627
|
-
if (
|
|
247628
|
-
|
|
247950
|
+
if (toPull.length === 0) {
|
|
247951
|
+
return { outroMessage: "No functions found on remote" };
|
|
247629
247952
|
}
|
|
247630
|
-
|
|
247631
|
-
|
|
247632
|
-
|
|
247633
|
-
|
|
247634
|
-
|
|
247635
|
-
|
|
247636
|
-
|
|
247637
|
-
});
|
|
247953
|
+
const { written, skipped } = await runTask("Writing function files", async () => {
|
|
247954
|
+
return await writeFunctions(functionsDir, toPull);
|
|
247955
|
+
}, {
|
|
247956
|
+
successMessage: "Function files written successfully",
|
|
247957
|
+
errorMessage: "Failed to write function files"
|
|
247958
|
+
});
|
|
247959
|
+
for (const name3 of written) {
|
|
247960
|
+
R2.success(`${name3.padEnd(25)} written`);
|
|
247961
|
+
}
|
|
247962
|
+
for (const name3 of skipped) {
|
|
247963
|
+
R2.info(`${name3.padEnd(25)} unchanged`);
|
|
247638
247964
|
}
|
|
247639
|
-
return {
|
|
247965
|
+
return {
|
|
247966
|
+
outroMessage: `Pulled ${toPull.length} function${toPull.length !== 1 ? "s" : ""} to ${functionsDir}`
|
|
247967
|
+
};
|
|
247640
247968
|
}
|
|
247641
|
-
function
|
|
247642
|
-
return new Command("
|
|
247643
|
-
await runCommand(
|
|
247644
|
-
})
|
|
247969
|
+
function getPullCommand(context) {
|
|
247970
|
+
return new Command("pull").description("Pull deployed functions from Base44").argument("[name]", "Function name to pull (pulls all if omitted)").action(async (name2) => {
|
|
247971
|
+
await runCommand(() => pullFunctionsAction(name2), { requireAuth: true }, context);
|
|
247972
|
+
});
|
|
247973
|
+
}
|
|
247974
|
+
|
|
247975
|
+
// src/cli/commands/functions/index.ts
|
|
247976
|
+
function getFunctionsCommand(context) {
|
|
247977
|
+
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getDeleteCommand(context)).addCommand(getListCommand(context)).addCommand(getPullCommand(context));
|
|
247645
247978
|
}
|
|
247646
247979
|
|
|
247647
247980
|
// src/cli/commands/project/create.ts
|
|
247648
|
-
import { basename as basename3, join as
|
|
247981
|
+
import { basename as basename3, join as join14, resolve as resolve2 } from "node:path";
|
|
247649
247982
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
247650
247983
|
var DEFAULT_TEMPLATE_ID = "backend-only";
|
|
247651
247984
|
async function getTemplateById(templateId) {
|
|
@@ -247782,7 +248115,7 @@ async function executeCreate({
|
|
|
247782
248115
|
updateMessage("Building project...");
|
|
247783
248116
|
await execa({ cwd: resolvedPath, shell: true })`${buildCommand}`;
|
|
247784
248117
|
updateMessage("Deploying site...");
|
|
247785
|
-
return await deploySite(
|
|
248118
|
+
return await deploySite(join14(resolvedPath, outputDirectory));
|
|
247786
248119
|
}, {
|
|
247787
248120
|
successMessage: theme.colors.base44Orange("Site deployed successfully"),
|
|
247788
248121
|
errorMessage: "Failed to deploy site"
|
|
@@ -247869,11 +248202,17 @@ ${summaryLines.join(`
|
|
|
247869
248202
|
${summaryLines.join(`
|
|
247870
248203
|
`)}`);
|
|
247871
248204
|
}
|
|
247872
|
-
|
|
247873
|
-
|
|
247874
|
-
|
|
247875
|
-
|
|
247876
|
-
|
|
248205
|
+
let functionCompleted = 0;
|
|
248206
|
+
const functionTotal = functions.length;
|
|
248207
|
+
const result = await deployAll(projectData, {
|
|
248208
|
+
onFunctionStart: (names) => {
|
|
248209
|
+
const label = names.length === 1 ? names[0] : `${names.length} functions`;
|
|
248210
|
+
R2.step(theme.styles.dim(`[${functionCompleted + 1}/${functionTotal}] Deploying ${label}...`));
|
|
248211
|
+
},
|
|
248212
|
+
onFunctionResult: (r) => {
|
|
248213
|
+
functionCompleted++;
|
|
248214
|
+
formatDeployResult(r);
|
|
248215
|
+
}
|
|
247877
248216
|
});
|
|
247878
248217
|
const connectorResults = result.connectorResults ?? [];
|
|
247879
248218
|
await handleOAuthConnectors(connectorResults, options);
|
|
@@ -247887,7 +248226,7 @@ ${summaryLines.join(`
|
|
|
247887
248226
|
}
|
|
247888
248227
|
return { outroMessage: "App deployed successfully" };
|
|
247889
248228
|
}
|
|
247890
|
-
function
|
|
248229
|
+
function getDeployCommand2(context) {
|
|
247891
248230
|
return new Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").action(async (options) => {
|
|
247892
248231
|
await runCommand(() => deployAction({
|
|
247893
248232
|
...options,
|
|
@@ -248432,10 +248771,10 @@ function toPascalCase(name2) {
|
|
|
248432
248771
|
return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
|
|
248433
248772
|
}
|
|
248434
248773
|
// src/core/types/update-project.ts
|
|
248435
|
-
import { join as
|
|
248774
|
+
import { join as join17 } from "node:path";
|
|
248436
248775
|
var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
|
|
248437
248776
|
async function updateProjectConfig(projectRoot) {
|
|
248438
|
-
const tsconfigPath =
|
|
248777
|
+
const tsconfigPath = join17(projectRoot, "tsconfig.json");
|
|
248439
248778
|
if (!await pathExists(tsconfigPath)) {
|
|
248440
248779
|
return false;
|
|
248441
248780
|
}
|
|
@@ -248478,7 +248817,7 @@ function getTypesCommand(context) {
|
|
|
248478
248817
|
}
|
|
248479
248818
|
|
|
248480
248819
|
// src/cli/dev/dev-server/main.ts
|
|
248481
|
-
import { dirname as
|
|
248820
|
+
import { dirname as dirname14, join as join20 } from "node:path";
|
|
248482
248821
|
var import_cors = __toESM(require_lib4(), 1);
|
|
248483
248822
|
var import_express4 = __toESM(require_express(), 1);
|
|
248484
248823
|
|
|
@@ -248604,6 +248943,7 @@ var { promisify: promisify11 } = __require("util");
|
|
|
248604
248943
|
var tmp = require_tmp();
|
|
248605
248944
|
var $fileSync = tmp.fileSync;
|
|
248606
248945
|
var fileWithOptions = promisify11((options8, cb2) => tmp.file(options8, (err, path18, fd, cleanup) => err ? cb2(err) : cb2(undefined, { path: path18, fd, cleanup: promisify11(cleanup) })));
|
|
248946
|
+
var $file = async (options8) => fileWithOptions(options8);
|
|
248607
248947
|
var $dirSync = tmp.dirSync;
|
|
248608
248948
|
var dirWithOptions = promisify11((options8, cb2) => tmp.dir(options8, (err, path18, cleanup) => err ? cb2(err) : cb2(undefined, { path: path18, cleanup: promisify11(cleanup) })));
|
|
248609
248949
|
var $dir = async (options8) => dirWithOptions(options8);
|
|
@@ -248636,7 +248976,85 @@ function createDevLogger() {
|
|
|
248636
248976
|
}
|
|
248637
248977
|
|
|
248638
248978
|
// src/cli/dev/dev-server/function-manager.ts
|
|
248979
|
+
import { spawn as spawn3 } from "node:child_process";
|
|
248980
|
+
|
|
248981
|
+
// src/core/exec/run-script.ts
|
|
248639
248982
|
import { spawn as spawn2, spawnSync as spawnSync2 } from "node:child_process";
|
|
248983
|
+
import { copyFileSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
248984
|
+
import { resolve as resolve6 } from "node:path";
|
|
248985
|
+
function verifyDenoInstalled() {
|
|
248986
|
+
const result = spawnSync2("deno", ["--version"]);
|
|
248987
|
+
if (result.error) {
|
|
248988
|
+
throw new DependencyNotFoundError("Deno is required to run scripts with exec", {
|
|
248989
|
+
hints: [
|
|
248990
|
+
{
|
|
248991
|
+
message: "Install Deno: https://docs.deno.com/runtime/getting_started/installation/"
|
|
248992
|
+
}
|
|
248993
|
+
]
|
|
248994
|
+
});
|
|
248995
|
+
}
|
|
248996
|
+
}
|
|
248997
|
+
async function getUserAppToken() {
|
|
248998
|
+
try {
|
|
248999
|
+
const response = await getAppClient().get("auth/token").json();
|
|
249000
|
+
return response.token;
|
|
249001
|
+
} catch (error48) {
|
|
249002
|
+
throw await ApiError.fromHttpError(error48, "exchanging platform token for app user token");
|
|
249003
|
+
}
|
|
249004
|
+
}
|
|
249005
|
+
async function runScript(options8) {
|
|
249006
|
+
const { filePath, code: code2, extraArgs = [], execWrapperPath } = options8;
|
|
249007
|
+
verifyDenoInstalled();
|
|
249008
|
+
const cleanupFns = [];
|
|
249009
|
+
let scriptPath;
|
|
249010
|
+
if (filePath) {
|
|
249011
|
+
scriptPath = `file://${resolve6(filePath)}`;
|
|
249012
|
+
} else if (code2 !== undefined) {
|
|
249013
|
+
const tempScript = await $file({ postfix: ".ts" });
|
|
249014
|
+
cleanupFns.push(tempScript.cleanup);
|
|
249015
|
+
writeFileSync2(tempScript.path, code2, "utf-8");
|
|
249016
|
+
scriptPath = `file://${tempScript.path}`;
|
|
249017
|
+
} else {
|
|
249018
|
+
throw new Error("Either filePath or code must be provided");
|
|
249019
|
+
}
|
|
249020
|
+
const appConfig = getAppConfig();
|
|
249021
|
+
const [appUserToken, appBaseUrl] = await Promise.all([
|
|
249022
|
+
getUserAppToken(),
|
|
249023
|
+
getSiteUrl()
|
|
249024
|
+
]);
|
|
249025
|
+
const tempWrapper = await $file({ postfix: ".ts" });
|
|
249026
|
+
cleanupFns.push(tempWrapper.cleanup);
|
|
249027
|
+
copyFileSync(execWrapperPath, tempWrapper.path);
|
|
249028
|
+
try {
|
|
249029
|
+
const exitCode = await new Promise((resolvePromise) => {
|
|
249030
|
+
const child = spawn2("deno", [
|
|
249031
|
+
"run",
|
|
249032
|
+
"--allow-all",
|
|
249033
|
+
"--node-modules-dir=auto",
|
|
249034
|
+
tempWrapper.path,
|
|
249035
|
+
...extraArgs
|
|
249036
|
+
], {
|
|
249037
|
+
env: {
|
|
249038
|
+
...process.env,
|
|
249039
|
+
SCRIPT_PATH: scriptPath,
|
|
249040
|
+
BASE44_APP_ID: appConfig.id,
|
|
249041
|
+
BASE44_ACCESS_TOKEN: appUserToken,
|
|
249042
|
+
BASE44_APP_BASE_URL: appBaseUrl
|
|
249043
|
+
},
|
|
249044
|
+
stdio: "inherit"
|
|
249045
|
+
});
|
|
249046
|
+
child.on("close", (code3) => {
|
|
249047
|
+
resolvePromise(code3 ?? 1);
|
|
249048
|
+
});
|
|
249049
|
+
});
|
|
249050
|
+
return { exitCode };
|
|
249051
|
+
} finally {
|
|
249052
|
+
for (const cleanup of cleanupFns) {
|
|
249053
|
+
cleanup();
|
|
249054
|
+
}
|
|
249055
|
+
}
|
|
249056
|
+
}
|
|
249057
|
+
// src/cli/dev/dev-server/function-manager.ts
|
|
248640
249058
|
var READY_TIMEOUT = 30000;
|
|
248641
249059
|
|
|
248642
249060
|
class FunctionManager {
|
|
@@ -248650,15 +249068,7 @@ class FunctionManager {
|
|
|
248650
249068
|
this.logger = logger;
|
|
248651
249069
|
this.wrapperPath = wrapperPath;
|
|
248652
249070
|
if (functions.length > 0) {
|
|
248653
|
-
|
|
248654
|
-
}
|
|
248655
|
-
}
|
|
248656
|
-
verifyDenoIsInstalled() {
|
|
248657
|
-
const result = spawnSync2("deno", ["--version"]);
|
|
248658
|
-
if (result.error) {
|
|
248659
|
-
throw new DependencyNotFoundError("Deno is required to run functions", {
|
|
248660
|
-
hints: [{ message: "Install Deno from https://deno.com/download" }]
|
|
248661
|
-
});
|
|
249071
|
+
verifyDenoInstalled();
|
|
248662
249072
|
}
|
|
248663
249073
|
}
|
|
248664
249074
|
getFunctionNames() {
|
|
@@ -248721,7 +249131,7 @@ class FunctionManager {
|
|
|
248721
249131
|
}
|
|
248722
249132
|
spawnFunction(func, port) {
|
|
248723
249133
|
this.logger.log(`Spawning function "${func.name}" on port ${port}`);
|
|
248724
|
-
const process21 =
|
|
249134
|
+
const process21 = spawn3("deno", ["run", "--allow-all", this.wrapperPath], {
|
|
248725
249135
|
env: {
|
|
248726
249136
|
...globalThis.process.env,
|
|
248727
249137
|
FUNCTION_PATH: func.entryPath,
|
|
@@ -248759,7 +249169,7 @@ class FunctionManager {
|
|
|
248759
249169
|
});
|
|
248760
249170
|
}
|
|
248761
249171
|
waitForReady(name2, runningFunc) {
|
|
248762
|
-
return new Promise((
|
|
249172
|
+
return new Promise((resolve7, reject) => {
|
|
248763
249173
|
runningFunc.process.on("exit", (code2) => {
|
|
248764
249174
|
if (!runningFunc.ready) {
|
|
248765
249175
|
clearTimeout(timeout3);
|
|
@@ -248782,7 +249192,7 @@ class FunctionManager {
|
|
|
248782
249192
|
runningFunc.ready = true;
|
|
248783
249193
|
clearTimeout(timeout3);
|
|
248784
249194
|
runningFunc.process.stdout?.off("data", onData);
|
|
248785
|
-
|
|
249195
|
+
resolve7(runningFunc.port);
|
|
248786
249196
|
}
|
|
248787
249197
|
};
|
|
248788
249198
|
runningFunc.process.stdout?.on("data", onData);
|
|
@@ -248835,14 +249245,163 @@ function createFunctionRouter(manager, logger) {
|
|
|
248835
249245
|
return router;
|
|
248836
249246
|
}
|
|
248837
249247
|
|
|
248838
|
-
// src/cli/dev/dev-server/database.ts
|
|
249248
|
+
// src/cli/dev/dev-server/db/database.ts
|
|
248839
249249
|
var import_nedb = __toESM(require_nedb(), 1);
|
|
248840
249250
|
|
|
249251
|
+
// src/cli/dev/dev-server/db/validator.ts
|
|
249252
|
+
var fieldTypes = [
|
|
249253
|
+
"string",
|
|
249254
|
+
"integer",
|
|
249255
|
+
"number",
|
|
249256
|
+
"boolean",
|
|
249257
|
+
"array",
|
|
249258
|
+
"object"
|
|
249259
|
+
];
|
|
249260
|
+
|
|
249261
|
+
class Validator {
|
|
249262
|
+
filterFields(record2, entitySchema) {
|
|
249263
|
+
const filteredRecord = {};
|
|
249264
|
+
for (const [key2, value] of Object.entries(record2)) {
|
|
249265
|
+
if (entitySchema.properties[key2]) {
|
|
249266
|
+
filteredRecord[key2] = value;
|
|
249267
|
+
}
|
|
249268
|
+
}
|
|
249269
|
+
return filteredRecord;
|
|
249270
|
+
}
|
|
249271
|
+
applyDefaults(record2, entitySchema) {
|
|
249272
|
+
const result = {};
|
|
249273
|
+
for (const [key2, property] of Object.entries(entitySchema.properties)) {
|
|
249274
|
+
if (property.default !== undefined) {
|
|
249275
|
+
result[key2] = property.default;
|
|
249276
|
+
}
|
|
249277
|
+
}
|
|
249278
|
+
return {
|
|
249279
|
+
...result,
|
|
249280
|
+
...record2
|
|
249281
|
+
};
|
|
249282
|
+
}
|
|
249283
|
+
validate(record2, entitySchema, partial2 = false) {
|
|
249284
|
+
if (!partial2) {
|
|
249285
|
+
const requiredFieldsResponse = this.validateRequiredFields(record2, entitySchema);
|
|
249286
|
+
if (requiredFieldsResponse.hasError) {
|
|
249287
|
+
return requiredFieldsResponse;
|
|
249288
|
+
}
|
|
249289
|
+
}
|
|
249290
|
+
const fieldTypesResponse = this.validateFieldTypes(record2, entitySchema);
|
|
249291
|
+
if (fieldTypesResponse.hasError) {
|
|
249292
|
+
return fieldTypesResponse;
|
|
249293
|
+
}
|
|
249294
|
+
return {
|
|
249295
|
+
hasError: false
|
|
249296
|
+
};
|
|
249297
|
+
}
|
|
249298
|
+
createValidationError(message) {
|
|
249299
|
+
return {
|
|
249300
|
+
error_type: "ValidationError",
|
|
249301
|
+
message,
|
|
249302
|
+
request_id: null,
|
|
249303
|
+
traceback: ""
|
|
249304
|
+
};
|
|
249305
|
+
}
|
|
249306
|
+
validateFieldTypes(record2, entitySchema) {
|
|
249307
|
+
for (const [key2, value] of Object.entries(record2)) {
|
|
249308
|
+
const property = entitySchema.properties[key2];
|
|
249309
|
+
const result = this.validateValue(value, property, key2);
|
|
249310
|
+
if (result.hasError)
|
|
249311
|
+
return result;
|
|
249312
|
+
}
|
|
249313
|
+
return {
|
|
249314
|
+
hasError: false
|
|
249315
|
+
};
|
|
249316
|
+
}
|
|
249317
|
+
validateValue(value, property, fieldPath) {
|
|
249318
|
+
if (!property) {
|
|
249319
|
+
return { hasError: false };
|
|
249320
|
+
}
|
|
249321
|
+
const propertyType = property.type;
|
|
249322
|
+
if (!fieldTypes.includes(propertyType)) {
|
|
249323
|
+
return {
|
|
249324
|
+
hasError: true,
|
|
249325
|
+
error: this.createValidationError(`Error in field ${fieldPath}: Unsupported field type ${propertyType}`)
|
|
249326
|
+
};
|
|
249327
|
+
}
|
|
249328
|
+
switch (propertyType) {
|
|
249329
|
+
case "array":
|
|
249330
|
+
if (!Array.isArray(value)) {
|
|
249331
|
+
return {
|
|
249332
|
+
hasError: true,
|
|
249333
|
+
error: this.createValidationError(`Error in field ${fieldPath}: Input should be a valid array`)
|
|
249334
|
+
};
|
|
249335
|
+
}
|
|
249336
|
+
if (property.items) {
|
|
249337
|
+
for (let i5 = 0;i5 < value.length; i5++) {
|
|
249338
|
+
const itemResult = this.validateValue(value[i5], property.items, `${fieldPath}[${i5}]`);
|
|
249339
|
+
if (itemResult.hasError)
|
|
249340
|
+
return itemResult;
|
|
249341
|
+
}
|
|
249342
|
+
}
|
|
249343
|
+
break;
|
|
249344
|
+
case "object":
|
|
249345
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
249346
|
+
return {
|
|
249347
|
+
hasError: true,
|
|
249348
|
+
error: this.createValidationError(`Error in field ${fieldPath}: Input should be a valid object`)
|
|
249349
|
+
};
|
|
249350
|
+
}
|
|
249351
|
+
if (property.properties) {
|
|
249352
|
+
for (const [subKey, subValue] of Object.entries(value)) {
|
|
249353
|
+
if (property.properties[subKey]) {
|
|
249354
|
+
const subResult = this.validateValue(subValue, property.properties[subKey], `${fieldPath}.${subKey}`);
|
|
249355
|
+
if (subResult.hasError)
|
|
249356
|
+
return subResult;
|
|
249357
|
+
}
|
|
249358
|
+
}
|
|
249359
|
+
}
|
|
249360
|
+
break;
|
|
249361
|
+
case "integer":
|
|
249362
|
+
if (!Number.isInteger(value)) {
|
|
249363
|
+
return {
|
|
249364
|
+
hasError: true,
|
|
249365
|
+
error: this.createValidationError(`Error in field ${fieldPath}: Input should be a valid integer`)
|
|
249366
|
+
};
|
|
249367
|
+
}
|
|
249368
|
+
break;
|
|
249369
|
+
default:
|
|
249370
|
+
if (typeof value !== propertyType) {
|
|
249371
|
+
return {
|
|
249372
|
+
hasError: true,
|
|
249373
|
+
error: this.createValidationError(`Error in field ${fieldPath}: Input should be a valid ${propertyType}`)
|
|
249374
|
+
};
|
|
249375
|
+
}
|
|
249376
|
+
}
|
|
249377
|
+
return { hasError: false };
|
|
249378
|
+
}
|
|
249379
|
+
validateRequiredFields(record2, entitySchema) {
|
|
249380
|
+
if (entitySchema.required && entitySchema.required.length > 0) {
|
|
249381
|
+
for (const required2 of entitySchema.required) {
|
|
249382
|
+
if (record2[required2] == null) {
|
|
249383
|
+
return {
|
|
249384
|
+
hasError: true,
|
|
249385
|
+
error: this.createValidationError(`Error in field ${required2}: Field required`)
|
|
249386
|
+
};
|
|
249387
|
+
}
|
|
249388
|
+
}
|
|
249389
|
+
}
|
|
249390
|
+
return {
|
|
249391
|
+
hasError: false
|
|
249392
|
+
};
|
|
249393
|
+
}
|
|
249394
|
+
}
|
|
249395
|
+
|
|
249396
|
+
// src/cli/dev/dev-server/db/database.ts
|
|
248841
249397
|
class Database {
|
|
248842
249398
|
collections = new Map;
|
|
249399
|
+
schemas = new Map;
|
|
249400
|
+
validator = new Validator;
|
|
248843
249401
|
load(entities) {
|
|
248844
249402
|
for (const entity2 of entities) {
|
|
248845
249403
|
this.collections.set(entity2.name, new import_nedb.default);
|
|
249404
|
+
this.schemas.set(entity2.name, entity2);
|
|
248846
249405
|
}
|
|
248847
249406
|
}
|
|
248848
249407
|
getCollection(name2) {
|
|
@@ -248856,6 +249415,25 @@ class Database {
|
|
|
248856
249415
|
collection.remove({}, { multi: true });
|
|
248857
249416
|
}
|
|
248858
249417
|
this.collections.clear();
|
|
249418
|
+
this.schemas.clear();
|
|
249419
|
+
}
|
|
249420
|
+
validate(entityName, record2, partial2 = false) {
|
|
249421
|
+
const schema9 = this.schemas.get(entityName);
|
|
249422
|
+
if (!schema9) {
|
|
249423
|
+
throw new Error(`Entity "${entityName}" not found`);
|
|
249424
|
+
}
|
|
249425
|
+
return this.validator.validate(record2, schema9, partial2);
|
|
249426
|
+
}
|
|
249427
|
+
prepareRecord(entityName, record2, partial2 = false) {
|
|
249428
|
+
const schema9 = this.schemas.get(entityName);
|
|
249429
|
+
if (!schema9) {
|
|
249430
|
+
throw new Error(`Entity "${entityName}" not found`);
|
|
249431
|
+
}
|
|
249432
|
+
const filteredRecord = this.validator.filterFields(record2, schema9);
|
|
249433
|
+
if (partial2) {
|
|
249434
|
+
return filteredRecord;
|
|
249435
|
+
}
|
|
249436
|
+
return this.validator.applyDefaults(filteredRecord, schema9);
|
|
248859
249437
|
}
|
|
248860
249438
|
}
|
|
248861
249439
|
|
|
@@ -249047,8 +249625,14 @@ function createEntityRoutes(db2, logger, remoteProxy, broadcast) {
|
|
|
249047
249625
|
try {
|
|
249048
249626
|
const now = new Date().toISOString();
|
|
249049
249627
|
const { _id, ...body } = req.body;
|
|
249628
|
+
const filteredBody = db2.prepareRecord(entityName, body);
|
|
249629
|
+
const validation = db2.validate(entityName, filteredBody);
|
|
249630
|
+
if (validation.hasError) {
|
|
249631
|
+
res.status(422).json(validation.error);
|
|
249632
|
+
return;
|
|
249633
|
+
}
|
|
249050
249634
|
const record2 = {
|
|
249051
|
-
...
|
|
249635
|
+
...filteredBody,
|
|
249052
249636
|
id: nanoid3(),
|
|
249053
249637
|
created_date: now,
|
|
249054
249638
|
updated_date: now
|
|
@@ -249069,12 +249653,21 @@ function createEntityRoutes(db2, logger, remoteProxy, broadcast) {
|
|
|
249069
249653
|
}
|
|
249070
249654
|
try {
|
|
249071
249655
|
const now = new Date().toISOString();
|
|
249072
|
-
const records =
|
|
249073
|
-
|
|
249074
|
-
|
|
249075
|
-
|
|
249076
|
-
|
|
249077
|
-
|
|
249656
|
+
const records = [];
|
|
249657
|
+
for (const record2 of req.body) {
|
|
249658
|
+
const filteredRecord = db2.prepareRecord(entityName, record2);
|
|
249659
|
+
const validation = db2.validate(entityName, filteredRecord);
|
|
249660
|
+
if (validation.hasError) {
|
|
249661
|
+
res.status(422).json(validation.error);
|
|
249662
|
+
return;
|
|
249663
|
+
}
|
|
249664
|
+
records.push({
|
|
249665
|
+
...filteredRecord,
|
|
249666
|
+
id: nanoid3(),
|
|
249667
|
+
created_date: now,
|
|
249668
|
+
updated_date: now
|
|
249669
|
+
});
|
|
249670
|
+
}
|
|
249078
249671
|
const inserted = stripInternalFields(await collection.insertAsync(records));
|
|
249079
249672
|
emit(appId, entityName, "create", inserted);
|
|
249080
249673
|
res.status(201).json(inserted);
|
|
@@ -249087,8 +249680,14 @@ function createEntityRoutes(db2, logger, remoteProxy, broadcast) {
|
|
|
249087
249680
|
const { appId, entityName, id: id2 } = req.params;
|
|
249088
249681
|
const { id: _id, created_date: _created_date, ...body } = req.body;
|
|
249089
249682
|
try {
|
|
249683
|
+
const filteredBody = db2.prepareRecord(entityName, body, true);
|
|
249684
|
+
const validation = db2.validate(entityName, filteredBody, true);
|
|
249685
|
+
if (validation.hasError) {
|
|
249686
|
+
res.status(422).json(validation.error);
|
|
249687
|
+
return;
|
|
249688
|
+
}
|
|
249090
249689
|
const updateData = {
|
|
249091
|
-
...
|
|
249690
|
+
...filteredBody,
|
|
249092
249691
|
updated_date: new Date().toISOString()
|
|
249093
249692
|
};
|
|
249094
249693
|
const result = await collection.updateAsync({ id: id2 }, { $set: updateData }, { returnUpdatedDocs: true });
|
|
@@ -249958,9 +250557,9 @@ class NodeFsHandler {
|
|
|
249958
250557
|
if (this.fsw.closed) {
|
|
249959
250558
|
return;
|
|
249960
250559
|
}
|
|
249961
|
-
const
|
|
250560
|
+
const dirname13 = sp2.dirname(file2);
|
|
249962
250561
|
const basename5 = sp2.basename(file2);
|
|
249963
|
-
const parent = this.fsw._getWatchedDir(
|
|
250562
|
+
const parent = this.fsw._getWatchedDir(dirname13);
|
|
249964
250563
|
let prevStats = stats;
|
|
249965
250564
|
if (parent.has(basename5))
|
|
249966
250565
|
return;
|
|
@@ -249987,7 +250586,7 @@ class NodeFsHandler {
|
|
|
249987
250586
|
prevStats = newStats2;
|
|
249988
250587
|
}
|
|
249989
250588
|
} catch (error48) {
|
|
249990
|
-
this.fsw._remove(
|
|
250589
|
+
this.fsw._remove(dirname13, basename5);
|
|
249991
250590
|
}
|
|
249992
250591
|
} else if (parent.has(basename5)) {
|
|
249993
250592
|
const at13 = newStats.atimeMs;
|
|
@@ -250076,7 +250675,7 @@ class NodeFsHandler {
|
|
|
250076
250675
|
this._addToNodeFs(path19, initialAdd, wh2, depth + 1);
|
|
250077
250676
|
}
|
|
250078
250677
|
}).on(EV.ERROR, this._boundHandleError);
|
|
250079
|
-
return new Promise((
|
|
250678
|
+
return new Promise((resolve8, reject) => {
|
|
250080
250679
|
if (!stream)
|
|
250081
250680
|
return reject();
|
|
250082
250681
|
stream.once(STR_END, () => {
|
|
@@ -250085,7 +250684,7 @@ class NodeFsHandler {
|
|
|
250085
250684
|
return;
|
|
250086
250685
|
}
|
|
250087
250686
|
const wasThrottled = throttler ? throttler.clear() : false;
|
|
250088
|
-
|
|
250687
|
+
resolve8(undefined);
|
|
250089
250688
|
previous.getChildren().filter((item) => {
|
|
250090
250689
|
return item !== directory && !current.has(item);
|
|
250091
250690
|
}).forEach((item) => {
|
|
@@ -250990,7 +251589,7 @@ async function createDevServer(options8) {
|
|
|
250990
251589
|
devLogger.warn(`"${req.originalUrl}" is not supported in local development, passing call to production`);
|
|
250991
251590
|
remoteProxy(req, res, next);
|
|
250992
251591
|
});
|
|
250993
|
-
const server = await new Promise((
|
|
251592
|
+
const server = await new Promise((resolve9, reject) => {
|
|
250994
251593
|
const s5 = app.listen(port, "127.0.0.1", (err) => {
|
|
250995
251594
|
if (err) {
|
|
250996
251595
|
if ("code" in err && err.code === "EADDRINUSE") {
|
|
@@ -250999,7 +251598,7 @@ async function createDevServer(options8) {
|
|
|
250999
251598
|
reject(err);
|
|
251000
251599
|
}
|
|
251001
251600
|
} else {
|
|
251002
|
-
|
|
251601
|
+
resolve9(s5);
|
|
251003
251602
|
}
|
|
251004
251603
|
});
|
|
251005
251604
|
});
|
|
@@ -251008,8 +251607,8 @@ async function createDevServer(options8) {
|
|
|
251008
251607
|
broadcastEntityEvent(io6, appId, entityName, event);
|
|
251009
251608
|
};
|
|
251010
251609
|
const base44ConfigWatcher = new WatchBase44({
|
|
251011
|
-
functions:
|
|
251012
|
-
entities:
|
|
251610
|
+
functions: join20(dirname14(project2.configPath), project2.functionsDir),
|
|
251611
|
+
entities: join20(dirname14(project2.configPath), project2.entitiesDir)
|
|
251013
251612
|
}, devLogger);
|
|
251014
251613
|
base44ConfigWatcher.on("change", async (name2) => {
|
|
251015
251614
|
try {
|
|
@@ -251073,8 +251672,53 @@ function getDevCommand(context) {
|
|
|
251073
251672
|
});
|
|
251074
251673
|
}
|
|
251075
251674
|
|
|
251675
|
+
// src/cli/commands/exec.ts
|
|
251676
|
+
import { dirname as dirname15, join as join21 } from "node:path";
|
|
251677
|
+
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
251678
|
+
var __dirname4 = dirname15(fileURLToPath6(import.meta.url));
|
|
251679
|
+
var EXEC_WRAPPER_PATH = join21(__dirname4, "../deno-runtime/exec.ts");
|
|
251680
|
+
function readStdin() {
|
|
251681
|
+
return new Promise((resolve9, reject) => {
|
|
251682
|
+
let data = "";
|
|
251683
|
+
process.stdin.setEncoding("utf-8");
|
|
251684
|
+
process.stdin.on("data", (chunk) => {
|
|
251685
|
+
data += chunk;
|
|
251686
|
+
});
|
|
251687
|
+
process.stdin.on("end", () => resolve9(data));
|
|
251688
|
+
process.stdin.on("error", reject);
|
|
251689
|
+
});
|
|
251690
|
+
}
|
|
251691
|
+
async function execAction(extraArgs) {
|
|
251692
|
+
if (process.stdin.isTTY) {
|
|
251693
|
+
throw new InvalidInputError("No input provided. Pipe a script to stdin.", {
|
|
251694
|
+
hints: [
|
|
251695
|
+
{ message: "File: cat ./script.ts | base44 exec" },
|
|
251696
|
+
{ message: 'Eval: echo "console.log(1)" | base44 exec' }
|
|
251697
|
+
]
|
|
251698
|
+
});
|
|
251699
|
+
}
|
|
251700
|
+
const code2 = await readStdin();
|
|
251701
|
+
const { exitCode } = await runScript({
|
|
251702
|
+
code: code2,
|
|
251703
|
+
extraArgs,
|
|
251704
|
+
execWrapperPath: EXEC_WRAPPER_PATH
|
|
251705
|
+
});
|
|
251706
|
+
if (exitCode !== 0) {
|
|
251707
|
+
process.exitCode = exitCode;
|
|
251708
|
+
}
|
|
251709
|
+
return {};
|
|
251710
|
+
}
|
|
251711
|
+
function getExecCommand(context) {
|
|
251712
|
+
const cmd = new Command("exec").description("Run a script with the Base44 SDK pre-authenticated as the current user").action(async () => {
|
|
251713
|
+
const dashIndex = process.argv.indexOf("--");
|
|
251714
|
+
const extraArgs = dashIndex !== -1 ? process.argv.slice(dashIndex + 1) : [];
|
|
251715
|
+
await runCommand(() => execAction(extraArgs), { requireAuth: true }, context);
|
|
251716
|
+
});
|
|
251717
|
+
return cmd;
|
|
251718
|
+
}
|
|
251719
|
+
|
|
251076
251720
|
// src/cli/commands/project/eject.ts
|
|
251077
|
-
import { resolve as
|
|
251721
|
+
import { resolve as resolve9 } from "node:path";
|
|
251078
251722
|
var import_kebabCase2 = __toESM(require_kebabCase(), 1);
|
|
251079
251723
|
async function eject(options8) {
|
|
251080
251724
|
const projects = await listProjects();
|
|
@@ -251123,7 +251767,7 @@ async function eject(options8) {
|
|
|
251123
251767
|
Ne("Operation cancelled.");
|
|
251124
251768
|
throw new CLIExitError(0);
|
|
251125
251769
|
}
|
|
251126
|
-
const resolvedPath =
|
|
251770
|
+
const resolvedPath = resolve9(selectedPath);
|
|
251127
251771
|
await runTask("Downloading your project's code...", async (updateMessage) => {
|
|
251128
251772
|
await createProjectFilesForExistingProject({
|
|
251129
251773
|
projectId,
|
|
@@ -251179,16 +251823,17 @@ function createProgram(context) {
|
|
|
251179
251823
|
program2.addCommand(getLogoutCommand(context));
|
|
251180
251824
|
program2.addCommand(getCreateCommand(context));
|
|
251181
251825
|
program2.addCommand(getDashboardCommand(context));
|
|
251182
|
-
program2.addCommand(
|
|
251826
|
+
program2.addCommand(getDeployCommand2(context));
|
|
251183
251827
|
program2.addCommand(getLinkCommand(context));
|
|
251184
251828
|
program2.addCommand(getEjectCommand(context));
|
|
251185
251829
|
program2.addCommand(getEntitiesPushCommand(context));
|
|
251186
251830
|
program2.addCommand(getAgentsCommand(context));
|
|
251187
251831
|
program2.addCommand(getConnectorsCommand(context));
|
|
251188
|
-
program2.addCommand(
|
|
251832
|
+
program2.addCommand(getFunctionsCommand(context));
|
|
251189
251833
|
program2.addCommand(getSecretsCommand(context));
|
|
251190
251834
|
program2.addCommand(getSiteCommand(context));
|
|
251191
251835
|
program2.addCommand(getTypesCommand(context));
|
|
251836
|
+
program2.addCommand(getExecCommand(context));
|
|
251192
251837
|
program2.addCommand(getDevCommand(context), { hidden: true });
|
|
251193
251838
|
program2.addCommand(getLogsCommand(context), { hidden: true });
|
|
251194
251839
|
return program2;
|
|
@@ -251199,7 +251844,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
|
|
|
251199
251844
|
import { release, type } from "node:os";
|
|
251200
251845
|
|
|
251201
251846
|
// ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
251202
|
-
import { dirname as
|
|
251847
|
+
import { dirname as dirname16, posix, sep } from "path";
|
|
251203
251848
|
function createModulerModifier() {
|
|
251204
251849
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
251205
251850
|
return async (frames) => {
|
|
@@ -251208,7 +251853,7 @@ function createModulerModifier() {
|
|
|
251208
251853
|
return frames;
|
|
251209
251854
|
};
|
|
251210
251855
|
}
|
|
251211
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
251856
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname16(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
|
|
251212
251857
|
const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
|
|
251213
251858
|
return (filename) => {
|
|
251214
251859
|
if (!filename)
|
|
@@ -253486,14 +254131,14 @@ async function addSourceContext(frames) {
|
|
|
253486
254131
|
return frames;
|
|
253487
254132
|
}
|
|
253488
254133
|
function getContextLinesFromFile(path19, ranges, output) {
|
|
253489
|
-
return new Promise((
|
|
254134
|
+
return new Promise((resolve10) => {
|
|
253490
254135
|
const stream = createReadStream2(path19);
|
|
253491
254136
|
const lineReaded = createInterface2({
|
|
253492
254137
|
input: stream
|
|
253493
254138
|
});
|
|
253494
254139
|
function destroyStreamAndResolve() {
|
|
253495
254140
|
stream.destroy();
|
|
253496
|
-
|
|
254141
|
+
resolve10();
|
|
253497
254142
|
}
|
|
253498
254143
|
let lineNumber = 0;
|
|
253499
254144
|
let currentRangeIndex = 0;
|
|
@@ -254605,15 +255250,15 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
254605
255250
|
return true;
|
|
254606
255251
|
if (this.featureFlagsPoller === undefined)
|
|
254607
255252
|
return false;
|
|
254608
|
-
return new Promise((
|
|
255253
|
+
return new Promise((resolve10) => {
|
|
254609
255254
|
const timeout3 = setTimeout(() => {
|
|
254610
255255
|
cleanup();
|
|
254611
|
-
|
|
255256
|
+
resolve10(false);
|
|
254612
255257
|
}, timeoutMs);
|
|
254613
255258
|
const cleanup = this._events.on("localEvaluationFlagsLoaded", (count2) => {
|
|
254614
255259
|
clearTimeout(timeout3);
|
|
254615
255260
|
cleanup();
|
|
254616
|
-
|
|
255261
|
+
resolve10(count2 > 0);
|
|
254617
255262
|
});
|
|
254618
255263
|
});
|
|
254619
255264
|
}
|
|
@@ -255397,9 +256042,9 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
|
|
|
255397
256042
|
});
|
|
255398
256043
|
}
|
|
255399
256044
|
// src/cli/index.ts
|
|
255400
|
-
var
|
|
256045
|
+
var __dirname5 = dirname17(fileURLToPath7(import.meta.url));
|
|
255401
256046
|
async function runCLI(options8) {
|
|
255402
|
-
ensureNpmAssets(
|
|
256047
|
+
ensureNpmAssets(join22(__dirname5, "../assets"));
|
|
255403
256048
|
const errorReporter = new ErrorReporter;
|
|
255404
256049
|
errorReporter.registerProcessErrorHandlers();
|
|
255405
256050
|
const isNonInteractive = !process.stdin.isTTY || !process.stdout.isTTY;
|
|
@@ -255432,4 +256077,4 @@ export {
|
|
|
255432
256077
|
CLIExitError
|
|
255433
256078
|
};
|
|
255434
256079
|
|
|
255435
|
-
//# debugId=
|
|
256080
|
+
//# debugId=7CE2464A9D880F1A64756E2164756E21
|