@agile-team/mach-report 2.14.0 → 2.16.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.
Files changed (282) hide show
  1. package/README.md +26 -16
  2. package/THIRD_PARTY_NOTICES.md +3 -1
  3. package/dist/{ExcelBindingWizard-CLT2p7P3.cjs → ExcelBindingWizard-CP6h2x1f.cjs} +1 -1
  4. package/dist/{ExcelBindingWizard-CvsWR8Ga.js → ExcelBindingWizard-HhB3hAJE.js} +3 -3
  5. package/dist/ParamEditor-CUQLgoxa.cjs +1 -0
  6. package/dist/ParamEditor-OKesP_nO.js +594 -0
  7. package/dist/{ReportBatchPanel-DkxTzBkD.cjs → ReportBatchPanel-cZCAMAwH.cjs} +1 -1
  8. package/dist/{ReportBatchPanel-LqVgiqp7.js → ReportBatchPanel-ruxcbfY6.js} +39 -39
  9. package/dist/ReportPreview-BcDKCLiK.js +4834 -0
  10. package/dist/ReportPreview-Bk9nLfO9.cjs +6 -0
  11. package/dist/{ReportTemplateLibrary-cQ1sqNYo.cjs → ReportTemplateLibrary-BDlNT8JN.cjs} +1 -1
  12. package/dist/{ReportTemplateLibrary-MjWEtc7X.js → ReportTemplateLibrary-DcwrH-63.js} +1 -1
  13. package/dist/{RuleEditor-BaR6xUiI.cjs → RuleEditor-BX5S8RSF.cjs} +1 -1
  14. package/dist/{RuleEditor-ChuXMlei.js → RuleEditor-CGl9XY2s.js} +5 -5
  15. package/dist/{TemplateOutlinePanel-BHKP89Xz.cjs → TemplateOutlinePanel-CGrT5DFN.cjs} +1 -1
  16. package/dist/{TemplateOutlinePanel-Dci6aRn1.js → TemplateOutlinePanel-SXCjaPKR.js} +2 -2
  17. package/dist/{TemplateReusePanel-CY5eO2Sh.cjs → TemplateReusePanel-6Z3wRFz8.cjs} +1 -1
  18. package/dist/{TemplateReusePanel-B7Gmyc1z.js → TemplateReusePanel-lHLOS9Wn.js} +2 -2
  19. package/dist/{TemplateReviewPanel-DjlX3xpt.js → TemplateReviewPanel-CJ9PLc48.js} +2 -2
  20. package/dist/{TemplateReviewPanel-JvZe9_4G.cjs → TemplateReviewPanel-Dpk7sLcF.cjs} +1 -1
  21. package/dist/analytics.cjs +1 -1
  22. package/dist/analytics.d.cts +5 -1
  23. package/dist/analytics.d.ts +5 -1
  24. package/dist/analytics.js +154 -60
  25. package/dist/artifact-integrity.json +143 -0
  26. package/dist/assets-CqIbfbTr.js +126 -0
  27. package/dist/assets-e4YSke8n.cjs +1 -0
  28. package/dist/auto-YR7a4BtF.js +240 -0
  29. package/dist/auto-uVBjX1j5.cjs +1 -0
  30. package/dist/batch-WzDIXJAt.js +220 -0
  31. package/dist/batch-z6Aw5GEY.cjs +1 -0
  32. package/dist/capabilities-DDwXr_cA.js +103 -0
  33. package/dist/capabilities-DNLyZdNw.cjs +1 -0
  34. package/dist/codes.d.cts +4 -0
  35. package/dist/codes.d.ts +4 -0
  36. package/dist/component-tree-Ca6YYfHq.js +61 -0
  37. package/dist/component-tree-DkGLEfZC.cjs +1 -0
  38. package/dist/{computed-Bvk0W15F.js → computed-C-4C2S5h.js} +3 -3
  39. package/dist/config-Dg_o8e7m.cjs +1 -0
  40. package/dist/config-XQ4qrQ7Q.js +844 -0
  41. package/dist/designer-BfQSahxq.js +5163 -0
  42. package/dist/designer-CPPdeM5_.cjs +2 -0
  43. package/dist/designer.cjs +1 -1
  44. package/dist/designer.d.cts +197 -16
  45. package/dist/designer.d.ts +197 -16
  46. package/dist/designer.js +1 -1
  47. package/dist/diagnostic-notification-B9K9We3h.cjs +1 -0
  48. package/dist/diagnostic-notification-qGAYZdkB.js +7 -0
  49. package/dist/drill-CsdjgkRM.cjs +1 -0
  50. package/dist/drill-DIGsZfyB.js +145 -0
  51. package/dist/encoding-BOGq4qYL.js +21 -0
  52. package/dist/encoding-BYF9ZTl9.cjs +1 -0
  53. package/dist/{font-loader-DHto6Lra.js → font-loader-CzI1GuBc.js} +1 -1
  54. package/dist/{font-loader-vhCT8znW.cjs → font-loader-EKLzOJxf.cjs} +1 -1
  55. package/dist/index.cjs +8 -9
  56. package/dist/index.d.cts +84 -4
  57. package/dist/index.d.ts +84 -4
  58. package/dist/index.js +829 -833
  59. package/dist/json-snapshot-D6ioHth9.js +1702 -0
  60. package/dist/json-snapshot-DknkjvxP.cjs +2 -0
  61. package/dist/licenses/_bwip-js_generic-4.11.4.txt +24 -0
  62. package/dist/licenses/_fast-csv_format-4.3.5.txt +22 -0
  63. package/dist/licenses/_fast-csv_parse-4.3.6.txt +22 -0
  64. package/dist/licenses/_pdf-lib_fontkit-1.1.1.txt +326 -0
  65. package/dist/licenses/_pdf-lib_standard-fonts-1.0.0.txt +22 -0
  66. package/dist/licenses/_pdf-lib_upng-1.0.1.txt +22 -0
  67. package/dist/licenses/_types_node-14.18.63.txt +22 -0
  68. package/dist/licenses/_types_pako-2.0.3.txt +22 -0
  69. package/dist/licenses/_types_pegjs-0.10.6.txt +22 -0
  70. package/dist/licenses/archiver-5.3.2.txt +23 -0
  71. package/dist/licenses/archiver-utils-2.1.0.txt +23 -0
  72. package/dist/licenses/archiver-utils-3.0.4.txt +23 -0
  73. package/dist/licenses/async-3.2.6.txt +20 -0
  74. package/dist/licenses/balanced-match-1.0.2.txt +22 -0
  75. package/dist/licenses/base64-js-1.5.1.txt +22 -0
  76. package/dist/licenses/big-integer-1.6.52.txt +25 -0
  77. package/dist/licenses/binary-0.3.0.txt +178 -0
  78. package/dist/licenses/bl-4.1.0.txt +14 -0
  79. package/dist/licenses/bluebird-3.4.7.txt +22 -0
  80. package/dist/licenses/brace-expansion-1.1.21.txt +22 -0
  81. package/dist/licenses/brace-expansion-2.1.7.txt +22 -0
  82. package/dist/licenses/buffer-5.7.1.txt +22 -0
  83. package/dist/licenses/buffer-crc32-0.2.13.txt +20 -0
  84. package/dist/licenses/buffer-indexof-polyfill-1.0.2.txt +23 -0
  85. package/dist/licenses/buffers-0.1.1.txt +140 -0
  86. package/dist/licenses/chainsaw-0.1.0.txt +184 -0
  87. package/dist/licenses/compress-commons-4.1.2.txt +23 -0
  88. package/dist/licenses/concat-map-0.0.1.txt +19 -0
  89. package/dist/licenses/core-util-is-1.0.3.txt +20 -0
  90. package/dist/licenses/crc-32-1.2.2.txt +202 -0
  91. package/dist/licenses/crc32-stream-4.0.3.txt +23 -0
  92. package/dist/licenses/dayjs-1.11.23.txt +22 -0
  93. package/dist/licenses/duplexer2-0.1.4.txt +27 -0
  94. package/dist/licenses/end-of-stream-1.4.5.txt +22 -0
  95. package/dist/licenses/exceljs-4.4.0.txt +23 -0
  96. package/dist/licenses/fast-csv-4.3.6.txt +22 -0
  97. package/dist/licenses/fast-png-6.4.0.txt +22 -0
  98. package/dist/licenses/fs-constants-1.0.0.txt +22 -0
  99. package/dist/licenses/fs.realpath-1.0.0.txt +44 -0
  100. package/dist/licenses/fstream-1.0.12.txt +16 -0
  101. package/dist/licenses/glob-7.2.3.txt +22 -0
  102. package/dist/licenses/graceful-fs-4.2.11.txt +16 -0
  103. package/dist/licenses/ieee754-1.2.1.txt +12 -0
  104. package/dist/licenses/immediate-3.0.6.txt +21 -0
  105. package/dist/licenses/inflight-1.0.6.txt +16 -0
  106. package/dist/licenses/inherits-2.0.4.txt +17 -0
  107. package/dist/licenses/iobuffer-5.4.0.txt +23 -0
  108. package/dist/licenses/isarray-1.0.0.txt +61 -0
  109. package/dist/licenses/jszip-3.10.2.txt +652 -0
  110. package/dist/licenses/lazystream-1.0.1.txt +24 -0
  111. package/dist/licenses/lie-3.3.0.txt +8 -0
  112. package/dist/licenses/listenercount-1.0.1.txt +6 -0
  113. package/dist/licenses/lodash.defaults-4.2.0.txt +48 -0
  114. package/dist/licenses/lodash.difference-4.5.0.txt +48 -0
  115. package/dist/licenses/lodash.escaperegexp-4.1.2.txt +48 -0
  116. package/dist/licenses/lodash.flatten-4.4.0.txt +48 -0
  117. package/dist/licenses/lodash.groupby-4.6.0.txt +48 -0
  118. package/dist/licenses/lodash.isboolean-3.0.3.txt +23 -0
  119. package/dist/licenses/lodash.isequal-4.5.0.txt +48 -0
  120. package/dist/licenses/lodash.isfunction-3.0.9.txt +48 -0
  121. package/dist/licenses/lodash.isnil-4.0.0.txt +23 -0
  122. package/dist/licenses/lodash.isplainobject-4.0.6.txt +48 -0
  123. package/dist/licenses/lodash.isundefined-3.0.1.txt +23 -0
  124. package/dist/licenses/lodash.union-4.6.0.txt +48 -0
  125. package/dist/licenses/lodash.uniq-4.5.0.txt +48 -0
  126. package/dist/licenses/minimatch-3.1.5.txt +16 -0
  127. package/dist/licenses/minimatch-5.1.9.txt +16 -0
  128. package/dist/licenses/minimist-1.2.8.txt +19 -0
  129. package/dist/licenses/mkdirp-0.5.6.txt +22 -0
  130. package/dist/licenses/node-sql-parser-5.4.0.txt +202 -0
  131. package/dist/licenses/normalize-path-3.0.0.txt +22 -0
  132. package/dist/licenses/once-1.4.0.txt +16 -0
  133. package/dist/licenses/pako-1.0.11.txt +22 -0
  134. package/dist/licenses/pako-2.2.0.txt +22 -0
  135. package/dist/licenses/path-is-absolute-1.0.1.txt +22 -0
  136. package/dist/licenses/pdf-lib-1.17.1.txt +22 -0
  137. package/dist/licenses/process-nextick-args-2.0.1.txt +20 -0
  138. package/dist/licenses/readable-stream-2.3.8.txt +48 -0
  139. package/dist/licenses/readable-stream-3.6.2.txt +48 -0
  140. package/dist/licenses/readdir-glob-1.1.3.txt +202 -0
  141. package/dist/licenses/rimraf-2.7.1.txt +16 -0
  142. package/dist/licenses/safe-buffer-5.1.2.txt +22 -0
  143. package/dist/licenses/safe-buffer-5.2.1.txt +22 -0
  144. package/dist/licenses/saxes-5.0.1.txt +397 -0
  145. package/dist/licenses/setimmediate-1.0.5.txt +21 -0
  146. package/dist/licenses/string_decoder-1.1.1.txt +49 -0
  147. package/dist/licenses/string_decoder-1.3.0.txt +49 -0
  148. package/dist/licenses/tar-stream-2.2.0.txt +22 -0
  149. package/dist/licenses/tmp-0.2.7.txt +22 -0
  150. package/dist/licenses/traverse-0.3.9.txt +25 -0
  151. package/dist/licenses/tslib-1.14.1.txt +13 -0
  152. package/dist/licenses/unzipper-0.10.14.txt +26 -0
  153. package/dist/licenses/util-deprecate-1.0.2.txt +25 -0
  154. package/dist/licenses/uuid-11.1.1.txt +10 -0
  155. package/dist/licenses/wrappy-1.0.2.txt +16 -0
  156. package/dist/licenses/xmlchars-2.2.0.txt +19 -0
  157. package/dist/licenses/zip-stream-4.1.1.txt +23 -0
  158. package/dist/matrix-CGRGkn5s.js +112 -0
  159. package/dist/matrix-gEO7ZM_u.cjs +1 -0
  160. package/dist/media-B7vnpD8k.cjs +1 -0
  161. package/dist/media-Y90dHK9z.js +70 -0
  162. package/dist/param-validation-C3HlcLLO.cjs +1 -0
  163. package/dist/param-validation-Do7Eg8Zv.js +181 -0
  164. package/dist/{pdf-AyJGb22z.cjs → pdf-ByVCb1i6.cjs} +49 -49
  165. package/dist/{pdf-8UPQebOE.js → pdf-DJ5S6ukC.js} +4924 -4872
  166. package/dist/pdf.cjs +1 -1
  167. package/dist/pdf.d.cts +20 -3
  168. package/dist/pdf.d.ts +20 -3
  169. package/dist/pdf.js +2 -2
  170. package/dist/{plugin-BGKf-Tqg.js → plugin-C2j5_mhx.js} +2 -2
  171. package/dist/{plugin-CktLH_Iy.cjs → plugin-Dr39GBRG.cjs} +1 -1
  172. package/dist/prepared-DdrjLC7L.cjs +1 -0
  173. package/dist/prepared-DqtpvRTn.js +87 -0
  174. package/dist/progress-B0ctFpKf.cjs +1 -0
  175. package/dist/progress-BXzlVbIp.js +29 -0
  176. package/dist/progress-DJBd9Rb9.cjs +1 -0
  177. package/dist/progress-Hc2vxoCs.js +52 -0
  178. package/dist/protocol-BzwMP4Vw.cjs +1 -0
  179. package/dist/protocol-kt4Iy6-3.js +90 -0
  180. package/dist/record-bindings-CZWBJ1fU.js +195 -0
  181. package/dist/record-bindings-DUX1VMlR.cjs +1 -0
  182. package/dist/{region-binding-workflow-DEJbhpCv.js → region-binding-workflow-CWNvIjkV.js} +1 -1
  183. package/dist/{region-binding-workflow-BzfbxRiR.cjs → region-binding-workflow-CqSMxQ4p.cjs} +1 -1
  184. package/dist/report-encoding-worker.cjs +1 -0
  185. package/dist/report-encoding-worker.d.ts +1 -0
  186. package/dist/report-encoding-worker.js +2 -0
  187. package/dist/{report-params-B44imUd4.js → report-params-B1RzkhJj.js} +1 -1
  188. package/dist/{report-params-SJfhKgaX.cjs → report-params-WDGrA4oP.cjs} +1 -1
  189. package/dist/rich-text-layout-ALlMoYOG.cjs +3 -0
  190. package/dist/rich-text-layout-Ct5WrY1g.js +102 -0
  191. package/dist/runtime-BjKBI530.js +168 -0
  192. package/dist/runtime-CBFEPKEs.cjs +1 -0
  193. package/dist/sbom.cdx.json +3982 -0
  194. package/dist/server/node.d.cts +106 -2
  195. package/dist/server/node.d.ts +106 -2
  196. package/dist/server-node.cjs +5 -1
  197. package/dist/server-node.js +4634 -539
  198. package/dist/server.cjs +1 -1
  199. package/dist/server.d.cts +780 -5
  200. package/dist/server.d.ts +780 -5
  201. package/dist/server.js +773 -691
  202. package/dist/sha256-BshdOkCC.cjs +1 -0
  203. package/dist/sha256-DTG-Gq8i.js +157 -0
  204. package/dist/style-67OqfNed.js +73 -0
  205. package/dist/style-C22Pbv3T.cjs +1 -0
  206. package/dist/style.css +1 -1
  207. package/dist/template-bindings-C2SpvsMU.js +58 -0
  208. package/dist/template-bindings-CEtWyiLX.cjs +1 -0
  209. package/dist/template-catalog-BtR2JmCL.js +414 -0
  210. package/dist/template-catalog-C2NLdrwB.cjs +1 -0
  211. package/dist/{template-fragments-DFUpq5QM.cjs → template-fragments-BVsbxs4a.cjs} +1 -1
  212. package/dist/{template-fragments-CLkGo6To.js → template-fragments-By0aZC1D.js} +21 -21
  213. package/dist/{template-outline-B3xVkzSv.cjs → template-outline-BwRV_eRo.cjs} +1 -1
  214. package/dist/{template-outline-CFenM1PV.js → template-outline-cnWfT_LK.js} +3 -3
  215. package/dist/template-registry-C62vpv4a.cjs +1 -0
  216. package/dist/template-registry-Cw3vRTX2.js +801 -0
  217. package/dist/textwrap-BEIg2w8y.js +110 -0
  218. package/dist/textwrap-BI-yJ6Wt.cjs +4 -0
  219. package/dist/{tree-CqcQ99NM.js → tree-CjVZLRw7.js} +1 -1
  220. package/dist/vue/async.d.cts +189 -14
  221. package/dist/vue/async.d.ts +189 -14
  222. package/dist/vue/index.d.cts +246 -22
  223. package/dist/vue/index.d.ts +246 -22
  224. package/dist/vue-async.cjs +1 -1
  225. package/dist/vue-async.js +3 -3
  226. package/dist/vue.cjs +1 -1
  227. package/dist/vue.js +80 -78
  228. package/dist/{workbook-session-BfK1yHOO.js → workbook-session-BeSO8PFB.js} +5460 -5295
  229. package/dist/{workbook-session-DNa2RHNG.cjs → workbook-session-Cbts-22R.cjs} +19 -19
  230. package/dist/worker.cjs +1 -1
  231. package/dist/worker.d.cts +104 -2
  232. package/dist/worker.d.ts +104 -2
  233. package/dist/worker.js +12 -156
  234. package/dist/xlsx-node.cjs +35 -35
  235. package/dist/xlsx-node.js +2138 -2137
  236. package/dist/xlsx.cjs +4 -4
  237. package/dist/xlsx.d.cts +24 -10
  238. package/dist/xlsx.d.ts +24 -10
  239. package/dist/xlsx.js +303 -277
  240. package/package.json +7 -4
  241. package/dist/ParamEditor-CflQV3eQ.js +0 -526
  242. package/dist/ParamEditor-vIDzvpPV.cjs +0 -1
  243. package/dist/ReportPreview-CvbqLUzM.cjs +0 -6
  244. package/dist/ReportPreview-D_ywJ_-H.js +0 -4533
  245. package/dist/assets-C2U-e-Sz.cjs +0 -4
  246. package/dist/assets-Q0wUwNrV.js +0 -217
  247. package/dist/batch-DzaTNLWI.js +0 -371
  248. package/dist/batch-xMkqYiTr.cjs +0 -1
  249. package/dist/capabilities-CK_7hizc.js +0 -63
  250. package/dist/capabilities-CsZ-pNHR.cjs +0 -1
  251. package/dist/config-0UIohTS7.cjs +0 -1
  252. package/dist/config-Dt9NtCPl.js +0 -566
  253. package/dist/data-explanation-BktvER5B.cjs +0 -1
  254. package/dist/data-explanation-C_J6jYNi.js +0 -16
  255. package/dist/defaults-DXhiM1ZD.js +0 -10
  256. package/dist/defaults-xhmcLLrf.cjs +0 -1
  257. package/dist/designer-Ci1LizA9.js +0 -5020
  258. package/dist/designer-rtmVIIdN.cjs +0 -2
  259. package/dist/grid-strokes-Cr7DwUux.cjs +0 -1
  260. package/dist/grid-strokes-DyyG1q_o.js +0 -53
  261. package/dist/json-snapshot-BeFT3Tso.js +0 -1952
  262. package/dist/json-snapshot-D1NTP2oI.cjs +0 -2
  263. package/dist/matrix-DVyWiYsd.cjs +0 -1
  264. package/dist/matrix-yZsGnldA.js +0 -227
  265. package/dist/page-window-index-CIuT4BAv.js +0 -43
  266. package/dist/page-window-index-DEjnM6IB.cjs +0 -1
  267. package/dist/param-validation-BlHHXs6u.js +0 -153
  268. package/dist/param-validation-DCK039V1.cjs +0 -1
  269. package/dist/progress-7OSZbFok.js +0 -39
  270. package/dist/progress-BnLiS5eH.cjs +0 -1
  271. package/dist/render-plan-7xpGrCEl.cjs +0 -1
  272. package/dist/render-plan-Ck6koX9L.js +0 -13
  273. package/dist/style-CQ1PK8ZB.js +0 -67
  274. package/dist/style-UgIJSA1F.cjs +0 -1
  275. package/dist/task-events-DQ276fn2.cjs +0 -1
  276. package/dist/task-events-Dpsvf_t2.js +0 -47
  277. package/dist/template-bindings-BJR4k7qZ.cjs +0 -1
  278. package/dist/template-bindings-Daui7hLF.js +0 -252
  279. package/dist/template-registry-COXDEJEM.js +0 -570
  280. package/dist/template-registry-D3SjENi6.cjs +0 -1
  281. package/dist/validate-BJ5HIWY8.cjs +0 -1
  282. package/dist/validate-CkQBWCeg.js +0 -163
