@apollo/client 4.0.0-alpha.2 → 4.0.0-alpha.4

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 (150) hide show
  1. package/.changeset/eighty-squids-fix.md +15 -0
  2. package/.changeset/four-ghosts-watch.md +5 -0
  3. package/.changeset/funny-jeans-invent.md +16 -0
  4. package/.changeset/khaki-spies-work.md +11 -0
  5. package/.changeset/light-apes-rescue.md +5 -0
  6. package/.changeset/odd-lemons-relax.md +5 -0
  7. package/.changeset/pre.json +7 -0
  8. package/.changeset/unlucky-kiwis-sell.md +5 -0
  9. package/CHANGELOG.md +58 -0
  10. package/__cjs/core/ApolloClient.cjs +22 -13
  11. package/__cjs/core/ApolloClient.cjs.map +1 -1
  12. package/__cjs/core/ApolloClient.d.cts +13 -1
  13. package/__cjs/core/ObservableQuery.cjs +29 -10
  14. package/__cjs/core/ObservableQuery.cjs.map +1 -1
  15. package/__cjs/core/ObservableQuery.d.cts +6 -3
  16. package/__cjs/core/QueryInfo.cjs +8 -7
  17. package/__cjs/core/QueryInfo.cjs.map +1 -1
  18. package/__cjs/core/QueryInfo.d.cts +1 -0
  19. package/__cjs/core/QueryManager.cjs +36 -10
  20. package/__cjs/core/QueryManager.cjs.map +1 -1
  21. package/__cjs/core/QueryManager.d.cts +11 -0
  22. package/__cjs/core/watchQueryOptions.d.cts +18 -25
  23. package/__cjs/react/hooks/index.cjs +13 -8
  24. package/__cjs/react/hooks/index.cjs.map +1 -1
  25. package/__cjs/react/hooks/index.d.cts +6 -12
  26. package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
  27. package/__cjs/react/hooks/useBackgroundQuery.d.cts +146 -43
  28. package/__cjs/react/hooks/useFragment.cjs.map +1 -1
  29. package/__cjs/react/hooks/useFragment.d.cts +51 -26
  30. package/__cjs/react/hooks/useLazyQuery.cjs +1 -1
  31. package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
  32. package/__cjs/react/hooks/useLazyQuery.d.cts +263 -266
  33. package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
  34. package/__cjs/react/hooks/useLoadableQuery.d.cts +105 -32
  35. package/__cjs/react/hooks/useMutation.cjs.map +1 -1
  36. package/__cjs/react/hooks/useMutation.d.cts +198 -3
  37. package/__cjs/react/hooks/useQuery.cjs +9 -12
  38. package/__cjs/react/hooks/useQuery.cjs.map +1 -1
  39. package/__cjs/react/hooks/useQuery.d.cts +279 -4
  40. package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
  41. package/__cjs/react/hooks/useQueryRefHandlers.d.cts +21 -20
  42. package/__cjs/react/hooks/useReadQuery.cjs.map +1 -1
  43. package/__cjs/react/hooks/useReadQuery.d.cts +26 -24
  44. package/__cjs/react/hooks/useSubscription.cjs.map +1 -1
  45. package/__cjs/react/hooks/useSubscription.d.cts +127 -4
  46. package/__cjs/react/hooks/useSuspenseFragment.cjs.map +1 -1
  47. package/__cjs/react/hooks/useSuspenseFragment.d.cts +40 -37
  48. package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
  49. package/__cjs/react/hooks/useSuspenseQuery.d.cts +202 -35
  50. package/__cjs/react/index.cjs.map +1 -1
  51. package/__cjs/react/index.d.cts +2 -1
  52. package/__cjs/react/internal/cache/QueryReference.cjs +2 -8
  53. package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
  54. package/__cjs/react/internal/index.cjs.map +1 -1
  55. package/__cjs/react/internal/index.d.cts +1 -0
  56. package/__cjs/react/internal/types.d.cts +46 -0
  57. package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
  58. package/__cjs/react/query-preloader/createQueryPreloader.d.cts +2 -3
  59. package/__cjs/react/ssr/RenderPromises.cjs.map +1 -1
  60. package/__cjs/react/ssr/RenderPromises.d.cts +6 -3
  61. package/__cjs/react/types/deprecated.cjs +3 -0
  62. package/__cjs/react/types/deprecated.cjs.map +1 -0
  63. package/__cjs/react/types/deprecated.d.cts +65 -0
  64. package/__cjs/react/types/types.documentation.d.cts +0 -8
  65. package/__cjs/testing/matchers/index.cjs +2 -0
  66. package/__cjs/testing/matchers/index.cjs.map +1 -1
  67. package/__cjs/testing/matchers/toEqualLazyQueryResult.cjs.map +1 -1
  68. package/__cjs/testing/matchers/toEqualLazyQueryResult.d.cts +2 -2
  69. package/__cjs/testing/matchers/toEqualQueryResult.cjs +0 -1
  70. package/__cjs/testing/matchers/toEqualQueryResult.cjs.map +1 -1
  71. package/__cjs/testing/matchers/toEqualQueryResult.d.cts +3 -3
  72. package/__cjs/testing/matchers/toEqualStrictTyped.cjs +44 -0
  73. package/__cjs/testing/matchers/toEqualStrictTyped.cjs.map +1 -0
  74. package/__cjs/testing/matchers/toEqualStrictTyped.d.cts +3 -0
  75. package/__cjs/version.cjs +1 -1
  76. package/__cjs/version.d.cts +1 -1
  77. package/core/ApolloClient.d.ts +13 -1
  78. package/core/ApolloClient.js +22 -13
  79. package/core/ApolloClient.js.map +1 -1
  80. package/core/ObservableQuery.d.ts +6 -3
  81. package/core/ObservableQuery.js +29 -10
  82. package/core/ObservableQuery.js.map +1 -1
  83. package/core/QueryInfo.d.ts +1 -0
  84. package/core/QueryInfo.js +8 -7
  85. package/core/QueryInfo.js.map +1 -1
  86. package/core/QueryManager.d.ts +11 -0
  87. package/core/QueryManager.js +36 -10
  88. package/core/QueryManager.js.map +1 -1
  89. package/core/watchQueryOptions.d.ts +18 -25
  90. package/package.json +1 -1
  91. package/react/hooks/index.d.ts +6 -12
  92. package/react/hooks/index.js +6 -6
  93. package/react/hooks/index.js.map +1 -1
  94. package/react/hooks/useBackgroundQuery.d.ts +146 -43
  95. package/react/hooks/useBackgroundQuery.js.map +1 -1
  96. package/react/hooks/useFragment.d.ts +51 -26
  97. package/react/hooks/useFragment.js.map +1 -1
  98. package/react/hooks/useLazyQuery.d.ts +263 -266
  99. package/react/hooks/useLazyQuery.js +1 -1
  100. package/react/hooks/useLazyQuery.js.map +1 -1
  101. package/react/hooks/useLoadableQuery.d.ts +105 -32
  102. package/react/hooks/useLoadableQuery.js.map +1 -1
  103. package/react/hooks/useMutation.d.ts +198 -3
  104. package/react/hooks/useMutation.js.map +1 -1
  105. package/react/hooks/useQuery.d.ts +279 -4
  106. package/react/hooks/useQuery.js +9 -12
  107. package/react/hooks/useQuery.js.map +1 -1
  108. package/react/hooks/useQueryRefHandlers.d.ts +21 -20
  109. package/react/hooks/useQueryRefHandlers.js.map +1 -1
  110. package/react/hooks/useReadQuery.d.ts +26 -24
  111. package/react/hooks/useReadQuery.js.map +1 -1
  112. package/react/hooks/useSubscription.d.ts +127 -4
  113. package/react/hooks/useSubscription.js.map +1 -1
  114. package/react/hooks/useSuspenseFragment.d.ts +40 -37
  115. package/react/hooks/useSuspenseFragment.js.map +1 -1
  116. package/react/hooks/useSuspenseQuery.d.ts +202 -35
  117. package/react/hooks/useSuspenseQuery.js.map +1 -1
  118. package/react/index.d.ts +2 -1
  119. package/react/index.js.map +1 -1
  120. package/react/internal/cache/QueryReference.js +2 -8
  121. package/react/internal/cache/QueryReference.js.map +1 -1
  122. package/react/internal/index.d.ts +1 -0
  123. package/react/internal/index.js.map +1 -1
  124. package/react/internal/types.d.ts +46 -0
  125. package/react/query-preloader/createQueryPreloader.d.ts +2 -3
  126. package/react/query-preloader/createQueryPreloader.js.map +1 -1
  127. package/react/ssr/RenderPromises.d.ts +6 -3
  128. package/react/ssr/RenderPromises.js.map +1 -1
  129. package/react/types/deprecated.d.ts +65 -0
  130. package/react/types/deprecated.js +2 -0
  131. package/react/types/deprecated.js.map +1 -0
  132. package/react/types/types.documentation.d.ts +0 -8
  133. package/testing/matchers/index.js +2 -0
  134. package/testing/matchers/index.js.map +1 -1
  135. package/testing/matchers/toEqualLazyQueryResult.d.ts +2 -2
  136. package/testing/matchers/toEqualLazyQueryResult.js.map +1 -1
  137. package/testing/matchers/toEqualQueryResult.d.ts +3 -3
  138. package/testing/matchers/toEqualQueryResult.js +0 -1
  139. package/testing/matchers/toEqualQueryResult.js.map +1 -1
  140. package/testing/matchers/toEqualStrictTyped.d.ts +3 -0
  141. package/testing/matchers/toEqualStrictTyped.js +40 -0
  142. package/testing/matchers/toEqualStrictTyped.js.map +1 -0
  143. package/version.d.ts +1 -1
  144. package/version.js +1 -1
  145. package/__cjs/react/types/types.d.cts +0 -671
  146. package/react/types/types.d.ts +0 -671
  147. /package/__cjs/react/{types → internal}/types.cjs +0 -0
  148. /package/__cjs/react/{types → internal}/types.cjs.map +0 -0
  149. /package/react/{types → internal}/types.js +0 -0
  150. /package/react/{types → internal}/types.js.map +0 -0
