import { APIRoute } from 'astro'; import { Kavach } from 'kavachos'; import { McpAuthModule } from 'kavachos/mcp'; interface KavachAstroOptions { /** * The MCP OAuth 2.1 module. When provided, MCP endpoints are enabled. */ mcp?: McpAuthModule; /** * The URL path prefix before the `[...path]` catch-all segment. * Defaults to `/api/kavach`. * * @example `/api/auth/kavach` */ basePath?: string; } interface KavachAstroHandlers { GET: APIRoute; POST: APIRoute; PATCH: APIRoute; DELETE: APIRoute; OPTIONS: APIRoute; ALL: APIRoute; } /** * Create Astro API route handlers for all KavachOS REST API routes. * * Mount in `src/pages/api/kavach/[...path].ts`: * * @example * ```typescript * import { createKavach } from 'kavachos'; * import { kavachAstro } from '@kavachos/astro'; * * const kavach = createKavach({ database: { provider: 'sqlite', url: 'kavach.db' } }); * const handlers = kavachAstro(kavach); * * export const GET = handlers.GET; * export const POST = handlers.POST; * export const PATCH = handlers.PATCH; * export const DELETE = handlers.DELETE; * export const OPTIONS = handlers.OPTIONS; * ``` * * Or use the catch-all handler: * ```typescript * export const ALL = handlers.ALL; * ``` * * With MCP OAuth 2.1: * ```typescript * import { createMcpModule } from 'kavachos/mcp'; * const mcp = createMcpModule({ ... }); * const handlers = kavachAstro(kavach, { mcp }); * ``` */ declare function kavachAstro(kavach: Kavach, options?: KavachAstroOptions): KavachAstroHandlers; export { type KavachAstroHandlers, type KavachAstroOptions, kavachAstro };