@univerjs-pro/collaboration-client 0.2.11 → 0.2.13

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.
Files changed (29) hide show
  1. package/lib/cjs/index.js +1 -1
  2. package/lib/es/index.js +1 -1
  3. package/lib/locale/en-US.json +5 -0
  4. package/lib/locale/ru-RU.json +5 -0
  5. package/lib/locale/vi-VN.json +5 -0
  6. package/lib/locale/zh-CN.json +11 -6
  7. package/lib/locale/zh-TW.json +5 -0
  8. package/lib/types/config/config.d.ts +1 -1
  9. package/lib/types/controllers/collab-cursor/doc-collab-cursor-entity.d.ts +1 -1
  10. package/lib/types/controllers/collab-cursor/sheet-collab-cursor-entity.d.ts +1 -1
  11. package/lib/types/controllers/collab-status/collab-status.controller.d.ts +1 -1
  12. package/lib/types/controllers/collaboration/__tests__/mock-text-selection-render-manager.service.d.ts +0 -9
  13. package/lib/types/controllers/collaboration/collaboration-entity.d.ts +87 -0
  14. package/lib/types/controllers/collaboration/collaboration-state.d.ts +3 -2
  15. package/lib/types/controllers/collaboration/collaboration.controller.d.ts +4 -88
  16. package/lib/types/controllers/config.schema.d.ts +5 -0
  17. package/lib/types/controllers/telemetry.d.ts +11 -0
  18. package/lib/types/index.d.ts +4 -3
  19. package/lib/types/locale/zh-CN.d.ts +5 -0
  20. package/lib/types/plugin.d.ts +3 -2
  21. package/lib/types/services/collaboration-session/collaboration-session.d.ts +59 -0
  22. package/lib/types/services/collaboration-session/collaboration-session.service.d.ts +16 -58
  23. package/lib/types/services/ime-cache-transform/doc-transform-ime-cache.service.d.ts +3 -1
  24. package/lib/types/services/range-selection/sheet-transform-selections.service.d.ts +3 -2
  25. package/lib/types/services/single-active-unit/single-active-unit.service.d.ts +1 -1
  26. package/lib/types/services/socket/collaboration-socket.service.d.ts +5 -5
  27. package/lib/types/services/url/url.service.d.ts +1 -1
  28. package/lib/umd/index.js +1 -1
  29. package/package.json +36 -31
