import type { Spanwise } from "../client.js"; /** * Generic handler type using Web standard Request/Response. * Works with Next.js App Router, Bun, Deno, Cloudflare Workers, etc. */ export type Handler = (request: Request) => T | Promise; export type WrapHandlerOptions = { /** Override the span name (default: "METHOD /path") */ name?: string; /** Route pattern for http.route attribute (e.g., "/api/users/:id") */ route?: string; }; /** * Creates a handler wrapper for tracing HTTP handlers. * * Works with any framework using Web standard Request/Response: * - Next.js App Router * - Bun.serve * - Deno.serve * - Cloudflare Workers * * @example * ```ts * const wrapHandler = createHandlerWrapper(spanwise) * * // Next.js App Router * export const GET = wrapHandler(async (request) => { * return Response.json({ ok: true }) * }, { route: '/api/users/[id]' }) * * // Bun * Bun.serve({ * fetch: wrapHandler(async (request) => { * return new Response('Hello') * }) * }) * ``` */ export declare function createHandlerWrapper(spanwise: Spanwise): (handler: Handler, options?: WrapHandlerOptions) => Handler; //# sourceMappingURL=handler.d.ts.map