@apollo/client 3.8.0-alpha.9 → 3.8.0-beta.0

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 (582) hide show
  1. package/apollo-client.cjs +1030 -673
  2. package/apollo-client.cjs.map +1 -1
  3. package/apollo-client.min.cjs +1 -1
  4. package/cache/cache.cjs +35 -31
  5. package/cache/cache.cjs.map +1 -1
  6. package/cache/cache.cjs.native.js +35 -31
  7. package/cache/core/cache.d.ts +5 -4
  8. package/cache/core/cache.d.ts.map +1 -1
  9. package/cache/core/cache.js +1 -0
  10. package/cache/core/cache.js.map +1 -1
  11. package/cache/core/types/Cache.d.ts +2 -2
  12. package/cache/core/types/Cache.d.ts.map +1 -1
  13. package/cache/core/types/Cache.js.map +1 -1
  14. package/cache/core/types/DataProxy.d.ts +4 -4
  15. package/cache/core/types/DataProxy.d.ts.map +1 -1
  16. package/cache/core/types/DataProxy.js.map +1 -1
  17. package/cache/core/types/common.d.ts +3 -3
  18. package/cache/core/types/common.d.ts.map +1 -1
  19. package/cache/core/types/common.js.map +1 -1
  20. package/cache/inmemory/entityStore.d.ts +5 -5
  21. package/cache/inmemory/entityStore.d.ts.map +1 -1
  22. package/cache/inmemory/entityStore.js +2 -2
  23. package/cache/inmemory/entityStore.js.map +1 -1
  24. package/cache/inmemory/fragmentRegistry.d.ts +1 -1
  25. package/cache/inmemory/fragmentRegistry.d.ts.map +1 -1
  26. package/cache/inmemory/fragmentRegistry.js.map +1 -1
  27. package/cache/inmemory/helpers.d.ts +6 -5
  28. package/cache/inmemory/helpers.d.ts.map +1 -1
  29. package/cache/inmemory/helpers.js.map +1 -1
  30. package/cache/inmemory/inMemoryCache.d.ts +9 -7
  31. package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
  32. package/cache/inmemory/inMemoryCache.js +14 -15
  33. package/cache/inmemory/inMemoryCache.js.map +1 -1
  34. package/cache/inmemory/key-extractor.d.ts +1 -1
  35. package/cache/inmemory/key-extractor.d.ts.map +1 -1
  36. package/cache/inmemory/key-extractor.js +2 -2
  37. package/cache/inmemory/key-extractor.js.map +1 -1
  38. package/cache/inmemory/policies.d.ts +7 -6
  39. package/cache/inmemory/policies.d.ts.map +1 -1
  40. package/cache/inmemory/policies.js +6 -6
  41. package/cache/inmemory/policies.js.map +1 -1
  42. package/cache/inmemory/reactiveVars.d.ts +1 -1
  43. package/cache/inmemory/reactiveVars.d.ts.map +1 -1
  44. package/cache/inmemory/reactiveVars.js.map +1 -1
  45. package/cache/inmemory/readFromStore.d.ts +6 -6
  46. package/cache/inmemory/readFromStore.d.ts.map +1 -1
  47. package/cache/inmemory/readFromStore.js +10 -5
  48. package/cache/inmemory/readFromStore.js.map +1 -1
  49. package/cache/inmemory/types.d.ts +6 -6
  50. package/cache/inmemory/types.d.ts.map +1 -1
  51. package/cache/inmemory/types.js.map +1 -1
  52. package/cache/inmemory/writeToStore.d.ts +6 -6
  53. package/cache/inmemory/writeToStore.d.ts.map +1 -1
  54. package/cache/inmemory/writeToStore.js +7 -8
  55. package/cache/inmemory/writeToStore.js.map +1 -1
  56. package/config/jest/setup.d.ts +1 -0
  57. package/config/jest/setup.d.ts.map +1 -1
  58. package/config/jest/setup.js +3 -0
  59. package/config/jest/setup.js.map +1 -1
  60. package/core/ApolloClient.d.ts +13 -10
  61. package/core/ApolloClient.d.ts.map +1 -1
  62. package/core/ApolloClient.js +18 -16
  63. package/core/ApolloClient.js.map +1 -1
  64. package/core/DocumentTransform.d.ts +24 -0
  65. package/core/DocumentTransform.d.ts.map +1 -0
  66. package/core/DocumentTransform.js +68 -0
  67. package/core/DocumentTransform.js.map +1 -0
  68. package/core/LocalState.d.ts +7 -9
  69. package/core/LocalState.d.ts.map +1 -1
  70. package/core/LocalState.js +6 -10
  71. package/core/LocalState.js.map +1 -1
  72. package/core/ObservableQuery.d.ts +11 -8
  73. package/core/ObservableQuery.d.ts.map +1 -1
  74. package/core/ObservableQuery.js +48 -28
  75. package/core/ObservableQuery.js.map +1 -1
  76. package/core/QueryInfo.d.ts +9 -9
  77. package/core/QueryInfo.d.ts.map +1 -1
  78. package/core/QueryInfo.js.map +1 -1
  79. package/core/QueryManager.d.ts +15 -11
  80. package/core/QueryManager.d.ts.map +1 -1
  81. package/core/QueryManager.js +115 -108
  82. package/core/QueryManager.js.map +1 -1
  83. package/core/core.cjs +332 -172
  84. package/core/core.cjs.map +1 -1
  85. package/core/core.cjs.native.js +332 -172
  86. package/core/equalByQuery.d.ts +4 -0
  87. package/core/equalByQuery.d.ts.map +1 -0
  88. package/{react/hooks/compareResults.js → core/equalByQuery.js} +14 -10
  89. package/core/equalByQuery.js.map +1 -0
  90. package/core/index.d.ts +2 -1
  91. package/core/index.d.ts.map +1 -1
  92. package/core/index.js +2 -1
  93. package/core/index.js.map +1 -1
  94. package/core/networkStatus.d.ts +1 -0
  95. package/core/networkStatus.d.ts.map +1 -1
  96. package/core/networkStatus.js +3 -0
  97. package/core/networkStatus.js.map +1 -1
  98. package/core/types.d.ts +14 -14
  99. package/core/types.d.ts.map +1 -1
  100. package/core/types.js.map +1 -1
  101. package/core/watchQueryOptions.d.ts +6 -7
  102. package/core/watchQueryOptions.d.ts.map +1 -1
  103. package/core/watchQueryOptions.js.map +1 -1
  104. package/dev/dev.cjs +642 -0
  105. package/dev/dev.cjs.map +1 -0
  106. package/dev/dev.cjs.native.js +642 -0
  107. package/dev/index.d.ts +4 -0
  108. package/dev/index.d.ts.map +1 -0
  109. package/dev/index.js +4 -0
  110. package/dev/index.js.map +1 -0
  111. package/dev/loadDevMessages.d.ts +2 -0
  112. package/dev/loadDevMessages.d.ts.map +1 -0
  113. package/dev/loadDevMessages.js +6 -0
  114. package/dev/loadDevMessages.js.map +1 -0
  115. package/dev/loadErrorMessageHandler.d.ts +3 -0
  116. package/dev/loadErrorMessageHandler.d.ts.map +1 -0
  117. package/dev/loadErrorMessageHandler.js +26 -0
  118. package/dev/loadErrorMessageHandler.js.map +1 -0
  119. package/dev/loadErrorMessages.d.ts +2 -0
  120. package/dev/loadErrorMessages.d.ts.map +1 -0
  121. package/dev/loadErrorMessages.js +6 -0
  122. package/dev/loadErrorMessages.js.map +1 -0
  123. package/dev/package.json +8 -0
  124. package/errors/errors.cjs +17 -17
  125. package/errors/errors.cjs.map +1 -1
  126. package/errors/errors.cjs.native.js +17 -17
  127. package/errors/index.d.ts +26 -10
  128. package/errors/index.d.ts.map +1 -1
  129. package/errors/index.js +17 -19
  130. package/errors/index.js.map +1 -1
  131. package/invariantErrorCodes.d.ts +13 -0
  132. package/invariantErrorCodes.d.ts.map +1 -0
  133. package/invariantErrorCodes.js +331 -144
  134. package/invariantErrorCodes.js.map +1 -0
  135. package/link/batch/batchLink.d.ts +4 -3
  136. package/link/batch/batchLink.d.ts.map +1 -1
  137. package/link/batch/batchLink.js.map +1 -1
  138. package/link/batch/batching.d.ts +1 -1
  139. package/link/batch/batching.d.ts.map +1 -1
  140. package/link/batch/batching.js.map +1 -1
  141. package/link/batch-http/batch-http.cjs +23 -2
  142. package/link/batch-http/batch-http.cjs.map +1 -1
  143. package/link/batch-http/batch-http.cjs.native.js +23 -2
  144. package/link/batch-http/batchHttpLink.d.ts +3 -2
  145. package/link/batch-http/batchHttpLink.d.ts.map +1 -1
  146. package/link/batch-http/batchHttpLink.js +7 -2
  147. package/link/batch-http/batchHttpLink.js.map +1 -1
  148. package/link/context/index.d.ts +3 -2
  149. package/link/context/index.d.ts.map +1 -1
  150. package/link/context/index.js.map +1 -1
  151. package/link/core/ApolloLink.d.ts +3 -2
  152. package/link/core/ApolloLink.d.ts.map +1 -1
  153. package/link/core/ApolloLink.js +3 -13
  154. package/link/core/ApolloLink.js.map +1 -1
  155. package/link/core/core.cjs +2 -12
  156. package/link/core/core.cjs.map +1 -1
  157. package/link/core/core.cjs.native.js +2 -12
  158. package/link/core/types.d.ts +8 -3
  159. package/link/core/types.d.ts.map +1 -1
  160. package/link/core/types.js.map +1 -1
  161. package/link/error/index.d.ts +4 -3
  162. package/link/error/index.d.ts.map +1 -1
  163. package/link/error/index.js.map +1 -1
  164. package/link/http/HttpLink.d.ts +3 -2
  165. package/link/http/HttpLink.d.ts.map +1 -1
  166. package/link/http/HttpLink.js.map +1 -1
  167. package/link/http/checkFetcher.js +2 -2
  168. package/link/http/checkFetcher.js.map +1 -1
  169. package/link/http/createHttpLink.d.ts +1 -1
  170. package/link/http/createHttpLink.d.ts.map +1 -1
  171. package/link/http/createHttpLink.js +21 -20
  172. package/link/http/createHttpLink.js.map +1 -1
  173. package/link/http/http.cjs +73 -43
  174. package/link/http/http.cjs.map +1 -1
  175. package/link/http/http.cjs.native.js +73 -43
  176. package/link/http/iterators/nodeStream.d.ts +1 -1
  177. package/link/http/iterators/nodeStream.d.ts.map +1 -1
  178. package/link/http/iterators/nodeStream.js.map +1 -1
  179. package/link/http/parseAndCheckHttpResponse.d.ts +2 -2
  180. package/link/http/parseAndCheckHttpResponse.d.ts.map +1 -1
  181. package/link/http/parseAndCheckHttpResponse.js +47 -26
  182. package/link/http/parseAndCheckHttpResponse.js.map +1 -1
  183. package/link/http/responseIterator.d.ts +1 -1
  184. package/link/http/responseIterator.d.ts.map +1 -1
  185. package/link/http/responseIterator.js.map +1 -1
  186. package/link/http/rewriteURIForGET.d.ts +1 -1
  187. package/link/http/rewriteURIForGET.d.ts.map +1 -1
  188. package/link/http/rewriteURIForGET.js.map +1 -1
  189. package/link/http/selectHttpOptionsAndBody.d.ts +3 -2
  190. package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -1
  191. package/link/http/selectHttpOptionsAndBody.js.map +1 -1
  192. package/link/http/selectURI.d.ts +1 -1
  193. package/link/http/selectURI.d.ts.map +1 -1
  194. package/link/http/selectURI.js.map +1 -1
  195. package/link/http/serializeFetchParameter.d.ts +1 -1
  196. package/link/http/serializeFetchParameter.d.ts.map +1 -1
  197. package/link/http/serializeFetchParameter.js +2 -2
  198. package/link/http/serializeFetchParameter.js.map +1 -1
  199. package/link/persisted-queries/index.d.ts +4 -3
  200. package/link/persisted-queries/index.d.ts.map +1 -1
  201. package/link/persisted-queries/index.js +16 -20
  202. package/link/persisted-queries/index.js.map +1 -1
  203. package/link/persisted-queries/persisted-queries.cjs +15 -19
  204. package/link/persisted-queries/persisted-queries.cjs.map +1 -1
  205. package/link/persisted-queries/persisted-queries.cjs.native.js +15 -19
  206. package/link/remove-typename/index.d.ts +2 -0
  207. package/link/remove-typename/index.d.ts.map +1 -0
  208. package/link/remove-typename/index.js +2 -0
  209. package/link/remove-typename/index.js.map +1 -0
  210. package/link/remove-typename/package.json +8 -0
  211. package/link/remove-typename/remove-typename.cjs +82 -0
  212. package/link/remove-typename/remove-typename.cjs.map +1 -0
  213. package/link/remove-typename/remove-typename.cjs.native.js +82 -0
  214. package/link/remove-typename/removeTypenameFromVariables.d.ts +11 -0
  215. package/link/remove-typename/removeTypenameFromVariables.d.ts.map +1 -0
  216. package/link/remove-typename/removeTypenameFromVariables.js +74 -0
  217. package/link/remove-typename/removeTypenameFromVariables.js.map +1 -0
  218. package/link/retry/delayFunction.d.ts +1 -1
  219. package/link/retry/delayFunction.d.ts.map +1 -1
  220. package/link/retry/delayFunction.js.map +1 -1
  221. package/link/retry/retryFunction.d.ts +1 -1
  222. package/link/retry/retryFunction.d.ts.map +1 -1
  223. package/link/retry/retryFunction.js.map +1 -1
  224. package/link/retry/retryLink.d.ts +4 -3
  225. package/link/retry/retryLink.d.ts.map +1 -1
  226. package/link/retry/retryLink.js.map +1 -1
  227. package/link/schema/index.d.ts +3 -2
  228. package/link/schema/index.d.ts.map +1 -1
  229. package/link/schema/index.js.map +1 -1
  230. package/link/subscriptions/index.d.ts +2 -1
  231. package/link/subscriptions/index.d.ts.map +1 -1
  232. package/link/subscriptions/index.js +8 -3
  233. package/link/subscriptions/index.js.map +1 -1
  234. package/link/subscriptions/subscriptions.cjs +8 -3
  235. package/link/subscriptions/subscriptions.cjs.map +1 -1
  236. package/link/subscriptions/subscriptions.cjs.native.js +8 -3
  237. package/link/utils/createOperation.d.ts +1 -1
  238. package/link/utils/createOperation.d.ts.map +1 -1
  239. package/link/utils/createOperation.js.map +1 -1
  240. package/link/utils/filterOperationVariables.d.ts +5 -0
  241. package/link/utils/filterOperationVariables.d.ts.map +1 -0
  242. package/link/utils/filterOperationVariables.js +18 -0
  243. package/link/utils/filterOperationVariables.js.map +1 -0
  244. package/link/utils/index.d.ts +1 -0
  245. package/link/utils/index.d.ts.map +1 -1
  246. package/link/utils/index.js +1 -0
  247. package/link/utils/index.js.map +1 -1
  248. package/link/utils/throwServerError.d.ts +1 -1
  249. package/link/utils/throwServerError.d.ts.map +1 -1
  250. package/link/utils/throwServerError.js.map +1 -1
  251. package/link/utils/toPromise.d.ts +1 -1
  252. package/link/utils/toPromise.d.ts.map +1 -1
  253. package/link/utils/toPromise.js +1 -1
  254. package/link/utils/toPromise.js.map +1 -1
  255. package/link/utils/transformOperation.d.ts +1 -1
  256. package/link/utils/transformOperation.d.ts.map +1 -1
  257. package/link/utils/transformOperation.js.map +1 -1
  258. package/link/utils/utils.cjs +20 -2
  259. package/link/utils/utils.cjs.map +1 -1
  260. package/link/utils/utils.cjs.native.js +20 -2
  261. package/link/utils/validateOperation.d.ts +1 -1
  262. package/link/utils/validateOperation.d.ts.map +1 -1
  263. package/link/utils/validateOperation.js +2 -2
  264. package/link/utils/validateOperation.js.map +1 -1
  265. package/link/ws/index.d.ts +5 -3
  266. package/link/ws/index.d.ts.map +1 -1
  267. package/link/ws/index.js.map +1 -1
  268. package/package.json +36 -32
  269. package/react/cache/QueryReference.d.ts +34 -0
  270. package/react/cache/QueryReference.d.ts.map +1 -0
  271. package/react/cache/QueryReference.js +107 -0
  272. package/react/cache/QueryReference.js.map +1 -0
  273. package/react/cache/SuspenseCache.d.ts +10 -13
  274. package/react/cache/SuspenseCache.d.ts.map +1 -1
  275. package/react/cache/SuspenseCache.js +18 -41
  276. package/react/cache/SuspenseCache.js.map +1 -1
  277. package/react/cache/types.d.ts +2 -0
  278. package/react/cache/types.d.ts.map +1 -0
  279. package/react/cache/types.js +2 -0
  280. package/react/cache/types.js.map +1 -0
  281. package/react/components/Mutation.d.ts +2 -2
  282. package/react/components/Mutation.d.ts.map +1 -1
  283. package/react/components/Mutation.js.map +1 -1
  284. package/react/components/Query.d.ts +2 -2
  285. package/react/components/Query.d.ts.map +1 -1
  286. package/react/components/Query.js.map +1 -1
  287. package/react/components/Subscription.d.ts +2 -2
  288. package/react/components/Subscription.d.ts.map +1 -1
  289. package/react/components/Subscription.js.map +1 -1
  290. package/react/components/types.d.ts +4 -4
  291. package/react/components/types.d.ts.map +1 -1
  292. package/react/components/types.js.map +1 -1
  293. package/react/context/ApolloConsumer.d.ts +1 -1
  294. package/react/context/ApolloConsumer.d.ts.map +1 -1
  295. package/react/context/ApolloConsumer.js +2 -3
  296. package/react/context/ApolloConsumer.js.map +1 -1
  297. package/react/context/ApolloContext.d.ts +10 -3
  298. package/react/context/ApolloContext.d.ts.map +1 -1
  299. package/react/context/ApolloContext.js +10 -8
  300. package/react/context/ApolloContext.js.map +1 -1
  301. package/react/context/ApolloProvider.d.ts +2 -2
  302. package/react/context/ApolloProvider.d.ts.map +1 -1
  303. package/react/context/ApolloProvider.js +8 -13
  304. package/react/context/ApolloProvider.js.map +1 -1
  305. package/react/context/context.cjs +18 -22
  306. package/react/context/context.cjs.map +1 -1
  307. package/react/context/context.cjs.native.js +18 -22
  308. package/react/context/index.d.ts +1 -1
  309. package/react/context/index.d.ts.map +1 -1
  310. package/react/context/index.js +1 -1
  311. package/react/context/index.js.map +1 -1
  312. package/react/hoc/graphql.d.ts +3 -3
  313. package/react/hoc/graphql.d.ts.map +1 -1
  314. package/react/hoc/graphql.js.map +1 -1
  315. package/react/hoc/hoc-utils.d.ts +2 -2
  316. package/react/hoc/hoc-utils.d.ts.map +1 -1
  317. package/react/hoc/hoc-utils.js +2 -3
  318. package/react/hoc/hoc-utils.js.map +1 -1
  319. package/react/hoc/hoc.cjs +2 -4
  320. package/react/hoc/hoc.cjs.map +1 -1
  321. package/react/hoc/hoc.cjs.native.js +2 -4
  322. package/react/hoc/mutation-hoc.d.ts +4 -4
  323. package/react/hoc/mutation-hoc.d.ts.map +1 -1
  324. package/react/hoc/mutation-hoc.js.map +1 -1
  325. package/react/hoc/query-hoc.d.ts +2 -2
  326. package/react/hoc/query-hoc.d.ts.map +1 -1
  327. package/react/hoc/query-hoc.js.map +1 -1
  328. package/react/hoc/subscription-hoc.d.ts +2 -2
  329. package/react/hoc/subscription-hoc.d.ts.map +1 -1
  330. package/react/hoc/subscription-hoc.js.map +1 -1
  331. package/react/hoc/types.d.ts +4 -4
  332. package/react/hoc/types.d.ts.map +1 -1
  333. package/react/hoc/types.js.map +1 -1
  334. package/react/hoc/withApollo.d.ts +1 -1
  335. package/react/hoc/withApollo.d.ts.map +1 -1
  336. package/react/hoc/withApollo.js +2 -3
  337. package/react/hoc/withApollo.js.map +1 -1
  338. package/react/hooks/hooks.cjs +223 -219
  339. package/react/hooks/hooks.cjs.map +1 -1
  340. package/react/hooks/hooks.cjs.native.js +223 -219
  341. package/react/hooks/index.d.ts +2 -1
  342. package/react/hooks/index.d.ts.map +1 -1
  343. package/react/hooks/index.js +2 -1
  344. package/react/hooks/index.js.map +1 -1
  345. package/react/hooks/internal/__use.d.ts +4 -0
  346. package/react/hooks/internal/__use.d.ts.map +1 -0
  347. package/react/hooks/internal/__use.js +17 -0
  348. package/react/hooks/internal/__use.js.map +1 -0
  349. package/react/hooks/internal/index.d.ts +2 -0
  350. package/react/hooks/internal/index.d.ts.map +1 -1
  351. package/react/hooks/internal/index.js +2 -0
  352. package/react/hooks/internal/index.js.map +1 -1
  353. package/react/hooks/internal/useDeepMemo.d.ts +1 -1
  354. package/react/hooks/internal/useDeepMemo.d.ts.map +1 -1
  355. package/react/hooks/internal/useDeepMemo.js.map +1 -1
  356. package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts.map +1 -1
  357. package/react/hooks/internal/useIsomorphicLayoutEffect.js +2 -2
  358. package/react/hooks/internal/useIsomorphicLayoutEffect.js.map +1 -1
  359. package/react/hooks/internal/useStrictModeSafeCleanupEffect.d.ts +2 -0
  360. package/react/hooks/internal/useStrictModeSafeCleanupEffect.d.ts.map +1 -0
  361. package/react/hooks/internal/useStrictModeSafeCleanupEffect.js +11 -0
  362. package/react/hooks/internal/useStrictModeSafeCleanupEffect.js.map +1 -0
  363. package/react/hooks/useApolloClient.d.ts +1 -1
  364. package/react/hooks/useApolloClient.d.ts.map +1 -1
  365. package/react/hooks/useApolloClient.js +2 -4
  366. package/react/hooks/useApolloClient.js.map +1 -1
  367. package/react/hooks/useBackgroundQuery.d.ts +18 -0
  368. package/react/hooks/useBackgroundQuery.d.ts.map +1 -0
  369. package/react/hooks/useBackgroundQuery.js +69 -0
  370. package/react/hooks/useBackgroundQuery.js.map +1 -0
  371. package/react/hooks/useFragment.d.ts +14 -9
  372. package/react/hooks/useFragment.d.ts.map +1 -1
  373. package/react/hooks/useFragment.js +2 -2
  374. package/react/hooks/useFragment.js.map +1 -1
  375. package/react/hooks/useLazyQuery.d.ts +4 -4
  376. package/react/hooks/useLazyQuery.d.ts.map +1 -1
  377. package/react/hooks/useLazyQuery.js +13 -22
  378. package/react/hooks/useLazyQuery.js.map +1 -1
  379. package/react/hooks/useMutation.d.ts +4 -4
  380. package/react/hooks/useMutation.d.ts.map +1 -1
  381. package/react/hooks/useMutation.js +1 -1
  382. package/react/hooks/useMutation.js.map +1 -1
  383. package/react/hooks/useQuery.d.ts +6 -6
  384. package/react/hooks/useQuery.d.ts.map +1 -1
  385. package/react/hooks/useQuery.js +29 -28
  386. package/react/hooks/useQuery.js.map +1 -1
  387. package/react/hooks/useReactiveVar.d.ts +1 -1
  388. package/react/hooks/useReactiveVar.d.ts.map +1 -1
  389. package/react/hooks/useReactiveVar.js.map +1 -1
  390. package/react/hooks/useSubscription.d.ts +4 -4
  391. package/react/hooks/useSubscription.d.ts.map +1 -1
  392. package/react/hooks/useSubscription.js +27 -19
  393. package/react/hooks/useSubscription.js.map +1 -1
  394. package/react/hooks/useSuspenseCache.d.ts +1 -1
  395. package/react/hooks/useSuspenseCache.d.ts.map +1 -1
  396. package/react/hooks/useSuspenseCache.js +2 -4
  397. package/react/hooks/useSuspenseCache.js.map +1 -1
  398. package/react/hooks/useSuspenseQuery.d.ts +39 -7
  399. package/react/hooks/useSuspenseQuery.d.ts.map +1 -1
  400. package/react/hooks/useSuspenseQuery.js +68 -149
  401. package/react/hooks/useSuspenseQuery.js.map +1 -1
  402. package/react/hooks/useSyncExternalStore.js +1 -1
  403. package/react/index.d.ts +1 -1
  404. package/react/index.d.ts.map +1 -1
  405. package/react/index.js +1 -1
  406. package/react/index.js.map +1 -1
  407. package/react/parser/index.d.ts +1 -1
  408. package/react/parser/index.d.ts.map +1 -1
  409. package/react/parser/index.js +20 -17
  410. package/react/parser/index.js.map +1 -1
  411. package/react/parser/parser.cjs +19 -16
  412. package/react/parser/parser.cjs.map +1 -1
  413. package/react/parser/parser.cjs.native.js +19 -16
  414. package/react/react.cjs +116 -35
  415. package/react/react.cjs.map +1 -1
  416. package/react/react.cjs.native.js +116 -35
  417. package/react/ssr/RenderPromises.d.ts +2 -2
  418. package/react/ssr/RenderPromises.d.ts.map +1 -1
  419. package/react/ssr/RenderPromises.js.map +1 -1
  420. package/react/ssr/renderToStringWithData.d.ts +1 -1
  421. package/react/ssr/renderToStringWithData.d.ts.map +1 -1
  422. package/react/ssr/renderToStringWithData.js.map +1 -1
  423. package/react/types/types.d.ts +10 -13
  424. package/react/types/types.d.ts.map +1 -1
  425. package/react/types/types.js.map +1 -1
  426. package/testing/core/core.cjs +1 -1
  427. package/testing/core/core.cjs.map +1 -1
  428. package/testing/core/core.cjs.native.js +1 -1
  429. package/testing/core/mocking/mockClient.d.ts +2 -2
  430. package/testing/core/mocking/mockClient.d.ts.map +1 -1
  431. package/testing/core/mocking/mockClient.js.map +1 -1
  432. package/testing/core/mocking/mockLink.d.ts +2 -1
  433. package/testing/core/mocking/mockLink.d.ts.map +1 -1
  434. package/testing/core/mocking/mockLink.js +3 -3
  435. package/testing/core/mocking/mockLink.js.map +1 -1
  436. package/testing/core/mocking/mockQueryManager.d.ts +1 -1
  437. package/testing/core/mocking/mockQueryManager.d.ts.map +1 -1
  438. package/testing/core/mocking/mockQueryManager.js.map +1 -1
  439. package/testing/core/mocking/mockSubscriptionLink.d.ts +3 -2
  440. package/testing/core/mocking/mockSubscriptionLink.d.ts.map +1 -1
  441. package/testing/core/mocking/mockSubscriptionLink.js.map +1 -1
  442. package/testing/core/mocking/mockWatchQuery.d.ts +2 -2
  443. package/testing/core/mocking/mockWatchQuery.d.ts.map +1 -1
  444. package/testing/core/mocking/mockWatchQuery.js.map +1 -1
  445. package/testing/core/observableToPromise.d.ts +2 -2
  446. package/testing/core/observableToPromise.d.ts.map +1 -1
  447. package/testing/core/observableToPromise.js.map +1 -1
  448. package/testing/core/subscribeAndCount.d.ts +1 -1
  449. package/testing/core/subscribeAndCount.d.ts.map +1 -1
  450. package/testing/core/subscribeAndCount.js.map +1 -1
  451. package/testing/matchers/index.d.ts +2 -0
  452. package/testing/matchers/index.d.ts.map +1 -0
  453. package/testing/matchers/index.js +6 -0
  454. package/testing/matchers/index.js.map +1 -0
  455. package/testing/matchers/toMatchDocument.d.ts +4 -0
  456. package/testing/matchers/toMatchDocument.d.ts.map +1 -0
  457. package/testing/matchers/toMatchDocument.js +34 -0
  458. package/testing/matchers/toMatchDocument.js.map +1 -0
  459. package/testing/react/MockedProvider.d.ts +8 -7
  460. package/testing/react/MockedProvider.d.ts.map +1 -1
  461. package/testing/react/MockedProvider.js +7 -6
  462. package/testing/react/MockedProvider.js.map +1 -1
  463. package/testing/testing.cjs +7 -51
  464. package/testing/testing.cjs.map +1 -1
  465. package/testing/testing.cjs.native.js +7 -51
  466. package/utilities/common/compact.d.ts +1 -1
  467. package/utilities/common/compact.d.ts.map +1 -1
  468. package/utilities/common/compact.js.map +1 -1
  469. package/utilities/common/errorHandling.d.ts +1 -1
  470. package/utilities/common/errorHandling.d.ts.map +1 -1
  471. package/utilities/common/errorHandling.js.map +1 -1
  472. package/utilities/common/incrementalResult.d.ts +2 -1
  473. package/utilities/common/incrementalResult.d.ts.map +1 -1
  474. package/utilities/common/incrementalResult.js +4 -0
  475. package/utilities/common/incrementalResult.js.map +1 -1
  476. package/utilities/common/mergeOptions.d.ts +1 -1
  477. package/utilities/common/mergeOptions.d.ts.map +1 -1
  478. package/utilities/common/mergeOptions.js +1 -1
  479. package/utilities/common/mergeOptions.js.map +1 -1
  480. package/utilities/common/objects.d.ts +1 -0
  481. package/utilities/common/objects.d.ts.map +1 -1
  482. package/utilities/common/objects.js +6 -0
  483. package/utilities/common/objects.js.map +1 -1
  484. package/utilities/common/omitDeep.d.ts +3 -0
  485. package/utilities/common/omitDeep.d.ts.map +1 -0
  486. package/utilities/common/omitDeep.js +41 -0
  487. package/utilities/common/omitDeep.js.map +1 -0
  488. package/utilities/common/responseIterator.d.ts +2 -2
  489. package/utilities/common/responseIterator.d.ts.map +1 -1
  490. package/utilities/common/responseIterator.js.map +1 -1
  491. package/utilities/common/stringifyForDisplay.d.ts +1 -1
  492. package/utilities/common/stringifyForDisplay.d.ts.map +1 -1
  493. package/utilities/common/stringifyForDisplay.js +3 -2
  494. package/utilities/common/stringifyForDisplay.js.map +1 -1
  495. package/utilities/common/stripTypename.d.ts +2 -0
  496. package/utilities/common/stripTypename.d.ts.map +1 -0
  497. package/utilities/common/stripTypename.js +5 -0
  498. package/utilities/common/stripTypename.js.map +1 -0
  499. package/utilities/globals/global.d.ts +6 -3
  500. package/utilities/globals/global.d.ts.map +1 -1
  501. package/utilities/globals/global.js.map +1 -1
  502. package/utilities/globals/globals.cjs +67 -1
  503. package/utilities/globals/globals.cjs.map +1 -1
  504. package/utilities/globals/globals.cjs.native.js +67 -1
  505. package/utilities/globals/index.d.ts +2 -2
  506. package/utilities/globals/index.d.ts.map +1 -1
  507. package/utilities/globals/index.js +2 -2
  508. package/utilities/globals/index.js.map +1 -1
  509. package/utilities/globals/invariantWrappers.d.ts +24 -0
  510. package/utilities/globals/invariantWrappers.d.ts.map +1 -0
  511. package/utilities/globals/invariantWrappers.js +53 -0
  512. package/utilities/globals/invariantWrappers.js.map +1 -0
  513. package/utilities/graphql/directives.d.ts +1 -1
  514. package/utilities/graphql/directives.d.ts.map +1 -1
  515. package/utilities/graphql/directives.js +6 -7
  516. package/utilities/graphql/directives.js.map +1 -1
  517. package/utilities/graphql/fragments.d.ts +1 -1
  518. package/utilities/graphql/fragments.d.ts.map +1 -1
  519. package/utilities/graphql/fragments.js +8 -5
  520. package/utilities/graphql/fragments.js.map +1 -1
  521. package/utilities/graphql/getFromAST.d.ts +1 -1
  522. package/utilities/graphql/getFromAST.d.ts.map +1 -1
  523. package/utilities/graphql/getFromAST.js +9 -9
  524. package/utilities/graphql/getFromAST.js.map +1 -1
  525. package/utilities/graphql/operations.d.ts +5 -0
  526. package/utilities/graphql/operations.d.ts.map +1 -0
  527. package/utilities/graphql/operations.js +16 -0
  528. package/utilities/graphql/operations.js.map +1 -0
  529. package/utilities/graphql/storeUtils.d.ts +2 -2
  530. package/utilities/graphql/storeUtils.d.ts.map +1 -1
  531. package/utilities/graphql/storeUtils.js +16 -7
  532. package/utilities/graphql/storeUtils.js.map +1 -1
  533. package/utilities/graphql/transform.d.ts +1 -1
  534. package/utilities/graphql/transform.d.ts.map +1 -1
  535. package/utilities/graphql/transform.js +30 -21
  536. package/utilities/graphql/transform.js.map +1 -1
  537. package/utilities/index.d.ts +6 -0
  538. package/utilities/index.d.ts.map +1 -1
  539. package/utilities/index.js +4 -0
  540. package/utilities/index.js.map +1 -1
  541. package/utilities/observables/Concast.d.ts +2 -1
  542. package/utilities/observables/Concast.d.ts.map +1 -1
  543. package/utilities/observables/Concast.js.map +1 -1
  544. package/utilities/observables/Observable.d.ts +2 -1
  545. package/utilities/observables/Observable.d.ts.map +1 -1
  546. package/utilities/observables/Observable.js +1 -1
  547. package/utilities/observables/Observable.js.map +1 -1
  548. package/utilities/observables/asyncMap.d.ts.map +1 -1
  549. package/utilities/observables/asyncMap.js.map +1 -1
  550. package/utilities/observables/iteration.d.ts +1 -1
  551. package/utilities/observables/iteration.d.ts.map +1 -1
  552. package/utilities/observables/iteration.js.map +1 -1
  553. package/utilities/policies/pagination.d.ts +1 -1
  554. package/utilities/policies/pagination.d.ts.map +1 -1
  555. package/utilities/policies/pagination.js.map +1 -1
  556. package/utilities/promises/decoration.d.ts +17 -0
  557. package/utilities/promises/decoration.d.ts.map +1 -0
  558. package/utilities/promises/decoration.js +37 -0
  559. package/utilities/promises/decoration.js.map +1 -0
  560. package/utilities/types/DeepOmit.d.ts +10 -0
  561. package/utilities/types/DeepOmit.d.ts.map +1 -0
  562. package/utilities/types/DeepOmit.js +2 -0
  563. package/utilities/types/DeepOmit.js.map +1 -0
  564. package/utilities/types/DeepPartial.d.ts +12 -0
  565. package/utilities/types/DeepPartial.d.ts.map +1 -0
  566. package/utilities/types/DeepPartial.js +2 -0
  567. package/utilities/types/DeepPartial.js.map +1 -0
  568. package/utilities/types/Primitive.d.ts +2 -0
  569. package/utilities/types/Primitive.d.ts.map +1 -0
  570. package/utilities/types/Primitive.js +2 -0
  571. package/utilities/types/Primitive.js.map +1 -0
  572. package/utilities/utilities.cjs +181 -45
  573. package/utilities/utilities.cjs.map +1 -1
  574. package/utilities/utilities.cjs.native.js +181 -45
  575. package/version.js +1 -1
  576. package/cache/inmemory/__mocks__/optimism.d.ts +0 -2
  577. package/cache/inmemory/__mocks__/optimism.d.ts.map +0 -1
  578. package/cache/inmemory/__mocks__/optimism.js +0 -14
  579. package/cache/inmemory/__mocks__/optimism.js.map +0 -1
  580. package/react/hooks/compareResults.d.ts +0 -3
  581. package/react/hooks/compareResults.d.ts.map +0 -1
  582. package/react/hooks/compareResults.js.map +0 -1
