@apollo/client 3.8.0-alpha.13 → 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 (420) hide show
  1. package/apollo-client.cjs +195 -164
  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 +45 -28
  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.map +1 -1
  136. package/link/remove-typename/index.d.ts +2 -0
  137. package/link/remove-typename/index.d.ts.map +1 -0
  138. package/link/remove-typename/index.js +2 -0
  139. package/link/remove-typename/index.js.map +1 -0
  140. package/link/remove-typename/package.json +8 -0
  141. package/link/remove-typename/remove-typename.cjs +70 -0
  142. package/link/remove-typename/remove-typename.cjs.map +1 -0
  143. package/link/remove-typename/remove-typename.cjs.native.js +70 -0
  144. package/link/remove-typename/removeTypenameFromVariables.d.ts +11 -0
  145. package/link/remove-typename/removeTypenameFromVariables.d.ts.map +1 -0
  146. package/link/remove-typename/removeTypenameFromVariables.js +62 -0
  147. package/link/remove-typename/removeTypenameFromVariables.js.map +1 -0
  148. package/link/retry/delayFunction.d.ts +1 -1
  149. package/link/retry/delayFunction.d.ts.map +1 -1
  150. package/link/retry/delayFunction.js.map +1 -1
  151. package/link/retry/retryFunction.d.ts +1 -1
  152. package/link/retry/retryFunction.d.ts.map +1 -1
  153. package/link/retry/retryFunction.js.map +1 -1
  154. package/link/retry/retryLink.d.ts +4 -3
  155. package/link/retry/retryLink.d.ts.map +1 -1
  156. package/link/retry/retryLink.js.map +1 -1
  157. package/link/schema/index.d.ts +3 -2
  158. package/link/schema/index.d.ts.map +1 -1
  159. package/link/schema/index.js.map +1 -1
  160. package/link/subscriptions/index.d.ts +2 -1
  161. package/link/subscriptions/index.d.ts.map +1 -1
  162. package/link/subscriptions/index.js +2 -2
  163. package/link/subscriptions/index.js.map +1 -1
  164. package/link/subscriptions/subscriptions.cjs +1 -1
  165. package/link/subscriptions/subscriptions.cjs.map +1 -1
  166. package/link/subscriptions/subscriptions.cjs.native.js +1 -1
  167. package/link/utils/createOperation.d.ts +1 -1
  168. package/link/utils/createOperation.d.ts.map +1 -1
  169. package/link/utils/createOperation.js.map +1 -1
  170. package/link/utils/filterOperationVariables.d.ts +1 -1
  171. package/link/utils/filterOperationVariables.d.ts.map +1 -1
  172. package/link/utils/filterOperationVariables.js.map +1 -1
  173. package/link/utils/toPromise.d.ts +1 -1
  174. package/link/utils/toPromise.d.ts.map +1 -1
  175. package/link/utils/toPromise.js.map +1 -1
  176. package/link/utils/transformOperation.d.ts +1 -1
  177. package/link/utils/transformOperation.d.ts.map +1 -1
  178. package/link/utils/transformOperation.js.map +1 -1
  179. package/link/utils/validateOperation.d.ts +1 -1
  180. package/link/utils/validateOperation.d.ts.map +1 -1
  181. package/link/utils/validateOperation.js.map +1 -1
  182. package/link/ws/index.d.ts +5 -3
  183. package/link/ws/index.d.ts.map +1 -1
  184. package/link/ws/index.js.map +1 -1
  185. package/package.json +18 -15
  186. package/react/cache/{QuerySubscription.d.ts → QueryReference.d.ts} +12 -11
  187. package/react/cache/QueryReference.d.ts.map +1 -0
  188. package/react/cache/{QuerySubscription.js → QueryReference.js} +37 -36
  189. package/react/cache/QueryReference.js.map +1 -0
  190. package/react/cache/SuspenseCache.d.ts +5 -5
  191. package/react/cache/SuspenseCache.d.ts.map +1 -1
  192. package/react/cache/SuspenseCache.js +8 -7
  193. package/react/cache/SuspenseCache.js.map +1 -1
  194. package/react/cache/types.d.ts +2 -0
  195. package/react/cache/types.d.ts.map +1 -0
  196. package/react/cache/types.js +2 -0
  197. package/react/cache/types.js.map +1 -0
  198. package/react/components/Mutation.d.ts +2 -2
  199. package/react/components/Mutation.d.ts.map +1 -1
  200. package/react/components/Mutation.js.map +1 -1
  201. package/react/components/Query.d.ts +2 -2
  202. package/react/components/Query.d.ts.map +1 -1
  203. package/react/components/Query.js.map +1 -1
  204. package/react/components/Subscription.d.ts +2 -2
  205. package/react/components/Subscription.d.ts.map +1 -1
  206. package/react/components/Subscription.js.map +1 -1
  207. package/react/components/types.d.ts +4 -4
  208. package/react/components/types.d.ts.map +1 -1
  209. package/react/components/types.js.map +1 -1
  210. package/react/context/ApolloConsumer.d.ts +1 -1
  211. package/react/context/ApolloConsumer.d.ts.map +1 -1
  212. package/react/context/ApolloConsumer.js.map +1 -1
  213. package/react/context/ApolloContext.d.ts +10 -3
  214. package/react/context/ApolloContext.d.ts.map +1 -1
  215. package/react/context/ApolloContext.js +13 -8
  216. package/react/context/ApolloContext.js.map +1 -1
  217. package/react/context/ApolloProvider.d.ts +2 -2
  218. package/react/context/ApolloProvider.d.ts.map +1 -1
  219. package/react/context/ApolloProvider.js +8 -12
  220. package/react/context/ApolloProvider.js.map +1 -1
  221. package/react/context/context.cjs +21 -20
  222. package/react/context/context.cjs.map +1 -1
  223. package/react/context/context.cjs.native.js +21 -20
  224. package/react/context/index.d.ts +1 -1
  225. package/react/context/index.d.ts.map +1 -1
  226. package/react/context/index.js +1 -1
  227. package/react/context/index.js.map +1 -1
  228. package/react/hoc/graphql.d.ts +3 -3
  229. package/react/hoc/graphql.d.ts.map +1 -1
  230. package/react/hoc/graphql.js.map +1 -1
  231. package/react/hoc/hoc-utils.d.ts +2 -2
  232. package/react/hoc/hoc-utils.d.ts.map +1 -1
  233. package/react/hoc/hoc-utils.js +1 -1
  234. package/react/hoc/hoc-utils.js.map +1 -1
  235. package/react/hoc/hoc.cjs +2 -2
  236. package/react/hoc/hoc.cjs.map +1 -1
  237. package/react/hoc/hoc.cjs.native.js +2 -2
  238. package/react/hoc/mutation-hoc.d.ts +4 -4
  239. package/react/hoc/mutation-hoc.d.ts.map +1 -1
  240. package/react/hoc/mutation-hoc.js.map +1 -1
  241. package/react/hoc/query-hoc.d.ts +2 -2
  242. package/react/hoc/query-hoc.d.ts.map +1 -1
  243. package/react/hoc/query-hoc.js.map +1 -1
  244. package/react/hoc/subscription-hoc.d.ts +2 -2
  245. package/react/hoc/subscription-hoc.d.ts.map +1 -1
  246. package/react/hoc/subscription-hoc.js.map +1 -1
  247. package/react/hoc/types.d.ts +4 -4
  248. package/react/hoc/types.d.ts.map +1 -1
  249. package/react/hoc/types.js.map +1 -1
  250. package/react/hoc/withApollo.d.ts +1 -1
  251. package/react/hoc/withApollo.d.ts.map +1 -1
  252. package/react/hoc/withApollo.js +1 -1
  253. package/react/hoc/withApollo.js.map +1 -1
  254. package/react/hooks/hooks.cjs +101 -32
  255. package/react/hooks/hooks.cjs.map +1 -1
  256. package/react/hooks/hooks.cjs.native.js +101 -32
  257. package/react/hooks/index.d.ts +2 -1
  258. package/react/hooks/index.d.ts.map +1 -1
  259. package/react/hooks/index.js +2 -1
  260. package/react/hooks/index.js.map +1 -1
  261. package/react/hooks/internal/useDeepMemo.d.ts +1 -1
  262. package/react/hooks/internal/useDeepMemo.d.ts.map +1 -1
  263. package/react/hooks/internal/useDeepMemo.js.map +1 -1
  264. package/react/hooks/useApolloClient.d.ts +1 -1
  265. package/react/hooks/useApolloClient.d.ts.map +1 -1
  266. package/react/hooks/useApolloClient.js +1 -1
  267. package/react/hooks/useApolloClient.js.map +1 -1
  268. package/react/hooks/useBackgroundQuery.d.ts +18 -0
  269. package/react/hooks/useBackgroundQuery.d.ts.map +1 -0
  270. package/react/hooks/useBackgroundQuery.js +71 -0
  271. package/react/hooks/useBackgroundQuery.js.map +1 -0
  272. package/react/hooks/useFragment.d.ts +12 -8
  273. package/react/hooks/useFragment.d.ts.map +1 -1
  274. package/react/hooks/useFragment.js +1 -1
  275. package/react/hooks/useFragment.js.map +1 -1
  276. package/react/hooks/useLazyQuery.d.ts +4 -4
  277. package/react/hooks/useLazyQuery.d.ts.map +1 -1
  278. package/react/hooks/useLazyQuery.js.map +1 -1
  279. package/react/hooks/useMutation.d.ts +4 -4
  280. package/react/hooks/useMutation.d.ts.map +1 -1
  281. package/react/hooks/useMutation.js +1 -1
  282. package/react/hooks/useMutation.js.map +1 -1
  283. package/react/hooks/useQuery.d.ts +3 -3
  284. package/react/hooks/useQuery.d.ts.map +1 -1
  285. package/react/hooks/useQuery.js +2 -2
  286. package/react/hooks/useQuery.js.map +1 -1
  287. package/react/hooks/useReactiveVar.d.ts +1 -1
  288. package/react/hooks/useReactiveVar.d.ts.map +1 -1
  289. package/react/hooks/useReactiveVar.js.map +1 -1
  290. package/react/hooks/useSubscription.d.ts +4 -4
  291. package/react/hooks/useSubscription.d.ts.map +1 -1
  292. package/react/hooks/useSubscription.js.map +1 -1
  293. package/react/hooks/useSuspenseCache.d.ts +1 -1
  294. package/react/hooks/useSuspenseCache.d.ts.map +1 -1
  295. package/react/hooks/useSuspenseCache.js +1 -1
  296. package/react/hooks/useSuspenseCache.js.map +1 -1
  297. package/react/hooks/useSuspenseQuery.d.ts +16 -6
  298. package/react/hooks/useSuspenseQuery.d.ts.map +1 -1
  299. package/react/hooks/useSuspenseQuery.js +32 -29
  300. package/react/hooks/useSuspenseQuery.js.map +1 -1
  301. package/react/parser/index.d.ts +1 -1
  302. package/react/parser/index.d.ts.map +1 -1
  303. package/react/parser/index.js +5 -5
  304. package/react/parser/index.js.map +1 -1
  305. package/react/parser/parser.cjs +5 -5
  306. package/react/parser/parser.cjs.map +1 -1
  307. package/react/parser/parser.cjs.native.js +5 -5
  308. package/react/react.cjs +40 -37
  309. package/react/react.cjs.map +1 -1
  310. package/react/react.cjs.native.js +40 -37
  311. package/react/ssr/RenderPromises.d.ts +2 -2
  312. package/react/ssr/RenderPromises.d.ts.map +1 -1
  313. package/react/ssr/RenderPromises.js.map +1 -1
  314. package/react/ssr/renderToStringWithData.d.ts +1 -1
  315. package/react/ssr/renderToStringWithData.d.ts.map +1 -1
  316. package/react/ssr/renderToStringWithData.js.map +1 -1
  317. package/react/types/types.d.ts +8 -8
  318. package/react/types/types.d.ts.map +1 -1
  319. package/react/types/types.js.map +1 -1
  320. package/testing/core/core.cjs +1 -1
  321. package/testing/core/core.cjs.map +1 -1
  322. package/testing/core/core.cjs.native.js +1 -1
  323. package/testing/core/mocking/mockClient.d.ts +2 -2
  324. package/testing/core/mocking/mockClient.d.ts.map +1 -1
  325. package/testing/core/mocking/mockClient.js.map +1 -1
  326. package/testing/core/mocking/mockLink.d.ts +2 -1
  327. package/testing/core/mocking/mockLink.d.ts.map +1 -1
  328. package/testing/core/mocking/mockLink.js +2 -2
  329. package/testing/core/mocking/mockLink.js.map +1 -1
  330. package/testing/core/mocking/mockQueryManager.d.ts +1 -1
  331. package/testing/core/mocking/mockQueryManager.d.ts.map +1 -1
  332. package/testing/core/mocking/mockQueryManager.js.map +1 -1
  333. package/testing/core/mocking/mockSubscriptionLink.d.ts +2 -1
  334. package/testing/core/mocking/mockSubscriptionLink.d.ts.map +1 -1
  335. package/testing/core/mocking/mockSubscriptionLink.js.map +1 -1
  336. package/testing/core/mocking/mockWatchQuery.d.ts +2 -2
  337. package/testing/core/mocking/mockWatchQuery.d.ts.map +1 -1
  338. package/testing/core/mocking/mockWatchQuery.js.map +1 -1
  339. package/testing/core/observableToPromise.d.ts +2 -2
  340. package/testing/core/observableToPromise.d.ts.map +1 -1
  341. package/testing/core/observableToPromise.js.map +1 -1
  342. package/testing/core/subscribeAndCount.d.ts +1 -1
  343. package/testing/core/subscribeAndCount.d.ts.map +1 -1
  344. package/testing/core/subscribeAndCount.js.map +1 -1
  345. package/testing/react/MockedProvider.d.ts +7 -6
  346. package/testing/react/MockedProvider.d.ts.map +1 -1
  347. package/testing/react/MockedProvider.js.map +1 -1
  348. package/utilities/common/compact.d.ts +1 -1
  349. package/utilities/common/compact.d.ts.map +1 -1
  350. package/utilities/common/compact.js.map +1 -1
  351. package/utilities/common/errorHandling.d.ts +1 -1
  352. package/utilities/common/errorHandling.d.ts.map +1 -1
  353. package/utilities/common/errorHandling.js.map +1 -1
  354. package/utilities/common/incrementalResult.d.ts +1 -1
  355. package/utilities/common/incrementalResult.d.ts.map +1 -1
  356. package/utilities/common/incrementalResult.js.map +1 -1
  357. package/utilities/common/omitDeep.d.ts +10 -2
  358. package/utilities/common/omitDeep.d.ts.map +1 -1
  359. package/utilities/common/omitDeep.js +22 -10
  360. package/utilities/common/omitDeep.js.map +1 -1
  361. package/utilities/common/responseIterator.d.ts +2 -2
  362. package/utilities/common/responseIterator.d.ts.map +1 -1
  363. package/utilities/common/responseIterator.js.map +1 -1
  364. package/utilities/common/stripTypename.d.ts +9 -1
  365. package/utilities/common/stripTypename.d.ts.map +1 -1
  366. package/utilities/common/stripTypename.js +3 -2
  367. package/utilities/common/stripTypename.js.map +1 -1
  368. package/utilities/globals/global.d.ts +6 -3
  369. package/utilities/globals/global.d.ts.map +1 -1
  370. package/utilities/globals/global.js.map +1 -1
  371. package/utilities/graphql/directives.d.ts +1 -1
  372. package/utilities/graphql/directives.d.ts.map +1 -1
  373. package/utilities/graphql/directives.js +4 -4
  374. package/utilities/graphql/directives.js.map +1 -1
  375. package/utilities/graphql/fragments.d.ts +1 -1
  376. package/utilities/graphql/fragments.d.ts.map +1 -1
  377. package/utilities/graphql/fragments.js +3 -3
  378. package/utilities/graphql/fragments.js.map +1 -1
  379. package/utilities/graphql/getFromAST.d.ts +1 -1
  380. package/utilities/graphql/getFromAST.d.ts.map +1 -1
  381. package/utilities/graphql/getFromAST.js +8 -8
  382. package/utilities/graphql/getFromAST.js.map +1 -1
  383. package/utilities/graphql/storeUtils.d.ts +2 -2
  384. package/utilities/graphql/storeUtils.d.ts.map +1 -1
  385. package/utilities/graphql/storeUtils.js +14 -4
  386. package/utilities/graphql/storeUtils.js.map +1 -1
  387. package/utilities/graphql/transform.d.ts +1 -1
  388. package/utilities/graphql/transform.d.ts.map +1 -1
  389. package/utilities/graphql/transform.js +2 -2
  390. package/utilities/graphql/transform.js.map +1 -1
  391. package/utilities/index.d.ts +1 -1
  392. package/utilities/index.d.ts.map +1 -1
  393. package/utilities/index.js.map +1 -1
  394. package/utilities/observables/Concast.d.ts +2 -1
  395. package/utilities/observables/Concast.d.ts.map +1 -1
  396. package/utilities/observables/Concast.js.map +1 -1
  397. package/utilities/observables/Observable.d.ts +2 -1
  398. package/utilities/observables/Observable.d.ts.map +1 -1
  399. package/utilities/observables/Observable.js +1 -1
  400. package/utilities/observables/Observable.js.map +1 -1
  401. package/utilities/observables/asyncMap.d.ts.map +1 -1
  402. package/utilities/observables/asyncMap.js.map +1 -1
  403. package/utilities/observables/iteration.d.ts +1 -1
  404. package/utilities/observables/iteration.d.ts.map +1 -1
  405. package/utilities/observables/iteration.js.map +1 -1
  406. package/utilities/policies/pagination.d.ts +1 -1
  407. package/utilities/policies/pagination.d.ts.map +1 -1
  408. package/utilities/policies/pagination.js.map +1 -1
  409. package/utilities/types/DeepOmit.d.ts +1 -1
  410. package/utilities/types/DeepOmit.d.ts.map +1 -1
  411. package/utilities/types/DeepOmit.js.map +1 -1
  412. package/utilities/types/DeepPartial.d.ts +1 -1
  413. package/utilities/types/DeepPartial.d.ts.map +1 -1
  414. package/utilities/types/DeepPartial.js.map +1 -1
  415. package/utilities/utilities.cjs +54 -31
  416. package/utilities/utilities.cjs.map +1 -1
  417. package/utilities/utilities.cjs.native.js +54 -31
  418. package/version.js +1 -1
  419. package/react/cache/QuerySubscription.d.ts.map +0 -1
  420. 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, 41);
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;
@@ -103,13 +103,13 @@ function getInclusionDirectives(directives) {
103
103
  return;
104
104
  var directiveArguments = directive.arguments;
105
105
  var directiveName = directive.name.value;
106
- __DEV__ ? tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @".concat(directiveName, " directive.")) : tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, 42);
106
+ __DEV__ ? tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @".concat(directiveName, " directive.")) : tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, 44);
107
107
  var ifArgument = directiveArguments[0];
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', 43);
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);
109
109
  var ifValue = ifArgument.value;
