@apollo/client 4.2.9 → 4.2.11

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 (85) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/__cjs/cache/core/cache.cjs +1 -1
  3. package/__cjs/cache/inmemory/entityStore.cjs +3 -3
  4. package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
  5. package/__cjs/cache/inmemory/policies.cjs +4 -4
  6. package/__cjs/cache/inmemory/readFromStore.cjs +2 -2
  7. package/__cjs/cache/inmemory/writeToStore.cjs +4 -4
  8. package/__cjs/core/ApolloClient.cjs.map +1 -1
  9. package/__cjs/core/ApolloClient.d.cts +44 -10
  10. package/__cjs/core/ObservableQuery.cjs.map +1 -1
  11. package/__cjs/core/ObservableQuery.d.cts +12 -1
  12. package/__cjs/core/QueryInfo.cjs +24 -1
  13. package/__cjs/core/QueryInfo.cjs.map +1 -1
  14. package/__cjs/core/QueryManager.cjs +12 -12
  15. package/__cjs/core/RefetchEventManager.cjs +3 -3
  16. package/__cjs/invariantErrorCodes.cjs +49 -30
  17. package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
  18. package/__cjs/react/hooks/useBackgroundQuery.d.cts +100 -47
  19. package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
  20. package/__cjs/react/hooks/useLazyQuery.d.cts +26 -20
  21. package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
  22. package/__cjs/react/hooks/useLoadableQuery.d.cts +23 -15
  23. package/__cjs/react/hooks/useMutation.cjs.map +1 -1
  24. package/__cjs/react/hooks/useMutation.d.cts +10 -7
  25. package/__cjs/react/hooks/useQuery.cjs.map +1 -1
  26. package/__cjs/react/hooks/useQuery.d.cts +74 -32
  27. package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
  28. package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
  29. package/__cjs/react/hooks/useSuspenseQuery.d.cts +83 -34
  30. package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
  31. package/__cjs/react/internal/types.d.cts +14 -3
  32. package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
  33. package/__cjs/react/query-preloader/createQueryPreloader.d.cts +20 -5
  34. package/__cjs/version.cjs +1 -1
  35. package/__cjs/version.cjs.map +1 -1
  36. package/cache/core/cache.js +1 -1
  37. package/cache/inmemory/entityStore.js +3 -3
  38. package/cache/inmemory/key-extractor.js +1 -1
  39. package/cache/inmemory/policies.js +4 -4
  40. package/cache/inmemory/readFromStore.js +2 -2
  41. package/cache/inmemory/writeToStore.js +4 -4
  42. package/core/ApolloClient.d.ts +44 -10
  43. package/core/ApolloClient.js.map +1 -1
  44. package/core/ObservableQuery.d.ts +12 -1
  45. package/core/ObservableQuery.js.map +1 -1
  46. package/core/QueryInfo.js +19 -0
  47. package/core/QueryInfo.js.map +1 -1
  48. package/core/QueryManager.js +12 -12
  49. package/core/QueryManager.js.map +1 -1
  50. package/core/RefetchEventManager.js +3 -3
  51. package/invariantErrorCodes.js +49 -30
  52. package/package.json +1 -1
  53. package/react/hooks/useBackgroundQuery.d.ts +100 -47
  54. package/react/hooks/useBackgroundQuery.js.map +1 -1
  55. package/react/hooks/useLazyQuery.d.ts +26 -20
  56. package/react/hooks/useLazyQuery.js.map +1 -1
  57. package/react/hooks/useLoadableQuery.d.ts +23 -15
  58. package/react/hooks/useLoadableQuery.js.map +1 -1
  59. package/react/hooks/useMutation.d.ts +10 -7
  60. package/react/hooks/useMutation.js.map +1 -1
  61. package/react/hooks/useQuery.d.ts +74 -32
  62. package/react/hooks/useQuery.js.map +1 -1
  63. package/react/hooks/useQueryRefHandlers.js.map +1 -1
  64. package/react/hooks/useSuspenseQuery.d.ts +83 -34
  65. package/react/hooks/useSuspenseQuery.js.map +1 -1
  66. package/react/hooks-compiled/useBackgroundQuery.d.ts +100 -47
  67. package/react/hooks-compiled/useBackgroundQuery.js.map +1 -1
  68. package/react/hooks-compiled/useLazyQuery.d.ts +26 -20
  69. package/react/hooks-compiled/useLazyQuery.js.map +1 -1
  70. package/react/hooks-compiled/useLoadableQuery.d.ts +23 -15
  71. package/react/hooks-compiled/useLoadableQuery.js.map +1 -1
  72. package/react/hooks-compiled/useMutation.d.ts +10 -7
  73. package/react/hooks-compiled/useMutation.js.map +1 -1
  74. package/react/hooks-compiled/useQuery.d.ts +74 -32
  75. package/react/hooks-compiled/useQuery.js.map +1 -1
  76. package/react/hooks-compiled/useQueryRefHandlers.js.map +1 -1
  77. package/react/hooks-compiled/useSuspenseQuery.d.ts +83 -34
  78. package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
  79. package/react/internal/cache/QueryReference.js.map +1 -1
  80. package/react/internal/types.d.ts +15 -4
  81. package/react/internal/types.js.map +1 -1
  82. package/react/query-preloader/createQueryPreloader.d.ts +20 -5
  83. package/react/query-preloader/createQueryPreloader.js.map +1 -1
  84. package/version.js +1 -1
  85. package/version.js.map +1 -1
