/** * Storage Upload URL API Route Handler * * Provides an endpoint for generating pre-signed URLs for client-side uploads. * This allows direct-to-storage uploads that bypass serverless platform limits * (e.g., Vercel's 4.5MB request body limit). * * Only available when: * 1. A storage plugin (S3, etc.) is configured for the collection * 2. The collection has `clientUploads: true` in its config * 3. The storage adapter supports pre-signed upload URLs * * @example * ```typescript * // In your Next.js app: app/api/nextly/storage/upload-url/route.ts * export { POST } from 'nextly/api/storage-upload-url'; * ``` * * Adapter-specific failures (no plugin, `clientUploads` not enabled, * Vercel-Blob `handleUpload` style adapters) collapse to canonical * `NextlyError.validation` shapes; per spec ยง13.8 the public messages * carry no collection-slug identifier and the slug lives in `logContext`. * * @module api/storage-upload-url */ /** * POST handler for generating client upload URLs. * * Path: /api/nextly/storage/upload-url * * Request Body (JSON): * - filename: string - Original filename * - mimeType: string - File MIME type * - collection: string - Collection slug * - expiresIn?: number - Optional URL expiry in seconds * * Requires create-media, matching the media-handlers upload route: a * pre-signed URL is a grant to write into the site's storage, so it * carries the same permission as a direct media upload. * * Response Codes: * - 200 OK: Upload URL generated successfully * - 400 Bad Request: Invalid input or client uploads not enabled * - 401 Unauthorized / 403 Forbidden: missing or insufficient credentials * - 500 Internal Server Error: URL generation failed * * Response: bare `ClientUploadData` (respondData); see the * `ClientUploadData` type for the field shape (`uploadUrl`, `path`, * `method`, `headers`, `expiresAt`). */ declare const POST: (request: Request) => Promise; export { POST };