diff --git a/.api-reports/api-report-testing.api.md b/.api-reports/api-report-testing.api.md index d86e2a44da2..5c4c3372d07 100644 --- a/.api-reports/api-report-testing.api.md +++ b/.api-reports/api-report-testing.api.md @@ -14,7 +14,6 @@ import type { GraphQLFormattedError } from 'graphql'; import type { InlineFragmentNode } from 'graphql'; import { Observable } from 'zen-observable-ts'; import type { Observer } from 'zen-observable-ts'; -import * as React_2 from 'react'; import type { Subscriber } from 'zen-observable-ts'; import type { Subscription } from 'zen-observable-ts'; import { Trie } from '@wry/trie'; @@ -1049,50 +1048,6 @@ interface MockApolloLink extends ApolloLink { operation?: Operation; } -// Warning: (ae-forgotten-export) The symbol "MockedProviderState" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export class MockedProvider extends React_2.Component { - constructor(props: MockedProviderProps); - // (undocumented) - componentWillUnmount(): void; - // (undocumented) - static defaultProps: MockedProviderProps; - // (undocumented) - render(): React_2.JSX.Element | null; -} - -// @public (undocumented) -export interface MockedProviderProps { - // (undocumented) - addTypename?: boolean; - // (undocumented) - cache?: ApolloCache; - // (undocumented) - childProps?: object; - // (undocumented) - children?: any; - connectToDevTools?: boolean; - // Warning: (ae-forgotten-export) The symbol "DefaultOptions" needs to be exported by the entry point index.d.ts - // - // (undocumented) - defaultOptions?: DefaultOptions; - // (undocumented) - link?: ApolloLink; - // (undocumented) - mocks?: ReadonlyArray>; - // (undocumented) - resolvers?: Resolvers; - // (undocumented) - showWarnings?: boolean; -} - -// @public (undocumented) -interface MockedProviderState { - // (undocumented) - client: ApolloClient; -} - // @public (undocumented) export interface MockedResponse, out TVariables = Record> { // (undocumented) @@ -1494,6 +1449,8 @@ class QueryManager { readonly dataMasking: boolean; // (undocumented) readonly defaultContext: Partial; + // Warning: (ae-forgotten-export) The symbol "DefaultOptions" needs to be exported by the entry point index.d.ts + // // (undocumented) defaultOptions: DefaultOptions; // (undocumented) diff --git a/.api-reports/api-report-testing_react.api.md b/.api-reports/api-report-testing_react.api.md new file mode 100644 index 00000000000..36697ad119c --- /dev/null +++ b/.api-reports/api-report-testing_react.api.md @@ -0,0 +1,1885 @@ +## API Report File for "@apollo/client" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { ASTNode } from 'graphql'; +import type { DocumentNode } from 'graphql'; +import type { FieldNode } from 'graphql'; +import type { FormattedExecutionResult } from 'graphql'; +import type { FragmentDefinitionNode } from 'graphql'; +import type { GraphQLErrorExtensions } from 'graphql'; +import type { GraphQLFormattedError } from 'graphql'; +import type { InlineFragmentNode } from 'graphql'; +import { Observable } from 'zen-observable-ts'; +import type { Observer } from 'zen-observable-ts'; +import * as React_2 from 'react'; +import type { Subscriber } from 'zen-observable-ts'; +import type { Subscription } from 'zen-observable-ts'; +import { Trie } from '@wry/trie'; +import { TypedDocumentNode } from '@graphql-typed-document-node/core'; + +// Warning: (ae-forgotten-export) The symbol "Modifier" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "StoreObjectValueMaybeReference" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type AllFieldsModifier> = Modifier> : never>; + +// Warning: (ae-forgotten-export) The symbol "DataProxy" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +abstract class ApolloCache implements DataProxy { + // (undocumented) + readonly assumeImmutableResults: boolean; + // (undocumented) + batch(options: Cache_2.BatchOptions): U; + // (undocumented) + abstract diff(query: Cache_2.DiffOptions): Cache_2.DiffResult; + // (undocumented) + abstract evict(options: Cache_2.EvictOptions): boolean; + abstract extract(optimistic?: boolean): TSerialized; + // (undocumented) + fragmentMatches?(fragment: InlineFragmentNode, typename: string): boolean; + // (undocumented) + gc(): string[]; + // Warning: (ae-forgotten-export) The symbol "getApolloCacheMemoryInternals" needs to be exported by the entry point index.d.ts + // + // @internal + getMemoryInternals?: typeof getApolloCacheMemoryInternals; + // Warning: (ae-forgotten-export) The symbol "StoreObject" needs to be exported by the entry point index.d.ts + // + // (undocumented) + identify(object: StoreObject | Reference): string | undefined; + // (undocumented) + lookupFragment(fragmentName: string): FragmentDefinitionNode | null; + // (undocumented) + modify = Record>(options: Cache_2.ModifyOptions): boolean; + // Warning: (ae-forgotten-export) The symbol "Transaction" needs to be exported by the entry point index.d.ts + // + // (undocumented) + abstract performTransaction(transaction: Transaction, optimisticId?: string | null): void; + // Warning: (ae-forgotten-export) The symbol "Cache_2" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "Unmasked" needs to be exported by the entry point index.d.ts + // + // (undocumented) + abstract read(query: Cache_2.ReadOptions): Unmasked | null; + // (undocumented) + readFragment(options: Cache_2.ReadFragmentOptions, optimistic?: boolean): Unmasked | null; + // (undocumented) + readQuery(options: Cache_2.ReadQueryOptions, optimistic?: boolean): Unmasked | null; + // (undocumented) + recordOptimisticTransaction(transaction: Transaction, optimisticId: string): void; + // (undocumented) + abstract removeOptimistic(id: string): void; + // (undocumented) + abstract reset(options?: Cache_2.ResetOptions): Promise; + abstract restore(serializedState: TSerialized): ApolloCache; + // (undocumented) + transformDocument(document: DocumentNode): DocumentNode; + // (undocumented) + transformForLink(document: DocumentNode): DocumentNode; + // (undocumented) + updateFragment(options: Cache_2.UpdateFragmentOptions, update: (data: Unmasked | null) => Unmasked | null | void): Unmasked | null; + // (undocumented) + updateQuery(options: Cache_2.UpdateQueryOptions, update: (data: Unmasked | null) => Unmasked | null | void): Unmasked | null; + // (undocumented) + abstract watch(watch: Cache_2.WatchOptions): () => void; + // Warning: (ae-forgotten-export) The symbol "OperationVariables" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "WatchFragmentOptions" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "WatchFragmentResult" needs to be exported by the entry point index.d.ts + watchFragment(options: WatchFragmentOptions): Observable>; + // Warning: (ae-forgotten-export) The symbol "Reference" needs to be exported by the entry point index.d.ts + // + // (undocumented) + abstract write(write: Cache_2.WriteOptions): Reference | undefined; + // (undocumented) + writeFragment({ id, data, fragment, fragmentName, ...options }: Cache_2.WriteFragmentOptions): Reference | undefined; + // (undocumented) + writeQuery({ id, data, ...options }: Cache_2.WriteQueryOptions): Reference | undefined; +} + +// @public +class ApolloClient implements DataProxy { + // (undocumented) + __actionHookForDevTools(cb: () => any): void; + constructor(options: ApolloClientOptions); + // Warning: (ae-forgotten-export) The symbol "GraphQLRequest" needs to be exported by the entry point index.d.ts + // + // (undocumented) + __requestRaw(payload: GraphQLRequest): Observable; + // Warning: (ae-forgotten-export) The symbol "Resolvers" needs to be exported by the entry point index.d.ts + addResolvers(resolvers: Resolvers | Resolvers[]): void; + // Warning: (ae-forgotten-export) The symbol "ApolloCache" needs to be exported by the entry point index.d.ts + // + // (undocumented) + cache: ApolloCache; + clearStore(): Promise; + // (undocumented) + get defaultContext(): Partial; + // (undocumented) + defaultOptions: DefaultOptions; + // Warning: (ae-forgotten-export) The symbol "DevtoolsOptions" needs to be exported by the entry point index.d.ts + // + // (undocumented) + readonly devtoolsConfig: DevtoolsOptions; + // (undocumented) + disableNetworkFetches: boolean; + // Warning: (ae-forgotten-export) The symbol "DocumentTransform" needs to be exported by the entry point index.d.ts + get documentTransform(): DocumentTransform; + extract(optimistic?: boolean): TCacheShape; + // Warning: (ae-forgotten-export) The symbol "getApolloClientMemoryInternals" needs to be exported by the entry point index.d.ts + getMemoryInternals?: typeof getApolloClientMemoryInternals; + // Warning: (ae-forgotten-export) The symbol "RefetchQueriesInclude" needs to be exported by the entry point index.d.ts + getObservableQueries(include?: RefetchQueriesInclude): Map>; + getResolvers(): Resolvers; + // Warning: (ae-forgotten-export) The symbol "ApolloLink" needs to be exported by the entry point index.d.ts + // + // (undocumented) + link: ApolloLink; + // Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "MutationOptions" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "FetchResult" needs to be exported by the entry point index.d.ts + mutate = DefaultContext, TCache extends ApolloCache = ApolloCache>(options: MutationOptions): Promise>>; + onClearStore(cb: () => Promise): () => void; + onResetStore(cb: () => Promise): () => void; + // Warning: (ae-forgotten-export) The symbol "QueryOptions" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "ApolloQueryResult" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "MaybeMasked" needs to be exported by the entry point index.d.ts + query(options: QueryOptions): Promise>>; + // (undocumented) + queryDeduplication: boolean; + readFragment(options: DataProxy.Fragment, optimistic?: boolean): Unmasked | null; + readQuery(options: DataProxy.Query, optimistic?: boolean): Unmasked | null; + reFetchObservableQueries(includeStandby?: boolean): Promise[]>; + // Warning: (ae-forgotten-export) The symbol "RefetchQueriesOptions" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "RefetchQueriesResult" needs to be exported by the entry point index.d.ts + refetchQueries = ApolloCache, TResult = Promise>>(options: RefetchQueriesOptions): RefetchQueriesResult; + resetStore(): Promise[] | null>; + restore(serializedState: TCacheShape): ApolloCache; + setLink(newLink: ApolloLink): void; + // Warning: (ae-forgotten-export) The symbol "FragmentMatcher" needs to be exported by the entry point index.d.ts + setLocalStateFragmentMatcher(fragmentMatcher: FragmentMatcher): void; + setResolvers(resolvers: Resolvers | Resolvers[]): void; + stop(): void; + // Warning: (ae-forgotten-export) The symbol "SubscriptionOptions" needs to be exported by the entry point index.d.ts + subscribe(options: SubscriptionOptions): Observable>>; + // Warning: (ae-forgotten-export) The symbol "ApolloClientOptions" needs to be exported by the entry point index.d.ts + // + // (undocumented) + readonly typeDefs: ApolloClientOptions["typeDefs"]; + // (undocumented) + version: string; + watchFragment(options: WatchFragmentOptions): Observable>; + // Warning: (ae-forgotten-export) The symbol "WatchQueryOptions" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "ObservableQuery" needs to be exported by the entry point index.d.ts + watchQuery(options: WatchQueryOptions): ObservableQuery; + writeFragment(options: DataProxy.WriteFragmentOptions): Reference | undefined; + writeQuery(options: DataProxy.WriteQueryOptions): Reference | undefined; +} + +// @public (undocumented) +interface ApolloClientOptions { + assumeImmutableResults?: boolean; + cache: ApolloCache; + // @deprecated + connectToDevTools?: boolean; + // (undocumented) + credentials?: string; + dataMasking?: boolean; + // (undocumented) + defaultContext?: Partial; + defaultOptions?: DefaultOptions; + devtools?: DevtoolsOptions; + // (undocumented) + documentTransform?: DocumentTransform; + // (undocumented) + fragmentMatcher?: FragmentMatcher; + headers?: Record; + link?: ApolloLink; + name?: string; + queryDeduplication?: boolean; + // (undocumented) + resolvers?: Resolvers | Resolvers[]; + ssrForceFetchDelay?: number; + ssrMode?: boolean; + // (undocumented) + typeDefs?: string | string[] | DocumentNode | DocumentNode[]; + // Warning: (ae-forgotten-export) The symbol "UriFunction" needs to be exported by the entry point index.d.ts + uri?: string | UriFunction; + version?: string; +} + +// @public (undocumented) +class ApolloError extends Error { + // Warning: (ae-forgotten-export) The symbol "ApolloErrorOptions" needs to be exported by the entry point index.d.ts + constructor({ graphQLErrors, protocolErrors, clientErrors, networkError, errorMessage, extraInfo, }: ApolloErrorOptions); + cause: ({ + readonly message: string; + extensions?: GraphQLErrorExtensions[] | GraphQLFormattedError["extensions"]; + } & Omit & Partial, "extensions">) | null; + // (undocumented) + clientErrors: ReadonlyArray; + // (undocumented) + extraInfo: any; + // (undocumented) + graphQLErrors: ReadonlyArray; + // (undocumented) + message: string; + // (undocumented) + name: string; + // Warning: (ae-forgotten-export) The symbol "ServerParseError" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "ServerError" needs to be exported by the entry point index.d.ts + // + // (undocumented) + networkError: Error | ServerParseError | ServerError | null; + // (undocumented) + protocolErrors: ReadonlyArray<{ + message: string; + extensions?: GraphQLErrorExtensions[]; + }>; +} + +// @public (undocumented) +interface ApolloErrorOptions { + // (undocumented) + clientErrors?: ReadonlyArray; + // (undocumented) + errorMessage?: string; + // (undocumented) + extraInfo?: any; + // (undocumented) + graphQLErrors?: ReadonlyArray; + // (undocumented) + networkError?: Error | ServerParseError | ServerError | null; + // (undocumented) + protocolErrors?: ReadonlyArray<{ + message: string; + extensions?: GraphQLErrorExtensions[]; + }>; +} + +// @public (undocumented) +class ApolloLink { + constructor(request?: RequestHandler); + // (undocumented) + static concat(first: ApolloLink | RequestHandler, second: ApolloLink | RequestHandler): ApolloLink; + // (undocumented) + concat(next: ApolloLink | RequestHandler): ApolloLink; + // (undocumented) + static empty(): ApolloLink; + // (undocumented) + static execute(link: ApolloLink, operation: GraphQLRequest): Observable; + // Warning: (ae-forgotten-export) The symbol "RequestHandler" needs to be exported by the entry point index.d.ts + // + // (undocumented) + static from(links: (ApolloLink | RequestHandler)[]): ApolloLink; + // @internal + getMemoryInternals?: () => unknown; + // @internal + readonly left?: ApolloLink; + // (undocumented) + protected onError(error: any, observer?: Observer): false | void; + // Warning: (ae-forgotten-export) The symbol "NextLink" needs to be exported by the entry point index.d.ts + // + // (undocumented) + request(operation: Operation, forward?: NextLink): Observable | null; + // @internal + readonly right?: ApolloLink; + // (undocumented) + setOnError(fn: ApolloLink["onError"]): this; + // Warning: (ae-forgotten-export) The symbol "Operation" needs to be exported by the entry point index.d.ts + // + // (undocumented) + static split(test: (op: Operation) => boolean, left: ApolloLink | RequestHandler, right?: ApolloLink | RequestHandler): ApolloLink; + // (undocumented) + split(test: (op: Operation) => boolean, left: ApolloLink | RequestHandler, right?: ApolloLink | RequestHandler): ApolloLink; +} + +// @public (undocumented) +interface ApolloQueryResult { + // (undocumented) + data: T; + // Warning: (ae-forgotten-export) The symbol "ApolloError" needs to be exported by the entry point index.d.ts + error?: ApolloError; + errors?: ReadonlyArray; + // (undocumented) + loading: boolean; + // Warning: (ae-forgotten-export) The symbol "NetworkStatus" needs to be exported by the entry point index.d.ts + // + // (undocumented) + networkStatus: NetworkStatus; + // (undocumented) + partial?: boolean; +} + +// @public +type AsStoreObject = { + [K in keyof T]: T[K]; +}; + +// @public (undocumented) +namespace Cache_2 { + // (undocumented) + interface BatchOptions, TUpdateResult = void> { + // (undocumented) + onWatchUpdated?: (this: TCache, watch: Cache_2.WatchOptions, diff: Cache_2.DiffResult, lastDiff?: Cache_2.DiffResult | undefined) => any; + // (undocumented) + optimistic?: string | boolean; + // (undocumented) + removeOptimistic?: string; + // (undocumented) + update(cache: TCache): TUpdateResult; + } + // Warning: (ae-forgotten-export) The symbol "Cache_2" needs to be exported by the entry point index.d.ts + // + // (undocumented) + interface DiffOptions extends Omit, "rootId"> { + } + // (undocumented) + interface EvictOptions { + // (undocumented) + args?: Record; + // (undocumented) + broadcast?: boolean; + // (undocumented) + fieldName?: string; + // (undocumented) + id?: string; + } + // (undocumented) + interface ModifyOptions = Record> { + // (undocumented) + broadcast?: boolean; + // Warning: (ae-forgotten-export) The symbol "Modifiers" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "AllFieldsModifier" needs to be exported by the entry point index.d.ts + // + // (undocumented) + fields: Modifiers | AllFieldsModifier; + // (undocumented) + id?: string; + // (undocumented) + optimistic?: boolean; + } + // (undocumented) + interface ReadOptions extends DataProxy.Query { + // @deprecated (undocumented) + canonizeResults?: boolean; + // (undocumented) + optimistic: boolean; + // (undocumented) + previousResult?: any; + // (undocumented) + returnPartialData?: boolean; + // (undocumented) + rootId?: string; + } + // (undocumented) + interface ResetOptions { + // (undocumented) + discardWatches?: boolean; + } + // (undocumented) + type WatchCallback = (diff: Cache_2.DiffResult, lastDiff?: Cache_2.DiffResult) => void; + // Warning: (ae-forgotten-export) The symbol "Cache_2" needs to be exported by the entry point index.d.ts + // + // (undocumented) + interface WatchOptions extends DiffOptions { + // Warning: (ae-forgotten-export) The symbol "Cache_2" needs to be exported by the entry point index.d.ts + // + // (undocumented) + callback: WatchCallback; + // (undocumented) + immediate?: boolean; + // Warning: (ae-forgotten-export) The symbol "DataProxy" needs to be exported by the entry point index.d.ts + // + // (undocumented) + lastDiff?: DiffResult; + // (undocumented) + watcher?: object; + } + // (undocumented) + interface WriteOptions extends Omit, "id">, Omit, "data"> { + // (undocumented) + dataId?: string; + // (undocumented) + result: Unmasked; + } + import DiffResult = DataProxy.DiffResult; + import ReadQueryOptions = DataProxy.ReadQueryOptions; + import ReadFragmentOptions = DataProxy.ReadFragmentOptions; + import WriteQueryOptions = DataProxy.WriteQueryOptions; + import WriteFragmentOptions = DataProxy.WriteFragmentOptions; + import UpdateQueryOptions = DataProxy.UpdateQueryOptions; + import UpdateFragmentOptions = DataProxy.UpdateFragmentOptions; + import Fragment = DataProxy.Fragment; +} + +// @public (undocumented) +const enum CacheWriteBehavior { + // (undocumented) + FORBID = 0, + // (undocumented) + MERGE = 2, + // (undocumented) + OVERWRITE = 1 +} + +// Warning: (ae-forgotten-export) The symbol "StoreValue" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type CanReadFunction = (value: StoreValue) => boolean; + +// Warning: (ae-forgotten-export) The symbol "Prettify" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "MergeUnions" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "ExtractByMatchingTypeNames" needs to be exported by the entry point index.d.ts +// +// @public +type CombineByTypeName = { + [TypeName in NonNullable]: Prettify>>; +}[NonNullable]; + +// Warning: (ae-forgotten-export) The symbol "CombineByTypeName" needs to be exported by the entry point index.d.ts +// +// @public +type CombineIntersection = Exclude | CombineByTypeName>; + +// @public (undocumented) +class Concast extends Observable { + // Warning: (ae-forgotten-export) The symbol "MaybeAsync" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "ConcastSourcesIterable" needs to be exported by the entry point index.d.ts + constructor(sources: MaybeAsync> | Subscriber); + // (undocumented) + addObserver(observer: Observer): void; + // Warning: (ae-forgotten-export) The symbol "NextResultListener" needs to be exported by the entry point index.d.ts + // + // (undocumented) + beforeNext(callback: NextResultListener): void; + // (undocumented) + cancel: (reason: any) => void; + // (undocumented) + readonly promise: Promise; + // (undocumented) + removeObserver(observer: Observer): void; +} + +// Warning: (ae-forgotten-export) The symbol "Source" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type ConcastSourcesIterable = Iterable>; + +// Warning: (ae-forgotten-export) The symbol "IsAny" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "Exact" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "RemoveIndexSignature" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type ContainsFragmentsRefs = true extends (IsAny) ? false : TData extends object ? Exact extends Seen ? false : " $fragmentRefs" extends keyof RemoveIndexSignature ? true : ContainsFragmentsRefs> : false; + +// @internal (undocumented) +type CovariantUnaryFunction = { + fn(arg: Arg): Ret; +}["fn"]; + +// @public (undocumented) +interface DataMasking { +} + +// @public (undocumented) +namespace DataProxy { + // (undocumented) + type DiffResult = { + result?: T; + complete?: boolean; + missing?: MissingFieldError[]; + fromOptimisticTransaction?: boolean; + }; + // (undocumented) + interface Fragment { + fragment: DocumentNode | TypedDocumentNode; + fragmentName?: string; + id?: string; + variables?: TVariables; + } + // (undocumented) + interface Query { + id?: string; + query: DocumentNode | TypedDocumentNode; + variables?: TVariables; + } + // Warning: (ae-forgotten-export) The symbol "DataProxy" needs to be exported by the entry point index.d.ts + // + // (undocumented) + interface ReadFragmentOptions extends Fragment { + // @deprecated + canonizeResults?: boolean; + optimistic?: boolean; + returnPartialData?: boolean; + } + // Warning: (ae-forgotten-export) The symbol "DataProxy" needs to be exported by the entry point index.d.ts + // + // (undocumented) + interface ReadQueryOptions extends Query { + // @deprecated + canonizeResults?: boolean; + optimistic?: boolean; + returnPartialData?: boolean; + } + // Warning: (ae-forgotten-export) The symbol "DataProxy" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "DataProxy" needs to be exported by the entry point index.d.ts + // + // (undocumented) + interface UpdateFragmentOptions extends Omit & WriteFragmentOptions, "data"> { + } + // Warning: (ae-forgotten-export) The symbol "DataProxy" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "DataProxy" needs to be exported by the entry point index.d.ts + // + // (undocumented) + interface UpdateQueryOptions extends Omit & WriteQueryOptions, "data"> { + } + // (undocumented) + interface WriteFragmentOptions extends Fragment, WriteOptions { + } + // (undocumented) + interface WriteOptions { + broadcast?: boolean; + data: Unmasked; + overwrite?: boolean; + } + // Warning: (ae-forgotten-export) The symbol "DataProxy" needs to be exported by the entry point index.d.ts + // + // (undocumented) + interface WriteQueryOptions extends Query, WriteOptions { + } +} + +// @public +interface DataProxy { + readFragment(options: DataProxy.ReadFragmentOptions, optimistic?: boolean): Unmasked | null; + readQuery(options: DataProxy.ReadQueryOptions, optimistic?: boolean): Unmasked | null; + writeFragment(options: DataProxy.WriteFragmentOptions): Reference | undefined; + writeQuery(options: DataProxy.WriteQueryOptions): Reference | undefined; +} + +// Warning: (ae-forgotten-export) The symbol "DeepPartialPrimitive" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialMap" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialReadonlyMap" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialSet" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialReadonlySet" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialObject" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type DeepPartial = T extends DeepPartialPrimitive ? T : T extends Map ? DeepPartialMap : T extends ReadonlyMap ? DeepPartialReadonlyMap : T extends Set ? DeepPartialSet : T extends ReadonlySet ? DeepPartialReadonlySet : T extends (...args: any[]) => unknown ? T | undefined : T extends object ? T extends (ReadonlyArray) ? TItem[] extends (T) ? readonly TItem[] extends T ? ReadonlyArray> : Array> : DeepPartialObject : DeepPartialObject : unknown; + +// Warning: (ae-forgotten-export) The symbol "DeepPartial" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type DeepPartialMap = {} & Map, DeepPartial>; + +// @public (undocumented) +type DeepPartialObject = { + [K in keyof T]?: DeepPartial; +}; + +// Warning: (ae-forgotten-export) The symbol "Primitive" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type DeepPartialPrimitive = Primitive | Date | RegExp; + +// @public (undocumented) +type DeepPartialReadonlyMap = {} & ReadonlyMap, DeepPartial>; + +// @public (undocumented) +type DeepPartialReadonlySet = {} & ReadonlySet>; + +// @public (undocumented) +type DeepPartialSet = {} & Set>; + +// @public (undocumented) +interface DefaultContext extends Record { +} + +// @public (undocumented) +interface DefaultOptions { + // (undocumented) + mutate?: Partial>; + // (undocumented) + query?: Partial>; + // (undocumented) + watchQuery?: Partial>; +} + +// @public (undocumented) +interface DeleteModifier { + // (undocumented) + [_deleteModifier]: true; +} + +// @public (undocumented) +const _deleteModifier: unique symbol; + +// @public (undocumented) +interface DevtoolsOptions { + enabled?: boolean; + name?: string; +} + +// @public (undocumented) +type DistributedRequiredExclude = T extends any ? Required extends Required ? Required extends Required ? never : T : T : T; + +// @public (undocumented) +class DocumentTransform { + // Warning: (ae-forgotten-export) The symbol "TransformFn" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "DocumentTransformOptions" needs to be exported by the entry point index.d.ts + constructor(transform: TransformFn, options?: DocumentTransformOptions); + // (undocumented) + concat(otherTransform: DocumentTransform): DocumentTransform; + // (undocumented) + static identity(): DocumentTransform; + // @internal + readonly left?: DocumentTransform; + resetCache(): void; + // @internal + readonly right?: DocumentTransform; + // (undocumented) + static split(predicate: (document: DocumentNode) => boolean, left: DocumentTransform, right?: DocumentTransform): DocumentTransform & { + left: DocumentTransform; + right: DocumentTransform; + }; + // (undocumented) + transformDocument(document: DocumentNode): DocumentNode; +} + +// @public (undocumented) +type DocumentTransformCacheKey = ReadonlyArray; + +// @public (undocumented) +interface DocumentTransformOptions { + cache?: boolean; + // Warning: (ae-forgotten-export) The symbol "DocumentTransformCacheKey" needs to be exported by the entry point index.d.ts + getCacheKey?: (document: DocumentNode) => DocumentTransformCacheKey | undefined; +} + +// @public +type ErrorPolicy = "none" | "ignore" | "all"; + +// @public (undocumented) +type Exact = (x: T) => T; + +// Warning: (ae-forgotten-export) The symbol "ExecutionPatchResultBase" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +interface ExecutionPatchIncrementalResult, TExtensions = Record> extends ExecutionPatchResultBase { + // (undocumented) + data?: never; + // (undocumented) + errors?: never; + // (undocumented) + extensions?: never; + // Warning: (ae-forgotten-export) The symbol "IncrementalPayload" needs to be exported by the entry point index.d.ts + // + // (undocumented) + incremental?: IncrementalPayload[]; +} + +// @public (undocumented) +interface ExecutionPatchInitialResult, TExtensions = Record> extends ExecutionPatchResultBase { + // (undocumented) + data: TData | null | undefined; + // (undocumented) + errors?: ReadonlyArray; + // (undocumented) + extensions?: TExtensions; + // (undocumented) + incremental?: never; +} + +// Warning: (ae-forgotten-export) The symbol "ExecutionPatchInitialResult" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "ExecutionPatchIncrementalResult" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type ExecutionPatchResult, TExtensions = Record> = ExecutionPatchInitialResult | ExecutionPatchIncrementalResult; + +// @public (undocumented) +interface ExecutionPatchResultBase { + // (undocumented) + hasNext?: boolean; +} + +// @public +type ExtractByMatchingTypeNames = Union extends any ? TypeName extends NonNullable ? Omit & { + [K in keyof Union as K extends "__typename" ? K : never]: TypeName; +} : never : never; + +// @public (undocumented) +interface FetchMoreQueryOptions { + // (undocumented) + context?: DefaultContext; + query?: DocumentNode | TypedDocumentNode; + variables?: Partial; +} + +// @public +type FetchPolicy = "cache-first" | "network-only" | "cache-only" | "no-cache" | "standby"; + +// Warning: (ae-forgotten-export) The symbol "SingleExecutionResult" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "ExecutionPatchResult" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type FetchResult, TContext = Record, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; + +// @public (undocumented) +interface FieldSpecifier { + // (undocumented) + args?: Record; + // (undocumented) + field?: FieldNode; + // (undocumented) + fieldName: string; + // (undocumented) + typename?: string; + // (undocumented) + variables?: Record; +} + +// @public +interface FragmentMap { + // (undocumented) + [fragmentName: string]: FragmentDefinitionNode; +} + +// @public (undocumented) +type FragmentMatcher = (rootValue: any, typeCondition: string, context: any) => boolean; + +// @public (undocumented) +type FragmentType = [ +TData +] extends [{ + " $fragmentName"?: infer TKey; +}] ? TKey extends string ? { + " $fragmentRefs"?: { + [key in TKey]: TData; + }; +} : never : never; + +// @internal +const getApolloCacheMemoryInternals: (() => { + cache: { + fragmentQueryDocuments: number | undefined; + }; +}) | undefined; + +// @internal +const getApolloClientMemoryInternals: (() => { + limits: { + [k: string]: number; + }; + sizes: { + cache?: { + fragmentQueryDocuments: number | undefined; + } | undefined; + addTypenameDocumentTransform?: { + cache: number; + }[] | undefined; + inMemoryCache?: { + executeSelectionSet: number | undefined; + executeSubSelectedArray: number | undefined; + maybeBroadcastWatch: number | undefined; + } | undefined; + fragmentRegistry?: { + findFragmentSpreads: number | undefined; + lookup: number | undefined; + transform: number | undefined; + } | undefined; + print: number | undefined; + parser: number | undefined; + canonicalStringify: number | undefined; + links: unknown[]; + queryManager: { + getDocumentInfo: number; + documentTransforms: { + cache: number; + }[]; + }; + }; +}) | undefined; + +// @public (undocumented) +interface GraphQLRequest> { + // (undocumented) + context?: DefaultContext; + // (undocumented) + extensions?: Record; + // (undocumented) + operationName?: string; + // (undocumented) + query: DocumentNode; + // (undocumented) + variables?: TVariables; +} + +// @public (undocumented) +interface IgnoreModifier { + // (undocumented) + [_ignoreModifier]: true; +} + +// @public (undocumented) +const _ignoreModifier: unique symbol; + +// @public (undocumented) +interface IncrementalPayload { + // (undocumented) + data: TData | null; + // (undocumented) + errors?: ReadonlyArray; + // (undocumented) + extensions?: TExtensions; + // (undocumented) + label?: string; + // Warning: (ae-forgotten-export) The symbol "Path" needs to be exported by the entry point index.d.ts + // + // (undocumented) + path: Path; +} + +// Warning: (ae-forgotten-export) The symbol "InternalRefetchQueryDescriptor" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "RefetchQueriesIncludeShorthand" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type InternalRefetchQueriesInclude = InternalRefetchQueryDescriptor[] | RefetchQueriesIncludeShorthand; + +// Warning: (ae-forgotten-export) The symbol "InternalRefetchQueriesResult" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type InternalRefetchQueriesMap = Map, InternalRefetchQueriesResult>; + +// @public (undocumented) +interface InternalRefetchQueriesOptions, TResult> extends Omit, "include"> { + // Warning: (ae-forgotten-export) The symbol "InternalRefetchQueriesInclude" needs to be exported by the entry point index.d.ts + // + // (undocumented) + include?: InternalRefetchQueriesInclude; + // (undocumented) + removeOptimistic?: string; +} + +// @public (undocumented) +type InternalRefetchQueriesResult = TResult extends boolean ? Promise> : TResult; + +// Warning: (ae-forgotten-export) The symbol "RefetchQueryDescriptor" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type InternalRefetchQueryDescriptor = RefetchQueryDescriptor | QueryOptions; + +// @public (undocumented) +interface InvalidateModifier { + // (undocumented) + [_invalidateModifier]: true; +} + +// @public (undocumented) +const _invalidateModifier: unique symbol; + +// @public (undocumented) +type IsAny = 0 extends 1 & T ? true : false; + +// @public (undocumented) +function isReference(obj: any): obj is Reference; + +// Warning: (ae-forgotten-export) The symbol "UnionToIntersection" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "UnionForAny" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type IsStrictlyAny = UnionToIntersection> extends never ? true : false; + +// @public (undocumented) +class LocalState { + // Warning: (ae-forgotten-export) The symbol "LocalStateOptions" needs to be exported by the entry point index.d.ts + constructor({ cache, client, resolvers, fragmentMatcher, }: LocalStateOptions); + // (undocumented) + addExportedVariables(document: DocumentNode, variables?: TVars, context?: {}): Promise; + // (undocumented) + addResolvers(resolvers: Resolvers | Resolvers[]): void; + // (undocumented) + clientQuery(document: DocumentNode): DocumentNode | null; + // (undocumented) + getFragmentMatcher(): FragmentMatcher | undefined; + // (undocumented) + getResolvers(): Resolvers; + // (undocumented) + prepareContext(context?: Record): { + cache: ApolloCache; + getCacheKey(obj: StoreObject): string | undefined; + }; + // (undocumented) + runResolvers({ document, remoteResult, context, variables, onlyRunForcedResolvers, }: { + document: DocumentNode | null; + remoteResult: FetchResult; + context?: Record; + variables?: Record; + onlyRunForcedResolvers?: boolean; + }): Promise>; + // (undocumented) + serverQuery(document: DocumentNode): DocumentNode | null; + // (undocumented) + setFragmentMatcher(fragmentMatcher: FragmentMatcher): void; + // (undocumented) + setResolvers(resolvers: Resolvers | Resolvers[]): void; + // (undocumented) + shouldForceResolvers(document: ASTNode): boolean; +} + +// @public (undocumented) +type LocalStateOptions = { + cache: ApolloCache; + client?: ApolloClient; + resolvers?: Resolvers | Resolvers[]; + fragmentMatcher?: FragmentMatcher; +}; + +// @public (undocumented) +interface MaskFragmentOptions { + // (undocumented) + data: TData; + // (undocumented) + fragment: DocumentNode; + // (undocumented) + fragmentName?: string; +} + +// @public (undocumented) +interface MaskOperationOptions { + // (undocumented) + data: TData; + // (undocumented) + document: DocumentNode; + // Warning: (ae-forgotten-export) The symbol "WatchQueryFetchPolicy" needs to be exported by the entry point index.d.ts + // + // (undocumented) + fetchPolicy?: WatchQueryFetchPolicy; + // (undocumented) + id: string; +} + +// @public (undocumented) +type MaybeAsync = T | PromiseLike; + +// Warning: (ae-forgotten-export) The symbol "DataMasking" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "RemoveMaskedMarker" needs to be exported by the entry point index.d.ts +// +// @public +type MaybeMasked = DataMasking extends { + mode: "unmask"; +} ? TData extends any ? true extends IsAny ? TData : TData extends { + __masked?: true; +} ? Prettify> : Unmasked : never : DataMasking extends { + mode: "preserveTypes"; +} ? TData : TData; + +// Warning: (ae-forgotten-export) The symbol "CombineIntersection" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeObjects = Prettify<{ + [k in keyof T]: k extends keyof U ? [ + NonNullable, + NonNullable + ] extends ([ + infer TK extends object, + infer UK extends object + ]) ? TK extends unknown[] ? UK extends unknown[] ? CombineIntersection[] | Extract : T[k] : CombineIntersection | Extract : T[k] : T[k]; +} & Pick>>; + +// Warning: (ae-forgotten-export) The symbol "MergeUnionsAcc" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "takeOneFromUnion" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeUnions = MergeUnionsAcc, never>; + +// Warning: (ae-forgotten-export) The symbol "DistributedRequiredExclude" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "MergeObjects" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeUnionsAcc = [ +Curr +] extends [never] ? Merged : MergeUnionsAcc, takeOneFromUnion>, [ +Merged +] extends [never] ? Curr : MergeObjects>; + +// @public (undocumented) +class MissingFieldError extends Error { + constructor(message: string, path: MissingTree | Array, query: DocumentNode, variables?: Record | undefined); + // (undocumented) + readonly message: string; + // (undocumented) + readonly missing: MissingTree; + // Warning: (ae-forgotten-export) The symbol "MissingTree" needs to be exported by the entry point index.d.ts + // + // (undocumented) + readonly path: MissingTree | Array; + // (undocumented) + readonly query: DocumentNode; + // (undocumented) + readonly variables?: Record | undefined; +} + +// @public (undocumented) +type MissingTree = string | { + readonly [key: string]: MissingTree; +}; + +// Warning: (ae-forgotten-export) The symbol "MockedProviderState" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export class MockedProvider extends React_2.Component { + constructor(props: MockedProviderProps); + // (undocumented) + componentWillUnmount(): void; + // (undocumented) + static defaultProps: MockedProviderProps; + // (undocumented) + render(): React_2.JSX.Element | null; +} + +// @public (undocumented) +export interface MockedProviderProps { + // (undocumented) + addTypename?: boolean; + // (undocumented) + cache?: ApolloCache; + // (undocumented) + childProps?: object; + // (undocumented) + children?: any; + connectToDevTools?: boolean; + // Warning: (ae-forgotten-export) The symbol "DefaultOptions" needs to be exported by the entry point index.d.ts + // + // (undocumented) + defaultOptions?: DefaultOptions; + // (undocumented) + link?: ApolloLink; + // Warning: (ae-forgotten-export) The symbol "MockedResponse" needs to be exported by the entry point index.d.ts + // + // (undocumented) + mocks?: ReadonlyArray>; + // (undocumented) + resolvers?: Resolvers; + // (undocumented) + showWarnings?: boolean; +} + +// @public (undocumented) +interface MockedProviderState { + // (undocumented) + client: ApolloClient; +} + +// @public (undocumented) +interface MockedResponse, out TVariables = Record> { + // (undocumented) + delay?: number; + // (undocumented) + error?: Error; + // (undocumented) + maxUsageCount?: number; + // (undocumented) + newData?: ResultFunction>, TVariables>; + // (undocumented) + request: GraphQLRequest; + // Warning: (ae-forgotten-export) The symbol "ResultFunction" needs to be exported by the entry point index.d.ts + // + // (undocumented) + result?: FetchResult> | ResultFunction>, TVariables>; + // Warning: (ae-forgotten-export) The symbol "VariableMatcher" needs to be exported by the entry point index.d.ts + // + // (undocumented) + variableMatcher?: VariableMatcher; +} + +// Warning: (ae-forgotten-export) The symbol "ModifierDetails" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeleteModifier" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "InvalidateModifier" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type Modifier = (value: T, details: ModifierDetails) => DeepPartial | DeleteModifier | InvalidateModifier | undefined; + +// @public (undocumented) +type ModifierDetails = { + DELETE: DeleteModifier; + INVALIDATE: InvalidateModifier; + fieldName: string; + storeFieldName: string; + readField: ReadFieldFunction; + canRead: CanReadFunction; + isReference: typeof isReference; + toReference: ToReferenceFunction; + storage: StorageType; +}; + +// @public (undocumented) +type Modifiers = Record> = Partial<{ + [FieldName in keyof T]: Modifier>>; +}>; + +// @public (undocumented) +interface MutationBaseOptions = ApolloCache> { + awaitRefetchQueries?: boolean; + context?: TContext; + // Warning: (ae-forgotten-export) The symbol "ErrorPolicy" needs to be exported by the entry point index.d.ts + errorPolicy?: ErrorPolicy; + // Warning: (ae-forgotten-export) The symbol "OnQueryUpdated" needs to be exported by the entry point index.d.ts + onQueryUpdated?: OnQueryUpdated; + // Warning: (ae-forgotten-export) The symbol "NoInfer_2" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "IgnoreModifier" needs to be exported by the entry point index.d.ts + optimisticResponse?: Unmasked> | ((vars: TVariables, { IGNORE }: { + IGNORE: IgnoreModifier; + }) => Unmasked> | IgnoreModifier); + refetchQueries?: ((result: FetchResult>) => InternalRefetchQueriesInclude) | InternalRefetchQueriesInclude; + // Warning: (ae-forgotten-export) The symbol "MutationUpdaterFunction" needs to be exported by the entry point index.d.ts + update?: MutationUpdaterFunction; + // Warning: (ae-forgotten-export) The symbol "MutationQueryReducersMap" needs to be exported by the entry point index.d.ts + updateQueries?: MutationQueryReducersMap; + variables?: TVariables; +} + +// Warning: (ae-forgotten-export) The symbol "FetchPolicy" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MutationFetchPolicy = Extract; + +// Warning: (ae-forgotten-export) The symbol "MutationSharedOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +interface MutationOptions = ApolloCache> extends MutationSharedOptions { + mutation: DocumentNode | TypedDocumentNode; +} + +// @public (undocumented) +type MutationQueryReducer = (previousResult: Record, options: { + mutationResult: FetchResult>; + queryName: string | undefined; + queryVariables: Record; +}) => Record; + +// @public (undocumented) +type MutationQueryReducersMap = { + [queryName: string]: MutationQueryReducer; +}; + +// Warning: (ae-forgotten-export) The symbol "MutationBaseOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +interface MutationSharedOptions = ApolloCache> extends MutationBaseOptions { + // Warning: (ae-forgotten-export) The symbol "MutationFetchPolicy" needs to be exported by the entry point index.d.ts + fetchPolicy?: MutationFetchPolicy; + keepRootFields?: boolean; +} + +// @public (undocumented) +interface MutationStoreValue { + // (undocumented) + error: Error | null; + // (undocumented) + loading: boolean; + // (undocumented) + mutation: DocumentNode; + // (undocumented) + variables: Record; +} + +// @public (undocumented) +type MutationUpdaterFunction> = (cache: TCache, result: Omit>, "context">, options: { + context?: TContext; + variables?: TVariables; +}) => void; + +// @public +enum NetworkStatus { + error = 8, + fetchMore = 3, + loading = 1, + poll = 6, + ready = 7, + refetch = 4, + setVariables = 2 +} + +// @public (undocumented) +interface NextFetchPolicyContext { + // (undocumented) + initialFetchPolicy: WatchQueryFetchPolicy; + // (undocumented) + observable: ObservableQuery; + // (undocumented) + options: WatchQueryOptions; + // (undocumented) + reason: "after-fetch" | "variables-changed"; +} + +// @public (undocumented) +type NextLink = (operation: Operation) => Observable; + +// @public (undocumented) +type NextResultListener = (method: "next" | "error" | "complete", arg?: any) => any; + +// @public +type NoInfer_2 = [T][T extends any ? 0 : never]; + +// @public (undocumented) +class ObservableQuery extends Observable>> { + constructor({ queryManager, queryInfo, options, }: { + queryManager: QueryManager; + queryInfo: QueryInfo; + options: WatchQueryOptions; + }); + // Warning: (ae-forgotten-export) The symbol "FetchMoreQueryOptions" needs to be exported by the entry point index.d.ts + fetchMore(fetchMoreOptions: FetchMoreQueryOptions & { + updateQuery?: (previousQueryResult: Unmasked, options: { + fetchMoreResult: Unmasked; + variables: TFetchVars; + }) => Unmasked; + }): Promise>>; + // (undocumented) + getCurrentResult(saveAsLastResult?: boolean): ApolloQueryResult>; + // (undocumented) + getLastError(variablesMustMatch?: boolean): ApolloError | undefined; + // (undocumented) + getLastResult(variablesMustMatch?: boolean): ApolloQueryResult | undefined; + // (undocumented) + hasObservers(): boolean; + // (undocumented) + isDifferentFromLastResult(newResult: ApolloQueryResult, variables?: TVariables): boolean | undefined; + // (undocumented) + readonly options: WatchQueryOptions; + // (undocumented) + get query(): TypedDocumentNode; + // (undocumented) + readonly queryId: string; + // (undocumented) + readonly queryName?: string; + refetch(variables?: Partial): Promise>>; + // (undocumented) + reobserve(newOptions?: Partial>, newNetworkStatus?: NetworkStatus): Promise>>; + // Warning: (ae-forgotten-export) The symbol "Concast" needs to be exported by the entry point index.d.ts + // + // (undocumented) + reobserveAsConcast(newOptions?: Partial>, newNetworkStatus?: NetworkStatus): Concast>; + // @internal (undocumented) + resetDiff(): void; + // (undocumented) + resetLastResults(): void; + // (undocumented) + resetQueryStoreErrors(): void; + // (undocumented) + resubscribeAfterError(onNext: (value: ApolloQueryResult>) => void, onError?: (error: any) => void, onComplete?: () => void): Subscription; + // (undocumented) + resubscribeAfterError(observer: Observer>): Subscription; + // (undocumented) + result(): Promise>>; + // (undocumented) + setOptions(newOptions: Partial>): Promise>>; + setVariables(variables: TVariables): Promise> | void>; + // (undocumented) + silentSetOptions(newOptions: Partial>): void; + startPolling(pollInterval: number): void; + stopPolling(): void; + // Warning: (ae-forgotten-export) The symbol "SubscribeToMoreOptions" needs to be exported by the entry point index.d.ts + subscribeToMore(options: SubscribeToMoreOptions): () => void; + updateQuery(mapFn: (previousQueryResult: Unmasked, options: Pick, "variables">) => Unmasked): void; + get variables(): TVariables | undefined; +} + +// @public (undocumented) +type OnQueryUpdated = (observableQuery: ObservableQuery, diff: Cache_2.DiffResult, lastDiff: Cache_2.DiffResult | undefined) => boolean | TResult; + +// @public (undocumented) +interface Operation { + // (undocumented) + extensions: Record; + // (undocumented) + getContext: () => DefaultContext; + // (undocumented) + operationName: string; + // (undocumented) + query: DocumentNode; + // (undocumented) + setContext: { + (context: Partial): void; + (updateContext: (previousContext: DefaultContext) => Partial): void; + }; + // (undocumented) + variables: Record; +} + +// @public (undocumented) +type OperationVariables = Record; + +// @public (undocumented) +type Path = ReadonlyArray; + +// @public (undocumented) +type Prettify = { + [K in keyof T]: T[K]; +} & {}; + +// @public (undocumented) +type Primitive = null | undefined | string | number | boolean | symbol | bigint; + +// @public (undocumented) +class QueryInfo { + constructor(queryManager: QueryManager, queryId?: string); + // (undocumented) + document: DocumentNode | null; + // (undocumented) + getDiff(): Cache_2.DiffResult; + // (undocumented) + graphQLErrors?: ReadonlyArray; + // (undocumented) + init(query: { + document: DocumentNode; + variables: Record | undefined; + networkStatus?: NetworkStatus; + observableQuery?: ObservableQuery; + lastRequestId?: number; + }): this; + // (undocumented) + lastRequestId: number; + // Warning: (ae-forgotten-export) The symbol "QueryListener" needs to be exported by the entry point index.d.ts + // + // (undocumented) + listeners: Set; + // (undocumented) + markError(error: ApolloError): ApolloError; + // (undocumented) + markReady(): NetworkStatus; + // Warning: (ae-forgotten-export) The symbol "CacheWriteBehavior" needs to be exported by the entry point index.d.ts + // + // (undocumented) + markResult(result: FetchResult, document: DocumentNode, options: Pick, cacheWriteBehavior: CacheWriteBehavior): void; + // (undocumented) + networkError?: Error | null; + // (undocumented) + networkStatus?: NetworkStatus; + // (undocumented) + notify(): void; + // (undocumented) + readonly observableQuery: ObservableQuery | null; + // (undocumented) + readonly queryId: string; + // (undocumented) + reset(): void; + // (undocumented) + resetDiff(): void; + // (undocumented) + resetLastWrite(): void; + // (undocumented) + setDiff(diff: Cache_2.DiffResult | null): void; + // (undocumented) + setObservableQuery(oq: ObservableQuery | null): void; + // (undocumented) + stop(): void; + // (undocumented) + stopped: boolean; + // (undocumented) + variables?: Record; +} + +// @public (undocumented) +type QueryListener = (queryInfo: QueryInfo) => void; + +// @public (undocumented) +class QueryManager { + // Warning: (ae-forgotten-export) The symbol "QueryManagerOptions" needs to be exported by the entry point index.d.ts + constructor(options: QueryManagerOptions); + // (undocumented) + readonly assumeImmutableResults: boolean; + // (undocumented) + broadcastQueries(): void; + // (undocumented) + cache: ApolloCache; + // (undocumented) + clearStore(options?: Cache_2.ResetOptions): Promise; + // (undocumented) + readonly dataMasking: boolean; + // (undocumented) + readonly defaultContext: Partial; + // (undocumented) + defaultOptions: DefaultOptions; + // (undocumented) + readonly documentTransform: DocumentTransform; + // (undocumented) + protected fetchCancelFns: Map any>; + // (undocumented) + fetchQuery(queryId: string, options: WatchQueryOptions, networkStatus?: NetworkStatus): Promise>; + // (undocumented) + generateMutationId(): string; + // (undocumented) + generateQueryId(): string; + // (undocumented) + generateRequestId(): number; + // Warning: (ae-forgotten-export) The symbol "TransformCacheEntry" needs to be exported by the entry point index.d.ts + // + // (undocumented) + getDocumentInfo(document: DocumentNode): TransformCacheEntry; + // Warning: (ae-forgotten-export) The symbol "LocalState" needs to be exported by the entry point index.d.ts + // + // (undocumented) + getLocalState(): LocalState; + // (undocumented) + getObservableQueries(include?: InternalRefetchQueriesInclude): Map>; + // Warning: (ae-forgotten-export) The symbol "QueryStoreValue" needs to be exported by the entry point index.d.ts + // + // (undocumented) + getQueryStore(): Record; + // (undocumented) + protected inFlightLinkObservables: Trie<{ + observable?: Observable>; + }>; + // (undocumented) + link: ApolloLink; + // (undocumented) + markMutationOptimistic>(optimisticResponse: any, mutation: { + mutationId: string; + document: DocumentNode; + variables?: TVariables; + fetchPolicy?: MutationFetchPolicy; + errorPolicy: ErrorPolicy; + context?: TContext; + updateQueries: UpdateQueries; + update?: MutationUpdaterFunction; + keepRootFields?: boolean; + }): boolean; + // (undocumented) + markMutationResult>(mutation: { + mutationId: string; + result: FetchResult; + document: DocumentNode; + variables?: TVariables; + fetchPolicy?: MutationFetchPolicy; + errorPolicy: ErrorPolicy; + context?: TContext; + updateQueries: UpdateQueries; + update?: MutationUpdaterFunction; + awaitRefetchQueries?: boolean; + refetchQueries?: InternalRefetchQueriesInclude; + removeOptimistic?: string; + onQueryUpdated?: OnQueryUpdated; + keepRootFields?: boolean; + }, cache?: ApolloCache): Promise>; + // Warning: (ae-forgotten-export) The symbol "MaskFragmentOptions" needs to be exported by the entry point index.d.ts + // + // (undocumented) + maskFragment(options: MaskFragmentOptions): TData; + // Warning: (ae-forgotten-export) The symbol "MaskOperationOptions" needs to be exported by the entry point index.d.ts + // + // (undocumented) + maskOperation(options: MaskOperationOptions): MaybeMasked; + // (undocumented) + mutate, TCache extends ApolloCache>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions): Promise>>; + // (undocumented) + mutationStore?: { + [mutationId: string]: MutationStoreValue; + }; + // (undocumented) + query(options: QueryOptions, queryId?: string): Promise>>; + // (undocumented) + reFetchObservableQueries(includeStandby?: boolean): Promise[]>; + // Warning: (ae-forgotten-export) The symbol "InternalRefetchQueriesOptions" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "InternalRefetchQueriesMap" needs to be exported by the entry point index.d.ts + // + // (undocumented) + refetchQueries({ updateCache, include, optimistic, removeOptimistic, onQueryUpdated, }: InternalRefetchQueriesOptions, TResult>): InternalRefetchQueriesMap; + // (undocumented) + removeQuery(queryId: string): void; + // (undocumented) + resetErrors(queryId: string): void; + // (undocumented) + setObservableQuery(observableQuery: ObservableQuery): void; + // (undocumented) + readonly ssrMode: boolean; + // (undocumented) + startGraphQLSubscription(options: SubscriptionOptions): Observable>; + stop(): void; + // (undocumented) + stopQuery(queryId: string): void; + // (undocumented) + stopQueryInStore(queryId: string): void; + // (undocumented) + transform(document: DocumentNode): DocumentNode; + // (undocumented) + watchQuery(options: WatchQueryOptions): ObservableQuery; +} + +// @public (undocumented) +interface QueryManagerOptions { + // (undocumented) + assumeImmutableResults: boolean; + // (undocumented) + cache: ApolloCache; + // (undocumented) + clientAwareness: Record; + // (undocumented) + dataMasking: boolean; + // (undocumented) + defaultContext: Partial | undefined; + // (undocumented) + defaultOptions: DefaultOptions; + // (undocumented) + documentTransform: DocumentTransform | null | undefined; + // (undocumented) + link: ApolloLink; + // (undocumented) + localState: LocalState; + // (undocumented) + onBroadcast: undefined | (() => void); + // (undocumented) + queryDeduplication: boolean; + // (undocumented) + ssrMode: boolean; +} + +// @public +interface QueryOptions { + // @deprecated + canonizeResults?: boolean; + context?: DefaultContext; + errorPolicy?: ErrorPolicy; + fetchPolicy?: FetchPolicy; + notifyOnNetworkStatusChange?: boolean; + pollInterval?: number; + query: DocumentNode | TypedDocumentNode; + returnPartialData?: boolean; + variables?: TVariables; +} + +// @public (undocumented) +type QueryStoreValue = Pick; + +// @public (undocumented) +interface ReadFieldFunction { + // Warning: (ae-forgotten-export) The symbol "ReadFieldOptions" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "SafeReadonly" needs to be exported by the entry point index.d.ts + // + // (undocumented) + (options: ReadFieldOptions): SafeReadonly | undefined; + // (undocumented) + (fieldName: string, from?: StoreObject | Reference): SafeReadonly | undefined; +} + +// Warning: (ae-forgotten-export) The symbol "FieldSpecifier" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +interface ReadFieldOptions extends FieldSpecifier { + // (undocumented) + from?: StoreObject | Reference; +} + +// @public (undocumented) +interface Reference { + // (undocumented) + readonly __ref: string; +} + +// @public (undocumented) +type RefetchQueriesInclude = RefetchQueryDescriptor[] | RefetchQueriesIncludeShorthand; + +// @public (undocumented) +type RefetchQueriesIncludeShorthand = "all" | "active"; + +// @public (undocumented) +interface RefetchQueriesOptions, TResult> { + // (undocumented) + include?: RefetchQueriesInclude; + // (undocumented) + onQueryUpdated?: OnQueryUpdated | null; + // (undocumented) + optimistic?: boolean; + // (undocumented) + updateCache?: (cache: TCache) => void; +} + +// Warning: (ae-forgotten-export) The symbol "IsStrictlyAny" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type RefetchQueriesPromiseResults = IsStrictlyAny extends true ? any[] : TResult extends boolean ? ApolloQueryResult[] : TResult extends PromiseLike ? U[] : TResult[]; + +// Warning: (ae-forgotten-export) The symbol "RefetchQueriesPromiseResults" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +interface RefetchQueriesResult extends Promise> { + // (undocumented) + queries: ObservableQuery[]; + // (undocumented) + results: InternalRefetchQueriesResult[]; +} + +// @public (undocumented) +type RefetchQueryDescriptor = string | DocumentNode; + +// @public (undocumented) +type RefetchWritePolicy = "merge" | "overwrite"; + +// @public (undocumented) +type RemoveFragmentName = T extends any ? Omit : T; + +// @public (undocumented) +type RemoveIndexSignature = { + [K in keyof T as string extends K ? never : number extends K ? never : symbol extends K ? never : K]: T[K]; +}; + +// @public (undocumented) +type RemoveMaskedMarker = Omit; + +// @public (undocumented) +type RequestHandler = (operation: Operation, forward: NextLink) => Observable | null; + +// @public (undocumented) +type Resolver = (rootValue?: any, args?: any, context?: any, info?: { + field: FieldNode; + fragmentMap: FragmentMap; +}) => any; + +// @public (undocumented) +interface Resolvers { + // (undocumented) + [key: string]: { + [field: string]: Resolver; + }; +} + +// Warning: (ae-forgotten-export) The symbol "CovariantUnaryFunction" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type ResultFunction> = CovariantUnaryFunction; + +// @public (undocumented) +type SafeReadonly = T extends object ? Readonly : T; + +// @public (undocumented) +type ServerError = Error & { + response: Response; + result: Record | string; + statusCode: number; +}; + +// @public (undocumented) +type ServerParseError = Error & { + response: Response; + statusCode: number; + bodyText: string; +}; + +// @public (undocumented) +interface SharedWatchQueryOptions { + // @deprecated + canonizeResults?: boolean; + context?: DefaultContext; + errorPolicy?: ErrorPolicy; + fetchPolicy?: WatchQueryFetchPolicy; + initialFetchPolicy?: WatchQueryFetchPolicy; + // Warning: (ae-forgotten-export) The symbol "NextFetchPolicyContext" needs to be exported by the entry point index.d.ts + nextFetchPolicy?: WatchQueryFetchPolicy | ((this: WatchQueryOptions, currentFetchPolicy: WatchQueryFetchPolicy, context: NextFetchPolicyContext) => WatchQueryFetchPolicy); + notifyOnNetworkStatusChange?: boolean; + pollInterval?: number; + // Warning: (ae-forgotten-export) The symbol "RefetchWritePolicy" needs to be exported by the entry point index.d.ts + refetchWritePolicy?: RefetchWritePolicy; + returnPartialData?: boolean; + skipPollAttempt?: () => boolean; + variables?: TVariables; +} + +// @public (undocumented) +interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { + // (undocumented) + context?: TContext; + // (undocumented) + data?: TData | null; + // (undocumented) + errors?: ReadonlyArray; + // (undocumented) + extensions?: TExtensions; +} + +// @public (undocumented) +type Source = MaybeAsync>; + +// @public (undocumented) +type StorageType = Record; + +// @public (undocumented) +interface StoreObject { + // (undocumented) + [storeFieldName: string]: StoreValue; + // (undocumented) + __typename?: string; +} + +// Warning: (ae-forgotten-export) The symbol "AsStoreObject" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type StoreObjectValueMaybeReference = StoreVal extends Array> ? StoreVal extends Array ? [ +Item +] extends [Record] ? ReadonlyArray | Reference> : never : never : StoreVal extends Record ? AsStoreObject | Reference : StoreVal; + +// @public (undocumented) +type StoreValue = number | string | string[] | Reference | Reference[] | null | undefined | void | Object; + +// @public (undocumented) +type SubscribeToMoreOptions = { + document: DocumentNode | TypedDocumentNode; + variables?: TSubscriptionVariables; + updateQuery?: UpdateQueryFn; + onError?: (error: Error) => void; + context?: DefaultContext; +}; + +// @public (undocumented) +interface SubscriptionOptions { + context?: DefaultContext; + errorPolicy?: ErrorPolicy; + extensions?: Record; + fetchPolicy?: FetchPolicy; + query: DocumentNode | TypedDocumentNode; + variables?: TVariables; +} + +// Warning: (ae-forgotten-export) The symbol "unionToIntersection" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type takeOneFromUnion = unionToIntersection 0 : never> extends ((x: infer U) => 0) ? U : never; + +// @public (undocumented) +type ToReferenceFunction = (objOrIdOrRef: StoreObject | string | Reference, mergeIntoStore?: boolean) => Reference | undefined; + +// @public (undocumented) +type Transaction = (c: ApolloCache) => void; + +// @public (undocumented) +interface TransformCacheEntry { + // (undocumented) + asQuery: DocumentNode; + // (undocumented) + clientQuery: DocumentNode | null; + // (undocumented) + defaultVars: OperationVariables; + // (undocumented) + hasClientExports: boolean; + // (undocumented) + hasForcedResolvers: boolean; + // (undocumented) + hasNonreactiveDirective: boolean; + // (undocumented) + nonReactiveQuery: DocumentNode; + // (undocumented) + serverQuery: DocumentNode | null; +} + +// @public (undocumented) +type TransformFn = (document: DocumentNode) => DocumentNode; + +// @public (undocumented) +type UnionForAny = T extends never ? "a" : 1; + +// @public (undocumented) +type UnionToIntersection = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; + +// @public (undocumented) +type unionToIntersection = (T extends unknown ? (x: T) => unknown : never) extends ((x: infer U) => unknown) ? U : never; + +// Warning: (ae-forgotten-export) The symbol "ContainsFragmentsRefs" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "UnwrapFragmentRefs" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "RemoveFragmentName" needs to be exported by the entry point index.d.ts +// +// @public +type Unmasked = true extends IsAny ? TData : TData extends object ? true extends ContainsFragmentsRefs ? UnwrapFragmentRefs>> : TData : TData; + +// @public (undocumented) +type UnwrapFragmentRefs = true extends IsAny ? TData : TData extends any ? TData extends Primitive ? TData : string extends keyof TData ? TData : keyof TData extends never ? TData : TData extends { + " $fragmentRefs"?: infer FragmentRefs; +} ? UnwrapFragmentRefs | RemoveFragmentName[keyof NonNullable]>>>> : TData extends object ? { + [K in keyof TData]: UnwrapFragmentRefs; +} : TData : never; + +// @public (undocumented) +type UpdateQueries = MutationOptions["updateQueries"]; + +// @public (undocumented) +type UpdateQueryFn = (previousQueryResult: Unmasked, options: { + subscriptionData: { + data: Unmasked; + }; + variables?: TSubscriptionVariables; +}) => Unmasked; + +// @public (undocumented) +interface UriFunction { + // (undocumented) + (operation: Operation): string; +} + +// @public (undocumented) +type VariableMatcher> = CovariantUnaryFunction; + +// @public +interface WatchFragmentOptions { + fragment: DocumentNode | TypedDocumentNode; + fragmentName?: string; + // Warning: (ae-forgotten-export) The symbol "FragmentType" needs to be exported by the entry point index.d.ts + from: StoreObject | Reference | FragmentType> | string; + optimistic?: boolean; + variables?: TVars; +} + +// @public +type WatchFragmentResult = { + data: MaybeMasked; + complete: true; + missing?: never; +} | { + data: DeepPartial>; + complete: false; + missing: MissingTree; +}; + +// @public (undocumented) +type WatchQueryFetchPolicy = FetchPolicy | "cache-and-network"; + +// Warning: (ae-forgotten-export) The symbol "SharedWatchQueryOptions" needs to be exported by the entry point index.d.ts +// +// @public +interface WatchQueryOptions extends SharedWatchQueryOptions { + query: DocumentNode | TypedDocumentNode; +} + +// Warnings were encountered during analysis: +// +// src/cache/core/types/DataProxy.ts:147:7 - (ae-forgotten-export) The symbol "MissingFieldError" needs to be exported by the entry point index.d.ts +// src/cache/core/types/common.ts:101:3 - (ae-forgotten-export) The symbol "ReadFieldFunction" needs to be exported by the entry point index.d.ts +// src/cache/core/types/common.ts:102:3 - (ae-forgotten-export) The symbol "CanReadFunction" needs to be exported by the entry point index.d.ts +// src/cache/core/types/common.ts:103:3 - (ae-forgotten-export) The symbol "isReference" needs to be exported by the entry point index.d.ts +// src/cache/core/types/common.ts:104:3 - (ae-forgotten-export) The symbol "ToReferenceFunction" needs to be exported by the entry point index.d.ts +// src/cache/core/types/common.ts:105:3 - (ae-forgotten-export) The symbol "StorageType" needs to be exported by the entry point index.d.ts +// src/core/LocalState.ts:46:5 - (ae-forgotten-export) The symbol "FragmentMap" needs to be exported by the entry point index.d.ts +// src/core/LocalState.ts:71:3 - (ae-forgotten-export) The symbol "ApolloClient" needs to be exported by the entry point index.d.ts +// src/core/ObservableQuery.ts:120:5 - (ae-forgotten-export) The symbol "QueryManager" needs to be exported by the entry point index.d.ts +// src/core/ObservableQuery.ts:121:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts +// src/core/QueryManager.ts:159:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts +// src/core/QueryManager.ts:414:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts +// src/core/types.ts:175:3 - (ae-forgotten-export) The symbol "MutationQueryReducer" needs to be exported by the entry point index.d.ts +// src/core/types.ts:204:5 - (ae-forgotten-export) The symbol "Resolver" needs to be exported by the entry point index.d.ts +// src/core/watchQueryOptions.ts:271:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts + +// (No @packageDocumentation comment for this package) + +``` diff --git a/.api-reports/api-report.api.md b/.api-reports/api-report.api.md index 9c6c1f1f2ea..cf7e1713adc 100644 --- a/.api-reports/api-report.api.md +++ b/.api-reports/api-report.api.md @@ -20,14 +20,12 @@ import { InvariantError } from 'ts-invariant'; import { Observable } from 'zen-observable-ts'; import type { Subscription as ObservableSubscription } from 'zen-observable-ts'; import type { Observer } from 'zen-observable-ts'; -import type * as ReactTypes from 'react'; import { resetCaches } from 'graphql-tag'; import type { SelectionSetNode } from 'graphql'; import { setVerbosity as setLogVerbosity } from 'ts-invariant'; import type { Subscriber } from 'zen-observable-ts'; import { Trie } from '@wry/trie'; import { TypedDocumentNode } from '@graphql-typed-document-node/core'; -import type { VariableDefinitionNode } from 'graphql'; // Warning: (ae-forgotten-export) The symbol "Modifier" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "StoreObjectValueMaybeReference" needs to be exported by the entry point index.d.ts @@ -181,27 +179,6 @@ export interface ApolloClientOptions { version?: string; } -// Warning: (ae-forgotten-export) The symbol "ApolloConsumerProps" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export const ApolloConsumer: ReactTypes.FC; - -// @public (undocumented) -interface ApolloConsumerProps { - // (undocumented) - children: (client: ApolloClient) => ReactTypes.ReactNode; -} - -// @public (undocumented) -export interface ApolloContextValue { - // (undocumented) - client?: ApolloClient; - // Warning: (ae-forgotten-export) The symbol "RenderPromises" needs to be exported by the entry point index.d.ts - // - // (undocumented) - renderPromises?: RenderPromises; -} - // @public (undocumented) export class ApolloError extends Error { // Warning: (ae-forgotten-export) The symbol "ApolloErrorOptions" needs to be exported by the entry point index.d.ts @@ -287,19 +264,6 @@ export interface ApolloPayloadResult, TExtensions = payload: SingleExecutionResult | ExecutionPatchResult | null; } -// Warning: (ae-forgotten-export) The symbol "ApolloProviderProps" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export const ApolloProvider: ReactTypes.FC>; - -// @public (undocumented) -interface ApolloProviderProps { - // (undocumented) - children: ReactTypes.ReactNode | ReactTypes.ReactNode[] | null; - // (undocumented) - client: ApolloClient; -} - // @public (undocumented) export interface ApolloQueryResult { // (undocumented) @@ -327,62 +291,6 @@ type AsStoreObject; - -// @public (undocumented) -export interface BackgroundQueryHookOptions extends Pick, "client" | "variables" | "errorPolicy" | "context" | "canonizeResults" | "returnPartialData" | "refetchWritePolicy"> { - // (undocumented) - fetchPolicy?: BackgroundQueryHookFetchPolicy; - // (undocumented) - queryKey?: string | number | any[]; - // @deprecated - skip?: boolean; -} - -// @public (undocumented) -type BackgroundQueryHookOptionsNoInfer = BackgroundQueryHookOptions, NoInfer_2>; - -// Warning: (ae-forgotten-export) The symbol "MutationSharedOptions" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export interface BaseMutationOptions = ApolloCache> extends MutationSharedOptions { - client?: ApolloClient; - ignoreResults?: boolean; - notifyOnNetworkStatusChange?: boolean; - onCompleted?: (data: MaybeMasked, clientOptions?: BaseMutationOptions) => void; - onError?: (error: ApolloError, clientOptions?: BaseMutationOptions) => void; -} - -// Warning: (ae-forgotten-export) The symbol "SharedWatchQueryOptions" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export interface BaseQueryOptions extends SharedWatchQueryOptions { - client?: ApolloClient; - context?: DefaultContext; - ssr?: boolean; -} - -// @public (undocumented) -export interface BaseSubscriptionOptions { - client?: ApolloClient; - context?: DefaultContext; - errorPolicy?: ErrorPolicy; - extensions?: Record; - fetchPolicy?: FetchPolicy; - ignoreResults?: boolean; - onComplete?: () => void; - onData?: (options: OnDataOptions) => any; - onError?: (error: ApolloError) => void; - // @deprecated - onSubscriptionComplete?: () => void; - // @deprecated - onSubscriptionData?: (options: OnSubscriptionDataOptions) => any; - shouldResubscribe?: boolean | ((options: BaseSubscriptionOptions) => boolean); - skip?: boolean; - variables?: TVariables; -} - // @public (undocumented) interface Body_2 { // (undocumented) @@ -544,11 +452,6 @@ type CombineIntersection = Exclude>; -// @public (undocumented) -export type CommonOptions = TOptions & { - client?: ApolloClient; -}; - // @public (undocumented) class Concast extends Observable { // Warning: (ae-forgotten-export) The symbol "MaybeAsync" needs to be exported by the entry point index.d.ts @@ -586,9 +489,6 @@ type ContainsFragmentsRefs = true extends (IsAny) ? // @public (undocumented) export const createHttpLink: (linkOptions?: HttpOptions) => ApolloLink; -// @public -export function createQueryPreloader(client: ApolloClient): PreloadQueryFunction; - // @public @deprecated (undocumented) export const createSignalIfSupported: () => { controller: boolean; @@ -701,10 +601,8 @@ type DeepPartialReadonlySet = {} & ReadonlySet>; type DeepPartialSet = {} & Set>; // @public (undocumented) -interface DefaultContext extends Record { +export interface DefaultContext extends Record { } -export { DefaultContext as Context } -export { DefaultContext } // Warning: (ae-forgotten-export) The symbol "KeyFieldsContext" needs to be exported by the entry point index.d.ts // @@ -787,17 +685,6 @@ interface DocumentTransformOptions { getCacheKey?: (document: DocumentNode) => DocumentTransformCacheKey | undefined; } -// @public (undocumented) -enum DocumentType_2 { - // (undocumented) - Mutation = 1, - // (undocumented) - Query = 0, - // (undocumented) - Subscription = 2 -} -export { DocumentType_2 as DocumentType } - // @public (undocumented) export const empty: typeof ApolloLink.empty; @@ -964,14 +851,6 @@ export const fallbackHttpConfig: { }; }; -// @public (undocumented) -type FetchMoreFunction = (fetchMoreOptions: FetchMoreQueryOptions & { - updateQuery?: (previousQueryResult: Unmasked, options: { - fetchMoreResult: Unmasked; - variables: TVariables; - }) => Unmasked; -}) => Promise>>; - // @public (undocumented) export interface FetchMoreOptions { // (undocumented) @@ -1150,9 +1029,6 @@ const getApolloClientMemoryInternals: (() => { }; }) | undefined; -// @public (undocumented) -export function getApolloContext(): ReactTypes.Context; - // @internal const getInMemoryCacheMemoryInternals: (() => { addTypenameDocumentTransform: { @@ -1245,16 +1121,6 @@ export interface IdGetterObj extends Object { _id?: string; } -// @public (undocumented) -export interface IDocumentDefinition { - // (undocumented) - name: string; - // (undocumented) - type: DocumentType_2; - // (undocumented) - variables: ReadonlyArray; -} - // @public (undocumented) interface IgnoreModifier { // (undocumented) @@ -1454,53 +1320,6 @@ class Layer extends EntityStore { toObject(): NormalizedCacheObject; } -// @public (undocumented) -export type LazyQueryExecFunction = (options?: Partial>) => Promise>; - -// @public (undocumented) -export interface LazyQueryHookExecOptions extends LazyQueryHookOptions { - // (undocumented) - query?: DocumentNode | TypedDocumentNode; -} - -// @public (undocumented) -export interface LazyQueryHookOptions extends BaseQueryOptions { - // @internal (undocumented) - defaultOptions?: Partial>; - onCompleted?: (data: MaybeMasked) => void; - onError?: (error: ApolloError) => void; -} - -// @public @deprecated (undocumented) -export type LazyQueryResult = QueryResult; - -// @public (undocumented) -export type LazyQueryResultTuple = [ -execute: LazyQueryExecFunction, -result: QueryResult -]; - -// @public (undocumented) -export type LoadableQueryHookFetchPolicy = Extract; - -// @public (undocumented) -export interface LoadableQueryHookOptions { - // @deprecated - canonizeResults?: boolean; - client?: ApolloClient; - context?: DefaultContext; - errorPolicy?: ErrorPolicy; - fetchPolicy?: LoadableQueryHookFetchPolicy; - queryKey?: string | number | any[]; - refetchWritePolicy?: RefetchWritePolicy; - returnPartialData?: boolean; -} - -// Warning: (ae-forgotten-export) The symbol "OnlyRequiredProperties" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export type LoadQueryFunction = (...args: [TVariables] extends [never] ? [] : {} extends OnlyRequiredProperties ? [variables?: TVariables] : [variables: TVariables]) => void; - // @public (undocumented) class LocalState { // Warning: (ae-forgotten-export) The symbol "LocalStateOptions" needs to be exported by the entry point index.d.ts @@ -1713,6 +1532,7 @@ interface MutationBaseOptions; + // Warning: (ae-forgotten-export) The symbol "NoInfer_2" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "IgnoreModifier" needs to be exported by the entry point index.d.ts optimisticResponse?: Unmasked> | ((vars: TVariables, { IGNORE }: { IGNORE: IgnoreModifier; @@ -1723,27 +1543,11 @@ interface MutationBaseOptions = ApolloCache> extends BaseMutationOptions { - // (undocumented) - mutation: DocumentNode | TypedDocumentNode; -} - // @public (undocumented) export type MutationFetchPolicy = Extract; -// @public (undocumented) -export type MutationFunction = ApolloCache> = (options?: MutationFunctionOptions) => Promise>>; - -// @public (undocumented) -export interface MutationFunctionOptions = ApolloCache> extends BaseMutationOptions { - mutation?: DocumentNode | TypedDocumentNode; -} - -// @public (undocumented) -export interface MutationHookOptions = ApolloCache> extends BaseMutationOptions { -} - +// Warning: (ae-forgotten-export) The symbol "MutationSharedOptions" needs to be exported by the entry point index.d.ts +// // @public (undocumented) export interface MutationOptions = ApolloCache> extends MutationSharedOptions { mutation: DocumentNode | TypedDocumentNode; @@ -1763,16 +1567,6 @@ export type MutationQueryReducersMap; }; -// @public (undocumented) -export interface MutationResult { - called: boolean; - client: ApolloClient; - data?: MaybeMasked | null; - error?: ApolloError; - loading: boolean; - reset: () => void; -} - // Warning: (ae-forgotten-export) The symbol "MutationBaseOptions" needs to be exported by the entry point index.d.ts // // @public (undocumented) @@ -1793,12 +1587,6 @@ interface MutationStoreValue { variables: Record; } -// @public (undocumented) -export type MutationTuple = ApolloCache> = [ -mutate: (options?: MutationFunctionOptions) => Promise>>, -result: MutationResult -]; - // @public @deprecated (undocumented) export type MutationUpdaterFn // @public type NoInfer_2 = [T][T extends any ? 0 : never]; -export { NoInfer_2 as NoInfer } // @public export interface NormalizedCache { @@ -1950,52 +1737,13 @@ export class ObservableQuery { - fetchMore: (fetchMoreOptions: FetchMoreQueryOptions & { - updateQuery?: (previousQueryResult: Unmasked, options: { - fetchMoreResult: Unmasked; - variables: TFetchVars; - }) => Unmasked; - }) => Promise>>; - refetch: (variables?: Partial) => Promise>>; - // @internal (undocumented) - reobserve: (newOptions?: Partial>, newNetworkStatus?: NetworkStatus) => Promise>>; - startPolling: (pollInterval: number) => void; - stopPolling: () => void; - subscribeToMore: (options: SubscribeToMoreOptions) => () => void; - updateQuery: (mapFn: (previousQueryResult: Unmasked, options: Pick, "variables">) => Unmasked) => void; - variables: TVariables | undefined; -} - export { ObservableSubscription } export { Observer } -// @public (undocumented) -export interface OnDataOptions { - // (undocumented) - client: ApolloClient; - // (undocumented) - data: SubscriptionResult; -} - -// @public -type OnlyRequiredProperties = { - [K in keyof T as {} extends Pick ? never : K]: T[K]; -}; - // @public (undocumented) export type OnQueryUpdated = (observableQuery: ObservableQuery, diff: Cache_2.DiffResult, lastDiff: Cache_2.DiffResult | undefined) => boolean | TResult; -// @public (undocumented) -export interface OnSubscriptionDataOptions { - // (undocumented) - client: ApolloClient; - // (undocumented) - subscriptionData: SubscriptionResult; -} - // @public (undocumented) export interface Operation { // (undocumented) @@ -2015,9 +1763,6 @@ export interface Operation { variables: Record; } -// @public (undocumented) -export function operationName(type: DocumentType_2): string; - // @public (undocumented) export type OperationVariables = Record; @@ -2034,15 +1779,6 @@ type OptionsUnion = Watc // @public (undocumented) export function parseAndCheckHttpResponse(operations: Operation | Operation[]): (response: Response) => Promise; -// @public (undocumented) -export function parser(document: DocumentNode): IDocumentDefinition; - -// @public (undocumented) -export namespace parser { - var // (undocumented) - resetCache: () => void; -} - // @public (undocumented) export type Path = ReadonlyArray; @@ -2093,52 +1829,6 @@ export type PossibleTypesMap = { [supertype: string]: string[]; }; -// @public -export interface PreloadedQueryRef extends QueryRef { - toPromise(): Promise>; -} - -// @public (undocumented) -export type PreloadQueryFetchPolicy = Extract; - -// @public -export interface PreloadQueryFunction { - // Warning: (ae-forgotten-export) The symbol "PreloadQueryOptionsArg" needs to be exported by the entry point index.d.ts - >(query: DocumentNode | TypedDocumentNode, ...[options]: PreloadQueryOptionsArg, TOptions>): PreloadedQueryRef | undefined : TData | undefined : TOptions["returnPartialData"] extends true ? DeepPartial : TData, TVariables>; - (query: DocumentNode | TypedDocumentNode, options: PreloadQueryOptions> & { - returnPartialData: true; - errorPolicy: "ignore" | "all"; - }): PreloadedQueryRef | undefined, TVariables>; - (query: DocumentNode | TypedDocumentNode, options: PreloadQueryOptions> & { - errorPolicy: "ignore" | "all"; - }): PreloadedQueryRef; - (query: DocumentNode | TypedDocumentNode, options: PreloadQueryOptions> & { - returnPartialData: true; - }): PreloadedQueryRef, TVariables>; - (query: DocumentNode | TypedDocumentNode, ...[options]: PreloadQueryOptionsArg>): PreloadedQueryRef; -} - -// Warning: (ae-forgotten-export) The symbol "VariablesOption" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export type PreloadQueryOptions = { - canonizeResults?: boolean; - context?: DefaultContext; - errorPolicy?: ErrorPolicy; - fetchPolicy?: PreloadQueryFetchPolicy; - returnPartialData?: boolean; - refetchWritePolicy?: RefetchWritePolicy; -} & VariablesOption; - -// @public (undocumented) -type PreloadQueryOptionsArg = [TVariables] extends [never] ? [ -options?: PreloadQueryOptions & TOptions -] : {} extends OnlyRequiredProperties ? [ -options?: PreloadQueryOptions> & Omit -] : [ -options: PreloadQueryOptions> & Omit -]; - // @public (undocumented) type Prettify = { [K in keyof T]: T[K]; @@ -2160,37 +1850,6 @@ interface Printer { (node: ASTNode, originalPrint: typeof print_2): string; } -// @public (undocumented) -const QUERY_REF_BRAND: unique symbol; - -// @public (undocumented) -interface QueryData { - // (undocumented) - fetchData(): Promise; - // (undocumented) - getOptions(): any; -} - -// @public (undocumented) -export interface QueryDataOptions extends QueryFunctionOptions { - // (undocumented) - children?: (result: QueryResult) => ReactTypes.ReactNode; - query: DocumentNode | TypedDocumentNode; -} - -// @public (undocumented) -export interface QueryFunctionOptions extends BaseQueryOptions { - // @internal (undocumented) - defaultOptions?: Partial>; - onCompleted?: (data: MaybeMasked) => void; - onError?: (error: ApolloError) => void; - skip?: boolean; -} - -// @public (undocumented) -export interface QueryHookOptions extends QueryFunctionOptions { -} - // @public (undocumented) class QueryInfo { constructor(queryManager: QueryManager, queryId?: string); @@ -2248,12 +1907,6 @@ class QueryInfo { variables?: Record; } -// @public @deprecated (undocumented) -export interface QueryLazyOptions { - context?: DefaultContext; - variables?: TVariables; -} - // @public (undocumented) export type QueryListener = (queryInfo: QueryInfo) => void; @@ -2421,38 +2074,9 @@ interface QueryOptions { export { QueryOptions as PureQueryOptions } export { QueryOptions } -// @public -export interface QueryRef { - // @internal (undocumented) - [QUERY_REF_BRAND]?(variables: TVariables): TData; -} - -// @public @deprecated (undocumented) -export interface QueryReference extends QueryRef { - // @deprecated (undocumented) - toPromise?: unknown; -} - -// @public (undocumented) -export interface QueryResult extends ObservableQueryFields { - called: boolean; - client: ApolloClient; - data: MaybeMasked | undefined; - error?: ApolloError; - // @deprecated (undocumented) - errors?: ReadonlyArray; - loading: boolean; - networkStatus: NetworkStatus; - observable: ObservableQuery; - previousData?: MaybeMasked; -} - // @public (undocumented) type QueryStoreValue = Pick; -// @public @deprecated (undocumented) -export type QueryTuple = LazyQueryResultTuple; - // @public (undocumented) type ReactiveListener = (value: T) => any; @@ -2511,12 +2135,6 @@ export interface Reference { readonly __ref: string; } -// @public (undocumented) -type RefetchFunction = ObservableQueryFields["refetch"]; - -// @public (undocumented) -export type RefetchQueriesFunction = (...args: any[]) => InternalRefetchQueriesInclude; - // @public (undocumented) export type RefetchQueriesInclude = RefetchQueryDescriptor[] | RefetchQueriesIncludeShorthand; @@ -2565,37 +2183,11 @@ type RemoveIndexSignature = { // @public (undocumented) type RemoveMaskedMarker = Omit; -// @public (undocumented) -class RenderPromises { - // (undocumented) - addObservableQueryPromise(obsQuery: ObservableQuery): ReactTypes.ReactNode; - // Warning: (ae-forgotten-export) The symbol "QueryData" needs to be exported by the entry point index.d.ts - // - // (undocumented) - addQueryPromise(queryInstance: QueryData, finish?: () => ReactTypes.ReactNode): ReactTypes.ReactNode; - // (undocumented) - consumeAndAwaitPromises(): Promise; - // (undocumented) - getSSRObservable(props: QueryDataOptions): ObservableQuery | null; - // (undocumented) - hasPromises(): boolean; - // (undocumented) - registerSSRObservable(observable: ObservableQuery): void; - // (undocumented) - stop(): void; -} - // @public (undocumented) export type RequestHandler = (operation: Operation, forward: NextLink) => Observable | null; -// @public @deprecated (undocumented) -export const resetApolloContext: typeof getApolloContext; - export { resetCaches } -// @public (undocumented) -type ResetFunction = () => void; - // @public (undocumented) export type Resolver = (rootValue?: any, args?: any, context?: any, info?: { field: FieldNode; @@ -2690,12 +2282,6 @@ export interface SingleExecutionResult, TContext = D extensions?: TExtensions; } -// @public (undocumented) -export type SkipToken = typeof skipToken; - -// @public (undocumented) -export const skipToken: unique symbol; - // @public (undocumented) type Source = MaybeAsync>; @@ -2732,9 +2318,6 @@ class Stump extends Layer { removeLayer(): this; } -// @public (undocumented) -type SubscribeToMoreFunction = ObservableQueryFields["subscribeToMore"]; - // @public (undocumented) export type SubscribeToMoreOptions = { document: DocumentNode | TypedDocumentNode; @@ -2744,26 +2327,6 @@ export type SubscribeToMoreOptions; - // (undocumented) - subscription?: ObservableSubscription; -} - -// @public @deprecated (undocumented) -export interface SubscriptionDataOptions extends BaseSubscriptionOptions { - // (undocumented) - children?: null | ((result: SubscriptionResult) => ReactTypes.ReactNode); - // (undocumented) - subscription: DocumentNode | TypedDocumentNode; -} - -// @public (undocumented) -export interface SubscriptionHookOptions extends BaseSubscriptionOptions { -} - // @public (undocumented) export interface SubscriptionOptions { context?: DefaultContext; @@ -2774,34 +2337,6 @@ export interface SubscriptionOptions { - data?: MaybeMasked; - error?: ApolloError; - loading: boolean; - // @internal (undocumented) - variables?: TVariables; -} - -// @public (undocumented) -export type SuspenseQueryHookFetchPolicy = Extract; - -// @public (undocumented) -export interface SuspenseQueryHookOptions { - // @deprecated - canonizeResults?: boolean; - client?: ApolloClient; - context?: DefaultContext; - errorPolicy?: ErrorPolicy; - fetchPolicy?: SuspenseQueryHookFetchPolicy; - queryKey?: string | number | any[]; - refetchWritePolicy?: RefetchWritePolicy; - returnPartialData?: boolean; - // @deprecated - skip?: boolean; - variables?: TVariables; -} - // Warning: (ae-forgotten-export) The symbol "unionToIntersection" needs to be exported by the entry point index.d.ts // // @public (undocumented) @@ -2907,254 +2442,6 @@ export interface UriFunction { (operation: Operation): string; } -// @public (undocumented) -export function useApolloClient(override?: ApolloClient): ApolloClient; - -// Warning: (ae-forgotten-export) The symbol "BackgroundQueryHookOptionsNoInfer" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export function useBackgroundQuery, "variables">>(query: DocumentNode | TypedDocumentNode, options?: BackgroundQueryHookOptionsNoInfer & TOptions): [ -(QueryRef | undefined : TData | undefined : TOptions["returnPartialData"] extends true ? DeepPartial : TData, TVariables> | (TOptions["skip"] extends boolean ? undefined : never)), -UseBackgroundQueryResult -]; - -// @public (undocumented) -export function useBackgroundQuery(query: DocumentNode | TypedDocumentNode, options: BackgroundQueryHookOptionsNoInfer & { - returnPartialData: true; - errorPolicy: "ignore" | "all"; -}): [ -QueryRef | undefined, TVariables>, -UseBackgroundQueryResult -]; - -// @public (undocumented) -export function useBackgroundQuery(query: DocumentNode | TypedDocumentNode, options: BackgroundQueryHookOptionsNoInfer & { - errorPolicy: "ignore" | "all"; -}): [ -QueryRef, -UseBackgroundQueryResult -]; - -// @public (undocumented) -export function useBackgroundQuery(query: DocumentNode | TypedDocumentNode, options: BackgroundQueryHookOptionsNoInfer & { - skip: boolean; - returnPartialData: true; -}): [ -QueryRef, TVariables> | undefined, -UseBackgroundQueryResult -]; - -// @public (undocumented) -export function useBackgroundQuery(query: DocumentNode | TypedDocumentNode, options: BackgroundQueryHookOptionsNoInfer & { - returnPartialData: true; -}): [ -QueryRef, TVariables>, -UseBackgroundQueryResult -]; - -// @public (undocumented) -export function useBackgroundQuery(query: DocumentNode | TypedDocumentNode, options: BackgroundQueryHookOptionsNoInfer & { - skip: boolean; -}): [ -QueryRef | undefined, -UseBackgroundQueryResult -]; - -// @public (undocumented) -export function useBackgroundQuery(query: DocumentNode | TypedDocumentNode, options?: BackgroundQueryHookOptionsNoInfer): [QueryRef, UseBackgroundQueryResult]; - -// @public (undocumented) -export function useBackgroundQuery(query: DocumentNode | TypedDocumentNode, options: SkipToken): [undefined, UseBackgroundQueryResult]; - -// @public (undocumented) -export function useBackgroundQuery(query: DocumentNode | TypedDocumentNode, options: SkipToken | (BackgroundQueryHookOptionsNoInfer & { - returnPartialData: true; -})): [ -QueryRef, TVariables> | undefined, -UseBackgroundQueryResult -]; - -// @public (undocumented) -export function useBackgroundQuery(query: DocumentNode | TypedDocumentNode, options?: SkipToken | BackgroundQueryHookOptionsNoInfer): [ -QueryRef | undefined, -UseBackgroundQueryResult -]; - -// @public (undocumented) -export type UseBackgroundQueryResult = { - subscribeToMore: SubscribeToMoreFunction; - fetchMore: FetchMoreFunction; - refetch: RefetchFunction; -}; - -// @public (undocumented) -export function useFragment(options: UseFragmentOptions): UseFragmentResult; - -// @public (undocumented) -export interface UseFragmentOptions extends Omit, NoInfer_2>, "id" | "query" | "optimistic" | "previousResult" | "returnPartialData">, Omit, "id" | "variables" | "returnPartialData"> { - client?: ApolloClient; - // (undocumented) - from: StoreObject | Reference | FragmentType> | string | null; - // (undocumented) - optimistic?: boolean; -} - -// @public (undocumented) -export type UseFragmentResult = { - data: MaybeMasked; - complete: true; - missing?: never; -} | { - data: DeepPartial>; - complete: false; - missing?: MissingTree; -}; - -// @public -export function useLazyQuery(query: DocumentNode | TypedDocumentNode, options?: LazyQueryHookOptions, NoInfer_2>): LazyQueryResultTuple; - -// @public (undocumented) -export function useLoadableQuery(query: DocumentNode | TypedDocumentNode, options?: LoadableQueryHookOptions & TOptions): UseLoadableQueryResult | undefined : TData | undefined : TOptions["returnPartialData"] extends true ? DeepPartial : TData, TVariables>; - -// @public (undocumented) -export function useLoadableQuery(query: DocumentNode | TypedDocumentNode, options: LoadableQueryHookOptions & { - returnPartialData: true; - errorPolicy: "ignore" | "all"; -}): UseLoadableQueryResult | undefined, TVariables>; - -// @public (undocumented) -export function useLoadableQuery(query: DocumentNode | TypedDocumentNode, options: LoadableQueryHookOptions & { - errorPolicy: "ignore" | "all"; -}): UseLoadableQueryResult; - -// @public (undocumented) -export function useLoadableQuery(query: DocumentNode | TypedDocumentNode, options: LoadableQueryHookOptions & { - returnPartialData: true; -}): UseLoadableQueryResult, TVariables>; - -// @public -export function useLoadableQuery(query: DocumentNode | TypedDocumentNode, options?: LoadableQueryHookOptions): UseLoadableQueryResult; - -// @public (undocumented) -export type UseLoadableQueryResult = [ -loadQuery: LoadQueryFunction, -queryRef: QueryRef | null, -handlers: { - fetchMore: FetchMoreFunction; - refetch: RefetchFunction; - subscribeToMore: SubscribeToMoreFunction; - reset: ResetFunction; -} -]; - -// @public -export function useMutation = ApolloCache>(mutation: DocumentNode | TypedDocumentNode, options?: MutationHookOptions, NoInfer_2, TContext, TCache>): MutationTuple; - -// @public -export function useQuery(query: DocumentNode | TypedDocumentNode, options?: QueryHookOptions, NoInfer_2>): QueryResult; - -// @public -export function useQueryRefHandlers(queryRef: QueryRef): UseQueryRefHandlersResult; - -// @public (undocumented) -export interface UseQueryRefHandlersResult { - fetchMore: FetchMoreFunction; - refetch: RefetchFunction; - subscribeToMore: SubscribeToMoreFunction; -} - -// @public -export function useReactiveVar(rv: ReactiveVar): T; - -// @public (undocumented) -export function useReadQuery(queryRef: QueryRef): UseReadQueryResult; - -// @public (undocumented) -export interface UseReadQueryResult { - data: MaybeMasked; - error: ApolloError | undefined; - networkStatus: NetworkStatus; -} - -// @public -export function useSubscription(subscription: DocumentNode | TypedDocumentNode, options?: SubscriptionHookOptions, NoInfer_2>): { - restart: () => void; - loading: boolean; - data?: TData | undefined; - error?: ApolloError; - variables?: TVariables | undefined; -}; - -// @public (undocumented) -export function useSuspenseQuery, "variables">>(query: DocumentNode | TypedDocumentNode, options?: SuspenseQueryHookOptions, NoInfer_2> & TOptions): UseSuspenseQueryResult | undefined : TData | undefined : TOptions["returnPartialData"] extends true ? TOptions["skip"] extends boolean ? DeepPartial | undefined : DeepPartial : TOptions["skip"] extends boolean ? TData | undefined : TData, TVariables>; - -// @public (undocumented) -export function useSuspenseQuery(query: DocumentNode | TypedDocumentNode, options: SuspenseQueryHookOptions, NoInfer_2> & { - returnPartialData: true; - errorPolicy: "ignore" | "all"; -}): UseSuspenseQueryResult | undefined, TVariables>; - -// @public (undocumented) -export function useSuspenseQuery(query: DocumentNode | TypedDocumentNode, options: SuspenseQueryHookOptions, NoInfer_2> & { - errorPolicy: "ignore" | "all"; -}): UseSuspenseQueryResult; - -// @public (undocumented) -export function useSuspenseQuery(query: DocumentNode | TypedDocumentNode, options: SuspenseQueryHookOptions, NoInfer_2> & { - skip: boolean; - returnPartialData: true; -}): UseSuspenseQueryResult | undefined, TVariables>; - -// @public (undocumented) -export function useSuspenseQuery(query: DocumentNode | TypedDocumentNode, options: SuspenseQueryHookOptions, NoInfer_2> & { - returnPartialData: true; -}): UseSuspenseQueryResult, TVariables>; - -// @public (undocumented) -export function useSuspenseQuery(query: DocumentNode | TypedDocumentNode, options: SuspenseQueryHookOptions, NoInfer_2> & { - skip: boolean; -}): UseSuspenseQueryResult; - -// @public (undocumented) -export function useSuspenseQuery(query: DocumentNode | TypedDocumentNode, options?: SuspenseQueryHookOptions, NoInfer_2>): UseSuspenseQueryResult; - -// @public (undocumented) -export function useSuspenseQuery(query: DocumentNode | TypedDocumentNode, options: SkipToken | (SuspenseQueryHookOptions, NoInfer_2> & { - returnPartialData: true; -})): UseSuspenseQueryResult | undefined, TVariables>; - -// @public (undocumented) -export function useSuspenseQuery(query: DocumentNode | TypedDocumentNode, options?: SkipToken | SuspenseQueryHookOptions, NoInfer_2>): UseSuspenseQueryResult; - -// @public (undocumented) -export interface UseSuspenseQueryResult { - // (undocumented) - client: ApolloClient; - // (undocumented) - data: MaybeMasked; - // (undocumented) - error: ApolloError | undefined; - // (undocumented) - fetchMore: FetchMoreFunction; - // (undocumented) - networkStatus: NetworkStatus; - // (undocumented) - refetch: RefetchFunction; - // (undocumented) - subscribeToMore: SubscribeToMoreFunction; -} - -// @public (undocumented) -type VariablesOption = [ -TVariables -] extends [never] ? { - variables?: Record; -} : {} extends OnlyRequiredProperties ? { - variables?: TVariables; -} : { - variables: TVariables; -}; - // @public export interface WatchFragmentOptions { fragment: DocumentNode | TypedDocumentNode; @@ -3178,6 +2465,8 @@ export type WatchFragmentResult = { // @public (undocumented) export type WatchQueryFetchPolicy = FetchPolicy | "cache-and-network"; +// Warning: (ae-forgotten-export) The symbol "SharedWatchQueryOptions" needs to be exported by the entry point index.d.ts +// // @public export interface WatchQueryOptions extends SharedWatchQueryOptions { query: DocumentNode | TypedDocumentNode; @@ -3227,10 +2516,6 @@ interface WriteContext extends ReadMergeModifyContext { // src/core/QueryManager.ts:414:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts // src/core/watchQueryOptions.ts:271:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts // src/link/http/selectHttpOptionsAndBody.ts:128:32 - (ae-forgotten-export) The symbol "HttpQueryOptions" needs to be exported by the entry point index.d.ts -// src/react/hooks/useBackgroundQuery.ts:38:3 - (ae-forgotten-export) The symbol "SubscribeToMoreFunction" needs to be exported by the entry point index.d.ts -// src/react/hooks/useBackgroundQuery.ts:54:3 - (ae-forgotten-export) The symbol "FetchMoreFunction" needs to be exported by the entry point index.d.ts -// src/react/hooks/useBackgroundQuery.ts:78:4 - (ae-forgotten-export) The symbol "RefetchFunction" needs to be exported by the entry point index.d.ts -// src/react/hooks/useLoadableQuery.ts:120:9 - (ae-forgotten-export) The symbol "ResetFunction" needs to be exported by the entry point index.d.ts // (No @packageDocumentation comment for this package) diff --git a/.changeset/short-jokes-jam.md b/.changeset/short-jokes-jam.md new file mode 100644 index 00000000000..1b16841c79e --- /dev/null +++ b/.changeset/short-jokes-jam.md @@ -0,0 +1,27 @@ +--- +"@apollo/client": major +--- + +Moves all React-related exports to the `@apollo/client/react` entrypoint and out of the main `@apollo/client` entrypoint. This prevents the need to install React in order to use the core client. + +The following is a list of exports available in `@apollo/client` that should now import from `@apollo/client/react`. +- `ApolloConsumer` +- `ApolloProvider` +- `createQueryPreloader` +- `getApolloContext` +- `skipToken` +- `useApolloClient` +- `useBackgroundQuery` +- `useFragment` +- `useLazyQuery` +- `useLoadableQuery` +- `useMutation` +- `useQuery` +- `useQueryRefHandlers` +- `useReactiveVar` +- `useReadQuery` +- `useSubscription` +- `useSuspenseQuery` + +The following is a list of exports available in `@apollo/client/testing` that should now import from `@apollo/client/testing/react`: +- `MockedProvider` diff --git a/.size-limits.json b/.size-limits.json index d73904f5000..e5f66a45631 100644 --- a/.size-limits.json +++ b/.size-limits.json @@ -1,4 +1,4 @@ { - "dist/apollo-client.min.cjs": 41586, - "import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 34415 + "dist/apollo-client.min.cjs": 34273, + "import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 34391 } diff --git a/config/entryPoints.js b/config/entryPoints.js index 6098234e251..83ebae6adf9 100644 --- a/config/entryPoints.js +++ b/config/entryPoints.js @@ -27,6 +27,7 @@ const entryPoints = [ { dirs: ["testing"], extensions: [".js", ".jsx"] }, { dirs: ["testing", "core"] }, { dirs: ["testing", "experimental"] }, + { dirs: ["testing", "react"] }, { dirs: ["utilities"] }, { dirs: ["utilities", "subscriptions", "relay"] }, { dirs: ["utilities", "subscriptions", "urql"] }, diff --git a/docs/source/api/react/hooks.mdx b/docs/source/api/react/hooks.mdx index ccd11ecd1b0..e29ccecfa03 100644 --- a/docs/source/api/react/hooks.mdx +++ b/docs/source/api/react/hooks.mdx @@ -3,15 +3,15 @@ title: Hooks description: Apollo Client react hooks API reference minVersion: 3.0.0 api_doc: - - "@apollo/client!SuspenseQueryHookOptions:interface" - - "@apollo/client!useQuery:function(1)" - - "@apollo/client!useLazyQuery:function(1)" - - "@apollo/client!useMutation:function(1)" - - "@apollo/client!useSubscription:function(1)" - - "@apollo/client!useApolloClient:function(1)" - - "@apollo/client!useReactiveVar:function(1)" - - "@apollo/client!useLoadableQuery:function(5)" - - "@apollo/client!useQueryRefHandlers:function(1)" + - "@apollo/client/react!SuspenseQueryHookOptions:interface" + - "@apollo/client/react!useQuery:function(1)" + - "@apollo/client/react!useLazyQuery:function(1)" + - "@apollo/client/react!useMutation:function(1)" + - "@apollo/client/react!useSubscription:function(1)" + - "@apollo/client/react!useApolloClient:function(1)" + - "@apollo/client/react!useReactiveVar:function(1)" + - "@apollo/client/react!useLoadableQuery:function(5)" + - "@apollo/client/react!useQueryRefHandlers:function(1)" --- import UseFragmentOptions from '../../../shared/useFragment-options.mdx'; @@ -24,10 +24,10 @@ import { FunctionDetails, PropertySignatureTable, ManualTuple, InterfaceDetails ## The `ApolloProvider` component -The `ApolloProvider` component leverages [React's Context API](https://react.dev/reference/react/useContext) to make a configured Apollo Client instance available throughout a React component tree. This component can be imported directly from the `@apollo/client` package. +The `ApolloProvider` component leverages [React's Context API](https://react.dev/reference/react/useContext) to make a configured Apollo Client instance available throughout a React component tree. This component can be imported directly from the `@apollo/client/react` package. ```js -import { ApolloProvider } from '@apollo/client'; +import { ApolloProvider } from '@apollo/client/react'; ``` ### Props @@ -59,7 +59,7 @@ One way to access the configured Apollo Client instance directly is to create an ### Example ```jsx -import { ApolloConsumer } from '@apollo/client'; +import { ApolloConsumer } from '@apollo/client/react'; function WithApolloClient() { return ( @@ -70,9 +70,9 @@ function WithApolloClient() { } ``` - + - + ```ts [execute: LazyQueryExecFunction, result: QueryResult] ``` @@ -89,7 +89,7 @@ function WithApolloClient() { The result of the query. See the `useQuery` hook for more details. @@ -97,7 +97,7 @@ function WithApolloClient() { ```ts @@ -257,7 +257,7 @@ function useSuspenseQuery( Instead of passing a `SuspenseQueryHookOptions` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useSuspenseQuery` hook from executing the query or suspending. @@ -278,12 +278,8 @@ For a detailed explanation of `useBackgroundQuery`, see the [fetching with Suspe ```jsx import { Suspense } from 'react'; -import { - ApolloClient, - InMemoryCache, - useBackgroundQuery, - useReadQuery, -} from '@apollo/client'; +import { ApolloClient, InMemoryCache } from '@apollo/client'; +import { useBackgroundQuery, useReadQuery } from '@apollo/client/react'; const query = gql` foo { @@ -400,7 +396,7 @@ function useReadQuery( ```ts @@ -428,7 +424,7 @@ function useReadQuery( idPrefix="useloadablequery-result" name="queryRef" type="QueryRef | null" - canonicalReference="@apollo/client!QueryRef:interface" + canonicalReference="@apollo/client/react!QueryRef:interface" > The `queryRef` used by `useReadQuery` to read the query result. @@ -442,7 +438,7 @@ function useReadQuery( - + @@ -454,7 +450,7 @@ While not a hook by itself, `skipToken` is designed to be used with `useSuspense If a `skipToken` is passed into one of those hooks instead of the `options` object, that hook will not cause any requests or suspenseful behavior, while keeping the last `data` available. ```js title="Recommended usage of skipToken with useSuspenseQuery" -import { skipToken, useSuspenseQuery } from '@apollo/client'; +import { skipToken, useSuspenseQuery } from '@apollo/client/react'; const { data } = useSuspenseQuery( query, id ? { variables: { id } } : skipToken @@ -463,7 +459,7 @@ const { data } = useSuspenseQuery( ```js title="Recommended usage of skipToken with useBackgroundQuery" -import { skipToken, useBackgroundQuery } from '@apollo/client'; +import { skipToken, useBackgroundQuery } from '@apollo/client/react'; const [queryRef] = useBackgroundQuery( query, id ? { variables: { id } } : skipToken diff --git a/docs/source/api/react/testing.md b/docs/source/api/react/testing.md index 20dec8db9bf..da06a3d93d4 100644 --- a/docs/source/api/react/testing.md +++ b/docs/source/api/react/testing.md @@ -11,7 +11,7 @@ api_reference: true ```js -import { MockedProvider } from "@apollo/client/testing"; +import { MockedProvider } from "@apollo/client/testing/react"; ``` The `MockedProvider` component is a mocked version of [`ApolloProvider`](./hooks/#the-apolloprovider-component) that doesn't send network requests to your API. Instead, it allows you to specify the exact response payload for a given GraphQL operation. This enables you to test your application's operations without communicating with a server. diff --git a/docs/source/data/mutations.mdx b/docs/source/data/mutations.mdx index 74ca8df88dc..78dddee3aea 100644 --- a/docs/source/data/mutations.mdx +++ b/docs/source/data/mutations.mdx @@ -2,8 +2,8 @@ title: Mutations in Apollo Client description: Modify data with the useMutation hook api_doc: - - "@apollo/client!MutationHookOptions:interface" - - "@apollo/client!MutationResult:interface" + - "@apollo/client/react!MutationHookOptions:interface" + - "@apollo/client/react!MutationResult:interface" --- import { PropertySignatureTable } from '../../shared/ApiDoc'; @@ -28,7 +28,8 @@ The `useMutation` [React hook](https://react.dev/reference/react) is the primary To execute a mutation, you first call `useMutation` within a React component and pass it the mutation you want to execute, like so: ```jsx {13} title="my-component.jsx" -import { gql, useMutation } from '@apollo/client'; +import { gql } from '@apollo/client'; +import { useMutation } from '@apollo/client/react'; // Define mutation const INCREMENT_COUNTER = gql` @@ -58,7 +59,8 @@ When your component renders, `useMutation` returns a tuple that includes: Let's say we're creating a to-do list application and we want the user to be able to add items to their list. First, we'll create a corresponding GraphQL mutation named `ADD_TODO`. Remember to wrap GraphQL strings in the `gql` function to parse them into query documents: ```jsx title="add-todo.jsx" -import { gql, useMutation } from '@apollo/client'; +import { gql } from '@apollo/client'; +import { useMutation } from '@apollo/client/react'; const ADD_TODO = gql` mutation AddTodo($type: String!) { @@ -382,7 +384,7 @@ detail with usage examples, see the [API reference](../api/react/hooks/). The `useMutation` hook accepts the following options: - + ### Result @@ -390,7 +392,7 @@ The `useMutation` result is a tuple with a mutate function in the first position You call the mutate function to trigger the mutation from your UI. - + ## Next steps diff --git a/docs/source/data/queries.mdx b/docs/source/data/queries.mdx index bd15ebf1a84..27956cb07dc 100644 --- a/docs/source/data/queries.mdx +++ b/docs/source/data/queries.mdx @@ -2,8 +2,8 @@ title: Queries description: Fetch data with the useQuery hook api_doc: - - "@apollo/client!QueryHookOptions:interface" - - "@apollo/client!QueryResult:interface" + - "@apollo/client/react!QueryHookOptions:interface" + - "@apollo/client/react!QueryResult:interface" --- import { PropertySignatureTable } from '../../shared/ApiDoc'; @@ -27,7 +27,8 @@ The `useQuery` [React hook](https://react.dev/reference/react) is the primary AP Let's look at an example. First, we'll create a GraphQL query named `GET_DOGS`. Remember to wrap query strings in the `gql` function to parse them into query documents: ```js title="index.js" -import { gql, useQuery } from '@apollo/client'; +import { gql } from '@apollo/client'; +import { useQuery } from '@apollo/client/react'; const GET_DOGS = gql` query GetDogs { @@ -246,7 +247,7 @@ Here's an example: ```jsx {2,5,13} title="index.js" import React from 'react'; -import { useLazyQuery } from '@apollo/client'; +import { useLazyQuery } from '@apollo/client/react'; function DelayedQuery() { const [getDog, { loading, error, data }] = useLazyQuery(GET_DOG_PHOTO); @@ -512,13 +513,13 @@ Most calls to `useQuery` can omit the majority of these options, but it's useful The `useQuery` hook accepts the following options: - + ### Result After being called, the `useQuery` hook returns a result object with the following properties. This object contains your query result, plus some helpful functions for refetching, dynamic polling, and pagination. - + ## Next steps diff --git a/docs/source/data/suspense.mdx b/docs/source/data/suspense.mdx index fa509788fe1..5eadfdf5ee4 100644 --- a/docs/source/data/suspense.mdx +++ b/docs/source/data/suspense.mdx @@ -18,11 +18,8 @@ Let's take a look at an example: ```tsx {5,38,40,45-47} import { Suspense } from 'react'; -import { - gql, - TypedDocumentNode, - useSuspenseQuery -} from '@apollo/client'; +import { gql, TypedDocumentNode } from '@apollo/client'; +import { useSuspenseQuery } from '@apollo/client/react'; interface Data { dog: { @@ -407,7 +404,7 @@ import { useBackgroundQuery, useReadQuery, useSuspenseQuery, -} from '@apollo/client'; +} from '@apollo/client/react'; function App() { // We can start the request here, even though `Dog` @@ -489,7 +486,7 @@ Let's update our example to start loading the dog's details as a result of selec import { // ... useLoadableQuery -} from '@apollo/client'; +} from '@apollo/client/react'; function App() { const { data } = useSuspenseQuery(GET_DOGS_QUERY); @@ -554,7 +551,7 @@ Let's update our example to start loading the `GET_DOGS_QUERY` before our app is import { // ... createQueryPreloader -} from '@apollo/client'; +} from '@apollo/client/react'; // This `preloadQuery` function does not have to be created each time you // need to preload a new query. You may prefer to export this function @@ -685,14 +682,13 @@ Let's update our example by adding the ability to refetch breeds. We destructure ```tsx {1,12-15,18-20,49,57,62} import { Suspense, useTransition } from "react"; +import { gql, TypedDocumentNode } from "@apollo/client"; import { useSuspenseQuery, useBackgroundQuery, useReadQuery, - gql, - TypedDocumentNode, QueryRef, -} from "@apollo/client"; +} from "@apollo/client/react"; function App() { const [isPending, startTransition] = useTransition(); @@ -770,7 +766,7 @@ Let's update our example to preload our `GET_BREEDS_QUERY` outside React and use import { // ... useQueryRefHandlers, -} from "@apollo/client"; +} from "@apollo/client/react"; const queryRef = preloadQuery(GET_BREEDS_QUERY); @@ -868,7 +864,7 @@ It should not be used in the long term. Instead, you should use [`skipToken`](/react/api/react/hooks#skiptoken): ```js title="Recommended usage of skipToken with useSuspenseQuery" -import { skipToken, useSuspenseQuery } from '@apollo/client'; +import { skipToken, useSuspenseQuery } from '@apollo/client/react'; const { data } = useSuspenseQuery( query, id ? { variables: { id } } : skipToken @@ -876,7 +872,7 @@ const { data } = useSuspenseQuery( ``` ```js title="Recommended usage of skipToken with useBackgroundQuery" -import { skipToken, useBackgroundQuery } from '@apollo/client'; +import { skipToken, useBackgroundQuery } from '@apollo/client/react'; const [queryRef] = useBackgroundQuery( query, id ? { variables: { id } } : skipToken diff --git a/docs/source/development-testing/static-typing.md b/docs/source/development-testing/static-typing.md index a63de125da2..624f6912bfb 100644 --- a/docs/source/development-testing/static-typing.md +++ b/docs/source/development-testing/static-typing.md @@ -74,7 +74,7 @@ Below we use the `gql` function to define our query, which automatically generat ```tsx import React from 'react'; -import { useQuery } from '@apollo/client'; +import { useQuery } from '@apollo/client/react'; import { gql } from '../src/__generated__/gql'; @@ -193,7 +193,7 @@ We can type `useMutation` hooks the same way we type `useQuery` hooks. Using the ```tsx import React, { useState } from 'react'; -import { useMutation } from '@apollo/client'; +import { useMutation } from '@apollo/client/react'; import { gql } from '../src/__generated__/gql'; @@ -261,7 +261,7 @@ We can type our `useSubscription` hooks the same way we typed our `useQuery` and ```tsx import React from 'react'; -import { useSubscription } from '@apollo/client'; +import { useSubscription } from '@apollo/client/react'; import { gql } from '../src/gql'; @@ -438,12 +438,8 @@ This is especially helpful when accessing deeply nested objects passed to our co ```tsx import React from "react"; -import { - ApolloClient, - createHttpLink, - InMemoryCache, - ApolloProvider -} from "@apollo/client"; +import { ApolloClient, createHttpLink, InMemoryCache } from "@apollo/client"; +import { ApolloProvider } from "@apollo/client/react"; import Character from "./Character"; @@ -583,7 +579,8 @@ This technique enables us to modify the [`useQuery` example](#usequery) above to ```tsx import React from 'react'; -import { useQuery, gql, TypedDocumentNode } from '@apollo/client'; +import { gql, TypedDocumentNode } from '@apollo/client'; +import { useQuery } from '@apollo/client/react'; interface RocketInventoryData { rocketInventory: RocketInventory[]; diff --git a/docs/source/development-testing/testing.mdx b/docs/source/development-testing/testing.mdx index 3453f2559f4..ff73b265983 100644 --- a/docs/source/development-testing/testing.mdx +++ b/docs/source/development-testing/testing.mdx @@ -21,7 +21,8 @@ Let's say we want to test the following `Dog` component, which executes a basic ```jsx title="dog.jsx" import React from "react"; -import { gql, useQuery } from "@apollo/client"; +import { gql } from "@apollo/client"; +import { useQuery } from "@apollo/client/react"; // Make sure that both the query and the component are exported export const GET_DOG_QUERY = gql` @@ -55,7 +56,7 @@ A basic rendering test for the component looks like this (minus mocked responses ```jsx title="dog.test.js" import "@testing-library/jest-dom"; import { render, screen } from "@testing-library/react"; -import { MockedProvider } from "@apollo/client/testing"; +import { MockedProvider } from "@apollo/client/testing/react"; import { GET_DOG_QUERY, Dog } from "./dog"; const mocks = []; // We'll fill this in next @@ -119,7 +120,7 @@ Combining our code above, we get the following complete test: ```jsx title="dog.test.js" import "@testing-library/jest-dom"; import { render, screen } from "@testing-library/react"; -import { MockedProvider } from "@apollo/client/testing"; +import { MockedProvider } from "@apollo/client/testing/react"; import { GET_DOG_QUERY, Dog } from "./dog"; const mocks = [ @@ -317,7 +318,8 @@ The following `DeleteButton` component executes the `DELETE_DOG_MUTATION` to del ```jsx title="delete-dog.jsx" import React from "react"; -import { gql, useMutation } from "@apollo/client"; +import { gql } from "@apollo/client"; +import { useMutation } from "@apollo/client/react"; export const DELETE_DOG_MUTATION = gql` mutation deleteDog($name: String!) { @@ -350,7 +352,7 @@ We can test the initial rendering of this component just like we [tested our `Do import '@testing-library/jest-dom'; import userEvent from '@testing-library/user-event'; import { render, screen } from '@testing-library/react'; -import { MockedProvider } from "@apollo/client/testing"; +import { MockedProvider } from "@apollo/client/testing/react"; import { DeleteButton, DELETE_DOG_MUTATION } from "./delete-dog"; it("should render without error", () => { diff --git a/docs/source/get-started.mdx b/docs/source/get-started.mdx index cacfad62526..d117257b814 100644 --- a/docs/source/get-started.mdx +++ b/docs/source/get-started.mdx @@ -36,10 +36,11 @@ Our example application will use the [FlyBy GraphQL API](https://flyby-router-de With our dependencies set up, we can now initialize an `ApolloClient` instance. -In `main.jsx`, let's first import the symbols we need from `@apollo/client`: +In `main.jsx`, let's first import the symbols we need from `@apollo/client` and `@apollo/client/react`: ```jsx title="main.jsx" -import { ApolloClient, InMemoryCache, ApolloProvider, gql } from '@apollo/client'; +import { ApolloClient, InMemoryCache, gql } from '@apollo/client'; +import { ApolloProvider } from '@apollo/client/react'; ``` Next we'll initialize `ApolloClient`, passing its constructor a configuration object with the `uri` and `cache` fields: @@ -92,7 +93,8 @@ In `main.jsx`, let's wrap our React app with an `ApolloProvider`. We suggest put ```jsx title="main.jsx" {15-17} import React from 'react'; import * as ReactDOM from 'react-dom/client'; -import { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client'; +import { ApolloClient, InMemoryCache } from '@apollo/client'; +import { ApolloProvider } from '@apollo/client/react'; import App from './App'; const client = new ApolloClient({ @@ -118,7 +120,8 @@ Switching over to our `App.jsx` file, we'll start by replacing our existing file ```jsx title="App.jsx" // Import everything needed to use the `useQuery` hook -import { useQuery, gql } from '@apollo/client'; +import { gql } from '@apollo/client'; +import { useQuery } from '@apollo/client/react'; export default function App() { return ( diff --git a/docs/source/integrations/react-native.md b/docs/source/integrations/react-native.md index 78ea0eb8897..6aadc0dd572 100644 --- a/docs/source/integrations/react-native.md +++ b/docs/source/integrations/react-native.md @@ -13,7 +13,8 @@ Then wrap your application in the `ApolloProvider` component, like so: ```jsx import React from 'react'; import { AppRegistry } from 'react-native'; -import { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client'; +import { ApolloClient, InMemoryCache } from '@apollo/client'; +import { ApolloProvider } from '@apollo/client/react'; // Initialize Apollo Client const client = new ApolloClient({ diff --git a/docs/source/local-state/local-resolvers.mdx b/docs/source/local-state/local-resolvers.mdx index 5a086b351f7..e73fa25a501 100644 --- a/docs/source/local-state/local-resolvers.mdx +++ b/docs/source/local-state/local-resolvers.mdx @@ -25,7 +25,7 @@ Direct writes to the cache do not require a GraphQL mutation or a resolver funct ```jsx import React from "react"; -import { useApolloClient } from "@apollo/client"; +import { useApolloClient } from "@apollo/client/react"; import Link from "./Link"; @@ -50,7 +50,8 @@ What if we want to immediately subscribe to the data we just wrote to the cache? ```jsx import React from "react"; -import { gql, useQuery } from "@apollo/client"; +import { gql } from "@apollo/client"; +import { useQuery } from "@apollo/client/react"; import Link from "./Link"; @@ -130,7 +131,8 @@ Let's learn how to trigger our `toggleTodo` mutation from our component: ```jsx import React from "react" -import { gql, useMutation } from "@apollo/client"; +import { gql } from "@apollo/client"; +import { useMutation } from "@apollo/client/react"; const TOGGLE_TODO = gql` mutation ToggleTodo($id: Int!) { @@ -161,7 +163,8 @@ Querying for local data is very similar to querying your GraphQL server. The onl ```jsx import React from "react"; -import { gql, useQuery } from "@apollo/client"; +import { gql } from "@apollo/client"; +import { useQuery } from "@apollo/client/react"; import Todo from "./Todo"; @@ -509,14 +512,8 @@ As outlined in [Handling `@client` fields with resolvers][], `@client` fields ca ```jsx import React from "react"; import ReactDOM from "react-dom"; -import { - ApolloClient, - InMemoryCache, - HttpLink, - ApolloProvider, - useQuery, - gql -} from "@apollo/client"; +import { ApolloClient, InMemoryCache, HttpLink, gql } from "@apollo/client"; +import { ApolloProvider, useQuery } from "@apollo/client/react"; import Pages from "./pages"; import Login from "./pages/login"; @@ -566,7 +563,8 @@ Before Apollo Client executes a query, one of the first things it does is check ```jsx import React, { Fragment } from "react"; -import { useQuery, gql } from "@apollo/client"; +import { gql } from "@apollo/client"; +import { useQuery } from "@apollo/client/react"; import { Loading, Header, LaunchDetail } from "../components"; import { ActionButton } from "../containers"; @@ -947,7 +945,8 @@ and wait until our `Stats` component is called to define our local resolvers (us ```js import React from "react"; -import { ApolloConsumer, useApolloClient, useQuery, gql } from "@apollo/client"; +import { gql } from "@apollo/client"; +import { ApolloConsumer, useApolloClient, useQuery } from "@apollo/client/react"; const GET_MESSAGE_COUNT = gql` query GetMessageCount { diff --git a/docs/source/local-state/managing-state-with-field-policies.mdx b/docs/source/local-state/managing-state-with-field-policies.mdx index da4a4ceca7b..e2b4295e577 100644 --- a/docs/source/local-state/managing-state-with-field-policies.mdx +++ b/docs/source/local-state/managing-state-with-field-policies.mdx @@ -246,7 +246,7 @@ export function Cart() { Instead of querying for `cartItems`, the `Cart` component can read and react to a reactive variable directly with the `useReactiveVar` hook: ```jsx {1,4} title="Cart.js" -import { useReactiveVar } from '@apollo/client'; +import { useReactiveVar } from '@apollo/client/react'; export function Cart() { const cartItems = useReactiveVar(cartItemsVar); @@ -320,13 +320,8 @@ Here's a full example that incorporates the code blocks above: ```jsx import React from 'react'; import ReactDOM from 'react-dom'; -import { - ApolloClient, - InMemoryCache, - ApolloProvider, - useQuery, - gql -} from '@apollo/client'; +import { ApolloClient, InMemoryCache, gql } from '@apollo/client'; +import { ApolloProvider, useQuery } from '@apollo/client/react'; import Pages from './pages'; import Login from './pages/login'; diff --git a/docs/source/migrating/hooks-migration.md b/docs/source/migrating/hooks-migration.md index f47258e4d7b..332936f59db 100644 --- a/docs/source/migrating/hooks-migration.md +++ b/docs/source/migrating/hooks-migration.md @@ -57,8 +57,8 @@ import { getDataFromTree } from "@apollo/client/react/ssr"; ## Testing -React testing utilities are now available through the Apollo Client project, but they aren't included in the default bundle. To access the React testing utilities, you can use the `@apollo/client/testing` bundle like: +React testing utilities are now available through the Apollo Client project, but they aren't included in the default bundle. To access the React testing utilities, you can use the `@apollo/client/testing/react` bundle like: ``` -import { MockedProvider } from '@apollo/client/testing'; +import { MockedProvider } from '@apollo/client/testing/react'; ``` diff --git a/docs/source/performance/server-side-rendering.mdx b/docs/source/performance/server-side-rendering.mdx index 62abae2ac55..f271f2eef83 100644 --- a/docs/source/performance/server-side-rendering.mdx +++ b/docs/source/performance/server-side-rendering.mdx @@ -73,12 +73,8 @@ First, here's an example `app.js` file, _without_ the code for rendering React t ```jsx title="app.js" -import { - ApolloProvider, - ApolloClient, - createHttpLink, - InMemoryCache -} from '@apollo/client'; +import { ApolloClient, createHttpLink, InMemoryCache } from '@apollo/client'; +import { ApolloProvider } from '@apollo/client/react'; import Express from 'express'; import React from 'react'; import { StaticRouter } from 'react-router'; @@ -124,7 +120,7 @@ app.listen(basePort, () => console.log( So far, whenever this example server receives a request, it first initializes Apollo Client and then creates a React tree that's wrapped with the `ApolloProvider` and `StaticRouter` components. The contents of that tree depend on the request's path and the `StaticRouter`'s defined routes. - + It's important to create an _entirely new instance_ of Apollo Client for each request. Otherwise, your response to a request might include sensitive cached query results from a _previous_ request. diff --git a/scripts/memory/tests.js b/scripts/memory/tests.js index 0edccf5e02b..a764f4dac96 100644 --- a/scripts/memory/tests.js +++ b/scripts/memory/tests.js @@ -59,10 +59,6 @@ describe("@apollo/client/apollo-client.cjs", () => { assert.strictEqual(typeof bundle.ApolloClient, "function"); assert.strictEqual(typeof bundle.InMemoryCache, "function"); - // TODO This will change in AC4 when we move all React exports to the - // @apollo/client/react entry point (see issue #8190). - assert.strictEqual(typeof bundle.ApolloProvider, "function"); - // The CommonJS bundles referred to by the "main" fields in the various // package.json files that we generate during `npm run build` are all // independent, non-overlapping bundles, but apollo-client.cjs is its own diff --git a/src/__tests__/__snapshots__/exports.ts.snap b/src/__tests__/__snapshots__/exports.ts.snap index 7e8ee9063b8..4f7907a5938 100644 --- a/src/__tests__/__snapshots__/exports.ts.snap +++ b/src/__tests__/__snapshots__/exports.ts.snap @@ -4,13 +4,10 @@ exports[`exports of public entry points @apollo/client 1`] = ` Array [ "ApolloCache", "ApolloClient", - "ApolloConsumer", "ApolloError", "ApolloLink", - "ApolloProvider", "Cache", "DocumentTransform", - "DocumentType", "HttpLink", "InMemoryCache", "MissingFieldError", @@ -20,7 +17,6 @@ Array [ "checkFetcher", "concat", "createHttpLink", - "createQueryPreloader", "createSignalIfSupported", "defaultDataIdFromObject", "defaultPrinter", @@ -33,7 +29,6 @@ Array [ "from", "fromError", "fromPromise", - "getApolloContext", "gql", "isApolloError", "isNetworkRequestSettled", @@ -41,10 +36,7 @@ Array [ "makeReference", "makeVar", "mergeOptions", - "operationName", "parseAndCheckHttpResponse", - "parser", - "resetApolloContext", "resetCaches", "rewriteURIForGET", "selectHttpOptionsAndBody", @@ -52,22 +44,9 @@ Array [ "selectURI", "serializeFetchParameter", "setLogVerbosity", - "skipToken", "split", "throwServerError", "toPromise", - "useApolloClient", - "useBackgroundQuery", - "useFragment", - "useLazyQuery", - "useLoadableQuery", - "useMutation", - "useQuery", - "useQueryRefHandlers", - "useReactiveVar", - "useReadQuery", - "useSubscription", - "useSuspenseQuery", ] `; @@ -358,7 +337,6 @@ exports[`exports of public entry points @apollo/client/testing 1`] = ` Array [ "MockLink", "MockSubscriptionLink", - "MockedProvider", "createMockClient", "mockObservableLink", "mockSingleLink", @@ -392,6 +370,12 @@ Array [ ] `; +exports[`exports of public entry points @apollo/client/testing/react 1`] = ` +Array [ + "MockedProvider", +] +`; + exports[`exports of public entry points @apollo/client/utilities 1`] = ` Array [ "AutoCleanedStrongCache", diff --git a/src/__tests__/exports.ts b/src/__tests__/exports.ts index ed948f33733..d5d48db4f50 100644 --- a/src/__tests__/exports.ts +++ b/src/__tests__/exports.ts @@ -31,6 +31,7 @@ import * as reactSSR from "../react/ssr"; import * as testing from "../testing"; import * as testingCore from "../testing/core"; import * as testingExperimental from "../testing/experimental"; +import * as testingReact from "../testing/react"; import * as utilities from "../utilities"; import * as utilitiesGlobals from "../utilities/globals"; import * as urqlUtilities from "../utilities/subscriptions/urql"; @@ -77,6 +78,7 @@ describe("exports of public entry points", () => { check("@apollo/client/testing", testing); check("@apollo/client/testing/core", testingCore); check("@apollo/client/testing/experimental", testingExperimental); + check("@apollo/client/testing/react", testingReact); check("@apollo/client/utilities", utilities); check("@apollo/client/utilities/globals", utilitiesGlobals); check("@apollo/client/utilities/subscriptions/urql", urqlUtilities); diff --git a/src/index.ts b/src/index.ts index bcafe77b18f..7d3cdc056b2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,2 +1 @@ export * from "./core/index.js"; -export * from "./react/index.js"; diff --git a/src/react/hooks/__tests__/useBackgroundQuery.test.tsx b/src/react/hooks/__tests__/useBackgroundQuery.test.tsx index 6ce0564cc63..a8c0cb9b606 100644 --- a/src/react/hooks/__tests__/useBackgroundQuery.test.tsx +++ b/src/react/hooks/__tests__/useBackgroundQuery.test.tsx @@ -23,7 +23,6 @@ import { MockLink, MockSubscriptionLink, mockSingleLink, - MockedProvider, wait, } from "../../../testing"; import { @@ -70,6 +69,7 @@ import { disableActEnvironment, useTrackRenders, } from "@testing-library/react-render-stream"; +import { MockedProvider } from "../../../testing/react"; afterEach(() => { jest.useRealTimers(); diff --git a/src/react/hooks/__tests__/useFragment.test.tsx b/src/react/hooks/__tests__/useFragment.test.tsx index 3884c22338c..0c61ca2b3ea 100644 --- a/src/react/hooks/__tests__/useFragment.test.tsx +++ b/src/react/hooks/__tests__/useFragment.test.tsx @@ -14,7 +14,6 @@ import { UseFragmentResult, useFragment, } from "../useFragment"; -import { MockedProvider } from "../../../testing"; import { ApolloProvider } from "../../context"; import { InMemoryCache, @@ -41,6 +40,7 @@ import { renderHookToSnapshotStream, useTrackRenders, } from "@testing-library/react-render-stream"; +import { MockedProvider } from "../../../testing/react"; describe("useFragment", () => { it("is importable and callable", () => { diff --git a/src/react/hooks/__tests__/useLazyQuery.test.tsx b/src/react/hooks/__tests__/useLazyQuery.test.tsx index 802638fef98..4e7ae40953d 100644 --- a/src/react/hooks/__tests__/useLazyQuery.test.tsx +++ b/src/react/hooks/__tests__/useLazyQuery.test.tsx @@ -15,7 +15,6 @@ import { import { Observable } from "../../../utilities"; import { ApolloProvider } from "../../../react"; import { - MockedProvider, mockSingleLink, wait, tick, @@ -31,6 +30,7 @@ import { disableActEnvironment, renderHookToSnapshotStream, } from "@testing-library/react-render-stream"; +import { MockedProvider } from "../../../testing/react"; const IS_REACT_17 = React.version.startsWith("17"); const IS_REACT_18 = React.version.startsWith("18"); diff --git a/src/react/hooks/__tests__/useLoadableQuery.test.tsx b/src/react/hooks/__tests__/useLoadableQuery.test.tsx index 86227f9775c..17da5fdd9f5 100644 --- a/src/react/hooks/__tests__/useLoadableQuery.test.tsx +++ b/src/react/hooks/__tests__/useLoadableQuery.test.tsx @@ -19,8 +19,6 @@ import { split, } from "../../../core"; import { - MockedProvider, - MockedProviderProps, MockedResponse, MockLink, MockSubscriptionLink, @@ -60,6 +58,7 @@ import { useTrackRenders, AsyncRenderFn, } from "@testing-library/react-render-stream"; +import { MockedProvider, MockedProviderProps } from "../../../testing/react"; const IS_REACT_19 = React.version.startsWith("19"); afterEach(() => { diff --git a/src/react/hooks/__tests__/useMutation.test.tsx b/src/react/hooks/__tests__/useMutation.test.tsx index 2ac84fb45b8..66d6aa9cdee 100644 --- a/src/react/hooks/__tests__/useMutation.test.tsx +++ b/src/react/hooks/__tests__/useMutation.test.tsx @@ -19,7 +19,6 @@ import { } from "../../../core"; import { InMemoryCache } from "../../../cache"; import { - MockedProvider, MockSubscriptionLink, mockSingleLink, MockedResponse, @@ -40,6 +39,7 @@ import { } from "@testing-library/react-render-stream"; import { MutationTuple, QueryResult } from "../../types/types"; import { invariant } from "../../../utilities/globals"; +import { MockedProvider } from "../../../testing/react"; describe("useMutation Hook", () => { interface Todo { diff --git a/src/react/hooks/__tests__/useQuery.test.tsx b/src/react/hooks/__tests__/useQuery.test.tsx index f692f9d5bcd..9ab466bad42 100644 --- a/src/react/hooks/__tests__/useQuery.test.tsx +++ b/src/react/hooks/__tests__/useQuery.test.tsx @@ -21,7 +21,6 @@ import { Observable, Reference, concatPagination } from "../../../utilities"; import { ApolloLink } from "../../../link/core"; import { MockLink, - MockedProvider, MockSubscriptionLink, mockSingleLink, tick, @@ -41,6 +40,7 @@ import { renderHookToSnapshotStream, disableActEnvironment, } from "@testing-library/react-render-stream"; +import { MockedProvider } from "../../../testing/react"; const IS_REACT_17 = React.version.startsWith("17"); const IS_REACT_18 = React.version.startsWith("18"); diff --git a/src/react/hooks/__tests__/useSuspenseQuery.test.tsx b/src/react/hooks/__tests__/useSuspenseQuery.test.tsx index b7ba7bc04f1..60861b58f22 100644 --- a/src/react/hooks/__tests__/useSuspenseQuery.test.tsx +++ b/src/react/hooks/__tests__/useSuspenseQuery.test.tsx @@ -38,7 +38,6 @@ import { offsetLimitPagination, } from "../../../utilities"; import { - MockedProvider, MockedResponse, MockSubscriptionLink, MockLink, @@ -66,6 +65,7 @@ import { disableActEnvironment, useTrackRenders, } from "@testing-library/react-render-stream"; +import { MockedProvider } from "../../../testing/react"; const IS_REACT_19 = React.version.startsWith("19"); diff --git a/src/react/ssr/__tests__/useQuery.test.tsx b/src/react/ssr/__tests__/useQuery.test.tsx index 02c711b9eba..27c142615c6 100644 --- a/src/react/ssr/__tests__/useQuery.test.tsx +++ b/src/react/ssr/__tests__/useQuery.test.tsx @@ -2,17 +2,14 @@ import React from "react"; import { DocumentNode } from "graphql"; import gql from "graphql-tag"; -import { - MockedProvider, - MockedResponse, - mockSingleLink, -} from "../../../testing"; +import { MockedResponse, mockSingleLink } from "../../../testing"; import { ApolloClient } from "../../../core"; import { InMemoryCache } from "../../../cache"; import { ApolloProvider, getApolloContext } from "../../context"; import { useApolloClient, useQuery } from "../../hooks"; import { renderToStringWithData } from ".."; import type { Trie } from "@wry/trie"; +import { MockedProvider } from "../../../testing/react"; describe("useQuery Hook SSR", () => { const CAR_QUERY: DocumentNode = gql` diff --git a/src/testing/index.ts b/src/testing/index.ts index be84a5e57e5..83141f0960f 100644 --- a/src/testing/index.ts +++ b/src/testing/index.ts @@ -1,4 +1,2 @@ import "../utilities/globals/index.js"; -export type { MockedProviderProps } from "./react/MockedProvider.js"; -export { MockedProvider } from "./react/MockedProvider.js"; export * from "./core/index.js"; diff --git a/src/testing/react/index.ts b/src/testing/react/index.ts new file mode 100644 index 00000000000..0fc72679337 --- /dev/null +++ b/src/testing/react/index.ts @@ -0,0 +1,2 @@ +export { MockedProvider } from "./MockedProvider.js"; +export type { MockedProviderProps } from "./MockedProvider.js";