export { withContext, getPendingContext }; export type { ClientCallContext, StreamTransport }; import type { StreamTransport, ChannelTransports } from '../wire-protocol/constants.js'; type StreamCallContext = { /** Streamed-value transport — overrides `config.stream.transport` for this call. */ transport?: StreamTransport; }; type ChannelCallContext = { /** Channel transports — overrides `config.channel.transports` for this call. */ transports?: ChannelTransports; /** Cache key — calls sharing it share a `ClientConnection`; distinct keys are isolated. */ connectionKey?: string; /** How long (ms) to keep the underlying transport alive after all channels close. Default: 60 000. Pass 0 to dispose immediately. */ idleTimeout?: number; }; /** Per-call context options for the HTTP transport layer. */ type ClientCallContext = { /** AbortSignal to cancel the telefunc call. */ signal?: AbortSignal; /** Additional HTTP headers for this call. */ headers?: Record; /** Override `config.telefuncUrl` for this call and any of its channels. */ telefuncUrl?: string; /** Streamed-value transport overrides for this call. */ stream?: StreamCallContext; /** Channel transport overrides for this call. */ channel?: ChannelCallContext; /** Per-call extension data, keyed by extension name. */ extensions?: Record>; }; /** Wrap a telefunc function with per-call context (signal, headers). * * ```ts * import { withContext } from 'telefunc/client' * const call = withContext(onLoadTodoItem, { signal, headers: { Priority: 'u=0' } }) * const res = await call(id) * ``` */ declare function withContext any>(telefunc: F, context: ClientCallContext): F; declare function getPendingContext(): ClientCallContext | null;