@apollo/client 4.0.0-rc.4 → 4.0.0-rc.6

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 (528) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/README.md +40 -40
  3. package/__cjs/cache/core/cache.cjs +4 -12
  4. package/__cjs/cache/core/cache.cjs.map +1 -1
  5. package/__cjs/cache/core/cache.d.cts +96 -66
  6. package/__cjs/cache/core/types/Cache.cjs +0 -4
  7. package/__cjs/cache/core/types/Cache.cjs.map +1 -1
  8. package/__cjs/cache/core/types/Cache.d.cts +200 -15
  9. package/__cjs/cache/{core/types/DataProxy.cjs → deprecated.cjs} +1 -1
  10. package/__cjs/cache/deprecated.cjs.map +1 -0
  11. package/__cjs/cache/deprecated.d.cts +6 -0
  12. package/__cjs/cache/index.cjs.map +1 -1
  13. package/__cjs/cache/index.d.cts +2 -2
  14. package/__cjs/cache/inmemory/entityStore.cjs +28 -31
  15. package/__cjs/cache/inmemory/entityStore.cjs.map +1 -1
  16. package/__cjs/cache/inmemory/entityStore.d.cts +18 -17
  17. package/__cjs/cache/inmemory/inMemoryCache.cjs +1 -1
  18. package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
  19. package/__cjs/cache/inmemory/inMemoryCache.d.cts +4 -4
  20. package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
  21. package/__cjs/cache/inmemory/policies.cjs +4 -4
  22. package/__cjs/cache/inmemory/policies.cjs.map +1 -1
  23. package/__cjs/cache/inmemory/policies.d.cts +3 -2
  24. package/__cjs/cache/inmemory/readFromStore.cjs +2 -2
  25. package/__cjs/cache/inmemory/types.d.cts +1 -1
  26. package/__cjs/cache/inmemory/writeToStore.cjs +4 -4
  27. package/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
  28. package/__cjs/cache/inmemory/writeToStore.d.cts +1 -1
  29. package/__cjs/core/ApolloClient.cjs +137 -117
  30. package/__cjs/core/ApolloClient.cjs.map +1 -1
  31. package/__cjs/core/ApolloClient.d.cts +790 -183
  32. package/__cjs/core/ObservableQuery.cjs +50 -20
  33. package/__cjs/core/ObservableQuery.cjs.map +1 -1
  34. package/__cjs/core/ObservableQuery.d.cts +184 -68
  35. package/__cjs/core/QueryInfo.cjs.map +1 -1
  36. package/__cjs/core/QueryInfo.d.cts +5 -4
  37. package/__cjs/core/QueryManager.cjs +15 -13
  38. package/__cjs/core/QueryManager.cjs.map +1 -1
  39. package/__cjs/core/QueryManager.d.cts +17 -17
  40. package/__cjs/core/deprecated.cjs +3 -0
  41. package/__cjs/core/deprecated.cjs.map +1 -0
  42. package/__cjs/core/deprecated.d.cts +29 -0
  43. package/__cjs/core/index.cjs.map +1 -1
  44. package/__cjs/core/index.d.cts +9 -5
  45. package/__cjs/core/types.d.cts +81 -104
  46. package/__cjs/core/watchQueryOptions.d.cts +8 -297
  47. package/__cjs/dev/setErrorMessageHandler.cjs.map +1 -1
  48. package/__cjs/dev/setErrorMessageHandler.d.cts +4 -4
  49. package/__cjs/errors/CombinedGraphQLErrors.cjs +59 -11
  50. package/__cjs/errors/CombinedGraphQLErrors.cjs.map +1 -1
  51. package/__cjs/errors/CombinedGraphQLErrors.d.cts +146 -11
  52. package/__cjs/errors/CombinedProtocolErrors.cjs +48 -1
  53. package/__cjs/errors/CombinedProtocolErrors.cjs.map +1 -1
  54. package/__cjs/errors/CombinedProtocolErrors.d.cts +126 -2
  55. package/__cjs/errors/LinkError.cjs +45 -2
  56. package/__cjs/errors/LinkError.cjs.map +1 -1
  57. package/__cjs/errors/LinkError.d.cts +45 -2
  58. package/__cjs/errors/LocalStateError.cjs +35 -5
  59. package/__cjs/errors/LocalStateError.cjs.map +1 -1
  60. package/__cjs/errors/LocalStateError.d.cts +41 -5
  61. package/__cjs/errors/ServerError.cjs +50 -8
  62. package/__cjs/errors/ServerError.cjs.map +1 -1
  63. package/__cjs/errors/ServerError.d.cts +70 -11
  64. package/__cjs/errors/ServerParseError.cjs +45 -8
  65. package/__cjs/errors/ServerParseError.cjs.map +1 -1
  66. package/__cjs/errors/ServerParseError.d.cts +71 -16
  67. package/__cjs/errors/UnconventionalError.cjs +46 -2
  68. package/__cjs/errors/UnconventionalError.cjs.map +1 -1
  69. package/__cjs/errors/UnconventionalError.d.cts +46 -2
  70. package/__cjs/incremental/handlers/notImplemented.cjs +1 -1
  71. package/__cjs/invariantErrorCodes.cjs +72 -80
  72. package/__cjs/link/batch/batchLink.cjs.map +1 -1
  73. package/__cjs/link/batch-http/batchHttpLink.cjs +2 -2
  74. package/__cjs/link/batch-http/batchHttpLink.cjs.map +1 -1
  75. package/__cjs/link/client-awareness/ClientAwarenessLink.cjs.map +1 -1
  76. package/__cjs/link/client-awareness/ClientAwarenessLink.d.cts +4 -4
  77. package/__cjs/link/context/index.cjs +1 -1
  78. package/__cjs/link/context/index.cjs.map +1 -1
  79. package/__cjs/link/context/index.d.cts +1 -1
  80. package/__cjs/link/core/ApolloLink.cjs +2 -2
  81. package/__cjs/link/core/types.d.cts +2 -2
  82. package/__cjs/link/error/index.cjs.map +1 -1
  83. package/__cjs/link/error/index.d.cts +16 -1
  84. package/__cjs/link/http/HttpLink.cjs.map +1 -1
  85. package/__cjs/link/http/HttpLink.d.cts +13 -2
  86. package/__cjs/link/http/checkFetcher.cjs +1 -1
  87. package/__cjs/link/http/parseAndCheckHttpResponse.cjs +1 -1
  88. package/__cjs/link/http/serializeFetchParameter.cjs +1 -1
  89. package/__cjs/link/persisted-queries/index.cjs +2 -2
  90. package/__cjs/link/persisted-queries/index.cjs.map +1 -1
  91. package/__cjs/link/persisted-queries/index.d.cts +11 -11
  92. package/__cjs/link/retry/delayFunction.cjs.map +1 -1
  93. package/__cjs/link/retry/delayFunction.d.cts +1 -1
  94. package/__cjs/link/retry/retryFunction.cjs.map +1 -1
  95. package/__cjs/link/retry/retryFunction.d.cts +1 -1
  96. package/__cjs/link/retry/retryLink.cjs.map +1 -1
  97. package/__cjs/link/schema/index.cjs.map +1 -1
  98. package/__cjs/link/utils/validateOperation.cjs +1 -1
  99. package/__cjs/link/ws/index.cjs.map +1 -1
  100. package/__cjs/local-state/LocalState.cjs +55 -9
  101. package/__cjs/local-state/LocalState.cjs.map +1 -1
  102. package/__cjs/local-state/LocalState.d.cts +94 -0
  103. package/__cjs/masking/GraphQLCodegenDataMasking.d.cts +6 -7
  104. package/__cjs/masking/internal/types.d.cts +70 -70
  105. package/__cjs/masking/maskDefinition.cjs +2 -2
  106. package/__cjs/masking/maskFragment.cjs +2 -2
  107. package/__cjs/masking/maskOperation.cjs +1 -1
  108. package/__cjs/masking/utils.cjs +3 -3
  109. package/__cjs/react/context/ApolloContext.cjs +1 -1
  110. package/__cjs/react/context/ApolloProvider.cjs +1 -1
  111. package/__cjs/react/hooks/internal/useDeepMemo.cjs +0 -3
  112. package/__cjs/react/hooks/internal/useDeepMemo.cjs.map +1 -1
  113. package/__cjs/react/hooks/internal/validateSuspenseHookOptions.cjs.map +1 -1
  114. package/__cjs/react/hooks/internal/validateSuspenseHookOptions.d.cts +2 -2
  115. package/__cjs/react/hooks/internal/wrapHook.cjs +1 -0
  116. package/__cjs/react/hooks/internal/wrapHook.cjs.map +1 -1
  117. package/__cjs/react/hooks/internal/wrapHook.d.cts +8 -7
  118. package/__cjs/react/hooks/useApolloClient.cjs +2 -2
  119. package/__cjs/react/hooks/useApolloClient.cjs.map +1 -1
  120. package/__cjs/react/hooks/useApolloClient.d.cts +2 -2
  121. package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
  122. package/__cjs/react/hooks/useBackgroundQuery.d.cts +814 -82
  123. package/__cjs/react/hooks/useFragment.cjs +11 -9
  124. package/__cjs/react/hooks/useFragment.cjs.map +1 -1
  125. package/__cjs/react/hooks/useFragment.d.cts +53 -2
  126. package/__cjs/react/hooks/useLazyQuery.cjs +0 -38
  127. package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
  128. package/__cjs/react/hooks/useLazyQuery.d.cts +313 -119
  129. package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
  130. package/__cjs/react/hooks/useLoadableQuery.d.cts +230 -44
  131. package/__cjs/react/hooks/useMutation.cjs +6 -7
  132. package/__cjs/react/hooks/useMutation.cjs.map +1 -1
  133. package/__cjs/react/hooks/useMutation.d.cts +57 -17
  134. package/__cjs/react/hooks/useQuery.cjs +1 -35
  135. package/__cjs/react/hooks/useQuery.cjs.map +1 -1
  136. package/__cjs/react/hooks/useQuery.d.cts +407 -238
  137. package/__cjs/react/hooks/useQueryRefHandlers.cjs +2 -1
  138. package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
  139. package/__cjs/react/hooks/useQueryRefHandlers.d.cts +25 -1
  140. package/__cjs/react/hooks/useReactiveVar.cjs +2 -1
  141. package/__cjs/react/hooks/useReactiveVar.cjs.map +1 -1
  142. package/__cjs/react/hooks/useReactiveVar.d.cts +2 -1
  143. package/__cjs/react/hooks/useReadQuery.cjs +29 -0
  144. package/__cjs/react/hooks/useReadQuery.cjs.map +1 -1
  145. package/__cjs/react/hooks/useReadQuery.d.cts +95 -16
  146. package/__cjs/react/hooks/useSubscription.cjs +8 -9
  147. package/__cjs/react/hooks/useSubscription.cjs.map +1 -1
  148. package/__cjs/react/hooks/useSubscription.d.cts +153 -69
  149. package/__cjs/react/hooks/useSuspenseFragment.cjs.map +1 -1
  150. package/__cjs/react/hooks/useSuspenseFragment.d.cts +61 -29
  151. package/__cjs/react/hooks/useSuspenseQuery.cjs +4 -1
  152. package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
  153. package/__cjs/react/hooks/useSuspenseQuery.d.cts +605 -160
  154. package/__cjs/react/index.cjs +1 -5
  155. package/__cjs/react/index.cjs.map +1 -1
  156. package/__cjs/react/index.d.cts +0 -2
  157. package/__cjs/react/index.react-server.cjs +1 -3
  158. package/__cjs/react/index.react-server.cjs.map +1 -1
  159. package/__cjs/react/index.react-server.d.cts +0 -1
  160. package/__cjs/react/internal/cache/FragmentReference.cjs +1 -1
  161. package/__cjs/react/internal/cache/FragmentReference.cjs.map +1 -1
  162. package/__cjs/react/internal/cache/FragmentReference.d.cts +2 -3
  163. package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
  164. package/__cjs/react/internal/cache/QueryReference.d.cts +11 -11
  165. package/__cjs/react/internal/cache/SuspenseCache.cjs.map +1 -1
  166. package/__cjs/react/internal/cache/SuspenseCache.d.cts +2 -2
  167. package/__cjs/react/internal/cache/getSuspenseCache.cjs.map +1 -1
  168. package/__cjs/react/internal/cache/getSuspenseCache.d.cts +6 -4
  169. package/__cjs/react/internal/index.cjs +1 -0
  170. package/__cjs/react/internal/index.cjs.map +1 -1
  171. package/__cjs/react/internal/index.d.cts +1 -1
  172. package/__cjs/react/internal/types.d.cts +3 -3
  173. package/__cjs/react/query-preloader/createQueryPreloader.cjs +1 -1
  174. package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
  175. package/__cjs/react/query-preloader/createQueryPreloader.d.cts +31 -31
  176. package/__cjs/react/ssr/prerenderStatic.cjs +5 -4
  177. package/__cjs/react/ssr/prerenderStatic.cjs.map +1 -1
  178. package/__cjs/react/ssr/prerenderStatic.d.cts +11 -9
  179. package/__cjs/react/ssr/useSSRQuery.cjs.map +1 -1
  180. package/__cjs/react/types/deprecated.d.cts +1 -1
  181. package/__cjs/react/types/types.documentation.d.cts +22 -11
  182. package/__cjs/testing/core/mocking/mockLink.cjs.map +1 -1
  183. package/__cjs/testing/core/mocking/mockLink.d.cts +3 -2
  184. package/__cjs/testing/core/types/deprecated.d.cts +3 -2
  185. package/__cjs/testing/react/MockedProvider.cjs.map +1 -1
  186. package/__cjs/testing/react/MockedProvider.d.cts +2 -3
  187. package/__cjs/utilities/HKT.d.cts +8 -7
  188. package/__cjs/utilities/caching/sizes.cjs +3 -3
  189. package/__cjs/utilities/caching/sizes.cjs.map +1 -1
  190. package/__cjs/utilities/caching/sizes.d.cts +4 -6
  191. package/__cjs/utilities/graphql/DocumentTransform.cjs +2 -2
  192. package/__cjs/utilities/graphql/DocumentTransform.cjs.map +1 -1
  193. package/__cjs/utilities/index.cjs +2 -3
  194. package/__cjs/utilities/index.cjs.map +1 -1
  195. package/__cjs/utilities/index.d.cts +1 -2
  196. package/__cjs/utilities/{shared → internal}/canonicalStringify.cjs +5 -7
  197. package/__cjs/utilities/internal/canonicalStringify.cjs.map +1 -0
  198. package/__cjs/utilities/{shared → internal}/canonicalStringify.d.cts +1 -1
  199. package/__cjs/utilities/internal/checkDocument.cjs +2 -2
  200. package/__cjs/utilities/internal/checkDocument.cjs.map +1 -1
  201. package/__cjs/utilities/internal/createFragmentMap.cjs.map +1 -1
  202. package/__cjs/{core → utilities/internal}/equalByQuery.cjs +13 -7
  203. package/__cjs/utilities/internal/equalByQuery.cjs.map +1 -0
  204. package/__cjs/utilities/internal/equalByQuery.d.cts +5 -0
  205. package/__cjs/utilities/internal/getFragmentQueryDocument.cjs +13 -3
  206. package/__cjs/utilities/internal/getFragmentQueryDocument.cjs.map +1 -1
  207. package/__cjs/utilities/internal/getFragmentQueryDocument.d.cts +13 -3
  208. package/__cjs/utilities/internal/getMemoryInternals.cjs.map +1 -1
  209. package/__cjs/utilities/internal/getStoreKeyName.cjs +9 -7
  210. package/__cjs/utilities/internal/getStoreKeyName.cjs.map +1 -1
  211. package/__cjs/utilities/internal/index.cjs +8 -2
  212. package/__cjs/utilities/internal/index.cjs.map +1 -1
  213. package/__cjs/utilities/internal/index.d.cts +4 -0
  214. package/__cjs/utilities/internal/mergeOptions.cjs.map +1 -1
  215. package/__cjs/utilities/internal/mergeOptions.d.cts +2 -2
  216. package/__cjs/utilities/internal/removeFragmentSpreads.cjs +14 -0
  217. package/__cjs/utilities/internal/removeFragmentSpreads.cjs.map +1 -0
  218. package/__cjs/utilities/internal/removeFragmentSpreads.d.cts +3 -0
  219. package/__cjs/utilities/internal/toQueryResult.cjs.map +1 -1
  220. package/__cjs/utilities/internal/toQueryResult.d.cts +2 -2
  221. package/__cjs/utilities/internal/types/DocumentationTypes.cjs +3 -0
  222. package/__cjs/utilities/internal/types/DocumentationTypes.cjs.map +1 -0
  223. package/__cjs/utilities/internal/types/DocumentationTypes.d.cts +96 -0
  224. package/__cjs/utilities/internal/types/NoInfer.d.cts +31 -25
  225. package/__cjs/utilities/subscriptions/relay/index.cjs +2 -0
  226. package/__cjs/utilities/subscriptions/relay/index.cjs.map +1 -1
  227. package/__cjs/version.cjs +1 -1
  228. package/cache/core/cache.d.ts +96 -66
  229. package/cache/core/cache.js +5 -13
  230. package/cache/core/cache.js.map +1 -1
  231. package/cache/core/types/Cache.d.ts +200 -15
  232. package/cache/core/types/Cache.js +1 -3
  233. package/cache/core/types/Cache.js.map +1 -1
  234. package/cache/deprecated.d.ts +6 -0
  235. package/cache/deprecated.js +2 -0
  236. package/cache/deprecated.js.map +1 -0
  237. package/cache/index.d.ts +2 -2
  238. package/cache/index.js.map +1 -1
  239. package/cache/inmemory/entityStore.d.ts +18 -17
  240. package/cache/inmemory/entityStore.js +28 -31
  241. package/cache/inmemory/entityStore.js.map +1 -1
  242. package/cache/inmemory/inMemoryCache.d.ts +4 -4
  243. package/cache/inmemory/inMemoryCache.js +1 -1
  244. package/cache/inmemory/inMemoryCache.js.map +1 -1
  245. package/cache/inmemory/key-extractor.js +1 -1
  246. package/cache/inmemory/policies.d.ts +3 -2
  247. package/cache/inmemory/policies.js +4 -4
  248. package/cache/inmemory/policies.js.map +1 -1
  249. package/cache/inmemory/readFromStore.js +2 -2
  250. package/cache/inmemory/types.d.ts +1 -1
  251. package/cache/inmemory/types.js.map +1 -1
  252. package/cache/inmemory/writeToStore.d.ts +1 -1
  253. package/cache/inmemory/writeToStore.js +4 -4
  254. package/cache/inmemory/writeToStore.js.map +1 -1
  255. package/core/ApolloClient.d.ts +790 -183
  256. package/core/ApolloClient.js +138 -118
  257. package/core/ApolloClient.js.map +1 -1
  258. package/core/ObservableQuery.d.ts +184 -68
  259. package/core/ObservableQuery.js +50 -20
  260. package/core/ObservableQuery.js.map +1 -1
  261. package/core/QueryInfo.d.ts +5 -4
  262. package/core/QueryInfo.js.map +1 -1
  263. package/core/QueryManager.d.ts +17 -17
  264. package/core/QueryManager.js +15 -13
  265. package/core/QueryManager.js.map +1 -1
  266. package/core/deprecated.d.ts +29 -0
  267. package/core/deprecated.js +2 -0
  268. package/core/deprecated.js.map +1 -0
  269. package/core/index.d.ts +9 -5
  270. package/core/index.js.map +1 -1
  271. package/core/types.d.ts +81 -104
  272. package/core/types.js.map +1 -1
  273. package/core/watchQueryOptions.d.ts +9 -298
  274. package/core/watchQueryOptions.js.map +1 -1
  275. package/dev/setErrorMessageHandler.d.ts +4 -4
  276. package/dev/setErrorMessageHandler.js.map +1 -1
  277. package/errors/CombinedGraphQLErrors.d.ts +147 -12
  278. package/errors/CombinedGraphQLErrors.js +60 -12
  279. package/errors/CombinedGraphQLErrors.js.map +1 -1
  280. package/errors/CombinedProtocolErrors.d.ts +127 -3
  281. package/errors/CombinedProtocolErrors.js +49 -2
  282. package/errors/CombinedProtocolErrors.js.map +1 -1
  283. package/errors/LinkError.d.ts +45 -2
  284. package/errors/LinkError.js +45 -2
  285. package/errors/LinkError.js.map +1 -1
  286. package/errors/LocalStateError.d.ts +42 -6
  287. package/errors/LocalStateError.js +36 -6
  288. package/errors/LocalStateError.js.map +1 -1
  289. package/errors/ServerError.d.ts +71 -12
  290. package/errors/ServerError.js +51 -9
  291. package/errors/ServerError.js.map +1 -1
  292. package/errors/ServerParseError.d.ts +72 -17
  293. package/errors/ServerParseError.js +46 -9
  294. package/errors/ServerParseError.js.map +1 -1
  295. package/errors/UnconventionalError.d.ts +46 -2
  296. package/errors/UnconventionalError.js +46 -2
  297. package/errors/UnconventionalError.js.map +1 -1
  298. package/incremental/handlers/notImplemented.js +1 -1
  299. package/invariantErrorCodes.js +72 -80
  300. package/link/batch/batchLink.js.map +1 -1
  301. package/link/batch-http/batchHttpLink.js +1 -1
  302. package/link/batch-http/batchHttpLink.js.map +1 -1
  303. package/link/client-awareness/ClientAwarenessLink.d.ts +4 -4
  304. package/link/client-awareness/ClientAwarenessLink.js.map +1 -1
  305. package/link/context/index.d.ts +1 -1
  306. package/link/context/index.js +1 -1
  307. package/link/context/index.js.map +1 -1
  308. package/link/core/ApolloLink.js +2 -2
  309. package/link/core/types.d.ts +2 -2
  310. package/link/core/types.js.map +1 -1
  311. package/link/error/index.d.ts +16 -1
  312. package/link/error/index.js.map +1 -1
  313. package/link/http/HttpLink.d.ts +13 -2
  314. package/link/http/HttpLink.js.map +1 -1
  315. package/link/http/checkFetcher.js +1 -1
  316. package/link/http/parseAndCheckHttpResponse.js +1 -1
  317. package/link/http/serializeFetchParameter.js +1 -1
  318. package/link/persisted-queries/index.d.ts +11 -11
  319. package/link/persisted-queries/index.js +2 -2
  320. package/link/persisted-queries/index.js.map +1 -1
  321. package/link/retry/delayFunction.d.ts +1 -1
  322. package/link/retry/delayFunction.js.map +1 -1
  323. package/link/retry/retryFunction.d.ts +1 -1
  324. package/link/retry/retryFunction.js.map +1 -1
  325. package/link/retry/retryLink.js.map +1 -1
  326. package/link/schema/index.js.map +1 -1
  327. package/link/utils/validateOperation.js +1 -1
  328. package/link/ws/index.js.map +1 -1
  329. package/local-state/LocalState.d.ts +94 -0
  330. package/local-state/LocalState.js +55 -9
  331. package/local-state/LocalState.js.map +1 -1
  332. package/masking/GraphQLCodegenDataMasking.d.ts +6 -7
  333. package/masking/GraphQLCodegenDataMasking.js.map +1 -1
  334. package/masking/internal/types.d.ts +70 -70
  335. package/masking/internal/types.js.map +1 -1
  336. package/masking/maskDefinition.js +2 -2
  337. package/masking/maskFragment.js +2 -2
  338. package/masking/maskOperation.js +1 -1
  339. package/masking/types.js.map +1 -1
  340. package/masking/utils.js +3 -3
  341. package/package.json +1 -1
  342. package/react/context/ApolloContext.js +1 -1
  343. package/react/context/ApolloProvider.js +1 -1
  344. package/react/hooks/internal/useDeepMemo.js +0 -3
  345. package/react/hooks/internal/useDeepMemo.js.map +1 -1
  346. package/react/hooks/internal/validateSuspenseHookOptions.d.ts +2 -2
  347. package/react/hooks/internal/validateSuspenseHookOptions.js.map +1 -1
  348. package/react/hooks/internal/wrapHook.d.ts +8 -7
  349. package/react/hooks/internal/wrapHook.js +1 -0
  350. package/react/hooks/internal/wrapHook.js.map +1 -1
  351. package/react/hooks/useApolloClient.d.ts +2 -2
  352. package/react/hooks/useApolloClient.js +2 -2
  353. package/react/hooks/useApolloClient.js.map +1 -1
  354. package/react/hooks/useBackgroundQuery.d.ts +814 -82
  355. package/react/hooks/useBackgroundQuery.js.map +1 -1
  356. package/react/hooks/useFragment.d.ts +54 -3
  357. package/react/hooks/useFragment.js +11 -9
  358. package/react/hooks/useFragment.js.map +1 -1
  359. package/react/hooks/useLazyQuery.d.ts +313 -119
  360. package/react/hooks/useLazyQuery.js +0 -38
  361. package/react/hooks/useLazyQuery.js.map +1 -1
  362. package/react/hooks/useLoadableQuery.d.ts +230 -44
  363. package/react/hooks/useLoadableQuery.js.map +1 -1
  364. package/react/hooks/useMutation.d.ts +57 -17
  365. package/react/hooks/useMutation.js +6 -7
  366. package/react/hooks/useMutation.js.map +1 -1
  367. package/react/hooks/useQuery.d.ts +407 -238
  368. package/react/hooks/useQuery.js +1 -35
  369. package/react/hooks/useQuery.js.map +1 -1
  370. package/react/hooks/useQueryRefHandlers.d.ts +25 -1
  371. package/react/hooks/useQueryRefHandlers.js +2 -1
  372. package/react/hooks/useQueryRefHandlers.js.map +1 -1
  373. package/react/hooks/useReactiveVar.d.ts +2 -1
  374. package/react/hooks/useReactiveVar.js +2 -1
  375. package/react/hooks/useReactiveVar.js.map +1 -1
  376. package/react/hooks/useReadQuery.d.ts +96 -17
  377. package/react/hooks/useReadQuery.js +29 -0
  378. package/react/hooks/useReadQuery.js.map +1 -1
  379. package/react/hooks/useSubscription.d.ts +153 -69
  380. package/react/hooks/useSubscription.js +8 -9
  381. package/react/hooks/useSubscription.js.map +1 -1
  382. package/react/hooks/useSuspenseFragment.d.ts +62 -30
  383. package/react/hooks/useSuspenseFragment.js.map +1 -1
  384. package/react/hooks/useSuspenseQuery.d.ts +605 -160
  385. package/react/hooks/useSuspenseQuery.js +4 -1
  386. package/react/hooks/useSuspenseQuery.js.map +1 -1
  387. package/react/hooks-compiled/internal/useDeepMemo.js +0 -3
  388. package/react/hooks-compiled/internal/useDeepMemo.js.map +1 -1
  389. package/react/hooks-compiled/internal/validateSuspenseHookOptions.d.ts +2 -2
  390. package/react/hooks-compiled/internal/validateSuspenseHookOptions.js.map +1 -1
  391. package/react/hooks-compiled/internal/wrapHook.d.ts +8 -7
  392. package/react/hooks-compiled/internal/wrapHook.js +1 -0
  393. package/react/hooks-compiled/internal/wrapHook.js.map +1 -1
  394. package/react/hooks-compiled/useApolloClient.d.ts +2 -2
  395. package/react/hooks-compiled/useApolloClient.js +2 -2
  396. package/react/hooks-compiled/useApolloClient.js.map +1 -1
  397. package/react/hooks-compiled/useBackgroundQuery.d.ts +814 -82
  398. package/react/hooks-compiled/useBackgroundQuery.js.map +1 -1
  399. package/react/hooks-compiled/useFragment.d.ts +54 -3
  400. package/react/hooks-compiled/useFragment.js +11 -9
  401. package/react/hooks-compiled/useFragment.js.map +1 -1
  402. package/react/hooks-compiled/useLazyQuery.d.ts +313 -119
  403. package/react/hooks-compiled/useLazyQuery.js +0 -38
  404. package/react/hooks-compiled/useLazyQuery.js.map +1 -1
  405. package/react/hooks-compiled/useLoadableQuery.d.ts +230 -44
  406. package/react/hooks-compiled/useLoadableQuery.js.map +1 -1
  407. package/react/hooks-compiled/useMutation.d.ts +57 -17
  408. package/react/hooks-compiled/useMutation.js +6 -7
  409. package/react/hooks-compiled/useMutation.js.map +1 -1
  410. package/react/hooks-compiled/useQuery.d.ts +407 -238
  411. package/react/hooks-compiled/useQuery.js +1 -35
  412. package/react/hooks-compiled/useQuery.js.map +1 -1
  413. package/react/hooks-compiled/useQueryRefHandlers.d.ts +25 -1
  414. package/react/hooks-compiled/useQueryRefHandlers.js +2 -1
  415. package/react/hooks-compiled/useQueryRefHandlers.js.map +1 -1
  416. package/react/hooks-compiled/useReactiveVar.d.ts +2 -1
  417. package/react/hooks-compiled/useReactiveVar.js +2 -1
  418. package/react/hooks-compiled/useReactiveVar.js.map +1 -1
  419. package/react/hooks-compiled/useReadQuery.d.ts +96 -17
  420. package/react/hooks-compiled/useReadQuery.js +29 -0
  421. package/react/hooks-compiled/useReadQuery.js.map +1 -1
  422. package/react/hooks-compiled/useSubscription.d.ts +153 -69
  423. package/react/hooks-compiled/useSubscription.js +8 -9
  424. package/react/hooks-compiled/useSubscription.js.map +1 -1
  425. package/react/hooks-compiled/useSuspenseFragment.d.ts +62 -30
  426. package/react/hooks-compiled/useSuspenseFragment.js.map +1 -1
  427. package/react/hooks-compiled/useSuspenseQuery.d.ts +605 -160
  428. package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
  429. package/react/index.compiled.d.ts +0 -2
  430. package/react/index.compiled.js +0 -2
  431. package/react/index.compiled.js.map +1 -1
  432. package/react/index.d.ts +0 -2
  433. package/react/index.js +0 -2
  434. package/react/index.js.map +1 -1
  435. package/react/index.react-server.d.ts +0 -1
  436. package/react/index.react-server.js +0 -2
  437. package/react/index.react-server.js.map +1 -1
  438. package/react/internal/cache/FragmentReference.d.ts +2 -3
  439. package/react/internal/cache/FragmentReference.js +1 -1
  440. package/react/internal/cache/FragmentReference.js.map +1 -1
  441. package/react/internal/cache/QueryReference.d.ts +11 -11
  442. package/react/internal/cache/QueryReference.js.map +1 -1
  443. package/react/internal/cache/SuspenseCache.d.ts +2 -2
  444. package/react/internal/cache/SuspenseCache.js.map +1 -1
  445. package/react/internal/cache/getSuspenseCache.d.ts +6 -4
  446. package/react/internal/cache/getSuspenseCache.js.map +1 -1
  447. package/react/internal/index.d.ts +1 -1
  448. package/react/internal/index.js +1 -0
  449. package/react/internal/index.js.map +1 -1
  450. package/react/internal/types.d.ts +3 -3
  451. package/react/internal/types.js.map +1 -1
  452. package/react/query-preloader/createQueryPreloader.d.ts +31 -31
  453. package/react/query-preloader/createQueryPreloader.js +1 -1
  454. package/react/query-preloader/createQueryPreloader.js.map +1 -1
  455. package/react/ssr/prerenderStatic.d.ts +11 -9
  456. package/react/ssr/prerenderStatic.js +5 -4
  457. package/react/ssr/prerenderStatic.js.map +1 -1
  458. package/react/ssr/useSSRQuery.js.map +1 -1
  459. package/react/types/deprecated.d.ts +1 -1
  460. package/react/types/deprecated.js.map +1 -1
  461. package/react/types/types.documentation.d.ts +22 -11
  462. package/react/types/types.documentation.js.map +1 -1
  463. package/testing/core/mocking/mockLink.d.ts +3 -2
  464. package/testing/core/mocking/mockLink.js.map +1 -1
  465. package/testing/core/types/deprecated.d.ts +3 -2
  466. package/testing/core/types/deprecated.js.map +1 -1
  467. package/testing/react/MockedProvider.d.ts +2 -3
  468. package/testing/react/MockedProvider.js.map +1 -1
  469. package/utilities/HKT.d.ts +8 -7
  470. package/utilities/HKT.js.map +1 -1
  471. package/utilities/caching/sizes.d.ts +4 -6
  472. package/utilities/caching/sizes.js +3 -3
  473. package/utilities/caching/sizes.js.map +1 -1
  474. package/utilities/graphql/DocumentTransform.js +1 -1
  475. package/utilities/graphql/DocumentTransform.js.map +1 -1
  476. package/utilities/index.d.ts +1 -2
  477. package/utilities/index.js +1 -2
  478. package/utilities/index.js.map +1 -1
  479. package/utilities/{shared → internal}/canonicalStringify.d.ts +1 -1
  480. package/utilities/{shared → internal}/canonicalStringify.js +4 -6
  481. package/utilities/internal/canonicalStringify.js.map +1 -0
  482. package/utilities/internal/checkDocument.js +1 -1
  483. package/utilities/internal/checkDocument.js.map +1 -1
  484. package/utilities/internal/createFragmentMap.js.map +1 -1
  485. package/utilities/internal/equalByQuery.d.ts +5 -0
  486. package/{core → utilities/internal}/equalByQuery.js +7 -1
  487. package/utilities/internal/equalByQuery.js.map +1 -0
  488. package/utilities/internal/getFragmentQueryDocument.d.ts +13 -3
  489. package/utilities/internal/getFragmentQueryDocument.js +13 -3
  490. package/utilities/internal/getFragmentQueryDocument.js.map +1 -1
  491. package/utilities/internal/getMemoryInternals.js.map +1 -1
  492. package/utilities/internal/getStoreKeyName.js +9 -7
  493. package/utilities/internal/getStoreKeyName.js.map +1 -1
  494. package/utilities/internal/index.d.ts +4 -0
  495. package/utilities/internal/index.js +3 -0
  496. package/utilities/internal/index.js.map +1 -1
  497. package/utilities/internal/mergeOptions.d.ts +2 -2
  498. package/utilities/internal/mergeOptions.js.map +1 -1
  499. package/utilities/internal/removeFragmentSpreads.d.ts +3 -0
  500. package/utilities/internal/removeFragmentSpreads.js +11 -0
  501. package/utilities/internal/removeFragmentSpreads.js.map +1 -0
  502. package/utilities/internal/toQueryResult.d.ts +2 -2
  503. package/utilities/internal/toQueryResult.js.map +1 -1
  504. package/utilities/internal/types/DocumentationTypes.d.ts +96 -0
  505. package/utilities/internal/types/DocumentationTypes.js +2 -0
  506. package/utilities/internal/types/DocumentationTypes.js.map +1 -0
  507. package/utilities/internal/types/NoInfer.d.ts +31 -25
  508. package/utilities/internal/types/NoInfer.js.map +1 -1
  509. package/utilities/subscriptions/relay/index.js +2 -0
  510. package/utilities/subscriptions/relay/index.js.map +1 -1
  511. package/version.js +1 -1
  512. package/__cjs/cache/core/types/DataProxy.cjs.map +0 -1
  513. package/__cjs/cache/core/types/DataProxy.d.cts +0 -140
  514. package/__cjs/core/equalByQuery.cjs.map +0 -1
  515. package/__cjs/core/equalByQuery.d.cts +0 -4
  516. package/__cjs/react/context/ApolloConsumer.cjs +0 -16
  517. package/__cjs/react/context/ApolloConsumer.cjs.map +0 -1
  518. package/__cjs/react/context/ApolloConsumer.d.cts +0 -10
  519. package/__cjs/utilities/shared/canonicalStringify.cjs.map +0 -1
  520. package/cache/core/types/DataProxy.d.ts +0 -140
  521. package/cache/core/types/DataProxy.js +0 -2
  522. package/cache/core/types/DataProxy.js.map +0 -1
  523. package/core/equalByQuery.d.ts +0 -4
  524. package/core/equalByQuery.js.map +0 -1
  525. package/react/context/ApolloConsumer.d.ts +0 -10
  526. package/react/context/ApolloConsumer.js +0 -11
  527. package/react/context/ApolloConsumer.js.map +0 -1
  528. package/utilities/shared/canonicalStringify.js.map +0 -1
