import { jn as HTTPBaseHandlerOptions, zn as AnyRouter } from "../../unstable-core-do-not-import-Db2TnFh8.cjs";
import { o as NodeHTTPCreateContextFnOptions, s as NodeHTTPCreateContextOption } from "../../index-Dn1ucZS5.cjs";
import { i as WSSHandlerOptions } from "../../ws-D-DF_k_T.cjs";
import { FastifyInstance, FastifyReply, FastifyRequest } from "fastify";
//#region src/adapters/fastify/fastifyRequestHandler.d.ts
/** The options of the Fastify adapter's request handler. */
export type FastifyHandlerOptions<TRouter extends AnyRouter, TRequest extends FastifyRequest, TResponse extends FastifyReply> = HTTPBaseHandlerOptions<TRouter, TRequest> & {
  /**
   * The largest request body, in bytes. A larger one gets a
   * `PAYLOAD_TOO_LARGE` error. It applies to bodies tRPC streams, such as
   * `multipart/form-data`; JSON bodies are read by Fastify, so limit them
   * with Fastify's `bodyLimit`.
   */
  maxBodySize?: number;
} & NodeHTTPCreateContextOption<TRouter, TRequest, TResponse>;
type FastifyRequestHandlerOptions<TRouter extends AnyRouter, TRequest extends FastifyRequest, TResponse extends FastifyReply> = FastifyHandlerOptions<TRouter, TRequest, TResponse> & {
  req: TRequest;
  res: TResponse;
  path: string;
};
/**
 * Handles one Fastify request for a router. `fastifyTRPCPlugin` uses it;
 * call it yourself to mount tRPC on your own route.
 */
export declare function fastifyRequestHandler<TRouter extends AnyRouter, TRequest extends FastifyRequest, TResponse extends FastifyReply>(opts: FastifyRequestHandlerOptions<TRouter, TRequest, TResponse>): Promise<void>;
//#endregion
//#region src/adapters/fastify/fastifyTRPCPlugin.d.ts
/**
 * The options of `fastifyTRPCPlugin`.
 * @see https://trpc.io/docs/server/adapters/fastify#fastify-plugin-options
 */
export interface FastifyTRPCPluginOptions<TRouter extends AnyRouter> {
  /** The path the router is served at, such as `/trpc`. */
  prefix?: string;
  /**
   * Whether to serve WebSockets too. Needs `@fastify/websocket` to be
   * registered first.
   * @see https://trpc.io/docs/server/adapters/fastify#enable-websockets
   */
  useWSS?: boolean;
  /**
   * The router and handler options. `keepAlive`, `dangerouslyDisablePong`
   * and `experimental_encoder` only apply with `useWSS`.
   */
  trpcOptions: FastifyHandlerOptions<TRouter, FastifyRequest, FastifyReply> & Pick<WSSHandlerOptions<TRouter>, 'keepAlive' | 'dangerouslyDisablePong' | 'experimental_encoder'>;
}
/**
 * What `createContext` gets in the Fastify adapter: `req`, `res` and the
 * request's `info`. With `useWSS`, WebSocket connections get the raw
 * `IncomingMessage` as `req` and the `WebSocket` as `res` instead.
 * @see https://trpc.io/docs/server/adapters/fastify#create-the-context
 */
export type CreateFastifyContextOptions = NodeHTTPCreateContextFnOptions<FastifyRequest, FastifyReply>;
/**
 * A Fastify plugin that serves a router over HTTP, and over WebSockets
 * with `useWSS`.
 * @example
 * ```ts
 * server.register(fastifyTRPCPlugin, {
 *   prefix: '/trpc',
 *   trpcOptions: { router: appRouter, createContext },
 * });
 * ```
 * @see https://trpc.io/docs/server/adapters/fastify#create-fastify-server
 */
export declare function fastifyTRPCPlugin<TRouter extends AnyRouter>(fastify: FastifyInstance, opts: FastifyTRPCPluginOptions<TRouter>, done: (err?: Error) => void): void;
//#endregion

//# sourceMappingURL=index.d.cts.map