@base44-preview/cli 0.0.50-pr.487.fc1c45a → 0.0.51-pr.481.a2befc3
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 +422 -569
- package/dist/cli/index.js.map +13 -21
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -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" ? join19(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 join19(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: join19,
|
|
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" ? join21(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 join21(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: join21,
|
|
133963
133963
|
line: line3,
|
|
133964
133964
|
softline: softline2,
|
|
133965
133965
|
hardline: hardline4,
|
|
@@ -134614,11 +134614,11 @@ var require_prettier = __commonJS((exports, module) => {
|
|
|
134614
134614
|
var require_formatter = __commonJS((exports) => {
|
|
134615
134615
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
|
|
134616
134616
|
function adopt(value) {
|
|
134617
|
-
return value instanceof P9 ? value : new P9(function(
|
|
134618
|
-
|
|
134617
|
+
return value instanceof P9 ? value : new P9(function(resolve7) {
|
|
134618
|
+
resolve7(value);
|
|
134619
134619
|
});
|
|
134620
134620
|
}
|
|
134621
|
-
return new (P9 || (P9 = Promise))(function(
|
|
134621
|
+
return new (P9 || (P9 = Promise))(function(resolve7, reject) {
|
|
134622
134622
|
function fulfilled(value) {
|
|
134623
134623
|
try {
|
|
134624
134624
|
step(generator.next(value));
|
|
@@ -134634,7 +134634,7 @@ var require_formatter = __commonJS((exports) => {
|
|
|
134634
134634
|
}
|
|
134635
134635
|
}
|
|
134636
134636
|
function step(result) {
|
|
134637
|
-
result.done ?
|
|
134637
|
+
result.done ? resolve7(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
134638
134638
|
}
|
|
134639
134639
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
134640
134640
|
});
|
|
@@ -139287,7 +139287,7 @@ var require_url = __commonJS((exports) => {
|
|
|
139287
139287
|
};
|
|
139288
139288
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
139289
139289
|
exports.parse = undefined;
|
|
139290
|
-
exports.resolve =
|
|
139290
|
+
exports.resolve = resolve7;
|
|
139291
139291
|
exports.cwd = cwd;
|
|
139292
139292
|
exports.getProtocol = getProtocol;
|
|
139293
139293
|
exports.getExtension = getExtension;
|
|
@@ -139315,7 +139315,7 @@ var require_url = __commonJS((exports) => {
|
|
|
139315
139315
|
var urlDecodePatterns = [/%23/g, "#", /%24/g, "$", /%26/g, "&", /%2C/g, ",", /%40/g, "@"];
|
|
139316
139316
|
var parse11 = (u4) => new URL(u4);
|
|
139317
139317
|
exports.parse = parse11;
|
|
139318
|
-
function
|
|
139318
|
+
function resolve7(from, to5) {
|
|
139319
139319
|
const fromUrl = new URL((0, convert_path_to_posix_1.default)(from), "https://aaa.nonexistanturl.com");
|
|
139320
139320
|
const resolvedUrl = new URL((0, convert_path_to_posix_1.default)(to5), fromUrl);
|
|
139321
139321
|
const endSpaces = to5.match(/(\s*)$/)?.[1] || "";
|
|
@@ -139451,7 +139451,7 @@ var require_url = __commonJS((exports) => {
|
|
|
139451
139451
|
}
|
|
139452
139452
|
function relative4(from, to5) {
|
|
139453
139453
|
if (!isFileSystemPath(from) || !isFileSystemPath(to5)) {
|
|
139454
|
-
return
|
|
139454
|
+
return resolve7(from, to5);
|
|
139455
139455
|
}
|
|
139456
139456
|
const fromDir = path_1.default.dirname(stripHash(from));
|
|
139457
139457
|
const toPath4 = stripHash(to5);
|
|
@@ -140127,7 +140127,7 @@ var require_plugins = __commonJS((exports) => {
|
|
|
140127
140127
|
let plugin;
|
|
140128
140128
|
let lastError;
|
|
140129
140129
|
let index = 0;
|
|
140130
|
-
return new Promise((
|
|
140130
|
+
return new Promise((resolve7, reject) => {
|
|
140131
140131
|
runNextPlugin();
|
|
140132
140132
|
function runNextPlugin() {
|
|
140133
140133
|
plugin = plugins[index++];
|
|
@@ -140155,7 +140155,7 @@ var require_plugins = __commonJS((exports) => {
|
|
|
140155
140155
|
}
|
|
140156
140156
|
}
|
|
140157
140157
|
function onSuccess(result) {
|
|
140158
|
-
|
|
140158
|
+
resolve7({
|
|
140159
140159
|
plugin,
|
|
140160
140160
|
result
|
|
140161
140161
|
});
|
|
@@ -141488,11 +141488,11 @@ var require_lib3 = __commonJS((exports) => {
|
|
|
141488
141488
|
var require_resolver = __commonJS((exports) => {
|
|
141489
141489
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
|
|
141490
141490
|
function adopt(value) {
|
|
141491
|
-
return value instanceof P9 ? value : new P9(function(
|
|
141492
|
-
|
|
141491
|
+
return value instanceof P9 ? value : new P9(function(resolve7) {
|
|
141492
|
+
resolve7(value);
|
|
141493
141493
|
});
|
|
141494
141494
|
}
|
|
141495
|
-
return new (P9 || (P9 = Promise))(function(
|
|
141495
|
+
return new (P9 || (P9 = Promise))(function(resolve7, reject) {
|
|
141496
141496
|
function fulfilled(value) {
|
|
141497
141497
|
try {
|
|
141498
141498
|
step(generator.next(value));
|
|
@@ -141508,7 +141508,7 @@ var require_resolver = __commonJS((exports) => {
|
|
|
141508
141508
|
}
|
|
141509
141509
|
}
|
|
141510
141510
|
function step(result) {
|
|
141511
|
-
result.done ?
|
|
141511
|
+
result.done ? resolve7(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
141512
141512
|
}
|
|
141513
141513
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
141514
141514
|
});
|
|
@@ -141629,11 +141629,11 @@ var require_optionValidator = __commonJS((exports) => {
|
|
|
141629
141629
|
var require_src3 = __commonJS((exports) => {
|
|
141630
141630
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
|
|
141631
141631
|
function adopt(value) {
|
|
141632
|
-
return value instanceof P9 ? value : new P9(function(
|
|
141633
|
-
|
|
141632
|
+
return value instanceof P9 ? value : new P9(function(resolve7) {
|
|
141633
|
+
resolve7(value);
|
|
141634
141634
|
});
|
|
141635
141635
|
}
|
|
141636
|
-
return new (P9 || (P9 = Promise))(function(
|
|
141636
|
+
return new (P9 || (P9 = Promise))(function(resolve7, reject) {
|
|
141637
141637
|
function fulfilled(value) {
|
|
141638
141638
|
try {
|
|
141639
141639
|
step(generator.next(value));
|
|
@@ -141649,7 +141649,7 @@ var require_src3 = __commonJS((exports) => {
|
|
|
141649
141649
|
}
|
|
141650
141650
|
}
|
|
141651
141651
|
function step(result) {
|
|
141652
|
-
result.done ?
|
|
141652
|
+
result.done ? resolve7(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
141653
141653
|
}
|
|
141654
141654
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
141655
141655
|
});
|
|
@@ -147274,11 +147274,11 @@ var require_raw_body = __commonJS((exports, module) => {
|
|
|
147274
147274
|
if (done) {
|
|
147275
147275
|
return readStream(stream, encoding, length, limit, wrap(done));
|
|
147276
147276
|
}
|
|
147277
|
-
return new Promise(function executor(
|
|
147277
|
+
return new Promise(function executor(resolve7, reject) {
|
|
147278
147278
|
readStream(stream, encoding, length, limit, function onRead2(err, buf) {
|
|
147279
147279
|
if (err)
|
|
147280
147280
|
return reject(err);
|
|
147281
|
-
|
|
147281
|
+
resolve7(buf);
|
|
147282
147282
|
});
|
|
147283
147283
|
});
|
|
147284
147284
|
}
|
|
@@ -160399,11 +160399,11 @@ 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 dirname15 = path18.dirname;
|
|
160403
160403
|
var basename4 = path18.basename;
|
|
160404
160404
|
var extname2 = path18.extname;
|
|
160405
|
-
var
|
|
160406
|
-
var
|
|
160405
|
+
var join22 = path18.join;
|
|
160406
|
+
var resolve7 = path18.resolve;
|
|
160407
160407
|
module.exports = View;
|
|
160408
160408
|
function View(name2, options8) {
|
|
160409
160409
|
var opts = options8 || {};
|
|
@@ -160437,8 +160437,8 @@ var require_view = __commonJS((exports, module) => {
|
|
|
160437
160437
|
debug('lookup "%s"', name2);
|
|
160438
160438
|
for (var i5 = 0;i5 < roots.length && !path19; i5++) {
|
|
160439
160439
|
var root2 = roots[i5];
|
|
160440
|
-
var loc =
|
|
160441
|
-
var dir =
|
|
160440
|
+
var loc = resolve7(root2, name2);
|
|
160441
|
+
var dir = dirname15(loc);
|
|
160442
160442
|
var file2 = basename4(loc);
|
|
160443
160443
|
path19 = this.resolve(dir, file2);
|
|
160444
160444
|
}
|
|
@@ -160462,14 +160462,14 @@ var require_view = __commonJS((exports, module) => {
|
|
|
160462
160462
|
});
|
|
160463
160463
|
sync = false;
|
|
160464
160464
|
};
|
|
160465
|
-
View.prototype.resolve = function
|
|
160465
|
+
View.prototype.resolve = function resolve8(dir, file2) {
|
|
160466
160466
|
var ext = this.ext;
|
|
160467
|
-
var path19 =
|
|
160467
|
+
var path19 = join22(dir, file2);
|
|
160468
160468
|
var stat2 = tryStat(path19);
|
|
160469
160469
|
if (stat2 && stat2.isFile()) {
|
|
160470
160470
|
return path19;
|
|
160471
160471
|
}
|
|
160472
|
-
path19 =
|
|
160472
|
+
path19 = join22(dir, basename4(file2, ext), "index" + ext);
|
|
160473
160473
|
stat2 = tryStat(path19);
|
|
160474
160474
|
if (stat2 && stat2.isFile()) {
|
|
160475
160475
|
return path19;
|
|
@@ -162621,7 +162621,7 @@ var require_application = __commonJS((exports, module) => {
|
|
|
162621
162621
|
var compileETag = require_utils10().compileETag;
|
|
162622
162622
|
var compileQueryParser = require_utils10().compileQueryParser;
|
|
162623
162623
|
var compileTrust = require_utils10().compileTrust;
|
|
162624
|
-
var
|
|
162624
|
+
var resolve7 = __require("node:path").resolve;
|
|
162625
162625
|
var once9 = require_once();
|
|
162626
162626
|
var Router = require_router();
|
|
162627
162627
|
var slice = Array.prototype.slice;
|
|
@@ -162675,7 +162675,7 @@ var require_application = __commonJS((exports, module) => {
|
|
|
162675
162675
|
this.mountpath = "/";
|
|
162676
162676
|
this.locals.settings = this.settings;
|
|
162677
162677
|
this.set("view", View);
|
|
162678
|
-
this.set("views",
|
|
162678
|
+
this.set("views", resolve7("views"));
|
|
162679
162679
|
this.set("jsonp callback name", "callback");
|
|
162680
162680
|
if (env3 === "production") {
|
|
162681
162681
|
this.enable("view cache");
|
|
@@ -164164,9 +164164,9 @@ 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 join22 = path18.join;
|
|
164168
164168
|
var normalize2 = path18.normalize;
|
|
164169
|
-
var
|
|
164169
|
+
var resolve7 = path18.resolve;
|
|
164170
164170
|
var sep = path18.sep;
|
|
164171
164171
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
164172
164172
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1000;
|
|
@@ -164195,7 +164195,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
164195
164195
|
this._maxage = opts.maxAge || opts.maxage;
|
|
164196
164196
|
this._maxage = typeof this._maxage === "string" ? ms8(this._maxage) : Number(this._maxage);
|
|
164197
164197
|
this._maxage = !isNaN(this._maxage) ? Math.min(Math.max(0, this._maxage), MAX_MAXAGE) : 0;
|
|
164198
|
-
this._root = opts.root ?
|
|
164198
|
+
this._root = opts.root ? resolve7(opts.root) : null;
|
|
164199
164199
|
}
|
|
164200
164200
|
util2.inherits(SendStream, Stream2);
|
|
164201
164201
|
SendStream.prototype.error = function error48(status, err) {
|
|
@@ -164336,7 +164336,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
164336
164336
|
return res;
|
|
164337
164337
|
}
|
|
164338
164338
|
parts = path19.split(sep);
|
|
164339
|
-
path19 = normalize2(
|
|
164339
|
+
path19 = normalize2(join22(root2, path19));
|
|
164340
164340
|
} else {
|
|
164341
164341
|
if (UP_PATH_REGEXP.test(path19)) {
|
|
164342
164342
|
debug('malicious path "%s"', path19);
|
|
@@ -164344,7 +164344,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
164344
164344
|
return res;
|
|
164345
164345
|
}
|
|
164346
164346
|
parts = normalize2(path19).split(sep);
|
|
164347
|
-
path19 =
|
|
164347
|
+
path19 = resolve7(path19);
|
|
164348
164348
|
}
|
|
164349
164349
|
if (containsDotFile(parts)) {
|
|
164350
164350
|
debug('%s dotfile "%s"', this._dotfiles, 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 = join22(path19, self2._index[i5]);
|
|
164480
164480
|
debug('stat "%s"', p4);
|
|
164481
164481
|
fs28.stat(p4, function(err2, stat2) {
|
|
164482
164482
|
if (err2)
|
|
@@ -164672,7 +164672,7 @@ var require_response = __commonJS((exports, module) => {
|
|
|
164672
164672
|
var cookie = require_cookie();
|
|
164673
164673
|
var send = require_send();
|
|
164674
164674
|
var extname2 = path18.extname;
|
|
164675
|
-
var
|
|
164675
|
+
var resolve7 = path18.resolve;
|
|
164676
164676
|
var vary = require_vary();
|
|
164677
164677
|
var { Buffer: Buffer7 } = __require("node:buffer");
|
|
164678
164678
|
var res = Object.create(http.ServerResponse.prototype);
|
|
@@ -164881,7 +164881,7 @@ var require_response = __commonJS((exports, module) => {
|
|
|
164881
164881
|
}
|
|
164882
164882
|
opts = Object.create(opts);
|
|
164883
164883
|
opts.headers = headers;
|
|
164884
|
-
var fullPath = !opts.root ?
|
|
164884
|
+
var fullPath = !opts.root ? resolve7(path19) : path19;
|
|
164885
164885
|
return this.sendFile(fullPath, opts, done);
|
|
164886
164886
|
};
|
|
164887
164887
|
res.contentType = res.type = function contentType(type) {
|
|
@@ -165142,7 +165142,7 @@ var require_serve_static = __commonJS((exports, module) => {
|
|
|
165142
165142
|
var encodeUrl = require_encodeurl();
|
|
165143
165143
|
var escapeHtml = require_escape_html();
|
|
165144
165144
|
var parseUrl = require_parseurl();
|
|
165145
|
-
var
|
|
165145
|
+
var resolve7 = __require("path").resolve;
|
|
165146
165146
|
var send = require_send();
|
|
165147
165147
|
var url3 = __require("url");
|
|
165148
165148
|
module.exports = serveStatic;
|
|
@@ -165161,7 +165161,7 @@ var require_serve_static = __commonJS((exports, module) => {
|
|
|
165161
165161
|
throw new TypeError("option setHeaders must be function");
|
|
165162
165162
|
}
|
|
165163
165163
|
opts.maxage = opts.maxage || opts.maxAge || 0;
|
|
165164
|
-
opts.root =
|
|
165164
|
+
opts.root = resolve7(root2);
|
|
165165
165165
|
var onDirectory = redirect ? createRedirectDirectoryListener() : createNotFoundDirectoryListener();
|
|
165166
165166
|
return function serveStatic2(req, res, next) {
|
|
165167
165167
|
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
@@ -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 {
|
|
@@ -214616,7 +214616,7 @@ var require_buffer_list = __commonJS((exports, module) => {
|
|
|
214616
214616
|
}
|
|
214617
214617
|
}, {
|
|
214618
214618
|
key: "join",
|
|
214619
|
-
value: function
|
|
214619
|
+
value: function join22(s5) {
|
|
214620
214620
|
if (this.length === 0)
|
|
214621
214621
|
return "";
|
|
214622
214622
|
var p4 = this.head;
|
|
@@ -215914,14 +215914,14 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
215914
215914
|
};
|
|
215915
215915
|
}
|
|
215916
215916
|
function readAndResolve(iter) {
|
|
215917
|
-
var
|
|
215918
|
-
if (
|
|
215917
|
+
var resolve7 = iter[kLastResolve];
|
|
215918
|
+
if (resolve7 !== null) {
|
|
215919
215919
|
var data = iter[kStream].read();
|
|
215920
215920
|
if (data !== null) {
|
|
215921
215921
|
iter[kLastPromise] = null;
|
|
215922
215922
|
iter[kLastResolve] = null;
|
|
215923
215923
|
iter[kLastReject] = null;
|
|
215924
|
-
|
|
215924
|
+
resolve7(createIterResult(data, false));
|
|
215925
215925
|
}
|
|
215926
215926
|
}
|
|
215927
215927
|
}
|
|
@@ -215929,13 +215929,13 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
215929
215929
|
process.nextTick(readAndResolve, iter);
|
|
215930
215930
|
}
|
|
215931
215931
|
function wrapForNext(lastPromise, iter) {
|
|
215932
|
-
return function(
|
|
215932
|
+
return function(resolve7, reject) {
|
|
215933
215933
|
lastPromise.then(function() {
|
|
215934
215934
|
if (iter[kEnded]) {
|
|
215935
|
-
|
|
215935
|
+
resolve7(createIterResult(undefined, true));
|
|
215936
215936
|
return;
|
|
215937
215937
|
}
|
|
215938
|
-
iter[kHandlePromise](
|
|
215938
|
+
iter[kHandlePromise](resolve7, reject);
|
|
215939
215939
|
}, reject);
|
|
215940
215940
|
};
|
|
215941
215941
|
}
|
|
@@ -215954,12 +215954,12 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
215954
215954
|
return Promise.resolve(createIterResult(undefined, true));
|
|
215955
215955
|
}
|
|
215956
215956
|
if (this[kStream].destroyed) {
|
|
215957
|
-
return new Promise(function(
|
|
215957
|
+
return new Promise(function(resolve7, reject) {
|
|
215958
215958
|
process.nextTick(function() {
|
|
215959
215959
|
if (_this[kError]) {
|
|
215960
215960
|
reject(_this[kError]);
|
|
215961
215961
|
} else {
|
|
215962
|
-
|
|
215962
|
+
resolve7(createIterResult(undefined, true));
|
|
215963
215963
|
}
|
|
215964
215964
|
});
|
|
215965
215965
|
});
|
|
@@ -215982,13 +215982,13 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
215982
215982
|
return this;
|
|
215983
215983
|
}), _defineProperty(_Object$setPrototypeO, "return", function _return() {
|
|
215984
215984
|
var _this2 = this;
|
|
215985
|
-
return new Promise(function(
|
|
215985
|
+
return new Promise(function(resolve7, reject) {
|
|
215986
215986
|
_this2[kStream].destroy(null, function(err) {
|
|
215987
215987
|
if (err) {
|
|
215988
215988
|
reject(err);
|
|
215989
215989
|
return;
|
|
215990
215990
|
}
|
|
215991
|
-
|
|
215991
|
+
resolve7(createIterResult(undefined, true));
|
|
215992
215992
|
});
|
|
215993
215993
|
});
|
|
215994
215994
|
}), _Object$setPrototypeO), AsyncIteratorPrototype);
|
|
@@ -216010,15 +216010,15 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
216010
216010
|
value: stream._readableState.endEmitted,
|
|
216011
216011
|
writable: true
|
|
216012
216012
|
}), _defineProperty(_Object$create, kHandlePromise, {
|
|
216013
|
-
value: function value(
|
|
216013
|
+
value: function value(resolve7, reject) {
|
|
216014
216014
|
var data = iterator[kStream].read();
|
|
216015
216015
|
if (data) {
|
|
216016
216016
|
iterator[kLastPromise] = null;
|
|
216017
216017
|
iterator[kLastResolve] = null;
|
|
216018
216018
|
iterator[kLastReject] = null;
|
|
216019
|
-
|
|
216019
|
+
resolve7(createIterResult(data, false));
|
|
216020
216020
|
} else {
|
|
216021
|
-
iterator[kLastResolve] =
|
|
216021
|
+
iterator[kLastResolve] = resolve7;
|
|
216022
216022
|
iterator[kLastReject] = reject;
|
|
216023
216023
|
}
|
|
216024
216024
|
},
|
|
@@ -216037,12 +216037,12 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
216037
216037
|
iterator[kError] = err;
|
|
216038
216038
|
return;
|
|
216039
216039
|
}
|
|
216040
|
-
var
|
|
216041
|
-
if (
|
|
216040
|
+
var resolve7 = iterator[kLastResolve];
|
|
216041
|
+
if (resolve7 !== null) {
|
|
216042
216042
|
iterator[kLastPromise] = null;
|
|
216043
216043
|
iterator[kLastResolve] = null;
|
|
216044
216044
|
iterator[kLastReject] = null;
|
|
216045
|
-
|
|
216045
|
+
resolve7(createIterResult(undefined, true));
|
|
216046
216046
|
}
|
|
216047
216047
|
iterator[kEnded] = true;
|
|
216048
216048
|
});
|
|
@@ -216054,7 +216054,7 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
216054
216054
|
|
|
216055
216055
|
// ../../node_modules/readable-stream/lib/internal/streams/from.js
|
|
216056
216056
|
var require_from = __commonJS((exports, module) => {
|
|
216057
|
-
function asyncGeneratorStep(gen,
|
|
216057
|
+
function asyncGeneratorStep(gen, resolve7, reject, _next, _throw, key2, arg) {
|
|
216058
216058
|
try {
|
|
216059
216059
|
var info = gen[key2](arg);
|
|
216060
216060
|
var value = info.value;
|
|
@@ -216063,7 +216063,7 @@ var require_from = __commonJS((exports, module) => {
|
|
|
216063
216063
|
return;
|
|
216064
216064
|
}
|
|
216065
216065
|
if (info.done) {
|
|
216066
|
-
|
|
216066
|
+
resolve7(value);
|
|
216067
216067
|
} else {
|
|
216068
216068
|
Promise.resolve(value).then(_next, _throw);
|
|
216069
216069
|
}
|
|
@@ -216071,13 +216071,13 @@ var require_from = __commonJS((exports, module) => {
|
|
|
216071
216071
|
function _asyncToGenerator(fn9) {
|
|
216072
216072
|
return function() {
|
|
216073
216073
|
var self2 = this, args = arguments;
|
|
216074
|
-
return new Promise(function(
|
|
216074
|
+
return new Promise(function(resolve7, reject) {
|
|
216075
216075
|
var gen = fn9.apply(self2, args);
|
|
216076
216076
|
function _next(value) {
|
|
216077
|
-
asyncGeneratorStep(gen,
|
|
216077
|
+
asyncGeneratorStep(gen, resolve7, reject, _next, _throw, "next", value);
|
|
216078
216078
|
}
|
|
216079
216079
|
function _throw(err) {
|
|
216080
|
-
asyncGeneratorStep(gen,
|
|
216080
|
+
asyncGeneratorStep(gen, resolve7, reject, _next, _throw, "throw", err);
|
|
216081
216081
|
}
|
|
216082
216082
|
_next(undefined);
|
|
216083
216083
|
});
|
|
@@ -218270,7 +218270,7 @@ var require_dist5 = __commonJS((exports, module) => {
|
|
|
218270
218270
|
});
|
|
218271
218271
|
|
|
218272
218272
|
// src/cli/index.ts
|
|
218273
|
-
import { dirname as
|
|
218273
|
+
import { dirname as dirname19, join as join25 } from "node:path";
|
|
218274
218274
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
218275
218275
|
|
|
218276
218276
|
// ../../node_modules/@clack/core/dist/index.mjs
|
|
@@ -235098,8 +235098,8 @@ var TOKEN_REFRESH_BUFFER_MS = 60 * 1000;
|
|
|
235098
235098
|
var refreshPromise = null;
|
|
235099
235099
|
async function readAuth() {
|
|
235100
235100
|
try {
|
|
235101
|
-
const
|
|
235102
|
-
const result = AuthDataSchema.safeParse(
|
|
235101
|
+
const authData = await readJsonFile(getAuthFilePath());
|
|
235102
|
+
const result = AuthDataSchema.safeParse(authData);
|
|
235103
235103
|
if (!result.success) {
|
|
235104
235104
|
throw new SchemaValidationError("Invalid authentication data", result.error, getAuthFilePath());
|
|
235105
235105
|
}
|
|
@@ -241974,11 +241974,7 @@ async function updateSocialLoginConfig(authDir, provider, enable, customOAuth) {
|
|
|
241974
241974
|
const current = await readAuthConfig(authDir) ?? DEFAULT_AUTH_CONFIG;
|
|
241975
241975
|
const merged = {
|
|
241976
241976
|
...current,
|
|
241977
|
-
[providerInfo.field]: enable
|
|
241978
|
-
...enable && {
|
|
241979
|
-
enableSSOLogin: false,
|
|
241980
|
-
ssoProviderName: null
|
|
241981
|
-
}
|
|
241977
|
+
[providerInfo.field]: enable
|
|
241982
241978
|
};
|
|
241983
241979
|
if (providerInfo.customOAuth) {
|
|
241984
241980
|
const oauth = providerInfo.customOAuth;
|
|
@@ -242002,182 +241998,6 @@ async function pushCustomOAuthSecret(provider, clientSecret) {
|
|
|
242002
241998
|
[providerInfo.customOAuth.secretKey]: clientSecret
|
|
242003
241999
|
});
|
|
242004
242000
|
}
|
|
242005
|
-
// src/core/resources/auth-config/sso/secret-keys.ts
|
|
242006
|
-
var SSOSecretKey;
|
|
242007
|
-
((SSOSecretKey2) => {
|
|
242008
|
-
SSOSecretKey2["Name"] = "sso_name";
|
|
242009
|
-
SSOSecretKey2["ClientId"] = "sso_client_id";
|
|
242010
|
-
SSOSecretKey2["ClientSecret"] = "sso_client_secret";
|
|
242011
|
-
SSOSecretKey2["Scope"] = "sso_scope";
|
|
242012
|
-
SSOSecretKey2["DiscoveryUrl"] = "sso_discovery_url";
|
|
242013
|
-
SSOSecretKey2["TenantId"] = "sso_tenant_id";
|
|
242014
|
-
SSOSecretKey2["AuthEndpoint"] = "sso_auth_endpoint";
|
|
242015
|
-
SSOSecretKey2["TokenEndpoint"] = "sso_token_endpoint";
|
|
242016
|
-
SSOSecretKey2["UserinfoEndpoint"] = "sso_userinfo_endpoint";
|
|
242017
|
-
SSOSecretKey2["OktaDomain"] = "sso_okta_domain";
|
|
242018
|
-
SSOSecretKey2["JwksUri"] = "sso_jwks_uri";
|
|
242019
|
-
})(SSOSecretKey ||= {});
|
|
242020
|
-
var ALL_SSO_SECRET_KEYS = Object.values(SSOSecretKey);
|
|
242021
|
-
var DEFAULT_OIDC_SCOPE = "openid email profile";
|
|
242022
|
-
var DEFAULT_GITHUB_SCOPE = "user:email";
|
|
242023
|
-
|
|
242024
|
-
// src/core/resources/auth-config/sso/providers/custom.ts
|
|
242025
|
-
var customProvider = {
|
|
242026
|
-
requiredKeys: [
|
|
242027
|
-
"sso_auth_endpoint" /* AuthEndpoint */,
|
|
242028
|
-
"sso_token_endpoint" /* TokenEndpoint */,
|
|
242029
|
-
"sso_userinfo_endpoint" /* UserinfoEndpoint */,
|
|
242030
|
-
"sso_jwks_uri" /* JwksUri */
|
|
242031
|
-
],
|
|
242032
|
-
defaults: {
|
|
242033
|
-
["sso_scope" /* Scope */]: DEFAULT_OIDC_SCOPE
|
|
242034
|
-
}
|
|
242035
|
-
};
|
|
242036
|
-
|
|
242037
|
-
// src/core/resources/auth-config/sso/providers/github.ts
|
|
242038
|
-
var githubProvider = {
|
|
242039
|
-
requiredKeys: [],
|
|
242040
|
-
defaults: {
|
|
242041
|
-
["sso_scope" /* Scope */]: DEFAULT_GITHUB_SCOPE,
|
|
242042
|
-
["sso_auth_endpoint" /* AuthEndpoint */]: "https://github.com/login/oauth/authorize",
|
|
242043
|
-
["sso_token_endpoint" /* TokenEndpoint */]: "https://github.com/login/oauth/access_token",
|
|
242044
|
-
["sso_userinfo_endpoint" /* UserinfoEndpoint */]: "https://api.github.com/user"
|
|
242045
|
-
}
|
|
242046
|
-
};
|
|
242047
|
-
|
|
242048
|
-
// src/core/resources/auth-config/sso/providers/google.ts
|
|
242049
|
-
var googleProvider = {
|
|
242050
|
-
requiredKeys: [],
|
|
242051
|
-
defaults: {
|
|
242052
|
-
["sso_scope" /* Scope */]: DEFAULT_OIDC_SCOPE,
|
|
242053
|
-
["sso_discovery_url" /* DiscoveryUrl */]: "https://accounts.google.com/.well-known/openid-configuration"
|
|
242054
|
-
}
|
|
242055
|
-
};
|
|
242056
|
-
|
|
242057
|
-
// src/core/resources/auth-config/sso/providers/microsoft.ts
|
|
242058
|
-
var microsoftProvider = {
|
|
242059
|
-
requiredKeys: ["sso_tenant_id" /* TenantId */],
|
|
242060
|
-
defaults: {
|
|
242061
|
-
["sso_scope" /* Scope */]: DEFAULT_OIDC_SCOPE
|
|
242062
|
-
},
|
|
242063
|
-
deriveDefaults: (secrets) => {
|
|
242064
|
-
const tenantId = secrets["sso_tenant_id" /* TenantId */];
|
|
242065
|
-
if (tenantId) {
|
|
242066
|
-
return {
|
|
242067
|
-
["sso_discovery_url" /* DiscoveryUrl */]: `https://login.microsoftonline.com/${tenantId}/v2.0/.well-known/openid-configuration`
|
|
242068
|
-
};
|
|
242069
|
-
}
|
|
242070
|
-
return {};
|
|
242071
|
-
}
|
|
242072
|
-
};
|
|
242073
|
-
|
|
242074
|
-
// src/core/resources/auth-config/sso/providers/okta.ts
|
|
242075
|
-
var oktaProvider = {
|
|
242076
|
-
requiredKeys: ["sso_okta_domain" /* OktaDomain */],
|
|
242077
|
-
defaults: {
|
|
242078
|
-
["sso_scope" /* Scope */]: DEFAULT_OIDC_SCOPE
|
|
242079
|
-
},
|
|
242080
|
-
deriveDefaults: (secrets) => {
|
|
242081
|
-
const domain2 = secrets["sso_okta_domain" /* OktaDomain */];
|
|
242082
|
-
if (domain2) {
|
|
242083
|
-
return {
|
|
242084
|
-
["sso_discovery_url" /* DiscoveryUrl */]: `https://${domain2}/.well-known/openid-configuration`
|
|
242085
|
-
};
|
|
242086
|
-
}
|
|
242087
|
-
return {};
|
|
242088
|
-
}
|
|
242089
|
-
};
|
|
242090
|
-
|
|
242091
|
-
// src/core/resources/auth-config/sso/providers/index.ts
|
|
242092
|
-
var SSO_PROVIDER_SCHEMAS = {
|
|
242093
|
-
google: googleProvider,
|
|
242094
|
-
microsoft: microsoftProvider,
|
|
242095
|
-
github: githubProvider,
|
|
242096
|
-
okta: oktaProvider,
|
|
242097
|
-
custom: customProvider
|
|
242098
|
-
};
|
|
242099
|
-
|
|
242100
|
-
// src/core/resources/auth-config/sso/types.ts
|
|
242101
|
-
var KNOWN_SSO_PROVIDERS = {
|
|
242102
|
-
google: "google",
|
|
242103
|
-
microsoft: "microsoft",
|
|
242104
|
-
github: "github",
|
|
242105
|
-
okta: "okta",
|
|
242106
|
-
custom: "custom"
|
|
242107
|
-
};
|
|
242108
|
-
|
|
242109
|
-
// src/core/resources/auth-config/sso/operations.ts
|
|
242110
|
-
var OPTION_TO_SECRET_KEY = {
|
|
242111
|
-
scope: "sso_scope" /* Scope */,
|
|
242112
|
-
discoveryUrl: "sso_discovery_url" /* DiscoveryUrl */,
|
|
242113
|
-
tenantId: "sso_tenant_id" /* TenantId */,
|
|
242114
|
-
oktaDomain: "sso_okta_domain" /* OktaDomain */,
|
|
242115
|
-
authEndpoint: "sso_auth_endpoint" /* AuthEndpoint */,
|
|
242116
|
-
tokenEndpoint: "sso_token_endpoint" /* TokenEndpoint */,
|
|
242117
|
-
userinfoEndpoint: "sso_userinfo_endpoint" /* UserinfoEndpoint */,
|
|
242118
|
-
jwksUri: "sso_jwks_uri" /* JwksUri */
|
|
242119
|
-
};
|
|
242120
|
-
async function updateSSOConfig(authDir, provider, enable) {
|
|
242121
|
-
const current = await readAuthConfig(authDir) ?? DEFAULT_AUTH_CONFIG;
|
|
242122
|
-
const merged = {
|
|
242123
|
-
...current,
|
|
242124
|
-
enableSSOLogin: enable,
|
|
242125
|
-
ssoProviderName: enable && provider ? provider : null,
|
|
242126
|
-
...enable && {
|
|
242127
|
-
enableGoogleLogin: false,
|
|
242128
|
-
enableMicrosoftLogin: false,
|
|
242129
|
-
enableFacebookLogin: false,
|
|
242130
|
-
enableAppleLogin: false
|
|
242131
|
-
}
|
|
242132
|
-
};
|
|
242133
|
-
await writeAuthConfig(authDir, merged);
|
|
242134
|
-
return merged;
|
|
242135
|
-
}
|
|
242136
|
-
function buildSSOSecrets(provider, options) {
|
|
242137
|
-
const schema3 = SSO_PROVIDER_SCHEMAS[provider];
|
|
242138
|
-
const secrets = {};
|
|
242139
|
-
secrets["sso_name" /* Name */] = options.ssoName ?? provider;
|
|
242140
|
-
secrets["sso_client_id" /* ClientId */] = options.clientId;
|
|
242141
|
-
secrets["sso_client_secret" /* ClientSecret */] = options.clientSecret;
|
|
242142
|
-
for (const [optionKey, secretKey] of Object.entries(OPTION_TO_SECRET_KEY)) {
|
|
242143
|
-
const value = options[optionKey];
|
|
242144
|
-
if (typeof value === "string" && value.length > 0) {
|
|
242145
|
-
secrets[secretKey] = value;
|
|
242146
|
-
}
|
|
242147
|
-
}
|
|
242148
|
-
if (schema3.deriveDefaults) {
|
|
242149
|
-
const derived = schema3.deriveDefaults(secrets);
|
|
242150
|
-
for (const [key, val] of Object.entries(derived)) {
|
|
242151
|
-
if (!secrets[key]) {
|
|
242152
|
-
secrets[key] = val;
|
|
242153
|
-
}
|
|
242154
|
-
}
|
|
242155
|
-
}
|
|
242156
|
-
for (const [key, val] of Object.entries(schema3.defaults)) {
|
|
242157
|
-
if (!secrets[key]) {
|
|
242158
|
-
secrets[key] = val;
|
|
242159
|
-
}
|
|
242160
|
-
}
|
|
242161
|
-
const missing = [];
|
|
242162
|
-
for (const key of schema3.requiredKeys) {
|
|
242163
|
-
if (!secrets[key]) {
|
|
242164
|
-
missing.push(key);
|
|
242165
|
-
}
|
|
242166
|
-
}
|
|
242167
|
-
if (provider === KNOWN_SSO_PROVIDERS.custom && !options.ssoName) {
|
|
242168
|
-
missing.push("sso_name" /* Name */);
|
|
242169
|
-
}
|
|
242170
|
-
if (missing.length > 0) {
|
|
242171
|
-
throw new InvalidInputError(`Missing required fields for ${provider}: ${missing.join(", ")}`);
|
|
242172
|
-
}
|
|
242173
|
-
return Object.fromEntries(Object.entries(secrets).filter(([, v]) => v.length > 0));
|
|
242174
|
-
}
|
|
242175
|
-
async function pushSSOSecrets(secrets) {
|
|
242176
|
-
await setSecrets(secrets);
|
|
242177
|
-
}
|
|
242178
|
-
async function deleteSSOSecrets() {
|
|
242179
|
-
await Promise.allSettled(ALL_SSO_SECRET_KEYS.map((key) => deleteSecret(key)));
|
|
242180
|
-
}
|
|
242181
242001
|
// src/core/resources/connector/schema.ts
|
|
242182
242002
|
var GoogleCalendarConnectorSchema = exports_external.object({
|
|
242183
242003
|
type: exports_external.literal("googlecalendar"),
|
|
@@ -243538,7 +243358,7 @@ import { join as join9 } from "node:path";
|
|
|
243538
243358
|
// package.json
|
|
243539
243359
|
var package_default = {
|
|
243540
243360
|
name: "base44",
|
|
243541
|
-
version: "0.0.
|
|
243361
|
+
version: "0.0.51",
|
|
243542
243362
|
description: "Base44 CLI - Unified interface for managing Base44 applications",
|
|
243543
243363
|
type: "module",
|
|
243544
243364
|
bin: {
|
|
@@ -243593,6 +243413,7 @@ var package_default = {
|
|
|
243593
243413
|
"@types/multer": "^2.0.0",
|
|
243594
243414
|
"@types/node": "^22.10.5",
|
|
243595
243415
|
"@vercel/detect-agent": "^1.1.0",
|
|
243416
|
+
outdent: "^0.8.0",
|
|
243596
243417
|
chalk: "^5.6.2",
|
|
243597
243418
|
chokidar: "^5.0.0",
|
|
243598
243419
|
commander: "^12.1.0",
|
|
@@ -251215,193 +251036,9 @@ function getSocialLoginCommand() {
|
|
|
251215
251036
|
])).option("--client-id <id>", "custom OAuth client ID (Google only)").option("--client-secret <secret>", "custom OAuth client secret (Google only)").option("--client-secret-stdin", "read client secret from stdin (Google only)").option("--env-file <path>", "read client secret from a .env file (Google only)").action(socialLoginAction);
|
|
251216
251037
|
}
|
|
251217
251038
|
|
|
251218
|
-
// src/cli/commands/auth/sso.ts
|
|
251219
|
-
import { dirname as dirname11, join as join16, resolve as resolve3 } from "node:path";
|
|
251220
|
-
var SSOConfigFileSchema = exports_external.object({
|
|
251221
|
-
provider: exports_external.enum(["google", "microsoft", "github", "okta", "custom"]),
|
|
251222
|
-
clientId: exports_external.string(),
|
|
251223
|
-
clientSecret: exports_external.string(),
|
|
251224
|
-
scope: exports_external.string().optional(),
|
|
251225
|
-
discoveryUrl: exports_external.string().optional(),
|
|
251226
|
-
tenantId: exports_external.string().optional(),
|
|
251227
|
-
oktaDomain: exports_external.string().optional(),
|
|
251228
|
-
authEndpoint: exports_external.string().optional(),
|
|
251229
|
-
tokenEndpoint: exports_external.string().optional(),
|
|
251230
|
-
userinfoEndpoint: exports_external.string().optional(),
|
|
251231
|
-
jwksUri: exports_external.string().optional(),
|
|
251232
|
-
ssoName: exports_external.string().optional()
|
|
251233
|
-
});
|
|
251234
|
-
async function loadSSOConfigFile(filePath) {
|
|
251235
|
-
const resolved = resolve3(filePath);
|
|
251236
|
-
const raw2 = await readJsonFile(resolved);
|
|
251237
|
-
const result = SSOConfigFileSchema.safeParse(raw2);
|
|
251238
|
-
if (!result.success) {
|
|
251239
|
-
const issues = result.error.issues.map((i2) => ` ${i2.path.join(".")}: ${i2.message}`).join(`
|
|
251240
|
-
`);
|
|
251241
|
-
throw new InvalidInputError(`Invalid SSO config file ${filePath}:
|
|
251242
|
-
${issues}`);
|
|
251243
|
-
}
|
|
251244
|
-
return result.data;
|
|
251245
|
-
}
|
|
251246
|
-
function mergeFileWithFlags(fileConfig, options) {
|
|
251247
|
-
return {
|
|
251248
|
-
provider: options.provider ?? fileConfig.provider,
|
|
251249
|
-
clientId: options.clientId ?? fileConfig.clientId,
|
|
251250
|
-
clientSecret: options.clientSecret ?? fileConfig.clientSecret,
|
|
251251
|
-
clientSecretStdin: options.clientSecretStdin,
|
|
251252
|
-
envFile: options.envFile,
|
|
251253
|
-
scope: options.scope ?? fileConfig.scope,
|
|
251254
|
-
discoveryUrl: options.discoveryUrl ?? fileConfig.discoveryUrl,
|
|
251255
|
-
tenantId: options.tenantId ?? fileConfig.tenantId,
|
|
251256
|
-
oktaDomain: options.oktaDomain ?? fileConfig.oktaDomain,
|
|
251257
|
-
authEndpoint: options.authEndpoint ?? fileConfig.authEndpoint,
|
|
251258
|
-
tokenEndpoint: options.tokenEndpoint ?? fileConfig.tokenEndpoint,
|
|
251259
|
-
userinfoEndpoint: options.userinfoEndpoint ?? fileConfig.userinfoEndpoint,
|
|
251260
|
-
jwksUri: options.jwksUri ?? fileConfig.jwksUri,
|
|
251261
|
-
ssoName: options.ssoName ?? fileConfig.ssoName
|
|
251262
|
-
};
|
|
251263
|
-
}
|
|
251264
|
-
var providerNames = Object.keys(KNOWN_SSO_PROVIDERS);
|
|
251265
|
-
function secretKeyToFlag(key) {
|
|
251266
|
-
return `--${key.replace(/^sso_/, "").replace(/_/g, "-")}`;
|
|
251267
|
-
}
|
|
251268
|
-
function exampleCommand(provider) {
|
|
251269
|
-
let cmd = `base44 auth sso enable --provider ${provider} --client-id <id> --client-secret <secret>`;
|
|
251270
|
-
if (provider === KNOWN_SSO_PROVIDERS.microsoft)
|
|
251271
|
-
cmd += " --tenant-id <id>";
|
|
251272
|
-
if (provider === KNOWN_SSO_PROVIDERS.okta)
|
|
251273
|
-
cmd += " --okta-domain <domain>";
|
|
251274
|
-
if (provider === KNOWN_SSO_PROVIDERS.custom)
|
|
251275
|
-
cmd += " --sso-name <name> --auth-endpoint <url> --token-endpoint <url> --userinfo-endpoint <url> --jwks-uri <url>";
|
|
251276
|
-
return cmd;
|
|
251277
|
-
}
|
|
251278
|
-
function validateProvider(provider) {
|
|
251279
|
-
if (!provider) {
|
|
251280
|
-
throw new InvalidInputError("Missing --provider.", {
|
|
251281
|
-
hints: [
|
|
251282
|
-
{
|
|
251283
|
-
message: `Valid providers: ${providerNames.join(", ")}`,
|
|
251284
|
-
command: "base44 auth sso enable --provider <provider> --client-id <id> --client-secret <secret>"
|
|
251285
|
-
}
|
|
251286
|
-
]
|
|
251287
|
-
});
|
|
251288
|
-
}
|
|
251289
|
-
return provider;
|
|
251290
|
-
}
|
|
251291
|
-
async function ssoEnableAction({ isNonInteractive, runTask: runTask2 }, options) {
|
|
251292
|
-
let merged = options;
|
|
251293
|
-
if (options.file) {
|
|
251294
|
-
const fileConfig = await loadSSOConfigFile(options.file);
|
|
251295
|
-
merged = mergeFileWithFlags(fileConfig, options);
|
|
251296
|
-
}
|
|
251297
|
-
const provider = validateProvider(merged.provider);
|
|
251298
|
-
if (!merged.clientId) {
|
|
251299
|
-
throw new InvalidInputError("Missing --client-id.", {
|
|
251300
|
-
hints: [
|
|
251301
|
-
{
|
|
251302
|
-
message: `Example: base44 auth sso enable --provider ${provider} --client-id <id> --client-secret <secret>`,
|
|
251303
|
-
command: `base44 auth sso enable --provider ${provider} --client-id <id> --client-secret <secret>`
|
|
251304
|
-
}
|
|
251305
|
-
]
|
|
251306
|
-
});
|
|
251307
|
-
}
|
|
251308
|
-
let clientSecret;
|
|
251309
|
-
if (merged.envFile && !merged.clientSecret) {
|
|
251310
|
-
const secrets2 = await parseEnvFile(resolve3(merged.envFile));
|
|
251311
|
-
const value = secrets2.sso_client_secret;
|
|
251312
|
-
if (!value) {
|
|
251313
|
-
throw new InvalidInputError(`Key "sso_client_secret" not found in ${merged.envFile}.`);
|
|
251314
|
-
}
|
|
251315
|
-
clientSecret = value;
|
|
251316
|
-
} else {
|
|
251317
|
-
clientSecret = await resolveSecret({
|
|
251318
|
-
flagValue: merged.clientSecret,
|
|
251319
|
-
fromStdin: merged.clientSecretStdin,
|
|
251320
|
-
envVar: "sso_client_secret",
|
|
251321
|
-
promptMessage: "Enter SSO client secret",
|
|
251322
|
-
isNonInteractive,
|
|
251323
|
-
name: "client secret",
|
|
251324
|
-
hints: [
|
|
251325
|
-
{
|
|
251326
|
-
message: `Provide via flag: base44 auth sso enable --provider ${provider} --client-id <id> --client-secret <secret>`,
|
|
251327
|
-
command: `base44 auth sso enable --provider ${provider} --client-id <id> --client-secret <secret>`
|
|
251328
|
-
},
|
|
251329
|
-
{
|
|
251330
|
-
message: `Provide via stdin: echo <secret> | base44 auth sso enable --provider ${provider} --client-id <id> --client-secret-stdin`
|
|
251331
|
-
},
|
|
251332
|
-
{
|
|
251333
|
-
message: `Provide via env: sso_client_secret=<secret> base44 auth sso enable --provider ${provider} --client-id <id>`
|
|
251334
|
-
}
|
|
251335
|
-
]
|
|
251336
|
-
});
|
|
251337
|
-
}
|
|
251338
|
-
const secretOptions = {
|
|
251339
|
-
clientId: merged.clientId,
|
|
251340
|
-
clientSecret,
|
|
251341
|
-
scope: merged.scope,
|
|
251342
|
-
discoveryUrl: merged.discoveryUrl,
|
|
251343
|
-
tenantId: merged.tenantId,
|
|
251344
|
-
oktaDomain: merged.oktaDomain,
|
|
251345
|
-
authEndpoint: merged.authEndpoint,
|
|
251346
|
-
tokenEndpoint: merged.tokenEndpoint,
|
|
251347
|
-
userinfoEndpoint: merged.userinfoEndpoint,
|
|
251348
|
-
jwksUri: merged.jwksUri,
|
|
251349
|
-
ssoName: merged.ssoName
|
|
251350
|
-
};
|
|
251351
|
-
let secrets;
|
|
251352
|
-
try {
|
|
251353
|
-
secrets = buildSSOSecrets(provider, secretOptions);
|
|
251354
|
-
} catch (error48) {
|
|
251355
|
-
if (error48 instanceof InvalidInputError) {
|
|
251356
|
-
const flagMessage = error48.message.replace(/sso_[a-z_]+/g, (key) => secretKeyToFlag(key));
|
|
251357
|
-
throw new InvalidInputError(flagMessage, {
|
|
251358
|
-
hints: [
|
|
251359
|
-
{
|
|
251360
|
-
message: `Example: ${exampleCommand(provider)}`,
|
|
251361
|
-
command: exampleCommand(provider)
|
|
251362
|
-
}
|
|
251363
|
-
]
|
|
251364
|
-
});
|
|
251365
|
-
}
|
|
251366
|
-
throw error48;
|
|
251367
|
-
}
|
|
251368
|
-
const { project: project2 } = await readProjectConfig();
|
|
251369
|
-
const configDir = dirname11(project2.configPath);
|
|
251370
|
-
const authDir = join16(configDir, project2.authDir);
|
|
251371
|
-
await runTask2("Updating local auth config", async () => updateSSOConfig(authDir, provider, true));
|
|
251372
|
-
await runTask2("Saving SSO credentials", async () => pushSSOSecrets(secrets));
|
|
251373
|
-
return {
|
|
251374
|
-
outroMessage: `SSO configured with ${provider} in local config. Run \`base44 auth push\` or \`base44 deploy\` to apply.`
|
|
251375
|
-
};
|
|
251376
|
-
}
|
|
251377
|
-
async function ssoDisableAction({
|
|
251378
|
-
runTask: runTask2
|
|
251379
|
-
}) {
|
|
251380
|
-
const { project: project2 } = await readProjectConfig();
|
|
251381
|
-
const configDir = dirname11(project2.configPath);
|
|
251382
|
-
const authDir = join16(configDir, project2.authDir);
|
|
251383
|
-
await runTask2("Updating local auth config", async () => updateSSOConfig(authDir, null, false));
|
|
251384
|
-
await runTask2("Removing SSO credentials", async () => deleteSSOSecrets());
|
|
251385
|
-
return {
|
|
251386
|
-
outroMessage: "SSO disabled in local config and credentials removed. Run `base44 auth push` or `base44 deploy` to apply."
|
|
251387
|
-
};
|
|
251388
|
-
}
|
|
251389
|
-
async function ssoAction(context, action, options) {
|
|
251390
|
-
if (action === "disable") {
|
|
251391
|
-
return ssoDisableAction(context);
|
|
251392
|
-
}
|
|
251393
|
-
return ssoEnableAction(context, options);
|
|
251394
|
-
}
|
|
251395
|
-
function getSSOCommand() {
|
|
251396
|
-
return new Base44Command("sso").description("Configure SSO identity provider (google, microsoft, github, okta, custom)").addArgument(new Argument("<action>", "enable or disable SSO").choices([
|
|
251397
|
-
"enable",
|
|
251398
|
-
"disable"
|
|
251399
|
-
])).addOption(new Option("--provider <provider>", "SSO provider").choices(Object.values(KNOWN_SSO_PROVIDERS))).option("--client-id <id>", "OAuth client ID").option("--client-secret <secret>", "OAuth client secret").option("--client-secret-stdin", "Read client secret from stdin").option("--env-file <path>", "Read client secret from a .env file (key: sso_client_secret)").option("--file <path>", "JSON config file with all SSO settings").option("--scope <scope>", "OAuth scope (defaults per provider)").option("--discovery-url <url>", "OIDC discovery URL").option("--tenant-id <id>", "Microsoft tenant ID (required for microsoft)").option("--okta-domain <domain>", "Okta domain (required for okta)").option("--auth-endpoint <url>", "Authorization endpoint (required for custom)").option("--token-endpoint <url>", "Token endpoint (required for custom)").option("--userinfo-endpoint <url>", "Userinfo endpoint (required for custom)").option("--jwks-uri <url>", "JWKS URI (required for custom)").option("--sso-name <name>", "Provider display name (required for custom)").action(ssoAction);
|
|
251400
|
-
}
|
|
251401
|
-
|
|
251402
251039
|
// src/cli/commands/auth/index.ts
|
|
251403
251040
|
function getAuthCommand() {
|
|
251404
|
-
return new Command("auth").description("Manage app authentication settings").addCommand(getPasswordLoginCommand()).addCommand(getSocialLoginCommand()).addCommand(
|
|
251041
|
+
return new Command("auth").description("Manage app authentication settings").addCommand(getPasswordLoginCommand()).addCommand(getSocialLoginCommand()).addCommand(getAuthPullCommand()).addCommand(getAuthPushCommand());
|
|
251405
251042
|
}
|
|
251406
251043
|
|
|
251407
251044
|
// src/cli/commands/auth/login.ts
|
|
@@ -251463,14 +251100,14 @@ function getConnectorsListAvailableCommand() {
|
|
|
251463
251100
|
}
|
|
251464
251101
|
|
|
251465
251102
|
// src/cli/commands/connectors/pull.ts
|
|
251466
|
-
import { dirname as
|
|
251103
|
+
import { dirname as dirname11, join as join16 } from "node:path";
|
|
251467
251104
|
async function pullConnectorsAction({
|
|
251468
251105
|
log,
|
|
251469
251106
|
runTask: runTask2
|
|
251470
251107
|
}) {
|
|
251471
251108
|
const { project: project2 } = await readProjectConfig();
|
|
251472
|
-
const configDir =
|
|
251473
|
-
const connectorsDir =
|
|
251109
|
+
const configDir = dirname11(project2.configPath);
|
|
251110
|
+
const connectorsDir = join16(configDir, project2.connectorsDir);
|
|
251474
251111
|
const remoteConnectors = await runTask2("Fetching connectors from Base44", async () => {
|
|
251475
251112
|
return await pullAllConnectors();
|
|
251476
251113
|
}, {
|
|
@@ -251999,19 +251636,19 @@ var baseOpen = async (options) => {
|
|
|
251999
251636
|
}
|
|
252000
251637
|
const subprocess = childProcess3.spawn(command2, cliArguments, childProcessOptions);
|
|
252001
251638
|
if (options.wait) {
|
|
252002
|
-
return new Promise((
|
|
251639
|
+
return new Promise((resolve3, reject) => {
|
|
252003
251640
|
subprocess.once("error", reject);
|
|
252004
251641
|
subprocess.once("close", (exitCode) => {
|
|
252005
251642
|
if (!options.allowNonzeroExitCode && exitCode !== 0) {
|
|
252006
251643
|
reject(new Error(`Exited with code ${exitCode}`));
|
|
252007
251644
|
return;
|
|
252008
251645
|
}
|
|
252009
|
-
|
|
251646
|
+
resolve3(subprocess);
|
|
252010
251647
|
});
|
|
252011
251648
|
});
|
|
252012
251649
|
}
|
|
252013
251650
|
if (isFallbackAttempt) {
|
|
252014
|
-
return new Promise((
|
|
251651
|
+
return new Promise((resolve3, reject) => {
|
|
252015
251652
|
subprocess.once("error", reject);
|
|
252016
251653
|
subprocess.once("spawn", () => {
|
|
252017
251654
|
subprocess.once("close", (exitCode) => {
|
|
@@ -252021,17 +251658,17 @@ var baseOpen = async (options) => {
|
|
|
252021
251658
|
return;
|
|
252022
251659
|
}
|
|
252023
251660
|
subprocess.unref();
|
|
252024
|
-
|
|
251661
|
+
resolve3(subprocess);
|
|
252025
251662
|
});
|
|
252026
251663
|
});
|
|
252027
251664
|
});
|
|
252028
251665
|
}
|
|
252029
251666
|
subprocess.unref();
|
|
252030
|
-
return new Promise((
|
|
251667
|
+
return new Promise((resolve3, reject) => {
|
|
252031
251668
|
subprocess.once("error", reject);
|
|
252032
251669
|
subprocess.once("spawn", () => {
|
|
252033
251670
|
subprocess.off("error", reject);
|
|
252034
|
-
|
|
251671
|
+
resolve3(subprocess);
|
|
252035
251672
|
});
|
|
252036
251673
|
});
|
|
252037
251674
|
};
|
|
@@ -252525,11 +252162,11 @@ function getListCommand() {
|
|
|
252525
252162
|
}
|
|
252526
252163
|
|
|
252527
252164
|
// src/cli/commands/functions/pull.ts
|
|
252528
|
-
import { dirname as
|
|
252165
|
+
import { dirname as dirname12, join as join17 } from "node:path";
|
|
252529
252166
|
async function pullFunctionsAction({ log, runTask: runTask2 }, name2) {
|
|
252530
252167
|
const { project: project2 } = await readProjectConfig();
|
|
252531
|
-
const configDir =
|
|
252532
|
-
const functionsDir =
|
|
252168
|
+
const configDir = dirname12(project2.configPath);
|
|
252169
|
+
const functionsDir = join17(configDir, project2.functionsDir);
|
|
252533
252170
|
const remoteFunctions = await runTask2("Fetching functions from Base44", async () => {
|
|
252534
252171
|
const { functions } = await listDeployedFunctions();
|
|
252535
252172
|
return functions;
|
|
@@ -252572,7 +252209,7 @@ function getFunctionsCommand() {
|
|
|
252572
252209
|
}
|
|
252573
252210
|
|
|
252574
252211
|
// src/cli/commands/project/create.ts
|
|
252575
|
-
import { basename as basename3, join as
|
|
252212
|
+
import { basename as basename3, join as join18, resolve as resolve3 } from "node:path";
|
|
252576
252213
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
252577
252214
|
var DEFAULT_TEMPLATE_ID = "backend-only";
|
|
252578
252215
|
async function getTemplateById(templateId) {
|
|
@@ -252637,7 +252274,7 @@ async function createInteractive(options, ctx) {
|
|
|
252637
252274
|
}, ctx);
|
|
252638
252275
|
}
|
|
252639
252276
|
async function createNonInteractive(options, ctx) {
|
|
252640
|
-
ctx.log.info(`Creating a new project at ${
|
|
252277
|
+
ctx.log.info(`Creating a new project at ${resolve3(options.path)}`);
|
|
252641
252278
|
const template2 = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
|
|
252642
252279
|
return await executeCreate({
|
|
252643
252280
|
template: template2,
|
|
@@ -252658,7 +252295,7 @@ async function executeCreate({
|
|
|
252658
252295
|
isInteractive
|
|
252659
252296
|
}, { log, runTask: runTask2 }) {
|
|
252660
252297
|
const name2 = rawName.trim();
|
|
252661
|
-
const resolvedPath =
|
|
252298
|
+
const resolvedPath = resolve3(projectPath);
|
|
252662
252299
|
const { projectId } = await runTask2("Setting up your project...", async () => {
|
|
252663
252300
|
return await createProjectFiles({
|
|
252664
252301
|
name: name2,
|
|
@@ -252709,7 +252346,7 @@ async function executeCreate({
|
|
|
252709
252346
|
updateMessage("Building project...");
|
|
252710
252347
|
await execa({ cwd: resolvedPath, shell: true })`${buildCommand}`;
|
|
252711
252348
|
updateMessage("Deploying site...");
|
|
252712
|
-
return await deploySite(
|
|
252349
|
+
return await deploySite(join18(resolvedPath, outputDirectory));
|
|
252713
252350
|
}, {
|
|
252714
252351
|
successMessage: theme.colors.base44Orange("Site deployed successfully"),
|
|
252715
252352
|
errorMessage: "Failed to deploy site"
|
|
@@ -253174,7 +252811,7 @@ function getSecretsListCommand() {
|
|
|
253174
252811
|
}
|
|
253175
252812
|
|
|
253176
252813
|
// src/cli/commands/secrets/set.ts
|
|
253177
|
-
import { resolve as
|
|
252814
|
+
import { resolve as resolve4 } from "node:path";
|
|
253178
252815
|
function parseEntries(entries) {
|
|
253179
252816
|
const secrets = {};
|
|
253180
252817
|
for (const entry of entries) {
|
|
@@ -253205,7 +252842,7 @@ async function setSecretsAction({ log, runTask: runTask2 }, entries, options) {
|
|
|
253205
252842
|
validateInput(entries, options);
|
|
253206
252843
|
let secrets;
|
|
253207
252844
|
if (options.envFile) {
|
|
253208
|
-
secrets = await parseEnvFile(
|
|
252845
|
+
secrets = await parseEnvFile(resolve4(options.envFile));
|
|
253209
252846
|
if (Object.keys(secrets).length === 0) {
|
|
253210
252847
|
throw new InvalidInputError("The env file contains no valid KEY=VALUE entries.");
|
|
253211
252848
|
}
|
|
@@ -253234,7 +252871,7 @@ function getSecretsCommand() {
|
|
|
253234
252871
|
}
|
|
253235
252872
|
|
|
253236
252873
|
// src/cli/commands/site/deploy.ts
|
|
253237
|
-
import { resolve as
|
|
252874
|
+
import { resolve as resolve5 } from "node:path";
|
|
253238
252875
|
async function deployAction2({ isNonInteractive, runTask: runTask2 }, options) {
|
|
253239
252876
|
if (isNonInteractive && !options.yes) {
|
|
253240
252877
|
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
@@ -253249,7 +252886,7 @@ async function deployAction2({ isNonInteractive, runTask: runTask2 }, options) {
|
|
|
253249
252886
|
]
|
|
253250
252887
|
});
|
|
253251
252888
|
}
|
|
253252
|
-
const outputDir =
|
|
252889
|
+
const outputDir = resolve5(project2.root, project2.site.outputDirectory);
|
|
253253
252890
|
if (!options.yes) {
|
|
253254
252891
|
const shouldDeploy = await Re({
|
|
253255
252892
|
message: `Deploy site from ${project2.site.outputDirectory}?`
|
|
@@ -253375,10 +253012,10 @@ function toPascalCase(name2) {
|
|
|
253375
253012
|
return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
|
|
253376
253013
|
}
|
|
253377
253014
|
// src/core/types/update-project.ts
|
|
253378
|
-
import { join as
|
|
253015
|
+
import { join as join21 } from "node:path";
|
|
253379
253016
|
var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
|
|
253380
253017
|
async function updateProjectConfig(projectRoot) {
|
|
253381
|
-
const tsconfigPath =
|
|
253018
|
+
const tsconfigPath = join21(projectRoot, "tsconfig.json");
|
|
253382
253019
|
if (!await pathExists(tsconfigPath)) {
|
|
253383
253020
|
return false;
|
|
253384
253021
|
}
|
|
@@ -253426,7 +253063,7 @@ import process21 from "node:process";
|
|
|
253426
253063
|
// src/cli/dev/dev-server/main.ts
|
|
253427
253064
|
var import_cors = __toESM(require_lib4(), 1);
|
|
253428
253065
|
var import_express6 = __toESM(require_express(), 1);
|
|
253429
|
-
import { dirname as
|
|
253066
|
+
import { dirname as dirname17, join as join24 } from "node:path";
|
|
253430
253067
|
|
|
253431
253068
|
// ../../node_modules/get-port/index.js
|
|
253432
253069
|
import net from "node:net";
|
|
@@ -253453,14 +253090,14 @@ var getLocalHosts = () => {
|
|
|
253453
253090
|
}
|
|
253454
253091
|
return results;
|
|
253455
253092
|
};
|
|
253456
|
-
var checkAvailablePort = (options8) => new Promise((
|
|
253093
|
+
var checkAvailablePort = (options8) => new Promise((resolve7, reject) => {
|
|
253457
253094
|
const server = net.createServer();
|
|
253458
253095
|
server.unref();
|
|
253459
253096
|
server.on("error", reject);
|
|
253460
253097
|
server.listen(options8, () => {
|
|
253461
253098
|
const { port } = server.address();
|
|
253462
253099
|
server.close(() => {
|
|
253463
|
-
|
|
253100
|
+
resolve7(port);
|
|
253464
253101
|
});
|
|
253465
253102
|
});
|
|
253466
253103
|
});
|
|
@@ -253658,15 +253295,21 @@ class FunctionManager {
|
|
|
253658
253295
|
this.setupProcessHandlers(name2, process21);
|
|
253659
253296
|
return this.waitForReady(name2, runningFunc);
|
|
253660
253297
|
}
|
|
253661
|
-
reload(functions) {
|
|
253662
|
-
this.stopAll();
|
|
253298
|
+
async reload(functions) {
|
|
253299
|
+
await this.stopAll();
|
|
253663
253300
|
this.functions = new Map(functions.map((f7) => [f7.name, f7]));
|
|
253664
253301
|
}
|
|
253665
|
-
stopAll() {
|
|
253666
|
-
|
|
253302
|
+
async stopAll() {
|
|
253303
|
+
await Promise.all(Array.from(this.running, ([name2, { process: proc2 }]) => {
|
|
253667
253304
|
this.logger.log(`Stopping function: ${name2}`);
|
|
253668
|
-
|
|
253669
|
-
|
|
253305
|
+
const exited = new Promise((r5) => proc2.once("exit", () => r5()));
|
|
253306
|
+
if (process.platform === "win32" && proc2.pid) {
|
|
253307
|
+
spawn2("taskkill", ["/pid", String(proc2.pid), "/T", "/F"]);
|
|
253308
|
+
} else {
|
|
253309
|
+
proc2.kill();
|
|
253310
|
+
}
|
|
253311
|
+
return exited;
|
|
253312
|
+
}));
|
|
253670
253313
|
this.running.clear();
|
|
253671
253314
|
this.starting.clear();
|
|
253672
253315
|
}
|
|
@@ -253714,7 +253357,7 @@ class FunctionManager {
|
|
|
253714
253357
|
});
|
|
253715
253358
|
}
|
|
253716
253359
|
waitForReady(name2, runningFunc) {
|
|
253717
|
-
return new Promise((
|
|
253360
|
+
return new Promise((resolve7, reject) => {
|
|
253718
253361
|
runningFunc.process.on("exit", (code2) => {
|
|
253719
253362
|
if (!runningFunc.ready) {
|
|
253720
253363
|
clearTimeout(timeout3);
|
|
@@ -253737,7 +253380,7 @@ class FunctionManager {
|
|
|
253737
253380
|
runningFunc.ready = true;
|
|
253738
253381
|
clearTimeout(timeout3);
|
|
253739
253382
|
runningFunc.process.stdout?.off("data", onData);
|
|
253740
|
-
|
|
253383
|
+
resolve7(runningFunc.port);
|
|
253741
253384
|
}
|
|
253742
253385
|
};
|
|
253743
253386
|
runningFunc.process.stdout?.on("data", onData);
|
|
@@ -254054,6 +253697,9 @@ class Database {
|
|
|
254054
253697
|
getCollection(name2) {
|
|
254055
253698
|
return this.collections.get(this.normalizeName(name2));
|
|
254056
253699
|
}
|
|
253700
|
+
getSchema(entityName) {
|
|
253701
|
+
return this.schemas.get(this.normalizeName(entityName));
|
|
253702
|
+
}
|
|
254057
253703
|
getCollectionNames() {
|
|
254058
253704
|
return Array.from(this.collections.keys()).filter((name2) => {
|
|
254059
253705
|
return !name2.startsWith(PRIVATE_COLLECTION_PREFIX);
|
|
@@ -254281,6 +253927,120 @@ In order to complete registration use this verification code: ${otpCode}
|
|
|
254281
253927
|
// src/cli/dev/dev-server/routes/entities/entities-router.ts
|
|
254282
253928
|
var import_express4 = __toESM(require_express(), 1);
|
|
254283
253929
|
|
|
253930
|
+
// src/cli/dev/dev-server/db/rls.ts
|
|
253931
|
+
function getRLSFieldValue(key2, source3) {
|
|
253932
|
+
const DATA_FIELD_PREFIX = "data.";
|
|
253933
|
+
return source3[key2.startsWith(DATA_FIELD_PREFIX) ? key2.slice(DATA_FIELD_PREFIX.length) : key2];
|
|
253934
|
+
}
|
|
253935
|
+
function resolveTemplate(value, user) {
|
|
253936
|
+
return value.replace(/\{\{user\.([\w.]+)\}\}/g, (_match, path18) => {
|
|
253937
|
+
return String(getRLSFieldValue(path18, user) ?? "");
|
|
253938
|
+
});
|
|
253939
|
+
}
|
|
253940
|
+
function evaluateOperator(recordValue, operator) {
|
|
253941
|
+
for (const [op2, opValue] of Object.entries(operator)) {
|
|
253942
|
+
switch (op2) {
|
|
253943
|
+
case "$in":
|
|
253944
|
+
if (!Array.isArray(opValue) || !opValue.includes(recordValue)) {
|
|
253945
|
+
return false;
|
|
253946
|
+
}
|
|
253947
|
+
break;
|
|
253948
|
+
case "$nin":
|
|
253949
|
+
if (!Array.isArray(opValue) || opValue.includes(recordValue)) {
|
|
253950
|
+
return false;
|
|
253951
|
+
}
|
|
253952
|
+
break;
|
|
253953
|
+
case "$ne":
|
|
253954
|
+
if (recordValue === opValue)
|
|
253955
|
+
return false;
|
|
253956
|
+
break;
|
|
253957
|
+
case "$all":
|
|
253958
|
+
if (!Array.isArray(recordValue) || !Array.isArray(opValue)) {
|
|
253959
|
+
return false;
|
|
253960
|
+
}
|
|
253961
|
+
if (!opValue.every((v10) => recordValue.includes(v10))) {
|
|
253962
|
+
return false;
|
|
253963
|
+
}
|
|
253964
|
+
break;
|
|
253965
|
+
default:
|
|
253966
|
+
return false;
|
|
253967
|
+
}
|
|
253968
|
+
}
|
|
253969
|
+
return true;
|
|
253970
|
+
}
|
|
253971
|
+
function evaluateUserCondition(condition, user) {
|
|
253972
|
+
for (const [key2, expected] of Object.entries(condition)) {
|
|
253973
|
+
const userValue = getRLSFieldValue(key2, user);
|
|
253974
|
+
if (typeof expected === "object" && expected !== null) {
|
|
253975
|
+
if (!evaluateOperator(userValue, expected))
|
|
253976
|
+
return false;
|
|
253977
|
+
} else {
|
|
253978
|
+
if (userValue !== expected)
|
|
253979
|
+
return false;
|
|
253980
|
+
}
|
|
253981
|
+
}
|
|
253982
|
+
return true;
|
|
253983
|
+
}
|
|
253984
|
+
function evaluateCondition(condition, record2, user) {
|
|
253985
|
+
for (const [key2, value] of Object.entries(condition)) {
|
|
253986
|
+
if (key2 === "user_condition") {
|
|
253987
|
+
if (!evaluateUserCondition(value, user))
|
|
253988
|
+
return false;
|
|
253989
|
+
continue;
|
|
253990
|
+
}
|
|
253991
|
+
if (key2 === "$or") {
|
|
253992
|
+
const conditions = value;
|
|
253993
|
+
if (!conditions.some((c8) => evaluateCondition(c8, record2, user)))
|
|
253994
|
+
return false;
|
|
253995
|
+
continue;
|
|
253996
|
+
}
|
|
253997
|
+
if (key2 === "$and") {
|
|
253998
|
+
const conditions = value;
|
|
253999
|
+
if (!conditions.every((c8) => evaluateCondition(c8, record2, user)))
|
|
254000
|
+
return false;
|
|
254001
|
+
continue;
|
|
254002
|
+
}
|
|
254003
|
+
if (key2 === "$nor") {
|
|
254004
|
+
const conditions = value;
|
|
254005
|
+
if (conditions.some((c8) => evaluateCondition(c8, record2, user)))
|
|
254006
|
+
return false;
|
|
254007
|
+
continue;
|
|
254008
|
+
}
|
|
254009
|
+
const recordValue = getRLSFieldValue(key2, record2);
|
|
254010
|
+
const resolvedValue = typeof value === "string" ? resolveTemplate(value, user) : value;
|
|
254011
|
+
if (typeof resolvedValue === "object" && resolvedValue !== null) {
|
|
254012
|
+
if (!evaluateOperator(recordValue, resolvedValue))
|
|
254013
|
+
return false;
|
|
254014
|
+
} else {
|
|
254015
|
+
if (recordValue !== resolvedValue)
|
|
254016
|
+
return false;
|
|
254017
|
+
}
|
|
254018
|
+
}
|
|
254019
|
+
return true;
|
|
254020
|
+
}
|
|
254021
|
+
function checkRLS(rule, record2, user) {
|
|
254022
|
+
if (rule === undefined)
|
|
254023
|
+
return true;
|
|
254024
|
+
if (typeof rule === "boolean")
|
|
254025
|
+
return rule;
|
|
254026
|
+
if (!user)
|
|
254027
|
+
return false;
|
|
254028
|
+
return evaluateCondition(rule, record2, user);
|
|
254029
|
+
}
|
|
254030
|
+
function applyFLS(record2, schema10, user, operation) {
|
|
254031
|
+
if (Array.isArray(record2)) {
|
|
254032
|
+
return record2.map((r5) => applyFLS(r5, schema10, user, operation));
|
|
254033
|
+
}
|
|
254034
|
+
const result = {};
|
|
254035
|
+
for (const [key2, value] of Object.entries(record2)) {
|
|
254036
|
+
const rule = schema10.properties[key2]?.rls?.[operation];
|
|
254037
|
+
if (!rule || checkRLS(rule, record2, user)) {
|
|
254038
|
+
result[key2] = value;
|
|
254039
|
+
}
|
|
254040
|
+
}
|
|
254041
|
+
return result;
|
|
254042
|
+
}
|
|
254043
|
+
|
|
254284
254044
|
// src/cli/dev/dev-server/db/entity-queries.ts
|
|
254285
254045
|
function parseSort(sort) {
|
|
254286
254046
|
if (!sort) {
|
|
@@ -254338,30 +254098,54 @@ var queryEntity = async (collection, reqQuery) => {
|
|
|
254338
254098
|
return cursor3;
|
|
254339
254099
|
};
|
|
254340
254100
|
|
|
254101
|
+
// src/cli/dev/dev-server/routes/entities/current-user.ts
|
|
254102
|
+
var import_jsonwebtoken2 = __toESM(require_jsonwebtoken(), 1);
|
|
254103
|
+
function getSubject(payload) {
|
|
254104
|
+
if (!payload || typeof payload === "string") {
|
|
254105
|
+
return;
|
|
254106
|
+
}
|
|
254107
|
+
return payload.sub;
|
|
254108
|
+
}
|
|
254109
|
+
async function resolveCurrentUser(db2, req) {
|
|
254110
|
+
const auth2 = req.headers.authorization;
|
|
254111
|
+
if (!auth2?.startsWith("Bearer ")) {
|
|
254112
|
+
return { ok: false, reason: "missing" };
|
|
254113
|
+
}
|
|
254114
|
+
try {
|
|
254115
|
+
const decoded = import_jsonwebtoken2.default.decode(auth2.replace("Bearer ", ""), {
|
|
254116
|
+
complete: true
|
|
254117
|
+
});
|
|
254118
|
+
const subject = getSubject(decoded?.payload);
|
|
254119
|
+
if (!subject) {
|
|
254120
|
+
return { ok: false, reason: "invalid" };
|
|
254121
|
+
}
|
|
254122
|
+
const currentUser = await db2.getCollection(USER_COLLECTION)?.findOneAsync({ email: subject });
|
|
254123
|
+
if (!currentUser) {
|
|
254124
|
+
return { ok: false, reason: "not_found" };
|
|
254125
|
+
}
|
|
254126
|
+
return { ok: true, user: currentUser };
|
|
254127
|
+
} catch {
|
|
254128
|
+
return { ok: false, reason: "invalid" };
|
|
254129
|
+
}
|
|
254130
|
+
}
|
|
254131
|
+
|
|
254341
254132
|
// src/cli/dev/dev-server/routes/entities/entities-user-router.ts
|
|
254342
254133
|
var import_express3 = __toESM(require_express(), 1);
|
|
254343
|
-
var import_jsonwebtoken2 = __toESM(require_jsonwebtoken(), 1);
|
|
254344
254134
|
function createUserRouter(db2, logger2) {
|
|
254345
254135
|
const router = import_express3.Router({ mergeParams: true });
|
|
254346
254136
|
const parseBody = import_express3.json();
|
|
254347
254137
|
function withAuth(handler) {
|
|
254348
254138
|
return async (req, res) => {
|
|
254349
|
-
const
|
|
254350
|
-
if (!
|
|
254139
|
+
const currentUserResult = await resolveCurrentUser(db2, req);
|
|
254140
|
+
if (!currentUserResult.ok && (currentUserResult.reason === "missing" || currentUserResult.reason === "invalid")) {
|
|
254351
254141
|
res.status(401).json({ error: "Unauthorized" });
|
|
254352
254142
|
return;
|
|
254353
254143
|
}
|
|
254354
|
-
|
|
254355
|
-
|
|
254356
|
-
|
|
254357
|
-
if (!result) {
|
|
254358
|
-
res.status(404).json({ error: "Unable to read data for the current user" });
|
|
254359
|
-
return;
|
|
254360
|
-
}
|
|
254361
|
-
await handler(req, res, result);
|
|
254362
|
-
} catch {
|
|
254363
|
-
res.status(401).json({ error: "Unauthorized" });
|
|
254144
|
+
if (!currentUserResult.ok) {
|
|
254145
|
+
res.status(404).json({ error: "Unable to read data for the current user" });
|
|
254146
|
+
return;
|
|
254364
254147
|
}
|
|
254148
|
+
await handler(req, res, currentUserResult.user);
|
|
254365
254149
|
};
|
|
254366
254150
|
}
|
|
254367
254151
|
router.get("/:id", withAuth(async (req, res, currentUser) => {
|
|
@@ -254461,12 +254245,20 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
254461
254245
|
const parseBody = import_express4.json();
|
|
254462
254246
|
function withCollection(handler) {
|
|
254463
254247
|
return async (req, res) => {
|
|
254464
|
-
const
|
|
254248
|
+
const { entityName } = req.params;
|
|
254249
|
+
const collection = db2.getCollection(entityName);
|
|
254465
254250
|
if (!collection) {
|
|
254466
|
-
res.status(404).json({ error: `Entity "${
|
|
254251
|
+
res.status(404).json({ error: `Entity "${entityName}" not found` });
|
|
254252
|
+
return;
|
|
254253
|
+
}
|
|
254254
|
+
const schema10 = db2.getSchema(entityName);
|
|
254255
|
+
if (!schema10) {
|
|
254256
|
+
res.status(404).json({ error: `Schema for "${entityName}" not found` });
|
|
254467
254257
|
return;
|
|
254468
254258
|
}
|
|
254469
|
-
await
|
|
254259
|
+
const currentUserResult = await resolveCurrentUser(db2, req);
|
|
254260
|
+
const currentUser = currentUserResult.ok ? currentUserResult.user : undefined;
|
|
254261
|
+
await handler(req, res, collection, schema10, currentUser);
|
|
254470
254262
|
};
|
|
254471
254263
|
}
|
|
254472
254264
|
function emit(appId, entityName, type, data) {
|
|
@@ -254484,9 +254276,31 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
254484
254276
|
}
|
|
254485
254277
|
broadcast(appId, entityName, createData(data));
|
|
254486
254278
|
}
|
|
254279
|
+
function prepareCreateRecord(entityName, body, schema10, currentUser, now) {
|
|
254280
|
+
const { _id, ...recordBody } = body;
|
|
254281
|
+
const ownerFields = {
|
|
254282
|
+
created_by: currentUser?.email,
|
|
254283
|
+
created_by_id: currentUser?.id
|
|
254284
|
+
};
|
|
254285
|
+
if (!checkRLS(schema10.rls?.create, {
|
|
254286
|
+
...recordBody,
|
|
254287
|
+
...ownerFields
|
|
254288
|
+
}, currentUser)) {
|
|
254289
|
+
return;
|
|
254290
|
+
}
|
|
254291
|
+
const filteredBody = applyFLS(db2.prepareRecord(entityName, recordBody), schema10, currentUser, "write");
|
|
254292
|
+
db2.validate(entityName, filteredBody);
|
|
254293
|
+
return {
|
|
254294
|
+
...filteredBody,
|
|
254295
|
+
id: nanoid3(),
|
|
254296
|
+
...ownerFields,
|
|
254297
|
+
created_date: now,
|
|
254298
|
+
updated_date: now
|
|
254299
|
+
};
|
|
254300
|
+
}
|
|
254487
254301
|
const userRouter = createUserRouter(db2, logger2);
|
|
254488
254302
|
router.use("/User", userRouter);
|
|
254489
|
-
router.get("/:entityName/:id", withCollection(async (req, res, collection) => {
|
|
254303
|
+
router.get("/:entityName/:id", withCollection(async (req, res, collection, schema10, currentUser) => {
|
|
254490
254304
|
const { entityName, id: id2 } = req.params;
|
|
254491
254305
|
try {
|
|
254492
254306
|
const doc2 = await collection.findOneAsync({ id: id2 });
|
|
@@ -254494,16 +254308,28 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
254494
254308
|
res.status(404).json({ error: `Record with id "${id2}" not found` });
|
|
254495
254309
|
return;
|
|
254496
254310
|
}
|
|
254497
|
-
|
|
254311
|
+
if (!checkRLS(schema10.rls?.read, doc2, currentUser)) {
|
|
254312
|
+
res.status(404).json({
|
|
254313
|
+
message: `Entity ${entityName} with ID ${id2} not found`
|
|
254314
|
+
});
|
|
254315
|
+
return;
|
|
254316
|
+
}
|
|
254317
|
+
const result = applyFLS(stripInternalFields(doc2), schema10, currentUser, "read");
|
|
254318
|
+
res.json(result);
|
|
254498
254319
|
} catch (error48) {
|
|
254499
254320
|
logger2.error(`Error in GET /${entityName}/${id2}:`, error48);
|
|
254500
254321
|
res.status(500).json({ error: "Internal server error" });
|
|
254501
254322
|
}
|
|
254502
254323
|
}));
|
|
254503
|
-
router.get("/:entityName", withCollection(async (req, res, collection) => {
|
|
254324
|
+
router.get("/:entityName", withCollection(async (req, res, collection, schema10, currentUser) => {
|
|
254504
254325
|
const { entityName } = req.params;
|
|
254505
254326
|
try {
|
|
254506
|
-
|
|
254327
|
+
let results = stripInternalFields(await queryEntity(collection, req.query));
|
|
254328
|
+
if (schema10.rls?.read && schema10.rls.read !== true) {
|
|
254329
|
+
results = results.filter((doc2) => checkRLS(schema10.rls.read, doc2, currentUser));
|
|
254330
|
+
}
|
|
254331
|
+
results = results.map((doc2) => applyFLS(doc2, schema10, currentUser, "read"));
|
|
254332
|
+
res.json(results);
|
|
254507
254333
|
} catch (error48) {
|
|
254508
254334
|
if (error48 instanceof InvalidInputError) {
|
|
254509
254335
|
res.status(400).json({ error: error48.message });
|
|
@@ -254513,20 +254339,16 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
254513
254339
|
}
|
|
254514
254340
|
}
|
|
254515
254341
|
}));
|
|
254516
|
-
router.post("/:entityName", parseBody, withCollection(async (req, res, collection) => {
|
|
254342
|
+
router.post("/:entityName", parseBody, withCollection(async (req, res, collection, schema10, currentUser) => {
|
|
254517
254343
|
const { appId, entityName } = req.params;
|
|
254518
254344
|
try {
|
|
254519
254345
|
const now = new Date().toISOString();
|
|
254520
|
-
const
|
|
254521
|
-
|
|
254522
|
-
|
|
254523
|
-
|
|
254524
|
-
|
|
254525
|
-
|
|
254526
|
-
created_date: now,
|
|
254527
|
-
updated_date: now
|
|
254528
|
-
};
|
|
254529
|
-
const inserted = stripInternalFields(await collection.insertAsync(record2));
|
|
254346
|
+
const record2 = prepareCreateRecord(entityName, req.body, schema10, currentUser, now);
|
|
254347
|
+
if (!record2) {
|
|
254348
|
+
res.status(403).json({ error: "Permission denied" });
|
|
254349
|
+
return;
|
|
254350
|
+
}
|
|
254351
|
+
const inserted = applyFLS(stripInternalFields(await collection.insertAsync(record2)), schema10, currentUser, "read");
|
|
254530
254352
|
emit(appId, entityName, "create", inserted);
|
|
254531
254353
|
res.status(201).json(inserted);
|
|
254532
254354
|
} catch (error48) {
|
|
@@ -254538,7 +254360,7 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
254538
254360
|
res.status(500).json({ error: "Internal server error" });
|
|
254539
254361
|
}
|
|
254540
254362
|
}));
|
|
254541
|
-
router.post("/:entityName/bulk", parseBody, withCollection(async (req, res, collection) => {
|
|
254363
|
+
router.post("/:entityName/bulk", parseBody, withCollection(async (req, res, collection, schema10, currentUser) => {
|
|
254542
254364
|
const { appId, entityName } = req.params;
|
|
254543
254365
|
if (!Array.isArray(req.body)) {
|
|
254544
254366
|
res.status(400).json({ error: "Request body must be an array" });
|
|
@@ -254547,17 +254369,15 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
254547
254369
|
try {
|
|
254548
254370
|
const now = new Date().toISOString();
|
|
254549
254371
|
const records = [];
|
|
254550
|
-
for (const
|
|
254551
|
-
const
|
|
254552
|
-
|
|
254553
|
-
|
|
254554
|
-
|
|
254555
|
-
|
|
254556
|
-
|
|
254557
|
-
updated_date: now
|
|
254558
|
-
});
|
|
254372
|
+
for (const body of req.body) {
|
|
254373
|
+
const record2 = prepareCreateRecord(entityName, body, schema10, currentUser, now);
|
|
254374
|
+
if (!record2) {
|
|
254375
|
+
res.status(403).json({ error: "Permission denied" });
|
|
254376
|
+
return;
|
|
254377
|
+
}
|
|
254378
|
+
records.push(record2);
|
|
254559
254379
|
}
|
|
254560
|
-
const inserted = stripInternalFields(await collection.insertAsync(records));
|
|
254380
|
+
const inserted = applyFLS(stripInternalFields(await collection.insertAsync(records)), schema10, currentUser, "read");
|
|
254561
254381
|
emit(appId, entityName, "create", inserted);
|
|
254562
254382
|
res.status(201).json(inserted);
|
|
254563
254383
|
} catch (error48) {
|
|
@@ -254569,11 +254389,24 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
254569
254389
|
res.status(500).json({ error: "Internal server error" });
|
|
254570
254390
|
}
|
|
254571
254391
|
}));
|
|
254572
|
-
router.put("/:entityName/:id", parseBody, withCollection(async (req, res, collection) => {
|
|
254392
|
+
router.put("/:entityName/:id", parseBody, withCollection(async (req, res, collection, schema10, currentUser) => {
|
|
254573
254393
|
const { appId, entityName, id: id2 } = req.params;
|
|
254574
254394
|
const { id: _id, created_date: _created_date, ...body } = req.body;
|
|
254575
254395
|
try {
|
|
254576
|
-
|
|
254396
|
+
if (schema10.rls?.update !== undefined) {
|
|
254397
|
+
const existing = await collection.findOneAsync({ id: id2 });
|
|
254398
|
+
if (!existing) {
|
|
254399
|
+
res.status(404).json({ error: `Record with id "${id2}" not found` });
|
|
254400
|
+
return;
|
|
254401
|
+
}
|
|
254402
|
+
if (!checkRLS(schema10.rls.update, existing, currentUser)) {
|
|
254403
|
+
res.status(404).json({
|
|
254404
|
+
message: `Entity ${entityName} with ID ${id2} not found`
|
|
254405
|
+
});
|
|
254406
|
+
return;
|
|
254407
|
+
}
|
|
254408
|
+
}
|
|
254409
|
+
const filteredBody = applyFLS(db2.prepareRecord(entityName, body, true), schema10, currentUser, "write");
|
|
254577
254410
|
db2.validate(entityName, filteredBody, true);
|
|
254578
254411
|
const updateData = {
|
|
254579
254412
|
...filteredBody,
|
|
@@ -254584,7 +254417,7 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
254584
254417
|
res.status(404).json({ error: `Record with id "${id2}" not found` });
|
|
254585
254418
|
return;
|
|
254586
254419
|
}
|
|
254587
|
-
const updated = stripInternalFields(result.affectedDocuments);
|
|
254420
|
+
const updated = applyFLS(stripInternalFields(result.affectedDocuments), schema10, currentUser, "read");
|
|
254588
254421
|
emit(appId, entityName, "update", updated);
|
|
254589
254422
|
res.json(updated);
|
|
254590
254423
|
} catch (error48) {
|
|
@@ -254596,30 +254429,48 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
254596
254429
|
res.status(500).json({ error: "Internal server error" });
|
|
254597
254430
|
}
|
|
254598
254431
|
}));
|
|
254599
|
-
router.delete("/:entityName/:id", withCollection(async (req, res, collection) => {
|
|
254432
|
+
router.delete("/:entityName/:id", withCollection(async (req, res, collection, schema10, currentUser) => {
|
|
254600
254433
|
const { appId, entityName, id: id2 } = req.params;
|
|
254601
254434
|
try {
|
|
254602
254435
|
const doc2 = await collection.findOneAsync({ id: id2 });
|
|
254603
|
-
|
|
254604
|
-
if (numRemoved === 0) {
|
|
254436
|
+
if (!doc2) {
|
|
254605
254437
|
res.status(404).json({ error: `Record with id "${id2}" not found` });
|
|
254606
254438
|
return;
|
|
254607
254439
|
}
|
|
254608
|
-
if (doc2) {
|
|
254609
|
-
|
|
254440
|
+
if (!checkRLS(schema10.rls?.delete, doc2, currentUser)) {
|
|
254441
|
+
res.status(404).json({
|
|
254442
|
+
message: `Entity ${entityName} with ID ${id2} not found`
|
|
254443
|
+
});
|
|
254444
|
+
return;
|
|
254610
254445
|
}
|
|
254446
|
+
await collection.removeAsync({ id: id2 }, { multi: false });
|
|
254447
|
+
emit(appId, entityName, "delete", stripInternalFields(doc2));
|
|
254611
254448
|
res.json({ success: true });
|
|
254612
254449
|
} catch (error48) {
|
|
254613
254450
|
logger2.error(`Error in DELETE /${entityName}/${id2}:`, error48);
|
|
254614
254451
|
res.status(500).json({ error: "Internal server error" });
|
|
254615
254452
|
}
|
|
254616
254453
|
}));
|
|
254617
|
-
router.delete("/:entityName", parseBody, withCollection(async (req, res, collection) => {
|
|
254454
|
+
router.delete("/:entityName", parseBody, withCollection(async (req, res, collection, schema10, currentUser) => {
|
|
254618
254455
|
const { entityName } = req.params;
|
|
254619
254456
|
try {
|
|
254620
254457
|
const query = req.body || {};
|
|
254621
|
-
const
|
|
254622
|
-
|
|
254458
|
+
const rlsDelete = schema10?.rls?.delete;
|
|
254459
|
+
if (rlsDelete !== undefined && rlsDelete !== true) {
|
|
254460
|
+
if (rlsDelete === false) {
|
|
254461
|
+
res.status(403).json({ error: "Permission denied" });
|
|
254462
|
+
return;
|
|
254463
|
+
}
|
|
254464
|
+
const docs = await collection.findAsync(query);
|
|
254465
|
+
const allowedIds = docs.filter((doc2) => checkRLS(rlsDelete, doc2, currentUser)).map((doc2) => doc2.id);
|
|
254466
|
+
const numRemoved = await collection.removeAsync({ id: { $in: allowedIds } }, { multi: true });
|
|
254467
|
+
res.json({ success: true, deleted: numRemoved });
|
|
254468
|
+
} else {
|
|
254469
|
+
const numRemoved = await collection.removeAsync(query, {
|
|
254470
|
+
multi: true
|
|
254471
|
+
});
|
|
254472
|
+
res.json({ success: true, deleted: numRemoved });
|
|
254473
|
+
}
|
|
254623
254474
|
} catch (error48) {
|
|
254624
254475
|
logger2.error(`Error in DELETE /${entityName}:`, error48);
|
|
254625
254476
|
res.status(500).json({ error: "Internal server error" });
|
|
@@ -255450,9 +255301,9 @@ class NodeFsHandler {
|
|
|
255450
255301
|
if (this.fsw.closed) {
|
|
255451
255302
|
return;
|
|
255452
255303
|
}
|
|
255453
|
-
const
|
|
255304
|
+
const dirname16 = sp2.dirname(file2);
|
|
255454
255305
|
const basename5 = sp2.basename(file2);
|
|
255455
|
-
const parent = this.fsw._getWatchedDir(
|
|
255306
|
+
const parent = this.fsw._getWatchedDir(dirname16);
|
|
255456
255307
|
let prevStats = stats;
|
|
255457
255308
|
if (parent.has(basename5))
|
|
255458
255309
|
return;
|
|
@@ -255479,7 +255330,7 @@ class NodeFsHandler {
|
|
|
255479
255330
|
prevStats = newStats2;
|
|
255480
255331
|
}
|
|
255481
255332
|
} catch (error48) {
|
|
255482
|
-
this.fsw._remove(
|
|
255333
|
+
this.fsw._remove(dirname16, basename5);
|
|
255483
255334
|
}
|
|
255484
255335
|
} else if (parent.has(basename5)) {
|
|
255485
255336
|
const at13 = newStats.atimeMs;
|
|
@@ -255568,7 +255419,7 @@ class NodeFsHandler {
|
|
|
255568
255419
|
this._addToNodeFs(path19, initialAdd, wh2, depth + 1);
|
|
255569
255420
|
}
|
|
255570
255421
|
}).on(EV.ERROR, this._boundHandleError);
|
|
255571
|
-
return new Promise((
|
|
255422
|
+
return new Promise((resolve8, reject) => {
|
|
255572
255423
|
if (!stream)
|
|
255573
255424
|
return reject();
|
|
255574
255425
|
stream.once(STR_END, () => {
|
|
@@ -255577,7 +255428,7 @@ class NodeFsHandler {
|
|
|
255577
255428
|
return;
|
|
255578
255429
|
}
|
|
255579
255430
|
const wasThrottled = throttler ? throttler.clear() : false;
|
|
255580
|
-
|
|
255431
|
+
resolve8(undefined);
|
|
255581
255432
|
previous.getChildren().filter((item) => {
|
|
255582
255433
|
return item !== directory && !current.has(item);
|
|
255583
255434
|
}).forEach((item) => {
|
|
@@ -256419,7 +256270,9 @@ var DEFAULT_PORT = 4400;
|
|
|
256419
256270
|
var BASE44_APP_URL = "https://base44.app";
|
|
256420
256271
|
async function createDevServer(options8) {
|
|
256421
256272
|
const { port: userPort } = options8;
|
|
256422
|
-
const port = userPort ?? await getPorts({
|
|
256273
|
+
const port = userPort ?? await getPorts({
|
|
256274
|
+
port: process.env.IS_TEST === "true" ? undefined : DEFAULT_PORT
|
|
256275
|
+
});
|
|
256423
256276
|
const baseUrl = `http://localhost:${port}`;
|
|
256424
256277
|
const { functions, entities, project: project2 } = await options8.loadResources();
|
|
256425
256278
|
const app = import_express6.default();
|
|
@@ -256486,7 +256339,7 @@ async function createDevServer(options8) {
|
|
|
256486
256339
|
}
|
|
256487
256340
|
remoteProxy(req, res, next);
|
|
256488
256341
|
});
|
|
256489
|
-
const server = await new Promise((
|
|
256342
|
+
const server = await new Promise((resolve9, reject) => {
|
|
256490
256343
|
const s5 = app.listen(port, "127.0.0.1", (err) => {
|
|
256491
256344
|
if (err) {
|
|
256492
256345
|
if ("code" in err && err.code === "EADDRINUSE") {
|
|
@@ -256495,7 +256348,7 @@ async function createDevServer(options8) {
|
|
|
256495
256348
|
reject(err);
|
|
256496
256349
|
}
|
|
256497
256350
|
} else {
|
|
256498
|
-
|
|
256351
|
+
resolve9(s5);
|
|
256499
256352
|
}
|
|
256500
256353
|
});
|
|
256501
256354
|
});
|
|
@@ -256504,15 +256357,15 @@ async function createDevServer(options8) {
|
|
|
256504
256357
|
broadcastEntityEvent(io6, appId, entityName, event);
|
|
256505
256358
|
};
|
|
256506
256359
|
const base44ConfigWatcher = new WatchBase44({
|
|
256507
|
-
functions:
|
|
256508
|
-
entities:
|
|
256360
|
+
functions: join24(dirname17(project2.configPath), project2.functionsDir),
|
|
256361
|
+
entities: join24(dirname17(project2.configPath), project2.entitiesDir)
|
|
256509
256362
|
}, devLogger);
|
|
256510
256363
|
base44ConfigWatcher.on("change", async (name2) => {
|
|
256511
256364
|
try {
|
|
256512
256365
|
const { functions: functions2, entities: entities2 } = await options8.loadResources();
|
|
256513
256366
|
if (name2 === "functions") {
|
|
256514
256367
|
const previousFunctionCount = functionManager.getFunctionNames().length;
|
|
256515
|
-
functionManager.reload(functions2);
|
|
256368
|
+
await functionManager.reload(functions2);
|
|
256516
256369
|
const names = functionManager.getFunctionNames();
|
|
256517
256370
|
if (names.length > 0) {
|
|
256518
256371
|
devLogger.log(`Reloaded functions: ${names.sort().join(", ")}`);
|
|
@@ -256537,10 +256390,10 @@ async function createDevServer(options8) {
|
|
|
256537
256390
|
}
|
|
256538
256391
|
});
|
|
256539
256392
|
await base44ConfigWatcher.start();
|
|
256540
|
-
const shutdown = () => {
|
|
256393
|
+
const shutdown = async () => {
|
|
256541
256394
|
base44ConfigWatcher.close();
|
|
256542
256395
|
io6.close();
|
|
256543
|
-
functionManager.stopAll();
|
|
256396
|
+
await functionManager.stopAll();
|
|
256544
256397
|
server.close();
|
|
256545
256398
|
};
|
|
256546
256399
|
process.on("SIGINT", shutdown);
|
|
@@ -256612,13 +256465,13 @@ async function runScript(options8) {
|
|
|
256612
256465
|
}
|
|
256613
256466
|
// src/cli/commands/exec.ts
|
|
256614
256467
|
function readStdin2() {
|
|
256615
|
-
return new Promise((
|
|
256468
|
+
return new Promise((resolve9, reject) => {
|
|
256616
256469
|
let data = "";
|
|
256617
256470
|
process.stdin.setEncoding("utf-8");
|
|
256618
256471
|
process.stdin.on("data", (chunk) => {
|
|
256619
256472
|
data += chunk;
|
|
256620
256473
|
});
|
|
256621
|
-
process.stdin.on("end", () =>
|
|
256474
|
+
process.stdin.on("end", () => resolve9(data));
|
|
256622
256475
|
process.stdin.on("error", reject);
|
|
256623
256476
|
});
|
|
256624
256477
|
}
|
|
@@ -256657,7 +256510,7 @@ Examples:
|
|
|
256657
256510
|
}
|
|
256658
256511
|
|
|
256659
256512
|
// src/cli/commands/project/eject.ts
|
|
256660
|
-
import { resolve as
|
|
256513
|
+
import { resolve as resolve9 } from "node:path";
|
|
256661
256514
|
var import_kebabCase2 = __toESM(require_kebabCase(), 1);
|
|
256662
256515
|
async function eject(ctx, options8) {
|
|
256663
256516
|
const { log, runTask: runTask2, isNonInteractive } = ctx;
|
|
@@ -256713,7 +256566,7 @@ async function eject(ctx, options8) {
|
|
|
256713
256566
|
Ne("Operation cancelled.");
|
|
256714
256567
|
throw new CLIExitError(0);
|
|
256715
256568
|
}
|
|
256716
|
-
const resolvedPath =
|
|
256569
|
+
const resolvedPath = resolve9(selectedPath);
|
|
256717
256570
|
await runTask2("Downloading your project's code...", async (updateMessage) => {
|
|
256718
256571
|
await createProjectFilesForExistingProject({
|
|
256719
256572
|
projectId,
|
|
@@ -256794,7 +256647,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
|
|
|
256794
256647
|
import { release, type } from "node:os";
|
|
256795
256648
|
|
|
256796
256649
|
// ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
256797
|
-
import { dirname as
|
|
256650
|
+
import { dirname as dirname18, posix, sep } from "path";
|
|
256798
256651
|
function createModulerModifier() {
|
|
256799
256652
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
256800
256653
|
return async (frames) => {
|
|
@@ -256803,7 +256656,7 @@ function createModulerModifier() {
|
|
|
256803
256656
|
return frames;
|
|
256804
256657
|
};
|
|
256805
256658
|
}
|
|
256806
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
256659
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname18(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
|
|
256807
256660
|
const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
|
|
256808
256661
|
return (filename) => {
|
|
256809
256662
|
if (!filename)
|
|
@@ -259081,14 +258934,14 @@ async function addSourceContext(frames) {
|
|
|
259081
258934
|
return frames;
|
|
259082
258935
|
}
|
|
259083
258936
|
function getContextLinesFromFile(path19, ranges, output) {
|
|
259084
|
-
return new Promise((
|
|
258937
|
+
return new Promise((resolve10) => {
|
|
259085
258938
|
const stream = createReadStream2(path19);
|
|
259086
258939
|
const lineReaded = createInterface2({
|
|
259087
258940
|
input: stream
|
|
259088
258941
|
});
|
|
259089
258942
|
function destroyStreamAndResolve() {
|
|
259090
258943
|
stream.destroy();
|
|
259091
|
-
|
|
258944
|
+
resolve10();
|
|
259092
258945
|
}
|
|
259093
258946
|
let lineNumber = 0;
|
|
259094
258947
|
let currentRangeIndex = 0;
|
|
@@ -260200,15 +260053,15 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
260200
260053
|
return true;
|
|
260201
260054
|
if (this.featureFlagsPoller === undefined)
|
|
260202
260055
|
return false;
|
|
260203
|
-
return new Promise((
|
|
260056
|
+
return new Promise((resolve10) => {
|
|
260204
260057
|
const timeout3 = setTimeout(() => {
|
|
260205
260058
|
cleanup();
|
|
260206
|
-
|
|
260059
|
+
resolve10(false);
|
|
260207
260060
|
}, timeoutMs);
|
|
260208
260061
|
const cleanup = this._events.on("localEvaluationFlagsLoaded", (count2) => {
|
|
260209
260062
|
clearTimeout(timeout3);
|
|
260210
260063
|
cleanup();
|
|
260211
|
-
|
|
260064
|
+
resolve10(count2 > 0);
|
|
260212
260065
|
});
|
|
260213
260066
|
});
|
|
260214
260067
|
}
|
|
@@ -260992,9 +260845,9 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
|
|
|
260992
260845
|
});
|
|
260993
260846
|
}
|
|
260994
260847
|
// src/cli/index.ts
|
|
260995
|
-
var __dirname4 =
|
|
260848
|
+
var __dirname4 = dirname19(fileURLToPath6(import.meta.url));
|
|
260996
260849
|
async function runCLI(options8) {
|
|
260997
|
-
ensureNpmAssets(
|
|
260850
|
+
ensureNpmAssets(join25(__dirname4, "../assets"));
|
|
260998
260851
|
const errorReporter = new ErrorReporter;
|
|
260999
260852
|
errorReporter.registerProcessErrorHandlers();
|
|
261000
260853
|
const isNonInteractive = !process.stdin.isTTY || !process.stdout.isTTY;
|
|
@@ -261031,4 +260884,4 @@ export {
|
|
|
261031
260884
|
CLIExitError
|
|
261032
260885
|
};
|
|
261033
260886
|
|
|
261034
|
-
//# debugId=
|
|
260887
|
+
//# debugId=8CB4CFE788FBDEB164756E2164756E21
|