/** * Pages Router API Handler * * Handles Pages Router API routes (under /api/ directory). * Supports optional cache injection for testing. * * @module server/handlers/request/api/pages-api-handler */ import { APIRouteHandler } from "../../../../routing/index.js"; import type { HandlerContext } from "../../types.js"; export interface HandlerCache { get(key: string): T | undefined; set(key: string, value: T): void; delete(key: string): boolean; clear(): void; entries(): IterableIterator<[string, T]>; values(): IterableIterator; } export declare class LRUHandlerCache implements HandlerCache { private readonly lru; private suppressEvictionCleanup; constructor(options?: { maxEntries?: number; onEvict?: (value: T) => void; }); get(key: string): T | undefined; set(key: string, value: T): void; delete(key: string): boolean; clear(): void; entries(): IterableIterator<[string, T]>; values(): IterableIterator; } export declare function __injectCacheForTests(cache: HandlerCache> | null): void; interface ApiHandlerOptions { sourceSnapshotReady?: boolean; } export declare function getApiHandler(ctx: HandlerContext): Promise; /** * Use an API handler while holding a lease that defers cache-eviction cleanup. * The lease begins before the handler promise is awaited, closing the gap * between a cache lookup and APIRouteHandler.handle() registering the request. */ export declare function withApiHandler(ctx: HandlerContext, use: (handler: APIRouteHandler) => T | Promise, options?: ApiHandlerOptions): Promise; export declare function resetApiHandler(projectDir?: string): Promise; /** * Reset cached API handlers for a specific project slug. * * In proxy/production mode the cache key includes the project slug and release * context, so we can't reuse `resetApiHandler(projectDir)`. Instead we iterate * all entries and destroy those scoped to the project slug. */ export declare function resetApiHandlerForProject(projectSlug: string): Promise; export {}; //# sourceMappingURL=pages-api-handler.d.ts.map