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 { v2 } from 'cloudinary'; import 'node:stream'; import 'node:timers'; import 'node:crypto'; import 'node:http'; import 'lru-cache'; declare class CloudinaryFile extends File { bucket?: string; path?: string; publicUrl?: string; } declare class CloudinaryMetaStorage extends LocalMetaStorage { constructor(config?: LocalMetaStorageOptions); } interface CloudinaryStorageOptions extends BaseStorageOptions { /** * Cloudinary API key. Ignored when `client` is supplied. Falls back to * `CLOUDINARY_API_KEY`, or the credentials encoded in `CLOUDINARY_URL`. */ apiKey?: string; /** * Cloudinary API secret. Ignored when `client` is supplied. Falls back to * `CLOUDINARY_API_SECRET`, or the credentials encoded in `CLOUDINARY_URL`. */ apiSecret?: string; /** * Pre-configured `cloudinary` namespace (the `v2` export). Mutually * exclusive with `cloudName` + `apiKey` + `apiSecret`. When supplied the * adapter skips `cloudinary.config()` and uses the instance as-is. */ client?: typeof v2; /** * Cloudinary cloud name. Ignored when `client` is supplied. Falls back to * `CLOUDINARY_CLOUD_NAME`, or the host segment of `CLOUDINARY_URL`. */ cloudName?: string; /** * Default expiry, in seconds, for `getReadUrl` signed URLs on private or * authenticated assets. Defaults to 3600 (1 hour). */ defaultUrlExpiresIn?: number; /** * Configure metafiles storage. Used for TUS-style resumable upload * bookkeeping. Defaults to {@link LocalMetaStorage} under the OS tmp * directory. */ metaStorageConfig?: LocalMetaStorageOptions; /** * Cloudinary resource type. Use `"raw"` for arbitrary files, `"image"` or * `"video"` for media that benefits from transformations. Defaults to * `"raw"`. */ resourceType?: "image" | "raw" | "video"; /** * Generate `https://` delivery URLs. Defaults to `true`. */ secure?: boolean; /** * Cloudinary delivery type. `"private"` and `"authenticated"` require a * signed URL for delivery. Defaults to `"upload"`. */ type?: "authenticated" | "private" | "upload"; } /** * Cloudinary Storage backend. * * Single-shot uploads only — the adapter buffers the part stream and uploads * it in one request via `upload_stream`. Cloudinary has no simple presigned * `PUT` endpoint, so `getUploadUrl` is not implemented (the base default * throws `METHOD_NOT_ALLOWED`). * @example * ```ts * import { CloudinaryStorage } from "@visulima/storage/provider/cloudinary"; * * const storage = new CloudinaryStorage({ * cloudName: process.env.CLOUDINARY_CLOUD_NAME, * apiKey: process.env.CLOUDINARY_API_KEY, * apiSecret: process.env.CLOUDINARY_API_SECRET, * }); * ``` * @remarks * - ⚠️ 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 CloudinaryStorage extends BaseStorage { static override readonly name: string; override checksumTypes: string[]; protected meta: MetaStorage; private readonly client; private readonly defaultUrlExpiresIn; private readonly deliveryType; private readonly resourceType; private readonly secure; constructor(config: CloudinaryStorageOptions); override get raw(): typeof v2; create(config: FileInit, _options?: OperationOptions): Promise; write(part: CloudinaryFile | FilePart | FileQuery, options?: OperationOptions): Promise; delete({ id }: FileQuery, options?: OperationOptions): Promise; override exists({ 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; private uploadBuffer; private getMetaSafe; private internalOnComplete; } export { CloudinaryFile, CloudinaryMetaStorage, CloudinaryStorage, type CloudinaryStorageOptions };