import { Dropbox } from 'dropbox'; import { Adapter, FilesError } from '../index.js'; interface DropboxAdapterOptions { /** * Logical "bucket root" — virtual keys live under this folder path on the * Dropbox account. Must already exist; the adapter does not create folders. * Path is normalized: leading slash is added, trailing slashes stripped. * Defaults to the account root. */ rootFolderPath?: string; /** * When `true`, `upload()` also creates a public shared link (anyone with * the link can view) and `url()` returns that link's `url` (rewritten to * `?dl=1` for direct download). When `false` (default), `url()` mints a * 4-hour temporary link via `filesGetTemporaryLink`. * * **Plan policy note:** public shared links may be restricted on Dropbox * Business teams; the adapter surfaces Dropbox's `access_denied` error * unmodified in that case. */ publicByDefault?: boolean; /** * Origin used to build URLs from `url()`. When set, `url(key)` returns * `${publicBaseUrl}/${key}` and skips both signing and shared-link creation. * Useful when a CDN sits in front of pre-shared Dropbox links. */ publicBaseUrl?: string; /** * Default expiry, in seconds, for the temporary download links returned by * `url()` when neither `publicByDefault` nor `publicBaseUrl` is set. * Capped at 14400 (4 hours, the Dropbox maximum). Defaults to 3600. */ defaultUrlExpiresIn?: number; /** * Pre-built `Dropbox` client — escape hatch for callers that already wire * auth themselves (e.g. with team-space `pathRoot`, custom headers, or * shared `DropboxAuth`). */ client?: Dropbox; /** * Static or dynamic access token. Pass a string for a one-shot token, or * a function returning a fresh token on each call. The adapter does not * cache the result of a callable — your callable is responsible for * caching/refresh. */ accessToken?: string | (() => string | Promise); /** * OAuth2 refresh-token flow. Tokens are exchanged at * `https://api.dropboxapi.com/oauth2/token` and cached until ~60s before * expiry. `appSecret` is required for confidential clients (server-side * apps); PKCE-only public clients should pass `appKey` alone. */ refreshToken?: string; /** Dropbox app key (client_id). Required when `refreshToken` is set. */ appKey?: string; /** Dropbox app secret (client_secret). Required for confidential clients. */ appSecret?: string; } type DropboxClient = Dropbox; type DropboxAdapter = Adapter & { readonly rootFolderPath: string; }; declare const mapDropboxError: (err: unknown) => FilesError; declare const dropbox: (opts: DropboxAdapterOptions) => DropboxAdapter; export { type DropboxAdapter, type DropboxAdapterOptions, type DropboxClient, dropbox, mapDropboxError };