@@ -1,106 +1,669 @@
1
+ import type { DocumentNode } from "graphql";
1
2
  import type { Observable } from "rxjs";
2
- import type { ApolloCache, DataProxy, Reference } from "@apollo/client/cache";
3
- import type { WatchFragmentOptions, WatchFragmentResult } from "@apollo/client/cache";
3
+ import type { ApolloCache, IgnoreModifier, Reference } from "@apollo/client/cache";
4
4
  import type { Incremental } from "@apollo/client/incremental";
5
5
  import type { ApolloLink, FetchResult, GraphQLRequest } from "@apollo/client/link";
6
6
  import type { ClientAwarenessLink } from "@apollo/client/link/client-awareness";
7
7
  import type { LocalState } from "@apollo/client/local-state";
8
8
  import type { MaybeMasked, Unmasked } from "@apollo/client/masking";
9
- import type { DocumentTransform } from "@apollo/client/utilities";
9
+ import { DocumentTransform } from "@apollo/client/utilities";
10
+ import type { VariablesOption } from "@apollo/client/utilities/internal";
10
11
  import { getApolloClientMemoryInternals } from "@apollo/client/utilities/internal";
11
12
  import type { ObservableQuery } from "./ObservableQuery.js";
12
- import type { DefaultContext, MutateResult, OperationVariables, QueryResult, RefetchQueriesInclude, RefetchQueriesOptions, RefetchQueriesResult, SubscribeResult, SubscriptionObservable } from "./types.js";
13
- import type { MutationOptions, QueryOptions, SubscriptionOptions, WatchQueryOptions } from "./watchQueryOptions.js";
14
- export interface DefaultOptions {
15
- watchQuery?: Partial<WatchQueryOptions<any, any>>;
16
- query?: Partial<QueryOptions<any, any>>;
17
- mutate?: Partial<MutationOptions<any, any, any>>;
18
- }
19
- interface DevtoolsOptions {
20
- /**
21
- * If `true`, the [Apollo Client Devtools](https://www.apollographql.com/docs/react/development-testing/developer-tooling/#apollo-client-devtools) browser extension can connect to this `ApolloClient` instance.
22
- *
23
- * The default value is `false` in production and `true` in development if there is a `window` object.
24
- */
25
- enabled?: boolean;
26
- /**
27
- * Optional name for this `ApolloClient` instance in the devtools. This is
28
- * useful when you instantiate multiple clients and want to be able to
29
- * identify them by name.
30
- */
31
- name?: string;
32
- }
33
- export interface ApolloClientOptions {
34
- /**
35
- * You can provide an `ApolloLink` instance to serve as Apollo Client's network layer. For more information, see [Advanced HTTP networking](https://www.apollographql.com/docs/react/networking/advanced-http-networking/).
36
- *
37
- * One of `uri` or `link` is **required**. If you provide both, `link` takes precedence.
38
- */
39
- link: ApolloLink;
40
- /**
41
- * The cache that Apollo Client should use to store query results locally. The recommended cache is `InMemoryCache`, which is provided by the `@apollo/client` package.
42
- *
43
- * For more information, see [Configuring the cache](https://www.apollographql.com/docs/react/caching/cache-configuration/).
44
- */
45
- cache: ApolloCache;
13
+ import type { DefaultContext, ErrorLike, InternalRefetchQueriesInclude, InternalRefetchQueriesResult, MutationQueryReducersMap, MutationUpdaterFunction, NormalizedExecutionResult, OnQueryUpdated, OperationVariables, RefetchQueriesInclude, RefetchQueriesPromiseResults, SubscriptionObservable, TypedDocumentNode } from "./types.js";
14
+ import type { ErrorPolicy, FetchPolicy, MutationFetchPolicy, NextFetchPolicyContext, RefetchWritePolicy, WatchQueryFetchPolicy } from "./watchQueryOptions.js";
15
+ export declare namespace ApolloClient {
16
+ interface DefaultOptions {
17
+ watchQuery?: Partial<ApolloClient.WatchQueryOptions<any, any>>;
18
+ query?: Partial<ApolloClient.QueryOptions<any, any>>;
19
+ mutate?: Partial<ApolloClient.MutateOptions<any, any, any>>;
20
+ }
21
+ interface Options {
22
+ /**
23
+ * An `ApolloLink` instance to serve as Apollo Client's network layer. For more information, see [Advanced HTTP networking](https://www.apollographql.com/docs/react/networking/advanced-http-networking/).
24
+ */
25
+ link: ApolloLink;
26
+ /**
27
+ * The cache that Apollo Client should use to store query results locally. The recommended cache is `InMemoryCache`, which is provided by the `@apollo/client` package.
28
+ *
29
+ * For more information, see [Configuring the cache](https://www.apollographql.com/docs/react/caching/cache-configuration/).
30
+ */
31
+ cache: ApolloCache;
32
+ /**
33
+ * The time interval (in milliseconds) before Apollo Client force-fetches queries after a server-side render.
34
+ *
35
+ * @defaultValue `0` (no delay)
36
+ */
37
+ ssrForceFetchDelay?: number;
38
+ /**
39
+ * When using Apollo Client for [server-side rendering](https://www.apollographql.com/docs/react/performance/server-side-rendering/), set this to `true` so that the [`getDataFromTree` function](../react/ssr/#getdatafromtree) can work effectively.
40
+ *
41
+ * @defaultValue `false`
42
+ */
43
+ ssrMode?: boolean;
44
+ /**
45
+ * If `false`, Apollo Client sends every created query to the server, even if a _completely_ identical query (identical in terms of query string, variable values, and operationName) is already in flight.
46
+ *
47
+ * @defaultValue `true`
48
+ */
49
+ queryDeduplication?: boolean;
50
+ /**
51
+ * Provide this object to set application-wide default values for options you can provide to the `watchQuery`, `query`, and `mutate` functions. See below for an example object.
52
+ *
53
+ * See this [example object](https://www.apollographql.com/docs/react/api/core/ApolloClient#example-defaultoptions-object).
54
+ */
55
+ defaultOptions?: ApolloClient.DefaultOptions;
56
+ defaultContext?: Partial<DefaultContext>;
57
+ /**
58
+ * If `true`, Apollo Client will assume results read from the cache are never mutated by application code, which enables substantial performance optimizations.
59
+ *
60
+ * @defaultValue `false`
61
+ */
62
+ assumeImmutableResults?: boolean;
63
+ localState?: LocalState;
64
+ /**
65
+ *
66
+ */
67
+ clientAwareness?: ClientAwarenessLink.ClientAwarenessOptions;
68
+ /**
69
+ *
70
+ */
71
+ enhancedClientAwareness?: ClientAwarenessLink.EnhancedClientAwarenessOptions;
72
+ documentTransform?: DocumentTransform;
73
+ /**
74
+ * Configuration used by the [Apollo Client Devtools extension](https://www.apollographql.com/docs/react/development-testing/developer-tooling/#apollo-client-devtools) for this client.
75
+ *
76
+ * @since 3.11.0
77
+ */
78
+ devtools?: DevtoolsOptions;
79
+ /**
80
+ * Determines if data masking is enabled for the client.
81
+ *
82
+ * @defaultValue false
83
+ */
84
+ dataMasking?: boolean;
85
+ /**
86
+ * Determines the strategy used to parse incremental chunks from `@defer`
87
+ * queries.
88
+ */
89
+ incrementalHandler?: Incremental.Handler<any>;
90
+ }
91
+ interface DevtoolsOptions {
92
+ /**
93
+ * If `true`, the [Apollo Client Devtools](https://www.apollographql.com/docs/react/development-testing/developer-tooling/#apollo-client-devtools) browser extension can connect to this `ApolloClient` instance.
94
+ *
95
+ * The default value is `false` in production and `true` in development if there is a `window` object.
96
+ */
97
+ enabled?: boolean;
98
+ /**
99
+ * Optional name for this `ApolloClient` instance in the devtools. This is
100
+ * useful when you instantiate multiple clients and want to be able to
101
+ * identify them by name.
102
+ */
103
+ name?: string;
104
+ }
105
+ type MutateOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables, TCache extends ApolloCache = ApolloCache> = {
106
+ /**
107
+ * 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.
108
+ *
109
+ * For more information, see [Optimistic mutation results](https://www.apollographql.com/docs/react/performance/optimistic-ui/).
110
+ *
111
+ * @docGroup
112
+ *
113
+ * 3. Caching options
114
+ */
115
+ optimisticResponse?: Unmasked<NoInfer<TData>> | ((vars: TVariables, { IGNORE }: {
116
+ IGNORE: IgnoreModifier;
117
+ }) => Unmasked<NoInfer<TData>> | IgnoreModifier);
118
+ /**
119
+ * 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.
120
+ */
121
+ updateQueries?: MutationQueryReducersMap<TData>;
122
+ /**
123
+ * An array (or a function that _returns_ an array) that specifies which queries you want to refetch after the mutation occurs.
124
+ *
125
+ * Each array value can be either:
126
+ *
127
+ * - An object containing the `query` to execute, along with any `variables`
128
+ *
129
+ * - A string indicating the operation name of the query to refetch
130
+ *
131
+ * @docGroup
132
+ *
133
+ * 1. Operation options
134
+ */
135
+ refetchQueries?: ((result: NormalizedExecutionResult<Unmasked<TData>>) => InternalRefetchQueriesInclude) | InternalRefetchQueriesInclude;
136
+ /**
137
+ * If `true`, makes sure all queries included in `refetchQueries` are completed before the mutation is considered complete.
138
+ *
139
+ * The default value is `false` (queries are refetched asynchronously).
140
+ *
141
+ * @docGroup
142
+ *
143
+ * 1. Operation options
144
+ */
145
+ awaitRefetchQueries?: boolean;
146
+ /**
147
+ * A function used to update the Apollo Client cache after the mutation completes.
148
+ *
149
+ * For more information, see [Updating the cache after a mutation](https://www.apollographql.com/docs/react/data/mutations#updating-the-cache-after-a-mutation).
150
+ *
151
+ * @docGroup
152
+ *
153
+ * 3. Caching options
154
+ */
155
+ update?: MutationUpdaterFunction<TData, TVariables, TCache>;
156
+ /**
157
+ * 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`.
158
+ *
159
+ * Returning a `Promise` from `onQueryUpdated` will cause the final mutation `Promise` to await the returned `Promise`. Returning `false` causes the query to be ignored.
160
+ *
161
+ * @docGroup
162
+ *
163
+ * 1. Operation options
164
+ */
165
+ onQueryUpdated?: OnQueryUpdated<any>;
166
+ /**
167
+ * Specifies how the mutation handles a response that returns both GraphQL errors and partial results.
168
+ *
169
+ * For details, see [GraphQL error policies](https://www.apollographql.com/docs/react/data/error-handling/#graphql-error-policies).
170
+ *
171
+ * The default value is `none`, meaning that the mutation result includes error details but _not_ partial results.
172
+ *
173
+ * @docGroup
174
+ *
175
+ * 1. Operation options
176
+ */
177
+ errorPolicy?: ErrorPolicy;
178
+ /**
179
+ * 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.
180
+ *
181
+ * @docGroup
182
+ *
183
+ * 2. Networking options
184
+ */
185
+ context?: DefaultContext;
186
+ /**
187
+ * Provide `no-cache` if the mutation's result should _not_ be written to the Apollo Client cache.
188
+ *
189
+ * The default value is `network-only` (which means the result _is_ written to the cache).
190
+ *
191
+ * 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`.
192
+ *
193
+ * @docGroup
194
+ *
195
+ * 3. Caching options
196
+ */
197
+ fetchPolicy?: MutationFetchPolicy;
198
+ /**
199
+ * 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.
200
+ */
201
+ keepRootFields?: boolean;
202
+ /**
203
+ * A GraphQL document, often created with `gql` from the `graphql-tag` package, that contains a single mutation inside of it.
204
+ *
205
+ * @docGroup
206
+ *
207
+ * 1. Operation options
208
+ */
209
+ mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;
210
+ } & VariablesOption<NoInfer<TVariables>>;
211
+ interface MutateResult<TData = unknown> {
212
+ /**
213
+ * The data returned from your mutation. Can be `undefined` if `ignoreResults` is `true`.
214
+ */
215
+ data: TData | undefined;
216
+ /**
217
+ * 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`.
218
+ *
219
+ * For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).
220
+ */
221
+ error?: ErrorLike;
222
+ /**
223
+ * Custom extensions returned from the GraphQL server
224
+ */
225
+ extensions?: Record<string, unknown>;
226
+ }
46
227
  /**
47
- * The time interval (in milliseconds) before Apollo Client force-fetches queries after a server-side render.
48
- *
49
- * @defaultValue `0` (no delay)
50
- */
51
- ssrForceFetchDelay?: number;
52
- /**
53
- * When using Apollo Client for [server-side rendering](https://www.apollographql.com/docs/react/performance/server-side-rendering/), set this to `true` so that the [`getDataFromTree` function](../react/ssr/#getdatafromtree) can work effectively.
54
- *
55
- * @defaultValue `false`
228
+ * Query options.
56
229
  */
57
- ssrMode?: boolean;
230
+ type QueryOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables> = {
231
+ /**
232
+ * A GraphQL query string parsed into an AST with the gql template literal.
233
+ *
234
+ * @docGroup
235
+ *
236
+ * 1. Operation options
237
+ */
238
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>;
239
+ /**
240
+ * Specifies how the query handles a response that returns both GraphQL errors and partial results.
241
+ *
242
+ * For details, see [GraphQL error policies](https://www.apollographql.com/docs/react/data/error-handling/#graphql-error-policies).
243
+ *
244
+ * The default value is `none`, meaning that the query result includes error details but not partial results.
245
+ *
246
+ * @docGroup
247
+ *
248
+ * 1. Operation options
249
+ */
250
+ errorPolicy?: ErrorPolicy;
251
+ /**
252
+ * 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.
253
+ *
254
+ * @docGroup
255
+ *
256
+ * 2. Networking options
257
+ */
258
+ context?: DefaultContext;
259
+ /**
260
+ * 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).
261
+ *
262
+ * For details, see [Setting a fetch policy](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy).
263
+ *
264
+ * The default value is `cache-first`.
265
+ *
266
+ * @docGroup
267
+ *
268
+ * 3. Caching options
269
+ */
270
+ fetchPolicy?: FetchPolicy;
271
+ } & VariablesOption<NoInfer<TVariables>>;
272
+ interface QueryResult<TData = unknown> {
273
+ /**
274
+ * An object containing the result of your GraphQL query after it completes.
275
+ *
276
+ * This value might be `undefined` if a query results in one or more errors (depending on the query's `errorPolicy`).
277
+ *
278
+ * @docGroup
279
+ *
280
+ * 1. Operation data
281
+ */
282
+ data: TData | undefined;
283
+ /**
284
+ * A single ErrorLike object describing the error that occured during the latest query execution.
285
+ *
286
+ * For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).
287
+ *
288
+ * @docGroup
289
+ *
290
+ * 1. Operation data
291
+ */
292
+ error?: ErrorLike;
293
+ }
58
294
  /**
59
- * If `false`, Apollo Client sends every created query to the server, even if a _completely_ identical query (identical in terms of query string, variable values, and operationName) is already in flight.
60
- *
61
- * @defaultValue `true`
295
+ * Options object for the `client.refetchQueries` method.
62
296
  */
63
- queryDeduplication?: boolean;
297
+ interface RefetchQueriesOptions<TCache extends ApolloCache, TResult> {
298
+ /**
299
+ * Optional function that updates cached fields to trigger refetches of queries that include those fields.
300
+ */
301
+ updateCache?: (cache: TCache) => void;
302
+ /**
303
+ * Optional array specifying queries to refetch. Each element can be either a query's string name or a `DocumentNode` object.
304
+ *
305
+ * Pass `"active"` as a shorthand to refetch all active queries, or `"all"` to refetch all active and inactive queries.
306
+ *
307
+ * Analogous to the [`options.refetchQueries`](https://www.apollographql.com/docs/react/data/mutations/#options) array for mutations.
308
+ */
309
+ include?: RefetchQueriesInclude;
310
+ /**
311
+ * If `true`, the `options.updateCache` function is executed on a temporary optimistic layer of `InMemoryCache`, so its modifications can be discarded from the cache after observing which fields it invalidated.
312
+ *
313
+ * Defaults to `false`, meaning `options.updateCache` updates the cache in a lasting way.
314
+ */
315
+ optimistic?: boolean;
316
+ /**
317
+ * Optional callback function that's called once for each `ObservableQuery` that's either affected by `options.updateCache` or listed in `options.include` (or both).
318
+ *
319
+ * If `onQueryUpdated` is not provided, the default implementation returns the result of calling `observableQuery.refetch()`. When `onQueryUpdated` is provided, it can dynamically decide whether (and how) each query should be refetched.
320
+ *
321
+ * Returning `false` from `onQueryUpdated` prevents the associated query from being refetched.
322
+ */
323
+ onQueryUpdated?: OnQueryUpdated<TResult> | null;
324
+ }
64
325
  /**
65
- * Provide this object to set application-wide default values for options you can provide to the `watchQuery`, `query`, and `mutate` functions. See below for an example object.
66
- *
67
- * See this [example object](https://www.apollographql.com/docs/react/api/core/ApolloClient#example-defaultoptions-object).
326
+ * The result of client.refetchQueries is thenable/awaitable, if you just want
327
+ * an array of fully resolved results, but you can also access the raw results
328
+ * immediately by examining the additional `queries` and `results` properties of
329
+ * the `RefetchQueriesResult<TResult> object`.
68
330
  */
69
- defaultOptions?: DefaultOptions;
70
- defaultContext?: Partial<DefaultContext>;
331
+ interface RefetchQueriesResult<TResult> extends Promise<RefetchQueriesPromiseResults<TResult>>, RefetchQueriesResult.AdditionalProperties<TResult> {
332
+ }
333
+ namespace RefetchQueriesResult {
334
+ interface AdditionalProperties<TResult> {
335
+ /**
336
+ * An array of ObservableQuery objects corresponding 1:1 to TResult values
337
+ * in the results arrays (both the `result` property and the resolved value).
338
+ */
339
+ queries: ObservableQuery<any>[];
340
+ /**
341
+ * An array of results that were either returned by `onQueryUpdated`, or provided by default in the absence of `onQueryUpdated`, including pending promises.
342
+ *
343
+ * If `onQueryUpdated` returns `false` for a given query, no result is provided for that query.
344
+ *
345
+ * If `onQueryUpdated` returns `true`, the resulting `Promise<ApolloQueryResult<any>>` is included in the `results` array instead of `true`.
346
+ */
347
+ results: InternalRefetchQueriesResult<TResult>[];
348
+ }
349
+ }
350
+ type SubscribeOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables> = {
351
+ /**
352
+ * A GraphQL document, often created with `gql` from the `graphql-tag` package, that contains a single subscription inside of it.
353
+ */
354
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>;
355
+ /**
356
+ * How you want your component to interact with the Apollo cache. For details, see [Setting a fetch policy](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy).
357
+ */
358
+ fetchPolicy?: FetchPolicy;
359
+ /**
360
+ * Specifies the `ErrorPolicy` to be used for this operation
361
+ */
362
+ errorPolicy?: ErrorPolicy;
363
+ /**
364
+ * Shared context between your component and your network interface (Apollo Link).
365
+ */
366
+ context?: DefaultContext;
367
+ /**
368
+ * Shared context between your component and your network interface (Apollo Link).
369
+ */
370
+ extensions?: Record<string, any>;
371
+ } & VariablesOption<NoInfer<TVariables>>;
372
+ interface SubscribeResult<TData = unknown> {
373
+ /**
374
+ * The data returned from your mutation. Can be `undefined` if `ignoreResults` is `true`.
375
+ */
376
+ data: TData | undefined;
377
+ /**
378
+ * 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`.
379
+ *
380
+ * For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).
381
+ */
382
+ error?: ErrorLike;
383
+ /**
384
+ * Custom extensions returned from the GraphQL server
385
+ */
386
+ extensions?: Record<string, unknown>;
387
+ }
388
+ type WatchFragmentOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables> = ApolloCache.WatchFragmentOptions<TData, TVariables>;
389
+ type WatchFragmentResult<TData = unknown> = ApolloCache.WatchFragmentResult<TData>;
71
390
  /**
72
- * If `true`, Apollo Client will assume results read from the cache are never mutated by application code, which enables substantial performance optimizations.
73
- *
74
- * @defaultValue `false`
391
+ * Watched query options.
75
392
  */
76
- assumeImmutableResults?: boolean;
77
- localState?: LocalState;
78
- /**
79
- *
80
- */
81
- clientAwareness?: ClientAwarenessLink.ClientAwarenessOptions;
82
- /**
83
- *
84
- */
85
- enhancedClientAwareness?: ClientAwarenessLink.EnhancedClientAwarenessOptions;
86
- documentTransform?: DocumentTransform;
87
- /**
88
- * Configuration used by the [Apollo Client Devtools extension](https://www.apollographql.com/docs/react/development-testing/developer-tooling/#apollo-client-devtools) for this client.
89
- *
90
- * @since 3.11.0
91
- */
92
- devtools?: DevtoolsOptions;
93
- /**
94
- * Determines if data masking is enabled for the client.
95
- *
96
- * @defaultValue false
97
- */
98
- dataMasking?: boolean;
99
- /**
100
- * Determines the strategy used to parse incremental chunks from `@defer`
101
- * queries.
102
- */
103
- incrementalHandler?: Incremental.Handler<any>;
393
+ type WatchQueryOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables> = {
394
+ /**
395
+ * 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).
396
+ *
397
+ * For details, see [Setting a fetch policy](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy).
398
+ *
399
+ * The default value is `cache-first`.
400
+ *
401
+ * @docGroup
402
+ *
403
+ * 3. Caching options
404
+ */
405
+ fetchPolicy?: WatchQueryFetchPolicy;
406
+ /**
407
+ * Specifies the `FetchPolicy` to be used after this query has completed.
408
+ *
409
+ * @docGroup
410
+ *
411
+ * 3. Caching options
412
+ */
413
+ nextFetchPolicy?: WatchQueryFetchPolicy | ((this: WatchQueryOptions<TData, TVariables>, currentFetchPolicy: WatchQueryFetchPolicy, context: NextFetchPolicyContext<TData, TVariables>) => WatchQueryFetchPolicy);
414
+ /**
415
+ * 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).
416
+ *
417
+ * @docGroup
418
+ *
419
+ * 3. Caching options
420
+ */
421
+ initialFetchPolicy?: WatchQueryFetchPolicy;
422
+ /**
423
+ * 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.
424
+ *
425
+ * @docGroup
426
+ *
427
+ * 3. Caching options
428
+ */
429
+ refetchWritePolicy?: RefetchWritePolicy;
430
+ /**
431
+ * Specifies how the query handles a response that returns both GraphQL errors and partial results.
432
+ *
433
+ * For details, see [GraphQL error policies](https://www.apollographql.com/docs/react/data/error-handling/#graphql-error-policies).
434
+ *
435
+ * The default value is `none`, meaning that the query result includes error details but not partial results.
436
+ *
437
+ * @docGroup
438
+ *
439
+ * 1. Operation options
440
+ */
441
+ errorPolicy?: ErrorPolicy;
442
+ /**
443
+ * 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.
444
+ *
445
+ * @docGroup
446
+ *
447
+ * 2. Networking options
448
+ */
449
+ context?: DefaultContext;
450
+ /**
451
+ * Specifies the interval (in milliseconds) at which the query polls for updated results.
452
+ *
453
+ * The default value is `0` (no polling).
454
+ *
455
+ * @docGroup
456
+ *
457
+ * 2. Networking options
458
+ */
459
+ pollInterval?: number;
460
+ /**
461
+ * If `true`, the in-progress query's associated component re-renders whenever the network status changes or a network error occurs.
462
+ *
463
+ * The default value is `true`.
464
+ *
465
+ * @docGroup
466
+ *
467
+ * 2. Networking options
468
+ */
469
+ notifyOnNetworkStatusChange?: boolean;
470
+ /**
471
+ * If `true`, the query can return partial results from the cache if the cache doesn't contain results for all queried fields.
472
+ *
473
+ * The default value is `false`.
474
+ *
475
+ * @docGroup
476
+ *
477
+ * 3. Caching options
478
+ */
479
+ returnPartialData?: boolean;
480
+ /**
481
+ * 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.
482
+ *
483
+ * @docGroup
484
+ *
485
+ * 2. Networking options
486
+ */
487
+ skipPollAttempt?: () => boolean;
488
+ /**
489
+ * A GraphQL query string parsed into an AST with the gql template literal.
490
+ *
491
+ * @docGroup
492
+ *
493
+ * 1. Operation options
494
+ */
495
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>;
496
+ } & VariablesOption<NoInfer<TVariables>>;
497
+ namespace Base {
498
+ interface ReadQueryOptions<TData, TVariables extends OperationVariables> {
499
+ /**
500
+ * The GraphQL query shape to be used constructed using the `gql` template
501
+ * string tag. The query will be used to determine the
502
+ * shape of the data to be read.
503
+ */
504
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>;
505
+ /**
506
+ * The root id to be used. Defaults to "ROOT_QUERY", which is the ID of the
507
+ * root query object. This property makes `readQuery` capable of reading data
508
+ * from any object in the cache.
509
+ */
510
+ id?: string;
511
+ /**
512
+ * Whether to return incomplete data rather than null.
513
+ * @defaultValue false
514
+ */
515
+ returnPartialData?: boolean;
516
+ /**
517
+ * Whether to read from optimistic or non-optimistic cache data.
518
+ * This option should be preferred over the `optimistic` parameter of the
519
+ * `readQuery` method.
520
+ * @defaultValue false
521
+ */
522
+ optimistic?: boolean;
523
+ }
524
+ }
525
+ type ReadQueryOptions<TData, TVariables extends OperationVariables> = Base.ReadQueryOptions<TData, TVariables> & VariablesOption<TVariables>;
526
+ namespace DocumentationTypes {
527
+ interface ReadQueryOptions<TData, TVariables extends OperationVariables> extends Base.ReadQueryOptions<TData, TVariables> {
528
+ /**
529
+ * Any variables that the GraphQL query may depend on.
530
+ */
531
+ variables?: TVariables;
532
+ }
533
+ }
534
+ namespace Base {
535
+ interface ReadFragmentOptions<TData, TVariables extends OperationVariables> {
536
+ /**
537
+ * The root id to be used. This id should take the same form as the
538
+ * value returned by the `cache.identify` function. If a value with your
539
+ * id does not exist in the store, `null` will be returned.
540
+ */
541
+ id?: string;
542
+ /**
543
+ * A GraphQL document created using the `gql` template string tag
544
+ * with one or more fragments which will be used to determine
545
+ * the shape of data to read. If you provide more than one fragment in this
546
+ * document then you must also specify `fragmentName` to specify which
547
+ * fragment is the root fragment.
548
+ */
549
+ fragment: DocumentNode | TypedDocumentNode<TData, TVariables>;
550
+ /**
551
+ * The name of the fragment in your GraphQL document to be used. If you do
552
+ * not provide a `fragmentName` and there is only one fragment in your
553
+ * `fragment` document then that fragment will be used.
554
+ */
555
+ fragmentName?: string;
556
+ /**
557
+ * Whether to return incomplete data rather than null.
558
+ * @defaultValue false
559
+ */
560
+ returnPartialData?: boolean;
561
+ /**
562
+ * Whether to read from optimistic or non-optimistic cache data.
563
+ * This option should be preferred over the `optimistic` parameter of the
564
+ * `readFragment` method.
565
+ * @defaultValue false
566
+ */
567
+ optimistic?: boolean;
568
+ }
569
+ }
570
+ type ReadFragmentOptions<TData, TVariables extends OperationVariables> = Base.ReadFragmentOptions<TData, TVariables> & VariablesOption<TVariables>;
571
+ namespace DocumentationTypes {
572
+ interface WriteQueryOptions<TData, TVariables extends OperationVariables> extends Base.WriteQueryOptions<TData, TVariables> {
573
+ /**
574
+ * Any variables that your GraphQL fragments depend on.
575
+ */
576
+ variables?: TVariables;
577
+ }
578
+ }
579
+ namespace Base {
580
+ interface WriteQueryOptions<TData, TVariables extends OperationVariables> {
581
+ /**
582
+ * The GraphQL query shape to be used constructed using the `gql` template
583
+ * string tag. The query will be used to determine the
584
+ * shape of the data to be read.
585
+ */
586
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>;
587
+ /**
588
+ * The root id to be used. Defaults to "ROOT_QUERY", which is the ID of the
589
+ * root query object. This property makes writeQuery capable of writing data
590
+ * to any object in the cache.
591
+ */
592
+ id?: string;
593
+ /**
594
+ * The data to write to the store.
595
+ */
596
+ data: Unmasked<TData>;
597
+ /**
598
+ * Whether to notify query watchers.
599
+ * @defaultValue true
600
+ */
601
+ broadcast?: boolean;
602
+ /**
603
+ * When true, ignore existing field data rather than merging it with
604
+ * incoming data.
605
+ * @defaultValue false
606
+ */
607
+ overwrite?: boolean;
608
+ }
609
+ }
610
+ type WriteQueryOptions<TData, TVariables extends OperationVariables> = Base.WriteQueryOptions<TData, TVariables> & VariablesOption<TVariables>;
611
+ namespace DocumentationTypes {
612
+ interface WriteQueryOptions<TData, TVariables extends OperationVariables> extends Base.WriteQueryOptions<TData, TVariables> {
613
+ /**
614
+ * Any variables that the GraphQL query may depend on.
615
+ */
616
+ variables?: TVariables;
617
+ }
618
+ }
619
+ namespace Base {
620
+ interface WriteFragmentOptions<TData, TVariables extends OperationVariables> {
621
+ /**
622
+ * The root id to be used. This id should take the same form as the
623
+ * value returned by the `cache.identify` function. If a value with your
624
+ * id does not exist in the store, `null` will be returned.
625
+ */
626
+ id?: string;
627
+ /**
628
+ * A GraphQL document created using the `gql` template string tag from
629
+ * `graphql-tag` with one or more fragments which will be used to determine
630
+ * the shape of data to read. If you provide more than one fragment in this
631
+ * document then you must also specify `fragmentName` to specify which
632
+ * fragment is the root fragment.
633
+ */
634
+ fragment: DocumentNode | TypedDocumentNode<TData, TVariables>;
635
+ /**
636
+ * The name of the fragment in your GraphQL document to be used. If you do
637
+ * not provide a `fragmentName` and there is only one fragment in your
638
+ * `fragment` document then that fragment will be used.
639
+ */
640
+ fragmentName?: string;
641
+ /**
642
+ * The data to write to the store.
643
+ */
644
+ data: Unmasked<TData>;
645
+ /**
646
+ * Whether to notify query watchers.
647
+ * @defaultValue true
648
+ */
649
+ broadcast?: boolean;
650
+ /**
651
+ * When true, ignore existing field data rather than merging it with
652
+ * incoming data.
653
+ * @defaultValue false
654
+ */
655
+ overwrite?: boolean;
656
+ }
657
+ }
658
+ type WriteFragmentOptions<TData, TVariables extends OperationVariables> = Base.WriteFragmentOptions<TData, TVariables> & VariablesOption<TVariables>;
659
+ namespace DocumentationTypes {
660
+ interface WriteFragmentOptions<TData, TVariables extends OperationVariables> extends Base.WriteFragmentOptions<TData, TVariables> {
661
+ /**
662
+ * Any variables that your GraphQL fragments depend on.
663
+ */
664
+ variables?: TVariables;
665
+ }
666
+ }
104
667
  }
105
668
  /**
106
669
  * This is the primary Apollo Client class. It is used to send GraphQL documents (i.e. queries
@@ -108,7 +671,7 @@ export interface ApolloClientOptions {
108
671
  * receive results from the server and cache the results in a store. It also delivers updates
109
672
  * to GraphQL queries through `Observable` instances.
110
673
  */
111
- export declare class ApolloClient implements DataProxy {
674
+ export declare class ApolloClient {
112
675
  link: ApolloLink;
113
676
  cache: ApolloCache;
114
677
  /**
@@ -126,8 +689,8 @@ export declare class ApolloClient implements DataProxy {
126
689
  get prioritizeCacheValues(): boolean;
127
690
  version: string;
128
691
  queryDeduplication: boolean;
129
- defaultOptions: DefaultOptions;
130
- readonly devtoolsConfig: DevtoolsOptions;
692
+ defaultOptions: ApolloClient.DefaultOptions;
693
+ readonly devtoolsConfig: ApolloClient.DevtoolsOptions;
131
694
  private queryManager;
132
695
  private devToolsHookCb?;
133
696
  private resetStoreCallbacks;
@@ -136,29 +699,30 @@ export declare class ApolloClient implements DataProxy {
136
699
  * Constructs an instance of `ApolloClient`.
137
700
  *
138
701
  * @example
702
+ *
139
703
  * ```js
140
- * import { ApolloClient, InMemoryCache } from '@apollo/client';
704
+ * import { ApolloClient, InMemoryCache } from "@apollo/client";
141
705
  *
142
706
  * const cache = new InMemoryCache();
143
707
  *
144
708
  * const client = new ApolloClient({
145
709
  * // Provide required constructor fields
146
710
  * cache: cache,
147
- * uri: 'http://localhost:4000/',
711
+ * uri: "http://localhost:4000/",
148
712
  *
149
713
  * // Provide some optional constructor fields
150
- * name: 'react-web-client',
151
- * version: '1.3',
714
+ * name: "react-web-client",
715
+ * version: "1.3",
152
716
  * queryDeduplication: false,
153
717
  * defaultOptions: {
154
718
  * watchQuery: {
155
- * fetchPolicy: 'cache-and-network',
719
+ * fetchPolicy: "cache-and-network",
156
720
  * },
157
721
  * },
158
722
  * });
159
723
  * ```
160
724
  */
161
- constructor(options: ApolloClientOptions);
725
+ constructor(options: ApolloClient.Options);
162
726
  private connectToDevTools;
163
727
  /**
164
728
  * The `DocumentTransform` used to modify GraphQL documents before a request
@@ -175,6 +739,12 @@ export declare class ApolloClient implements DataProxy {
175
739
  /**
176
740
  * Call this method to terminate any active client processes, making it safe
177
741
  * to dispose of this `ApolloClient` instance.
742
+ *
743
+ * This method performs aggressive cleanup to prevent memory leaks:
744
+ *
745
+ * - Unsubscribes all active `ObservableQuery` instances by emitting a `completed` event
746
+ * - Rejects all currently running queries with "QueryManager stopped while query was in flight"
747
+ * - Removes all queryRefs from the suspense cache
178
748
  */
179
749
  stop(): void;
180
750
  /**
@@ -187,16 +757,16 @@ export declare class ApolloClient implements DataProxy {
187
757
  *
188
758
  * For example, suppose you call watchQuery on a GraphQL query that fetches a person's
189
759
  * first and last name and this person has a particular object identifier, provided by
190
- * dataIdFromObject. Later, a different query fetches that same person's
760
+ * `cache.identify`. Later, a different query fetches that same person's
191
761
  * first and last name and the first name has now changed. Then, any observers associated
192
762
  * with the results of the first query will be updated with a new result object.
193
763
  *
194
- * Note that if the cache does not change, the subscriber will *not* be notified.
764
+ * Note that if the cache does not change, the subscriber will _not_ be notified.
195
765
  *
196
766
  * See [here](https://medium.com/apollo-stack/the-concepts-of-graphql-bc68bd819be3#.3mb0cbcmc) for
197
767
  * a description of store reactivity.
198
768
  */
199
- watchQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: WatchQueryOptions<TVariables, TData>): ObservableQuery<TData, TVariables>;
769
+ watchQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WatchQueryOptions<TData, TVariables>): ObservableQuery<TData, TVariables>;
200
770
  /**
201
771
  * This resolves a single query according to the options specified and
202
772
  * returns a `Promise` which is either resolved with the resulting data
@@ -206,7 +776,7 @@ export declare class ApolloClient implements DataProxy {
206
776
  * describe how this query should be treated e.g. whether it should hit the
207
777
  * server at all or just resolve from the cache, etc.
208
778
  */
209
- query<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: QueryOptions<TVariables, TData>): Promise<QueryResult<MaybeMasked<TData>>>;
779
+ query<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.QueryOptions<TData, TVariables>): Promise<ApolloClient.QueryResult<MaybeMasked<TData>>>;
210
780
  /**
211
781
  * This resolves a single mutation according to the options specified and returns a
212
782
  * Promise which is either resolved with the resulting data or rejected with an
@@ -215,22 +785,37 @@ export declare class ApolloClient implements DataProxy {
215
785
  *
216
786
  * It takes options as an object with the following keys and values:
217
787
  */