@@ -2,21 +2,21 @@ import { __assign, __extends } from "tslib";
2
2
  import { invariant, __DEV__ } from "../utilities/globals/index.js";
3
3
  import { equal } from '@wry/equality';
4
4
  import { NetworkStatus, isNetworkRequestInFlight } from "./networkStatus.js";
5
- import { cloneDeep, compact, getOperationDefinition, Observable, iterateObserversSafely, isNonEmptyArray, fixObservableSubclass, getQueryDefinition, } from "../utilities/index.js";
5
+ import { cloneDeep, compact, getOperationDefinition, Observable, iterateObserversSafely, fixObservableSubclass, getQueryDefinition, } from "../utilities/index.js";
6
+ import { equalByQuery } from "./equalByQuery.js";
6
7
  var assign = Object.assign, hasOwnProperty = Object.hasOwnProperty;
7
8
  var ObservableQuery = (function (_super) {
8
9
  __extends(ObservableQuery, _super);
9
10
  function ObservableQuery(_a) {
10
11
  var queryManager = _a.queryManager, queryInfo = _a.queryInfo, options = _a.options;
11
12
  var _this = _super.call(this, function (observer) {
12
- var _a = options.fetchOnFirstSubscribe, fetchOnFirstSubscribe = _a === void 0 ? true : _a;
13
13
  try {
14
14
  var subObserver = observer._subscription._observer;
15
15
  if (subObserver && !subObserver.error) {
16
16
  subObserver.error = defaultSubscriptionObserverErrorCallback;
17
17
  }
18
18
  }
19
- catch (_b) { }
19
+ catch (_a) { }
20
20
  var first = !_this.observers.size;
21
21
  _this.observers.add(observer);
22
22
  var last = _this.last;
@@ -26,7 +26,7 @@ var ObservableQuery = (function (_super) {
26
26
  else if (last && last.result) {
27
27
  observer.next && observer.next(last.result);
28
28
  }
29
- if (first && fetchOnFirstSubscribe) {
29
+ if (first) {
30
30
  _this.reobserve().catch(function () { });
31
31
  }
32
32
  return function () {
@@ -50,7 +50,7 @@ var ObservableQuery = (function (_super) {
50
50
  }
51
51
  Object.defineProperty(ObservableQuery.prototype, "query", {
52
52
  get: function () {
53
- return this.queryManager.transform(this.options.query).document;
53
+ return this.lastQuery || this.options.query;
54
54
  },
55
55
  enumerable: false,
56
56
  configurable: true
@@ -92,7 +92,7 @@ var ObservableQuery = (function (_super) {
92
92
  if (fetchPolicy === 'network-only' ||
93
93
  fetchPolicy === 'no-cache' ||
94
94
  fetchPolicy === 'standby' ||
95
- this.queryManager.transform(this.options.query).hasForcedResolvers) {
95
+ this.queryManager.getDocumentInfo(this.query).hasForcedResolvers) {
96
96
  }
97
97
  else {
98
98
  var diff = this.queryInfo.getDiff();
@@ -130,8 +130,13 @@ var ObservableQuery = (function (_super) {
130
130
  return result;
131
131
  };
132
132
  ObservableQuery.prototype.isDifferentFromLastResult = function (newResult, variables) {
133
- return (!this.last ||
134
- !equal(this.last.result, newResult) ||
133
+ if (!this.last) {
134
+ return true;
135
+ }
136
+ var resultIsDifferent = this.queryManager.getDocumentInfo(this.query).hasNonreactiveDirective
137
+ ? !equalByQuery(this.query, this.last.result, newResult, this.variables)
138
+ : !equal(this.last.result, newResult);
139
+ return (resultIsDifferent ||
135
140
  (variables && !equal(this.last.variables, variables)));
136
141
  };
137
142
  ObservableQuery.prototype.getLast = function (key, variablesMustMatch) {
@@ -174,7 +179,11 @@ var ObservableQuery = (function (_super) {
174
179
  var queryDef = getQueryDefinition(this.query);
175
180
  var vars = queryDef.variableDefinitions;
176
181
  if (!vars || !vars.some(function (v) { return v.variable.name.value === "variables"; })) {
177
- __DEV__ && invariant.warn("Called refetch(".concat(JSON.stringify(variables), ") for query ").concat(((_a = queryDef.name) === null || _a === void 0 ? void 0 : _a.value) || JSON.stringify(queryDef), ", which does not declare a $variables variable.\nDid you mean to call refetch(variables) instead of refetch({ variables })?"));
182
+ __DEV__ && invariant.warn(
183
+ 20,
184
+ variables,
185
+ ((_a = queryDef.name) === null || _a === void 0 ? void 0 : _a.value) || queryDef
186
+ );
178
187
  }
179
188
  }
180
189
  if (variables && !equal(this.options.variables, variables)) {
@@ -185,8 +194,12 @@ var ObservableQuery = (function (_super) {
185
194
  };
186
195
  ObservableQuery.prototype.fetchMore = function (fetchMoreOptions) {
187
196
  var _this = this;
188
- var combinedOptions = __assign(__assign({}, (fetchMoreOptions.query ? fetchMoreOptions : __assign(__assign(__assign(__assign({}, this.options), { query: this.query }), fetchMoreOptions), { variables: __assign(__assign({}, this.options.variables), fetchMoreOptions.variables) }))), { fetchPolicy: "no-cache" });
197
+ var combinedOptions = __assign(__assign({}, (fetchMoreOptions.query ? fetchMoreOptions : __assign(__assign(__assign(__assign({}, this.options), { query: this.options.query }), fetchMoreOptions), { variables: __assign(__assign({}, this.options.variables), fetchMoreOptions.variables) }))), { fetchPolicy: "no-cache" });
198
+ combinedOptions.query = this.transformDocument(combinedOptions.query);
189
199
  var qid = this.queryManager.generateQueryId();
200
+ this.lastQuery = fetchMoreOptions.query
201
+ ? this.transformDocument(this.options.query)
202
+ : combinedOptions.query;
190
203
  var queryInfo = this.queryInfo;
191
204
  var originalNetworkStatus = queryInfo.networkStatus;
192
205
  queryInfo.networkStatus = NetworkStatus.fetchMore;
@@ -258,7 +271,7 @@ var ObservableQuery = (function (_super) {
258
271
  options.onError(err);
259
272
  return;
260
273
  }
261
- __DEV__ && invariant.error('Unhandled GraphQL subscription error', err);
274
+ __DEV__ && invariant.error(21, err);
262
275
  },
263
276
  });
264
277
  this.subscriptions.add(subscription);
@@ -338,7 +351,7 @@ var ObservableQuery = (function (_super) {
338
351
  };
339
352
  ObservableQuery.prototype.fetch = function (options, newNetworkStatus) {
340
353
  this.queryManager.setObservableQuery(this);
341
- return this.queryManager.fetchQueryObservable(this.queryId, options, newNetworkStatus);
354
+ return this.queryManager['fetchConcastWithInfo'](this.queryId, options, newNetworkStatus);
342
355
  };
343
356
  ObservableQuery.prototype.updatePolling = function () {
344
357
  var _this = this;
@@ -357,7 +370,7 @@ var ObservableQuery = (function (_super) {
357
370
  pollingInfo.interval === pollInterval) {
358
371
  return;
359
372
  }
360
- __DEV__ ? invariant(pollInterval, 'Attempted to start a polling query without a polling interval.') : invariant(pollInterval, 13);
373
+ invariant(pollInterval, 22);
361
374
  var info = pollingInfo || (this.pollingInfo = {});
362
375
  info.interval = pollInterval;
363
376
  var maybeFetch = function () {
@@ -384,13 +397,13 @@ var ObservableQuery = (function (_super) {
384
397
  };
385
398
  ObservableQuery.prototype.updateLastResult = function (newResult, variables) {
386
399
  if (variables === void 0) { variables = this.variables; }
387
- this.last = __assign(__assign({}, this.last), { result: this.queryManager.assumeImmutableResults
388
- ? newResult
389
- : cloneDeep(newResult), variables: variables });
390
- if (!isNonEmptyArray(newResult.errors)) {
391
- delete this.last.error;
400
+ var error = this.getLastError();
401
+ if (error && this.last && !equal(variables, this.last.variables)) {
402
+ error = void 0;
392
403
  }
393
- return this.last;
404
+ return this.last = __assign({ result: this.queryManager.assumeImmutableResults
405
+ ? newResult
406
+ : cloneDeep(newResult), variables: variables }, (error ? { error: error } : null));
394
407
  };
395
408
  ObservableQuery.prototype.reobserveAsConcast = function (newOptions, newNetworkStatus) {
396
409
  var _this = this;
@@ -404,6 +417,8 @@ var ObservableQuery = (function (_super) {
404
417
  var options = useDisposableConcast
405
418
  ? mergedOptions
406
419
  : assign(this.options, mergedOptions);
420
+ var query = this.transformDocument(options.query);
421
+ this.lastQuery = query;
407
422
  if (!useDisposableConcast) {
408
423
  this.updatePolling();
409
424
  if (newOptions &&
@@ -417,8 +432,9 @@ var ObservableQuery = (function (_super) {
417
432
  }
418
433
  }
419
434
  }
435
+ var fetchOptions = query === options.query ? options : __assign(__assign({}, options), { query: query });
420
436
  var variables = options.variables && __assign({}, options.variables);
421
- var concast = this.fetch(options, newNetworkStatus);
437
+ var _a = this.fetch(fetchOptions, newNetworkStatus), concast = _a.concast, fromLink = _a.fromLink;
422
438
  var observer = {
423
439
  next: function (result) {
424
440
  _this.reportResult(result, variables);
@@ -427,7 +443,7 @@ var ObservableQuery = (function (_super) {
427
443
  _this.reportError(error, variables);
428
444
  },
429
445
  };
430
- if (!useDisposableConcast) {
446
+ if (!useDisposableConcast && (fromLink || !this.concast)) {
431
447
  if (this.concast && this.observer) {
432
448
  this.concast.removeObserver(this.observer);
433
449
  }
@@ -445,11 +461,12 @@ var ObservableQuery = (function (_super) {
445
461
  };
446
462
  ObservableQuery.prototype.reportResult = function (result, variables) {
447
463
  var lastError = this.getLastError();
448
- if (lastError || this.isDifferentFromLastResult(result, variables)) {
449
- if (lastError || !result.partial || this.options.returnPartialData) {
450
- this.updateLastResult(result, variables);
451
- }
452
- iterateObserversSafely(this.observers, 'next', result);
464
+ var isDifferent = this.isDifferentFromLastResult(result, variables);
465
+ if (lastError || !result.partial || this.options.returnPartialData) {
466
+ this.updateLastResult(result, variables);
467
+ }
468
+ if (lastError || isDifferent) {
469
+ iterateObserversSafely(this.observers, "next", result);
453
470
  }
454
471
  };
455
472
  ObservableQuery.prototype.reportError = function (error, variables) {
@@ -475,6 +492,9 @@ var ObservableQuery = (function (_super) {
475
492
  this.observers.clear();
476
493
  this.isTornDown = true;
477
494
  };
495
+ ObservableQuery.prototype.transformDocument = function (document) {
496
+ return this.queryManager.transform(document);
497
+ };
478
498
  return ObservableQuery;
479
499
  }(Observable));
480
500
  export { ObservableQuery };
@@ -497,11 +517,11 @@ export function reobserveCacheFirst(obsQuery) {
497
517
  return obsQuery.reobserve();
498
518
  }
499
519
  function defaultSubscriptionObserverErrorCallback(error) {
500
- __DEV__ && invariant.error('Unhandled error', error.message, error.stack);
520
+ __DEV__ && invariant.error(23, error.message, error.stack);
501
521
  }
502
522
  export function logMissingFieldErrors(missing) {
503
523
  if (__DEV__ && missing) {
504
- __DEV__ && invariant.debug("Missing cache result fields: ".concat(JSON.stringify(missing)), missing);
524
+ __DEV__ && invariant.debug(24, missing);
505
525
  }
506
526
  }
507
527
  //# sourceMappingURL=ObservableQuery.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ObservableQuery.js","sourceRoot":"","sources":["../../src/core/ObservableQuery.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,OAAO,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAEL,SAAS,EACT,OAAO,EACP,sBAAsB,EACtB,UAAU,EAGV,sBAAsB,EACtB,eAAe,EACf,qBAAqB,EACrB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AW,EAAE,aAAa;YAG1B,eAAe;gBAGb,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;gBAGvC,IAAI,OAAO,eAAe,KAAK,UAAU,EAAE;oBACzC,OAAO,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;iBAC/C;gBAED,OAAO,WAAY,CAAC;YACtB,CAAC;SACF,CAAC,CAAC;KACJ;IAED,OAAO,QAAQ,CAAC,SAAS,EAAE,CAAC;AAC9B,CAAC;AAED,SAAS,wCAAwC,CAAC,KAAkB;IAClE,SAAS,CAAC,KAAK,CAAC,iBAAiB,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,OAAsD;IAEtD,IAAI,OAAO,IAAI,OAAO,EAAE;QACtB,SAAS,CAAC,KAAK,CAAC,uCACd,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CACvB,EAAE,OAAO,CAAC,CAAC;KACd;AACH,CAAC","sourcesContent":["import { invariant, __DEV__ } from '../utilities/globals';\nimport { DocumentNode } from 'graphql';\nimport { equal } from '@wry/equality';\n\nimport { NetworkStatus, isNetworkRequestInFlight } from './networkStatus';\nimport {\n Concast,\n cloneDeep,\n compact,\n getOperationDefinition,\n Observable,\n Observer,\n ObservableSubscription,\n iterateObserversSafely,\n isNonEmptyArray,\n fixObservableSubclass,\n getQueryDefinition,\n} from '../utilities';\nimport { ApolloError } from '../errors';\nimport { QueryManager } from './QueryManager';\nimport {\n ApolloQueryResult,\n OperationVariables,\n TypedDocumentNode,\n} from './types';\nimport {\n WatchQueryOptions,\n FetchMoreQueryOptions,\n SubscribeToMoreOptions,\n NextFetchPolicyContext,\n} from './watchQueryOptions';\nimport { QueryInfo } from './QueryInfo';\nimport { MissingFieldError } from '../cache';\nimport { MissingTree } from '../cache/core/types/common';\n\nconst {\n assign,\n hasOwnProperty,\n} = Object;\n\nexport interface FetchMoreOptions<\n TData = any,\n TVariables = OperationVariables\n> {\n updateQuery?: (\n previousQueryResult: TData,\n options: {\n fetchMoreResult?: TData;\n variables?: TVariables;\n },\n ) => TData;\n}\n\nexport interface UpdateQueryOptions<TVariables> {\n variables?: TVariables;\n}\n\ninterface Last<TData, TVariables> {\n result: ApolloQueryResult<TData>;\n variables?: TVariables;\n error?: ApolloError;\n}\n\nexport class ObservableQuery<\n TData = any,\n TVariables extends OperationVariables = OperationVariables\n> extends Observable<ApolloQueryResult<TData>> {\n public readonly options: WatchQueryOptions<TVariables, TData>;\n public readonly queryId: string;\n public readonly queryName?: string;\n\n public get query(): TypedDocumentNode<TData, TVariables> {\n // This transform is heavily cached, so it should not be expensive to\n // transform the same this.options.query document repeatedly.\n return this.queryManager.transform(this.options.query).document;\n }\n\n // Computed shorthand for this.options.variables, preserved for\n // backwards compatibility.\n public get variables(): TVariables | undefined {\n return this.options.variables;\n }\n\n private isTornDown: boolean;\n private queryManager: QueryManager<any>;\n private observers = new Set<Observer<ApolloQueryResult<TData>>>();\n private subscriptions = new Set<ObservableSubscription>();\n\n private last?: Last<TData, TVariables>;\n\n private queryInfo: QueryInfo;\n\n // When this.concast is defined, this.observer is the Observer currently\n // subscribed to that Concast.\n private concast?: Concast<ApolloQueryResult<TData>>;\n private observer?: Observer<ApolloQueryResult<TData>>;\n\n private pollingInfo?: {\n interval: number;\n timeout: ReturnType<typeof setTimeout>;\n };\n\n constructor({\n queryManager,\n queryInfo,\n options,\n }: {\n queryManager: QueryManager<any>;\n queryInfo: QueryInfo;\n options: WatchQueryOptions<TVariables, TData>;\n }) {\n super((observer: Observer<ApolloQueryResult<TData>>) => {\n const { fetchOnFirstSubscribe = true } = options\n\n // Zen Observable has its own error function, so in order to log correctly\n // we need to provide a custom error callback.\n try {\n var subObserver = (observer as any)._subscription._observer;\n if (subObserver && !subObserver.error) {\n subObserver.error = defaultSubscriptionObserverErrorCallback;\n }\n } catch {}\n\n const first = !this.observers.size;\n this.observers.add(observer);\n\n // Deliver most recent error or result.\n const last = this.last;\n if (last && last.error) {\n observer.error && observer.error(last.error);\n } else if (last && last.result) {\n observer.next && observer.next(last.result);\n }\n\n // Initiate observation of this query if it hasn't been reported to\n // the QueryManager yet.\n if (first && fetchOnFirstSubscribe) {\n // Blindly catching here prevents unhandled promise rejections,\n // and is safe because the ObservableQuery handles this error with\n // this.observer.error, so we're not just swallowing the error by\n // ignoring it here.\n this.reobserve().catch(() => {});\n }\n\n return () => {\n if (this.observers.delete(observer) && !this.observers.size) {\n this.tearDownQuery();\n }\n };\n });\n\n // related classes\n this.queryInfo = queryInfo;\n this.queryManager = queryManager;\n\n // active state\n this.isTornDown = false;\n\n const {\n watchQuery: {\n fetchPolicy: defaultFetchPolicy = \"cache-first\",\n } = {},\n } = queryManager.defaultOptions;\n\n const {\n fetchPolicy = defaultFetchPolicy,\n initialFetchPolicy = (\n // Make sure we don't store \"standby\" as the initialFetchPolicy.\n fetchPolicy === \"standby\" ? defaultFetchPolicy : fetchPolicy\n ),\n } = options;\n\n this.options = {\n ...options,\n\n // Remember the initial options.fetchPolicy so we can revert back to this\n // policy when variables change. This information can also be specified\n // (or overridden) by providing options.initialFetchPolicy explicitly.\n initialFetchPolicy,\n\n // This ensures this.options.fetchPolicy always has a string value, in\n // case options.fetchPolicy was not provided.\n fetchPolicy,\n };\n\n this.queryId = queryInfo.queryId || queryManager.generateQueryId();\n\n const opDef = getOperationDefinition(this.query);\n this.queryName = opDef && opDef.name && opDef.name.value;\n }\n\n public result(): Promise<ApolloQueryResult<TData>> {\n return new Promise((resolve, reject) => {\n // TODO: this code doesn’t actually make sense insofar as the observer\n // will never exist in this.observers due how zen-observable wraps observables.\n // https://github.com/zenparsing/zen-observable/blob/master/src/Observable.js#L169\n const observer: Observer<ApolloQueryResult<TData>> = {\n next: (result: ApolloQueryResult<TData>) => {\n resolve(result);\n\n // Stop the query within the QueryManager if we can before\n // this function returns.\n //\n // We do this in order to prevent observers piling up within\n // the QueryManager. Notice that we only fully unsubscribe\n // from the subscription in a setTimeout(..., 0) call. This call can\n // actually be handled by the browser at a much later time. If queries\n // are fired in the meantime, observers that should have been removed\n // from the QueryManager will continue to fire, causing an unnecessary\n // performance hit.\n this.observers.delete(observer);\n if (!this.observers.size) {\n this.queryManager.removeQuery(this.queryId);\n }\n\n setTimeout(() => {\n subscription.unsubscribe();\n }, 0);\n },\n error: reject,\n };\n const subscription = this.subscribe(observer);\n });\n }\n\n public getCurrentResult(saveAsLastResult = true): ApolloQueryResult<TData> {\n // Use the last result as long as the variables match this.variables.\n const lastResult = this.getLastResult(true);\n\n const networkStatus =\n this.queryInfo.networkStatus ||\n (lastResult && lastResult.networkStatus) ||\n NetworkStatus.ready;\n\n const result = {\n ...lastResult,\n loading: isNetworkRequestInFlight(networkStatus),\n networkStatus,\n } as ApolloQueryResult<TData>;\n\n const { fetchPolicy = \"cache-first\" } = this.options;\n if (\n // These fetch policies should never deliver data from the cache, unless\n // redelivering a previously delivered result.\n fetchPolicy === 'network-only' ||\n fetchPolicy === 'no-cache' ||\n fetchPolicy === 'standby' ||\n // If this.options.query has @client(always: true) fields, we cannot\n // trust diff.result, since it was read from the cache without running\n // local resolvers (and it's too late to run resolvers now, since we must\n // return a result synchronously).\n this.queryManager.transform(this.options.query).hasForcedResolvers\n ) {\n // Fall through.\n } else {\n const diff = this.queryInfo.getDiff();\n\n if (diff.complete || this.options.returnPartialData) {\n result.data = diff.result;\n }\n\n if (equal(result.data, {})) {\n result.data = void 0 as any;\n }\n\n if (diff.complete) {\n // Similar to setting result.partial to false, but taking advantage of the\n // falsiness of missing fields.\n delete result.partial;\n\n // If the diff is complete, and we're using a FetchPolicy that\n // terminates after a complete cache read, we can assume the next result\n // we receive will have NetworkStatus.ready and !loading.\n if (\n diff.complete &&\n result.networkStatus === NetworkStatus.loading &&\n (fetchPolicy === 'cache-first' ||\n fetchPolicy === 'cache-only')\n ) {\n result.networkStatus = NetworkStatus.ready;\n result.loading = false;\n }\n } else {\n result.partial = true;\n }\n\n if (\n __DEV__ &&\n !diff.complete &&\n !this.options.partialRefetch &&\n !result.loading &&\n !result.data &&\n !result.error\n ) {\n logMissingFieldErrors(diff.missing);\n }\n }\n\n if (saveAsLastResult) {\n this.updateLastResult(result);\n }\n\n return result;\n }\n\n // Compares newResult to the snapshot we took of this.lastResult when it was\n // first received.\n public isDifferentFromLastResult(\n newResult: ApolloQueryResult<TData>,\n variables?: TVariables\n ) {\n return (\n !this.last ||\n !equal(this.last.result, newResult) ||\n (variables && !equal(this.last.variables, variables))\n );\n }\n\n private getLast<K extends keyof Last<TData, TVariables>>(\n key: K,\n variablesMustMatch?: boolean,\n ) {\n const last = this.last;\n if (\n last &&\n last[key] &&\n (!variablesMustMatch || equal(last.variables, this.variables))\n ) {\n return last[key];\n }\n }\n\n public getLastResult(variablesMustMatch?: boolean): ApolloQueryResult<TData> | undefined {\n return this.getLast(\"result\", variablesMustMatch);\n }\n\n public getLastError(variablesMustMatch?: boolean): ApolloError | undefined {\n return this.getLast(\"error\", variablesMustMatch);\n }\n\n public resetLastResults(): void {\n delete this.last;\n this.isTornDown = false;\n }\n\n public resetQueryStoreErrors() {\n this.queryManager.resetErrors(this.queryId);\n }\n\n /**\n * Update the variables of this observable query, and fetch the new results.\n * This method should be preferred over `setVariables` in most use cases.\n *\n * @param variables: The new set of variables. If there are missing variables,\n * the previous values of those variables will be used.\n */\n public refetch(variables?: Partial<TVariables>): Promise<ApolloQueryResult<TData>> {\n const reobserveOptions: Partial<WatchQueryOptions<TVariables, TData>> = {\n // Always disable polling for refetches.\n pollInterval: 0,\n };\n\n // Unless the provided fetchPolicy always consults the network\n // (no-cache, network-only, or cache-and-network), override it with\n // network-only to force the refetch for this fetchQuery call.\n const { fetchPolicy } = this.options;\n if (fetchPolicy === 'cache-and-network') {\n reobserveOptions.fetchPolicy = fetchPolicy;\n } else if (fetchPolicy === 'no-cache') {\n reobserveOptions.fetchPolicy = 'no-cache';\n } else {\n reobserveOptions.fetchPolicy = 'network-only';\n }\n\n if (__DEV__ && variables && hasOwnProperty.call(variables, \"variables\")) {\n const queryDef = getQueryDefinition(this.query);\n const vars = queryDef.variableDefinitions;\n if (!vars || !vars.some(v => v.variable.name.value === \"variables\")) {\n invariant.warn(`Called refetch(${\n JSON.stringify(variables)\n }) for query ${\n queryDef.name?.value || JSON.stringify(queryDef)\n }, which does not declare a $variables variable.\nDid you mean to call refetch(variables) instead of refetch({ variables })?`);\n }\n }\n\n if (variables && !equal(this.options.variables, variables)) {\n // Update the existing options with new variables\n reobserveOptions.variables = this.options.variables = {\n ...this.options.variables,\n ...variables,\n } as TVariables;\n }\n\n this.queryInfo.resetLastWrite();\n return this.reobserve(reobserveOptions, NetworkStatus.refetch);\n }\n\n public fetchMore<\n TFetchData = TData,\n TFetchVars extends OperationVariables = TVariables,\n >(fetchMoreOptions: FetchMoreQueryOptions<TFetchVars, TFetchData> & {\n updateQuery?: (\n previousQueryResult: TData,\n options: {\n fetchMoreResult: TFetchData;\n variables: TFetchVars;\n },\n ) => TData;\n }): Promise<ApolloQueryResult<TFetchData>> {\n const combinedOptions = {\n ...(fetchMoreOptions.query ? fetchMoreOptions : {\n ...this.options,\n query: this.query,\n ...fetchMoreOptions,\n variables: {\n ...this.options.variables,\n ...fetchMoreOptions.variables,\n },\n }),\n // The fetchMore request goes immediately to the network and does\n // not automatically write its result to the cache (hence no-cache\n // instead of network-only), because we allow the caller of\n // fetchMore to provide an updateQuery callback that determines how\n // the data gets written to the cache.\n fetchPolicy: \"no-cache\",\n } as WatchQueryOptions<TFetchVars, TFetchData>;\n\n const qid = this.queryManager.generateQueryId();\n\n // Simulate a loading result for the original query with\n // result.networkStatus === NetworkStatus.fetchMore.\n const { queryInfo } = this;\n const originalNetworkStatus = queryInfo.networkStatus;\n queryInfo.networkStatus = NetworkStatus.fetchMore;\n if (combinedOptions.notifyOnNetworkStatusChange) {\n this.observe();\n }\n\n const updatedQuerySet = new Set<DocumentNode>();\n\n return this.queryManager.fetchQuery(\n qid,\n combinedOptions,\n NetworkStatus.fetchMore,\n ).then(fetchMoreResult => {\n this.queryManager.removeQuery(qid);\n\n if (queryInfo.networkStatus === NetworkStatus.fetchMore) {\n queryInfo.networkStatus = originalNetworkStatus;\n }\n\n // Performing this cache update inside a cache.batch transaction ensures\n // any affected cache.watch watchers are notified at most once about any\n // updates. Most watchers will be using the QueryInfo class, which\n // responds to notifications by calling reobserveCacheFirst to deliver\n // fetchMore cache results back to this ObservableQuery.\n this.queryManager.cache.batch({\n update: cache => {\n const { updateQuery } = fetchMoreOptions;\n if (updateQuery) {\n cache.updateQuery({\n query: this.query,\n variables: this.variables,\n returnPartialData: true,\n optimistic: false,\n }, previous => updateQuery(previous!, {\n fetchMoreResult: fetchMoreResult.data,\n variables: combinedOptions.variables as TFetchVars,\n }));\n\n } else {\n // If we're using a field policy instead of updateQuery, the only\n // thing we need to do is write the new data to the cache using\n // combinedOptions.variables (instead of this.variables, which is\n // what this.updateQuery uses, because it works by abusing the\n // original field value, keyed by the original variables).\n cache.writeQuery({\n query: combinedOptions.query,\n variables: combinedOptions.variables,\n data: fetchMoreResult.data,\n });\n }\n },\n\n onWatchUpdated: watch => {\n // Record the DocumentNode associated with any watched query whose\n // data were updated by the cache writes above.\n updatedQuerySet.add(watch.query);\n },\n });\n\n return fetchMoreResult;\n\n }).finally(() => {\n // In case the cache writes above did not generate a broadcast\n // notification (which would have been intercepted by onWatchUpdated),\n // likely because the written data were the same as what was already in\n // the cache, we still want fetchMore to deliver its final loading:false\n // result with the unchanged data.\n if (!updatedQuerySet.has(this.query)) {\n reobserveCacheFirst(this);\n }\n });\n }\n\n // XXX the subscription variables are separate from the query variables.\n // if you want to update subscription variables, right now you have to do that separately,\n // and you can only do it by stopping the subscription and then subscribing again with new variables.\n public subscribeToMore<\n TSubscriptionData = TData,\n TSubscriptionVariables extends OperationVariables = TVariables\n >(\n options: SubscribeToMoreOptions<\n TData,\n TSubscriptionVariables,\n TSubscriptionData\n >,\n ) {\n const subscription = this.queryManager\n .startGraphQLSubscription({\n query: options.document,\n variables: options.variables,\n context: options.context,\n })\n .subscribe({\n next: (subscriptionData: { data: TSubscriptionData }) => {\n const { updateQuery } = options;\n if (updateQuery) {\n this.updateQuery<TSubscriptionVariables>(\n (previous, { variables }) =>\n updateQuery(previous, {\n subscriptionData,\n variables,\n }),\n );\n }\n },\n error: (err: any) => {\n if (options.onError) {\n options.onError(err);\n return;\n }\n invariant.error('Unhandled GraphQL subscription error', err);\n },\n });\n\n this.subscriptions.add(subscription);\n\n return () => {\n if (this.subscriptions.delete(subscription)) {\n subscription.unsubscribe();\n }\n };\n }\n\n public setOptions(\n newOptions: Partial<WatchQueryOptions<TVariables, TData>>,\n ): Promise<ApolloQueryResult<TData>> {\n return this.reobserve(newOptions);\n }\n\n /**\n * This is for *internal* use only. Most users should instead use `refetch`\n * in order to be properly notified of results even when they come from cache.\n *\n * Update the variables of this observable query, and fetch the new results\n * if they've changed. If you want to force new results, use `refetch`.\n *\n * Note: the `next` callback will *not* fire if the variables have not changed\n * or if the result is coming from cache.\n *\n * Note: the promise will return the old results immediately if the variables\n * have not changed.\n *\n * Note: the promise will return null immediately if the query is not active\n * (there are no subscribers).\n *\n * @private\n *\n * @param variables: The new set of variables. If there are missing variables,\n * the previous values of those variables will be used.\n */\n public setVariables(\n variables: TVariables,\n ): Promise<ApolloQueryResult<TData> | void> {\n if (equal(this.variables, variables)) {\n // If we have no observers, then we don't actually want to make a network\n // request. As soon as someone observes the query, the request will kick\n // off. For now, we just store any changes. (See #1077)\n return this.observers.size\n ? this.result()\n : Promise.resolve();\n }\n\n this.options.variables = variables;\n\n // See comment above\n if (!this.observers.size) {\n return Promise.resolve();\n }\n\n return this.reobserve({\n // Reset options.fetchPolicy to its original value.\n fetchPolicy: this.options.initialFetchPolicy,\n variables,\n }, NetworkStatus.setVariables);\n }\n\n public updateQuery<TVars extends OperationVariables = TVariables>(\n mapFn: (\n previousQueryResult: TData,\n options: Pick<WatchQueryOptions<TVars, TData>, \"variables\">,\n ) => TData,\n ): void {\n const { queryManager } = this;\n const { result } = queryManager.cache.diff<TData>({\n query: this.options.query,\n variables: this.variables,\n returnPartialData: true,\n optimistic: false,\n });\n\n const newResult = mapFn(result!, {\n variables: (this as any).variables,\n });\n\n if (newResult) {\n queryManager.cache.writeQuery({\n query: this.options.query,\n data: newResult,\n variables: this.variables,\n });\n\n queryManager.broadcastQueries();\n }\n }\n\n public startPolling(pollInterval: number) {\n this.options.pollInterval = pollInterval;\n this.updatePolling();\n }\n\n public stopPolling() {\n this.options.pollInterval = 0;\n this.updatePolling();\n }\n\n // Update options.fetchPolicy according to options.nextFetchPolicy.\n private applyNextFetchPolicy(\n reason: NextFetchPolicyContext<TData, TVariables>[\"reason\"],\n // It's possible to use this method to apply options.nextFetchPolicy to\n // options.fetchPolicy even if options !== this.options, though that happens\n // most often when the options are temporary, used for only one request and\n // then thrown away, so nextFetchPolicy may not end up mattering.\n options: WatchQueryOptions<TVariables, TData>,\n ) {\n if (options.nextFetchPolicy) {\n const {\n fetchPolicy = \"cache-first\",\n initialFetchPolicy = fetchPolicy,\n } = options;\n\n if (fetchPolicy === \"standby\") {\n // Do nothing, leaving options.fetchPolicy unchanged.\n } else if (typeof options.nextFetchPolicy === \"function\") {\n // When someone chooses \"cache-and-network\" or \"network-only\" as their\n // initial FetchPolicy, they often do not want future cache updates to\n // trigger unconditional network requests, which is what repeatedly\n // applying the \"cache-and-network\" or \"network-only\" policies would\n // seem to imply. Instead, when the cache reports an update after the\n // initial network request, it may be desirable for subsequent network\n // requests to be triggered only if the cache result is incomplete. To\n // that end, the options.nextFetchPolicy option provides an easy way to\n // update options.fetchPolicy after the initial network request, without\n // having to call observableQuery.setOptions.\n options.fetchPolicy = options.nextFetchPolicy(fetchPolicy, {\n reason,\n options,\n observable: this,\n initialFetchPolicy,\n });\n } else if (reason === \"variables-changed\") {\n options.fetchPolicy = initialFetchPolicy;\n } else {\n options.fetchPolicy = options.nextFetchPolicy;\n }\n }\n\n return options.fetchPolicy;\n }\n\n private fetch(\n options: WatchQueryOptions<TVariables, TData>,\n newNetworkStatus?: NetworkStatus,\n ): Concast<ApolloQueryResult<TData>> {\n // TODO Make sure we update the networkStatus (and infer fetchVariables)\n // before actually committing to the fetch.\n this.queryManager.setObservableQuery(this);\n return this.queryManager.fetchQueryObservable(\n this.queryId,\n options,\n newNetworkStatus,\n );\n }\n\n // Turns polling on or off based on this.options.pollInterval.\n private updatePolling() {\n // Avoid polling in SSR mode\n if (this.queryManager.ssrMode) {\n return;\n }\n\n const {\n pollingInfo,\n options: {\n pollInterval,\n },\n } = this;\n\n if (!pollInterval) {\n if (pollingInfo) {\n clearTimeout(pollingInfo.timeout);\n delete this.pollingInfo;\n }\n return;\n }\n\n if (pollingInfo &&\n pollingInfo.interval === pollInterval) {\n return;\n }\n\n invariant(\n pollInterval,\n 'Attempted to start a polling query without a polling interval.',\n );\n\n const info = pollingInfo || (this.pollingInfo = {} as any);\n info.interval = pollInterval;\n\n const maybeFetch = () => {\n if (this.pollingInfo) {\n if (!isNetworkRequestInFlight(this.queryInfo.networkStatus)) {\n this.reobserve({\n // Most fetchPolicy options don't make sense to use in a polling context, as\n // users wouldn't want to be polling the cache directly. However, network-only and\n // no-cache are both useful for when the user wants to control whether or not the\n // polled results are written to the cache.\n fetchPolicy: this.options.initialFetchPolicy === 'no-cache' ? 'no-cache' : 'network-only',\n }, NetworkStatus.poll).then(poll, poll);\n } else {\n poll();\n }\n };\n };\n\n const poll = () => {\n const info = this.pollingInfo;\n if (info) {\n clearTimeout(info.timeout);\n info.timeout = setTimeout(maybeFetch, info.interval);\n }\n };\n\n poll();\n }\n\n private updateLastResult(\n newResult: ApolloQueryResult<TData>,\n variables = this.variables,\n ) {\n this.last = {\n ...this.last,\n result: this.queryManager.assumeImmutableResults\n ? newResult\n : cloneDeep(newResult),\n variables,\n };\n if (!isNonEmptyArray(newResult.errors)) {\n delete this.last.error;\n }\n return this.last;\n }\n\n // For cases like suspense with a deferred query where we need a custom\n // promise wrapped around the concast, we need access to the raw concast\n // created from `reobserve`. This function provides the original `reobserve`\n // functionality, but returns a concast instead of a promise. Most consumers\n // should prefer `reobserve` instead of this function.\n public reobserveAsConcast(\n newOptions?: Partial<WatchQueryOptions<TVariables, TData>>,\n newNetworkStatus?: NetworkStatus\n ): Concast<ApolloQueryResult<TData>> {\n this.isTornDown = false;\n\n const useDisposableConcast =\n // Refetching uses a disposable Concast to allow refetches using different\n // options/variables, without permanently altering the options of the\n // original ObservableQuery.\n newNetworkStatus === NetworkStatus.refetch ||\n // The fetchMore method does not actually call the reobserve method, but,\n // if it did, it would definitely use a disposable Concast.\n newNetworkStatus === NetworkStatus.fetchMore ||\n // Polling uses a disposable Concast so the polling options (which force\n // fetchPolicy to be \"network-only\" or \"no-cache\") won't override the original options.\n newNetworkStatus === NetworkStatus.poll;\n\n // Save the old variables, since Object.assign may modify them below.\n const oldVariables = this.options.variables;\n const oldFetchPolicy = this.options.fetchPolicy;\n\n const mergedOptions = compact(this.options, newOptions || {});\n const options = useDisposableConcast\n // Disposable Concast fetches receive a shallow copy of this.options\n // (merged with newOptions), leaving this.options unmodified.\n ? mergedOptions\n : assign(this.options, mergedOptions);\n\n if (!useDisposableConcast) {\n // We can skip calling updatePolling if we're not changing this.options.\n this.updatePolling();\n\n // Reset options.fetchPolicy to its original value when variables change,\n // unless a new fetchPolicy was provided by newOptions.\n if (\n newOptions &&\n newOptions.variables &&\n !equal(newOptions.variables, oldVariables) &&\n // Don't mess with the fetchPolicy if it's currently \"standby\".\n options.fetchPolicy !== \"standby\" &&\n // If we're changing the fetchPolicy anyway, don't try to change it here\n // using applyNextFetchPolicy. The explicit options.fetchPolicy wins.\n options.fetchPolicy === oldFetchPolicy\n ) {\n this.applyNextFetchPolicy(\"variables-changed\", options);\n if (newNetworkStatus === void 0) {\n newNetworkStatus = NetworkStatus.setVariables;\n }\n }\n }\n\n const variables = options.variables && { ...options.variables };\n const concast = this.fetch(options, newNetworkStatus);\n const observer: Observer<ApolloQueryResult<TData>> = {\n next: result => {\n this.reportResult(result, variables);\n },\n error: error => {\n this.reportError(error, variables);\n },\n };\n\n if (!useDisposableConcast) {\n // We use the {add,remove}Observer methods directly to avoid wrapping\n // observer with an unnecessary SubscriptionObserver object.\n if (this.concast && this.observer) {\n this.concast.removeObserver(this.observer);\n }\n\n this.concast = concast;\n this.observer = observer;\n }\n\n concast.addObserver(observer);\n\n return concast;\n }\n\n public reobserve(\n newOptions?: Partial<WatchQueryOptions<TVariables, TData>>,\n newNetworkStatus?: NetworkStatus,\n ): Promise<ApolloQueryResult<TData>> {\n return this.reobserveAsConcast(\n newOptions,\n newNetworkStatus\n ).promise\n }\n\n // (Re)deliver the current result to this.observers without applying fetch\n // policies or making network requests.\n private observe() {\n this.reportResult(\n // Passing false is important so that this.getCurrentResult doesn't\n // save the fetchMore result as this.lastResult, causing it to be\n // ignored due to the this.isDifferentFromLastResult check in\n // this.reportResult.\n this.getCurrentResult(false),\n this.variables,\n );\n }\n\n private reportResult(\n result: ApolloQueryResult<TData>,\n variables: TVariables | undefined,\n ) {\n const lastError = this.getLastError();\n if (lastError || this.isDifferentFromLastResult(result, variables)) {\n if (lastError || !result.partial || this.options.returnPartialData) {\n this.updateLastResult(result, variables);\n }\n\n iterateObserversSafely(this.observers, 'next', result);\n }\n }\n\n private reportError(\n error: ApolloError,\n variables: TVariables | undefined,\n ) {\n // Since we don't get the current result on errors, only the error, we\n // must mirror the updates that occur in QueryStore.markQueryError here\n const errorResult = {\n ...this.getLastResult(),\n error,\n errors: error.graphQLErrors,\n networkStatus: NetworkStatus.error,\n loading: false,\n } as ApolloQueryResult<TData>;\n\n this.updateLastResult(errorResult, variables);\n\n iterateObserversSafely(this.observers, 'error', this.last!.error = error);\n }\n\n public hasObservers() {\n return this.observers.size > 0;\n }\n\n private tearDownQuery() {\n if (this.isTornDown) return;\n if (this.concast && this.observer) {\n this.concast.removeObserver(this.observer);\n delete this.concast;\n delete this.observer;\n }\n\n this.stopPolling();\n // stop all active GraphQL subscriptions\n this.subscriptions.forEach(sub => sub.unsubscribe());\n this.subscriptions.clear();\n this.queryManager.stopQuery(this.queryId);\n this.observers.clear();\n this.isTornDown = true;\n }\n}\n\n// Necessary because the ObservableQuery constructor has a different\n// signature than the Observable constructor.\nfixObservableSubclass(ObservableQuery);\n\n// Reobserve with fetchPolicy effectively set to \"cache-first\", triggering\n// delivery of any new data from the cache, possibly falling back to the network\n// if any cache data are missing. This allows _complete_ cache results to be\n// delivered without also kicking off unnecessary network requests when\n// this.options.fetchPolicy is \"cache-and-network\" or \"network-only\". When\n// this.options.fetchPolicy is any other policy (\"cache-first\", \"cache-only\",\n// \"standby\", or \"no-cache\"), we call this.reobserve() as usual.\nexport function reobserveCacheFirst<TData, TVars extends OperationVariables>(\n obsQuery: ObservableQuery<TData, TVars>,\n) {\n const { fetchPolicy, nextFetchPolicy } = obsQuery.options;\n\n if (\n fetchPolicy === \"cache-and-network\" ||\n fetchPolicy === \"network-only\"\n ) {\n return obsQuery.reobserve({\n fetchPolicy: \"cache-first\",\n // Use a temporary nextFetchPolicy function that replaces itself with the\n // previous nextFetchPolicy value and returns the original fetchPolicy.\n nextFetchPolicy(this: WatchQueryOptions<TVars, TData>) {\n // Replace this nextFetchPolicy function in the options object with the\n // original this.options.nextFetchPolicy value.\n this.nextFetchPolicy = nextFetchPolicy;\n // If the original nextFetchPolicy value was a function, give it a\n // chance to decide what happens here.\n if (typeof nextFetchPolicy === \"function\") {\n return nextFetchPolicy.apply(this, arguments);\n }\n // Otherwise go back to the original this.options.fetchPolicy.\n return fetchPolicy!;\n },\n });\n }\n\n return obsQuery.reobserve();\n}\n\nfunction defaultSubscriptionObserverErrorCallback(error: ApolloError) {\n invariant.error('Unhandled error', error.message, error.stack);\n}\n\nexport function logMissingFieldErrors(\n missing: MissingFieldError[] | MissingTree | undefined,\n) {\n if (__DEV__ && missing) {\n invariant.debug(`Missing cache result fields: ${\n JSON.stringify(missing)\n }`, missing);\n }\n}\n"]}
1
+ {"version":3,"file":"ObservableQuery.js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QAAQ,CAAC,OAAO,EAAjD,WAAW,iBAAA,EAAE,eAAe,qBAAqB,CAAC;IAE1D,IACE,WAAW,KAAK,mBAAmB;QACnC,WAAW,KAAK,cAAc,EAC9B;QACA,OAAO,QAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,aAAa;YAG1B,eAAe;gBAGb,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;gBAGvC,IAAI,OAAO,eAAe,KAAK,UAAU,EAAE;oBACzC,OAAO,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;iBAC/C;gBAED,OAAO,WAAY,CAAC;YACtB,CAAC;SACF,CAAC,CAAC;KACJ;IAED,OAAO,QAAQ,CAAC,SAAS,EAAE,CAAC;AAC9B,CAAC;AAED,SAAS,wCAAwC,CAAC,KAAkB;IAClE,SAAS,CAAC,KAAK,CAAC,iBAAiB,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,OAAsD;IAEtD,IAAI,OAAO,IAAI,OAAO,EAAE;QACtB,SAAS,CAAC,KAAK,CAAC,iCAAiC,EAAE,OAAO,CAAC,CAAC;KAC7D;AACH,CAAC","sourcesContent":["import { invariant, __DEV__ } from '../utilities/globals';\nimport type { DocumentNode } from 'graphql';\nimport { equal } from '@wry/equality';\n\nimport { NetworkStatus, isNetworkRequestInFlight } from './networkStatus';\nimport type {\n Concast,\n Observer,\n ObservableSubscription} from '../utilities';\nimport {\n cloneDeep,\n compact,\n getOperationDefinition,\n Observable,\n iterateObserversSafely,\n fixObservableSubclass,\n getQueryDefinition,\n} from '../utilities';\nimport type { ApolloError } from '../errors';\nimport type { QueryManager } from './QueryManager';\nimport type {\n ApolloQueryResult,\n OperationVariables,\n TypedDocumentNode,\n} from './types';\nimport type {\n WatchQueryOptions,\n FetchMoreQueryOptions,\n SubscribeToMoreOptions,\n NextFetchPolicyContext,\n} from './watchQueryOptions';\nimport type { QueryInfo } from './QueryInfo';\nimport type { MissingFieldError } from '../cache';\nimport type { MissingTree } from '../cache/core/types/common';\nimport { equalByQuery } from './equalByQuery';\n\nconst {\n assign,\n hasOwnProperty,\n} = Object;\n\nexport interface FetchMoreOptions<\n TData = any,\n TVariables = OperationVariables\n> {\n updateQuery?: (\n previousQueryResult: TData,\n options: {\n fetchMoreResult?: TData;\n variables?: TVariables;\n },\n ) => TData;\n}\n\nexport interface UpdateQueryOptions<TVariables> {\n variables?: TVariables;\n}\n\ninterface Last<TData, TVariables> {\n result: ApolloQueryResult<TData>;\n variables?: TVariables;\n error?: ApolloError;\n}\n\nexport class ObservableQuery<\n TData = any,\n TVariables extends OperationVariables = OperationVariables\n> extends Observable<ApolloQueryResult<TData>> {\n public readonly options: WatchQueryOptions<TVariables, TData>;\n public readonly queryId: string;\n public readonly queryName?: string;\n\n // The `query` computed property will always reflect the document transformed\n // by the last run query. `this.options.query` will always reflect the raw\n // untransformed query to ensure document transforms with runtime conditionals\n // are run on the original document.\n public get query(): TypedDocumentNode<TData, TVariables> {\n return this.lastQuery || this.options.query;\n }\n\n // Computed shorthand for this.options.variables, preserved for\n // backwards compatibility.\n public get variables(): TVariables | undefined {\n return this.options.variables;\n }\n\n private isTornDown: boolean;\n private queryManager: QueryManager<any>;\n private observers = new Set<Observer<ApolloQueryResult<TData>>>();\n private subscriptions = new Set<ObservableSubscription>();\n\n private last?: Last<TData, TVariables>;\n private lastQuery?: DocumentNode;\n\n private queryInfo: QueryInfo;\n\n // When this.concast is defined, this.observer is the Observer currently\n // subscribed to that Concast.\n private concast?: Concast<ApolloQueryResult<TData>>;\n private observer?: Observer<ApolloQueryResult<TData>>;\n\n private pollingInfo?: {\n interval: number;\n timeout: ReturnType<typeof setTimeout>;\n };\n\n constructor({\n queryManager,\n queryInfo,\n options,\n }: {\n queryManager: QueryManager<any>;\n queryInfo: QueryInfo;\n options: WatchQueryOptions<TVariables, TData>;\n }) {\n super((observer: Observer<ApolloQueryResult<TData>>) => {\n // Zen Observable has its own error function, so in order to log correctly\n // we need to provide a custom error callback.\n try {\n var subObserver = (observer as any)._subscription._observer;\n if (subObserver && !subObserver.error) {\n subObserver.error = defaultSubscriptionObserverErrorCallback;\n }\n } catch {}\n\n const first = !this.observers.size;\n this.observers.add(observer);\n\n // Deliver most recent error or result.\n const last = this.last;\n if (last && last.error) {\n observer.error && observer.error(last.error);\n } else if (last && last.result) {\n observer.next && observer.next(last.result);\n }\n\n // Initiate observation of this query if it hasn't been reported to\n // the QueryManager yet.\n if (first) {\n // Blindly catching here prevents unhandled promise rejections,\n // and is safe because the ObservableQuery handles this error with\n // this.observer.error, so we're not just swallowing the error by\n // ignoring it here.\n this.reobserve().catch(() => {});\n }\n\n return () => {\n if (this.observers.delete(observer) && !this.observers.size) {\n this.tearDownQuery();\n }\n };\n });\n\n // related classes\n this.queryInfo = queryInfo;\n this.queryManager = queryManager;\n\n // active state\n this.isTornDown = false;\n\n const {\n watchQuery: {\n fetchPolicy: defaultFetchPolicy = \"cache-first\",\n } = {},\n } = queryManager.defaultOptions;\n\n const {\n fetchPolicy = defaultFetchPolicy,\n initialFetchPolicy = (\n // Make sure we don't store \"standby\" as the initialFetchPolicy.\n fetchPolicy === \"standby\" ? defaultFetchPolicy : fetchPolicy\n ),\n } = options;\n\n this.options = {\n ...options,\n\n // Remember the initial options.fetchPolicy so we can revert back to this\n // policy when variables change. This information can also be specified\n // (or overridden) by providing options.initialFetchPolicy explicitly.\n initialFetchPolicy,\n\n // This ensures this.options.fetchPolicy always has a string value, in\n // case options.fetchPolicy was not provided.\n fetchPolicy,\n };\n\n this.queryId = queryInfo.queryId || queryManager.generateQueryId();\n\n const opDef = getOperationDefinition(this.query);\n this.queryName = opDef && opDef.name && opDef.name.value;\n }\n\n public result(): Promise<ApolloQueryResult<TData>> {\n return new Promise((resolve, reject) => {\n // TODO: this code doesn’t actually make sense insofar as the observer\n // will never exist in this.observers due how zen-observable wraps observables.\n // https://github.com/zenparsing/zen-observable/blob/master/src/Observable.js#L169\n const observer: Observer<ApolloQueryResult<TData>> = {\n next: (result: ApolloQueryResult<TData>) => {\n resolve(result);\n\n // Stop the query within the QueryManager if we can before\n // this function returns.\n //\n // We do this in order to prevent observers piling up within\n // the QueryManager. Notice that we only fully unsubscribe\n // from the subscription in a setTimeout(..., 0) call. This call can\n // actually be handled by the browser at a much later time. If queries\n // are fired in the meantime, observers that should have been removed\n // from the QueryManager will continue to fire, causing an unnecessary\n // performance hit.\n this.observers.delete(observer);\n if (!this.observers.size) {\n this.queryManager.removeQuery(this.queryId);\n }\n\n setTimeout(() => {\n subscription.unsubscribe();\n }, 0);\n },\n error: reject,\n };\n const subscription = this.subscribe(observer);\n });\n }\n\n public getCurrentResult(saveAsLastResult = true): ApolloQueryResult<TData> {\n // Use the last result as long as the variables match this.variables.\n const lastResult = this.getLastResult(true);\n\n const networkStatus =\n this.queryInfo.networkStatus ||\n (lastResult && lastResult.networkStatus) ||\n NetworkStatus.ready;\n\n const result = {\n ...lastResult,\n loading: isNetworkRequestInFlight(networkStatus),\n networkStatus,\n } as ApolloQueryResult<TData>;\n\n const { fetchPolicy = \"cache-first\" } = this.options;\n if (\n // These fetch policies should never deliver data from the cache, unless\n // redelivering a previously delivered result.\n fetchPolicy === 'network-only' ||\n fetchPolicy === 'no-cache' ||\n fetchPolicy === 'standby' ||\n // If this.options.query has @client(always: true) fields, we cannot\n // trust diff.result, since it was read from the cache without running\n // local resolvers (and it's too late to run resolvers now, since we must\n // return a result synchronously).\n this.queryManager.getDocumentInfo(this.query).hasForcedResolvers\n ) {\n // Fall through.\n } else {\n const diff = this.queryInfo.getDiff();\n\n if (diff.complete || this.options.returnPartialData) {\n result.data = diff.result;\n }\n\n if (equal(result.data, {})) {\n result.data = void 0 as any;\n }\n\n if (diff.complete) {\n // Similar to setting result.partial to false, but taking advantage of the\n // falsiness of missing fields.\n delete result.partial;\n\n // If the diff is complete, and we're using a FetchPolicy that\n // terminates after a complete cache read, we can assume the next result\n // we receive will have NetworkStatus.ready and !loading.\n if (\n diff.complete &&\n result.networkStatus === NetworkStatus.loading &&\n (fetchPolicy === 'cache-first' ||\n fetchPolicy === 'cache-only')\n ) {\n result.networkStatus = NetworkStatus.ready;\n result.loading = false;\n }\n } else {\n result.partial = true;\n }\n\n if (\n __DEV__ &&\n !diff.complete &&\n !this.options.partialRefetch &&\n !result.loading &&\n !result.data &&\n !result.error\n ) {\n logMissingFieldErrors(diff.missing);\n }\n }\n\n if (saveAsLastResult) {\n this.updateLastResult(result);\n }\n\n return result;\n }\n\n // Compares newResult to the snapshot we took of this.lastResult when it was\n // first received.\n public isDifferentFromLastResult(\n newResult: ApolloQueryResult<TData>,\n variables?: TVariables\n ) {\n if (!this.last) {\n return true;\n }\n\n const resultIsDifferent =\n this.queryManager.getDocumentInfo(this.query).hasNonreactiveDirective\n ? !equalByQuery(\n this.query,\n this.last.result,\n newResult,\n this.variables,\n )\n : !equal(this.last.result, newResult);\n\n return (\n resultIsDifferent ||\n (variables && !equal(this.last.variables, variables))\n );\n }\n\n private getLast<K extends keyof Last<TData, TVariables>>(\n key: K,\n variablesMustMatch?: boolean,\n ) {\n const last = this.last;\n if (\n last &&\n last[key] &&\n (!variablesMustMatch || equal(last.variables, this.variables))\n ) {\n return last[key];\n }\n }\n\n public getLastResult(variablesMustMatch?: boolean): ApolloQueryResult<TData> | undefined {\n return this.getLast(\"result\", variablesMustMatch);\n }\n\n public getLastError(variablesMustMatch?: boolean): ApolloError | undefined {\n return this.getLast(\"error\", variablesMustMatch);\n }\n\n public resetLastResults(): void {\n delete this.last;\n this.isTornDown = false;\n }\n\n public resetQueryStoreErrors() {\n this.queryManager.resetErrors(this.queryId);\n }\n\n /**\n * Update the variables of this observable query, and fetch the new results.\n * This method should be preferred over `setVariables` in most use cases.\n *\n * @param variables: The new set of variables. If there are missing variables,\n * the previous values of those variables will be used.\n */\n public refetch(variables?: Partial<TVariables>): Promise<ApolloQueryResult<TData>> {\n const reobserveOptions: Partial<WatchQueryOptions<TVariables, TData>> = {\n // Always disable polling for refetches.\n pollInterval: 0,\n };\n\n // Unless the provided fetchPolicy always consults the network\n // (no-cache, network-only, or cache-and-network), override it with\n // network-only to force the refetch for this fetchQuery call.\n const { fetchPolicy } = this.options;\n if (fetchPolicy === 'cache-and-network') {\n reobserveOptions.fetchPolicy = fetchPolicy;\n } else if (fetchPolicy === 'no-cache') {\n reobserveOptions.fetchPolicy = 'no-cache';\n } else {\n reobserveOptions.fetchPolicy = 'network-only';\n }\n\n if (__DEV__ && variables && hasOwnProperty.call(variables, \"variables\")) {\n const queryDef = getQueryDefinition(this.query);\n const vars = queryDef.variableDefinitions;\n if (!vars || !vars.some(v => v.variable.name.value === \"variables\")) {\n invariant.warn(`Called refetch(%o) for query %o, which does not declare a $variables variable.\nDid you mean to call refetch(variables) instead of refetch({ variables })?`, \n variables, \n queryDef.name?.value || queryDef\n );\n }\n }\n\n if (variables && !equal(this.options.variables, variables)) {\n // Update the existing options with new variables\n reobserveOptions.variables = this.options.variables = {\n ...this.options.variables,\n ...variables,\n } as TVariables;\n }\n\n this.queryInfo.resetLastWrite();\n return this.reobserve(reobserveOptions, NetworkStatus.refetch);\n }\n\n public fetchMore<\n TFetchData = TData,\n TFetchVars extends OperationVariables = TVariables,\n >(fetchMoreOptions: FetchMoreQueryOptions<TFetchVars, TFetchData> & {\n updateQuery?: (\n previousQueryResult: TData,\n options: {\n fetchMoreResult: TFetchData;\n variables: TFetchVars;\n },\n ) => TData;\n }): Promise<ApolloQueryResult<TFetchData>> {\n const combinedOptions = {\n ...(fetchMoreOptions.query ? fetchMoreOptions : {\n ...this.options,\n query: this.options.query,\n ...fetchMoreOptions,\n variables: {\n ...this.options.variables,\n ...fetchMoreOptions.variables,\n },\n }),\n // The fetchMore request goes immediately to the network and does\n // not automatically write its result to the cache (hence no-cache\n // instead of network-only), because we allow the caller of\n // fetchMore to provide an updateQuery callback that determines how\n // the data gets written to the cache.\n fetchPolicy: \"no-cache\",\n } as WatchQueryOptions<TFetchVars, TFetchData>;\n\n combinedOptions.query = this.transformDocument(combinedOptions.query);\n\n const qid = this.queryManager.generateQueryId();\n\n // If a temporary query is passed to `fetchMore`, we don't want to store \n // it as the last query result since it may be an optimized query for \n // pagination. We will however run the transforms on the original document \n // as well as the document passed in `fetchMoreOptions` to ensure the cache \n // uses the most up-to-date document which may rely on runtime conditionals.\n this.lastQuery = fetchMoreOptions.query \n ? this.transformDocument(this.options.query)\n : combinedOptions.query;\n\n // Simulate a loading result for the original query with\n // result.networkStatus === NetworkStatus.fetchMore.\n const { queryInfo } = this;\n const originalNetworkStatus = queryInfo.networkStatus;\n queryInfo.networkStatus = NetworkStatus.fetchMore;\n if (combinedOptions.notifyOnNetworkStatusChange) {\n this.observe();\n }\n\n const updatedQuerySet = new Set<DocumentNode>();\n\n return this.queryManager.fetchQuery(\n qid,\n combinedOptions,\n NetworkStatus.fetchMore,\n ).then(fetchMoreResult => {\n this.queryManager.removeQuery(qid);\n\n if (queryInfo.networkStatus === NetworkStatus.fetchMore) {\n queryInfo.networkStatus = originalNetworkStatus;\n }\n\n // Performing this cache update inside a cache.batch transaction ensures\n // any affected cache.watch watchers are notified at most once about any\n // updates. Most watchers will be using the QueryInfo class, which\n // responds to notifications by calling reobserveCacheFirst to deliver\n // fetchMore cache results back to this ObservableQuery.\n this.queryManager.cache.batch({\n update: cache => {\n const { updateQuery } = fetchMoreOptions;\n if (updateQuery) {\n cache.updateQuery({\n query: this.query,\n variables: this.variables,\n returnPartialData: true,\n optimistic: false,\n }, previous => updateQuery(previous!, {\n fetchMoreResult: fetchMoreResult.data,\n variables: combinedOptions.variables as TFetchVars,\n }));\n\n } else {\n // If we're using a field policy instead of updateQuery, the only\n // thing we need to do is write the new data to the cache using\n // combinedOptions.variables (instead of this.variables, which is\n // what this.updateQuery uses, because it works by abusing the\n // original field value, keyed by the original variables).\n cache.writeQuery({\n query: combinedOptions.query,\n variables: combinedOptions.variables,\n data: fetchMoreResult.data,\n });\n }\n },\n\n onWatchUpdated: watch => {\n // Record the DocumentNode associated with any watched query whose\n // data were updated by the cache writes above.\n updatedQuerySet.add(watch.query);\n },\n });\n\n return fetchMoreResult;\n\n }).finally(() => {\n // In case the cache writes above did not generate a broadcast\n // notification (which would have been intercepted by onWatchUpdated),\n // likely because the written data were the same as what was already in\n // the cache, we still want fetchMore to deliver its final loading:false\n // result with the unchanged data.\n if (!updatedQuerySet.has(this.query)) {\n reobserveCacheFirst(this);\n }\n });\n }\n\n // XXX the subscription variables are separate from the query variables.\n // if you want to update subscription variables, right now you have to do that separately,\n // and you can only do it by stopping the subscription and then subscribing again with new variables.\n public subscribeToMore<\n TSubscriptionData = TData,\n TSubscriptionVariables extends OperationVariables = TVariables\n >(\n options: SubscribeToMoreOptions<\n TData,\n TSubscriptionVariables,\n TSubscriptionData\n >,\n ) {\n const subscription = this.queryManager\n .startGraphQLSubscription({\n query: options.document,\n variables: options.variables,\n context: options.context,\n })\n .subscribe({\n next: (subscriptionData: { data: TSubscriptionData }) => {\n const { updateQuery } = options;\n if (updateQuery) {\n this.updateQuery<TSubscriptionVariables>(\n (previous, { variables }) =>\n updateQuery(previous, {\n subscriptionData,\n variables,\n }),\n );\n }\n },\n error: (err: any) => {\n if (options.onError) {\n options.onError(err);\n return;\n }\n invariant.error('Unhandled GraphQL subscription error', err);\n },\n });\n\n this.subscriptions.add(subscription);\n\n return () => {\n if (this.subscriptions.delete(subscription)) {\n subscription.unsubscribe();\n }\n };\n }\n\n public setOptions(\n newOptions: Partial<WatchQueryOptions<TVariables, TData>>,\n ): Promise<ApolloQueryResult<TData>> {\n return this.reobserve(newOptions);\n }\n\n /**\n * Update the variables of this observable query, and fetch the new results\n * if they've changed. Most users should prefer `refetch` instead of\n * `setVariables` in order to to be properly notified of results even when\n * they come from the cache.\n *\n * Note: the `next` callback will *not* fire if the variables have not changed\n * or if the result is coming from cache.\n *\n * Note: the promise will return the old results immediately if the variables\n * have not changed.\n *\n * Note: the promise will return null immediately if the query is not active\n * (there are no subscribers).\n *\n * @private\n *\n * @param variables: The new set of variables. If there are missing variables,\n * the previous values of those variables will be used.\n */\n public setVariables(\n variables: TVariables,\n ): Promise<ApolloQueryResult<TData> | void> {\n if (equal(this.variables, variables)) {\n // If we have no observers, then we don't actually want to make a network\n // request. As soon as someone observes the query, the request will kick\n // off. For now, we just store any changes. (See #1077)\n return this.observers.size\n ? this.result()\n : Promise.resolve();\n }\n\n this.options.variables = variables;\n\n // See comment above\n if (!this.observers.size) {\n return Promise.resolve();\n }\n\n return this.reobserve({\n // Reset options.fetchPolicy to its original value.\n fetchPolicy: this.options.initialFetchPolicy,\n variables,\n }, NetworkStatus.setVariables);\n }\n\n public updateQuery<TVars extends OperationVariables = TVariables>(\n mapFn: (\n previousQueryResult: TData,\n options: Pick<WatchQueryOptions<TVars, TData>, \"variables\">,\n ) => TData,\n ): void {\n const { queryManager } = this;\n const { result } = queryManager.cache.diff<TData>({\n query: this.options.query,\n variables: this.variables,\n returnPartialData: true,\n optimistic: false,\n });\n\n const newResult = mapFn(result!, {\n variables: (this as any).variables,\n });\n\n if (newResult) {\n queryManager.cache.writeQuery({\n query: this.options.query,\n data: newResult,\n variables: this.variables,\n });\n\n queryManager.broadcastQueries();\n }\n }\n\n public startPolling(pollInterval: number) {\n this.options.pollInterval = pollInterval;\n this.updatePolling();\n }\n\n public stopPolling() {\n this.options.pollInterval = 0;\n this.updatePolling();\n }\n\n // Update options.fetchPolicy according to options.nextFetchPolicy.\n private applyNextFetchPolicy(\n reason: NextFetchPolicyContext<TData, TVariables>[\"reason\"],\n // It's possible to use this method to apply options.nextFetchPolicy to\n // options.fetchPolicy even if options !== this.options, though that happens\n // most often when the options are temporary, used for only one request and\n // then thrown away, so nextFetchPolicy may not end up mattering.\n options: WatchQueryOptions<TVariables, TData>,\n ) {\n if (options.nextFetchPolicy) {\n const {\n fetchPolicy = \"cache-first\",\n initialFetchPolicy = fetchPolicy,\n } = options;\n\n if (fetchPolicy === \"standby\") {\n // Do nothing, leaving options.fetchPolicy unchanged.\n } else if (typeof options.nextFetchPolicy === \"function\") {\n // When someone chooses \"cache-and-network\" or \"network-only\" as their\n // initial FetchPolicy, they often do not want future cache updates to\n // trigger unconditional network requests, which is what repeatedly\n // applying the \"cache-and-network\" or \"network-only\" policies would\n // seem to imply. Instead, when the cache reports an update after the\n // initial network request, it may be desirable for subsequent network\n // requests to be triggered only if the cache result is incomplete. To\n // that end, the options.nextFetchPolicy option provides an easy way to\n // update options.fetchPolicy after the initial network request, without\n // having to call observableQuery.setOptions.\n options.fetchPolicy = options.nextFetchPolicy(fetchPolicy, {\n reason,\n options,\n observable: this,\n initialFetchPolicy,\n });\n } else if (reason === \"variables-changed\") {\n options.fetchPolicy = initialFetchPolicy;\n } else {\n options.fetchPolicy = options.nextFetchPolicy;\n }\n }\n\n return options.fetchPolicy;\n }\n\n private fetch(\n options: WatchQueryOptions<TVariables, TData>,\n newNetworkStatus?: NetworkStatus,\n ) {\n // TODO Make sure we update the networkStatus (and infer fetchVariables)\n // before actually committing to the fetch.\n this.queryManager.setObservableQuery(this);\n return this.queryManager['fetchConcastWithInfo'](\n this.queryId,\n options,\n newNetworkStatus,\n );\n }\n\n // Turns polling on or off based on this.options.pollInterval.\n private updatePolling() {\n // Avoid polling in SSR mode\n if (this.queryManager.ssrMode) {\n return;\n }\n\n const {\n pollingInfo,\n options: {\n pollInterval,\n },\n } = this;\n\n if (!pollInterval) {\n if (pollingInfo) {\n clearTimeout(pollingInfo.timeout);\n delete this.pollingInfo;\n }\n return;\n }\n\n if (pollingInfo &&\n pollingInfo.interval === pollInterval) {\n return;\n }\n\n invariant(\n pollInterval,\n 'Attempted to start a polling query without a polling interval.',\n );\n\n const info = pollingInfo || (this.pollingInfo = {} as any);\n info.interval = pollInterval;\n\n const maybeFetch = () => {\n if (this.pollingInfo) {\n if (!isNetworkRequestInFlight(this.queryInfo.networkStatus)) {\n this.reobserve({\n // Most fetchPolicy options don't make sense to use in a polling context, as\n // users wouldn't want to be polling the cache directly. However, network-only and\n // no-cache are both useful for when the user wants to control whether or not the\n // polled results are written to the cache.\n fetchPolicy: this.options.initialFetchPolicy === 'no-cache' ? 'no-cache' : 'network-only',\n }, NetworkStatus.poll).then(poll, poll);\n } else {\n poll();\n }\n };\n };\n\n const poll = () => {\n const info = this.pollingInfo;\n if (info) {\n clearTimeout(info.timeout);\n info.timeout = setTimeout(maybeFetch, info.interval);\n }\n };\n\n poll();\n }\n\n private updateLastResult(\n newResult: ApolloQueryResult<TData>,\n variables = this.variables,\n ) {\n let error: ApolloError | undefined = this.getLastError();\n // Preserve this.last.error unless the variables have changed.\n if (error && this.last && !equal(variables, this.last.variables)) {\n error = void 0;\n }\n return this.last = {\n result: this.queryManager.assumeImmutableResults\n ? newResult\n : cloneDeep(newResult),\n variables,\n ...(error ? { error } : null),\n };\n }\n\n public reobserveAsConcast(\n newOptions?: Partial<WatchQueryOptions<TVariables, TData>>,\n newNetworkStatus?: NetworkStatus,\n ): Concast<ApolloQueryResult<TData>> {\n this.isTornDown = false;\n\n const useDisposableConcast =\n // Refetching uses a disposable Concast to allow refetches using different\n // options/variables, without permanently altering the options of the\n // original ObservableQuery.\n newNetworkStatus === NetworkStatus.refetch ||\n // The fetchMore method does not actually call the reobserve method, but,\n // if it did, it would definitely use a disposable Concast.\n newNetworkStatus === NetworkStatus.fetchMore ||\n // Polling uses a disposable Concast so the polling options (which force\n // fetchPolicy to be \"network-only\" or \"no-cache\") won't override the original options.\n newNetworkStatus === NetworkStatus.poll;\n\n // Save the old variables, since Object.assign may modify them below.\n const oldVariables = this.options.variables;\n const oldFetchPolicy = this.options.fetchPolicy;\n\n const mergedOptions = compact(this.options, newOptions || {});\n const options = useDisposableConcast\n // Disposable Concast fetches receive a shallow copy of this.options\n // (merged with newOptions), leaving this.options unmodified.\n ? mergedOptions\n : assign(this.options, mergedOptions);\n\n // Don't update options.query with the transformed query to avoid \n // overwriting this.options.query when we aren't using a disposable concast. \n // We want to ensure we can re-run the custom document transforms the next \n // time a request is made against the original query.\n const query = this.transformDocument(options.query);\n\n this.lastQuery = query;\n\n if (!useDisposableConcast) {\n // We can skip calling updatePolling if we're not changing this.options.\n this.updatePolling();\n\n // Reset options.fetchPolicy to its original value when variables change,\n // unless a new fetchPolicy was provided by newOptions.\n if (\n newOptions &&\n newOptions.variables &&\n !equal(newOptions.variables, oldVariables) &&\n // Don't mess with the fetchPolicy if it's currently \"standby\".\n options.fetchPolicy !== \"standby\" &&\n // If we're changing the fetchPolicy anyway, don't try to change it here\n // using applyNextFetchPolicy. The explicit options.fetchPolicy wins.\n options.fetchPolicy === oldFetchPolicy\n ) {\n this.applyNextFetchPolicy(\"variables-changed\", options);\n if (newNetworkStatus === void 0) {\n newNetworkStatus = NetworkStatus.setVariables;\n }\n }\n }\n\n // If the transform doesn't change the document, leave `options` alone and\n // use the original object.\n const fetchOptions = query === options.query ? options : { ...options, query };\n const variables = options.variables && { ...options.variables };\n const { concast, fromLink } = this.fetch(fetchOptions, newNetworkStatus);\n const observer: Observer<ApolloQueryResult<TData>> = {\n next: result => {\n this.reportResult(result, variables);\n },\n error: error => {\n this.reportError(error, variables);\n },\n };\n\n if (!useDisposableConcast && (fromLink || !this.concast)) {\n // We use the {add,remove}Observer methods directly to avoid wrapping\n // observer with an unnecessary SubscriptionObserver object.\n if (this.concast && this.observer) {\n this.concast.removeObserver(this.observer);\n }\n\n this.concast = concast;\n this.observer = observer;\n }\n\n concast.addObserver(observer);\n\n return concast;\n }\n\n public reobserve(\n newOptions?: Partial<WatchQueryOptions<TVariables, TData>>,\n newNetworkStatus?: NetworkStatus,\n ) {\n return this.reobserveAsConcast(newOptions, newNetworkStatus).promise;\n }\n\n // (Re)deliver the current result to this.observers without applying fetch\n // policies or making network requests.\n private observe() {\n this.reportResult(\n // Passing false is important so that this.getCurrentResult doesn't\n // save the fetchMore result as this.lastResult, causing it to be\n // ignored due to the this.isDifferentFromLastResult check in\n // this.reportResult.\n this.getCurrentResult(false),\n this.variables,\n );\n }\n\n private reportResult(\n result: ApolloQueryResult<TData>,\n variables: TVariables | undefined,\n ) {\n const lastError = this.getLastError();\n const isDifferent = this.isDifferentFromLastResult(result, variables);\n // Update the last result even when isDifferentFromLastResult returns false,\n // because the query may be using the @nonreactive directive, and we want to\n // save the the latest version of any nonreactive subtrees (in case\n // getCurrentResult is called), even though we skip broadcasting changes.\n if (lastError || !result.partial || this.options.returnPartialData) {\n this.updateLastResult(result, variables);\n }\n if (lastError || isDifferent) {\n iterateObserversSafely(this.observers, \"next\", result);\n }\n }\n\n private reportError(\n error: ApolloError,\n variables: TVariables | undefined,\n ) {\n // Since we don't get the current result on errors, only the error, we\n // must mirror the updates that occur in QueryStore.markQueryError here\n const errorResult = {\n ...this.getLastResult(),\n error,\n errors: error.graphQLErrors,\n networkStatus: NetworkStatus.error,\n loading: false,\n } as ApolloQueryResult<TData>;\n\n this.updateLastResult(errorResult, variables);\n\n iterateObserversSafely(this.observers, 'error', this.last!.error = error);\n }\n\n public hasObservers() {\n return this.observers.size > 0;\n }\n\n private tearDownQuery() {\n if (this.isTornDown) return;\n if (this.concast && this.observer) {\n this.concast.removeObserver(this.observer);\n delete this.concast;\n delete this.observer;\n }\n\n this.stopPolling();\n // stop all active GraphQL subscriptions\n this.subscriptions.forEach(sub => sub.unsubscribe());\n this.subscriptions.clear();\n this.queryManager.stopQuery(this.queryId);\n this.observers.clear();\n this.isTornDown = true;\n }\n\n private transformDocument(document: DocumentNode) {\n return this.queryManager.transform(document);\n }\n}\n\n// Necessary because the ObservableQuery constructor has a different\n// signature than the Observable constructor.\nfixObservableSubclass(ObservableQuery);\n\n// Reobserve with fetchPolicy effectively set to \"cache-first\", triggering\n// delivery of any new data from the cache, possibly falling back to the network\n// if any cache data are missing. This allows _complete_ cache results to be\n// delivered without also kicking off unnecessary network requests when\n// this.options.fetchPolicy is \"cache-and-network\" or \"network-only\". When\n// this.options.fetchPolicy is any other policy (\"cache-first\", \"cache-only\",\n// \"standby\", or \"no-cache\"), we call this.reobserve() as usual.\nexport function reobserveCacheFirst<TData, TVars extends OperationVariables>(\n obsQuery: ObservableQuery<TData, TVars>,\n) {\n const { fetchPolicy, nextFetchPolicy } = obsQuery.options;\n\n if (\n fetchPolicy === \"cache-and-network\" ||\n fetchPolicy === \"network-only\"\n ) {\n return obsQuery.reobserve({\n fetchPolicy: \"cache-first\",\n // Use a temporary nextFetchPolicy function that replaces itself with the\n // previous nextFetchPolicy value and returns the original fetchPolicy.\n nextFetchPolicy(this: WatchQueryOptions<TVars, TData>) {\n // Replace this nextFetchPolicy function in the options object with the\n // original this.options.nextFetchPolicy value.\n this.nextFetchPolicy = nextFetchPolicy;\n // If the original nextFetchPolicy value was a function, give it a\n // chance to decide what happens here.\n if (typeof nextFetchPolicy === \"function\") {\n return nextFetchPolicy.apply(this, arguments);\n }\n // Otherwise go back to the original this.options.fetchPolicy.\n return fetchPolicy!;\n },\n });\n }\n\n return obsQuery.reobserve();\n}\n\nfunction defaultSubscriptionObserverErrorCallback(error: ApolloError) {\n invariant.error('Unhandled error', error.message, error.stack);\n}\n\nexport function logMissingFieldErrors(\n missing: MissingFieldError[] | MissingTree | undefined,\n) {\n if (__DEV__ && missing) {\n invariant.debug(`Missing cache result fields: %o`, missing);\n }\n}\n"]}
@@ -1,13 +1,13 @@
1
- import { DocumentNode, GraphQLError } from 'graphql';
2
- import { Cache } from '../cache';
3
- import { WatchQueryOptions, ErrorPolicy } from './watchQueryOptions';
4
- import { ObservableQuery } from './ObservableQuery';
5
- import { QueryListener } from './types';
6
- import { FetchResult } from '../link/core';
7
- import { ObservableSubscription } from '../utilities';
1
+ import type { DocumentNode, GraphQLError } from 'graphql';
2
+ import type { Cache } from '../cache';
3
+ import type { WatchQueryOptions, ErrorPolicy } from './watchQueryOptions';
4
+ import type { ObservableQuery } from './ObservableQuery';
5
+ import type { QueryListener } from './types';
6
+ import type { FetchResult } from '../link/core';
7
+ import type { ObservableSubscription } from '../utilities';
8
8
  import { NetworkStatus } from './networkStatus';
9
- import { ApolloError } from '../errors';
10
- import { QueryManager } from './QueryManager';
9
+ import type { ApolloError } from '../errors';
10
+ import type { QueryManager } from './QueryManager';
11
11
  export type QueryStoreValue = Pick<QueryInfo, "variables" | "networkStatus" | "networkError" | "graphQLErrors">;
12
12
  export declare const enum CacheWriteBehavior {
13
13
  FORBID = 0,
@@ -1 +1 @@
1
- {"version":3,"file":"QueryInfo.d.ts","sourceRoot":"","sources":["../../src/core/QueryInfo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGrD,OAAO,EAAE,KAAK,EAAe,MAAM,UAAU,CAAC;AAG9C,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,eAAe,EAAuB,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EACL,sBAAsB,EAIvB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,aAAa,EAEd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,EACxC,WAAW,GACX,eAAe,GACf,cAAc,GACd,eAAe,CAChB,CAAC;AAEJ,0BAAkB,kBAAkB;IAClC,MAAM,IAAA;IACN,SAAS,IAAA;IACT,KAAK,IAAA;CACN;AA6CD,qBAAa,SAAS;aAeF,OAAO;IAdzB,SAAS,qBAA4B;IACrC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAQ;IACrC,aAAa,SAAK;IAClB,aAAa,8BAAqC;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChC,aAAa,CAAC,EAAE,aAAa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