@@ -1,7 +1,202 @@
1
1
  import type { TypedDocumentNode } from "@graphql-typed-document-node/core";
2
2
  import type { DocumentNode } from "graphql";
3
- import type { ApolloCache, DefaultContext, OperationVariables } from "@apollo/client/core";
4
- import type { MutationHookOptions, MutationTuple, NoInfer } from "@apollo/client/react";
3
+ import type { ApolloCache, ApolloClient, DefaultContext, ErrorLike, ErrorPolicy, FetchResult, InternalRefetchQueriesInclude, MaybeMasked, MutationFetchPolicy, MutationQueryReducersMap, MutationUpdaterFunction, OnQueryUpdated, OperationVariables, Unmasked } from "@apollo/client/core";
4
+ import type { NoInfer } from "@apollo/client/utilities";
5
+ import type { IgnoreModifier } from "../../cache/core/types/common.js";
6
+ export declare namespace useMutation {
7
+ interface Options<TData = unknown, TVariables = OperationVariables, TContext = DefaultContext, TCache extends ApolloCache = ApolloCache> {
8
+ /**
9
+ * By providing either an object or a callback function that, when invoked after a mutation, allows you to return optimistic data and optionally skip updates via the `IGNORE` sentinel object, Apollo Client caches this temporary (and potentially incorrect) response until the mutation completes, enabling more responsive UI updates.
10
+ *
11
+ * For more information, see [Optimistic mutation results](https://www.apollographql.com/docs/react/performance/optimistic-ui/).
12
+ *
13
+ * @docGroup
14
+ *
15
+ * 3. Caching options
16
+ */
17
+ optimisticResponse?: Unmasked<NoInfer<TData>> | ((vars: TVariables, { IGNORE }: {
18
+ IGNORE: IgnoreModifier;
19
+ }) => Unmasked<NoInfer<TData>> | IgnoreModifier);
20
+ /**
21
+ * A `MutationQueryReducersMap`, which is map from query names to mutation query reducers. Briefly, this map defines how to incorporate the results of the mutation into the results of queries that are currently being watched by your application.
22
+ */
23
+ updateQueries?: MutationQueryReducersMap<TData>;
24
+ /**
25
+ * An array (or a function that _returns_ an array) that specifies which queries you want to refetch after the mutation occurs.
26
+ *
27
+ * Each array value can be either:
28
+ *
29
+ * - An object containing the `query` to execute, along with any `variables`
30
+ *
31
+ * - A string indicating the operation name of the query to refetch
32
+ *
33
+ * @docGroup
34
+ *
35
+ * 1. Operation options
36
+ */
37
+ refetchQueries?: ((result: FetchResult<Unmasked<TData>>) => InternalRefetchQueriesInclude) | InternalRefetchQueriesInclude;
38
+ /**
39
+ * If `true`, makes sure all queries included in `refetchQueries` are completed before the mutation is considered complete.
40
+ *
41
+ * The default value is `false` (queries are refetched asynchronously).
42
+ *
43
+ * @docGroup
44
+ *
45
+ * 1. Operation options
46
+ */
47
+ awaitRefetchQueries?: boolean;
48
+ /**
49
+ * A function used to update the Apollo Client cache after the mutation completes.
50
+ *
51
+ * For more information, see [Updating the cache after a mutation](https://www.apollographql.com/docs/react/data/mutations#updating-the-cache-after-a-mutation).
52
+ *
53
+ * @docGroup
54
+ *
55
+ * 3. Caching options
56
+ */
57
+ update?: MutationUpdaterFunction<TData, TVariables, TContext, TCache>;
58
+ /**
59
+ * Optional callback for intercepting queries whose cache data has been updated by the mutation, as well as any queries specified in the `refetchQueries: [...]` list passed to `client.mutate`.
60
+ *
61
+ * Returning a `Promise` from `onQueryUpdated` will cause the final mutation `Promise` to await the returned `Promise`. Returning `false` causes the query to be ignored.
62
+ *
63
+ * @docGroup
64
+ *
65
+ * 1. Operation options
66
+ */
67
+ onQueryUpdated?: OnQueryUpdated<any>;
68
+ /**
69
+ * Specifies how the mutation handles a response that returns both GraphQL errors and partial results.
70
+ *
71
+ * For details, see [GraphQL error policies](https://www.apollographql.com/docs/react/data/error-handling/#graphql-error-policies).
72
+ *
73
+ * The default value is `none`, meaning that the mutation result includes error details but _not_ partial results.
74
+ *
75
+ * @docGroup
76
+ *
77
+ * 1. Operation options
78
+ */
79
+ errorPolicy?: ErrorPolicy;
80
+ /**
81
+ * An object containing all of the GraphQL variables your mutation requires to execute.
82
+ *
83
+ * Each key in the object corresponds to a variable name, and that key's value corresponds to the variable value.
84
+ *
85
+ * @docGroup
86
+ *
87
+ * 1. Operation options
88
+ */
89
+ variables?: TVariables;
90
+ /**
91
+ * If you're using [Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/), this object is the initial value of the `context` object that's passed along your link chain.
92
+ *
93
+ * @docGroup
94
+ *
95
+ * 2. Networking options
96
+ */
97
+ context?: TContext;
98
+ /**
99
+ * Provide `no-cache` if the mutation's result should _not_ be written to the Apollo Client cache.
100
+ *
101
+ * The default value is `network-only` (which means the result _is_ written to the cache).
102
+ *
103
+ * Unlike queries, mutations _do not_ support [fetch policies](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy) besides `network-only` and `no-cache`.
104
+ *
105
+ * @docGroup
106
+ *
107
+ * 3. Caching options
108
+ */
109
+ fetchPolicy?: MutationFetchPolicy;
110
+ /**
111
+ * To avoid retaining sensitive information from mutation root field arguments, Apollo Client v3.4+ automatically clears any `ROOT_MUTATION` fields from the cache after each mutation finishes. If you need this information to remain in the cache, you can prevent the removal by passing `keepRootFields: true` to the mutation. `ROOT_MUTATION` result data are also passed to the mutation `update` function, so we recommend obtaining the results that way, rather than using this option, if possible.
112
+ */
113
+ keepRootFields?: boolean;
114
+ /**
115
+ * The instance of `ApolloClient` to use to execute the mutation.
116
+ *
117
+ * By default, the instance that's passed down via context is used, but you can provide a different instance here.
118
+ *
119
+ * @docGroup
120
+ *
121
+ * 2. Networking options
122
+ */
123
+ client?: ApolloClient;
124
+ /**
125
+ * If `true`, the in-progress mutation's associated component re-renders whenever the network status changes or a network error occurs.
126
+ *
127
+ * The default value is `false`.
128
+ *
129
+ * @docGroup
130
+ *
131
+ * 2. Networking options
132
+ */
133
+ notifyOnNetworkStatusChange?: boolean;
134
+ /**
135
+ * A callback function that's called when your mutation successfully completes with zero errors (or if `errorPolicy` is `ignore` and partial data is returned).
136
+ *
137
+ * This function is passed the mutation's result `data` and any options passed to the mutation.
138
+ *
139
+ * @docGroup
140
+ *
141
+ * 1. Operation options
142
+ */
143
+ onCompleted?: (data: MaybeMasked<TData>, clientOptions?: Options<TData, TVariables, TContext, TCache>) => void;
144
+ /**
145
+ * A callback function that's called when the mutation encounters one or more errors (unless `errorPolicy` is `ignore`).
146
+ *
147
+ * This function is passed an [`ApolloError`](https://github.com/apollographql/apollo-client/blob/d96f4578f89b933c281bb775a39503f6cdb59ee8/src/errors/index.ts#L36-L39) object that contains either a `networkError` object or a `graphQLErrors` array, depending on the error(s) that occurred, as well as any options passed the mutation.
148
+ *
149
+ * @docGroup
150
+ *
151
+ * 1. Operation options
152
+ */
153
+ onError?: (error: ErrorLike, clientOptions?: Options<TData, TVariables, TContext, TCache>) => void;
154
+ }
155
+ interface Result<TData = unknown> {
156
+ /**
157
+ * The data returned from your mutation. Can be `undefined` if `ignoreResults` is `true`.
158
+ */
159
+ data?: MaybeMasked<TData> | null;
160
+ /**
161
+ * If the mutation produces one or more errors, this object contains either an array of `graphQLErrors` or a single `networkError`. Otherwise, this value is `undefined`.
162
+ *
163
+ * For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).
164
+ */
165
+ error?: ErrorLike;
166
+ /**
167
+ * If `true`, the mutation is currently in flight.
168
+ */
169
+ loading: boolean;
170
+ /**
171
+ * If `true`, the mutation's mutate function has been called.
172
+ */
173
+ called: boolean;
174
+ /**
175
+ * The instance of Apollo Client that executed the mutation.
176
+ *
177
+ * Can be useful for manually executing followup operations or writing data to the cache.
178
+ */
179
+ client: ApolloClient;
180
+ /**
181
+ * A function that you can call to reset the mutation's result to its initial, uncalled state.
182
+ */
183
+ reset: () => void;
184
+ }
185
+ type ResultTuple<TData, TVariables, TContext = DefaultContext, TCache extends ApolloCache = ApolloCache> = [
186
+ mutate: (options?: MutationFunctionOptions<TData, TVariables, TContext, TCache>) => Promise<FetchResult<MaybeMasked<TData>>>,
187
+ result: Result<TData>
188
+ ];
189
+ interface MutationFunctionOptions<TData = unknown, TVariables = OperationVariables, TContext = DefaultContext, TCache extends ApolloCache = ApolloCache> extends Options<TData, TVariables, TContext, TCache> {
190
+ /**
191
+ * A GraphQL document, often created with `gql` from the `graphql-tag` package, that contains a single mutation inside of it.
192
+ *
193
+ * @docGroup
194
+ *
195
+ * 1. Operation options
196
+ */
197
+ mutation?: DocumentNode | TypedDocumentNode<TData, TVariables>;
198
+ }
199
+ }
5
200
  /**
6
201
  *
7
202
  *
@@ -49,5 +244,5 @@ import type { MutationHookOptions, MutationTuple, NoInfer } from "@apollo/client
49
244
  * @param options - Options to control how the mutation is executed.
50
245
  * @returns A tuple in the form of `[mutate, result]`
51
246
  */
