@univerjs-pro/collaboration 0.7.0-nightly.202505221607 → 0.7.0-nightly.202505241606

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.
@@ -7,10 +7,11 @@ export { UniverCollaborationPlugin } from './plugin';
7
7
  export { CompressMutationService } from './services/compress-mutation/compress-mutation-service';
8
8
  export { RevisionService, SINGLE_HISTORY_MUTATIONS, SINGLE_SNAPSHOT_MUTATIONS } from './services/rev/rev.service';
9
9
  export { ISnapshotServerService, SnapshotService } from './services/snapshot/snapshot.service';
10
+ export { SnapshotSaveService } from './services/snapshot/snapshot-save.service';
10
11
  export { generateTempDocumentSnapshot, generateTemporarySnap, getSheetBlocksFromSnapshot, transformDocumentDataToSnapshot, transformSnapshotToDocumentData, transformSnapshotToWorkbookData, transformWorkbookDataToSnapshot } from './services/snapshot/snapshot-transform';
11
12
  export { textDecoder, textEncoder } from './services/snapshot/snapshot-utils';
12
13
  export { type IMutationTransformAlgorithm, ITransformService, TransformService, } from './services/transform/transform.service';
13
14
  export { type IFailureTransformChangesetsResult, type IFailureTransformMutationResult, type IFailureTransformMutationsResult, type IFailureTransformMutationsWithChangesetResult, isTransformChangesetsFailure, isTransformChangesetsSuccess, isTransformMutationFailure, isTransformMutationsFailure, isTransformMutationsSuccess, isTransformMutationSuccess, isTransformMutationsWithChangesetFailure, isTransformMutationsWithChangesetSuccess, type ISuccessTransformChangesetsResult, type ISuccessTransformMutationResult, type ISuccessTransformMutationsResult, type ISuccessTransformMutationsWithChangesetResult, type ITransformChangesetsResult, type ITransformMutationResult, type ITransformMutationsResult, type ITransformMutationsWithChangesetResult, } from './services/transform/types';
14
- export { b64DecodeUnicode, b64EncodeUnicode, type ILogContext, mapDocumentTypeToUniverType } from './utils';
15
+ export { b64DecodeUnicode, b64EncodeUnicode, type ILogContext, mapDocumentTypeToUniverType, uuidv4 } from './utils';
15
16
  export { type IRevertRevisionMutationParams, RevertRevisionMutation } from './command/revert-revision.mutation';
16
17
  export { CreateUnitMutation, type ICreateUnitMutationParams } from './command/create-unit.mutation';
