@agile-team/mach-report 2.14.0 → 2.15.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 +16 -11
- package/THIRD_PARTY_NOTICES.md +3 -1
- package/dist/{ExcelBindingWizard-CvsWR8Ga.js → ExcelBindingWizard-BKH1nGNS.js} +3 -3
- package/dist/{ExcelBindingWizard-CLT2p7P3.cjs → ExcelBindingWizard-Bs43BGNp.cjs} +1 -1
- package/dist/ParamEditor-Da4akw6V.cjs +1 -0
- package/dist/ParamEditor-DoAhzJsm.js +594 -0
- package/dist/{ReportBatchPanel-LqVgiqp7.js → ReportBatchPanel-BMf6boMA.js} +39 -39
- package/dist/{ReportBatchPanel-DkxTzBkD.cjs → ReportBatchPanel-wP9m9Pj1.cjs} +1 -1
- package/dist/ReportPreview-ChV19HBp.js +4619 -0
- package/dist/ReportPreview-DbLvvOUT.cjs +6 -0
- package/dist/{ReportTemplateLibrary-MjWEtc7X.js → ReportTemplateLibrary-C9wutIiT.js} +1 -1
- package/dist/{ReportTemplateLibrary-cQ1sqNYo.cjs → ReportTemplateLibrary-Sxr3eD0J.cjs} +1 -1
- package/dist/{RuleEditor-ChuXMlei.js → RuleEditor-C_Clasvd.js} +5 -5
- package/dist/{RuleEditor-BaR6xUiI.cjs → RuleEditor-XhGHK8DE.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-Dci6aRn1.js → TemplateOutlinePanel-D6Bkny59.js} +2 -2
- package/dist/{TemplateOutlinePanel-BHKP89Xz.cjs → TemplateOutlinePanel-JTSR53vJ.cjs} +1 -1
- package/dist/{TemplateReusePanel-CY5eO2Sh.cjs → TemplateReusePanel-Kx35S0Ql.cjs} +1 -1
- package/dist/{TemplateReusePanel-B7Gmyc1z.js → TemplateReusePanel-rVuK1kTz.js} +2 -2
- package/dist/{TemplateReviewPanel-DjlX3xpt.js → TemplateReviewPanel-B0ar9_zf.js} +2 -2
- package/dist/{TemplateReviewPanel-JvZe9_4G.cjs → TemplateReviewPanel-Dn6X9UmY.cjs} +1 -1
- package/dist/analytics.cjs +1 -1
- package/dist/analytics.d.cts +3 -1
- package/dist/analytics.d.ts +3 -1
- package/dist/analytics.js +154 -60
- package/dist/artifact-integrity.json +135 -0
- package/dist/assets-B9ImAi6_.cjs +1 -0
- package/dist/assets-DEaz4qsp.js +124 -0
- package/dist/batch-BaP6pWDE.cjs +1 -0
- package/dist/batch-BfZHN1do.js +220 -0
- package/dist/batch-CGyt-b2W.js +273 -0
- package/dist/batch-CLpELXBl.cjs +1 -0
- package/dist/capabilities-CAh2Nrue.cjs +1 -0
- package/dist/capabilities-DskCHs3V.js +69 -0
- package/dist/codes.d.cts +2 -0
- package/dist/codes.d.ts +2 -0
- package/dist/{computed-Bvk0W15F.js → computed-C-4C2S5h.js} +3 -3
- package/dist/config-BVsJXSqS.js +842 -0
- package/dist/config-D10us76d.cjs +1 -0
- package/dist/data-explanation-B8MZRYVS.js +16 -0
- package/dist/data-explanation-DE55G30w.cjs +1 -0
- package/dist/designer-2bDlcNXQ.js +5136 -0
- package/dist/designer-BT7XCdbW.cjs +2 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +144 -16
- package/dist/designer.d.ts +144 -16
- package/dist/designer.js +1 -1
- package/dist/drill-ByJviLXS.js +145 -0
- package/dist/drill-DYTxuL3A.cjs +1 -0
- package/dist/{font-loader-vhCT8znW.cjs → font-loader-B_UkxpzC.cjs} +1 -1
- package/dist/{font-loader-DHto6Lra.js → font-loader-Q3bQjmrI.js} +1 -1
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +82 -4
- package/dist/index.d.ts +82 -4
- package/dist/index.js +785 -820
- package/dist/json-snapshot-DFb2eWkf.js +1416 -0
- package/dist/json-snapshot-WWSGlaHG.cjs +2 -0
- package/dist/licenses/_bwip-js_generic-4.11.4.txt +24 -0
- package/dist/licenses/_fast-csv_format-4.3.5.txt +22 -0
- package/dist/licenses/_fast-csv_parse-4.3.6.txt +22 -0
- package/dist/licenses/_pdf-lib_fontkit-1.1.1.txt +326 -0
- package/dist/licenses/_pdf-lib_standard-fonts-1.0.0.txt +22 -0
- package/dist/licenses/_pdf-lib_upng-1.0.1.txt +22 -0
- package/dist/licenses/_types_node-14.18.63.txt +22 -0
- package/dist/licenses/_types_pako-2.0.3.txt +22 -0
- package/dist/licenses/_types_pegjs-0.10.6.txt +22 -0
- package/dist/licenses/archiver-5.3.2.txt +23 -0
- package/dist/licenses/archiver-utils-2.1.0.txt +23 -0
- package/dist/licenses/archiver-utils-3.0.4.txt +23 -0
- package/dist/licenses/async-3.2.6.txt +20 -0
- package/dist/licenses/balanced-match-1.0.2.txt +22 -0
- package/dist/licenses/base64-js-1.5.1.txt +22 -0
- package/dist/licenses/big-integer-1.6.52.txt +25 -0
- package/dist/licenses/binary-0.3.0.txt +178 -0
- package/dist/licenses/bl-4.1.0.txt +14 -0
- package/dist/licenses/bluebird-3.4.7.txt +22 -0
- package/dist/licenses/brace-expansion-1.1.21.txt +22 -0
- package/dist/licenses/brace-expansion-2.1.7.txt +22 -0
- package/dist/licenses/buffer-5.7.1.txt +22 -0
- package/dist/licenses/buffer-crc32-0.2.13.txt +20 -0
- package/dist/licenses/buffer-indexof-polyfill-1.0.2.txt +23 -0
- package/dist/licenses/buffers-0.1.1.txt +140 -0
- package/dist/licenses/chainsaw-0.1.0.txt +184 -0
- package/dist/licenses/compress-commons-4.1.2.txt +23 -0
- package/dist/licenses/concat-map-0.0.1.txt +19 -0
- package/dist/licenses/core-util-is-1.0.3.txt +20 -0
- package/dist/licenses/crc-32-1.2.2.txt +202 -0
- package/dist/licenses/crc32-stream-4.0.3.txt +23 -0
- package/dist/licenses/dayjs-1.11.23.txt +22 -0
- package/dist/licenses/duplexer2-0.1.4.txt +27 -0
- package/dist/licenses/end-of-stream-1.4.5.txt +22 -0
- package/dist/licenses/exceljs-4.4.0.txt +23 -0
- package/dist/licenses/fast-csv-4.3.6.txt +22 -0
- package/dist/licenses/fast-png-6.4.0.txt +22 -0
- package/dist/licenses/fs-constants-1.0.0.txt +22 -0
- package/dist/licenses/fs.realpath-1.0.0.txt +44 -0
- package/dist/licenses/fstream-1.0.12.txt +16 -0
- package/dist/licenses/glob-7.2.3.txt +22 -0
- package/dist/licenses/graceful-fs-4.2.11.txt +16 -0
- package/dist/licenses/ieee754-1.2.1.txt +12 -0
- package/dist/licenses/immediate-3.0.6.txt +21 -0
- package/dist/licenses/inflight-1.0.6.txt +16 -0
- package/dist/licenses/inherits-2.0.4.txt +17 -0
- package/dist/licenses/iobuffer-5.4.0.txt +23 -0
- package/dist/licenses/isarray-1.0.0.txt +61 -0
- package/dist/licenses/jszip-3.10.2.txt +652 -0
- package/dist/licenses/lazystream-1.0.1.txt +24 -0
- package/dist/licenses/lie-3.3.0.txt +8 -0
- package/dist/licenses/listenercount-1.0.1.txt +6 -0
- package/dist/licenses/lodash.defaults-4.2.0.txt +48 -0
- package/dist/licenses/lodash.difference-4.5.0.txt +48 -0
- package/dist/licenses/lodash.escaperegexp-4.1.2.txt +48 -0
- package/dist/licenses/lodash.flatten-4.4.0.txt +48 -0
- package/dist/licenses/lodash.groupby-4.6.0.txt +48 -0
- package/dist/licenses/lodash.isboolean-3.0.3.txt +23 -0
- package/dist/licenses/lodash.isequal-4.5.0.txt +48 -0
- package/dist/licenses/lodash.isfunction-3.0.9.txt +48 -0
- package/dist/licenses/lodash.isnil-4.0.0.txt +23 -0
- package/dist/licenses/lodash.isplainobject-4.0.6.txt +48 -0
- package/dist/licenses/lodash.isundefined-3.0.1.txt +23 -0
- package/dist/licenses/lodash.union-4.6.0.txt +48 -0
- package/dist/licenses/lodash.uniq-4.5.0.txt +48 -0
- package/dist/licenses/minimatch-3.1.5.txt +16 -0
- package/dist/licenses/minimatch-5.1.9.txt +16 -0
- package/dist/licenses/minimist-1.2.8.txt +19 -0
- package/dist/licenses/mkdirp-0.5.6.txt +22 -0
- package/dist/licenses/node-sql-parser-5.4.0.txt +202 -0
- package/dist/licenses/normalize-path-3.0.0.txt +22 -0
- package/dist/licenses/once-1.4.0.txt +16 -0
- package/dist/licenses/pako-1.0.11.txt +22 -0
- package/dist/licenses/pako-2.2.0.txt +22 -0
- package/dist/licenses/path-is-absolute-1.0.1.txt +22 -0
- package/dist/licenses/pdf-lib-1.17.1.txt +22 -0
- package/dist/licenses/process-nextick-args-2.0.1.txt +20 -0
- package/dist/licenses/readable-stream-2.3.8.txt +48 -0
- package/dist/licenses/readable-stream-3.6.2.txt +48 -0
- package/dist/licenses/readdir-glob-1.1.3.txt +202 -0
- package/dist/licenses/rimraf-2.7.1.txt +16 -0
- package/dist/licenses/safe-buffer-5.1.2.txt +22 -0
- package/dist/licenses/safe-buffer-5.2.1.txt +22 -0
- package/dist/licenses/saxes-5.0.1.txt +397 -0
- package/dist/licenses/setimmediate-1.0.5.txt +21 -0
- package/dist/licenses/string_decoder-1.1.1.txt +49 -0
- package/dist/licenses/string_decoder-1.3.0.txt +49 -0
- package/dist/licenses/tar-stream-2.2.0.txt +22 -0
- package/dist/licenses/tmp-0.2.7.txt +22 -0
- package/dist/licenses/traverse-0.3.9.txt +25 -0
- package/dist/licenses/tslib-1.14.1.txt +13 -0
- package/dist/licenses/unzipper-0.10.14.txt +26 -0
- package/dist/licenses/util-deprecate-1.0.2.txt +25 -0
- package/dist/licenses/uuid-11.1.1.txt +10 -0
- package/dist/licenses/wrappy-1.0.2.txt +16 -0
- package/dist/licenses/xmlchars-2.2.0.txt +19 -0
- package/dist/licenses/zip-stream-4.1.1.txt +23 -0
- package/dist/matrix-CGRGkn5s.js +112 -0
- package/dist/matrix-gEO7ZM_u.cjs +1 -0
- package/dist/media-B7vnpD8k.cjs +1 -0
- package/dist/media-Y90dHK9z.js +70 -0
- package/dist/param-validation-C3HlcLLO.cjs +1 -0
- package/dist/param-validation-Do7Eg8Zv.js +181 -0
- package/dist/{pdf-8UPQebOE.js → pdf-BwNyeGpt.js} +4385 -4321
- package/dist/{pdf-AyJGb22z.cjs → pdf-CvvrjPQg.cjs} +51 -49
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.d.cts +18 -3
- package/dist/pdf.d.ts +18 -3
- package/dist/pdf.js +2 -2
- package/dist/{plugin-BGKf-Tqg.js → plugin-Ca_XZG3l.js} +2 -2
- package/dist/{plugin-CktLH_Iy.cjs → plugin-DHO7X8z2.cjs} +1 -1
- package/dist/prepared-CFy9B75C.cjs +1 -0
- package/dist/prepared-ajM-H-9B.js +69 -0
- package/dist/progress-B0ctFpKf.cjs +1 -0
- package/dist/progress-D-OTpEav.js +52 -0
- package/dist/record-bindings-By_UKZ2g.cjs +1 -0
- package/dist/record-bindings-Do_b3h4V.js +196 -0
- package/dist/{region-binding-workflow-DEJbhpCv.js → region-binding-workflow-BMhK_TjP.js} +1 -1
- package/dist/{region-binding-workflow-BzfbxRiR.cjs → region-binding-workflow-DIYJdCUr.cjs} +1 -1
- package/dist/{report-params-B44imUd4.js → report-params-B1RzkhJj.js} +1 -1
- package/dist/{report-params-SJfhKgaX.cjs → report-params-WDGrA4oP.cjs} +1 -1
- package/dist/sbom.cdx.json +3982 -0
- package/dist/server/node.d.cts +20 -1
- package/dist/server/node.d.ts +20 -1
- package/dist/server-node.cjs +1 -1
- package/dist/server-node.js +247 -237
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +772 -4
- package/dist/server.d.ts +772 -4
- package/dist/server.js +885 -645
- package/dist/sha256-ArEYjaTI.cjs +1 -0
- package/dist/sha256-DPEuJ3nh.js +155 -0
- package/dist/style.css +1 -1
- package/dist/template-bindings-C2SpvsMU.js +58 -0
- package/dist/template-bindings-CEtWyiLX.cjs +1 -0
- package/dist/template-catalog-FJE_c9Qe.cjs +1 -0
- package/dist/template-catalog-j2B1MJlL.js +414 -0
- package/dist/{template-fragments-CLkGo6To.js → template-fragments-BGbQLGlV.js} +21 -21
- package/dist/{template-fragments-DFUpq5QM.cjs → template-fragments-DcKeiylI.cjs} +1 -1
- package/dist/{template-outline-B3xVkzSv.cjs → template-outline-BwRV_eRo.cjs} +1 -1
- package/dist/{template-outline-CFenM1PV.js → template-outline-cnWfT_LK.js} +3 -3
- package/dist/{template-registry-COXDEJEM.js → template-registry-BtaKPELV.js} +364 -201
- package/dist/template-registry-Co1zPq5e.cjs +1 -0
- package/dist/textwrap-CWHyzkBH.cjs +4 -0
- package/dist/textwrap-DE1kgcJB.js +110 -0
- package/dist/{tree-CqcQ99NM.js → tree-CjVZLRw7.js} +1 -1
- package/dist/vue/async.d.cts +123 -14
- package/dist/vue/async.d.ts +123 -14
- package/dist/vue/index.d.cts +158 -22
- package/dist/vue/index.d.ts +158 -22
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +80 -78
- package/dist/{workbook-session-DNa2RHNG.cjs → workbook-session-Bjv1YCRK.cjs} +18 -18
- package/dist/{workbook-session-BfK1yHOO.js → workbook-session-BvToI-Fd.js} +5440 -5288
- package/dist/worker.cjs +1 -1
- package/dist/worker.d.cts +20 -1
- package/dist/worker.d.ts +20 -1
- package/dist/worker.js +33 -32
- package/dist/xlsx-node.cjs +34 -34
- package/dist/xlsx-node.js +878 -870
- package/dist/xlsx.cjs +3 -4
- package/dist/xlsx.d.cts +22 -10
- package/dist/xlsx.d.ts +22 -10
- package/dist/xlsx.js +261 -253
- package/package.json +2 -2
- package/dist/ParamEditor-CflQV3eQ.js +0 -526
- package/dist/ParamEditor-vIDzvpPV.cjs +0 -1
- package/dist/ReportPreview-CvbqLUzM.cjs +0 -6
- package/dist/ReportPreview-D_ywJ_-H.js +0 -4533
- package/dist/assets-C2U-e-Sz.cjs +0 -4
- package/dist/assets-Q0wUwNrV.js +0 -217
- package/dist/batch-DzaTNLWI.js +0 -371
- package/dist/batch-xMkqYiTr.cjs +0 -1
- package/dist/capabilities-CK_7hizc.js +0 -63
- package/dist/capabilities-CsZ-pNHR.cjs +0 -1
- package/dist/config-0UIohTS7.cjs +0 -1
- package/dist/config-Dt9NtCPl.js +0 -566
- package/dist/data-explanation-BktvER5B.cjs +0 -1
- package/dist/data-explanation-C_J6jYNi.js +0 -16
- package/dist/designer-Ci1LizA9.js +0 -5020
- package/dist/designer-rtmVIIdN.cjs +0 -2
- package/dist/json-snapshot-BeFT3Tso.js +0 -1952
- package/dist/json-snapshot-D1NTP2oI.cjs +0 -2
- package/dist/matrix-DVyWiYsd.cjs +0 -1
- package/dist/matrix-yZsGnldA.js +0 -227
- package/dist/page-window-index-CIuT4BAv.js +0 -43
- package/dist/page-window-index-DEjnM6IB.cjs +0 -1
- package/dist/param-validation-BlHHXs6u.js +0 -153
- package/dist/param-validation-DCK039V1.cjs +0 -1
- package/dist/progress-7OSZbFok.js +0 -39
- package/dist/progress-BnLiS5eH.cjs +0 -1
- package/dist/task-events-DQ276fn2.cjs +0 -1
- package/dist/task-events-Dpsvf_t2.js +0 -47
- package/dist/template-bindings-BJR4k7qZ.cjs +0 -1
- package/dist/template-bindings-Daui7hLF.js +0 -252
- package/dist/template-registry-D3SjENi6.cjs +0 -1
- package/dist/validate-BJ5HIWY8.cjs +0 -1
- package/dist/validate-CkQBWCeg.js +0 -163
package/dist/server-node.js
CHANGED
|
@@ -14,7 +14,7 @@ function Z(e, t, r) {
|
|
|
14
14
|
function Q(e) {
|
|
15
15
|
if (!e || typeof e != "object" || Array.isArray(e)) return !1;
|
|
16
16
|
const t = e, r = (o) => typeof o == "string" && o.trim().length > 0 && o.length <= 256;
|
|
17
|
-
return !r(t.datasetId) || !r(t.field) || t.tableId !== void 0 && !r(t.tableId) ? !1 : t.rowKey === void 0 ? !0 : typeof t.rowKey == "string" ? t.rowKey.trim().length > 0 && t.rowKey.length <= 1024 : typeof t.rowKey == "number" && Number.isFinite(t.rowKey);
|
|
17
|
+
return !r(t.datasetId) || !r(t.field) || t.tableId !== void 0 && !r(t.tableId) || t.reportScope !== void 0 && (typeof t.reportScope != "string" || !t.reportScope.trim() || t.reportScope.length > 4096) ? !1 : t.rowKey === void 0 ? !0 : typeof t.rowKey == "string" ? t.rowKey.trim().length > 0 && t.rowKey.length <= 1024 : typeof t.rowKey == "number" && Number.isFinite(t.rowKey);
|
|
18
18
|
}
|
|
19
19
|
function V(e) {
|
|
20
20
|
return e === "missing-source" || e === "not-applicable" || e === "not-calculable";
|
|
@@ -23,10 +23,13 @@ function G(e) {
|
|
|
23
23
|
return e.target !== void 0 && !Q(e.target) ? !1 : e.valueState === void 0 || V(e.valueState) && e.target !== void 0;
|
|
24
24
|
}
|
|
25
25
|
function X(e, t, r) {
|
|
26
|
-
e
|
|
26
|
+
e !== void 0 && (typeof e != "string" || !e.trim() || e.length > 4096) && r.push({ path: t, message: "来源范围应为不超过 4096 字符的非空字符串" });
|
|
27
27
|
}
|
|
28
28
|
function Y(e, t, r) {
|
|
29
|
-
|
|
29
|
+
e.editable !== void 0 && typeof e.editable != "boolean" && r.push({ path: `${t}.editable`, message: "编辑控制应为布尔值" }), e.valueType !== void 0 && !["text", "number", "boolean"].includes(e.valueType) && r.push({ path: `${t}.valueType`, message: "编辑类型应为 text、number 或 boolean" });
|
|
30
|
+
}
|
|
31
|
+
function ee(e, t, r) {
|
|
32
|
+
Y(e, t, r), e.indentMm !== void 0 && (typeof e.indentMm != "number" || !Number.isFinite(e.indentMm) || e.indentMm < 0) && r.push({ path: `${t}.indentMm`, message: "单元格缩进应为有限非负数" }), e.derived !== void 0 && typeof e.derived != "boolean" && r.push({ path: `${t}.derived`, message: "派生结果标记应为布尔值" }), F(e.source, `${t}.source`, r, !0), e.formula !== void 0 && typeof e.formula != "string" && r.push({ path: `${t}.formula`, message: "单元格公式应为字符串" });
|
|
30
33
|
}
|
|
31
34
|
function F(e, t, r, o = !1) {
|
|
32
35
|
if (e === void 0) return;
|
|
@@ -35,6 +38,7 @@ function F(e, t, r, o = !1) {
|
|
|
35
38
|
return;
|
|
36
39
|
}
|
|
37
40
|
const n = e;
|
|
41
|
+
X(n.sourceScope, `${t}.sourceScope`, r);
|
|
38
42
|
for (const s of ["datasetId", ...o ? ["field"] : []])
|
|
39
43
|
(typeof n[s] != "string" || !n[s].trim()) && r.push({ path: `${t}.${s}`, message: "业务标识应为非空字符串" });
|
|
40
44
|
for (const s of ["rowKey", "revision"]) {
|
|
@@ -43,22 +47,22 @@ function F(e, t, r, o = !1) {
|
|
|
43
47
|
}
|
|
44
48
|
n.sourceToken !== void 0 && typeof n.sourceToken != "string" && r.push({ path: `${t}.sourceToken`, message: "来源令牌应为字符串" });
|
|
45
49
|
}
|
|
46
|
-
function
|
|
50
|
+
function te(e) {
|
|
47
51
|
const t = [];
|
|
48
52
|
return e.value !== void 0 && typeof e.value != "string" && t.push({ path: "value", message: "Symbol value must be a string." }), e.symbology !== void 0 && !["code128", "code39", "ean13", "ean8"].includes(e.symbology) && t.push({ path: "symbology", message: "Unsupported barcode symbology." }), e.errorCorrection !== void 0 && !["L", "M", "Q", "H"].includes(e.errorCorrection) && t.push({ path: "errorCorrection", message: "Unsupported QR error correction." }), e.showText !== void 0 && typeof e.showText != "boolean" && t.push({ path: "showText", message: "showText must be a boolean." }), t;
|
|
49
53
|
}
|
|
50
|
-
function
|
|
54
|
+
function re(e, t) {
|
|
51
55
|
const r = [];
|
|
52
56
|
return t !== "barcode" && t !== "qrcode" && r.push({ path: "", message: "code is only supported by barcode and qrcode components." }), t === "qrcode" && e.symbology !== void 0 && r.push({ path: "symbology", message: "QR components do not use a linear symbology." }), t === "qrcode" && e.showText === !0 && r.push({ path: "showText", message: "Use a separate text component below a QR code." }), t === "barcode" && e.errorCorrection !== void 0 && r.push({ path: "errorCorrection", message: "Linear barcodes do not use QR error correction." }), r;
|
|
53
57
|
}
|
|
54
|
-
function
|
|
58
|
+
function ne(e, t) {
|
|
55
59
|
if (typeof e != "object" || e === null || Array.isArray(e)) return [{ path: "", message: "code must be an object." }];
|
|
56
|
-
const r = e, o = [...
|
|
60
|
+
const r = e, o = [...te(r), ...re(r, t)];
|
|
57
61
|
for (const i of Object.keys(r)) ["value", "symbology", "errorCorrection", "quietZoneModules", "showText"].includes(i) || o.push({ path: i, message: "Unknown symbol option." });
|
|
58
62
|
const n = r.symbology === "ean13" || r.symbology === "ean8", s = t === "qrcode" ? 4 : n ? 11 : 10;
|
|
59
63
|
return r.quietZoneModules !== void 0 && (!Number.isSafeInteger(r.quietZoneModules) || Number(r.quietZoneModules) < s || Number(r.quietZoneModules) > 64) && o.push({ path: "quietZoneModules", message: `Quiet zone must contain ${s}–64 whole modules.` }), o;
|
|
60
64
|
}
|
|
61
|
-
const
|
|
65
|
+
const oe = /* @__PURE__ */ new Set([
|
|
62
66
|
"text",
|
|
63
67
|
"image",
|
|
64
68
|
"barcode",
|
|
@@ -71,11 +75,11 @@ const ne = /* @__PURE__ */ new Set([
|
|
|
71
75
|
function A(e) {
|
|
72
76
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
73
77
|
}
|
|
74
|
-
function
|
|
78
|
+
function se(e, t, r, o) {
|
|
75
79
|
const n = e[t];
|
|
76
80
|
(typeof n != "number" || !Number.isFinite(n)) && o.push({ path: `${r}.${t}`, message: `应为有限数字,实际 ${JSON.stringify(n)}` });
|
|
77
81
|
}
|
|
78
|
-
function
|
|
82
|
+
function ie(e, t, r) {
|
|
79
83
|
if (e !== void 0) {
|
|
80
84
|
const o = `${t}.table`;
|
|
81
85
|
if (!A(e)) r.push({ path: o, message: "逻辑表来源应为对象" });
|
|
@@ -88,7 +92,7 @@ function se(e, t, r) {
|
|
|
88
92
|
}
|
|
89
93
|
}
|
|
90
94
|
}
|
|
91
|
-
function
|
|
95
|
+
function ae(e, t, r, o) {
|
|
92
96
|
if (e !== void 0)
|
|
93
97
|
if (!A(e) || !Array.isArray(e.cells))
|
|
94
98
|
r.push({ path: `${t}.grid.cells`, message: "grid.cells 应为二维数组" });
|
|
@@ -99,21 +103,21 @@ function ie(e, t, r, o) {
|
|
|
99
103
|
r.push({ path: `${t}.grid.cells.${i}`, message: "行应为数组" });
|
|
100
104
|
return;
|
|
101
105
|
}
|
|
102
|
-
s.forEach((d,
|
|
106
|
+
s.forEach((d, m) => {
|
|
103
107
|
if (d == null) return;
|
|
104
|
-
const u = `${t}.grid.cells.${i}.${
|
|
108
|
+
const u = `${t}.grid.cells.${i}.${m}`;
|
|
105
109
|
if (!A(d)) {
|
|
106
110
|
r.push({ path: u, message: "网格单元格应为对象或 null" });
|
|
107
111
|
return;
|
|
108
112
|
}
|
|
109
|
-
|
|
110
|
-
U(b, `${t}.grid.cells.${i}.${
|
|
113
|
+
ee(d, u, r), Array.isArray(d.children) && d.children.forEach((b, S) => {
|
|
114
|
+
U(b, `${t}.grid.cells.${i}.${m}.children.${S}`, r, o);
|
|
111
115
|
});
|
|
112
116
|
});
|
|
113
117
|
});
|
|
114
118
|
}
|
|
115
119
|
}
|
|
116
|
-
function
|
|
120
|
+
function ce(e, t, r) {
|
|
117
121
|
e !== void 0 && (Array.isArray(e) ? e.forEach((o, n) => {
|
|
118
122
|
(!A(o) || !Array.isArray(o.segments)) && r.push({ path: `${t}.richParagraphs.${n}`, message: "段落缺少 segments 数组" });
|
|
119
123
|
}) : r.push({ path: `${t}.richParagraphs`, message: "richParagraphs 应为数组" }));
|
|
@@ -124,20 +128,20 @@ function U(e, t, r, o = []) {
|
|
|
124
128
|
return;
|
|
125
129
|
}
|
|
126
130
|
const n = e.kind;
|
|
127
|
-
typeof n != "string" ? r.push({ path: `${t}.kind`, message: "组件缺少 kind 字符串" }) :
|
|
131
|
+
typeof n != "string" ? r.push({ path: `${t}.kind`, message: "组件缺少 kind 字符串" }) : oe.has(n) || o.push({
|
|
128
132
|
path: `${t}.kind`,
|
|
129
133
|
message: `未知组件类型 ${JSON.stringify(n)},将以兜底方式渲染`
|
|
130
134
|
});
|
|
131
135
|
for (const s of ["leftMm", "topMm", "widthMm", "heightMm"])
|
|
132
|
-
|
|
136
|
+
se(e, s, t, r);
|
|
133
137
|
typeof e.leftMm == "number" && e.leftMm < -100 && r.push({ path: `${t}.leftMm`, message: "几何数值异常(leftMm<-100)" });
|
|
134
138
|
for (const s of ["widthMm", "heightMm"])
|
|
135
139
|
typeof e[s] == "number" && e[s] < 0 && r.push({ path: `${t}.${s}`, message: "组件尺寸不能为负数" });
|
|
136
|
-
|
|
140
|
+
ie(e.table, t, r), fe(e.code, n, t, r), e.pageAnchor !== void 0 && !["header", "footer"].includes(e.pageAnchor) && r.push({ path: `${t}.pageAnchor`, message: "页面锚点应为 header 或 footer" }), e.lineDirection !== void 0 && !["down", "up"].includes(e.lineDirection) && r.push({ path: `${t}.lineDirection`, message: "线段方向应为 down 或 up" }), ae(e.grid, t, r, o), ce(e.richParagraphs, t, r);
|
|
137
141
|
}
|
|
138
|
-
function
|
|
142
|
+
function fe(e, t, r, o) {
|
|
139
143
|
if (e !== void 0)
|
|
140
|
-
for (const n of
|
|
144
|
+
for (const n of ne(e, t)) o.push({ path: `${r}.code${n.path ? `.${n.path}` : ""}`, message: n.message });
|
|
141
145
|
}
|
|
142
146
|
function C(e, t, r) {
|
|
143
147
|
if (!A(e)) return;
|
|
@@ -145,11 +149,11 @@ function C(e, t, r) {
|
|
|
145
149
|
const o = e.grid;
|
|
146
150
|
!A(o) || !Array.isArray(o.cells) || o.cells.forEach((n, s) => {
|
|
147
151
|
Array.isArray(n) && n.forEach((i, d) => {
|
|
148
|
-
!A(i) || !Array.isArray(i.children) || i.children.forEach((
|
|
152
|
+
!A(i) || !Array.isArray(i.children) || i.children.forEach((m, u) => C(m, `${t}.grid.cells.${s}.${d}.children.${u}`, r));
|
|
149
153
|
});
|
|
150
154
|
});
|
|
151
155
|
}
|
|
152
|
-
function
|
|
156
|
+
function ue(e, t, r, o = []) {
|
|
153
157
|
if (!A(e)) {
|
|
154
158
|
r.push({ path: t, message: "页应为对象" });
|
|
155
159
|
return;
|
|
@@ -157,11 +161,11 @@ function fe(e, t, r, o = []) {
|
|
|
157
161
|
const n = e.pageWidthMm, s = e.pageHeightMm;
|
|
158
162
|
(typeof n != "number" || !Number.isFinite(n) || n <= 0) && r.push({ path: `${t}.pageWidthMm`, message: `页宽非法: ${JSON.stringify(n)}` }), (typeof s != "number" || !(s > 0 && s < 5e3)) && r.push({ path: `${t}.pageHeightMm`, message: `页高非法: ${JSON.stringify(s)}` }), e.layout !== void 0 && e.layout !== "page" && e.layout !== "wide" && r.push({ path: `${t}.layout`, message: "布局应为 page 或 wide" });
|
|
159
163
|
const i = e.components;
|
|
160
|
-
Array.isArray(i) ? Array.isArray(i) && i.forEach((d,
|
|
161
|
-
U(d, `${t}.components.${
|
|
164
|
+
Array.isArray(i) ? Array.isArray(i) && i.forEach((d, m) => {
|
|
165
|
+
U(d, `${t}.components.${m}`, r, o), C(d, `${t}.components.${m}`, r);
|
|
162
166
|
}) : r.push({ path: `${t}.components`, message: "components 应为数组" });
|
|
163
167
|
}
|
|
164
|
-
function
|
|
168
|
+
function pe(e) {
|
|
165
169
|
const t = [], r = [], o = A(e) ? e.pages : void 0;
|
|
166
170
|
if (A(e) && e.requiresRecalculation !== void 0 && typeof e.requiresRecalculation != "boolean" && t.push({ path: "$.requiresRecalculation", message: "重算能力要求应为布尔值" }), !Array.isArray(o))
|
|
167
171
|
t.push({
|
|
@@ -169,7 +173,7 @@ function ue(e) {
|
|
|
169
173
|
message: e == null ? "渲染计划为空" : "渲染计划缺少 pages 数组"
|
|
170
174
|
});
|
|
171
175
|
else {
|
|
172
|
-
o.forEach((s, i) =>
|
|
176
|
+
o.forEach((s, i) => ue(s, `$.pages.${i}`, t, r)), o.length > 2e3 && r.push({
|
|
173
177
|
path: "$.pages",
|
|
174
178
|
message: `页数异常大(${o.length} 页),渲染与打印耗时可能显著增加`
|
|
175
179
|
});
|
|
@@ -184,7 +188,108 @@ function ue(e) {
|
|
|
184
188
|
}
|
|
185
189
|
return { ok: t.length === 0, errors: t, warnings: r };
|
|
186
190
|
}
|
|
187
|
-
const
|
|
191
|
+
const de = new Uint32Array([
|
|
192
|
+
1116352408,
|
|
193
|
+
1899447441,
|
|
194
|
+
3049323471,
|
|
195
|
+
3921009573,
|
|
196
|
+
961987163,
|
|
197
|
+
1508970993,
|
|
198
|
+
2453635748,
|
|
199
|
+
2870763221,
|
|
200
|
+
3624381080,
|
|
201
|
+
310598401,
|
|
202
|
+
607225278,
|
|
203
|
+
1426881987,
|
|
204
|
+
1925078388,
|
|
205
|
+
2162078206,
|
|
206
|
+
2614888103,
|
|
207
|
+
3248222580,
|
|
208
|
+
3835390401,
|
|
209
|
+
4022224774,
|
|
210
|
+
264347078,
|
|
211
|
+
604807628,
|
|
212
|
+
770255983,
|
|
213
|
+
1249150122,
|
|
214
|
+
1555081692,
|
|
215
|
+
1996064986,
|
|
216
|
+
2554220882,
|
|
217
|
+
2821834349,
|
|
218
|
+
2952996808,
|
|
219
|
+
3210313671,
|
|
220
|
+
3336571891,
|
|
221
|
+
3584528711,
|
|
222
|
+
113926993,
|
|
223
|
+
338241895,
|
|
224
|
+
666307205,
|
|
225
|
+
773529912,
|
|
226
|
+
1294757372,
|
|
227
|
+
1396182291,
|
|
228
|
+
1695183700,
|
|
229
|
+
1986661051,
|
|
230
|
+
2177026350,
|
|
231
|
+
2456956037,
|
|
232
|
+
2730485921,
|
|
233
|
+
2820302411,
|
|
234
|
+
3259730800,
|
|
235
|
+
3345764771,
|
|
236
|
+
3516065817,
|
|
237
|
+
3600352804,
|
|
238
|
+
4094571909,
|
|
239
|
+
275423344,
|
|
240
|
+
430227734,
|
|
241
|
+
506948616,
|
|
242
|
+
659060556,
|
|
243
|
+
883997877,
|
|
244
|
+
958139571,
|
|
245
|
+
1322822218,
|
|
246
|
+
1537002063,
|
|
247
|
+
1747873779,
|
|
248
|
+
1955562222,
|
|
249
|
+
2024104815,
|
|
250
|
+
2227730452,
|
|
251
|
+
2361852424,
|
|
252
|
+
2428436474,
|
|
253
|
+
2756734187,
|
|
254
|
+
3204031479,
|
|
255
|
+
3329325298
|
|
256
|
+
]), $ = (e, t) => e >>> t | e << 32 - t;
|
|
257
|
+
function ye(e, t, r) {
|
|
258
|
+
const o = new DataView(e.buffer, e.byteOffset + t, 64);
|
|
259
|
+
for (let n = 0; n < 16; n++) r[n] = o.getUint32(n * 4);
|
|
260
|
+
for (let n = 16; n < 64; n++) {
|
|
261
|
+
const s = r[n - 15], i = r[n - 2], d = $(s, 7) ^ $(s, 18) ^ s >>> 3, m = $(i, 17) ^ $(i, 19) ^ i >>> 10;
|
|
262
|
+
r[n] = r[n - 16] + d + r[n - 7] + m;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
function me(e, t) {
|
|
266
|
+
let r = e[0], o = e[1], n = e[2], s = e[3], i = e[4], d = e[5], m = e[6], u = e[7];
|
|
267
|
+
for (let b = 0; b < 64; b++) {
|
|
268
|
+
const S = $(i, 6) ^ $(i, 11) ^ $(i, 25), p = i & d ^ ~i & m, f = u + S + p + de[b] + t[b] >>> 0, c = $(r, 2) ^ $(r, 13) ^ $(r, 22), y = r & o ^ r & n ^ o & n, g = c + y >>> 0;
|
|
269
|
+
u = m, m = d, d = i, i = s + f >>> 0, s = n, n = o, o = r, r = f + g >>> 0;
|
|
270
|
+
}
|
|
271
|
+
e[0] = e[0] + r, e[1] = e[1] + o, e[2] = e[2] + n, e[3] = e[3] + s, e[4] = e[4] + i, e[5] = e[5] + d, e[6] = e[6] + m, e[7] = e[7] + u;
|
|
272
|
+
}
|
|
273
|
+
function le(e) {
|
|
274
|
+
const t = new Uint8Array(Math.ceil((e.byteLength + 9) / 64) * 64);
|
|
275
|
+
t.set(e), t[e.byteLength] = 128;
|
|
276
|
+
const r = new DataView(t.buffer);
|
|
277
|
+
return r.setUint32(t.length - 8, Math.floor(e.byteLength / 536870912)), r.setUint32(t.length - 4, e.byteLength * 8 >>> 0), t;
|
|
278
|
+
}
|
|
279
|
+
const he = () => new Uint32Array([1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225]), ge = (e) => Array.from(e, (t) => t.toString(16).padStart(8, "0")).join("");
|
|
280
|
+
async function we(e) {
|
|
281
|
+
const t = le(e), r = he(), o = new Uint32Array(64);
|
|
282
|
+
for (let n = 0; n < t.length; n += 64)
|
|
283
|
+
n > 0 && n % 262144 === 0 && await new Promise((s) => setTimeout(s, 0)), ye(t, n, o), me(r, o);
|
|
284
|
+
return ge(r);
|
|
285
|
+
}
|
|
286
|
+
function be(e) {
|
|
287
|
+
if (e === void 0) return !0;
|
|
288
|
+
if (!Array.isArray(e)) return !1;
|
|
289
|
+
const t = /* @__PURE__ */ new Set();
|
|
290
|
+
return e.every((r) => !r || typeof r != "object" || Array.isArray(r) || typeof r.reportId != "string" || !r.reportId.trim() || !Number.isSafeInteger(r.reportIndex) || r.reportIndex < 0 || t.has(r.reportIndex) || typeof r.reportScope != "string" || !r.reportScope.trim() || r.reportScope.length > 4096 || r.revision !== void 0 && typeof r.revision != "string" || r.sourceToken !== void 0 && typeof r.sourceToken != "string" ? !1 : (t.add(r.reportIndex), !0));
|
|
291
|
+
}
|
|
292
|
+
const I = "mach-report-worker/1";
|
|
188
293
|
class B extends Error {
|
|
189
294
|
constructor(t) {
|
|
190
295
|
super(t.message), this.name = t.name, this.code = t.code, this.path = t.path, this.issues = t.issues, this.diagnostics = t.diagnostics;
|
|
@@ -193,21 +298,21 @@ class B extends Error {
|
|
|
193
298
|
function R(e) {
|
|
194
299
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
195
300
|
}
|
|
196
|
-
function
|
|
301
|
+
function Ae(e) {
|
|
197
302
|
return R(e) ? ["rows", "pages", "cells"].every((t) => typeof e[t] == "number" && Number.isSafeInteger(e[t]) && e[t] >= 0) && typeof e.durationMs == "number" && Number.isFinite(e.durationMs) && e.durationMs >= 0 : !1;
|
|
198
303
|
}
|
|
199
|
-
function
|
|
304
|
+
function xe(e) {
|
|
200
305
|
return Array.isArray(e) && e.every((t) => R(t) && typeof t.code == "string" && typeof t.message == "string" && ["info", "warning", "error"].includes(t.severity) && G(t));
|
|
201
306
|
}
|
|
202
|
-
function
|
|
307
|
+
function $e(e) {
|
|
203
308
|
return R(e) && Object.values(e).every((t) => R(t) && (t.revision === void 0 || typeof t.revision == "string") && (t.sourceToken === void 0 || typeof t.sourceToken == "string"));
|
|
204
309
|
}
|
|
205
|
-
function
|
|
310
|
+
function Se(e) {
|
|
206
311
|
return e === void 0 ? !0 : R(e) && ["heuristic", "provided", "font-bytes"].includes(e.textMetrics) && (e.fontFingerprint === void 0 || typeof e.fontFingerprint == "string" && /^[a-f0-9]{64}$/.test(e.fontFingerprint));
|
|
207
312
|
}
|
|
208
|
-
function
|
|
209
|
-
if (!R(e) || !
|
|
210
|
-
if (t === "prepare") return
|
|
313
|
+
function ke(e, t) {
|
|
314
|
+
if (!R(e) || !Ae(e.stats) || !xe(e.diagnostics) || !$e(e.revisions) || !Se(e.layout) || !be(e.sources)) return !1;
|
|
315
|
+
if (t === "prepare") return pe(e.plan).ok;
|
|
211
316
|
const r = e.format === "pdf" ? "application/pdf" : "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
212
317
|
return e.bytes instanceof Uint8Array && (e.format === "pdf" || e.format === "xlsx") && e.contentType === r;
|
|
213
318
|
}
|
|
@@ -220,14 +325,14 @@ function D(e) {
|
|
|
220
325
|
}
|
|
221
326
|
return t;
|
|
222
327
|
}
|
|
223
|
-
function
|
|
328
|
+
function Ne(e) {
|
|
224
329
|
const t = D(e);
|
|
225
330
|
if (!R(e)) return t;
|
|
226
331
|
for (const r of ["format", "severity", "kind", "nid"]) typeof e[r] == "string" && (t[r] = e[r]);
|
|
227
332
|
for (const r of ["pageIndex", "componentIndex"]) Number.isSafeInteger(e[r]) && e[r] >= 0 && (t[r] = e[r]);
|
|
228
333
|
return Array.isArray(e.componentPath) && e.componentPath.every((r) => Number.isSafeInteger(r) && r >= 0) && (t.componentPath = e.componentPath), t;
|
|
229
334
|
}
|
|
230
|
-
function
|
|
335
|
+
function ve(e) {
|
|
231
336
|
if (!(e instanceof Error)) return { name: "Error", message: String(e) };
|
|
232
337
|
const t = e;
|
|
233
338
|
return {
|
|
@@ -236,45 +341,45 @@ function ge(e) {
|
|
|
236
341
|
...typeof t.code == "string" ? { code: t.code } : {},
|
|
237
342
|
...typeof t.path == "string" ? { path: t.path } : {},
|
|
238
343
|
...Array.isArray(t.issues) ? { issues: t.issues.map(D) } : {},
|
|
239
|
-
...Array.isArray(t.diagnostics) ? { diagnostics: t.diagnostics.map(
|
|
344
|
+
...Array.isArray(t.diagnostics) ? { diagnostics: t.diagnostics.map(Ne) } : {}
|
|
240
345
|
};
|
|
241
346
|
}
|
|
242
|
-
function
|
|
347
|
+
function Re(e) {
|
|
243
348
|
if (!e || typeof e != "object") return !1;
|
|
244
349
|
const t = e;
|
|
245
|
-
return t.protocol ===
|
|
350
|
+
return t.protocol === I && typeof t.id == "string" && (t.operation === "prepare" || t.operation === "export" || t.operation === "exportPrepared") && !!t.input && typeof t.input == "object";
|
|
246
351
|
}
|
|
247
|
-
async function
|
|
352
|
+
async function Ie(e, t, r) {
|
|
248
353
|
try {
|
|
249
354
|
const o = t.operation === "prepare" ? await e.prepare({ ...t.input, onEvent: r }) : t.operation === "exportPrepared" ? await e.exportPrepared({ ...t.input, onEvent: r }) : await e.export({ ...t.input, onEvent: r });
|
|
250
|
-
return { protocol:
|
|
355
|
+
return { protocol: I, id: t.id, result: o };
|
|
251
356
|
} catch (o) {
|
|
252
|
-
return { protocol:
|
|
357
|
+
return { protocol: I, id: t.id, error: ve(o) };
|
|
253
358
|
}
|
|
254
359
|
}
|
|
255
|
-
function
|
|
360
|
+
function Me(e) {
|
|
256
361
|
const t = e.result;
|
|
257
362
|
return !t || !("bytes" in t) || !(t.bytes.buffer instanceof ArrayBuffer) ? [] : [t.bytes.buffer];
|
|
258
363
|
}
|
|
259
|
-
function
|
|
364
|
+
function Ee(e, t) {
|
|
260
365
|
if (!R(e) || typeof e.taskId != "string" || !e.taskId || t.taskId !== void 0 && e.taskId !== t.taskId || e.correlationId !== t.correlationId || e.reportId !== void 0 && (typeof e.reportId != "string" || !("reportIds" in t && t.reportIds.includes(e.reportId))) || !["query", "validate", "layout", "assets", "encode"].includes(e.stage) || !["started", "completed", "failed"].includes(e.status)) return !1;
|
|
261
366
|
for (const r of ["completed", "total"]) if (e[r] !== void 0 && (typeof e[r] != "number" || !Number.isFinite(e[r]) || e[r] < 0)) return !1;
|
|
262
367
|
return e.completed === void 0 || e.total === void 0 || e.completed <= e.total;
|
|
263
368
|
}
|
|
264
|
-
let
|
|
369
|
+
let Oe = 0;
|
|
265
370
|
function J(e) {
|
|
266
371
|
const t = new Error("报表 Worker 任务已取消");
|
|
267
372
|
return t.name = "AbortError", Object.defineProperty(t, "cause", { value: e }), t;
|
|
268
373
|
}
|
|
269
|
-
function
|
|
374
|
+
function Te(e, t) {
|
|
270
375
|
if (!e || typeof e != "object") return;
|
|
271
376
|
const r = e;
|
|
272
|
-
return r.protocol ===
|
|
377
|
+
return r.protocol === I && r.id === t ? r : void 0;
|
|
273
378
|
}
|
|
274
|
-
function
|
|
379
|
+
function je(e, t = {}) {
|
|
275
380
|
const r = t.timeoutMs ?? 12e4;
|
|
276
381
|
if (!Number.isFinite(r) || r <= 0 || r > 2147483647) throw new RangeError("Worker timeoutMs 应为正有限数字,且不能超过 2147483647");
|
|
277
|
-
const o = (n, s, i, d) => i?.aborted ? Promise.reject(J(i.reason)) : new Promise((
|
|
382
|
+
const o = (n, s, i, d) => i?.aborted ? Promise.reject(J(i.reason)) : new Promise((m, u) => {
|
|
278
383
|
let b;
|
|
279
384
|
try {
|
|
280
385
|
b = e();
|
|
@@ -282,136 +387,41 @@ function Ne(e, t = {}) {
|
|
|
282
387
|
u(l);
|
|
283
388
|
return;
|
|
284
389
|
}
|
|
285
|
-
const
|
|
390
|
+
const S = `mach-report-${Date.now()}-${++Oe}`;
|
|
286
391
|
let p = !1, f = () => {
|
|
287
392
|
}, c;
|
|
288
|
-
const
|
|
393
|
+
const y = (l, w) => {
|
|
289
394
|
p || (p = !0, c && clearTimeout(c), f(), i?.removeEventListener("abort", g), Promise.resolve().then(() => b.terminate()).then(
|
|
290
|
-
() => l === void 0 ?
|
|
291
|
-
(
|
|
395
|
+
() => l === void 0 ? m(w) : u(l),
|
|
396
|
+
(k) => u(l ?? k)
|
|
292
397
|
));
|
|
293
|
-
}, g = () =>
|
|
294
|
-
const w =
|
|
398
|
+
}, g = () => y(J(i?.reason)), x = (l) => {
|
|
399
|
+
const w = Te(l, S);
|
|
295
400
|
if (!(!w || p)) {
|
|
296
401
|
if ("type" in w && w.type === "event") {
|
|
297
|
-
const
|
|
298
|
-
|
|
402
|
+
const k = "event" in w ? w.event : void 0;
|
|
403
|
+
Ee(k, s) ? Z(d, k, i) : y(new Error("报表 Worker 返回无效阶段事件"));
|
|
299
404
|
return;
|
|
300
405
|
}
|
|
301
|
-
w.error && typeof w.error.name == "string" && typeof w.error.message == "string" ?
|
|
406
|
+
w.error && typeof w.error.name == "string" && typeof w.error.message == "string" ? y(new B(w.error)) : ke(w.result, n) && (n === "prepare" || "format" in w.result && "format" in s && w.result.format === s.format) ? y(void 0, w.result) : y(new Error("报表 Worker 返回无效响应"));
|
|
302
407
|
}
|
|
303
408
|
};
|
|
304
409
|
try {
|
|
305
|
-
if (f = b.subscribe(x, (l) =>
|
|
410
|
+
if (f = b.subscribe(x, (l) => y(l ?? new Error("报表 Worker 执行失败"))), p) {
|
|
306
411
|
f();
|
|
307
412
|
return;
|
|
308
413
|
}
|
|
309
|
-
if (i?.addEventListener("abort", g, { once: !0 }), c = setTimeout(() =>
|
|
414
|
+
if (i?.addEventListener("abort", g, { once: !0 }), c = setTimeout(() => y(new B({ name: "ReportRuntimeError", code: "timeout", message: `报表 Worker 执行超过 ${r}ms` })), r), i?.aborted) g();
|
|
310
415
|
else {
|
|
311
|
-
const { onEvent: l, signal: w, ...
|
|
312
|
-
b.postMessage({ protocol:
|
|
416
|
+
const { onEvent: l, signal: w, ...k } = s;
|
|
417
|
+
b.postMessage({ protocol: I, id: S, operation: n, input: k });
|
|
313
418
|
}
|
|
314
419
|
} catch (l) {
|
|
315
|
-
|
|
420
|
+
y(l);
|
|
316
421
|
}
|
|
317
422
|
});
|
|
318
423
|
return { exportPrepared: (n, s, i) => o("exportPrepared", n, s, i), prepare: (n, s, i) => o("prepare", n, s, i), export: (n, s, i) => o("export", n, s, i) };
|
|
319
424
|
}
|
|
320
|
-
const Se = new Uint32Array([
|
|
321
|
-
1116352408,
|
|
322
|
-
1899447441,
|
|
323
|
-
3049323471,
|
|
324
|
-
3921009573,
|
|
325
|
-
961987163,
|
|
326
|
-
1508970993,
|
|
327
|
-
2453635748,
|
|
328
|
-
2870763221,
|
|
329
|
-
3624381080,
|
|
330
|
-
310598401,
|
|
331
|
-
607225278,
|
|
332
|
-
1426881987,
|
|
333
|
-
1925078388,
|
|
334
|
-
2162078206,
|
|
335
|
-
2614888103,
|
|
336
|
-
3248222580,
|
|
337
|
-
3835390401,
|
|
338
|
-
4022224774,
|
|
339
|
-
264347078,
|
|
340
|
-
604807628,
|
|
341
|
-
770255983,
|
|
342
|
-
1249150122,
|
|
343
|
-
1555081692,
|
|
344
|
-
1996064986,
|
|
345
|
-
2554220882,
|
|
346
|
-
2821834349,
|
|
347
|
-
2952996808,
|
|
348
|
-
3210313671,
|
|
349
|
-
3336571891,
|
|
350
|
-
3584528711,
|
|
351
|
-
113926993,
|
|
352
|
-
338241895,
|
|
353
|
-
666307205,
|
|
354
|
-
773529912,
|
|
355
|
-
1294757372,
|
|
356
|
-
1396182291,
|
|
357
|
-
1695183700,
|
|
358
|
-
1986661051,
|
|
359
|
-
2177026350,
|
|
360
|
-
2456956037,
|
|
361
|
-
2730485921,
|
|
362
|
-
2820302411,
|
|
363
|
-
3259730800,
|
|
364
|
-
3345764771,
|
|
365
|
-
3516065817,
|
|
366
|
-
3600352804,
|
|
367
|
-
4094571909,
|
|
368
|
-
275423344,
|
|
369
|
-
430227734,
|
|
370
|
-
506948616,
|
|
371
|
-
659060556,
|
|
372
|
-
883997877,
|
|
373
|
-
958139571,
|
|
374
|
-
1322822218,
|
|
375
|
-
1537002063,
|
|
376
|
-
1747873779,
|
|
377
|
-
1955562222,
|
|
378
|
-
2024104815,
|
|
379
|
-
2227730452,
|
|
380
|
-
2361852424,
|
|
381
|
-
2428436474,
|
|
382
|
-
2756734187,
|
|
383
|
-
3204031479,
|
|
384
|
-
3329325298
|
|
385
|
-
]), $ = (e, t) => e >>> t | e << 32 - t;
|
|
386
|
-
function ve(e, t, r) {
|
|
387
|
-
const o = new DataView(e.buffer, e.byteOffset + t, 64);
|
|
388
|
-
for (let n = 0; n < 16; n++) r[n] = o.getUint32(n * 4);
|
|
389
|
-
for (let n = 16; n < 64; n++) {
|
|
390
|
-
const s = r[n - 15], i = r[n - 2], d = $(s, 7) ^ $(s, 18) ^ s >>> 3, y = $(i, 17) ^ $(i, 19) ^ i >>> 10;
|
|
391
|
-
r[n] = r[n - 16] + d + r[n - 7] + y;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
function Re(e, t) {
|
|
395
|
-
let r = e[0], o = e[1], n = e[2], s = e[3], i = e[4], d = e[5], y = e[6], u = e[7];
|
|
396
|
-
for (let b = 0; b < 64; b++) {
|
|
397
|
-
const k = $(i, 6) ^ $(i, 11) ^ $(i, 25), p = i & d ^ ~i & y, f = u + k + p + Se[b] + t[b] >>> 0, c = $(r, 2) ^ $(r, 13) ^ $(r, 22), m = r & o ^ r & n ^ o & n, g = c + m >>> 0;
|
|
398
|
-
u = y, y = d, d = i, i = s + f >>> 0, s = n, n = o, o = r, r = f + g >>> 0;
|
|
399
|
-
}
|
|
400
|
-
e[0] = e[0] + r, e[1] = e[1] + o, e[2] = e[2] + n, e[3] = e[3] + s, e[4] = e[4] + i, e[5] = e[5] + d, e[6] = e[6] + y, e[7] = e[7] + u;
|
|
401
|
-
}
|
|
402
|
-
function Me(e) {
|
|
403
|
-
const t = new Uint8Array(Math.ceil((e.byteLength + 9) / 64) * 64);
|
|
404
|
-
t.set(e), t[e.byteLength] = 128;
|
|
405
|
-
const r = new DataView(t.buffer);
|
|
406
|
-
return r.setUint32(t.length - 8, Math.floor(e.byteLength / 536870912)), r.setUint32(t.length - 4, e.byteLength * 8 >>> 0), t;
|
|
407
|
-
}
|
|
408
|
-
const Ee = () => new Uint32Array([1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225]), Ie = (e) => Array.from(e, (t) => t.toString(16).padStart(8, "0")).join("");
|
|
409
|
-
async function Oe(e) {
|
|
410
|
-
const t = Me(e), r = Ee(), o = new Uint32Array(64);
|
|
411
|
-
for (let n = 0; n < t.length; n += 64)
|
|
412
|
-
n > 0 && n % 262144 === 0 && await new Promise((s) => setTimeout(s, 0)), ve(t, n, o), Re(r, o);
|
|
413
|
-
return Ie(r);
|
|
414
|
-
}
|
|
415
425
|
class a extends Error {
|
|
416
426
|
constructor(t, r) {
|
|
417
427
|
super(r), this.code = t, this.name = "ReportJobError";
|
|
@@ -420,7 +430,7 @@ class a extends Error {
|
|
|
420
430
|
function T(e, t) {
|
|
421
431
|
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 a("input", "任务范围应非空,ID应为1–128位安全标识");
|
|
422
432
|
}
|
|
423
|
-
function
|
|
433
|
+
function qe(e) {
|
|
424
434
|
const t = Array.isArray(e), r = Object.getPrototypeOf(e), o = Object.keys(e);
|
|
425
435
|
if (r !== (t ? Array.prototype : Object.prototype) && !(r === null && !t)) throw new a("input", "任务对象应为普通 JSON 对象");
|
|
426
436
|
if (Object.getOwnPropertySymbols(e).length) throw new a("input", "任务不能包含Symbol");
|
|
@@ -428,12 +438,12 @@ function Te(e) {
|
|
|
428
438
|
if (t && (o.length !== e.length || o.some((s) => s !== String(Number(s)) || !Number.isSafeInteger(Number(s)) || Number(s) < 0 || Number(s) >= e.length))) throw new a("input", "任务数组不能稀疏或包含额外属性");
|
|
429
439
|
return o.sort();
|
|
430
440
|
}
|
|
431
|
-
function
|
|
441
|
+
function Be(e, t) {
|
|
432
442
|
const r = Object.getOwnPropertyDescriptor(e, t);
|
|
433
443
|
if (["__proto__", "prototype", "constructor"].includes(t) || r.get || r.set) throw new a("input", "任务不能包含危险键或访问器");
|
|
434
444
|
return r.value;
|
|
435
445
|
}
|
|
436
|
-
function
|
|
446
|
+
function N(e, t = {}) {
|
|
437
447
|
const r = t.maxNodes ?? 2e4, o = t.maxCharacters ?? 1e6;
|
|
438
448
|
if (!Number.isSafeInteger(r) || r < 1 || r > 2e4 || !Number.isSafeInteger(o) || o < 1 || o > 1e6) throw new a("input", "任务JSON预算无效");
|
|
439
449
|
let n = 0, s = 0;
|
|
@@ -446,18 +456,18 @@ function S(e, t = {}) {
|
|
|
446
456
|
}
|
|
447
457
|
if (u === null || typeof u == "boolean" || typeof u == "number" && Number.isFinite(u)) return u;
|
|
448
458
|
if (!u || typeof u != "object" || i.has(u)) throw new a("input", "任务只允许无循环的有限 JSON 值");
|
|
449
|
-
const
|
|
459
|
+
const S = Array.isArray(u), p = qe(u);
|
|
450
460
|
i.add(u);
|
|
451
461
|
const f = /* @__PURE__ */ Object.create(null);
|
|
452
462
|
for (const c of p) {
|
|
453
463
|
if (s += c.length, s > o) throw new a("input", "任务文本超过预算");
|
|
454
|
-
f[c] = d(
|
|
464
|
+
f[c] = d(Be(u, c), b + 1);
|
|
455
465
|
}
|
|
456
|
-
return i.delete(u),
|
|
466
|
+
return i.delete(u), S ? Array.from({ length: u.length }, (c, y) => f[String(y)]) : f;
|
|
457
467
|
}
|
|
458
|
-
const
|
|
459
|
-
if (
|
|
460
|
-
return
|
|
468
|
+
const m = JSON.stringify(d(e, 0));
|
|
469
|
+
if (m.length > o) throw new a("input", "任务序列化数据超过字符预算");
|
|
470
|
+
return m;
|
|
461
471
|
}
|
|
462
472
|
function j(e) {
|
|
463
473
|
return JSON.parse(JSON.stringify(e));
|
|
@@ -467,15 +477,15 @@ function K(e, t, r, o) {
|
|
|
467
477
|
if (![e.createdAt, e.updatedAt, e.attempt].every((n) => Number.isSafeInteger(n) && n >= 0) || !["queued", "running", "completed", "failed", "cancelled"].includes(e.status)) throw new a("input", "任务状态无效");
|
|
468
478
|
if (e.lease && (!e.lease.owner || !Number.isSafeInteger(e.lease.expiresAt))) throw new a("input", "任务租约无效");
|
|
469
479
|
if (!e.request || typeof e.request.kind != "string" || !e.request.kind.trim() || e.request.kind.length > 128) throw new a("input", "任务类型无效");
|
|
470
|
-
|
|
480
|
+
N(e.request.payload, { maxNodes: 19e3, maxCharacters: 75e4 }), N(e);
|
|
471
481
|
}
|
|
472
|
-
function
|
|
473
|
-
if (e && (e.createdAt !== t.createdAt ||
|
|
482
|
+
function Je(e, t) {
|
|
483
|
+
if (e && (e.createdAt !== t.createdAt || N(e.request) !== N(t.request))) throw new a("input", "任务创建时间与请求不可变更,请使用新任务ID");
|
|
474
484
|
}
|
|
475
|
-
function
|
|
485
|
+
function Pe(e, t) {
|
|
476
486
|
return e.status === "queued" || e.status === "running" && (e.lease?.expiresAt ?? 0) <= t;
|
|
477
487
|
}
|
|
478
|
-
function
|
|
488
|
+
function We(e = {}) {
|
|
479
489
|
const t = {
|
|
480
490
|
maxRecords: e.maxRecords ?? 1e4,
|
|
481
491
|
maxBytes: e.maxBytes ?? 67108864,
|
|
@@ -487,43 +497,43 @@ function Je(e = {}) {
|
|
|
487
497
|
if (!Object.values(t).every((r) => Number.isSafeInteger(r) && r > 0) || t.controlReserveBytes < 4096) throw new a("input", "任务容量应为正整数,控制状态预留至少4096字节");
|
|
488
498
|
return t;
|
|
489
499
|
}
|
|
490
|
-
function
|
|
491
|
-
return new TextEncoder().encode(
|
|
500
|
+
function M(e) {
|
|
501
|
+
return new TextEncoder().encode(N(e)).byteLength;
|
|
492
502
|
}
|
|
493
503
|
function L(e, t) {
|
|
494
504
|
const r = { scope: e.scope, id: e.id, revision: 1, request: e.request, status: "queued", createdAt: e.createdAt, updatedAt: e.createdAt, attempt: 0 }, o = { ...e };
|
|
495
505
|
delete o.result;
|
|
496
|
-
const n = e.result === void 0 ? 0 :
|
|
506
|
+
const n = e.result === void 0 ? 0 : M(e.result);
|
|
497
507
|
if (n > t.maxResultBytes) throw new a("capacity", "任务结果超过独立预算,请保存文件引用");
|
|
498
|
-
return Math.max(
|
|
508
|
+
return Math.max(M(r) + t.controlReserveBytes, M(o)) + n;
|
|
499
509
|
}
|
|
500
510
|
function z(e) {
|
|
501
511
|
return e.status !== "queued" && e.status !== "running";
|
|
502
512
|
}
|
|
503
|
-
function
|
|
513
|
+
function Fe(e) {
|
|
504
514
|
const t = { ...e, tombstoneRetentionMs: e.tombstoneRetentionMs ?? 6048e5, limit: e.limit ?? 100 };
|
|
505
515
|
if (![t.now, t.terminalBefore].every((r) => Number.isSafeInteger(r) && r >= 0) || t.terminalBefore > t.now) throw new a("input", "终态清理时间应为不超过当前时间的非负整数");
|
|
506
516
|
if (![t.tombstoneRetentionMs, t.limit].every((r) => Number.isSafeInteger(r) && r > 0) || !Number.isSafeInteger(t.now + t.tombstoneRetentionMs)) throw new a("input", "幂等保留期与清理批量应为正整数");
|
|
507
517
|
return t;
|
|
508
518
|
}
|
|
509
|
-
async function
|
|
510
|
-
const t = new TextEncoder().encode(
|
|
511
|
-
if (!r) return
|
|
519
|
+
async function Ue(e) {
|
|
520
|
+
const t = new TextEncoder().encode(N(e)), r = globalThis.crypto?.subtle;
|
|
521
|
+
if (!r) return we(t);
|
|
512
522
|
const o = await r.digest("SHA-256", t);
|
|
513
523
|
return Array.from(new Uint8Array(o), (n) => n.toString(16).padStart(2, "0")).join("");
|
|
514
524
|
}
|
|
515
|
-
async function
|
|
525
|
+
async function Ce(e, t) {
|
|
516
526
|
if (!z(e)) throw new a("input", "只能归档终态任务");
|
|
517
|
-
return { scope: e.scope, id: e.id, revision: e.revision, status: e.status, createdAt: e.createdAt, updatedAt: e.updatedAt, attempt: e.attempt, requestHash: await
|
|
527
|
+
return { scope: e.scope, id: e.id, revision: e.revision, status: e.status, createdAt: e.createdAt, updatedAt: e.updatedAt, attempt: e.attempt, requestHash: await Ue(e.request), expiresAt: t };
|
|
518
528
|
}
|
|
519
|
-
function
|
|
529
|
+
function De(e) {
|
|
520
530
|
if (!e || !["completed", "failed", "cancelled"].includes(e.status) || !/^[a-f0-9]{64}$/.test(e.requestHash)) throw new a("input", "任务幂等摘要无效");
|
|
521
531
|
if (![e.revision, e.createdAt, e.updatedAt, e.attempt, e.expiresAt].every((t) => Number.isSafeInteger(t) && t >= 0) || e.revision < 1) throw new a("input", "任务幂等摘要时间或修订无效");
|
|
522
532
|
}
|
|
523
533
|
function O(e) {
|
|
524
534
|
return e?.code;
|
|
525
535
|
}
|
|
526
|
-
function
|
|
536
|
+
function E(e, t) {
|
|
527
537
|
return W("sha256").update(JSON.stringify([e, t])).digest("hex") + ".json";
|
|
528
538
|
}
|
|
529
539
|
async function q(e) {
|
|
@@ -534,7 +544,7 @@ async function q(e) {
|
|
|
534
544
|
throw t;
|
|
535
545
|
}
|
|
536
546
|
}
|
|
537
|
-
async function
|
|
547
|
+
async function Ke(e, t) {
|
|
538
548
|
const r = await q(e);
|
|
539
549
|
if (r === void 0) return;
|
|
540
550
|
let o;
|
|
@@ -555,7 +565,7 @@ async function Ce(e, t) {
|
|
|
555
565
|
}
|
|
556
566
|
throw new a("conflict", "任务目录的写入进程仍在运行");
|
|
557
567
|
}
|
|
558
|
-
async function
|
|
568
|
+
async function Le(e, t) {
|
|
559
569
|
if (!t) throw new a("conflict", "任务目录已有写入进程;多实例请使用数据库CAS适配器");
|
|
560
570
|
const r = e + ".recovery";
|
|
561
571
|
let o;
|
|
@@ -565,19 +575,19 @@ async function De(e, t) {
|
|
|
565
575
|
throw O(n) === "EEXIST" ? new a("conflict", "任务目录恢复正在进行,请稍后重试") : n;
|
|
566
576
|
}
|
|
567
577
|
try {
|
|
568
|
-
return await o.writeFile(JSON.stringify({ pid: process.pid })), await
|
|
578
|
+
return await o.writeFile(JSON.stringify({ pid: process.pid })), await Ke(e, !0), await h.open(e, "wx", 384);
|
|
569
579
|
} finally {
|
|
570
580
|
await o.close(), await h.unlink(r);
|
|
571
581
|
}
|
|
572
582
|
}
|
|
573
|
-
async function
|
|
583
|
+
async function ze(e, t) {
|
|
574
584
|
const r = v.join(e, ".writer-lock"), o = P();
|
|
575
585
|
let n;
|
|
576
586
|
try {
|
|
577
587
|
n = await h.open(r, "wx", 384);
|
|
578
588
|
} catch (s) {
|
|
579
589
|
if (O(s) !== "EEXIST") throw s;
|
|
580
|
-
n = await
|
|
590
|
+
n = await Le(r, t);
|
|
581
591
|
}
|
|
582
592
|
try {
|
|
583
593
|
await n.writeFile(JSON.stringify({ pid: process.pid, token: o })), await n.sync();
|
|
@@ -587,20 +597,20 @@ async function Ke(e, t) {
|
|
|
587
597
|
}
|
|
588
598
|
return { file: r, token: o, handle: n };
|
|
589
599
|
}
|
|
590
|
-
function
|
|
600
|
+
function _e(e, t, r, o) {
|
|
591
601
|
if ("tombstone" in r) {
|
|
592
602
|
const n = r.tombstone;
|
|
593
|
-
if (
|
|
594
|
-
const s =
|
|
603
|
+
if (De(n), T(n.scope, n.id), E(n.scope, n.id) !== t) throw new a("input", "持久任务摘要身份不匹配");
|
|
604
|
+
const s = M(n);
|
|
595
605
|
e.tombstoneBytes += s, e.tombstones.set(t, { value: n, bytes: s });
|
|
596
606
|
} else {
|
|
597
|
-
if (K(r, r.scope, r.id, r.revision - 1),
|
|
607
|
+
if (K(r, r.scope, r.id, r.revision - 1), E(r.scope, r.id) !== t) throw new a("input", "持久任务文件身份不匹配");
|
|
598
608
|
const n = L(r, o);
|
|
599
609
|
e.bytes += n, e.records.set(t, { record: r, bytes: n });
|
|
600
610
|
}
|
|
601
611
|
if (e.bytes > o.maxBytes || e.records.size > o.maxRecords || e.tombstoneBytes > o.maxTombstoneBytes || e.tombstones.size > o.maxTombstones) throw new a("capacity", "持久任务及控制状态预留超过目录预算");
|
|
602
612
|
}
|
|
603
|
-
async function
|
|
613
|
+
async function He(e, t) {
|
|
604
614
|
const r = await h.readdir(e);
|
|
605
615
|
for (const s of r.filter((i) => /^\.pending-[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/.test(i))) await h.unlink(v.join(e, s));
|
|
606
616
|
const o = r.filter((s) => /^[a-f0-9]{64}\.json$/.test(s));
|
|
@@ -609,11 +619,11 @@ async function ze(e, t) {
|
|
|
609
619
|
for (const s of o) {
|
|
610
620
|
const i = v.join(e, s);
|
|
611
621
|
if ((await h.stat(i)).size > 4e6) throw new a("capacity", "持久任务文件超过单文件预算");
|
|
612
|
-
|
|
622
|
+
_e(n, s, JSON.parse(await h.readFile(i, "utf8")), t);
|
|
613
623
|
}
|
|
614
624
|
return n;
|
|
615
625
|
}
|
|
616
|
-
async function
|
|
626
|
+
async function Ze(e, t, r) {
|
|
617
627
|
const o = v.join(e, `.pending-${P()}`);
|
|
618
628
|
try {
|
|
619
629
|
const n = await h.open(o, "wx", 384);
|
|
@@ -635,20 +645,20 @@ async function _e(e, t, r) {
|
|
|
635
645
|
});
|
|
636
646
|
}
|
|
637
647
|
}
|
|
638
|
-
async function
|
|
639
|
-
const t = v.resolve(e.directory), r =
|
|
648
|
+
async function Ye(e) {
|
|
649
|
+
const t = v.resolve(e.directory), r = We(e);
|
|
640
650
|
await h.mkdir(t, { recursive: !0, mode: 448 });
|
|
641
|
-
const o = await
|
|
651
|
+
const o = await ze(t, e.recoverDeadOwner ?? !1);
|
|
642
652
|
let n;
|
|
643
653
|
try {
|
|
644
|
-
n = await
|
|
654
|
+
n = await He(t, r);
|
|
645
655
|
} catch (p) {
|
|
646
656
|
throw await o.handle.close(), await h.unlink(o.file), p;
|
|
647
657
|
}
|
|
648
658
|
let s = !1, i = Promise.resolve();
|
|
649
659
|
const d = () => {
|
|
650
660
|
if (s) throw new a("closed", "持久任务存储已关闭");
|
|
651
|
-
},
|
|
661
|
+
}, m = (p) => {
|
|
652
662
|
d();
|
|
653
663
|
const f = i.then(async () => {
|
|
654
664
|
if (JSON.parse(await h.readFile(o.file, "utf8")).token !== o.token) throw new a("closed", "持久任务存储写入锁已失效");
|
|
@@ -659,57 +669,57 @@ async function Ge(e) {
|
|
|
659
669
|
}), f;
|
|
660
670
|
}, u = async (p, f, c) => {
|
|
661
671
|
try {
|
|
662
|
-
await
|
|
663
|
-
} catch (
|
|
664
|
-
throw await q(v.join(t, p)) === f && c(),
|
|
672
|
+
await Ze(t, p, f);
|
|
673
|
+
} catch (y) {
|
|
674
|
+
throw await q(v.join(t, p)) === f && c(), y;
|
|
665
675
|
}
|
|
666
676
|
c();
|
|
667
677
|
};
|
|
668
678
|
return {
|
|
669
679
|
read: async (p, f) => {
|
|
670
680
|
d(), T(p, f), await i;
|
|
671
|
-
const c = n.records.get(
|
|
681
|
+
const c = n.records.get(E(p, f));
|
|
672
682
|
return c ? j(c.record) : void 0;
|
|
673
683
|
},
|
|
674
684
|
readTombstone: async (p, f) => {
|
|
675
685
|
d(), T(p, f), await i;
|
|
676
|
-
const c = n.tombstones.get(
|
|
686
|
+
const c = n.tombstones.get(E(p, f));
|
|
677
687
|
return c ? j(c.value) : void 0;
|
|
678
688
|
},
|
|
679
|
-
candidates: async (p, f) => (d(), await i, Array.from(n.records.values(), (c) => c.record).filter((c) =>
|
|
680
|
-
compareAndSwap: async (p, f, c,
|
|
681
|
-
const g = JSON.parse(
|
|
682
|
-
return K(g, p, f, c),
|
|
683
|
-
const x =
|
|
689
|
+
candidates: async (p, f) => (d(), await i, Array.from(n.records.values(), (c) => c.record).filter((c) => Pe(c, p)).sort((c, y) => c.createdAt - y.createdAt).slice(0, f).map(j)),
|
|
690
|
+
compareAndSwap: async (p, f, c, y) => {
|
|
691
|
+
const g = JSON.parse(N(y));
|
|
692
|
+
return K(g, p, f, c), m(async () => {
|
|
693
|
+
const x = E(p, f), l = n.records.get(x);
|
|
684
694
|
if ((l?.record.revision ?? null) !== c || n.tombstones.has(x)) return !1;
|
|
685
|
-
|
|
686
|
-
const w = L(g, r),
|
|
687
|
-
if (
|
|
688
|
-
return await u(x,
|
|
689
|
-
n.records.set(x, { record: g, bytes: w }), n.bytes =
|
|
695
|
+
Je(l?.record, g);
|
|
696
|
+
const w = L(g, r), k = n.bytes - (l?.bytes ?? 0) + w;
|
|
697
|
+
if (k > r.maxBytes || !l && n.records.size >= r.maxRecords) throw new a("capacity", "持久任务容量已满,请清理终态任务或扩大显式预算");
|
|
698
|
+
return await u(x, N(g), () => {
|
|
699
|
+
n.records.set(x, { record: g, bytes: w }), n.bytes = k;
|
|
690
700
|
}), !0;
|
|
691
701
|
});
|
|
692
702
|
},
|
|
693
703
|
prune: async (p) => {
|
|
694
|
-
const f =
|
|
695
|
-
return
|
|
704
|
+
const f = Fe(p);
|
|
705
|
+
return m(async () => {
|
|
696
706
|
const c = { archived: 0, expired: 0 };
|
|
697
|
-
for (const [
|
|
698
|
-
g.value.expiresAt > f.now || c.expired >= f.limit || (await h.unlink(v.join(t,
|
|
699
|
-
for (const [
|
|
707
|
+
for (const [y, g] of n.tombstones)
|
|
708
|
+
g.value.expiresAt > f.now || c.expired >= f.limit || (await h.unlink(v.join(t, y)), n.tombstones.delete(y), n.tombstoneBytes -= g.bytes, c.expired++);
|
|
709
|
+
for (const [y, g] of n.records) {
|
|
700
710
|
if (!z(g.record) || g.record.updatedAt > f.terminalBefore || c.archived + c.expired >= f.limit) continue;
|
|
701
|
-
const x = await
|
|
711
|
+
const x = await Ce(g.record, f.now + f.tombstoneRetentionMs), l = M(x);
|
|
702
712
|
if (n.tombstones.size >= r.maxTombstones || n.tombstoneBytes + l > r.maxTombstoneBytes) break;
|
|
703
|
-
await u(
|
|
704
|
-
n.tombstones.set(
|
|
713
|
+
await u(y, N({ tombstone: x }), () => {
|
|
714
|
+
n.tombstones.set(y, { value: x, bytes: l }), n.tombstoneBytes += l, n.records.delete(y), n.bytes -= g.bytes;
|
|
705
715
|
}), c.archived++;
|
|
706
716
|
}
|
|
707
717
|
if (c.expired) {
|
|
708
|
-
const
|
|
718
|
+
const y = await h.open(t, "r");
|
|
709
719
|
try {
|
|
710
|
-
await
|
|
720
|
+
await y.sync();
|
|
711
721
|
} finally {
|
|
712
|
-
await
|
|
722
|
+
await y.close();
|
|
713
723
|
}
|
|
714
724
|
}
|
|
715
725
|
return c;
|
|
@@ -723,10 +733,10 @@ async function Ge(e) {
|
|
|
723
733
|
}
|
|
724
734
|
};
|
|
725
735
|
}
|
|
726
|
-
function
|
|
736
|
+
function et(e) {
|
|
727
737
|
const t = e.filename ?? e.workerUrl;
|
|
728
738
|
if (!t || e.filename && e.workerUrl) throw new TypeError("请且仅请指定 filename 或 workerUrl");
|
|
729
|
-
return
|
|
739
|
+
return je(() => {
|
|
730
740
|
const r = new H(t, e.workerOptions);
|
|
731
741
|
return {
|
|
732
742
|
postMessage: (o) => r.postMessage(o),
|
|
@@ -740,21 +750,21 @@ function Xe(e) {
|
|
|
740
750
|
};
|
|
741
751
|
}, e);
|
|
742
752
|
}
|
|
743
|
-
function
|
|
753
|
+
function tt(e) {
|
|
744
754
|
const t = _;
|
|
745
755
|
if (!t) throw new Error("serveNodeReportWorker 只能在 worker_threads 中调用");
|
|
746
756
|
const r = (o) => {
|
|
747
|
-
|
|
757
|
+
Re(o) && Ie(e, o, (n) => t.postMessage({ protocol: I, id: o.id, type: "event", event: n })).then((n) => t.postMessage(n, Me(n)));
|
|
748
758
|
};
|
|
749
759
|
return t.on("message", r), () => t.off("message", r);
|
|
750
760
|
}
|
|
751
|
-
function
|
|
761
|
+
function rt(e) {
|
|
752
762
|
return W("sha256").update(e).digest("hex");
|
|
753
763
|
}
|
|
754
764
|
export {
|
|
755
765
|
B as ReportWorkerError,
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
766
|
+
et as createNodeReportExecutor,
|
|
767
|
+
Ye as openFileReportJobStore,
|
|
768
|
+
rt as reportArtifactSha256,
|
|
769
|
+
tt as serveNodeReportWorker
|
|
760
770
|
};
|