@apollo/client 3.8.0-alpha.12 → 3.8.0-alpha.14

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 (434) hide show
  1. package/apollo-client.cjs +272 -215
  2. package/apollo-client.cjs.map +1 -1
  3. package/apollo-client.min.cjs +1 -1
  4. package/cache/cache.cjs +1 -1
  5. package/cache/cache.cjs.map +1 -1
  6. package/cache/cache.cjs.native.js +1 -1
  7. package/cache/core/cache.d.ts +4 -4
  8. package/cache/core/cache.d.ts.map +1 -1
  9. package/cache/core/cache.js.map +1 -1
  10. package/cache/core/types/Cache.d.ts +2 -2
  11. package/cache/core/types/Cache.d.ts.map +1 -1
  12. package/cache/core/types/Cache.js.map +1 -1
  13. package/cache/core/types/DataProxy.d.ts +4 -4
  14. package/cache/core/types/DataProxy.d.ts.map +1 -1
  15. package/cache/core/types/DataProxy.js.map +1 -1
  16. package/cache/core/types/common.d.ts +3 -3
  17. package/cache/core/types/common.d.ts.map +1 -1
  18. package/cache/core/types/common.js.map +1 -1
  19. package/cache/inmemory/entityStore.d.ts +5 -5
  20. package/cache/inmemory/entityStore.d.ts.map +1 -1
  21. package/cache/inmemory/entityStore.js.map +1 -1
  22. package/cache/inmemory/fragmentRegistry.d.ts +1 -1
  23. package/cache/inmemory/fragmentRegistry.d.ts.map +1 -1
  24. package/cache/inmemory/fragmentRegistry.js.map +1 -1
  25. package/cache/inmemory/helpers.d.ts +6 -5
  26. package/cache/inmemory/helpers.d.ts.map +1 -1
  27. package/cache/inmemory/helpers.js.map +1 -1
  28. package/cache/inmemory/inMemoryCache.d.ts +5 -5
  29. package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
  30. package/cache/inmemory/inMemoryCache.js.map +1 -1
  31. package/cache/inmemory/key-extractor.d.ts +1 -1
  32. package/cache/inmemory/key-extractor.d.ts.map +1 -1
  33. package/cache/inmemory/key-extractor.js.map +1 -1
  34. package/cache/inmemory/policies.d.ts +7 -6
  35. package/cache/inmemory/policies.d.ts.map +1 -1
  36. package/cache/inmemory/policies.js +1 -1
  37. package/cache/inmemory/policies.js.map +1 -1
  38. package/cache/inmemory/reactiveVars.d.ts +1 -1
  39. package/cache/inmemory/reactiveVars.d.ts.map +1 -1
  40. package/cache/inmemory/reactiveVars.js.map +1 -1
  41. package/cache/inmemory/readFromStore.d.ts +6 -6
  42. package/cache/inmemory/readFromStore.d.ts.map +1 -1
  43. package/cache/inmemory/readFromStore.js +2 -2
  44. package/cache/inmemory/readFromStore.js.map +1 -1
  45. package/cache/inmemory/types.d.ts +6 -6
  46. package/cache/inmemory/types.d.ts.map +1 -1
  47. package/cache/inmemory/types.js.map +1 -1
  48. package/cache/inmemory/writeToStore.d.ts +6 -6
  49. package/cache/inmemory/writeToStore.d.ts.map +1 -1
  50. package/cache/inmemory/writeToStore.js.map +1 -1
  51. package/core/ApolloClient.d.ts +10 -9
  52. package/core/ApolloClient.d.ts.map +1 -1
  53. package/core/ApolloClient.js +1 -1
  54. package/core/ApolloClient.js.map +1 -1
  55. package/core/LocalState.d.ts +6 -6
  56. package/core/LocalState.d.ts.map +1 -1
  57. package/core/LocalState.js +1 -1
  58. package/core/LocalState.js.map +1 -1
  59. package/core/ObservableQuery.d.ts +9 -8
  60. package/core/ObservableQuery.d.ts.map +1 -1
  61. package/core/ObservableQuery.js.map +1 -1
  62. package/core/QueryInfo.d.ts +9 -9
  63. package/core/QueryInfo.d.ts.map +1 -1
  64. package/core/QueryInfo.js.map +1 -1
  65. package/core/QueryManager.d.ts +6 -6
  66. package/core/QueryManager.d.ts.map +1 -1
  67. package/core/QueryManager.js.map +1 -1
  68. package/core/core.cjs +1 -1
  69. package/core/core.cjs.map +1 -1
  70. package/core/core.cjs.native.js +1 -1
  71. package/core/equalByQuery.d.ts +2 -2
  72. package/core/equalByQuery.d.ts.map +1 -1
  73. package/core/equalByQuery.js.map +1 -1
  74. package/core/types.d.ts +11 -11
  75. package/core/types.d.ts.map +1 -1
  76. package/core/types.js.map +1 -1
  77. package/core/watchQueryOptions.d.ts +6 -6
  78. package/core/watchQueryOptions.d.ts.map +1 -1
  79. package/core/watchQueryOptions.js.map +1 -1
  80. package/errors/index.d.ts +4 -4
  81. package/errors/index.d.ts.map +1 -1
  82. package/errors/index.js.map +1 -1
  83. package/invariantErrorCodes.js +41 -29
  84. package/link/batch/batchLink.d.ts +4 -3
  85. package/link/batch/batchLink.d.ts.map +1 -1
  86. package/link/batch/batchLink.js.map +1 -1
  87. package/link/batch/batching.d.ts +1 -1
  88. package/link/batch/batching.d.ts.map +1 -1
  89. package/link/batch/batching.js.map +1 -1
  90. package/link/batch-http/batchHttpLink.d.ts +3 -2
  91. package/link/batch-http/batchHttpLink.d.ts.map +1 -1
  92. package/link/batch-http/batchHttpLink.js.map +1 -1
  93. package/link/context/index.d.ts +3 -2
  94. package/link/context/index.d.ts.map +1 -1
  95. package/link/context/index.js.map +1 -1
  96. package/link/core/ApolloLink.d.ts +3 -2
  97. package/link/core/ApolloLink.d.ts.map +1 -1
  98. package/link/core/ApolloLink.js.map +1 -1
  99. package/link/core/types.d.ts +4 -3
  100. package/link/core/types.d.ts.map +1 -1
  101. package/link/core/types.js.map +1 -1
  102. package/link/error/index.d.ts +4 -3
  103. package/link/error/index.d.ts.map +1 -1
  104. package/link/error/index.js.map +1 -1
  105. package/link/http/HttpLink.d.ts +3 -2
  106. package/link/http/HttpLink.d.ts.map +1 -1
  107. package/link/http/HttpLink.js.map +1 -1
  108. package/link/http/createHttpLink.d.ts +1 -1
  109. package/link/http/createHttpLink.d.ts.map +1 -1
  110. package/link/http/createHttpLink.js.map +1 -1
  111. package/link/http/http.cjs +1 -1
  112. package/link/http/http.cjs.map +1 -1
  113. package/link/http/http.cjs.native.js +1 -1
  114. package/link/http/iterators/nodeStream.d.ts +1 -1
  115. package/link/http/iterators/nodeStream.d.ts.map +1 -1
  116. package/link/http/iterators/nodeStream.js.map +1 -1
  117. package/link/http/parseAndCheckHttpResponse.d.ts +2 -2
  118. package/link/http/parseAndCheckHttpResponse.d.ts.map +1 -1
  119. package/link/http/parseAndCheckHttpResponse.js.map +1 -1
  120. package/link/http/responseIterator.d.ts +1 -1
  121. package/link/http/responseIterator.d.ts.map +1 -1
  122. package/link/http/responseIterator.js.map +1 -1
  123. package/link/http/rewriteURIForGET.d.ts +1 -1
  124. package/link/http/rewriteURIForGET.d.ts.map +1 -1
  125. package/link/http/rewriteURIForGET.js.map +1 -1
  126. package/link/http/selectHttpOptionsAndBody.d.ts +3 -2
  127. package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -1
  128. package/link/http/selectHttpOptionsAndBody.js +1 -2
  129. package/link/http/selectHttpOptionsAndBody.js.map +1 -1
  130. package/link/http/selectURI.d.ts +1 -1
  131. package/link/http/selectURI.d.ts.map +1 -1
  132. package/link/http/selectURI.js.map +1 -1
  133. package/link/persisted-queries/index.d.ts +4 -3
  134. package/link/persisted-queries/index.d.ts.map +1 -1
  135. package/link/persisted-queries/index.js +12 -13
  136. package/link/persisted-queries/index.js.map +1 -1
  137. package/link/persisted-queries/persisted-queries.cjs +12 -13
  138. package/link/persisted-queries/persisted-queries.cjs.map +1 -1
  139. package/link/persisted-queries/persisted-queries.cjs.native.js +12 -13
  140. package/link/remove-typename/index.d.ts +2 -0
  141. package/link/remove-typename/index.d.ts.map +1 -0
  142. package/link/remove-typename/index.js +2 -0
  143. package/link/remove-typename/index.js.map +1 -0
  144. package/link/remove-typename/package.json +8 -0
  145. package/link/remove-typename/remove-typename.cjs +70 -0
  146. package/link/remove-typename/remove-typename.cjs.map +1 -0
  147. package/link/remove-typename/remove-typename.cjs.native.js +70 -0
  148. package/link/remove-typename/removeTypenameFromVariables.d.ts +11 -0
  149. package/link/remove-typename/removeTypenameFromVariables.d.ts.map +1 -0
  150. package/link/remove-typename/removeTypenameFromVariables.js +62 -0
  151. package/link/remove-typename/removeTypenameFromVariables.js.map +1 -0
  152. package/link/retry/delayFunction.d.ts +1 -1
  153. package/link/retry/delayFunction.d.ts.map +1 -1
  154. package/link/retry/delayFunction.js.map +1 -1
  155. package/link/retry/retryFunction.d.ts +1 -1
  156. package/link/retry/retryFunction.d.ts.map +1 -1
  157. package/link/retry/retryFunction.js.map +1 -1
  158. package/link/retry/retryLink.d.ts +4 -3
  159. package/link/retry/retryLink.d.ts.map +1 -1
  160. package/link/retry/retryLink.js.map +1 -1
  161. package/link/schema/index.d.ts +3 -2
  162. package/link/schema/index.d.ts.map +1 -1
  163. package/link/schema/index.js.map +1 -1
  164. package/link/subscriptions/index.d.ts +2 -1
  165. package/link/subscriptions/index.d.ts.map +1 -1
  166. package/link/subscriptions/index.js +2 -2
  167. package/link/subscriptions/index.js.map +1 -1
  168. package/link/subscriptions/subscriptions.cjs +1 -1
  169. package/link/subscriptions/subscriptions.cjs.map +1 -1
  170. package/link/subscriptions/subscriptions.cjs.native.js +1 -1
  171. package/link/utils/createOperation.d.ts +1 -1
  172. package/link/utils/createOperation.d.ts.map +1 -1
  173. package/link/utils/createOperation.js.map +1 -1
  174. package/link/utils/filterOperationVariables.d.ts +1 -1
  175. package/link/utils/filterOperationVariables.d.ts.map +1 -1
  176. package/link/utils/filterOperationVariables.js.map +1 -1
  177. package/link/utils/throwServerError.d.ts +1 -1
  178. package/link/utils/throwServerError.d.ts.map +1 -1
  179. package/link/utils/throwServerError.js.map +1 -1
  180. package/link/utils/toPromise.d.ts +1 -1
  181. package/link/utils/toPromise.d.ts.map +1 -1
  182. package/link/utils/toPromise.js.map +1 -1
  183. package/link/utils/transformOperation.d.ts +1 -1
  184. package/link/utils/transformOperation.d.ts.map +1 -1
  185. package/link/utils/transformOperation.js.map +1 -1
  186. package/link/utils/validateOperation.d.ts +1 -1
  187. package/link/utils/validateOperation.d.ts.map +1 -1
  188. package/link/utils/validateOperation.js.map +1 -1
  189. package/link/ws/index.d.ts +5 -3
  190. package/link/ws/index.d.ts.map +1 -1
  191. package/link/ws/index.js.map +1 -1
  192. package/package.json +26 -22
  193. package/react/cache/{QuerySubscription.d.ts → QueryReference.d.ts} +15 -7
  194. package/react/cache/QueryReference.d.ts.map +1 -0
  195. package/react/cache/QueryReference.js +107 -0
  196. package/react/cache/QueryReference.js.map +1 -0
  197. package/react/cache/SuspenseCache.d.ts +5 -5
  198. package/react/cache/SuspenseCache.d.ts.map +1 -1
  199. package/react/cache/SuspenseCache.js +8 -7
  200. package/react/cache/SuspenseCache.js.map +1 -1
  201. package/react/cache/types.d.ts +2 -0
  202. package/react/cache/types.d.ts.map +1 -0
  203. package/react/cache/types.js +2 -0
  204. package/react/cache/types.js.map +1 -0
  205. package/react/components/Mutation.d.ts +2 -2
  206. package/react/components/Mutation.d.ts.map +1 -1
  207. package/react/components/Mutation.js.map +1 -1
  208. package/react/components/Query.d.ts +2 -2
  209. package/react/components/Query.d.ts.map +1 -1
  210. package/react/components/Query.js.map +1 -1
  211. package/react/components/Subscription.d.ts +2 -2
  212. package/react/components/Subscription.d.ts.map +1 -1
  213. package/react/components/Subscription.js.map +1 -1
  214. package/react/components/types.d.ts +4 -4
  215. package/react/components/types.d.ts.map +1 -1
  216. package/react/components/types.js.map +1 -1
  217. package/react/context/ApolloConsumer.d.ts +1 -1
  218. package/react/context/ApolloConsumer.d.ts.map +1 -1
  219. package/react/context/ApolloConsumer.js +1 -1
  220. package/react/context/ApolloConsumer.js.map +1 -1
  221. package/react/context/ApolloContext.d.ts +10 -3
  222. package/react/context/ApolloContext.d.ts.map +1 -1
  223. package/react/context/ApolloContext.js +13 -8
  224. package/react/context/ApolloContext.js.map +1 -1
  225. package/react/context/ApolloProvider.d.ts +2 -2
  226. package/react/context/ApolloProvider.d.ts.map +1 -1
  227. package/react/context/ApolloProvider.js +8 -12
  228. package/react/context/ApolloProvider.js.map +1 -1
  229. package/react/context/context.cjs +22 -21
  230. package/react/context/context.cjs.map +1 -1
  231. package/react/context/context.cjs.native.js +22 -21
  232. package/react/context/index.d.ts +1 -1
  233. package/react/context/index.d.ts.map +1 -1
  234. package/react/context/index.js +1 -1
  235. package/react/context/index.js.map +1 -1
  236. package/react/hoc/graphql.d.ts +3 -3
  237. package/react/hoc/graphql.d.ts.map +1 -1
  238. package/react/hoc/graphql.js.map +1 -1
  239. package/react/hoc/hoc-utils.d.ts +2 -2
  240. package/react/hoc/hoc-utils.d.ts.map +1 -1
  241. package/react/hoc/hoc-utils.js.map +1 -1
  242. package/react/hoc/mutation-hoc.d.ts +4 -4
  243. package/react/hoc/mutation-hoc.d.ts.map +1 -1
  244. package/react/hoc/mutation-hoc.js.map +1 -1
  245. package/react/hoc/query-hoc.d.ts +2 -2
  246. package/react/hoc/query-hoc.d.ts.map +1 -1
  247. package/react/hoc/query-hoc.js.map +1 -1
  248. package/react/hoc/subscription-hoc.d.ts +2 -2
  249. package/react/hoc/subscription-hoc.d.ts.map +1 -1
  250. package/react/hoc/subscription-hoc.js.map +1 -1
  251. package/react/hoc/types.d.ts +4 -4
  252. package/react/hoc/types.d.ts.map +1 -1
  253. package/react/hoc/types.js.map +1 -1
  254. package/react/hoc/withApollo.d.ts +1 -1
  255. package/react/hoc/withApollo.d.ts.map +1 -1
  256. package/react/hoc/withApollo.js.map +1 -1
  257. package/react/hooks/hooks.cjs +133 -69
  258. package/react/hooks/hooks.cjs.map +1 -1
  259. package/react/hooks/hooks.cjs.native.js +133 -69
  260. package/react/hooks/index.d.ts +2 -1
  261. package/react/hooks/index.d.ts.map +1 -1
  262. package/react/hooks/index.js +2 -1
  263. package/react/hooks/index.js.map +1 -1
  264. package/react/hooks/internal/useDeepMemo.d.ts +1 -1
  265. package/react/hooks/internal/useDeepMemo.d.ts.map +1 -1
  266. package/react/hooks/internal/useDeepMemo.js.map +1 -1
  267. package/react/hooks/useApolloClient.d.ts +1 -1
  268. package/react/hooks/useApolloClient.d.ts.map +1 -1
  269. package/react/hooks/useApolloClient.js.map +1 -1
  270. package/react/hooks/useBackgroundQuery.d.ts +18 -0
  271. package/react/hooks/useBackgroundQuery.d.ts.map +1 -0
  272. package/react/hooks/useBackgroundQuery.js +71 -0
  273. package/react/hooks/useBackgroundQuery.js.map +1 -0
  274. package/react/hooks/useFragment.d.ts +13 -8
  275. package/react/hooks/useFragment.d.ts.map +1 -1
  276. package/react/hooks/useFragment.js +1 -1
  277. package/react/hooks/useFragment.js.map +1 -1
  278. package/react/hooks/useLazyQuery.d.ts +4 -4
  279. package/react/hooks/useLazyQuery.d.ts.map +1 -1
  280. package/react/hooks/useLazyQuery.js.map +1 -1
  281. package/react/hooks/useMutation.d.ts +4 -4
  282. package/react/hooks/useMutation.d.ts.map +1 -1
  283. package/react/hooks/useMutation.js +1 -1
  284. package/react/hooks/useMutation.js.map +1 -1
  285. package/react/hooks/useQuery.d.ts +3 -3
  286. package/react/hooks/useQuery.d.ts.map +1 -1
  287. package/react/hooks/useQuery.js +2 -2
  288. package/react/hooks/useQuery.js.map +1 -1
  289. package/react/hooks/useReactiveVar.d.ts +1 -1
  290. package/react/hooks/useReactiveVar.d.ts.map +1 -1
  291. package/react/hooks/useReactiveVar.js.map +1 -1
  292. package/react/hooks/useSubscription.d.ts +4 -4
  293. package/react/hooks/useSubscription.d.ts.map +1 -1
  294. package/react/hooks/useSubscription.js +25 -13
  295. package/react/hooks/useSubscription.js.map +1 -1
  296. package/react/hooks/useSuspenseCache.d.ts +1 -1
  297. package/react/hooks/useSuspenseCache.d.ts.map +1 -1
  298. package/react/hooks/useSuspenseCache.js +1 -1
  299. package/react/hooks/useSuspenseCache.js.map +1 -1
  300. package/react/hooks/useSuspenseQuery.d.ts +29 -7
  301. package/react/hooks/useSuspenseQuery.d.ts.map +1 -1
  302. package/react/hooks/useSuspenseQuery.js +44 -59
  303. package/react/hooks/useSuspenseQuery.js.map +1 -1
  304. package/react/parser/index.d.ts +1 -1
  305. package/react/parser/index.d.ts.map +1 -1
  306. package/react/parser/index.js +5 -5
  307. package/react/parser/index.js.map +1 -1
  308. package/react/parser/parser.cjs +5 -5
  309. package/react/parser/parser.cjs.map +1 -1
  310. package/react/parser/parser.cjs.native.js +5 -5
  311. package/react/react.cjs +73 -51
  312. package/react/react.cjs.map +1 -1
  313. package/react/react.cjs.native.js +73 -51
  314. package/react/ssr/RenderPromises.d.ts +2 -2
  315. package/react/ssr/RenderPromises.d.ts.map +1 -1
  316. package/react/ssr/RenderPromises.js.map +1 -1
  317. package/react/ssr/renderToStringWithData.d.ts +1 -1
  318. package/react/ssr/renderToStringWithData.d.ts.map +1 -1
  319. package/react/ssr/renderToStringWithData.js.map +1 -1
  320. package/react/types/types.d.ts +9 -11
  321. package/react/types/types.d.ts.map +1 -1
  322. package/react/types/types.js.map +1 -1
  323. package/testing/core/core.cjs +1 -1
  324. package/testing/core/core.cjs.map +1 -1
  325. package/testing/core/core.cjs.native.js +1 -1
  326. package/testing/core/mocking/mockClient.d.ts +2 -2
  327. package/testing/core/mocking/mockClient.d.ts.map +1 -1
  328. package/testing/core/mocking/mockClient.js.map +1 -1
  329. package/testing/core/mocking/mockLink.d.ts +2 -1
  330. package/testing/core/mocking/mockLink.d.ts.map +1 -1
  331. package/testing/core/mocking/mockLink.js +2 -2
  332. package/testing/core/mocking/mockLink.js.map +1 -1
  333. package/testing/core/mocking/mockQueryManager.d.ts +1 -1
  334. package/testing/core/mocking/mockQueryManager.d.ts.map +1 -1
  335. package/testing/core/mocking/mockQueryManager.js.map +1 -1
  336. package/testing/core/mocking/mockSubscriptionLink.d.ts +2 -1
  337. package/testing/core/mocking/mockSubscriptionLink.d.ts.map +1 -1
  338. package/testing/core/mocking/mockSubscriptionLink.js.map +1 -1
  339. package/testing/core/mocking/mockWatchQuery.d.ts +2 -2
  340. package/testing/core/mocking/mockWatchQuery.d.ts.map +1 -1
  341. package/testing/core/mocking/mockWatchQuery.js.map +1 -1
  342. package/testing/core/observableToPromise.d.ts +2 -2
  343. package/testing/core/observableToPromise.d.ts.map +1 -1
  344. package/testing/core/observableToPromise.js.map +1 -1
  345. package/testing/core/subscribeAndCount.d.ts +1 -1
  346. package/testing/core/subscribeAndCount.d.ts.map +1 -1
  347. package/testing/core/subscribeAndCount.js.map +1 -1
  348. package/testing/react/MockedProvider.d.ts +7 -6
  349. package/testing/react/MockedProvider.d.ts.map +1 -1
  350. package/testing/react/MockedProvider.js.map +1 -1
  351. package/utilities/common/compact.d.ts +1 -1
  352. package/utilities/common/compact.d.ts.map +1 -1
  353. package/utilities/common/compact.js.map +1 -1
  354. package/utilities/common/errorHandling.d.ts +1 -1
  355. package/utilities/common/errorHandling.d.ts.map +1 -1
  356. package/utilities/common/errorHandling.js.map +1 -1
  357. package/utilities/common/incrementalResult.d.ts +1 -1
  358. package/utilities/common/incrementalResult.d.ts.map +1 -1
  359. package/utilities/common/incrementalResult.js.map +1 -1
  360. package/utilities/common/omitDeep.d.ts +10 -2
  361. package/utilities/common/omitDeep.d.ts.map +1 -1
  362. package/utilities/common/omitDeep.js +22 -10
  363. package/utilities/common/omitDeep.js.map +1 -1
  364. package/utilities/common/responseIterator.d.ts +2 -2
  365. package/utilities/common/responseIterator.d.ts.map +1 -1
  366. package/utilities/common/responseIterator.js.map +1 -1
  367. package/utilities/common/stripTypename.d.ts +9 -1
  368. package/utilities/common/stripTypename.d.ts.map +1 -1
  369. package/utilities/common/stripTypename.js +3 -2
  370. package/utilities/common/stripTypename.js.map +1 -1
  371. package/utilities/globals/global.d.ts +6 -3
  372. package/utilities/globals/global.d.ts.map +1 -1
  373. package/utilities/globals/global.js.map +1 -1
  374. package/utilities/graphql/directives.d.ts +1 -1
  375. package/utilities/graphql/directives.d.ts.map +1 -1
  376. package/utilities/graphql/directives.js +4 -4
  377. package/utilities/graphql/directives.js.map +1 -1
  378. package/utilities/graphql/fragments.d.ts +1 -1
  379. package/utilities/graphql/fragments.d.ts.map +1 -1
  380. package/utilities/graphql/fragments.js +3 -3
  381. package/utilities/graphql/fragments.js.map +1 -1
  382. package/utilities/graphql/getFromAST.d.ts +1 -1
  383. package/utilities/graphql/getFromAST.d.ts.map +1 -1
  384. package/utilities/graphql/getFromAST.js +8 -8
  385. package/utilities/graphql/getFromAST.js.map +1 -1
  386. package/utilities/graphql/storeUtils.d.ts +2 -2
  387. package/utilities/graphql/storeUtils.d.ts.map +1 -1
  388. package/utilities/graphql/storeUtils.js +14 -4
  389. package/utilities/graphql/storeUtils.js.map +1 -1
  390. package/utilities/graphql/transform.d.ts +1 -1
  391. package/utilities/graphql/transform.d.ts.map +1 -1
  392. package/utilities/graphql/transform.js +2 -2
  393. package/utilities/graphql/transform.js.map +1 -1
  394. package/utilities/index.d.ts +3 -2
  395. package/utilities/index.d.ts.map +1 -1
  396. package/utilities/index.js +1 -1
  397. package/utilities/index.js.map +1 -1
  398. package/utilities/observables/Concast.d.ts +2 -1
  399. package/utilities/observables/Concast.d.ts.map +1 -1
  400. package/utilities/observables/Concast.js.map +1 -1
  401. package/utilities/observables/Observable.d.ts +2 -1
  402. package/utilities/observables/Observable.d.ts.map +1 -1
  403. package/utilities/observables/Observable.js +1 -1
  404. package/utilities/observables/Observable.js.map +1 -1
  405. package/utilities/observables/asyncMap.d.ts.map +1 -1
  406. package/utilities/observables/asyncMap.js.map +1 -1
  407. package/utilities/observables/iteration.d.ts +1 -1
  408. package/utilities/observables/iteration.d.ts.map +1 -1
  409. package/utilities/observables/iteration.js.map +1 -1
  410. package/utilities/policies/pagination.d.ts +1 -1
  411. package/utilities/policies/pagination.d.ts.map +1 -1
  412. package/utilities/policies/pagination.js.map +1 -1
  413. package/utilities/promises/decoration.d.ts +2 -0
  414. package/utilities/promises/decoration.d.ts.map +1 -1
  415. package/utilities/promises/decoration.js +12 -0
  416. package/utilities/promises/decoration.js.map +1 -1
  417. package/utilities/types/DeepOmit.d.ts +4 -3
  418. package/utilities/types/DeepOmit.d.ts.map +1 -1
  419. package/utilities/types/DeepOmit.js.map +1 -1
  420. package/utilities/types/DeepPartial.d.ts +12 -0
  421. package/utilities/types/DeepPartial.d.ts.map +1 -0
  422. package/utilities/types/DeepPartial.js +2 -0
  423. package/utilities/types/DeepPartial.js.map +1 -0
  424. package/utilities/types/Primitive.d.ts +2 -0
  425. package/utilities/types/Primitive.d.ts.map +1 -0
  426. package/utilities/types/Primitive.js +2 -0
  427. package/utilities/types/Primitive.js.map +1 -0
  428. package/utilities/utilities.cjs +68 -31
  429. package/utilities/utilities.cjs.map +1 -1
  430. package/utilities/utilities.cjs.native.js +68 -31
  431. package/version.js +1 -1
  432. package/react/cache/QuerySubscription.d.ts.map +0 -1
  433. package/react/cache/QuerySubscription.js +0 -88
  434. package/react/cache/QuerySubscription.js.map +0 -1
