@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
@@ -50,11 +50,6 @@ export declare namespace Cache {
50
50
  * @defaultValue false
51
51
  */
52
52
  overwrite?: boolean;
53
- /**
54
- * GraphQL extensions for the write operation. Any provided `extensions`
55
- * are available in `merge` functions.
56
- */
57
- extensions?: Record<string, unknown>;
58
53
  }
59
54
  interface DiffOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables> extends Omit<ReadOptions<TData, TVariables>, "rootId"> {
60
55
  }
@@ -143,7 +138,13 @@ export declare namespace Cache {
143
138
  */
144
139
  optimistic?: boolean;
145
140
  }
146
- type ReadFragmentOptions<TData, TVariables extends OperationVariables> = {
141
+ interface ReadFragmentOptions<TData, TVariables extends OperationVariables> {
142
+ /**
143
+ * The root id to be used. This id should take the same form as the
144
+ * value returned by the `cache.identify` function. If a value with your
145
+ * id does not exist in the store, `null` will be returned.
146
+ */
147
+ id?: string;
147
148
  /**
148
149
  * A GraphQL document created using the `gql` template string tag from
149
150
  * `graphql-tag` with one or more fragments which will be used to determine
@@ -174,7 +175,7 @@ export declare namespace Cache {
174
175
  * @defaultValue false
175
176
  */
176
177
  optimistic?: boolean;
177
- } & Cache.CacheIdentifierOption<TData>;
178
+ }
178
179
  interface WriteQueryOptions<TData, TVariables extends OperationVariables> {
179
180
  /**
180
181
  * The GraphQL query shape to be used constructed using the `gql` template
@@ -207,13 +208,14 @@ export declare namespace Cache {
207
208
  * @defaultValue false
208
209
  */
209
210
  overwrite?: boolean;
211
+ }
212
+ interface WriteFragmentOptions<TData, TVariables extends OperationVariables> {
210
213
  /**
211
- * GraphQL extensions for the write operation. Any provided `extensions`
212
- * are available in `merge` functions.
214
+ * The root id to be used. This id should take the same form as the
215
+ * value returned by the `cache.identify` function. If a value with your
216
+ * id does not exist in the store, `null` will be returned.
213
217
  */
214
- extensions?: Record<string, unknown>;
215
- }
216
- type WriteFragmentOptions<TData, TVariables extends OperationVariables> = {
218
+ id?: string;
217
219
  /**
218
220
  * A GraphQL document created using the `gql` template string
219
221
  * with one or more fragments which will be used to determine
@@ -247,10 +249,11 @@ export declare namespace Cache {
247
249
  * @defaultValue false
248
250
  */
249
251
  overwrite?: boolean;
250
- } & Cache.CacheIdentifierOption<TData>;
252
+ }
251
253
  interface UpdateQueryOptions<TData, TVariables extends OperationVariables> extends Omit<ReadQueryOptions<TData, TVariables> & WriteQueryOptions<TData, TVariables>, "data"> {
252
254
  }
253
- type UpdateFragmentOptions<TData, TVariables extends OperationVariables> = Omit<ReadFragmentOptions<TData, TVariables> & WriteFragmentOptions<TData, TVariables>, "data" | "id" | "from"> & Cache.CacheIdentifierOption<TData>;
255
+ interface UpdateFragmentOptions<TData, TVariables extends OperationVariables> extends Omit<ReadFragmentOptions<TData, TVariables> & WriteFragmentOptions<TData, TVariables>, "data"> {
256
+ }
254
257
  type DiffResult<TData> = {
255
258
  result: DataValue.Complete<TData>;
256
259
  complete: true;
@@ -262,40 +265,5 @@ export declare namespace Cache {
262
265
  missing?: MissingFieldError;
263
266
  fromOptimisticTransaction?: boolean;
264
267
  };
265
- type CacheIdentifierOption<TData> = {
266
- /**
267
- * The root id to be used. This id should take the same form as the
268
- * value returned by the `cache.identify` function. If a value with your
269
- * id does not exist in the store, `null` will be returned.
270
- */
271
- id?: string;
272
- /**
273
- * An object containing a `__typename` and primary key fields
274
- * (such as `id`) identifying the entity object from which the fragment will
275
- * be retrieved, or a `{ __ref: "..." }` reference, or a `string` ID
276
- * (uncommon).
277
- *
278
- * @remarks
279
- * `from` is given precedence over `id` when both are provided.
280
- */
281
- from?: never;
282
- } | {
283
- /**
284
- * The root id to be used. This id should take the same form as the
285
- * value returned by the `cache.identify` function. If a value with your
286
- * id does not exist in the store, `null` will be returned.
287
- */
288
- id?: never;
289
- /**
290
- * An object containing a `__typename` and primary key fields
291
- * (such as `id`) identifying the entity object from which the fragment will
292
- * be retrieved, or a `{ __ref: "..." }` reference, or a `string` ID
293
- * (uncommon).
294
- *
295
- * @remarks
296
- * `from` is given precedence over `id` when both are provided.
297
- */
298
- from?: ApolloCache.FromOptionValue<TData>;
299
- };
300
268
  }