218
- mutate<TData = unknown, TVariables extends OperationVariables = OperationVariables, TCache extends ApolloCache = ApolloCache>(options: MutationOptions<TData, TVariables, TCache>): Promise<MutateResult<MaybeMasked<TData>>>;
788
+ mutate<TData = unknown, TVariables extends OperationVariables = OperationVariables, TCache extends ApolloCache = ApolloCache>(options: ApolloClient.MutateOptions<TData, TVariables, TCache>): Promise<ApolloClient.MutateResult<MaybeMasked<TData>>>;
219
789
  /**
220
790
  * This subscribes to a graphql subscription according to the options specified and returns an
221
791
  * `Observable` which either emits received data or an error.
222
792
  */
223
- subscribe<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: SubscriptionOptions<TVariables, TData>): SubscriptionObservable<SubscribeResult<MaybeMasked<TData>>>;
793
+ subscribe<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.SubscribeOptions<TData, TVariables>): SubscriptionObservable<ApolloClient.SubscribeResult<MaybeMasked<TData>>>;
224
794
  /**
225
795
  * Tries to read some data from the store in the shape of the provided
226
796
  * GraphQL query without making a network request. This method will start at
227
- * the root query. To start at a specific id returned by `dataIdFromObject`
797
+ * the root query. To start at a specific id returned by `cache.identify`
228
798
  * use `readFragment`.
229
799
  *
230
800
  * @param optimistic - Set to `true` to allow `readQuery` to return
231
801
  * optimistic results. Is `false` by default.
232
802
  */
