@univerjs-pro/collaboration-client 0.4.2 → 0.5.0-nightly.202411091605
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/cjs/locale/en-US.js +1 -0
- package/lib/cjs/locale/fa-IR.js +1 -0
- package/lib/cjs/locale/ru-RU.js +1 -0
- package/lib/cjs/locale/vi-VN.js +1 -0
- package/lib/cjs/locale/zh-CN.js +1 -0
- package/lib/cjs/locale/zh-TW.js +1 -0
- package/lib/es/index.js +1 -1
- package/lib/es/locale/en-US.js +1 -0
- package/lib/es/locale/fa-IR.js +1 -0
- package/lib/es/locale/ru-RU.js +1 -0
- package/lib/es/locale/vi-VN.js +1 -0
- package/lib/es/locale/zh-CN.js +1 -0
- package/lib/es/locale/zh-TW.js +1 -0
- package/lib/types/index.d.ts +890 -34
- package/lib/umd/index.js +1 -1
- package/lib/umd/locale/en-US.js +1 -0
- package/lib/umd/locale/fa-IR.js +1 -0
- package/lib/umd/locale/ru-RU.js +1 -0
- package/lib/umd/locale/vi-VN.js +1 -0
- package/lib/umd/locale/zh-CN.js +1 -0
- package/lib/umd/locale/zh-TW.js +1 -0
- package/package.json +39 -31
- package/lib/locale/en-US.json +0 -38
- package/lib/locale/fa-IR.json +0 -38
- package/lib/locale/ru-RU.json +0 -38
- package/lib/locale/vi-VN.json +0 -38
- package/lib/locale/zh-CN.json +0 -38
- package/lib/locale/zh-TW.json +0 -38
- package/lib/types/config/config.d.ts +0 -48
- package/lib/types/controllers/collab-cursor/__tests__/doc-collab-cursor.controller.spec.d.ts +0 -23
- package/lib/types/controllers/collab-cursor/__tests__/serialize-text-ranges.spec.d.ts +0 -1
- package/lib/types/controllers/collab-cursor/__tests__/sheet-collab-cursor.controller.spec.d.ts +0 -1
- package/lib/types/controllers/collab-cursor/collab-cursor.controller.d.ts +0 -22
- package/lib/types/controllers/collab-cursor/doc-collab-cursor-entity.d.ts +0 -38
- package/lib/types/controllers/collab-cursor/doc-collab-cursor-render.controller.d.ts +0 -24
- package/lib/types/controllers/collab-cursor/serialize-text-ranges.d.ts +0 -3
- package/lib/types/controllers/collab-cursor/sheet-collab-cursor-entity.d.ts +0 -39
- package/lib/types/controllers/collab-cursor/sheet-collab-cursor-render.controller.d.ts +0 -21
- package/lib/types/controllers/collab-status/collab-status.controller.d.ts +0 -18
- package/lib/types/controllers/collaboration/__tests__/collaboration.controller.spec.d.ts +0 -4
- package/lib/types/controllers/collaboration/__tests__/mock-text-selection-render-manager.service.d.ts +0 -0
- package/lib/types/controllers/collaboration/__tests__/mocks.d.ts +0 -54
- package/lib/types/controllers/collaboration/collaboration-entity.d.ts +0 -91
- package/lib/types/controllers/collaboration/collaboration-state.d.ts +0 -303
- package/lib/types/controllers/collaboration/collaboration.controller.d.ts +0 -24
- package/lib/types/controllers/collaboration/utils/changeset-utils.d.ts +0 -18
- package/lib/types/controllers/collaboration/utils/empty.d.ts +0 -2
- package/lib/types/controllers/config.schema.d.ts +0 -29
- package/lib/types/controllers/data-loader/__tests__/data-loader.controller.spec.d.ts +0 -1
- package/lib/types/controllers/data-loader/data-loader.controller.d.ts +0 -22
- package/lib/types/controllers/file-name/file-name.controller.d.ts +0 -12
- package/lib/types/controllers/telemetry.d.ts +0 -11
- package/lib/types/locale/en-US.d.ts +0 -3
- package/lib/types/locale/fa-IR.d.ts +0 -3
- package/lib/types/locale/ru-RU.d.ts +0 -3
- package/lib/types/locale/vi-VN.d.ts +0 -3
- package/lib/types/locale/zh-CN.d.ts +0 -39
- package/lib/types/locale/zh-TW.d.ts +0 -3
- package/lib/types/models/cursor.d.ts +0 -30
- package/lib/types/plugin.d.ts +0 -18
- package/lib/types/services/auth-server/auth-server.service.d.ts +0 -10
- package/lib/types/services/auth-server/authz-io-http.service.d.ts +0 -30
- package/lib/types/services/auth-server/domain-request.service.d.ts +0 -6
- package/lib/types/services/auth-server/util.d.ts +0 -1
- package/lib/types/services/collaboration-session/collaboration-session.d.ts +0 -59
- package/lib/types/services/collaboration-session/collaboration-session.service.d.ts +0 -61
- package/lib/types/services/color-assign/color-assign.service.d.ts +0 -10
- package/lib/types/services/comment/comment.service.d.ts +0 -6
- package/lib/types/services/image-remote/image-io.service.d.ts +0 -34
- package/lib/types/services/ime-cache-transform/doc-transform-ime-cache.service.d.ts +0 -13
- package/lib/types/services/local-cache/local-cache.service.d.ts +0 -37
- package/lib/types/services/member/member.service.d.ts +0 -77
- package/lib/types/services/permission/permission.service.d.ts +0 -12
- package/lib/types/services/range-selection/sheet-transform-selections.service.d.ts +0 -13
- package/lib/types/services/single-active-unit/single-active-unit.service.d.ts +0 -39
- package/lib/types/services/snapshot-server/snapshot-server.service.d.ts +0 -21
- package/lib/types/services/socket/collaboration-socket.service.d.ts +0 -34
- package/lib/types/services/socket/serialize.d.ts +0 -3
- package/lib/types/services/state-cache-transform/doc-transform-state-cache.service.d.ts +0 -12
- package/lib/types/services/sync-editing-collab-cursor/doc-sync-editing-collab-cursor.service.d.ts +0 -13
- package/lib/types/services/text-selection/doc-transform-selections.service.d.ts +0 -8
- package/lib/types/services/undoredo/collaborative-undoredo.service.d.ts +0 -19
- package/lib/types/services/url/url.service.d.ts +0 -12
- package/lib/types/services/url/web-url.service.d.ts +0 -10
- package/lib/types/views/components/CollabStatus.d.ts +0 -10
- package/lib/types/views/components/CollabStatus.stories.d.ts +0 -8
- package/lib/types/views/shapes/doc-collab-cursor.d.ts +0 -27
- package/lib/types/views/shapes/sheet-collab-cursor.shape.d.ts +0 -27
- package/lib/types/views/shapes/text-bubble.shape.d.ts +0 -19
@@ -1,21 +0,0 @@
|
|
1
|
-
import { Workbook, RxDisposable, ThemeService } from '@univerjs/core';
|
2
|
-
import { IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
3
|
-
import { SheetSkeletonManagerService } from '@univerjs/sheets-ui';
|
4
|
-
import { CollabCursorController } from './collab-cursor.controller';
|
5
|
-
/**
|
6
|
-
* This controller works with `CollabCursorController` to render sheet collaboration cursors.
|
7
|
-
*/
|
8
|
-
export declare class SheetCollabCursorRenderController extends RxDisposable implements IRenderModule {
|
9
|
-
private readonly _context;
|
10
|
-
private readonly _sheetSkeletonManagerService;
|
11
|
-
private readonly _collabCursorController;
|
12
|
-
private readonly _themeService;
|
13
|
-
/** Cursors stored for different Workbooks. */
|
14
|
-
private _cursors;
|
15
|
-
private _lastPointer;
|
16
|
-
constructor(_context: IRenderContext<Workbook>, _sheetSkeletonManagerService: SheetSkeletonManagerService, _collabCursorController: CollabCursorController, _themeService: ThemeService);
|
17
|
-
private _init;
|
18
|
-
private _updateCollabCursors;
|
19
|
-
private _removeCollabCursors;
|
20
|
-
private _getSheetObject;
|
21
|
-
}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
import { Disposable, Injector, IUniverInstanceService } from '@univerjs/core';
|
2
|
-
import { IUIPartsService } from '@univerjs/ui';
|
3
|
-
import { BehaviorSubject } from 'rxjs';
|
4
|
-
import { CollaborationController } from '../collaboration/collaboration.controller';
|
5
|
-
import { CollaborationStatus } from '../collaboration/collaboration-state';
|
6
|
-
/**
|
7
|
-
* This controller is responsible for monitoring the collaboration status of the currently focused unit.
|
8
|
-
*/
|
9
|
-
export declare class DesktopCollaborationStatusDisplayController extends Disposable {
|
10
|
-
private readonly _univerInstanceService;
|
11
|
-
private readonly _uiPartsService;
|
12
|
-
private readonly _injector;
|
13
|
-
private readonly _collaborationController;
|
14
|
-
protected readonly _status$: BehaviorSubject<CollaborationStatus>;
|
15
|
-
constructor(_univerInstanceService: IUniverInstanceService, _uiPartsService: IUIPartsService, _injector: Injector, _collaborationController: CollaborationController);
|
16
|
-
private _initStatusListener;
|
17
|
-
protected _initStatusComponent(): void;
|
18
|
-
}
|
File without changes
|
@@ -1,54 +0,0 @@
|
|
1
|
-
import { IDisposable, ILocalStorageService, Nullable, ILogService } from '@univerjs/core';
|
2
|
-
import { IMessageOptions, IMessageProps } from '@univerjs/design';
|
3
|
-
import { IBeforeCloseService, IMessageService, INotificationService } from '@univerjs/ui';
|
4
|
-
import { ICombResponseEvent } from '@univerjs-pro/collaboration';
|
5
|
-
import { Subject } from 'rxjs';
|
6
|
-
import { ICollaborationSocket, ICollaborationSocketService } from '../../../services/socket/collaboration-socket.service';
|
7
|
-
/**
|
8
|
-
* The handler object for a mocked socket connection. You can terminate, send messages / error through this object.
|
9
|
-
*/
|
10
|
-
export interface IMockCollabSessionSocketHandler extends ICollaborationSocket {
|
11
|
-
socket: ICollaborationSocket;
|
12
|
-
close$: Subject<CloseEvent>;
|
13
|
-
error$: Subject<Event>;
|
14
|
-
open$: Subject<Event>;
|
15
|
-
message$: Subject<ICombResponseEvent>;
|
16
|
-
}
|
17
|
-
/**
|
18
|
-
* This service provides a mocked
|
19
|
-
*/
|
20
|
-
export declare class MockCollaborationSocketService implements ICollaborationSocketService {
|
21
|
-
private readonly _logService;
|
22
|
-
private readonly _handlers;
|
23
|
-
constructor(_logService: ILogService);
|
24
|
-
createSocket(url: string): Nullable<ICollaborationSocket>;
|
25
|
-
/** Test scripts could get the session handler from this method to mock network events. */
|
26
|
-
getHandler(url: string): Nullable<IMockCollabSessionSocketHandler>;
|
27
|
-
}
|
28
|
-
export declare class MockBeforeCloseService implements IBeforeCloseService {
|
29
|
-
private _onCloseCallbacks;
|
30
|
-
private _beforeCloseCallbacks;
|
31
|
-
registerBeforeClose(callback: () => string | undefined): IDisposable;
|
32
|
-
registerOnClose(callback: () => void): IDisposable;
|
33
|
-
}
|
34
|
-
/**
|
35
|
-
* A mocked local storage service which use in-memory storage.
|
36
|
-
*/
|
37
|
-
export declare class MockLocalStorageService implements ILocalStorageService {
|
38
|
-
private readonly _inMemoryCache;
|
39
|
-
getItem<T>(key: string): Promise<T | null>;
|
40
|
-
setItem<T>(key: string, value: T): Promise<T>;
|
41
|
-
removeItem(_key: string): Promise<void>;
|
42
|
-
clear(): Promise<void>;
|
43
|
-
key(_index: number): Promise<string | null>;
|
44
|
-
keys(): Promise<string[]>;
|
45
|
-
iterate<T, U>(_iteratee: (value: T, key: string, iterationNumber: number) => U): Promise<U>;
|
46
|
-
}
|
47
|
-
export declare class MockMessageService implements IMessageService {
|
48
|
-
show(_options: IMessageOptions & Omit<IMessageProps, 'key'>): IDisposable;
|
49
|
-
setContainer(_container: HTMLElement): void;
|
50
|
-
getContainer(): HTMLElement;
|
51
|
-
}
|
52
|
-
export declare class MockNotificationService implements INotificationService {
|
53
|
-
show(): IDisposable;
|
54
|
-
}
|
@@ -1,91 +0,0 @@
|
|
1
|
-
import { IDisposable, IMutationInfo, Nullable, ICommandService, ILogService, Injector, IPermissionService, LocaleService, RxDisposable } from '@univerjs/core';
|
2
|
-
import { UniverType } from '@univerjs/protocol';
|
3
|
-
import { Observable, BehaviorSubject } from 'rxjs';
|
4
|
-
import { CollaborationSession } from '../../services/collaboration-session/collaboration-session';
|
5
|
-
import { CollaborationState, ICollaborationStateHandler, CollaborationStatus } from './collaboration-state';
|
6
|
-
import { DocStateChangeManagerService } from '@univerjs/docs-ui';
|
7
|
-
import { IMessageService } from '@univerjs/ui';
|
8
|
-
import { CompressMutationService, RevisionService } from '@univerjs-pro/collaboration';
|
9
|
-
import { DocTransformIMECacheService } from '../../services/ime-cache-transform/doc-transform-ime-cache.service';
|
10
|
-
import { LocalCacheService } from '../../services/local-cache/local-cache.service';
|
11
|
-
import { SheetTransformSelectionsService } from '../../services/range-selection/sheet-transform-selections.service';
|
12
|
-
import { ISingleActiveUnitService } from '../../services/single-active-unit/single-active-unit.service';
|
13
|
-
import { DocTransformStateCacheService } from '../../services/state-cache-transform/doc-transform-state-cache.service';
|
14
|
-
import { DocSyncEditingCollabCursorService } from '../../services/sync-editing-collab-cursor/doc-sync-editing-collab-cursor.service';
|
15
|
-
import { DocTransformSelectionsService } from '../../services/text-selection/doc-transform-selections.service';
|
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
|
-
protected _changesetSessionId: string;
|
39
|
-
protected _changesetReqId: number;
|
40
|
-
readonly status$: Observable<CollaborationStatus>;
|
41
|
-
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);
|
42
|
-
init(): Promise<void>;
|
43
|
-
/**
|
44
|
-
* Pause collaboration on the document. Remote changesets would be inserted to a queue and wait for resuming.
|
45
|
-
* @returns a disposable which will resume collaboration when called.
|
46
|
-
*/
|
47
|
-
pauseCollaboration(): IDisposable;
|
48
|
-
private _updateState;
|
49
|
-
protected _init(): Promise<CollaborationState>;
|
50
|
-
/**
|
51
|
-
* Could not transit the state twice at the same time. So we put a lock here in case of implementation fault.
|
52
|
-
*/
|
53
|
-
private _transitionLocked;
|
54
|
-
private _unlockTransition;
|
55
|
-
private _lockTransition;
|
56
|
-
protected _onLocalMutation(command: IMutationInfo): void;
|
57
|
-
private _remoteChangesetQueue;
|
58
|
-
private _onRemoteChangeset;
|
59
|
-
private _exhaustRemoteChangesetQueue;
|
60
|
-
private _applyRemoteChangeset;
|
61
|
-
private _onRemoteACK;
|
62
|
-
private _onRemoteRejected;
|
63
|
-
private _onRemoteRetry;
|
64
|
-
private _onFetchMissResult;
|
65
|
-
private _toggleOffline;
|
66
|
-
private _toggleOnline;
|
67
|
-
private _createInitialState;
|
68
|
-
protected _createHandler(): ICollaborationStateHandler;
|
69
|
-
private _createInitialStateImpl;
|
70
|
-
private _replayCachedMutations;
|
71
|
-
}
|
72
|
-
export declare class DocCollaborationEntity extends CollaborationEntity {
|
73
|
-
readonly unitID: string;
|
74
|
-
readonly type: UniverType;
|
75
|
-
private readonly _docStateChangeManagerService;
|
76
|
-
private readonly _docTransformIMECacheService;
|
77
|
-
private readonly _docTransformStateCacheService;
|
78
|
-
private readonly _docTransformSelectionsService;
|
79
|
-
private readonly _docSyncEditingCollabCursorService;
|
80
|
-
constructor(unitID: string, type: UniverType, session: CollaborationSession, injector: Injector, localCacheService: LocalCacheService, compressMutationService: CompressMutationService, localeService: LocaleService, revisionService: RevisionService, _docStateChangeManagerService: DocStateChangeManagerService, _docTransformIMECacheService: DocTransformIMECacheService, _docTransformStateCacheService: DocTransformStateCacheService, _docTransformSelectionsService: DocTransformSelectionsService, _docSyncEditingCollabCursorService: DocSyncEditingCollabCursorService, logService: ILogService, commandService: ICommandService, messageService: IMessageService, permissionService: IPermissionService, singleActiveUnitService?: ISingleActiveUnitService);
|
81
|
-
protected _createHandler(): ICollaborationStateHandler;
|
82
|
-
protected _init(): Promise<CollaborationState>;
|
83
|
-
}
|
84
|
-
export declare class SheetCollaborationEntity extends CollaborationEntity {
|
85
|
-
readonly unitID: string;
|
86
|
-
readonly type: UniverType;
|
87
|
-
private readonly _sheetTransformSelectionsService;
|
88
|
-
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);
|
89
|
-
protected _createHandler(): ICollaborationStateHandler;
|
90
|
-
protected _init(): Promise<CollaborationState>;
|
91
|
-
}
|
@@ -1,303 +0,0 @@
|
|
1
|
-
import { IMutationInfo, Nullable, ICommandService, IConfigService, ILogService, Injector, IPermissionService, IUniverInstanceService, LocaleService } from '@univerjs/core';
|
2
|
-
import { IAcknowledgedChangeset, IChangeset, ITransformService, RevisionService } from '@univerjs-pro/collaboration';
|
3
|
-
import { Observable } from 'rxjs';
|
4
|
-
import { ICollabEditingCursor } from '../../services/sync-editing-collab-cursor/doc-sync-editing-collab-cursor.service';
|
5
|
-
import { ICollaborativeUndoRedoService } from '../../services/undoredo/collaborative-undoredo.service';
|
6
|
-
import { UniverType } from '@univerjs/protocol';
|
7
|
-
import { INotificationService } from '@univerjs/ui';
|
8
|
-
import { LocalCacheService } from '../../services/local-cache/local-cache.service';
|
9
|
-
import { MemberService } from '../../services/member/member.service';
|
10
|
-
/** Provide both states when and after changing, so the parent could examine if state transition is correct. */
|
11
|
-
export type StateChangeHandler = (before: CollaborationState, after: CollaborationState) => void;
|
12
|
-
/** A network interface to send changeset and */
|
13
|
-
export type SendChangesetHandler = (changeset: IChangeset) => void;
|
14
|
-
export type MissingChangesetsHandler = (params: {
|
15
|
-
from: number;
|
16
|
-
to: number;
|
17
|
-
}) => void;
|
18
|
-
export type TransformSelectionsHandler = (changeset: IChangeset) => void;
|
19
|
-
export type TransformIMEHandler = (changeset: IChangeset) => void;
|
20
|
-
export type TransformStateHandler = (changeset: IChangeset) => void;
|
21
|
-
export type SyncEditingCollabCursorHandler = (params: ICollabEditingCursor) => void;
|
22
|
-
export type TransformRemoteChangesetByIMECache = (changeset: IChangeset) => IChangeset;
|
23
|
-
export type TransformRemoteChangesetByStateCache = (changeset: IChangeset) => IChangeset;
|
24
|
-
export interface ICollaborationStateHandler {
|
25
|
-
onStateChange: StateChangeHandler;
|
26
|
-
onSendChangeset: SendChangesetHandler;
|
27
|
-
onMissingChangesets: MissingChangesetsHandler;
|
28
|
-
onTransformSelections?: TransformSelectionsHandler;
|
29
|
-
onTransformIME?: TransformIMEHandler;
|
30
|
-
onTransformState?: TransformStateHandler;
|
31
|
-
onSyncEditingCollabCursor?: SyncEditingCollabCursorHandler;
|
32
|
-
onTransformRemoteChangesetByIMECache?: TransformRemoteChangesetByIMECache;
|
33
|
-
onTransformRemoteChangesetByStateCache?: TransformRemoteChangesetByStateCache;
|
34
|
-
}
|
35
|
-
export declare enum CollaborationStatus {
|
36
|
-
NOT_COLLAB = "not_collab",
|
37
|
-
SYNCED = "synced",
|
38
|
-
PENDING = "pending",
|
39
|
-
AWAITING = "awaiting",
|
40
|
-
AWAITING_WITH_PENDING = "awaiting_with_pending",
|
41
|
-
FETCH_MISS = "fetch_missing",
|
42
|
-
CONFLICT = "conflict",
|
43
|
-
OFFLINE = "offline"
|
44
|
-
}
|
45
|
-
/**
|
46
|
-
* Use state machine to manage syncing states.
|
47
|
-
* An explanation to how these states are transformed to each other.
|
48
|
-
*/
|
49
|
-
export declare abstract class CollaborationState {
|
50
|
-
readonly unitID: string;
|
51
|
-
readonly type: UniverType;
|
52
|
-
/** State may change internally. Parent module should provide a callback to handle this event. */
|
53
|
-
protected readonly _handler: ICollaborationStateHandler;
|
54
|
-
protected readonly _commandService: ICommandService;
|
55
|
-
protected readonly _undoRedoService: ICollaborativeUndoRedoService;
|
56
|
-
protected readonly _revisionService: RevisionService;
|
57
|
-
protected readonly _localCacheService: LocalCacheService;
|
58
|
-
abstract readonly status: CollaborationStatus;
|
59
|
-
/** Mutations that has been sent to the server but not yet acknowledged by the server. */
|
60
|
-
protected _awaitingChangeset: Nullable<IChangeset>;
|
61
|
-
/** Mutations that has not been sent to the server. */
|
62
|
-
protected _pendingMutations: IMutationInfo[];
|
63
|
-
constructor(unitID: string, type: UniverType, awaitingChangeset: Nullable<IChangeset>, pendingMutations: IMutationInfo[],
|
64
|
-
/** State may change internally. Parent module should provide a callback to handle this event. */
|
65
|
-
_handler: ICollaborationStateHandler, _commandService: ICommandService, _undoRedoService: ICollaborativeUndoRedoService, _revisionService: RevisionService, _localCacheService: LocalCacheService);
|
66
|
-
abstract resend(): void;
|
67
|
-
/**
|
68
|
-
* Append a location mutation to collaboration queue.
|
69
|
-
*
|
70
|
-
* @param mutation a mutation that happened locally and should be broadcasted to other peers
|
71
|
-
*/
|
72
|
-
abstract appendMutation(mutation: IMutationInfo): CollaborationState;
|
73
|
-
/**
|
74
|
-
* Received a changeset from the server.
|
75
|
-
* @param changeset
|
76
|
-
*/
|
77
|
-
abstract onRemoteChangeset(changeset: IChangeset): CollaborationState;
|
78
|
-
/**
|
79
|
-
* Received an acknowledgement from the server.
|
80
|
-
*/
|
81
|
-
abstract onRemoteAck(changeset: IAcknowledgedChangeset): CollaborationState;
|
82
|
-
/**
|
83
|
-
* Received a rejection from the server, meaning that conflict could be resolved by the algorithm.
|
84
|
-
*/
|
85
|
-
abstract onRemoteRej(config?: {
|
86
|
-
isPermissionRej: boolean;
|
87
|
-
}): CollaborationState;
|
88
|
-
/**
|
89
|
-
* Received a retry message from the server, meaning that some unexpected error occurred in server.
|
90
|
-
*/
|
91
|
-
abstract onRemoteRetry(changeset: IChangeset): CollaborationState;
|
92
|
-
abstract toggleOffline(): CollaborationState;
|
93
|
-
abstract toggleOnline(): CollaborationState;
|
94
|
-
/**
|
95
|
-
* Check if there are some changesets missing. If true, the state should abort this changeset and request
|
96
|
-
* for missing changesets. Missing changesets will later be passed to `onRemoteChangeset` method.
|
97
|
-
*
|
98
|
-
* @param changeset The changeset sent from the remote collaboration server.
|
99
|
-
* @returns There is some changeset missing.
|
100
|
-
*/
|
101
|
-
protected _checkMissing(changeset: IChangeset | IAcknowledgedChangeset): boolean;
|
102
|
-
/** Transform undo redo mutations in the undo redo stack. */
|
103
|
-
protected _transformUndoredo(changeset: IChangeset): void;
|
104
|
-
/** Transform selections by calling the selection manager service. */
|
105
|
-
protected _transformSelections(changeset: IChangeset): void;
|
106
|
-
protected _transformIMECache(changeset: IChangeset): void | undefined;
|
107
|
-
protected _transformStateCache(changeset: IChangeset): void | undefined;
|
108
|
-
protected _transformRemoteChangesetByIMECache(changeset: IChangeset): IChangeset;
|
109
|
-
protected _transformRemoteChangesetByStateCache(changeset: IChangeset): IChangeset;
|
110
|
-
protected _syncEditingCollabCursor(changeset: IChangeset): void;
|
111
|
-
/** @internal */
|
112
|
-
_updateLocalCache(): void;
|
113
|
-
protected _getCurrentRevision(): number;
|
114
|
-
protected _incrementRevisionNumber(): void;
|
115
|
-
protected _executeRemoteChangeset(changeset: IChangeset): void;
|
116
|
-
}
|
117
|
-
/**
|
118
|
-
* All local changesets are sent to and acknowledged by the server.
|
119
|
-
*/
|
120
|
-
export declare class SyncedState extends CollaborationState {
|
121
|
-
private readonly _injector;
|
122
|
-
private readonly _logService;
|
123
|
-
private readonly _transformService;
|
124
|
-
readonly status = CollaborationStatus.SYNCED;
|
125
|
-
constructor(unitID: string, type: UniverType, handler: ICollaborationStateHandler, revisionService: RevisionService, localCacheService: LocalCacheService, _injector: Injector, undoRedoService: ICollaborativeUndoRedoService, commandService: ICommandService, _logService: ILogService, _transformService: ITransformService);
|
126
|
-
appendMutation(mutation: IMutationInfo): CollaborationState;
|
127
|
-
onRemoteChangeset(changeset: IChangeset): CollaborationState;
|
128
|
-
private _onConflict;
|
129
|
-
onRemoteAck(): never;
|
130
|
-
onRemoteRej(): CollaborationState;
|
131
|
-
onRemoteRetry(): CollaborationState;
|
132
|
-
toggleOffline(): CollaborationState;
|
133
|
-
toggleOnline(): CollaborationState;
|
134
|
-
resend(): void;
|
135
|
-
fetchMiss(): CollaborationState;
|
136
|
-
}
|
137
|
-
/**
|
138
|
-
* Some local changes are waiting to be sent to the server. But no changesets are waiting for acknowledgement.
|
139
|
-
*
|
140
|
-
* You should call schedule task after you create a `PendingState`.
|
141
|
-
*/
|
142
|
-
export declare class PendingState extends CollaborationState {
|
143
|
-
private readonly _injector;
|
144
|
-
private readonly _memberService;
|
145
|
-
private readonly _logService;
|
146
|
-
private readonly _configService;
|
147
|
-
private readonly _transformService;
|
148
|
-
private readonly _univerInstanceService;
|
149
|
-
readonly status = CollaborationStatus.PENDING;
|
150
|
-
private _scheduleTimestamp;
|
151
|
-
private _sendingTimer;
|
152
|
-
constructor(unitID: string, type: UniverType, pendingMutations: IMutationInfo[], handler: ICollaborationStateHandler, _injector: Injector, _revisionService: RevisionService, _localCacheService: LocalCacheService, _memberService: MemberService, _logService: ILogService, commandService: ICommandService, _configService: IConfigService, _transformService: ITransformService, _univerInstanceService: IUniverInstanceService, _undoRedoService: ICollaborativeUndoRedoService);
|
153
|
-
appendMutation(mutation: IMutationInfo): CollaborationState;
|
154
|
-
onRemoteChangeset(changeset: IChangeset): CollaborationState;
|
155
|
-
onRemoteAck(): CollaborationState;
|
156
|
-
onRemoteRej(): CollaborationState;
|
157
|
-
onRemoteRetry(): CollaborationState;
|
158
|
-
toggleOffline(): CollaborationState;
|
159
|
-
toggleOnline(): CollaborationState;
|
160
|
-
/**
|
161
|
-
* Schedule a task to send changeset to the server.
|
162
|
-
*
|
163
|
-
* @internal
|
164
|
-
*/
|
165
|
-
_schedule(t?: number): void;
|
166
|
-
private _getSendChangesetTimeout;
|
167
|
-
resend(): void;
|
168
|
-
private _clearScheduledTask;
|
169
|
-
private _onConflict;
|
170
|
-
}
|
171
|
-
/**
|
172
|
-
* All local mutations are sent to the server and waiting for acknowledgement.
|
173
|
-
*/
|
174
|
-
export declare class AwaitingState extends CollaborationState {
|
175
|
-
private readonly _injector;
|
176
|
-
private readonly _logService;
|
177
|
-
private readonly _transformService;
|
178
|
-
readonly status = CollaborationStatus.AWAITING;
|
179
|
-
private _resendTimeout;
|
180
|
-
private _resendTimer;
|
181
|
-
private _sender;
|
182
|
-
constructor(unitID: string, type: UniverType, awaitingChangeset: IChangeset, handler: ICollaborationStateHandler, _injector: Injector, revisionService: RevisionService, localCacheService: LocalCacheService, commandService: ICommandService, _logService: ILogService, _transformService: ITransformService, undoRedoService: ICollaborativeUndoRedoService);
|
183
|
-
appendMutation(mutation: IMutationInfo): CollaborationState;
|
184
|
-
onRemoteChangeset(changeset: IChangeset): CollaborationState;
|
185
|
-
onRemoteAck(changeset: IAcknowledgedChangeset): CollaborationState;
|
186
|
-
onRemoteRej(config?: {
|
187
|
-
isPermissionRej: boolean;
|
188
|
-
}): CollaborationState;
|
189
|
-
onRemoteRetry(changeset: IChangeset): CollaborationState;
|
190
|
-
toggleOffline(): CollaborationState;
|
191
|
-
toggleOnline(): CollaborationState;
|
192
|
-
resend(): void;
|
193
|
-
private _onConflict;
|
194
|
-
private _resendWithTimeout;
|
195
|
-
private _clearScheduledTask;
|
196
|
-
}
|
197
|
-
/**
|
198
|
-
* Some local mutations are sent to the server and waiting for acknowledgement, yet still some local mutations
|
199
|
-
* are waiting to be sent to the server.
|
200
|
-
*/
|
201
|
-
export declare class AwaitingWithPendingState extends CollaborationState {
|
202
|
-
private readonly _injector;
|
203
|
-
private readonly _logService;
|
204
|
-
private readonly _transformService;
|
205
|
-
readonly status = CollaborationStatus.AWAITING_WITH_PENDING;
|
206
|
-
private _resendTimeout;
|
207
|
-
private _resendTimer;
|
208
|
-
private _sender;
|
209
|
-
constructor(unitID: string, type: UniverType, awaitingChangeset: IChangeset, pendingMutations: IMutationInfo[], handler: ICollaborationStateHandler, timer: Observable<{
|
210
|
-
timeout: number;
|
211
|
-
reqId: number;
|
212
|
-
}> | undefined, _injector: Injector, revisionService: RevisionService, localCacheService: LocalCacheService, commandService: ICommandService, _logService: ILogService, _transformService: ITransformService, undoRedoService: ICollaborativeUndoRedoService);
|
213
|
-
appendMutation(mutation: IMutationInfo): CollaborationState;
|
214
|
-
onRemoteChangeset(changeset: IChangeset): CollaborationState;
|
215
|
-
onRemoteAck(changeset: IAcknowledgedChangeset): CollaborationState;
|
216
|
-
onRemoteRej(config?: {
|
217
|
-
isPermissionRej: boolean;
|
218
|
-
}): CollaborationState;
|
219
|
-
onRemoteRetry(changeset: IChangeset): CollaborationState;
|
220
|
-
toggleOffline(): CollaborationState;
|
221
|
-
toggleOnline(): CollaborationState;
|
222
|
-
resend(): void;
|
223
|
-
private _onConflict;
|
224
|
-
private _resendWithTimeout;
|
225
|
-
private _clearScheduledTask;
|
226
|
-
}
|
227
|
-
/**
|
228
|
-
* This state is special for handling collaboration conflicts.
|
229
|
-
*
|
230
|
-
* `ConflictState` is a dead end state. It cannot transit to any other state. User could only reload the page to
|
231
|
-
* reload the document.
|
232
|
-
*/
|
233
|
-
export declare class ConflictState extends CollaborationState {
|
234
|
-
private _isPermissionRej;
|
235
|
-
private readonly _permissionService;
|
236
|
-
private readonly _localeService;
|
237
|
-
private readonly _notificationService;
|
238
|
-
readonly status = CollaborationStatus.CONFLICT;
|
239
|
-
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);
|
240
|
-
appendMutation(): CollaborationState;
|
241
|
-
onRemoteChangeset(): CollaborationState;
|
242
|
-
onRemoteAck(): CollaborationState;
|
243
|
-
onRemoteRej(): CollaborationState;
|
244
|
-
onRemoteRetry(): CollaborationState;
|
245
|
-
toggleOffline(): CollaborationState;
|
246
|
-
toggleOnline(): CollaborationState;
|
247
|
-
resend(): void;
|
248
|
-
private _clearLocalCache;
|
249
|
-
private _showConflictNotification;
|
250
|
-
private _disableEditing;
|
251
|
-
}
|
252
|
-
export declare class OfflineState extends CollaborationState {
|
253
|
-
private readonly _injector;
|
254
|
-
readonly status = CollaborationStatus.OFFLINE;
|
255
|
-
constructor(unitID: string, type: UniverType, awaitingChangeset: Nullable<IChangeset>, pendingMutations: IMutationInfo[], handler: ICollaborationStateHandler, _injector: Injector, revisionService: RevisionService, localCacheService: LocalCacheService, commandService: ICommandService, undoRedoService: ICollaborativeUndoRedoService);
|
256
|
-
appendMutation(mutation: IMutationInfo): CollaborationState;
|
257
|
-
onRemoteChangeset(_changeset: IChangeset): CollaborationState;
|
258
|
-
onRemoteAck(): CollaborationState;
|
259
|
-
onRemoteRej(): CollaborationState;
|
260
|
-
onRemoteRetry(): CollaborationState;
|
261
|
-
toggleOffline(): CollaborationState;
|
262
|
-
toggleOnline(): CollaborationState;
|
263
|
-
resend(): void;
|
264
|
-
}
|
265
|
-
/**
|
266
|
-
* When the client is trying to fetch missed changesets:
|
267
|
-
*
|
268
|
-
* 1. local changesets would not be send to the server until the missed changesets are fetched
|
269
|
-
* 2. remote changesets would not be applied util the missed changesets are fetched and applied
|
270
|
-
*/
|
271
|
-
export declare class FetchingMissState extends CollaborationState {
|
272
|
-
/**
|
273
|
-
* The awaiting changeset may have been acknowledged when missing is detected.
|
274
|
-
* We need to transform missing changeset against this acknowledged changeset,
|
275
|
-
* so other state should pass this acknowledged changeset to this parameter.
|
276
|
-
*/
|
277
|
-
private _acknowledgedAwaitingChangeset;
|
278
|
-
private readonly _queuedRemoteChangesets;
|
279
|
-
private readonly _injector;
|
280
|
-
private readonly _logService;
|
281
|
-
private readonly _transformService;
|
282
|
-
readonly status = CollaborationStatus.FETCH_MISS;
|
283
|
-
constructor(unitID: string, type: UniverType, awaitingChangeset: Nullable<IChangeset>, pendingMutations: IMutationInfo[],
|
284
|
-
/**
|
285
|
-
* The awaiting changeset may have been acknowledged when missing is detected.
|
286
|
-
* We need to transform missing changeset against this acknowledged changeset,
|
287
|
-
* so other state should pass this acknowledged changeset to this parameter.
|
288
|
-
*/
|
289
|
-
_acknowledgedAwaitingChangeset: Nullable<IChangeset>, _queuedRemoteChangesets: IChangeset[], handler: ICollaborationStateHandler, _injector: Injector, revisionService: RevisionService, localCacheService: LocalCacheService, _logService: ILogService, commandService: ICommandService, undoRedoService: ICollaborativeUndoRedoService, _transformService: ITransformService);
|
290
|
-
onMissedChangesetFetched(changesets: IChangeset[]): CollaborationState;
|
291
|
-
resend(): void;
|
292
|
-
appendMutation(mutation: IMutationInfo<object>): CollaborationState;
|
293
|
-
onRemoteChangeset(changeset: IChangeset): CollaborationState;
|
294
|
-
onRemoteAck(_changeset: IAcknowledgedChangeset): CollaborationState;
|
295
|
-
onRemoteRej(config?: {
|
296
|
-
isPermissionRej: boolean;
|
297
|
-
}): CollaborationState;
|
298
|
-
onRemoteRetry(): CollaborationState;
|
299
|
-
toggleOffline(): CollaborationState;
|
300
|
-
toggleOnline(): CollaborationState;
|
301
|
-
private _onConflict;
|
302
|
-
}
|
303
|
-
export declare function createOnlineState(injector: Injector, unitID: string, type: UniverType, awaitingChangeset: Nullable<IChangeset>, mutations: IMutationInfo[], handler: ICollaborationStateHandler): SyncedState | PendingState | AwaitingState | AwaitingWithPendingState;
|
@@ -1,24 +0,0 @@
|
|
1
|
-
import { Nullable, Injector, IUniverInstanceService, RxDisposable } from '@univerjs/core';
|
2
|
-
import { Observable } from 'rxjs';
|
3
|
-
import { CollaborationEntity } from './collaboration-entity';
|
4
|
-
import { CollaborationSessionService } from '../../services/collaboration-session/collaboration-session.service';
|
5
|
-
export declare class CollaborationController extends RxDisposable {
|
6
|
-
private readonly _injector;
|
7
|
-
private readonly _collabSessionService;
|
8
|
-
private readonly _univerInstanceService;
|
9
|
-
private readonly _entities;
|
10
|
-
private readonly _entityInit$;
|
11
|
-
constructor(_injector: Injector, _collabSessionService: CollaborationSessionService, _univerInstanceService: IUniverInstanceService);
|
12
|
-
dispose(): void;
|
13
|
-
getCollabEntity(id: string): Nullable<CollaborationEntity>;
|
14
|
-
getCollabEntity$(id: string): Observable<CollaborationEntity>;
|
15
|
-
private _init;
|
16
|
-
/**
|
17
|
-
* Start collaboration on a document.
|
18
|
-
*
|
19
|
-
* @param unitID ID of the document to start collaboration.
|
20
|
-
* @returns A disposable to stop collaboration.
|
21
|
-
*/
|
22
|
-
private _startCollaboration;
|
23
|
-
private _getCtorByUniverType;
|
24
|
-
}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
import { IMutationInfo, IUniverInstanceService } from '@univerjs/core';
|
2
|
-
import { IChangeset, RevisionService } from '@univerjs-pro/collaboration';
|
3
|
-
import { Observable } from 'rxjs';
|
4
|
-
import { MemberService } from '../../../services/member/member.service';
|
5
|
-
export interface IAssembledChangeset {
|
6
|
-
changeset: IChangeset;
|
7
|
-
pendingMutations: IMutationInfo[];
|
8
|
-
}
|
9
|
-
/**
|
10
|
-
* Mutations those should be assembled into a single changeset.
|
11
|
-
*/
|
12
|
-
export declare const SINGLE_CHANGESET_MUTATIONS: Set<string>;
|
13
|
-
/**
|
14
|
-
* Assemble a changeset from a list of mutations.
|
15
|
-
*/
|
16
|
-
export declare function assembleSheetChangeset(pendingMutations: IMutationInfo[], unitID: string, univerInstanceService: IUniverInstanceService, revisionService: RevisionService, memberService: MemberService): IAssembledChangeset;
|
17
|
-
export declare function assembleDocChangeset(pendingMutations: IMutationInfo[], unitID: string, univerInstanceService: IUniverInstanceService, revisionService: RevisionService, memberService: MemberService): IAssembledChangeset;
|
18
|
-
export declare function createTimerObservable$<T>(ms: number, options: T): Observable<T>;
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import { Ctor, DependencyOverride } from '@univerjs/core';
|
2
|
-
import { ICollaborationSocketService } from '../services/socket/collaboration-socket.service';
|
3
|
-
export declare const PLUGIN_CONFIG_KEY = "collaboration-client.config";
|
4
|
-
export declare const configSymbol: unique symbol;
|
5
|
-
export interface IUniverCollaborationClientConfig {
|
6
|
-
socketService?: Ctor<ICollaborationSocketService>;
|
7
|
-
enableOfflineEditing?: boolean;
|
8
|
-
enableSingleActiveInstanceLock?: boolean;
|
9
|
-
enableAuthServer?: boolean;
|
10
|
-
/**
|
11
|
-
* Override internal modules with custom implementations.
|
12
|
-
*/
|
13
|
-
override?: DependencyOverride;
|
14
|
-
sendChangesetTimeout?: number;
|
15
|
-
snapshotServerUrl?: string;
|
16
|
-
collabSubmitChangesetUrl?: string;
|
17
|
-
collabWebSocketUrl?: string;
|
18
|
-
loginUrlKey?: string;
|
19
|
-
retryConnectingInterval?: number;
|
20
|
-
authzUrl?: string;
|
21
|
-
/**
|
22
|
-
* The URL of the endpoint for downloading files.
|
23
|
-
* @default 'location.origin'
|
24
|
-
*/
|
25
|
-
downloadEndpointUrl?: string;
|
26
|
-
uploadFileServerUrl?: string;
|
27
|
-
signUrlServerUrl?: string;
|
28
|
-
}
|
29
|
-
export declare const defaultPluginConfig: IUniverCollaborationClientConfig;
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,22 +0,0 @@
|
|
1
|
-
import { ICommandService, ILogService, RxDisposable } from '@univerjs/core';
|
2
|
-
import { IRemoteInstanceService } from '@univerjs/rpc';
|
3
|
-
import { SnapshotService } from '@univerjs-pro/collaboration';
|
4
|
-
import { LocalCacheService } from '../../services/local-cache/local-cache.service';
|
5
|
-
import { IURLService } from '../../services/url/url.service';
|
6
|
-
/**
|
7
|
-
* This controller loads data when URL changes.
|
8
|
-
*/
|
9
|
-
export declare class DataLoaderController extends RxDisposable {
|
10
|
-
private _urlService;
|
11
|
-
private readonly _logService;
|
12
|
-
private readonly _commandService;
|
13
|
-
private readonly _localCacheService;
|
14
|
-
private readonly _snapshotService;
|
15
|
-
constructor(_urlService: IURLService, _logService: ILogService, _commandService: ICommandService, _localCacheService: LocalCacheService, _snapshotService: SnapshotService, remoteInstanceService?: IRemoteInstanceService);
|
16
|
-
private _init;
|
17
|
-
private _setupSubUnitSync;
|
18
|
-
private _updateURLWithCurrentState;
|
19
|
-
private _updateSubUnitFromURLParams;
|
20
|
-
private _loadSheet;
|
21
|
-
private _loadDoc;
|
22
|
-
}
|
@@ -1,12 +0,0 @@
|
|
1
|
-
import { Disposable, IConfigService, IUniverInstanceService } from '@univerjs/core';
|
2
|
-
export declare const DEFAULT_FILE_NAME_KEY = "DEFAULT_FILE_NAME";
|
3
|
-
/**
|
4
|
-
* This controller would change the current tab's title to the
|
5
|
-
* currently focused unit's name.
|
6
|
-
*/
|
7
|
-
export declare class FileNameController extends Disposable {
|
8
|
-
private readonly _univerInstanceService;
|
9
|
-
private readonly _configService;
|
10
|
-
constructor(_univerInstanceService: IUniverInstanceService, _configService: IConfigService);
|
11
|
-
private _init;
|
12
|
-
}
|
@@ -1,11 +0,0 @@
|
|
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;
|