@apollo/client 4.0.12-beta.0 → 4.0.13

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 (340) hide show
  1. package/CHANGELOG.md +10 -194
  2. package/__cjs/cache/core/cache.cjs +48 -169
  3. package/__cjs/cache/core/cache.cjs.map +1 -1
  4. package/__cjs/cache/core/cache.d.cts +25 -94
  5. package/__cjs/cache/core/types/Cache.d.cts +17 -49
  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 +4 -6
  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 +1 -15
  14. package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
  15. package/__cjs/cache/inmemory/inMemoryCache.d.cts +0 -1
  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 +17 -56
  19. package/__cjs/cache/inmemory/policies.cjs.map +1 -1
  20. package/__cjs/cache/inmemory/policies.d.cts +6 -30
  21. package/__cjs/cache/inmemory/readFromStore.cjs +3 -3
  22. package/__cjs/cache/inmemory/readFromStore.cjs.map +1 -1
  23. package/__cjs/cache/inmemory/types.d.cts +0 -2
  24. package/__cjs/cache/inmemory/writeToStore.cjs +10 -24
  25. package/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
  26. package/__cjs/cache/inmemory/writeToStore.d.cts +1 -2
  27. package/__cjs/core/ApolloClient.cjs +49 -31
  28. package/__cjs/core/ApolloClient.cjs.map +1 -1
  29. package/__cjs/core/ApolloClient.d.cts +17 -143
  30. package/__cjs/core/ObservableQuery.cjs +128 -162
  31. package/__cjs/core/ObservableQuery.cjs.map +1 -1
  32. package/__cjs/core/ObservableQuery.d.cts +0 -1
  33. package/__cjs/core/QueryInfo.cjs +1 -9
  34. package/__cjs/core/QueryInfo.cjs.map +1 -1
  35. package/__cjs/core/QueryInfo.d.cts +1 -2
  36. package/__cjs/core/QueryManager.cjs +24 -46
  37. package/__cjs/core/QueryManager.cjs.map +1 -1
  38. package/__cjs/core/QueryManager.d.cts +2 -18
  39. package/__cjs/incremental/handlers/defer20220824.cjs +19 -44
  40. package/__cjs/incremental/handlers/defer20220824.cjs.map +1 -1
  41. package/__cjs/incremental/handlers/defer20220824.d.cts +7 -15
  42. package/__cjs/incremental/handlers/notImplemented.cjs +1 -1
  43. package/__cjs/incremental/handlers/notImplemented.cjs.map +1 -1
  44. package/__cjs/incremental/index.cjs +1 -3
  45. package/__cjs/incremental/index.cjs.map +1 -1
  46. package/__cjs/incremental/index.d.cts +0 -1
  47. package/__cjs/incremental/types.d.cts +0 -9
  48. package/__cjs/invariantErrorCodes.cjs +62 -78
  49. package/__cjs/link/client-awareness/ClientAwarenessLink.cjs +1 -13
  50. package/__cjs/link/client-awareness/ClientAwarenessLink.cjs.map +1 -1
  51. package/__cjs/link/client-awareness/ClientAwarenessLink.d.cts +1 -1
  52. package/__cjs/link/core/ApolloLink.cjs +3 -3
  53. package/__cjs/link/http/checkFetcher.cjs +1 -1
  54. package/__cjs/link/http/parseAndCheckHttpResponse.cjs +1 -1
  55. package/__cjs/link/persisted-queries/index.cjs +2 -2
  56. package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs +51 -50
  57. package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs.map +1 -1
  58. package/__cjs/link/remove-typename/removeTypenameFromVariables.d.cts +3 -0
  59. package/__cjs/link/ws/index.cjs +1 -1
  60. package/__cjs/local-state/LocalState.cjs +14 -28
  61. package/__cjs/local-state/LocalState.cjs.map +1 -1
  62. package/__cjs/local-state/LocalState.d.cts +2 -3
  63. package/__cjs/masking/types.d.cts +1 -2
  64. package/__cjs/react/hooks/internal/useDeepMemo.cjs +0 -2
  65. package/__cjs/react/hooks/internal/useDeepMemo.cjs.map +1 -1
  66. package/__cjs/react/hooks/useApolloClient.cjs +1 -1
  67. package/__cjs/react/hooks/useApolloClient.cjs.map +1 -1
  68. package/__cjs/react/hooks/useApolloClient.d.cts +1 -1
  69. package/__cjs/react/hooks/useBackgroundQuery.cjs +3 -1
  70. package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
  71. package/__cjs/react/hooks/useFragment.cjs +87 -38
  72. package/__cjs/react/hooks/useFragment.cjs.map +1 -1
  73. package/__cjs/react/hooks/useFragment.d.cts +6 -65
  74. package/__cjs/react/hooks/useLazyQuery.cjs +0 -2
  75. package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
  76. package/__cjs/react/hooks/useMutation.cjs +1 -7
  77. package/__cjs/react/hooks/useMutation.cjs.map +1 -1
  78. package/__cjs/react/hooks/useMutation.d.cts +1 -13
  79. package/__cjs/react/hooks/useQuery.cjs +4 -1
  80. package/__cjs/react/hooks/useQuery.cjs.map +1 -1
  81. package/__cjs/react/hooks/useQuery.d.cts +1 -1
  82. package/__cjs/react/hooks/useQueryRefHandlers.cjs +3 -1
  83. package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
  84. package/__cjs/react/hooks/useReadQuery.cjs +3 -1
  85. package/__cjs/react/hooks/useReadQuery.cjs.map +1 -1
  86. package/__cjs/react/hooks/useSubscription.cjs +1 -1
  87. package/__cjs/react/hooks/useSubscription.cjs.map +1 -1
  88. package/__cjs/react/hooks/useSuspenseFragment.cjs +16 -16
  89. package/__cjs/react/hooks/useSuspenseFragment.cjs.map +1 -1
  90. package/__cjs/react/hooks/useSuspenseFragment.d.cts +7 -33
  91. package/__cjs/react/hooks/useSuspenseQuery.cjs +4 -4
  92. package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
  93. package/__cjs/react/internal/cache/FragmentReference.cjs +22 -3
  94. package/__cjs/react/internal/cache/FragmentReference.cjs.map +1 -1
  95. package/__cjs/react/internal/cache/FragmentReference.d.cts +4 -2
  96. package/__cjs/react/internal/cache/QueryReference.cjs +0 -16
  97. package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
  98. package/__cjs/react/internal/cache/QueryReference.d.cts +0 -5
  99. package/__cjs/react/internal/cache/SuspenseCache.cjs.map +1 -1
  100. package/__cjs/react/internal/cache/SuspenseCache.d.cts +1 -1
  101. package/__cjs/react/internal/cache/types.d.cts +2 -2
  102. package/__cjs/react/query-preloader/createQueryPreloader.cjs +1 -41
  103. package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
  104. package/__cjs/react/ssr/useSSRQuery.cjs +0 -1
  105. package/__cjs/react/ssr/useSSRQuery.cjs.map +1 -1
  106. package/__cjs/utilities/DeepPartial.cjs.map +1 -1
  107. package/__cjs/utilities/DeepPartial.d.cts +1 -1
  108. package/__cjs/utilities/internal/DeepMerger.cjs +4 -36
  109. package/__cjs/utilities/internal/DeepMerger.cjs.map +1 -1
  110. package/__cjs/utilities/internal/DeepMerger.d.cts +4 -20
  111. package/__cjs/utilities/internal/bindCacheKey.cjs +21 -0
  112. package/__cjs/utilities/internal/bindCacheKey.cjs.map +1 -0
  113. package/__cjs/utilities/internal/bindCacheKey.d.cts +15 -0
  114. package/__cjs/utilities/internal/compact.cjs +1 -1
  115. package/__cjs/utilities/internal/compact.cjs.map +1 -1
  116. package/__cjs/utilities/internal/constants.cjs +1 -17
  117. package/__cjs/utilities/internal/constants.cjs.map +1 -1
  118. package/__cjs/utilities/internal/constants.d.cts +0 -16
  119. package/__cjs/utilities/internal/getStoreKeyName.cjs +0 -1
  120. package/__cjs/utilities/internal/getStoreKeyName.cjs.map +1 -1
  121. package/__cjs/utilities/internal/index.cjs +4 -8
  122. package/__cjs/utilities/internal/index.cjs.map +1 -1
  123. package/__cjs/utilities/internal/index.d.cts +2 -4
  124. package/__cjs/utilities/internal/memoize.cjs +2 -2
  125. package/__cjs/utilities/internal/memoize.cjs.map +1 -1
  126. package/__cjs/utilities/internal/memoize.d.cts +1 -2
  127. package/__cjs/version.cjs +1 -1
  128. package/__cjs/version.cjs.map +1 -1
  129. package/cache/core/cache.d.ts +25 -94
  130. package/cache/core/cache.js +51 -172
  131. package/cache/core/cache.js.map +1 -1
  132. package/cache/core/types/Cache.d.ts +17 -49
  133. package/cache/core/types/Cache.js.map +1 -1
  134. package/cache/index.d.ts +1 -1
  135. package/cache/index.js.map +1 -1
  136. package/cache/inmemory/entityStore.js +4 -6
  137. package/cache/inmemory/entityStore.js.map +1 -1
  138. package/cache/inmemory/fragmentRegistry.js +6 -1
  139. package/cache/inmemory/fragmentRegistry.js.map +1 -1
  140. package/cache/inmemory/helpers.d.ts +1 -1
  141. package/cache/inmemory/inMemoryCache.d.ts +0 -1
  142. package/cache/inmemory/inMemoryCache.js +1 -15
  143. package/cache/inmemory/inMemoryCache.js.map +1 -1
  144. package/cache/inmemory/key-extractor.js +1 -1
  145. package/cache/inmemory/key-extractor.js.map +1 -1
  146. package/cache/inmemory/policies.d.ts +6 -30
  147. package/cache/inmemory/policies.js +7 -45
  148. package/cache/inmemory/policies.js.map +1 -1
  149. package/cache/inmemory/readFromStore.js +3 -3
  150. package/cache/inmemory/readFromStore.js.map +1 -1
  151. package/cache/inmemory/types.d.ts +0 -2
  152. package/cache/inmemory/types.js.map +1 -1
  153. package/cache/inmemory/writeToStore.d.ts +1 -2
  154. package/cache/inmemory/writeToStore.js +12 -26
  155. package/cache/inmemory/writeToStore.js.map +1 -1
  156. package/core/ApolloClient.d.ts +17 -143
  157. package/core/ApolloClient.js +50 -32
  158. package/core/ApolloClient.js.map +1 -1
  159. package/core/ObservableQuery.d.ts +0 -1
  160. package/core/ObservableQuery.js +131 -165
  161. package/core/ObservableQuery.js.map +1 -1
  162. package/core/QueryInfo.d.ts +1 -2
  163. package/core/QueryInfo.js +2 -10
  164. package/core/QueryInfo.js.map +1 -1
  165. package/core/QueryManager.d.ts +2 -18
  166. package/core/QueryManager.js +25 -47
  167. package/core/QueryManager.js.map +1 -1
  168. package/incremental/handlers/defer20220824.d.ts +7 -15
  169. package/incremental/handlers/defer20220824.js +19 -44
  170. package/incremental/handlers/defer20220824.js.map +1 -1
  171. package/incremental/handlers/notImplemented.js +1 -1
  172. package/incremental/handlers/notImplemented.js.map +1 -1
  173. package/incremental/index.d.ts +0 -1
  174. package/incremental/index.js +2 -3
  175. package/incremental/index.js.map +1 -1
  176. package/incremental/types.d.ts +0 -9
  177. package/incremental/types.js.map +1 -1
  178. package/invariantErrorCodes.js +62 -78
  179. package/link/client-awareness/ClientAwarenessLink.d.ts +1 -1
  180. package/link/client-awareness/ClientAwarenessLink.js +1 -13
  181. package/link/client-awareness/ClientAwarenessLink.js.map +1 -1
  182. package/link/core/ApolloLink.js +3 -3
  183. package/link/http/checkFetcher.js +1 -1
  184. package/link/http/parseAndCheckHttpResponse.js +1 -1
  185. package/link/persisted-queries/index.js +2 -2
  186. package/link/remove-typename/removeTypenameFromVariables.d.ts +3 -0
  187. package/link/remove-typename/removeTypenameFromVariables.js +51 -50
  188. package/link/remove-typename/removeTypenameFromVariables.js.map +1 -1
  189. package/link/ws/index.js +1 -1
  190. package/local-state/LocalState.d.ts +2 -3
  191. package/local-state/LocalState.js +14 -28
  192. package/local-state/LocalState.js.map +1 -1
  193. package/masking/types.d.ts +1 -2
  194. package/masking/types.js.map +1 -1
  195. package/package.json +1 -15
  196. package/react/hooks/internal/useDeepMemo.js +0 -2
  197. package/react/hooks/internal/useDeepMemo.js.map +1 -1
  198. package/react/hooks/useApolloClient.d.ts +1 -1
  199. package/react/hooks/useApolloClient.js +1 -1
  200. package/react/hooks/useApolloClient.js.map +1 -1
  201. package/react/hooks/useBackgroundQuery.js +3 -1
  202. package/react/hooks/useBackgroundQuery.js.map +1 -1
  203. package/react/hooks/useFragment.d.ts +6 -65
  204. package/react/hooks/useFragment.js +87 -38
  205. package/react/hooks/useFragment.js.map +1 -1
  206. package/react/hooks/useLazyQuery.js +0 -2
  207. package/react/hooks/useLazyQuery.js.map +1 -1
  208. package/react/hooks/useMutation.d.ts +1 -13
  209. package/react/hooks/useMutation.js +1 -7
  210. package/react/hooks/useMutation.js.map +1 -1
  211. package/react/hooks/useQuery.js +4 -1
  212. package/react/hooks/useQuery.js.map +1 -1
  213. package/react/hooks/useQueryRefHandlers.js +3 -1
  214. package/react/hooks/useQueryRefHandlers.js.map +1 -1
  215. package/react/hooks/useReadQuery.js +3 -1
  216. package/react/hooks/useReadQuery.js.map +1 -1
  217. package/react/hooks/useSubscription.js +1 -1
  218. package/react/hooks/useSubscription.js.map +1 -1
  219. package/react/hooks/useSuspenseFragment.d.ts +7 -33
  220. package/react/hooks/useSuspenseFragment.js +17 -17
  221. package/react/hooks/useSuspenseFragment.js.map +1 -1
  222. package/react/hooks/useSuspenseQuery.js +4 -4
  223. package/react/hooks/useSuspenseQuery.js.map +1 -1
  224. package/react/hooks-compiled/internal/useDeepMemo.js +0 -2
  225. package/react/hooks-compiled/internal/useDeepMemo.js.map +1 -1
  226. package/react/hooks-compiled/internal/useSuspenseHookCacheKey.js +2 -0
  227. package/react/hooks-compiled/internal/useSuspenseHookCacheKey.js.map +1 -1
  228. package/react/hooks-compiled/useApolloClient.d.ts +1 -1
  229. package/react/hooks-compiled/useApolloClient.js +1 -1
  230. package/react/hooks-compiled/useApolloClient.js.map +1 -1
  231. package/react/hooks-compiled/useBackgroundQuery.js +3 -1
  232. package/react/hooks-compiled/useBackgroundQuery.js.map +1 -1
  233. package/react/hooks-compiled/useFragment.d.ts +6 -65
  234. package/react/hooks-compiled/useFragment.js +88 -110
  235. package/react/hooks-compiled/useFragment.js.map +1 -1
  236. package/react/hooks-compiled/useLazyQuery.js +0 -2
  237. package/react/hooks-compiled/useLazyQuery.js.map +1 -1
  238. package/react/hooks-compiled/useLoadableQuery.js +75 -69
  239. package/react/hooks-compiled/useMutation.d.ts +1 -13
  240. package/react/hooks-compiled/useMutation.js +13 -5
  241. package/react/hooks-compiled/useMutation.js.map +1 -1
  242. package/react/hooks-compiled/useQuery.js +56 -44
  243. package/react/hooks-compiled/useQuery.js.map +1 -1
  244. package/react/hooks-compiled/useQueryRefHandlers.js +5 -1
  245. package/react/hooks-compiled/useQueryRefHandlers.js.map +1 -1
  246. package/react/hooks-compiled/useReadQuery.js +14 -77
  247. package/react/hooks-compiled/useReadQuery.js.map +1 -1
  248. package/react/hooks-compiled/useSubscription.js +93 -237
  249. package/react/hooks-compiled/useSubscription.js.map +1 -1
  250. package/react/hooks-compiled/useSuspenseFragment.d.ts +7 -33
  251. package/react/hooks-compiled/useSuspenseFragment.js +17 -17
  252. package/react/hooks-compiled/useSuspenseFragment.js.map +1 -1
  253. package/react/hooks-compiled/useSuspenseQuery.js +8 -4
  254. package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
  255. package/react/index.compiled.d.ts +1 -1
  256. package/react/index.compiled.js +1 -1
  257. package/react/index.compiled.js.map +1 -1
  258. package/react/internal/cache/FragmentReference.d.ts +4 -2
  259. package/react/internal/cache/FragmentReference.js +22 -3
  260. package/react/internal/cache/FragmentReference.js.map +1 -1
  261. package/react/internal/cache/QueryReference.d.ts +0 -5
  262. package/react/internal/cache/QueryReference.js +0 -16
  263. package/react/internal/cache/QueryReference.js.map +1 -1
  264. package/react/internal/cache/SuspenseCache.d.ts +1 -1
  265. package/react/internal/cache/SuspenseCache.js.map +1 -1
  266. package/react/internal/cache/types.d.ts +2 -2
  267. package/react/internal/cache/types.js.map +1 -1
  268. package/react/query-preloader/createQueryPreloader.js +1 -41
  269. package/react/query-preloader/createQueryPreloader.js.map +1 -1
  270. package/react/ssr/useSSRQuery.js +0 -1
  271. package/react/ssr/useSSRQuery.js.map +1 -1
  272. package/utilities/DeepPartial.d.ts +1 -1
  273. package/utilities/DeepPartial.js.map +1 -1
  274. package/utilities/internal/DeepMerger.d.ts +4 -20
  275. package/utilities/internal/DeepMerger.js +4 -36
  276. package/utilities/internal/DeepMerger.js.map +1 -1
  277. package/utilities/internal/bindCacheKey.d.ts +15 -0
  278. package/utilities/internal/bindCacheKey.js +18 -0
  279. package/utilities/internal/bindCacheKey.js.map +1 -0
  280. package/utilities/internal/compact.js +1 -1
  281. package/utilities/internal/compact.js.map +1 -1
  282. package/utilities/internal/constants.d.ts +0 -16
  283. package/utilities/internal/constants.js +0 -16
  284. package/utilities/internal/constants.js.map +1 -1
  285. package/utilities/internal/getStoreKeyName.js +0 -1
  286. package/utilities/internal/getStoreKeyName.js.map +1 -1
  287. package/utilities/internal/index.d.ts +2 -4
  288. package/utilities/internal/index.js +2 -3
  289. package/utilities/internal/index.js.map +1 -1
  290. package/utilities/internal/memoize.d.ts +1 -2
  291. package/utilities/internal/memoize.js +2 -2
  292. package/utilities/internal/memoize.js.map +1 -1
  293. package/version.js +1 -1
  294. package/version.js.map +1 -1
  295. package/__cjs/incremental/handlers/graphql17Alpha9.cjs +0 -222
  296. package/__cjs/incremental/handlers/graphql17Alpha9.cjs.map +0 -1
  297. package/__cjs/incremental/handlers/graphql17Alpha9.d.cts +0 -98
  298. package/__cjs/utilities/internal/combineLatestBatched.cjs +0 -71
  299. package/__cjs/utilities/internal/combineLatestBatched.cjs.map +0 -1
  300. package/__cjs/utilities/internal/combineLatestBatched.d.cts +0 -14
  301. package/__cjs/utilities/internal/mapObservableFragment.cjs +0 -27
  302. package/__cjs/utilities/internal/mapObservableFragment.cjs.map +0 -1
  303. package/__cjs/utilities/internal/mapObservableFragment.d.cts +0 -3
  304. package/__cjs/utilities/internal/ponyfills/FinalizationRegistry.cjs +0 -61
  305. package/__cjs/utilities/internal/ponyfills/FinalizationRegistry.cjs.map +0 -1
  306. package/__cjs/utilities/internal/ponyfills/FinalizationRegistry.d.cts +0 -11
  307. package/__cjs/utilities/internal/ponyfills/index.cjs +0 -6
  308. package/__cjs/utilities/internal/ponyfills/index.cjs.map +0 -1
  309. package/__cjs/utilities/internal/ponyfills/index.d.cts +0 -3
  310. package/__cjs/utilities/internal/ponyfills/index.react-native.cjs +0 -6
  311. package/__cjs/utilities/internal/ponyfills/index.react-native.cjs.map +0 -1
  312. package/__cjs/utilities/internal/ponyfills/index.react-native.d.cts +0 -2
  313. package/__cjs/utilities/internal/types/ExtensionsWithStreamDetails.cjs +0 -3
  314. package/__cjs/utilities/internal/types/ExtensionsWithStreamDetails.cjs.map +0 -1
  315. package/__cjs/utilities/internal/types/ExtensionsWithStreamDetails.d.cts +0 -24
  316. package/incremental/handlers/graphql17Alpha9.d.ts +0 -98
  317. package/incremental/handlers/graphql17Alpha9.js +0 -218
  318. package/incremental/handlers/graphql17Alpha9.js.map +0 -1
  319. package/legacyEntryPoints/utilities/internal/ponyfills/index.d.ts +0 -1
  320. package/legacyEntryPoints/utilities/internal/ponyfills/index.js +0 -1
  321. package/legacyEntryPoints/utilities/internal/ponyfills/ponyfills.cjs +0 -1
  322. package/legacyEntryPoints/utilities/internal/ponyfills/ponyfills.d.cts +0 -1
  323. package/utilities/internal/combineLatestBatched.d.ts +0 -14
  324. package/utilities/internal/combineLatestBatched.js +0 -68
  325. package/utilities/internal/combineLatestBatched.js.map +0 -1
  326. package/utilities/internal/mapObservableFragment.d.ts +0 -3
  327. package/utilities/internal/mapObservableFragment.js +0 -24
  328. package/utilities/internal/mapObservableFragment.js.map +0 -1
  329. package/utilities/internal/ponyfills/FinalizationRegistry.d.ts +0 -11
  330. package/utilities/internal/ponyfills/FinalizationRegistry.js +0 -57
  331. package/utilities/internal/ponyfills/FinalizationRegistry.js.map +0 -1
  332. package/utilities/internal/ponyfills/index.d.ts +0 -3
  333. package/utilities/internal/ponyfills/index.js +0 -3
  334. package/utilities/internal/ponyfills/index.js.map +0 -1
  335. package/utilities/internal/ponyfills/index.react-native.d.ts +0 -2
  336. package/utilities/internal/ponyfills/index.react-native.js +0 -2
  337. package/utilities/internal/ponyfills/index.react-native.js.map +0 -1
  338. package/utilities/internal/types/ExtensionsWithStreamDetails.d.ts +0 -24
  339. package/utilities/internal/types/ExtensionsWithStreamDetails.js +0 -2
  340. package/utilities/internal/types/ExtensionsWithStreamDetails.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import type { DocumentNode } from "graphql";
