@apollo/client 3.8.7 → 3.8.9

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 (614) hide show
  1. package/.changeset/README.md +8 -0
  2. package/.changeset/config.json +14 -0
  3. package/CHANGELOG.md +3369 -0
  4. package/apollo-client.cjs +356 -354
  5. package/apollo-client.cjs.map +1 -1
  6. package/apollo-client.min.cjs +1 -1
  7. package/cache/cache.cjs +133 -152
  8. package/cache/cache.cjs.map +1 -1
  9. package/cache/cache.cjs.native.js +133 -152
  10. package/cache/core/cache.d.ts +10 -0
  11. package/cache/core/cache.js +17 -5
  12. package/cache/core/cache.js.map +1 -1
  13. package/cache/core/types/Cache.d.ts +1 -1
  14. package/cache/core/types/Cache.js.map +1 -1
  15. package/cache/core/types/DataProxy.d.ts +92 -0
  16. package/cache/core/types/common.js +4 -1
  17. package/cache/core/types/common.js.map +1 -1
  18. package/cache/inmemory/entityStore.d.ts +1 -1
  19. package/cache/inmemory/entityStore.js +190 -29
  20. package/cache/inmemory/entityStore.js.map +1 -1
  21. package/cache/inmemory/fixPolyfills.js +9 -0
  22. package/cache/inmemory/fixPolyfills.js.map +1 -1
  23. package/cache/inmemory/fixPolyfills.native.js +12 -0
  24. package/cache/inmemory/fixPolyfills.native.js.map +1 -1
  25. package/cache/inmemory/fragmentRegistry.js +23 -12
  26. package/cache/inmemory/fragmentRegistry.js.map +1 -1
  27. package/cache/inmemory/helpers.js +20 -11
  28. package/cache/inmemory/helpers.js.map +1 -1
  29. package/cache/inmemory/inMemoryCache.js +161 -8
  30. package/cache/inmemory/inMemoryCache.js.map +1 -1
  31. package/cache/inmemory/key-extractor.js +72 -4
  32. package/cache/inmemory/key-extractor.js.map +1 -1
  33. package/cache/inmemory/object-canon.js +91 -3
  34. package/cache/inmemory/object-canon.js.map +1 -1
  35. package/cache/inmemory/policies.js +193 -43
  36. package/cache/inmemory/policies.js.map +1 -1
  37. package/cache/inmemory/reactiveVars.js +20 -2
  38. package/cache/inmemory/reactiveVars.js.map +1 -1
  39. package/cache/inmemory/readFromStore.d.ts +4 -0
  40. package/cache/inmemory/readFromStore.js +54 -9
  41. package/cache/inmemory/readFromStore.js.map +1 -1
  42. package/cache/inmemory/types.d.ts +28 -0
  43. package/cache/inmemory/types.js.map +1 -1
  44. package/cache/inmemory/writeToStore.js +152 -25
  45. package/cache/inmemory/writeToStore.js.map +1 -1
  46. package/config/jest/setup.js +2 -0
  47. package/config/jest/setup.js.map +1 -1
  48. package/core/ApolloClient.d.ts +264 -3
  49. package/core/ApolloClient.js +235 -7
  50. package/core/ApolloClient.js.map +1 -1
  51. package/core/LocalState.d.ts +4 -6
  52. package/core/LocalState.js +56 -18
  53. package/core/LocalState.js.map +1 -1
  54. package/core/ObservableQuery.d.ts +25 -0
  55. package/core/ObservableQuery.js +239 -30
  56. package/core/ObservableQuery.js.map +1 -1
  57. package/core/QueryInfo.d.ts +3 -3
  58. package/core/QueryInfo.js +116 -13
  59. package/core/QueryInfo.js.map +1 -1
  60. package/core/QueryManager.d.ts +4 -0
  61. package/core/QueryManager.js +229 -33
  62. package/core/QueryManager.js.map +1 -1
  63. package/core/core.cjs +112 -103
  64. package/core/core.cjs.map +1 -1
  65. package/core/core.cjs.native.js +112 -103
  66. package/core/equalByQuery.js +20 -1
  67. package/core/equalByQuery.js.map +1 -1
  68. package/core/index.d.ts +1 -1
  69. package/core/index.js +19 -0
  70. package/core/index.js.map +1 -1
  71. package/core/networkStatus.d.ts +39 -0
  72. package/core/networkStatus.js +39 -0
  73. package/core/networkStatus.js.map +1 -1
  74. package/core/types.d.ts +9 -0
  75. package/core/types.js.map +1 -1
  76. package/core/watchQueryOptions.d.ts +225 -1
  77. package/core/watchQueryOptions.js.map +1 -1
  78. package/dev/dev.cjs +5 -111
  79. package/dev/dev.cjs.map +1 -1
  80. package/dev/dev.cjs.native.js +5 -111
  81. package/dev/loadErrorMessageHandler.js.map +1 -1
  82. package/errors/errors.cjs +1 -1
  83. package/errors/errors.cjs.map +1 -1
  84. package/errors/errors.cjs.native.js +1 -1
  85. package/errors/index.js +14 -1
  86. package/errors/index.js.map +1 -1
  87. package/invariantErrorCodes.js +1 -0
  88. package/link/batch/batch.cjs +2 -2
  89. package/link/batch/batch.cjs.map +1 -1
  90. package/link/batch/batch.cjs.native.js +2 -2
  91. package/link/batch/batchLink.d.ts +21 -0
  92. package/link/batch/batchLink.js +2 -1
  93. package/link/batch/batchLink.js.map +1 -1
  94. package/link/batch/batching.js +24 -1
  95. package/link/batch/batching.js.map +1 -1
  96. package/link/batch-http/batch-http.cjs +3 -2
  97. package/link/batch-http/batch-http.cjs.map +1 -1
  98. package/link/batch-http/batch-http.cjs.native.js +3 -2
  99. package/link/batch-http/batchHttpLink.d.ts +4 -0
  100. package/link/batch-http/batchHttpLink.js +53 -2
  101. package/link/batch-http/batchHttpLink.js.map +1 -1
  102. package/link/context/context.cjs.map +1 -1
  103. package/link/context/index.js +1 -0
  104. package/link/context/index.js.map +1 -1
  105. package/link/core/ApolloLink.js +12 -5
  106. package/link/core/ApolloLink.js.map +1 -1
  107. package/link/core/core.cjs +5 -5
  108. package/link/core/core.cjs.map +1 -1
  109. package/link/core/core.cjs.native.js +5 -5
  110. package/link/error/error.cjs +1 -1
  111. package/link/error/error.cjs.map +1 -1
  112. package/link/error/error.cjs.native.js +1 -1
  113. package/link/error/index.d.ts +3 -0
  114. package/link/error/index.js +4 -1
  115. package/link/error/index.js.map +1 -1
  116. package/link/http/HttpLink.d.ts +0 -2
  117. package/link/http/HttpLink.js +1 -1
  118. package/link/http/HttpLink.js.map +1 -1
  119. package/link/http/checkFetcher.d.ts +1 -1
  120. package/link/http/checkFetcher.js.map +1 -1
  121. package/link/http/createHttpLink.js +23 -1
  122. package/link/http/createHttpLink.js.map +1 -1
  123. package/link/http/createSignalIfSupported.d.ts +5 -0
  124. package/link/http/createSignalIfSupported.js +5 -0
  125. package/link/http/createSignalIfSupported.js.map +1 -1
  126. package/link/http/http.cjs +14 -15
  127. package/link/http/http.cjs.map +1 -1
  128. package/link/http/http.cjs.native.js +14 -15
  129. package/link/http/index.js +2 -1
  130. package/link/http/index.js.map +1 -1
  131. package/link/http/iterators/async.d.ts +4 -0
  132. package/link/http/iterators/async.js +4 -0
  133. package/link/http/iterators/async.js.map +1 -1
  134. package/link/http/iterators/nodeStream.d.ts +4 -0
  135. package/link/http/iterators/nodeStream.js +4 -0
  136. package/link/http/iterators/nodeStream.js.map +1 -1
  137. package/link/http/iterators/promise.d.ts +4 -0
  138. package/link/http/iterators/promise.js +4 -0
  139. package/link/http/iterators/promise.js.map +1 -1
  140. package/link/http/iterators/reader.d.ts +4 -0
  141. package/link/http/iterators/reader.js +4 -0
  142. package/link/http/iterators/reader.js.map +1 -1
  143. package/link/http/parseAndCheckHttpResponse.js +50 -13
  144. package/link/http/parseAndCheckHttpResponse.js.map +1 -1
  145. package/link/http/responseIterator.d.ts +4 -0
  146. package/link/http/responseIterator.js +6 -0
  147. package/link/http/responseIterator.js.map +1 -1
  148. package/link/http/rewriteURIForGET.d.ts +1 -1
  149. package/link/http/rewriteURIForGET.js +10 -0
  150. package/link/http/rewriteURIForGET.js.map +1 -1
  151. package/link/http/selectHttpOptionsAndBody.d.ts +46 -1
  152. package/link/http/selectHttpOptionsAndBody.js +23 -0
  153. package/link/http/selectHttpOptionsAndBody.js.map +1 -1
  154. package/link/http/selectURI.js.map +1 -1
  155. package/link/http/serializeFetchParameter.js.map +1 -1
  156. package/link/persisted-queries/index.js +34 -4
  157. package/link/persisted-queries/index.js.map +1 -1
  158. package/link/persisted-queries/persisted-queries.cjs +4 -4
  159. package/link/persisted-queries/persisted-queries.cjs.map +1 -1
  160. package/link/persisted-queries/persisted-queries.cjs.native.js +4 -4
  161. package/link/remove-typename/remove-typename.cjs +12 -9
  162. package/link/remove-typename/remove-typename.cjs.map +1 -1
  163. package/link/remove-typename/remove-typename.cjs.native.js +12 -9
  164. package/link/remove-typename/removeTypenameFromVariables.js +12 -9
  165. package/link/remove-typename/removeTypenameFromVariables.js.map +1 -1
  166. package/link/retry/delayFunction.d.ts +29 -0
  167. package/link/retry/delayFunction.js +6 -0
  168. package/link/retry/delayFunction.js.map +1 -1
  169. package/link/retry/retry.cjs +5 -5
  170. package/link/retry/retry.cjs.map +1 -1
  171. package/link/retry/retry.cjs.native.js +5 -5
  172. package/link/retry/retryFunction.d.ts +20 -0
  173. package/link/retry/retryLink.d.ts +6 -0
  174. package/link/retry/retryLink.js +31 -6
  175. package/link/retry/retryLink.js.map +1 -1
  176. package/link/schema/index.d.ts +13 -0
  177. package/link/schema/index.js +3 -3
  178. package/link/schema/index.js.map +1 -1
  179. package/link/schema/schema.cjs +3 -3
  180. package/link/schema/schema.cjs.map +1 -1
  181. package/link/schema/schema.cjs.native.js +3 -3
  182. package/link/subscriptions/index.js +35 -2
  183. package/link/subscriptions/index.js.map +1 -1
  184. package/link/subscriptions/subscriptions.cjs +3 -2
  185. package/link/subscriptions/subscriptions.cjs.map +1 -1
  186. package/link/subscriptions/subscriptions.cjs.native.js +3 -2
  187. package/link/utils/createOperation.js.map +1 -1
  188. package/link/utils/filterOperationVariables.js +4 -0
  189. package/link/utils/filterOperationVariables.js.map +1 -1
  190. package/link/utils/toPromise.js.map +1 -1
  191. package/link/utils/transformOperation.js +3 -2
  192. package/link/utils/transformOperation.js.map +1 -1
  193. package/link/utils/utils.cjs +2 -2
  194. package/link/utils/utils.cjs.map +1 -1
  195. package/link/utils/utils.cjs.native.js +2 -2
  196. package/link/utils/validateOperation.js.map +1 -1
  197. package/link/ws/index.d.ts +12 -0
  198. package/link/ws/index.js +1 -1
  199. package/link/ws/index.js.map +1 -1
  200. package/link/ws/ws.cjs +1 -1
  201. package/link/ws/ws.cjs.map +1 -1
  202. package/link/ws/ws.cjs.native.js +1 -1
  203. package/package.json +56 -45
  204. package/react/cache/QueryReference.d.ts +6 -1
  205. package/react/cache/QueryReference.js +26 -1
  206. package/react/cache/QueryReference.js.map +1 -1
  207. package/react/cache/SuspenseCache.d.ts +10 -0
  208. package/react/cache/SuspenseCache.js +1 -1
  209. package/react/cache/SuspenseCache.js.map +1 -1
  210. package/react/cache/getSuspenseCache.js.map +1 -1
  211. package/react/context/ApolloContext.d.ts +5 -0
  212. package/react/context/ApolloContext.js +10 -3
  213. package/react/context/ApolloContext.js.map +1 -1
  214. package/react/context/context.cjs +1 -3
  215. package/react/context/context.cjs.map +1 -1
  216. package/react/context/context.cjs.native.js +1 -3
  217. package/react/hoc/graphql.js.map +1 -1
  218. package/react/hoc/hoc-utils.js +3 -1
  219. package/react/hoc/hoc-utils.js.map +1 -1
  220. package/react/hoc/hoc.cjs +9 -17
  221. package/react/hoc/hoc.cjs.map +1 -1
  222. package/react/hoc/hoc.cjs.native.js +9 -17
  223. package/react/hoc/mutation-hoc.js +9 -4
  224. package/react/hoc/mutation-hoc.js.map +1 -1
  225. package/react/hoc/query-hoc.js +10 -4
  226. package/react/hoc/query-hoc.js.map +1 -1
  227. package/react/hoc/subscription-hoc.js +10 -4
  228. package/react/hoc/subscription-hoc.js.map +1 -1
  229. package/react/hoc/withApollo.js +3 -4
  230. package/react/hoc/withApollo.js.map +1 -1
  231. package/react/hooks/hooks.cjs +72 -57
  232. package/react/hooks/hooks.cjs.map +1 -1
  233. package/react/hooks/hooks.cjs.native.js +72 -57
  234. package/react/hooks/internal/__use.js +5 -0
  235. package/react/hooks/internal/__use.js.map +1 -1
  236. package/react/hooks/internal/index.d.ts +1 -0
  237. package/react/hooks/internal/index.js +2 -0
  238. package/react/hooks/internal/index.js.map +1 -1
  239. package/react/hooks/internal/useDeepMemo.js.map +1 -1
  240. package/react/hooks/internal/useIsomorphicLayoutEffect.js +6 -3
  241. package/react/hooks/internal/useIsomorphicLayoutEffect.js.map +1 -1
  242. package/react/hooks/internal/useLazyRef.d.ts +3 -0
  243. package/react/hooks/internal/useLazyRef.js +10 -0
  244. package/react/hooks/internal/useLazyRef.js.map +1 -0
  245. package/react/hooks/useBackgroundQuery.js +6 -0
  246. package/react/hooks/useBackgroundQuery.js.map +1 -1
  247. package/react/hooks/useFragment.js +21 -17
  248. package/react/hooks/useFragment.js.map +1 -1
  249. package/react/hooks/useLazyQuery.js +13 -4
  250. package/react/hooks/useLazyQuery.js.map +1 -1
  251. package/react/hooks/useMutation.js +8 -3
  252. package/react/hooks/useMutation.js.map +1 -1
  253. package/react/hooks/useQuery.d.ts +11 -0
  254. package/react/hooks/useQuery.js +137 -5
  255. package/react/hooks/useQuery.js.map +1 -1
  256. package/react/hooks/useReactiveVar.js +5 -0
  257. package/react/hooks/useReactiveVar.js.map +1 -1
  258. package/react/hooks/useReadQuery.d.ts +19 -0
  259. package/react/hooks/useReadQuery.js.map +1 -1
  260. package/react/hooks/useSubscription.js +5 -0
  261. package/react/hooks/useSubscription.js.map +1 -1
  262. package/react/hooks/useSuspenseQuery.js +11 -5
  263. package/react/hooks/useSuspenseQuery.js.map +1 -1
  264. package/react/hooks/useSyncExternalStore.js +53 -1
  265. package/react/hooks/useSyncExternalStore.js.map +1 -1
  266. package/react/parser/index.js +4 -5
  267. package/react/parser/index.js.map +1 -1
  268. package/react/parser/parser.cjs +2 -4
  269. package/react/parser/parser.cjs.map +1 -1
  270. package/react/parser/parser.cjs.native.js +2 -4
  271. package/react/ssr/RenderPromises.js +21 -1
  272. package/react/ssr/RenderPromises.js.map +1 -1
  273. package/react/ssr/getDataFromTree.js +18 -3
  274. package/react/ssr/getDataFromTree.js.map +1 -1
  275. package/react/ssr/ssr.cjs +6 -4
  276. package/react/ssr/ssr.cjs.map +1 -1
  277. package/react/ssr/ssr.cjs.native.js +6 -4
  278. package/react/types/types.d.ts +66 -0
  279. package/testing/core/core.cjs +18 -13
  280. package/testing/core/core.cjs.map +1 -1
  281. package/testing/core/core.cjs.native.js +18 -13
  282. package/testing/core/itAsync.d.ts +1 -1
  283. package/testing/core/itAsync.js.map +1 -1
  284. package/testing/core/mocking/mockFetch.d.ts +2 -2
  285. package/testing/core/mocking/mockFetch.js +8 -4
  286. package/testing/core/mocking/mockFetch.js.map +1 -1
  287. package/testing/core/mocking/mockLink.js +25 -9
  288. package/testing/core/mocking/mockLink.js.map +1 -1
  289. package/testing/core/mocking/mockQueryManager.js +2 -0
  290. package/testing/core/mocking/mockQueryManager.js.map +1 -1
  291. package/testing/core/mocking/mockSubscriptionLink.d.ts +1 -1
  292. package/testing/core/mocking/mockSubscriptionLink.js +1 -1
  293. package/testing/core/mocking/mockSubscriptionLink.js.map +1 -1
  294. package/testing/core/mocking/mockWatchQuery.js +1 -1
  295. package/testing/core/mocking/mockWatchQuery.js.map +1 -1
  296. package/testing/core/observableToPromise.d.ts +17 -3
  297. package/testing/core/observableToPromise.js +5 -0
  298. package/testing/core/observableToPromise.js.map +1 -1
  299. package/testing/core/subscribeAndCount.js +3 -0
  300. package/testing/core/subscribeAndCount.js.map +1 -1
  301. package/testing/core/wait.js +2 -2
  302. package/testing/core/wait.js.map +1 -1
  303. package/testing/core/withConsoleSpy.d.ts +3 -0
  304. package/testing/core/withConsoleSpy.js +7 -1
  305. package/testing/core/withConsoleSpy.js.map +1 -1
  306. package/testing/core/wrap.js +2 -0
  307. package/testing/core/wrap.js.map +1 -1
  308. package/testing/internal/ObservableStream.js +14 -14
  309. package/testing/internal/ObservableStream.js.map +1 -1
  310. package/testing/internal/disposables/spyOnConsole.d.ts +1 -0
  311. package/testing/internal/disposables/spyOnConsole.js +2 -0
  312. package/testing/internal/disposables/spyOnConsole.js.map +1 -1
  313. package/testing/internal/disposables/withCleanup.d.ts +1 -0
  314. package/testing/internal/disposables/withCleanup.js +3 -0
  315. package/testing/internal/disposables/withCleanup.js.map +1 -1
  316. package/testing/internal/profile/Render.d.ts +28 -0
  317. package/testing/internal/profile/Render.js +12 -1
  318. package/testing/internal/profile/Render.js.map +1 -1
  319. package/testing/internal/profile/profile.d.ts +44 -7
  320. package/testing/internal/profile/profile.js +63 -51
  321. package/testing/internal/profile/profile.js.map +1 -1
  322. package/testing/internal/profile/traces.d.ts +4 -0
  323. package/testing/internal/profile/traces.js +9 -5
  324. package/testing/internal/profile/traces.js.map +1 -1
  325. package/testing/matchers/ProfiledComponent.js +27 -22
  326. package/testing/matchers/ProfiledComponent.js.map +1 -1
  327. package/testing/matchers/toHaveSuspenseCacheEntryUsing.js.map +1 -1
  328. package/testing/matchers/toMatchDocument.js.map +1 -1
  329. package/testing/react/MockedProvider.d.ts +4 -0
  330. package/testing/react/MockedProvider.js +6 -2
  331. package/testing/react/MockedProvider.js.map +1 -1
  332. package/testing/testing.cjs +4 -2
  333. package/testing/testing.cjs.map +1 -1
  334. package/testing/testing.cjs.native.js +4 -2
  335. package/utilities/common/arrays.js +1 -0
  336. package/utilities/common/arrays.js.map +1 -1
  337. package/utilities/common/canUse.js +16 -1
  338. package/utilities/common/canUse.js.map +1 -1
  339. package/utilities/common/cloneDeep.d.ts +3 -0
  340. package/utilities/common/cloneDeep.js +5 -0
  341. package/utilities/common/cloneDeep.js.map +1 -1
  342. package/utilities/common/compact.d.ts +4 -0
  343. package/utilities/common/compact.js +4 -0
  344. package/utilities/common/compact.js.map +1 -1
  345. package/utilities/common/errorHandling.js +1 -3
  346. package/utilities/common/errorHandling.js.map +1 -1
  347. package/utilities/common/incrementalResult.js +3 -0
  348. package/utilities/common/incrementalResult.js.map +1 -1
  349. package/utilities/common/makeUniqueId.js +2 -0
  350. package/utilities/common/makeUniqueId.js.map +1 -1
  351. package/utilities/common/maybeDeepFreeze.js +3 -0
  352. package/utilities/common/maybeDeepFreeze.js.map +1 -1
  353. package/utilities/common/mergeDeep.js +12 -1
  354. package/utilities/common/mergeDeep.js.map +1 -1
  355. package/utilities/common/mergeOptions.d.ts +1 -1
  356. package/utilities/common/mergeOptions.js.map +1 -1
  357. package/utilities/common/omitDeep.js.map +1 -1
  358. package/utilities/globals/global.js +7 -1
  359. package/utilities/globals/global.js.map +1 -1
  360. package/utilities/globals/globals.cjs +4 -5
  361. package/utilities/globals/globals.cjs.map +1 -1
  362. package/utilities/globals/globals.cjs.native.js +4 -5
  363. package/utilities/globals/index.d.ts +4 -0
  364. package/utilities/globals/index.js +7 -0
  365. package/utilities/globals/index.js.map +1 -1
  366. package/utilities/globals/invariantWrappers.d.ts +40 -0
  367. package/utilities/globals/invariantWrappers.js +11 -3
  368. package/utilities/globals/invariantWrappers.js.map +1 -1
  369. package/utilities/globals/maybe.js.map +1 -1
  370. package/utilities/graphql/DocumentTransform.js +19 -6
  371. package/utilities/graphql/DocumentTransform.js.map +1 -1
  372. package/utilities/graphql/directives.js +3 -0
  373. package/utilities/graphql/directives.js.map +1 -1
  374. package/utilities/graphql/fragments.d.ts +25 -0
  375. package/utilities/graphql/fragments.js +36 -0
  376. package/utilities/graphql/fragments.js.map +1 -1
  377. package/utilities/graphql/getFromAST.d.ts +5 -0
  378. package/utilities/graphql/getFromAST.js +9 -0
  379. package/utilities/graphql/getFromAST.js.map +1 -1
  380. package/utilities/graphql/print.js.map +1 -1
  381. package/utilities/graphql/storeUtils.d.ts +14 -0
  382. package/utilities/graphql/storeUtils.js +7 -2
  383. package/utilities/graphql/storeUtils.js.map +1 -1
  384. package/utilities/graphql/transform.js +106 -7
  385. package/utilities/graphql/transform.js.map +1 -1
  386. package/utilities/observables/Concast.d.ts +1 -1
  387. package/utilities/observables/Concast.js +84 -1
  388. package/utilities/observables/Concast.js.map +1 -1
  389. package/utilities/observables/Observable.js +6 -0
  390. package/utilities/observables/Observable.js.map +1 -1
  391. package/utilities/observables/asyncMap.js +12 -3
  392. package/utilities/observables/asyncMap.js.map +1 -1
  393. package/utilities/observables/iteration.js +3 -0
  394. package/utilities/observables/iteration.js.map +1 -1
  395. package/utilities/observables/subclassing.js +14 -0
  396. package/utilities/observables/subclassing.js.map +1 -1
  397. package/utilities/policies/pagination.js +47 -3
  398. package/utilities/policies/pagination.js.map +1 -1
  399. package/utilities/promises/decoration.js +1 -0
  400. package/utilities/promises/decoration.js.map +1 -1
  401. package/utilities/types/DeepOmit.js.map +1 -1
  402. package/utilities/types/DeepPartial.d.ts +1 -1
  403. package/utilities/types/DeepPartial.js +4 -0
  404. package/utilities/types/DeepPartial.js.map +1 -1
  405. package/utilities/types/IsStrictlyAny.js.map +1 -1
  406. package/utilities/types/TODO.d.ts +3 -0
  407. package/utilities/types/TODO.js +2 -0
  408. package/utilities/types/TODO.js.map +1 -0
  409. package/utilities/utilities.cjs +31 -27
  410. package/utilities/utilities.cjs.map +1 -1
  411. package/utilities/utilities.cjs.native.js +31 -27
  412. package/version.js +1 -1
  413. package/cache/core/cache.d.ts.map +0 -1
  414. package/cache/core/types/Cache.d.ts.map +0 -1
  415. package/cache/core/types/DataProxy.d.ts.map +0 -1
  416. package/cache/core/types/common.d.ts.map +0 -1
  417. package/cache/index.d.ts.map +0 -1
  418. package/cache/inmemory/entityStore.d.ts.map +0 -1
  419. package/cache/inmemory/fixPolyfills.d.ts.map +0 -1
  420. package/cache/inmemory/fixPolyfills.native.d.ts.map +0 -1
  421. package/cache/inmemory/fragmentRegistry.d.ts.map +0 -1
  422. package/cache/inmemory/helpers.d.ts.map +0 -1
  423. package/cache/inmemory/inMemoryCache.d.ts.map +0 -1
  424. package/cache/inmemory/key-extractor.d.ts.map +0 -1
  425. package/cache/inmemory/object-canon.d.ts.map +0 -1
  426. package/cache/inmemory/policies.d.ts.map +0 -1
  427. package/cache/inmemory/reactiveVars.d.ts.map +0 -1
  428. package/cache/inmemory/readFromStore.d.ts.map +0 -1
  429. package/cache/inmemory/types.d.ts.map +0 -1
  430. package/cache/inmemory/writeToStore.d.ts.map +0 -1
  431. package/config/jest/setup.d.ts.map +0 -1
  432. package/core/ApolloClient.d.ts.map +0 -1
  433. package/core/LocalState.d.ts.map +0 -1
  434. package/core/ObservableQuery.d.ts.map +0 -1
  435. package/core/QueryInfo.d.ts.map +0 -1
  436. package/core/QueryManager.d.ts.map +0 -1
  437. package/core/equalByQuery.d.ts.map +0 -1
  438. package/core/index.d.ts.map +0 -1
  439. package/core/networkStatus.d.ts.map +0 -1
  440. package/core/types.d.ts.map +0 -1
  441. package/core/watchQueryOptions.d.ts.map +0 -1
  442. package/dev/index.d.ts.map +0 -1
  443. package/dev/loadDevMessages.d.ts.map +0 -1
  444. package/dev/loadErrorMessageHandler.d.ts.map +0 -1
  445. package/dev/loadErrorMessages.d.ts.map +0 -1
  446. package/errors/index.d.ts.map +0 -1
  447. package/index.d.ts.map +0 -1
  448. package/invariantErrorCodes.d.ts.map +0 -1
  449. package/link/batch/batchLink.d.ts.map +0 -1
  450. package/link/batch/batching.d.ts.map +0 -1
  451. package/link/batch/index.d.ts.map +0 -1
  452. package/link/batch-http/batchHttpLink.d.ts.map +0 -1
  453. package/link/batch-http/index.d.ts.map +0 -1
  454. package/link/context/index.d.ts.map +0 -1
  455. package/link/core/ApolloLink.d.ts.map +0 -1
  456. package/link/core/concat.d.ts.map +0 -1
  457. package/link/core/empty.d.ts.map +0 -1
  458. package/link/core/execute.d.ts.map +0 -1
  459. package/link/core/from.d.ts.map +0 -1
  460. package/link/core/index.d.ts.map +0 -1
  461. package/link/core/split.d.ts.map +0 -1
  462. package/link/core/types.d.ts.map +0 -1
  463. package/link/error/index.d.ts.map +0 -1
  464. package/link/http/HttpLink.d.ts.map +0 -1
  465. package/link/http/checkFetcher.d.ts.map +0 -1
  466. package/link/http/createHttpLink.d.ts.map +0 -1
  467. package/link/http/createSignalIfSupported.d.ts.map +0 -1
  468. package/link/http/index.d.ts.map +0 -1
  469. package/link/http/iterators/async.d.ts.map +0 -1
  470. package/link/http/iterators/nodeStream.d.ts.map +0 -1
  471. package/link/http/iterators/promise.d.ts.map +0 -1
  472. package/link/http/iterators/reader.d.ts.map +0 -1
  473. package/link/http/parseAndCheckHttpResponse.d.ts.map +0 -1
  474. package/link/http/responseIterator.d.ts.map +0 -1
  475. package/link/http/rewriteURIForGET.d.ts.map +0 -1
  476. package/link/http/selectHttpOptionsAndBody.d.ts.map +0 -1
  477. package/link/http/selectURI.d.ts.map +0 -1
  478. package/link/http/serializeFetchParameter.d.ts.map +0 -1
  479. package/link/persisted-queries/index.d.ts.map +0 -1
  480. package/link/remove-typename/index.d.ts.map +0 -1
  481. package/link/remove-typename/removeTypenameFromVariables.d.ts.map +0 -1
  482. package/link/retry/delayFunction.d.ts.map +0 -1
  483. package/link/retry/index.d.ts.map +0 -1
  484. package/link/retry/retryFunction.d.ts.map +0 -1
  485. package/link/retry/retryLink.d.ts.map +0 -1
  486. package/link/schema/index.d.ts.map +0 -1
  487. package/link/subscriptions/index.d.ts.map +0 -1
  488. package/link/utils/createOperation.d.ts.map +0 -1
  489. package/link/utils/filterOperationVariables.d.ts.map +0 -1
  490. package/link/utils/fromError.d.ts.map +0 -1
  491. package/link/utils/fromPromise.d.ts.map +0 -1
  492. package/link/utils/index.d.ts.map +0 -1
  493. package/link/utils/throwServerError.d.ts.map +0 -1
  494. package/link/utils/toPromise.d.ts.map +0 -1
  495. package/link/utils/transformOperation.d.ts.map +0 -1
  496. package/link/utils/validateOperation.d.ts.map +0 -1
  497. package/link/ws/index.d.ts.map +0 -1
  498. package/react/cache/QueryReference.d.ts.map +0 -1
  499. package/react/cache/SuspenseCache.d.ts.map +0 -1
  500. package/react/cache/getSuspenseCache.d.ts.map +0 -1
  501. package/react/cache/index.d.ts.map +0 -1
  502. package/react/cache/types.d.ts.map +0 -1
  503. package/react/components/Mutation.d.ts.map +0 -1
  504. package/react/components/Query.d.ts.map +0 -1
  505. package/react/components/Subscription.d.ts.map +0 -1
  506. package/react/components/index.d.ts.map +0 -1
  507. package/react/components/types.d.ts.map +0 -1
  508. package/react/context/ApolloConsumer.d.ts.map +0 -1
  509. package/react/context/ApolloContext.d.ts.map +0 -1
  510. package/react/context/ApolloProvider.d.ts.map +0 -1
  511. package/react/context/index.d.ts.map +0 -1
  512. package/react/hoc/graphql.d.ts.map +0 -1
  513. package/react/hoc/hoc-utils.d.ts.map +0 -1
  514. package/react/hoc/index.d.ts.map +0 -1
  515. package/react/hoc/mutation-hoc.d.ts.map +0 -1
  516. package/react/hoc/query-hoc.d.ts.map +0 -1
  517. package/react/hoc/subscription-hoc.d.ts.map +0 -1
  518. package/react/hoc/types.d.ts.map +0 -1
  519. package/react/hoc/withApollo.d.ts.map +0 -1
  520. package/react/hooks/constants.d.ts.map +0 -1
  521. package/react/hooks/index.d.ts.map +0 -1
  522. package/react/hooks/internal/__use.d.ts.map +0 -1
  523. package/react/hooks/internal/index.d.ts.map +0 -1
  524. package/react/hooks/internal/useDeepMemo.d.ts.map +0 -1
  525. package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts.map +0 -1
  526. package/react/hooks/useApolloClient.d.ts.map +0 -1
  527. package/react/hooks/useBackgroundQuery.d.ts.map +0 -1
  528. package/react/hooks/useFragment.d.ts.map +0 -1
  529. package/react/hooks/useLazyQuery.d.ts.map +0 -1
  530. package/react/hooks/useMutation.d.ts.map +0 -1
  531. package/react/hooks/useQuery.d.ts.map +0 -1
  532. package/react/hooks/useReactiveVar.d.ts.map +0 -1
  533. package/react/hooks/useReadQuery.d.ts.map +0 -1
  534. package/react/hooks/useSubscription.d.ts.map +0 -1
  535. package/react/hooks/useSuspenseQuery.d.ts.map +0 -1
  536. package/react/hooks/useSyncExternalStore.d.ts.map +0 -1
  537. package/react/index.d.ts.map +0 -1
  538. package/react/parser/index.d.ts.map +0 -1
  539. package/react/ssr/RenderPromises.d.ts.map +0 -1
  540. package/react/ssr/getDataFromTree.d.ts.map +0 -1
  541. package/react/ssr/index.d.ts.map +0 -1
  542. package/react/ssr/renderToStringWithData.d.ts.map +0 -1
  543. package/react/types/types.d.ts.map +0 -1
  544. package/testing/core/index.d.ts.map +0 -1
  545. package/testing/core/itAsync.d.ts.map +0 -1
  546. package/testing/core/mocking/mockClient.d.ts.map +0 -1
  547. package/testing/core/mocking/mockFetch.d.ts.map +0 -1
  548. package/testing/core/mocking/mockLink.d.ts.map +0 -1
  549. package/testing/core/mocking/mockQueryManager.d.ts.map +0 -1
  550. package/testing/core/mocking/mockSubscriptionLink.d.ts.map +0 -1
  551. package/testing/core/mocking/mockWatchQuery.d.ts.map +0 -1
  552. package/testing/core/observableToPromise.d.ts.map +0 -1
  553. package/testing/core/subscribeAndCount.d.ts.map +0 -1
  554. package/testing/core/wait.d.ts.map +0 -1
  555. package/testing/core/withConsoleSpy.d.ts.map +0 -1
  556. package/testing/core/wrap.d.ts.map +0 -1
  557. package/testing/index.d.ts.map +0 -1
  558. package/testing/internal/ObservableStream.d.ts.map +0 -1
  559. package/testing/internal/disposables/index.d.ts.map +0 -1
  560. package/testing/internal/disposables/spyOnConsole.d.ts.map +0 -1
  561. package/testing/internal/disposables/withCleanup.d.ts.map +0 -1
  562. package/testing/internal/index.d.ts.map +0 -1
  563. package/testing/internal/profile/Render.d.ts.map +0 -1
  564. package/testing/internal/profile/index.d.ts.map +0 -1
  565. package/testing/internal/profile/profile.d.ts.map +0 -1
  566. package/testing/internal/profile/traces.d.ts.map +0 -1
  567. package/testing/matchers/ProfiledComponent.d.ts.map +0 -1
  568. package/testing/matchers/index.d.ts.map +0 -1
  569. package/testing/matchers/toHaveSuspenseCacheEntryUsing.d.ts.map +0 -1
  570. package/testing/matchers/toMatchDocument.d.ts.map +0 -1
  571. package/testing/react/MockedProvider.d.ts.map +0 -1
  572. package/utilities/common/arrays.d.ts.map +0 -1
  573. package/utilities/common/canUse.d.ts.map +0 -1
  574. package/utilities/common/cloneDeep.d.ts.map +0 -1
  575. package/utilities/common/compact.d.ts.map +0 -1
  576. package/utilities/common/errorHandling.d.ts.map +0 -1
  577. package/utilities/common/filterInPlace.d.ts +0 -2
  578. package/utilities/common/filterInPlace.d.ts.map +0 -1
  579. package/utilities/common/filterInPlace.js +0 -11
  580. package/utilities/common/filterInPlace.js.map +0 -1
  581. package/utilities/common/incrementalResult.d.ts.map +0 -1
  582. package/utilities/common/makeUniqueId.d.ts.map +0 -1
  583. package/utilities/common/maybeDeepFreeze.d.ts.map +0 -1
  584. package/utilities/common/mergeDeep.d.ts.map +0 -1
  585. package/utilities/common/mergeOptions.d.ts.map +0 -1
  586. package/utilities/common/objects.d.ts.map +0 -1
  587. package/utilities/common/omitDeep.d.ts.map +0 -1
  588. package/utilities/common/stringifyForDisplay.d.ts.map +0 -1
  589. package/utilities/common/stripTypename.d.ts.map +0 -1
  590. package/utilities/globals/global.d.ts.map +0 -1
  591. package/utilities/globals/index.d.ts.map +0 -1
  592. package/utilities/globals/invariantWrappers.d.ts.map +0 -1
  593. package/utilities/globals/maybe.d.ts.map +0 -1
  594. package/utilities/graphql/DocumentTransform.d.ts.map +0 -1
  595. package/utilities/graphql/directives.d.ts.map +0 -1
  596. package/utilities/graphql/fragments.d.ts.map +0 -1
  597. package/utilities/graphql/getFromAST.d.ts.map +0 -1
  598. package/utilities/graphql/operations.d.ts.map +0 -1
  599. package/utilities/graphql/print.d.ts.map +0 -1
  600. package/utilities/graphql/storeUtils.d.ts.map +0 -1
  601. package/utilities/graphql/transform.d.ts.map +0 -1
  602. package/utilities/index.d.ts.map +0 -1
  603. package/utilities/observables/Concast.d.ts.map +0 -1
  604. package/utilities/observables/Observable.d.ts.map +0 -1
  605. package/utilities/observables/asyncMap.d.ts.map +0 -1
  606. package/utilities/observables/iteration.d.ts.map +0 -1
  607. package/utilities/observables/subclassing.d.ts.map +0 -1
  608. package/utilities/policies/pagination.d.ts.map +0 -1
  609. package/utilities/promises/decoration.d.ts.map +0 -1
  610. package/utilities/types/DeepOmit.d.ts.map +0 -1
  611. package/utilities/types/DeepPartial.d.ts.map +0 -1
  612. package/utilities/types/IsStrictlyAny.d.ts.map +0 -1
  613. package/utilities/types/Primitive.d.ts.map +0 -1
  614. package/version.d.ts.map +0 -1
