Back to Apollo Client

Api Report Local State.Api

.api-reports/api-report-local-state.api.md

3.14.15.0 KB
Original Source

API Report File for "@apollo/client"

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

ts

import type { ApolloClient } from '@apollo/client';
import type { DefaultContext } from '@apollo/client';
import type { DocumentNode } from 'graphql';
import type { FieldNode } from 'graphql';
import type { FormattedExecutionResult } from 'graphql';
import type { FragmentMap } from '@apollo/client/utilities/internal';
import type { NoInfer as NoInfer_2 } from '@apollo/client/utilities/internal';
import type { OperationVariables } from '@apollo/client';
import type { RemoveIndexSignature } from '@apollo/client/utilities/internal';
import type { TypedDocumentNode } from '@apollo/client';
import type { WatchQueryFetchPolicy } from '@apollo/client';

// @public (undocumented)
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;

// @public (undocumented)
export namespace LocalState {
    // (undocumented)
    export type ContextFunction<TContext> = (options: ContextFunctionOptions) => TContext;
    // (undocumented)
    export interface ContextFunctionOptions {
        // (undocumented)
        client: ApolloClient;
        // (undocumented)
        document: DocumentNode;
        // (undocumented)
        phase: "exports" | "resolve";
        // (undocumented)
        requestContext: DefaultContext;
        // (undocumented)
        variables: OperationVariables;
    }
    // Warning: (ae-forgotten-export) The symbol "MaybeRequireContextFunction" needs to be exported by the entry point index.d.ts
    export type Options<TResolvers extends Resolvers = Resolvers, TContext = DefaultContext> = {
        context?: ContextFunction<TContext>;
        resolvers?: TResolvers;
    } & MaybeRequireContextFunction<TContext>;
    // (undocumented)
    export type Path = Array<string | number>;
    export 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>;
    export interface Resolvers<TContext = any> {
        // (undocumented)
        [typename: string]: {
            [field: string]: Resolver<any, any, TContext, any>;
        };
    }
    // (undocumented)
    export type RootValueFunction<TRootValue> = (context: RootValueFunctionContext) => TRootValue;
    // (undocumented)
    export interface RootValueFunctionContext {
        // (undocumented)
        client: ApolloClient;
        // (undocumented)
        context: DefaultContext;
        // (undocumented)
        document: DocumentNode;
        // (undocumented)
        phase: "exports" | "resolve";
        // (undocumented)
        variables: OperationVariables;
    }
}

// Warning: (ae-forgotten-export) The symbol "InferContextValueFromResolvers" needs to be exported by the entry point index.d.ts
//
// @public
export class LocalState<TResolvers extends LocalState.Resolvers = LocalState.Resolvers<DefaultContext>, TContext = InferContextValueFromResolvers<TResolvers>> {
    constructor(...[options]: {} extends TResolvers ? [
    options?: LocalState.Options<TResolvers, NoInfer_2<TContext>>
    ] : [
    options: LocalState.Options<TResolvers, NoInfer_2<TContext>> & {
        resolvers: TResolvers;
    }
    ]);
    addResolvers(resolvers: TResolvers): void;
    // (undocumented)
    execute<TData = unknown, TVariables extends OperationVariables = OperationVariables>({ document, client, context, remoteResult, variables, onlyRunForcedResolvers, returnPartialData, fetchPolicy, }: {
        document: DocumentNode | TypedDocumentNode<TData, TVariables>;
        client: ApolloClient;
        context: DefaultContext | undefined;
        remoteResult: FormattedExecutionResult<any> | undefined;
        variables: TVariables | undefined;
        onlyRunForcedResolvers?: boolean;
        returnPartialData?: boolean;
        fetchPolicy: WatchQueryFetchPolicy;
    }): Promise<FormattedExecutionResult<TData>>;
    // (undocumented)
    getExportedVariables<TVariables extends OperationVariables = OperationVariables>({ document, client, context, variables, }: {
        document: DocumentNode | TypedDocumentNode<any, TVariables>;
        client: ApolloClient;
        context: DefaultContext | undefined;
        variables: Partial<NoInfer_2<TVariables>>;
    }): Promise<TVariables>;
}

// @public (undocumented)
type MaybeRequireContextFunction<TContext> = {} extends RemoveIndexSignature<TContext> ? {} : {
    context: LocalState.ContextFunction<TContext>;
};

// (No @packageDocumentation comment for this package)