@agile-team/mach-report 2.25.2 → 2.26.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 +12 -8
- package/dist/ExcelBindingWizard-B418l44t.js +1578 -0
- package/dist/ExcelBindingWizard-C4FGVsY_.cjs +1 -0
- package/dist/{ParamEditor-CGfaweYX.cjs → ParamEditor-BemJE8n8.cjs} +1 -1
- package/dist/{ParamEditor-B7YVD28E.js → ParamEditor-XvMtf_XQ.js} +2 -2
- package/dist/{ReportBatchPanel-BRJt0TXp.cjs → ReportBatchPanel-CbY4fvXD.cjs} +1 -1
- package/dist/{ReportBatchPanel-BTKHtLTW.js → ReportBatchPanel-Ds0R_uXn.js} +37 -37
- package/dist/{ReportLabelStudio-BvK_WBke.cjs → ReportLabelStudio-DuTwN5er.cjs} +1 -1
- package/dist/{ReportLabelStudio-CZwqyO3t.js → ReportLabelStudio-ZFy79eRv.js} +26 -26
- package/dist/ReportParamPanel-Chxu4MTx.cjs +1 -0
- package/dist/{ReportParamPanel-DGXzBzl2.js → ReportParamPanel-Czm3OPo_.js} +216 -205
- package/dist/{ReportPreview-D1ZC5kzz.js → ReportPreview-C9c0Rp7Y.js} +2938 -2875
- package/dist/ReportPreview-CIMR4ERo.cjs +6 -0
- package/dist/{ReportTemplateLibrary-ClwxhnC0.cjs → ReportTemplateLibrary-C6lByc69.cjs} +1 -1
- package/dist/{ReportTemplateLibrary-C7sB0Jay.js → ReportTemplateLibrary-XJVoTDIz.js} +1 -1
- package/dist/{RuleEditor-CsDGFaWz.js → RuleEditor-CeNFPeOc.js} +5 -5
- package/dist/{RuleEditor-D-OdaGdR.cjs → RuleEditor-gggUkEwB.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-DAqR9zQi.cjs → TemplateOutlinePanel-B0e-umq2.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-CXOT7d1r.js → TemplateOutlinePanel-BWN4Y9iz.js} +2 -2
- package/dist/{TemplateReusePanel-Dcfx3Hba.js → TemplateReusePanel-CR-4OHoU.js} +2 -2
- package/dist/{TemplateReusePanel-ygIi-Ajz.cjs → TemplateReusePanel-Cthig1S1.cjs} +1 -1
- package/dist/{TemplateReviewPanel-COU8FqPq.js → TemplateReviewPanel-BkWzyNL4.js} +2 -2
- package/dist/{TemplateReviewPanel-DyGULVxr.cjs → TemplateReviewPanel-D8o2gDaK.cjs} +1 -1
- package/dist/analytics.cjs +1 -1
- package/dist/analytics.js +5 -5
- package/dist/artifact-integrity.json +106 -102
- package/dist/{assets-C4MIvzQ4.js → assets-BFTP-0WR.js} +2 -2
- package/dist/{assets-BYdpkTIt.cjs → assets-CZiZhTf2.cjs} +1 -1
- package/dist/{auto-j7mr8Kvc.js → auto-C7udkeAa.js} +20 -19
- package/dist/auto-CXd2E2aZ.cjs +1 -0
- package/dist/capabilities-D8UU2clQ.cjs +1 -0
- package/dist/{capabilities-CN_kSVjO.js → capabilities-g0a2j9Yy.js} +50 -46
- package/dist/{charts-Cjw5AYkg.cjs → charts-D-Vg-ak9.cjs} +1 -1
- package/dist/{charts-CxJZ0XaY.js → charts-D48XCefN.js} +1 -1
- package/dist/computed-BQgBrma-.cjs +1 -0
- package/dist/{computed-f3pOqWLX.js → computed-CH3NYPOW.js} +198 -188
- package/dist/{data-bar-Bfh54sT4.js → data-bar-DjOgTLqu.js} +1 -1
- package/dist/{dataset-DL83majE.js → dataset-B8oTsC6o.js} +69 -66
- package/dist/dataset-D3OsyzG1.cjs +1 -0
- package/dist/designer-COuSUxZ1.cjs +2 -0
- package/dist/designer-CT4mlrr0.js +7997 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +83 -4
- package/dist/designer.d.ts +83 -4
- package/dist/designer.js +4 -4
- package/dist/{diagnostic-collector-gB07PHy2.js → diagnostic-collector-C-JBA016.js} +2 -2
- package/dist/dom-DgWc-DY1.js +452 -0
- package/dist/dom-Fk4NF-gN.cjs +1 -0
- package/dist/{encoding-BWEMdzFG.js → encoding-D480EM2r.js} +2 -2
- package/dist/{encoding-DVea2qIR.cjs → encoding-tWc2Wn89.cjs} +1 -1
- package/dist/execution-result-7sG_mdcD.cjs +1 -0
- package/dist/execution-result-Ba65gieT.js +39 -0
- package/dist/{font-loader-p_SyTvqt.cjs → font-loader-BIxme_9g.cjs} +1 -1
- package/dist/{font-loader-D4NLIKJL.js → font-loader-CHmEwkHl.js} +1 -1
- package/dist/{grid-strokes-DkZEZvcI.js → grid-strokes-DsoICRjZ.js} +1 -1
- package/dist/import-range-BwT86Z3j.cjs +1 -0
- package/dist/import-range-D9p_blcb.js +98 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +25 -25
- package/dist/{json-snapshot-DdzALe8q.js → json-snapshot-BZ0CIQln.js} +1041 -887
- package/dist/json-snapshot-DGFeI30h.cjs +2 -0
- package/dist/{matrix-b6T291xo.js → matrix-CB9TqTEy.js} +1 -1
- package/dist/{matrix-DUYPRL7t.cjs → matrix-CcqYOuq_.cjs} +1 -1
- package/dist/{pdf-DU8HelKd.js → pdf-DTR7fAIr.js} +3596 -3517
- package/dist/{pdf-C060D5UY.cjs → pdf-d9oJ6V0P.cjs} +49 -49
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.js +2 -2
- package/dist/{plugin-D5BRHlne.cjs → plugin-B7Bi-1te.cjs} +1 -1
- package/dist/{plugin-FWhTnjr0.js → plugin-OKDFQFS4.js} +1 -1
- package/dist/{prefill-m01IM1hl.js → prefill-C8fF91JB.js} +3 -3
- package/dist/{prefill-DZymomY6.cjs → prefill-C_Bf_AMo.cjs} +1 -1
- package/dist/{prepared-BHu8bIdj.cjs → prepared-BLhV7vdE.cjs} +1 -1
- package/dist/{prepared-DO5pe6Ed.js → prepared-DhgQ0d-h.js} +7 -7
- package/dist/protocol-CZ-BILne.cjs +1 -0
- package/dist/{protocol-CZddmu2n.js → protocol-DHO91-Jt.js} +3 -3
- package/dist/{record-bindings-Cv7lFiof.js → record-bindings-DBrCu6zO.js} +3 -3
- package/dist/{record-bindings-B7djSjNs.cjs → record-bindings-KEs-DKCS.cjs} +1 -1
- package/dist/region-binding-workflow-FSyIZge8.js +882 -0
- package/dist/region-binding-workflow-ikpY1Kbw.cjs +3 -0
- package/dist/report-encoding-worker.cjs +1 -1
- package/dist/report-encoding-worker.js +1 -1
- package/dist/rich-text-layout-BYbIc3eJ.cjs +3 -0
- package/dist/rich-text-layout-BtygMWZC.js +96 -0
- package/dist/runtime-B5HG8poy.cjs +1 -0
- package/dist/runtime-BsvAqz4a.js +204 -0
- package/dist/sbom.cdx.json +1 -1
- package/dist/server-node.cjs +5 -5
- package/dist/server-node.js +2049 -1889
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +35 -0
- package/dist/server.d.ts +35 -0
- package/dist/server.js +340 -328
- package/dist/style.css +1 -1
- package/dist/{template-catalog-DLu814zA.js → template-catalog-BbrN9dgu.js} +5 -5
- package/dist/{template-catalog-Lil5Ryt-.cjs → template-catalog-DDH-5J57.cjs} +1 -1
- package/dist/{template-fragments-BDxdCuMD.js → template-fragments-CUTE8-_I.js} +3 -3
- package/dist/{template-fragments-DbKdxI1z.cjs → template-fragments-cyAQu7aw.cjs} +1 -1
- package/dist/{template-registry-B-AK1oam.cjs → template-registry-D24Z8aQf.cjs} +1 -1
- package/dist/{template-registry-DeVgwEZj.js → template-registry-PSuLsnyq.js} +4 -4
- package/dist/{template-serialization-CqQY4zDg.cjs → template-serialization-BOUidUlh.cjs} +1 -1
- package/dist/{template-serialization-CWmHq7lX.js → template-serialization-BgGWYV_1.js} +1 -1
- package/dist/{textwrap-BywMBMXM.js → textwrap-Bt_tnI6V.js} +1 -1
- package/dist/vue/async.d.cts +46 -3
- package/dist/vue/async.d.ts +46 -3
- package/dist/vue/index.d.cts +215 -24
- package/dist/vue/index.d.ts +215 -24
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +433 -202
- package/dist/workbook-session-BJfZVp4q.cjs +29 -0
- package/dist/{workbook-session-B6hRjTyX.js → workbook-session-DRnMjIFK.js} +2377 -2350
- package/dist/worker.cjs +1 -1
- package/dist/worker.js +4 -4
- package/dist/xlsx.cjs +1 -1
- package/dist/xlsx.d.cts +27 -2
- package/dist/xlsx.d.ts +27 -2
- package/dist/xlsx.js +15 -15
- package/package.json +1 -1
- package/dist/ExcelBindingWizard-bs3F4dD8.js +0 -1486
- package/dist/ExcelBindingWizard-jSdjBtWw.cjs +0 -1
- package/dist/ReportParamPanel-B27IGJjk.cjs +0 -1
- package/dist/ReportPreview-DAU-V3Ov.cjs +0 -6
- package/dist/auto-DjmvmcX-.cjs +0 -1
- package/dist/capabilities-D4nfhcvB.cjs +0 -1
- package/dist/computed-DK6BruFz.cjs +0 -1
- package/dist/dataset-IrlXbUvh.cjs +0 -1
- package/dist/designer-B597ZdC0.js +0 -7595
- package/dist/designer-DFIdv_n7.cjs +0 -2
- package/dist/dom-CXWMmwh-.cjs +0 -1
- package/dist/dom-DxdCMLzs.js +0 -452
- package/dist/json-snapshot-L_gJ7KRS.cjs +0 -2
- package/dist/protocol-CymmHWmL.cjs +0 -1
- package/dist/region-binding-workflow-EYxvUYJ-.js +0 -977
- package/dist/region-binding-workflow-NdkMSFCh.cjs +0 -3
- package/dist/rich-text-layout-Ch_N0Ubu.js +0 -52
- package/dist/rich-text-layout-yJGuThtC.cjs +0 -3
- package/dist/runtime-D8AlfJ6S.js +0 -234
- package/dist/runtime-ywf3oLBR.cjs +0 -1
- package/dist/workbook-session-BclW7KKH.cjs +0 -29
package/dist/server.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { c as W } from "./runtime-
|
|
1
|
+
import { c as W } from "./runtime-BsvAqz4a.js";
|
|
2
2
|
import { R as A, t as h, c as T, p as Re } from "./sha256-BDQ1Qk7A.js";
|
|
3
|
-
import { H as Se, s as Y, I as Ie } from "./json-snapshot-
|
|
3
|
+
import { H as Se, s as Y, I as Ie } from "./json-snapshot-BZ0CIQln.js";
|
|
4
4
|
import { R, c as X, s as P, a as H, j as Ee, b as ke, r as Oe } from "./batch-DGCt44XM.js";
|
|
5
|
-
import { d as
|
|
6
|
-
import { r as Ae, a as Pe } from "./template-catalog-
|
|
7
|
-
import { p as $, b as le, v as je } from "./template-registry-
|
|
8
|
-
import { v as pe, s as ee, a as Te } from "./prepared-
|
|
5
|
+
import { d as nr, e as sr, f as or, v as ar, g as ir } from "./batch-DGCt44XM.js";
|
|
6
|
+
import { r as Ae, a as Pe } from "./template-catalog-BbrN9dgu.js";
|
|
7
|
+
import { p as $, b as le, v as je } from "./template-registry-PSuLsnyq.js";
|
|
8
|
+
import { v as pe, s as ee, a as Te } from "./prepared-DhgQ0d-h.js";
|
|
9
9
|
import { R as Ne, l as Be } from "./param-validation-CnDEd2l-.js";
|
|
10
|
-
import { k as we } from "./record-bindings-
|
|
11
|
-
import { v as
|
|
12
|
-
import { c as
|
|
13
|
-
import { R as $e } from "./diagnostic-collector-
|
|
14
|
-
function
|
|
10
|
+
import { k as we } from "./record-bindings-DBrCu6zO.js";
|
|
11
|
+
import { v as me } from "./dataset-B8oTsC6o.js";
|
|
12
|
+
import { c as ye } from "./media-Y90dHK9z.js";
|
|
13
|
+
import { R as $e } from "./diagnostic-collector-C-JBA016.js";
|
|
14
|
+
function _t(e = {}) {
|
|
15
15
|
const t = e.concurrency ?? 1, r = e.maxQueued ?? 20;
|
|
16
16
|
if (!Number.isSafeInteger(t) || t < 1 || !Number.isSafeInteger(r) || r < 0) throw new A("budget", "队列并发应为正整数,排队上限应为非负整数");
|
|
17
|
-
const n = [], s = /* @__PURE__ */ new Set(),
|
|
18
|
-
let
|
|
17
|
+
const n = [], s = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
|
|
18
|
+
let a = !1, u = 0;
|
|
19
19
|
const f = () => {
|
|
20
|
-
for (; !
|
|
20
|
+
for (; !a && s.size < t && n.length; ) n.shift().start();
|
|
21
21
|
};
|
|
22
22
|
return {
|
|
23
23
|
get active() {
|
|
@@ -27,16 +27,16 @@ function zt(e = {}) {
|
|
|
27
27
|
return n.length;
|
|
28
28
|
},
|
|
29
29
|
enqueue: (i, d = {}) => {
|
|
30
|
-
if (
|
|
30
|
+
if (a) throw new A("closed", "任务队列已关闭");
|
|
31
31
|
if (h(d.signal), s.size >= t && n.length >= r) throw new A("queue-full", "报表任务队列已满");
|
|
32
32
|
const l = d.id ?? `report-${++u}`;
|
|
33
|
-
if (
|
|
33
|
+
if (o.has(l)) throw new A("queue-full", "任务 ID 正在执行或排队");
|
|
34
34
|
const p = new AbortController();
|
|
35
|
-
let w = "queued", g,
|
|
35
|
+
let w = "queued", g, m, y, v;
|
|
36
36
|
const N = new Promise((S, k) => {
|
|
37
|
-
|
|
37
|
+
y = S, v = k;
|
|
38
38
|
}), M = () => {
|
|
39
|
-
d.signal?.removeEventListener("abort", C),
|
|
39
|
+
d.signal?.removeEventListener("abort", C), o.delete(l);
|
|
40
40
|
}, E = (S) => {
|
|
41
41
|
if (w !== "queued" && w !== "running") return;
|
|
42
42
|
const k = w === "queued";
|
|
@@ -53,13 +53,13 @@ function zt(e = {}) {
|
|
|
53
53
|
}, C = () => E(d.signal?.reason), Z = (S, k) => {
|
|
54
54
|
w === "running" && (!Number.isFinite(S) || S < 0 || k !== void 0 && (!Number.isFinite(k) || k < S) || (g = { completed: S, ...k === void 0 ? {} : { total: k } }));
|
|
55
55
|
}, B = (S) => {
|
|
56
|
-
w !== "running" || p.signal.aborted || (
|
|
56
|
+
w !== "running" || p.signal.aborted || (m = { ...S, taskId: l }, S.completed !== void 0 && Z(S.completed, S.total), Se(d.onEvent, m, p.signal));
|
|
57
57
|
}, I = {
|
|
58
58
|
cancel: E,
|
|
59
59
|
start: () => {
|
|
60
60
|
w === "queued" && (w = "running", s.add(I), Promise.resolve().then(() => (h(p.signal), i({ taskId: l, signal: p.signal, reportProgress: Z, onEvent: B }))).then(
|
|
61
61
|
(S) => {
|
|
62
|
-
w === "running" && (w = "completed",
|
|
62
|
+
w === "running" && (w = "completed", y(S));
|
|
63
63
|
},
|
|
64
64
|
(S) => {
|
|
65
65
|
w === "running" && (w = "failed", v(S));
|
|
@@ -69,16 +69,16 @@ function zt(e = {}) {
|
|
|
69
69
|
}));
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
|
-
return
|
|
72
|
+
return o.add(l), d.signal?.addEventListener("abort", C, { once: !0 }), d.signal?.aborted ? E(d.signal.reason) : s.size < t ? I.start() : n.push(I), { id: l, get status() {
|
|
73
73
|
return w;
|
|
74
74
|
}, get progress() {
|
|
75
75
|
return g;
|
|
76
76
|
}, get event() {
|
|
77
|
-
return
|
|
77
|
+
return m;
|
|
78
78
|
}, result: N, cancel: E };
|
|
79
79
|
},
|
|
80
80
|
close: (i = {}) => {
|
|
81
|
-
|
|
81
|
+
a = !0;
|
|
82
82
|
for (const d of [...n]) d.cancel(new A("closed", "任务队列已关闭"));
|
|
83
83
|
if (i.cancelRunning) for (const d of s) d.cancel(new A("closed", "任务队列已关闭"));
|
|
84
84
|
}
|
|
@@ -86,8 +86,8 @@ function zt(e = {}) {
|
|
|
86
86
|
}
|
|
87
87
|
function Me(e) {
|
|
88
88
|
let t, r;
|
|
89
|
-
const n = new Promise((s,
|
|
90
|
-
t = s, r =
|
|
89
|
+
const n = new Promise((s, o) => {
|
|
90
|
+
t = s, r = o;
|
|
91
91
|
});
|
|
92
92
|
return n.catch(() => {
|
|
93
93
|
}), { progress: e, promise: n, resolve: t, reject: r };
|
|
@@ -98,23 +98,23 @@ function te(e) {
|
|
|
98
98
|
}), t;
|
|
99
99
|
}
|
|
100
100
|
function De(e, t) {
|
|
101
|
-
let r, n, s = !0,
|
|
102
|
-
function
|
|
103
|
-
|
|
101
|
+
let r, n, s = !0, o;
|
|
102
|
+
function a(c) {
|
|
103
|
+
o ??= c ?? new Error("任务心跳更新失败"), n?.reject(o), n = void 0, t(o);
|
|
104
104
|
}
|
|
105
105
|
function u(c) {
|
|
106
106
|
const i = Promise.resolve().then(() => e(c?.progress)).then(
|
|
107
107
|
() => c?.resolve(),
|
|
108
108
|
(d) => {
|
|
109
|
-
c?.reject(d),
|
|
109
|
+
c?.reject(d), a(d);
|
|
110
110
|
}
|
|
111
111
|
).finally(() => {
|
|
112
112
|
r = void 0;
|
|
113
113
|
const d = n;
|
|
114
|
-
n = void 0, d &&
|
|
114
|
+
n = void 0, d && o === void 0 && u(d);
|
|
115
115
|
});
|
|
116
116
|
r = i, i.catch((d) => {
|
|
117
|
-
|
|
117
|
+
a(d);
|
|
118
118
|
});
|
|
119
119
|
}
|
|
120
120
|
function f(c) {
|
|
@@ -122,7 +122,7 @@ function De(e, t) {
|
|
|
122
122
|
return te(
|
|
123
123
|
new R("closed", "任务进度上报已结束")
|
|
124
124
|
);
|
|
125
|
-
if (
|
|
125
|
+
if (o !== void 0) return te(o);
|
|
126
126
|
n ? n.progress = c : n = Me(c);
|
|
127
127
|
const i = n;
|
|
128
128
|
return r || (n = void 0, u(i)), i.promise;
|
|
@@ -130,11 +130,11 @@ function De(e, t) {
|
|
|
130
130
|
return {
|
|
131
131
|
progress: f,
|
|
132
132
|
pulse() {
|
|
133
|
-
s && !r &&
|
|
133
|
+
s && !r && o === void 0 && u();
|
|
134
134
|
},
|
|
135
135
|
async finish() {
|
|
136
136
|
for (s = !1; r; ) await r;
|
|
137
|
-
if (
|
|
137
|
+
if (o !== void 0) throw o;
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
140
|
}
|
|
@@ -146,7 +146,7 @@ class re extends R {
|
|
|
146
146
|
function Je(e) {
|
|
147
147
|
const t = e.concurrency ?? 1, r = e.leaseMs ?? 3e4, n = e.heartbeatMs ?? 1e4, s = e.maxResultBytes ?? 256 * 1024;
|
|
148
148
|
if (![t, r, n, s].every(
|
|
149
|
-
(
|
|
149
|
+
(a) => Number.isSafeInteger(a) && a > 0
|
|
150
150
|
) || n * 2 > r)
|
|
151
151
|
throw new R(
|
|
152
152
|
"input",
|
|
@@ -158,10 +158,10 @@ function Je(e) {
|
|
|
158
158
|
"心跳间隔超过平台定时器上限(2147483647毫秒)"
|
|
159
159
|
);
|
|
160
160
|
return { concurrency: t, leaseMs: r, heartbeatMs: n, maxResultBytes: s, now: () => {
|
|
161
|
-
const
|
|
162
|
-
if (!Number.isSafeInteger(
|
|
161
|
+
const a = (e.now ?? Date.now)();
|
|
162
|
+
if (!Number.isSafeInteger(a) || a < 0)
|
|
163
163
|
throw new R("input", "任务时钟应返回非负整数毫秒");
|
|
164
|
-
return
|
|
164
|
+
return a;
|
|
165
165
|
} };
|
|
166
166
|
}
|
|
167
167
|
async function F(e, t, r) {
|
|
@@ -172,7 +172,7 @@ async function F(e, t, r) {
|
|
|
172
172
|
}
|
|
173
173
|
async function q(e, t, r, n = []) {
|
|
174
174
|
const s = { ...t, ...r, revision: t.revision + 1 };
|
|
175
|
-
for (const
|
|
175
|
+
for (const o of n) delete s[o];
|
|
176
176
|
if (!await e.compareAndSwap(
|
|
177
177
|
t.scope,
|
|
178
178
|
t.id,
|
|
@@ -186,7 +186,7 @@ async function Ce(e, t, r, n) {
|
|
|
186
186
|
if (!t.trim() || t.length > 128)
|
|
187
187
|
throw new R("input", "workerId应为1–128位标识");
|
|
188
188
|
for (const s of await e.store.candidates(n, 100)) {
|
|
189
|
-
const
|
|
189
|
+
const o = s.cancelRequested ? {
|
|
190
190
|
...s,
|
|
191
191
|
revision: s.revision + 1,
|
|
192
192
|
status: "cancelled",
|
|
@@ -199,71 +199,71 @@ async function Ce(e, t, r, n) {
|
|
|
199
199
|
updatedAt: n,
|
|
200
200
|
lease: { owner: t, expiresAt: n + r }
|
|
201
201
|
};
|
|
202
|
-
if (
|
|
202
|
+
if (o.status === "cancelled" && delete o.lease, await e.store.compareAndSwap(
|
|
203
203
|
s.scope,
|
|
204
204
|
s.id,
|
|
205
205
|
s.revision,
|
|
206
|
-
|
|
206
|
+
o
|
|
207
207
|
))
|
|
208
|
-
return
|
|
208
|
+
return o;
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
function ne(e, t, r, n) {
|
|
212
212
|
return e.status === "running" && e.attempt === n && e.lease?.owner === t && e.lease.expiresAt > r;
|
|
213
213
|
}
|
|
214
214
|
async function qe(e, t, r, n) {
|
|
215
|
-
const { scope: s, id:
|
|
215
|
+
const { scope: s, id: o } = r, a = r.lease.owner;
|
|
216
216
|
let u;
|
|
217
217
|
const f = De(
|
|
218
|
-
async (
|
|
219
|
-
const
|
|
220
|
-
if (!ne(
|
|
218
|
+
async (m) => {
|
|
219
|
+
const y = await F(e.store, s, o), v = t.now();
|
|
220
|
+
if (!ne(y, a, v, r.attempt))
|
|
221
221
|
throw new R("lease", "报表任务租约已失效");
|
|
222
|
-
if (
|
|
222
|
+
if (y.cancelRequested) {
|
|
223
223
|
n.abort(new R("closed", "任务已请求取消"));
|
|
224
224
|
return;
|
|
225
225
|
}
|
|
226
|
-
await q(e.store,
|
|
226
|
+
await q(e.store, y, {
|
|
227
227
|
updatedAt: v,
|
|
228
|
-
lease: { owner:
|
|
229
|
-
...
|
|
228
|
+
lease: { owner: a, expiresAt: v + t.leaseMs },
|
|
229
|
+
...m ? { progress: m } : {}
|
|
230
230
|
});
|
|
231
231
|
},
|
|
232
|
-
(
|
|
233
|
-
u =
|
|
232
|
+
(m) => {
|
|
233
|
+
u = m, n.abort(m);
|
|
234
234
|
}
|
|
235
|
-
), c = (
|
|
236
|
-
completed:
|
|
237
|
-
...
|
|
235
|
+
), c = (m, y) => !Number.isFinite(m) || m < 0 || y !== void 0 && (!Number.isFinite(y) || y < m) ? Promise.reject(new R("input", "任务进度无效")) : f.progress({
|
|
236
|
+
completed: m,
|
|
237
|
+
...y === void 0 ? {} : { total: y }
|
|
238
238
|
}), i = setInterval(() => {
|
|
239
239
|
f.pulse();
|
|
240
240
|
}, t.heartbeatMs);
|
|
241
241
|
let d, l;
|
|
242
242
|
try {
|
|
243
|
-
const
|
|
243
|
+
const m = Object.prototype.hasOwnProperty.call(
|
|
244
244
|
e.handlers,
|
|
245
245
|
r.request.kind
|
|
246
246
|
) ? e.handlers[r.request.kind] : void 0;
|
|
247
|
-
if (!
|
|
247
|
+
if (!m) throw new R("input", "报表任务处理器未注册");
|
|
248
248
|
if (!n.signal.aborted) {
|
|
249
|
-
const
|
|
249
|
+
const y = await m(H(r.request.payload), {
|
|
250
250
|
scope: s,
|
|
251
|
-
taskId:
|
|
251
|
+
taskId: o,
|
|
252
252
|
attempt: r.attempt,
|
|
253
|
-
executionToken: JSON.stringify([s,
|
|
253
|
+
executionToken: JSON.stringify([s, o, r.attempt]),
|
|
254
254
|
signal: n.signal,
|
|
255
255
|
reportProgress: c
|
|
256
256
|
});
|
|
257
|
-
if (d = JSON.parse(P(
|
|
257
|
+
if (d = JSON.parse(P(y)), Ee(d) > t.maxResultBytes) throw new re();
|
|
258
258
|
}
|
|
259
|
-
} catch (
|
|
260
|
-
l =
|
|
259
|
+
} catch (m) {
|
|
260
|
+
l = m ?? new Error("报表任务执行失败");
|
|
261
261
|
} finally {
|
|
262
262
|
clearInterval(i), await f.finish().catch(() => {
|
|
263
263
|
});
|
|
264
264
|
}
|
|
265
|
-
const p = await F(e.store, s,
|
|
266
|
-
if (!ne(p,
|
|
265
|
+
const p = await F(e.store, s, o), w = t.now();
|
|
266
|
+
if (!ne(p, a, w, r.attempt))
|
|
267
267
|
throw new R("lease", "任务租约已失效,迟到结果不会写回");
|
|
268
268
|
const g = { ...p, updatedAt: w };
|
|
269
269
|
delete g.lease, l ??= u, p.cancelRequested || n.signal.aborted && u === void 0 ? g.status = "cancelled" : l !== void 0 ? (g.status = "failed", g.error = {
|
|
@@ -295,11 +295,11 @@ async function se(e, t, r, n) {
|
|
|
295
295
|
return { scope: t, id: r, revision: s.revision, request: H(n), status: s.status, createdAt: s.createdAt, updatedAt: s.updatedAt, attempt: s.attempt, archived: !0 };
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
|
-
function
|
|
298
|
+
function Lt(e) {
|
|
299
299
|
e = { ...e, handlers: { ...e.handlers } };
|
|
300
300
|
const t = Je(e), r = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
301
|
-
let s = !1,
|
|
302
|
-
const
|
|
301
|
+
let s = !1, o = 0;
|
|
302
|
+
const a = (c, i) => (X(c, i), e.store.read(c, i));
|
|
303
303
|
return {
|
|
304
304
|
submit: async (c) => {
|
|
305
305
|
if (c = { ...c }, X(c.scope, c.id), !Object.prototype.hasOwnProperty.call(e.handlers, c.kind) || typeof e.handlers[c.kind] != "function")
|
|
@@ -312,7 +312,7 @@ function _t(e) {
|
|
|
312
312
|
maxCharacters: 75e4
|
|
313
313
|
})
|
|
314
314
|
)
|
|
315
|
-
}, d = await
|
|
315
|
+
}, d = await a(c.scope, c.id);
|
|
316
316
|
if (d) {
|
|
317
317
|
if (P(d.request) !== P(i))
|
|
318
318
|
throw new R("conflict", "相同任务ID不能提交不同内容");
|
|
@@ -331,24 +331,24 @@ function _t(e) {
|
|
|
331
331
|
attempt: 0
|
|
332
332
|
};
|
|
333
333
|
if (!await e.store.compareAndSwap(c.scope, c.id, null, w)) {
|
|
334
|
-
const g = await
|
|
334
|
+
const g = await a(c.scope, c.id);
|
|
335
335
|
if (g && P(g.request) === P(i))
|
|
336
336
|
return g;
|
|
337
|
-
const
|
|
338
|
-
if (
|
|
337
|
+
const m = await se(e.store, c.scope, c.id, i);
|
|
338
|
+
if (m) return m;
|
|
339
339
|
throw new R("conflict", "报表任务提交发生冲突");
|
|
340
340
|
}
|
|
341
341
|
return H(w);
|
|
342
342
|
},
|
|
343
|
-
get:
|
|
343
|
+
get: a,
|
|
344
344
|
runNext: (c) => {
|
|
345
345
|
if (s)
|
|
346
346
|
return Promise.reject(new R("closed", "报表任务服务已关闭"));
|
|
347
|
-
if (
|
|
347
|
+
if (o >= t.concurrency)
|
|
348
348
|
return Promise.reject(
|
|
349
349
|
new R("capacity", "报表任务执行槽位已满")
|
|
350
350
|
);
|
|
351
|
-
|
|
351
|
+
o++;
|
|
352
352
|
const i = new AbortController();
|
|
353
353
|
r.add(i);
|
|
354
354
|
const d = (async () => {
|
|
@@ -361,7 +361,7 @@ function _t(e) {
|
|
|
361
361
|
);
|
|
362
362
|
return l?.status === "running" ? await qe(e, t, l, i) : l;
|
|
363
363
|
} finally {
|
|
364
|
-
|
|
364
|
+
o--, r.delete(i);
|
|
365
365
|
}
|
|
366
366
|
})();
|
|
367
367
|
return n.add(d), d.then(
|
|
@@ -370,7 +370,7 @@ function _t(e) {
|
|
|
370
370
|
), d;
|
|
371
371
|
},
|
|
372
372
|
get active() {
|
|
373
|
-
return
|
|
373
|
+
return o;
|
|
374
374
|
},
|
|
375
375
|
cancel: async (c, i) => {
|
|
376
376
|
const d = await F(e.store, c, i);
|
|
@@ -414,17 +414,17 @@ function ge(e, t) {
|
|
|
414
414
|
assetBudget: { ...r?.assetBudget, ...n?.assetBudget }
|
|
415
415
|
};
|
|
416
416
|
}
|
|
417
|
-
function
|
|
417
|
+
function oe(e, t) {
|
|
418
418
|
if (!e || e.code !== "missing-image" || e.format !== "pdf" && e.format !== "xlsx") return !1;
|
|
419
419
|
const r = ge(t, e.format);
|
|
420
420
|
return typeof r?.assetRenderers?.[e.kind] == "function" || !!(e.extension && r?.assetRegistry?.hasExtension(e.extension.id, e.extension.version, e.kind));
|
|
421
421
|
}
|
|
422
422
|
function _e(e, t) {
|
|
423
|
-
const r = Ae(e, t), n = r.issues.filter((
|
|
424
|
-
return { ...r, issues: n, samples: s, ok: n.every((
|
|
423
|
+
const r = Ae(e, t), n = r.issues.filter((o) => !oe(o.diagnostic, t)), s = r.samples.map((o) => ({ ...o, diagnostics: o.diagnostics.filter((a) => !oe(a, t)) }));
|
|
424
|
+
return { ...r, issues: n, samples: s, ok: n.every((o) => o.severity !== "error"), artifacts: [] };
|
|
425
425
|
}
|
|
426
426
|
async function Le(e, t, r, n, s) {
|
|
427
|
-
const
|
|
427
|
+
const o = W({ reports: { sample: { template: r, datasets: e.datasets } }, assets: ge(n, t), budget: {
|
|
428
428
|
maxRows: n.maxSampleRows ?? 1e3,
|
|
429
429
|
maxPages: n.maxPages ?? 100,
|
|
430
430
|
maxCells: n.maxCells ?? 25e4,
|
|
@@ -432,28 +432,28 @@ async function Le(e, t, r, n, s) {
|
|
|
432
432
|
maxDurationMs: n.maxDurationMs ?? 3e4
|
|
433
433
|
} });
|
|
434
434
|
try {
|
|
435
|
-
const { result:
|
|
436
|
-
const c = await
|
|
435
|
+
const { result: a, digest: u } = await T(n.signal, n.maxDurationMs ?? 3e4, async (f) => {
|
|
436
|
+
const c = await o.export({ reportIds: ["sample"], params: e.params, format: t, signal: f, fidelity: n.strictOutputs ? "strict" : "warn", pdf: n.pdf, xlsx: n.xlsx }), i = c.diagnostics.filter((l) => l.severity !== "info");
|
|
437
437
|
if (n.strictOutputs && i.length) throw new Error(`Strict ${t} encoding found fidelity issues: ${i.slice(0, 3).map((l) => l.message).join("; ")}`);
|
|
438
438
|
const d = await n.digest?.(c.bytes);
|
|
439
439
|
return h(f), await n.onArtifact?.(e.name, c), h(f), { result: c, digest: d };
|
|
440
440
|
});
|
|
441
|
-
s.artifacts.push({ fixture: e.name, format: t, bytes:
|
|
442
|
-
} catch (
|
|
443
|
-
h(n.signal), s.issues.push({ code: "output", severity: "error", path: "$.template", fixture: e.name, message: `${t}: ${
|
|
441
|
+
s.artifacts.push({ fixture: e.name, format: t, bytes: a.bytes.byteLength, pages: a.stats.pages, ...u ? { digest: u } : {} }), s.issues.push(...a.diagnostics.map((f) => ({ code: "output", severity: n.strictOutputs || f.severity === "error" ? "error" : "warning", path: "$.template", fixture: e.name, message: `${t}: ${f.message}` })));
|
|
442
|
+
} catch (a) {
|
|
443
|
+
h(n.signal), s.issues.push({ code: "output", severity: "error", path: "$.template", fixture: e.name, message: `${t}: ${a instanceof Error ? a.message : String(a)}` });
|
|
444
444
|
}
|
|
445
445
|
}
|
|
446
|
-
async function
|
|
446
|
+
async function Ft(e, t = {}) {
|
|
447
447
|
h(t.signal);
|
|
448
448
|
const r = _e(e, t);
|
|
449
449
|
if (!r.ok) return r;
|
|
450
450
|
const n = $(e).template, s = [...new Set(t.formats ?? ["pdf", "xlsx"])];
|
|
451
|
-
if (!s.length || s.some((
|
|
451
|
+
if (!s.length || s.some((o) => o !== "pdf" && o !== "xlsx"))
|
|
452
452
|
return r.issues.push({ code: "output", severity: "error", path: "$.formats", message: "真实文件验收应至少选择PDF/XLSX之一" }), r.ok = !1, r;
|
|
453
|
-
for (const
|
|
454
|
-
for (const
|
|
455
|
-
h(t.signal), !(
|
|
456
|
-
return r.ok = r.issues.every((
|
|
453
|
+
for (const o of t.fixtures ?? [])
|
|
454
|
+
for (const a of s)
|
|
455
|
+
h(t.signal), !(a !== "pdf" && a !== "xlsx") && await Le(o, a, n, t, r);
|
|
456
|
+
return r.ok = r.issues.every((o) => o.severity !== "error"), r;
|
|
457
457
|
}
|
|
458
458
|
class b extends Error {
|
|
459
459
|
constructor(t, r) {
|
|
@@ -481,7 +481,7 @@ function he(e, t) {
|
|
|
481
481
|
if (!Number.isSafeInteger(t) || t < 1) throw new b("input", "实例快照字节预算应为正安全整数");
|
|
482
482
|
let r = 0, n = 0;
|
|
483
483
|
const s = /* @__PURE__ */ new Set();
|
|
484
|
-
function
|
|
484
|
+
function o(u, f) {
|
|
485
485
|
if (++r > 1e6 || f > 64) throw new b("capacity", "实例节点或嵌套深度超过预算");
|
|
486
486
|
if (typeof u == "string" && (n += u.length, n > t))
|
|
487
487
|
throw new b("capacity", "实例文本超过预算");
|
|
@@ -494,7 +494,7 @@ function he(e, t) {
|
|
|
494
494
|
if (n += d.length, n > t) throw new b("capacity", "实例文本超过预算");
|
|
495
495
|
const l = Object.getOwnPropertyDescriptor(u, d);
|
|
496
496
|
if (l.get || l.set || ["__proto__", "constructor", "prototype"].includes(d)) throw new b("input", "实例不能包含访问器或危险键");
|
|
497
|
-
l.value !== void 0 && (i[d] =
|
|
497
|
+
l.value !== void 0 && (i[d] = o(l.value, f + 1));
|
|
498
498
|
}
|
|
499
499
|
if (s.delete(u), c) {
|
|
500
500
|
if (Object.keys(i).length !== u.length) throw new b("input", "实例数组不能稀疏或包含额外属性");
|
|
@@ -502,24 +502,24 @@ function he(e, t) {
|
|
|
502
502
|
}
|
|
503
503
|
return i;
|
|
504
504
|
}
|
|
505
|
-
const
|
|
506
|
-
if (new TextEncoder().encode(
|
|
507
|
-
return
|
|
505
|
+
const a = JSON.stringify(o(e, 0));
|
|
506
|
+
if (new TextEncoder().encode(a).byteLength > t) throw new b("capacity", "实例快照超过单条字节预算");
|
|
507
|
+
return a;
|
|
508
508
|
}
|
|
509
509
|
function G(e, t = 8e6) {
|
|
510
510
|
const r = JSON.parse(he(e, t));
|
|
511
511
|
J(r.scope, r.id);
|
|
512
512
|
const n = /* @__PURE__ */ new Set(["scope", "id", "revision", "title", "generatedAt", "reportIds", "params", "templateRevisions", "sourceRevisions", "plan", "artifacts", "output"]);
|
|
513
|
-
if (Object.keys(r).some((
|
|
513
|
+
if (Object.keys(r).some((o) => !n.has(o))) throw new b("input", "实例包含未知字段");
|
|
514
514
|
Ve(r);
|
|
515
|
-
for (const
|
|
516
|
-
if (!
|
|
517
|
-
if (r.reportIds.some((
|
|
515
|
+
for (const o of [r.params, r.templateRevisions, r.sourceRevisions])
|
|
516
|
+
if (!o || typeof o != "object" || Array.isArray(o) || Object.values(o).some((a) => typeof a != "string")) throw new b("input", "实例参数和修订应为字符串字典");
|
|
517
|
+
if (r.reportIds.some((o) => !r.templateRevisions[o])) throw new b("input", "每张报表都应记录生成时的模板修订");
|
|
518
518
|
const s = le(r.plan);
|
|
519
519
|
if (!s.ok) throw new b("input", `实例渲染计划无效:${s.errors[0]?.path}`);
|
|
520
520
|
if (r.output !== void 0) {
|
|
521
|
-
if (!r.output || Object.keys(r.output).some((
|
|
522
|
-
if (pe({ ...r.output, plan: r.plan, revisions: {} }), r.output.sources?.some((
|
|
521
|
+
if (!r.output || Object.keys(r.output).some((o) => !["stats", "diagnostics", "layout", "sources"].includes(o))) throw new b("input", "实例输出元数据只允许统计、诊断和字体度量;不保存来源令牌");
|
|
522
|
+
if (pe({ ...r.output, plan: r.plan, revisions: {} }), r.output.sources?.some((o) => "sourceToken" in o)) throw new b("input", "实例来源清单不保存来源令牌");
|
|
523
523
|
}
|
|
524
524
|
return r.artifacts !== void 0 && Ue(r.artifacts), r;
|
|
525
525
|
}
|
|
@@ -532,36 +532,36 @@ function Ue(e) {
|
|
|
532
532
|
}
|
|
533
533
|
}
|
|
534
534
|
function Ze(e) {
|
|
535
|
-
const { scope: t, id: r, revision: n, title: s, generatedAt:
|
|
536
|
-
return JSON.parse(JSON.stringify({ scope: t, id: r, revision: n, title: s, generatedAt:
|
|
535
|
+
const { scope: t, id: r, revision: n, title: s, generatedAt: o, reportIds: a, params: u, templateRevisions: f, sourceRevisions: c } = e;
|
|
536
|
+
return JSON.parse(JSON.stringify({ scope: t, id: r, revision: n, title: s, generatedAt: o, reportIds: a, params: u, templateRevisions: f, sourceRevisions: c }));
|
|
537
537
|
}
|
|
538
538
|
function Ke(e) {
|
|
539
539
|
const t = { maxInstances: 100, maxRevisions: 20, maxBytes: 64e6, maxSnapshotBytes: 8e6, ...e };
|
|
540
540
|
if (Object.values(t).some((r) => !Number.isSafeInteger(r) || r < 1)) throw new b("input", "实例存储预算应为正安全整数");
|
|
541
541
|
return t;
|
|
542
542
|
}
|
|
543
|
-
function
|
|
543
|
+
function Vt(e = {}) {
|
|
544
544
|
const t = Ke(e), r = /* @__PURE__ */ new Map();
|
|
545
545
|
let n = 0;
|
|
546
546
|
return {
|
|
547
|
-
read: async (s,
|
|
548
|
-
h(u), J(s,
|
|
549
|
-
const f = r.get(JSON.stringify([s,
|
|
547
|
+
read: async (s, o, a, u) => {
|
|
548
|
+
h(u), J(s, o);
|
|
549
|
+
const f = r.get(JSON.stringify([s, o])), c = f?.get(a ?? f.size);
|
|
550
550
|
return c ? G(c, t.maxSnapshotBytes) : void 0;
|
|
551
551
|
},
|
|
552
|
-
list: async (s,
|
|
553
|
-
h(
|
|
554
|
-
const
|
|
555
|
-
if (!Number.isSafeInteger(
|
|
556
|
-
const u = Array.from(r.values(), (f) => f.get(f.size)).filter((f) => f.scope === s && (!
|
|
557
|
-
return { items: u.slice(0,
|
|
552
|
+
list: async (s, o = {}) => {
|
|
553
|
+
h(o.signal), J(s, "list");
|
|
554
|
+
const a = o.limit ?? 25;
|
|
555
|
+
if (!Number.isSafeInteger(a) || a < 1 || a > 100) throw new b("input", "实例每页数量应为 1–100");
|
|
556
|
+
const u = Array.from(r.values(), (f) => f.get(f.size)).filter((f) => f.scope === s && (!o.after || f.id > o.after) && (!o.reportId || f.reportIds.includes(o.reportId))).sort((f, c) => f.id < c.id ? -1 : 1).slice(0, a + 1);
|
|
557
|
+
return { items: u.slice(0, a).map(Ze), ...u.length > a ? { next: u[a - 1].id } : {} };
|
|
558
558
|
},
|
|
559
|
-
compareAndSwap: async (s,
|
|
560
|
-
h(f), J(s,
|
|
559
|
+
compareAndSwap: async (s, o, a, u, f) => {
|
|
560
|
+
h(f), J(s, o);
|
|
561
561
|
const c = G(u, t.maxSnapshotBytes);
|
|
562
|
-
if (c.scope !== s || c.id !==
|
|
563
|
-
const i = JSON.stringify([s,
|
|
564
|
-
if ((d.size || null) !==
|
|
562
|
+
if (c.scope !== s || c.id !== o || c.revision !== (a ?? 0) + 1) throw new b("input", "实例身份或修订不一致");
|
|
563
|
+
const i = JSON.stringify([s, o]), d = r.get(i) ?? /* @__PURE__ */ new Map();
|
|
564
|
+
if ((d.size || null) !== a) return !1;
|
|
565
565
|
const l = new TextEncoder().encode(JSON.stringify(c)).byteLength;
|
|
566
566
|
if (d.size >= t.maxRevisions || n + l > t.maxBytes || !d.size && r.size >= t.maxInstances) throw new b("capacity", "实例存储达到预算,请使用持久化归档策略或显式调整容量");
|
|
567
567
|
return d.set(c.revision, c), r.set(i, d), n += l, !0;
|
|
@@ -575,15 +575,15 @@ function Xe(e, t = {}) {
|
|
|
575
575
|
read: e.read.bind(e),
|
|
576
576
|
list: e.list.bind(e),
|
|
577
577
|
save: async (n, s) => {
|
|
578
|
-
const
|
|
579
|
-
if (
|
|
580
|
-
const
|
|
581
|
-
if (h(s.signal), !await e.compareAndSwap(u.scope, u.id,
|
|
578
|
+
const o = s.expectedRevision;
|
|
579
|
+
if (o !== null && (!Number.isSafeInteger(o) || o < 1 || o >= Number.MAX_SAFE_INTEGER)) throw new b("input", "实例预期修订无效");
|
|
580
|
+
const a = JSON.parse(he(n, r)), u = G({ ...a, revision: (o ?? 0) + 1 }, r);
|
|
581
|
+
if (h(s.signal), !await e.compareAndSwap(u.scope, u.id, o, u, s.signal)) throw new b("conflict", "实例已存在或已变化,请显式确认修订后保存");
|
|
582
582
|
return u;
|
|
583
583
|
}
|
|
584
584
|
};
|
|
585
585
|
}
|
|
586
|
-
function
|
|
586
|
+
function Ht(e, t) {
|
|
587
587
|
return P({ reportIds: e, params: t });
|
|
588
588
|
}
|
|
589
589
|
function Ge(e) {
|
|
@@ -592,9 +592,9 @@ function Ge(e) {
|
|
|
592
592
|
let r;
|
|
593
593
|
const n = /* @__PURE__ */ new Set(["scope", "id", "title", "reportIds", "params", "expectedRevision", "signal"]);
|
|
594
594
|
for (const s of Object.getOwnPropertyNames(e)) {
|
|
595
|
-
const
|
|
596
|
-
if (!n.has(s) || !
|
|
597
|
-
s === "signal" ? r =
|
|
595
|
+
const o = Object.getOwnPropertyDescriptor(e, s);
|
|
596
|
+
if (!n.has(s) || !o.enumerable || o.get || o.set) throw new b("input", "生成请求不能包含未知字段或访问器");
|
|
597
|
+
s === "signal" ? r = o.value : o.value !== void 0 && (t[s] = o.value);
|
|
598
598
|
}
|
|
599
599
|
return { signal: r, request: JSON.parse(P(t)) };
|
|
600
600
|
}
|
|
@@ -602,51 +602,51 @@ function Qe(e) {
|
|
|
602
602
|
const t = JSON.parse(P(e.templateRevisions)), r = ee(e.pdf), n = Xe(e.instances, { maxSnapshotBytes: e.maxSnapshotBytes });
|
|
603
603
|
return {
|
|
604
604
|
async generate(s) {
|
|
605
|
-
const { signal:
|
|
606
|
-
if (J(
|
|
607
|
-
const u = e.runtime.validate(
|
|
605
|
+
const { signal: o, request: a } = Ge(s);
|
|
606
|
+
if (J(a.scope, a.id), a.expectedRevision !== null && (!Number.isSafeInteger(a.expectedRevision) || a.expectedRevision < 1)) throw new b("input", "实例预期修订无效");
|
|
607
|
+
const u = e.runtime.validate(a);
|
|
608
608
|
if (!u.ok) throw new Ne(u.issues);
|
|
609
609
|
const f = /* @__PURE__ */ Object.create(null);
|
|
610
|
-
for (const
|
|
611
|
-
if (typeof t[
|
|
612
|
-
f[
|
|
610
|
+
for (const y of a.reportIds) {
|
|
611
|
+
if (typeof t[y] != "string" || !t[y]) throw new TypeError(`报表 ${y} 缺少生成时的模板修订`);
|
|
612
|
+
f[y] = t[y];
|
|
613
613
|
}
|
|
614
|
-
if (h(
|
|
614
|
+
if (h(o), ((await e.instances.read(a.scope, a.id, void 0, o))?.revision ?? null) !== a.expectedRevision)
|
|
615
615
|
throw new b("conflict", "实例已存在或已变化,请显式确认修订后生成");
|
|
616
|
-
const i = await e.runtime.prepare({ reportIds:
|
|
617
|
-
h(
|
|
616
|
+
const i = await e.runtime.prepare({ reportIds: a.reportIds, params: u.values, pdf: r, signal: o });
|
|
617
|
+
h(o);
|
|
618
618
|
const d = /* @__PURE__ */ Object.create(null);
|
|
619
|
-
for (const [
|
|
620
|
-
const { plan: l, revisions: p, sources: w, ...g } = i,
|
|
619
|
+
for (const [y, v] of Object.entries(i.revisions)) v.revision !== void 0 && (d[y] = v.revision);
|
|
620
|
+
const { plan: l, revisions: p, sources: w, ...g } = i, m = { ...g, ...w ? { sources: w.map(({ sourceToken: y, ...v }) => v) } : {} };
|
|
621
621
|
return n.save({
|
|
622
|
-
scope:
|
|
623
|
-
id:
|
|
624
|
-
title:
|
|
625
|
-
reportIds:
|
|
622
|
+
scope: a.scope,
|
|
623
|
+
id: a.id,
|
|
624
|
+
title: a.title,
|
|
625
|
+
reportIds: a.reportIds,
|
|
626
626
|
params: u.values,
|
|
627
627
|
templateRevisions: f,
|
|
628
628
|
sourceRevisions: d,
|
|
629
629
|
generatedAt: (e.now?.() ?? /* @__PURE__ */ new Date()).toISOString(),
|
|
630
630
|
plan: l,
|
|
631
|
-
output:
|
|
632
|
-
}, { expectedRevision:
|
|
631
|
+
output: m
|
|
632
|
+
}, { expectedRevision: a.expectedRevision, signal: o });
|
|
633
633
|
},
|
|
634
634
|
read: n.read,
|
|
635
635
|
list: n.list,
|
|
636
636
|
/** Read an immutable saved revision and encode its plan, never re-query the business source. */
|
|
637
637
|
async exportInstance(s) {
|
|
638
|
-
const { scope:
|
|
639
|
-
J(
|
|
640
|
-
const
|
|
641
|
-
if (!
|
|
642
|
-
const
|
|
643
|
-
plan:
|
|
644
|
-
revisions: Object.fromEntries(
|
|
638
|
+
const { scope: o, id: a, revision: u, signal: f, format: c, fidelity: i, taskId: d, correlationId: l, onEvent: p } = s, w = ee(s.pdf ?? r), g = Te(s.xlsx);
|
|
639
|
+
J(o, a), h(f);
|
|
640
|
+
const m = await n.read(o, a, u, f);
|
|
641
|
+
if (!m) throw new b("input", "报表实例不存在");
|
|
642
|
+
const y = {
|
|
643
|
+
plan: m.plan,
|
|
644
|
+
revisions: Object.fromEntries(m.reportIds.map((v) => [v, { revision: m.sourceRevisions[v] }])),
|
|
645
645
|
diagnostics: [{ code: "instance-row-count", severity: "info", message: "历史实例未保存原始取数行数;本次 rows 统计为 0,页面及单元格数由已保存计划校验。" }],
|
|
646
|
-
stats: { rows: 0, pages:
|
|
647
|
-
...
|
|
646
|
+
stats: { rows: 0, pages: m.plan.pages.length, cells: 0, durationMs: 0 },
|
|
647
|
+
...m.output
|
|
648
648
|
};
|
|
649
|
-
return e.runtime.exportPrepared({ prepared:
|
|
649
|
+
return e.runtime.exportPrepared({ prepared: y, format: c, fidelity: i, pdf: w, xlsx: g, signal: f, taskId: d, correlationId: l, onEvent: p });
|
|
650
650
|
},
|
|
651
651
|
/** Instance edits are explicit snapshots; source business persistence remains the Provider.save responsibility. */
|
|
652
652
|
save: n.save
|
|
@@ -656,7 +656,7 @@ function _(e, t, r) {
|
|
|
656
656
|
if (!Number.isSafeInteger(e) || e < 1 || e > t) throw new RangeError(`${r} 应为 1–${t} 的安全整数`);
|
|
657
657
|
return e;
|
|
658
658
|
}
|
|
659
|
-
function
|
|
659
|
+
function ae(e) {
|
|
660
660
|
if (!e || typeof e.key != "string" || !e.key.trim() || e.key.length > 1024 || !["pdf", "xlsx"].includes(e.format) || !Number.isSafeInteger(e.bytes) || e.bytes < 0 || e.sha256 !== void 0 && !/^[a-f0-9]{64}$/i.test(e.sha256)) throw new TypeError("分批归档回执应包含存储键、格式、大小和可选 SHA256");
|
|
661
661
|
return { key: e.key, format: e.format, bytes: e.bytes, ...e.sha256 ? { sha256: e.sha256 } : {} };
|
|
662
662
|
}
|
|
@@ -669,28 +669,28 @@ function Ye(e) {
|
|
|
669
669
|
r.rowKey && t.add(r.rowKey), typeof r.copies == "object" && t.add(r.copies.field);
|
|
670
670
|
const n = (s) => {
|
|
671
671
|
s.binding && t.add(s.binding.field);
|
|
672
|
-
for (const
|
|
672
|
+
for (const o of s.grid?.cells ?? []) for (const a of o) a?.children?.forEach(n);
|
|
673
673
|
};
|
|
674
|
-
return e.pages.forEach((s) => s.components.forEach((
|
|
674
|
+
return e.pages.forEach((s) => s.components.forEach((o) => n(o))), [...t];
|
|
675
675
|
}
|
|
676
676
|
function et(e, t, r, n) {
|
|
677
677
|
if (!e || typeof e != "object" || Array.isArray(e)) throw new TypeError(`标签记录 ${n} 应为对象`);
|
|
678
678
|
const s = /* @__PURE__ */ Object.create(null);
|
|
679
|
-
for (const
|
|
680
|
-
const
|
|
681
|
-
if (typeof
|
|
682
|
-
|
|
679
|
+
for (const o of t) {
|
|
680
|
+
const a = we(e, o, { dataset: r, rowIndex: n });
|
|
681
|
+
if (typeof a == "string" && a.length > 1e6) throw new A("budget", "标签字段超过 1 MB 字符预算", `$.datasets.${r}[${n}].${o}`);
|
|
682
|
+
a !== void 0 && (s[o] = a);
|
|
683
683
|
}
|
|
684
684
|
return s;
|
|
685
685
|
}
|
|
686
686
|
function tt(e, t, r, n) {
|
|
687
687
|
const s = t.repeat;
|
|
688
688
|
if (!s.rowKey) return;
|
|
689
|
-
const
|
|
690
|
-
if (!(typeof
|
|
691
|
-
const
|
|
692
|
-
if (r.keys.has(
|
|
693
|
-
r.bytes +=
|
|
689
|
+
const o = we(e, s.rowKey, { rowIndex: n, dataset: s.dataset });
|
|
690
|
+
if (!(typeof o == "string" && o.trim() || typeof o == "number" && Number.isFinite(o))) throw new TypeError(`标签记录 ${n} 的业务主键无效`);
|
|
691
|
+
const a = JSON.stringify([typeof o, o]);
|
|
692
|
+
if (r.keys.has(a)) throw new TypeError(`标签记录 ${n} 的业务主键重复(包含先前批次)`);
|
|
693
|
+
r.bytes += a.length * 2 + 64, r.keys.add(a);
|
|
694
694
|
}
|
|
695
695
|
function rt(e) {
|
|
696
696
|
return Object.entries(e).reduce((t, [r, n]) => t + 64 + r.length * 2 + (typeof n == "string" ? n.length * 2 : 8), 0);
|
|
@@ -718,15 +718,15 @@ async function ie(e, t, r) {
|
|
|
718
718
|
n.catch(() => {
|
|
719
719
|
}), await T(r.signal, void 0, () => n);
|
|
720
720
|
}
|
|
721
|
-
function
|
|
721
|
+
function ot(e, t, r) {
|
|
722
722
|
return new Promise((n, s) => {
|
|
723
|
-
let
|
|
723
|
+
let o = !1, a = !1, u;
|
|
724
724
|
const f = () => {
|
|
725
725
|
clearTimeout(u), t.removeEventListener("abort", c);
|
|
726
726
|
}, c = () => {
|
|
727
|
-
|
|
728
|
-
if (!
|
|
729
|
-
|
|
727
|
+
o || u !== void 0 || (u = setTimeout(() => {
|
|
728
|
+
if (!o) {
|
|
729
|
+
o = !0, a = !0, f();
|
|
730
730
|
try {
|
|
731
731
|
h(t);
|
|
732
732
|
} catch (i) {
|
|
@@ -736,52 +736,52 @@ function at(e, t, r) {
|
|
|
736
736
|
}, 0));
|
|
737
737
|
};
|
|
738
738
|
e.then((i) => {
|
|
739
|
-
if (
|
|
739
|
+
if (a) {
|
|
740
740
|
Promise.resolve().then(() => r(i)).catch(() => {
|
|
741
741
|
});
|
|
742
742
|
return;
|
|
743
743
|
}
|
|
744
|
-
|
|
744
|
+
o || (o = !0, f(), n(i));
|
|
745
745
|
}, (i) => {
|
|
746
|
-
|
|
746
|
+
o || (o = !0, f(), s(i));
|
|
747
747
|
}), t.addEventListener("abort", c, { once: !0 }), t.aborted && c();
|
|
748
748
|
});
|
|
749
749
|
}
|
|
750
|
-
async function
|
|
751
|
-
const r = _(t.batchSize ?? 100, 1e3, "batchSize"), n = _(t.maxRows ?? 1e5, 1e6, "maxRows"), s = _(t.maxChunks ?? 1e3, 1e4, "maxChunks"),
|
|
750
|
+
async function Ut(e, t) {
|
|
751
|
+
const r = _(t.batchSize ?? 100, 1e3, "batchSize"), n = _(t.maxRows ?? 1e5, 1e6, "maxRows"), s = _(t.maxChunks ?? 1e3, 1e4, "maxChunks"), o = _(t.maxRetainedBytes ?? 16e6, 64e6, "maxRetainedBytes"), a = We(t.template), u = Ye(a);
|
|
752
752
|
if (!e || typeof e[Symbol.asyncIterator] != "function") throw new TypeError("标签来源应为 AsyncIterable");
|
|
753
753
|
return T(t.signal, t.runtime?.budget?.maxDurationMs ?? 12e4, async (f) => {
|
|
754
754
|
const c = { rows: 0, chunks: [] }, i = { keys: /* @__PURE__ */ new Set(), bytes: 0 }, d = e[Symbol.asyncIterator]();
|
|
755
755
|
let l = !1, p = !1, w;
|
|
756
|
-
const g = () => w ??= st(d, f),
|
|
756
|
+
const g = () => w ??= st(d, f), m = () => {
|
|
757
757
|
l || g().catch(() => {
|
|
758
758
|
});
|
|
759
759
|
};
|
|
760
|
-
f.addEventListener("abort",
|
|
760
|
+
f.addEventListener("abort", m, { once: !0 });
|
|
761
761
|
try {
|
|
762
762
|
for (; !l; ) {
|
|
763
763
|
h(f);
|
|
764
|
-
const
|
|
764
|
+
const y = [];
|
|
765
765
|
let v = 0;
|
|
766
|
-
for (;
|
|
766
|
+
for (; y.length < r; ) {
|
|
767
767
|
const I = await T(f, void 0, () => Promise.resolve(d.next()));
|
|
768
768
|
if (I.done) {
|
|
769
769
|
l = !0;
|
|
770
770
|
break;
|
|
771
771
|
}
|
|
772
|
-
if (c.rows +
|
|
772
|
+
if (c.rows + y.length >= n) throw new A("budget", "标签来源行数超过预算", "$.maxRows");
|
|
773
773
|
if (c.chunks.length >= s) throw new A("budget", "标签分块数量超过预算", "$.maxChunks");
|
|
774
|
-
const S = et(I.value, u,
|
|
775
|
-
if (tt(S,
|
|
776
|
-
|
|
774
|
+
const S = et(I.value, u, a.repeat.dataset, c.rows + y.length);
|
|
775
|
+
if (tt(S, a, i, c.rows + y.length), v += rt(S), i.bytes + v > o) throw new A("budget", "标签当前块字段与全局主键索引超过内存预算", "$.maxRetainedBytes");
|
|
776
|
+
y.push(S);
|
|
777
777
|
}
|
|
778
|
-
if (!
|
|
779
|
-
const N = W({ ...t.runtime, reports: { labels: { template:
|
|
778
|
+
if (!y.length) break;
|
|
779
|
+
const N = W({ ...t.runtime, reports: { labels: { template: a, datasets: { [a.repeat.dataset]: y } } } });
|
|
780
780
|
let M;
|
|
781
781
|
const E = {
|
|
782
782
|
index: c.chunks.length,
|
|
783
783
|
rowOffset: c.rows,
|
|
784
|
-
rowCount:
|
|
784
|
+
rowCount: y.length,
|
|
785
785
|
signal: f,
|
|
786
786
|
export: (I) => N.exportPrepared({ pdf: t.pdf, ...I, prepared: M, signal: f })
|
|
787
787
|
};
|
|
@@ -789,8 +789,8 @@ async function Ht(e, t) {
|
|
|
789
789
|
const B = (await Oe([{ id: `labels-${E.index}`, params: {} }], async () => {
|
|
790
790
|
try {
|
|
791
791
|
M = nt(await N.prepare({ reportIds: ["labels"], pdf: t.pdf, signal: f }), E.rowOffset), h(f);
|
|
792
|
-
const I = Promise.resolve(t.execute(M, E)), S = await
|
|
793
|
-
return
|
|
792
|
+
const I = Promise.resolve(t.execute(M, E)), S = await ot(I, f, (k) => ie(t, ae(k), E));
|
|
793
|
+
return ae(S);
|
|
794
794
|
} catch (I) {
|
|
795
795
|
throw C = I, I;
|
|
796
796
|
}
|
|
@@ -798,24 +798,24 @@ async function Ht(e, t) {
|
|
|
798
798
|
if (B.status === "cancelled")
|
|
799
799
|
throw h(f), new Error("标签分批任务已取消");
|
|
800
800
|
if (B.status === "failed") throw C ?? new Error(B.error.message);
|
|
801
|
-
c.chunks.push({ ...B.value, index: E.index, rowOffset: E.rowOffset, rowCount: E.rowCount }), c.rows +=
|
|
801
|
+
c.chunks.push({ ...B.value, index: E.index, rowOffset: E.rowOffset, rowCount: E.rowCount }), c.rows += y.length, await ie(t, B.value, E);
|
|
802
802
|
}
|
|
803
803
|
return c;
|
|
804
|
-
} catch (
|
|
805
|
-
throw p = !0,
|
|
804
|
+
} catch (y) {
|
|
805
|
+
throw p = !0, y;
|
|
806
806
|
} finally {
|
|
807
|
-
f.removeEventListener("abort",
|
|
808
|
-
if (!p) throw
|
|
807
|
+
f.removeEventListener("abort", m), l || await g().catch((y) => {
|
|
808
|
+
if (!p) throw y;
|
|
809
809
|
});
|
|
810
810
|
}
|
|
811
811
|
});
|
|
812
812
|
}
|
|
813
|
-
async function
|
|
813
|
+
async function at(e, t) {
|
|
814
814
|
const r = t.document().id, n = () => t.editor.saving || t.editor.blocked;
|
|
815
815
|
if (n()) throw new Error("草稿尚未保存,请处理设计器提示后再发布");
|
|
816
816
|
if (t.editor.pendingLocalChanges) {
|
|
817
|
-
const
|
|
818
|
-
if (await t.editor.save(), await t.afterSave(), t.successfulSaves() ===
|
|
817
|
+
const o = t.successfulSaves();
|
|
818
|
+
if (await t.editor.save(), await t.afterSave(), t.successfulSaves() === o || t.editor.pendingLocalChanges || n()) throw new Error("草稿尚未保存,请处理设计器提示后再发布");
|
|
819
819
|
}
|
|
820
820
|
const s = t.document();
|
|
821
821
|
if (s.id !== r) throw new b("conflict", "当前模板已切换,请重新确认后发布");
|
|
@@ -828,10 +828,10 @@ function it(e, t) {
|
|
|
828
828
|
const n = await e.list(r.signal);
|
|
829
829
|
if (n.length > 1e3) throw new RangeError("本地模板连接目录最多 1000 项;更大目录请使用宿主分页查询适配器");
|
|
830
830
|
const s = [];
|
|
831
|
-
for (const
|
|
831
|
+
for (const o of n) {
|
|
832
832
|
h(r.signal);
|
|
833
|
-
const [
|
|
834
|
-
f && s.push({ document: f, published: u, draftRevision:
|
|
833
|
+
const [a, u] = await Promise.all([e.get(o.id, { draft: !0, signal: r.signal }), e.get(o.id, { signal: r.signal })]), f = a ?? u;
|
|
834
|
+
f && s.push({ document: f, published: u, draftRevision: a?.revision, publishedRevision: u?.revision, ...t?.($(f)) });
|
|
835
835
|
}
|
|
836
836
|
return Pe(s).search(r);
|
|
837
837
|
},
|
|
@@ -846,11 +846,11 @@ function ct(e = 1e3) {
|
|
|
846
846
|
return {
|
|
847
847
|
forCase(n, s) {
|
|
848
848
|
if (![n, s].every((f) => typeof f == "string" && f.length > 0 && f.length <= 256)) throw new TypeError("模板与参数组标识无效");
|
|
849
|
-
const
|
|
850
|
-
if (
|
|
849
|
+
const o = JSON.stringify([n, s]), a = t.get(o);
|
|
850
|
+
if (a) return a;
|
|
851
851
|
if (t.size >= e) throw new RangeError("本地生成意图已达上限,请使用持久化任务服务");
|
|
852
852
|
const u = `instance-${r}-${(t.size + 1).toString(36)}`;
|
|
853
|
-
return t.set(
|
|
853
|
+
return t.set(o, u), u;
|
|
854
854
|
}
|
|
855
855
|
};
|
|
856
856
|
}
|
|
@@ -864,7 +864,7 @@ function ce(e) {
|
|
|
864
864
|
function dt(e, t, r) {
|
|
865
865
|
const n = $(e);
|
|
866
866
|
if (!n.revision) throw new Error("请先发布该模板");
|
|
867
|
-
const s = typeof t.data == "function" ? t.data($(n)) : t.data,
|
|
867
|
+
const s = typeof t.data == "function" ? t.data($(n)) : t.data, o = W({ ...t.runtime, reports: { [n.id]: { ...s, template: n.template } } }), a = Qe({ runtime: o, instances: t.instances, templateRevisions: { [n.id]: n.revision }, pdf: t.pdf });
|
|
868
868
|
async function u(f, c, i) {
|
|
869
869
|
h(i);
|
|
870
870
|
const d = await t.instances.read(t.scope, f, void 0, i);
|
|
@@ -877,12 +877,12 @@ function dt(e, t, r) {
|
|
|
877
877
|
document: $(n),
|
|
878
878
|
async execute(f, { signal: c }) {
|
|
879
879
|
h(c);
|
|
880
|
-
const i =
|
|
880
|
+
const i = o.validate({ reportIds: [n.id], params: f.params });
|
|
881
881
|
if (!i.ok) throw new Error(i.issues[0]?.message ?? "生成参数无效");
|
|
882
882
|
const d = r(n.id, f.id), l = await u(d, i.values, c);
|
|
883
883
|
if (l) return l;
|
|
884
884
|
try {
|
|
885
|
-
return ce(await
|
|
885
|
+
return ce(await a.generate({
|
|
886
886
|
scope: t.scope,
|
|
887
887
|
id: d,
|
|
888
888
|
title: (t.title?.($(n), f, i.values) ?? `${n.name} · ${f.id}`).slice(0, 512),
|
|
@@ -901,22 +901,22 @@ function dt(e, t, r) {
|
|
|
901
901
|
}
|
|
902
902
|
};
|
|
903
903
|
}
|
|
904
|
-
function
|
|
904
|
+
function Zt(e) {
|
|
905
905
|
e = { ...e };
|
|
906
906
|
const t = ct(), r = e.instanceId ?? t.forCase;
|
|
907
907
|
return {
|
|
908
908
|
catalog: e.catalog ?? it(e.templates, e.catalogMetadata),
|
|
909
|
-
publish: (n) =>
|
|
909
|
+
publish: (n) => at(e.templates, n),
|
|
910
910
|
/** Resolve only a manager-owned publication, then keep that exact revision for this batch. */
|
|
911
911
|
async batch(n, s = {}) {
|
|
912
|
-
const { expectedRevision:
|
|
913
|
-
if (h(
|
|
914
|
-
if (
|
|
912
|
+
const { expectedRevision: o, signal: a } = s, u = await e.templates.get(n, { signal: a });
|
|
913
|
+
if (h(a), !u?.revision) throw new Error("请先发布该模板");
|
|
914
|
+
if (o !== void 0 && u.revision !== o) throw new b("conflict", "模板发布版本已变化,请重新打开后生成");
|
|
915
915
|
return dt(u, e, r);
|
|
916
916
|
}
|
|
917
917
|
};
|
|
918
918
|
}
|
|
919
|
-
const be = "2.
|
|
919
|
+
const be = "2.26.0";
|
|
920
920
|
function U(e, t) {
|
|
921
921
|
const r = t?.componentPath;
|
|
922
922
|
if (!Number.isSafeInteger(t?.pageIndex) || t.pageIndex < 0 || !Array.isArray(r) || r.length < 1 || r.length > 31 || r.length % 3 !== 1 || r.some((s) => !Number.isSafeInteger(s) || s < 0)) throw new TypeError("模板包图片位置无效");
|
|
@@ -947,47 +947,47 @@ function lt(e, t) {
|
|
|
947
947
|
}
|
|
948
948
|
}
|
|
949
949
|
function pt(e, t) {
|
|
950
|
-
const r = (n) => n.every((s,
|
|
950
|
+
const r = (n) => n.every((s, o) => e[o] === s);
|
|
951
951
|
return t === "image/png" ? r([137, 80, 78, 71, 13, 10, 26, 10]) : t === "image/jpeg" ? r([255, 216, 255]) : t === "font/otf" ? r([79, 84, 84, 79]) : r([0, 1, 0, 0]) || r([116, 114, 117, 101]);
|
|
952
952
|
}
|
|
953
953
|
function wt(e) {
|
|
954
954
|
if (!(e instanceof Uint8Array) || !e.byteLength || e.byteLength > 32e6) throw new RangeError("资源摘要只接受1–32MB字节");
|
|
955
955
|
return Re(e);
|
|
956
956
|
}
|
|
957
|
-
function ve(e, t, r =
|
|
958
|
-
const n = new Set(t.flatMap((
|
|
959
|
-
if (
|
|
960
|
-
const u = r(
|
|
957
|
+
function ve(e, t, r = ye()) {
|
|
958
|
+
const n = new Set(t.flatMap((a) => (a.targets ?? []).map((u) => U(e, u)))), s = /* @__PURE__ */ new Map(), o = (a) => {
|
|
959
|
+
if (a.imageData && !n.has(a)) {
|
|
960
|
+
const u = r(a.imageData);
|
|
961
961
|
s.set(u.dataUrl, u.bytes.byteLength);
|
|
962
962
|
}
|
|
963
|
-
for (const u of
|
|
963
|
+
for (const u of a.grid?.cells ?? []) for (const f of u) for (const c of f?.children ?? []) o(c);
|
|
964
964
|
};
|
|
965
|
-
for (const
|
|
966
|
-
return [...s.values()].reduce((
|
|
965
|
+
for (const a of e.template.pages) for (const u of a.components) o(u);
|
|
966
|
+
return [...s.values()].reduce((a, u) => a + u, 0);
|
|
967
967
|
}
|
|
968
|
-
function
|
|
968
|
+
function mt(e, t) {
|
|
969
969
|
let r = "";
|
|
970
970
|
for (let n = 0; n < e.length; n += 16384) r += String.fromCharCode(...e.subarray(n, n + 16384));
|
|
971
971
|
return `data:${t};base64,${btoa(r)}`;
|
|
972
972
|
}
|
|
973
|
-
async function
|
|
973
|
+
async function yt(e, t, r, n, s = 3e4) {
|
|
974
974
|
if (!Number.isFinite(s) || s < 1 || s > 2147483647) throw new RangeError("模板资源加载超时应为1–2147483647毫秒");
|
|
975
|
-
return T(n, s, async (
|
|
976
|
-
const
|
|
975
|
+
return T(n, s, async (o) => {
|
|
976
|
+
const a = [], u = ye();
|
|
977
977
|
ve(e, t, u);
|
|
978
978
|
for (const f of t) {
|
|
979
|
-
h(
|
|
980
|
-
const c = await T(
|
|
981
|
-
if (h(
|
|
979
|
+
h(o);
|
|
980
|
+
const c = await T(o, void 0, () => Promise.resolve(r(JSON.parse(JSON.stringify(f)), { signal: o })));
|
|
981
|
+
if (h(o), !c || !(c.bytes instanceof Uint8Array) || c.mediaType !== f.mediaType || c.bytes.byteLength !== f.bytes) throw new TypeError(`资源 ${f.id} 的类型或大小与清单不一致`);
|
|
982
982
|
const i = new Uint8Array(c.bytes);
|
|
983
983
|
if (!pt(i, f.mediaType) || wt(i) !== f.sha256) throw new TypeError(`资源 ${f.id} 的文件标识或SHA256与清单不一致`);
|
|
984
|
-
if (f.kind === "font")
|
|
984
|
+
if (f.kind === "font") a.push({ id: f.id, family: f.font.family, face: f.font.face, bytes: i });
|
|
985
985
|
else {
|
|
986
|
-
const d = u(
|
|
986
|
+
const d = u(mt(i, f.mediaType)).dataUrl;
|
|
987
987
|
for (const l of f.targets) U(e, l).imageData = d;
|
|
988
988
|
}
|
|
989
989
|
}
|
|
990
|
-
return
|
|
990
|
+
return a;
|
|
991
991
|
});
|
|
992
992
|
}
|
|
993
993
|
function fe(e) {
|
|
@@ -1011,7 +1011,7 @@ function ht(e) {
|
|
|
1011
1011
|
if (!e.contracts || typeof e.contracts != "object" || Array.isArray(e.contracts) || Object.keys(e.contracts).length > 100) throw new TypeError("模板包字段契约应为最多100个数据集");
|
|
1012
1012
|
for (const [t, r] of Object.entries(e.contracts)) {
|
|
1013
1013
|
if (!t.trim() || t.length > 256) throw new TypeError("模板包数据集名称无效");
|
|
1014
|
-
|
|
1014
|
+
me([], r);
|
|
1015
1015
|
}
|
|
1016
1016
|
}
|
|
1017
1017
|
}
|
|
@@ -1024,12 +1024,12 @@ function bt(e, t) {
|
|
|
1024
1024
|
function vt(e, t) {
|
|
1025
1025
|
let r = 0;
|
|
1026
1026
|
for (const s of Object.values(e.datasets))
|
|
1027
|
-
if (!Array.isArray(s) || s.some((
|
|
1027
|
+
if (!Array.isArray(s) || s.some((o) => !o || typeof o != "object" || Array.isArray(o))) throw new TypeError("模板包样例应为对象行数组");
|
|
1028
1028
|
const n = Ie(t.document.template, e.datasets, { maxRows: 1e3 });
|
|
1029
|
-
for (const [s,
|
|
1030
|
-
if (r +=
|
|
1031
|
-
const
|
|
1032
|
-
if (
|
|
1029
|
+
for (const [s, o] of Object.entries(n)) {
|
|
1030
|
+
if (r += o.length, r > 1e3) throw new RangeError("模板包每个样例最多1000行");
|
|
1031
|
+
const a = t.contracts?.[s];
|
|
1032
|
+
if (a && !me(o, a).ok) throw new TypeError(`样例 ${e.name} 不符合 ${s} 字段契约`);
|
|
1033
1033
|
}
|
|
1034
1034
|
for (const s of Object.keys(t.contracts ?? {})) if (!Object.prototype.hasOwnProperty.call(e.datasets, s)) throw new TypeError(`样例 ${e.name} 缺少 ${s} 数据集`);
|
|
1035
1035
|
}
|
|
@@ -1045,20 +1045,20 @@ function xt(e) {
|
|
|
1045
1045
|
function Rt(e, t) {
|
|
1046
1046
|
if (!Array.isArray(e.resources) || e.resources.length > 64) throw new RangeError("模板包最多64个资源依赖");
|
|
1047
1047
|
const r = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
|
|
1048
|
-
let
|
|
1049
|
-
for (const
|
|
1050
|
-
if (lt(
|
|
1051
|
-
if (r.add(
|
|
1052
|
-
const u =
|
|
1048
|
+
let o = 0;
|
|
1049
|
+
for (const a of e.resources) {
|
|
1050
|
+
if (lt(a, e.document), r.has(a.id)) throw new TypeError("模板资源ID重复");
|
|
1051
|
+
if (r.add(a.id), o += a.bytes, o > t) throw new RangeError("模板包资源总大小超过预算");
|
|
1052
|
+
const u = a.font && JSON.stringify([a.font.family, a.font.face]);
|
|
1053
1053
|
if (u && s.has(u)) throw new TypeError("模板包字体family/face重复");
|
|
1054
1054
|
u && s.add(u);
|
|
1055
|
-
for (const f of
|
|
1055
|
+
for (const f of a.targets ?? []) {
|
|
1056
1056
|
const c = JSON.stringify([f.pageIndex, f.componentPath]);
|
|
1057
1057
|
if (n.has(c)) throw new TypeError("同一图片位置不能绑定多个资源");
|
|
1058
1058
|
n.add(c);
|
|
1059
1059
|
}
|
|
1060
1060
|
}
|
|
1061
|
-
if (
|
|
1061
|
+
if (o + ve(e.document, e.resources) > t) throw new RangeError("模板包内嵌与外部资源总大小超过预算");
|
|
1062
1062
|
}
|
|
1063
1063
|
function xe(e, t = {}) {
|
|
1064
1064
|
h(t.signal);
|
|
@@ -1067,18 +1067,18 @@ function xe(e, t = {}) {
|
|
|
1067
1067
|
if (e.length > r || new TextEncoder().encode(e).byteLength > r) throw new RangeError("模板包JSON超过预算");
|
|
1068
1068
|
e = JSON.parse(e);
|
|
1069
1069
|
}
|
|
1070
|
-
const n = Y(e, { maxBytes: r, check: () => h(t.signal), error: (s,
|
|
1070
|
+
const n = Y(e, { maxBytes: r, check: () => h(t.signal), error: (s, o) => new TypeError(o) });
|
|
1071
1071
|
if (!n || typeof n != "object" || Array.isArray(n) || n.schemaVersion !== "1.0" || Object.keys(n).some((s) => !["schemaVersion", "minimumVersion", "document", "contracts", "resources", "fixtures"].includes(s))) throw new TypeError("模板包结构或版本无效");
|
|
1072
1072
|
return gt(n.minimumVersion, t.runtimeVersion ?? be), n.document = $(n.document), ht(n), xt(n), Rt(n, Q(t.maxResourceBytes, 32e6, 64e6)), n;
|
|
1073
1073
|
}
|
|
1074
|
-
function
|
|
1075
|
-
const r = Y(e, { maxBytes: Q(t.maxBytes, 8e6, 32e6), check: () => h(t.signal), error: (s,
|
|
1076
|
-
for (const s of n.resources) for (const
|
|
1074
|
+
function Kt(e, t = {}) {
|
|
1075
|
+
const r = Y(e, { maxBytes: Q(t.maxBytes, 8e6, 32e6), check: () => h(t.signal), error: (s, o) => new TypeError(o) }), n = xe({ schemaVersion: "1.0", ...r, minimumVersion: r.minimumVersion ?? be, resources: r.resources ?? [] }, t);
|
|
1076
|
+
for (const s of n.resources) for (const o of s.targets ?? []) delete U(n.document, o).imageData;
|
|
1077
1077
|
return n;
|
|
1078
1078
|
}
|
|
1079
|
-
async function
|
|
1080
|
-
const { resolve: r, signal: n, maxDurationMs: s } = t,
|
|
1081
|
-
return { document:
|
|
1079
|
+
async function Xt(e, t) {
|
|
1080
|
+
const { resolve: r, signal: n, maxDurationMs: s } = t, o = xe(e, t), a = await yt(o.document, o.resources, r, n, s);
|
|
1081
|
+
return { document: o.document, fonts: a, contracts: o.contracts, fixtures: o.fixtures ?? [] };
|
|
1082
1082
|
}
|
|
1083
1083
|
class x extends Error {
|
|
1084
1084
|
constructor(t, r) {
|
|
@@ -1114,19 +1114,19 @@ function L(e, t) {
|
|
|
1114
1114
|
}
|
|
1115
1115
|
function It(e, t, r = []) {
|
|
1116
1116
|
const n = /* @__PURE__ */ new Map();
|
|
1117
|
-
let s = 0,
|
|
1117
|
+
let s = 0, o = Promise.resolve();
|
|
1118
1118
|
for (const i of r) {
|
|
1119
1119
|
const d = j(i.scope, i.id, i.version);
|
|
1120
1120
|
if (de(i.plan), n.has(d) || !Number.isSafeInteger(i.bytes) || i.bytes < 0 || !Number.isSafeInteger(i.pageCount) || i.pageCount < 0 || i.pageCount > t.maxPages || !["building", "complete", "failed"].includes(i.state) || i.revision !== i.pageCount + (i.state === "building" ? 0 : 1)) throw new x("input", "文档清单无效");
|
|
1121
1121
|
n.set(d, O(i, t.maxManifestBytes)), s += i.bytes;
|
|
1122
1122
|
}
|
|
1123
|
-
function
|
|
1123
|
+
function a(i, d) {
|
|
1124
1124
|
if (s - (d?.bytes ?? 0) + i.bytes > t.maxBytes || !d && n.size >= t.maxDocuments) throw new x("capacity", "文档存储容量已满,请显式清理旧文档");
|
|
1125
1125
|
}
|
|
1126
1126
|
if (n.size > t.maxDocuments || s > t.maxBytes) throw new x("capacity", "已存文档超过预算");
|
|
1127
1127
|
const u = (i) => {
|
|
1128
|
-
const d =
|
|
1129
|
-
return
|
|
1128
|
+
const d = o.then(i);
|
|
1129
|
+
return o = d.then(() => {
|
|
1130
1130
|
}, () => {
|
|
1131
1131
|
}), d;
|
|
1132
1132
|
}, f = (i, d, l, p) => {
|
|
@@ -1136,7 +1136,7 @@ function It(e, t, r = []) {
|
|
|
1136
1136
|
return w;
|
|
1137
1137
|
}, c = async (i, d, l) => {
|
|
1138
1138
|
const p = O(i, t.maxManifestBytes);
|
|
1139
|
-
return
|
|
1139
|
+
return a(p, d), await e.write(p, l), n.set(j(i.scope, i.id), p), s += i.bytes - (d?.bytes ?? 0), O(p, t.maxManifestBytes);
|
|
1140
1140
|
};
|
|
1141
1141
|
return {
|
|
1142
1142
|
create: (i, d) => {
|
|
@@ -1148,42 +1148,42 @@ function It(e, t, r = []) {
|
|
|
1148
1148
|
});
|
|
1149
1149
|
},
|
|
1150
1150
|
append: (i, d, l, p, w, g) => {
|
|
1151
|
-
const
|
|
1152
|
-
if (!
|
|
1151
|
+
const m = O(w, t.maxPageBytes, g), y = le({ pages: [m] });
|
|
1152
|
+
if (!y.ok) throw new x("input", y.errors[0].message);
|
|
1153
1153
|
return u(async () => {
|
|
1154
1154
|
h(g);
|
|
1155
1155
|
const v = f(i, d, l, p);
|
|
1156
1156
|
if (v.state !== "building") throw new x("conflict", "已完成文档不可追加");
|
|
1157
1157
|
if (v.pageCount >= t.maxPages) throw new x("capacity", "文档页数超过预算");
|
|
1158
1158
|
const N = { ...v, revision: p + 1, pageCount: v.pageCount + 1 };
|
|
1159
|
-
return L(N, v.bytes - D(v) + D(
|
|
1159
|
+
return L(N, v.bytes - D(v) + D(m)), c(N, v, { index: v.pageCount, value: m });
|
|
1160
1160
|
});
|
|
1161
1161
|
},
|
|
1162
1162
|
complete: (i, d, l, p, w, g) => {
|
|
1163
|
-
const
|
|
1164
|
-
return
|
|
1163
|
+
const m = w === void 0 ? void 0 : O(w, t.maxManifestBytes, g);
|
|
1164
|
+
return m && pe({ ...m }), u(async () => {
|
|
1165
1165
|
h(g);
|
|
1166
|
-
const
|
|
1167
|
-
if (
|
|
1168
|
-
if (
|
|
1169
|
-
const v = { ...
|
|
1170
|
-
return L(v,
|
|
1166
|
+
const y = f(i, d, l, p);
|
|
1167
|
+
if (y.state !== "building") throw new x("conflict", "文档已完成");
|
|
1168
|
+
if (m && m.stats.pages !== y.pageCount) throw new x("input", "准备结果页数与文档页数不一致");
|
|
1169
|
+
const v = { ...y, revision: p + 1, state: "complete", ...m ? { metadata: m } : {} };
|
|
1170
|
+
return L(v, y.bytes - D(y)), c(v, y);
|
|
1171
1171
|
});
|
|
1172
1172
|
},
|
|
1173
1173
|
fail: (i, d, l, p, w) => {
|
|
1174
1174
|
const g = O(w, 4096);
|
|
1175
1175
|
if (!g || !["cancelled", "generation"].includes(g.code) || typeof g.message != "string" || !g.message.trim() || g.message.length > 1024) throw new x("input", "文档失败状态无效");
|
|
1176
1176
|
return u(async () => {
|
|
1177
|
-
const
|
|
1178
|
-
if (
|
|
1179
|
-
const
|
|
1180
|
-
return L(
|
|
1177
|
+
const m = f(i, d, l, p);
|
|
1178
|
+
if (m.state !== "building") throw new x("conflict", "终态文档不可变更");
|
|
1179
|
+
const y = { ...m, state: "failed", revision: p + 1, failure: g };
|
|
1180
|
+
return L(y, m.bytes - D(m)), c(y, m);
|
|
1181
1181
|
});
|
|
1182
1182
|
},
|
|
1183
1183
|
read: async (i, d, l) => {
|
|
1184
1184
|
h(l);
|
|
1185
1185
|
const p = j(i, d);
|
|
1186
|
-
await
|
|
1186
|
+
await o, h(l);
|
|
1187
1187
|
const w = n.get(p);
|
|
1188
1188
|
return w ? O(w, t.maxManifestBytes) : void 0;
|
|
1189
1189
|
},
|
|
@@ -1192,9 +1192,9 @@ function It(e, t, r = []) {
|
|
|
1192
1192
|
const g = f(i, d, l);
|
|
1193
1193
|
if (!Number.isSafeInteger(p) || p < 0) throw new x("input", "页索引应为非负安全整数");
|
|
1194
1194
|
if (p >= g.pageCount) return;
|
|
1195
|
-
const
|
|
1196
|
-
if (h(w), !
|
|
1197
|
-
return O(
|
|
1195
|
+
const m = await e.readPage(i, d, p);
|
|
1196
|
+
if (h(w), !m) throw new x("missing", "已提交的文档页缺失");
|
|
1197
|
+
return O(m, t.maxPageBytes, w);
|
|
1198
1198
|
}),
|
|
1199
1199
|
remove: (i, d, l, p) => u(async () => {
|
|
1200
1200
|
h(p);
|
|
@@ -1203,13 +1203,13 @@ function It(e, t, r = []) {
|
|
|
1203
1203
|
})
|
|
1204
1204
|
};
|
|
1205
1205
|
}
|
|
1206
|
-
function
|
|
1206
|
+
function Gt(e = {}) {
|
|
1207
1207
|
const t = /* @__PURE__ */ new Map();
|
|
1208
1208
|
return It({
|
|
1209
1209
|
write: async (r, n) => {
|
|
1210
1210
|
if (!n) return;
|
|
1211
|
-
const s = j(r.scope, r.id),
|
|
1212
|
-
|
|
1211
|
+
const s = j(r.scope, r.id), o = t.get(s) ?? [];
|
|
1212
|
+
o[n.index] = n.value, t.set(s, o);
|
|
1213
1213
|
},
|
|
1214
1214
|
readPage: async (r, n, s) => t.get(j(r, n))?.[s],
|
|
1215
1215
|
remove: async (r) => {
|
|
@@ -1217,65 +1217,65 @@ function Xt(e = {}) {
|
|
|
1217
1217
|
}
|
|
1218
1218
|
}, St(e));
|
|
1219
1219
|
}
|
|
1220
|
-
async function
|
|
1220
|
+
async function Et(e, t) {
|
|
1221
1221
|
const r = t.fromPage ?? 0, n = t.limit ?? 4, s = t.maxBytes ?? 8e6;
|
|
1222
1222
|
if (!Number.isSafeInteger(r) || r < 0 || !Number.isSafeInteger(n) || n < 1 || n > 32 || !Number.isSafeInteger(s) || s < 1) throw new x("input", "页窗口参数无效;每次最多读取 32 页");
|
|
1223
|
-
const
|
|
1224
|
-
if (!
|
|
1225
|
-
if (
|
|
1226
|
-
const
|
|
1227
|
-
let u = 0, f = Math.min(r,
|
|
1228
|
-
for (; f < Math.min(
|
|
1223
|
+
const o = await e.read(t.scope, t.id, t.signal);
|
|
1224
|
+
if (!o) throw new x("missing", "文档不存在");
|
|
1225
|
+
if (o.version !== t.version) throw new x("conflict", "文档版本已变化");
|
|
1226
|
+
const a = [];
|
|
1227
|
+
let u = 0, f = Math.min(r, o.pageCount);
|
|
1228
|
+
for (; f < Math.min(o.pageCount, r + n); f++) {
|
|
1229
1229
|
const c = await e.readPage(t.scope, t.id, t.version, f, t.signal);
|
|
1230
1230
|
if (!c) throw new x("missing", "文档页缺失");
|
|
1231
1231
|
const i = D(c);
|
|
1232
1232
|
if (u + i > s) {
|
|
1233
|
-
if (!
|
|
1233
|
+
if (!a.length) throw new x("capacity", "单页超过读取窗口预算");
|
|
1234
1234
|
break;
|
|
1235
1235
|
}
|
|
1236
|
-
|
|
1236
|
+
a.push(c), u += i;
|
|
1237
1237
|
}
|
|
1238
|
-
return { manifest:
|
|
1238
|
+
return { manifest: o, pages: a, nextPage: f };
|
|
1239
1239
|
}
|
|
1240
1240
|
async function Qt(e, t) {
|
|
1241
|
-
const { scope: r, id: n, version: s, signal:
|
|
1242
|
-
let f = await e.create({ scope: r, id: n, version: s, plan: t.plan },
|
|
1241
|
+
const { scope: r, id: n, version: s, signal: o, pages: a } = t, u = t.metadata === void 0 ? void 0 : O(t.metadata, 1e6, o);
|
|
1242
|
+
let f = await e.create({ scope: r, id: n, version: s, plan: t.plan }, o), c;
|
|
1243
1243
|
try {
|
|
1244
|
-
const i = Symbol.asyncIterator in
|
|
1244
|
+
const i = Symbol.asyncIterator in a ? a[Symbol.asyncIterator]() : a[Symbol.iterator]();
|
|
1245
1245
|
for (c = i; ; ) {
|
|
1246
|
-
const d = await T(
|
|
1246
|
+
const d = await T(o, void 0, () => Promise.resolve(i.next()));
|
|
1247
1247
|
if (d.done) break;
|
|
1248
|
-
f = await e.append(r, n, s, f.revision, d.value,
|
|
1248
|
+
f = await e.append(r, n, s, f.revision, d.value, o);
|
|
1249
1249
|
}
|
|
1250
|
-
return await e.complete(r, n, s, f.revision, u,
|
|
1250
|
+
return await e.complete(r, n, s, f.revision, u, o);
|
|
1251
1251
|
} catch (i) {
|
|
1252
1252
|
throw Promise.resolve(c?.return?.()).catch(() => {
|
|
1253
|
-
}), await e.fail(r, n, s, f.revision,
|
|
1253
|
+
}), await e.fail(r, n, s, f.revision, o?.aborted ? { code: "cancelled", message: "报表文档生成已取消" } : { code: "generation", message: "报表文档生成失败" }).catch(() => {
|
|
1254
1254
|
}), i;
|
|
1255
1255
|
}
|
|
1256
1256
|
}
|
|
1257
|
-
const
|
|
1257
|
+
const kt = "1.0", ue = Object.freeze({ params: 422, validate: 422, fetch: 502, config: 400, input: 400, budget: 413, capacity: 413, timeout: 504, "queue-full": 429, closed: 503, cancelled: 499, "output-fidelity": 422, conflict: 409, missing: 404 });
|
|
1258
1258
|
function V(e) {
|
|
1259
1259
|
return e && typeof e == "object" ? e : {};
|
|
1260
1260
|
}
|
|
1261
|
-
function
|
|
1261
|
+
function Ot(e) {
|
|
1262
1262
|
if (Array.isArray(e))
|
|
1263
1263
|
return e.slice(0, 100).map((t) => Object.fromEntries(["code", "path", "field", "message"].flatMap((r) => typeof V(t)[r] == "string" ? [[r, V(t)[r].slice(0, 4096)]] : [])));
|
|
1264
1264
|
}
|
|
1265
1265
|
function Wt(e, t) {
|
|
1266
|
-
const r = V(e), n = r.name === "AbortError" ? "cancelled" : r.code, s = typeof n == "string" && Object.prototype.hasOwnProperty.call(ue, n) ? n : "internal",
|
|
1266
|
+
const r = V(e), n = r.name === "AbortError" ? "cancelled" : r.code, s = typeof n == "string" && Object.prototype.hasOwnProperty.call(ue, n) ? n : "internal", o = s === "internal" ? void 0 : Ot(r.issues ?? V(r.cause).issues);
|
|
1267
1267
|
return { status: ue[s] ?? 500, body: { error: {
|
|
1268
1268
|
code: s,
|
|
1269
1269
|
message: s === "internal" ? "Report execution failed" : typeof r.message == "string" ? r.message.slice(0, 4096) : "Report request failed",
|
|
1270
1270
|
correlationId: t.slice(0, 128),
|
|
1271
1271
|
...s !== "internal" && typeof r.path == "string" ? { path: r.path.slice(0, 4096) } : {},
|
|
1272
|
-
...
|
|
1272
|
+
...o ? { issues: o } : {}
|
|
1273
1273
|
} } };
|
|
1274
1274
|
}
|
|
1275
1275
|
function K(e, t, r) {
|
|
1276
1276
|
return { description: r, headers: { "X-Request-Id": { schema: { type: "string" }, description: "Request correlation identity" } }, content: { [e]: { schema: t } } };
|
|
1277
1277
|
}
|
|
1278
|
-
function
|
|
1278
|
+
function At(e) {
|
|
1279
1279
|
return {
|
|
1280
1280
|
type: "object",
|
|
1281
1281
|
additionalProperties: !1,
|
|
@@ -1290,30 +1290,41 @@ function Yt(e, t = {}) {
|
|
|
1290
1290
|
const n = {
|
|
1291
1291
|
[r]: { get: { operationId: "describeReports", responses: { 200: K("application/json", { type: "array", items: { type: "object" } }, "Authorized report descriptions") } } }
|
|
1292
1292
|
}, s = /* @__PURE__ */ new Set();
|
|
1293
|
-
for (const
|
|
1294
|
-
if (!
|
|
1295
|
-
s.add(
|
|
1296
|
-
for (const
|
|
1297
|
-
const u =
|
|
1293
|
+
for (const o of e) {
|
|
1294
|
+
if (!o.id.trim() || s.has(o.id) || [".", ".."].includes(o.id)) throw new Error("OpenAPI 报表 ID 应非空、唯一且不是路径跳转段");
|
|
1295
|
+
s.add(o.id);
|
|
1296
|
+
for (const a of ["prepare", "pdf", "xlsx"]) {
|
|
1297
|
+
const u = a === "prepare" ? "prepare" : `export/${a}`, f = a !== "prepare", c = { 200: K(f ? a === "pdf" ? "application/pdf" : "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" : "application/json", f ? { type: "string", format: "binary" } : { type: "object", required: ["plan", "stats", "diagnostics", "revisions"] }, f ? "Report file" : "Prepared report snapshot") };
|
|
1298
1298
|
for (const i of [400, 413, 422, 429, 499, 500, 502, 503, 504]) c[String(i)] = K("application/json", { $ref: "#/components/schemas/ReportError" }, "Structured report error");
|
|
1299
|
-
n[`${r}/${encodeURIComponent(
|
|
1300
|
-
operationId: `report_${s.size}_${
|
|
1299
|
+
n[`${r}/${encodeURIComponent(o.id)}/${u}`] = { post: {
|
|
1300
|
+
operationId: `report_${s.size}_${a}`,
|
|
1301
1301
|
parameters: [{ in: "header", name: "X-Request-Id", schema: { type: "string", pattern: "^[A-Za-z0-9._-]{1,80}$" } }],
|
|
1302
|
-
requestBody: { required: !0, content: { "application/json": { schema: { type: "object", required: ["params"], additionalProperties: !1, properties: { params:
|
|
1302
|
+
requestBody: { required: !0, content: { "application/json": { schema: { type: "object", required: ["params"], additionalProperties: !1, properties: { params: At(o) } } } } },
|
|
1303
1303
|
responses: c,
|
|
1304
|
-
"x-report-datasets":
|
|
1304
|
+
"x-report-datasets": o.datasetsSchema
|
|
1305
1305
|
} };
|
|
1306
1306
|
}
|
|
1307
1307
|
}
|
|
1308
1308
|
return {
|
|
1309
1309
|
openapi: "3.1.0",
|
|
1310
|
-
info: { title: t.title ?? "MachReport HTTP", version: t.version ??
|
|
1310
|
+
info: { title: t.title ?? "MachReport HTTP", version: t.version ?? kt },
|
|
1311
1311
|
paths: n,
|
|
1312
1312
|
components: { schemas: { ReportError: { type: "object", required: ["error"], properties: { error: { type: "object", required: ["code", "message", "correlationId"], properties: { code: { type: "string" }, message: { type: "string" }, correlationId: { type: "string" }, path: { type: "string" }, issues: { type: "array", items: { type: "object", additionalProperties: { type: "string" } } } } } } } } }
|
|
1313
1313
|
};
|
|
1314
1314
|
}
|
|
1315
|
+
function er(e, t, r = {}) {
|
|
1316
|
+
const { scope: n, id: s } = t;
|
|
1317
|
+
return {
|
|
1318
|
+
async load(o) {
|
|
1319
|
+
const a = { ...o }, u = a.version ?? (await e.read(n, s, a.signal))?.version;
|
|
1320
|
+
if (!u) throw new x("missing", "文档不存在");
|
|
1321
|
+
return Et(e, { ...a, scope: n, id: s, version: u });
|
|
1322
|
+
},
|
|
1323
|
+
...r.export ? { export: r.export } : {}
|
|
1324
|
+
};
|
|
1325
|
+
}
|
|
1315
1326
|
export {
|
|
1316
|
-
|
|
1327
|
+
kt as REPORT_HTTP_CONTRACT_VERSION,
|
|
1317
1328
|
x as ReportDocumentError,
|
|
1318
1329
|
b as ReportInstanceError,
|
|
1319
1330
|
R as ReportJobError,
|
|
@@ -1322,34 +1333,35 @@ export {
|
|
|
1322
1333
|
X as checkJobIdentity,
|
|
1323
1334
|
H as cloneJob,
|
|
1324
1335
|
it as createManagerTemplateCatalog,
|
|
1325
|
-
|
|
1336
|
+
Gt as createMemoryReportDocumentStore,
|
|
1326
1337
|
ct as createMemoryReportInstanceIds,
|
|
1327
|
-
|
|
1328
|
-
|
|
1338
|
+
Vt as createMemoryReportInstanceStore,
|
|
1339
|
+
nr as createMemoryReportJobStore,
|
|
1340
|
+
er as createReportDocumentSource,
|
|
1329
1341
|
Qe as createReportGenerationService,
|
|
1330
1342
|
Xe as createReportInstanceManager,
|
|
1331
|
-
|
|
1343
|
+
Lt as createReportJobService,
|
|
1332
1344
|
Yt as createReportOpenApi,
|
|
1333
1345
|
W as createReportRuntime,
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1346
|
+
_t as createReportTaskQueue,
|
|
1347
|
+
Kt as createReportTemplatePackage,
|
|
1348
|
+
Zt as createReportWorkflow,
|
|
1337
1349
|
xe as parseReportTemplatePackage,
|
|
1338
|
-
|
|
1350
|
+
Et as readReportDocumentPages,
|
|
1339
1351
|
Wt as reportHttpError,
|
|
1340
|
-
|
|
1352
|
+
Ht as reportInstanceParameterKey,
|
|
1341
1353
|
Ze as reportInstanceSummary,
|
|
1342
1354
|
wt as reportPackageResourceDigest,
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1355
|
+
Xt as resolveReportTemplatePackage,
|
|
1356
|
+
Ft as reviewReportPublication,
|
|
1357
|
+
Ut as runLabelStream,
|
|
1346
1358
|
Oe as runReportBatch,
|
|
1347
|
-
|
|
1348
|
-
|
|
1359
|
+
sr as runnableJob,
|
|
1360
|
+
at as saveAndPublishReportTemplate,
|
|
1349
1361
|
P as serializeJobJson,
|
|
1350
|
-
|
|
1362
|
+
or as snapshotReportBatchCases,
|
|
1351
1363
|
G as snapshotReportInstance,
|
|
1352
1364
|
ar as validateJobRecord,
|
|
1353
|
-
|
|
1365
|
+
ir as validateJobTransition,
|
|
1354
1366
|
Qt as writeReportDocument
|
|
1355
1367
|
};
|