import type { FastifyRequest, FastifyReply } from 'fastify';
import { HandlerOptions as RawHandlerOptions, OperationContext } from '../handler';
/**
 * @category Server/fastify
 */
export interface RequestContext {
    reply: FastifyReply;
}
/**
 * @category Server/fastify
 */
export type HandlerOptions<Context extends OperationContext = undefined> = RawHandlerOptions<FastifyRequest, RequestContext, Context>;
/**
 * The ready-to-use handler for [fastify](https://www.fastify.io).
 *
 * Errors thrown from the provided options or callbacks (or even due to
 * library misuse or potential bugs) will reject the handler or bubble to the
 * returned iterator. They are considered internal errors and you should take care
 * of them accordingly.
 *
 * For production environments, its recommended not to transmit the exact internal
 * error details to the client, but instead report to an error logging tool or simply
 * the console.
 *
 * ```ts
 * import Fastify from 'fastify'; // yarn add fastify
 * import { createHandler } from 'graphql-sse/lib/use/fastify';
 *
 * const handler = createHandler({ schema });
 *
 * const fastify = Fastify();
 *
 * fastify.all('/graphql/stream', async (req, reply) => {
 *   try {
 *     await handler(req, reply);
 *   } catch (err) {
 *     console.error(err);
 *     reply.code(500).send();
 *   }
 * });
 *
 * fastify.listen({ port: 4000 });
 * console.log('Listening to port 4000');
 * ```
 *
 * @category Server/fastify
 */
export declare function createHandler<Context extends OperationContext = undefined>(options: HandlerOptions<Context>): (req: FastifyRequest, reply: FastifyReply) => Promise<void>;
