import { getSession } from './session.js'; import { StartAuthJSConfig } from './types.js'; /** * Middleware options */ export interface AuthMiddlewareOptions { /** * Paths to preload session for * Can be an array of paths or `true` to preload for all paths */ paths: Array | boolean; /** * Auth configuration */ config: StartAuthJSConfig; } /** * Middleware context that will receive the session */ export interface MiddlewareContext { request: Request; locals?: { session?: Awaited>; }; } /** * Create auth middleware for TanStack Start * * This middleware can preload the session for specified paths, * making it available in route loaders without additional requests. * * Usage: * ```ts * import { authMiddleware } from 'start-authjs' * * // In your middleware setup * const middleware = authMiddleware({ * paths: ['/dashboard', '/profile', '/settings'], * config: authConfig, * }) * ``` */ export declare function authMiddleware(options: AuthMiddlewareOptions): (context: MiddlewareContext) => Promise;