@agile-team/mach-report 2.25.0 → 2.25.2
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 +6 -2
- package/dist/{ExcelBindingWizard-NQ_v396s.js → ExcelBindingWizard-bs3F4dD8.js} +3 -3
- package/dist/{ExcelBindingWizard-BgJG-T6k.cjs → ExcelBindingWizard-jSdjBtWw.cjs} +1 -1
- package/dist/{ParamEditor-Z-3yodp5.js → ParamEditor-B7YVD28E.js} +1 -1
- package/dist/{ParamEditor-DEP38mBp.cjs → ParamEditor-CGfaweYX.cjs} +1 -1
- package/dist/{ReportBatchPanel-D33LjMrA.cjs → ReportBatchPanel-BRJt0TXp.cjs} +1 -1
- package/dist/{ReportBatchPanel-DG8FV-5X.js → ReportBatchPanel-BTKHtLTW.js} +1 -1
- package/dist/{ReportLabelStudio-Bz-xAayk.cjs → ReportLabelStudio-BvK_WBke.cjs} +1 -1
- package/dist/{ReportLabelStudio-BZp23_hA.js → ReportLabelStudio-CZwqyO3t.js} +2 -2
- package/dist/ReportPreview-D1ZC5kzz.js +7317 -0
- package/dist/ReportPreview-DAU-V3Ov.cjs +6 -0
- package/dist/{ReportTemplateLibrary-DpSGgvFa.js → ReportTemplateLibrary-C7sB0Jay.js} +1 -1
- package/dist/{ReportTemplateLibrary-uG1gENaW.cjs → ReportTemplateLibrary-ClwxhnC0.cjs} +1 -1
- package/dist/{RuleEditor-BONALh1Q.js → RuleEditor-CsDGFaWz.js} +3 -3
- package/dist/{RuleEditor-bLXiRcxL.cjs → RuleEditor-D-OdaGdR.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-JGBKeF3e.js → TemplateOutlinePanel-CXOT7d1r.js} +1 -1
- package/dist/{TemplateOutlinePanel-C3nfHuaR.cjs → TemplateOutlinePanel-DAqR9zQi.cjs} +1 -1
- package/dist/{TemplateReusePanel-DXQUO6nQ.js → TemplateReusePanel-Dcfx3Hba.js} +2 -2
- package/dist/{TemplateReusePanel-BKhgp6kg.cjs → TemplateReusePanel-ygIi-Ajz.cjs} +1 -1
- package/dist/{TemplateReviewPanel-DhL7Hapy.js → TemplateReviewPanel-COU8FqPq.js} +1 -1
- package/dist/{TemplateReviewPanel-5RWFUUEf.cjs → TemplateReviewPanel-DyGULVxr.cjs} +1 -1
- package/dist/analytics.cjs +1 -1
- package/dist/analytics.js +2 -2
- package/dist/artifact-integrity.json +71 -71
- package/dist/{auto-D-eDZa_V.cjs → auto-DjmvmcX-.cjs} +1 -1
- package/dist/{auto-umW_ozwr.js → auto-j7mr8Kvc.js} +82 -82
- package/dist/{designer-CCyj5WYS.js → designer-B597ZdC0.js} +4 -4
- package/dist/{designer-Cj7fn4Hh.cjs → designer-DFIdv_n7.cjs} +1 -1
- package/dist/designer.cjs +1 -1
- package/dist/designer.js +1 -1
- package/dist/{encoding-CEkBtlUP.js → encoding-BWEMdzFG.js} +2 -2
- package/dist/{encoding-Cipno7dq.cjs → encoding-DVea2qIR.cjs} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -8
- package/dist/{json-snapshot-x0JpllWL.js → json-snapshot-DdzALe8q.js} +995 -911
- package/dist/json-snapshot-L_gJ7KRS.cjs +2 -0
- package/dist/matrix-DUYPRL7t.cjs +1 -0
- package/dist/{matrix-C6e_r_vp.js → matrix-b6T291xo.js} +120 -104
- package/dist/{plugin-B_k23hut.cjs → plugin-D5BRHlne.cjs} +1 -1
- package/dist/{plugin-CttO46hc.js → plugin-FWhTnjr0.js} +1 -1
- package/dist/{prefill-BvkuwooY.cjs → prefill-DZymomY6.cjs} +1 -1
- package/dist/{prefill-BkF9Fw_p.js → prefill-m01IM1hl.js} +1 -1
- package/dist/{prepared-CSywIEAZ.cjs → prepared-BHu8bIdj.cjs} +1 -1
- package/dist/{prepared-Cyuh61fJ.js → prepared-DO5pe6Ed.js} +1 -1
- package/dist/{protocol-DwtxjXzO.js → protocol-CZddmu2n.js} +2 -2
- package/dist/{protocol-BwbJNVZl.cjs → protocol-CymmHWmL.cjs} +1 -1
- package/dist/{region-binding-workflow-D8I4QWRh.js → region-binding-workflow-EYxvUYJ-.js} +1 -1
- package/dist/{region-binding-workflow-COD8nISZ.cjs → region-binding-workflow-NdkMSFCh.cjs} +1 -1
- package/dist/report-encoding-worker.cjs +1 -1
- package/dist/report-encoding-worker.js +1 -1
- package/dist/{runtime-BE30icyB.js → runtime-D8AlfJ6S.js} +83 -76
- package/dist/runtime-ywf3oLBR.cjs +1 -0
- package/dist/sbom.cdx.json +1 -1
- package/dist/server-node.cjs +5 -5
- package/dist/server-node.js +1880 -1773
- package/dist/server.cjs +1 -1
- package/dist/server.js +6 -6
- package/dist/{template-catalog-D_gl93va.js → template-catalog-DLu814zA.js} +2 -2
- package/dist/{template-catalog-C0riwrx7.cjs → template-catalog-Lil5Ryt-.cjs} +1 -1
- package/dist/{template-fragments-D94ZZmPc.js → template-fragments-BDxdCuMD.js} +1 -1
- package/dist/{template-fragments-CgzPdFKB.cjs → template-fragments-DbKdxI1z.cjs} +1 -1
- package/dist/template-registry-B-AK1oam.cjs +1 -0
- package/dist/{template-registry-DZOtRY7t.js → template-registry-DeVgwEZj.js} +143 -142
- package/dist/vue/index.d.cts +2 -1
- package/dist/vue/index.d.ts +2 -1
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +127 -126
- package/dist/{workbook-session-SzfILBJJ.js → workbook-session-B6hRjTyX.js} +1 -1
- package/dist/{workbook-session-DR2j6Hxm.cjs → workbook-session-BclW7KKH.cjs} +1 -1
- package/dist/worker.cjs +1 -1
- package/dist/worker.js +4 -4
- package/dist/xlsx.cjs +1 -1
- package/dist/xlsx.js +3 -3
- package/package.json +1 -1
- package/dist/ReportPreview-CilFAS9U.js +0 -7170
- package/dist/ReportPreview-dOOzPts2.cjs +0 -6
- package/dist/json-snapshot-DQdkA_At.cjs +0 -2
- package/dist/matrix-B8QWbsGM.cjs +0 -1
- package/dist/runtime-DRSuy_SQ.cjs +0 -1
- package/dist/template-registry-BMScUmM4.cjs +0 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { G as Q, x as X } from "./diagnostic-collector-gB07PHy2.js";
|
|
2
|
-
import { d as
|
|
3
|
-
import { Q as S, R as h, v as
|
|
2
|
+
import { d as tt, m as T, e as et, f as st, b as at, s as M, a as A, g as rt, h as ot, i as nt, r as it } from "./prepared-DO5pe6Ed.js";
|
|
3
|
+
import { Q as S, R as h, v as ct, S as dt, N as O, H as k, n as mt, J as ft, M as pt, o as gt } from "./json-snapshot-DdzALe8q.js";
|
|
4
4
|
import { g as $ } from "./report-params-D9tBuM9B.js";
|
|
5
|
-
import { l as N, r as
|
|
6
|
-
import { t as P, b as x, D as
|
|
7
|
-
import { b as z } from "./template-registry-
|
|
8
|
-
import { T as
|
|
5
|
+
import { l as N, r as lt, R as ut } from "./param-validation-CnDEd2l-.js";
|
|
6
|
+
import { t as P, b as x, D as xt, v as yt, c as B, R as D } from "./sha256-BDQ1Qk7A.js";
|
|
7
|
+
import { b as z } from "./template-registry-DeVgwEZj.js";
|
|
8
|
+
import { T as wt } from "./template-serialization-CWmHq7lX.js";
|
|
9
9
|
import { r as _ } from "./assets-C4MIvzQ4.js";
|
|
10
|
-
import { f as
|
|
11
|
-
function
|
|
10
|
+
import { f as ht, P as vt, e as bt } from "./record-bindings-Cv7lFiof.js";
|
|
11
|
+
function Pt(t) {
|
|
12
12
|
let e = `$.pages.${t.pageIndex}`;
|
|
13
13
|
if (t.componentIndex < 0) return e;
|
|
14
14
|
e += `.components.${t.componentIndex}`;
|
|
@@ -17,39 +17,39 @@ function bt(t) {
|
|
|
17
17
|
e += `.grid.cells.${a[i]}.${a[i + 1]}`, a[i + 2] !== void 0 && (e += `.children.${a[i + 2]}`);
|
|
18
18
|
return e;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
return t.map((e) => ({ ...e, path:
|
|
20
|
+
function E(t = []) {
|
|
21
|
+
return t.map((e) => ({ ...e, path: Pt(e) }));
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function Rt(t, e) {
|
|
24
24
|
const a = X(e ?? (t.diagnosticSummary ? Q : void 0));
|
|
25
25
|
return t.diagnosticSummary ? a.merge(t.diagnosticSummary) : t.diagnostics.forEach((i) => a.push(i)), a;
|
|
26
26
|
}
|
|
27
27
|
function J(t, e) {
|
|
28
|
-
e.diagnosticSummary ? t.merge({ ...e.diagnosticSummary, entries:
|
|
28
|
+
e.diagnosticSummary ? t.merge({ ...e.diagnosticSummary, entries: E(e.diagnosticSummary.entries) }) : E(e.diagnostics).forEach((a) => t.push(a));
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function St(t) {
|
|
31
31
|
const e = t.prepared.diagnosticSummary?.counts, a = e ? !!(e["asset-render-failed"] || e["asset-budget-exceeded"]) : t.prepared.diagnostics.some((i) => i.code === "asset-render-failed" || i.code === "asset-budget-exceeded");
|
|
32
32
|
if (t.fidelity === "strict" && a) throw new h("validate", "严格输出拒绝已有资产渲染降级,请修复组件后重新准备报表。");
|
|
33
33
|
}
|
|
34
34
|
async function U(t, e, a = Date.now()) {
|
|
35
35
|
const i = t.prepared;
|
|
36
|
-
|
|
37
|
-
const s =
|
|
36
|
+
tt(t, e), St(t);
|
|
37
|
+
const s = Rt(i, t.diagnosticLimit), r = t.format === "pdf" ? await import("@agile-team/mach-report/pdf") : void 0;
|
|
38
38
|
P(t.signal);
|
|
39
|
-
const m = t.pdf?.customFontFaces ?? (t.pdf?.customFontBytes ? { regular: t.pdf.customFontBytes } : void 0),
|
|
40
|
-
let
|
|
39
|
+
const m = t.pdf?.customFontFaces ?? (t.pdf?.customFontBytes ? { regular: t.pdf.customFontBytes } : void 0), p = r && m ? r.createFontBytesMeasurer(m) : void 0, d = S(t), n = await d.run("encode", async () => {
|
|
40
|
+
let f;
|
|
41
41
|
const w = { fidelity: t.fidelity, diagnosticLimit: t.diagnosticLimit ?? (i.diagnosticSummary ? Q : void 0), signal: t.signal, onProgress: (o, u) => d.progress("encode", o, u) };
|
|
42
42
|
if (t.format === "pdf") {
|
|
43
43
|
P(t.signal);
|
|
44
|
-
const o = await r.renderPlanToPdf(i.plan, { ...t.pdf, ...
|
|
45
|
-
|
|
44
|
+
const o = await r.renderPlanToPdf(i.plan, { ...t.pdf, ...p ? { measurer: p } : {}, ...w });
|
|
45
|
+
f = o.bytes, J(s, o), T(s, "pdf-fidelity", o.fidelityWarnings, "warning", o.fidelityWarningCount), T(s, "pdf-page", o.pageErrors, "error", o.pageErrorCount), o.unsupportedTextCount && s.push({ code: "pdf-font", message: `${o.unsupportedTextCount} 段文本包含当前字体不支持的字符`, severity: "warning" });
|
|
46
46
|
} else {
|
|
47
47
|
const { renderPlanToXlsx: o } = await import("@agile-team/mach-report/xlsx");
|
|
48
48
|
P(t.signal);
|
|
49
49
|
const u = await o(i.plan, { ...t.xlsx, ...w });
|
|
50
|
-
|
|
50
|
+
f = new Uint8Array(u.buffer), J(s, u), T(s, "xlsx-fidelity", u.warnings, "warning", u.warningCount), u.notes?.forEach((R) => s.push({ code: "xlsx-snapshot", message: R, severity: "info" }));
|
|
51
51
|
}
|
|
52
|
-
return P(t.signal),
|
|
52
|
+
return P(t.signal), f;
|
|
53
53
|
});
|
|
54
54
|
x(e, "maxOutputBytes", n.byteLength);
|
|
55
55
|
const { plan: y, ...l } = i;
|
|
@@ -63,35 +63,41 @@ async function U(t, e, a = Date.now()) {
|
|
|
63
63
|
stats: { ...l.stats, durationMs: Date.now() - a, outputBytes: n.byteLength }
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function C(t) {
|
|
67
67
|
return !!t && typeof t == "object" && !Array.isArray(t);
|
|
68
68
|
}
|
|
69
|
-
function
|
|
70
|
-
return
|
|
69
|
+
function Et(t) {
|
|
70
|
+
return C(t) ? ["rows", "pages", "cells"].every((e) => typeof t[e] == "number" && Number.isSafeInteger(t[e]) && t[e] >= 0) && typeof t.durationMs == "number" && Number.isFinite(t.durationMs) && t.durationMs >= 0 : !1;
|
|
71
71
|
}
|
|
72
72
|
function Ct(t) {
|
|
73
|
-
return Array.isArray(t) && t.every((e) =>
|
|
74
|
-
}
|
|
75
|
-
function Et(t) {
|
|
76
|
-
return E(t) && Object.values(t).every((e) => E(e) && (e.revision === void 0 || typeof e.revision == "string") && (e.sourceToken === void 0 || typeof e.sourceToken == "string"));
|
|
73
|
+
return Array.isArray(t) && t.every((e) => C(e) && typeof e.code == "string" && typeof e.message == "string" && ["info", "warning", "error"].includes(e.severity) && ct(e) && at(e));
|
|
77
74
|
}
|
|
78
75
|
function It(t) {
|
|
79
|
-
return
|
|
76
|
+
return C(t) && Object.values(t).every((e) => C(e) && (e.revision === void 0 || typeof e.revision == "string") && (e.sourceToken === void 0 || typeof e.sourceToken == "string"));
|
|
80
77
|
}
|
|
81
|
-
function Dt(t
|
|
82
|
-
|
|
78
|
+
function Dt(t) {
|
|
79
|
+
return t === void 0 ? !0 : C(t) && ["heuristic", "provided", "font-bytes"].includes(t.textMetrics) && (t.fontFingerprint === void 0 || typeof t.fontFingerprint == "string" && /^[a-f0-9]{64}$/.test(t.fontFingerprint));
|
|
80
|
+
}
|
|
81
|
+
function H(t) {
|
|
82
|
+
return !C(t) || !Et(t.stats) || !Ct(t.diagnostics) || !It(t.revisions) || !Dt(t.layout) || !et(t.sources) ? !1 : t.diagnosticSummary === void 0 || st(t.diagnosticSummary, t.diagnostics);
|
|
83
|
+
}
|
|
84
|
+
function Lt(t) {
|
|
85
|
+
if (!H(t)) throw new h("validate", "报表执行器返回的准备结果元数据无效");
|
|
86
|
+
}
|
|
87
|
+
function Ft(t, e) {
|
|
88
|
+
if (!H(t)) return !1;
|
|
83
89
|
if (e === "prepare") return z(t.plan).ok;
|
|
84
90
|
const a = t.format === "pdf" ? "application/pdf" : "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
85
91
|
return t.bytes instanceof Uint8Array && (t.format === "pdf" || t.format === "xlsx") && t.contentType === a;
|
|
86
92
|
}
|
|
87
93
|
function V(t, e) {
|
|
88
|
-
if (!
|
|
94
|
+
if (!Ft(t, "export") || !("format" in t) || t.format !== e)
|
|
89
95
|
throw new h("validate", "报表执行器返回的导出结果与请求格式不一致或元数据无效");
|
|
90
96
|
}
|
|
91
97
|
function q(t) {
|
|
92
98
|
return { ...t, reportIds: [...t.reportIds], ...t.params ? { params: { ...t.params } } : {} };
|
|
93
99
|
}
|
|
94
|
-
function
|
|
100
|
+
function K(t, e) {
|
|
95
101
|
if (e.length === 0) throw new h("config", "缺少报表 ID");
|
|
96
102
|
return e.map((a) => {
|
|
97
103
|
if (!Object.prototype.hasOwnProperty.call(t, a)) throw new h("config", `未注册报表 ${a}`);
|
|
@@ -101,17 +107,17 @@ function H(t, e) {
|
|
|
101
107
|
function L(t) {
|
|
102
108
|
return t.grid?.cells.reduce((e, a) => e + a.reduce((i, s) => i + (s ? 1 + (s.children?.reduce((r, m) => r + L(m), 0) ?? 0) : 0), 0), 0) ?? 0;
|
|
103
109
|
}
|
|
104
|
-
function
|
|
105
|
-
return t.pages.reduce((i, s) => i + s.components.reduce((r, m) => m.kind !== "list" ? r + L(m) : r +
|
|
110
|
+
function Tt(t, e, a) {
|
|
111
|
+
return t.pages.reduce((i, s) => i + s.components.reduce((r, m) => m.kind !== "list" ? r + L(m) : r + gt(m, e, a), 0), 0);
|
|
106
112
|
}
|
|
107
|
-
function
|
|
108
|
-
return
|
|
113
|
+
function Mt(t, e = Object.keys(t)) {
|
|
114
|
+
return K(t, e).map((a, i) => {
|
|
109
115
|
const s = e[i], r = $(t, [s]);
|
|
110
116
|
return {
|
|
111
117
|
id: s,
|
|
112
118
|
params: JSON.parse(JSON.stringify(r)),
|
|
113
|
-
paramsSchema:
|
|
114
|
-
datasetsSchema: Object.fromEntries(Object.entries(a.dataSchema ?? {}).map(([m,
|
|
119
|
+
paramsSchema: lt(r),
|
|
120
|
+
datasetsSchema: Object.fromEntries(Object.entries(a.dataSchema ?? {}).map(([m, p]) => [m, dt(typeof a.template == "function" ? void 0 : a.template, m, p)])),
|
|
115
121
|
capabilities: {
|
|
116
122
|
save: !!a.provider?.save,
|
|
117
123
|
export: !!a.provider?.export,
|
|
@@ -120,28 +126,28 @@ function Ft(t, e = Object.keys(t)) {
|
|
|
120
126
|
};
|
|
121
127
|
});
|
|
122
128
|
}
|
|
123
|
-
function
|
|
124
|
-
|
|
129
|
+
function Y(t, e) {
|
|
130
|
+
K(t, e.reportIds);
|
|
125
131
|
const a = N($(t, e.reportIds), e.params), i = e.reportIds.flatMap((r) => N($(t, [r]), e.params).issues), s = new Map(i.map((r) => [JSON.stringify(r), r]));
|
|
126
132
|
return { ...a, ok: s.size === 0, issues: [...s.values()] };
|
|
127
133
|
}
|
|
128
134
|
function G(t, e) {
|
|
129
135
|
const a = z(t.plan);
|
|
130
136
|
if (!a.ok) throw new h("validate", `执行器返回无效计划:${a.errors[0]?.path}`);
|
|
131
|
-
const i = t.plan.pages.length, s = t.plan.pages.reduce((r, m) => r + m.components.reduce((
|
|
137
|
+
const i = t.plan.pages.length, s = t.plan.pages.reduce((r, m) => r + m.components.reduce((p, d) => p + L(d), 0), 0);
|
|
132
138
|
return x(e, "maxRows", t.stats.rows), x(e, "maxPages", i), x(e, "maxCells", s), { ...t, stats: { ...t.stats, pages: i, cells: s } };
|
|
133
139
|
}
|
|
134
140
|
function W(t, e) {
|
|
135
|
-
const a =
|
|
136
|
-
if (!a.ok) throw new
|
|
141
|
+
const a = Y(t.reports, e);
|
|
142
|
+
if (!a.ok) throw new ut(a.issues);
|
|
137
143
|
}
|
|
138
|
-
function
|
|
139
|
-
const e = { ...
|
|
140
|
-
|
|
144
|
+
function Vt(t) {
|
|
145
|
+
const e = { ...xt, ...t.budget };
|
|
146
|
+
yt(e);
|
|
141
147
|
const a = async (s, r) => {
|
|
142
148
|
const m = Date.now();
|
|
143
|
-
let
|
|
144
|
-
const n = X(s.diagnosticLimit), y = {}, l = [],
|
|
149
|
+
let p = 0, d = 0;
|
|
150
|
+
const n = X(s.diagnosticLimit), y = {}, l = [], f = Object.fromEntries(Object.entries(t.reports).map(([c, g]) => [c, {
|
|
145
151
|
...g,
|
|
146
152
|
pagination: { ...t.pagination, ...g.pagination, ...r ? { measurer: r } : {} },
|
|
147
153
|
dataValidation: {
|
|
@@ -149,13 +155,13 @@ function Jt(t) {
|
|
|
149
155
|
maxRows: Math.min(e.maxRows ?? 1e5, g.dataValidation?.maxRows ?? 1 / 0),
|
|
150
156
|
maxCells: Math.min(e.maxCells ?? 2e6, g.dataValidation?.maxCells ?? 1 / 0)
|
|
151
157
|
}
|
|
152
|
-
}])), o = await
|
|
158
|
+
}])), o = await mt(f, { maxPages: e.maxPages, maxCells: e.maxCells, maxChartComponents: e.maxChartComponents, onDatasets: (c, g, v) => {
|
|
153
159
|
try {
|
|
154
|
-
|
|
160
|
+
p += ft(v, g, { maxRows: e.maxRows, signal: s.signal });
|
|
155
161
|
} catch (b) {
|
|
156
|
-
throw b instanceof
|
|
162
|
+
throw b instanceof wt ? new D("budget", b.message, "$.budget.maxRows") : b;
|
|
157
163
|
}
|
|
158
|
-
x(e, "maxRows",
|
|
164
|
+
x(e, "maxRows", p), d += Tt(v, g, f[c]?.pagination), x(e, "maxCells", d);
|
|
159
165
|
} })({ ...s, params: s.params ?? {}, onWarning: (c) => n.push({ code: "layout", message: c, severity: "warning" }), onQueryResult: (c, g, v = 0) => {
|
|
160
166
|
const b = pt(v, c);
|
|
161
167
|
Object.defineProperty(y, c, { value: { revision: g.revision, sourceToken: g.sourceToken }, enumerable: !0, writable: !0 }), l.push({ reportId: c, reportIndex: v, reportScope: b, ...g.revision === void 0 ? {} : { revision: g.revision }, ...g.sourceToken === void 0 ? {} : { sourceToken: g.sourceToken } }), (g.diagnostics ?? []).forEach((I) => n.push({ ...I, ...I.target ? { target: {
|
|
@@ -164,64 +170,65 @@ function Jt(t) {
|
|
|
164
170
|
...I.target.tableId ? { tableId: JSON.stringify([v, c, I.target.tableId]) } : {}
|
|
165
171
|
} } : {} }));
|
|
166
172
|
} }).catch((c) => {
|
|
167
|
-
throw c instanceof h && c.cause instanceof
|
|
173
|
+
throw c instanceof h && c.cause instanceof ht ? new D("budget", c.cause.message, "$.budget.maxPages") : c instanceof h && c.cause instanceof vt ? new D("budget", c.cause.message, "$.budget.maxCells") : c instanceof h && c.cause instanceof bt ? new D("budget", c.cause.message, "$.budget.maxChartComponents") : c;
|
|
168
174
|
});
|
|
169
175
|
P(s.signal);
|
|
170
176
|
const u = t.assets ? await S(s).run("assets", () => _(o, { ...t.assets, diagnosticLimit: s.diagnosticLimit, signal: s.signal })) : { plan: o, diagnostics: [] }, R = u.plan;
|
|
171
|
-
u.diagnosticSummary ? n.merge({ ...u.diagnosticSummary, entries:
|
|
177
|
+
u.diagnosticSummary ? n.merge({ ...u.diagnosticSummary, entries: E(u.diagnosticSummary.entries) }) : E(u.diagnostics).forEach((c) => n.push(c));
|
|
172
178
|
const j = R.pages.reduce((c, g) => c + g.components.reduce((v, b) => v + L(b), 0), 0);
|
|
173
179
|
x(e, "maxPages", R.pages.length), x(e, "maxCells", j);
|
|
174
|
-
const F =
|
|
175
|
-
return { plan: R, diagnostics: n.entries, ...s.diagnosticLimit === void 0 ? {} : { diagnosticSummary: n.snapshot() }, revisions: y, sources: l, layout: { textMetrics: F ? "font-bytes" :
|
|
180
|
+
const F = it(s.pdf), Z = t.pagination?.measurer || Object.values(t.reports).some((c) => c.pagination?.measurer);
|
|
181
|
+
return { plan: R, diagnostics: n.entries, ...s.diagnosticLimit === void 0 ? {} : { diagnosticSummary: n.snapshot() }, revisions: y, sources: l, layout: { textMetrics: F ? "font-bytes" : Z ? "provided" : "heuristic", ...F ? { fontFingerprint: F } : {} }, stats: { rows: p, pages: R.pages.length, cells: j, durationMs: Date.now() - m } };
|
|
176
182
|
}, i = async (s) => {
|
|
177
183
|
const r = Date.now();
|
|
178
184
|
if (s.format !== "pdf" && s.format !== "xlsx") throw new h("config", "不支持的报表导出格式");
|
|
179
185
|
const m = s.format === "pdf" ? await import("@agile-team/mach-report/pdf") : void 0;
|
|
180
186
|
P(s.signal);
|
|
181
|
-
const
|
|
187
|
+
const p = s.pdf?.customFontFaces ?? (s.pdf?.customFontBytes ? { regular: s.pdf.customFontBytes } : void 0), d = m && p ? m.createFontBytesMeasurer(p) : void 0, n = await a(s, d);
|
|
182
188
|
return P(s.signal), U({ ...s, prepared: n }, e, r);
|
|
183
189
|
};
|
|
184
190
|
return {
|
|
185
|
-
describe: (s) =>
|
|
186
|
-
validate: (s) =>
|
|
191
|
+
describe: (s) => Mt(t.reports, s),
|
|
192
|
+
validate: (s) => Y(t.reports, s),
|
|
187
193
|
prepare: (s) => B(s.signal, e.maxDurationMs, async (r) => {
|
|
188
|
-
const { signal: m, onEvent:
|
|
194
|
+
const { signal: m, onEvent: p, ...d } = q(s), n = { ...d, ...d.pdf ? { pdf: M(d.pdf) } : {}, taskId: d.taskId ?? O() }, y = p ? (u) => k(p, u, r) : void 0, l = { ...n, signal: r, onEvent: y };
|
|
189
195
|
S(l).runSync("validate", () => W(t, n));
|
|
190
|
-
let
|
|
196
|
+
let f;
|
|
191
197
|
const w = n.pdf?.customFontFaces ?? (n.pdf?.customFontBytes ? { regular: n.pdf.customFontBytes } : void 0);
|
|
192
198
|
if (!t.executor && w) {
|
|
193
199
|
const u = await import("@agile-team/mach-report/pdf");
|
|
194
|
-
P(r),
|
|
200
|
+
P(r), f = u.createFontBytesMeasurer(w);
|
|
195
201
|
}
|
|
196
|
-
const o = t.executor ? await t.executor.prepare(n, r, y) : await a(l,
|
|
197
|
-
return G(o, e);
|
|
202
|
+
const o = t.executor ? await t.executor.prepare(n, r, y) : await a(l, f);
|
|
203
|
+
return t.executor && Lt(o), G(o, e);
|
|
198
204
|
}),
|
|
199
205
|
exportPrepared: (s) => B(s.signal, e.maxDurationMs, async (r) => {
|
|
200
|
-
const m = Date.now(), { signal:
|
|
206
|
+
const m = Date.now(), { signal: p, onEvent: d, ...n } = s, y = G(rt(s.prepared, e.maxPreparedBytes ?? 64e6, r), e), l = { ...n, xlsx: A(n.xlsx), prepared: y, ...n.pdf ? { pdf: M(n.pdf) } : {}, taskId: n.taskId ?? O() };
|
|
201
207
|
if (l.format !== "pdf" && l.format !== "xlsx") throw new h("config", "不支持的报表导出格式");
|
|
202
|
-
const
|
|
208
|
+
const f = d ? (o) => k(d, o, r) : void 0;
|
|
203
209
|
if (t.executor) {
|
|
204
210
|
if (!t.executor.exportPrepared) throw new h("config", "执行器未实现 exportPrepared;请升级执行器或显式使用本地运行时");
|
|
205
|
-
const o = await t.executor.exportPrepared(l, r,
|
|
211
|
+
const o = await t.executor.exportPrepared(l, r, f);
|
|
206
212
|
return V(o, l.format), x(e, "maxRows", o.stats.rows), x(e, "maxPages", o.stats.pages), x(e, "maxCells", o.stats.cells), x(e, "maxOutputBytes", o.bytes.byteLength), { ...o, stats: { ...o.stats, outputBytes: o.bytes.byteLength } };
|
|
207
213
|
}
|
|
208
|
-
const w = { ...l, signal: r, onEvent:
|
|
209
|
-
if (S(w).runSync("validate", () =>
|
|
214
|
+
const w = { ...l, signal: r, onEvent: f };
|
|
215
|
+
if (S(w).runSync("validate", () => ot(w)), t.assets) {
|
|
210
216
|
const o = await S(w).run("assets", () => _(y.plan, { ...t.assets, diagnosticLimit: s.diagnosticLimit, signal: r }));
|
|
211
|
-
y.plan = o.plan,
|
|
217
|
+
y.plan = o.plan, nt(y, E(o.diagnostics), o.diagnosticSummary ? { ...o.diagnosticSummary, entries: E(o.diagnosticSummary.entries) } : void 0, s.diagnosticLimit);
|
|
212
218
|
}
|
|
213
219
|
return U(w, e, m);
|
|
214
220
|
}),
|
|
215
221
|
export: (s) => B(s.signal, e.maxDurationMs, async (r) => {
|
|
216
|
-
const { signal: m, onEvent:
|
|
222
|
+
const { signal: m, onEvent: p, ...d } = q(s), n = { ...d, xlsx: A(d.xlsx), ...d.pdf ? { pdf: M(d.pdf) } : {}, taskId: d.taskId ?? O() }, y = p ? (w) => k(p, w, r) : void 0, l = { ...n, signal: r, onEvent: y };
|
|
217
223
|
if (S(l).runSync("validate", () => W(t, n)), n.format !== "pdf" && n.format !== "xlsx") throw new h("config", "不支持的报表导出格式");
|
|
218
|
-
const
|
|
219
|
-
return t.executor && V(
|
|
224
|
+
const f = t.executor ? await t.executor.export(n, r, y) : await i(l);
|
|
225
|
+
return t.executor && V(f, n.format), x(e, "maxRows", f.stats.rows), x(e, "maxPages", f.stats.pages), x(e, "maxCells", f.stats.cells), x(e, "maxOutputBytes", f.bytes.byteLength), { ...f, stats: { ...f.stats, outputBytes: f.bytes.byteLength } };
|
|
220
226
|
})
|
|
221
227
|
};
|
|
222
228
|
}
|
|
223
229
|
export {
|
|
224
|
-
|
|
230
|
+
V as a,
|
|
231
|
+
Vt as c,
|
|
225
232
|
G as e,
|
|
226
|
-
|
|
233
|
+
Ft as v
|
|
227
234
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var Q=Object.create;var $=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var Y=Object.getPrototypeOf,Z=Object.prototype.hasOwnProperty;var ee=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of K(t))!Z.call(e,r)&&r!==s&&$(e,r,{get:()=>t[r],enumerable:!(n=H(t,r))||n.enumerable});return e};var T=(e,t,s)=>(s=e!=null?Q(Y(e)):{},ee(t||!e||!e.__esModule?$(s,"default",{value:e,enumerable:!0}):s,e));const B=require("./diagnostic-collector-wASg6Fzs.cjs"),h=require("./prepared-BHu8bIdj.cjs"),d=require("./json-snapshot-L_gJ7KRS.cjs"),L=require("./report-params-VTg8MoCp.cjs"),C=require("./param-validation-C-8sRJLq.cjs"),i=require("./sha256-DgZAKXqI.cjs"),V=require("./template-registry-B-AK1oam.cjs"),te=require("./template-serialization-CqQY4zDg.cjs"),q=require("./assets-BYdpkTIt.cjs"),F=require("./record-bindings-B7djSjNs.cjs");function re(e){let t=`$.pages.${e.pageIndex}`;if(e.componentIndex<0)return t;t+=`.components.${e.componentIndex}`;const s=e.componentPath??[];for(let n=0;n+1<s.length;n+=3)t+=`.grid.cells.${s[n]}.${s[n+1]}`,s[n+2]!==void 0&&(t+=`.children.${s[n+2]}`);return t}function E(e=[]){return e.map(t=>({...t,path:re(t)}))}function se(e,t){const s=B.createDiagnosticCollector(t??(e.diagnosticSummary?B.DEFAULT_DIAGNOSTIC_LIMIT:void 0));return e.diagnosticSummary?s.merge(e.diagnosticSummary):e.diagnostics.forEach(n=>s.push(n)),s}function j(e,t){t.diagnosticSummary?e.merge({...t.diagnosticSummary,entries:E(t.diagnosticSummary.entries)}):E(t.diagnostics).forEach(s=>e.push(s))}function ae(e){const t=e.prepared.diagnosticSummary?.counts,s=t?!!(t["asset-render-failed"]||t["asset-budget-exceeded"]):e.prepared.diagnostics.some(n=>n.code==="asset-render-failed"||n.code==="asset-budget-exceeded");if(e.fidelity==="strict"&&s)throw new d.ReportSourceError("validate","严格输出拒绝已有资产渲染降级,请修复组件后重新准备报表。")}async function _(e,t,s=Date.now()){const n=e.prepared;h.assertPreparedOutputBudget(e,t),ae(e);const r=se(n,e.diagnosticLimit),a=e.format==="pdf"?await import("@agile-team/mach-report/pdf"):void 0;i.throwIfAborted(e.signal);const g=e.pdf?.customFontFaces??(e.pdf?.customFontBytes?{regular:e.pdf.customFontBytes}:void 0),f=a&&g?a.createFontBytesMeasurer(g):void 0,m=d.createReportTaskReporter(e),c=await m.run("encode",async()=>{let u;const R={fidelity:e.fidelity,diagnosticLimit:e.diagnosticLimit??(n.diagnosticSummary?B.DEFAULT_DIAGNOSTIC_LIMIT:void 0),signal:e.signal,onProgress:(o,y)=>m.progress("encode",o,y)};if(e.format==="pdf"){i.throwIfAborted(e.signal);const o=await a.renderPlanToPdf(n.plan,{...e.pdf,...f?{measurer:f}:{},...R});u=o.bytes,j(r,o),h.mergeDiagnosticMessages(r,"pdf-fidelity",o.fidelityWarnings,"warning",o.fidelityWarningCount),h.mergeDiagnosticMessages(r,"pdf-page",o.pageErrors,"error",o.pageErrorCount),o.unsupportedTextCount&&r.push({code:"pdf-font",message:`${o.unsupportedTextCount} 段文本包含当前字体不支持的字符`,severity:"warning"})}else{const{renderPlanToXlsx:o}=await import("@agile-team/mach-report/xlsx");i.throwIfAborted(e.signal);const y=await o(n.plan,{...e.xlsx,...R});u=new Uint8Array(y.buffer),j(r,y),h.mergeDiagnosticMessages(r,"xlsx-fidelity",y.warnings,"warning",y.warningCount),y.notes?.forEach(S=>r.push({code:"xlsx-snapshot",message:S,severity:"info"}))}return i.throwIfAborted(e.signal),u});i.assertBudget(t,"maxOutputBytes",c.byteLength);const{plan:w,...x}=n;return{...x,diagnostics:r.entries,...e.diagnosticLimit===void 0&&!n.diagnosticSummary?{}:{diagnosticSummary:r.snapshot()},bytes:c,format:e.format,contentType:e.format==="pdf"?"application/pdf":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",stats:{...x.stats,durationMs:Date.now()-s,outputBytes:c.byteLength}}}function P(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function oe(e){return P(e)?["rows","pages","cells"].every(t=>typeof e[t]=="number"&&Number.isSafeInteger(e[t])&&e[t]>=0)&&typeof e.durationMs=="number"&&Number.isFinite(e.durationMs)&&e.durationMs>=0:!1}function ne(e){return Array.isArray(e)&&e.every(t=>P(t)&&typeof t.code=="string"&&typeof t.message=="string"&&["info","warning","error"].includes(t.severity)&&d.hasValidDataExplanation(t)&&h.validReportDiagnosticLocation(t))}function ie(e){return P(e)&&Object.values(e).every(t=>P(t)&&(t.revision===void 0||typeof t.revision=="string")&&(t.sourceToken===void 0||typeof t.sourceToken=="string"))}function ce(e){return e===void 0?!0:P(e)&&["heuristic","provided","font-bytes"].includes(e.textMetrics)&&(e.fontFingerprint===void 0||typeof e.fontFingerprint=="string"&&/^[a-f0-9]{64}$/.test(e.fontFingerprint))}function J(e){return!P(e)||!oe(e.stats)||!ne(e.diagnostics)||!ie(e.revisions)||!ce(e.layout)||!h.validPreparedSources(e.sources)?!1:e.diagnosticSummary===void 0||h.matchingDiagnosticSummary(e.diagnosticSummary,e.diagnostics)}function de(e){if(!J(e))throw new d.ReportSourceError("validate","报表执行器返回的准备结果元数据无效")}function G(e,t){if(!J(e))return!1;if(t==="prepare")return V.validateRenderPlan(e.plan).ok;const s=e.format==="pdf"?"application/pdf":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";return e.bytes instanceof Uint8Array&&(e.format==="pdf"||e.format==="xlsx")&&e.contentType===s}function M(e,t){if(!G(e,"export")||!("format"in e)||e.format!==t)throw new d.ReportSourceError("validate","报表执行器返回的导出结果与请求格式不一致或元数据无效")}function N(e){return{...e,reportIds:[...e.reportIds],...e.params?{params:{...e.params}}:{}}}function W(e,t){if(t.length===0)throw new d.ReportSourceError("config","缺少报表 ID");return t.map(s=>{if(!Object.prototype.hasOwnProperty.call(e,s))throw new d.ReportSourceError("config",`未注册报表 ${s}`);return e[s]})}function D(e){return e.grid?.cells.reduce((t,s)=>t+s.reduce((n,r)=>n+(r?1+(r.children?.reduce((a,g)=>a+D(g),0)??0):0),0),0)??0}function pe(e,t,s){return e.pages.reduce((n,r)=>n+r.components.reduce((a,g)=>g.kind!=="list"?a+D(g):a+d.estimateListLayoutCells(g,t,s),0),0)}function me(e,t=Object.keys(e)){return W(e,t).map((s,n)=>{const r=t[n],a=L.getReportParamDefs(e,[r]);return{id:r,params:JSON.parse(JSON.stringify(a)),paramsSchema:C.reportParamsJsonSchema(a),datasetsSchema:Object.fromEntries(Object.entries(s.dataSchema??{}).map(([g,f])=>[g,d.templateDatasetJsonSchema(typeof s.template=="function"?void 0:s.template,g,f)])),capabilities:{save:!!s.provider?.save,export:!!s.provider?.export,templates:!!s.provider?.templates}}})}function X(e,t){W(e,t.reportIds);const s=C.validateReportParams(L.getReportParamDefs(e,t.reportIds),t.params),n=t.reportIds.flatMap(a=>C.validateReportParams(L.getReportParamDefs(e,[a]),t.params).issues),r=new Map(n.map(a=>[JSON.stringify(a),a]));return{...s,ok:r.size===0,issues:[...r.values()]}}function O(e,t){const s=V.validateRenderPlan(e.plan);if(!s.ok)throw new d.ReportSourceError("validate",`执行器返回无效计划:${s.errors[0]?.path}`);const n=e.plan.pages.length,r=e.plan.pages.reduce((a,g)=>a+g.components.reduce((f,m)=>f+D(m),0),0);return i.assertBudget(t,"maxRows",e.stats.rows),i.assertBudget(t,"maxPages",n),i.assertBudget(t,"maxCells",r),{...e,stats:{...e.stats,pages:n,cells:r}}}function U(e,t){const s=X(e.reports,t);if(!s.ok)throw new C.ReportParamValidationError(s.issues)}function ge(e){const t={...i.DEFAULT_REPORT_RUNTIME_BUDGET,...e.budget};i.validateBudget(t);const s=async(r,a)=>{const g=Date.now();let f=0,m=0;const c=B.createDiagnosticCollector(r.diagnosticLimit),w={},x=[],u=Object.fromEntries(Object.entries(e.reports).map(([p,l])=>[p,{...l,pagination:{...e.pagination,...l.pagination,...a?{measurer:a}:{}},dataValidation:{...l.dataValidation,maxRows:Math.min(t.maxRows??1e5,l.dataValidation?.maxRows??1/0),maxCells:Math.min(t.maxCells??2e6,l.dataValidation?.maxCells??1/0)}}])),o=await d.createReportSource(u,{maxPages:t.maxPages,maxCells:t.maxCells,maxChartComponents:t.maxChartComponents,onDatasets:(p,l,v)=>{try{f+=d.templateDatasetRowCount(v,l,{maxRows:t.maxRows,signal:r.signal})}catch(b){throw b instanceof te.TreeRowLimitError?new i.ReportRuntimeError("budget",b.message,"$.budget.maxRows"):b}i.assertBudget(t,"maxRows",f),m+=pe(v,l,u[p]?.pagination),i.assertBudget(t,"maxCells",m)}})({...r,params:r.params??{},onWarning:p=>c.push({code:"layout",message:p,severity:"warning"}),onQueryResult:(p,l,v=0)=>{const b=d.reportOccurrenceScope(v,p);Object.defineProperty(w,p,{value:{revision:l.revision,sourceToken:l.sourceToken},enumerable:!0,writable:!0}),x.push({reportId:p,reportIndex:v,reportScope:b,...l.revision===void 0?{}:{revision:l.revision},...l.sourceToken===void 0?{}:{sourceToken:l.sourceToken}}),(l.diagnostics??[]).forEach(I=>c.push({...I,...I.target?{target:{...I.target,reportScope:b,...I.target.tableId?{tableId:JSON.stringify([v,p,I.target.tableId])}:{}}}:{}}))}}).catch(p=>{throw p instanceof d.ReportSourceError&&p.cause instanceof F.PaginatePageLimitError?new i.ReportRuntimeError("budget",p.cause.message,"$.budget.maxPages"):p instanceof d.ReportSourceError&&p.cause instanceof F.PaginateCellLimitError?new i.ReportRuntimeError("budget",p.cause.message,"$.budget.maxCells"):p instanceof d.ReportSourceError&&p.cause instanceof F.PaginateChartComponentLimitError?new i.ReportRuntimeError("budget",p.cause.message,"$.budget.maxChartComponents"):p});i.throwIfAborted(r.signal);const y=e.assets?await d.createReportTaskReporter(r).run("assets",()=>q.resolvePlanAssets(o,{...e.assets,diagnosticLimit:r.diagnosticLimit,signal:r.signal})):{plan:o,diagnostics:[]},S=y.plan;y.diagnosticSummary?c.merge({...y.diagnosticSummary,entries:E(y.diagnosticSummary.entries)}):E(y.diagnostics).forEach(p=>c.push(p));const A=S.pages.reduce((p,l)=>p+l.components.reduce((v,b)=>v+D(b),0),0);i.assertBudget(t,"maxPages",S.pages.length),i.assertBudget(t,"maxCells",A);const k=h.reportFontFingerprint(r.pdf),z=e.pagination?.measurer||Object.values(e.reports).some(p=>p.pagination?.measurer);return{plan:S,diagnostics:c.entries,...r.diagnosticLimit===void 0?{}:{diagnosticSummary:c.snapshot()},revisions:w,sources:x,layout:{textMetrics:k?"font-bytes":z?"provided":"heuristic",...k?{fontFingerprint:k}:{}},stats:{rows:f,pages:S.pages.length,cells:A,durationMs:Date.now()-g}}},n=async r=>{const a=Date.now();if(r.format!=="pdf"&&r.format!=="xlsx")throw new d.ReportSourceError("config","不支持的报表导出格式");const g=r.format==="pdf"?await import("@agile-team/mach-report/pdf"):void 0;i.throwIfAborted(r.signal);const f=r.pdf?.customFontFaces??(r.pdf?.customFontBytes?{regular:r.pdf.customFontBytes}:void 0),m=g&&f?g.createFontBytesMeasurer(f):void 0,c=await s(r,m);return i.throwIfAborted(r.signal),_({...r,prepared:c},t,a)};return{describe:r=>me(e.reports,r),validate:r=>X(e.reports,r),prepare:r=>i.controlled(r.signal,t.maxDurationMs,async a=>{const{signal:g,onEvent:f,...m}=N(r),c={...m,...m.pdf?{pdf:h.snapshotPdfFonts(m.pdf)}:{},taskId:m.taskId??d.reportTaskId()},w=f?y=>d.notifyReportTaskEvent(f,y,a):void 0,x={...c,signal:a,onEvent:w};d.createReportTaskReporter(x).runSync("validate",()=>U(e,c));let u;const R=c.pdf?.customFontFaces??(c.pdf?.customFontBytes?{regular:c.pdf.customFontBytes}:void 0);if(!e.executor&&R){const y=await import("@agile-team/mach-report/pdf");i.throwIfAborted(a),u=y.createFontBytesMeasurer(R)}const o=e.executor?await e.executor.prepare(c,a,w):await s(x,u);return e.executor&&de(o),O(o,t)}),exportPrepared:r=>i.controlled(r.signal,t.maxDurationMs,async a=>{const g=Date.now(),{signal:f,onEvent:m,...c}=r,w=O(h.snapshotPreparedReport(r.prepared,t.maxPreparedBytes??64e6,a),t),x={...c,xlsx:h.snapshotXlsxOptions(c.xlsx),prepared:w,...c.pdf?{pdf:h.snapshotPdfFonts(c.pdf)}:{},taskId:c.taskId??d.reportTaskId()};if(x.format!=="pdf"&&x.format!=="xlsx")throw new d.ReportSourceError("config","不支持的报表导出格式");const u=m?o=>d.notifyReportTaskEvent(m,o,a):void 0;if(e.executor){if(!e.executor.exportPrepared)throw new d.ReportSourceError("config","执行器未实现 exportPrepared;请升级执行器或显式使用本地运行时");const o=await e.executor.exportPrepared(x,a,u);return M(o,x.format),i.assertBudget(t,"maxRows",o.stats.rows),i.assertBudget(t,"maxPages",o.stats.pages),i.assertBudget(t,"maxCells",o.stats.cells),i.assertBudget(t,"maxOutputBytes",o.bytes.byteLength),{...o,stats:{...o.stats,outputBytes:o.bytes.byteLength}}}const R={...x,signal:a,onEvent:u};if(d.createReportTaskReporter(R).runSync("validate",()=>h.checkPreparedFont(R)),e.assets){const o=await d.createReportTaskReporter(R).run("assets",()=>q.resolvePlanAssets(w.plan,{...e.assets,diagnosticLimit:r.diagnosticLimit,signal:a}));w.plan=o.plan,h.appendPreparedDiagnostics(w,E(o.diagnostics),o.diagnosticSummary?{...o.diagnosticSummary,entries:E(o.diagnosticSummary.entries)}:void 0,r.diagnosticLimit)}return _(R,t,g)}),export:r=>i.controlled(r.signal,t.maxDurationMs,async a=>{const{signal:g,onEvent:f,...m}=N(r),c={...m,xlsx:h.snapshotXlsxOptions(m.xlsx),...m.pdf?{pdf:h.snapshotPdfFonts(m.pdf)}:{},taskId:m.taskId??d.reportTaskId()},w=f?R=>d.notifyReportTaskEvent(f,R,a):void 0,x={...c,signal:a,onEvent:w};if(d.createReportTaskReporter(x).runSync("validate",()=>U(e,c)),c.format!=="pdf"&&c.format!=="xlsx")throw new d.ReportSourceError("config","不支持的报表导出格式");const u=e.executor?await e.executor.export(c,a,w):await n(x);return e.executor&&M(u,c.format),i.assertBudget(t,"maxRows",u.stats.rows),i.assertBudget(t,"maxPages",u.stats.pages),i.assertBudget(t,"maxCells",u.stats.cells),i.assertBudget(t,"maxOutputBytes",u.bytes.byteLength),{...u,stats:{...u.stats,outputBytes:u.bytes.byteLength}}})}}exports.assertReportExportResult=M;exports.createReportRuntime=ge;exports.enforcePrepared=O;exports.validReportExecutionResult=G;
|