233
- readQuery<TData = unknown, TVariables = OperationVariables>(options: DataProxy.Query<TVariables, TData>, optimistic?: boolean): Unmasked<TData> | null;
803
+ readQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.ReadQueryOptions<TData, TVariables>): Unmasked<TData> | null;
804
+ /**
805
+ * Tries to read some data from the store in the shape of the provided GraphQL query without making a network request. This method will start at the root query. To start at a specific id returned by `cache.identify` use `readFragment`.
806
+ *
807
+ * @param optimistic - Set to `true` to allow `readQuery` to return optimistic results. Is `false` by default.
808
+ *
809
+ *
810
+ * @deprecated Pass the `optimistic` argument as part of the first argument
811
+ * instead of passing it as a separate option.
812
+ */
813
+ readQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.ReadQueryOptions<TData, TVariables>,
814
+ /**
815
+ * @deprecated Pass the `optimistic` argument as part of the first argument
816
+ * instead of passing it as a separate option.
817
+ */
818
+ optimistic: boolean): Unmasked<TData> | null;
234
819
  /**
235
820
  * Watches the cache store of the fragment according to the options specified
236
821
  * and returns an `Observable`. We can subscribe to this
@@ -247,7 +832,7 @@ export declare class ApolloClient implements DataProxy {
247
832
  * the cache to identify the fragment and optionally specify whether to react
248
833
  * to optimistic updates.
249
834
  */
