@covro/covro 0.9.1-dev.3 → 0.9.1-dev.4
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 +1 -1
- package/README.zh-CN.md +1 -1
- package/dist/cli/codex-probe.js +16 -0
- package/dist/cli/codex-probe.js.map +7 -0
- package/dist/cli/daemon.js +3 -1
- package/dist/cli/daemon.js.map +2 -2
- package/dist/cli/runtime-launch.js +1 -0
- package/dist/cli/runtime-launch.js.map +2 -2
- package/dist/codex/adapter.js +31 -13
- package/dist/codex/adapter.js.map +2 -2
- package/dist/codex/identity.js +98 -0
- package/dist/codex/identity.js.map +7 -0
- package/dist/shared/codex-compatibility.js +5 -5
- package/dist/shared/codex-compatibility.js.map +2 -2
- package/dist/shared/codex-identity.js +1 -0
- package/dist/shared/codex-identity.js.map +7 -0
- package/dist/shared/updates.js.map +2 -2
- package/dist/update-worker.cjs +691 -455
- package/dist/updates/codex-target.js +205 -0
- package/dist/updates/codex-target.js.map +7 -0
- package/dist/updates/manager.js +76 -13
- package/dist/updates/manager.js.map +2 -2
- package/dist/updates/plan.js +2 -1
- package/dist/updates/plan.js.map +2 -2
- package/dist/updates/transaction.js +1 -0
- package/dist/updates/transaction.js.map +2 -2
- package/dist/updates/worker.js +39 -8
- package/dist/updates/worker.js.map +2 -2
- package/dist/web/assets/{abnfDiagram-WEYOIA3C-BjKPZWkQ.js → abnfDiagram-WEYOIA3C-ijArbNII.js} +1 -1
- package/dist/web/assets/{arc-B9kEeQux.js → arc-BUrVLCzb.js} +1 -1
- package/dist/web/assets/{architecture-WOLXFQ4H-DtGpSjpu.js → architecture-WOLXFQ4H-BVWpMxzm.js} +1 -1
- package/dist/web/assets/{architectureDiagram-ZHVYKT53-N421cjgM.js → architectureDiagram-ZHVYKT53-CP3cGTEi.js} +1 -1
- package/dist/web/assets/{blockDiagram-RJAE7QA3-xTVjUZvn.js → blockDiagram-RJAE7QA3-DSm5K-Jl.js} +1 -1
- package/dist/web/assets/{c4Diagram-XDPPPE54-Bzde5CNZ.js → c4Diagram-XDPPPE54-C3xH3HNB.js} +1 -1
- package/dist/web/assets/channel-DaBBEkp4.js +1 -0
- package/dist/web/assets/{chunk-2E7WHVMD-DRQNeSoP.js → chunk-2E7WHVMD-CegEANdn.js} +1 -1
- package/dist/web/assets/{chunk-4EMNKR2T-33yxkote.js → chunk-4EMNKR2T-DWAI0TyX.js} +1 -1
- package/dist/web/assets/{chunk-55XCU76K-CW0h-mdD.js → chunk-55XCU76K-BFTladB-.js} +1 -1
- package/dist/web/assets/{chunk-7S6XSTFO-DCqqhVMc.js → chunk-7S6XSTFO-DWG-FnLe.js} +1 -1
- package/dist/web/assets/{chunk-AQDTSKZB-Dipvair2.js → chunk-AQDTSKZB-DomfNNjX.js} +1 -1
- package/dist/web/assets/{chunk-DSNLSHJZ-BURUGXUl.js → chunk-DSNLSHJZ-CgmEVoOr.js} +1 -1
- package/dist/web/assets/{chunk-HAGFOTED-BIZ-MS0x.js → chunk-HAGFOTED-DHpT7yoS.js} +1 -1
- package/dist/web/assets/{chunk-HNE4Q36P-C2wQjOA0.js → chunk-HNE4Q36P-CFUrS8o8.js} +1 -1
- package/dist/web/assets/{chunk-NQOKRVIF-B2Mev7Zt.js → chunk-NQOKRVIF-D7yHviXC.js} +1 -1
- package/dist/web/assets/{chunk-UHW7PFBP-BscdqWA6.js → chunk-UHW7PFBP-DHXDXWLJ.js} +1 -1
- package/dist/web/assets/{chunk-VQ5W62QI-D31WLgI4.js → chunk-VQ5W62QI-Gb2Gwpvo.js} +1 -1
- package/dist/web/assets/{chunk-WQQL4CDK-CxAAvC_l.js → chunk-WQQL4CDK-D9Bj2vUD.js} +1 -1
- package/dist/web/assets/{chunk-XXDRQBXY--nM5P_MO.js → chunk-XXDRQBXY-B-QXAbuO.js} +1 -1
- package/dist/web/assets/{chunk-YZO67HFG-B8dxZw27.js → chunk-YZO67HFG-BNBXo21d.js} +1 -1
- package/dist/web/assets/{chunk-ZAUX2LTX-ByoVBn5L.js → chunk-ZAUX2LTX-BZljmM0h.js} +1 -1
- package/dist/web/assets/{chunk-ZCHMQSOR-sSbSgLw6.js → chunk-ZCHMQSOR-BIBZO0ch.js} +1 -1
- package/dist/web/assets/{classDiagram-v2-4MYWR3UA-BCtsvTXU.js → classDiagram-v2-4MYWR3UA-H2un566X.js} +1 -1
- package/dist/web/assets/{cose-bilkent-JH36ORCC-9p-DmnKi.js → cose-bilkent-JH36ORCC-Cqbg8P4E.js} +1 -1
- package/dist/web/assets/{cynefin-EF2NZ3EQ-miWeDxJu.js → cynefin-EF2NZ3EQ-CWSs8awz.js} +1 -1
- package/dist/web/assets/{cynefinDiagram-WF24UDRP-QPLu03ZE.js → cynefinDiagram-WF24UDRP-BM3DCFuV.js} +1 -1
- package/dist/web/assets/{dagre-NK4GIZVX-CAOLyQK2.js → dagre-NK4GIZVX-hwER4l0X.js} +1 -1
- package/dist/web/assets/{diagram-CBK3MWTC-DepddJst.js → diagram-CBK3MWTC-DTZC5Q6L.js} +1 -1
- package/dist/web/assets/{diagram-I5XIIV2D-DXFTNR3c.js → diagram-I5XIIV2D-CUtdCXUT.js} +1 -1
- package/dist/web/assets/{diagram-ODIL2UCW-osFWXWSr.js → diagram-ODIL2UCW-Dc8VnTGO.js} +1 -1
- package/dist/web/assets/{diagram-PFBEJUXE-B_O77v3p.js → diagram-PFBEJUXE-BuIyNSGs.js} +1 -1
- package/dist/web/assets/{diagram-RJA3I4VV-DjruvCfX.js → diagram-RJA3I4VV-C6yMaOE3.js} +1 -1
- package/dist/web/assets/{diagram-TYUNFSNR-BvaFbzkd.js → diagram-TYUNFSNR-DQ2OZUMK.js} +1 -1
- package/dist/web/assets/{dist-CqcAwjz8.js → dist-COGhAbl7.js} +1 -1
- package/dist/web/assets/{ebnfDiagram-V4P3TTPT-BxBz1jiA.js → ebnfDiagram-V4P3TTPT-DDsR-wad.js} +1 -1
- package/dist/web/assets/{elk-QONTBCTQ-CYacnrUC.js → elk-QONTBCTQ-YEdimQeY.js} +1 -1
- package/dist/web/assets/{erDiagram-KYQIGQAA-BvnoTswC.js → erDiagram-KYQIGQAA-BsFCBexZ.js} +1 -1
- package/dist/web/assets/{eventmodeling-K75KTNOO-D71pbA8B.js → eventmodeling-K75KTNOO-Djt53UEa.js} +1 -1
- package/dist/web/assets/flowDiagram-IUGLLWBU-BvI9h7TL.js +1 -0
- package/dist/web/assets/{ganttDiagram-R7GPNTJY-C6rCQD2I.js → ganttDiagram-R7GPNTJY-DBquLWQM.js} +1 -1
- package/dist/web/assets/{gitGraph-VSP46ZUC-BGvanMn4.js → gitGraph-VSP46ZUC-DFSe9nWV.js} +1 -1
- package/dist/web/assets/{gitGraphDiagram-PDYL7XHY-BHdauTG3.js → gitGraphDiagram-PDYL7XHY-CmfaFop_.js} +1 -1
- package/dist/web/assets/{index-B63XFWyv.js → index-DqFC_8X4.js} +8 -8
- package/dist/web/assets/{info-OHQRW6UA-CcjtcXni.js → info-OHQRW6UA-tMJdHtJC.js} +1 -1
- package/dist/web/assets/{infoDiagram-MVDRKAX5-MYJobcL9.js → infoDiagram-MVDRKAX5-BFHE2lqW.js} +1 -1
- package/dist/web/assets/{ishikawaDiagram-HPEHV2GE-Psi_IHly.js → ishikawaDiagram-HPEHV2GE-C0I9Dsv7.js} +1 -1
- package/dist/web/assets/{journeyDiagram-BOSHW7O7-Cr4HAmh0.js → journeyDiagram-BOSHW7O7-C3RINSBQ.js} +1 -1
- package/dist/web/assets/{kanban-definition-FNSA4HC5-jxyhrW3G.js → kanban-definition-FNSA4HC5-3E3lIhYM.js} +1 -1
- package/dist/web/assets/{line-CNxlQX4M.js → line-DBWSiyI7.js} +1 -1
- package/dist/web/assets/{linear--NJWiJ9W.js → linear-ibpVQd4n.js} +1 -1
- package/dist/web/assets/{mermaid-parser.core-sNBwe3zk.js → mermaid-parser.core-hoJQmGdf.js} +3 -3
- package/dist/web/assets/{mermaid.core-Bprxe1pT.js → mermaid.core-DZW-hwJE.js} +4 -4
- package/dist/web/assets/{mindmap-definition-6OY57UG3-C0LMAiFc.js → mindmap-definition-6OY57UG3-4vngyXxE.js} +1 -1
- package/dist/web/assets/{packet-JDAUHWVQ-vNf7Cv_O.js → packet-JDAUHWVQ-gWdSwfXw.js} +1 -1
- package/dist/web/assets/{pegDiagram-ECIUJNBX-DYUvwQ4J.js → pegDiagram-ECIUJNBX-D1vgfWxA.js} +1 -1
- package/dist/web/assets/{pie-XZMESJXO-CBKeDUwO.js → pie-XZMESJXO-BJPbe0FK.js} +1 -1
- package/dist/web/assets/{pieDiagram-GNMPY74T-DTIK7Z-L.js → pieDiagram-GNMPY74T-TDuwnAZ-.js} +1 -1
- package/dist/web/assets/{quadrantDiagram-D57K4MC3-A44MmCfc.js → quadrantDiagram-D57K4MC3-CdYZQzuA.js} +1 -1
- package/dist/web/assets/{radar-ABXABTNO-CJgPqPwV.js → radar-ABXABTNO-DtHBE3Zn.js} +1 -1
- package/dist/web/assets/{railroad-I3PHUGI6--iwkcGQQ.js → railroad-I3PHUGI6-ClFe7XDj.js} +1 -1
- package/dist/web/assets/{railroad-abnf-LNEFI6M7-Dk7z4OWN.js → railroad-abnf-LNEFI6M7-DdgqBfiy.js} +1 -1
- package/dist/web/assets/{railroad-ebnf-DWYD2UWJ-D_wdSwm6.js → railroad-ebnf-DWYD2UWJ-BKXBeuek.js} +1 -1
- package/dist/web/assets/{railroad-peg-JR7BVNR7-CEoZVoK6.js → railroad-peg-JR7BVNR7-CxxOQoxy.js} +1 -1
- package/dist/web/assets/{railroadDiagram-Y72NRBL7-CUtTGpaj.js → railroadDiagram-Y72NRBL7-CM0S9LYU.js} +1 -1
- package/dist/web/assets/{requirementDiagram-EQYSW5RA-tH0aCAi1.js → requirementDiagram-EQYSW5RA-C7uN9q4j.js} +1 -1
- package/dist/web/assets/{sankeyDiagram-SY24JHO5-D14JYHRm.js → sankeyDiagram-SY24JHO5-C8yoE6YR.js} +1 -1
- package/dist/web/assets/{sequenceDiagram-BLEHNHQU-D5IY4yFL.js → sequenceDiagram-BLEHNHQU-Cso3CFsM.js} +1 -1
- package/dist/web/assets/{src-B8K_a83e.js → src-BkGwF3ik.js} +1 -1
- package/dist/web/assets/{stateDiagram-v2-A6IESKWZ-Co_JCSST.js → stateDiagram-v2-A6IESKWZ-Dkc4FmT3.js} +1 -1
- package/dist/web/assets/{swimlanes-B3ENRKFQ-B6Sp1jzn.js → swimlanes-B3ENRKFQ-6FBtw0UR.js} +1 -1
- package/dist/web/assets/swimlanesDiagram-AYQRV4AK-Cx0n-F9N.js +8 -0
- package/dist/web/assets/{timeline-definition-JXYKGLGB-C39JQvkU.js → timeline-definition-JXYKGLGB-DIK_We3A.js} +1 -1
- package/dist/web/assets/{treeView-D4JQ5SDB-COV5qRrd.js → treeView-D4JQ5SDB-C-Mw7rCl.js} +1 -1
- package/dist/web/assets/{treemap-SAJKECNS-BQeVkrEA.js → treemap-SAJKECNS-DM15x_0o.js} +1 -1
- package/dist/web/assets/{usecaseDiagram-WPOLBNNX-BZTx892-.js → usecaseDiagram-WPOLBNNX-Rrrf5RFl.js} +1 -1
- package/dist/web/assets/{vennDiagram-Q3Y3IDCW-CYF0RQdz.js → vennDiagram-Q3Y3IDCW-DJTS-DWI.js} +1 -1
- package/dist/web/assets/{wardley-7MLQ67FV-jpzdSmzm.js → wardley-7MLQ67FV-BMRjoELd.js} +1 -1
- package/dist/web/assets/{wardleyDiagram-IVAIDKWA-DrXDqijK.js → wardleyDiagram-IVAIDKWA-BTZUA_5x.js} +1 -1
- package/dist/web/assets/{xychartDiagram-4URNHDU4-B-jWn5HS.js → xychartDiagram-4URNHDU4-CWd1q7VO.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +3 -3
- package/dist/web/assets/channel-BSSgis91.js +0 -1
- package/dist/web/assets/flowDiagram-IUGLLWBU-Dt5BcUUc.js +0 -1
- package/dist/web/assets/swimlanesDiagram-AYQRV4AK-DruJRTbj.js +0 -8
package/dist/update-worker.cjs
CHANGED
|
@@ -986,7 +986,7 @@ var require_redaction = __commonJS({
|
|
|
986
986
|
o[ns].push(nextPath);
|
|
987
987
|
return o;
|
|
988
988
|
}, /* @__PURE__ */ Object.create(null));
|
|
989
|
-
const
|
|
989
|
+
const result2 = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
990
990
|
[redactFmtSym]: Redact({ paths, censor, serialize, strict, remove })
|
|
991
991
|
});
|
|
992
992
|
const topCensor = (...args) => {
|
|
@@ -1008,7 +1008,7 @@ var require_redaction = __commonJS({
|
|
|
1008
1008
|
});
|
|
1009
1009
|
}
|
|
1010
1010
|
return o;
|
|
1011
|
-
},
|
|
1011
|
+
}, result2);
|
|
1012
1012
|
}
|
|
1013
1013
|
function handle(opts) {
|
|
1014
1014
|
if (Array.isArray(opts)) {
|
|
@@ -1975,9 +1975,9 @@ var require_wait = __commonJS({
|
|
|
1975
1975
|
return;
|
|
1976
1976
|
}
|
|
1977
1977
|
const remaining = max === Infinity ? WAIT_MS : Math.min(WAIT_MS, Math.max(1, max - Date.now()));
|
|
1978
|
-
const
|
|
1979
|
-
if (
|
|
1980
|
-
|
|
1978
|
+
const result2 = Atomics.waitAsync(state, index, current, remaining);
|
|
1979
|
+
if (result2.async) {
|
|
1980
|
+
result2.value.then((res) => {
|
|
1981
1981
|
if (res === "ok") {
|
|
1982
1982
|
const latest = Atomics.load(state, index);
|
|
1983
1983
|
done(null, latest >= expected ? "ok" : "not-equal");
|
|
@@ -2004,9 +2004,9 @@ var require_wait = __commonJS({
|
|
|
2004
2004
|
return;
|
|
2005
2005
|
}
|
|
2006
2006
|
const remaining = max === Infinity ? WAIT_MS : Math.min(WAIT_MS, Math.max(1, max - Date.now()));
|
|
2007
|
-
const
|
|
2008
|
-
if (
|
|
2009
|
-
|
|
2007
|
+
const result2 = Atomics.waitAsync(state, index, expected, remaining);
|
|
2008
|
+
if (result2.async) {
|
|
2009
|
+
result2.value.then((res) => {
|
|
2010
2010
|
if (res === "ok") {
|
|
2011
2011
|
done(null, "ok");
|
|
2012
2012
|
return;
|
|
@@ -2045,7 +2045,7 @@ var require_thread_stream = __commonJS({
|
|
|
2045
2045
|
var { version: version3 } = require_package();
|
|
2046
2046
|
var { EventEmitter } = require("events");
|
|
2047
2047
|
var { Worker } = require("worker_threads");
|
|
2048
|
-
var { join:
|
|
2048
|
+
var { join: join15 } = require("path");
|
|
2049
2049
|
var { pathToFileURL } = require("url");
|
|
2050
2050
|
var { wait } = require_wait();
|
|
2051
2051
|
var {
|
|
@@ -2097,7 +2097,7 @@ var require_thread_stream = __commonJS({
|
|
|
2097
2097
|
function createWorker(stream, opts) {
|
|
2098
2098
|
const { filename, workerData } = opts;
|
|
2099
2099
|
const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
|
|
2100
|
-
const toExecute = bundlerOverrides["thread-stream-worker"] ||
|
|
2100
|
+
const toExecute = bundlerOverrides["thread-stream-worker"] || join15(__dirname, "lib", "worker.js");
|
|
2101
2101
|
const worker2 = new Worker(toExecute, {
|
|
2102
2102
|
...opts.workerOpts,
|
|
2103
2103
|
name: opts.workerOpts?.name || "thread-stream",
|
|
@@ -2610,7 +2610,7 @@ var require_transport = __commonJS({
|
|
|
2610
2610
|
var { createRequire: createRequire2 } = require("module");
|
|
2611
2611
|
var { existsSync } = require("node:fs");
|
|
2612
2612
|
var getCallers = require_caller();
|
|
2613
|
-
var { join:
|
|
2613
|
+
var { join: join15, isAbsolute: isAbsolute3, sep } = require("node:path");
|
|
2614
2614
|
var { fileURLToPath } = require("node:url");
|
|
2615
2615
|
var sleep = require_atomic_sleep();
|
|
2616
2616
|
var onExit = require_on_exit_leak_free();
|
|
@@ -2765,7 +2765,7 @@ var require_transport = __commonJS({
|
|
|
2765
2765
|
throw new Error("only one of target or targets can be specified");
|
|
2766
2766
|
}
|
|
2767
2767
|
if (targets) {
|
|
2768
|
-
target = bundlerOverrides["pino-worker"] ||
|
|
2768
|
+
target = bundlerOverrides["pino-worker"] || join15(__dirname, "worker.js");
|
|
2769
2769
|
options.targets = targets.filter((dest) => dest.target).map((dest) => {
|
|
2770
2770
|
return {
|
|
2771
2771
|
...dest,
|
|
@@ -2786,7 +2786,7 @@ var require_transport = __commonJS({
|
|
|
2786
2786
|
const pipelinesHaveLevel = options.pipelines.some((p) => p.some((t) => t.level != null));
|
|
2787
2787
|
usesMultistream = options.targets.length + options.pipelines.length > 1 || targetsHaveLevel || pipelinesHaveLevel;
|
|
2788
2788
|
} else if (pipeline) {
|
|
2789
|
-
target = bundlerOverrides["pino-worker"] ||
|
|
2789
|
+
target = bundlerOverrides["pino-worker"] || join15(__dirname, "worker.js");
|
|
2790
2790
|
options.pipelines = [pipeline.map((dest) => {
|
|
2791
2791
|
return {
|
|
2792
2792
|
...dest,
|
|
@@ -2813,7 +2813,7 @@ var require_transport = __commonJS({
|
|
|
2813
2813
|
return origin2;
|
|
2814
2814
|
}
|
|
2815
2815
|
if (origin2 === "pino/file") {
|
|
2816
|
-
return
|
|
2816
|
+
return join15(__dirname, "..", "file.js");
|
|
2817
2817
|
}
|
|
2818
2818
|
let fixTarget2;
|
|
2819
2819
|
for (const filePath of callers) {
|
|
@@ -2905,7 +2905,7 @@ var require_tools = __commonJS({
|
|
|
2905
2905
|
}
|
|
2906
2906
|
}
|
|
2907
2907
|
function _asString(str) {
|
|
2908
|
-
let
|
|
2908
|
+
let result2 = "";
|
|
2909
2909
|
let last = 0;
|
|
2910
2910
|
let found = false;
|
|
2911
2911
|
let point = 255;
|
|
@@ -2916,17 +2916,17 @@ var require_tools = __commonJS({
|
|
|
2916
2916
|
for (var i = 0; i < l && point >= 32; i++) {
|
|
2917
2917
|
point = str.charCodeAt(i);
|
|
2918
2918
|
if (point === 34 || point === 92) {
|
|
2919
|
-
|
|
2919
|
+
result2 += str.slice(last, i) + "\\";
|
|
2920
2920
|
last = i;
|
|
2921
2921
|
found = true;
|
|
2922
2922
|
}
|
|
2923
2923
|
}
|
|
2924
2924
|
if (!found) {
|
|
2925
|
-
|
|
2925
|
+
result2 = str;
|
|
2926
2926
|
} else {
|
|
2927
|
-
|
|
2927
|
+
result2 += str.slice(last);
|
|
2928
2928
|
}
|
|
2929
|
-
return point < 32 ? JSON.stringify(str) : '"' +
|
|
2929
|
+
return point < 32 ? JSON.stringify(str) : '"' + result2 + '"';
|
|
2930
2930
|
}
|
|
2931
2931
|
function asJson(obj, msg, num, time3) {
|
|
2932
2932
|
if (asJsonChan.hasSubscribers === false) {
|
|
@@ -3793,7 +3793,7 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
3793
3793
|
return circularValue;
|
|
3794
3794
|
}
|
|
3795
3795
|
let res = "";
|
|
3796
|
-
let
|
|
3796
|
+
let join15 = ",";
|
|
3797
3797
|
const originalIndentation = indentation;
|
|
3798
3798
|
if (Array.isArray(value)) {
|
|
3799
3799
|
if (value.length === 0) {
|
|
@@ -3807,7 +3807,7 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
3807
3807
|
indentation += spacer;
|
|
3808
3808
|
res += `
|
|
3809
3809
|
${indentation}`;
|
|
3810
|
-
|
|
3810
|
+
join15 = `,
|
|
3811
3811
|
${indentation}`;
|
|
3812
3812
|
}
|
|
3813
3813
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
@@ -3815,13 +3815,13 @@ ${indentation}`;
|
|
|
3815
3815
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
3816
3816
|
const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
3817
3817
|
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
3818
|
-
res +=
|
|
3818
|
+
res += join15;
|
|
3819
3819
|
}
|
|
3820
3820
|
const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
3821
3821
|
res += tmp !== void 0 ? tmp : "null";
|
|
3822
3822
|
if (value.length - 1 > maximumBreadth) {
|
|
3823
3823
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
3824
|
-
res += `${
|
|
3824
|
+
res += `${join15}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
3825
3825
|
}
|
|
3826
3826
|
if (spacer !== "") {
|
|
3827
3827
|
res += `
|
|
@@ -3842,7 +3842,7 @@ ${originalIndentation}`;
|
|
|
3842
3842
|
let separator = "";
|
|
3843
3843
|
if (spacer !== "") {
|
|
3844
3844
|
indentation += spacer;
|
|
3845
|
-
|
|
3845
|
+
join15 = `,
|
|
3846
3846
|
${indentation}`;
|
|
3847
3847
|
whitespace = " ";
|
|
3848
3848
|
}
|
|
@@ -3856,13 +3856,13 @@ ${indentation}`;
|
|
|
3856
3856
|
const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
|
|
3857
3857
|
if (tmp !== void 0) {
|
|
3858
3858
|
res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
|
|
3859
|
-
separator =
|
|
3859
|
+
separator = join15;
|
|
3860
3860
|
}
|
|
3861
3861
|
}
|
|
3862
3862
|
if (keyLength > maximumBreadth) {
|
|
3863
3863
|
const removedKeys = keyLength - maximumBreadth;
|
|
3864
3864
|
res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
|
|
3865
|
-
separator =
|
|
3865
|
+
separator = join15;
|
|
3866
3866
|
}
|
|
3867
3867
|
if (spacer !== "" && separator.length > 1) {
|
|
3868
3868
|
res = `
|
|
@@ -3903,7 +3903,7 @@ ${originalIndentation}`;
|
|
|
3903
3903
|
}
|
|
3904
3904
|
const originalIndentation = indentation;
|
|
3905
3905
|
let res = "";
|
|
3906
|
-
let
|
|
3906
|
+
let join15 = ",";
|
|
3907
3907
|
if (Array.isArray(value)) {
|
|
3908
3908
|
if (value.length === 0) {
|
|
3909
3909
|
return "[]";
|
|
@@ -3916,7 +3916,7 @@ ${originalIndentation}`;
|
|
|
3916
3916
|
indentation += spacer;
|
|
3917
3917
|
res += `
|
|
3918
3918
|
${indentation}`;
|
|
3919
|
-
|
|
3919
|
+
join15 = `,
|
|
3920
3920
|
${indentation}`;
|
|
3921
3921
|
}
|
|
3922
3922
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
@@ -3924,13 +3924,13 @@ ${indentation}`;
|
|
|
3924
3924
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
3925
3925
|
const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
|
3926
3926
|
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
3927
|
-
res +=
|
|
3927
|
+
res += join15;
|
|
3928
3928
|
}
|
|
3929
3929
|
const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
|
3930
3930
|
res += tmp !== void 0 ? tmp : "null";
|
|
3931
3931
|
if (value.length - 1 > maximumBreadth) {
|
|
3932
3932
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
3933
|
-
res += `${
|
|
3933
|
+
res += `${join15}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
3934
3934
|
}
|
|
3935
3935
|
if (spacer !== "") {
|
|
3936
3936
|
res += `
|
|
@@ -3943,7 +3943,7 @@ ${originalIndentation}`;
|
|
|
3943
3943
|
let whitespace = "";
|
|
3944
3944
|
if (spacer !== "") {
|
|
3945
3945
|
indentation += spacer;
|
|
3946
|
-
|
|
3946
|
+
join15 = `,
|
|
3947
3947
|
${indentation}`;
|
|
3948
3948
|
whitespace = " ";
|
|
3949
3949
|
}
|
|
@@ -3952,7 +3952,7 @@ ${indentation}`;
|
|
|
3952
3952
|
const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
|
|
3953
3953
|
if (tmp !== void 0) {
|
|
3954
3954
|
res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
|
|
3955
|
-
separator =
|
|
3955
|
+
separator = join15;
|
|
3956
3956
|
}
|
|
3957
3957
|
}
|
|
3958
3958
|
if (spacer !== "" && separator.length > 1) {
|
|
@@ -4010,20 +4010,20 @@ ${originalIndentation}`;
|
|
|
4010
4010
|
indentation += spacer;
|
|
4011
4011
|
let res2 = `
|
|
4012
4012
|
${indentation}`;
|
|
4013
|
-
const
|
|
4013
|
+
const join16 = `,
|
|
4014
4014
|
${indentation}`;
|
|
4015
4015
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
4016
4016
|
let i = 0;
|
|
4017
4017
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
4018
4018
|
const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
|
4019
4019
|
res2 += tmp2 !== void 0 ? tmp2 : "null";
|
|
4020
|
-
res2 +=
|
|
4020
|
+
res2 += join16;
|
|
4021
4021
|
}
|
|
4022
4022
|
const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
|
4023
4023
|
res2 += tmp !== void 0 ? tmp : "null";
|
|
4024
4024
|
if (value.length - 1 > maximumBreadth) {
|
|
4025
4025
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
4026
|
-
res2 += `${
|
|
4026
|
+
res2 += `${join16}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
4027
4027
|
}
|
|
4028
4028
|
res2 += `
|
|
4029
4029
|
${originalIndentation}`;
|
|
@@ -4039,16 +4039,16 @@ ${originalIndentation}`;
|
|
|
4039
4039
|
return '"[Object]"';
|
|
4040
4040
|
}
|
|
4041
4041
|
indentation += spacer;
|
|
4042
|
-
const
|
|
4042
|
+
const join15 = `,
|
|
4043
4043
|
${indentation}`;
|
|
4044
4044
|
let res = "";
|
|
4045
4045
|
let separator = "";
|
|
4046
4046
|
let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
|
|
4047
4047
|
if (isTypedArrayWithEntries(value)) {
|
|
4048
|
-
res += stringifyTypedArray(value,
|
|
4048
|
+
res += stringifyTypedArray(value, join15, maximumBreadth);
|
|
4049
4049
|
keys = keys.slice(value.length);
|
|
4050
4050
|
maximumPropertiesToStringify -= value.length;
|
|
4051
|
-
separator =
|
|
4051
|
+
separator = join15;
|
|
4052
4052
|
}
|
|
4053
4053
|
if (deterministic) {
|
|
4054
4054
|
keys = sort(keys, comparator);
|
|
@@ -4059,13 +4059,13 @@ ${indentation}`;
|
|
|
4059
4059
|
const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
|
|
4060
4060
|
if (tmp !== void 0) {
|
|
4061
4061
|
res += `${separator}${strEscape(key2)}: ${tmp}`;
|
|
4062
|
-
separator =
|
|
4062
|
+
separator = join15;
|
|
4063
4063
|
}
|
|
4064
4064
|
}
|
|
4065
4065
|
if (keyLength > maximumBreadth) {
|
|
4066
4066
|
const removedKeys = keyLength - maximumBreadth;
|
|
4067
4067
|
res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
|
|
4068
|
-
separator =
|
|
4068
|
+
separator = join15;
|
|
4069
4069
|
}
|
|
4070
4070
|
if (separator !== "") {
|
|
4071
4071
|
res = `
|
|
@@ -5179,15 +5179,15 @@ var require_max = __commonJS({
|
|
|
5179
5179
|
var _index = require_constructFrom();
|
|
5180
5180
|
var _index2 = require_toDate();
|
|
5181
5181
|
function max(dates, options) {
|
|
5182
|
-
let
|
|
5182
|
+
let result2;
|
|
5183
5183
|
let context2 = options?.in;
|
|
5184
5184
|
dates.forEach((date5) => {
|
|
5185
5185
|
if (!context2 && typeof date5 === "object")
|
|
5186
5186
|
context2 = _index.constructFrom.bind(null, date5);
|
|
5187
5187
|
const date_ = (0, _index2.toDate)(date5, context2);
|
|
5188
|
-
if (!
|
|
5188
|
+
if (!result2 || result2 < date_ || isNaN(+date_)) result2 = date_;
|
|
5189
5189
|
});
|
|
5190
|
-
return (0, _index.constructFrom)(context2,
|
|
5190
|
+
return (0, _index.constructFrom)(context2, result2 || NaN);
|
|
5191
5191
|
}
|
|
5192
5192
|
}
|
|
5193
5193
|
});
|
|
@@ -5200,15 +5200,15 @@ var require_min = __commonJS({
|
|
|
5200
5200
|
var _index = require_constructFrom();
|
|
5201
5201
|
var _index2 = require_toDate();
|
|
5202
5202
|
function min(dates, options) {
|
|
5203
|
-
let
|
|
5203
|
+
let result2;
|
|
5204
5204
|
let context2 = options?.in;
|
|
5205
5205
|
dates.forEach((date5) => {
|
|
5206
5206
|
if (!context2 && typeof date5 === "object")
|
|
5207
5207
|
context2 = _index.constructFrom.bind(null, date5);
|
|
5208
5208
|
const date_ = (0, _index2.toDate)(date5, context2);
|
|
5209
|
-
if (!
|
|
5209
|
+
if (!result2 || result2 > date_ || isNaN(+date_)) result2 = date_;
|
|
5210
5210
|
});
|
|
5211
|
-
return (0, _index.constructFrom)(context2,
|
|
5211
|
+
return (0, _index.constructFrom)(context2, result2 || NaN);
|
|
5212
5212
|
}
|
|
5213
5213
|
}
|
|
5214
5214
|
});
|
|
@@ -5245,22 +5245,22 @@ var require_closestIndexTo = __commonJS({
|
|
|
5245
5245
|
function closestIndexTo(dateToCompare, dates) {
|
|
5246
5246
|
const timeToCompare = +(0, _index.toDate)(dateToCompare);
|
|
5247
5247
|
if (isNaN(timeToCompare)) return NaN;
|
|
5248
|
-
let
|
|
5248
|
+
let result2;
|
|
5249
5249
|
let minDistance;
|
|
5250
5250
|
dates.forEach((date5, index) => {
|
|
5251
5251
|
const date_ = (0, _index.toDate)(date5);
|
|
5252
5252
|
if (isNaN(+date_)) {
|
|
5253
|
-
|
|
5253
|
+
result2 = NaN;
|
|
5254
5254
|
minDistance = NaN;
|
|
5255
5255
|
return;
|
|
5256
5256
|
}
|
|
5257
5257
|
const distance = Math.abs(timeToCompare - +date_);
|
|
5258
|
-
if (
|
|
5259
|
-
|
|
5258
|
+
if (result2 == null || distance < minDistance) {
|
|
5259
|
+
result2 = index;
|
|
5260
5260
|
minDistance = distance;
|
|
5261
5261
|
}
|
|
5262
5262
|
});
|
|
5263
|
-
return
|
|
5263
|
+
return result2;
|
|
5264
5264
|
}
|
|
5265
5265
|
}
|
|
5266
5266
|
});
|
|
@@ -5336,8 +5336,8 @@ var require_daysToWeeks = __commonJS({
|
|
|
5336
5336
|
exports2.daysToWeeks = daysToWeeks;
|
|
5337
5337
|
var _index = require_constants2();
|
|
5338
5338
|
function daysToWeeks(days) {
|
|
5339
|
-
const
|
|
5340
|
-
return
|
|
5339
|
+
const result2 = Math.trunc(days / _index.daysInWeek);
|
|
5340
|
+
return result2 === 0 ? 0 : result2;
|
|
5341
5341
|
}
|
|
5342
5342
|
}
|
|
5343
5343
|
});
|
|
@@ -5406,13 +5406,13 @@ var require_differenceInBusinessDays = __commonJS({
|
|
|
5406
5406
|
const diff = (0, _index3.differenceInCalendarDays)(laterDate_, earlierDate_);
|
|
5407
5407
|
const sign = diff < 0 ? -1 : 1;
|
|
5408
5408
|
const weeks = Math.trunc(diff / 7);
|
|
5409
|
-
let
|
|
5409
|
+
let result2 = weeks * 5;
|
|
5410
5410
|
let movingDate = (0, _index2.addDays)(earlierDate_, weeks * 7);
|
|
5411
5411
|
while (!(0, _index4.isSameDay)(laterDate_, movingDate)) {
|
|
5412
|
-
|
|
5412
|
+
result2 += (0, _index6.isWeekend)(movingDate, options) ? 0 : sign;
|
|
5413
5413
|
movingDate = (0, _index2.addDays)(movingDate, sign);
|
|
5414
5414
|
}
|
|
5415
|
-
return
|
|
5415
|
+
return result2 === 0 ? 0 : result2;
|
|
5416
5416
|
}
|
|
5417
5417
|
}
|
|
5418
5418
|
});
|
|
@@ -5578,8 +5578,8 @@ var require_differenceInDays = __commonJS({
|
|
|
5578
5578
|
const isLastDayNotFull = Number(
|
|
5579
5579
|
compareLocalAsc(laterDate_, earlierDate_) === -sign
|
|
5580
5580
|
);
|
|
5581
|
-
const
|
|
5582
|
-
return
|
|
5581
|
+
const result2 = sign * (difference - isLastDayNotFull);
|
|
5582
|
+
return result2 === 0 ? 0 : result2;
|
|
5583
5583
|
}
|
|
5584
5584
|
function compareLocalAsc(laterDate, earlierDate) {
|
|
5585
5585
|
const diff = laterDate.getFullYear() - earlierDate.getFullYear() || laterDate.getMonth() - earlierDate.getMonth() || laterDate.getDate() - earlierDate.getDate() || laterDate.getHours() - earlierDate.getHours() || laterDate.getMinutes() - earlierDate.getMinutes() || laterDate.getSeconds() - earlierDate.getSeconds() || laterDate.getMilliseconds() - earlierDate.getMilliseconds();
|
|
@@ -5598,8 +5598,8 @@ var require_getRoundingMethod = __commonJS({
|
|
|
5598
5598
|
function getRoundingMethod(method) {
|
|
5599
5599
|
return (number4) => {
|
|
5600
5600
|
const round = method ? Math[method] : Math.trunc;
|
|
5601
|
-
const
|
|
5602
|
-
return
|
|
5601
|
+
const result2 = round(number4);
|
|
5602
|
+
return result2 === 0 ? 0 : result2;
|
|
5603
5603
|
};
|
|
5604
5604
|
}
|
|
5605
5605
|
}
|
|
@@ -5668,8 +5668,8 @@ var require_differenceInISOWeekYears = __commonJS({
|
|
|
5668
5668
|
const isLastISOWeekYearNotFull = Number(
|
|
5669
5669
|
(0, _index2.compareAsc)(adjustedDate, earlierDate_) === -sign
|
|
5670
5670
|
);
|
|
5671
|
-
const
|
|
5672
|
-
return
|
|
5671
|
+
const result2 = sign * (diff - isLastISOWeekYearNotFull);
|
|
5672
|
+
return result2 === 0 ? 0 : result2;
|
|
5673
5673
|
}
|
|
5674
5674
|
}
|
|
5675
5675
|
});
|
|
@@ -5769,8 +5769,8 @@ var require_differenceInMonths = __commonJS({
|
|
|
5769
5769
|
if ((0, _index4.isLastDayOfMonth)(laterDate_) && difference === 1 && (0, _index2.compareAsc)(laterDate_, earlierDate_) === 1) {
|
|
5770
5770
|
isLastMonthNotFull = false;
|
|
5771
5771
|
}
|
|
5772
|
-
const
|
|
5773
|
-
return
|
|
5772
|
+
const result2 = sign * (difference - +isLastMonthNotFull);
|
|
5773
|
+
return result2 === 0 ? 0 : result2;
|
|
5774
5774
|
}
|
|
5775
5775
|
}
|
|
5776
5776
|
});
|
|
@@ -5838,8 +5838,8 @@ var require_differenceInYears = __commonJS({
|
|
|
5838
5838
|
laterDate_.setFullYear(1584);
|
|
5839
5839
|
earlierDate_.setFullYear(1584);
|
|
5840
5840
|
const partial2 = (0, _index2.compareAsc)(laterDate_, earlierDate_) === -sign;
|
|
5841
|
-
const
|
|
5842
|
-
return
|
|
5841
|
+
const result2 = sign * (diff - +partial2);
|
|
5842
|
+
return result2 === 0 ? 0 : result2;
|
|
5843
5843
|
}
|
|
5844
5844
|
}
|
|
5845
5845
|
});
|
|
@@ -6443,23 +6443,23 @@ var require_formatDistance = __commonJS({
|
|
|
6443
6443
|
}
|
|
6444
6444
|
};
|
|
6445
6445
|
var formatDistance = (token, count, options) => {
|
|
6446
|
-
let
|
|
6446
|
+
let result2;
|
|
6447
6447
|
const tokenValue = formatDistanceLocale[token];
|
|
6448
6448
|
if (typeof tokenValue === "string") {
|
|
6449
|
-
|
|
6449
|
+
result2 = tokenValue;
|
|
6450
6450
|
} else if (count === 1) {
|
|
6451
|
-
|
|
6451
|
+
result2 = tokenValue.one;
|
|
6452
6452
|
} else {
|
|
6453
|
-
|
|
6453
|
+
result2 = tokenValue.other.replace("{{count}}", count.toString());
|
|
6454
6454
|
}
|
|
6455
6455
|
if (options?.addSuffix) {
|
|
6456
6456
|
if (options.comparison && options.comparison > 0) {
|
|
6457
|
-
return "in " +
|
|
6457
|
+
return "in " + result2;
|
|
6458
6458
|
} else {
|
|
6459
|
-
return
|
|
6459
|
+
return result2 + " ago";
|
|
6460
6460
|
}
|
|
6461
6461
|
}
|
|
6462
|
-
return
|
|
6462
|
+
return result2;
|
|
6463
6463
|
};
|
|
6464
6464
|
exports2.formatDistance = formatDistance;
|
|
6465
6465
|
}
|
|
@@ -8241,7 +8241,7 @@ var require_formatDuration = __commonJS({
|
|
|
8241
8241
|
if (!locale.formatDistance) {
|
|
8242
8242
|
return "";
|
|
8243
8243
|
}
|
|
8244
|
-
const
|
|
8244
|
+
const result2 = format.reduce((acc, unit) => {
|
|
8245
8245
|
const token = `x${unit.replace(/(^.)/, (m) => m.toUpperCase())}`;
|
|
8246
8246
|
const value = duration3[unit];
|
|
8247
8247
|
if (value !== void 0 && (zero || duration3[unit])) {
|
|
@@ -8249,7 +8249,7 @@ var require_formatDuration = __commonJS({
|
|
|
8249
8249
|
}
|
|
8250
8250
|
return acc;
|
|
8251
8251
|
}, []).join(delimiter2);
|
|
8252
|
-
return
|
|
8252
|
+
return result2;
|
|
8253
8253
|
}
|
|
8254
8254
|
}
|
|
8255
8255
|
});
|
|
@@ -8268,7 +8268,7 @@ var require_formatISO = __commonJS({
|
|
|
8268
8268
|
}
|
|
8269
8269
|
const format = options?.format ?? "extended";
|
|
8270
8270
|
const representation = options?.representation ?? "complete";
|
|
8271
|
-
let
|
|
8271
|
+
let result2 = "";
|
|
8272
8272
|
let tzOffset = "";
|
|
8273
8273
|
const dateDelimiter = format === "extended" ? "-" : "";
|
|
8274
8274
|
const timeDelimiter = format === "extended" ? ":" : "";
|
|
@@ -8276,7 +8276,7 @@ var require_formatISO = __commonJS({
|
|
|
8276
8276
|
const day = (0, _index.addLeadingZeros)(date_.getDate(), 2);
|
|
8277
8277
|
const month = (0, _index.addLeadingZeros)(date_.getMonth() + 1, 2);
|
|
8278
8278
|
const year = (0, _index.addLeadingZeros)(date_.getFullYear(), 4);
|
|
8279
|
-
|
|
8279
|
+
result2 = `${year}${dateDelimiter}${month}${dateDelimiter}${day}`;
|
|
8280
8280
|
}
|
|
8281
8281
|
if (representation !== "date") {
|
|
8282
8282
|
const offset = date_.getTimezoneOffset();
|
|
@@ -8295,11 +8295,11 @@ var require_formatISO = __commonJS({
|
|
|
8295
8295
|
const hour = (0, _index.addLeadingZeros)(date_.getHours(), 2);
|
|
8296
8296
|
const minute = (0, _index.addLeadingZeros)(date_.getMinutes(), 2);
|
|
8297
8297
|
const second = (0, _index.addLeadingZeros)(date_.getSeconds(), 2);
|
|
8298
|
-
const separator =
|
|
8298
|
+
const separator = result2 === "" ? "" : "T";
|
|
8299
8299
|
const time3 = [hour, minute, second].join(timeDelimiter);
|
|
8300
|
-
|
|
8300
|
+
result2 = `${result2}${separator}${time3}${tzOffset}`;
|
|
8301
8301
|
}
|
|
8302
|
-
return
|
|
8302
|
+
return result2;
|
|
8303
8303
|
}
|
|
8304
8304
|
}
|
|
8305
8305
|
});
|
|
@@ -8319,23 +8319,23 @@ var require_formatISO9075 = __commonJS({
|
|
|
8319
8319
|
}
|
|
8320
8320
|
const format = options?.format ?? "extended";
|
|
8321
8321
|
const representation = options?.representation ?? "complete";
|
|
8322
|
-
let
|
|
8322
|
+
let result2 = "";
|
|
8323
8323
|
const dateDelimiter = format === "extended" ? "-" : "";
|
|
8324
8324
|
const timeDelimiter = format === "extended" ? ":" : "";
|
|
8325
8325
|
if (representation !== "time") {
|
|
8326
8326
|
const day = (0, _index.addLeadingZeros)(date_.getDate(), 2);
|
|
8327
8327
|
const month = (0, _index.addLeadingZeros)(date_.getMonth() + 1, 2);
|
|
8328
8328
|
const year = (0, _index.addLeadingZeros)(date_.getFullYear(), 4);
|
|
8329
|
-
|
|
8329
|
+
result2 = `${year}${dateDelimiter}${month}${dateDelimiter}${day}`;
|
|
8330
8330
|
}
|
|
8331
8331
|
if (representation !== "date") {
|
|
8332
8332
|
const hour = (0, _index.addLeadingZeros)(date_.getHours(), 2);
|
|
8333
8333
|
const minute = (0, _index.addLeadingZeros)(date_.getMinutes(), 2);
|
|
8334
8334
|
const second = (0, _index.addLeadingZeros)(date_.getSeconds(), 2);
|
|
8335
|
-
const separator =
|
|
8336
|
-
|
|
8335
|
+
const separator = result2 === "" ? "" : " ";
|
|
8336
|
+
result2 = `${result2}${separator}${hour}${timeDelimiter}${minute}${timeDelimiter}${second}`;
|
|
8337
8337
|
}
|
|
8338
|
-
return
|
|
8338
|
+
return result2;
|
|
8339
8339
|
}
|
|
8340
8340
|
}
|
|
8341
8341
|
});
|
|
@@ -9215,19 +9215,19 @@ var require_Parser = __commonJS({
|
|
|
9215
9215
|
var _Setter = require_Setter();
|
|
9216
9216
|
var Parser = class {
|
|
9217
9217
|
run(dateString, token, match, options) {
|
|
9218
|
-
const
|
|
9219
|
-
if (!
|
|
9218
|
+
const result2 = this.parse(dateString, token, match, options);
|
|
9219
|
+
if (!result2) {
|
|
9220
9220
|
return null;
|
|
9221
9221
|
}
|
|
9222
9222
|
return {
|
|
9223
9223
|
setter: new _Setter.ValueSetter(
|
|
9224
|
-
|
|
9224
|
+
result2.value,
|
|
9225
9225
|
this.validate,
|
|
9226
9226
|
this.set,
|
|
9227
9227
|
this.priority,
|
|
9228
9228
|
this.subPriority
|
|
9229
9229
|
),
|
|
9230
|
-
rest:
|
|
9230
|
+
rest: result2.rest
|
|
9231
9231
|
};
|
|
9232
9232
|
}
|
|
9233
9233
|
validate(_utcDate, _value, _options) {
|
|
@@ -9460,16 +9460,16 @@ var require_utils = __commonJS({
|
|
|
9460
9460
|
function normalizeTwoDigitYear(twoDigitYear, currentYear) {
|
|
9461
9461
|
const isCommonEra = currentYear > 0;
|
|
9462
9462
|
const absCurrentYear = isCommonEra ? currentYear : 1 - currentYear;
|
|
9463
|
-
let
|
|
9463
|
+
let result2;
|
|
9464
9464
|
if (absCurrentYear <= 50) {
|
|
9465
|
-
|
|
9465
|
+
result2 = twoDigitYear || 100;
|
|
9466
9466
|
} else {
|
|
9467
9467
|
const rangeEnd = absCurrentYear + 50;
|
|
9468
9468
|
const rangeEndCentury = Math.trunc(rangeEnd / 100) * 100;
|
|
9469
9469
|
const isPreviousCentury = twoDigitYear >= rangeEnd % 100;
|
|
9470
|
-
|
|
9470
|
+
result2 = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0);
|
|
9471
9471
|
}
|
|
9472
|
-
return isCommonEra ?
|
|
9472
|
+
return isCommonEra ? result2 : 1 - result2;
|
|
9473
9473
|
}
|
|
9474
9474
|
function isLeapYearIndex(year) {
|
|
9475
9475
|
return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
|
|
@@ -11410,12 +11410,12 @@ var require_parse = __commonJS({
|
|
|
11410
11410
|
if (!setter.validate(date5, subFnOptions)) {
|
|
11411
11411
|
return invalidDate();
|
|
11412
11412
|
}
|
|
11413
|
-
const
|
|
11414
|
-
if (Array.isArray(
|
|
11415
|
-
date5 =
|
|
11416
|
-
Object.assign(flags2,
|
|
11413
|
+
const result2 = setter.set(date5, flags2, subFnOptions);
|
|
11414
|
+
if (Array.isArray(result2)) {
|
|
11415
|
+
date5 = result2[0];
|
|
11416
|
+
Object.assign(flags2, result2[1]);
|
|
11417
11417
|
} else {
|
|
11418
|
-
date5 =
|
|
11418
|
+
date5 = result2;
|
|
11419
11419
|
}
|
|
11420
11420
|
}
|
|
11421
11421
|
return date5;
|
|
@@ -12026,7 +12026,7 @@ var require_lightFormat = __commonJS({
|
|
|
12026
12026
|
}
|
|
12027
12027
|
const tokens = formatStr.match(formattingTokensRegExp);
|
|
12028
12028
|
if (!tokens) return "";
|
|
12029
|
-
const
|
|
12029
|
+
const result2 = tokens.map((substring) => {
|
|
12030
12030
|
if (substring === "''") {
|
|
12031
12031
|
return "'";
|
|
12032
12032
|
}
|
|
@@ -12045,7 +12045,7 @@ var require_lightFormat = __commonJS({
|
|
|
12045
12045
|
}
|
|
12046
12046
|
return substring;
|
|
12047
12047
|
}).join("");
|
|
12048
|
-
return
|
|
12048
|
+
return result2;
|
|
12049
12049
|
}
|
|
12050
12050
|
function cleanEscapedString(input2) {
|
|
12051
12051
|
const matches = input2.match(escapedStringRegExp);
|
|
@@ -12307,19 +12307,19 @@ var require_parseISO = __commonJS({
|
|
|
12307
12307
|
if (isNaN(offset)) return invalidDate();
|
|
12308
12308
|
} else {
|
|
12309
12309
|
const tmpDate = new Date(timestamp + time3);
|
|
12310
|
-
const
|
|
12311
|
-
|
|
12310
|
+
const result2 = (0, _index3.toDate)(0, options?.in);
|
|
12311
|
+
result2.setFullYear(
|
|
12312
12312
|
tmpDate.getUTCFullYear(),
|
|
12313
12313
|
tmpDate.getUTCMonth(),
|
|
12314
12314
|
tmpDate.getUTCDate()
|
|
12315
12315
|
);
|
|
12316
|
-
|
|
12316
|
+
result2.setHours(
|
|
12317
12317
|
tmpDate.getUTCHours(),
|
|
12318
12318
|
tmpDate.getUTCMinutes(),
|
|
12319
12319
|
tmpDate.getUTCSeconds(),
|
|
12320
12320
|
tmpDate.getUTCMilliseconds()
|
|
12321
12321
|
);
|
|
12322
|
-
return
|
|
12322
|
+
return result2;
|
|
12323
12323
|
}
|
|
12324
12324
|
return (0, _index3.toDate)(timestamp + time3 + offset, options?.in);
|
|
12325
12325
|
}
|
|
@@ -12782,23 +12782,23 @@ var require_setDefaultOptions = __commonJS({
|
|
|
12782
12782
|
exports2.setDefaultOptions = setDefaultOptions;
|
|
12783
12783
|
var _index = require_defaultOptions();
|
|
12784
12784
|
function setDefaultOptions(options) {
|
|
12785
|
-
const
|
|
12785
|
+
const result2 = {};
|
|
12786
12786
|
const defaultOptions = (0, _index.getDefaultOptions)();
|
|
12787
12787
|
for (const property in defaultOptions) {
|
|
12788
12788
|
if (Object.prototype.hasOwnProperty.call(defaultOptions, property)) {
|
|
12789
|
-
|
|
12789
|
+
result2[property] = defaultOptions[property];
|
|
12790
12790
|
}
|
|
12791
12791
|
}
|
|
12792
12792
|
for (const property in options) {
|
|
12793
12793
|
if (Object.prototype.hasOwnProperty.call(options, property)) {
|
|
12794
12794
|
if (options[property] === void 0) {
|
|
12795
|
-
delete
|
|
12795
|
+
delete result2[property];
|
|
12796
12796
|
} else {
|
|
12797
|
-
|
|
12797
|
+
result2[property] = options[property];
|
|
12798
12798
|
}
|
|
12799
12799
|
}
|
|
12800
12800
|
}
|
|
12801
|
-
(0, _index.setDefaultOptions)(
|
|
12801
|
+
(0, _index.setDefaultOptions)(result2);
|
|
12802
12802
|
}
|
|
12803
12803
|
}
|
|
12804
12804
|
});
|
|
@@ -15887,10 +15887,10 @@ var require_utils2 = __commonJS({
|
|
|
15887
15887
|
"use strict";
|
|
15888
15888
|
var { readdir: readdir4, stat, unlink: unlink3, symlink, lstat: lstat5, readlink } = require("fs/promises");
|
|
15889
15889
|
var { symlinkSync, unlinkSync, lstatSync, readlinkSync } = require("fs");
|
|
15890
|
-
var { dirname: dirname8, join:
|
|
15890
|
+
var { dirname: dirname8, join: join15 } = require("path");
|
|
15891
15891
|
var { format, addDays, addHours, parse: parse3, isValid } = require_date_fns();
|
|
15892
|
-
var { promisify:
|
|
15893
|
-
var sleep =
|
|
15892
|
+
var { promisify: promisify8 } = require("util");
|
|
15893
|
+
var sleep = promisify8(setTimeout);
|
|
15894
15894
|
function parseSize(size) {
|
|
15895
15895
|
let multiplier = 1024 ** 2;
|
|
15896
15896
|
if (typeof size !== "string" && typeof size !== "number") {
|
|
@@ -16016,7 +16016,7 @@ var require_utils2 = __commonJS({
|
|
|
16016
16016
|
async function readFileTrailingNumbers(folder, time3, fileExtension) {
|
|
16017
16017
|
const numbers2 = [1];
|
|
16018
16018
|
for (const file2 of await readdir4(folder)) {
|
|
16019
|
-
if (time3 && !await isMatchingTime(
|
|
16019
|
+
if (time3 && !await isMatchingTime(join15(folder, file2), time3)) {
|
|
16020
16020
|
continue;
|
|
16021
16021
|
}
|
|
16022
16022
|
const number4 = extractTrailingNumber(file2, fileExtension);
|
|
@@ -16070,7 +16070,7 @@ var require_utils2 = __commonJS({
|
|
|
16070
16070
|
let files = [];
|
|
16071
16071
|
const pathSegments = getFileName(baseFile).split(/(\\|\/)/g);
|
|
16072
16072
|
const baseFileNameStr = pathSegments.pop();
|
|
16073
|
-
for (const fileEntry of await readdir4(
|
|
16073
|
+
for (const fileEntry of await readdir4(join15(...pathSegments))) {
|
|
16074
16074
|
const f = identifyLogFile(fileEntry, baseFileNameStr, dateFormat, extension);
|
|
16075
16075
|
if (f) {
|
|
16076
16076
|
files.push(f);
|
|
@@ -16085,7 +16085,7 @@ var require_utils2 = __commonJS({
|
|
|
16085
16085
|
if (files.length > count) {
|
|
16086
16086
|
const filesToRemove = files.slice(0, files.length - count);
|
|
16087
16087
|
await Promise.allSettled(
|
|
16088
|
-
filesToRemove.map((file2) => unlinkWithRetry(
|
|
16088
|
+
filesToRemove.map((file2) => unlinkWithRetry(join15(...pathSegments, file2.fileName)))
|
|
16089
16089
|
);
|
|
16090
16090
|
}
|
|
16091
16091
|
}
|
|
@@ -16102,7 +16102,7 @@ var require_utils2 = __commonJS({
|
|
|
16102
16102
|
return true;
|
|
16103
16103
|
}
|
|
16104
16104
|
async function createSymlink(fileVal) {
|
|
16105
|
-
const linkPath =
|
|
16105
|
+
const linkPath = join15(dirname8(fileVal), "current.log");
|
|
16106
16106
|
const shouldCreateSymlink = await checkSymlink(fileVal, linkPath);
|
|
16107
16107
|
if (shouldCreateSymlink) {
|
|
16108
16108
|
await symlink(extractFileName(fileVal), linkPath);
|
|
@@ -16128,7 +16128,7 @@ var require_utils2 = __commonJS({
|
|
|
16128
16128
|
}
|
|
16129
16129
|
}
|
|
16130
16130
|
function createSymlinkSync(fileVal) {
|
|
16131
|
-
const linkPath =
|
|
16131
|
+
const linkPath = join15(dirname8(fileVal), "current.log");
|
|
16132
16132
|
const shouldCreateSymlink = checkSymlinkSync(fileVal, linkPath);
|
|
16133
16133
|
if (shouldCreateSymlink) {
|
|
16134
16134
|
symlinkSync(extractFileName(fileVal), linkPath);
|
|
@@ -16837,8 +16837,8 @@ var require_graceful_fs = __commonJS({
|
|
|
16837
16837
|
fs2.createReadStream = createReadStream2;
|
|
16838
16838
|
fs2.createWriteStream = createWriteStream;
|
|
16839
16839
|
var fs$readFile = fs2.readFile;
|
|
16840
|
-
fs2.readFile =
|
|
16841
|
-
function
|
|
16840
|
+
fs2.readFile = readFile6;
|
|
16841
|
+
function readFile6(path, options, cb) {
|
|
16842
16842
|
if (typeof options === "function")
|
|
16843
16843
|
cb = options, options = null;
|
|
16844
16844
|
return go$readFile(path, options, cb);
|
|
@@ -16854,8 +16854,8 @@ var require_graceful_fs = __commonJS({
|
|
|
16854
16854
|
}
|
|
16855
16855
|
}
|
|
16856
16856
|
var fs$writeFile = fs2.writeFile;
|
|
16857
|
-
fs2.writeFile =
|
|
16858
|
-
function
|
|
16857
|
+
fs2.writeFile = writeFile5;
|
|
16858
|
+
function writeFile5(path, data, options, cb) {
|
|
16859
16859
|
if (typeof options === "function")
|
|
16860
16860
|
cb = options, options = null;
|
|
16861
16861
|
return go$writeFile(path, data, options, cb);
|
|
@@ -17845,11 +17845,11 @@ var require_adapter = __commonJS({
|
|
|
17845
17845
|
}
|
|
17846
17846
|
function toPromise(method) {
|
|
17847
17847
|
return (...args) => new Promise((resolve4, reject) => {
|
|
17848
|
-
args.push((err,
|
|
17848
|
+
args.push((err, result2) => {
|
|
17849
17849
|
if (err) {
|
|
17850
17850
|
reject(err);
|
|
17851
17851
|
} else {
|
|
17852
|
-
resolve4(
|
|
17852
|
+
resolve4(result2);
|
|
17853
17853
|
}
|
|
17854
17854
|
});
|
|
17855
17855
|
method(...args);
|
|
@@ -17858,16 +17858,16 @@ var require_adapter = __commonJS({
|
|
|
17858
17858
|
function toSync(method) {
|
|
17859
17859
|
return (...args) => {
|
|
17860
17860
|
let err;
|
|
17861
|
-
let
|
|
17861
|
+
let result2;
|
|
17862
17862
|
args.push((_err, _result) => {
|
|
17863
17863
|
err = _err;
|
|
17864
|
-
|
|
17864
|
+
result2 = _result;
|
|
17865
17865
|
});
|
|
17866
17866
|
method(...args);
|
|
17867
17867
|
if (err) {
|
|
17868
17868
|
throw err;
|
|
17869
17869
|
}
|
|
17870
|
-
return
|
|
17870
|
+
return result2;
|
|
17871
17871
|
};
|
|
17872
17872
|
}
|
|
17873
17873
|
function toSyncOptions(options) {
|
|
@@ -19982,7 +19982,7 @@ function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
|
19982
19982
|
return fieldErrors;
|
|
19983
19983
|
}
|
|
19984
19984
|
function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
19985
|
-
const
|
|
19985
|
+
const result2 = { errors: [] };
|
|
19986
19986
|
const processError = (error63, path = []) => {
|
|
19987
19987
|
var _a3;
|
|
19988
19988
|
for (const issue2 of error63.issues) {
|
|
@@ -19995,10 +19995,10 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
|
19995
19995
|
} else {
|
|
19996
19996
|
const fullpath = [...path, ...issue2.path];
|
|
19997
19997
|
if (fullpath.length === 0) {
|
|
19998
|
-
|
|
19998
|
+
result2.errors.push(mapper(issue2));
|
|
19999
19999
|
continue;
|
|
20000
20000
|
}
|
|
20001
|
-
let curr =
|
|
20001
|
+
let curr = result2;
|
|
20002
20002
|
let i = 0;
|
|
20003
20003
|
while (i < fullpath.length) {
|
|
20004
20004
|
const el = fullpath[i];
|
|
@@ -20028,7 +20028,7 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
|
20028
20028
|
}
|
|
20029
20029
|
};
|
|
20030
20030
|
processError(error62);
|
|
20031
|
-
return
|
|
20031
|
+
return result2;
|
|
20032
20032
|
}
|
|
20033
20033
|
function toDotPath(_path) {
|
|
20034
20034
|
const segs = [];
|
|
@@ -20066,16 +20066,16 @@ function finalizeParams(callee, params) {
|
|
|
20066
20066
|
var _parse = (_Err) => {
|
|
20067
20067
|
const fn = (schema2, value, _ctx, _params) => {
|
|
20068
20068
|
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
20069
|
-
const
|
|
20070
|
-
if (
|
|
20069
|
+
const result2 = schema2._zod.run({ value, issues: [] }, ctx);
|
|
20070
|
+
if (result2 instanceof Promise) {
|
|
20071
20071
|
throw new $ZodAsyncError();
|
|
20072
20072
|
}
|
|
20073
|
-
if (
|
|
20074
|
-
const e = new (_params?.Err ?? _Err)(
|
|
20073
|
+
if (result2.issues.length) {
|
|
20074
|
+
const e = new (_params?.Err ?? _Err)(result2.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
20075
20075
|
captureStackTrace(e, _params?.callee ?? fn);
|
|
20076
20076
|
throw e;
|
|
20077
20077
|
}
|
|
20078
|
-
return
|
|
20078
|
+
return result2.value;
|
|
20079
20079
|
};
|
|
20080
20080
|
return fn;
|
|
20081
20081
|
};
|
|
@@ -20083,26 +20083,26 @@ var parse = /* @__PURE__ */ _parse($ZodRealError);
|
|
|
20083
20083
|
var _parseAsync = (_Err) => {
|
|
20084
20084
|
const fn = async (schema2, value, _ctx, params) => {
|
|
20085
20085
|
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
20086
|
-
let
|
|
20087
|
-
if (
|
|
20088
|
-
|
|
20089
|
-
if (
|
|
20090
|
-
const e = new (params?.Err ?? _Err)(
|
|
20086
|
+
let result2 = schema2._zod.run({ value, issues: [] }, ctx);
|
|
20087
|
+
if (result2 instanceof Promise)
|
|
20088
|
+
result2 = await result2;
|
|
20089
|
+
if (result2.issues.length) {
|
|
20090
|
+
const e = new (params?.Err ?? _Err)(result2.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
20091
20091
|
captureStackTrace(e, params?.callee ?? fn);
|
|
20092
20092
|
throw e;
|
|
20093
20093
|
}
|
|
20094
|
-
return
|
|
20094
|
+
return result2.value;
|
|
20095
20095
|
};
|
|
20096
20096
|
return fn;
|
|
20097
20097
|
};
|
|
20098
20098
|
var parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError);
|
|
20099
20099
|
var _safeParse = (_Err) => (schema2, value, _ctx) => {
|
|
20100
20100
|
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
20101
|
-
const
|
|
20102
|
-
if (
|
|
20101
|
+
const result2 = schema2._zod.run({ value, issues: [] }, ctx);
|
|
20102
|
+
if (result2 instanceof Promise) {
|
|
20103
20103
|
throw new $ZodAsyncError();
|
|
20104
20104
|
}
|
|
20105
|
-
return
|
|
20105
|
+
return result2.issues.length ? failure(_Err, result2.issues, ctx) : { success: true, data: result2.value };
|
|
20106
20106
|
};
|
|
20107
20107
|
var safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
20108
20108
|
function failure(Err, issues, ctx) {
|
|
@@ -20126,10 +20126,10 @@ function failure(Err, issues, ctx) {
|
|
|
20126
20126
|
}
|
|
20127
20127
|
var _safeParseAsync = (_Err) => async (schema2, value, _ctx) => {
|
|
20128
20128
|
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
20129
|
-
let
|
|
20130
|
-
if (
|
|
20131
|
-
|
|
20132
|
-
return
|
|
20129
|
+
let result2 = schema2._zod.run({ value, issues: [] }, ctx);
|
|
20130
|
+
if (result2 instanceof Promise)
|
|
20131
|
+
result2 = await result2;
|
|
20132
|
+
return result2.issues.length ? failure(_Err, result2.issues, ctx) : { success: true, data: result2.value };
|
|
20133
20133
|
};
|
|
20134
20134
|
var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
20135
20135
|
var COMPILE_INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid");
|
|
@@ -20147,24 +20147,24 @@ var validate = ((schema2, value, _ctx) => {
|
|
|
20147
20147
|
function validateFallback(schema2, value, _ctx) {
|
|
20148
20148
|
const ctx = _ctx ? { ..._ctx, async: false, abortEarly: true } : { async: false, abortEarly: true };
|
|
20149
20149
|
const fallbackRun = schema2._zod.bag.fallbackRun;
|
|
20150
|
-
let
|
|
20150
|
+
let result2;
|
|
20151
20151
|
if (fallbackRun) {
|
|
20152
20152
|
ctx[COMPILE_FALLBACK] = true;
|
|
20153
|
-
|
|
20153
|
+
result2 = fallbackRun({ value, issues: [] }, ctx);
|
|
20154
20154
|
} else {
|
|
20155
|
-
|
|
20155
|
+
result2 = schema2._zod.run({ value, issues: [] }, ctx);
|
|
20156
20156
|
}
|
|
20157
|
-
if (
|
|
20157
|
+
if (result2 instanceof Promise) {
|
|
20158
20158
|
throw new $ZodAsyncError();
|
|
20159
20159
|
}
|
|
20160
|
-
return
|
|
20160
|
+
return result2.issues.length === 0;
|
|
20161
20161
|
}
|
|
20162
20162
|
var validateAsync = async (schema2, value, _ctx) => {
|
|
20163
20163
|
const ctx = _ctx ? { ..._ctx, async: true, abortEarly: true } : { async: true, abortEarly: true };
|
|
20164
|
-
let
|
|
20165
|
-
if (
|
|
20166
|
-
|
|
20167
|
-
return
|
|
20164
|
+
let result2 = schema2._zod.run({ value, issues: [] }, ctx);
|
|
20165
|
+
if (result2 instanceof Promise)
|
|
20166
|
+
result2 = await result2;
|
|
20167
|
+
return result2.issues.length === 0;
|
|
20168
20168
|
};
|
|
20169
20169
|
var _encode = (_Err) => {
|
|
20170
20170
|
const parse3 = _parse(_Err);
|
|
@@ -20798,22 +20798,22 @@ var $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst,
|
|
|
20798
20798
|
});
|
|
20799
20799
|
};
|
|
20800
20800
|
});
|
|
20801
|
-
function handleCheckPropertyResult(
|
|
20802
|
-
if (
|
|
20803
|
-
payload.issues.push(...prefixIssues(property,
|
|
20801
|
+
function handleCheckPropertyResult(result2, payload, property) {
|
|
20802
|
+
if (result2.issues.length) {
|
|
20803
|
+
payload.issues.push(...prefixIssues(property, result2.issues));
|
|
20804
20804
|
}
|
|
20805
20805
|
}
|
|
20806
20806
|
var $ZodCheckProperty = /* @__PURE__ */ $constructor("$ZodCheckProperty", (inst, def) => {
|
|
20807
20807
|
$ZodCheck.init(inst, def);
|
|
20808
20808
|
inst._zod.check = (payload) => {
|
|
20809
|
-
const
|
|
20809
|
+
const result2 = def.schema._zod.run({
|
|
20810
20810
|
value: payload.value[def.property],
|
|
20811
20811
|
issues: []
|
|
20812
20812
|
}, {});
|
|
20813
|
-
if (
|
|
20814
|
-
return
|
|
20813
|
+
if (result2 instanceof Promise) {
|
|
20814
|
+
return result2.then((result3) => handleCheckPropertyResult(result3, payload, def.property));
|
|
20815
20815
|
}
|
|
20816
|
-
handleCheckPropertyResult(
|
|
20816
|
+
handleCheckPropertyResult(result2, payload, def.property);
|
|
20817
20817
|
return;
|
|
20818
20818
|
};
|
|
20819
20819
|
});
|
|
@@ -20832,12 +20832,12 @@ var $ZodCheckProperties = /* @__PURE__ */ $constructor("$ZodCheckProperties", (i
|
|
|
20832
20832
|
const input2 = payload.value;
|
|
20833
20833
|
let proms;
|
|
20834
20834
|
for (const [key, schema2] of entries) {
|
|
20835
|
-
const
|
|
20836
|
-
if (
|
|
20835
|
+
const result2 = schema2._zod.run({ value: input2[key], issues: [] }, {});
|
|
20836
|
+
if (result2 instanceof Promise) {
|
|
20837
20837
|
proms ?? (proms = []);
|
|
20838
|
-
proms.push(
|
|
20838
|
+
proms.push(result2.then((result3) => handleCheckPropertyResult(result3, payload, key)));
|
|
20839
20839
|
} else {
|
|
20840
|
-
handleCheckPropertyResult(
|
|
20840
|
+
handleCheckPropertyResult(result2, payload, key);
|
|
20841
20841
|
}
|
|
20842
20842
|
}
|
|
20843
20843
|
if (proms)
|
|
@@ -21007,13 +21007,13 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
21007
21007
|
}
|
|
21008
21008
|
return handleCanaryResult(canary, payload, ctx);
|
|
21009
21009
|
}
|
|
21010
|
-
const
|
|
21011
|
-
if (
|
|
21010
|
+
const result2 = inst._zod.parse(payload, ctx);
|
|
21011
|
+
if (result2 instanceof Promise) {
|
|
21012
21012
|
if (ctx.async === false)
|
|
21013
21013
|
throw new $ZodAsyncError();
|
|
21014
|
-
return
|
|
21014
|
+
return result2.then((result3) => runChecks(result3, checks, ctx));
|
|
21015
21015
|
}
|
|
21016
|
-
return runChecks(
|
|
21016
|
+
return runChecks(result2, checks, ctx);
|
|
21017
21017
|
};
|
|
21018
21018
|
}
|
|
21019
21019
|
}, {
|
|
@@ -21693,11 +21693,11 @@ function capSize(inst, size) {
|
|
|
21693
21693
|
var arraySize = (input2) => Array.isArray(input2) ? input2.length : -1;
|
|
21694
21694
|
var mapSize = (input2) => input2 instanceof Map ? input2.size : -1;
|
|
21695
21695
|
var setSize = (input2) => input2 instanceof Set ? input2.size : -1;
|
|
21696
|
-
function handleArrayResult(
|
|
21697
|
-
if (
|
|
21698
|
-
final.issues.push(...prefixIssues(index,
|
|
21696
|
+
function handleArrayResult(result2, final, index) {
|
|
21697
|
+
if (result2.issues.length) {
|
|
21698
|
+
final.issues.push(...prefixIssues(index, result2.issues));
|
|
21699
21699
|
}
|
|
21700
|
-
final.value[index] =
|
|
21700
|
+
final.value[index] = result2.value;
|
|
21701
21701
|
}
|
|
21702
21702
|
var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
21703
21703
|
$ZodType.init(inst, def);
|
|
@@ -21719,15 +21719,15 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
21719
21719
|
const abortEarly = ctx?.abortEarly;
|
|
21720
21720
|
for (let i = 0; i < input2.length; i++) {
|
|
21721
21721
|
const item = input2[i];
|
|
21722
|
-
const
|
|
21722
|
+
const result2 = def.element._zod.run({
|
|
21723
21723
|
value: item,
|
|
21724
21724
|
issues: []
|
|
21725
21725
|
}, ctx);
|
|
21726
|
-
if (
|
|
21727
|
-
proms.push(
|
|
21726
|
+
if (result2 instanceof Promise) {
|
|
21727
|
+
proms.push(result2.then((result3) => handleArrayResult(result3, payload, i)));
|
|
21728
21728
|
} else {
|
|
21729
|
-
handleArrayResult(
|
|
21730
|
-
if (abortEarly &&
|
|
21729
|
+
handleArrayResult(result2, payload, i);
|
|
21730
|
+
if (abortEarly && result2.issues.length !== 0 && aborted(result2))
|
|
21731
21731
|
break;
|
|
21732
21732
|
}
|
|
21733
21733
|
}
|
|
@@ -21738,20 +21738,20 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
21738
21738
|
};
|
|
21739
21739
|
capSize(inst, arraySize);
|
|
21740
21740
|
});
|
|
21741
|
-
function handlePropertyResult(
|
|
21741
|
+
function handlePropertyResult(result2, final, key, input2, optin, optout) {
|
|
21742
21742
|
const isPresent = key in input2;
|
|
21743
21743
|
const isOptionalOut = optout === "optional";
|
|
21744
21744
|
if (!isPresent && isOptionalOut && optin === "optional") {
|
|
21745
21745
|
return;
|
|
21746
21746
|
}
|
|
21747
|
-
if (
|
|
21747
|
+
if (result2.issues.length) {
|
|
21748
21748
|
if (optin !== void 0 && isOptionalOut && !isPresent) {
|
|
21749
21749
|
return;
|
|
21750
21750
|
}
|
|
21751
|
-
final.issues.push(...prefixIssues(key,
|
|
21751
|
+
final.issues.push(...prefixIssues(key, result2.issues));
|
|
21752
21752
|
}
|
|
21753
21753
|
if (!isPresent && optin === void 0) {
|
|
21754
|
-
if (!
|
|
21754
|
+
if (!result2.issues.length) {
|
|
21755
21755
|
final.issues.push({
|
|
21756
21756
|
code: "invalid_type",
|
|
21757
21757
|
expected: "nonoptional",
|
|
@@ -21761,12 +21761,12 @@ function handlePropertyResult(result, final, key, input2, optin, optout) {
|
|
|
21761
21761
|
}
|
|
21762
21762
|
return;
|
|
21763
21763
|
}
|
|
21764
|
-
if (
|
|
21764
|
+
if (result2.value === void 0) {
|
|
21765
21765
|
if (isPresent || optin === "defaulted" && !isOptionalOut) {
|
|
21766
21766
|
final.value[key] = void 0;
|
|
21767
21767
|
}
|
|
21768
21768
|
} else {
|
|
21769
|
-
final.value[key] =
|
|
21769
|
+
final.value[key] = result2.value;
|
|
21770
21770
|
}
|
|
21771
21771
|
}
|
|
21772
21772
|
var NO_SYMBOL_KEYS = [];
|
|
@@ -22045,9 +22045,9 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
22045
22045
|
};
|
|
22046
22046
|
});
|
|
22047
22047
|
function handleUnionResults(results, final, inst, ctx) {
|
|
22048
|
-
for (const
|
|
22049
|
-
if (
|
|
22050
|
-
final.value =
|
|
22048
|
+
for (const result2 of results) {
|
|
22049
|
+
if (result2.issues.length === 0) {
|
|
22050
|
+
final.value = result2.value;
|
|
22051
22051
|
return final;
|
|
22052
22052
|
}
|
|
22053
22053
|
}
|
|
@@ -22060,7 +22060,7 @@ function handleUnionResults(results, final, inst, ctx) {
|
|
|
22060
22060
|
code: "invalid_union",
|
|
22061
22061
|
input: final.value,
|
|
22062
22062
|
inst,
|
|
22063
|
-
errors: results.map((
|
|
22063
|
+
errors: results.map((result2) => result2.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
22064
22064
|
});
|
|
22065
22065
|
return final;
|
|
22066
22066
|
}
|
|
@@ -22089,17 +22089,17 @@ var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
|
22089
22089
|
let async = false;
|
|
22090
22090
|
const results = [];
|
|
22091
22091
|
for (const option of def.options) {
|
|
22092
|
-
const
|
|
22092
|
+
const result2 = option._zod.run({
|
|
22093
22093
|
value: payload.value,
|
|
22094
22094
|
issues: []
|
|
22095
22095
|
}, ctx);
|
|
22096
|
-
if (
|
|
22097
|
-
results.push(
|
|
22096
|
+
if (result2 instanceof Promise) {
|
|
22097
|
+
results.push(result2);
|
|
22098
22098
|
async = true;
|
|
22099
22099
|
} else {
|
|
22100
|
-
if (
|
|
22101
|
-
return
|
|
22102
|
-
results.push(
|
|
22100
|
+
if (result2.issues.length === 0)
|
|
22101
|
+
return result2;
|
|
22102
|
+
results.push(result2);
|
|
22103
22103
|
}
|
|
22104
22104
|
}
|
|
22105
22105
|
if (!async)
|
|
@@ -22124,7 +22124,7 @@ function handleExclusiveUnionResults(results, final, inst, ctx) {
|
|
|
22124
22124
|
code: "invalid_union",
|
|
22125
22125
|
input: final.value,
|
|
22126
22126
|
inst,
|
|
22127
|
-
errors: results.map((
|
|
22127
|
+
errors: results.map((result2) => result2.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
22128
22128
|
});
|
|
22129
22129
|
} else {
|
|
22130
22130
|
final.issues.push({
|
|
@@ -22149,15 +22149,15 @@ var $ZodXor = /* @__PURE__ */ $constructor("$ZodXor", (inst, def) => {
|
|
|
22149
22149
|
let async = false;
|
|
22150
22150
|
const results = [];
|
|
22151
22151
|
for (const option of def.options) {
|
|
22152
|
-
const
|
|
22152
|
+
const result2 = option._zod.run({
|
|
22153
22153
|
value: payload.value,
|
|
22154
22154
|
issues: []
|
|
22155
22155
|
}, ctx);
|
|
22156
|
-
if (
|
|
22157
|
-
results.push(
|
|
22156
|
+
if (result2 instanceof Promise) {
|
|
22157
|
+
results.push(result2);
|
|
22158
22158
|
async = true;
|
|
22159
22159
|
} else {
|
|
22160
|
-
results.push(
|
|
22160
|
+
results.push(result2);
|
|
22161
22161
|
}
|
|
22162
22162
|
}
|
|
22163
22163
|
if (!async)
|
|
@@ -22325,7 +22325,7 @@ function mergeValues(a, b) {
|
|
|
22325
22325
|
}
|
|
22326
22326
|
return { valid: false, mergeErrorPath: [] };
|
|
22327
22327
|
}
|
|
22328
|
-
function handleIntersectionResults(
|
|
22328
|
+
function handleIntersectionResults(result2, left, right) {
|
|
22329
22329
|
const unrecKeys = /* @__PURE__ */ new Map();
|
|
22330
22330
|
let unrecIssue;
|
|
22331
22331
|
const keyIssues = /* @__PURE__ */ new Map();
|
|
@@ -22351,30 +22351,30 @@ function handleIntersectionResults(result, left, right) {
|
|
|
22351
22351
|
};
|
|
22352
22352
|
for (const iss of left.issues) {
|
|
22353
22353
|
if (!collect(iss, "l"))
|
|
22354
|
-
|
|
22354
|
+
result2.issues.push(iss);
|
|
22355
22355
|
}
|
|
22356
22356
|
for (const iss of right.issues) {
|
|
22357
22357
|
if (!collect(iss, "r"))
|
|
22358
|
-
|
|
22358
|
+
result2.issues.push(iss);
|
|
22359
22359
|
}
|
|
22360
22360
|
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
22361
22361
|
if (bothKeys.length) {
|
|
22362
22362
|
const aggregated = unrecIssue ? bothKeys.filter((k) => unrecIssue.keys.includes(k)) : [];
|
|
22363
22363
|
if (aggregated.length)
|
|
22364
|
-
|
|
22364
|
+
result2.issues.push({ ...unrecIssue, keys: aggregated });
|
|
22365
22365
|
for (const k of bothKeys) {
|
|
22366
22366
|
if (!aggregated.includes(k) && keyIssues.has(k))
|
|
22367
|
-
|
|
22367
|
+
result2.issues.push(keyIssues.get(k));
|
|
22368
22368
|
}
|
|
22369
22369
|
}
|
|
22370
22370
|
const merged = mergeValues(left.value, right.value);
|
|
22371
22371
|
if (!merged.valid) {
|
|
22372
|
-
if (aborted(
|
|
22373
|
-
return
|
|
22372
|
+
if (aborted(result2))
|
|
22373
|
+
return result2;
|
|
22374
22374
|
throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
|
|
22375
22375
|
}
|
|
22376
|
-
|
|
22377
|
-
return
|
|
22376
|
+
result2.value = merged.data;
|
|
22377
|
+
return result2;
|
|
22378
22378
|
}
|
|
22379
22379
|
var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
22380
22380
|
$ZodType.init(inst, def);
|
|
@@ -22445,11 +22445,11 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
22445
22445
|
seen = payload.issues.length;
|
|
22446
22446
|
}
|
|
22447
22447
|
i++;
|
|
22448
|
-
const
|
|
22449
|
-
if (
|
|
22450
|
-
proms.push(
|
|
22448
|
+
const result2 = def.rest._zod.run({ value: el, issues: [] }, ctx);
|
|
22449
|
+
if (result2 instanceof Promise) {
|
|
22450
|
+
proms.push(result2.then((r) => handleTupleResult(r, payload, i)));
|
|
22451
22451
|
} else {
|
|
22452
|
-
handleTupleResult(
|
|
22452
|
+
handleTupleResult(result2, payload, i);
|
|
22453
22453
|
}
|
|
22454
22454
|
}
|
|
22455
22455
|
}
|
|
@@ -22467,11 +22467,11 @@ function getTupleOptStart(items, key) {
|
|
|
22467
22467
|
}
|
|
22468
22468
|
return 0;
|
|
22469
22469
|
}
|
|
22470
|
-
function handleTupleResult(
|
|
22471
|
-
if (
|
|
22472
|
-
final.issues.push(...prefixIssues(index,
|
|
22470
|
+
function handleTupleResult(result2, final, index) {
|
|
22471
|
+
if (result2.issues.length) {
|
|
22472
|
+
final.issues.push(...prefixIssues(index, result2.issues));
|
|
22473
22473
|
}
|
|
22474
|
-
final.value[index] =
|
|
22474
|
+
final.value[index] = result2.value;
|
|
22475
22475
|
}
|
|
22476
22476
|
function handleTupleResults(itemResults, final, items, input2, optoutStart) {
|
|
22477
22477
|
for (let i = 0; i < items.length; i++) {
|
|
@@ -22542,19 +22542,19 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
22542
22542
|
const outKey = keyResult.value;
|
|
22543
22543
|
if (outKey === "__proto__")
|
|
22544
22544
|
continue;
|
|
22545
|
-
const
|
|
22546
|
-
if (
|
|
22547
|
-
proms.push(
|
|
22548
|
-
if (
|
|
22549
|
-
payload.issues.push(...prefixIssues(key,
|
|
22545
|
+
const result2 = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx);
|
|
22546
|
+
if (result2 instanceof Promise) {
|
|
22547
|
+
proms.push(result2.then((result3) => {
|
|
22548
|
+
if (result3.issues.length) {
|
|
22549
|
+
payload.issues.push(...prefixIssues(key, result3.issues));
|
|
22550
22550
|
}
|
|
22551
|
-
payload.value[outKey] =
|
|
22551
|
+
payload.value[outKey] = result3.value;
|
|
22552
22552
|
}));
|
|
22553
22553
|
} else {
|
|
22554
|
-
if (
|
|
22555
|
-
payload.issues.push(...prefixIssues(key,
|
|
22554
|
+
if (result2.issues.length) {
|
|
22555
|
+
payload.issues.push(...prefixIssues(key, result2.issues));
|
|
22556
22556
|
}
|
|
22557
|
-
payload.value[outKey] =
|
|
22557
|
+
payload.value[outKey] = result2.value;
|
|
22558
22558
|
}
|
|
22559
22559
|
}
|
|
22560
22560
|
}
|
|
@@ -22623,19 +22623,19 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
22623
22623
|
const outKey = keyResult.value;
|
|
22624
22624
|
if (outKey === "__proto__")
|
|
22625
22625
|
continue;
|
|
22626
|
-
const
|
|
22627
|
-
if (
|
|
22628
|
-
proms.push(
|
|
22629
|
-
if (
|
|
22630
|
-
payload.issues.push(...prefixIssues(key,
|
|
22626
|
+
const result2 = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx);
|
|
22627
|
+
if (result2 instanceof Promise) {
|
|
22628
|
+
proms.push(result2.then((result3) => {
|
|
22629
|
+
if (result3.issues.length) {
|
|
22630
|
+
payload.issues.push(...prefixIssues(key, result3.issues));
|
|
22631
22631
|
}
|
|
22632
|
-
payload.value[outKey] =
|
|
22632
|
+
payload.value[outKey] = result3.value;
|
|
22633
22633
|
}));
|
|
22634
22634
|
} else {
|
|
22635
|
-
if (
|
|
22636
|
-
payload.issues.push(...prefixIssues(key,
|
|
22635
|
+
if (result2.issues.length) {
|
|
22636
|
+
payload.issues.push(...prefixIssues(key, result2.issues));
|
|
22637
22637
|
}
|
|
22638
|
-
payload.value[outKey] =
|
|
22638
|
+
payload.value[outKey] = result2.value;
|
|
22639
22639
|
}
|
|
22640
22640
|
}
|
|
22641
22641
|
if (unrecognized && unrecognized.length > 0) {
|
|
@@ -22750,11 +22750,11 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
|
|
|
22750
22750
|
break;
|
|
22751
22751
|
seen = payload.issues.length;
|
|
22752
22752
|
}
|
|
22753
|
-
const
|
|
22754
|
-
if (
|
|
22755
|
-
proms.push(
|
|
22753
|
+
const result2 = def.valueType._zod.run({ value: item, issues: [] }, ctx);
|
|
22754
|
+
if (result2 instanceof Promise) {
|
|
22755
|
+
proms.push(result2.then((result3) => handleSetResult(result3, payload)));
|
|
22756
22756
|
} else
|
|
22757
|
-
handleSetResult(
|
|
22757
|
+
handleSetResult(result2, payload);
|
|
22758
22758
|
}
|
|
22759
22759
|
if (proms.length)
|
|
22760
22760
|
return Promise.all(proms).then(() => payload);
|
|
@@ -22762,11 +22762,11 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
|
|
|
22762
22762
|
};
|
|
22763
22763
|
capSize(inst, setSize);
|
|
22764
22764
|
});
|
|
22765
|
-
function handleSetResult(
|
|
22766
|
-
if (
|
|
22767
|
-
final.issues.push(...
|
|
22765
|
+
function handleSetResult(result2, final) {
|
|
22766
|
+
if (result2.issues.length) {
|
|
22767
|
+
final.issues.push(...result2.issues);
|
|
22768
22768
|
}
|
|
22769
|
-
final.value.add(
|
|
22769
|
+
final.value.add(result2.value);
|
|
22770
22770
|
}
|
|
22771
22771
|
var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
22772
22772
|
$ZodType.init(inst, def);
|
|
@@ -22851,8 +22851,8 @@ var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) =>
|
|
|
22851
22851
|
return payload;
|
|
22852
22852
|
};
|
|
22853
22853
|
});
|
|
22854
|
-
function handleOptionalResult(payload,
|
|
22855
|
-
payload.value =
|
|
22854
|
+
function handleOptionalResult(payload, result2) {
|
|
22855
|
+
payload.value = result2.issues.length ? void 0 : result2.value;
|
|
22856
22856
|
return payload;
|
|
22857
22857
|
}
|
|
22858
22858
|
var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
@@ -22871,10 +22871,10 @@ var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
|
22871
22871
|
if (payload.value === void 0) {
|
|
22872
22872
|
if (def.innerType._zod.optin !== "defaulted")
|
|
22873
22873
|
return payload;
|
|
22874
|
-
const
|
|
22875
|
-
if (
|
|
22876
|
-
return
|
|
22877
|
-
return handleOptionalResult(payload,
|
|
22874
|
+
const result2 = def.innerType._zod.run({ value: payload.value, issues: [] }, ctx);
|
|
22875
|
+
if (result2 instanceof Promise)
|
|
22876
|
+
return result2.then((result3) => handleOptionalResult(payload, result3));
|
|
22877
|
+
return handleOptionalResult(payload, result2);
|
|
22878
22878
|
}
|
|
22879
22879
|
return def.innerType._zod.run(payload, ctx);
|
|
22880
22880
|
};
|
|
@@ -22916,11 +22916,11 @@ var $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
|
|
|
22916
22916
|
payload.value = def.defaultValue;
|
|
22917
22917
|
return payload;
|
|
22918
22918
|
}
|
|
22919
|
-
const
|
|
22920
|
-
if (
|
|
22921
|
-
return
|
|
22919
|
+
const result2 = def.innerType._zod.run(payload, ctx);
|
|
22920
|
+
if (result2 instanceof Promise) {
|
|
22921
|
+
return result2.then((result3) => handleDefaultResult(result3, def));
|
|
22922
22922
|
}
|
|
22923
|
-
return handleDefaultResult(
|
|
22923
|
+
return handleDefaultResult(result2, def);
|
|
22924
22924
|
};
|
|
22925
22925
|
});
|
|
22926
22926
|
function handleDefaultResult(payload, def) {
|
|
@@ -22950,11 +22950,11 @@ var $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def
|
|
|
22950
22950
|
return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
|
|
22951
22951
|
});
|
|
22952
22952
|
inst._zod.parse = (payload, ctx) => {
|
|
22953
|
-
const
|
|
22954
|
-
if (
|
|
22955
|
-
return
|
|
22953
|
+
const result2 = def.innerType._zod.run(payload, ctx);
|
|
22954
|
+
if (result2 instanceof Promise) {
|
|
22955
|
+
return result2.then((result3) => handleNonOptionalResult(result3, inst));
|
|
22956
22956
|
}
|
|
22957
|
-
return handleNonOptionalResult(
|
|
22957
|
+
return handleNonOptionalResult(result2, inst);
|
|
22958
22958
|
};
|
|
22959
22959
|
});
|
|
22960
22960
|
function handleNonOptionalResult(payload, inst) {
|
|
@@ -22974,29 +22974,29 @@ var $ZodSuccess = /* @__PURE__ */ $constructor("$ZodSuccess", (inst, def) => {
|
|
|
22974
22974
|
if (ctx.direction === "backward") {
|
|
22975
22975
|
throw new $ZodEncodeError("ZodSuccess");
|
|
22976
22976
|
}
|
|
22977
|
-
const
|
|
22978
|
-
if (
|
|
22979
|
-
return
|
|
22980
|
-
payload.value =
|
|
22977
|
+
const result2 = def.innerType._zod.run(payload, ctx);
|
|
22978
|
+
if (result2 instanceof Promise) {
|
|
22979
|
+
return result2.then((result3) => {
|
|
22980
|
+
payload.value = result3.issues.length === 0;
|
|
22981
22981
|
return payload;
|
|
22982
22982
|
});
|
|
22983
22983
|
}
|
|
22984
|
-
payload.value =
|
|
22984
|
+
payload.value = result2.issues.length === 0;
|
|
22985
22985
|
return payload;
|
|
22986
22986
|
};
|
|
22987
22987
|
});
|
|
22988
|
-
function handleCatchResult(payload,
|
|
22989
|
-
if (!
|
|
22990
|
-
payload.value =
|
|
22991
|
-
if (
|
|
22988
|
+
function handleCatchResult(payload, result2, def, ctx) {
|
|
22989
|
+
if (!result2.issues.length) {
|
|
22990
|
+
payload.value = result2.value;
|
|
22991
|
+
if (result2.memo)
|
|
22992
22992
|
payload.memo = true;
|
|
22993
22993
|
return payload;
|
|
22994
22994
|
}
|
|
22995
22995
|
payload.value = def.catchValue({
|
|
22996
|
-
...
|
|
22996
|
+
...result2,
|
|
22997
22997
|
value: payload.value,
|
|
22998
22998
|
error: {
|
|
22999
|
-
issues:
|
|
22999
|
+
issues: result2.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
23000
23000
|
},
|
|
23001
23001
|
input: payload.value
|
|
23002
23002
|
});
|
|
@@ -23011,11 +23011,11 @@ var $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
|
23011
23011
|
if (ctx.direction === "backward") {
|
|
23012
23012
|
return def.innerType._zod.run(payload, ctx);
|
|
23013
23013
|
}
|
|
23014
|
-
const
|
|
23015
|
-
if (
|
|
23016
|
-
return
|
|
23014
|
+
const result2 = def.innerType._zod.run({ value: payload.value, issues: [] }, ctx);
|
|
23015
|
+
if (result2 instanceof Promise) {
|
|
23016
|
+
return result2.then((result3) => handleCatchResult(payload, result3, def, ctx));
|
|
23017
23017
|
}
|
|
23018
|
-
return handleCatchResult(payload,
|
|
23018
|
+
return handleCatchResult(payload, result2, def, ctx);
|
|
23019
23019
|
};
|
|
23020
23020
|
});
|
|
23021
23021
|
var $ZodNaN = /* @__PURE__ */ $constructor("$ZodNaN", (inst, def) => {
|
|
@@ -23084,24 +23084,24 @@ var $ZodCodec = /* @__PURE__ */ $constructor("$ZodCodec", (inst, def) => {
|
|
|
23084
23084
|
}
|
|
23085
23085
|
};
|
|
23086
23086
|
});
|
|
23087
|
-
function handleCodecAResult(
|
|
23088
|
-
if (
|
|
23089
|
-
|
|
23090
|
-
return
|
|
23087
|
+
function handleCodecAResult(result2, def, ctx) {
|
|
23088
|
+
if (result2.issues.length) {
|
|
23089
|
+
result2.aborted = true;
|
|
23090
|
+
return result2;
|
|
23091
23091
|
}
|
|
23092
23092
|
const direction = ctx.direction || "forward";
|
|
23093
23093
|
if (direction === "forward") {
|
|
23094
|
-
const transformed = def.transform(
|
|
23094
|
+
const transformed = def.transform(result2.value, result2);
|
|
23095
23095
|
if (transformed instanceof Promise) {
|
|
23096
|
-
return transformed.then((value) => handleCodecTxResult(
|
|
23096
|
+
return transformed.then((value) => handleCodecTxResult(result2, value, def.out, ctx));
|
|
23097
23097
|
}
|
|
23098
|
-
return handleCodecTxResult(
|
|
23098
|
+
return handleCodecTxResult(result2, transformed, def.out, ctx);
|
|
23099
23099
|
} else {
|
|
23100
|
-
const transformed = def.reverseTransform(
|
|
23100
|
+
const transformed = def.reverseTransform(result2.value, result2);
|
|
23101
23101
|
if (transformed instanceof Promise) {
|
|
23102
|
-
return transformed.then((value) => handleCodecTxResult(
|
|
23102
|
+
return transformed.then((value) => handleCodecTxResult(result2, value, def.in, ctx));
|
|
23103
23103
|
}
|
|
23104
|
-
return handleCodecTxResult(
|
|
23104
|
+
return handleCodecTxResult(result2, transformed, def.in, ctx);
|
|
23105
23105
|
}
|
|
23106
23106
|
}
|
|
23107
23107
|
function handleCodecTxResult(left, value, nextSchema, ctx) {
|
|
@@ -23124,11 +23124,11 @@ var $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
|
|
|
23124
23124
|
if (ctx.direction === "backward") {
|
|
23125
23125
|
return def.innerType._zod.run(payload, ctx);
|
|
23126
23126
|
}
|
|
23127
|
-
const
|
|
23128
|
-
if (
|
|
23129
|
-
return
|
|
23127
|
+
const result2 = def.innerType._zod.run(payload, ctx);
|
|
23128
|
+
if (result2 instanceof Promise) {
|
|
23129
|
+
return result2.then(handleReadonlyResult);
|
|
23130
23130
|
}
|
|
23131
|
-
return handleReadonlyResult(
|
|
23131
|
+
return handleReadonlyResult(result2);
|
|
23132
23132
|
};
|
|
23133
23133
|
});
|
|
23134
23134
|
function handleReadonlyResult(payload) {
|
|
@@ -23233,11 +23233,11 @@ var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => {
|
|
|
23233
23233
|
}
|
|
23234
23234
|
return Object.defineProperty(function(...args) {
|
|
23235
23235
|
const parsedArgs = inst._def.input ? parse(inst._def.input, args) : args;
|
|
23236
|
-
const
|
|
23236
|
+
const result2 = Reflect.apply(func, this, parsedArgs);
|
|
23237
23237
|
if (inst._def.output) {
|
|
23238
|
-
return parse(inst._def.output,
|
|
23238
|
+
return parse(inst._def.output, result2);
|
|
23239
23239
|
}
|
|
23240
|
-
return
|
|
23240
|
+
return result2;
|
|
23241
23241
|
}, "_zod", { value: inst._zod, enumerable: false });
|
|
23242
23242
|
};
|
|
23243
23243
|
inst.implementAsync = (func) => {
|
|
@@ -23246,11 +23246,11 @@ var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => {
|
|
|
23246
23246
|
}
|
|
23247
23247
|
return Object.defineProperty(async function(...args) {
|
|
23248
23248
|
const parsedArgs = inst._def.input ? await parseAsync(inst._def.input, args) : args;
|
|
23249
|
-
const
|
|
23249
|
+
const result2 = await Reflect.apply(func, this, parsedArgs);
|
|
23250
23250
|
if (inst._def.output) {
|
|
23251
|
-
return await parseAsync(inst._def.output,
|
|
23251
|
+
return await parseAsync(inst._def.output, result2);
|
|
23252
23252
|
}
|
|
23253
|
-
return
|
|
23253
|
+
return result2;
|
|
23254
23254
|
}, "_zod", { value: inst._zod, enumerable: false });
|
|
23255
23255
|
};
|
|
23256
23256
|
inst._zod.parse = (payload, _ctx) => {
|
|
@@ -23339,8 +23339,8 @@ var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
|
23339
23339
|
return;
|
|
23340
23340
|
};
|
|
23341
23341
|
});
|
|
23342
|
-
function handleRefineResult(
|
|
23343
|
-
if (!
|
|
23342
|
+
function handleRefineResult(result2, payload, input2, inst) {
|
|
23343
|
+
if (!result2) {
|
|
23344
23344
|
const _iss = {
|
|
23345
23345
|
code: "custom",
|
|
23346
23346
|
input: input2,
|
|
@@ -23383,12 +23383,12 @@ function isRecursive(inst, stack, resolve4) {
|
|
|
23383
23383
|
if (stack.has(inst))
|
|
23384
23384
|
return PROVEN;
|
|
23385
23385
|
stack.add(inst);
|
|
23386
|
-
let
|
|
23386
|
+
let result2 = NONE;
|
|
23387
23387
|
const check2 = (child) => {
|
|
23388
|
-
if (
|
|
23388
|
+
if (result2 !== PROVEN && child?._zod) {
|
|
23389
23389
|
const answer = isRecursive(child, stack, resolve4);
|
|
23390
|
-
if (answer >
|
|
23391
|
-
|
|
23390
|
+
if (answer > result2)
|
|
23391
|
+
result2 = answer;
|
|
23392
23392
|
}
|
|
23393
23393
|
};
|
|
23394
23394
|
const shape = (sh, spread) => {
|
|
@@ -23404,8 +23404,8 @@ function isRecursive(inst, stack, resolve4) {
|
|
|
23404
23404
|
return answer;
|
|
23405
23405
|
};
|
|
23406
23406
|
const merge2 = (answer) => {
|
|
23407
|
-
if (answer >
|
|
23408
|
-
|
|
23407
|
+
if (answer > result2)
|
|
23408
|
+
result2 = answer;
|
|
23409
23409
|
};
|
|
23410
23410
|
const def = inst._zod.def;
|
|
23411
23411
|
const kind = def.type;
|
|
@@ -23506,7 +23506,7 @@ function isRecursive(inst, stack, resolve4) {
|
|
|
23506
23506
|
}
|
|
23507
23507
|
}
|
|
23508
23508
|
stack.delete(inst);
|
|
23509
|
-
return settle(inst,
|
|
23509
|
+
return settle(inst, result2);
|
|
23510
23510
|
}
|
|
23511
23511
|
function settle(inst, answer) {
|
|
23512
23512
|
if (answer !== ASSUMED)
|
|
@@ -23606,19 +23606,19 @@ var memo = {
|
|
|
23606
23606
|
}
|
|
23607
23607
|
handoff = bucket;
|
|
23608
23608
|
const depth = open.length;
|
|
23609
|
-
const
|
|
23609
|
+
const result2 = base(payload, ctx);
|
|
23610
23610
|
handoff = void 0;
|
|
23611
23611
|
const entry = open.length > depth ? open.pop() : void 0;
|
|
23612
|
-
if (
|
|
23613
|
-
return
|
|
23612
|
+
if (result2 instanceof Promise) {
|
|
23613
|
+
return result2.then((r) => {
|
|
23614
23614
|
if (entry)
|
|
23615
23615
|
entry.issues = r.issues.length ? cloneIssues(r.issues) : NO_ISSUES;
|
|
23616
23616
|
return r;
|
|
23617
23617
|
});
|
|
23618
23618
|
}
|
|
23619
23619
|
if (entry)
|
|
23620
|
-
entry.issues =
|
|
23621
|
-
return
|
|
23620
|
+
entry.issues = result2.issues.length ? cloneIssues(result2.issues) : NO_ISSUES;
|
|
23621
|
+
return result2;
|
|
23622
23622
|
};
|
|
23623
23623
|
inst._zod.parse = wrapped;
|
|
23624
23624
|
if (inst._zod.run === base)
|
|
@@ -27744,12 +27744,12 @@ var error33 = () => {
|
|
|
27744
27744
|
}
|
|
27745
27745
|
};
|
|
27746
27746
|
function getSizing(origin2, unitType, inclusive, targetShouldBe) {
|
|
27747
|
-
const
|
|
27748
|
-
if (
|
|
27749
|
-
return
|
|
27747
|
+
const result2 = Sizable[origin2] ?? null;
|
|
27748
|
+
if (result2 === null)
|
|
27749
|
+
return result2;
|
|
27750
27750
|
return {
|
|
27751
|
-
unit:
|
|
27752
|
-
verb:
|
|
27751
|
+
unit: result2.unit[unitType],
|
|
27752
|
+
verb: result2.verb[targetShouldBe][inclusive ? "inclusive" : "notInclusive"]
|
|
27753
27753
|
};
|
|
27754
27754
|
}
|
|
27755
27755
|
const FormatDictionary = {
|
|
@@ -31398,10 +31398,10 @@ function newVar(ctx) {
|
|
|
31398
31398
|
return `v${ctx.varCounter++}`;
|
|
31399
31399
|
}
|
|
31400
31400
|
function runtimeRun(schema2, value) {
|
|
31401
|
-
const
|
|
31402
|
-
if (
|
|
31401
|
+
const result2 = schema2._zod.run({ value, issues: [] }, {});
|
|
31402
|
+
if (result2 && typeof result2.then === "function")
|
|
31403
31403
|
return INVALID;
|
|
31404
|
-
const r =
|
|
31404
|
+
const r = result2;
|
|
31405
31405
|
return r.issues.length === 0 ? r.value : INVALID;
|
|
31406
31406
|
}
|
|
31407
31407
|
function compileChild(doc, ctx, schema2, accessor, needsValue = true) {
|
|
@@ -31673,8 +31673,8 @@ function generateCustomRefineCheck(doc, ctx, check2, accessor) {
|
|
|
31673
31673
|
const checkFn = check2._zod.check;
|
|
31674
31674
|
const helperFn = (value) => {
|
|
31675
31675
|
const fakePayload = { value, issues: [], addIssue: pushIssue };
|
|
31676
|
-
const
|
|
31677
|
-
if (
|
|
31676
|
+
const result2 = checkFn(fakePayload);
|
|
31677
|
+
if (result2 instanceof Promise)
|
|
31678
31678
|
throwAsync();
|
|
31679
31679
|
return fakePayload.issues.length === 0 ? fakePayload.value : INVALID;
|
|
31680
31680
|
};
|
|
@@ -32772,10 +32772,10 @@ function generatePipeCheck(doc, ctx, schema2, accessor) {
|
|
|
32772
32772
|
const transformFn = def.transform;
|
|
32773
32773
|
const helperFn = (value) => {
|
|
32774
32774
|
const fakePayload = { value, issues: [], addIssue: pushIssue };
|
|
32775
|
-
const
|
|
32776
|
-
if (
|
|
32775
|
+
const result2 = transformFn(value, fakePayload);
|
|
32776
|
+
if (result2 instanceof Promise)
|
|
32777
32777
|
return INVALID;
|
|
32778
|
-
return fakePayload.issues.length === 0 ?
|
|
32778
|
+
return fakePayload.issues.length === 0 ? result2 : INVALID;
|
|
32779
32779
|
};
|
|
32780
32780
|
const helperConst = addUserConstant(ctx, helperFn);
|
|
32781
32781
|
const transformedVar = newVar(ctx);
|
|
@@ -32807,10 +32807,10 @@ function generateCustomCheck(doc, ctx, schema2, accessor) {
|
|
|
32807
32807
|
return accessor;
|
|
32808
32808
|
}
|
|
32809
32809
|
function runtimeCatch(innerSchema, catchValue, value) {
|
|
32810
|
-
const
|
|
32811
|
-
if (
|
|
32810
|
+
const result2 = innerSchema._zod.run({ value, issues: [] }, {});
|
|
32811
|
+
if (result2 && typeof result2.then === "function")
|
|
32812
32812
|
return INVALID;
|
|
32813
|
-
const r =
|
|
32813
|
+
const r = result2;
|
|
32814
32814
|
if (r.issues.length === 0)
|
|
32815
32815
|
return r.value;
|
|
32816
32816
|
return catchValue();
|
|
@@ -32847,10 +32847,10 @@ function generateTransformCheck(doc, ctx, schema2, accessor) {
|
|
|
32847
32847
|
const transformFn = def.transform;
|
|
32848
32848
|
const helperFn = (value) => {
|
|
32849
32849
|
const fakePayload = { value, issues: [], addIssue: pushIssue };
|
|
32850
|
-
const
|
|
32851
|
-
if (
|
|
32850
|
+
const result2 = transformFn(value, fakePayload);
|
|
32851
|
+
if (result2 instanceof Promise)
|
|
32852
32852
|
return INVALID;
|
|
32853
|
-
return fakePayload.issues.length === 0 ?
|
|
32853
|
+
return fakePayload.issues.length === 0 ? result2 : INVALID;
|
|
32854
32854
|
};
|
|
32855
32855
|
const helperConst = addUserConstant(ctx, helperFn);
|
|
32856
32856
|
const outputVar = newVar(ctx);
|
|
@@ -33957,12 +33957,12 @@ function initializeContext(params) {
|
|
|
33957
33957
|
};
|
|
33958
33958
|
}
|
|
33959
33959
|
function handleUnrepresentable(schema2, ctx, json2, params, message2) {
|
|
33960
|
-
const
|
|
33961
|
-
if (
|
|
33960
|
+
const result2 = typeof ctx.unrepresentable === "function" ? ctx.unrepresentable({ zodSchema: schema2, path: params.path, message: message2 }) : ctx.unrepresentable;
|
|
33961
|
+
if (result2 === "any")
|
|
33962
33962
|
return false;
|
|
33963
|
-
if (
|
|
33963
|
+
if (result2 === void 0 || result2 === "throw")
|
|
33964
33964
|
throw new Error(message2);
|
|
33965
|
-
Object.assign(json2,
|
|
33965
|
+
Object.assign(json2, result2);
|
|
33966
33966
|
return true;
|
|
33967
33967
|
}
|
|
33968
33968
|
function processSchema(schema2, ctx, _params = { path: [], schemaPath: [] }) {
|
|
@@ -33977,13 +33977,13 @@ function processSchema(schema2, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
33977
33977
|
}
|
|
33978
33978
|
return seen.schema;
|
|
33979
33979
|
}
|
|
33980
|
-
const
|
|
33981
|
-
ctx.seen.set(schema2,
|
|
33980
|
+
const result2 = { schema: {}, count: 1, cycle: void 0, path: _params.path };
|
|
33981
|
+
ctx.seen.set(schema2, result2);
|
|
33982
33982
|
ctx.sharedDefsExtractedFor = void 0;
|
|
33983
33983
|
ctx.sharedEmitDoneFor = void 0;
|
|
33984
33984
|
const overrideSchema = schema2._zod.toJSONSchema?.();
|
|
33985
33985
|
if (overrideSchema) {
|
|
33986
|
-
|
|
33986
|
+
result2.schema = overrideSchema;
|
|
33987
33987
|
} else {
|
|
33988
33988
|
const params = {
|
|
33989
33989
|
..._params,
|
|
@@ -33991,9 +33991,9 @@ function processSchema(schema2, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
33991
33991
|
path: _params.path
|
|
33992
33992
|
};
|
|
33993
33993
|
if (schema2._zod.processJSONSchema) {
|
|
33994
|
-
schema2._zod.processJSONSchema(ctx,
|
|
33994
|
+
schema2._zod.processJSONSchema(ctx, result2.schema, params);
|
|
33995
33995
|
} else {
|
|
33996
|
-
const _json =
|
|
33996
|
+
const _json = result2.schema;
|
|
33997
33997
|
const processor = ctx.processors[def.type];
|
|
33998
33998
|
if (!processor) {
|
|
33999
33999
|
throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
|
|
@@ -34002,22 +34002,22 @@ function processSchema(schema2, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
34002
34002
|
}
|
|
34003
34003
|
const parent = schema2._zod.parent;
|
|
34004
34004
|
if (parent) {
|
|
34005
|
-
if (!
|
|
34006
|
-
|
|
34005
|
+
if (!result2.ref)
|
|
34006
|
+
result2.ref = parent;
|
|
34007
34007
|
processSchema(parent, ctx, params);
|
|
34008
34008
|
ctx.seen.get(parent).isParent = true;
|
|
34009
34009
|
}
|
|
34010
34010
|
}
|
|
34011
34011
|
const meta3 = ctx.metadataRegistry.get(schema2);
|
|
34012
34012
|
if (meta3)
|
|
34013
|
-
assignProps(
|
|
34013
|
+
assignProps(result2.schema, meta3);
|
|
34014
34014
|
if (ctx.io === "input" && isTransforming(schema2)) {
|
|
34015
|
-
delete
|
|
34016
|
-
delete
|
|
34015
|
+
delete result2.schema.examples;
|
|
34016
|
+
delete result2.schema.default;
|
|
34017
34017
|
}
|
|
34018
|
-
if (ctx.io === "input" && "_prefault" in
|
|
34019
|
-
(_a3 =
|
|
34020
|
-
delete
|
|
34018
|
+
if (ctx.io === "input" && "_prefault" in result2.schema)
|
|
34019
|
+
(_a3 = result2.schema).default ?? (_a3.default = result2.schema._prefault);
|
|
34020
|
+
delete result2.schema._prefault;
|
|
34021
34021
|
const _result = ctx.seen.get(schema2);
|
|
34022
34022
|
return _result.schema;
|
|
34023
34023
|
}
|
|
@@ -34322,13 +34322,13 @@ function finalize(ctx, schema2) {
|
|
|
34322
34322
|
}
|
|
34323
34323
|
}
|
|
34324
34324
|
}
|
|
34325
|
-
const
|
|
34325
|
+
const result2 = {};
|
|
34326
34326
|
if (ctx.target === "draft-2020-12") {
|
|
34327
|
-
|
|
34327
|
+
result2.$schema = "https://json-schema.org/draft/2020-12/schema";
|
|
34328
34328
|
} else if (ctx.target === "draft-07") {
|
|
34329
|
-
|
|
34329
|
+
result2.$schema = "http://json-schema.org/draft-07/schema#";
|
|
34330
34330
|
} else if (ctx.target === "draft-04") {
|
|
34331
|
-
|
|
34331
|
+
result2.$schema = "http://json-schema.org/draft-04/schema#";
|
|
34332
34332
|
} else if (ctx.target === "openapi-3.0") {
|
|
34333
34333
|
} else {
|
|
34334
34334
|
}
|
|
@@ -34336,12 +34336,12 @@ function finalize(ctx, schema2) {
|
|
|
34336
34336
|
const id = ctx.external.registry.get(schema2)?.id;
|
|
34337
34337
|
if (!id)
|
|
34338
34338
|
throw new Error("Schema is missing an `id` property");
|
|
34339
|
-
|
|
34339
|
+
result2.$id = ctx.external.uri(id);
|
|
34340
34340
|
}
|
|
34341
|
-
assignProps(
|
|
34341
|
+
assignProps(result2, root.defId ? root.schema : root.def ?? root.schema);
|
|
34342
34342
|
const rootMetaId = ctx.metadataRegistry.get(schema2)?.id;
|
|
34343
|
-
if (rootMetaId !== void 0 &&
|
|
34344
|
-
delete
|
|
34343
|
+
if (rootMetaId !== void 0 && result2.id === rootMetaId)
|
|
34344
|
+
delete result2.id;
|
|
34345
34345
|
const defs = ctx.external?.defs ?? {};
|
|
34346
34346
|
if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) {
|
|
34347
34347
|
for (const entry of ctx.seen.entries()) {
|
|
@@ -34359,14 +34359,14 @@ function finalize(ctx, schema2) {
|
|
|
34359
34359
|
} else {
|
|
34360
34360
|
if (Object.keys(defs).length > 0) {
|
|
34361
34361
|
if (ctx.target === "draft-2020-12") {
|
|
34362
|
-
|
|
34362
|
+
result2.$defs = defs;
|
|
34363
34363
|
} else {
|
|
34364
|
-
|
|
34364
|
+
result2.definitions = defs;
|
|
34365
34365
|
}
|
|
34366
34366
|
}
|
|
34367
34367
|
}
|
|
34368
34368
|
try {
|
|
34369
|
-
const finalized = JSON.parse(JSON.stringify(
|
|
34369
|
+
const finalized = JSON.parse(JSON.stringify(result2));
|
|
34370
34370
|
Object.defineProperty(finalized, "~standard", {
|
|
34371
34371
|
value: {
|
|
34372
34372
|
...schema2["~standard"],
|
|
@@ -35270,8 +35270,8 @@ var JSONSchemaGenerator = class {
|
|
|
35270
35270
|
this.ctx.sharedDefsExtractedFor = void 0;
|
|
35271
35271
|
this.ctx.sharedEmitDoneFor = void 0;
|
|
35272
35272
|
extractDefs(this.ctx, schema2);
|
|
35273
|
-
const
|
|
35274
|
-
const { "~standard": _, ...plainResult } =
|
|
35273
|
+
const result2 = finalize(this.ctx, schema2);
|
|
35274
|
+
const { "~standard": _, ...plainResult } = result2;
|
|
35275
35275
|
return plainResult;
|
|
35276
35276
|
}
|
|
35277
35277
|
};
|
|
@@ -37217,13 +37217,13 @@ function checkObjectGuards(objectSchema, guards) {
|
|
|
37217
37217
|
}
|
|
37218
37218
|
if (guards.keySchema) {
|
|
37219
37219
|
for (const key of keys) {
|
|
37220
|
-
const
|
|
37221
|
-
if (
|
|
37220
|
+
const result2 = guards.keySchema.safeParse(key);
|
|
37221
|
+
if (result2.success)
|
|
37222
37222
|
continue;
|
|
37223
37223
|
payload.issues.push({
|
|
37224
37224
|
code: "invalid_key",
|
|
37225
37225
|
origin: "record",
|
|
37226
|
-
issues:
|
|
37226
|
+
issues: result2.error.issues,
|
|
37227
37227
|
input: key,
|
|
37228
37228
|
path: [key],
|
|
37229
37229
|
continue: true
|
|
@@ -37589,11 +37589,11 @@ function convertBaseSchema(schema2, ctx) {
|
|
|
37589
37589
|
} else if (schemasToIntersect.length === 1) {
|
|
37590
37590
|
zodSchema = schemasToIntersect[0];
|
|
37591
37591
|
} else {
|
|
37592
|
-
let
|
|
37592
|
+
let result2 = z.intersection(schemasToIntersect[0], schemasToIntersect[1]);
|
|
37593
37593
|
for (let i = 2; i < schemasToIntersect.length; i++) {
|
|
37594
|
-
|
|
37594
|
+
result2 = z.intersection(result2, schemasToIntersect[i]);
|
|
37595
37595
|
}
|
|
37596
|
-
zodSchema =
|
|
37596
|
+
zodSchema = result2;
|
|
37597
37597
|
}
|
|
37598
37598
|
if (schema2.additionalProperties === false) {
|
|
37599
37599
|
const propertyKeys = Object.keys(shape);
|
|
@@ -37720,12 +37720,12 @@ function convertSchema(schema2, ctx) {
|
|
|
37720
37720
|
if (schema2.allOf.length === 0) {
|
|
37721
37721
|
baseSchema = hasExplicitType ? baseSchema : z.any();
|
|
37722
37722
|
} else {
|
|
37723
|
-
let
|
|
37723
|
+
let result2 = hasExplicitType ? baseSchema : convertSchema(schema2.allOf[0], ctx);
|
|
37724
37724
|
const startIdx = hasExplicitType ? 0 : 1;
|
|
37725
37725
|
for (let i = startIdx; i < schema2.allOf.length; i++) {
|
|
37726
|
-
|
|
37726
|
+
result2 = z.intersection(result2, convertSchema(schema2.allOf[i], ctx));
|
|
37727
37727
|
}
|
|
37728
|
-
baseSchema =
|
|
37728
|
+
baseSchema = result2;
|
|
37729
37729
|
}
|
|
37730
37730
|
}
|
|
37731
37731
|
if (schema2.nullable === true && ctx.version === "openapi-3.0") {
|
|
@@ -38239,14 +38239,14 @@ function parseFileConfig(value) {
|
|
|
38239
38239
|
}
|
|
38240
38240
|
function parseConfig(value, filename, development = false) {
|
|
38241
38241
|
const config2 = parseFileConfig(value);
|
|
38242
|
-
const
|
|
38242
|
+
const result2 = {
|
|
38243
38243
|
...config2,
|
|
38244
38244
|
developmentOrigins: development ? config2.developmentOrigins : [],
|
|
38245
38245
|
dataDir: (0, import_node_path4.resolve)((0, import_node_path4.dirname)(filename), config2.dataDir),
|
|
38246
38246
|
demo: false
|
|
38247
38247
|
};
|
|
38248
|
-
sources.set(
|
|
38249
|
-
return
|
|
38248
|
+
sources.set(result2, { path: (0, import_node_path4.resolve)(filename), development });
|
|
38249
|
+
return result2;
|
|
38250
38250
|
}
|
|
38251
38251
|
|
|
38252
38252
|
// src/server/config-store.ts
|
|
@@ -38647,7 +38647,7 @@ var codexCompatibilitySchema = external_exports.object({
|
|
|
38647
38647
|
(value) => !value.unsupported.some((entry) => value.verified.includes(entry.version)),
|
|
38648
38648
|
"Verified and unsupported versions must not overlap"
|
|
38649
38649
|
);
|
|
38650
|
-
function assessCodexCompatibility(metadata, running) {
|
|
38650
|
+
function assessCodexCompatibility(metadata, running, basis = "running") {
|
|
38651
38651
|
const parsed = codexCompatibilitySchema.safeParse(metadata);
|
|
38652
38652
|
if (!parsed.success)
|
|
38653
38653
|
return {
|
|
@@ -38661,7 +38661,7 @@ function assessCodexCompatibility(metadata, running) {
|
|
|
38661
38661
|
version: running,
|
|
38662
38662
|
manifest,
|
|
38663
38663
|
status: "unknown",
|
|
38664
|
-
reason: "\u65E0\u6CD5\u786E\u8BA4\u5F53\u524D Codex CLI \u7248\u672C\uFF0C\u8BF7\u5148\u6062\u590D Codex \u8FDE\u63A5\u540E\u91CD\u65B0\u68C0\u67E5\u3002"
|
|
38664
|
+
reason: basis === "restart" ? "\u65E0\u6CD5\u786E\u8BA4\u91CD\u542F\u540E\u7684 Codex CLI \u7248\u672C\uFF0C\u8BF7\u6838\u5BF9\u542F\u52A8\u6765\u6E90\u540E\u91CD\u65B0\u68C0\u67E5\u3002" : "\u65E0\u6CD5\u786E\u8BA4\u5F53\u524D Codex CLI \u7248\u672C\uFF0C\u8BF7\u5148\u6062\u590D Codex \u8FDE\u63A5\u540E\u91CD\u65B0\u68C0\u67E5\u3002"
|
|
38665
38665
|
};
|
|
38666
38666
|
const unsupported = manifest.unsupported.find((entry) => entry.version === running);
|
|
38667
38667
|
if (unsupported)
|
|
@@ -38677,24 +38677,24 @@ function assessCodexCompatibility(metadata, running) {
|
|
|
38677
38677
|
version: running,
|
|
38678
38678
|
manifest,
|
|
38679
38679
|
status: "unverified",
|
|
38680
|
-
reason:
|
|
38680
|
+
reason: `${basis === "restart" ? "\u91CD\u542F\u540E\u7684" : "\u5F53\u524D"} Codex ${running} \u4E0E\u76EE\u6807 Covro \u7684\u7EC4\u5408\u5C1A\u672A\u9A8C\u8BC1\uFF1B\u81EA\u52A8\u5347\u7EA7\u5DF2\u6682\u505C\u3002`
|
|
38681
38681
|
};
|
|
38682
38682
|
}
|
|
38683
|
-
function requireCodexCompatibility(metadata, running, confirmed = false) {
|
|
38684
|
-
const
|
|
38685
|
-
if (
|
|
38686
|
-
throw new Error(
|
|
38687
|
-
return
|
|
38683
|
+
function requireCodexCompatibility(metadata, running, confirmed = false, basis = "running") {
|
|
38684
|
+
const result2 = assessCodexCompatibility(metadata, running, basis);
|
|
38685
|
+
if (result2.status !== "verified" && !(confirmed && result2.status === "unverified"))
|
|
38686
|
+
throw new Error(result2.reason);
|
|
38687
|
+
return result2;
|
|
38688
38688
|
}
|
|
38689
38689
|
|
|
38690
38690
|
// src/updates/worker.ts
|
|
38691
|
-
var
|
|
38692
|
-
var
|
|
38691
|
+
var import_node_child_process7 = require("node:child_process");
|
|
38692
|
+
var import_node_util7 = require("node:util");
|
|
38693
38693
|
var import_node_module = require("node:module");
|
|
38694
|
-
var
|
|
38694
|
+
var import_promises18 = require("node:fs/promises");
|
|
38695
38695
|
var import_node_fs6 = require("node:fs");
|
|
38696
|
-
var
|
|
38697
|
-
var
|
|
38696
|
+
var import_node_path16 = require("node:path");
|
|
38697
|
+
var import_promises19 = require("node:timers/promises");
|
|
38698
38698
|
var import_proper_lockfile7 = __toESM(require_proper_lockfile(), 1);
|
|
38699
38699
|
|
|
38700
38700
|
// src/cli/control.ts
|
|
@@ -38723,14 +38723,14 @@ function control(location, action, input2 = {}) {
|
|
|
38723
38723
|
incoming.on("error", reject);
|
|
38724
38724
|
incoming.on("end", () => {
|
|
38725
38725
|
try {
|
|
38726
|
-
const
|
|
38726
|
+
const result2 = JSON.parse(body);
|
|
38727
38727
|
if (incoming.statusCode !== 200)
|
|
38728
38728
|
reject(
|
|
38729
|
-
Object.assign(new Error(
|
|
38730
|
-
code:
|
|
38729
|
+
Object.assign(new Error(result2.error ?? "Control request failed"), {
|
|
38730
|
+
code: result2.code
|
|
38731
38731
|
})
|
|
38732
38732
|
);
|
|
38733
|
-
else resolve4(
|
|
38733
|
+
else resolve4(result2);
|
|
38734
38734
|
} catch (error62) {
|
|
38735
38735
|
reject(error62);
|
|
38736
38736
|
}
|
|
@@ -39225,7 +39225,8 @@ async function waitForAutomaticPlan(run, effects) {
|
|
|
39225
39225
|
codex: candidate.codex.manifest && candidate.codex.version ? {
|
|
39226
39226
|
version: candidate.codex.version,
|
|
39227
39227
|
manifest: candidate.codex.manifest,
|
|
39228
|
-
confirmedUnverified: false
|
|
39228
|
+
confirmedUnverified: false,
|
|
39229
|
+
target: candidate.codexTarget
|
|
39229
39230
|
} : void 0,
|
|
39230
39231
|
runtime: status.runtime?.target && run.runtime ? {
|
|
39231
39232
|
from: run.runtime.from,
|
|
@@ -39276,6 +39277,7 @@ async function activateUpdate(paths, effects, reuseTarget = false) {
|
|
|
39276
39277
|
try {
|
|
39277
39278
|
await effects.phase("waiting", "\u5019\u9009\u5305\u5DF2\u51C6\u5907\u597D\uFF0C\u7B49\u5F85\u6240\u6709\u4EFB\u52A1\u3001\u5BA1\u6279\u4E0E\u5F85\u6838\u5BF9\u64CD\u4F5C\u7ED3\u675F");
|
|
39278
39279
|
await effects.waitForIdle();
|
|
39280
|
+
await effects.beforeStop?.();
|
|
39279
39281
|
await effects.phase("stopping", "\u5DF2\u5173\u95ED\u65B0\u4EFB\u52A1\u5165\u53E3\uFF0C\u6B63\u5728\u505C\u6B62\u65E7\u670D\u52A1\u5E76\u5907\u4EFD\u6570\u636E");
|
|
39280
39282
|
stopped = true;
|
|
39281
39283
|
await effects.stop();
|
|
@@ -39511,14 +39513,219 @@ async function resolveRuntimeTarget(environment = defaultNodeEnvironment) {
|
|
|
39511
39513
|
}
|
|
39512
39514
|
}
|
|
39513
39515
|
|
|
39514
|
-
// src/updates/
|
|
39516
|
+
// src/updates/codex-target.ts
|
|
39517
|
+
var import_node_child_process6 = require("node:child_process");
|
|
39518
|
+
var import_node_util6 = require("node:util");
|
|
39519
|
+
var import_node_crypto7 = require("node:crypto");
|
|
39520
|
+
var import_promises16 = require("node:fs/promises");
|
|
39521
|
+
var import_node_path15 = require("node:path");
|
|
39522
|
+
var import_promises17 = require("node:timers/promises");
|
|
39523
|
+
|
|
39524
|
+
// src/codex/identity.ts
|
|
39525
|
+
var import_node_child_process5 = require("node:child_process");
|
|
39526
|
+
var import_node_util5 = require("node:util");
|
|
39515
39527
|
var exec5 = (0, import_node_util5.promisify)(import_node_child_process5.execFile);
|
|
39528
|
+
function assertCodexIdentity(actual, expected) {
|
|
39529
|
+
if (!actual || Object.keys(expected).some(
|
|
39530
|
+
(key) => actual[key] !== expected[key]
|
|
39531
|
+
))
|
|
39532
|
+
throw new Error("Codex \u542F\u52A8\u6765\u6E90\u3001\u73AF\u5883\u6216\u7248\u672C\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u65B0\u68C0\u67E5\u66F4\u65B0");
|
|
39533
|
+
}
|
|
39534
|
+
|
|
39535
|
+
// src/updates/codex-target.ts
|
|
39536
|
+
var execute = (0, import_node_util6.promisify)(import_node_child_process6.execFile);
|
|
39537
|
+
var CodexTargetError = class extends Error {
|
|
39538
|
+
};
|
|
39539
|
+
async function exec6(command, args, options = {}) {
|
|
39540
|
+
try {
|
|
39541
|
+
return await execute(command, args, options);
|
|
39542
|
+
} catch {
|
|
39543
|
+
throw new CodexTargetError(
|
|
39544
|
+
"\u76EE\u6807\u670D\u52A1 Codex \u63A2\u6D4B\u672A\u5B8C\u6210\uFF1B\u8BF7\u68C0\u67E5\u542F\u52A8\u6765\u6E90\u3001Node\u3001PATH \u4E0E\u670D\u52A1\u7BA1\u7406\u5668\u6743\u9650"
|
|
39545
|
+
);
|
|
39546
|
+
}
|
|
39547
|
+
}
|
|
39548
|
+
var identity = external_exports.object({
|
|
39549
|
+
binary: external_exports.string(),
|
|
39550
|
+
resolved: external_exports.string(),
|
|
39551
|
+
executable: external_exports.string(),
|
|
39552
|
+
file: external_exports.string(),
|
|
39553
|
+
version: external_exports.string(),
|
|
39554
|
+
node: external_exports.string(),
|
|
39555
|
+
cwd: external_exports.string(),
|
|
39556
|
+
environment: external_exports.string()
|
|
39557
|
+
}).strict();
|
|
39558
|
+
var digest = (value) => (0, import_node_crypto7.createHash)("sha256").update(value).digest("hex");
|
|
39559
|
+
var codexConfiguration = async (config2) => digest(await (0, import_promises16.readFile)(config2, "utf8"));
|
|
39560
|
+
function result(stdout) {
|
|
39561
|
+
const value = external_exports.object({ identity: identity.optional(), error: external_exports.string().optional() }).parse(JSON.parse(stdout));
|
|
39562
|
+
if (!value.identity)
|
|
39563
|
+
throw new CodexTargetError("\u65E0\u6CD5\u63A2\u6D4B\u91CD\u542F\u76EE\u6807 Codex\uFF0C\u8BF7\u68C0\u67E5\u914D\u7F6E\u7684 binary\u3001Node \u548C\u76EE\u6807 PATH");
|
|
39564
|
+
return value.identity;
|
|
39565
|
+
}
|
|
39566
|
+
var xml3 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """);
|
|
39567
|
+
function plist(value) {
|
|
39568
|
+
if (typeof value === "string") return `<string>${xml3(value)}</string>`;
|
|
39569
|
+
if (typeof value === "boolean") return value ? "<true/>" : "<false/>";
|
|
39570
|
+
if (Array.isArray(value)) return `<array>${value.map(plist).join("")}</array>`;
|
|
39571
|
+
if (value && typeof value === "object")
|
|
39572
|
+
return `<dict>${Object.entries(value).map(([key, entry]) => `<key>${xml3(key)}</key>${plist(entry)}`).join("")}</dict>`;
|
|
39573
|
+
throw new CodexTargetError("\u767B\u5F55\u670D\u52A1\u5305\u542B\u65E0\u6CD5\u590D\u73B0\u7684\u542F\u52A8\u5C5E\u6027");
|
|
39574
|
+
}
|
|
39575
|
+
async function launchdProbe(location, content, args) {
|
|
39576
|
+
const directory = await (0, import_promises16.mkdtemp)((0, import_node_path15.join)(location.state, "codex-probe-"));
|
|
39577
|
+
const label = `dev.covro.probe.${(0, import_node_crypto7.randomUUID)()}`;
|
|
39578
|
+
const target = `${launchdPaths(location).domain}/${label}`;
|
|
39579
|
+
let loaded2 = false;
|
|
39580
|
+
try {
|
|
39581
|
+
const filename = (0, import_node_path15.join)(directory, "probe.plist");
|
|
39582
|
+
await (0, import_promises16.writeFile)(filename, content, { mode: 384 });
|
|
39583
|
+
const parsed = JSON.parse(
|
|
39584
|
+
(await exec6("/usr/bin/plutil", ["-convert", "json", "-o", "-", filename], { timeout: 5e3 })).stdout
|
|
39585
|
+
);
|
|
39586
|
+
const allowed = [
|
|
39587
|
+
"Label",
|
|
39588
|
+
"ProgramArguments",
|
|
39589
|
+
"LimitLoadToSessionType",
|
|
39590
|
+
"RunAtLoad",
|
|
39591
|
+
"KeepAlive",
|
|
39592
|
+
"ThrottleInterval",
|
|
39593
|
+
"EnvironmentVariables",
|
|
39594
|
+
"StandardOutPath",
|
|
39595
|
+
"StandardErrorPath",
|
|
39596
|
+
"WorkingDirectory"
|
|
39597
|
+
];
|
|
39598
|
+
if (Object.keys(parsed).some((key) => !allowed.includes(key)))
|
|
39599
|
+
throw new CodexTargetError("\u81EA\u5B9A\u4E49 launchd \u542F\u52A8\u5C5E\u6027\u65E0\u6CD5\u53EF\u9760\u63A2\u6D4B\uFF0C\u8BF7\u4F7F\u7528\u539F\u90E8\u7F72\u65B9\u5F0F\u66F4\u65B0");
|
|
39600
|
+
delete parsed.KeepAlive;
|
|
39601
|
+
delete parsed.ThrottleInterval;
|
|
39602
|
+
parsed.Label = label;
|
|
39603
|
+
parsed.ProgramArguments = args;
|
|
39604
|
+
parsed.RunAtLoad = true;
|
|
39605
|
+
parsed.StandardOutPath = (0, import_node_path15.join)(directory, "result.json");
|
|
39606
|
+
parsed.StandardErrorPath = (0, import_node_path15.join)(directory, "stderr");
|
|
39607
|
+
await (0, import_promises16.writeFile)(filename, `<?xml version="1.0"?><plist version="1.0">${plist(parsed)}</plist>`);
|
|
39608
|
+
await exec6("/bin/launchctl", ["bootstrap", launchdPaths(location).domain, filename], {
|
|
39609
|
+
timeout: 5e3
|
|
39610
|
+
});
|
|
39611
|
+
loaded2 = true;
|
|
39612
|
+
for (let attempt = 0; attempt < 80; attempt++) {
|
|
39613
|
+
const output2 = await (0, import_promises16.readFile)((0, import_node_path15.join)(directory, "result.json"), "utf8").catch(() => "");
|
|
39614
|
+
if (output2.trim()) return result(output2);
|
|
39615
|
+
await (0, import_promises17.setTimeout)(100);
|
|
39616
|
+
}
|
|
39617
|
+
throw new CodexTargetError("\u767B\u5F55\u670D\u52A1\u672A\u8FD4\u56DE Codex \u63A2\u6D4B\u7ED3\u679C\uFF0C\u8BF7\u68C0\u67E5\u76EE\u6807 Node \u4E0E\u670D\u52A1\u73AF\u5883");
|
|
39618
|
+
} finally {
|
|
39619
|
+
if (loaded2) await exec6("/bin/launchctl", ["bootout", target], { timeout: 5e3 });
|
|
39620
|
+
await (0, import_promises16.rm)(directory, { recursive: true, force: true });
|
|
39621
|
+
}
|
|
39622
|
+
}
|
|
39623
|
+
async function systemdProbe(content, args) {
|
|
39624
|
+
const properties = [];
|
|
39625
|
+
let environment = false;
|
|
39626
|
+
let command = false;
|
|
39627
|
+
let cwd = false;
|
|
39628
|
+
let section = "";
|
|
39629
|
+
for (const line of content.split("\n").map((value) => value.trim()).filter(Boolean)) {
|
|
39630
|
+
if (/^\[(Unit|Service|Install)\]$/.test(line)) {
|
|
39631
|
+
section = line;
|
|
39632
|
+
continue;
|
|
39633
|
+
}
|
|
39634
|
+
if (line.startsWith("#") || section === "[Unit]" && line.startsWith("Description=") || section === "[Install]" && line.startsWith("WantedBy="))
|
|
39635
|
+
continue;
|
|
39636
|
+
if (section !== "[Service]")
|
|
39637
|
+
throw new CodexTargetError("\u81EA\u5B9A\u4E49 systemd \u542F\u52A8\u5C5E\u6027\u65E0\u6CD5\u53EF\u9760\u63A2\u6D4B\uFF0C\u8BF7\u4F7F\u7528\u539F\u90E8\u7F72\u65B9\u5F0F\u66F4\u65B0");
|
|
39638
|
+
if (line.startsWith("ExecStart=") && !command) {
|
|
39639
|
+
command = true;
|
|
39640
|
+
continue;
|
|
39641
|
+
}
|
|
39642
|
+
if (/^(Restart|RestartSec)=/.test(line)) continue;
|
|
39643
|
+
if (line.startsWith("Environment=") && !environment) {
|
|
39644
|
+
if (line.includes("%"))
|
|
39645
|
+
throw new CodexTargetError("systemd \u73AF\u5883\u542B\u52A8\u6001 specifier\uFF0C\u8BF7\u4F7F\u7528\u539F\u90E8\u7F72\u65B9\u5F0F\u66F4\u65B0");
|
|
39646
|
+
environment = true;
|
|
39647
|
+
properties.push(`--property=${line}`);
|
|
39648
|
+
} else if (line.startsWith("WorkingDirectory=") && !line.includes("%") && !cwd) {
|
|
39649
|
+
cwd = true;
|
|
39650
|
+
properties.push(`--property=${line}`);
|
|
39651
|
+
} else throw new CodexTargetError("\u81EA\u5B9A\u4E49 systemd \u542F\u52A8\u5C5E\u6027\u65E0\u6CD5\u53EF\u9760\u63A2\u6D4B\uFF0C\u8BF7\u4F7F\u7528\u539F\u90E8\u7F72\u65B9\u5F0F\u66F4\u65B0");
|
|
39652
|
+
}
|
|
39653
|
+
if (!environment || !command)
|
|
39654
|
+
throw new CodexTargetError("systemd \u542F\u52A8\u547D\u4EE4\u6216\u73AF\u5883\u7F3A\u5931\uFF0C\u8BF7\u91CD\u65B0\u5B89\u88C5\u767B\u5F55\u670D\u52A1");
|
|
39655
|
+
const { stdout } = await exec6(
|
|
39656
|
+
"systemd-run",
|
|
39657
|
+
[
|
|
39658
|
+
"--user",
|
|
39659
|
+
"--quiet",
|
|
39660
|
+
"--wait",
|
|
39661
|
+
"--pipe",
|
|
39662
|
+
"--collect",
|
|
39663
|
+
"--service-type=exec",
|
|
39664
|
+
"--expand-environment=no",
|
|
39665
|
+
`--unit=covro-codex-probe-${(0, import_node_crypto7.randomUUID)()}`,
|
|
39666
|
+
...properties,
|
|
39667
|
+
"--",
|
|
39668
|
+
...args
|
|
39669
|
+
],
|
|
39670
|
+
{ timeout: 15e3, maxBuffer: 64 * 1024 }
|
|
39671
|
+
);
|
|
39672
|
+
return result(stdout);
|
|
39673
|
+
}
|
|
39674
|
+
async function observeRestartCodex(location, root, target, expectedSource, probeRoot = root) {
|
|
39675
|
+
const current = await launchRuntime(location, (0, import_node_path15.join)(root, "bin/covro.mjs"));
|
|
39676
|
+
if (expectedSource && JSON.stringify(current) !== JSON.stringify(expectedSource))
|
|
39677
|
+
throw new CodexTargetError("\u4FDD\u5B58\u7684\u542F\u52A8\u6765\u6E90\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u65B0\u68C0\u67E5\u66F4\u65B0");
|
|
39678
|
+
const snapshot = await snapshotLaunch(location, current);
|
|
39679
|
+
const configuration = await codexConfiguration(location.config);
|
|
39680
|
+
const args = [target.node, (0, import_node_path15.join)(probeRoot, "dist/cli/codex-probe.js"), location.config];
|
|
39681
|
+
let found;
|
|
39682
|
+
if (snapshot.service) {
|
|
39683
|
+
const content = serviceContent(location, target, snapshot.service);
|
|
39684
|
+
const path = snapshot.service.platform === "darwin" ? `<key>PATH</key><string>${xml3(target.path)}</string>` : systemdQuote(`PATH=${target.path}`);
|
|
39685
|
+
if (!content.includes(path))
|
|
39686
|
+
throw new CodexTargetError("\u670D\u52A1\u7F3A\u5C11\u53EF\u786E\u8BA4\u7684\u76EE\u6807 PATH\uFF0C\u8BF7\u91CD\u65B0\u5B89\u88C5\u767B\u5F55\u670D\u52A1");
|
|
39687
|
+
found = snapshot.service.platform === "darwin" ? await launchdProbe(location, content, args) : await systemdProbe(content, args);
|
|
39688
|
+
} else {
|
|
39689
|
+
const { stdout } = await exec6(args[0], args.slice(1), {
|
|
39690
|
+
env: { ...process.env, PATH: target.path, COVRO_HOME: location.home },
|
|
39691
|
+
cwd: process.cwd(),
|
|
39692
|
+
timeout: 1e4,
|
|
39693
|
+
maxBuffer: 64 * 1024
|
|
39694
|
+
});
|
|
39695
|
+
found = result(stdout);
|
|
39696
|
+
}
|
|
39697
|
+
if (configuration !== await codexConfiguration(location.config))
|
|
39698
|
+
throw new CodexTargetError("\u914D\u7F6E\u5728 Codex \u63A2\u6D4B\u671F\u95F4\u53D8\u5316\uFF0C\u8BF7\u91CD\u65B0\u68C0\u67E5");
|
|
39699
|
+
return {
|
|
39700
|
+
identity: found,
|
|
39701
|
+
configuration,
|
|
39702
|
+
launch: digest(JSON.stringify({ current, target, snapshot }))
|
|
39703
|
+
};
|
|
39704
|
+
}
|
|
39705
|
+
async function probeRestartCodex(...args) {
|
|
39706
|
+
try {
|
|
39707
|
+
return await observeRestartCodex(...args);
|
|
39708
|
+
} catch (error62) {
|
|
39709
|
+
if (error62 instanceof CodexTargetError) throw error62;
|
|
39710
|
+
throw new CodexTargetError(
|
|
39711
|
+
"\u65E0\u6CD5\u786E\u8BA4\u91CD\u542F\u76EE\u6807 Codex\uFF1B\u8BF7\u68C0\u67E5\u914D\u7F6E\u3001\u76EE\u6807 PATH\u3001Node \u548C\u670D\u52A1\u542F\u52A8\u6765\u6E90\u540E\u91CD\u65B0\u68C0\u67E5\u3002"
|
|
39712
|
+
);
|
|
39713
|
+
}
|
|
39714
|
+
}
|
|
39715
|
+
function assertCodexTarget(actual, expected) {
|
|
39716
|
+
assertCodexIdentity(actual.identity, expected.identity);
|
|
39717
|
+
if (actual.configuration !== expected.configuration || actual.launch !== expected.launch)
|
|
39718
|
+
throw new CodexTargetError("Codex \u914D\u7F6E\u6216\u670D\u52A1\u542F\u52A8\u6765\u6E90\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u65B0\u68C0\u67E5\u66F4\u65B0");
|
|
39719
|
+
}
|
|
39720
|
+
|
|
39721
|
+
// src/updates/worker.ts
|
|
39722
|
+
var exec7 = (0, import_node_util7.promisify)(import_node_child_process7.execFile);
|
|
39516
39723
|
var message = (error62) => error62 instanceof Error ? error62.message : String(error62);
|
|
39517
39724
|
async function startService(context2, candidate = false) {
|
|
39518
39725
|
const target = candidate ? context2.target : void 0;
|
|
39519
39726
|
await startBackground(
|
|
39520
39727
|
context2.location,
|
|
39521
|
-
(0,
|
|
39728
|
+
(0, import_node_path16.join)(context2.root, "bin/covro.mjs"),
|
|
39522
39729
|
target ? { node: target.node, entry: target.entry, path: target.path } : context2.source
|
|
39523
39730
|
);
|
|
39524
39731
|
}
|
|
@@ -39531,29 +39738,29 @@ async function verifyRestoredService(context2, version3) {
|
|
|
39531
39738
|
const restored = await control(context2.location, "status");
|
|
39532
39739
|
if (restored.version !== version3 || restored.maintenance)
|
|
39533
39740
|
throw new Error("\u65E7\u7248\u6062\u590D\u8EAB\u4EFD\u4E0D\u5339\u914D");
|
|
39534
|
-
const record2 = await readJson((0,
|
|
39741
|
+
const record2 = await readJson((0, import_node_path16.join)(context2.directory, "run.json"));
|
|
39535
39742
|
if (record2?.runtime) assertRuntime(restored.runtime, record2.runtime.from);
|
|
39536
39743
|
return;
|
|
39537
39744
|
} catch (error62) {
|
|
39538
39745
|
if (attempt === 239) throw error62;
|
|
39539
39746
|
}
|
|
39540
|
-
await (0,
|
|
39747
|
+
await (0, import_promises19.setTimeout)(250);
|
|
39541
39748
|
}
|
|
39542
39749
|
}
|
|
39543
39750
|
async function verifyMigrations(context2, candidate) {
|
|
39544
|
-
const require2 = (0, import_node_module.createRequire)((0,
|
|
39751
|
+
const require2 = (0, import_node_module.createRequire)((0, import_node_path16.join)(context2.root, "package.json"));
|
|
39545
39752
|
const Sqlite = require2("better-sqlite3");
|
|
39546
|
-
const filename = (0,
|
|
39753
|
+
const filename = (0, import_node_path16.join)(context2.dataDir, "app.sqlite");
|
|
39547
39754
|
try {
|
|
39548
|
-
await (0,
|
|
39755
|
+
await (0, import_promises18.access)(filename);
|
|
39549
39756
|
} catch (error62) {
|
|
39550
39757
|
if (error62.code === "ENOENT") return;
|
|
39551
39758
|
throw error62;
|
|
39552
39759
|
}
|
|
39553
39760
|
const db = new Sqlite(filename, { readonly: true, fileMustExist: true });
|
|
39554
39761
|
try {
|
|
39555
|
-
const migrations = readMigrations((0,
|
|
39556
|
-
const metadata = await readJson((0,
|
|
39762
|
+
const migrations = readMigrations((0, import_node_path16.join)(candidate, "dist/drizzle"));
|
|
39763
|
+
const metadata = await readJson((0, import_node_path16.join)(candidate, "package.json"));
|
|
39557
39764
|
if (metadata?.covroDatabase) {
|
|
39558
39765
|
const contract = databaseCompatibilitySchema.parse(metadata.covroDatabase);
|
|
39559
39766
|
if (contract.schemaVersion !== migrations.length)
|
|
@@ -39565,21 +39772,21 @@ async function verifyMigrations(context2, candidate) {
|
|
|
39565
39772
|
}
|
|
39566
39773
|
}
|
|
39567
39774
|
async function workerCore(directory, logger) {
|
|
39568
|
-
await (0,
|
|
39775
|
+
await (0, import_promises18.mkdir)(directory, { recursive: true, mode: 448 });
|
|
39569
39776
|
const release = await import_proper_lockfile7.default.lock(directory, {
|
|
39570
39777
|
stale: 1e4,
|
|
39571
39778
|
update: 2e3,
|
|
39572
39779
|
retries: { retries: 30, minTimeout: 100, maxTimeout: 500 }
|
|
39573
39780
|
});
|
|
39574
|
-
let record2 = await readJson((0,
|
|
39575
|
-
const context2 = await readJson((0,
|
|
39781
|
+
let record2 = await readJson((0, import_node_path16.join)(directory, "run.json"));
|
|
39782
|
+
const context2 = await readJson((0, import_node_path16.join)(directory, "context.json"));
|
|
39576
39783
|
if (!record2 || !context2) {
|
|
39577
39784
|
await release();
|
|
39578
39785
|
throw new Error("\u7F3A\u5C11\u5347\u7EA7\u8BB0\u5F55");
|
|
39579
39786
|
}
|
|
39580
39787
|
const update = async (phase, detail) => {
|
|
39581
39788
|
record2 = { ...record2, phase, message: detail, updatedAt: Date.now() };
|
|
39582
|
-
await saveJson((0,
|
|
39789
|
+
await saveJson((0, import_node_path16.join)(directory, "run.json"), record2);
|
|
39583
39790
|
logger.info("update.phase_changed", { updateId: record2.id, stage: phase });
|
|
39584
39791
|
};
|
|
39585
39792
|
let paths = transactionPaths(
|
|
@@ -39587,7 +39794,7 @@ async function workerCore(directory, logger) {
|
|
|
39587
39794
|
record2.id,
|
|
39588
39795
|
context2.dataDir,
|
|
39589
39796
|
context2.location.config,
|
|
39590
|
-
(0,
|
|
39797
|
+
(0, import_node_path16.join)(backupDirectory(context2.location.home, context2.dataDir), record2.id)
|
|
39591
39798
|
);
|
|
39592
39799
|
let releaseMaintenance;
|
|
39593
39800
|
let releaseData;
|
|
@@ -39598,16 +39805,16 @@ async function workerCore(directory, logger) {
|
|
|
39598
39805
|
readiness: () => control(context2.location, "update-readiness"),
|
|
39599
39806
|
save: async (next) => {
|
|
39600
39807
|
record2 = next;
|
|
39601
|
-
await saveJson((0,
|
|
39808
|
+
await saveJson((0, import_node_path16.join)(directory, "run.json"), record2);
|
|
39602
39809
|
},
|
|
39603
39810
|
freeze: (checkedAt) => confirmAutomaticFreeze(
|
|
39604
39811
|
record2.id,
|
|
39605
39812
|
() => control(context2.location, "freeze-automatic-update", { id: record2.id, checkedAt }),
|
|
39606
|
-
() => readJson((0,
|
|
39813
|
+
() => readJson((0, import_node_path16.join)(directory, "run.json"))
|
|
39607
39814
|
),
|
|
39608
|
-
pause: () => (0,
|
|
39815
|
+
pause: () => (0, import_promises19.setTimeout)(2e3)
|
|
39609
39816
|
});
|
|
39610
|
-
const frozen = await readJson((0,
|
|
39817
|
+
const frozen = await readJson((0, import_node_path16.join)(directory, "context.json"));
|
|
39611
39818
|
if (!frozen) throw new Error("\u7F3A\u5C11\u56FA\u5B9A\u76EE\u6807\u8FD0\u884C\u73AF\u5883");
|
|
39612
39819
|
Object.assign(context2, frozen);
|
|
39613
39820
|
paths = transactionPaths(
|
|
@@ -39615,20 +39822,20 @@ async function workerCore(directory, logger) {
|
|
|
39615
39822
|
record2.id,
|
|
39616
39823
|
context2.dataDir,
|
|
39617
39824
|
context2.location.config,
|
|
39618
|
-
(0,
|
|
39825
|
+
(0, import_node_path16.join)(backupDirectory(context2.location.home, context2.dataDir), record2.id)
|
|
39619
39826
|
);
|
|
39620
39827
|
}
|
|
39621
39828
|
if (record2.runtime) await verifyRuntimeExecutable(record2.runtime.from);
|
|
39622
39829
|
const previousMetadata = await readJson(
|
|
39623
|
-
(0,
|
|
39830
|
+
(0, import_node_path16.join)(paths.previous, "package.json")
|
|
39624
39831
|
);
|
|
39625
39832
|
const sameRoot = paths.root.replace(/\/$/, "") === context2.root.replace(/\/$/, "");
|
|
39626
39833
|
const originalRoot = sameRoot && previousMetadata?.version === record2.from ? paths.previous : context2.root;
|
|
39627
|
-
const originalMetadata = await readJson((0,
|
|
39628
|
-
const Sqlite = (0, import_node_module.createRequire)((0,
|
|
39834
|
+
const originalMetadata = await readJson((0, import_node_path16.join)(originalRoot, "package.json"));
|
|
39835
|
+
const Sqlite = (0, import_node_module.createRequire)((0, import_node_path16.join)(originalRoot, "package.json"))(
|
|
39629
39836
|
"better-sqlite3"
|
|
39630
39837
|
);
|
|
39631
|
-
const migrations = readMigrations((0,
|
|
39838
|
+
const migrations = readMigrations((0, import_node_path16.join)(originalRoot, "dist/drizzle"));
|
|
39632
39839
|
const backups = new BackupStore({
|
|
39633
39840
|
directory: backupDirectory(context2.location.home, context2.dataDir),
|
|
39634
39841
|
config: paths.config,
|
|
@@ -39647,8 +39854,8 @@ async function workerCore(directory, logger) {
|
|
|
39647
39854
|
});
|
|
39648
39855
|
if (process.argv[3] === "--repair") {
|
|
39649
39856
|
releaseMaintenance = await acquireMaintenanceLock(context2.dataDir);
|
|
39650
|
-
if (!await readJson((0,
|
|
39651
|
-
paths.backup = (0,
|
|
39857
|
+
if (!await readJson((0, import_node_path16.join)(paths.backup, "snapshot.json")))
|
|
39858
|
+
paths.backup = (0, import_node_path16.join)(directory, `backup-${record2.id}`);
|
|
39652
39859
|
const active = await control(context2.location, "status").catch(
|
|
39653
39860
|
(error62) => {
|
|
39654
39861
|
if (isNotRunning(error62)) return void 0;
|
|
@@ -39659,7 +39866,7 @@ async function workerCore(directory, logger) {
|
|
|
39659
39866
|
if (active && !active.maintenance && active.version !== record2.from)
|
|
39660
39867
|
throw new Error("\u5F53\u524D\u670D\u52A1\u53EF\u80FD\u5DF2\u63A5\u53D7\u65B0\u7248\u4E1A\u52A1\u6570\u636E\uFF1B\u62D2\u7EDD\u6062\u590D\u65E7\u5FEB\u7167\uFF0C\u8BF7\u4F7F\u7528\u517C\u5BB9\u7248\u672C\u68C0\u67E5\u3002");
|
|
39661
39868
|
const previous = await readJson(
|
|
39662
|
-
(0,
|
|
39869
|
+
(0, import_node_path16.join)(paths.previous, "package.json")
|
|
39663
39870
|
);
|
|
39664
39871
|
if (previous || context2.reuseTarget) {
|
|
39665
39872
|
if (active && !active.maintenance)
|
|
@@ -39667,16 +39874,16 @@ async function workerCore(directory, logger) {
|
|
|
39667
39874
|
if (previous && (previous.name !== npmPackageName || previous.version !== (context2.target?.version ?? record2.from)))
|
|
39668
39875
|
throw new Error("\u65E7\u7248\u5907\u4EFD\u8EAB\u4EFD\u4E0D\u5339\u914D");
|
|
39669
39876
|
const snapshot = await readJson(
|
|
39670
|
-
(0,
|
|
39877
|
+
(0, import_node_path16.join)(paths.backup, "snapshot.json")
|
|
39671
39878
|
);
|
|
39672
39879
|
if (snapshot?.formatVersion === 1) {
|
|
39673
39880
|
const verified = await backups.verify(record2.id);
|
|
39674
39881
|
if (verified.appVersion !== record2.from || verified.protectedBy !== record2.id || verified.configPath !== paths.config || verified.dataDir !== paths.dataDir)
|
|
39675
39882
|
throw new Error("\u5907\u4EFD\u8EAB\u4EFD\u4E0D\u5339\u914D");
|
|
39676
|
-
} else await verifyLegacySnapshot(paths.backup, Sqlite, (0,
|
|
39883
|
+
} else await verifyLegacySnapshot(paths.backup, Sqlite, (0, import_node_path16.join)(originalRoot, "dist/drizzle"));
|
|
39677
39884
|
} else if (sameRoot) {
|
|
39678
39885
|
const original = await readJson(
|
|
39679
|
-
(0,
|
|
39886
|
+
(0, import_node_path16.join)(paths.root, "package.json")
|
|
39680
39887
|
);
|
|
39681
39888
|
if (original?.name !== npmPackageName || original.version !== record2.from)
|
|
39682
39889
|
throw new Error("\u672A\u627E\u5230\u5B8C\u6574\u7684\u4E0A\u4E00\u7248\u672C\u5B89\u88C5");
|
|
@@ -39688,24 +39895,24 @@ async function workerCore(directory, logger) {
|
|
|
39688
39895
|
await stopService(context2);
|
|
39689
39896
|
releaseData = await acquireInstanceLock(context2.dataDir);
|
|
39690
39897
|
if (previous) {
|
|
39691
|
-
await (0,
|
|
39692
|
-
await (0,
|
|
39898
|
+
await (0, import_promises18.rm)(paths.root, { recursive: true, force: true });
|
|
39899
|
+
await (0, import_promises18.rename)(paths.previous, paths.root);
|
|
39693
39900
|
}
|
|
39694
39901
|
if (previous || context2.reuseTarget) {
|
|
39695
39902
|
for (const name of ["app.sqlite", "app.sqlite-wal", "app.sqlite-shm"]) {
|
|
39696
|
-
await (0,
|
|
39903
|
+
await (0, import_promises18.rm)((0, import_node_path16.join)(paths.dataDir, name), { force: true });
|
|
39697
39904
|
try {
|
|
39698
|
-
await copyDurable((0,
|
|
39905
|
+
await copyDurable((0, import_node_path16.join)(paths.backup, name), (0, import_node_path16.join)(paths.dataDir, name));
|
|
39699
39906
|
} catch (error62) {
|
|
39700
39907
|
if (error62.code !== "ENOENT") throw error62;
|
|
39701
39908
|
}
|
|
39702
39909
|
}
|
|
39703
|
-
await copyDurable((0,
|
|
39910
|
+
await copyDurable((0, import_node_path16.join)(paths.backup, "config.json"), paths.config);
|
|
39704
39911
|
}
|
|
39705
|
-
const launch2 = await readJson((0,
|
|
39912
|
+
const launch2 = await readJson((0, import_node_path16.join)(directory, `launch-${record2.id}.json`));
|
|
39706
39913
|
if (launch2) await restoreLaunch(context2.location, launch2);
|
|
39707
39914
|
const restored = await readJson(
|
|
39708
|
-
(0,
|
|
39915
|
+
(0, import_node_path16.join)(context2.root, "package.json")
|
|
39709
39916
|
);
|
|
39710
39917
|
if (restored?.name !== npmPackageName || restored.version !== record2.from)
|
|
39711
39918
|
throw new Error("\u672A\u627E\u5230\u5B8C\u6574\u7684\u4E0A\u4E00\u7248\u672C\u5B89\u88C5");
|
|
@@ -39724,10 +39931,10 @@ async function workerCore(directory, logger) {
|
|
|
39724
39931
|
}
|
|
39725
39932
|
const reason = await inspectInstallation(context2.root);
|
|
39726
39933
|
if (reason) throw new Error(reason);
|
|
39727
|
-
for (const key of await (0,
|
|
39934
|
+
for (const key of await (0, import_promises18.readdir)((0, import_node_path16.join)(context2.location.home, "instances"))) {
|
|
39728
39935
|
if (key === context2.location.key) continue;
|
|
39729
39936
|
const instance = await readJson(
|
|
39730
|
-
(0,
|
|
39937
|
+
(0, import_node_path16.join)(context2.location.home, "instances", key, "instance.json")
|
|
39731
39938
|
);
|
|
39732
39939
|
if (!instance || ![context2.root.replace(/\/$/, ""), paths.root].includes(instance.root.replace(/\/$/, "")))
|
|
39733
39940
|
continue;
|
|
@@ -39738,8 +39945,8 @@ async function workerCore(directory, logger) {
|
|
|
39738
39945
|
if (!isNotRunning(error62)) throw error62;
|
|
39739
39946
|
}
|
|
39740
39947
|
}
|
|
39741
|
-
await (0,
|
|
39742
|
-
await (0,
|
|
39948
|
+
await (0, import_promises18.access)((0, import_node_path16.dirname)(context2.root), import_node_fs6.constants.W_OK);
|
|
39949
|
+
await (0, import_promises18.access)((0, import_node_path16.dirname)(paths.root), import_node_fs6.constants.W_OK);
|
|
39743
39950
|
if (context2.target) {
|
|
39744
39951
|
const target = await resolveRuntimeTarget();
|
|
39745
39952
|
assertRuntime(target, context2.target);
|
|
@@ -39752,8 +39959,31 @@ async function workerCore(directory, logger) {
|
|
|
39752
39959
|
context2.target?.path ?? process.env.PATH ?? "/usr/bin:/bin",
|
|
39753
39960
|
context2.target?.npmConfig
|
|
39754
39961
|
);
|
|
39962
|
+
const restartRuntime = context2.target ?? context2.source;
|
|
39963
|
+
if (!record2.codex?.target || !restartRuntime)
|
|
39964
|
+
throw new Error("\u7F3A\u5C11\u91CD\u542F\u76EE\u6807 Codex \u6765\u6E90\u8BB0\u5F55\uFF0C\u8BF7\u91CD\u65B0\u68C0\u67E5\u66F4\u65B0");
|
|
39965
|
+
if (record2.codex.version !== record2.codex.target.identity.version)
|
|
39966
|
+
throw new Error("Codex \u7248\u672C\u4E0E\u91CD\u542F\u76EE\u6807\u6765\u6E90\u8BB0\u5F55\u4E0D\u5339\u914D\uFF0C\u8BF7\u91CD\u65B0\u68C0\u67E5\u66F4\u65B0");
|
|
39967
|
+
let probeRoot = context2.reuseTarget ? candidateRoot : context2.root;
|
|
39968
|
+
const checkRestartCodex = async () => {
|
|
39969
|
+
const actual = await probeRestartCodex(
|
|
39970
|
+
context2.location,
|
|
39971
|
+
context2.root,
|
|
39972
|
+
restartRuntime,
|
|
39973
|
+
context2.source,
|
|
39974
|
+
probeRoot
|
|
39975
|
+
);
|
|
39976
|
+
assertCodexTarget(actual, record2.codex.target);
|
|
39977
|
+
requireCodexCompatibility(
|
|
39978
|
+
record2.codex.manifest,
|
|
39979
|
+
actual.identity.version,
|
|
39980
|
+
record2.codex.confirmedUnverified,
|
|
39981
|
+
"restart"
|
|
39982
|
+
);
|
|
39983
|
+
};
|
|
39984
|
+
await checkRestartCodex();
|
|
39755
39985
|
if (!context2.reuseTarget)
|
|
39756
|
-
await
|
|
39986
|
+
await exec7(
|
|
39757
39987
|
context2.target?.node ?? "npm",
|
|
39758
39988
|
[
|
|
39759
39989
|
...context2.target ? [context2.target.npm] : [],
|
|
@@ -39770,7 +40000,7 @@ async function workerCore(directory, logger) {
|
|
|
39770
40000
|
],
|
|
39771
40001
|
{ env, timeout: 10 * 6e4, maxBuffer: 2 * 1024 * 1024 }
|
|
39772
40002
|
);
|
|
39773
|
-
const candidate = await readJson((0,
|
|
40003
|
+
const candidate = await readJson((0, import_node_path16.join)(candidateRoot, "package.json"));
|
|
39774
40004
|
if (candidate?.name !== npmPackageName || candidate.version !== record2.target)
|
|
39775
40005
|
throw new Error("\u5019\u9009\u5305\u8EAB\u4EFD\u6216\u7248\u672C\u4E0D\u5339\u914D");
|
|
39776
40006
|
if (record2.commit && (candidate.covroCommit ?? candidate.gitHead) !== record2.commit)
|
|
@@ -39779,27 +40009,28 @@ async function workerCore(directory, logger) {
|
|
|
39779
40009
|
const manifest = codexCompatibilitySchema.parse(candidate.covroCodex);
|
|
39780
40010
|
if (JSON.stringify(manifest) !== JSON.stringify(record2.codex.manifest))
|
|
39781
40011
|
throw new Error("\u5019\u9009\u5305\u7684 Codex \u517C\u5BB9\u58F0\u660E\u4E0E\u68C0\u67E5\u65F6\u4E0D\u4E00\u81F4\uFF0C\u62D2\u7EDD\u5207\u6362");
|
|
39782
|
-
const
|
|
39783
|
-
const state = current ?? await control(context2.location, "status");
|
|
40012
|
+
const checkRunningCodex = (state) => {
|
|
39784
40013
|
if (state.codexVersion !== record2.codex.version)
|
|
39785
|
-
throw new Error("Codex \u7248\u672C\
|
|
40014
|
+
throw new Error("\u91CD\u542F\u540E\u7684 Codex \u7248\u672C\u4E0E\u5347\u7EA7\u6821\u9A8C\u8BB0\u5F55\u4E0D\u5339\u914D");
|
|
40015
|
+
assertCodexIdentity(state.codexIdentity, record2.codex.target.identity);
|
|
39786
40016
|
requireCodexCompatibility(
|
|
39787
40017
|
manifest,
|
|
39788
40018
|
state.codexVersion ?? null,
|
|
39789
40019
|
record2.codex.confirmedUnverified
|
|
39790
40020
|
);
|
|
39791
40021
|
};
|
|
39792
|
-
|
|
39793
|
-
|
|
40022
|
+
probeRoot = candidateRoot;
|
|
40023
|
+
await checkRestartCodex();
|
|
40024
|
+
const versionProbe = await exec7(node2, [(0, import_node_path16.join)(candidateRoot, "bin/covro.mjs"), "--version"], {
|
|
39794
40025
|
timeout: 3e4,
|
|
39795
40026
|
env
|
|
39796
40027
|
});
|
|
39797
40028
|
if (versionProbe.stdout.trim() !== record2.target)
|
|
39798
40029
|
throw new Error("\u76EE\u6807 Node \u6267\u884C Covro \u5165\u53E3\u540E\u8FD4\u56DE\u7684\u7248\u672C\u4E0D\u5339\u914D");
|
|
39799
40030
|
const nativeProbe = 'const {createRequire}=await import("node:module"); const r=createRequire(process.argv[1]); const DB=r("better-sqlite3"); const db=new DB(":memory:"); db.close();';
|
|
39800
|
-
await
|
|
40031
|
+
await exec7(
|
|
39801
40032
|
node2,
|
|
39802
|
-
["--input-type=module", "-e", nativeProbe, (0,
|
|
40033
|
+
["--input-type=module", "-e", nativeProbe, (0, import_node_path16.join)(candidateRoot, "package.json")],
|
|
39803
40034
|
{ env, timeout: 3e4 }
|
|
39804
40035
|
);
|
|
39805
40036
|
await verifyMigrations(context2, candidateRoot);
|
|
@@ -39807,13 +40038,13 @@ async function workerCore(directory, logger) {
|
|
|
39807
40038
|
context2.location,
|
|
39808
40039
|
context2.source ?? {
|
|
39809
40040
|
node: process.execPath,
|
|
39810
|
-
entry: (0,
|
|
40041
|
+
entry: (0, import_node_path16.join)(context2.root, "bin/covro.mjs"),
|
|
39811
40042
|
path: process.env.PATH ?? "/usr/bin:/bin"
|
|
39812
40043
|
}
|
|
39813
40044
|
);
|
|
39814
40045
|
if (context2.target)
|
|
39815
40046
|
launch.target = { node: node2, entry: context2.target.entry, path: context2.target.path };
|
|
39816
|
-
await saveJson((0,
|
|
40047
|
+
await saveJson((0, import_node_path16.join)(directory, `launch-${record2.id}.json`), launch);
|
|
39817
40048
|
releaseMaintenance = await acquireMaintenanceLock(context2.dataDir);
|
|
39818
40049
|
await activateUpdate(
|
|
39819
40050
|
paths,
|
|
@@ -39835,23 +40066,24 @@ async function workerCore(directory, logger) {
|
|
|
39835
40066
|
phase: update,
|
|
39836
40067
|
waitForIdle: async () => {
|
|
39837
40068
|
for (; ; ) {
|
|
39838
|
-
await
|
|
39839
|
-
const
|
|
40069
|
+
await checkRestartCodex();
|
|
40070
|
+
const result2 = await control(
|
|
39840
40071
|
context2.location,
|
|
39841
40072
|
"prepare-update"
|
|
39842
40073
|
);
|
|
39843
|
-
if (
|
|
39844
|
-
await
|
|
40074
|
+
if (result2.ready) {
|
|
40075
|
+
await checkRestartCodex();
|
|
39845
40076
|
await verifyMigrations(context2, candidateRoot);
|
|
39846
|
-
const pinned = await readJson((0,
|
|
40077
|
+
const pinned = await readJson((0, import_node_path16.join)(candidateRoot, "package.json"));
|
|
39847
40078
|
if (JSON.stringify(pinned) !== JSON.stringify(candidate))
|
|
39848
40079
|
throw new Error("\u56FA\u5B9A\u5019\u9009\u5305\u5728\u5B89\u88C5\u540E\u53D1\u751F\u53D8\u5316\uFF0C\u62D2\u7EDD\u5207\u6362");
|
|
39849
40080
|
return;
|
|
39850
40081
|
}
|
|
39851
|
-
await update("waiting",
|
|
39852
|
-
await (0,
|
|
40082
|
+
await update("waiting", result2.reason ?? "\u7B49\u5F85\u6240\u6709\u4EFB\u52A1\u7ED3\u675F");
|
|
40083
|
+
await (0, import_promises19.setTimeout)(2e3);
|
|
39853
40084
|
}
|
|
39854
40085
|
},
|
|
40086
|
+
beforeStop: checkRestartCodex,
|
|
39855
40087
|
stop: () => stopService(context2),
|
|
39856
40088
|
start: async (candidate2) => {
|
|
39857
40089
|
await releaseData?.();
|
|
@@ -39868,10 +40100,14 @@ async function workerCore(directory, logger) {
|
|
|
39868
40100
|
if (current.version !== record2.target || !current.maintenance)
|
|
39869
40101
|
throw new Error("\u65B0\u7248\u670D\u52A1\u8EAB\u4EFD\u6216\u7EF4\u62A4\u72B6\u6001\u4E0D\u5339\u914D");
|
|
39870
40102
|
if (record2.runtime) assertRuntime(current.runtime, record2.runtime.target);
|
|
39871
|
-
|
|
39872
|
-
|
|
40103
|
+
if (current.codexVersion && current.codexVersion !== record2.codex.version)
|
|
40104
|
+
throw new Error("\u91CD\u542F\u540E\u7684 Codex \u7248\u672C\u4E0E\u5347\u7EA7\u6821\u9A8C\u8BB0\u5F55\u4E0D\u5339\u914D");
|
|
40105
|
+
if (current.codexReady) {
|
|
40106
|
+
checkRunningCodex(current);
|
|
40107
|
+
return;
|
|
40108
|
+
}
|
|
39873
40109
|
}
|
|
39874
|
-
await (0,
|
|
40110
|
+
await (0, import_promises19.setTimeout)(250);
|
|
39875
40111
|
}
|
|
39876
40112
|
throw new Error("\u65B0\u7248\u670D\u52A1\u6216 Codex \u8FDE\u63A5\u672A\u5C31\u7EEA\uFF0C\u62D2\u7EDD\u6FC0\u6D3B");
|
|
39877
40113
|
},
|
|
@@ -39880,11 +40116,11 @@ async function workerCore(directory, logger) {
|
|
|
39880
40116
|
id: record2.id,
|
|
39881
40117
|
channel: record2.channel
|
|
39882
40118
|
});
|
|
39883
|
-
const final = await readJson((0,
|
|
40119
|
+
const final = await readJson((0, import_node_path16.join)(directory, "run.json"));
|
|
39884
40120
|
if (!final?.committed) throw new Error("\u65B0\u7248\u5C1A\u672A\u786E\u8BA4\u5347\u7EA7\u63D0\u4EA4");
|
|
39885
40121
|
record2 = final;
|
|
39886
40122
|
},
|
|
39887
|
-
hasCommitted: async () => Boolean((await readJson((0,
|
|
40123
|
+
hasCommitted: async () => Boolean((await readJson((0, import_node_path16.join)(directory, "run.json")))?.committed),
|
|
39888
40124
|
resume: async () => {
|
|
39889
40125
|
await control(context2.location, "cancel-update").catch(() => {
|
|
39890
40126
|
});
|
|
@@ -39893,7 +40129,7 @@ async function workerCore(directory, logger) {
|
|
|
39893
40129
|
context2.reuseTarget
|
|
39894
40130
|
);
|
|
39895
40131
|
} catch (error62) {
|
|
39896
|
-
const latest = await readJson((0,
|
|
40132
|
+
const latest = await readJson((0, import_node_path16.join)(directory, "run.json"));
|
|
39897
40133
|
if (latest?.committed) {
|
|
39898
40134
|
record2 = latest;
|
|
39899
40135
|
} else if (!["rolledBack", "failed"].includes(record2.phase))
|
|
@@ -39908,16 +40144,16 @@ async function workerCore(directory, logger) {
|
|
|
39908
40144
|
await releaseMaintenance?.();
|
|
39909
40145
|
await release();
|
|
39910
40146
|
if (record2.phase === "succeeded" || record2.phase === "rolledBack") {
|
|
39911
|
-
await (0,
|
|
40147
|
+
await (0, import_promises18.rm)(paths.prefix, { recursive: true, force: true });
|
|
39912
40148
|
}
|
|
39913
40149
|
}
|
|
39914
40150
|
}
|
|
39915
40151
|
async function worker(directory) {
|
|
39916
|
-
const context2 = await readJson((0,
|
|
40152
|
+
const context2 = await readJson((0, import_node_path16.join)(directory, "context.json"));
|
|
39917
40153
|
if (!context2) throw new Error("Missing update context");
|
|
39918
|
-
const record2 = await readJson((0,
|
|
40154
|
+
const record2 = await readJson((0, import_node_path16.join)(directory, "run.json"));
|
|
39919
40155
|
const logging = await createLogging({
|
|
39920
|
-
...loggingOptions((0,
|
|
40156
|
+
...loggingOptions((0, import_node_path16.join)(context2.location.state, "logs"), record2?.from ?? "unknown"),
|
|
39921
40157
|
component: "update_worker"
|
|
39922
40158
|
});
|
|
39923
40159
|
const removeMonitor = monitorCrashes(logging.logger, logging.flushSync);
|