@apollo/client 4.2.8 → 4.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +3 -7
  3. package/__cjs/cache/inmemory/readFromStore.cjs +1 -4
  4. package/__cjs/cache/inmemory/readFromStore.cjs.map +1 -1
  5. package/__cjs/core/ApolloClient.cjs.map +1 -1
  6. package/__cjs/core/ApolloClient.d.cts +44 -10
  7. package/__cjs/core/ObservableQuery.cjs +42 -4
  8. package/__cjs/core/ObservableQuery.cjs.map +1 -1
  9. package/__cjs/core/ObservableQuery.d.cts +12 -1
  10. package/__cjs/core/QueryManager.cjs +12 -0
  11. package/__cjs/core/QueryManager.cjs.map +1 -1
  12. package/__cjs/core/types.d.cts +2 -0
  13. package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
  14. package/__cjs/react/hooks/useBackgroundQuery.d.cts +92 -47
  15. package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
  16. package/__cjs/react/hooks/useLazyQuery.d.cts +26 -20
  17. package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
  18. package/__cjs/react/hooks/useLoadableQuery.d.cts +23 -15
  19. package/__cjs/react/hooks/useMutation.cjs.map +1 -1
  20. package/__cjs/react/hooks/useMutation.d.cts +10 -7
  21. package/__cjs/react/hooks/useQuery.cjs.map +1 -1
  22. package/__cjs/react/hooks/useQuery.d.cts +66 -32
  23. package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
  24. package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
  25. package/__cjs/react/hooks/useSuspenseQuery.d.cts +75 -34
  26. package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
  27. package/__cjs/react/internal/types.d.cts +14 -3
  28. package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
  29. package/__cjs/react/query-preloader/createQueryPreloader.d.cts +20 -5
  30. package/__cjs/version.cjs +1 -1
  31. package/__cjs/version.cjs.map +1 -1
  32. package/cache/inmemory/readFromStore.js +2 -5
  33. package/cache/inmemory/readFromStore.js.map +1 -1
  34. package/core/ApolloClient.d.ts +44 -10
  35. package/core/ApolloClient.js.map +1 -1
  36. package/core/ObservableQuery.d.ts +12 -1
  37. package/core/ObservableQuery.js +42 -4
  38. package/core/ObservableQuery.js.map +1 -1
  39. package/core/QueryManager.js +12 -0
  40. package/core/QueryManager.js.map +1 -1
  41. package/core/types.d.ts +2 -0
  42. package/core/types.js.map +1 -1
  43. package/package.json +1 -1
  44. package/react/hooks/useBackgroundQuery.d.ts +92 -47
  45. package/react/hooks/useBackgroundQuery.js.map +1 -1
  46. package/react/hooks/useLazyQuery.d.ts +26 -20
  47. package/react/hooks/useLazyQuery.js.map +1 -1
  48. package/react/hooks/useLoadableQuery.d.ts +23 -15
  49. package/react/hooks/useLoadableQuery.js.map +1 -1
  50. package/react/hooks/useMutation.d.ts +10 -7
  51. package/react/hooks/useMutation.js.map +1 -1
  52. package/react/hooks/useQuery.d.ts +66 -32
  53. package/react/hooks/useQuery.js.map +1 -1
  54. package/react/hooks/useQueryRefHandlers.js.map +1 -1
  55. package/react/hooks/useSuspenseQuery.d.ts +75 -34
  56. package/react/hooks/useSuspenseQuery.js.map +1 -1
  57. package/react/hooks-compiled/useBackgroundQuery.d.ts +92 -47
  58. package/react/hooks-compiled/useBackgroundQuery.js.map +1 -1
  59. package/react/hooks-compiled/useLazyQuery.d.ts +26 -20
  60. package/react/hooks-compiled/useLazyQuery.js.map +1 -1
  61. package/react/hooks-compiled/useLoadableQuery.d.ts +23 -15
  62. package/react/hooks-compiled/useLoadableQuery.js.map +1 -1
  63. package/react/hooks-compiled/useMutation.d.ts +10 -7
  64. package/react/hooks-compiled/useMutation.js.map +1 -1
  65. package/react/hooks-compiled/useQuery.d.ts +66 -32
  66. package/react/hooks-compiled/useQuery.js.map +1 -1
  67. package/react/hooks-compiled/useQueryRefHandlers.js.map +1 -1
  68. package/react/hooks-compiled/useSuspenseQuery.d.ts +75 -34
  69. package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
  70. package/react/internal/cache/QueryReference.js.map +1 -1
  71. package/react/internal/types.d.ts +15 -4
  72. package/react/internal/types.js.map +1 -1
  73. package/react/query-preloader/createQueryPreloader.d.ts +20 -5
  74. package/react/query-preloader/createQueryPreloader.js.map +1 -1
  75. package/version.js +1 -1
  76. package/version.js.map +1 -1
package/core/types.d.ts CHANGED
@@ -317,9 +317,11 @@ export declare namespace QueryNotification {
317
317
  source: "setResult";
318
318
  };
319
319
  type FromNetwork<TData> = ObservableNotification<ObservableQuery.Result<TData>> & {
320
+ resolvedVariables?: OperationVariables;
320
321
  source: "network";
321
322
  };
322
323
  type FromCache<TData> = NextNotification<ObservableQuery.Result<TData>> & {
324
+ resolvedVariables?: OperationVariables;
323
325
  source: "cache";
324
326
  };
325
327
  type Value<TData> = FromCache<TData> | FromNetwork<TData> | NewNetworkStatus | SetResult<TData>;
