@univerjs-pro/collaboration-client 0.1.12 → 0.1.15
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 +32 -0
- package/lib/locale/ru-RU.json +32 -0
- package/lib/locale/zh-CN.json +32 -0
- package/lib/types/config/config.d.ts +44 -0
- package/lib/types/controllers/collab-cursor/sheet-collab-cursor-render.controller.d.ts +3 -3
- package/lib/types/controllers/collaboration/__tests__/mocks.d.ts +2 -2
- package/lib/types/controllers/collaboration/collaboration-state.d.ts +17 -12
- package/lib/types/controllers/collaboration/collaboration.controller.d.ts +5 -5
- package/lib/types/index.d.ts +6 -8
- package/lib/types/locale/ru-RU.d.ts +4 -0
- package/lib/types/locale/zh-CN.d.ts +4 -0
- package/lib/types/plugin.d.ts +4 -4
- package/lib/types/services/auth-server/auth-server.service.d.ts +0 -4
- package/lib/types/services/auth-server/authz-io-http.service.d.ts +29 -0
- package/lib/types/services/collaboration-session/collaboration-session.service.d.ts +0 -7
- package/lib/types/services/image-remote/image-io.service.d.ts +31 -0
- package/lib/types/services/local-cache/local-cache.service.d.ts +0 -5
- package/lib/types/services/member/member.service.d.ts +9 -3
- package/lib/types/services/snapshot-server/snapshot-server.service.d.ts +2 -6
- package/lib/types/services/socket/collaboration-socket.service.d.ts +0 -1
- package/lib/umd/index.js +1 -1
- package/package.json +49 -32
- package/lib/types/locale/index.d.ts +0 -2
@@ -0,0 +1,32 @@
|
|
1
|
+
{
|
2
|
+
"collabStatus": {
|
3
|
+
"fetchMiss": "Syncing server data...",
|
4
|
+
"conflict": "Edit conflicts",
|
5
|
+
"notCollab": "Local file",
|
6
|
+
"synced": "Synced",
|
7
|
+
"syncing": "Syncing...",
|
8
|
+
"offline": "Offline, edits would be save on local"
|
9
|
+
},
|
10
|
+
"session": {
|
11
|
+
"connection-failed": "Connection failed, please check your network.",
|
12
|
+
"will-retry": "Connection failed, we retry in a while.",
|
13
|
+
"room-full": "Collaboration room is full. You edits would be saved locally.",
|
14
|
+
"collaboration-timeout": "The server is not responding to your collaboration request. Your edits would be saved locally."
|
15
|
+
},
|
16
|
+
"conflict": {
|
17
|
+
"title": "Collaboration Conflict",
|
18
|
+
"content": "There is a conflict between your local copy and the copy on the server. Please save your local edits, because they will be lost when you reload the page."
|
19
|
+
},
|
20
|
+
"permission": {
|
21
|
+
"title": "Authentication Error",
|
22
|
+
"content": "Your actions are conflicting with the server's permissions. Please save your local edits elsewhere as they will be discarded after refreshing the page."
|
23
|
+
},
|
24
|
+
"collaboration": {
|
25
|
+
"single-unit": {
|
26
|
+
"warning": "You opened the same file in another tab. In case of data missing, you cannot edit on this tab."
|
27
|
+
}
|
28
|
+
},
|
29
|
+
"auth": {
|
30
|
+
"needGotoLoginAlert": "Your login has expired, click OK to re-login, click Cancel to save your local edits."
|
31
|
+
}
|
32
|
+
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
{
|
2
|
+
"collabStatus": {
|
3
|
+
"fetchMiss": "Syncing server data...",
|
4
|
+
"conflict": "Edit conflicts",
|
5
|
+
"notCollab": "Local file",
|
6
|
+
"synced": "Synced",
|
7
|
+
"syncing": "Syncing...",
|
8
|
+
"offline": "Offline, edits would be save on local"
|
9
|
+
},
|
10
|
+
"session": {
|
11
|
+
"connection-failed": "Connection failed, please check your network.",
|
12
|
+
"will-retry": "Connection failed, we retry in a while.",
|
13
|
+
"room-full": "Collaboration room is full. You edits would be saved locally.",
|
14
|
+
"collaboration-timeout": "The server is not responding to your collaboration request. Your edits would be saved locally."
|
15
|
+
},
|
16
|
+
"conflict": {
|
17
|
+
"title": "Collaboration Conflict",
|
18
|
+
"content": "There is a conflict between your local copy and the copy on the server. Please save your local edits, because they will be lost when you reload the page."
|
19
|
+
},
|
20
|
+
"permission": {
|
21
|
+
"title": "Authentication Error",
|
22
|
+
"content": "Your actions are conflicting with the server's permissions. Please save your local edits elsewhere as they will be discarded after refreshing the page."
|
23
|
+
},
|
24
|
+
"collaboration": {
|
25
|
+
"single-unit": {
|
26
|
+
"warning": "You opened the same file in another tab. In case of data missing, you cannot edit on this tab."
|
27
|
+
}
|
28
|
+
},
|
29
|
+
"auth": {
|
30
|
+
"needGotoLoginAlert": "Your login has expired, click OK to re-login, click Cancel to save your local edits."
|
31
|
+
}
|
32
|
+
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
{
|
2
|
+
"collabStatus": {
|
3
|
+
"fetchMiss": "正在同步服务端数据...",
|
4
|
+
"conflict": "编辑冲突",
|
5
|
+
"notCollab": "本地文件",
|
6
|
+
"synced": "已保存",
|
7
|
+
"syncing": "保存中...",
|
8
|
+
"offline": "编辑将在本地保存"
|
9
|
+
},
|
10
|
+
"session": {
|
11
|
+
"connection-failed": "连接失败,请检查你的网络",
|
12
|
+
"will-retry": "连接失败,将在一会儿之后重试",
|
13
|
+
"room-full": "协同房间已满,你的编辑将在本地保存",
|
14
|
+
"collaboration-timeout": "服务器未响应你的协同请求,你的编辑将在本地保存"
|
15
|
+
},
|
16
|
+
"conflict": {
|
17
|
+
"title": "协同冲突",
|
18
|
+
"content": "你的本地文档和服务器的文档存在冲突。请在别处保存你的本地编辑,本地编辑将在刷新页面后丢弃。"
|
19
|
+
},
|
20
|
+
"permission": {
|
21
|
+
"title": "权限错误",
|
22
|
+
"content": "你的操作和服务器的权限存在冲突。请在别处保存你的本地编辑,本地编辑将在刷新页面后丢弃。"
|
23
|
+
},
|
24
|
+
"collaboration": {
|
25
|
+
"single-unit": {
|
26
|
+
"warning": "你在另一个标签页打开了同一个文件。为了避免数据丢失,这个标签页的编辑行为将会被限制。"
|
27
|
+
}
|
28
|
+
},
|
29
|
+
"auth": {
|
30
|
+
"needGotoLoginAlert": "你的登录已过期,点击确认重新登陆,点击取消去保存你的本地编辑。"
|
31
|
+
}
|
32
|
+
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
/**
|
2
|
+
* The config key to determined the URL provided by the snapshot server
|
3
|
+
* to load snapshot. The URL should not ends with a slash.
|
4
|
+
*/
|
5
|
+
export declare const SNAPSHOT_SERVER_URL_KEY = "SNAPSHOT_SERVER_URL_KEY";
|
6
|
+
/**
|
7
|
+
* Default value for `SNAPSHOT_SERVER_URL_KEY`.
|
8
|
+
*
|
9
|
+
* Determined in the protocol file in `submodules/protocol/universer/v1/snapshot.proto`.
|
10
|
+
*/
|
11
|
+
export declare const DEFAULT_SNAPSHOT_SERVER_URL = "/universer-api/snapshot";
|
12
|
+
/**
|
13
|
+
* @ignore
|
14
|
+
*/
|
15
|
+
export declare const SNAPSHOT_URL_KEY = "SNAPSHOT_URL_KEY";
|
16
|
+
/**
|
17
|
+
* Determines how often should we send changesets.
|
18
|
+
*/
|
19
|
+
export declare const SEND_CHANGESET_TIMEOUT_KEY = "SEND_CHANGESET_TIMEOUT";
|
20
|
+
export declare const DEFAULT_SEND_CHANGESET_TIMEOUT = 2000;
|
21
|
+
export declare const COLLAB_WEB_SOCKET_URL_KEY = "COLLAB_WEB_SOCKET_URL";
|
22
|
+
export declare const DEFAULT_COLLAB_WEB_SOCKET_URL = "ws://127.0.0.1:8000/universer-api/comb/connect";
|
23
|
+
/** The heartbeat interval in milliseconds. */
|
24
|
+
export declare const HEARTBEAT_INTERVAL_KEY = "HEARTBEAT_INTERVAL";
|
25
|
+
export declare const DEFAULT_HEARTBEAT_INTERVAL = 30000;
|
26
|
+
export declare const HEARTBEAT_TIMEOUT_KEY = "HEARTBEAT_TIMEOUT";
|
27
|
+
export declare const DEFAULT_HEARTBEAT_TIMEOUT = 10000;
|
28
|
+
export declare const RETRY_CONNECTING_INTERVAL_KEY = "RETRY_CONNECTING_INTERVAL";
|
29
|
+
export declare const DEFAULT_RETRY_CONNECTING_INTERVAL = 20000;
|
30
|
+
export declare const RETRY_CONNECTING_MAX_COUNT_KEY = "RETRY_CONNECTING_MAX_COUNT";
|
31
|
+
export declare const DEFAULT_RETRY_CONNECTING_MAX_COUNT = 3;
|
32
|
+
/**
|
33
|
+
* A config key to determine how often should Univer save local edits.
|
34
|
+
*/
|
35
|
+
export declare const LOCAL_CACHE_INTERVAL_KEY = "LOCAL_CACHE_INTERVAL";
|
36
|
+
export declare const LOCAL_CACHE_INTERVAL = 1000;
|
37
|
+
export declare const COLLAB_SUBMIT_CHANGESET_URL_KEY = "COLLAB_SUBMIT_CHANGESET_URL";
|
38
|
+
/** The url prefix is determined by protocol in submodules/protocol/universer/v1/comb.proto */
|
39
|
+
export declare const DEFAULT_COLLAB_SUBMIT_CHANGESET_URL = "/universer-api/comb";
|
40
|
+
/**
|
41
|
+
* The config key to determined the URL provided by the auth server
|
42
|
+
*/
|
43
|
+
export declare const LOGIN_URL_KEY = "LOGIN_URL_KEY";
|
44
|
+
export declare const DEFAULT_LOGIN_URL = "/universer-api/oidc/authpage";
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import { IUniverInstanceService, RxDisposable, ThemeService } from '@univerjs/core';
|
2
2
|
import { IRenderManagerService } from '@univerjs/engine-render';
|
3
|
-
import { SheetSkeletonManagerService } from '@univerjs/sheets-ui';
|
4
3
|
import { CollabCursorController } from './collab-cursor.controller';
|
5
4
|
|
6
5
|
/**
|
@@ -10,12 +9,13 @@ export declare class SheetCollabCursorRenderController extends RxDisposable {
|
|
10
9
|
private readonly _collabCursorController;
|
11
10
|
private readonly _univerInstanceService;
|
12
11
|
private readonly _renderManagerService;
|
13
|
-
private readonly _sheetSkeletonManagerService;
|
14
12
|
private readonly _themeService;
|
15
13
|
/** Cursors stored for different Workbooks. */
|
16
14
|
private _cursors;
|
17
15
|
private _lastPointer;
|
18
|
-
|
16
|
+
private get _sheetSkeletonManagerService();
|
17
|
+
private get _unitId();
|
18
|
+
constructor(_collabCursorController: CollabCursorController, _univerInstanceService: IUniverInstanceService, _renderManagerService: IRenderManagerService, _themeService: ThemeService);
|
19
19
|
private _init;
|
20
20
|
private _updateCollabCursors;
|
21
21
|
private _removeCollabCursors;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ILocalStorageService, Nullable, ILogService } from '@univerjs/core';
|
2
|
-
import {
|
2
|
+
import { IMessageOptions, IMessageProps } from '@univerjs/design';
|
3
3
|
import { IBeforeCloseService, IMessageService, INotificationService } from '@univerjs/ui';
|
4
4
|
import { ICombResponseEvent } from '@univerjs-pro/collaboration';
|
5
5
|
import { IDisposable } from '@wendellhu/redi';
|
@@ -47,7 +47,7 @@ export declare class MockLocalStorageService implements ILocalStorageService {
|
|
47
47
|
iterate<T, U>(_iteratee: (value: T, key: string, iterationNumber: number) => U): Promise<U>;
|
48
48
|
}
|
49
49
|
export declare class MockMessageService implements IMessageService {
|
50
|
-
show(_options:
|
50
|
+
show(_options: IMessageOptions & Omit<IMessageProps, 'key'>): IDisposable;
|
51
51
|
setContainer(_container: HTMLElement): void;
|
52
52
|
}
|
53
53
|
export declare class MockNotificationService implements INotificationService {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { IMutationInfo, Nullable, ICommandService, IConfigService, ILogService, IUniverInstanceService, LocaleService
|
1
|
+
import { IMutationInfo, Nullable, ICommandService, IConfigService, ILogService, IPermissionService, IUniverInstanceService, LocaleService } from '@univerjs/core';
|
2
2
|
import { INotificationService } from '@univerjs/ui';
|
3
3
|
import { IAcknowledgedChangeset, IChangeset, ITransformService, RevisionService } from '@univerjs-pro/collaboration';
|
4
4
|
import { UniverType } from '@univerjs/protocol';
|
@@ -8,10 +8,6 @@ import { MemberService } from '../../services/member/member.service';
|
|
8
8
|
import { ICollaborativeUndoRedoService } from '../../services/undoredo/collaborative-undoredo.service';
|
9
9
|
import { ICollabEditingCursor } from '../../services/sync-editing-collab-cursor/doc-sync-editing-collab-cursor.service';
|
10
10
|
|
11
|
-
/**
|
12
|
-
* Determines how often should we send changesets.
|
13
|
-
*/
|
14
|
-
export declare const SEND_CHANGESET_TIMEOUT_KEY = "SEND_CHANGESET_TIMEOUT";
|
15
11
|
/** Provide both states when and after changing, so the parent could examine if state transition is correct. */
|
16
12
|
export type StateChangeHandler = (before: CollaborationState, after: CollaborationState) => void;
|
17
13
|
/** A network interface to send changeset and */
|
@@ -83,7 +79,9 @@ export declare abstract class CollaborationState {
|
|
83
79
|
/**
|
84
80
|
* Received a rejection from the server, meaning that conflict could be resolved by the algorithm.
|
85
81
|
*/
|
86
|
-
abstract onRemoteRej(
|
82
|
+
abstract onRemoteRej(config?: {
|
83
|
+
isPermissionRej: boolean;
|
84
|
+
}): CollaborationState;
|
87
85
|
abstract toggleOffline(): CollaborationState;
|
88
86
|
abstract toggleOnline(): CollaborationState;
|
89
87
|
/**
|
@@ -168,7 +166,9 @@ export declare class AwaitingState extends CollaborationState {
|
|
168
166
|
appendMutation(mutation: IMutationInfo): CollaborationState;
|
169
167
|
onRemoteChangeset(changeset: IChangeset): CollaborationState;
|
170
168
|
onRemoteAck(changeset: IAcknowledgedChangeset): CollaborationState;
|
171
|
-
onRemoteRej(
|
169
|
+
onRemoteRej(config?: {
|
170
|
+
isPermissionRej: boolean;
|
171
|
+
}): CollaborationState;
|
172
172
|
toggleOffline(): CollaborationState;
|
173
173
|
toggleOnline(): CollaborationState;
|
174
174
|
resend(): void;
|
@@ -187,7 +187,9 @@ export declare class AwaitingWithPendingState extends CollaborationState {
|
|
187
187
|
appendMutation(mutation: IMutationInfo): CollaborationState;
|
188
188
|
onRemoteChangeset(changeset: IChangeset): CollaborationState;
|
189
189
|
onRemoteAck(changeset: IAcknowledgedChangeset): CollaborationState;
|
190
|
-
onRemoteRej(
|
190
|
+
onRemoteRej(config?: {
|
191
|
+
isPermissionRej: boolean;
|
192
|
+
}): CollaborationState;
|
191
193
|
toggleOffline(): CollaborationState;
|
192
194
|
toggleOnline(): CollaborationState;
|
193
195
|
resend(): void;
|
@@ -200,11 +202,12 @@ export declare class AwaitingWithPendingState extends CollaborationState {
|
|
200
202
|
* reload the document.
|
201
203
|
*/
|
202
204
|
export declare class ConflictState extends CollaborationState {
|
203
|
-
private
|
205
|
+
private _isPermissionRej;
|
206
|
+
private readonly _permissionService;
|
204
207
|
private readonly _localeService;
|
205
208
|
private readonly _notificationService;
|
206
209
|
readonly status = CollaborationStatus.CONFLICT;
|
207
|
-
constructor(unitID: string, type: UniverType, awaitingChangeset: Nullable<IChangeset>, pendingMutations: IMutationInfo[], handler: ICollaborationStateHandler,
|
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);
|
208
211
|
appendMutation(): CollaborationState;
|
209
212
|
onRemoteChangeset(): CollaborationState;
|
210
213
|
onRemoteAck(): CollaborationState;
|
@@ -257,8 +260,10 @@ export declare class FetchingMissState extends CollaborationState {
|
|
257
260
|
resend(): void;
|
258
261
|
appendMutation(mutation: IMutationInfo<object>): CollaborationState;
|
259
262
|
onRemoteChangeset(changeset: IChangeset): CollaborationState;
|
260
|
-
onRemoteAck(
|
261
|
-
onRemoteRej(
|
263
|
+
onRemoteAck(_changeset: IAcknowledgedChangeset): CollaborationState;
|
264
|
+
onRemoteRej(config?: {
|
265
|
+
isPermissionRej: boolean;
|
266
|
+
}): CollaborationState;
|
262
267
|
toggleOffline(): CollaborationState;
|
263
268
|
toggleOnline(): CollaborationState;
|
264
269
|
private _onConflict;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { IMutationInfo, Nullable, ICommandService, ILogService, IUniverInstanceService, LocaleService, RxDisposable
|
1
|
+
import { IMutationInfo, Nullable, ICommandService, ILogService, IPermissionService, IUniverInstanceService, LocaleService, RxDisposable } from '@univerjs/core';
|
2
2
|
import { IMessageService } from '@univerjs/ui';
|
3
3
|
import { CompressMutationService, RevisionService } from '@univerjs-pro/collaboration';
|
4
4
|
import { UniverType } from '@univerjs/protocol';
|
@@ -43,13 +43,13 @@ export declare abstract class CollaborationEntity extends RxDisposable {
|
|
43
43
|
protected readonly _session: CollaborationSession;
|
44
44
|
protected readonly _injector: Injector;
|
45
45
|
protected readonly _localCacheService: LocalCacheService;
|
46
|
-
protected readonly _univerPermissionService: UniverPermissionService;
|
47
46
|
protected readonly _compressMutationService: CompressMutationService;
|
48
47
|
protected readonly _localeService: LocaleService;
|
49
48
|
protected readonly _revisionService: RevisionService;
|
50
49
|
protected readonly _logService: ILogService;
|
51
50
|
protected readonly _commandService: ICommandService;
|
52
51
|
protected readonly _messageService: IMessageService;
|
52
|
+
private _permissionService;
|
53
53
|
protected readonly _singleActiveUnitService?: ISingleActiveUnitService | undefined;
|
54
54
|
protected _state$: BehaviorSubject<Nullable<CollaborationState>>;
|
55
55
|
readonly state$: Observable<Nullable<CollaborationState>>;
|
@@ -57,7 +57,7 @@ export declare abstract class CollaborationEntity extends RxDisposable {
|
|
57
57
|
get state(): CollaborationState;
|
58
58
|
protected _collaborationPaused: boolean;
|
59
59
|
readonly status$: Observable<CollaborationStatus>;
|
60
|
-
constructor(unitID: string, _type: UniverType, _session: CollaborationSession, _injector: Injector, _localCacheService: LocalCacheService,
|
60
|
+
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);
|
61
61
|
init(): Promise<void>;
|
62
62
|
/**
|
63
63
|
* Pause collaboration on the document. Remote changesets would be inserted to a queue and wait for resuming.
|
@@ -95,7 +95,7 @@ export declare class DocCollaborationEntity extends CollaborationEntity {
|
|
95
95
|
private readonly _docTransformIMECacheService;
|
96
96
|
private readonly _docTransformSelectionsService;
|
97
97
|
private readonly _docSyncEditingCollabCursorService;
|
98
|
-
constructor(unitID: string, type: UniverType, session: CollaborationSession, injector: Injector, localCacheService: LocalCacheService,
|
98
|
+
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);
|
99
99
|
protected _createHandler(): ICollaborationStateHandler;
|
100
100
|
protected _init(): Promise<CollaborationState>;
|
101
101
|
}
|
@@ -104,7 +104,7 @@ export declare class SheetCollaborationEntity extends CollaborationEntity {
|
|
104
104
|
readonly type: UniverType;
|
105
105
|
readonly session: CollaborationSession;
|
106
106
|
private readonly _sheetTransformSelectionsService;
|
107
|
-
constructor(unitID: string, type: UniverType, session: CollaborationSession, injector: Injector, localCacheService: LocalCacheService,
|
107
|
+
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);
|
108
108
|
protected _createHandler(): ICollaborationStateHandler;
|
109
109
|
protected _init(): Promise<CollaborationState>;
|
110
110
|
}
|
package/lib/types/index.d.ts
CHANGED
@@ -1,17 +1,15 @@
|
|
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
2
|
export { CollaborationController } from './controllers/collaboration/collaboration.controller';
|
2
|
-
export {
|
3
|
-
export {
|
4
|
-
export {
|
5
|
-
export { LOCAL_CACHE_INTERVAL_KEY } from './services/local-cache/local-cache.service';
|
6
|
-
export { SNAPSHOT_SERVER_URL_KEY } from './services/snapshot-server/snapshot-server.service';
|
3
|
+
export { CollaborationStatus } from './controllers/collaboration/collaboration-state';
|
4
|
+
export { UniverCollaborationClientPlugin, type ICollaborationClientPluginConfig } from './plugin';
|
5
|
+
export { CollaborationSession, CollaborationSessionService, SessionStatus, } from './services/collaboration-session/collaboration-session.service';
|
7
6
|
export type { ICollaborationSocket } from './services/socket/collaboration-socket.service';
|
8
|
-
export {
|
7
|
+
export { CollaborationSocketService, ICollaborationSocketService, } from './services/socket/collaboration-socket.service';
|
9
8
|
export { LocalCacheService } from './services/local-cache/local-cache.service';
|
10
9
|
export { IURLService } from './services/url/url.service';
|
11
10
|
export { WebURLService } from './services/url/web-url.service';
|
12
11
|
export { DataLoaderController } from './controllers/data-loader/data-loader.controller';
|
13
12
|
export { DesktopCollaborationStatusDisplayController } from './controllers/collab-status/collab-status.controller';
|
14
|
-
export {
|
13
|
+
export { AUTHZ_URL_KEY, AuthzIoHttpService } from './services/auth-server/authz-io-http.service';
|
15
14
|
export { deserializeToCombResponse, serializeCombRequest } from './services/socket/serialize';
|
16
15
|
export { CollaborationStatusDisplay } from './views/components/CollabStatus';
|
17
|
-
export { enUS, zhCN } from './locale';
|
package/lib/types/plugin.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { DependencyOverride,
|
1
|
+
import { DependencyOverride, ILogService, Plugin, UniverInstanceType } from '@univerjs/core';
|
2
2
|
import { Ctor, Injector } from '@wendellhu/redi';
|
3
3
|
import { ICollaborationSocketService } from './services/socket/collaboration-socket.service';
|
4
4
|
|
@@ -13,12 +13,12 @@ export interface ICollaborationClientPluginConfig {
|
|
13
13
|
*/
|
14
14
|
override?: DependencyOverride;
|
15
15
|
}
|
16
|
-
export declare class
|
16
|
+
export declare class UniverCollaborationClientPlugin extends Plugin {
|
17
17
|
private readonly _config;
|
18
|
+
private readonly _logService;
|
18
19
|
protected _injector: Injector;
|
19
|
-
private readonly _localeService;
|
20
20
|
static pluginName: string;
|
21
|
-
constructor(_config: ICollaborationClientPluginConfig | undefined,
|
21
|
+
constructor(_config: ICollaborationClientPluginConfig | undefined, _logService: ILogService, _injector: Injector);
|
22
22
|
onStarting(injector: Injector): void;
|
23
23
|
private _initModules;
|
24
24
|
}
|
@@ -1,10 +1,6 @@
|
|
1
1
|
import { IConfigService, LocaleService } from '@univerjs/core';
|
2
2
|
import { HTTPService } from '@univerjs/network';
|
3
3
|
|
4
|
-
/**
|
5
|
-
* The config key to determined the URL provided by the auth server
|
6
|
-
*/
|
7
|
-
export declare const LOGIN_URL_KEY = "LOGIN_URL_KEY";
|
8
4
|
export declare class AuthServerService {
|
9
5
|
private readonly _configService;
|
10
6
|
private readonly _httpService;
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { IAuthzIoService, IConfigService } from '@univerjs/core';
|
2
|
+
import { HTTPService } from '@univerjs/network';
|
3
|
+
import { IActionInfo, IAllowedRequest, IBatchAllowedResponse, ICollaborator, ICreateCollaboratorRequest, ICreateRequest, IDeleteCollaboratorRequest, IListCollaboratorRequest, IListPermPointRequest, IListPermPointResponse, IListRolesRequest, IPutCollaboratorsRequest, IUnitRoleKV, IUpdateCollaboratorRequest, IUpdatePermPointRequest, UnitAction } from '@univerjs/protocol';
|
4
|
+
|
5
|
+
/**
|
6
|
+
* The config key to determined the URL provided by the author server.
|
7
|
+
* The URL should not ends with a slash.
|
8
|
+
*/
|
9
|
+
export declare const AUTHZ_URL_KEY = "AUTHZ_URL_KEY";
|
10
|
+
export declare class AuthzIoHttpService implements IAuthzIoService {
|
11
|
+
private _HTTPService;
|
12
|
+
private _configService;
|
13
|
+
constructor(_HTTPService: HTTPService, _configService: IConfigService);
|
14
|
+
private _getAPIPrefixPath;
|
15
|
+
create(config: ICreateRequest): Promise<string>;
|
16
|
+
list(config: IListPermPointRequest): Promise<IListPermPointResponse['objects']>;
|
17
|
+
update(config: IUpdatePermPointRequest): Promise<void>;
|
18
|
+
allowed(config: IAllowedRequest): Promise<IActionInfo[]>;
|
19
|
+
batchAllowed(config: IAllowedRequest[]): Promise<IBatchAllowedResponse['objectActions']>;
|
20
|
+
listRoles(config: IListRolesRequest): Promise<{
|
21
|
+
roles: IUnitRoleKV[];
|
22
|
+
actions: UnitAction[];
|
23
|
+
}>;
|
24
|
+
deleteCollaborator(config: IDeleteCollaboratorRequest): Promise<void>;
|
25
|
+
updateCollaborator(config: IUpdateCollaboratorRequest): Promise<void>;
|
26
|
+
createCollaborator(config: ICreateCollaboratorRequest): Promise<void>;
|
27
|
+
listCollaborators(config: IListCollaboratorRequest): Promise<ICollaborator[]>;
|
28
|
+
putCollaborators(config: IPutCollaboratorsRequest): Promise<void>;
|
29
|
+
}
|
@@ -12,13 +12,6 @@ export declare enum SessionStatus {
|
|
12
12
|
OFFLINE = 2,
|
13
13
|
ONLINE = 3
|
14
14
|
}
|
15
|
-
export declare const COLLAB_WEB_SOCKET_URL_KEY = "COLLAB_WEB_SOCKET_URL";
|
16
|
-
export declare const DEFAULT_COLLAB_WEB_SOCKET_URL = "ws://127.0.0.1:8000/universer-api/comb/connect";
|
17
|
-
/** The heartbeat interval in milliseconds. */
|
18
|
-
export declare const HEARTBEAT_INTERVAL_KEY = "HEARTBEAT_INTERVAL";
|
19
|
-
export declare const HEARTBEAT_TIMEOUT_KEY = "HEARTBEAT_TIMEOUT";
|
20
|
-
export declare const RETRY_CONNECTING_INTERVAL_KEY = "RETRY_CONNECTING_INTERVAL";
|
21
|
-
export declare const RETRY_CONNECTING_MAX_COUNT_KEY = "RETRY_CONNECTING_MAX_COUNT";
|
22
15
|
/**
|
23
16
|
* The data structure to represent a collaboration session. It also manages the collaborator's identity.
|
24
17
|
*
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import { Nullable, IConfigService } from '@univerjs/core';
|
2
|
+
import { IImageIoService, IImageIoServiceParam, ImageSourceType } from '@univerjs/drawing';
|
3
|
+
import { HTTPService } from '@univerjs/network';
|
4
|
+
import { IError } from '@univerjs/protocol';
|
5
|
+
import { Observable } from 'rxjs';
|
6
|
+
|
7
|
+
export declare const ALLOW_IMAGE_LIST: string[];
|
8
|
+
export declare const EXCHANGE_UPLOAD_FILE_SERVER_URL_KEY = "EXCHANGE_UPLOAD_FILE_SERVER_URL_KEY";
|
9
|
+
export declare const EXCHANGE_SIGN_URL_SERVER_URL_KEY = "EXCHANGE_SIGN_URL_SERVER_URL_KEY";
|
10
|
+
export interface ISignUrlResponse {
|
11
|
+
error: IError | undefined;
|
12
|
+
url: string;
|
13
|
+
}
|
14
|
+
export declare class ImageIoService implements IImageIoService {
|
15
|
+
private readonly _httpService;
|
16
|
+
private readonly _configService;
|
17
|
+
private _waitCount;
|
18
|
+
private _change$;
|
19
|
+
change$: Observable<number>;
|
20
|
+
constructor(_httpService: HTTPService, _configService: IConfigService);
|
21
|
+
setWaitCount(count: number): void;
|
22
|
+
private _imageSourceCache;
|
23
|
+
getImageSourceCache(source: string, imageSourceType: ImageSourceType): HTMLImageElement | undefined;
|
24
|
+
addImageSourceCache(source: string, imageSourceType: ImageSourceType, imageSource: Nullable<HTMLImageElement>): void;
|
25
|
+
getImage(imageId: string): Promise<string>;
|
26
|
+
saveImage(imageFile: File): Promise<Nullable<IImageIoServiceParam>>;
|
27
|
+
private _getUploadFileURL;
|
28
|
+
private _getSignURL;
|
29
|
+
private _replaceFileID;
|
30
|
+
private _decreaseWaiting;
|
31
|
+
}
|
@@ -10,11 +10,6 @@ export interface IUnitCacheData {
|
|
10
10
|
awaitingChangeset: Nullable<IChangeset>;
|
11
11
|
mutations: IMutationInfo[];
|
12
12
|
}
|
13
|
-
/**
|
14
|
-
* A config key to determine how often should Univer save local edits.
|
15
|
-
*/
|
16
|
-
export declare const LOCAL_CACHE_INTERVAL_KEY = "LOCAL_CACHE_INTERVAL";
|
17
|
-
export declare const LOCAL_CACHE_INTERVAL = 1000;
|
18
13
|
/**
|
19
14
|
* This service provide caching to the collaboration controller.
|
20
15
|
*/
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Nullable, Disposable, IUniverInstanceService } from '@univerjs/core';
|
1
|
+
import { Nullable, Disposable, IUniverInstanceService, UserManagerService } from '@univerjs/core';
|
2
2
|
import { IMember } from '@univerjs/protocol';
|
3
3
|
|
4
4
|
export interface IUser extends IMember {
|
@@ -9,10 +9,16 @@ export interface IUser extends IMember {
|
|
9
9
|
*/
|
10
10
|
export declare class MemberService extends Disposable {
|
11
11
|
private readonly _univerInstanceService;
|
12
|
+
private _userManagerService;
|
12
13
|
private _roomMembers;
|
13
|
-
|
14
|
-
|
14
|
+
constructor(_univerInstanceService: IUniverInstanceService, _userManagerService: UserManagerService);
|
15
|
+
/**
|
16
|
+
* @deprecated please use userManagerService
|
17
|
+
*/
|
15
18
|
setCurrentUser(user: IUser): void;
|
19
|
+
/**
|
20
|
+
* @deprecated please use userManagerService
|
21
|
+
*/
|
16
22
|
getCurrentUser(): Nullable<IUser>;
|
17
23
|
updateMember(roomID: string, member: IMember): void;
|
18
24
|
removeMember(roomID: string, memberID: string): void;
|
@@ -2,11 +2,6 @@ import { ILogContext, ISnapshotServerService, IConfigService } from '@univerjs/c
|
|
2
2
|
import { HTTPService } from '@univerjs/network';
|
3
3
|
import { IFetchMissingChangesetsRequest, IFetchMissingChangesetsResponse, IGetResourcesRequest, IGetResourcesResponse, IGetSheetBlockRequest, IGetSheetBlockResponse, IGetUnitOnRevRequest, IGetUnitOnRevResponse, ISaveChangesetResponse, ISaveSheetBlockResponse, ISaveSnapshotResponse } from '@univerjs/protocol';
|
4
4
|
|
5
|
-
/**
|
6
|
-
* The config key to determined the URL provided by the snapshot server
|
7
|
-
* to load snapshot. The URL should not ends with a slash.
|
8
|
-
*/
|
9
|
-
export declare const SNAPSHOT_SERVER_URL_KEY = "SNAPSHOT_SERVER_URL_KEY";
|
10
5
|
export declare class SnapshotServerOverHTTPService implements ISnapshotServerService {
|
11
6
|
private readonly _configService;
|
12
7
|
private readonly _httpService;
|
@@ -14,7 +9,8 @@ export declare class SnapshotServerOverHTTPService implements ISnapshotServerSer
|
|
14
9
|
getUnitOnRev(_context: ILogContext, params: IGetUnitOnRevRequest): Promise<IGetUnitOnRevResponse>;
|
15
10
|
getSheetBlock(_context: ILogContext, params: IGetSheetBlockRequest): Promise<IGetSheetBlockResponse>;
|
16
11
|
fetchMissingChangesets(_context: ILogContext, params: IFetchMissingChangesetsRequest): Promise<IFetchMissingChangesetsResponse>;
|
17
|
-
private
|
12
|
+
private _getSnapshotAPIPrefix;
|
13
|
+
private _getAPIPrefix;
|
18
14
|
getResourcesRequest(_context: ILogContext, params: IGetResourcesRequest): Promise<IGetResourcesResponse>;
|
19
15
|
saveSnapshot(): Promise<ISaveSnapshotResponse>;
|
20
16
|
saveSheetBlock(): Promise<ISaveSheetBlockResponse>;
|
@@ -17,7 +17,6 @@ export interface ICollaborationSocketService {
|
|
17
17
|
createSocket: (url: string) => Nullable<ICollaborationSocket>;
|
18
18
|
}
|
19
19
|
export declare const ICollaborationSocketService: import('@wendellhu/redi').IdentifierDecorator<ICollaborationSocketService>;
|
20
|
-
export declare const COLLAB_SUBMIT_CHANGESET_URL_KEY = "COLLAB_SUBMIT_CHANGESET_URL";
|
21
20
|
export declare class CollaborationSocketService implements ICollaborationSocketService {
|
22
21
|
protected readonly _http: HTTPService;
|
23
22
|
protected readonly _ws: WebSocketService;
|