@apollo/client 4.0.0-alpha.6 → 4.0.0-alpha.8

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 (609) hide show
  1. package/.changeset/afraid-moons-arrive.md +5 -0
  2. package/.changeset/beige-mirrors-talk.md +15 -0
  3. package/.changeset/dirty-eagles-poke.md +5 -0
  4. package/.changeset/early-eggs-develop.md +22 -0
  5. package/.changeset/giant-apes-thank.md +5 -0
  6. package/.changeset/nice-dots-matter.md +5 -0
  7. package/.changeset/ninety-bags-bake.md +17 -0
  8. package/.changeset/perfect-vans-give.md +7 -0
  9. package/.changeset/pre.json +13 -0
  10. package/.changeset/purple-bears-flash.md +5 -0
  11. package/.changeset/shaggy-pugs-add.md +52 -0
  12. package/.changeset/short-months-complain.md +5 -0
  13. package/.changeset/swift-rivers-share.md +13 -0
  14. package/.changeset/wicked-forks-double.md +33 -0
  15. package/CHANGELOG.md +178 -0
  16. package/__cjs/cache/core/cache.cjs +1 -1
  17. package/__cjs/cache/core/cache.cjs.map +1 -1
  18. package/__cjs/cache/core/cache.d.cts +1 -1
  19. package/__cjs/cache/core/types/Cache.cjs.map +1 -1
  20. package/__cjs/cache/core/types/Cache.d.cts +1 -1
  21. package/__cjs/cache/core/types/DataProxy.d.cts +1 -1
  22. package/__cjs/cache/core/types/common.cjs +1 -0
  23. package/__cjs/cache/core/types/common.cjs.map +1 -1
  24. package/__cjs/cache/index.cjs +4 -4
  25. package/__cjs/cache/index.cjs.map +1 -1
  26. package/__cjs/cache/index.d.cts +3 -3
  27. package/__cjs/cache/inmemory/entityStore.cjs +7 -4
  28. package/__cjs/cache/inmemory/entityStore.cjs.map +1 -1
  29. package/__cjs/cache/inmemory/entityStore.d.cts +1 -0
  30. package/__cjs/cache/inmemory/fragmentRegistry.cjs.map +1 -1
  31. package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
  32. package/__cjs/cache/inmemory/inMemoryCache.d.cts +1 -1
  33. package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
  34. package/__cjs/cache/inmemory/policies.cjs +4 -4
  35. package/__cjs/cache/inmemory/reactiveVars.cjs.map +1 -1
  36. package/__cjs/cache/inmemory/reactiveVars.d.cts +1 -1
  37. package/__cjs/cache/inmemory/readFromStore.cjs +2 -2
  38. package/__cjs/cache/inmemory/readFromStore.cjs.map +1 -1
  39. package/__cjs/cache/inmemory/types.d.cts +1 -1
  40. package/__cjs/cache/inmemory/writeToStore.cjs +4 -4
  41. package/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
  42. package/__cjs/cache/inmemory/writeToStore.d.cts +1 -1
  43. package/__cjs/config/jest/areCombinedGraphQLErrorsEqual.cjs +2 -3
  44. package/__cjs/config/jest/areCombinedGraphQLErrorsEqual.cjs.map +1 -1
  45. package/__cjs/config/jest/areCombinedProtocolErrorsEqual.cjs +2 -3
  46. package/__cjs/config/jest/areCombinedProtocolErrorsEqual.cjs.map +1 -1
  47. package/__cjs/config/jest/areMissingFieldErrorsEqual.cjs +2 -3
  48. package/__cjs/config/jest/areMissingFieldErrorsEqual.cjs.map +1 -1
  49. package/__cjs/config/jest/areServerErrorsEqual.cjs +21 -0
  50. package/__cjs/config/jest/areServerErrorsEqual.cjs.map +1 -0
  51. package/__cjs/config/jest/areServerErrorsEqual.d.cts +3 -0
  52. package/__cjs/config/jest/resolver.cjs +11 -0
  53. package/__cjs/config/jest/resolver.cjs.map +1 -1
  54. package/__cjs/config/jest/setup.cjs +12 -1
  55. package/__cjs/config/jest/setup.cjs.map +1 -1
  56. package/__cjs/core/ApolloClient.cjs +7 -9
  57. package/__cjs/core/ApolloClient.cjs.map +1 -1
  58. package/__cjs/core/ApolloClient.d.cts +0 -2
  59. package/__cjs/core/LocalState.cjs +2 -2
  60. package/__cjs/core/ObservableQuery.cjs +105 -38
  61. package/__cjs/core/ObservableQuery.cjs.map +1 -1
  62. package/__cjs/core/ObservableQuery.d.cts +18 -1
  63. package/__cjs/core/QueryInfo.cjs +4 -78
  64. package/__cjs/core/QueryInfo.cjs.map +1 -1
  65. package/__cjs/core/QueryInfo.d.cts +0 -10
  66. package/__cjs/core/QueryManager.cjs +34 -53
  67. package/__cjs/core/QueryManager.cjs.map +1 -1
  68. package/__cjs/core/QueryManager.d.cts +3 -3
  69. package/__cjs/core/index.cjs +41 -21
  70. package/__cjs/core/index.cjs.map +1 -1
  71. package/__cjs/core/index.d.cts +13 -11
  72. package/__cjs/errors/CombinedGraphQLErrors.cjs.map +1 -1
  73. package/__cjs/errors/CombinedGraphQLErrors.d.cts +1 -1
  74. package/__cjs/errors/index.cjs +21 -2
  75. package/__cjs/errors/index.cjs.map +1 -1
  76. package/__cjs/errors/index.d.cts +2 -0
  77. package/__cjs/invariantErrorCodes.cjs +95 -119
  78. package/__cjs/link/batch/index.cjs +4 -2
  79. package/__cjs/link/batch/index.cjs.map +1 -1
  80. package/__cjs/link/batch/index.d.cts +2 -1
  81. package/__cjs/link/batch-http/index.cjs +3 -2
  82. package/__cjs/link/batch-http/index.cjs.map +1 -1
  83. package/__cjs/link/batch-http/index.d.cts +1 -1
  84. package/__cjs/link/context/index.cjs.map +1 -1
  85. package/__cjs/link/context/index.d.cts +1 -1
  86. package/__cjs/link/core/ApolloLink.cjs +2 -20
  87. package/__cjs/link/core/ApolloLink.cjs.map +1 -1
  88. package/__cjs/link/core/ApolloLink.d.cts +1 -3
  89. package/__cjs/link/core/index.cjs.map +1 -1
  90. package/__cjs/link/core/index.d.cts +1 -1
  91. package/__cjs/link/core/types.d.cts +1 -1
  92. package/__cjs/link/error/index.cjs +13 -28
  93. package/__cjs/link/error/index.cjs.map +1 -1
  94. package/__cjs/link/error/index.d.cts +4 -15
  95. package/__cjs/link/http/checkFetcher.cjs +1 -1
  96. package/__cjs/link/http/createHttpLink.cjs +1 -1
  97. package/__cjs/link/http/parseAndCheckHttpResponse.cjs +1 -1
  98. package/__cjs/link/http/serializeFetchParameter.cjs +1 -1
  99. package/__cjs/link/persisted-queries/index.cjs +2 -2
  100. package/__cjs/link/persisted-queries/index.cjs.map +1 -1
  101. package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs.map +1 -1
  102. package/__cjs/link/retry/index.cjs +3 -2
  103. package/__cjs/link/retry/index.cjs.map +1 -1
  104. package/__cjs/link/retry/index.d.cts +1 -1
  105. package/__cjs/link/utils/validateOperation.cjs +1 -1
  106. package/__cjs/masking/maskDefinition.cjs +2 -2
  107. package/__cjs/masking/maskFragment.cjs +2 -2
  108. package/__cjs/masking/maskFragment.cjs.map +1 -1
  109. package/__cjs/masking/maskFragment.d.cts +1 -1
  110. package/__cjs/masking/maskOperation.cjs +1 -1
  111. package/__cjs/masking/maskOperation.cjs.map +1 -1
  112. package/__cjs/masking/maskOperation.d.cts +1 -1
  113. package/__cjs/masking/utils.cjs +1 -1
  114. package/__cjs/react/context/ApolloConsumer.cjs +1 -1
  115. package/__cjs/react/context/ApolloConsumer.cjs.map +1 -1
  116. package/__cjs/react/context/ApolloConsumer.d.cts +7 -4
  117. package/__cjs/react/context/ApolloContext.cjs +1 -1
  118. package/__cjs/react/context/ApolloContext.cjs.map +1 -1
  119. package/__cjs/react/context/ApolloContext.d.cts +1 -1
  120. package/__cjs/react/context/ApolloProvider.cjs +1 -1
  121. package/__cjs/react/context/ApolloProvider.cjs.map +1 -1
  122. package/__cjs/react/context/ApolloProvider.d.cts +7 -5
  123. package/__cjs/react/hooks/internal/wrapHook.cjs.map +1 -1
  124. package/__cjs/react/hooks/internal/wrapHook.d.cts +3 -3
  125. package/__cjs/react/hooks/useApolloClient.cjs +3 -3
  126. package/__cjs/react/hooks/useApolloClient.cjs.map +1 -1
  127. package/__cjs/react/hooks/useApolloClient.d.cts +1 -1
  128. package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
  129. package/__cjs/react/hooks/useBackgroundQuery.d.cts +2 -2
  130. package/__cjs/react/hooks/useFragment.cjs.map +1 -1
  131. package/__cjs/react/hooks/useFragment.d.cts +1 -1
  132. package/__cjs/react/hooks/useLazyQuery.cjs +4 -4
  133. package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
  134. package/__cjs/react/hooks/useLazyQuery.d.cts +2 -2
  135. package/__cjs/react/hooks/useLoadableQuery.cjs +2 -2
  136. package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
  137. package/__cjs/react/hooks/useLoadableQuery.d.cts +2 -2
  138. package/__cjs/react/hooks/useMutation.cjs +0 -2
  139. package/__cjs/react/hooks/useMutation.cjs.map +1 -1
  140. package/__cjs/react/hooks/useMutation.d.cts +1 -2
  141. package/__cjs/react/hooks/useQuery.cjs +4 -6
  142. package/__cjs/react/hooks/useQuery.cjs.map +1 -1
  143. package/__cjs/react/hooks/useQuery.d.cts +2 -3
  144. package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
  145. package/__cjs/react/hooks/useQueryRefHandlers.d.cts +2 -2
  146. package/__cjs/react/hooks/useReactiveVar.cjs.map +1 -1
  147. package/__cjs/react/hooks/useReactiveVar.d.cts +1 -1
  148. package/__cjs/react/hooks/useReadQuery.cjs.map +1 -1
  149. package/__cjs/react/hooks/useReadQuery.d.cts +1 -1
  150. package/__cjs/react/hooks/useSubscription.cjs +1 -3
  151. package/__cjs/react/hooks/useSubscription.cjs.map +1 -1
  152. package/__cjs/react/hooks/useSubscription.d.cts +1 -1
  153. package/__cjs/react/hooks/useSuspenseFragment.cjs.map +1 -1
  154. package/__cjs/react/hooks/useSuspenseFragment.d.cts +1 -1
  155. package/__cjs/react/hooks/useSuspenseQuery.cjs +5 -7
  156. package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
  157. package/__cjs/react/hooks/useSuspenseQuery.d.cts +3 -3
  158. package/__cjs/react/hooks/useSyncExternalStore.cjs +1 -1
  159. package/__cjs/react/index.cjs +35 -11
  160. package/__cjs/react/index.cjs.map +1 -1
  161. package/__cjs/react/index.d.cts +21 -7
  162. package/__cjs/react/index.react-server.cjs +1 -5
  163. package/__cjs/react/index.react-server.cjs.map +1 -1
  164. package/__cjs/react/index.react-server.d.cts +0 -1
  165. package/__cjs/react/internal/cache/FragmentReference.cjs.map +1 -1
  166. package/__cjs/react/internal/cache/FragmentReference.d.cts +1 -1
  167. package/__cjs/react/internal/cache/QueryReference.cjs +1 -1
  168. package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
  169. package/__cjs/react/internal/cache/QueryReference.d.cts +1 -1
  170. package/__cjs/react/internal/cache/SuspenseCache.cjs.map +1 -1
  171. package/__cjs/react/internal/cache/SuspenseCache.d.cts +1 -1
  172. package/__cjs/react/internal/cache/getSuspenseCache.cjs.map +1 -1
  173. package/__cjs/react/internal/cache/getSuspenseCache.d.cts +2 -2
  174. package/__cjs/react/internal/types.d.cts +1 -1
  175. package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
  176. package/__cjs/react/query-preloader/createQueryPreloader.d.cts +1 -1
  177. package/__cjs/react/ssr/prerenderStatic.cjs +4 -4
  178. package/__cjs/react/ssr/prerenderStatic.cjs.map +1 -1
  179. package/__cjs/react/ssr/prerenderStatic.d.cts +1 -1
  180. package/__cjs/react/ssr/useSSRQuery.cjs.map +1 -1
  181. package/__cjs/react/types/deprecated.d.cts +12 -2
  182. package/__cjs/testing/core/index.cjs +6 -3
  183. package/__cjs/testing/core/index.cjs.map +1 -1
  184. package/__cjs/testing/core/index.d.cts +3 -3
  185. package/__cjs/testing/core/mocking/mockClient.cjs +3 -4
  186. package/__cjs/testing/core/mocking/mockClient.cjs.map +1 -1
  187. package/__cjs/testing/core/mocking/mockClient.d.cts +1 -1
  188. package/__cjs/testing/core/mocking/mockLink.cjs +118 -112
  189. package/__cjs/testing/core/mocking/mockLink.cjs.map +1 -1
  190. package/__cjs/testing/core/mocking/mockLink.d.cts +26 -7
  191. package/__cjs/testing/experimental/createSchemaFetch.cjs +4 -4
  192. package/__cjs/testing/experimental/createSchemaFetch.cjs.map +1 -1
  193. package/__cjs/testing/experimental/createTestSchema.cjs.map +1 -1
  194. package/__cjs/testing/experimental/createTestSchema.d.cts +1 -1
  195. package/__cjs/testing/index.cjs +13 -2
  196. package/__cjs/testing/index.cjs.map +1 -1
  197. package/__cjs/testing/index.d.cts +2 -1
  198. package/__cjs/testing/internal/disposables/spyOnConsole.cjs +0 -1
  199. package/__cjs/testing/internal/disposables/spyOnConsole.cjs.map +1 -1
  200. package/__cjs/testing/internal/disposables/spyOnConsole.d.cts +0 -1
  201. package/__cjs/testing/internal/incremental.cjs.map +1 -1
  202. package/__cjs/testing/internal/incremental.d.cts +1 -1
  203. package/__cjs/testing/internal/index.cjs +12 -8
  204. package/__cjs/testing/internal/index.cjs.map +1 -1
  205. package/__cjs/testing/internal/index.d.cts +3 -3
  206. package/__cjs/testing/internal/renderHelpers.cjs.map +1 -1
  207. package/__cjs/testing/internal/renderHelpers.d.cts +1 -1
  208. package/__cjs/testing/internal/scenarios/index.cjs +9 -7
  209. package/__cjs/testing/internal/scenarios/index.cjs.map +1 -1
  210. package/__cjs/testing/internal/scenarios/index.d.cts +6 -8
  211. package/__cjs/testing/matchers/index.cjs +4 -22
  212. package/__cjs/testing/matchers/index.cjs.map +1 -1
  213. package/__cjs/testing/matchers/toComplete.cjs.map +1 -1
  214. package/__cjs/testing/matchers/toEmitAnything.cjs.map +1 -1
  215. package/__cjs/testing/matchers/toEmitError.cjs.map +1 -1
  216. package/__cjs/testing/matchers/toEmitNext.cjs.map +1 -1
  217. package/__cjs/testing/matchers/{toEmitStrictTyped.cjs → toEmitTypedValue.cjs} +5 -5
  218. package/__cjs/testing/matchers/toEmitTypedValue.cjs.map +1 -0
  219. package/__cjs/testing/matchers/{toEmitValueStrict.d.cts → toEmitTypedValue.d.cts} +2 -2
  220. package/__cjs/testing/matchers/toHaveSuspenseCacheEntryUsing.cjs +2 -2
  221. package/__cjs/testing/matchers/toHaveSuspenseCacheEntryUsing.cjs.map +1 -1
  222. package/__cjs/testing/matchers/toHaveSuspenseCacheEntryUsing.d.cts +1 -1
  223. package/__cjs/testing/matchers/toMatchDocument.cjs.map +1 -1
  224. package/__cjs/testing/matchers/toMatchDocument.d.cts +1 -1
  225. package/__cjs/testing/matchers/{toEqualStrictTyped.cjs → toStrictEqualTyped.cjs} +5 -5
  226. package/__cjs/testing/matchers/{toEqualStrictTyped.cjs.map → toStrictEqualTyped.cjs.map} +1 -1
  227. package/__cjs/testing/matchers/toStrictEqualTyped.d.cts +3 -0
  228. package/__cjs/testing/matchers/utils/getSerializableProperties.cjs +2 -2
  229. package/__cjs/testing/matchers/utils/getSerializableProperties.cjs.map +1 -1
  230. package/__cjs/testing/react/MockedProvider.cjs +11 -7
  231. package/__cjs/testing/react/MockedProvider.cjs.map +1 -1
  232. package/__cjs/testing/react/MockedProvider.d.cts +5 -3
  233. package/__cjs/utilities/caching/sizes.cjs +2 -2
  234. package/__cjs/utilities/caching/sizes.cjs.map +1 -1
  235. package/__cjs/utilities/caching/sizes.d.cts +2 -20
  236. package/__cjs/utilities/common/mergeOptions.cjs.map +1 -1
  237. package/__cjs/utilities/common/mergeOptions.d.cts +1 -1
  238. package/__cjs/utilities/graphql/getFromAST.cjs +15 -6
  239. package/__cjs/utilities/graphql/getFromAST.cjs.map +1 -1
  240. package/__cjs/utilities/graphql/getFromAST.d.cts +2 -2
  241. package/__cjs/utilities/graphql/operations.cjs.map +1 -1
  242. package/__cjs/utilities/graphql/operations.d.cts +1 -1
  243. package/__cjs/utilities/graphql/storeUtils.cjs +1 -1
  244. package/__cjs/utilities/graphql/transform.cjs +2 -2
  245. package/__cjs/utilities/index.cjs +39 -19
  246. package/__cjs/utilities/index.cjs.map +1 -1
  247. package/__cjs/utilities/index.d.cts +15 -14
  248. package/__cjs/utilities/internal/getMemoryInternals.cjs +0 -2
  249. package/__cjs/utilities/internal/getMemoryInternals.cjs.map +1 -1
  250. package/__cjs/utilities/internal/getMemoryInternals.d.cts +0 -1
  251. package/__cjs/utilities/internal/index.production.cjs +1 -0
  252. package/__cjs/utilities/internal/index.production.cjs.map +1 -1
  253. package/__cjs/utilities/internal/toQueryResult.cjs.map +1 -1
  254. package/__cjs/utilities/internal/toQueryResult.d.cts +1 -1
  255. package/__cjs/utilities/invariant/index.development.cjs +1 -0
  256. package/__cjs/utilities/invariant/index.development.cjs.map +1 -1
  257. package/__cjs/utilities/subscriptions/relay/index.cjs +2 -2
  258. package/__cjs/utilities/subscriptions/relay/index.cjs.map +1 -1
  259. package/__cjs/utilities/subscriptions/relay/index.d.cts +1 -1
  260. package/__cjs/version.cjs +1 -1
  261. package/__cjs/version.cjs.map +1 -1
  262. package/__cjs/version.d.cts +1 -1
  263. package/cache/core/cache.d.ts +1 -1
  264. package/cache/core/cache.js +1 -1
  265. package/cache/core/cache.js.map +1 -1
  266. package/cache/core/types/Cache.d.ts +1 -1
  267. package/cache/core/types/Cache.js.map +1 -1
  268. package/cache/core/types/DataProxy.d.ts +1 -1
  269. package/cache/core/types/common.js +1 -0
  270. package/cache/core/types/common.js.map +1 -1
  271. package/cache/index.d.ts +3 -3
  272. package/cache/index.js +1 -1
  273. package/cache/index.js.map +1 -1
  274. package/cache/inmemory/entityStore.d.ts +1 -0
  275. package/cache/inmemory/entityStore.js +7 -4
  276. package/cache/inmemory/entityStore.js.map +1 -1
  277. package/cache/inmemory/fragmentRegistry.js +1 -1
  278. package/cache/inmemory/fragmentRegistry.js.map +1 -1
  279. package/cache/inmemory/inMemoryCache.d.ts +1 -1
  280. package/cache/inmemory/inMemoryCache.js.map +1 -1
  281. package/cache/inmemory/key-extractor.js +1 -1
  282. package/cache/inmemory/policies.js +4 -4
  283. package/cache/inmemory/reactiveVars.d.ts +1 -1
  284. package/cache/inmemory/reactiveVars.js.map +1 -1
  285. package/cache/inmemory/readFromStore.js +2 -2
  286. package/cache/inmemory/readFromStore.js.map +1 -1
  287. package/cache/inmemory/types.d.ts +1 -1
  288. package/cache/inmemory/writeToStore.d.ts +1 -1
  289. package/cache/inmemory/writeToStore.js +4 -4
  290. package/cache/inmemory/writeToStore.js.map +1 -1
  291. package/config/jest/areCombinedGraphQLErrorsEqual.js +2 -3
  292. package/config/jest/areCombinedGraphQLErrorsEqual.js.map +1 -1
  293. package/config/jest/areCombinedProtocolErrorsEqual.js +2 -3
  294. package/config/jest/areCombinedProtocolErrorsEqual.js.map +1 -1
  295. package/config/jest/areMissingFieldErrorsEqual.js +2 -3
  296. package/config/jest/areMissingFieldErrorsEqual.js.map +1 -1
  297. package/config/jest/areServerErrorsEqual.d.ts +3 -0
  298. package/config/jest/areServerErrorsEqual.js +17 -0
  299. package/config/jest/areServerErrorsEqual.js.map +1 -0
  300. package/config/jest/resolver.js +12 -1
  301. package/config/jest/resolver.js.map +1 -1
  302. package/config/jest/setup.js +13 -2
  303. package/config/jest/setup.js.map +1 -1
  304. package/core/ApolloClient.d.ts +0 -2
  305. package/core/ApolloClient.js +7 -9
  306. package/core/ApolloClient.js.map +1 -1
  307. package/core/LocalState.js +2 -2
  308. package/core/ObservableQuery.d.ts +18 -1
  309. package/core/ObservableQuery.js +104 -36
  310. package/core/ObservableQuery.js.map +1 -1
  311. package/core/QueryInfo.d.ts +0 -10
  312. package/core/QueryInfo.js +4 -78
  313. package/core/QueryInfo.js.map +1 -1
  314. package/core/QueryManager.d.ts +3 -3
  315. package/core/QueryManager.js +36 -55
  316. package/core/QueryManager.js.map +1 -1
  317. package/core/index.d.ts +13 -11
  318. package/core/index.js +9 -6
  319. package/core/index.js.map +1 -1
  320. package/errors/CombinedGraphQLErrors.d.ts +1 -1
  321. package/errors/CombinedGraphQLErrors.js.map +1 -1
  322. package/errors/index.d.ts +2 -0
  323. package/errors/index.js +18 -0
  324. package/errors/index.js.map +1 -1
  325. package/invariantErrorCodes.js +95 -119
  326. package/legacyEntryPoints/testing/internal/index.d.ts +1 -0
  327. package/legacyEntryPoints/testing/internal/index.js +1 -0
  328. package/legacyEntryPoints/testing/internal/internal.cjs +1 -0
  329. package/legacyEntryPoints/testing/internal/internal.d.cts +1 -0
  330. package/link/batch/index.d.ts +2 -1
  331. package/link/batch/index.js +1 -1
  332. package/link/batch/index.js.map +1 -1
  333. package/link/batch-http/index.d.ts +1 -1
  334. package/link/batch-http/index.js +1 -1
  335. package/link/batch-http/index.js.map +1 -1
  336. package/link/context/index.d.ts +1 -1
  337. package/link/context/index.js.map +1 -1
  338. package/link/core/ApolloLink.d.ts +1 -3
  339. package/link/core/ApolloLink.js +2 -20
  340. package/link/core/ApolloLink.js.map +1 -1
  341. package/link/core/index.d.ts +1 -1
  342. package/link/core/index.js.map +1 -1
  343. package/link/core/types.d.ts +1 -1
  344. package/link/error/index.d.ts +4 -15
  345. package/link/error/index.js +14 -29
  346. package/link/error/index.js.map +1 -1
  347. package/link/http/checkFetcher.js +1 -1
  348. package/link/http/createHttpLink.js +1 -1
  349. package/link/http/parseAndCheckHttpResponse.js +1 -1
  350. package/link/http/serializeFetchParameter.js +1 -1
  351. package/link/persisted-queries/index.js +3 -3
  352. package/link/persisted-queries/index.js.map +1 -1
  353. package/link/remove-typename/removeTypenameFromVariables.js.map +1 -1
  354. package/link/retry/index.d.ts +1 -1
  355. package/link/retry/index.js +1 -1
  356. package/link/retry/index.js.map +1 -1
  357. package/link/utils/validateOperation.js +1 -1
  358. package/masking/maskDefinition.js +2 -2
  359. package/masking/maskFragment.d.ts +1 -1
  360. package/masking/maskFragment.js +2 -2
  361. package/masking/maskFragment.js.map +1 -1
  362. package/masking/maskOperation.d.ts +1 -1
  363. package/masking/maskOperation.js +1 -1
  364. package/masking/maskOperation.js.map +1 -1
  365. package/masking/utils.js +1 -1
  366. package/package.json +20 -40
  367. package/react/context/ApolloConsumer.d.ts +7 -4
  368. package/react/context/ApolloConsumer.js +1 -1
  369. package/react/context/ApolloConsumer.js.map +1 -1
  370. package/react/context/ApolloContext.d.ts +1 -1
  371. package/react/context/ApolloContext.js +1 -1
  372. package/react/context/ApolloContext.js.map +1 -1
  373. package/react/context/ApolloProvider.d.ts +7 -5
  374. package/react/context/ApolloProvider.js +1 -1
  375. package/react/context/ApolloProvider.js.map +1 -1
  376. package/react/hooks/internal/wrapHook.d.ts +3 -3
  377. package/react/hooks/internal/wrapHook.js.map +1 -1
  378. package/react/hooks/useApolloClient.d.ts +1 -1
  379. package/react/hooks/useApolloClient.js +2 -2
  380. package/react/hooks/useApolloClient.js.map +1 -1
  381. package/react/hooks/useBackgroundQuery.d.ts +2 -2
  382. package/react/hooks/useBackgroundQuery.js.map +1 -1
  383. package/react/hooks/useFragment.d.ts +1 -1
  384. package/react/hooks/useFragment.js.map +1 -1
  385. package/react/hooks/useLazyQuery.d.ts +2 -2
  386. package/react/hooks/useLazyQuery.js +3 -3
  387. package/react/hooks/useLazyQuery.js.map +1 -1
  388. package/react/hooks/useLoadableQuery.d.ts +2 -2
  389. package/react/hooks/useLoadableQuery.js +2 -2
  390. package/react/hooks/useLoadableQuery.js.map +1 -1
  391. package/react/hooks/useMutation.d.ts +1 -2
  392. package/react/hooks/useMutation.js +0 -2
  393. package/react/hooks/useMutation.js.map +1 -1
  394. package/react/hooks/useQuery.d.ts +2 -3
  395. package/react/hooks/useQuery.js +2 -4
  396. package/react/hooks/useQuery.js.map +1 -1
  397. package/react/hooks/useQueryRefHandlers.d.ts +2 -2
  398. package/react/hooks/useQueryRefHandlers.js.map +1 -1
  399. package/react/hooks/useReactiveVar.d.ts +1 -1
  400. package/react/hooks/useReactiveVar.js.map +1 -1
  401. package/react/hooks/useReadQuery.d.ts +1 -1
  402. package/react/hooks/useReadQuery.js.map +1 -1
  403. package/react/hooks/useSubscription.d.ts +1 -1
  404. package/react/hooks/useSubscription.js +1 -3
  405. package/react/hooks/useSubscription.js.map +1 -1
  406. package/react/hooks/useSuspenseFragment.d.ts +1 -1
  407. package/react/hooks/useSuspenseFragment.js.map +1 -1
  408. package/react/hooks/useSuspenseQuery.d.ts +3 -3
  409. package/react/hooks/useSuspenseQuery.js +4 -6
  410. package/react/hooks/useSuspenseQuery.js.map +1 -1
  411. package/react/hooks/useSyncExternalStore.js +1 -1
  412. package/react/index.d.ts +21 -7
  413. package/react/index.js +17 -3
  414. package/react/index.js.map +1 -1
  415. package/react/index.react-server.d.ts +0 -1
  416. package/react/index.react-server.js +0 -1
  417. package/react/index.react-server.js.map +1 -1
  418. package/react/internal/cache/FragmentReference.d.ts +1 -1
  419. package/react/internal/cache/FragmentReference.js.map +1 -1
  420. package/react/internal/cache/QueryReference.d.ts +1 -1
  421. package/react/internal/cache/QueryReference.js +1 -1
  422. package/react/internal/cache/QueryReference.js.map +1 -1
  423. package/react/internal/cache/SuspenseCache.d.ts +1 -1
  424. package/react/internal/cache/SuspenseCache.js.map +1 -1
  425. package/react/internal/cache/getSuspenseCache.d.ts +2 -2
  426. package/react/internal/cache/getSuspenseCache.js.map +1 -1
  427. package/react/internal/types.d.ts +1 -1
  428. package/react/query-preloader/createQueryPreloader.d.ts +1 -1
  429. package/react/query-preloader/createQueryPreloader.js.map +1 -1
  430. package/react/ssr/prerenderStatic.d.ts +1 -1
  431. package/react/ssr/prerenderStatic.js +3 -3
  432. package/react/ssr/prerenderStatic.js.map +1 -1
  433. package/react/ssr/useSSRQuery.js.map +1 -1
  434. package/react/types/deprecated.d.ts +12 -2
  435. package/testing/core/index.d.ts +3 -3
  436. package/testing/core/index.js +2 -2
  437. package/testing/core/index.js.map +1 -1
  438. package/testing/core/mocking/mockClient.d.ts +1 -1
  439. package/testing/core/mocking/mockClient.js +2 -3
  440. package/testing/core/mocking/mockClient.js.map +1 -1
  441. package/testing/core/mocking/mockLink.d.ts +26 -7
  442. package/testing/core/mocking/mockLink.js +117 -113
  443. package/testing/core/mocking/mockLink.js.map +1 -1
  444. package/testing/experimental/createSchemaFetch.js +2 -2
  445. package/testing/experimental/createSchemaFetch.js.map +1 -1
  446. package/testing/experimental/createTestSchema.d.ts +1 -1
  447. package/testing/experimental/createTestSchema.js.map +1 -1
  448. package/testing/index.d.ts +2 -1
  449. package/testing/index.js +1 -1
  450. package/testing/index.js.map +1 -1
  451. package/testing/internal/disposables/spyOnConsole.d.ts +0 -1
  452. package/testing/internal/disposables/spyOnConsole.js +0 -1
  453. package/testing/internal/disposables/spyOnConsole.js.map +1 -1
  454. package/testing/internal/incremental.d.ts +1 -1
  455. package/testing/internal/incremental.js.map +1 -1
  456. package/testing/internal/index.d.ts +3 -3
  457. package/testing/internal/index.js +2 -2
  458. package/testing/internal/index.js.map +1 -1
  459. package/testing/internal/renderHelpers.d.ts +1 -1
  460. package/testing/internal/renderHelpers.js.map +1 -1
  461. package/testing/internal/scenarios/index.d.ts +6 -8
  462. package/testing/internal/scenarios/index.js +4 -2
  463. package/testing/internal/scenarios/index.js.map +1 -1
  464. package/testing/matchers/index.js +4 -22
  465. package/testing/matchers/index.js.map +1 -1
  466. package/testing/matchers/toComplete.js.map +1 -1
  467. package/testing/matchers/toEmitAnything.js.map +1 -1
  468. package/testing/matchers/toEmitError.js.map +1 -1
  469. package/testing/matchers/toEmitNext.js.map +1 -1
  470. package/testing/matchers/{toEmitValueStrict.d.ts → toEmitTypedValue.d.ts} +2 -2
  471. package/testing/matchers/{toEmitStrictTyped.js → toEmitTypedValue.js} +3 -3
  472. package/testing/matchers/toEmitTypedValue.js.map +1 -0
  473. package/testing/matchers/toHaveSuspenseCacheEntryUsing.d.ts +1 -1
  474. package/testing/matchers/toHaveSuspenseCacheEntryUsing.js +1 -1
  475. package/testing/matchers/toHaveSuspenseCacheEntryUsing.js.map +1 -1
  476. package/testing/matchers/toMatchDocument.d.ts +1 -1
  477. package/testing/matchers/toMatchDocument.js.map +1 -1
  478. package/testing/matchers/toStrictEqualTyped.d.ts +3 -0
  479. package/testing/matchers/{toEqualStrictTyped.js → toStrictEqualTyped.js} +3 -3
  480. package/testing/matchers/{toEqualStrictTyped.js.map → toStrictEqualTyped.js.map} +1 -1
  481. package/testing/matchers/utils/getSerializableProperties.js +1 -1
  482. package/testing/matchers/utils/getSerializableProperties.js.map +1 -1
  483. package/testing/react/MockedProvider.d.ts +5 -3
  484. package/testing/react/MockedProvider.js +8 -4
  485. package/testing/react/MockedProvider.js.map +1 -1
  486. package/utilities/caching/sizes.d.ts +2 -20
  487. package/utilities/caching/sizes.js +2 -2
  488. package/utilities/caching/sizes.js.map +1 -1
  489. package/utilities/common/mergeOptions.d.ts +1 -1
  490. package/utilities/common/mergeOptions.js.map +1 -1
  491. package/utilities/graphql/getFromAST.d.ts +2 -2
  492. package/utilities/graphql/getFromAST.js +15 -6
  493. package/utilities/graphql/getFromAST.js.map +1 -1
  494. package/utilities/graphql/operations.d.ts +1 -1
  495. package/utilities/graphql/operations.js.map +1 -1
  496. package/utilities/graphql/storeUtils.js +1 -1
  497. package/utilities/graphql/transform.js +2 -2
  498. package/utilities/index.d.ts +15 -14
  499. package/utilities/index.js +12 -12
  500. package/utilities/index.js.map +1 -1
  501. package/utilities/internal/getMemoryInternals.d.ts +0 -1
  502. package/utilities/internal/getMemoryInternals.js +0 -2
  503. package/utilities/internal/getMemoryInternals.js.map +1 -1
  504. package/utilities/internal/index.production.js +1 -0
  505. package/utilities/internal/index.production.js.map +1 -1
  506. package/utilities/internal/toQueryResult.d.ts +1 -1
  507. package/utilities/internal/toQueryResult.js.map +1 -1
  508. package/utilities/invariant/index.development.js +1 -0
  509. package/utilities/invariant/index.development.js.map +1 -1
  510. package/utilities/subscriptions/relay/index.d.ts +1 -1
  511. package/utilities/subscriptions/relay/index.js +1 -1
  512. package/utilities/subscriptions/relay/index.js.map +1 -1
  513. package/version.d.ts +1 -1
  514. package/version.js +1 -1
  515. package/version.js.map +1 -1
  516. package/__cjs/index.cjs +0 -8
  517. package/__cjs/index.cjs.map +0 -1
  518. package/__cjs/index.d.cts +0 -3
  519. package/__cjs/react/context/index.cjs +0 -10
  520. package/__cjs/react/context/index.cjs.map +0 -1
  521. package/__cjs/react/context/index.d.cts +0 -7
  522. package/__cjs/react/hooks/index.cjs +0 -32
  523. package/__cjs/react/hooks/index.cjs.map +0 -1
  524. package/__cjs/react/hooks/index.d.cts +0 -16
  525. package/__cjs/react/parser/index.cjs +0 -115
  526. package/__cjs/react/parser/index.cjs.map +0 -1
  527. package/__cjs/react/parser/index.d.cts +0 -18
  528. package/__cjs/testing/matchers/toEmitApolloQueryResult.cjs +0 -40
  529. package/__cjs/testing/matchers/toEmitApolloQueryResult.cjs.map +0 -1
  530. package/__cjs/testing/matchers/toEmitApolloQueryResult.d.cts +0 -8
  531. package/__cjs/testing/matchers/toEmitFetchResult.cjs +0 -40
  532. package/__cjs/testing/matchers/toEmitFetchResult.cjs.map +0 -1
  533. package/__cjs/testing/matchers/toEmitFetchResult.d.cts +0 -8
  534. package/__cjs/testing/matchers/toEmitMatchedValue.cjs +0 -40
  535. package/__cjs/testing/matchers/toEmitMatchedValue.cjs.map +0 -1
  536. package/__cjs/testing/matchers/toEmitMatchedValue.d.cts +0 -7
  537. package/__cjs/testing/matchers/toEmitStrictTyped.cjs.map +0 -1
  538. package/__cjs/testing/matchers/toEmitStrictTyped.d.cts +0 -7
  539. package/__cjs/testing/matchers/toEmitValue.cjs +0 -41
  540. package/__cjs/testing/matchers/toEmitValue.cjs.map +0 -1
  541. package/__cjs/testing/matchers/toEmitValue.d.cts +0 -4
  542. package/__cjs/testing/matchers/toEmitValueStrict.cjs +0 -46
  543. package/__cjs/testing/matchers/toEmitValueStrict.cjs.map +0 -1
  544. package/__cjs/testing/matchers/toEqualApolloQueryResult.cjs +0 -24
  545. package/__cjs/testing/matchers/toEqualApolloQueryResult.cjs.map +0 -1
  546. package/__cjs/testing/matchers/toEqualApolloQueryResult.d.cts +0 -6
  547. package/__cjs/testing/matchers/toEqualFetchResult.cjs +0 -24
  548. package/__cjs/testing/matchers/toEqualFetchResult.cjs.map +0 -1
  549. package/__cjs/testing/matchers/toEqualFetchResult.d.cts +0 -4
  550. package/__cjs/testing/matchers/toEqualLazyQueryResult.cjs +0 -40
  551. package/__cjs/testing/matchers/toEqualLazyQueryResult.cjs.map +0 -1
  552. package/__cjs/testing/matchers/toEqualLazyQueryResult.d.cts +0 -10
  553. package/__cjs/testing/matchers/toEqualQueryResult.cjs +0 -39
  554. package/__cjs/testing/matchers/toEqualQueryResult.cjs.map +0 -1
  555. package/__cjs/testing/matchers/toEqualQueryResult.d.cts +0 -9
  556. package/__cjs/testing/matchers/toEqualStrictTyped.d.cts +0 -3
  557. package/index.d.ts +0 -3
  558. package/index.js +0 -3
  559. package/index.js.map +0 -1
  560. package/legacyEntryPoints/react/context/context.cjs +0 -1
  561. package/legacyEntryPoints/react/context/context.d.cts +0 -1
  562. package/legacyEntryPoints/react/context/index.d.ts +0 -1
  563. package/legacyEntryPoints/react/context/index.js +0 -1
  564. package/legacyEntryPoints/react/hooks/hooks.cjs +0 -1
  565. package/legacyEntryPoints/react/hooks/hooks.d.cts +0 -1
  566. package/legacyEntryPoints/react/hooks/index.d.ts +0 -1
  567. package/legacyEntryPoints/react/hooks/index.js +0 -1
  568. package/legacyEntryPoints/react/parser/index.d.ts +0 -1
  569. package/legacyEntryPoints/react/parser/index.js +0 -1
  570. package/legacyEntryPoints/react/parser/parser.cjs +0 -1
  571. package/legacyEntryPoints/react/parser/parser.d.cts +0 -1
  572. package/react/context/index.d.ts +0 -7
  573. package/react/context/index.js +0 -4
  574. package/react/context/index.js.map +0 -1
  575. package/react/hooks/index.d.ts +0 -16
  576. package/react/hooks/index.js +0 -15
  577. package/react/hooks/index.js.map +0 -1
  578. package/react/parser/index.d.ts +0 -18
  579. package/react/parser/index.js +0 -109
  580. package/react/parser/index.js.map +0 -1
  581. package/testing/matchers/toEmitApolloQueryResult.d.ts +0 -8
  582. package/testing/matchers/toEmitApolloQueryResult.js +0 -36
  583. package/testing/matchers/toEmitApolloQueryResult.js.map +0 -1
  584. package/testing/matchers/toEmitFetchResult.d.ts +0 -8
  585. package/testing/matchers/toEmitFetchResult.js +0 -36
  586. package/testing/matchers/toEmitFetchResult.js.map +0 -1
  587. package/testing/matchers/toEmitMatchedValue.d.ts +0 -7
  588. package/testing/matchers/toEmitMatchedValue.js +0 -36
  589. package/testing/matchers/toEmitMatchedValue.js.map +0 -1
  590. package/testing/matchers/toEmitStrictTyped.d.ts +0 -7
  591. package/testing/matchers/toEmitStrictTyped.js.map +0 -1
  592. package/testing/matchers/toEmitValue.d.ts +0 -4
  593. package/testing/matchers/toEmitValue.js +0 -37
  594. package/testing/matchers/toEmitValue.js.map +0 -1
  595. package/testing/matchers/toEmitValueStrict.js +0 -42
  596. package/testing/matchers/toEmitValueStrict.js.map +0 -1
  597. package/testing/matchers/toEqualApolloQueryResult.d.ts +0 -6
  598. package/testing/matchers/toEqualApolloQueryResult.js +0 -20
  599. package/testing/matchers/toEqualApolloQueryResult.js.map +0 -1
  600. package/testing/matchers/toEqualFetchResult.d.ts +0 -4
  601. package/testing/matchers/toEqualFetchResult.js +0 -20
  602. package/testing/matchers/toEqualFetchResult.js.map +0 -1
  603. package/testing/matchers/toEqualLazyQueryResult.d.ts +0 -10
  604. package/testing/matchers/toEqualLazyQueryResult.js +0 -36
  605. package/testing/matchers/toEqualLazyQueryResult.js.map +0 -1
  606. package/testing/matchers/toEqualQueryResult.d.ts +0 -9
  607. package/testing/matchers/toEqualQueryResult.js +0 -35
  608. package/testing/matchers/toEqualQueryResult.js.map +0 -1
  609. package/testing/matchers/toEqualStrictTyped.d.ts +0 -3
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@apollo/client": minor
3
+ ---
4
+
5
+ Allow mocked responses passed to `MockLink` to accept a callback for the `delay` option. The `delay` callback will be given the current operation which can be used to determine what delay should be used for the mock.
@@ -0,0 +1,15 @@
1
+ ---
2
+ "@apollo/client": major
3
+ ---
4
+
5
+ `onError` link now uses a single `error` property to report the error that caused the link callback to be called. This will be an instance of `CombinedGraphQLErrors` in the event GraphQL errors were emitted from the terminating link, `CombinedProtocolErrors` if the terminating link emitted protocol errors, or the unwrapped error type if any other non-GraphQL error was thrown or emitted.
6
+
7
+ ```diff
8
+ - const errorLink = onError(({ graphQLErrors, networkError, protocolErrors }) => {
9
+ - graphQLErrors.forEach(error => console.log(error.message));
10
+ + const errorLink = onError(({ error }) => {
11
+ + if (error.name === 'CombinedGraphQLErrors') {
12
+ + error.errors.forEach(rawError => console.log(rawError.message));
13
+ + }
14
+ });
15
+ ```
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@apollo/client": major
3
+ ---
4
+
5
+ Removed the `@apollo/client/react/context` and `@apollo/client/react/hooks` entry points. Please use `@apollo/client/react` instead.
@@ -0,0 +1,22 @@
1
+ ---
2
+ "@apollo/client": minor
3
+ ---
4
+
5
+ Introduce a new `realisticDelay` helper function for use with the `delay` callback for mocked responses used with `MockLink`. `realisticDelay` will generate a random value between 20 and 50ms to provide an experience closer to unpredictable network latency. `realisticDelay` can be configured with a `min` and `max` to set different thresholds if the defaults are not sufficient.
6
+
7
+ ```ts
8
+ import { realisticDelay } from '@apollo/client/testing';
9
+
10
+ new MockLink([
11
+ {
12
+ request: { query },
13
+ result: { data: { greeting: 'Hello' }},
14
+ delay: realisticDelay()
15
+ },
16
+ {
17
+ request: { query },
18
+ result: { data: { greeting: 'Hello' }},
19
+ delay: realisticDelay({ min: 10, max: 100 })
20
+ },
21
+ ]);
22
+ ```
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@apollo/client": major
3
+ ---
4
+
5
+ Remove the `onError` and `setOnError` methods from `ApolloLink`. `onError` was only used by `MockLink` to rewrite errors if `setOnError` was used.
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@apollo/client": patch
3
+ ---
4
+
5
+ Removed the `parser` cache. The functionality has been replaced in a way that doesn't need caching.
@@ -0,0 +1,17 @@
1
+ ---
2
+ "@apollo/client": major
3
+ ---
4
+
5
+ Mocked responses passed to `MockLink` now accept a callback for the `request.variables` option. This is used to determine if the mock should be matched for a set of request variables. With this change, the `variableMatcher` option has been removed in favor of passing a callback to `variables`. Update by moving the callback function from `variableMatcher` to `request.variables`.
6
+
7
+ ```diff
8
+ new MockLink([
9
+ {
10
+ request: {
11
+ query,
12
+ + variables: (requestVariables) => true
13
+ },
14
+ - variableMatcher: (requestVariables) => true
15
+ }
16
+ ]);
17
+ ```
@@ -0,0 +1,7 @@
1
+ ---
2
+ "@apollo/client": major
3
+ ---
4
+
5
+ The `@apollo/client` and `@apollo/client/core` entry points are now equal.
6
+ In the next major, the `@apollo/client/core` entry point will be removed.
7
+ Please change imports over from `@apollo/client/core` to `@apollo/client`.
@@ -5,6 +5,8 @@
5
5
  "@apollo/client": "3.12.2"
