export declare class AbortError extends Error { constructor(signal: AbortSignal); } /** * Abortable async iteration over a {@link ReadableStream}. Reads the source * reader directly and yields each chunk, so the consumer's `for await` drives a * single read loop with no intermediate stream or per-chunk enqueue. * * Unlike `stream.pipeThrough(..., { signal })`, this explicitly cancels the * source reader on abort or early `break`, propagating HTTP-client disconnects * and watchdog timeouts to the backend request instead of only stopping the * local consumer. On abort it throws {@link AbortError}; the lock is released * on completion, abort, throw, or early exit. The source is cancelled only on * abort or early exit — never on natural EOF. */ export declare function abortableSource(stream: ReadableStream, signal?: AbortSignal): AsyncGenerator; /** * Runs a promise-returning function (`pr`). If the given AbortSignal is aborted before or during * execution, the promise is rejected with a standard error. * * @param signal - Optional AbortSignal to cancel the operation * @param pr - Function returning a promise to run * @returns Promise resolving as `pr` would, or rejecting on abort */ export declare function untilAborted(signal: AbortSignal | undefined | null, pr: Promise | (() => Promise)): Promise; /** * Memoizes a function with no arguments, calling it once and caching the result. * * @param fn - Function to be called once * @returns A function that returns the cached result of `fn` */ export declare function once(fn: () => T): () => T;