UNPKG

@apollo/client

Version:

A fully-featured caching GraphQL client.

85 lines (84 loc) 3.28 kB
import type { DocumentNode, FormattedExecutionResult, GraphQLFormattedError } from "graphql"; import type { ApolloLink } from "@apollo/client/link"; import type { DeepPartial, DocumentTransform } from "@apollo/client/utilities"; import type { StreamInfoTrie } from "@apollo/client/utilities/internal"; export declare namespace Incremental { type Path = ReadonlyArray<string | number>; interface PendingResult { id: string; path: Incremental.Path; label?: string; } /** * @internal * * @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time. */ interface Handler<Chunk extends Record<string, unknown> = Record<string, unknown>> { isIncrementalResult: (result: ApolloLink.Result<any>) => result is Chunk; prepareRequest: (request: ApolloLink.Request) => ApolloLink.Request; extractErrors: (result: ApolloLink.Result<any>) => readonly GraphQLFormattedError[] | undefined | void; startRequest: <TData extends Record<string, unknown>>(request: Incremental.StartRequestOptions) => IncrementalRequest<Chunk, TData>; readonly documentTransform?: DocumentTransform; } /** * @internal * * @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time. */ interface StartRequestOptions { query: DocumentNode; } interface IncrementalRequest<Chunk extends Record<string, unknown>, TData> { hasNext: boolean; /** * @internal * * @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time. */ readonly streamInfo?: StreamInfoTrie; /** * @internal * * @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time. */ getPendingWithInfo?: () => Array<PendingItemWithInfo>; handle: (cacheData: TData | DeepPartial<TData> | undefined | null, chunk: Chunk) => FormattedExecutionResult<TData>; } /** * @internal * * @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time. */ interface PendingDeferResultWithInfo { type: "defer"; delivered: boolean; path: Incremental.Path; label: string | undefined; } /** * @internal * * @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time. */ interface PendingStreamResultWithInfo { type: "stream"; path: Incremental.Path; } /** * @internal * * @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time. */ type PendingItemWithInfo = PendingDeferResultWithInfo | PendingStreamResultWithInfo; /** * @internal * * @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time. */ interface StreamFieldInfo { isFirstChunk: boolean; isLastChunk: boolean; } } //# sourceMappingURL=types.d.ts.map