package/apollo-client.cjs CHANGED
@@ -67,7 +67,7 @@ function shouldInclude(_a, variables) {
67
67
  var evaledValue = false;
68
68
  if (ifArgument.value.kind === 'Variable') {
69
69
  evaledValue = variables && variables[ifArgument.value.name.value];
70
- __DEV__ ? tsInvariant.invariant(evaledValue !== void 0, "Invalid variable referenced in @".concat(directive.name.value, " directive.")) : tsInvariant.invariant(evaledValue !== void 0, 42);
70
+ __DEV__ ? tsInvariant.invariant(evaledValue !== void 0, "Invalid variable referenced in @".concat(directive.name.value, " directive.")) : tsInvariant.invariant(evaledValue !== void 0, 43);
71
71
  }
72
72
  else {
73
73
  evaledValue = ifArgument.value.value;
@@ -75,7 +75,6 @@ function shouldInclude(_a, variables) {
75
75
  return directive.name.value === 'skip' ? !evaledValue : evaledValue;
76
76
  });
77
77
  }
78
- var hasAnyDirectives = function (names, root) { return hasDirectives(names, root, false); };
79
78
  function hasDirectives(names, root, all) {
80
79
  var nameSet = new Set(names);
81
80
  var uniqueCount = nameSet.size;
@@ -104,13 +103,13 @@ function getInclusionDirectives(directives) {
104
103
  return;
105
104
  var directiveArguments = directive.arguments;
106
105
  var directiveName = directive.name.value;
107
- __DEV__ ? tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @".concat(directiveName, " directive.")) : tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, 43);
106
+ __DEV__ ? tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @".concat(directiveName, " directive.")) : tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, 44);
108
107
  var ifArgument = directiveArguments[0];
109
- __DEV__ ? tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @".concat(directiveName, " directive.")) : tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', 44);
108
+ __DEV__ ? tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @".concat(directiveName, " directive.")) : tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', 45);
110
109
  var ifValue = ifArgument.value;
111
110
  __DEV__ ? tsInvariant.invariant(ifValue &&
112
111
  (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @".concat(directiveName, " directive must be a variable or a boolean value.")) : tsInvariant.invariant(ifValue &&
113
- (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 45);
112
+ (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 46);
114
113
  result.push({ directive: directive, ifArgument: ifArgument });
115
114
  });
116
115
  }
@@ -123,14 +122,14 @@ function getFragmentQueryDocument(document, fragmentName) {
123
122
  document.definitions.forEach(function (definition) {
124
123
  if (definition.kind === 'OperationDefinition') {
125
124
  throw __DEV__ ? new tsInvariant.InvariantError("Found a ".concat(definition.operation, " operation").concat(definition.name ? " named '".concat(definition.name.value, "'") : '', ". ") +
126
- 'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new tsInvariant.InvariantError(46);
125
+ 'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new tsInvariant.InvariantError(47);
127
126
  }
128
127
  if (definition.kind === 'FragmentDefinition') {
129
128
  fragments.push(definition);
130
129
  }
131
130
  });
132
131
  if (typeof actualFragmentName === 'undefined') {
133
- __DEV__ ? tsInvariant.invariant(fragments.length === 1, "Found ".concat(fragments.length, " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")) : tsInvariant.invariant(fragments.length === 1, 47);
132
+ __DEV__ ? tsInvariant.invariant(fragments.length === 1, "Found ".concat(fragments.length, " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")) : tsInvariant.invariant(fragments.length === 1, 48);
134
133
  actualFragmentName = fragments[0].name.value;
135
134
  }
136
135
  var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
@@ -171,7 +170,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
171
170
  return fragmentMap(fragmentName);
172
171
  }
173
172
  var fragment = fragmentMap && fragmentMap[fragmentName];
174
- __DEV__ ? tsInvariant.invariant(fragment, "No fragment named ".concat(fragmentName)) : tsInvariant.invariant(fragment, 48);
173
+ __DEV__ ? tsInvariant.invariant(fragment, "No fragment named ".concat(fragmentName)) : tsInvariant.invariant(fragment, 49);
175
174
  return fragment || null;
176
175
  }
177
176
  default:
@@ -182,12 +181,6 @@ function getFragmentFromSelection(selection, fragmentMap) {
182
181
  function isNonNullObject(obj) {
183
182
  return obj !== null && typeof obj === 'object';
184
183
  }
185
- function isPlainObject(obj) {
186
- return (obj !== null &&
187
- typeof obj === 'object' &&
188
- (Object.getPrototypeOf(obj) === Object.prototype ||
189
- Object.getPrototypeOf(obj) === null));
190
- }
191
184
 
192
185
  function makeReference(id) {
193
186
  return { __ref: String(id) };
@@ -261,7 +254,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
261
254
  else {
262
255
  throw __DEV__ ? new tsInvariant.InvariantError("The inline argument \"".concat(name.value, "\" of kind \"").concat(value.kind, "\"") +
263
256
  'is not supported. Use variables instead of inline arguments to ' +
264
- 'overcome this limitation.') : new tsInvariant.InvariantError(57);
257
+ 'overcome this limitation.') : new tsInvariant.InvariantError(58);
265
258
  }
266
259
  }
267
260
  function storeKeyNameFromField(field, variables) {
@@ -370,9 +363,7 @@ function resultKeyNameFromField(field) {
370
363
  return field.alias ? field.alias.value : field.name.value;
371
364
  }
372
365
  function getTypenameFromResult(result, selectionSet, fragmentMap) {
373
- if (typeof result.__typename === 'string') {
374
- return result.__typename;
375
- }
366
+ var fragments;
376
367
  for (var _i = 0, _a = selectionSet.selections; _i < _a.length; _i++) {
377
368
  var selection = _a[_i];
378
369
  if (isField(selection)) {
@@ -380,7 +371,19 @@ function getTypenameFromResult(result, selectionSet, fragmentMap) {
380
371
  return result[resultKeyNameFromField(selection)];
381
372
  }
382
373
  }
374
+ else if (fragments) {
375
+ fragments.push(selection);
376
+ }
383
377
  else {
378
+ fragments = [selection];
379
+ }
380
+ }
381
+ if (typeof result.__typename === 'string') {
382
+ return result.__typename;
383
+ }
384
+ if (fragments) {
385
+ for (var _b = 0, fragments_1 = fragments; _b < fragments_1.length; _b++) {
386
+ var selection = fragments_1[_b];
384
387
  var typename = getTypenameFromResult(result, getFragmentFromSelection(selection, fragmentMap).selectionSet, fragmentMap);
385
388
  if (typeof typename === 'string') {
386
389
  return typename;
@@ -396,16 +399,16 @@ function isInlineFragment(selection) {
396
399
  }
397
400
 
398
401
  function checkDocument(doc) {
399
- __DEV__ ? tsInvariant.invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : tsInvariant.invariant(doc && doc.kind === 'Document', 49);
402
+ __DEV__ ? tsInvariant.invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : tsInvariant.invariant(doc && doc.kind === 'Document', 50);
400
403
  var operations = doc.definitions
401
404
  .filter(function (d) { return d.kind !== 'FragmentDefinition'; })
402
405
  .map(function (definition) {
403
406
  if (definition.kind !== 'OperationDefinition') {
404
- throw __DEV__ ? new tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"".concat(definition.kind, "\"")) : new tsInvariant.InvariantError(50);
407
+ throw __DEV__ ? new tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"".concat(definition.kind, "\"")) : new tsInvariant.InvariantError(51);
405
408
  }
406
409
  return definition;
407
410
  });
408
- __DEV__ ? tsInvariant.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains ".concat(operations.length, " operations")) : tsInvariant.invariant(operations.length <= 1, 51);
411
+ __DEV__ ? tsInvariant.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains ".concat(operations.length, " operations")) : tsInvariant.invariant(operations.length <= 1, 52);
409
412
  return doc;
410
413
  }
411
414
  function getOperationDefinition(doc) {
@@ -428,14 +431,14 @@ function getFragmentDefinitions(doc) {
428
431
  }
429
432
  function getQueryDefinition(doc) {
430
433
  var queryDef = getOperationDefinition(doc);
431
- __DEV__ ? tsInvariant.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : tsInvariant.invariant(queryDef && queryDef.operation === 'query', 52);
434
+ __DEV__ ? tsInvariant.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : tsInvariant.invariant(queryDef && queryDef.operation === 'query', 53);
432
435
  return queryDef;
433
436
  }
434
437
  function getFragmentDefinition(doc) {
435
- __DEV__ ? tsInvariant.invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : tsInvariant.invariant(doc.kind === 'Document', 53);
436
- __DEV__ ? tsInvariant.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : tsInvariant.invariant(doc.definitions.length <= 1, 54);
438
+ __DEV__ ? tsInvariant.invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : tsInvariant.invariant(doc.kind === 'Document', 54);
439
+ __DEV__ ? tsInvariant.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : tsInvariant.invariant(doc.definitions.length <= 1, 55);
437
440
  var fragmentDef = doc.definitions[0];
438
- __DEV__ ? tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 55);
441
+ __DEV__ ? tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 56);
439
442
  return fragmentDef;
440
443
  }
441
444
  function getMainDefinition(queryDoc) {
@@ -458,7 +461,7 @@ function getMainDefinition(queryDoc) {
458
461
  if (fragmentDefinition) {
459
462
  return fragmentDefinition;
460
463
  }
461
- throw __DEV__ ? new tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new tsInvariant.InvariantError(56);
464
+ throw __DEV__ ? new tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new tsInvariant.InvariantError(57);
462
465
  }
463
466
  function getDefaultValues(definition) {
464
467
  var defaultValues = Object.create(null);
@@ -817,6 +820,18 @@ var DeepMerger = (function () {
817
820
  return DeepMerger;
818
821
  }());
819
822
 
823
+ function createFulfilledPromise(value) {
824
+ var promise = Promise.resolve(value);
825
+ promise.status = 'fulfilled';
826
+ promise.value = value;
827
+ return promise;
828
+ }
829
+ function createRejectedPromise(reason) {
830
+ var promise = Promise.reject(reason);
831
+ promise.status = 'rejected';
832
+ promise.reason = reason;
833
+ return promise;
834
+ }
820
835
  function isStatefulPromise(promise) {
821
836
  return 'status' in promise;
822
837
  }
@@ -1225,51 +1240,6 @@ function isNodeReadableStream(value) {
1225
1240
  return !!value.pipe;
1226
1241
  }
1227
1242
 
1228
- function omitDeep(value, key) {
1229
- return __omitDeep(value, key);
1230
- }
1231
- function __omitDeep(value, key, known) {
1232
- if (known === void 0) { known = new Map(); }
1233
- if (known.has(value)) {
1234
- return known.get(value);
1235
- }
1236
- var modified = false;
1237
- if (Array.isArray(value)) {
1238
- var array_1 = [];
1239
- known.set(value, array_1);
1240
- value.forEach(function (value, index) {
1241
- var result = __omitDeep(value, key, known);
1242
- modified || (modified = result !== value);
1243
- array_1[index] = result;
1244
- });
1245
- if (modified) {
1246
- return array_1;
1247
- }
1248
- }
1249
- else if (isPlainObject(value)) {
1250
- var obj_1 = Object.create(Object.getPrototypeOf(value));
1251
- known.set(value, obj_1);
1252
- Object.keys(value).forEach(function (k) {
1253
- if (k === key) {
1254
- modified = true;
1255
- }
1256
- else {
1257
- var result = __omitDeep(value[k], key, known);
1258
- modified || (modified = result !== value[k]);
1259
- obj_1[k] = result;
1260
- }
1261
- });
1262
- if (modified) {
1263
- return obj_1;
1264
- }
1265
- }
1266
- return value;
1267
- }
1268
-
1269
- function stripTypename(value) {
1270
- return omitDeep(value, '__typename');
1271
- }
1272
-
1273
1243
  function fromError(errorValue) {
1274
1244
  return new zenObservableTs.Observable(function (observer) {
1275
1245
  observer.error(errorValue);
@@ -1490,7 +1460,7 @@ var concat = ApolloLink.concat;
1490
1460
 
1491
1461
  var execute = ApolloLink.execute;
1492
1462
 
1493
- var version = '3.8.0-alpha.12';
1463
+ var version = '3.8.0-alpha.14';
1494
1464
 
1495
1465
  function asyncIterator(source) {
1496
1466
  var _a;
@@ -1892,7 +1862,7 @@ function selectHttpOptionsAndBodyInternal(operation, printer) {
1892
1862
  options.headers = removeDuplicateHeaders(options.headers, http.preserveHeaderCase);
1893
1863
  }
1894
1864
  var operationName = operation.operationName, extensions = operation.extensions, variables = operation.variables, query = operation.query;
1895
- var body = { operationName: operationName, variables: stripTypename(variables) };
1865
+ var body = { operationName: operationName, variables: variables };
1896
1866
  if (http.includeExtensions)
1897
1867
  body.extensions = extensions;
1898
1868
  if (http.includeQuery)
@@ -3370,7 +3340,7 @@ var Policies = (function () {
3370
3340
  var policy = typename && this.getTypePolicy(typename);
3371
3341
  var keyFn = policy && policy.keyFn || this.config.dataIdFromObject;
3372
3342
  while (keyFn) {
3373
- var specifierOrId = keyFn(object, context);
3343
+ var specifierOrId = keyFn(tslib.__assign(tslib.__assign({}, object), storeObject), context);
3374
3344
  if (isArray(specifierOrId)) {
3375
3345
  keyFn = keyFieldsFnFromSpecifier(specifierOrId);
3376
3346
  }
@@ -6724,24 +6694,29 @@ var contextKey = canUseSymbol
6724
6694
  ? Symbol.for('__APOLLO_CONTEXT__')
6725
6695
  : '__APOLLO_CONTEXT__';
6726
6696
  function getApolloContext() {
6727
- var context = React__namespace.createContext[contextKey];
6697
+ __DEV__ ? tsInvariant.invariant('createContext' in React__namespace, 'Invoking `getApolloContext` in an environment where `React.createContext` is not available.\n' +
6698
+ 'The Apollo Client functionality you are trying to use is only available in React Client Components.\n' +
6699
+ 'Please make sure to add "use client" at the top of your file.\n' +
6700
+ 'For more information, see https://nextjs.org/docs/getting-started/react-essentials#client-components') : tsInvariant.invariant('createContext' in React__namespace, 29);
6701
+ var contextStorage = global$1[contextKey];
6702
+ if (!contextStorage) {
6703
+ contextStorage = global$1[contextKey] = new Map();
6704
+ }
6705
+ var context = contextStorage.get(React__namespace);
6728
6706
  if (!context) {
6729
- Object.defineProperty(React__namespace.createContext, contextKey, {
6730
- value: context = React__namespace.createContext({}),
6731
- enumerable: false,
6732
- writable: false,
6733
- configurable: true,
6734
- });
6707
+ context = React__namespace.createContext({});
6735
6708
  context.displayName = 'ApolloContext';
6709
+ contextStorage.set(React__namespace, context);
6736
6710
  }
6737
6711
  return context;
6738
6712
  }
6713
+ var resetApolloContext = getApolloContext;
6739
6714
 
6740
6715
  var ApolloConsumer = function (props) {
6741
6716
  var ApolloContext = getApolloContext();
6742
6717
  return (React__namespace.createElement(ApolloContext.Consumer, null, function (context) {
6743
6718
  __DEV__ ? tsInvariant.invariant(context && context.client, 'Could not find "client" in the context of ApolloConsumer. ' +
6744
- 'Wrap the root component in an <ApolloProvider>.') : tsInvariant.invariant(context && context.client, 29);
6719
+ 'Wrap the root component in an <ApolloProvider>.') : tsInvariant.invariant(context && context.client, 28);
6745
6720
  return props.children(context.client);
6746
6721
  }));
6747
6722
  };
@@ -6749,18 +6724,13 @@ var ApolloConsumer = function (props) {
6749
6724
  var ApolloProvider = function (_a) {
6750
6725
  var client = _a.client, suspenseCache = _a.suspenseCache, children = _a.children;
6751
6726
  var ApolloContext = getApolloContext();
6752
- return (React__namespace.createElement(ApolloContext.Consumer, null, function (context) {
6753
- if (context === void 0) { context = {}; }
6754
- if (client && context.client !== client) {
6755
- context = Object.assign({}, context, { client: client });
6756
- }
6757
- if (suspenseCache) {
6758
- context = Object.assign({}, context, { suspenseCache: suspenseCache });
6759
- }
6760
- __DEV__ ? tsInvariant.invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +
6761
- 'sure you pass in your client via the "client" prop.') : tsInvariant.invariant(context.client, 30);
6762
- return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
6763
- }));
6727
+ var parentContext = React__namespace.useContext(ApolloContext);
6728
+ var context = React__namespace.useMemo(function () {
6729
+ return tslib.__assign(tslib.__assign({}, parentContext), { client: client || parentContext.client, suspenseCache: suspenseCache || parentContext.suspenseCache });
6730
+ }, [parentContext, client, suspenseCache]);
6731
+ __DEV__ ? tsInvariant.invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +
6732
+ 'sure you pass in your client via the "client" prop.') : tsInvariant.invariant(context.client, 30);
6733
+ return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
6764
6734
  };
6765
6735
 
6766
6736
  function useApolloClient(override) {
@@ -6846,7 +6816,7 @@ function parser(document) {
6846
6816
  var variables, type, name;
6847
6817
  __DEV__ ? tsInvariant.invariant(!!document && !!document.kind, "Argument of ".concat(document, " passed to parser was not a valid GraphQL ") +
6848
6818
  "DocumentNode. You may need to use 'graphql-tag' or another method " +
6849
- "to convert your operation into a document") : tsInvariant.invariant(!!document && !!document.kind, 36);
6819
+ "to convert your operation into a document") : tsInvariant.invariant(!!document && !!document.kind, 37);
6850
6820
  var fragments = [];
6851
6821
  var queries = [];
6852
6822
  var mutations = [];
@@ -6874,11 +6844,11 @@ function parser(document) {
6874
6844
  __DEV__ ? tsInvariant.invariant(!fragments.length ||
6875
6845
  (queries.length || mutations.length || subscriptions.length), "Passing only a fragment to 'graphql' is not yet supported. " +
6876
6846
  "You must include a query, subscription or mutation as well") : tsInvariant.invariant(!fragments.length ||
6877
- (queries.length || mutations.length || subscriptions.length), 37);
6847
+ (queries.length || mutations.length || subscriptions.length), 38);
6878
6848
  __DEV__ ? tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1, "react-apollo only supports a query, subscription, or a mutation per HOC. " +
6879
6849
  "".concat(document, " had ").concat(queries.length, " queries, ").concat(subscriptions.length, " ") +
6880
6850
  "subscriptions and ".concat(mutations.length, " mutations. ") +
6881
- "You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1, 38);
6851
+ "You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1, 39);
6882
6852
  type = queries.length ? exports.DocumentType.Query : exports.DocumentType.Mutation;
6883
6853
  if (!queries.length && !mutations.length)
6884
6854
  type = exports.DocumentType.Subscription;
@@ -6889,7 +6859,7 @@ function parser(document) {
6889
6859
  : subscriptions;
6890
6860
  __DEV__ ? tsInvariant.invariant(definitions.length === 1, "react-apollo only supports one definition per HOC. ".concat(document, " had ") +
6891
6861
  "".concat(definitions.length, " definitions. ") +
6892
- "You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(definitions.length === 1, 39);
6862
+ "You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(definitions.length === 1, 40);
6893
6863
  var definition = definitions[0];
6894
6864
  variables = definition.variableDefinitions || [];
6895
6865
  if (definition.name && definition.name.kind === 'Name') {
@@ -6907,7 +6877,7 @@ function verifyDocumentType(document, type) {
6907
6877
  var requiredOperationName = operationName(type);
6908
6878
  var usedOperationName = operationName(operation.type);
6909
6879
  __DEV__ ? tsInvariant.invariant(operation.type === type, "Running a ".concat(requiredOperationName, " requires a graphql ") +
6910
- "".concat(requiredOperationName, ", but a ").concat(usedOperationName, " was used instead.")) : tsInvariant.invariant(operation.type === type, 40);
6880
+ "".concat(requiredOperationName, ", but a ").concat(usedOperationName, " was used instead.")) : tsInvariant.invariant(operation.type === type, 41);
6911
6881
  }
6912
6882
 
6913
6883
  var hasOwnProperty = Object.prototype.hasOwnProperty;
@@ -7438,9 +7408,13 @@ function useSubscription(subscription, options) {
7438
7408
  if (!observable) {
7439
7409
  return;
7440
7410
  }
7411
+ var subscriptionStopped = false;
7441
7412
  var subscription = observable.subscribe({
7442
7413
  next: function (fetchResult) {
7443
7414
  var _a, _b;
7415
+ if (subscriptionStopped) {
7416
+ return;
7417
+ }
7444
7418
  var result = {
7445
7419
  loading: false,
7446
7420
  data: fetchResult.data,
@@ -7463,26 +7437,33 @@ function useSubscription(subscription, options) {
7463
7437
  },
7464
7438
  error: function (error) {
7465
7439
  var _a, _b;
7466
- setResult({
7467
- loading: false,
7468
- data: void 0,
7469
- error: error,
7470
- variables: options === null || options === void 0 ? void 0 : options.variables,
7471
- });
7472
- (_b = (_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError) === null || _b === void 0 ? void 0 : _b.call(_a, error);
7440
+ if (!subscriptionStopped) {
7441
+ setResult({
7442
+ loading: false,
7443
+ data: void 0,
7444
+ error: error,
7445
+ variables: options === null || options === void 0 ? void 0 : options.variables,
7446
+ });
7447
+ (_b = (_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError) === null || _b === void 0 ? void 0 : _b.call(_a, error);
7448
+ }
7473
7449
  },
7474
7450
  complete: function () {
7475
7451
  var _a, _b;
7476
- if ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onComplete) {
7477
- ref.current.options.onComplete();
7478
- }
7479
- else if ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onSubscriptionComplete) {
7480
- ref.current.options.onSubscriptionComplete();
7452
+ if (!subscriptionStopped) {
7453
+ if ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onComplete) {
7454
+ ref.current.options.onComplete();
7455
+ }
7456
+ else if ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onSubscriptionComplete) {
7457
+ ref.current.options.onSubscriptionComplete();
7458
+ }
7481
7459
  }
7482
7460
  },
7483
7461
  });
7484
7462
  return function () {
7485
- subscription.unsubscribe();
7463
+ subscriptionStopped = true;
7464
+ setTimeout(function () {
7465
+ subscription.unsubscribe();
7466
+ });
7486
7467
  };
7487
7468
  }, [observable]);
7488
7469
  return result;
@@ -7506,7 +7487,7 @@ function useReactiveVar(rv) {
7506
7487
  function useFragment_experimental(options) {
7507
7488
  var cache = useApolloClient().cache;
7508
7489
  var fragment = options.fragment, fragmentName = options.fragmentName, from = options.from, _a = options.optimistic, optimistic = _a === void 0 ? true : _a, rest = tslib.__rest(options, ["fragment", "fragmentName", "from", "optimistic"]);
7509
- var diffOptions = tslib.__assign(tslib.__assign({}, rest), { id: typeof from === "string" ? from : cache.identify(from), query: cache["getFragmentDoc"](fragment, fragmentName), optimistic: optimistic });
7490
+ var diffOptions = tslib.__assign(tslib.__assign({}, rest), { returnPartialData: true, id: typeof from === "string" ? from : cache.identify(from), query: cache["getFragmentDoc"](fragment, fragmentName), optimistic: optimistic });
7510
7491
  var resultRef = React.useRef();
7511
7492
  var latestDiff = cache.diff(diffOptions);
7512
7493
  var getSnapshot = function () {
@@ -7574,47 +7555,51 @@ function useSuspenseCache(override) {
7574
7555
  var suspenseCache = override || context.suspenseCache;
7575
7556
  __DEV__ ? tsInvariant.invariant(suspenseCache, 'Could not find a "suspenseCache" in the context or passed in as an option. ' +
7576
7557
  'Wrap the root component in an <ApolloProvider> and provide a suspenseCache, ' +
7577
- 'or pass a SuspenseCache instance in via options.') : tsInvariant.invariant(suspenseCache, 34);
7558
+ 'or pass a SuspenseCache instance in via options.') : tsInvariant.invariant(suspenseCache, 35);
7578
7559
  return suspenseCache;
7579
7560
  }
7580
7561
 
7581
7562
  function useSuspenseQuery_experimental(query, options) {
7582
7563
  if (options === void 0) { options = Object.create(null); }
7583
- var didPreviouslySuspend = React.useRef(false);
7584
7564
  var client = useApolloClient(options.client);
7585
7565
  var suspenseCache = useSuspenseCache(options.suspenseCache);
7586
7566
  var watchQueryOptions = useWatchQueryOptions({ query: query, options: options });
7587
- var _a = watchQueryOptions.returnPartialData, returnPartialData = _a === void 0 ? false : _a, variables = watchQueryOptions.variables;
7588
- var _b = options.suspensePolicy, suspensePolicy = _b === void 0 ? 'always' : _b, _c = options.queryKey, queryKey = _c === void 0 ? [] : _c;
7589
- var shouldSuspend = suspensePolicy === 'always' || !didPreviouslySuspend.current;
7567
+ var variables = watchQueryOptions.variables;
7568
+ var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a;
7590
7569
  var cacheKey = [client, query, canonicalStringify(variables)].concat(queryKey);
7591
- var subscription = suspenseCache.getSubscription(cacheKey, function () {
7570
+ var queryRef = suspenseCache.getQueryRef(cacheKey, function () {
7592
7571
  return client.watchQuery(watchQueryOptions);
7593
7572
  });
7594
- var dispose = useTrackedSubscriptions(subscription);
7595
- useStrictModeSafeCleanupEffect(dispose);
7596
- var result = useSyncExternalStore(subscription.listen, function () { return subscription.result; }, function () { return subscription.result; });
7597
- var previousVariables = React.useRef(variables);
7598
- var previousData = React.useRef(result.data);
7599
- if (!equal.equal(variables, previousVariables.current)) {
7600
- if (result.networkStatus !== exports.NetworkStatus.ready) {
7601
- result = tslib.__assign(tslib.__assign({}, result), { data: previousData.current, networkStatus: exports.NetworkStatus.setVariables });
7602
- }
7603
- previousVariables.current = variables;
7604
- previousData.current = result.data;
7605
- }
7606
- if (result.networkStatus === exports.NetworkStatus.error ||
7607
- (shouldSuspend &&
7608
- !shouldUseCachedResult(subscription.result, {
7609
- returnPartialData: returnPartialData,
7610
- fetchPolicy: options.fetchPolicy,
7611
- }))) {
7612
- __use(subscription.promise);
7613
- }
7614
- didPreviouslySuspend.current = true;
7615
- var fetchMore = React.useCallback(function (options) { return subscription.fetchMore(options); }, [subscription]);
7616
- var refetch = React.useCallback(function (variables) { return subscription.refetch(variables); }, [subscription]);
7617
- var subscribeToMore = React.useCallback(function (options) { return subscription.observable.subscribeToMore(options); }, [subscription]);
7573
+ var _b = React.useState(function () { return new Map([[queryRef.key, queryRef.promise]]); }), promiseCache = _b[0], setPromiseCache = _b[1];
7574
+ var promise = promiseCache.get(queryRef.key);
7575
+ if (!promise) {
7576
+ promise = queryRef.promise;
7577
+ promiseCache.set(queryRef.key, promise);
7578
+ }
7579
+ useTrackedQueryRefs(queryRef);
7580
+ React.useEffect(function () {
7581
+ return queryRef.listen(function (promise) {
7582
+ setPromiseCache(function (promiseCache) {
7583
+ return new Map(promiseCache).set(queryRef.key, promise);
7584
+ });
7585
+ });
7586
+ }, [queryRef]);
7587
+ var result = __use(promise);
7588
+ var fetchMore = React.useCallback(function (options) {
7589
+ var promise = queryRef.fetchMore(options);
7590
+ setPromiseCache(function (previousPromiseCache) {
7591
+ return new Map(previousPromiseCache).set(queryRef.key, promise);
7592
+ });
7593
+ return promise;
7594
+ }, [queryRef]);
7595
+ var refetch = React.useCallback(function (variables) {
7596
+ var promise = queryRef.refetch(variables);
7597
+ setPromiseCache(function (previousPromiseCache) {
7598
+ return new Map(previousPromiseCache).set(queryRef.key, promise);
7599
+ });
7600
+ return promise;
7601
+ }, [queryRef]);
7602
+ var subscribeToMore = React.useCallback(function (options) { return queryRef.observable.subscribeToMore(options); }, [queryRef]);
7618
7603
  return React.useMemo(function () {
7619
7604
  return {
7620
7605
  client: client,
@@ -7641,7 +7626,7 @@ function validateFetchPolicy(fetchPolicy) {
7641
7626
  'no-cache',
7642
7627
  'cache-and-network',
7643
7628
  ];
7644
- __DEV__ ? tsInvariant.invariant(supportedFetchPolicies.includes(fetchPolicy), "The fetch policy `".concat(fetchPolicy, "` is not supported with suspense.")) : tsInvariant.invariant(supportedFetchPolicies.includes(fetchPolicy), 35);
7629
+ __DEV__ ? tsInvariant.invariant(supportedFetchPolicies.includes(fetchPolicy), "The fetch policy `".concat(fetchPolicy, "` is not supported with suspense.")) : tsInvariant.invariant(supportedFetchPolicies.includes(fetchPolicy), 36);
7645
7630
  }
7646
7631
  function validatePartialDataReturn(fetchPolicy, returnPartialData) {
7647
7632
  if (fetchPolicy === 'no-cache' && returnPartialData) {
@@ -7653,79 +7638,123 @@ function toApolloError(result) {
7653
7638
  ? new ApolloError({ graphQLErrors: result.errors })
7654
7639
  : result.error;
7655
7640
  }
7656
- function useTrackedSubscriptions(subscription) {
7657
- var trackedSubscriptions = React.useRef(new Set());
7658
- trackedSubscriptions.current.add(subscription);
7659
- return function dispose() {
7660
- trackedSubscriptions.current.forEach(function (sub) { return sub.dispose(); });
7661
- };
7641
+ function useTrackedQueryRefs(queryRef) {
7642
+ var trackedQueryRefs = React.useRef(new Set());
7643
+ trackedQueryRefs.current.add(queryRef);
7644
+ useStrictModeSafeCleanupEffect(function () {
7645
+ trackedQueryRefs.current.forEach(function (sub) { return sub.dispose(); });
7646
+ });
7662
7647
  }
7663
7648
  function useWatchQueryOptions(_a) {
7664
7649
  var query = _a.query, options = _a.options;
7665
- var watchQueryOptions = useDeepMemo(function () { return (tslib.__assign(tslib.__assign({}, options), { query: query, notifyOnNetworkStatusChange: true, nextFetchPolicy: void 0 })); }, [options, query]);
7650
+ var watchQueryOptions = useDeepMemo(function () { return (tslib.__assign(tslib.__assign({}, options), { query: query, notifyOnNetworkStatusChange: false, nextFetchPolicy: void 0 })); }, [options, query]);
7666
7651
  if (__DEV__) {
7667
7652
  validateOptions(watchQueryOptions);
7668
7653
  }
7669
7654
  return watchQueryOptions;
7670
7655
  }
7671
- function shouldUseCachedResult(result, _a) {
7672
- var returnPartialData = _a.returnPartialData, fetchPolicy = _a.fetchPolicy;
7673
- if (result.networkStatus === exports.NetworkStatus.refetch ||
7674
- result.networkStatus === exports.NetworkStatus.fetchMore ||
7675
- result.networkStatus === exports.NetworkStatus.error) {
7676
- return false;
7677
- }
7678
- switch (fetchPolicy) {
7679
- case void 0:
7680
- case 'cache-first':
7681
- case 'cache-and-network': {
7682
- return Boolean(result.data && (!result.partial || returnPartialData));
7683
- }
7684
- default:
7685
- return false;
7686
- }
7687
- }
7688
7656
 
7689
- function wrapWithCustomPromise(concast) {
7690
- return new Promise(function (resolve, reject) {
7691
- var subscription = concast.subscribe({
7692
- next: function (value) {
7693
- resolve(value);
7694
- subscription.unsubscribe();
7657
+ function useBackgroundQuery_experimental(query, options) {
7658
+ if (options === void 0) { options = Object.create(null); }
7659
+ var suspenseCache = useSuspenseCache(options.suspenseCache);
7660
+ var client = useApolloClient(options.client);
7661
+ var watchQueryOptions = useWatchQueryOptions({ query: query, options: options });
7662
+ var variables = watchQueryOptions.variables;
7663
+ var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a;
7664
+ var cacheKey = [client, query, canonicalStringify(variables)].concat(queryKey);
7665
+ var queryRef = suspenseCache.getQueryRef(cacheKey, function () {
7666
+ return client.watchQuery(watchQueryOptions);
7667
+ });
7668
+ var _b = React.useState(function () { return new Map([[queryRef.key, queryRef.promise]]); }), promiseCache = _b[0], setPromiseCache = _b[1];
7669
+ useTrackedQueryRefs(queryRef);
7670
+ var fetchMore = React.useCallback(function (options) {
7671
+ var promise = queryRef.fetchMore(options);
7672
+ setPromiseCache(function (promiseCache) {
7673
+ return new Map(promiseCache).set(queryRef.key, promise);
7674
+ });
7675
+ return promise;
7676
+ }, [queryRef]);
7677
+ var refetch = React.useCallback(function (variables) {
7678
+ var promise = queryRef.refetch(variables);
7679
+ setPromiseCache(function (promiseCache) {
7680
+ return new Map(promiseCache).set(queryRef.key, promise);
7681
+ });
7682
+ return promise;
7683
+ }, [queryRef]);
7684
+ queryRef.promiseCache = promiseCache;
7685
+ return React.useMemo(function () {
7686
+ return [
7687
+ queryRef,
7688
+ {
7689
+ fetchMore: fetchMore,
7690
+ refetch: refetch,
7695
7691
  },
7696
- error: reject,
7692
+ ];
7693
+ }, [queryRef, fetchMore, refetch]);
7694
+ }
7695
+ function useReadQuery_experimental(queryRef) {
7696
+ var _a = React.useState(0), forceUpdate = _a[1];
7697
+ __DEV__ ? tsInvariant.invariant(queryRef.promiseCache, 'It appears that `useReadQuery` was used outside of `useBackgroundQuery`. ' +
7698
+ '`useReadQuery` is only supported for use with `useBackgroundQuery`. ' +
7699
+ 'Please ensure you are passing the `queryRef` returned from `useBackgroundQuery`.') : tsInvariant.invariant(queryRef.promiseCache, 34);
7700
+ var promise = queryRef.promiseCache.get(queryRef.key);
7701
+ if (!promise) {
7702
+ promise = queryRef.promise;
7703
+ queryRef.promiseCache.set(queryRef.key, promise);
7704
+ }
7705
+ React.useEffect(function () {
7706
+ return queryRef.listen(function (promise) {
7707
+ queryRef.promiseCache.set(queryRef.key, promise);
7708
+ forceUpdate(function (prevState) { return prevState + 1; });
7697
7709
  });
7698
- });
7710
+ }, [queryRef]);
7711
+ var result = __use(promise);
7712
+ return React.useMemo(function () {
7713
+ return {
7714
+ data: result.data,
7715
+ networkStatus: result.networkStatus,
7716
+ error: toApolloError(result),
7717
+ };
7718
+ }, [result]);
7699
7719
  }
7700
- var isMultipartQuery = optimism.wrap(function (query) {
7701
- return hasAnyDirectives(['defer', 'stream'], query);
7702
- });
7703
- var QuerySubscription = (function () {
7704
- function QuerySubscription(observable, options) {
7705
- if (options === void 0) { options = Object.create(null); }
7720
+
7721
+ var QueryReference = (function () {
7722
+ function QueryReference(observable, options) {
7723
+ var _this = this;
7706
7724
  var _a;
7707
7725
  this.listeners = new Set();
7726
+ this.initialized = false;
7727
+ this.refetching = false;
7708
7728
  this.listen = this.listen.bind(this);
7709
7729
  this.handleNext = this.handleNext.bind(this);
7710
7730
  this.handleError = this.handleError.bind(this);
7711
7731
  this.dispose = this.dispose.bind(this);
7712
7732
  this.observable = observable;
7713
- this.result = observable.getCurrentResult();
7733
+ this.result = observable.getCurrentResult(false);
7734
+ this.key = options.key;
7714
7735
  if (options.onDispose) {
7715
7736
  this.onDispose = options.onDispose;
7716
7737
  }
7738
+ if (isNetworkRequestSettled(this.result.networkStatus) ||
7739
+ (this.result.data &&
7740
+ (!this.result.partial || this.observable.options.returnPartialData))) {
7741
+ this.promise = createFulfilledPromise(this.result);
7742
+ this.initialized = true;
7743
+ this.refetching = false;
7744
+ }
7717
7745
  this.subscription = observable.subscribe({
7718
7746
  next: this.handleNext,
7719
7747
  error: this.handleError,
7720
7748
  });
7721
- __DEV__ ? tsInvariant.invariant(observable['concast'], 'Unexpected error: A concast was not found on the observable.') : tsInvariant.invariant(observable['concast'], 28);
7722
- var concast = observable['concast'];
7723
- this.promise = isMultipartQuery(observable.query)
7724
- ? wrapWithCustomPromise(concast)
7725
- : concast.promise;
7749
+ if (!this.promise) {
7750
+ this.promise = new Promise(function (resolve, reject) {
7751
+ _this.resolve = resolve;
7752
+ _this.reject = reject;
7753
+ });
7754
+ }
7726
7755
  this.autoDisposeTimeoutId = setTimeout(this.dispose, (_a = options.autoDisposeTimeoutMs) !== null && _a !== void 0 ? _a : 30000);
7727
7756
  }
7728
- QuerySubscription.prototype.listen = function (listener) {
7757
+ QueryReference.prototype.listen = function (listener) {
7729
7758
  var _this = this;
7730
7759
  clearTimeout(this.autoDisposeTimeoutId);
7731
7760
  this.listeners.add(listener);
@@ -7733,57 +7762,83 @@ var QuerySubscription = (function () {
7733
7762
  _this.listeners.delete(listener);
7734
7763
  };
7735
7764
  };
7736
- QuerySubscription.prototype.refetch = function (variables) {
7737
- this.promise = this.observable.refetch(variables);
7738
- return this.promise;
7765
+ QueryReference.prototype.refetch = function (variables) {
7766
+ this.refetching = true;
7767
+ var promise = this.observable.refetch(variables);
7768
+ this.promise = promise;
7769
+ return promise;
7739
7770
  };
7740
- QuerySubscription.prototype.fetchMore = function (options) {
7741
- this.promise = this.observable.fetchMore(options);
7742
- return this.promise;
7771
+ QueryReference.prototype.fetchMore = function (options) {
7772
+ var promise = this.observable.fetchMore(options);
7773
+ this.promise = promise;
7774
+ return promise;
7743
7775
  };
7744
- QuerySubscription.prototype.dispose = function () {
7776
+ QueryReference.prototype.dispose = function () {
7745
7777
  this.subscription.unsubscribe();
7746
7778
  this.onDispose();
7747
7779
  };
7748
- QuerySubscription.prototype.onDispose = function () {
7780
+ QueryReference.prototype.onDispose = function () {
7749
7781
  };
7750
- QuerySubscription.prototype.handleNext = function (result) {
7751
- if (isNetworkRequestSettled(result.networkStatus) &&
7752
- this.result.data &&
7753
- result.data === void 0) {
7754
- result.data = this.result.data;
7782
+ QueryReference.prototype.handleNext = function (result) {
7783
+ if (!this.initialized || this.refetching) {
7784
+ if (!isNetworkRequestSettled(result.networkStatus)) {
7785
+ return;
7786
+ }
7787
+ if (this.result.data && result.data === void 0) {
7788
+ result.data = this.result.data;
7789
+ }
7790
+ this.initialized = true;
7791
+ this.refetching = false;
7792
+ this.result = result;
7793
+ this.resolve(result);
7794
+ return;
7795
+ }
7796
+ if (result.data === this.result.data) {
7797
+ return;
7755
7798
  }
7756
7799
  this.result = result;
7757
- this.deliver(result);
7800
+ this.promise = createFulfilledPromise(result);
7801
+ this.deliver(this.promise);
7758
7802
  };
7759
- QuerySubscription.prototype.handleError = function (error) {
7803
+ QueryReference.prototype.handleError = function (error) {
7760
7804
  var result = tslib.__assign(tslib.__assign({}, this.result), { error: error, networkStatus: exports.NetworkStatus.error });
7761
7805
  this.result = result;
7762
- this.deliver(result);
7806
+ if (!this.initialized || this.refetching) {
7807
+ this.initialized = true;
7808
+ this.refetching = false;
7809
+ this.reject(error);
7810
+ return;
7811
+ }
7812
+ this.result = result;
7813
+ this.promise = result.data
7814
+ ? createFulfilledPromise(result)
7815
+ : createRejectedPromise(result);
7816
+ this.deliver(this.promise);
7763
7817
  };
7764
- QuerySubscription.prototype.deliver = function (result) {
7765
- this.listeners.forEach(function (listener) { return listener(result); });
7818
+ QueryReference.prototype.deliver = function (promise) {
7819
+ this.listeners.forEach(function (listener) { return listener(promise); });
7766
7820
  };
7767
- return QuerySubscription;
7821
+ return QueryReference;
7768
7822
  }());
7769
7823
 
7770
7824
  var SuspenseCache = (function () {
7771
7825
  function SuspenseCache(options) {
7772
7826
  if (options === void 0) { options = Object.create(null); }
7773
7827
  this.cacheKeys = new trie.Trie(canUseWeakMap, function (cacheKey) { return cacheKey; });
7774
- this.subscriptions = new Map();
7828
+ this.queryRefs = new Map();
7775
7829
  this.options = options;
7776
7830
  }
7777
- SuspenseCache.prototype.getSubscription = function (cacheKey, createObservable) {
7831
+ SuspenseCache.prototype.getQueryRef = function (cacheKey, createObservable) {
7778
7832
  var _this = this;
7779
7833
  var stableCacheKey = this.cacheKeys.lookupArray(cacheKey);
7780
- if (!this.subscriptions.has(stableCacheKey)) {
7781
- this.subscriptions.set(stableCacheKey, new QuerySubscription(createObservable(), {
7834
+ if (!this.queryRefs.has(stableCacheKey)) {
7835
+ this.queryRefs.set(stableCacheKey, new QueryReference(createObservable(), {
7836
+ key: stableCacheKey,
7782
7837
  autoDisposeTimeoutMs: this.options.autoDisposeTimeoutMs,
7783
- onDispose: function () { return _this.subscriptions.delete(stableCacheKey); },
7838
+ onDispose: function () { return _this.queryRefs.delete(stableCacheKey); },
7784
7839
  }));
7785
7840
  }
7786
- return this.subscriptions.get(stableCacheKey);
7841
+ return this.queryRefs.get(stableCacheKey);
7787
7842
  };
7788
7843
  return SuspenseCache;
7789
7844
  }());
@@ -7828,7 +7883,7 @@ exports.mergeOptions = mergeOptions;
7828
7883
  exports.operationName = operationName;
7829
7884
  exports.parseAndCheckHttpResponse = parseAndCheckHttpResponse;
7830
7885
  exports.parser = parser;
7831
- exports.resetApolloContext = getApolloContext;
7886
+ exports.resetApolloContext = resetApolloContext;
7832
7887
  exports.rewriteURIForGET = rewriteURIForGET;
7833
7888
  exports.selectHttpOptionsAndBody = selectHttpOptionsAndBody;
7834
7889
  exports.selectHttpOptionsAndBodyInternal = selectHttpOptionsAndBodyInternal;
@@ -7838,11 +7893,13 @@ exports.split = split;
7838
7893
  exports.throwServerError = throwServerError;
7839
7894
  exports.toPromise = toPromise;
7840
7895
  exports.useApolloClient = useApolloClient;
7896
+ exports.useBackgroundQuery_experimental = useBackgroundQuery_experimental;
7841
7897
  exports.useFragment_experimental = useFragment_experimental;
7842
7898
  exports.useLazyQuery = useLazyQuery;
7843
7899
  exports.useMutation = useMutation;
7844
7900
  exports.useQuery = useQuery;
7845
7901
  exports.useReactiveVar = useReactiveVar;
7902
+ exports.useReadQuery_experimental = useReadQuery_experimental;
7846
7903
  exports.useSubscription = useSubscription;
7847
7904
  exports.useSuspenseQuery_experimental = useSuspenseQuery_experimental;
7848
7905
  //# sourceMappingURL=apollo-client.cjs.map