@agile-team/mach-report 2.13.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 +20 -7
- package/THIRD_PARTY_NOTICES.md +3 -1
- package/dist/ExcelBindingWizard-BKH1nGNS.js +1485 -0
- package/dist/ExcelBindingWizard-Bs43BGNp.cjs +1 -0
- package/dist/ParamEditor-Da4akw6V.cjs +1 -0
- package/dist/ParamEditor-DoAhzJsm.js +594 -0
- package/dist/{ReportBatchPanel-CW2HV9I8.js → ReportBatchPanel-BMf6boMA.js} +39 -39
- package/dist/ReportBatchPanel-wP9m9Pj1.cjs +1 -0
- package/dist/ReportPreview-ChV19HBp.js +4619 -0
- package/dist/ReportPreview-DbLvvOUT.cjs +6 -0
- package/dist/{ReportTemplateLibrary-BZB-XWjj.js → ReportTemplateLibrary-C9wutIiT.js} +1 -1
- package/dist/ReportTemplateLibrary-Sxr3eD0J.cjs +1 -0
- package/dist/RuleEditor-C_Clasvd.js +2037 -0
- package/dist/RuleEditor-XhGHK8DE.cjs +1 -0
- package/dist/TemplateOutlinePanel-D6Bkny59.js +96 -0
- package/dist/TemplateOutlinePanel-JTSR53vJ.cjs +1 -0
- package/dist/TemplateReusePanel-Kx35S0Ql.cjs +1 -0
- package/dist/TemplateReusePanel-rVuK1kTz.js +388 -0
- package/dist/TemplateReviewPanel-B0ar9_zf.js +592 -0
- package/dist/TemplateReviewPanel-Dn6X9UmY.cjs +1 -0
- 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 -2
- package/dist/designer.d.cts +432 -17
- package/dist/designer.d.ts +432 -17
- package/dist/designer.js +21 -4312
- package/dist/drill-ByJviLXS.js +145 -0
- package/dist/drill-DYTxuL3A.cjs +1 -0
- package/dist/font-loader-B_UkxpzC.cjs +1 -0
- package/dist/font-loader-Q3bQjmrI.js +297 -0
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +239 -5
- package/dist/index.d.ts +239 -5
- package/dist/index.js +939 -893
- 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-BwNyeGpt.js +36352 -0
- package/dist/pdf-CvvrjPQg.cjs +103 -0
- package/dist/pdf.cjs +1 -101
- package/dist/pdf.d.cts +18 -3
- package/dist/pdf.d.ts +18 -3
- package/dist/pdf.js +9 -36579
- package/dist/plugin-Ca_XZG3l.js +22 -0
- package/dist/{plugin-DzS6pxTA.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-D-5jQlTj.js → record-bindings-Do_b3h4V.js} +1 -1
- package/dist/{region-binding-workflow-CcUq8W2Q.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 +66 -12
- package/dist/server/node.d.ts +66 -12
- package/dist/server-node.cjs +1 -1
- package/dist/server-node.js +405 -381
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +878 -15
- package/dist/server.d.ts +878 -15
- package/dist/server.js +1034 -534
- 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-BGbQLGlV.js +187 -0
- package/dist/template-fragments-DcKeiylI.cjs +1 -0
- package/dist/template-outline-BwRV_eRo.cjs +1 -0
- package/dist/template-outline-cnWfT_LK.js +88 -0
- package/dist/{template-registry-BjE1VS6g.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/{useLocalDraft-C07SYRnC.js → useLocalDraft-BnhcxXk_.js} +1 -1
- package/dist/{useLocalDraft-Yiw1wFgI.cjs → useLocalDraft-CioIfDb6.cjs} +1 -1
- package/dist/vue/async.d.cts +190 -15
- package/dist/vue/async.d.ts +190 -15
- package/dist/vue/index.d.cts +274 -24
- package/dist/vue/index.d.ts +274 -24
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +5 -5
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +90 -81
- package/dist/{workbook-session-DNa2RHNG.cjs → workbook-session-Bjv1YCRK.cjs} +18 -18
- package/dist/{workbook-session-BPb3TMnT.js → workbook-session-BvToI-Fd.js} +5440 -5288
- package/dist/worker.cjs +1 -1
- package/dist/worker.d.cts +66 -12
- package/dist/worker.d.ts +66 -12
- package/dist/worker.js +61 -56
- 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/ExcelBindingWizard-CeAf4QSE.js +0 -1465
- package/dist/ExcelBindingWizard-y0mT-AHR.cjs +0 -1
- package/dist/ParamEditor-BLaE5q5W.js +0 -522
- package/dist/ParamEditor-MBBC7lUE.cjs +0 -1
- package/dist/ReportBatchPanel-Fp1ePFag.cjs +0 -1
- package/dist/ReportPreview-BN6fk7Wz.cjs +0 -6
- package/dist/ReportPreview-D2Jkyh1U.js +0 -4243
- package/dist/ReportTemplateLibrary-5fk5CQBO.cjs +0 -1
- package/dist/RuleEditor-ChRzNQuF.cjs +0 -1
- package/dist/RuleEditor-DzAmW5YH.js +0 -2024
- package/dist/TemplateReviewPanel-BKofGrV9.js +0 -222
- package/dist/TemplateReviewPanel-DwtOcLue.cjs +0 -1
- package/dist/assets-C2U-e-Sz.cjs +0 -4
- package/dist/assets-Q0wUwNrV.js +0 -217
- package/dist/batch-Bt3Fd27Z.cjs +0 -1
- package/dist/batch-mRqhhhjt.js +0 -364
- package/dist/capabilities-CK_7hizc.js +0 -63
- package/dist/capabilities-CsZ-pNHR.cjs +0 -1
- package/dist/config-Bb7RiIO5.cjs +0 -1
- package/dist/config-XVwG87IA.js +0 -529
- 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/plugin-D4wizDXB.js +0 -22
- 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-registry-D3SjENi6.cjs +0 -1
- package/dist/template-review-DGwWOoCv.cjs +0 -2
- package/dist/template-review-PgEe_Wr9.js +0 -1742
- package/dist/validate-BJ5HIWY8.cjs +0 -1
- package/dist/validate-DbgEM1Hh.js +0 -163
package/dist/worker.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const W=require("./json-snapshot-WWSGlaHG.cjs"),M=require("./prepared-CFy9B75C.cjs"),A=require("./data-explanation-DE55G30w.cjs"),L=require("./template-registry-Co1zPq5e.cjs"),u="mach-report-worker/1";class l extends Error{constructor(r){super(r.message),this.name=r.name,this.code=r.code,this.path=r.path,this.issues=r.issues,this.diagnostics=r.diagnostics}}function f(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function T(e){return f(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}function j(e){return Array.isArray(e)&&e.every(r=>f(r)&&typeof r.code=="string"&&typeof r.message=="string"&&["info","warning","error"].includes(r.severity)&&A.hasValidDataExplanation(r))}function S(e){return f(e)&&Object.values(e).every(r=>f(r)&&(r.revision===void 0||typeof r.revision=="string")&&(r.sourceToken===void 0||typeof r.sourceToken=="string"))}function O(e){return e===void 0?!0:f(e)&&["heuristic","provided","font-bytes"].includes(e.textMetrics)&&(e.fontFingerprint===void 0||typeof e.fontFingerprint=="string"&&/^[a-f0-9]{64}$/.test(e.fontFingerprint))}function F(e,r){if(!f(e)||!T(e.stats)||!j(e.diagnostics)||!S(e.revisions)||!O(e.layout)||!M.validPreparedSources(e.sources))return!1;if(r==="prepare")return L.validateRenderPlan(e.plan).ok;const t=e.format==="pdf"?"application/pdf":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";return e.bytes instanceof Uint8Array&&(e.format==="pdf"||e.format==="xlsx")&&e.contentType===t}function x(e){if(!e||typeof e!="object")return{message:String(e)};const r={};for(const t of["code","path","field","message"]){const o=e[t];typeof o=="string"&&(r[t]=o)}return r}function N(e){const r=x(e);if(!f(e))return r;for(const t of["format","severity","kind","nid"])typeof e[t]=="string"&&(r[t]=e[t]);for(const t of["pageIndex","componentIndex"])Number.isSafeInteger(e[t])&&e[t]>=0&&(r[t]=e[t]);return Array.isArray(e.componentPath)&&e.componentPath.every(t=>Number.isSafeInteger(t)&&t>=0)&&(r.componentPath=e.componentPath),r}function z(e){if(!(e instanceof Error))return{name:"Error",message:String(e)};const r=e;return{name:e.name,message:e.message,...typeof r.code=="string"?{code:r.code}:{},...typeof r.path=="string"?{path:r.path}:{},...Array.isArray(r.issues)?{issues:r.issues.map(x)}:{},...Array.isArray(r.diagnostics)?{diagnostics:r.diagnostics.map(N)}:{}}}function _(e){if(!e||typeof e!="object")return!1;const r=e;return r.protocol===u&&typeof r.id=="string"&&(r.operation==="prepare"||r.operation==="export"||r.operation==="exportPrepared")&&!!r.input&&typeof r.input=="object"}async function $(e,r,t){try{const o=r.operation==="prepare"?await e.prepare({...r.input,onEvent:t}):r.operation==="exportPrepared"?await e.exportPrepared({...r.input,onEvent:t}):await e.export({...r.input,onEvent:t});return{protocol:u,id:r.id,result:o}}catch(o){return{protocol:u,id:r.id,error:z(o)}}}function q(e){const r=e.result;return!r||!("bytes"in r)||!(r.bytes.buffer instanceof ArrayBuffer)?[]:[r.bytes.buffer]}function v(e,r){if(!f(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"||!("reportIds"in r&&r.reportIds.includes(e.reportId)))||!["query","validate","layout","assets","encode"].includes(e.stage)||!["started","completed","failed"].includes(e.status))return!1;for(const t of["completed","total"])if(e[t]!==void 0&&(typeof e[t]!="number"||!Number.isFinite(e[t])||e[t]<0))return!1;return e.completed===void 0||e.total===void 0||e.completed<=e.total}let B=0;function w(e){const r=new Error("报表 Worker 任务已取消");return r.name="AbortError",Object.defineProperty(r,"cause",{value:e}),r}function D(e,r){if(!e||typeof e!="object")return;const t=e;return t.protocol===u&&t.id===r?t:void 0}function C(e,r={}){const t=r.timeoutMs??12e4;if(!Number.isFinite(t)||t<=0||t>2147483647)throw new RangeError("Worker timeoutMs 应为正有限数字,且不能超过 2147483647");const o=(s,a,n,d)=>n?.aborted?Promise.reject(w(n.reason)):new Promise((I,b)=>{let g;try{g=e()}catch(c){b(c);return}const R=`mach-report-${Date.now()}-${++B}`;let y=!1,E=()=>{},h;const p=(c,i)=>{y||(y=!0,h&&clearTimeout(h),E(),n?.removeEventListener("abort",k),Promise.resolve().then(()=>g.terminate()).then(()=>c===void 0?I(i):b(c),m=>b(c??m)))},k=()=>p(w(n?.reason)),P=c=>{const i=D(c,R);if(!(!i||y)){if("type"in i&&i.type==="event"){const m="event"in i?i.event:void 0;v(m,a)?W.notifyReportTaskEvent(d,m,n):p(new Error("报表 Worker 返回无效阶段事件"));return}i.error&&typeof i.error.name=="string"&&typeof i.error.message=="string"?p(new l(i.error)):F(i.result,s)&&(s==="prepare"||"format"in i.result&&"format"in a&&i.result.format===a.format)?p(void 0,i.result):p(new Error("报表 Worker 返回无效响应"))}};try{if(E=g.subscribe(P,c=>p(c??new Error("报表 Worker 执行失败"))),y){E();return}if(n?.addEventListener("abort",k,{once:!0}),h=setTimeout(()=>p(new l({name:"ReportRuntimeError",code:"timeout",message:`报表 Worker 执行超过 ${t}ms`})),t),n?.aborted)k();else{const{onEvent:c,signal:i,...m}=a;g.postMessage({protocol:u,id:R,operation:s,input:m})}}catch(c){p(c)}});return{exportPrepared:(s,a,n)=>o("exportPrepared",s,a,n),prepare:(s,a,n)=>o("prepare",s,a,n),export:(s,a,n)=>o("export",s,a,n)}}function K(e,r={}){return C(()=>{const t=e();return{postMessage:o=>t.postMessage(o),terminate:()=>t.terminate(),subscribe:(o,s)=>{const a=d=>o(d.data),n=d=>s(d instanceof ErrorEvent?new Error(d.message):new Error("报表 Worker 消息无法解码"));return t.addEventListener("message",a),t.addEventListener("error",n),t.addEventListener("messageerror",n),()=>{t.removeEventListener("message",a),t.removeEventListener("error",n),t.removeEventListener("messageerror",n)}}}},r)}function U(e,r=globalThis){const t=o=>{_(o.data)&&$(e,o.data,s=>r.postMessage({protocol:u,id:o.data.id,type:"event",event:s})).then(s=>r.postMessage(s,q(s)))};return r.addEventListener("message",t),()=>r.removeEventListener("message",t)}exports.ReportWorkerError=l;exports.createBrowserReportExecutor=K;exports.serveReportWorker=U;
|
package/dist/worker.d.cts
CHANGED
|
@@ -181,6 +181,13 @@ declare interface PreparedReport {
|
|
|
181
181
|
revision?: string;
|
|
182
182
|
sourceToken?: string;
|
|
183
183
|
}>;
|
|
184
|
+
/** Ordered occurrences; legacy revisions remains last-value-by-ID for compatibility. */
|
|
185
|
+
sources?: ReportRuntimeSource[];
|
|
186
|
+
/** Captured metrics identity; absence on old saved instances remains supported with diagnostics. */
|
|
187
|
+
layout?: {
|
|
188
|
+
textMetrics: "heuristic" | "provided" | "font-bytes";
|
|
189
|
+
fontFingerprint?: string;
|
|
190
|
+
};
|
|
184
191
|
}
|
|
185
192
|
|
|
186
193
|
declare interface RenderPlan {
|
|
@@ -192,6 +199,8 @@ declare interface RenderPlan {
|
|
|
192
199
|
|
|
193
200
|
/** 可持久化的业务身份与计划坐标独立;权限及并发校验仍由业务服务器执行。 */
|
|
194
201
|
declare interface ReportCellSource {
|
|
202
|
+
/** Source identity across report occurrences; sharing must be explicitly declared. */
|
|
203
|
+
sourceScope?: string;
|
|
195
204
|
datasetId: string;
|
|
196
205
|
rowKey: string | number;
|
|
197
206
|
field: string;
|
|
@@ -199,6 +208,16 @@ declare interface ReportCellSource {
|
|
|
199
208
|
sourceToken?: string;
|
|
200
209
|
}
|
|
201
210
|
|
|
211
|
+
declare interface ReportDataTarget {
|
|
212
|
+
datasetId: string;
|
|
213
|
+
field: string;
|
|
214
|
+
rowKey?: string | number;
|
|
215
|
+
/** Use table identity when the same dataset appears in several tables. */
|
|
216
|
+
tableId?: string;
|
|
217
|
+
/** Assigned by the source/runtime when several reports share dataset names. */
|
|
218
|
+
reportScope?: string;
|
|
219
|
+
}
|
|
220
|
+
|
|
202
221
|
declare interface ReportDescription {
|
|
203
222
|
id: string;
|
|
204
223
|
params: ReportParamDef[];
|
|
@@ -217,6 +236,9 @@ declare interface ReportDiagnostic {
|
|
|
217
236
|
message: string;
|
|
218
237
|
path?: string;
|
|
219
238
|
severity: "warning" | "error" | "info";
|
|
239
|
+
/** Optional explanation supplied by the business source, not inferred from blank cells. */
|
|
240
|
+
valueState?: ReportValueState;
|
|
241
|
+
target?: ReportDataTarget;
|
|
220
242
|
}
|
|
221
243
|
|
|
222
244
|
/** 报表参数定义(声明式,模板自描述参数面:渲染组件据此生成查询面板) */
|
|
@@ -231,6 +253,10 @@ declare interface ReportParamDef {
|
|
|
231
253
|
label: string;
|
|
232
254
|
value: string;
|
|
233
255
|
}>;
|
|
256
|
+
/** Opaque host-resolved source key. No URL, credentials or executable code is stored. */
|
|
257
|
+
optionsSource?: string;
|
|
258
|
+
/** Select dependencies must be declared parameters; changing a parent clears descendants. */
|
|
259
|
+
dependsOn?: string[];
|
|
234
260
|
defaultValue?: string;
|
|
235
261
|
required?: boolean;
|
|
236
262
|
placeholder?: string;
|
|
@@ -248,7 +274,7 @@ declare interface ReportParamIssue {
|
|
|
248
274
|
message: string;
|
|
249
275
|
}
|
|
250
276
|
|
|
251
|
-
declare type ReportParamIssueCode = "definition" | "required" | "type" | "option" | "minimum" | "maximum" | "minLength" | "maxLength";
|
|
277
|
+
declare type ReportParamIssueCode = "definition" | "required" | "type" | "option" | "dependency" | "minimum" | "maximum" | "minLength" | "maxLength";
|
|
252
278
|
|
|
253
279
|
declare interface ReportParamValidation {
|
|
254
280
|
ok: boolean;
|
|
@@ -259,15 +285,30 @@ declare interface ReportParamValidation {
|
|
|
259
285
|
issues: ReportParamIssue[];
|
|
260
286
|
}
|
|
261
287
|
|
|
288
|
+
/** Licensed local font bytes; never downloaded implicitly by the runtime. */
|
|
289
|
+
declare interface ReportPdfFontOptions {
|
|
290
|
+
customFontBytes?: Uint8Array | ArrayBuffer;
|
|
291
|
+
customFontName?: string;
|
|
292
|
+
customFontFaces?: {
|
|
293
|
+
regular: Uint8Array | ArrayBuffer;
|
|
294
|
+
bold?: Uint8Array | ArrayBuffer;
|
|
295
|
+
italic?: Uint8Array | ArrayBuffer;
|
|
296
|
+
boldItalic?: Uint8Array | ArrayBuffer;
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
|
|
262
300
|
declare interface ReportRuntime {
|
|
263
301
|
describe(reportIds?: string[]): ReportDescription[];
|
|
264
302
|
validate(input: Omit<ReportRuntimeInput, "signal">): ReportParamValidation;
|
|
265
303
|
prepare(input: ReportRuntimeInput): Promise<PreparedReport>;
|
|
266
304
|
export(input: ReportRuntimeExportInput): Promise<ReportRuntimeExportResult>;
|
|
305
|
+
exportPrepared(input: ReportRuntimePreparedExportInput): Promise<ReportRuntimeExportResult>;
|
|
267
306
|
}
|
|
268
307
|
|
|
269
308
|
/** 可用 worker_threads/进程/RPC 实现;接收可序列化请求,signal 由桥接层映射为取消消息。 */
|
|
270
309
|
declare interface ReportRuntimeExecutor {
|
|
310
|
+
/** Old custom executors may omit this; the runtime explicitly rejects unsupported prepared output. */
|
|
311
|
+
exportPrepared?(input: Omit<ReportRuntimePreparedExportInput, "signal" | "onEvent">, signal?: AbortSignal, onEvent?: ReportTaskObserver): Promise<ReportRuntimeExportResult>;
|
|
271
312
|
prepare(input: Omit<ReportRuntimeInput, "signal" | "onEvent">, signal?: AbortSignal, onEvent?: ReportTaskObserver): Promise<PreparedReport>;
|
|
272
313
|
export(input: Omit<ReportRuntimeExportInput, "signal" | "onEvent">, signal?: AbortSignal, onEvent?: ReportTaskObserver): Promise<ReportRuntimeExportResult>;
|
|
273
314
|
}
|
|
@@ -276,17 +317,6 @@ declare interface ReportRuntimeExportInput extends ReportRuntimeInput {
|
|
|
276
317
|
format: "pdf" | "xlsx";
|
|
277
318
|
/** strict 在编码前拒绝已识别的输出降级;默认保留诊断并继续。 */
|
|
278
319
|
fidelity?: "warn" | "strict";
|
|
279
|
-
/** PDF 中文需宿主显式提供有授权的字体;不隐式下载字体或资源。 */
|
|
280
|
-
pdf?: {
|
|
281
|
-
customFontBytes?: Uint8Array | ArrayBuffer;
|
|
282
|
-
customFontName?: string;
|
|
283
|
-
customFontFaces?: {
|
|
284
|
-
regular: Uint8Array | ArrayBuffer;
|
|
285
|
-
bold?: Uint8Array | ArrayBuffer;
|
|
286
|
-
italic?: Uint8Array | ArrayBuffer;
|
|
287
|
-
boldItalic?: Uint8Array | ArrayBuffer;
|
|
288
|
-
};
|
|
289
|
-
};
|
|
290
320
|
xlsx?: {
|
|
291
321
|
sheetMode?: "auto" | "pages" | "continuous";
|
|
292
322
|
valueMode?: "text" | "raw";
|
|
@@ -304,6 +334,27 @@ declare interface ReportRuntimeInput extends ReportTaskMonitoring {
|
|
|
304
334
|
reportIds: string[];
|
|
305
335
|
params?: Record<string, string>;
|
|
306
336
|
signal?: AbortSignal;
|
|
337
|
+
/** Prepare using the same licensed font bytes later supplied to PDF output. */
|
|
338
|
+
pdf?: ReportPdfFontOptions;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/** Encode an existing plan without querying providers or repaginating. */
|
|
342
|
+
declare interface ReportRuntimePreparedExportInput extends ReportTaskMonitoring {
|
|
343
|
+
prepared: PreparedReport;
|
|
344
|
+
format: ReportRuntimeExportInput["format"];
|
|
345
|
+
fidelity?: ReportRuntimeExportInput["fidelity"];
|
|
346
|
+
pdf?: ReportPdfFontOptions;
|
|
347
|
+
xlsx?: ReportRuntimeExportInput["xlsx"];
|
|
348
|
+
signal?: AbortSignal;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/** One query occurrence; repeated report IDs retain independent provenance. */
|
|
352
|
+
declare interface ReportRuntimeSource {
|
|
353
|
+
reportId: string;
|
|
354
|
+
reportIndex: number;
|
|
355
|
+
reportScope: string;
|
|
356
|
+
revision?: string;
|
|
357
|
+
sourceToken?: string;
|
|
307
358
|
}
|
|
308
359
|
|
|
309
360
|
declare interface ReportRuntimeStats {
|
|
@@ -333,6 +384,9 @@ declare interface ReportTaskMonitoring {
|
|
|
333
384
|
|
|
334
385
|
declare type ReportTaskObserver = (event: ReportTaskEvent) => void;
|
|
335
386
|
|
|
387
|
+
/** Optional business explanations never replace raw data or schema validation. */
|
|
388
|
+
declare type ReportValueState = "missing-source" | "not-applicable" | "not-calculable";
|
|
389
|
+
|
|
336
390
|
export declare class ReportWorkerError extends Error {
|
|
337
391
|
readonly code?: string;
|
|
338
392
|
readonly path?: string;
|
package/dist/worker.d.ts
CHANGED
|
@@ -181,6 +181,13 @@ declare interface PreparedReport {
|
|
|
181
181
|
revision?: string;
|
|
182
182
|
sourceToken?: string;
|
|
183
183
|
}>;
|
|
184
|
+
/** Ordered occurrences; legacy revisions remains last-value-by-ID for compatibility. */
|
|
185
|
+
sources?: ReportRuntimeSource[];
|
|
186
|
+
/** Captured metrics identity; absence on old saved instances remains supported with diagnostics. */
|
|
187
|
+
layout?: {
|
|
188
|
+
textMetrics: "heuristic" | "provided" | "font-bytes";
|
|
189
|
+
fontFingerprint?: string;
|
|
190
|
+
};
|
|
184
191
|
}
|
|
185
192
|
|
|
186
193
|
declare interface RenderPlan {
|
|
@@ -192,6 +199,8 @@ declare interface RenderPlan {
|
|
|
192
199
|
|
|
193
200
|
/** 可持久化的业务身份与计划坐标独立;权限及并发校验仍由业务服务器执行。 */
|
|
194
201
|
declare interface ReportCellSource {
|
|
202
|
+
/** Source identity across report occurrences; sharing must be explicitly declared. */
|
|
203
|
+
sourceScope?: string;
|
|
195
204
|
datasetId: string;
|
|
196
205
|
rowKey: string | number;
|
|
197
206
|
field: string;
|
|
@@ -199,6 +208,16 @@ declare interface ReportCellSource {
|
|
|
199
208
|
sourceToken?: string;
|
|
200
209
|
}
|
|
201
210
|
|
|
211
|
+
declare interface ReportDataTarget {
|
|
212
|
+
datasetId: string;
|
|
213
|
+
field: string;
|
|
214
|
+
rowKey?: string | number;
|
|
215
|
+
/** Use table identity when the same dataset appears in several tables. */
|
|
216
|
+
tableId?: string;
|
|
217
|
+
/** Assigned by the source/runtime when several reports share dataset names. */
|
|
218
|
+
reportScope?: string;
|
|
219
|
+
}
|
|
220
|
+
|
|
202
221
|
declare interface ReportDescription {
|
|
203
222
|
id: string;
|
|
204
223
|
params: ReportParamDef[];
|
|
@@ -217,6 +236,9 @@ declare interface ReportDiagnostic {
|
|
|
217
236
|
message: string;
|
|
218
237
|
path?: string;
|
|
219
238
|
severity: "warning" | "error" | "info";
|
|
239
|
+
/** Optional explanation supplied by the business source, not inferred from blank cells. */
|
|
240
|
+
valueState?: ReportValueState;
|
|
241
|
+
target?: ReportDataTarget;
|
|
220
242
|
}
|
|
221
243
|
|
|
222
244
|
/** 报表参数定义(声明式,模板自描述参数面:渲染组件据此生成查询面板) */
|
|
@@ -231,6 +253,10 @@ declare interface ReportParamDef {
|
|
|
231
253
|
label: string;
|
|
232
254
|
value: string;
|
|
233
255
|
}>;
|
|
256
|
+
/** Opaque host-resolved source key. No URL, credentials or executable code is stored. */
|
|
257
|
+
optionsSource?: string;
|
|
258
|
+
/** Select dependencies must be declared parameters; changing a parent clears descendants. */
|
|
259
|
+
dependsOn?: string[];
|
|
234
260
|
defaultValue?: string;
|
|
235
261
|
required?: boolean;
|
|
236
262
|
placeholder?: string;
|
|
@@ -248,7 +274,7 @@ declare interface ReportParamIssue {
|
|
|
248
274
|
message: string;
|
|
249
275
|
}
|
|
250
276
|
|
|
251
|
-
declare type ReportParamIssueCode = "definition" | "required" | "type" | "option" | "minimum" | "maximum" | "minLength" | "maxLength";
|
|
277
|
+
declare type ReportParamIssueCode = "definition" | "required" | "type" | "option" | "dependency" | "minimum" | "maximum" | "minLength" | "maxLength";
|
|
252
278
|
|
|
253
279
|
declare interface ReportParamValidation {
|
|
254
280
|
ok: boolean;
|
|
@@ -259,15 +285,30 @@ declare interface ReportParamValidation {
|
|
|
259
285
|
issues: ReportParamIssue[];
|
|
260
286
|
}
|
|
261
287
|
|
|
288
|
+
/** Licensed local font bytes; never downloaded implicitly by the runtime. */
|
|
289
|
+
declare interface ReportPdfFontOptions {
|
|
290
|
+
customFontBytes?: Uint8Array | ArrayBuffer;
|
|
291
|
+
customFontName?: string;
|
|
292
|
+
customFontFaces?: {
|
|
293
|
+
regular: Uint8Array | ArrayBuffer;
|
|
294
|
+
bold?: Uint8Array | ArrayBuffer;
|
|
295
|
+
italic?: Uint8Array | ArrayBuffer;
|
|
296
|
+
boldItalic?: Uint8Array | ArrayBuffer;
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
|
|
262
300
|
declare interface ReportRuntime {
|
|
263
301
|
describe(reportIds?: string[]): ReportDescription[];
|
|
264
302
|
validate(input: Omit<ReportRuntimeInput, "signal">): ReportParamValidation;
|
|
265
303
|
prepare(input: ReportRuntimeInput): Promise<PreparedReport>;
|
|
266
304
|
export(input: ReportRuntimeExportInput): Promise<ReportRuntimeExportResult>;
|
|
305
|
+
exportPrepared(input: ReportRuntimePreparedExportInput): Promise<ReportRuntimeExportResult>;
|
|
267
306
|
}
|
|
268
307
|
|
|
269
308
|
/** 可用 worker_threads/进程/RPC 实现;接收可序列化请求,signal 由桥接层映射为取消消息。 */
|
|
270
309
|
declare interface ReportRuntimeExecutor {
|
|
310
|
+
/** Old custom executors may omit this; the runtime explicitly rejects unsupported prepared output. */
|
|
311
|
+
exportPrepared?(input: Omit<ReportRuntimePreparedExportInput, "signal" | "onEvent">, signal?: AbortSignal, onEvent?: ReportTaskObserver): Promise<ReportRuntimeExportResult>;
|
|
271
312
|
prepare(input: Omit<ReportRuntimeInput, "signal" | "onEvent">, signal?: AbortSignal, onEvent?: ReportTaskObserver): Promise<PreparedReport>;
|
|
272
313
|
export(input: Omit<ReportRuntimeExportInput, "signal" | "onEvent">, signal?: AbortSignal, onEvent?: ReportTaskObserver): Promise<ReportRuntimeExportResult>;
|
|
273
314
|
}
|
|
@@ -276,17 +317,6 @@ declare interface ReportRuntimeExportInput extends ReportRuntimeInput {
|
|
|
276
317
|
format: "pdf" | "xlsx";
|
|
277
318
|
/** strict 在编码前拒绝已识别的输出降级;默认保留诊断并继续。 */
|
|
278
319
|
fidelity?: "warn" | "strict";
|
|
279
|
-
/** PDF 中文需宿主显式提供有授权的字体;不隐式下载字体或资源。 */
|
|
280
|
-
pdf?: {
|
|
281
|
-
customFontBytes?: Uint8Array | ArrayBuffer;
|
|
282
|
-
customFontName?: string;
|
|
283
|
-
customFontFaces?: {
|
|
284
|
-
regular: Uint8Array | ArrayBuffer;
|
|
285
|
-
bold?: Uint8Array | ArrayBuffer;
|
|
286
|
-
italic?: Uint8Array | ArrayBuffer;
|
|
287
|
-
boldItalic?: Uint8Array | ArrayBuffer;
|
|
288
|
-
};
|
|
289
|
-
};
|
|
290
320
|
xlsx?: {
|
|
291
321
|
sheetMode?: "auto" | "pages" | "continuous";
|
|
292
322
|
valueMode?: "text" | "raw";
|
|
@@ -304,6 +334,27 @@ declare interface ReportRuntimeInput extends ReportTaskMonitoring {
|
|
|
304
334
|
reportIds: string[];
|
|
305
335
|
params?: Record<string, string>;
|
|
306
336
|
signal?: AbortSignal;
|
|
337
|
+
/** Prepare using the same licensed font bytes later supplied to PDF output. */
|
|
338
|
+
pdf?: ReportPdfFontOptions;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/** Encode an existing plan without querying providers or repaginating. */
|
|
342
|
+
declare interface ReportRuntimePreparedExportInput extends ReportTaskMonitoring {
|
|
343
|
+
prepared: PreparedReport;
|
|
344
|
+
format: ReportRuntimeExportInput["format"];
|
|
345
|
+
fidelity?: ReportRuntimeExportInput["fidelity"];
|
|
346
|
+
pdf?: ReportPdfFontOptions;
|
|
347
|
+
xlsx?: ReportRuntimeExportInput["xlsx"];
|
|
348
|
+
signal?: AbortSignal;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/** One query occurrence; repeated report IDs retain independent provenance. */
|
|
352
|
+
declare interface ReportRuntimeSource {
|
|
353
|
+
reportId: string;
|
|
354
|
+
reportIndex: number;
|
|
355
|
+
reportScope: string;
|
|
356
|
+
revision?: string;
|
|
357
|
+
sourceToken?: string;
|
|
307
358
|
}
|
|
308
359
|
|
|
309
360
|
declare interface ReportRuntimeStats {
|
|
@@ -333,6 +384,9 @@ declare interface ReportTaskMonitoring {
|
|
|
333
384
|
|
|
334
385
|
declare type ReportTaskObserver = (event: ReportTaskEvent) => void;
|
|
335
386
|
|
|
387
|
+
/** Optional business explanations never replace raw data or schema validation. */
|
|
388
|
+
declare type ReportValueState = "missing-source" | "not-applicable" | "not-calculable";
|
|
389
|
+
|
|
336
390
|
export declare class ReportWorkerError extends Error {
|
|
337
391
|
readonly code?: string;
|
|
338
392
|
readonly path?: string;
|
package/dist/worker.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { o as M } from "./json-snapshot-DFb2eWkf.js";
|
|
2
|
+
import { d as W } from "./prepared-ajM-H-9B.js";
|
|
3
|
+
import { h as A } from "./data-explanation-B8MZRYVS.js";
|
|
4
|
+
import { a as L } from "./template-registry-BtaKPELV.js";
|
|
3
5
|
const u = "mach-report-worker/1";
|
|
4
6
|
class R extends Error {
|
|
5
7
|
constructor(r) {
|
|
@@ -9,22 +11,25 @@ class R extends Error {
|
|
|
9
11
|
function p(e) {
|
|
10
12
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
11
13
|
}
|
|
12
|
-
function
|
|
14
|
+
function T(e) {
|
|
13
15
|
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;
|
|
14
16
|
}
|
|
15
|
-
function
|
|
16
|
-
return Array.isArray(e) && e.every((r) => p(r) && typeof r.code == "string" && typeof r.message == "string" && ["info", "warning", "error"].includes(r.severity));
|
|
17
|
+
function j(e) {
|
|
18
|
+
return Array.isArray(e) && e.every((r) => p(r) && typeof r.code == "string" && typeof r.message == "string" && ["info", "warning", "error"].includes(r.severity) && A(r));
|
|
17
19
|
}
|
|
18
|
-
function
|
|
20
|
+
function O(e) {
|
|
19
21
|
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"));
|
|
20
22
|
}
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
function F(e) {
|
|
24
|
+
return e === void 0 ? !0 : p(e) && ["heuristic", "provided", "font-bytes"].includes(e.textMetrics) && (e.fontFingerprint === void 0 || typeof e.fontFingerprint == "string" && /^[a-f0-9]{64}$/.test(e.fontFingerprint));
|
|
25
|
+
}
|
|
26
|
+
function N(e, r) {
|
|
27
|
+
if (!p(e) || !T(e.stats) || !j(e.diagnostics) || !O(e.revisions) || !F(e.layout) || !W(e.sources)) return !1;
|
|
28
|
+
if (r === "prepare") return L(e.plan).ok;
|
|
24
29
|
const t = e.format === "pdf" ? "application/pdf" : "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
25
30
|
return e.bytes instanceof Uint8Array && (e.format === "pdf" || e.format === "xlsx") && e.contentType === t;
|
|
26
31
|
}
|
|
27
|
-
function
|
|
32
|
+
function x(e) {
|
|
28
33
|
if (!e || typeof e != "object") return { message: String(e) };
|
|
29
34
|
const r = {};
|
|
30
35
|
for (const t of ["code", "path", "field", "message"]) {
|
|
@@ -33,14 +38,14 @@ function I(e) {
|
|
|
33
38
|
}
|
|
34
39
|
return r;
|
|
35
40
|
}
|
|
36
|
-
function
|
|
37
|
-
const r =
|
|
41
|
+
function S(e) {
|
|
42
|
+
const r = x(e);
|
|
38
43
|
if (!p(e)) return r;
|
|
39
44
|
for (const t of ["format", "severity", "kind", "nid"]) typeof e[t] == "string" && (r[t] = e[t]);
|
|
40
45
|
for (const t of ["pageIndex", "componentIndex"]) Number.isSafeInteger(e[t]) && e[t] >= 0 && (r[t] = e[t]);
|
|
41
46
|
return Array.isArray(e.componentPath) && e.componentPath.every((t) => Number.isSafeInteger(t) && t >= 0) && (r.componentPath = e.componentPath), r;
|
|
42
47
|
}
|
|
43
|
-
function
|
|
48
|
+
function z(e) {
|
|
44
49
|
if (!(e instanceof Error)) return { name: "Error", message: String(e) };
|
|
45
50
|
const r = e;
|
|
46
51
|
return {
|
|
@@ -48,111 +53,111 @@ function N(e) {
|
|
|
48
53
|
message: e.message,
|
|
49
54
|
...typeof r.code == "string" ? { code: r.code } : {},
|
|
50
55
|
...typeof r.path == "string" ? { path: r.path } : {},
|
|
51
|
-
...Array.isArray(r.issues) ? { issues: r.issues.map(
|
|
52
|
-
...Array.isArray(r.diagnostics) ? { diagnostics: r.diagnostics.map(
|
|
56
|
+
...Array.isArray(r.issues) ? { issues: r.issues.map(x) } : {},
|
|
57
|
+
...Array.isArray(r.diagnostics) ? { diagnostics: r.diagnostics.map(S) } : {}
|
|
53
58
|
};
|
|
54
59
|
}
|
|
55
|
-
function
|
|
60
|
+
function _(e) {
|
|
56
61
|
if (!e || typeof e != "object") return !1;
|
|
57
62
|
const r = e;
|
|
58
|
-
return r.protocol === u && typeof r.id == "string" && (r.operation === "prepare" || r.operation === "export") && !!r.input && typeof r.input == "object";
|
|
63
|
+
return r.protocol === u && typeof r.id == "string" && (r.operation === "prepare" || r.operation === "export" || r.operation === "exportPrepared") && !!r.input && typeof r.input == "object";
|
|
59
64
|
}
|
|
60
|
-
async function
|
|
65
|
+
async function $(e, r, t) {
|
|
61
66
|
try {
|
|
62
|
-
const o = r.operation === "prepare" ? await e.prepare({ ...r.input, onEvent: t }) : await e.export({ ...r.input, onEvent: t });
|
|
67
|
+
const o = r.operation === "prepare" ? await e.prepare({ ...r.input, onEvent: t }) : r.operation === "exportPrepared" ? await e.exportPrepared({ ...r.input, onEvent: t }) : await e.export({ ...r.input, onEvent: t });
|
|
63
68
|
return { protocol: u, id: r.id, result: o };
|
|
64
69
|
} catch (o) {
|
|
65
|
-
return { protocol: u, id: r.id, error:
|
|
70
|
+
return { protocol: u, id: r.id, error: z(o) };
|
|
66
71
|
}
|
|
67
72
|
}
|
|
68
|
-
function
|
|
73
|
+
function D(e) {
|
|
69
74
|
const r = e.result;
|
|
70
75
|
return !r || !("bytes" in r) || !(r.bytes.buffer instanceof ArrayBuffer) ? [] : [r.bytes.buffer];
|
|
71
76
|
}
|
|
72
|
-
function
|
|
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", "assets", "encode"].includes(e.stage) || !["started", "completed", "failed"].includes(e.status)) return !1;
|
|
77
|
+
function B(e, r) {
|
|
78
|
+
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" || !("reportIds" in r && r.reportIds.includes(e.reportId))) || !["query", "validate", "layout", "assets", "encode"].includes(e.stage) || !["started", "completed", "failed"].includes(e.status)) return !1;
|
|
74
79
|
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
80
|
return e.completed === void 0 || e.total === void 0 || e.completed <= e.total;
|
|
76
81
|
}
|
|
77
|
-
let
|
|
82
|
+
let v = 0;
|
|
78
83
|
function w(e) {
|
|
79
84
|
const r = new Error("报表 Worker 任务已取消");
|
|
80
85
|
return r.name = "AbortError", Object.defineProperty(r, "cause", { value: e }), r;
|
|
81
86
|
}
|
|
82
|
-
function
|
|
87
|
+
function C(e, r) {
|
|
83
88
|
if (!e || typeof e != "object") return;
|
|
84
89
|
const t = e;
|
|
85
90
|
return t.protocol === u && t.id === r ? t : void 0;
|
|
86
91
|
}
|
|
87
|
-
function
|
|
92
|
+
function K(e, r = {}) {
|
|
88
93
|
const t = r.timeoutMs ?? 12e4;
|
|
89
94
|
if (!Number.isFinite(t) || t <= 0 || t > 2147483647) throw new RangeError("Worker timeoutMs 应为正有限数字,且不能超过 2147483647");
|
|
90
|
-
const o = (
|
|
95
|
+
const o = (s, a, n, d) => n?.aborted ? Promise.reject(w(n.reason)) : new Promise((I, b) => {
|
|
91
96
|
let g;
|
|
92
97
|
try {
|
|
93
98
|
g = e();
|
|
94
|
-
} catch (
|
|
95
|
-
b(
|
|
99
|
+
} catch (c) {
|
|
100
|
+
b(c);
|
|
96
101
|
return;
|
|
97
102
|
}
|
|
98
|
-
const l = `mach-report-${Date.now()}-${++
|
|
103
|
+
const l = `mach-report-${Date.now()}-${++v}`;
|
|
99
104
|
let y = !1, E = () => {
|
|
100
105
|
}, h;
|
|
101
|
-
const f = (
|
|
106
|
+
const f = (c, i) => {
|
|
102
107
|
y || (y = !0, h && clearTimeout(h), E(), n?.removeEventListener("abort", k), Promise.resolve().then(() => g.terminate()).then(
|
|
103
|
-
() =>
|
|
104
|
-
(m) => b(
|
|
108
|
+
() => c === void 0 ? I(i) : b(c),
|
|
109
|
+
(m) => b(c ?? m)
|
|
105
110
|
));
|
|
106
|
-
}, k = () => f(w(n?.reason)),
|
|
107
|
-
const
|
|
108
|
-
if (!(!
|
|
109
|
-
if ("type" in
|
|
110
|
-
const m = "event" in
|
|
111
|
-
|
|
111
|
+
}, k = () => f(w(n?.reason)), P = (c) => {
|
|
112
|
+
const i = C(c, l);
|
|
113
|
+
if (!(!i || y)) {
|
|
114
|
+
if ("type" in i && i.type === "event") {
|
|
115
|
+
const m = "event" in i ? i.event : void 0;
|
|
116
|
+
B(m, a) ? M(d, m, n) : f(new Error("报表 Worker 返回无效阶段事件"));
|
|
112
117
|
return;
|
|
113
118
|
}
|
|
114
|
-
|
|
119
|
+
i.error && typeof i.error.name == "string" && typeof i.error.message == "string" ? f(new R(i.error)) : N(i.result, s) && (s === "prepare" || "format" in i.result && "format" in a && i.result.format === a.format) ? f(void 0, i.result) : f(new Error("报表 Worker 返回无效响应"));
|
|
115
120
|
}
|
|
116
121
|
};
|
|
117
122
|
try {
|
|
118
|
-
if (E = g.subscribe(
|
|
123
|
+
if (E = g.subscribe(P, (c) => f(c ?? new Error("报表 Worker 执行失败"))), y) {
|
|
119
124
|
E();
|
|
120
125
|
return;
|
|
121
126
|
}
|
|
122
127
|
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
128
|
else {
|
|
124
|
-
const { onEvent:
|
|
125
|
-
g.postMessage({ protocol: u, id: l, operation:
|
|
129
|
+
const { onEvent: c, signal: i, ...m } = a;
|
|
130
|
+
g.postMessage({ protocol: u, id: l, operation: s, input: m });
|
|
126
131
|
}
|
|
127
|
-
} catch (
|
|
128
|
-
f(
|
|
132
|
+
} catch (c) {
|
|
133
|
+
f(c);
|
|
129
134
|
}
|
|
130
135
|
});
|
|
131
|
-
return { prepare: (
|
|
136
|
+
return { exportPrepared: (s, a, n) => o("exportPrepared", s, a, n), prepare: (s, a, n) => o("prepare", s, a, n), export: (s, a, n) => o("export", s, a, n) };
|
|
132
137
|
}
|
|
133
|
-
function
|
|
134
|
-
return
|
|
138
|
+
function J(e, r = {}) {
|
|
139
|
+
return K(() => {
|
|
135
140
|
const t = e();
|
|
136
141
|
return {
|
|
137
142
|
postMessage: (o) => t.postMessage(o),
|
|
138
143
|
terminate: () => t.terminate(),
|
|
139
|
-
subscribe: (o,
|
|
140
|
-
const
|
|
141
|
-
return t.addEventListener("message",
|
|
142
|
-
t.removeEventListener("message",
|
|
144
|
+
subscribe: (o, s) => {
|
|
145
|
+
const a = (d) => o(d.data), n = (d) => s(d instanceof ErrorEvent ? new Error(d.message) : new Error("报表 Worker 消息无法解码"));
|
|
146
|
+
return t.addEventListener("message", a), t.addEventListener("error", n), t.addEventListener("messageerror", n), () => {
|
|
147
|
+
t.removeEventListener("message", a), t.removeEventListener("error", n), t.removeEventListener("messageerror", n);
|
|
143
148
|
};
|
|
144
149
|
}
|
|
145
150
|
};
|
|
146
151
|
}, r);
|
|
147
152
|
}
|
|
148
|
-
function
|
|
153
|
+
function Q(e, r = globalThis) {
|
|
149
154
|
const t = (o) => {
|
|
150
|
-
|
|
155
|
+
_(o.data) && $(e, o.data, (s) => r.postMessage({ protocol: u, id: o.data.id, type: "event", event: s })).then((s) => r.postMessage(s, D(s)));
|
|
151
156
|
};
|
|
152
157
|
return r.addEventListener("message", t), () => r.removeEventListener("message", t);
|
|
153
158
|
}
|
|
154
159
|
export {
|
|
155
160
|
R as ReportWorkerError,
|
|
156
|
-
|
|
157
|
-
|
|
161
|
+
J as createBrowserReportExecutor,
|
|
162
|
+
Q as serveReportWorker
|
|
158
163
|
};
|