@agile-team/mach-report 2.15.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.
- package/README.md +14 -9
- package/dist/{ExcelBindingWizard-Bs43BGNp.cjs → ExcelBindingWizard-CP6h2x1f.cjs} +1 -1
- package/dist/{ExcelBindingWizard-BKH1nGNS.js → ExcelBindingWizard-HhB3hAJE.js} +3 -3
- package/dist/{ParamEditor-Da4akw6V.cjs → ParamEditor-CUQLgoxa.cjs} +1 -1
- package/dist/{ParamEditor-DoAhzJsm.js → ParamEditor-OKesP_nO.js} +1 -1
- package/dist/{ReportBatchPanel-wP9m9Pj1.cjs → ReportBatchPanel-cZCAMAwH.cjs} +1 -1
- package/dist/{ReportBatchPanel-BMf6boMA.js → ReportBatchPanel-ruxcbfY6.js} +3 -3
- package/dist/ReportPreview-BcDKCLiK.js +4834 -0
- package/dist/ReportPreview-Bk9nLfO9.cjs +6 -0
- package/dist/{ReportTemplateLibrary-Sxr3eD0J.cjs → ReportTemplateLibrary-BDlNT8JN.cjs} +1 -1
- package/dist/{ReportTemplateLibrary-C9wutIiT.js → ReportTemplateLibrary-DcwrH-63.js} +1 -1
- package/dist/{RuleEditor-XhGHK8DE.cjs → RuleEditor-BX5S8RSF.cjs} +1 -1
- package/dist/{RuleEditor-C_Clasvd.js → RuleEditor-CGl9XY2s.js} +2 -2
- package/dist/{TemplateOutlinePanel-JTSR53vJ.cjs → TemplateOutlinePanel-CGrT5DFN.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-D6Bkny59.js → TemplateOutlinePanel-SXCjaPKR.js} +1 -1
- package/dist/{TemplateReusePanel-Kx35S0Ql.cjs → TemplateReusePanel-6Z3wRFz8.cjs} +1 -1
- package/dist/{TemplateReusePanel-rVuK1kTz.js → TemplateReusePanel-lHLOS9Wn.js} +2 -2
- package/dist/{TemplateReviewPanel-B0ar9_zf.js → TemplateReviewPanel-CJ9PLc48.js} +1 -1
- package/dist/{TemplateReviewPanel-Dn6X9UmY.cjs → TemplateReviewPanel-Dpk7sLcF.cjs} +1 -1
- package/dist/analytics.d.cts +2 -0
- package/dist/analytics.d.ts +2 -0
- package/dist/artifact-integrity.json +99 -91
- package/dist/{assets-DEaz4qsp.js → assets-CqIbfbTr.js} +24 -22
- package/dist/assets-e4YSke8n.cjs +1 -0
- package/dist/auto-YR7a4BtF.js +240 -0
- package/dist/auto-uVBjX1j5.cjs +1 -0
- package/dist/{batch-BfZHN1do.js → batch-WzDIXJAt.js} +1 -1
- package/dist/{batch-CLpELXBl.cjs → batch-z6Aw5GEY.cjs} +1 -1
- package/dist/capabilities-DDwXr_cA.js +103 -0
- package/dist/capabilities-DNLyZdNw.cjs +1 -0
- package/dist/codes.d.cts +2 -0
- package/dist/codes.d.ts +2 -0
- package/dist/component-tree-Ca6YYfHq.js +61 -0
- package/dist/component-tree-DkGLEfZC.cjs +1 -0
- package/dist/config-Dg_o8e7m.cjs +1 -0
- package/dist/{config-BVsJXSqS.js → config-XQ4qrQ7Q.js} +66 -64
- package/dist/designer-BfQSahxq.js +5163 -0
- package/dist/designer-CPPdeM5_.cjs +2 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +53 -0
- package/dist/designer.d.ts +53 -0
- package/dist/designer.js +1 -1
- package/dist/diagnostic-notification-B9K9We3h.cjs +1 -0
- package/dist/diagnostic-notification-qGAYZdkB.js +7 -0
- package/dist/drill-CsdjgkRM.cjs +1 -0
- package/dist/{drill-ByJviLXS.js → drill-DIGsZfyB.js} +11 -11
- package/dist/encoding-BOGq4qYL.js +21 -0
- package/dist/encoding-BYF9ZTl9.cjs +1 -0
- package/dist/{font-loader-Q3bQjmrI.js → font-loader-CzI1GuBc.js} +1 -1
- package/dist/{font-loader-B_UkxpzC.cjs → font-loader-EKLzOJxf.cjs} +1 -1
- package/dist/index.cjs +7 -8
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +865 -834
- package/dist/json-snapshot-D6ioHth9.js +1702 -0
- package/dist/json-snapshot-DknkjvxP.cjs +2 -0
- package/dist/{pdf-CvvrjPQg.cjs → pdf-ByVCb1i6.cjs} +48 -50
- package/dist/{pdf-BwNyeGpt.js → pdf-DJ5S6ukC.js} +2737 -2749
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.d.cts +2 -0
- package/dist/pdf.d.ts +2 -0
- package/dist/pdf.js +2 -2
- package/dist/{plugin-Ca_XZG3l.js → plugin-C2j5_mhx.js} +1 -1
- package/dist/{plugin-DHO7X8z2.cjs → plugin-Dr39GBRG.cjs} +1 -1
- package/dist/prepared-DdrjLC7L.cjs +1 -0
- package/dist/prepared-DqtpvRTn.js +87 -0
- package/dist/progress-BXzlVbIp.js +29 -0
- package/dist/progress-DJBd9Rb9.cjs +1 -0
- package/dist/{progress-D-OTpEav.js → progress-Hc2vxoCs.js} +2 -2
- package/dist/protocol-BzwMP4Vw.cjs +1 -0
- package/dist/protocol-kt4Iy6-3.js +90 -0
- package/dist/{record-bindings-Do_b3h4V.js → record-bindings-CZWBJ1fU.js} +9 -10
- package/dist/record-bindings-DUX1VMlR.cjs +1 -0
- package/dist/{region-binding-workflow-BMhK_TjP.js → region-binding-workflow-CWNvIjkV.js} +1 -1
- package/dist/{region-binding-workflow-DIYJdCUr.cjs → region-binding-workflow-CqSMxQ4p.cjs} +1 -1
- package/dist/report-encoding-worker.cjs +1 -0
- package/dist/report-encoding-worker.d.ts +1 -0
- package/dist/report-encoding-worker.js +2 -0
- package/dist/rich-text-layout-ALlMoYOG.cjs +3 -0
- package/dist/rich-text-layout-Ct5WrY1g.js +102 -0
- package/dist/runtime-BjKBI530.js +168 -0
- package/dist/runtime-CBFEPKEs.cjs +1 -0
- package/dist/sbom.cdx.json +2 -2
- package/dist/server/node.d.cts +86 -1
- package/dist/server/node.d.ts +86 -1
- package/dist/server-node.cjs +5 -1
- package/dist/server-node.js +4558 -473
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +8 -1
- package/dist/server.d.ts +8 -1
- package/dist/server.js +634 -792
- package/dist/sha256-BshdOkCC.cjs +1 -0
- package/dist/sha256-DTG-Gq8i.js +157 -0
- package/dist/style-67OqfNed.js +73 -0
- package/dist/style-C22Pbv3T.cjs +1 -0
- package/dist/style.css +1 -1
- package/dist/{template-catalog-j2B1MJlL.js → template-catalog-BtR2JmCL.js} +9 -9
- package/dist/{template-catalog-FJE_c9Qe.cjs → template-catalog-C2NLdrwB.cjs} +1 -1
- package/dist/{template-fragments-DcKeiylI.cjs → template-fragments-BVsbxs4a.cjs} +1 -1
- package/dist/{template-fragments-BGbQLGlV.js → template-fragments-By0aZC1D.js} +2 -2
- package/dist/template-registry-C62vpv4a.cjs +1 -0
- package/dist/{template-registry-BtaKPELV.js → template-registry-Cw3vRTX2.js} +389 -321
- package/dist/{textwrap-DE1kgcJB.js → textwrap-BEIg2w8y.js} +1 -1
- package/dist/textwrap-BI-yJ6Wt.cjs +4 -0
- package/dist/vue/async.d.cts +66 -0
- package/dist/vue/async.d.ts +66 -0
- package/dist/vue/index.d.cts +89 -1
- package/dist/vue/index.d.ts +89 -1
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +7 -7
- package/dist/{workbook-session-BvToI-Fd.js → workbook-session-BeSO8PFB.js} +153 -140
- package/dist/{workbook-session-Bjv1YCRK.cjs → workbook-session-Cbts-22R.cjs} +12 -12
- package/dist/worker.cjs +1 -1
- package/dist/worker.d.cts +84 -1
- package/dist/worker.d.ts +84 -1
- package/dist/worker.js +12 -157
- package/dist/xlsx-node.cjs +33 -33
- package/dist/xlsx-node.js +1282 -1289
- package/dist/xlsx.cjs +4 -3
- package/dist/xlsx.d.cts +2 -0
- package/dist/xlsx.d.ts +2 -0
- package/dist/xlsx.js +297 -279
- package/package.json +6 -3
- package/dist/ReportPreview-ChV19HBp.js +0 -4619
- package/dist/ReportPreview-DbLvvOUT.cjs +0 -6
- package/dist/assets-B9ImAi6_.cjs +0 -1
- package/dist/batch-BaP6pWDE.cjs +0 -1
- package/dist/batch-CGyt-b2W.js +0 -273
- package/dist/capabilities-CAh2Nrue.cjs +0 -1
- package/dist/capabilities-DskCHs3V.js +0 -69
- package/dist/config-D10us76d.cjs +0 -1
- package/dist/data-explanation-B8MZRYVS.js +0 -16
- package/dist/data-explanation-DE55G30w.cjs +0 -1
- package/dist/defaults-DXhiM1ZD.js +0 -10
- package/dist/defaults-xhmcLLrf.cjs +0 -1
- package/dist/designer-2bDlcNXQ.js +0 -5136
- package/dist/designer-BT7XCdbW.cjs +0 -2
- package/dist/drill-DYTxuL3A.cjs +0 -1
- package/dist/grid-strokes-Cr7DwUux.cjs +0 -1
- package/dist/grid-strokes-DyyG1q_o.js +0 -53
- package/dist/json-snapshot-DFb2eWkf.js +0 -1416
- package/dist/json-snapshot-WWSGlaHG.cjs +0 -2
- package/dist/prepared-CFy9B75C.cjs +0 -1
- package/dist/prepared-ajM-H-9B.js +0 -69
- package/dist/record-bindings-By_UKZ2g.cjs +0 -1
- package/dist/render-plan-7xpGrCEl.cjs +0 -1
- package/dist/render-plan-Ck6koX9L.js +0 -13
- package/dist/sha256-ArEYjaTI.cjs +0 -1
- package/dist/sha256-DPEuJ3nh.js +0 -155
- package/dist/style-CQ1PK8ZB.js +0 -67
- package/dist/style-UgIJSA1F.cjs +0 -1
- package/dist/template-registry-Co1zPq5e.cjs +0 -1
- package/dist/textwrap-CWHyzkBH.cjs +0 -4
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 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;
|
|
@@ -197,6 +215,16 @@ declare interface RenderPlan {
|
|
|
197
215
|
pages: PlanPage[];
|
|
198
216
|
}
|
|
199
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
|
+
|
|
200
228
|
/** 可持久化的业务身份与计划坐标独立;权限及并发校验仍由业务服务器执行。 */
|
|
201
229
|
declare interface ReportCellSource {
|
|
202
230
|
/** Source identity across report occurrences; sharing must be explicitly declared. */
|
|
@@ -241,6 +269,40 @@ declare interface ReportDiagnostic {
|
|
|
241
269
|
target?: ReportDataTarget;
|
|
242
270
|
}
|
|
243
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
|
+
|
|
244
306
|
/** 报表参数定义(声明式,模板自描述参数面:渲染组件据此生成查询面板) */
|
|
245
307
|
declare interface ReportParamDef {
|
|
246
308
|
/** 参数名(传入 params,与数据集 SQL #{field} 绑定对应) */
|
|
@@ -305,6 +367,16 @@ declare interface ReportRuntime {
|
|
|
305
367
|
exportPrepared(input: ReportRuntimePreparedExportInput): Promise<ReportRuntimeExportResult>;
|
|
306
368
|
}
|
|
307
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
|
+
|
|
308
380
|
/** 可用 worker_threads/进程/RPC 实现;接收可序列化请求,signal 由桥接层映射为取消消息。 */
|
|
309
381
|
declare interface ReportRuntimeExecutor {
|
|
310
382
|
/** Old custom executors may omit this; the runtime explicitly rejects unsupported prepared output. */
|
|
@@ -317,10 +389,11 @@ declare interface ReportRuntimeExportInput extends ReportRuntimeInput {
|
|
|
317
389
|
format: "pdf" | "xlsx";
|
|
318
390
|
/** strict 在编码前拒绝已识别的输出降级;默认保留诊断并继续。 */
|
|
319
391
|
fidelity?: "warn" | "strict";
|
|
320
|
-
xlsx?: {
|
|
392
|
+
xlsx?: ImageMediaOptions & {
|
|
321
393
|
sheetMode?: "auto" | "pages" | "continuous";
|
|
322
394
|
valueMode?: "text" | "raw";
|
|
323
395
|
paperSize?: "auto" | "a3" | "a4" | "a5";
|
|
396
|
+
sheetName?: (sheetIndex: number) => string;
|
|
324
397
|
};
|
|
325
398
|
}
|
|
326
399
|
|
|
@@ -341,6 +414,8 @@ declare interface ReportRuntimeInput extends ReportTaskMonitoring {
|
|
|
341
414
|
/** Encode an existing plan without querying providers or repaginating. */
|
|
342
415
|
declare interface ReportRuntimePreparedExportInput extends ReportTaskMonitoring {
|
|
343
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";
|
|
344
419
|
format: ReportRuntimeExportInput["format"];
|
|
345
420
|
fidelity?: ReportRuntimeExportInput["fidelity"];
|
|
346
421
|
pdf?: ReportPdfFontOptions;
|
|
@@ -397,6 +472,7 @@ export declare class ReportWorkerError extends Error {
|
|
|
397
472
|
|
|
398
473
|
export declare interface ReportWorkerOptions {
|
|
399
474
|
timeoutMs?: number;
|
|
475
|
+
budget?: ReportRuntimeBudget;
|
|
400
476
|
}
|
|
401
477
|
|
|
402
478
|
export declare interface ReportWorkerScope {
|
|
@@ -405,6 +481,11 @@ export declare interface ReportWorkerScope {
|
|
|
405
481
|
removeEventListener(type: "message", listener: (event: MessageEvent) => void): void;
|
|
406
482
|
}
|
|
407
483
|
|
|
484
|
+
export declare class ReportWorkerStartError extends Error {
|
|
485
|
+
readonly cause: unknown;
|
|
486
|
+
constructor(cause: unknown);
|
|
487
|
+
}
|
|
488
|
+
|
|
408
489
|
declare interface RichParagraph {
|
|
409
490
|
segments: RichSegment[];
|
|
410
491
|
align?: ComponentStyle["align"];
|
|
@@ -430,6 +511,8 @@ declare interface SerializedReportError {
|
|
|
430
511
|
diagnostics?: unknown;
|
|
431
512
|
}
|
|
432
513
|
|
|
514
|
+
export declare function serveReportEncodingWorker(scope?: ReportWorkerScope): () => void;
|
|
515
|
+
|
|
433
516
|
/** 在 Worker 入口注册一次 runtime;返回函数可清理监听器,浏览器主线程无需引入 Node。 */
|
|
434
517
|
export declare function serveReportWorker(runtime: ReportRuntime, scope?: ReportWorkerScope): () => void;
|
|
435
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;
|
|
@@ -197,6 +215,16 @@ declare interface RenderPlan {
|
|
|
197
215
|
pages: PlanPage[];
|
|
198
216
|
}
|
|
199
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
|
+
|
|
200
228
|
/** 可持久化的业务身份与计划坐标独立;权限及并发校验仍由业务服务器执行。 */
|
|
201
229
|
declare interface ReportCellSource {
|
|
202
230
|
/** Source identity across report occurrences; sharing must be explicitly declared. */
|
|
@@ -241,6 +269,40 @@ declare interface ReportDiagnostic {
|
|
|
241
269
|
target?: ReportDataTarget;
|
|
242
270
|
}
|
|
243
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
|
+
|
|
244
306
|
/** 报表参数定义(声明式,模板自描述参数面:渲染组件据此生成查询面板) */
|
|
245
307
|
declare interface ReportParamDef {
|
|
246
308
|
/** 参数名(传入 params,与数据集 SQL #{field} 绑定对应) */
|
|
@@ -305,6 +367,16 @@ declare interface ReportRuntime {
|
|
|
305
367
|
exportPrepared(input: ReportRuntimePreparedExportInput): Promise<ReportRuntimeExportResult>;
|
|
306
368
|
}
|
|
307
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
|
+
|
|
308
380
|
/** 可用 worker_threads/进程/RPC 实现;接收可序列化请求,signal 由桥接层映射为取消消息。 */
|
|
309
381
|
declare interface ReportRuntimeExecutor {
|
|
310
382
|
/** Old custom executors may omit this; the runtime explicitly rejects unsupported prepared output. */
|
|
@@ -317,10 +389,11 @@ declare interface ReportRuntimeExportInput extends ReportRuntimeInput {
|
|
|
317
389
|
format: "pdf" | "xlsx";
|
|
318
390
|
/** strict 在编码前拒绝已识别的输出降级;默认保留诊断并继续。 */
|
|
319
391
|
fidelity?: "warn" | "strict";
|
|
320
|
-
xlsx?: {
|
|
392
|
+
xlsx?: ImageMediaOptions & {
|
|
321
393
|
sheetMode?: "auto" | "pages" | "continuous";
|
|
322
394
|
valueMode?: "text" | "raw";
|
|
323
395
|
paperSize?: "auto" | "a3" | "a4" | "a5";
|
|
396
|
+
sheetName?: (sheetIndex: number) => string;
|
|
324
397
|
};
|
|
325
398
|
}
|
|
326
399
|
|
|
@@ -341,6 +414,8 @@ declare interface ReportRuntimeInput extends ReportTaskMonitoring {
|
|
|
341
414
|
/** Encode an existing plan without querying providers or repaginating. */
|
|
342
415
|
declare interface ReportRuntimePreparedExportInput extends ReportTaskMonitoring {
|
|
343
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";
|
|
344
419
|
format: ReportRuntimeExportInput["format"];
|
|
345
420
|
fidelity?: ReportRuntimeExportInput["fidelity"];
|
|
346
421
|
pdf?: ReportPdfFontOptions;
|
|
@@ -397,6 +472,7 @@ export declare class ReportWorkerError extends Error {
|
|
|
397
472
|
|
|
398
473
|
export declare interface ReportWorkerOptions {
|
|
399
474
|
timeoutMs?: number;
|
|
475
|
+
budget?: ReportRuntimeBudget;
|
|
400
476
|
}
|
|
401
477
|
|
|
402
478
|
export declare interface ReportWorkerScope {
|
|
@@ -405,6 +481,11 @@ export declare interface ReportWorkerScope {
|
|
|
405
481
|
removeEventListener(type: "message", listener: (event: MessageEvent) => void): void;
|
|
406
482
|
}
|
|
407
483
|
|
|
484
|
+
export declare class ReportWorkerStartError extends Error {
|
|
485
|
+
readonly cause: unknown;
|
|
486
|
+
constructor(cause: unknown);
|
|
487
|
+
}
|
|
488
|
+
|
|
408
489
|
declare interface RichParagraph {
|
|
409
490
|
segments: RichSegment[];
|
|
410
491
|
align?: ComponentStyle["align"];
|
|
@@ -430,6 +511,8 @@ declare interface SerializedReportError {
|
|
|
430
511
|
diagnostics?: unknown;
|
|
431
512
|
}
|
|
432
513
|
|
|
514
|
+
export declare function serveReportEncodingWorker(scope?: ReportWorkerScope): () => void;
|
|
515
|
+
|
|
433
516
|
/** 在 Worker 入口注册一次 runtime;返回函数可清理监听器,浏览器主线程无需引入 Node。 */
|
|
434
517
|
export declare function serveReportWorker(runtime: ReportRuntime, scope?: ReportWorkerScope): () => void;
|
|
435
518
|
|
package/dist/worker.js
CHANGED
|
@@ -1,163 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
class R extends Error {
|
|
7
|
-
constructor(r) {
|
|
8
|
-
super(r.message), this.name = r.name, this.code = r.code, this.path = r.path, this.issues = r.issues, this.diagnostics = r.diagnostics;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
function p(e) {
|
|
12
|
-
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
13
|
-
}
|
|
14
|
-
function T(e) {
|
|
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;
|
|
16
|
-
}
|
|
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));
|
|
19
|
-
}
|
|
20
|
-
function O(e) {
|
|
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"));
|
|
22
|
-
}
|
|
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;
|
|
29
|
-
const t = e.format === "pdf" ? "application/pdf" : "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
30
|
-
return e.bytes instanceof Uint8Array && (e.format === "pdf" || e.format === "xlsx") && e.contentType === t;
|
|
31
|
-
}
|
|
32
|
-
function x(e) {
|
|
33
|
-
if (!e || typeof e != "object") return { message: String(e) };
|
|
34
|
-
const r = {};
|
|
35
|
-
for (const t of ["code", "path", "field", "message"]) {
|
|
36
|
-
const o = e[t];
|
|
37
|
-
typeof o == "string" && (r[t] = o);
|
|
38
|
-
}
|
|
39
|
-
return r;
|
|
40
|
-
}
|
|
41
|
-
function S(e) {
|
|
42
|
-
const r = x(e);
|
|
43
|
-
if (!p(e)) return r;
|
|
44
|
-
for (const t of ["format", "severity", "kind", "nid"]) typeof e[t] == "string" && (r[t] = e[t]);
|
|
45
|
-
for (const t of ["pageIndex", "componentIndex"]) Number.isSafeInteger(e[t]) && e[t] >= 0 && (r[t] = e[t]);
|
|
46
|
-
return Array.isArray(e.componentPath) && e.componentPath.every((t) => Number.isSafeInteger(t) && t >= 0) && (r.componentPath = e.componentPath), r;
|
|
47
|
-
}
|
|
48
|
-
function z(e) {
|
|
49
|
-
if (!(e instanceof Error)) return { name: "Error", message: String(e) };
|
|
50
|
-
const r = e;
|
|
51
|
-
return {
|
|
52
|
-
name: e.name,
|
|
53
|
-
message: e.message,
|
|
54
|
-
...typeof r.code == "string" ? { code: r.code } : {},
|
|
55
|
-
...typeof r.path == "string" ? { path: r.path } : {},
|
|
56
|
-
...Array.isArray(r.issues) ? { issues: r.issues.map(x) } : {},
|
|
57
|
-
...Array.isArray(r.diagnostics) ? { diagnostics: r.diagnostics.map(S) } : {}
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
function _(e) {
|
|
61
|
-
if (!e || typeof e != "object") return !1;
|
|
62
|
-
const r = e;
|
|
63
|
-
return r.protocol === u && typeof r.id == "string" && (r.operation === "prepare" || r.operation === "export" || r.operation === "exportPrepared") && !!r.input && typeof r.input == "object";
|
|
64
|
-
}
|
|
65
|
-
async function $(e, r, t) {
|
|
66
|
-
try {
|
|
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 });
|
|
68
|
-
return { protocol: u, id: r.id, result: o };
|
|
69
|
-
} catch (o) {
|
|
70
|
-
return { protocol: u, id: r.id, error: z(o) };
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
function D(e) {
|
|
74
|
-
const r = e.result;
|
|
75
|
-
return !r || !("bytes" in r) || !(r.bytes.buffer instanceof ArrayBuffer) ? [] : [r.bytes.buffer];
|
|
76
|
-
}
|
|
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;
|
|
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;
|
|
80
|
-
return e.completed === void 0 || e.total === void 0 || e.completed <= e.total;
|
|
81
|
-
}
|
|
82
|
-
let v = 0;
|
|
83
|
-
function w(e) {
|
|
84
|
-
const r = new Error("报表 Worker 任务已取消");
|
|
85
|
-
return r.name = "AbortError", Object.defineProperty(r, "cause", { value: e }), r;
|
|
86
|
-
}
|
|
87
|
-
function C(e, r) {
|
|
88
|
-
if (!e || typeof e != "object") return;
|
|
89
|
-
const t = e;
|
|
90
|
-
return t.protocol === u && t.id === r ? t : void 0;
|
|
91
|
-
}
|
|
92
|
-
function K(e, r = {}) {
|
|
93
|
-
const t = r.timeoutMs ?? 12e4;
|
|
94
|
-
if (!Number.isFinite(t) || t <= 0 || t > 2147483647) throw new RangeError("Worker timeoutMs 应为正有限数字,且不能超过 2147483647");
|
|
95
|
-
const o = (s, a, n, d) => n?.aborted ? Promise.reject(w(n.reason)) : new Promise((I, b) => {
|
|
96
|
-
let g;
|
|
97
|
-
try {
|
|
98
|
-
g = e();
|
|
99
|
-
} catch (c) {
|
|
100
|
-
b(c);
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
const l = `mach-report-${Date.now()}-${++v}`;
|
|
104
|
-
let y = !1, E = () => {
|
|
105
|
-
}, h;
|
|
106
|
-
const f = (c, i) => {
|
|
107
|
-
y || (y = !0, h && clearTimeout(h), E(), n?.removeEventListener("abort", k), Promise.resolve().then(() => g.terminate()).then(
|
|
108
|
-
() => c === void 0 ? I(i) : b(c),
|
|
109
|
-
(m) => b(c ?? m)
|
|
110
|
-
));
|
|
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 返回无效阶段事件"));
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
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 返回无效响应"));
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
try {
|
|
123
|
-
if (E = g.subscribe(P, (c) => f(c ?? new Error("报表 Worker 执行失败"))), y) {
|
|
124
|
-
E();
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
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();
|
|
128
|
-
else {
|
|
129
|
-
const { onEvent: c, signal: i, ...m } = a;
|
|
130
|
-
g.postMessage({ protocol: u, id: l, operation: s, input: m });
|
|
131
|
-
}
|
|
132
|
-
} catch (c) {
|
|
133
|
-
f(c);
|
|
134
|
-
}
|
|
135
|
-
});
|
|
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) };
|
|
137
|
-
}
|
|
138
|
-
function J(e, r = {}) {
|
|
139
|
-
return K(() => {
|
|
140
|
-
const t = e();
|
|
141
|
-
return {
|
|
142
|
-
postMessage: (o) => t.postMessage(o),
|
|
143
|
-
terminate: () => t.terminate(),
|
|
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);
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
}, r);
|
|
152
|
-
}
|
|
153
|
-
function Q(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) {
|
|
154
6
|
const t = (o) => {
|
|
155
|
-
|
|
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)));
|
|
156
8
|
};
|
|
157
9
|
return r.addEventListener("message", t), () => r.removeEventListener("message", t);
|
|
158
10
|
}
|
|
159
11
|
export {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
12
|
+
W as ReportWorkerError,
|
|
13
|
+
g as ReportWorkerStartError,
|
|
14
|
+
k as createAutoReportExporter,
|
|
15
|
+
u as createBrowserReportExecutor,
|
|
16
|
+
x as serveReportEncodingWorker,
|
|
17
|
+
d as serveReportWorker
|
|
163
18
|
};
|