/** * Field Groups API Route Handlers for Next.js * * These route handlers can be re-exported in your Next.js application to provide * component definition management endpoints at /api/field-groups. * * Services are auto-initialized on first request using environment variables: * - DB_DIALECT: Database dialect ("postgresql" | "mysql" | "sqlite") * - DATABASE_URL: Database connection string * * @example * ```typescript * // In your Next.js app: app/api/field-groups/route.ts * export { GET, POST } from 'nextly/api/field-groups'; * ``` * * @module api/field-groups */ /** * GET handler for listing components with pagination and filters. * * Requires read-settings (or manage-settings), matching the dispatcher's * components authorization — component definitions are builder-surface * metadata, not public content. * * Query Parameters: * - source: Filter by source type ("code" | "ui") * - search: Search query for slug and label * - limit: Maximum results (default: 50) * - offset: Number of results to skip (default: 0) * * Response Codes: * - 200 OK: Components list retrieved successfully * - 500 Internal Server Error: Failed to fetch components * * @param request - Next.js Request object * @returns Response with JSON component list and pagination meta * * @example * ```bash * curl "http://localhost:3000/api/field-groups?source=ui&limit=10" * # => {"items":[...],"meta":{"total":5,"page":1,"limit":10,"totalPages":1,"hasNext":false,"hasPrev":false}} * ``` */ declare const GET: (request: Request) => Promise; /** * POST handler for creating a new UI component. * * Requires create-settings (or manage-settings), matching the dispatcher's * components authorization. Creates a new component with source="ui" and * locked=false. * * Request Body: * - slug: Unique identifier (lowercase, letters/numbers/hyphens) * - label: Display name for the component * - description: Optional description * - fields: Array of field configurations * - admin: Optional admin UI configuration (category, icon, hidden, description, imageURL) * * Response Codes: * - 201 Created: Field group created successfully * - 400 Bad Request: Invalid input * - 401 Unauthorized: Authentication required * - 409 Conflict: Component with slug already exists * - 500 Internal Server Error: Creation failed * * @param request - Next.js Request object with JSON body * @returns Response with JSON created component */ declare const POST: (request: Request) => Promise; export { GET, POST };