/** * Object-storage upload plugin (provider-agnostic). * * Adapts any `StorageProvider` (Cloudflare R2 — canonical — Vercel Blob, mock, * or a future backend) to the RevealUI engine's collection upload-adapter * interface, so `apps/admin/revealui.config.ts` stores media through the * configured object-storage backend. Replaces the provider-specific * `vercelBlobStorage` Payload plugin retired in GAP-208 Phase 4. * * The backend is resolved through a lazy `resolveProvider` thunk — invoked * (and memoized) on the first upload/delete, never at config-build time — so a * consumer reading validated config (e.g. `@revealui/config`'s `config.storage`) * does NOT force env validation when the admin config module is imported during * `next build`, tests, or boot. This mirrors `apps/server` `getMediaStorage()`, * which reads `config.storage` lazily per request. * * WARNING: This module is server-only. * Do NOT import in client-side code or edge runtime. */ import type { Plugin } from '../types/index.js'; import type { StorageProvider } from './types.js'; export interface ObjectStorageConfig { /** When `false`, the plugin is a no-op (no upload config applied). Defaults to enabled. */ enabled?: boolean; /** Map of collection slug → whether to attach upload handling. */ collections?: { [key: string]: boolean; }; /** * Lazily resolves the backend the upload adapter writes through. Called once * (memoized) on the first upload/delete — never at config build — so reading * validated config (e.g. `@revealui/config`'s `config.storage`) does not force * env validation at module load. Should throw a clear, actionable error when * no backend is configured (fail-fast; never silently no-op an upload). */ resolveProvider: () => StorageProvider; /** Key prefix for stored objects. Defaults to `'uploads'`. */ prefix?: string; } export declare function objectStorage(config: ObjectStorageConfig): Plugin; //# sourceMappingURL=object-storage.d.ts.map