110
110
  __DEV__ ? tsInvariant.invariant(ifValue &&
111
111
  (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @".concat(directiveName, " directive must be a variable or a boolean value.")) : tsInvariant.invariant(ifValue &&
112
- (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 44);
112
+ (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 46);
113
113
  result.push({ directive: directive, ifArgument: ifArgument });
114
114
  });
115
115
  }
@@ -122,14 +122,14 @@ function getFragmentQueryDocument(document, fragmentName) {
122
122
  document.definitions.forEach(function (definition) {
123
123
  if (definition.kind === 'OperationDefinition') {
124
124
  throw __DEV__ ? new tsInvariant.InvariantError("Found a ".concat(definition.operation, " operation").concat(definition.name ? " named '".concat(definition.name.value, "'") : '', ". ") +
125
- 'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new tsInvariant.InvariantError(45);
125
+ 'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new tsInvariant.InvariantError(47);
126
126
  }
127
127
  if (definition.kind === 'FragmentDefinition') {
128
128
  fragments.push(definition);
129
129
  }
130
130
  });
131
131
  if (typeof actualFragmentName === 'undefined') {
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, 46);
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);
133
133
  actualFragmentName = fragments[0].name.value;
134
134
  }
135
135
  var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
@@ -170,7 +170,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
170
170
  return fragmentMap(fragmentName);