250
- watchFragment<TData = unknown, TVariables = OperationVariables>(options: WatchFragmentOptions<TData, TVariables>): Observable<WatchFragmentResult<TData>>;
835
+ watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WatchFragmentOptions<TData, TVariables>): Observable<ApolloClient.WatchFragmentResult<MaybeMasked<TData>>>;
251
836
  /**
252
837
  * Tries to read some data from the store in the shape of the provided
253
838
  * GraphQL fragment without making a network request. This method will read a
@@ -262,13 +847,25 @@ export declare class ApolloClient implements DataProxy {
262
847
  * @param optimistic - Set to `true` to allow `readFragment` to return
263
848
  * optimistic results. Is `false` by default.
264
849
  */
265
- readFragment<T = unknown, TVariables = OperationVariables>(options: DataProxy.Fragment<TVariables, T>, optimistic?: boolean): Unmasked<T> | null;
850
+ readFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.ReadFragmentOptions<TData, TVariables>): Unmasked<TData> | null;
851
+ /**
852
+ * Tries to read some data from the store in the shape of the provided GraphQL fragment without making a network request. This method will read a GraphQL fragment from any arbitrary id that is currently cached, unlike `readQuery` which will only read from the root query.
853
+ *
854
+ * You must pass in a GraphQL document with a single fragment or a document with multiple fragments that represent what you are reading. If you pass in a document with multiple fragments then you must also specify a `fragmentName`.
855
+ *
856
+ * @param optimistic - Set to `true` to allow `readFragment` to return optimistic results. Is `false` by default.
857
+ *
858
+ *
859
+ * @deprecated Pass the `optimistic` argument as part of the first argument
860
+ * instead of passing it as a separate option.
861
+ */
862
+ readFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.ReadFragmentOptions<TData, TVariables>, optimistic: boolean): Unmasked<TData> | null;
266
863
  /**
267
864
  * Writes some data in the shape of the provided GraphQL query directly to
268
865
  * the store. This method will start at the root query. To start at a
269
- * specific id returned by `dataIdFromObject` then use `writeFragment`.
866
+ * specific id returned by `cache.identify` then use `writeFragment`.
270
867
  */
