@apollo/client 4.0.9 → 4.1.3

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 (374) hide show
  1. package/CHANGELOG.md +453 -0
  2. package/__cjs/cache/core/cache.cjs +217 -52
  3. package/__cjs/cache/core/cache.cjs.map +1 -1
  4. package/__cjs/cache/core/cache.d.cts +141 -25
  5. package/__cjs/cache/core/types/Cache.d.cts +78 -17
  6. package/__cjs/cache/index.cjs.map +1 -1
  7. package/__cjs/cache/index.d.cts +1 -1
  8. package/__cjs/cache/inmemory/entityStore.cjs +6 -4
  9. package/__cjs/cache/inmemory/entityStore.cjs.map +1 -1
  10. package/__cjs/cache/inmemory/fragmentRegistry.cjs +5 -0
  11. package/__cjs/cache/inmemory/fragmentRegistry.cjs.map +1 -1
  12. package/__cjs/cache/inmemory/helpers.d.cts +1 -1
  13. package/__cjs/cache/inmemory/inMemoryCache.cjs +62 -1
  14. package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
  15. package/__cjs/cache/inmemory/inMemoryCache.d.cts +48 -0
  16. package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
  17. package/__cjs/cache/inmemory/key-extractor.cjs.map +1 -1
  18. package/__cjs/cache/inmemory/policies.cjs +76 -17
  19. package/__cjs/cache/inmemory/policies.cjs.map +1 -1
  20. package/__cjs/cache/inmemory/policies.d.cts +33 -6
  21. package/__cjs/cache/inmemory/readFromStore.cjs +9 -8
  22. package/__cjs/cache/inmemory/readFromStore.cjs.map +1 -1
  23. package/__cjs/cache/inmemory/types.d.cts +3 -0
  24. package/__cjs/cache/inmemory/writeToStore.cjs +25 -10
  25. package/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
  26. package/__cjs/cache/inmemory/writeToStore.d.cts +1 -1
  27. package/__cjs/core/ApolloClient.cjs +38 -58
  28. package/__cjs/core/ApolloClient.cjs.map +1 -1
  29. package/__cjs/core/ApolloClient.d.cts +166 -27
  30. package/__cjs/core/ObservableQuery.cjs +178 -131
  31. package/__cjs/core/ObservableQuery.cjs.map +1 -1
  32. package/__cjs/core/ObservableQuery.d.cts +2 -0
  33. package/__cjs/core/QueryInfo.cjs +9 -1
  34. package/__cjs/core/QueryInfo.cjs.map +1 -1
  35. package/__cjs/core/QueryInfo.d.cts +4 -3
  36. package/__cjs/core/QueryManager.cjs +47 -25
  37. package/__cjs/core/QueryManager.cjs.map +1 -1
  38. package/__cjs/core/QueryManager.d.cts +19 -2
  39. package/__cjs/incremental/handlers/defer20220824.cjs +44 -19
  40. package/__cjs/incremental/handlers/defer20220824.cjs.map +1 -1
  41. package/__cjs/incremental/handlers/defer20220824.d.cts +15 -7
  42. package/__cjs/incremental/handlers/graphql17Alpha9.cjs +227 -0
  43. package/__cjs/incremental/handlers/graphql17Alpha9.cjs.map +1 -0
  44. package/__cjs/incremental/handlers/graphql17Alpha9.d.cts +98 -0
  45. package/__cjs/incremental/handlers/notImplemented.cjs +1 -1
  46. package/__cjs/incremental/handlers/notImplemented.cjs.map +1 -1
  47. package/__cjs/incremental/index.cjs +3 -1
  48. package/__cjs/incremental/index.cjs.map +1 -1
  49. package/__cjs/incremental/index.d.cts +1 -0
  50. package/__cjs/incremental/types.d.cts +9 -0
  51. package/__cjs/invariantErrorCodes.cjs +83 -61
  52. package/__cjs/link/client-awareness/ClientAwarenessLink.cjs +13 -1
  53. package/__cjs/link/client-awareness/ClientAwarenessLink.cjs.map +1 -1
  54. package/__cjs/link/client-awareness/ClientAwarenessLink.d.cts +1 -1
  55. package/__cjs/link/core/ApolloLink.cjs +3 -3
  56. package/__cjs/link/error/index.cjs +1 -1
  57. package/__cjs/link/error/index.cjs.map +1 -1
  58. package/__cjs/link/error/index.d.cts +1 -1
  59. package/__cjs/link/http/checkFetcher.cjs +1 -1
  60. package/__cjs/link/http/parseAndCheckHttpResponse.cjs +2 -2
  61. package/__cjs/link/http/parseAndCheckHttpResponse.cjs.map +1 -1
  62. package/__cjs/link/persisted-queries/index.cjs +2 -2
  63. package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs +51 -50
  64. package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs.map +1 -1
  65. package/__cjs/link/remove-typename/removeTypenameFromVariables.d.cts +3 -0
  66. package/__cjs/link/schema/index.cjs +1 -1
  67. package/__cjs/link/schema/index.cjs.map +1 -1
  68. package/__cjs/link/schema/index.d.cts +1 -1
  69. package/__cjs/link/ws/index.cjs +1 -1
  70. package/__cjs/local-state/LocalState.cjs +29 -15
  71. package/__cjs/local-state/LocalState.cjs.map +1 -1
  72. package/__cjs/local-state/LocalState.d.cts +3 -2
  73. package/__cjs/masking/types.d.cts +2 -1
  74. package/__cjs/react/hooks/internal/useDeepMemo.cjs +2 -0
  75. package/__cjs/react/hooks/internal/useDeepMemo.cjs.map +1 -1
  76. package/__cjs/react/hooks/useApolloClient.cjs +1 -1
  77. package/__cjs/react/hooks/useApolloClient.cjs.map +1 -1
  78. package/__cjs/react/hooks/useApolloClient.d.cts +1 -1
  79. package/__cjs/react/hooks/useBackgroundQuery.cjs +1 -3
  80. package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
  81. package/__cjs/react/hooks/useFragment.cjs +38 -87
  82. package/__cjs/react/hooks/useFragment.cjs.map +1 -1
  83. package/__cjs/react/hooks/useFragment.d.cts +65 -6
  84. package/__cjs/react/hooks/useLazyQuery.cjs +3 -0
  85. package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
  86. package/__cjs/react/hooks/useMutation.cjs +7 -1
  87. package/__cjs/react/hooks/useMutation.cjs.map +1 -1
  88. package/__cjs/react/hooks/useMutation.d.cts +13 -1
  89. package/__cjs/react/hooks/useQuery.cjs +8 -8
  90. package/__cjs/react/hooks/useQuery.cjs.map +1 -1
  91. package/__cjs/react/hooks/useQuery.d.cts +1 -1
  92. package/__cjs/react/hooks/useQueryRefHandlers.cjs +1 -3
  93. package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
  94. package/__cjs/react/hooks/useReadQuery.cjs +1 -3
  95. package/__cjs/react/hooks/useReadQuery.cjs.map +1 -1
  96. package/__cjs/react/hooks/useSubscription.cjs +1 -1
  97. package/__cjs/react/hooks/useSubscription.cjs.map +1 -1
  98. package/__cjs/react/hooks/useSuspenseFragment.cjs +16 -16
  99. package/__cjs/react/hooks/useSuspenseFragment.cjs.map +1 -1
  100. package/__cjs/react/hooks/useSuspenseFragment.d.cts +33 -7
  101. package/__cjs/react/hooks/useSuspenseQuery.cjs +6 -4
  102. package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
  103. package/__cjs/react/internal/cache/FragmentReference.cjs +3 -22
  104. package/__cjs/react/internal/cache/FragmentReference.cjs.map +1 -1
  105. package/__cjs/react/internal/cache/FragmentReference.d.cts +2 -4
  106. package/__cjs/react/internal/cache/QueryReference.cjs +16 -0
  107. package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
  108. package/__cjs/react/internal/cache/QueryReference.d.cts +5 -0
  109. package/__cjs/react/internal/cache/SuspenseCache.cjs.map +1 -1
  110. package/__cjs/react/internal/cache/SuspenseCache.d.cts +1 -1
  111. package/__cjs/react/internal/cache/types.d.cts +2 -2
  112. package/__cjs/react/query-preloader/createQueryPreloader.cjs +41 -1
  113. package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
  114. package/__cjs/react/ssr/prerenderStatic.cjs +17 -4
  115. package/__cjs/react/ssr/prerenderStatic.cjs.map +1 -1
  116. package/__cjs/react/ssr/prerenderStatic.d.cts +23 -4
  117. package/__cjs/react/ssr/useSSRQuery.cjs +7 -4
  118. package/__cjs/react/ssr/useSSRQuery.cjs.map +1 -1
  119. package/__cjs/react/ssr/useSSRQuery.d.cts +2 -1
  120. package/__cjs/utilities/DeepPartial.cjs.map +1 -1
  121. package/__cjs/utilities/DeepPartial.d.cts +1 -1
  122. package/__cjs/utilities/internal/DeepMerger.cjs +36 -4
  123. package/__cjs/utilities/internal/DeepMerger.cjs.map +1 -1
  124. package/__cjs/utilities/internal/DeepMerger.d.cts +20 -4
  125. package/__cjs/utilities/internal/bindCacheKey.cjs +21 -0
  126. package/__cjs/utilities/internal/bindCacheKey.cjs.map +1 -0
  127. package/__cjs/utilities/internal/bindCacheKey.d.cts +15 -0
  128. package/__cjs/utilities/internal/checkDocument.cjs +2 -4
  129. package/__cjs/utilities/internal/checkDocument.cjs.map +1 -1
  130. package/__cjs/utilities/internal/combineLatestBatched.cjs +71 -0
  131. package/__cjs/utilities/internal/combineLatestBatched.cjs.map +1 -0
  132. package/__cjs/utilities/internal/combineLatestBatched.d.cts +14 -0
  133. package/__cjs/utilities/internal/compact.cjs +1 -1
  134. package/__cjs/utilities/internal/compact.cjs.map +1 -1
  135. package/__cjs/utilities/internal/constants.cjs +26 -0
  136. package/__cjs/utilities/internal/constants.cjs.map +1 -0
  137. package/__cjs/utilities/internal/constants.d.cts +23 -0
  138. package/__cjs/utilities/internal/getStoreKeyName.cjs +1 -0
  139. package/__cjs/utilities/internal/getStoreKeyName.cjs.map +1 -1
  140. package/__cjs/utilities/internal/index.cjs +12 -2
  141. package/__cjs/utilities/internal/index.cjs.map +1 -1
  142. package/__cjs/utilities/internal/index.d.cts +6 -0
  143. package/__cjs/utilities/internal/mapObservableFragment.cjs +27 -0
  144. package/__cjs/utilities/internal/mapObservableFragment.cjs.map +1 -0
  145. package/__cjs/utilities/internal/mapObservableFragment.d.cts +3 -0
  146. package/__cjs/utilities/internal/memoize.cjs +31 -0
  147. package/__cjs/utilities/internal/memoize.cjs.map +1 -0
  148. package/__cjs/utilities/internal/memoize.d.cts +8 -0
  149. package/__cjs/utilities/internal/ponyfills/FinalizationRegistry.cjs +61 -0
  150. package/__cjs/utilities/internal/ponyfills/FinalizationRegistry.cjs.map +1 -0
  151. package/__cjs/utilities/internal/ponyfills/FinalizationRegistry.d.cts +11 -0
  152. package/__cjs/utilities/internal/ponyfills/index.cjs +6 -0
  153. package/__cjs/utilities/internal/ponyfills/index.cjs.map +1 -0
  154. package/__cjs/utilities/internal/ponyfills/index.d.cts +3 -0
  155. package/__cjs/utilities/internal/ponyfills/index.react-native.cjs +6 -0
  156. package/__cjs/utilities/internal/ponyfills/index.react-native.cjs.map +1 -0
  157. package/__cjs/utilities/internal/ponyfills/index.react-native.d.cts +2 -0
  158. package/__cjs/utilities/internal/types/ExtensionsWithStreamDetails.cjs +3 -0
  159. package/__cjs/utilities/internal/types/ExtensionsWithStreamDetails.cjs.map +1 -0
  160. package/__cjs/utilities/internal/types/ExtensionsWithStreamDetails.d.cts +12 -0
  161. package/__cjs/utilities/internal/types/StreamInfoTrie.cjs +3 -0
  162. package/__cjs/utilities/internal/types/StreamInfoTrie.cjs.map +1 -0
  163. package/__cjs/utilities/internal/types/StreamInfoTrie.d.cts +16 -0
  164. package/__cjs/utilities/subscriptions/relay/index.cjs +8 -2
  165. package/__cjs/utilities/subscriptions/relay/index.cjs.map +1 -1
  166. package/__cjs/version.cjs +1 -1
  167. package/cache/core/cache.d.ts +141 -25
  168. package/cache/core/cache.js +220 -55
  169. package/cache/core/cache.js.map +1 -1
  170. package/cache/core/types/Cache.d.ts +78 -17
  171. package/cache/core/types/Cache.js.map +1 -1
  172. package/cache/index.d.ts +1 -1
  173. package/cache/index.js.map +1 -1
  174. package/cache/inmemory/entityStore.js +6 -4
  175. package/cache/inmemory/entityStore.js.map +1 -1
  176. package/cache/inmemory/fragmentRegistry.js +6 -1
  177. package/cache/inmemory/fragmentRegistry.js.map +1 -1
  178. package/cache/inmemory/helpers.d.ts +1 -1
  179. package/cache/inmemory/inMemoryCache.d.ts +48 -0
  180. package/cache/inmemory/inMemoryCache.js +62 -1
  181. package/cache/inmemory/inMemoryCache.js.map +1 -1
  182. package/cache/inmemory/key-extractor.js +1 -1
  183. package/cache/inmemory/key-extractor.js.map +1 -1
  184. package/cache/inmemory/policies.d.ts +33 -6
  185. package/cache/inmemory/policies.js +65 -7
  186. package/cache/inmemory/policies.js.map +1 -1
  187. package/cache/inmemory/readFromStore.js +9 -8
  188. package/cache/inmemory/readFromStore.js.map +1 -1
  189. package/cache/inmemory/types.d.ts +3 -0
  190. package/cache/inmemory/types.js.map +1 -1
  191. package/cache/inmemory/writeToStore.d.ts +1 -1
  192. package/cache/inmemory/writeToStore.js +27 -12
  193. package/cache/inmemory/writeToStore.js.map +1 -1
  194. package/core/ApolloClient.d.ts +166 -27
  195. package/core/ApolloClient.js +39 -59
  196. package/core/ApolloClient.js.map +1 -1
  197. package/core/ObservableQuery.d.ts +2 -0
  198. package/core/ObservableQuery.js +181 -134
  199. package/core/ObservableQuery.js.map +1 -1
  200. package/core/QueryInfo.d.ts +4 -3
  201. package/core/QueryInfo.js +10 -2
  202. package/core/QueryInfo.js.map +1 -1
  203. package/core/QueryManager.d.ts +19 -2
  204. package/core/QueryManager.js +48 -26
  205. package/core/QueryManager.js.map +1 -1
  206. package/incremental/handlers/defer20220824.d.ts +15 -7
  207. package/incremental/handlers/defer20220824.js +44 -19
  208. package/incremental/handlers/defer20220824.js.map +1 -1
  209. package/incremental/handlers/graphql17Alpha9.d.ts +98 -0
  210. package/incremental/handlers/graphql17Alpha9.js +223 -0
  211. package/incremental/handlers/graphql17Alpha9.js.map +1 -0
  212. package/incremental/handlers/notImplemented.js +1 -1
  213. package/incremental/handlers/notImplemented.js.map +1 -1
  214. package/incremental/index.d.ts +1 -0
  215. package/incremental/index.js +3 -2
  216. package/incremental/index.js.map +1 -1
  217. package/incremental/types.d.ts +9 -0
  218. package/incremental/types.js.map +1 -1
  219. package/invariantErrorCodes.js +83 -61
  220. package/legacyEntryPoints/utilities/internal/ponyfills/index.d.ts +1 -0
  221. package/legacyEntryPoints/utilities/internal/ponyfills/index.js +1 -0
  222. package/legacyEntryPoints/utilities/internal/ponyfills/ponyfills.cjs +1 -0
  223. package/legacyEntryPoints/utilities/internal/ponyfills/ponyfills.d.cts +1 -0
  224. package/link/client-awareness/ClientAwarenessLink.d.ts +1 -1
  225. package/link/client-awareness/ClientAwarenessLink.js +13 -1
  226. package/link/client-awareness/ClientAwarenessLink.js.map +1 -1
  227. package/link/core/ApolloLink.js +3 -3
  228. package/link/error/index.d.ts +1 -1
  229. package/link/error/index.js +1 -1
  230. package/link/error/index.js.map +1 -1
  231. package/link/http/checkFetcher.js +1 -1
  232. package/link/http/parseAndCheckHttpResponse.js +2 -2
  233. package/link/http/parseAndCheckHttpResponse.js.map +1 -1
  234. package/link/persisted-queries/index.js +2 -2
  235. package/link/remove-typename/removeTypenameFromVariables.d.ts +3 -0
  236. package/link/remove-typename/removeTypenameFromVariables.js +51 -50
  237. package/link/remove-typename/removeTypenameFromVariables.js.map +1 -1
  238. package/link/schema/index.d.ts +1 -1
  239. package/link/schema/index.js +1 -1
  240. package/link/schema/index.js.map +1 -1
  241. package/link/ws/index.js +1 -1
  242. package/local-state/LocalState.d.ts +3 -2
  243. package/local-state/LocalState.js +29 -15
  244. package/local-state/LocalState.js.map +1 -1
  245. package/masking/types.d.ts +2 -1
  246. package/masking/types.js.map +1 -1
  247. package/package.json +15 -1
  248. package/react/hooks/internal/useDeepMemo.js +2 -0
  249. package/react/hooks/internal/useDeepMemo.js.map +1 -1
  250. package/react/hooks/useApolloClient.d.ts +1 -1
  251. package/react/hooks/useApolloClient.js +1 -1
  252. package/react/hooks/useApolloClient.js.map +1 -1
  253. package/react/hooks/useBackgroundQuery.js +1 -3
  254. package/react/hooks/useBackgroundQuery.js.map +1 -1
  255. package/react/hooks/useFragment.d.ts +65 -6
  256. package/react/hooks/useFragment.js +38 -87
  257. package/react/hooks/useFragment.js.map +1 -1
  258. package/react/hooks/useLazyQuery.js +4 -1
  259. package/react/hooks/useLazyQuery.js.map +1 -1
  260. package/react/hooks/useMutation.d.ts +13 -1
  261. package/react/hooks/useMutation.js +7 -1
  262. package/react/hooks/useMutation.js.map +1 -1
  263. package/react/hooks/useQuery.js +9 -9
  264. package/react/hooks/useQuery.js.map +1 -1
  265. package/react/hooks/useQueryRefHandlers.js +1 -3
  266. package/react/hooks/useQueryRefHandlers.js.map +1 -1
  267. package/react/hooks/useReadQuery.js +1 -3
  268. package/react/hooks/useReadQuery.js.map +1 -1
  269. package/react/hooks/useSubscription.js +1 -1
  270. package/react/hooks/useSubscription.js.map +1 -1
  271. package/react/hooks/useSuspenseFragment.d.ts +33 -7
  272. package/react/hooks/useSuspenseFragment.js +17 -17
  273. package/react/hooks/useSuspenseFragment.js.map +1 -1
  274. package/react/hooks/useSuspenseQuery.js +6 -4
  275. package/react/hooks/useSuspenseQuery.js.map +1 -1
  276. package/react/hooks-compiled/internal/useDeepMemo.js +2 -0
  277. package/react/hooks-compiled/internal/useDeepMemo.js.map +1 -1
  278. package/react/hooks-compiled/internal/useSuspenseHookCacheKey.js +0 -2
  279. package/react/hooks-compiled/internal/useSuspenseHookCacheKey.js.map +1 -1
  280. package/react/hooks-compiled/useApolloClient.d.ts +1 -1
  281. package/react/hooks-compiled/useApolloClient.js +1 -1
  282. package/react/hooks-compiled/useApolloClient.js.map +1 -1
  283. package/react/hooks-compiled/useBackgroundQuery.js +1 -3
  284. package/react/hooks-compiled/useBackgroundQuery.js.map +1 -1
  285. package/react/hooks-compiled/useFragment.d.ts +65 -6
  286. package/react/hooks-compiled/useFragment.js +110 -88
  287. package/react/hooks-compiled/useFragment.js.map +1 -1
  288. package/react/hooks-compiled/useLazyQuery.js +4 -1
  289. package/react/hooks-compiled/useLazyQuery.js.map +1 -1
  290. package/react/hooks-compiled/useLoadableQuery.js +69 -75
  291. package/react/hooks-compiled/useMutation.d.ts +13 -1
  292. package/react/hooks-compiled/useMutation.js +5 -13
  293. package/react/hooks-compiled/useMutation.js.map +1 -1
  294. package/react/hooks-compiled/useQuery.js +53 -61
  295. package/react/hooks-compiled/useQuery.js.map +1 -1
  296. package/react/hooks-compiled/useQueryRefHandlers.js +1 -5
  297. package/react/hooks-compiled/useQueryRefHandlers.js.map +1 -1
  298. package/react/hooks-compiled/useReadQuery.js +77 -14
  299. package/react/hooks-compiled/useReadQuery.js.map +1 -1
  300. package/react/hooks-compiled/useSubscription.js +237 -93
  301. package/react/hooks-compiled/useSubscription.js.map +1 -1
  302. package/react/hooks-compiled/useSuspenseFragment.d.ts +33 -7
  303. package/react/hooks-compiled/useSuspenseFragment.js +17 -17
  304. package/react/hooks-compiled/useSuspenseFragment.js.map +1 -1
  305. package/react/hooks-compiled/useSuspenseQuery.js +7 -9
  306. package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
  307. package/react/index.compiled.d.ts +1 -1
  308. package/react/index.compiled.js +1 -1
  309. package/react/index.compiled.js.map +1 -1
  310. package/react/internal/cache/FragmentReference.d.ts +2 -4
  311. package/react/internal/cache/FragmentReference.js +3 -22
  312. package/react/internal/cache/FragmentReference.js.map +1 -1
  313. package/react/internal/cache/QueryReference.d.ts +5 -0
  314. package/react/internal/cache/QueryReference.js +16 -0
  315. package/react/internal/cache/QueryReference.js.map +1 -1
  316. package/react/internal/cache/SuspenseCache.d.ts +1 -1
  317. package/react/internal/cache/SuspenseCache.js.map +1 -1
  318. package/react/internal/cache/types.d.ts +2 -2
  319. package/react/internal/cache/types.js.map +1 -1
  320. package/react/query-preloader/createQueryPreloader.js +41 -1
  321. package/react/query-preloader/createQueryPreloader.js.map +1 -1
  322. package/react/ssr/prerenderStatic.d.ts +24 -5
  323. package/react/ssr/prerenderStatic.js +17 -4
  324. package/react/ssr/prerenderStatic.js.map +1 -1
  325. package/react/ssr/useSSRQuery.d.ts +2 -1
  326. package/react/ssr/useSSRQuery.js +8 -5
  327. package/react/ssr/useSSRQuery.js.map +1 -1
  328. package/utilities/DeepPartial.d.ts +1 -1
  329. package/utilities/DeepPartial.js.map +1 -1
  330. package/utilities/internal/DeepMerger.d.ts +20 -4
  331. package/utilities/internal/DeepMerger.js +36 -4
  332. package/utilities/internal/DeepMerger.js.map +1 -1
  333. package/utilities/internal/bindCacheKey.d.ts +15 -0
  334. package/utilities/internal/bindCacheKey.js +18 -0
  335. package/utilities/internal/bindCacheKey.js.map +1 -0
  336. package/utilities/internal/checkDocument.js +2 -4
  337. package/utilities/internal/checkDocument.js.map +1 -1
  338. package/utilities/internal/combineLatestBatched.d.ts +14 -0
  339. package/utilities/internal/combineLatestBatched.js +68 -0
  340. package/utilities/internal/combineLatestBatched.js.map +1 -0
  341. package/utilities/internal/compact.js +1 -1
  342. package/utilities/internal/compact.js.map +1 -1
  343. package/utilities/internal/constants.d.ts +23 -0
  344. package/utilities/internal/constants.js +23 -0
  345. package/utilities/internal/constants.js.map +1 -0
  346. package/utilities/internal/getStoreKeyName.js +1 -0
  347. package/utilities/internal/getStoreKeyName.js.map +1 -1
  348. package/utilities/internal/index.d.ts +6 -0
  349. package/utilities/internal/index.js +4 -0
  350. package/utilities/internal/index.js.map +1 -1
  351. package/utilities/internal/mapObservableFragment.d.ts +3 -0
  352. package/utilities/internal/mapObservableFragment.js +24 -0
  353. package/utilities/internal/mapObservableFragment.js.map +1 -0
  354. package/utilities/internal/memoize.d.ts +8 -0
  355. package/utilities/internal/memoize.js +28 -0
  356. package/utilities/internal/memoize.js.map +1 -0
  357. package/utilities/internal/ponyfills/FinalizationRegistry.d.ts +11 -0
  358. package/utilities/internal/ponyfills/FinalizationRegistry.js +57 -0
  359. package/utilities/internal/ponyfills/FinalizationRegistry.js.map +1 -0
  360. package/utilities/internal/ponyfills/index.d.ts +3 -0
  361. package/utilities/internal/ponyfills/index.js +3 -0
  362. package/utilities/internal/ponyfills/index.js.map +1 -0
  363. package/utilities/internal/ponyfills/index.react-native.d.ts +2 -0
  364. package/utilities/internal/ponyfills/index.react-native.js +2 -0
  365. package/utilities/internal/ponyfills/index.react-native.js.map +1 -0
  366. package/utilities/internal/types/ExtensionsWithStreamDetails.d.ts +12 -0
  367. package/utilities/internal/types/ExtensionsWithStreamDetails.js +2 -0
  368. package/utilities/internal/types/ExtensionsWithStreamDetails.js.map +1 -0
  369. package/utilities/internal/types/StreamInfoTrie.d.ts +16 -0
  370. package/utilities/internal/types/StreamInfoTrie.js +2 -0
  371. package/utilities/internal/types/StreamInfoTrie.js.map +1 -0
  372. package/utilities/subscriptions/relay/index.js +8 -2
  373. package/utilities/subscriptions/relay/index.js.map +1 -1
  374. package/version.js +1 -1
