UNPKG

@casual-simulation/aux-common

Version:
47 lines 2.02 kB
import type { Observable } from 'rxjs'; import type { AuxPartitionRealtimeStrategy, YjsPartition } from './AuxPartition'; import type { BotAction, Bot, UpdatedBot, StateUpdatedEvent, BotsState } from '../bots'; import type { PartitionConfig, YjsPartitionConfig } from './AuxPartitionConfig'; import type { RemoteActions } from '../common'; import { YjsSharedDocument } from '../documents/YjsSharedDocument'; /** * Attempts to create a YjsPartition from the given config. * @param config The config. */ export declare function createYjsPartition(config: PartitionConfig): YjsPartition; export declare class YjsPartitionImpl extends YjsSharedDocument implements YjsPartition { protected _hasRegisteredSubs: boolean; private _bots; private _masks; private _internalPartition; private _remoteEvents; private _connectionId; get onBotsAdded(): Observable<Bot[]>; get onBotsRemoved(): Observable<string[]>; get onBotsUpdated(): Observable<UpdatedBot[]>; get onStateUpdated(): Observable<StateUpdatedEvent>; unsubscribe(): void; get state(): BotsState; type: "yjs"; private: boolean; get space(): string; set space(value: string); get realtimeStrategy(): AuxPartitionRealtimeStrategy; constructor(config: YjsPartitionConfig); sendRemoteEvents(events: RemoteActions[]): Promise<void>; applyEvents(events: BotAction[]): Promise<BotAction[]>; 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=YjsPartition.d.ts.map