@ultrst-armada/krnl 1.0.2 → 1.0.3
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/README.md +67 -65
- package/package.json +12 -8
- package/packages/cli/dist/bin/krnl.cjs +793 -330
- package/packages/cli/dist/bin/krnl.js +50 -65
- package/packages/cli/dist/chunk-6SHSECXR.js +1628 -0
- package/packages/cli/dist/index.cjs +746 -262
- package/packages/cli/dist/index.d.cts +45 -2
- package/packages/cli/dist/index.d.ts +45 -2
- package/packages/cli/dist/index.js +5 -1
- package/packages/cli/package.json +17 -10
- package/packages/core/dist/index.cjs +2905 -139
- package/packages/core/dist/index.d.cts +611 -27
- package/packages/core/dist/index.d.ts +611 -27
- package/packages/core/dist/index.js +2897 -139
- package/packages/core/package.json +14 -6
- package/packages/create-krnl/dist/index.cjs +102 -65
- package/packages/create-krnl/dist/index.js +102 -65
- package/packages/create-krnl/package.json +5 -3
- package/packages/eslint-plugin/dist/index.cjs +17 -55
- package/packages/eslint-plugin/dist/index.d.cts +8 -43
- package/packages/eslint-plugin/dist/index.d.ts +8 -43
- package/packages/eslint-plugin/dist/index.js +17 -55
- package/packages/eslint-plugin/package.json +5 -4
- package/packages/validate/dist/index.cjs +378 -85
- package/packages/validate/dist/index.d.cts +11 -1
- package/packages/validate/dist/index.d.ts +11 -1
- package/packages/validate/dist/index.js +375 -82
- package/packages/validate/package.json +14 -7
- package/packages/cli/dist/K_ENT_Entity-PQ5MURQY-ZG6FZXXX.js +0 -13
- package/packages/cli/dist/K_LIB_Krnl_Aiko_Client-OPZAVZCW-K4CRQYA5.js +0 -8
- package/packages/cli/dist/K_LIB_Krnl_Ep_Tools-ROOE2TQF-LNPXZYOE.js +0 -110
- package/packages/cli/dist/K_LIB_Krnl_Frontend_Builder-2ZDUH6PF-3ALZPNX4.js +0 -11
- package/packages/cli/dist/K_LIB_Krnl_Frontend_Generator-UYNRNX2X-PJTICYSW.js +0 -11
- package/packages/cli/dist/K_LIB_Krnl_Registry_Client-NXV6D2QW-M5TYU55O.js +0 -8
- package/packages/cli/dist/K_LIB_Krnl_SubApp_Engine-7HR5HWW2-H6STOXRK.js +0 -20
- package/packages/cli/dist/K_LIB_Krnl_SubApp_Registry-7XYGDKJK-XPJXSF7D.js +0 -19
- package/packages/cli/dist/K_LIB_Krnl_SubApp_Worker_Host-CQVTGGG7-CUYGTWOW.js +0 -7
- package/packages/cli/dist/K_LIB_Krnl_System_App_Adapter-M6FJKLGU-VR6T4N6J.js +0 -17
- package/packages/cli/dist/K_LIB_Krnl_System_Base_Functionality_APIs-ZZUZ6ZG5-RLJ4QWDP.js +0 -58
- package/packages/cli/dist/K_LIB_Krnl_System_Magnetic_Loader-XBQO2KXF-BOQGUASC.js +0 -22
- package/packages/cli/dist/K_LIB_Krnl_System_Unified_Http_Adapter-RCEGP3OG-XJI7KIT5.js +0 -8
- package/packages/cli/dist/K_LIB_Krnl_Telemetry-77FRZ3KV-K5VCWAFW.js +0 -9
- package/packages/cli/dist/chunk-3TRM6CYL.js +0 -152
- package/packages/cli/dist/chunk-5JDK35TG.js +0 -3872
- package/packages/cli/dist/chunk-63PTK33I.js +0 -997
- package/packages/cli/dist/chunk-6NIKAMUZ.js +0 -82
- package/packages/cli/dist/chunk-BOXWWXQG.js +0 -400
- package/packages/cli/dist/chunk-EEKLK7QJ.js +0 -565
- package/packages/cli/dist/chunk-EG7T2IAD.js +0 -107
- package/packages/cli/dist/chunk-ESTKOQ7T.js +0 -1146
- package/packages/cli/dist/chunk-F5EHXE2O.js +0 -1036
- package/packages/cli/dist/chunk-F65ANSQG.js +0 -269
- package/packages/cli/dist/chunk-FDNCADFE.js +0 -71
- package/packages/cli/dist/chunk-FZ6X7PHR.js +0 -1146
- package/packages/cli/dist/chunk-GDLRMDAN.js +0 -127
- package/packages/cli/dist/chunk-HWMTCMOS.js +0 -656
- package/packages/cli/dist/chunk-I74QIQOD.js +0 -5536
- package/packages/cli/dist/chunk-JTLSTO25.js +0 -71
- package/packages/cli/dist/chunk-JULBBJ27.js +0 -1033
- package/packages/cli/dist/chunk-OHVMVRBP.js +0 -117
- package/packages/cli/dist/chunk-P2PCLEKX.js +0 -666
- package/packages/cli/dist/chunk-PJQIUOX2.js +0 -7767
- package/packages/cli/dist/chunk-PPOF3DJW.js +0 -471
- package/packages/cli/dist/chunk-Q45257P6.js +0 -173
- package/packages/cli/dist/chunk-QNROWGBI.js +0 -1036
- package/packages/cli/dist/chunk-RJNYUXZD.js +0 -977
- package/packages/cli/dist/chunk-SRTOPJ5W.js +0 -104
- package/packages/cli/dist/chunk-TCEX3MPS.js +0 -702
- package/packages/cli/dist/chunk-TNOAJO2J.js +0 -675
- package/packages/cli/dist/chunk-UR2SUCSF.js +0 -701
- package/packages/cli/dist/chunk-X5LOIFM7.js +0 -68
- package/packages/cli/dist/chunk-XIRFOO3H.js +0 -589
- package/packages/cli/dist/chunk-ZAAV3JXQ.js +0 -809
- package/packages/core/dist/K_ENT_Entity-4MB7CU4A.js +0 -12
- package/packages/core/dist/K_ENT_Entity-DEJGIDGH.js +0 -12
- package/packages/core/dist/K_ENT_Entity-FXZO5UZ2.js +0 -12
- package/packages/core/dist/K_ENT_Entity-HDSCXC5F.js +0 -12
- package/packages/core/dist/K_ENT_Entity-JILABHLW.js +0 -12
- package/packages/core/dist/K_ENT_Entity-PQ5MURQY.js +0 -13
- package/packages/core/dist/K_ENT_Entity-ROAKDIHW.js +0 -12
- package/packages/core/dist/K_ENT_Entity-TBVFSKDV.js +0 -12
- package/packages/core/dist/K_ENT_Entity-ZFLKG3JO.js +0 -12
- package/packages/core/dist/K_LIB_Krnl_Aiko_Client-OPZAVZCW.js +0 -8
- package/packages/core/dist/K_LIB_Krnl_Ep_Tools-ROOE2TQF.js +0 -110
- package/packages/core/dist/K_LIB_Krnl_Frontend_Builder-2ZDUH6PF.js +0 -9
- package/packages/core/dist/K_LIB_Krnl_Frontend_Generator-UYNRNX2X.js +0 -9
- package/packages/core/dist/K_LIB_Krnl_Registry_Client-NXV6D2QW.js +0 -8
- package/packages/core/dist/K_LIB_Krnl_SubApp_Engine-7HR5HWW2.js +0 -20
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-4C6GBQAG.js +0 -18
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-6V23A6F6.js +0 -18
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-7XYGDKJK.js +0 -19
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-DYLLC5G2.js +0 -18
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-F4FOFAUP.js +0 -18
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-FBOXXMI3.js +0 -18
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-Q73BWLNP.js +0 -18
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-QM2C4MVA.js +0 -18
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-QUGI6SMP.js +0 -18
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-RGMTBHNP.js +0 -18
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-RWR7UNDW.js +0 -18
- package/packages/core/dist/K_LIB_Krnl_SubApp_Worker_Host-CQVTGGG7.js +0 -7
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-32MFJJ5Z.js +0 -17
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-4J4CEWRY.js +0 -17
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-A366YHF2.js +0 -17
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-LK4LYJHI.js +0 -17
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-M6FJKLGU.js +0 -17
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-NW3K63II.js +0 -17
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-QDHTI5ZV.js +0 -17
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-VHCT6VIW.js +0 -17
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-WBRKF24R.js +0 -17
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-XKYQYT6Q.js +0 -17
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-Z2PWZYDZ.js +0 -17
- package/packages/core/dist/K_LIB_Krnl_System_Base_Functionality_APIs-ZZUZ6ZG5.js +0 -58
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-2EZU7QF4.js +0 -21
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-6G3AQNAV.js +0 -21
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-B2NZMQUG.js +0 -21
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-C2RABMZP.js +0 -21
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-HHE3NZ4F.js +0 -21
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-LHFGR6WK.js +0 -21
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-M74BLM3N.js +0 -21
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-PT6ZA6EA.js +0 -21
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-SP52V3CX.js +0 -21
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-XBQO2KXF.js +0 -22
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-YNSEUHJJ.js +0 -21
- package/packages/core/dist/K_LIB_Krnl_System_Unified_Http_Adapter-M6SBHIVA.js +0 -8
- package/packages/core/dist/K_LIB_Krnl_System_Unified_Http_Adapter-RCEGP3OG.js +0 -8
- package/packages/core/dist/K_LIB_Krnl_Telemetry-77FRZ3KV.js +0 -9
- package/packages/core/dist/chunk-33L2J7V7.js +0 -82
- package/packages/core/dist/chunk-3ES4K2ZP.js +0 -817
- package/packages/core/dist/chunk-3SMHVVLL.js +0 -82
- package/packages/core/dist/chunk-3UEZ7JQA.js +0 -4877
- package/packages/core/dist/chunk-3XIE6KBD.js +0 -4877
- package/packages/core/dist/chunk-46ZLCML6.js +0 -107
- package/packages/core/dist/chunk-4UEL3DWJ.js +0 -107
- package/packages/core/dist/chunk-54GWZ5PC.js +0 -82
- package/packages/core/dist/chunk-6QCYRS5L.js +0 -127
- package/packages/core/dist/chunk-6ULMHNXR.js +0 -104
- package/packages/core/dist/chunk-7WUETJEV.js +0 -117
- package/packages/core/dist/chunk-A5KRAYDB.js +0 -107
- package/packages/core/dist/chunk-ANEAZ3PO.js +0 -107
- package/packages/core/dist/chunk-BE76RL6F.js +0 -82
- package/packages/core/dist/chunk-CIARVYDO.js +0 -107
- package/packages/core/dist/chunk-CR2ANE62.js +0 -107
- package/packages/core/dist/chunk-DI27MOR7.js +0 -173
- package/packages/core/dist/chunk-E6RLFHM5.js +0 -596
- package/packages/core/dist/chunk-EELAPMNV.js +0 -4877
- package/packages/core/dist/chunk-ENZ2RQVJ.js +0 -107
- package/packages/core/dist/chunk-F2U6CX4F.js +0 -4877
- package/packages/core/dist/chunk-FKG64OHL.js +0 -82
- package/packages/core/dist/chunk-FYAZJYM5.js +0 -772
- package/packages/core/dist/chunk-G4NP4RDQ.js +0 -82
- package/packages/core/dist/chunk-GADIRLRS.js +0 -473
- package/packages/core/dist/chunk-GR6CSLQJ.js +0 -772
- package/packages/core/dist/chunk-HDS7AT6O.js +0 -772
- package/packages/core/dist/chunk-HIMEZUU2.js +0 -71
- package/packages/core/dist/chunk-IB4UHG5I.js +0 -596
- package/packages/core/dist/chunk-J7ZYNVRS.js +0 -772
- package/packages/core/dist/chunk-JVLZU4K7.js +0 -604
- package/packages/core/dist/chunk-JYXXI7Q3.js +0 -82
- package/packages/core/dist/chunk-K54K2KZW.js +0 -192
- package/packages/core/dist/chunk-K6VHLBNH.js +0 -3316
- package/packages/core/dist/chunk-KCBP7ZYA.js +0 -596
- package/packages/core/dist/chunk-KFQGP6VL.js +0 -33
- package/packages/core/dist/chunk-KIUEUI7K.js +0 -82
- package/packages/core/dist/chunk-LB67NIZP.js +0 -949
- package/packages/core/dist/chunk-LDTYFUNW.js +0 -596
- package/packages/core/dist/chunk-MLVWARD4.js +0 -596
- package/packages/core/dist/chunk-MPYVXHKO.js +0 -2777
- package/packages/core/dist/chunk-MRQ3MITU.js +0 -772
- package/packages/core/dist/chunk-MVUN7I7O.js +0 -107
- package/packages/core/dist/chunk-NDDOIRW7.js +0 -596
- package/packages/core/dist/chunk-O3KDB5MH.js +0 -3330
- package/packages/core/dist/chunk-OEINUDSE.js +0 -400
- package/packages/core/dist/chunk-OPDENPT4.js +0 -4877
- package/packages/core/dist/chunk-P6XEM2LA.js +0 -429
- package/packages/core/dist/chunk-QKMRSQV4.js +0 -82
- package/packages/core/dist/chunk-R6CCWALL.js +0 -4877
- package/packages/core/dist/chunk-RAMMOO73.js +0 -774
- package/packages/core/dist/chunk-S3FTZFG6.js +0 -772
- package/packages/core/dist/chunk-T2ZVN434.js +0 -4877
- package/packages/core/dist/chunk-TFHLDMIA.js +0 -107
- package/packages/core/dist/chunk-TI3QUCIJ.js +0 -107
- package/packages/core/dist/chunk-TR2BAIGI.js +0 -107
- package/packages/core/dist/chunk-UGVVJKC6.js +0 -4877
- package/packages/core/dist/chunk-V2DX7YIU.js +0 -984
- package/packages/core/dist/chunk-W4IHYUYD.js +0 -772
- package/packages/core/dist/chunk-W6WBG5OY.js +0 -4877
- package/packages/core/dist/chunk-WN3M7O7H.js +0 -3312
- package/packages/core/dist/chunk-WR3NCU7U.js +0 -4877
- package/packages/core/dist/chunk-XC6B6L27.js +0 -82
- package/packages/core/dist/chunk-XNSE64ZY.js +0 -3316
- package/packages/core/dist/chunk-XROES2WN.js +0 -634
- package/packages/core/dist/chunk-XSCKNRCZ.js +0 -5020
- package/packages/core/dist/chunk-XVABPAUZ.js +0 -82
- package/packages/core/dist/chunk-YOBCB5C5.js +0 -596
- package/packages/core/dist/chunk-YUK6Q563.js +0 -666
- package/packages/core/dist/chunk-YXGL3ZEU.js +0 -1030
- package/packages/core/dist/chunk-ZINJ5OUX.js +0 -596
- package/packages/core/dist/chunk-ZPFD4BIQ.js +0 -604
- package/packages/core/dist/chunk-ZQZBFG6F.js +0 -4826
- package/packages/core/dist/chunk-ZZFRJGXM.js +0 -4877
- package/packages/create-krnl/dist/K_ENT_Entity-PQ5MURQY-R2OH4VXE.js +0 -14
- package/packages/create-krnl/dist/K_LIB_Krnl_Aiko_Client-OPZAVZCW-AZM5HF4M.js +0 -9
- package/packages/create-krnl/dist/K_LIB_Krnl_Ep_Tools-ROOE2TQF-X5N6SV2S.js +0 -111
- package/packages/create-krnl/dist/K_LIB_Krnl_Frontend_Builder-2ZDUH6PF-5PFHF4JU.js +0 -12
- package/packages/create-krnl/dist/K_LIB_Krnl_Frontend_Generator-UYNRNX2X-ED33OQPH.js +0 -12
- package/packages/create-krnl/dist/K_LIB_Krnl_Registry_Client-NXV6D2QW-YGQLVR4P.js +0 -9
- package/packages/create-krnl/dist/K_LIB_Krnl_SubApp_Engine-7HR5HWW2-VM7CTU2L.js +0 -21
- package/packages/create-krnl/dist/K_LIB_Krnl_SubApp_Registry-7XYGDKJK-Y2GQFJ7I.js +0 -21
- package/packages/create-krnl/dist/K_LIB_Krnl_SubApp_Worker_Host-CQVTGGG7-L3JQWO54.js +0 -8
- package/packages/create-krnl/dist/K_LIB_Krnl_System_App_Adapter-M6FJKLGU-KQARASPR.js +0 -19
- package/packages/create-krnl/dist/K_LIB_Krnl_System_Base_Functionality_APIs-ZZUZ6ZG5-OF3IGLVL.js +0 -59
- package/packages/create-krnl/dist/K_LIB_Krnl_System_Magnetic_Loader-XBQO2KXF-JOLHKOEX.js +0 -24
- package/packages/create-krnl/dist/K_LIB_Krnl_System_Unified_Http_Adapter-RCEGP3OG-L46LSHKQ.js +0 -10
- package/packages/create-krnl/dist/K_LIB_Krnl_Telemetry-77FRZ3KV-4JUPRR3X.js +0 -10
- package/packages/create-krnl/dist/chunk-3TRM6CYL.js +0 -152
- package/packages/create-krnl/dist/chunk-3URCB3QS.js +0 -127
- package/packages/create-krnl/dist/chunk-5JDK35TG.js +0 -3872
- package/packages/create-krnl/dist/chunk-A2XAXDOW.js +0 -812
- package/packages/create-krnl/dist/chunk-AN6TMQHG.js +0 -1033
- package/packages/create-krnl/dist/chunk-BOXWWXQG.js +0 -400
- package/packages/create-krnl/dist/chunk-BPTBREBG.js +0 -38
- package/packages/create-krnl/dist/chunk-FDNCADFE.js +0 -71
- package/packages/create-krnl/dist/chunk-JTLSTO25.js +0 -71
- package/packages/create-krnl/dist/chunk-M3NCUIPL.js +0 -107
- package/packages/create-krnl/dist/chunk-N2EONSOC.js +0 -7769
- package/packages/create-krnl/dist/chunk-OHVMVRBP.js +0 -117
- package/packages/create-krnl/dist/chunk-Q45257P6.js +0 -173
- package/packages/create-krnl/dist/chunk-QGM4M3NI.js +0 -37
- package/packages/create-krnl/dist/chunk-RJNYUXZD.js +0 -977
- package/packages/create-krnl/dist/chunk-SRTOPJ5W.js +0 -104
- package/packages/create-krnl/dist/chunk-UPBIGEC3.js +0 -666
- package/packages/create-krnl/dist/chunk-V2DB7UD7.js +0 -82
- package/packages/create-krnl/dist/chunk-WMHLIUI6.js +0 -3644
- package/packages/create-krnl/dist/chunk-XIRFOO3H.js +0 -589
- package/packages/create-krnl/dist/chunk-Y2CEEVZP.js +0 -5536
- package/packages/create-krnl/dist/main-DXUMPBND.js +0 -2217
- package/packages/create-krnl/dist/wrapper-SDF2VKX3.js +0 -31
|
@@ -1,589 +0,0 @@
|
|
|
1
|
-
// ../core/dist/chunk-MLVWARD4.js
|
|
2
|
-
import fs from "fs";
|
|
3
|
-
import fsp from "fs/promises";
|
|
4
|
-
import path from "path";
|
|
5
|
-
import os from "os";
|
|
6
|
-
var ObjectKit = class _ObjectKit {
|
|
7
|
-
/**
|
|
8
|
-
* Structurally deep clones an object with circular dependency check.
|
|
9
|
-
*/
|
|
10
|
-
static deepClone(obj, seen = /* @__PURE__ */ new Map()) {
|
|
11
|
-
if (obj === null || typeof obj !== "object") {
|
|
12
|
-
return obj;
|
|
13
|
-
}
|
|
14
|
-
if (seen.has(obj)) {
|
|
15
|
-
return seen.get(obj);
|
|
16
|
-
}
|
|
17
|
-
if (obj instanceof Date) {
|
|
18
|
-
return new Date(obj.getTime());
|
|
19
|
-
}
|
|
20
|
-
if (obj instanceof RegExp) {
|
|
21
|
-
return new RegExp(obj.source, obj.flags);
|
|
22
|
-
}
|
|
23
|
-
if (Array.isArray(obj)) {
|
|
24
|
-
const cloneArr = [];
|
|
25
|
-
seen.set(obj, cloneArr);
|
|
26
|
-
for (const item of obj) {
|
|
27
|
-
cloneArr.push(_ObjectKit.deepClone(item, seen));
|
|
28
|
-
}
|
|
29
|
-
return cloneArr;
|
|
30
|
-
}
|
|
31
|
-
const cloneObj = Object.create(Object.getPrototypeOf(obj));
|
|
32
|
-
seen.set(obj, cloneObj);
|
|
33
|
-
for (const key of Reflect.ownKeys(obj)) {
|
|
34
|
-
const descriptor = Reflect.getOwnPropertyDescriptor(obj, key);
|
|
35
|
-
if (descriptor) {
|
|
36
|
-
descriptor.value = _ObjectKit.deepClone(descriptor.value, seen);
|
|
37
|
-
Object.defineProperty(cloneObj, key, descriptor);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return cloneObj;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Recursively deep merges override objects into a base.
|
|
44
|
-
*/
|
|
45
|
-
static deepMerge(base, ...overrides) {
|
|
46
|
-
let result = _ObjectKit.deepClone(base);
|
|
47
|
-
for (const override of overrides) {
|
|
48
|
-
if (override === null || typeof override !== "object") {
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
for (const key of Object.keys(override)) {
|
|
52
|
-
const val = override[key];
|
|
53
|
-
if (val === void 0) {
|
|
54
|
-
delete result[key];
|
|
55
|
-
} else if (val && typeof val === "object" && !Array.isArray(val)) {
|
|
56
|
-
if (result[key] && typeof result[key] === "object" && !Array.isArray(result[key])) {
|
|
57
|
-
result[key] = _ObjectKit.deepMerge(result[key], val);
|
|
58
|
-
} else {
|
|
59
|
-
result[key] = _ObjectKit.deepClone(val);
|
|
60
|
-
}
|
|
61
|
-
} else {
|
|
62
|
-
result[key] = _ObjectKit.deepClone(val);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return result;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Performs a strict structural equality check.
|
|
70
|
-
*/
|
|
71
|
-
static deepEqual(a, b) {
|
|
72
|
-
if (Object.is(a, b))
|
|
73
|
-
return true;
|
|
74
|
-
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null) {
|
|
75
|
-
return false;
|
|
76
|
-
}
|
|
77
|
-
if (Object.getPrototypeOf(a) !== Object.getPrototypeOf(b)) {
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
if (a instanceof Date && b instanceof Date) {
|
|
81
|
-
return a.getTime() === b.getTime();
|
|
82
|
-
}
|
|
83
|
-
if (a instanceof RegExp && b instanceof RegExp) {
|
|
84
|
-
return a.toString() === b.toString();
|
|
85
|
-
}
|
|
86
|
-
const keysA = Reflect.ownKeys(a);
|
|
87
|
-
const keysB = Reflect.ownKeys(b);
|
|
88
|
-
if (keysA.length !== keysB.length)
|
|
89
|
-
return false;
|
|
90
|
-
const setB = new Set(keysB);
|
|
91
|
-
for (const key of keysA) {
|
|
92
|
-
if (!setB.has(key))
|
|
93
|
-
return false;
|
|
94
|
-
if (!_ObjectKit.deepEqual(a[key], b[key]))
|
|
95
|
-
return false;
|
|
96
|
-
}
|
|
97
|
-
return true;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Performs an object diff between before and after states.
|
|
101
|
-
*/
|
|
102
|
-
static objectDiff(before, after) {
|
|
103
|
-
const added = {};
|
|
104
|
-
const removed = {};
|
|
105
|
-
const changed = {};
|
|
106
|
-
if (before === null || typeof before !== "object" || after === null || typeof after !== "object") {
|
|
107
|
-
return { added, removed, changed };
|
|
108
|
-
}
|
|
109
|
-
const keysBefore = Object.keys(before);
|
|
110
|
-
const keysAfter = Object.keys(after);
|
|
111
|
-
for (const key of keysAfter) {
|
|
112
|
-
if (!(key in before)) {
|
|
113
|
-
added[key] = _ObjectKit.deepClone(after[key]);
|
|
114
|
-
} else if (!_ObjectKit.deepEqual(before[key], after[key])) {
|
|
115
|
-
if (before[key] && typeof before[key] === "object" && after[key] && typeof after[key] === "object" && !Array.isArray(before[key]) && !Array.isArray(after[key])) {
|
|
116
|
-
const nested = _ObjectKit.objectDiff(before[key], after[key]);
|
|
117
|
-
if (Object.keys(nested.added).length > 0 || Object.keys(nested.removed).length > 0 || Object.keys(nested.changed).length > 0) {
|
|
118
|
-
changed[key] = nested;
|
|
119
|
-
}
|
|
120
|
-
} else {
|
|
121
|
-
changed[key] = { from: _ObjectKit.deepClone(before[key]), to: _ObjectKit.deepClone(after[key]) };
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
for (const key of keysBefore) {
|
|
126
|
-
if (!(key in after)) {
|
|
127
|
-
removed[key] = _ObjectKit.deepClone(before[key]);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return { added, removed, changed };
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Accesses an in-memory object by dot-notation.
|
|
134
|
-
*/
|
|
135
|
-
static getPath(obj, path2, defaultValue) {
|
|
136
|
-
if (!path2)
|
|
137
|
-
return obj;
|
|
138
|
-
const parts = path2.split(".");
|
|
139
|
-
let current = obj;
|
|
140
|
-
for (const part of parts) {
|
|
141
|
-
if (current === null || current === void 0) {
|
|
142
|
-
return defaultValue;
|
|
143
|
-
}
|
|
144
|
-
current = current[part];
|
|
145
|
-
}
|
|
146
|
-
return current !== void 0 ? current : defaultValue;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Mutates or sets an in-memory object by dot-notation.
|
|
150
|
-
*/
|
|
151
|
-
static setPath(obj, path2, value) {
|
|
152
|
-
if (!path2)
|
|
153
|
-
return obj;
|
|
154
|
-
const parts = path2.split(".");
|
|
155
|
-
let current = obj;
|
|
156
|
-
for (let i = 0; i < parts.length - 1; i++) {
|
|
157
|
-
const part = parts[i];
|
|
158
|
-
if (current[part] === void 0 || current[part] === null) {
|
|
159
|
-
current[part] = {};
|
|
160
|
-
}
|
|
161
|
-
current = current[part];
|
|
162
|
-
}
|
|
163
|
-
current[parts[parts.length - 1]] = value;
|
|
164
|
-
return obj;
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
var FileLock = class _FileLock {
|
|
168
|
-
static locks = /* @__PURE__ */ new Map();
|
|
169
|
-
static async acquire(filePath) {
|
|
170
|
-
const resolvedPath = path.resolve(filePath);
|
|
171
|
-
const existing = _FileLock.locks.get(resolvedPath) || Promise.resolve();
|
|
172
|
-
let release = () => {
|
|
173
|
-
};
|
|
174
|
-
const nextLock = new Promise((resolve) => {
|
|
175
|
-
release = () => {
|
|
176
|
-
_FileLock.locks.delete(resolvedPath);
|
|
177
|
-
resolve();
|
|
178
|
-
};
|
|
179
|
-
});
|
|
180
|
-
_FileLock.locks.set(resolvedPath, nextLock);
|
|
181
|
-
await existing;
|
|
182
|
-
return release;
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
var KrnlFS = class _KrnlFS {
|
|
186
|
-
// --- File primitives ---
|
|
187
|
-
static async readFile(filePath, encoding = "utf8") {
|
|
188
|
-
return await fsp.readFile(filePath, encoding);
|
|
189
|
-
}
|
|
190
|
-
static async writeFile(filePath, content) {
|
|
191
|
-
await fsp.writeFile(filePath, content);
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Atomic file writing via temp files.
|
|
195
|
-
*/
|
|
196
|
-
static async writeFileAtomic(filePath, content) {
|
|
197
|
-
const dir = path.dirname(filePath);
|
|
198
|
-
await _KrnlFS.ensureDir(dir);
|
|
199
|
-
const tempFile = path.join(dir, `.${path.basename(filePath)}.tmp_${Date.now()}_${Math.random().toString(36).substring(7)}`);
|
|
200
|
-
try {
|
|
201
|
-
await fsp.writeFile(tempFile, content);
|
|
202
|
-
await fsp.rename(tempFile, filePath);
|
|
203
|
-
} catch (e) {
|
|
204
|
-
if (fs.existsSync(tempFile)) {
|
|
205
|
-
await fsp.unlink(tempFile).catch(() => {
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
throw e;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
static async appendFile(filePath, content) {
|
|
212
|
-
await fsp.appendFile(filePath, content);
|
|
213
|
-
}
|
|
214
|
-
static async deleteFile(filePath) {
|
|
215
|
-
await fsp.unlink(filePath);
|
|
216
|
-
}
|
|
217
|
-
static async fileExists(filePath) {
|
|
218
|
-
try {
|
|
219
|
-
const stat = await fsp.stat(filePath);
|
|
220
|
-
return stat.isFile();
|
|
221
|
-
} catch (e) {
|
|
222
|
-
return false;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
static async getFileStat(filePath) {
|
|
226
|
-
const stat = await fsp.stat(filePath);
|
|
227
|
-
return {
|
|
228
|
-
size: stat.size,
|
|
229
|
-
createdAt: stat.birthtime,
|
|
230
|
-
modifiedAt: stat.mtime,
|
|
231
|
-
isDir: stat.isDirectory()
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
// --- JSON convenience ---
|
|
235
|
-
static async readJSON(filePath) {
|
|
236
|
-
try {
|
|
237
|
-
const content = await _KrnlFS.readFile(filePath, "utf8");
|
|
238
|
-
return JSON.parse(content);
|
|
239
|
-
} catch (e) {
|
|
240
|
-
return null;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
static async writeJSON(filePath, data, indent = 2) {
|
|
244
|
-
const content = JSON.stringify(data, null, indent);
|
|
245
|
-
await _KrnlFS.writeFileAtomic(filePath, content);
|
|
246
|
-
}
|
|
247
|
-
static async updateJSON(filePath, patch) {
|
|
248
|
-
const release = await FileLock.acquire(filePath);
|
|
249
|
-
try {
|
|
250
|
-
let existing = await _KrnlFS.readJSON(filePath);
|
|
251
|
-
if (!existing) {
|
|
252
|
-
existing = {};
|
|
253
|
-
}
|
|
254
|
-
const updated = ObjectKit.deepMerge(existing, patch);
|
|
255
|
-
await _KrnlFS.writeJSON(filePath, updated);
|
|
256
|
-
return updated;
|
|
257
|
-
} finally {
|
|
258
|
-
release();
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
// --- Directory primitives ---
|
|
262
|
-
static async ensureDir(dirPath) {
|
|
263
|
-
await fsp.mkdir(dirPath, { recursive: true });
|
|
264
|
-
}
|
|
265
|
-
static async deleteDir(dirPath, recursive = true) {
|
|
266
|
-
await fsp.rm(dirPath, { recursive, force: true });
|
|
267
|
-
}
|
|
268
|
-
static async listDir(dirPath) {
|
|
269
|
-
return await fsp.readdir(dirPath);
|
|
270
|
-
}
|
|
271
|
-
static async *walkDir(dirPath, filter) {
|
|
272
|
-
const list = await _KrnlFS.listDir(dirPath);
|
|
273
|
-
for (const item of list) {
|
|
274
|
-
const full = path.join(dirPath, item);
|
|
275
|
-
const stat = await _KrnlFS.getFileStat(full);
|
|
276
|
-
if (stat.isDir) {
|
|
277
|
-
yield* _KrnlFS.walkDir(full, filter);
|
|
278
|
-
} else {
|
|
279
|
-
if (!filter || filter(full)) {
|
|
280
|
-
yield full;
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
static async dirExists(dirPath) {
|
|
286
|
-
try {
|
|
287
|
-
const stat = await fsp.stat(dirPath);
|
|
288
|
-
return stat.isDirectory();
|
|
289
|
-
} catch (e) {
|
|
290
|
-
return false;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
static async copyDir(src, dest) {
|
|
294
|
-
await _KrnlFS.ensureDir(dest);
|
|
295
|
-
const list = await _KrnlFS.listDir(src);
|
|
296
|
-
for (const item of list) {
|
|
297
|
-
const srcItem = path.join(src, item);
|
|
298
|
-
const destItem = path.join(dest, item);
|
|
299
|
-
const stat = await _KrnlFS.getFileStat(srcItem);
|
|
300
|
-
if (stat.isDir) {
|
|
301
|
-
await _KrnlFS.copyDir(srcItem, destItem);
|
|
302
|
-
} else {
|
|
303
|
-
await fsp.copyFile(srcItem, destItem);
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
// --- Path utilities ---
|
|
308
|
-
static join(...parts) {
|
|
309
|
-
return path.join(...parts);
|
|
310
|
-
}
|
|
311
|
-
static resolve(...parts) {
|
|
312
|
-
return path.resolve(...parts);
|
|
313
|
-
}
|
|
314
|
-
static relative(from, to) {
|
|
315
|
-
return path.relative(from, to);
|
|
316
|
-
}
|
|
317
|
-
static basename(filePath, ext) {
|
|
318
|
-
return path.basename(filePath, ext);
|
|
319
|
-
}
|
|
320
|
-
static dirname(filePath) {
|
|
321
|
-
return path.dirname(filePath);
|
|
322
|
-
}
|
|
323
|
-
static extname(filePath) {
|
|
324
|
-
return path.extname(filePath);
|
|
325
|
-
}
|
|
326
|
-
static normalize(filePath) {
|
|
327
|
-
return path.normalize(filePath);
|
|
328
|
-
}
|
|
329
|
-
static isSafe(filePath, root) {
|
|
330
|
-
const resolvedPath = path.resolve(filePath);
|
|
331
|
-
const resolvedRoot = path.resolve(root);
|
|
332
|
-
return resolvedPath.startsWith(resolvedRoot);
|
|
333
|
-
}
|
|
334
|
-
// --- Candidate resolution ---
|
|
335
|
-
static async firstExisting(candidates) {
|
|
336
|
-
for (const cand of candidates) {
|
|
337
|
-
if (await _KrnlFS.fileExists(cand)) {
|
|
338
|
-
return cand;
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
return null;
|
|
342
|
-
}
|
|
343
|
-
// --- Watching ---
|
|
344
|
-
static watchFile(filePath, handler, debounceMs = 100) {
|
|
345
|
-
let timer = null;
|
|
346
|
-
return fs.watch(filePath, (event) => {
|
|
347
|
-
if (timer)
|
|
348
|
-
clearTimeout(timer);
|
|
349
|
-
timer = setTimeout(() => handler(event), debounceMs);
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
|
-
static watchDir(dirPath, handler, debounceMs = 100) {
|
|
353
|
-
let timer = null;
|
|
354
|
-
return fs.watch(dirPath, (event, filename) => {
|
|
355
|
-
if (timer)
|
|
356
|
-
clearTimeout(timer);
|
|
357
|
-
timer = setTimeout(() => handler(event, filename), debounceMs);
|
|
358
|
-
});
|
|
359
|
-
}
|
|
360
|
-
// --- Temp ---
|
|
361
|
-
static createTempFile(prefix = "tmp-") {
|
|
362
|
-
return path.join(os.tmpdir(), `${prefix}${Math.random().toString(36).substring(7)}.tmp`);
|
|
363
|
-
}
|
|
364
|
-
static createTempDir(prefix = "tmp-dir-") {
|
|
365
|
-
const dir = path.join(os.tmpdir(), `${prefix}${Math.random().toString(36).substring(7)}`);
|
|
366
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
367
|
-
return dir;
|
|
368
|
-
}
|
|
369
|
-
static async withTempDir(fn, prefix = "tmp-") {
|
|
370
|
-
const tempDir = _KrnlFS.createTempDir(prefix);
|
|
371
|
-
try {
|
|
372
|
-
return await fn(tempDir);
|
|
373
|
-
} finally {
|
|
374
|
-
await _KrnlFS.deleteDir(tempDir, true).catch(() => {
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
};
|
|
379
|
-
var AsyncKit = class _AsyncKit {
|
|
380
|
-
/**
|
|
381
|
-
* Classic sleep/delay.
|
|
382
|
-
*/
|
|
383
|
-
static sleep(ms) {
|
|
384
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
385
|
-
}
|
|
386
|
-
/**
|
|
387
|
-
* Rejects if the task does not finish within ms.
|
|
388
|
-
*/
|
|
389
|
-
static withTimeout(promise, ms, label = "Operation") {
|
|
390
|
-
let timer;
|
|
391
|
-
const timeoutPromise = new Promise((_, reject) => {
|
|
392
|
-
timer = setTimeout(() => {
|
|
393
|
-
reject(new Error(`[KrnlTimeoutError] ${label} timed out after ${ms}ms`));
|
|
394
|
-
}, ms);
|
|
395
|
-
});
|
|
396
|
-
return Promise.race([
|
|
397
|
-
promise.then((val) => {
|
|
398
|
-
clearTimeout(timer);
|
|
399
|
-
return val;
|
|
400
|
-
}),
|
|
401
|
-
timeoutPromise
|
|
402
|
-
]);
|
|
403
|
-
}
|
|
404
|
-
/**
|
|
405
|
-
* Retries an async execution up to maxAttempts times.
|
|
406
|
-
*/
|
|
407
|
-
static async retry(fn, maxAttempts, delayMs = 1e3) {
|
|
408
|
-
let attempts = 0;
|
|
409
|
-
while (attempts < maxAttempts) {
|
|
410
|
-
try {
|
|
411
|
-
return await fn();
|
|
412
|
-
} catch (err) {
|
|
413
|
-
attempts++;
|
|
414
|
-
if (attempts >= maxAttempts) {
|
|
415
|
-
throw err;
|
|
416
|
-
}
|
|
417
|
-
await _AsyncKit.sleep(delayMs);
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
throw new Error("Retry failed");
|
|
421
|
-
}
|
|
422
|
-
static async pLimit(tasks, concurrency) {
|
|
423
|
-
const results = [];
|
|
424
|
-
let index = 0;
|
|
425
|
-
const worker = async () => {
|
|
426
|
-
while (index < tasks.length) {
|
|
427
|
-
const i = index++;
|
|
428
|
-
results[i] = await tasks[i]();
|
|
429
|
-
}
|
|
430
|
-
};
|
|
431
|
-
const workers = [];
|
|
432
|
-
for (let i = 0; i < concurrency && i < tasks.length; i++) {
|
|
433
|
-
workers.push(worker());
|
|
434
|
-
}
|
|
435
|
-
await Promise.all(workers);
|
|
436
|
-
return results;
|
|
437
|
-
}
|
|
438
|
-
/**
|
|
439
|
-
* Debounces a function.
|
|
440
|
-
*/
|
|
441
|
-
static debounce(fn, ms) {
|
|
442
|
-
let timer = null;
|
|
443
|
-
return (...args) => {
|
|
444
|
-
if (timer)
|
|
445
|
-
clearTimeout(timer);
|
|
446
|
-
timer = setTimeout(() => fn(...args), ms);
|
|
447
|
-
};
|
|
448
|
-
}
|
|
449
|
-
/**
|
|
450
|
-
* Throttles a function.
|
|
451
|
-
*/
|
|
452
|
-
static throttle(fn, ms) {
|
|
453
|
-
let lastCall = 0;
|
|
454
|
-
return (...args) => {
|
|
455
|
-
const now = Date.now();
|
|
456
|
-
if (now - lastCall >= ms) {
|
|
457
|
-
lastCall = now;
|
|
458
|
-
fn(...args);
|
|
459
|
-
}
|
|
460
|
-
};
|
|
461
|
-
}
|
|
462
|
-
/**
|
|
463
|
-
* Wraps a function to run only once and cache its outcome.
|
|
464
|
-
*/
|
|
465
|
-
static once(fn) {
|
|
466
|
-
let run = false;
|
|
467
|
-
let result;
|
|
468
|
-
return (...args) => {
|
|
469
|
-
if (!run) {
|
|
470
|
-
run = true;
|
|
471
|
-
result = fn(...args);
|
|
472
|
-
}
|
|
473
|
-
return result;
|
|
474
|
-
};
|
|
475
|
-
}
|
|
476
|
-
/**
|
|
477
|
-
* computational memoization cache helper.
|
|
478
|
-
*/
|
|
479
|
-
static memoize(fn, keyFn) {
|
|
480
|
-
const cache = /* @__PURE__ */ new Map();
|
|
481
|
-
return (...args) => {
|
|
482
|
-
const key = keyFn ? keyFn(...args) : JSON.stringify(args);
|
|
483
|
-
if (cache.has(key)) {
|
|
484
|
-
return cache.get(key);
|
|
485
|
-
}
|
|
486
|
-
const val = fn(...args);
|
|
487
|
-
cache.set(key, val);
|
|
488
|
-
return val;
|
|
489
|
-
};
|
|
490
|
-
}
|
|
491
|
-
};
|
|
492
|
-
var KrnlHTTP = class _KrnlHTTP {
|
|
493
|
-
/**
|
|
494
|
-
* Helper to perform fetch with timeout and retries.
|
|
495
|
-
*/
|
|
496
|
-
static async requestRaw(url, opts = {}) {
|
|
497
|
-
const timeout = opts.timeout || 6e4;
|
|
498
|
-
const retries = opts.retries || 0;
|
|
499
|
-
const perform = async () => {
|
|
500
|
-
const controller = new AbortController();
|
|
501
|
-
const id = setTimeout(() => controller.abort(), timeout);
|
|
502
|
-
try {
|
|
503
|
-
const response = await fetch(url, {
|
|
504
|
-
...opts,
|
|
505
|
-
signal: controller.signal
|
|
506
|
-
});
|
|
507
|
-
clearTimeout(id);
|
|
508
|
-
return response;
|
|
509
|
-
} catch (e) {
|
|
510
|
-
clearTimeout(id);
|
|
511
|
-
throw e;
|
|
512
|
-
}
|
|
513
|
-
};
|
|
514
|
-
return await AsyncKit.retry(perform, retries + 1, 1e3);
|
|
515
|
-
}
|
|
516
|
-
static async request(url, opts = {}) {
|
|
517
|
-
try {
|
|
518
|
-
const res = await _KrnlHTTP.requestRaw(url, opts);
|
|
519
|
-
if (!res.ok) {
|
|
520
|
-
return { status: "error", message: `HTTP Error ${res.status}: ${res.statusText}`, code: res.status };
|
|
521
|
-
}
|
|
522
|
-
const data = await res.json();
|
|
523
|
-
return { status: "success", data };
|
|
524
|
-
} catch (e) {
|
|
525
|
-
return { status: "error", message: e.message || String(e) };
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
static async get(url, opts = {}) {
|
|
529
|
-
return await _KrnlHTTP.request(url, { ...opts, method: "GET" });
|
|
530
|
-
}
|
|
531
|
-
static async post(url, body, opts = {}) {
|
|
532
|
-
return await _KrnlHTTP.request(url, {
|
|
533
|
-
...opts,
|
|
534
|
-
method: "POST",
|
|
535
|
-
headers: { "Content-Type": "application/json", ...opts.headers },
|
|
536
|
-
body: JSON.stringify(body)
|
|
537
|
-
});
|
|
538
|
-
}
|
|
539
|
-
static async put(url, body, opts = {}) {
|
|
540
|
-
return await _KrnlHTTP.request(url, {
|
|
541
|
-
...opts,
|
|
542
|
-
method: "PUT",
|
|
543
|
-
headers: { "Content-Type": "application/json", ...opts.headers },
|
|
544
|
-
body: JSON.stringify(body)
|
|
545
|
-
});
|
|
546
|
-
}
|
|
547
|
-
static async del(url, opts = {}) {
|
|
548
|
-
return await _KrnlHTTP.request(url, { ...opts, method: "DELETE" });
|
|
549
|
-
}
|
|
550
|
-
/**
|
|
551
|
-
* Creates a client instance.
|
|
552
|
-
*/
|
|
553
|
-
static createClient(baseUrl, defaultHeaders = {}) {
|
|
554
|
-
return {
|
|
555
|
-
get: (path2, opts = {}) => _KrnlHTTP.get(`${baseUrl}${path2}`, { ...opts, headers: { ...defaultHeaders, ...opts.headers } }),
|
|
556
|
-
post: (path2, body, opts = {}) => _KrnlHTTP.post(`${baseUrl}${path2}`, body, { ...opts, headers: { ...defaultHeaders, ...opts.headers } }),
|
|
557
|
-
put: (path2, body, opts = {}) => _KrnlHTTP.put(`${baseUrl}${path2}`, body, { ...opts, headers: { ...defaultHeaders, ...opts.headers } }),
|
|
558
|
-
del: (path2, opts = {}) => _KrnlHTTP.del(`${baseUrl}${path2}`, { ...opts, headers: { ...defaultHeaders, ...opts.headers } })
|
|
559
|
-
};
|
|
560
|
-
}
|
|
561
|
-
/**
|
|
562
|
-
* Streaming SSE / Chunk response.
|
|
563
|
-
*/
|
|
564
|
-
static async *streamResponse(url, opts = {}) {
|
|
565
|
-
const res = await _KrnlHTTP.requestRaw(url, opts);
|
|
566
|
-
if (!res.ok || !res.body) {
|
|
567
|
-
throw new Error(`Failed to initialize stream: HTTP ${res.status}`);
|
|
568
|
-
}
|
|
569
|
-
const reader = res.body.getReader();
|
|
570
|
-
const decoder = new TextDecoder();
|
|
571
|
-
try {
|
|
572
|
-
while (true) {
|
|
573
|
-
const { done, value } = await reader.read();
|
|
574
|
-
if (done)
|
|
575
|
-
break;
|
|
576
|
-
yield decoder.decode(value, { stream: true });
|
|
577
|
-
}
|
|
578
|
-
} finally {
|
|
579
|
-
reader.releaseLock();
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
};
|
|
583
|
-
|
|
584
|
-
export {
|
|
585
|
-
ObjectKit,
|
|
586
|
-
FileLock,
|
|
587
|
-
KrnlFS,
|
|
588
|
-
KrnlHTTP
|
|
589
|
-
};
|