271
- writeQuery<TData = unknown, TVariables = OperationVariables>(options: DataProxy.WriteQueryOptions<TData, TVariables>): Reference | undefined;
868
+ writeQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WriteQueryOptions<TData, TVariables>): Reference | undefined;
272
869
  /**
273
870
  * Writes some data in the shape of the provided GraphQL fragment directly to
274
871
  * the store. This method will write to a GraphQL fragment from any arbitrary
@@ -280,7 +877,7 @@ export declare class ApolloClient implements DataProxy {
280
877
  * in a document with multiple fragments then you must also specify a
281
878
  * `fragmentName`.
282
879
  */
283
- writeFragment<TData = unknown, TVariables = OperationVariables>(options: DataProxy.WriteFragmentOptions<TData, TVariables>): Reference | undefined;
880
+ writeFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WriteFragmentOptions<TData, TVariables>): Reference | undefined;
284
881
  __actionHookForDevTools(cb: () => any): void;
285
882
  __requestRaw(payload: GraphQLRequest): Observable<FetchResult<unknown>>;
286
883
  /**
@@ -293,13 +890,13 @@ export declare class ApolloClient implements DataProxy {
293
890
  * user session, and you now want to make sure that any references to data you
294
891
  * might have fetched while the user session was active is gone.
295
892
  *
296
- * It is important to remember that `resetStore()` *will* refetch any active
893
+ * It is important to remember that `resetStore()` _will_ refetch any active
297
894
  * queries. This means that any components that might be mounted will execute
298
895
  * their queries again using your network interface. If you do not want to
299
896
  * re-execute any queries then you should make sure to stop watching any
300
897
  * active queries.
301
898
  */
