@univerjs-pro/engine-formula-rust 1.0.0-insiders.20260725-1b9c8d8
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 +56 -0
- package/lib/index.js +2114 -0
- package/lib/types/adapters/rust-projection-remote-instance.service.d.ts +28 -0
- package/lib/types/binding.d.ts +105 -0
- package/lib/types/controllers/rust-engine-sync.controller.d.ts +40 -0
- package/lib/types/controllers/rust-same-runtime-projection.controller.d.ts +27 -0
- package/lib/types/index.d.ts +10 -0
- package/lib/types/numfmt.d.ts +145 -0
- package/lib/types/plugin.d.ts +35 -0
- package/lib/types/regression/formula-array-followers.d.ts +14 -0
- package/lib/types/regression/formula-value-normalization.d.ts +2 -0
- package/lib/types/regression/formula-volatile-dependencies.d.ts +7 -0
- package/lib/types/regression/real-univer-stage-timeouts.d.ts +7 -0
- package/lib/types/regression/rust-only-artifact-cache.d.ts +41 -0
- package/lib/types/regression/rust-only-discovery.d.ts +17 -0
- package/lib/types/regression/rust-only-excel-com-oracle.d.ts +57 -0
- package/lib/types/regression/rust-only-excel-process-cleanup.d.ts +3 -0
- package/lib/types/regression/rust-only-exchange-binary.d.ts +15 -0
- package/lib/types/regression/rust-only-failure-report.d.ts +13 -0
- package/lib/types/regression/rust-only-feature-extraction.d.ts +19 -0
- package/lib/types/regression/rust-only-formula-comparison.d.ts +43 -0
- package/lib/types/regression/rust-only-ooxml-diff.d.ts +23 -0
- package/lib/types/regression/rust-only-ooxml-feature-extraction.d.ts +7 -0
- package/lib/types/regression/rust-only-partial-artifacts.d.ts +7 -0
- package/lib/types/regression/rust-only-pipeline.d.ts +55 -0
- package/lib/types/regression/rust-only-process.d.ts +9 -0
- package/lib/types/regression/rust-only-real-runner.d.ts +103 -0
- package/lib/types/regression/rust-only-report.d.ts +131 -0
- package/lib/types/regression/rust-only-sequential-runner.d.ts +24 -0
- package/lib/types/regression/rust-only-timeout.d.ts +63 -0
- package/lib/types/regression/rust-only-view-host.d.ts +171 -0
- package/lib/types/regression/rust-only-workbook-json-formula-values.d.ts +2 -0
- package/lib/types/regression/rust-only-xlsx-formula-values.d.ts +8 -0
- package/lib/types/regression/xlsx-sample-compatibility.d.ts +56 -0
- package/lib/types/services/calculate-formula.service.d.ts +106 -0
- package/lib/types/services/rust-formula-projection.service.d.ts +70 -0
- package/lib/types/services/workbook-snapshot-materializer.d.ts +20 -0
- package/lib/types/types.d.ts +398 -0
- package/package.json +47 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export declare const DEFAULT_XLSX_SAMPLE_COMPATIBILITY_ROOT = "C:\\Users\\wbfsa\\Downloads\\gdpval";
|
|
2
|
+
export declare const XLSX_SAMPLE_COMPATIBILITY_GROUPS: readonly ['deliverable_files', 'reference_files'];
|
|
3
|
+
export type XlsxSampleCompatibilityGroup = (typeof XLSX_SAMPLE_COMPATIBILITY_GROUPS)[number];
|
|
4
|
+
export type XlsxSampleCompatibilityStatus = 'pending' | 'running' | 'failed' | 'passed' | 'unsupported-recorded';
|
|
5
|
+
export type XlsxSampleCompatibilityStage = 'sourceExcelOracle' | 'rustImport' | 'viewerOpen' | 'viewerCompare' | 'rustExport' | 'exportedExcelOpen' | 'exportedCompare' | 'reportWrite';
|
|
6
|
+
export interface XlsxSampleCompatibilityRunnerArgs {
|
|
7
|
+
readonly sampleRoot: string;
|
|
8
|
+
readonly outputRoot: string;
|
|
9
|
+
readonly manifestPath?: string;
|
|
10
|
+
readonly caseSelector?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface XlsxSampleWorkbookFile {
|
|
13
|
+
readonly path: string;
|
|
14
|
+
readonly size: number;
|
|
15
|
+
readonly modifiedTimeMs: number;
|
|
16
|
+
}
|
|
17
|
+
export interface XlsxSampleCompatibilityDiagnostic {
|
|
18
|
+
readonly classification: string;
|
|
19
|
+
readonly message: string;
|
|
20
|
+
}
|
|
21
|
+
export interface XlsxSampleCompatibilityCase {
|
|
22
|
+
readonly activeStage: XlsxSampleCompatibilityStage | null;
|
|
23
|
+
readonly artifactDir: string;
|
|
24
|
+
readonly caseId: string;
|
|
25
|
+
readonly group: XlsxSampleCompatibilityGroup;
|
|
26
|
+
readonly lastDiagnostic: XlsxSampleCompatibilityDiagnostic | null;
|
|
27
|
+
readonly modifiedTimeMs: number;
|
|
28
|
+
readonly relativePath: string;
|
|
29
|
+
readonly size: number;
|
|
30
|
+
readonly sourcePath: string;
|
|
31
|
+
readonly status: XlsxSampleCompatibilityStatus;
|
|
32
|
+
}
|
|
33
|
+
export interface XlsxSampleCompatibilityManifest {
|
|
34
|
+
readonly cases: readonly XlsxSampleCompatibilityCase[];
|
|
35
|
+
readonly createdAt: string;
|
|
36
|
+
readonly outputRoot: string;
|
|
37
|
+
readonly runId: string;
|
|
38
|
+
readonly sampleRoot: string;
|
|
39
|
+
}
|
|
40
|
+
export interface CreateXlsxSampleCompatibilityManifestOptions {
|
|
41
|
+
readonly listWorkbookFiles?: (groupRoot: string) => Promise<readonly XlsxSampleWorkbookFile[]>;
|
|
42
|
+
readonly now?: () => Date;
|
|
43
|
+
readonly outputRoot: string;
|
|
44
|
+
readonly runId: string;
|
|
45
|
+
readonly sampleRoot?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface RunXlsxSampleCompatibilityRunnerOptions extends CreateXlsxSampleCompatibilityManifestOptions {
|
|
48
|
+
readonly caseSelector?: string;
|
|
49
|
+
readonly manifestPath?: string;
|
|
50
|
+
readonly startStage?: XlsxSampleCompatibilityStage;
|
|
51
|
+
}
|
|
52
|
+
export declare function runXlsxSampleCompatibilityRunner(options: RunXlsxSampleCompatibilityRunnerOptions): Promise<XlsxSampleCompatibilityManifest>;
|
|
53
|
+
export declare function parseXlsxSampleCompatibilityRunnerArgs(args: readonly string[]): XlsxSampleCompatibilityRunnerArgs;
|
|
54
|
+
export declare function createXlsxSampleCompatibilityManifest(options: CreateXlsxSampleCompatibilityManifestOptions): Promise<XlsxSampleCompatibilityManifest>;
|
|
55
|
+
export declare function persistXlsxSampleCompatibilityManifest(manifest: XlsxSampleCompatibilityManifest, manifestPath: string): Promise<void>;
|
|
56
|
+
export declare function startXlsxSampleCompatibilityCase(manifest: XlsxSampleCompatibilityManifest, caseId: string, activeStage: XlsxSampleCompatibilityStage): XlsxSampleCompatibilityManifest;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { IUnitRange, Nullable } from '@univerjs/core';
|
|
2
|
+
import type { IAllRuntimeData, ICalculateFormulaService, IExecutionInProgressParams, IFeatureDirtyRangeType, IFormulaDependencyTreeJson, IFormulaDatasetConfig, IFormulaExecuteResultMap, IFormulaStringMap, IRuntimeUnitDataType, ISetFormulaCalculationResultMutation, IUnitRowData } from '@univerjs/engine-formula';
|
|
3
|
+
import type { IRustFormulaDependencyExecutionOutput } from '../types.js';
|
|
4
|
+
import { Disposable, ICommandService, IConfigService } from '@univerjs/core';
|
|
5
|
+
import { IFeatureCalculationManagerService, IFormulaCurrentConfigService, IFormulaDependencyGenerator, IFormulaRuntimeService, IOtherFormulaManagerService } from '@univerjs/engine-formula';
|
|
6
|
+
import { ExternalReferencePrefetchPlanner, ExternalReferencePrefetchService } from '@univerjs-pro/engine-formula';
|
|
7
|
+
import { Subject } from 'rxjs';
|
|
8
|
+
import { RustEngineSyncController } from '../controllers/rust-engine-sync.controller.js';
|
|
9
|
+
export interface IRustCalculateFormulaService extends ICalculateFormulaService {
|
|
10
|
+
}
|
|
11
|
+
export declare const IRustCalculateFormulaService: import("@wendellhu/redi").IdentifierDecorator<IRustCalculateFormulaService>;
|
|
12
|
+
export declare function rustExecutionOutputToCalculationResult(output: IRustFormulaDependencyExecutionOutput): ISetFormulaCalculationResultMutation;
|
|
13
|
+
/**
|
|
14
|
+
* Rust-backed implementation of ICalculateFormulaService.
|
|
15
|
+
*
|
|
16
|
+
* This service acts as an adapter: it gathers all necessary data from the TS-side
|
|
17
|
+
* DI container, serializes it, sends it to the Rust engine via NAPI, then writes
|
|
18
|
+
* the results back into IFormulaRuntimeService.
|
|
19
|
+
*/
|
|
20
|
+
export declare class RustCalculateFormulaService extends Disposable implements IRustCalculateFormulaService {
|
|
21
|
+
protected readonly _configService: IConfigService;
|
|
22
|
+
protected readonly _currentConfigService: IFormulaCurrentConfigService;
|
|
23
|
+
protected readonly _runtimeService: IFormulaRuntimeService;
|
|
24
|
+
protected readonly _formulaDependencyGenerator: IFormulaDependencyGenerator;
|
|
25
|
+
protected readonly _featureCalculationManagerService: IFeatureCalculationManagerService;
|
|
26
|
+
protected readonly _otherFormulaManagerService: IOtherFormulaManagerService;
|
|
27
|
+
protected readonly _commandService: ICommandService;
|
|
28
|
+
private readonly _rustEngineSyncController;
|
|
29
|
+
private readonly _externalPrefetchPlanner;
|
|
30
|
+
private readonly _externalPrefetchService;
|
|
31
|
+
protected readonly _executionInProgressListener$: Subject<IExecutionInProgressParams>;
|
|
32
|
+
readonly executionInProgressListener$: import("rxjs").Observable<IExecutionInProgressParams>;
|
|
33
|
+
protected readonly _executionCompleteListener$: Subject<IAllRuntimeData>;
|
|
34
|
+
readonly executionCompleteListener$: import("rxjs").Observable<IAllRuntimeData>;
|
|
35
|
+
private _executeLock;
|
|
36
|
+
private _nativeLoaded;
|
|
37
|
+
private _syncedSnapshotEpoch;
|
|
38
|
+
private _syncedDependencyInvalidationEpoch;
|
|
39
|
+
private _externalFormulaDatasetConfig;
|
|
40
|
+
constructor(_configService: IConfigService, _currentConfigService: IFormulaCurrentConfigService, _runtimeService: IFormulaRuntimeService, _formulaDependencyGenerator: IFormulaDependencyGenerator, _featureCalculationManagerService: IFeatureCalculationManagerService, _otherFormulaManagerService: IOtherFormulaManagerService, _commandService: ICommandService, _rustEngineSyncController: RustEngineSyncController, _externalPrefetchPlanner: ExternalReferencePrefetchPlanner, _externalPrefetchService: ExternalReferencePrefetchService);
|
|
41
|
+
dispose(): void;
|
|
42
|
+
stopFormulaExecution(): void;
|
|
43
|
+
setRuntimeFeatureCellData(featureId: string, featureData: IRuntimeUnitDataType): void;
|
|
44
|
+
setRuntimeFeatureRange(featureId: string, featureRange: IFeatureDirtyRangeType): void;
|
|
45
|
+
execute(formulaDatasetConfig: IFormulaDatasetConfig): Promise<void>;
|
|
46
|
+
private _executeStep;
|
|
47
|
+
private _prefetchStaticExternalReferences;
|
|
48
|
+
private _resolveExternalReferenceNeeds;
|
|
49
|
+
private _groupExternalReferenceNeeds;
|
|
50
|
+
private _hostUnitIdFromSynthetic;
|
|
51
|
+
private _buildRustInput;
|
|
52
|
+
private _syncRustFormulaDependencies;
|
|
53
|
+
private _syncRustFormulaDependencyDefinitions;
|
|
54
|
+
private _collectRustFormulaDependencySyncState;
|
|
55
|
+
private _markRustFormulaDirty;
|
|
56
|
+
private _dirtyFeatureMapFor;
|
|
57
|
+
private _featureKey;
|
|
58
|
+
private _featureSignatureMap;
|
|
59
|
+
private _serializeFeatureDirtyRanges;
|
|
60
|
+
private _serializeRuntimeFeatureCellData;
|
|
61
|
+
private _serializeFormulaData;
|
|
62
|
+
private _serializeUnitData;
|
|
63
|
+
private _serializeCellData;
|
|
64
|
+
private _applyRustOutput;
|
|
65
|
+
private _applyRustDependencyOutput;
|
|
66
|
+
calculate(formulaString: string): Promise<{} | null>;
|
|
67
|
+
executeFormulas(formulas: IFormulaStringMap, rowData?: IUnitRowData): Promise<IFormulaExecuteResultMap>;
|
|
68
|
+
getAllDependencyJson(_rowData?: IUnitRowData): Promise<IFormulaDependencyTreeJson[]>;
|
|
69
|
+
getCellDependencyJson(unitId: string, sheetId: string, row: number, column: number, _rowData?: IUnitRowData): Promise<{
|
|
70
|
+
treeId: number;
|
|
71
|
+
formula: string;
|
|
72
|
+
row: number;
|
|
73
|
+
column: number;
|
|
74
|
+
unitId: string;
|
|
75
|
+
subUnitId: string;
|
|
76
|
+
refOffsetX: number;
|
|
77
|
+
refOffsetY: number;
|
|
78
|
+
rangeList: IUnitRange[];
|
|
79
|
+
refTreeId: number | undefined;
|
|
80
|
+
formulaId: Nullable<string>;
|
|
81
|
+
featureId: Nullable<string>;
|
|
82
|
+
type: Nullable<import("@univerjs/engine-formula").FormulaDependencyTreeType>;
|
|
83
|
+
children: IFormulaDependencyTreeJson[];
|
|
84
|
+
parents: IFormulaDependencyTreeJson[];
|
|
85
|
+
} | undefined>;
|
|
86
|
+
getRangeDependents(unitRanges: IUnitRange[]): Promise<IFormulaDependencyTreeJson[]>;
|
|
87
|
+
getInRangeFormulas(unitRanges: IUnitRange[]): Promise<IFormulaDependencyTreeJson[]>;
|
|
88
|
+
getDependentsAndInRangeFormulas(unitRanges: IUnitRange[]): Promise<{
|
|
89
|
+
dependents: IFormulaDependencyTreeJson[];
|
|
90
|
+
inRanges: IFormulaDependencyTreeJson[];
|
|
91
|
+
}>;
|
|
92
|
+
private _formulaStringMapToFormulaData;
|
|
93
|
+
private _formulaExecutionOutputToResultMap;
|
|
94
|
+
private _getRustDependencyGraph;
|
|
95
|
+
private _getRustInspectGraph;
|
|
96
|
+
private _rustAllDependencyJson;
|
|
97
|
+
private _rustGraphDependencyJson;
|
|
98
|
+
private _rustDependencyNodeToJson;
|
|
99
|
+
private _rustFormulaNodeToDependencyJson;
|
|
100
|
+
private _rustRangeToUnitRange;
|
|
101
|
+
private _serializeUnitRanges;
|
|
102
|
+
private _rustDependencyJsonByCell;
|
|
103
|
+
private _cellKey;
|
|
104
|
+
private _cellInUnitRanges;
|
|
105
|
+
private _uniqueDependencyJson;
|
|
106
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { IWorkbookData } from '@univerjs/core';
|
|
2
|
+
import type { IFormulaDatasetConfig, ISetFormulaCalculationResultMutation } from '@univerjs/engine-formula';
|
|
3
|
+
import type { IRustDefinedNameSnapshot, IRustDependencyRange, IRustEngineModelStats, IRustEngineMutation, IRustEngineSnapshot, IRustFormulaDependencyExecutionOutput, IRustFormulaDependencySyncInput, IRustFormulaStoreState, IRustWorkbookSnapshot } from '../types.js';
|
|
4
|
+
export declare const RUST_UPSERT_REFERENCE_DATA_MUTATION_ID = "formula.mutation.upsert-reference-data";
|
|
5
|
+
export declare const RUST_FORMULA_RELEVANT_MUTATIONS: Set<string>;
|
|
6
|
+
export declare const RUST_INCREMENTAL_DEPENDENCY_MUTATIONS: Set<string>;
|
|
7
|
+
export interface IRustProjectionWorkbookInput {
|
|
8
|
+
snapshot: IWorkbookData;
|
|
9
|
+
unitId?: string;
|
|
10
|
+
definedNames?: Record<string, IRustDefinedNameSnapshot>;
|
|
11
|
+
}
|
|
12
|
+
export interface IFormulaCalculationError {
|
|
13
|
+
code: string;
|
|
14
|
+
message: string;
|
|
15
|
+
unitId?: string;
|
|
16
|
+
sheetId?: string;
|
|
17
|
+
row?: number;
|
|
18
|
+
column?: number;
|
|
19
|
+
}
|
|
20
|
+
export interface IFormulaProjectionDesyncSignal {
|
|
21
|
+
reason: string;
|
|
22
|
+
message: string;
|
|
23
|
+
mutationId?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface IFormulaCalculationPatch {
|
|
26
|
+
unitData: ISetFormulaCalculationResultMutation['unitData'];
|
|
27
|
+
unitOtherData: ISetFormulaCalculationResultMutation['unitOtherData'];
|
|
28
|
+
arrayFormulaRange?: IRustFormulaStoreState['arrayFormulaRange'];
|
|
29
|
+
arrayFormulaCellData?: IRustFormulaStoreState['arrayFormulaCellData'];
|
|
30
|
+
errors?: IFormulaCalculationError[];
|
|
31
|
+
desync?: IFormulaProjectionDesyncSignal;
|
|
32
|
+
}
|
|
33
|
+
export interface IRustFormulaProjectionLoadResult {
|
|
34
|
+
stats?: IRustEngineModelStats;
|
|
35
|
+
errors?: IFormulaCalculationError[];
|
|
36
|
+
desync?: IFormulaProjectionDesyncSignal;
|
|
37
|
+
}
|
|
38
|
+
export interface IRustFormulaProjectionMutationResult {
|
|
39
|
+
stats?: IRustEngineModelStats;
|
|
40
|
+
dependencyInvalidated: boolean;
|
|
41
|
+
errors?: IFormulaCalculationError[];
|
|
42
|
+
desync?: IFormulaProjectionDesyncSignal;
|
|
43
|
+
}
|
|
44
|
+
export declare function isRustFormulaRelevantMutation(id: string): boolean;
|
|
45
|
+
export declare function isRustIncrementalDependencyMutation(id: string): boolean;
|
|
46
|
+
export declare function createReferenceDataUpsertMutations(config: IFormulaDatasetConfig, needs: NonNullable<IRustFormulaDependencyExecutionOutput['needsData']>): IRustEngineMutation[];
|
|
47
|
+
export declare function serializeRuntimeWorkbookSnapshots(workbooks: readonly IRustProjectionWorkbookInput[]): IRustEngineSnapshot;
|
|
48
|
+
export declare function serializeRuntimeWorkbookSnapshot(input: IRustProjectionWorkbookInput): IRustWorkbookSnapshot;
|
|
49
|
+
export declare function rustExecutionOutputToFormulaCalculationPatch(output: IRustFormulaDependencyExecutionOutput): IFormulaCalculationPatch;
|
|
50
|
+
export declare function createFormulaProjectionDesyncSignal(reason: string, error: unknown, mutationId?: string): IFormulaProjectionDesyncSignal;
|
|
51
|
+
export declare class RustFormulaProjectionService {
|
|
52
|
+
private _nativeLoaded;
|
|
53
|
+
load(workbooks: readonly IRustProjectionWorkbookInput[]): Promise<IRustFormulaProjectionLoadResult>;
|
|
54
|
+
applyMutation(mutation: IRustEngineMutation): Promise<IRustFormulaProjectionMutationResult>;
|
|
55
|
+
syncFormulaDependencies(input: IRustFormulaDependencySyncInput): Promise<unknown>;
|
|
56
|
+
markDirty(input: {
|
|
57
|
+
forceCalculation?: boolean;
|
|
58
|
+
includeDirtyNodes?: boolean;
|
|
59
|
+
includeCalculationOrder?: boolean;
|
|
60
|
+
dirtyRanges?: IRustDependencyRange[];
|
|
61
|
+
dirtyUnitFeatureMap?: Record<string, Record<string, Record<string, boolean>>>;
|
|
62
|
+
dirtyUnitOtherFormulaMap?: Record<string, Record<string, Record<string, boolean>>>;
|
|
63
|
+
dirtyNameMap?: Record<string, Record<string, string>>;
|
|
64
|
+
dirtyDefinedNameMap?: Record<string, Record<string, string>>;
|
|
65
|
+
}): Promise<unknown>;
|
|
66
|
+
calculateDirty(maxIteration?: number): Promise<IFormulaCalculationPatch>;
|
|
67
|
+
reset(): Promise<IRustFormulaProjectionLoadResult>;
|
|
68
|
+
disposeWorkbook(unitId: string): Promise<IRustFormulaProjectionLoadResult>;
|
|
69
|
+
private _ensureNativeLoaded;
|
|
70
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { IWorkbookData } from '@univerjs/core';
|
|
2
|
+
import type { ISheetBlock, ISnapshot } from '@univerjs/protocol';
|
|
3
|
+
import type { IRustFormulaDependencyDirtyInput } from '../types.js';
|
|
4
|
+
export interface IMaterializedWorkbookSnapshot {
|
|
5
|
+
snapshot: ISnapshot;
|
|
6
|
+
sheetBlocks: Record<string, ISheetBlock[]>;
|
|
7
|
+
warnings: unknown[];
|
|
8
|
+
calculationStats: IMaterializationCalculationStats;
|
|
9
|
+
}
|
|
10
|
+
export interface IMaterializationCalculationStats {
|
|
11
|
+
fullCalculation: boolean;
|
|
12
|
+
formulaNodeCount: number;
|
|
13
|
+
calculatedNodeCount: number;
|
|
14
|
+
hasCycle: boolean;
|
|
15
|
+
cycleIterationCount: number;
|
|
16
|
+
parallelBatchCount: number;
|
|
17
|
+
parallelNodeCount: number;
|
|
18
|
+
errorCount: number;
|
|
19
|
+
}
|
|
20
|
+
export declare function materializeWorkbookSnapshot(workbook: IWorkbookData, unitID: string, rev: number, dirtyInput?: IRustFormulaDependencyDirtyInput): Promise<IMaterializedWorkbookSnapshot>;
|
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serialized types exchanged between TS and Rust formula engine.
|
|
3
|
+
*/
|
|
4
|
+
export interface IFormulaEngineConfig {
|
|
5
|
+
maxIteration: number;
|
|
6
|
+
intervalCount: number;
|
|
7
|
+
}
|
|
8
|
+
export interface IFormulaExecutionInput {
|
|
9
|
+
config: IFormulaEngineConfig;
|
|
10
|
+
formulaData: Record<string, Record<string, Record<number, Record<number, string | IRustFormulaDataItem>>>>;
|
|
11
|
+
unitData: Record<string, Record<string, ISheetData>>;
|
|
12
|
+
dirtyRanges: IUnitRange[];
|
|
13
|
+
definedNames: Record<string, IDefinedName>;
|
|
14
|
+
}
|
|
15
|
+
export interface ISheetData {
|
|
16
|
+
cellData: Record<number, Record<number, ICellValue>>;
|
|
17
|
+
rowCount: number;
|
|
18
|
+
columnCount: number;
|
|
19
|
+
}
|
|
20
|
+
export interface ICellValue {
|
|
21
|
+
v?: unknown;
|
|
22
|
+
t?: number;
|
|
23
|
+
p?: unknown;
|
|
24
|
+
f?: string;
|
|
25
|
+
si?: string;
|
|
26
|
+
ref?: string;
|
|
27
|
+
xf?: string;
|
|
28
|
+
s?: unknown;
|
|
29
|
+
displayPrecision?: number;
|
|
30
|
+
}
|
|
31
|
+
export interface IUnitRange {
|
|
32
|
+
unitId: string;
|
|
33
|
+
sheetId: string;
|
|
34
|
+
range: IRange;
|
|
35
|
+
}
|
|
36
|
+
export interface IRange {
|
|
37
|
+
startRow: number;
|
|
38
|
+
startColumn: number;
|
|
39
|
+
endRow: number;
|
|
40
|
+
endColumn: number;
|
|
41
|
+
}
|
|
42
|
+
export interface IDefinedName {
|
|
43
|
+
name: string;
|
|
44
|
+
formula?: string;
|
|
45
|
+
range?: IRange;
|
|
46
|
+
}
|
|
47
|
+
export interface IFormulaExecutionOutput {
|
|
48
|
+
runtimeData: Record<string, Record<string, Record<number, Record<number, unknown>>>>;
|
|
49
|
+
arrayFormulaRange: Record<string, Record<string, Record<number, Record<number, IRange>>>>;
|
|
50
|
+
cycleDependencies: ICycleDependencyInfo[];
|
|
51
|
+
errors: IExecutionError[];
|
|
52
|
+
}
|
|
53
|
+
export interface ICycleDependencyInfo {
|
|
54
|
+
unitId: string;
|
|
55
|
+
sheetId: string;
|
|
56
|
+
row: number;
|
|
57
|
+
column: number;
|
|
58
|
+
}
|
|
59
|
+
export interface IExecutionError {
|
|
60
|
+
unitId: string;
|
|
61
|
+
sheetId: string;
|
|
62
|
+
row: number;
|
|
63
|
+
column: number;
|
|
64
|
+
message: string;
|
|
65
|
+
}
|
|
66
|
+
export interface IRustEngineSnapshot {
|
|
67
|
+
workbooks: IRustWorkbookSnapshot[];
|
|
68
|
+
}
|
|
69
|
+
export interface IRustWorkbookSnapshot {
|
|
70
|
+
unitId: string;
|
|
71
|
+
name?: string;
|
|
72
|
+
sheets: IRustSheetSnapshot[];
|
|
73
|
+
calculation?: IRustWorkbookCalculationSnapshot;
|
|
74
|
+
resources?: Record<string, IRustResourceSnapshot>;
|
|
75
|
+
definedNames?: Record<string, IRustDefinedNameSnapshot>;
|
|
76
|
+
externalLinks?: IRustExternalLinkSnapshot[];
|
|
77
|
+
tables?: Record<string, IRustTableSnapshot>;
|
|
78
|
+
}
|
|
79
|
+
export interface IRustResourceSnapshot {
|
|
80
|
+
name: string;
|
|
81
|
+
data: unknown;
|
|
82
|
+
}
|
|
83
|
+
export interface IRustWorkbookCalculationSnapshot {
|
|
84
|
+
fullPrecision?: boolean;
|
|
85
|
+
}
|
|
86
|
+
export interface IRustExternalLinkSnapshot {
|
|
87
|
+
aliases?: string[];
|
|
88
|
+
definedNames?: Record<string, IRustDefinedNameSnapshot>;
|
|
89
|
+
sheets: IRustExternalSheetSnapshot[];
|
|
90
|
+
tables?: Record<string, IRustTableSnapshot>;
|
|
91
|
+
target?: string;
|
|
92
|
+
unitId?: string;
|
|
93
|
+
}
|
|
94
|
+
export interface IRustExternalSheetSnapshot {
|
|
95
|
+
name: string;
|
|
96
|
+
sheetId?: string;
|
|
97
|
+
rowCount: number;
|
|
98
|
+
columnCount: number;
|
|
99
|
+
cellData: Record<number, Record<number, ICellValue>>;
|
|
100
|
+
coverage?: IRange[];
|
|
101
|
+
}
|
|
102
|
+
export interface IRustDefinedNameSnapshot {
|
|
103
|
+
id?: string;
|
|
104
|
+
name: string;
|
|
105
|
+
formulaOrRefString?: string;
|
|
106
|
+
localSheetId?: string;
|
|
107
|
+
}
|
|
108
|
+
export interface IRustTableSnapshot {
|
|
109
|
+
sheetId: string;
|
|
110
|
+
range: {
|
|
111
|
+
startRow: number;
|
|
112
|
+
endRow: number;
|
|
113
|
+
startColumn: number;
|
|
114
|
+
endColumn: number;
|
|
115
|
+
};
|
|
116
|
+
columns: Array<{
|
|
117
|
+
displayName: string;
|
|
118
|
+
}>;
|
|
119
|
+
showHeader?: boolean;
|
|
120
|
+
showFooter?: boolean;
|
|
121
|
+
}
|
|
122
|
+
export interface IRustSheetSnapshot {
|
|
123
|
+
sheetId: string;
|
|
124
|
+
name?: string;
|
|
125
|
+
rowCount: number;
|
|
126
|
+
columnCount: number;
|
|
127
|
+
transitionEvaluation?: boolean;
|
|
128
|
+
cellData: Record<number, Record<number, ICellValue>>;
|
|
129
|
+
rowData?: Record<number, IRustVisibilityData>;
|
|
130
|
+
columnData?: Record<number, IRustVisibilityData>;
|
|
131
|
+
}
|
|
132
|
+
export interface IRustVisibilityData {
|
|
133
|
+
hd?: unknown;
|
|
134
|
+
}
|
|
135
|
+
export interface IRustEngineMutation {
|
|
136
|
+
id: string;
|
|
137
|
+
params?: unknown;
|
|
138
|
+
dirtyRanges?: unknown[];
|
|
139
|
+
}
|
|
140
|
+
export interface IRustEngineModelStats {
|
|
141
|
+
workbookCount: number;
|
|
142
|
+
sheetCount: number;
|
|
143
|
+
cellCount: number;
|
|
144
|
+
formulaCount: number;
|
|
145
|
+
definedNameCount: number;
|
|
146
|
+
tableCount: number;
|
|
147
|
+
typedValueCount: number;
|
|
148
|
+
jsonValueCount: number;
|
|
149
|
+
valueTileCount: number;
|
|
150
|
+
valueTileValueCount: number;
|
|
151
|
+
estimatedMemoryBytes: number;
|
|
152
|
+
revision: number;
|
|
153
|
+
applied: boolean;
|
|
154
|
+
}
|
|
155
|
+
export interface IRustSheetState {
|
|
156
|
+
rowCount: number;
|
|
157
|
+
columnCount: number;
|
|
158
|
+
hiddenRows: number[];
|
|
159
|
+
hiddenCols: number[];
|
|
160
|
+
revision: number;
|
|
161
|
+
}
|
|
162
|
+
export interface IRustFormulaStoreState {
|
|
163
|
+
formulaData: Record<string, Record<string, Record<number, Record<number, IRustFormulaDataItem>>>>;
|
|
164
|
+
arrayFormulaRange: Record<string, Record<string, Record<number, Record<number, IRange>>>>;
|
|
165
|
+
arrayFormulaCellData: Record<string, Record<string, Record<number, Record<number, ICellValue>>>>;
|
|
166
|
+
}
|
|
167
|
+
export interface IRustFormulaDataItem {
|
|
168
|
+
f: string;
|
|
169
|
+
si?: string;
|
|
170
|
+
ref?: string;
|
|
171
|
+
x?: number;
|
|
172
|
+
y?: number;
|
|
173
|
+
}
|
|
174
|
+
export interface IRustDependencyCell {
|
|
175
|
+
unitId: string;
|
|
176
|
+
sheetId: string;
|
|
177
|
+
row: number;
|
|
178
|
+
column: number;
|
|
179
|
+
}
|
|
180
|
+
export interface IRustDependencyRange {
|
|
181
|
+
unitId: string;
|
|
182
|
+
sheetId: string;
|
|
183
|
+
startRow: number;
|
|
184
|
+
endRow: number;
|
|
185
|
+
startColumn: number;
|
|
186
|
+
endColumn: number;
|
|
187
|
+
}
|
|
188
|
+
export interface IRustDependencyNode {
|
|
189
|
+
id: number;
|
|
190
|
+
unitId: string;
|
|
191
|
+
sheetId: string;
|
|
192
|
+
row: number;
|
|
193
|
+
column: number;
|
|
194
|
+
formula: string;
|
|
195
|
+
formulaId?: string;
|
|
196
|
+
offsetX: number;
|
|
197
|
+
offsetY: number;
|
|
198
|
+
precedentRanges: IRustDependencyRange[];
|
|
199
|
+
parents: number[];
|
|
200
|
+
children: number[];
|
|
201
|
+
dependents: IRustDependencyCell[];
|
|
202
|
+
}
|
|
203
|
+
export interface IRustDependencyGraph {
|
|
204
|
+
stats: {
|
|
205
|
+
formulaCount: number;
|
|
206
|
+
precedentRangeCount: number;
|
|
207
|
+
formulaEdgeCount: number;
|
|
208
|
+
cycleCount: number;
|
|
209
|
+
errorCount: number;
|
|
210
|
+
};
|
|
211
|
+
nodes: IRustDependencyNode[];
|
|
212
|
+
edges: Array<{
|
|
213
|
+
from: IRustDependencyCell;
|
|
214
|
+
to: IRustDependencyCell;
|
|
215
|
+
}>;
|
|
216
|
+
calculationOrder: IRustDependencyCell[];
|
|
217
|
+
calculationForest: IRustDependencyCalculationTree[];
|
|
218
|
+
cycles: IRustDependencyCell[][];
|
|
219
|
+
errors: Array<{
|
|
220
|
+
unitId: string;
|
|
221
|
+
sheetId: string;
|
|
222
|
+
row: number;
|
|
223
|
+
column: number;
|
|
224
|
+
formula: string;
|
|
225
|
+
message: string;
|
|
226
|
+
}>;
|
|
227
|
+
}
|
|
228
|
+
export interface IRustDependencyCalculationTree {
|
|
229
|
+
hasCycle: boolean;
|
|
230
|
+
plan: IRustDependencyCalculationPlanItem[];
|
|
231
|
+
levels: IRustDependencyCell[][];
|
|
232
|
+
}
|
|
233
|
+
export type IRustDependencyCalculationPlanItem = {
|
|
234
|
+
type: 'nodes';
|
|
235
|
+
cells: IRustDependencyCell[];
|
|
236
|
+
} | {
|
|
237
|
+
type: 'cycle';
|
|
238
|
+
cells: IRustDependencyCell[];
|
|
239
|
+
};
|
|
240
|
+
export interface IRustDependencyDirtyResult {
|
|
241
|
+
dirtyRanges: IRustDependencyRange[];
|
|
242
|
+
direct: IRustDependencyCell[];
|
|
243
|
+
affected: IRustDependencyCell[];
|
|
244
|
+
calculationForest: IRustDependencyCalculationTree[];
|
|
245
|
+
cycles: IRustDependencyCell[][];
|
|
246
|
+
errors: IRustDependencyGraph['errors'];
|
|
247
|
+
}
|
|
248
|
+
export interface IRustFormulaDependencySyncInput {
|
|
249
|
+
rebuildSheetFormulas?: boolean;
|
|
250
|
+
featureCalculations?: IRustExternalFeatureCalculation[];
|
|
251
|
+
otherFormulas?: IRustExternalOtherFormula[];
|
|
252
|
+
}
|
|
253
|
+
export interface IRustExternalFeatureCalculation {
|
|
254
|
+
unitId: string;
|
|
255
|
+
sheetId: string;
|
|
256
|
+
featureId: string;
|
|
257
|
+
dependencyRanges: IRustDependencyRange[];
|
|
258
|
+
dirtyRanges?: IRustDependencyRange[];
|
|
259
|
+
runtimeCellData?: Record<string, Record<string, Record<number, Record<number, ICellValue | null>>>>;
|
|
260
|
+
}
|
|
261
|
+
export interface IRustExternalOtherFormula {
|
|
262
|
+
unitId: string;
|
|
263
|
+
sheetId: string;
|
|
264
|
+
formulaId: string;
|
|
265
|
+
formula: string;
|
|
266
|
+
ranges: IRange[];
|
|
267
|
+
}
|
|
268
|
+
export interface IRustFormulaDependencyDirtyInput {
|
|
269
|
+
forceCalculation?: boolean;
|
|
270
|
+
includeDirtyNodes?: boolean;
|
|
271
|
+
includeCalculationOrder?: boolean;
|
|
272
|
+
dirtyFormulaCells?: IRustDependencyRange[];
|
|
273
|
+
dirtyRanges?: IRustDependencyRange[];
|
|
274
|
+
dirtyUnitFeatureMap?: Record<string, Record<string, Record<string, boolean>>>;
|
|
275
|
+
dirtyUnitOtherFormulaMap?: Record<string, Record<string, Record<string, boolean>>>;
|
|
276
|
+
dirtyNameMap?: Record<string, Record<string, string>>;
|
|
277
|
+
dirtyDefinedNameMap?: Record<string, Record<string, string>>;
|
|
278
|
+
}
|
|
279
|
+
export interface IRustFormulaDependencyClearInput {
|
|
280
|
+
unitId: string;
|
|
281
|
+
sheetId?: string;
|
|
282
|
+
clearSheetFormulas?: boolean;
|
|
283
|
+
clearFeatureFormulas?: boolean;
|
|
284
|
+
clearOtherFormulas?: boolean;
|
|
285
|
+
formulaCells?: Array<{
|
|
286
|
+
row: number;
|
|
287
|
+
col: number;
|
|
288
|
+
}>;
|
|
289
|
+
featureIds?: string[];
|
|
290
|
+
otherFormulaIds?: string[];
|
|
291
|
+
}
|
|
292
|
+
export interface IRustFormulaDependencySyncOutput {
|
|
293
|
+
sheetFormulaCount: number;
|
|
294
|
+
featureFormulaCount: number;
|
|
295
|
+
otherFormulaCount: number;
|
|
296
|
+
errorCount: number;
|
|
297
|
+
errors: IRustDependencyGraph['errors'];
|
|
298
|
+
timings?: {
|
|
299
|
+
dependencyInputMs: number;
|
|
300
|
+
featureSyncMs: number;
|
|
301
|
+
analyzeMs: number;
|
|
302
|
+
cacheInsertMs: number;
|
|
303
|
+
graphSetMs: number;
|
|
304
|
+
dynamicPrewarmMs: number;
|
|
305
|
+
dynamicApplyMs: number;
|
|
306
|
+
otherFormulaMs: number;
|
|
307
|
+
totalMs: number;
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
export interface IRustFormulaDependencyNodeOutput {
|
|
311
|
+
nodeType: 'cellFormula' | 'featureCalculation' | 'otherFormula';
|
|
312
|
+
label: string;
|
|
313
|
+
unitId?: string;
|
|
314
|
+
sheetId?: string;
|
|
315
|
+
row?: number;
|
|
316
|
+
column?: number;
|
|
317
|
+
formulaId?: string;
|
|
318
|
+
featureId?: string;
|
|
319
|
+
refOffsetX?: number;
|
|
320
|
+
refOffsetY?: number;
|
|
321
|
+
}
|
|
322
|
+
export interface IRustFormulaDependencyInspectGraph {
|
|
323
|
+
nodes: IRustFormulaDependencyInspectNode[];
|
|
324
|
+
}
|
|
325
|
+
export interface IRustFormulaDependencyInspectNode {
|
|
326
|
+
index: number;
|
|
327
|
+
node: IRustFormulaDependencyNodeOutput;
|
|
328
|
+
label: string;
|
|
329
|
+
precedents: string[];
|
|
330
|
+
dependents: string[];
|
|
331
|
+
}
|
|
332
|
+
export interface IRustFormulaDependencyDirtyOutput {
|
|
333
|
+
dirtyNodes: IRustFormulaDependencyNodeOutput[];
|
|
334
|
+
calculationOrder: {
|
|
335
|
+
hasCycle: boolean;
|
|
336
|
+
calculationForest: Array<{
|
|
337
|
+
hasCycle: boolean;
|
|
338
|
+
plan: Array<{
|
|
339
|
+
type: string;
|
|
340
|
+
nodeIndex?: number;
|
|
341
|
+
nodeIndices?: number[];
|
|
342
|
+
}>;
|
|
343
|
+
levels: number[][];
|
|
344
|
+
}>;
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
export interface IRustFormulaDependencyExecutionOutput {
|
|
348
|
+
runtimeData: Record<string, Record<string, Record<number, Record<number, unknown>>>>;
|
|
349
|
+
otherFormulaData?: Record<string, Record<string, Record<string, Record<number, Record<number, unknown>>>>>;
|
|
350
|
+
resultBatches: Array<{
|
|
351
|
+
unitId: string;
|
|
352
|
+
sheetId: string;
|
|
353
|
+
rows: number[];
|
|
354
|
+
cols: number[];
|
|
355
|
+
values: unknown[];
|
|
356
|
+
}>;
|
|
357
|
+
calculatedNodes: IRustFormulaDependencyNodeOutput[];
|
|
358
|
+
calculatedNodeCount: number;
|
|
359
|
+
errors: Array<{
|
|
360
|
+
unitId: string;
|
|
361
|
+
sheetId: string;
|
|
362
|
+
row: number;
|
|
363
|
+
column: number;
|
|
364
|
+
message: string;
|
|
365
|
+
}>;
|
|
366
|
+
needsData?: Array<{
|
|
367
|
+
unitId: string;
|
|
368
|
+
sheetId: string;
|
|
369
|
+
range: IRange;
|
|
370
|
+
}>;
|
|
371
|
+
hasCycle: boolean;
|
|
372
|
+
cycleIterationCount: number;
|
|
373
|
+
parallelBatchCount: number;
|
|
374
|
+
parallelNodeCount: number;
|
|
375
|
+
functionProfile?: Array<{
|
|
376
|
+
name: string;
|
|
377
|
+
callCount: number;
|
|
378
|
+
totalMs: number;
|
|
379
|
+
avgUs: number;
|
|
380
|
+
}>;
|
|
381
|
+
timings: {
|
|
382
|
+
initialDynamicRefreshMs: number;
|
|
383
|
+
initialDynamicRefreshRequestCount: number;
|
|
384
|
+
buildValueDataMs: number;
|
|
385
|
+
planningMs: number;
|
|
386
|
+
taskBuildMs: number;
|
|
387
|
+
evaluateMs: number;
|
|
388
|
+
applyMs: number;
|
|
389
|
+
applyResultMaterializeMs: number;
|
|
390
|
+
applyValueDataMs: number;
|
|
391
|
+
applyWorkbookMs: number;
|
|
392
|
+
applyRuntimeDynamicPatchMs: number;
|
|
393
|
+
clearDirtyMs: number;
|
|
394
|
+
runtimeDynamicRefreshMs: number;
|
|
395
|
+
runtimeDynamicRefreshRequestCount: number;
|
|
396
|
+
finalOutputMs: number;
|
|
397
|
+
};
|
|
398
|
+
}
|