import { ObservabilityOptions } from '../types'; type NextRequest = { method?: string; url?: string; headers: Record; socket?: { remoteAddress?: string; }; }; type NextResponse = { statusCode: number; setHeader: (key: string, value: string) => void; end: (...args: any[]) => void; }; type NextHandler = (req: NextRequest, res: NextResponse) => void | Promise; /** * Wraps a Next.js **Pages Router** API route handler with observability. * * For **App Router** route handlers (`app/api/.../route.ts`), use * {@link withAppRouterObservability} instead — App Router handlers receive a * Fetch API `Request` and return a `Response`, not the Node.js `(req, res)` * pair this function expects. * * @example * // pages/api/users.ts * import { withObservability } from 'auto-api-observe'; * export default withObservability(async (req, res) => { ... }, { apiKey: process.env.APILENS_KEY }); */ export declare function withObservability(handler: NextHandler, options?: ObservabilityOptions): NextHandler; type AppRouteContext = { params?: unknown; }; type AppRouteHandler = (request: Request, context: AppRouteContext) => Response | Promise; /** * Wraps a Next.js **App Router** route handler (`app/api/.../route.ts`) with * observability. For the legacy **Pages Router** (`pages/api/*.ts`), use * {@link withObservability} instead. * * @example * // app/api/users/route.ts * import { withAppRouterObservability } from 'auto-api-observe'; * export const GET = withAppRouterObservability(async (request) => { * return Response.json({ users: [] }); * }, { apiKey: process.env.APILENS_KEY }); */ export declare function withAppRouterObservability(handler: AppRouteHandler, options?: ObservabilityOptions): AppRouteHandler; export {}; //# sourceMappingURL=nextjs.d.ts.map