171
171
  }
172
172
  var fragment = fragmentMap && fragmentMap[fragmentName];
173
- __DEV__ ? tsInvariant.invariant(fragment, "No fragment named ".concat(fragmentName)) : tsInvariant.invariant(fragment, 47);
173
+ __DEV__ ? tsInvariant.invariant(fragment, "No fragment named ".concat(fragmentName)) : tsInvariant.invariant(fragment, 49);
174
174
  return fragment || null;
175
175
  }
176
176
  default:
@@ -181,12 +181,6 @@ function getFragmentFromSelection(selection, fragmentMap) {
181
181
  function isNonNullObject(obj) {
182
182
  return obj !== null && typeof obj === 'object';
183
183
  }
184
- function isPlainObject(obj) {
185
- return (obj !== null &&
186
- typeof obj === 'object' &&
187
- (Object.getPrototypeOf(obj) === Object.prototype ||
188
- Object.getPrototypeOf(obj) === null));
189
- }
190
184
 
191
185
  function makeReference(id) {
192
186
  return { __ref: String(id) };
@@ -260,7 +254,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
260
254
  else {
261
255
  throw __DEV__ ? new tsInvariant.InvariantError("The inline argument \"".concat(name.value, "\" of kind \"").concat(value.kind, "\"") +
262
256
  'is not supported. Use variables instead of inline arguments to ' +
263
- 'overcome this limitation.') : new tsInvariant.InvariantError(56);
257
+ 'overcome this limitation.') : new tsInvariant.InvariantError(58);
264
258
  }
265
259
  }
