import type { DocumentNode, FormattedExecutionResult, GraphQLFormattedError } from "graphql";
import type { FetchResult, GraphQLRequest } from "@apollo/client";
import type { DeepPartial } from "@apollo/client/utilities";
import type { Incremental } from "../types.js";
export declare namespace Defer20220824Handler {
    type InitialResult<TData = Record<string, unknown>> = {
        data?: TData | null | undefined;
        errors?: ReadonlyArray<GraphQLFormattedError>;
        extensions?: Record<string, unknown>;
        hasNext: boolean;
    };
    type SubsequentResult<TData = Record<string, unknown>> = {
        data?: TData | null | undefined;
        errors?: ReadonlyArray<GraphQLFormattedError>;
        extensions?: Record<string, unknown>;
        hasNext: boolean;
        incremental?: Array<IncrementalDeferPayload<TData>>;
    };
    type Chunk<TData extends Record<string, unknown>> = InitialResult<TData> | SubsequentResult<TData>;
    type IncrementalDeferPayload<TData = Record<string, unknown>> = {
        data?: TData | null | undefined;
        errors?: ReadonlyArray<GraphQLFormattedError>;
        extensions?: Record<string, unknown>;
        path?: Incremental.Path;
        label?: string;
    };
}
declare module "@apollo/client/link" {
    interface AdditionalFetchResultTypes {
        Defer20220824Handler: Defer20220824Handler.Chunk<Record<string, unknown>>;
    }
}
declare class DeferRequest<TData extends Record<string, unknown>> implements Incremental.IncrementalRequest<Defer20220824Handler.Chunk<TData>, TData> {
    hasNext: boolean;
    private errors;
    private extensions;
    private data;
    private mergeIn;
    handle(cacheData: TData | DeepPartial<TData> | null | undefined, chunk: Defer20220824Handler.Chunk<TData>): FormattedExecutionResult<TData>;
}
/**
 * This handler implements the `@defer` directive as specified in this historical commit:
 * https://github.com/graphql/graphql-spec/tree/48cf7263a71a683fab03d45d309fd42d8d9a6659/spec
 */
export declare class Defer20220824Handler implements Incremental.Handler<Defer20220824Handler.Chunk<any>> {
    isIncrementalResult(result: Record<string, any>): result is Defer20220824Handler.SubsequentResult | Defer20220824Handler.InitialResult;
    extractErrors(result: FetchResult<any>): GraphQLFormattedError[] | undefined;
    prepareRequest(request: GraphQLRequest): GraphQLRequest;
    startRequest<TData extends Record<string, unknown>>(_: {
        query: DocumentNode;
    }): DeferRequest<TData>;
}
export declare function hasIncrementalChunks(result: Record<string, any>): result is Required<Defer20220824Handler.SubsequentResult>;
export {};
//# sourceMappingURL=defer20220824.d.ts.map