@@ -27,7 +27,7 @@ export class RefetchEventManager {
27
27
  }
28
28
  if (this.client) {
29
29
  if (__DEV__) {
30
- __DEV__ && invariant.warn(101);
30
+ __DEV__ && invariant.warn(102);
31
31
  }
32
32
  this.disconnect();
33
33
  }
@@ -96,13 +96,13 @@ export class RefetchEventManager {
96
96
  const [payload] = args;
97
97
  if (!this.client) {
98
98
  if (__DEV__) {
99
- __DEV__ && invariant.warn(102, source);
99
+ __DEV__ && invariant.warn(103, source);
100
100
  }
101
101
  return;
102
102
  }
103
103
  if (!this.hasSource(source)) {
104
104
  if (__DEV__) {
105
- __DEV__ && invariant.warn(103, source);
105
+ __DEV__ && invariant.warn(104, source);
106
106
  }
107
107
  return;
108
108
  }
@@ -444,98 +444,98 @@ const client = new ApolloClient({
444
444
  message: "You must provide an `updateQuery` function when using `fetchMore` with a `no-cache` fetch policy."
445
445
  },
446
446
 
447
- 89: {
447
+ 90: {
448
448
  file: "@apollo/client/core/QueryManager.js",
449
449
  message: "QueryManager stopped while query was in flight"
450
450
  },
451
451
 
452
- 90: {
452
+ 91: {
453
453
  file: "@apollo/client/core/QueryManager.js",
454
454
  condition: "this.localState",
455
455
  message: "Mutation '%s' contains `@client` fields with variables provided by `@export` but local state has not been configured."
456
456
  },
457
457
 
458
- 91: {
458
+ 92: {
459
459
  file: "@apollo/client/core/QueryManager.js",
460
460
  message: "Store reset while query was in flight (not completed in link chain)"
461
461
  },
462
462
 
463
- 94: {
463
+ 95: {
464
464
  file: "@apollo/client/core/QueryManager.js",
465
465
  condition: "!this.getDocumentInfo(query).hasClientExports || this.localState",
466
466
  message: "Subscription '%s' contains `@client` fields with variables provided by `@export` but local state has not been configured."
467
467
  },
468
468
 
469
- 95: {
469
+ 96: {
470
470
  file: "@apollo/client/core/QueryManager.js",
471
471
  condition: "this.localState",
472
472
  message: "%s '%s' contains `@client` fields but local state has not been configured."
473
473
  },
474
474
 
475
- 96: {
475
+ 97: {
476
476
  file: "@apollo/client/core/QueryManager.js",
477
477
  condition: "!hasIncrementalDirective",
478
478
  message: "%s '%s' contains `@client` and `@defer` directives. These cannot be used together."
479
479
  },
480
480
 
481
- 97: {
481
+ 98: {
482
482
  file: "@apollo/client/core/QueryManager.js",
483
483
  condition: "this.localState",
484
484
  message: "Query '%s' contains `@client` fields with variables provided by `@export` but local state has not been configured."
485
485
  },
486
486
 
487
- 99: {
487
+ 100: {
488
488
  file: "@apollo/client/core/QueryManager.js",
489
489
  condition: "this.localState",
490
490
  message: "Query '%s' contains `@client` fields but local state has not been configured."
491
491
  },
492
492
 
493
- 100: {
493
+ 101: {
494
494
  file: "@apollo/client/core/QueryManager.js",
495
495
  condition: "didEmitValue",
496
496
  message: "The link chain completed without emitting a value. This is likely unintentional and should be updated to emit a value before completing."
497
497
  },
498
498
 
499
- 104: {
499
+ 105: {
500
500
  file: "@apollo/client/cache/inmemory/entityStore.js",
501
501
  condition: "typeof dataId === \"string\"",
502
502
  message: "store.merge expects a string ID"
503
503
  },
504
504
 
505
- 107: {
505
+ 108: {
506
506
  file: "@apollo/client/cache/inmemory/key-extractor.js",
507
507
  condition: "extracted !== void 0",
508
508
  message: `Missing field '%s' while extracting keyFields from %s`
509
509
  },
510
510
 
511
- 108: {
511
+ 109: {
512
512
  file: "@apollo/client/cache/inmemory/policies.js",
513
513
  condition: "!old || old === which",
514
514
  message: `Cannot change root %s __typename more than once`
515
515
  },
516
516
 
517
- 111: {
517
+ 112: {
518
518
  file: "@apollo/client/cache/inmemory/policies.js",
519
519
  message: "Cannot automatically merge arrays"
520
520
  },
521
521
 
522
- 112: {
522
+ 113: {
523
523
  file: "@apollo/client/cache/inmemory/readFromStore.js",
524
524
  message: `No fragment named %s`
525
525
  },
526
526
 
527
- 113: {
527
+ 114: {
528
528
  file: "@apollo/client/cache/inmemory/readFromStore.js",
529
529
  condition: "!isReference(value)",
530
530
  message: `Missing selection set for object of type %s returned for query field %s`
531
531
  },
532
532
 
533
- 114: {
533
+ 115: {
534
534
  file: "@apollo/client/cache/inmemory/writeToStore.js",
535
535
  message: `Could not identify object %s`
536
536
  },
537
537
 
538
- 116: {
538
+ 117: {
539
539
  file: "@apollo/client/cache/inmemory/writeToStore.js",
540
540
  message: `No fragment named %s`
541
541
  }
@@ -647,37 +647,56 @@ Did you mean to call refetch(variables) instead of refetch({ variables })?`
647
647
  message: "Cannot poll on 'cache-only' query '%s' and as such, polling is disabled. Please use a different fetch policy."
648
648
  },
649
649
 
650
- 92: {
650
+ 89: {
651
+ file: "@apollo/client/core/QueryInfo.js",
652
+
653
+ message: `The network result for query %s was written to the cache, but reading it back returned a partial result.
654
+
655
+ A \`read\` or \`merge\` function left missing fields after this write. Because the cache result is incomplete, Apollo Client cannot apply it to the network result. The raw network result was returned instead, and doesn't include any transformed values returned from \`read\` functions.
656
+
657
+ To address this problem (which is not a bug in Apollo Client), check the \`read\` and \`merge\` functions for the fields in this query. A \`read\` or \`merge\` function that leaves missing fields leaves the cache unable to fulfill the query's data requirements.
658
+
659
+ missing fields: %o
660
+ network result: %o
661
+ cache result: %o
662
+
663
+ For more information, please refer to the documentation:
664
+
665
+ * Customizing cache field behavior: https://go.apollo.dev/c/cache-field-behavior
666
+ `
667
+ },
668
+
669
+ 93: {
651
670
  file: "@apollo/client/core/QueryManager.js",
652
671
  message: `Unknown query named "%s" requested in refetchQueries options.include array`
653
672
  },
654
673
 
655
- 93: {
674
+ 94: {
656
675
  file: "@apollo/client/core/QueryManager.js",
657
676
  message: `Unknown anonymous query requested in refetchQueries options.include array`
658
677
  },
659
678
 
660
- 98: {
679
+ 99: {
661
680
  file: "@apollo/client/core/QueryManager.js",
662
681
  message: '[%s]: Fragments masked by data masking are inaccessible when using fetch policy "no-cache". Please add `@unmask` to each fragment spread to access the data.'
663
682
  },
664
683
 
665
- 101: {
684
+ 102: {
666
685
  file: "@apollo/client/core/RefetchEventManager.js",
667
686
  message: "Connected an `ApolloClient` instance to a `RefetchEventManager` that was already connected to a different `ApolloClient`. The previous client has been disconnected and will no longer receive refetch events from this manager."
668
687
  },
669
688
 
670
- 102: {
689
+ 103: {
671
690
  file: "@apollo/client/core/RefetchEventManager.js",
672
691
  message: "Received '%s' event but an `ApolloClient` instance is not connected to the `RefetchEventManager`. No queries will refetch. Pass the manager to the `refetchEventManager` option on the `ApolloClient` constructor."
673
692
  },
674
693
 
675
- 103: {
694
+ 104: {
676
695
  file: "@apollo/client/core/RefetchEventManager.js",
677
696
  message: "Received '%s' event but no source is configured for it on the `RefetchEventManager`. No queries will refetch. Add the event to the `sources` option or call `setEventSource`."
678
697
  },
679
698
 
680
- 105: {
699
+ 106: {
681
700
  file: "@apollo/client/cache/inmemory/entityStore.js",
682
701
 
683
702
  message: "cache.modify: You are trying to write a Reference that is not part of the store: %o\n" +
@@ -685,24 +704,24 @@ Did you mean to call refetch(variables) instead of refetch({ variables })?`
685
704
  "`toReference(object, true)`"
686
705
  },
687
706
 
688
- 106: {
707
+ 107: {
689
708
  file: "@apollo/client/cache/inmemory/entityStore.js",
690
709
 
691
710
  message: "cache.modify: Writing an array with a mix of both References and Objects will not result in the Objects being normalized correctly.\n" +
692
711
  "Please convert the object instance %o to a Reference before writing it to the cache by calling `toReference(object, true)`."
693
712
  },
694
713
 
695
- 109: {
714
+ 110: {
696
715
  file: "@apollo/client/cache/inmemory/policies.js",
697
716
  message: `Inferring subtype %s of supertype %s`
698
717
  },
699
718
 
700
- 110: {
719
+ 111: {
701
720
  file: "@apollo/client/cache/inmemory/policies.js",
702
721
  message: `Undefined 'from' passed to readField with arguments %s`
703
722
  },
704
723
 
705
- 117: {
724
+ 118: {
706
725
  file: "@apollo/client/cache/inmemory/writeToStore.js",
707
726
 
708
727
  message: `Cache data may be lost when replacing the %s field of a %s object.
@@ -721,7 +740,7 @@ For more information about these options, please refer to the documentation:
721
740
  `
722
741
  },
723
742
 
724
- 118: {
743
+ 119: {
725
744
  file: "@apollo/client/cache/core/cache.js",
726
745
  message: "Could not identify object passed to `from` for '%s' fragment, either because the object is non-normalized or the key fields are missing. If you are masking this object, please ensure the key fields are requested by the parent object."
727
746
  }
@@ -743,7 +762,7 @@ export const devError = {
743
762
  message: "Unhandled GraphQL subscription error"
744
763
  },
745
764
 
746
- 115: {
765
+ 116: {
747
766
  file: "@apollo/client/cache/inmemory/writeToStore.js",
748
767
  message: `Missing field '%s' while writing result %o`
749
768
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apollo/client",
3
- "version": "4.2.9",
3
+ "version": "4.2.11",
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 { 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,32 @@ 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 Base.Options {
131
+ /**
132
+ * An object containing all of the GraphQL variables your query requires to execute.
133
+ *
134
+ * Each key in the object corresponds to a variable name, and that key's value corresponds to the variable value.
135
+ *
136
+ * @docGroup 1. Operation options
137
+ */
138
+ variables?: TVariables;
123
139
  }
124
140
  }
125
141
  }
126
- interface Result<TData = unknown, TVariables extends OperationVariables = OperationVariables> {
142
+ interface Result<TData = unknown, TVariables extends OperationVariables = OperationVariables, TErrorPolicy extends ErrorPolicy | undefined = undefined> {
127
143
  /**
128
144
  * 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
145
  *
@@ -155,7 +171,7 @@ export declare namespace useBackgroundQuery {
155
171
  * @remarks
156
172
  * 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
173
  */
158
- refetch: RefetchFunction<TData, TVariables>;
174
+ refetch: RefetchFunction<TData, TVariables, TErrorPolicy>;
159
175
  }
160
176
  namespace DocumentationTypes {
161
177
  namespace useBackgroundQuery {
@@ -166,9 +182,20 @@ export declare namespace useBackgroundQuery {
166
182
  interface DefaultOptions extends ApolloClient.DefaultOptions.WatchQuery.Calculated {
167
183
  skip: false;
168
184
  }
169
- type ResultForOptions<TData, TVariables extends OperationVariables, TOptions extends Record<string, never> | Options<TVariables> | SkipToken> = [
185
+ type OptionsFor<TVariables extends OperationVariables, TOptions extends {
186
+ variables?: unknown;
187
+ }> = useBackgroundQuery.Options<NoInfer<TVariables>> & {
188
+ variables?: Prettify<TVariables & {
189
+ [K in keyof TOptions["variables"]]: K extends keyof TVariables ? TVariables[K] : never;
190
+ }>;
191
+ } & (Exclude<keyof Exclude<TOptions, SkipToken>, keyof useBackgroundQuery.Options<any>> extends infer InvalidOptionNames extends string ? [
192
+ InvalidOptionNames
193
+ ] extends [never] ? unknown : {
194
+ [K in InvalidOptionNames]: never;
195
+ } : never);
196
+ type ResultForOptions<TData, TVariables extends OperationVariables, TOptions extends Record<string, never> | Base.Options | SkipToken> = [
170
197
  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>
198
+ result: useBackgroundQuery.Result<TData, TVariables, OptionWithFallback<TOptions, DefaultOptions, "errorPolicy"> & ErrorPolicy>
172
199
  ];
173
200
  namespace DocumentationTypes {
174
201
  interface useBackgroundQuery {
@@ -434,13 +461,14 @@ export declare namespace useBackgroundQuery {
434
461
  * @param query - A GraphQL query document parsed into an AST by `gql`.
435
462
  * @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
463
  */
437
- <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
464
+ <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
465
  /** @deprecated `returnPartialData` has no effect on `no-cache` queries */
439
466
  returnPartialData: boolean;
440
467
  fetchPolicy: "no-cache";
468
+ errorPolicy?: TErrorPolicy;
441
469
  }): [
442
470
  QueryRef<TData, TVariables, "complete" | "streaming">,
443
- useBackgroundQuery.Result<TData, TVariables>
471
+ useBackgroundQuery.Result<TData, TVariables, TErrorPolicy>
444
472
  ];
445
473
  /**
446
474
  * For a detailed explanation of useBackgroundQuery, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
@@ -503,12 +531,12 @@ export declare namespace useBackgroundQuery {
503
531
  * @param query - A GraphQL query document parsed into an AST by `gql`.
504
532
  * @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
533
  */
506
- <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
534
+ <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
535
  returnPartialData: false;
508
- errorPolicy: "ignore" | "all";
536
+ errorPolicy: TErrorPolicy & ("ignore" | "all");
509
537
  }): [
510
538
  QueryRef<TData, TVariables, "complete" | "streaming" | "empty">,
511
- useBackgroundQuery.Result<TData, TVariables>
539
+ useBackgroundQuery.Result<TData, TVariables, TErrorPolicy>
512
540
  ];
513
541
  /**
514
542
  * For a detailed explanation of useBackgroundQuery, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
@@ -571,12 +599,12 @@ export declare namespace useBackgroundQuery {
571
599
  * @param query - A GraphQL query document parsed into an AST by `gql`.
572
600
  * @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
601
  */
574
- <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
602
+ <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
603
  returnPartialData: boolean;
576
- errorPolicy: "ignore" | "all";
604
+ errorPolicy: TErrorPolicy & ("ignore" | "all");
577
605
  }): [
578
606
  QueryRef<TData, TVariables, "complete" | "streaming" | "partial" | "empty">,
579
- useBackgroundQuery.Result<TData, TVariables>
607
+ useBackgroundQuery.Result<TData, TVariables, TErrorPolicy>
580
608
  ];
581
609
  /**
582
610
  * For a detailed explanation of useBackgroundQuery, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
@@ -639,11 +667,11 @@ export declare namespace useBackgroundQuery {
639
667
  * @param query - A GraphQL query document parsed into an AST by `gql`.
640
668
  * @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
669
  */
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";
670
+ <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>> & {
671
+ errorPolicy: TErrorPolicy & ("ignore" | "all");
644
672
  }): [
645
673
  QueryRef<TData, TVariables, "complete" | "streaming" | "empty">,
646
- useBackgroundQuery.Result<TData, TVariables>
674
+ useBackgroundQuery.Result<TData, TVariables, TErrorPolicy>
647
675
  ];
648
676
  /**
649
677
  * For a detailed explanation of useBackgroundQuery, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
@@ -706,12 +734,13 @@ export declare namespace useBackgroundQuery {
706
734
  * @param query - A GraphQL query document parsed into an AST by `gql`.
707
735
  * @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
736
  */
709
- <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
737
+ <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
738
  skip: boolean;
711
739
  returnPartialData: false;
740
+ errorPolicy?: TErrorPolicy;
712
741
  }): [
713
742
  QueryRef<TData, TVariables, "complete" | "streaming"> | undefined,
714
- useBackgroundQuery.Result<TData, TVariables>
743
+ useBackgroundQuery.Result<TData, TVariables, TErrorPolicy>
715
744
  ];
716
745
  /**
717
746
  * For a detailed explanation of useBackgroundQuery, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
@@ -774,12 +803,13 @@ export declare namespace useBackgroundQuery {
774
803
  * @param query - A GraphQL query document parsed into an AST by `gql`.
775
804
  * @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
805
  */
777
- <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
806
+ <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
807
  skip: boolean;
779
808
  returnPartialData: boolean;
809
+ errorPolicy?: TErrorPolicy;
780
810
  }): [
781
811
  (QueryRef<TData, TVariables, "complete" | "streaming" | "partial"> | undefined),
782
- useBackgroundQuery.Result<TData, TVariables>
812
+ useBackgroundQuery.Result<TData, TVariables, TErrorPolicy>
783
813
  ];
784
814
  /**
785
815
  * For a detailed explanation of useBackgroundQuery, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
@@ -842,11 +872,12 @@ export declare namespace useBackgroundQuery {
842
872
  * @param query - A GraphQL query document parsed into an AST by `gql`.
843
873
  * @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
874
  */
845
- <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
875
+ <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
876
  returnPartialData: false;
877
+ errorPolicy?: TErrorPolicy;
847
878
  }): [
848
879
  QueryRef<TData, TVariables, "complete" | "streaming">,
849
- useBackgroundQuery.Result<TData, TVariables>
880
+ useBackgroundQuery.Result<TData, TVariables, TErrorPolicy>
850
881
  ];
851
882
  /**
852
883
  * For a detailed explanation of useBackgroundQuery, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
@@ -909,11 +940,12 @@ export declare namespace useBackgroundQuery {
909
940
  * @param query - A GraphQL query document parsed into an AST by `gql`.
910
941
  * @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
942
  */
912
- <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
943
+ <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
944
  returnPartialData: boolean;
945
+ errorPolicy?: TErrorPolicy;
914
946
  }): [
915
947
  QueryRef<TData, TVariables, "complete" | "streaming" | "partial">,
916
- useBackgroundQuery.Result<TData, TVariables>
948
+ useBackgroundQuery.Result<TData, TVariables, TErrorPolicy>
917
949
  ];
918
950
  /**
919
951
  * For a detailed explanation of useBackgroundQuery, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
@@ -976,11 +1008,12 @@ export declare namespace useBackgroundQuery {
976
1008
  * @param query - A GraphQL query document parsed into an AST by `gql`.
977
1009
  * @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
1010
  */
979
- <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
1011
+ <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
1012
  skip: boolean;
1013
+ errorPolicy?: TErrorPolicy;
981
1014
  }): [
982
1015
  QueryRef<TData, TVariables, "complete" | "streaming"> | undefined,
983
- useBackgroundQuery.Result<TData, TVariables>
1016
+ useBackgroundQuery.Result<TData, TVariables, TErrorPolicy>
984
1017
  ];
985
1018
  /**
986
1019
  * For a detailed explanation of useBackgroundQuery, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
@@ -1105,11 +1138,12 @@ export declare namespace useBackgroundQuery {
1105
1138
  * @param query - A GraphQL query document parsed into an AST by `gql`.
1106
1139
  * @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
1140
  */
1108
- <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken | (useBackgroundQuery.Options<NoInfer<TVariables>> & {
1141
+ <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
1142
  returnPartialData: false;
1143
+ errorPolicy?: TErrorPolicy;
1110
1144
  })): [
1111
1145
  QueryRef<TData, TVariables, "complete" | "streaming"> | undefined,
1112
- useBackgroundQuery.Result<TData, TVariables>
1146
+ useBackgroundQuery.Result<TData, TVariables, TErrorPolicy>
1113
1147
  ];
1114
1148
  /**
1115
1149
  * For a detailed explanation of useBackgroundQuery, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
@@ -1172,11 +1206,12 @@ export declare namespace useBackgroundQuery {
1172
1206
  * @param query - A GraphQL query document parsed into an AST by `gql`.
1173
1207
  * @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
1208
  */
1175
- <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken | (useBackgroundQuery.Options<NoInfer<TVariables>> & {
1209
+ <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
1210
  returnPartialData: boolean;
1211
+ errorPolicy?: TErrorPolicy;
1177
1212
  })): [
1178
1213
  (QueryRef<TData, TVariables, "complete" | "streaming" | "partial"> | undefined),
1179
- useBackgroundQuery.Result<TData, TVariables>
1214
+ useBackgroundQuery.Result<TData, TVariables, TErrorPolicy>
1180
1215
  ];
1181
1216
  /**
1182
1217
  * For a detailed explanation of useBackgroundQuery, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
@@ -1239,11 +1274,17 @@ export declare namespace useBackgroundQuery {
1239
1274
  * @param query - A GraphQL query document parsed into an AST by `gql`.
1240
1275
  * @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
1276
  */
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>>]): [
1277
+ <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred", TErrorPolicy extends ErrorPolicy | undefined = undefined>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, ...[options]: {} extends TVariables ? [
1278
+ options?: useBackgroundQuery.Options<NoInfer<TVariables>> & {
1279
+ errorPolicy?: TErrorPolicy;
1280
+ }
1281
+ ] : [
1282
+ options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
1283
+ errorPolicy?: TErrorPolicy;
1284
+ }
1285
+ ]): [
1245
1286
  QueryRef<TData, TVariables, "complete" | "streaming">,
1246
- useBackgroundQuery.Result<TData, TVariables>
1287
+ useBackgroundQuery.Result<TData, TVariables, TErrorPolicy>
1247
1288
  ];
1248
1289
  /**
1249
1290
  * For a detailed explanation of useBackgroundQuery, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
@@ -1306,11 +1347,17 @@ export declare namespace useBackgroundQuery {
1306
1347
  * @param query - A GraphQL query document parsed into an AST by `gql`.
1307
1348
  * @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
1349
  */
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>>]): [
1350
+ <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred", TErrorPolicy extends ErrorPolicy | undefined = undefined>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, ...[options]: {} extends TVariables ? [
1351
+ options?: SkipToken | (useBackgroundQuery.Options<NoInfer<TVariables>> & {
1352
+ errorPolicy?: TErrorPolicy;
1353
+ })
1354
+ ] : [
1355
+ options: SkipToken | (useBackgroundQuery.Options<NoInfer<TVariables>> & {
1356
+ errorPolicy?: TErrorPolicy;
1357
+ })
1358
+ ]): [
1312
1359
  QueryRef<TData, TVariables, "complete" | "streaming"> | undefined,
1313
- useBackgroundQuery.Result<TData, TVariables>
1360
+ useBackgroundQuery.Result<TData, TVariables, TErrorPolicy>
1314
1361
  ];
1315
1362
  /**
1316
1363
  * For a detailed explanation of useBackgroundQuery, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
@@ -1373,9 +1420,11 @@ export declare namespace useBackgroundQuery {
1373
1420
  * @param query - A GraphQL query document parsed into an AST by `gql`.
1374
1421
  * @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
1422
  */
1376
- <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken | useBackgroundQuery.Options<NoInfer<TVariables>>): [
1423
+ <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>> & {
1424
+ errorPolicy?: TErrorPolicy;
1425
+ })): [
1377
1426
  QueryRef<TData, TVariables, "complete" | "streaming"> | undefined,
1378
- useBackgroundQuery.Result<TData, TVariables>
1427
+ useBackgroundQuery.Result<TData, TVariables, TErrorPolicy>
1379
1428
  ];
1380
1429
  /**
1381
1430
  * @deprecated Avoid manually specifying generics on `useBackgroundQuery`.
@@ -2627,9 +2676,11 @@ export declare namespace useBackgroundQuery {
2627
2676
  * @param query - A GraphQL query document parsed into an AST by `gql`.
2628
2677
  * @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
2678
  */
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>;
2679
+ <TData, TVariables extends OperationVariables, TOptions extends Base.Options>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, ...[options]: {} extends TVariables ? [
2680
+ options?: TOptions & useBackgroundQuery.OptionsFor<TVariables, TOptions>
2681
+ ] : [
2682
+ options: TOptions & useBackgroundQuery.OptionsFor<TVariables, TOptions>
2683
+ ]): useBackgroundQuery.ResultForOptions<TData, TVariables, TOptions>;
2633
2684
  /**
2634
2685
  * For a detailed explanation of useBackgroundQuery, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
2635
2686
  *
@@ -2753,9 +2804,11 @@ export declare namespace useBackgroundQuery {
2753
2804
  * @param query - A GraphQL query document parsed into an AST by `gql`.
2754
2805
  * @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
2806
  */
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>;
2807
+ <TData, TVariables extends OperationVariables, TOptions extends Base.Options>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, ...[options]: {} extends TVariables ? [
2808
+ options?: (TOptions & useBackgroundQuery.OptionsFor<TVariables, TOptions>) | SkipToken
2809
+ ] : [
2810
+ options: (TOptions & useBackgroundQuery.OptionsFor<TVariables, TOptions>) | SkipToken
2811
+ ]): useBackgroundQuery.ResultForOptions<TData, TVariables, TOptions | SkipToken>;
2759
2812
  }
2760
2813
  type Evaluated = SignatureStyle extends "classic" ? Classic : Modern;
2761
2814
  }