@base44-preview/cli 0.0.50-pr.484.42693d8 → 0.0.50-pr.484.8b296df
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 +553 -342
- package/dist/cli/index.js.map +21 -11
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -8935,8 +8935,8 @@ var require_ejs = __commonJS((exports) => {
|
|
|
8935
8935
|
exports.resolveInclude = function(name2, filename, isDir) {
|
|
8936
8936
|
var dirname6 = path11.dirname;
|
|
8937
8937
|
var extname = path11.extname;
|
|
8938
|
-
var
|
|
8939
|
-
var includePath =
|
|
8938
|
+
var resolve = path11.resolve;
|
|
8939
|
+
var includePath = resolve(isDir ? filename : dirname6(filename), name2);
|
|
8940
8940
|
var ext = extname(name2);
|
|
8941
8941
|
if (!ext) {
|
|
8942
8942
|
includePath += ".ejs";
|
|
@@ -9011,10 +9011,10 @@ var require_ejs = __commonJS((exports) => {
|
|
|
9011
9011
|
var result;
|
|
9012
9012
|
if (!cb) {
|
|
9013
9013
|
if (typeof exports.promiseImpl == "function") {
|
|
9014
|
-
return new exports.promiseImpl(function(
|
|
9014
|
+
return new exports.promiseImpl(function(resolve, reject) {
|
|
9015
9015
|
try {
|
|
9016
9016
|
result = handleCache(options)(data);
|
|
9017
|
-
|
|
9017
|
+
resolve(result);
|
|
9018
9018
|
} catch (err) {
|
|
9019
9019
|
reject(err);
|
|
9020
9020
|
}
|
|
@@ -12452,12 +12452,12 @@ var require_isexe = __commonJS((exports, module) => {
|
|
|
12452
12452
|
if (typeof Promise !== "function") {
|
|
12453
12453
|
throw new TypeError("callback not provided");
|
|
12454
12454
|
}
|
|
12455
|
-
return new Promise(function(
|
|
12455
|
+
return new Promise(function(resolve2, reject) {
|
|
12456
12456
|
isexe(path11, options || {}, function(er, is) {
|
|
12457
12457
|
if (er) {
|
|
12458
12458
|
reject(er);
|
|
12459
12459
|
} else {
|
|
12460
|
-
|
|
12460
|
+
resolve2(is);
|
|
12461
12461
|
}
|
|
12462
12462
|
});
|
|
12463
12463
|
});
|
|
@@ -12519,27 +12519,27 @@ var require_which = __commonJS((exports, module) => {
|
|
|
12519
12519
|
opt = {};
|
|
12520
12520
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
12521
12521
|
const found = [];
|
|
12522
|
-
const step = (i) => new Promise((
|
|
12522
|
+
const step = (i) => new Promise((resolve2, reject) => {
|
|
12523
12523
|
if (i === pathEnv.length)
|
|
12524
|
-
return opt.all && found.length ?
|
|
12524
|
+
return opt.all && found.length ? resolve2(found) : reject(getNotFoundError(cmd));
|
|
12525
12525
|
const ppRaw = pathEnv[i];
|
|
12526
12526
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
12527
12527
|
const pCmd = path11.join(pathPart, cmd);
|
|
12528
12528
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
12529
|
-
|
|
12529
|
+
resolve2(subStep(p, i, 0));
|
|
12530
12530
|
});
|
|
12531
|
-
const subStep = (p, i, ii) => new Promise((
|
|
12531
|
+
const subStep = (p, i, ii) => new Promise((resolve2, reject) => {
|
|
12532
12532
|
if (ii === pathExt.length)
|
|
12533
|
-
return
|
|
12533
|
+
return resolve2(step(i + 1));
|
|
12534
12534
|
const ext = pathExt[ii];
|
|
12535
12535
|
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
12536
12536
|
if (!er && is) {
|
|
12537
12537
|
if (opt.all)
|
|
12538
12538
|
found.push(p + ext);
|
|
12539
12539
|
else
|
|
12540
|
-
return
|
|
12540
|
+
return resolve2(p + ext);
|
|
12541
12541
|
}
|
|
12542
|
-
return
|
|
12542
|
+
return resolve2(subStep(p, i, ii + 1));
|
|
12543
12543
|
});
|
|
12544
12544
|
});
|
|
12545
12545
|
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
@@ -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(resolve8) {
|
|
134618
|
+
resolve8(value);
|
|
134619
134619
|
});
|
|
134620
134620
|
}
|
|
134621
|
-
return new (P9 || (P9 = Promise))(function(
|
|
134621
|
+
return new (P9 || (P9 = Promise))(function(resolve8, 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 ? resolve8(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 = resolve8;
|
|
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 resolve8(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 resolve8(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((resolve8, 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
|
+
resolve8({
|
|
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(resolve8) {
|
|
141492
|
+
resolve8(value);
|
|
141493
141493
|
});
|
|
141494
141494
|
}
|
|
141495
|
-
return new (P9 || (P9 = Promise))(function(
|
|
141495
|
+
return new (P9 || (P9 = Promise))(function(resolve8, 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 ? resolve8(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(resolve8) {
|
|
141633
|
+
resolve8(value);
|
|
141634
141634
|
});
|
|
141635
141635
|
}
|
|
141636
|
-
return new (P9 || (P9 = Promise))(function(
|
|
141636
|
+
return new (P9 || (P9 = Promise))(function(resolve8, 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 ? resolve8(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(resolve8, reject) {
|
|
147278
147278
|
readStream(stream, encoding, length, limit, function onRead2(err, buf) {
|
|
147279
147279
|
if (err)
|
|
147280
147280
|
return reject(err);
|
|
147281
|
-
|
|
147281
|
+
resolve8(buf);
|
|
147282
147282
|
});
|
|
147283
147283
|
});
|
|
147284
147284
|
}
|
|
@@ -160403,7 +160403,7 @@ var require_view = __commonJS((exports, module) => {
|
|
|
160403
160403
|
var basename4 = path18.basename;
|
|
160404
160404
|
var extname2 = path18.extname;
|
|
160405
160405
|
var join23 = path18.join;
|
|
160406
|
-
var
|
|
160406
|
+
var resolve8 = path18.resolve;
|
|
160407
160407
|
module.exports = View;
|
|
160408
160408
|
function View(name2, options8) {
|
|
160409
160409
|
var opts = options8 || {};
|
|
@@ -160437,7 +160437,7 @@ 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 =
|
|
160440
|
+
var loc = resolve8(root2, name2);
|
|
160441
160441
|
var dir = dirname16(loc);
|
|
160442
160442
|
var file2 = basename4(loc);
|
|
160443
160443
|
path19 = this.resolve(dir, file2);
|
|
@@ -160462,7 +160462,7 @@ var require_view = __commonJS((exports, module) => {
|
|
|
160462
160462
|
});
|
|
160463
160463
|
sync = false;
|
|
160464
160464
|
};
|
|
160465
|
-
View.prototype.resolve = function
|
|
160465
|
+
View.prototype.resolve = function resolve9(dir, file2) {
|
|
160466
160466
|
var ext = this.ext;
|
|
160467
160467
|
var path19 = join23(dir, file2);
|
|
160468
160468
|
var stat2 = tryStat(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 resolve8 = __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", resolve8("views"));
|
|
162679
162679
|
this.set("jsonp callback name", "callback");
|
|
162680
162680
|
if (env3 === "production") {
|
|
162681
162681
|
this.enable("view cache");
|
|
@@ -164166,7 +164166,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
164166
164166
|
var extname2 = path18.extname;
|
|
164167
164167
|
var join23 = path18.join;
|
|
164168
164168
|
var normalize2 = path18.normalize;
|
|
164169
|
-
var
|
|
164169
|
+
var resolve8 = 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 ? resolve8(opts.root) : null;
|
|
164199
164199
|
}
|
|
164200
164200
|
util2.inherits(SendStream, Stream2);
|
|
164201
164201
|
SendStream.prototype.error = function error48(status, err) {
|
|
@@ -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 = resolve8(path19);
|
|
164348
164348
|
}
|
|
164349
164349
|
if (containsDotFile(parts)) {
|
|
164350
164350
|
debug('%s dotfile "%s"', this._dotfiles, path19);
|
|
@@ -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 resolve8 = 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 ? resolve8(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 resolve8 = __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 = resolve8(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((resolve8) => {
|
|
168539
|
+
this._triggerBuffer = resolve8;
|
|
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((resolve8, 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
|
+
resolve8();
|
|
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((resolve8, 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
|
+
resolve8({ 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((resolve8, 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 resolve8(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((resolve8, reject) => {
|
|
195596
195596
|
args.push((arg1, arg2) => {
|
|
195597
195597
|
if (withErr) {
|
|
195598
|
-
return arg1 ? reject(arg1) :
|
|
195598
|
+
return arg1 ? reject(arg1) : resolve8(arg2);
|
|
195599
195599
|
} else {
|
|
195600
|
-
return
|
|
195600
|
+
return resolve8(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((resolve8, 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 resolve8(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((resolve8, 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: resolve8,
|
|
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((resolve8, 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: resolve8,
|
|
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((resolve8) => {
|
|
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
|
+
resolve8();
|
|
197711
197711
|
});
|
|
197712
197712
|
});
|
|
197713
197713
|
} else {
|
|
@@ -215914,14 +215914,14 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
215914
215914
|
};
|
|
215915
215915
|
}
|
|
215916
215916
|
function readAndResolve(iter) {
|
|
215917
|
-
var
|
|
215918
|
-
if (
|
|
215917
|
+
var resolve8 = iter[kLastResolve];
|
|
215918
|
+
if (resolve8 !== 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
|
+
resolve8(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(resolve8, reject) {
|
|
215933
215933
|
lastPromise.then(function() {
|
|
215934
215934
|
if (iter[kEnded]) {
|
|
215935
|
-
|
|
215935
|
+
resolve8(createIterResult(undefined, true));
|
|
215936
215936
|
return;
|
|
215937
215937
|
}
|
|
215938
|
-
iter[kHandlePromise](
|
|
215938
|
+
iter[kHandlePromise](resolve8, 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(resolve8, reject) {
|
|
215958
215958
|
process.nextTick(function() {
|
|
215959
215959
|
if (_this[kError]) {
|
|
215960
215960
|
reject(_this[kError]);
|
|
215961
215961
|
} else {
|
|
215962
|
-
|
|
215962
|
+
resolve8(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(resolve8, reject) {
|
|
215986
215986
|
_this2[kStream].destroy(null, function(err) {
|
|
215987
215987
|
if (err) {
|
|
215988
215988
|
reject(err);
|
|
215989
215989
|
return;
|
|
215990
215990
|
}
|
|
215991
|
-
|
|
215991
|
+
resolve8(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(resolve8, 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
|
+
resolve8(createIterResult(data, false));
|
|
216020
216020
|
} else {
|
|
216021
|
-
iterator[kLastResolve] =
|
|
216021
|
+
iterator[kLastResolve] = resolve8;
|
|
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 resolve8 = iterator[kLastResolve];
|
|
216041
|
+
if (resolve8 !== null) {
|
|
216042
216042
|
iterator[kLastPromise] = null;
|
|
216043
216043
|
iterator[kLastResolve] = null;
|
|
216044
216044
|
iterator[kLastReject] = null;
|
|
216045
|
-
|
|
216045
|
+
resolve8(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, resolve8, 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
|
+
resolve8(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(resolve8, reject) {
|
|
216075
216075
|
var gen = fn9.apply(self2, args);
|
|
216076
216076
|
function _next(value) {
|
|
216077
|
-
asyncGeneratorStep(gen,
|
|
216077
|
+
asyncGeneratorStep(gen, resolve8, reject, _next, _throw, "next", value);
|
|
216078
216078
|
}
|
|
216079
216079
|
function _throw(err) {
|
|
216080
|
-
asyncGeneratorStep(gen,
|
|
216080
|
+
asyncGeneratorStep(gen, resolve8, reject, _next, _throw, "throw", err);
|
|
216081
216081
|
}
|
|
216082
216082
|
_next(undefined);
|
|
216083
216083
|
});
|
|
@@ -219982,7 +219982,8 @@ var theme = {
|
|
|
219982
219982
|
bold: source_default.bold,
|
|
219983
219983
|
dim: source_default.dim,
|
|
219984
219984
|
error: source_default.red,
|
|
219985
|
-
warn: source_default.yellow
|
|
219985
|
+
warn: source_default.yellow,
|
|
219986
|
+
info: source_default.cyan
|
|
219986
219987
|
},
|
|
219987
219988
|
format: {
|
|
219988
219989
|
errorContext(ctx) {
|
|
@@ -242001,128 +242002,114 @@ async function pushCustomOAuthSecret(provider, clientSecret) {
|
|
|
242001
242002
|
[providerInfo.customOAuth.secretKey]: clientSecret
|
|
242002
242003
|
});
|
|
242003
242004
|
}
|
|
242004
|
-
// src/core/resources/auth-config/sso.ts
|
|
242005
|
-
|
|
242006
|
-
|
|
242007
|
-
"
|
|
242008
|
-
"
|
|
242009
|
-
"
|
|
242010
|
-
"
|
|
242011
|
-
"
|
|
242012
|
-
];
|
|
242013
|
-
|
|
242014
|
-
|
|
242015
|
-
|
|
242016
|
-
|
|
242017
|
-
|
|
242018
|
-
|
|
242019
|
-
|
|
242020
|
-
|
|
242021
|
-
|
|
242022
|
-
|
|
242023
|
-
|
|
242024
|
-
|
|
242025
|
-
|
|
242026
|
-
|
|
242027
|
-
|
|
242028
|
-
|
|
242029
|
-
|
|
242030
|
-
|
|
242031
|
-
|
|
242032
|
-
|
|
242033
|
-
|
|
242034
|
-
|
|
242035
|
-
|
|
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
|
+
|
|
242022
|
+
// src/core/resources/auth-config/sso/providers/custom.ts
|
|
242023
|
+
var DEFAULT_SCOPE = "openid email profile";
|
|
242024
|
+
var customProvider = {
|
|
242025
|
+
requiredKeys: [
|
|
242026
|
+
"sso_auth_endpoint" /* AuthEndpoint */,
|
|
242027
|
+
"sso_token_endpoint" /* TokenEndpoint */,
|
|
242028
|
+
"sso_userinfo_endpoint" /* UserinfoEndpoint */,
|
|
242029
|
+
"sso_jwks_uri" /* JwksUri */
|
|
242030
|
+
],
|
|
242031
|
+
defaults: {
|
|
242032
|
+
["sso_scope" /* Scope */]: DEFAULT_SCOPE
|
|
242033
|
+
}
|
|
242034
|
+
};
|
|
242035
|
+
|
|
242036
|
+
// src/core/resources/auth-config/sso/providers/github.ts
|
|
242037
|
+
var githubProvider = {
|
|
242038
|
+
requiredKeys: [],
|
|
242039
|
+
defaults: {
|
|
242040
|
+
["sso_scope" /* Scope */]: "user:email",
|
|
242041
|
+
["sso_auth_endpoint" /* AuthEndpoint */]: "https://github.com/login/oauth/authorize",
|
|
242042
|
+
["sso_token_endpoint" /* TokenEndpoint */]: "https://github.com/login/oauth/access_token",
|
|
242043
|
+
["sso_userinfo_endpoint" /* UserinfoEndpoint */]: "https://api.github.com/user"
|
|
242044
|
+
}
|
|
242045
|
+
};
|
|
242046
|
+
|
|
242047
|
+
// src/core/resources/auth-config/sso/providers/google.ts
|
|
242048
|
+
var DEFAULT_SCOPE2 = "openid email profile";
|
|
242049
|
+
var googleProvider = {
|
|
242050
|
+
requiredKeys: [],
|
|
242051
|
+
defaults: {
|
|
242052
|
+
["sso_scope" /* Scope */]: DEFAULT_SCOPE2,
|
|
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 DEFAULT_SCOPE3 = "openid email profile";
|
|
242059
|
+
var microsoftProvider = {
|
|
242060
|
+
requiredKeys: ["sso_tenant_id" /* TenantId */],
|
|
242061
|
+
defaults: {
|
|
242062
|
+
["sso_scope" /* Scope */]: DEFAULT_SCOPE3
|
|
242036
242063
|
},
|
|
242037
|
-
|
|
242038
|
-
|
|
242039
|
-
|
|
242040
|
-
|
|
242041
|
-
|
|
242042
|
-
|
|
242043
|
-
sso_userinfo_endpoint: "https://api.github.com/user"
|
|
242064
|
+
deriveDefaults: (secrets) => {
|
|
242065
|
+
const tenantId = secrets["sso_tenant_id" /* TenantId */];
|
|
242066
|
+
if (tenantId) {
|
|
242067
|
+
return {
|
|
242068
|
+
["sso_discovery_url" /* DiscoveryUrl */]: `https://login.microsoftonline.com/${tenantId}/v2.0/.well-known/openid-configuration`
|
|
242069
|
+
};
|
|
242044
242070
|
}
|
|
242071
|
+
return {};
|
|
242072
|
+
}
|
|
242073
|
+
};
|
|
242074
|
+
|
|
242075
|
+
// src/core/resources/auth-config/sso/providers/okta.ts
|
|
242076
|
+
var DEFAULT_SCOPE4 = "openid email profile";
|
|
242077
|
+
var oktaProvider = {
|
|
242078
|
+
requiredKeys: ["sso_okta_domain" /* OktaDomain */],
|
|
242079
|
+
defaults: {
|
|
242080
|
+
["sso_scope" /* Scope */]: DEFAULT_SCOPE4
|
|
242045
242081
|
},
|
|
242046
|
-
|
|
242047
|
-
|
|
242048
|
-
|
|
242049
|
-
|
|
242050
|
-
|
|
242051
|
-
|
|
242052
|
-
const domain2 = options.sso_okta_domain;
|
|
242053
|
-
if (domain2) {
|
|
242054
|
-
return {
|
|
242055
|
-
sso_discovery_url: `https://${domain2}/.well-known/openid-configuration`
|
|
242056
|
-
};
|
|
242057
|
-
}
|
|
242058
|
-
return {};
|
|
242082
|
+
deriveDefaults: (secrets) => {
|
|
242083
|
+
const domain2 = secrets["sso_okta_domain" /* OktaDomain */];
|
|
242084
|
+
if (domain2) {
|
|
242085
|
+
return {
|
|
242086
|
+
["sso_discovery_url" /* DiscoveryUrl */]: `https://${domain2}/.well-known/openid-configuration`
|
|
242087
|
+
};
|
|
242059
242088
|
}
|
|
242060
|
-
|
|
242061
|
-
custom: {
|
|
242062
|
-
requiredKeys: [
|
|
242063
|
-
"sso_auth_endpoint",
|
|
242064
|
-
"sso_token_endpoint",
|
|
242065
|
-
"sso_userinfo_endpoint",
|
|
242066
|
-
"sso_jwks_uri"
|
|
242067
|
-
],
|
|
242068
|
-
optionalKeys: ["sso_discovery_url"],
|
|
242069
|
-
defaults: {
|
|
242070
|
-
sso_scope: BASE_SSO_SCOPE
|
|
242071
|
-
}
|
|
242072
|
-
}
|
|
242073
|
-
};
|
|
242074
|
-
var ALL_SSO_SECRET_KEYS = [
|
|
242075
|
-
"sso_name",
|
|
242076
|
-
"sso_client_id",
|
|
242077
|
-
"sso_client_secret",
|
|
242078
|
-
"sso_scope",
|
|
242079
|
-
"sso_discovery_url",
|
|
242080
|
-
"sso_tenant_id",
|
|
242081
|
-
"sso_auth_endpoint",
|
|
242082
|
-
"sso_token_endpoint",
|
|
242083
|
-
"sso_userinfo_endpoint",
|
|
242084
|
-
"sso_okta_domain",
|
|
242085
|
-
"sso_jwks_uri"
|
|
242086
|
-
];
|
|
242087
|
-
var FLAG_TO_SECRET_KEY = {
|
|
242088
|
-
clientId: "sso_client_id",
|
|
242089
|
-
clientSecret: "sso_client_secret",
|
|
242090
|
-
scope: "sso_scope",
|
|
242091
|
-
discoveryUrl: "sso_discovery_url",
|
|
242092
|
-
tenantId: "sso_tenant_id",
|
|
242093
|
-
oktaDomain: "sso_okta_domain",
|
|
242094
|
-
authEndpoint: "sso_auth_endpoint",
|
|
242095
|
-
tokenEndpoint: "sso_token_endpoint",
|
|
242096
|
-
userinfoEndpoint: "sso_userinfo_endpoint",
|
|
242097
|
-
jwksUri: "sso_jwks_uri",
|
|
242098
|
-
ssoName: "sso_name"
|
|
242099
|
-
};
|
|
242100
|
-
var SSOConfigFileSchema = exports_external.object({
|
|
242101
|
-
provider: exports_external.enum(["google", "microsoft", "github", "okta", "custom"]),
|
|
242102
|
-
clientId: exports_external.string(),
|
|
242103
|
-
clientSecret: exports_external.string(),
|
|
242104
|
-
scope: exports_external.string().optional(),
|
|
242105
|
-
discoveryUrl: exports_external.string().optional(),
|
|
242106
|
-
tenantId: exports_external.string().optional(),
|
|
242107
|
-
oktaDomain: exports_external.string().optional(),
|
|
242108
|
-
authEndpoint: exports_external.string().optional(),
|
|
242109
|
-
tokenEndpoint: exports_external.string().optional(),
|
|
242110
|
-
userinfoEndpoint: exports_external.string().optional(),
|
|
242111
|
-
jwksUri: exports_external.string().optional(),
|
|
242112
|
-
ssoName: exports_external.string().optional()
|
|
242113
|
-
});
|
|
242114
|
-
async function loadSSOConfigFile(filePath) {
|
|
242115
|
-
const resolved = resolve(filePath);
|
|
242116
|
-
const raw2 = await readJsonFile(resolved);
|
|
242117
|
-
const result = SSOConfigFileSchema.safeParse(raw2);
|
|
242118
|
-
if (!result.success) {
|
|
242119
|
-
const issues = result.error.issues.map((i) => ` ${i.path.join(".")}: ${i.message}`).join(`
|
|
242120
|
-
`);
|
|
242121
|
-
throw new InvalidInputError(`Invalid SSO config file ${filePath}:
|
|
242122
|
-
${issues}`);
|
|
242089
|
+
return {};
|
|
242123
242090
|
}
|
|
242124
|
-
|
|
242125
|
-
|
|
242091
|
+
};
|
|
242092
|
+
|
|
242093
|
+
// src/core/resources/auth-config/sso/providers/index.ts
|
|
242094
|
+
var SSO_PROVIDER_SCHEMAS = {
|
|
242095
|
+
google: googleProvider,
|
|
242096
|
+
microsoft: microsoftProvider,
|
|
242097
|
+
github: githubProvider,
|
|
242098
|
+
okta: oktaProvider,
|
|
242099
|
+
custom: customProvider
|
|
242100
|
+
};
|
|
242101
|
+
|
|
242102
|
+
// src/core/resources/auth-config/sso/operations.ts
|
|
242103
|
+
var OPTION_TO_SECRET_KEY = {
|
|
242104
|
+
scope: "sso_scope" /* Scope */,
|
|
242105
|
+
discoveryUrl: "sso_discovery_url" /* DiscoveryUrl */,
|
|
242106
|
+
tenantId: "sso_tenant_id" /* TenantId */,
|
|
242107
|
+
oktaDomain: "sso_okta_domain" /* OktaDomain */,
|
|
242108
|
+
authEndpoint: "sso_auth_endpoint" /* AuthEndpoint */,
|
|
242109
|
+
tokenEndpoint: "sso_token_endpoint" /* TokenEndpoint */,
|
|
242110
|
+
userinfoEndpoint: "sso_userinfo_endpoint" /* UserinfoEndpoint */,
|
|
242111
|
+
jwksUri: "sso_jwks_uri" /* JwksUri */
|
|
242112
|
+
};
|
|
242126
242113
|
async function updateSSOConfig(authDir, provider, enable) {
|
|
242127
242114
|
const current = await readAuthConfig(authDir) ?? DEFAULT_AUTH_CONFIG;
|
|
242128
242115
|
const merged = {
|
|
@@ -242142,14 +242129,11 @@ async function updateSSOConfig(authDir, provider, enable) {
|
|
|
242142
242129
|
function buildSSOSecrets(provider, options) {
|
|
242143
242130
|
const schema3 = SSO_PROVIDER_SCHEMAS[provider];
|
|
242144
242131
|
const secrets = {};
|
|
242145
|
-
secrets
|
|
242146
|
-
secrets
|
|
242147
|
-
secrets
|
|
242148
|
-
for (const [
|
|
242149
|
-
|
|
242150
|
-
continue;
|
|
242151
|
-
}
|
|
242152
|
-
const value = options[flagKey];
|
|
242132
|
+
secrets["sso_name" /* Name */] = options.ssoName ?? provider;
|
|
242133
|
+
secrets["sso_client_id" /* ClientId */] = options.clientId;
|
|
242134
|
+
secrets["sso_client_secret" /* ClientSecret */] = options.clientSecret;
|
|
242135
|
+
for (const [optionKey, secretKey] of Object.entries(OPTION_TO_SECRET_KEY)) {
|
|
242136
|
+
const value = options[optionKey];
|
|
242153
242137
|
if (typeof value === "string" && value.length > 0) {
|
|
242154
242138
|
secrets[secretKey] = value;
|
|
242155
242139
|
}
|
|
@@ -242167,26 +242151,17 @@ function buildSSOSecrets(provider, options) {
|
|
|
242167
242151
|
secrets[key] = val;
|
|
242168
242152
|
}
|
|
242169
242153
|
}
|
|
242170
|
-
const
|
|
242154
|
+
const missing = [];
|
|
242171
242155
|
for (const key of schema3.requiredKeys) {
|
|
242172
242156
|
if (!secrets[key]) {
|
|
242173
|
-
|
|
242174
|
-
errors3.push(`Missing --${flagName} (required for ${provider})`);
|
|
242157
|
+
missing.push(key);
|
|
242175
242158
|
}
|
|
242176
242159
|
}
|
|
242177
242160
|
if (provider === "custom" && !options.ssoName) {
|
|
242178
|
-
|
|
242161
|
+
missing.push("sso_name" /* Name */);
|
|
242179
242162
|
}
|
|
242180
|
-
if (
|
|
242181
|
-
throw new InvalidInputError(
|
|
242182
|
-
`), {
|
|
242183
|
-
hints: [
|
|
242184
|
-
{
|
|
242185
|
-
message: `Example: base44 auth sso enable --provider ${provider} --client-id <id> --client-secret <secret>${provider === "microsoft" ? " --tenant-id <tid>" : ""}${provider === "okta" ? " --okta-domain <domain>" : ""}`,
|
|
242186
|
-
command: `base44 auth sso enable --provider ${provider} --client-id <id> --client-secret <secret>`
|
|
242187
|
-
}
|
|
242188
|
-
]
|
|
242189
|
-
});
|
|
242163
|
+
if (missing.length > 0) {
|
|
242164
|
+
throw new InvalidInputError(`Missing required fields for ${provider}: ${missing.join(", ")}`);
|
|
242190
242165
|
}
|
|
242191
242166
|
return Object.fromEntries(Object.entries(secrets).filter(([, v]) => v.length > 0));
|
|
242192
242167
|
}
|
|
@@ -242196,6 +242171,14 @@ async function pushSSOSecrets(secrets) {
|
|
|
242196
242171
|
async function deleteSSOSecrets() {
|
|
242197
242172
|
await Promise.allSettled(ALL_SSO_SECRET_KEYS.map((key) => deleteSecret(key)));
|
|
242198
242173
|
}
|
|
242174
|
+
// src/core/resources/auth-config/sso/types.ts
|
|
242175
|
+
var KNOWN_SSO_PROVIDERS = [
|
|
242176
|
+
"google",
|
|
242177
|
+
"microsoft",
|
|
242178
|
+
"github",
|
|
242179
|
+
"okta",
|
|
242180
|
+
"custom"
|
|
242181
|
+
];
|
|
242199
242182
|
// src/core/resources/connector/schema.ts
|
|
242200
242183
|
var GoogleCalendarConnectorSchema = exports_external.object({
|
|
242201
242184
|
type: exports_external.literal("googlecalendar"),
|
|
@@ -243606,6 +243589,7 @@ var package_default = {
|
|
|
243606
243589
|
"@types/ejs": "^3.1.5",
|
|
243607
243590
|
"@types/express": "^5.0.6",
|
|
243608
243591
|
"@types/json-schema": "^7.0.15",
|
|
243592
|
+
"@types/jsonwebtoken": "^9.0.10",
|
|
243609
243593
|
"@types/lodash": "^4.17.24",
|
|
243610
243594
|
"@types/multer": "^2.0.0",
|
|
243611
243595
|
"@types/node": "^22.10.5",
|
|
@@ -243624,6 +243608,7 @@ var package_default = {
|
|
|
243624
243608
|
globby: "^16.1.0",
|
|
243625
243609
|
"http-proxy-middleware": "^3.0.5",
|
|
243626
243610
|
"json-schema-to-typescript": "^15.0.4",
|
|
243611
|
+
jsonwebtoken: "^9.0.3",
|
|
243627
243612
|
json5: "^2.2.3",
|
|
243628
243613
|
ky: "^1.14.2",
|
|
243629
243614
|
lodash: "^4.17.23",
|
|
@@ -243639,6 +243624,7 @@ var package_default = {
|
|
|
243639
243624
|
typescript: "^5.7.2",
|
|
243640
243625
|
vitest: "^4.0.16",
|
|
243641
243626
|
yaml: "^2.8.2",
|
|
243627
|
+
qs: "^6.12.3",
|
|
243642
243628
|
zod: "^4.3.5"
|
|
243643
243629
|
},
|
|
243644
243630
|
engines: {
|
|
@@ -243735,7 +243721,7 @@ async function createProjectFilesForExistingProject(options) {
|
|
|
243735
243721
|
};
|
|
243736
243722
|
}
|
|
243737
243723
|
// src/core/project/deploy.ts
|
|
243738
|
-
import { resolve
|
|
243724
|
+
import { resolve } from "node:path";
|
|
243739
243725
|
|
|
243740
243726
|
// src/core/site/api.ts
|
|
243741
243727
|
async function uploadSite(archivePath) {
|
|
@@ -243824,7 +243810,7 @@ async function deployAll(projectData, options) {
|
|
|
243824
243810
|
await authConfigResource.push(authConfig);
|
|
243825
243811
|
const { results: connectorResults } = await pushConnectors(connectors);
|
|
243826
243812
|
if (project.site?.outputDirectory) {
|
|
243827
|
-
const outputDir =
|
|
243813
|
+
const outputDir = resolve(project.root, project.site.outputDirectory);
|
|
243828
243814
|
const { appUrl } = await deploySite(outputDir);
|
|
243829
243815
|
return { appUrl, connectorResults };
|
|
243830
243816
|
}
|
|
@@ -245639,8 +245625,8 @@ var disconnect = (anyProcess) => {
|
|
|
245639
245625
|
// ../../node_modules/execa/lib/utils/deferred.js
|
|
245640
245626
|
var createDeferred = () => {
|
|
245641
245627
|
const methods = {};
|
|
245642
|
-
const promise2 = new Promise((
|
|
245643
|
-
Object.assign(methods, { resolve:
|
|
245628
|
+
const promise2 = new Promise((resolve2, reject) => {
|
|
245629
|
+
Object.assign(methods, { resolve: resolve2, reject });
|
|
245644
245630
|
});
|
|
245645
245631
|
return Object.assign(promise2, methods);
|
|
245646
245632
|
};
|
|
@@ -250004,11 +249990,11 @@ var addConcurrentStream = (concurrentStreams, stream, waitName) => {
|
|
|
250004
249990
|
const promises = weakMap.get(stream);
|
|
250005
249991
|
const promise2 = createDeferred();
|
|
250006
249992
|
promises.push(promise2);
|
|
250007
|
-
const
|
|
250008
|
-
return { resolve:
|
|
249993
|
+
const resolve2 = promise2.resolve.bind(promise2);
|
|
249994
|
+
return { resolve: resolve2, promises };
|
|
250009
249995
|
};
|
|
250010
|
-
var waitForConcurrentStreams = async ({ resolve:
|
|
250011
|
-
|
|
249996
|
+
var waitForConcurrentStreams = async ({ resolve: resolve2, promises }, subprocess) => {
|
|
249997
|
+
resolve2();
|
|
250012
249998
|
const [isSubprocessExit] = await Promise.race([
|
|
250013
249999
|
Promise.allSettled([true, subprocess]),
|
|
250014
250000
|
Promise.all([false, ...promises])
|
|
@@ -251135,7 +251121,7 @@ function getAuthPushCommand() {
|
|
|
251135
251121
|
}
|
|
251136
251122
|
|
|
251137
251123
|
// src/cli/commands/auth/social-login.ts
|
|
251138
|
-
import { dirname as dirname10, join as join15, resolve as
|
|
251124
|
+
import { dirname as dirname10, join as join15, resolve as resolve2 } from "node:path";
|
|
251139
251125
|
var PROVIDER_LABELS = {
|
|
251140
251126
|
google: "Google",
|
|
251141
251127
|
microsoft: "Microsoft",
|
|
@@ -251175,7 +251161,7 @@ async function socialLoginAction({ log, isNonInteractive, runTask: runTask2 }, p
|
|
|
251175
251161
|
let clientSecret;
|
|
251176
251162
|
if (useCustomOAuth && oauth && oauthCli && hasSecretOptions(options)) {
|
|
251177
251163
|
if (options.envFile) {
|
|
251178
|
-
const secrets = await parseEnvFile(
|
|
251164
|
+
const secrets = await parseEnvFile(resolve2(options.envFile));
|
|
251179
251165
|
const value = secrets[oauthCli.envVar];
|
|
251180
251166
|
if (!value) {
|
|
251181
251167
|
throw new InvalidInputError(`Key "${oauthCli.envVar}" not found in ${options.envFile}.`);
|
|
@@ -251231,7 +251217,33 @@ function getSocialLoginCommand() {
|
|
|
251231
251217
|
}
|
|
251232
251218
|
|
|
251233
251219
|
// src/cli/commands/auth/sso.ts
|
|
251234
|
-
import { dirname as dirname11, join as join16, resolve as
|
|
251220
|
+
import { dirname as dirname11, join as join16, resolve as resolve3 } from "node:path";
|
|
251221
|
+
var SSOConfigFileSchema = exports_external.object({
|
|
251222
|
+
provider: exports_external.enum(["google", "microsoft", "github", "okta", "custom"]),
|
|
251223
|
+
clientId: exports_external.string(),
|
|
251224
|
+
clientSecret: exports_external.string(),
|
|
251225
|
+
scope: exports_external.string().optional(),
|
|
251226
|
+
discoveryUrl: exports_external.string().optional(),
|
|
251227
|
+
tenantId: exports_external.string().optional(),
|
|
251228
|
+
oktaDomain: exports_external.string().optional(),
|
|
251229
|
+
authEndpoint: exports_external.string().optional(),
|
|
251230
|
+
tokenEndpoint: exports_external.string().optional(),
|
|
251231
|
+
userinfoEndpoint: exports_external.string().optional(),
|
|
251232
|
+
jwksUri: exports_external.string().optional(),
|
|
251233
|
+
ssoName: exports_external.string().optional()
|
|
251234
|
+
});
|
|
251235
|
+
async function loadSSOConfigFile(filePath) {
|
|
251236
|
+
const resolved = resolve3(filePath);
|
|
251237
|
+
const raw2 = await readJsonFile(resolved);
|
|
251238
|
+
const result = SSOConfigFileSchema.safeParse(raw2);
|
|
251239
|
+
if (!result.success) {
|
|
251240
|
+
const issues = result.error.issues.map((i2) => ` ${i2.path.join(".")}: ${i2.message}`).join(`
|
|
251241
|
+
`);
|
|
251242
|
+
throw new InvalidInputError(`Invalid SSO config file ${filePath}:
|
|
251243
|
+
${issues}`);
|
|
251244
|
+
}
|
|
251245
|
+
return result.data;
|
|
251246
|
+
}
|
|
251235
251247
|
function mergeFileWithFlags(fileConfig, options) {
|
|
251236
251248
|
return {
|
|
251237
251249
|
provider: options.provider ?? fileConfig.provider,
|
|
@@ -251256,7 +251268,7 @@ function validateProvider(provider) {
|
|
|
251256
251268
|
hints: [
|
|
251257
251269
|
{
|
|
251258
251270
|
message: `Valid providers: ${KNOWN_SSO_PROVIDERS.join(", ")}`,
|
|
251259
|
-
command: "base44 auth sso enable --provider
|
|
251271
|
+
command: "base44 auth sso enable --provider <provider> --client-id <id> --client-secret <secret>"
|
|
251260
251272
|
}
|
|
251261
251273
|
]
|
|
251262
251274
|
});
|
|
@@ -251285,7 +251297,7 @@ async function ssoEnableAction({ isNonInteractive, log, runTask: runTask2 }, opt
|
|
|
251285
251297
|
}
|
|
251286
251298
|
let clientSecret;
|
|
251287
251299
|
if (merged.envFile && !merged.clientSecret) {
|
|
251288
|
-
const secrets2 = await parseEnvFile(
|
|
251300
|
+
const secrets2 = await parseEnvFile(resolve3(merged.envFile));
|
|
251289
251301
|
const value = secrets2.sso_client_secret;
|
|
251290
251302
|
if (!value) {
|
|
251291
251303
|
throw new InvalidInputError(`Key "sso_client_secret" not found in ${merged.envFile}.`);
|
|
@@ -251962,19 +251974,19 @@ var baseOpen = async (options) => {
|
|
|
251962
251974
|
}
|
|
251963
251975
|
const subprocess = childProcess3.spawn(command2, cliArguments, childProcessOptions);
|
|
251964
251976
|
if (options.wait) {
|
|
251965
|
-
return new Promise((
|
|
251977
|
+
return new Promise((resolve4, reject) => {
|
|
251966
251978
|
subprocess.once("error", reject);
|
|
251967
251979
|
subprocess.once("close", (exitCode) => {
|
|
251968
251980
|
if (!options.allowNonzeroExitCode && exitCode !== 0) {
|
|
251969
251981
|
reject(new Error(`Exited with code ${exitCode}`));
|
|
251970
251982
|
return;
|
|
251971
251983
|
}
|
|
251972
|
-
|
|
251984
|
+
resolve4(subprocess);
|
|
251973
251985
|
});
|
|
251974
251986
|
});
|
|
251975
251987
|
}
|
|
251976
251988
|
if (isFallbackAttempt) {
|
|
251977
|
-
return new Promise((
|
|
251989
|
+
return new Promise((resolve4, reject) => {
|
|
251978
251990
|
subprocess.once("error", reject);
|
|
251979
251991
|
subprocess.once("spawn", () => {
|
|
251980
251992
|
subprocess.once("close", (exitCode) => {
|
|
@@ -251984,17 +251996,17 @@ var baseOpen = async (options) => {
|
|
|
251984
251996
|
return;
|
|
251985
251997
|
}
|
|
251986
251998
|
subprocess.unref();
|
|
251987
|
-
|
|
251999
|
+
resolve4(subprocess);
|
|
251988
252000
|
});
|
|
251989
252001
|
});
|
|
251990
252002
|
});
|
|
251991
252003
|
}
|
|
251992
252004
|
subprocess.unref();
|
|
251993
|
-
return new Promise((
|
|
252005
|
+
return new Promise((resolve4, reject) => {
|
|
251994
252006
|
subprocess.once("error", reject);
|
|
251995
252007
|
subprocess.once("spawn", () => {
|
|
251996
252008
|
subprocess.off("error", reject);
|
|
251997
|
-
|
|
252009
|
+
resolve4(subprocess);
|
|
251998
252010
|
});
|
|
251999
252011
|
});
|
|
252000
252012
|
};
|
|
@@ -252535,7 +252547,7 @@ function getFunctionsCommand() {
|
|
|
252535
252547
|
}
|
|
252536
252548
|
|
|
252537
252549
|
// src/cli/commands/project/create.ts
|
|
252538
|
-
import { basename as basename3, join as join19, resolve as
|
|
252550
|
+
import { basename as basename3, join as join19, resolve as resolve4 } from "node:path";
|
|
252539
252551
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
252540
252552
|
var DEFAULT_TEMPLATE_ID = "backend-only";
|
|
252541
252553
|
async function getTemplateById(templateId) {
|
|
@@ -252600,7 +252612,7 @@ async function createInteractive(options, ctx) {
|
|
|
252600
252612
|
}, ctx);
|
|
252601
252613
|
}
|
|
252602
252614
|
async function createNonInteractive(options, ctx) {
|
|
252603
|
-
ctx.log.info(`Creating a new project at ${
|
|
252615
|
+
ctx.log.info(`Creating a new project at ${resolve4(options.path)}`);
|
|
252604
252616
|
const template2 = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
|
|
252605
252617
|
return await executeCreate({
|
|
252606
252618
|
template: template2,
|
|
@@ -252621,7 +252633,7 @@ async function executeCreate({
|
|
|
252621
252633
|
isInteractive
|
|
252622
252634
|
}, { log, runTask: runTask2 }) {
|
|
252623
252635
|
const name2 = rawName.trim();
|
|
252624
|
-
const resolvedPath =
|
|
252636
|
+
const resolvedPath = resolve4(projectPath);
|
|
252625
252637
|
const { projectId } = await runTask2("Setting up your project...", async () => {
|
|
252626
252638
|
return await createProjectFiles({
|
|
252627
252639
|
name: name2,
|
|
@@ -253137,7 +253149,7 @@ function getSecretsListCommand() {
|
|
|
253137
253149
|
}
|
|
253138
253150
|
|
|
253139
253151
|
// src/cli/commands/secrets/set.ts
|
|
253140
|
-
import { resolve as
|
|
253152
|
+
import { resolve as resolve5 } from "node:path";
|
|
253141
253153
|
function parseEntries(entries) {
|
|
253142
253154
|
const secrets = {};
|
|
253143
253155
|
for (const entry of entries) {
|
|
@@ -253168,7 +253180,7 @@ async function setSecretsAction({ log, runTask: runTask2 }, entries, options) {
|
|
|
253168
253180
|
validateInput(entries, options);
|
|
253169
253181
|
let secrets;
|
|
253170
253182
|
if (options.envFile) {
|
|
253171
|
-
secrets = await parseEnvFile(
|
|
253183
|
+
secrets = await parseEnvFile(resolve5(options.envFile));
|
|
253172
253184
|
if (Object.keys(secrets).length === 0) {
|
|
253173
253185
|
throw new InvalidInputError("The env file contains no valid KEY=VALUE entries.");
|
|
253174
253186
|
}
|
|
@@ -253197,7 +253209,7 @@ function getSecretsCommand() {
|
|
|
253197
253209
|
}
|
|
253198
253210
|
|
|
253199
253211
|
// src/cli/commands/site/deploy.ts
|
|
253200
|
-
import { resolve as
|
|
253212
|
+
import { resolve as resolve6 } from "node:path";
|
|
253201
253213
|
async function deployAction2({ isNonInteractive, runTask: runTask2 }, options) {
|
|
253202
253214
|
if (isNonInteractive && !options.yes) {
|
|
253203
253215
|
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
@@ -253212,7 +253224,7 @@ async function deployAction2({ isNonInteractive, runTask: runTask2 }, options) {
|
|
|
253212
253224
|
]
|
|
253213
253225
|
});
|
|
253214
253226
|
}
|
|
253215
|
-
const outputDir =
|
|
253227
|
+
const outputDir = resolve6(project2.root, project2.site.outputDirectory);
|
|
253216
253228
|
if (!options.yes) {
|
|
253217
253229
|
const shouldDeploy = await Re({
|
|
253218
253230
|
message: `Deploy site from ${project2.site.outputDirectory}?`
|
|
@@ -253383,9 +253395,12 @@ function getTypesCommand() {
|
|
|
253383
253395
|
return new Command("types").description("Manage TypeScript type generation").addCommand(getTypesGenerateCommand());
|
|
253384
253396
|
}
|
|
253385
253397
|
|
|
253398
|
+
// src/cli/commands/dev.ts
|
|
253399
|
+
import process21 from "node:process";
|
|
253400
|
+
|
|
253386
253401
|
// src/cli/dev/dev-server/main.ts
|
|
253387
253402
|
var import_cors = __toESM(require_lib4(), 1);
|
|
253388
|
-
var
|
|
253403
|
+
var import_express6 = __toESM(require_express(), 1);
|
|
253389
253404
|
import { dirname as dirname18, join as join25 } from "node:path";
|
|
253390
253405
|
|
|
253391
253406
|
// ../../node_modules/get-port/index.js
|
|
@@ -253413,14 +253428,14 @@ var getLocalHosts = () => {
|
|
|
253413
253428
|
}
|
|
253414
253429
|
return results;
|
|
253415
253430
|
};
|
|
253416
|
-
var checkAvailablePort = (options8) => new Promise((
|
|
253431
|
+
var checkAvailablePort = (options8) => new Promise((resolve8, reject) => {
|
|
253417
253432
|
const server = net.createServer();
|
|
253418
253433
|
server.unref();
|
|
253419
253434
|
server.on("error", reject);
|
|
253420
253435
|
server.listen(options8, () => {
|
|
253421
253436
|
const { port } = server.address();
|
|
253422
253437
|
server.close(() => {
|
|
253423
|
-
|
|
253438
|
+
resolve8(port);
|
|
253424
253439
|
});
|
|
253425
253440
|
});
|
|
253426
253441
|
});
|
|
@@ -253674,7 +253689,7 @@ class FunctionManager {
|
|
|
253674
253689
|
});
|
|
253675
253690
|
}
|
|
253676
253691
|
waitForReady(name2, runningFunc) {
|
|
253677
|
-
return new Promise((
|
|
253692
|
+
return new Promise((resolve8, reject) => {
|
|
253678
253693
|
runningFunc.process.on("exit", (code2) => {
|
|
253679
253694
|
if (!runningFunc.ready) {
|
|
253680
253695
|
clearTimeout(timeout3);
|
|
@@ -253697,7 +253712,7 @@ class FunctionManager {
|
|
|
253697
253712
|
runningFunc.ready = true;
|
|
253698
253713
|
clearTimeout(timeout3);
|
|
253699
253714
|
runningFunc.process.stdout?.off("data", onData);
|
|
253700
|
-
|
|
253715
|
+
resolve8(runningFunc.port);
|
|
253701
253716
|
}
|
|
253702
253717
|
};
|
|
253703
253718
|
runningFunc.process.stdout?.on("data", onData);
|
|
@@ -253949,7 +253964,9 @@ class Validator {
|
|
|
253949
253964
|
}
|
|
253950
253965
|
|
|
253951
253966
|
// src/cli/dev/dev-server/db/database.ts
|
|
253967
|
+
var PRIVATE_COLLECTION_PREFIX = "$";
|
|
253952
253968
|
var USER_COLLECTION = "user";
|
|
253969
|
+
var PRIVATE_USER_COLLECTION = PRIVATE_COLLECTION_PREFIX + USER_COLLECTION;
|
|
253953
253970
|
|
|
253954
253971
|
class Database {
|
|
253955
253972
|
collections = new Map;
|
|
@@ -253971,6 +253988,7 @@ class Database {
|
|
|
253971
253988
|
this.schemas.set(USER_COLLECTION, this.buildUserSchema(userEntity));
|
|
253972
253989
|
const collection = new import_nedb.default;
|
|
253973
253990
|
this.collections.set(USER_COLLECTION, collection);
|
|
253991
|
+
this.collections.set(PRIVATE_USER_COLLECTION, new import_nedb.default);
|
|
253974
253992
|
const userInfo = await readAuth();
|
|
253975
253993
|
const now = getNowISOTimestamp();
|
|
253976
253994
|
await collection.insertAsync({
|
|
@@ -254012,7 +254030,9 @@ class Database {
|
|
|
254012
254030
|
return this.collections.get(this.normalizeName(name2));
|
|
254013
254031
|
}
|
|
254014
254032
|
getCollectionNames() {
|
|
254015
|
-
return Array.from(this.collections.keys())
|
|
254033
|
+
return Array.from(this.collections.keys()).filter((name2) => {
|
|
254034
|
+
return !name2.startsWith(PRIVATE_COLLECTION_PREFIX);
|
|
254035
|
+
});
|
|
254016
254036
|
}
|
|
254017
254037
|
dropAll() {
|
|
254018
254038
|
for (const collection of this.collections.values()) {
|
|
@@ -254076,15 +254096,229 @@ function broadcastEntityEvent(io6, appId, entityName, event) {
|
|
|
254076
254096
|
});
|
|
254077
254097
|
}
|
|
254078
254098
|
|
|
254079
|
-
// src/cli/dev/dev-server/routes/
|
|
254080
|
-
var import_express3 = __toESM(require_express(), 1);
|
|
254081
|
-
|
|
254082
|
-
// src/cli/dev/dev-server/routes/entities/entities-user-router.ts
|
|
254099
|
+
// src/cli/dev/dev-server/routes/auth-router.ts
|
|
254083
254100
|
var import_express2 = __toESM(require_express(), 1);
|
|
254084
254101
|
var import_jsonwebtoken = __toESM(require_jsonwebtoken(), 1);
|
|
254085
|
-
|
|
254102
|
+
import { randomInt } from "node:crypto";
|
|
254103
|
+
var LOCAL_DEV_SECRET = "LOCAL_DEV_SECRET";
|
|
254104
|
+
var TEN_MINUTES = 10 * 60 * 1000;
|
|
254105
|
+
var generateCode = () => {
|
|
254106
|
+
return randomInt(1e5, 1e6).toString();
|
|
254107
|
+
};
|
|
254108
|
+
var createJwtToken = (email3) => {
|
|
254109
|
+
return import_jsonwebtoken.default.sign({ sub: email3 }, LOCAL_DEV_SECRET, {
|
|
254110
|
+
expiresIn: "360d"
|
|
254111
|
+
});
|
|
254112
|
+
};
|
|
254113
|
+
var LoginBody = object({ email: email2(), password: string2() });
|
|
254114
|
+
var VerifyOtpBody = object({ email: email2(), otp_code: string2() });
|
|
254115
|
+
function createAuthRouter(db2, logger2) {
|
|
254086
254116
|
const router = import_express2.Router({ mergeParams: true });
|
|
254087
254117
|
const parseBody = import_express2.json();
|
|
254118
|
+
router.post("/login", parseBody, async (req, res) => {
|
|
254119
|
+
const { email: email3, password } = LoginBody.parse(req.body);
|
|
254120
|
+
const result = await db2.getCollection(USER_COLLECTION)?.findOneAsync({ email: email3 });
|
|
254121
|
+
if (result) {
|
|
254122
|
+
const privateUserData = await db2.getCollection(PRIVATE_USER_COLLECTION)?.findOneAsync({ email: email3 });
|
|
254123
|
+
if (result.role === "admin" || privateUserData?.password === password) {
|
|
254124
|
+
res.json({
|
|
254125
|
+
access_token: createJwtToken(email3),
|
|
254126
|
+
success: true,
|
|
254127
|
+
user: {}
|
|
254128
|
+
});
|
|
254129
|
+
} else {
|
|
254130
|
+
res.status(400).json({
|
|
254131
|
+
detail: "Invalid email or password",
|
|
254132
|
+
error_type: "HTTPException",
|
|
254133
|
+
message: "Invalid email or password",
|
|
254134
|
+
request_id: null,
|
|
254135
|
+
traceback: ""
|
|
254136
|
+
});
|
|
254137
|
+
}
|
|
254138
|
+
return;
|
|
254139
|
+
}
|
|
254140
|
+
res.status(401).json({ error: "Unauthorized" });
|
|
254141
|
+
});
|
|
254142
|
+
router.post("/register", parseBody, async (req, res) => {
|
|
254143
|
+
const { email: email3, password } = LoginBody.parse(req.body);
|
|
254144
|
+
if ((password || "").length < 8) {
|
|
254145
|
+
res.status(400).json({
|
|
254146
|
+
detail: "Password must be at least 8 characters long",
|
|
254147
|
+
error_type: "HTTPException",
|
|
254148
|
+
message: "Password must be at least 8 characters long",
|
|
254149
|
+
request_id: null,
|
|
254150
|
+
traceback: ""
|
|
254151
|
+
});
|
|
254152
|
+
return;
|
|
254153
|
+
}
|
|
254154
|
+
const result = await db2.getCollection(USER_COLLECTION)?.findOneAsync({ email: email3 });
|
|
254155
|
+
if (result) {
|
|
254156
|
+
res.status(400).json({
|
|
254157
|
+
detail: "A user with this email already exists",
|
|
254158
|
+
error_type: "HTTPException",
|
|
254159
|
+
message: "A user with this email already exists",
|
|
254160
|
+
request_id: null,
|
|
254161
|
+
traceback: ""
|
|
254162
|
+
});
|
|
254163
|
+
return;
|
|
254164
|
+
}
|
|
254165
|
+
const privateUserCollection = db2.getCollection(PRIVATE_USER_COLLECTION);
|
|
254166
|
+
const privateUserData = await privateUserCollection?.findOneAsync({
|
|
254167
|
+
email: email3
|
|
254168
|
+
});
|
|
254169
|
+
const otpCode = generateCode();
|
|
254170
|
+
const id2 = privateUserData ? privateUserData.id : nanoid3();
|
|
254171
|
+
if (!privateUserData) {
|
|
254172
|
+
await privateUserCollection?.insertAsync({
|
|
254173
|
+
id: id2,
|
|
254174
|
+
email: email3,
|
|
254175
|
+
otpCode,
|
|
254176
|
+
password,
|
|
254177
|
+
createdAt: Date.now()
|
|
254178
|
+
});
|
|
254179
|
+
} else {
|
|
254180
|
+
await privateUserCollection?.updateAsync({
|
|
254181
|
+
email: email3
|
|
254182
|
+
}, {
|
|
254183
|
+
$set: {
|
|
254184
|
+
otpCode,
|
|
254185
|
+
createdAt: Date.now()
|
|
254186
|
+
}
|
|
254187
|
+
});
|
|
254188
|
+
}
|
|
254189
|
+
logger2.log(theme.styles.info(`
|
|
254190
|
+
In order to complete registration use this verification code: ${otpCode}
|
|
254191
|
+
`));
|
|
254192
|
+
res.json({
|
|
254193
|
+
id: id2,
|
|
254194
|
+
message: "Registration successful. Please check your email for the verification code.",
|
|
254195
|
+
otp_expires_in_minutes: 10
|
|
254196
|
+
});
|
|
254197
|
+
});
|
|
254198
|
+
router.post("/verify-otp", parseBody, async (req, res) => {
|
|
254199
|
+
const { email: email3, otp_code } = VerifyOtpBody.parse(req.body);
|
|
254200
|
+
const privateUserCollection = db2.getCollection(PRIVATE_USER_COLLECTION);
|
|
254201
|
+
const privateUserData = await privateUserCollection?.findOneAsync({
|
|
254202
|
+
email: email3
|
|
254203
|
+
});
|
|
254204
|
+
if (!privateUserData || privateUserData.otpCode !== otp_code) {
|
|
254205
|
+
const appId = req.params.appId;
|
|
254206
|
+
res.status(500).json({
|
|
254207
|
+
detail: `{'email': '${email3}', 'app_id': '${appId}}'} -> Object not found`,
|
|
254208
|
+
error_type: "ObjectNotFoundError",
|
|
254209
|
+
message: `{'email': '${email3}', 'app_id': '${appId}}'} -> Object not found`,
|
|
254210
|
+
request_id: null,
|
|
254211
|
+
traceback: ""
|
|
254212
|
+
});
|
|
254213
|
+
return;
|
|
254214
|
+
}
|
|
254215
|
+
if (+Date.now() - privateUserData.createdAt > TEN_MINUTES) {
|
|
254216
|
+
res.status(400).json({
|
|
254217
|
+
detail: "Verification code has expired",
|
|
254218
|
+
error_type: "HTTPException",
|
|
254219
|
+
message: "Verification code has expired",
|
|
254220
|
+
request_id: null,
|
|
254221
|
+
traceback: ""
|
|
254222
|
+
});
|
|
254223
|
+
} else {
|
|
254224
|
+
await privateUserCollection?.updateAsync({
|
|
254225
|
+
email: email3
|
|
254226
|
+
}, {
|
|
254227
|
+
$unset: { otpCode: true }
|
|
254228
|
+
});
|
|
254229
|
+
const collection = db2.getCollection(USER_COLLECTION);
|
|
254230
|
+
const now = getNowISOTimestamp();
|
|
254231
|
+
const nameFromEmailMatch = /^([^@]+)/.exec(email3);
|
|
254232
|
+
const fullName = nameFromEmailMatch ? nameFromEmailMatch[1] : email3;
|
|
254233
|
+
await collection?.insertAsync({
|
|
254234
|
+
id: privateUserData.id,
|
|
254235
|
+
email: email3,
|
|
254236
|
+
full_name: fullName,
|
|
254237
|
+
is_service: false,
|
|
254238
|
+
is_verified: true,
|
|
254239
|
+
disabled: null,
|
|
254240
|
+
role: "user",
|
|
254241
|
+
collaborator_role: "editor",
|
|
254242
|
+
created_date: now,
|
|
254243
|
+
updated_date: now
|
|
254244
|
+
});
|
|
254245
|
+
res.json({
|
|
254246
|
+
id: privateUserData.id,
|
|
254247
|
+
access_token: createJwtToken(email3),
|
|
254248
|
+
message: "Email verified successfully. You are now logged in.",
|
|
254249
|
+
success: true
|
|
254250
|
+
});
|
|
254251
|
+
}
|
|
254252
|
+
});
|
|
254253
|
+
return router;
|
|
254254
|
+
}
|
|
254255
|
+
|
|
254256
|
+
// src/cli/dev/dev-server/routes/entities/entities-router.ts
|
|
254257
|
+
var import_express4 = __toESM(require_express(), 1);
|
|
254258
|
+
|
|
254259
|
+
// src/cli/dev/dev-server/db/entity-queries.ts
|
|
254260
|
+
function parseSort(sort) {
|
|
254261
|
+
if (!sort) {
|
|
254262
|
+
return;
|
|
254263
|
+
}
|
|
254264
|
+
if (sort.startsWith("-")) {
|
|
254265
|
+
return { [sort.slice(1)]: -1 };
|
|
254266
|
+
}
|
|
254267
|
+
return { [sort]: 1 };
|
|
254268
|
+
}
|
|
254269
|
+
function parseFields(fields) {
|
|
254270
|
+
if (!fields) {
|
|
254271
|
+
return;
|
|
254272
|
+
}
|
|
254273
|
+
const projection = {};
|
|
254274
|
+
for (const field of fields.split(",")) {
|
|
254275
|
+
const trimmed = field.trim();
|
|
254276
|
+
if (trimmed) {
|
|
254277
|
+
projection[trimmed] = 1;
|
|
254278
|
+
}
|
|
254279
|
+
}
|
|
254280
|
+
return Object.keys(projection).length > 0 ? projection : undefined;
|
|
254281
|
+
}
|
|
254282
|
+
var queryEntity = async (collection, reqQuery) => {
|
|
254283
|
+
const { sort, limit, skip: skip2, fields, q: q13 } = reqQuery;
|
|
254284
|
+
let query = {};
|
|
254285
|
+
if (q13 && typeof q13 === "string") {
|
|
254286
|
+
try {
|
|
254287
|
+
query = JSON.parse(q13);
|
|
254288
|
+
} catch {
|
|
254289
|
+
throw new InvalidInputError("Invalid query parameter 'q'");
|
|
254290
|
+
}
|
|
254291
|
+
}
|
|
254292
|
+
let cursor3 = collection.findAsync(query);
|
|
254293
|
+
const sortObj = parseSort(sort);
|
|
254294
|
+
if (sortObj) {
|
|
254295
|
+
cursor3 = cursor3.sort(sortObj);
|
|
254296
|
+
}
|
|
254297
|
+
if (skip2) {
|
|
254298
|
+
const skipNum = Number.parseInt(skip2, 10);
|
|
254299
|
+
if (!Number.isNaN(skipNum)) {
|
|
254300
|
+
cursor3 = cursor3.skip(skipNum);
|
|
254301
|
+
}
|
|
254302
|
+
}
|
|
254303
|
+
if (limit) {
|
|
254304
|
+
const limitNum = Number.parseInt(limit, 10);
|
|
254305
|
+
if (!Number.isNaN(limitNum)) {
|
|
254306
|
+
cursor3 = cursor3.limit(limitNum);
|
|
254307
|
+
}
|
|
254308
|
+
}
|
|
254309
|
+
const projection = parseFields(fields);
|
|
254310
|
+
if (projection) {
|
|
254311
|
+
cursor3 = cursor3.projection(projection);
|
|
254312
|
+
}
|
|
254313
|
+
return cursor3;
|
|
254314
|
+
};
|
|
254315
|
+
|
|
254316
|
+
// src/cli/dev/dev-server/routes/entities/entities-user-router.ts
|
|
254317
|
+
var import_express3 = __toESM(require_express(), 1);
|
|
254318
|
+
var import_jsonwebtoken2 = __toESM(require_jsonwebtoken(), 1);
|
|
254319
|
+
function createUserRouter(db2, logger2) {
|
|
254320
|
+
const router = import_express3.Router({ mergeParams: true });
|
|
254321
|
+
const parseBody = import_express3.json();
|
|
254088
254322
|
function withAuth(handler) {
|
|
254089
254323
|
return async (req, res) => {
|
|
254090
254324
|
const auth2 = req.headers.authorization;
|
|
@@ -254093,7 +254327,7 @@ function createUserRouter(db2, logger2) {
|
|
|
254093
254327
|
return;
|
|
254094
254328
|
}
|
|
254095
254329
|
try {
|
|
254096
|
-
const { payload } =
|
|
254330
|
+
const { payload } = import_jsonwebtoken2.default.decode(auth2.replace("Bearer ", ""), { complete: true }) ?? {};
|
|
254097
254331
|
const result = await db2.getCollection(USER_COLLECTION)?.findOneAsync({ email: payload?.sub });
|
|
254098
254332
|
if (!result) {
|
|
254099
254333
|
res.status(404).json({ error: "Unable to read data for the current user" });
|
|
@@ -254126,6 +254360,28 @@ function createUserRouter(db2, logger2) {
|
|
|
254126
254360
|
...req.body
|
|
254127
254361
|
});
|
|
254128
254362
|
}));
|
|
254363
|
+
router.get("/", withAuth(async (req, res, currentUser) => {
|
|
254364
|
+
const collection = db2.getCollection(USER_COLLECTION);
|
|
254365
|
+
if (!collection) {
|
|
254366
|
+
res.status(404).json({ error: `Entity "${USER_COLLECTION}" not found` });
|
|
254367
|
+
return;
|
|
254368
|
+
}
|
|
254369
|
+
try {
|
|
254370
|
+
if (currentUser.role === "admin") {
|
|
254371
|
+
const result = await queryEntity(collection, req.query);
|
|
254372
|
+
res.json(stripInternalFields(result));
|
|
254373
|
+
} else {
|
|
254374
|
+
res.json([stripInternalFields(currentUser)]);
|
|
254375
|
+
}
|
|
254376
|
+
} catch (error48) {
|
|
254377
|
+
if (error48 instanceof InvalidInputError) {
|
|
254378
|
+
res.status(400).json({ error: error48.message });
|
|
254379
|
+
} else {
|
|
254380
|
+
logger2.error(`Error in GET /${USER_COLLECTION}:`, error48);
|
|
254381
|
+
res.status(500).json({ error: "Internal server error" });
|
|
254382
|
+
}
|
|
254383
|
+
}
|
|
254384
|
+
}));
|
|
254129
254385
|
router.post("/bulk", async (_req, res) => {
|
|
254130
254386
|
res.json({});
|
|
254131
254387
|
});
|
|
@@ -254175,31 +254431,9 @@ function createUserRouter(db2, logger2) {
|
|
|
254175
254431
|
}
|
|
254176
254432
|
|
|
254177
254433
|
// src/cli/dev/dev-server/routes/entities/entities-router.ts
|
|
254178
|
-
function parseSort(sort) {
|
|
254179
|
-
if (!sort) {
|
|
254180
|
-
return;
|
|
254181
|
-
}
|
|
254182
|
-
if (sort.startsWith("-")) {
|
|
254183
|
-
return { [sort.slice(1)]: -1 };
|
|
254184
|
-
}
|
|
254185
|
-
return { [sort]: 1 };
|
|
254186
|
-
}
|
|
254187
|
-
function parseFields(fields) {
|
|
254188
|
-
if (!fields) {
|
|
254189
|
-
return;
|
|
254190
|
-
}
|
|
254191
|
-
const projection = {};
|
|
254192
|
-
for (const field of fields.split(",")) {
|
|
254193
|
-
const trimmed = field.trim();
|
|
254194
|
-
if (trimmed) {
|
|
254195
|
-
projection[trimmed] = 1;
|
|
254196
|
-
}
|
|
254197
|
-
}
|
|
254198
|
-
return Object.keys(projection).length > 0 ? projection : undefined;
|
|
254199
|
-
}
|
|
254200
254434
|
async function createEntityRoutes(db2, logger2, broadcast) {
|
|
254201
|
-
const router =
|
|
254202
|
-
const parseBody =
|
|
254435
|
+
const router = import_express4.Router({ mergeParams: true });
|
|
254436
|
+
const parseBody = import_express4.json();
|
|
254203
254437
|
function withCollection(handler) {
|
|
254204
254438
|
return async (req, res) => {
|
|
254205
254439
|
const collection = db2.getCollection(req.params.entityName);
|
|
@@ -254244,42 +254478,14 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
254244
254478
|
router.get("/:entityName", withCollection(async (req, res, collection) => {
|
|
254245
254479
|
const { entityName } = req.params;
|
|
254246
254480
|
try {
|
|
254247
|
-
|
|
254248
|
-
let query = {};
|
|
254249
|
-
if (q13 && typeof q13 === "string") {
|
|
254250
|
-
try {
|
|
254251
|
-
query = JSON.parse(q13);
|
|
254252
|
-
} catch {
|
|
254253
|
-
res.status(400).json({ error: "Invalid query parameter 'q'" });
|
|
254254
|
-
return;
|
|
254255
|
-
}
|
|
254256
|
-
}
|
|
254257
|
-
let cursor3 = collection.findAsync(query);
|
|
254258
|
-
const sortObj = parseSort(sort);
|
|
254259
|
-
if (sortObj) {
|
|
254260
|
-
cursor3 = cursor3.sort(sortObj);
|
|
254261
|
-
}
|
|
254262
|
-
if (skip2) {
|
|
254263
|
-
const skipNum = Number.parseInt(skip2, 10);
|
|
254264
|
-
if (!Number.isNaN(skipNum)) {
|
|
254265
|
-
cursor3 = cursor3.skip(skipNum);
|
|
254266
|
-
}
|
|
254267
|
-
}
|
|
254268
|
-
if (limit) {
|
|
254269
|
-
const limitNum = Number.parseInt(limit, 10);
|
|
254270
|
-
if (!Number.isNaN(limitNum)) {
|
|
254271
|
-
cursor3 = cursor3.limit(limitNum);
|
|
254272
|
-
}
|
|
254273
|
-
}
|
|
254274
|
-
const projection = parseFields(fields);
|
|
254275
|
-
if (projection) {
|
|
254276
|
-
cursor3 = cursor3.projection(projection);
|
|
254277
|
-
}
|
|
254278
|
-
const docs = await cursor3;
|
|
254279
|
-
res.json(stripInternalFields(docs));
|
|
254481
|
+
res.json(stripInternalFields(await queryEntity(collection, req.query)));
|
|
254280
254482
|
} catch (error48) {
|
|
254281
|
-
|
|
254282
|
-
|
|
254483
|
+
if (error48 instanceof InvalidInputError) {
|
|
254484
|
+
res.status(400).json({ error: error48.message });
|
|
254485
|
+
} else {
|
|
254486
|
+
logger2.error(`Error in GET /${entityName}:`, error48);
|
|
254487
|
+
res.status(500).json({ error: "Internal server error" });
|
|
254488
|
+
}
|
|
254283
254489
|
}
|
|
254284
254490
|
}));
|
|
254285
254491
|
router.post("/:entityName", parseBody, withCollection(async (req, res, collection) => {
|
|
@@ -254398,7 +254604,7 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
254398
254604
|
}
|
|
254399
254605
|
|
|
254400
254606
|
// src/cli/dev/dev-server/routes/integrations.ts
|
|
254401
|
-
var
|
|
254607
|
+
var import_express5 = __toESM(require_express(), 1);
|
|
254402
254608
|
var import_multer = __toESM(require_multer(), 1);
|
|
254403
254609
|
import { createHash, randomUUID as randomUUID4 } from "node:crypto";
|
|
254404
254610
|
import fs28 from "node:fs";
|
|
@@ -254407,8 +254613,8 @@ function createFileToken(fileUri) {
|
|
|
254407
254613
|
return createHash("sha256").update(fileUri).digest("hex");
|
|
254408
254614
|
}
|
|
254409
254615
|
function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger2) {
|
|
254410
|
-
const router =
|
|
254411
|
-
const parseBody =
|
|
254616
|
+
const router = import_express5.Router({ mergeParams: true });
|
|
254617
|
+
const parseBody = import_express5.json();
|
|
254412
254618
|
const privateFilesDir = path18.join(mediaFilesDir, "private");
|
|
254413
254619
|
fs28.mkdirSync(mediaFilesDir, { recursive: true });
|
|
254414
254620
|
fs28.mkdirSync(privateFilesDir, { recursive: true });
|
|
@@ -254478,7 +254684,7 @@ function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger2) {
|
|
|
254478
254684
|
return router;
|
|
254479
254685
|
}
|
|
254480
254686
|
function createCustomIntegrationRoutes(remoteProxy, logger2) {
|
|
254481
|
-
const router =
|
|
254687
|
+
const router = import_express5.Router({ mergeParams: true });
|
|
254482
254688
|
router.post("/:slug/:operationId", (req, res, next) => {
|
|
254483
254689
|
logger2.warn(`"${req.originalUrl}" is not supported in local development, passing call to production`);
|
|
254484
254690
|
req.url = req.originalUrl;
|
|
@@ -255337,7 +255543,7 @@ class NodeFsHandler {
|
|
|
255337
255543
|
this._addToNodeFs(path19, initialAdd, wh2, depth + 1);
|
|
255338
255544
|
}
|
|
255339
255545
|
}).on(EV.ERROR, this._boundHandleError);
|
|
255340
|
-
return new Promise((
|
|
255546
|
+
return new Promise((resolve9, reject) => {
|
|
255341
255547
|
if (!stream)
|
|
255342
255548
|
return reject();
|
|
255343
255549
|
stream.once(STR_END, () => {
|
|
@@ -255346,7 +255552,7 @@ class NodeFsHandler {
|
|
|
255346
255552
|
return;
|
|
255347
255553
|
}
|
|
255348
255554
|
const wasThrottled = throttler ? throttler.clear() : false;
|
|
255349
|
-
|
|
255555
|
+
resolve9(undefined);
|
|
255350
255556
|
previous.getChildren().filter((item) => {
|
|
255351
255557
|
return item !== directory && !current.has(item);
|
|
255352
255558
|
}).forEach((item) => {
|
|
@@ -256191,7 +256397,7 @@ async function createDevServer(options8) {
|
|
|
256191
256397
|
const port = userPort ?? await getPorts({ port: DEFAULT_PORT });
|
|
256192
256398
|
const baseUrl = `http://localhost:${port}`;
|
|
256193
256399
|
const { functions, entities, project: project2 } = await options8.loadResources();
|
|
256194
|
-
const app =
|
|
256400
|
+
const app = import_express6.default();
|
|
256195
256401
|
const remoteProxy = import_http_proxy_middleware2.createProxyMiddleware({
|
|
256196
256402
|
target: BASE44_APP_URL,
|
|
256197
256403
|
changeOrigin: true
|
|
@@ -256223,6 +256429,8 @@ async function createDevServer(options8) {
|
|
|
256223
256429
|
let emitEntityEvent = () => {};
|
|
256224
256430
|
const entityRoutes = await createEntityRoutes(db2, devLogger, (...args) => emitEntityEvent(...args));
|
|
256225
256431
|
app.use("/api/apps/:appId/entities", entityRoutes);
|
|
256432
|
+
const authRouter = createAuthRouter(db2, devLogger);
|
|
256433
|
+
app.use("/api/apps/:appId/auth", authRouter);
|
|
256226
256434
|
const { path: mediaFilesDir } = await $dir();
|
|
256227
256435
|
app.use("/media/private/:fileUri", (req, res, next) => {
|
|
256228
256436
|
const { fileUri } = req.params;
|
|
@@ -256242,16 +256450,18 @@ async function createDevServer(options8) {
|
|
|
256242
256450
|
}
|
|
256243
256451
|
next();
|
|
256244
256452
|
});
|
|
256245
|
-
app.use("/media",
|
|
256453
|
+
app.use("/media", import_express6.default.static(mediaFilesDir));
|
|
256246
256454
|
const integrationRoutes = createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, devLogger);
|
|
256247
256455
|
app.use("/api/apps/:appId/integration-endpoints", integrationRoutes);
|
|
256248
256456
|
const customIntegrationRoutes = createCustomIntegrationRoutes(remoteProxy, devLogger);
|
|
256249
256457
|
app.use("/api/apps/:appId/integrations/custom", customIntegrationRoutes);
|
|
256250
256458
|
app.use((req, res, next) => {
|
|
256251
|
-
|
|
256459
|
+
if (!req.originalUrl.endsWith("analytics/track/batch")) {
|
|
256460
|
+
devLogger.warn(`"${req.originalUrl}" is not supported in local development, passing call to production`);
|
|
256461
|
+
}
|
|
256252
256462
|
remoteProxy(req, res, next);
|
|
256253
256463
|
});
|
|
256254
|
-
const server = await new Promise((
|
|
256464
|
+
const server = await new Promise((resolve10, reject) => {
|
|
256255
256465
|
const s5 = app.listen(port, "127.0.0.1", (err) => {
|
|
256256
256466
|
if (err) {
|
|
256257
256467
|
if ("code" in err && err.code === "EADDRINUSE") {
|
|
@@ -256260,7 +256470,7 @@ async function createDevServer(options8) {
|
|
|
256260
256470
|
reject(err);
|
|
256261
256471
|
}
|
|
256262
256472
|
} else {
|
|
256263
|
-
|
|
256473
|
+
resolve10(s5);
|
|
256264
256474
|
}
|
|
256265
256475
|
});
|
|
256266
256476
|
});
|
|
@@ -256319,6 +256529,7 @@ async function devAction({ log }, options8) {
|
|
|
256319
256529
|
const { port: resolvedPort } = await createDevServer({
|
|
256320
256530
|
log,
|
|
256321
256531
|
port,
|
|
256532
|
+
cwd: process21.cwd(),
|
|
256322
256533
|
denoWrapperPath: getDenoWrapperPath(),
|
|
256323
256534
|
loadResources: async () => {
|
|
256324
256535
|
const { functions, entities, project: project2 } = await readProjectConfig();
|
|
@@ -256376,13 +256587,13 @@ async function runScript(options8) {
|
|
|
256376
256587
|
}
|
|
256377
256588
|
// src/cli/commands/exec.ts
|
|
256378
256589
|
function readStdin2() {
|
|
256379
|
-
return new Promise((
|
|
256590
|
+
return new Promise((resolve10, reject) => {
|
|
256380
256591
|
let data = "";
|
|
256381
256592
|
process.stdin.setEncoding("utf-8");
|
|
256382
256593
|
process.stdin.on("data", (chunk) => {
|
|
256383
256594
|
data += chunk;
|
|
256384
256595
|
});
|
|
256385
|
-
process.stdin.on("end", () =>
|
|
256596
|
+
process.stdin.on("end", () => resolve10(data));
|
|
256386
256597
|
process.stdin.on("error", reject);
|
|
256387
256598
|
});
|
|
256388
256599
|
}
|
|
@@ -256421,7 +256632,7 @@ Examples:
|
|
|
256421
256632
|
}
|
|
256422
256633
|
|
|
256423
256634
|
// src/cli/commands/project/eject.ts
|
|
256424
|
-
import { resolve as
|
|
256635
|
+
import { resolve as resolve10 } from "node:path";
|
|
256425
256636
|
var import_kebabCase2 = __toESM(require_kebabCase(), 1);
|
|
256426
256637
|
async function eject(ctx, options8) {
|
|
256427
256638
|
const { log, runTask: runTask2, isNonInteractive } = ctx;
|
|
@@ -256477,7 +256688,7 @@ async function eject(ctx, options8) {
|
|
|
256477
256688
|
Ne("Operation cancelled.");
|
|
256478
256689
|
throw new CLIExitError(0);
|
|
256479
256690
|
}
|
|
256480
|
-
const resolvedPath =
|
|
256691
|
+
const resolvedPath = resolve10(selectedPath);
|
|
256481
256692
|
await runTask2("Downloading your project's code...", async (updateMessage) => {
|
|
256482
256693
|
await createProjectFilesForExistingProject({
|
|
256483
256694
|
projectId,
|
|
@@ -258845,14 +259056,14 @@ async function addSourceContext(frames) {
|
|
|
258845
259056
|
return frames;
|
|
258846
259057
|
}
|
|
258847
259058
|
function getContextLinesFromFile(path19, ranges, output) {
|
|
258848
|
-
return new Promise((
|
|
259059
|
+
return new Promise((resolve11) => {
|
|
258849
259060
|
const stream = createReadStream2(path19);
|
|
258850
259061
|
const lineReaded = createInterface2({
|
|
258851
259062
|
input: stream
|
|
258852
259063
|
});
|
|
258853
259064
|
function destroyStreamAndResolve() {
|
|
258854
259065
|
stream.destroy();
|
|
258855
|
-
|
|
259066
|
+
resolve11();
|
|
258856
259067
|
}
|
|
258857
259068
|
let lineNumber = 0;
|
|
258858
259069
|
let currentRangeIndex = 0;
|
|
@@ -259964,15 +260175,15 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
259964
260175
|
return true;
|
|
259965
260176
|
if (this.featureFlagsPoller === undefined)
|
|
259966
260177
|
return false;
|
|
259967
|
-
return new Promise((
|
|
260178
|
+
return new Promise((resolve11) => {
|
|
259968
260179
|
const timeout3 = setTimeout(() => {
|
|
259969
260180
|
cleanup();
|
|
259970
|
-
|
|
260181
|
+
resolve11(false);
|
|
259971
260182
|
}, timeoutMs);
|
|
259972
260183
|
const cleanup = this._events.on("localEvaluationFlagsLoaded", (count2) => {
|
|
259973
260184
|
clearTimeout(timeout3);
|
|
259974
260185
|
cleanup();
|
|
259975
|
-
|
|
260186
|
+
resolve11(count2 > 0);
|
|
259976
260187
|
});
|
|
259977
260188
|
});
|
|
259978
260189
|
}
|
|
@@ -260795,4 +261006,4 @@ export {
|
|
|
260795
261006
|
CLIExitError
|
|
260796
261007
|
};
|
|
260797
261008
|
|
|
260798
|
-
//# debugId=
|
|
261009
|
+
//# debugId=2639C9D09C44A37C64756E2164756E21
|