@@ -19,7 +19,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
19
19
 
20
20
  var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal);
21
21
 
22
- var version = "3.8.7";
22
+ var version = "3.8.9";
23
23
 
24
24
  function isNonNullObject(obj) {
25
25
  return obj !== null && typeof obj === "object";
@@ -33,7 +33,7 @@ var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
33
33
  var defaultReconciler = function (target, source, property) {
34
34
  return this.merge(target[property], source[property]);
35
35
  };
36
- var DeepMerger = (function () {
36
+ var DeepMerger = (function () {
37
37
  function DeepMerger(reconciler) {
38
38
  if (reconciler === void 0) { reconciler = defaultReconciler; }
39
39
  this.reconciler = reconciler;
@@ -179,7 +179,8 @@ function equalBySelectionSet(selectionSet, aResult, bResult, context) {
179
179
  if (fragment) {
180
180
  if (selectionHasNonreactiveDirective(fragment))
181
181
  return true;
182
- return equalBySelectionSet(fragment.selectionSet, aResult, bResult, context);
182
+ return equalBySelectionSet(fragment.selectionSet,
183
+ aResult, bResult, context);
183
184
  }
184
185
  }
185
186
  });
@@ -192,7 +193,7 @@ function directiveIsNonreactive(dir) {
192
193
  }
193
194
 
194
195
  var assign = Object.assign, hasOwnProperty$1 = Object.hasOwnProperty;
195
- var ObservableQuery = (function (_super) {
196
+ var ObservableQuery = (function (_super) {
196
197
  tslib.__extends(ObservableQuery, _super);
197
198
  function ObservableQuery(_a) {
198
199
  var queryManager = _a.queryManager, queryInfo = _a.queryInfo, options = _a.options;
@@ -229,10 +230,12 @@ var ObservableQuery = (function (_super) {
229
230
  _this.waitForOwnResult = skipCacheDataFor(options.fetchPolicy);
230
231
  _this.isTornDown = false;
231
232
  var _b = queryManager.defaultOptions.watchQuery, _c = _b === void 0 ? {} : _b, _d = _c.fetchPolicy, defaultFetchPolicy = _d === void 0 ? "cache-first" : _d;
232
- var _e = options.fetchPolicy, fetchPolicy = _e === void 0 ? defaultFetchPolicy : _e, _f = options.initialFetchPolicy, initialFetchPolicy = _f === void 0 ? fetchPolicy === "standby"
233
- ? defaultFetchPolicy
234
- : fetchPolicy : _f;
235
- _this.options = tslib.__assign(tslib.__assign({}, options), { initialFetchPolicy: initialFetchPolicy, fetchPolicy: fetchPolicy });
233
+ var _e = options.fetchPolicy, fetchPolicy = _e === void 0 ? defaultFetchPolicy : _e,
234
+ _f = options.initialFetchPolicy,
235
+ initialFetchPolicy = _f === void 0 ? fetchPolicy === "standby" ? defaultFetchPolicy : (fetchPolicy) : _f;
236
+ _this.options = tslib.__assign(tslib.__assign({}, options), {
237
+ initialFetchPolicy: initialFetchPolicy,
238
+ fetchPolicy: fetchPolicy });
236
239
  _this.queryId = queryInfo.queryId || queryManager.generateQueryId();
237
240
  var opDef = utilities.getOperationDefinition(_this.query);
238
241
  _this.queryName = opDef && opDef.name && opDef.name.value;
@@ -279,7 +282,8 @@ var ObservableQuery = (function (_super) {
279
282
  exports.NetworkStatus.ready;
280
283
  var result = tslib.__assign(tslib.__assign({}, lastResult), { loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus });
281
284
  var _a = this.options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a;
282
- if (skipCacheDataFor(fetchPolicy) ||
285
+ if (
286
+ skipCacheDataFor(fetchPolicy) ||
283
287
  this.queryManager.getDocumentInfo(this.query).hasForcedResolvers) ;
284
288
  else if (this.waitForOwnResult) {
285
289
  this.queryInfo["updateWatch"]();
@@ -322,9 +326,8 @@ var ObservableQuery = (function (_super) {
322
326
  if (!this.last) {
323
327
  return true;
324
328
  }
325
- var resultIsDifferent = this.queryManager.getDocumentInfo(this.query)
326
- .hasNonreactiveDirective
327
- ? !equalByQuery(this.query, this.last.result, newResult, this.variables)
329
+ var resultIsDifferent = this.queryManager.getDocumentInfo(this.query).hasNonreactiveDirective ?
330
+ !equalByQuery(this.query, this.last.result, newResult, this.variables)
328
331
  : !equal.equal(this.last.result, newResult);
329
332
  return (resultIsDifferent || (variables && !equal.equal(this.last.variables, variables)));
330
333
  };
@@ -383,14 +386,14 @@ var ObservableQuery = (function (_super) {
383
386
  };
384
387
  ObservableQuery.prototype.fetchMore = function (fetchMoreOptions) {
385
388
  var _this = this;
386
- var combinedOptions = tslib.__assign(tslib.__assign({}, (fetchMoreOptions.query
387
- ? fetchMoreOptions
388
- : tslib.__assign(tslib.__assign(tslib.__assign(tslib.__assign({}, this.options), { query: this.options.query }), fetchMoreOptions), { variables: tslib.__assign(tslib.__assign({}, this.options.variables), fetchMoreOptions.variables) }))), { fetchPolicy: "no-cache" });
389
+ var combinedOptions = tslib.__assign(tslib.__assign({}, (fetchMoreOptions.query ? fetchMoreOptions : (tslib.__assign(tslib.__assign(tslib.__assign(tslib.__assign({}, this.options), { query: this.options.query }), fetchMoreOptions), { variables: tslib.__assign(tslib.__assign({}, this.options.variables), fetchMoreOptions.variables) })))), {
390
+ fetchPolicy: "no-cache" });
389
391
  combinedOptions.query = this.transformDocument(combinedOptions.query);
390
392
  var qid = this.queryManager.generateQueryId();
391
- this.lastQuery = fetchMoreOptions.query
392
- ? this.transformDocument(this.options.query)
393
- : combinedOptions.query;
393
+ this.lastQuery =
394
+ fetchMoreOptions.query ?
395
+ this.transformDocument(this.options.query)
396
+ : combinedOptions.query;
394
397
  var queryInfo = this.queryInfo;
395
398
  var originalNetworkStatus = queryInfo.networkStatus;
396
399
  queryInfo.networkStatus = exports.NetworkStatus.fetchMore;
@@ -525,7 +528,8 @@ var ObservableQuery = (function (_super) {
525
528
  this.options.pollInterval = 0;
526
529
  this.updatePolling();
527
530
  };
528
- ObservableQuery.prototype.applyNextFetchPolicy = function (reason, options) {
531
+ ObservableQuery.prototype.applyNextFetchPolicy = function (reason,
532
+ options) {
529
533
  if (options.nextFetchPolicy) {
530
534
  var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a, _b = options.initialFetchPolicy, initialFetchPolicy = _b === void 0 ? fetchPolicy : _b;
531
535
  if (fetchPolicy === "standby") ;
@@ -573,8 +577,8 @@ var ObservableQuery = (function (_super) {
573
577
  if (_this.pollingInfo) {
574
578
  if (!isNetworkRequestInFlight(_this.queryInfo.networkStatus)) {
575
579
  _this.reobserve({
576
- fetchPolicy: _this.options.initialFetchPolicy === "no-cache"
577
- ? "no-cache"
580
+ fetchPolicy: _this.options.initialFetchPolicy === "no-cache" ?
581
+ "no-cache"
578
582
  : "network-only",
579
583
  }, exports.NetworkStatus.poll).then(poll, poll);
580
584
  }
@@ -598,22 +602,22 @@ var ObservableQuery = (function (_super) {
598
602
  if (error && this.last && !equal.equal(variables, this.last.variables)) {
599
603
  error = void 0;
600
604
  }
601
- return (this.last = tslib.__assign({ result: this.queryManager.assumeImmutableResults
602
- ? newResult
605
+ return (this.last = tslib.__assign({ result: this.queryManager.assumeImmutableResults ?
606
+ newResult
603
607
  : utilities.cloneDeep(newResult), variables: variables }, (error ? { error: error } : null)));
604
608
  };
605
609
  ObservableQuery.prototype.reobserveAsConcast = function (newOptions, newNetworkStatus) {
606
610
  var _this = this;
607
611
  this.isTornDown = false;
608
- var useDisposableConcast = newNetworkStatus === exports.NetworkStatus.refetch ||
612
+ var useDisposableConcast =
613
+ newNetworkStatus === exports.NetworkStatus.refetch ||
609
614
  newNetworkStatus === exports.NetworkStatus.fetchMore ||
610
615
  newNetworkStatus === exports.NetworkStatus.poll;
611
616
  var oldVariables = this.options.variables;
612
617
  var oldFetchPolicy = this.options.fetchPolicy;
613
618
  var mergedOptions = utilities.compact(this.options, newOptions || {});
614
- var options = useDisposableConcast
615
- ?
616
- mergedOptions
619
+ var options = useDisposableConcast ?
620
+ mergedOptions
617
621
  : assign(this.options, mergedOptions);
618
622
  var query = this.transformDocument(options.query);
619
623
  this.lastQuery = query;
@@ -659,7 +663,8 @@ var ObservableQuery = (function (_super) {
659
663
  return concast;
660
664
  };
661
665
  ObservableQuery.prototype.reobserve = function (newOptions, newNetworkStatus) {
662
- return this.reobserveAsConcast(newOptions, newNetworkStatus).promise;
666
+ return this.reobserveAsConcast(newOptions, newNetworkStatus)
667
+ .promise;
663
668
  };
664
669
  ObservableQuery.prototype.resubscribeAfterError = function () {
665
670
  var args = [];
@@ -673,7 +678,8 @@ var ObservableQuery = (function (_super) {
673
678
  return subscription;
674
679
  };
675
680
  ObservableQuery.prototype.observe = function () {
676
- this.reportResult(this.getCurrentResult(false), this.variables);
681
+ this.reportResult(
682
+ this.getCurrentResult(false), this.variables);
677
683
  };
678
684
  ObservableQuery.prototype.reportResult = function (result, variables) {
679
685
  var lastError = this.getLastError();
@@ -719,10 +725,10 @@ function reobserveCacheFirst(obsQuery) {
719
725
  if (fetchPolicy === "cache-and-network" || fetchPolicy === "network-only") {
720
726
  return obsQuery.reobserve({
721
727
  fetchPolicy: "cache-first",
722
- nextFetchPolicy: function () {
728
+ nextFetchPolicy: function (currentFetchPolicy, context) {
723
729
  this.nextFetchPolicy = nextFetchPolicy;
724
- if (typeof nextFetchPolicy === "function") {
725
- return nextFetchPolicy.apply(this, arguments);
730
+ if (typeof this.nextFetchPolicy === "function") {
731
+ return this.nextFetchPolicy(currentFetchPolicy, context);
726
732
  }
727
733
  return fetchPolicy;
728
734
  },
@@ -738,13 +744,13 @@ function logMissingFieldErrors(missing) {
738
744
  globalThis.__DEV__ !== false && globals.invariant.debug(24, missing);
739
745
  }
740
746
  }
741
- function skipCacheDataFor(fetchPolicy) {
747
+ function skipCacheDataFor(fetchPolicy ) {
742
748
  return (fetchPolicy === "network-only" ||
743
749
  fetchPolicy === "no-cache" ||
744
750
  fetchPolicy === "standby");
745
751
  }
746
752
 
747
- var LocalState = (function () {
753
+ var LocalState = (function () {
748
754
  function LocalState(_a) {
749
755
  var cache = _a.cache, client = _a.client, resolvers = _a.resolvers, fragmentMatcher = _a.fragmentMatcher;
750
756
  this.selectionsToResolveCache = new WeakMap();
@@ -783,9 +789,9 @@ var LocalState = (function () {
783
789
  return tslib.__awaiter(this, void 0, void 0, function () {
784
790
  return tslib.__generator(this, function (_c) {
785
791
  if (document) {
786
- return [2, this.resolveDocument(document, remoteResult.data, context, variables, this.fragmentMatcher, onlyRunForcedResolvers).then(function (localResult) { return (tslib.__assign(tslib.__assign({}, remoteResult), { data: localResult.result })); })];
792
+ return [2 , this.resolveDocument(document, remoteResult.data, context, variables, this.fragmentMatcher, onlyRunForcedResolvers).then(function (localResult) { return (tslib.__assign(tslib.__assign({}, remoteResult), { data: localResult.result })); })];
787
793
  }
788
- return [2, remoteResult];
794
+ return [2 , remoteResult];
789
795
  });
790
796
  });
791
797
  };
@@ -808,7 +814,8 @@ var LocalState = (function () {
808
814
  };
809
815
  LocalState.prototype.prepareContext = function (context) {
810
816
  var cache = this.cache;
811
- return tslib.__assign(tslib.__assign({}, context), { cache: cache, getCacheKey: function (obj) {
817
+ return tslib.__assign(tslib.__assign({}, context), { cache: cache,
818
+ getCacheKey: function (obj) {
812
819
  return cache.identify(obj);
813
820
  } });
814
821
  };
@@ -818,9 +825,9 @@ var LocalState = (function () {
818
825
  return tslib.__awaiter(this, void 0, void 0, function () {
819
826
  return tslib.__generator(this, function (_a) {
820
827
  if (document) {
821
- return [2, this.resolveDocument(document, this.buildRootValueFromCache(document, variables) || {}, this.prepareContext(context), variables).then(function (data) { return (tslib.__assign(tslib.__assign({}, variables), data.exportedVariables)); })];
828
+ return [2 , this.resolveDocument(document, this.buildRootValueFromCache(document, variables) || {}, this.prepareContext(context), variables).then(function (data) { return (tslib.__assign(tslib.__assign({}, variables), data.exportedVariables)); })];
822
829
  }
823
- return [2, tslib.__assign({}, variables)];
830
+ return [2 , tslib.__assign({}, variables)];
824
831
  });
825
832
  });
826
833
  };
@@ -865,8 +872,8 @@ var LocalState = (function () {
865
872
  fragmentMap = utilities.createFragmentMap(fragments);
866
873
  selectionsToResolve = this.collectSelectionsToResolve(mainDefinition, fragmentMap);
867
874
  definitionOperation = mainDefinition.operation;
868
- defaultOperationType = definitionOperation
869
- ? definitionOperation.charAt(0).toUpperCase() +
875
+ defaultOperationType = definitionOperation ?
876
+ definitionOperation.charAt(0).toUpperCase() +
870
877
  definitionOperation.slice(1)
871
878
  : "Query";
872
879
  _a = this, cache = _a.cache, client = _a.client;
@@ -881,7 +888,7 @@ var LocalState = (function () {
881
888
  onlyRunForcedResolvers: onlyRunForcedResolvers,
882
889
  };
883
890
  isClientFieldDescendant = false;
884
- return [2, this.resolveSelectionSet(mainDefinition.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (result) { return ({
891
+ return [2 , this.resolveSelectionSet(mainDefinition.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (result) { return ({
885
892
  result: result,
886
893
  exportedVariables: execContext.exportedVariables,
887
894
  }); })];
@@ -900,13 +907,13 @@ var LocalState = (function () {
900
907
  return tslib.__generator(this, function (_a) {
901
908
  if (!isClientFieldDescendant &&
902
909
  !execContext.selectionsToResolve.has(selection)) {
903
- return [2];
910
+ return [2 ];
904
911
  }
905
912
  if (!utilities.shouldInclude(selection, variables)) {
906
- return [2];
913
+ return [2 ];
907
914
  }
908
915
  if (utilities.isField(selection)) {
909
- return [2, this.resolveField(selection, isClientFieldDescendant, rootValue, execContext).then(function (fieldResult) {
916
+ return [2 , this.resolveField(selection, isClientFieldDescendant, rootValue, execContext).then(function (fieldResult) {
910
917
  var _a;
911
918
  if (typeof fieldResult !== "undefined") {
912
919
  resultsToMerge.push((_a = {},
@@ -925,15 +932,15 @@ var LocalState = (function () {
925
932
  if (fragment && fragment.typeCondition) {
926
933
  typeCondition = fragment.typeCondition.name.value;
927
934
  if (execContext.fragmentMatcher(rootValue, typeCondition, context)) {
928
- return [2, this.resolveSelectionSet(fragment.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (fragmentResult) {
935
+ return [2 , this.resolveSelectionSet(fragment.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (fragmentResult) {
929
936
  resultsToMerge.push(fragmentResult);
930
937
  })];
931
938
  }
932
939
  }
933
- return [2];
940
+ return [2 ];
934
941
  });
935
942
  }); };
936
- return [2, Promise.all(selectionSet.selections.map(execute)).then(function () {
943
+ return [2 , Promise.all(selectionSet.selections.map(execute)).then(function () {
937
944
  return utilities.mergeDeepArray(resultsToMerge);
938
945
  })];
939
946
  });
@@ -945,7 +952,7 @@ var LocalState = (function () {
945
952
  var _this = this;
946
953
  return tslib.__generator(this, function (_a) {
947
954
  if (!rootValue) {
948
- return [2, null];
955
+ return [2 , null];
949
956
  }
950
957
  variables = execContext.variables;
951
958
  fieldName = field.name.value;
@@ -960,7 +967,8 @@ var LocalState = (function () {
960
967
  if (resolverMap) {
961
968
  resolve = resolverMap[aliasUsed ? fieldName : aliasedFieldName];
962
969
  if (resolve) {
963
- resultPromise = Promise.resolve(cache.cacheSlot.withValue(this.cache, resolve, [
970
+ resultPromise = Promise.resolve(
971
+ cache.cacheSlot.withValue(this.cache, resolve, [
964
972
  rootValue,
965
973
  utilities.argumentsObjectFromField(field, variables),
966
974
  execContext.context,
@@ -969,7 +977,7 @@ var LocalState = (function () {
969
977
  }
970
978
  }
971
979
  }
972
- return [2, resultPromise.then(function (result) {
980
+ return [2 , resultPromise.then(function (result) {
973
981
  var _a, _b;
974
982
  if (result === void 0) { result = defaultResult; }
975
983
  if (field.directives) {
@@ -1061,7 +1069,8 @@ function wrapDestructiveCacheMethod(cache, methodName) {
1061
1069
  var original = cache[methodName];
1062
1070
  if (typeof original === "function") {
1063
1071
  cache[methodName] = function () {
1064
- destructiveMethodCounts.set(cache, (destructiveMethodCounts.get(cache) + 1) % 1e15);
1072
+ destructiveMethodCounts.set(cache,
1073
+ (destructiveMethodCounts.get(cache) + 1) % 1e15);
1065
1074
  return original.apply(this, arguments);
1066
1075
  };
1067
1076
  }
@@ -1072,7 +1081,7 @@ function cancelNotifyTimeout(info) {
1072
1081
  info["notifyTimeout"] = void 0;
1073
1082
  }
1074
1083
  }
1075
- var QueryInfo = (function () {
1084
+ var QueryInfo = (function () {
1076
1085
  function QueryInfo(queryManager, queryId) {
1077
1086
  if (queryId === void 0) { queryId = queryManager.generateQueryId(); }
1078
1087
  this.queryId = queryId;
@@ -1134,12 +1143,13 @@ var QueryInfo = (function () {
1134
1143
  return diff;
1135
1144
  };
1136
1145
  QueryInfo.prototype.updateLastDiff = function (diff, options) {
1137
- this.lastDiff = diff
1138
- ? {
1139
- diff: diff,
1140
- options: options || this.getDiffOptions(),
1141
- }
1142
- : void 0;
1146
+ this.lastDiff =
1147
+ diff ?
1148
+ {
1149
+ diff: diff,
1150
+ options: options || this.getDiffOptions(),
1151
+ }
1152
+ : void 0;
1143
1153
  };
1144
1154
  QueryInfo.prototype.getDiffOptions = function (variables) {
1145
1155
  var _a;
@@ -1245,9 +1255,7 @@ var QueryInfo = (function () {
1245
1255
  QueryInfo.prototype.markResult = function (result, document, options, cacheWriteBehavior) {
1246
1256
  var _this = this;
1247
1257
  var merger = new utilities.DeepMerger();
1248
- var graphQLErrors = utilities.isNonEmptyArray(result.errors)
1249
- ? result.errors.slice(0)
1250
- : [];
1258
+ var graphQLErrors = utilities.isNonEmptyArray(result.errors) ? result.errors.slice(0) : [];
1251
1259
  this.reset();
1252
1260
  if ("incremental" in result && utilities.isNonEmptyArray(result.incremental)) {
1253
1261
  var mergedData = utilities.mergeIncrementalData(this.getDiff().result, result);
@@ -1261,7 +1269,7 @@ var QueryInfo = (function () {
1261
1269
  if (options.fetchPolicy === "no-cache") {
1262
1270
  this.updateLastDiff({ result: result.data, complete: true }, this.getDiffOptions(options.variables));
1263
1271
  }
1264
- else if (cacheWriteBehavior !== 0) {
1272
+ else if (cacheWriteBehavior !== 0 ) {
1265
1273
  if (shouldWriteResult(result, options.errorPolicy)) {
1266
1274
  this.cache.performTransaction(function (cache) {
1267
1275
  if (_this.shouldWrite(result, options.variables)) {
@@ -1269,7 +1277,7 @@ var QueryInfo = (function () {
1269
1277
  query: document,
1270
1278
  data: result.data,
1271
1279
  variables: options.variables,
1272
- overwrite: cacheWriteBehavior === 1,
1280
+ overwrite: cacheWriteBehavior === 1 ,
1273
1281
  });
1274
1282
  _this.lastWrite = {
1275
1283
  result: result,
@@ -1328,10 +1336,10 @@ function shouldWriteResult(result, errorPolicy) {
1328
1336
  }
1329
1337
 
1330
1338
  var hasOwnProperty = Object.prototype.hasOwnProperty;
1331
- var QueryManager = (function () {
1339
+ var QueryManager = (function () {
1332
1340
  function QueryManager(_a) {
1333
- var _this = this;
1334
1341
  var cache = _a.cache, link = _a.link, defaultOptions = _a.defaultOptions, documentTransform = _a.documentTransform, _b = _a.queryDeduplication, queryDeduplication = _b === void 0 ? false : _b, onBroadcast = _a.onBroadcast, _c = _a.ssrMode, ssrMode = _c === void 0 ? false : _c, _d = _a.clientAwareness, clientAwareness = _d === void 0 ? {} : _d, localState = _a.localState, _e = _a.assumeImmutableResults, assumeImmutableResults = _e === void 0 ? !!cache.assumeImmutableResults : _e;
1342
+ var _this = this;
1335
1343
  this.clientAwareness = {};
1336
1344
  this.queries = new Map();
1337
1345
  this.fetchCancelFns = new Map();
@@ -1340,7 +1348,8 @@ var QueryManager = (function () {
1340
1348
  this.requestIdCounter = 1;
1341
1349
  this.mutationIdCounter = 1;
1342
1350
  this.inFlightLinkObservables = new Map();
1343
- var defaultDocumentTransform = new utilities.DocumentTransform(function (document) { return _this.cache.transformDocument(document); }, { cache: false });
1351
+ var defaultDocumentTransform = new utilities.DocumentTransform(function (document) { return _this.cache.transformDocument(document); },
1352
+ { cache: false });
1344
1353
  this.cache = cache;
1345
1354
  this.link = link;
1346
1355
  this.defaultOptions = defaultOptions || Object.create(null);
@@ -1349,11 +1358,12 @@ var QueryManager = (function () {
1349
1358
  this.localState = localState || new LocalState({ cache: cache });
1350
1359
  this.ssrMode = ssrMode;
1351
1360
  this.assumeImmutableResults = assumeImmutableResults;
1352
- this.documentTransform = documentTransform
1353
- ? defaultDocumentTransform
1354
- .concat(documentTransform)
1355
- .concat(defaultDocumentTransform)
1356
- : defaultDocumentTransform;
1361
+ this.documentTransform =
1362
+ documentTransform ?
1363
+ defaultDocumentTransform
1364
+ .concat(documentTransform)
1365
+ .concat(defaultDocumentTransform)
1366
+ : defaultDocumentTransform;
1357
1367
  if ((this.onBroadcast = onBroadcast)) {
1358
1368
  this.mutationStore = Object.create(null);
1359
1369
  }
@@ -1383,8 +1393,8 @@ var QueryManager = (function () {
1383
1393
  mutation = this.cache.transformForLink(this.transform(mutation));
1384
1394
  hasClientExports = this.getDocumentInfo(mutation).hasClientExports;
1385
1395
  variables = this.getVariables(mutation, variables);
1386
- if (!hasClientExports) return [3, 2];
1387
- return [4, this.localState.addExportedVariables(mutation, variables, context)];
1396
+ if (!hasClientExports) return [3 , 2];
1397
+ return [4 , this.localState.addExportedVariables(mutation, variables, context)];
1388
1398
  case 1:
1389
1399
  variables = (_h.sent());
1390
1400
  _h.label = 2;
@@ -1411,7 +1421,7 @@ var QueryManager = (function () {
1411
1421
  }
1412
1422
  this.broadcastQueries();
1413
1423
  self = this;
1414
- return [2, new Promise(function (resolve, reject) {
1424
+ return [2 , new Promise(function (resolve, reject) {
1415
1425
  return utilities.asyncMap(self.getObservableFromLink(mutation, tslib.__assign(tslib.__assign({}, context), { optimisticResponse: optimisticResponse }), variables, false), function (result) {
1416
1426
  if (utilities.graphQLResultHasError(result) && errorPolicy === "none") {
1417
1427
  throw new errors.ApolloError({
@@ -1461,11 +1471,9 @@ var QueryManager = (function () {
1461
1471
  self.cache.removeOptimistic(mutationId);
1462
1472
  }
1463
1473
  self.broadcastQueries();
1464
- reject(err instanceof errors.ApolloError
1465
- ? err
1466
- : new errors.ApolloError({
1467
- networkError: err,
1468
- }));
1474
+ reject(err instanceof errors.ApolloError ? err : (new errors.ApolloError({
1475
+ networkError: err,
1476
+ })));
1469
1477
  },
1470
1478
  });
1471
1479
  })];
@@ -1608,8 +1616,8 @@ var QueryManager = (function () {
1608
1616
  };
1609
1617
  QueryManager.prototype.markMutationOptimistic = function (optimisticResponse, mutation) {
1610
1618
  var _this = this;
1611
- var data = typeof optimisticResponse === "function"
1612
- ? optimisticResponse(mutation.variables)
1619
+ var data = typeof optimisticResponse === "function" ?
1620
+ optimisticResponse(mutation.variables)
1613
1621
  : optimisticResponse;
1614
1622
  return this.cache.recordOptimisticTransaction(function (cache) {
1615
1623
  try {
@@ -1901,7 +1909,8 @@ var QueryManager = (function () {
1901
1909
  QueryManager.prototype.getLocalState = function () {
1902
1910
  return this.localState;
1903
1911
  };
1904
- QueryManager.prototype.getObservableFromLink = function (query, context, variables, deduplication) {
1912
+ QueryManager.prototype.getObservableFromLink = function (query, context, variables,
1913
+ deduplication) {
1905
1914
  var _this = this;
1906
1915
  var _a;
1907
1916
  if (deduplication === void 0) { deduplication = (_a = context === null || context === void 0 ? void 0 : context.queryDeduplication) !== null && _a !== void 0 ? _a : this.queryDeduplication; }
@@ -1982,16 +1991,15 @@ var QueryManager = (function () {
1982
1991
  }
1983
1992
  return aqr;
1984
1993
  }, function (networkError) {
1985
- var error = errors.isApolloError(networkError)
1986
- ? networkError
1987
- : new errors.ApolloError({ networkError: networkError });
1994
+ var error = errors.isApolloError(networkError) ? networkError : (new errors.ApolloError({ networkError: networkError }));
1988
1995
  if (requestId >= queryInfo.lastRequestId) {
1989
1996
  queryInfo.markError(error);
1990
1997
  }
1991
1998
  throw error;
1992
1999
  });
1993
2000
  };
1994
- QueryManager.prototype.fetchConcastWithInfo = function (queryId, options, networkStatus, query) {
2001
+ QueryManager.prototype.fetchConcastWithInfo = function (queryId, options,
2002
+ networkStatus, query) {
1995
2003
  var _this = this;
1996
2004
  if (networkStatus === void 0) { networkStatus = exports.NetworkStatus.loading; }
1997
2005
  if (query === void 0) { query = options.query; }
@@ -2011,7 +2019,8 @@ var QueryManager = (function () {
2011
2019
  var fromVariables = function (variables) {
2012
2020
  normalized.variables = variables;
2013
2021
  var sourcesWithInfo = _this.fetchQueryByPolicy(queryInfo, normalized, networkStatus);
2014
- if (normalized.fetchPolicy !== "standby" &&
2022
+ if (
2023
+ normalized.fetchPolicy !== "standby" &&
2015
2024
  sourcesWithInfo.sources.length > 0 &&
2016
2025
  queryInfo.observableQuery) {
2017
2026
  queryInfo.observableQuery["applyNextFetchPolicy"]("after-fetch", options);
@@ -2109,7 +2118,8 @@ var QueryManager = (function () {
2109
2118
  }
2110
2119
  return results;
2111
2120
  };
2112
- QueryManager.prototype.fetchQueryByPolicy = function (queryInfo, _a, networkStatus) {
2121
+ QueryManager.prototype.fetchQueryByPolicy = function (queryInfo, _a,
2122
+ networkStatus) {
2113
2123
  var _this = this;
2114
2124
  var query = _a.query, variables = _a.variables, fetchPolicy = _a.fetchPolicy, refetchWritePolicy = _a.refetchWritePolicy, errorPolicy = _a.errorPolicy, returnPartialData = _a.returnPartialData, context = _a.context, notifyOnNetworkStatusChange = _a.notifyOnNetworkStatusChange;
2115
2125
  var oldNetworkStatus = queryInfo.networkStatus;
@@ -2146,13 +2156,11 @@ var QueryManager = (function () {
2146
2156
  }
2147
2157
  return fromData(data);
2148
2158
  };
2149
- var cacheWriteBehavior = fetchPolicy === "no-cache"
2150
- ? 0
2151
- :
2152
- networkStatus === exports.NetworkStatus.refetch &&
2153
- refetchWritePolicy !== "merge"
2154
- ? 1
2155
- : 2;
2159
+ var cacheWriteBehavior = fetchPolicy === "no-cache" ? 0
2160
+ : (networkStatus === exports.NetworkStatus.refetch &&
2161
+ refetchWritePolicy !== "merge") ?
2162
+ 1
2163
+ : 2 ;
2156
2164
  var resultsFromLink = function () {
2157
2165
  return _this.getResultsFromLink(queryInfo, cacheWriteBehavior, {
2158
2166
  query: query,
@@ -2234,7 +2242,7 @@ var QueryManager = (function () {
2234
2242
  }());
2235
2243
 
2236
2244
  var hasSuggestedDevtools = false;
2237
- var ApolloClient = (function () {
2245
+ var ApolloClient = (function () {
2238
2246
  function ApolloClient(options) {
2239
2247
  var _this = this;
2240
2248
  this.resetStoreCallbacks = [];
@@ -2242,14 +2250,15 @@ var ApolloClient = (function () {
2242
2250
  if (!options.cache) {
2243
2251
  throw globals.newInvariantError(15);
2244
2252
  }
2245
- var uri = options.uri, credentials = options.credentials, headers = options.headers, cache = options.cache, documentTransform = options.documentTransform, _a = options.ssrMode, ssrMode = _a === void 0 ? false : _a, _b = options.ssrForceFetchDelay, ssrForceFetchDelay = _b === void 0 ? 0 : _b, _c = options.connectToDevTools, connectToDevTools = _c === void 0 ? typeof window === "object" &&
2253
+ var uri = options.uri, credentials = options.credentials, headers = options.headers, cache = options.cache, documentTransform = options.documentTransform, _a = options.ssrMode, ssrMode = _a === void 0 ? false : _a, _b = options.ssrForceFetchDelay, ssrForceFetchDelay = _b === void 0 ? 0 : _b,
2254
+ _c = options.connectToDevTools,
2255
+ connectToDevTools = _c === void 0 ? typeof window === "object" &&
2246
2256
  !window.__APOLLO_CLIENT__ &&
2247
2257
  globalThis.__DEV__ !== false : _c, _d = options.queryDeduplication, queryDeduplication = _d === void 0 ? true : _d, defaultOptions = options.defaultOptions, _e = options.assumeImmutableResults, assumeImmutableResults = _e === void 0 ? cache.assumeImmutableResults : _e, resolvers = options.resolvers, typeDefs = options.typeDefs, fragmentMatcher = options.fragmentMatcher, clientAwarenessName = options.name, clientAwarenessVersion = options.version;
2248
2258
  var link = options.link;
2249
2259
  if (!link) {
2250
- link = uri
2251
- ? new http.HttpLink({ uri: uri, credentials: credentials, headers: headers })
2252
- : core.ApolloLink.empty();
2260
+ link =
2261
+ uri ? new http.HttpLink({ uri: uri, credentials: credentials, headers: headers }) : core.ApolloLink.empty();
2253
2262
  }
2254
2263
  this.link = link;
2255
2264
  this.cache = cache;
@@ -2285,8 +2294,8 @@ var ApolloClient = (function () {
2285
2294
  },
2286
2295
  localState: this.localState,
2287
2296
  assumeImmutableResults: assumeImmutableResults,
2288
- onBroadcast: connectToDevTools
2289
- ? function () {
2297
+ onBroadcast: connectToDevTools ?
2298
+ function () {
2290
2299
  if (_this.devToolsHookCb) {
2291
2300
  _this.devToolsHookCb({
2292
2301
  action: {},
@@ -1,6 +1,8 @@
1
1
  import { __rest } from "tslib";
2
2
  import equal from "@wry/equality";
3
3
  import { createFragmentMap, getFragmentDefinitions, getFragmentFromSelection, getMainDefinition, isField, resultKeyNameFromField, shouldInclude, } from "../utilities/index.js";
4
+ // Returns true if aResult and bResult are deeply equal according to the fields
5
+ // selected by the given query, ignoring any fields marked as @nonreactive.
4
6
  export function equalByQuery(query, _a, _b, variables) {
5
7
  var aData = _a.data, aRest = __rest(_a, ["data"]);
6
8
  var bData = _b.data, bRest = __rest(_b, ["data"]);
@@ -15,12 +17,20 @@ function equalBySelectionSet(selectionSet, aResult, bResult, context) {
15
17
  return true;
16
18
  }
17
19
  var seenSelections = new Set();
20
+ // Returning true from this Array.prototype.every callback function skips the
21
+ // current field/subtree. Returning false aborts the entire traversal
22
+ // immediately, causing equalBySelectionSet to return false.
18
23
  return selectionSet.selections.every(function (selection) {
24
+ // Avoid re-processing the same selection at the same level of recursion, in
25
+ // case the same field gets included via multiple indirect fragment spreads.
19
26
  if (seenSelections.has(selection))
20
27
  return true;
21
28
  seenSelections.add(selection);
29
+ // Ignore @skip(if: true) and @include(if: false) fields.
22
30
  if (!shouldInclude(selection, context.variables))
23
31
  return true;
32
+ // If the field or (named) fragment spread has a @nonreactive directive on
33
+ // it, we don't care if it's different, so we pretend it's the same.
24
34
  if (selectionHasNonreactiveDirective(selection))
25
35
  return true;
26
36
  if (isField(selection)) {
@@ -29,6 +39,8 @@ function equalBySelectionSet(selectionSet, aResult, bResult, context) {
29
39
  var bResultChild = bResult && bResult[resultKey];
30
40
  var childSelectionSet = selection.selectionSet;
31
41
  if (!childSelectionSet) {
42
+ // These are scalar values, so we can compare them with deep equal
43
+ // without redoing the main recursive work.
32
44
  return equal(aResultChild, bResultChild);
33
45
  }
34
46
  var aChildIsArray = Array.isArray(aResultChild);
@@ -52,9 +64,16 @@ function equalBySelectionSet(selectionSet, aResult, bResult, context) {
52
64
  else {
53
65
  var fragment = getFragmentFromSelection(selection, context.fragmentMap);
54
66
  if (fragment) {
67
+ // The fragment might === selection if it's an inline fragment, but
68
+ // could be !== if it's a named fragment ...spread.
55
69
  if (selectionHasNonreactiveDirective(fragment))
56
70
  return true;
57
- return equalBySelectionSet(fragment.selectionSet, aResult, bResult, context);
71
+ return equalBySelectionSet(fragment.selectionSet,
72
+ // Notice that we reuse the same aResult and bResult values here,
73
+ // since the fragment ...spread does not specify a field name, but
74
+ // consists of multiple fields (within the fragment's selection set)
75
+ // that should be applied to the current result value(s).
76
+ aResult, bResult, context);
58
77
  }
59
78
  }
60
79
  });