@@ -1,4 +1,9 @@
1
1
  {
2
+ "collab-client": {
3
+ "tooltip": {
4
+ "reconnect": "Click to Reconnect"
5
+ }
6
+ },
2
7
  "collabStatus": {
3
8
  "fetchMiss": "Syncing server data...",
4
9
  "conflict": "Edit conflicts",
@@ -1,4 +1,9 @@
1
1
  {
2
+ "collab-client": {
3
+ "tooltip": {
4
+ "reconnect": "Click to Reconnect"
5
+ }
6
+ },
2
7
  "collabStatus": {
3
8
  "fetchMiss": "Syncing server data...",
4
9
  "conflict": "Edit conflicts",
@@ -1,4 +1,9 @@
1
1
  {
2
+ "collab-client": {
3
+ "tooltip": {
4
+ "reconnect": "Click to Reconnect"
5
+ }
6
+ },
2
7
  "collabStatus": {
3
8
  "fetchMiss": "Syncing server data...",
4
9
  "conflict": "Edit conflicts",
@@ -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": "协同冲突",
@@ -1,4 +1,9 @@
1
1
  {
2
+ "collab-client": {
3
+ "tooltip": {
4
+ "reconnect": "Click to Reconnect"
5
+ }
6
+ },
2
7
  "collabStatus": {
3
8
  "fetchMiss": "Syncing server data...",
4
9
  "conflict": "Edit conflicts",
@@ -24,7 +24,7 @@ export declare const DEFAULT_COLLAB_WEB_SOCKET_URL = "ws://127.0.0.1:8000/univer
24
24
  export declare const HEARTBEAT_INTERVAL_KEY = "HEARTBEAT_INTERVAL";
25
25
  export declare const DEFAULT_HEARTBEAT_INTERVAL = 30000;
26
26
  export declare const HEARTBEAT_TIMEOUT_KEY = "HEARTBEAT_TIMEOUT";
27
- export declare const DEFAULT_HEARTBEAT_TIMEOUT = 10000;
27
+ export declare const DEFAULT_HEARTBEAT_TIMEOUT = 20000;
28
28
  export declare const RETRY_CONNECTING_INTERVAL_KEY = "RETRY_CONNECTING_INTERVAL";
29
29
  export declare const DEFAULT_RETRY_CONNECTING_INTERVAL = 20000;
30
30
  export declare const RETRY_CONNECTING_MAX_COUNT_KEY = "RETRY_CONNECTING_MAX_COUNT";
@@ -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
  }
@@ -1,9 +0,0 @@
1
- import { Nullable } from '@univerjs/core';
2
- import { ITextSelectionInnerParam } from '@univerjs/engine-render';
3
- export declare class TextSelectionRenderManager {
4
- private readonly _textSelectionInner$;
5
- readonly textSelectionInner$: import('rxjs').Observable<Nullable<ITextSelectionInnerParam>>;
6
- removeAllTextRanges(): void;
7
- addTextRanges(): void;
8
- }
9
- export declare const ITextSelectionRenderManager: import('@univerjs/core').IdentifierDecorator<TextSelectionRenderManager>;
@@ -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 { UniverType } from '@univerjs/protocol';
4
+ import { IMessageService } from '@univerjs/ui';
5
+ import { Observable, BehaviorSubject } from 'rxjs';
6
+ import { Nullable } from 'vitest';
7
+ import { DocStateChangeManagerService } from '@univerjs/docs-ui';
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(timeout?: number): void;
152
+ _schedule(t?: number): void;
152
153
  private _getSendChangesetTimeout;
153
154
  resend(): void;
154
155
  private _clearScheduledTask;
@@ -207,7 +208,7 @@ export declare class ConflictState extends CollaborationState {
207
208
  private readonly _localeService;
208
209
  private readonly _notificationService;
209
210
  readonly status = CollaborationStatus.CONFLICT;
210
- constructor(unitID: string, type: UniverType, awaitingChangeset: Nullable<IChangeset>, pendingMutations: IMutationInfo[], handler: ICollaborationStateHandler, _isPermissionRej: boolean, _permissionService: IPermissionService, commandService: ICommandService, undoRedoService: ICollaborativeUndoRedoService, localCacheService: LocalCacheService, revisionService: RevisionService, _localeService: LocaleService, _notificationService: INotificationService);
211
+ constructor(unitID: string, type: UniverType, awaitingChangeset: Nullable<IChangeset>, pendingMutations: IMutationInfo[], handler: ICollaborationStateHandler, _isPermissionRej: boolean | undefined, _permissionService: IPermissionService, commandService: ICommandService, undoRedoService: ICollaborativeUndoRedoService, localCacheService: LocalCacheService, revisionService: RevisionService, _localeService: LocaleService, _notificationService: INotificationService);
211
212
  appendMutation(): CollaborationState;
212
213
  onRemoteChangeset(): CollaborationState;
213
214
  onRemoteAck(): CollaborationState;
@@ -1,17 +1,7 @@
1
- import { IDisposable, IMutationInfo, Nullable, ICommandService, ILogService, Injector, IPermissionService, IUniverInstanceService, LocaleService, RxDisposable } from '@univerjs/core';
2
- import { IMessageService } from '@univerjs/ui';
3
- import { CompressMutationService, RevisionService } from '@univerjs-pro/collaboration';
4
- import { UniverType } from '@univerjs/protocol';
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,5 @@
1
+ export declare const PLUGIN_CONFIG_KEY = "collaboration-client.config";
2
+ export declare const configSymbol: unique symbol;
3
+ export interface IUniverCollaborationClientConfig {
4
+ }
5
+ export declare const defaultPluginConfig: IUniverCollaborationClientConfig;
@@ -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;
@@ -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 { CollaborationSession, CollaborationSessionService, SessionStatus, } from './services/collaboration-session/collaboration-session.service';
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';
@@ -1,4 +1,9 @@
1
1
  declare const locales: {
2
+ 'collab-client': {
3
+ tooltip: {
4
+ reconnect: string;
5
+ };
6
+ };
2
7
  collabStatus: {
3
8
  fetchMiss: string;
4
9
  conflict: string;
@@ -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 { IConfigService, ILogService, LocaleService, RxDisposable, IDisposable, Nullable } from '@univerjs/core';
2
+ import { ITelemetryService } from '@univerjs/telemetry';
3
+ import { IBeforeCloseService, IMessageService } from '@univerjs/ui';
4
+ import { ICollaborationEvent } from '@univerjs-pro/collaboration';
5
+ import { Observable } from 'rxjs';
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 { IDisposable, Nullable, Disposable, IConfigService, ILogService, Injector, LocaleService, RxDisposable } from '@univerjs/core';
2
- import { IBeforeCloseService, IMessageService } from '@univerjs/ui';
3
- import { ICollaborationEvent } from '@univerjs-pro/collaboration';
4
- import { Observable } from 'rxjs';
5
- import { MemberService } from '../member/member.service';
6
- import { ICollaborationSocket, ICollaborationSocketService } from '../socket/collaboration-socket.service';
7
- import { CommentService } from '../comment/comment.service';
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
- }
1
+ import { Disposable, IConfigService, ILogService, Injector, LocaleService, Nullable } from '@univerjs/core';
2
+ import { IMessageService } from '@univerjs/ui';
3
+ import { ICollaborationSocketService, ICollaborationSocket } from '../socket/collaboration-socket.service';
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,13 @@ 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();
22
+ private _candidateSocket;
69
23
  private _sessions;
70
24
  private _status$;
71
- status$: Observable<SessionStatus>;
25
+ status$: import('rxjs').Observable<SessionStatus>;
72
26
  private _socketReady;
73
- private _sendHeartbeatTimer;
74
- private _timeoutTimer;
75
27
  private _retryConnectingTimer;
76
28
  private _retryCount;
77
29
  constructor(_injector: Injector, _localeService: LocaleService, _messageService: IMessageService, _logService: ILogService, _configService: IConfigService, _socketService: ICollaborationSocketService);
@@ -83,6 +35,7 @@ export declare class CollaborationSessionService extends Disposable {
83
35
  */
84
36
  requireSession(unitID: string): Promise<CollaborationSession>;
85
37
  closeSession(unitID: string): void;
38
+ reconnect(): void;
86
39
  private _createSocket;
87
40
  /**
88
41
  * Try to establish connection to the collaboration server.
@@ -91,12 +44,17 @@ export declare class CollaborationSessionService extends Disposable {
91
44
  */
92
45
  private _tryEnsureSocket;
93
46
  private _onConnectionOpen;
47
+ private _listenToOfflineEvent;
48
+ private _onOffline;
94
49
  private _onConnectionFailed;
95
- private _scheduleReconnection;
96
- private _rescheduleHeartbeatEvent;
50
+ private _listenToOnlineEvent;
51
+ private _tryReconnect;
52
+ private _onMessage;
53
+ private _sendHeartbeatTimer;
54
+ private _timeoutTimer;
55
+ private _rescheduleHeartbeat;
97
56
  private _sendHeartbeat;
98
57
  private _waitForHeartbeatResponse;
99
- private _onMessage;
100
58
  private _clearHeartbeatTimer;
101
59
  private _clearTimeoutTimer;
102
60
  }
@@ -1,9 +1,11 @@
1
1
  import { ITransformService, IChangeset } from '@univerjs-pro/collaboration';
2
2
  import { Injector } from '@univerjs/core';
3
+ import { IRenderManagerService } from '@univerjs/engine-render';
3
4
  export declare class DocTransformIMECacheService {
4
5
  private readonly _injector;
5
6
  private readonly _transformService;
6
- constructor(_injector: Injector, _transformService: ITransformService);
7
+ private readonly _renderManagerService;
8
+ constructor(_injector: Injector, _transformService: ITransformService, _renderManagerService: IRenderManagerService);
7
9
  transformIMECache(changeset: IChangeset): void;
8
10
  transformRemoteChangeset(changeset: IChangeset): IChangeset;
9
11
  private _transformUndoRedoStack;
@@ -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
- constructor(_injector: Injector, _transformService: ITransformService);
10
+ private readonly _instanceService;
11
+ constructor(_injector: Injector, _transformService: ITransformService, _instanceService: IUniverInstanceService);
11
12
  transformSelections(changeset: IChangeset): void;
12
13
  }
@@ -5,7 +5,7 @@ import { Observable } from 'rxjs';
5
5
  * especially when the there is not access to the internet. There is a great chance of loosing
6
6
  * offline data! So we should make there is only one active unit at a time.
7
7
  */
8
- export declare const ISingleActiveUnitService: import('@univerjs/core').IdentifierDecorator<ISingleActiveUnitService>;
8
+ export declare const ISingleActiveUnitService: import('@wendellhu/redi').IdentifierDecorator<ISingleActiveUnitService>;
9
9
  export interface ISingleActiveUnitService {
10
10
  editingUnit: (unitID: string) => void;
11
11
  getUnitStatus$: (unitID: string) => Observable<UnitStatus>;