@agile-team/mach-report 2.24.0 → 2.25.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 +4 -4
- package/dist/{ExcelBindingWizard-BV12hGiK.cjs → ExcelBindingWizard-BgJG-T6k.cjs} +1 -1
- package/dist/{ExcelBindingWizard-Cy_lPjWV.js → ExcelBindingWizard-NQ_v396s.js} +3 -3
- package/dist/{ParamEditor-DenKjvKu.cjs → ParamEditor-DEP38mBp.cjs} +1 -1
- package/dist/{ParamEditor-PyOqHzzw.js → ParamEditor-Z-3yodp5.js} +2 -2
- package/dist/{ReportBatchPanel-pQ6d0yqJ.cjs → ReportBatchPanel-D33LjMrA.cjs} +1 -1
- package/dist/{ReportBatchPanel-8EFtMrKk.js → ReportBatchPanel-DG8FV-5X.js} +2 -2
- package/dist/{ReportLabelStudio-HUeo2TsU.js → ReportLabelStudio-BZp23_hA.js} +3 -3
- package/dist/{ReportLabelStudio-B_KF3Zc_.cjs → ReportLabelStudio-Bz-xAayk.cjs} +1 -1
- package/dist/{ReportParamPanel-8xR85nz-.cjs → ReportParamPanel-B27IGJjk.cjs} +1 -1
- package/dist/{ReportParamPanel-DA-YpkvC.js → ReportParamPanel-DGXzBzl2.js} +1 -1
- package/dist/{ReportPreview-_wTJnsG1.js → ReportPreview-CilFAS9U.js} +2392 -2342
- package/dist/ReportPreview-dOOzPts2.cjs +6 -0
- package/dist/{ReportTemplateLibrary-DH8jl9IF.js → ReportTemplateLibrary-DpSGgvFa.js} +1 -1
- package/dist/{ReportTemplateLibrary-CjArKxRG.cjs → ReportTemplateLibrary-uG1gENaW.cjs} +1 -1
- package/dist/{RuleEditor-GDydlEHz.js → RuleEditor-BONALh1Q.js} +2 -3
- package/dist/{RuleEditor-Bmj98oC4.cjs → RuleEditor-bLXiRcxL.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-B554_qk1.cjs → TemplateOutlinePanel-C3nfHuaR.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-DjPqzU9h.js → TemplateOutlinePanel-JGBKeF3e.js} +2 -2
- package/dist/{TemplateReusePanel-D0628OYc.cjs → TemplateReusePanel-BKhgp6kg.cjs} +1 -1
- package/dist/{TemplateReusePanel-DtYbCN7U.js → TemplateReusePanel-DXQUO6nQ.js} +2 -2
- package/dist/{TemplateReviewPanel-CSwvCz3f.cjs → TemplateReviewPanel-5RWFUUEf.cjs} +1 -1
- package/dist/{TemplateReviewPanel-D_FR4ISq.js → TemplateReviewPanel-DhL7Hapy.js} +1 -1
- package/dist/analytics.d.cts +1 -1
- package/dist/analytics.d.ts +1 -1
- package/dist/artifact-integrity.json +98 -98
- package/dist/{assets-B4AJIOTB.cjs → assets-BYdpkTIt.cjs} +1 -1
- package/dist/{assets-D0FbszhB.js → assets-C4MIvzQ4.js} +2 -2
- package/dist/{auto-C3mGqzJ8.cjs → auto-D-eDZa_V.cjs} +1 -1
- package/dist/{auto-BksreoKc.js → auto-umW_ozwr.js} +10 -10
- package/dist/{capabilities-lqDEZSq5.js → capabilities-CN_kSVjO.js} +7 -7
- package/dist/{capabilities-CTwlcl8q.cjs → capabilities-D4nfhcvB.cjs} +1 -1
- package/dist/cell-style-B6Qffrx8.js +37 -0
- package/dist/cell-style-y_uh1pZp.cjs +1 -0
- package/dist/{data-bar-BnGtnJ82.js → data-bar-Bfh54sT4.js} +1 -1
- package/dist/{data-bar-2NLRzOCQ.cjs → data-bar-DzceAVeR.cjs} +1 -1
- package/dist/{designer-BNf7NWd6.js → designer-CCyj5WYS.js} +2254 -2248
- package/dist/designer-Cj7fn4Hh.cjs +2 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +6 -6
- package/dist/designer.d.ts +6 -6
- package/dist/designer.js +1 -1
- package/dist/diagnostic-collector-gB07PHy2.js +392 -0
- package/dist/diagnostic-collector-wASg6Fzs.cjs +1 -0
- package/dist/dom-CXWMmwh-.cjs +1 -0
- package/dist/{dom-C90cTM6Y.js → dom-DxdCMLzs.js} +185 -185
- package/dist/{encoding-DSc9zv2F.js → encoding-CEkBtlUP.js} +2 -2
- package/dist/{encoding-CkziAnZI.cjs → encoding-Cipno7dq.cjs} +1 -1
- package/dist/{font-loader-i7lZbqH_.js → font-loader-D4NLIKJL.js} +1 -1
- package/dist/{font-loader-D-znWNWS.cjs → font-loader-p_SyTvqt.cjs} +1 -1
- package/dist/{grid-strokes-BPiV1WHe.js → grid-strokes-DkZEZvcI.js} +1 -1
- package/dist/{grid-strokes-DYf-6DMl.cjs → grid-strokes-RFMR91jn.cjs} +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +137 -137
- package/dist/json-snapshot-DQdkA_At.cjs +2 -0
- package/dist/{json-snapshot-BJWZNryO.js → json-snapshot-x0JpllWL.js} +8 -8
- package/dist/{pdf-DWuq6uxx.cjs → pdf-C060D5UY.cjs} +2 -2
- package/dist/{pdf-0_5XiTCx.js → pdf-DU8HelKd.js} +17 -17
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.js +2 -2
- package/dist/{plugin-BQBz2vLG.cjs → plugin-B_k23hut.cjs} +1 -1
- package/dist/{plugin-B1ydqEmS.js → plugin-CttO46hc.js} +1 -1
- package/dist/{prefill-Cuzh1wxf.js → prefill-BkF9Fw_p.js} +2 -2
- package/dist/{prefill-2p9wrpn9.cjs → prefill-BvkuwooY.cjs} +1 -1
- package/dist/{prepared-DAwe8Il2.cjs → prepared-CSywIEAZ.cjs} +1 -1
- package/dist/{prepared-CVbgO9KR.js → prepared-Cyuh61fJ.js} +2 -2
- package/dist/protocol-BwbJNVZl.cjs +1 -0
- package/dist/protocol-DwtxjXzO.js +96 -0
- package/dist/record-bindings-B7djSjNs.cjs +1 -0
- package/dist/{record-bindings-fhav-NLG.js → record-bindings-Cv7lFiof.js} +47 -47
- package/dist/{region-binding-workflow-DWCUgjZl.cjs → region-binding-workflow-COD8nISZ.cjs} +1 -1
- package/dist/{region-binding-workflow-Cm4mqhih.js → region-binding-workflow-D8I4QWRh.js} +2 -2
- package/dist/report-encoding-worker.cjs +1 -1
- package/dist/report-encoding-worker.js +1 -1
- package/dist/{rich-text-layout-YJHtCWQI.js → rich-text-layout-Ch_N0Ubu.js} +1 -1
- package/dist/{rich-text-layout-X9YOz1JD.cjs → rich-text-layout-yJGuThtC.cjs} +1 -1
- package/dist/runtime-BE30icyB.js +227 -0
- package/dist/runtime-DRSuy_SQ.cjs +1 -0
- package/dist/sbom.cdx.json +1 -1
- package/dist/server-node.cjs +5 -5
- package/dist/server-node.js +1695 -1661
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +8 -8
- package/dist/style.css +1 -1
- package/dist/{template-catalog--yBX169M.cjs → template-catalog-C0riwrx7.cjs} +1 -1
- package/dist/{template-catalog-Bu7s7ReF.js → template-catalog-D_gl93va.js} +3 -3
- package/dist/{template-fragments-5EzVn7bm.cjs → template-fragments-CgzPdFKB.cjs} +1 -1
- package/dist/{template-fragments-Di2vDFnx.js → template-fragments-D94ZZmPc.js} +2 -2
- package/dist/{template-registry-Bnh5aEYf.cjs → template-registry-BMScUmM4.cjs} +1 -1
- package/dist/{template-registry-BCBF2b8j.js → template-registry-DZOtRY7t.js} +10 -10
- package/dist/{textwrap-CmVkhMhx.js → textwrap-BywMBMXM.js} +1 -1
- package/dist/{textwrap-BPFxhpOw.cjs → textwrap-LhJkHWb1.cjs} +1 -1
- package/dist/vue/async.d.cts +4 -4
- package/dist/vue/async.d.ts +4 -4
- package/dist/vue/index.d.cts +6 -6
- package/dist/vue/index.d.ts +6 -6
- 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-BnPK3T58.cjs → workbook-session-DR2j6Hxm.cjs} +3 -3
- package/dist/{workbook-session-B6P_-5a4.js → workbook-session-SzfILBJJ.js} +106 -107
- package/dist/worker.cjs +1 -1
- package/dist/worker.js +4 -4
- package/dist/xlsx/node.d.cts +30 -1
- package/dist/xlsx/node.d.ts +30 -1
- package/dist/xlsx-node.cjs +42 -42
- package/dist/xlsx-node.js +3908 -3889
- package/dist/xlsx.cjs +2 -2
- package/dist/xlsx.d.cts +2 -2
- package/dist/xlsx.d.ts +2 -2
- package/dist/xlsx.js +151 -151
- package/package.json +1 -1
- package/dist/ReportPreview-CyUXJSVX.cjs +0 -6
- package/dist/designer-DWnZZ_ej.cjs +0 -2
- package/dist/diagnostic-collector-1sqd7DQP.js +0 -355
- package/dist/diagnostic-collector-D3rlvxm3.cjs +0 -1
- package/dist/dom-CxOkm_Sy.cjs +0 -1
- package/dist/json-snapshot-C7QZrRBf.cjs +0 -2
- package/dist/progress-BXzlVbIp.js +0 -29
- package/dist/progress-DJBd9Rb9.cjs +0 -1
- package/dist/protocol-BOri9qJL.js +0 -105
- package/dist/protocol-DD5dHSz-.cjs +0 -1
- package/dist/record-bindings-CAyM5tGg.cjs +0 -1
- package/dist/runtime-BpSAgOw1.js +0 -201
- package/dist/runtime-Cd2UTnwe.cjs +0 -1
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
function s(o) {
|
|
2
|
-
if (o?.aborted) throw o.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
3
|
-
}
|
|
4
|
-
function u(o) {
|
|
5
|
-
try {
|
|
6
|
-
Promise.resolve(o()).catch(() => {
|
|
7
|
-
});
|
|
8
|
-
} catch {
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
function b(o, e) {
|
|
12
|
-
const r = Promise.resolve(o);
|
|
13
|
-
return e?.aborted ? (r.catch(() => {
|
|
14
|
-
}), Promise.reject(e.reason ?? new DOMException("The operation was aborted.", "AbortError"))) : e ? new Promise((i, c) => {
|
|
15
|
-
const t = () => e.removeEventListener("abort", n), n = () => {
|
|
16
|
-
t(), c(e.reason ?? new DOMException("The operation was aborted.", "AbortError"));
|
|
17
|
-
};
|
|
18
|
-
e.addEventListener("abort", n, { once: !0 }), r.then((a) => {
|
|
19
|
-
t(), i(a);
|
|
20
|
-
}, (a) => {
|
|
21
|
-
t(), c(a);
|
|
22
|
-
}), e.aborted && n();
|
|
23
|
-
}) : r;
|
|
24
|
-
}
|
|
25
|
-
export {
|
|
26
|
-
s as a,
|
|
27
|
-
u as o,
|
|
28
|
-
b as w
|
|
29
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";function i(e){if(e?.aborted)throw e.reason??new DOMException("The operation was aborted.","AbortError")}function s(e){try{Promise.resolve(e()).catch(()=>{})}catch{}}function b(e,t){const r=Promise.resolve(e);return t?.aborted?(r.catch(()=>{}),Promise.reject(t.reason??new DOMException("The operation was aborted.","AbortError"))):t?new Promise((a,c)=>{const o=()=>t.removeEventListener("abort",n),n=()=>{o(),c(t.reason??new DOMException("The operation was aborted.","AbortError"))};t.addEventListener("abort",n,{once:!0}),r.then(u=>{o(),a(u)},u=>{o(),c(u)}),t.aborted&&n()}):r}exports.assertOutputActive=i;exports.observeOutput=s;exports.waitForOutput=b;
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { e as m, f as g, b as y } from "./prepared-CVbgO9KR.js";
|
|
2
|
-
import { v as d } from "./json-snapshot-BJWZNryO.js";
|
|
3
|
-
import { u, F as h, E as a } from "./diagnostic-collector-1sqd7DQP.js";
|
|
4
|
-
import { b } from "./template-registry-BCBF2b8j.js";
|
|
5
|
-
const n = "mach-report-worker/1";
|
|
6
|
-
class D extends Error {
|
|
7
|
-
constructor(r) {
|
|
8
|
-
super(r.message), this.name = r.name, this.code = r.code, this.path = r.path, this.issues = r.issues, this.diagnostics = r.diagnostics, this.diagnosticSummary = r.diagnosticSummary, this.issueSummary = r.issueSummary;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
function i(t) {
|
|
12
|
-
return !!t && typeof t == "object" && !Array.isArray(t);
|
|
13
|
-
}
|
|
14
|
-
function I(t) {
|
|
15
|
-
return i(t) ? ["rows", "pages", "cells"].every((r) => typeof t[r] == "number" && Number.isSafeInteger(t[r]) && t[r] >= 0) && typeof t.durationMs == "number" && Number.isFinite(t.durationMs) && t.durationMs >= 0 : !1;
|
|
16
|
-
}
|
|
17
|
-
function S(t) {
|
|
18
|
-
return Array.isArray(t) && t.every((r) => i(r) && typeof r.code == "string" && typeof r.message == "string" && ["info", "warning", "error"].includes(r.severity) && d(r) && y(r));
|
|
19
|
-
}
|
|
20
|
-
function k(t) {
|
|
21
|
-
return i(t) && Object.values(t).every((r) => i(r) && (r.revision === void 0 || typeof r.revision == "string") && (r.sourceToken === void 0 || typeof r.sourceToken == "string"));
|
|
22
|
-
}
|
|
23
|
-
function x(t) {
|
|
24
|
-
return t === void 0 ? !0 : i(t) && ["heuristic", "provided", "font-bytes"].includes(t.textMetrics) && (t.fontFingerprint === void 0 || typeof t.fontFingerprint == "string" && /^[a-f0-9]{64}$/.test(t.fontFingerprint));
|
|
25
|
-
}
|
|
26
|
-
function E(t, r) {
|
|
27
|
-
if (!i(t) || !I(t.stats) || !S(t.diagnostics) || !k(t.revisions) || !x(t.layout) || !m(t.sources) || t.diagnosticSummary !== void 0 && !g(t.diagnosticSummary, t.diagnostics)) return !1;
|
|
28
|
-
if (r === "prepare") return b(t.plan).ok;
|
|
29
|
-
const e = t.format === "pdf" ? "application/pdf" : "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
30
|
-
return t.bytes instanceof Uint8Array && (t.format === "pdf" || t.format === "xlsx") && t.contentType === e;
|
|
31
|
-
}
|
|
32
|
-
function p(t) {
|
|
33
|
-
if (!t || typeof t != "object") return { message: String(t).slice(0, 4096) };
|
|
34
|
-
const r = {};
|
|
35
|
-
for (const e of ["code", "path", "field", "message"]) {
|
|
36
|
-
const o = t[e];
|
|
37
|
-
typeof o == "string" && (r[e] = o.slice(0, e === "code" ? 128 : 4096));
|
|
38
|
-
}
|
|
39
|
-
return r;
|
|
40
|
-
}
|
|
41
|
-
function l(t) {
|
|
42
|
-
const r = p(t);
|
|
43
|
-
if (!i(t)) return r;
|
|
44
|
-
for (const e of ["format", "severity", "kind", "nid"]) typeof t[e] == "string" && (r[e] = t[e].slice(0, 4096));
|
|
45
|
-
for (const e of ["pageIndex", "componentIndex"]) Number.isSafeInteger(t[e]) && t[e] >= 0 && (r[e] = t[e]);
|
|
46
|
-
if (d(t) && t.valueState !== void 0 && i(t.target)) {
|
|
47
|
-
r.valueState = t.valueState;
|
|
48
|
-
const e = {};
|
|
49
|
-
for (const o of ["datasetId", "field", "rowKey", "tableId", "reportScope"]) t.target[o] !== void 0 && (e[o] = t.target[o]);
|
|
50
|
-
r.target = e;
|
|
51
|
-
}
|
|
52
|
-
return i(t.extension) && typeof t.extension.id == "string" && typeof t.extension.version == "string" && (r.extension = { id: t.extension.id.slice(0, 128), version: t.extension.version.slice(0, 64) }), Array.isArray(t.componentPath) && t.componentPath.length <= 192 && t.componentPath.every((e) => Number.isSafeInteger(e) && e >= 0) && (r.componentPath = t.componentPath), r;
|
|
53
|
-
}
|
|
54
|
-
function f(t, r, e) {
|
|
55
|
-
const o = u(a);
|
|
56
|
-
if (h(e))
|
|
57
|
-
o.merge({ ...e, entries: e.entries.slice(0, a).map((s) => ({ code: i(s) && typeof s.code == "string" ? s.code : "unknown", value: s })) });
|
|
58
|
-
else for (const s of t) o.push({ code: i(s) && typeof s.code == "string" ? s.code : "unknown", value: s });
|
|
59
|
-
const c = o.snapshot();
|
|
60
|
-
return { ...c, entries: c.entries.map((s) => r(s.value)) };
|
|
61
|
-
}
|
|
62
|
-
function R(t) {
|
|
63
|
-
if (!(t instanceof Error)) return { name: "Error", message: String(t).slice(0, 8192) };
|
|
64
|
-
const r = t, e = Array.isArray(r.diagnostics) ? f(r.diagnostics, l, r.diagnosticSummary) : void 0, o = Array.isArray(r.issues) ? f(r.issues, p) : void 0;
|
|
65
|
-
return {
|
|
66
|
-
name: t.name.slice(0, 128),
|
|
67
|
-
message: t.message.slice(0, 8192),
|
|
68
|
-
...typeof r.code == "string" ? { code: r.code.slice(0, 128) } : {},
|
|
69
|
-
...typeof r.path == "string" ? { path: r.path.slice(0, 4096) } : {},
|
|
70
|
-
...o ? { issues: o.entries, ...o.omitted ? { issueSummary: o } : {} } : {},
|
|
71
|
-
...e ? { diagnostics: e.entries, ...e.omitted || r.diagnosticSummary !== void 0 ? { diagnosticSummary: e } : {} } : {}
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
function F(t) {
|
|
75
|
-
if (!t || typeof t != "object") return !1;
|
|
76
|
-
const r = t;
|
|
77
|
-
return r.protocol === n && typeof r.id == "string" && (r.operation === "prepare" || r.operation === "export" || r.operation === "exportPrepared") && !!r.input && typeof r.input == "object";
|
|
78
|
-
}
|
|
79
|
-
async function O(t, r, e) {
|
|
80
|
-
try {
|
|
81
|
-
const o = r.operation === "prepare" ? await t.prepare({ ...r.input, onEvent: e }) : r.operation === "exportPrepared" ? await t.exportPrepared({ ...r.input, onEvent: e }) : await t.export({ ...r.input, onEvent: e });
|
|
82
|
-
return { protocol: n, id: r.id, result: o };
|
|
83
|
-
} catch (o) {
|
|
84
|
-
return { protocol: n, id: r.id, error: R(o) };
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
function W(t) {
|
|
88
|
-
const r = t.result;
|
|
89
|
-
return !r || !("bytes" in r) || !(r.bytes.buffer instanceof ArrayBuffer) ? [] : [r.bytes.buffer];
|
|
90
|
-
}
|
|
91
|
-
function j(t, r) {
|
|
92
|
-
if (!i(t) || typeof t.taskId != "string" || !t.taskId || r.taskId !== void 0 && t.taskId !== r.taskId || t.correlationId !== r.correlationId || t.reportId !== void 0 && (typeof t.reportId != "string" || !("reportIds" in r && r.reportIds.includes(t.reportId))) || !["query", "validate", "layout", "assets", "encode"].includes(t.stage) || !["started", "completed", "failed"].includes(t.status)) return !1;
|
|
93
|
-
for (const e of ["completed", "total"]) if (t[e] !== void 0 && (typeof t[e] != "number" || !Number.isFinite(t[e]) || t[e] < 0)) return !1;
|
|
94
|
-
return t.completed === void 0 || t.total === void 0 || t.completed <= t.total;
|
|
95
|
-
}
|
|
96
|
-
export {
|
|
97
|
-
n as R,
|
|
98
|
-
W as a,
|
|
99
|
-
D as b,
|
|
100
|
-
E as c,
|
|
101
|
-
F as i,
|
|
102
|
-
O as r,
|
|
103
|
-
R as s,
|
|
104
|
-
j as v
|
|
105
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const a=require("./prepared-DAwe8Il2.cjs"),p=require("./json-snapshot-C7QZrRBf.cjs"),n=require("./diagnostic-collector-D3rlvxm3.cjs"),y=require("./template-registry-Bnh5aEYf.cjs"),c="mach-report-worker/1";class u extends Error{constructor(r){super(r.message),this.name=r.name,this.code=r.code,this.path=r.path,this.issues=r.issues,this.diagnostics=r.diagnostics,this.diagnosticSummary=r.diagnosticSummary,this.issueSummary=r.issueSummary}}function i(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function h(t){return i(t)?["rows","pages","cells"].every(r=>typeof t[r]=="number"&&Number.isSafeInteger(t[r])&&t[r]>=0)&&typeof t.durationMs=="number"&&Number.isFinite(t.durationMs)&&t.durationMs>=0:!1}function R(t){return Array.isArray(t)&&t.every(r=>i(r)&&typeof r.code=="string"&&typeof r.message=="string"&&["info","warning","error"].includes(r.severity)&&p.hasValidDataExplanation(r)&&a.validReportDiagnosticLocation(r))}function I(t){return i(t)&&Object.values(t).every(r=>i(r)&&(r.revision===void 0||typeof r.revision=="string")&&(r.sourceToken===void 0||typeof r.sourceToken=="string"))}function k(t){return t===void 0?!0:i(t)&&["heuristic","provided","font-bytes"].includes(t.textMetrics)&&(t.fontFingerprint===void 0||typeof t.fontFingerprint=="string"&&/^[a-f0-9]{64}$/.test(t.fontFingerprint))}function l(t,r){if(!i(t)||!h(t.stats)||!R(t.diagnostics)||!I(t.revisions)||!k(t.layout)||!a.validPreparedSources(t.sources)||t.diagnosticSummary!==void 0&&!a.matchingDiagnosticSummary(t.diagnosticSummary,t.diagnostics))return!1;if(r==="prepare")return y.validateRenderPlan(t.plan).ok;const e=t.format==="pdf"?"application/pdf":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";return t.bytes instanceof Uint8Array&&(t.format==="pdf"||t.format==="xlsx")&&t.contentType===e}function m(t){if(!t||typeof t!="object")return{message:String(t).slice(0,4096)};const r={};for(const e of["code","path","field","message"]){const o=t[e];typeof o=="string"&&(r[e]=o.slice(0,e==="code"?128:4096))}return r}function S(t){const r=m(t);if(!i(t))return r;for(const e of["format","severity","kind","nid"])typeof t[e]=="string"&&(r[e]=t[e].slice(0,4096));for(const e of["pageIndex","componentIndex"])Number.isSafeInteger(t[e])&&t[e]>=0&&(r[e]=t[e]);if(p.hasValidDataExplanation(t)&&t.valueState!==void 0&&i(t.target)){r.valueState=t.valueState;const e={};for(const o of["datasetId","field","rowKey","tableId","reportScope"])t.target[o]!==void 0&&(e[o]=t.target[o]);r.target=e}return i(t.extension)&&typeof t.extension.id=="string"&&typeof t.extension.version=="string"&&(r.extension={id:t.extension.id.slice(0,128),version:t.extension.version.slice(0,64)}),Array.isArray(t.componentPath)&&t.componentPath.length<=192&&t.componentPath.every(e=>Number.isSafeInteger(e)&&e>=0)&&(r.componentPath=t.componentPath),r}function f(t,r,e){const o=n.createDiagnosticCollector(n.DEFAULT_DIAGNOSTIC_LIMIT);if(n.validDiagnosticSummary(e))o.merge({...e,entries:e.entries.slice(0,n.DEFAULT_DIAGNOSTIC_LIMIT).map(s=>({code:i(s)&&typeof s.code=="string"?s.code:"unknown",value:s}))});else for(const s of t)o.push({code:i(s)&&typeof s.code=="string"?s.code:"unknown",value:s});const d=o.snapshot();return{...d,entries:d.entries.map(s=>r(s.value))}}function g(t){if(!(t instanceof Error))return{name:"Error",message:String(t).slice(0,8192)};const r=t,e=Array.isArray(r.diagnostics)?f(r.diagnostics,S,r.diagnosticSummary):void 0,o=Array.isArray(r.issues)?f(r.issues,m):void 0;return{name:t.name.slice(0,128),message:t.message.slice(0,8192),...typeof r.code=="string"?{code:r.code.slice(0,128)}:{},...typeof r.path=="string"?{path:r.path.slice(0,4096)}:{},...o?{issues:o.entries,...o.omitted?{issueSummary:o}:{}}:{},...e?{diagnostics:e.entries,...e.omitted||r.diagnosticSummary!==void 0?{diagnosticSummary:e}:{}}:{}}}function b(t){if(!t||typeof t!="object")return!1;const r=t;return r.protocol===c&&typeof r.id=="string"&&(r.operation==="prepare"||r.operation==="export"||r.operation==="exportPrepared")&&!!r.input&&typeof r.input=="object"}async function x(t,r,e){try{const o=r.operation==="prepare"?await t.prepare({...r.input,onEvent:e}):r.operation==="exportPrepared"?await t.exportPrepared({...r.input,onEvent:e}):await t.export({...r.input,onEvent:e});return{protocol:c,id:r.id,result:o}}catch(o){return{protocol:c,id:r.id,error:g(o)}}}function A(t){const r=t.result;return!r||!("bytes"in r)||!(r.bytes.buffer instanceof ArrayBuffer)?[]:[r.bytes.buffer]}function T(t,r){if(!i(t)||typeof t.taskId!="string"||!t.taskId||r.taskId!==void 0&&t.taskId!==r.taskId||t.correlationId!==r.correlationId||t.reportId!==void 0&&(typeof t.reportId!="string"||!("reportIds"in r&&r.reportIds.includes(t.reportId)))||!["query","validate","layout","assets","encode"].includes(t.stage)||!["started","completed","failed"].includes(t.status))return!1;for(const e of["completed","total"])if(t[e]!==void 0&&(typeof t[e]!="number"||!Number.isFinite(t[e])||t[e]<0))return!1;return t.completed===void 0||t.total===void 0||t.completed<=t.total}exports.REPORT_WORKER_PROTOCOL=c;exports.ReportWorkerError=u;exports.isReportWorkerRequest=b;exports.reportWorkerTransferList=A;exports.runReportWorkerRequest=x;exports.serializeError=g;exports.validReportWorkerEvent=T;exports.validReportWorkerResult=l;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const l=require("./diagnostic-collector-D3rlvxm3.cjs"),y=require("./charts-Cjw5AYkg.cjs"),g=require("./computed-DK6BruFz.cjs");function C(e){if(!e||e.kind==="date")return;const t=e.digits;if(!(t!==void 0&&(!Number.isInteger(t)||t<0||t>100))){if(e.kind==="percent"){const r=t??2;return`0${r?`.${"0".repeat(r)}`:""}%`}return t===void 0?e.thousands?"#,##0.###############":void 0:`${e.thousands?"#,##0":"0"}${t?`.${"0".repeat(t)}`:""}`}}function S(e){const t=/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/.exec(e.trim());if(t){const i=new Date(Number(t[1]),Number(t[2])-1,Number(t[3]));return Number.isNaN(i.getTime())?null:i}const r=new Date(e);return Number.isNaN(r.getTime())?null:r}function u(e,t){return e.toLocaleString("en-US",{minimumFractionDigits:t,maximumFractionDigits:t})}function x(e,t){const r=i=>String(i).padStart(2,"0");return t.replace(/YYYY/g,String(e.getFullYear())).replace(/MM/g,r(e.getMonth()+1)).replace(/DD/g,r(e.getDate())).replace(/hh/g,r(e.getHours())).replace(/mm/g,r(e.getMinutes())).replace(/ss/g,r(e.getSeconds()))}function F(e,t,r){return r!=null?t?u(e,r):e.toFixed(r):t?u(e):String(e)}function c(e){const t=typeof e=="number"?e:Number(String(e).replace(/,/g,""));return Number.isFinite(t)?t:null}function m(e,t){if(e==null||e===""||!t)return String(e??"");switch(t.kind){case"number":{if(typeof e=="string")try{return g.formatDecimal(e,t.digits,t.thousands===!0)}catch{return e}const r=c(e);return r==null?String(e):F(r,t.thousands===!0,t.digits)}case"percent":{if(typeof e=="string")try{return g.formatDecimal(e,t.digits??2,!0,!0)}catch{return e}const r=c(e);return r==null?String(e):`${u(r*100,t.digits??2)}%`}case"date":{const r=t.pattern??"YYYY-MM-DD",i=e instanceof Date?e:S(String(e));return i?x(i,r):String(e)}default:return String(e)}}function h(e,t){return g.compileReportPredicate(t)(e)}function M(e,t,r,i=e.paddingMm??1){return t.field!==e.tree.labelField?0:Math.min(r.depth*(e.tree.indentMm??3),Math.max(0,t.widthMm-i*2-4))}function L(e,t,r,i){const n=i.tree;(n.input==="nested"||[n.idField,n.parentField].includes(t.field))&&(e.editable=!1),r.hasChildren&&n.parentValues==="leaf-aggregate"&&n.aggregates?.some(a=>a.field===t.field)&&(e.derived=!0,e.editable=!1)}function T(e,t,r){return r==="identifier"||r==="dimension"||r==="date"?"center":r==="measure"?"right":r==="text"?"left":t?.kind==="number"||t?.kind==="percent"?"right":t?.kind==="date"||e instanceof Date||typeof e=="boolean"?"center":typeof e=="number"&&Number.isFinite(e)?"right":"left"}function w(e){if(e==null)return"";if(typeof e=="string"||typeof e=="number")return String(e);if(typeof e=="boolean")return e?"是":"否";if(e instanceof Date)return e.toISOString().slice(0,10);try{return JSON.stringify(e)}catch{return String(e)}}function P(e,t){let r=l.mergeComponentStyles({fontSize:e.fontSizePt??l.DEFAULT_FONT_PT,bold:e.headerBold??!0,align:"center",verticalAlign:"middle",backgroundColor:e.headerBackgroundColor},t.style);return e.headerAlign!==void 0&&(r.align=e.headerAlign),r=l.mergeComponentStyles(r,e.headerStyle),t.headerAlign!==void 0&&(r.align=t.headerAlign),l.mergeComponentStyles(r,t.headerStyle)}function A(e,t,r){(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"&&Number.isFinite(r))&&(e.value=r);const i=t.format?.kind==="number"||t.format?.kind==="percent";t.valueType!==void 0?e.valueType=t.valueType:i&&(e.valueType="number"),t.editable!==void 0&&(e.editable=t.editable);const n=C(t.format);(typeof e.value=="number"||e.value==null)&&n!==void 0&&(e.numberFormat=n)}function N(e,t,r){const i=!!t.visibleWhen&&!h(r,t.visibleWhen),n=i?null:r[t.field],a=t.align??t.style?.align??e.align??"left";let s=l.mergeComponentStyles({fontSize:e.fontSizePt??l.DEFAULT_FONT_PT,verticalAlign:"middle"},t.style);s.align=a==="auto"?T(n,t.format,t.semanticRole):a;const o=t.rules?.find(f=>h(r,f.when));o&&(s=l.mergeComponentStyles(s,o.style));const d={text:t.format?m(n,t.format):w(n),style:s};return A(d,t,n),e.computed?.some(f=>f.field===t.field)&&(d.derived=!0,d.editable=!1),i&&(d.editable=!1),d}function R(e,t,r){const i=N(e,t,r.row),n=M(e,t,r);return t.field===e.tree.labelField&&(i.style={...i.style,align:"left"}),n&&(i.indentMm=n),L(i,t,r,e),i}class I extends Error{constructor(t,r){super(`报表页数超出上限 ${t}(至少 ${r} 页)`),this.limit=t,this.actual=r,this.code="page-limit",this.name="PaginatePageLimitError"}}class O extends Error{constructor(t,r){super(`报表单元格数量超出上限 ${t}(至少 ${r} 格)`),this.limit=t,this.actual=r,this.code="cell-limit",this.name="PaginateCellLimitError"}}class E extends Error{constructor(t,r){super(`报表图表图元数量预计超出上限 ${t}(本次估算 ${r})`),this.limit=t,this.estimated=r,this.code="chart-component-limit",this.name="PaginateChartComponentLimitError"}}const b=5e4;function D(e=b){if(!Number.isSafeInteger(e)||e<1||e>1e6)throw new RangeError("maxChartComponents 应为 1..1000000 的安全整数")}function k(e,t,r){const i=e.chartBinding;if(e.kind!=="chart"||e.grid||e.imageData||e.binding||e.pageAnchor)throw new TypeError("绑定图表不能同时设置图片、网格、记录绑定或页眉页脚");const n=Object.prototype.hasOwnProperty.call(t,i.dataset)?t[i.dataset]:void 0;if(!Array.isArray(n))throw new TypeError(`图表数据集 ${i.dataset} 未提供`);return{...g.createReportChartData(n,i,r),type:i.type,leftMm:e.leftMm,topMm:e.topMm,widthMm:e.widthMm,heightMm:e.heightMm,title:i.title,showValues:i.showValues}}function v(e,t,r=b){D(r);let i=0;return Object.assign(a=>{if(!a.chartBinding)return[a];const s=k(a,e,t),o=i+(s.categories.length?y.chartComponentUpperBound(s):1);if(!Number.isSafeInteger(o))throw new RangeError("图表图元估算应为有限安全整数");if(o>r)throw new E(r,o);const d=s.categories.length?y.createChartComponents(s):[{kind:"text",leftMm:a.leftMm,topMm:a.topMm,widthMm:a.widthMm,heightMm:a.heightMm,text:"—",style:{align:"center",verticalAlign:"middle",color:"#94a3b8",fontSize:10}}];return i+=d.length,d},{used:()=>i})}function B(e){return typeof e=="string"&&/^data:image\/(png|jpe?g);base64,[A-Za-z0-9+/\r\n]+=*$/.test(e)}class p extends Error{constructor(t,r,i,n){super(`${t}: ${r}`),this.path=t,this.rowIndex=i,this.field=n,this.code="report-binding",this.name="ReportBindingError"}}function $(e,t,r={}){const i=r.rowIndex??0,a=`$.datasets.${r.dataset??"label"}[${i}].${t}`,s=Object.getOwnPropertyDescriptor(e,t);if(!s||s.get||s.set)throw new p(a,"字段必须是记录的自有数据字段,不能缺失、使用访问器或从原型继承",i,t);const o=s.value;if(o==null||typeof o=="string"||typeof o=="boolean"||typeof o=="number"&&Number.isFinite(o))return o;throw new p(a,"绑定值应为字符串、有限数字、布尔值或空值",i,t)}function _(e,t,r={}){const i=$(t,e.field,r);return i==null||i===""?e.emptyText??"":`${e.prefix??""}${m(i,e.format)}${e.suffix??""}`}exports.DEFAULT_CHART_COMPONENT_LIMIT=b;exports.PaginateCellLimitError=O;exports.PaginateChartComponentLimitError=E;exports.PaginatePageLimitError=I;exports.ReportBindingError=p;exports.applyListTreeMetadata=L;exports.createChartResolver=v;exports.evalStyleRule=h;exports.formatValue=m;exports.isLabelImageData=B;exports.listCellText=w;exports.listTreeIndent=M;exports.parseDateLocal=S;exports.readRecordScalar=$;exports.resolveComponentBinding=_;exports.resolveListAutoAlignment=T;exports.resolveListHeaderStyle=P;exports.resolveListSampleCell=N;exports.resolveTreeListSampleCell=R;exports.toExcelNumberFormat=C;exports.toNumber=c;exports.validateChartComponentLimit=D;
|
package/dist/runtime-BpSAgOw1.js
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import { E as W, u as G } from "./diagnostic-collector-1sqd7DQP.js";
|
|
2
|
-
import { d as H, m as F, s as O, a as j, g as K, h as Y, i as Z, r as ee } from "./prepared-CVbgO9KR.js";
|
|
3
|
-
import { Q as S, R as h, S as te, N as T, H as k, n as ae, J as se, M as oe, o as re } from "./json-snapshot-BJWZNryO.js";
|
|
4
|
-
import { g as M } from "./report-params-D9tBuM9B.js";
|
|
5
|
-
import { l as _, r as ne, R as ie } from "./param-validation-CnDEd2l-.js";
|
|
6
|
-
import { t as P, b as x, D as ce, v as de, c as B, R as I } from "./sha256-BDQ1Qk7A.js";
|
|
7
|
-
import { b as me } from "./template-registry-BCBF2b8j.js";
|
|
8
|
-
import { T as le } from "./template-serialization-CWmHq7lX.js";
|
|
9
|
-
import { r as A } from "./assets-D0FbszhB.js";
|
|
10
|
-
import { f as ge, P as pe, e as fe } from "./record-bindings-fhav-NLG.js";
|
|
11
|
-
function ue(e) {
|
|
12
|
-
let t = `$.pages.${e.pageIndex}`;
|
|
13
|
-
if (e.componentIndex < 0) return t;
|
|
14
|
-
t += `.components.${e.componentIndex}`;
|
|
15
|
-
const s = e.componentPath ?? [];
|
|
16
|
-
for (let n = 0; n + 1 < s.length; n += 3)
|
|
17
|
-
t += `.grid.cells.${s[n]}.${s[n + 1]}`, s[n + 2] !== void 0 && (t += `.children.${s[n + 2]}`);
|
|
18
|
-
return t;
|
|
19
|
-
}
|
|
20
|
-
function C(e = []) {
|
|
21
|
-
return e.map((t) => ({ ...t, path: ue(t) }));
|
|
22
|
-
}
|
|
23
|
-
function xe(e, t) {
|
|
24
|
-
const s = G(t ?? (e.diagnosticSummary ? W : void 0));
|
|
25
|
-
return e.diagnosticSummary ? s.merge(e.diagnosticSummary) : e.diagnostics.forEach((n) => s.push(n)), s;
|
|
26
|
-
}
|
|
27
|
-
function J(e, t) {
|
|
28
|
-
t.diagnosticSummary ? e.merge({ ...t.diagnosticSummary, entries: C(t.diagnosticSummary.entries) }) : C(t.diagnostics).forEach((s) => e.push(s));
|
|
29
|
-
}
|
|
30
|
-
function we(e) {
|
|
31
|
-
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");
|
|
32
|
-
if (e.fidelity === "strict" && s) throw new h("validate", "严格输出拒绝已有资产渲染降级,请修复组件后重新准备报表。");
|
|
33
|
-
}
|
|
34
|
-
async function N(e, t, s = Date.now()) {
|
|
35
|
-
const n = e.prepared;
|
|
36
|
-
H(e, t), we(e);
|
|
37
|
-
const a = xe(n, e.diagnosticLimit), o = e.format === "pdf" ? await import("@agile-team/mach-report/pdf") : void 0;
|
|
38
|
-
P(e.signal);
|
|
39
|
-
const m = e.pdf?.customFontFaces ?? (e.pdf?.customFontBytes ? { regular: e.pdf.customFontBytes } : void 0), l = o && m ? o.createFontBytesMeasurer(m) : void 0, d = S(e), i = await d.run("encode", async () => {
|
|
40
|
-
let g;
|
|
41
|
-
const y = { fidelity: e.fidelity, diagnosticLimit: e.diagnosticLimit ?? (n.diagnosticSummary ? W : void 0), signal: e.signal, onProgress: (r, f) => d.progress("encode", r, f) };
|
|
42
|
-
if (e.format === "pdf") {
|
|
43
|
-
P(e.signal);
|
|
44
|
-
const r = await o.renderPlanToPdf(n.plan, { ...e.pdf, ...l ? { measurer: l } : {}, ...y });
|
|
45
|
-
g = r.bytes, J(a, r), F(a, "pdf-fidelity", r.fidelityWarnings, "warning", r.fidelityWarningCount), F(a, "pdf-page", r.pageErrors, "error", r.pageErrorCount), r.unsupportedTextCount && a.push({ code: "pdf-font", message: `${r.unsupportedTextCount} 段文本包含当前字体不支持的字符`, severity: "warning" });
|
|
46
|
-
} else {
|
|
47
|
-
const { renderPlanToXlsx: r } = await import("@agile-team/mach-report/xlsx");
|
|
48
|
-
P(e.signal);
|
|
49
|
-
const f = await r(n.plan, { ...e.xlsx, ...y });
|
|
50
|
-
g = new Uint8Array(f.buffer), J(a, f), F(a, "xlsx-fidelity", f.warnings, "warning", f.warningCount), f.notes?.forEach((R) => a.push({ code: "xlsx-snapshot", message: R, severity: "info" }));
|
|
51
|
-
}
|
|
52
|
-
return P(e.signal), g;
|
|
53
|
-
});
|
|
54
|
-
x(t, "maxOutputBytes", i.byteLength);
|
|
55
|
-
const { plan: w, ...u } = n;
|
|
56
|
-
return {
|
|
57
|
-
...u,
|
|
58
|
-
diagnostics: a.entries,
|
|
59
|
-
...e.diagnosticLimit === void 0 && !n.diagnosticSummary ? {} : { diagnosticSummary: a.snapshot() },
|
|
60
|
-
bytes: i,
|
|
61
|
-
format: e.format,
|
|
62
|
-
contentType: e.format === "pdf" ? "application/pdf" : "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
63
|
-
stats: { ...u.stats, durationMs: Date.now() - s, outputBytes: i.byteLength }
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
function U(e) {
|
|
67
|
-
return { ...e, reportIds: [...e.reportIds], ...e.params ? { params: { ...e.params } } : {} };
|
|
68
|
-
}
|
|
69
|
-
function Q(e, t) {
|
|
70
|
-
if (t.length === 0) throw new h("config", "缺少报表 ID");
|
|
71
|
-
return t.map((s) => {
|
|
72
|
-
if (!Object.prototype.hasOwnProperty.call(e, s)) throw new h("config", `未注册报表 ${s}`);
|
|
73
|
-
return e[s];
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
function L(e) {
|
|
77
|
-
return e.grid?.cells.reduce((t, s) => t + s.reduce((n, a) => n + (a ? 1 + (a.children?.reduce((o, m) => o + L(m), 0) ?? 0) : 0), 0), 0) ?? 0;
|
|
78
|
-
}
|
|
79
|
-
function ye(e, t, s) {
|
|
80
|
-
return e.pages.reduce((n, a) => n + a.components.reduce((o, m) => m.kind !== "list" ? o + L(m) : o + re(m, t, s), 0), 0);
|
|
81
|
-
}
|
|
82
|
-
function he(e, t = Object.keys(e)) {
|
|
83
|
-
return Q(e, t).map((s, n) => {
|
|
84
|
-
const a = t[n], o = M(e, [a]);
|
|
85
|
-
return {
|
|
86
|
-
id: a,
|
|
87
|
-
params: JSON.parse(JSON.stringify(o)),
|
|
88
|
-
paramsSchema: ne(o),
|
|
89
|
-
datasetsSchema: Object.fromEntries(Object.entries(s.dataSchema ?? {}).map(([m, l]) => [m, te(typeof s.template == "function" ? void 0 : s.template, m, l)])),
|
|
90
|
-
capabilities: {
|
|
91
|
-
save: !!s.provider?.save,
|
|
92
|
-
export: !!s.provider?.export,
|
|
93
|
-
templates: !!s.provider?.templates
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
function X(e, t) {
|
|
99
|
-
Q(e, t.reportIds);
|
|
100
|
-
const s = _(M(e, t.reportIds), t.params), n = t.reportIds.flatMap((o) => _(M(e, [o]), t.params).issues), a = new Map(n.map((o) => [JSON.stringify(o), o]));
|
|
101
|
-
return { ...s, ok: a.size === 0, issues: [...a.values()] };
|
|
102
|
-
}
|
|
103
|
-
function V(e, t) {
|
|
104
|
-
const s = me(e.plan);
|
|
105
|
-
if (!s.ok) throw new h("validate", `执行器返回无效计划:${s.errors[0]?.path}`);
|
|
106
|
-
const n = e.plan.pages.length, a = e.plan.pages.reduce((o, m) => o + m.components.reduce((l, d) => l + L(d), 0), 0);
|
|
107
|
-
return x(t, "maxRows", e.stats.rows), x(t, "maxPages", n), x(t, "maxCells", a), { ...e, stats: { ...e.stats, pages: n, cells: a } };
|
|
108
|
-
}
|
|
109
|
-
function q(e, t) {
|
|
110
|
-
const s = X(e.reports, t);
|
|
111
|
-
if (!s.ok) throw new ie(s.issues);
|
|
112
|
-
}
|
|
113
|
-
function Fe(e) {
|
|
114
|
-
const t = { ...ce, ...e.budget };
|
|
115
|
-
de(t);
|
|
116
|
-
const s = async (a, o) => {
|
|
117
|
-
const m = Date.now();
|
|
118
|
-
let l = 0, d = 0;
|
|
119
|
-
const i = G(a.diagnosticLimit), w = {}, u = [], g = Object.fromEntries(Object.entries(e.reports).map(([c, p]) => [c, {
|
|
120
|
-
...p,
|
|
121
|
-
pagination: { ...e.pagination, ...p.pagination, ...o ? { measurer: o } : {} },
|
|
122
|
-
dataValidation: {
|
|
123
|
-
...p.dataValidation,
|
|
124
|
-
maxRows: Math.min(t.maxRows ?? 1e5, p.dataValidation?.maxRows ?? 1 / 0),
|
|
125
|
-
maxCells: Math.min(t.maxCells ?? 2e6, p.dataValidation?.maxCells ?? 1 / 0)
|
|
126
|
-
}
|
|
127
|
-
}])), r = await ae(g, { maxPages: t.maxPages, maxCells: t.maxCells, maxChartComponents: t.maxChartComponents, onDatasets: (c, p, v) => {
|
|
128
|
-
try {
|
|
129
|
-
l += se(v, p, { maxRows: t.maxRows, signal: a.signal });
|
|
130
|
-
} catch (b) {
|
|
131
|
-
throw b instanceof le ? new I("budget", b.message, "$.budget.maxRows") : b;
|
|
132
|
-
}
|
|
133
|
-
x(t, "maxRows", l), d += ye(v, p, g[c]?.pagination), x(t, "maxCells", d);
|
|
134
|
-
} })({ ...a, params: a.params ?? {}, onWarning: (c) => i.push({ code: "layout", message: c, severity: "warning" }), onQueryResult: (c, p, v = 0) => {
|
|
135
|
-
const b = oe(v, c);
|
|
136
|
-
Object.defineProperty(w, c, { value: { revision: p.revision, sourceToken: p.sourceToken }, enumerable: !0, writable: !0 }), u.push({ reportId: c, reportIndex: v, reportScope: b, ...p.revision === void 0 ? {} : { revision: p.revision }, ...p.sourceToken === void 0 ? {} : { sourceToken: p.sourceToken } }), (p.diagnostics ?? []).forEach((E) => i.push({ ...E, ...E.target ? { target: {
|
|
137
|
-
...E.target,
|
|
138
|
-
reportScope: b,
|
|
139
|
-
...E.target.tableId ? { tableId: JSON.stringify([v, c, E.target.tableId]) } : {}
|
|
140
|
-
} } : {} }));
|
|
141
|
-
} }).catch((c) => {
|
|
142
|
-
throw c instanceof h && c.cause instanceof ge ? new I("budget", c.cause.message, "$.budget.maxPages") : c instanceof h && c.cause instanceof pe ? new I("budget", c.cause.message, "$.budget.maxCells") : c instanceof h && c.cause instanceof fe ? new I("budget", c.cause.message, "$.budget.maxChartComponents") : c;
|
|
143
|
-
});
|
|
144
|
-
P(a.signal);
|
|
145
|
-
const f = e.assets ? await S(a).run("assets", () => A(r, { ...e.assets, diagnosticLimit: a.diagnosticLimit, signal: a.signal })) : { plan: r, diagnostics: [] }, R = f.plan;
|
|
146
|
-
f.diagnosticSummary ? i.merge({ ...f.diagnosticSummary, entries: C(f.diagnosticSummary.entries) }) : C(f.diagnostics).forEach((c) => i.push(c));
|
|
147
|
-
const $ = R.pages.reduce((c, p) => c + p.components.reduce((v, b) => v + L(b), 0), 0);
|
|
148
|
-
x(t, "maxPages", R.pages.length), x(t, "maxCells", $);
|
|
149
|
-
const D = ee(a.pdf), z = e.pagination?.measurer || Object.values(e.reports).some((c) => c.pagination?.measurer);
|
|
150
|
-
return { plan: R, diagnostics: i.entries, ...a.diagnosticLimit === void 0 ? {} : { diagnosticSummary: i.snapshot() }, revisions: w, sources: u, layout: { textMetrics: D ? "font-bytes" : z ? "provided" : "heuristic", ...D ? { fontFingerprint: D } : {} }, stats: { rows: l, pages: R.pages.length, cells: $, durationMs: Date.now() - m } };
|
|
151
|
-
}, n = async (a) => {
|
|
152
|
-
const o = Date.now();
|
|
153
|
-
if (a.format !== "pdf" && a.format !== "xlsx") throw new h("config", "不支持的报表导出格式");
|
|
154
|
-
const m = a.format === "pdf" ? await import("@agile-team/mach-report/pdf") : void 0;
|
|
155
|
-
P(a.signal);
|
|
156
|
-
const l = a.pdf?.customFontFaces ?? (a.pdf?.customFontBytes ? { regular: a.pdf.customFontBytes } : void 0), d = m && l ? m.createFontBytesMeasurer(l) : void 0, i = await s(a, d);
|
|
157
|
-
return P(a.signal), N({ ...a, prepared: i }, t, o);
|
|
158
|
-
};
|
|
159
|
-
return {
|
|
160
|
-
describe: (a) => he(e.reports, a),
|
|
161
|
-
validate: (a) => X(e.reports, a),
|
|
162
|
-
prepare: (a) => B(a.signal, t.maxDurationMs, async (o) => {
|
|
163
|
-
const { signal: m, onEvent: l, ...d } = U(a), i = { ...d, ...d.pdf ? { pdf: O(d.pdf) } : {}, taskId: d.taskId ?? T() }, w = l ? (f) => k(l, f, o) : void 0, u = { ...i, signal: o, onEvent: w };
|
|
164
|
-
S(u).runSync("validate", () => q(e, i));
|
|
165
|
-
let g;
|
|
166
|
-
const y = i.pdf?.customFontFaces ?? (i.pdf?.customFontBytes ? { regular: i.pdf.customFontBytes } : void 0);
|
|
167
|
-
if (!e.executor && y) {
|
|
168
|
-
const f = await import("@agile-team/mach-report/pdf");
|
|
169
|
-
P(o), g = f.createFontBytesMeasurer(y);
|
|
170
|
-
}
|
|
171
|
-
const r = e.executor ? await e.executor.prepare(i, o, w) : await s(u, g);
|
|
172
|
-
return V(r, t);
|
|
173
|
-
}),
|
|
174
|
-
exportPrepared: (a) => B(a.signal, t.maxDurationMs, async (o) => {
|
|
175
|
-
const m = Date.now(), { signal: l, onEvent: d, ...i } = a, w = V(K(a.prepared, t.maxPreparedBytes ?? 64e6, o), t), u = { ...i, xlsx: j(i.xlsx), prepared: w, ...i.pdf ? { pdf: O(i.pdf) } : {}, taskId: i.taskId ?? T() };
|
|
176
|
-
if (u.format !== "pdf" && u.format !== "xlsx") throw new h("config", "不支持的报表导出格式");
|
|
177
|
-
const g = d ? (r) => k(d, r, o) : void 0;
|
|
178
|
-
if (e.executor) {
|
|
179
|
-
if (!e.executor.exportPrepared) throw new h("config", "执行器未实现 exportPrepared;请升级执行器或显式使用本地运行时");
|
|
180
|
-
const r = await e.executor.exportPrepared(u, o, g);
|
|
181
|
-
return x(t, "maxRows", r.stats.rows), x(t, "maxPages", r.stats.pages), x(t, "maxCells", r.stats.cells), x(t, "maxOutputBytes", r.bytes.byteLength), { ...r, stats: { ...r.stats, outputBytes: r.bytes.byteLength } };
|
|
182
|
-
}
|
|
183
|
-
const y = { ...u, signal: o, onEvent: g };
|
|
184
|
-
if (S(y).runSync("validate", () => Y(y)), e.assets) {
|
|
185
|
-
const r = await S(y).run("assets", () => A(w.plan, { ...e.assets, diagnosticLimit: a.diagnosticLimit, signal: o }));
|
|
186
|
-
w.plan = r.plan, Z(w, C(r.diagnostics), r.diagnosticSummary ? { ...r.diagnosticSummary, entries: C(r.diagnosticSummary.entries) } : void 0, a.diagnosticLimit);
|
|
187
|
-
}
|
|
188
|
-
return N(y, t, m);
|
|
189
|
-
}),
|
|
190
|
-
export: (a) => B(a.signal, t.maxDurationMs, async (o) => {
|
|
191
|
-
const { signal: m, onEvent: l, ...d } = U(a), i = { ...d, xlsx: j(d.xlsx), ...d.pdf ? { pdf: O(d.pdf) } : {}, taskId: d.taskId ?? T() }, w = l ? (y) => k(l, y, o) : void 0, u = { ...i, signal: o, onEvent: w };
|
|
192
|
-
if (S(u).runSync("validate", () => q(e, i)), i.format !== "pdf" && i.format !== "xlsx") throw new h("config", "不支持的报表导出格式");
|
|
193
|
-
const g = e.executor ? await e.executor.export(i, o, w) : await n(u);
|
|
194
|
-
return x(t, "maxRows", g.stats.rows), x(t, "maxPages", g.stats.pages), x(t, "maxCells", g.stats.cells), x(t, "maxOutputBytes", g.bytes.byteLength), { ...g, stats: { ...g.stats, outputBytes: g.bytes.byteLength } };
|
|
195
|
-
})
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
export {
|
|
199
|
-
Fe as c,
|
|
200
|
-
V as e
|
|
201
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var V=Object.create;var M=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var X=Object.getPrototypeOf,z=Object.prototype.hasOwnProperty;var Q=(e,t,a,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of W(t))!z.call(e,s)&&s!==a&&M(e,s,{get:()=>t[s],enumerable:!(o=G(t,s))||o.enumerable});return e};var I=(e,t,a)=>(a=e!=null?V(X(e)):{},Q(t||!e||!e.__esModule?M(a,"default",{value:e,enumerable:!0}):a,e));const B=require("./diagnostic-collector-D3rlvxm3.cjs"),v=require("./prepared-DAwe8Il2.cjs"),d=require("./json-snapshot-C7QZrRBf.cjs"),L=require("./report-params-VTg8MoCp.cjs"),C=require("./param-validation-C-8sRJLq.cjs"),i=require("./sha256-DgZAKXqI.cjs"),H=require("./template-registry-Bnh5aEYf.cjs"),K=require("./template-serialization-CqQY4zDg.cjs"),A=require("./assets-B4AJIOTB.cjs"),k=require("./record-bindings-CAyM5tGg.cjs");function Y(e){let t=`$.pages.${e.pageIndex}`;if(e.componentIndex<0)return t;t+=`.components.${e.componentIndex}`;const a=e.componentPath??[];for(let o=0;o+1<a.length;o+=3)t+=`.grid.cells.${a[o]}.${a[o+1]}`,a[o+2]!==void 0&&(t+=`.children.${a[o+2]}`);return t}function S(e=[]){return e.map(t=>({...t,path:Y(t)}))}function Z(e,t){const a=B.createDiagnosticCollector(t??(e.diagnosticSummary?B.DEFAULT_DIAGNOSTIC_LIMIT:void 0));return e.diagnosticSummary?a.merge(e.diagnosticSummary):e.diagnostics.forEach(o=>a.push(o)),a}function $(e,t){t.diagnosticSummary?e.merge({...t.diagnosticSummary,entries:S(t.diagnosticSummary.entries)}):S(t.diagnostics).forEach(a=>e.push(a))}function ee(e){const t=e.prepared.diagnosticSummary?.counts,a=t?!!(t["asset-render-failed"]||t["asset-budget-exceeded"]):e.prepared.diagnostics.some(o=>o.code==="asset-render-failed"||o.code==="asset-budget-exceeded");if(e.fidelity==="strict"&&a)throw new d.ReportSourceError("validate","严格输出拒绝已有资产渲染降级,请修复组件后重新准备报表。")}async function q(e,t,a=Date.now()){const o=e.prepared;v.assertPreparedOutputBudget(e,t),ee(e);const s=Z(o,e.diagnosticLimit),r=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),l=r&&g?r.createFontBytesMeasurer(g):void 0,m=d.createReportTaskReporter(e),c=await m.run("encode",async()=>{let u;const y={fidelity:e.fidelity,diagnosticLimit:e.diagnosticLimit??(o.diagnosticSummary?B.DEFAULT_DIAGNOSTIC_LIMIT:void 0),signal:e.signal,onProgress:(n,x)=>m.progress("encode",n,x)};if(e.format==="pdf"){i.throwIfAborted(e.signal);const n=await r.renderPlanToPdf(o.plan,{...e.pdf,...l?{measurer:l}:{},...y});u=n.bytes,$(s,n),v.mergeDiagnosticMessages(s,"pdf-fidelity",n.fidelityWarnings,"warning",n.fidelityWarningCount),v.mergeDiagnosticMessages(s,"pdf-page",n.pageErrors,"error",n.pageErrorCount),n.unsupportedTextCount&&s.push({code:"pdf-font",message:`${n.unsupportedTextCount} 段文本包含当前字体不支持的字符`,severity:"warning"})}else{const{renderPlanToXlsx:n}=await import("@agile-team/mach-report/xlsx");i.throwIfAborted(e.signal);const x=await n(o.plan,{...e.xlsx,...y});u=new Uint8Array(x.buffer),$(s,x),v.mergeDiagnosticMessages(s,"xlsx-fidelity",x.warnings,"warning",x.warningCount),x.notes?.forEach(P=>s.push({code:"xlsx-snapshot",message:P,severity:"info"}))}return i.throwIfAborted(e.signal),u});i.assertBudget(t,"maxOutputBytes",c.byteLength);const{plan:h,...w}=o;return{...w,diagnostics:s.entries,...e.diagnosticLimit===void 0&&!o.diagnosticSummary?{}:{diagnosticSummary:s.snapshot()},bytes:c,format:e.format,contentType:e.format==="pdf"?"application/pdf":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",stats:{...w.stats,durationMs:Date.now()-a,outputBytes:c.byteLength}}}function _(e){return{...e,reportIds:[...e.reportIds],...e.params?{params:{...e.params}}:{}}}function N(e,t){if(t.length===0)throw new d.ReportSourceError("config","缺少报表 ID");return t.map(a=>{if(!Object.prototype.hasOwnProperty.call(e,a))throw new d.ReportSourceError("config",`未注册报表 ${a}`);return e[a]})}function T(e){return e.grid?.cells.reduce((t,a)=>t+a.reduce((o,s)=>o+(s?1+(s.children?.reduce((r,g)=>r+T(g),0)??0):0),0),0)??0}function te(e,t,a){return e.pages.reduce((o,s)=>o+s.components.reduce((r,g)=>g.kind!=="list"?r+T(g):r+d.estimateListLayoutCells(g,t,a),0),0)}function se(e,t=Object.keys(e)){return N(e,t).map((a,o)=>{const s=t[o],r=L.getReportParamDefs(e,[s]);return{id:s,params:JSON.parse(JSON.stringify(r)),paramsSchema:C.reportParamsJsonSchema(r),datasetsSchema:Object.fromEntries(Object.entries(a.dataSchema??{}).map(([g,l])=>[g,d.templateDatasetJsonSchema(typeof a.template=="function"?void 0:a.template,g,l)])),capabilities:{save:!!a.provider?.save,export:!!a.provider?.export,templates:!!a.provider?.templates}}})}function J(e,t){N(e,t.reportIds);const a=C.validateReportParams(L.getReportParamDefs(e,t.reportIds),t.params),o=t.reportIds.flatMap(r=>C.validateReportParams(L.getReportParamDefs(e,[r]),t.params).issues),s=new Map(o.map(r=>[JSON.stringify(r),r]));return{...a,ok:s.size===0,issues:[...s.values()]}}function F(e,t){const a=H.validateRenderPlan(e.plan);if(!a.ok)throw new d.ReportSourceError("validate",`执行器返回无效计划:${a.errors[0]?.path}`);const o=e.plan.pages.length,s=e.plan.pages.reduce((r,g)=>r+g.components.reduce((l,m)=>l+T(m),0),0);return i.assertBudget(t,"maxRows",e.stats.rows),i.assertBudget(t,"maxPages",o),i.assertBudget(t,"maxCells",s),{...e,stats:{...e.stats,pages:o,cells:s}}}function j(e,t){const a=J(e.reports,t);if(!a.ok)throw new C.ReportParamValidationError(a.issues)}function ae(e){const t={...i.DEFAULT_REPORT_RUNTIME_BUDGET,...e.budget};i.validateBudget(t);const a=async(s,r)=>{const g=Date.now();let l=0,m=0;const c=B.createDiagnosticCollector(s.diagnosticLimit),h={},w=[],u=Object.fromEntries(Object.entries(e.reports).map(([p,f])=>[p,{...f,pagination:{...e.pagination,...f.pagination,...r?{measurer:r}:{}},dataValidation:{...f.dataValidation,maxRows:Math.min(t.maxRows??1e5,f.dataValidation?.maxRows??1/0),maxCells:Math.min(t.maxCells??2e6,f.dataValidation?.maxCells??1/0)}}])),n=await d.createReportSource(u,{maxPages:t.maxPages,maxCells:t.maxCells,maxChartComponents:t.maxChartComponents,onDatasets:(p,f,R)=>{try{l+=d.templateDatasetRowCount(R,f,{maxRows:t.maxRows,signal:s.signal})}catch(b){throw b instanceof K.TreeRowLimitError?new i.ReportRuntimeError("budget",b.message,"$.budget.maxRows"):b}i.assertBudget(t,"maxRows",l),m+=te(R,f,u[p]?.pagination),i.assertBudget(t,"maxCells",m)}})({...s,params:s.params??{},onWarning:p=>c.push({code:"layout",message:p,severity:"warning"}),onQueryResult:(p,f,R=0)=>{const b=d.reportOccurrenceScope(R,p);Object.defineProperty(h,p,{value:{revision:f.revision,sourceToken:f.sourceToken},enumerable:!0,writable:!0}),w.push({reportId:p,reportIndex:R,reportScope:b,...f.revision===void 0?{}:{revision:f.revision},...f.sourceToken===void 0?{}:{sourceToken:f.sourceToken}}),(f.diagnostics??[]).forEach(E=>c.push({...E,...E.target?{target:{...E.target,reportScope:b,...E.target.tableId?{tableId:JSON.stringify([R,p,E.target.tableId])}:{}}}:{}}))}}).catch(p=>{throw p instanceof d.ReportSourceError&&p.cause instanceof k.PaginatePageLimitError?new i.ReportRuntimeError("budget",p.cause.message,"$.budget.maxPages"):p instanceof d.ReportSourceError&&p.cause instanceof k.PaginateCellLimitError?new i.ReportRuntimeError("budget",p.cause.message,"$.budget.maxCells"):p instanceof d.ReportSourceError&&p.cause instanceof k.PaginateChartComponentLimitError?new i.ReportRuntimeError("budget",p.cause.message,"$.budget.maxChartComponents"):p});i.throwIfAborted(s.signal);const x=e.assets?await d.createReportTaskReporter(s).run("assets",()=>A.resolvePlanAssets(n,{...e.assets,diagnosticLimit:s.diagnosticLimit,signal:s.signal})):{plan:n,diagnostics:[]},P=x.plan;x.diagnosticSummary?c.merge({...x.diagnosticSummary,entries:S(x.diagnosticSummary.entries)}):S(x.diagnostics).forEach(p=>c.push(p));const O=P.pages.reduce((p,f)=>p+f.components.reduce((R,b)=>R+T(b),0),0);i.assertBudget(t,"maxPages",P.pages.length),i.assertBudget(t,"maxCells",O);const D=v.reportFontFingerprint(s.pdf),U=e.pagination?.measurer||Object.values(e.reports).some(p=>p.pagination?.measurer);return{plan:P,diagnostics:c.entries,...s.diagnosticLimit===void 0?{}:{diagnosticSummary:c.snapshot()},revisions:h,sources:w,layout:{textMetrics:D?"font-bytes":U?"provided":"heuristic",...D?{fontFingerprint:D}:{}},stats:{rows:l,pages:P.pages.length,cells:O,durationMs:Date.now()-g}}},o=async s=>{const r=Date.now();if(s.format!=="pdf"&&s.format!=="xlsx")throw new d.ReportSourceError("config","不支持的报表导出格式");const g=s.format==="pdf"?await import("@agile-team/mach-report/pdf"):void 0;i.throwIfAborted(s.signal);const l=s.pdf?.customFontFaces??(s.pdf?.customFontBytes?{regular:s.pdf.customFontBytes}:void 0),m=g&&l?g.createFontBytesMeasurer(l):void 0,c=await a(s,m);return i.throwIfAborted(s.signal),q({...s,prepared:c},t,r)};return{describe:s=>se(e.reports,s),validate:s=>J(e.reports,s),prepare:s=>i.controlled(s.signal,t.maxDurationMs,async r=>{const{signal:g,onEvent:l,...m}=_(s),c={...m,...m.pdf?{pdf:v.snapshotPdfFonts(m.pdf)}:{},taskId:m.taskId??d.reportTaskId()},h=l?x=>d.notifyReportTaskEvent(l,x,r):void 0,w={...c,signal:r,onEvent:h};d.createReportTaskReporter(w).runSync("validate",()=>j(e,c));let u;const y=c.pdf?.customFontFaces??(c.pdf?.customFontBytes?{regular:c.pdf.customFontBytes}:void 0);if(!e.executor&&y){const x=await import("@agile-team/mach-report/pdf");i.throwIfAborted(r),u=x.createFontBytesMeasurer(y)}const n=e.executor?await e.executor.prepare(c,r,h):await a(w,u);return F(n,t)}),exportPrepared:s=>i.controlled(s.signal,t.maxDurationMs,async r=>{const g=Date.now(),{signal:l,onEvent:m,...c}=s,h=F(v.snapshotPreparedReport(s.prepared,t.maxPreparedBytes??64e6,r),t),w={...c,xlsx:v.snapshotXlsxOptions(c.xlsx),prepared:h,...c.pdf?{pdf:v.snapshotPdfFonts(c.pdf)}:{},taskId:c.taskId??d.reportTaskId()};if(w.format!=="pdf"&&w.format!=="xlsx")throw new d.ReportSourceError("config","不支持的报表导出格式");const u=m?n=>d.notifyReportTaskEvent(m,n,r):void 0;if(e.executor){if(!e.executor.exportPrepared)throw new d.ReportSourceError("config","执行器未实现 exportPrepared;请升级执行器或显式使用本地运行时");const n=await e.executor.exportPrepared(w,r,u);return i.assertBudget(t,"maxRows",n.stats.rows),i.assertBudget(t,"maxPages",n.stats.pages),i.assertBudget(t,"maxCells",n.stats.cells),i.assertBudget(t,"maxOutputBytes",n.bytes.byteLength),{...n,stats:{...n.stats,outputBytes:n.bytes.byteLength}}}const y={...w,signal:r,onEvent:u};if(d.createReportTaskReporter(y).runSync("validate",()=>v.checkPreparedFont(y)),e.assets){const n=await d.createReportTaskReporter(y).run("assets",()=>A.resolvePlanAssets(h.plan,{...e.assets,diagnosticLimit:s.diagnosticLimit,signal:r}));h.plan=n.plan,v.appendPreparedDiagnostics(h,S(n.diagnostics),n.diagnosticSummary?{...n.diagnosticSummary,entries:S(n.diagnosticSummary.entries)}:void 0,s.diagnosticLimit)}return q(y,t,g)}),export:s=>i.controlled(s.signal,t.maxDurationMs,async r=>{const{signal:g,onEvent:l,...m}=_(s),c={...m,xlsx:v.snapshotXlsxOptions(m.xlsx),...m.pdf?{pdf:v.snapshotPdfFonts(m.pdf)}:{},taskId:m.taskId??d.reportTaskId()},h=l?y=>d.notifyReportTaskEvent(l,y,r):void 0,w={...c,signal:r,onEvent:h};if(d.createReportTaskReporter(w).runSync("validate",()=>j(e,c)),c.format!=="pdf"&&c.format!=="xlsx")throw new d.ReportSourceError("config","不支持的报表导出格式");const u=e.executor?await e.executor.export(c,r,h):await o(w);return 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.createReportRuntime=ae;exports.enforcePrepared=F;
|