@@ -1,13 +1,13 @@
1
1
  import type { DocumentNode } from "graphql";
2
2
  import type { Observable } from "rxjs";
3
- import type { ApolloCache, IgnoreModifier, Reference } from "@apollo/client/cache";
3
+ import type { ApolloCache, Cache, IgnoreModifier, Reference } from "@apollo/client/cache";
4
4
  import type { Incremental } from "@apollo/client/incremental";
5
5
  import type { ApolloLink } from "@apollo/client/link";
6
6
  import type { ClientAwarenessLink } from "@apollo/client/link/client-awareness";
7
7
  import type { LocalState } from "@apollo/client/local-state";
8
8
  import type { MaybeMasked, Unmasked } from "@apollo/client/masking";
9
9
  import { DocumentTransform } from "@apollo/client/utilities";
10
- import type { VariablesOption } from "@apollo/client/utilities/internal";
10
+ import type { VariablesOption, variablesUnknownSymbol } from "@apollo/client/utilities/internal";
11
11
  import { getApolloClientMemoryInternals } from "@apollo/client/utilities/internal";
12
12
  import type { ObservableQuery } from "./ObservableQuery.cjs";
13
13
  import type { DefaultContext, ErrorLike, InternalRefetchQueriesInclude, InternalRefetchQueriesResult, MutationQueryReducersMap, MutationUpdaterFunction, NormalizedExecutionResult, OnQueryUpdated, OperationVariables, RefetchQueriesInclude, RefetchQueriesPromiseResults, SubscriptionObservable, TypedDocumentNode } from "./types.cjs";
