import { type queueAsPromised } from "fastq"; export declare abstract class PipeHandler { /** * Callbacks for registered events. */ protected callbacks: { [K in keyof ReceiveMap]?: ((data: ReceiveMap[K]) => void | Promise)[]; }; /** * Queue for processing events asynchronously. */ protected queue: queueAsPromised<{ type: keyof ReceiveMap; data: ReceiveMap[keyof ReceiveMap]; }>; constructor(); /** * Registers a callback for a specific message type. * @param type - The message type. * @param callback - The callback function to handle the message. */ on(type: T, callback: (data: ReceiveMap[T]) => void | Promise): void; /** * Removes a callback for a specific message type. * @param type - The message type. * @param callback - The callback function to remove. */ off(type: T, callback: (data: ReceiveMap[T]) => void | Promise): void; /** * Registers a one-time listener for a specific message type. * The listener is automatically removed after being called once. * @param type - The message type. * @returns A promise that resolves when the message is received. */ once(type: T): Promise; /** * Emits a message to all registered callbacks for that message type. * @param type - The message type. * @param data - The data associated with the message. */ protected emit(type: T, data: ReceiveMap[T]): void; /** * Processes a message from the queue and invokes its associated callbacks. * @param payload - The message and its associated data. */ private process; /** * Handles messages and dispatches them to the appropriate callbacks. * @param message - The incoming message to process. */ protected routeMessage(message: { type: keyof ReceiveMap; data: ReceiveMap[keyof ReceiveMap]; }): void; /** * Sends a message to the appropriate pipe endpoint. * @param type - The message type. * @param data - The data for the message. * @param additionalArgs - Additional arguments for the implementation. */ abstract post(type: T, data: SendMap[T], ...additionalArgs: unknown[]): void; }