6
6
  },
7
7
  "changesets": [
8
+ "afraid-moons-arrive",
9
+ "beige-mirrors-talk",
8
10
  "brave-radios-wait",
9
11
  "bright-ads-share",
10
12
  "calm-frogs-remain",
@@ -15,7 +17,9 @@
15
17
  "cool-bikes-shake",
16
18
  "cuddly-spiders-tie",
17
19
  "curvy-pianos-count",
20
+ "dirty-eagles-poke",
18
21
  "dirty-trees-pump",
22
+ "early-eggs-develop",
19
23
  "eighty-squids-fix",
20
24
  "eleven-kangaroos-jump",
21
25
  "empty-rabbits-move",
@@ -25,6 +29,7 @@
25
29
  "four-ghosts-watch",
26
30
  "fresh-moose-hope",
27
31
  "funny-jeans-invent",
32
+ "giant-apes-thank",
28
33
  "giant-bags-share",
29
34
  "good-dolphins-peel",
30
35
  "gorgeous-chefs-tap",
@@ -52,11 +57,15 @@
52
57
  "nervous-fireants-bow",
53
58
  "nervous-goats-allow",
54
59
  "nice-donkeys-reflect",
60
+ "nice-dots-matter",
55
61
  "nice-waves-work",
62
+ "ninety-bags-bake",
56
63
  "odd-lemons-relax",
64
+ "perfect-vans-give",
57
65
  "polite-bees-care",
58
66
  "poor-eels-punch",
59
67
  "popular-games-sleep",
68
+ "purple-bears-flash",
60
69
  "purple-lions-cough",
61
70
  "rare-houses-prove",
62
71
  "real-gorillas-move",
@@ -65,8 +74,10 @@
65
74
  "rich-kids-carry",
66
75
  "rude-fans-study",
67
76
  "seven-foxes-melt",
77
+ "shaggy-pugs-add",
68
78
  "shiny-carrots-invent",
69
79
  "short-jokes-jam",
80
+ "short-months-complain",
70
81
  "silly-knives-exist",
71
82
  "slimy-chicken-melt",
72
83
  "slimy-maps-press",
@@ -80,6 +91,7 @@
80
91
  "soft-mails-clean",
81
92
  "sour-pillows-guess",
82
93
  "strange-seahorses-impress",
94
+ "swift-rivers-share",
83
95
  "tall-bikes-develop",
84
96
  "tall-cups-suffer",
85
97
  "tame-doors-shop",
@@ -95,6 +107,7 @@
95
107
  "unlucky-kiwis-sell",
96
108
  "unlucky-sheep-change",
97
109
  "warm-ties-sit",
110
+ "wicked-forks-double",
98
111
  "yellow-cats-judge",
99
112
  "young-phones-fold",
100
113
  "young-turtles-explode"
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@apollo/client": major
3
+ ---
4
+
5
+ Removed the `@apollo/client/react/parser` entry point. There is no replacement.
@@ -0,0 +1,52 @@
1
+ ---
2
+ "@apollo/client": minor
3
+ ---
4
+
5
+ Add ability to specify a default `delay` for all mocked responses passed to `MockLink`. This `delay` can be configured globally (all instances of `MockLink` will use the global defaults), or per-instance (all mocks in a single instance will use the defaults). A `delay` defined on a single mock will supercede all default delays. Per-instance defaults supercede global defaults.
6
+
7
+ **Global defaults**
8
+
9
+ ```ts
10
+ MockLink.defaultOptions = {
11
+ // Use a default delay of 20ms for all mocks in all instances without a specified delay
12
+ delay: 20,
13
+
14
+ // altenatively use a callback which will be executed for each mock
15
+ delay: () => getRandomNumber(),
16
+
17
+ // or use the built-in `realisticDelay`. This is the default
18
+ delay: realisticDelay(),
19
+ }
20
+ ```
21
+
22
+ **Per-instance defaults**
23
+
24
+ ```ts
25
+ new MockLink(
26
+ [
27
+ // Use the default delay
28
+ {
29
+ request: { query },
30
+ result: { data: { greeting: 'Hello' }},
31
+ },
32
+ {
33
+ request: { query },
34
+ result: { data: { greeting: 'Hello' }},
35
+ // Override the default for this mock
36
+ delay: 10
37
+ },
38
+ ],
39
+ {
40
+ defaultOptions: {
41
+ // Use a default delay of 20ms for all mocks without a specified delay
42
+ delay: 20,
43
+
44
+ // altenatively use a callback which will be executed for each mock
45
+ delay: () => getRandomNumber(),
46
+
47
+ // or use the built-in `realisticDelay`. This is the default
48
+ delay: realisticDelay(),
49
+ }
50
+ }
51
+ );
52
+ ```
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@apollo/client": major
3
+ ---
4
+
5
+ Throw an error when a client-only query is used in a mocked response passed to `MockLink`.
@@ -0,0 +1,13 @@
1
+ ---
2
+ "@apollo/client": major
3
+ ---
4
+
5
+ Default the `delay` for all mocked responses passed to `MockLink` using `realisticDelay`. This ensures your test handles loading states by default and is not reliant on a specific timing.
6
+
7
+ If you would like to restore the old behavior, use a global default delay of `0`.
8
+
9
+ ```ts
10
+ MockLink.defaultOptions = {
11
+ delay: 0
12
+ }
13
+ ```
@@ -0,0 +1,33 @@
1
+ ---
2
+ "@apollo/client": major
3
+ ---
4
+
5
+ Remove `newData` option for mocked responses passed to `MockLink` or the `mocks` option on `MockedProvider`. This option was undocumented and was nearly identical to using the `result` option as a callback.
6
+
7
+ To replicate the old behavior of `newData`, use `result` as a callback and add the `maxUsageCount` option with a value set to `Number.POSITIVE_INFINITY`.
8
+
9
+ **with `MockLink`**
10
+ ```diff
11
+ new MockLink([
12
+ {
13
+ request: { query, variables },
14
+ - newData: (variables) => ({ data: { greeting: "Hello " + variables.greeting } }),
15
+ + result: (variables) => ({ data: { greeting: "Hello " + variables.greeting } }),
16
+ + maxUsageCount: Number.POSITIVE_INFINITY,
17
+ }
18
+ ])
19
+ ```
20
+
21
+ **with `MockedProvider`**
22
+ ```diff
23
+ <MockedProvider
24
+ mocks={[
25
+ {
26
+ request: { query, variables },
27
+ - newData: (variables) => ({ data: { greeting: "Hello " + variables.greeting } }),
28
+ + result: (variables) => ({ data: { greeting: "Hello " + variables.greeting } }),
29
+ + maxUsageCount: Number.POSITIVE_INFINITY,
30
+ }
31
+ ]}
32
+ />
33
+ ```
package/CHANGELOG.md CHANGED
@@ -1,5 +1,169 @@
1
1
  # @apollo/client
2
2
 
3
+ ## 4.0.0-alpha.8
4
+
5
+ ### Major Changes
6
+
7
+ - [#12539](https://github.com/apollographql/apollo-client/pull/12539) [`dd0d6d6`](https://github.com/apollographql/apollo-client/commit/dd0d6d6d96d8b810e30dc2fdee2ac8a2477d0017) Thanks [@jerelmiller](https://github.com/jerelmiller)! - `onError` link now uses a single `error` property to report the error that caused the link callback to be called. This will be an instance of `CombinedGraphQLErrors` in the event GraphQL errors were emitted from the terminating link, `CombinedProtocolErrors` if the terminating link emitted protocol errors, or the unwrapped error type if any other non-GraphQL error was thrown or emitted.
8
+
9
+ ```diff
10
+ - const errorLink = onError(({ graphQLErrors, networkError, protocolErrors }) => {
11
+ - graphQLErrors.forEach(error => console.log(error.message));
12
+ + const errorLink = onError(({ error }) => {
13
+ + if (error.name === 'CombinedGraphQLErrors') {
14
+ + error.errors.forEach(rawError => console.log(rawError.message));
15
+ + }
16
+ });
17
+ ```
18
+
19
+ - [#12533](https://github.com/apollographql/apollo-client/pull/12533) [`73221d8`](https://github.com/apollographql/apollo-client/commit/73221d87bd5640986f86fe3ee50c63ed49834cbb) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Remove the `onError` and `setOnError` methods from `ApolloLink`. `onError` was only used by `MockLink` to rewrite errors if `setOnError` was used.
20
+
21
+ - [#12531](https://github.com/apollographql/apollo-client/pull/12531) [`7784b46`](https://github.com/apollographql/apollo-client/commit/7784b46117a4f91a270a020ed1a24f042cb9ee17) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Mocked responses passed to `MockLink` now accept a callback for the `request.variables` option. This is used to determine if the mock should be matched for a set of request variables. With this change, the `variableMatcher` option has been removed in favor of passing a callback to `variables`. Update by moving the callback function from `variableMatcher` to `request.variables`.
22
+
23
+ ```diff
24
+ new MockLink([
25
+ {
26
+ request: {
27
+ query,
28
+ + variables: (requestVariables) => true
29
+ },
30
+ - variableMatcher: (requestVariables) => true
31
+ }
32
+ ]);
33
+ ```
34
+
35
+ - [#12526](https://github.com/apollographql/apollo-client/pull/12526) [`391af1d`](https://github.com/apollographql/apollo-client/commit/391af1dd733219b7e1e14cfff9d5e3ce3967242f) Thanks [@phryneas](https://github.com/phryneas)! - The `@apollo/client` and `@apollo/client/core` entry points are now equal.
36
+ In the next major, the `@apollo/client/core` entry point will be removed.
37
+ Please change imports over from `@apollo/client/core` to `@apollo/client`.
38
+
39
+ - [#12525](https://github.com/apollographql/apollo-client/pull/12525) [`8785186`](https://github.com/apollographql/apollo-client/commit/87851863b94eebbc208671b17aeca73748ac41f6) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Throw an error when a client-only query is used in a mocked response passed to `MockLink`.
40
+
41
+ - [#12532](https://github.com/apollographql/apollo-client/pull/12532) [`ae0dcad`](https://github.com/apollographql/apollo-client/commit/ae0dcad89924e6b8090ca3182df30e528589b562) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Default the `delay` for all mocked responses passed to `MockLink` using `realisticDelay`. This ensures your test handles loading states by default and is not reliant on a specific timing.
42
+
43
+ If you would like to restore the old behavior, use a global default delay of `0`.
44
+
45
+ ```ts
46
+ MockLink.defaultOptions = {
47
+ delay: 0,
48
+ };
49
+ ```
50
+
51
+ - [#12530](https://github.com/apollographql/apollo-client/pull/12530) [`2973e2a`](https://github.com/apollographql/apollo-client/commit/2973e2a6e6fd81fa59b769d84c252c98ca69440d) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Remove `newData` option for mocked responses passed to `MockLink` or the `mocks` option on `MockedProvider`. This option was undocumented and was nearly identical to using the `result` option as a callback.
52
+
53
+ To replicate the old behavior of `newData`, use `result` as a callback and add the `maxUsageCount` option with a value set to `Number.POSITIVE_INFINITY`.
54
+
55
+ **with `MockLink`**
56
+
57
+ ```diff
58
+ new MockLink([
59
+ {
60
+ request: { query, variables },
61
+ - newData: (variables) => ({ data: { greeting: "Hello " + variables.greeting } }),
62
+ + result: (variables) => ({ data: { greeting: "Hello " + variables.greeting } }),
63
+ + maxUsageCount: Number.POSITIVE_INFINITY,
64
+ }
65
+ ])
66
+ ```
67
+
68
+ **with `MockedProvider`**
69
+
70
+ ```diff
71
+ <MockedProvider
72
+ mocks={[
73
+ {
74
+ request: { query, variables },
75
+ - newData: (variables) => ({ data: { greeting: "Hello " + variables.greeting } }),
76
+ + result: (variables) => ({ data: { greeting: "Hello " + variables.greeting } }),
77
+ + maxUsageCount: Number.POSITIVE_INFINITY,
78
+ }
79
+ ]}
80
+ />
81
+ ```
82
+
83
+ ### Minor Changes
84
+
85
+ - [#12532](https://github.com/apollographql/apollo-client/pull/12532) [`ae0dcad`](https://github.com/apollographql/apollo-client/commit/ae0dcad89924e6b8090ca3182df30e528589b562) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Allow mocked responses passed to `MockLink` to accept a callback for the `delay` option. The `delay` callback will be given the current operation which can be used to determine what delay should be used for the mock.
86
+
87
+ - [#12532](https://github.com/apollographql/apollo-client/pull/12532) [`ae0dcad`](https://github.com/apollographql/apollo-client/commit/ae0dcad89924e6b8090ca3182df30e528589b562) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Introduce a new `realisticDelay` helper function for use with the `delay` callback for mocked responses used with `MockLink`. `realisticDelay` will generate a random value between 20 and 50ms to provide an experience closer to unpredictable network latency. `realisticDelay` can be configured with a `min` and `max` to set different thresholds if the defaults are not sufficient.
88
+
89
+ ```ts
90
+ import { realisticDelay } from "@apollo/client/testing";
91
+
92
+ new MockLink([
93
+ {
94
+ request: { query },
95
+ result: { data: { greeting: "Hello" } },
96
+ delay: realisticDelay(),
97
+ },
98
+ {
99
+ request: { query },
100
+ result: { data: { greeting: "Hello" } },
101
+ delay: realisticDelay({ min: 10, max: 100 }),
102
+ },
103
+ ]);
104
+ ```
105
+
106
+ - [#12532](https://github.com/apollographql/apollo-client/pull/12532) [`ae0dcad`](https://github.com/apollographql/apollo-client/commit/ae0dcad89924e6b8090ca3182df30e528589b562) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add ability to specify a default `delay` for all mocked responses passed to `MockLink`. This `delay` can be configured globally (all instances of `MockLink` will use the global defaults), or per-instance (all mocks in a single instance will use the defaults). A `delay` defined on a single mock will supercede all default delays. Per-instance defaults supercede global defaults.
107
+
108
+ **Global defaults**
109
+
110
+ ```ts
111
+ MockLink.defaultOptions = {
112
+ // Use a default delay of 20ms for all mocks in all instances without a specified delay
113
+ delay: 20,
114
+
115
+ // altenatively use a callback which will be executed for each mock
116
+ delay: () => getRandomNumber(),
117
+
118
+ // or use the built-in `realisticDelay`. This is the default
119
+ delay: realisticDelay(),
120
+ };
121
+ ```
122
+
123
+ **Per-instance defaults**
124
+
125
+ ```ts
126
+ new MockLink(
127
+ [
128
+ // Use the default delay
129
+ {
130
+ request: { query },
131
+ result: { data: { greeting: "Hello" } },
132
+ },
133
+ {
134
+ request: { query },
135
+ result: { data: { greeting: "Hello" } },
136
+ // Override the default for this mock
137
+ delay: 10,
138
+ },
139
+ ],
140
+ {
141
+ defaultOptions: {
142
+ // Use a default delay of 20ms for all mocks without a specified delay
143
+ delay: 20,
144
+
145
+ // altenatively use a callback which will be executed for each mock
146
+ delay: () => getRandomNumber(),
147
+
148
+ // or use the built-in `realisticDelay`. This is the default
149
+ delay: realisticDelay(),
150
+ },
151
+ }
152
+ );
153
+ ```
154
+
155
+ ## 4.0.0-alpha.7
156
+
157
+ ### Major Changes
158
+
159
+ - [#12513](https://github.com/apollographql/apollo-client/pull/12513) [`9c3207c`](https://github.com/apollographql/apollo-client/commit/9c3207c44ddad1f8b845c09495d6c070ace8de7b) Thanks [@phryneas](https://github.com/phryneas)! - Removed the `@apollo/client/react/context` and `@apollo/client/react/hooks` entry points. Please use `@apollo/client/react` instead.
160
+
161
+ - [#12513](https://github.com/apollographql/apollo-client/pull/12513) [`9c3207c`](https://github.com/apollographql/apollo-client/commit/9c3207c44ddad1f8b845c09495d6c070ace8de7b) Thanks [@phryneas](https://github.com/phryneas)! - Removed the `@apollo/client/react/parser` entry point. There is no replacement.
162
+
163
+ ### Patch Changes
164
+
165
+ - [#12513](https://github.com/apollographql/apollo-client/pull/12513) [`9c3207c`](https://github.com/apollographql/apollo-client/commit/9c3207c44ddad1f8b845c09495d6c070ace8de7b) Thanks [@phryneas](https://github.com/phryneas)! - Removed the `parser` cache. The functionality has been replaced in a way that doesn't need caching.
166
+
3
167
  ## 4.0.0-alpha.6
4
168
 
5
169
  ### Major Changes
@@ -595,6 +759,20 @@
595
759
 
596
760
  - [#12384](https://github.com/apollographql/apollo-client/pull/12384) [`6aa6fd3`](https://github.com/apollographql/apollo-client/commit/6aa6fd316cfdb31ebbe3e3133cca2965604e7ca1) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Don't emit a partial cache result from `cache-only` queries when `returnPartialData` is `false`.
597
761
 
762
+ ## 3.13.7
763
+
764
+ ### Patch Changes
765
+
766
+ - [#12540](https://github.com/apollographql/apollo-client/pull/12540) [`0098932`](https://github.com/apollographql/apollo-client/commit/009893220934081f6e5733bff5863c768a597117) Thanks [@phryneas](https://github.com/phryneas)! - Refactor: Move notification scheduling logic from `QueryInfo` to `ObservableQuery`
767
+
768
+ - [#12540](https://github.com/apollographql/apollo-client/pull/12540) [`0098932`](https://github.com/apollographql/apollo-client/commit/009893220934081f6e5733bff5863c768a597117) Thanks [@phryneas](https://github.com/phryneas)! - Refactored cache emit logic for ObservableQuery. This should be an invisible change.
769
+
770
+ ## 3.13.6
771
+
772
+ ### Patch Changes
773
+
774
+ - [#12285](https://github.com/apollographql/apollo-client/pull/12285) [`cdc55ff`](https://github.com/apollographql/apollo-client/commit/cdc55ff54bf4c83ec8571508ec4bf8156af1bc97) Thanks [@phryneas](https://github.com/phryneas)! - keep ObservableQuery created by useQuery non-active before it is first subscribed
775
+
598
776
  ## 3.13.5
599
777
 
600
778
  ### Patch Changes
@@ -94,7 +94,7 @@ class ApolloCache {
94
94
  if (environment_1.__DEV__) {
95
95
  const actualFragmentName = fragmentName || (0, utilities_1.getFragmentDefinition)(fragment).name.value;
96
96
  if (!id) {
97
- __DEV__ && invariant_1.invariant.warn(96, actualFragmentName);
97
+ __DEV__ && invariant_1.invariant.warn(94, actualFragmentName);
98
98
  }
99
99
  }
100
100
  const diffOptions = {