import { UTApi } from 'uploadthing/server'; import { Adapter } from '../index.js'; interface UploadThingAdapterOptions { /** * UploadThing token. Falls back to `process.env.UPLOADTHING_TOKEN`. * * Tokens are base64-encoded JSON of the form * `{ apiKey, appId, regions: string[] }` — the adapter decodes them at * construction time so it can compute the public CDN host * (`{appId}.ufs.sh`) and sign UFS presigned PUT URLs without an API * round-trip. A token that doesn't decode to that shape throws * immediately rather than failing later on the first call. */ token?: string; /** * ACL applied to uploads. Drives both the upload-time ACL and `url()` * behavior — `"public-read"` returns the permanent CDN URL, `"private"` * mints a short-lived signed URL via `generateSignedURL`. Defaults to * `"public-read"`, which matches UploadThing's most common use case. * * Fixed at construction so a single `Files` instance is unambiguously * one or the other. If you need both, instantiate two adapters. */ acl?: "public-read" | "private"; /** * UploadThing file-router slug. Required only by `signedUploadUrl()`, * which embeds it as `x-ut-slug` on the ingest URL — UploadThing * validates the upload against the route's config (allowed file * types/sizes). Server-side `upload()` does not need it. */ slug?: string; /** * Default expiry (seconds) for signed download URLs and for `url()` * when `acl` is `"private"`. UploadThing caps signed URLs at 7 days. * Defaults to 3600 (1 hour). */ defaultUrlExpiresIn?: number; /** * Timeout in milliseconds for the HEAD/GET fallbacks that `head()`, * `download()`, and lazy bodies returned from `list()` issue against * the file URL. A hung CDN response would otherwise leak a fetch that * never resolves. Defaults to 300_000 (5 minutes). Pass `0` to * disable. */ downloadTimeoutMs?: number; /** * Override the region alias used to construct the ingest URL for * `signedUploadUrl()`. Defaults to the first region in the decoded * token, or `"sea1"` if none is present. */ region?: string; } type UploadThingClient = UTApi; type UploadThingAdapter = Adapter; declare const uploadthing: (opts?: UploadThingAdapterOptions) => UploadThingAdapter; export { type UploadThingAdapter, type UploadThingAdapterOptions, type UploadThingClient, uploadthing };