UNPKG

@casual-simulation/aux-common

Version:
53 lines 2.65 kB
import type { Observable } from 'rxjs'; import type { AuxPartitionRealtimeStrategy, YjsPartition } from './AuxPartition'; import type { BotAction, Bot, UpdatedBot, StateUpdatedEvent, BotsState } from '../bots'; import type { PartitionConfig, YjsClientPartitionConfig, RemoteYjsPartitionConfig } from './AuxPartitionConfig'; import type { RemoteActions } from '../common'; import type { ClientEvent, InstRecordsClient, MaxInstSizeReachedClientError, RateLimitExceededMessage } from '../websockets'; import type { PartitionAuthSource } from './PartitionAuthSource'; import { RemoteYjsSharedDocument } from '../documents/RemoteYjsSharedDocument'; /** * Attempts to create a YjsPartition from the given config. * @param config The config. * @param authSource The auth source. */ export declare function createRemoteClientYjsPartition(config: PartitionConfig, authSource: PartitionAuthSource): YjsPartition; export declare class RemoteYjsPartitionImpl extends RemoteYjsSharedDocument implements YjsPartition { private _emittedMaxSizeReached; private _bots; private _masks; private _internalPartition; private _remoteEvents; get onBotsAdded(): Observable<Bot[]>; get onBotsRemoved(): Observable<string[]>; get onBotsUpdated(): Observable<UpdatedBot[]>; get onStateUpdated(): Observable<StateUpdatedEvent>; unsubscribe(): void; get closed(): boolean; get state(): BotsState; type: "yjs"; private: boolean; get space(): string; set space(value: string); get realtimeStrategy(): AuxPartitionRealtimeStrategy; constructor(client: InstRecordsClient, authSource: PartitionAuthSource, config: YjsClientPartitionConfig | RemoteYjsPartitionConfig); applyEvents(events: BotAction[]): Promise<BotAction[]>; sendRemoteEvents(events: RemoteActions[]): Promise<void>; protected _handleClientEvent(event: ClientEvent): void; protected _onMaxSizeReached(event: MaxInstSizeReachedClientError): void; protected _onRateLimitExceeded(event: RateLimitExceededMessage): void; private _applyEvents; private _processTransaction; private _mapToBot; /** * Updates the given value in the given document and map. * This is a generalization of the update logic for tags and tag masks. * @param doc The document. * @param map The map that contains the values. * @param valueId The ID that the value should be looked up by. For tags, this is the tag name. For tag masks, this is the tag mask ID. * @param newVal The new value. */ private _updateValueInMap; private _handleValueUpdates; } //# sourceMappingURL=RemoteYjsPartition.d.ts.map