import type { Files } from "../../index.js"; import type { ResultModel } from "../router-core/web.js"; import type { Scope } from "./authorize.js"; import type { ClientFileInfo } from "./protocol.js"; import type { UploadLifecycle } from "./upload-complete.js"; export interface UploadConfig { files: Files; secret: string; defaultExpiresIn: number; /** * How long after an upload token expires `complete` still redeems it, ms. * The token gates when the bytes may *start* landing; a large body can * finish after that, and the client completes only once it has. */ completeGraceMs: number; /** Most presign targets signed at once. */ maxConcurrency: number; /** Key prefixes plugins reserve on `files` — never minted into. */ reserved: readonly string[]; /** The router's `onError`, for failures whose message can't reach the client. */ reportError: (error: unknown) => void; maxUploadSize?: number; proxyUrl: (token: string) => string; /** The request's canonical non-routing query — see {@link boundQuery}. */ boundQuery: string; /** The request URL's path — a token only redeems at the endpoint that minted it. */ boundPath: string; /** * The request URL's origin (scheme + host, as the gateway sees it). A * per-request `files` factory can pick the instance from the host, so a * token minted on one host must not redeem on another. */ boundOrigin: string; now: () => number; /** The request's abort signal, threaded into every storage call. */ signal: AbortSignal; /** `onUploadComplete` and its options, when configured. */ lifecycle?: UploadLifecycle; } /** * The query an upload token is bound to: every pair except the gateway's own * routing params, sorted into a canonical string. A per-request `files` * factory resolves the instance from this query (`?bucket=`), so a token * minted under one query must not be redeemable under another — otherwise a * caller could presign where uploads are allowed and PUT the bytes into an * instance where they are not. Empty for a bare endpoint. */ export declare const boundQuery: (query: URLSearchParams) => string; /** * The size an upload is held to: what the client declared (and `authorize` * approved), capped by the router's `maxUploadSize` — either one alone when * the other is absent. */ export declare const clampMaxSize: (requested: number | undefined, maxUploadSize: number | undefined) => number | undefined; export declare const handlePresign: (cfg: UploadConfig, files: ClientFileInfo[], requestedExpiresIn: number | undefined, scope: Scope, unscope: (key: string) => string) => Promise; export declare const handleComplete: (cfg: UploadConfig, completions: { id: string; key: string; }[], scope: Scope, unscope: (key: string) => string) => Promise; export declare const handleProxyUpload: (cfg: UploadConfig, token: string | null, body: ReadableStream | null, contentLength: number | undefined) => Promise; export declare const handleExplicitUpload: (cfg: UploadConfig, storageKey: string, unscopedKey: string, body: ReadableStream | null, contentType: string | null, contentLength: number | undefined) => Promise; //# sourceMappingURL=upload.d.ts.map