@base44-preview/cli 0.0.50-pr.484.42693d8 → 0.0.50-pr.484.56a235c
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 +557 -345
- 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: "google",
|
|
242177
|
+
microsoft: "microsoft",
|
|
242178
|
+
github: "github",
|
|
242179
|
+
okta: "okta",
|
|
242180
|
+
custom: "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,
|
|
@@ -251250,19 +251262,20 @@ function mergeFileWithFlags(fileConfig, options) {
|
|
|
251250
251262
|
ssoName: options.ssoName ?? fileConfig.ssoName
|
|
251251
251263
|
};
|
|
251252
251264
|
}
|
|
251265
|
+
var providerNames = Object.keys(KNOWN_SSO_PROVIDERS);
|
|
251253
251266
|
function validateProvider(provider) {
|
|
251254
251267
|
if (!provider) {
|
|
251255
251268
|
throw new InvalidInputError("Missing --provider.", {
|
|
251256
251269
|
hints: [
|
|
251257
251270
|
{
|
|
251258
|
-
message: `Valid providers: ${
|
|
251259
|
-
command: "base44 auth sso enable --provider
|
|
251271
|
+
message: `Valid providers: ${providerNames.join(", ")}`,
|
|
251272
|
+
command: "base44 auth sso enable --provider <provider> --client-id <id> --client-secret <secret>"
|
|
251260
251273
|
}
|
|
251261
251274
|
]
|
|
251262
251275
|
});
|
|
251263
251276
|
}
|
|
251264
|
-
if (!
|
|
251265
|
-
throw new InvalidInputError(`Unknown provider "${provider}". Valid providers: ${
|
|
251277
|
+
if (!(provider in KNOWN_SSO_PROVIDERS)) {
|
|
251278
|
+
throw new InvalidInputError(`Unknown provider "${provider}". Valid providers: ${providerNames.join(", ")}`);
|
|
251266
251279
|
}
|
|
251267
251280
|
return provider;
|
|
251268
251281
|
}
|
|
@@ -251285,7 +251298,7 @@ async function ssoEnableAction({ isNonInteractive, log, runTask: runTask2 }, opt
|
|
|
251285
251298
|
}
|
|
251286
251299
|
let clientSecret;
|
|
251287
251300
|
if (merged.envFile && !merged.clientSecret) {
|
|
251288
|
-
const secrets2 = await parseEnvFile(
|
|
251301
|
+
const secrets2 = await parseEnvFile(resolve3(merged.envFile));
|
|
251289
251302
|
const value = secrets2.sso_client_secret;
|
|
251290
251303
|
if (!value) {
|
|
251291
251304
|
throw new InvalidInputError(`Key "sso_client_secret" not found in ${merged.envFile}.`);
|
|
@@ -251962,19 +251975,19 @@ var baseOpen = async (options) => {
|
|
|
251962
251975
|
}
|
|
251963
251976
|
const subprocess = childProcess3.spawn(command2, cliArguments, childProcessOptions);
|
|
251964
251977
|
if (options.wait) {
|
|
251965
|
-
return new Promise((
|
|
251978
|
+
return new Promise((resolve4, reject) => {
|
|
251966
251979
|
subprocess.once("error", reject);
|
|
251967
251980
|
subprocess.once("close", (exitCode) => {
|
|
251968
251981
|
if (!options.allowNonzeroExitCode && exitCode !== 0) {
|
|
251969
251982
|
reject(new Error(`Exited with code ${exitCode}`));
|
|
251970
251983
|
return;
|
|
251971
251984
|
}
|
|
251972
|
-
|
|
251985
|
+
resolve4(subprocess);
|
|
251973
251986
|
});
|
|
251974
251987
|
});
|
|
251975
251988
|
}
|
|
251976
251989
|
if (isFallbackAttempt) {
|
|
251977
|
-
return new Promise((
|
|
251990
|
+
return new Promise((resolve4, reject) => {
|
|
251978
251991
|
subprocess.once("error", reject);
|
|
251979
251992
|
subprocess.once("spawn", () => {
|
|
251980
251993
|
subprocess.once("close", (exitCode) => {
|
|
@@ -251984,17 +251997,17 @@ var baseOpen = async (options) => {
|
|
|
251984
251997
|
return;
|
|
251985
251998
|
}
|
|
251986
251999
|
subprocess.unref();
|
|
251987
|
-
|
|
252000
|
+
resolve4(subprocess);
|
|
251988
252001
|
});
|
|
251989
252002
|
});
|
|
251990
252003
|
});
|
|
251991
252004
|
}
|
|
251992
252005
|
subprocess.unref();
|
|
251993
|
-
return new Promise((
|
|
252006
|
+
return new Promise((resolve4, reject) => {
|
|
251994
252007
|
subprocess.once("error", reject);
|
|
251995
252008
|
subprocess.once("spawn", () => {
|
|
251996
252009
|
subprocess.off("error", reject);
|
|
251997
|
-
|
|
252010
|
+
resolve4(subprocess);
|
|
251998
252011
|
});
|
|
251999
252012
|
});
|
|
252000
252013
|
};
|
|
@@ -252535,7 +252548,7 @@ function getFunctionsCommand() {
|
|
|
252535
252548
|
}
|
|
252536
252549
|
|
|
252537
252550
|
// src/cli/commands/project/create.ts
|
|
252538
|
-
import { basename as basename3, join as join19, resolve as
|
|
252551
|
+
import { basename as basename3, join as join19, resolve as resolve4 } from "node:path";
|
|
252539
252552
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
252540
252553
|
var DEFAULT_TEMPLATE_ID = "backend-only";
|
|
252541
252554
|
async function getTemplateById(templateId) {
|
|
@@ -252600,7 +252613,7 @@ async function createInteractive(options, ctx) {
|
|
|
252600
252613
|
}, ctx);
|
|
252601
252614
|
}
|
|
252602
252615
|
async function createNonInteractive(options, ctx) {
|
|
252603
|
-
ctx.log.info(`Creating a new project at ${
|
|
252616
|
+
ctx.log.info(`Creating a new project at ${resolve4(options.path)}`);
|
|
252604
252617
|
const template2 = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
|
|
252605
252618
|
return await executeCreate({
|
|
252606
252619
|
template: template2,
|
|
@@ -252621,7 +252634,7 @@ async function executeCreate({
|
|
|
252621
252634
|
isInteractive
|
|
252622
252635
|
}, { log, runTask: runTask2 }) {
|
|
252623
252636
|
const name2 = rawName.trim();
|
|
252624
|
-
const resolvedPath =
|
|
252637
|
+
const resolvedPath = resolve4(projectPath);
|
|
252625
252638
|
const { projectId } = await runTask2("Setting up your project...", async () => {
|
|
252626
252639
|
return await createProjectFiles({
|
|
252627
252640
|
name: name2,
|
|
@@ -253137,7 +253150,7 @@ function getSecretsListCommand() {
|
|
|
253137
253150
|
}
|
|
253138
253151
|
|
|
253139
253152
|
// src/cli/commands/secrets/set.ts
|
|
253140
|
-
import { resolve as
|
|
253153
|
+
import { resolve as resolve5 } from "node:path";
|
|
253141
253154
|
function parseEntries(entries) {
|
|
253142
253155
|
const secrets = {};
|
|
253143
253156
|
for (const entry of entries) {
|
|
@@ -253168,7 +253181,7 @@ async function setSecretsAction({ log, runTask: runTask2 }, entries, options) {
|
|
|
253168
253181
|
validateInput(entries, options);
|
|
253169
253182
|
let secrets;
|
|
253170
253183
|
if (options.envFile) {
|
|
253171
|
-
secrets = await parseEnvFile(
|
|
253184
|
+
secrets = await parseEnvFile(resolve5(options.envFile));
|
|
253172
253185
|
if (Object.keys(secrets).length === 0) {
|
|
253173
253186
|
throw new InvalidInputError("The env file contains no valid KEY=VALUE entries.");
|
|
253174
253187
|
}
|
|
@@ -253197,7 +253210,7 @@ function getSecretsCommand() {
|
|
|
253197
253210
|
}
|
|
253198
253211
|
|
|
253199
253212
|
// src/cli/commands/site/deploy.ts
|
|
253200
|
-
import { resolve as
|
|
253213
|
+
import { resolve as resolve6 } from "node:path";
|
|
253201
253214
|
async function deployAction2({ isNonInteractive, runTask: runTask2 }, options) {
|
|
253202
253215
|
if (isNonInteractive && !options.yes) {
|
|
253203
253216
|
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
@@ -253212,7 +253225,7 @@ async function deployAction2({ isNonInteractive, runTask: runTask2 }, options) {
|
|
|
253212
253225
|
]
|
|
253213
253226
|
});
|
|
253214
253227
|
}
|
|
253215
|
-
const outputDir =
|
|
253228
|
+
const outputDir = resolve6(project2.root, project2.site.outputDirectory);
|
|
253216
253229
|
if (!options.yes) {
|
|
253217
253230
|
const shouldDeploy = await Re({
|
|
253218
253231
|
message: `Deploy site from ${project2.site.outputDirectory}?`
|
|
@@ -253383,9 +253396,12 @@ function getTypesCommand() {
|
|
|
253383
253396
|
return new Command("types").description("Manage TypeScript type generation").addCommand(getTypesGenerateCommand());
|
|
253384
253397
|
}
|
|
253385
253398
|
|
|
253399
|
+
// src/cli/commands/dev.ts
|
|
253400
|
+
import process21 from "node:process";
|
|
253401
|
+
|
|
253386
253402
|
// src/cli/dev/dev-server/main.ts
|
|
253387
253403
|
var import_cors = __toESM(require_lib4(), 1);
|
|
253388
|
-
var
|
|
253404
|
+
var import_express6 = __toESM(require_express(), 1);
|
|
253389
253405
|
import { dirname as dirname18, join as join25 } from "node:path";
|
|
253390
253406
|
|
|
253391
253407
|
// ../../node_modules/get-port/index.js
|
|
@@ -253413,14 +253429,14 @@ var getLocalHosts = () => {
|
|
|
253413
253429
|
}
|
|
253414
253430
|
return results;
|
|
253415
253431
|
};
|
|
253416
|
-
var checkAvailablePort = (options8) => new Promise((
|
|
253432
|
+
var checkAvailablePort = (options8) => new Promise((resolve8, reject) => {
|
|
253417
253433
|
const server = net.createServer();
|
|
253418
253434
|
server.unref();
|
|
253419
253435
|
server.on("error", reject);
|
|
253420
253436
|
server.listen(options8, () => {
|
|
253421
253437
|
const { port } = server.address();
|
|
253422
253438
|
server.close(() => {
|
|
253423
|
-
|
|
253439
|
+
resolve8(port);
|
|
253424
253440
|
});
|
|
253425
253441
|
});
|
|
253426
253442
|
});
|
|
@@ -253674,7 +253690,7 @@ class FunctionManager {
|
|
|
253674
253690
|
});
|
|
253675
253691
|
}
|
|
253676
253692
|
waitForReady(name2, runningFunc) {
|
|
253677
|
-
return new Promise((
|
|
253693
|
+
return new Promise((resolve8, reject) => {
|
|
253678
253694
|
runningFunc.process.on("exit", (code2) => {
|
|
253679
253695
|
if (!runningFunc.ready) {
|
|
253680
253696
|
clearTimeout(timeout3);
|
|
@@ -253697,7 +253713,7 @@ class FunctionManager {
|
|
|
253697
253713
|
runningFunc.ready = true;
|
|
253698
253714
|
clearTimeout(timeout3);
|
|
253699
253715
|
runningFunc.process.stdout?.off("data", onData);
|
|
253700
|
-
|
|
253716
|
+
resolve8(runningFunc.port);
|
|
253701
253717
|
}
|
|
253702
253718
|
};
|
|
253703
253719
|
runningFunc.process.stdout?.on("data", onData);
|
|
@@ -253949,7 +253965,9 @@ class Validator {
|
|
|
253949
253965
|
}
|
|
253950
253966
|
|
|
253951
253967
|
// src/cli/dev/dev-server/db/database.ts
|
|
253968
|
+
var PRIVATE_COLLECTION_PREFIX = "$";
|
|
253952
253969
|
var USER_COLLECTION = "user";
|
|
253970
|
+
var PRIVATE_USER_COLLECTION = PRIVATE_COLLECTION_PREFIX + USER_COLLECTION;
|
|
253953
253971
|
|
|
253954
253972
|
class Database {
|
|
253955
253973
|
collections = new Map;
|
|
@@ -253971,6 +253989,7 @@ class Database {
|
|
|
253971
253989
|
this.schemas.set(USER_COLLECTION, this.buildUserSchema(userEntity));
|
|
253972
253990
|
const collection = new import_nedb.default;
|
|
253973
253991
|
this.collections.set(USER_COLLECTION, collection);
|
|
253992
|
+
this.collections.set(PRIVATE_USER_COLLECTION, new import_nedb.default);
|
|
253974
253993
|
const userInfo = await readAuth();
|
|
253975
253994
|
const now = getNowISOTimestamp();
|
|
253976
253995
|
await collection.insertAsync({
|
|
@@ -254012,7 +254031,9 @@ class Database {
|
|
|
254012
254031
|
return this.collections.get(this.normalizeName(name2));
|
|
254013
254032
|
}
|
|
254014
254033
|
getCollectionNames() {
|
|
254015
|
-
return Array.from(this.collections.keys())
|
|
254034
|
+
return Array.from(this.collections.keys()).filter((name2) => {
|
|
254035
|
+
return !name2.startsWith(PRIVATE_COLLECTION_PREFIX);
|
|
254036
|
+
});
|
|
254016
254037
|
}
|
|
254017
254038
|
dropAll() {
|
|
254018
254039
|
for (const collection of this.collections.values()) {
|
|
@@ -254076,15 +254097,229 @@ function broadcastEntityEvent(io6, appId, entityName, event) {
|
|
|
254076
254097
|
});
|
|
254077
254098
|
}
|
|
254078
254099
|
|
|
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
|
|
254100
|
+
// src/cli/dev/dev-server/routes/auth-router.ts
|
|
254083
254101
|
var import_express2 = __toESM(require_express(), 1);
|
|
254084
254102
|
var import_jsonwebtoken = __toESM(require_jsonwebtoken(), 1);
|
|
254085
|
-
|
|
254103
|
+
import { randomInt } from "node:crypto";
|
|
254104
|
+
var LOCAL_DEV_SECRET = "LOCAL_DEV_SECRET";
|
|
254105
|
+
var TEN_MINUTES = 10 * 60 * 1000;
|
|
254106
|
+
var generateCode = () => {
|
|
254107
|
+
return randomInt(1e5, 1e6).toString();
|
|
254108
|
+
};
|
|
254109
|
+
var createJwtToken = (email3) => {
|
|
254110
|
+
return import_jsonwebtoken.default.sign({ sub: email3 }, LOCAL_DEV_SECRET, {
|
|
254111
|
+
expiresIn: "360d"
|
|
254112
|
+
});
|
|
254113
|
+
};
|
|
254114
|
+
var LoginBody = object({ email: email2(), password: string2() });
|
|
254115
|
+
var VerifyOtpBody = object({ email: email2(), otp_code: string2() });
|
|
254116
|
+
function createAuthRouter(db2, logger2) {
|
|
254086
254117
|
const router = import_express2.Router({ mergeParams: true });
|
|
254087
254118
|
const parseBody = import_express2.json();
|
|
254119
|
+
router.post("/login", parseBody, async (req, res) => {
|
|
254120
|
+
const { email: email3, password } = LoginBody.parse(req.body);
|
|
254121
|
+
const result = await db2.getCollection(USER_COLLECTION)?.findOneAsync({ email: email3 });
|
|
254122
|
+
if (result) {
|
|
254123
|
+
const privateUserData = await db2.getCollection(PRIVATE_USER_COLLECTION)?.findOneAsync({ email: email3 });
|
|
254124
|
+
if (result.role === "admin" || privateUserData?.password === password) {
|
|
254125
|
+
res.json({
|
|
254126
|
+
access_token: createJwtToken(email3),
|
|
254127
|
+
success: true,
|
|
254128
|
+
user: {}
|
|
254129
|
+
});
|
|
254130
|
+
} else {
|
|
254131
|
+
res.status(400).json({
|
|
254132
|
+
detail: "Invalid email or password",
|
|
254133
|
+
error_type: "HTTPException",
|
|
254134
|
+
message: "Invalid email or password",
|
|
254135
|
+
request_id: null,
|
|
254136
|
+
traceback: ""
|
|
254137
|
+
});
|
|
254138
|
+
}
|
|
254139
|
+
return;
|
|
254140
|
+
}
|
|
254141
|
+
res.status(401).json({ error: "Unauthorized" });
|
|
254142
|
+
});
|
|
254143
|
+
router.post("/register", parseBody, async (req, res) => {
|
|
254144
|
+
const { email: email3, password } = LoginBody.parse(req.body);
|
|
254145
|
+
if ((password || "").length < 8) {
|
|
254146
|
+
res.status(400).json({
|
|
254147
|
+
detail: "Password must be at least 8 characters long",
|
|
254148
|
+
error_type: "HTTPException",
|
|
254149
|
+
message: "Password must be at least 8 characters long",
|
|
254150
|
+
request_id: null,
|
|
254151
|
+
traceback: ""
|
|
254152
|
+
});
|
|
254153
|
+
return;
|
|
254154
|
+
}
|
|
254155
|
+
const result = await db2.getCollection(USER_COLLECTION)?.findOneAsync({ email: email3 });
|
|
254156
|
+
if (result) {
|
|
254157
|
+
res.status(400).json({
|
|
254158
|
+
detail: "A user with this email already exists",
|
|
254159
|
+
error_type: "HTTPException",
|
|
254160
|
+
message: "A user with this email already exists",
|
|
254161
|
+
request_id: null,
|
|
254162
|
+
traceback: ""
|
|
254163
|
+
});
|
|
254164
|
+
return;
|
|
254165
|
+
}
|
|
254166
|
+
const privateUserCollection = db2.getCollection(PRIVATE_USER_COLLECTION);
|
|
254167
|
+
const privateUserData = await privateUserCollection?.findOneAsync({
|
|
254168
|
+
email: email3
|
|
254169
|
+
});
|
|
254170
|
+
const otpCode = generateCode();
|
|
254171
|
+
const id2 = privateUserData ? privateUserData.id : nanoid3();
|
|
254172
|
+
if (!privateUserData) {
|
|
254173
|
+
await privateUserCollection?.insertAsync({
|
|
254174
|
+
id: id2,
|
|
254175
|
+
email: email3,
|
|
254176
|
+
otpCode,
|
|
254177
|
+
password,
|
|
254178
|
+
createdAt: Date.now()
|
|
254179
|
+
});
|
|
254180
|
+
} else {
|
|
254181
|
+
await privateUserCollection?.updateAsync({
|
|
254182
|
+
email: email3
|
|
254183
|
+
}, {
|
|
254184
|
+
$set: {
|
|
254185
|
+
otpCode,
|
|
254186
|
+
createdAt: Date.now()
|
|
254187
|
+
}
|
|
254188
|
+
});
|
|
254189
|
+
}
|
|
254190
|
+
logger2.log(theme.styles.info(`
|
|
254191
|
+
In order to complete registration use this verification code: ${otpCode}
|
|
254192
|
+
`));
|
|
254193
|
+
res.json({
|
|
254194
|
+
id: id2,
|
|
254195
|
+
message: "Registration successful. Please check your email for the verification code.",
|
|
254196
|
+
otp_expires_in_minutes: 10
|
|
254197
|
+
});
|
|
254198
|
+
});
|
|
254199
|
+
router.post("/verify-otp", parseBody, async (req, res) => {
|
|
254200
|
+
const { email: email3, otp_code } = VerifyOtpBody.parse(req.body);
|
|
254201
|
+
const privateUserCollection = db2.getCollection(PRIVATE_USER_COLLECTION);
|
|
254202
|
+
const privateUserData = await privateUserCollection?.findOneAsync({
|
|
254203
|
+
email: email3
|
|
254204
|
+
});
|
|
254205
|
+
if (!privateUserData || privateUserData.otpCode !== otp_code) {
|
|
254206
|
+
const appId = req.params.appId;
|
|
254207
|
+
res.status(500).json({
|
|
254208
|
+
detail: `{'email': '${email3}', 'app_id': '${appId}}'} -> Object not found`,
|
|
254209
|
+
error_type: "ObjectNotFoundError",
|
|
254210
|
+
message: `{'email': '${email3}', 'app_id': '${appId}}'} -> Object not found`,
|
|
254211
|
+
request_id: null,
|
|
254212
|
+
traceback: ""
|
|
254213
|
+
});
|
|
254214
|
+
return;
|
|
254215
|
+
}
|
|
254216
|
+
if (+Date.now() - privateUserData.createdAt > TEN_MINUTES) {
|
|
254217
|
+
res.status(400).json({
|
|
254218
|
+
detail: "Verification code has expired",
|
|
254219
|
+
error_type: "HTTPException",
|
|
254220
|
+
message: "Verification code has expired",
|
|
254221
|
+
request_id: null,
|
|
254222
|
+
traceback: ""
|
|
254223
|
+
});
|
|
254224
|
+
} else {
|
|
254225
|
+
await privateUserCollection?.updateAsync({
|
|
254226
|
+
email: email3
|
|
254227
|
+
}, {
|
|
254228
|
+
$unset: { otpCode: true }
|
|
254229
|
+
});
|
|
254230
|
+
const collection = db2.getCollection(USER_COLLECTION);
|
|
254231
|
+
const now = getNowISOTimestamp();
|
|
254232
|
+
const nameFromEmailMatch = /^([^@]+)/.exec(email3);
|
|
254233
|
+
const fullName = nameFromEmailMatch ? nameFromEmailMatch[1] : email3;
|
|
254234
|
+
await collection?.insertAsync({
|
|
254235
|
+
id: privateUserData.id,
|
|
254236
|
+
email: email3,
|
|
254237
|
+
full_name: fullName,
|
|
254238
|
+
is_service: false,
|
|
254239
|
+
is_verified: true,
|
|
254240
|
+
disabled: null,
|
|
254241
|
+
role: "user",
|
|
254242
|
+
collaborator_role: "editor",
|
|
254243
|
+
created_date: now,
|
|
254244
|
+
updated_date: now
|
|
254245
|
+
});
|
|
254246
|
+
res.json({
|
|
254247
|
+
id: privateUserData.id,
|
|
254248
|
+
access_token: createJwtToken(email3),
|
|
254249
|
+
message: "Email verified successfully. You are now logged in.",
|
|
254250
|
+
success: true
|
|
254251
|
+
});
|
|
254252
|
+
}
|
|
254253
|
+
});
|
|
254254
|
+
return router;
|
|
254255
|
+
}
|
|
254256
|
+
|
|
254257
|
+
// src/cli/dev/dev-server/routes/entities/entities-router.ts
|
|
254258
|
+
var import_express4 = __toESM(require_express(), 1);
|
|
254259
|
+
|
|
254260
|
+
// src/cli/dev/dev-server/db/entity-queries.ts
|
|
254261
|
+
function parseSort(sort) {
|
|
254262
|
+
if (!sort) {
|
|
254263
|
+
return;
|
|
254264
|
+
}
|
|
254265
|
+
if (sort.startsWith("-")) {
|
|
254266
|
+
return { [sort.slice(1)]: -1 };
|
|
254267
|
+
}
|
|
254268
|
+
return { [sort]: 1 };
|
|
254269
|
+
}
|
|
254270
|
+
function parseFields(fields) {
|
|
254271
|
+
if (!fields) {
|
|
254272
|
+
return;
|
|
254273
|
+
}
|
|
254274
|
+
const projection = {};
|
|
254275
|
+
for (const field of fields.split(",")) {
|
|
254276
|
+
const trimmed = field.trim();
|
|
254277
|
+
if (trimmed) {
|
|
254278
|
+
projection[trimmed] = 1;
|
|
254279
|
+
}
|
|
254280
|
+
}
|
|
254281
|
+
return Object.keys(projection).length > 0 ? projection : undefined;
|
|
254282
|
+
}
|
|
254283
|
+
var queryEntity = async (collection, reqQuery) => {
|
|
254284
|
+
const { sort, limit, skip: skip2, fields, q: q13 } = reqQuery;
|
|
254285
|
+
let query = {};
|
|
254286
|
+
if (q13 && typeof q13 === "string") {
|
|
254287
|
+
try {
|
|
254288
|
+
query = JSON.parse(q13);
|
|
254289
|
+
} catch {
|
|
254290
|
+
throw new InvalidInputError("Invalid query parameter 'q'");
|
|
254291
|
+
}
|
|
254292
|
+
}
|
|
254293
|
+
let cursor3 = collection.findAsync(query);
|
|
254294
|
+
const sortObj = parseSort(sort);
|
|
254295
|
+
if (sortObj) {
|
|
254296
|
+
cursor3 = cursor3.sort(sortObj);
|
|
254297
|
+
}
|
|
254298
|
+
if (skip2) {
|
|
254299
|
+
const skipNum = Number.parseInt(skip2, 10);
|
|
254300
|
+
if (!Number.isNaN(skipNum)) {
|
|
254301
|
+
cursor3 = cursor3.skip(skipNum);
|
|
254302
|
+
}
|
|
254303
|
+
}
|
|
254304
|
+
if (limit) {
|
|
254305
|
+
const limitNum = Number.parseInt(limit, 10);
|
|
254306
|
+
if (!Number.isNaN(limitNum)) {
|
|
254307
|
+
cursor3 = cursor3.limit(limitNum);
|
|
254308
|
+
}
|
|
254309
|
+
}
|
|
254310
|
+
const projection = parseFields(fields);
|
|
254311
|
+
if (projection) {
|
|
254312
|
+
cursor3 = cursor3.projection(projection);
|
|
254313
|
+
}
|
|
254314
|
+
return cursor3;
|
|
254315
|
+
};
|
|
254316
|
+
|
|
254317
|
+
// src/cli/dev/dev-server/routes/entities/entities-user-router.ts
|
|
254318
|
+
var import_express3 = __toESM(require_express(), 1);
|
|
254319
|
+
var import_jsonwebtoken2 = __toESM(require_jsonwebtoken(), 1);
|
|
254320
|
+
function createUserRouter(db2, logger2) {
|
|
254321
|
+
const router = import_express3.Router({ mergeParams: true });
|
|
254322
|
+
const parseBody = import_express3.json();
|
|
254088
254323
|
function withAuth(handler) {
|
|
254089
254324
|
return async (req, res) => {
|
|
254090
254325
|
const auth2 = req.headers.authorization;
|
|
@@ -254093,7 +254328,7 @@ function createUserRouter(db2, logger2) {
|
|
|
254093
254328
|
return;
|
|
254094
254329
|
}
|
|
254095
254330
|
try {
|
|
254096
|
-
const { payload } =
|
|
254331
|
+
const { payload } = import_jsonwebtoken2.default.decode(auth2.replace("Bearer ", ""), { complete: true }) ?? {};
|
|
254097
254332
|
const result = await db2.getCollection(USER_COLLECTION)?.findOneAsync({ email: payload?.sub });
|
|
254098
254333
|
if (!result) {
|
|
254099
254334
|
res.status(404).json({ error: "Unable to read data for the current user" });
|
|
@@ -254126,6 +254361,28 @@ function createUserRouter(db2, logger2) {
|
|
|
254126
254361
|
...req.body
|
|
254127
254362
|
});
|
|
254128
254363
|
}));
|
|
254364
|
+
router.get("/", withAuth(async (req, res, currentUser) => {
|
|
254365
|
+
const collection = db2.getCollection(USER_COLLECTION);
|
|
254366
|
+
if (!collection) {
|
|
254367
|
+
res.status(404).json({ error: `Entity "${USER_COLLECTION}" not found` });
|
|
254368
|
+
return;
|
|
254369
|
+
}
|
|
254370
|
+
try {
|
|
254371
|
+
if (currentUser.role === "admin") {
|
|
254372
|
+
const result = await queryEntity(collection, req.query);
|
|
254373
|
+
res.json(stripInternalFields(result));
|
|
254374
|
+
} else {
|
|
254375
|
+
res.json([stripInternalFields(currentUser)]);
|
|
254376
|
+
}
|
|
254377
|
+
} catch (error48) {
|
|
254378
|
+
if (error48 instanceof InvalidInputError) {
|
|
254379
|
+
res.status(400).json({ error: error48.message });
|
|
254380
|
+
} else {
|
|
254381
|
+
logger2.error(`Error in GET /${USER_COLLECTION}:`, error48);
|
|
254382
|
+
res.status(500).json({ error: "Internal server error" });
|
|
254383
|
+
}
|
|
254384
|
+
}
|
|
254385
|
+
}));
|
|
254129
254386
|
router.post("/bulk", async (_req, res) => {
|
|
254130
254387
|
res.json({});
|
|
254131
254388
|
});
|
|
@@ -254175,31 +254432,9 @@ function createUserRouter(db2, logger2) {
|
|
|
254175
254432
|
}
|
|
254176
254433
|
|
|
254177
254434
|
// 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
254435
|
async function createEntityRoutes(db2, logger2, broadcast) {
|
|
254201
|
-
const router =
|
|
254202
|
-
const parseBody =
|
|
254436
|
+
const router = import_express4.Router({ mergeParams: true });
|
|
254437
|
+
const parseBody = import_express4.json();
|
|
254203
254438
|
function withCollection(handler) {
|
|
254204
254439
|
return async (req, res) => {
|
|
254205
254440
|
const collection = db2.getCollection(req.params.entityName);
|
|
@@ -254244,42 +254479,14 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
254244
254479
|
router.get("/:entityName", withCollection(async (req, res, collection) => {
|
|
254245
254480
|
const { entityName } = req.params;
|
|
254246
254481
|
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));
|
|
254482
|
+
res.json(stripInternalFields(await queryEntity(collection, req.query)));
|
|
254280
254483
|
} catch (error48) {
|
|
254281
|
-
|
|
254282
|
-
|
|
254484
|
+
if (error48 instanceof InvalidInputError) {
|
|
254485
|
+
res.status(400).json({ error: error48.message });
|
|
254486
|
+
} else {
|
|
254487
|
+
logger2.error(`Error in GET /${entityName}:`, error48);
|
|
254488
|
+
res.status(500).json({ error: "Internal server error" });
|
|
254489
|
+
}
|
|
254283
254490
|
}
|
|
254284
254491
|
}));
|
|
254285
254492
|
router.post("/:entityName", parseBody, withCollection(async (req, res, collection) => {
|
|
@@ -254398,7 +254605,7 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
254398
254605
|
}
|
|
254399
254606
|
|
|
254400
254607
|
// src/cli/dev/dev-server/routes/integrations.ts
|
|
254401
|
-
var
|
|
254608
|
+
var import_express5 = __toESM(require_express(), 1);
|
|
254402
254609
|
var import_multer = __toESM(require_multer(), 1);
|
|
254403
254610
|
import { createHash, randomUUID as randomUUID4 } from "node:crypto";
|
|
254404
254611
|
import fs28 from "node:fs";
|
|
@@ -254407,8 +254614,8 @@ function createFileToken(fileUri) {
|
|
|
254407
254614
|
return createHash("sha256").update(fileUri).digest("hex");
|
|
254408
254615
|
}
|
|
254409
254616
|
function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger2) {
|
|
254410
|
-
const router =
|
|
254411
|
-
const parseBody =
|
|
254617
|
+
const router = import_express5.Router({ mergeParams: true });
|
|
254618
|
+
const parseBody = import_express5.json();
|
|
254412
254619
|
const privateFilesDir = path18.join(mediaFilesDir, "private");
|
|
254413
254620
|
fs28.mkdirSync(mediaFilesDir, { recursive: true });
|
|
254414
254621
|
fs28.mkdirSync(privateFilesDir, { recursive: true });
|
|
@@ -254478,7 +254685,7 @@ function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger2) {
|
|
|
254478
254685
|
return router;
|
|
254479
254686
|
}
|
|
254480
254687
|
function createCustomIntegrationRoutes(remoteProxy, logger2) {
|
|
254481
|
-
const router =
|
|
254688
|
+
const router = import_express5.Router({ mergeParams: true });
|
|
254482
254689
|
router.post("/:slug/:operationId", (req, res, next) => {
|
|
254483
254690
|
logger2.warn(`"${req.originalUrl}" is not supported in local development, passing call to production`);
|
|
254484
254691
|
req.url = req.originalUrl;
|
|
@@ -255337,7 +255544,7 @@ class NodeFsHandler {
|
|
|
255337
255544
|
this._addToNodeFs(path19, initialAdd, wh2, depth + 1);
|
|
255338
255545
|
}
|
|
255339
255546
|
}).on(EV.ERROR, this._boundHandleError);
|
|
255340
|
-
return new Promise((
|
|
255547
|
+
return new Promise((resolve9, reject) => {
|
|
255341
255548
|
if (!stream)
|
|
255342
255549
|
return reject();
|
|
255343
255550
|
stream.once(STR_END, () => {
|
|
@@ -255346,7 +255553,7 @@ class NodeFsHandler {
|
|
|
255346
255553
|
return;
|
|
255347
255554
|
}
|
|
255348
255555
|
const wasThrottled = throttler ? throttler.clear() : false;
|
|
255349
|
-
|
|
255556
|
+
resolve9(undefined);
|
|
255350
255557
|
previous.getChildren().filter((item) => {
|
|
255351
255558
|
return item !== directory && !current.has(item);
|
|
255352
255559
|
}).forEach((item) => {
|
|
@@ -256191,7 +256398,7 @@ async function createDevServer(options8) {
|
|
|
256191
256398
|
const port = userPort ?? await getPorts({ port: DEFAULT_PORT });
|
|
256192
256399
|
const baseUrl = `http://localhost:${port}`;
|
|
256193
256400
|
const { functions, entities, project: project2 } = await options8.loadResources();
|
|
256194
|
-
const app =
|
|
256401
|
+
const app = import_express6.default();
|
|
256195
256402
|
const remoteProxy = import_http_proxy_middleware2.createProxyMiddleware({
|
|
256196
256403
|
target: BASE44_APP_URL,
|
|
256197
256404
|
changeOrigin: true
|
|
@@ -256223,6 +256430,8 @@ async function createDevServer(options8) {
|
|
|
256223
256430
|
let emitEntityEvent = () => {};
|
|
256224
256431
|
const entityRoutes = await createEntityRoutes(db2, devLogger, (...args) => emitEntityEvent(...args));
|
|
256225
256432
|
app.use("/api/apps/:appId/entities", entityRoutes);
|
|
256433
|
+
const authRouter = createAuthRouter(db2, devLogger);
|
|
256434
|
+
app.use("/api/apps/:appId/auth", authRouter);
|
|
256226
256435
|
const { path: mediaFilesDir } = await $dir();
|
|
256227
256436
|
app.use("/media/private/:fileUri", (req, res, next) => {
|
|
256228
256437
|
const { fileUri } = req.params;
|
|
@@ -256242,16 +256451,18 @@ async function createDevServer(options8) {
|
|
|
256242
256451
|
}
|
|
256243
256452
|
next();
|
|
256244
256453
|
});
|
|
256245
|
-
app.use("/media",
|
|
256454
|
+
app.use("/media", import_express6.default.static(mediaFilesDir));
|
|
256246
256455
|
const integrationRoutes = createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, devLogger);
|
|
256247
256456
|
app.use("/api/apps/:appId/integration-endpoints", integrationRoutes);
|
|
256248
256457
|
const customIntegrationRoutes = createCustomIntegrationRoutes(remoteProxy, devLogger);
|
|
256249
256458
|
app.use("/api/apps/:appId/integrations/custom", customIntegrationRoutes);
|
|
256250
256459
|
app.use((req, res, next) => {
|
|
256251
|
-
|
|
256460
|
+
if (!req.originalUrl.endsWith("analytics/track/batch")) {
|
|
256461
|
+
devLogger.warn(`"${req.originalUrl}" is not supported in local development, passing call to production`);
|
|
256462
|
+
}
|
|
256252
256463
|
remoteProxy(req, res, next);
|
|
256253
256464
|
});
|
|
256254
|
-
const server = await new Promise((
|
|
256465
|
+
const server = await new Promise((resolve10, reject) => {
|
|
256255
256466
|
const s5 = app.listen(port, "127.0.0.1", (err) => {
|
|
256256
256467
|
if (err) {
|
|
256257
256468
|
if ("code" in err && err.code === "EADDRINUSE") {
|
|
@@ -256260,7 +256471,7 @@ async function createDevServer(options8) {
|
|
|
256260
256471
|
reject(err);
|
|
256261
256472
|
}
|
|
256262
256473
|
} else {
|
|
256263
|
-
|
|
256474
|
+
resolve10(s5);
|
|
256264
256475
|
}
|
|
256265
256476
|
});
|
|
256266
256477
|
});
|
|
@@ -256319,6 +256530,7 @@ async function devAction({ log }, options8) {
|
|
|
256319
256530
|
const { port: resolvedPort } = await createDevServer({
|
|
256320
256531
|
log,
|
|
256321
256532
|
port,
|
|
256533
|
+
cwd: process21.cwd(),
|
|
256322
256534
|
denoWrapperPath: getDenoWrapperPath(),
|
|
256323
256535
|
loadResources: async () => {
|
|
256324
256536
|
const { functions, entities, project: project2 } = await readProjectConfig();
|
|
@@ -256376,13 +256588,13 @@ async function runScript(options8) {
|
|
|
256376
256588
|
}
|
|
256377
256589
|
// src/cli/commands/exec.ts
|
|
256378
256590
|
function readStdin2() {
|
|
256379
|
-
return new Promise((
|
|
256591
|
+
return new Promise((resolve10, reject) => {
|
|
256380
256592
|
let data = "";
|
|
256381
256593
|
process.stdin.setEncoding("utf-8");
|
|
256382
256594
|
process.stdin.on("data", (chunk) => {
|
|
256383
256595
|
data += chunk;
|
|
256384
256596
|
});
|
|
256385
|
-
process.stdin.on("end", () =>
|
|
256597
|
+
process.stdin.on("end", () => resolve10(data));
|
|
256386
256598
|
process.stdin.on("error", reject);
|
|
256387
256599
|
});
|
|
256388
256600
|
}
|
|
@@ -256421,7 +256633,7 @@ Examples:
|
|
|
256421
256633
|
}
|
|
256422
256634
|
|
|
256423
256635
|
// src/cli/commands/project/eject.ts
|
|
256424
|
-
import { resolve as
|
|
256636
|
+
import { resolve as resolve10 } from "node:path";
|
|
256425
256637
|
var import_kebabCase2 = __toESM(require_kebabCase(), 1);
|
|
256426
256638
|
async function eject(ctx, options8) {
|
|
256427
256639
|
const { log, runTask: runTask2, isNonInteractive } = ctx;
|
|
@@ -256477,7 +256689,7 @@ async function eject(ctx, options8) {
|
|
|
256477
256689
|
Ne("Operation cancelled.");
|
|
256478
256690
|
throw new CLIExitError(0);
|
|
256479
256691
|
}
|
|
256480
|
-
const resolvedPath =
|
|
256692
|
+
const resolvedPath = resolve10(selectedPath);
|
|
256481
256693
|
await runTask2("Downloading your project's code...", async (updateMessage) => {
|
|
256482
256694
|
await createProjectFilesForExistingProject({
|
|
256483
256695
|
projectId,
|
|
@@ -258845,14 +259057,14 @@ async function addSourceContext(frames) {
|
|
|
258845
259057
|
return frames;
|
|
258846
259058
|
}
|
|
258847
259059
|
function getContextLinesFromFile(path19, ranges, output) {
|
|
258848
|
-
return new Promise((
|
|
259060
|
+
return new Promise((resolve11) => {
|
|
258849
259061
|
const stream = createReadStream2(path19);
|
|
258850
259062
|
const lineReaded = createInterface2({
|
|
258851
259063
|
input: stream
|
|
258852
259064
|
});
|
|
258853
259065
|
function destroyStreamAndResolve() {
|
|
258854
259066
|
stream.destroy();
|
|
258855
|
-
|
|
259067
|
+
resolve11();
|
|
258856
259068
|
}
|
|
258857
259069
|
let lineNumber = 0;
|
|
258858
259070
|
let currentRangeIndex = 0;
|
|
@@ -259964,15 +260176,15 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
259964
260176
|
return true;
|
|
259965
260177
|
if (this.featureFlagsPoller === undefined)
|
|
259966
260178
|
return false;
|
|
259967
|
-
return new Promise((
|
|
260179
|
+
return new Promise((resolve11) => {
|
|
259968
260180
|
const timeout3 = setTimeout(() => {
|
|
259969
260181
|
cleanup();
|
|
259970
|
-
|
|
260182
|
+
resolve11(false);
|
|
259971
260183
|
}, timeoutMs);
|
|
259972
260184
|
const cleanup = this._events.on("localEvaluationFlagsLoaded", (count2) => {
|
|
259973
260185
|
clearTimeout(timeout3);
|
|
259974
260186
|
cleanup();
|
|
259975
|
-
|
|
260187
|
+
resolve11(count2 > 0);
|
|
259976
260188
|
});
|
|
259977
260189
|
});
|
|
259978
260190
|
}
|
|
@@ -260795,4 +261007,4 @@ export {
|
|
|
260795
261007
|
CLIExitError
|
|
260796
261008
|
};
|
|
260797
261009
|
|
|
260798
|
-
//# debugId=
|
|
261010
|
+
//# debugId=727C6F0A9BEC4E8764756E2164756E21
|