@@ -0,0 +1,33 @@
1
+ import { DocumentDataModel, IDocumentData, IWorkbookData, Workbook } from '@univerjs/core';
2
+ import { ISnapshot } from '@univerjs/protocol';
3
+ import { ILogContext } from '../../utils';
4
+ import { ISnapshotServerService, SnapshotService } from './snapshot.service';
5
+ /**
6
+ * This service provides methods to save snapshots into the database.
7
+ *
8
+ * It should be considered as a missing part ot `SnapshotService`. Because
9
+ * we only need to save snapshot on the server side, so we separate it from
10
+ * `SnapshotService`.
11
+ *
12
+ * Though this service is implemented in `@univerjs-pro/collaboration`, it is not registered by the plugin.
13
+ */
14
+ export declare class SnapshotSaveService {
15
+ private readonly _snapshotServerService;
16
+ private _snapshotService;
17
+ constructor(_snapshotServerService: ISnapshotServerService, _snapshotService: SnapshotService);
18
+ saveSheet(context: ILogContext, unitId: string, rev: number, workbook: Workbook, workbookData?: IWorkbookData): Promise<{
19
+ snapshot: ISnapshot;
20
+ }>;
21
+ updateSheet(context: ILogContext, unitId: string, rev: number, workbook: Workbook, workbookData?: IWorkbookData): Promise<{
22
+ snapshot: ISnapshot;
23
+ }>;
24
+ getSheet(context: ILogContext, unitID: string, rev: number, workbook: Workbook): Promise<{
25
+ snapshot: ISnapshot;
26
+ }>;
27
+ getDoc(context: ILogContext, unitId: string, rev: number, document: DocumentDataModel): Promise<{
28
+ snapshot: ISnapshot;
29
+ }>;
30
+ saveDoc(context: ILogContext, unitId: string, rev: number, document: DocumentDataModel, documentData?: IDocumentData): Promise<{
31
+ snapshot: ISnapshot;
32
+ }>;
33
+ }
@@ -8,7 +8,7 @@ export declare function generateTempDocumentSnapshot(_context: ILogContext, docu
8
8
  export declare function generateTemporarySnap(context: ILogContext, workbook: IWorkbookData, unitID: string, rev: number, snapshotService: ISnapshotServerService): Promise<{
9
9
  snapshot: ISnapshot;
10
10
  }>;
11
- export declare function transformWorkbookDataToSnapshot(context: ILogContext, workbook: IWorkbookData, unitID: string, rev: number, snapshotService: ISnapshotServerService): Promise<{
11
+ export declare function transformWorkbookDataToSnapshot(context: ILogContext, workbook: IWorkbookData, unitID: string, rev: number, snapshotService: ISnapshotServerService, performUpdate?: true): Promise<{
12
12
  snapshot: ISnapshot;
13
13
  }>;
14
14
  /**
@@ -1,4 +1,4 @@
1
- import { DocumentDataModel, IDocumentData, IWorkbookData, Workbook, ICommandService, Injector, IResourceManagerService, IUniverInstanceService } from '@univerjs/core';
1
+ import { DocumentDataModel, IDocumentData, IWorkbookData, Workbook, ICommandService, IResourceManagerService, IUniverInstanceService } from '@univerjs/core';
2
2
  import { ICopyFileMetaRequest, ICopyFileMetaResponse, IFetchMissingChangesetsRequest, IFetchMissingChangesetsResponse, IGetDeserializedSheetBlockResponse, IGetLatestCsReqIdBySidRequest, IGetLatestCsReqIdBySidResponse, IGetResourcesRequest, IGetResourcesResponse, IGetSheetBlockRequest, IGetSheetBlockResponse, IGetUnitOnRevRequest, IGetUnitOnRevResponse, ISaveChangesetRequest, ISaveChangesetResponse, ISaveSheetBlockRequest, ISaveSheetBlockResponse, ISaveSnapshotRequest, ISaveSnapshotResponse } from '@univerjs/protocol';
3
3
  import { ILogContext } from '../../utils';
4
4
  import { CompressMutationService } from '../compress-mutation/compress-mutation-service';
@@ -20,6 +20,8 @@ export interface ISnapshotServerService {
20
20
  getResourcesRequest: (context: ILogContext, params: IGetResourcesRequest) => Promise<IGetResourcesResponse>;
21
21
  /** Save snapshot to a database. */
22
22
  saveSnapshot: (context: ILogContext, params: ISaveSnapshotRequest) => Promise<ISaveSnapshotResponse>;
23
+ /** update snapshot to the database. */
24
+ updateSnapshot: (context: ILogContext, params: ISaveSnapshotRequest) => Promise<ISaveSnapshotResponse>;
23
25
  /** Save sheet block to a database. */
24
26
  saveSheetBlock: (context: ILogContext, params: ISaveSheetBlockRequest) => Promise<ISaveSheetBlockResponse>;
25
27
  /** Save changeset to a database. */
@@ -35,18 +37,11 @@ export declare class SnapshotService {
35
37
  private readonly _univerInstanceService;
36
38
  private readonly _snapshotServerService;
37
39
  private readonly _commandService;
38
- private _injector;
39
40
  private _compressMutationService;
40
41
  private _resourceManagerService;
41
- constructor(_revisionService: RevisionService, _univerInstanceService: IUniverInstanceService, _snapshotServerService: ISnapshotServerService, _commandService: ICommandService, _injector: Injector, _compressMutationService: CompressMutationService, _resourceManagerService: IResourceManagerService);
42
+ constructor(_revisionService: RevisionService, _univerInstanceService: IUniverInstanceService, _snapshotServerService: ISnapshotServerService, _commandService: ICommandService, _compressMutationService: CompressMutationService, _resourceManagerService: IResourceManagerService);
42
43
  loadSheet(unitId: string, rev: number, context?: ILogContext): Promise<Workbook>;
43
44
  loadDoc(unitID: string, rev: number, context?: ILogContext): Promise<DocumentDataModel>;
44
- /**
45
- * @deprecated This should be moved to `ResourceLoaderService.saveUnit`.
46
- */
47
- save(_context: ILogContext, workbook: Workbook): IWorkbookData;
48
- /**
49
- * @deprecated This should be moved to `ResourceLoaderService.saveUnit`.
50
- */
45
+ saveSheet(_context: ILogContext, workbook: Workbook): IWorkbookData;
51
46
  saveDoc(_context: ILogContext, document: DocumentDataModel): IDocumentData;
52
47
  }
@@ -19,3 +19,4 @@ export declare function b64EncodeUnicode(str: string): string;
19
19
  * @returns
20
20
  */
21
21
  export declare function b64DecodeUnicode(str: string): string;
22
+ export { v4 as uuidv4 } from 'uuid';