/** * Collection Schema Detail API Route Handlers for Next.js * * These route handlers can be re-exported in your Next.js application to provide * individual collection management endpoints at /api/collections/schema/[slug]. * * Services are auto-initialized on first request using environment variables: * - DB_DIALECT: Database dialect ("postgresql" | "mysql" | "sqlite") * - DATABASE_URL: Database connection string * * Locked code-first collections surface as canonical FORBIDDEN: the registry * throws `NextlyError.forbidden` with the `collection-locked` reason in * `logContext`. * * @example * ```typescript * // In your Next.js app: app/api/collections/schema/[slug]/route.ts * export { GET, PATCH, DELETE } from 'nextly/api/collections-schema-detail'; * ``` * * @module api/collections-schema-detail */ /** * Context object for dynamic route handlers. * Next.js 15+ requires params to be a Promise. */ interface RouteContext { params: Promise<{ slug: string; }>; } /** * GET handler for retrieving a single collection by slug. * * Requires a verified session or API key with read access to the * collection, matching the dispatcher's `getCollection` authorization. The * registry throws `NOT_FOUND` if no collection matches the slug. */ declare const GET: (request: Request, context: RouteContext) => Promise; /** * PATCH handler for updating a collection. * * Requires `manage-settings` (or super-admin). The registry throws * `NextlyError.forbidden` with `reason: "collection-locked"` if the * collection is locked (code-first collections cannot be modified via API). */ declare const PATCH: (request: Request, context: RouteContext) => Promise; /** * DELETE handler for removing a collection. * * Requires `manage-settings` (or super-admin). The registry throws * `NextlyError.forbidden` with `reason: "collection-locked-delete"` if the * collection is locked (code-first collections cannot be deleted via API). */ declare const DELETE: (request: Request, context: RouteContext) => Promise; export { DELETE, GET, PATCH };