@agile-team/mach-report 2.6.1 → 2.7.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 +37 -4
- package/dist/ReportPreview-BdvoqdOd.cjs +6 -0
- package/dist/ReportPreview-COFkbeEM.js +3719 -0
- package/dist/{assets-NVA_sftu.js → assets-B9qJku3V.js} +54 -57
- package/dist/assets-RZan7EyL.cjs +1 -0
- package/dist/capabilities-joSutDF8.js +63 -0
- package/dist/capabilities-xGTpnPjJ.cjs +1 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +869 -753
- package/dist/designer.d.ts +869 -753
- package/dist/designer.js +490 -234
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +86 -3
- package/dist/index.d.ts +86 -3
- package/dist/index.js +582 -508
- package/dist/pdf.cjs +30 -30
- package/dist/pdf.d.cts +11 -3
- package/dist/pdf.d.ts +11 -3
- package/dist/pdf.js +1501 -1500
- package/dist/{plugin-BqBkn_kI.cjs → plugin-9t_ZFwhz.cjs} +1 -1
- package/dist/{plugin-Ds10VnQO.js → plugin-s8Ay8kKk.js} +1 -1
- package/dist/progress-DD964VAB.js +102 -0
- package/dist/progress-KvhwXZ1Q.cjs +1 -0
- package/dist/{report-source-B9bENO0F.js → report-source-BXHNy_AD.js} +337 -332
- package/dist/report-source-CCAvFE3t.cjs +1 -0
- package/dist/server/node.d.cts +26 -3
- package/dist/server/node.d.ts +26 -3
- package/dist/server-node.cjs +1 -1
- package/dist/server-node.js +125 -92
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +28 -3
- package/dist/server.d.ts +28 -3
- package/dist/server.js +172 -164
- package/dist/style.css +1 -1
- package/dist/task-events-DQ276fn2.cjs +1 -0
- package/dist/task-events-Dpsvf_t2.js +47 -0
- package/dist/vue/async.d.cts +1507 -2083
- package/dist/vue/async.d.ts +1507 -2083
- package/dist/vue/index.d.cts +2376 -3310
- package/dist/vue/index.d.ts +2376 -3310
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +131 -107
- package/dist/worker.cjs +1 -1
- package/dist/worker.d.cts +26 -3
- package/dist/worker.d.ts +26 -3
- package/dist/worker.js +110 -85
- package/dist/xlsx.cjs +14 -14
- package/dist/xlsx.d.cts +11 -3
- package/dist/xlsx.d.ts +11 -3
- package/dist/xlsx.js +656 -652
- package/package.json +2 -2
- package/dist/ReportPreview-Dk-28QAi.js +0 -2946
- package/dist/ReportPreview-FSvcBLjH.cjs +0 -6
- package/dist/assets-66UBlhES.cjs +0 -1
- package/dist/capabilities-CNjIirfo.js +0 -36
- package/dist/capabilities-D4xeVYSR.cjs +0 -1
- package/dist/grid-geometry-BNptEcMm.js +0 -65
- package/dist/grid-geometry-CZ_cYB6O.cjs +0 -1
- package/dist/report-source-BbNkkBDy.cjs +0 -1
package/dist/worker.js
CHANGED
|
@@ -1,133 +1,158 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as A } from "./task-events-Dpsvf_t2.js";
|
|
2
|
+
import { c as M } from "./validate-S6CgIm5d.js";
|
|
2
3
|
const u = "mach-report-worker/1";
|
|
3
4
|
class R extends Error {
|
|
4
|
-
constructor(
|
|
5
|
-
super(
|
|
5
|
+
constructor(r) {
|
|
6
|
+
super(r.message), this.name = r.name, this.code = r.code, this.path = r.path, this.issues = r.issues, this.diagnostics = r.diagnostics;
|
|
6
7
|
}
|
|
7
8
|
}
|
|
8
|
-
function
|
|
9
|
-
return !!
|
|
9
|
+
function p(e) {
|
|
10
|
+
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
10
11
|
}
|
|
11
|
-
function
|
|
12
|
-
return
|
|
12
|
+
function L(e) {
|
|
13
|
+
return p(e) ? ["rows", "pages", "cells"].every((r) => typeof e[r] == "number" && Number.isSafeInteger(e[r]) && e[r] >= 0) && typeof e.durationMs == "number" && Number.isFinite(e.durationMs) && e.durationMs >= 0 : !1;
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
-
return Array.isArray(
|
|
15
|
+
function P(e) {
|
|
16
|
+
return Array.isArray(e) && e.every((r) => p(r) && typeof r.code == "string" && typeof r.message == "string" && ["info", "warning", "error"].includes(r.severity));
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
-
return
|
|
18
|
+
function T(e) {
|
|
19
|
+
return p(e) && Object.values(e).every((r) => p(r) && (r.revision === void 0 || typeof r.revision == "string") && (r.sourceToken === void 0 || typeof r.sourceToken == "string"));
|
|
19
20
|
}
|
|
20
|
-
function
|
|
21
|
-
if (!
|
|
22
|
-
if (
|
|
23
|
-
const t =
|
|
24
|
-
return
|
|
21
|
+
function j(e, r) {
|
|
22
|
+
if (!p(e) || !L(e.stats) || !P(e.diagnostics) || !T(e.revisions)) return !1;
|
|
23
|
+
if (r === "prepare") return M(e.plan).ok;
|
|
24
|
+
const t = e.format === "pdf" ? "application/pdf" : "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
25
|
+
return e.bytes instanceof Uint8Array && (e.format === "pdf" || e.format === "xlsx") && e.contentType === t;
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
-
if (!
|
|
28
|
-
const
|
|
27
|
+
function I(e) {
|
|
28
|
+
if (!e || typeof e != "object") return { message: String(e) };
|
|
29
|
+
const r = {};
|
|
29
30
|
for (const t of ["code", "path", "field", "message"]) {
|
|
30
|
-
const o =
|
|
31
|
-
typeof o == "string" && (
|
|
31
|
+
const o = e[t];
|
|
32
|
+
typeof o == "string" && (r[t] = o);
|
|
32
33
|
}
|
|
33
|
-
return
|
|
34
|
-
}
|
|
35
|
-
function
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
return r;
|
|
35
|
+
}
|
|
36
|
+
function O(e) {
|
|
37
|
+
const r = I(e);
|
|
38
|
+
if (!p(e)) return r;
|
|
39
|
+
for (const t of ["format", "severity", "kind", "nid"]) typeof e[t] == "string" && (r[t] = e[t]);
|
|
40
|
+
for (const t of ["pageIndex", "componentIndex"]) Number.isSafeInteger(e[t]) && e[t] >= 0 && (r[t] = e[t]);
|
|
41
|
+
return Array.isArray(e.componentPath) && e.componentPath.every((t) => Number.isSafeInteger(t) && t >= 0) && (r.componentPath = e.componentPath), r;
|
|
42
|
+
}
|
|
43
|
+
function N(e) {
|
|
44
|
+
if (!(e instanceof Error)) return { name: "Error", message: String(e) };
|
|
45
|
+
const r = e;
|
|
38
46
|
return {
|
|
39
|
-
name:
|
|
40
|
-
message:
|
|
41
|
-
...typeof
|
|
42
|
-
...typeof
|
|
43
|
-
...Array.isArray(
|
|
47
|
+
name: e.name,
|
|
48
|
+
message: e.message,
|
|
49
|
+
...typeof r.code == "string" ? { code: r.code } : {},
|
|
50
|
+
...typeof r.path == "string" ? { path: r.path } : {},
|
|
51
|
+
...Array.isArray(r.issues) ? { issues: r.issues.map(I) } : {},
|
|
52
|
+
...Array.isArray(r.diagnostics) ? { diagnostics: r.diagnostics.map(O) } : {}
|
|
44
53
|
};
|
|
45
54
|
}
|
|
46
|
-
function
|
|
47
|
-
if (!
|
|
48
|
-
const
|
|
49
|
-
return
|
|
55
|
+
function v(e) {
|
|
56
|
+
if (!e || typeof e != "object") return !1;
|
|
57
|
+
const r = e;
|
|
58
|
+
return r.protocol === u && typeof r.id == "string" && (r.operation === "prepare" || r.operation === "export") && !!r.input && typeof r.input == "object";
|
|
50
59
|
}
|
|
51
|
-
async function
|
|
60
|
+
async function S(e, r, t) {
|
|
52
61
|
try {
|
|
53
|
-
const
|
|
54
|
-
return { protocol: u, id:
|
|
55
|
-
} catch (
|
|
56
|
-
return { protocol: u, id:
|
|
62
|
+
const o = r.operation === "prepare" ? await e.prepare({ ...r.input, onEvent: t }) : await e.export({ ...r.input, onEvent: t });
|
|
63
|
+
return { protocol: u, id: r.id, result: o };
|
|
64
|
+
} catch (o) {
|
|
65
|
+
return { protocol: u, id: r.id, error: N(o) };
|
|
57
66
|
}
|
|
58
67
|
}
|
|
59
|
-
function
|
|
60
|
-
const
|
|
61
|
-
return !
|
|
68
|
+
function z(e) {
|
|
69
|
+
const r = e.result;
|
|
70
|
+
return !r || !("bytes" in r) || !(r.bytes.buffer instanceof ArrayBuffer) ? [] : [r.bytes.buffer];
|
|
71
|
+
}
|
|
72
|
+
function _(e, r) {
|
|
73
|
+
if (!p(e) || typeof e.taskId != "string" || !e.taskId || r.taskId !== void 0 && e.taskId !== r.taskId || e.correlationId !== r.correlationId || e.reportId !== void 0 && (typeof e.reportId != "string" || !r.reportIds.includes(e.reportId)) || !["query", "validate", "layout", "encode"].includes(e.stage) || !["started", "completed", "failed"].includes(e.status)) return !1;
|
|
74
|
+
for (const t of ["completed", "total"]) if (e[t] !== void 0 && (typeof e[t] != "number" || !Number.isFinite(e[t]) || e[t] < 0)) return !1;
|
|
75
|
+
return e.completed === void 0 || e.total === void 0 || e.completed <= e.total;
|
|
62
76
|
}
|
|
63
|
-
let
|
|
64
|
-
function w(
|
|
65
|
-
const
|
|
66
|
-
return
|
|
77
|
+
let F = 0;
|
|
78
|
+
function w(e) {
|
|
79
|
+
const r = new Error("报表 Worker 任务已取消");
|
|
80
|
+
return r.name = "AbortError", Object.defineProperty(r, "cause", { value: e }), r;
|
|
67
81
|
}
|
|
68
|
-
function $(
|
|
69
|
-
if (!
|
|
70
|
-
const t =
|
|
71
|
-
return t.protocol === u && t.id ===
|
|
82
|
+
function $(e, r) {
|
|
83
|
+
if (!e || typeof e != "object") return;
|
|
84
|
+
const t = e;
|
|
85
|
+
return t.protocol === u && t.id === r ? t : void 0;
|
|
72
86
|
}
|
|
73
|
-
function
|
|
74
|
-
const t =
|
|
87
|
+
function B(e, r = {}) {
|
|
88
|
+
const t = r.timeoutMs ?? 12e4;
|
|
75
89
|
if (!Number.isFinite(t) || t <= 0 || t > 2147483647) throw new RangeError("Worker timeoutMs 应为正有限数字,且不能超过 2147483647");
|
|
76
|
-
const o = (
|
|
77
|
-
let
|
|
90
|
+
const o = (i, c, n, d) => n?.aborted ? Promise.reject(w(n.reason)) : new Promise((W, b) => {
|
|
91
|
+
let g;
|
|
78
92
|
try {
|
|
79
|
-
|
|
80
|
-
} catch (
|
|
81
|
-
|
|
93
|
+
g = e();
|
|
94
|
+
} catch (a) {
|
|
95
|
+
b(a);
|
|
82
96
|
return;
|
|
83
97
|
}
|
|
84
|
-
const l = `mach-report-${Date.now()}-${++
|
|
85
|
-
let
|
|
86
|
-
},
|
|
87
|
-
const f = (
|
|
88
|
-
|
|
89
|
-
() =>
|
|
90
|
-
(
|
|
98
|
+
const l = `mach-report-${Date.now()}-${++F}`;
|
|
99
|
+
let y = !1, E = () => {
|
|
100
|
+
}, h;
|
|
101
|
+
const f = (a, s) => {
|
|
102
|
+
y || (y = !0, h && clearTimeout(h), E(), n?.removeEventListener("abort", k), Promise.resolve().then(() => g.terminate()).then(
|
|
103
|
+
() => a === void 0 ? W(s) : b(a),
|
|
104
|
+
(m) => b(a ?? m)
|
|
91
105
|
));
|
|
92
|
-
},
|
|
93
|
-
const
|
|
94
|
-
|
|
106
|
+
}, k = () => f(w(n?.reason)), x = (a) => {
|
|
107
|
+
const s = $(a, l);
|
|
108
|
+
if (!(!s || y)) {
|
|
109
|
+
if ("type" in s && s.type === "event") {
|
|
110
|
+
const m = "event" in s ? s.event : void 0;
|
|
111
|
+
_(m, c) ? A(d, m, n) : f(new Error("报表 Worker 返回无效阶段事件"));
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
s.error && typeof s.error.name == "string" && typeof s.error.message == "string" ? f(new R(s.error)) : j(s.result, i) && (i !== "export" || "format" in s.result && "format" in c && s.result.format === c.format) ? f(void 0, s.result) : f(new Error("报表 Worker 返回无效响应"));
|
|
115
|
+
}
|
|
95
116
|
};
|
|
96
117
|
try {
|
|
97
|
-
if (
|
|
98
|
-
|
|
118
|
+
if (E = g.subscribe(x, (a) => f(a ?? new Error("报表 Worker 执行失败"))), y) {
|
|
119
|
+
E();
|
|
99
120
|
return;
|
|
100
121
|
}
|
|
101
|
-
n?.addEventListener("abort",
|
|
102
|
-
|
|
103
|
-
|
|
122
|
+
if (n?.addEventListener("abort", k, { once: !0 }), h = setTimeout(() => f(new R({ name: "ReportRuntimeError", code: "timeout", message: `报表 Worker 执行超过 ${t}ms` })), t), n?.aborted) k();
|
|
123
|
+
else {
|
|
124
|
+
const { onEvent: a, signal: s, ...m } = c;
|
|
125
|
+
g.postMessage({ protocol: u, id: l, operation: i, input: m });
|
|
126
|
+
}
|
|
127
|
+
} catch (a) {
|
|
128
|
+
f(a);
|
|
104
129
|
}
|
|
105
130
|
});
|
|
106
|
-
return { prepare: (
|
|
131
|
+
return { prepare: (i, c, n) => o("prepare", i, c, n), export: (i, c, n) => o("export", i, c, n) };
|
|
107
132
|
}
|
|
108
|
-
function
|
|
109
|
-
return
|
|
110
|
-
const t =
|
|
133
|
+
function C(e, r = {}) {
|
|
134
|
+
return B(() => {
|
|
135
|
+
const t = e();
|
|
111
136
|
return {
|
|
112
137
|
postMessage: (o) => t.postMessage(o),
|
|
113
138
|
terminate: () => t.terminate(),
|
|
114
|
-
subscribe: (o,
|
|
115
|
-
const c = (
|
|
139
|
+
subscribe: (o, i) => {
|
|
140
|
+
const c = (d) => o(d.data), n = (d) => i(d instanceof ErrorEvent ? new Error(d.message) : new Error("报表 Worker 消息无法解码"));
|
|
116
141
|
return t.addEventListener("message", c), t.addEventListener("error", n), t.addEventListener("messageerror", n), () => {
|
|
117
142
|
t.removeEventListener("message", c), t.removeEventListener("error", n), t.removeEventListener("messageerror", n);
|
|
118
143
|
};
|
|
119
144
|
}
|
|
120
145
|
};
|
|
121
|
-
},
|
|
146
|
+
}, r);
|
|
122
147
|
}
|
|
123
|
-
function
|
|
148
|
+
function K(e, r = globalThis) {
|
|
124
149
|
const t = (o) => {
|
|
125
|
-
|
|
150
|
+
v(o.data) && S(e, o.data, (i) => r.postMessage({ protocol: u, id: o.data.id, type: "event", event: i })).then((i) => r.postMessage(i, z(i)));
|
|
126
151
|
};
|
|
127
|
-
return
|
|
152
|
+
return r.addEventListener("message", t), () => r.removeEventListener("message", t);
|
|
128
153
|
}
|
|
129
154
|
export {
|
|
130
155
|
R as ReportWorkerError,
|
|
131
|
-
|
|
132
|
-
|
|
156
|
+
C as createBrowserReportExecutor,
|
|
157
|
+
K as serveReportWorker
|
|
133
158
|
};
|