import type { DataConnection } from "peerjs"; import type { DatabaseData, DatabaseEntries, TableKey } from "./database.js"; export declare const HandlerType: { readonly CONNECTION: "connection"; readonly CLOSE: "close"; readonly MESSAGE: "message"; readonly ERROR: "error"; readonly SEND: "send"; readonly DISCONNECT: "disconnect"; }; export type HandlerType = typeof HandlerType[keyof typeof HandlerType]; export interface PeerEventMap { [HandlerType.CONNECTION]: ConnectionHandler; [HandlerType.CLOSE]: CloseHandler; [HandlerType.MESSAGE]: MessageHandler; [HandlerType.SEND]: SendHandler; [HandlerType.ERROR]: ErrorHandler; [HandlerType.DISCONNECT]: DisconnectHandler; } export type PeerHandler = PeerEventMap[keyof PeerEventMap]; export type Connections = Record; export type PeerID = string; export interface WebRtcDispatchPayload { id: string; table: TableKey; data: DatabaseData; clear?: boolean; } export type ConnectionHandler = (targetId?: PeerID) => void; export type CloseHandler = (targetId?: PeerID) => void; export type MessageHandler = (data?: unknown) => void; export type ErrorHandler = (err?: Error | unknown) => void; export type SendHandler = () => void; export type DisconnectHandler = (state: DisconnectType) => void; export interface WebRtcConfig { maxReconnectCount?: number; reconnectTimeout?: number; } export declare const enum PeerDataType { SYNC = "SYNC", UPDATE = "UPDATE" } export interface PeerData { data: T; timestamp: number; type: PeerDataType; senderId: PeerID; } export declare const enum DisconnectType { SUCCESS = "SUCCESS", RECONNECT_FAIL = "FAILED", RECONNECT_RETRY = "RETRY" } //# sourceMappingURL=web-rtc.d.ts.map