@casual-simulation/aux-common
Version:
Common library for AUX projects
68 lines • 3.16 kB
TypeScript
import { Observable } from 'rxjs';
import { Subject, Subscription } from 'rxjs';
import type { RemoteClientEvent, SharedDocument } from './SharedDocument';
import type { ClientEvent, InstRecordsClient, MaxInstSizeReachedClientError, RateLimitExceededMessage } from '../websockets';
import type { SharedDocumentConfig } from './SharedDocumentConfig';
import type { PartitionAuthSource } from '../partitions/PartitionAuthSource';
import type { ConnectionInfo } from '../common';
import { YjsSharedDocument } from './YjsSharedDocument';
import type { SharedDocumentServices } from './SharedDocumentFactories';
export declare function createRemoteClientYjsSharedDocument(config: SharedDocumentConfig, services: SharedDocumentServices, client: InstRecordsClient): RemoteYjsSharedDocument;
/**
* Defines a shared document that is able to use YJS and a InstRecordsClient to synchronize over the network.
*/
export declare class RemoteYjsSharedDocument extends YjsSharedDocument implements SharedDocument {
protected _static: boolean;
protected _skipInitialLoad: boolean;
protected _sendInitialUpdates: boolean;
protected _watchingBranch: any;
protected _synced: boolean;
protected _authorized: boolean;
protected _temporary: boolean;
protected _readOnly: boolean;
protected _authSource: PartitionAuthSource;
protected _markers: string[];
protected _connectedClients: Map<string, ConnectionInfo>;
protected _remoteClientsSubject: Subject<RemoteClientEvent>;
protected _remoteClientsRaw: Observable<RemoteClientEvent>;
protected _watchingBranchDevices: Subscription | null;
protected _remoteClientSubscribers: number;
get remoteClients(): Observable<RemoteClientEvent>;
get remoteClientsRaw(): Observable<RemoteClientEvent>;
unsubscribe(): void;
constructor(client: InstRecordsClient, authSource: PartitionAuthSource, config: SharedDocumentConfig);
connect(): void;
enableCollaboration(): Promise<void>;
private _initializePartitionWithoutLoading;
private _requestBranch;
private _watchBranch;
/**
* Handles a client error that was received from the server.
* @param event The event.
*/
private _handleClientError;
private _isNotAuthorizedErrorCode;
private _handleNotAuthorized;
/**
* Handles a client event that was received from the server.
* @param event The event that was received.
*/
protected _handleClientEvent(event: ClientEvent): void;
/**
* Called when the server sends a rate limit exceeded message.
* @param event The event that was sent.
*/
protected _onRateLimitExceeded(event: RateLimitExceededMessage): void;
/**
* Called when the server sends a max size reached message.
* @param event The event that was sent.
*/
protected _onMaxSizeReached(event: MaxInstSizeReachedClientError): void;
private _clientConnectedEvent;
private _clientDisconnectedEvent;
private _isSelfClient;
private _startWatchingBranchDevices;
private _stopWatchingBranchDevices;
private _updateSynced;
}
//# sourceMappingURL=RemoteYjsSharedDocument.d.ts.map