import type { FastifyPluginCallback, FastifyRequest } from "fastify"; export type SqlcommenterContextFn = (request: FastifyRequest) => Record; export interface SqlcommenterFastifyOptions { /** * Extra fields to add to every query's context, merged over the default `route`/`method` * (e.g. a tenant id, or the matched controller name). Runs once per request in `onRequest`. */ context?: SqlcommenterContextFn; } /** * Fastify plugin that tags every query issued during a request with its `route` and `method` * (plus anything returned by `options.context`). * * Register it **before** any other plugin whose hooks issue queries (e.g. an auth plugin that * resolves a session in its own `onRequest`/`preHandler`), so the context is already open when * those hooks run. Because it hooks `onRequest`, it covers the whole request lifecycle — not * just the route handler. * * @example * ```ts * import { sqlcommenterFastify } from "@query-doctor/sqlcommenter-drizzle/fastify"; * * await app.register(sqlcommenterFastify); * await app.register(authPlugin); // queries issued in auth's hooks are tagged too * ``` */ export declare const sqlcommenterFastify: FastifyPluginCallback; export default sqlcommenterFastify; export type { RequestContext } from "./request-context.js"; //# sourceMappingURL=fastify.d.ts.map