@univerjs-pro/collaboration-client 0.1.12 → 0.1.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.
- 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/controllers/collaboration/__tests__/mocks.d.ts +2 -2
- package/lib/types/controllers/collaboration/collaboration-state.d.ts +17 -8
- package/lib/types/controllers/collaboration/collaboration.controller.d.ts +5 -5
- package/lib/types/index.d.ts +1 -1
- package/lib/types/locale/ru-RU.d.ts +4 -0
- package/lib/types/locale/zh-CN.d.ts +4 -0
- package/lib/types/services/auth-server/authz-io-http.service.d.ts +29 -0
- package/lib/types/services/image-remote/image-io.service.d.ts +31 -0
- package/lib/umd/index.js +1 -1
- package/package.json +28 -25
- 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
|
+
}
|
@@ -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';
|
@@ -83,7 +83,9 @@ export declare abstract class CollaborationState {
|
|
83
83
|
/**
|
84
84
|
* Received a rejection from the server, meaning that conflict could be resolved by the algorithm.
|
85
85
|
*/
|
86
|
-
abstract onRemoteRej(
|
86
|
+
abstract onRemoteRej(config?: {
|
87
|
+
isPermissionRej: boolean;
|
88
|
+
}): CollaborationState;
|
87
89
|
abstract toggleOffline(): CollaborationState;
|
88
90
|
abstract toggleOnline(): CollaborationState;
|
89
91
|
/**
|
@@ -168,7 +170,9 @@ export declare class AwaitingState extends CollaborationState {
|
|
168
170
|
appendMutation(mutation: IMutationInfo): CollaborationState;
|
169
171
|
onRemoteChangeset(changeset: IChangeset): CollaborationState;
|
170
172
|
onRemoteAck(changeset: IAcknowledgedChangeset): CollaborationState;
|
171
|
-
onRemoteRej(
|
173
|
+
onRemoteRej(config?: {
|
174
|
+
isPermissionRej: boolean;
|
175
|
+
}): CollaborationState;
|
172
176
|
toggleOffline(): CollaborationState;
|
173
177
|
toggleOnline(): CollaborationState;
|
174
178
|
resend(): void;
|
@@ -187,7 +191,9 @@ export declare class AwaitingWithPendingState extends CollaborationState {
|
|
187
191
|
appendMutation(mutation: IMutationInfo): CollaborationState;
|
188
192
|
onRemoteChangeset(changeset: IChangeset): CollaborationState;
|
189
193
|
onRemoteAck(changeset: IAcknowledgedChangeset): CollaborationState;
|
190
|
-
onRemoteRej(
|
194
|
+
onRemoteRej(config?: {
|
195
|
+
isPermissionRej: boolean;
|
196
|
+
}): CollaborationState;
|
191
197
|
toggleOffline(): CollaborationState;
|
192
198
|
toggleOnline(): CollaborationState;
|
193
199
|
resend(): void;
|
@@ -200,11 +206,12 @@ export declare class AwaitingWithPendingState extends CollaborationState {
|
|
200
206
|
* reload the document.
|
201
207
|
*/
|
202
208
|
export declare class ConflictState extends CollaborationState {
|
203
|
-
private
|
209
|
+
private _isPermissionRej;
|
210
|
+
private readonly _permissionService;
|
204
211
|
private readonly _localeService;
|
205
212
|
private readonly _notificationService;
|
206
213
|
readonly status = CollaborationStatus.CONFLICT;
|
207
|
-
constructor(unitID: string, type: UniverType, awaitingChangeset: Nullable<IChangeset>, pendingMutations: IMutationInfo[], handler: ICollaborationStateHandler,
|
214
|
+
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
215
|
appendMutation(): CollaborationState;
|
209
216
|
onRemoteChangeset(): CollaborationState;
|
210
217
|
onRemoteAck(): CollaborationState;
|
@@ -257,8 +264,10 @@ export declare class FetchingMissState extends CollaborationState {
|
|
257
264
|
resend(): void;
|
258
265
|
appendMutation(mutation: IMutationInfo<object>): CollaborationState;
|
259
266
|
onRemoteChangeset(changeset: IChangeset): CollaborationState;
|
260
|
-
onRemoteAck(
|
261
|
-
onRemoteRej(
|
267
|
+
onRemoteAck(_changeset: IAcknowledgedChangeset): CollaborationState;
|
268
|
+
onRemoteRej(config?: {
|
269
|
+
isPermissionRej: boolean;
|
270
|
+
}): CollaborationState;
|
262
271
|
toggleOffline(): CollaborationState;
|
263
272
|
toggleOnline(): CollaborationState;
|
264
273
|
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
@@ -12,6 +12,6 @@ export { WebURLService } from './services/url/web-url.service';
|
|
12
12
|
export { DataLoaderController } from './controllers/data-loader/data-loader.controller';
|
13
13
|
export { DesktopCollaborationStatusDisplayController } from './controllers/collab-status/collab-status.controller';
|
14
14
|
export { LOGIN_URL_KEY } from './services/auth-server/auth-server.service';
|
15
|
+
export { AuthzIoHttpService } from './services/auth-server/authz-io-http.service';
|
15
16
|
export { deserializeToCombResponse, serializeCombRequest } from './services/socket/serialize';
|
16
17
|
export { CollaborationStatusDisplay } from './views/components/CollabStatus';
|
17
|
-
export { enUS, zhCN } from './locale';
|
@@ -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
|
+
}
|
@@ -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
|
+
}
|