302
- resetStore(): Promise<QueryResult<any>[] | null>;
899
+ resetStore(): Promise<ApolloClient.QueryResult<any>[] | null>;
303
900
  /**
304
901
  * Remove all data from the store. Unlike `resetStore`, `clearStore` will
305
902
  * not refetch any active queries.
@@ -322,44 +919,47 @@ export declare class ApolloClient implements DataProxy {
322
919
  *
323
920
  * `reFetchObservableQueries()` is useful if you want to bring the client back to proper state in case of a network outage
324
921
  *
325
- * It is important to remember that `reFetchObservableQueries()` *will* refetch any active
922
+ * It is important to remember that `reFetchObservableQueries()` _will_ refetch any active
326
923
  * queries. This means that any components that might be mounted will execute
327
924
  * their queries again using your network interface. If you do not want to
328
925
  * re-execute any queries then you should make sure to stop watching any
329
926
  * active queries.
330
927
  * Takes optional parameter `includeStandby` which will include queries in standby-mode when refetching.
331
928
  *
929
+ * Note: `cache-only` queries are not refetched by this function.
930
+ *
332
931
  * @deprecated Please use `refetchObservableQueries` instead.
333
932
  */
334
- reFetchObservableQueries: (includeStandby?: boolean) => Promise<QueryResult<any>[]>;
933
+ reFetchObservableQueries: (includeStandby?: boolean) => Promise<ApolloClient.QueryResult<any>[]>;
335
934
  /**
336
935
  * Refetches all of your active queries.
337
936
  *
338
937
  * `refetchObservableQueries()` is useful if you want to bring the client back to proper state in case of a network outage
339
938
  *
340
- * It is important to remember that `refetchObservableQueries()` *will* refetch any active
939
+ * It is important to remember that `refetchObservableQueries()` _will_ refetch any active
341
940
  * queries. This means that any components that might be mounted will execute
342
941
  * their queries again using your network interface. If you do not want to
343
942
  * re-execute any queries then you should make sure to stop watching any
344
943
  * active queries.
345
944
  * Takes optional parameter `includeStandby` which will include queries in standby-mode when refetching.
945
+ *
946
+ * Note: `cache-only` queries are not refetched by this function.
346
947
  */
