import { z } from 'zod'; import { Transport } from './transport'; /** * The set of body types accepted by FileTransport.upload. A Blob, which a File is, * names bytes the engine owns and can send straight from disk. A ReadableStream * produces bytes on demand, and reaches the wire unbuffered only where the engine sends * streaming request bodies. Bytes are sent as-is. */ export type UploadBody = ReadableStream | Blob | Uint8Array; /** * The wire encodings a FileTransport can transfer. ZIP carries a flat archive of named * files; JSON carries a single value. */ export type FileEncoding = "JSON" | "ZIP"; /** * Options shared by FileTransport.upload and FileTransport.download. Carries the wire * encoding of the transferred bytes and is the extension point for any future * per-transfer settings. */ export interface FileOptions

{ /** * The wire encoding of the transferred bytes. On upload it describes the request body * and is sent as Content-Type; the body has a single representation, so pass a single * encoding. */ encoding: FileEncoding; /** * Request params carrying per-transfer metadata (e.g. the source file's name) * out-of-band, since the body is the raw file bytes. They are validated against * paramsSchema and JSON-encoded onto a single freighterctx-prefixed query parameter. */ params?: z.input

; /** The schema to validate and encode params with. */ paramsSchema?: P; } /** * FileTransport streams request and response bodies to and from a server when a payload * could be too large to buffer in memory. Unlike UnaryClient, which encodes and decodes * a typed payload on each side, FileTransport leaves one side of the exchange as a raw * byte stream: upload streams the request body up, and download streams the response * body back. It is environment-agnostic — the byte stream is a standard Web * ReadableStream, which exists in browsers, Node 18+, and Tauri webviews alike. */ export interface FileTransport extends Transport { /** * Streams body to target as the request body and decodes the typed response. * @param target - The target route to send the request to. * @param body - The request body. A Blob never enters client memory; a ReadableStream * reaches the wire unbuffered only where the engine sends streaming request bodies. * @param options - The transfer options, including the encoding of body. * @param resSchema - The schema to validate the decoded response against. * @returns the decoded response. * @throws Unreachable: if the target cannot be reached. * @throws Error: if the server returns an error. */ upload: (target: string, body: UploadBody, options: FileOptions

, resSchema: RS) => Promise>; /** * Sends the typed request req to target and returns the response body as a byte * stream the caller can pipe wherever it likes (a file, a download, an in-memory * sink) without buffering the whole payload. * @param reqSchema - The schema to validate and encode the request with. * @param options - The transfer options, including the desired response encoding. * @returns the response body as a ReadableStream of bytes. * @throws Unreachable: if the target cannot be reached. * @throws Error: if the server returns an error. */ download: (target: string, req: z.input | z.infer, reqSchema: RQ, options: FileOptions

) => Promise>; } //# sourceMappingURL=file.d.ts.map