266
260
  function storeKeyNameFromField(field, variables) {
@@ -369,9 +363,7 @@ function resultKeyNameFromField(field) {
369
363
  return field.alias ? field.alias.value : field.name.value;
370
364
  }
371
365
  function getTypenameFromResult(result, selectionSet, fragmentMap) {
372
- if (typeof result.__typename === 'string') {
373
- return result.__typename;
374
- }
366
+ var fragments;
375
367
  for (var _i = 0, _a = selectionSet.selections; _i < _a.length; _i++) {
376
368
  var selection = _a[_i];
377
369
  if (isField(selection)) {
@@ -379,7 +371,19 @@ function getTypenameFromResult(result, selectionSet, fragmentMap) {
379
371
  return result[resultKeyNameFromField(selection)];
380
372
  }
381
373
  }
374
+ else if (fragments) {
375
+ fragments.push(selection);
376
+ }
382
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];
383
387
  var typename = getTypenameFromResult(result, getFragmentFromSelection(selection, fragmentMap).selectionSet, fragmentMap);
384
388
  if (typeof typename === 'string') {
385
389
  return typename;
@@ -395,16 +399,16 @@ function isInlineFragment(selection) {
395
399
  }
396
400
 
397
401
  function checkDocument(doc) {
398
- __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', 48);
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);
399
403
  var operations = doc.definitions
400
404
  .filter(function (d) { return d.kind !== 'FragmentDefinition'; })
401
405
  .map(function (definition) {
402
406
  if (definition.kind !== 'OperationDefinition') {
403
- throw __DEV__ ? new tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"".concat(definition.kind, "\"")) : new tsInvariant.InvariantError(49);
407
+ throw __DEV__ ? new tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"".concat(definition.kind, "\"")) : new tsInvariant.InvariantError(51);
404
408
  }
405
409
  return definition;
406
410
  });
407
- __DEV__ ? tsInvariant.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains ".concat(operations.length, " operations")) : tsInvariant.invariant(operations.length <= 1, 50);
411
+ __DEV__ ? tsInvariant.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains ".concat(operations.length, " operations")) : tsInvariant.invariant(operations.length <= 1, 52);
408
412
  return doc;
409
413
  }
410
414
  function getOperationDefinition(doc) {
@@ -427,14 +431,14 @@ function getFragmentDefinitions(doc) {
427
431
  }
428
432
  function getQueryDefinition(doc) {
429
433
  var queryDef = getOperationDefinition(doc);
430
- __DEV__ ? tsInvariant.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : tsInvariant.invariant(queryDef && queryDef.operation === 'query', 51);
434
+ __DEV__ ? tsInvariant.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : tsInvariant.invariant(queryDef && queryDef.operation === 'query', 53);
431
435
  return queryDef;
432
436
  }
433
437
  function getFragmentDefinition(doc) {
434
- __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', 52);
435
- __DEV__ ? tsInvariant.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : tsInvariant.invariant(doc.definitions.length <= 1, 53);
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);
436
440
  var fragmentDef = doc.definitions[0];
437
- __DEV__ ? tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 54);
441
+ __DEV__ ? tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 56);
438
442
  return fragmentDef;