347
- refetchObservableQueries(includeStandby?: boolean): Promise<QueryResult<any>[]>;
948
+ refetchObservableQueries(includeStandby?: boolean): Promise<ApolloClient.QueryResult<any>[]>;
348
949
  /**
349
950
  * Refetches specified active queries. Similar to "refetchObservableQueries()" but with a specific list of queries.
350
951
  *
351
952
  * `refetchQueries()` is useful for use cases to imperatively refresh a selection of queries.
352
953
  *
353
- * It is important to remember that `refetchQueries()` *will* refetch specified active
954
+ * It is important to remember that `refetchQueries()` _will_ refetch specified active
354
955
  * queries. This means that any components that might be mounted will execute
355
956
  * their queries again using your network interface. If you do not want to
356
957
  * re-execute any queries then you should make sure to stop watching any
357
958
  * active queries.
358
959
  */
359
- refetchQueries<TCache extends ApolloCache = ApolloCache, TResult = Promise<QueryResult<any>>>(options: RefetchQueriesOptions<TCache, TResult>): RefetchQueriesResult<TResult>;
960
+ refetchQueries<TCache extends ApolloCache = ApolloCache, TResult = Promise<ApolloClient.QueryResult<any>>>(options: ApolloClient.RefetchQueriesOptions<TCache, TResult>): ApolloClient.RefetchQueriesResult<TResult>;
360
961
  /**
361
- * Get all currently active `ObservableQuery` objects, in a `Map` keyed by
362
- * query ID strings.
962
+ * Get all currently active `ObservableQuery` objects, in a `Set`.
363
963
  *
364
964
  * An "active" query is one that has observers and a `fetchPolicy` other than
365
965
  * "standby" or "cache-only".
@@ -367,6 +967,9 @@ export declare class ApolloClient implements DataProxy {
367
967
  * You can include all `ObservableQuery` objects (including the inactive ones)
368
968
  * by passing "all" instead of "active", or you can include just a subset of
369
969
  * active queries by passing an array of query names or DocumentNode objects.
970
+ *
971
+ * Note: This method only returns queries that have active subscribers. Queries
972
+ * without subscribers are not tracked by the client.
370
973
  */
371
974
  getObservableQueries(include?: RefetchQueriesInclude): Set<ObservableQuery<any>>;
372
975
  /**
@@ -386,6 +989,8 @@ export declare class ApolloClient implements DataProxy {
386
989
  */
387
990
  setLink(newLink: ApolloLink): void;
388
991
  get defaultContext(): Partial<DefaultContext>;
992
+ private maskedFragmentTransform;
993
+ private transform;
389
994
  /**
390
995
  * @experimental
391
996
  * This is not a stable API - it is used in development builds to expose
@@ -394,77 +999,79 @@ export declare class ApolloClient implements DataProxy {
394
999
  * For more details, see [Memory Management](https://www.apollographql.com/docs/react/caching/memory-management/#measuring-cache-usage)
395
1000
  *
396
1001
  * @example
1002
+ *
397
1003
  * ```ts
398
- * console.log(client.getMemoryInternals())
1004
+ * console.log(client.getMemoryInternals());
399
1005
  * ```
1006
+ *
400
1007
  * Logs output in the following JSON format:
401
1008
  * @example
1009
+ *
402
1010
  * ```json
403
- *{
404
- * limits: {
405
- * canonicalStringify: 1000,
406
- * print: 2000,
407
- * 'documentTransform.cache': 2000,
408
- * 'queryManager.getDocumentInfo': 2000,
409
- * 'PersistedQueryLink.persistedQueryHashes': 2000,
410
- * 'fragmentRegistry.transform': 2000,
411
- * 'fragmentRegistry.lookup': 1000,
412
- * 'fragmentRegistry.findFragmentSpreads': 4000,
413
- * 'cache.fragmentQueryDocuments': 1000,
414
- * 'removeTypenameFromVariables.getVariableDefinitions': 2000,
415
- * 'inMemoryCache.maybeBroadcastWatch': 5000,
416
- * 'inMemoryCache.executeSelectionSet': 10000,
417
- * 'inMemoryCache.executeSubSelectedArray': 5000
418
- * },
419
- * sizes: {
420
- * canonicalStringify: 4,
421
- * print: 14,
422
- * addTypenameDocumentTransform: [
423
- * {
424
- * cache: 14,
425
- * },
426
- * ],
427
- * queryManager: {
428
- * getDocumentInfo: 14,
429
- * documentTransforms: [
430
- * {
431
- * cache: 14,
432
- * },
433
- * {
434
- * cache: 14,
435
- * },
436
- * ],
437
- * },
438
- * fragmentRegistry: {
439
- * findFragmentSpreads: 34,
440
- * lookup: 20,
441
- * transform: 14,
442
- * },
443
- * cache: {
444
- * fragmentQueryDocuments: 22,
445
- * },
446
- * inMemoryCache: {
447
- * executeSelectionSet: 4345,
448
- * executeSubSelectedArray: 1206,
449
- * maybeBroadcastWatch: 32,
450
- * },
451
- * links: [
452
- * {
453
- * PersistedQueryLink: {
454
- * persistedQueryHashes: 14,
455
- * },
456
- * },
457
- * {
458
- * removeTypenameFromVariables: {
459
- * getVariableDefinitions: 14,
460
- * },
461
- * },
462
- * ],
463
- * },
1011
+ * {
1012
+ * "limits": {
1013
+ * "canonicalStringify": 1000,
1014
+ * "print": 2000,
1015
+ * "documentTransform.cache": 2000,
1016
+ * "queryManager.getDocumentInfo": 2000,
1017
+ * "PersistedQueryLink.persistedQueryHashes": 2000,
1018
+ * "fragmentRegistry.transform": 2000,
1019
+ * "fragmentRegistry.lookup": 1000,
1020
+ * "fragmentRegistry.findFragmentSpreads": 4000,
1021
+ * "cache.fragmentQueryDocuments": 1000,
1022
+ * "removeTypenameFromVariables.getVariableDefinitions": 2000,
1023
+ * "inMemoryCache.maybeBroadcastWatch": 5000,
1024
+ * "inMemoryCache.executeSelectionSet": 10000,
1025
+ * "inMemoryCache.executeSubSelectedArray": 5000
1026
+ * },
1027
+ * "sizes": {
1028
+ * "canonicalStringify": 4,
1029
+ * "print": 14,
1030
+ * "addTypenameDocumentTransform": [
1031
+ * {
1032
+ * "cache": 14
1033
+ * }
1034
+ * ],
1035
+ * "queryManager": {
1036
+ * "getDocumentInfo": 14,
1037
+ * "documentTransforms": [
1038
+ * {
1039
+ * "cache": 14
1040
+ * },
1041
+ * {
1042
+ * "cache": 14
1043
+ * }
1044
+ * ]
1045
+ * },
1046
+ * "fragmentRegistry": {
1047
+ * "findFragmentSpreads": 34,
1048
+ * "lookup": 20,
1049
+ * "transform": 14
1050
+ * },
1051
+ * "cache": {
1052
+ * "fragmentQueryDocuments": 22
1053
+ * },
1054
+ * "inMemoryCache": {
1055
+ * "executeSelectionSet": 4345,
1056
+ * "executeSubSelectedArray": 1206,
1057
+ * "maybeBroadcastWatch": 32
1058
+ * },
1059
+ * "links": [
1060
+ * {
1061
+ * "PersistedQueryLink": {
1062
+ * "persistedQueryHashes": 14
1063
+ * }
1064
+ * },
1065
+ * {
1066
+ * "removeTypenameFromVariables": {
1067
+ * "getVariableDefinitions": 14
1068
+ * }
1069
+ * }
1070
+ * ]
1071
+ * }
464
1072
  * }
465
- *```
1073
+ * ```
466
1074
  */
467
1075
  getMemoryInternals?: typeof getApolloClientMemoryInternals;
468
1076
  }
469
- export {};
470
1077
  //# sourceMappingURL=ApolloClient.d.ts.map