package/core/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { DocumentNode, FormattedExecutionResult } from \"graphql\";\nimport type {\n NextNotification,\n Observable,\n ObservableNotification,\n} from \"rxjs\";\n\nimport type { ApolloCache } from \"@apollo/client/cache\";\nimport type { Cache } from \"@apollo/client/cache\";\nimport type { ClientAwarenessLink } from \"@apollo/client/link/client-awareness\";\nimport type { Unmasked } from \"@apollo/client/masking\";\nimport type { DeepPartial, HKT } from \"@apollo/client/utilities\";\nimport type {\n ApplyHKTImplementationWithDefault,\n IsAny,\n} from \"@apollo/client/utilities/internal\";\n\nimport type { ApolloClient } from \"./ApolloClient.js\";\nimport type { ObservableQuery } from \"./ObservableQuery.js\";\n\nexport type { TypedDocumentNode } from \"@graphql-typed-document-node/core\";\n\nexport interface TypeOverrides {}\n\ndeclare namespace OverridableTypes {\n export interface Defaults {\n Complete: Complete;\n Streaming: Streaming;\n Partial: Partial;\n }\n\n interface Complete extends HKT {\n arg1: unknown; // TData\n return: this[\"arg1\"];\n }\n\n interface Streaming extends HKT {\n arg1: unknown; // TData\n return: this[\"arg1\"];\n }\n\n interface Partial extends HKT {\n arg1: unknown; // TData\n return: DeepPartial<this[\"arg1\"]>;\n }\n}\n\nexport declare namespace DataValue {\n /**\n * Returns a representation of `TData` in it's \"complete\" state.\n *\n * @defaultValue `TData` if no overrides are provided.\n *\n * @example\n * You can override this type globally - this example shows how to override it\n * with `DeepPartial<TData>`:\n *\n * ```ts\n * import { HKT, DeepPartial } from \"@apollo/client/utilities\";\n *\n * type CompleteOverride<TData> =\n * TData extends { _complete?: infer _Complete } ? _Complete : TData;\n *\n * interface CompleteOverrideHKT extends HKT {\n * return: CompleteOverride<this[\"arg1\"]>;\n * }\n *\n * declare module \"@apollo/client\" {\n * export interface TypeOverrides {\n * Complete: CompleteOverrideHKT;\n * }\n * }\n * ```\n */\n export type Complete<TData> = ApplyHKTImplementationWithDefault<\n TypeOverrides,\n \"Complete\",\n OverridableTypes.Defaults,\n TData\n >;\n\n /**\n * Returns a representation of `TData` while it is streaming.\n *\n * @defaultValue `TData` if no overrides are provided.\n *\n * @example\n * You can override this type globally - this example shows how to override it\n * with `DeepPartial<TData>`:\n *\n * ```ts\n * import { HKT, DeepPartial } from \"@apollo/client/utilities\";\n *\n * type StreamingOverride<TData> = DeepPartial<TData>;\n *\n * interface StreamingOverrideHKT extends HKT {\n * return: StreamingOverride<this[\"arg1\"]>;\n * }\n *\n * declare module \"@apollo/client\" {\n * export interface TypeOverrides {\n * Streaming: StreamingOverrideHKT;\n * }\n * }\n * ```\n */\n export type Streaming<TData> = ApplyHKTImplementationWithDefault<\n TypeOverrides,\n \"Streaming\",\n OverridableTypes.Defaults,\n TData\n >;\n\n /**\n * Returns a representation of `TData` while it is partial.\n *\n * @defaultValue `DeepPartial<TData>` if no overrides are provided.\n *\n * @example\n * You can override this type globally - this example shows how to override it\n * with `DeepPartial<TData>`:\n *\n * ```ts\n * import { HKT, DeepPartial } from \"@apollo/client/utilities\";\n *\n * type PartialOverride<TData> = DeepPartial<Complete<TData>>;\n *\n * interface PartialOverrideHKT extends HKT {\n * return: PartialOverride<this[\"arg1\"]>;\n * }\n *\n * declare module \"@apollo/client\" {\n * export interface TypeOverrides {\n * Partial: PartialOverrideHKT;\n * }\n * }\n * ```\n */\n export type Partial<TData> = ApplyHKTImplementationWithDefault<\n TypeOverrides,\n \"Partial\",\n OverridableTypes.Defaults,\n TData\n >;\n}\n\nexport interface DefaultContext extends Record<string, any> {\n /**\n * Indicates whether `queryDeduplication` was enabled for the request.\n */\n queryDeduplication?: boolean;\n clientAwareness?: ClientAwarenessLink.ClientAwarenessOptions;\n}\n\nexport interface RefetchEvents {\n windowFocus: Event;\n online: Event;\n}\n\nexport declare namespace RefetchOn {\n export type Context<\n TSource extends keyof RefetchEvents = keyof RefetchEvents,\n > =\n TSource extends keyof RefetchEvents ?\n {\n /**\n * The source name that triggered the refetch.\n */\n source: TSource;\n\n /**\n * Any data emitted by the source along with the event\n */\n payload: RefetchEvents[TSource];\n }\n : never;\n\n export type Callback<\n TSource extends keyof RefetchEvents = keyof RefetchEvents,\n > = (context: RefetchOn.Context<TSource>) => boolean;\n\n export type Option =\n | boolean\n | RefetchOn.Callback<keyof RefetchEvents>\n | {\n [Key in keyof RefetchEvents]?: boolean | RefetchOn.Callback<Key>;\n };\n}\n\n/**\n * Represents an `Error` type, but used throughout Apollo Client to represent\n * errors that may otherwise fail `instanceof` checks if they are cross-realm\n * Error instances (see the [`Error.isError` proposal](https://github.com/tc39/proposal-is-error) for more details).\n *\n * Apollo Client uses several types of errors throughout the client which can be\n * narrowed using `instanceof`:\n *\n * - `CombinedGraphQLErrors` - `errors` returned from a GraphQL result\n * - `CombinedProtocolErrors` - Transport-level errors from multipart subscriptions.\n * - `ServerParseError` - A JSON-parse error when parsing the server response.\n * - `ServerError` - A non-200 server response.\n *\n * @example\n *\n * ```ts\n * import { CombinedGraphQLErrors } from \"@apollo/client\";\n *\n * try {\n * await client.query({ query });\n * } catch (error) {\n * // Use `instanceof` to check for more specific types of errors.\n * if (error instanceof CombinedGraphQLErrors) {\n * error.errors.map((graphQLError) => console.log(graphQLError.message));\n * } else {\n * console.error(errors);\n * }\n * }\n * ```\n */\nexport interface ErrorLike {\n message: string;\n name: string;\n stack?: string;\n}\n\nexport type OnQueryUpdated<TResult> = (\n observableQuery: ObservableQuery<any>,\n diff: Cache.DiffResult<any>,\n lastDiff: Cache.DiffResult<any> | undefined\n) => boolean | TResult;\n\nexport type RefetchQueryDescriptor = string | DocumentNode;\nexport type InternalRefetchQueryDescriptor =\n | RefetchQueryDescriptor\n | ApolloClient.QueryOptions;\n\ntype RefetchQueriesIncludeShorthand = \"all\" | \"active\";\n\nexport type RefetchQueriesInclude =\n | RefetchQueryDescriptor[]\n | RefetchQueriesIncludeShorthand;\n\nexport type InternalRefetchQueriesInclude =\n | InternalRefetchQueryDescriptor[]\n | RefetchQueriesIncludeShorthand;\n\n// The client.refetchQueries method returns a thenable (PromiseLike) object\n// whose result is an array of Promise.resolve'd TResult values, where TResult\n// is whatever type the (optional) onQueryUpdated function returns. When no\n// onQueryUpdated function is given, TResult defaults to ApolloQueryResult<any>\n// (thanks to default type parameters for client.refetchQueries).\nexport type RefetchQueriesPromiseResults<TResult> =\n // If onQueryUpdated returns any, all bets are off, so the results array must\n // be a generic any[] array, which is much less confusing than the union type\n // we get if we don't check for any. I hoped `any extends TResult` would do\n // the trick here, instead of IsStrictlyAny, but you can see for yourself what\n // fails in the refetchQueries tests if you try making that simplification.\n IsAny<TResult> extends true ? any[]\n : // If the onQueryUpdated function passed to client.refetchQueries returns true\n // or false, that means either to refetch the query (true) or to skip the\n // query (false). Since refetching produces an ApolloQueryResult<any>, and\n // skipping produces nothing, the fully-resolved array of all results produced\n // will be an ApolloQueryResult<any>[], when TResult extends boolean.\n TResult extends boolean ? ApolloClient.QueryResult<any>[]\n : // If onQueryUpdated returns a PromiseLike<U>, that thenable will be passed as\n // an array element to Promise.all, so we infer/unwrap the array type U here.\n TResult extends PromiseLike<infer U> ? U[]\n : // All other onQueryUpdated results end up in the final Promise.all array as\n // themselves, with their original TResult type. Note that TResult will\n // default to ApolloQueryResult<any> if no onQueryUpdated function is passed\n // to client.refetchQueries.\n TResult[];\n\n// Used by QueryManager[\"refetchQueries\"]\nexport interface InternalRefetchQueriesOptions<\n TCache extends ApolloCache,\n TResult,\n> extends Omit<ApolloClient.RefetchQueriesOptions<TCache, TResult>, \"include\"> {\n // Just like the refetchQueries option for a mutation, an array of strings,\n // DocumentNode objects, and/or QueryOptions objects, or one of the shorthand\n // strings \"all\" or \"active\", to select every (active) query.\n include?: InternalRefetchQueriesInclude;\n // This part of the API is a (useful) implementation detail, but need not be\n // exposed in the public client.refetchQueries API (above).\n removeOptimistic?: string;\n}\n\nexport type InternalRefetchQueriesResult<TResult> =\n // If onQueryUpdated returns a boolean, that's equivalent to refetching the\n // query when the boolean is true and skipping the query when false, so the\n // internal type of refetched results is Promise<ApolloQueryResult<any>>.\n TResult extends boolean ? Promise<ApolloClient.QueryResult<any>>\n : // Otherwise, onQueryUpdated returns whatever it returns. If onQueryUpdated is\n // not provided, TResult defaults to Promise<ApolloQueryResult<any>> (see the\n // generic type parameters of client.refetchQueries).\n TResult;\n\nexport type InternalRefetchQueriesMap<TResult> = Map<\n ObservableQuery<any>,\n InternalRefetchQueriesResult<TResult>\n>;\n\nexport type OperationVariables = Record<string, any>;\n\nexport type DataState<TData> =\n | {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#data:member} */\n data: DataValue.Complete<TData>;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#dataState:member} */\n dataState: \"complete\";\n }\n | {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#data:member} */\n data: DataValue.Streaming<TData>;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#dataState:member} */\n dataState: \"streaming\";\n }\n | {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#data:member} */\n data: DataValue.Partial<TData>;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#dataState:member} */\n dataState: \"partial\";\n }\n | {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#data:member} */\n data: undefined;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#dataState:member} */\n dataState: \"empty\";\n };\n\nexport type GetDataState<\n TData,\n TState extends DataState<TData>[\"dataState\"],\n> = Extract<DataState<TData>, { dataState: TState }>;\n\n/**\n * Represents a result that might be complete or still streaming and\n * has been normalized into a plain GraphQL result. When the result is\n * still `streaming`, some fields might not yet be available.\n */\nexport type NormalizedExecutionResult<\n TData = Record<string, unknown>,\n TExtensions = Record<string, unknown>,\n> = Omit<FormattedExecutionResult<TData, TExtensions>, \"data\"> &\n GetDataState<TData, \"streaming\" | \"complete\">;\n\n// This is part of the public API, people write these functions in `updateQueries`.\nexport type MutationQueryReducer<T> = (\n previousResult: Record<string, any>,\n options: {\n mutationResult: NormalizedExecutionResult<Unmasked<T>>;\n queryName: string | undefined;\n queryVariables: Record<string, any>;\n }\n) => Record<string, any>;\n\nexport type MutationQueryReducersMap<T = { [key: string]: any }> = {\n [queryName: string]: MutationQueryReducer<T>;\n};\n\nexport type MutationUpdaterFunction<\n TData,\n TVariables extends OperationVariables,\n TCache extends ApolloCache,\n> = (\n cache: TCache,\n result: FormattedExecutionResult<Unmasked<TData>>,\n options: {\n context?: DefaultContext;\n variables?: TVariables;\n }\n) => void;\n\nexport declare namespace QueryNotification {\n type NewNetworkStatus = NextNotification<{\n resetError?: boolean;\n }> & {\n source: \"newNetworkStatus\";\n };\n\n type SetResult<TData> = NextNotification<ObservableQuery.Result<TData>> & {\n source: \"setResult\";\n };\n\n type FromNetwork<TData> = ObservableNotification<\n ObservableQuery.Result<TData>\n > & {\n source: \"network\";\n };\n\n type FromCache<TData> = NextNotification<ObservableQuery.Result<TData>> & {\n source: \"cache\";\n };\n\n type Value<TData> =\n | FromCache<TData>\n | FromNetwork<TData>\n | NewNetworkStatus\n | SetResult<TData>;\n}\n\n/** Observable created by initiating a subscription operation. */\nexport interface SubscriptionObservable<T> extends Observable<T> {\n /**\n * Used to restart the connection to the link chain. Calling this on a\n * deduplicated subscription will restart the connection for all observables\n * that share the request.\n *\n * @example\n *\n * ```ts\n * const observable = client.subscribe({ query: subscription });\n * observable.subscribe((value) => {\n * // ...\n * });\n *\n * observable.restart();\n * ```\n */\n restart: () => void;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { DocumentNode, FormattedExecutionResult } from \"graphql\";\nimport type {\n NextNotification,\n Observable,\n ObservableNotification,\n} from \"rxjs\";\n\nimport type { ApolloCache } from \"@apollo/client/cache\";\nimport type { Cache } from \"@apollo/client/cache\";\nimport type { ClientAwarenessLink } from \"@apollo/client/link/client-awareness\";\nimport type { Unmasked } from \"@apollo/client/masking\";\nimport type { DeepPartial, HKT } from \"@apollo/client/utilities\";\nimport type {\n ApplyHKTImplementationWithDefault,\n IsAny,\n} from \"@apollo/client/utilities/internal\";\n\nimport type { ApolloClient } from \"./ApolloClient.js\";\nimport type { ObservableQuery } from \"./ObservableQuery.js\";\n\nexport type { TypedDocumentNode } from \"@graphql-typed-document-node/core\";\n\nexport interface TypeOverrides {}\n\ndeclare namespace OverridableTypes {\n export interface Defaults {\n Complete: Complete;\n Streaming: Streaming;\n Partial: Partial;\n }\n\n interface Complete extends HKT {\n arg1: unknown; // TData\n return: this[\"arg1\"];\n }\n\n interface Streaming extends HKT {\n arg1: unknown; // TData\n return: this[\"arg1\"];\n }\n\n interface Partial extends HKT {\n arg1: unknown; // TData\n return: DeepPartial<this[\"arg1\"]>;\n }\n}\n\nexport declare namespace DataValue {\n /**\n * Returns a representation of `TData` in it's \"complete\" state.\n *\n * @defaultValue `TData` if no overrides are provided.\n *\n * @example\n * You can override this type globally - this example shows how to override it\n * with `DeepPartial<TData>`:\n *\n * ```ts\n * import { HKT, DeepPartial } from \"@apollo/client/utilities\";\n *\n * type CompleteOverride<TData> =\n * TData extends { _complete?: infer _Complete } ? _Complete : TData;\n *\n * interface CompleteOverrideHKT extends HKT {\n * return: CompleteOverride<this[\"arg1\"]>;\n * }\n *\n * declare module \"@apollo/client\" {\n * export interface TypeOverrides {\n * Complete: CompleteOverrideHKT;\n * }\n * }\n * ```\n */\n export type Complete<TData> = ApplyHKTImplementationWithDefault<\n TypeOverrides,\n \"Complete\",\n OverridableTypes.Defaults,\n TData\n >;\n\n /**\n * Returns a representation of `TData` while it is streaming.\n *\n * @defaultValue `TData` if no overrides are provided.\n *\n * @example\n * You can override this type globally - this example shows how to override it\n * with `DeepPartial<TData>`:\n *\n * ```ts\n * import { HKT, DeepPartial } from \"@apollo/client/utilities\";\n *\n * type StreamingOverride<TData> = DeepPartial<TData>;\n *\n * interface StreamingOverrideHKT extends HKT {\n * return: StreamingOverride<this[\"arg1\"]>;\n * }\n *\n * declare module \"@apollo/client\" {\n * export interface TypeOverrides {\n * Streaming: StreamingOverrideHKT;\n * }\n * }\n * ```\n */\n export type Streaming<TData> = ApplyHKTImplementationWithDefault<\n TypeOverrides,\n \"Streaming\",\n OverridableTypes.Defaults,\n TData\n >;\n\n /**\n * Returns a representation of `TData` while it is partial.\n *\n * @defaultValue `DeepPartial<TData>` if no overrides are provided.\n *\n * @example\n * You can override this type globally - this example shows how to override it\n * with `DeepPartial<TData>`:\n *\n * ```ts\n * import { HKT, DeepPartial } from \"@apollo/client/utilities\";\n *\n * type PartialOverride<TData> = DeepPartial<Complete<TData>>;\n *\n * interface PartialOverrideHKT extends HKT {\n * return: PartialOverride<this[\"arg1\"]>;\n * }\n *\n * declare module \"@apollo/client\" {\n * export interface TypeOverrides {\n * Partial: PartialOverrideHKT;\n * }\n * }\n * ```\n */\n export type Partial<TData> = ApplyHKTImplementationWithDefault<\n TypeOverrides,\n \"Partial\",\n OverridableTypes.Defaults,\n TData\n >;\n}\n\nexport interface DefaultContext extends Record<string, any> {\n /**\n * Indicates whether `queryDeduplication` was enabled for the request.\n */\n queryDeduplication?: boolean;\n clientAwareness?: ClientAwarenessLink.ClientAwarenessOptions;\n}\n\nexport interface RefetchEvents {\n windowFocus: Event;\n online: Event;\n}\n\nexport declare namespace RefetchOn {\n export type Context<\n TSource extends keyof RefetchEvents = keyof RefetchEvents,\n > =\n TSource extends keyof RefetchEvents ?\n {\n /**\n * The source name that triggered the refetch.\n */\n source: TSource;\n\n /**\n * Any data emitted by the source along with the event\n */\n payload: RefetchEvents[TSource];\n }\n : never;\n\n export type Callback<\n TSource extends keyof RefetchEvents = keyof RefetchEvents,\n > = (context: RefetchOn.Context<TSource>) => boolean;\n\n export type Option =\n | boolean\n | RefetchOn.Callback<keyof RefetchEvents>\n | {\n [Key in keyof RefetchEvents]?: boolean | RefetchOn.Callback<Key>;\n };\n}\n\n/**\n * Represents an `Error` type, but used throughout Apollo Client to represent\n * errors that may otherwise fail `instanceof` checks if they are cross-realm\n * Error instances (see the [`Error.isError` proposal](https://github.com/tc39/proposal-is-error) for more details).\n *\n * Apollo Client uses several types of errors throughout the client which can be\n * narrowed using `instanceof`:\n *\n * - `CombinedGraphQLErrors` - `errors` returned from a GraphQL result\n * - `CombinedProtocolErrors` - Transport-level errors from multipart subscriptions.\n * - `ServerParseError` - A JSON-parse error when parsing the server response.\n * - `ServerError` - A non-200 server response.\n *\n * @example\n *\n * ```ts\n * import { CombinedGraphQLErrors } from \"@apollo/client\";\n *\n * try {\n * await client.query({ query });\n * } catch (error) {\n * // Use `instanceof` to check for more specific types of errors.\n * if (error instanceof CombinedGraphQLErrors) {\n * error.errors.map((graphQLError) => console.log(graphQLError.message));\n * } else {\n * console.error(errors);\n * }\n * }\n * ```\n */\nexport interface ErrorLike {\n message: string;\n name: string;\n stack?: string;\n}\n\nexport type OnQueryUpdated<TResult> = (\n observableQuery: ObservableQuery<any>,\n diff: Cache.DiffResult<any>,\n lastDiff: Cache.DiffResult<any> | undefined\n) => boolean | TResult;\n\nexport type RefetchQueryDescriptor = string | DocumentNode;\nexport type InternalRefetchQueryDescriptor =\n | RefetchQueryDescriptor\n | ApolloClient.QueryOptions;\n\ntype RefetchQueriesIncludeShorthand = \"all\" | \"active\";\n\nexport type RefetchQueriesInclude =\n | RefetchQueryDescriptor[]\n | RefetchQueriesIncludeShorthand;\n\nexport type InternalRefetchQueriesInclude =\n | InternalRefetchQueryDescriptor[]\n | RefetchQueriesIncludeShorthand;\n\n// The client.refetchQueries method returns a thenable (PromiseLike) object\n// whose result is an array of Promise.resolve'd TResult values, where TResult\n// is whatever type the (optional) onQueryUpdated function returns. When no\n// onQueryUpdated function is given, TResult defaults to ApolloQueryResult<any>\n// (thanks to default type parameters for client.refetchQueries).\nexport type RefetchQueriesPromiseResults<TResult> =\n // If onQueryUpdated returns any, all bets are off, so the results array must\n // be a generic any[] array, which is much less confusing than the union type\n // we get if we don't check for any. I hoped `any extends TResult` would do\n // the trick here, instead of IsStrictlyAny, but you can see for yourself what\n // fails in the refetchQueries tests if you try making that simplification.\n IsAny<TResult> extends true ? any[]\n : // If the onQueryUpdated function passed to client.refetchQueries returns true\n // or false, that means either to refetch the query (true) or to skip the\n // query (false). Since refetching produces an ApolloQueryResult<any>, and\n // skipping produces nothing, the fully-resolved array of all results produced\n // will be an ApolloQueryResult<any>[], when TResult extends boolean.\n TResult extends boolean ? ApolloClient.QueryResult<any>[]\n : // If onQueryUpdated returns a PromiseLike<U>, that thenable will be passed as\n // an array element to Promise.all, so we infer/unwrap the array type U here.\n TResult extends PromiseLike<infer U> ? U[]\n : // All other onQueryUpdated results end up in the final Promise.all array as\n // themselves, with their original TResult type. Note that TResult will\n // default to ApolloQueryResult<any> if no onQueryUpdated function is passed\n // to client.refetchQueries.\n TResult[];\n\n// Used by QueryManager[\"refetchQueries\"]\nexport interface InternalRefetchQueriesOptions<\n TCache extends ApolloCache,\n TResult,\n> extends Omit<ApolloClient.RefetchQueriesOptions<TCache, TResult>, \"include\"> {\n // Just like the refetchQueries option for a mutation, an array of strings,\n // DocumentNode objects, and/or QueryOptions objects, or one of the shorthand\n // strings \"all\" or \"active\", to select every (active) query.\n include?: InternalRefetchQueriesInclude;\n // This part of the API is a (useful) implementation detail, but need not be\n // exposed in the public client.refetchQueries API (above).\n removeOptimistic?: string;\n}\n\nexport type InternalRefetchQueriesResult<TResult> =\n // If onQueryUpdated returns a boolean, that's equivalent to refetching the\n // query when the boolean is true and skipping the query when false, so the\n // internal type of refetched results is Promise<ApolloQueryResult<any>>.\n TResult extends boolean ? Promise<ApolloClient.QueryResult<any>>\n : // Otherwise, onQueryUpdated returns whatever it returns. If onQueryUpdated is\n // not provided, TResult defaults to Promise<ApolloQueryResult<any>> (see the\n // generic type parameters of client.refetchQueries).\n TResult;\n\nexport type InternalRefetchQueriesMap<TResult> = Map<\n ObservableQuery<any>,\n InternalRefetchQueriesResult<TResult>\n>;\n\nexport type OperationVariables = Record<string, any>;\n\nexport type DataState<TData> =\n | {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#data:member} */\n data: DataValue.Complete<TData>;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#dataState:member} */\n dataState: \"complete\";\n }\n | {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#data:member} */\n data: DataValue.Streaming<TData>;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#dataState:member} */\n dataState: \"streaming\";\n }\n | {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#data:member} */\n data: DataValue.Partial<TData>;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#dataState:member} */\n dataState: \"partial\";\n }\n | {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#data:member} */\n data: undefined;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#dataState:member} */\n dataState: \"empty\";\n };\n\nexport type GetDataState<\n TData,\n TState extends DataState<TData>[\"dataState\"],\n> = Extract<DataState<TData>, { dataState: TState }>;\n\n/**\n * Represents a result that might be complete or still streaming and\n * has been normalized into a plain GraphQL result. When the result is\n * still `streaming`, some fields might not yet be available.\n */\nexport type NormalizedExecutionResult<\n TData = Record<string, unknown>,\n TExtensions = Record<string, unknown>,\n> = Omit<FormattedExecutionResult<TData, TExtensions>, \"data\"> &\n GetDataState<TData, \"streaming\" | \"complete\">;\n\n// This is part of the public API, people write these functions in `updateQueries`.\nexport type MutationQueryReducer<T> = (\n previousResult: Record<string, any>,\n options: {\n mutationResult: NormalizedExecutionResult<Unmasked<T>>;\n queryName: string | undefined;\n queryVariables: Record<string, any>;\n }\n) => Record<string, any>;\n\nexport type MutationQueryReducersMap<T = { [key: string]: any }> = {\n [queryName: string]: MutationQueryReducer<T>;\n};\n\nexport type MutationUpdaterFunction<\n TData,\n TVariables extends OperationVariables,\n TCache extends ApolloCache,\n> = (\n cache: TCache,\n result: FormattedExecutionResult<Unmasked<TData>>,\n options: {\n context?: DefaultContext;\n variables?: TVariables;\n }\n) => void;\n\nexport declare namespace QueryNotification {\n type NewNetworkStatus = NextNotification<{\n resetError?: boolean;\n }> & {\n source: \"newNetworkStatus\";\n };\n\n type SetResult<TData> = NextNotification<ObservableQuery.Result<TData>> & {\n source: \"setResult\";\n };\n\n type FromNetwork<TData> = ObservableNotification<\n ObservableQuery.Result<TData>\n > & {\n resolvedVariables?: OperationVariables;\n source: \"network\";\n };\n\n type FromCache<TData> = NextNotification<ObservableQuery.Result<TData>> & {\n resolvedVariables?: OperationVariables;\n source: \"cache\";\n };\n\n type Value<TData> =\n | FromCache<TData>\n | FromNetwork<TData>\n | NewNetworkStatus\n | SetResult<TData>;\n}\n\n/** Observable created by initiating a subscription operation. */\nexport interface SubscriptionObservable<T> extends Observable<T> {\n /**\n * Used to restart the connection to the link chain. Calling this on a\n * deduplicated subscription will restart the connection for all observables\n * that share the request.\n *\n * @example\n *\n * ```ts\n * const observable = client.subscribe({ query: subscription });\n * observable.subscribe((value) => {\n * // ...\n * });\n *\n * observable.restart();\n * ```\n */\n restart: () => void;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apollo/client",
3
- "version": "4.2.8",
3
+ "version": "4.2.10",
4
4
  "description": "A fully-featured caching GraphQL client.",