@@ -87,6 +87,14 @@ export declare namespace ApolloClient {
87
87
  * queries.
88
88
  */
89
89
  incrementalHandler?: Incremental.Handler<any>;
90
+ /**
91
+ * @experimental
92
+ * Allows passing in "experiments", experimental features that might one day
93
+ * become part of Apollo Client's core functionality.
94
+ * Keep in mind that these features might change the core of Apollo Client.
95
+ * Do not pass in experiments that are not provided by Apollo.
96
+ */
97
+ experiments?: ApolloClient.Experiment[];
90
98
  }
91
99
  interface DevtoolsOptions {
92
100
  /**
@@ -376,7 +384,13 @@ export declare namespace ApolloClient {
376
384
  extensions?: Record<string, unknown>;
377
385
  }
378
386
  type WatchFragmentOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables> = ApolloCache.WatchFragmentOptions<TData, TVariables>;
379
- type WatchFragmentResult<TData = unknown> = ApolloCache.WatchFragmentResult<TData>;
387
+ type WatchFragmentResult<TData = unknown> = ApolloCache.WatchFragmentResult<MaybeMasked<TData>>;
388
+ interface ObservableFragment<TData = unknown> extends Observable<ApolloClient.WatchFragmentResult<TData>> {
389
+ /**
390
+ * Return the current result for the fragment.
391
+ */
392
+ getCurrentResult: () => ApolloClient.WatchFragmentResult<TData>;
393
+ }
380
394
  /**
381
395
  * Watched query options.
382
396
  */
