@agile-team/mach-report 2.11.1 → 2.12.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 +15 -6
- package/THIRD_PARTY_NOTICES.md +270 -0
- package/dist/{ExcelBindingWizard-LWX6G1A2.js → ExcelBindingWizard-CeAf4QSE.js} +2 -2
- package/dist/{ExcelBindingWizard-a4kslPHF.cjs → ExcelBindingWizard-y0mT-AHR.cjs} +1 -1
- package/dist/{RuleEditor-C2QsOHOs.cjs → RuleEditor-ChRzNQuF.cjs} +1 -1
- package/dist/{RuleEditor-D9wQHrkf.js → RuleEditor-DzAmW5YH.js} +1 -1
- package/dist/analytics.d.cts +28 -0
- package/dist/analytics.d.ts +28 -0
- package/dist/assets-C2U-e-Sz.cjs +4 -0
- package/dist/assets-Q0wUwNrV.js +217 -0
- package/dist/code-options-BKXXY7NI.js +18 -0
- package/dist/code-options-BUTChiZZ.cjs +1 -0
- package/dist/codes.cjs +9 -0
- package/dist/codes.d.cts +223 -0
- package/dist/codes.d.ts +223 -0
- package/dist/codes.js +26917 -0
- package/dist/designer.cjs +2 -2
- package/dist/designer.d.cts +267 -0
- package/dist/designer.d.ts +267 -0
- package/dist/designer.js +2737 -1941
- package/dist/grid-strokes-Cr7DwUux.cjs +1 -0
- package/dist/grid-strokes-DyyG1q_o.js +53 -0
- package/dist/index.cjs +7 -7
- package/dist/index.d.cts +80 -1
- package/dist/index.d.ts +80 -1
- package/dist/index.js +404 -374
- package/dist/pdf.cjs +76 -59
- package/dist/pdf.d.cts +51 -0
- package/dist/pdf.d.ts +51 -0
- package/dist/pdf.js +32193 -32102
- package/dist/record-bindings-By_UKZ2g.cjs +1 -0
- package/dist/{list-cell-ClFra1zS.js → record-bindings-D-5jQlTj.js} +67 -44
- package/dist/{region-binding-workflow-DhQvu1co.cjs → region-binding-workflow-BzfbxRiR.cjs} +1 -1
- package/dist/{region-binding-workflow-CXDmt9Bs.js → region-binding-workflow-CcUq8W2Q.js} +1 -1
- package/dist/server/node.d.cts +52 -1
- package/dist/server/node.d.ts +52 -1
- package/dist/server-node.cjs +1 -1
- package/dist/server-node.js +239 -210
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +95 -3
- package/dist/server.d.ts +95 -3
- package/dist/server.js +456 -433
- package/dist/style.css +1 -1
- package/dist/{template-registry-WNXdkiET.js → template-registry-BjE1VS6g.js} +221 -157
- package/dist/template-registry-D3SjENi6.cjs +1 -0
- package/dist/template-review-BfCC8Ng9.cjs +2 -0
- package/dist/{template-review-BdcXSYbx.js → template-review-BzpcI-tR.js} +772 -666
- package/dist/validate-BJ5HIWY8.cjs +1 -0
- package/dist/validate-DbgEM1Hh.js +163 -0
- package/dist/vue/async.d.cts +121 -2
- package/dist/vue/async.d.ts +121 -2
- package/dist/vue/index.d.cts +114 -6
- package/dist/vue/index.d.ts +114 -6
- package/dist/{workbook-session-BKOTwcoq.js → workbook-session-BPb3TMnT.js} +1 -1
- package/dist/{workbook-session-CLYLhZWu.cjs → workbook-session-DNa2RHNG.cjs} +1 -1
- package/dist/worker.cjs +1 -1
- package/dist/worker.d.cts +52 -1
- package/dist/worker.d.ts +52 -1
- package/dist/worker.js +2 -2
- package/dist/xlsx.cjs +1 -1
- package/dist/xlsx.d.cts +40 -0
- package/dist/xlsx.d.ts +40 -0
- package/dist/xlsx.js +3 -3
- package/package.json +16 -3
- package/dist/assets-Bu6UohJx.cjs +0 -1
- package/dist/assets-DegqDNqY.js +0 -160
- package/dist/list-cell-BuYn4tGF.cjs +0 -1
- package/dist/template-registry-ukBGlm8N.cjs +0 -1
- package/dist/template-review-BXp2oyqg.cjs +0 -1
- package/dist/textwrap-CWHyzkBH.cjs +0 -4
- package/dist/textwrap-DE1kgcJB.js +0 -110
- package/dist/validate-7s0yn6ii.js +0 -148
- package/dist/validate-DsRiNw8h.cjs +0 -1
package/dist/server.js
CHANGED
|
@@ -1,422 +1,425 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { g as
|
|
3
|
-
import { d as
|
|
4
|
-
import { v as
|
|
5
|
-
import { g as
|
|
6
|
-
import { c as
|
|
7
|
-
import { r as
|
|
8
|
-
import { T as
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { A as ce, b as k, k as le, B as ue, a as de, P as fe, n as pe, y as ge } from "./template-review-BzpcI-tR.js";
|
|
2
|
+
import { g as F } from "./report-params-B44imUd4.js";
|
|
3
|
+
import { d as X, r as we, R as te } from "./param-validation-BlHHXs6u.js";
|
|
4
|
+
import { v as me, c as z, a as R, t as x, R as A, b, d as L, s as I, e as T, j as ye, f as he } from "./batch-mRqhhhjt.js";
|
|
5
|
+
import { g as at, r as ot, h as it, i as ct, k as lt, l as ut } from "./batch-mRqhhhjt.js";
|
|
6
|
+
import { c as re } from "./validate-DbgEM1Hh.js";
|
|
7
|
+
import { r as G, c as C, n as _ } from "./task-events-Dpsvf_t2.js";
|
|
8
|
+
import { T as ve } from "./tree-CqcQ99NM.js";
|
|
9
|
+
import { r as be } from "./assets-Q0wUwNrV.js";
|
|
10
|
+
import { p as xe } from "./template-registry-BjE1VS6g.js";
|
|
11
|
+
function se(e, t) {
|
|
12
|
+
if (t.length === 0) throw new k("config", "缺少报表 ID");
|
|
13
|
+
return t.map((r) => {
|
|
14
|
+
if (!Object.prototype.hasOwnProperty.call(e, r)) throw new k("config", `未注册报表 ${r}`);
|
|
15
|
+
return e[r];
|
|
15
16
|
});
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
-
return e.grid?.cells.reduce((t,
|
|
18
|
+
function $(e) {
|
|
19
|
+
return e.grid?.cells.reduce((t, r) => t + r.reduce((a, s) => a + (s ? 1 + (s.children?.reduce((n, i) => n + $(i), 0) ?? 0) : 0), 0), 0) ?? 0;
|
|
19
20
|
}
|
|
20
|
-
function
|
|
21
|
-
return e.pages.reduce((a,
|
|
21
|
+
function Se(e, t, r) {
|
|
22
|
+
return e.pages.reduce((a, s) => a + s.components.reduce((n, i) => i.kind !== "list" ? n + $(i) : n + pe(i, t, r), 0), 0);
|
|
22
23
|
}
|
|
23
|
-
function
|
|
24
|
-
return
|
|
25
|
-
const
|
|
24
|
+
function Re(e, t = Object.keys(e)) {
|
|
25
|
+
return se(e, t).map((r, a) => {
|
|
26
|
+
const s = t[a], n = F(e, [s]);
|
|
26
27
|
return {
|
|
27
|
-
id:
|
|
28
|
+
id: s,
|
|
28
29
|
params: JSON.parse(JSON.stringify(n)),
|
|
29
|
-
paramsSchema:
|
|
30
|
-
datasetsSchema: Object.fromEntries(Object.entries(
|
|
30
|
+
paramsSchema: we(n),
|
|
31
|
+
datasetsSchema: Object.fromEntries(Object.entries(r.dataSchema ?? {}).map(([i, l]) => [i, ce(typeof r.template == "function" ? void 0 : r.template, i, l)])),
|
|
31
32
|
capabilities: {
|
|
32
|
-
save: !!
|
|
33
|
-
export: !!
|
|
34
|
-
templates: !!
|
|
33
|
+
save: !!r.provider?.save,
|
|
34
|
+
export: !!r.provider?.export,
|
|
35
|
+
templates: !!r.provider?.templates
|
|
35
36
|
}
|
|
36
37
|
};
|
|
37
38
|
});
|
|
38
39
|
}
|
|
39
|
-
function
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
return { ...
|
|
40
|
+
function ne(e, t) {
|
|
41
|
+
se(e, t.reportIds);
|
|
42
|
+
const r = X(F(e, t.reportIds), t.params), a = t.reportIds.flatMap((n) => X(F(e, [n]), t.params).issues), s = new Map(a.map((n) => [JSON.stringify(n), n]));
|
|
43
|
+
return { ...r, ok: s.size === 0, issues: [...s.values()] };
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
-
const
|
|
46
|
-
if (!
|
|
47
|
-
const a = e.plan.pages.length,
|
|
48
|
-
return R(t, "maxRows", e.stats.rows), R(t, "maxPages", a), R(t, "maxCells",
|
|
45
|
+
function Ie(e, t) {
|
|
46
|
+
const r = re(e.plan);
|
|
47
|
+
if (!r.ok) throw new k("validate", `执行器返回无效计划:${r.errors[0]?.path}`);
|
|
48
|
+
const a = e.plan.pages.length, s = e.plan.pages.reduce((n, i) => n + i.components.reduce((l, f) => l + $(f), 0), 0);
|
|
49
|
+
return R(t, "maxRows", e.stats.rows), R(t, "maxPages", a), R(t, "maxCells", s), { ...e, stats: { ...e.stats, pages: a, cells: s } };
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
-
const
|
|
52
|
-
if (!
|
|
51
|
+
function U(e, t) {
|
|
52
|
+
const r = ne(e.reports, t);
|
|
53
|
+
if (!r.ok) throw new te(r.issues);
|
|
53
54
|
}
|
|
54
|
-
function
|
|
55
|
-
return e.map(({ code: t, message:
|
|
55
|
+
function q(e = []) {
|
|
56
|
+
return e.map(({ code: t, message: r, severity: a, pageIndex: s, componentIndex: n }) => ({ code: t, message: r, severity: a, path: `$.pages.${s}.components.${n}` }));
|
|
56
57
|
}
|
|
57
|
-
function
|
|
58
|
+
function Oe(e) {
|
|
58
59
|
const t = { maxRows: 1e5, maxPages: 1e4, maxCells: 2e6, maxOutputBytes: 1e8, maxDurationMs: 12e4, ...e.budget };
|
|
59
|
-
|
|
60
|
-
const
|
|
60
|
+
me(t);
|
|
61
|
+
const r = async (s, n) => {
|
|
61
62
|
const i = Date.now();
|
|
62
63
|
let l = 0, f = 0;
|
|
63
|
-
const o = [],
|
|
64
|
-
...
|
|
65
|
-
pagination: { ...e.pagination, ...
|
|
64
|
+
const o = [], d = {}, c = Object.fromEntries(Object.entries(e.reports).map(([p, v]) => [p, {
|
|
65
|
+
...v,
|
|
66
|
+
pagination: { ...e.pagination, ...v.pagination, ...n ? { measurer: n } : {} },
|
|
66
67
|
dataValidation: {
|
|
67
|
-
...
|
|
68
|
-
maxRows: Math.min(t.maxRows ?? 1e5,
|
|
69
|
-
maxCells: Math.min(t.maxCells ?? 2e6,
|
|
68
|
+
...v.dataValidation,
|
|
69
|
+
maxRows: Math.min(t.maxRows ?? 1e5, v.dataValidation?.maxRows ?? 1 / 0),
|
|
70
|
+
maxCells: Math.min(t.maxCells ?? 2e6, v.dataValidation?.maxCells ?? 1 / 0)
|
|
70
71
|
}
|
|
71
|
-
}])),
|
|
72
|
+
}])), y = await le(c, { maxPages: t.maxPages, maxCells: t.maxCells, onDatasets: (p, v, j) => {
|
|
72
73
|
try {
|
|
73
|
-
l +=
|
|
74
|
-
} catch (
|
|
75
|
-
throw
|
|
74
|
+
l += ue(j, v, { maxRows: t.maxRows, signal: s.signal });
|
|
75
|
+
} catch (P) {
|
|
76
|
+
throw P instanceof ve ? new A("budget", P.message, "$.budget.maxRows") : P;
|
|
76
77
|
}
|
|
77
|
-
R(t, "maxRows", l), f +=
|
|
78
|
-
} })({ ...
|
|
79
|
-
Object.defineProperty(
|
|
80
|
-
} }).catch((
|
|
81
|
-
throw
|
|
78
|
+
R(t, "maxRows", l), f += Se(j, v, c[p]?.pagination), R(t, "maxCells", f);
|
|
79
|
+
} })({ ...s, params: s.params ?? {}, onWarning: (p) => o.push({ code: "layout", message: p, severity: "warning" }), onQueryResult: (p, v) => {
|
|
80
|
+
Object.defineProperty(d, p, { value: { revision: v.revision, sourceToken: v.sourceToken }, enumerable: !0, writable: !0 }), o.push(...v.diagnostics ?? []);
|
|
81
|
+
} }).catch((p) => {
|
|
82
|
+
throw p instanceof k && p.cause instanceof de ? new A("budget", p.cause.message, "$.budget.maxPages") : p instanceof k && p.cause instanceof fe ? new A("budget", p.cause.message, "$.budget.maxCells") : p;
|
|
82
83
|
});
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
x(s.signal);
|
|
85
|
+
const h = e.assets ? await C(s).run("assets", () => be(y, { ...e.assets, signal: s.signal })) : { plan: y, diagnostics: [] }, w = h.plan;
|
|
86
|
+
o.push(...q(h.diagnostics));
|
|
87
|
+
const g = w.pages.reduce((p, v) => p + v.components.reduce((j, P) => j + $(P), 0), 0);
|
|
88
|
+
return R(t, "maxPages", w.pages.length), R(t, "maxCells", g), { plan: w, diagnostics: o, revisions: d, stats: { rows: l, pages: w.pages.length, cells: g, durationMs: Date.now() - i } };
|
|
89
|
+
}, a = async (s) => {
|
|
87
90
|
const n = Date.now();
|
|
88
|
-
if (
|
|
89
|
-
const i =
|
|
90
|
-
|
|
91
|
-
const l =
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
let
|
|
95
|
-
if (
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
|
|
91
|
+
if (s.format !== "pdf" && s.format !== "xlsx") throw new k("config", "不支持的报表导出格式");
|
|
92
|
+
const i = s.format === "pdf" ? await import("@agile-team/mach-report/pdf") : void 0;
|
|
93
|
+
x(s.signal);
|
|
94
|
+
const l = s.pdf?.customFontFaces ?? (s.pdf?.customFontBytes ? { regular: s.pdf.customFontBytes } : void 0), f = i && l ? i.createFontBytesMeasurer(l) : void 0, o = await r(s, f);
|
|
95
|
+
x(s.signal);
|
|
96
|
+
const d = C(s), c = await d.run("encode", async () => {
|
|
97
|
+
let h;
|
|
98
|
+
if (s.format === "pdf") {
|
|
99
|
+
x(s.signal);
|
|
100
|
+
const w = await i.renderPlanToPdf(o.plan, { ...s.pdf, ...f ? { measurer: f } : {}, fidelity: s.fidelity, signal: s.signal, onProgress: (g, p) => d.progress("encode", g, p) });
|
|
101
|
+
h = w.bytes, o.diagnostics.push(...q(w.diagnostics)), o.diagnostics.push(...w.fidelityWarnings.map((g) => ({ code: "pdf-fidelity", message: g, severity: "warning" })), ...w.pageErrors.map((g) => ({ code: "pdf-page", message: g, severity: "error" }))), w.unsupportedTextCount && o.diagnostics.push({ code: "pdf-font", message: `${w.unsupportedTextCount} 段文本包含当前字体不支持的字符`, severity: "warning" });
|
|
99
102
|
} else {
|
|
100
|
-
const { renderPlanToXlsx:
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
|
|
103
|
+
const { renderPlanToXlsx: w } = await import("@agile-team/mach-report/xlsx");
|
|
104
|
+
x(s.signal);
|
|
105
|
+
const g = await w(o.plan, { ...s.xlsx, fidelity: s.fidelity, signal: s.signal, onProgress: (p, v) => d.progress("encode", p, v) });
|
|
106
|
+
h = new Uint8Array(g.buffer), o.diagnostics.push(...q(g.diagnostics)), o.diagnostics.push(...g.warnings.map((p) => ({ code: "xlsx-fidelity", message: p, severity: "warning" })));
|
|
104
107
|
}
|
|
105
|
-
return
|
|
108
|
+
return x(s.signal), h;
|
|
106
109
|
});
|
|
107
110
|
R(t, "maxOutputBytes", c.byteLength);
|
|
108
|
-
const { plan:
|
|
109
|
-
return { ...
|
|
111
|
+
const { plan: u, ...y } = o;
|
|
112
|
+
return { ...y, bytes: c, format: s.format, contentType: s.format === "pdf" ? "application/pdf" : "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", stats: { ...y.stats, durationMs: Date.now() - n, outputBytes: c.byteLength } };
|
|
110
113
|
};
|
|
111
114
|
return {
|
|
112
|
-
describe: (
|
|
113
|
-
validate: (
|
|
114
|
-
prepare: (
|
|
115
|
-
const { signal: i, onEvent: l, ...f } =
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
return
|
|
115
|
+
describe: (s) => Re(e.reports, s),
|
|
116
|
+
validate: (s) => ne(e.reports, s),
|
|
117
|
+
prepare: (s) => z(s.signal, t.maxDurationMs, async (n) => {
|
|
118
|
+
const { signal: i, onEvent: l, ...f } = s, o = { ...f, taskId: f.taskId ?? G() }, d = l ? (y) => _(l, y, n) : void 0, c = { ...o, signal: n, onEvent: d };
|
|
119
|
+
C(c).runSync("validate", () => U(e, o));
|
|
120
|
+
const u = e.executor ? await e.executor.prepare(o, n, d) : await r(c);
|
|
121
|
+
return Ie(u, t);
|
|
119
122
|
}),
|
|
120
|
-
export: (
|
|
121
|
-
const { signal: i, onEvent: l, ...f } =
|
|
122
|
-
if (
|
|
123
|
-
const
|
|
124
|
-
return R(t, "maxRows",
|
|
123
|
+
export: (s) => z(s.signal, t.maxDurationMs, async (n) => {
|
|
124
|
+
const { signal: i, onEvent: l, ...f } = s, o = { ...f, taskId: f.taskId ?? G() }, d = l ? (y) => _(l, y, n) : void 0, c = { ...o, signal: n, onEvent: d };
|
|
125
|
+
if (C(c).runSync("validate", () => U(e, o)), o.format !== "pdf" && o.format !== "xlsx") throw new k("config", "不支持的报表导出格式");
|
|
126
|
+
const u = e.executor ? await e.executor.export(o, n, d) : await a(c);
|
|
127
|
+
return R(t, "maxRows", u.stats.rows), R(t, "maxPages", u.stats.pages), R(t, "maxCells", u.stats.cells), R(t, "maxOutputBytes", u.bytes.byteLength), { ...u, stats: { ...u.stats, outputBytes: u.bytes.byteLength } };
|
|
125
128
|
})
|
|
126
129
|
};
|
|
127
130
|
}
|
|
128
|
-
function
|
|
129
|
-
const t = e.concurrency ?? 1,
|
|
130
|
-
if (!Number.isSafeInteger(t) || t < 1 || !Number.isSafeInteger(
|
|
131
|
-
const a = [],
|
|
131
|
+
function Ze(e = {}) {
|
|
132
|
+
const t = e.concurrency ?? 1, r = e.maxQueued ?? 20;
|
|
133
|
+
if (!Number.isSafeInteger(t) || t < 1 || !Number.isSafeInteger(r) || r < 0) throw new A("budget", "队列并发应为正整数,排队上限应为非负整数");
|
|
134
|
+
const a = [], s = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
132
135
|
let i = !1, l = 0;
|
|
133
136
|
const f = () => {
|
|
134
|
-
for (; !i &&
|
|
137
|
+
for (; !i && s.size < t && a.length; ) a.shift().start();
|
|
135
138
|
};
|
|
136
139
|
return {
|
|
137
140
|
get active() {
|
|
138
|
-
return
|
|
141
|
+
return s.size;
|
|
139
142
|
},
|
|
140
143
|
get pending() {
|
|
141
144
|
return a.length;
|
|
142
145
|
},
|
|
143
|
-
enqueue: (
|
|
146
|
+
enqueue: (d, c = {}) => {
|
|
144
147
|
if (i) throw new A("closed", "任务队列已关闭");
|
|
145
|
-
if (
|
|
146
|
-
const
|
|
147
|
-
if (n.has(
|
|
148
|
-
const
|
|
149
|
-
let
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
}),
|
|
153
|
-
c.signal?.removeEventListener("abort",
|
|
154
|
-
},
|
|
155
|
-
if (
|
|
156
|
-
const O =
|
|
157
|
-
|
|
148
|
+
if (x(c.signal), s.size >= t && a.length >= r) throw new A("queue-full", "报表任务队列已满");
|
|
149
|
+
const u = c.id ?? `report-${++l}`;
|
|
150
|
+
if (n.has(u)) throw new A("queue-full", "任务 ID 正在执行或排队");
|
|
151
|
+
const y = new AbortController();
|
|
152
|
+
let h = "queued", w, g, p, v;
|
|
153
|
+
const j = new Promise((S, O) => {
|
|
154
|
+
p = S, v = O;
|
|
155
|
+
}), P = () => {
|
|
156
|
+
c.signal?.removeEventListener("abort", H), n.delete(u);
|
|
157
|
+
}, J = (S) => {
|
|
158
|
+
if (h !== "queued" && h !== "running") return;
|
|
159
|
+
const O = h === "queued";
|
|
160
|
+
h = "cancelled", y.abort(S);
|
|
158
161
|
try {
|
|
159
|
-
|
|
160
|
-
} catch (
|
|
161
|
-
|
|
162
|
+
x(y.signal);
|
|
163
|
+
} catch (D) {
|
|
164
|
+
v(D);
|
|
162
165
|
}
|
|
163
166
|
if (O) {
|
|
164
|
-
const
|
|
165
|
-
|
|
167
|
+
const D = a.indexOf(N);
|
|
168
|
+
D >= 0 && a.splice(D, 1), P(), f();
|
|
166
169
|
}
|
|
167
|
-
},
|
|
168
|
-
|
|
169
|
-
},
|
|
170
|
-
|
|
171
|
-
},
|
|
172
|
-
cancel:
|
|
170
|
+
}, H = () => J(c.signal?.reason), Q = (S, O) => {
|
|
171
|
+
h === "running" && (!Number.isFinite(S) || S < 0 || O !== void 0 && (!Number.isFinite(O) || O < S) || (w = { completed: S, ...O === void 0 ? {} : { total: O } }));
|
|
172
|
+
}, ie = (S) => {
|
|
173
|
+
h !== "running" || y.signal.aborted || (g = { ...S, taskId: u }, S.completed !== void 0 && Q(S.completed, S.total), _(c.onEvent, g, y.signal));
|
|
174
|
+
}, N = {
|
|
175
|
+
cancel: J,
|
|
173
176
|
start: () => {
|
|
174
|
-
|
|
175
|
-
(
|
|
176
|
-
|
|
177
|
+
h === "queued" && (h = "running", s.add(N), Promise.resolve().then(() => (x(y.signal), d({ taskId: u, signal: y.signal, reportProgress: Q, onEvent: ie }))).then(
|
|
178
|
+
(S) => {
|
|
179
|
+
h === "running" && (h = "completed", p(S));
|
|
177
180
|
},
|
|
178
|
-
(
|
|
179
|
-
|
|
181
|
+
(S) => {
|
|
182
|
+
h === "running" && (h = "failed", v(S));
|
|
180
183
|
}
|
|
181
184
|
).finally(() => {
|
|
182
|
-
|
|
185
|
+
s.delete(N), P(), f();
|
|
183
186
|
}));
|
|
184
187
|
}
|
|
185
188
|
};
|
|
186
|
-
return n.add(
|
|
187
|
-
return
|
|
189
|
+
return n.add(u), c.signal?.addEventListener("abort", H, { once: !0 }), c.signal?.aborted ? J(c.signal.reason) : s.size < t ? N.start() : a.push(N), { id: u, get status() {
|
|
190
|
+
return h;
|
|
188
191
|
}, get progress() {
|
|
189
|
-
return
|
|
192
|
+
return w;
|
|
190
193
|
}, get event() {
|
|
191
|
-
return
|
|
192
|
-
}, result:
|
|
194
|
+
return g;
|
|
195
|
+
}, result: j, cancel: J };
|
|
193
196
|
},
|
|
194
|
-
close: (
|
|
197
|
+
close: (d = {}) => {
|
|
195
198
|
i = !0;
|
|
196
199
|
for (const c of [...a]) c.cancel(new A("closed", "任务队列已关闭"));
|
|
197
|
-
if (
|
|
200
|
+
if (d.cancelRunning) for (const c of s) c.cancel(new A("closed", "任务队列已关闭"));
|
|
198
201
|
}
|
|
199
202
|
};
|
|
200
203
|
}
|
|
201
|
-
function
|
|
202
|
-
let t,
|
|
203
|
-
const a = new Promise((
|
|
204
|
-
t =
|
|
204
|
+
function Ae(e) {
|
|
205
|
+
let t, r;
|
|
206
|
+
const a = new Promise((s, n) => {
|
|
207
|
+
t = s, r = n;
|
|
205
208
|
});
|
|
206
209
|
return a.catch(() => {
|
|
207
|
-
}), { progress: e, promise: a, resolve: t, reject:
|
|
210
|
+
}), { progress: e, promise: a, resolve: t, reject: r };
|
|
208
211
|
}
|
|
209
|
-
function
|
|
212
|
+
function W(e) {
|
|
210
213
|
const t = Promise.reject(e);
|
|
211
214
|
return t.catch(() => {
|
|
212
215
|
}), t;
|
|
213
216
|
}
|
|
214
|
-
function
|
|
215
|
-
let
|
|
217
|
+
function Pe(e, t) {
|
|
218
|
+
let r, a, s = !0, n;
|
|
216
219
|
function i(o) {
|
|
217
220
|
n ??= o ?? new Error("任务心跳更新失败"), a?.reject(n), a = void 0, t(n);
|
|
218
221
|
}
|
|
219
222
|
function l(o) {
|
|
220
|
-
const
|
|
223
|
+
const d = Promise.resolve().then(() => e(o?.progress)).then(
|
|
221
224
|
() => o?.resolve(),
|
|
222
225
|
(c) => {
|
|
223
226
|
o?.reject(c), i(c);
|
|
224
227
|
}
|
|
225
228
|
).finally(() => {
|
|
226
|
-
|
|
229
|
+
r = void 0;
|
|
227
230
|
const c = a;
|
|
228
231
|
a = void 0, c && n === void 0 && l(c);
|
|
229
232
|
});
|
|
230
|
-
|
|
233
|
+
r = d, d.catch((c) => {
|
|
231
234
|
i(c);
|
|
232
235
|
});
|
|
233
236
|
}
|
|
234
237
|
function f(o) {
|
|
235
|
-
if (!
|
|
236
|
-
return
|
|
237
|
-
new
|
|
238
|
+
if (!s)
|
|
239
|
+
return W(
|
|
240
|
+
new b("closed", "任务进度上报已结束")
|
|
238
241
|
);
|
|
239
|
-
if (n !== void 0) return
|
|
240
|
-
a ? a.progress = o : a =
|
|
241
|
-
const
|
|
242
|
-
return
|
|
242
|
+
if (n !== void 0) return W(n);
|
|
243
|
+
a ? a.progress = o : a = Ae(o);
|
|
244
|
+
const d = a;
|
|
245
|
+
return r || (a = void 0, l(d)), d.promise;
|
|
243
246
|
}
|
|
244
247
|
return {
|
|
245
248
|
progress: f,
|
|
246
249
|
pulse() {
|
|
247
|
-
|
|
250
|
+
s && !r && n === void 0 && l();
|
|
248
251
|
},
|
|
249
252
|
async finish() {
|
|
250
|
-
for (
|
|
253
|
+
for (s = !1; r; ) await r;
|
|
251
254
|
if (n !== void 0) throw n;
|
|
252
255
|
}
|
|
253
256
|
};
|
|
254
257
|
}
|
|
255
|
-
class
|
|
258
|
+
class Z extends b {
|
|
256
259
|
constructor() {
|
|
257
260
|
super("capacity", "任务结果超过独立预算,请保存文件引用");
|
|
258
261
|
}
|
|
259
262
|
}
|
|
260
|
-
function
|
|
261
|
-
const t = e.concurrency ?? 1,
|
|
262
|
-
if (![t,
|
|
263
|
+
function ke(e) {
|
|
264
|
+
const t = e.concurrency ?? 1, r = e.leaseMs ?? 3e4, a = e.heartbeatMs ?? 1e4, s = e.maxResultBytes ?? 256 * 1024;
|
|
265
|
+
if (![t, r, a, s].every(
|
|
263
266
|
(i) => Number.isSafeInteger(i) && i > 0
|
|
264
|
-
) || a * 2 >
|
|
265
|
-
throw new
|
|
267
|
+
) || a * 2 > r)
|
|
268
|
+
throw new b(
|
|
266
269
|
"input",
|
|
267
270
|
"并发、租约、心跳应为正整数,租约至少为心跳的两倍"
|
|
268
271
|
);
|
|
269
272
|
if (a > 2147483647)
|
|
270
|
-
throw new
|
|
273
|
+
throw new b(
|
|
271
274
|
"input",
|
|
272
275
|
"心跳间隔超过平台定时器上限(2147483647毫秒)"
|
|
273
276
|
);
|
|
274
|
-
return { concurrency: t, leaseMs:
|
|
277
|
+
return { concurrency: t, leaseMs: r, heartbeatMs: a, maxResultBytes: s, now: () => {
|
|
275
278
|
const i = (e.now ?? Date.now)();
|
|
276
279
|
if (!Number.isSafeInteger(i) || i < 0)
|
|
277
|
-
throw new
|
|
280
|
+
throw new b("input", "任务时钟应返回非负整数毫秒");
|
|
278
281
|
return i;
|
|
279
282
|
} };
|
|
280
283
|
}
|
|
281
|
-
async function
|
|
282
|
-
|
|
283
|
-
const a = await e.read(t,
|
|
284
|
-
if (!a) throw new
|
|
284
|
+
async function M(e, t, r) {
|
|
285
|
+
L(t, r);
|
|
286
|
+
const a = await e.read(t, r);
|
|
287
|
+
if (!a) throw new b("missing", "报表任务不存在");
|
|
285
288
|
return a;
|
|
286
289
|
}
|
|
287
|
-
async function
|
|
288
|
-
const
|
|
289
|
-
for (const n of a) delete
|
|
290
|
+
async function B(e, t, r, a = []) {
|
|
291
|
+
const s = { ...t, ...r, revision: t.revision + 1 };
|
|
292
|
+
for (const n of a) delete s[n];
|
|
290
293
|
if (!await e.compareAndSwap(
|
|
291
294
|
t.scope,
|
|
292
295
|
t.id,
|
|
293
296
|
t.revision,
|
|
294
|
-
|
|
297
|
+
s
|
|
295
298
|
))
|
|
296
|
-
throw new
|
|
297
|
-
return
|
|
299
|
+
throw new b("conflict", "报表任务已被其他请求更新");
|
|
300
|
+
return T(s);
|
|
298
301
|
}
|
|
299
|
-
async function
|
|
302
|
+
async function je(e, t, r, a) {
|
|
300
303
|
if (!t.trim() || t.length > 128)
|
|
301
|
-
throw new
|
|
302
|
-
for (const
|
|
303
|
-
const n =
|
|
304
|
-
...
|
|
305
|
-
revision:
|
|
304
|
+
throw new b("input", "workerId应为1–128位标识");
|
|
305
|
+
for (const s of await e.store.candidates(a, 100)) {
|
|
306
|
+
const n = s.cancelRequested ? {
|
|
307
|
+
...s,
|
|
308
|
+
revision: s.revision + 1,
|
|
306
309
|
status: "cancelled",
|
|
307
310
|
updatedAt: a
|
|
308
311
|
} : {
|
|
309
|
-
...
|
|
310
|
-
revision:
|
|
312
|
+
...s,
|
|
313
|
+
revision: s.revision + 1,
|
|
311
314
|
status: "running",
|
|
312
|
-
attempt:
|
|
315
|
+
attempt: s.attempt + 1,
|
|
313
316
|
updatedAt: a,
|
|
314
|
-
lease: { owner: t, expiresAt: a +
|
|
317
|
+
lease: { owner: t, expiresAt: a + r }
|
|
315
318
|
};
|
|
316
319
|
if (n.status === "cancelled" && delete n.lease, await e.store.compareAndSwap(
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
+
s.scope,
|
|
321
|
+
s.id,
|
|
322
|
+
s.revision,
|
|
320
323
|
n
|
|
321
324
|
))
|
|
322
325
|
return n;
|
|
323
326
|
}
|
|
324
327
|
}
|
|
325
|
-
function
|
|
326
|
-
return e.status === "running" && e.attempt === a && e.lease?.owner === t && e.lease.expiresAt >
|
|
328
|
+
function K(e, t, r, a) {
|
|
329
|
+
return e.status === "running" && e.attempt === a && e.lease?.owner === t && e.lease.expiresAt > r;
|
|
327
330
|
}
|
|
328
|
-
async function
|
|
329
|
-
const { scope:
|
|
331
|
+
async function Ne(e, t, r, a) {
|
|
332
|
+
const { scope: s, id: n } = r, i = r.lease.owner;
|
|
330
333
|
let l;
|
|
331
|
-
const f =
|
|
332
|
-
async (
|
|
333
|
-
const
|
|
334
|
-
if (!
|
|
335
|
-
throw new
|
|
336
|
-
if (
|
|
337
|
-
a.abort(new
|
|
334
|
+
const f = Pe(
|
|
335
|
+
async (g) => {
|
|
336
|
+
const p = await M(e.store, s, n), v = t.now();
|
|
337
|
+
if (!K(p, i, v, r.attempt))
|
|
338
|
+
throw new b("lease", "报表任务租约已失效");
|
|
339
|
+
if (p.cancelRequested) {
|
|
340
|
+
a.abort(new b("closed", "任务已请求取消"));
|
|
338
341
|
return;
|
|
339
342
|
}
|
|
340
|
-
await
|
|
341
|
-
updatedAt:
|
|
342
|
-
lease: { owner: i, expiresAt:
|
|
343
|
-
...
|
|
343
|
+
await B(e.store, p, {
|
|
344
|
+
updatedAt: v,
|
|
345
|
+
lease: { owner: i, expiresAt: v + t.leaseMs },
|
|
346
|
+
...g ? { progress: g } : {}
|
|
344
347
|
});
|
|
345
348
|
},
|
|
346
|
-
(
|
|
347
|
-
l =
|
|
349
|
+
(g) => {
|
|
350
|
+
l = g, a.abort(g);
|
|
348
351
|
}
|
|
349
|
-
), o = (
|
|
350
|
-
completed:
|
|
351
|
-
...
|
|
352
|
-
}),
|
|
352
|
+
), o = (g, p) => !Number.isFinite(g) || g < 0 || p !== void 0 && (!Number.isFinite(p) || p < g) ? Promise.reject(new b("input", "任务进度无效")) : f.progress({
|
|
353
|
+
completed: g,
|
|
354
|
+
...p === void 0 ? {} : { total: p }
|
|
355
|
+
}), d = setInterval(() => {
|
|
353
356
|
f.pulse();
|
|
354
357
|
}, t.heartbeatMs);
|
|
355
|
-
let c,
|
|
358
|
+
let c, u;
|
|
356
359
|
try {
|
|
357
|
-
const
|
|
360
|
+
const g = Object.prototype.hasOwnProperty.call(
|
|
358
361
|
e.handlers,
|
|
359
|
-
|
|
360
|
-
) ? e.handlers[
|
|
361
|
-
if (!
|
|
362
|
+
r.request.kind
|
|
363
|
+
) ? e.handlers[r.request.kind] : void 0;
|
|
364
|
+
if (!g) throw new b("input", "报表任务处理器未注册");
|
|
362
365
|
if (!a.signal.aborted) {
|
|
363
|
-
const
|
|
364
|
-
scope:
|
|
366
|
+
const p = await g(T(r.request.payload), {
|
|
367
|
+
scope: s,
|
|
365
368
|
taskId: n,
|
|
366
369
|
signal: a.signal,
|
|
367
370
|
reportProgress: o
|
|
368
371
|
});
|
|
369
|
-
if (c = JSON.parse(I(
|
|
372
|
+
if (c = JSON.parse(I(p)), ye(c) > t.maxResultBytes) throw new Z();
|
|
370
373
|
}
|
|
371
|
-
} catch (
|
|
372
|
-
|
|
374
|
+
} catch (g) {
|
|
375
|
+
u = g ?? new Error("报表任务执行失败");
|
|
373
376
|
} finally {
|
|
374
|
-
clearInterval(
|
|
377
|
+
clearInterval(d), await f.finish().catch(() => {
|
|
375
378
|
});
|
|
376
379
|
}
|
|
377
|
-
const
|
|
378
|
-
if (!
|
|
379
|
-
throw new
|
|
380
|
-
const
|
|
381
|
-
delete
|
|
382
|
-
code:
|
|
383
|
-
message:
|
|
384
|
-
}) : (
|
|
380
|
+
const y = await M(e.store, s, n), h = t.now();
|
|
381
|
+
if (!K(y, i, h, r.attempt))
|
|
382
|
+
throw new b("lease", "任务租约已失效,迟到结果不会写回");
|
|
383
|
+
const w = { ...y, updatedAt: h };
|
|
384
|
+
delete w.lease, u ??= l, y.cancelRequested || a.signal.aborted && l === void 0 ? w.status = "cancelled" : u !== void 0 ? (w.status = "failed", w.error = {
|
|
385
|
+
code: u instanceof Z ? "result-budget" : u instanceof b ? u.code : "execution",
|
|
386
|
+
message: u instanceof Error ? u.message.slice(0, 500) : "报表任务执行失败"
|
|
387
|
+
}) : (w.status = "completed", w.result = c);
|
|
385
388
|
try {
|
|
386
|
-
I(
|
|
389
|
+
I(w);
|
|
387
390
|
} catch {
|
|
388
|
-
delete
|
|
391
|
+
delete w.result, w.status = "failed", w.error = {
|
|
389
392
|
code: "result-budget",
|
|
390
393
|
message: "任务结果与请求的组合超过存储预算,请保存文件引用而非文件内容"
|
|
391
394
|
};
|
|
392
395
|
}
|
|
393
|
-
return
|
|
396
|
+
return Ee(e.store, y, w);
|
|
394
397
|
}
|
|
395
|
-
async function
|
|
398
|
+
async function Ee(e, t, r) {
|
|
396
399
|
try {
|
|
397
|
-
return await
|
|
400
|
+
return await B(e, t, r, ["lease"]);
|
|
398
401
|
} catch (a) {
|
|
399
|
-
if (!(a instanceof
|
|
400
|
-
return delete
|
|
402
|
+
if (!(a instanceof b) || a.code !== "capacity" || r.status !== "completed") throw a;
|
|
403
|
+
return delete r.result, r.status = "failed", r.error = { code: "result-budget", message: "任务结果超过存储剩余预算,请保存文件引用而非文件内容" }, B(e, t, r, ["lease", "result"]);
|
|
401
404
|
}
|
|
402
405
|
}
|
|
403
|
-
async function
|
|
404
|
-
const
|
|
405
|
-
if (
|
|
406
|
-
if (
|
|
407
|
-
return { scope: t, id:
|
|
406
|
+
async function Y(e, t, r, a) {
|
|
407
|
+
const s = await e.readTombstone?.(t, r);
|
|
408
|
+
if (s) {
|
|
409
|
+
if (s.requestHash !== await he(a)) throw new b("conflict", "相同任务ID不能提交不同内容(幂等保留期内)");
|
|
410
|
+
return { scope: t, id: r, revision: s.revision, request: T(a), status: s.status, createdAt: s.createdAt, updatedAt: s.updatedAt, attempt: s.attempt, archived: !0 };
|
|
408
411
|
}
|
|
409
412
|
}
|
|
410
|
-
function
|
|
413
|
+
function Ke(e) {
|
|
411
414
|
e = { ...e, handlers: { ...e.handlers } };
|
|
412
|
-
const t =
|
|
413
|
-
let
|
|
414
|
-
const i = (o,
|
|
415
|
+
const t = ke(e), r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
|
|
416
|
+
let s = !1, n = 0;
|
|
417
|
+
const i = (o, d) => (L(o, d), e.store.read(o, d));
|
|
415
418
|
return {
|
|
416
419
|
submit: async (o) => {
|
|
417
|
-
if (o = { ...o },
|
|
418
|
-
throw new
|
|
419
|
-
const
|
|
420
|
+
if (o = { ...o }, L(o.scope, o.id), !Object.prototype.hasOwnProperty.call(e.handlers, o.kind) || typeof e.handlers[o.kind] != "function")
|
|
421
|
+
throw new b("input", "报表任务处理器未注册");
|
|
422
|
+
const d = {
|
|
420
423
|
kind: o.kind,
|
|
421
424
|
payload: JSON.parse(
|
|
422
425
|
I(o.payload, {
|
|
@@ -426,54 +429,54 @@ function Xe(e) {
|
|
|
426
429
|
)
|
|
427
430
|
}, c = await i(o.scope, o.id);
|
|
428
431
|
if (c) {
|
|
429
|
-
if (I(c.request) !== I(
|
|
430
|
-
throw new
|
|
432
|
+
if (I(c.request) !== I(d))
|
|
433
|
+
throw new b("conflict", "相同任务ID不能提交不同内容");
|
|
431
434
|
return c;
|
|
432
435
|
}
|
|
433
|
-
const
|
|
434
|
-
if (
|
|
435
|
-
const
|
|
436
|
+
const u = await Y(e.store, o.scope, o.id, d);
|
|
437
|
+
if (u) return u;
|
|
438
|
+
const y = t.now(), h = {
|
|
436
439
|
scope: o.scope,
|
|
437
440
|
id: o.id,
|
|
438
441
|
revision: 1,
|
|
439
|
-
request:
|
|
442
|
+
request: d,
|
|
440
443
|
status: "queued",
|
|
441
|
-
createdAt:
|
|
442
|
-
updatedAt:
|
|
444
|
+
createdAt: y,
|
|
445
|
+
updatedAt: y,
|
|
443
446
|
attempt: 0
|
|
444
447
|
};
|
|
445
|
-
if (!await e.store.compareAndSwap(o.scope, o.id, null,
|
|
446
|
-
const
|
|
447
|
-
if (
|
|
448
|
-
return
|
|
449
|
-
const
|
|
450
|
-
if (
|
|
451
|
-
throw new
|
|
448
|
+
if (!await e.store.compareAndSwap(o.scope, o.id, null, h)) {
|
|
449
|
+
const w = await i(o.scope, o.id);
|
|
450
|
+
if (w && I(w.request) === I(d))
|
|
451
|
+
return w;
|
|
452
|
+
const g = await Y(e.store, o.scope, o.id, d);
|
|
453
|
+
if (g) return g;
|
|
454
|
+
throw new b("conflict", "报表任务提交发生冲突");
|
|
452
455
|
}
|
|
453
|
-
return
|
|
456
|
+
return T(h);
|
|
454
457
|
},
|
|
455
458
|
get: i,
|
|
456
459
|
runNext: (o) => {
|
|
457
|
-
if (
|
|
458
|
-
return Promise.reject(new
|
|
460
|
+
if (s)
|
|
461
|
+
return Promise.reject(new b("closed", "报表任务服务已关闭"));
|
|
459
462
|
if (n >= t.concurrency)
|
|
460
463
|
return Promise.reject(
|
|
461
|
-
new
|
|
464
|
+
new b("capacity", "报表任务执行槽位已满")
|
|
462
465
|
);
|
|
463
466
|
n++;
|
|
464
|
-
const
|
|
465
|
-
|
|
467
|
+
const d = new AbortController();
|
|
468
|
+
r.add(d);
|
|
466
469
|
const c = (async () => {
|
|
467
470
|
try {
|
|
468
|
-
const
|
|
471
|
+
const u = await je(
|
|
469
472
|
e,
|
|
470
473
|
o,
|
|
471
474
|
t.leaseMs,
|
|
472
475
|
t.now()
|
|
473
476
|
);
|
|
474
|
-
return
|
|
477
|
+
return u?.status === "running" ? await Ne(e, t, u, d) : u;
|
|
475
478
|
} finally {
|
|
476
|
-
n--,
|
|
479
|
+
n--, r.delete(d);
|
|
477
480
|
}
|
|
478
481
|
})();
|
|
479
482
|
return a.add(c), c.then(
|
|
@@ -484,38 +487,56 @@ function Xe(e) {
|
|
|
484
487
|
get active() {
|
|
485
488
|
return n;
|
|
486
489
|
},
|
|
487
|
-
cancel: async (o,
|
|
488
|
-
const c = await
|
|
489
|
-
return c.status !== "queued" && c.status !== "running" ? c :
|
|
490
|
+
cancel: async (o, d) => {
|
|
491
|
+
const c = await M(e.store, o, d);
|
|
492
|
+
return c.status !== "queued" && c.status !== "running" ? c : B(e.store, c, {
|
|
490
493
|
updatedAt: t.now(),
|
|
491
494
|
...c.status === "queued" ? { status: "cancelled" } : { cancelRequested: !0 }
|
|
492
495
|
});
|
|
493
496
|
},
|
|
494
|
-
retry: async (o,
|
|
495
|
-
const
|
|
496
|
-
if (
|
|
497
|
-
throw new
|
|
498
|
-
const
|
|
499
|
-
...
|
|
497
|
+
retry: async (o, d, c) => {
|
|
498
|
+
const u = await M(e.store, o, d);
|
|
499
|
+
if (u.revision !== c || u.status !== "failed")
|
|
500
|
+
throw new b("conflict", "仅可重试当前修订的失败任务");
|
|
501
|
+
const y = {
|
|
502
|
+
...u,
|
|
500
503
|
status: "queued",
|
|
501
504
|
updatedAt: t.now()
|
|
502
505
|
};
|
|
503
|
-
return delete
|
|
506
|
+
return delete y.error, delete y.progress, B(e.store, u, y, ["error", "progress"]);
|
|
504
507
|
},
|
|
505
508
|
prune: async (o) => {
|
|
506
|
-
if (!e.store.prune || !e.store.readTombstone) throw new
|
|
509
|
+
if (!e.store.prune || !e.store.readTombstone) throw new b("input", "当前任务适配器未实现可选终态保留能力");
|
|
507
510
|
return e.store.prune({ ...o, now: t.now() });
|
|
508
511
|
},
|
|
509
512
|
close: async () => {
|
|
510
|
-
|
|
511
|
-
for (const o of
|
|
512
|
-
o.abort(new
|
|
513
|
+
s = !0;
|
|
514
|
+
for (const o of r)
|
|
515
|
+
o.abort(new b("closed", "任务服务正在关闭"));
|
|
513
516
|
await Promise.allSettled([...a]);
|
|
514
517
|
}
|
|
515
518
|
};
|
|
516
519
|
}
|
|
517
|
-
|
|
518
|
-
const
|
|
520
|
+
function ae(e, t) {
|
|
521
|
+
const r = e.assets, a = e[t];
|
|
522
|
+
if (!(!r && !a?.assetRenderers))
|
|
523
|
+
return {
|
|
524
|
+
...r,
|
|
525
|
+
...a?.assetFailure === void 0 ? {} : { assetFailure: a.assetFailure },
|
|
526
|
+
...a?.onDiagnostic === void 0 ? {} : { onDiagnostic: a.onDiagnostic },
|
|
527
|
+
assetRenderers: { ...r?.assetRenderers, ...a?.assetRenderers },
|
|
528
|
+
assetBudget: { ...r?.assetBudget, ...a?.assetBudget }
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
function ee(e, t) {
|
|
532
|
+
return !e || e.code !== "missing-image" || e.format !== "pdf" && e.format !== "xlsx" ? !1 : typeof ae(t, e.format)?.assetRenderers?.[e.kind] == "function";
|
|
533
|
+
}
|
|
534
|
+
function Be(e, t) {
|
|
535
|
+
const r = ge(e, t), a = r.issues.filter((n) => !ee(n.diagnostic, t)), s = r.samples.map((n) => ({ ...n, diagnostics: n.diagnostics.filter((i) => !ee(i, t)) }));
|
|
536
|
+
return { ...r, issues: a, samples: s, ok: a.every((n) => n.severity !== "error"), artifacts: [] };
|
|
537
|
+
}
|
|
538
|
+
async function Je(e, t, r, a, s) {
|
|
539
|
+
const n = Oe({ reports: { sample: { template: r, datasets: e.datasets } }, assets: ae(a, t), budget: {
|
|
519
540
|
maxRows: a.maxSampleRows ?? 1e3,
|
|
520
541
|
maxPages: a.maxPages ?? 100,
|
|
521
542
|
maxCells: a.maxCells ?? 25e4,
|
|
@@ -523,225 +544,227 @@ async function Ne(e, t, s, a, r) {
|
|
|
523
544
|
maxDurationMs: a.maxDurationMs ?? 3e4
|
|
524
545
|
} });
|
|
525
546
|
try {
|
|
526
|
-
const { result: i, digest: l } = await
|
|
527
|
-
const o = await n.export({ reportIds: ["sample"], params: e.params, format: t, signal: f, fidelity: a.strictOutputs ? "strict" : "warn", pdf: a.pdf, xlsx: a.xlsx }),
|
|
528
|
-
|
|
547
|
+
const { result: i, digest: l } = await z(a.signal, a.maxDurationMs ?? 3e4, async (f) => {
|
|
548
|
+
const o = await n.export({ reportIds: ["sample"], params: e.params, format: t, signal: f, fidelity: a.strictOutputs ? "strict" : "warn", pdf: a.pdf, xlsx: a.xlsx }), d = o.diagnostics.filter((u) => u.severity !== "info");
|
|
549
|
+
if (a.strictOutputs && d.length) throw new Error(`Strict ${t} encoding found fidelity issues: ${d.slice(0, 3).map((u) => u.message).join("; ")}`);
|
|
550
|
+
const c = await a.digest?.(o.bytes);
|
|
551
|
+
return x(f), await a.onArtifact?.(e.name, o), x(f), { result: o, digest: c };
|
|
529
552
|
});
|
|
530
|
-
|
|
553
|
+
s.artifacts.push({ fixture: e.name, format: t, bytes: i.bytes.byteLength, pages: i.stats.pages, ...l ? { digest: l } : {} }), s.issues.push(...i.diagnostics.map((f) => ({ code: "output", severity: a.strictOutputs || f.severity === "error" ? "error" : "warning", path: "$.template", fixture: e.name, message: `${t}: ${f.message}` })));
|
|
531
554
|
} catch (i) {
|
|
532
|
-
|
|
555
|
+
x(a.signal), s.issues.push({ code: "output", severity: "error", path: "$.template", fixture: e.name, message: `${t}: ${i instanceof Error ? i.message : String(i)}` });
|
|
533
556
|
}
|
|
534
557
|
}
|
|
535
|
-
async function
|
|
536
|
-
|
|
537
|
-
const
|
|
538
|
-
if (!
|
|
539
|
-
const a =
|
|
540
|
-
if (!
|
|
541
|
-
return
|
|
558
|
+
async function Ye(e, t = {}) {
|
|
559
|
+
x(t.signal);
|
|
560
|
+
const r = Be(e, t);
|
|
561
|
+
if (!r.ok) return r;
|
|
562
|
+
const a = xe(e).template, s = [...new Set(t.formats ?? ["pdf", "xlsx"])];
|
|
563
|
+
if (!s.length || s.some((n) => n !== "pdf" && n !== "xlsx"))
|
|
564
|
+
return r.issues.push({ code: "output", severity: "error", path: "$.formats", message: "真实文件验收应至少选择PDF/XLSX之一" }), r.ok = !1, r;
|
|
542
565
|
for (const n of t.fixtures ?? [])
|
|
543
|
-
for (const i of
|
|
544
|
-
|
|
545
|
-
return
|
|
566
|
+
for (const i of s)
|
|
567
|
+
x(t.signal), !(i !== "pdf" && i !== "xlsx") && await Je(n, i, a, t, r);
|
|
568
|
+
return r.ok = r.issues.every((n) => n.severity !== "error"), r;
|
|
546
569
|
}
|
|
547
|
-
class
|
|
548
|
-
constructor(t,
|
|
549
|
-
super(
|
|
570
|
+
class m extends Error {
|
|
571
|
+
constructor(t, r) {
|
|
572
|
+
super(r), this.code = t, this.name = "ReportInstanceError";
|
|
550
573
|
}
|
|
551
574
|
}
|
|
552
|
-
function
|
|
553
|
-
if (typeof e != "string" || !e.trim() || e.length > 256 || typeof t != "string" || t !== t.trim() || !/^[a-zA-Z0-9][a-zA-Z0-9_.:-]{0,127}$/.test(t)) throw new
|
|
575
|
+
function E(e, t) {
|
|
576
|
+
if (typeof e != "string" || !e.trim() || e.length > 256 || typeof t != "string" || t !== t.trim() || !/^[a-zA-Z0-9][a-zA-Z0-9_.:-]{0,127}$/.test(t)) throw new m("input", "实例范围应非空,ID 应为安全标识");
|
|
554
577
|
}
|
|
555
|
-
function
|
|
556
|
-
const
|
|
557
|
-
if (
|
|
558
|
-
if (t && Object.keys(e).some((
|
|
559
|
-
if (Object.getOwnPropertyNames(e).filter((
|
|
578
|
+
function De(e, t) {
|
|
579
|
+
const r = Object.getPrototypeOf(e);
|
|
580
|
+
if (r !== (t ? Array.prototype : Object.prototype) && !(r === null && !t) || Object.getOwnPropertySymbols(e).length) throw new m("input", "实例应为普通 JSON 对象");
|
|
581
|
+
if (t && Object.keys(e).some((s) => s !== String(Number(s)) || !Number.isSafeInteger(Number(s)) || Number(s) < 0 || Number(s) >= e.length)) throw new m("input", "实例数组不能包含额外属性");
|
|
582
|
+
if (Object.getOwnPropertyNames(e).filter((s) => !(t && s === "length")).length !== Object.keys(e).length) throw new m("input", "实例不能包含不可枚举属性");
|
|
560
583
|
}
|
|
561
|
-
function
|
|
562
|
-
if (!Number.isSafeInteger(e.revision) || e.revision < 1 || typeof e.title != "string" || !e.title.trim() || e.title.length > 512) throw new
|
|
563
|
-
if (typeof e.generatedAt != "string" || !Number.isFinite(Date.parse(e.generatedAt)) || new Date(e.generatedAt).toISOString() !== e.generatedAt) throw new
|
|
564
|
-
if (!Array.isArray(e.reportIds) || !e.reportIds.length || e.reportIds.length > 100 || e.reportIds.some((t) => typeof t != "string" || !t.trim()) || new Set(e.reportIds).size !== e.reportIds.length) throw new
|
|
584
|
+
function Ce(e) {
|
|
585
|
+
if (!Number.isSafeInteger(e.revision) || e.revision < 1 || typeof e.title != "string" || !e.title.trim() || e.title.length > 512) throw new m("input", "实例修订或标题无效");
|
|
586
|
+
if (typeof e.generatedAt != "string" || !Number.isFinite(Date.parse(e.generatedAt)) || new Date(e.generatedAt).toISOString() !== e.generatedAt) throw new m("input", "实例生成时间应为 ISO UTC 字符串");
|
|
587
|
+
if (!Array.isArray(e.reportIds) || !e.reportIds.length || e.reportIds.length > 100 || e.reportIds.some((t) => typeof t != "string" || !t.trim()) || new Set(e.reportIds).size !== e.reportIds.length) throw new m("input", "实例报表 ID 应非空且唯一");
|
|
565
588
|
}
|
|
566
|
-
function
|
|
589
|
+
function Me(e) {
|
|
567
590
|
return e === null || typeof e == "boolean" || typeof e == "string" || typeof e == "number" && Number.isFinite(e);
|
|
568
591
|
}
|
|
569
|
-
function
|
|
570
|
-
if (!Number.isSafeInteger(t) || t < 1) throw new
|
|
571
|
-
let
|
|
572
|
-
const
|
|
592
|
+
function oe(e, t) {
|
|
593
|
+
if (!Number.isSafeInteger(t) || t < 1) throw new m("input", "实例快照字节预算应为正安全整数");
|
|
594
|
+
let r = 0, a = 0;
|
|
595
|
+
const s = /* @__PURE__ */ new Set();
|
|
573
596
|
function n(l, f) {
|
|
574
|
-
if (++
|
|
597
|
+
if (++r > 1e6 || f > 64) throw new m("capacity", "实例节点或嵌套深度超过预算");
|
|
575
598
|
if (typeof l == "string" && (a += l.length, a > t))
|
|
576
|
-
throw new
|
|
577
|
-
if (
|
|
578
|
-
if (!l || typeof l != "object" ||
|
|
599
|
+
throw new m("capacity", "实例文本超过预算");
|
|
600
|
+
if (Me(l)) return l;
|
|
601
|
+
if (!l || typeof l != "object" || s.has(l)) throw new m("input", "实例只允许无循环的有限 JSON 值");
|
|
579
602
|
const o = Array.isArray(l);
|
|
580
|
-
|
|
581
|
-
const
|
|
603
|
+
De(l, o), s.add(l);
|
|
604
|
+
const d = /* @__PURE__ */ Object.create(null);
|
|
582
605
|
for (const c of Object.keys(l)) {
|
|
583
|
-
if (a += c.length, a > t) throw new
|
|
584
|
-
const
|
|
585
|
-
if (
|
|
586
|
-
|
|
606
|
+
if (a += c.length, a > t) throw new m("capacity", "实例文本超过预算");
|
|
607
|
+
const u = Object.getOwnPropertyDescriptor(l, c);
|
|
608
|
+
if (u.get || u.set || ["__proto__", "constructor", "prototype"].includes(c)) throw new m("input", "实例不能包含访问器或危险键");
|
|
609
|
+
u.value !== void 0 && (d[c] = n(u.value, f + 1));
|
|
587
610
|
}
|
|
588
|
-
if (
|
|
589
|
-
if (Object.keys(
|
|
590
|
-
return Array.from({ length: l.length }, (c,
|
|
611
|
+
if (s.delete(l), o) {
|
|
612
|
+
if (Object.keys(d).length !== l.length) throw new m("input", "实例数组不能稀疏或包含额外属性");
|
|
613
|
+
return Array.from({ length: l.length }, (c, u) => d[String(u)]);
|
|
591
614
|
}
|
|
592
|
-
return
|
|
615
|
+
return d;
|
|
593
616
|
}
|
|
594
617
|
const i = JSON.stringify(n(e, 0));
|
|
595
|
-
if (new TextEncoder().encode(i).byteLength > t) throw new
|
|
618
|
+
if (new TextEncoder().encode(i).byteLength > t) throw new m("capacity", "实例快照超过单条字节预算");
|
|
596
619
|
return i;
|
|
597
620
|
}
|
|
598
|
-
function
|
|
599
|
-
const
|
|
600
|
-
|
|
621
|
+
function V(e, t = 8e6) {
|
|
622
|
+
const r = JSON.parse(oe(e, t));
|
|
623
|
+
E(r.scope, r.id);
|
|
601
624
|
const a = /* @__PURE__ */ new Set(["scope", "id", "revision", "title", "generatedAt", "reportIds", "params", "templateRevisions", "sourceRevisions", "plan", "artifacts"]);
|
|
602
|
-
if (Object.keys(
|
|
603
|
-
|
|
604
|
-
for (const n of [
|
|
605
|
-
if (!n || typeof n != "object" || Array.isArray(n) || Object.values(n).some((i) => typeof i != "string")) throw new
|
|
606
|
-
if (
|
|
607
|
-
const
|
|
608
|
-
if (!
|
|
609
|
-
return
|
|
610
|
-
}
|
|
611
|
-
function
|
|
612
|
-
if (!Array.isArray(e) || e.length > 100) throw new
|
|
625
|
+
if (Object.keys(r).some((n) => !a.has(n))) throw new m("input", "实例包含未知字段");
|
|
626
|
+
Ce(r);
|
|
627
|
+
for (const n of [r.params, r.templateRevisions, r.sourceRevisions])
|
|
628
|
+
if (!n || typeof n != "object" || Array.isArray(n) || Object.values(n).some((i) => typeof i != "string")) throw new m("input", "实例参数和修订应为字符串字典");
|
|
629
|
+
if (r.reportIds.some((n) => !r.templateRevisions[n])) throw new m("input", "每张报表都应记录生成时的模板修订");
|
|
630
|
+
const s = re(r.plan);
|
|
631
|
+
if (!s.ok) throw new m("input", `实例渲染计划无效:${s.errors[0]?.path}`);
|
|
632
|
+
return r.artifacts !== void 0 && Te(r.artifacts), r;
|
|
633
|
+
}
|
|
634
|
+
function Te(e) {
|
|
635
|
+
if (!Array.isArray(e) || e.length > 100) throw new m("input", "实例文件列表无效");
|
|
613
636
|
const t = /* @__PURE__ */ new Set();
|
|
614
|
-
for (const
|
|
615
|
-
if (!
|
|
616
|
-
t.add(
|
|
637
|
+
for (const r of e) {
|
|
638
|
+
if (!r || typeof r.key != "string" || !r.key.trim() || r.key.length > 1024 || t.has(r.key) || !["pdf", "xlsx"].includes(r.format) || !Number.isSafeInteger(r.bytes) || r.bytes < 0 || r.sha256 !== void 0 && (typeof r.sha256 != "string" || r.sha256.length !== 64 || !/^[a-f0-9]{64}$/i.test(r.sha256))) throw new m("input", "实例文件应包含唯一存储键、格式、大小和可选 SHA256");
|
|
639
|
+
t.add(r.key);
|
|
617
640
|
}
|
|
618
641
|
}
|
|
619
|
-
function
|
|
620
|
-
const { scope: t, id:
|
|
621
|
-
return JSON.parse(JSON.stringify({ scope: t, id:
|
|
642
|
+
function $e(e) {
|
|
643
|
+
const { scope: t, id: r, revision: a, title: s, generatedAt: n, reportIds: i, params: l, templateRevisions: f, sourceRevisions: o } = e;
|
|
644
|
+
return JSON.parse(JSON.stringify({ scope: t, id: r, revision: a, title: s, generatedAt: n, reportIds: i, params: l, templateRevisions: f, sourceRevisions: o }));
|
|
622
645
|
}
|
|
623
|
-
function
|
|
646
|
+
function qe(e) {
|
|
624
647
|
const t = { maxInstances: 100, maxRevisions: 20, maxBytes: 64e6, maxSnapshotBytes: 8e6, ...e };
|
|
625
|
-
if (Object.values(t).some((
|
|
648
|
+
if (Object.values(t).some((r) => !Number.isSafeInteger(r) || r < 1)) throw new m("input", "实例存储预算应为正安全整数");
|
|
626
649
|
return t;
|
|
627
650
|
}
|
|
628
|
-
function
|
|
629
|
-
const t =
|
|
651
|
+
function et(e = {}) {
|
|
652
|
+
const t = qe(e), r = /* @__PURE__ */ new Map();
|
|
630
653
|
let a = 0;
|
|
631
654
|
return {
|
|
632
|
-
read: async (
|
|
633
|
-
|
|
634
|
-
const f =
|
|
635
|
-
return o ?
|
|
655
|
+
read: async (s, n, i, l) => {
|
|
656
|
+
x(l), E(s, n);
|
|
657
|
+
const f = r.get(JSON.stringify([s, n])), o = f?.get(i ?? f.size);
|
|
658
|
+
return o ? V(o, t.maxSnapshotBytes) : void 0;
|
|
636
659
|
},
|
|
637
|
-
list: async (
|
|
638
|
-
|
|
660
|
+
list: async (s, n = {}) => {
|
|
661
|
+
x(n.signal), E(s, "list");
|
|
639
662
|
const i = n.limit ?? 25;
|
|
640
|
-
if (!Number.isSafeInteger(i) || i < 1 || i > 100) throw new
|
|
641
|
-
const l = Array.from(
|
|
642
|
-
return { items: l.slice(0, i).map(
|
|
663
|
+
if (!Number.isSafeInteger(i) || i < 1 || i > 100) throw new m("input", "实例每页数量应为 1–100");
|
|
664
|
+
const l = Array.from(r.values(), (f) => f.get(f.size)).filter((f) => f.scope === s && (!n.after || f.id > n.after) && (!n.reportId || f.reportIds.includes(n.reportId))).sort((f, o) => f.id < o.id ? -1 : 1).slice(0, i + 1);
|
|
665
|
+
return { items: l.slice(0, i).map($e), ...l.length > i ? { next: l[i - 1].id } : {} };
|
|
643
666
|
},
|
|
644
|
-
compareAndSwap: async (
|
|
645
|
-
|
|
646
|
-
const o =
|
|
647
|
-
if (o.scope !==
|
|
648
|
-
const
|
|
667
|
+
compareAndSwap: async (s, n, i, l, f) => {
|
|
668
|
+
x(f), E(s, n);
|
|
669
|
+
const o = V(l, t.maxSnapshotBytes);
|
|
670
|
+
if (o.scope !== s || o.id !== n || o.revision !== (i ?? 0) + 1) throw new m("input", "实例身份或修订不一致");
|
|
671
|
+
const d = JSON.stringify([s, n]), c = r.get(d) ?? /* @__PURE__ */ new Map();
|
|
649
672
|
if ((c.size || null) !== i) return !1;
|
|
650
|
-
const
|
|
651
|
-
if (c.size >= t.maxRevisions || a +
|
|
652
|
-
return c.set(o.revision, o),
|
|
673
|
+
const u = new TextEncoder().encode(JSON.stringify(o)).byteLength;
|
|
674
|
+
if (c.size >= t.maxRevisions || a + u > t.maxBytes || !c.size && r.size >= t.maxInstances) throw new m("capacity", "实例存储达到预算,请使用持久化归档策略或显式调整容量");
|
|
675
|
+
return c.set(o.revision, o), r.set(d, c), a += u, !0;
|
|
653
676
|
}
|
|
654
677
|
};
|
|
655
678
|
}
|
|
656
|
-
function
|
|
657
|
-
const
|
|
658
|
-
if (!Number.isSafeInteger(
|
|
679
|
+
function Fe(e, t = {}) {
|
|
680
|
+
const r = t.maxSnapshotBytes ?? 8e6;
|
|
681
|
+
if (!Number.isSafeInteger(r) || r < 1) throw new m("input", "实例快照字节预算应为正安全整数");
|
|
659
682
|
return {
|
|
660
683
|
read: e.read.bind(e),
|
|
661
684
|
list: e.list.bind(e),
|
|
662
|
-
save: async (a,
|
|
663
|
-
const n =
|
|
664
|
-
if (n !== null && (!Number.isSafeInteger(n) || n < 1 || n >= Number.MAX_SAFE_INTEGER)) throw new
|
|
665
|
-
const i = JSON.parse(
|
|
666
|
-
if (
|
|
685
|
+
save: async (a, s) => {
|
|
686
|
+
const n = s.expectedRevision;
|
|
687
|
+
if (n !== null && (!Number.isSafeInteger(n) || n < 1 || n >= Number.MAX_SAFE_INTEGER)) throw new m("input", "实例预期修订无效");
|
|
688
|
+
const i = JSON.parse(oe(a, r)), l = V({ ...i, revision: (n ?? 0) + 1 }, r);
|
|
689
|
+
if (x(s.signal), !await e.compareAndSwap(l.scope, l.id, n, l, s.signal)) throw new m("conflict", "实例已存在或已变化,请显式确认修订后保存");
|
|
667
690
|
return l;
|
|
668
691
|
}
|
|
669
692
|
};
|
|
670
693
|
}
|
|
671
|
-
function
|
|
694
|
+
function tt(e, t) {
|
|
672
695
|
return I({ reportIds: e, params: t });
|
|
673
696
|
}
|
|
674
|
-
function
|
|
675
|
-
if (!e || typeof e != "object" || Object.getOwnPropertySymbols(e).length) throw new
|
|
697
|
+
function ze(e) {
|
|
698
|
+
if (!e || typeof e != "object" || Object.getOwnPropertySymbols(e).length) throw new m("input", "生成请求应为普通对象");
|
|
676
699
|
const t = /* @__PURE__ */ Object.create(null);
|
|
677
|
-
let
|
|
700
|
+
let r;
|
|
678
701
|
const a = /* @__PURE__ */ new Set(["scope", "id", "title", "reportIds", "params", "expectedRevision", "signal"]);
|
|
679
|
-
for (const
|
|
680
|
-
const n = Object.getOwnPropertyDescriptor(e,
|
|
681
|
-
if (!a.has(
|
|
682
|
-
|
|
702
|
+
for (const s of Object.getOwnPropertyNames(e)) {
|
|
703
|
+
const n = Object.getOwnPropertyDescriptor(e, s);
|
|
704
|
+
if (!a.has(s) || !n.enumerable || n.get || n.set) throw new m("input", "生成请求不能包含未知字段或访问器");
|
|
705
|
+
s === "signal" ? r = n.value : n.value !== void 0 && (t[s] = n.value);
|
|
683
706
|
}
|
|
684
|
-
return { signal:
|
|
707
|
+
return { signal: r, request: JSON.parse(I(t)) };
|
|
685
708
|
}
|
|
686
|
-
function
|
|
687
|
-
const t = JSON.parse(I(e.templateRevisions)),
|
|
709
|
+
function rt(e) {
|
|
710
|
+
const t = JSON.parse(I(e.templateRevisions)), r = Fe(e.instances, { maxSnapshotBytes: e.maxSnapshotBytes });
|
|
688
711
|
return {
|
|
689
712
|
async generate(a) {
|
|
690
|
-
const { signal:
|
|
691
|
-
if (
|
|
713
|
+
const { signal: s, request: n } = ze(a);
|
|
714
|
+
if (E(n.scope, n.id), n.expectedRevision !== null && (!Number.isSafeInteger(n.expectedRevision) || n.expectedRevision < 1)) throw new m("input", "实例预期修订无效");
|
|
692
715
|
const i = e.runtime.validate(n);
|
|
693
|
-
if (!i.ok) throw new
|
|
716
|
+
if (!i.ok) throw new te(i.issues);
|
|
694
717
|
const l = /* @__PURE__ */ Object.create(null);
|
|
695
718
|
for (const c of n.reportIds) {
|
|
696
719
|
if (typeof t[c] != "string" || !t[c]) throw new TypeError(`报表 ${c} 缺少生成时的模板修订`);
|
|
697
720
|
l[c] = t[c];
|
|
698
721
|
}
|
|
699
|
-
if (
|
|
700
|
-
throw new
|
|
701
|
-
const o = await e.runtime.prepare({ reportIds: n.reportIds, params: i.values, signal:
|
|
702
|
-
|
|
703
|
-
const
|
|
704
|
-
for (const [c,
|
|
705
|
-
return
|
|
722
|
+
if (x(s), ((await e.instances.read(n.scope, n.id, void 0, s))?.revision ?? null) !== n.expectedRevision)
|
|
723
|
+
throw new m("conflict", "实例已存在或已变化,请显式确认修订后生成");
|
|
724
|
+
const o = await e.runtime.prepare({ reportIds: n.reportIds, params: i.values, signal: s });
|
|
725
|
+
x(s);
|
|
726
|
+
const d = /* @__PURE__ */ Object.create(null);
|
|
727
|
+
for (const [c, u] of Object.entries(o.revisions)) u.revision !== void 0 && (d[c] = u.revision);
|
|
728
|
+
return r.save({
|
|
706
729
|
scope: n.scope,
|
|
707
730
|
id: n.id,
|
|
708
731
|
title: n.title,
|
|
709
732
|
reportIds: n.reportIds,
|
|
710
733
|
params: i.values,
|
|
711
734
|
templateRevisions: l,
|
|
712
|
-
sourceRevisions:
|
|
735
|
+
sourceRevisions: d,
|
|
713
736
|
generatedAt: (e.now?.() ?? /* @__PURE__ */ new Date()).toISOString(),
|
|
714
737
|
plan: o.plan
|
|
715
|
-
}, { expectedRevision: n.expectedRevision, signal:
|
|
738
|
+
}, { expectedRevision: n.expectedRevision, signal: s });
|
|
716
739
|
},
|
|
717
|
-
read:
|
|
718
|
-
list:
|
|
740
|
+
read: r.read,
|
|
741
|
+
list: r.list,
|
|
719
742
|
/** Instance edits are explicit snapshots; source business persistence remains the Provider.save responsibility. */
|
|
720
|
-
save:
|
|
743
|
+
save: r.save
|
|
721
744
|
};
|
|
722
745
|
}
|
|
723
746
|
export {
|
|
724
|
-
|
|
725
|
-
|
|
747
|
+
m as ReportInstanceError,
|
|
748
|
+
b as ReportJobError,
|
|
726
749
|
A as ReportRuntimeError,
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
750
|
+
E as checkInstanceIdentity,
|
|
751
|
+
L as checkJobIdentity,
|
|
752
|
+
T as cloneJob,
|
|
753
|
+
et as createMemoryReportInstanceStore,
|
|
754
|
+
at as createMemoryReportJobStore,
|
|
755
|
+
rt as createReportGenerationService,
|
|
756
|
+
Fe as createReportInstanceManager,
|
|
757
|
+
Ke as createReportJobService,
|
|
758
|
+
Oe as createReportRuntime,
|
|
759
|
+
Ze as createReportTaskQueue,
|
|
760
|
+
tt as reportInstanceParameterKey,
|
|
761
|
+
$e as reportInstanceSummary,
|
|
762
|
+
Ye as reviewReportPublication,
|
|
763
|
+
ot as runReportBatch,
|
|
764
|
+
it as runnableJob,
|
|
742
765
|
I as serializeJobJson,
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
766
|
+
ct as snapshotReportBatchCases,
|
|
767
|
+
V as snapshotReportInstance,
|
|
768
|
+
lt as validateJobRecord,
|
|
769
|
+
ut as validateJobTransition
|
|
747
770
|
};
|