2
2
  import type { Observable } from "rxjs";
3
- import type { ApolloCache, Cache, IgnoreModifier, Reference } from "@apollo/client/cache";
3
+ import type { ApolloCache, IgnoreModifier, Reference } from "@apollo/client/cache";
4
4
  import type { Incremental } from "@apollo/client/incremental";
5
5
  import type { ApolloLink } from "@apollo/client/link";
6
6
  import type { ClientAwarenessLink } from "@apollo/client/link/client-awareness";
@@ -87,14 +87,6 @@ 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[];
98
90
  }
99
91
  interface DevtoolsOptions {
100
92
  /**
@@ -384,13 +376,7 @@ export declare namespace ApolloClient {
384
376
  extensions?: Record<string, unknown>;
385
377
  }
386
378
  type WatchFragmentOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables> = ApolloCache.WatchFragmentOptions<TData, TVariables>;
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
- }
379
+ type WatchFragmentResult<TData = unknown> = ApolloCache.WatchFragmentResult<TData>;
394
380
  /**
395
381
  * Watched query options.
396
382
  */
@@ -537,6 +523,12 @@ export declare namespace ApolloClient {
537
523
  }
538
524
  namespace Base {
539
525
  interface ReadFragmentOptions<TData, TVariables extends OperationVariables> {
526
+ /**
527
+ * The root id to be used. This id should take the same form as the
528
+ * value returned by the `cache.identify` function. If a value with your
529
+ * id does not exist in the store, `null` will be returned.
530
+ */
531
+ id?: string;
540
532
  /**
541
533
  * A GraphQL document created using the `gql` template string tag
542
534
  * with one or more fragments which will be used to determine
@@ -565,27 +557,7 @@ export declare namespace ApolloClient {
565
557
  optimistic?: boolean;
566
558
  }
567
559
  }
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>;
560
+ type ReadFragmentOptions<TData, TVariables extends OperationVariables> = Base.ReadFragmentOptions<TData, TVariables> & VariablesOption<TVariables>;
589
561
  namespace DocumentationTypes {
590
562
  interface WriteQueryOptions<TData, TVariables extends OperationVariables> extends Base.WriteQueryOptions<TData, TVariables> {
591
563
  /**
@@ -623,11 +595,6 @@ export declare namespace ApolloClient {
623
595
  * @defaultValue false
624
596
  */
625
597
  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>;
631
598
  }
632
599
  }
633
600
  type WriteQueryOptions<TData, TVariables extends OperationVariables> = Base.WriteQueryOptions<TData, TVariables> & VariablesOption<TVariables>;
@@ -641,6 +608,12 @@ export declare namespace ApolloClient {
641
608
  }
642
609
  namespace Base {
643
610
  interface WriteFragmentOptions<TData, TVariables extends OperationVariables> {
611
+ /**
612
+ * The root id to be used. This id should take the same form as the
613
+ * value returned by the `cache.identify` function. If a value with your
614
+ * id does not exist in the store, `null` will be returned.
615
+ */
616
+ id?: string;
644
617
  /**
645
618
  * A GraphQL document created using the `gql` template string tag from
646
619
  * `graphql-tag` with one or more fragments which will be used to determine
@@ -672,35 +645,15 @@ export declare namespace ApolloClient {
672
645
  overwrite?: boolean;
673
646
  }
674
647
  }
675
- type WriteFragmentOptions<TData, TVariables extends OperationVariables> = Base.WriteFragmentOptions<TData, TVariables> & VariablesOption<TVariables> & Cache.CacheIdentifierOption<TData>;
648
+ type WriteFragmentOptions<TData, TVariables extends OperationVariables> = Base.WriteFragmentOptions<TData, TVariables> & VariablesOption<TVariables>;
676
649
  namespace DocumentationTypes {
677
650
  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>;
694
651
  /**
695
652
  * Any variables that your GraphQL fragments depend on.
696
653
  */
697
654
  variables?: TVariables;
698
655
  }
699
656
  }
700
- interface Experiment {
701
- (this: ApolloClient, options: ApolloClient.Options): void;
702
- v: 1;
703
- }
704
657
  }