package/dist/worker.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("./task-events-DQ276fn2.cjs"),P=require("./data-explanation-BktvER5B.cjs"),A=require("./validate-BJ5HIWY8.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 p(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function L(e){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}function T(e){return Array.isArray(e)&&e.every(r=>p(r)&&typeof r.code=="string"&&typeof r.message=="string"&&["info","warning","error"].includes(r.severity)&&P.hasValidDataExplanation(r))}function j(e){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"))}function O(e){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))}function S(e,r){if(!p(e)||!L(e.stats)||!T(e.diagnostics)||!j(e.revisions)||!O(e.layout))return!1;if(r==="prepare")return A.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 F(e){const r=x(e);if(!p(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 N(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(F)}:{}}}function v(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 z(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:N(o)}}}function _(e){const r=e.result;return!r||!("bytes"in r)||!(r.bytes.buffer instanceof ArrayBuffer)?[]:[r.bytes.buffer]}function $(e,r){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;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 q(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=()=>{},k;const f=(c,i)=>{y||(y=!0,k&&clearTimeout(k),E(),n?.removeEventListener("abort",h),Promise.resolve().then(()=>g.terminate()).then(()=>c===void 0?I(i):b(c),m=>b(c??m)))},h=()=>f(w(n?.reason)),W=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;$(m,a)?M.notifyReportTaskEvent(d,m,n):f(new Error("报表 Worker 返回无效阶段事件"));return}i.error&&typeof i.error.name=="string"&&typeof i.error.message=="string"?f(new l(i.error)):S(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 返回无效响应"))}};try{if(E=g.subscribe(W,c=>f(c??new Error("报表 Worker 执行失败"))),y){E();return}if(n?.addEventListener("abort",h,{once:!0}),k=setTimeout(()=>f(new l({name:"ReportRuntimeError",code:"timeout",message:`报表 Worker 执行超过 ${t}ms`})),t),n?.aborted)h();else{const{onEvent:c,signal:i,...m}=a;g.postMessage({protocol:u,id:R,operation:s,input:m})}}catch(c){f(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 C(e,r={}){return q(()=>{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 K(e,r=globalThis){const t=o=>{v(o.data)&&z(e,o.data,s=>r.postMessage({protocol:u,id:o.data.id,type:"event",event:s})).then(s=>r.postMessage(s,_(s)))};return r.addEventListener("message",t),()=>r.removeEventListener("message",t)}exports.ReportWorkerError=l;exports.createBrowserReportExecutor=C;exports.serveReportWorker=K;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./protocol-BzwMP4Vw.cjs"),s=require("./auto-uVBjX1j5.cjs"),R=require("./encoding-BYF9ZTl9.cjs");function p(n,e=globalThis){const a=t=>{r.isReportWorkerRequest(t.data)&&r.runReportWorkerRequest(n,t.data,o=>e.postMessage({protocol:r.REPORT_WORKER_PROTOCOL,id:t.data.id,type:"event",event:o})).then(o=>e.postMessage(o,r.reportWorkerTransferList(o)))};return e.addEventListener("message",a),()=>e.removeEventListener("message",a)}exports.ReportWorkerError=r.ReportWorkerError;exports.ReportWorkerStartError=s.ReportWorkerStartError;exports.createAutoReportExporter=s.createAutoReportExporter;exports.createBrowserReportExecutor=s.createBrowserReportExecutor;exports.serveReportEncodingWorker=R.serveReportEncodingWorker;exports.serveReportWorker=p;
package/dist/worker.d.cts CHANGED
@@ -77,10 +77,15 @@ declare interface ComponentStyle {
77
77
  rotateDeg?: number;
78
78
  }
79
79
 
80
+ /** Small exports stay local; large exports use the supplied bundler/CSP-compatible Worker factory. */
81
+ export declare function createAutoReportExporter(options?: ReportExportExecutionOptions): ReportAutoExporter;
82
+
80
83
  /** factory 每次返回全新 Worker,例如 () => new Worker(new URL('./worker.ts', import.meta.url), {type:'module'})。 */
81
84
  export declare function createBrowserReportExecutor(factory: () => BrowserReportWorker, options?: ReportWorkerOptions): ReportRuntimeExecutor;
82
85
 
83
86
  declare interface GridCell {
87
+ /** Styled cell content; text remains a plain-text fallback. Imported rich cells are read-only. */
88
+ richParagraphs?: RichParagraph[];
84
89
  text?: string;
85
90
  rawText?: string;
86
91
  /** 原始值,仅供 Excel raw 模式消费;不参与预览、分页与 PDF 绘制。 */
@@ -104,6 +109,19 @@ declare interface GridCell {
104
109
  style?: ComponentStyle;
105
110
  }
106
111
 
112
+ /** Bounded binary image inspection shared by PDF, Excel and template import. No decoder is loaded. */
113
+ declare interface ImageMediaOptions {
114
+ maxImageBytes?: number;
115
+ maxTotalImageBytes?: number;
116
+ maxImages?: number;
117
+ /** Decoded pixels per unique image, default 16 million. */
118
+ maxImagePixels?: number;
119
+ /** Total decoded pixels for unique media, default 64 million. */
120
+ maxTotalImagePixels?: number;
121
+ /** Maximum source dimension, default 16384 pixels. */
122
+ maxImageDimension?: number;
123
+ }
124
+
107
125
  declare interface PlanComponent {
108
126
  /** Optional QR/barcode encoding configuration; no encoder is loaded by the core. */
109
127
  code?: CodeOptions;
@@ -181,6 +199,8 @@ declare interface PreparedReport {
181
199
  revision?: string;
182
200
  sourceToken?: string;
183
201
  }>;
202
+ /** Ordered occurrences; legacy revisions remains last-value-by-ID for compatibility. */
203
+ sources?: ReportRuntimeSource[];
184
204
  /** Captured metrics identity; absence on old saved instances remains supported with diagnostics. */
185
205
  layout?: {
186
206
  textMetrics: "heuristic" | "provided" | "font-bytes";
@@ -195,8 +215,20 @@ declare interface RenderPlan {
195
215
  pages: PlanPage[];
196
216
  }
197
217
 
218
+ export declare interface ReportAutoExporter {
219
+ exportPrepared(input: ReportRuntimePreparedExportInput, localOverride?: ReportLocalExport): Promise<ReportAutoExportResult>;
220
+ cancel(): void;
221
+ dispose(): void;
222
+ }
223
+
224
+ export declare interface ReportAutoExportResult extends ReportRuntimeExportResult {
225
+ execution: ReportExportDecision;
226
+ }
227
+
198
228
  /** 可持久化的业务身份与计划坐标独立;权限及并发校验仍由业务服务器执行。 */
199
229
  declare interface ReportCellSource {
230
+ /** Source identity across report occurrences; sharing must be explicitly declared. */
231
+ sourceScope?: string;
200
232
  datasetId: string;
201
233
  rowKey: string | number;
202
234
  field: string;
@@ -210,6 +242,8 @@ declare interface ReportDataTarget {
210
242
  rowKey?: string | number;
211
243
  /** Use table identity when the same dataset appears in several tables. */
212
244
  tableId?: string;
245
+ /** Assigned by the source/runtime when several reports share dataset names. */
246
+ reportScope?: string;
213
247
  }
214
248
 
215
249
  declare interface ReportDescription {
@@ -235,6 +269,40 @@ declare interface ReportDiagnostic {
235
269
  target?: ReportDataTarget;
236
270
  }
237
271
 
272
+ export declare interface ReportExportDecision {
273
+ mode: "local" | "worker";
274
+ reason: ReportExportDecisionReason;
275
+ /** Lower bounds: traversal stops as soon as isolation is warranted. No font or image hashing. */
276
+ estimate: {
277
+ pages: number;
278
+ cells: number;
279
+ bytes: number;
280
+ };
281
+ hardCancellation: boolean;
282
+ }
283
+
284
+ export declare type ReportExportDecisionReason = "small-task" | "threshold" | "scan-limit" | "explicit-local" | "explicit-worker" | "worker-unavailable" | "worker-start-failed" | "nonserializable-options";
285
+
286
+ export declare interface ReportExportExecutionOptions {
287
+ mode?: "auto" | "worker" | "local";
288
+ /** A fresh bundler-managed module Worker for every call; never a shared worker. */
289
+ workerFactory?: () => BrowserReportWorker;
290
+ thresholds?: ReportExportThresholds;
291
+ /** Auto only. Startup unavailability may use local; encoding failures never retry. */
292
+ fallback?: "local" | "error";
293
+ timeoutMs?: number;
294
+ budget?: ReportRuntimeBudget;
295
+ onDecision?: (decision: ReportExportDecision) => void;
296
+ }
297
+
298
+ export declare interface ReportExportThresholds {
299
+ cells?: number;
300
+ pages?: number;
301
+ bytes?: number;
302
+ }
303
+
304
+ export declare type ReportLocalExport = (input: ReportRuntimePreparedExportInput) => Promise<ReportRuntimeExportResult>;
305
+
238
306
  /** 报表参数定义(声明式,模板自描述参数面:渲染组件据此生成查询面板) */
239
307
  declare interface ReportParamDef {
240
308
  /** 参数名(传入 params,与数据集 SQL #{field} 绑定对应) */
@@ -247,6 +315,10 @@ declare interface ReportParamDef {
247
315
  label: string;
248
316
  value: string;
249
317
  }>;
318
+ /** Opaque host-resolved source key. No URL, credentials or executable code is stored. */
319
+ optionsSource?: string;
320
+ /** Select dependencies must be declared parameters; changing a parent clears descendants. */
321
+ dependsOn?: string[];
250
322
  defaultValue?: string;
251
323
  required?: boolean;
252
324
  placeholder?: string;
@@ -264,7 +336,7 @@ declare interface ReportParamIssue {
264
336
  message: string;
265
337
  }
266
338
 
267
- declare type ReportParamIssueCode = "definition" | "required" | "type" | "option" | "minimum" | "maximum" | "minLength" | "maxLength";
339
+ declare type ReportParamIssueCode = "definition" | "required" | "type" | "option" | "dependency" | "minimum" | "maximum" | "minLength" | "maxLength";
268
340
 
269
341
  declare interface ReportParamValidation {
270
342
  ok: boolean;
@@ -295,6 +367,16 @@ declare interface ReportRuntime {
295
367
  exportPrepared(input: ReportRuntimePreparedExportInput): Promise<ReportRuntimeExportResult>;
296
368
  }
297
369
 
370
+ declare interface ReportRuntimeBudget {
371
+ maxRows?: number;
372
+ maxPages?: number;
373
+ maxCells?: number;
374
+ maxOutputBytes?: number;
375
+ /** Bound the plain JSON snapshot accepted by exportPrepared (default 64 MB). */
376
+ maxPreparedBytes?: number;
377
+ maxDurationMs?: number;
378
+ }
379
+
298
380
  /** 可用 worker_threads/进程/RPC 实现;接收可序列化请求,signal 由桥接层映射为取消消息。 */
299
381
  declare interface ReportRuntimeExecutor {
300
382
  /** Old custom executors may omit this; the runtime explicitly rejects unsupported prepared output. */
@@ -307,10 +389,11 @@ declare interface ReportRuntimeExportInput extends ReportRuntimeInput {
307
389
  format: "pdf" | "xlsx";
308
390
  /** strict 在编码前拒绝已识别的输出降级;默认保留诊断并继续。 */
309
391
  fidelity?: "warn" | "strict";
310
- xlsx?: {
392
+ xlsx?: ImageMediaOptions & {
311
393
  sheetMode?: "auto" | "pages" | "continuous";
312
394
  valueMode?: "text" | "raw";
313
395
  paperSize?: "auto" | "a3" | "a4" | "a5";
396
+ sheetName?: (sheetIndex: number) => string;
314
397
  };
315
398
  }
316
399
 
@@ -331,6 +414,8 @@ declare interface ReportRuntimeInput extends ReportTaskMonitoring {
331
414
  /** Encode an existing plan without querying providers or repaginating. */
332
415
  declare interface ReportRuntimePreparedExportInput extends ReportTaskMonitoring {
333
416
  prepared: PreparedReport;
417
+ /** verify checks font metric identity; preserve explicitly keeps existing geometry, with a diagnostic. Encoding fidelity is unchanged. */
418
+ layoutPolicy?: "verify" | "preserve";
334
419
  format: ReportRuntimeExportInput["format"];
335
420
  fidelity?: ReportRuntimeExportInput["fidelity"];
336
421
  pdf?: ReportPdfFontOptions;
@@ -338,6 +423,15 @@ declare interface ReportRuntimePreparedExportInput extends ReportTaskMonitoring
338
423
  signal?: AbortSignal;
339
424
  }
340
425
 
426
+ /** One query occurrence; repeated report IDs retain independent provenance. */
427
+ declare interface ReportRuntimeSource {
428
+ reportId: string;
429
+ reportIndex: number;
430
+ reportScope: string;
431
+ revision?: string;
432
+ sourceToken?: string;
433
+ }
434
+
341
435
  declare interface ReportRuntimeStats {
342
436
  rows: number;
343
437
  pages: number;
@@ -378,6 +472,7 @@ export declare class ReportWorkerError extends Error {
378
472
 
379
473
  export declare interface ReportWorkerOptions {
380
474
  timeoutMs?: number;
475
+ budget?: ReportRuntimeBudget;
381
476
  }
382
477
 
383
478
  export declare interface ReportWorkerScope {
@@ -386,6 +481,11 @@ export declare interface ReportWorkerScope {
386
481
  removeEventListener(type: "message", listener: (event: MessageEvent) => void): void;
387
482
  }
388
483
 
484
+ export declare class ReportWorkerStartError extends Error {
485
+ readonly cause: unknown;
486
+ constructor(cause: unknown);
487
+ }
488
+
389
489
  declare interface RichParagraph {
390
490
  segments: RichSegment[];
391
491
  align?: ComponentStyle["align"];
@@ -411,6 +511,8 @@ declare interface SerializedReportError {
411
511
  diagnostics?: unknown;
412
512
  }
413
513
 
514
+ export declare function serveReportEncodingWorker(scope?: ReportWorkerScope): () => void;
515
+
414
516
  /** 在 Worker 入口注册一次 runtime;返回函数可清理监听器,浏览器主线程无需引入 Node。 */
415
517
  export declare function serveReportWorker(runtime: ReportRuntime, scope?: ReportWorkerScope): () => void;
416
518
 
package/dist/worker.d.ts CHANGED
@@ -77,10 +77,15 @@ declare interface ComponentStyle {
77
77
  rotateDeg?: number;
78
78
  }
79
79
 
80
+ /** Small exports stay local; large exports use the supplied bundler/CSP-compatible Worker factory. */
81
+ export declare function createAutoReportExporter(options?: ReportExportExecutionOptions): ReportAutoExporter;
82
+
80
83
  /** factory 每次返回全新 Worker,例如 () => new Worker(new URL('./worker.ts', import.meta.url), {type:'module'})。 */
81
84
  export declare function createBrowserReportExecutor(factory: () => BrowserReportWorker, options?: ReportWorkerOptions): ReportRuntimeExecutor;
82
85
 
83
86
  declare interface GridCell {
87
+ /** Styled cell content; text remains a plain-text fallback. Imported rich cells are read-only. */
88
+ richParagraphs?: RichParagraph[];
84
89
  text?: string;
85
90
  rawText?: string;
86
91
  /** 原始值,仅供 Excel raw 模式消费;不参与预览、分页与 PDF 绘制。 */
@@ -104,6 +109,19 @@ declare interface GridCell {
104
109
  style?: ComponentStyle;
105
110
  }
106
111
 
112
+ /** Bounded binary image inspection shared by PDF, Excel and template import. No decoder is loaded. */
113
+ declare interface ImageMediaOptions {
114
+ maxImageBytes?: number;
115
+ maxTotalImageBytes?: number;
116
+ maxImages?: number;
117
+ /** Decoded pixels per unique image, default 16 million. */
118
+ maxImagePixels?: number;
119
+ /** Total decoded pixels for unique media, default 64 million. */
120
+ maxTotalImagePixels?: number;
121
+ /** Maximum source dimension, default 16384 pixels. */
122
+ maxImageDimension?: number;
123
+ }
124
+
107
125
  declare interface PlanComponent {
108
126
  /** Optional QR/barcode encoding configuration; no encoder is loaded by the core. */
109
127
  code?: CodeOptions;
@@ -181,6 +199,8 @@ declare interface PreparedReport {
181
199
  revision?: string;
182
200
  sourceToken?: string;
183
201
  }>;
202
+ /** Ordered occurrences; legacy revisions remains last-value-by-ID for compatibility. */
203
+ sources?: ReportRuntimeSource[];
184
204
  /** Captured metrics identity; absence on old saved instances remains supported with diagnostics. */
185
205
  layout?: {
186
206
  textMetrics: "heuristic" | "provided" | "font-bytes";
@@ -195,8 +215,20 @@ declare interface RenderPlan {
195
215
  pages: PlanPage[];
196
216
  }
197
217
 
218
+ export declare interface ReportAutoExporter {
219
+ exportPrepared(input: ReportRuntimePreparedExportInput, localOverride?: ReportLocalExport): Promise<ReportAutoExportResult>;
220
+ cancel(): void;
221
+ dispose(): void;
222
+ }
223
+
224
+ export declare interface ReportAutoExportResult extends ReportRuntimeExportResult {
225
+ execution: ReportExportDecision;
226
+ }
227
+
198
228
  /** 可持久化的业务身份与计划坐标独立;权限及并发校验仍由业务服务器执行。 */
199
229
  declare interface ReportCellSource {
230
+ /** Source identity across report occurrences; sharing must be explicitly declared. */
231
+ sourceScope?: string;
200
232
  datasetId: string;
201
233
  rowKey: string | number;
202
234
  field: string;
@@ -210,6 +242,8 @@ declare interface ReportDataTarget {
210
242
  rowKey?: string | number;
211
243
  /** Use table identity when the same dataset appears in several tables. */
212
244
  tableId?: string;
245
+ /** Assigned by the source/runtime when several reports share dataset names. */
246
+ reportScope?: string;
213
247
  }
214
248
 
215
249
  declare interface ReportDescription {
@@ -235,6 +269,40 @@ declare interface ReportDiagnostic {
235
269
  target?: ReportDataTarget;
236
270
  }
237
271
 
272
+ export declare interface ReportExportDecision {
273
+ mode: "local" | "worker";
274
+ reason: ReportExportDecisionReason;
275
+ /** Lower bounds: traversal stops as soon as isolation is warranted. No font or image hashing. */
276
+ estimate: {
277
+ pages: number;
278
+ cells: number;
279
+ bytes: number;
280
+ };
281
+ hardCancellation: boolean;
282
+ }
283
+
284
+ export declare type ReportExportDecisionReason = "small-task" | "threshold" | "scan-limit" | "explicit-local" | "explicit-worker" | "worker-unavailable" | "worker-start-failed" | "nonserializable-options";
285
+
286
+ export declare interface ReportExportExecutionOptions {
287
+ mode?: "auto" | "worker" | "local";
288
+ /** A fresh bundler-managed module Worker for every call; never a shared worker. */
289
+ workerFactory?: () => BrowserReportWorker;
290
+ thresholds?: ReportExportThresholds;
291
+ /** Auto only. Startup unavailability may use local; encoding failures never retry. */
292
+ fallback?: "local" | "error";
293
+ timeoutMs?: number;
294
+ budget?: ReportRuntimeBudget;
295
+ onDecision?: (decision: ReportExportDecision) => void;
296
+ }
297
+
298
+ export declare interface ReportExportThresholds {
299
+ cells?: number;
300
+ pages?: number;
301
+ bytes?: number;
302
+ }
303
+
304
+ export declare type ReportLocalExport = (input: ReportRuntimePreparedExportInput) => Promise<ReportRuntimeExportResult>;
305
+
238
306
  /** 报表参数定义(声明式,模板自描述参数面:渲染组件据此生成查询面板) */
239
307
  declare interface ReportParamDef {
240
308
  /** 参数名(传入 params,与数据集 SQL #{field} 绑定对应) */
@@ -247,6 +315,10 @@ declare interface ReportParamDef {
247
315
  label: string;
248
316
  value: string;
249
317
  }>;
318
+ /** Opaque host-resolved source key. No URL, credentials or executable code is stored. */
319
+ optionsSource?: string;
320
+ /** Select dependencies must be declared parameters; changing a parent clears descendants. */
321
+ dependsOn?: string[];
250
322
  defaultValue?: string;
251
323
  required?: boolean;
252
324
  placeholder?: string;
@@ -264,7 +336,7 @@ declare interface ReportParamIssue {
264
336
  message: string;
265
337
  }
266
338
 
267
- declare type ReportParamIssueCode = "definition" | "required" | "type" | "option" | "minimum" | "maximum" | "minLength" | "maxLength";
339
+ declare type ReportParamIssueCode = "definition" | "required" | "type" | "option" | "dependency" | "minimum" | "maximum" | "minLength" | "maxLength";
268
340
 
269
341
  declare interface ReportParamValidation {
270
342
  ok: boolean;
@@ -295,6 +367,16 @@ declare interface ReportRuntime {
295
367
  exportPrepared(input: ReportRuntimePreparedExportInput): Promise<ReportRuntimeExportResult>;
296
368
  }
297
369
 
370
+ declare interface ReportRuntimeBudget {
371
+ maxRows?: number;
372
+ maxPages?: number;
373
+ maxCells?: number;
374
+ maxOutputBytes?: number;
375
+ /** Bound the plain JSON snapshot accepted by exportPrepared (default 64 MB). */
376
+ maxPreparedBytes?: number;
377
+ maxDurationMs?: number;
378
+ }
379
+
298
380
  /** 可用 worker_threads/进程/RPC 实现;接收可序列化请求,signal 由桥接层映射为取消消息。 */
299
381
  declare interface ReportRuntimeExecutor {
300
382
  /** Old custom executors may omit this; the runtime explicitly rejects unsupported prepared output. */
@@ -307,10 +389,11 @@ declare interface ReportRuntimeExportInput extends ReportRuntimeInput {
307
389
  format: "pdf" | "xlsx";
308
390
  /** strict 在编码前拒绝已识别的输出降级;默认保留诊断并继续。 */
309
391
  fidelity?: "warn" | "strict";
310
- xlsx?: {
392
+ xlsx?: ImageMediaOptions & {
311
393
  sheetMode?: "auto" | "pages" | "continuous";
312
394
  valueMode?: "text" | "raw";
313
395
  paperSize?: "auto" | "a3" | "a4" | "a5";
396
+ sheetName?: (sheetIndex: number) => string;
314
397
  };
315
398
  }
316
399
 
@@ -331,6 +414,8 @@ declare interface ReportRuntimeInput extends ReportTaskMonitoring {
331
414
  /** Encode an existing plan without querying providers or repaginating. */
332
415
  declare interface ReportRuntimePreparedExportInput extends ReportTaskMonitoring {
333
416
  prepared: PreparedReport;
417
+ /** verify checks font metric identity; preserve explicitly keeps existing geometry, with a diagnostic. Encoding fidelity is unchanged. */
418
+ layoutPolicy?: "verify" | "preserve";
334
419
  format: ReportRuntimeExportInput["format"];
335
420
  fidelity?: ReportRuntimeExportInput["fidelity"];
336
421
  pdf?: ReportPdfFontOptions;
@@ -338,6 +423,15 @@ declare interface ReportRuntimePreparedExportInput extends ReportTaskMonitoring
338
423
  signal?: AbortSignal;
339
424
  }
340
425
 
426
+ /** One query occurrence; repeated report IDs retain independent provenance. */
427
+ declare interface ReportRuntimeSource {
428
+ reportId: string;
429
+ reportIndex: number;
430
+ reportScope: string;
431
+ revision?: string;
432
+ sourceToken?: string;
433
+ }
434
+
341
435
  declare interface ReportRuntimeStats {
342
436
  rows: number;
343
437
  pages: number;
@@ -378,6 +472,7 @@ export declare class ReportWorkerError extends Error {
378
472
 
379
473
  export declare interface ReportWorkerOptions {
380
474
  timeoutMs?: number;
475
+ budget?: ReportRuntimeBudget;
381
476
  }
382
477
 
383
478
  export declare interface ReportWorkerScope {
@@ -386,6 +481,11 @@ export declare interface ReportWorkerScope {
386
481
  removeEventListener(type: "message", listener: (event: MessageEvent) => void): void;
387
482
  }
388
483
 
484
+ export declare class ReportWorkerStartError extends Error {
485
+ readonly cause: unknown;
486
+ constructor(cause: unknown);
487
+ }
488
+
389
489
  declare interface RichParagraph {
390
490
  segments: RichSegment[];
391
491
  align?: ComponentStyle["align"];
@@ -411,6 +511,8 @@ declare interface SerializedReportError {
411
511
  diagnostics?: unknown;
412
512
  }
413
513
 
514
+ export declare function serveReportEncodingWorker(scope?: ReportWorkerScope): () => void;
515
+
414
516
  /** 在 Worker 入口注册一次 runtime;返回函数可清理监听器,浏览器主线程无需引入 Node。 */
415
517
  export declare function serveReportWorker(runtime: ReportRuntime, scope?: ReportWorkerScope): () => void;
416
518
 
package/dist/worker.js CHANGED
@@ -1,162 +1,18 @@
1
- import { n as P } from "./task-events-Dpsvf_t2.js";
2
- import { h as W } from "./data-explanation-C_J6jYNi.js";
3
- import { v as A } from "./validate-CkQBWCeg.js";
4
- const u = "mach-report-worker/1";
5
- class R extends Error {
6
- constructor(r) {
7
- super(r.message), this.name = r.name, this.code = r.code, this.path = r.path, this.issues = r.issues, this.diagnostics = r.diagnostics;
8
- }
9
- }
10
- function p(e) {
11
- return !!e && typeof e == "object" && !Array.isArray(e);
12
- }
13
- function L(e) {
14
- 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;
15
- }
16
- function T(e) {
17
- return Array.isArray(e) && e.every((r) => p(r) && typeof r.code == "string" && typeof r.message == "string" && ["info", "warning", "error"].includes(r.severity) && W(r));
18
- }
19
- function j(e) {
20
- 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"));
21
- }
22
- function O(e) {
23
- 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));
24
- }
25
- function F(e, r) {
26
- if (!p(e) || !L(e.stats) || !T(e.diagnostics) || !j(e.revisions) || !O(e.layout)) return !1;
27
- if (r === "prepare") return A(e.plan).ok;
28
- const t = e.format === "pdf" ? "application/pdf" : "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
29
- return e.bytes instanceof Uint8Array && (e.format === "pdf" || e.format === "xlsx") && e.contentType === t;
30
- }
31
- function x(e) {
32
- if (!e || typeof e != "object") return { message: String(e) };
33
- const r = {};
34
- for (const t of ["code", "path", "field", "message"]) {
35
- const o = e[t];
36
- typeof o == "string" && (r[t] = o);
37
- }
38
- return r;
39
- }
40
- function N(e) {
41
- const r = x(e);
42
- if (!p(e)) return r;
43
- for (const t of ["format", "severity", "kind", "nid"]) typeof e[t] == "string" && (r[t] = e[t]);
44
- for (const t of ["pageIndex", "componentIndex"]) Number.isSafeInteger(e[t]) && e[t] >= 0 && (r[t] = e[t]);
45
- return Array.isArray(e.componentPath) && e.componentPath.every((t) => Number.isSafeInteger(t) && t >= 0) && (r.componentPath = e.componentPath), r;
46
- }
47
- function S(e) {
48
- if (!(e instanceof Error)) return { name: "Error", message: String(e) };
49
- const r = e;
50
- return {
51
- name: e.name,
52
- message: e.message,
53
- ...typeof r.code == "string" ? { code: r.code } : {},
54
- ...typeof r.path == "string" ? { path: r.path } : {},
55
- ...Array.isArray(r.issues) ? { issues: r.issues.map(x) } : {},
56
- ...Array.isArray(r.diagnostics) ? { diagnostics: r.diagnostics.map(N) } : {}
57
- };
58
- }
59
- function z(e) {
60
- if (!e || typeof e != "object") return !1;
61
- const r = e;
62
- return r.protocol === u && typeof r.id == "string" && (r.operation === "prepare" || r.operation === "export" || r.operation === "exportPrepared") && !!r.input && typeof r.input == "object";
63
- }
64
- async function _(e, r, t) {
65
- try {
66
- 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 });
67
- return { protocol: u, id: r.id, result: o };
68
- } catch (o) {
69
- return { protocol: u, id: r.id, error: S(o) };
70
- }
71
- }
72
- function $(e) {
73
- const r = e.result;
74
- return !r || !("bytes" in r) || !(r.bytes.buffer instanceof ArrayBuffer) ? [] : [r.bytes.buffer];
75
- }
76
- function D(e, r) {
77
- 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;
78
- for (const t of ["completed", "total"]) if (e[t] !== void 0 && (typeof e[t] != "number" || !Number.isFinite(e[t]) || e[t] < 0)) return !1;
79
- return e.completed === void 0 || e.total === void 0 || e.completed <= e.total;
80
- }
81
- let v = 0;
82
- function w(e) {
83
- const r = new Error("报表 Worker 任务已取消");
84
- return r.name = "AbortError", Object.defineProperty(r, "cause", { value: e }), r;
85
- }
86
- function B(e, r) {
87
- if (!e || typeof e != "object") return;
88
- const t = e;
89
- return t.protocol === u && t.id === r ? t : void 0;
90
- }
91
- function C(e, r = {}) {
92
- const t = r.timeoutMs ?? 12e4;
93
- if (!Number.isFinite(t) || t <= 0 || t > 2147483647) throw new RangeError("Worker timeoutMs 应为正有限数字,且不能超过 2147483647");
94
- const o = (s, a, n, d) => n?.aborted ? Promise.reject(w(n.reason)) : new Promise((I, b) => {
95
- let g;
96
- try {
97
- g = e();
98
- } catch (c) {
99
- b(c);
100
- return;
101
- }
102
- const l = `mach-report-${Date.now()}-${++v}`;
103
- let y = !1, E = () => {
104
- }, h;
105
- const f = (c, i) => {
106
- y || (y = !0, h && clearTimeout(h), E(), n?.removeEventListener("abort", k), Promise.resolve().then(() => g.terminate()).then(
107
- () => c === void 0 ? I(i) : b(c),
108
- (m) => b(c ?? m)
109
- ));
110
- }, k = () => f(w(n?.reason)), M = (c) => {
111
- const i = B(c, l);
112
- if (!(!i || y)) {
113
- if ("type" in i && i.type === "event") {
114
- const m = "event" in i ? i.event : void 0;
115
- D(m, a) ? P(d, m, n) : f(new Error("报表 Worker 返回无效阶段事件"));
116
- return;
117
- }
118
- i.error && typeof i.error.name == "string" && typeof i.error.message == "string" ? f(new R(i.error)) : F(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 返回无效响应"));
119
- }
120
- };
121
- try {
122
- if (E = g.subscribe(M, (c) => f(c ?? new Error("报表 Worker 执行失败"))), y) {
123
- E();
124
- return;
125
- }
126
- if (n?.addEventListener("abort", k, { once: !0 }), h = setTimeout(() => f(new R({ name: "ReportRuntimeError", code: "timeout", message: `报表 Worker 执行超过 ${t}ms` })), t), n?.aborted) k();
127
- else {
128
- const { onEvent: c, signal: i, ...m } = a;
129
- g.postMessage({ protocol: u, id: l, operation: s, input: m });
130
- }
131
- } catch (c) {
132
- f(c);
133
- }
134
- });
135
- 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) };
136
- }
137
- function G(e, r = {}) {
138
- return C(() => {
139
- const t = e();
140
- return {
141
- postMessage: (o) => t.postMessage(o),
142
- terminate: () => t.terminate(),
143
- subscribe: (o, s) => {
144
- const a = (d) => o(d.data), n = (d) => s(d instanceof ErrorEvent ? new Error(d.message) : new Error("报表 Worker 消息无法解码"));
145
- return t.addEventListener("message", a), t.addEventListener("error", n), t.addEventListener("messageerror", n), () => {
146
- t.removeEventListener("message", a), t.removeEventListener("error", n), t.removeEventListener("messageerror", n);
147
- };
148
- }
149
- };
150
- }, r);
151
- }
152
- function H(e, r = globalThis) {
1
+ import { i as a, r as R, R as p, a as n } from "./protocol-kt4Iy6-3.js";
2
+ import { b as W } from "./protocol-kt4Iy6-3.js";
3
+ import { R as g, c as k, a as u } from "./auto-YR7a4BtF.js";
4
+ import { s as x } from "./encoding-BOGq4qYL.js";
5
+ function d(s, r = globalThis) {
153
6
  const t = (o) => {
154
- z(o.data) && _(e, o.data, (s) => r.postMessage({ protocol: u, id: o.data.id, type: "event", event: s })).then((s) => r.postMessage(s, $(s)));
7
+ a(o.data) && R(s, o.data, (e) => r.postMessage({ protocol: p, id: o.data.id, type: "event", event: e })).then((e) => r.postMessage(e, n(e)));
155
8
  };
156
9
  return r.addEventListener("message", t), () => r.removeEventListener("message", t);
157
10
  }
158
11
  export {
159
- R as ReportWorkerError,
160
- G as createBrowserReportExecutor,
161
- H as serveReportWorker
12
+ W as ReportWorkerError,
13
+ g as ReportWorkerStartError,
14
+ k as createAutoReportExporter,
15
+ u as createBrowserReportExecutor,
16
+ x as serveReportEncodingWorker,
17
+ d as serveReportWorker
162
18
  };