@univerjs-pro/collaboration 0.12.4 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +1 -1
- package/lib/index.js +1 -1
- package/lib/types/controllers/sheet-transform/algorithms/set-worksheet-name/insert-worksheet.algo.d.ts +3 -0
- package/lib/types/index.d.ts +1 -1
- package/lib/types/services/snapshot/snapshot-save.service.d.ts +3 -2
- package/lib/types/services/snapshot/snapshot-transform.d.ts +3 -3
- package/lib/types/services/snapshot/snapshot.service.d.ts +4 -3
- package/lib/types/utils.d.ts +22 -1
- package/lib/umd/index.js +1 -1
- package/package.json +17 -17
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { IInsertSheetMutationParams, ISetWorksheetNameMutationParams } from '@univerjs/sheets';
|
|
2
|
+
import { IMutationTransformAlgorithm } from '../../../../services/transform/transform.service';
|
|
3
|
+
export declare const setWorksheetNameWithInsertSheet: IMutationTransformAlgorithm<ISetWorksheetNameMutationParams, IInsertSheetMutationParams>;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -16,4 +16,4 @@ export { textDecoder, textEncoder } from './services/snapshot/snapshot-utils';
|
|
|
16
16
|
export { ISnapshotServerService, SnapshotService } from './services/snapshot/snapshot.service';
|
|
17
17
|
export { type IMutationTransformAlgorithm, ITransformService, TransformService, } from './services/transform/transform.service';
|
|
18
18
|
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';
|
|
19
|
-
export { b64DecodeUnicode, b64EncodeUnicode, type ILogContext, mapDocumentTypeToUniverType, uuidv4 } from './utils';
|
|
19
|
+
export { b64DecodeUnicode, b64EncodeUnicode, type ILogContext, mapDocumentTypeToUniverType, measureAsyncOperation, measureSyncOperation, uuidv4 } from './utils';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DocumentDataModel, IDocumentData, IWorkbookData, Workbook } from '@univerjs/core';
|
|
1
|
+
import { DocumentDataModel, IDocumentData, IWorkbookData, Workbook, ILogService } from '@univerjs/core';
|
|
2
2
|
import { ISheetBlockMeta, ISnapshot } from '@univerjs/protocol';
|
|
3
3
|
import { ILogContext } from '../../utils';
|
|
4
4
|
import { ISnapshotServerService, SnapshotService } from './snapshot.service';
|
|
@@ -14,7 +14,8 @@ import { ISnapshotServerService, SnapshotService } from './snapshot.service';
|
|
|
14
14
|
export declare class SnapshotSaveService {
|
|
15
15
|
private readonly _snapshotServerService;
|
|
16
16
|
private _snapshotService;
|
|
17
|
-
|
|
17
|
+
private readonly _logService;
|
|
18
|
+
constructor(_snapshotServerService: ISnapshotServerService, _snapshotService: SnapshotService, _logService: ILogService);
|
|
18
19
|
saveSheet(context: ILogContext, unitId: string, rev: number, workbook: Workbook, workbookData?: IWorkbookData): Promise<{
|
|
19
20
|
snapshot: ISnapshot;
|
|
20
21
|
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IDocumentData, IWorkbookData } from '@univerjs/core';
|
|
1
|
+
import { IDocumentData, ILogService, IWorkbookData } from '@univerjs/core';
|
|
2
2
|
import { IDeserializedSheetBlock, ISheetBlock, ISheetBlockMeta, ISnapshot } from '@univerjs/protocol';
|
|
3
3
|
import { ILogContext } from '../../utils';
|
|
4
4
|
import { ISnapshotServerService } from './snapshot.service';
|
|
@@ -11,7 +11,7 @@ export declare function generateTemporarySnap(context: ILogContext, workbook: IW
|
|
|
11
11
|
export declare function transformWorkbookDataToSnapshotNoSave(context: ILogContext, workbook: IWorkbookData, unitID: string, snapshotService: ISnapshotServerService): Promise<{
|
|
12
12
|
[key: string]: ISheetBlockMeta;
|
|
13
13
|
}>;
|
|
14
|
-
export declare function transformWorkbookDataToSnapshot(context: ILogContext, workbook: IWorkbookData, unitID: string, rev: number, snapshotService: ISnapshotServerService): Promise<{
|
|
14
|
+
export declare function transformWorkbookDataToSnapshot(context: ILogContext, workbook: IWorkbookData, unitID: string, rev: number, snapshotService: ISnapshotServerService, logger?: ILogService): Promise<{
|
|
15
15
|
snapshot: ISnapshot;
|
|
16
16
|
}>;
|
|
17
17
|
/**
|
|
@@ -19,7 +19,7 @@ export declare function transformWorkbookDataToSnapshot(context: ILogContext, wo
|
|
|
19
19
|
* @param snapshot
|
|
20
20
|
* @param sheetBlocks
|
|
21
21
|
*/
|
|
22
|
-
export declare function transformSnapshotToWorkbookData(snapshot: ISnapshot, sheetBlocks: (IDeserializedSheetBlock | ISheetBlock)[], _context?: ILogContext): IWorkbookData
|
|
22
|
+
export declare function transformSnapshotToWorkbookData(snapshot: ISnapshot, sheetBlocks: (IDeserializedSheetBlock | ISheetBlock)[], _context?: ILogContext, logService?: ILogService): Promise<IWorkbookData>;
|
|
23
23
|
export declare function transformSnapshotToDocumentData(snapshot: ISnapshot): IDocumentData;
|
|
24
24
|
export declare function transformDocumentDataToSnapshot(context: ILogContext, document: IDocumentData, unitID: string, rev: number, snapshotService: ISnapshotServerService): Promise<{
|
|
25
25
|
snapshot: ISnapshot;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DocumentDataModel, IDocumentData, IWorkbookData, Workbook, ICommandService, IResourceManagerService, IUniverInstanceService } from '@univerjs/core';
|
|
1
|
+
import { DocumentDataModel, IDocumentData, IWorkbookData, Workbook, ICommandService, ILogService, 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';
|
|
@@ -14,7 +14,7 @@ export interface ISnapshotServerService {
|
|
|
14
14
|
getUnitOnRev: (context: ILogContext, params: IGetUnitOnRevRequest) => Promise<IGetUnitOnRevResponse>;
|
|
15
15
|
/** Load sheet block from a database. */
|
|
16
16
|
getSheetBlock: (context: ILogContext, params: IGetSheetBlockRequest) => Promise<IGetSheetBlockResponse>;
|
|
17
|
-
getDeserializedSheetBlock: (context: ILogContext, params: IGetSheetBlockRequest) => Promise<IGetDeserializedSheetBlockResponse>;
|
|
17
|
+
getDeserializedSheetBlock: (context: ILogContext, params: IGetSheetBlockRequest) => Promise<IGetDeserializedSheetBlockResponse | IGetSheetBlockResponse>;
|
|
18
18
|
/** Fetch missing changeset */
|
|
19
19
|
fetchMissingChangesets: (context: ILogContext, params: IFetchMissingChangesetsRequest) => Promise<IFetchMissingChangesetsResponse>;
|
|
20
20
|
getResourcesRequest: (context: ILogContext, params: IGetResourcesRequest) => Promise<IGetResourcesResponse>;
|
|
@@ -37,9 +37,10 @@ export declare class SnapshotService {
|
|
|
37
37
|
private readonly _univerInstanceService;
|
|
38
38
|
private readonly _snapshotServerService;
|
|
39
39
|
private readonly _commandService;
|
|
40
|
+
private readonly _logService;
|
|
40
41
|
private _compressMutationService;
|
|
41
42
|
private _resourceManagerService;
|
|
42
|
-
constructor(_revisionService: RevisionService, _univerInstanceService: IUniverInstanceService, _snapshotServerService: ISnapshotServerService, _commandService: ICommandService, _compressMutationService: CompressMutationService, _resourceManagerService: IResourceManagerService);
|
|
43
|
+
constructor(_revisionService: RevisionService, _univerInstanceService: IUniverInstanceService, _snapshotServerService: ISnapshotServerService, _commandService: ICommandService, _logService: ILogService, _compressMutationService: CompressMutationService, _resourceManagerService: IResourceManagerService);
|
|
43
44
|
loadSheet(unitId: string, rev: number, context?: ILogContext): Promise<Workbook>;
|
|
44
45
|
loadDoc(unitID: string, rev: number, context?: ILogContext): Promise<DocumentDataModel>;
|
|
45
46
|
saveSheet(_context: ILogContext, workbook: Workbook): IWorkbookData;
|
package/lib/types/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UniverInstanceType } from '@univerjs/core';
|
|
1
|
+
import { ILogService, UniverInstanceType } from '@univerjs/core';
|
|
2
2
|
import { UniverType } from '@univerjs/protocol';
|
|
3
3
|
export declare function mapDocumentTypeToUniverType(documentType: UniverInstanceType): UniverType;
|
|
4
4
|
/**
|
|
@@ -20,3 +20,24 @@ export declare function b64EncodeUnicode(str: string): string;
|
|
|
20
20
|
*/
|
|
21
21
|
export declare function b64DecodeUnicode(str: string): string;
|
|
22
22
|
export { v4 as uuidv4 } from 'uuid';
|
|
23
|
+
/**
|
|
24
|
+
* Limit the number of concurrent tasks to avoid OOM
|
|
25
|
+
*/
|
|
26
|
+
export declare function limitConcurrencyTasks<T>({ tasks, handleTaskResult, limit, options, onError, }: {
|
|
27
|
+
tasks: Array<() => Promise<T>>;
|
|
28
|
+
handleTaskResult?: (result: T) => void;
|
|
29
|
+
limit?: number;
|
|
30
|
+
options?: {
|
|
31
|
+
retryCount: number;
|
|
32
|
+
retryDelay: number;
|
|
33
|
+
};
|
|
34
|
+
onError?: (error: unknown) => void;
|
|
35
|
+
}): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Assess and log the duration of an asynchronous operation.
|
|
38
|
+
*/
|
|
39
|
+
export declare function measureAsyncOperation<T>(operationName: string, operation: () => Promise<T>, logService: ILogService, warnThresholdMs?: number, startAdditionalInfo?: string): Promise<T>;
|
|
40
|
+
/**
|
|
41
|
+
* Assess and log the duration of an synchronous operation.
|
|
42
|
+
*/
|
|
43
|
+
export declare function measureSyncOperation<T>(operationName: string, operation: () => T, logService: ILogService, warnThresholdMs?: number, startAdditionalInfo?: string): T;
|