705
658
  /**
706
659
  * This is the primary Apollo Client class. It is used to send GraphQL documents (i.e. queries
@@ -873,86 +826,7 @@ export declare class ApolloClient {
873
826
  * the cache to identify the fragment and optionally specify whether to react
874
827
  * to optimistic updates.
875
828
  */
876
- watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WatchFragmentOptions<TData, TVariables> & {
877
- from: Array<ApolloCache.FromOptionValue<TData>>;
878
- }): ApolloClient.ObservableFragment<Array<TData>>;
879
- /**
880
- * Watches the cache store of the fragment according to the options specified
881
- * and returns an `Observable`. We can subscribe to this
882
- * `Observable` and receive updated results through an
883
- * observer when the cache store changes.
884
- *
885
- * You must pass in a GraphQL document with a single fragment or a document
886
- * with multiple fragments that represent what you are reading. If you pass
887
- * in a document with multiple fragments then you must also specify a
888
- * `fragmentName`.
889
- *
890
- * @since 3.10.0
891
- * @param options - An object of type `WatchFragmentOptions` that allows
892
- * the cache to identify the fragment and optionally specify whether to react
893
- * to optimistic updates.
894
- */
895
- watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WatchFragmentOptions<TData, TVariables> & {
896
- from: Array<null>;
897
- }): ApolloClient.ObservableFragment<Array<null>>;
898
- watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WatchFragmentOptions<TData, TVariables> & {
899
- from: Array<ApolloCache.FromOptionValue<TData> | null>;
900
- }): ApolloClient.ObservableFragment<Array<TData | null>>;
901
- /**
902
- * Watches the cache store of the fragment according to the options specified
903
- * and returns an `Observable`. We can subscribe to this
904
- * `Observable` and receive updated results through an
905
- * observer when the cache store changes.
906
- *
907
- * You must pass in a GraphQL document with a single fragment or a document
908
- * with multiple fragments that represent what you are reading. If you pass
909
- * in a document with multiple fragments then you must also specify a
910
- * `fragmentName`.
911
- *
912
- * @since 3.10.0
913
- * @param options - An object of type `WatchFragmentOptions` that allows
914
- * the cache to identify the fragment and optionally specify whether to react
915
- * to optimistic updates.
916
- */
917
- watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WatchFragmentOptions<TData, TVariables> & {
918
- from: null;
919
- }): ApolloClient.ObservableFragment<null>;
920
- /**
921
- * Watches the cache store of the fragment according to the options specified
922
- * and returns an `Observable`. We can subscribe to this
923
- * `Observable` and receive updated results through an
924
- * observer when the cache store changes.
925
- *
926
- * You must pass in a GraphQL document with a single fragment or a document
927
- * with multiple fragments that represent what you are reading. If you pass
928
- * in a document with multiple fragments then you must also specify a
929
- * `fragmentName`.
930
- *
931
- * @since 3.10.0
932
- * @param options - An object of type `WatchFragmentOptions` that allows
933
- * the cache to identify the fragment and optionally specify whether to react
934
- * to optimistic updates.
935
- */
936
- watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WatchFragmentOptions<TData, TVariables> & {
937
- from: ApolloCache.FromOptionValue<TData>;
938
- }): ApolloClient.ObservableFragment<TData>;
939
- /**
940
- * Watches the cache store of the fragment according to the options specified
941
- * and returns an `Observable`. We can subscribe to this
942
- * `Observable` and receive updated results through an
943
- * observer when the cache store changes.
944
- *
945
- * You must pass in a GraphQL document with a single fragment or a document
946
- * with multiple fragments that represent what you are reading. If you pass
947
- * in a document with multiple fragments then you must also specify a
948
- * `fragmentName`.
949
- *
950
- * @since 3.10.0
951
- * @param options - An object of type `WatchFragmentOptions` that allows
952
- * the cache to identify the fragment and optionally specify whether to react
953
- * to optimistic updates.
954
- */
955
- watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WatchFragmentOptions<TData, TVariables>): ApolloClient.ObservableFragment<TData | null>;
829
+ watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WatchFragmentOptions<TData, TVariables>): Observable<ApolloClient.WatchFragmentResult<MaybeMasked<TData>>>;
956
830
  /**
957
831
  * Tries to read some data from the store in the shape of the provided
958
832
  * GraphQL fragment without making a network request. This method will read a
@@ -4,7 +4,7 @@ import { NotImplementedHandler } from "@apollo/client/incremental";
4
4
  import { execute } from "@apollo/client/link";
5
5
  import { DocumentTransform } from "@apollo/client/utilities";
6
6
  import { __DEV__ } from "@apollo/client/utilities/environment";
7
- import { checkDocument, compact, getApolloClientMemoryInternals, mapObservableFragmentMemoized, mergeOptions, removeMaskedFragmentSpreads, } from "@apollo/client/utilities/internal";
7
+ import { checkDocument, compact, getApolloClientMemoryInternals, mergeOptions, removeMaskedFragmentSpreads, } from "@apollo/client/utilities/internal";
8
8
  import { invariant } from "@apollo/client/utilities/invariant";
9
9
  import { version } from "../version.js";
10
10
  import { QueryManager } from "./QueryManager.js";
@@ -72,10 +72,10 @@ export class ApolloClient {
72
72
  */
