@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,28 @@
|
|
|
1
|
+
import type { IBaseSnapshot, IExecutionOptions, IMutationInfo, IWorkbookData } from '@univerjs/core';
|
|
2
|
+
import type { IRemoteInstanceService } from '@univerjs/rpc';
|
|
3
|
+
import { ICommandService, UniverInstanceType } from '@univerjs/core';
|
|
4
|
+
import { RustEngineSyncController } from '../controllers/rust-engine-sync.controller.js';
|
|
5
|
+
/**
|
|
6
|
+
* Optional worker-side adapter for the no-worker-Workbook runtime.
|
|
7
|
+
*
|
|
8
|
+
* Hosts can register this implementation for `IRemoteInstanceService` instead
|
|
9
|
+
* of `WebWorkerRemoteInstanceService` when Rust owns the formula projection.
|
|
10
|
+
*/
|
|
11
|
+
export declare class RustProjectionRemoteInstanceService implements IRemoteInstanceService {
|
|
12
|
+
private readonly _syncController;
|
|
13
|
+
private readonly _commandService;
|
|
14
|
+
constructor(_syncController: RustEngineSyncController, _commandService: ICommandService);
|
|
15
|
+
whenReady(): Promise<true>;
|
|
16
|
+
createInstance(params: {
|
|
17
|
+
unitID: string;
|
|
18
|
+
type: UniverInstanceType;
|
|
19
|
+
snapshot: IBaseSnapshot | IWorkbookData;
|
|
20
|
+
}): Promise<boolean>;
|
|
21
|
+
disposeInstance(params: {
|
|
22
|
+
unitID: string;
|
|
23
|
+
}): Promise<boolean>;
|
|
24
|
+
syncMutation(params: {
|
|
25
|
+
mutationInfo: IMutationInfo;
|
|
26
|
+
}, options?: IExecutionOptions): Promise<boolean>;
|
|
27
|
+
private _shouldExecuteOnWorkerFormulaRuntime;
|
|
28
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loads the native Rust binding (NAPI on Node.js, WASM in browser).
|
|
3
|
+
*/
|
|
4
|
+
import type { Buffer } from 'node:buffer';
|
|
5
|
+
export interface INativeBinding {
|
|
6
|
+
formulaEngineExecute(inputJson: string): string;
|
|
7
|
+
formulaLexerTreeBuild(formula: string, transformSuffix?: boolean): string;
|
|
8
|
+
formulaSequenceNodesBuild(formula: string): string;
|
|
9
|
+
formulaCheckIfAddBracket(formula: string): number;
|
|
10
|
+
rustNumfmtFormat(inputJson: string): string;
|
|
11
|
+
rustNumfmtFormatBatch(inputJson: string): string;
|
|
12
|
+
rustNumfmtParse(inputJson: string): string;
|
|
13
|
+
rustNumfmtParseBatch(inputJson: string): string;
|
|
14
|
+
rustNumfmtParseMatrixBatch(inputJson: string): string;
|
|
15
|
+
rustNumfmtParseValue(inputJson: string): string;
|
|
16
|
+
rustNumfmtAnalyzeFormat(inputJson: string): string;
|
|
17
|
+
rustNumfmtAnalyzeBatch(inputJson: string): string;
|
|
18
|
+
rustNumfmtFormatInfo(inputJson: string): string;
|
|
19
|
+
rustNumfmtFormatDateInfo(inputJson: string): string;
|
|
20
|
+
rustNumfmtFormatColor(inputJson: string): string;
|
|
21
|
+
rustNumfmtDateToSerial(inputJson: string): string;
|
|
22
|
+
rustNumfmtDateFromSerial(inputJson: string): string;
|
|
23
|
+
rustNumfmtValidate(inputJson: string): string;
|
|
24
|
+
rustEngineLoadSnapshot(snapshotJson: string): string;
|
|
25
|
+
rustEngineLoadSnapshotBinary(snapshotBytes: Buffer): string;
|
|
26
|
+
rustEngineLoadSingleSheetColumnarSnapshot(unitId: string, workbookName: string | undefined | null, sheetId: string, sheetName: string | undefined | null, rowCount: number, columnCount: number, rows: Buffer, cols: Buffer, valueTags: Buffer, numbers: Buffer, valueStringOffsets: Buffer, valueStringBytes: Buffer, formulaOffsets: Buffer, formulaBytes: Buffer): string;
|
|
27
|
+
rustEngineApplyMutation(mutationJson: string): string;
|
|
28
|
+
rustEngineApplyMutationBinary(mutationBytes: Buffer): string;
|
|
29
|
+
rustEngineApplyNumberCellsColumnar(unitId: string, sheetId: string, rows: Buffer, cols: Buffer, values: Buffer): string;
|
|
30
|
+
rustEngineDisposeWorkbook(unitId: string): string;
|
|
31
|
+
rustEngineDisposeAllWorkbooks(): string;
|
|
32
|
+
rustEngineGetModelStats(): string;
|
|
33
|
+
rustEngineGetCell(unitId: string, sheetId: string, row: number, col: number): string;
|
|
34
|
+
rustEngineGetSheetState(unitId: string, sheetId: string): string;
|
|
35
|
+
rustEngineGetFormulaData(unitId?: string): string;
|
|
36
|
+
rustEngineBuildDependencyGraph(unitId?: string): string;
|
|
37
|
+
rustEngineGetDirtyDependencies(dirtyRangesJson: string, unitId?: string): string;
|
|
38
|
+
rustEngineSyncFormulaDependencies(inputJson: string): string;
|
|
39
|
+
rustEngineInspectFormulaDependencyGraph(): string;
|
|
40
|
+
rustEngineMarkFormulaDirty(inputJson: string): string;
|
|
41
|
+
rustEngineClearFormulaDependencies(inputJson: string): string;
|
|
42
|
+
rustEngineClearFormulaDirty(): string;
|
|
43
|
+
rustEngineExecuteDirtyFormulas(maxIteration?: number, includeCalculatedNodes?: boolean, includeRuntimeData?: boolean, includeResultBatches?: boolean): string;
|
|
44
|
+
rustEngineGetFormulaNumberResultsColumnar(unitId: string, sheetId: string, startColumn?: number, endColumn?: number): Buffer;
|
|
45
|
+
rustMaterializeWorkbookSnapshot(workbookJson: Buffer, unitId: string, rev: number, dirtyInputJson?: string): Promise<INativeMaterializedWorkbook>;
|
|
46
|
+
}
|
|
47
|
+
export interface INativeMaterializedBlock {
|
|
48
|
+
id: string;
|
|
49
|
+
startRow: number;
|
|
50
|
+
endRow: number;
|
|
51
|
+
data: Buffer;
|
|
52
|
+
}
|
|
53
|
+
export interface INativeMaterializedSheetBlocks {
|
|
54
|
+
sheetId: string;
|
|
55
|
+
blocks: INativeMaterializedBlock[];
|
|
56
|
+
}
|
|
57
|
+
export interface INativeMaterializedWorkbook {
|
|
58
|
+
snapshotDraftJson: Buffer;
|
|
59
|
+
sheetBlocks: INativeMaterializedSheetBlocks[];
|
|
60
|
+
warningsJson: Buffer;
|
|
61
|
+
calculationStatsJson: Buffer;
|
|
62
|
+
}
|
|
63
|
+
export type NativeBindingSource = '../native/index.js' | '../../../crates/univer-formula/index.js' | '@univerjs-pro/engine-formula-rust-binding';
|
|
64
|
+
export declare function getNativeBindingSource(): NativeBindingSource | null;
|
|
65
|
+
export declare function loadNativeBinding(): Promise<INativeBinding>;
|
|
66
|
+
export declare function executeOnRust(inputJson: string): string;
|
|
67
|
+
export declare function buildLexerTreeOnRust(formula: string, transformSuffix?: boolean): string;
|
|
68
|
+
export declare function buildSequenceNodesOnRust(formula: string): string;
|
|
69
|
+
export declare function checkIfAddBracketOnRust(formula: string): number;
|
|
70
|
+
export declare function formatNumberOnRust(inputJson: string): string;
|
|
71
|
+
export declare function formatNumberBatchOnRust(inputJson: string): string;
|
|
72
|
+
export declare function parseNumberFormatInputOnRust(inputJson: string): string;
|
|
73
|
+
export declare function parseNumberFormatInputBatchOnRust(inputJson: string): string;
|
|
74
|
+
export declare function parseNumberFormatMatrixBatchOnRust(inputJson: string): string;
|
|
75
|
+
export declare function parseNumberFormatValueOnRust(inputJson: string): string;
|
|
76
|
+
export declare function analyzeNumberFormatOnRust(inputJson: string): string;
|
|
77
|
+
export declare function analyzeNumberFormatBatchOnRust(inputJson: string): string;
|
|
78
|
+
export declare function getNumberFormatInfoOnRust(inputJson: string): string;
|
|
79
|
+
export declare function getNumberFormatDateInfoOnRust(inputJson: string): string;
|
|
80
|
+
export declare function getNumberFormatColorOnRust(inputJson: string): string;
|
|
81
|
+
export declare function dateToSerialOnRust(inputJson: string): string;
|
|
82
|
+
export declare function dateFromSerialOnRust(inputJson: string): string;
|
|
83
|
+
export declare function validateNumberFormatInputOnRust(inputJson: string): string;
|
|
84
|
+
export declare function loadSnapshotOnRust(snapshotJson: string): string;
|
|
85
|
+
export declare function loadSnapshotBinaryOnRust(snapshotBytes: Buffer): string;
|
|
86
|
+
export declare function loadSingleSheetColumnarSnapshotOnRust(unitId: string, workbookName: string | undefined | null, sheetId: string, sheetName: string | undefined | null, rowCount: number, columnCount: number, rows: Buffer, cols: Buffer, valueTags: Buffer, numbers: Buffer, valueStringOffsets: Buffer, valueStringBytes: Buffer, formulaOffsets: Buffer, formulaBytes: Buffer): string;
|
|
87
|
+
export declare function applyMutationOnRust(mutationJson: string): string;
|
|
88
|
+
export declare function applyMutationBinaryOnRust(mutationBytes: Buffer): string;
|
|
89
|
+
export declare function applyNumberCellsColumnarOnRust(unitId: string, sheetId: string, rows: Buffer, cols: Buffer, values: Buffer): string;
|
|
90
|
+
export declare function disposeWorkbookOnRust(unitId: string): string;
|
|
91
|
+
export declare function disposeAllWorkbooksOnRust(): string;
|
|
92
|
+
export declare function getRustModelStats(): string;
|
|
93
|
+
export declare function getRustCellOnRust(unitId: string, sheetId: string, row: number, col: number): string;
|
|
94
|
+
export declare function getRustSheetStateOnRust(unitId: string, sheetId: string): string;
|
|
95
|
+
export declare function getRustFormulaDataOnRust(unitId?: string): string;
|
|
96
|
+
export declare function buildRustDependencyGraphOnRust(unitId?: string): string;
|
|
97
|
+
export declare function getRustDirtyDependenciesOnRust(dirtyRangesJson: string, unitId?: string): string;
|
|
98
|
+
export declare function syncRustFormulaDependenciesOnRust(inputJson: string): string;
|
|
99
|
+
export declare function inspectRustFormulaDependencyGraphOnRust(): string;
|
|
100
|
+
export declare function markRustFormulaDirtyOnRust(inputJson: string): string;
|
|
101
|
+
export declare function clearRustFormulaDependenciesOnRust(inputJson: string): string;
|
|
102
|
+
export declare function clearRustFormulaDirtyOnRust(): string;
|
|
103
|
+
export declare function executeDirtyFormulasOnRust(maxIteration?: number, includeCalculatedNodes?: boolean, includeRuntimeData?: boolean, includeResultBatches?: boolean): string;
|
|
104
|
+
export declare function getFormulaNumberResultsColumnarOnRust(unitId: string, sheetId: string, startColumn?: number, endColumn?: number): Buffer;
|
|
105
|
+
export declare function materializeWorkbookSnapshotOnRust(workbookJson: Buffer, unitId: string, rev: number, dirtyInputJson?: string): Promise<INativeMaterializedWorkbook>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { IFormulaDatasetConfig } from '@univerjs/engine-formula';
|
|
2
|
+
import type { IRustEngineMutation, IRustFormulaDependencyExecutionOutput } from '../types.js';
|
|
3
|
+
import { Disposable, ICommandService } from '@univerjs/core';
|
|
4
|
+
import { type IRustProjectionWorkbookInput } from '../services/rust-formula-projection.service.js';
|
|
5
|
+
interface IRustEngineSyncState {
|
|
6
|
+
snapshotEpoch: number;
|
|
7
|
+
dependencyInvalidationEpoch: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function getRustEngineSyncState(): IRustEngineSyncState;
|
|
10
|
+
/**
|
|
11
|
+
* Keeps Rust's in-memory formula workbook projection aligned with Univer.
|
|
12
|
+
*
|
|
13
|
+
* Rust projection loading is host-driven: the main/runtime adapter provides the
|
|
14
|
+
* initial workbook snapshot and subsequent formula-relevant mutations. This
|
|
15
|
+
* controller intentionally does not create or read worker-side Workbook units.
|
|
16
|
+
*/
|
|
17
|
+
export declare class RustEngineSyncController extends Disposable {
|
|
18
|
+
private readonly _commandService;
|
|
19
|
+
private _nativeReady;
|
|
20
|
+
private _snapshotLoaded;
|
|
21
|
+
private _projectionLoadPromise;
|
|
22
|
+
private readonly _pendingMutations;
|
|
23
|
+
constructor(_commandService: ICommandService);
|
|
24
|
+
private _initialize;
|
|
25
|
+
loadProjection(workbooks: readonly IRustProjectionWorkbookInput[]): Promise<void>;
|
|
26
|
+
waitForProjectionLoad(): Promise<void>;
|
|
27
|
+
private _loadProjection;
|
|
28
|
+
applyProjectionMutation(mutation: IRustEngineMutation): void;
|
|
29
|
+
upsertReferenceData(config: IFormulaDatasetConfig, needs: NonNullable<IRustFormulaDependencyExecutionOutput['needsData']>): number;
|
|
30
|
+
disposeProjectionWorkbook(unitId: string): void;
|
|
31
|
+
dispose(): void;
|
|
32
|
+
private _loadSerializedSnapshot;
|
|
33
|
+
private _queueOrSyncMutation;
|
|
34
|
+
private _flushPendingMutations;
|
|
35
|
+
private _syncMutation;
|
|
36
|
+
private _markProjectionDesynced;
|
|
37
|
+
private _shouldSyncMutation;
|
|
38
|
+
private _serializeMutation;
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ISuperTableService as ISuperTableServiceType } from '@univerjs/engine-formula';
|
|
2
|
+
import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
|
|
3
|
+
import { FormulaDataModel } from '@univerjs/engine-formula';
|
|
4
|
+
import { RustEngineSyncController } from './rust-engine-sync.controller.js';
|
|
5
|
+
/**
|
|
6
|
+
* Loads Rust projection from the same Univer runtime that owns calculation.
|
|
7
|
+
*
|
|
8
|
+
* This is for headless/same-runtime hosts. It does not recover from worker
|
|
9
|
+
* Workbook snapshots and does not reload on mutation errors.
|
|
10
|
+
*/
|
|
11
|
+
export declare class RustSameRuntimeProjectionController extends Disposable {
|
|
12
|
+
private readonly _univerInstanceService;
|
|
13
|
+
private readonly _rustEngineSyncController;
|
|
14
|
+
private readonly _formulaDataModel;
|
|
15
|
+
private readonly _superTableService;
|
|
16
|
+
private readonly _commandService;
|
|
17
|
+
private _projectionReload;
|
|
18
|
+
private _projectionReloadRequested;
|
|
19
|
+
constructor(_univerInstanceService: IUniverInstanceService, _rustEngineSyncController: RustEngineSyncController, _formulaDataModel: FormulaDataModel, _superTableService: ISuperTableServiceType, _commandService: ICommandService);
|
|
20
|
+
private _initialize;
|
|
21
|
+
private _scheduleProjectionReload;
|
|
22
|
+
private _drainProjectionReloads;
|
|
23
|
+
private _loadAllWorkbookProjections;
|
|
24
|
+
private _createBaseWorkbookProjection;
|
|
25
|
+
private _createBaseTableResource;
|
|
26
|
+
private _rawCellData;
|
|
27
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { applyMutationOnRust, buildRustDependencyGraphOnRust, buildLexerTreeOnRust, buildSequenceNodesOnRust, checkIfAddBracketOnRust, disposeAllWorkbooksOnRust, disposeWorkbookOnRust, executeOnRust, getRustCellOnRust, getRustFormulaDataOnRust, getRustDirtyDependenciesOnRust, getRustModelStats, getRustSheetStateOnRust, getNativeBindingSource, loadNativeBinding, loadSnapshotOnRust, materializeWorkbookSnapshotOnRust, syncRustFormulaDependenciesOnRust, markRustFormulaDirtyOnRust, clearRustFormulaDependenciesOnRust, clearRustFormulaDirtyOnRust, } from './binding.js';
|
|
2
|
+
export { RustEngineSyncController } from './controllers/rust-engine-sync.controller.js';
|
|
3
|
+
export { analyzeNumberFormatBatch, formatNumberBatch, parseNumberFormatBatch, parseNumberFormatMatrixBatch, } from './numfmt.js';
|
|
4
|
+
export type { IAnalyzeNumberFormatBatchInput, IAnalyzeNumberFormatBatchOutput, IFormatNumberBatchInput, IFormatNumberBatchOutput, INumberFormatAnalysis, INumberFormatDiagnostic, INumberFormatOptions, IObjectArrayPrimitiveType, IObjectMatrixPrimitiveType, IParsedNumberFormatValue, IParsedNumberFormatMatrixValue, IParseNumberFormatBatchInput, IParseNumberFormatBatchOutput, IParseNumberFormatMatrixBatchInput, IParseNumberFormatMatrixBatchOutput, IParseNumberFormatMatrixCell, NumberFormatDateSystem, } from './numfmt.js';
|
|
5
|
+
export { type IUniverRustFormulaEngineConfig, UniverRustFormulaEnginePlugin } from './plugin.js';
|
|
6
|
+
export { IRustCalculateFormulaService, RustCalculateFormulaService } from './services/calculate-formula.service.js';
|
|
7
|
+
export { materializeWorkbookSnapshot, type IMaterializationCalculationStats, type IMaterializedWorkbookSnapshot, } from './services/workbook-snapshot-materializer.js';
|
|
8
|
+
export { createFormulaProjectionDesyncSignal, isRustFormulaRelevantMutation, isRustIncrementalDependencyMutation, RUST_FORMULA_RELEVANT_MUTATIONS, RUST_INCREMENTAL_DEPENDENCY_MUTATIONS, RUST_UPSERT_REFERENCE_DATA_MUTATION_ID, RustFormulaProjectionService, rustExecutionOutputToFormulaCalculationPatch, serializeRuntimeWorkbookSnapshot, serializeRuntimeWorkbookSnapshots, } from './services/rust-formula-projection.service.js';
|
|
9
|
+
export * from './types.js';
|
|
10
|
+
export type { IFormulaCalculationError, IFormulaCalculationPatch, IFormulaProjectionDesyncSignal, IRustFormulaProjectionLoadResult, IRustFormulaProjectionMutationResult, IRustProjectionWorkbookInput, } from './services/rust-formula-projection.service.js';
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
export type NumberFormatDateSystem = '1900' | '1904';
|
|
2
|
+
export interface INumberFormatOptions {
|
|
3
|
+
locale?: string;
|
|
4
|
+
dateSystem?: NumberFormatDateSystem;
|
|
5
|
+
throws?: boolean;
|
|
6
|
+
invalid?: string;
|
|
7
|
+
overflow?: string;
|
|
8
|
+
dateErrorNumber?: boolean;
|
|
9
|
+
dateSpanLarge?: boolean;
|
|
10
|
+
leap1900?: boolean;
|
|
11
|
+
nbsp?: boolean;
|
|
12
|
+
skipChar?: string;
|
|
13
|
+
fillChar?: string;
|
|
14
|
+
bigintErrorNumber?: boolean;
|
|
15
|
+
ignoreTimezone?: boolean;
|
|
16
|
+
dateNf?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface INumberFormatDiagnostic {
|
|
19
|
+
code: string;
|
|
20
|
+
message?: string;
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
}
|
|
23
|
+
export interface IFormatNumberBatchInput {
|
|
24
|
+
formats: Array<{
|
|
25
|
+
id: number;
|
|
26
|
+
formatCode?: string;
|
|
27
|
+
numFmtId?: number;
|
|
28
|
+
options?: INumberFormatOptions;
|
|
29
|
+
}>;
|
|
30
|
+
values: Array<{
|
|
31
|
+
value: unknown;
|
|
32
|
+
valueType?: 'number' | 'text' | 'boolean' | 'date' | 'datetime' | 'bigint' | string;
|
|
33
|
+
formatId: number;
|
|
34
|
+
}>;
|
|
35
|
+
}
|
|
36
|
+
export interface IFormatNumberBatchOutput {
|
|
37
|
+
values: Array<{
|
|
38
|
+
text: string;
|
|
39
|
+
color?: string;
|
|
40
|
+
style?: unknown;
|
|
41
|
+
diagnostics: INumberFormatDiagnostic[];
|
|
42
|
+
}>;
|
|
43
|
+
timingsMs?: Record<string, number>;
|
|
44
|
+
}
|
|
45
|
+
export interface IParseNumberFormatBatchInput {
|
|
46
|
+
options: Array<INumberFormatOptions & {
|
|
47
|
+
id: number;
|
|
48
|
+
}>;
|
|
49
|
+
inputs: Array<{
|
|
50
|
+
input: string;
|
|
51
|
+
optionsId: number;
|
|
52
|
+
}>;
|
|
53
|
+
}
|
|
54
|
+
export interface IParsedNumberFormatValue {
|
|
55
|
+
number?: number;
|
|
56
|
+
text?: string;
|
|
57
|
+
boolean?: boolean;
|
|
58
|
+
}
|
|
59
|
+
export interface IParseNumberFormatBatchOutput {
|
|
60
|
+
values: Array<{
|
|
61
|
+
value: IParsedNumberFormatValue | null;
|
|
62
|
+
kind?: string;
|
|
63
|
+
inferredFormat?: string;
|
|
64
|
+
diagnostics: INumberFormatDiagnostic[];
|
|
65
|
+
}>;
|
|
66
|
+
timingsMs?: Record<string, number>;
|
|
67
|
+
}
|
|
68
|
+
export interface IObjectMatrixPrimitiveType<T> {
|
|
69
|
+
[key: number]: IObjectArrayPrimitiveType<T>;
|
|
70
|
+
}
|
|
71
|
+
export interface IObjectArrayPrimitiveType<T> {
|
|
72
|
+
[key: number]: T;
|
|
73
|
+
}
|
|
74
|
+
export interface IParseNumberFormatMatrixCell {
|
|
75
|
+
v?: unknown;
|
|
76
|
+
}
|
|
77
|
+
export interface IParseNumberFormatMatrixBatchInput {
|
|
78
|
+
option?: INumberFormatOptions;
|
|
79
|
+
matrix: IObjectMatrixPrimitiveType<IParseNumberFormatMatrixCell>;
|
|
80
|
+
}
|
|
81
|
+
export interface IParsedNumberFormatMatrixValue {
|
|
82
|
+
value: IParsedNumberFormatValue | null;
|
|
83
|
+
kind?: string;
|
|
84
|
+
inferredFormat?: string;
|
|
85
|
+
diagnostics: INumberFormatDiagnostic[];
|
|
86
|
+
}
|
|
87
|
+
export interface IParseNumberFormatMatrixBatchOutput {
|
|
88
|
+
values: IObjectMatrixPrimitiveType<IParsedNumberFormatMatrixValue>;
|
|
89
|
+
timingsMs?: Record<string, number>;
|
|
90
|
+
}
|
|
91
|
+
export interface IAnalyzeNumberFormatBatchInput {
|
|
92
|
+
formats: Array<{
|
|
93
|
+
id: number;
|
|
94
|
+
formatCode: string;
|
|
95
|
+
}>;
|
|
96
|
+
}
|
|
97
|
+
export interface INumberFormatAnalysis {
|
|
98
|
+
isDate?: boolean;
|
|
99
|
+
isTime?: boolean;
|
|
100
|
+
isPercent?: boolean;
|
|
101
|
+
isText?: boolean;
|
|
102
|
+
[key: string]: unknown;
|
|
103
|
+
}
|
|
104
|
+
export interface IAnalyzeNumberFormatBatchOutput {
|
|
105
|
+
values: Array<{
|
|
106
|
+
id: number;
|
|
107
|
+
analysis: INumberFormatAnalysis | null;
|
|
108
|
+
diagnostics: INumberFormatDiagnostic[];
|
|
109
|
+
}>;
|
|
110
|
+
timingsMs?: Record<string, number>;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Formats many values with the Rust number-format engine.
|
|
114
|
+
*
|
|
115
|
+
* The native binding is loaded lazily on the first call, so callers do not need
|
|
116
|
+
* to call `loadNativeBinding()` before using this API. Binding or transport
|
|
117
|
+
* failures reject the promise; per-item formatting issues are returned in each
|
|
118
|
+
* item's `diagnostics` array.
|
|
119
|
+
*/
|
|
120
|
+
export declare function formatNumberBatch(input: IFormatNumberBatchInput): Promise<IFormatNumberBatchOutput>;
|
|
121
|
+
/**
|
|
122
|
+
* Parses many user-entered number-format strings with the Rust engine.
|
|
123
|
+
*
|
|
124
|
+
* This API is pure data-in/data-out and does not apply Univer mutations. The
|
|
125
|
+
* native binding is loaded lazily on the first call. Binding or transport
|
|
126
|
+
* failures reject the promise; per-item parse issues are returned in each
|
|
127
|
+
* item's `diagnostics` array.
|
|
128
|
+
*/
|
|
129
|
+
export declare function parseNumberFormatBatch(input: IParseNumberFormatBatchInput): Promise<IParseNumberFormatBatchOutput>;
|
|
130
|
+
/**
|
|
131
|
+
* Parses string `v` values from a Univer-style sparse object matrix.
|
|
132
|
+
*
|
|
133
|
+
* Non-string values and empty strings are skipped and therefore omitted from
|
|
134
|
+
* the returned sparse matrix. Row and column coordinates are preserved.
|
|
135
|
+
*/
|
|
136
|
+
export declare function parseNumberFormatMatrixBatch(input: IParseNumberFormatMatrixBatchInput): Promise<IParseNumberFormatMatrixBatchOutput>;
|
|
137
|
+
/**
|
|
138
|
+
* Analyzes many number-format patterns with the Rust engine.
|
|
139
|
+
*
|
|
140
|
+
* The native binding is loaded lazily on the first call, so callers can use the
|
|
141
|
+
* API directly as a Promise-returning utility. Binding or transport failures
|
|
142
|
+
* reject the promise; per-pattern analysis issues are returned in each item's
|
|
143
|
+
* `diagnostics` array.
|
|
144
|
+
*/
|
|
145
|
+
export declare function analyzeNumberFormatBatch(input: IAnalyzeNumberFormatBatchInput): Promise<IAnalyzeNumberFormatBatchOutput>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Dependency } from '@univerjs/core';
|
|
2
|
+
import type { IUniverEngineFormulaConfig } from '@univerjs/engine-formula';
|
|
3
|
+
import { IConfigService, Injector } from '@univerjs/core';
|
|
4
|
+
import { UniverProFormulaEnginePlugin } from '@univerjs-pro/engine-formula';
|
|
5
|
+
export interface IUniverRustFormulaEngineConfig extends IUniverEngineFormulaConfig {
|
|
6
|
+
/**
|
|
7
|
+
* Whether to use the Rust-backed formula engine.
|
|
8
|
+
* @default true
|
|
9
|
+
*/
|
|
10
|
+
useRustEngine?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Plugin that swaps the formula calculation core for a Rust implementation.
|
|
14
|
+
*
|
|
15
|
+
* Inherits from UniverFormulaEnginePlugin to keep all non-calculation services
|
|
16
|
+
* (FormulaDataModel, IFunctionService, controllers, etc.) intact.
|
|
17
|
+
*
|
|
18
|
+
* On the worker thread it overrides ICalculateFormulaService with
|
|
19
|
+
* RustCalculateFormulaService which delegates heavy computation to the Rust
|
|
20
|
+
* NAPI module.
|
|
21
|
+
*/
|
|
22
|
+
export declare class UniverRustFormulaEnginePlugin extends UniverProFormulaEnginePlugin {
|
|
23
|
+
protected readonly _config: Partial<IUniverRustFormulaEngineConfig>;
|
|
24
|
+
protected readonly _injector: Injector;
|
|
25
|
+
protected readonly _configService: IConfigService;
|
|
26
|
+
static packageName: string;
|
|
27
|
+
static version: string;
|
|
28
|
+
constructor(_config: Partial<IUniverRustFormulaEngineConfig> | undefined, _injector: Injector, _configService: IConfigService);
|
|
29
|
+
onReady(): void;
|
|
30
|
+
/**
|
|
31
|
+
* UniverProFormulaEnginePlugin invokes this hook before its single DI
|
|
32
|
+
* registration pass.
|
|
33
|
+
*/
|
|
34
|
+
protected _extendFormulaExecutionDependencies(dependencies: Dependency[]): void;
|
|
35
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface FormulaArrayAnchor {
|
|
2
|
+
readonly endColumn: number;
|
|
3
|
+
readonly endRow: number;
|
|
4
|
+
readonly formula: string;
|
|
5
|
+
readonly startColumn: number;
|
|
6
|
+
readonly startRow: number;
|
|
7
|
+
}
|
|
8
|
+
export interface FormulaArrayFollowerComparable {
|
|
9
|
+
readonly syntheticArrayFollower?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function isIgnorableFormulaArrayFollowerExtra(value: FormulaArrayFollowerComparable | undefined): boolean;
|
|
12
|
+
export declare function parseFormulaArrayAnchor(ref: string, formula: string): FormulaArrayAnchor | undefined;
|
|
13
|
+
export declare function buildFormulaArrayAnchorRowIndex(anchors: readonly FormulaArrayAnchor[]): Map<number, readonly FormulaArrayAnchor[]>;
|
|
14
|
+
export declare function findFormulaArrayFollower(anchors: readonly FormulaArrayAnchor[], row: number, column: number): FormulaArrayAnchor | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface FormulaDependencyValue {
|
|
2
|
+
readonly sheetName: string;
|
|
3
|
+
readonly address: string;
|
|
4
|
+
readonly formula?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function buildVolatileRandomFormulaKeySet(values: readonly FormulaDependencyValue[]): Set<string>;
|
|
7
|
+
export declare function formulaValueKey(value: FormulaDependencyValue): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface CaseBoundedTimeoutInput {
|
|
2
|
+
readonly caseTimeoutMs: number;
|
|
3
|
+
readonly elapsedCaseMs: number;
|
|
4
|
+
readonly operationTimeoutMs: number;
|
|
5
|
+
readonly stageTimeoutMs?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function caseBoundedTimeoutMs(input: CaseBoundedTimeoutInput): number;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { RustOnlyExchangeBinaryProfile } from './rust-only-exchange-binary.js';
|
|
2
|
+
import type { RustOnlyFormulaCalculationMode } from './rust-only-report.js';
|
|
3
|
+
export type RustOnlyArtifactStaleReason = 'source-hash-changed' | 'rust-exchange-binary-path-changed' | 'rust-exchange-binary-profile-changed' | 'rust-exchange-binary-version-changed' | 'formula-mode-changed' | 'calc-chain-mode-changed' | 'runner-version-changed';
|
|
4
|
+
export interface RustOnlyArtifactFingerprint {
|
|
5
|
+
readonly sourceSha256: string;
|
|
6
|
+
readonly rustExchangeBinaryPath: string;
|
|
7
|
+
readonly rustExchangeBinaryVersion: string;
|
|
8
|
+
readonly formulaCalculationMode: RustOnlyFormulaCalculationMode;
|
|
9
|
+
readonly calcChainMode?: 'off' | 'trusted';
|
|
10
|
+
readonly runnerVersion: string;
|
|
11
|
+
}
|
|
12
|
+
export interface EvaluateRustOnlyArtifactFreshnessOptions {
|
|
13
|
+
readonly expected: RustOnlyArtifactFingerprint;
|
|
14
|
+
readonly actual: RustOnlyArtifactFingerprint;
|
|
15
|
+
}
|
|
16
|
+
export interface RustOnlyArtifactFreshnessResult {
|
|
17
|
+
readonly fresh: boolean;
|
|
18
|
+
readonly staleReasons: readonly RustOnlyArtifactStaleReason[];
|
|
19
|
+
}
|
|
20
|
+
export interface ShouldReuseRustOnlyCaseReportOptions {
|
|
21
|
+
readonly report: {
|
|
22
|
+
readonly runnerVersion?: string;
|
|
23
|
+
readonly exchangeBinaryProfile?: RustOnlyExchangeBinaryProfile;
|
|
24
|
+
readonly formulaCalculationMode?: RustOnlyFormulaCalculationMode;
|
|
25
|
+
readonly calcChainMode?: 'off' | 'trusted';
|
|
26
|
+
readonly source?: {
|
|
27
|
+
readonly sha256?: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
readonly expectedRunnerVersion: string;
|
|
31
|
+
readonly expectedExchangeBinaryProfile?: RustOnlyExchangeBinaryProfile;
|
|
32
|
+
readonly expectedFormulaCalculationMode: RustOnlyFormulaCalculationMode;
|
|
33
|
+
readonly expectedCalcChainMode?: 'off' | 'trusted';
|
|
34
|
+
readonly expectedSourceSha256: string;
|
|
35
|
+
}
|
|
36
|
+
export interface ShouldReuseRustOnlyCaseReportResult {
|
|
37
|
+
readonly reuse: boolean;
|
|
38
|
+
readonly staleReasons: readonly RustOnlyArtifactStaleReason[];
|
|
39
|
+
}
|
|
40
|
+
export declare function evaluateRustOnlyArtifactFreshness(options: EvaluateRustOnlyArtifactFreshnessOptions): RustOnlyArtifactFreshnessResult;
|
|
41
|
+
export declare function shouldReuseRustOnlyCaseReport(options: ShouldReuseRustOnlyCaseReportOptions): ShouldReuseRustOnlyCaseReportResult;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const DEFAULT_RUST_ONLY_SOURCE_DIRS: readonly ['C:\\Users\\wbfsa\\Downloads\\\u590D\u6742Excel\u6A21\u677F', 'C:\\Users\\wbfsa\\Downloads\\spreadsheetbench_verified_400\\spreadsheet'];
|
|
2
|
+
export interface RustOnlyRegressionCase {
|
|
3
|
+
readonly caseId: string;
|
|
4
|
+
readonly sourcePath: string;
|
|
5
|
+
readonly sourceRoot: string;
|
|
6
|
+
readonly relativePath: string;
|
|
7
|
+
readonly reusedFromResume: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface DiscoverRustOnlyRegressionCasesOptions {
|
|
10
|
+
readonly sourceDirs?: readonly string[];
|
|
11
|
+
readonly explicitFiles?: readonly string[];
|
|
12
|
+
readonly only?: readonly string[];
|
|
13
|
+
readonly limit?: number;
|
|
14
|
+
readonly resumeCompletedCaseIds?: ReadonlySet<string>;
|
|
15
|
+
readonly listXlsxFiles?: (sourceRoot: string) => Promise<readonly string[]>;
|
|
16
|
+
}
|
|
17
|
+
export declare function discoverRustOnlyRegressionCases(options?: DiscoverRustOnlyRegressionCasesOptions): Promise<RustOnlyRegressionCase[]>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { RustOnlyFormulaValueExtractorPort } from './rust-only-pipeline.js';
|
|
2
|
+
export interface RustOnlyExcelComPort {
|
|
3
|
+
readonly openSaveWorkbook: (request: {
|
|
4
|
+
readonly inputPath: string;
|
|
5
|
+
readonly outputXlsxPath: string;
|
|
6
|
+
readonly forceFullRecalculation: boolean;
|
|
7
|
+
}) => Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export interface CreateRustOnlyExcelComOracleOptions {
|
|
10
|
+
readonly sourcePath: string;
|
|
11
|
+
readonly caseDir: string;
|
|
12
|
+
readonly excelCom: RustOnlyExcelComPort;
|
|
13
|
+
readonly formulaValueExtractor: RustOnlyFormulaValueExtractorPort;
|
|
14
|
+
readonly shortOutputDir?: string;
|
|
15
|
+
readonly now?: () => number;
|
|
16
|
+
}
|
|
17
|
+
export interface RustOnlyExcelComOracleSuccess {
|
|
18
|
+
readonly ok: true;
|
|
19
|
+
readonly excelComCalculatedXlsx: string;
|
|
20
|
+
readonly excelComFormulaValues: string;
|
|
21
|
+
readonly excelComOracleMs: number;
|
|
22
|
+
readonly formulaCacheExtractionMs: number;
|
|
23
|
+
}
|
|
24
|
+
export interface RustOnlyExcelComOracleFailure {
|
|
25
|
+
readonly ok: false;
|
|
26
|
+
readonly diagnostic: {
|
|
27
|
+
readonly classification: 'excel-com-unavailable';
|
|
28
|
+
readonly message: string;
|
|
29
|
+
readonly sourcePath: string;
|
|
30
|
+
readonly stage: 'excelComOracle';
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export type RustOnlyExcelComOracleResult = RustOnlyExcelComOracleSuccess | RustOnlyExcelComOracleFailure;
|
|
34
|
+
export interface ValidateRustOnlyExportedWorkbookOptions {
|
|
35
|
+
readonly exportedXlsxPath: string;
|
|
36
|
+
readonly caseDir: string;
|
|
37
|
+
readonly excelCom: RustOnlyExcelComPort;
|
|
38
|
+
readonly shortOutputDir?: string;
|
|
39
|
+
readonly now?: () => number;
|
|
40
|
+
}
|
|
41
|
+
export interface RustOnlyExportedWorkbookExcelComSuccess {
|
|
42
|
+
readonly ok: true;
|
|
43
|
+
readonly excelComOpenedXlsx: string;
|
|
44
|
+
readonly excelComOpenMs: number;
|
|
45
|
+
}
|
|
46
|
+
export interface RustOnlyExportedWorkbookExcelComFailure {
|
|
47
|
+
readonly ok: false;
|
|
48
|
+
readonly diagnostic: {
|
|
49
|
+
readonly classification: 'export' | 'excel-com-unavailable';
|
|
50
|
+
readonly message: string;
|
|
51
|
+
readonly exportedXlsxPath: string;
|
|
52
|
+
readonly stage: 'rustExportExcelComOpen';
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export type RustOnlyExportedWorkbookExcelComResult = RustOnlyExportedWorkbookExcelComSuccess | RustOnlyExportedWorkbookExcelComFailure;
|
|
56
|
+
export declare function createRustOnlyExcelComOracle(options: CreateRustOnlyExcelComOracleOptions): Promise<RustOnlyExcelComOracleResult>;
|
|
57
|
+
export declare function validateRustOnlyExportedWorkbookWithExcelCom(options: ValidateRustOnlyExportedWorkbookOptions): Promise<RustOnlyExportedWorkbookExcelComResult>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare function listRustOnlyExcelAutomationProcessIds(): Promise<ReadonlySet<number>>;
|
|
2
|
+
export declare function resolveNewRustOnlyExcelAutomationProcessIds(beforeIds: ReadonlySet<number>, afterIds: ReadonlySet<number>): number[];
|
|
3
|
+
export declare function stopNewRustOnlyExcelAutomationProcesses(beforeIds: ReadonlySet<number>): Promise<void>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type RustOnlyExchangeBinaryProfile = 'release' | 'debug' | 'custom';
|
|
2
|
+
export interface ResolveRustOnlyExchangeBinaryPathOptions {
|
|
3
|
+
readonly explicitPath?: string;
|
|
4
|
+
readonly envPath?: string;
|
|
5
|
+
readonly binaryProfile?: RustOnlyExchangeBinaryProfile;
|
|
6
|
+
readonly releasePath: string;
|
|
7
|
+
readonly debugPath: string;
|
|
8
|
+
readonly exists: (path: string) => boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface RustOnlyExchangeBinarySelection {
|
|
11
|
+
readonly path: string;
|
|
12
|
+
readonly profile: RustOnlyExchangeBinaryProfile;
|
|
13
|
+
}
|
|
14
|
+
export declare function resolveRustOnlyExchangeBinaryPath(options: ResolveRustOnlyExchangeBinaryPathOptions): string;
|
|
15
|
+
export declare function resolveRustOnlyExchangeBinarySelection(options: ResolveRustOnlyExchangeBinaryPathOptions): RustOnlyExchangeBinarySelection;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { RustOnlyMismatchClassification, RustOnlyMismatchGroup } from './rust-only-report.js';
|
|
2
|
+
import type { RustOnlyActiveStage } from './rust-only-timeout.js';
|
|
3
|
+
export interface CreateRustOnlyRunnerFailureMismatchGroupOptions {
|
|
4
|
+
readonly activeStage: RustOnlyActiveStage;
|
|
5
|
+
readonly message: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function createRustOnlyRunnerFailureMismatchGroup(options: CreateRustOnlyRunnerFailureMismatchGroupOptions): RustOnlyMismatchGroup;
|
|
8
|
+
export declare function isSkippableRustOnlyFailureClassification(classification: RustOnlyMismatchClassification): boolean;
|
|
9
|
+
export declare function isRustOnlyRunnerTimeoutFailure(options: CreateRustOnlyRunnerFailureMismatchGroupOptions): boolean;
|
|
10
|
+
export declare function createUnsupportedExcelSourceWorkbookMismatchGroup(reason: string): RustOnlyMismatchGroup;
|
|
11
|
+
export declare function detectUnsupportedExcelGridLimits(parts: Record<string, string>): string | undefined;
|
|
12
|
+
export declare function detectUnsupportedExcelSourceWorkbook(parts: Record<string, string>): string | undefined;
|
|
13
|
+
export declare function detectUnsupportedExcelSourceOpenFailure(message: string): string | undefined;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type RustOnlyFeatureFamily } from './rust-only-report.js';
|
|
2
|
+
type FeatureStatus = 'present' | 'not-present';
|
|
3
|
+
export interface RustOnlyFeatureEvidence {
|
|
4
|
+
readonly status: FeatureStatus;
|
|
5
|
+
readonly count: number;
|
|
6
|
+
readonly modelPaths: readonly string[];
|
|
7
|
+
}
|
|
8
|
+
export type RustOnlyExtractedFeatureEvidence = Record<string, RustOnlyFeatureEvidence>;
|
|
9
|
+
export interface RustOnlyNormalizedFeatureCoverage {
|
|
10
|
+
readonly status: FeatureStatus;
|
|
11
|
+
readonly evidenceArtifacts: readonly string[];
|
|
12
|
+
readonly comparisonArtifacts: readonly string[];
|
|
13
|
+
readonly comparisonRequired: boolean;
|
|
14
|
+
readonly failures: readonly string[];
|
|
15
|
+
}
|
|
16
|
+
export declare function extractRustOnlyWorkbookFeatureEvidence(workbook: unknown): RustOnlyExtractedFeatureEvidence;
|
|
17
|
+
export declare function unwrapRustOnlyWorkbookSnapshot(workbook: unknown): Record<string, unknown>;
|
|
18
|
+
export declare function normalizeRustOnlyFeatureCoverage(evidence: RustOnlyExtractedFeatureEvidence): Record<RustOnlyFeatureFamily, RustOnlyNormalizedFeatureCoverage>;
|
|
19
|
+
export {};
|