@univerjs-pro/collaboration-client 0.2.10 → 0.2.12
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/locale/en-US.json +5 -0
- package/lib/locale/ru-RU.json +5 -0
- package/lib/locale/vi-VN.json +5 -0
- package/lib/locale/zh-CN.json +11 -6
- package/lib/locale/zh-TW.json +5 -0
- package/lib/types/controllers/collab-cursor/doc-collab-cursor-entity.d.ts +1 -1
- package/lib/types/controllers/collab-cursor/sheet-collab-cursor-entity.d.ts +1 -1
- package/lib/types/controllers/collab-status/collab-status.controller.d.ts +1 -1
- package/lib/types/controllers/collaboration/collaboration-entity.d.ts +87 -0
- package/lib/types/controllers/collaboration/collaboration-state.d.ts +2 -1
- package/lib/types/controllers/collaboration/collaboration.controller.d.ts +4 -88
- package/lib/types/controllers/config.schema.d.ts +5 -0
- package/lib/types/controllers/telemetry.d.ts +11 -0
- package/lib/types/index.d.ts +4 -3
- package/lib/types/locale/zh-CN.d.ts +5 -0
- package/lib/types/plugin.d.ts +3 -2
- package/lib/types/services/collaboration-session/collaboration-session.d.ts +59 -0
- package/lib/types/services/collaboration-session/collaboration-session.service.d.ts +14 -57
- package/lib/types/services/range-selection/sheet-transform-selections.service.d.ts +3 -2
- package/lib/umd/index.js +1 -1
- package/package.json +29 -27
package/lib/locale/en-US.json
CHANGED
package/lib/locale/ru-RU.json
CHANGED
package/lib/locale/vi-VN.json
CHANGED
package/lib/locale/zh-CN.json
CHANGED
@@ -1,17 +1,22 @@
|
|
1
1
|
{
|
2
|
+
"collab-client": {
|
3
|
+
"tooltip": {
|
4
|
+
"reconnect": "点击重新连接"
|
5
|
+
}
|
6
|
+
},
|
2
7
|
"collabStatus": {
|
3
|
-
"fetchMiss": "
|
8
|
+
"fetchMiss": "正在拉取服务端数据...",
|
4
9
|
"conflict": "编辑冲突",
|
5
10
|
"notCollab": "本地文件",
|
6
|
-
"synced": "
|
11
|
+
"synced": "已同步",
|
7
12
|
"syncing": "保存中...",
|
8
|
-
"offline": "
|
13
|
+
"offline": "已离线,编辑将在本地缓存"
|
9
14
|
},
|
10
15
|
"session": {
|
11
16
|
"connection-failed": "连接失败,请检查你的网络",
|
12
|
-
"will-retry": "
|
13
|
-
"room-full": "
|
14
|
-
"collaboration-timeout": "
|
17
|
+
"will-retry": "连接失败,将在一会儿之后重试连接",
|
18
|
+
"room-full": "协同房间已满,你的编辑将在本地缓存",
|
19
|
+
"collaboration-timeout": "服务器未响应,你的编辑将在本地缓存"
|
15
20
|
},
|
16
21
|
"conflict": {
|
17
22
|
"title": "协同冲突",
|
package/lib/locale/zh-TW.json
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
import { ICommandService, Injector, IUniverInstanceService, RxDisposable } from '@univerjs/core';
|
2
2
|
import { ICollaborationUser, ITransformService } from '@univerjs-pro/collaboration';
|
3
3
|
import { IDocCollabCursor } from '../../models/cursor';
|
4
|
-
import { CollaborationSession } from '../../services/collaboration-session/collaboration-session.service';
|
5
4
|
import { ColorAssignService } from '../../services/color-assign/color-assign.service';
|
6
5
|
import { MemberService } from '../../services/member/member.service';
|
7
6
|
import { DocSyncEditingCollabCursorService } from '../../services/sync-editing-collab-cursor/doc-sync-editing-collab-cursor.service';
|
7
|
+
import { CollaborationSession } from '../../services/collaboration-session/collaboration-session';
|
8
8
|
/**
|
9
9
|
* Each univer document instance would map to an `CollabCursorEntity` to handle collaborated editing events.
|
10
10
|
*/
|
@@ -2,9 +2,9 @@ import { ICommandService, Injector, IUniverInstanceService, RxDisposable } from
|
|
2
2
|
import { RefRangeService } from '@univerjs/sheets';
|
3
3
|
import { ICollaborationUser } from '@univerjs-pro/collaboration';
|
4
4
|
import { ISheetCollabCursor } from '../../models/cursor';
|
5
|
-
import { CollaborationSession } from '../../services/collaboration-session/collaboration-session.service';
|
6
5
|
import { ColorAssignService } from '../../services/color-assign/color-assign.service';
|
7
6
|
import { MemberService } from '../../services/member/member.service';
|
7
|
+
import { CollaborationSession } from '../../services/collaboration-session/collaboration-session';
|
8
8
|
/**
|
9
9
|
* Each univer document instance would map to an `CollabCursorEntity` to handle collaborated editing events.
|
10
10
|
*/
|
@@ -13,6 +13,6 @@ export declare class DesktopCollaborationStatusDisplayController extends Disposa
|
|
13
13
|
private readonly _collaborationController;
|
14
14
|
protected readonly _status$: BehaviorSubject<CollaborationStatus>;
|
15
15
|
constructor(_univerInstanceService: IUniverInstanceService, _uiPartsService: IUIPartsService, _injector: Injector, _collaborationController: CollaborationController);
|
16
|
-
protected _initStatusComponent(): void;
|
17
16
|
private _initStatusListener;
|
17
|
+
protected _initStatusComponent(): void;
|
18
18
|
}
|
@@ -0,0 +1,87 @@
|
|
1
|
+
import { CompressMutationService, RevisionService } from '@univerjs-pro/collaboration';
|
2
|
+
import { IDisposable, IMutationInfo, ICommandService, ILogService, Injector, IPermissionService, LocaleService, RxDisposable } from '@univerjs/core';
|
3
|
+
import { DocStateChangeManagerService } from '@univerjs/docs';
|
4
|
+
import { UniverType } from '@univerjs/protocol';
|
5
|
+
import { IMessageService } from '@univerjs/ui';
|
6
|
+
import { Observable, BehaviorSubject } from 'rxjs';
|
7
|
+
import { Nullable } from 'vitest';
|
8
|
+
import { DocTransformIMECacheService } from '../../services/ime-cache-transform/doc-transform-ime-cache.service';
|
9
|
+
import { LocalCacheService } from '../../services/local-cache/local-cache.service';
|
10
|
+
import { SheetTransformSelectionsService } from '../../services/range-selection/sheet-transform-selections.service';
|
11
|
+
import { ISingleActiveUnitService } from '../../services/single-active-unit/single-active-unit.service';
|
12
|
+
import { DocSyncEditingCollabCursorService } from '../../services/sync-editing-collab-cursor/doc-sync-editing-collab-cursor.service';
|
13
|
+
import { DocTransformSelectionsService } from '../../services/text-selection/doc-transform-selections.service';
|
14
|
+
import { CollaborationSession } from '../../services/collaboration-session/collaboration-session';
|
15
|
+
import { CollaborationState, ICollaborationStateHandler, CollaborationStatus } from './collaboration-state';
|
16
|
+
/**
|
17
|
+
* Each univer document instance would map to an `CollaborationEntity` to handle collaborated editing events.
|
18
|
+
*/
|
19
|
+
export declare abstract class CollaborationEntity extends RxDisposable {
|
20
|
+
readonly unitID: string;
|
21
|
+
readonly session: CollaborationSession;
|
22
|
+
protected readonly _type: UniverType;
|
23
|
+
protected readonly _injector: Injector;
|
24
|
+
protected readonly _localCacheService: LocalCacheService;
|
25
|
+
protected readonly _compressMutationService: CompressMutationService;
|
26
|
+
protected readonly _localeService: LocaleService;
|
27
|
+
protected readonly _revisionService: RevisionService;
|
28
|
+
protected readonly _logService: ILogService;
|
29
|
+
protected readonly _commandService: ICommandService;
|
30
|
+
protected readonly _messageService: IMessageService;
|
31
|
+
private _permissionService;
|
32
|
+
protected readonly _singleActiveUnitService?: ISingleActiveUnitService | undefined;
|
33
|
+
protected _state$: BehaviorSubject<Nullable<CollaborationState>>;
|
34
|
+
readonly state$: Observable<Nullable<CollaborationState>>;
|
35
|
+
protected _state: CollaborationState;
|
36
|
+
get state(): CollaborationState;
|
37
|
+
protected _collaborationPaused: boolean;
|
38
|
+
readonly status$: Observable<CollaborationStatus>;
|
39
|
+
constructor(unitID: string, session: CollaborationSession, _type: UniverType, _injector: Injector, _localCacheService: LocalCacheService, _compressMutationService: CompressMutationService, _localeService: LocaleService, _revisionService: RevisionService, _logService: ILogService, _commandService: ICommandService, _messageService: IMessageService, _permissionService: IPermissionService, _singleActiveUnitService?: ISingleActiveUnitService | undefined);
|
40
|
+
init(): Promise<void>;
|
41
|
+
/**
|
42
|
+
* Pause collaboration on the document. Remote changesets would be inserted to a queue and wait for resuming.
|
43
|
+
* @returns a disposable which will resume collaboration when called.
|
44
|
+
*/
|
45
|
+
pauseCollaboration(): IDisposable;
|
46
|
+
private _updateState;
|
47
|
+
protected _init(): Promise<CollaborationState>;
|
48
|
+
/**
|
49
|
+
* Could not transit the state twice at the same time. So we put a lock here in case of implementation fault.
|
50
|
+
*/
|
51
|
+
private _transitionLocked;
|
52
|
+
private _unlockTransition;
|
53
|
+
private _lockTransition;
|
54
|
+
protected _onLocalMutation(command: IMutationInfo): void;
|
55
|
+
private _remoteChangesetQueue;
|
56
|
+
private _onRemoteChangeset;
|
57
|
+
private _exhaustRemoteChangesetQueue;
|
58
|
+
private _applyRemoteChangeset;
|
59
|
+
private _onRemoteACK;
|
60
|
+
private _onRemoteRejected;
|
61
|
+
private _onFetchMissResult;
|
62
|
+
private _toggleOffline;
|
63
|
+
private _toggleOnline;
|
64
|
+
private _createInitialState;
|
65
|
+
protected _createHandler(): ICollaborationStateHandler;
|
66
|
+
private _createInitialStateImpl;
|
67
|
+
private _replayCachedMutations;
|
68
|
+
}
|
69
|
+
export declare class DocCollaborationEntity extends CollaborationEntity {
|
70
|
+
readonly unitID: string;
|
71
|
+
readonly type: UniverType;
|
72
|
+
private readonly _docStateChangeManagerService;
|
73
|
+
private readonly _docTransformIMECacheService;
|
74
|
+
private readonly _docTransformSelectionsService;
|
75
|
+
private readonly _docSyncEditingCollabCursorService;
|
76
|
+
constructor(unitID: string, type: UniverType, session: CollaborationSession, injector: Injector, localCacheService: LocalCacheService, compressMutationService: CompressMutationService, localeService: LocaleService, revisionService: RevisionService, _docStateChangeManagerService: DocStateChangeManagerService, _docTransformIMECacheService: DocTransformIMECacheService, _docTransformSelectionsService: DocTransformSelectionsService, _docSyncEditingCollabCursorService: DocSyncEditingCollabCursorService, logService: ILogService, commandService: ICommandService, messageService: IMessageService, permissionService: IPermissionService, singleActiveUnitService?: ISingleActiveUnitService);
|
77
|
+
protected _createHandler(): ICollaborationStateHandler;
|
78
|
+
protected _init(): Promise<CollaborationState>;
|
79
|
+
}
|
80
|
+
export declare class SheetCollaborationEntity extends CollaborationEntity {
|
81
|
+
readonly unitID: string;
|
82
|
+
readonly type: UniverType;
|
83
|
+
private readonly _sheetTransformSelectionsService;
|
84
|
+
constructor(unitID: string, type: UniverType, session: CollaborationSession, injector: Injector, localCacheService: LocalCacheService, compressMutationService: CompressMutationService, localeService: LocaleService, revisionService: RevisionService, _sheetTransformSelectionsService: SheetTransformSelectionsService, logService: ILogService, commandService: ICommandService, messageService: IMessageService, permissionService: IPermissionService, singleActiveUnitService?: ISingleActiveUnitService);
|
85
|
+
protected _createHandler(): ICollaborationStateHandler;
|
86
|
+
protected _init(): Promise<CollaborationState>;
|
87
|
+
}
|
@@ -120,6 +120,7 @@ export declare class SyncedState extends CollaborationState {
|
|
120
120
|
toggleOffline(): CollaborationState;
|
121
121
|
toggleOnline(): CollaborationState;
|
122
122
|
resend(): void;
|
123
|
+
fetchMiss(): CollaborationState;
|
123
124
|
}
|
124
125
|
/**
|
125
126
|
* Some local changes are waiting to be sent to the server. But no changesets are waiting for acknowledgement.
|
@@ -148,7 +149,7 @@ export declare class PendingState extends CollaborationState {
|
|
148
149
|
*
|
149
150
|
* @internal
|
150
151
|
*/
|
151
|
-
_schedule(
|
152
|
+
_schedule(t?: number): void;
|
152
153
|
private _getSendChangesetTimeout;
|
153
154
|
resend(): void;
|
154
155
|
private _clearScheduledTask;
|
@@ -1,17 +1,7 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import { Observable, BehaviorSubject } from 'rxjs';
|
6
|
-
import { DocStateChangeManagerService } from '@univerjs/docs';
|
7
|
-
import { CollaborationSession, CollaborationSessionService } from '../../services/collaboration-session/collaboration-session.service';
|
8
|
-
import { LocalCacheService } from '../../services/local-cache/local-cache.service';
|
9
|
-
import { ISingleActiveUnitService } from '../../services/single-active-unit/single-active-unit.service';
|
10
|
-
import { DocTransformIMECacheService } from '../../services/ime-cache-transform/doc-transform-ime-cache.service';
|
11
|
-
import { DocTransformSelectionsService } from '../../services/text-selection/doc-transform-selections.service';
|
12
|
-
import { DocSyncEditingCollabCursorService } from '../../services/sync-editing-collab-cursor/doc-sync-editing-collab-cursor.service';
|
13
|
-
import { SheetTransformSelectionsService } from '../../services/range-selection/sheet-transform-selections.service';
|
14
|
-
import { CollaborationState, ICollaborationStateHandler, CollaborationStatus } from './collaboration-state';
|
1
|
+
import { Nullable, Injector, IUniverInstanceService, RxDisposable } from '@univerjs/core';
|
2
|
+
import { Observable } from 'rxjs';
|
3
|
+
import { CollaborationSessionService } from '../../services/collaboration-session/collaboration-session.service';
|
4
|
+
import { CollaborationEntity } from './collaboration-entity';
|
15
5
|
export declare class CollaborationController extends RxDisposable {
|
16
6
|
private readonly _injector;
|
17
7
|
private readonly _collabSessionService;
|
@@ -32,77 +22,3 @@ export declare class CollaborationController extends RxDisposable {
|
|
32
22
|
private _startCollaboration;
|
33
23
|
private _getCtorByUniverType;
|
34
24
|
}
|
35
|
-
/**
|
36
|
-
* Each univer document instance would map to an `CollaborationEntity` to handle collaborated editing events.
|
37
|
-
*/
|
38
|
-
export declare abstract class CollaborationEntity extends RxDisposable {
|
39
|
-
readonly unitID: string;
|
40
|
-
protected readonly _type: UniverType;
|
41
|
-
protected readonly _session: CollaborationSession;
|
42
|
-
protected readonly _injector: Injector;
|
43
|
-
protected readonly _localCacheService: LocalCacheService;
|
44
|
-
protected readonly _compressMutationService: CompressMutationService;
|
45
|
-
protected readonly _localeService: LocaleService;
|
46
|
-
protected readonly _revisionService: RevisionService;
|
47
|
-
protected readonly _logService: ILogService;
|
48
|
-
protected readonly _commandService: ICommandService;
|
49
|
-
protected readonly _messageService: IMessageService;
|
50
|
-
private _permissionService;
|
51
|
-
protected readonly _singleActiveUnitService?: ISingleActiveUnitService | undefined;
|
52
|
-
protected _state$: BehaviorSubject<Nullable<CollaborationState>>;
|
53
|
-
readonly state$: Observable<Nullable<CollaborationState>>;
|
54
|
-
protected _state: CollaborationState;
|
55
|
-
get state(): CollaborationState;
|
56
|
-
protected _collaborationPaused: boolean;
|
57
|
-
readonly status$: Observable<CollaborationStatus>;
|
58
|
-
constructor(unitID: string, _type: UniverType, _session: CollaborationSession, _injector: Injector, _localCacheService: LocalCacheService, _compressMutationService: CompressMutationService, _localeService: LocaleService, _revisionService: RevisionService, _logService: ILogService, _commandService: ICommandService, _messageService: IMessageService, _permissionService: IPermissionService, _singleActiveUnitService?: ISingleActiveUnitService | undefined);
|
59
|
-
init(): Promise<void>;
|
60
|
-
/**
|
61
|
-
* Pause collaboration on the document. Remote changesets would be inserted to a queue and wait for resuming.
|
62
|
-
* @returns a disposable which will resume collaboration when called.
|
63
|
-
*/
|
64
|
-
pauseCollaboration(): IDisposable;
|
65
|
-
private _updateState;
|
66
|
-
protected _init(): Promise<CollaborationState>;
|
67
|
-
/**
|
68
|
-
* Could not transit the state twice at the same time. So we put a lock here in case of implementation fault.
|
69
|
-
*/
|
70
|
-
private _transitionLocked;
|
71
|
-
private _unlockTransition;
|
72
|
-
private _lockTransition;
|
73
|
-
protected _onLocalMutation(command: IMutationInfo): void;
|
74
|
-
private _remoteChangesetQueue;
|
75
|
-
private _onRemoteChangeset;
|
76
|
-
private _exhaustRemoteChangesetQueue;
|
77
|
-
private _applyRemoteChangeset;
|
78
|
-
private _onRemoteACK;
|
79
|
-
private _onRemoteRejected;
|
80
|
-
private _onFetchMissResult;
|
81
|
-
private _toggleOffline;
|
82
|
-
private _toggleOnline;
|
83
|
-
private _createInitialState;
|
84
|
-
protected _createHandler(): ICollaborationStateHandler;
|
85
|
-
private _createInitialStateImpl;
|
86
|
-
private _replayCachedMutations;
|
87
|
-
}
|
88
|
-
export declare class DocCollaborationEntity extends CollaborationEntity {
|
89
|
-
readonly unitID: string;
|
90
|
-
readonly type: UniverType;
|
91
|
-
readonly session: CollaborationSession;
|
92
|
-
private readonly _docStateChangeManagerService;
|
93
|
-
private readonly _docTransformIMECacheService;
|
94
|
-
private readonly _docTransformSelectionsService;
|
95
|
-
private readonly _docSyncEditingCollabCursorService;
|
96
|
-
constructor(unitID: string, type: UniverType, session: CollaborationSession, injector: Injector, localCacheService: LocalCacheService, compressMutationService: CompressMutationService, localeService: LocaleService, revisionService: RevisionService, _docStateChangeManagerService: DocStateChangeManagerService, _docTransformIMECacheService: DocTransformIMECacheService, _docTransformSelectionsService: DocTransformSelectionsService, _docSyncEditingCollabCursorService: DocSyncEditingCollabCursorService, logService: ILogService, commandService: ICommandService, messageService: IMessageService, permissionService: IPermissionService, singleActiveUnitService?: ISingleActiveUnitService);
|
97
|
-
protected _createHandler(): ICollaborationStateHandler;
|
98
|
-
protected _init(): Promise<CollaborationState>;
|
99
|
-
}
|
100
|
-
export declare class SheetCollaborationEntity extends CollaborationEntity {
|
101
|
-
readonly unitID: string;
|
102
|
-
readonly type: UniverType;
|
103
|
-
readonly session: CollaborationSession;
|
104
|
-
private readonly _sheetTransformSelectionsService;
|
105
|
-
constructor(unitID: string, type: UniverType, session: CollaborationSession, injector: Injector, localCacheService: LocalCacheService, compressMutationService: CompressMutationService, localeService: LocaleService, revisionService: RevisionService, _sheetTransformSelectionsService: SheetTransformSelectionsService, logService: ILogService, commandService: ICommandService, messageService: IMessageService, permissionService: IPermissionService, singleActiveUnitService?: ISingleActiveUnitService);
|
106
|
-
protected _createHandler(): ICollaborationStateHandler;
|
107
|
-
protected _init(): Promise<CollaborationState>;
|
108
|
-
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { IMutationInfo, UniverInstanceType } from '@univerjs/core';
|
2
|
+
export declare const TELEMETRY_COLLABORATION_NEW_CHANGESET = "collaboration_new_changeset";
|
3
|
+
export interface INewChangesetTelemetryInfo {
|
4
|
+
startTime: number;
|
5
|
+
stopTime: number;
|
6
|
+
duration: number;
|
7
|
+
size: number;
|
8
|
+
type: UniverInstanceType;
|
9
|
+
unitId: string;
|
10
|
+
}
|
11
|
+
export declare function summaryChangesetSize(mutations: IMutationInfo[]): number;
|
package/lib/types/index.d.ts
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
export { SNAPSHOT_SERVER_URL_KEY, SNAPSHOT_URL_KEY, SEND_CHANGESET_TIMEOUT_KEY, COLLAB_WEB_SOCKET_URL_KEY, HEARTBEAT_INTERVAL_KEY, HEARTBEAT_TIMEOUT_KEY, LOCAL_CACHE_INTERVAL_KEY, COLLAB_SUBMIT_CHANGESET_URL_KEY, LOGIN_URL_KEY, } from './config/config';
|
1
|
+
export { SNAPSHOT_SERVER_URL_KEY, SNAPSHOT_URL_KEY, SEND_CHANGESET_TIMEOUT_KEY, COLLAB_WEB_SOCKET_URL_KEY, HEARTBEAT_INTERVAL_KEY, HEARTBEAT_TIMEOUT_KEY, LOCAL_CACHE_INTERVAL_KEY, RETRY_CONNECTING_INTERVAL_KEY, RETRY_CONNECTING_MAX_COUNT_KEY, COLLAB_SUBMIT_CHANGESET_URL_KEY, LOGIN_URL_KEY, } from './config/config';
|
2
2
|
export { CollaborationController } from './controllers/collaboration/collaboration.controller';
|
3
|
+
export { CollaborationEntity, SheetCollaborationEntity, DocCollaborationEntity } from './controllers/collaboration/collaboration-entity';
|
3
4
|
export { CollaborationStatus } from './controllers/collaboration/collaboration-state';
|
4
5
|
export { UniverCollaborationClientPlugin, type ICollaborationClientPluginConfig } from './plugin';
|
5
|
-
export {
|
6
|
+
export { CollaborationSessionService } from './services/collaboration-session/collaboration-session.service';
|
7
|
+
export { CollaborationSession, SessionStatus } from './services/collaboration-session/collaboration-session';
|
6
8
|
export type { ICollaborationSocket } from './services/socket/collaboration-socket.service';
|
7
9
|
export { CollaborationSocketService, ICollaborationSocketService, } from './services/socket/collaboration-socket.service';
|
8
10
|
export { LocalCacheService } from './services/local-cache/local-cache.service';
|
@@ -15,6 +17,5 @@ export { deserializeToCombResponse, serializeCombRequest } from './services/sock
|
|
15
17
|
export { CollaborationStatusDisplay } from './views/components/CollabStatus';
|
16
18
|
export { SnapshotServerOverHTTPService } from './services/snapshot-server/snapshot-server.service';
|
17
19
|
export { CommentService } from './services/comment/comment.service';
|
18
|
-
export { SheetCollaborationEntity } from './controllers/collaboration/collaboration.controller';
|
19
20
|
export { SheetCollabCursorShape, type ISheetCollabCursorShapeProps } from './views/shapes/sheet-collab-cursor.shape';
|
20
21
|
export { ImageIoService } from './services/image-remote/image-io.service';
|
package/lib/types/plugin.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Ctor, DependencyOverride, ILogService, Injector, Plugin } from '@univerjs/core';
|
1
|
+
import { Ctor, DependencyOverride, IConfigService, ILogService, Injector, Plugin } from '@univerjs/core';
|
2
2
|
import { IRenderManagerService } from '@univerjs/engine-render';
|
3
3
|
import { ICollaborationSocketService } from './services/socket/collaboration-socket.service';
|
4
4
|
export interface ICollaborationClientPluginConfig {
|
@@ -16,8 +16,9 @@ export declare class UniverCollaborationClientPlugin extends Plugin {
|
|
16
16
|
private readonly _logService;
|
17
17
|
private readonly _renderManagerService;
|
18
18
|
protected _injector: Injector;
|
19
|
+
private readonly _configService;
|
19
20
|
static pluginName: string;
|
20
|
-
constructor(_config: ICollaborationClientPluginConfig | undefined, _logService: ILogService, _renderManagerService: IRenderManagerService, _injector: Injector);
|
21
|
+
constructor(_config: ICollaborationClientPluginConfig | undefined, _logService: ILogService, _renderManagerService: IRenderManagerService, _injector: Injector, _configService: IConfigService);
|
21
22
|
onStarting(): void;
|
22
23
|
onRendered(): void;
|
23
24
|
private _registerDependencies;
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import { ICollaborationEvent } from '@univerjs-pro/collaboration';
|
2
|
+
import { IDisposable, Nullable, IConfigService, ILogService, LocaleService, RxDisposable } from '@univerjs/core';
|
3
|
+
import { IBeforeCloseService, IMessageService } from '@univerjs/ui';
|
4
|
+
import { Observable } from 'rxjs';
|
5
|
+
import { ITelemetryService } from '@univerjs/telemetry';
|
6
|
+
import { CommentService } from '../comment/comment.service';
|
7
|
+
import { MemberService } from '../member/member.service';
|
8
|
+
import { ICollaborationSocket } from '../socket/collaboration-socket.service';
|
9
|
+
export declare enum SessionStatus {
|
10
|
+
IDLE = 0,
|
11
|
+
JOINING = 1,
|
12
|
+
OFFLINE = 2,
|
13
|
+
ONLINE = 3
|
14
|
+
}
|
15
|
+
/**
|
16
|
+
* The data structure to represent a collaboration session. It also manages the collaborator's identity.
|
17
|
+
*
|
18
|
+
* An collaboration session maps to a unit.
|
19
|
+
*/
|
20
|
+
export declare class CollaborationSession extends RxDisposable implements IDisposable {
|
21
|
+
private readonly _unitID;
|
22
|
+
private readonly _logService;
|
23
|
+
private readonly _beforeCloseService;
|
24
|
+
private readonly _messageService;
|
25
|
+
private readonly _configService;
|
26
|
+
private readonly _localeService;
|
27
|
+
private readonly _memberService;
|
28
|
+
private readonly _commentService;
|
29
|
+
private readonly _telemetryService?;
|
30
|
+
private readonly _sessionStatus$;
|
31
|
+
readonly sessionStatus$: Observable<SessionStatus>;
|
32
|
+
get sessionStatus(): SessionStatus;
|
33
|
+
private readonly _event$;
|
34
|
+
readonly event$: Observable<ICollaborationEvent>;
|
35
|
+
private _socket;
|
36
|
+
private _socketMessageSubscription;
|
37
|
+
constructor(_unitID: string, socket$: Observable<Nullable<ICollaborationSocket>>, _logService: ILogService, _beforeCloseService: IBeforeCloseService, _messageService: IMessageService, _configService: IConfigService, _localeService: LocaleService, _memberService: MemberService, _commentService: CommentService, _telemetryService?: ITelemetryService | undefined);
|
38
|
+
getMemberID(): string | null;
|
39
|
+
dispose(): void;
|
40
|
+
close(): void;
|
41
|
+
private _onCombEvent;
|
42
|
+
private _joinRoom;
|
43
|
+
private _onJoinRoomEvent;
|
44
|
+
private _onRecvEvent;
|
45
|
+
private _onUserJoin;
|
46
|
+
private _onUserLeave;
|
47
|
+
/**
|
48
|
+
* Send event to the collaboration server.
|
49
|
+
*/
|
50
|
+
send(event: ICollaborationEvent, unitID: string): Promise<void>;
|
51
|
+
private _collaborationTimeoutTimer;
|
52
|
+
private _scheduleCollaborationTimeoutTimer;
|
53
|
+
private _clearCollaborationTimeoutTimer;
|
54
|
+
private _shouldReportTelemetry;
|
55
|
+
private _telemetryInfo;
|
56
|
+
private _startTelemetryCollaborationNewChangeset;
|
57
|
+
private _stopTelemetryCollaborationNewChangeset;
|
58
|
+
private _throwTelemetryCollaborationNewChangeset;
|
59
|
+
}
|
@@ -1,55 +1,7 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import { ICollaborationEvent } from '@univerjs-pro/collaboration';
|
4
|
-
import { Observable } from 'rxjs';
|
5
|
-
import { MemberService } from '../member/member.service';
|
1
|
+
import { Nullable, Disposable, IConfigService, ILogService, Injector, LocaleService } from '@univerjs/core';
|
2
|
+
import { IMessageService } from '@univerjs/ui';
|
6
3
|
import { ICollaborationSocket, ICollaborationSocketService } from '../socket/collaboration-socket.service';
|
7
|
-
import {
|
8
|
-
export declare enum SessionStatus {
|
9
|
-
IDLE = 0,
|
10
|
-
JOINING = 1,
|
11
|
-
OFFLINE = 2,
|
12
|
-
ONLINE = 3
|
13
|
-
}
|
14
|
-
/**
|
15
|
-
* The data structure to represent a collaboration session. It also manages the collaborator's identity.
|
16
|
-
*
|
17
|
-
* An collaboration session maps to a unit.
|
18
|
-
*/
|
19
|
-
export declare class CollaborationSession extends RxDisposable implements IDisposable {
|
20
|
-
private readonly _unitID;
|
21
|
-
private readonly _logService;
|
22
|
-
private readonly _beforeCloseService;
|
23
|
-
private readonly _messageService;
|
24
|
-
private readonly _configService;
|
25
|
-
private readonly _localeService;
|
26
|
-
private readonly _memberService;
|
27
|
-
private readonly _commentService;
|
28
|
-
private readonly _sessionStatus$;
|
29
|
-
readonly sessionStatus$: Observable<SessionStatus>;
|
30
|
-
get sessionStatus(): SessionStatus;
|
31
|
-
private readonly _event$;
|
32
|
-
readonly event$: Observable<ICollaborationEvent>;
|
33
|
-
private _socket;
|
34
|
-
private _socketMessageSubscription;
|
35
|
-
constructor(_unitID: string, socket$: Observable<Nullable<ICollaborationSocket>>, _logService: ILogService, _beforeCloseService: IBeforeCloseService, _messageService: IMessageService, _configService: IConfigService, _localeService: LocaleService, _memberService: MemberService, _commentService: CommentService);
|
36
|
-
getMemberID(): string | null;
|
37
|
-
dispose(): void;
|
38
|
-
close(): void;
|
39
|
-
private _onCombEvent;
|
40
|
-
private _joinRoom;
|
41
|
-
private _onJoinRoomEvent;
|
42
|
-
private _onRecvEvent;
|
43
|
-
private _onUserJoin;
|
44
|
-
private _onUserLeave;
|
45
|
-
/**
|
46
|
-
* Send event to the collaboration server.
|
47
|
-
*/
|
48
|
-
send(event: ICollaborationEvent, unitID: string): Promise<void>;
|
49
|
-
private _collaborationTimeoutTimer;
|
50
|
-
private _scheduleCollaborationTimeoutTimer;
|
51
|
-
private _clearCollaborationTimeoutTimer;
|
52
|
-
}
|
4
|
+
import { CollaborationSession, SessionStatus } from './collaboration-session';
|
53
5
|
/**
|
54
6
|
* This service provide collaboration sessions to univer instances. A collaboration session
|
55
7
|
* may be used by different controllers of different features.
|
@@ -65,13 +17,12 @@ export declare class CollaborationSessionService extends Disposable {
|
|
65
17
|
* Socket for collaboration sessions. Session are by unitID but the socket is share by collaboration sessions.
|
66
18
|
*/
|
67
19
|
private _socket$;
|
20
|
+
readonly socket$: import('rxjs').Observable<Nullable<ICollaborationSocket>>;
|
68
21
|
private get _socket();
|
69
22
|
private _sessions;
|
70
23
|
private _status$;
|
71
|
-
status$: Observable<SessionStatus>;
|
24
|
+
status$: import('rxjs').Observable<SessionStatus>;
|
72
25
|
private _socketReady;
|
73
|
-
private _sendHeartbeatTimer;
|
74
|
-
private _timeoutTimer;
|
75
26
|
private _retryConnectingTimer;
|
76
27
|
private _retryCount;
|
77
28
|
constructor(_injector: Injector, _localeService: LocaleService, _messageService: IMessageService, _logService: ILogService, _configService: IConfigService, _socketService: ICollaborationSocketService);
|
@@ -83,6 +34,7 @@ export declare class CollaborationSessionService extends Disposable {
|
|
83
34
|
*/
|
84
35
|
requireSession(unitID: string): Promise<CollaborationSession>;
|
85
36
|
closeSession(unitID: string): void;
|
37
|
+
reconnect(): void;
|
86
38
|
private _createSocket;
|
87
39
|
/**
|
88
40
|
* Try to establish connection to the collaboration server.
|
@@ -91,12 +43,17 @@ export declare class CollaborationSessionService extends Disposable {
|
|
91
43
|
*/
|
92
44
|
private _tryEnsureSocket;
|
93
45
|
private _onConnectionOpen;
|
46
|
+
private _listenToOfflineEvent;
|
47
|
+
private _onOffline;
|
94
48
|
private _onConnectionFailed;
|
95
|
-
private
|
96
|
-
private
|
49
|
+
private _listenToOnlineEvent;
|
50
|
+
private _tryReconnect;
|
51
|
+
private _onMessage;
|
52
|
+
private _sendHeartbeatTimer;
|
53
|
+
private _timeoutTimer;
|
54
|
+
private _rescheduleHeartbeat;
|
97
55
|
private _sendHeartbeat;
|
98
56
|
private _waitForHeartbeatResponse;
|
99
|
-
private _onMessage;
|
100
57
|
private _clearHeartbeatTimer;
|
101
58
|
private _clearTimeoutTimer;
|
102
59
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { IChangeset, ITransformService } from '@univerjs-pro/collaboration';
|
2
|
-
import { Injector } from '@univerjs/core';
|
2
|
+
import { Injector, IUniverInstanceService } from '@univerjs/core';
|
3
3
|
export declare function extractTargetFromFirstChangeset(changeset: IChangeset): {
|
4
4
|
unitId: string;
|
5
5
|
subUnitId: string;
|
@@ -7,6 +7,7 @@ export declare function extractTargetFromFirstChangeset(changeset: IChangeset):
|
|
7
7
|
export declare class SheetTransformSelectionsService {
|
8
8
|
private readonly _injector;
|
9
9
|
private readonly _transformService;
|
10
|
-
|
10
|
+
private readonly _instanceService;
|
11
|
+
constructor(_injector: Injector, _transformService: ITransformService, _instanceService: IUniverInstanceService);
|
11
12
|
transformSelections(changeset: IChangeset): void;
|
12
13
|
}
|