Back to Apollo Client

Api Report Testing.Api

.api-reports/api-report-testing.api.md

3.14.14.7 KB
Original Source

API Report File for "@apollo/client"

Do not edit this file. It is a report generated by API Extractor.

ts

import { ApolloLink } from '@apollo/client/link';
import type { DocumentNode } from 'graphql';
import { FormattedExecutionResult } from 'graphql';
import { Observable } from 'rxjs';
import type { OperationVariables } from '@apollo/client';
import type { Unmasked } from '@apollo/client/masking';

// @internal @deprecated (undocumented)
type CovariantUnaryFunction<out Arg, out Ret> = {
    fn(arg: Arg): Ret;
}["fn"];

// @public @deprecated (undocumented)
export type MockedRequest<TVariables extends OperationVariables = Record<string, any>> = MockLink.MockedRequest<TVariables>;

// @public @deprecated (undocumented)
export type MockedResponse<TData = Record<string, any>, TVariables extends OperationVariables = Record<string, any>> = MockLink.MockedResponse<TData, TVariables>;

// @public (undocumented)
export namespace MockLink {
    // (undocumented)
    export interface DefaultOptions {
        // (undocumented)
        delay?: MockLink.Delay;
    }
    // (undocumented)
    export type Delay = number | DelayFunction;
    // (undocumented)
    export type DelayFunction = (operation: ApolloLink.Operation) => number;
    // (undocumented)
    export interface MockedRequest<TVariables extends OperationVariables = OperationVariables> {
        // (undocumented)
        query: DocumentNode;
        // Warning: (ae-forgotten-export) The symbol "VariableMatcher" needs to be exported by the entry point index.d.ts
        //
        // (undocumented)
        variables?: TVariables | VariableMatcher<TVariables>;
    }
    // (undocumented)
    export interface MockedResponse<
    /** @ts-ignore */
    out TData = Record<string, any>, out TVariables extends OperationVariables = Record<string, any>> {
        // (undocumented)
        delay?: number | MockLink.DelayFunction;
        // (undocumented)
        error?: Error;
        // (undocumented)
        maxUsageCount?: number;
        // (undocumented)
        request: MockedRequest<TVariables>;
        // (undocumented)
        result?: ApolloLink.Result<Unmasked<TData>> | ResultFunction<ApolloLink.Result<Unmasked<TData>>, TVariables>;
    }
    // (undocumented)
    export interface Options {
        // (undocumented)
        defaultOptions?: DefaultOptions;
        // (undocumented)
        showWarnings?: boolean;
    }
    // Warning: (ae-forgotten-export) The symbol "CovariantUnaryFunction" needs to be exported by the entry point index.d.ts
    //
    // (undocumented)
    export type ResultFunction<T, V = Record<string, any>> = CovariantUnaryFunction<V, T>;
}

// @public (undocumented)
export class MockLink extends ApolloLink {
    constructor(mockedResponses: ReadonlyArray<MockLink.MockedResponse<Record<string, any>, Record<string, any>>>, options?: MockLink.Options);
    // (undocumented)
    addMockedResponse(mockedResponse: MockLink.MockedResponse): void;
    // (undocumented)
    static defaultOptions: MockLink.DefaultOptions;
    // (undocumented)
    operation: ApolloLink.Operation;
    // (undocumented)
    request(operation: ApolloLink.Operation): Observable<ApolloLink.Result>;
    // (undocumented)
    showWarnings: boolean;
}

// @public @deprecated (undocumented)
export type MockLinkOptions = MockLink.Options;

// @public (undocumented)
export namespace MockSubscriptionLink {
    // (undocumented)
    export interface Result {
        // (undocumented)
        delay?: number;
        // (undocumented)
        error?: Error;
        // (undocumented)
        result?: ApolloLink.Result;
    }
}

// @public (undocumented)
export class MockSubscriptionLink extends ApolloLink {
    constructor();
    // (undocumented)
    onSetup(listener: any): void;
    // (undocumented)
    onUnsubscribe(listener: any): void;
    // (undocumented)
    operation?: ApolloLink.Operation;
    // (undocumented)
    request(operation: ApolloLink.Operation): Observable<FormattedExecutionResult<Record<string, any>, Record<string, any>>>;
    // (undocumented)
    setups: any[];
    // (undocumented)
    simulateComplete(): void;
    // (undocumented)
    simulateResult(result: MockSubscriptionLink.Result, complete?: boolean): void;
    // (undocumented)
    unsubscribers: any[];
}

// @public (undocumented)
export function realisticDelay({ min, max, }?: {
    min?: number;
    max?: number;
}): MockLink.DelayFunction;

// @public @deprecated (undocumented)
export type ResultFunction<T, V = Record<string, any>> = MockLink.ResultFunction<T, V>;

// @public (undocumented)
type VariableMatcher<V = Record<string, any>> = CovariantUnaryFunction<V, boolean>;

// (No @packageDocumentation comment for this package)