import type { DocumentNode, FieldNode, FormattedExecutionResult } from "graphql";
import type { ApolloClient, DefaultContext, OperationVariables, TypedDocumentNode } from "@apollo/client";
import type { FragmentMap, NoInfer, RemoveIndexSignature } from "@apollo/client/utilities/internal";
type InferContextValueFromResolvers<TResolvers> = TResolvers extends {
    [typename: string]: infer TFieldResolvers;
} ? TFieldResolvers extends ({
    [field: string]: LocalState.Resolver<any, any, infer TContext, any>;
}) ? unknown extends TContext ? DefaultContext : TContext : DefaultContext : DefaultContext;
type MaybeRequireContextFunction<TContext> = {} extends RemoveIndexSignature<TContext> ? {} : {
    context: LocalState.ContextFunction<TContext>;
};
export declare namespace LocalState {
    type Options<TResolvers extends Resolvers = Resolvers, TContext = DefaultContext> = {
        context?: ContextFunction<TContext>;
        /**
         * The map of resolvers used to provide values for `@local` fields.
         */
        resolvers?: TResolvers;
    } & MaybeRequireContextFunction<TContext>;
    interface RootValueFunctionContext {
        document: DocumentNode;
        client: ApolloClient;
        context: DefaultContext;
        phase: "exports" | "resolve";
        variables: OperationVariables;
    }
    type ContextFunction<TContext> = (options: ContextFunctionOptions) => TContext;
    interface ContextFunctionOptions {
        document: DocumentNode;
        client: ApolloClient;
        phase: "exports" | "resolve";
        variables: OperationVariables;
        requestContext: DefaultContext;
    }
    type RootValueFunction<TRootValue> = (context: RootValueFunctionContext) => TRootValue;
    interface Resolvers<TContext = any> {
        [typename: string]: {
            [field: string]: Resolver<any, any, TContext, any>;
        };
    }
    type Resolver<TResult = unknown, TParent = unknown, TContext = DefaultContext, TArgs = Record<string, unknown>> = (rootValue: TParent, args: TArgs, context: {
        requestContext: TContext;
        client: ApolloClient;
        phase: "exports" | "resolve";
    }, info: {
        field: FieldNode;
        fragmentMap: FragmentMap;
        path: Path;
    }) => TResult | Promise<TResult>;
    type Path = Array<string | number>;
}
export declare class LocalState<TResolvers extends LocalState.Resolvers = LocalState.Resolvers<DefaultContext>, TContext = InferContextValueFromResolvers<TResolvers>> {
    private context?;
    private resolvers;
    private traverseCache;
    constructor(...[options]: {} extends TResolvers ? [
        options?: LocalState.Options<TResolvers, NoInfer<TContext>>
    ] : [
        options: LocalState.Options<TResolvers, NoInfer<TContext>> & {
            resolvers: TResolvers;
        }
    ]);
    addResolvers(resolvers: TResolvers): void;
    execute<TData = unknown, TVariables extends OperationVariables = OperationVariables>({ document, client, context, remoteResult, variables, onlyRunForcedResolvers, returnPartialData, }: {
        document: DocumentNode | TypedDocumentNode<TData, TVariables>;
        client: ApolloClient;
        context: DefaultContext | undefined;
        remoteResult: FormattedExecutionResult<any> | undefined;
        variables: TVariables | undefined;
        onlyRunForcedResolvers?: boolean;
        returnPartialData?: boolean;
    }): Promise<FormattedExecutionResult<TData>>;
    getExportedVariables<TVariables extends OperationVariables = OperationVariables>({ document, client, context, variables, }: {
        document: DocumentNode | TypedDocumentNode<any, TVariables>;
        client: ApolloClient;
        context: DefaultContext | undefined;
        variables: Partial<NoInfer<TVariables>>;
    }): Promise<TVariables>;
    private resolveSelectionSet;
    private resolveServerField;
    private resolveClientField;
    private addError;
    private getResolver;
    private resolveSubSelectedArray;
    private collectQueryDetail;
}
export {};
//# sourceMappingURL=LocalState.d.ts.map
