@univerjs-pro/collaboration 1.0.0-alpha.2 → 1.0.0-alpha.4
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/lib/cjs/index.js +1 -1
- package/lib/es/index.js +1 -1
- package/lib/index.js +1 -1
- package/lib/types/controllers/board-transform/algorithms/element.algo.d.ts +5 -0
- package/lib/types/controllers/board-transform/algorithms/index.d.ts +4 -0
- package/lib/types/controllers/board-transform/algorithms/order.algo.d.ts +3 -0
- package/lib/types/controllers/board-transform/algorithms/table-resource.algo.d.ts +3 -0
- package/lib/types/controllers/board-transform/algorithms/types.d.ts +8 -0
- package/lib/types/controllers/board-transform/board-transform.controller.d.ts +9 -0
- package/lib/types/controllers/sheet-transform/sheet-transform.controller.d.ts +1 -1
- package/lib/types/controllers/slide-transform/algorithms/index.d.ts +4 -4
- package/lib/types/index.d.ts +15 -19
- package/lib/types/models/changeset.d.ts +4 -4
- package/lib/types/services/snapshot/snapshot-loading.service.d.ts +37 -0
- package/lib/types/services/snapshot/snapshot-save.service.d.ts +4 -0
- package/lib/types/services/snapshot/snapshot-transform.d.ts +9 -0
- package/lib/types/services/snapshot/snapshot-utils.d.ts +3 -0
- package/lib/types/services/snapshot/snapshot.service.d.ts +19 -6
- package/lib/types/services/validation/doc-changeset-validation.d.ts +2 -1
- package/lib/umd/index.js +1 -1
- package/package.json +30 -22
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IMutationTransformAlgorithm } from '../../../services/transform/transform.service';
|
|
2
|
+
export declare const RemoveBoardElementMutationWithOthers: IMutationTransformAlgorithm;
|
|
3
|
+
export declare const RemoveBoardElementOnlyMutationWithOthers: IMutationTransformAlgorithm;
|
|
4
|
+
export declare const AddBoardElementMutationWithSelf: IMutationTransformAlgorithm;
|
|
5
|
+
export declare const UpdateBoardElementMutationWithSelf: IMutationTransformAlgorithm;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { AddBoardElementMutationWithSelf, RemoveBoardElementMutationWithOthers, RemoveBoardElementOnlyMutationWithOthers, UpdateBoardElementMutationWithSelf, } from './element.algo';
|
|
2
|
+
export { RemoveBoardElementMutationWithOrder, RemoveBoardElementOnlyMutationWithOrder } from './order.algo';
|
|
3
|
+
export { RemoveBoardTableMutationWithResource, RemoveBoardTableMutationWithSelf } from './table-resource.algo';
|
|
4
|
+
export declare const BOARD_ALL_ALGORITHMS: import("../../../services/transform/transform.service").IMutationTransformAlgorithm<any, any>[];
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IMutationTransformAlgorithm } from '../../../services/transform/transform.service';
|
|
2
|
+
export declare const RemoveBoardElementMutationWithOrder: IMutationTransformAlgorithm;
|
|
3
|
+
export declare const RemoveBoardElementOnlyMutationWithOrder: IMutationTransformAlgorithm;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IMutationInfo } from '@univerjs/core';
|
|
2
|
+
export declare function getBoardUnitId(mutation: IMutationInfo): string | undefined;
|
|
3
|
+
export declare function getBoardPageId(mutation: IMutationInfo): string | undefined;
|
|
4
|
+
export declare function getBoardElementId(mutation: IMutationInfo): string | undefined;
|
|
5
|
+
export declare function getBoardElementIds(mutation: IMutationInfo): string[];
|
|
6
|
+
export declare function sameBoardUnit(m1: IMutationInfo, m2: IMutationInfo): boolean;
|
|
7
|
+
export declare function sameBoardPage(m1: IMutationInfo, m2: IMutationInfo): boolean;
|
|
8
|
+
export declare function boardElementIntersects(m1: IMutationInfo, m2: IMutationInfo): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Disposable } from '@univerjs/core';
|
|
2
|
+
import { ITransformService } from '../../services/transform/transform.service';
|
|
3
|
+
/**
|
|
4
|
+
* This controller registers board transform algorithms to the transform service.
|
|
5
|
+
*/
|
|
6
|
+
export declare class BoardTransformController extends Disposable {
|
|
7
|
+
private readonly _transformService;
|
|
8
|
+
constructor(_transformService: ITransformService);
|
|
9
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Disposable } from '@univerjs/core';
|
|
2
2
|
import { ITransformService } from '../../services/transform/transform.service';
|
|
3
|
-
export declare const SHEET_ALL_ALGORITHMS: import("
|
|
3
|
+
export declare const SHEET_ALL_ALGORITHMS: import("../../services/transform/transform.service").IMutationTransformAlgorithm<any, any>[];
|
|
4
4
|
/**
|
|
5
5
|
* This controller register sheet transform algorithms to the transform service.
|
|
6
6
|
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { UpdateSlidePageBackgroundMutationWithSelf } from './background.algo';
|
|
2
2
|
export { RemoveSlideChartDataSourceMutationWithResource, RemoveSlideChartDataSourceMutationWithSelf, RemoveSlideChartSnapshotMutationWithResource, RemoveSlideChartSnapshotMutationWithSelf, } from './chart-resource.algo';
|
|
3
3
|
export { SetSlideDrawingApplyMutationWithSelf } from './drawing-json.algo';
|
|
4
|
-
export { AddSlideElementMutationWithSelf, RemoveSlideElementMutationWithOthers, UpdateSlideElementMutationWithSelf } from './element.algo';
|
|
5
|
-
export { RemoveSlideElementMutationWithCancelGroup, RemoveSlideElementMutationWithSetGroup, SetSlideGroupMutationWithSelf } from './group.algo';
|
|
4
|
+
export { AddSlideElementMutationWithSelf, RemoveSlideElementMutationWithOthers, UpdateSlideElementMutationWithSelf, } from './element.algo';
|
|
5
|
+
export { RemoveSlideElementMutationWithCancelGroup, RemoveSlideElementMutationWithSetGroup, SetSlideGroupMutationWithSelf, } from './group.algo';
|
|
6
6
|
export { RemoveSlideElementMutationWithOrder } from './order.algo';
|
|
7
|
-
export { AddSlidePageMutationWithSelf, MoveSlidePageMutationWithSelf, RemoveSlidePageMutationWithOthers } from './page.algo';
|
|
7
|
+
export { AddSlidePageMutationWithSelf, MoveSlidePageMutationWithSelf, RemoveSlidePageMutationWithOthers, } from './page.algo';
|
|
8
8
|
export { RemoveSlideTableMutationWithResource, RemoveSlideTableMutationWithSelf } from './table-resource.algo';
|
|
9
|
-
export declare const SLIDE_ALL_ALGORITHMS: import("
|
|
9
|
+
export declare const SLIDE_ALL_ALGORITHMS: import("../../../services/transform/transform.service").IMutationTransformAlgorithm<any, any>[];
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,33 +1,29 @@
|
|
|
1
1
|
export { CreateUnitMutation } from './commands/create-unit.mutation';
|
|
2
|
-
export type { ICreateUnitMutationParams } from './commands/create-unit.mutation';
|
|
3
2
|
export { RevertRevisionMutation } from './commands/revert-revision.mutation';
|
|
4
3
|
export type { IRevertRevisionMutationParams } from './commands/revert-revision.mutation';
|
|
5
|
-
export type { IUniverCollaborationConfig } from './config/config';
|
|
6
|
-
export { BaseAlgorithms, BaseJson1MutationWithSelf } from './controllers/base-transform/algorithms/base-json1.algo';
|
|
7
4
|
export { BaseTransformController } from './controllers/base-transform/base-transform.controller';
|
|
8
|
-
export {
|
|
5
|
+
export { BoardTransformController } from './controllers/board-transform/board-transform.controller';
|
|
6
|
+
export { RichTextEditingMutationWithSelf } from './controllers/doc-transform/algorithms/doc-algo';
|
|
9
7
|
export { DocTransformController } from './controllers/doc-transform/doc-transform.controller';
|
|
10
8
|
export { EmptyMutationInfo } from './controllers/empty';
|
|
11
9
|
export { SheetTransformController } from './controllers/sheet-transform/sheet-transform.controller';
|
|
12
|
-
export { SLIDE_ALL_ALGORITHMS } from './controllers/slide-transform/algorithms';
|
|
13
10
|
export { SlideTransformController } from './controllers/slide-transform/slide-transform.controller';
|
|
14
|
-
export { parseChangesetToProtocol, parseMutationToProtocol, parseProtocolChangeset, parseProtocolCommand,
|
|
11
|
+
export { parseChangesetToProtocol, parseMutationToProtocol, parseProtocolChangeset, parseProtocolCommand, } from './models/changeset';
|
|
15
12
|
export type { IChangeset, IFetchMissingCSResult } from './models/changeset';
|
|
16
13
|
export { CollaborationEvent } from './models/collaboration-events';
|
|
17
|
-
export type { IAcknowledgedChangeset, IAcknowledgementEvent, ICollaborationEvent, ICollaborationUser, IFetchingMissEvent, IFetchOperationsEvent, INewChangesetsEvent, INewHostEvent, IOperationEvent, IPermissionUpdateEvent, IPseudoFetchMissingResultEvent,
|
|
18
|
-
export {
|
|
14
|
+
export type { IAcknowledgedChangeset, IAcknowledgementEvent, ICollaborationEvent, ICollaborationUser, IFetchingMissEvent, IFetchOperationsEvent, INewChangesetsEvent, INewHostEvent, IOperationEvent, IPermissionUpdateEvent, IPseudoFetchMissingResultEvent, IRejectionEvent, IRequestHostEvent, IRetryEvent, IShouldCloseConnEvent, ISubmitChangesetEvent, ITerminateEvent, IUpdateCursorEvent, IUserJoinEvent, IUserLeaveEvent, } from './models/collaboration-events';
|
|
15
|
+
export type { ICombRequestEvent, ICombResponseEvent, IHeartbeatRequestEvent, IHelloRequestEvent, IHelloResponseEvent, IIngestQuestEvent, IJoinRequestEvent, IJoinResponseEvent, ILeaveRequestEvent, IRecvResponseEvent, } from './models/socket-events';
|
|
19
16
|
export { UniverCollaborationPlugin } from './plugin';
|
|
20
17
|
export { CompressMutationService } from './services/compress-mutation/compress-mutation.service';
|
|
21
|
-
export { RevisionService, SINGLE_HISTORY_MUTATIONS, SINGLE_SNAPSHOT_MUTATIONS } from './services/rev/rev.service';
|
|
18
|
+
export { RevisionService, SINGLE_HISTORY_MUTATIONS, SINGLE_SNAPSHOT_MUTATIONS, } from './services/rev/rev.service';
|
|
19
|
+
export { SNAPSHOT_LOADING_PREVIEW_BLOCK_LIMIT, SnapshotLoadingService, SnapshotLoadStage, } from './services/snapshot/snapshot-loading.service';
|
|
20
|
+
export type { ISnapshotLoadState } from './services/snapshot/snapshot-loading.service';
|
|
22
21
|
export { SnapshotSaveService } from './services/snapshot/snapshot-save.service';
|
|
23
|
-
export {
|
|
24
|
-
export {
|
|
25
|
-
export { ISnapshotServerService, SnapshotService } from './services/snapshot/snapshot.service';
|
|
26
|
-
export { ITransformService, TransformService } from './services/transform/transform.service';
|
|
27
|
-
export
|
|
28
|
-
export {
|
|
29
|
-
export
|
|
30
|
-
export { validateDocBodyAfterApply } from './services/validation/doc-changeset-validation';
|
|
31
|
-
export type { IDocBodyValidationResult } from './services/validation/doc-changeset-validation';
|
|
32
|
-
export { b64DecodeUnicode, b64EncodeUnicode, mapDocumentTypeToUniverInstanceType, measureAsyncOperation, measureSyncOperation, uuidv4, } from './utils';
|
|
22
|
+
export { getSheetBlocksFromSnapshot, transformDocumentDataToSnapshot, transformSlideDataToSnapshot, transformSnapshotToDocumentData, transformSnapshotToSlideData, transformSnapshotToWorkbookData, transformWorkbookDataToSnapshot, } from './services/snapshot/snapshot-transform';
|
|
23
|
+
export { textDecoder, textEncoder, } from './services/snapshot/snapshot-utils';
|
|
24
|
+
export { ISnapshotServerService, SnapshotService, } from './services/snapshot/snapshot.service';
|
|
25
|
+
export { ITransformService, TransformService, } from './services/transform/transform.service';
|
|
26
|
+
export { isTransformChangesetsFailure, isTransformChangesetsSuccess, isTransformMutationFailure, isTransformMutationsSuccess, isTransformMutationsWithChangesetFailure, isTransformMutationsWithChangesetSuccess, } from './services/transform/types';
|
|
27
|
+
export { validateDocBodyAfterApply, validateDocumentAfterApply } from './services/validation/doc-changeset-validation';
|
|
28
|
+
export { b64DecodeUnicode, b64EncodeUnicode, mapDocumentTypeToUniverInstanceType, measureSyncOperation, uuidv4, } from './utils';
|
|
33
29
|
export type { ILogContext } from './utils';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ICommandInfo, IMutationInfo, UniverInstanceType } from '@univerjs/core';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ICommand, IMutation, IChangeset as IProtocolChangeset } from '@univerjs/protocol';
|
|
3
3
|
export interface IFetchMissingCSResult {
|
|
4
4
|
changesets: IChangeset[];
|
|
5
5
|
lastRevision?: number;
|
|
@@ -21,7 +21,7 @@ export interface IChangeset {
|
|
|
21
21
|
additionalFields?: string;
|
|
22
22
|
}
|
|
23
23
|
export declare function parseProtocolChangeset(protocolChangeset: IProtocolChangeset): IChangeset;
|
|
24
|
-
export declare function parseProtocolCommand(protocolCommands:
|
|
24
|
+
export declare function parseProtocolCommand(protocolCommands: ICommand[]): ICommandInfo[];
|
|
25
25
|
export declare function parseChangesetToProtocol(changeset: IChangeset): IProtocolChangeset;
|
|
26
|
-
export declare function parseProtocolMutation(mutation:
|
|
27
|
-
export declare function parseMutationToProtocol(mutation: IMutationInfo):
|
|
26
|
+
export declare function parseProtocolMutation(mutation: IMutation): IMutationInfo;
|
|
27
|
+
export declare function parseMutationToProtocol(mutation: IMutationInfo): IMutation;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ICellData, IObjectMatrixPrimitiveType, IWorkbookData, UniverInstanceType } from '@univerjs/core';
|
|
2
|
+
import { Disposable } from '@univerjs/core';
|
|
3
|
+
export declare const SNAPSHOT_LOADING_PREVIEW_BLOCK_LIMIT = 3;
|
|
4
|
+
export declare enum SnapshotLoadStage {
|
|
5
|
+
LOADING_SNAPSHOT = "loading-snapshot",
|
|
6
|
+
LOADING_BLOCKS = "loading-blocks",
|
|
7
|
+
COMPLETE = "complete",
|
|
8
|
+
ERROR = "error"
|
|
9
|
+
}
|
|
10
|
+
export interface ISnapshotLoadState {
|
|
11
|
+
unitId: string;
|
|
12
|
+
type: UniverInstanceType;
|
|
13
|
+
stage: SnapshotLoadStage;
|
|
14
|
+
totalBlocks: number;
|
|
15
|
+
loadedBlocks: number;
|
|
16
|
+
totalPreviewBlocks: number;
|
|
17
|
+
loadedPreviewBlocks: number;
|
|
18
|
+
previewReady: boolean;
|
|
19
|
+
activeSheetId?: string;
|
|
20
|
+
workbookShell?: IWorkbookData;
|
|
21
|
+
previewCellData?: IObjectMatrixPrimitiveType<ICellData>;
|
|
22
|
+
error?: Error;
|
|
23
|
+
}
|
|
24
|
+
/** Sheet snapshot loading state consumed by loading UI and preview renderers. */
|
|
25
|
+
export declare class SnapshotLoadingService extends Disposable {
|
|
26
|
+
private readonly _stateByUnit;
|
|
27
|
+
private readonly _state$;
|
|
28
|
+
readonly state$: import("rxjs").Observable<ReadonlyMap<string, ISnapshotLoadState>>;
|
|
29
|
+
begin(unitId: string, type: UniverInstanceType): void;
|
|
30
|
+
setSnapshot(unitId: string, workbookShell: IWorkbookData, activeSheetId: string, totalBlocks: number, totalPreviewBlocks: number): void;
|
|
31
|
+
addBlock(unitId: string, subUnitId: string, cellData: IObjectMatrixPrimitiveType<ICellData>, isPreviewBlock?: boolean): void;
|
|
32
|
+
complete(unitId: string): void;
|
|
33
|
+
fail(unitId: string, error: Error): void;
|
|
34
|
+
getState(unitId: string): ISnapshotLoadState | undefined;
|
|
35
|
+
dispose(): void;
|
|
36
|
+
private _setState;
|
|
37
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IBoardData } from '@univerjs-pro/boards';
|
|
1
2
|
import type { ISlideData } from '@univerjs-pro/slides';
|
|
2
3
|
import type { BaseDataModel, DocumentDataModel, IBaseSnapshot, IDocumentData, IWorkbookData, Workbook } from '@univerjs/core';
|
|
3
4
|
import type { ISheetBlockMeta, ISnapshot } from '@univerjs/protocol';
|
|
@@ -42,4 +43,7 @@ export declare class SnapshotSaveService {
|
|
|
42
43
|
saveSlide(unitId: string, slideData: ISlideData, rev: number): Promise<{
|
|
43
44
|
snapshot: ISnapshot;
|
|
44
45
|
}>;
|
|
46
|
+
saveBoard(unitId: string, boardData: IBoardData, rev: number): Promise<{
|
|
47
|
+
snapshot: ISnapshot;
|
|
48
|
+
}>;
|
|
45
49
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IBoardData } from '@univerjs-pro/boards';
|
|
1
2
|
import type { ISlideData } from '@univerjs-pro/slides';
|
|
2
3
|
import type { IBaseSnapshot, IDocumentData, ILogService, IWorkbookData } from '@univerjs/core';
|
|
3
4
|
import type { IDeserializedSheetBlock, ISheetBlock, ISheetBlockMeta, ISnapshot } from '@univerjs/protocol';
|
|
@@ -27,6 +28,10 @@ export declare function transformBaseDataToSnapshot(context: ILogContext, base:
|
|
|
27
28
|
* @param sheetBlocks
|
|
28
29
|
*/
|
|
29
30
|
export declare function transformSnapshotToWorkbookData(snapshot: ISnapshot, sheetBlocks: (IDeserializedSheetBlock | ISheetBlock)[], _context?: ILogContext, logService?: ILogService): Promise<IWorkbookData>;
|
|
31
|
+
/**
|
|
32
|
+
* Builds the workbook shell from snapshot metadata without loading cell blocks.
|
|
33
|
+
*/
|
|
34
|
+
export declare function transformSnapshotToWorkbookDataWithoutBlocks(snapshot: ISnapshot): IWorkbookData;
|
|
30
35
|
export declare function transformSnapshotToBaseData(snapshot: ISnapshot, baseBlocks?: (IDeserializedSheetBlock | ISheetBlock)[], _context?: ILogContext, logService?: ILogService): Promise<IBaseSnapshot>;
|
|
31
36
|
export declare function transformSnapshotToDocumentData(snapshot: ISnapshot): IDocumentData;
|
|
32
37
|
export declare function transformDocumentDataToSnapshot(context: ILogContext, document: IDocumentData, unitID: string, rev: number, snapshotService: ISnapshotServerService): Promise<{
|
|
@@ -36,6 +41,10 @@ export declare function transformSlideDataToSnapshot(_resources: ISlideData['res
|
|
|
36
41
|
snapshot: ISnapshot;
|
|
37
42
|
}>;
|
|
38
43
|
export declare function transformSnapshotToSlideData(snapshot: ISnapshot): ISlideData;
|
|
44
|
+
export declare function transformBoardDataToSnapshot(_resources: IBoardData['resources'], boardData: IBoardData, unitID: string, rev: number, snapshotService: ISnapshotServerService): Promise<{
|
|
45
|
+
snapshot: ISnapshot;
|
|
46
|
+
}>;
|
|
47
|
+
export declare function transformSnapshotToBoardData(snapshot: ISnapshot): IBoardData;
|
|
39
48
|
/**
|
|
40
49
|
*
|
|
41
50
|
* @param snapshot
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IBoardData } from '@univerjs-pro/boards';
|
|
1
2
|
import type { ISlideData } from '@univerjs-pro/slides';
|
|
2
3
|
import type { ICellData, IDocumentData, IObjectMatrixPrimitiveType, IWorkbookData, IWorksheetData } from '@univerjs/core';
|
|
3
4
|
import type { ISheetBlock } from '@univerjs/protocol';
|
|
@@ -10,11 +11,13 @@ export declare function encodeWorksheetOtherMetas(worksheet: Partial<IWorksheetD
|
|
|
10
11
|
export declare function encodeWorkbookOtherMetas(workbook: IWorkbookData): Uint8Array;
|
|
11
12
|
export declare function encodeDocOriginalMeta(document: IDocumentData): Uint8Array;
|
|
12
13
|
export declare function encodeSlideOriginalMeta(slide: ISlideData): Uint8Array;
|
|
14
|
+
export declare function encodeBoardOriginalMeta(board: IBoardData): Uint8Array;
|
|
13
15
|
export declare function decodeWorksheetOtherMetas(buffer: Uint8Array | string): Partial<IWorksheetData>;
|
|
14
16
|
export declare function decodeWorkbookOtherMetas(buffer: Uint8Array | string): Partial<IWorkbookData>;
|
|
15
17
|
export declare function decodePartOfCellData(buffer: Uint8Array | object): IObjectMatrixPrimitiveType<ICellData>;
|
|
16
18
|
export declare function decodeDocOriginalMeta(buffer: Uint8Array | string): Partial<IDocumentData>;
|
|
17
19
|
export declare function decodeSlideOriginalMeta(buffer: Uint8Array | string): ISlideData;
|
|
20
|
+
export declare function decodeBoardOriginalMeta(buffer: Uint8Array | string): IBoardData;
|
|
18
21
|
export declare function splitCellDataToBlocks(cellData: IObjectMatrixPrimitiveType<ICellData>, fragmentCellCount?: number, minBlockSize?: number): {
|
|
19
22
|
blocks: ISheetBlock[];
|
|
20
23
|
totalCells: number;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import type { BoardModel, IBoardData } from '@univerjs-pro/boards';
|
|
1
2
|
import type { ISlideData, SlideModel } from '@univerjs-pro/slides';
|
|
2
|
-
import type { BaseDataModel, DocumentDataModel, IBaseSnapshot, IDocumentData, IWorkbookData, Workbook } from '@univerjs/core';
|
|
3
|
+
import type { BaseDataModel, DocumentDataModel, IBaseSnapshot, ICreateUnitOptions, IDocumentData, IWorkbookData, Workbook } from '@univerjs/core';
|
|
3
4
|
import type { ICopyFileMetaRequest, ICopyFileMetaResponse, IFetchMissingChangesetsRequest, IFetchMissingChangesetsResponse, IGetDeserializedSheetBlockResponse, IGetLatestCsReqIdBySidRequest, IGetLatestCsReqIdBySidResponse, IGetResourcesRequest, IGetResourcesResponse, IGetSheetBlockRequest, IGetSheetBlockResponse, IGetUnitOnRevRequest, IGetUnitOnRevResponse, IReportUnitRoutingStatsRequest, IReportUnitRoutingStatsResponse, ISaveChangesetRequest, ISaveChangesetResponse, ISaveSheetBlockRequest, ISaveSheetBlockResponse, ISaveSnapshotRequest, ISaveSnapshotResponse, ISnapshot } from '@univerjs/protocol';
|
|
4
5
|
import type { ILogContext } from '../../utils';
|
|
5
6
|
import { ICommandService, ILogService, IResourceManagerService, IUniverInstanceService } from '@univerjs/core';
|
|
6
7
|
import { CompressMutationService } from '../compress-mutation/compress-mutation.service';
|
|
7
8
|
import { RevisionService } from '../rev/rev.service';
|
|
9
|
+
import { SnapshotLoadingService } from './snapshot-loading.service';
|
|
8
10
|
export declare function hasSlideSnapshotMeta(snapshot: ISnapshot | null | undefined): boolean;
|
|
11
|
+
export declare function hasBoardSnapshotMeta(snapshot: ISnapshot | null | undefined): boolean;
|
|
9
12
|
/**
|
|
10
13
|
* It provides implementations for server side controllers to load or save
|
|
11
14
|
* or load snapshots. This service should be implemented by the host environment.
|
|
@@ -34,6 +37,10 @@ export interface ISnapshotServerService {
|
|
|
34
37
|
/** Report unit routing stats */
|
|
35
38
|
reportUnitRoutingStats?: (context: ILogContext, params: IReportUnitRoutingStatsRequest) => Promise<IReportUnitRoutingStatsResponse>;
|
|
36
39
|
}
|
|
40
|
+
export interface ISnapshotLoadOptions {
|
|
41
|
+
createOptions?: ICreateUnitOptions;
|
|
42
|
+
initialSubUnitId?: string;
|
|
43
|
+
}
|
|
37
44
|
/**
|
|
38
45
|
* The service provides methods to load snapshots from the snapshot server.
|
|
39
46
|
*/
|
|
@@ -45,15 +52,21 @@ export declare class SnapshotService {
|
|
|
45
52
|
private readonly _logService;
|
|
46
53
|
private _compressMutationService;
|
|
47
54
|
private _resourceManagerService;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
private readonly _snapshotLoadingService;
|
|
56
|
+
constructor(_revisionService: RevisionService, _univerInstanceService: IUniverInstanceService, _snapshotServerService: ISnapshotServerService, _commandService: ICommandService, _logService: ILogService, _compressMutationService: CompressMutationService, _resourceManagerService: IResourceManagerService, _snapshotLoadingService: SnapshotLoadingService);
|
|
57
|
+
loadSheet(unitId: string, rev: number, context?: ILogContext, options?: ISnapshotLoadOptions): Promise<Workbook>;
|
|
58
|
+
private _getPrioritizedSheetBlocks;
|
|
59
|
+
loadBase(unitId: string, rev: number, context?: ILogContext, options?: ISnapshotLoadOptions): Promise<BaseDataModel>;
|
|
60
|
+
loadDoc(unitID: string, rev: number, context?: ILogContext, options?: ISnapshotLoadOptions): Promise<DocumentDataModel>;
|
|
61
|
+
loadSlide(unitID: string, rev?: number, context?: ILogContext, options?: ISnapshotLoadOptions): Promise<SlideModel>;
|
|
62
|
+
loadBoard(unitID: string, rev?: number, context?: ILogContext, options?: ISnapshotLoadOptions): Promise<BoardModel>;
|
|
53
63
|
saveSheet(_context: ILogContext, workbook: Workbook): IWorkbookData;
|
|
54
64
|
saveBase(_context: ILogContext, base: BaseDataModel): IBaseSnapshot;
|
|
55
65
|
saveDoc(_context: ILogContext, document: DocumentDataModel): IDocumentData;
|
|
56
66
|
saveSlide(unitId: string, slideData: ISlideData, rev: number): Promise<{
|
|
57
67
|
snapshot: ISnapshot;
|
|
58
68
|
}>;
|
|
69
|
+
saveBoard(unitId: string, boardData: IBoardData, rev: number): Promise<{
|
|
70
|
+
snapshot: ISnapshot;
|
|
71
|
+
}>;
|
|
59
72
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { IDocumentBody } from '@univerjs/core';
|
|
1
|
+
import type { IDocumentBody, IDocumentData } from '@univerjs/core';
|
|
2
2
|
export interface IDocBodyValidationResult {
|
|
3
3
|
ok: boolean;
|
|
4
4
|
errors: string[];
|
|
5
5
|
}
|
|
6
6
|
export declare function validateDocBodyAfterApply(body: IDocumentBody): IDocBodyValidationResult;
|
|
7
|
+
export declare function validateDocumentAfterApply(snapshot: Pick<IDocumentData, 'body' | 'headers' | 'footers' | 'tableSource'>): IDocBodyValidationResult;
|