asaihost-nodejs 0.0.3 → 0.0.5
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/asaihost-nodejs.cjs
CHANGED
|
@@ -2551,6 +2551,10 @@ function readRequestBody(req, maxBody) {
|
|
|
2551
2551
|
});
|
|
2552
2552
|
}
|
|
2553
2553
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, readRequestBody, "readRequestBody");
|
|
2554
|
+
function isRawUploadPost(url = "") {
|
|
2555
|
+
return /\/api\/asaifile\/manage\/up(?:base64|binary)(?:batch)?\//.test(url);
|
|
2556
|
+
}
|
|
2557
|
+
_chunkSMVZ3ZDJcjs.__name.call(void 0, isRawUploadPost, "isRawUploadPost");
|
|
2554
2558
|
function processPostPayload($asai, req, postdata, pm) {
|
|
2555
2559
|
let isAes = false;
|
|
2556
2560
|
let out = postdata;
|
|
@@ -2566,7 +2570,7 @@ function processPostPayload($asai, req, postdata, pm) {
|
|
|
2566
2570
|
}
|
|
2567
2571
|
}
|
|
2568
2572
|
const plainJson = typeof out === "string" && out.trimStart().startsWith("{");
|
|
2569
|
-
if (_optionalChain([req, 'optionalAccess', _280 => _280.Userinfo, 'optionalAccess', _281 => _281[2]]) && !plainJson) {
|
|
2573
|
+
if (_optionalChain([req, 'optionalAccess', _280 => _280.Userinfo, 'optionalAccess', _281 => _281[2]]) && !plainJson && !isRawUploadPost(_optionalChain([req, 'optionalAccess', _282 => _282.url]))) {
|
|
2570
2574
|
pm = req.Userinfo[2];
|
|
2571
2575
|
out = $asai.$lib.AsCode.asdecode(out, pm);
|
|
2572
2576
|
}
|
|
@@ -2574,7 +2578,7 @@ function processPostPayload($asai, req, postdata, pm) {
|
|
|
2574
2578
|
}
|
|
2575
2579
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, processPostPayload, "processPostPayload");
|
|
2576
2580
|
var Api_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai, opt = {}) => {
|
|
2577
|
-
_optionalChain([opt, 'optionalAccess',
|
|
2581
|
+
_optionalChain([opt, 'optionalAccess', _283 => _283.fn, 'optionalCall', _284 => _284($asai)]);
|
|
2578
2582
|
function getHeader(req, key) {
|
|
2579
2583
|
return req.headers[key.toLowerCase()] || "";
|
|
2580
2584
|
}
|
|
@@ -2583,7 +2587,7 @@ var Api_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai,
|
|
|
2583
2587
|
let apiRouteCacheLen = -1;
|
|
2584
2588
|
function findApiHandler($asai2, pathname) {
|
|
2585
2589
|
const apis = $asai2.hostserverapis;
|
|
2586
|
-
if (!_optionalChain([apis, 'optionalAccess',
|
|
2590
|
+
if (!_optionalChain([apis, 'optionalAccess', _285 => _285.length])) return void 0;
|
|
2587
2591
|
if (!apiRouteCache || apiRouteCacheLen !== apis.length) {
|
|
2588
2592
|
apiRouteCache = apis.map((elp) => ({ key: elp, path: `/api/${elp}` }));
|
|
2589
2593
|
apiRouteCacheLen = apis.length;
|
|
@@ -2631,9 +2635,9 @@ var Api_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai,
|
|
|
2631
2635
|
pm: decodeURIComponent(urlParse.search.substring(4))
|
|
2632
2636
|
};
|
|
2633
2637
|
if (req.url.indexOf("binary") === -1) {
|
|
2634
|
-
if (_optionalChain([req, 'optionalAccess',
|
|
2638
|
+
if (_optionalChain([req, 'optionalAccess', _286 => _286.Userinfo]) && _optionalChain([req, 'optionalAccess', _287 => _287.Userinfo, 'access', _288 => _288[2]]) && _optionalChain([query, 'optionalAccess', _289 => _289.pm])) {
|
|
2635
2639
|
pm = req.Userinfo[2];
|
|
2636
|
-
query = $asai.$lib.AsCode.asdecode(_optionalChain([query, 'optionalAccess',
|
|
2640
|
+
query = $asai.$lib.AsCode.asdecode(_optionalChain([query, 'optionalAccess', _290 => _290.pm]), pm);
|
|
2637
2641
|
query = Object.fromEntries(new URLSearchParams("?" + query).entries());
|
|
2638
2642
|
}
|
|
2639
2643
|
}
|
|
@@ -2652,7 +2656,7 @@ var Api_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai,
|
|
|
2652
2656
|
const releaseSlot = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, () => releaseApiSlot(hostdir, clientIp), "releaseSlot");
|
|
2653
2657
|
res.once("finish", releaseSlot);
|
|
2654
2658
|
res.once("close", releaseSlot);
|
|
2655
|
-
const maxBody = _optionalChain([$asai, 'access',
|
|
2659
|
+
const maxBody = _optionalChain([$asai, 'access', _291 => _291.hostconfig, 'optionalAccess', _292 => _292.maxbody]) || 100 * 1024 * 1024;
|
|
2656
2660
|
const isTextPost = req.method === "POST" && req.url.indexOf("binary") === -1;
|
|
2657
2661
|
const bodyPromise = isTextPost ? readRequestBody(req, maxBody) : null;
|
|
2658
2662
|
void (async () => {
|
|
@@ -2665,16 +2669,16 @@ var Api_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai,
|
|
|
2665
2669
|
]);
|
|
2666
2670
|
} catch (err) {
|
|
2667
2671
|
releaseSlot();
|
|
2668
|
-
if (_optionalChain([err, 'optionalAccess',
|
|
2672
|
+
if (_optionalChain([err, 'optionalAccess', _293 => _293.message]) === "PAYLOAD_TOO_LARGE") {
|
|
2669
2673
|
return sendError(res, 413, "Payload Too Large");
|
|
2670
2674
|
}
|
|
2671
|
-
return sendError(res, 400, _optionalChain([err, 'optionalAccess',
|
|
2675
|
+
return sendError(res, 400, _optionalChain([err, 'optionalAccess', _294 => _294.message]) || "Bad Request");
|
|
2672
2676
|
}
|
|
2673
2677
|
if (!authResult.ok) {
|
|
2674
2678
|
releaseSlot();
|
|
2675
2679
|
return sendAuthError(res, authResult);
|
|
2676
2680
|
}
|
|
2677
|
-
let apiFn = _optionalChain([$asai, 'access',
|
|
2681
|
+
let apiFn = _optionalChain([$asai, 'access', _295 => _295.hostserverapi, 'access', _296 => _296[apiHandlerKey], 'optionalCall', _297 => _297($asai, query)]);
|
|
2678
2682
|
if (!apiFn) {
|
|
2679
2683
|
return sendError(res, 501, "Not Implemented");
|
|
2680
2684
|
}
|
|
@@ -2693,20 +2697,20 @@ var Api_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai,
|
|
|
2693
2697
|
} catch (e35) {
|
|
2694
2698
|
return sendError(res, 400, "AES decrypt failed");
|
|
2695
2699
|
}
|
|
2696
|
-
if (_optionalChain([apiFn, 'optionalAccess',
|
|
2700
|
+
if (_optionalChain([apiFn, 'optionalAccess', _298 => _298.post]) && typeof _optionalChain([apiFn, 'optionalAccess', _299 => _299.post]) === "function") {
|
|
2697
2701
|
const optTmp = { qrdata, data: postdata, pm };
|
|
2698
|
-
if (isAes || _optionalChain([$asai, 'access',
|
|
2699
|
-
optTmp.resAES = _optionalChain([$asai, 'access',
|
|
2702
|
+
if (isAes || _optionalChain([$asai, 'access', _300 => _300.$lib, 'access', _301 => _301.aesfns, 'optionalAccess', _302 => _302.allaes])) {
|
|
2703
|
+
optTmp.resAES = _optionalChain([$asai, 'access', _303 => _303.$lib, 'access', _304 => _304.aesfns, 'optionalAccess', _305 => _305.resAES]);
|
|
2700
2704
|
}
|
|
2701
2705
|
apiFn.post(req, res, hostdir, optTmp);
|
|
2702
2706
|
} else {
|
|
2703
2707
|
res.end(typeof postdata === "string" ? postdata : JSON.stringify(_nullishCoalesce(postdata, () => ( ""))));
|
|
2704
2708
|
}
|
|
2705
2709
|
} else if (req.method === "GET") {
|
|
2706
|
-
if (_optionalChain([apiFn, 'optionalAccess',
|
|
2710
|
+
if (_optionalChain([apiFn, 'optionalAccess', _306 => _306.get]) && typeof _optionalChain([apiFn, 'optionalAccess', _307 => _307.get]) === "function") {
|
|
2707
2711
|
const optTmp = { qrdata, data: qrdata, pm };
|
|
2708
|
-
if (isAes || _optionalChain([$asai, 'access',
|
|
2709
|
-
optTmp.resAES = _optionalChain([$asai, 'access',
|
|
2712
|
+
if (isAes || _optionalChain([$asai, 'access', _308 => _308.$lib, 'access', _309 => _309.aesfns, 'optionalAccess', _310 => _310.allaes])) {
|
|
2713
|
+
optTmp.resAES = _optionalChain([$asai, 'access', _311 => _311.$lib, 'access', _312 => _312.aesfns, 'optionalAccess', _313 => _313.resAES]);
|
|
2710
2714
|
}
|
|
2711
2715
|
apiFn.get(req, res, hostdir, optTmp);
|
|
2712
2716
|
} else {
|
|
@@ -2714,12 +2718,12 @@ var Api_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai,
|
|
|
2714
2718
|
}
|
|
2715
2719
|
}
|
|
2716
2720
|
} else {
|
|
2717
|
-
if (_optionalChain([Object, 'access',
|
|
2721
|
+
if (_optionalChain([Object, 'access', _314 => _314.keys, 'call', _315 => _315(query), 'optionalAccess', _316 => _316.length])) {
|
|
2718
2722
|
qrdata = query;
|
|
2719
2723
|
}
|
|
2720
2724
|
if (req.method === "POST") {
|
|
2721
2725
|
$asai.$lib.AsNodeTool.upBinary(req).then((postdata2) => {
|
|
2722
|
-
if (_optionalChain([apiFn, 'optionalAccess',
|
|
2726
|
+
if (_optionalChain([apiFn, 'optionalAccess', _317 => _317.post]) && typeof _optionalChain([apiFn, 'optionalAccess', _318 => _318.post]) === "function") {
|
|
2723
2727
|
apiFn.post(req, res, hostdir, {
|
|
2724
2728
|
qrdata,
|
|
2725
2729
|
data: postdata2
|
|
@@ -2743,12 +2747,12 @@ var Api_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai,
|
|
|
2743
2747
|
|
|
2744
2748
|
// src/common/server/Ws.ts
|
|
2745
2749
|
var Ws_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai, opt = {}) => {
|
|
2746
|
-
_optionalChain([opt, 'optionalAccess',
|
|
2750
|
+
_optionalChain([opt, 'optionalAccess', _319 => _319.fn, 'optionalCall', _320 => _320($asai)]);
|
|
2747
2751
|
const wsHandlerCache = /* @__PURE__ */ new Map();
|
|
2748
2752
|
const routeIndex = ensureWsRouteIndex($asai);
|
|
2749
2753
|
function getWsHandler(handlerKey) {
|
|
2750
2754
|
if (!wsHandlerCache.has(handlerKey)) {
|
|
2751
|
-
wsHandlerCache.set(handlerKey, _optionalChain([$asai, 'access',
|
|
2755
|
+
wsHandlerCache.set(handlerKey, _optionalChain([$asai, 'access', _321 => _321.hostserverws, 'access', _322 => _322[handlerKey], 'optionalCall', _323 => _323($asai)]));
|
|
2752
2756
|
}
|
|
2753
2757
|
return wsHandlerCache.get(handlerKey);
|
|
2754
2758
|
}
|
|
@@ -2772,21 +2776,21 @@ var Ws_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai, o
|
|
|
2772
2776
|
let reqdata = parseMessage(msg);
|
|
2773
2777
|
let handlerKey;
|
|
2774
2778
|
if (reqdata === "ping") {
|
|
2775
|
-
_optionalChain([ws2, 'access',
|
|
2779
|
+
_optionalChain([ws2, 'access', _324 => _324.send, 'optionalCall', _325 => _325("pong")]);
|
|
2776
2780
|
return;
|
|
2777
2781
|
} else {
|
|
2778
2782
|
const reqdataisobj = typeof reqdata === "object" && reqdata !== null;
|
|
2779
|
-
handlerKey = reqdataisobj ? routeIndex.matchTy(_optionalChain([reqdata, 'optionalAccess',
|
|
2780
|
-
if (!handlerKey && _optionalChain([$asai, 'access',
|
|
2783
|
+
handlerKey = reqdataisobj ? routeIndex.matchTy(_optionalChain([reqdata, 'optionalAccess', _326 => _326.ty])) : routeIndex.matchString(reqdata);
|
|
2784
|
+
if (!handlerKey && _optionalChain([$asai, 'access', _327 => _327.hostserverwss, 'optionalAccess', _328 => _328.length])) {
|
|
2781
2785
|
handlerKey = $asai.hostserverwss.find((elp) => {
|
|
2782
2786
|
if (reqdataisobj) {
|
|
2783
|
-
return _optionalChain([reqdata, 'optionalAccess',
|
|
2787
|
+
return _optionalChain([reqdata, 'optionalAccess', _329 => _329.ty, 'optionalAccess', _330 => _330.startsWith, 'call', _331 => _331(elp)]);
|
|
2784
2788
|
}
|
|
2785
2789
|
return typeof reqdata === "string" && reqdata.startsWith(elp);
|
|
2786
2790
|
});
|
|
2787
2791
|
}
|
|
2788
2792
|
if (!handlerKey) {
|
|
2789
|
-
_optionalChain([$asai, 'access',
|
|
2793
|
+
_optionalChain([$asai, 'access', _332 => _332.asaimock, 'optionalAccess', _333 => _333.wsWorkMock, 'call', _334 => _334({
|
|
2790
2794
|
msg,
|
|
2791
2795
|
ws: ws2,
|
|
2792
2796
|
hostdir,
|
|
@@ -2798,14 +2802,14 @@ var Ws_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai, o
|
|
|
2798
2802
|
}
|
|
2799
2803
|
}
|
|
2800
2804
|
if (!handlerKey) return;
|
|
2801
|
-
_optionalChain([getWsHandler, 'call',
|
|
2805
|
+
_optionalChain([getWsHandler, 'call', _335 => _335(handlerKey), 'optionalAccess', _336 => _336.work, 'optionalCall', _337 => _337(reqdata, ws2, hostdir, req)]);
|
|
2802
2806
|
} catch (err) {
|
|
2803
|
-
_optionalChain([($asai.$log || console.error), 'optionalCall',
|
|
2807
|
+
_optionalChain([($asai.$log || console.error), 'optionalCall', _338 => _338("WS", "handler error", err instanceof Error ? err.message : err)]);
|
|
2804
2808
|
}
|
|
2805
2809
|
}
|
|
2806
2810
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, wsWork, "wsWork");
|
|
2807
2811
|
function _getMessage(msg) {
|
|
2808
|
-
if (_optionalChain([msg, 'optionalAccess',
|
|
2812
|
+
if (_optionalChain([msg, 'optionalAccess', _339 => _339.db, 'optionalAccess', _340 => _340.aes]) && _optionalChain([$asai, 'access', _341 => _341.$lib, 'optionalAccess', _342 => _342.aesfns, 'optionalAccess', _343 => _343.reqAES])) {
|
|
2809
2813
|
msg.db = $asai.$lib.aesfns.reqAES({ data: msg.db });
|
|
2810
2814
|
}
|
|
2811
2815
|
return msg;
|
|
@@ -2832,12 +2836,12 @@ var Ws_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai, o
|
|
|
2832
2836
|
|
|
2833
2837
|
// src/common/server/Sys.ts
|
|
2834
2838
|
var Sys_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai, opt = {}) => {
|
|
2835
|
-
_optionalChain([opt, 'optionalAccess',
|
|
2839
|
+
_optionalChain([opt, 'optionalAccess', _344 => _344.fn, 'optionalCall', _345 => _345($asai)]);
|
|
2836
2840
|
let sysRouteCache = null;
|
|
2837
2841
|
let sysRouteCacheLen = -1;
|
|
2838
2842
|
function findSystemHandler(req) {
|
|
2839
2843
|
const routes = $asai.hostserversyss;
|
|
2840
|
-
if (!_optionalChain([routes, 'optionalAccess',
|
|
2844
|
+
if (!_optionalChain([routes, 'optionalAccess', _346 => _346.length])) return void 0;
|
|
2841
2845
|
if (!sysRouteCache || sysRouteCacheLen !== routes.length) {
|
|
2842
2846
|
sysRouteCache = routes.map((elp) => ({ key: elp, route: `/${elp}` }));
|
|
2843
2847
|
sysRouteCacheLen = routes.length;
|
|
@@ -2870,11 +2874,11 @@ var Sys_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai,
|
|
|
2870
2874
|
if (!authResult.ok) {
|
|
2871
2875
|
return sendAuthError(res, authResult);
|
|
2872
2876
|
}
|
|
2873
|
-
const handler = _optionalChain([$asai, 'access',
|
|
2877
|
+
const handler = _optionalChain([$asai, 'access', _347 => _347.hostserversys, 'access', _348 => _348[handlerKey], 'optionalCall', _349 => _349($asai)]);
|
|
2874
2878
|
if (!handler) {
|
|
2875
2879
|
return sendError(res, 500, "Handler Initialization Failed");
|
|
2876
2880
|
}
|
|
2877
|
-
if (_optionalChain([handler, 'optionalAccess',
|
|
2881
|
+
if (_optionalChain([handler, 'optionalAccess', _350 => _350.show]) && typeof _optionalChain([handler, 'optionalAccess', _351 => _351.show]) === "function") {
|
|
2878
2882
|
handler.show(req, res, hostdir);
|
|
2879
2883
|
} else {
|
|
2880
2884
|
res.end("postdata");
|
|
@@ -2894,14 +2898,14 @@ var Sys_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai,
|
|
|
2894
2898
|
|
|
2895
2899
|
// src/common/server/WsClient.ts
|
|
2896
2900
|
var WsClient_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai, wsname) => {
|
|
2897
|
-
if (!_optionalChain([$asai, 'optionalAccess',
|
|
2901
|
+
if (!_optionalChain([$asai, 'optionalAccess', _352 => _352.clientws])) {
|
|
2898
2902
|
$asai.clientws = {};
|
|
2899
2903
|
}
|
|
2900
2904
|
if (!$asai.clientws[wsname]) {
|
|
2901
2905
|
$asai.clientws[wsname] = { tasks: /* @__PURE__ */ new Map() };
|
|
2902
2906
|
}
|
|
2903
2907
|
function getKeyByData(msgdata) {
|
|
2904
|
-
return _optionalChain([msgdata, 'optionalAccess',
|
|
2908
|
+
return _optionalChain([msgdata, 'optionalAccess', _353 => _353.id]) || _optionalChain([msgdata, 'optionalAccess', _354 => _354.ty]);
|
|
2905
2909
|
}
|
|
2906
2910
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, getKeyByData, "getKeyByData");
|
|
2907
2911
|
function clientwsInit() {
|
|
@@ -2914,7 +2918,7 @@ var WsClient_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($a
|
|
|
2914
2918
|
};
|
|
2915
2919
|
$asai.clientws[wsname].socket.on("error", (err) => {
|
|
2916
2920
|
$asai.clientws[wsname].open = 0;
|
|
2917
|
-
_optionalChain([$asai, 'access',
|
|
2921
|
+
_optionalChain([$asai, 'access', _355 => _355.hostconfig, 'access', _356 => _356.logger, 'optionalAccess', _357 => _357.lv, 'optionalAccess', _358 => _358.view]) && console.error(
|
|
2918
2922
|
666.2203,
|
|
2919
2923
|
`${wsname}=${$asai.command.commandconfig.clientws[wsname]} is error.`,
|
|
2920
2924
|
err
|
|
@@ -2923,14 +2927,14 @@ var WsClient_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($a
|
|
|
2923
2927
|
});
|
|
2924
2928
|
$asai.clientws[wsname].socket.on("close", () => {
|
|
2925
2929
|
$asai.clientws[wsname].open = 0;
|
|
2926
|
-
_optionalChain([$asai, 'access',
|
|
2930
|
+
_optionalChain([$asai, 'access', _359 => _359.hostconfig, 'access', _360 => _360.logger, 'optionalAccess', _361 => _361.lv, 'optionalAccess', _362 => _362.view]) && console.error(
|
|
2927
2931
|
666.2205,
|
|
2928
2932
|
`${wsname}=${$asai.command.commandconfig.clientws[wsname]} is close.`
|
|
2929
2933
|
);
|
|
2930
2934
|
reject();
|
|
2931
2935
|
});
|
|
2932
2936
|
$asai.clientws[wsname].socket.onopen = () => {
|
|
2933
|
-
_optionalChain([$asai, 'access',
|
|
2937
|
+
_optionalChain([$asai, 'access', _363 => _363.hostconfig, 'access', _364 => _364.logger, 'optionalAccess', _365 => _365.lv, 'optionalAccess', _366 => _366.view]) && console.log(
|
|
2934
2938
|
666.2201,
|
|
2935
2939
|
`${wsname}=${$asai.command.commandconfig.clientws[wsname]} is open.`
|
|
2936
2940
|
);
|
|
@@ -2953,7 +2957,7 @@ var WsClient_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($a
|
|
|
2953
2957
|
const key = getKeyByData(messageData);
|
|
2954
2958
|
const task = $asai.clientws[wsname].tasks.get(key);
|
|
2955
2959
|
if (task) {
|
|
2956
|
-
_optionalChain([task, 'optionalAccess',
|
|
2960
|
+
_optionalChain([task, 'optionalAccess', _367 => _367.callback, 'call', _368 => _368(messageData)]);
|
|
2957
2961
|
if (messageData.ty && !messageData.id) {
|
|
2958
2962
|
} else {
|
|
2959
2963
|
$asai.clientws[wsname].tasks.delete(key);
|
|
@@ -3007,7 +3011,7 @@ var WsClient_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($a
|
|
|
3007
3011
|
}
|
|
3008
3012
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, clientwsWatch, "clientwsWatch");
|
|
3009
3013
|
function clientwsWatchOff(messageData) {
|
|
3010
|
-
if (_optionalChain([messageData, 'optionalAccess',
|
|
3014
|
+
if (_optionalChain([messageData, 'optionalAccess', _369 => _369.ty]) === "clear") {
|
|
3011
3015
|
$asai.clientws[wsname].tasks = /* @__PURE__ */ new Map();
|
|
3012
3016
|
} else {
|
|
3013
3017
|
const key = getKeyByData(messageData);
|
|
@@ -3048,7 +3052,7 @@ var ping_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai)
|
|
|
3048
3052
|
var web_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai) => {
|
|
3049
3053
|
function chatBoard(msgdata, ws2, hostdir, req) {
|
|
3050
3054
|
let room;
|
|
3051
|
-
if (_optionalChain([msgdata, 'access',
|
|
3055
|
+
if (_optionalChain([msgdata, 'access', _370 => _370.db, 'optionalAccess', _371 => _371.room]) && typeof msgdata.db.room === "string") {
|
|
3052
3056
|
room = msgdata.db.room;
|
|
3053
3057
|
delete msgdata.db.room;
|
|
3054
3058
|
} else {
|
|
@@ -3105,26 +3109,26 @@ var logmanage_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($
|
|
|
3105
3109
|
removeFile: removeFile2,
|
|
3106
3110
|
resolvePathUnderBase: resolvePathUnderBase2
|
|
3107
3111
|
} = $asai.$lib.AsFs;
|
|
3108
|
-
const { sendSuccess, sendFail, mnLog } = _optionalChain([$asai, 'access',
|
|
3112
|
+
const { sendSuccess, sendFail, mnLog } = _optionalChain([$asai, 'access', _372 => _372.$lib, 'optionalAccess', _373 => _373.reqWork, 'optionalCall', _374 => _374($asai)]);
|
|
3109
3113
|
function mgLog(...arg) {
|
|
3110
3114
|
mnLog("LOG", ...arg);
|
|
3111
3115
|
}
|
|
3112
3116
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, mgLog, "mgLog");
|
|
3113
3117
|
function getDir(opt) {
|
|
3114
|
-
let tmpDir = _optionalChain([opt, 'access',
|
|
3118
|
+
let tmpDir = _optionalChain([opt, 'access', _375 => _375.qrdata, 'optionalAccess', _376 => _376.dir]) || _optionalChain([opt, 'access', _377 => _377.data, 'optionalAccess', _378 => _378.dir]);
|
|
3115
3119
|
if (tmpDir) {
|
|
3116
3120
|
tmpDir = decodeURIComponent(tmpDir);
|
|
3117
3121
|
} else {
|
|
3118
|
-
tmpDir = _optionalChain([opt, 'access',
|
|
3122
|
+
tmpDir = _optionalChain([opt, 'access', _379 => _379.qrdata, 'optionalAccess', _380 => _380.ty]) || _optionalChain([opt, 'access', _381 => _381.data, 'optionalAccess', _382 => _382.ty]);
|
|
3119
3123
|
if (tmpDir) {
|
|
3120
3124
|
tmpDir = decodeURIComponent(tmpDir);
|
|
3121
3125
|
if (tmpDir === "access-clf" || tmpDir === "access-w3c") {
|
|
3122
|
-
tmpDir = _optionalChain([$asai, 'access',
|
|
3126
|
+
tmpDir = _optionalChain([$asai, 'access', _383 => _383.hostconfig, 'access', _384 => _384.logger, 'optionalAccess', _385 => _385.path, 'optionalAccess', _386 => _386.access]) || "";
|
|
3123
3127
|
} else {
|
|
3124
|
-
tmpDir = _optionalChain([$asai, 'access',
|
|
3128
|
+
tmpDir = _optionalChain([$asai, 'access', _387 => _387.hostconfig, 'access', _388 => _388.logger, 'optionalAccess', _389 => _389.path, 'optionalAccess', _390 => _390[tmpDir]]) || "";
|
|
3125
3129
|
}
|
|
3126
3130
|
} else {
|
|
3127
|
-
tmpDir = _optionalChain([$asai, 'access',
|
|
3131
|
+
tmpDir = _optionalChain([$asai, 'access', _391 => _391.hostconfig, 'access', _392 => _392.logger, 'optionalAccess', _393 => _393.path, 'optionalAccess', _394 => _394.client]) || "";
|
|
3128
3132
|
}
|
|
3129
3133
|
}
|
|
3130
3134
|
return tmpDir;
|
|
@@ -3156,7 +3160,7 @@ var logmanage_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($
|
|
|
3156
3160
|
if (!await ensureLv(req, $asai, 3)) return sendFail(res, "Forbidden", opt);
|
|
3157
3161
|
try {
|
|
3158
3162
|
const baseDir = getDir(opt);
|
|
3159
|
-
const relPath = decodeURIComponent(_optionalChain([opt, 'access',
|
|
3163
|
+
const relPath = decodeURIComponent(_optionalChain([opt, 'access', _395 => _395.qrdata, 'optionalAccess', _396 => _396.path]) || _optionalChain([opt, 'access', _397 => _397.data, 'optionalAccess', _398 => _398.path]));
|
|
3160
3164
|
const jsonpath = resolvePathUnderBase2(baseDir, relPath);
|
|
3161
3165
|
await ensureFile2(jsonpath);
|
|
3162
3166
|
mgLog("ENSURE", jsonpath);
|
|
@@ -3177,7 +3181,7 @@ var logmanage_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($
|
|
|
3177
3181
|
if (url.startsWith("/api/asailog/manage/selectlist/")) {
|
|
3178
3182
|
if (!await ensureLv(req, $asai, _chunkH3K33HBAcjs.getPermissionThreshold.call(void 0, $asai, "logRead"))) return sendFail(res, "Forbidden", opt);
|
|
3179
3183
|
try {
|
|
3180
|
-
const ty = decodeURIComponent(_optionalChain([opt, 'access',
|
|
3184
|
+
const ty = decodeURIComponent(_optionalChain([opt, 'access', _399 => _399.qrdata, 'optionalAccess', _400 => _400.ty]) || _optionalChain([opt, 'access', _401 => _401.data, 'optionalAccess', _402 => _402.ty]) || "client");
|
|
3181
3185
|
if (!_chunkTKJAHTPOcjs.prefersDiskLogAccess.call(void 0, $asai) && _chunkTKJAHTPOcjs.isLogStoreEnabled.call(void 0, $asai) && (ty === "client" || ty === "server" || ty === "sec")) {
|
|
3182
3186
|
const kind = ty === "sec" ? "sec" : "web";
|
|
3183
3187
|
const groups = await _chunkTKJAHTPOcjs.listUnifiedGroups.call(void 0, $asai, { kind, source: ty === "sec" ? "sec" : ty });
|
|
@@ -3205,8 +3209,8 @@ var logmanage_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($
|
|
|
3205
3209
|
if (url.startsWith("/api/asailog/manage/select/")) {
|
|
3206
3210
|
if (!await ensureLv(req, $asai, _chunkH3K33HBAcjs.getPermissionThreshold.call(void 0, $asai, "logRead"))) return sendFail(res, "Forbidden", opt);
|
|
3207
3211
|
try {
|
|
3208
|
-
const ty = decodeURIComponent(_optionalChain([opt, 'access',
|
|
3209
|
-
const relPath = decodeURIComponent(_optionalChain([opt, 'access',
|
|
3212
|
+
const ty = decodeURIComponent(_optionalChain([opt, 'access', _403 => _403.qrdata, 'optionalAccess', _404 => _404.ty]) || _optionalChain([opt, 'access', _405 => _405.data, 'optionalAccess', _406 => _406.ty]) || "client");
|
|
3213
|
+
const relPath = decodeURIComponent(_optionalChain([opt, 'access', _407 => _407.qrdata, 'optionalAccess', _408 => _408.path]) || _optionalChain([opt, 'access', _409 => _409.data, 'optionalAccess', _410 => _410.path]));
|
|
3210
3214
|
if (!_chunkTKJAHTPOcjs.prefersDiskLogAccess.call(void 0, $asai) && _chunkTKJAHTPOcjs.isLogStoreEnabled.call(void 0, $asai) && (ty === "client" || ty === "server" || ty === "sec")) {
|
|
3211
3215
|
const data2 = await _chunkTKJAHTPOcjs.readWebLogFromStore.call(void 0, $asai, ty, relPath);
|
|
3212
3216
|
if (data2) {
|
|
@@ -3234,7 +3238,7 @@ var logmanage_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($
|
|
|
3234
3238
|
if (!await ensureLv(req, $asai, 3)) return sendFail(res, "Forbidden", opt);
|
|
3235
3239
|
try {
|
|
3236
3240
|
const baseDir = getDir(opt);
|
|
3237
|
-
const relPath = decodeURIComponent(_optionalChain([opt, 'access',
|
|
3241
|
+
const relPath = decodeURIComponent(_optionalChain([opt, 'access', _411 => _411.qrdata, 'optionalAccess', _412 => _412.path]) || _optionalChain([opt, 'access', _413 => _413.data, 'optionalAccess', _414 => _414.path]));
|
|
3238
3242
|
const fileName = relPath.split(/[/\\]/).pop() || relPath;
|
|
3239
3243
|
if (_chunkTKJAHTPOcjs.isLogStoreEnabled.call(void 0, $asai)) {
|
|
3240
3244
|
await _chunkTKJAHTPOcjs.purgeStoreEntriesForFile.call(void 0, $asai, fileName).catch(() => void 0);
|
|
@@ -3257,14 +3261,14 @@ var logmanage_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($
|
|
|
3257
3261
|
|
|
3258
3262
|
// src/infra/siem-auth.ts
|
|
3259
3263
|
function isSiemEnabled($asai) {
|
|
3260
|
-
const cfg = _optionalChain([$asai, 'optionalAccess',
|
|
3261
|
-
return !!(_optionalChain([cfg, 'optionalAccess',
|
|
3264
|
+
const cfg = _optionalChain([$asai, 'optionalAccess', _415 => _415.hostconfig, 'optionalAccess', _416 => _416.logger, 'optionalAccess', _417 => _417.siem]);
|
|
3265
|
+
return !!(_optionalChain([cfg, 'optionalAccess', _418 => _418.enabled]) && getSiemToken($asai));
|
|
3262
3266
|
}
|
|
3263
3267
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, isSiemEnabled, "isSiemEnabled");
|
|
3264
3268
|
function getSiemToken($asai) {
|
|
3265
3269
|
const fromEnv = process.env.ASAI_SIEM_TOKEN;
|
|
3266
3270
|
if (typeof fromEnv === "string" && fromEnv.trim()) return fromEnv.trim();
|
|
3267
|
-
const fromCfg = _optionalChain([$asai, 'optionalAccess',
|
|
3271
|
+
const fromCfg = _optionalChain([$asai, 'optionalAccess', _419 => _419.hostconfig, 'optionalAccess', _420 => _420.logger, 'optionalAccess', _421 => _421.siem, 'optionalAccess', _422 => _422.token]);
|
|
3268
3272
|
return typeof fromCfg === "string" ? fromCfg.trim() : "";
|
|
3269
3273
|
}
|
|
3270
3274
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, getSiemToken, "getSiemToken");
|
|
@@ -3272,9 +3276,9 @@ function isSiemTokenValid($asai, req) {
|
|
|
3272
3276
|
if (!isSiemEnabled($asai)) return false;
|
|
3273
3277
|
const expected = getSiemToken($asai);
|
|
3274
3278
|
if (!expected) return false;
|
|
3275
|
-
const header = _optionalChain([req, 'optionalAccess',
|
|
3279
|
+
const header = _optionalChain([req, 'optionalAccess', _423 => _423.headers, 'optionalAccess', _424 => _424["x-siem-token"]]) || _optionalChain([req, 'optionalAccess', _425 => _425.headers, 'optionalAccess', _426 => _426["x-api-key"]]);
|
|
3276
3280
|
if (typeof header === "string" && header === expected) return true;
|
|
3277
|
-
const q = _optionalChain([req, 'optionalAccess',
|
|
3281
|
+
const q = _optionalChain([req, 'optionalAccess', _427 => _427.query]) || {};
|
|
3278
3282
|
const qToken = q.siem_token || q.token;
|
|
3279
3283
|
return typeof qToken === "string" && qToken === expected;
|
|
3280
3284
|
}
|
|
@@ -3298,20 +3302,20 @@ function getNs(raw) {
|
|
|
3298
3302
|
}
|
|
3299
3303
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, getNs, "getNs");
|
|
3300
3304
|
async function ensureServerUser(req, $asai) {
|
|
3301
|
-
if (Array.isArray(_optionalChain([req, 'optionalAccess',
|
|
3305
|
+
if (Array.isArray(_optionalChain([req, 'optionalAccess', _428 => _428.Userinfo])) && req.Userinfo[0]) {
|
|
3302
3306
|
await attachServerUserLevel(req, $asai);
|
|
3303
3307
|
}
|
|
3304
3308
|
}
|
|
3305
3309
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, ensureServerUser, "ensureServerUser");
|
|
3306
3310
|
var interventionlog_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai) => {
|
|
3307
|
-
const { sendSuccess, sendFail } = _optionalChain([$asai, 'access',
|
|
3311
|
+
const { sendSuccess, sendFail } = _optionalChain([$asai, 'access', _429 => _429.$lib, 'optionalAccess', _430 => _430.reqWork, 'optionalCall', _431 => _431($asai)]) || {};
|
|
3308
3312
|
const IL = $asai.$lib.InterventionLog;
|
|
3309
3313
|
async function get(req, res, hostdir, opt) {
|
|
3310
3314
|
const url = req.url || "";
|
|
3311
3315
|
if (url.startsWith("/api/asailog/intervention/selectlist/")) {
|
|
3312
3316
|
if (!await ensureLogReadAccess(req, $asai, _chunkH3K33HBAcjs.getPermissionThreshold.call(void 0, $asai, "logRead"))) return sendFail(res, "Forbidden", opt);
|
|
3313
3317
|
try {
|
|
3314
|
-
const ns = getNs(_optionalChain([opt, 'access',
|
|
3318
|
+
const ns = getNs(_optionalChain([opt, 'access', _432 => _432.qrdata, 'optionalAccess', _433 => _433.ns]) || _optionalChain([opt, 'access', _434 => _434.data, 'optionalAccess', _435 => _435.ns]));
|
|
3315
3319
|
let list = await IL.listInterventionFiles($asai, ns);
|
|
3316
3320
|
if (_chunkTKJAHTPOcjs.isLogStoreEnabled.call(void 0, $asai) && !_chunkTKJAHTPOcjs.prefersDiskLogAccess.call(void 0, $asai)) {
|
|
3317
3321
|
const groups = await _chunkTKJAHTPOcjs.listUnifiedGroups.call(void 0, $asai, { kind: "intervention", ns });
|
|
@@ -3323,19 +3327,19 @@ var interventionlog_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void
|
|
|
3323
3327
|
}
|
|
3324
3328
|
return sendSuccess(res, { ns, files: list }, opt);
|
|
3325
3329
|
} catch (err) {
|
|
3326
|
-
return sendFail(res, _optionalChain([err, 'optionalAccess',
|
|
3330
|
+
return sendFail(res, _optionalChain([err, 'optionalAccess', _436 => _436.message]) || err, opt);
|
|
3327
3331
|
}
|
|
3328
3332
|
}
|
|
3329
3333
|
if (url.startsWith("/api/asailog/intervention/select/")) {
|
|
3330
3334
|
if (!await ensureLogReadAccess(req, $asai, _chunkH3K33HBAcjs.getPermissionThreshold.call(void 0, $asai, "logRead"))) return sendFail(res, "Forbidden", opt);
|
|
3331
3335
|
try {
|
|
3332
|
-
const name = decodeURIComponent(_optionalChain([opt, 'access',
|
|
3333
|
-
const ns = getNs(_optionalChain([opt, 'access',
|
|
3336
|
+
const name = decodeURIComponent(_optionalChain([opt, 'access', _437 => _437.qrdata, 'optionalAccess', _438 => _438.name]) || _optionalChain([opt, 'access', _439 => _439.data, 'optionalAccess', _440 => _440.name]) || "");
|
|
3337
|
+
const ns = getNs(_optionalChain([opt, 'access', _441 => _441.qrdata, 'optionalAccess', _442 => _442.ns]) || _optionalChain([opt, 'access', _443 => _443.data, 'optionalAccess', _444 => _444.ns]));
|
|
3334
3338
|
if (!name) return sendFail(res, "name required", opt);
|
|
3335
3339
|
const content = await IL.readInterventionFile($asai, name, ns);
|
|
3336
3340
|
return sendSuccess(res, { ns, ...content }, opt);
|
|
3337
3341
|
} catch (err) {
|
|
3338
|
-
return sendFail(res, _optionalChain([err, 'optionalAccess',
|
|
3342
|
+
return sendFail(res, _optionalChain([err, 'optionalAccess', _445 => _445.message]) || err, opt);
|
|
3339
3343
|
}
|
|
3340
3344
|
}
|
|
3341
3345
|
if (url.startsWith("/api/asailog/intervention/types/")) {
|
|
@@ -3343,7 +3347,7 @@ var interventionlog_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void
|
|
|
3343
3347
|
try {
|
|
3344
3348
|
return sendSuccess(res, IL.getInterventionTaxonomy($asai), opt);
|
|
3345
3349
|
} catch (err) {
|
|
3346
|
-
return sendFail(res, _optionalChain([err, 'optionalAccess',
|
|
3350
|
+
return sendFail(res, _optionalChain([err, 'optionalAccess', _446 => _446.message]) || err, opt);
|
|
3347
3351
|
}
|
|
3348
3352
|
}
|
|
3349
3353
|
}
|
|
@@ -3373,7 +3377,7 @@ var interventionlog_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void
|
|
|
3373
3377
|
);
|
|
3374
3378
|
return sendSuccess(res, { ns, ...result }, opt);
|
|
3375
3379
|
} catch (err) {
|
|
3376
|
-
return sendFail(res, _optionalChain([err, 'optionalAccess',
|
|
3380
|
+
return sendFail(res, _optionalChain([err, 'optionalAccess', _447 => _447.message]) || err, opt);
|
|
3377
3381
|
}
|
|
3378
3382
|
}
|
|
3379
3383
|
}
|
|
@@ -3392,7 +3396,7 @@ function parseQuery(opt) {
|
|
|
3392
3396
|
}
|
|
3393
3397
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, parseQuery, "parseQuery");
|
|
3394
3398
|
function parseBody(opt) {
|
|
3395
|
-
if (!_optionalChain([opt, 'optionalAccess',
|
|
3399
|
+
if (!_optionalChain([opt, 'optionalAccess', _448 => _448.data])) return {};
|
|
3396
3400
|
if (typeof opt.data === "string") {
|
|
3397
3401
|
try {
|
|
3398
3402
|
return JSON.parse(opt.data);
|
|
@@ -3404,7 +3408,7 @@ function parseBody(opt) {
|
|
|
3404
3408
|
}
|
|
3405
3409
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, parseBody, "parseBody");
|
|
3406
3410
|
var unifiedlog_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai) => {
|
|
3407
|
-
const { sendSuccess, sendFail } = _optionalChain([$asai, 'access',
|
|
3411
|
+
const { sendSuccess, sendFail } = _optionalChain([$asai, 'access', _449 => _449.$lib, 'optionalAccess', _450 => _450.reqWork, 'optionalCall', _451 => _451($asai)]) || {};
|
|
3408
3412
|
const IL = $asai.$lib.InterventionLog;
|
|
3409
3413
|
async function get(req, res, hostdir, opt) {
|
|
3410
3414
|
const url = req.url || "";
|
|
@@ -3414,7 +3418,7 @@ var unifiedlog_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, (
|
|
|
3414
3418
|
try {
|
|
3415
3419
|
return sendSuccess(res, _chunkTKJAHTPOcjs.getLogStoreMeta.call(void 0, $asai), opt);
|
|
3416
3420
|
} catch (err) {
|
|
3417
|
-
return sendFail(res, _optionalChain([err, 'optionalAccess',
|
|
3421
|
+
return sendFail(res, _optionalChain([err, 'optionalAccess', _452 => _452.message]) || err, opt);
|
|
3418
3422
|
}
|
|
3419
3423
|
}
|
|
3420
3424
|
if (url.startsWith("/api/asailog/store/stats/")) {
|
|
@@ -3427,7 +3431,7 @@ var unifiedlog_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, (
|
|
|
3427
3431
|
const stats = await _chunkTKJAHTPOcjs.getUnifiedStats.call(void 0, $asai);
|
|
3428
3432
|
return sendSuccess(res, { store: storeType, stats, config: _chunkTKJAHTPOcjs.getLogStoreMeta.call(void 0, $asai) }, opt);
|
|
3429
3433
|
} catch (err) {
|
|
3430
|
-
return sendFail(res, _optionalChain([err, 'optionalAccess',
|
|
3434
|
+
return sendFail(res, _optionalChain([err, 'optionalAccess', _453 => _453.message]) || err, opt);
|
|
3431
3435
|
}
|
|
3432
3436
|
}
|
|
3433
3437
|
if (url.startsWith("/api/asailog/store/compliance/")) {
|
|
@@ -3437,7 +3441,7 @@ var unifiedlog_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, (
|
|
|
3437
3441
|
const report = await _chunkTKJAHTPOcjs.getComplianceReport.call(void 0, $asai, ns);
|
|
3438
3442
|
return sendSuccess(res, report, opt);
|
|
3439
3443
|
} catch (err) {
|
|
3440
|
-
return sendFail(res, _optionalChain([err, 'optionalAccess',
|
|
3444
|
+
return sendFail(res, _optionalChain([err, 'optionalAccess', _454 => _454.message]) || err, opt);
|
|
3441
3445
|
}
|
|
3442
3446
|
}
|
|
3443
3447
|
if (url.startsWith("/api/asailog/store/search/")) {
|
|
@@ -3459,7 +3463,7 @@ var unifiedlog_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, (
|
|
|
3459
3463
|
});
|
|
3460
3464
|
return sendSuccess(res, result, opt);
|
|
3461
3465
|
} catch (err) {
|
|
3462
|
-
return sendFail(res, _optionalChain([err, 'optionalAccess',
|
|
3466
|
+
return sendFail(res, _optionalChain([err, 'optionalAccess', _455 => _455.message]) || err, opt);
|
|
3463
3467
|
}
|
|
3464
3468
|
}
|
|
3465
3469
|
if (url.startsWith("/api/asailog/store/export/")) {
|
|
@@ -3480,7 +3484,7 @@ var unifiedlog_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, (
|
|
|
3480
3484
|
});
|
|
3481
3485
|
return sendSuccess(res, payload, opt);
|
|
3482
3486
|
} catch (err) {
|
|
3483
|
-
return sendFail(res, _optionalChain([err, 'optionalAccess',
|
|
3487
|
+
return sendFail(res, _optionalChain([err, 'optionalAccess', _456 => _456.message]) || err, opt);
|
|
3484
3488
|
}
|
|
3485
3489
|
}
|
|
3486
3490
|
if (url.startsWith("/api/asailog/store/taxonomy/")) {
|
|
@@ -3488,7 +3492,7 @@ var unifiedlog_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, (
|
|
|
3488
3492
|
try {
|
|
3489
3493
|
return sendSuccess(res, IL.getInterventionTaxonomy($asai), opt);
|
|
3490
3494
|
} catch (err) {
|
|
3491
|
-
return sendFail(res, _optionalChain([err, 'optionalAccess',
|
|
3495
|
+
return sendFail(res, _optionalChain([err, 'optionalAccess', _457 => _457.message]) || err, opt);
|
|
3492
3496
|
}
|
|
3493
3497
|
}
|
|
3494
3498
|
if (url.startsWith("/api/asailog/store/formats/")) {
|
|
@@ -3497,7 +3501,7 @@ var unifiedlog_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, (
|
|
|
3497
3501
|
const { getLogFormatTaxonomy } = await Promise.resolve().then(() => _interopRequireWildcard(require("./log-formats-TUXGMCCU.cjs")));
|
|
3498
3502
|
return sendSuccess(res, getLogFormatTaxonomy($asai), opt);
|
|
3499
3503
|
} catch (err) {
|
|
3500
|
-
return sendFail(res, _optionalChain([err, 'optionalAccess',
|
|
3504
|
+
return sendFail(res, _optionalChain([err, 'optionalAccess', _458 => _458.message]) || err, opt);
|
|
3501
3505
|
}
|
|
3502
3506
|
}
|
|
3503
3507
|
if (url.startsWith("/api/asailog/store/selectlist/")) {
|
|
@@ -3524,7 +3528,7 @@ var unifiedlog_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, (
|
|
|
3524
3528
|
}
|
|
3525
3529
|
return sendSuccess(res, { groups }, opt);
|
|
3526
3530
|
} catch (err) {
|
|
3527
|
-
return sendFail(res, _optionalChain([err, 'optionalAccess',
|
|
3531
|
+
return sendFail(res, _optionalChain([err, 'optionalAccess', _459 => _459.message]) || err, opt);
|
|
3528
3532
|
}
|
|
3529
3533
|
}
|
|
3530
3534
|
if (url.startsWith("/api/asailog/store/select/")) {
|
|
@@ -3558,7 +3562,7 @@ var unifiedlog_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, (
|
|
|
3558
3562
|
});
|
|
3559
3563
|
return sendSuccess(res, { entries: rows }, opt);
|
|
3560
3564
|
} catch (err) {
|
|
3561
|
-
return sendFail(res, _optionalChain([err, 'optionalAccess',
|
|
3565
|
+
return sendFail(res, _optionalChain([err, 'optionalAccess', _460 => _460.message]) || err, opt);
|
|
3562
3566
|
}
|
|
3563
3567
|
}
|
|
3564
3568
|
}
|
|
@@ -3580,7 +3584,7 @@ var unifiedlog_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, (
|
|
|
3580
3584
|
});
|
|
3581
3585
|
return sendSuccess(res, result, opt);
|
|
3582
3586
|
} catch (err) {
|
|
3583
|
-
return sendFail(res, _optionalChain([err, 'optionalAccess',
|
|
3587
|
+
return sendFail(res, _optionalChain([err, 'optionalAccess', _461 => _461.message]) || err, opt);
|
|
3584
3588
|
}
|
|
3585
3589
|
}
|
|
3586
3590
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, post, "post");
|
|
@@ -3592,7 +3596,7 @@ var unifiedlog_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, (
|
|
|
3592
3596
|
|
|
3593
3597
|
var registry = null;
|
|
3594
3598
|
function resolveFilePath($asai) {
|
|
3595
|
-
const root = _optionalChain([$asai, 'optionalAccess',
|
|
3599
|
+
const root = _optionalChain([$asai, 'optionalAccess', _462 => _462.serverRoot]) || process.cwd();
|
|
3596
3600
|
return nodePath3.join(root, "websys/sys/errorcodes.json");
|
|
3597
3601
|
}
|
|
3598
3602
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, resolveFilePath, "resolveFilePath");
|
|
@@ -3610,7 +3614,7 @@ function loadErrorCodes($asai) {
|
|
|
3610
3614
|
}
|
|
3611
3615
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, loadErrorCodes, "loadErrorCodes");
|
|
3612
3616
|
function getError(ec) {
|
|
3613
|
-
return _optionalChain([registry, 'optionalAccess',
|
|
3617
|
+
return _optionalChain([registry, 'optionalAccess', _463 => _463.errors, 'optionalAccess', _464 => _464[ec]]) || null;
|
|
3614
3618
|
}
|
|
3615
3619
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, getError, "getError");
|
|
3616
3620
|
function hasError(ec) {
|
|
@@ -3619,11 +3623,11 @@ function hasError(ec) {
|
|
|
3619
3623
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, hasError, "hasError");
|
|
3620
3624
|
function logError($asai, ec, params) {
|
|
3621
3625
|
const entry = getError(ec);
|
|
3622
|
-
const logFn = _optionalChain([$asai, 'optionalAccess',
|
|
3626
|
+
const logFn = _optionalChain([$asai, 'optionalAccess', _465 => _465.$log]) || console.warn;
|
|
3623
3627
|
if (entry) {
|
|
3624
|
-
logFn(`[EC:${ec}]`, entry.id || "", entry.detail || "", _optionalChain([params, 'optionalAccess',
|
|
3628
|
+
logFn(`[EC:${ec}]`, entry.id || "", entry.detail || "", _optionalChain([params, 'optionalAccess', _466 => _466.length]) ? params : "");
|
|
3625
3629
|
} else {
|
|
3626
|
-
logFn(`[EC:${ec}]`, "(unregistered)", _optionalChain([params, 'optionalAccess',
|
|
3630
|
+
logFn(`[EC:${ec}]`, "(unregistered)", _optionalChain([params, 'optionalAccess', _467 => _467.length]) ? params : "");
|
|
3627
3631
|
}
|
|
3628
3632
|
}
|
|
3629
3633
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, logError, "logError");
|
|
@@ -3651,14 +3655,14 @@ var ErrorCode_default = {
|
|
|
3651
3655
|
|
|
3652
3656
|
// src/sysserver/api/common/errorcodes.ts
|
|
3653
3657
|
var errorcodes_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai) => {
|
|
3654
|
-
const { sendSuccess, sendFail } = _optionalChain([$asai, 'access',
|
|
3658
|
+
const { sendSuccess, sendFail } = _optionalChain([$asai, 'access', _468 => _468.$lib, 'optionalAccess', _469 => _469.reqWork, 'optionalCall', _470 => _470($asai)]) || {};
|
|
3655
3659
|
function get(req, res, _hostdir, opt) {
|
|
3656
3660
|
const url = req.url || "";
|
|
3657
3661
|
if (url.startsWith("/api/sys/errorcodes/")) {
|
|
3658
3662
|
try {
|
|
3659
3663
|
return sendSuccess(res, loadErrorCodes($asai), opt);
|
|
3660
3664
|
} catch (err) {
|
|
3661
|
-
return sendFail(res, _optionalChain([err, 'optionalAccess',
|
|
3665
|
+
return sendFail(res, _optionalChain([err, 'optionalAccess', _471 => _471.message]) || err, opt);
|
|
3662
3666
|
}
|
|
3663
3667
|
}
|
|
3664
3668
|
}
|
|
@@ -3668,9 +3672,9 @@ var errorcodes_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, (
|
|
|
3668
3672
|
|
|
3669
3673
|
// src/sysserver/api/common/sqlitemanage.ts
|
|
3670
3674
|
var sqlitemanage_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai) => {
|
|
3671
|
-
const { sendSuccess, sendFail, mnLog } = _optionalChain([$asai, 'optionalAccess',
|
|
3675
|
+
const { sendSuccess, sendFail, mnLog } = _optionalChain([$asai, 'optionalAccess', _472 => _472.$lib, 'optionalAccess', _473 => _473.reqWork, 'optionalCall', _474 => _474($asai)]) || {};
|
|
3672
3676
|
function mgLog(...arg) {
|
|
3673
|
-
_optionalChain([mnLog, 'optionalCall',
|
|
3677
|
+
_optionalChain([mnLog, 'optionalCall', _475 => _475("SQLite", ...arg)]);
|
|
3674
3678
|
}
|
|
3675
3679
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, mgLog, "mgLog");
|
|
3676
3680
|
return $asai.$lib.AsDb($asai, {
|
|
@@ -3688,7 +3692,7 @@ var sqlitemanage_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0,
|
|
|
3688
3692
|
if (req.url.startsWith("/api/asaisqlite/manage/post")) {
|
|
3689
3693
|
try {
|
|
3690
3694
|
mgLog("POST", "custom handler triggered");
|
|
3691
|
-
_optionalChain([sendSuccess, 'optionalCall',
|
|
3695
|
+
_optionalChain([sendSuccess, 'optionalCall', _476 => _476(res, { data: "post" }, opt)]);
|
|
3692
3696
|
} catch (err) {
|
|
3693
3697
|
mgLog("ERROR", "post handler", err);
|
|
3694
3698
|
}
|
|
@@ -3705,10 +3709,10 @@ var sqlitemanage_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0,
|
|
|
3705
3709
|
table: dataObj.table
|
|
3706
3710
|
});
|
|
3707
3711
|
mgLog("SELECT", "completed");
|
|
3708
|
-
_optionalChain([sendSuccess, 'optionalCall',
|
|
3712
|
+
_optionalChain([sendSuccess, 'optionalCall', _477 => _477(res, resdb, opt)]);
|
|
3709
3713
|
} catch (errdb) {
|
|
3710
3714
|
mgLog("ERROR", "select", errdb);
|
|
3711
|
-
_optionalChain([sendFail, 'optionalCall',
|
|
3715
|
+
_optionalChain([sendFail, 'optionalCall', _478 => _478(res, errdb, opt)]);
|
|
3712
3716
|
}
|
|
3713
3717
|
return "ok";
|
|
3714
3718
|
}
|
|
@@ -3724,7 +3728,7 @@ function promLine(name, value, labels) {
|
|
|
3724
3728
|
}
|
|
3725
3729
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, promLine, "promLine");
|
|
3726
3730
|
var health_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai) => {
|
|
3727
|
-
const { sendSuccess, sendFail } = _optionalChain([$asai, 'access',
|
|
3731
|
+
const { sendSuccess, sendFail } = _optionalChain([$asai, 'access', _479 => _479.$lib, 'optionalAccess', _480 => _480.reqWork, 'optionalCall', _481 => _481($asai)]) || {};
|
|
3728
3732
|
async function get(req, res, _hostdir, opt) {
|
|
3729
3733
|
const url = req.url || "";
|
|
3730
3734
|
if (url.startsWith("/api/sys/health/metrics/")) {
|
|
@@ -3733,10 +3737,10 @@ var health_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asa
|
|
|
3733
3737
|
let httpTotal = 0;
|
|
3734
3738
|
let wsTotal = 0;
|
|
3735
3739
|
for (const set of Object.values($asai.connectionshttp || {})) {
|
|
3736
|
-
httpTotal += _optionalChain([set, 'optionalAccess',
|
|
3740
|
+
httpTotal += _optionalChain([set, 'optionalAccess', _482 => _482.size]) || 0;
|
|
3737
3741
|
}
|
|
3738
3742
|
for (const set of Object.values($asai.connectionsws || {})) {
|
|
3739
|
-
wsTotal += _optionalChain([set, 'optionalAccess',
|
|
3743
|
+
wsTotal += _optionalChain([set, 'optionalAccess', _483 => _483.size]) || 0;
|
|
3740
3744
|
}
|
|
3741
3745
|
const lines = [
|
|
3742
3746
|
"# HELP asai_uptime_seconds Process uptime",
|
|
@@ -3758,7 +3762,7 @@ var health_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asa
|
|
|
3758
3762
|
res.writeHead(200, { "Content-Type": "text/plain; charset=utf-8" });
|
|
3759
3763
|
return res.end(lines.join("\n") + "\n");
|
|
3760
3764
|
} catch (err) {
|
|
3761
|
-
return sendFail(res, _optionalChain([err, 'optionalAccess',
|
|
3765
|
+
return sendFail(res, _optionalChain([err, 'optionalAccess', _484 => _484.message]) || err, opt);
|
|
3762
3766
|
}
|
|
3763
3767
|
}
|
|
3764
3768
|
if (url.startsWith("/api/sys/health/status/")) {
|
|
@@ -3771,10 +3775,10 @@ var health_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asa
|
|
|
3771
3775
|
memory: process.memoryUsage(),
|
|
3772
3776
|
quota: {
|
|
3773
3777
|
http: Object.fromEntries(
|
|
3774
|
-
Object.entries($asai.connectionshttp || {}).map(([k, v]) => [k, _optionalChain([v, 'optionalAccess',
|
|
3778
|
+
Object.entries($asai.connectionshttp || {}).map(([k, v]) => [k, _optionalChain([v, 'optionalAccess', _485 => _485.size]) || 0])
|
|
3775
3779
|
),
|
|
3776
3780
|
ws: Object.fromEntries(
|
|
3777
|
-
Object.entries($asai.connectionsws || {}).map(([k, v]) => [k, _optionalChain([v, 'optionalAccess',
|
|
3781
|
+
Object.entries($asai.connectionsws || {}).map(([k, v]) => [k, _optionalChain([v, 'optionalAccess', _486 => _486.size]) || 0])
|
|
3778
3782
|
)
|
|
3779
3783
|
}
|
|
3780
3784
|
},
|
|
@@ -3815,7 +3819,7 @@ _chunkSMVZ3ZDJcjs.__name.call(void 0, sanitizeString, "sanitizeString");
|
|
|
3815
3819
|
// src/sysserver/api/login/service/session.ts
|
|
3816
3820
|
|
|
3817
3821
|
function getSessionTtlMs($asai) {
|
|
3818
|
-
const hours = _nullishCoalesce(_optionalChain([$asai, 'optionalAccess',
|
|
3822
|
+
const hours = _nullishCoalesce(_optionalChain([$asai, 'optionalAccess', _487 => _487.hostconfig, 'optionalAccess', _488 => _488.security, 'optionalAccess', _489 => _489.sessionTtlHours]), () => ( 24));
|
|
3819
3823
|
return Number(hours) * 3600 * 1e3;
|
|
3820
3824
|
}
|
|
3821
3825
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, getSessionTtlMs, "getSessionTtlMs");
|
|
@@ -3832,7 +3836,7 @@ _chunkSMVZ3ZDJcjs.__name.call(void 0, generatePriKey, "generatePriKey");
|
|
|
3832
3836
|
function createSessionKeys($asai) {
|
|
3833
3837
|
const sessionId = _crypto.randomUUID.call(void 0, );
|
|
3834
3838
|
const pri = generatePriKey();
|
|
3835
|
-
const sn = _optionalChain([$asai, 'optionalAccess',
|
|
3839
|
+
const sn = _optionalChain([$asai, 'optionalAccess', _490 => _490.hostconfig, 'optionalAccess', _491 => _491.asaisn]);
|
|
3836
3840
|
if (!sn) throw new Error("[session] ASAI_ASAISN \u672A\u914D\u7F6E");
|
|
3837
3841
|
const pub = $asai.$lib.AsCode.asencode(pri, sn);
|
|
3838
3842
|
return { pri, pub, sessionId };
|
|
@@ -3888,7 +3892,7 @@ function unwrapJsonString(value) {
|
|
|
3888
3892
|
}
|
|
3889
3893
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, unwrapJsonString, "unwrapJsonString");
|
|
3890
3894
|
function parseAuthBody(opt) {
|
|
3891
|
-
let raw = _optionalChain([opt, 'optionalAccess',
|
|
3895
|
+
let raw = _optionalChain([opt, 'optionalAccess', _492 => _492.data]);
|
|
3892
3896
|
if (raw == null || raw === "") return {};
|
|
3893
3897
|
if (typeof raw === "string") {
|
|
3894
3898
|
const text = raw.trim();
|
|
@@ -3964,7 +3968,7 @@ _chunkSMVZ3ZDJcjs.__name.call(void 0, purgeOfflineSessions, "purgeOfflineSession
|
|
|
3964
3968
|
|
|
3965
3969
|
// src/sysserver/api/login/index.ts
|
|
3966
3970
|
function getSecurity($asai) {
|
|
3967
|
-
return _optionalChain([$asai, 'optionalAccess',
|
|
3971
|
+
return _optionalChain([$asai, 'optionalAccess', _493 => _493.hostconfig, 'optionalAccess', _494 => _494.security]) || {};
|
|
3968
3972
|
}
|
|
3969
3973
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, getSecurity, "getSecurity");
|
|
3970
3974
|
function getQuota2($asai) {
|
|
@@ -3977,7 +3981,7 @@ async function canLogin($asai, us, hostdir) {
|
|
|
3977
3981
|
if (!quota.enabled) return { ok: true };
|
|
3978
3982
|
const store = _chunkLXJMGLKWcjs.createUserStore.call(void 0, $asai);
|
|
3979
3983
|
const total = await countOnlineSessions($asai, hostdir, store);
|
|
3980
|
-
const maxLogin = _nullishCoalesce(_nullishCoalesce(quota.maxLoginSessions, () => ( _optionalChain([$asai, 'optionalAccess',
|
|
3984
|
+
const maxLogin = _nullishCoalesce(_nullishCoalesce(quota.maxLoginSessions, () => ( _optionalChain([$asai, 'optionalAccess', _495 => _495.hostconfig, 'optionalAccess', _496 => _496.hosts, 'optionalAccess', _497 => _497.default, 'optionalAccess', _498 => _498.maxonline]))), () => ( 100));
|
|
3981
3985
|
if (total >= maxLogin) {
|
|
3982
3986
|
return { ok: false, message: "LOGIN_QUOTA_FULL" };
|
|
3983
3987
|
}
|
|
@@ -4010,7 +4014,7 @@ function ensureReady($asai) {
|
|
|
4010
4014
|
}
|
|
4011
4015
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, ensureReady, "ensureReady");
|
|
4012
4016
|
var login_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai) => {
|
|
4013
|
-
const { sendSuccess, sendFail, sendErr } = _optionalChain([$asai, 'access',
|
|
4017
|
+
const { sendSuccess, sendFail, sendErr } = _optionalChain([$asai, 'access', _499 => _499.$lib, 'optionalAccess', _500 => _500.reqWork, 'optionalCall', _501 => _501($asai)]) || {};
|
|
4014
4018
|
const store = _chunkLXJMGLKWcjs.createUserStore.call(void 0, $asai);
|
|
4015
4019
|
async function checkAdmin(req, pathname, minOverride) {
|
|
4016
4020
|
await attachServerUserLevel(req, $asai);
|
|
@@ -4051,7 +4055,7 @@ var login_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai
|
|
|
4051
4055
|
logSecurityEvent($asai, { type: "AUTH_FAIL", path: url, method: "POST", user: us, ip, detail: "password_changed" });
|
|
4052
4056
|
return sendSuccess(res, { ok: true }, opt);
|
|
4053
4057
|
} catch (err) {
|
|
4054
|
-
return sendFail(res, _optionalChain([err, 'optionalAccess',
|
|
4058
|
+
return sendFail(res, _optionalChain([err, 'optionalAccess', _502 => _502.message]) || err, opt);
|
|
4055
4059
|
}
|
|
4056
4060
|
}
|
|
4057
4061
|
if (url.startsWith("/api/user/login/register/")) {
|
|
@@ -4084,11 +4088,11 @@ var login_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai
|
|
|
4084
4088
|
logSecurityEvent($asai, { type: "AUTH_FAIL", path: url, method: "POST", user: us, ip, detail: "register_ok" });
|
|
4085
4089
|
return sendSuccess(res, { user: publicUser($asai, user) }, opt);
|
|
4086
4090
|
} catch (err) {
|
|
4087
|
-
const msg = _optionalChain([err, 'optionalAccess',
|
|
4091
|
+
const msg = _optionalChain([err, 'optionalAccess', _503 => _503.message]) || String(err);
|
|
4088
4092
|
if (msg.includes("exists") || msg.includes("\u5DF2\u5B58\u5728")) {
|
|
4089
4093
|
return sendErr(res, "USER_ALREADY_EXISTS", void 0, opt);
|
|
4090
4094
|
}
|
|
4091
|
-
return sendFail(res, _optionalChain([err, 'optionalAccess',
|
|
4095
|
+
return sendFail(res, _optionalChain([err, 'optionalAccess', _504 => _504.message]) || err, opt);
|
|
4092
4096
|
}
|
|
4093
4097
|
}
|
|
4094
4098
|
if (url.startsWith("/api/user/login/auth/")) {
|
|
@@ -4122,7 +4126,7 @@ var login_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai
|
|
|
4122
4126
|
}
|
|
4123
4127
|
const policy = _chunkH3K33HBAcjs.getPasswordPolicy.call(void 0, $asai);
|
|
4124
4128
|
const mustChange = !!user.mustChangePassword || _chunkH3K33HBAcjs.isPasswordExpired.call(void 0, user.passwordChangedAt, policy.maxAgeDays);
|
|
4125
|
-
const hostcfg = _optionalChain([$asai, 'access',
|
|
4129
|
+
const hostcfg = _optionalChain([$asai, 'access', _505 => _505.getHost, 'optionalCall', _506 => _506(hostdir)]) || {};
|
|
4126
4130
|
if (hostcfg.ckws && isUserOnlineOnWs($asai, us, hostdir)) {
|
|
4127
4131
|
kickUserWs($asai, us, hostdir);
|
|
4128
4132
|
}
|
|
@@ -4147,18 +4151,18 @@ var login_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai
|
|
|
4147
4151
|
opt
|
|
4148
4152
|
);
|
|
4149
4153
|
} catch (err) {
|
|
4150
|
-
return sendFail(res, _optionalChain([err, 'optionalAccess',
|
|
4154
|
+
return sendFail(res, _optionalChain([err, 'optionalAccess', _507 => _507.message]) || err, opt);
|
|
4151
4155
|
}
|
|
4152
4156
|
}
|
|
4153
4157
|
if (url.startsWith("/api/user/login/logout/")) {
|
|
4154
4158
|
try {
|
|
4155
4159
|
const bodySid = body.sessionId ? sanitizeString(body.sessionId, 64) : "";
|
|
4156
4160
|
if (bodySid) await store.removeSession(bodySid);
|
|
4157
|
-
const us = _optionalChain([req, 'optionalAccess',
|
|
4161
|
+
const us = _optionalChain([req, 'optionalAccess', _508 => _508.Userinfo, 'optionalAccess', _509 => _509[0]]);
|
|
4158
4162
|
if (us) logSecurityEvent($asai, { type: "AUTH_FAIL", path: url, method: "POST", user: String(us), ip, detail: "logout" });
|
|
4159
4163
|
return sendSuccess(res, "ok", opt);
|
|
4160
4164
|
} catch (err) {
|
|
4161
|
-
return sendFail(res, _optionalChain([err, 'optionalAccess',
|
|
4165
|
+
return sendFail(res, _optionalChain([err, 'optionalAccess', _510 => _510.message]) || err, opt);
|
|
4162
4166
|
}
|
|
4163
4167
|
}
|
|
4164
4168
|
if (url.startsWith("/api/user/login/admin/kick/")) {
|
|
@@ -4176,7 +4180,7 @@ var login_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai
|
|
|
4176
4180
|
}
|
|
4177
4181
|
kickUserWs($asai, target.us, hostdir);
|
|
4178
4182
|
await store.removeSession(sessionId);
|
|
4179
|
-
const operator = String(_optionalChain([req, 'optionalAccess',
|
|
4183
|
+
const operator = String(_optionalChain([req, 'optionalAccess', _511 => _511.Userinfo, 'optionalAccess', _512 => _512[0]]) || "");
|
|
4180
4184
|
await _chunkRIRKIYETcjs.logSessionTerminate.call(void 0, $asai, {
|
|
4181
4185
|
operator,
|
|
4182
4186
|
sessionId,
|
|
@@ -4185,7 +4189,7 @@ var login_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai
|
|
|
4185
4189
|
});
|
|
4186
4190
|
return sendSuccess(res, { ok: true }, opt);
|
|
4187
4191
|
} catch (err) {
|
|
4188
|
-
return sendFail(res, _optionalChain([err, 'optionalAccess',
|
|
4192
|
+
return sendFail(res, _optionalChain([err, 'optionalAccess', _513 => _513.message]) || err, opt);
|
|
4189
4193
|
}
|
|
4190
4194
|
}
|
|
4191
4195
|
if (url.startsWith("/api/user/login/admin/delete/")) {
|
|
@@ -4197,11 +4201,11 @@ var login_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai
|
|
|
4197
4201
|
if (!targetUs || targetUs === "admin") return sendErr(res, "AUTH_FORBIDDEN", void 0, opt);
|
|
4198
4202
|
const ok = await store.deleteUser(targetUs);
|
|
4199
4203
|
if (!ok) return sendErr(res, "AUTH_USER_NOT_FOUND", void 0, opt);
|
|
4200
|
-
const operator = String(_optionalChain([req, 'optionalAccess',
|
|
4204
|
+
const operator = String(_optionalChain([req, 'optionalAccess', _514 => _514.Userinfo, 'optionalAccess', _515 => _515[0]]) || "");
|
|
4201
4205
|
await _chunkRIRKIYETcjs.logAccountPurge.call(void 0, $asai, { operator, targetUs, ip });
|
|
4202
4206
|
return sendSuccess(res, { ok: true }, opt);
|
|
4203
4207
|
} catch (err) {
|
|
4204
|
-
return sendFail(res, _optionalChain([err, 'optionalAccess',
|
|
4208
|
+
return sendFail(res, _optionalChain([err, 'optionalAccess', _516 => _516.message]) || err, opt);
|
|
4205
4209
|
}
|
|
4206
4210
|
}
|
|
4207
4211
|
if (url.startsWith("/api/user/login/admin/levels/")) {
|
|
@@ -4213,7 +4217,7 @@ var login_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai
|
|
|
4213
4217
|
const thresholds = body.thresholds && typeof body.thresholds === "object" ? body.thresholds : void 0;
|
|
4214
4218
|
const routeRights = Array.isArray(body.routeRights) ? body.routeRights : void 0;
|
|
4215
4219
|
const defaultResetPassword = typeof body.defaultResetPassword === "string" ? body.defaultResetPassword : void 0;
|
|
4216
|
-
const operator = String(_optionalChain([req, 'optionalAccess',
|
|
4220
|
+
const operator = String(_optionalChain([req, 'optionalAccess', _517 => _517.Userinfo, 'optionalAccess', _518 => _518[0]]) || "");
|
|
4217
4221
|
const cfg = await _chunkH3K33HBAcjs.saveUserLevelConfig.call(void 0,
|
|
4218
4222
|
$asai,
|
|
4219
4223
|
{
|
|
@@ -4226,13 +4230,13 @@ var login_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai
|
|
|
4226
4230
|
);
|
|
4227
4231
|
await _chunkRIRKIYETcjs.logSecurityConfigIntervention.call(void 0, $asai, {
|
|
4228
4232
|
section: "user_levels",
|
|
4229
|
-
detail: JSON.stringify({ levels: _optionalChain([levels, 'optionalAccess',
|
|
4233
|
+
detail: JSON.stringify({ levels: _optionalChain([levels, 'optionalAccess', _519 => _519.length]), thresholds: !!thresholds, routeRights: _optionalChain([routeRights, 'optionalAccess', _520 => _520.length]) }),
|
|
4230
4234
|
operator,
|
|
4231
4235
|
ip
|
|
4232
4236
|
});
|
|
4233
4237
|
return sendSuccess(res, cfg, opt);
|
|
4234
4238
|
} catch (err) {
|
|
4235
|
-
return sendFail(res, _optionalChain([err, 'optionalAccess',
|
|
4239
|
+
return sendFail(res, _optionalChain([err, 'optionalAccess', _521 => _521.message]) || err, opt);
|
|
4236
4240
|
}
|
|
4237
4241
|
}
|
|
4238
4242
|
if (url.startsWith("/api/user/login/admin/resetpass/")) {
|
|
@@ -4266,7 +4270,7 @@ var login_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai
|
|
|
4266
4270
|
passHistory: "[]"
|
|
4267
4271
|
});
|
|
4268
4272
|
if (!updated) return sendErr(res, "AUTH_USER_NOT_FOUND", void 0, opt);
|
|
4269
|
-
const operator = String(_optionalChain([req, 'optionalAccess',
|
|
4273
|
+
const operator = String(_optionalChain([req, 'optionalAccess', _522 => _522.Userinfo, 'optionalAccess', _523 => _523[0]]) || "");
|
|
4270
4274
|
await _chunkRIRKIYETcjs.logUserRbacChange.call(void 0, $asai, {
|
|
4271
4275
|
operator,
|
|
4272
4276
|
targetUs,
|
|
@@ -4283,7 +4287,7 @@ var login_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai
|
|
|
4283
4287
|
});
|
|
4284
4288
|
return sendSuccess(res, { user: publicUser($asai, updated) }, opt);
|
|
4285
4289
|
} catch (err) {
|
|
4286
|
-
return sendFail(res, _optionalChain([err, 'optionalAccess',
|
|
4290
|
+
return sendFail(res, _optionalChain([err, 'optionalAccess', _524 => _524.message]) || err, opt);
|
|
4287
4291
|
}
|
|
4288
4292
|
}
|
|
4289
4293
|
if (url.startsWith("/api/user/login/admin/update/")) {
|
|
@@ -4314,7 +4318,7 @@ var login_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai
|
|
|
4314
4318
|
if (!updated) return sendErr(res, "AUTH_USER_NOT_FOUND", void 0, opt);
|
|
4315
4319
|
if (Object.keys(patch).length) {
|
|
4316
4320
|
await _chunkRIRKIYETcjs.logUserRbacChange.call(void 0, $asai, {
|
|
4317
|
-
operator: String(_optionalChain([req, 'optionalAccess',
|
|
4321
|
+
operator: String(_optionalChain([req, 'optionalAccess', _525 => _525.Userinfo, 'optionalAccess', _526 => _526[0]]) || ""),
|
|
4318
4322
|
targetUs,
|
|
4319
4323
|
patch,
|
|
4320
4324
|
ip
|
|
@@ -4322,11 +4326,11 @@ var login_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai
|
|
|
4322
4326
|
}
|
|
4323
4327
|
return sendSuccess(res, { user: publicUser($asai, updated) }, opt);
|
|
4324
4328
|
} catch (err) {
|
|
4325
|
-
return sendFail(res, _optionalChain([err, 'optionalAccess',
|
|
4329
|
+
return sendFail(res, _optionalChain([err, 'optionalAccess', _527 => _527.message]) || err, opt);
|
|
4326
4330
|
}
|
|
4327
4331
|
}
|
|
4328
4332
|
if (url.startsWith("/api/user/login/profile/")) {
|
|
4329
|
-
const us = _optionalChain([req, 'optionalAccess',
|
|
4333
|
+
const us = _optionalChain([req, 'optionalAccess', _528 => _528.Userinfo, 'optionalAccess', _529 => _529[0]]);
|
|
4330
4334
|
if (!us) return sendErr(res, "AUTH_UNAUTHORIZED", void 0, opt);
|
|
4331
4335
|
try {
|
|
4332
4336
|
const user = await store.findByUsername(String(us));
|
|
@@ -4360,7 +4364,7 @@ var login_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai
|
|
|
4360
4364
|
const fresh = await store.findByUsername(String(us));
|
|
4361
4365
|
return sendSuccess(res, { user: fresh ? publicUser($asai, fresh) : null }, opt);
|
|
4362
4366
|
} catch (err) {
|
|
4363
|
-
return sendFail(res, _optionalChain([err, 'optionalAccess',
|
|
4367
|
+
return sendFail(res, _optionalChain([err, 'optionalAccess', _530 => _530.message]) || err, opt);
|
|
4364
4368
|
}
|
|
4365
4369
|
}
|
|
4366
4370
|
}
|
|
@@ -4369,7 +4373,7 @@ var login_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai
|
|
|
4369
4373
|
const url = req.url || "";
|
|
4370
4374
|
const ip = getClientIp(req);
|
|
4371
4375
|
if (url.startsWith("/api/user/login/config/")) {
|
|
4372
|
-
const lang = String(_optionalChain([req, 'optionalAccess',
|
|
4376
|
+
const lang = String(_optionalChain([req, 'optionalAccess', _531 => _531.headers, 'optionalAccess', _532 => _532["accept-language"]]) || _optionalChain([opt, 'optionalAccess', _533 => _533.headers, 'optionalAccess', _534 => _534["accept-language"]]) || "zh-CN").split(",")[0];
|
|
4373
4377
|
await _chunkH3K33HBAcjs.loadUserLevelConfig.call(void 0, $asai);
|
|
4374
4378
|
return sendSuccess(res, _chunkH3K33HBAcjs.getPublicSecurityConfig.call(void 0, $asai, lang), opt);
|
|
4375
4379
|
}
|
|
@@ -4430,7 +4434,7 @@ var login_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai
|
|
|
4430
4434
|
);
|
|
4431
4435
|
}
|
|
4432
4436
|
if (url.startsWith("/api/user/login/profile/")) {
|
|
4433
|
-
const us = _optionalChain([req, 'optionalAccess',
|
|
4437
|
+
const us = _optionalChain([req, 'optionalAccess', _535 => _535.Userinfo, 'optionalAccess', _536 => _536[0]]);
|
|
4434
4438
|
if (!us) return sendErr(res, "AUTH_UNAUTHORIZED", void 0, opt);
|
|
4435
4439
|
const user = await store.findByUsername(String(us));
|
|
4436
4440
|
return sendSuccess(res, { user: user ? publicUser($asai, user) : null }, opt);
|
|
@@ -4472,16 +4476,16 @@ var As_default = {
|
|
|
4472
4476
|
return { code: 908, data: val };
|
|
4473
4477
|
},
|
|
4474
4478
|
ctxSuccess(val, opt = null) {
|
|
4475
|
-
if (typeof _optionalChain([opt, 'optionalAccess',
|
|
4479
|
+
if (typeof _optionalChain([opt, 'optionalAccess', _537 => _537.resAES]) === "function") {
|
|
4476
4480
|
val = opt.resAES(val);
|
|
4477
4481
|
}
|
|
4478
4482
|
return { code: 909, data: val };
|
|
4479
4483
|
},
|
|
4480
4484
|
getPath(str = "-") {
|
|
4481
|
-
return _optionalChain([str, 'optionalAccess',
|
|
4485
|
+
return _optionalChain([str, 'optionalAccess', _538 => _538.replace, 'call', _539 => _539(/[^a-zA-Z0-9.\-_\\\/]/g, "")]);
|
|
4482
4486
|
},
|
|
4483
4487
|
getName(str = "-") {
|
|
4484
|
-
return _optionalChain([str, 'optionalAccess',
|
|
4488
|
+
return _optionalChain([str, 'optionalAccess', _540 => _540.replace, 'call', _541 => _541(/[^a-zA-Z0-9.\-_]/g, "")]);
|
|
4485
4489
|
},
|
|
4486
4490
|
toDirPath(relativePath) {
|
|
4487
4491
|
const pathArr = relativePath.split("/");
|
|
@@ -4552,7 +4556,7 @@ var As_default = {
|
|
|
4552
4556
|
// immediate: false,
|
|
4553
4557
|
// });
|
|
4554
4558
|
dtImmediate(fn, opt) {
|
|
4555
|
-
if (_optionalChain([opt, 'optionalAccess',
|
|
4559
|
+
if (_optionalChain([opt, 'optionalAccess', _542 => _542.immediate])) {
|
|
4556
4560
|
fn();
|
|
4557
4561
|
opt.immediate = false;
|
|
4558
4562
|
}
|
|
@@ -4574,7 +4578,7 @@ var As_default = {
|
|
|
4574
4578
|
if (opt.endtime - opt.starttime < opt.wait) {
|
|
4575
4579
|
this.dtClearTimeout(opt);
|
|
4576
4580
|
}
|
|
4577
|
-
if (!_optionalChain([opt, 'optionalAccess',
|
|
4581
|
+
if (!_optionalChain([opt, 'optionalAccess', _543 => _543.timeout])) {
|
|
4578
4582
|
opt.starttime = opt.endtime;
|
|
4579
4583
|
opt.timeout = this.dtSetTimeout(fn, opt);
|
|
4580
4584
|
}
|
|
@@ -4582,7 +4586,7 @@ var As_default = {
|
|
|
4582
4586
|
// 节流:指定长度时间内有多次触发,只fn最后一次触发
|
|
4583
4587
|
throttle(fn, opt) {
|
|
4584
4588
|
this.dtImmediate(fn, opt);
|
|
4585
|
-
if (!_optionalChain([opt, 'optionalAccess',
|
|
4589
|
+
if (!_optionalChain([opt, 'optionalAccess', _544 => _544.timeout])) {
|
|
4586
4590
|
opt.timeout = this.dtSetTimeout(fn, opt);
|
|
4587
4591
|
}
|
|
4588
4592
|
},
|
|
@@ -4618,8 +4622,8 @@ var As_default = {
|
|
|
4618
4622
|
var AsCode_default = {
|
|
4619
4623
|
// 加密
|
|
4620
4624
|
asencode(str, keys) {
|
|
4621
|
-
const strlen = _optionalChain([str, 'optionalAccess',
|
|
4622
|
-
const keyslen = _optionalChain([keys, 'optionalAccess',
|
|
4625
|
+
const strlen = _optionalChain([str, 'optionalAccess', _545 => _545.length]) || 0;
|
|
4626
|
+
const keyslen = _optionalChain([keys, 'optionalAccess', _546 => _546.length]) || 0;
|
|
4623
4627
|
let newstr = "";
|
|
4624
4628
|
for (let i = 0; i < strlen; i++) {
|
|
4625
4629
|
const rnum = Math.round(Math.random() * 1e3) % keyslen;
|
|
@@ -4644,7 +4648,7 @@ var AsCode_default = {
|
|
|
4644
4648
|
const rnum = keys.indexOf(str[i + 3]);
|
|
4645
4649
|
const rnumx = Number(rnum.toString().slice(-1)) + 1;
|
|
4646
4650
|
const ylen = keyslen - rnumx;
|
|
4647
|
-
newstr += _optionalChain([String, 'optionalAccess',
|
|
4651
|
+
newstr += _optionalChain([String, 'optionalAccess', _547 => _547.fromCodePoint, 'call', _548 => _548(
|
|
4648
4652
|
(keys.indexOf(str[i++]) - rnumx) * ylen * ylen + (keys.indexOf(str[i++]) - rnumx) * ylen + (keys.indexOf(str[i++]) - rnumx)
|
|
4649
4653
|
)]);
|
|
4650
4654
|
}
|
|
@@ -4727,7 +4731,7 @@ var AsAES_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai
|
|
|
4727
4731
|
}
|
|
4728
4732
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, decrypt, "decrypt");
|
|
4729
4733
|
function validateFields(payload, fields) {
|
|
4730
|
-
return fields.every((key) => typeof _optionalChain([payload, 'optionalAccess',
|
|
4734
|
+
return fields.every((key) => typeof _optionalChain([payload, 'optionalAccess', _549 => _549[key]]) === "string" && payload[key].length > 0);
|
|
4731
4735
|
}
|
|
4732
4736
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, validateFields, "validateFields");
|
|
4733
4737
|
function reqAES(opt, fn = (data) => data) {
|
|
@@ -4735,7 +4739,7 @@ var AsAES_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai
|
|
|
4735
4739
|
try {
|
|
4736
4740
|
if (validateFields(reqData, ["data", "iv", "auth"])) {
|
|
4737
4741
|
let aesData = decrypt(reqData);
|
|
4738
|
-
if (_optionalChain([reqData, 'optionalAccess',
|
|
4742
|
+
if (_optionalChain([reqData, 'optionalAccess', _550 => _550.aes]) === 2) {
|
|
4739
4743
|
aesData = JSON.parse(aesData);
|
|
4740
4744
|
}
|
|
4741
4745
|
return fn(aesData);
|
|
@@ -4769,24 +4773,24 @@ var AsAES_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai
|
|
|
4769
4773
|
// src/sysserver/lib/common/AsDb.ts
|
|
4770
4774
|
var AsDb_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai, cfg) => {
|
|
4771
4775
|
const DataServer = _chunk2BCIIKRGcjs.getDataServerForAsDb.call(void 0, $asai, {
|
|
4772
|
-
type: _optionalChain([cfg, 'optionalAccess',
|
|
4776
|
+
type: _optionalChain([cfg, 'optionalAccess', _551 => _551.type]) || "sqlite",
|
|
4773
4777
|
opt: {
|
|
4774
|
-
..._optionalChain([cfg, 'optionalAccess',
|
|
4778
|
+
..._optionalChain([cfg, 'optionalAccess', _552 => _552.opt]) || {
|
|
4775
4779
|
database: "./webdata/webdb/sqlite/asaisqlite.db",
|
|
4776
4780
|
create: 1
|
|
4777
4781
|
}
|
|
4778
4782
|
},
|
|
4779
|
-
storeKey: _optionalChain([cfg, 'optionalAccess',
|
|
4783
|
+
storeKey: _optionalChain([cfg, 'optionalAccess', _553 => _553.storeKey])
|
|
4780
4784
|
});
|
|
4781
4785
|
function reqwherestr(str) {
|
|
4782
|
-
if (_optionalChain([cfg, 'optionalAccess',
|
|
4786
|
+
if (_optionalChain([cfg, 'optionalAccess', _554 => _554.type]) === "sqlite" || _optionalChain([cfg, 'optionalAccess', _555 => _555.type]) === "mysql") {
|
|
4783
4787
|
return `'${str}'`;
|
|
4784
4788
|
}
|
|
4785
4789
|
return str;
|
|
4786
4790
|
}
|
|
4787
4791
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, reqwherestr, "reqwherestr");
|
|
4788
4792
|
function reqfield(queryData) {
|
|
4789
|
-
if (_optionalChain([queryData, 'optionalAccess',
|
|
4793
|
+
if (_optionalChain([queryData, 'optionalAccess', _556 => _556.fd])) {
|
|
4790
4794
|
return queryData.fd.split("-");
|
|
4791
4795
|
}
|
|
4792
4796
|
return cfg.field.data;
|
|
@@ -4794,14 +4798,14 @@ var AsDb_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai,
|
|
|
4794
4798
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, reqfield, "reqfield");
|
|
4795
4799
|
function reqwhere(queryData) {
|
|
4796
4800
|
const wheretmp = [];
|
|
4797
|
-
if ((_optionalChain([cfg, 'optionalAccess',
|
|
4801
|
+
if ((_optionalChain([cfg, 'optionalAccess', _557 => _557.type]) === "sqlite" || _optionalChain([cfg, 'optionalAccess', _558 => _558.type]) === "mysql") && _optionalChain([queryData, 'optionalAccess', _559 => _559.wlv])) {
|
|
4798
4802
|
const wlvarr = queryData.wlv.split("-");
|
|
4799
4803
|
wheretmp.push([wlvarr[0], ">", Number(wlvarr[1] || 0)]);
|
|
4800
4804
|
}
|
|
4801
|
-
if (_optionalChain([queryData, 'optionalAccess',
|
|
4805
|
+
if (_optionalChain([queryData, 'optionalAccess', _560 => _560.fl])) {
|
|
4802
4806
|
wheretmp.push([cfg.field.class, "LIKE", reqwherestr(`${queryData.fl}%`)]);
|
|
4803
4807
|
}
|
|
4804
|
-
if (_optionalChain([queryData, 'optionalAccess',
|
|
4808
|
+
if (_optionalChain([queryData, 'optionalAccess', _561 => _561.ss]) && _optionalChain([queryData, 'optionalAccess', _562 => _562.ssty])) {
|
|
4805
4809
|
wheretmp.push([queryData.ssty, "LIKE", reqwherestr(`%${queryData.ss}%`)]);
|
|
4806
4810
|
}
|
|
4807
4811
|
if (wheretmp.length > 1) {
|
|
@@ -4812,16 +4816,16 @@ var AsDb_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai,
|
|
|
4812
4816
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, reqwhere, "reqwhere");
|
|
4813
4817
|
function reqorder(queryData) {
|
|
4814
4818
|
const ordertmp = [];
|
|
4815
|
-
if (_optionalChain([queryData, 'optionalAccess',
|
|
4816
|
-
ordertmp.push([queryData.sx, _optionalChain([queryData, 'optionalAccess',
|
|
4819
|
+
if (_optionalChain([queryData, 'optionalAccess', _563 => _563.sx])) {
|
|
4820
|
+
ordertmp.push([queryData.sx, _optionalChain([queryData, 'optionalAccess', _564 => _564.sxty]) == 1 ? "DESC" : "ASC"]);
|
|
4817
4821
|
}
|
|
4818
4822
|
return ordertmp;
|
|
4819
4823
|
}
|
|
4820
4824
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, reqorder, "reqorder");
|
|
4821
4825
|
function reqlimit(queryData) {
|
|
4822
4826
|
let limittmp = "";
|
|
4823
|
-
let limitps = _optionalChain([queryData, 'optionalAccess',
|
|
4824
|
-
if (_optionalChain([queryData, 'optionalAccess',
|
|
4827
|
+
let limitps = _optionalChain([queryData, 'optionalAccess', _565 => _565.ps]);
|
|
4828
|
+
if (_optionalChain([queryData, 'optionalAccess', _566 => _566.pg])) {
|
|
4825
4829
|
limitps = limitps || 20;
|
|
4826
4830
|
limittmp = `${(queryData.pg - 1) * limitps},${limitps}`;
|
|
4827
4831
|
} else if (limitps) {
|
|
@@ -4874,8 +4878,8 @@ var AsDb_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai,
|
|
|
4874
4878
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, fileKeyFromSegment, "fileKeyFromSegment");
|
|
4875
4879
|
function getSqlParamsByUrl(req, opt) {
|
|
4876
4880
|
let tmpSqlParams;
|
|
4877
|
-
const reqArr = _optionalChain([req, 'optionalAccess',
|
|
4878
|
-
const table = (_optionalChain([opt, 'optionalAccess',
|
|
4881
|
+
const reqArr = _optionalChain([req, 'optionalAccess', _567 => _567.url, 'optionalAccess', _568 => _568.split, 'call', _569 => _569("?"), 'access', _570 => _570[0], 'optionalAccess', _571 => _571.split, 'call', _572 => _572("/")]) || [];
|
|
4882
|
+
const table = (_optionalChain([opt, 'optionalAccess', _573 => _573.qrdata, 'optionalAccess', _574 => _574.table]) || _optionalChain([opt, 'optionalAccess', _575 => _575.data, 'optionalAccess', _576 => _576.table]) || reqArr[3]).replaceAll("_", "/");
|
|
4879
4883
|
if (!table) return tmpSqlParams;
|
|
4880
4884
|
tmpSqlParams = {
|
|
4881
4885
|
type: "select",
|
|
@@ -4884,7 +4888,7 @@ var AsDb_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai,
|
|
|
4884
4888
|
if (reqArr[5]) {
|
|
4885
4889
|
if (reqArr[4] === "insert") {
|
|
4886
4890
|
tmpSqlParams.type = reqArr[4];
|
|
4887
|
-
if (_optionalChain([cfg, 'optionalAccess',
|
|
4891
|
+
if (_optionalChain([cfg, 'optionalAccess', _577 => _577.type]) === "file") {
|
|
4888
4892
|
const { name: bodyName, content } = parseFileBody(opt.data);
|
|
4889
4893
|
const fileKey = fileKeyFromSegment(reqArr[5], bodyName);
|
|
4890
4894
|
tmpSqlParams.field = cfg.field.data;
|
|
@@ -4908,11 +4912,11 @@ var AsDb_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai,
|
|
|
4908
4912
|
}
|
|
4909
4913
|
} else if (reqArr[4] === "update") {
|
|
4910
4914
|
tmpSqlParams.type = reqArr[4];
|
|
4911
|
-
const rowKey = _optionalChain([cfg, 'optionalAccess',
|
|
4915
|
+
const rowKey = _optionalChain([cfg, 'optionalAccess', _578 => _578.type]) === "file" ? fileKeyFromSegment(reqArr[5]) : decodePathSegment(reqArr[5]);
|
|
4912
4916
|
tmpSqlParams.where = [[cfg.field.key, "=", reqwherestr(rowKey)]];
|
|
4913
|
-
if (_optionalChain([cfg, 'optionalAccess',
|
|
4917
|
+
if (_optionalChain([cfg, 'optionalAccess', _579 => _579.type]) === "file") {
|
|
4914
4918
|
const { content } = parseFileBody(opt.data);
|
|
4915
|
-
const contentField = _optionalChain([cfg, 'access',
|
|
4919
|
+
const contentField = _optionalChain([cfg, 'access', _580 => _580.field, 'access', _581 => _581.data, 'optionalAccess', _582 => _582[1]]) || "content";
|
|
4916
4920
|
tmpSqlParams.set = [[contentField, fileContentString(content)]];
|
|
4917
4921
|
} else {
|
|
4918
4922
|
tmpSqlParams.set = [];
|
|
@@ -4929,18 +4933,18 @@ var AsDb_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai,
|
|
|
4929
4933
|
}
|
|
4930
4934
|
} else if (reqArr[4] === "delete") {
|
|
4931
4935
|
tmpSqlParams.type = reqArr[4];
|
|
4932
|
-
const rowKey = _optionalChain([cfg, 'optionalAccess',
|
|
4936
|
+
const rowKey = _optionalChain([cfg, 'optionalAccess', _583 => _583.type]) === "file" ? fileKeyFromSegment(reqArr[5]) : decodePathSegment(reqArr[5]);
|
|
4933
4937
|
tmpSqlParams.where = [[cfg.field.key, "=", reqwherestr(rowKey)]];
|
|
4934
4938
|
} else {
|
|
4935
|
-
if (_optionalChain([cfg, 'optionalAccess',
|
|
4939
|
+
if (_optionalChain([cfg, 'optionalAccess', _584 => _584.as]) > 1) {
|
|
4936
4940
|
tmpSqlParams.as = +cfg.as - 1;
|
|
4937
4941
|
}
|
|
4938
4942
|
tmpSqlParams.field = cfg.field.data;
|
|
4939
|
-
const rowKey = _optionalChain([cfg, 'optionalAccess',
|
|
4943
|
+
const rowKey = _optionalChain([cfg, 'optionalAccess', _585 => _585.type]) === "file" ? fileKeyFromSegment(reqArr[5]) : decodePathSegment(reqArr[5]);
|
|
4940
4944
|
tmpSqlParams.where = [[cfg.field.key, "=", reqwherestr(rowKey)]];
|
|
4941
4945
|
}
|
|
4942
4946
|
} else {
|
|
4943
|
-
tmpSqlParams.as = _optionalChain([cfg, 'optionalAccess',
|
|
4947
|
+
tmpSqlParams.as = _optionalChain([cfg, 'optionalAccess', _586 => _586.as]);
|
|
4944
4948
|
tmpSqlParams.field = reqfield(opt.data);
|
|
4945
4949
|
tmpSqlParams.where = reqwhere(opt.data);
|
|
4946
4950
|
tmpSqlParams.order = reqorder(opt.data);
|
|
@@ -4950,8 +4954,8 @@ var AsDb_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai,
|
|
|
4950
4954
|
}
|
|
4951
4955
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, getSqlParamsByUrl, "getSqlParamsByUrl");
|
|
4952
4956
|
function dbFresh(req, resdb) {
|
|
4953
|
-
if (_optionalChain([req, 'optionalAccess',
|
|
4954
|
-
const list = Array.isArray(resdb) ? resdb : _optionalChain([resdb, 'optionalAccess',
|
|
4957
|
+
if (_optionalChain([req, 'optionalAccess', _587 => _587.url, 'optionalAccess', _588 => _588.includes, 'call', _589 => _589("/selectlist/")])) {
|
|
4958
|
+
const list = Array.isArray(resdb) ? resdb : _optionalChain([resdb, 'optionalAccess', _590 => _590.data]);
|
|
4955
4959
|
if (Array.isArray(list)) {
|
|
4956
4960
|
const names = list.map((el) => {
|
|
4957
4961
|
if (typeof el === "string") {
|
|
@@ -4974,12 +4978,12 @@ var AsDb_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai,
|
|
|
4974
4978
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, dbFresh, "dbFresh");
|
|
4975
4979
|
function normalizeSelectResult(params, resdb) {
|
|
4976
4980
|
let data = resdb;
|
|
4977
|
-
if (_optionalChain([params, 'optionalAccess',
|
|
4981
|
+
if (_optionalChain([params, 'optionalAccess', _591 => _591.where, 'optionalAccess', _592 => _592.length]) && Array.isArray(data) && data.length === 1) {
|
|
4978
4982
|
data = data[0];
|
|
4979
4983
|
}
|
|
4980
|
-
if (_optionalChain([cfg, 'optionalAccess',
|
|
4981
|
-
const nameKey = _optionalChain([cfg, 'access',
|
|
4982
|
-
const contentKey = _optionalChain([cfg, 'access',
|
|
4984
|
+
if (_optionalChain([cfg, 'optionalAccess', _593 => _593.type]) === "file" && data && typeof data === "object" && !Array.isArray(data)) {
|
|
4985
|
+
const nameKey = _optionalChain([cfg, 'access', _594 => _594.field, 'optionalAccess', _595 => _595.data, 'optionalAccess', _596 => _596[0]]) || "name";
|
|
4986
|
+
const contentKey = _optionalChain([cfg, 'access', _597 => _597.field, 'optionalAccess', _598 => _598.data, 'optionalAccess', _599 => _599[1]]) || "content";
|
|
4983
4987
|
if (data[nameKey] != null) {
|
|
4984
4988
|
data[nameKey] = bareFileName(String(data[nameKey]));
|
|
4985
4989
|
}
|
|
@@ -4998,8 +5002,10 @@ var AsDb_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai,
|
|
|
4998
5002
|
}
|
|
4999
5003
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, normalizeSelectResult, "normalizeSelectResult");
|
|
5000
5004
|
function dbCodePm(req, resdb) {
|
|
5001
|
-
if (_optionalChain([req, 'optionalAccess',
|
|
5002
|
-
resdb
|
|
5005
|
+
if (_optionalChain([req, 'optionalAccess', _600 => _600.Userinfo]) && _optionalChain([req, 'optionalAccess', _601 => _601.Userinfo, 'access', _602 => _602[2]])) {
|
|
5006
|
+
if (resdb != null && typeof resdb === "object") {
|
|
5007
|
+
resdb.data = $asai.$lib.AsCode.asencode(JSON.stringify(resdb.data), req.Userinfo[2]);
|
|
5008
|
+
}
|
|
5003
5009
|
}
|
|
5004
5010
|
return resdb;
|
|
5005
5011
|
}
|
|
@@ -5010,8 +5016,8 @@ var AsDb_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai,
|
|
|
5010
5016
|
DataServer.sqlDb(params).then((resdb) => {
|
|
5011
5017
|
res.end(JSON.stringify($asai.$lib.As.ctxSuccess(dbCodePm(req, dbFresh(req, resdb)), opt)));
|
|
5012
5018
|
}).catch((errdb) => {
|
|
5013
|
-
const msg = String(_optionalChain([errdb, 'optionalAccess',
|
|
5014
|
-
if (_optionalChain([params, 'optionalAccess',
|
|
5019
|
+
const msg = String(_optionalChain([errdb, 'optionalAccess', _603 => _603.message]) || errdb || "");
|
|
5020
|
+
if (_optionalChain([params, 'optionalAccess', _604 => _604.type]) === "select" && msg.includes("no such table")) {
|
|
5015
5021
|
res.end(JSON.stringify($asai.$lib.As.ctxSuccess([], opt)));
|
|
5016
5022
|
return;
|
|
5017
5023
|
}
|
|
@@ -5028,23 +5034,23 @@ var AsDb_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai,
|
|
|
5028
5034
|
try {
|
|
5029
5035
|
DataServer.sqlDb(params).then((resdb) => {
|
|
5030
5036
|
let resData = normalizeSelectResult(params, dbFresh(req, resdb));
|
|
5031
|
-
if (_optionalChain([params, 'optionalAccess',
|
|
5037
|
+
if (_optionalChain([params, 'optionalAccess', _605 => _605.as]) === 2 && _optionalChain([params, 'optionalAccess', _606 => _606.field, 'optionalAccess', _607 => _607.length]) > 1) {
|
|
5032
5038
|
let limitArr = [];
|
|
5033
|
-
if (_optionalChain([params, 'access',
|
|
5034
|
-
limitArr = [0, +_optionalChain([params, 'access',
|
|
5039
|
+
if (_optionalChain([params, 'access', _608 => _608.limit, 'optionalAccess', _609 => _609.split, 'call', _610 => _610(","), 'optionalAccess', _611 => _611.length]) < 2) {
|
|
5040
|
+
limitArr = [0, +_optionalChain([params, 'access', _612 => _612.limit, 'optionalAccess', _613 => _613.split, 'call', _614 => _614(","), 'optionalAccess', _615 => _615[0]])];
|
|
5035
5041
|
} else {
|
|
5036
5042
|
limitArr = params.limit.split(",");
|
|
5037
5043
|
limitArr = [+limitArr[0], +limitArr[0] + +limitArr[1]];
|
|
5038
5044
|
}
|
|
5039
|
-
if (_optionalChain([resData, 'access',
|
|
5045
|
+
if (_optionalChain([resData, 'access', _616 => _616.data, 'optionalAccess', _617 => _617.length])) {
|
|
5040
5046
|
resData.data = resData.data.slice(+limitArr[0], +limitArr[1]);
|
|
5041
5047
|
}
|
|
5042
5048
|
}
|
|
5043
5049
|
resData = dbCodePm(req, resData);
|
|
5044
5050
|
res.end(JSON.stringify($asai.$lib.As.ctxSuccess(resData, opt)));
|
|
5045
5051
|
}).catch((errdb) => {
|
|
5046
|
-
const msg = String(_optionalChain([errdb, 'optionalAccess',
|
|
5047
|
-
if (_optionalChain([params, 'optionalAccess',
|
|
5052
|
+
const msg = String(_optionalChain([errdb, 'optionalAccess', _618 => _618.message]) || errdb || "");
|
|
5053
|
+
if (_optionalChain([params, 'optionalAccess', _619 => _619.type]) === "select" && msg.includes("no such table")) {
|
|
5048
5054
|
res.end(JSON.stringify($asai.$lib.As.ctxSuccess([], opt)));
|
|
5049
5055
|
return;
|
|
5050
5056
|
}
|
|
@@ -5059,7 +5065,7 @@ var AsDb_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai,
|
|
|
5059
5065
|
}
|
|
5060
5066
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, runDefaultGet, "runDefaultGet");
|
|
5061
5067
|
function post(req, res, hostdir, opt) {
|
|
5062
|
-
if (_optionalChain([cfg, 'optionalAccess',
|
|
5068
|
+
if (_optionalChain([cfg, 'optionalAccess', _620 => _620.post]) && typeof cfg.post === "function") {
|
|
5063
5069
|
Promise.resolve(cfg.post(req, res, hostdir, opt, DataServer)).then((reqstat) => {
|
|
5064
5070
|
if (!reqstat) runDefaultPost(req, res, opt);
|
|
5065
5071
|
}).catch((errdb) => {
|
|
@@ -5071,7 +5077,7 @@ var AsDb_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($asai,
|
|
|
5071
5077
|
}
|
|
5072
5078
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, post, "post");
|
|
5073
5079
|
function get(req, res, hostdir, opt) {
|
|
5074
|
-
if (_optionalChain([cfg, 'optionalAccess',
|
|
5080
|
+
if (_optionalChain([cfg, 'optionalAccess', _621 => _621.get]) && typeof cfg.get === "function") {
|
|
5075
5081
|
Promise.resolve(cfg.get(req, res, hostdir, opt, DataServer)).then((reqstat) => {
|
|
5076
5082
|
if (!reqstat) runDefaultGet(req, res, opt);
|
|
5077
5083
|
}).catch((errdb) => {
|
|
@@ -5096,7 +5102,7 @@ var reqWork_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($as
|
|
|
5096
5102
|
}
|
|
5097
5103
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, hostDefault2, "hostDefault");
|
|
5098
5104
|
function getPathFromOpt(opt) {
|
|
5099
|
-
const rawPath = _optionalChain([opt, 'access',
|
|
5105
|
+
const rawPath = _optionalChain([opt, 'access', _622 => _622.qrdata, 'optionalAccess', _623 => _623.path]) || _optionalChain([opt, 'access', _624 => _624.data, 'optionalAccess', _625 => _625.path]);
|
|
5100
5106
|
return decodeURIComponent(rawPath);
|
|
5101
5107
|
}
|
|
5102
5108
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, getPathFromOpt, "getPathFromOpt");
|
|
@@ -5106,18 +5112,18 @@ var reqWork_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($as
|
|
|
5106
5112
|
}
|
|
5107
5113
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, sendSuccess, "sendSuccess");
|
|
5108
5114
|
function sendErr(res, ec, params, opt) {
|
|
5109
|
-
const ErrorCode = _optionalChain([$asai, 'access',
|
|
5110
|
-
_optionalChain([ErrorCode, 'optionalAccess',
|
|
5111
|
-
_optionalChain([ErrorCode, 'optionalAccess',
|
|
5115
|
+
const ErrorCode = _optionalChain([$asai, 'access', _626 => _626.$lib, 'optionalAccess', _627 => _627.ErrorCode]);
|
|
5116
|
+
_optionalChain([ErrorCode, 'optionalAccess', _628 => _628.loadErrorCodes, 'optionalCall', _629 => _629($asai)]);
|
|
5117
|
+
_optionalChain([ErrorCode, 'optionalAccess', _630 => _630.logError, 'optionalCall', _631 => _631($asai, ec, Array.isArray(params) ? params.map(String) : params != null ? [String(params)] : void 0)]);
|
|
5112
5118
|
const response = $asai.$lib.As.ctxErr(ec, params, opt);
|
|
5113
5119
|
res.end(JSON.stringify(response));
|
|
5114
5120
|
}
|
|
5115
5121
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, sendErr, "sendErr");
|
|
5116
5122
|
function sendFail(res, err, opt) {
|
|
5117
|
-
const ErrorCode = _optionalChain([$asai, 'access',
|
|
5118
|
-
_optionalChain([ErrorCode, 'optionalAccess',
|
|
5119
|
-
const normalized = _optionalChain([ErrorCode, 'optionalAccess',
|
|
5120
|
-
if (_optionalChain([normalized, 'optionalAccess',
|
|
5123
|
+
const ErrorCode = _optionalChain([$asai, 'access', _632 => _632.$lib, 'optionalAccess', _633 => _633.ErrorCode]);
|
|
5124
|
+
_optionalChain([ErrorCode, 'optionalAccess', _634 => _634.loadErrorCodes, 'optionalCall', _635 => _635($asai)]);
|
|
5125
|
+
const normalized = _optionalChain([ErrorCode, 'optionalAccess', _636 => _636.normalizeErrPayload, 'optionalCall', _637 => _637(err)]);
|
|
5126
|
+
if (_optionalChain([normalized, 'optionalAccess', _638 => _638.ec])) {
|
|
5121
5127
|
return sendErr(res, normalized.ec, normalized.pm, opt);
|
|
5122
5128
|
}
|
|
5123
5129
|
const response = $asai.$lib.As.ctxFail(err);
|
|
@@ -5125,7 +5131,7 @@ var reqWork_default = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, ($as
|
|
|
5125
5131
|
}
|
|
5126
5132
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, sendFail, "sendFail");
|
|
5127
5133
|
function mnLog(...arg) {
|
|
5128
|
-
(_optionalChain([$asai, 'optionalAccess',
|
|
5134
|
+
(_optionalChain([$asai, 'optionalAccess', _639 => _639.$log]) || console.log)(...arg);
|
|
5129
5135
|
}
|
|
5130
5136
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, mnLog, "mnLog");
|
|
5131
5137
|
return { hostDefault: hostDefault2, getPathFromOpt, sendSuccess, sendFail, sendErr, mnLog };
|
|
@@ -5225,7 +5231,7 @@ async function removeFile(filePath) {
|
|
|
5225
5231
|
try {
|
|
5226
5232
|
await _promises2.default.unlink(nodePath2.default.normalize(filePath));
|
|
5227
5233
|
} catch (err) {
|
|
5228
|
-
if (_optionalChain([err, 'optionalAccess',
|
|
5234
|
+
if (_optionalChain([err, 'optionalAccess', _640 => _640.code]) !== "ENOENT") throw err;
|
|
5229
5235
|
}
|
|
5230
5236
|
}
|
|
5231
5237
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, removeFile, "removeFile");
|
|
@@ -5263,7 +5269,7 @@ function isPkgRuntime() {
|
|
|
5263
5269
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, isPkgRuntime, "isPkgRuntime");
|
|
5264
5270
|
function getPkgSnapshotDir() {
|
|
5265
5271
|
if (!isPkgRuntime()) return void 0;
|
|
5266
|
-
const entry = _nullishCoalesce(_optionalChain([process, 'access',
|
|
5272
|
+
const entry = _nullishCoalesce(_optionalChain([process, 'access', _641 => _641.pkg, 'optionalAccess', _642 => _642.entrypoint]), () => ( _optionalChain([process, 'access', _643 => _643.pkg, 'optionalAccess', _644 => _644.defaultEntrypoint])));
|
|
5267
5273
|
if (!entry) return void 0;
|
|
5268
5274
|
return nodePath4.resolve(nodePath4.dirname(entry));
|
|
5269
5275
|
}
|
|
@@ -5617,7 +5623,7 @@ function dbDriver(opt = {}) {
|
|
|
5617
5623
|
this.baseDirAbs = path6.resolve(process.cwd(), config.dir);
|
|
5618
5624
|
}
|
|
5619
5625
|
dbLog(...args) {
|
|
5620
|
-
(_optionalChain([this, 'access',
|
|
5626
|
+
(_optionalChain([this, 'access', _645 => _645.config, 'optionalAccess', _646 => _646.$asai, 'optionalAccess', _647 => _647.$log]) || console.log)("FILE", ...args);
|
|
5621
5627
|
}
|
|
5622
5628
|
checkFile(file) {
|
|
5623
5629
|
return fs11.existsSync(this.getAbsPath(file, false));
|
|
@@ -5683,7 +5689,7 @@ function dbDriver(opt = {}) {
|
|
|
5683
5689
|
}
|
|
5684
5690
|
getReadPath(file, sql) {
|
|
5685
5691
|
const candidates = [];
|
|
5686
|
-
if (_optionalChain([sql, 'optionalAccess',
|
|
5692
|
+
if (_optionalChain([sql, 'optionalAccess', _648 => _648.filename])) {
|
|
5687
5693
|
candidates.push({ dir: path6.join(file, sql.filename) });
|
|
5688
5694
|
candidates.push({ dir: path6.join(file + ".delete" + this.fileExt, sql.filename) });
|
|
5689
5695
|
} else {
|
|
@@ -5703,20 +5709,20 @@ function dbDriver(opt = {}) {
|
|
|
5703
5709
|
if (!read2.path) {
|
|
5704
5710
|
return { path: "", dir: read2.dir };
|
|
5705
5711
|
}
|
|
5706
|
-
if (_optionalChain([sql, 'optionalAccess',
|
|
5712
|
+
if (_optionalChain([sql, 'optionalAccess', _649 => _649.filename])) {
|
|
5707
5713
|
return { path: path6.dirname(read2.path), dir: path6.dirname(read2.dir) };
|
|
5708
5714
|
}
|
|
5709
5715
|
return { path: read2.path, dir: read2.dir };
|
|
5710
5716
|
}
|
|
5711
5717
|
getNewPath(file, sql) {
|
|
5712
|
-
if (_optionalChain([sql, 'optionalAccess',
|
|
5718
|
+
if (_optionalChain([sql, 'optionalAccess', _650 => _650.filename])) {
|
|
5713
5719
|
return this.getAbsPath(path6.join(file, sql.filename), true);
|
|
5714
5720
|
}
|
|
5715
5721
|
return this.getAbsPath(file, true);
|
|
5716
5722
|
}
|
|
5717
5723
|
write(file, data, sql) {
|
|
5718
5724
|
try {
|
|
5719
|
-
const filePath = _optionalChain([sql, 'optionalAccess',
|
|
5725
|
+
const filePath = _optionalChain([sql, 'optionalAccess', _651 => _651.type]) === "insert" ? this.getNewPath(file, sql) : this.getReadPath(file, sql).path || this.getNewPath(file, sql);
|
|
5720
5726
|
this.dbLog("write", "[WRITE]", filePath);
|
|
5721
5727
|
fs11.writeFileSync(filePath, data, "utf8");
|
|
5722
5728
|
return "ok";
|
|
@@ -5746,11 +5752,11 @@ function dbDriver(opt = {}) {
|
|
|
5746
5752
|
if (!del.path) {
|
|
5747
5753
|
return "";
|
|
5748
5754
|
}
|
|
5749
|
-
if (this.fileDel && _optionalChain([sql, 'optionalAccess',
|
|
5755
|
+
if (this.fileDel && _optionalChain([sql, 'optionalAccess', _652 => _652.deltrue])) {
|
|
5750
5756
|
const target = del.path + ".delete" + this.fileExt;
|
|
5751
5757
|
this.dbLog("soft delete", "[SOFT DELETE]", `${del.path} -> ${target}`);
|
|
5752
5758
|
fs11.renameSync(del.path, target);
|
|
5753
|
-
} else if (_optionalChain([sql, 'optionalAccess',
|
|
5759
|
+
} else if (_optionalChain([sql, 'optionalAccess', _653 => _653.filename])) {
|
|
5754
5760
|
this.deldir(del.dir);
|
|
5755
5761
|
} else {
|
|
5756
5762
|
this.dbLog("delete", "[DELETE]", del.path);
|
|
@@ -5793,7 +5799,7 @@ function dbDriver(opt = {}) {
|
|
|
5793
5799
|
try {
|
|
5794
5800
|
entries = fs11.readdirSync(absDir, { withFileTypes: true });
|
|
5795
5801
|
} catch (e47) {
|
|
5796
|
-
return _optionalChain([sql, 'optionalAccess',
|
|
5802
|
+
return _optionalChain([sql, 'optionalAccess', _654 => _654.list]) ? { open: [], delete: [] } : [];
|
|
5797
5803
|
}
|
|
5798
5804
|
const result = { open: [], delete: [] };
|
|
5799
5805
|
const deleteSuffix = ".delete" + this.fileExt;
|
|
@@ -5808,14 +5814,14 @@ function dbDriver(opt = {}) {
|
|
|
5808
5814
|
const data = fs11.readFileSync(fullPath, "utf8");
|
|
5809
5815
|
const entryData = { data, file: baseName };
|
|
5810
5816
|
if (isDelete) {
|
|
5811
|
-
if (_optionalChain([sql, 'optionalAccess',
|
|
5817
|
+
if (_optionalChain([sql, 'optionalAccess', _655 => _655.list])) result.delete.push(entryData);
|
|
5812
5818
|
} else {
|
|
5813
5819
|
result.open.push(entryData);
|
|
5814
5820
|
}
|
|
5815
5821
|
} catch (e48) {
|
|
5816
5822
|
}
|
|
5817
5823
|
}
|
|
5818
|
-
return _optionalChain([sql, 'optionalAccess',
|
|
5824
|
+
return _optionalChain([sql, 'optionalAccess', _656 => _656.list]) ? result : result.open;
|
|
5819
5825
|
} catch (e) {
|
|
5820
5826
|
this.dbLog("list failed", "[LIST ERROR]", e);
|
|
5821
5827
|
return e;
|
|
@@ -5825,7 +5831,7 @@ function dbDriver(opt = {}) {
|
|
|
5825
5831
|
getFileNameFromWhere(where) {
|
|
5826
5832
|
if (!where || !Array.isArray(where)) return "";
|
|
5827
5833
|
const first = where.find((item) => Array.isArray(item));
|
|
5828
|
-
const raw = _optionalChain([first, 'optionalAccess',
|
|
5834
|
+
const raw = _optionalChain([first, 'optionalAccess', _657 => _657[2]]);
|
|
5829
5835
|
if (typeof raw === "string") {
|
|
5830
5836
|
return raw.replace(/^'+|'+$/g, "");
|
|
5831
5837
|
}
|
|
@@ -5850,15 +5856,15 @@ function dbDriver(opt = {}) {
|
|
|
5850
5856
|
const data = sql.set[0][1];
|
|
5851
5857
|
result = this.write(this.tableFilePath(sql.table, file), data, sql);
|
|
5852
5858
|
} else if (sql.type === "select") {
|
|
5853
|
-
if (_optionalChain([sql, 'optionalAccess',
|
|
5859
|
+
if (_optionalChain([sql, 'optionalAccess', _658 => _658.where, 'optionalAccess', _659 => _659.length]) && _optionalChain([sql, 'optionalAccess', _660 => _660.as]) !== 2) {
|
|
5854
5860
|
const file = this.getFileNameFromWhere(sql.where);
|
|
5855
5861
|
const readRes = this.read(this.tableFilePath(sql.table, file), sql);
|
|
5856
5862
|
const resObj = {};
|
|
5857
|
-
if (_optionalChain([readRes, 'optionalAccess',
|
|
5863
|
+
if (_optionalChain([readRes, 'optionalAccess', _661 => _661[0], 'optionalAccess', _662 => _662.file]) && !readRes.error) {
|
|
5858
5864
|
if (sql.as === 1) {
|
|
5859
5865
|
try {
|
|
5860
5866
|
const parsed = JSON.parse(readRes[0].data);
|
|
5861
|
-
if (_optionalChain([sql, 'access',
|
|
5867
|
+
if (_optionalChain([sql, 'access', _663 => _663.field, 'optionalAccess', _664 => _664.length])) {
|
|
5862
5868
|
sql.field.forEach((f) => {
|
|
5863
5869
|
resObj[f] = _nullishCoalesce(parsed[f], () => ( ""));
|
|
5864
5870
|
});
|
|
@@ -5879,7 +5885,7 @@ function dbDriver(opt = {}) {
|
|
|
5879
5885
|
} else {
|
|
5880
5886
|
const listRes = this.list(tableDir, sql);
|
|
5881
5887
|
if (listRes && !listRes.error) {
|
|
5882
|
-
if (_optionalChain([sql, 'optionalAccess',
|
|
5888
|
+
if (_optionalChain([sql, 'optionalAccess', _665 => _665.list])) {
|
|
5883
5889
|
const mapEntry = /* @__PURE__ */ _chunkSMVZ3ZDJcjs.__name.call(void 0, (el) => {
|
|
5884
5890
|
const fields = sql.field;
|
|
5885
5891
|
const item = { [fields[0]]: el.file };
|
|
@@ -5890,9 +5896,9 @@ function dbDriver(opt = {}) {
|
|
|
5890
5896
|
if (listRes.delete) listRes.delete = listRes.delete.map(mapEntry);
|
|
5891
5897
|
result = listRes;
|
|
5892
5898
|
} else {
|
|
5893
|
-
if (_optionalChain([sql, 'optionalAccess',
|
|
5899
|
+
if (_optionalChain([sql, 'optionalAccess', _666 => _666.as]) === 2) {
|
|
5894
5900
|
let items = listRes;
|
|
5895
|
-
if (_optionalChain([sql, 'access',
|
|
5901
|
+
if (_optionalChain([sql, 'access', _667 => _667.where, 'optionalAccess', _668 => _668.length])) {
|
|
5896
5902
|
const where = sql.where;
|
|
5897
5903
|
const whereType = typeof where[0] === "string" ? where[0] : "and";
|
|
5898
5904
|
items = items.filter((el) => {
|
|
@@ -5924,7 +5930,7 @@ function dbDriver(opt = {}) {
|
|
|
5924
5930
|
const obj = {};
|
|
5925
5931
|
try {
|
|
5926
5932
|
const parsed = JSON.parse(el.data);
|
|
5927
|
-
if (_optionalChain([sql, 'access',
|
|
5933
|
+
if (_optionalChain([sql, 'access', _669 => _669.field, 'optionalAccess', _670 => _670.length])) {
|
|
5928
5934
|
sql.field.forEach((f) => {
|
|
5929
5935
|
obj[f] = _nullishCoalesce(parsed[f], () => ( ""));
|
|
5930
5936
|
});
|
|
@@ -5935,7 +5941,7 @@ function dbDriver(opt = {}) {
|
|
|
5935
5941
|
}
|
|
5936
5942
|
return obj;
|
|
5937
5943
|
});
|
|
5938
|
-
if (_optionalChain([sql, 'access',
|
|
5944
|
+
if (_optionalChain([sql, 'access', _671 => _671.order, 'optionalAccess', _672 => _672.length])) {
|
|
5939
5945
|
const orderField = sql.order[0];
|
|
5940
5946
|
const orderFieldName = typeof orderField === "string" ? orderField : orderField[0];
|
|
5941
5947
|
const direction = typeof orderField === "string" ? "ASC" : String(orderField[1]).toUpperCase();
|
|
@@ -5956,7 +5962,7 @@ function dbDriver(opt = {}) {
|
|
|
5956
5962
|
}
|
|
5957
5963
|
}
|
|
5958
5964
|
} else {
|
|
5959
|
-
result = _optionalChain([sql, 'optionalAccess',
|
|
5965
|
+
result = _optionalChain([sql, 'optionalAccess', _673 => _673.list]) ? { open: [], delete: [] } : [];
|
|
5960
5966
|
}
|
|
5961
5967
|
}
|
|
5962
5968
|
}
|
|
@@ -6012,7 +6018,7 @@ function sysserver($asai, opt = {}) {
|
|
|
6012
6018
|
if (!$asai.$lib) $asai.$lib = {};
|
|
6013
6019
|
$asai.$lib = { ...lib_default, ...$asai.$lib, ...opt || {} };
|
|
6014
6020
|
$asai.dataserver = db_default;
|
|
6015
|
-
_optionalChain([$asai, 'access',
|
|
6021
|
+
_optionalChain([$asai, 'access', _674 => _674.$lib, 'access', _675 => _675.ErrorCode, 'optionalAccess', _676 => _676.loadErrorCodes, 'optionalCall', _677 => _677($asai)]);
|
|
6016
6022
|
if (!$asai.$lib.api) $asai.$lib.api = {};
|
|
6017
6023
|
$asai.$lib.api = { ...api_default, ...$asai.$lib.api };
|
|
6018
6024
|
if (!$asai.$lib.ws) $asai.$lib.ws = {};
|
|
@@ -6205,7 +6211,7 @@ function normalizeDataStoresConfig(cfg) {
|
|
|
6205
6211
|
}
|
|
6206
6212
|
if (userStore.opt.create == null) userStore.opt.create = 1;
|
|
6207
6213
|
}
|
|
6208
|
-
if (!stores.log && _optionalChain([cfg, 'access',
|
|
6214
|
+
if (!stores.log && _optionalChain([cfg, 'access', _678 => _678.logger, 'optionalAccess', _679 => _679.store])) {
|
|
6209
6215
|
const s = cfg.logger.store;
|
|
6210
6216
|
stores.log = {
|
|
6211
6217
|
type: s.type || "file",
|
|
@@ -6269,13 +6275,13 @@ function validateHostConfig(cfg) {
|
|
|
6269
6275
|
if (cfg.asaisn != null) {
|
|
6270
6276
|
errors.push("asaisn \u7981\u6B62\u5199\u5165 asaihost.json\uFF0C\u8BF7\u4F7F\u7528 ASAI_ASAISN");
|
|
6271
6277
|
}
|
|
6272
|
-
if (_optionalChain([cfg, 'access',
|
|
6278
|
+
if (_optionalChain([cfg, 'access', _680 => _680.aes, 'optionalAccess', _681 => _681.keybase64]) != null) {
|
|
6273
6279
|
errors.push("aes.keybase64 \u7981\u6B62\u5199\u5165 asaihost.json\uFF0C\u8BF7\u4F7F\u7528 ASAI_AES_KEYBASE64");
|
|
6274
6280
|
}
|
|
6275
|
-
if (_optionalChain([cfg, 'access',
|
|
6281
|
+
if (_optionalChain([cfg, 'access', _682 => _682.httpscert, 'optionalAccess', _683 => _683.key]) != null || _optionalChain([cfg, 'access', _684 => _684.httpscert, 'optionalAccess', _685 => _685.cert]) != null) {
|
|
6276
6282
|
errors.push("httpscert.key/cert \u7981\u6B62\u5185\u8054\u4E8E asaihost.json\uFF0C\u8BF7\u4F7F\u7528 keyPath/certPath \u6216\u73AF\u5883\u53D8\u91CF");
|
|
6277
6283
|
}
|
|
6278
|
-
if (_optionalChain([cfg, 'access',
|
|
6284
|
+
if (_optionalChain([cfg, 'access', _686 => _686.security, 'optionalAccess', _687 => _687.sessionSecret]) != null) {
|
|
6279
6285
|
errors.push("security.sessionSecret \u7981\u6B62\u5199\u5165 asaihost.json\uFF0C\u8BF7\u4F7F\u7528 ASAI_SESSION_SECRET");
|
|
6280
6286
|
}
|
|
6281
6287
|
if (Array.isArray(cfg.wssec) && typeof cfg.wssec[0] === "string" && cfg.wssec[0].length > 0) {
|
|
@@ -6330,10 +6336,10 @@ function validateHostConfig(cfg) {
|
|
|
6330
6336
|
validateHostSiteLimits(name, h, errors);
|
|
6331
6337
|
}
|
|
6332
6338
|
}
|
|
6333
|
-
if (_optionalChain([cfg, 'access',
|
|
6339
|
+
if (_optionalChain([cfg, 'access', _688 => _688.logger, 'optionalAccess', _689 => _689.sample]) && typeof cfg.logger.sample !== "object") {
|
|
6334
6340
|
errors.push('logger.sample \u5FC5\u987B\u4E3A\u5BF9\u8C61\uFF08\u5982 { "REQ_OTHER": 0.1 }\uFF09');
|
|
6335
6341
|
}
|
|
6336
|
-
if (_optionalChain([cfg, 'access',
|
|
6342
|
+
if (_optionalChain([cfg, 'access', _690 => _690.logger, 'optionalAccess', _691 => _691.skip]) != null && !Array.isArray(cfg.logger.skip)) {
|
|
6337
6343
|
errors.push('logger.skip \u5FC5\u987B\u4E3A\u5B57\u7B26\u4E32\u6570\u7EC4\uFF08\u5982 ["/sys/info/metrics"]\uFF09');
|
|
6338
6344
|
}
|
|
6339
6345
|
if (cfg.proxyhosts && typeof cfg.proxyhosts === "object") {
|
|
@@ -6367,7 +6373,7 @@ _chunkSMVZ3ZDJcjs.__name.call(void 0, validateHostSiteLimits, "validateHostSiteL
|
|
|
6367
6373
|
function validateProductionSecurity(cfg) {
|
|
6368
6374
|
const errors = [];
|
|
6369
6375
|
if (process.env.NODE_ENV !== "production") return errors;
|
|
6370
|
-
const sec = _optionalChain([cfg, 'optionalAccess',
|
|
6376
|
+
const sec = _optionalChain([cfg, 'optionalAccess', _692 => _692.security]);
|
|
6371
6377
|
if (!sec || typeof sec !== "object") {
|
|
6372
6378
|
errors.push("\u751F\u4EA7\u73AF\u5883\u5FC5\u987B\u914D\u7F6E security \u5BF9\u8C61");
|
|
6373
6379
|
return errors;
|
|
@@ -6378,7 +6384,7 @@ function validateProductionSecurity(cfg) {
|
|
|
6378
6384
|
if (sec.allowRegister === 1) {
|
|
6379
6385
|
errors.push("\u751F\u4EA7\u73AF\u5883 security.allowRegister \u5E94\u4E3A 0\uFF08CR 1.3 \u7981\u6B62\u5F00\u653E\u6CE8\u518C\uFF09");
|
|
6380
6386
|
}
|
|
6381
|
-
if (!_optionalChain([sec, 'access',
|
|
6387
|
+
if (!_optionalChain([sec, 'access', _693 => _693.quota, 'optionalAccess', _694 => _694.enabled])) {
|
|
6382
6388
|
errors.push("\u751F\u4EA7\u73AF\u5883 security.quota.enabled \u5E94\u4E3A 1\uFF08CR 7.1 \u8D44\u6E90\u9650\u5236\uFF09");
|
|
6383
6389
|
}
|
|
6384
6390
|
if (sec.csp !== 1) {
|
|
@@ -6387,7 +6393,7 @@ function validateProductionSecurity(cfg) {
|
|
|
6387
6393
|
if (typeof sec.minUserLevel !== "number" || sec.minUserLevel < 0) {
|
|
6388
6394
|
errors.push("\u751F\u4EA7\u73AF\u5883 security.minUserLevel \u5E94\u663E\u5F0F\u914D\u7F6E");
|
|
6389
6395
|
}
|
|
6390
|
-
if (sec.forceWss === 1 && !_optionalChain([cfg, 'optionalAccess',
|
|
6396
|
+
if (sec.forceWss === 1 && !_optionalChain([cfg, 'optionalAccess', _695 => _695.httpscert, 'optionalAccess', _696 => _696.keyPath]) && !_optionalChain([cfg, 'optionalAccess', _697 => _697.httpscert, 'optionalAccess', _698 => _698.key])) {
|
|
6391
6397
|
errors.push("\u751F\u4EA7\u73AF\u5883 security.forceWss=1 \u65F6\u9700\u914D\u7F6E HTTPS \u8BC1\u4E66");
|
|
6392
6398
|
}
|
|
6393
6399
|
return errors;
|
|
@@ -6406,12 +6412,12 @@ var DEFAULT_RECONNECT = {
|
|
|
6406
6412
|
rs485: { enabled: true, maxRetries: 60, initialDelay: 3e3, maxDelay: 3e4, factor: 2 }
|
|
6407
6413
|
};
|
|
6408
6414
|
function getTransportBlock(cfg, kind) {
|
|
6409
|
-
const block = _optionalChain([cfg, 'optionalAccess',
|
|
6415
|
+
const block = _optionalChain([cfg, 'optionalAccess', _699 => _699[kind]]);
|
|
6410
6416
|
return block && typeof block === "object" ? block : null;
|
|
6411
6417
|
}
|
|
6412
6418
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, getTransportBlock, "getTransportBlock");
|
|
6413
6419
|
function getTransportDefault(cfg, kind) {
|
|
6414
|
-
const def = _optionalChain([getTransportBlock, 'call',
|
|
6420
|
+
const def = _optionalChain([getTransportBlock, 'call', _700 => _700(cfg, kind), 'optionalAccess', _701 => _701.default]);
|
|
6415
6421
|
return def && typeof def === "object" ? def : null;
|
|
6416
6422
|
}
|
|
6417
6423
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, getTransportDefault, "getTransportDefault");
|
|
@@ -6421,7 +6427,7 @@ function hasTransportDefault(cfg, kind) {
|
|
|
6421
6427
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, hasTransportDefault, "hasTransportDefault");
|
|
6422
6428
|
function getDefaultConnId(cfg, kind) {
|
|
6423
6429
|
const def = getTransportDefault(cfg, kind);
|
|
6424
|
-
const id = _optionalChain([def, 'optionalAccess',
|
|
6430
|
+
const id = _optionalChain([def, 'optionalAccess', _702 => _702.id]);
|
|
6425
6431
|
return typeof id === "string" && id.length > 0 ? id : DEFAULT_CONN_ID[kind];
|
|
6426
6432
|
}
|
|
6427
6433
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, getDefaultConnId, "getDefaultConnId");
|
|
@@ -6432,14 +6438,14 @@ function shouldAutoConnect(def) {
|
|
|
6432
6438
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, shouldAutoConnect, "shouldAutoConnect");
|
|
6433
6439
|
function resolveReconnectOptions(def, kind, cfg) {
|
|
6434
6440
|
const base = DEFAULT_RECONNECT[kind];
|
|
6435
|
-
const rc = _optionalChain([def, 'optionalAccess',
|
|
6436
|
-
const tmMaxTry = _optionalChain([cfg, 'optionalAccess',
|
|
6441
|
+
const rc = _optionalChain([def, 'optionalAccess', _703 => _703.reconnect]);
|
|
6442
|
+
const tmMaxTry = _optionalChain([cfg, 'optionalAccess', _704 => _704.tm, 'optionalAccess', _705 => _705.maxtry]);
|
|
6437
6443
|
return {
|
|
6438
|
-
enabled: _optionalChain([rc, 'optionalAccess',
|
|
6439
|
-
maxRetries: _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([rc, 'optionalAccess',
|
|
6440
|
-
initialDelay: _nullishCoalesce(_nullishCoalesce(_optionalChain([rc, 'optionalAccess',
|
|
6441
|
-
maxDelay: _nullishCoalesce(_nullishCoalesce(_optionalChain([rc, 'optionalAccess',
|
|
6442
|
-
factor: _nullishCoalesce(_nullishCoalesce(_optionalChain([rc, 'optionalAccess',
|
|
6444
|
+
enabled: _optionalChain([rc, 'optionalAccess', _706 => _706.enabled]) !== false && base.enabled !== false,
|
|
6445
|
+
maxRetries: _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([rc, 'optionalAccess', _707 => _707.maxRetries]), () => ( tmMaxTry)), () => ( base.maxRetries)), () => ( 60)),
|
|
6446
|
+
initialDelay: _nullishCoalesce(_nullishCoalesce(_optionalChain([rc, 'optionalAccess', _708 => _708.initialDelay]), () => ( base.initialDelay)), () => ( 1e3)),
|
|
6447
|
+
maxDelay: _nullishCoalesce(_nullishCoalesce(_optionalChain([rc, 'optionalAccess', _709 => _709.maxDelay]), () => ( base.maxDelay)), () => ( 3e4)),
|
|
6448
|
+
factor: _nullishCoalesce(_nullishCoalesce(_optionalChain([rc, 'optionalAccess', _710 => _710.factor]), () => ( base.factor)), () => ( 2))
|
|
6443
6449
|
};
|
|
6444
6450
|
}
|
|
6445
6451
|
_chunkSMVZ3ZDJcjs.__name.call(void 0, resolveReconnectOptions, "resolveReconnectOptions");
|
|
@@ -6492,13 +6498,13 @@ function createTransportDataHandler($asai, manager) {
|
|
|
6492
6498
|
} catch (e52) {
|
|
6493
6499
|
}
|
|
6494
6500
|
}
|
|
6495
|
-
if (_optionalChain([event, 'access',
|
|
6501
|
+
if (_optionalChain([event, 'access', _711 => _711.data, 'optionalAccess', _712 => _712.id])) {
|
|
6496
6502
|
manager.watch(event.id, event.data);
|
|
6497
6503
|
return;
|
|
6498
6504
|
}
|
|
6499
6505
|
try {
|
|
6500
|
-
const wsKey = _optionalChain([$asai, 'optionalAccess',
|
|
6501
|
-
_optionalChain([$asai, 'access',
|
|
6506
|
+
const wsKey = _optionalChain([$asai, 'optionalAccess', _713 => _713.command, 'optionalAccess', _714 => _714.commandconfig, 'optionalAccess', _715 => _715.config, 'optionalAccess', _716 => _716.commandclient]);
|
|
6507
|
+
_optionalChain([$asai, 'access', _717 => _717.serversws, 'optionalAccess', _718 => _718[wsKey], 'optionalAccess', _719 => _719.broadws, 'optionalCall', _720 => _720(event.data)]);
|
|
6502
6508
|
} catch (e53) {
|
|
6503
6509
|
}
|
|
6504
6510
|
};
|
|
@@ -6571,7 +6577,7 @@ var initAsaiHostNodejs2 = {
|
|
|
6571
6577
|
createTransportDataHandler,
|
|
6572
6578
|
wireTransportConnectionLogs
|
|
6573
6579
|
};
|
|
6574
|
-
var PLUGIN_VERSION = true ? "0.0.
|
|
6580
|
+
var PLUGIN_VERSION = true ? "0.0.5" : "0.0.1";
|
|
6575
6581
|
var index_default = initAsaiHostNodejs2;
|
|
6576
6582
|
|
|
6577
6583
|
|