5
5
  "private": false,
6
6
  "keywords": [
@@ -2,7 +2,7 @@ import type { ApolloClient, DefaultContext, DocumentNode, ErrorPolicy, Operation
2
2
  import type { SubscribeToMoreFunction } from "@apollo/client";
3
3
  import type { QueryRef } from "@apollo/client/react";
4
4
  import type { FetchMoreFunction, RefetchFunction } from "@apollo/client/react/internal";
5
- import type { DocumentationTypes as UtilityDocumentationTypes, NoInfer, OptionWithFallback, SignatureStyle, VariablesOption } from "@apollo/client/utilities/internal";
5
+ import type { DocumentationTypes as UtilityDocumentationTypes, NoInfer, OptionWithFallback, Prettify, SignatureStyle, VariablesOption } from "@apollo/client/utilities/internal";
6
6
  import type { SkipToken } from "./constants.js";
7
7
  export declare namespace useBackgroundQuery {
8
8
  import _self = useBackgroundQuery;
@@ -114,16 +114,24 @@ export declare namespace useBackgroundQuery {
114
114
  * ```
115
115
  */
116
116
  skip?: boolean;
117
+ /**
118
+ * An object containing all of the GraphQL variables your query requires to execute.
119
+ *
120
+ * Each key in the object corresponds to a variable name, and that key's value corresponds to the variable value.
121
+ *
122
+ * @docGroup 1. Operation options
123
+ */
124
+ variables?: unknown;
117
125
  }
118
126
  }
119
127
  type Options<TVariables extends OperationVariables = OperationVariables> = Base.Options & VariablesOption<TVariables>;
120
128
  namespace DocumentationTypes {
121
129
  namespace useBackgroundQuery {
122
- interface Options<TVariables extends OperationVariables = OperationVariables> extends Base.Options, UtilityDocumentationTypes.VariableOptions<TVariables> {
130
+ interface Options<TVariables extends OperationVariables = OperationVariables> extends Omit<Base.Options, "variables">, UtilityDocumentationTypes.VariableOptions<TVariables> {
123
131
  }
124
132
  }
125
133
  }
126
- interface Result<TData = unknown, TVariables extends OperationVariables = OperationVariables> {
134
+ interface Result<TData = unknown, TVariables extends OperationVariables = OperationVariables, TErrorPolicy extends ErrorPolicy | undefined = undefined> {
127
135
  /**
128
136
  * A function that enables you to execute a [subscription](https://www.apollographql.com/docs/react/data/subscriptions/), usually to subscribe to specific fields that were included in the query.
129
137
  *
@@ -155,7 +163,7 @@ export declare namespace useBackgroundQuery {
155
163
  * @remarks
156
164
  * Calling this function will cause the component to re-suspend, unless the call site is wrapped in [`startTransition`](https://react.dev/reference/react/startTransition).
157
165
  */
158
- refetch: RefetchFunction<TData, TVariables>;
166
+ refetch: RefetchFunction<TData, TVariables, TErrorPolicy>;
159
167
  }
160
168
  namespace DocumentationTypes {
161
169
  namespace useBackgroundQuery {
@@ -166,9 +174,20 @@ export declare namespace useBackgroundQuery {
166
174
  interface DefaultOptions extends ApolloClient.DefaultOptions.WatchQuery.Calculated {
167
175
  skip: false;
168
176
  }
169
- type ResultForOptions<TData, TVariables extends OperationVariables, TOptions extends Record<string, never> | Options<TVariables> | SkipToken> = [
177
+ type OptionsFor<TVariables extends OperationVariables, TOptions extends {
178
+ variables?: unknown;
179
+ }> = useBackgroundQuery.Options<NoInfer<TVariables>> & {
180
+ variables?: Prettify<TVariables & {
181
+ [K in keyof TOptions["variables"]]: K extends keyof TVariables ? TVariables[K] : never;
182
+ }>;
183
+ } & (Exclude<keyof Exclude<TOptions, SkipToken>, keyof useBackgroundQuery.Options<any>> extends infer InvalidOptionNames extends string ? [
184
+ InvalidOptionNames
185
+ ] extends [never] ? unknown : {
186
+ [K in InvalidOptionNames]: never;
187
+ } : never);
188
+ type ResultForOptions<TData, TVariables extends OperationVariables, TOptions extends Record<string, never> | Base.Options | SkipToken> = [
170
189
  queryRef: TOptions extends any ? TOptions extends SkipToken ? undefined : QueryRef<TData, TVariables, "complete" | "streaming" | ((OptionWithFallback<TOptions, DefaultOptions, "errorPolicy"> extends "none" ? never : "empty") | (OptionWithFallback<TOptions, DefaultOptions, "returnPartialData"> extends false ? never : "partial"))> | (OptionWithFallback<TOptions, DefaultOptions, "skip"> extends false ? never : undefined) : never,
171
- result: useBackgroundQuery.Result<TData, TVariables>
190
+ result: useBackgroundQuery.Result<TData, TVariables, OptionWithFallback<TOptions, DefaultOptions, "errorPolicy"> & ErrorPolicy>
172
191
  ];
173
192
  namespace DocumentationTypes {
174
193
  interface useBackgroundQuery {
@@ -434,13 +453,14 @@ export declare namespace useBackgroundQuery {
434
453
  * @param query - A GraphQL query document parsed into an AST by `gql`.
435
454
  * @param options - An optional object containing options for the query. Instead of passing a `useBackgroundQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useBackgroundQuery` hook from executing the query or suspending.
436
455
  */
437
- <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
456
+ <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred", TErrorPolicy extends ErrorPolicy | undefined = undefined>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
438
457
  /** @deprecated `returnPartialData` has no effect on `no-cache` queries */
439
458
  returnPartialData: boolean;
440
459
  fetchPolicy: "no-cache";
460
+ errorPolicy?: TErrorPolicy;
441
461
  }): [
442
462
  QueryRef<TData, TVariables, "complete" | "streaming">,
443
- useBackgroundQuery.Result<TData, TVariables>
463
+ useBackgroundQuery.Result<TData, TVariables, TErrorPolicy>
444
464
  ];
445
465
  /**
446
466
  * For a detailed explanation of useBackgroundQuery, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
@@ -503,12 +523,12 @@ export declare namespace useBackgroundQuery {
503
523
  * @param query - A GraphQL query document parsed into an AST by `gql`.
504
524
  * @param options - An optional object containing options for the query. Instead of passing a `useBackgroundQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useBackgroundQuery` hook from executing the query or suspending.
505
525
  */
506
- <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
526
+ <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred", TErrorPolicy extends ErrorPolicy | undefined = undefined>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
507
527
  returnPartialData: false;
508
- errorPolicy: "ignore" | "all";
528
+ errorPolicy: TErrorPolicy & ("ignore" | "all");
509
529
  }): [
510
530
  QueryRef<TData, TVariables, "complete" | "streaming" | "empty">,
511
- useBackgroundQuery.Result<TData, TVariables>
531
+ useBackgroundQuery.Result<TData, TVariables, TErrorPolicy>
512
532
  ];
513
533
  /**
514
534
  * For a detailed explanation of useBackgroundQuery, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
@@ -571,12 +591,12 @@ export declare namespace useBackgroundQuery {
571
591
  * @param query - A GraphQL query document parsed into an AST by `gql`.
572
592
  * @param options - An optional object containing options for the query. Instead of passing a `useBackgroundQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useBackgroundQuery` hook from executing the query or suspending.
573
593
  */
574
- <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
594
+ <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred", TErrorPolicy extends ErrorPolicy | undefined = undefined>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
575
595
  returnPartialData: boolean;
576
- errorPolicy: "ignore" | "all";
596
+ errorPolicy: TErrorPolicy & ("ignore" | "all");
577
597
  }): [
578
598
  QueryRef<TData, TVariables, "complete" | "streaming" | "partial" | "empty">,
579
- useBackgroundQuery.Result<TData, TVariables>
599
+ useBackgroundQuery.Result<TData, TVariables, TErrorPolicy>
580
600
  ];
581
601
  /**
582
602
  * For a detailed explanation of useBackgroundQuery, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
@@ -639,11 +659,11 @@ export declare namespace useBackgroundQuery {
639
659
  * @param query - A GraphQL query document parsed into an AST by `gql`.
640
660
  * @param options - An optional object containing options for the query. Instead of passing a `useBackgroundQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useBackgroundQuery` hook from executing the query or suspending.
641
661
  */
642
- <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
643
- errorPolicy: "ignore" | "all";
662
+ <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred", TErrorPolicy extends ErrorPolicy | undefined = undefined>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
663
+ errorPolicy: TErrorPolicy & ("ignore" | "all");
644
664
  }): [
645
665
  QueryRef<TData, TVariables, "complete" | "streaming" | "empty">,
646
- useBackgroundQuery.Result<TData, TVariables>
666
+ useBackgroundQuery.Result<TData, TVariables, TErrorPolicy>
647
667
  ];
648
668
  /**
649
669
  * For a detailed explanation of useBackgroundQuery, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
@@ -706,12 +726,13 @@ export declare namespace useBackgroundQuery {
706
726
  * @param query - A GraphQL query document parsed into an AST by `gql`.
707
727
  * @param options - An optional object containing options for the query. Instead of passing a `useBackgroundQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useBackgroundQuery` hook from executing the query or suspending.
708
728
  */
709
- <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
729
+ <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred", TErrorPolicy extends ErrorPolicy | undefined = undefined>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
710
730
  skip: boolean;
711
731
  returnPartialData: false;
732
+ errorPolicy?: TErrorPolicy;
712
733
  }): [
713
734
  QueryRef<TData, TVariables, "complete" | "streaming"> | undefined,
714
- useBackgroundQuery.Result<TData, TVariables>
735
+ useBackgroundQuery.Result<TData, TVariables, TErrorPolicy>
715
736
  ];
716
737
  /**
717
738
  * For a detailed explanation of useBackgroundQuery, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
@@ -774,12 +795,13 @@ export declare namespace useBackgroundQuery {
774
795
  * @param query - A GraphQL query document parsed into an AST by `gql`.
775
796
  * @param options - An optional object containing options for the query. Instead of passing a `useBackgroundQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useBackgroundQuery` hook from executing the query or suspending.
776
797
  */
777
- <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
798
+ <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred", TErrorPolicy extends ErrorPolicy | undefined = undefined>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
778
799
  skip: boolean;
779
800
  returnPartialData: boolean;
801
+ errorPolicy?: TErrorPolicy;
780
802
  }): [
781
803
  (QueryRef<TData, TVariables, "complete" | "streaming" | "partial"> | undefined),
782
- useBackgroundQuery.Result<TData, TVariables>
804
+ useBackgroundQuery.Result<TData, TVariables, TErrorPolicy>
783
805
  ];
784
806
  /**
785
807
  * For a detailed explanation of useBackgroundQuery, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
@@ -842,11 +864,12 @@ export declare namespace useBackgroundQuery {
842
864
  * @param query - A GraphQL query document parsed into an AST by `gql`.
843
865
  * @param options - An optional object containing options for the query. Instead of passing a `useBackgroundQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useBackgroundQuery` hook from executing the query or suspending.
844
866
  */
845
- <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
867
+ <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred", TErrorPolicy extends ErrorPolicy | undefined = undefined>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
846
868
  returnPartialData: false;
869
+ errorPolicy?: TErrorPolicy;
847
870
  }): [
848
871
  QueryRef<TData, TVariables, "complete" | "streaming">,
849
- useBackgroundQuery.Result<TData, TVariables>
872
+ useBackgroundQuery.Result<TData, TVariables, TErrorPolicy>
850
873
  ];
851
874
  /**
852
875
  * For a detailed explanation of useBackgroundQuery, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
@@ -909,11 +932,12 @@ export declare namespace useBackgroundQuery {
909
932
  * @param query - A GraphQL query document parsed into an AST by `gql`.
910
933
  * @param options - An optional object containing options for the query. Instead of passing a `useBackgroundQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useBackgroundQuery` hook from executing the query or suspending.
911
934
  */
912
- <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
935
+ <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred", TErrorPolicy extends ErrorPolicy | undefined = undefined>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
913
936
  returnPartialData: boolean;
937
+ errorPolicy?: TErrorPolicy;
914
938
  }): [
915
939
  QueryRef<TData, TVariables, "complete" | "streaming" | "partial">,
916
- useBackgroundQuery.Result<TData, TVariables>
940
+ useBackgroundQuery.Result<TData, TVariables, TErrorPolicy>
917
941
  ];
918
942
  /**
919
943
  * For a detailed explanation of useBackgroundQuery, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
@@ -976,11 +1000,12 @@ export declare namespace useBackgroundQuery {
976
1000
  * @param query - A GraphQL query document parsed into an AST by `gql`.
977
1001
  * @param options - An optional object containing options for the query. Instead of passing a `useBackgroundQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useBackgroundQuery` hook from executing the query or suspending.
978
1002
  */
979
- <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
1003
+ <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred", TErrorPolicy extends ErrorPolicy | undefined = undefined>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
980
1004
  skip: boolean;
1005
+ errorPolicy?: TErrorPolicy;
981
1006
  }): [
982
1007
  QueryRef<TData, TVariables, "complete" | "streaming"> | undefined,
983
- useBackgroundQuery.Result<TData, TVariables>
1008
+ useBackgroundQuery.Result<TData, TVariables, TErrorPolicy>
984
1009
  ];
985
1010
  /**
986
1011
  * For a detailed explanation of useBackgroundQuery, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
@@ -1105,11 +1130,12 @@ export declare namespace useBackgroundQuery {
1105
1130
  * @param query - A GraphQL query document parsed into an AST by `gql`.
1106
1131
  * @param options - An optional object containing options for the query. Instead of passing a `useBackgroundQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useBackgroundQuery` hook from executing the query or suspending.
1107
1132
  */
1108
- <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken | (useBackgroundQuery.Options<NoInfer<TVariables>> & {
1133
+ <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred", TErrorPolicy extends ErrorPolicy | undefined = undefined>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken | (useBackgroundQuery.Options<NoInfer<TVariables>> & {
1109
1134
  returnPartialData: false;
1135
+ errorPolicy?: TErrorPolicy;
1110
1136
  })): [
1111
1137
  QueryRef<TData, TVariables, "complete" | "streaming"> | undefined,
1112
- useBackgroundQuery.Result<TData, TVariables>
1138
+ useBackgroundQuery.Result<TData, TVariables, TErrorPolicy>
1113
1139
  ];
1114
1140
  /**
1115
1141
  * For a detailed explanation of useBackgroundQuery, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
@@ -1172,11 +1198,12 @@ export declare namespace useBackgroundQuery {
1172
1198
  * @param query - A GraphQL query document parsed into an AST by `gql`.
1173
1199
  * @param options - An optional object containing options for the query. Instead of passing a `useBackgroundQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useBackgroundQuery` hook from executing the query or suspending.
1174
1200
  */
1175
- <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken | (useBackgroundQuery.Options<NoInfer<TVariables>> & {
1201
+ <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred", TErrorPolicy extends ErrorPolicy | undefined = undefined>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken | (useBackgroundQuery.Options<NoInfer<TVariables>> & {
1176
1202
  returnPartialData: boolean;
1203
+ errorPolicy?: TErrorPolicy;
1177
1204
  })): [
1178
1205
  (QueryRef<TData, TVariables, "complete" | "streaming" | "partial"> | undefined),
1179
- useBackgroundQuery.Result<TData, TVariables>
1206
+ useBackgroundQuery.Result<TData, TVariables, TErrorPolicy>
1180
1207
  ];
1181
1208
  /**
1182
1209
  * For a detailed explanation of useBackgroundQuery, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
@@ -1239,11 +1266,17 @@ export declare namespace useBackgroundQuery {
1239
1266
  * @param query - A GraphQL query document parsed into an AST by `gql`.
1240
1267
  * @param options - An optional object containing options for the query. Instead of passing a `useBackgroundQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useBackgroundQuery` hook from executing the query or suspending.
1241
1268
  */
1242
- <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, ...[options]: {} extends TVariables ? [
1243
- options?: useBackgroundQuery.Options<NoInfer<TVariables>>
1244
- ] : [options: useBackgroundQuery.Options<NoInfer<TVariables>>]): [
1269
+ <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred", TErrorPolicy extends ErrorPolicy | undefined = undefined>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, ...[options]: {} extends TVariables ? [
1270
+ options?: useBackgroundQuery.Options<NoInfer<TVariables>> & {
1271
+ errorPolicy?: TErrorPolicy;
1272
+ }
1273
+ ] : [
1274
+ options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
1275
+ errorPolicy?: TErrorPolicy;
1276
+ }
1277
+ ]): [
1245
1278
  QueryRef<TData, TVariables, "complete" | "streaming">,
1246
- useBackgroundQuery.Result<TData, TVariables>
1279
+ useBackgroundQuery.Result<TData, TVariables, TErrorPolicy>
1247
1280
  ];
1248
1281
  /**
1249
1282
  * For a detailed explanation of useBackgroundQuery, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
@@ -1306,11 +1339,17 @@ export declare namespace useBackgroundQuery {
1306
1339
  * @param query - A GraphQL query document parsed into an AST by `gql`.
1307
1340
  * @param options - An optional object containing options for the query. Instead of passing a `useBackgroundQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useBackgroundQuery` hook from executing the query or suspending.
1308
1341
  */
1309
- <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, ...[options]: {} extends TVariables ? [
1310
- options?: SkipToken | useBackgroundQuery.Options<NoInfer<TVariables>>
1311
- ] : [options: SkipToken | useBackgroundQuery.Options<NoInfer<TVariables>>]): [
1342
+ <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred", TErrorPolicy extends ErrorPolicy | undefined = undefined>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, ...[options]: {} extends TVariables ? [
1343
+ options?: SkipToken | (useBackgroundQuery.Options<NoInfer<TVariables>> & {
1344
+ errorPolicy?: TErrorPolicy;
1345
+ })
1346
+ ] : [
1347
+ options: SkipToken | (useBackgroundQuery.Options<NoInfer<TVariables>> & {
1348
+ errorPolicy?: TErrorPolicy;
1349
+ })
1350
+ ]): [
1312
1351
  QueryRef<TData, TVariables, "complete" | "streaming"> | undefined,
1313
- useBackgroundQuery.Result<TData, TVariables>
1352
+ useBackgroundQuery.Result<TData, TVariables, TErrorPolicy>
1314
1353
  ];
1315
1354
  /**
1316
1355
  * For a detailed explanation of useBackgroundQuery, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
@@ -1373,9 +1412,11 @@ export declare namespace useBackgroundQuery {
1373
1412
  * @param query - A GraphQL query document parsed into an AST by `gql`.
1374
1413
  * @param options - An optional object containing options for the query. Instead of passing a `useBackgroundQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useBackgroundQuery` hook from executing the query or suspending.
1375
1414
  */
1376
- <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken | useBackgroundQuery.Options<NoInfer<TVariables>>): [
1415
+ <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred", TErrorPolicy extends ErrorPolicy | undefined = undefined>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken | (useBackgroundQuery.Options<NoInfer<TVariables>> & {
1416
+ errorPolicy?: TErrorPolicy;
1417
+ })): [
1377
1418
  QueryRef<TData, TVariables, "complete" | "streaming"> | undefined,
1378
- useBackgroundQuery.Result<TData, TVariables>
1419
+ useBackgroundQuery.Result<TData, TVariables, TErrorPolicy>
1379
1420
  ];
1380
1421
  /**
1381
1422
  * @deprecated Avoid manually specifying generics on `useBackgroundQuery`.
@@ -2627,9 +2668,11 @@ export declare namespace useBackgroundQuery {
2627
2668
  * @param query - A GraphQL query document parsed into an AST by `gql`.
2628
2669
  * @param options - An optional object containing options for the query. Instead of passing a `useBackgroundQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useBackgroundQuery` hook from executing the query or suspending.
2629
2670
  */
2630
- <TData, TVariables extends OperationVariables, TOptions extends useBackgroundQuery.Options<NoInfer<TVariables>> & VariablesOption<TVariables & {
2631
- [K in Exclude<keyof TOptions["variables"], keyof TVariables>]?: never;
2632
- }>>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, ...[options]: {} extends TVariables ? [options?: TOptions] : [options: TOptions]): useBackgroundQuery.ResultForOptions<TData, TVariables, TOptions>;
2671
+ <TData, TVariables extends OperationVariables, TOptions extends Base.Options>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, ...[options]: {} extends TVariables ? [
2672
+ options?: TOptions & useBackgroundQuery.OptionsFor<TVariables, TOptions>
2673
+ ] : [
2674
+ options: TOptions & useBackgroundQuery.OptionsFor<TVariables, TOptions>
2675
+ ]): useBackgroundQuery.ResultForOptions<TData, TVariables, TOptions>;
2633
2676
  /**
2634
2677
  * For a detailed explanation of useBackgroundQuery, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
2635
2678
  *
@@ -2753,9 +2796,11 @@ export declare namespace useBackgroundQuery {
2753
2796
  * @param query - A GraphQL query document parsed into an AST by `gql`.
2754
2797
  * @param options - An optional object containing options for the query. Instead of passing a `useBackgroundQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useBackgroundQuery` hook from executing the query or suspending.
2755
2798
  */
2756
- <TData, TVariables extends OperationVariables, TOptions extends useBackgroundQuery.Options<NoInfer<TVariables>> & VariablesOption<TVariables & {
2757
- [K in Exclude<keyof TOptions["variables"], keyof TVariables>]?: never;
2758
- }>>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, ...[options]: {} extends TVariables ? [options?: TOptions | SkipToken] : [options: TOptions | SkipToken]): useBackgroundQuery.ResultForOptions<TData, TVariables, TOptions | SkipToken>;
2799
+ <TData, TVariables extends OperationVariables, TOptions extends Base.Options>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, ...[options]: {} extends TVariables ? [
2800
+ options?: (TOptions & useBackgroundQuery.OptionsFor<TVariables, TOptions>) | SkipToken
2801
+ ] : [
2802
+ options: (TOptions & useBackgroundQuery.OptionsFor<TVariables, TOptions>) | SkipToken
2803
+ ]): useBackgroundQuery.ResultForOptions<TData, TVariables, TOptions | SkipToken>;
2759
2804
  }
2760
2805
  type Evaluated = SignatureStyle extends "classic" ? Classic : Modern;
2761
2806
  }