import type { DocumentNode } from "graphql";
import { Observable } from "rxjs";
import type { FetchResult, Operation } from "@apollo/client/link/core";
import { ApolloLink } from "@apollo/client/link/core";
import type { Unmasked } from "@apollo/client/masking";
/** @internal */
type CovariantUnaryFunction<out Arg, out Ret> = {
    fn(arg: Arg): Ret;
}["fn"];
export type ResultFunction<T, V = Record<string, any>> = CovariantUnaryFunction<V, T>;
type VariableMatcher<V = Record<string, any>> = CovariantUnaryFunction<V, boolean>;
export interface MockedRequest<TVariables = Record<string, any>> {
    query: DocumentNode;
    variables?: TVariables | VariableMatcher<TVariables>;
}
export interface MockedResponse<out TData = Record<string, any>, out TVariables = Record<string, any>> {
    request: MockedRequest<TVariables>;
    maxUsageCount?: number;
    result?: FetchResult<Unmasked<TData>> | ResultFunction<FetchResult<Unmasked<TData>>, TVariables>;
    error?: Error;
    delay?: number | MockLink.DelayFunction;
}
export interface MockLinkOptions {
    showWarnings?: boolean;
    defaultOptions?: MockLink.DefaultOptions;
}
export declare namespace MockLink {
    type DelayFunction = (operation: Operation) => number;
    type Delay = number | DelayFunction;
    interface DefaultOptions {
        delay?: MockLink.Delay;
    }
}
export declare function realisticDelay({ min, max, }?: {
    min?: number;
    max?: number;
}): MockLink.DelayFunction;
export declare class MockLink extends ApolloLink {
    operation: Operation;
    showWarnings: boolean;
    private defaultDelay;
    private mockedResponsesByKey;
    static defaultOptions: MockLink.DefaultOptions;
    constructor(mockedResponses: ReadonlyArray<MockedResponse<Record<string, any>, Record<string, any>>>, options?: MockLinkOptions);
    addMockedResponse(mockedResponse: MockedResponse): void;
    request(operation: Operation): Observable<FetchResult> | null;
    private getMockedResponses;
    private normalizeMockedResponse;
}
/** @internal */
export declare function stringifyMockedResponse(mockedResponse: MockedResponse): string;
export interface MockApolloLink extends ApolloLink {
    operation?: Operation;
}
export declare function mockSingleLink(...mockedResponses: Array<MockedResponse<any, any>>): MockApolloLink;
export {};
//# sourceMappingURL=mockLink.d.ts.map
