import type { ModuleRegistry } from '../runtime/registry.js'; type PermissionChecker = (permission: string) => Promise<{ error: Response | null; session: unknown; }>; export interface CatchAllOptions { /** * Permission checker from the host (e.g. checkPermission from @/lib/authCheck). * When provided, routes that declare a `permission` are protected automatically. * The handler is called ONLY if the permission check passes. */ checkPermission?: PermissionChecker; } /** * Create a catch-all API route handler that delegates to registered module routes. * * Usage in host's src/app/api/[...path]/route.ts: * * import { getRegistry } from '@/modules' * import { createCatchAllHandler } from '@mostajs/socle/helpers/route-handler' * import { checkPermission } from '@/lib/authCheck' * const handler = createCatchAllHandler(() => getRegistry(), { checkPermission }) * export const GET = handler('GET') * export const POST = handler('POST') * export const PUT = handler('PUT') * export const DELETE = handler('DELETE') * export const PATCH = handler('PATCH') */ export declare function createCatchAllHandler(getRegistry: () => Promise | ModuleRegistry, options?: CatchAllOptions): (method: string) => (req: Request, context: { params: Promise<{ path: string[]; }> | { path: string[]; }; }) => Promise; export {}; //# sourceMappingURL=route-handler.d.ts.map