import type { Express, Request as ExpressRequest, Response as ExpressResponse } from 'express';
import type { FastifyInstance, FastifyReply, FastifyRequest } from 'fastify';
import { YogaSchemaDefinition, YogaServerInstance, YogaServerOptions } from 'graphql-yoga';
import { AbstractGraphQLDriver, GqlModuleOptions, SubscriptionConfig } from '@nestjs/graphql';
export type YogaDriverPlatform = 'express' | 'fastify';
export type YogaDriverServerContext<Platform extends YogaDriverPlatform> = Platform extends 'fastify' ? {
    req: FastifyRequest;
    reply: FastifyReply;
} : {
    req: ExpressRequest;
    res: ExpressResponse;
};
export type YogaDriverServerOptions<Platform extends YogaDriverPlatform> = Omit<YogaServerOptions<YogaDriverServerContext<Platform>, never>, 'context' | 'schema'> & {
    conditionalSchema?: YogaSchemaDefinition<YogaDriverServerContext<Platform>, never> | undefined;
};
export type YogaDriverServerInstance<Platform extends YogaDriverPlatform> = YogaServerInstance<YogaDriverServerContext<Platform>, never>;
export type YogaDriverConfig<Platform extends YogaDriverPlatform = 'express'> = GqlModuleOptions & YogaDriverServerOptions<Platform> & ({
    /**
     * Subscriptions configuration. Passing `true` will install only `graphql-ws`.
     */
    subscriptions?: boolean | YogaDriverSubscriptionConfig;
    conditionalSchema?: never;
} | {
    /**
     * TODO: Support conditional schema with subscriptions
     */
    subscriptions?: never;
    conditionalSchema?: YogaSchemaDefinition<YogaDriverServerContext<Platform>, never> | undefined;
});
export type YogaDriverSubscriptionConfig = {
    'graphql-ws'?: Omit<SubscriptionConfig['graphql-ws'], 'onSubscribe'>;
    'subscriptions-transport-ws'?: Omit<SubscriptionConfig['subscriptions-transport-ws'], 'onOperation'>;
};
export declare abstract class AbstractYogaDriver<Platform extends YogaDriverPlatform> extends AbstractGraphQLDriver<YogaDriverConfig<Platform>> {
    protected yoga: YogaDriverServerInstance<Platform>;
    start(options: YogaDriverConfig<Platform>): Promise<void>;
    stop(): Promise<void>;
    protected registerExpress({ conditionalSchema, ...options }: YogaDriverConfig<'express'>, { preStartHook }?: {
        preStartHook?: (app: Express) => void;
    }): void;
    protected registerFastify({ conditionalSchema, ...options }: YogaDriverConfig<'fastify'>, { preStartHook }?: {
        preStartHook?: (app: FastifyInstance) => void;
    }): void;
    private mergeConditionalSchema;
    subscriptionWithFilter<TPayload, TVariables, TContext>(instanceRef: unknown, filterFn: (payload: TPayload, variables: TVariables, context: TContext) => boolean | Promise<boolean>, createSubscribeContext: Function): (...args: [TPayload, TVariables, TContext]) => Promise<import("graphql-yoga").Repeater<TPayload, void, unknown>>;
}
export declare class YogaDriver<Platform extends YogaDriverPlatform = 'express'> extends AbstractYogaDriver<Platform> {
    private subscriptionService?;
    start(options: YogaDriverConfig<Platform>): Promise<void>;
    stop(): Promise<void>;
}
