@univerjs-pro/collaboration-client 0.1.13 → 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.
@@ -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
- constructor(_collabCursorController: CollabCursorController, _univerInstanceService: IUniverInstanceService, _renderManagerService: IRenderManagerService, _sheetSkeletonManagerService: SheetSkeletonManagerService, _themeService: ThemeService);
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;
@@ -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 */
@@ -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 { SEND_CHANGESET_TIMEOUT_KEY, CollaborationStatus, } from './controllers/collaboration/collaboration-state';
3
- export { CollaborationClientPlugin, type ICollaborationClientPluginConfig } from './plugin';
4
- export { COLLAB_WEB_SOCKET_URL_KEY, CollaborationSession, CollaborationSessionService, HEARTBEAT_INTERVAL_KEY, HEARTBEAT_TIMEOUT_KEY, SessionStatus, } from './services/collaboration-session/collaboration-session.service';
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 { COLLAB_SUBMIT_CHANGESET_URL_KEY, CollaborationSocketService, ICollaborationSocketService, } from './services/socket/collaboration-socket.service';
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 { LOGIN_URL_KEY } from './services/auth-server/auth-server.service';
15
- export { AuthzIoHttpService } from './services/auth-server/authz-io-http.service';
13
+ export { AUTHZ_URL_KEY, AuthzIoHttpService } from './services/auth-server/authz-io-http.service';
16
14
  export { deserializeToCombResponse, serializeCombRequest } from './services/socket/serialize';
17
15
  export { CollaborationStatusDisplay } from './views/components/CollabStatus';
@@ -1,4 +1,4 @@
1
- import { DependencyOverride, LocaleService, Plugin, UniverInstanceType } from '@univerjs/core';
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 CollaborationClientPlugin extends Plugin {
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, _injector: Injector, _localeService: LocaleService);
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;
@@ -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
  *
@@ -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
- private _currentUser;
14
- constructor(_univerInstanceService: IUniverInstanceService);
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 _getAPIPrefixPath;
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;