import type { AdapterCapabilities, ByteRange, DeleteManyResult, DownloadManyResult, ExistsManyResult, HeadManyResult, ListResult, SearchMatch, SignedUpload, StoredFile, UploadManyResult } from "../index.js"; import type { AggregateProgress, FileUploadState } from "./progress.js"; import type { Transport } from "./transport.js"; export interface FilesClientConfig { /** Gateway endpoint. Default `/api/files`. */ endpoint?: string; /** Static or lazily-resolved headers (e.g. an auth token) sent on every gateway call. */ headers?: HeadersInit | (() => HeadersInit | Promise); /** Default fan-out for bulk ops. Default 4. */ concurrency?: number; /** Upload transport seam (test injection). Defaults to XHR (progress) with a fetch fallback. */ transport?: Transport; /** `fetch` implementation for JSON verbs + download (test/SSR injection). */ fetchImpl?: typeof fetch; } export interface CallOptions { signal?: AbortSignal; } export interface DownloadCallOptions extends CallOptions { range?: ByteRange; as?: "blob" | "stream"; } export interface UrlCallOptions extends CallOptions { expiresIn?: number; responseContentDisposition?: string; } export interface ListCallOptions extends CallOptions { prefix?: string; cursor?: string; limit?: number; delimiter?: string; } export interface SearchCallOptions extends CallOptions { match?: SearchMatch; prefix?: string; limit?: number; maxResults?: number; caseInsensitive?: boolean; } export interface SignUploadCallOptions extends CallOptions { expiresIn: number; contentType?: string; maxSize?: number; minSize?: number; } export interface UploadCallOptions extends CallOptions { contentType?: string; /** Presign expiry for the keyless path, seconds. */ expiresIn?: number; onProgress?: (progress: AggregateProgress, perFile: readonly FileUploadState[]) => void; } export interface BulkCallOptions extends CallOptions { concurrency?: number; stopOnError?: boolean; } export interface UploadOutcome { key: string; size: number; type: string; etag?: string; lastModified?: number; } /** * A React Native file reference — the `{ uri, name, type }` shape Expo's * pickers return and React Native's `FormData` streams from disk. Pass one * anywhere an upload body goes; on a presigned-POST target it rides the form * untouched (native streaming), on every other path the client resolves the * `uri` to a Blob first. Only meaningful in React Native — on the web, pass a * `Blob`/`File` instead. */ export interface NativeFileRef { uri: string; name?: string; type?: string; /** Bytes, when the picker reports it; informs presign info and progress totals. */ size?: number; } export declare const isNativeFileRef: (body: unknown) => body is NativeFileRef; export type UploadBody = Blob | ArrayBuffer | ArrayBufferView | string | NativeFileRef; export interface UploadManyClientItem { key: string; body: UploadBody; contentType?: string; } /** * A saved version returned by `versions()` (needs the `versioning()` plugin on * the server). Pass `versionId` back to `restoreVersion()`. */ export interface FileVersion { versionId: string; size: number; lastModified: number; etag?: string; } /** * A trashed object returned by `trashed()` (needs the `softDelete()` plugin on * the server). `key` is the original key — pass it to `restoreTrashed()` / * `purge()`. */ export interface TrashedFile { key: string; size: number; lastModified?: number; etag?: string; } export interface FilesClient { upload: { (file: Blob | NativeFileRef, opts?: UploadCallOptions): Promise; (key: string, body: UploadBody, opts?: UploadCallOptions): Promise; (items: UploadManyClientItem[], opts?: BulkCallOptions): Promise; }; download: { (key: string, opts?: DownloadCallOptions): Promise; (keys: string[], opts?: BulkCallOptions & { as?: "blob" | "stream"; }): Promise; }; head: { (key: string, opts?: CallOptions): Promise; (keys: string[], opts?: BulkCallOptions): Promise; }; exists: { (key: string, opts?: CallOptions): Promise; (keys: string[], opts?: BulkCallOptions): Promise; }; delete: { (key: string, opts?: CallOptions): Promise; (keys: string[], opts?: BulkCallOptions): Promise; }; copy: (from: string, to: string, opts?: CallOptions) => Promise; move: (from: string, to: string, opts?: CallOptions) => Promise; url: (key: string, opts?: UrlCallOptions) => Promise; signedUploadUrl: (key: string, opts: SignUploadCallOptions) => Promise; list: (opts?: ListCallOptions) => Promise; listAll: (opts?: ListCallOptions) => AsyncGenerator; search: (pattern: string | RegExp, opts?: SearchCallOptions) => AsyncGenerator; capabilities: (opts?: CallOptions) => Promise; versions: (key: string, opts?: CallOptions) => Promise; restoreVersion: (key: string, versionId?: string, opts?: CallOptions) => Promise; trashed: (opts?: CallOptions) => Promise; restoreTrashed: (key: string, opts?: CallOptions) => Promise; purge: (key?: string, opts?: CallOptions) => Promise; } //# sourceMappingURL=types.d.ts.map