@base44-preview/cli 0.0.44-pr.417.2c58950 → 0.0.45-pr.357.604c676
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 +848 -198
- package/dist/cli/index.js.map +27 -17
- package/dist/deno-runtime/exec.ts +55 -0
- package/package.json +2 -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: {
|
|
@@ -238585,6 +238719,7 @@ var package_default = {
|
|
|
238585
238719
|
files: [
|
|
238586
238720
|
"dist/cli",
|
|
238587
238721
|
"dist/assets",
|
|
238722
|
+
"dist/deno-runtime",
|
|
238588
238723
|
"bin"
|
|
238589
238724
|
],
|
|
238590
238725
|
scripts: {
|
|
@@ -238665,15 +238800,15 @@ var package_default = {
|
|
|
238665
238800
|
};
|
|
238666
238801
|
|
|
238667
238802
|
// src/core/assets.ts
|
|
238668
|
-
var ASSETS_DIR =
|
|
238803
|
+
var ASSETS_DIR = join8(homedir2(), ".base44", "assets", package_default.version);
|
|
238669
238804
|
function getTemplatesDir() {
|
|
238670
|
-
return
|
|
238805
|
+
return join8(ASSETS_DIR, "templates");
|
|
238671
238806
|
}
|
|
238672
238807
|
function getTemplatesIndexPath() {
|
|
238673
|
-
return
|
|
238808
|
+
return join8(ASSETS_DIR, "templates", "templates.json");
|
|
238674
238809
|
}
|
|
238675
238810
|
function getDenoWrapperPath() {
|
|
238676
|
-
return
|
|
238811
|
+
return join8(ASSETS_DIR, "deno-runtime", "main.ts");
|
|
238677
238812
|
}
|
|
238678
238813
|
function ensureNpmAssets(sourceDir) {
|
|
238679
238814
|
if (existsSync(ASSETS_DIR))
|
|
@@ -238694,23 +238829,23 @@ async function listTemplates() {
|
|
|
238694
238829
|
return result.data.templates;
|
|
238695
238830
|
}
|
|
238696
238831
|
async function renderTemplate(template, destPath, data) {
|
|
238697
|
-
const templateDir =
|
|
238832
|
+
const templateDir = join9(getTemplatesDir(), template.path);
|
|
238698
238833
|
const files = await globby("**/*", {
|
|
238699
238834
|
cwd: templateDir,
|
|
238700
238835
|
dot: true,
|
|
238701
238836
|
onlyFiles: true
|
|
238702
238837
|
});
|
|
238703
238838
|
for (const file2 of files) {
|
|
238704
|
-
const srcPath =
|
|
238839
|
+
const srcPath = join9(templateDir, file2);
|
|
238705
238840
|
try {
|
|
238706
238841
|
if (file2.endsWith(".ejs")) {
|
|
238707
238842
|
const rendered = await import_ejs.default.renderFile(srcPath, data);
|
|
238708
238843
|
const { attributes, body } = import_front_matter.default(rendered);
|
|
238709
|
-
const destFile = attributes.outputFileName ?
|
|
238710
|
-
const destFilePath =
|
|
238844
|
+
const destFile = attributes.outputFileName ? join9(dirname6(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
|
|
238845
|
+
const destFilePath = join9(destPath, destFile);
|
|
238711
238846
|
await writeFile(destFilePath, body);
|
|
238712
238847
|
} else {
|
|
238713
|
-
const destFilePath =
|
|
238848
|
+
const destFilePath = join9(destPath, file2);
|
|
238714
238849
|
await copyFile(srcPath, destFilePath);
|
|
238715
238850
|
}
|
|
238716
238851
|
} catch (error48) {
|
|
@@ -238809,7 +238944,7 @@ async function getSiteFilePaths(outputDir) {
|
|
|
238809
238944
|
// src/core/site/deploy.ts
|
|
238810
238945
|
import { randomUUID } from "node:crypto";
|
|
238811
238946
|
import { tmpdir } from "node:os";
|
|
238812
|
-
import { join as
|
|
238947
|
+
import { join as join10 } from "node:path";
|
|
238813
238948
|
async function deploySite(siteOutputDir) {
|
|
238814
238949
|
if (!await pathExists(siteOutputDir)) {
|
|
238815
238950
|
throw new InvalidInputError(`Output directory does not exist: ${siteOutputDir}. Make sure to build your project first.`, {
|
|
@@ -238826,7 +238961,7 @@ async function deploySite(siteOutputDir) {
|
|
|
238826
238961
|
]
|
|
238827
238962
|
});
|
|
238828
238963
|
}
|
|
238829
|
-
const archivePath =
|
|
238964
|
+
const archivePath = join10(tmpdir(), `base44-site-${randomUUID()}.tar.gz`);
|
|
238830
238965
|
try {
|
|
238831
238966
|
await createArchive(siteOutputDir, archivePath);
|
|
238832
238967
|
return await uploadSite(archivePath);
|
|
@@ -238851,10 +238986,13 @@ function hasResourcesToDeploy(projectData) {
|
|
|
238851
238986
|
const hasConnectors = connectors.length > 0;
|
|
238852
238987
|
return hasEntities || hasFunctions || hasAgents || hasConnectors || hasSite;
|
|
238853
238988
|
}
|
|
238854
|
-
async function deployAll(projectData) {
|
|
238989
|
+
async function deployAll(projectData, options) {
|
|
238855
238990
|
const { project, entities, functions, agents, connectors } = projectData;
|
|
238856
238991
|
await entityResource.push(entities);
|
|
238857
|
-
await
|
|
238992
|
+
await deployFunctionsSequentially(functions, {
|
|
238993
|
+
onStart: options?.onFunctionStart,
|
|
238994
|
+
onResult: options?.onFunctionResult
|
|
238995
|
+
});
|
|
238858
238996
|
await agentResource.push(agents);
|
|
238859
238997
|
const { results: connectorResults } = await pushConnectors(connectors);
|
|
238860
238998
|
if (project.site?.outputDirectory) {
|
|
@@ -246611,7 +246749,7 @@ function formatYaml(data, options = {}) {
|
|
|
246611
246749
|
async function pullAgentsAction() {
|
|
246612
246750
|
const { project: project2 } = await readProjectConfig();
|
|
246613
246751
|
const configDir = dirname7(project2.configPath);
|
|
246614
|
-
const agentsDir =
|
|
246752
|
+
const agentsDir = join11(configDir, project2.agentsDir);
|
|
246615
246753
|
const remoteAgents = await runTask("Fetching agents from Base44", async () => {
|
|
246616
246754
|
return await fetchAgents();
|
|
246617
246755
|
}, {
|
|
@@ -246733,11 +246871,11 @@ function getConnectorsListAvailableCommand(context) {
|
|
|
246733
246871
|
}
|
|
246734
246872
|
|
|
246735
246873
|
// src/cli/commands/connectors/pull.ts
|
|
246736
|
-
import { dirname as dirname8, join as
|
|
246874
|
+
import { dirname as dirname8, join as join12 } from "node:path";
|
|
246737
246875
|
async function pullConnectorsAction() {
|
|
246738
246876
|
const { project: project2 } = await readProjectConfig();
|
|
246739
246877
|
const configDir = dirname8(project2.configPath);
|
|
246740
|
-
const connectorsDir =
|
|
246878
|
+
const connectorsDir = join12(configDir, project2.connectorsDir);
|
|
246741
246879
|
const remoteConnectors = await runTask("Fetching connectors from Base44", async () => {
|
|
246742
246880
|
return await pullAllConnectors();
|
|
246743
246881
|
}, {
|
|
@@ -247606,46 +247744,242 @@ function getEntitiesPushCommand(context) {
|
|
|
247606
247744
|
}));
|
|
247607
247745
|
}
|
|
247608
247746
|
|
|
247747
|
+
// src/cli/commands/functions/delete.ts
|
|
247748
|
+
async function deleteFunctionsAction(names) {
|
|
247749
|
+
let deleted = 0;
|
|
247750
|
+
let notFound = 0;
|
|
247751
|
+
let errors5 = 0;
|
|
247752
|
+
for (const name2 of names) {
|
|
247753
|
+
try {
|
|
247754
|
+
await runTask(`Deleting ${name2}...`, () => deleteSingleFunction(name2), {
|
|
247755
|
+
successMessage: `${name2} deleted`,
|
|
247756
|
+
errorMessage: `Failed to delete ${name2}`
|
|
247757
|
+
});
|
|
247758
|
+
deleted++;
|
|
247759
|
+
} catch (error48) {
|
|
247760
|
+
if (error48 instanceof ApiError && error48.statusCode === 404) {
|
|
247761
|
+
notFound++;
|
|
247762
|
+
} else {
|
|
247763
|
+
errors5++;
|
|
247764
|
+
}
|
|
247765
|
+
}
|
|
247766
|
+
}
|
|
247767
|
+
if (names.length === 1) {
|
|
247768
|
+
if (deleted)
|
|
247769
|
+
return { outroMessage: `Function "${names[0]}" deleted` };
|
|
247770
|
+
if (notFound)
|
|
247771
|
+
return { outroMessage: `Function "${names[0]}" not found` };
|
|
247772
|
+
return { outroMessage: `Failed to delete "${names[0]}"` };
|
|
247773
|
+
}
|
|
247774
|
+
const total = names.length;
|
|
247775
|
+
const parts = [];
|
|
247776
|
+
if (deleted > 0)
|
|
247777
|
+
parts.push(`${deleted}/${total} deleted`);
|
|
247778
|
+
if (notFound > 0)
|
|
247779
|
+
parts.push(`${notFound} not found`);
|
|
247780
|
+
if (errors5 > 0)
|
|
247781
|
+
parts.push(`${errors5} error${errors5 !== 1 ? "s" : ""}`);
|
|
247782
|
+
return { outroMessage: parts.join(", ") };
|
|
247783
|
+
}
|
|
247784
|
+
function parseNames(args) {
|
|
247785
|
+
return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
|
|
247786
|
+
}
|
|
247787
|
+
function validateNames(command) {
|
|
247788
|
+
const names = parseNames(command.args);
|
|
247789
|
+
if (names.length === 0) {
|
|
247790
|
+
command.error("At least one function name is required");
|
|
247791
|
+
}
|
|
247792
|
+
}
|
|
247793
|
+
function getDeleteCommand(context) {
|
|
247794
|
+
return new Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").hook("preAction", validateNames).action(async (rawNames) => {
|
|
247795
|
+
const names = parseNames(rawNames);
|
|
247796
|
+
await runCommand(() => deleteFunctionsAction(names), { requireAuth: true }, context);
|
|
247797
|
+
});
|
|
247798
|
+
}
|
|
247799
|
+
|
|
247800
|
+
// src/cli/commands/functions/formatDeployResult.ts
|
|
247801
|
+
function formatDuration(ms) {
|
|
247802
|
+
return `${(ms / 1000).toFixed(1)}s`;
|
|
247803
|
+
}
|
|
247804
|
+
function formatDeployResult(result) {
|
|
247805
|
+
const label = result.name.padEnd(25);
|
|
247806
|
+
if (result.status === "deployed") {
|
|
247807
|
+
const timing = result.durationMs ? theme.styles.dim(` (${formatDuration(result.durationMs)})`) : "";
|
|
247808
|
+
R2.success(`${label} deployed${timing}`);
|
|
247809
|
+
} else if (result.status === "unchanged") {
|
|
247810
|
+
R2.success(`${label} unchanged`);
|
|
247811
|
+
} else {
|
|
247812
|
+
R2.error(`${label} error: ${result.error}`);
|
|
247813
|
+
}
|
|
247814
|
+
}
|
|
247815
|
+
|
|
247816
|
+
// src/cli/commands/functions/parseNames.ts
|
|
247817
|
+
function parseNames2(args) {
|
|
247818
|
+
return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
|
|
247819
|
+
}
|
|
247820
|
+
|
|
247609
247821
|
// src/cli/commands/functions/deploy.ts
|
|
247610
|
-
|
|
247822
|
+
function resolveFunctionsToDeploy(names, allFunctions) {
|
|
247823
|
+
if (names.length === 0)
|
|
247824
|
+
return allFunctions;
|
|
247825
|
+
const notFound = names.filter((n2) => !allFunctions.some((f) => f.name === n2));
|
|
247826
|
+
if (notFound.length > 0) {
|
|
247827
|
+
throw new InvalidInputError(`Function${notFound.length > 1 ? "s" : ""} not found in project: ${notFound.join(", ")}`);
|
|
247828
|
+
}
|
|
247829
|
+
return allFunctions.filter((f) => names.includes(f.name));
|
|
247830
|
+
}
|
|
247831
|
+
function formatPruneResult(pruneResult) {
|
|
247832
|
+
if (pruneResult.deleted) {
|
|
247833
|
+
R2.success(`${pruneResult.name.padEnd(25)} deleted`);
|
|
247834
|
+
} else {
|
|
247835
|
+
R2.error(`${pruneResult.name.padEnd(25)} error: ${pruneResult.error}`);
|
|
247836
|
+
}
|
|
247837
|
+
}
|
|
247838
|
+
function formatPruneSummary(pruneResults) {
|
|
247839
|
+
if (pruneResults.length > 0) {
|
|
247840
|
+
const pruned = pruneResults.filter((r) => r.deleted).length;
|
|
247841
|
+
R2.info(`${pruned} deleted`);
|
|
247842
|
+
}
|
|
247843
|
+
}
|
|
247844
|
+
function buildDeploySummary(results) {
|
|
247845
|
+
const deployed = results.filter((r) => r.status === "deployed").length;
|
|
247846
|
+
const unchanged = results.filter((r) => r.status === "unchanged").length;
|
|
247847
|
+
const failed = results.filter((r) => r.status === "error").length;
|
|
247848
|
+
const parts = [];
|
|
247849
|
+
if (deployed > 0)
|
|
247850
|
+
parts.push(`${deployed} deployed`);
|
|
247851
|
+
if (unchanged > 0)
|
|
247852
|
+
parts.push(`${unchanged} unchanged`);
|
|
247853
|
+
if (failed > 0)
|
|
247854
|
+
parts.push(`${failed} error${failed !== 1 ? "s" : ""}`);
|
|
247855
|
+
return parts.join(", ") || "No functions deployed";
|
|
247856
|
+
}
|
|
247857
|
+
async function deployFunctionsAction(names, options) {
|
|
247858
|
+
if (options.force && names.length > 0) {
|
|
247859
|
+
throw new InvalidInputError("--force cannot be used when specifying function names");
|
|
247860
|
+
}
|
|
247611
247861
|
const { functions } = await readProjectConfig();
|
|
247612
|
-
|
|
247862
|
+
const toDeploy = resolveFunctionsToDeploy(names, functions);
|
|
247863
|
+
if (toDeploy.length === 0) {
|
|
247613
247864
|
return {
|
|
247614
247865
|
outroMessage: "No functions found. Create functions in the 'functions' directory."
|
|
247615
247866
|
};
|
|
247616
247867
|
}
|
|
247617
|
-
R2.info(`Found ${
|
|
247618
|
-
|
|
247619
|
-
|
|
247868
|
+
R2.info(`Found ${toDeploy.length} ${toDeploy.length === 1 ? "function" : "functions"} to deploy`);
|
|
247869
|
+
let completed = 0;
|
|
247870
|
+
const total = toDeploy.length;
|
|
247871
|
+
const results = await deployFunctionsSequentially(toDeploy, {
|
|
247872
|
+
onStart: (startNames) => {
|
|
247873
|
+
const label = startNames.length === 1 ? startNames[0] : `${startNames.length} functions`;
|
|
247874
|
+
R2.step(theme.styles.dim(`[${completed + 1}/${total}] Deploying ${label}...`));
|
|
247875
|
+
},
|
|
247876
|
+
onResult: (result) => {
|
|
247877
|
+
completed++;
|
|
247878
|
+
formatDeployResult(result);
|
|
247879
|
+
}
|
|
247880
|
+
});
|
|
247881
|
+
if (options.force) {
|
|
247882
|
+
const allLocalNames = functions.map((f) => f.name);
|
|
247883
|
+
let pruneCompleted = 0;
|
|
247884
|
+
let pruneTotal = 0;
|
|
247885
|
+
const pruneResults = await pruneRemovedFunctions(allLocalNames, {
|
|
247886
|
+
onStart: (total2) => {
|
|
247887
|
+
pruneTotal = total2;
|
|
247888
|
+
if (total2 > 0) {
|
|
247889
|
+
R2.info(`Found ${total2} remote ${total2 === 1 ? "function" : "functions"} to delete`);
|
|
247890
|
+
}
|
|
247891
|
+
},
|
|
247892
|
+
onBeforeDelete: (name2) => {
|
|
247893
|
+
pruneCompleted++;
|
|
247894
|
+
R2.step(theme.styles.dim(`[${pruneCompleted}/${pruneTotal}] Deleting ${name2}...`));
|
|
247895
|
+
},
|
|
247896
|
+
onResult: formatPruneResult
|
|
247897
|
+
});
|
|
247898
|
+
formatPruneSummary(pruneResults);
|
|
247899
|
+
}
|
|
247900
|
+
return { outroMessage: buildDeploySummary(results) };
|
|
247901
|
+
}
|
|
247902
|
+
function getDeployCommand(context) {
|
|
247903
|
+
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) => {
|
|
247904
|
+
await runCommand(() => {
|
|
247905
|
+
const names = parseNames2(rawNames);
|
|
247906
|
+
return deployFunctionsAction(names, options);
|
|
247907
|
+
}, { requireAuth: true }, context);
|
|
247908
|
+
});
|
|
247909
|
+
}
|
|
247910
|
+
|
|
247911
|
+
// src/cli/commands/functions/list.ts
|
|
247912
|
+
async function listFunctionsAction() {
|
|
247913
|
+
const { functions } = await runTask("Fetching functions...", async () => listDeployedFunctions(), { errorMessage: "Failed to fetch functions" });
|
|
247914
|
+
if (functions.length === 0) {
|
|
247915
|
+
return { outroMessage: "No functions on remote" };
|
|
247916
|
+
}
|
|
247917
|
+
for (const fn of functions) {
|
|
247918
|
+
const automationCount = fn.automations.length;
|
|
247919
|
+
const automationLabel = automationCount > 0 ? theme.styles.dim(` (${automationCount} automation${automationCount > 1 ? "s" : ""})`) : "";
|
|
247920
|
+
R2.message(` ${fn.name}${automationLabel}`);
|
|
247921
|
+
}
|
|
247922
|
+
return {
|
|
247923
|
+
outroMessage: `${functions.length} function${functions.length !== 1 ? "s" : ""} on remote`
|
|
247924
|
+
};
|
|
247925
|
+
}
|
|
247926
|
+
function getListCommand(context) {
|
|
247927
|
+
return new Command("list").description("List all deployed functions").action(async () => {
|
|
247928
|
+
await runCommand(listFunctionsAction, { requireAuth: true }, context);
|
|
247929
|
+
});
|
|
247930
|
+
}
|
|
247931
|
+
|
|
247932
|
+
// src/cli/commands/functions/pull.ts
|
|
247933
|
+
import { dirname as dirname9, join as join13 } from "node:path";
|
|
247934
|
+
async function pullFunctionsAction(name2) {
|
|
247935
|
+
const { project: project2 } = await readProjectConfig();
|
|
247936
|
+
const configDir = dirname9(project2.configPath);
|
|
247937
|
+
const functionsDir = join13(configDir, project2.functionsDir);
|
|
247938
|
+
const remoteFunctions = await runTask("Fetching functions from Base44", async () => {
|
|
247939
|
+
const { functions } = await listDeployedFunctions();
|
|
247940
|
+
return functions;
|
|
247620
247941
|
}, {
|
|
247621
|
-
successMessage: "Functions
|
|
247622
|
-
errorMessage: "Failed to
|
|
247942
|
+
successMessage: "Functions fetched successfully",
|
|
247943
|
+
errorMessage: "Failed to fetch functions"
|
|
247623
247944
|
});
|
|
247624
|
-
|
|
247625
|
-
|
|
247945
|
+
const toPull = name2 ? remoteFunctions.filter((f) => f.name === name2) : remoteFunctions;
|
|
247946
|
+
if (name2 && toPull.length === 0) {
|
|
247947
|
+
return {
|
|
247948
|
+
outroMessage: `Function "${name2}" not found on remote`
|
|
247949
|
+
};
|
|
247626
247950
|
}
|
|
247627
|
-
if (
|
|
247628
|
-
|
|
247951
|
+
if (toPull.length === 0) {
|
|
247952
|
+
return { outroMessage: "No functions found on remote" };
|
|
247629
247953
|
}
|
|
247630
|
-
|
|
247631
|
-
|
|
247632
|
-
|
|
247633
|
-
|
|
247634
|
-
|
|
247635
|
-
|
|
247636
|
-
|
|
247637
|
-
});
|
|
247954
|
+
const { written, skipped } = await runTask("Writing function files", async () => {
|
|
247955
|
+
return await writeFunctions(functionsDir, toPull);
|
|
247956
|
+
}, {
|
|
247957
|
+
successMessage: "Function files written successfully",
|
|
247958
|
+
errorMessage: "Failed to write function files"
|
|
247959
|
+
});
|
|
247960
|
+
for (const name3 of written) {
|
|
247961
|
+
R2.success(`${name3.padEnd(25)} written`);
|
|
247962
|
+
}
|
|
247963
|
+
for (const name3 of skipped) {
|
|
247964
|
+
R2.info(`${name3.padEnd(25)} unchanged`);
|
|
247638
247965
|
}
|
|
247639
|
-
return {
|
|
247966
|
+
return {
|
|
247967
|
+
outroMessage: `Pulled ${toPull.length} function${toPull.length !== 1 ? "s" : ""} to ${functionsDir}`
|
|
247968
|
+
};
|
|
247640
247969
|
}
|
|
247641
|
-
function
|
|
247642
|
-
return new Command("
|
|
247643
|
-
await runCommand(
|
|
247644
|
-
})
|
|
247970
|
+
function getPullCommand(context) {
|
|
247971
|
+
return new Command("pull").description("Pull deployed functions from Base44").argument("[name]", "Function name to pull (pulls all if omitted)").action(async (name2) => {
|
|
247972
|
+
await runCommand(() => pullFunctionsAction(name2), { requireAuth: true }, context);
|
|
247973
|
+
});
|
|
247974
|
+
}
|
|
247975
|
+
|
|
247976
|
+
// src/cli/commands/functions/index.ts
|
|
247977
|
+
function getFunctionsCommand(context) {
|
|
247978
|
+
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getDeleteCommand(context)).addCommand(getListCommand(context)).addCommand(getPullCommand(context));
|
|
247645
247979
|
}
|
|
247646
247980
|
|
|
247647
247981
|
// src/cli/commands/project/create.ts
|
|
247648
|
-
import { basename as basename3, join as
|
|
247982
|
+
import { basename as basename3, join as join14, resolve as resolve2 } from "node:path";
|
|
247649
247983
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
247650
247984
|
var DEFAULT_TEMPLATE_ID = "backend-only";
|
|
247651
247985
|
async function getTemplateById(templateId) {
|
|
@@ -247782,7 +248116,7 @@ async function executeCreate({
|
|
|
247782
248116
|
updateMessage("Building project...");
|
|
247783
248117
|
await execa({ cwd: resolvedPath, shell: true })`${buildCommand}`;
|
|
247784
248118
|
updateMessage("Deploying site...");
|
|
247785
|
-
return await deploySite(
|
|
248119
|
+
return await deploySite(join14(resolvedPath, outputDirectory));
|
|
247786
248120
|
}, {
|
|
247787
248121
|
successMessage: theme.colors.base44Orange("Site deployed successfully"),
|
|
247788
248122
|
errorMessage: "Failed to deploy site"
|
|
@@ -247869,11 +248203,17 @@ ${summaryLines.join(`
|
|
|
247869
248203
|
${summaryLines.join(`
|
|
247870
248204
|
`)}`);
|
|
247871
248205
|
}
|
|
247872
|
-
|
|
247873
|
-
|
|
247874
|
-
|
|
247875
|
-
|
|
247876
|
-
|
|
248206
|
+
let functionCompleted = 0;
|
|
248207
|
+
const functionTotal = functions.length;
|
|
248208
|
+
const result = await deployAll(projectData, {
|
|
248209
|
+
onFunctionStart: (names) => {
|
|
248210
|
+
const label = names.length === 1 ? names[0] : `${names.length} functions`;
|
|
248211
|
+
R2.step(theme.styles.dim(`[${functionCompleted + 1}/${functionTotal}] Deploying ${label}...`));
|
|
248212
|
+
},
|
|
248213
|
+
onFunctionResult: (r) => {
|
|
248214
|
+
functionCompleted++;
|
|
248215
|
+
formatDeployResult(r);
|
|
248216
|
+
}
|
|
247877
248217
|
});
|
|
247878
248218
|
const connectorResults = result.connectorResults ?? [];
|
|
247879
248219
|
await handleOAuthConnectors(connectorResults, options);
|
|
@@ -247887,7 +248227,7 @@ ${summaryLines.join(`
|
|
|
247887
248227
|
}
|
|
247888
248228
|
return { outroMessage: "App deployed successfully" };
|
|
247889
248229
|
}
|
|
247890
|
-
function
|
|
248230
|
+
function getDeployCommand2(context) {
|
|
247891
248231
|
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
248232
|
await runCommand(() => deployAction({
|
|
247893
248233
|
...options,
|
|
@@ -248432,10 +248772,10 @@ function toPascalCase(name2) {
|
|
|
248432
248772
|
return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
|
|
248433
248773
|
}
|
|
248434
248774
|
// src/core/types/update-project.ts
|
|
248435
|
-
import { join as
|
|
248775
|
+
import { join as join17 } from "node:path";
|
|
248436
248776
|
var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
|
|
248437
248777
|
async function updateProjectConfig(projectRoot) {
|
|
248438
|
-
const tsconfigPath =
|
|
248778
|
+
const tsconfigPath = join17(projectRoot, "tsconfig.json");
|
|
248439
248779
|
if (!await pathExists(tsconfigPath)) {
|
|
248440
248780
|
return false;
|
|
248441
248781
|
}
|
|
@@ -248478,7 +248818,7 @@ function getTypesCommand(context) {
|
|
|
248478
248818
|
}
|
|
248479
248819
|
|
|
248480
248820
|
// src/cli/dev/dev-server/main.ts
|
|
248481
|
-
import { dirname as
|
|
248821
|
+
import { dirname as dirname14, join as join20 } from "node:path";
|
|
248482
248822
|
var import_cors = __toESM(require_lib4(), 1);
|
|
248483
248823
|
var import_express4 = __toESM(require_express(), 1);
|
|
248484
248824
|
|
|
@@ -248604,6 +248944,7 @@ var { promisify: promisify11 } = __require("util");
|
|
|
248604
248944
|
var tmp = require_tmp();
|
|
248605
248945
|
var $fileSync = tmp.fileSync;
|
|
248606
248946
|
var fileWithOptions = promisify11((options8, cb2) => tmp.file(options8, (err, path18, fd, cleanup) => err ? cb2(err) : cb2(undefined, { path: path18, fd, cleanup: promisify11(cleanup) })));
|
|
248947
|
+
var $file = async (options8) => fileWithOptions(options8);
|
|
248607
248948
|
var $dirSync = tmp.dirSync;
|
|
248608
248949
|
var dirWithOptions = promisify11((options8, cb2) => tmp.dir(options8, (err, path18, cleanup) => err ? cb2(err) : cb2(undefined, { path: path18, cleanup: promisify11(cleanup) })));
|
|
248609
248950
|
var $dir = async (options8) => dirWithOptions(options8);
|
|
@@ -248636,7 +248977,85 @@ function createDevLogger() {
|
|
|
248636
248977
|
}
|
|
248637
248978
|
|
|
248638
248979
|
// src/cli/dev/dev-server/function-manager.ts
|
|
248980
|
+
import { spawn as spawn3 } from "node:child_process";
|
|
248981
|
+
|
|
248982
|
+
// src/core/exec/run-script.ts
|
|
248639
248983
|
import { spawn as spawn2, spawnSync as spawnSync2 } from "node:child_process";
|
|
248984
|
+
import { copyFileSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
248985
|
+
import { resolve as resolve6 } from "node:path";
|
|
248986
|
+
function verifyDenoInstalled() {
|
|
248987
|
+
const result = spawnSync2("deno", ["--version"]);
|
|
248988
|
+
if (result.error) {
|
|
248989
|
+
throw new DependencyNotFoundError("Deno is required to run scripts with exec", {
|
|
248990
|
+
hints: [
|
|
248991
|
+
{
|
|
248992
|
+
message: "Install Deno: https://docs.deno.com/runtime/getting_started/installation/"
|
|
248993
|
+
}
|
|
248994
|
+
]
|
|
248995
|
+
});
|
|
248996
|
+
}
|
|
248997
|
+
}
|
|
248998
|
+
async function getUserAppToken() {
|
|
248999
|
+
try {
|
|
249000
|
+
const response = await getAppClient().get("auth/token").json();
|
|
249001
|
+
return response.token;
|
|
249002
|
+
} catch (error48) {
|
|
249003
|
+
throw await ApiError.fromHttpError(error48, "exchanging platform token for app user token");
|
|
249004
|
+
}
|
|
249005
|
+
}
|
|
249006
|
+
async function runScript(options8) {
|
|
249007
|
+
const { filePath, code: code2, extraArgs = [], execWrapperPath } = options8;
|
|
249008
|
+
verifyDenoInstalled();
|
|
249009
|
+
const cleanupFns = [];
|
|
249010
|
+
let scriptPath;
|
|
249011
|
+
if (filePath) {
|
|
249012
|
+
scriptPath = `file://${resolve6(filePath)}`;
|
|
249013
|
+
} else if (code2 !== undefined) {
|
|
249014
|
+
const tempScript = await $file({ postfix: ".ts" });
|
|
249015
|
+
cleanupFns.push(tempScript.cleanup);
|
|
249016
|
+
writeFileSync2(tempScript.path, code2, "utf-8");
|
|
249017
|
+
scriptPath = `file://${tempScript.path}`;
|
|
249018
|
+
} else {
|
|
249019
|
+
throw new Error("Either filePath or code must be provided");
|
|
249020
|
+
}
|
|
249021
|
+
const appConfig = getAppConfig();
|
|
249022
|
+
const [appUserToken, appBaseUrl] = await Promise.all([
|
|
249023
|
+
getUserAppToken(),
|
|
249024
|
+
getSiteUrl()
|
|
249025
|
+
]);
|
|
249026
|
+
const tempWrapper = await $file({ postfix: ".ts" });
|
|
249027
|
+
cleanupFns.push(tempWrapper.cleanup);
|
|
249028
|
+
copyFileSync(execWrapperPath, tempWrapper.path);
|
|
249029
|
+
try {
|
|
249030
|
+
const exitCode = await new Promise((resolvePromise) => {
|
|
249031
|
+
const child = spawn2("deno", [
|
|
249032
|
+
"run",
|
|
249033
|
+
"--allow-all",
|
|
249034
|
+
"--node-modules-dir=auto",
|
|
249035
|
+
tempWrapper.path,
|
|
249036
|
+
...extraArgs
|
|
249037
|
+
], {
|
|
249038
|
+
env: {
|
|
249039
|
+
...process.env,
|
|
249040
|
+
SCRIPT_PATH: scriptPath,
|
|
249041
|
+
BASE44_APP_ID: appConfig.id,
|
|
249042
|
+
BASE44_ACCESS_TOKEN: appUserToken,
|
|
249043
|
+
BASE44_APP_BASE_URL: appBaseUrl
|
|
249044
|
+
},
|
|
249045
|
+
stdio: "inherit"
|
|
249046
|
+
});
|
|
249047
|
+
child.on("close", (code3) => {
|
|
249048
|
+
resolvePromise(code3 ?? 1);
|
|
249049
|
+
});
|
|
249050
|
+
});
|
|
249051
|
+
return { exitCode };
|
|
249052
|
+
} finally {
|
|
249053
|
+
for (const cleanup of cleanupFns) {
|
|
249054
|
+
cleanup();
|
|
249055
|
+
}
|
|
249056
|
+
}
|
|
249057
|
+
}
|
|
249058
|
+
// src/cli/dev/dev-server/function-manager.ts
|
|
248640
249059
|
var READY_TIMEOUT = 30000;
|
|
248641
249060
|
|
|
248642
249061
|
class FunctionManager {
|
|
@@ -248650,15 +249069,7 @@ class FunctionManager {
|
|
|
248650
249069
|
this.logger = logger;
|
|
248651
249070
|
this.wrapperPath = wrapperPath;
|
|
248652
249071
|
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
|
-
});
|
|
249072
|
+
verifyDenoInstalled();
|
|
248662
249073
|
}
|
|
248663
249074
|
}
|
|
248664
249075
|
getFunctionNames() {
|
|
@@ -248721,7 +249132,7 @@ class FunctionManager {
|
|
|
248721
249132
|
}
|
|
248722
249133
|
spawnFunction(func, port) {
|
|
248723
249134
|
this.logger.log(`Spawning function "${func.name}" on port ${port}`);
|
|
248724
|
-
const process21 =
|
|
249135
|
+
const process21 = spawn3("deno", ["run", "--allow-all", this.wrapperPath], {
|
|
248725
249136
|
env: {
|
|
248726
249137
|
...globalThis.process.env,
|
|
248727
249138
|
FUNCTION_PATH: func.entryPath,
|
|
@@ -248759,7 +249170,7 @@ class FunctionManager {
|
|
|
248759
249170
|
});
|
|
248760
249171
|
}
|
|
248761
249172
|
waitForReady(name2, runningFunc) {
|
|
248762
|
-
return new Promise((
|
|
249173
|
+
return new Promise((resolve7, reject) => {
|
|
248763
249174
|
runningFunc.process.on("exit", (code2) => {
|
|
248764
249175
|
if (!runningFunc.ready) {
|
|
248765
249176
|
clearTimeout(timeout3);
|
|
@@ -248782,7 +249193,7 @@ class FunctionManager {
|
|
|
248782
249193
|
runningFunc.ready = true;
|
|
248783
249194
|
clearTimeout(timeout3);
|
|
248784
249195
|
runningFunc.process.stdout?.off("data", onData);
|
|
248785
|
-
|
|
249196
|
+
resolve7(runningFunc.port);
|
|
248786
249197
|
}
|
|
248787
249198
|
};
|
|
248788
249199
|
runningFunc.process.stdout?.on("data", onData);
|
|
@@ -248835,14 +249246,163 @@ function createFunctionRouter(manager, logger) {
|
|
|
248835
249246
|
return router;
|
|
248836
249247
|
}
|
|
248837
249248
|
|
|
248838
|
-
// src/cli/dev/dev-server/database.ts
|
|
249249
|
+
// src/cli/dev/dev-server/db/database.ts
|
|
248839
249250
|
var import_nedb = __toESM(require_nedb(), 1);
|
|
248840
249251
|
|
|
249252
|
+
// src/cli/dev/dev-server/db/validator.ts
|
|
249253
|
+
var fieldTypes = [
|
|
249254
|
+
"string",
|
|
249255
|
+
"integer",
|
|
249256
|
+
"number",
|
|
249257
|
+
"boolean",
|
|
249258
|
+
"array",
|
|
249259
|
+
"object"
|
|
249260
|
+
];
|
|
249261
|
+
|
|
249262
|
+
class Validator {
|
|
249263
|
+
filterFields(record2, entitySchema) {
|
|
249264
|
+
const filteredRecord = {};
|
|
249265
|
+
for (const [key2, value] of Object.entries(record2)) {
|
|
249266
|
+
if (entitySchema.properties[key2]) {
|
|
249267
|
+
filteredRecord[key2] = value;
|
|
249268
|
+
}
|
|
249269
|
+
}
|
|
249270
|
+
return filteredRecord;
|
|
249271
|
+
}
|
|
249272
|
+
applyDefaults(record2, entitySchema) {
|
|
249273
|
+
const result = {};
|
|
249274
|
+
for (const [key2, property] of Object.entries(entitySchema.properties)) {
|
|
249275
|
+
if (property.default !== undefined) {
|
|
249276
|
+
result[key2] = property.default;
|
|
249277
|
+
}
|
|
249278
|
+
}
|
|
249279
|
+
return {
|
|
249280
|
+
...result,
|
|
249281
|
+
...record2
|
|
249282
|
+
};
|
|
249283
|
+
}
|
|
249284
|
+
validate(record2, entitySchema, partial2 = false) {
|
|
249285
|
+
if (!partial2) {
|
|
249286
|
+
const requiredFieldsResponse = this.validateRequiredFields(record2, entitySchema);
|
|
249287
|
+
if (requiredFieldsResponse.hasError) {
|
|
249288
|
+
return requiredFieldsResponse;
|
|
249289
|
+
}
|
|
249290
|
+
}
|
|
249291
|
+
const fieldTypesResponse = this.validateFieldTypes(record2, entitySchema);
|
|
249292
|
+
if (fieldTypesResponse.hasError) {
|
|
249293
|
+
return fieldTypesResponse;
|
|
249294
|
+
}
|
|
249295
|
+
return {
|
|
249296
|
+
hasError: false
|
|
249297
|
+
};
|
|
249298
|
+
}
|
|
249299
|
+
createValidationError(message) {
|
|
249300
|
+
return {
|
|
249301
|
+
error_type: "ValidationError",
|
|
249302
|
+
message,
|
|
249303
|
+
request_id: null,
|
|
249304
|
+
traceback: ""
|
|
249305
|
+
};
|
|
249306
|
+
}
|
|
249307
|
+
validateFieldTypes(record2, entitySchema) {
|
|
249308
|
+
for (const [key2, value] of Object.entries(record2)) {
|
|
249309
|
+
const property = entitySchema.properties[key2];
|
|
249310
|
+
const result = this.validateValue(value, property, key2);
|
|
249311
|
+
if (result.hasError)
|
|
249312
|
+
return result;
|
|
249313
|
+
}
|
|
249314
|
+
return {
|
|
249315
|
+
hasError: false
|
|
249316
|
+
};
|
|
249317
|
+
}
|
|
249318
|
+
validateValue(value, property, fieldPath) {
|
|
249319
|
+
if (!property) {
|
|
249320
|
+
return { hasError: false };
|
|
249321
|
+
}
|
|
249322
|
+
const propertyType = property.type;
|
|
249323
|
+
if (!fieldTypes.includes(propertyType)) {
|
|
249324
|
+
return {
|
|
249325
|
+
hasError: true,
|
|
249326
|
+
error: this.createValidationError(`Error in field ${fieldPath}: Unsupported field type ${propertyType}`)
|
|
249327
|
+
};
|
|
249328
|
+
}
|
|
249329
|
+
switch (propertyType) {
|
|
249330
|
+
case "array":
|
|
249331
|
+
if (!Array.isArray(value)) {
|
|
249332
|
+
return {
|
|
249333
|
+
hasError: true,
|
|
249334
|
+
error: this.createValidationError(`Error in field ${fieldPath}: Input should be a valid array`)
|
|
249335
|
+
};
|
|
249336
|
+
}
|
|
249337
|
+
if (property.items) {
|
|
249338
|
+
for (let i5 = 0;i5 < value.length; i5++) {
|
|
249339
|
+
const itemResult = this.validateValue(value[i5], property.items, `${fieldPath}[${i5}]`);
|
|
249340
|
+
if (itemResult.hasError)
|
|
249341
|
+
return itemResult;
|
|
249342
|
+
}
|
|
249343
|
+
}
|
|
249344
|
+
break;
|
|
249345
|
+
case "object":
|
|
249346
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
249347
|
+
return {
|
|
249348
|
+
hasError: true,
|
|
249349
|
+
error: this.createValidationError(`Error in field ${fieldPath}: Input should be a valid object`)
|
|
249350
|
+
};
|
|
249351
|
+
}
|
|
249352
|
+
if (property.properties) {
|
|
249353
|
+
for (const [subKey, subValue] of Object.entries(value)) {
|
|
249354
|
+
if (property.properties[subKey]) {
|
|
249355
|
+
const subResult = this.validateValue(subValue, property.properties[subKey], `${fieldPath}.${subKey}`);
|
|
249356
|
+
if (subResult.hasError)
|
|
249357
|
+
return subResult;
|
|
249358
|
+
}
|
|
249359
|
+
}
|
|
249360
|
+
}
|
|
249361
|
+
break;
|
|
249362
|
+
case "integer":
|
|
249363
|
+
if (!Number.isInteger(value)) {
|
|
249364
|
+
return {
|
|
249365
|
+
hasError: true,
|
|
249366
|
+
error: this.createValidationError(`Error in field ${fieldPath}: Input should be a valid integer`)
|
|
249367
|
+
};
|
|
249368
|
+
}
|
|
249369
|
+
break;
|
|
249370
|
+
default:
|
|
249371
|
+
if (typeof value !== propertyType) {
|
|
249372
|
+
return {
|
|
249373
|
+
hasError: true,
|
|
249374
|
+
error: this.createValidationError(`Error in field ${fieldPath}: Input should be a valid ${propertyType}`)
|
|
249375
|
+
};
|
|
249376
|
+
}
|
|
249377
|
+
}
|
|
249378
|
+
return { hasError: false };
|
|
249379
|
+
}
|
|
249380
|
+
validateRequiredFields(record2, entitySchema) {
|
|
249381
|
+
if (entitySchema.required && entitySchema.required.length > 0) {
|
|
249382
|
+
for (const required2 of entitySchema.required) {
|
|
249383
|
+
if (record2[required2] == null) {
|
|
249384
|
+
return {
|
|
249385
|
+
hasError: true,
|
|
249386
|
+
error: this.createValidationError(`Error in field ${required2}: Field required`)
|
|
249387
|
+
};
|
|
249388
|
+
}
|
|
249389
|
+
}
|
|
249390
|
+
}
|
|
249391
|
+
return {
|
|
249392
|
+
hasError: false
|
|
249393
|
+
};
|
|
249394
|
+
}
|
|
249395
|
+
}
|
|
249396
|
+
|
|
249397
|
+
// src/cli/dev/dev-server/db/database.ts
|
|
248841
249398
|
class Database {
|
|
248842
249399
|
collections = new Map;
|
|
249400
|
+
schemas = new Map;
|
|
249401
|
+
validator = new Validator;
|
|
248843
249402
|
load(entities) {
|
|
248844
249403
|
for (const entity2 of entities) {
|
|
248845
249404
|
this.collections.set(entity2.name, new import_nedb.default);
|
|
249405
|
+
this.schemas.set(entity2.name, entity2);
|
|
248846
249406
|
}
|
|
248847
249407
|
}
|
|
248848
249408
|
getCollection(name2) {
|
|
@@ -248856,6 +249416,25 @@ class Database {
|
|
|
248856
249416
|
collection.remove({}, { multi: true });
|
|
248857
249417
|
}
|
|
248858
249418
|
this.collections.clear();
|
|
249419
|
+
this.schemas.clear();
|
|
249420
|
+
}
|
|
249421
|
+
validate(entityName, record2, partial2 = false) {
|
|
249422
|
+
const schema9 = this.schemas.get(entityName);
|
|
249423
|
+
if (!schema9) {
|
|
249424
|
+
throw new Error(`Entity "${entityName}" not found`);
|
|
249425
|
+
}
|
|
249426
|
+
return this.validator.validate(record2, schema9, partial2);
|
|
249427
|
+
}
|
|
249428
|
+
prepareRecord(entityName, record2, partial2 = false) {
|
|
249429
|
+
const schema9 = this.schemas.get(entityName);
|
|
249430
|
+
if (!schema9) {
|
|
249431
|
+
throw new Error(`Entity "${entityName}" not found`);
|
|
249432
|
+
}
|
|
249433
|
+
const filteredRecord = this.validator.filterFields(record2, schema9);
|
|
249434
|
+
if (partial2) {
|
|
249435
|
+
return filteredRecord;
|
|
249436
|
+
}
|
|
249437
|
+
return this.validator.applyDefaults(filteredRecord, schema9);
|
|
248859
249438
|
}
|
|
248860
249439
|
}
|
|
248861
249440
|
|
|
@@ -249047,8 +249626,14 @@ function createEntityRoutes(db2, logger, remoteProxy, broadcast) {
|
|
|
249047
249626
|
try {
|
|
249048
249627
|
const now = new Date().toISOString();
|
|
249049
249628
|
const { _id, ...body } = req.body;
|
|
249629
|
+
const filteredBody = db2.prepareRecord(entityName, body);
|
|
249630
|
+
const validation = db2.validate(entityName, filteredBody);
|
|
249631
|
+
if (validation.hasError) {
|
|
249632
|
+
res.status(422).json(validation.error);
|
|
249633
|
+
return;
|
|
249634
|
+
}
|
|
249050
249635
|
const record2 = {
|
|
249051
|
-
...
|
|
249636
|
+
...filteredBody,
|
|
249052
249637
|
id: nanoid3(),
|
|
249053
249638
|
created_date: now,
|
|
249054
249639
|
updated_date: now
|
|
@@ -249069,12 +249654,21 @@ function createEntityRoutes(db2, logger, remoteProxy, broadcast) {
|
|
|
249069
249654
|
}
|
|
249070
249655
|
try {
|
|
249071
249656
|
const now = new Date().toISOString();
|
|
249072
|
-
const records =
|
|
249073
|
-
|
|
249074
|
-
|
|
249075
|
-
|
|
249076
|
-
|
|
249077
|
-
|
|
249657
|
+
const records = [];
|
|
249658
|
+
for (const record2 of req.body) {
|
|
249659
|
+
const filteredRecord = db2.prepareRecord(entityName, record2);
|
|
249660
|
+
const validation = db2.validate(entityName, filteredRecord);
|
|
249661
|
+
if (validation.hasError) {
|
|
249662
|
+
res.status(422).json(validation.error);
|
|
249663
|
+
return;
|
|
249664
|
+
}
|
|
249665
|
+
records.push({
|
|
249666
|
+
...filteredRecord,
|
|
249667
|
+
id: nanoid3(),
|
|
249668
|
+
created_date: now,
|
|
249669
|
+
updated_date: now
|
|
249670
|
+
});
|
|
249671
|
+
}
|
|
249078
249672
|
const inserted = stripInternalFields(await collection.insertAsync(records));
|
|
249079
249673
|
emit(appId, entityName, "create", inserted);
|
|
249080
249674
|
res.status(201).json(inserted);
|
|
@@ -249087,8 +249681,14 @@ function createEntityRoutes(db2, logger, remoteProxy, broadcast) {
|
|
|
249087
249681
|
const { appId, entityName, id: id2 } = req.params;
|
|
249088
249682
|
const { id: _id, created_date: _created_date, ...body } = req.body;
|
|
249089
249683
|
try {
|
|
249684
|
+
const filteredBody = db2.prepareRecord(entityName, body, true);
|
|
249685
|
+
const validation = db2.validate(entityName, filteredBody, true);
|
|
249686
|
+
if (validation.hasError) {
|
|
249687
|
+
res.status(422).json(validation.error);
|
|
249688
|
+
return;
|
|
249689
|
+
}
|
|
249090
249690
|
const updateData = {
|
|
249091
|
-
...
|
|
249691
|
+
...filteredBody,
|
|
249092
249692
|
updated_date: new Date().toISOString()
|
|
249093
249693
|
};
|
|
249094
249694
|
const result = await collection.updateAsync({ id: id2 }, { $set: updateData }, { returnUpdatedDocs: true });
|
|
@@ -249958,9 +250558,9 @@ class NodeFsHandler {
|
|
|
249958
250558
|
if (this.fsw.closed) {
|
|
249959
250559
|
return;
|
|
249960
250560
|
}
|
|
249961
|
-
const
|
|
250561
|
+
const dirname13 = sp2.dirname(file2);
|
|
249962
250562
|
const basename5 = sp2.basename(file2);
|
|
249963
|
-
const parent = this.fsw._getWatchedDir(
|
|
250563
|
+
const parent = this.fsw._getWatchedDir(dirname13);
|
|
249964
250564
|
let prevStats = stats;
|
|
249965
250565
|
if (parent.has(basename5))
|
|
249966
250566
|
return;
|
|
@@ -249987,7 +250587,7 @@ class NodeFsHandler {
|
|
|
249987
250587
|
prevStats = newStats2;
|
|
249988
250588
|
}
|
|
249989
250589
|
} catch (error48) {
|
|
249990
|
-
this.fsw._remove(
|
|
250590
|
+
this.fsw._remove(dirname13, basename5);
|
|
249991
250591
|
}
|
|
249992
250592
|
} else if (parent.has(basename5)) {
|
|
249993
250593
|
const at13 = newStats.atimeMs;
|
|
@@ -250076,7 +250676,7 @@ class NodeFsHandler {
|
|
|
250076
250676
|
this._addToNodeFs(path19, initialAdd, wh2, depth + 1);
|
|
250077
250677
|
}
|
|
250078
250678
|
}).on(EV.ERROR, this._boundHandleError);
|
|
250079
|
-
return new Promise((
|
|
250679
|
+
return new Promise((resolve8, reject) => {
|
|
250080
250680
|
if (!stream)
|
|
250081
250681
|
return reject();
|
|
250082
250682
|
stream.once(STR_END, () => {
|
|
@@ -250085,7 +250685,7 @@ class NodeFsHandler {
|
|
|
250085
250685
|
return;
|
|
250086
250686
|
}
|
|
250087
250687
|
const wasThrottled = throttler ? throttler.clear() : false;
|
|
250088
|
-
|
|
250688
|
+
resolve8(undefined);
|
|
250089
250689
|
previous.getChildren().filter((item) => {
|
|
250090
250690
|
return item !== directory && !current.has(item);
|
|
250091
250691
|
}).forEach((item) => {
|
|
@@ -250990,7 +251590,7 @@ async function createDevServer(options8) {
|
|
|
250990
251590
|
devLogger.warn(`"${req.originalUrl}" is not supported in local development, passing call to production`);
|
|
250991
251591
|
remoteProxy(req, res, next);
|
|
250992
251592
|
});
|
|
250993
|
-
const server = await new Promise((
|
|
251593
|
+
const server = await new Promise((resolve9, reject) => {
|
|
250994
251594
|
const s5 = app.listen(port, "127.0.0.1", (err) => {
|
|
250995
251595
|
if (err) {
|
|
250996
251596
|
if ("code" in err && err.code === "EADDRINUSE") {
|
|
@@ -250999,7 +251599,7 @@ async function createDevServer(options8) {
|
|
|
250999
251599
|
reject(err);
|
|
251000
251600
|
}
|
|
251001
251601
|
} else {
|
|
251002
|
-
|
|
251602
|
+
resolve9(s5);
|
|
251003
251603
|
}
|
|
251004
251604
|
});
|
|
251005
251605
|
});
|
|
@@ -251008,8 +251608,8 @@ async function createDevServer(options8) {
|
|
|
251008
251608
|
broadcastEntityEvent(io6, appId, entityName, event);
|
|
251009
251609
|
};
|
|
251010
251610
|
const base44ConfigWatcher = new WatchBase44({
|
|
251011
|
-
functions:
|
|
251012
|
-
entities:
|
|
251611
|
+
functions: join20(dirname14(project2.configPath), project2.functionsDir),
|
|
251612
|
+
entities: join20(dirname14(project2.configPath), project2.entitiesDir)
|
|
251013
251613
|
}, devLogger);
|
|
251014
251614
|
base44ConfigWatcher.on("change", async (name2) => {
|
|
251015
251615
|
try {
|
|
@@ -251073,8 +251673,57 @@ function getDevCommand(context) {
|
|
|
251073
251673
|
});
|
|
251074
251674
|
}
|
|
251075
251675
|
|
|
251676
|
+
// src/cli/commands/exec.ts
|
|
251677
|
+
import { dirname as dirname15, join as join21 } from "node:path";
|
|
251678
|
+
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
251679
|
+
var __dirname4 = dirname15(fileURLToPath6(import.meta.url));
|
|
251680
|
+
var EXEC_WRAPPER_PATH = join21(__dirname4, "../deno-runtime/exec.ts");
|
|
251681
|
+
function readStdin() {
|
|
251682
|
+
return new Promise((resolve9, reject) => {
|
|
251683
|
+
let data = "";
|
|
251684
|
+
process.stdin.setEncoding("utf-8");
|
|
251685
|
+
process.stdin.on("data", (chunk) => {
|
|
251686
|
+
data += chunk;
|
|
251687
|
+
});
|
|
251688
|
+
process.stdin.on("end", () => resolve9(data));
|
|
251689
|
+
process.stdin.on("error", reject);
|
|
251690
|
+
});
|
|
251691
|
+
}
|
|
251692
|
+
async function execAction(extraArgs) {
|
|
251693
|
+
const noInputError = 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
|
+
if (process.stdin.isTTY) {
|
|
251700
|
+
throw noInputError;
|
|
251701
|
+
}
|
|
251702
|
+
const code2 = await readStdin();
|
|
251703
|
+
if (!code2.trim()) {
|
|
251704
|
+
throw noInputError;
|
|
251705
|
+
}
|
|
251706
|
+
const { exitCode } = await runScript({
|
|
251707
|
+
code: code2,
|
|
251708
|
+
extraArgs,
|
|
251709
|
+
execWrapperPath: EXEC_WRAPPER_PATH
|
|
251710
|
+
});
|
|
251711
|
+
if (exitCode !== 0) {
|
|
251712
|
+
process.exitCode = exitCode;
|
|
251713
|
+
}
|
|
251714
|
+
return {};
|
|
251715
|
+
}
|
|
251716
|
+
function getExecCommand(context) {
|
|
251717
|
+
const cmd = new Command("exec").description("Run a script with the Base44 SDK pre-authenticated as the current user").action(async () => {
|
|
251718
|
+
const dashIndex = process.argv.indexOf("--");
|
|
251719
|
+
const extraArgs = dashIndex !== -1 ? process.argv.slice(dashIndex + 1) : [];
|
|
251720
|
+
await runCommand(() => execAction(extraArgs), { requireAuth: true }, context);
|
|
251721
|
+
});
|
|
251722
|
+
return cmd;
|
|
251723
|
+
}
|
|
251724
|
+
|
|
251076
251725
|
// src/cli/commands/project/eject.ts
|
|
251077
|
-
import { resolve as
|
|
251726
|
+
import { resolve as resolve9 } from "node:path";
|
|
251078
251727
|
var import_kebabCase2 = __toESM(require_kebabCase(), 1);
|
|
251079
251728
|
async function eject(options8) {
|
|
251080
251729
|
const projects = await listProjects();
|
|
@@ -251123,7 +251772,7 @@ async function eject(options8) {
|
|
|
251123
251772
|
Ne("Operation cancelled.");
|
|
251124
251773
|
throw new CLIExitError(0);
|
|
251125
251774
|
}
|
|
251126
|
-
const resolvedPath =
|
|
251775
|
+
const resolvedPath = resolve9(selectedPath);
|
|
251127
251776
|
await runTask("Downloading your project's code...", async (updateMessage) => {
|
|
251128
251777
|
await createProjectFilesForExistingProject({
|
|
251129
251778
|
projectId,
|
|
@@ -251179,16 +251828,17 @@ function createProgram(context) {
|
|
|
251179
251828
|
program2.addCommand(getLogoutCommand(context));
|
|
251180
251829
|
program2.addCommand(getCreateCommand(context));
|
|
251181
251830
|
program2.addCommand(getDashboardCommand(context));
|
|
251182
|
-
program2.addCommand(
|
|
251831
|
+
program2.addCommand(getDeployCommand2(context));
|
|
251183
251832
|
program2.addCommand(getLinkCommand(context));
|
|
251184
251833
|
program2.addCommand(getEjectCommand(context));
|
|
251185
251834
|
program2.addCommand(getEntitiesPushCommand(context));
|
|
251186
251835
|
program2.addCommand(getAgentsCommand(context));
|
|
251187
251836
|
program2.addCommand(getConnectorsCommand(context));
|
|
251188
|
-
program2.addCommand(
|
|
251837
|
+
program2.addCommand(getFunctionsCommand(context));
|
|
251189
251838
|
program2.addCommand(getSecretsCommand(context));
|
|
251190
251839
|
program2.addCommand(getSiteCommand(context));
|
|
251191
251840
|
program2.addCommand(getTypesCommand(context));
|
|
251841
|
+
program2.addCommand(getExecCommand(context));
|
|
251192
251842
|
program2.addCommand(getDevCommand(context), { hidden: true });
|
|
251193
251843
|
program2.addCommand(getLogsCommand(context), { hidden: true });
|
|
251194
251844
|
return program2;
|
|
@@ -251199,7 +251849,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
|
|
|
251199
251849
|
import { release, type } from "node:os";
|
|
251200
251850
|
|
|
251201
251851
|
// ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
251202
|
-
import { dirname as
|
|
251852
|
+
import { dirname as dirname16, posix, sep } from "path";
|
|
251203
251853
|
function createModulerModifier() {
|
|
251204
251854
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
251205
251855
|
return async (frames) => {
|
|
@@ -251208,7 +251858,7 @@ function createModulerModifier() {
|
|
|
251208
251858
|
return frames;
|
|
251209
251859
|
};
|
|
251210
251860
|
}
|
|
251211
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
251861
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname16(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
|
|
251212
251862
|
const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
|
|
251213
251863
|
return (filename) => {
|
|
251214
251864
|
if (!filename)
|
|
@@ -253486,14 +254136,14 @@ async function addSourceContext(frames) {
|
|
|
253486
254136
|
return frames;
|
|
253487
254137
|
}
|
|
253488
254138
|
function getContextLinesFromFile(path19, ranges, output) {
|
|
253489
|
-
return new Promise((
|
|
254139
|
+
return new Promise((resolve10) => {
|
|
253490
254140
|
const stream = createReadStream2(path19);
|
|
253491
254141
|
const lineReaded = createInterface2({
|
|
253492
254142
|
input: stream
|
|
253493
254143
|
});
|
|
253494
254144
|
function destroyStreamAndResolve() {
|
|
253495
254145
|
stream.destroy();
|
|
253496
|
-
|
|
254146
|
+
resolve10();
|
|
253497
254147
|
}
|
|
253498
254148
|
let lineNumber = 0;
|
|
253499
254149
|
let currentRangeIndex = 0;
|
|
@@ -254605,15 +255255,15 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
254605
255255
|
return true;
|
|
254606
255256
|
if (this.featureFlagsPoller === undefined)
|
|
254607
255257
|
return false;
|
|
254608
|
-
return new Promise((
|
|
255258
|
+
return new Promise((resolve10) => {
|
|
254609
255259
|
const timeout3 = setTimeout(() => {
|
|
254610
255260
|
cleanup();
|
|
254611
|
-
|
|
255261
|
+
resolve10(false);
|
|
254612
255262
|
}, timeoutMs);
|
|
254613
255263
|
const cleanup = this._events.on("localEvaluationFlagsLoaded", (count2) => {
|
|
254614
255264
|
clearTimeout(timeout3);
|
|
254615
255265
|
cleanup();
|
|
254616
|
-
|
|
255266
|
+
resolve10(count2 > 0);
|
|
254617
255267
|
});
|
|
254618
255268
|
});
|
|
254619
255269
|
}
|
|
@@ -255397,9 +256047,9 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
|
|
|
255397
256047
|
});
|
|
255398
256048
|
}
|
|
255399
256049
|
// src/cli/index.ts
|
|
255400
|
-
var
|
|
256050
|
+
var __dirname5 = dirname17(fileURLToPath7(import.meta.url));
|
|
255401
256051
|
async function runCLI(options8) {
|
|
255402
|
-
ensureNpmAssets(
|
|
256052
|
+
ensureNpmAssets(join22(__dirname5, "../assets"));
|
|
255403
256053
|
const errorReporter = new ErrorReporter;
|
|
255404
256054
|
errorReporter.registerProcessErrorHandlers();
|
|
255405
256055
|
const isNonInteractive = !process.stdin.isTTY || !process.stdout.isTTY;
|
|
@@ -255432,4 +256082,4 @@ export {
|
|
|
255432
256082
|
CLIExitError
|
|
255433
256083
|
};
|
|
255434
256084
|
|
|
255435
|
-
//# debugId=
|
|
256085
|
+
//# debugId=7A217CD3C600288564756E2164756E21
|