UNPKG

@directus/api

Version:

Directus is a real-time API and App dashboard for managing SQL database content

64 lines (63 loc) 1.94 kB
import { type WebSocketClient } from '@directus/types'; import { Messenger } from './messenger.js'; import { RoomManager } from './room.js'; import type { DiscardMessage, FocusMessage, JoinMessage, LeaveMessage, UpdateAllMessage, UpdateMessage } from './types.js'; /** * Handler responsible for subscriptions */ export declare class CollabHandler { roomManager: RoomManager; messenger: Messenger; enabled: boolean; private initialized; private initializePromise?; private settingsService?; private cleanupJob?; private cleanupInterval?; private busHandler?; private eventQueue; /** * Initialize the handler */ constructor(); initialize(force?: boolean): Promise<void>; bindWebSocket(): void; startBackgroundJobs(): void; /** * Terminate the handler and stop background jobs */ terminate(): Promise<void>; /** * Ensure collaborative editing is enabled and initialized */ ensureEnabled(): Promise<void>; /** * Join a collaborative editing room */ onJoin(client: WebSocketClient, message: JoinMessage): Promise<void>; /** * Leave a collaborative editing room */ onLeave(client: WebSocketClient, message?: LeaveMessage): Promise<void>; /** * Update a field value */ onUpdate(client: WebSocketClient, message: UpdateMessage): Promise<void>; /** * Update multiple field values */ onUpdateAll(client: WebSocketClient, message: UpdateAllMessage): Promise<void>; /** * Update focus state */ onFocus(client: WebSocketClient, message: FocusMessage): Promise<void>; /** * Discard specified changes in the room */ onDiscard(client: WebSocketClient, message: DiscardMessage): Promise<void>; /** * Verify field access for both READ and UPDATE permissions */ private checkFieldsAccess; private getAllowedFields; }