import type { DocumentNode, GraphQLFormattedError } from "graphql"; import type { ApolloCache } from "../cache/index.js"; import type { FetchResult } from "../link/core/index.js"; import type { ApolloError } from "../errors/index.js"; import type { QueryInfo } from "./QueryInfo.js"; import type { NetworkStatus } from "./networkStatus.js"; import type { Resolver } from "./LocalState.js"; import type { ObservableQuery } from "./ObservableQuery.js"; import type { QueryOptions } from "./watchQueryOptions.js"; import type { Cache } from "../cache/index.js"; import type { IsStrictlyAny } from "../utilities/index.js"; export type { TypedDocumentNode } from "@graphql-typed-document-node/core"; export type MethodKeys = { [P in keyof T]: T[P] extends Function ? P : never; }[keyof T]; export interface DefaultContext extends Record { } export type QueryListener = (queryInfo: QueryInfo) => void; export type OnQueryUpdated = (observableQuery: ObservableQuery, diff: Cache.DiffResult, lastDiff: Cache.DiffResult | undefined) => boolean | TResult; export type RefetchQueryDescriptor = string | DocumentNode; export type InternalRefetchQueryDescriptor = RefetchQueryDescriptor | QueryOptions; type RefetchQueriesIncludeShorthand = "all" | "active"; export type RefetchQueriesInclude = RefetchQueryDescriptor[] | RefetchQueriesIncludeShorthand; export type InternalRefetchQueriesInclude = InternalRefetchQueryDescriptor[] | RefetchQueriesIncludeShorthand; export interface RefetchQueriesOptions, TResult> { updateCache?: (cache: TCache) => void; include?: RefetchQueriesInclude; optimistic?: boolean; onQueryUpdated?: OnQueryUpdated | null; } export type RefetchQueriesPromiseResults = IsStrictlyAny extends true ? any[] : TResult extends boolean ? ApolloQueryResult[] : TResult extends PromiseLike ? U[] : TResult[]; export interface RefetchQueriesResult extends Promise> { queries: ObservableQuery[]; results: InternalRefetchQueriesResult[]; } export interface InternalRefetchQueriesOptions, TResult> extends Omit, "include"> { include?: InternalRefetchQueriesInclude; removeOptimistic?: string; } export type InternalRefetchQueriesResult = TResult extends boolean ? Promise> : TResult; export type InternalRefetchQueriesMap = Map, InternalRefetchQueriesResult>; export type { QueryOptions as PureQueryOptions }; export type OperationVariables = Record; export interface ApolloQueryResult { data: T; /** * A list of any errors that occurred during server-side execution of a GraphQL operation. * See https://www.apollographql.com/docs/react/data/error-handling/ for more information. */ errors?: ReadonlyArray; /** * The single Error object that is passed to onError and useQuery hooks, and is often thrown during manual `client.query` calls. * This will contain both a NetworkError field and any GraphQLErrors. * See https://www.apollographql.com/docs/react/data/error-handling/ for more information. */ error?: ApolloError; loading: boolean; networkStatus: NetworkStatus; partial?: boolean; } export type MutationQueryReducer = (previousResult: Record, options: { mutationResult: FetchResult; queryName: string | undefined; queryVariables: Record; }) => Record; export type MutationQueryReducersMap = { [queryName: string]: MutationQueryReducer; }; /** * @deprecated Use `MutationUpdaterFunction` instead. */ export type MutationUpdaterFn = (cache: ApolloCache, mutationResult: FetchResult) => void; export type MutationUpdaterFunction> = (cache: TCache, result: Omit, "context">, options: { context?: TContext; variables?: TVariables; }) => void; export interface Resolvers { [key: string]: { [field: string]: Resolver; }; } //# sourceMappingURL=types.d.ts.map