52
- export declare function useMutation<TData = unknown, TVariables = OperationVariables, TContext = DefaultContext, TCache extends ApolloCache = ApolloCache>(mutation: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: MutationHookOptions<NoInfer<TData>, NoInfer<TVariables>, TContext, TCache>): MutationTuple<TData, TVariables, TContext, TCache>;
247
+ export declare function useMutation<TData = unknown, TVariables = OperationVariables, TContext = DefaultContext, TCache extends ApolloCache = ApolloCache>(mutation: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: useMutation.Options<NoInfer<TData>, NoInfer<TVariables>, TContext, TCache>): useMutation.ResultTuple<TData, TVariables, TContext, TCache>;
53
248
  //# sourceMappingURL=useMutation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useMutation.js","sources":["../../../src/react/hooks/useMutation.ts"],"sourcesContent":["import type { TypedDocumentNode } from \"@graphql-typed-document-node/core\";\nimport { equal } from \"@wry/equality\";\nimport type { DocumentNode } from \"graphql\";\nimport * as React from \"react\";\n\nimport type {\n ApolloCache,\n DefaultContext,\n MutationOptions,\n OperationVariables,\n} from \"@apollo/client/core\";\nimport { CombinedGraphQLErrors } from \"@apollo/client/errors\";\nimport type {\n MutationFunctionOptions,\n MutationHookOptions,\n MutationResult,\n MutationTuple,\n NoInfer,\n} from \"@apollo/client/react\";\nimport { DocumentType, verifyDocumentType } from \"@apollo/client/react/parser\";\nimport { mergeOptions } from \"@apollo/client/utilities\";\n\nimport { useIsomorphicLayoutEffect } from \"./internal/useIsomorphicLayoutEffect.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\n\n/**\n *\n *\n * > Refer to the [Mutations](https://www.apollographql.com/docs/react/data/mutations/) section for a more in-depth overview of `useMutation`.\n *\n * @example\n * ```jsx\n * import { gql, useMutation } from '@apollo/client';\n *\n * const ADD_TODO = gql`\n * mutation AddTodo($type: String!) {\n * addTodo(type: $type) {\n * id\n * type\n * }\n * }\n * `;\n *\n * function AddTodo() {\n * let input;\n * const [addTodo, { data }] = useMutation(ADD_TODO);\n *\n * return (\n * <div>\n * <form\n * onSubmit={e => {\n * e.preventDefault();\n * addTodo({ variables: { type: input.value } });\n * input.value = '';\n * }}\n * >\n * <input\n * ref={node => {\n * input = node;\n * }}\n * />\n * <button type=\"submit\">Add Todo</button>\n * </form>\n * </div>\n * );\n * }\n * ```\n * @since 3.0.0\n * @param mutation - A GraphQL mutation document parsed into an AST by `gql`.\n * @param options - Options to control how the mutation is executed.\n * @returns A tuple in the form of `[mutate, result]`\n */\nexport function useMutation<\n TData = unknown,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache = ApolloCache,\n>(\n mutation: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options?: MutationHookOptions<\n NoInfer<TData>,\n NoInfer<TVariables>,\n TContext,\n TCache\n >\n): MutationTuple<TData, TVariables, TContext, TCache> {\n const client = useApolloClient(options?.client);\n verifyDocumentType(mutation, DocumentType.Mutation);\n const [result, setResult] = React.useState<\n Omit<MutationResult<TData>, \"reset\">\n >({\n called: false,\n loading: false,\n client,\n });\n\n const ref = React.useRef({\n result,\n mutationId: 0,\n isMounted: true,\n client,\n mutation,\n options,\n });\n\n useIsomorphicLayoutEffect(() => {\n Object.assign(ref.current, { client, options, mutation });\n });\n\n const execute = React.useCallback(\n (\n executeOptions: MutationFunctionOptions<\n TData,\n TVariables,\n TContext,\n TCache\n > = {}\n ) => {\n const { options, mutation } = ref.current;\n const baseOptions = { ...options, mutation };\n const client = executeOptions.client || ref.current.client;\n\n if (!ref.current.result.loading && ref.current.isMounted) {\n setResult(\n (ref.current.result = {\n loading: true,\n error: void 0,\n data: void 0,\n called: true,\n client,\n })\n );\n }\n\n const mutationId = ++ref.current.mutationId;\n const clientOptions = mergeOptions(baseOptions, executeOptions);\n\n return client\n .mutate(clientOptions as MutationOptions<TData, OperationVariables>)\n .then(\n (response) => {\n const { data, errors } = response;\n const error =\n errors && errors.length > 0 ?\n new CombinedGraphQLErrors(errors)\n : void 0;\n\n const onError =\n executeOptions.onError || ref.current.options?.onError;\n\n if (error && onError) {\n onError(error, clientOptions);\n }\n\n if (mutationId === ref.current.mutationId) {\n const result = {\n called: true,\n loading: false,\n data,\n error,\n client,\n };\n\n if (ref.current.isMounted && !equal(ref.current.result, result)) {\n setResult((ref.current.result = result));\n }\n }\n\n const onCompleted =\n executeOptions.onCompleted || ref.current.options?.onCompleted;\n\n if (!error) {\n onCompleted?.(response.data!, clientOptions);\n }\n\n return response;\n },\n (error) => {\n if (\n mutationId === ref.current.mutationId &&\n ref.current.isMounted\n ) {\n const result = {\n loading: false,\n error,\n data: void 0,\n called: true,\n client,\n };\n\n if (!equal(ref.current.result, result)) {\n setResult((ref.current.result = result));\n }\n }\n\n const onError =\n executeOptions.onError || ref.current.options?.onError;\n\n if (onError) {\n onError(error, clientOptions);\n\n // TODO(brian): why are we returning this here???\n return { data: void 0, errors: error };\n }\n\n throw error;\n }\n );\n },\n []\n );\n\n const reset = React.useCallback(() => {\n if (ref.current.isMounted) {\n const result = {\n called: false,\n loading: false,\n client: ref.current.client,\n };\n Object.assign(ref.current, { mutationId: 0, result });\n setResult(result);\n }\n }, []);\n\n React.useEffect(() => {\n const current = ref.current;\n current.isMounted = true;\n\n return () => {\n current.isMounted = false;\n };\n }, []);\n\n return [execute, { reset, ...result }];\n}\n"],"names":[],"mappings":"AACA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAsB,CAAtB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAqC;AAErC,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAP,CAAA,EAAY,CAAZ,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAuB,CAAvB,CAAA,CAAA,CAAA,CAAA,CAAA,CAA8B;AAQ9B,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAsC,CAAtC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA6D;AAQ7D,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAqB,EAAE,CAAvB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAiD,CAAjD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CA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,CAAA,CAAA,CAAA,EAAS,CAAC,CAAV,CAAA,CAAA,CAAA,CAAA,CAAA,CAAiB,EAAE,EAAE,CAArB,CAAA,CAAA,CAAA,CAA0B,EAAE,CAA5B,CAAA,CAA+B,CAA/B,CAAA,CAAA,CAAA,CAAA,EAAA,CAAuC,CAAC;AACxC;"}