301
269
  //# sourceMappingURL=Cache.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Cache.js","sourceRoot":"","sources":["../../../../src/cache/core/types/Cache.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n DataValue,\n DocumentNode,\n OperationVariables,\n TypedDocumentNode,\n} from \"@apollo/client\";\nimport type { Unmasked } from \"@apollo/client/masking\";\n\nimport type { ApolloCache } from \"../cache.js\";\n\nimport type {\n AllFieldsModifier,\n MissingFieldError,\n Modifiers,\n} from \"./common.js\";\nexport declare namespace Cache {\n export type WatchCallback<TData = unknown> = (\n diff: Cache.DiffResult<TData>,\n lastDiff?: Cache.DiffResult<TData>\n ) => void;\n\n export interface ReadOptions<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n > {\n /**\n * The GraphQL query shape to be used constructed using the `gql` template\n * string tag from `graphql-tag`. The query will be used to determine the\n * shape of the data to be read.\n */\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * Any variables that the GraphQL query may depend on.\n */\n variables?: TVariables;\n\n /**\n * The root id to be used. Defaults to \"ROOT_QUERY\", which is the ID of the\n * root query object. This property makes writeQuery capable of writing data\n * to any object in the cache.\n */\n id?: string;\n rootId?: string;\n previousResult?: any;\n optimistic: boolean;\n returnPartialData?: boolean;\n }\n\n export interface WriteOptions<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n > {\n /**\n * The GraphQL query shape to be used constructed using the `gql` template\n * string tag from `graphql-tag`. The query will be used to determine the\n * shape of the data to be read.\n */\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * Any variables that the GraphQL query may depend on.\n */\n variables?: TVariables;\n\n dataId?: string;\n result: Unmasked<TData>;\n\n /**\n * Whether to notify query watchers.\n * @defaultValue true\n */\n broadcast?: boolean;\n /**\n * When true, ignore existing field data rather than merging it with\n * incoming data.\n * @defaultValue false\n */\n overwrite?: boolean;\n\n /**\n * GraphQL extensions for the write operation. Any provided `extensions`\n * are available in `merge` functions.\n */\n extensions?: Record<string, unknown>;\n }\n\n export interface DiffOptions<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n > extends Omit<ReadOptions<TData, TVariables>, \"rootId\"> {\n // The DiffOptions interface is currently just an alias for\n // ReadOptions, though DiffOptions used to be responsible for\n // declaring the returnPartialData option.\n }\n\n export interface WatchOptions<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n > extends DiffOptions<TData, TVariables> {\n watcher?: object;\n immediate?: boolean;\n callback: WatchCallback<TData>;\n lastDiff?: DiffResult<TData>;\n }\n\n export interface EvictOptions {\n id?: string;\n fieldName?: string;\n args?: Record<string, any>;\n broadcast?: boolean;\n }\n\n // Although you can call cache.reset() without options, its behavior can be\n // configured by passing a Cache.ResetOptions object.\n export interface ResetOptions {\n discardWatches?: boolean;\n }\n\n export interface ModifyOptions<\n Entity extends Record<string, any> = Record<string, any>,\n > {\n id?: string;\n fields: Modifiers<Entity> | AllFieldsModifier<Entity>;\n optimistic?: boolean;\n broadcast?: boolean;\n }\n\n export interface BatchOptions<\n TCache extends ApolloCache,\n TUpdateResult = void,\n > {\n /**\n * A function that performs cache operations. Receives the cache instance as its argument.\n *\n * The return value of this function becomes the return value of `batch`.\n */\n update(cache: TCache): TUpdateResult;\n\n /**\n * Controls how optimistic data is handled:\n *\n * - `string`: Creates a new optimistic layer with this ID. Use `removeOptimistic` later to remove it.\n * - `true`: Updates the current top layer of the cache (including any optimistic data).\n * - `false`: Updates only the root (non-optimistic) cache data.\n *\n * @defaultValue false\n */\n optimistic?: string | boolean;\n\n /**\n * If provided, removes the optimistic layer with this ID after the batch completes.\n *\n * This is useful for atomically applying server data while removing a pending optimistic update, triggering at most one broadcast for both operations.\n *\n * Note: this option is needed because calling `cache.removeOptimistic` during the transaction function may not be safe, since any modifications to cache layers may be discarded after the transaction finishes.\n */\n removeOptimistic?: string;\n\n /**\n * Optional callback invoked for each watcher affected by the batch operation.\n *\n * Receives the watch options, the new diff result, and optionally the previous diff result.\n *\n * Return `false` to prevent broadcasting to that specific watcher.\n */\n onWatchUpdated?: (\n this: TCache,\n watch: Cache.WatchOptions,\n diff: Cache.DiffResult<any>,\n lastDiff?: Cache.DiffResult<any> | undefined\n ) => any;\n }\n\n export interface ReadQueryOptions<\n TData,\n TVariables extends OperationVariables,\n > {\n /**\n * The GraphQL query shape to be used constructed using the `gql` template\n * string tag. The query will be used to determine the\n * shape of the data to be read.\n */\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * Any variables that the GraphQL query may depend on.\n */\n variables?: TVariables;\n\n /**\n * The root id to be used. Defaults to \"ROOT_QUERY\", which is the ID of the\n * root query object. This property makes readQuery capable of reading data\n * from any object in the cache.\n */\n id?: string;\n /**\n * Whether to return incomplete data rather than null.\n * @defaultValue false\n */\n returnPartialData?: boolean;\n /**\n * Whether to read from optimistic or non-optimistic cache data. If\n * this named option is provided, the optimistic parameter of the\n * readQuery method can be omitted.\n * @defaultValue false\n */\n optimistic?: boolean;\n }\n\n export type ReadFragmentOptions<\n TData,\n TVariables extends OperationVariables,\n > = {\n /**\n * A GraphQL document created using the `gql` template string tag from\n * `graphql-tag` with one or more fragments which will be used to determine\n * the shape of data to read. If you provide more than one fragment in this\n * document then you must also specify `fragmentName` to specify which\n * fragment is the root fragment.\n */\n fragment: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * The name of the fragment in your GraphQL document to be used. If you do\n * not provide a `fragmentName` and there is only one fragment in your\n * `fragment` document then that fragment will be used.\n */\n fragmentName?: string;\n\n /**\n * Any variables that your GraphQL fragments depend on.\n */\n variables?: TVariables;\n\n /**\n * Whether to return incomplete data rather than null.\n * @defaultValue false\n */\n returnPartialData?: boolean;\n /**\n * Whether to read from optimistic or non-optimistic cache data. If\n * this named option is provided, the optimistic parameter of the\n * readFragment method can be omitted.\n * @defaultValue false\n */\n optimistic?: boolean;\n } & Cache.CacheIdentifierOption<TData>;\n\n export interface WriteQueryOptions<\n TData,\n TVariables extends OperationVariables,\n > {\n /**\n * The GraphQL query shape to be used constructed using the `gql` template\n * string tag from `graphql-tag`. The query will be used to determine the\n * shape of the data to be read.\n */\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * Any variables that the GraphQL query may depend on.\n */\n variables?: TVariables;\n\n /**\n * The root id to be used. Defaults to \"ROOT_QUERY\", which is the ID of the\n * root query object. This property makes writeQuery capable of writing data\n * to any object in the cache.\n */\n id?: string;\n\n /**\n * The data to write to the store.\n */\n data: Unmasked<TData>;\n /**\n * Whether to notify query watchers.\n * @defaultValue true\n */\n broadcast?: boolean;\n /**\n * When true, ignore existing field data rather than merging it with\n * incoming data.\n * @defaultValue false\n */\n overwrite?: boolean;\n\n /**\n * GraphQL extensions for the write operation. Any provided `extensions`\n * are available in `merge` functions.\n */\n extensions?: Record<string, unknown>;\n }\n\n export type WriteFragmentOptions<\n TData,\n TVariables extends OperationVariables,\n > = {\n /**\n * A GraphQL document created using the `gql` template string\n * with one or more fragments which will be used to determine\n * the shape of data to read. If you provide more than one fragment in this\n * document then you must also specify `fragmentName` to specify specify which\n * fragment is the root fragment.\n */\n fragment: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * The name of the fragment in your GraphQL document to be used. If you do\n * not provide a `fragmentName` and there is only one fragment in your\n * `fragment` document then that fragment will be used.\n */\n fragmentName?: string;\n\n /**\n * Any variables that your GraphQL fragments depend on.\n */\n variables?: TVariables;\n /**\n * The data to write to the store.\n */\n data: Unmasked<TData>;\n /**\n * Whether to notify query watchers.\n * @defaultValue true\n */\n broadcast?: boolean;\n /**\n * When true, ignore existing field data rather than merging it with\n * incoming data.\n * @defaultValue false\n */\n overwrite?: boolean;\n } & Cache.CacheIdentifierOption<TData>;\n\n export interface UpdateQueryOptions<\n TData,\n TVariables extends OperationVariables,\n > extends Omit<\n ReadQueryOptions<TData, TVariables> &\n WriteQueryOptions<TData, TVariables>,\n \"data\"\n > {}\n\n export type UpdateFragmentOptions<\n TData,\n TVariables extends OperationVariables,\n > = Omit<\n ReadFragmentOptions<TData, TVariables> &\n WriteFragmentOptions<TData, TVariables>,\n \"data\" | \"id\" | \"from\"\n > &\n Cache.CacheIdentifierOption<TData>;\n\n export type DiffResult<TData> =\n | {\n result: DataValue.Complete<TData>;\n complete: true;\n missing?: never;\n fromOptimisticTransaction?: boolean;\n }\n | {\n result: DataValue.Partial<TData> | null;\n complete: false;\n missing?: MissingFieldError;\n fromOptimisticTransaction?: boolean;\n };\n\n export type CacheIdentifierOption<TData> =\n | {\n /**\n * The root id to be used. This id should take the same form as the\n * value returned by the `cache.identify` function. If a value with your\n * id does not exist in the store, `null` will be returned.\n */\n id?: string;\n\n /**\n * An object containing a `__typename` and primary key fields\n * (such as `id`) identifying the entity object from which the fragment will\n * be retrieved, or a `{ __ref: \"...\" }` reference, or a `string` ID\n * (uncommon).\n *\n * @remarks\n * `from` is given precedence over `id` when both are provided.\n */\n from?: never;\n }\n | {\n /**\n * The root id to be used. This id should take the same form as the\n * value returned by the `cache.identify` function. If a value with your\n * id does not exist in the store, `null` will be returned.\n */\n id?: never;\n\n /**\n * An object containing a `__typename` and primary key fields\n * (such as `id`) identifying the entity object from which the fragment will\n * be retrieved, or a `{ __ref: \"...\" }` reference, or a `string` ID\n * (uncommon).\n *\n * @remarks\n * `from` is given precedence over `id` when both are provided.\n */\n from?: ApolloCache.FromOptionValue<TData>;\n };\n}\n"]}
