@agile-team/mach-report 2.15.0 → 2.17.0
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 +21 -12
- package/dist/{ExcelBindingWizard-Bs43BGNp.cjs → ExcelBindingWizard-Bq6FYME6.cjs} +1 -1
- package/dist/{ExcelBindingWizard-BKH1nGNS.js → ExcelBindingWizard-Co1svTsw.js} +3 -3
- package/dist/{ParamEditor-Da4akw6V.cjs → ParamEditor-B5UZRgxv.cjs} +1 -1
- package/dist/{ParamEditor-DoAhzJsm.js → ParamEditor-DNNARyeB.js} +1 -1
- package/dist/{ReportBatchPanel-wP9m9Pj1.cjs → ReportBatchPanel-Ctvs2t_9.cjs} +1 -1
- package/dist/{ReportBatchPanel-BMf6boMA.js → ReportBatchPanel-uQh06usx.js} +3 -3
- package/dist/ReportPreview-BdQawRh0.js +4879 -0
- package/dist/ReportPreview-CJC_-j2I.cjs +6 -0
- package/dist/{ReportTemplateLibrary-Sxr3eD0J.cjs → ReportTemplateLibrary-CnP7_1pH.cjs} +1 -1
- package/dist/{ReportTemplateLibrary-C9wutIiT.js → ReportTemplateLibrary-TIL_Oj2l.js} +1 -1
- package/dist/RuleEditor-DkRjOLlr.js +2141 -0
- package/dist/RuleEditor-h5anGsDB.cjs +1 -0
- package/dist/{TemplateOutlinePanel-JTSR53vJ.cjs → TemplateOutlinePanel-BlLxRrfu.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-D6Bkny59.js → TemplateOutlinePanel-BouxsuqQ.js} +1 -1
- package/dist/{TemplateReusePanel-rVuK1kTz.js → TemplateReusePanel-BEACLPaN.js} +2 -2
- package/dist/{TemplateReusePanel-Kx35S0Ql.cjs → TemplateReusePanel-yxsHSO40.cjs} +1 -1
- package/dist/{TemplateReviewPanel-B0ar9_zf.js → TemplateReviewPanel-B1OGRY2i.js} +1 -1
- package/dist/{TemplateReviewPanel-Dn6X9UmY.cjs → TemplateReviewPanel-D9Cx0m2N.cjs} +1 -1
- package/dist/analytics.cjs +1 -1
- package/dist/analytics.d.cts +65 -1
- package/dist/analytics.d.ts +65 -1
- package/dist/analytics.js +4 -4
- package/dist/artifact-integrity.json +105 -101
- package/dist/assets-BIMVwjQe.js +231 -0
- package/dist/assets-Dfs2ElxI.cjs +1 -0
- package/dist/auto-BIOmtVhk.js +240 -0
- package/dist/auto-DDHflI9v.cjs +1 -0
- package/dist/{batch-BfZHN1do.js → batch-WzDIXJAt.js} +1 -1
- package/dist/{batch-CLpELXBl.cjs → batch-z6Aw5GEY.cjs} +1 -1
- package/dist/codes.d.cts +2 -0
- package/dist/codes.d.ts +2 -0
- package/dist/component-tree-Ca6YYfHq.js +61 -0
- package/dist/component-tree-DkGLEfZC.cjs +1 -0
- package/dist/computed-BW5a8QFk.js +612 -0
- package/dist/computed-C2GD3XcE.cjs +1 -0
- package/dist/config-Dg_o8e7m.cjs +1 -0
- package/dist/{config-BVsJXSqS.js → config-XQ4qrQ7Q.js} +66 -64
- package/dist/dataset-DL83majE.js +161 -0
- package/dist/dataset-IrlXbUvh.cjs +1 -0
- package/dist/designer-D9XAxqSc.js +5178 -0
- package/dist/designer-uCDo5XSK.cjs +2 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +178 -3
- package/dist/designer.d.ts +178 -3
- package/dist/designer.js +1 -1
- package/dist/drill-ByN8COs_.cjs +1 -0
- package/dist/{drill-ByJviLXS.js → drill-CKW3Xtfa.js} +5 -5
- package/dist/encoding-BFMFIc4r.cjs +1 -0
- package/dist/encoding-DP_Eaf0A.js +21 -0
- package/dist/{font-loader-B_UkxpzC.cjs → font-loader-7FWVlykp.cjs} +1 -1
- package/dist/{font-loader-Q3bQjmrI.js → font-loader-CQZowp0I.js} +1 -1
- package/dist/index.cjs +8 -9
- package/dist/index.d.cts +175 -1
- package/dist/index.d.ts +175 -1
- package/dist/index.js +1343 -915
- package/dist/json-snapshot-D7PE1NsU.cjs +2 -0
- package/dist/json-snapshot-DYmEe3sO.js +1779 -0
- package/dist/matrix-JLAXlux-.js +302 -0
- package/dist/matrix-gTHpDTGm.cjs +1 -0
- package/dist/{pdf-CvvrjPQg.cjs → pdf-B8JouyYv.cjs} +48 -50
- package/dist/{pdf-BwNyeGpt.js → pdf-l3ea86di.js} +2734 -2748
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.d.cts +14 -0
- package/dist/pdf.d.ts +14 -0
- package/dist/pdf.js +2 -2
- package/dist/{plugin-Ca_XZG3l.js → plugin-BBp74CQZ.js} +1 -1
- package/dist/{plugin-DHO7X8z2.cjs → plugin-CtFX9PFG.cjs} +1 -1
- package/dist/prepared-CARicKYh.js +87 -0
- package/dist/prepared-Ch1x_Gog.cjs +1 -0
- package/dist/progress-BXzlVbIp.js +29 -0
- package/dist/progress-DJBd9Rb9.cjs +1 -0
- package/dist/{progress-D-OTpEav.js → progress-Hc2vxoCs.js} +2 -2
- package/dist/protocol-B5A2uom4.cjs +1 -0
- package/dist/protocol-BaiWjq5w.js +90 -0
- package/dist/record-bindings-B86Sur_y.cjs +1 -0
- package/dist/{record-bindings-Do_b3h4V.js → record-bindings-D4TuMzHs.js} +10 -11
- package/dist/{region-binding-workflow-BMhK_TjP.js → region-binding-workflow-BNasF5kz.js} +2 -2
- package/dist/{region-binding-workflow-DIYJdCUr.cjs → region-binding-workflow-O2Cni3mF.cjs} +1 -1
- package/dist/report-encoding-worker.cjs +1 -0
- package/dist/report-encoding-worker.d.ts +1 -0
- package/dist/report-encoding-worker.js +2 -0
- package/dist/rich-text-layout-ALlMoYOG.cjs +3 -0
- package/dist/rich-text-layout-Ct5WrY1g.js +102 -0
- package/dist/runtime-DakRXui3.js +170 -0
- package/dist/runtime-dL5ygIfa.cjs +1 -0
- package/dist/sbom.cdx.json +2 -2
- package/dist/server/node.d.cts +132 -1
- package/dist/server/node.d.ts +132 -1
- package/dist/server-node.cjs +5 -1
- package/dist/server-node.js +5177 -463
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +182 -2
- package/dist/server.d.ts +182 -2
- package/dist/server.js +918 -833
- package/dist/sha256-BshdOkCC.cjs +1 -0
- package/dist/sha256-DTG-Gq8i.js +157 -0
- package/dist/style-67OqfNed.js +73 -0
- package/dist/style-C22Pbv3T.cjs +1 -0
- package/dist/style.css +1 -1
- package/dist/template-catalog-Dua8h9ZA.cjs +1 -0
- package/dist/{template-catalog-j2B1MJlL.js → template-catalog-wT1fNeAP.js} +10 -10
- package/dist/{template-fragments-DcKeiylI.cjs → template-fragments-BajTajb4.cjs} +1 -1
- package/dist/{template-fragments-BGbQLGlV.js → template-fragments-DmX5XK4N.js} +2 -2
- package/dist/template-registry-CpysHAxy.cjs +1 -0
- package/dist/{template-registry-BtaKPELV.js → template-registry-u11fPd8D.js} +389 -321
- package/dist/{textwrap-DE1kgcJB.js → textwrap-BEIg2w8y.js} +1 -1
- package/dist/textwrap-BI-yJ6Wt.cjs +4 -0
- package/dist/{tree-BX380Rr7.cjs → tree-CLpxYbKa.cjs} +1 -1
- package/dist/{tree-CjVZLRw7.js → tree-DNJorJUf.js} +1 -1
- package/dist/vue/async.d.cts +174 -2
- package/dist/vue/async.d.ts +174 -2
- package/dist/vue/index.d.cts +218 -3
- package/dist/vue/index.d.ts +218 -3
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +7 -7
- package/dist/{workbook-session-BvToI-Fd.js → workbook-session-B8pNW24X.js} +153 -140
- package/dist/{workbook-session-Bjv1YCRK.cjs → workbook-session-DN5LSA5C.cjs} +12 -12
- package/dist/worker.cjs +1 -1
- package/dist/worker.d.cts +84 -1
- package/dist/worker.d.ts +84 -1
- package/dist/worker.js +12 -157
- package/dist/xlsx-node.cjs +33 -33
- package/dist/xlsx-node.js +1282 -1289
- package/dist/xlsx.cjs +4 -3
- package/dist/xlsx.d.cts +90 -2
- package/dist/xlsx.d.ts +90 -2
- package/dist/xlsx.js +279 -259
- package/package.json +6 -3
- package/dist/ReportPreview-ChV19HBp.js +0 -4619
- package/dist/ReportPreview-DbLvvOUT.cjs +0 -6
- package/dist/RuleEditor-C_Clasvd.js +0 -2037
- package/dist/RuleEditor-XhGHK8DE.cjs +0 -1
- package/dist/assets-B9ImAi6_.cjs +0 -1
- package/dist/assets-DEaz4qsp.js +0 -124
- package/dist/batch-BaP6pWDE.cjs +0 -1
- package/dist/batch-CGyt-b2W.js +0 -273
- package/dist/capabilities-CAh2Nrue.cjs +0 -1
- package/dist/capabilities-DskCHs3V.js +0 -69
- package/dist/computed-C-4C2S5h.js +0 -521
- package/dist/computed-CGV2a809.cjs +0 -1
- package/dist/config-D10us76d.cjs +0 -1
- package/dist/data-explanation-B8MZRYVS.js +0 -16
- package/dist/data-explanation-DE55G30w.cjs +0 -1
- package/dist/dataset-BkRmwgeJ.cjs +0 -1
- package/dist/dataset-H5pFuQGU.js +0 -121
- package/dist/defaults-DXhiM1ZD.js +0 -10
- package/dist/defaults-xhmcLLrf.cjs +0 -1
- package/dist/designer-2bDlcNXQ.js +0 -5136
- package/dist/designer-BT7XCdbW.cjs +0 -2
- package/dist/drill-DYTxuL3A.cjs +0 -1
- package/dist/grid-strokes-Cr7DwUux.cjs +0 -1
- package/dist/grid-strokes-DyyG1q_o.js +0 -53
- package/dist/json-snapshot-DFb2eWkf.js +0 -1416
- package/dist/json-snapshot-WWSGlaHG.cjs +0 -2
- package/dist/matrix-CGRGkn5s.js +0 -112
- package/dist/matrix-gEO7ZM_u.cjs +0 -1
- package/dist/prepared-CFy9B75C.cjs +0 -1
- package/dist/prepared-ajM-H-9B.js +0 -69
- package/dist/record-bindings-By_UKZ2g.cjs +0 -1
- package/dist/render-plan-7xpGrCEl.cjs +0 -1
- package/dist/render-plan-Ck6koX9L.js +0 -13
- package/dist/sha256-ArEYjaTI.cjs +0 -1
- package/dist/sha256-DPEuJ3nh.js +0 -155
- package/dist/style-CQ1PK8ZB.js +0 -67
- package/dist/style-UgIJSA1F.cjs +0 -1
- package/dist/template-catalog-FJE_c9Qe.cjs +0 -1
- package/dist/template-registry-Co1zPq5e.cjs +0 -1
- package/dist/textwrap-CWHyzkBH.cjs +0 -4
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { s as A, c as C, a as q } from "./prepared-CARicKYh.js";
|
|
2
|
+
import { F as U } from "./json-snapshot-DYmEe3sO.js";
|
|
3
|
+
import { b as T, R as S, v as I, c as $ } from "./protocol-BaiWjq5w.js";
|
|
4
|
+
import { a as H } from "./progress-Hc2vxoCs.js";
|
|
5
|
+
import { c as N, e as G } from "./runtime-DakRXui3.js";
|
|
6
|
+
import { D as j, R as M, t as R, v as K, b as F, c as L } from "./sha256-DTG-Gq8i.js";
|
|
7
|
+
class O extends Error {
|
|
8
|
+
constructor(r) {
|
|
9
|
+
super("报表 Worker 无法启动"), this.cause = r, this.name = "ReportWorkerStartError";
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
let X = 0;
|
|
13
|
+
function W(e) {
|
|
14
|
+
const r = new Error("报表 Worker 任务已取消");
|
|
15
|
+
return r.name = "AbortError", Object.defineProperty(r, "cause", { value: e }), r;
|
|
16
|
+
}
|
|
17
|
+
function J(e, r) {
|
|
18
|
+
if (!e || typeof e != "object") return;
|
|
19
|
+
const t = e;
|
|
20
|
+
return t.protocol === S && t.id === r ? t : void 0;
|
|
21
|
+
}
|
|
22
|
+
function Q(e, r = {}) {
|
|
23
|
+
const t = r.timeoutMs ?? 12e4;
|
|
24
|
+
if (!Number.isFinite(t) || t <= 0 || t > 2147483647) throw new RangeError("Worker timeoutMs 应为正有限数字,且不能超过 2147483647");
|
|
25
|
+
const n = (o, s, a, f) => a?.aborted ? Promise.reject(W(a.reason)) : new Promise((v, i) => {
|
|
26
|
+
let g;
|
|
27
|
+
try {
|
|
28
|
+
g = e();
|
|
29
|
+
} catch (l) {
|
|
30
|
+
i(new O(l));
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const w = `mach-report-${Date.now()}-${++X}`;
|
|
34
|
+
let m = !1, u = () => {
|
|
35
|
+
}, y;
|
|
36
|
+
const p = (l, c) => {
|
|
37
|
+
if (m) return;
|
|
38
|
+
m = !0, y && clearTimeout(y);
|
|
39
|
+
let b;
|
|
40
|
+
try {
|
|
41
|
+
u();
|
|
42
|
+
} catch (E) {
|
|
43
|
+
b = E;
|
|
44
|
+
}
|
|
45
|
+
a?.removeEventListener("abort", x), l ??= b, Promise.resolve().then(() => g.terminate()).then(
|
|
46
|
+
() => l === void 0 ? v(c) : i(l),
|
|
47
|
+
(E) => i(l ?? E)
|
|
48
|
+
);
|
|
49
|
+
}, x = () => p(W(a?.reason)), d = (l) => {
|
|
50
|
+
const c = J(l, w);
|
|
51
|
+
if (!(!c || m)) {
|
|
52
|
+
if ("type" in c && c.type === "event") {
|
|
53
|
+
const b = "event" in c ? c.event : void 0;
|
|
54
|
+
I(b, s) ? U(f, b, a) : p(new Error("报表 Worker 返回无效阶段事件"));
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
c.error && typeof c.error.name == "string" && typeof c.error.message == "string" ? p(new T(c.error)) : $(c.result, o) && (o === "prepare" || "format" in c.result && "format" in s && c.result.format === s.format) ? p(void 0, c.result) : p(new Error("报表 Worker 返回无效响应"));
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
try {
|
|
61
|
+
if (u = g.subscribe(d, (l) => p(l ?? new Error("报表 Worker 执行失败"))), m) {
|
|
62
|
+
u();
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (a?.addEventListener("abort", x, { once: !0 }), y = setTimeout(() => p(new T({ name: "ReportRuntimeError", code: "timeout", message: `报表 Worker 执行超过 ${t}ms` })), t), a?.aborted) x();
|
|
66
|
+
else {
|
|
67
|
+
const { onEvent: l, signal: c, ...b } = s, E = V(b);
|
|
68
|
+
g.postMessage({ protocol: S, id: w, operation: o, input: b, ...r.budget ? { budget: r.budget } : {} }, E);
|
|
69
|
+
}
|
|
70
|
+
} catch (l) {
|
|
71
|
+
p(l);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
return { exportPrepared: (o, s, a) => n("exportPrepared", o, s, a), prepare: (o, s, a) => n("prepare", o, s, a), export: (o, s, a) => n("export", o, s, a) };
|
|
75
|
+
}
|
|
76
|
+
function V(e) {
|
|
77
|
+
return e.pdf ? (e.pdf = A(e.pdf), (e.pdf?.customFontFaces ? Object.values(e.pdf.customFontFaces) : [e.pdf?.customFontBytes]).filter((t) => t instanceof Uint8Array).map((t) => t.buffer)) : [];
|
|
78
|
+
}
|
|
79
|
+
function Y(e, r = {}) {
|
|
80
|
+
return Q(() => {
|
|
81
|
+
const t = e();
|
|
82
|
+
return {
|
|
83
|
+
postMessage: (n, o) => t.postMessage(n, o),
|
|
84
|
+
terminate: () => t.terminate(),
|
|
85
|
+
subscribe: (n, o) => {
|
|
86
|
+
const s = (f) => n(f.data), a = (f) => o(f instanceof ErrorEvent ? new Error(f.message) : new Error("报表 Worker 消息无法解码"));
|
|
87
|
+
return t.addEventListener("message", s), t.addEventListener("error", a), t.addEventListener("messageerror", a), () => {
|
|
88
|
+
t.removeEventListener("message", s), t.removeEventListener("error", a), t.removeEventListener("messageerror", a);
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}, r);
|
|
93
|
+
}
|
|
94
|
+
const Z = { cells: 2e4, pages: 20, bytes: 2e6 };
|
|
95
|
+
function P(e) {
|
|
96
|
+
return e.cells >= e.limits.cells || e.pages >= e.limits.pages || e.bytes >= e.limits.bytes || e.capped;
|
|
97
|
+
}
|
|
98
|
+
function k(e) {
|
|
99
|
+
return ++e.visits >= 1e5 && (e.capped = !0), !P(e);
|
|
100
|
+
}
|
|
101
|
+
function h(e) {
|
|
102
|
+
return typeof e == "string" ? e.length * 2 : 0;
|
|
103
|
+
}
|
|
104
|
+
function D(e, r) {
|
|
105
|
+
for (const t of e ?? []) {
|
|
106
|
+
if (!k(r)) return;
|
|
107
|
+
for (const n of t.segments) {
|
|
108
|
+
if (!k(r)) return;
|
|
109
|
+
r.bytes += h(n.text);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function z(e, r, t) {
|
|
114
|
+
if (t > 32) {
|
|
115
|
+
r.capped = !0;
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (k(r)) {
|
|
119
|
+
r.bytes += h(e.text) + h(e.rawText) + h(e.imageData), D(e.richParagraphs, r);
|
|
120
|
+
for (const n of e.lines ?? []) {
|
|
121
|
+
if (!k(r)) return;
|
|
122
|
+
r.bytes += h(n);
|
|
123
|
+
}
|
|
124
|
+
for (const n of e.grid?.cells ?? []) {
|
|
125
|
+
if (!k(r)) return;
|
|
126
|
+
for (const o of n) {
|
|
127
|
+
if (!k(r)) return;
|
|
128
|
+
if (o) {
|
|
129
|
+
r.cells++, r.bytes += h(o.text) + h(o.rawText) + h(o.value), D(o.richParagraphs, r);
|
|
130
|
+
for (const s of o.children ?? []) {
|
|
131
|
+
if (P(r)) return;
|
|
132
|
+
z(s, r, t + 1);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function ee(e) {
|
|
140
|
+
const r = { ...Z, ...e.thresholds };
|
|
141
|
+
for (const t of Object.values(r)) if (!Number.isSafeInteger(t) || t <= 0) throw new RangeError("导出隔离阈值应为正安全整数");
|
|
142
|
+
return r;
|
|
143
|
+
}
|
|
144
|
+
function re(e, r) {
|
|
145
|
+
const t = ee(r), n = e.pdf?.customFontFaces ? Object.values(e.pdf.customFontFaces) : [e.pdf?.customFontBytes], o = { pages: e.prepared.plan.pages.length, cells: 0, bytes: n.reduce((f, v) => f + (v?.byteLength ?? 0), 0), visits: 0, capped: !1, limits: t };
|
|
146
|
+
for (const f of e.prepared.plan.pages) {
|
|
147
|
+
if (P(o)) break;
|
|
148
|
+
for (const v of f.components) {
|
|
149
|
+
if (P(o)) break;
|
|
150
|
+
z(v, o, 0);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
let s = P(o) ? "worker" : "local", a = o.capped ? "scan-limit" : s === "worker" ? "threshold" : "small-task";
|
|
154
|
+
return r.mode === "local" && (s = "local", a = "explicit-local"), r.mode === "worker" && (s = "worker", a = "explicit-worker"), Object.values(e.xlsx ?? {}).some((f) => typeof f == "function") && (s = "local", a = "nonserializable-options"), { mode: s, reason: a, estimate: { pages: o.pages, cells: o.cells, bytes: o.bytes }, hardCancellation: s === "worker" };
|
|
155
|
+
}
|
|
156
|
+
function te(e) {
|
|
157
|
+
if (e.mode !== void 0 && !["auto", "local", "worker"].includes(e.mode)) throw new TypeError("无效的导出执行模式");
|
|
158
|
+
if (e.fallback !== void 0 && !["local", "error"].includes(e.fallback)) throw new TypeError("无效的导出回退策略");
|
|
159
|
+
K({ ...e.budget, maxDurationMs: e.timeoutMs ?? e.budget?.maxDurationMs ?? 12e4 });
|
|
160
|
+
}
|
|
161
|
+
function _(e, r) {
|
|
162
|
+
H(() => e.onDecision?.({ ...r, estimate: { ...r.estimate } }));
|
|
163
|
+
}
|
|
164
|
+
function B(e, r) {
|
|
165
|
+
return { ...e, mode: "local", reason: r, hardCancellation: !1 };
|
|
166
|
+
}
|
|
167
|
+
function oe(e, r) {
|
|
168
|
+
const t = { ...j, ...r.budget }, n = C(e.prepared, t.maxPreparedBytes, e.signal), o = G(n.prepared, t);
|
|
169
|
+
n.prepared.stats = o.stats;
|
|
170
|
+
const s = { ...e, prepared: n.prepared, pdf: A(e.pdf), xlsx: q(e.xlsx) };
|
|
171
|
+
return { request: s, forward: () => ({ ...s, prepared: n.forward() }) };
|
|
172
|
+
}
|
|
173
|
+
function se(e, r) {
|
|
174
|
+
te(e);
|
|
175
|
+
const t = { ...e, thresholds: { ...e.thresholds }, budget: { ...j, ...e.budget } }, n = t.timeoutMs ?? t.budget.maxDurationMs ?? 12e4, o = N({ reports: {}, budget: { ...t.budget, maxDurationMs: n } }), s = /* @__PURE__ */ new Set();
|
|
176
|
+
let a = !1;
|
|
177
|
+
const f = t.mode !== "worker" && t.fallback !== "error";
|
|
178
|
+
async function v(i, g) {
|
|
179
|
+
const w = Date.now(), m = () => {
|
|
180
|
+
const d = n - (Date.now() - w);
|
|
181
|
+
if (d <= 0) throw new M("timeout", `报表执行超过 ${n}ms`);
|
|
182
|
+
return d;
|
|
183
|
+
};
|
|
184
|
+
let u = re(i, t);
|
|
185
|
+
if (u.reason === "nonserializable-options" && t.mode === "worker") throw new TypeError("Worker 模式不接受函数选项;请使用本地模式或可序列化配置");
|
|
186
|
+
if (u.mode === "worker" && !r) {
|
|
187
|
+
if (!f) throw new O(new Error("未配置 workerFactory"));
|
|
188
|
+
u = B(u, "worker-unavailable");
|
|
189
|
+
}
|
|
190
|
+
const y = oe(i, t), p = y.request;
|
|
191
|
+
if (_(t, u), R(i.signal), u.mode === "worker")
|
|
192
|
+
try {
|
|
193
|
+
const d = r(m());
|
|
194
|
+
if (!d.exportPrepared) throw new TypeError("隔离执行器缺少 exportPrepared");
|
|
195
|
+
const { signal: l, onEvent: c, ...b } = p, E = await d.exportPrepared(b, l, c);
|
|
196
|
+
return R(l), F(t.budget, "maxOutputBytes", E.bytes.byteLength), { ...E, execution: u };
|
|
197
|
+
} catch (d) {
|
|
198
|
+
if (!(d instanceof O) || !f) throw d;
|
|
199
|
+
R(i.signal), u = B(u, "worker-start-failed"), _(t, u);
|
|
200
|
+
}
|
|
201
|
+
const x = g ? await L(i.signal, m(), (d) => g({ ...p, signal: d })) : await L(i.signal, m(), (d) => o.exportPrepared({ ...y.forward(), signal: d }));
|
|
202
|
+
return R(i.signal), F(t.budget, "maxOutputBytes", x.bytes.byteLength), { ...x, execution: u };
|
|
203
|
+
}
|
|
204
|
+
return {
|
|
205
|
+
async exportPrepared(i, g) {
|
|
206
|
+
if (a) throw new M("closed", "导出执行器已释放");
|
|
207
|
+
if (R(i.signal), s.size >= 2) throw new M("queue-full", "同时导出的任务已达 2 个,请等待完成后重试");
|
|
208
|
+
const w = new AbortController();
|
|
209
|
+
s.add(w);
|
|
210
|
+
const m = () => w.abort(i.signal?.reason);
|
|
211
|
+
i.signal?.addEventListener("abort", m, { once: !0 });
|
|
212
|
+
try {
|
|
213
|
+
return await v({ ...i, signal: w.signal }, g);
|
|
214
|
+
} finally {
|
|
215
|
+
i.signal?.removeEventListener("abort", m), s.delete(w);
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
cancel() {
|
|
219
|
+
for (const i of s) i.abort();
|
|
220
|
+
},
|
|
221
|
+
dispose() {
|
|
222
|
+
a = !0;
|
|
223
|
+
for (const i of s) i.abort();
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
function ne(e = {}) {
|
|
228
|
+
const r = e.workerFactory, t = { timeoutMs: e.timeoutMs ?? e.budget?.maxDurationMs, budget: { ...e.budget } };
|
|
229
|
+
return se(e, r ? (n) => Y(r, { ...t, timeoutMs: n }) : void 0);
|
|
230
|
+
}
|
|
231
|
+
const de = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
232
|
+
__proto__: null,
|
|
233
|
+
createAutoReportExporter: ne
|
|
234
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
235
|
+
export {
|
|
236
|
+
O as R,
|
|
237
|
+
Y as a,
|
|
238
|
+
de as b,
|
|
239
|
+
ne as c
|
|
240
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const T=require("./prepared-Ch1x_Gog.cjs"),S=require("./json-snapshot-D7PE1NsU.cjs"),R=require("./protocol-B5A2uom4.cjs"),I=require("./progress-B0ctFpKf.cjs"),_=require("./runtime-dL5ygIfa.cjs"),d=require("./sha256-BshdOkCC.cjs");class M extends Error{constructor(r){super("报表 Worker 无法启动"),this.cause=r,this.name="ReportWorkerStartError"}}let j=0;function W(e){const r=new Error("报表 Worker 任务已取消");return r.name="AbortError",Object.defineProperty(r,"cause",{value:e}),r}function U(e,r){if(!e||typeof e!="object")return;const t=e;return t.protocol===R.REPORT_WORKER_PROTOCOL&&t.id===r?t:void 0}function C(e,r={}){const t=r.timeoutMs??12e4;if(!Number.isFinite(t)||t<=0||t>2147483647)throw new RangeError("Worker timeoutMs 应为正有限数字,且不能超过 2147483647");const n=(o,s,a,u)=>a?.aborted?Promise.reject(W(a.reason)):new Promise((v,c)=>{let w;try{w=e()}catch(l){c(new M(l));return}const E=`mach-report-${Date.now()}-${++j}`;let m=!1,f=()=>{},k;const b=(l,i)=>{if(m)return;m=!0,k&&clearTimeout(k);let g;try{f()}catch(h){g=h}a?.removeEventListener("abort",x),l??=g,Promise.resolve().then(()=>w.terminate()).then(()=>l===void 0?v(i):c(l),h=>c(l??h))},x=()=>b(W(a?.reason)),p=l=>{const i=U(l,E);if(!(!i||m)){if("type"in i&&i.type==="event"){const g="event"in i?i.event:void 0;R.validReportWorkerEvent(g,s)?S.notifyReportTaskEvent(u,g,a):b(new Error("报表 Worker 返回无效阶段事件"));return}i.error&&typeof i.error.name=="string"&&typeof i.error.message=="string"?b(new R.ReportWorkerError(i.error)):R.validReportWorkerResult(i.result,o)&&(o==="prepare"||"format"in i.result&&"format"in s&&i.result.format===s.format)?b(void 0,i.result):b(new Error("报表 Worker 返回无效响应"))}};try{if(f=w.subscribe(p,l=>b(l??new Error("报表 Worker 执行失败"))),m){f();return}if(a?.addEventListener("abort",x,{once:!0}),k=setTimeout(()=>b(new R.ReportWorkerError({name:"ReportRuntimeError",code:"timeout",message:`报表 Worker 执行超过 ${t}ms`})),t),a?.aborted)x();else{const{onEvent:l,signal:i,...g}=s,h=z(g);w.postMessage({protocol:R.REPORT_WORKER_PROTOCOL,id:E,operation:o,input:g,...r.budget?{budget:r.budget}:{}},h)}}catch(l){b(l)}});return{exportPrepared:(o,s,a)=>n("exportPrepared",o,s,a),prepare:(o,s,a)=>n("prepare",o,s,a),export:(o,s,a)=>n("export",o,s,a)}}function z(e){return e.pdf?(e.pdf=T.snapshotPdfFonts(e.pdf),(e.pdf?.customFontFaces?Object.values(e.pdf.customFontFaces):[e.pdf?.customFontBytes]).filter(t=>t instanceof Uint8Array).map(t=>t.buffer)):[]}function A(e,r={}){return C(()=>{const t=e();return{postMessage:(n,o)=>t.postMessage(n,o),terminate:()=>t.terminate(),subscribe:(n,o)=>{const s=u=>n(u.data),a=u=>o(u instanceof ErrorEvent?new Error(u.message):new Error("报表 Worker 消息无法解码"));return t.addEventListener("message",s),t.addEventListener("error",a),t.addEventListener("messageerror",a),()=>{t.removeEventListener("message",s),t.removeEventListener("error",a),t.removeEventListener("messageerror",a)}}}},r)}const N={cells:2e4,pages:20,bytes:2e6};function P(e){return e.cells>=e.limits.cells||e.pages>=e.limits.pages||e.bytes>=e.limits.bytes||e.capped}function O(e){return++e.visits>=1e5&&(e.capped=!0),!P(e)}function y(e){return typeof e=="string"?e.length*2:0}function L(e,r){for(const t of e??[]){if(!O(r))return;for(const n of t.segments){if(!O(r))return;r.bytes+=y(n.text)}}}function B(e,r,t){if(t>32){r.capped=!0;return}if(O(r)){r.bytes+=y(e.text)+y(e.rawText)+y(e.imageData),L(e.richParagraphs,r);for(const n of e.lines??[]){if(!O(r))return;r.bytes+=y(n)}for(const n of e.grid?.cells??[]){if(!O(r))return;for(const o of n){if(!O(r))return;if(o){r.cells++,r.bytes+=y(o.text)+y(o.rawText)+y(o.value),L(o.richParagraphs,r);for(const s of o.children??[]){if(P(r))return;B(s,r,t+1)}}}}}}function $(e){const r={...N,...e.thresholds};for(const t of Object.values(r))if(!Number.isSafeInteger(t)||t<=0)throw new RangeError("导出隔离阈值应为正安全整数");return r}function H(e,r){const t=$(r),n=e.pdf?.customFontFaces?Object.values(e.pdf.customFontFaces):[e.pdf?.customFontBytes],o={pages:e.prepared.plan.pages.length,cells:0,bytes:n.reduce((u,v)=>u+(v?.byteLength??0),0),visits:0,capped:!1,limits:t};for(const u of e.prepared.plan.pages){if(P(o))break;for(const v of u.components){if(P(o))break;B(v,o,0)}}let s=P(o)?"worker":"local",a=o.capped?"scan-limit":s==="worker"?"threshold":"small-task";return r.mode==="local"&&(s="local",a="explicit-local"),r.mode==="worker"&&(s="worker",a="explicit-worker"),Object.values(e.xlsx??{}).some(u=>typeof u=="function")&&(s="local",a="nonserializable-options"),{mode:s,reason:a,estimate:{pages:o.pages,cells:o.cells,bytes:o.bytes},hardCancellation:s==="worker"}}function G(e){if(e.mode!==void 0&&!["auto","local","worker"].includes(e.mode))throw new TypeError("无效的导出执行模式");if(e.fallback!==void 0&&!["local","error"].includes(e.fallback))throw new TypeError("无效的导出回退策略");d.validateBudget({...e.budget,maxDurationMs:e.timeoutMs??e.budget?.maxDurationMs??12e4})}function F(e,r){I.observeOutput(()=>e.onDecision?.({...r,estimate:{...r.estimate}}))}function D(e,r){return{...e,mode:"local",reason:r,hardCancellation:!1}}function K(e,r){const t={...d.DEFAULT_REPORT_RUNTIME_BUDGET,...r.budget},n=T.capturePreparedHandoff(e.prepared,t.maxPreparedBytes,e.signal),o=_.enforcePrepared(n.prepared,t);n.prepared.stats=o.stats;const s={...e,prepared:n.prepared,pdf:T.snapshotPdfFonts(e.pdf),xlsx:T.snapshotXlsxOptions(e.xlsx)};return{request:s,forward:()=>({...s,prepared:n.forward()})}}function X(e,r){G(e);const t={...e,thresholds:{...e.thresholds},budget:{...d.DEFAULT_REPORT_RUNTIME_BUDGET,...e.budget}},n=t.timeoutMs??t.budget.maxDurationMs??12e4,o=_.createReportRuntime({reports:{},budget:{...t.budget,maxDurationMs:n}}),s=new Set;let a=!1;const u=t.mode!=="worker"&&t.fallback!=="error";async function v(c,w){const E=Date.now(),m=()=>{const p=n-(Date.now()-E);if(p<=0)throw new d.ReportRuntimeError("timeout",`报表执行超过 ${n}ms`);return p};let f=H(c,t);if(f.reason==="nonserializable-options"&&t.mode==="worker")throw new TypeError("Worker 模式不接受函数选项;请使用本地模式或可序列化配置");if(f.mode==="worker"&&!r){if(!u)throw new M(new Error("未配置 workerFactory"));f=D(f,"worker-unavailable")}const k=K(c,t),b=k.request;if(F(t,f),d.throwIfAborted(c.signal),f.mode==="worker")try{const p=r(m());if(!p.exportPrepared)throw new TypeError("隔离执行器缺少 exportPrepared");const{signal:l,onEvent:i,...g}=b,h=await p.exportPrepared(g,l,i);return d.throwIfAborted(l),d.assertBudget(t.budget,"maxOutputBytes",h.bytes.byteLength),{...h,execution:f}}catch(p){if(!(p instanceof M)||!u)throw p;d.throwIfAborted(c.signal),f=D(f,"worker-start-failed"),F(t,f)}const x=w?await d.controlled(c.signal,m(),p=>w({...b,signal:p})):await d.controlled(c.signal,m(),p=>o.exportPrepared({...k.forward(),signal:p}));return d.throwIfAborted(c.signal),d.assertBudget(t.budget,"maxOutputBytes",x.bytes.byteLength),{...x,execution:f}}return{async exportPrepared(c,w){if(a)throw new d.ReportRuntimeError("closed","导出执行器已释放");if(d.throwIfAborted(c.signal),s.size>=2)throw new d.ReportRuntimeError("queue-full","同时导出的任务已达 2 个,请等待完成后重试");const E=new AbortController;s.add(E);const m=()=>E.abort(c.signal?.reason);c.signal?.addEventListener("abort",m,{once:!0});try{return await v({...c,signal:E.signal},w)}finally{c.signal?.removeEventListener("abort",m),s.delete(E)}},cancel(){for(const c of s)c.abort()},dispose(){a=!0;for(const c of s)c.abort()}}}function q(e={}){const r=e.workerFactory,t={timeoutMs:e.timeoutMs??e.budget?.maxDurationMs,budget:{...e.budget}};return X(e,r?n=>A(r,{...t,timeoutMs:n}):void 0)}const J=Object.freeze(Object.defineProperty({__proto__:null,createAutoReportExporter:q},Symbol.toStringTag,{value:"Module"}));exports.ReportWorkerStartError=M;exports.auto=J;exports.createAutoReportExporter=q;exports.createBrowserReportExecutor=A;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const v=require("./sha256-
|
|
1
|
+
"use strict";const v=require("./sha256-BshdOkCC.cjs");function j(e={}){const t={maxRecords:e.maxRecords??1e4,maxBytes:e.maxBytes??67108864,maxResultBytes:e.maxResultBytes??262144,controlReserveBytes:e.controlReserveBytes??4096,maxTombstones:e.maxTombstones??1e4,maxTombstoneBytes:e.maxTombstoneBytes??16777216};if(!Object.values(t).every(n=>Number.isSafeInteger(n)&&n>0)||t.controlReserveBytes<4096)throw new c("input","任务容量应为正整数,控制状态预留至少4096字节");return t}function g(e){return new TextEncoder().encode(d(e)).byteLength}function A(e,t){const n={scope:e.scope,id:e.id,revision:1,request:e.request,status:"queued",createdAt:e.createdAt,updatedAt:e.createdAt,attempt:0},r={...e};delete r.result;const a=e.result===void 0?0:g(e.result);if(a>t.maxResultBytes)throw new c("capacity","任务结果超过独立预算,请保存文件引用");return Math.max(g(n)+t.controlReserveBytes,g(r))+a}function x(e){return e.status!=="queued"&&e.status!=="running"}function I(e){const t={...e,tombstoneRetentionMs:e.tombstoneRetentionMs??6048e5,limit:e.limit??100};if(![t.now,t.terminalBefore].every(n=>Number.isSafeInteger(n)&&n>=0)||t.terminalBefore>t.now)throw new c("input","终态清理时间应为不超过当前时间的非负整数");if(![t.tombstoneRetentionMs,t.limit].every(n=>Number.isSafeInteger(n)&&n>0)||!Number.isSafeInteger(t.now+t.tombstoneRetentionMs))throw new c("input","幂等保留期与清理批量应为正整数");return t}async function R(e){const t=new TextEncoder().encode(d(e)),n=globalThis.crypto?.subtle;if(!n)return v.portableSha256HexAsync(t);const r=await n.digest("SHA-256",t);return Array.from(new Uint8Array(r),a=>a.toString(16).padStart(2,"0")).join("")}async function E(e,t){if(!x(e))throw new c("input","只能归档终态任务");return{scope:e.scope,id:e.id,revision:e.revision,status:e.status,createdAt:e.createdAt,updatedAt:e.updatedAt,attempt:e.attempt,requestHash:await R(e.request),expiresAt:t}}class c extends Error{constructor(t,n){super(n),this.code=t,this.name="ReportJobError"}}function J(e,t){if(typeof e!="string"||!e.trim()||e.length>256||typeof t!="string"||t!==t.trim()||!/^[a-zA-Z0-9][a-zA-Z0-9_.:-]{0,127}$/.test(t))throw new c("input","任务范围应非空,ID应为1–128位安全标识")}function T(e){const t=Array.isArray(e),n=Object.getPrototypeOf(e),r=Object.keys(e);if(n!==(t?Array.prototype:Object.prototype)&&!(n===null&&!t))throw new c("input","任务对象应为普通 JSON 对象");if(Object.getOwnPropertySymbols(e).length)throw new c("input","任务不能包含Symbol");if(Object.getOwnPropertyNames(e).filter(i=>!(t&&i==="length")).length!==r.length)throw new c("input","任务不能包含不可枚举属性");if(t&&(r.length!==e.length||r.some(i=>i!==String(Number(i))||!Number.isSafeInteger(Number(i))||Number(i)<0||Number(i)>=e.length)))throw new c("input","任务数组不能稀疏或包含额外属性");return r.sort()}function M(e,t){const n=Object.getOwnPropertyDescriptor(e,t);if(["__proto__","prototype","constructor"].includes(t)||n.get||n.set)throw new c("input","任务不能包含危险键或访问器");return n.value}function d(e,t={}){const n=t.maxNodes??2e4,r=t.maxCharacters??1e6;if(!Number.isSafeInteger(n)||n<1||n>2e4||!Number.isSafeInteger(r)||r<1||r>1e6)throw new c("input","任务JSON预算无效");let a=0,i=0;const y=new Set;function b(s,u){if(++a>n||u>32)throw new c("input","任务数据超过节点或深度预算");if(typeof s=="string"){if(i+=s.length,i>r)throw new c("input","任务文本超过预算");return s}if(s===null||typeof s=="boolean"||typeof s=="number"&&Number.isFinite(s))return s;if(!s||typeof s!="object"||y.has(s))throw new c("input","任务只允许无循环的有限 JSON 值");const o=Array.isArray(s),h=T(s);y.add(s);const l=Object.create(null);for(const f of h){if(i+=f.length,i>r)throw new c("input","任务文本超过预算");l[f]=b(M(s,f),u+1)}return y.delete(s),o?Array.from({length:s.length},(f,p)=>l[String(p)]):l}const w=JSON.stringify(b(e,0));if(w.length>r)throw new c("input","任务序列化数据超过字符预算");return w}function m(e){return JSON.parse(JSON.stringify(e))}function N(e,t,n,r){if(J(t,n),e.scope!==t||e.id!==n||e.revision!==(r??0)+1||!Number.isSafeInteger(e.revision))throw new c("input","任务身份或修订不匹配");if(![e.createdAt,e.updatedAt,e.attempt].every(a=>Number.isSafeInteger(a)&&a>=0)||!["queued","running","completed","failed","cancelled"].includes(e.status))throw new c("input","任务状态无效");if(e.lease&&(!e.lease.owner||!Number.isSafeInteger(e.lease.expiresAt)))throw new c("input","任务租约无效");if(!e.request||typeof e.request.kind!="string"||!e.request.kind.trim()||e.request.kind.length>128)throw new c("input","任务类型无效");d(e.request.payload,{maxNodes:19e3,maxCharacters:75e4}),d(e)}function B(e,t){if(e&&(e.createdAt!==t.createdAt||d(e.request)!==d(t.request)))throw new c("input","任务创建时间与请求不可变更,请使用新任务ID")}function O(e,t){return e.status==="queued"||e.status==="running"&&(e.lease?.expiresAt??0)<=t}function C(e={}){const t=new Map,n=new Map,r=j(e);let a=0,i=0,y=Promise.resolve();const b=(s,u)=>JSON.stringify([s,u]),w=s=>{const u=y.then(s);return y=u.then(()=>{},()=>{}),u};return{read:async(s,u)=>{await y;const o=t.get(b(s,u));return o?m(o):void 0},readTombstone:async(s,u)=>{await y;const o=n.get(b(s,u));return o?m(o):void 0},candidates:async(s,u)=>(await y,Array.from(t.values()).filter(o=>O(o,s)).sort((o,h)=>o.createdAt-h.createdAt).slice(0,u).map(m)),compareAndSwap:async(s,u,o,h)=>{N(h,s,u,o);const l=m(h);return w(async()=>{const f=b(s,u),p=t.get(f);if((p?.revision??null)!==o||n.has(f))return!1;B(p,l);const S=a-(p?A(p,r):0)+A(l,r);if(S>r.maxBytes||!p&&t.size>=r.maxRecords)throw new c("capacity","任务容量已满,请清理终态任务或扩大显式预算");return t.set(f,l),a=S,!0})},prune:async s=>{const u=I(s);return w(async()=>{const o={archived:0,expired:0};for(const[h,l]of n)l.expiresAt>u.now||o.expired>=u.limit||(n.delete(h),i-=g(l),o.expired++);for(const[h,l]of t){if(!x(l)||l.updatedAt>u.terminalBefore||o.archived+o.expired>=u.limit)continue;const f=await E(l,u.now+u.tombstoneRetentionMs),p=g(f);if(n.size>=r.maxTombstones||i+p>r.maxTombstoneBytes)break;n.set(h,f),i+=p,t.delete(h),a-=A(l,r),o.archived++}return o})}}}function q(e,t=100){if(!Number.isSafeInteger(t)||t<1||t>1e3||!Array.isArray(e)||e.length>t)throw new RangeError("批量参数应包含 1–maxCases 条,maxCases 最大为 1000");const n=JSON.parse(d(e)),r=new Set;for(const a of n){if(!a||typeof a.id!="string"||a.id!==a.id.trim()||!/^[a-zA-Z0-9][a-zA-Z0-9_.:-]{0,127}$/.test(a.id)||r.has(a.id))throw new TypeError("批量行 ID 应唯一且为安全标识");if(!a.params||Array.isArray(a.params)||typeof a.params!="object"||Object.values(a.params).some(i=>typeof i!="string"))throw new TypeError("批量参数应为字符串字典");r.add(a.id)}return n}function z(e,t){if(!t)return;const n={completed:0,total:e.length,failed:0,cancelled:0};for(const r of e)r&&(n.completed++,r.status==="failed"&&n.failed++,r.status==="cancelled"&&n.cancelled++);try{t(n)}catch{}}async function k(e,t,n={}){const r=n.concurrency??2;if(!Number.isSafeInteger(r)||r<1||r>16)throw new RangeError("批量并发应为 1–16");if(n.failure!==void 0&&n.failure!=="continue"&&n.failure!=="stop")throw new TypeError("批量失败策略无效");const a=q(e,n.maxCases??100);if(!a.length)throw new RangeError("批量生成至少需要一组参数");const i=Array.from({length:a.length}),y=new AbortController,b=()=>y.abort(n.signal?.reason);n.signal?.addEventListener("abort",b,{once:!0}),n.signal?.aborted&&b();let w=0,s=!1;async function u(){for(;w<a.length;){const o=w++,h=a[o],l={id:h.id,index:o};if(s||y.signal.aborted)i[o]={...l,status:"cancelled"};else try{v.throwIfAborted(y.signal);const f=await t(h,{index:o,signal:y.signal});i[o]={...l,status:"completed",value:f}}catch(f){y.signal.aborted?i[o]={...l,status:"cancelled"}:(i[o]={...l,status:"failed",error:{name:f instanceof Error?f.name:"Error",message:f instanceof Error?f.message:String(f)}},n.failure==="stop"&&(s=!0))}z(i,n.onProgress)}}try{await Promise.all(Array.from({length:Math.min(r,a.length)},u))}finally{n.signal?.removeEventListener("abort",b)}return i}exports.ReportJobError=c;exports.checkJobIdentity=J;exports.cloneJob=m;exports.createMemoryReportJobStore=C;exports.jobByteLength=g;exports.jobRequestHash=R;exports.runReportBatch=k;exports.runnableJob=O;exports.serializeJobJson=d;exports.snapshotReportBatchCases=q;exports.validateJobRecord=N;exports.validateJobTransition=B;
|
package/dist/codes.d.cts
CHANGED
|
@@ -110,6 +110,8 @@ export declare function createCodeAssetRenderers(options?: CodeImageOptions): {
|
|
|
110
110
|
};
|
|
111
111
|
|
|
112
112
|
declare interface GridCell {
|
|
113
|
+
/** Styled cell content; text remains a plain-text fallback. Imported rich cells are read-only. */
|
|
114
|
+
richParagraphs?: RichParagraph[];
|
|
113
115
|
text?: string;
|
|
114
116
|
rawText?: string;
|
|
115
117
|
/** 原始值,仅供 Excel raw 模式消费;不参与预览、分页与 PDF 绘制。 */
|
package/dist/codes.d.ts
CHANGED
|
@@ -110,6 +110,8 @@ export declare function createCodeAssetRenderers(options?: CodeImageOptions): {
|
|
|
110
110
|
};
|
|
111
111
|
|
|
112
112
|
declare interface GridCell {
|
|
113
|
+
/** Styled cell content; text remains a plain-text fallback. Imported rich cells are read-only. */
|
|
114
|
+
richParagraphs?: RichParagraph[];
|
|
113
115
|
text?: string;
|
|
114
116
|
rawText?: string;
|
|
115
117
|
/** 原始值,仅供 Excel raw 模式消费;不参与预览、分页与 PDF 绘制。 */
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { S as A } from "./style-67OqfNed.js";
|
|
2
|
+
const l = A;
|
|
3
|
+
function k(e) {
|
|
4
|
+
return (e.kind === "image" || e.kind === "barcode" || e.kind === "qrcode" || e.kind === "chart") && !!e.imageData;
|
|
5
|
+
}
|
|
6
|
+
function E(e) {
|
|
7
|
+
return e.kind === "text" && Array.isArray(e.richParagraphs) && e.richParagraphs.length > 0;
|
|
8
|
+
}
|
|
9
|
+
function o(e) {
|
|
10
|
+
return !!e && typeof e == "object";
|
|
11
|
+
}
|
|
12
|
+
function d(e, r, s, n, i) {
|
|
13
|
+
if (++i.nodes > 1e6) return { path: r, message: "组件树超过100万个结构节点预算" };
|
|
14
|
+
if (o(e)) {
|
|
15
|
+
if (s > 64) return { path: r, message: "组件嵌套超过64层预算" };
|
|
16
|
+
if (n.has(e)) return { path: r, message: "组件树包含循环引用" };
|
|
17
|
+
if (!(!o(e.grid) || !Array.isArray(e.grid.cells))) {
|
|
18
|
+
n.add(e);
|
|
19
|
+
try {
|
|
20
|
+
for (const [t, f] of e.grid.cells.entries())
|
|
21
|
+
if (Array.isArray(f))
|
|
22
|
+
for (const [u, c] of f.entries()) {
|
|
23
|
+
if (++i.nodes > 1e6) return { path: r, message: "组件树超过100万个结构节点预算" };
|
|
24
|
+
if (!(!o(c) || !Array.isArray(c.children)))
|
|
25
|
+
for (const [g, y] of c.children.entries()) {
|
|
26
|
+
const a = d(y, `${r}.grid.cells.${t}.${u}.children.${g}`, s + 1, n, i);
|
|
27
|
+
if (a) return a;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
} finally {
|
|
31
|
+
n.delete(e);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function m(e, r = "$.components", s = { nodes: 0 }) {
|
|
37
|
+
for (const [n, i] of e.entries()) {
|
|
38
|
+
const t = d(i, `${r}.${n}`, 0, /* @__PURE__ */ new Set(), s);
|
|
39
|
+
if (t) return t;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function $(e) {
|
|
43
|
+
const r = { nodes: 0 };
|
|
44
|
+
for (const [s, n] of e.entries()) {
|
|
45
|
+
if (!o(n) || !Array.isArray(n.components)) continue;
|
|
46
|
+
const i = m(n.components, `$.pages.${s}.components`, r);
|
|
47
|
+
if (i) return i;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function R(e) {
|
|
51
|
+
const r = $(e.pages);
|
|
52
|
+
if (r) throw new TypeError(`${r.path}: ${r.message}`);
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
l as R,
|
|
56
|
+
E as a,
|
|
57
|
+
R as b,
|
|
58
|
+
m as c,
|
|
59
|
+
k as i,
|
|
60
|
+
$ as r
|
|
61
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const E=require("./style-C22Pbv3T.cjs"),R=E.SCHEMA_VERSION_MACH;function $(e){return(e.kind==="image"||e.kind==="barcode"||e.kind==="qrcode"||e.kind==="chart")&&!!e.imageData}function h(e){return e.kind==="text"&&Array.isArray(e.richParagraphs)&&e.richParagraphs.length>0}function o(e){return!!e&&typeof e=="object"}function a(e,r,s,n,i){if(++i.nodes>1e6)return{path:r,message:"组件树超过100万个结构节点预算"};if(o(e)){if(s>64)return{path:r,message:"组件嵌套超过64层预算"};if(n.has(e))return{path:r,message:"组件树包含循环引用"};if(!(!o(e.grid)||!Array.isArray(e.grid.cells))){n.add(e);try{for(const[t,d]of e.grid.cells.entries())if(Array.isArray(d))for(const[A,c]of d.entries()){if(++i.nodes>1e6)return{path:r,message:"组件树超过100万个结构节点预算"};if(!(!o(c)||!Array.isArray(c.children)))for(const[y,m]of c.children.entries()){const f=a(m,`${r}.grid.cells.${t}.${A}.children.${y}`,s+1,n,i);if(f)return f}}}finally{n.delete(e)}}}}function u(e,r="$.components",s={nodes:0}){for(const[n,i]of e.entries()){const t=a(i,`${r}.${n}`,0,new Set,s);if(t)return t}}function g(e){const r={nodes:0};for(const[s,n]of e.entries()){if(!o(n)||!Array.isArray(n.components))continue;const i=u(n.components,`$.pages.${s}.components`,r);if(i)return i}}function l(e){const r=g(e.pages);if(r)throw new TypeError(`${r.path}: ${r.message}`)}exports.RENDER_PLAN_SCHEMA_VERSION=R;exports.assertBoundedRenderTree=l;exports.componentTreeIssue=u;exports.isImageBackedComponent=$;exports.isRichText=h;exports.renderTreeIssue=g;
|