@agile-team/mach-report 2.16.0 → 2.18.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 +25 -12
- package/dist/{ExcelBindingWizard-CP6h2x1f.cjs → ExcelBindingWizard-Czn3C2yE.cjs} +1 -1
- package/dist/{ExcelBindingWizard-HhB3hAJE.js → ExcelBindingWizard-DMGZj6I6.js} +3 -3
- package/dist/ParamEditor-KzDQvbHY.js +732 -0
- package/dist/ParamEditor-oDfD8LgE.cjs +1 -0
- package/dist/{ReportBatchPanel-ruxcbfY6.js → ReportBatchPanel-BJK7PvZ4.js} +39 -39
- package/dist/ReportBatchPanel-DnmNRssu.cjs +1 -0
- package/dist/ReportParamPanel-mQkeN70Q.js +1020 -0
- package/dist/ReportParamPanel-sOANVRz-.cjs +1 -0
- package/dist/ReportPreview-BxWWTUL5.js +5583 -0
- package/dist/ReportPreview-Yf99omi3.cjs +6 -0
- package/dist/{ReportTemplateLibrary-DcwrH-63.js → ReportTemplateLibrary-BFjB08Wu.js} +1 -1
- package/dist/{ReportTemplateLibrary-BDlNT8JN.cjs → ReportTemplateLibrary-BO42QnWd.cjs} +1 -1
- package/dist/RuleEditor-CqxT1a-W.js +2337 -0
- package/dist/RuleEditor-D7YWigD9.cjs +1 -0
- package/dist/{TemplateOutlinePanel-CGrT5DFN.cjs → TemplateOutlinePanel-B0XX350V.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-SXCjaPKR.js → TemplateOutlinePanel-zG0DrsIB.js} +2 -2
- package/dist/{TemplateReusePanel-6Z3wRFz8.cjs → TemplateReusePanel-BD0HSKp_.cjs} +1 -1
- package/dist/{TemplateReusePanel-lHLOS9Wn.js → TemplateReusePanel-Czwe5GbC.js} +2 -2
- package/dist/{TemplateReviewPanel-Dpk7sLcF.cjs → TemplateReviewPanel-CA5sdffM.cjs} +1 -1
- package/dist/{TemplateReviewPanel-CJ9PLc48.js → TemplateReviewPanel-NhmQI65C.js} +2 -2
- package/dist/analytics.cjs +1 -1
- package/dist/analytics.d.cts +163 -42
- package/dist/analytics.d.ts +163 -42
- package/dist/analytics.js +76 -141
- package/dist/artifact-integrity.json +110 -108
- package/dist/assets-2eC3mOcV.js +232 -0
- package/dist/assets-B0Hxn4l6.cjs +1 -0
- package/dist/{auto-uVBjX1j5.cjs → auto-B0EZFIK1.cjs} +1 -1
- package/dist/{auto-YR7a4BtF.js → auto-BlchZ1b8.js} +10 -10
- package/dist/{batch-WzDIXJAt.js → batch-DGCt44XM.js} +1 -1
- package/dist/{batch-z6Aw5GEY.cjs → batch-DYcokH4v.cjs} +1 -1
- package/dist/charts-Dlv8j2AG.js +141 -0
- package/dist/charts-aCtoswXq.cjs +1 -0
- package/dist/codes.cjs +9 -9
- package/dist/codes.d.cts +54 -0
- package/dist/codes.d.ts +54 -0
- package/dist/codes.js +12097 -13668
- package/dist/column-visual-BpgQVWwT.js +238 -0
- package/dist/column-visual-CtYxnBCP.cjs +1 -0
- package/dist/component-tree-6TV7W6Yj.cjs +1 -0
- package/dist/component-tree-CvW4lzpv.js +67 -0
- package/dist/computed-4TnxzgIh.cjs +1 -0
- package/dist/computed-C8NRZQss.js +739 -0
- package/dist/data-bar-Ce38juRZ.cjs +1 -0
- package/dist/data-bar-PtjXhMgN.js +9 -0
- package/dist/dataset-DL83majE.js +161 -0
- package/dist/dataset-IrlXbUvh.cjs +1 -0
- package/dist/designer--TKECSEc.cjs +2 -0
- package/dist/designer-d6hJS41w.js +5683 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +835 -45
- package/dist/designer.d.ts +835 -45
- package/dist/designer.js +23 -20
- package/dist/{encoding-BYF9ZTl9.cjs → encoding-B--eZpp1.cjs} +1 -1
- package/dist/{encoding-BOGq4qYL.js → encoding-mctOLocI.js} +2 -2
- package/dist/{font-loader-EKLzOJxf.cjs → font-loader-DBBJ5KE9.cjs} +1 -1
- package/dist/{font-loader-CzI1GuBc.js → font-loader-DW8tIaNp.js} +1 -1
- package/dist/index-CPh6tqge.js +1575 -0
- package/dist/index-CUNw7dL9.cjs +1 -0
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +534 -16
- package/dist/index.d.ts +534 -16
- package/dist/index.js +1393 -955
- package/dist/json-snapshot-By4ZVVUt.js +1967 -0
- package/dist/json-snapshot-jiXff4lc.cjs +2 -0
- package/dist/matrix-0hywp0-F.cjs +1 -0
- package/dist/matrix-Dy-tyY7E.js +381 -0
- package/dist/param-validation-C-8sRJLq.cjs +1 -0
- package/dist/param-validation-CnDEd2l-.js +333 -0
- package/dist/{pdf-DJ5S6ukC.js → pdf-CKROKygt.js} +1845 -1845
- package/dist/{pdf-ByVCb1i6.cjs → pdf-DqyxJ96U.cjs} +47 -47
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.d.cts +66 -0
- package/dist/pdf.d.ts +66 -0
- package/dist/pdf.js +2 -2
- package/dist/{plugin-C2j5_mhx.js → plugin-ByjF2kiV.js} +5 -5
- package/dist/{plugin-Dr39GBRG.cjs → plugin-DM1M2wlI.cjs} +1 -1
- package/dist/prefill-B8H9qwE4.js +371 -0
- package/dist/prefill-D7EswyTI.cjs +1 -0
- package/dist/{prepared-DqtpvRTn.js → prepared-BE-4jfX5.js} +2 -2
- package/dist/{prepared-DdrjLC7L.cjs → prepared-CGVphji3.cjs} +1 -1
- package/dist/{protocol-BzwMP4Vw.cjs → protocol-ByRVzzQG.cjs} +1 -1
- package/dist/{protocol-kt4Iy6-3.js → protocol-Cr81vFSQ.js} +3 -3
- package/dist/{record-bindings-CZWBJ1fU.js → record-bindings-DEJtmo3p.js} +67 -107
- package/dist/record-bindings-ehjnCDHt.cjs +1 -0
- package/dist/{region-binding-workflow-CWNvIjkV.js → region-binding-workflow-CBg0l_tj.js} +2 -2
- package/dist/{region-binding-workflow-CqSMxQ4p.cjs → region-binding-workflow-D05tOYn3.cjs} +1 -1
- package/dist/report-encoding-worker.cjs +1 -1
- package/dist/report-encoding-worker.js +1 -1
- package/dist/{report-params-B1RzkhJj.js → report-params-D9tBuM9B.js} +1 -1
- package/dist/{report-params-WDGrA4oP.cjs → report-params-VTg8MoCp.cjs} +1 -1
- package/dist/runtime-CDA6d263.cjs +1 -0
- package/dist/runtime-CEMvybO7.js +170 -0
- package/dist/sbom.cdx.json +1 -1
- package/dist/server/node.d.cts +121 -7
- package/dist/server/node.d.ts +121 -7
- package/dist/server-node.cjs +4 -4
- package/dist/server-node.js +3446 -2115
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +417 -29
- package/dist/server.d.ts +417 -29
- package/dist/server.js +787 -544
- package/dist/sha256-BDQ1Qk7A.js +158 -0
- package/dist/sha256-DgZAKXqI.cjs +1 -0
- package/dist/style.css +1 -1
- package/dist/template-bindings-Cg5oBLFT.cjs +1 -0
- package/dist/template-bindings-TKnXM7ll.js +62 -0
- package/dist/{template-catalog-BtR2JmCL.js → template-catalog-CmbWOJqy.js} +16 -16
- package/dist/template-catalog-Utu4GP09.cjs +1 -0
- package/dist/{template-fragments-BVsbxs4a.cjs → template-fragments-C_zSHJAa.cjs} +1 -1
- package/dist/{template-fragments-By0aZC1D.js → template-fragments-DWgo9tlZ.js} +2 -2
- package/dist/{template-outline-BwRV_eRo.cjs → template-outline-DWkzZXVC.cjs} +1 -1
- package/dist/{template-outline-cnWfT_LK.js → template-outline-DiADphlq.js} +1 -1
- package/dist/{template-registry-Cw3vRTX2.js → template-registry-BIhIHOab.js} +319 -314
- package/dist/template-registry-DzWswQI5.cjs +1 -0
- package/dist/vue/async.d.cts +636 -35
- package/dist/vue/async.d.ts +636 -35
- package/dist/vue/index.d.cts +746 -67
- package/dist/vue/index.d.ts +746 -67
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +94 -89
- package/dist/{workbook-session-Cbts-22R.cjs → workbook-session-B94EwVa_.cjs} +1 -1
- package/dist/{workbook-session-BeSO8PFB.js → workbook-session-BoScoOg-.js} +2 -2
- package/dist/worker.cjs +1 -1
- package/dist/worker.d.cts +75 -7
- package/dist/worker.d.ts +75 -7
- package/dist/worker.js +4 -4
- package/dist/xlsx.cjs +4 -4
- package/dist/xlsx.d.cts +208 -15
- package/dist/xlsx.d.ts +208 -15
- package/dist/xlsx.js +288 -252
- package/package.json +1 -1
- package/dist/ParamEditor-CUQLgoxa.cjs +0 -1
- package/dist/ParamEditor-OKesP_nO.js +0 -594
- package/dist/ReportBatchPanel-cZCAMAwH.cjs +0 -1
- package/dist/ReportPreview-BcDKCLiK.js +0 -4834
- package/dist/ReportPreview-Bk9nLfO9.cjs +0 -6
- package/dist/RuleEditor-BX5S8RSF.cjs +0 -1
- package/dist/RuleEditor-CGl9XY2s.js +0 -2037
- package/dist/assets-CqIbfbTr.js +0 -126
- package/dist/assets-e4YSke8n.cjs +0 -1
- package/dist/capabilities-DDwXr_cA.js +0 -103
- package/dist/capabilities-DNLyZdNw.cjs +0 -1
- package/dist/component-tree-Ca6YYfHq.js +0 -61
- package/dist/component-tree-DkGLEfZC.cjs +0 -1
- package/dist/computed-C-4C2S5h.js +0 -521
- package/dist/computed-CGV2a809.cjs +0 -1
- package/dist/config-Dg_o8e7m.cjs +0 -1
- package/dist/config-XQ4qrQ7Q.js +0 -844
- package/dist/dataset-BkRmwgeJ.cjs +0 -1
- package/dist/dataset-H5pFuQGU.js +0 -121
- package/dist/designer-BfQSahxq.js +0 -5163
- package/dist/designer-CPPdeM5_.cjs +0 -2
- package/dist/diagnostic-notification-B9K9We3h.cjs +0 -1
- package/dist/diagnostic-notification-qGAYZdkB.js +0 -7
- package/dist/drill-CsdjgkRM.cjs +0 -1
- package/dist/drill-DIGsZfyB.js +0 -145
- package/dist/json-snapshot-D6ioHth9.js +0 -1702
- package/dist/json-snapshot-DknkjvxP.cjs +0 -2
- package/dist/matrix-CGRGkn5s.js +0 -112
- package/dist/matrix-gEO7ZM_u.cjs +0 -1
- package/dist/param-validation-C3HlcLLO.cjs +0 -1
- package/dist/param-validation-Do7Eg8Zv.js +0 -181
- package/dist/record-bindings-DUX1VMlR.cjs +0 -1
- package/dist/runtime-BjKBI530.js +0 -168
- package/dist/runtime-CBFEPKEs.cjs +0 -1
- package/dist/sha256-BshdOkCC.cjs +0 -1
- package/dist/sha256-DTG-Gq8i.js +0 -157
- package/dist/template-bindings-C2SpvsMU.js +0 -58
- package/dist/template-bindings-CEtWyiLX.cjs +0 -1
- package/dist/template-catalog-C2NLdrwB.cjs +0 -1
- package/dist/template-registry-C62vpv4a.cjs +0 -1
- package/dist/tree-BX380Rr7.cjs +0 -1
- package/dist/tree-CjVZLRw7.js +0 -172
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { R as y, Q as R, S as W, T as B, J as O, q as X, L as z, U as G, c as H, P as K, b as Y, r as Z } from "./json-snapshot-By4ZVVUt.js";
|
|
2
|
+
import { g as M } from "./report-params-D9tBuM9B.js";
|
|
3
|
+
import { l as $, r as ee, R as te } from "./param-validation-CnDEd2l-.js";
|
|
4
|
+
import { t as P, b as w, D as se, v as ae, c as D, R as F } from "./sha256-BDQ1Qk7A.js";
|
|
5
|
+
import { b as re } from "./template-registry-BIhIHOab.js";
|
|
6
|
+
import { T as oe } from "./column-visual-BpgQVWwT.js";
|
|
7
|
+
import { a as j } from "./assets-2eC3mOcV.js";
|
|
8
|
+
import { s as S, a as J, d as ne, e as ce, r as ie } from "./prepared-BE-4jfX5.js";
|
|
9
|
+
function k(e = []) {
|
|
10
|
+
return e.map(({ code: t, message: r, severity: n, pageIndex: s, componentIndex: a }) => ({ code: t, message: r, severity: n, path: a < 0 ? `$.pages.${s}` : `$.pages.${s}.components.${a}` }));
|
|
11
|
+
}
|
|
12
|
+
async function _(e, t, r = Date.now()) {
|
|
13
|
+
const n = e.prepared;
|
|
14
|
+
if (e.fidelity === "strict" && n.diagnostics.some((g) => g.code === "asset-render-failed" || g.code === "asset-budget-exceeded")) throw new y("validate", "严格输出拒绝已有资产渲染降级,请修复组件后重新准备报表。");
|
|
15
|
+
const s = e.format === "pdf" ? await import("@agile-team/mach-report/pdf") : void 0;
|
|
16
|
+
P(e.signal);
|
|
17
|
+
const a = e.pdf?.customFontFaces ?? (e.pdf?.customFontBytes ? { regular: e.pdf.customFontBytes } : void 0), l = s && a ? s.createFontBytesMeasurer(a) : void 0, m = R(e), p = await m.run("encode", async () => {
|
|
18
|
+
let g;
|
|
19
|
+
if (e.format === "pdf") {
|
|
20
|
+
P(e.signal);
|
|
21
|
+
const c = await s.renderPlanToPdf(n.plan, { ...e.pdf, ...l ? { measurer: l } : {}, fidelity: e.fidelity, signal: e.signal, onProgress: (f, i) => m.progress("encode", f, i) });
|
|
22
|
+
g = c.bytes, n.diagnostics.push(...k(c.diagnostics)), n.diagnostics.push(...c.fidelityWarnings.map((f) => ({ code: "pdf-fidelity", message: f, severity: "warning" })), ...c.pageErrors.map((f) => ({ code: "pdf-page", message: f, severity: "error" }))), c.unsupportedTextCount && n.diagnostics.push({ code: "pdf-font", message: `${c.unsupportedTextCount} 段文本包含当前字体不支持的字符`, severity: "warning" });
|
|
23
|
+
} else {
|
|
24
|
+
const { renderPlanToXlsx: c } = await import("@agile-team/mach-report/xlsx");
|
|
25
|
+
P(e.signal);
|
|
26
|
+
const f = await c(n.plan, { ...e.xlsx, fidelity: e.fidelity, signal: e.signal, onProgress: (i, v) => m.progress("encode", i, v) });
|
|
27
|
+
g = new Uint8Array(f.buffer), n.diagnostics.push(...k(f.diagnostics)), n.diagnostics.push(...f.warnings.map((i) => ({ code: "xlsx-fidelity", message: i, severity: "warning" }))), n.diagnostics.push(...(f.notes ?? []).map((i) => ({ code: "xlsx-snapshot", message: i, severity: "info" })));
|
|
28
|
+
}
|
|
29
|
+
return P(e.signal), g;
|
|
30
|
+
});
|
|
31
|
+
w(t, "maxOutputBytes", p.byteLength);
|
|
32
|
+
const { plan: o, ...x } = n;
|
|
33
|
+
return { ...x, bytes: p, format: e.format, contentType: e.format === "pdf" ? "application/pdf" : "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", stats: { ...x.stats, durationMs: Date.now() - r, outputBytes: p.byteLength } };
|
|
34
|
+
}
|
|
35
|
+
function q(e) {
|
|
36
|
+
return { ...e, reportIds: [...e.reportIds], ...e.params ? { params: { ...e.params } } : {} };
|
|
37
|
+
}
|
|
38
|
+
function V(e, t) {
|
|
39
|
+
if (t.length === 0) throw new y("config", "缺少报表 ID");
|
|
40
|
+
return t.map((r) => {
|
|
41
|
+
if (!Object.prototype.hasOwnProperty.call(e, r)) throw new y("config", `未注册报表 ${r}`);
|
|
42
|
+
return e[r];
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function I(e) {
|
|
46
|
+
return e.grid?.cells.reduce((t, r) => t + r.reduce((n, s) => n + (s ? 1 + (s.children?.reduce((a, l) => a + I(l), 0) ?? 0) : 0), 0), 0) ?? 0;
|
|
47
|
+
}
|
|
48
|
+
function de(e, t, r) {
|
|
49
|
+
return e.pages.reduce((n, s) => n + s.components.reduce((a, l) => l.kind !== "list" ? a + I(l) : a + Z(l, t, r), 0), 0);
|
|
50
|
+
}
|
|
51
|
+
function pe(e, t = Object.keys(e)) {
|
|
52
|
+
return V(e, t).map((r, n) => {
|
|
53
|
+
const s = t[n], a = M(e, [s]);
|
|
54
|
+
return {
|
|
55
|
+
id: s,
|
|
56
|
+
params: JSON.parse(JSON.stringify(a)),
|
|
57
|
+
paramsSchema: ee(a),
|
|
58
|
+
datasetsSchema: Object.fromEntries(Object.entries(r.dataSchema ?? {}).map(([l, m]) => [l, W(typeof r.template == "function" ? void 0 : r.template, l, m)])),
|
|
59
|
+
capabilities: {
|
|
60
|
+
save: !!r.provider?.save,
|
|
61
|
+
export: !!r.provider?.export,
|
|
62
|
+
templates: !!r.provider?.templates
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function A(e, t) {
|
|
68
|
+
V(e, t.reportIds);
|
|
69
|
+
const r = $(M(e, t.reportIds), t.params), n = t.reportIds.flatMap((a) => $(M(e, [a]), t.params).issues), s = new Map(n.map((a) => [JSON.stringify(a), a]));
|
|
70
|
+
return { ...r, ok: s.size === 0, issues: [...s.values()] };
|
|
71
|
+
}
|
|
72
|
+
function N(e, t) {
|
|
73
|
+
const r = re(e.plan);
|
|
74
|
+
if (!r.ok) throw new y("validate", `执行器返回无效计划:${r.errors[0]?.path}`);
|
|
75
|
+
const n = e.plan.pages.length, s = e.plan.pages.reduce((a, l) => a + l.components.reduce((m, p) => m + I(p), 0), 0);
|
|
76
|
+
return w(t, "maxRows", e.stats.rows), w(t, "maxPages", n), w(t, "maxCells", s), { ...e, stats: { ...e.stats, pages: n, cells: s } };
|
|
77
|
+
}
|
|
78
|
+
function U(e, t) {
|
|
79
|
+
const r = A(e.reports, t);
|
|
80
|
+
if (!r.ok) throw new te(r.issues);
|
|
81
|
+
}
|
|
82
|
+
function ve(e) {
|
|
83
|
+
const t = { ...se, ...e.budget };
|
|
84
|
+
ae(t);
|
|
85
|
+
const r = async (s, a) => {
|
|
86
|
+
const l = Date.now();
|
|
87
|
+
let m = 0, p = 0;
|
|
88
|
+
const o = [], x = {}, g = [], c = Object.fromEntries(Object.entries(e.reports).map(([d, u]) => [d, {
|
|
89
|
+
...u,
|
|
90
|
+
pagination: { ...e.pagination, ...u.pagination, ...a ? { measurer: a } : {} },
|
|
91
|
+
dataValidation: {
|
|
92
|
+
...u.dataValidation,
|
|
93
|
+
maxRows: Math.min(t.maxRows ?? 1e5, u.dataValidation?.maxRows ?? 1 / 0),
|
|
94
|
+
maxCells: Math.min(t.maxCells ?? 2e6, u.dataValidation?.maxCells ?? 1 / 0)
|
|
95
|
+
}
|
|
96
|
+
}])), i = await X(c, { maxPages: t.maxPages, maxCells: t.maxCells, maxChartComponents: t.maxChartComponents, onDatasets: (d, u, h) => {
|
|
97
|
+
try {
|
|
98
|
+
m += z(h, u, { maxRows: t.maxRows, signal: s.signal });
|
|
99
|
+
} catch (b) {
|
|
100
|
+
throw b instanceof oe ? new F("budget", b.message, "$.budget.maxRows") : b;
|
|
101
|
+
}
|
|
102
|
+
w(t, "maxRows", m), p += de(h, u, c[d]?.pagination), w(t, "maxCells", p);
|
|
103
|
+
} })({ ...s, params: s.params ?? {}, onWarning: (d) => o.push({ code: "layout", message: d, severity: "warning" }), onQueryResult: (d, u, h = 0) => {
|
|
104
|
+
const b = G(h, d);
|
|
105
|
+
Object.defineProperty(x, d, { value: { revision: u.revision, sourceToken: u.sourceToken }, enumerable: !0, writable: !0 }), g.push({ reportId: d, reportIndex: h, reportScope: b, ...u.revision === void 0 ? {} : { revision: u.revision }, ...u.sourceToken === void 0 ? {} : { sourceToken: u.sourceToken } }), o.push(...(u.diagnostics ?? []).map((C) => ({ ...C, ...C.target ? { target: {
|
|
106
|
+
...C.target,
|
|
107
|
+
reportScope: b,
|
|
108
|
+
...C.target.tableId ? { tableId: JSON.stringify([h, d, C.target.tableId]) } : {}
|
|
109
|
+
} } : {} })));
|
|
110
|
+
} }).catch((d) => {
|
|
111
|
+
throw d instanceof y && d.cause instanceof H ? new F("budget", d.cause.message, "$.budget.maxPages") : d instanceof y && d.cause instanceof K ? new F("budget", d.cause.message, "$.budget.maxCells") : d instanceof y && d.cause instanceof Y ? new F("budget", d.cause.message, "$.budget.maxChartComponents") : d;
|
|
112
|
+
});
|
|
113
|
+
P(s.signal);
|
|
114
|
+
const v = e.assets ? await R(s).run("assets", () => j(i, { ...e.assets, signal: s.signal })) : { plan: i, diagnostics: [] }, E = v.plan;
|
|
115
|
+
o.push(...k(v.diagnostics));
|
|
116
|
+
const L = E.pages.reduce((d, u) => d + u.components.reduce((h, b) => h + I(b), 0), 0);
|
|
117
|
+
w(t, "maxPages", E.pages.length), w(t, "maxCells", L);
|
|
118
|
+
const T = ie(s.pdf), Q = e.pagination?.measurer || Object.values(e.reports).some((d) => d.pagination?.measurer);
|
|
119
|
+
return { plan: E, diagnostics: o, revisions: x, sources: g, layout: { textMetrics: T ? "font-bytes" : Q ? "provided" : "heuristic", ...T ? { fontFingerprint: T } : {} }, stats: { rows: m, pages: E.pages.length, cells: L, durationMs: Date.now() - l } };
|
|
120
|
+
}, n = async (s) => {
|
|
121
|
+
const a = Date.now();
|
|
122
|
+
if (s.format !== "pdf" && s.format !== "xlsx") throw new y("config", "不支持的报表导出格式");
|
|
123
|
+
const l = s.format === "pdf" ? await import("@agile-team/mach-report/pdf") : void 0;
|
|
124
|
+
P(s.signal);
|
|
125
|
+
const m = s.pdf?.customFontFaces ?? (s.pdf?.customFontBytes ? { regular: s.pdf.customFontBytes } : void 0), p = l && m ? l.createFontBytesMeasurer(m) : void 0, o = await r(s, p);
|
|
126
|
+
return P(s.signal), _({ ...s, prepared: o }, t, a);
|
|
127
|
+
};
|
|
128
|
+
return {
|
|
129
|
+
describe: (s) => pe(e.reports, s),
|
|
130
|
+
validate: (s) => A(e.reports, s),
|
|
131
|
+
prepare: (s) => D(s.signal, t.maxDurationMs, async (a) => {
|
|
132
|
+
const { signal: l, onEvent: m, ...p } = q(s), o = { ...p, ...p.pdf ? { pdf: S(p.pdf) } : {}, taskId: p.taskId ?? B() }, x = m ? (v) => O(m, v, a) : void 0, g = { ...o, signal: a, onEvent: x };
|
|
133
|
+
R(g).runSync("validate", () => U(e, o));
|
|
134
|
+
let c;
|
|
135
|
+
const f = o.pdf?.customFontFaces ?? (o.pdf?.customFontBytes ? { regular: o.pdf.customFontBytes } : void 0);
|
|
136
|
+
if (!e.executor && f) {
|
|
137
|
+
const v = await import("@agile-team/mach-report/pdf");
|
|
138
|
+
P(a), c = v.createFontBytesMeasurer(f);
|
|
139
|
+
}
|
|
140
|
+
const i = e.executor ? await e.executor.prepare(o, a, x) : await r(g, c);
|
|
141
|
+
return N(i, t);
|
|
142
|
+
}),
|
|
143
|
+
exportPrepared: (s) => D(s.signal, t.maxDurationMs, async (a) => {
|
|
144
|
+
const l = Date.now(), { signal: m, onEvent: p, ...o } = s, x = N(ne(s.prepared, t.maxPreparedBytes ?? 64e6, a), t), g = { ...o, xlsx: J(o.xlsx), prepared: x, ...o.pdf ? { pdf: S(o.pdf) } : {}, taskId: o.taskId ?? B() };
|
|
145
|
+
if (g.format !== "pdf" && g.format !== "xlsx") throw new y("config", "不支持的报表导出格式");
|
|
146
|
+
const c = p ? (i) => O(p, i, a) : void 0;
|
|
147
|
+
if (e.executor) {
|
|
148
|
+
if (!e.executor.exportPrepared) throw new y("config", "执行器未实现 exportPrepared;请升级执行器或显式使用本地运行时");
|
|
149
|
+
const i = await e.executor.exportPrepared(g, a, c);
|
|
150
|
+
return w(t, "maxRows", i.stats.rows), w(t, "maxPages", i.stats.pages), w(t, "maxCells", i.stats.cells), w(t, "maxOutputBytes", i.bytes.byteLength), { ...i, stats: { ...i.stats, outputBytes: i.bytes.byteLength } };
|
|
151
|
+
}
|
|
152
|
+
const f = { ...g, signal: a, onEvent: c };
|
|
153
|
+
if (R(f).runSync("validate", () => ce(f)), e.assets) {
|
|
154
|
+
const i = await R(f).run("assets", () => j(x.plan, { ...e.assets, signal: a }));
|
|
155
|
+
x.plan = i.plan, x.diagnostics.push(...k(i.diagnostics));
|
|
156
|
+
}
|
|
157
|
+
return _(f, t, l);
|
|
158
|
+
}),
|
|
159
|
+
export: (s) => D(s.signal, t.maxDurationMs, async (a) => {
|
|
160
|
+
const { signal: l, onEvent: m, ...p } = q(s), o = { ...p, xlsx: J(p.xlsx), ...p.pdf ? { pdf: S(p.pdf) } : {}, taskId: p.taskId ?? B() }, x = m ? (f) => O(m, f, a) : void 0, g = { ...o, signal: a, onEvent: x };
|
|
161
|
+
if (R(g).runSync("validate", () => U(e, o)), o.format !== "pdf" && o.format !== "xlsx") throw new y("config", "不支持的报表导出格式");
|
|
162
|
+
const c = e.executor ? await e.executor.export(o, a, x) : await n(g);
|
|
163
|
+
return w(t, "maxRows", c.stats.rows), w(t, "maxPages", c.stats.pages), w(t, "maxCells", c.stats.cells), w(t, "maxOutputBytes", c.bytes.byteLength), { ...c, stats: { ...c.stats, outputBytes: c.bytes.byteLength } };
|
|
164
|
+
})
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
export {
|
|
168
|
+
ve as c,
|
|
169
|
+
N as e
|
|
170
|
+
};
|
package/dist/sbom.cdx.json
CHANGED
package/dist/server/node.d.cts
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
import { WorkerOptions as WorkerOptions_2 } from 'node:worker_threads';
|
|
4
4
|
|
|
5
|
+
declare type AggregateOperation = "sum" | "count" | "avg" | "min" | "max" | "weightedAvg";
|
|
6
|
+
|
|
7
|
+
declare interface AggregateRequest {
|
|
8
|
+
op: AggregateOperation;
|
|
9
|
+
field?: string;
|
|
10
|
+
weightField?: string;
|
|
11
|
+
numeric?: "number" | "decimal";
|
|
12
|
+
digits?: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
5
15
|
declare interface BrowserReportWorker {
|
|
6
16
|
postMessage(value: unknown, transfer?: Transferable[]): void;
|
|
7
17
|
terminate(): void;
|
|
@@ -87,6 +97,14 @@ export declare function createNodeAutoReportExporter(options?: Omit<ReportExport
|
|
|
87
97
|
/** 独立 worker_threads 适配器;worker 入口注册自己的模板/Provider,不把函数跨线程序列化。 */
|
|
88
98
|
export declare function createNodeReportExecutor(options: NodeReportExecutorOptions): ReportRuntimeExecutor;
|
|
89
99
|
|
|
100
|
+
export declare interface FileReportDocumentStore extends ReportDocumentStore {
|
|
101
|
+
close(): Promise<void>;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export declare interface FileReportDocumentStoreOptions extends ReportDocumentBudget {
|
|
105
|
+
directory: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
90
108
|
export declare interface FileReportJobStore extends ReportJobStore {
|
|
91
109
|
close(): Promise<void>;
|
|
92
110
|
}
|
|
@@ -97,6 +115,12 @@ export declare interface FileReportJobStoreOptions extends ReportJobStoreBudgetO
|
|
|
97
115
|
}
|
|
98
116
|
|
|
99
117
|
declare interface GridCell {
|
|
118
|
+
/** Resolved visual only. Original value, text, editability and source are unchanged. */
|
|
119
|
+
dataBar?: {
|
|
120
|
+
start: number;
|
|
121
|
+
end: number;
|
|
122
|
+
color: string;
|
|
123
|
+
};
|
|
100
124
|
/** Styled cell content; text remains a plain-text fallback. Imported rich cells are read-only. */
|
|
101
125
|
richParagraphs?: RichParagraph[];
|
|
102
126
|
text?: string;
|
|
@@ -141,10 +165,15 @@ export declare interface NodeReportExecutorOptions extends ReportWorkerOptions {
|
|
|
141
165
|
workerOptions?: WorkerOptions_2;
|
|
142
166
|
}
|
|
143
167
|
|
|
168
|
+
/** Exclusive-process disk reference. Pages stay on disk; manifest/page reads and appends are bounded. */
|
|
169
|
+
export declare function openFileReportDocumentStore(options: FileReportDocumentStoreOptions): Promise<FileReportDocumentStore>;
|
|
170
|
+
|
|
144
171
|
/** Durable local store with one process owner; database adapters provide multi-instance atomic CAS. */
|
|
145
172
|
export declare function openFileReportJobStore(options: FileReportJobStoreOptions): Promise<FileReportJobStore>;
|
|
146
173
|
|
|
147
174
|
declare interface PlanComponent {
|
|
175
|
+
/** Template-only aggregate binding, expanded into shared primitives during layout. */
|
|
176
|
+
chartBinding?: ReportChartBinding;
|
|
148
177
|
/** Optional QR/barcode encoding configuration; no encoder is loaded by the core. */
|
|
149
178
|
code?: CodeOptions;
|
|
150
179
|
/** Template-only binding; resolved and removed before constructing the output plan. */
|
|
@@ -261,6 +290,42 @@ declare interface ReportCellSource {
|
|
|
261
290
|
sourceToken?: string;
|
|
262
291
|
}
|
|
263
292
|
|
|
293
|
+
/** Serializable binding; data and authorization continue to come from the existing report source. */
|
|
294
|
+
declare interface ReportChartBinding {
|
|
295
|
+
dataset: string;
|
|
296
|
+
categoryField: string;
|
|
297
|
+
measures: readonly ReportChartMeasure[];
|
|
298
|
+
type: ReportChartOptions["type"];
|
|
299
|
+
sort?: "asc" | "desc";
|
|
300
|
+
title?: string;
|
|
301
|
+
showValues?: boolean;
|
|
302
|
+
maxRows?: number;
|
|
303
|
+
maxCategories?: number;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
declare interface ReportChartMeasure extends AggregateRequest {
|
|
307
|
+
label?: string;
|
|
308
|
+
color?: string;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
declare interface ReportChartOptions {
|
|
312
|
+
type: "bar" | "line" | "stackedBar" | "percentBar";
|
|
313
|
+
categories: readonly string[];
|
|
314
|
+
series: readonly ReportChartSeries[];
|
|
315
|
+
leftMm: number;
|
|
316
|
+
topMm: number;
|
|
317
|
+
widthMm: number;
|
|
318
|
+
heightMm: number;
|
|
319
|
+
title?: string;
|
|
320
|
+
showValues?: boolean;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
declare interface ReportChartSeries {
|
|
324
|
+
name: string;
|
|
325
|
+
values: readonly (number | null)[];
|
|
326
|
+
color?: string;
|
|
327
|
+
}
|
|
328
|
+
|
|
264
329
|
declare interface ReportDataTarget {
|
|
265
330
|
datasetId: string;
|
|
266
331
|
field: string;
|
|
@@ -294,6 +359,41 @@ declare interface ReportDiagnostic {
|
|
|
294
359
|
target?: ReportDataTarget;
|
|
295
360
|
}
|
|
296
361
|
|
|
362
|
+
declare interface ReportDocumentBudget {
|
|
363
|
+
maxDocuments?: number;
|
|
364
|
+
maxBytes?: number;
|
|
365
|
+
maxPages?: number;
|
|
366
|
+
maxPageBytes?: number;
|
|
367
|
+
maxManifestBytes?: number;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
declare interface ReportDocumentManifest {
|
|
371
|
+
scope: string;
|
|
372
|
+
id: string;
|
|
373
|
+
version: string;
|
|
374
|
+
/** CAS token increases after each append and completion. */
|
|
375
|
+
revision: number;
|
|
376
|
+
state: "building" | "complete" | "failed";
|
|
377
|
+
failure?: {
|
|
378
|
+
code: "cancelled" | "generation";
|
|
379
|
+
message: string;
|
|
380
|
+
};
|
|
381
|
+
pageCount: number;
|
|
382
|
+
bytes: number;
|
|
383
|
+
plan: Omit<RenderPlan, "pages">;
|
|
384
|
+
metadata?: Omit<PreparedReport, "plan">;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
declare interface ReportDocumentStore {
|
|
388
|
+
create(input: Pick<ReportDocumentManifest, "scope" | "id" | "version" | "plan">, signal?: AbortSignal): Promise<ReportDocumentManifest>;
|
|
389
|
+
append(scope: string, id: string, version: string, expectedRevision: number, page: PlanPage, signal?: AbortSignal): Promise<ReportDocumentManifest>;
|
|
390
|
+
complete(scope: string, id: string, version: string, expectedRevision: number, metadata?: Omit<PreparedReport, "plan">, signal?: AbortSignal): Promise<ReportDocumentManifest>;
|
|
391
|
+
fail(scope: string, id: string, version: string, expectedRevision: number, failure: NonNullable<ReportDocumentManifest["failure"]>): Promise<ReportDocumentManifest>;
|
|
392
|
+
read(scope: string, id: string, signal?: AbortSignal): Promise<ReportDocumentManifest | undefined>;
|
|
393
|
+
readPage(scope: string, id: string, version: string, index: number, signal?: AbortSignal): Promise<PlanPage | undefined>;
|
|
394
|
+
remove(scope: string, id: string, version: string, signal?: AbortSignal): Promise<boolean>;
|
|
395
|
+
}
|
|
396
|
+
|
|
297
397
|
export declare interface ReportExportDecision {
|
|
298
398
|
mode: "local" | "worker";
|
|
299
399
|
reason: ReportExportDecisionReason;
|
|
@@ -409,18 +509,17 @@ declare interface ReportJobTombstone {
|
|
|
409
509
|
|
|
410
510
|
declare type ReportLocalExport = (input: ReportRuntimePreparedExportInput) => Promise<ReportRuntimeExportResult>;
|
|
411
511
|
|
|
512
|
+
declare type ReportNumberRange = readonly [number, number];
|
|
513
|
+
|
|
412
514
|
/** 报表参数定义(声明式,模板自描述参数面:渲染组件据此生成查询面板) */
|
|
413
515
|
declare interface ReportParamDef {
|
|
414
516
|
/** 参数名(传入 params,与数据集 SQL #{field} 绑定对应) */
|
|
415
517
|
field: string;
|
|
416
518
|
/** 显示名(缺省用 field) */
|
|
417
519
|
label?: string;
|
|
418
|
-
type?: "text" | "number" | "date" | "month" | "year" | "dateRange" | "select";
|
|
520
|
+
type?: "text" | "number" | "date" | "month" | "year" | "dateRange" | "select" | "multiSelect" | "cascader" | "numberRange";
|
|
419
521
|
/** select 选项 */
|
|
420
|
-
options?:
|
|
421
|
-
label: string;
|
|
422
|
-
value: string;
|
|
423
|
-
}>;
|
|
522
|
+
options?: ReportParamTreeOption[];
|
|
424
523
|
/** Opaque host-resolved source key. No URL, credentials or executable code is stored. */
|
|
425
524
|
optionsSource?: string;
|
|
426
525
|
/** Select dependencies must be declared parameters; changing a parent clears descendants. */
|
|
@@ -433,6 +532,9 @@ declare interface ReportParamDef {
|
|
|
433
532
|
max?: number | string;
|
|
434
533
|
minLength?: number;
|
|
435
534
|
maxLength?: number;
|
|
535
|
+
/** multiSelect item count (maximum 100). Cascader paths are bounded to 16 levels. */
|
|
536
|
+
minItems?: number;
|
|
537
|
+
maxItems?: number;
|
|
436
538
|
}
|
|
437
539
|
|
|
438
540
|
declare interface ReportParamIssue {
|
|
@@ -442,14 +544,23 @@ declare interface ReportParamIssue {
|
|
|
442
544
|
message: string;
|
|
443
545
|
}
|
|
444
546
|
|
|
445
|
-
declare type ReportParamIssueCode = "definition" | "required" | "type" | "option" | "dependency" | "minimum" | "maximum" | "minLength" | "maxLength";
|
|
547
|
+
declare type ReportParamIssueCode = "definition" | "required" | "type" | "option" | "dependency" | "minimum" | "maximum" | "minLength" | "maxLength" | "minItems" | "maxItems";
|
|
548
|
+
|
|
549
|
+
/** Cascader values are unique within each sibling list. */
|
|
550
|
+
declare interface ReportParamTreeOption {
|
|
551
|
+
label: string;
|
|
552
|
+
value: string;
|
|
553
|
+
children?: ReportParamTreeOption[];
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
declare type ReportParamTypedValue = string | number | string[] | ReportNumberRange;
|
|
446
557
|
|
|
447
558
|
declare interface ReportParamValidation {
|
|
448
559
|
ok: boolean;
|
|
449
560
|
/** 保留历史取数契约的字符串形式;未知参数保留,不能代替接口权限白名单。 */
|
|
450
561
|
values: Record<string, string>;
|
|
451
562
|
/** JSON Schema 对应的规范值:number 参数转换为有限数字。 */
|
|
452
|
-
typedValues: Record<string,
|
|
563
|
+
typedValues: Record<string, ReportParamTypedValue>;
|
|
453
564
|
issues: ReportParamIssue[];
|
|
454
565
|
}
|
|
455
566
|
|
|
@@ -477,6 +588,8 @@ declare interface ReportRuntimeBudget {
|
|
|
477
588
|
maxRows?: number;
|
|
478
589
|
maxPages?: number;
|
|
479
590
|
maxCells?: number;
|
|
591
|
+
/** Aggregate bound-chart primitives per prepare, before expansion; default 50000, hard maximum 1000000. */
|
|
592
|
+
maxChartComponents?: number;
|
|
480
593
|
maxOutputBytes?: number;
|
|
481
594
|
/** Bound the plain JSON snapshot accepted by exportPrepared (default 64 MB). */
|
|
482
595
|
maxPreparedBytes?: number;
|
|
@@ -499,6 +612,7 @@ declare interface ReportRuntimeExportInput extends ReportRuntimeInput {
|
|
|
499
612
|
sheetMode?: "auto" | "pages" | "continuous";
|
|
500
613
|
valueMode?: "text" | "raw";
|
|
501
614
|
paperSize?: "auto" | "a3" | "a4" | "a5";
|
|
615
|
+
maxDataBars?: number;
|
|
502
616
|
sheetName?: (sheetIndex: number) => string;
|
|
503
617
|
};
|
|
504
618
|
}
|
package/dist/server/node.d.ts
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
import { WorkerOptions as WorkerOptions_2 } from 'node:worker_threads';
|
|
4
4
|
|
|
5
|
+
declare type AggregateOperation = "sum" | "count" | "avg" | "min" | "max" | "weightedAvg";
|
|
6
|
+
|
|
7
|
+
declare interface AggregateRequest {
|
|
8
|
+
op: AggregateOperation;
|
|
9
|
+
field?: string;
|
|
10
|
+
weightField?: string;
|
|
11
|
+
numeric?: "number" | "decimal";
|
|
12
|
+
digits?: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
5
15
|
declare interface BrowserReportWorker {
|
|
6
16
|
postMessage(value: unknown, transfer?: Transferable[]): void;
|
|
7
17
|
terminate(): void;
|
|
@@ -87,6 +97,14 @@ export declare function createNodeAutoReportExporter(options?: Omit<ReportExport
|
|
|
87
97
|
/** 独立 worker_threads 适配器;worker 入口注册自己的模板/Provider,不把函数跨线程序列化。 */
|
|
88
98
|
export declare function createNodeReportExecutor(options: NodeReportExecutorOptions): ReportRuntimeExecutor;
|
|
89
99
|
|
|
100
|
+
export declare interface FileReportDocumentStore extends ReportDocumentStore {
|
|
101
|
+
close(): Promise<void>;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export declare interface FileReportDocumentStoreOptions extends ReportDocumentBudget {
|
|
105
|
+
directory: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
90
108
|
export declare interface FileReportJobStore extends ReportJobStore {
|
|
91
109
|
close(): Promise<void>;
|
|
92
110
|
}
|
|
@@ -97,6 +115,12 @@ export declare interface FileReportJobStoreOptions extends ReportJobStoreBudgetO
|
|
|
97
115
|
}
|
|
98
116
|
|
|
99
117
|
declare interface GridCell {
|
|
118
|
+
/** Resolved visual only. Original value, text, editability and source are unchanged. */
|
|
119
|
+
dataBar?: {
|
|
120
|
+
start: number;
|
|
121
|
+
end: number;
|
|
122
|
+
color: string;
|
|
123
|
+
};
|
|
100
124
|
/** Styled cell content; text remains a plain-text fallback. Imported rich cells are read-only. */
|
|
101
125
|
richParagraphs?: RichParagraph[];
|
|
102
126
|
text?: string;
|
|
@@ -141,10 +165,15 @@ export declare interface NodeReportExecutorOptions extends ReportWorkerOptions {
|
|
|
141
165
|
workerOptions?: WorkerOptions_2;
|
|
142
166
|
}
|
|
143
167
|
|
|
168
|
+
/** Exclusive-process disk reference. Pages stay on disk; manifest/page reads and appends are bounded. */
|
|
169
|
+
export declare function openFileReportDocumentStore(options: FileReportDocumentStoreOptions): Promise<FileReportDocumentStore>;
|
|
170
|
+
|
|
144
171
|
/** Durable local store with one process owner; database adapters provide multi-instance atomic CAS. */
|
|
145
172
|
export declare function openFileReportJobStore(options: FileReportJobStoreOptions): Promise<FileReportJobStore>;
|
|
146
173
|
|
|
147
174
|
declare interface PlanComponent {
|
|
175
|
+
/** Template-only aggregate binding, expanded into shared primitives during layout. */
|
|
176
|
+
chartBinding?: ReportChartBinding;
|
|
148
177
|
/** Optional QR/barcode encoding configuration; no encoder is loaded by the core. */
|
|
149
178
|
code?: CodeOptions;
|
|
150
179
|
/** Template-only binding; resolved and removed before constructing the output plan. */
|
|
@@ -261,6 +290,42 @@ declare interface ReportCellSource {
|
|
|
261
290
|
sourceToken?: string;
|
|
262
291
|
}
|
|
263
292
|
|
|
293
|
+
/** Serializable binding; data and authorization continue to come from the existing report source. */
|
|
294
|
+
declare interface ReportChartBinding {
|
|
295
|
+
dataset: string;
|
|
296
|
+
categoryField: string;
|
|
297
|
+
measures: readonly ReportChartMeasure[];
|
|
298
|
+
type: ReportChartOptions["type"];
|
|
299
|
+
sort?: "asc" | "desc";
|
|
300
|
+
title?: string;
|
|
301
|
+
showValues?: boolean;
|
|
302
|
+
maxRows?: number;
|
|
303
|
+
maxCategories?: number;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
declare interface ReportChartMeasure extends AggregateRequest {
|
|
307
|
+
label?: string;
|
|
308
|
+
color?: string;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
declare interface ReportChartOptions {
|
|
312
|
+
type: "bar" | "line" | "stackedBar" | "percentBar";
|
|
313
|
+
categories: readonly string[];
|
|
314
|
+
series: readonly ReportChartSeries[];
|
|
315
|
+
leftMm: number;
|
|
316
|
+
topMm: number;
|
|
317
|
+
widthMm: number;
|
|
318
|
+
heightMm: number;
|
|
319
|
+
title?: string;
|
|
320
|
+
showValues?: boolean;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
declare interface ReportChartSeries {
|
|
324
|
+
name: string;
|
|
325
|
+
values: readonly (number | null)[];
|
|
326
|
+
color?: string;
|
|
327
|
+
}
|
|
328
|
+
|
|
264
329
|
declare interface ReportDataTarget {
|
|
265
330
|
datasetId: string;
|
|
266
331
|
field: string;
|
|
@@ -294,6 +359,41 @@ declare interface ReportDiagnostic {
|
|
|
294
359
|
target?: ReportDataTarget;
|
|
295
360
|
}
|
|
296
361
|
|
|
362
|
+
declare interface ReportDocumentBudget {
|
|
363
|
+
maxDocuments?: number;
|
|
364
|
+
maxBytes?: number;
|
|
365
|
+
maxPages?: number;
|
|
366
|
+
maxPageBytes?: number;
|
|
367
|
+
maxManifestBytes?: number;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
declare interface ReportDocumentManifest {
|
|
371
|
+
scope: string;
|
|
372
|
+
id: string;
|
|
373
|
+
version: string;
|
|
374
|
+
/** CAS token increases after each append and completion. */
|
|
375
|
+
revision: number;
|
|
376
|
+
state: "building" | "complete" | "failed";
|
|
377
|
+
failure?: {
|
|
378
|
+
code: "cancelled" | "generation";
|
|
379
|
+
message: string;
|
|
380
|
+
};
|
|
381
|
+
pageCount: number;
|
|
382
|
+
bytes: number;
|
|
383
|
+
plan: Omit<RenderPlan, "pages">;
|
|
384
|
+
metadata?: Omit<PreparedReport, "plan">;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
declare interface ReportDocumentStore {
|
|
388
|
+
create(input: Pick<ReportDocumentManifest, "scope" | "id" | "version" | "plan">, signal?: AbortSignal): Promise<ReportDocumentManifest>;
|
|
389
|
+
append(scope: string, id: string, version: string, expectedRevision: number, page: PlanPage, signal?: AbortSignal): Promise<ReportDocumentManifest>;
|
|
390
|
+
complete(scope: string, id: string, version: string, expectedRevision: number, metadata?: Omit<PreparedReport, "plan">, signal?: AbortSignal): Promise<ReportDocumentManifest>;
|
|
391
|
+
fail(scope: string, id: string, version: string, expectedRevision: number, failure: NonNullable<ReportDocumentManifest["failure"]>): Promise<ReportDocumentManifest>;
|
|
392
|
+
read(scope: string, id: string, signal?: AbortSignal): Promise<ReportDocumentManifest | undefined>;
|
|
393
|
+
readPage(scope: string, id: string, version: string, index: number, signal?: AbortSignal): Promise<PlanPage | undefined>;
|
|
394
|
+
remove(scope: string, id: string, version: string, signal?: AbortSignal): Promise<boolean>;
|
|
395
|
+
}
|
|
396
|
+
|
|
297
397
|
export declare interface ReportExportDecision {
|
|
298
398
|
mode: "local" | "worker";
|
|
299
399
|
reason: ReportExportDecisionReason;
|
|
@@ -409,18 +509,17 @@ declare interface ReportJobTombstone {
|
|
|
409
509
|
|
|
410
510
|
declare type ReportLocalExport = (input: ReportRuntimePreparedExportInput) => Promise<ReportRuntimeExportResult>;
|
|
411
511
|
|
|
512
|
+
declare type ReportNumberRange = readonly [number, number];
|
|
513
|
+
|
|
412
514
|
/** 报表参数定义(声明式,模板自描述参数面:渲染组件据此生成查询面板) */
|
|
413
515
|
declare interface ReportParamDef {
|
|
414
516
|
/** 参数名(传入 params,与数据集 SQL #{field} 绑定对应) */
|
|
415
517
|
field: string;
|
|
416
518
|
/** 显示名(缺省用 field) */
|
|
417
519
|
label?: string;
|
|
418
|
-
type?: "text" | "number" | "date" | "month" | "year" | "dateRange" | "select";
|
|
520
|
+
type?: "text" | "number" | "date" | "month" | "year" | "dateRange" | "select" | "multiSelect" | "cascader" | "numberRange";
|
|
419
521
|
/** select 选项 */
|
|
420
|
-
options?:
|
|
421
|
-
label: string;
|
|
422
|
-
value: string;
|
|
423
|
-
}>;
|
|
522
|
+
options?: ReportParamTreeOption[];
|
|
424
523
|
/** Opaque host-resolved source key. No URL, credentials or executable code is stored. */
|
|
425
524
|
optionsSource?: string;
|
|
426
525
|
/** Select dependencies must be declared parameters; changing a parent clears descendants. */
|
|
@@ -433,6 +532,9 @@ declare interface ReportParamDef {
|
|
|
433
532
|
max?: number | string;
|
|
434
533
|
minLength?: number;
|
|
435
534
|
maxLength?: number;
|
|
535
|
+
/** multiSelect item count (maximum 100). Cascader paths are bounded to 16 levels. */
|
|
536
|
+
minItems?: number;
|
|
537
|
+
maxItems?: number;
|
|
436
538
|
}
|
|
437
539
|
|
|
438
540
|
declare interface ReportParamIssue {
|
|
@@ -442,14 +544,23 @@ declare interface ReportParamIssue {
|
|
|
442
544
|
message: string;
|
|
443
545
|
}
|
|
444
546
|
|
|
445
|
-
declare type ReportParamIssueCode = "definition" | "required" | "type" | "option" | "dependency" | "minimum" | "maximum" | "minLength" | "maxLength";
|
|
547
|
+
declare type ReportParamIssueCode = "definition" | "required" | "type" | "option" | "dependency" | "minimum" | "maximum" | "minLength" | "maxLength" | "minItems" | "maxItems";
|
|
548
|
+
|
|
549
|
+
/** Cascader values are unique within each sibling list. */
|
|
550
|
+
declare interface ReportParamTreeOption {
|
|
551
|
+
label: string;
|
|
552
|
+
value: string;
|
|
553
|
+
children?: ReportParamTreeOption[];
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
declare type ReportParamTypedValue = string | number | string[] | ReportNumberRange;
|
|
446
557
|
|
|
447
558
|
declare interface ReportParamValidation {
|
|
448
559
|
ok: boolean;
|
|
449
560
|
/** 保留历史取数契约的字符串形式;未知参数保留,不能代替接口权限白名单。 */
|
|
450
561
|
values: Record<string, string>;
|
|
451
562
|
/** JSON Schema 对应的规范值:number 参数转换为有限数字。 */
|
|
452
|
-
typedValues: Record<string,
|
|
563
|
+
typedValues: Record<string, ReportParamTypedValue>;
|
|
453
564
|
issues: ReportParamIssue[];
|
|
454
565
|
}
|
|
455
566
|
|
|
@@ -477,6 +588,8 @@ declare interface ReportRuntimeBudget {
|
|
|
477
588
|
maxRows?: number;
|
|
478
589
|
maxPages?: number;
|
|
479
590
|
maxCells?: number;
|
|
591
|
+
/** Aggregate bound-chart primitives per prepare, before expansion; default 50000, hard maximum 1000000. */
|
|
592
|
+
maxChartComponents?: number;
|
|
480
593
|
maxOutputBytes?: number;
|
|
481
594
|
/** Bound the plain JSON snapshot accepted by exportPrepared (default 64 MB). */
|
|
482
595
|
maxPreparedBytes?: number;
|
|
@@ -499,6 +612,7 @@ declare interface ReportRuntimeExportInput extends ReportRuntimeInput {
|
|
|
499
612
|
sheetMode?: "auto" | "pages" | "continuous";
|
|
500
613
|
valueMode?: "text" | "raw";
|
|
501
614
|
paperSize?: "auto" | "a3" | "a4" | "a5";
|
|
615
|
+
maxDataBars?: number;
|
|
502
616
|
sheetName?: (sheetIndex: number) => string;
|
|
503
617
|
};
|
|
504
618
|
}
|