1
+ {"version":3,"file":"Cache.js","sourceRoot":"","sources":["../../../../src/cache/core/types/Cache.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n DataValue,\n DocumentNode,\n OperationVariables,\n TypedDocumentNode,\n} from \"@apollo/client\";\nimport type { Unmasked } from \"@apollo/client/masking\";\n\nimport type { ApolloCache } from \"../cache.js\";\n\nimport type {\n AllFieldsModifier,\n MissingFieldError,\n Modifiers,\n} from \"./common.js\";\nexport declare namespace Cache {\n export type WatchCallback<TData = unknown> = (\n diff: Cache.DiffResult<TData>,\n lastDiff?: Cache.DiffResult<TData>\n ) => void;\n\n export interface ReadOptions<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n > {\n /**\n * The GraphQL query shape to be used constructed using the `gql` template\n * string tag from `graphql-tag`. The query will be used to determine the\n * shape of the data to be read.\n */\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * Any variables that the GraphQL query may depend on.\n */\n variables?: TVariables;\n\n /**\n * The root id to be used. Defaults to \"ROOT_QUERY\", which is the ID of the\n * root query object. This property makes writeQuery capable of writing data\n * to any object in the cache.\n */\n id?: string;\n rootId?: string;\n previousResult?: any;\n optimistic: boolean;\n returnPartialData?: boolean;\n }\n\n export interface WriteOptions<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n > {\n /**\n * The GraphQL query shape to be used constructed using the `gql` template\n * string tag from `graphql-tag`. The query will be used to determine the\n * shape of the data to be read.\n */\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * Any variables that the GraphQL query may depend on.\n */\n variables?: TVariables;\n\n dataId?: string;\n result: Unmasked<TData>;\n\n /**\n * Whether to notify query watchers.\n * @defaultValue true\n */\n broadcast?: boolean;\n /**\n * When true, ignore existing field data rather than merging it with\n * incoming data.\n * @defaultValue false\n */\n overwrite?: boolean;\n }\n\n export interface DiffOptions<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n > extends Omit<ReadOptions<TData, TVariables>, \"rootId\"> {\n // The DiffOptions interface is currently just an alias for\n // ReadOptions, though DiffOptions used to be responsible for\n // declaring the returnPartialData option.\n }\n\n export interface WatchOptions<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n > extends DiffOptions<TData, TVariables> {\n watcher?: object;\n immediate?: boolean;\n callback: WatchCallback<TData>;\n lastDiff?: DiffResult<TData>;\n }\n\n export interface EvictOptions {\n id?: string;\n fieldName?: string;\n args?: Record<string, any>;\n broadcast?: boolean;\n }\n\n // Although you can call cache.reset() without options, its behavior can be\n // configured by passing a Cache.ResetOptions object.\n export interface ResetOptions {\n discardWatches?: boolean;\n }\n\n export interface ModifyOptions<\n Entity extends Record<string, any> = Record<string, any>,\n > {\n id?: string;\n fields: Modifiers<Entity> | AllFieldsModifier<Entity>;\n optimistic?: boolean;\n broadcast?: boolean;\n }\n\n export interface BatchOptions<\n TCache extends ApolloCache,\n TUpdateResult = void,\n > {\n /**\n * A function that performs cache operations. Receives the cache instance as its argument.\n *\n * The return value of this function becomes the return value of `batch`.\n */\n update(cache: TCache): TUpdateResult;\n\n /**\n * Controls how optimistic data is handled:\n *\n * - `string`: Creates a new optimistic layer with this ID. Use `removeOptimistic` later to remove it.\n * - `true`: Updates the current top layer of the cache (including any optimistic data).\n * - `false`: Updates only the root (non-optimistic) cache data.\n *\n * @defaultValue false\n */\n optimistic?: string | boolean;\n\n /**\n * If provided, removes the optimistic layer with this ID after the batch completes.\n *\n * This is useful for atomically applying server data while removing a pending optimistic update, triggering at most one broadcast for both operations.\n *\n * Note: this option is needed because calling `cache.removeOptimistic` during the transaction function may not be safe, since any modifications to cache layers may be discarded after the transaction finishes.\n */\n removeOptimistic?: string;\n\n /**\n * Optional callback invoked for each watcher affected by the batch operation.\n *\n * Receives the watch options, the new diff result, and optionally the previous diff result.\n *\n * Return `false` to prevent broadcasting to that specific watcher.\n */\n onWatchUpdated?: (\n this: TCache,\n watch: Cache.WatchOptions,\n diff: Cache.DiffResult<any>,\n lastDiff?: Cache.DiffResult<any> | undefined\n ) => any;\n }\n\n export interface ReadQueryOptions<\n TData,\n TVariables extends OperationVariables,\n > {\n /**\n * The GraphQL query shape to be used constructed using the `gql` template\n * string tag. The query will be used to determine the\n * shape of the data to be read.\n */\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * Any variables that the GraphQL query may depend on.\n */\n variables?: TVariables;\n\n /**\n * The root id to be used. Defaults to \"ROOT_QUERY\", which is the ID of the\n * root query object. This property makes readQuery capable of reading data\n * from any object in the cache.\n */\n id?: string;\n /**\n * Whether to return incomplete data rather than null.\n * @defaultValue false\n */\n returnPartialData?: boolean;\n /**\n * Whether to read from optimistic or non-optimistic cache data. If\n * this named option is provided, the optimistic parameter of the\n * readQuery method can be omitted.\n * @defaultValue false\n */\n optimistic?: boolean;\n }\n\n export interface ReadFragmentOptions<\n TData,\n TVariables extends OperationVariables,\n > {\n /**\n * The root id to be used. This id should take the same form as the\n * value returned by the `cache.identify` function. If a value with your\n * id does not exist in the store, `null` will be returned.\n */\n id?: string;\n\n /**\n * A GraphQL document created using the `gql` template string tag from\n * `graphql-tag` with one or more fragments which will be used to determine\n * the shape of data to read. If you provide more than one fragment in this\n * document then you must also specify `fragmentName` to specify which\n * fragment is the root fragment.\n */\n fragment: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * The name of the fragment in your GraphQL document to be used. If you do\n * not provide a `fragmentName` and there is only one fragment in your\n * `fragment` document then that fragment will be used.\n */\n fragmentName?: string;\n\n /**\n * Any variables that your GraphQL fragments depend on.\n */\n variables?: TVariables;\n\n /**\n * Whether to return incomplete data rather than null.\n * @defaultValue false\n */\n returnPartialData?: boolean;\n /**\n * Whether to read from optimistic or non-optimistic cache data. If\n * this named option is provided, the optimistic parameter of the\n * readFragment method can be omitted.\n * @defaultValue false\n */\n optimistic?: boolean;\n }\n\n export interface WriteQueryOptions<\n TData,\n TVariables extends OperationVariables,\n > {\n /**\n * The GraphQL query shape to be used constructed using the `gql` template\n * string tag from `graphql-tag`. The query will be used to determine the\n * shape of the data to be read.\n */\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * Any variables that the GraphQL query may depend on.\n */\n variables?: TVariables;\n\n /**\n * The root id to be used. Defaults to \"ROOT_QUERY\", which is the ID of the\n * root query object. This property makes writeQuery capable of writing data\n * to any object in the cache.\n */\n id?: string;\n\n /**\n * The data to write to the store.\n */\n data: Unmasked<TData>;\n /**\n * Whether to notify query watchers.\n * @defaultValue true\n */\n broadcast?: boolean;\n /**\n * When true, ignore existing field data rather than merging it with\n * incoming data.\n * @defaultValue false\n */\n overwrite?: boolean;\n }\n\n export interface WriteFragmentOptions<\n TData,\n TVariables extends OperationVariables,\n > {\n /**\n * The root id to be used. This id should take the same form as the\n * value returned by the `cache.identify` function. If a value with your\n * id does not exist in the store, `null` will be returned.\n */\n id?: string;\n\n /**\n * A GraphQL document created using the `gql` template string\n * with one or more fragments which will be used to determine\n * the shape of data to read. If you provide more than one fragment in this\n * document then you must also specify `fragmentName` to specify specify which\n * fragment is the root fragment.\n */\n fragment: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * The name of the fragment in your GraphQL document to be used. If you do\n * not provide a `fragmentName` and there is only one fragment in your\n * `fragment` document then that fragment will be used.\n */\n fragmentName?: string;\n\n /**\n * Any variables that your GraphQL fragments depend on.\n */\n variables?: TVariables;\n /**\n * The data to write to the store.\n */\n data: Unmasked<TData>;\n /**\n * Whether to notify query watchers.\n * @defaultValue true\n */\n broadcast?: boolean;\n /**\n * When true, ignore existing field data rather than merging it with\n * incoming data.\n * @defaultValue false\n */\n overwrite?: boolean;\n }\n\n export interface UpdateQueryOptions<\n TData,\n TVariables extends OperationVariables,\n > extends Omit<\n ReadQueryOptions<TData, TVariables> &\n WriteQueryOptions<TData, TVariables>,\n \"data\"\n > {}\n\n export interface UpdateFragmentOptions<\n TData,\n TVariables extends OperationVariables,\n > extends Omit<\n ReadFragmentOptions<TData, TVariables> &\n WriteFragmentOptions<TData, TVariables>,\n \"data\"\n > {}\n\n export type DiffResult<TData> =\n | {\n result: DataValue.Complete<TData>;\n complete: true;\n missing?: never;\n fromOptimisticTransaction?: boolean;\n }\n | {\n result: DataValue.Partial<TData> | null;\n complete: false;\n missing?: MissingFieldError;\n fromOptimisticTransaction?: boolean;\n };\n}\n"]}
package/cache/index.d.ts CHANGED
@@ -11,7 +11,7 @@ export { defaultDataIdFromObject, fieldNameFromStoreName, } from "./inmemory/hel
11
11
  export { InMemoryCache } from "./inmemory/inMemoryCache.js";
