import { v2 } from 'cloudinary'; import { Adapter, FilesError } from '../index.js'; type CloudinaryResourceType = "image" | "video" | "raw"; type CloudinaryDeliveryType = "upload" | "private" | "authenticated"; interface CloudinaryAdapterOptions { /** * Cloudinary cloud name. Falls back to `CLOUDINARY_CLOUD_NAME` or to the * `cloud_name` parsed out of `CLOUDINARY_URL`. */ cloudName?: string; /** * Cloudinary API key. Falls back to `CLOUDINARY_API_KEY` or the value parsed * out of `CLOUDINARY_URL`. */ apiKey?: string; /** * Cloudinary API secret. Falls back to `CLOUDINARY_API_SECRET` or the value * parsed out of `CLOUDINARY_URL`. Required for `signedUploadUrl()` and for * private/authenticated `url()` signing. */ apiSecret?: string; /** * Cloudinary resource_type bucket. Defaults to `"raw"` — the closest match * to S3-style "arbitrary bytes" storage. Switch to `"image"`/`"video"` if * the bucket holds those types and you want transforms. */ resourceType?: CloudinaryResourceType; /** * Delivery type. Defaults to `"upload"` (public CDN). Use `"private"` or * `"authenticated"` for access-controlled assets — `url()` then mints * short-lived signed URLs. */ type?: CloudinaryDeliveryType; /** * Pre-configured `cloudinary.v2` namespace — escape hatch for callers that * have already called `cloudinary.config()` themselves and want the adapter * to skip its own configuration. When passed, `cloudName`/`apiKey`/ * `apiSecret` are ignored for SDK calls but still needed for * `signedUploadUrl()` (the adapter computes the signature locally). */ client?: typeof v2; /** * Serve assets over HTTPS. Defaults to `true`. */ secure?: boolean; /** * Default expiry, in seconds, for signed URLs returned by `url()` on * private/authenticated assets. Per-call `opts.expiresIn` overrides. * Defaults to 3600. */ signedUrlExpiresIn?: number; } type CloudinaryAdapter = Adapter & { readonly resourceType: CloudinaryResourceType; readonly type: CloudinaryDeliveryType; readonly cloudName: string; }; declare const mapCloudinaryError: (err: unknown) => FilesError; declare const cloudinaryAdapter: (opts?: CloudinaryAdapterOptions) => CloudinaryAdapter; export { type CloudinaryAdapter, type CloudinaryAdapterOptions, type CloudinaryDeliveryType, type CloudinaryResourceType, cloudinaryAdapter as cloudinary, cloudinaryAdapter, mapCloudinaryError };