export { runTelefunc }; export type { HttpResponse }; import { Telefunc } from './context/getContext.js'; import type { Readable as StreamReadableNode, Writable as StreamWritableNode } from 'node:stream'; type StreamWritableWeb = WritableStream; type StreamReadableWeb = ReadableStream; /** The HTTP Response of a telefunction remote call HTTP Request */ type HttpResponse = { /** HTTP Response Status Code */ statusCode: 200 | 400 | 403 | 422 | 500; /** HTTP Response Body (only for non-streaming responses, throws for streaming — use `pipe()` or `getReadableWebStream()` instead) */ body: string; /** HTTP Response Headers */ headers: [string, string][]; /** Pipe the response body to a Node.js or Web writable stream. The returned * promise resolves once the body has been fully written (for streaming * responses, that's when the underlying stream closes), so callers can * hold their handler open until the response is genuinely finished. */ pipe: (writable: StreamWritableWeb | StreamWritableNode) => Promise; /** Get the response body as a Web ReadableStream */ getReadableWebStream: () => StreamReadableWeb; /** Get the response body as a Node.js Readable stream */ getReadableNodeStream: () => StreamReadableNode; /** Get the full response body as a string (awaits streaming if needed) */ getBody: () => Promise; /** @deprecated Use `headers` instead */ contentType: ContentType; /** @deprecated Unused, always null */ etag: string | null; /** Error thrown by your telefunction */ err?: unknown; }; type ContentType = 'text/plain' | 'application/octet-stream' | 'text/event-stream'; declare function runTelefunc(httpRequestResolved: Parameters[0]): Promise; declare function runTelefunc_({ request, readable, context, }: { request: Request; readable?: StreamReadableNode; context?: Telefunc.Context; }): Promise;