import { GraphQLError } from 'graphql';
/**
 * Context passed to the "request start" hook.
 * @publicApi
 */
export interface GqlRequestStartHookContext {
    /**
     * Raw GraphQL document sent by the client (if available).
     */
    query?: string;
    /**
     * Name of the operation being executed (if provided by the client).
     */
    operationName?: string;
    /**
     * Variables sent along with the operation.
     */
    variables?: Record<string, unknown>;
    /**
     * GraphQL context object associated with this request.
     */
    context?: Record<string, unknown>;
}
/**
 * Context passed to the "request end" hook.
 * @publicApi
 */
export interface GqlRequestEndHookContext extends GqlRequestStartHookContext {
    /**
     * Errors collected during the execution of the operation (if any).
     */
    errors?: readonly GraphQLError[];
    /**
     * Value returned from the corresponding "request start" hook.
     * Useful to carry over instrumentation state (spans, timestamps, etc.).
     */
    state?: unknown;
}
/**
 * @publicApi
 */
export type GqlRequestStartHook = (context: GqlRequestStartHookContext) => unknown;
/**
 * @publicApi
 */
export type GqlRequestEndHook = (context: GqlRequestEndHookContext) => void | Promise<void>;
/**
 * @publicApi
 */
export declare class ResolverDecoratorHost {
    private readonly logger;
    private decorator;
    private onRequestStartHook;
    private onRequestEndHook;
    setDecorator(decorator: (fn: (...args: unknown[]) => void) => (...args: unknown[]) => void): void;
    getDecorator(): (...args: unknown[]) => void;
    decorate(target: (...args: unknown[]) => void): (...args: unknown[]) => void;
    /**
     * Registers a hook that is called right before a GraphQL operation
     * starts being processed. Whatever it returns is passed back to the
     * "request end" hook through the `state` property.
     */
    setOnRequestStartHook(hook: GqlRequestStartHook): void;
    getOnRequestStartHook(): GqlRequestStartHook;
    /**
     * Registers a hook that is called once a GraphQL operation has been
     * fully processed (right before the response is sent back to the client).
     */
    setOnRequestEndHook(hook: GqlRequestEndHook): void;
    getOnRequestEndHook(): GqlRequestEndHook;
    /**
     * Indicates whether any of the request lifecycle hooks has been registered.
     */
    hasRequestHooks(): boolean;
    /**
     * Calls the "request start" hook and returns what it returns: the promise
     * of an async hook is returned as is, for the caller to await.
     */
    onRequestStart(context: GqlRequestStartHookContext): unknown;
    /**
     * Calls the "request end" hook. The promise of an async hook is returned,
     * for the caller to await.
     */
    onRequestEnd(context: GqlRequestEndHookContext): void | Promise<void>;
    /**
     * A rejected promise that nothing handles terminates the Node.js process,
     * so the rejection of an async hook is logged even if the caller does not
     * await the promise (the caller awaiting it still sees the rejection).
     */
    private handleRejection;
}
//# sourceMappingURL=resolver-decorator-host.d.ts.map