UNPKG

@tidecloak/nextjs

Version:
21 lines 819 B
import { NextRequest } from 'next/server'; /** * A route matcher: prefix string, glob string, RegExp, or custom function */ export type RoutePattern = string | RegExp | ((pathname: string, req: NextRequest) => boolean); /** * Map of protected routes: key = path pattern, value = allowed roles */ export type ProtectedRoutesMap = Record<string, string[]>; /** * Convert a single RoutePattern into a test function */ export declare function normalizePattern(pattern: RoutePattern): (pathname: string, req: NextRequest) => boolean; /** * Convert a ProtectedRoutesMap into an array of { test, roles } */ export declare function normalizeProtectedRoutes(map?: ProtectedRoutesMap): Array<{ test: (pathname: string, req: NextRequest) => boolean; roles: string[]; }>; //# sourceMappingURL=routerMatcher.d.ts.map