import { type HttpServer, RequestMethod } from '@nestjs/common';
import { IncomingMessage } from 'http';
import { Observable } from 'rxjs';
import { AdditionalHeadersSource, StatusCodeSource, WritableHeaderStream } from './sse-stream.js';
import { type StreamingBody } from './streaming-body.js';
/**
 * The surface the SSE lifecycle listens on to learn that the client is gone.
 * Runtimes that emulate "node:http" without a real "net.Socket" (e.g.
 * Cloudflare Workers) expose a socket-like object that only carries address
 * information, so it cannot be used as an event source.
 */
interface CloseSource {
    destroyed?: boolean;
    once(event: 'close', listener: () => void): unknown;
    removeListener(event: 'close', listener: () => void): unknown;
}
export declare function pickCloseSource(socket: unknown, response: unknown): CloseSource | undefined;
/**
 * Calls `callback` once `source` closes.
 * @returns a function that stops waiting. Once nothing waits for `source`
 * anymore, no listener is left on it.
 */
export declare function onceClosed(source: CloseSource, callback: () => void): () => void;
export interface CustomHeader {
    name: string;
    value: string | (() => string);
}
export interface RedirectResponse {
    url: string;
    statusCode?: number;
}
export declare class RouterResponseController {
    private readonly applicationRef;
    private readonly logger;
    private readonly exceptionFilter;
    constructor(applicationRef: HttpServer);
    apply<TInput = any, TResponse = any>(result: TInput, response: TResponse, httpStatusCode?: number): Promise<any>;
    /**
     * Sends a web `Response`, a `ReadableStream` or an async iterable as it is
     * produced, through the adapter's `StreamableFile` path, which gives each of
     * them backpressure, and stops the stream when the client goes away.
     *
     * The headers wait for the first chunk, as exception filters can no longer
     * answer once they are sent. A `Response` is the whole answer: its status and
     * headers win over those set before it (by `@HttpCode()`, `@Header()` or a
     * middleware), which it otherwise leaves in place.
     */
    stream<TResponse = any, TRequest = any>(body: StreamingBody, response: TResponse, request: TRequest, options?: {
        statusCode?: number;
    }): Promise<any>;
    /**
     * Resolves to the first result of the body, or to nothing if the client goes
     * away first: that result may take a while, and may be paid for.
     */
    private readFirst;
    private setWebResponseHeaders;
    redirect<TInput = any, TResponse = any>(resultOrDeferred: TInput, response: TResponse, redirectResponse: RedirectResponse): Promise<any>;
    render<TInput = unknown, TResponse = unknown>(resultOrDeferred: TInput, response: TResponse, template: string): Promise<any>;
    transformToResult(resultOrDeferred: any): Promise<any>;
    getStatusByMethod(requestMethod: RequestMethod): number;
    setHeaders<TResponse = unknown>(response: TResponse, headers: CustomHeader[]): void;
    setStatus<TResponse = unknown>(response: TResponse, statusCode: number): void;
    sse<TInput extends Observable<unknown> = any, TResponse extends WritableHeaderStream = any, TRequest extends IncomingMessage = any>(result: TInput | Promise<TInput>, response: TResponse, request: TRequest, options?: {
        additionalHeaders?: AdditionalHeadersSource;
        statusCode?: StatusCodeSource;
        maxPendingDataLength?: number;
    }): Promise<void>;
    private assertObservable;
    private getOrCreateAbortController;
}
export {};
