import { Controllable, ControllerPullListener } from '@johngw/stream/sources/Controllable';
/**
 * The underlying source of a ReadableStream that can have chunks
 * queued to from an external source.
 *
 * @group Sources
 * @example
 * Queuing items externally.
 *
 * ```
 * const controller = new ControllableSource<number>()
 * const stream = new ReadableStream(controller)
 * controller.enqueue(1)
 * controller.enqueue(2)
 * controller.enqueue(3)
 * controller.close()
 * ```
 *
 * Registering pull subscribers externally.
 *
 * ```
 * const controller = new ControllableStream<number>()
 * let i = -1
 * controller.onPull(() => ++i)
 * ```
 */
export declare class ControllableSource<T> implements ReadableStreamDefaultController<T>, Controllable<T> {
    #private;
    start(controller: ReadableStreamDefaultController<T>): void;
    pull(controller: ReadableStreamDefaultController<T>): Promise<void>;
    get desiredSize(): number | null;
    /**
     * Register a pull subscriber.
     *
     * @remark
     * When the stream is ready to pull it will pull from all
     * subscribers until the desired size has been fulfilled.
     */
    onPull(pullListener: ControllerPullListener<T>): () => void;
    error(error?: unknown): void;
    enqueue(chunk: T): void;
    close(): void;
}
