import { v2 as cloudinary } from "cloudinary"; import type { Adapter } from "../index.js"; import { FilesError } from "../internal/errors.js"; export type CloudinaryResourceType = "image" | "video" | "raw"; export type CloudinaryDeliveryType = "upload" | "private" | "authenticated"; export 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 cloudinary; /** * 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; } export type CloudinaryAdapter = Adapter & { readonly resourceType: CloudinaryResourceType; readonly type: CloudinaryDeliveryType; readonly cloudName: string; }; export declare const mapCloudinaryError: (err: unknown) => FilesError; export declare const cloudinaryAdapter: (opts?: CloudinaryAdapterOptions) => CloudinaryAdapter; export { cloudinaryAdapter as cloudinary }; //# sourceMappingURL=index.d.ts.map