73
73
  constructor(options) {
74
74
  if (__DEV__) {
75
- invariant(options.cache, 68);
76
- invariant(options.link, 69);
75
+ invariant(options.cache, 65);
76
+ invariant(options.link, 66);
77
77
  }
78
- const { cache, documentTransform, ssrMode = false, ssrForceFetchDelay = 0, queryDeduplication = true, defaultOptions, defaultContext, assumeImmutableResults = cache.assumeImmutableResults, localState, devtools, dataMasking, link, incrementalHandler = new NotImplementedHandler(), experiments = [], } = options;
78
+ const { cache, documentTransform, ssrMode = false, ssrForceFetchDelay = 0, queryDeduplication = true, defaultOptions, defaultContext, assumeImmutableResults = cache.assumeImmutableResults, localState, devtools, dataMasking, link, incrementalHandler = new NotImplementedHandler(), } = options;
79
79
  this.link = link;
80
80
  this.cache = cache;
81
81
  this.queryDeduplication = queryDeduplication;
@@ -120,7 +120,6 @@ export class ApolloClient {
120
120
  }
121
121
  if (this.devtoolsConfig.enabled)
122
122
  this.connectToDevTools();
123
- experiments.forEach((experiment) => experiment.call(this, options));
124
123
  }
125
124
  connectToDevTools() {
126
125
  if (typeof window === "undefined") {
@@ -234,13 +233,13 @@ export class ApolloClient {
234
233
  options = mergeOptions(this.defaultOptions.query, options);
235
234
  }
236
235
  if (__DEV__) {
237
- invariant(options.fetchPolicy !== "cache-and-network", 70);
238
- invariant(options.fetchPolicy !== "standby", 71);
239
- invariant(options.query, 72);
240
- invariant(options.query.kind === "Document", 73);
241
- invariant(!options.returnPartialData, 74);
242
- invariant(!options.pollInterval, 75);
243
- invariant(!options.notifyOnNetworkStatusChange, 76);
236
+ invariant(options.fetchPolicy !== "cache-and-network", 67);
237
+ invariant(options.fetchPolicy !== "standby", 68);
238
+ invariant(options.query, 69);
239
+ invariant(options.query.kind === "Document", 70);
240
+ invariant(!options.returnPartialData, 71);
241
+ invariant(!options.pollInterval, 72);
242
+ invariant(!options.notifyOnNetworkStatusChange, 73);
244
243
  }
245
244
  return this.queryManager.query(options);
246
245
  }
@@ -258,9 +257,9 @@ export class ApolloClient {
258
257
  errorPolicy: "none",
259
258
  }, this.defaultOptions.mutate), options);