439
443
  }
440
444
  function getMainDefinition(queryDoc) {
@@ -457,7 +461,7 @@ function getMainDefinition(queryDoc) {
457
461
  if (fragmentDefinition) {
458
462
  return fragmentDefinition;
459
463
  }
460
- throw __DEV__ ? new tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new tsInvariant.InvariantError(55);
464
+ throw __DEV__ ? new tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new tsInvariant.InvariantError(57);
461
465
  }
462
466
  function getDefaultValues(definition) {
463
467
  var defaultValues = Object.create(null);
@@ -1236,51 +1240,6 @@ function isNodeReadableStream(value) {
1236
1240
  return !!value.pipe;
1237
1241
  }
1238
1242
 
1239
- function omitDeep(value, key) {
1240
- return __omitDeep(value, key);
1241
- }
1242
- function __omitDeep(value, key, known) {
1243
- if (known === void 0) { known = new Map(); }
1244
- if (known.has(value)) {
1245
- return known.get(value);
1246
- }
1247
- var modified = false;
1248
- if (Array.isArray(value)) {
1249
- var array_1 = [];
1250
- known.set(value, array_1);
1251
- value.forEach(function (value, index) {
1252
- var result = __omitDeep(value, key, known);
1253
- modified || (modified = result !== value);
1254
- array_1[index] = result;
1255
- });
1256
- if (modified) {
1257
- return array_1;
1258
- }
1259
- }
1260
- else if (isPlainObject(value)) {
1261
- var obj_1 = Object.create(Object.getPrototypeOf(value));
1262
- known.set(value, obj_1);
1263
- Object.keys(value).forEach(function (k) {
1264
- if (k === key) {
1265
- modified = true;
1266
- }
1267
- else {
1268
- var result = __omitDeep(value[k], key, known);
1269
- modified || (modified = result !== value[k]);
1270
- obj_1[k] = result;
1271
- }
1272
- });
1273
- if (modified) {
1274
- return obj_1;
1275
- }
1276
- }
1277
- return value;
1278
- }
1279
-
1280
- function stripTypename(value) {
1281
- return omitDeep(value, '__typename');
1282
- }
1283
-
1284
1243
  function fromError(errorValue) {
1285
1244
  return new zenObservableTs.Observable(function (observer) {
1286
1245
  observer.error(errorValue);
@@ -1501,7 +1460,7 @@ var concat = ApolloLink.concat;
1501
1460
 
1502
1461
  var execute = ApolloLink.execute;
1503
1462
 
1504
- var version = '3.8.0-alpha.13';
1463
+ var version = '3.8.0-alpha.14';
1505
1464
 
1506
1465
  function asyncIterator(source) {
1507
1466
  var _a;
@@ -1903,7 +1862,7 @@ function selectHttpOptionsAndBodyInternal(operation, printer) {
1903
1862
  options.headers = removeDuplicateHeaders(options.headers, http.preserveHeaderCase);
1904
1863
  }
1905
1864
  var operationName = operation.operationName, extensions = operation.extensions, variables = operation.variables, query = operation.query;
1906
- var body = { operationName: operationName, variables: stripTypename(variables) };
1865
+ var body = { operationName: operationName, variables: variables };
1907
1866
  if (http.includeExtensions)
1908
1867
  body.extensions = extensions;
1909
1868
  if (http.includeQuery)
@@ -3381,7 +3340,7 @@ var Policies = (function () {
3381
3340
  var policy = typename && this.getTypePolicy(typename);
3382
3341
  var keyFn = policy && policy.keyFn || this.config.dataIdFromObject;
3383
3342
  while (keyFn) {
3384
- var specifierOrId = keyFn(object, context);
3343
+ var specifierOrId = keyFn(tslib.__assign(tslib.__assign({}, object), storeObject), context);
3385
3344
  if (isArray(specifierOrId)) {
3386
3345
  keyFn = keyFieldsFnFromSpecifier(specifierOrId);
3387
3346
  }
@@ -6735,18 +6694,23 @@ var contextKey = canUseSymbol
6735
6694
  ? Symbol.for('__APOLLO_CONTEXT__')
6736
6695
  : '__APOLLO_CONTEXT__';
6737
6696
  function getApolloContext() {
6738
- 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);
6739
6706
  if (!context) {
6740
- Object.defineProperty(React__namespace.createContext, contextKey, {
6741
- value: context = React__namespace.createContext({}),
6742
- enumerable: false,
6743
- writable: false,
6744
- configurable: true,
6745
- });
6707
+ context = React__namespace.createContext({});
6746
6708
  context.displayName = 'ApolloContext';
6709
+ contextStorage.set(React__namespace, context);
6747
6710
  }
6748
6711
  return context;
6749
6712
  }
6713
+ var resetApolloContext = getApolloContext;
6750
6714
 
6751
6715
  var ApolloConsumer = function (props) {
6752
6716
  var ApolloContext = getApolloContext();
@@ -6760,18 +6724,13 @@ var ApolloConsumer = function (props) {
6760
6724
  var ApolloProvider = function (_a) {
6761
6725
  var client = _a.client, suspenseCache = _a.suspenseCache, children = _a.children;
6762
6726
  var ApolloContext = getApolloContext();
6763
- return (React__namespace.createElement(ApolloContext.Consumer, null, function (context) {
6764
- if (context === void 0) { context = {}; }
6765
- if (client && context.client !== client) {
6766
- context = Object.assign({}, context, { client: client });
6767
- }
6768
- if (suspenseCache) {
6769
- context = Object.assign({}, context, { suspenseCache: suspenseCache });
6770
- }
6771
- __DEV__ ? tsInvariant.invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +
6772
- 'sure you pass in your client via the "client" prop.') : tsInvariant.invariant(context.client, 29);
6773
- return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
6774
- }));
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));
6775
6734
  };
6776
6735
 
6777
6736
  function useApolloClient(override) {
@@ -6779,7 +6738,7 @@ function useApolloClient(override) {
6779
6738
  var client = override || context.client;
6780
6739
  __DEV__ ? tsInvariant.invariant(!!client, 'Could not find "client" in the context or passed in as an option. ' +
6781
6740
  'Wrap the root component in an <ApolloProvider>, or pass an ApolloClient ' +
6782
- 'instance in via options.') : tsInvariant.invariant(!!client, 32);
6741
+ 'instance in via options.') : tsInvariant.invariant(!!client, 33);
6783
6742
  return client;
6784
6743
  }
6785
6744
 
@@ -6857,7 +6816,7 @@ function parser(document) {
6857
6816
  var variables, type, name;
6858
6817
  __DEV__ ? tsInvariant.invariant(!!document && !!document.kind, "Argument of ".concat(document, " passed to parser was not a valid GraphQL ") +
6859
6818
  "DocumentNode. You may need to use 'graphql-tag' or another method " +
6860
- "to convert your operation into a document") : tsInvariant.invariant(!!document && !!document.kind, 35);
6819
+ "to convert your operation into a document") : tsInvariant.invariant(!!document && !!document.kind, 37);
6861
6820
  var fragments = [];
6862
6821
  var queries = [];
6863
6822
  var mutations = [];
@@ -6885,11 +6844,11 @@ function parser(document) {
6885
6844
  __DEV__ ? tsInvariant.invariant(!fragments.length ||
6886
6845
  (queries.length || mutations.length || subscriptions.length), "Passing only a fragment to 'graphql' is not yet supported. " +
6887
6846
  "You must include a query, subscription or mutation as well") : tsInvariant.invariant(!fragments.length ||
6888
- (queries.length || mutations.length || subscriptions.length), 36);
6847
+ (queries.length || mutations.length || subscriptions.length), 38);
6889
6848
  __DEV__ ? tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1, "react-apollo only supports a query, subscription, or a mutation per HOC. " +
6890
6849
  "".concat(document, " had ").concat(queries.length, " queries, ").concat(subscriptions.length, " ") +
6891
6850
  "subscriptions and ".concat(mutations.length, " mutations. ") +
6892
- "You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1, 37);
6851
+ "You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1, 39);
6893
6852
  type = queries.length ? exports.DocumentType.Query : exports.DocumentType.Mutation;
6894
6853
  if (!queries.length && !mutations.length)
6895
6854
  type = exports.DocumentType.Subscription;
@@ -6900,7 +6859,7 @@ function parser(document) {
6900
6859
  : subscriptions;
6901
6860
  __DEV__ ? tsInvariant.invariant(definitions.length === 1, "react-apollo only supports one definition per HOC. ".concat(document, " had ") +
6902
6861
  "".concat(definitions.length, " definitions. ") +
6903
- "You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(definitions.length === 1, 38);
6862
+ "You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(definitions.length === 1, 40);
6904
6863
  var definition = definitions[0];
6905
6864
  variables = definition.variableDefinitions || [];
6906
6865
  if (definition.name && definition.name.kind === 'Name') {
@@ -6918,7 +6877,7 @@ function verifyDocumentType(document, type) {
6918
6877
  var requiredOperationName = operationName(type);
6919
6878
  var usedOperationName = operationName(operation.type);
6920
6879
  __DEV__ ? tsInvariant.invariant(operation.type === type, "Running a ".concat(requiredOperationName, " requires a graphql ") +
6921
- "".concat(requiredOperationName, ", but a ").concat(usedOperationName, " was used instead.")) : tsInvariant.invariant(operation.type === type, 39);
6880
+ "".concat(requiredOperationName, ", but a ").concat(usedOperationName, " was used instead.")) : tsInvariant.invariant(operation.type === type, 41);
6922
6881
  }
6923
6882
 
6924
6883
  var hasOwnProperty = Object.prototype.hasOwnProperty;
@@ -7528,7 +7487,7 @@ function useReactiveVar(rv) {
7528
7487
  function useFragment_experimental(options) {
7529
7488
  var cache = useApolloClient().cache;
7530
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"]);
7531
- 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 });
7532
7491
  var resultRef = React.useRef();
7533
7492
  var latestDiff = cache.diff(diffOptions);
7534
7493
  var getSnapshot = function () {
@@ -7596,7 +7555,7 @@ function useSuspenseCache(override) {
7596
7555
  var suspenseCache = override || context.suspenseCache;
7597
7556
  __DEV__ ? tsInvariant.invariant(suspenseCache, 'Could not find a "suspenseCache" in the context or passed in as an option. ' +
7598
7557
  'Wrap the root component in an <ApolloProvider> and provide a suspenseCache, ' +
7599
- 'or pass a SuspenseCache instance in via options.') : tsInvariant.invariant(suspenseCache, 33);
7558
+ 'or pass a SuspenseCache instance in via options.') : tsInvariant.invariant(suspenseCache, 35);
7600
7559
  return suspenseCache;
7601
7560
  }
7602
7561
 
@@ -7607,30 +7566,40 @@ function useSuspenseQuery_experimental(query, options) {
7607
7566
  var watchQueryOptions = useWatchQueryOptions({ query: query, options: options });
7608
7567
  var variables = watchQueryOptions.variables;
7609
7568
  var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a;
7610
- var _b = usePromiseVersion(), version = _b[0], setVersion = _b[1];
7611
7569
  var cacheKey = [client, query, canonicalStringify(variables)].concat(queryKey);
7612
- var subscription = suspenseCache.getSubscription(cacheKey, function () {
7570
+ var queryRef = suspenseCache.getQueryRef(cacheKey, function () {
7613
7571
  return client.watchQuery(watchQueryOptions);
7614
7572
  });
7615
- useTrackedSubscriptions(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);
7616
7580
  React.useEffect(function () {
7617
- return subscription.listen(function () {
7618
- setVersion('main');
7581
+ return queryRef.listen(function (promise) {
7582
+ setPromiseCache(function (promiseCache) {
7583
+ return new Map(promiseCache).set(queryRef.key, promise);
7584
+ });
7619
7585
  });
7620
- }, [subscription]);
7621
- var promise = subscription.promises[version] || subscription.promises.main;
7586
+ }, [queryRef]);
7622
7587
  var result = __use(promise);
7623
7588
  var fetchMore = React.useCallback(function (options) {
7624
- var promise = subscription.fetchMore(options);
7625
- setVersion('network');
7589
+ var promise = queryRef.fetchMore(options);
7590
+ setPromiseCache(function (previousPromiseCache) {
7591
+ return new Map(previousPromiseCache).set(queryRef.key, promise);
7592
+ });
7626
7593
  return promise;
7627
- }, [subscription]);
7594
+ }, [queryRef]);
7628
7595
  var refetch = React.useCallback(function (variables) {
7629
- var promise = subscription.refetch(variables);
7630
- setVersion('network');
7596
+ var promise = queryRef.refetch(variables);
7597
+ setPromiseCache(function (previousPromiseCache) {
7598
+ return new Map(previousPromiseCache).set(queryRef.key, promise);
7599
+ });
7631
7600
  return promise;
7632
- }, [subscription]);
7633
- var subscribeToMore = React.useCallback(function (options) { return subscription.observable.subscribeToMore(options); }, [subscription]);
7601
+ }, [queryRef]);
7602
+ var subscribeToMore = React.useCallback(function (options) { return queryRef.observable.subscribeToMore(options); }, [queryRef]);
7634
7603
  return React.useMemo(function () {
7635
7604
  return {
7636
7605
  client: client,
@@ -7657,7 +7626,7 @@ function validateFetchPolicy(fetchPolicy) {
7657
7626
  'no-cache',
7658
7627
  'cache-and-network',
7659
7628
  ];
7660
- __DEV__ ? tsInvariant.invariant(supportedFetchPolicies.includes(fetchPolicy), "The fetch policy `".concat(fetchPolicy, "` is not supported with suspense.")) : tsInvariant.invariant(supportedFetchPolicies.includes(fetchPolicy), 34);
7629
+ __DEV__ ? tsInvariant.invariant(supportedFetchPolicies.includes(fetchPolicy), "The fetch policy `".concat(fetchPolicy, "` is not supported with suspense.")) : tsInvariant.invariant(supportedFetchPolicies.includes(fetchPolicy), 36);
7661
7630
  }
7662
7631
  function validatePartialDataReturn(fetchPolicy, returnPartialData) {
7663
7632
  if (fetchPolicy === 'no-cache' && returnPartialData) {
@@ -7669,20 +7638,13 @@ function toApolloError(result) {
7669
7638
  ? new ApolloError({ graphQLErrors: result.errors })
7670
7639
  : result.error;
7671
7640
  }
7672
- function useTrackedSubscriptions(subscription) {
7673
- var trackedSubscriptions = React.useRef(new Set());
7674
- trackedSubscriptions.current.add(subscription);
7641
+ function useTrackedQueryRefs(queryRef) {
7642
+ var trackedQueryRefs = React.useRef(new Set());
7643
+ trackedQueryRefs.current.add(queryRef);
7675
7644
  useStrictModeSafeCleanupEffect(function () {
7676
- trackedSubscriptions.current.forEach(function (sub) { return sub.dispose(); });
7645
+ trackedQueryRefs.current.forEach(function (sub) { return sub.dispose(); });
7677
7646
  });
7678
7647
  }
7679
- function usePromiseVersion() {
7680
- var _a = React.useState({
7681
- version: 'main',
7682
- }), version = _a[0].version, setState = _a[1];
7683
- var setVersion = React.useCallback(function (version) { return setState({ version: version }); }, []);
7684
- return [version, setVersion];
7685
- }
7686
7648
  function useWatchQueryOptions(_a) {
7687
7649
  var query = _a.query, options = _a.options;
7688
7650
  var watchQueryOptions = useDeepMemo(function () { return (tslib.__assign(tslib.__assign({}, options), { query: query, notifyOnNetworkStatusChange: false, nextFetchPolicy: void 0 })); }, [options, query]);
@@ -7692,9 +7654,72 @@ function useWatchQueryOptions(_a) {
7692
7654
  return watchQueryOptions;
7693
7655
  }
7694
7656
 
7695
- var QuerySubscription = (function () {
7696
- function QuerySubscription(observable, options) {
7697
- if (options === void 0) { options = Object.create(null); }
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,
7691
+ },
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; });
7709
+ });
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]);
7719
+ }
7720
+
7721
+ var QueryReference = (function () {
7722
+ function QueryReference(observable, options) {
7698
7723
  var _this = this;
7699
7724
  var _a;
7700
7725
  this.listeners = new Set();
@@ -7706,13 +7731,14 @@ var QuerySubscription = (function () {
7706
7731
  this.dispose = this.dispose.bind(this);
7707
7732
  this.observable = observable;
7708
7733
  this.result = observable.getCurrentResult(false);
7734
+ this.key = options.key;
7709
7735
  if (options.onDispose) {
7710
7736
  this.onDispose = options.onDispose;
7711
7737
  }
7712
7738
  if (isNetworkRequestSettled(this.result.networkStatus) ||
7713
7739
  (this.result.data &&
7714
7740
  (!this.result.partial || this.observable.options.returnPartialData))) {
7715
- this.promises = { main: createFulfilledPromise(this.result) };
7741
+ this.promise = createFulfilledPromise(this.result);
7716
7742
  this.initialized = true;
7717
7743
  this.refetching = false;
7718
7744
  }
@@ -7720,17 +7746,15 @@ var QuerySubscription = (function () {
7720
7746
  next: this.handleNext,
7721
7747
  error: this.handleError,
7722
7748
  });
7723
- if (!this.promises) {
7724
- this.promises = {
7725
- main: new Promise(function (resolve, reject) {
7726
- _this.resolve = resolve;
7727
- _this.reject = reject;
7728
- }),
7729
- };
7749
+ if (!this.promise) {
7750
+ this.promise = new Promise(function (resolve, reject) {
7751
+ _this.resolve = resolve;
7752
+ _this.reject = reject;
7753
+ });
7730
7754
  }
7731
7755
  this.autoDisposeTimeoutId = setTimeout(this.dispose, (_a = options.autoDisposeTimeoutMs) !== null && _a !== void 0 ? _a : 30000);
7732
7756
  }
7733
- QuerySubscription.prototype.listen = function (listener) {
7757
+ QueryReference.prototype.listen = function (listener) {
7734
7758
  var _this = this;
7735
7759
  clearTimeout(this.autoDisposeTimeoutId);
7736
7760
  this.listeners.add(listener);
@@ -7738,26 +7762,33 @@ var QuerySubscription = (function () {
7738
7762
  _this.listeners.delete(listener);
7739
7763
  };
7740
7764
  };
7741
- QuerySubscription.prototype.refetch = function (variables) {
7765
+ QueryReference.prototype.refetch = function (variables) {
7742
7766
  this.refetching = true;
7743
7767
  var promise = this.observable.refetch(variables);
7744
- this.promises.network = promise;
7768
+ this.promise = promise;
7745
7769
  return promise;
7746
7770
  };
7747
- QuerySubscription.prototype.fetchMore = function (options) {
7771
+ QueryReference.prototype.fetchMore = function (options) {
7748
7772
  var promise = this.observable.fetchMore(options);
7749
- this.promises.network = promise;
7773
+ this.promise = promise;
7750
7774
  return promise;
7751
7775
  };
7752
- QuerySubscription.prototype.dispose = function () {
7776
+ QueryReference.prototype.dispose = function () {
7753
7777
  this.subscription.unsubscribe();
7754
7778
  this.onDispose();
7755
7779
  };
7756
- QuerySubscription.prototype.onDispose = function () {
7780
+ QueryReference.prototype.onDispose = function () {
7757
7781
  };
7758
- QuerySubscription.prototype.handleNext = function (result) {
7759
- if (!this.initialized) {
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
+ }
7760
7790
  this.initialized = true;
7791
+ this.refetching = false;
7761
7792
  this.result = result;
7762
7793
  this.resolve(result);
7763
7794
  return;
@@ -7765,14 +7796,11 @@ var QuerySubscription = (function () {
7765
7796
  if (result.data === this.result.data) {
7766
7797
  return;
7767
7798
  }
7768
- if (this.result.data && result.data === void 0) {
7769
- result.data = this.result.data;
7770
- }
7771
7799
  this.result = result;
7772
- this.promises.main = createFulfilledPromise(result);
7773
- this.deliver();
7800
+ this.promise = createFulfilledPromise(result);
7801
+ this.deliver(this.promise);
7774
7802
  };
7775
- QuerySubscription.prototype.handleError = function (error) {
7803
+ QueryReference.prototype.handleError = function (error) {
7776
7804
  var result = tslib.__assign(tslib.__assign({}, this.result), { error: error, networkStatus: exports.NetworkStatus.error });
7777
7805
  this.result = result;
7778
7806
  if (!this.initialized || this.refetching) {
@@ -7782,34 +7810,35 @@ var QuerySubscription = (function () {
7782
7810
  return;
7783
7811
  }
7784
7812
  this.result = result;
7785
- this.promises.main = result.data
7813
+ this.promise = result.data
7786
7814
  ? createFulfilledPromise(result)
7787
7815
  : createRejectedPromise(result);
7788
- this.deliver();
7816
+ this.deliver(this.promise);
7789
7817
  };
7790
- QuerySubscription.prototype.deliver = function () {
7791
- this.listeners.forEach(function (listener) { return listener(); });
7818
+ QueryReference.prototype.deliver = function (promise) {
7819
+ this.listeners.forEach(function (listener) { return listener(promise); });
7792
7820
  };
7793
- return QuerySubscription;
7821
+ return QueryReference;
7794
7822
  }());
7795
7823
 
7796
7824
  var SuspenseCache = (function () {
7797
7825
  function SuspenseCache(options) {
7798
7826
  if (options === void 0) { options = Object.create(null); }
7799
7827
  this.cacheKeys = new trie.Trie(canUseWeakMap, function (cacheKey) { return cacheKey; });
7800
- this.subscriptions = new Map();
7828
+ this.queryRefs = new Map();
7801
7829
  this.options = options;
7802
7830
  }
7803
- SuspenseCache.prototype.getSubscription = function (cacheKey, createObservable) {
7831
+ SuspenseCache.prototype.getQueryRef = function (cacheKey, createObservable) {
7804
7832
  var _this = this;
7805
7833
  var stableCacheKey = this.cacheKeys.lookupArray(cacheKey);
7806
- if (!this.subscriptions.has(stableCacheKey)) {
7807
- this.subscriptions.set(stableCacheKey, new QuerySubscription(createObservable(), {
7834
+ if (!this.queryRefs.has(stableCacheKey)) {
7835
+ this.queryRefs.set(stableCacheKey, new QueryReference(createObservable(), {
7836
+ key: stableCacheKey,
7808
7837
  autoDisposeTimeoutMs: this.options.autoDisposeTimeoutMs,
7809
- onDispose: function () { return _this.subscriptions.delete(stableCacheKey); },
7838
+ onDispose: function () { return _this.queryRefs.delete(stableCacheKey); },
7810
7839
  }));
7811
7840
  }
7812
- return this.subscriptions.get(stableCacheKey);
7841
+ return this.queryRefs.get(stableCacheKey);
7813
7842
  };
7814
7843
  return SuspenseCache;
7815
7844
  }());
@@ -7854,7 +7883,7 @@ exports.mergeOptions = mergeOptions;
7854
7883
  exports.operationName = operationName;
7855
7884
  exports.parseAndCheckHttpResponse = parseAndCheckHttpResponse;
7856
7885
  exports.parser = parser;
7857
- exports.resetApolloContext = getApolloContext;
7886
+ exports.resetApolloContext = resetApolloContext;
7858
7887
  exports.rewriteURIForGET = rewriteURIForGET;
7859
7888
  exports.selectHttpOptionsAndBody = selectHttpOptionsAndBody;
7860
7889
  exports.selectHttpOptionsAndBodyInternal = selectHttpOptionsAndBodyInternal;
@@ -7864,11 +7893,13 @@ exports.split = split;
7864
7893
  exports.throwServerError = throwServerError;
7865
7894
  exports.toPromise = toPromise;
7866
7895
  exports.useApolloClient = useApolloClient;
7896
+ exports.useBackgroundQuery_experimental = useBackgroundQuery_experimental;
7867
7897
  exports.useFragment_experimental = useFragment_experimental;
7868
7898
  exports.useLazyQuery = useLazyQuery;
7869
7899
  exports.useMutation = useMutation;
7870
7900
  exports.useQuery = useQuery;
7871
7901
  exports.useReactiveVar = useReactiveVar;
7902
+ exports.useReadQuery_experimental = useReadQuery_experimental;
7872
7903
  exports.useSubscription = useSubscription;
7873
7904
  exports.useSuspenseQuery_experimental = useSuspenseQuery_experimental;
7874
7905
  //# sourceMappingURL=apollo-client.cjs.map