12
12
  export type { ReactiveVar } from "./inmemory/reactiveVars.js";
13
13
  export { cacheSlot, makeVar } from "./inmemory/reactiveVars.js";
14
- export type { FieldFunctionOptions, FieldMergeFunction, FieldMergeFunctionOptions, FieldPolicy, FieldReadFunction, FieldReadFunctionOptions, PossibleTypesMap, TypePolicies, TypePolicy, } from "./inmemory/policies.js";
14
+ export type { FieldFunctionOptions, FieldMergeFunction, FieldPolicy, FieldReadFunction, PossibleTypesMap, TypePolicies, TypePolicy, } from "./inmemory/policies.js";
15
15
  export { Policies } from "./inmemory/policies.js";
16
16
  export type { FragmentRegistryAPI } from "./inmemory/fragmentRegistry.js";
17
17
  export { createFragmentRegistry } from "./inmemory/fragmentRegistry.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cache/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAU9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG3D,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE3E,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EACL,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAG5D,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAahE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC","sourcesContent":["export type { Transaction } from \"./core/cache.js\";\nexport type {\n WatchFragmentOptions,\n WatchFragmentResult,\n} from \"./deprecated.js\";\nexport { ApolloCache } from \"./core/cache.js\";\nexport type { Cache } from \"./core/types/Cache.js\";\nexport type {\n IgnoreModifier,\n MissingTree,\n Modifier,\n ModifierDetails,\n Modifiers,\n ReadFieldOptions,\n} from \"./core/types/common.js\";\nexport { MissingFieldError } from \"./core/types/common.js\";\n\nexport type { Reference } from \"@apollo/client/utilities\";\nexport { canonicalStringify, isReference } from \"@apollo/client/utilities\";\n\nexport { EntityStore } from \"./inmemory/entityStore.js\";\nexport {\n defaultDataIdFromObject,\n fieldNameFromStoreName,\n} from \"./inmemory/helpers.js\";\n\nexport { InMemoryCache } from \"./inmemory/inMemoryCache.js\";\n\nexport type { ReactiveVar } from \"./inmemory/reactiveVars.js\";\nexport { cacheSlot, makeVar } from \"./inmemory/reactiveVars.js\";\n\nexport type {\n FieldFunctionOptions,\n FieldMergeFunction,\n FieldMergeFunctionOptions,\n FieldPolicy,\n FieldReadFunction,\n FieldReadFunctionOptions,\n PossibleTypesMap,\n TypePolicies,\n TypePolicy,\n} from \"./inmemory/policies.js\";\nexport { Policies } from \"./inmemory/policies.js\";\n\nexport type { FragmentRegistryAPI } from \"./inmemory/fragmentRegistry.js\";\nexport { createFragmentRegistry } from \"./inmemory/fragmentRegistry.js\";\n\nexport type {\n ApolloReducerConfig,\n DiffQueryAgainstStoreOptions,\n IdGetter,\n IdGetterObj,\n InMemoryCacheConfig,\n MergeInfo,\n MergeTree,\n NormalizedCache,\n NormalizedCacheObject,\n OptimisticStoreItem,\n ReadMergeModifyContext,\n ReadQueryOptions,\n StoreObject,\n StoreValue,\n} from \"./inmemory/types.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cache/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAU9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG3D,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE3E,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EACL,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAG5D,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAWhE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC","sourcesContent":["export type { Transaction } from \"./core/cache.js\";\nexport type {\n WatchFragmentOptions,\n WatchFragmentResult,\n} from \"./deprecated.js\";\nexport { ApolloCache } from \"./core/cache.js\";\nexport type { Cache } from \"./core/types/Cache.js\";\nexport type {\n IgnoreModifier,\n MissingTree,\n Modifier,\n ModifierDetails,\n Modifiers,\n ReadFieldOptions,\n} from \"./core/types/common.js\";\nexport { MissingFieldError } from \"./core/types/common.js\";\n\nexport type { Reference } from \"@apollo/client/utilities\";\nexport { canonicalStringify, isReference } from \"@apollo/client/utilities\";\n\nexport { EntityStore } from \"./inmemory/entityStore.js\";\nexport {\n defaultDataIdFromObject,\n fieldNameFromStoreName,\n} from \"./inmemory/helpers.js\";\n\nexport { InMemoryCache } from \"./inmemory/inMemoryCache.js\";\n\nexport type { ReactiveVar } from \"./inmemory/reactiveVars.js\";\nexport { cacheSlot, makeVar } from \"./inmemory/reactiveVars.js\";\n\nexport type {\n FieldFunctionOptions,\n FieldMergeFunction,\n FieldPolicy,\n FieldReadFunction,\n PossibleTypesMap,\n TypePolicies,\n TypePolicy,\n} from \"./inmemory/policies.js\";\nexport { Policies } from \"./inmemory/policies.js\";\n\nexport type { FragmentRegistryAPI } from \"./inmemory/fragmentRegistry.js\";\nexport { createFragmentRegistry } from \"./inmemory/fragmentRegistry.js\";\n\nexport type {\n ApolloReducerConfig,\n DiffQueryAgainstStoreOptions,\n IdGetter,\n IdGetterObj,\n InMemoryCacheConfig,\n MergeInfo,\n MergeTree,\n NormalizedCache,\n NormalizedCacheObject,\n OptimisticStoreItem,\n ReadMergeModifyContext,\n ReadQueryOptions,\n StoreObject,\n StoreValue,\n} from \"./inmemory/types.js\";\n"]}
