@agile-team/mach-report 2.10.0 → 2.11.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 +6 -2
- package/dist/ExcelBindingWizard-CjIiVox-.cjs +1 -0
- package/dist/ExcelBindingWizard-Dxm-K5HL.js +1240 -0
- package/dist/ParamEditor-D-Hf5xfO.cjs +1 -0
- package/dist/ParamEditor-DRGxzxeO.js +381 -0
- package/dist/ReportBatchPanel-BYgg0EDB.cjs +1 -0
- package/dist/ReportBatchPanel-Bby5yLzU.js +287 -0
- package/dist/ReportPreview-DWXROHBP.cjs +6 -0
- package/dist/ReportPreview-DiNXhQI0.js +4138 -0
- package/dist/ReportTemplateLibrary-C6CO7YCT.cjs +1 -0
- package/dist/ReportTemplateLibrary-DfzDXRvr.js +260 -0
- package/dist/RuleEditor-C2QsOHOs.cjs +1 -0
- package/dist/RuleEditor-D9wQHrkf.js +2024 -0
- package/dist/TemplateReviewPanel-BKofGrV9.js +222 -0
- package/dist/TemplateReviewPanel-DwtOcLue.cjs +1 -0
- package/dist/analytics.cjs +1 -1
- package/dist/analytics.d.cts +2 -0
- package/dist/analytics.d.ts +2 -0
- package/dist/analytics.js +29 -29
- package/dist/batch-Bt3Fd27Z.cjs +1 -0
- package/dist/batch-mRqhhhjt.js +364 -0
- package/dist/computed-Bvk0W15F.js +521 -0
- package/dist/computed-CGV2a809.cjs +1 -0
- package/dist/config-B612mw0x.js +525 -0
- package/dist/config-BRoLo2oj.cjs +1 -0
- package/dist/designer.cjs +2 -2
- package/dist/designer.d.cts +659 -9
- package/dist/designer.d.ts +659 -9
- package/dist/designer.js +2030 -1824
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +147 -3
- package/dist/index.d.ts +147 -3
- package/dist/index.js +639 -592
- package/dist/injection-keys-Db_DyLkm.cjs +1 -0
- package/dist/injection-keys-e85udZCp.js +7 -0
- package/dist/list-cell-BuYn4tGF.cjs +1 -0
- package/dist/{list-cell-Dxyi7DOw.js → list-cell-ClFra1zS.js} +54 -40
- package/dist/matrix-DVyWiYsd.cjs +1 -0
- package/dist/matrix-yZsGnldA.js +227 -0
- package/dist/param-validation-BlHHXs6u.js +153 -0
- package/dist/param-validation-DCK039V1.cjs +1 -0
- package/dist/pdf.cjs +25 -25
- package/dist/pdf.d.cts +3 -0
- package/dist/pdf.d.ts +3 -0
- package/dist/pdf.js +677 -677
- package/dist/plugin-BDTU4D94.cjs +1 -0
- package/dist/plugin-Cd5G2QQn.js +22 -0
- package/dist/region-binding-workflow-CXDmt9Bs.js +977 -0
- package/dist/region-binding-workflow-DhQvu1co.cjs +3 -0
- package/dist/{report-params-B_VCihAh.js → report-params-B44imUd4.js} +1 -1
- package/dist/{report-params-CjWrjPl6.cjs → report-params-SJfhKgaX.cjs} +1 -1
- package/dist/server/node.d.cts +5 -2
- package/dist/server/node.d.ts +5 -2
- package/dist/server-node.cjs +1 -1
- package/dist/server-node.js +87 -87
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +201 -2
- package/dist/server.d.ts +201 -2
- package/dist/server.js +557 -658
- package/dist/style.css +1 -1
- package/dist/template-registry-WNXdkiET.js +506 -0
- package/dist/template-registry-ukBGlm8N.cjs +1 -0
- package/dist/template-review-BXp2oyqg.cjs +1 -0
- package/dist/template-review-BdcXSYbx.js +1616 -0
- package/dist/tree-BX380Rr7.cjs +1 -0
- package/dist/tree-CqcQ99NM.js +172 -0
- package/dist/{validate-UUy9yP4K.js → validate-7s0yn6ii.js} +44 -44
- package/dist/validate-DsRiNw8h.cjs +1 -0
- package/dist/vue/async.d.cts +93 -4
- package/dist/vue/async.d.ts +93 -4
- package/dist/vue/index.d.cts +145 -7
- package/dist/vue/index.d.ts +145 -7
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +5 -5
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +116 -113
- package/dist/{workbook-session-B-bW5_yR.js → workbook-session-BKOTwcoq.js} +1 -1
- package/dist/{workbook-session-D7RtdNo0.cjs → workbook-session-CLYLhZWu.cjs} +1 -1
- package/dist/worker.cjs +1 -1
- package/dist/worker.d.cts +5 -2
- package/dist/worker.d.ts +5 -2
- package/dist/worker.js +1 -1
- package/dist/xlsx.cjs +3 -3
- package/dist/xlsx.d.cts +129 -2
- package/dist/xlsx.d.ts +129 -2
- package/dist/xlsx.js +336 -242
- package/package.json +1 -1
- package/dist/ExcelBindingWizard-CF7RplWm.cjs +0 -1
- package/dist/ExcelBindingWizard-qhwEderR.js +0 -842
- package/dist/ReportPreview-BE1tCHqE.js +0 -4604
- package/dist/ReportPreview-QKRKQOe3.cjs +0 -6
- package/dist/RuleEditor-BA36yIV6.js +0 -1723
- package/dist/RuleEditor-CczJ6mJm.cjs +0 -1
- package/dist/TemplateReviewPanel-CHi4Alqa.cjs +0 -1
- package/dist/TemplateReviewPanel-Dz0G5o83.js +0 -217
- package/dist/binding-preview-BWsdf_z2.cjs +0 -2
- package/dist/binding-preview-DILq0-0f.js +0 -649
- package/dist/decimal-CI1OAczk.js +0 -87
- package/dist/decimal-CQA0xJex.cjs +0 -1
- package/dist/list-cell-CyM1ZlRN.cjs +0 -1
- package/dist/matrix-BbXarwyk.js +0 -661
- package/dist/matrix-Cm65WLLP.cjs +0 -1
- package/dist/param-validation-BWNjLcN0.js +0 -116
- package/dist/param-validation-CiTxFeZ8.cjs +0 -1
- package/dist/plugin-CThk42vJ.cjs +0 -1
- package/dist/plugin-tGn7-5oF.js +0 -25
- package/dist/template-registry-CGWTLtIA.cjs +0 -1
- package/dist/template-registry-DzlQs3OF.js +0 -434
- package/dist/template-review-D1RoNCPw.cjs +0 -1
- package/dist/template-review-fnteXRng.js +0 -1473
- package/dist/validate-Bf6ccFr2.cjs +0 -1
package/dist/server.d.cts
CHANGED
|
@@ -10,6 +10,8 @@ declare interface AggregateDefinition {
|
|
|
10
10
|
|
|
11
11
|
declare type AggregateOperation = "sum" | "count" | "avg" | "min" | "max" | "weightedAvg";
|
|
12
12
|
|
|
13
|
+
export declare function checkInstanceIdentity(scope: string, id: string): void;
|
|
14
|
+
|
|
13
15
|
export declare function checkJobIdentity(scope: string, id: string): void;
|
|
14
16
|
|
|
15
17
|
export declare function cloneJob<T>(value: T): T;
|
|
@@ -73,9 +75,42 @@ declare interface ComputedField extends ExpressionOptions {
|
|
|
73
75
|
dependsOn?: readonly string[];
|
|
74
76
|
}
|
|
75
77
|
|
|
78
|
+
/** Bounded reference store for tests/local sessions. Production hosts implement durable transactional CAS. */
|
|
79
|
+
export declare function createMemoryReportInstanceStore(options?: MemoryReportInstanceStoreOptions): ReportInstanceStore;
|
|
80
|
+
|
|
76
81
|
/** Reference store for tests; use a database CAS or the single-process durable Node adapter in production. */
|
|
77
82
|
export declare function createMemoryReportJobStore(options?: ReportJobStoreBudgetOptions): ReportJobStore;
|
|
78
83
|
|
|
84
|
+
/** Bind immutable template revisions to the same runtime registration. Rebuild the service on publication. */
|
|
85
|
+
export declare function createReportGenerationService(options: {
|
|
86
|
+
runtime: ReportRuntime;
|
|
87
|
+
instances: ReportInstanceStore;
|
|
88
|
+
templateRevisions: Record<string, string>;
|
|
89
|
+
maxSnapshotBytes?: number;
|
|
90
|
+
now?: () => Date;
|
|
91
|
+
}): {
|
|
92
|
+
generate(input: ReportGenerationInput): Promise<ReportInstanceSnapshot>;
|
|
93
|
+
read: (scope: string, id: string, revision?: number, signal?: AbortSignal) => Promise<ReportInstanceSnapshot | undefined>;
|
|
94
|
+
list: (scope: string, options?: ReportInstanceListOptions) => Promise<ReportInstancePage>;
|
|
95
|
+
/** Instance edits are explicit snapshots; source business persistence remains the Provider.save responsibility. */
|
|
96
|
+
save: (input: Omit<ReportInstanceSnapshot, "revision">, options: {
|
|
97
|
+
expectedRevision: number | null;
|
|
98
|
+
signal?: AbortSignal;
|
|
99
|
+
}) => Promise<ReportInstanceSnapshot>;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/** Save is explicit. A preview/query never calls this manager or overwrites a prior instance. */
|
|
103
|
+
export declare function createReportInstanceManager(store: ReportInstanceStore, options?: {
|
|
104
|
+
maxSnapshotBytes?: number;
|
|
105
|
+
}): {
|
|
106
|
+
read: (scope: string, id: string, revision?: number, signal?: AbortSignal) => Promise<ReportInstanceSnapshot | undefined>;
|
|
107
|
+
list: (scope: string, options?: ReportInstanceListOptions) => Promise<ReportInstancePage>;
|
|
108
|
+
save: (input: Omit<ReportInstanceSnapshot, "revision">, options: {
|
|
109
|
+
expectedRevision: number | null;
|
|
110
|
+
signal?: AbortSignal;
|
|
111
|
+
}) => Promise<ReportInstanceSnapshot>;
|
|
112
|
+
};
|
|
113
|
+
|
|
79
114
|
/** Durable at-least-once dispatch; export/artifact handlers must be idempotent by scope+taskId. */
|
|
80
115
|
export declare function createReportJobService(options: ReportJobServiceOptions): ReportJobService;
|
|
81
116
|
|
|
@@ -125,6 +160,8 @@ declare interface GridCell {
|
|
|
125
160
|
value?: string | number | boolean | null;
|
|
126
161
|
/** Excel 数字格式(例如 #,##0.00 / 0.00%),不改变 text。 */
|
|
127
162
|
numberFormat?: string;
|
|
163
|
+
/** Physical left inset for hierarchical labels; raw value stays unchanged. */
|
|
164
|
+
indentMm?: number;
|
|
128
165
|
/** 编辑输入类型;省略时只按原始值推断,数字字符串不会被转换为数值。 */
|
|
129
166
|
valueType?: "text" | "number" | "boolean";
|
|
130
167
|
/** 单元格级编辑控制;预览仍需显式开启 editing。 */
|
|
@@ -171,6 +208,8 @@ declare interface ListColumn {
|
|
|
171
208
|
|
|
172
209
|
declare interface ListComponent {
|
|
173
210
|
kind: "list";
|
|
211
|
+
/** Opaque serializable layout annotations; interpreted only by explicit optional adapters. */
|
|
212
|
+
meta?: Record<string, unknown>;
|
|
174
213
|
id?: string;
|
|
175
214
|
/** 宽表标记用于连续 Excel;不改变低层列表的列宽和分页算法。 */
|
|
176
215
|
layout?: "page" | "wide";
|
|
@@ -180,6 +219,10 @@ declare interface ListComponent {
|
|
|
180
219
|
topMm: number;
|
|
181
220
|
widthMm: number;
|
|
182
221
|
dataset: string;
|
|
222
|
+
/** Headerless record/region bindings do not allocate a synthetic list header. */
|
|
223
|
+
header?: boolean;
|
|
224
|
+
/** A fixed record region rejects multiple rows instead of dropping source data. */
|
|
225
|
+
cardinality?: "record";
|
|
183
226
|
/** 数据集中稳定业务主键的字段名;省略时编辑仅有计划内坐标。 */
|
|
184
227
|
rowKey?: string;
|
|
185
228
|
revisionField?: string;
|
|
@@ -206,6 +249,8 @@ declare interface ListComponent {
|
|
|
206
249
|
computed?: ComputedField[];
|
|
207
250
|
/** Dynamic pivot of the current source dataset, with read-only derived identities. */
|
|
208
251
|
matrix?: MatrixTableOptions;
|
|
252
|
+
/** Full ordered hierarchy; source parent values and descendant-leaf rollups are explicit. */
|
|
253
|
+
tree?: TreeTableOptions;
|
|
209
254
|
/** Explicit row visibility; hidden rows do not participate in summaries. */
|
|
210
255
|
rowVisibleWhen?: StyleRule["when"];
|
|
211
256
|
/** Master/detail relation is keyed by business identity, never by display row index. */
|
|
@@ -272,6 +317,13 @@ declare interface MatrixTableOptions {
|
|
|
272
317
|
maxCells?: number;
|
|
273
318
|
}
|
|
274
319
|
|
|
320
|
+
export declare interface MemoryReportInstanceStoreOptions {
|
|
321
|
+
maxInstances?: number;
|
|
322
|
+
maxRevisions?: number;
|
|
323
|
+
maxBytes?: number;
|
|
324
|
+
maxSnapshotBytes?: number;
|
|
325
|
+
}
|
|
326
|
+
|
|
275
327
|
declare interface OutputDiagnostic {
|
|
276
328
|
code: "missing-image" | "unsupported-component" | "unsupported-image-format" | "unsupported-style" | "rich-text-flattened" | "nested-components-omitted" | "async-image-required" | "image-decode-failed" | "asset-render-failed" | "asset-budget-exceeded";
|
|
277
329
|
severity: "warning";
|
|
@@ -340,6 +392,7 @@ declare interface PlanGrid {
|
|
|
340
392
|
}
|
|
341
393
|
|
|
342
394
|
declare interface PlanPage {
|
|
395
|
+
meta?: Record<string, unknown>;
|
|
343
396
|
/** wide 表示完整自然列宽;页面仅为预览的垂直窗口分段。 */
|
|
344
397
|
layout?: "page" | "wide";
|
|
345
398
|
pageWidthMm: number;
|
|
@@ -385,6 +438,43 @@ declare interface RenderPlan {
|
|
|
385
438
|
pages: PlanPage[];
|
|
386
439
|
}
|
|
387
440
|
|
|
441
|
+
export declare interface ReportBatchCase {
|
|
442
|
+
id: string;
|
|
443
|
+
params: Record<string, string>;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
export declare interface ReportBatchOptions {
|
|
447
|
+
concurrency?: number;
|
|
448
|
+
maxCases?: number;
|
|
449
|
+
signal?: AbortSignal;
|
|
450
|
+
/** Stop launching new cases after the first failure; already running cases finish. */
|
|
451
|
+
failure?: "continue" | "stop";
|
|
452
|
+
onProgress?: (progress: ReportBatchProgress) => void;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
export declare type ReportBatchOutcome<T> = {
|
|
456
|
+
id: string;
|
|
457
|
+
index: number;
|
|
458
|
+
} & ({
|
|
459
|
+
status: "completed";
|
|
460
|
+
value: T;
|
|
461
|
+
} | {
|
|
462
|
+
status: "failed";
|
|
463
|
+
error: {
|
|
464
|
+
name: string;
|
|
465
|
+
message: string;
|
|
466
|
+
};
|
|
467
|
+
} | {
|
|
468
|
+
status: "cancelled";
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
export declare interface ReportBatchProgress {
|
|
472
|
+
completed: number;
|
|
473
|
+
total: number;
|
|
474
|
+
failed: number;
|
|
475
|
+
cancelled: number;
|
|
476
|
+
}
|
|
477
|
+
|
|
388
478
|
/** 预览中的物理坐标;合并单元格使用左上角坐标。 */
|
|
389
479
|
declare interface ReportCellAddress {
|
|
390
480
|
pageIndex: number;
|
|
@@ -486,6 +576,78 @@ declare interface ReportFieldContract {
|
|
|
486
576
|
unit?: string;
|
|
487
577
|
}
|
|
488
578
|
|
|
579
|
+
declare interface ReportFlowBand {
|
|
580
|
+
/** Exact stable component IDs. Static components use nid, lists use id. */
|
|
581
|
+
componentIds: string[];
|
|
582
|
+
/** Source-template coordinates; following bands keep their original gap. */
|
|
583
|
+
topMm: number;
|
|
584
|
+
heightMm: number;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
export declare interface ReportGenerationInput {
|
|
588
|
+
scope: string;
|
|
589
|
+
id: string;
|
|
590
|
+
title: string;
|
|
591
|
+
reportIds: string[];
|
|
592
|
+
params?: Record<string, string>;
|
|
593
|
+
expectedRevision: number | null;
|
|
594
|
+
signal?: AbortSignal;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
export declare interface ReportInstanceArtifact {
|
|
598
|
+
key: string;
|
|
599
|
+
format: "pdf" | "xlsx";
|
|
600
|
+
bytes: number;
|
|
601
|
+
sha256?: string;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
export declare class ReportInstanceError extends Error {
|
|
605
|
+
readonly code: "input" | "conflict" | "capacity";
|
|
606
|
+
constructor(code: "input" | "conflict" | "capacity", message: string);
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
export declare interface ReportInstanceListOptions {
|
|
610
|
+
after?: string;
|
|
611
|
+
limit?: number;
|
|
612
|
+
reportId?: string;
|
|
613
|
+
signal?: AbortSignal;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
export declare interface ReportInstancePage {
|
|
617
|
+
items: ReportInstanceSummary[];
|
|
618
|
+
next?: string;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
/** Stable parameter identity without adding a database, user account or credential to the SDK. */
|
|
622
|
+
export declare function reportInstanceParameterKey(reportIds: string[], params: Record<string, string>): string;
|
|
623
|
+
|
|
624
|
+
export declare interface ReportInstanceSnapshot {
|
|
625
|
+
scope: string;
|
|
626
|
+
id: string;
|
|
627
|
+
revision: number;
|
|
628
|
+
title: string;
|
|
629
|
+
generatedAt: string;
|
|
630
|
+
reportIds: string[];
|
|
631
|
+
params: Record<string, string>;
|
|
632
|
+
/** Exact template/data revisions used by generation, never inferred from a later template read. */
|
|
633
|
+
templateRevisions: Record<string, string>;
|
|
634
|
+
sourceRevisions: Record<string, string>;
|
|
635
|
+
plan: RenderPlan;
|
|
636
|
+
/** Private storage keys; signed download URLs must be generated by the host after authorization. */
|
|
637
|
+
artifacts?: ReportInstanceArtifact[];
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
export declare interface ReportInstanceStore {
|
|
641
|
+
read(scope: string, id: string, revision?: number, signal?: AbortSignal): Promise<ReportInstanceSnapshot | undefined>;
|
|
642
|
+
list(scope: string, options?: ReportInstanceListOptions): Promise<ReportInstancePage>;
|
|
643
|
+
/** Atomic append + current-revision advance. Historical revisions must never be overwritten. */
|
|
644
|
+
compareAndSwap(scope: string, id: string, expectedRevision: number | null, next: ReportInstanceSnapshot, signal?: AbortSignal): Promise<boolean>;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
export declare type ReportInstanceSummary = Omit<ReportInstanceSnapshot, "plan" | "artifacts">;
|
|
648
|
+
|
|
649
|
+
export declare function reportInstanceSummary(snapshot: ReportInstanceSnapshot): ReportInstanceSummary;
|
|
650
|
+
|
|
489
651
|
export declare class ReportJobError extends Error {
|
|
490
652
|
readonly code: "input" | "conflict" | "missing" | "lease" | "closed" | "capacity";
|
|
491
653
|
constructor(code: "input" | "conflict" | "missing" | "lease" | "closed" | "capacity", message: string);
|
|
@@ -616,13 +778,17 @@ declare interface ReportLoadContext {
|
|
|
616
778
|
signal?: AbortSignal;
|
|
617
779
|
}
|
|
618
780
|
|
|
781
|
+
declare interface ReportPageFlow {
|
|
782
|
+
bands: ReportFlowBand[];
|
|
783
|
+
}
|
|
784
|
+
|
|
619
785
|
/** 报表参数定义(声明式,模板自描述参数面:渲染组件据此生成查询面板) */
|
|
620
786
|
declare interface ReportParamDef {
|
|
621
787
|
/** 参数名(传入 params,与数据集 SQL #{field} 绑定对应) */
|
|
622
788
|
field: string;
|
|
623
789
|
/** 显示名(缺省用 field) */
|
|
624
790
|
label?: string;
|
|
625
|
-
type?: "text" | "number" | "date" | "select";
|
|
791
|
+
type?: "text" | "number" | "date" | "month" | "year" | "dateRange" | "select";
|
|
626
792
|
/** select 选项 */
|
|
627
793
|
options?: Array<{
|
|
628
794
|
label: string;
|
|
@@ -631,7 +797,7 @@ declare interface ReportParamDef {
|
|
|
631
797
|
defaultValue?: string;
|
|
632
798
|
required?: boolean;
|
|
633
799
|
placeholder?: string;
|
|
634
|
-
/**
|
|
800
|
+
/** 数字上下界;日期/月/年使用对应规范字符串;dateRange 对两端使用 YYYY-MM-DD 边界(含边界)。 */
|
|
635
801
|
min?: number | string;
|
|
636
802
|
max?: number | string;
|
|
637
803
|
minLength?: number;
|
|
@@ -968,12 +1134,22 @@ declare interface RichSegment {
|
|
|
968
1134
|
|
|
969
1135
|
export declare function runnableJob(record: ReportJobRecord, now: number): boolean;
|
|
970
1136
|
|
|
1137
|
+
/** Browser/Node shared bounded runner. Return small receipts; persist/export large artifacts inside execute. */
|
|
1138
|
+
export declare function runReportBatch<T>(input: readonly ReportBatchCase[], execute: (item: ReportBatchCase, context: {
|
|
1139
|
+
index: number;
|
|
1140
|
+
signal: AbortSignal;
|
|
1141
|
+
}) => Promise<T>, options?: ReportBatchOptions): Promise<ReportBatchOutcome<T>[]>;
|
|
1142
|
+
|
|
971
1143
|
/** Canonical plain JSON rejects getters/scripts and gives stable idempotency without coercion. */
|
|
972
1144
|
export declare function serializeJobJson(value: unknown, budget?: {
|
|
973
1145
|
maxNodes?: number;
|
|
974
1146
|
maxCharacters?: number;
|
|
975
1147
|
}): string;
|
|
976
1148
|
|
|
1149
|
+
export declare function snapshotReportBatchCases(input: readonly ReportBatchCase[], maximum?: number): ReportBatchCase[];
|
|
1150
|
+
|
|
1151
|
+
export declare function snapshotReportInstance(value: ReportInstanceSnapshot, maxBytes?: number): ReportInstanceSnapshot;
|
|
1152
|
+
|
|
977
1153
|
/** 条件格式规则求值(声明式,见 ListColumn.rules) */
|
|
978
1154
|
declare interface StyleRule {
|
|
979
1155
|
when: {
|
|
@@ -999,6 +1175,9 @@ declare interface TemplatePage {
|
|
|
999
1175
|
marginLeftMm?: number;
|
|
1000
1176
|
marginRightMm?: number;
|
|
1001
1177
|
components: TemplateComponent[];
|
|
1178
|
+
/** Explicit vertical bands preserve source gaps as dynamic regions expand. */
|
|
1179
|
+
flow?: ReportPageFlow;
|
|
1180
|
+
meta?: Record<string, unknown>;
|
|
1002
1181
|
}
|
|
1003
1182
|
|
|
1004
1183
|
/**
|
|
@@ -1021,6 +1200,26 @@ declare interface TextMeasurer {
|
|
|
1021
1200
|
measureMm(text: string, options: TextMeasureOptions): number;
|
|
1022
1201
|
}
|
|
1023
1202
|
|
|
1203
|
+
/** A serialized tree contract. Sibling and root order follow input order. */
|
|
1204
|
+
declare interface TreeTableOptions {
|
|
1205
|
+
input: "flat" | "nested";
|
|
1206
|
+
idField: string;
|
|
1207
|
+
/** Flat roots have null/undefined parent values. */
|
|
1208
|
+
parentField?: string;
|
|
1209
|
+
/** Nested child arrays, defaults to children. Every node still needs an ID. */
|
|
1210
|
+
childrenField?: string;
|
|
1211
|
+
labelField: string;
|
|
1212
|
+
indentMm?: number;
|
|
1213
|
+
orphan?: "error" | "root";
|
|
1214
|
+
/** Source preserves parent values; leaf-aggregate derives only parents from descendant leaves. */
|
|
1215
|
+
parentValues?: "source" | "leaf-aggregate";
|
|
1216
|
+
aggregates?: AggregateDefinition[];
|
|
1217
|
+
maxRows?: number;
|
|
1218
|
+
maxDepth?: number;
|
|
1219
|
+
/** Bounded leaf-to-ancestor aggregate work; default one million. */
|
|
1220
|
+
maxAggregationVisits?: number;
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1024
1223
|
export declare function validateJobRecord(record: ReportJobRecord, scope: string, id: string, expectedRevision: number | null): void;
|
|
1025
1224
|
|
|
1026
1225
|
export declare function validateJobTransition(previous: ReportJobRecord | undefined, next: ReportJobRecord): void;
|
package/dist/server.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ declare interface AggregateDefinition {
|
|
|
10
10
|
|
|
11
11
|
declare type AggregateOperation = "sum" | "count" | "avg" | "min" | "max" | "weightedAvg";
|
|
12
12
|
|
|
13
|
+
export declare function checkInstanceIdentity(scope: string, id: string): void;
|
|
14
|
+
|
|
13
15
|
export declare function checkJobIdentity(scope: string, id: string): void;
|
|
14
16
|
|
|
15
17
|
export declare function cloneJob<T>(value: T): T;
|
|
@@ -73,9 +75,42 @@ declare interface ComputedField extends ExpressionOptions {
|
|
|
73
75
|
dependsOn?: readonly string[];
|
|
74
76
|
}
|
|
75
77
|
|
|
78
|
+
/** Bounded reference store for tests/local sessions. Production hosts implement durable transactional CAS. */
|
|
79
|
+
export declare function createMemoryReportInstanceStore(options?: MemoryReportInstanceStoreOptions): ReportInstanceStore;
|
|
80
|
+
|
|
76
81
|
/** Reference store for tests; use a database CAS or the single-process durable Node adapter in production. */
|
|
77
82
|
export declare function createMemoryReportJobStore(options?: ReportJobStoreBudgetOptions): ReportJobStore;
|
|
78
83
|
|
|
84
|
+
/** Bind immutable template revisions to the same runtime registration. Rebuild the service on publication. */
|
|
85
|
+
export declare function createReportGenerationService(options: {
|
|
86
|
+
runtime: ReportRuntime;
|
|
87
|
+
instances: ReportInstanceStore;
|
|
88
|
+
templateRevisions: Record<string, string>;
|
|
89
|
+
maxSnapshotBytes?: number;
|
|
90
|
+
now?: () => Date;
|
|
91
|
+
}): {
|
|
92
|
+
generate(input: ReportGenerationInput): Promise<ReportInstanceSnapshot>;
|
|
93
|
+
read: (scope: string, id: string, revision?: number, signal?: AbortSignal) => Promise<ReportInstanceSnapshot | undefined>;
|
|
94
|
+
list: (scope: string, options?: ReportInstanceListOptions) => Promise<ReportInstancePage>;
|
|
95
|
+
/** Instance edits are explicit snapshots; source business persistence remains the Provider.save responsibility. */
|
|
96
|
+
save: (input: Omit<ReportInstanceSnapshot, "revision">, options: {
|
|
97
|
+
expectedRevision: number | null;
|
|
98
|
+
signal?: AbortSignal;
|
|
99
|
+
}) => Promise<ReportInstanceSnapshot>;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/** Save is explicit. A preview/query never calls this manager or overwrites a prior instance. */
|
|
103
|
+
export declare function createReportInstanceManager(store: ReportInstanceStore, options?: {
|
|
104
|
+
maxSnapshotBytes?: number;
|
|
105
|
+
}): {
|
|
106
|
+
read: (scope: string, id: string, revision?: number, signal?: AbortSignal) => Promise<ReportInstanceSnapshot | undefined>;
|
|
107
|
+
list: (scope: string, options?: ReportInstanceListOptions) => Promise<ReportInstancePage>;
|
|
108
|
+
save: (input: Omit<ReportInstanceSnapshot, "revision">, options: {
|
|
109
|
+
expectedRevision: number | null;
|
|
110
|
+
signal?: AbortSignal;
|
|
111
|
+
}) => Promise<ReportInstanceSnapshot>;
|
|
112
|
+
};
|
|
113
|
+
|
|
79
114
|
/** Durable at-least-once dispatch; export/artifact handlers must be idempotent by scope+taskId. */
|
|
80
115
|
export declare function createReportJobService(options: ReportJobServiceOptions): ReportJobService;
|
|
81
116
|
|
|
@@ -125,6 +160,8 @@ declare interface GridCell {
|
|
|
125
160
|
value?: string | number | boolean | null;
|
|
126
161
|
/** Excel 数字格式(例如 #,##0.00 / 0.00%),不改变 text。 */
|
|
127
162
|
numberFormat?: string;
|
|
163
|
+
/** Physical left inset for hierarchical labels; raw value stays unchanged. */
|
|
164
|
+
indentMm?: number;
|
|
128
165
|
/** 编辑输入类型;省略时只按原始值推断,数字字符串不会被转换为数值。 */
|
|
129
166
|
valueType?: "text" | "number" | "boolean";
|
|
130
167
|
/** 单元格级编辑控制;预览仍需显式开启 editing。 */
|
|
@@ -171,6 +208,8 @@ declare interface ListColumn {
|
|
|
171
208
|
|
|
172
209
|
declare interface ListComponent {
|
|
173
210
|
kind: "list";
|
|
211
|
+
/** Opaque serializable layout annotations; interpreted only by explicit optional adapters. */
|
|
212
|
+
meta?: Record<string, unknown>;
|
|
174
213
|
id?: string;
|
|
175
214
|
/** 宽表标记用于连续 Excel;不改变低层列表的列宽和分页算法。 */
|
|
176
215
|
layout?: "page" | "wide";
|
|
@@ -180,6 +219,10 @@ declare interface ListComponent {
|
|
|
180
219
|
topMm: number;
|
|
181
220
|
widthMm: number;
|
|
182
221
|
dataset: string;
|
|
222
|
+
/** Headerless record/region bindings do not allocate a synthetic list header. */
|
|
223
|
+
header?: boolean;
|
|
224
|
+
/** A fixed record region rejects multiple rows instead of dropping source data. */
|
|
225
|
+
cardinality?: "record";
|
|
183
226
|
/** 数据集中稳定业务主键的字段名;省略时编辑仅有计划内坐标。 */
|
|
184
227
|
rowKey?: string;
|
|
185
228
|
revisionField?: string;
|
|
@@ -206,6 +249,8 @@ declare interface ListComponent {
|
|
|
206
249
|
computed?: ComputedField[];
|
|
207
250
|
/** Dynamic pivot of the current source dataset, with read-only derived identities. */
|
|
208
251
|
matrix?: MatrixTableOptions;
|
|
252
|
+
/** Full ordered hierarchy; source parent values and descendant-leaf rollups are explicit. */
|
|
253
|
+
tree?: TreeTableOptions;
|
|
209
254
|
/** Explicit row visibility; hidden rows do not participate in summaries. */
|
|
210
255
|
rowVisibleWhen?: StyleRule["when"];
|
|
211
256
|
/** Master/detail relation is keyed by business identity, never by display row index. */
|
|
@@ -272,6 +317,13 @@ declare interface MatrixTableOptions {
|
|
|
272
317
|
maxCells?: number;
|
|
273
318
|
}
|
|
274
319
|
|
|
320
|
+
export declare interface MemoryReportInstanceStoreOptions {
|
|
321
|
+
maxInstances?: number;
|
|
322
|
+
maxRevisions?: number;
|
|
323
|
+
maxBytes?: number;
|
|
324
|
+
maxSnapshotBytes?: number;
|
|
325
|
+
}
|
|
326
|
+
|
|
275
327
|
declare interface OutputDiagnostic {
|
|
276
328
|
code: "missing-image" | "unsupported-component" | "unsupported-image-format" | "unsupported-style" | "rich-text-flattened" | "nested-components-omitted" | "async-image-required" | "image-decode-failed" | "asset-render-failed" | "asset-budget-exceeded";
|
|
277
329
|
severity: "warning";
|
|
@@ -340,6 +392,7 @@ declare interface PlanGrid {
|
|
|
340
392
|
}
|
|
341
393
|
|
|
342
394
|
declare interface PlanPage {
|
|
395
|
+
meta?: Record<string, unknown>;
|
|
343
396
|
/** wide 表示完整自然列宽;页面仅为预览的垂直窗口分段。 */
|
|
344
397
|
layout?: "page" | "wide";
|
|
345
398
|
pageWidthMm: number;
|
|
@@ -385,6 +438,43 @@ declare interface RenderPlan {
|
|
|
385
438
|
pages: PlanPage[];
|
|
386
439
|
}
|
|
387
440
|
|
|
441
|
+
export declare interface ReportBatchCase {
|
|
442
|
+
id: string;
|
|
443
|
+
params: Record<string, string>;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
export declare interface ReportBatchOptions {
|
|
447
|
+
concurrency?: number;
|
|
448
|
+
maxCases?: number;
|
|
449
|
+
signal?: AbortSignal;
|
|
450
|
+
/** Stop launching new cases after the first failure; already running cases finish. */
|
|
451
|
+
failure?: "continue" | "stop";
|
|
452
|
+
onProgress?: (progress: ReportBatchProgress) => void;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
export declare type ReportBatchOutcome<T> = {
|
|
456
|
+
id: string;
|
|
457
|
+
index: number;
|
|
458
|
+
} & ({
|
|
459
|
+
status: "completed";
|
|
460
|
+
value: T;
|
|
461
|
+
} | {
|
|
462
|
+
status: "failed";
|
|
463
|
+
error: {
|
|
464
|
+
name: string;
|
|
465
|
+
message: string;
|
|
466
|
+
};
|
|
467
|
+
} | {
|
|
468
|
+
status: "cancelled";
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
export declare interface ReportBatchProgress {
|
|
472
|
+
completed: number;
|
|
473
|
+
total: number;
|
|
474
|
+
failed: number;
|
|
475
|
+
cancelled: number;
|
|
476
|
+
}
|
|
477
|
+
|
|
388
478
|
/** 预览中的物理坐标;合并单元格使用左上角坐标。 */
|
|
389
479
|
declare interface ReportCellAddress {
|
|
390
480
|
pageIndex: number;
|
|
@@ -486,6 +576,78 @@ declare interface ReportFieldContract {
|
|
|
486
576
|
unit?: string;
|
|
487
577
|
}
|
|
488
578
|
|
|
579
|
+
declare interface ReportFlowBand {
|
|
580
|
+
/** Exact stable component IDs. Static components use nid, lists use id. */
|
|
581
|
+
componentIds: string[];
|
|
582
|
+
/** Source-template coordinates; following bands keep their original gap. */
|
|
583
|
+
topMm: number;
|
|
584
|
+
heightMm: number;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
export declare interface ReportGenerationInput {
|
|
588
|
+
scope: string;
|
|
589
|
+
id: string;
|
|
590
|
+
title: string;
|
|
591
|
+
reportIds: string[];
|
|
592
|
+
params?: Record<string, string>;
|
|
593
|
+
expectedRevision: number | null;
|
|
594
|
+
signal?: AbortSignal;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
export declare interface ReportInstanceArtifact {
|
|
598
|
+
key: string;
|
|
599
|
+
format: "pdf" | "xlsx";
|
|
600
|
+
bytes: number;
|
|
601
|
+
sha256?: string;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
export declare class ReportInstanceError extends Error {
|
|
605
|
+
readonly code: "input" | "conflict" | "capacity";
|
|
606
|
+
constructor(code: "input" | "conflict" | "capacity", message: string);
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
export declare interface ReportInstanceListOptions {
|
|
610
|
+
after?: string;
|
|
611
|
+
limit?: number;
|
|
612
|
+
reportId?: string;
|
|
613
|
+
signal?: AbortSignal;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
export declare interface ReportInstancePage {
|
|
617
|
+
items: ReportInstanceSummary[];
|
|
618
|
+
next?: string;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
/** Stable parameter identity without adding a database, user account or credential to the SDK. */
|
|
622
|
+
export declare function reportInstanceParameterKey(reportIds: string[], params: Record<string, string>): string;
|
|
623
|
+
|
|
624
|
+
export declare interface ReportInstanceSnapshot {
|
|
625
|
+
scope: string;
|
|
626
|
+
id: string;
|
|
627
|
+
revision: number;
|
|
628
|
+
title: string;
|
|
629
|
+
generatedAt: string;
|
|
630
|
+
reportIds: string[];
|
|
631
|
+
params: Record<string, string>;
|
|
632
|
+
/** Exact template/data revisions used by generation, never inferred from a later template read. */
|
|
633
|
+
templateRevisions: Record<string, string>;
|
|
634
|
+
sourceRevisions: Record<string, string>;
|
|
635
|
+
plan: RenderPlan;
|
|
636
|
+
/** Private storage keys; signed download URLs must be generated by the host after authorization. */
|
|
637
|
+
artifacts?: ReportInstanceArtifact[];
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
export declare interface ReportInstanceStore {
|
|
641
|
+
read(scope: string, id: string, revision?: number, signal?: AbortSignal): Promise<ReportInstanceSnapshot | undefined>;
|
|
642
|
+
list(scope: string, options?: ReportInstanceListOptions): Promise<ReportInstancePage>;
|
|
643
|
+
/** Atomic append + current-revision advance. Historical revisions must never be overwritten. */
|
|
644
|
+
compareAndSwap(scope: string, id: string, expectedRevision: number | null, next: ReportInstanceSnapshot, signal?: AbortSignal): Promise<boolean>;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
export declare type ReportInstanceSummary = Omit<ReportInstanceSnapshot, "plan" | "artifacts">;
|
|
648
|
+
|
|
649
|
+
export declare function reportInstanceSummary(snapshot: ReportInstanceSnapshot): ReportInstanceSummary;
|
|
650
|
+
|
|
489
651
|
export declare class ReportJobError extends Error {
|
|
490
652
|
readonly code: "input" | "conflict" | "missing" | "lease" | "closed" | "capacity";
|
|
491
653
|
constructor(code: "input" | "conflict" | "missing" | "lease" | "closed" | "capacity", message: string);
|
|
@@ -616,13 +778,17 @@ declare interface ReportLoadContext {
|
|
|
616
778
|
signal?: AbortSignal;
|
|
617
779
|
}
|
|
618
780
|
|
|
781
|
+
declare interface ReportPageFlow {
|
|
782
|
+
bands: ReportFlowBand[];
|
|
783
|
+
}
|
|
784
|
+
|
|
619
785
|
/** 报表参数定义(声明式,模板自描述参数面:渲染组件据此生成查询面板) */
|
|
620
786
|
declare interface ReportParamDef {
|
|
621
787
|
/** 参数名(传入 params,与数据集 SQL #{field} 绑定对应) */
|
|
622
788
|
field: string;
|
|
623
789
|
/** 显示名(缺省用 field) */
|
|
624
790
|
label?: string;
|
|
625
|
-
type?: "text" | "number" | "date" | "select";
|
|
791
|
+
type?: "text" | "number" | "date" | "month" | "year" | "dateRange" | "select";
|
|
626
792
|
/** select 选项 */
|
|
627
793
|
options?: Array<{
|
|
628
794
|
label: string;
|
|
@@ -631,7 +797,7 @@ declare interface ReportParamDef {
|
|
|
631
797
|
defaultValue?: string;
|
|
632
798
|
required?: boolean;
|
|
633
799
|
placeholder?: string;
|
|
634
|
-
/**
|
|
800
|
+
/** 数字上下界;日期/月/年使用对应规范字符串;dateRange 对两端使用 YYYY-MM-DD 边界(含边界)。 */
|
|
635
801
|
min?: number | string;
|
|
636
802
|
max?: number | string;
|
|
637
803
|
minLength?: number;
|
|
@@ -968,12 +1134,22 @@ declare interface RichSegment {
|
|
|
968
1134
|
|
|
969
1135
|
export declare function runnableJob(record: ReportJobRecord, now: number): boolean;
|
|
970
1136
|
|
|
1137
|
+
/** Browser/Node shared bounded runner. Return small receipts; persist/export large artifacts inside execute. */
|
|
1138
|
+
export declare function runReportBatch<T>(input: readonly ReportBatchCase[], execute: (item: ReportBatchCase, context: {
|
|
1139
|
+
index: number;
|
|
1140
|
+
signal: AbortSignal;
|
|
1141
|
+
}) => Promise<T>, options?: ReportBatchOptions): Promise<ReportBatchOutcome<T>[]>;
|
|
1142
|
+
|
|
971
1143
|
/** Canonical plain JSON rejects getters/scripts and gives stable idempotency without coercion. */
|
|
972
1144
|
export declare function serializeJobJson(value: unknown, budget?: {
|
|
973
1145
|
maxNodes?: number;
|
|
974
1146
|
maxCharacters?: number;
|
|
975
1147
|
}): string;
|
|
976
1148
|
|
|
1149
|
+
export declare function snapshotReportBatchCases(input: readonly ReportBatchCase[], maximum?: number): ReportBatchCase[];
|
|
1150
|
+
|
|
1151
|
+
export declare function snapshotReportInstance(value: ReportInstanceSnapshot, maxBytes?: number): ReportInstanceSnapshot;
|
|
1152
|
+
|
|
977
1153
|
/** 条件格式规则求值(声明式,见 ListColumn.rules) */
|
|
978
1154
|
declare interface StyleRule {
|
|
979
1155
|
when: {
|
|
@@ -999,6 +1175,9 @@ declare interface TemplatePage {
|
|
|
999
1175
|
marginLeftMm?: number;
|
|
1000
1176
|
marginRightMm?: number;
|
|
1001
1177
|
components: TemplateComponent[];
|
|
1178
|
+
/** Explicit vertical bands preserve source gaps as dynamic regions expand. */
|
|
1179
|
+
flow?: ReportPageFlow;
|
|
1180
|
+
meta?: Record<string, unknown>;
|
|
1002
1181
|
}
|
|
1003
1182
|
|
|
1004
1183
|
/**
|
|
@@ -1021,6 +1200,26 @@ declare interface TextMeasurer {
|
|
|
1021
1200
|
measureMm(text: string, options: TextMeasureOptions): number;
|
|
1022
1201
|
}
|
|
1023
1202
|
|
|
1203
|
+
/** A serialized tree contract. Sibling and root order follow input order. */
|
|
1204
|
+
declare interface TreeTableOptions {
|
|
1205
|
+
input: "flat" | "nested";
|
|
1206
|
+
idField: string;
|
|
1207
|
+
/** Flat roots have null/undefined parent values. */
|
|
1208
|
+
parentField?: string;
|
|
1209
|
+
/** Nested child arrays, defaults to children. Every node still needs an ID. */
|
|
1210
|
+
childrenField?: string;
|
|
1211
|
+
labelField: string;
|
|
1212
|
+
indentMm?: number;
|
|
1213
|
+
orphan?: "error" | "root";
|
|
1214
|
+
/** Source preserves parent values; leaf-aggregate derives only parents from descendant leaves. */
|
|
1215
|
+
parentValues?: "source" | "leaf-aggregate";
|
|
1216
|
+
aggregates?: AggregateDefinition[];
|
|
1217
|
+
maxRows?: number;
|
|
1218
|
+
maxDepth?: number;
|
|
1219
|
+
/** Bounded leaf-to-ancestor aggregate work; default one million. */
|
|
1220
|
+
maxAggregationVisits?: number;
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1024
1223
|
export declare function validateJobRecord(record: ReportJobRecord, scope: string, id: string, expectedRevision: number | null): void;
|
|
1025
1224
|
|
|
1026
1225
|
export declare function validateJobTransition(previous: ReportJobRecord | undefined, next: ReportJobRecord): void;
|