import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, d as FileInit, O as OperationOptions, e as FilePart, f as FileQuery, g as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-C9EdfTf1.js"; import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-CYWYyCUo.js"; import { Dropbox } from 'dropbox'; import 'node:stream'; import 'node:timers'; import 'node:crypto'; import 'node:http'; import 'lru-cache'; declare class DropboxFile extends File { path?: string; publicUrl?: string; rev?: string; } declare class DropboxMetaStorage extends LocalMetaStorage { constructor(config?: LocalMetaStorageOptions); } interface DropboxStorageOptions extends BaseStorageOptions { /** * 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); /** * Dropbox app key (client_id). Required when `refreshToken` is set. */ appKey?: string; /** * Dropbox app secret (client_secret). Required for confidential clients. */ appSecret?: string; /** * Pre-built `Dropbox` client. Escape hatch for callers that already wire * auth themselves (e.g. with team-space `pathRoot`, custom headers, or a * shared `DropboxAuth`). */ client?: Dropbox; /** * Default expiry, in seconds, for temporary download links from * `getReadUrl()`. Capped at 14400 (4 hours, the Dropbox maximum). * Defaults to 3600 (1 hour). */ defaultUrlExpiresIn?: number; /** * Configure metafiles storage. Defaults to local tmp directory. */ metaStorageConfig?: LocalMetaStorageOptions; /** * When `true`, `getReadUrl` creates a public shared link instead of a * temporary 4-hour link. The link is rewritten to `?dl=1` so it serves * raw bytes directly. */ publicByDefault?: boolean; /** * OAuth2 refresh token. When set, the adapter exchanges it for fresh * access tokens at `https://api.dropboxapi.com/oauth2/token` and caches * them until ~60s before expiry. Requires `appKey` (PKCE) or `appKey` + * `appSecret` (confidential client). */ refreshToken?: string; /** * Logical "bucket root" — virtual keys live under this folder path. Must * already exist; the adapter does not create folders. Path is normalized: * leading slash is added, trailing slashes stripped. Defaults to account * root. */ rootFolderPath?: string; } /** * Dropbox storage backend. * * Routes virtual keys onto Dropbox paths under `rootFolderPath`. Uploads use * the simple `filesUpload` endpoint up to 150 MB and switch to chunked * upload sessions above that threshold. * * **Auth precedence**: * 1. `client` (pre-built `Dropbox`) * 2. `accessToken` (string or `() => string | Promise<string>`) * 3. `refreshToken` + `appKey` (+ optional `appSecret`) * 4. Env fallback: `DROPBOX_ACCESS_TOKEN`, or `DROPBOX_REFRESH_TOKEN` + * `DROPBOX_APP_KEY` (+ optional `DROPBOX_APP_SECRET`) * * **Limitations**: * - `metadata` and `cacheControl` are not supported (Dropbox files have no * native arbitrary-metadata field, and no HTTP cache-header overrides). * - `getUploadUrl` is not supported — Dropbox's `files/get_temporary_upload_link` * requires a `POST` with raw body, which doesn't fit a presigned-PUT contract. * - `responseContentDisposition` is not supported on signed URLs. * - ⚠️ Per-operation `signal`/`timeout` are best-effort: the underlying SDK does not support request cancellation, so an in-flight call may complete server-side even after abort. `retries` is honored. */ declare class DropboxStorage extends BaseStorage { static override readonly name: string; override checksumTypes: string[]; protected meta: MetaStorage; private readonly authHandle; private readonly client; private readonly defaultUrlExpiresIn; private readonly publicByDefault; private readonly rootFolderPath; constructor(config: DropboxStorageOptions); override get raw(): Dropbox; create(config: FileInit, _options?: OperationOptions): Promise; write(part: FilePart | FileQuery | DropboxFile, options?: OperationOptions): Promise; delete({ id }: FileQuery, options?: OperationOptions): Promise; get({ id }: FileQuery, options?: OperationOptions): Promise; copy(name: string, destination: string, options?: OperationOptions & { storageClass?: string; }): Promise; move(name: string, destination: string, options?: OperationOptions): Promise; override list(limit?: number, options?: OperationOptions): Promise; override getReadUrl(key: string, options?: { expiresIn?: number; responseContentDisposition?: string; responseContentType?: string; }): Promise; override getUploadUrl(_key: string, _options?: { contentLength?: number; contentType?: string; expiresIn?: number; }): Promise; private keyToPath; private pathToKey; private uploadSimple; private uploadSession; private createPublicSharedLink; private internalOnComplete; } export { DropboxFile, DropboxMetaStorage, DropboxStorage, type DropboxStorageOptions };