@@ -468,6 +482,21 @@ export declare namespace ApolloClient {
468
482
  * @docGroup 1. Operation options
469
483
  */
470
484
  query: DocumentNode | TypedDocumentNode<TData, TVariables>;
485
+ /**
486
+ * @internal This API is meant for framework integrations only.
487
+ * Do not use for everyday use.
488
+ *
489
+ * Indicates that the variables are unknown at the time of query creation.
490
+ * This option can only be set when `fetchPolicy` is `'standby'`.
491
+ * Setting this to `true` will prevent `client.refetchQueries` from refetching
492
+ * this query before it has left the `'standby'` state, either by setting a
493
+ * `fetchPolicy`, or by calling `observableQuery.refetch()` explicitly.
494
+ *
495
+ * Changing this option after the query has been created will have no effect.
496
+ *
497
+ * @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time.
498
+ */
499
+ [variablesUnknownSymbol]?: boolean;
471
500
  } & VariablesOption<NoInfer<TVariables>>;
472
501
  namespace Base {
473
502
  interface ReadQueryOptions<TData, TVariables extends OperationVariables> {
@@ -508,12 +537,6 @@ export declare namespace ApolloClient {
508
537
  }
509
538
  namespace Base {
510
539
  interface ReadFragmentOptions<TData, TVariables extends OperationVariables> {
511
- /**
512
- * The root id to be used. This id should take the same form as the
513
- * value returned by the `cache.identify` function. If a value with your
514
- * id does not exist in the store, `null` will be returned.
515
- */
516
- id?: string;
517
540
  /**
518
541
  * A GraphQL document created using the `gql` template string tag
519
542
  * with one or more fragments which will be used to determine
@@ -542,7 +565,27 @@ export declare namespace ApolloClient {
542
565
  optimistic?: boolean;
543
566
  }
544
567
  }
545
- type ReadFragmentOptions<TData, TVariables extends OperationVariables> = Base.ReadFragmentOptions<TData, TVariables> & VariablesOption<TVariables>;
568
+ namespace DocumentationTypes {
569
+ interface ReadFragmentOptions<TData, TVariables extends OperationVariables> extends Base.ReadFragmentOptions<TData, TVariables> {
570
+ /**
571
+ * The root id to be used. This id should take the same form as the
572
+ * value returned by the `cache.identify` function. If a value with your
573
+ * id does not exist in the store, `null` will be returned.
574
+ */
575
+ id?: string;
576
+ /**
577
+ * An object containing a `__typename` and primary key fields
578
+ * (such as `id`) identifying the entity object from which the fragment will
579
+ * be retrieved, or a `{ __ref: "..." }` reference, or a `string` ID
580
+ * (uncommon).
581
+ *
582
+ * @remarks
583
+ * `from` is given precedence over `id` when both are provided.
584
+ */
585
+ from?: ApolloCache.FromOptionValue<TData>;
586
+ }
587
+ }
588
+ type ReadFragmentOptions<TData, TVariables extends OperationVariables> = Base.ReadFragmentOptions<TData, TVariables> & VariablesOption<TVariables> & Cache.CacheIdentifierOption<TData>;
546
589
  namespace DocumentationTypes {
547
590
  interface WriteQueryOptions<TData, TVariables extends OperationVariables> extends Base.WriteQueryOptions<TData, TVariables> {
548
591
  /**
@@ -580,6 +623,11 @@ export declare namespace ApolloClient {
580
623
  * @defaultValue false
581
624
  */
582
625
  overwrite?: boolean;
626
+ /**
627
+ * GraphQL extensions for the write operation. Any provided `extensions`
628
+ * are available in `merge` functions.
629
+ */
630
+ extensions?: Record<string, unknown>;
583
631
  }
584
632
  }
585
633
  type WriteQueryOptions<TData, TVariables extends OperationVariables> = Base.WriteQueryOptions<TData, TVariables> & VariablesOption<TVariables>;
@@ -593,12 +641,6 @@ export declare namespace ApolloClient {
593
641
  }
594
642
  namespace Base {
595
643
  interface WriteFragmentOptions<TData, TVariables extends OperationVariables> {
596
- /**
597
- * The root id to be used. This id should take the same form as the
598
- * value returned by the `cache.identify` function. If a value with your
599
- * id does not exist in the store, `null` will be returned.
600
- */
601
- id?: string;
602
644
  /**
603
645
  * A GraphQL document created using the `gql` template string tag from
604
646
  * `graphql-tag` with one or more fragments which will be used to determine
@@ -630,15 +672,35 @@ export declare namespace ApolloClient {
630
672
  overwrite?: boolean;
631
673
  }
632
674
  }
633
- type WriteFragmentOptions<TData, TVariables extends OperationVariables> = Base.WriteFragmentOptions<TData, TVariables> & VariablesOption<TVariables>;
675
+ type WriteFragmentOptions<TData, TVariables extends OperationVariables> = Base.WriteFragmentOptions<TData, TVariables> & VariablesOption<TVariables> & Cache.CacheIdentifierOption<TData>;
634
676
  namespace DocumentationTypes {
635
677
  interface WriteFragmentOptions<TData, TVariables extends OperationVariables> extends Base.WriteFragmentOptions<TData, TVariables> {
678
+ /**
679
+ * The root id to be used. This id should take the same form as the
680
+ * value returned by the `cache.identify` function. If a value with your
681
+ * id does not exist in the store, `null` will be returned.
682
+ */
683
+ id?: string;
684
+ /**
685
+ * An object containing a `__typename` and primary key fields
686
+ * (such as `id`) identifying the entity object from which the fragment will
687
+ * be retrieved, or a `{ __ref: "..." }` reference, or a `string` ID
688
+ * (uncommon).
689
+ *
690
+ * @remarks
691
+ * `from` is given precedence over `id` when both are provided.
692
+ */
693
+ from?: ApolloCache.FromOptionValue<TData>;
636
694
  /**
637
695
  * Any variables that your GraphQL fragments depend on.
638
696
  */
639
697
  variables?: TVariables;
640
698
  }
641
699
  }
700
+ interface Experiment {
701
+ (this: ApolloClient, options: ApolloClient.Options): void;
702
+ v: 1;
703
+ }
642
704
  }
643
705
  /**
644
706
  * This is the primary Apollo Client class. It is used to send GraphQL documents (i.e. queries
@@ -676,24 +738,22 @@ export declare class ApolloClient {
676
738
  * @example
677
739
  *
678
740
  * ```js
679
- * import { ApolloClient, InMemoryCache } from "@apollo/client";
741
+ * import { ApolloClient, InMemoryCache, HttpLink } from "@apollo/client";
680
742
  *
681
743
  * const cache = new InMemoryCache();
744
+ * const link = new HttpLink({ uri: "http://localhost:4000/" });
682
745
  *
683
746
  * const client = new ApolloClient({
684
747
  * // Provide required constructor fields
685
748
  * cache: cache,
686
- * uri: "http://localhost:4000/",
749
+ * link: link,
687
750
  *
688
751
  * // Provide some optional constructor fields
689
- * name: "react-web-client",
690
- * version: "1.3",
691
- * queryDeduplication: false,
692
- * defaultOptions: {
693
- * watchQuery: {
694
- * fetchPolicy: "cache-and-network",
695
- * },
752
+ * clientAwareness: {
753
+ * name: "react-web-client",
754
+ * version: "1.3",
696
755
  * },
756
+ * queryDeduplication: false,
697
757
  * });
698
758
  * ```
699
759
  */
@@ -811,7 +871,86 @@ export declare class ApolloClient {
811
871
  * the cache to identify the fragment and optionally specify whether to react
812
872
  * to optimistic updates.
813
873
  */
814
- watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WatchFragmentOptions<TData, TVariables>): Observable<ApolloClient.WatchFragmentResult<MaybeMasked<TData>>>;
874
+ watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WatchFragmentOptions<TData, TVariables> & {
875
+ from: Array<ApolloCache.FromOptionValue<TData>>;
876
+ }): ApolloClient.ObservableFragment<Array<TData>>;
877
+ /**
878
+ * Watches the cache store of the fragment according to the options specified
879
+ * and returns an `Observable`. We can subscribe to this
880
+ * `Observable` and receive updated results through an
881
+ * observer when the cache store changes.
882
+ *
883
+ * You must pass in a GraphQL document with a single fragment or a document
884
+ * with multiple fragments that represent what you are reading. If you pass
885
+ * in a document with multiple fragments then you must also specify a
886
+ * `fragmentName`.
887
+ *
888
+ * @since 3.10.0
889
+ * @param options - An object of type `WatchFragmentOptions` that allows
890
+ * the cache to identify the fragment and optionally specify whether to react
891
+ * to optimistic updates.
892
+ */
893
+ watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WatchFragmentOptions<TData, TVariables> & {
894
+ from: Array<null>;
895
+ }): ApolloClient.ObservableFragment<Array<null>>;
896
+ watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WatchFragmentOptions<TData, TVariables> & {
897
+ from: Array<ApolloCache.FromOptionValue<TData> | null>;
898
+ }): ApolloClient.ObservableFragment<Array<TData | null>>;
899
+ /**
900
+ * Watches the cache store of the fragment according to the options specified
901
+ * and returns an `Observable`. We can subscribe to this
902
+ * `Observable` and receive updated results through an
903
+ * observer when the cache store changes.
904
+ *
905
+ * You must pass in a GraphQL document with a single fragment or a document
906
+ * with multiple fragments that represent what you are reading. If you pass
907
+ * in a document with multiple fragments then you must also specify a
908
+ * `fragmentName`.
909
+ *
910
+ * @since 3.10.0
911
+ * @param options - An object of type `WatchFragmentOptions` that allows
912
+ * the cache to identify the fragment and optionally specify whether to react
913
+ * to optimistic updates.
914
+ */
915
+ watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WatchFragmentOptions<TData, TVariables> & {
916
+ from: null;
917
+ }): ApolloClient.ObservableFragment<null>;
918
+ /**
919
+ * Watches the cache store of the fragment according to the options specified
920
+ * and returns an `Observable`. We can subscribe to this
921
+ * `Observable` and receive updated results through an
922
+ * observer when the cache store changes.
923
+ *
924
+ * You must pass in a GraphQL document with a single fragment or a document
925
+ * with multiple fragments that represent what you are reading. If you pass
926
+ * in a document with multiple fragments then you must also specify a
927
+ * `fragmentName`.
928
+ *
929
+ * @since 3.10.0
930
+ * @param options - An object of type `WatchFragmentOptions` that allows
931
+ * the cache to identify the fragment and optionally specify whether to react
932
+ * to optimistic updates.
933
+ */
934
+ watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WatchFragmentOptions<TData, TVariables> & {
935
+ from: ApolloCache.FromOptionValue<TData>;
936
+ }): ApolloClient.ObservableFragment<TData>;
937
+ /**
938
+ * Watches the cache store of the fragment according to the options specified
939
+ * and returns an `Observable`. We can subscribe to this
940
+ * `Observable` and receive updated results through an
941
+ * observer when the cache store changes.
942
+ *
943
+ * You must pass in a GraphQL document with a single fragment or a document
944
+ * with multiple fragments that represent what you are reading. If you pass
945
+ * in a document with multiple fragments then you must also specify a
946
+ * `fragmentName`.
947
+ *
948
+ * @since 3.10.0
949
+ * @param options - An object of type `WatchFragmentOptions` that allows
950
+ * the cache to identify the fragment and optionally specify whether to react
951
+ * to optimistic updates.
952
+ */
953
+ watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WatchFragmentOptions<TData, TVariables>): ApolloClient.ObservableFragment<TData | null>;
815
954
  /**
816
955
  * Tries to read some data from the store in the shape of the provided
817
956
  * GraphQL fragment without making a network request. This method will read a