@@ -73,10 +73,8 @@ export class EntityStore {
73
73
  // then there are no fields to be merged, so we're done.
74
74
  if (!incoming)
75
75
  return;
76
- invariant(typeof dataId === "string", 99);
77
- const merged = new DeepMerger({
78
- reconciler: storeObjectReconciler,
79
- }).merge(existing, incoming);
76
+ invariant(typeof dataId === "string", 96);
77
+ const merged = new DeepMerger(storeObjectReconciler).merge(existing, incoming);
80
78
  // Even if merged === existing, existing may have come from a lower
81
79
  // layer, so we always need to set this.data[dataId] on this level.
82
80
  this.data[dataId] = merged;
@@ -175,7 +173,7 @@ export class EntityStore {
175
173
  if (__DEV__) {
176
174
  const checkReference = (ref) => {
177
175
  if (this.lookup(ref.__ref) === undefined) {
178
- __DEV__ && invariant.warn(100, ref);
176
+ __DEV__ && invariant.warn(97, ref);
179
177
  return true;
180
178
  }
181
179
  };
@@ -204,7 +202,7 @@ export class EntityStore {
204
202
  }
205
203
  }
206
204
  if (seenReference && someNonReference !== undefined) {
207
- __DEV__ && invariant.warn(101, someNonReference);
205
+ __DEV__ && invariant.warn(98, someNonReference);
208
206
  break;
209
207
  }
210
208
  }