import type { JanusJS } from 'janus-gateway-ts'; import type { Readable, Updater, Writable } from 'svelte/store'; import type { PluginHandle, Event } from '../../attach'; import type { OneOf } from '../../utils/typing'; export declare type RoomId = number; export declare type RoomPin = string | undefined; export declare type UserName = string; export declare type DisplayName = string | undefined; /** * The properties exposed when the component attached */ export declare type AttachEvent = { on: Event; send: Send; peers: Readable; }; /** * The structure of messages received from TextRoom */ export declare type Message = { textroom: string; transaction: string; participants?: Participant[]; join?: string; leave?: string; room?: number; from?: string; date?: string; text?: string; username?: string; display?: string; }; /** * The anatomy of a participant */ export declare type Participant = { username: UserName; display: DisplayName; }; /** * The data we're holding regarding a participant */ export declare type PeerModelMeta = Participant & { [key: string]: unknown; }; /** * What do we know about our neighbours, really? */ export declare type PeerModel = { meta: Writable; ended?: true; }; /** * Peers get indexed by their username */ export declare type Peers = Record; /** * Our payload must contain a text string, and then either one or neither of `to` or `tos`, * which are the username or usernames of recipients, respectively. */ export declare type Payload = { text: string; } & Partial>; /** * The signature of sending a data message */ export declare type Send = (payload: Payload) => void; /** * For a given opaqueId, generate a new plugin handle conforming to the TextRoom spec */ export declare type InitTextRoom = (opaqueId: string) => Promise>; declare type ConnectParams = { room: number; pin?: string | undefined; username: string; display?: string; }; export declare function connect(janus: JanusJS.Janus, { room, pin, username, display }: ConnectParams): InitTextRoom; /** * Helper function for updating a store of Peers, inserting the given participants into the store */ export declare function putPeers(participants: Participant[]): Updater; /** * Helper function for updating a store of Peers, removing a particular peer because they have 'ended'. * * This behaviour is distinctly different from VideoRoom - here, we can simply delete the participant. */ export declare function markAsEnded(username: string): Updater; export { default as TextRoom } from './index.svelte';