260
259
  if (__DEV__) {
261
- invariant(optionsWithDefaults.mutation, 77);
260
+ invariant(optionsWithDefaults.mutation, 74);
262
261
  invariant(optionsWithDefaults.fetchPolicy === "network-only" ||
263
- optionsWithDefaults.fetchPolicy === "no-cache", 78);
262
+ optionsWithDefaults.fetchPolicy === "no-cache", 75);
264
263
  }
265
264
  checkDocument(optionsWithDefaults.mutation, OperationTypeNode.MUTATION);
266
265
  return this.queryManager.mutate(optionsWithDefaults);
@@ -286,27 +285,46 @@ export class ApolloClient {
286
285
  readQuery(options, optimistic = false) {
287
286
  return this.cache.readQuery({ ...options, query: this.transform(options.query) }, optimistic);
288
287
  }
288
+ /**
289
+ * Watches the cache store of the fragment according to the options specified
290
+ * and returns an `Observable`. We can subscribe to this
291
+ * `Observable` and receive updated results through an
292
+ * observer when the cache store changes.
293
+ *
294
+ * You must pass in a GraphQL document with a single fragment or a document
295
+ * with multiple fragments that represent what you are reading. If you pass
296
+ * in a document with multiple fragments then you must also specify a
297
+ * `fragmentName`.
298
+ *
299
+ * @since 3.10.0
300
+ * @param options - An object of type `WatchFragmentOptions` that allows
301
+ * the cache to identify the fragment and optionally specify whether to react
302
+ * to optimistic updates.
303
+ */
289
304
  watchFragment(options) {
290
305
  const dataMasking = this.queryManager.dataMasking;
291
- const observable = this.cache.watchFragment({
306
+ return this.cache
307
+ .watchFragment({
292
308
  ...options,
293
309
  fragment: this.transform(options.fragment, dataMasking),
294
- });
295
- if (__DEV__) {
296
- return mapObservableFragmentMemoized(observable, Symbol.for("apollo.transform.dev.mask"), (result) => ({
297
- ...result,
298
- // The transform will remove fragment spreads from the fragment
299
- // document when dataMasking is enabled. The `mask` function
300
- // remains to apply warnings to fragments marked as
301
- // `@unmask(mode: "migrate")`. Since these warnings are only applied
302
- // in dev, we can skip the masking algorithm entirely for production.
303
- data: this.queryManager.maskFragment({
304
- ...options,
305
- data: result.data,
306
- }),
307
- }));
308
- }
309
- return observable;
310
+ })
311
+ .pipe(map((result) => {
312
+ // The transform will remove fragment spreads from the fragment
313
+ // document when dataMasking is enabled. The `maskFragment` function
314
+ // remains to apply warnings to fragments marked as
315
+ // `@unmask(mode: "migrate")`. Since these warnings are only applied
316
+ // in dev, we can skip the masking algorithm entirely for production.
317
+ if (__DEV__) {
318
+ if (dataMasking) {
319
+ const data = this.queryManager.maskFragment({
320
+ ...options,
321
+ data: result.data,
322
+ });
323
+ return { ...result, data };
324
+ }
325
+ }
326
+ return result;
327
+ }));
310
328
  }
311
329
  readFragment(options, optimistic = false) {
312
330
  return this.cache.readFragment({ ...options, fragment: this.transform(options.fragment) }, optimistic);
@@ -466,7 +484,7 @@ export class ApolloClient {
466
484
  // result.queries and result.results instead, you shouldn't have to worry
467
485
  // about preventing uncaught rejections for the Promise.all result.
468
486
  result.catch((error) => {
469
- __DEV__ && invariant.debug(79, error);
487
+ __DEV__ && invariant.debug(76, error);
470
488
  });
471
489
  return result;
472
490
  }