@base44-preview/cli 0.0.38-pr.330.d128357 → 0.0.38-pr.357.643fc18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +341 -500
- package/dist/cli/index.js.map +17 -22
- package/dist/deno-runtime/exec.ts +55 -0
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -18040,7 +18040,7 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
18040
18040
|
}
|
|
18041
18041
|
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
|
|
18042
18042
|
});
|
|
18043
|
-
function
|
|
18043
|
+
function join12(array2, separator) {
|
|
18044
18044
|
return array2 == null ? "" : nativeJoin.call(array2, separator);
|
|
18045
18045
|
}
|
|
18046
18046
|
function last(array2) {
|
|
@@ -18062,7 +18062,7 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
18062
18062
|
function nth(array2, n2) {
|
|
18063
18063
|
return array2 && array2.length ? baseNth(array2, toInteger(n2)) : undefined2;
|
|
18064
18064
|
}
|
|
18065
|
-
var
|
|
18065
|
+
var pull = baseRest(pullAll);
|
|
18066
18066
|
function pullAll(array2, values2) {
|
|
18067
18067
|
return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2) : array2;
|
|
18068
18068
|
}
|
|
@@ -19827,7 +19827,7 @@ __p += '`;
|
|
|
19827
19827
|
lodash.pickBy = pickBy;
|
|
19828
19828
|
lodash.property = property;
|
|
19829
19829
|
lodash.propertyOf = propertyOf;
|
|
19830
|
-
lodash.pull =
|
|
19830
|
+
lodash.pull = pull;
|
|
19831
19831
|
lodash.pullAll = pullAll;
|
|
19832
19832
|
lodash.pullAllBy = pullAllBy;
|
|
19833
19833
|
lodash.pullAllWith = pullAllWith;
|
|
@@ -19972,7 +19972,7 @@ __p += '`;
|
|
|
19972
19972
|
lodash.isUndefined = isUndefined;
|
|
19973
19973
|
lodash.isWeakMap = isWeakMap;
|
|
19974
19974
|
lodash.isWeakSet = isWeakSet;
|
|
19975
|
-
lodash.join =
|
|
19975
|
+
lodash.join = join12;
|
|
19976
19976
|
lodash.kebabCase = kebabCase2;
|
|
19977
19977
|
lodash.last = last;
|
|
19978
19978
|
lodash.lastIndexOf = lastIndexOf;
|
|
@@ -20601,7 +20601,7 @@ function cleanDoc(doc2) {
|
|
|
20601
20601
|
return mapDoc(doc2, (currentDoc) => cleanDocFn(currentDoc));
|
|
20602
20602
|
}
|
|
20603
20603
|
function replaceEndOfLine(doc2, replacement = literalline) {
|
|
20604
|
-
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
20604
|
+
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ? join12(replacement, currentDoc.split(`
|
|
20605
20605
|
`)) : currentDoc);
|
|
20606
20606
|
}
|
|
20607
20607
|
function canBreakFn(doc2) {
|
|
@@ -20681,7 +20681,7 @@ function indentIfBreak(contents, options) {
|
|
|
20681
20681
|
negate: options.negate
|
|
20682
20682
|
};
|
|
20683
20683
|
}
|
|
20684
|
-
function
|
|
20684
|
+
function join12(separator, docs) {
|
|
20685
20685
|
assertDoc(separator);
|
|
20686
20686
|
assertDocArray(docs);
|
|
20687
20687
|
const parts = [];
|
|
@@ -21392,7 +21392,7 @@ var init_doc = __esm(() => {
|
|
|
21392
21392
|
MODE_FLAT = Symbol("MODE_FLAT");
|
|
21393
21393
|
DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
|
|
21394
21394
|
builders = {
|
|
21395
|
-
join:
|
|
21395
|
+
join: join12,
|
|
21396
21396
|
line,
|
|
21397
21397
|
softline,
|
|
21398
21398
|
hardline,
|
|
@@ -126306,7 +126306,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
126306
126306
|
return mapDoc2(doc2, (currentDoc) => cleanDocFn2(currentDoc));
|
|
126307
126307
|
}
|
|
126308
126308
|
function replaceEndOfLine2(doc2, replacement = literalline2) {
|
|
126309
|
-
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
126309
|
+
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ? join14(replacement, currentDoc.split(`
|
|
126310
126310
|
`)) : currentDoc);
|
|
126311
126311
|
}
|
|
126312
126312
|
function canBreakFn2(doc2) {
|
|
@@ -126392,7 +126392,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
126392
126392
|
negate: options8.negate
|
|
126393
126393
|
};
|
|
126394
126394
|
}
|
|
126395
|
-
function
|
|
126395
|
+
function join14(separator, docs) {
|
|
126396
126396
|
assertDoc2(separator);
|
|
126397
126397
|
assertDocArray2(docs);
|
|
126398
126398
|
const parts = [];
|
|
@@ -127057,7 +127057,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
127057
127057
|
}
|
|
127058
127058
|
}
|
|
127059
127059
|
var builders2 = {
|
|
127060
|
-
join:
|
|
127060
|
+
join: join14,
|
|
127061
127061
|
line: line3,
|
|
127062
127062
|
softline: softline2,
|
|
127063
127063
|
hardline: hardline4,
|
|
@@ -156272,10 +156272,10 @@ var require_view = __commonJS((exports, module) => {
|
|
|
156272
156272
|
var debug = require_src4()("express:view");
|
|
156273
156273
|
var path18 = __require("node:path");
|
|
156274
156274
|
var fs28 = __require("node:fs");
|
|
156275
|
-
var
|
|
156275
|
+
var dirname12 = path18.dirname;
|
|
156276
156276
|
var basename4 = path18.basename;
|
|
156277
156277
|
var extname2 = path18.extname;
|
|
156278
|
-
var
|
|
156278
|
+
var join15 = path18.join;
|
|
156279
156279
|
var resolve6 = path18.resolve;
|
|
156280
156280
|
module.exports = View;
|
|
156281
156281
|
function View(name2, options8) {
|
|
@@ -156311,7 +156311,7 @@ var require_view = __commonJS((exports, module) => {
|
|
|
156311
156311
|
for (var i5 = 0;i5 < roots.length && !path19; i5++) {
|
|
156312
156312
|
var root2 = roots[i5];
|
|
156313
156313
|
var loc = resolve6(root2, name2);
|
|
156314
|
-
var dir =
|
|
156314
|
+
var dir = dirname12(loc);
|
|
156315
156315
|
var file2 = basename4(loc);
|
|
156316
156316
|
path19 = this.resolve(dir, file2);
|
|
156317
156317
|
}
|
|
@@ -156337,12 +156337,12 @@ var require_view = __commonJS((exports, module) => {
|
|
|
156337
156337
|
};
|
|
156338
156338
|
View.prototype.resolve = function resolve7(dir, file2) {
|
|
156339
156339
|
var ext = this.ext;
|
|
156340
|
-
var path19 =
|
|
156340
|
+
var path19 = join15(dir, file2);
|
|
156341
156341
|
var stat2 = tryStat(path19);
|
|
156342
156342
|
if (stat2 && stat2.isFile()) {
|
|
156343
156343
|
return path19;
|
|
156344
156344
|
}
|
|
156345
|
-
path19 =
|
|
156345
|
+
path19 = join15(dir, basename4(file2, ext), "index" + ext);
|
|
156346
156346
|
stat2 = tryStat(path19);
|
|
156347
156347
|
if (stat2 && stat2.isFile()) {
|
|
156348
156348
|
return path19;
|
|
@@ -160037,7 +160037,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
160037
160037
|
var Stream2 = __require("stream");
|
|
160038
160038
|
var util2 = __require("util");
|
|
160039
160039
|
var extname2 = path18.extname;
|
|
160040
|
-
var
|
|
160040
|
+
var join15 = path18.join;
|
|
160041
160041
|
var normalize = path18.normalize;
|
|
160042
160042
|
var resolve6 = path18.resolve;
|
|
160043
160043
|
var sep = path18.sep;
|
|
@@ -160209,7 +160209,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
160209
160209
|
return res;
|
|
160210
160210
|
}
|
|
160211
160211
|
parts = path19.split(sep);
|
|
160212
|
-
path19 = normalize(
|
|
160212
|
+
path19 = normalize(join15(root2, path19));
|
|
160213
160213
|
} else {
|
|
160214
160214
|
if (UP_PATH_REGEXP.test(path19)) {
|
|
160215
160215
|
debug('malicious path "%s"', path19);
|
|
@@ -160349,7 +160349,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
160349
160349
|
return self2.onStatError(err);
|
|
160350
160350
|
return self2.error(404);
|
|
160351
160351
|
}
|
|
160352
|
-
var p4 =
|
|
160352
|
+
var p4 = join15(path19, self2._index[i5]);
|
|
160353
160353
|
debug('stat "%s"', p4);
|
|
160354
160354
|
fs28.stat(p4, function(err2, stat2) {
|
|
160355
160355
|
if (err2)
|
|
@@ -164408,8 +164408,8 @@ var require_executor = __commonJS((exports, module) => {
|
|
|
164408
164408
|
}
|
|
164409
164409
|
resetBuffer() {
|
|
164410
164410
|
this.buffer = new Waterfall;
|
|
164411
|
-
this.buffer.chain(new Promise((
|
|
164412
|
-
this._triggerBuffer =
|
|
164411
|
+
this.buffer.chain(new Promise((resolve7) => {
|
|
164412
|
+
this._triggerBuffer = resolve7;
|
|
164413
164413
|
}));
|
|
164414
164414
|
if (this.ready)
|
|
164415
164415
|
this._triggerBuffer();
|
|
@@ -165429,7 +165429,7 @@ var require_storage = __commonJS((exports, module) => {
|
|
|
165429
165429
|
throw e8;
|
|
165430
165430
|
}
|
|
165431
165431
|
};
|
|
165432
|
-
var writeFileLinesAsync = (filename, lines, mode = DEFAULT_FILE_MODE) => new Promise((
|
|
165432
|
+
var writeFileLinesAsync = (filename, lines, mode = DEFAULT_FILE_MODE) => new Promise((resolve7, reject) => {
|
|
165433
165433
|
try {
|
|
165434
165434
|
const stream = writeFileStream(filename, { mode });
|
|
165435
165435
|
const readable2 = Readable6.from(lines);
|
|
@@ -165446,7 +165446,7 @@ var require_storage = __commonJS((exports, module) => {
|
|
|
165446
165446
|
if (err)
|
|
165447
165447
|
reject(err);
|
|
165448
165448
|
else
|
|
165449
|
-
|
|
165449
|
+
resolve7();
|
|
165450
165450
|
});
|
|
165451
165451
|
});
|
|
165452
165452
|
readable2.on("error", (err) => {
|
|
@@ -165617,7 +165617,7 @@ var require_persistence = __commonJS((exports, module) => {
|
|
|
165617
165617
|
return { data: tdata, indexes };
|
|
165618
165618
|
}
|
|
165619
165619
|
treatRawStreamAsync(rawStream) {
|
|
165620
|
-
return new Promise((
|
|
165620
|
+
return new Promise((resolve7, reject) => {
|
|
165621
165621
|
const dataById = {};
|
|
165622
165622
|
const indexes = {};
|
|
165623
165623
|
let corruptItems = 0;
|
|
@@ -165660,7 +165660,7 @@ var require_persistence = __commonJS((exports, module) => {
|
|
|
165660
165660
|
}
|
|
165661
165661
|
}
|
|
165662
165662
|
const data = Object.values(dataById);
|
|
165663
|
-
|
|
165663
|
+
resolve7({ data, indexes });
|
|
165664
165664
|
});
|
|
165665
165665
|
lineStream.on("error", function(err) {
|
|
165666
165666
|
reject(err, null);
|
|
@@ -191271,13 +191271,13 @@ var require_broadcast_operator = __commonJS((exports) => {
|
|
|
191271
191271
|
return true;
|
|
191272
191272
|
}
|
|
191273
191273
|
emitWithAck(ev2, ...args) {
|
|
191274
|
-
return new Promise((
|
|
191274
|
+
return new Promise((resolve7, reject) => {
|
|
191275
191275
|
args.push((err, responses) => {
|
|
191276
191276
|
if (err) {
|
|
191277
191277
|
err.responses = responses;
|
|
191278
191278
|
return reject(err);
|
|
191279
191279
|
} else {
|
|
191280
|
-
return
|
|
191280
|
+
return resolve7(responses);
|
|
191281
191281
|
}
|
|
191282
191282
|
});
|
|
191283
191283
|
this.emit(ev2, ...args);
|
|
@@ -191465,12 +191465,12 @@ var require_socket2 = __commonJS((exports) => {
|
|
|
191465
191465
|
}
|
|
191466
191466
|
emitWithAck(ev2, ...args) {
|
|
191467
191467
|
const withErr = this.flags.timeout !== undefined;
|
|
191468
|
-
return new Promise((
|
|
191468
|
+
return new Promise((resolve7, reject) => {
|
|
191469
191469
|
args.push((arg1, arg2) => {
|
|
191470
191470
|
if (withErr) {
|
|
191471
|
-
return arg1 ? reject(arg1) :
|
|
191471
|
+
return arg1 ? reject(arg1) : resolve7(arg2);
|
|
191472
191472
|
} else {
|
|
191473
|
-
return
|
|
191473
|
+
return resolve7(arg1);
|
|
191474
191474
|
}
|
|
191475
191475
|
});
|
|
191476
191476
|
this.emit(ev2, ...args);
|
|
@@ -191925,13 +191925,13 @@ var require_namespace = __commonJS((exports) => {
|
|
|
191925
191925
|
return true;
|
|
191926
191926
|
}
|
|
191927
191927
|
serverSideEmitWithAck(ev2, ...args) {
|
|
191928
|
-
return new Promise((
|
|
191928
|
+
return new Promise((resolve7, reject) => {
|
|
191929
191929
|
args.push((err, responses) => {
|
|
191930
191930
|
if (err) {
|
|
191931
191931
|
err.responses = responses;
|
|
191932
191932
|
return reject(err);
|
|
191933
191933
|
} else {
|
|
191934
|
-
return
|
|
191934
|
+
return resolve7(responses);
|
|
191935
191935
|
}
|
|
191936
191936
|
});
|
|
191937
191937
|
this.serverSideEmit(ev2, ...args);
|
|
@@ -192615,7 +192615,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
192615
192615
|
return localSockets;
|
|
192616
192616
|
}
|
|
192617
192617
|
const requestId = randomId();
|
|
192618
|
-
return new Promise((
|
|
192618
|
+
return new Promise((resolve7, reject) => {
|
|
192619
192619
|
const timeout3 = setTimeout(() => {
|
|
192620
192620
|
const storedRequest2 = this.requests.get(requestId);
|
|
192621
192621
|
if (storedRequest2) {
|
|
@@ -192625,7 +192625,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
192625
192625
|
}, opts.flags.timeout || DEFAULT_TIMEOUT);
|
|
192626
192626
|
const storedRequest = {
|
|
192627
192627
|
type: MessageType.FETCH_SOCKETS,
|
|
192628
|
-
resolve:
|
|
192628
|
+
resolve: resolve7,
|
|
192629
192629
|
timeout: timeout3,
|
|
192630
192630
|
current: 0,
|
|
192631
192631
|
expected: expectedResponseCount,
|
|
@@ -192835,7 +192835,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
192835
192835
|
return localSockets;
|
|
192836
192836
|
}
|
|
192837
192837
|
const requestId = randomId();
|
|
192838
|
-
return new Promise((
|
|
192838
|
+
return new Promise((resolve7, reject) => {
|
|
192839
192839
|
const timeout3 = setTimeout(() => {
|
|
192840
192840
|
const storedRequest2 = this.customRequests.get(requestId);
|
|
192841
192841
|
if (storedRequest2) {
|
|
@@ -192845,7 +192845,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
192845
192845
|
}, opts.flags.timeout || DEFAULT_TIMEOUT);
|
|
192846
192846
|
const storedRequest = {
|
|
192847
192847
|
type: MessageType.FETCH_SOCKETS,
|
|
192848
|
-
resolve:
|
|
192848
|
+
resolve: resolve7,
|
|
192849
192849
|
timeout: timeout3,
|
|
192850
192850
|
missingUids: new Set([...this.nodesMap.keys()]),
|
|
192851
192851
|
responses: localSockets
|
|
@@ -193574,13 +193574,13 @@ var require_dist4 = __commonJS((exports, module) => {
|
|
|
193574
193574
|
this.engine.close();
|
|
193575
193575
|
(0, uws_1.restoreAdapter)();
|
|
193576
193576
|
if (this.httpServer) {
|
|
193577
|
-
return new Promise((
|
|
193577
|
+
return new Promise((resolve7) => {
|
|
193578
193578
|
this.httpServer.close((err) => {
|
|
193579
193579
|
fn9 && fn9(err);
|
|
193580
193580
|
if (err) {
|
|
193581
193581
|
debug("server was not running");
|
|
193582
193582
|
}
|
|
193583
|
-
|
|
193583
|
+
resolve7();
|
|
193584
193584
|
});
|
|
193585
193585
|
});
|
|
193586
193586
|
} else {
|
|
@@ -206944,7 +206944,7 @@ var require_buffer_list = __commonJS((exports, module) => {
|
|
|
206944
206944
|
}
|
|
206945
206945
|
}, {
|
|
206946
206946
|
key: "join",
|
|
206947
|
-
value: function
|
|
206947
|
+
value: function join16(s5) {
|
|
206948
206948
|
if (this.length === 0)
|
|
206949
206949
|
return "";
|
|
206950
206950
|
var p4 = this.head;
|
|
@@ -208299,14 +208299,14 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
208299
208299
|
};
|
|
208300
208300
|
}
|
|
208301
208301
|
function readAndResolve(iter) {
|
|
208302
|
-
var
|
|
208303
|
-
if (
|
|
208302
|
+
var resolve7 = iter[kLastResolve];
|
|
208303
|
+
if (resolve7 !== null) {
|
|
208304
208304
|
var data = iter[kStream].read();
|
|
208305
208305
|
if (data !== null) {
|
|
208306
208306
|
iter[kLastPromise] = null;
|
|
208307
208307
|
iter[kLastResolve] = null;
|
|
208308
208308
|
iter[kLastReject] = null;
|
|
208309
|
-
|
|
208309
|
+
resolve7(createIterResult(data, false));
|
|
208310
208310
|
}
|
|
208311
208311
|
}
|
|
208312
208312
|
}
|
|
@@ -208314,13 +208314,13 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
208314
208314
|
process.nextTick(readAndResolve, iter);
|
|
208315
208315
|
}
|
|
208316
208316
|
function wrapForNext(lastPromise, iter) {
|
|
208317
|
-
return function(
|
|
208317
|
+
return function(resolve7, reject) {
|
|
208318
208318
|
lastPromise.then(function() {
|
|
208319
208319
|
if (iter[kEnded]) {
|
|
208320
|
-
|
|
208320
|
+
resolve7(createIterResult(undefined, true));
|
|
208321
208321
|
return;
|
|
208322
208322
|
}
|
|
208323
|
-
iter[kHandlePromise](
|
|
208323
|
+
iter[kHandlePromise](resolve7, reject);
|
|
208324
208324
|
}, reject);
|
|
208325
208325
|
};
|
|
208326
208326
|
}
|
|
@@ -208339,12 +208339,12 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
208339
208339
|
return Promise.resolve(createIterResult(undefined, true));
|
|
208340
208340
|
}
|
|
208341
208341
|
if (this[kStream].destroyed) {
|
|
208342
|
-
return new Promise(function(
|
|
208342
|
+
return new Promise(function(resolve7, reject) {
|
|
208343
208343
|
process.nextTick(function() {
|
|
208344
208344
|
if (_this[kError]) {
|
|
208345
208345
|
reject(_this[kError]);
|
|
208346
208346
|
} else {
|
|
208347
|
-
|
|
208347
|
+
resolve7(createIterResult(undefined, true));
|
|
208348
208348
|
}
|
|
208349
208349
|
});
|
|
208350
208350
|
});
|
|
@@ -208367,13 +208367,13 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
208367
208367
|
return this;
|
|
208368
208368
|
}), _defineProperty(_Object$setPrototypeO, "return", function _return() {
|
|
208369
208369
|
var _this2 = this;
|
|
208370
|
-
return new Promise(function(
|
|
208370
|
+
return new Promise(function(resolve7, reject) {
|
|
208371
208371
|
_this2[kStream].destroy(null, function(err) {
|
|
208372
208372
|
if (err) {
|
|
208373
208373
|
reject(err);
|
|
208374
208374
|
return;
|
|
208375
208375
|
}
|
|
208376
|
-
|
|
208376
|
+
resolve7(createIterResult(undefined, true));
|
|
208377
208377
|
});
|
|
208378
208378
|
});
|
|
208379
208379
|
}), _Object$setPrototypeO), AsyncIteratorPrototype);
|
|
@@ -208395,15 +208395,15 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
208395
208395
|
value: stream._readableState.endEmitted,
|
|
208396
208396
|
writable: true
|
|
208397
208397
|
}), _defineProperty(_Object$create, kHandlePromise, {
|
|
208398
|
-
value: function value(
|
|
208398
|
+
value: function value(resolve7, reject) {
|
|
208399
208399
|
var data = iterator[kStream].read();
|
|
208400
208400
|
if (data) {
|
|
208401
208401
|
iterator[kLastPromise] = null;
|
|
208402
208402
|
iterator[kLastResolve] = null;
|
|
208403
208403
|
iterator[kLastReject] = null;
|
|
208404
|
-
|
|
208404
|
+
resolve7(createIterResult(data, false));
|
|
208405
208405
|
} else {
|
|
208406
|
-
iterator[kLastResolve] =
|
|
208406
|
+
iterator[kLastResolve] = resolve7;
|
|
208407
208407
|
iterator[kLastReject] = reject;
|
|
208408
208408
|
}
|
|
208409
208409
|
},
|
|
@@ -208422,12 +208422,12 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
208422
208422
|
iterator[kError] = err;
|
|
208423
208423
|
return;
|
|
208424
208424
|
}
|
|
208425
|
-
var
|
|
208426
|
-
if (
|
|
208425
|
+
var resolve7 = iterator[kLastResolve];
|
|
208426
|
+
if (resolve7 !== null) {
|
|
208427
208427
|
iterator[kLastPromise] = null;
|
|
208428
208428
|
iterator[kLastResolve] = null;
|
|
208429
208429
|
iterator[kLastReject] = null;
|
|
208430
|
-
|
|
208430
|
+
resolve7(createIterResult(undefined, true));
|
|
208431
208431
|
}
|
|
208432
208432
|
iterator[kEnded] = true;
|
|
208433
208433
|
});
|
|
@@ -208439,7 +208439,7 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
208439
208439
|
|
|
208440
208440
|
// node_modules/readable-stream/lib/internal/streams/from.js
|
|
208441
208441
|
var require_from = __commonJS((exports, module) => {
|
|
208442
|
-
function asyncGeneratorStep(gen,
|
|
208442
|
+
function asyncGeneratorStep(gen, resolve7, reject, _next, _throw, key2, arg) {
|
|
208443
208443
|
try {
|
|
208444
208444
|
var info = gen[key2](arg);
|
|
208445
208445
|
var value = info.value;
|
|
@@ -208448,7 +208448,7 @@ var require_from = __commonJS((exports, module) => {
|
|
|
208448
208448
|
return;
|
|
208449
208449
|
}
|
|
208450
208450
|
if (info.done) {
|
|
208451
|
-
|
|
208451
|
+
resolve7(value);
|
|
208452
208452
|
} else {
|
|
208453
208453
|
Promise.resolve(value).then(_next, _throw);
|
|
208454
208454
|
}
|
|
@@ -208456,13 +208456,13 @@ var require_from = __commonJS((exports, module) => {
|
|
|
208456
208456
|
function _asyncToGenerator(fn9) {
|
|
208457
208457
|
return function() {
|
|
208458
208458
|
var self2 = this, args = arguments;
|
|
208459
|
-
return new Promise(function(
|
|
208459
|
+
return new Promise(function(resolve7, reject) {
|
|
208460
208460
|
var gen = fn9.apply(self2, args);
|
|
208461
208461
|
function _next(value) {
|
|
208462
|
-
asyncGeneratorStep(gen,
|
|
208462
|
+
asyncGeneratorStep(gen, resolve7, reject, _next, _throw, "next", value);
|
|
208463
208463
|
}
|
|
208464
208464
|
function _throw(err) {
|
|
208465
|
-
asyncGeneratorStep(gen,
|
|
208465
|
+
asyncGeneratorStep(gen, resolve7, reject, _next, _throw, "throw", err);
|
|
208466
208466
|
}
|
|
208467
208467
|
_next(undefined);
|
|
208468
208468
|
});
|
|
@@ -210590,7 +210590,7 @@ var require_dist5 = __commonJS((exports, module) => {
|
|
|
210590
210590
|
});
|
|
210591
210591
|
module.exports = __toCommonJS(src_exports);
|
|
210592
210592
|
var import_promises22 = __require("node:fs/promises");
|
|
210593
|
-
var
|
|
210593
|
+
var import_node_fs22 = __require("node:fs");
|
|
210594
210594
|
var DEVIN_LOCAL_PATH = "/opt/.devin";
|
|
210595
210595
|
var CURSOR2 = "cursor";
|
|
210596
210596
|
var CURSOR_CLI = "cursor-cli";
|
|
@@ -210647,7 +210647,7 @@ var require_dist5 = __commonJS((exports, module) => {
|
|
|
210647
210647
|
return { isAgent: true, agent: { name: REPLIT } };
|
|
210648
210648
|
}
|
|
210649
210649
|
try {
|
|
210650
|
-
await (0, import_promises22.access)(DEVIN_LOCAL_PATH,
|
|
210650
|
+
await (0, import_promises22.access)(DEVIN_LOCAL_PATH, import_node_fs22.constants.F_OK);
|
|
210651
210651
|
return { isAgent: true, agent: { name: DEVIN } };
|
|
210652
210652
|
} catch (error48) {}
|
|
210653
210653
|
return { isAgent: false, agent: undefined };
|
|
@@ -210671,7 +210671,7 @@ var {
|
|
|
210671
210671
|
} = import__.default;
|
|
210672
210672
|
|
|
210673
210673
|
// src/cli/commands/agents/pull.ts
|
|
210674
|
-
import { dirname as dirname8, join as
|
|
210674
|
+
import { dirname as dirname8, join as join9 } from "node:path";
|
|
210675
210675
|
|
|
210676
210676
|
// node_modules/@clack/core/dist/index.mjs
|
|
210677
210677
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
@@ -225313,6 +225313,9 @@ var UserInfoSchema = exports_external.object({
|
|
|
225313
225313
|
name: exports_external.string()
|
|
225314
225314
|
});
|
|
225315
225315
|
|
|
225316
|
+
// src/core/clients/base44-client.ts
|
|
225317
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
225318
|
+
|
|
225316
225319
|
// node_modules/ky/distribution/errors/HTTPError.js
|
|
225317
225320
|
class HTTPError extends Error {
|
|
225318
225321
|
response;
|
|
@@ -233172,7 +233175,7 @@ var generateGlobTasks = normalizeArguments(generateTasks);
|
|
|
233172
233175
|
var generateGlobTasksSync = normalizeArgumentsSync(generateTasksSync);
|
|
233173
233176
|
|
|
233174
233177
|
// src/core/project/config.ts
|
|
233175
|
-
import { dirname as dirname6, join as
|
|
233178
|
+
import { dirname as dirname6, join as join6 } from "node:path";
|
|
233176
233179
|
|
|
233177
233180
|
// src/core/resources/agent/schema.ts
|
|
233178
233181
|
var EntityOperationSchema = exports_external.enum(["create", "update", "delete", "read"]);
|
|
@@ -233902,23 +233905,11 @@ var BackendFunctionSchema = FunctionConfigSchema.extend({
|
|
|
233902
233905
|
entryPath: exports_external.string().min(1, "Entry path cannot be empty"),
|
|
233903
233906
|
filePaths: exports_external.array(exports_external.string()).min(1, "Function must have at least one file")
|
|
233904
233907
|
});
|
|
233905
|
-
var
|
|
233906
|
-
|
|
233907
|
-
|
|
233908
|
-
|
|
233909
|
-
name: exports_external.string(),
|
|
233910
|
-
type: exports_external.string(),
|
|
233911
|
-
is_active: exports_external.boolean()
|
|
233912
|
-
});
|
|
233913
|
-
var FunctionInfoSchema = exports_external.object({
|
|
233914
|
-
name: exports_external.string(),
|
|
233915
|
-
deployment_id: exports_external.string(),
|
|
233916
|
-
entry: exports_external.string(),
|
|
233917
|
-
files: exports_external.array(FunctionFileSchema),
|
|
233918
|
-
automations: exports_external.array(FunctionAutomationInfoSchema)
|
|
233919
|
-
});
|
|
233920
|
-
var ListFunctionsResponseSchema = exports_external.object({
|
|
233921
|
-
functions: exports_external.array(FunctionInfoSchema)
|
|
233908
|
+
var DeployFunctionsResponseSchema = exports_external.object({
|
|
233909
|
+
deployed: exports_external.array(exports_external.string()),
|
|
233910
|
+
deleted: exports_external.array(exports_external.string()),
|
|
233911
|
+
skipped: exports_external.array(exports_external.string()).optional().nullable(),
|
|
233912
|
+
errors: exports_external.array(exports_external.object({ name: exports_external.string(), message: exports_external.string() })).nullable()
|
|
233922
233913
|
});
|
|
233923
233914
|
var LogLevelSchema = exports_external.enum(["info", "warning", "error", "debug"]);
|
|
233924
233915
|
var FunctionLogEntrySchema = exports_external.object({
|
|
@@ -233929,37 +233920,29 @@ var FunctionLogEntrySchema = exports_external.object({
|
|
|
233929
233920
|
var FunctionLogsResponseSchema = exports_external.array(FunctionLogEntrySchema);
|
|
233930
233921
|
|
|
233931
233922
|
// src/core/resources/function/api.ts
|
|
233932
|
-
|
|
233933
|
-
|
|
233934
|
-
|
|
233935
|
-
|
|
233936
|
-
|
|
233937
|
-
|
|
233938
|
-
|
|
233939
|
-
}
|
|
233940
|
-
const result = DeploySingleFunctionResponseSchema.safeParse(await response.json());
|
|
233941
|
-
if (!result.success) {
|
|
233942
|
-
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
233943
|
-
}
|
|
233944
|
-
return result.data;
|
|
233945
|
-
}
|
|
233946
|
-
async function deleteSingleFunction(name2) {
|
|
233947
|
-
const appClient = getAppClient();
|
|
233948
|
-
try {
|
|
233949
|
-
await appClient.delete(`backend-functions/${encodeURIComponent(name2)}`, { timeout: 60000 });
|
|
233950
|
-
} catch (error48) {
|
|
233951
|
-
throw await ApiError.fromHttpError(error48, `deleting function "${name2}"`);
|
|
233952
|
-
}
|
|
233923
|
+
function toDeployPayloadItem(fn) {
|
|
233924
|
+
return {
|
|
233925
|
+
name: fn.name,
|
|
233926
|
+
entry: fn.entry,
|
|
233927
|
+
files: fn.files,
|
|
233928
|
+
automations: fn.automations
|
|
233929
|
+
};
|
|
233953
233930
|
}
|
|
233954
|
-
async function
|
|
233931
|
+
async function deployFunctions(functions) {
|
|
233955
233932
|
const appClient = getAppClient();
|
|
233933
|
+
const payload = {
|
|
233934
|
+
functions: functions.map(toDeployPayloadItem)
|
|
233935
|
+
};
|
|
233956
233936
|
let response;
|
|
233957
233937
|
try {
|
|
233958
|
-
response = await appClient.
|
|
233938
|
+
response = await appClient.put("backend-functions", {
|
|
233939
|
+
json: payload,
|
|
233940
|
+
timeout: false
|
|
233941
|
+
});
|
|
233959
233942
|
} catch (error48) {
|
|
233960
|
-
throw await ApiError.fromHttpError(error48, "
|
|
233943
|
+
throw await ApiError.fromHttpError(error48, "deploying functions");
|
|
233961
233944
|
}
|
|
233962
|
-
const result =
|
|
233945
|
+
const result = DeployFunctionsResponseSchema.safeParse(await response.json());
|
|
233963
233946
|
if (!result.success) {
|
|
233964
233947
|
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
233965
233948
|
}
|
|
@@ -234082,131 +234065,24 @@ async function readAllFunctions(functionsDir) {
|
|
|
234082
234065
|
import { dirname as dirname5, relative as relative2 } from "node:path";
|
|
234083
234066
|
async function loadFunctionCode(fn) {
|
|
234084
234067
|
const functionDir = dirname5(fn.entryPath);
|
|
234085
|
-
const
|
|
234068
|
+
const loadedFiles = await Promise.all(fn.filePaths.map(async (filePath) => {
|
|
234086
234069
|
const content = await readTextFile(filePath);
|
|
234087
234070
|
const path11 = relative2(functionDir, filePath).split(/[/\\]/).join("/");
|
|
234088
234071
|
return { path: path11, content };
|
|
234089
234072
|
}));
|
|
234090
|
-
return { ...fn, files:
|
|
234091
|
-
}
|
|
234092
|
-
async function deployOne(fn) {
|
|
234093
|
-
const start = Date.now();
|
|
234094
|
-
try {
|
|
234095
|
-
const functionWithCode = await loadFunctionCode(fn);
|
|
234096
|
-
const response = await deploySingleFunction(functionWithCode.name, {
|
|
234097
|
-
entry: functionWithCode.entry,
|
|
234098
|
-
files: functionWithCode.files,
|
|
234099
|
-
automations: functionWithCode.automations
|
|
234100
|
-
});
|
|
234101
|
-
return {
|
|
234102
|
-
name: functionWithCode.name,
|
|
234103
|
-
status: response.status,
|
|
234104
|
-
durationMs: Date.now() - start
|
|
234105
|
-
};
|
|
234106
|
-
} catch (error48) {
|
|
234107
|
-
return {
|
|
234108
|
-
name: fn.name,
|
|
234109
|
-
status: "error",
|
|
234110
|
-
error: error48 instanceof Error ? error48.message : String(error48)
|
|
234111
|
-
};
|
|
234112
|
-
}
|
|
234113
|
-
}
|
|
234114
|
-
async function deployFunctionsSequentially(functions, options) {
|
|
234115
|
-
if (functions.length === 0)
|
|
234116
|
-
return [];
|
|
234117
|
-
const results = [];
|
|
234118
|
-
for (const fn of functions) {
|
|
234119
|
-
options?.onStart?.([fn.name]);
|
|
234120
|
-
const result = await deployOne(fn);
|
|
234121
|
-
results.push(result);
|
|
234122
|
-
options?.onResult?.(result);
|
|
234123
|
-
}
|
|
234124
|
-
return results;
|
|
234125
|
-
}
|
|
234126
|
-
async function pruneRemovedFunctions(localFunctionNames) {
|
|
234127
|
-
const remote = await listDeployedFunctions();
|
|
234128
|
-
const localSet = new Set(localFunctionNames);
|
|
234129
|
-
const toDelete = remote.functions.filter((f) => !localSet.has(f.name));
|
|
234130
|
-
const results = [];
|
|
234131
|
-
for (const fn of toDelete) {
|
|
234132
|
-
try {
|
|
234133
|
-
await deleteSingleFunction(fn.name);
|
|
234134
|
-
results.push({ name: fn.name, deleted: true });
|
|
234135
|
-
} catch (error48) {
|
|
234136
|
-
results.push({
|
|
234137
|
-
name: fn.name,
|
|
234138
|
-
deleted: false,
|
|
234139
|
-
error: error48 instanceof Error ? error48.message : String(error48)
|
|
234140
|
-
});
|
|
234141
|
-
}
|
|
234142
|
-
}
|
|
234143
|
-
return results;
|
|
234073
|
+
return { ...fn, files: loadedFiles };
|
|
234144
234074
|
}
|
|
234145
|
-
|
|
234146
|
-
|
|
234147
|
-
|
|
234148
|
-
const written = [];
|
|
234149
|
-
const skipped = [];
|
|
234150
|
-
for (const fn of functions) {
|
|
234151
|
-
const functionDir = join6(functionsDir, fn.name);
|
|
234152
|
-
const configPath = join6(functionDir, "function.jsonc");
|
|
234153
|
-
if (await isFunctionUnchanged(functionDir, fn)) {
|
|
234154
|
-
skipped.push(fn.name);
|
|
234155
|
-
continue;
|
|
234156
|
-
}
|
|
234157
|
-
const config5 = {
|
|
234158
|
-
name: fn.name,
|
|
234159
|
-
entry: fn.entry
|
|
234160
|
-
};
|
|
234161
|
-
if (fn.automations.length > 0) {
|
|
234162
|
-
config5.automations = fn.automations;
|
|
234163
|
-
}
|
|
234164
|
-
await writeJsonFile(configPath, config5);
|
|
234165
|
-
for (const file2 of fn.files) {
|
|
234166
|
-
await writeFile(join6(functionDir, file2.path), file2.content);
|
|
234167
|
-
}
|
|
234168
|
-
written.push(fn.name);
|
|
234169
|
-
}
|
|
234170
|
-
return { written, skipped };
|
|
234171
|
-
}
|
|
234172
|
-
async function isFunctionUnchanged(functionDir, fn) {
|
|
234173
|
-
if (!await pathExists(functionDir)) {
|
|
234174
|
-
return false;
|
|
234175
|
-
}
|
|
234176
|
-
const configPath = join6(functionDir, "function.jsonc");
|
|
234177
|
-
try {
|
|
234178
|
-
const localConfig = await readJsonFile(configPath);
|
|
234179
|
-
if (localConfig.entry !== fn.entry) {
|
|
234180
|
-
return false;
|
|
234181
|
-
}
|
|
234182
|
-
const localAuto = JSON.stringify(localConfig.automations ?? []);
|
|
234183
|
-
const remoteAuto = JSON.stringify(fn.automations);
|
|
234184
|
-
if (localAuto !== remoteAuto) {
|
|
234185
|
-
return false;
|
|
234186
|
-
}
|
|
234187
|
-
} catch {
|
|
234188
|
-
return false;
|
|
234189
|
-
}
|
|
234190
|
-
for (const file2 of fn.files) {
|
|
234191
|
-
const filePath = join6(functionDir, file2.path);
|
|
234192
|
-
if (!await pathExists(filePath)) {
|
|
234193
|
-
return false;
|
|
234194
|
-
}
|
|
234195
|
-
try {
|
|
234196
|
-
const localContent = await readTextFile(filePath);
|
|
234197
|
-
if (localContent !== file2.content) {
|
|
234198
|
-
return false;
|
|
234199
|
-
}
|
|
234200
|
-
} catch {
|
|
234201
|
-
return false;
|
|
234202
|
-
}
|
|
234075
|
+
async function pushFunctions(functions) {
|
|
234076
|
+
if (functions.length === 0) {
|
|
234077
|
+
return { deployed: [], deleted: [], skipped: [], errors: null };
|
|
234203
234078
|
}
|
|
234204
|
-
|
|
234079
|
+
const functionsWithCode = await Promise.all(functions.map(loadFunctionCode));
|
|
234080
|
+
return deployFunctions(functionsWithCode);
|
|
234205
234081
|
}
|
|
234206
234082
|
// src/core/resources/function/resource.ts
|
|
234207
234083
|
var functionResource = {
|
|
234208
234084
|
readAll: readAllFunctions,
|
|
234209
|
-
push:
|
|
234085
|
+
push: pushFunctions
|
|
234210
234086
|
};
|
|
234211
234087
|
// src/core/project/config.ts
|
|
234212
234088
|
async function findConfigInDir(dir) {
|
|
@@ -234247,10 +234123,10 @@ async function readProjectConfig(projectRoot) {
|
|
|
234247
234123
|
const project = result.data;
|
|
234248
234124
|
const configDir = dirname6(configPath);
|
|
234249
234125
|
const [entities, functions, agents, connectors] = await Promise.all([
|
|
234250
|
-
entityResource.readAll(
|
|
234251
|
-
functionResource.readAll(
|
|
234252
|
-
agentResource.readAll(
|
|
234253
|
-
connectorResource.readAll(
|
|
234126
|
+
entityResource.readAll(join6(configDir, project.entitiesDir)),
|
|
234127
|
+
functionResource.readAll(join6(configDir, project.functionsDir)),
|
|
234128
|
+
agentResource.readAll(join6(configDir, project.agentsDir)),
|
|
234129
|
+
connectorResource.readAll(join6(configDir, project.connectorsDir))
|
|
234254
234130
|
]);
|
|
234255
234131
|
return {
|
|
234256
234132
|
project: { ...project, root, configPath },
|
|
@@ -234347,7 +234223,7 @@ async function readAppConfig(projectRoot) {
|
|
|
234347
234223
|
// src/core/project/template.ts
|
|
234348
234224
|
var import_ejs = __toESM(require_ejs(), 1);
|
|
234349
234225
|
var import_front_matter = __toESM(require_front_matter(), 1);
|
|
234350
|
-
import { dirname as dirname7, join as
|
|
234226
|
+
import { dirname as dirname7, join as join7 } from "node:path";
|
|
234351
234227
|
async function listTemplates() {
|
|
234352
234228
|
const parsed = await readJsonFile(getTemplatesIndexPath());
|
|
234353
234229
|
const result = TemplatesConfigSchema.safeParse(parsed);
|
|
@@ -234357,23 +234233,23 @@ async function listTemplates() {
|
|
|
234357
234233
|
return result.data.templates;
|
|
234358
234234
|
}
|
|
234359
234235
|
async function renderTemplate(template, destPath, data) {
|
|
234360
|
-
const templateDir =
|
|
234236
|
+
const templateDir = join7(getTemplatesDir(), template.path);
|
|
234361
234237
|
const files = await globby("**/*", {
|
|
234362
234238
|
cwd: templateDir,
|
|
234363
234239
|
dot: true,
|
|
234364
234240
|
onlyFiles: true
|
|
234365
234241
|
});
|
|
234366
234242
|
for (const file2 of files) {
|
|
234367
|
-
const srcPath =
|
|
234243
|
+
const srcPath = join7(templateDir, file2);
|
|
234368
234244
|
try {
|
|
234369
234245
|
if (file2.endsWith(".ejs")) {
|
|
234370
234246
|
const rendered = await import_ejs.default.renderFile(srcPath, data);
|
|
234371
234247
|
const { attributes, body } = import_front_matter.default(rendered);
|
|
234372
|
-
const destFile = attributes.outputFileName ?
|
|
234373
|
-
const destFilePath =
|
|
234248
|
+
const destFile = attributes.outputFileName ? join7(dirname7(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
|
|
234249
|
+
const destFilePath = join7(destPath, destFile);
|
|
234374
234250
|
await writeFile(destFilePath, body);
|
|
234375
234251
|
} else {
|
|
234376
|
-
const destFilePath =
|
|
234252
|
+
const destFilePath = join7(destPath, file2);
|
|
234377
234253
|
await copyFile(srcPath, destFilePath);
|
|
234378
234254
|
}
|
|
234379
234255
|
} catch (error48) {
|
|
@@ -234476,7 +234352,7 @@ async function getSiteFilePaths(outputDir) {
|
|
|
234476
234352
|
// src/core/site/deploy.ts
|
|
234477
234353
|
import { randomUUID } from "node:crypto";
|
|
234478
234354
|
import { tmpdir } from "node:os";
|
|
234479
|
-
import { join as
|
|
234355
|
+
import { join as join8 } from "node:path";
|
|
234480
234356
|
async function deploySite(siteOutputDir) {
|
|
234481
234357
|
if (!await pathExists(siteOutputDir)) {
|
|
234482
234358
|
throw new InvalidInputError(`Output directory does not exist: ${siteOutputDir}. Make sure to build your project first.`, {
|
|
@@ -234493,7 +234369,7 @@ async function deploySite(siteOutputDir) {
|
|
|
234493
234369
|
]
|
|
234494
234370
|
});
|
|
234495
234371
|
}
|
|
234496
|
-
const archivePath =
|
|
234372
|
+
const archivePath = join8(tmpdir(), `base44-site-${randomUUID()}.tar.gz`);
|
|
234497
234373
|
try {
|
|
234498
234374
|
await createArchive(siteOutputDir, archivePath);
|
|
234499
234375
|
return await uploadSite(archivePath);
|
|
@@ -234518,13 +234394,10 @@ function hasResourcesToDeploy(projectData) {
|
|
|
234518
234394
|
const hasConnectors = connectors.length > 0;
|
|
234519
234395
|
return hasEntities || hasFunctions || hasAgents || hasConnectors || hasSite;
|
|
234520
234396
|
}
|
|
234521
|
-
async function deployAll(projectData
|
|
234397
|
+
async function deployAll(projectData) {
|
|
234522
234398
|
const { project, entities, functions, agents, connectors } = projectData;
|
|
234523
234399
|
await entityResource.push(entities);
|
|
234524
|
-
await
|
|
234525
|
-
onStart: options?.onFunctionStart,
|
|
234526
|
-
onResult: options?.onFunctionResult
|
|
234527
|
-
});
|
|
234400
|
+
await functionResource.push(functions);
|
|
234528
234401
|
await agentResource.push(agents);
|
|
234529
234402
|
const { results: connectorResults } = await pushConnectors(connectors);
|
|
234530
234403
|
if (project.site?.outputDirectory) {
|
|
@@ -234558,8 +234431,12 @@ async function handleUnauthorized(request, _options, response) {
|
|
|
234558
234431
|
return;
|
|
234559
234432
|
}
|
|
234560
234433
|
retriedRequests.add(request);
|
|
234434
|
+
const requestId = request.headers.get("X-Request-ID");
|
|
234561
234435
|
return distribution_default(request.clone(), {
|
|
234562
|
-
headers: {
|
|
234436
|
+
headers: {
|
|
234437
|
+
...requestId && { "X-Request-ID": requestId },
|
|
234438
|
+
Authorization: `Bearer ${newAccessToken}`
|
|
234439
|
+
}
|
|
234563
234440
|
});
|
|
234564
234441
|
}
|
|
234565
234442
|
var base44Client = distribution_default.create({
|
|
@@ -234569,6 +234446,9 @@ var base44Client = distribution_default.create({
|
|
|
234569
234446
|
},
|
|
234570
234447
|
hooks: {
|
|
234571
234448
|
beforeRequest: [
|
|
234449
|
+
(request) => {
|
|
234450
|
+
request.headers.set("X-Request-ID", randomUUID2());
|
|
234451
|
+
},
|
|
234572
234452
|
captureRequestBody,
|
|
234573
234453
|
async (request) => {
|
|
234574
234454
|
try {
|
|
@@ -234594,10 +234474,18 @@ function getAppClient() {
|
|
|
234594
234474
|
});
|
|
234595
234475
|
}
|
|
234596
234476
|
// src/core/clients/oauth-client.ts
|
|
234477
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
234597
234478
|
var oauthClient = distribution_default.create({
|
|
234598
234479
|
prefixUrl: getBase44ApiUrl(),
|
|
234599
234480
|
headers: {
|
|
234600
234481
|
"User-Agent": "Base44 CLI"
|
|
234482
|
+
},
|
|
234483
|
+
hooks: {
|
|
234484
|
+
beforeRequest: [
|
|
234485
|
+
(request) => {
|
|
234486
|
+
request.headers.set("X-Request-ID", randomUUID3());
|
|
234487
|
+
}
|
|
234488
|
+
]
|
|
234601
234489
|
}
|
|
234602
234490
|
});
|
|
234603
234491
|
// src/core/auth/api.ts
|
|
@@ -234742,7 +234630,8 @@ async function deleteSecret(name2) {
|
|
|
234742
234630
|
let response;
|
|
234743
234631
|
try {
|
|
234744
234632
|
response = await appClient.delete("secrets", {
|
|
234745
|
-
searchParams: { secret_name: name2 }
|
|
234633
|
+
searchParams: { secret_name: name2 },
|
|
234634
|
+
timeout: false
|
|
234746
234635
|
});
|
|
234747
234636
|
} catch (error48) {
|
|
234748
234637
|
throw await ApiError.fromHttpError(error48, "deleting secret");
|
|
@@ -242258,7 +242147,7 @@ function getDashboardUrl(projectId) {
|
|
|
242258
242147
|
async function pullAgentsAction() {
|
|
242259
242148
|
const { project: project2 } = await readProjectConfig();
|
|
242260
242149
|
const configDir = dirname8(project2.configPath);
|
|
242261
|
-
const agentsDir =
|
|
242150
|
+
const agentsDir = join9(configDir, project2.agentsDir);
|
|
242262
242151
|
const remoteAgents = await runTask("Fetching agents from Base44", async () => {
|
|
242263
242152
|
return await fetchAgents();
|
|
242264
242153
|
}, {
|
|
@@ -242352,11 +242241,11 @@ function getWhoamiCommand(context) {
|
|
|
242352
242241
|
}
|
|
242353
242242
|
|
|
242354
242243
|
// src/cli/commands/connectors/pull.ts
|
|
242355
|
-
import { dirname as dirname9, join as
|
|
242244
|
+
import { dirname as dirname9, join as join10 } from "node:path";
|
|
242356
242245
|
async function pullConnectorsAction() {
|
|
242357
242246
|
const { project: project2 } = await readProjectConfig();
|
|
242358
242247
|
const configDir = dirname9(project2.configPath);
|
|
242359
|
-
const connectorsDir =
|
|
242248
|
+
const connectorsDir = join10(configDir, project2.connectorsDir);
|
|
242360
242249
|
const remoteConnectors = await runTask("Fetching connectors from Base44", async () => {
|
|
242361
242250
|
return await listConnectors();
|
|
242362
242251
|
}, {
|
|
@@ -243204,225 +243093,46 @@ function getEntitiesPushCommand(context) {
|
|
|
243204
243093
|
}));
|
|
243205
243094
|
}
|
|
243206
243095
|
|
|
243207
|
-
// src/cli/utils/parseNames.ts
|
|
243208
|
-
function parseNames(args) {
|
|
243209
|
-
return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
|
|
243210
|
-
}
|
|
243211
|
-
|
|
243212
|
-
// src/cli/commands/functions/delete.ts
|
|
243213
|
-
async function deleteFunctionsAction(names) {
|
|
243214
|
-
let deleted = 0;
|
|
243215
|
-
let notFound = 0;
|
|
243216
|
-
let errors4 = 0;
|
|
243217
|
-
let completed = 0;
|
|
243218
|
-
const total = names.length;
|
|
243219
|
-
for (const name2 of names) {
|
|
243220
|
-
R2.step(theme.styles.dim(`[${completed + 1}/${total}] Deleting ${name2}...`));
|
|
243221
|
-
try {
|
|
243222
|
-
await deleteSingleFunction(name2);
|
|
243223
|
-
R2.success(`${name2.padEnd(25)} deleted`);
|
|
243224
|
-
deleted++;
|
|
243225
|
-
} catch (error48) {
|
|
243226
|
-
if (error48 instanceof ApiError && error48.statusCode === 404) {
|
|
243227
|
-
R2.warn(`${name2.padEnd(25)} not found`);
|
|
243228
|
-
notFound++;
|
|
243229
|
-
} else {
|
|
243230
|
-
R2.error(`${name2.padEnd(25)} error: ${error48 instanceof Error ? error48.message : String(error48)}`);
|
|
243231
|
-
errors4++;
|
|
243232
|
-
}
|
|
243233
|
-
}
|
|
243234
|
-
completed++;
|
|
243235
|
-
}
|
|
243236
|
-
if (names.length === 1) {
|
|
243237
|
-
if (deleted)
|
|
243238
|
-
return { outroMessage: `Function "${names[0]}" deleted` };
|
|
243239
|
-
if (notFound)
|
|
243240
|
-
return { outroMessage: `Function "${names[0]}" not found` };
|
|
243241
|
-
return { outroMessage: `Failed to delete "${names[0]}"` };
|
|
243242
|
-
}
|
|
243243
|
-
const parts = [];
|
|
243244
|
-
if (deleted > 0)
|
|
243245
|
-
parts.push(`${deleted}/${total} deleted`);
|
|
243246
|
-
if (notFound > 0)
|
|
243247
|
-
parts.push(`${notFound} not found`);
|
|
243248
|
-
if (errors4 > 0)
|
|
243249
|
-
parts.push(`${errors4} error${errors4 !== 1 ? "s" : ""}`);
|
|
243250
|
-
return { outroMessage: parts.join(", ") };
|
|
243251
|
-
}
|
|
243252
|
-
function getDeleteCommand(context) {
|
|
243253
|
-
return new Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").action(async (rawNames) => {
|
|
243254
|
-
await runCommand(() => {
|
|
243255
|
-
const names = parseNames(rawNames);
|
|
243256
|
-
if (names.length === 0) {
|
|
243257
|
-
throw new InvalidInputError("At least one function name is required");
|
|
243258
|
-
}
|
|
243259
|
-
return deleteFunctionsAction(names);
|
|
243260
|
-
}, { requireAuth: true }, context);
|
|
243261
|
-
});
|
|
243262
|
-
}
|
|
243263
|
-
|
|
243264
|
-
// src/cli/utils/formatDeployResult.ts
|
|
243265
|
-
function formatDuration(ms) {
|
|
243266
|
-
return `${(ms / 1000).toFixed(1)}s`;
|
|
243267
|
-
}
|
|
243268
|
-
function formatDeployResult(result) {
|
|
243269
|
-
const label = result.name.padEnd(25);
|
|
243270
|
-
if (result.status === "deployed") {
|
|
243271
|
-
const timing = result.durationMs ? theme.styles.dim(` (${formatDuration(result.durationMs)})`) : "";
|
|
243272
|
-
R2.success(`${label} deployed${timing}`);
|
|
243273
|
-
} else if (result.status === "unchanged") {
|
|
243274
|
-
R2.success(`${label} unchanged`);
|
|
243275
|
-
} else {
|
|
243276
|
-
R2.error(`${label} error: ${result.error}`);
|
|
243277
|
-
}
|
|
243278
|
-
}
|
|
243279
|
-
|
|
243280
243096
|
// src/cli/commands/functions/deploy.ts
|
|
243281
|
-
function
|
|
243282
|
-
if (names.length === 0)
|
|
243283
|
-
return allFunctions;
|
|
243284
|
-
const notFound = names.filter((n2) => !allFunctions.some((f) => f.name === n2));
|
|
243285
|
-
if (notFound.length > 0) {
|
|
243286
|
-
throw new InvalidInputError(`Function${notFound.length > 1 ? "s" : ""} not found in project: ${notFound.join(", ")}`);
|
|
243287
|
-
}
|
|
243288
|
-
return allFunctions.filter((f) => names.includes(f.name));
|
|
243289
|
-
}
|
|
243290
|
-
function formatPruneResults(pruneResults) {
|
|
243291
|
-
for (const pruneResult of pruneResults) {
|
|
243292
|
-
if (pruneResult.deleted) {
|
|
243293
|
-
R2.success(`${pruneResult.name.padEnd(25)} deleted`);
|
|
243294
|
-
} else {
|
|
243295
|
-
R2.error(`${pruneResult.name.padEnd(25)} error: ${pruneResult.error}`);
|
|
243296
|
-
}
|
|
243297
|
-
}
|
|
243298
|
-
if (pruneResults.length > 0) {
|
|
243299
|
-
const pruned = pruneResults.filter((r) => r.deleted).length;
|
|
243300
|
-
R2.info(`${pruned} function${pruned !== 1 ? "s" : ""} removed`);
|
|
243301
|
-
}
|
|
243302
|
-
}
|
|
243303
|
-
function buildDeploySummary(results) {
|
|
243304
|
-
const deployed = results.filter((r) => r.status !== "error").length;
|
|
243305
|
-
const failed = results.filter((r) => r.status === "error").length;
|
|
243306
|
-
const parts = [];
|
|
243307
|
-
if (deployed > 0)
|
|
243308
|
-
parts.push(`${deployed}/${results.length} deployed`);
|
|
243309
|
-
if (failed > 0)
|
|
243310
|
-
parts.push(`${failed} error${failed !== 1 ? "s" : ""}`);
|
|
243311
|
-
return parts.join(", ") || "No functions deployed";
|
|
243312
|
-
}
|
|
243313
|
-
async function deployFunctionsAction(names, options) {
|
|
243314
|
-
if (options.force && names.length > 0) {
|
|
243315
|
-
throw new InvalidInputError("--force cannot be used when specifying function names");
|
|
243316
|
-
}
|
|
243097
|
+
async function deployFunctionsAction() {
|
|
243317
243098
|
const { functions } = await readProjectConfig();
|
|
243318
|
-
|
|
243319
|
-
if (toDeploy.length === 0) {
|
|
243099
|
+
if (functions.length === 0) {
|
|
243320
243100
|
return {
|
|
243321
243101
|
outroMessage: "No functions found. Create functions in the 'functions' directory."
|
|
243322
243102
|
};
|
|
243323
243103
|
}
|
|
243324
|
-
R2.info(`Found ${
|
|
243325
|
-
|
|
243326
|
-
|
|
243327
|
-
const results = await deployFunctionsSequentially(toDeploy, {
|
|
243328
|
-
onStart: (startNames) => {
|
|
243329
|
-
const label = startNames.length === 1 ? startNames[0] : `${startNames.length} functions`;
|
|
243330
|
-
R2.step(theme.styles.dim(`[${completed + 1}/${total}] Deploying ${label}...`));
|
|
243331
|
-
},
|
|
243332
|
-
onResult: (result) => {
|
|
243333
|
-
completed++;
|
|
243334
|
-
formatDeployResult(result);
|
|
243335
|
-
}
|
|
243336
|
-
});
|
|
243337
|
-
if (options.force) {
|
|
243338
|
-
R2.info("Removing remote functions not found locally...");
|
|
243339
|
-
const allLocalNames = functions.map((f) => f.name);
|
|
243340
|
-
const pruneResults = await pruneRemovedFunctions(allLocalNames);
|
|
243341
|
-
formatPruneResults(pruneResults);
|
|
243342
|
-
}
|
|
243343
|
-
return { outroMessage: buildDeploySummary(results) };
|
|
243344
|
-
}
|
|
243345
|
-
function getDeployCommand(context) {
|
|
243346
|
-
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) => {
|
|
243347
|
-
await runCommand(() => {
|
|
243348
|
-
const names = parseNames(rawNames);
|
|
243349
|
-
return deployFunctionsAction(names, options);
|
|
243350
|
-
}, { requireAuth: true }, context);
|
|
243351
|
-
});
|
|
243352
|
-
}
|
|
243353
|
-
|
|
243354
|
-
// src/cli/commands/functions/list.ts
|
|
243355
|
-
async function listFunctionsAction() {
|
|
243356
|
-
const { functions } = await listDeployedFunctions();
|
|
243357
|
-
if (functions.length === 0) {
|
|
243358
|
-
return { outroMessage: "No functions on remote" };
|
|
243359
|
-
}
|
|
243360
|
-
for (const fn of functions) {
|
|
243361
|
-
const autoCount = fn.automations.length;
|
|
243362
|
-
const autoLabel = autoCount > 0 ? theme.styles.dim(` (${autoCount} automation${autoCount > 1 ? "s" : ""})`) : "";
|
|
243363
|
-
R2.message(` ${fn.name}${autoLabel}`);
|
|
243364
|
-
}
|
|
243365
|
-
return {
|
|
243366
|
-
outroMessage: `${functions.length} function${functions.length !== 1 ? "s" : ""} on remote`
|
|
243367
|
-
};
|
|
243368
|
-
}
|
|
243369
|
-
function getListCommand(context) {
|
|
243370
|
-
return new Command("list").description("List all deployed functions").action(async () => {
|
|
243371
|
-
await runCommand(listFunctionsAction, { requireAuth: true }, context);
|
|
243372
|
-
});
|
|
243373
|
-
}
|
|
243374
|
-
|
|
243375
|
-
// src/cli/commands/functions/pull.ts
|
|
243376
|
-
import { dirname as dirname10, join as join12 } from "node:path";
|
|
243377
|
-
async function pullFunctionsAction(name2) {
|
|
243378
|
-
const { project: project2 } = await readProjectConfig();
|
|
243379
|
-
const configDir = dirname10(project2.configPath);
|
|
243380
|
-
const functionsDir = join12(configDir, project2.functionsDir);
|
|
243381
|
-
const remoteFunctions = await runTask("Fetching functions from Base44", async () => {
|
|
243382
|
-
const { functions } = await listDeployedFunctions();
|
|
243383
|
-
return functions;
|
|
243104
|
+
R2.info(`Found ${functions.length} ${functions.length === 1 ? "function" : "functions"} to deploy`);
|
|
243105
|
+
const result = await runTask("Deploying functions to Base44", async () => {
|
|
243106
|
+
return await pushFunctions(functions);
|
|
243384
243107
|
}, {
|
|
243385
|
-
successMessage: "Functions
|
|
243386
|
-
errorMessage: "Failed to
|
|
243108
|
+
successMessage: "Functions deployed successfully",
|
|
243109
|
+
errorMessage: "Failed to deploy functions"
|
|
243387
243110
|
});
|
|
243388
|
-
|
|
243389
|
-
|
|
243390
|
-
return {
|
|
243391
|
-
outroMessage: `Function "${name2}" not found on remote`
|
|
243392
|
-
};
|
|
243111
|
+
if (result.deployed.length > 0) {
|
|
243112
|
+
R2.success(`Deployed: ${result.deployed.join(", ")}`);
|
|
243393
243113
|
}
|
|
243394
|
-
if (
|
|
243395
|
-
|
|
243396
|
-
}
|
|
243397
|
-
const { written, skipped } = await runTask("Writing function files", async () => {
|
|
243398
|
-
return await writeFunctions(functionsDir, toPull);
|
|
243399
|
-
}, {
|
|
243400
|
-
successMessage: "Function files written successfully",
|
|
243401
|
-
errorMessage: "Failed to write function files"
|
|
243402
|
-
});
|
|
243403
|
-
for (const name3 of written) {
|
|
243404
|
-
R2.success(`${name3.padEnd(25)} written`);
|
|
243114
|
+
if (result.deleted.length > 0) {
|
|
243115
|
+
R2.warn(`Deleted: ${result.deleted.join(", ")}`);
|
|
243405
243116
|
}
|
|
243406
|
-
|
|
243407
|
-
|
|
243117
|
+
if (result.errors && result.errors.length > 0) {
|
|
243118
|
+
throw new ApiError("Function deployment errors", {
|
|
243119
|
+
details: result.errors.map((e2) => `'${e2.name}': ${e2.message}`),
|
|
243120
|
+
hints: [
|
|
243121
|
+
{ message: "Check the function code for syntax errors" },
|
|
243122
|
+
{ message: "Ensure all imports are valid" }
|
|
243123
|
+
]
|
|
243124
|
+
});
|
|
243408
243125
|
}
|
|
243409
|
-
return {
|
|
243410
|
-
outroMessage: `Pulled ${toPull.length} function${toPull.length !== 1 ? "s" : ""} to ${functionsDir}`
|
|
243411
|
-
};
|
|
243412
|
-
}
|
|
243413
|
-
function getPullCommand(context) {
|
|
243414
|
-
return new Command("pull").description("Pull deployed functions from Base44").argument("[name]", "Pull a single function by name").action(async (name2) => {
|
|
243415
|
-
await runCommand(() => pullFunctionsAction(name2), { requireAuth: true }, context);
|
|
243416
|
-
});
|
|
243126
|
+
return { outroMessage: "Functions deployed to Base44" };
|
|
243417
243127
|
}
|
|
243418
|
-
|
|
243419
|
-
|
|
243420
|
-
|
|
243421
|
-
|
|
243128
|
+
function getFunctionsDeployCommand(context) {
|
|
243129
|
+
return new Command("functions").description("Manage project functions").addCommand(new Command("deploy").description("Deploy local functions to Base44").action(async () => {
|
|
243130
|
+
await runCommand(deployFunctionsAction, { requireAuth: true }, context);
|
|
243131
|
+
}));
|
|
243422
243132
|
}
|
|
243423
243133
|
|
|
243424
243134
|
// src/cli/commands/project/create.ts
|
|
243425
|
-
import { basename as basename3, join as
|
|
243135
|
+
import { basename as basename3, join as join11, resolve as resolve2 } from "node:path";
|
|
243426
243136
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
243427
243137
|
var DEFAULT_TEMPLATE_ID = "backend-only";
|
|
243428
243138
|
async function getTemplateById(templateId) {
|
|
@@ -243558,7 +243268,7 @@ async function executeCreate({
|
|
|
243558
243268
|
updateMessage("Building project...");
|
|
243559
243269
|
await execa({ cwd: resolvedPath, shell: true })`${buildCommand}`;
|
|
243560
243270
|
updateMessage("Deploying site...");
|
|
243561
|
-
return await deploySite(
|
|
243271
|
+
return await deploySite(join11(resolvedPath, outputDirectory));
|
|
243562
243272
|
}, {
|
|
243563
243273
|
successMessage: theme.colors.base44Orange("Site deployed successfully"),
|
|
243564
243274
|
errorMessage: "Failed to deploy site"
|
|
@@ -243638,17 +243348,11 @@ ${summaryLines.join(`
|
|
|
243638
243348
|
${summaryLines.join(`
|
|
243639
243349
|
`)}`);
|
|
243640
243350
|
}
|
|
243641
|
-
|
|
243642
|
-
|
|
243643
|
-
|
|
243644
|
-
|
|
243645
|
-
|
|
243646
|
-
R2.step(theme.styles.dim(`[${functionCompleted + 1}/${functionTotal}] Deploying ${label}...`));
|
|
243647
|
-
},
|
|
243648
|
-
onFunctionResult: (r) => {
|
|
243649
|
-
functionCompleted++;
|
|
243650
|
-
formatDeployResult(r);
|
|
243651
|
-
}
|
|
243351
|
+
const result = await runTask("Deploying your app...", async () => {
|
|
243352
|
+
return await deployAll(projectData);
|
|
243353
|
+
}, {
|
|
243354
|
+
successMessage: theme.colors.base44Orange("Deployment completed"),
|
|
243355
|
+
errorMessage: "Deployment failed"
|
|
243652
243356
|
});
|
|
243653
243357
|
const needsOAuth = filterPendingOAuth(result.connectorResults ?? []);
|
|
243654
243358
|
if (needsOAuth.length > 0) {
|
|
@@ -243666,7 +243370,7 @@ ${summaryLines.join(`
|
|
|
243666
243370
|
}
|
|
243667
243371
|
return { outroMessage: "App deployed successfully" };
|
|
243668
243372
|
}
|
|
243669
|
-
function
|
|
243373
|
+
function getDeployCommand(context) {
|
|
243670
243374
|
return new Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").action(async (options) => {
|
|
243671
243375
|
await runCommand(() => deployAction({
|
|
243672
243376
|
...options,
|
|
@@ -244190,10 +243894,10 @@ function toPascalCase(name2) {
|
|
|
244190
243894
|
return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
|
|
244191
243895
|
}
|
|
244192
243896
|
// src/core/types/update-project.ts
|
|
244193
|
-
import { join as
|
|
243897
|
+
import { join as join14 } from "node:path";
|
|
244194
243898
|
var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
|
|
244195
243899
|
async function updateProjectConfig(projectRoot) {
|
|
244196
|
-
const tsconfigPath =
|
|
243900
|
+
const tsconfigPath = join14(projectRoot, "tsconfig.json");
|
|
244197
243901
|
if (!await pathExists(tsconfigPath)) {
|
|
244198
243902
|
return false;
|
|
244199
243903
|
}
|
|
@@ -244236,7 +243940,7 @@ function getTypesCommand(context) {
|
|
|
244236
243940
|
}
|
|
244237
243941
|
|
|
244238
243942
|
// src/cli/dev/dev-server/main.ts
|
|
244239
|
-
import { dirname as
|
|
243943
|
+
import { dirname as dirname15, join as join18 } from "node:path";
|
|
244240
243944
|
var import_cors = __toESM(require_lib4(), 1);
|
|
244241
243945
|
var import_express4 = __toESM(require_express(), 1);
|
|
244242
243946
|
|
|
@@ -244362,6 +244066,7 @@ var { promisify: promisify11 } = __require("util");
|
|
|
244362
244066
|
var tmp = require_tmp();
|
|
244363
244067
|
var $fileSync = tmp.fileSync;
|
|
244364
244068
|
var fileWithOptions = promisify11((options8, cb2) => tmp.file(options8, (err, path18, fd, cleanup) => err ? cb2(err) : cb2(undefined, { path: path18, fd, cleanup: promisify11(cleanup) })));
|
|
244069
|
+
var $file = async (options8) => fileWithOptions(options8);
|
|
244365
244070
|
var $dirSync = tmp.dirSync;
|
|
244366
244071
|
var dirWithOptions = promisify11((options8, cb2) => tmp.dir(options8, (err, path18, cleanup) => err ? cb2(err) : cb2(undefined, { path: path18, cleanup: promisify11(cleanup) })));
|
|
244367
244072
|
var $dir = async (options8) => dirWithOptions(options8);
|
|
@@ -244394,11 +244099,89 @@ function createDevLogger() {
|
|
|
244394
244099
|
}
|
|
244395
244100
|
|
|
244396
244101
|
// src/cli/dev/dev-server/function-manager.ts
|
|
244397
|
-
import { spawn as
|
|
244398
|
-
import { dirname as
|
|
244102
|
+
import { spawn as spawn3 } from "node:child_process";
|
|
244103
|
+
import { dirname as dirname12, join as join15 } from "node:path";
|
|
244399
244104
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
244400
|
-
|
|
244401
|
-
|
|
244105
|
+
|
|
244106
|
+
// src/core/exec/run-script.ts
|
|
244107
|
+
import { spawn as spawn2, spawnSync as spawnSync2 } from "node:child_process";
|
|
244108
|
+
import { copyFileSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
244109
|
+
import { resolve as resolve6 } from "node:path";
|
|
244110
|
+
function verifyDenoInstalled() {
|
|
244111
|
+
const result = spawnSync2("deno", ["--version"]);
|
|
244112
|
+
if (result.error) {
|
|
244113
|
+
throw new DependencyNotFoundError("Deno is required to run scripts with exec", {
|
|
244114
|
+
hints: [
|
|
244115
|
+
{
|
|
244116
|
+
message: "Install Deno: https://docs.deno.com/runtime/getting_started/installation/"
|
|
244117
|
+
}
|
|
244118
|
+
]
|
|
244119
|
+
});
|
|
244120
|
+
}
|
|
244121
|
+
}
|
|
244122
|
+
async function getUserAppToken() {
|
|
244123
|
+
try {
|
|
244124
|
+
const response = await getAppClient().get("auth/token").json();
|
|
244125
|
+
return response.token;
|
|
244126
|
+
} catch (error48) {
|
|
244127
|
+
throw await ApiError.fromHttpError(error48, "exchanging platform token for app user token");
|
|
244128
|
+
}
|
|
244129
|
+
}
|
|
244130
|
+
async function runScript(options8) {
|
|
244131
|
+
const { filePath, code: code2, extraArgs = [], execWrapperPath } = options8;
|
|
244132
|
+
verifyDenoInstalled();
|
|
244133
|
+
const cleanupFns = [];
|
|
244134
|
+
let scriptPath;
|
|
244135
|
+
if (filePath) {
|
|
244136
|
+
scriptPath = `file://${resolve6(filePath)}`;
|
|
244137
|
+
} else if (code2 !== undefined) {
|
|
244138
|
+
const tempScript = await $file({ postfix: ".ts" });
|
|
244139
|
+
cleanupFns.push(tempScript.cleanup);
|
|
244140
|
+
writeFileSync2(tempScript.path, code2, "utf-8");
|
|
244141
|
+
scriptPath = `file://${tempScript.path}`;
|
|
244142
|
+
} else {
|
|
244143
|
+
throw new Error("Either filePath or code must be provided");
|
|
244144
|
+
}
|
|
244145
|
+
const appConfig = getAppConfig();
|
|
244146
|
+
const [appUserToken, appBaseUrl] = await Promise.all([
|
|
244147
|
+
getUserAppToken(),
|
|
244148
|
+
getSiteUrl()
|
|
244149
|
+
]);
|
|
244150
|
+
const tempWrapper = await $file({ postfix: ".ts" });
|
|
244151
|
+
cleanupFns.push(tempWrapper.cleanup);
|
|
244152
|
+
copyFileSync(execWrapperPath, tempWrapper.path);
|
|
244153
|
+
try {
|
|
244154
|
+
const exitCode = await new Promise((resolvePromise) => {
|
|
244155
|
+
const child = spawn2("deno", [
|
|
244156
|
+
"run",
|
|
244157
|
+
"--allow-all",
|
|
244158
|
+
"--node-modules-dir=auto",
|
|
244159
|
+
tempWrapper.path,
|
|
244160
|
+
...extraArgs
|
|
244161
|
+
], {
|
|
244162
|
+
env: {
|
|
244163
|
+
...process.env,
|
|
244164
|
+
SCRIPT_PATH: scriptPath,
|
|
244165
|
+
BASE44_APP_ID: appConfig.id,
|
|
244166
|
+
BASE44_ACCESS_TOKEN: appUserToken,
|
|
244167
|
+
BASE44_APP_BASE_URL: appBaseUrl
|
|
244168
|
+
},
|
|
244169
|
+
stdio: "inherit"
|
|
244170
|
+
});
|
|
244171
|
+
child.on("close", (code3) => {
|
|
244172
|
+
resolvePromise(code3 ?? 1);
|
|
244173
|
+
});
|
|
244174
|
+
});
|
|
244175
|
+
return { exitCode };
|
|
244176
|
+
} finally {
|
|
244177
|
+
for (const cleanup of cleanupFns) {
|
|
244178
|
+
cleanup();
|
|
244179
|
+
}
|
|
244180
|
+
}
|
|
244181
|
+
}
|
|
244182
|
+
// src/cli/dev/dev-server/function-manager.ts
|
|
244183
|
+
var __dirname5 = dirname12(fileURLToPath7(import.meta.url));
|
|
244184
|
+
var WRAPPER_PATH = join15(__dirname5, "../deno-runtime/main.js");
|
|
244402
244185
|
var READY_TIMEOUT = 30000;
|
|
244403
244186
|
|
|
244404
244187
|
class FunctionManager {
|
|
@@ -244410,15 +244193,7 @@ class FunctionManager {
|
|
|
244410
244193
|
this.functions = new Map(functions.map((f7) => [f7.name, f7]));
|
|
244411
244194
|
this.logger = logger;
|
|
244412
244195
|
if (functions.length > 0) {
|
|
244413
|
-
|
|
244414
|
-
}
|
|
244415
|
-
}
|
|
244416
|
-
verifyDenoIsInstalled() {
|
|
244417
|
-
const result = spawnSync2("deno", ["--version"]);
|
|
244418
|
-
if (result.error) {
|
|
244419
|
-
throw new DependencyNotFoundError("Deno is required to run functions", {
|
|
244420
|
-
hints: [{ message: "Install Deno from https://deno.com/download" }]
|
|
244421
|
-
});
|
|
244196
|
+
verifyDenoInstalled();
|
|
244422
244197
|
}
|
|
244423
244198
|
}
|
|
244424
244199
|
getFunctionNames() {
|
|
@@ -244481,7 +244256,7 @@ class FunctionManager {
|
|
|
244481
244256
|
}
|
|
244482
244257
|
spawnFunction(func, port) {
|
|
244483
244258
|
this.logger.log(`Spawning function "${func.name}" on port ${port}`);
|
|
244484
|
-
const process21 =
|
|
244259
|
+
const process21 = spawn3("deno", ["run", "--allow-all", WRAPPER_PATH], {
|
|
244485
244260
|
env: {
|
|
244486
244261
|
...globalThis.process.env,
|
|
244487
244262
|
FUNCTION_PATH: func.entryPath,
|
|
@@ -244519,7 +244294,7 @@ class FunctionManager {
|
|
|
244519
244294
|
});
|
|
244520
244295
|
}
|
|
244521
244296
|
waitForReady(name2, runningFunc) {
|
|
244522
|
-
return new Promise((
|
|
244297
|
+
return new Promise((resolve7, reject) => {
|
|
244523
244298
|
runningFunc.process.on("exit", (code2) => {
|
|
244524
244299
|
if (!runningFunc.ready) {
|
|
244525
244300
|
clearTimeout(timeout3);
|
|
@@ -244542,7 +244317,7 @@ class FunctionManager {
|
|
|
244542
244317
|
runningFunc.ready = true;
|
|
244543
244318
|
clearTimeout(timeout3);
|
|
244544
244319
|
runningFunc.process.stdout?.off("data", onData);
|
|
244545
|
-
|
|
244320
|
+
resolve7(runningFunc.port);
|
|
244546
244321
|
}
|
|
244547
244322
|
};
|
|
244548
244323
|
runningFunc.process.stdout?.on("data", onData);
|
|
@@ -244899,7 +244674,7 @@ function createEntityRoutes(db2, logger, remoteProxy, broadcast) {
|
|
|
244899
244674
|
// src/cli/dev/dev-server/routes/integrations.ts
|
|
244900
244675
|
var import_express3 = __toESM(require_express(), 1);
|
|
244901
244676
|
var import_multer = __toESM(require_multer(), 1);
|
|
244902
|
-
import { randomUUID as
|
|
244677
|
+
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
244903
244678
|
import fs28 from "node:fs";
|
|
244904
244679
|
import path18 from "node:path";
|
|
244905
244680
|
function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
|
|
@@ -244910,7 +244685,7 @@ function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
|
|
|
244910
244685
|
destination: mediaFilesDir,
|
|
244911
244686
|
filename: (_req, file2, cb2) => {
|
|
244912
244687
|
const ext = path18.extname(file2.originalname);
|
|
244913
|
-
cb2(null, `${
|
|
244688
|
+
cb2(null, `${randomUUID4()}${ext}`);
|
|
244914
244689
|
}
|
|
244915
244690
|
});
|
|
244916
244691
|
const MAX_FILE_SIZE = 50 * 1024 * 1024;
|
|
@@ -244937,7 +244712,7 @@ function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
|
|
|
244937
244712
|
res.status(400).json({ error: "file_uri is required" });
|
|
244938
244713
|
return;
|
|
244939
244714
|
}
|
|
244940
|
-
const signature =
|
|
244715
|
+
const signature = randomUUID4();
|
|
244941
244716
|
const signed_url = `${baseUrl}/media/${file_uri}?signature=${signature}`;
|
|
244942
244717
|
res.json({ signed_url });
|
|
244943
244718
|
});
|
|
@@ -245702,9 +245477,9 @@ class NodeFsHandler {
|
|
|
245702
245477
|
if (this.fsw.closed) {
|
|
245703
245478
|
return;
|
|
245704
245479
|
}
|
|
245705
|
-
const
|
|
245480
|
+
const dirname14 = sp2.dirname(file2);
|
|
245706
245481
|
const basename5 = sp2.basename(file2);
|
|
245707
|
-
const parent = this.fsw._getWatchedDir(
|
|
245482
|
+
const parent = this.fsw._getWatchedDir(dirname14);
|
|
245708
245483
|
let prevStats = stats;
|
|
245709
245484
|
if (parent.has(basename5))
|
|
245710
245485
|
return;
|
|
@@ -245731,7 +245506,7 @@ class NodeFsHandler {
|
|
|
245731
245506
|
prevStats = newStats2;
|
|
245732
245507
|
}
|
|
245733
245508
|
} catch (error48) {
|
|
245734
|
-
this.fsw._remove(
|
|
245509
|
+
this.fsw._remove(dirname14, basename5);
|
|
245735
245510
|
}
|
|
245736
245511
|
} else if (parent.has(basename5)) {
|
|
245737
245512
|
const at13 = newStats.atimeMs;
|
|
@@ -245820,7 +245595,7 @@ class NodeFsHandler {
|
|
|
245820
245595
|
this._addToNodeFs(path19, initialAdd, wh2, depth + 1);
|
|
245821
245596
|
}
|
|
245822
245597
|
}).on(EV.ERROR, this._boundHandleError);
|
|
245823
|
-
return new Promise((
|
|
245598
|
+
return new Promise((resolve8, reject) => {
|
|
245824
245599
|
if (!stream)
|
|
245825
245600
|
return reject();
|
|
245826
245601
|
stream.once(STR_END, () => {
|
|
@@ -245829,7 +245604,7 @@ class NodeFsHandler {
|
|
|
245829
245604
|
return;
|
|
245830
245605
|
}
|
|
245831
245606
|
const wasThrottled = throttler ? throttler.clear() : false;
|
|
245832
|
-
|
|
245607
|
+
resolve8(undefined);
|
|
245833
245608
|
previous.getChildren().filter((item) => {
|
|
245834
245609
|
return item !== directory && !current.has(item);
|
|
245835
245610
|
}).forEach((item) => {
|
|
@@ -246716,7 +246491,7 @@ async function createDevServer(options8) {
|
|
|
246716
246491
|
devLogger.warn(`"${req.originalUrl}" is not supported in local development, passing call to production`);
|
|
246717
246492
|
remoteProxy(req, res, next);
|
|
246718
246493
|
});
|
|
246719
|
-
const server = await new Promise((
|
|
246494
|
+
const server = await new Promise((resolve9, reject) => {
|
|
246720
246495
|
const s5 = app.listen(port, "127.0.0.1", (err) => {
|
|
246721
246496
|
if (err) {
|
|
246722
246497
|
if ("code" in err && err.code === "EADDRINUSE") {
|
|
@@ -246725,7 +246500,7 @@ async function createDevServer(options8) {
|
|
|
246725
246500
|
reject(err);
|
|
246726
246501
|
}
|
|
246727
246502
|
} else {
|
|
246728
|
-
|
|
246503
|
+
resolve9(s5);
|
|
246729
246504
|
}
|
|
246730
246505
|
});
|
|
246731
246506
|
});
|
|
@@ -246734,8 +246509,8 @@ async function createDevServer(options8) {
|
|
|
246734
246509
|
broadcastEntityEvent(io6, appId, entityName, event);
|
|
246735
246510
|
};
|
|
246736
246511
|
const base44ConfigWatcher = new WatchBase44({
|
|
246737
|
-
functions:
|
|
246738
|
-
entities:
|
|
246512
|
+
functions: join18(dirname15(project2.configPath), project2.functionsDir),
|
|
246513
|
+
entities: join18(dirname15(project2.configPath), project2.entitiesDir)
|
|
246739
246514
|
}, devLogger);
|
|
246740
246515
|
base44ConfigWatcher.on("change", async (name2) => {
|
|
246741
246516
|
try {
|
|
@@ -246798,8 +246573,73 @@ function getDevCommand(context) {
|
|
|
246798
246573
|
});
|
|
246799
246574
|
}
|
|
246800
246575
|
|
|
246576
|
+
// src/cli/commands/exec.ts
|
|
246577
|
+
import { dirname as dirname16, join as join19 } from "node:path";
|
|
246578
|
+
import { fileURLToPath as fileURLToPath8 } from "node:url";
|
|
246579
|
+
var __dirname6 = dirname16(fileURLToPath8(import.meta.url));
|
|
246580
|
+
var EXEC_WRAPPER_PATH = join19(__dirname6, "../deno-runtime/exec.ts");
|
|
246581
|
+
function readStdin() {
|
|
246582
|
+
return new Promise((resolve9, reject) => {
|
|
246583
|
+
let data = "";
|
|
246584
|
+
process.stdin.setEncoding("utf-8");
|
|
246585
|
+
process.stdin.on("data", (chunk) => {
|
|
246586
|
+
data += chunk;
|
|
246587
|
+
});
|
|
246588
|
+
process.stdin.on("end", () => resolve9(data));
|
|
246589
|
+
process.stdin.on("error", reject);
|
|
246590
|
+
});
|
|
246591
|
+
}
|
|
246592
|
+
function validateInput2(command) {
|
|
246593
|
+
const [scriptArg] = command.args;
|
|
246594
|
+
const { eval: evalCode } = command.opts();
|
|
246595
|
+
const hasStdin = scriptArg === "-";
|
|
246596
|
+
const hasFile = scriptArg !== undefined && !hasStdin;
|
|
246597
|
+
const hasEval = evalCode !== undefined;
|
|
246598
|
+
const inputCount = [hasFile, hasEval, hasStdin].filter(Boolean).length;
|
|
246599
|
+
if (inputCount > 1) {
|
|
246600
|
+
throw new InvalidInputError("Cannot use more than one input mode. Provide only one of: file path, -e, or -.");
|
|
246601
|
+
}
|
|
246602
|
+
if (inputCount === 0) {
|
|
246603
|
+
throw new InvalidInputError("No script provided. Pass a file path, use -e for inline code, or - for stdin.", {
|
|
246604
|
+
hints: [
|
|
246605
|
+
{ message: "File: base44 exec ./script.ts" },
|
|
246606
|
+
{ message: 'Eval: base44 exec -e "console.log(1)"' },
|
|
246607
|
+
{ message: "Stdin: echo 'code' | base44 exec -" }
|
|
246608
|
+
]
|
|
246609
|
+
});
|
|
246610
|
+
}
|
|
246611
|
+
}
|
|
246612
|
+
async function execAction(scriptArg, options8, extraArgs) {
|
|
246613
|
+
const hasStdin = scriptArg === "-";
|
|
246614
|
+
const hasFile = scriptArg !== undefined && !hasStdin;
|
|
246615
|
+
let code2;
|
|
246616
|
+
if (hasStdin) {
|
|
246617
|
+
code2 = await readStdin();
|
|
246618
|
+
} else if (options8.eval !== undefined) {
|
|
246619
|
+
code2 = options8.eval;
|
|
246620
|
+
}
|
|
246621
|
+
const { exitCode } = await runScript({
|
|
246622
|
+
filePath: hasFile ? scriptArg : undefined,
|
|
246623
|
+
code: code2,
|
|
246624
|
+
extraArgs,
|
|
246625
|
+
execWrapperPath: EXEC_WRAPPER_PATH
|
|
246626
|
+
});
|
|
246627
|
+
if (exitCode !== 0) {
|
|
246628
|
+
process.exitCode = exitCode;
|
|
246629
|
+
}
|
|
246630
|
+
return {};
|
|
246631
|
+
}
|
|
246632
|
+
function getExecCommand(context) {
|
|
246633
|
+
const cmd = new Command("exec").description("Run a script with the Base44 SDK pre-authenticated as the current user").argument("[script]", "Path to a .ts/.js file, or - for stdin").option("-e, --eval <code>", "Evaluate inline code").allowUnknownOption(true).hook("preAction", validateInput2).action(async (script, options8) => {
|
|
246634
|
+
const dashIndex = process.argv.indexOf("--");
|
|
246635
|
+
const extraArgs = dashIndex !== -1 ? process.argv.slice(dashIndex + 1) : [];
|
|
246636
|
+
await runCommand(() => execAction(script, options8, extraArgs), { requireAuth: true }, context);
|
|
246637
|
+
});
|
|
246638
|
+
return cmd;
|
|
246639
|
+
}
|
|
246640
|
+
|
|
246801
246641
|
// src/cli/commands/project/eject.ts
|
|
246802
|
-
import { resolve as
|
|
246642
|
+
import { resolve as resolve9 } from "node:path";
|
|
246803
246643
|
var import_kebabCase2 = __toESM(require_kebabCase(), 1);
|
|
246804
246644
|
async function eject(options8) {
|
|
246805
246645
|
const projects = await listProjects();
|
|
@@ -246848,7 +246688,7 @@ async function eject(options8) {
|
|
|
246848
246688
|
Ne("Operation cancelled.");
|
|
246849
246689
|
throw new CLIExitError(0);
|
|
246850
246690
|
}
|
|
246851
|
-
const resolvedPath =
|
|
246691
|
+
const resolvedPath = resolve9(selectedPath);
|
|
246852
246692
|
await runTask("Downloading your project's code...", async (updateMessage) => {
|
|
246853
246693
|
await createProjectFilesForExistingProject({
|
|
246854
246694
|
projectId,
|
|
@@ -246904,16 +246744,17 @@ function createProgram(context) {
|
|
|
246904
246744
|
program2.addCommand(getLogoutCommand(context));
|
|
246905
246745
|
program2.addCommand(getCreateCommand(context));
|
|
246906
246746
|
program2.addCommand(getDashboardCommand(context));
|
|
246907
|
-
program2.addCommand(
|
|
246747
|
+
program2.addCommand(getDeployCommand(context));
|
|
246908
246748
|
program2.addCommand(getLinkCommand(context));
|
|
246909
246749
|
program2.addCommand(getEjectCommand(context));
|
|
246910
246750
|
program2.addCommand(getEntitiesPushCommand(context));
|
|
246911
246751
|
program2.addCommand(getAgentsCommand(context));
|
|
246912
246752
|
program2.addCommand(getConnectorsCommand(context));
|
|
246913
|
-
program2.addCommand(
|
|
246753
|
+
program2.addCommand(getFunctionsDeployCommand(context));
|
|
246914
246754
|
program2.addCommand(getSecretsCommand(context));
|
|
246915
246755
|
program2.addCommand(getSiteCommand(context));
|
|
246916
246756
|
program2.addCommand(getTypesCommand(context));
|
|
246757
|
+
program2.addCommand(getExecCommand(context));
|
|
246917
246758
|
program2.addCommand(getDevCommand(context), { hidden: true });
|
|
246918
246759
|
program2.addCommand(getLogsCommand(context), { hidden: true });
|
|
246919
246760
|
return program2;
|
|
@@ -249211,14 +249052,14 @@ async function addSourceContext(frames) {
|
|
|
249211
249052
|
return frames;
|
|
249212
249053
|
}
|
|
249213
249054
|
function getContextLinesFromFile(path19, ranges, output) {
|
|
249214
|
-
return new Promise((
|
|
249055
|
+
return new Promise((resolve10) => {
|
|
249215
249056
|
const stream = createReadStream2(path19);
|
|
249216
249057
|
const lineReaded = createInterface2({
|
|
249217
249058
|
input: stream
|
|
249218
249059
|
});
|
|
249219
249060
|
function destroyStreamAndResolve() {
|
|
249220
249061
|
stream.destroy();
|
|
249221
|
-
|
|
249062
|
+
resolve10();
|
|
249222
249063
|
}
|
|
249223
249064
|
let lineNumber = 0;
|
|
249224
249065
|
let currentRangeIndex = 0;
|
|
@@ -250330,15 +250171,15 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
250330
250171
|
return true;
|
|
250331
250172
|
if (this.featureFlagsPoller === undefined)
|
|
250332
250173
|
return false;
|
|
250333
|
-
return new Promise((
|
|
250174
|
+
return new Promise((resolve10) => {
|
|
250334
250175
|
const timeout3 = setTimeout(() => {
|
|
250335
250176
|
cleanup();
|
|
250336
|
-
|
|
250177
|
+
resolve10(false);
|
|
250337
250178
|
}, timeoutMs);
|
|
250338
250179
|
const cleanup = this._events.on("localEvaluationFlagsLoaded", (count2) => {
|
|
250339
250180
|
clearTimeout(timeout3);
|
|
250340
250181
|
cleanup();
|
|
250341
|
-
|
|
250182
|
+
resolve10(count2 > 0);
|
|
250342
250183
|
});
|
|
250343
250184
|
});
|
|
250344
250185
|
}
|
|
@@ -251151,4 +250992,4 @@ export {
|
|
|
251151
250992
|
CLIExitError
|
|
251152
250993
|
};
|
|
251153
250994
|
|
|
251154
|
-
//# debugId=
|
|
250995
|
+
//# debugId=36A3D3D037267E4264756E2164756E21
|