import type { FileRouteMiddleware, FileRouteMiddlewareContext, RequestLocals } from '../../../types/public-types.js'; import type { PageCacheService } from '../../../services/cache/page-cache-service.js'; export declare const FILE_ROUTE_MIDDLEWARE_PIPELINE_ERRORS: { readonly middlewareRequiresDynamic: (filePath: string) => string; }; /** * Executes middleware for file-based page routes. * * This pipeline owns the middleware-specific rules that are distinct from route * matching and rendering, including request-local storage, the middleware * execution context, and the invariant that page middleware only runs for * request-time dynamic rendering. */ export declare class FileRouteMiddlewarePipeline { private cacheService; constructor(cacheService: PageCacheService | null); /** * Enforces the current middleware contract for file-routed pages. * * Middleware depends on request-scoped locals and therefore must not run when * the page is treated as statically cacheable. * * @param input Middleware list, effective cache strategy, and page path. * @throws LocalsAccessError When middleware is configured for a non-dynamic page. */ assertValidConfiguration(input: { middleware: FileRouteMiddleware[]; pageCacheStrategy: 'static' | 'dynamic' | { revalidate: number; tags?: string[]; }; filePath: string; }): void; /** * Creates the request-scoped middleware context used by page middleware. * * The context intentionally omits `render()` and `renderPartial()` because * rendering is owned by the page route pipeline, not by middleware stages. * * @param input Request details and the mutable locals store. * @returns Middleware execution context. */ createContext(input: { request: Request; params: Record; locals: RequestLocals; }): FileRouteMiddlewareContext; /** * Runs the middleware chain and eventually delegates to the render callback. * * Middleware may short-circuit by returning a response directly. If the chain * completes, the supplied `renderResponse` callback is executed exactly once. * * @param input Middleware context, chain, and terminal render callback. * @returns Response from middleware or final render stage. */ run(input: { middleware: FileRouteMiddleware[]; context: FileRouteMiddlewareContext; renderResponse: () => Promise; }): Promise; }