@apollo/client 4.3.0-alpha.0 → 4.3.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (392) hide show
  1. package/CHANGELOG.md +490 -0
  2. package/README.md +3 -7
  3. package/__cjs/cache/core/Scalar.cjs +36 -0
  4. package/__cjs/cache/core/Scalar.cjs.map +1 -0
  5. package/__cjs/cache/core/Scalar.d.cts +20 -0
  6. package/__cjs/cache/core/cache.cjs +32 -1
  7. package/__cjs/cache/core/cache.cjs.map +1 -1
  8. package/__cjs/cache/core/cache.d.cts +89 -6
  9. package/__cjs/cache/core/types/Cache.d.cts +25 -0
  10. package/__cjs/cache/index.cjs +3 -1
  11. package/__cjs/cache/index.cjs.map +1 -1
  12. package/__cjs/cache/index.d.cts +3 -2
  13. package/__cjs/cache/inmemory/entityStore.cjs +48 -5
  14. package/__cjs/cache/inmemory/entityStore.cjs.map +1 -1
  15. package/__cjs/cache/inmemory/entityStore.d.cts +3 -0
  16. package/__cjs/cache/inmemory/helpers.d.cts +9 -1
  17. package/__cjs/cache/inmemory/inMemoryCache.cjs +83 -4
  18. package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
  19. package/__cjs/cache/inmemory/inMemoryCache.d.cts +44 -5
  20. package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
  21. package/__cjs/cache/inmemory/policies.cjs +35 -6
  22. package/__cjs/cache/inmemory/policies.cjs.map +1 -1
  23. package/__cjs/cache/inmemory/policies.d.cts +4 -1
  24. package/__cjs/cache/inmemory/readFromStore.cjs +490 -49
  25. package/__cjs/cache/inmemory/readFromStore.cjs.map +1 -1
  26. package/__cjs/cache/inmemory/readFromStore.d.cts +11 -2
  27. package/__cjs/cache/inmemory/types.d.cts +29 -4
  28. package/__cjs/cache/inmemory/writeToStore.cjs +6 -6
  29. package/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
  30. package/__cjs/core/ApolloClient.cjs +37 -38
  31. package/__cjs/core/ApolloClient.cjs.map +1 -1
  32. package/__cjs/core/ApolloClient.d.cts +44 -10
  33. package/__cjs/core/ObservableQuery.cjs +228 -76
  34. package/__cjs/core/ObservableQuery.cjs.map +1 -1
  35. package/__cjs/core/ObservableQuery.d.cts +16 -8
  36. package/__cjs/core/QueryInfo.cjs +178 -190
  37. package/__cjs/core/QueryInfo.cjs.map +1 -1
  38. package/__cjs/core/QueryInfo.d.cts +17 -22
  39. package/__cjs/core/QueryManager.cjs +88 -59
  40. package/__cjs/core/QueryManager.cjs.map +1 -1
  41. package/__cjs/core/QueryManager.d.cts +1 -3
  42. package/__cjs/core/RefetchEventManager.cjs +3 -3
  43. package/__cjs/core/dataStateErrorCache.cjs +12 -0
  44. package/__cjs/core/dataStateErrorCache.cjs.map +1 -0
  45. package/__cjs/core/dataStateErrorCache.d.cts +3 -0
  46. package/__cjs/core/index.cjs +2 -1
  47. package/__cjs/core/index.cjs.map +1 -1
  48. package/__cjs/core/index.d.cts +4 -3
  49. package/__cjs/core/types.d.cts +12 -6
  50. package/__cjs/incremental/GraphQLCodegenIncremental.cjs +3 -0
  51. package/__cjs/incremental/GraphQLCodegenIncremental.cjs.map +1 -0
  52. package/__cjs/incremental/GraphQLCodegenIncremental.d.cts +55 -0
  53. package/__cjs/incremental/handlers/defer20220824.cjs.map +1 -1
  54. package/__cjs/incremental/handlers/defer20220824.d.cts +2 -4
  55. package/__cjs/incremental/handlers/graphql17Alpha9.cjs +47 -16
  56. package/__cjs/incremental/handlers/graphql17Alpha9.cjs.map +1 -1
  57. package/__cjs/incremental/handlers/graphql17Alpha9.d.cts +29 -6
  58. package/__cjs/incremental/handlers/notImplemented.cjs +1 -1
  59. package/__cjs/incremental/index.cjs.map +1 -1
  60. package/__cjs/incremental/index.d.cts +1 -0
  61. package/__cjs/incremental/internal/types.cjs +3 -0
  62. package/__cjs/incremental/internal/types.cjs.map +1 -0
  63. package/__cjs/incremental/internal/types.d.cts +17 -0
  64. package/__cjs/incremental/types.d.cts +55 -4
  65. package/__cjs/invariantErrorCodes.cjs +167 -112
  66. package/__cjs/link/core/ApolloLink.cjs +3 -3
  67. package/__cjs/link/http/checkFetcher.cjs +1 -1
  68. package/__cjs/link/http/parseAndCheckHttpResponse.cjs +2 -2
  69. package/__cjs/link/http/parseAndCheckHttpResponse.cjs.map +1 -1
  70. package/__cjs/link/persisted-queries/index.cjs +2 -2
  71. package/__cjs/link/ws/index.cjs +1 -1
  72. package/__cjs/local-state/LocalState.cjs +11 -11
  73. package/__cjs/masking/internal/types.d.cts +1 -2
  74. package/__cjs/masking/maskDefinition.cjs +2 -2
  75. package/__cjs/masking/maskFragment.cjs +2 -2
  76. package/__cjs/masking/maskOperation.cjs +1 -1
  77. package/__cjs/masking/utils.cjs +3 -3
  78. package/__cjs/react/context/ApolloContext.cjs +1 -1
  79. package/__cjs/react/context/ApolloProvider.cjs +1 -1
  80. package/__cjs/react/hooks/internal/validateSuspenseHookOptions.cjs +2 -2
  81. package/__cjs/react/hooks/useApolloClient.cjs +1 -1
  82. package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
  83. package/__cjs/react/hooks/useBackgroundQuery.d.cts +100 -47
  84. package/__cjs/react/hooks/useLazyQuery.cjs +2 -2
  85. package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
  86. package/__cjs/react/hooks/useLazyQuery.d.cts +39 -33
  87. package/__cjs/react/hooks/useLoadableQuery.cjs +2 -2
  88. package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
  89. package/__cjs/react/hooks/useLoadableQuery.d.cts +23 -15
  90. package/__cjs/react/hooks/useMutation.cjs.map +1 -1
  91. package/__cjs/react/hooks/useMutation.d.cts +10 -7
  92. package/__cjs/react/hooks/useQuery.cjs.map +1 -1
  93. package/__cjs/react/hooks/useQuery.d.cts +74 -32
  94. package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
  95. package/__cjs/react/hooks/useSubscription.cjs +1 -1
  96. package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
  97. package/__cjs/react/hooks/useSuspenseQuery.d.cts +83 -34
  98. package/__cjs/react/hooks/useSyncExternalStore.cjs +1 -1
  99. package/__cjs/react/internal/cache/QueryReference.cjs +1 -1
  100. package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
  101. package/__cjs/react/internal/types.d.cts +14 -3
  102. package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
  103. package/__cjs/react/query-preloader/createQueryPreloader.d.cts +20 -5
  104. package/__cjs/react/ssr/prerenderStatic.cjs +2 -2
  105. package/__cjs/react/types/deprecated.d.cts +5 -4
  106. package/__cjs/testing/core/mocking/mockLink.cjs +25 -5
  107. package/__cjs/testing/core/mocking/mockLink.cjs.map +1 -1
  108. package/__cjs/testing/core/mocking/mockLink.d.cts +1 -2
  109. package/__cjs/utilities/caching/sizes.cjs.map +1 -1
  110. package/__cjs/utilities/caching/sizes.d.cts +39 -1
  111. package/__cjs/utilities/graphql/DocumentTransform.cjs +1 -1
  112. package/__cjs/utilities/index.cjs.map +1 -1
  113. package/__cjs/utilities/index.d.cts +1 -0
  114. package/__cjs/utilities/internal/StreamArrayState.cjs +27 -0
  115. package/__cjs/utilities/internal/StreamArrayState.cjs.map +1 -0
  116. package/__cjs/utilities/internal/StreamArrayState.d.cts +12 -0
  117. package/__cjs/utilities/internal/addDeferFragmentLabels.cjs +33 -0
  118. package/__cjs/utilities/internal/addDeferFragmentLabels.cjs.map +1 -0
  119. package/__cjs/utilities/internal/addDeferFragmentLabels.d.cts +3 -0
  120. package/__cjs/utilities/internal/capitalize.cjs +12 -0
  121. package/__cjs/utilities/internal/capitalize.cjs.map +1 -0
  122. package/__cjs/utilities/internal/capitalize.d.cts +7 -0
  123. package/__cjs/utilities/internal/coerceScalarFieldsToParsed.cjs +69 -0
  124. package/__cjs/utilities/internal/coerceScalarFieldsToParsed.cjs.map +1 -0
  125. package/__cjs/utilities/internal/coerceScalarFieldsToParsed.d.cts +9 -0
  126. package/__cjs/utilities/internal/constants.cjs +20 -1
  127. package/__cjs/utilities/internal/constants.cjs.map +1 -1
  128. package/__cjs/utilities/internal/constants.d.cts +19 -0
  129. package/__cjs/utilities/internal/getDirectiveArgValue.cjs +19 -0
  130. package/__cjs/utilities/internal/getDirectiveArgValue.cjs.map +1 -0
  131. package/__cjs/utilities/internal/getDirectiveArgValue.d.cts +9 -0
  132. package/__cjs/utilities/internal/getFragmentDefinition.cjs +3 -3
  133. package/__cjs/utilities/internal/getFragmentFromSelection.cjs +2 -2
  134. package/__cjs/utilities/internal/getFragmentFromSelection.cjs.map +1 -1
  135. package/__cjs/utilities/internal/getFragmentQueryDocument.cjs +2 -2
  136. package/__cjs/utilities/internal/getMainDefinition.cjs +1 -1
  137. package/__cjs/utilities/internal/getMemoryInternals.cjs +6 -0
  138. package/__cjs/utilities/internal/getMemoryInternals.cjs.map +1 -1
  139. package/__cjs/utilities/internal/getMemoryInternals.d.cts +4 -0
  140. package/__cjs/utilities/internal/getQueryDefinition.cjs +1 -1
  141. package/__cjs/utilities/internal/getUnwrappedType.cjs +20 -0
  142. package/__cjs/utilities/internal/getUnwrappedType.cjs.map +1 -0
  143. package/__cjs/utilities/internal/getUnwrappedType.d.cts +8 -0
  144. package/__cjs/utilities/internal/index.cjs +25 -2
  145. package/__cjs/utilities/internal/index.cjs.map +1 -1
  146. package/__cjs/utilities/internal/index.d.cts +16 -1
  147. package/__cjs/utilities/internal/isDeferredFragment.cjs +38 -0
  148. package/__cjs/utilities/internal/isDeferredFragment.cjs.map +1 -0
  149. package/__cjs/utilities/internal/isDeferredFragment.d.cts +9 -0
  150. package/__cjs/utilities/internal/isStreamField.cjs +37 -0
  151. package/__cjs/utilities/internal/isStreamField.cjs.map +1 -0
  152. package/__cjs/utilities/internal/isStreamField.d.cts +9 -0
  153. package/__cjs/utilities/internal/isTypenameField.cjs +7 -0
  154. package/__cjs/utilities/internal/isTypenameField.cjs.map +1 -0
  155. package/__cjs/utilities/internal/isTypenameField.d.cts +3 -0
  156. package/__cjs/utilities/internal/makeStreamInfoTrie.cjs +17 -0
  157. package/__cjs/utilities/internal/makeStreamInfoTrie.cjs.map +1 -0
  158. package/__cjs/utilities/internal/makeStreamInfoTrie.d.cts +8 -0
  159. package/__cjs/utilities/internal/removeDirectivesFromDocument.cjs +1 -1
  160. package/__cjs/utilities/internal/shouldInclude.cjs +4 -4
  161. package/__cjs/utilities/internal/toDiffWithDataState.cjs +20 -0
  162. package/__cjs/utilities/internal/toDiffWithDataState.cjs.map +1 -0
  163. package/__cjs/utilities/internal/toDiffWithDataState.d.cts +8 -0
  164. package/__cjs/utilities/internal/types/DeferInfo.cjs +3 -0
  165. package/__cjs/utilities/internal/types/DeferInfo.cjs.map +1 -0
  166. package/__cjs/utilities/internal/types/DeferInfo.d.cts +10 -0
  167. package/__cjs/utilities/internal/types/Exact.cjs +3 -0
  168. package/__cjs/utilities/internal/types/Exact.cjs.map +1 -0
  169. package/__cjs/utilities/internal/types/Exact.d.cts +2 -0
  170. package/__cjs/utilities/internal/types/IsLooselyEqual.cjs +3 -0
  171. package/__cjs/utilities/internal/types/IsLooselyEqual.cjs.map +1 -0
  172. package/__cjs/utilities/internal/types/IsLooselyEqual.d.cts +10 -0
  173. package/__cjs/utilities/internal/types/IsNeverish.cjs +3 -0
  174. package/__cjs/utilities/internal/types/IsNeverish.cjs.map +1 -0
  175. package/__cjs/utilities/internal/types/IsNeverish.d.cts +4 -0
  176. package/__cjs/utilities/internal/types/StreamInfoTrie.d.cts +2 -0
  177. package/__cjs/utilities/internal/valueToObjectRepresentation.cjs +1 -1
  178. package/__cjs/utilities/policies/pagination.cjs.map +1 -1
  179. package/__cjs/utilities/policies/pagination.d.cts +1 -1
  180. package/__cjs/utilities/subscriptions/relay/index.cjs +1 -0
  181. package/__cjs/utilities/subscriptions/relay/index.cjs.map +1 -1
  182. package/__cjs/version.cjs +1 -1
  183. package/__cjs/version.cjs.map +1 -1
  184. package/cache/core/Scalar.d.ts +20 -0
  185. package/cache/core/Scalar.js +32 -0
  186. package/cache/core/Scalar.js.map +1 -0
  187. package/cache/core/cache.d.ts +89 -6
  188. package/cache/core/cache.js +33 -2
  189. package/cache/core/cache.js.map +1 -1
  190. package/cache/core/types/Cache.d.ts +25 -0
  191. package/cache/core/types/Cache.js.map +1 -1
  192. package/cache/index.d.ts +3 -2
  193. package/cache/index.js +1 -0
  194. package/cache/index.js.map +1 -1
  195. package/cache/inmemory/entityStore.d.ts +3 -0
  196. package/cache/inmemory/entityStore.js +49 -6
  197. package/cache/inmemory/entityStore.js.map +1 -1
  198. package/cache/inmemory/helpers.d.ts +9 -1
  199. package/cache/inmemory/inMemoryCache.d.ts +44 -5
  200. package/cache/inmemory/inMemoryCache.js +84 -5
  201. package/cache/inmemory/inMemoryCache.js.map +1 -1
  202. package/cache/inmemory/key-extractor.js +1 -1
  203. package/cache/inmemory/policies.d.ts +4 -1
  204. package/cache/inmemory/policies.js +35 -6
  205. package/cache/inmemory/policies.js.map +1 -1
  206. package/cache/inmemory/readFromStore.d.ts +11 -2
  207. package/cache/inmemory/readFromStore.js +486 -49
  208. package/cache/inmemory/readFromStore.js.map +1 -1
  209. package/cache/inmemory/types.d.ts +30 -5
  210. package/cache/inmemory/types.js.map +1 -1
  211. package/cache/inmemory/writeToStore.js +7 -7
  212. package/cache/inmemory/writeToStore.js.map +1 -1
  213. package/core/ApolloClient.d.ts +44 -10
  214. package/core/ApolloClient.js +37 -38
  215. package/core/ApolloClient.js.map +1 -1
  216. package/core/ObservableQuery.d.ts +16 -8
  217. package/core/ObservableQuery.js +225 -77
  218. package/core/ObservableQuery.js.map +1 -1
  219. package/core/QueryInfo.d.ts +18 -23
  220. package/core/QueryInfo.js +174 -190
  221. package/core/QueryInfo.js.map +1 -1
  222. package/core/QueryManager.d.ts +1 -3
  223. package/core/QueryManager.js +89 -60
  224. package/core/QueryManager.js.map +1 -1
  225. package/core/RefetchEventManager.js +3 -3
  226. package/core/dataStateErrorCache.d.ts +3 -0
  227. package/core/dataStateErrorCache.js +9 -0
  228. package/core/dataStateErrorCache.js.map +1 -0
  229. package/core/index.d.ts +4 -3
  230. package/core/index.js +1 -1
  231. package/core/index.js.map +1 -1
  232. package/core/types.d.ts +12 -6
  233. package/core/types.js.map +1 -1
  234. package/incremental/GraphQLCodegenIncremental.d.ts +55 -0
  235. package/incremental/GraphQLCodegenIncremental.js +2 -0
  236. package/incremental/GraphQLCodegenIncremental.js.map +1 -0
  237. package/incremental/handlers/defer20220824.d.ts +2 -4
  238. package/incremental/handlers/defer20220824.js.map +1 -1
  239. package/incremental/handlers/graphql17Alpha9.d.ts +29 -6
  240. package/incremental/handlers/graphql17Alpha9.js +48 -17
  241. package/incremental/handlers/graphql17Alpha9.js.map +1 -1
  242. package/incremental/handlers/notImplemented.js +1 -1
  243. package/incremental/index.d.ts +1 -0
  244. package/incremental/index.js.map +1 -1
  245. package/incremental/internal/types.d.ts +17 -0
  246. package/incremental/internal/types.js +2 -0
  247. package/incremental/internal/types.js.map +1 -0
  248. package/incremental/types.d.ts +55 -4
  249. package/incremental/types.js.map +1 -1
  250. package/invariantErrorCodes.js +167 -112
  251. package/link/core/ApolloLink.js +3 -3
  252. package/link/http/checkFetcher.js +1 -1
  253. package/link/http/parseAndCheckHttpResponse.js +2 -2
  254. package/link/http/parseAndCheckHttpResponse.js.map +1 -1
  255. package/link/persisted-queries/index.js +2 -2
  256. package/link/ws/index.js +1 -1
  257. package/local-state/LocalState.js +11 -11
  258. package/masking/internal/types.d.ts +1 -2
  259. package/masking/internal/types.js.map +1 -1
  260. package/masking/maskDefinition.js +2 -2
  261. package/masking/maskFragment.js +2 -2
  262. package/masking/maskOperation.js +1 -1
  263. package/masking/utils.js +3 -3
  264. package/package.json +1 -1
  265. package/react/context/ApolloContext.js +1 -1
  266. package/react/context/ApolloProvider.js +1 -1
  267. package/react/hooks/internal/validateSuspenseHookOptions.js +2 -2
  268. package/react/hooks/useApolloClient.js +1 -1
  269. package/react/hooks/useBackgroundQuery.d.ts +100 -47
  270. package/react/hooks/useBackgroundQuery.js.map +1 -1
  271. package/react/hooks/useLazyQuery.d.ts +39 -33
  272. package/react/hooks/useLazyQuery.js +2 -2
  273. package/react/hooks/useLazyQuery.js.map +1 -1
  274. package/react/hooks/useLoadableQuery.d.ts +23 -15
  275. package/react/hooks/useLoadableQuery.js +2 -2
  276. package/react/hooks/useLoadableQuery.js.map +1 -1
  277. package/react/hooks/useMutation.d.ts +10 -7
  278. package/react/hooks/useMutation.js.map +1 -1
  279. package/react/hooks/useQuery.d.ts +74 -32
  280. package/react/hooks/useQuery.js.map +1 -1
  281. package/react/hooks/useQueryRefHandlers.js.map +1 -1
  282. package/react/hooks/useSubscription.js +1 -1
  283. package/react/hooks/useSuspenseQuery.d.ts +83 -34
  284. package/react/hooks/useSuspenseQuery.js.map +1 -1
  285. package/react/hooks/useSyncExternalStore.js +1 -1
  286. package/react/hooks-compiled/internal/validateSuspenseHookOptions.js +2 -2
  287. package/react/hooks-compiled/useApolloClient.js +1 -1
  288. package/react/hooks-compiled/useBackgroundQuery.d.ts +100 -47
  289. package/react/hooks-compiled/useBackgroundQuery.js.map +1 -1
  290. package/react/hooks-compiled/useLazyQuery.d.ts +39 -33
  291. package/react/hooks-compiled/useLazyQuery.js +2 -2
  292. package/react/hooks-compiled/useLazyQuery.js.map +1 -1
  293. package/react/hooks-compiled/useLoadableQuery.d.ts +23 -15
  294. package/react/hooks-compiled/useLoadableQuery.js +2 -2
  295. package/react/hooks-compiled/useLoadableQuery.js.map +1 -1
  296. package/react/hooks-compiled/useMutation.d.ts +10 -7
  297. package/react/hooks-compiled/useMutation.js.map +1 -1
  298. package/react/hooks-compiled/useQuery.d.ts +74 -32
  299. package/react/hooks-compiled/useQuery.js.map +1 -1
  300. package/react/hooks-compiled/useQueryRefHandlers.js.map +1 -1
  301. package/react/hooks-compiled/useSubscription.js +1 -1
  302. package/react/hooks-compiled/useSuspenseQuery.d.ts +83 -34
  303. package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
  304. package/react/hooks-compiled/useSyncExternalStore.js +1 -1
  305. package/react/internal/cache/QueryReference.js +1 -1
  306. package/react/internal/cache/QueryReference.js.map +1 -1
  307. package/react/internal/types.d.ts +15 -4
  308. package/react/internal/types.js.map +1 -1
  309. package/react/query-preloader/createQueryPreloader.d.ts +20 -5
  310. package/react/query-preloader/createQueryPreloader.js.map +1 -1
  311. package/react/ssr/prerenderStatic.js +2 -2
  312. package/react/types/deprecated.d.ts +5 -4
  313. package/react/types/deprecated.js.map +1 -1
  314. package/testing/core/mocking/mockLink.d.ts +1 -2
  315. package/testing/core/mocking/mockLink.js +25 -5
  316. package/testing/core/mocking/mockLink.js.map +1 -1
  317. package/utilities/caching/sizes.d.ts +39 -1
  318. package/utilities/caching/sizes.js.map +1 -1
  319. package/utilities/graphql/DocumentTransform.js +1 -1
  320. package/utilities/index.d.ts +1 -0
  321. package/utilities/index.js.map +1 -1
  322. package/utilities/internal/StreamArrayState.d.ts +12 -0
  323. package/utilities/internal/StreamArrayState.js +23 -0
  324. package/utilities/internal/StreamArrayState.js.map +1 -0
  325. package/utilities/internal/addDeferFragmentLabels.d.ts +3 -0
  326. package/utilities/internal/addDeferFragmentLabels.js +30 -0
  327. package/utilities/internal/addDeferFragmentLabels.js.map +1 -0
  328. package/utilities/internal/capitalize.d.ts +7 -0
  329. package/utilities/internal/capitalize.js +9 -0
  330. package/utilities/internal/capitalize.js.map +1 -0
  331. package/utilities/internal/coerceScalarFieldsToParsed.d.ts +9 -0
  332. package/utilities/internal/coerceScalarFieldsToParsed.js +66 -0
  333. package/utilities/internal/coerceScalarFieldsToParsed.js.map +1 -0
  334. package/utilities/internal/constants.d.ts +19 -0
  335. package/utilities/internal/constants.js +19 -0
  336. package/utilities/internal/constants.js.map +1 -1
  337. package/utilities/internal/getDirectiveArgValue.d.ts +9 -0
  338. package/utilities/internal/getDirectiveArgValue.js +16 -0
  339. package/utilities/internal/getDirectiveArgValue.js.map +1 -0
  340. package/utilities/internal/getFragmentDefinition.js +3 -3
  341. package/utilities/internal/getFragmentFromSelection.js +2 -2
  342. package/utilities/internal/getFragmentFromSelection.js.map +1 -1
  343. package/utilities/internal/getFragmentQueryDocument.js +2 -2
  344. package/utilities/internal/getMainDefinition.js +1 -1
  345. package/utilities/internal/getMemoryInternals.d.ts +4 -0
  346. package/utilities/internal/getMemoryInternals.js +6 -0
  347. package/utilities/internal/getMemoryInternals.js.map +1 -1
  348. package/utilities/internal/getQueryDefinition.js +1 -1
  349. package/utilities/internal/getUnwrappedType.d.ts +8 -0
  350. package/utilities/internal/getUnwrappedType.js +17 -0
  351. package/utilities/internal/getUnwrappedType.js.map +1 -0
  352. package/utilities/internal/index.d.ts +16 -1
  353. package/utilities/internal/index.js +12 -1
  354. package/utilities/internal/index.js.map +1 -1
  355. package/utilities/internal/isDeferredFragment.d.ts +9 -0
  356. package/utilities/internal/isDeferredFragment.js +35 -0
  357. package/utilities/internal/isDeferredFragment.js.map +1 -0
  358. package/utilities/internal/isStreamField.d.ts +9 -0
  359. package/utilities/internal/isStreamField.js +34 -0
  360. package/utilities/internal/isStreamField.js.map +1 -0
  361. package/utilities/internal/isTypenameField.d.ts +3 -0
  362. package/utilities/internal/isTypenameField.js +4 -0
  363. package/utilities/internal/isTypenameField.js.map +1 -0
  364. package/utilities/internal/makeStreamInfoTrie.d.ts +8 -0
  365. package/utilities/internal/makeStreamInfoTrie.js +14 -0
  366. package/utilities/internal/makeStreamInfoTrie.js.map +1 -0
  367. package/utilities/internal/removeDirectivesFromDocument.js +1 -1
  368. package/utilities/internal/shouldInclude.js +4 -4
  369. package/utilities/internal/toDiffWithDataState.d.ts +8 -0
  370. package/utilities/internal/toDiffWithDataState.js +17 -0
  371. package/utilities/internal/toDiffWithDataState.js.map +1 -0
  372. package/utilities/internal/types/DeferInfo.d.ts +10 -0
  373. package/utilities/internal/types/DeferInfo.js +2 -0
  374. package/utilities/internal/types/DeferInfo.js.map +1 -0
  375. package/utilities/internal/types/Exact.d.ts +2 -0
  376. package/utilities/internal/types/Exact.js +2 -0
  377. package/utilities/internal/types/Exact.js.map +1 -0
  378. package/utilities/internal/types/IsLooselyEqual.d.ts +10 -0
  379. package/utilities/internal/types/IsLooselyEqual.js +2 -0
  380. package/utilities/internal/types/IsLooselyEqual.js.map +1 -0
  381. package/utilities/internal/types/IsNeverish.d.ts +4 -0
  382. package/utilities/internal/types/IsNeverish.js +2 -0
  383. package/utilities/internal/types/IsNeverish.js.map +1 -0
  384. package/utilities/internal/types/StreamInfoTrie.d.ts +2 -0
  385. package/utilities/internal/types/StreamInfoTrie.js.map +1 -1
  386. package/utilities/internal/valueToObjectRepresentation.js +1 -1
  387. package/utilities/policies/pagination.d.ts +1 -1
  388. package/utilities/policies/pagination.js.map +1 -1
  389. package/utilities/subscriptions/relay/index.js +1 -0
  390. package/utilities/subscriptions/relay/index.js.map +1 -1
  391. package/version.js +1 -1
  392. package/version.js.map +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,429 @@