1
+ {"version":3,"file":"useMutation.js","sources":["../../../src/react/hooks/useMutation.ts"],"sourcesContent":["import type { TypedDocumentNode } from \"@graphql-typed-document-node/core\";\nimport { equal } from \"@wry/equality\";\nimport type { DocumentNode } from \"graphql\";\nimport * as React from \"react\";\n\nimport type {\n ApolloCache,\n ApolloClient,\n DefaultContext,\n ErrorLike,\n ErrorPolicy,\n FetchResult,\n InternalRefetchQueriesInclude,\n MaybeMasked,\n MutationFetchPolicy,\n MutationOptions,\n MutationQueryReducersMap,\n MutationUpdaterFunction,\n OnQueryUpdated,\n OperationVariables,\n Unmasked,\n} from \"@apollo/client/core\";\nimport { CombinedGraphQLErrors } from \"@apollo/client/errors\";\nimport { DocumentType, verifyDocumentType } from \"@apollo/client/react/parser\";\nimport type { NoInfer } from \"@apollo/client/utilities\";\nimport { mergeOptions } from \"@apollo/client/utilities\";\n\nimport type { IgnoreModifier } from \"../../cache/core/types/common.js\";\n\nimport { useIsomorphicLayoutEffect } from \"./internal/useIsomorphicLayoutEffect.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\n\nexport declare namespace useMutation {\n export interface Options<\n TData = unknown,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache = ApolloCache,\n > {\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#optimisticResponse:member} */\n optimisticResponse?:\n | Unmasked<NoInfer<TData>>\n | ((\n vars: TVariables,\n { IGNORE }: { IGNORE: IgnoreModifier }\n ) => Unmasked<NoInfer<TData>> | IgnoreModifier);\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#updateQueries:member} */\n updateQueries?: MutationQueryReducersMap<TData>;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#refetchQueries:member} */\n refetchQueries?:\n | ((\n result: FetchResult<Unmasked<TData>>\n ) => InternalRefetchQueriesInclude)\n | InternalRefetchQueriesInclude;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#awaitRefetchQueries:member} */\n awaitRefetchQueries?: boolean;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#update:member} */\n update?: MutationUpdaterFunction<TData, TVariables, TContext, TCache>;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#onQueryUpdated:member} */\n onQueryUpdated?: OnQueryUpdated<any>;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#errorPolicy:member} */\n errorPolicy?: ErrorPolicy;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#variables:member} */\n variables?: TVariables;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#context:member} */\n context?: TContext;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#fetchPolicy:member} */\n fetchPolicy?: MutationFetchPolicy;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#keepRootFields:member} */\n keepRootFields?: boolean;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#client:member} */\n client?: ApolloClient;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#notifyOnNetworkStatusChange:member} */\n notifyOnNetworkStatusChange?: boolean;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#onCompleted:member} */\n onCompleted?: (\n data: MaybeMasked<TData>,\n clientOptions?: Options<TData, TVariables, TContext, TCache>\n ) => void;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#onError:member} */\n onError?: (\n error: ErrorLike,\n clientOptions?: Options<TData, TVariables, TContext, TCache>\n ) => void;\n }\n\n export interface Result<TData = unknown> {\n /** {@inheritDoc @apollo/client!MutationResultDocumentation#data:member} */\n data?: MaybeMasked<TData> | null;\n\n /** {@inheritDoc @apollo/client!MutationResultDocumentation#error:member} */\n error?: ErrorLike;\n\n /** {@inheritDoc @apollo/client!MutationResultDocumentation#loading:member} */\n loading: boolean;\n\n /** {@inheritDoc @apollo/client!MutationResultDocumentation#called:member} */\n called: boolean;\n\n /** {@inheritDoc @apollo/client!MutationResultDocumentation#client:member} */\n client: ApolloClient;\n\n /** {@inheritDoc @apollo/client!MutationResultDocumentation#reset:member} */\n reset: () => void;\n }\n\n export type ResultTuple<\n TData,\n TVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache = ApolloCache,\n > = [\n mutate: (\n options?: MutationFunctionOptions<TData, TVariables, TContext, TCache>\n // TODO This FetchResult<TData> seems strange here, as opposed to an\n // ApolloQueryResult<TData>\n ) => Promise<FetchResult<MaybeMasked<TData>>>,\n result: Result<TData>,\n ];\n\n export interface MutationFunctionOptions<\n TData = unknown,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache = ApolloCache,\n > extends Options<TData, TVariables, TContext, TCache> {\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#mutation:member} */\n // TODO: Remove this option. We shouldn't allow the mutation to be overridden\n // in the mutation function\n mutation?: DocumentNode | TypedDocumentNode<TData, TVariables>;\n }\n}\n\n/**\n *\n *\n * > Refer to the [Mutations](https://www.apollographql.com/docs/react/data/mutations/) section for a more in-depth overview of `useMutation`.\n *\n * @example\n * ```jsx\n * import { gql, useMutation } from '@apollo/client';\n *\n * const ADD_TODO = gql`\n * mutation AddTodo($type: String!) {\n * addTodo(type: $type) {\n * id\n * type\n * }\n * }\n * `;\n *\n * function AddTodo() {\n * let input;\n * const [addTodo, { data }] = useMutation(ADD_TODO);\n *\n * return (\n * <div>\n * <form\n * onSubmit={e => {\n * e.preventDefault();\n * addTodo({ variables: { type: input.value } });\n * input.value = '';\n * }}\n * >\n * <input\n * ref={node => {\n * input = node;\n * }}\n * />\n * <button type=\"submit\">Add Todo</button>\n * </form>\n * </div>\n * );\n * }\n * ```\n * @since 3.0.0\n * @param mutation - A GraphQL mutation document parsed into an AST by `gql`.\n * @param options - Options to control how the mutation is executed.\n * @returns A tuple in the form of `[mutate, result]`\n */\nexport function useMutation<\n TData = unknown,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache = ApolloCache,\n>(\n mutation: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options?: useMutation.Options<\n NoInfer<TData>,\n NoInfer<TVariables>,\n TContext,\n TCache\n >\n): useMutation.ResultTuple<TData, TVariables, TContext, TCache> {\n const client = useApolloClient(options?.client);\n verifyDocumentType(mutation, DocumentType.Mutation);\n const [result, setResult] = React.useState<\n Omit<useMutation.Result<TData>, \"reset\">\n >({\n called: false,\n loading: false,\n client,\n });\n\n const ref = React.useRef({\n result,\n mutationId: 0,\n isMounted: true,\n client,\n mutation,\n options,\n });\n\n useIsomorphicLayoutEffect(() => {\n Object.assign(ref.current, { client, options, mutation });\n });\n\n const execute = React.useCallback(\n (\n executeOptions: useMutation.MutationFunctionOptions<\n TData,\n TVariables,\n TContext,\n TCache\n > = {}\n ) => {\n const { options, mutation } = ref.current;\n const baseOptions = { ...options, mutation };\n const client = executeOptions.client || ref.current.client;\n\n if (!ref.current.result.loading && ref.current.isMounted) {\n setResult(\n (ref.current.result = {\n loading: true,\n error: void 0,\n data: void 0,\n called: true,\n client,\n })\n );\n }\n\n const mutationId = ++ref.current.mutationId;\n const clientOptions = mergeOptions(baseOptions, executeOptions);\n\n return client\n .mutate(clientOptions as MutationOptions<TData, OperationVariables>)\n .then(\n (response) => {\n const { data, errors } = response;\n const error =\n errors && errors.length > 0 ?\n new CombinedGraphQLErrors(errors)\n : void 0;\n\n const onError =\n executeOptions.onError || ref.current.options?.onError;\n\n if (error && onError) {\n onError(error, clientOptions);\n }\n\n if (mutationId === ref.current.mutationId) {\n const result = {\n called: true,\n loading: false,\n data,\n error,\n client,\n };\n\n if (ref.current.isMounted && !equal(ref.current.result, result)) {\n setResult((ref.current.result = result));\n }\n }\n\n const onCompleted =\n executeOptions.onCompleted || ref.current.options?.onCompleted;\n\n if (!error) {\n onCompleted?.(response.data!, clientOptions);\n }\n\n return response;\n },\n (error) => {\n if (\n mutationId === ref.current.mutationId &&\n ref.current.isMounted\n ) {\n const result = {\n loading: false,\n error,\n data: void 0,\n called: true,\n client,\n };\n\n if (!equal(ref.current.result, result)) {\n setResult((ref.current.result = result));\n }\n }\n\n const onError =\n executeOptions.onError || ref.current.options?.onError;\n\n if (onError) {\n onError(error, clientOptions);\n\n // TODO(brian): why are we returning this here???\n return { data: void 0, errors: error };\n }\n\n throw error;\n }\n );\n },\n []\n );\n\n const reset = React.useCallback(() => {\n if (ref.current.isMounted) {\n const result = {\n called: false,\n loading: false,\n client: ref.current.client,\n };\n Object.assign(ref.current, { mutationId: 0, result });\n setResult(result);\n }\n }, []);\n\n React.useEffect(() => {\n const current = ref.current;\n current.isMounted = true;\n\n return () => {\n current.isMounted = false;\n };\n }, []);\n\n return [execute, { reset, ...result }];\n}\n"],"names":[],"mappings":"AACA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAsB,CAAtB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAqC;AAErC,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAP,CAAA,EAAY,CAAZ,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAuB,CAAvB,CAAA,CAAA,CAAA,CAAA,CAAA,CAA8B;AAmB9B,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAsC,CAAtC,CAAA,CAAA,CAAA,CAAA,CAAA,CA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C,CAAxB,CAAA,CAAA,CAAA,CAAA,CAAA,CAA+B;QAC3B,CAAJ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAC,CAAZ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAwB,CAAxB,CAAA,CAAA,CAA4B;QAExB,CAAJ,CAAA,CAAA,CAAA,CAAA,EAAW,CAAX,EAAc,CAAd,EAAA;YACM,CAAN,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAC,CAAd,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAA0B,CAA1B,CAAA,CAAA,CAAA,CAA+B;QAC3B,CAAC;IACH,CAAC,EAAE,CAAL,CAAO,CAAC;IAEN,CAAF,CAAA,CAAA,CAAA,CAAA,EAAS,CAAC,CAAV,CAAA,CAAA,CAAA,CAAA,CAAA,CAAiB,EAAE,EAAE,CAArB,CAAA,CAAA,CAAA,CAA0B,EAAE,CAA5B,CAAA,CAA+B,CAA/B,CAAA,CAAA,CAAA,CAAA,EAAA,CAAuC,CAAC;AACxC;"}
@@ -1,6 +1,281 @@
1
- import type { OperationVariables } from "@apollo/client/core";
2
- import type { DocumentNode, TypedDocumentNode } from "@apollo/client/core";
3
- import type { NoInfer, QueryHookOptions, QueryResult } from "@apollo/client/react";
1
+ import type { ApolloClient, DefaultContext, ErrorLike, ErrorPolicy, FetchMoreQueryOptions, OperationVariables, RefetchWritePolicy, SubscribeToMoreFunction, UpdateQueryMapFn, WatchQueryFetchPolicy } from "@apollo/client/core";
2
+ import type { ApolloQueryResult, DocumentNode, ObservableQuery, TypedDocumentNode, WatchQueryOptions } from "@apollo/client/core";
3
+ import { NetworkStatus } from "@apollo/client/core";
4
+ import type { MaybeMasked, Unmasked } from "@apollo/client/masking";
5
+ import type { NoInfer } from "@apollo/client/utilities";
6
+ import type { NextFetchPolicyContext } from "../../core/watchQueryOptions.js";
7
+ export declare namespace useQuery {
8
+ interface Options<TData = unknown, TVariables extends OperationVariables = OperationVariables> {
9
+ /**
10
+ * Specifies how the query interacts with the Apollo Client cache during execution (for example, whether it checks the cache for results before sending a request to the server).
11
+ *
12
+ * For details, see [Setting a fetch policy](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy).
13
+ *
14
+ * The default value is `cache-first`.
15
+ *
16
+ * @docGroup
17
+ *
18
+ * 3. Caching options
19
+ */
20
+ fetchPolicy?: WatchQueryFetchPolicy;
21
+ /**
22
+ * Specifies the `FetchPolicy` to be used after this query has completed.
23
+ *
24
+ * @docGroup
25
+ *
26
+ * 3. Caching options
27
+ */
28
+ nextFetchPolicy?: WatchQueryFetchPolicy | ((this: WatchQueryOptions<TVariables, TData>, currentFetchPolicy: WatchQueryFetchPolicy, context: NextFetchPolicyContext<TData, TVariables>) => WatchQueryFetchPolicy);
29
+ /**
30
+ * Defaults to the initial value of options.fetchPolicy, but can be explicitly configured to specify the WatchQueryFetchPolicy to revert back to whenever variables change (unless nextFetchPolicy intervenes).
31
+ *
32
+ * @docGroup
33
+ *
34
+ * 3. Caching options
35
+ */
36
+ initialFetchPolicy?: WatchQueryFetchPolicy;
37
+ /**
38
+ * Specifies whether a `NetworkStatus.refetch` operation should merge incoming field data with existing data, or overwrite the existing data. Overwriting is probably preferable, but merging is currently the default behavior, for backwards compatibility with Apollo Client 3.x.
39
+ *
40
+ * @docGroup
41
+ *
42
+ * 3. Caching options
43
+ */
44
+ refetchWritePolicy?: RefetchWritePolicy;
45
+ /**
46
+ * An object containing all of the GraphQL variables your query requires to execute.
47
+ *
48
+ * Each key in the object corresponds to a variable name, and that key's value corresponds to the variable value.
49
+ *
50
+ * @docGroup
51
+ *
52
+ * 1. Operation options
53
+ */
54
+ variables?: TVariables;
55
+ /**
56
+ * Specifies how the query handles a response that returns both GraphQL errors and partial results.
57
+ *
58
+ * For details, see [GraphQL error policies](https://www.apollographql.com/docs/react/data/error-handling/#graphql-error-policies).
59
+ *
60
+ * The default value is `none`, meaning that the query result includes error details but not partial results.
61
+ *
62
+ * @docGroup
63
+ *
64
+ * 1. Operation options
65
+ */
66
+ errorPolicy?: ErrorPolicy;
67
+ /**
68
+ * Specifies the interval (in milliseconds) at which the query polls for updated results.
69
+ *
70
+ * The default value is `0` (no polling).
71
+ *
72
+ * @docGroup
73
+ *
74
+ * 2. Networking options
75
+ */
76
+ pollInterval?: number;
77
+ /**
78
+ * If `true`, the in-progress query's associated component re-renders whenever the network status changes or a network error occurs.
79
+ *
80
+ * The default value is `false`.
81
+ *
82
+ * @docGroup
83
+ *
84
+ * 2. Networking options
85
+ */
86
+ notifyOnNetworkStatusChange?: boolean;
87
+ /**
88
+ * If `true`, the query can return partial results from the cache if the cache doesn't contain results for all queried fields.
89
+ *
90
+ * The default value is `false`.
91
+ *
92
+ * @docGroup
93
+ *
94
+ * 3. Caching options
95
+ */
96
+ returnPartialData?: boolean;
97
+ /**
98
+ * A callback function that's called whenever a refetch attempt occurs while polling. If the function returns `true`, the refetch is skipped and not reattempted until the next poll interval.
99
+ *
100
+ * @docGroup
101
+ *
102
+ * 2. Networking options
103
+ */
104
+ skipPollAttempt?: () => boolean;
105
+ /**
106
+ * Pass `false` to skip executing the query during [server-side rendering](https://www.apollographql.com/docs/react/performance/server-side-rendering/).
107
+ *
108
+ * @docGroup
109
+ *
110
+ * 2. Networking options
111
+ */
112
+ ssr?: boolean;
113
+ /**
114
+ * The instance of `ApolloClient` to use to execute the query.
115
+ *
116
+ * By default, the instance that's passed down via context is used, but you can provide a different instance here.
117
+ *
118
+ * @docGroup
119
+ *
120
+ * 1. Operation options
121
+ */
122
+ client?: ApolloClient;
123
+ /**
124
+ * If you're using [Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/), this object is the initial value of the `context` object that's passed along your link chain.
125
+ *
126
+ * @docGroup
127
+ *
128
+ * 2. Networking options
129
+ */
130
+ context?: DefaultContext;
131
+ /**
132
+ * If true, the query is not executed.
133
+ *
134
+ * The default value is `false`.
135
+ *
136
+ * @docGroup
137
+ *
138
+ * 1. Operation options
139
+ */
140
+ skip?: boolean;
141
+ }
142
+ interface Result<TData = unknown, TVariables extends OperationVariables = OperationVariables> {
143
+ /**
144
+ * The instance of Apollo Client that executed the query. Can be useful for manually executing followup queries or writing data to the cache.
145
+ *
146
+ * @docGroup
147
+ *
148
+ * 2. Network info
149
+ */
150
+ client: ApolloClient;
151
+ /**
152
+ * A reference to the internal `ObservableQuery` used by the hook.
153
+ */
154
+ observable: ObservableQuery<TData, TVariables>;
155
+ /**
156
+ * An object containing the result of your GraphQL query after it completes.
157
+ *
158
+ * This value might be `undefined` if a query results in one or more errors (depending on the query's `errorPolicy`).
159
+ *
160
+ * @docGroup
161
+ *
162
+ * 1. Operation data
163
+ */
164
+ data: MaybeMasked<TData> | undefined;
165
+ /**
166
+ * An object containing the result from the most recent _previous_ execution of this query.
167
+ *
168
+ * This value is `undefined` if this is the query's first execution.
169
+ *
170
+ * @docGroup
171
+ *
172
+ * 1. Operation data
173
+ */
174
+ previousData?: MaybeMasked<TData>;
175
+ /**
176
+ * If the query produces one or more errors, this object contains either an array of `graphQLErrors` or a single `networkError`. Otherwise, this value is `undefined`.
177
+ *
178
+ * For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).
179
+ *
180
+ * @docGroup
181
+ *
182
+ * 1. Operation data
183
+ */
184
+ error?: ErrorLike;
185
+ /**
186
+ * If `true`, the query is still in flight and results have not yet been returned.
187
+ *
188
+ * @docGroup
189
+ *
190
+ * 2. Network info
191
+ */
192
+ loading: boolean;
193
+ /**
194
+ * A number indicating the current network state of the query's associated request. [See possible values.](https://github.com/apollographql/apollo-client/blob/d96f4578f89b933c281bb775a39503f6cdb59ee8/src/core/networkStatus.ts#L4)
195
+ *
196
+ * Used in conjunction with the [`notifyOnNetworkStatusChange`](#notifyonnetworkstatuschange) option.
197
+ *
198
+ * @docGroup
199
+ *
200
+ * 2. Network info
201
+ */
202
+ networkStatus: NetworkStatus;
203
+ /**
204
+ * A function that instructs the query to begin re-executing at a specified interval (in milliseconds).
205
+ *
206
+ *
207
+ * @docGroup
208
+ *
209
+ * 3. Helper functions
210
+ */
211
+ startPolling: (pollInterval: number) => void;
212
+ /**
213
+ * A function that instructs the query to stop polling after a previous call to `startPolling`.
214
+ *
215
+ *
216
+ * @docGroup
217
+ *
218
+ * 3. Helper functions
219
+ */
220
+ stopPolling: () => void;
221
+ /**
222
+ * 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.
223
+ *
224
+ * This function returns _another_ function that you can call to terminate the subscription.
225
+ *
226
+ *
227
+ * @docGroup
228
+ *
229
+ * 3. Helper functions
230
+ */
231
+ subscribeToMore: SubscribeToMoreFunction<TData, TVariables>;
232
+ /**
233
+ * A function that enables you to update the query's cached result without executing a followup GraphQL operation.
234
+ *
235
+ * See [using updateQuery and updateFragment](https://www.apollographql.com/docs/react/caching/cache-interaction/#using-updatequery-and-updatefragment) for additional information.
236
+ *
237
+ *
238
+ * @docGroup
239
+ *
240
+ * 3. Helper functions
241
+ */
242
+ updateQuery: (mapFn: UpdateQueryMapFn<TData, TVariables>) => void;
243
+ /**
244
+ * A function that enables you to re-execute the query, optionally passing in new `variables`.
245
+ *
246
+ * To guarantee that the refetch performs a network request, its `fetchPolicy` is set to `network-only` (unless the original query's `fetchPolicy` is `no-cache` or `cache-and-network`, which also guarantee a network request).
247
+ *
248
+ * See also [Refetching](https://www.apollographql.com/docs/react/data/queries/#refetching).
249
+ *
250
+ * @docGroup
251
+ *
252
+ * 3. Helper functions
253
+ */
254
+ refetch: (variables?: Partial<TVariables>) => Promise<ApolloQueryResult<MaybeMasked<TData>>>;
255
+ /**
256
+ * An object containing the variables that were provided for the query.
257
+ *
258
+ * @docGroup
259
+ *
260
+ * 1. Operation data
261
+ */
262
+ variables: TVariables | undefined;
263
+ /**
264
+ * A function that helps you fetch the next set of results for a [paginated list field](https://www.apollographql.com/docs/react/pagination/core-api/).
265
+ *
266
+ *
267
+ * @docGroup
268
+ *
269
+ * 3. Helper functions
270
+ */
271
+ fetchMore: <TFetchData = TData, TFetchVars extends OperationVariables = TVariables>(fetchMoreOptions: FetchMoreQueryOptions<TFetchVars, TFetchData> & {
272
+ updateQuery?: (previousQueryResult: Unmasked<TData>, options: {
273
+ fetchMoreResult: Unmasked<TFetchData>;
274
+ variables: TFetchVars;
275
+ }) => Unmasked<TData>;
276
+ }) => Promise<ApolloQueryResult<MaybeMasked<TFetchData>>>;
277
+ }
278
+ }
4
279
  /**
5
280
  * A hook for executing queries in an Apollo application.
6
281
  *
@@ -35,5 +310,5 @@ import type { NoInfer, QueryHookOptions, QueryResult } from "@apollo/client/reac
35
310
  * @param options - Options to control how the query is executed.
36
311
  * @returns Query result object
37
312
  */
38
- export declare function useQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: QueryHookOptions<NoInfer<TData>, NoInfer<TVariables>>): QueryResult<TData, TVariables>;
313
+ export declare function useQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>): useQuery.Result<TData, TVariables>;
39
314
  //# sourceMappingURL=useQuery.d.ts.map