1
1
  # @apollo/client
2
2
 
3
+ ## 4.3.0-alpha.10
4
+
5
+ ### Minor Changes
6
+
7
+ - [#13421](https://github.com/apollographql/apollo-client/pull/13421) [`d6197a4`](https://github.com/apollographql/apollo-client/commit/d6197a417ee7ed0c6e1dcc651c3d28ad7559a29c) Thanks [@jerelmiller](https://github.com/jerelmiller)! - The minimum supported TypeScript version is now 5.9.x.
8
+
9
+ - [#13337](https://github.com/apollographql/apollo-client/pull/13337) [`2df711f`](https://github.com/apollographql/apollo-client/commit/2df711fd6f889ca3a62779483243d909800cd0c7) Thanks [@jcostello-atlassian](https://github.com/jcostello-atlassian)! - Allow overriding the `from` input of `useFragment`, `useSuspenseFragment`, `readFragment`, `writeFragment` and related fragment APIs via a new `FromOptionValue` key on the `TypeOverrides` interface.
10
+
11
+ By default, `from` continues to accept `StoreObject | Reference | FragmentType<TData> | string`. Apps can now supply a stricter policy (for example, requiring `__typename` and disallowing nullish identifier values) without affecting `StoreObject`, `cache.identify`, `cache.modify` or optimistic writes.
12
+
13
+ ```ts
14
+ // apollo.d.ts
15
+ import "@apollo/client";
16
+ import type { HKT, StoreValue } from "@apollo/client/utilities";
17
+
18
+ type StrictFrom<TData extends { __typename: string }> =
19
+ | {
20
+ // the `__typename` has to match the one of the fragment type
21
+ __typename: TData["__typename"];
22
+ // `& {}` forces values to be "defined" so an explicit `undefined`
23
+ // (as well as `null`) is rejected.
24
+ [key: string]: Exclude<StoreValue, null | undefined> & {};
25
+ }
26
+ | { __ref: string }
27
+ | string
28
+ | null;
29
+
30
+ interface StrictFromHKT extends HKT {
31
+ arg1: { __typename: string }; // TData
32
+ return: StrictFrom<this["arg1"]>;
33
+ }
34
+
35
+ declare module "@apollo/client" {
36
+ export interface TypeOverrides {
37
+ FromOptionValue: StrictFromHKT;
38
+ }
39
+ }
40
+ ```
41
+
42
+ ## 4.3.0-alpha.9
43
+
44
+ ### Minor Changes
45
+
46
+ - [#13416](https://github.com/apollographql/apollo-client/pull/13416) [`f2d5d5a`](https://github.com/apollographql/apollo-client/commit/f2d5d5ac26f0ad19f1aaa315f92b19f268bd0509) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add `GraphQLCodegenIncremental` type overrides that assemble GraphQL Codegen `@defer` operation types when `dataState` is `"complete"`.
47
+
48
+ ## 4.3.0-alpha.8
49
+
50
+ ### Minor Changes
51
+
52
+ - [#13372](https://github.com/apollographql/apollo-client/pull/13372) [`e4cde69`](https://github.com/apollographql/apollo-client/commit/e4cde6999e64e81d8fbef42326a7b2e83d90aa10) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Parse scalar fields for `no-cache` queries.
53
+
54
+ ## 4.3.0-alpha.7
55
+
56
+ ### Minor Changes
57
+
58
+ - [#13406](https://github.com/apollographql/apollo-client/pull/13406) [`bd74ccb`](https://github.com/apollographql/apollo-client/commit/bd74ccb2f75bc434afc4f5172311b551266f8196) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Emit a development-only warning when a feud is detected between queries that overwrite each other's data. This should make it easier to detect when you need to select a key field or add a `merge` function to a field policy.
59
+
60
+ - [#13406](https://github.com/apollographql/apollo-client/pull/13406) [`bd74ccb`](https://github.com/apollographql/apollo-client/commit/bd74ccb2f75bc434afc4f5172311b551266f8196) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fixes an issue where cache feuds between queries selecting incompatible non-normalized data could return untransformed network values.
61
+
62
+ Apollo Client now always writes network results to the cache before delivering them, ensuring custom scalars and field `read` functions are applied. To prevent repeated refetches when competing queries repeatedly make each other's cache results incomplete, Apollo Client stops automatically refetching a query after it sees the same incomplete result again.
63
+
64
+ This may add one network request in these cache-feud scenarios.
65
+
66
+ ## 4.3.0-alpha.6
67
+
68
+ ### Minor Changes
69
+
70
+ - [#13405](https://github.com/apollographql/apollo-client/pull/13405) [`f923ab4`](https://github.com/apollographql/apollo-client/commit/f923ab422e1bcd35c1bcd2939f58dc3723508b55) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Field policy `read` and `merge` functions are now ignored when the field policy configures the `scalar` option. If a `read` or `merge` function is provided alongside `scalar`, a development-only warning is emitted.
71
+
72
+ ### Patch Changes
73
+
74
+ - [#13408](https://github.com/apollographql/apollo-client/pull/13408) [`7a5164d`](https://github.com/apollographql/apollo-client/commit/7a5164d3ce21b7f88f625588ec72dbce8ea33810) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix `dataState` to report `"streaming"` instead of `"partial"` when `returnPartialData` is `true` and the cache result is missing only `@defer` fields.
75
+
76
+ ## 4.3.0-alpha.5
77
+
78
+ ### Minor Changes
79
+
80
+ - [#13390](https://github.com/apollographql/apollo-client/pull/13390) [`90e338c`](https://github.com/apollographql/apollo-client/commit/90e338c3cd5ec1be23852cc5ef0ca6078a98f548) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix issue where sibling `@defer` fragments were pruned incorrectly when at least one of the `@defer` fragments wasn't delivered.
81
+
82
+ As a result of this change, a `label` argument is now added to all outgoing `@defer` directives when using the `GraphQL17Alpha9Handler` in order to disambiguate the `@defer` fragments from each other.
83
+
84
+ - [#13393](https://github.com/apollographql/apollo-client/pull/13393) [`434d25f`](https://github.com/apollographql/apollo-client/commit/434d25facdcb214cac4ee33abbe1f1fecd05637b) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Change when `@defer` fragments and `@stream` fields are pruned for `cache-first` and `cache-and-network` fetch policies to better match the network when the initial value contained a partial result:
85
+
86
+ - `cache-first`: prune undelivered `@defer` fragments or `@stream` items when the result is fetched from the network due to a partial result
87
+ - `cache-and-network`: prune undelivered `@defer` fragments or `@stream` items if the initial cache value was partial. If the first value emitted from the cache is complete, the results will not be pruned.
88
+
89
+ This makes the emitted results more predictable by following what the network has delivered and avoids some ambiguity in other edge cases.
90
+
91
+ For example, with a `cache-first` fetch policy where all `@defer` fields are written to the cache, but a non-deferred field is partial, the values emitted from the client previously looked like the following:
92
+
93
+ ```graphql
94
+ query {
95
+ user {
96
+ id
97
+ name
98
+ ... @defer {
99
+ email
100
+ }
101
+ }
102
+ }
103
+ ```
104
+
105
+ ```ts
106
+ // data written to the cache is missing name
107
+ { user: { id: 1, email: "user.cache@example.com" }}
108
+
109
+ // 1. empty because the result is partial
110
+ { data: undefined, dataState: "empty", ... }
111
+ // 2. returns all data because the cache contains a value for email
112
+ { data: { user: 1, name: "User", email: "user.cache@example.com" }, dataState: "complete" }
113
+ // 3. email updated from the server
114
+ { data: { user: 1, name: "User", email: "user.network@example.com" }, dataState: "complete" }
115
+ ```
116
+
117
+ Here the result is confusing because the initial value returned from the query was `undefined`, yet a complete result was returned after the initial chunk from the network returned (which did not contain `email`).
118
+
119
+ The cache values are now pruned if the network hasn't delivered them yet:
120
+
121
+ ```ts
122
+ // 1. empty because the result is partial
123
+ { data: undefined, dataState: "empty" }
124
+ // 2. email hasn't been delivered by the network so it gets pruned
125
+ { data: { user: 1, name: "User" }, dataState: "streaming" }
126
+ // 3. full result returned after the network streams the email field
127
+ { data: { user: 1, name: "User", email: "user.network@example.com" }, dataState: "complete" }
128
+ ```
129
+
130
+ This is especially helpful in situations where `@defer` boundaries that are never delivered due to errors prevent an awkward situation where the client would otherwise have to choose whether to serve the stale cache result from the cache, or prune the undelivered fragment on the final chunk.
131
+
132
+ ### Patch Changes
133
+
134
+ - [#13381](https://github.com/apollographql/apollo-client/pull/13381) [`9c73762`](https://github.com/apollographql/apollo-client/commit/9c73762b8e8f1d16885140df847b8222f16a39f4) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where a `network-only` query leaked partial cache data for `@defer` fragments that were not delivered by the network due to an error that bubbled to the `@defer` fragment boundary.
135
+
136
+ - [#13390](https://github.com/apollographql/apollo-client/pull/13390) [`90e338c`](https://github.com/apollographql/apollo-client/commit/90e338c3cd5ec1be23852cc5ef0ca6078a98f548) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where a sibling non-deferred fragment might be accidentally pruned when the `@defer` fragment hadn't been delivered.
137
+
138
+ - [#13403](https://github.com/apollographql/apollo-client/pull/13403) [`aaff7a8`](https://github.com/apollographql/apollo-client/commit/aaff7a8a833c261e0514488c493a18d51e07a983) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix issue where the wrong `dataState` was returned when there was nothing written to the cache and a `@defer` fragment was marked pending.
139
+
140
+ - [#13381](https://github.com/apollographql/apollo-client/pull/13381) [`9c73762`](https://github.com/apollographql/apollo-client/commit/9c73762b8e8f1d16885140df847b8222f16a39f4) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where a `@defer` query reported the `dataState` as `complete` instead of `streaming` when an error occurs on a deferred field that bubbled to the defer boundary.
141
+
142
+ - [#13373](https://github.com/apollographql/apollo-client/pull/13373) [`2551937`](https://github.com/apollographql/apollo-client/commit/25519374c7137dee7b1ddd4a70b28288936fcef0) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where a cache write in the middle of polling would remain as the query value if future poll requests returned deep equal results to previous polling results.
143
+
144
+ - [#13403](https://github.com/apollographql/apollo-client/pull/13403) [`aaff7a8`](https://github.com/apollographql/apollo-client/commit/aaff7a8a833c261e0514488c493a18d51e07a983) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix issue where setting `returnPartialData: true` might report the wrong `dataState` when partial data was written to the cache and `@defer` fragments were pending.
145
+
146
+ - [#13381](https://github.com/apollographql/apollo-client/pull/13381) [`9c73762`](https://github.com/apollographql/apollo-client/commit/9c73762b8e8f1d16885140df847b8222f16a39f4) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an invariant error thrown when a `@defer` boundary received a payload after it had already been marked complete.
147
+
148
+ ## 4.3.0-alpha.4
149
+
150
+ ### Patch Changes
151
+
152
+ - [#13347](https://github.com/apollographql/apollo-client/pull/13347) [`7d543d6`](https://github.com/apollographql/apollo-client/commit/7d543d6416688ed113295a69e73b706c097a0d31) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where `network-only` incremental queries could cause cache data to leak into the emitted result when a `@defer` or `@stream` boundary already had complete data in the cache. Cache data inside pending `@defer` objects and `@stream` arrays are now pruned so that only completed `@defer` or `@stream` boundaries are returned.
153
+
154
+ NOTE: This change only applies to `InMemoryCache` when using `GraphQL17Alpha9Handler`.
155
+
156
+ - [#13329](https://github.com/apollographql/apollo-client/pull/13329) [`1d581d2`](https://github.com/apollographql/apollo-client/commit/1d581d282fe223e4bf39ea5e7a3cbc44fdbf32b5) Thanks [@AmariahAK](https://github.com/AmariahAK)! - Cache diffs for incomplete queries no longer pay the cost of building a full `MissingFieldError` when the `missing` property is not accessed. The error object is now only constructed when the `missing` property is accessed the first time. This improves performance by avoiding a V8 stack capture when `missing` is ignored entirely.
157
+
158
+ As an additional small performance improvement, `JSON.stringify` is no longer used in the error message on objects whose cache ID is known. `JSON.stringify` is only used for non-normalized objects.
159
+
160
+ - [#13347](https://github.com/apollographql/apollo-client/pull/13347) [`7d543d6`](https://github.com/apollographql/apollo-client/commit/7d543d6416688ed113295a69e73b706c097a0d31) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where partial cache data could leak into intermediate incremental results. This could cause runtime crashes if you relied on the presence of values to determine whether the `@defer` data had streamed in or not.
161
+
162
+ ## 4.3.0-alpha.3
163
+
164
+ ### Minor Changes
165
+
166
+ - [#13324](https://github.com/apollographql/apollo-client/pull/13324) [`0abd8de`](https://github.com/apollographql/apollo-client/commit/0abd8de53a408c6b5925b2a909acde5179eaac46) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix the accuracy of `dataState` in complex incremental streaming scenarios, especially when combined with `returnPartialData: true`.
167
+
168
+ Prior to this change, all intermediate chunks used for both `@defer` and `@stream` directives returned a `dataState` of `streaming`, regardless of whether the actual data shape fit the definition of the `streaming` data state. The `streaming` data state represents an incomplete incremental response where the only holes in the data occur at `@defer` boundaries.
169
+
170
+ Let's use the following example of where the previous `dataState` fell down when combined with `returnPartialData`.
171
+
172
+ ```gql
173
+ query GreetingQuery {
174
+ greeting {
175
+ message
176
+ ... @defer {
177
+ recipient {
178
+ name
179
+ email
180
+ }
181
+ }
182
+ }
183
+ }
184
+ ```
185
+
186
+ 1. Scenario 1: partial data inside a `@defer` boundary written to the cache
187
+
188
+ Let's say the cache contained the following partial data:
189
+
190
+ ```ts
191
+ {
192
+ greeting: {
193
+ __typename: "Greeting",
194
+ recipient: {
195
+ __typename: "Person",
196
+ name: "John Doe",
197
+ },
198
+ },
199
+ };
200
+ ```
201
+
202
+ After the first chunk arrives from the server, the data looks like the following:
203
+
204
+ ```ts
205
+ {
206
+ greeting: {
207
+ __typename: "Greeting",
208
+ message: "Hello, John",
209
+ recipient: {
210
+ __typename: "Person",
211
+ name: "John Doe",
212
+ },
213
+ },
214
+ };
215
+ ```
216
+
217
+ This data is not `complete` because `recipient.email` is missing. This data is also not `streaming` because the data requirements in the `@defer` boundary are partially fulfilled due to the existence of `recipient`. This could lead to runtime crashes on `recipient.email` if you use the existence of `recipient` to detect whether data in the `@defer` boundary has streamed in or not. This change now accurately reports this as `partial` to ensure the field is marked as a partial field in `recipient`.
218
+
219
+ 2. Scenario 2: partial data written to the cache that fulfills the data requirements of the `@defer` boundary
220
+
221
+ Let's say the cache contained the following partial data:
222
+
223
+ ```ts
224
+ {
225
+ greeting: {
226
+ __typename: "Greeting",
227
+ recipient: {
228
+ __typename: "Person",
229
+ name: "John Doe",
230
+ email: "john@example.com",
231
+ },
232
+ },
233
+ };
234
+ ```
235
+
236
+ After the first chunk arrives from the server, the data looks like the following:
237
+
238
+ ```ts
239
+ {
240
+ greeting: {
241
+ __typename: "Greeting",
242
+ message: "Hello, John",
243
+ recipient: {
244
+ __typename: "Person",
245
+ name: "John Doe",
246
+ email: "john@example.com",
247
+ },
248
+ },
249
+ };
250
+ ```
251
+
252
+ In this case, the combination of the first chunk and the partial data in the cache now fulfills the data requirements of the query. Even though the server is still streaming data (`NetworkStatus.streaming`), we can report this as `dataState: "complete"` since it is safe to access data on all fields.
253
+
254
+ This change also means `@stream` queries by definition fulfill the data requirements of the query after the first chunk arrives since `@stream` operates on lists and contains no data holes. `@stream` queries now accurately report `dataState` as `complete` or `partial`, depending on whether the list mixes partial data with streamed list items.
255
+
256
+ As a result of this change, some cases where you'd previously see `dataState` reported as `"streaming"` are now reported as `partial` or `complete`.
257
+
258
+ If you use `dataState` to determine whether an incremental request is still in-flight, please use `networkStatus` instead to check for `NetworkStatus.streaming`. `dataState` is type narrowing feature and not intended to report the network status.
259
+
260
+ ### Patch Changes
261
+
262
+ - [#13324](https://github.com/apollographql/apollo-client/pull/13324) [`0abd8de`](https://github.com/apollographql/apollo-client/commit/0abd8de53a408c6b5925b2a909acde5179eaac46) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where field `read` functions were not applied to intermediate results while streaming `@defer` responses. `cache.diff` ran the `read` functions, but the transformed values were only applied to the emitted result when the updated cache result was considered complete. Intermediate chunks whose only holes were at `@defer` boundaries now correctly return the result of field `read` functions.
263
+
264
+ ```ts
265
+ new InMemoryCache({
266
+ typePolicies: {
267
+ Greeting: {
268
+ fields: {
269
+ message: {
270
+ read: (message) => message.toUpperCase(),
271
+ },
272
+ },
273
+ },
274
+ },
275
+ });
276
+
277
+ // query GreetingQuery {
278
+ // greeting {
279
+ // message
280
+ // ... @defer {
281
+ // recipient { name }
282
+ // }
283
+ // }
284
+ // }
285
+
286
+ // First chunk previously returned:
287
+ // { greeting: { message: "Hello world" } }
288
+ //
289
+ // Now correctly returns while still streaming:
290
+ // { greeting: { message: "HELLO WORLD" } }
291
+ ```
292
+
293
+ - [#13324](https://github.com/apollographql/apollo-client/pull/13324) [`0abd8de`](https://github.com/apollographql/apollo-client/commit/0abd8de53a408c6b5925b2a909acde5179eaac46) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue with `@stream` queries when using `returnPartialData: true` where the streamed list was truncated after the first incremental chunk when the list contained partial cache data. The list is no longer truncated and partial list items are now retained as incremental chunks arrive. The `dataState` is now reported as `partial` until the server has streamed enough of the list so that each list item fully satisfies the query.
294
+
295
+ This change also updates `@stream` queries so that they reported with `dataState: "complete` instead of `"streaming"` since it is safe to access all fields in the response.
296
+
297
+ ## 4.3.0-alpha.2
298
+
299
+ ### Minor Changes
300
+
301
+ - [#13274](https://github.com/apollographql/apollo-client/pull/13274) [`7b10078`](https://github.com/apollographql/apollo-client/commit/7b10078f4bcd8d82890ca438bf7355677fe2f841) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Adds `Scalar.fromGraphQLScalarType` helper to create a `Scalar` instance from an existing graphql.js `GraphQLScalarType`.
302
+
303
+ ```ts
304
+ import { GraphQLScalarType } from "graphql";
305
+ import { Scalar } from "@apollo/client";
306
+
307
+ const dateTimeScalarType = new GraphQLScalarType<Date, string>({
308
+ // ...
309
+ });
310
+
311
+ const dateTimeScalar = Scalar.fromGraphQLScalarType(dateTimeScalarType, {
312
+ is: (value) => value instanceof Date,
313
+ });
314
+ ```
315
+
316
+ - [#13252](https://github.com/apollographql/apollo-client/pull/13252) [`ed86234`](https://github.com/apollographql/apollo-client/commit/ed8623485683c38982c87278d1381412ef39a9db) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Adds the plumbing and types implementation for declaring custom scalars and configuring custom scalars in `InMemoryCache`.
317
+
318
+ You can declare custom scalar types with declaration merging on the `ApolloCache.Scalars` interface:
319
+
320
+ ```ts
321
+ // apollo.d.ts
322
+ import "@apollo/client";
323
+
324
+ declare module "@apollo/client" {
325
+ namespace ApolloCache {
326
+ interface Scalars {
327
+ Date: { serialized: string; parsed: Date };
328
+ }
329
+ }
330
+ }
331
+ ```
332
+
333
+ This enables the `scalars` option in `InMemoryCache`:
334
+
335
+ ```ts
336
+ import { Scalar } from "@apollo/client";
337
+
338
+ const cache = new InMemoryCache({
339
+ scalars: {
340
+ Date: new Scalar({
341
+ parse: (dateString) => new Date(dateString),
342
+ serialize: (date) => date.toISOString(),
343
+ is: (value) => value instanceof Date,
344
+ }),
345
+ },
346
+ });
347
+ ```
348
+
349
+ - [#13259](https://github.com/apollographql/apollo-client/pull/13259) [`ccaf686`](https://github.com/apollographql/apollo-client/commit/ccaf6867be15e413f08594b54b3516003e28c108) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Adds a `scalar` option to `InMemoryCache` field policies that tells the cache which scalar to use when parsing or serializing the field value.
350
+
351
+ ```ts
352
+ import { Scalar } from "@apollo/client";
353
+
354
+ new InMemoryCache({
355
+ scalars: {
356
+ DateTime: new Scalar({
357
+ parse: (dateString) => new Date(dateString),
358
+ serialize: (date) => date.toISOString(),
359
+ }),
360
+ },
361
+ typePolicies: {
362
+ Event: {
363
+ fields: {
364
+ startTime: {
365
+ // Parse this field using the DateTime scalar
366
+ scalar: "DateTime",
367
+ },
368
+ },
369
+ },
370
+ },
371
+ });
372
+ ```
373
+
374
+ This scalar definition is now used to properly parse or serialize the field value for cache reads and writes as well as `cache.extract()` and `cache.restore()`.
375
+
376
+ - [#13273](https://github.com/apollographql/apollo-client/pull/13273) [`0886de1`](https://github.com/apollographql/apollo-client/commit/0886de19ed67ca24bbcc075dcf5a94ba01589902) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Automatically serialize variables that include custom scalar values. This includes cache reads and writes as well as requests to the network.
377
+
378
+ For more complex input objects, a new `inputObjects` option is available to `InMemoryCache` that specifies where nested scalar fields are found.
379
+
380
+ ```ts
381
+ const cache = new InMemoryCache({
382
+ scalars: {
383
+ DateTime: new Scalar({
384
+ parse: (value) => new Date(value),
385
+ serialize: (value) => value.toISOString(),
386
+ is: (value) => value instanceof Date,
387
+ }),
388
+ },
389
+ inputObjects: {
390
+ EventFilter: {
391
+ fields: {
392
+ date: "DateTime",
393
+ },
394
+ },
395
+ },
396
+ });
397
+
398
+ const client = new ApolloClient({ cache, link });
399
+
400
+ await client.query({
401
+ query: gql`
402
+ query Event($filter: EventFilter!) {
403
+ event(filter: $filter) {
404
+ name
405
+ }
406
+ }
407
+ `,
408
+ variables: {
409
+ filter: {
410
+ date: new Date("2026-01-01T00:00:00.000Z"),
411
+ },
412
+ },
413
+ });
414
+
415
+ // The link receives:
416
+ // { filter: { date: "2026-01-01T00:00:00.000Z" } }
417
+ ```
418
+
419
+ - [#13252](https://github.com/apollographql/apollo-client/pull/13252) [`ed86234`](https://github.com/apollographql/apollo-client/commit/ed8623485683c38982c87278d1381412ef39a9db) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Adds the `getScalar` abstract method to `ApolloCache` that cache subclasses override to provide scalar behavior to Apollo Client. Defaults to unconditionally return `undefined` if not specified.
420
+
421
+ ## 4.3.0-alpha.1
422
+
423
+ ### Patch Changes
424
+
425
+ - [#13268](https://github.com/apollographql/apollo-client/pull/13268) [`419e2b5`](https://github.com/apollographql/apollo-client/commit/419e2b5bfe573d1eb4c3a0ff7aa9084e6aaa2f37) Thanks [@DaleSeo](https://github.com/DaleSeo)! - Align the remaining cache generic constraints with `Cache.Implementation`. The deprecated React mutation types (`MutationHookOptions`, `MutationFunctionOptions`, `MutationTuple`) and the internal `InternalRefetchQueriesOptions` and `QueryInfo` types still constrained their cache type parameter to `ApolloCache`, so they now match the rest of the overridable cache API.
426
+
3
427
  ## 4.3.0-alpha.0
4
428
 
5
429
  ### Minor Changes
@@ -35,6 +459,72 @@
35
459
  > [!NOTE]
36
460
  > Setting a cache type enforces that cache type in the `cache` option for the `ApolloClient` constructor.
37
461
 
462
+ ## 4.2.12
463
+
464
+ ### Patch Changes
465
+
466
+ - [#13400](https://github.com/apollographql/apollo-client/pull/13400) [`56ca81b`](https://github.com/apollographql/apollo-client/commit/56ca81b40962d1aeef3d753e562672dfed042ea2) Thanks [@QiRaining](https://github.com/QiRaining)! - Preserve multi-byte UTF-8 characters split across multipart response chunks.
467
+
468
+ ## 4.2.11
469
+
470
+ ### Patch Changes
471
+
472
+ - [#13398](https://github.com/apollographql/apollo-client/pull/13398) [`3dd3e9a`](https://github.com/apollographql/apollo-client/commit/3dd3e9a6f195ea5dd27a973f153a0538ccdffd20) Thanks [@phryneas](https://github.com/phryneas)! - Fix type signature of some `DocumentationTypes` to fix their display in our documentation.
473
+
474
+ - [#13392](https://github.com/apollographql/apollo-client/pull/13392) [`d4f0771`](https://github.com/apollographql/apollo-client/commit/d4f0771976766b54e0a95a3d51b708b64eb3cfe0) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add a development-only warning when a network result is written to the cache but reading the query back from the cache returns a partial result. This usually points at a `merge` or `read` function that did not repair missing fields in the cache, which prevents Apollo Client from applying the cache result to the data received by the network.
475
+
476
+ ## 4.2.10
477
+
478
+ ### Patch Changes
479
+
480
+ - [#13385](https://github.com/apollographql/apollo-client/pull/13385) [`bfb674e`](https://github.com/apollographql/apollo-client/commit/bfb674ec0ac9cd296b7ea2992d9deebf68edaea9) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix accidental widening of the `client.mutate` return type when `optimisticResponse` was present.
481
+
482
+ - [#13382](https://github.com/apollographql/apollo-client/pull/13382) [`365373e`](https://github.com/apollographql/apollo-client/commit/365373e0a0b647e89183245c3904d58499aa63e1) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix result types widened when a query's variables had constant types (e.g. `TypedDocumentNode<Data, { type: "main" }>`). This caused options such as `returnPartialData` or `errorPolicy` to be reported as their widened types (e.g. `boolean`, `ErrorPolicy`) instead of the value that was passed which returned the wrong `data` and `dataState` types.
483
+
484
+ - [#13382](https://github.com/apollographql/apollo-client/pull/13382) [`365373e`](https://github.com/apollographql/apollo-client/commit/365373e0a0b647e89183245c3904d58499aa63e1) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix issue where unknown options were permitted by TypeScript when passed alongside a valid option to APIs with modern signatures.
485
+
486
+ - [#13383](https://github.com/apollographql/apollo-client/pull/13383) [`5840f50`](https://github.com/apollographql/apollo-client/commit/5840f5014d0a6bb9b963801657cd68b0a1aba6c8) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Update the return type of `refetch`, `fetchMore` and `useLazyQuery`'s `execute` function on the provided `errorPolicy`. Previously these APIs all used the default type which typed `data` as `TData | undefined` and `error` as `ErrorLike | undefined`.
487
+
488
+ ## 4.2.9
489
+
490
+ ### Patch Changes
491
+
492
+ - [#13364](https://github.com/apollographql/apollo-client/pull/13364) [`2f383e7`](https://github.com/apollographql/apollo-client/commit/2f383e7e484ceaec72df205b52abf8430cc59891) Thanks [@atharv-sys32](https://github.com/atharv-sys32)! - Fix a bug where GraphQL variable default values were not applied during cache reads when variables with defaults were explicitly set to `undefined`. This caused `@include`/`@skip` directives to throw "Invalid variable referenced" errors when the variable was passed as `undefined` instead of being omitted entirely.
493
+
494
+ - [#13367](https://github.com/apollographql/apollo-client/pull/13367) [`2b39cc8`](https://github.com/apollographql/apollo-client/commit/2b39cc8b2e0a6b0a6c1dfc2f64fa2940c59b23bd) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where some `@export` queries would not react to cache updates when the fields keyed by exported variables were updated.
495
+
496
+ ## 4.2.8
497
+
498
+ ### Patch Changes
499
+
500
+ - [#13349](https://github.com/apollographql/apollo-client/pull/13349) [`501a33b`](https://github.com/apollographql/apollo-client/commit/501a33bba831828da0398c994662582054272743) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Prevent the `setTimeout` in `connectToDevtools` that shows the devtools suggestion from firing when the user agent does not match Chrome or Firefox. This check was previously done inside the `setTimeout` which meant the timer was scheduled for environments where we'd never show the message anyways. For test environments, this could cause flaky tests when that `setTimeout` outlived the tests and ran after any virtual DOM was torn down and removed.
501
+
502
+ ## 4.2.7
503
+
504
+ ### Patch Changes
505
+
506
+ - [#13320](https://github.com/apollographql/apollo-client/pull/13320) [`538c906`](https://github.com/apollographql/apollo-client/commit/538c906143c18dcc4fd9c29427413451fcd72c22) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Cleanup some unused internals. Please file an issue if you notice anything change.
507
+
508
+ ## 4.2.6
509
+
510
+ ### Patch Changes
511
+
512
+ - [#13315](https://github.com/apollographql/apollo-client/pull/13315) [`a406cc9`](https://github.com/apollographql/apollo-client/commit/a406cc9669246972a8f067462422aec716b6213b) Thanks [@fallintoplace](https://github.com/fallintoplace)! - Prevent relay multipart subscriptions from issuing a fetch request after serializing the request body fails.
513
+
514
+ - [#13307](https://github.com/apollographql/apollo-client/pull/13307) [`abd0781`](https://github.com/apollographql/apollo-client/commit/abd07814bbe80d9307458a450dd28addf1d38ef1) Thanks [@wolfie](https://github.com/wolfie)! - Speed up cache writes by avoiding a full AST `visit` of every written field to detect `@stream`. The check now runs only when the result carries stream info, and only inspects the field node's own directives. As a result, fields that merely contain `@stream` on a nested field are no longer treated as streamed themselves and now overwrite existing lists like regular fields instead of merging chunk-wise.
515
+
516
+ ## 4.2.5
517
+
518
+ ### Patch Changes
519
+
520
+ - [#13302](https://github.com/apollographql/apollo-client/pull/13302) [`bb75dd3`](https://github.com/apollographql/apollo-client/commit/bb75dd3a42bab21a0ff14c4482a5cb99a61843eb) Thanks [@tpict](https://github.com/tpict)! - Export `KeyArgsFunction` and `RelayFieldPolicy` types from public entrypoints.
521
+
522
+ ## 4.2.4
523
+
524
+ ### Patch Changes
525
+
526
+ - [#13281](https://github.com/apollographql/apollo-client/pull/13281) [`e4df809`](https://github.com/apollographql/apollo-client/commit/e4df809e87a1d2b72728df53327f531f65411ed3) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fixes an issue where `client.readFragment` and `client.readQuery` ignored the `optimistic` option when passed in the options object.
527
+
38
528
  ## 4.2.3
39
529
 
40
530
  ### Patch Changes
package/README.md CHANGED
@@ -93,13 +93,9 @@ We regularly update our [public roadmap](https://github.com/apollographql/apollo
93
93
 
94
94
  Join these live events to meet other GraphQL users and learn more:
95
95
 
96
- 🎪 [**GraphQL Summit 2025**](https://summit.graphql.com?utm_source=github&utm_medium=apollographql_apollo-client&utm_campaign=readme)
97
- Oct 6-8, 2025 • San Francisco
98
- _1000+ engineers, talks, workshops, and office hours_
99
-
100
- 🌟 [**GraphQLConf 2025**](https://graphql.org/conf/2025)
101
- Sep 8-10, 2025 • Amsterdam
102
- _Celebrating 10 Years of GraphQL_
96
+ 🎪 [**Apollo Summit 2026**](https://apollosummit.dev/)
97
+ Oct 6-8, 2026 • San Francisco
98
+ _1000+ engineers, talks, workshops, and office hours_
103
99
 
104
100
  [**View All Events →**](https://www.apollographql.com/events?utm_source=github&utm_medium=apollographql_apollo-client&utm_campaign=readme)
105
101
 
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Scalar = void 0;
4
+ class Scalar {
5
+ options;
6
+ static fromGraphQLScalarType(scalarType, options) {
7
+ return new Scalar({
8
+ ...options,
9
+ parse: scalarType.parseValue,
10
+ serialize: scalarType.serialize,
11
+ });
12
+ }
13
+ constructor(options) {
14
+ this.options = options;
15
+ }
16
+ parse(value) {
17
+ return this.options.parse(value);
18
+ }
19
+ serialize(value) {
20
+ return this.options.serialize(value);
21
+ }
22
+ coerceToParsed(value) {
23
+ return this.is(value) ? value : this.parse(value);
24
+ }
25
+ coerceToSerialized(value) {
26
+ return this.is(value) ? this.serialize(value) : value;
27
+ }
28
+ is(value) {
29
+ if (this.options.is) {
30
+ return this.options.is(value);
31
+ }
32
+ return typeof value === "object" && value !== null;
33
+ }
34
+ }
35
+ exports.Scalar = Scalar;
36
+ //# sourceMappingURL=Scalar.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Scalar.cjs","sources":["../../../../src/cache/core/Scalar.ts"],"sourcesContent":["import type { GraphQLScalarType } from \"graphql\";\n\nimport type { NoInfer } from \"@apollo/client/utilities/internal\";\n\nexport declare namespace Scalar {\n export interface Options<TSerialized, TParsed> {\n // We use method syntax to ensure the functions are bivariant. This lets\n // users declare scalars using\n // `extends Record<string, { serialized: unknown; parsed: unknown }>` while\n // allowing specific scalar overrides.\n parse(serializedValue: TSerialized): NoInfer<TParsed>;\n serialize(parsedValue: TParsed): NoInfer<TSerialized>;\n is?(value: TSerialized | TParsed): boolean;\n }\n}\n\nexport class Scalar<TSerialized, TParsed> {\n private options: Scalar.Options<TSerialized, TParsed>;\n\n static fromGraphQLScalarType<TSerialized, TParsed>(\n scalarType: GraphQLScalarType<TParsed, TSerialized>,\n options?: Pick<Scalar.Options<NoInfer<TSerialized>, NoInfer<TParsed>>, \"is\">\n ): Scalar<TSerialized, TParsed> {\n return new Scalar<TSerialized, TParsed>({\n ...options,\n parse: scalarType.parseValue,\n serialize: scalarType.serialize,\n });\n }\n\n constructor(options: Scalar.Options<TSerialized, TParsed>) {\n this.options = options;\n }\n\n parse(value: TSerialized): TParsed {\n return this.options.parse(value);\n }\n\n serialize(value: TParsed): TSerialized {\n return this.options.serialize(value);\n }\n\n coerceToParsed(value: TSerialized | TParsed): TParsed {\n return this.is(value) ? value : this.parse(value);\n }\n\n coerceToSerialized(value: TSerialized | TParsed): TSerialized {\n return this.is(value) ? this.serialize(value) : value;\n }\n\n is(value: TSerialized | TParsed): value is TParsed {\n if (this.options.is) {\n return this.options.is(value);\n }\n\n return typeof value === \"object\" && value !== null;\n }\n}\n"],"names":[],"mappings":"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"}
@@ -0,0 +1,20 @@
1
+ import type { GraphQLScalarType } from "graphql";
2
+ import type { NoInfer } from "@apollo/client/utilities/internal";
3
+ export declare namespace Scalar {
4
+ interface Options<TSerialized, TParsed> {
5
+ parse(serializedValue: TSerialized): NoInfer<TParsed>;
6
+ serialize(parsedValue: TParsed): NoInfer<TSerialized>;
7
+ is?(value: TSerialized | TParsed): boolean;
8
+ }
9
+ }
10
+ export declare class Scalar<TSerialized, TParsed> {
11
+ private options;
12
+ static fromGraphQLScalarType<TSerialized, TParsed>(scalarType: GraphQLScalarType<TParsed, TSerialized>, options?: Pick<Scalar.Options<NoInfer<TSerialized>, NoInfer<TParsed>>, "is">): Scalar<TSerialized, TParsed>;
13
+ constructor(options: Scalar.Options<TSerialized, TParsed>);
14
+ parse(value: TSerialized): TParsed;
15
+ serialize(value: TParsed): TSerialized;
16
+ coerceToParsed(value: TSerialized | TParsed): TParsed;
17
+ coerceToSerialized(value: TSerialized | TParsed): TSerialized;
18
+ is(value: TSerialized | TParsed): value is TParsed;
19
+ }
20
+ //# sourceMappingURL=Scalar.d.cts.map
@@ -22,6 +22,37 @@ class ApolloCache {
22
22
  lookupFragment(fragmentName) {
23
23
  return null;
24
24
  }
25
+ /**
26
+ * Get the root typename value for an operation type.
27
+ *
28
+ * @defaultValue Query, Mutation, or Subscription
29
+ */
30
+ getRootTypename(operation) {
31
+ return (0, internal_1.capitalize)(operation);
32
+ }
33
+ // Custom scalars API
34
+ getScalar(key) {
35
+ return;
36
+ }
37
+ /** Get a scalar instance for a field in a type */
38
+ getScalarForField(typename, fieldName) {
39
+ return;
40
+ }
41
+ /**
42
+ * Determines whether the cache configures custom scalars or not. This allows
43
+ * Apollo Client to skip processing results unnecessarily when there is
44
+ * nothing to transform into a scalar value.
45
+ *
46
+ * @remarks
47
+ * 3rd party caches should override this method if they have the ability to
48
+ * configure scalar implementations.
49
+ */
50
+ configuresScalars() {
51
+ return false;
52
+ }
53
+ serializeVariables(document, variables) {
54
+ return variables;
55
+ }
25
56
  // Transactional API
26
57
  /**
27
58
  * Executes multiple cache operations as a single batch, ensuring that
@@ -140,7 +171,7 @@ class ApolloCache {
140
171
  if (environment_1.__DEV__) {
141
172
  const actualFragmentName = fragmentName || (0, internal_1.getFragmentDefinition)(fragment).name.value;
142
173
  if (id === undefined) {
143
- __DEV__ && invariant_1.invariant.warn(118, actualFragmentName);
174
+ __DEV__ && invariant_1.invariant.warn(123, actualFragmentName);
144
175
  }
145
176
  }
146
177
  return id;