@apollo/client 3.8.0-beta.5 → 3.8.0-beta.7

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 (646) hide show
  1. package/apollo-client.cjs +282 -242
  2. package/apollo-client.cjs.map +1 -1
  3. package/apollo-client.min.cjs +1 -1
  4. package/cache/cache.cjs +12 -12
  5. package/cache/cache.cjs.map +1 -1
  6. package/cache/cache.cjs.native.js +12 -12
  7. package/cache/core/cache.d.ts +3 -3
  8. package/cache/core/cache.d.ts.map +1 -1
  9. package/cache/core/cache.js +1 -1
  10. package/cache/core/cache.js.map +1 -1
  11. package/cache/core/types/Cache.d.ts +3 -3
  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 +2 -2
  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 +2 -2
  18. package/cache/core/types/common.d.ts.map +1 -1
  19. package/cache/core/types/common.js.map +1 -1
  20. package/cache/index.d.ts +14 -14
  21. package/cache/index.d.ts.map +1 -1
  22. package/cache/index.js +13 -13
  23. package/cache/index.js.map +1 -1
  24. package/cache/inmemory/entityStore.d.ts +5 -5
  25. package/cache/inmemory/entityStore.d.ts.map +1 -1
  26. package/cache/inmemory/entityStore.js +3 -3
  27. package/cache/inmemory/entityStore.js.map +1 -1
  28. package/cache/inmemory/fragmentRegistry.js.map +1 -1
  29. package/cache/inmemory/helpers.d.ts +5 -5
  30. package/cache/inmemory/helpers.d.ts.map +1 -1
  31. package/cache/inmemory/helpers.js +1 -1
  32. package/cache/inmemory/helpers.js.map +1 -1
  33. package/cache/inmemory/inMemoryCache.d.ts +8 -8
  34. package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
  35. package/cache/inmemory/inMemoryCache.js +13 -13
  36. package/cache/inmemory/inMemoryCache.js.map +1 -1
  37. package/cache/inmemory/key-extractor.d.ts +1 -1
  38. package/cache/inmemory/key-extractor.d.ts.map +1 -1
  39. package/cache/inmemory/key-extractor.js.map +1 -1
  40. package/cache/inmemory/object-canon.d.ts.map +1 -1
  41. package/cache/inmemory/object-canon.js +2 -3
  42. package/cache/inmemory/object-canon.js.map +1 -1
  43. package/cache/inmemory/policies.d.ts +6 -6
  44. package/cache/inmemory/policies.d.ts.map +1 -1
  45. package/cache/inmemory/policies.js +9 -9
  46. package/cache/inmemory/policies.js.map +1 -1
  47. package/cache/inmemory/reactiveVars.d.ts +1 -1
  48. package/cache/inmemory/reactiveVars.d.ts.map +1 -1
  49. package/cache/inmemory/reactiveVars.js.map +1 -1
  50. package/cache/inmemory/readFromStore.d.ts +6 -6
  51. package/cache/inmemory/readFromStore.d.ts.map +1 -1
  52. package/cache/inmemory/readFromStore.js +7 -7
  53. package/cache/inmemory/readFromStore.js.map +1 -1
  54. package/cache/inmemory/types.d.ts +6 -6
  55. package/cache/inmemory/types.d.ts.map +1 -1
  56. package/cache/inmemory/types.js.map +1 -1
  57. package/cache/inmemory/writeToStore.d.ts +6 -6
  58. package/cache/inmemory/writeToStore.d.ts.map +1 -1
  59. package/cache/inmemory/writeToStore.js +10 -10
  60. package/cache/inmemory/writeToStore.js.map +1 -1
  61. package/config/jest/setup.d.ts +1 -1
  62. package/config/jest/setup.d.ts.map +1 -1
  63. package/config/jest/setup.js +2 -2
  64. package/config/jest/setup.js.map +1 -1
  65. package/core/ApolloClient.d.ts +10 -10
  66. package/core/ApolloClient.d.ts.map +1 -1
  67. package/core/ApolloClient.js +12 -11
  68. package/core/ApolloClient.js.map +1 -1
  69. package/core/LocalState.d.ts +5 -5
  70. package/core/LocalState.d.ts.map +1 -1
  71. package/core/LocalState.js +5 -5
  72. package/core/LocalState.js.map +1 -1
  73. package/core/ObservableQuery.d.ts +11 -10
  74. package/core/ObservableQuery.d.ts.map +1 -1
  75. package/core/ObservableQuery.js +17 -13
  76. package/core/ObservableQuery.js.map +1 -1
  77. package/core/QueryInfo.d.ts +9 -9
  78. package/core/QueryInfo.d.ts.map +1 -1
  79. package/core/QueryInfo.js +4 -4
  80. package/core/QueryInfo.js.map +1 -1
  81. package/core/QueryManager.d.ts +12 -12
  82. package/core/QueryManager.d.ts.map +1 -1
  83. package/core/QueryManager.js +25 -25
  84. package/core/QueryManager.js.map +1 -1
  85. package/core/core.cjs +43 -37
  86. package/core/core.cjs.map +1 -1
  87. package/core/core.cjs.native.js +43 -37
  88. package/core/equalByQuery.d.ts +2 -2
  89. package/core/equalByQuery.d.ts.map +1 -1
  90. package/core/equalByQuery.js +9 -8
  91. package/core/equalByQuery.js.map +1 -1
  92. package/core/index.d.ts +13 -13
  93. package/core/index.d.ts.map +1 -1
  94. package/core/index.js +12 -13
  95. package/core/index.js.map +1 -1
  96. package/core/types.d.ts +10 -10
  97. package/core/types.d.ts.map +1 -1
  98. package/core/types.js.map +1 -1
  99. package/core/watchQueryOptions.d.ts +4 -4
  100. package/core/watchQueryOptions.d.ts.map +1 -1
  101. package/core/watchQueryOptions.js.map +1 -1
  102. package/dev/dev.cjs +73 -81
  103. package/dev/dev.cjs.map +1 -1
  104. package/dev/dev.cjs.native.js +73 -81
  105. package/dev/index.d.ts +3 -3
  106. package/dev/index.d.ts.map +1 -1
  107. package/dev/index.js +3 -3
  108. package/dev/index.js.map +1 -1
  109. package/dev/loadDevMessages.js +2 -2
  110. package/dev/loadDevMessages.js.map +1 -1
  111. package/dev/loadErrorMessageHandler.d.ts +1 -1
  112. package/dev/loadErrorMessageHandler.d.ts.map +1 -1
  113. package/dev/loadErrorMessageHandler.js +2 -2
  114. package/dev/loadErrorMessageHandler.js.map +1 -1
  115. package/dev/loadErrorMessages.js +2 -2
  116. package/dev/loadErrorMessages.js.map +1 -1
  117. package/errors/errors.cjs.map +1 -1
  118. package/errors/index.d.ts +4 -4
  119. package/errors/index.d.ts.map +1 -1
  120. package/errors/index.js +2 -2
  121. package/errors/index.js.map +1 -1
  122. package/index.d.ts +2 -2
  123. package/index.d.ts.map +1 -1
  124. package/index.js +2 -2
  125. package/index.js.map +1 -1
  126. package/invariantErrorCodes.js +71 -78
  127. package/link/batch/batch.cjs.map +1 -1
  128. package/link/batch/batchLink.d.ts +5 -5
  129. package/link/batch/batchLink.d.ts.map +1 -1
  130. package/link/batch/batchLink.js +3 -3
  131. package/link/batch/batchLink.js.map +1 -1
  132. package/link/batch/batching.d.ts +2 -2
  133. package/link/batch/batching.d.ts.map +1 -1
  134. package/link/batch/batching.js +1 -1
  135. package/link/batch/batching.js.map +1 -1
  136. package/link/batch/index.d.ts +1 -1
  137. package/link/batch/index.d.ts.map +1 -1
  138. package/link/batch/index.js +1 -1
  139. package/link/batch/index.js.map +1 -1
  140. package/link/batch-http/batch-http.cjs.map +1 -1
  141. package/link/batch-http/batchHttpLink.d.ts +5 -5
  142. package/link/batch-http/batchHttpLink.d.ts.map +1 -1
  143. package/link/batch-http/batchHttpLink.js +5 -5
  144. package/link/batch-http/batchHttpLink.js.map +1 -1
  145. package/link/batch-http/index.d.ts +1 -1
  146. package/link/batch-http/index.d.ts.map +1 -1
  147. package/link/batch-http/index.js +1 -1
  148. package/link/batch-http/index.js.map +1 -1
  149. package/link/context/context.cjs.map +1 -1
  150. package/link/context/index.d.ts +3 -3
  151. package/link/context/index.d.ts.map +1 -1
  152. package/link/context/index.js +2 -2
  153. package/link/context/index.js.map +1 -1
  154. package/link/core/ApolloLink.d.ts +3 -3
  155. package/link/core/ApolloLink.d.ts.map +1 -1
  156. package/link/core/ApolloLink.js +5 -5
  157. package/link/core/ApolloLink.js.map +1 -1
  158. package/link/core/concat.d.ts +1 -1
  159. package/link/core/concat.d.ts.map +1 -1
  160. package/link/core/concat.js +1 -1
  161. package/link/core/concat.js.map +1 -1
  162. package/link/core/core.cjs +2 -2
  163. package/link/core/core.cjs.map +1 -1
  164. package/link/core/core.cjs.native.js +2 -2
  165. package/link/core/empty.d.ts +1 -1
  166. package/link/core/empty.d.ts.map +1 -1
  167. package/link/core/empty.js +1 -1
  168. package/link/core/empty.js.map +1 -1
  169. package/link/core/execute.d.ts +1 -1
  170. package/link/core/execute.d.ts.map +1 -1
  171. package/link/core/execute.js +1 -1
  172. package/link/core/execute.js.map +1 -1
  173. package/link/core/from.d.ts +1 -1
  174. package/link/core/from.d.ts.map +1 -1
  175. package/link/core/from.js +1 -1
  176. package/link/core/from.js.map +1 -1
  177. package/link/core/index.d.ts +8 -8
  178. package/link/core/index.d.ts.map +1 -1
  179. package/link/core/index.js +8 -8
  180. package/link/core/index.js.map +1 -1
  181. package/link/core/split.d.ts +1 -1
  182. package/link/core/split.d.ts.map +1 -1
  183. package/link/core/split.js +1 -1
  184. package/link/core/split.js.map +1 -1
  185. package/link/core/types.d.ts +2 -2
  186. package/link/core/types.d.ts.map +1 -1
  187. package/link/core/types.js.map +1 -1
  188. package/link/error/error.cjs.map +1 -1
  189. package/link/error/index.d.ts +4 -4
  190. package/link/error/index.d.ts.map +1 -1
  191. package/link/error/index.js +2 -2
  192. package/link/error/index.js.map +1 -1
  193. package/link/http/HttpLink.d.ts +3 -3
  194. package/link/http/HttpLink.d.ts.map +1 -1
  195. package/link/http/HttpLink.js +2 -2
  196. package/link/http/HttpLink.js.map +1 -1
  197. package/link/http/checkFetcher.js +2 -2
  198. package/link/http/checkFetcher.js.map +1 -1
  199. package/link/http/createHttpLink.d.ts +2 -2
  200. package/link/http/createHttpLink.d.ts.map +1 -1
  201. package/link/http/createHttpLink.js +14 -14
  202. package/link/http/createHttpLink.js.map +1 -1
  203. package/link/http/http.cjs +4 -4
  204. package/link/http/http.cjs.map +1 -1
  205. package/link/http/http.cjs.native.js +4 -4
  206. package/link/http/index.d.ts +10 -10
  207. package/link/http/index.d.ts.map +1 -1
  208. package/link/http/index.js +10 -10
  209. package/link/http/index.js.map +1 -1
  210. package/link/http/iterators/nodeStream.js.map +1 -1
  211. package/link/http/iterators/promise.js.map +1 -1
  212. package/link/http/iterators/reader.js.map +1 -1
  213. package/link/http/parseAndCheckHttpResponse.d.ts +2 -2
  214. package/link/http/parseAndCheckHttpResponse.d.ts.map +1 -1
  215. package/link/http/parseAndCheckHttpResponse.js +2 -2
  216. package/link/http/parseAndCheckHttpResponse.js.map +1 -1
  217. package/link/http/responseIterator.js.map +1 -1
  218. package/link/http/rewriteURIForGET.d.ts +1 -1
  219. package/link/http/rewriteURIForGET.d.ts.map +1 -1
  220. package/link/http/rewriteURIForGET.js +1 -1
  221. package/link/http/rewriteURIForGET.js.map +1 -1
  222. package/link/http/selectHttpOptionsAndBody.d.ts +2 -2
  223. package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -1
  224. package/link/http/selectHttpOptionsAndBody.js +1 -1
  225. package/link/http/selectHttpOptionsAndBody.js.map +1 -1
  226. package/link/http/selectURI.d.ts +1 -1
  227. package/link/http/selectURI.d.ts.map +1 -1
  228. package/link/http/selectURI.js.map +1 -1
  229. package/link/http/serializeFetchParameter.d.ts +1 -1
  230. package/link/http/serializeFetchParameter.d.ts.map +1 -1
  231. package/link/http/serializeFetchParameter.js +2 -2
  232. package/link/http/serializeFetchParameter.js.map +1 -1
  233. package/link/persisted-queries/index.d.ts +3 -3
  234. package/link/persisted-queries/index.d.ts.map +1 -1
  235. package/link/persisted-queries/index.js +6 -6
  236. package/link/persisted-queries/index.js.map +1 -1
  237. package/link/persisted-queries/persisted-queries.cjs +2 -2
  238. package/link/persisted-queries/persisted-queries.cjs.map +1 -1
  239. package/link/persisted-queries/persisted-queries.cjs.native.js +2 -2
  240. package/link/remove-typename/index.d.ts +1 -1
  241. package/link/remove-typename/index.d.ts.map +1 -1
  242. package/link/remove-typename/index.js +1 -1
  243. package/link/remove-typename/index.js.map +1 -1
  244. package/link/remove-typename/remove-typename.cjs.map +1 -1
  245. package/link/remove-typename/removeTypenameFromVariables.d.ts +1 -1
  246. package/link/remove-typename/removeTypenameFromVariables.d.ts.map +1 -1
  247. package/link/remove-typename/removeTypenameFromVariables.js +2 -2
  248. package/link/remove-typename/removeTypenameFromVariables.js.map +1 -1
  249. package/link/retry/delayFunction.d.ts +1 -1
  250. package/link/retry/delayFunction.d.ts.map +1 -1
  251. package/link/retry/delayFunction.js.map +1 -1
  252. package/link/retry/index.d.ts +1 -1
  253. package/link/retry/index.d.ts.map +1 -1
  254. package/link/retry/index.js +1 -1
  255. package/link/retry/index.js.map +1 -1
  256. package/link/retry/retry.cjs.map +1 -1
  257. package/link/retry/retryFunction.d.ts +1 -1
  258. package/link/retry/retryFunction.d.ts.map +1 -1
  259. package/link/retry/retryFunction.js.map +1 -1
  260. package/link/retry/retryLink.d.ts +5 -5
  261. package/link/retry/retryLink.d.ts.map +1 -1
  262. package/link/retry/retryLink.js +4 -4
  263. package/link/retry/retryLink.js.map +1 -1
  264. package/link/schema/index.d.ts +3 -3
  265. package/link/schema/index.d.ts.map +1 -1
  266. package/link/schema/index.js +2 -2
  267. package/link/schema/index.js.map +1 -1
  268. package/link/schema/schema.cjs.map +1 -1
  269. package/link/subscriptions/index.d.ts +3 -3
  270. package/link/subscriptions/index.d.ts.map +1 -1
  271. package/link/subscriptions/index.js +1 -1
  272. package/link/subscriptions/index.js.map +1 -1
  273. package/link/subscriptions/subscriptions.cjs.map +1 -1
  274. package/link/utils/createOperation.d.ts +1 -1
  275. package/link/utils/createOperation.d.ts.map +1 -1
  276. package/link/utils/createOperation.js.map +1 -1
  277. package/link/utils/fromError.d.ts +1 -1
  278. package/link/utils/fromError.d.ts.map +1 -1
  279. package/link/utils/fromError.js +1 -1
  280. package/link/utils/fromError.js.map +1 -1
  281. package/link/utils/fromPromise.d.ts +1 -1
  282. package/link/utils/fromPromise.d.ts.map +1 -1
  283. package/link/utils/fromPromise.js +1 -1
  284. package/link/utils/fromPromise.js.map +1 -1
  285. package/link/utils/index.d.ts +9 -9
  286. package/link/utils/index.d.ts.map +1 -1
  287. package/link/utils/index.js +9 -9
  288. package/link/utils/index.js.map +1 -1
  289. package/link/utils/toPromise.d.ts +1 -1
  290. package/link/utils/toPromise.d.ts.map +1 -1
  291. package/link/utils/toPromise.js +2 -2
  292. package/link/utils/toPromise.js.map +1 -1
  293. package/link/utils/transformOperation.d.ts +1 -1
  294. package/link/utils/transformOperation.d.ts.map +1 -1
  295. package/link/utils/transformOperation.js +1 -1
  296. package/link/utils/transformOperation.js.map +1 -1
  297. package/link/utils/utils.cjs +2 -2
  298. package/link/utils/utils.cjs.map +1 -1
  299. package/link/utils/utils.cjs.native.js +2 -2
  300. package/link/utils/validateOperation.d.ts +1 -1
  301. package/link/utils/validateOperation.d.ts.map +1 -1
  302. package/link/utils/validateOperation.js +2 -2
  303. package/link/utils/validateOperation.js.map +1 -1
  304. package/link/ws/index.d.ts +3 -3
  305. package/link/ws/index.d.ts.map +1 -1
  306. package/link/ws/index.js +1 -1
  307. package/link/ws/index.js.map +1 -1
  308. package/link/ws/ws.cjs.map +1 -1
  309. package/package.json +18 -14
  310. package/react/cache/QueryReference.d.ts +9 -6
  311. package/react/cache/QueryReference.d.ts.map +1 -1
  312. package/react/cache/QueryReference.js +108 -52
  313. package/react/cache/QueryReference.js.map +1 -1
  314. package/react/cache/SuspenseCache.d.ts +3 -3
  315. package/react/cache/SuspenseCache.d.ts.map +1 -1
  316. package/react/cache/SuspenseCache.js +2 -2
  317. package/react/cache/SuspenseCache.js.map +1 -1
  318. package/react/cache/index.d.ts +1 -1
  319. package/react/cache/index.d.ts.map +1 -1
  320. package/react/cache/index.js +1 -1
  321. package/react/cache/index.js.map +1 -1
  322. package/react/components/Mutation.d.ts +3 -3
  323. package/react/components/Mutation.d.ts.map +1 -1
  324. package/react/components/Mutation.js +1 -1
  325. package/react/components/Mutation.js.map +1 -1
  326. package/react/components/Query.d.ts +2 -2
  327. package/react/components/Query.d.ts.map +1 -1
  328. package/react/components/Query.js +1 -1
  329. package/react/components/Query.js.map +1 -1
  330. package/react/components/Subscription.d.ts +2 -2
  331. package/react/components/Subscription.d.ts.map +1 -1
  332. package/react/components/Subscription.js +1 -1
  333. package/react/components/Subscription.js.map +1 -1
  334. package/react/components/components.cjs.map +1 -1
  335. package/react/components/index.d.ts +4 -4
  336. package/react/components/index.d.ts.map +1 -1
  337. package/react/components/index.js +4 -4
  338. package/react/components/index.js.map +1 -1
  339. package/react/components/types.d.ts +2 -2
  340. package/react/components/types.d.ts.map +1 -1
  341. package/react/components/types.js.map +1 -1
  342. package/react/context/ApolloConsumer.d.ts +1 -1
  343. package/react/context/ApolloConsumer.d.ts.map +1 -1
  344. package/react/context/ApolloConsumer.js +3 -3
  345. package/react/context/ApolloConsumer.js.map +1 -1
  346. package/react/context/ApolloContext.d.ts +4 -5
  347. package/react/context/ApolloContext.d.ts.map +1 -1
  348. package/react/context/ApolloContext.js +12 -5
  349. package/react/context/ApolloContext.js.map +1 -1
  350. package/react/context/ApolloProvider.d.ts +2 -2
  351. package/react/context/ApolloProvider.d.ts.map +1 -1
  352. package/react/context/ApolloProvider.js +3 -3
  353. package/react/context/ApolloProvider.js.map +1 -1
  354. package/react/context/context.cjs +12 -5
  355. package/react/context/context.cjs.map +1 -1
  356. package/react/context/context.cjs.native.js +12 -5
  357. package/react/context/index.d.ts +4 -4
  358. package/react/context/index.d.ts.map +1 -1
  359. package/react/context/index.js +4 -4
  360. package/react/context/index.js.map +1 -1
  361. package/react/hoc/graphql.d.ts +2 -2
  362. package/react/hoc/graphql.d.ts.map +1 -1
  363. package/react/hoc/graphql.js +4 -4
  364. package/react/hoc/graphql.js.map +1 -1
  365. package/react/hoc/hoc-utils.d.ts +2 -2
  366. package/react/hoc/hoc-utils.d.ts.map +1 -1
  367. package/react/hoc/hoc-utils.js +2 -2
  368. package/react/hoc/hoc-utils.js.map +1 -1
  369. package/react/hoc/hoc.cjs +2 -2
  370. package/react/hoc/hoc.cjs.map +1 -1
  371. package/react/hoc/hoc.cjs.native.js +2 -2
  372. package/react/hoc/index.d.ts +7 -7
  373. package/react/hoc/index.d.ts.map +1 -1
  374. package/react/hoc/index.js +7 -7
  375. package/react/hoc/index.js.map +1 -1
  376. package/react/hoc/mutation-hoc.d.ts +3 -3
  377. package/react/hoc/mutation-hoc.d.ts.map +1 -1
  378. package/react/hoc/mutation-hoc.js +3 -3
  379. package/react/hoc/mutation-hoc.js.map +1 -1
  380. package/react/hoc/query-hoc.d.ts +1 -1
  381. package/react/hoc/query-hoc.d.ts.map +1 -1
  382. package/react/hoc/query-hoc.js +3 -3
  383. package/react/hoc/query-hoc.js.map +1 -1
  384. package/react/hoc/subscription-hoc.d.ts +1 -1
  385. package/react/hoc/subscription-hoc.d.ts.map +1 -1
  386. package/react/hoc/subscription-hoc.js +3 -3
  387. package/react/hoc/subscription-hoc.js.map +1 -1
  388. package/react/hoc/types.d.ts +4 -4
  389. package/react/hoc/types.d.ts.map +1 -1
  390. package/react/hoc/types.js.map +1 -1
  391. package/react/hoc/withApollo.d.ts +1 -1
  392. package/react/hoc/withApollo.d.ts.map +1 -1
  393. package/react/hoc/withApollo.js +3 -3
  394. package/react/hoc/withApollo.js.map +1 -1
  395. package/react/hooks/hooks.cjs +179 -140
  396. package/react/hooks/hooks.cjs.map +1 -1
  397. package/react/hooks/hooks.cjs.native.js +179 -140
  398. package/react/hooks/index.d.ts +11 -11
  399. package/react/hooks/index.d.ts.map +1 -1
  400. package/react/hooks/index.js +11 -11
  401. package/react/hooks/index.js.map +1 -1
  402. package/react/hooks/internal/__use.js +2 -2
  403. package/react/hooks/internal/__use.js.map +1 -1
  404. package/react/hooks/internal/index.d.ts +3 -4
  405. package/react/hooks/internal/index.d.ts.map +1 -1
  406. package/react/hooks/internal/index.js +3 -4
  407. package/react/hooks/internal/index.js.map +1 -1
  408. package/react/hooks/internal/useDeepMemo.js +2 -2
  409. package/react/hooks/internal/useDeepMemo.js.map +1 -1
  410. package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts +2 -2
  411. package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts.map +1 -1
  412. package/react/hooks/internal/useIsomorphicLayoutEffect.js +4 -4
  413. package/react/hooks/internal/useIsomorphicLayoutEffect.js.map +1 -1
  414. package/react/hooks/useApolloClient.d.ts +1 -1
  415. package/react/hooks/useApolloClient.d.ts.map +1 -1
  416. package/react/hooks/useApolloClient.js +5 -5
  417. package/react/hooks/useApolloClient.js.map +1 -1
  418. package/react/hooks/useBackgroundQuery.d.ts +5 -5
  419. package/react/hooks/useBackgroundQuery.d.ts.map +1 -1
  420. package/react/hooks/useBackgroundQuery.js +16 -17
  421. package/react/hooks/useBackgroundQuery.js.map +1 -1
  422. package/react/hooks/useFragment.d.ts +4 -4
  423. package/react/hooks/useFragment.d.ts.map +1 -1
  424. package/react/hooks/useFragment.js +2 -2
  425. package/react/hooks/useFragment.js.map +1 -1
  426. package/react/hooks/useLazyQuery.d.ts +2 -2
  427. package/react/hooks/useLazyQuery.d.ts.map +1 -1
  428. package/react/hooks/useLazyQuery.js +9 -9
  429. package/react/hooks/useLazyQuery.js.map +1 -1
  430. package/react/hooks/useMutation.d.ts +2 -2
  431. package/react/hooks/useMutation.d.ts.map +1 -1
  432. package/react/hooks/useMutation.js +10 -10
  433. package/react/hooks/useMutation.js.map +1 -1
  434. package/react/hooks/useQuery.d.ts +4 -4
  435. package/react/hooks/useQuery.d.ts.map +1 -1
  436. package/react/hooks/useQuery.js +17 -17
  437. package/react/hooks/useQuery.js.map +1 -1
  438. package/react/hooks/useReactiveVar.d.ts +1 -1
  439. package/react/hooks/useReactiveVar.d.ts.map +1 -1
  440. package/react/hooks/useReactiveVar.js +3 -3
  441. package/react/hooks/useReactiveVar.js.map +1 -1
  442. package/react/hooks/useReadQuery.d.ts +3 -3
  443. package/react/hooks/useReadQuery.d.ts.map +1 -1
  444. package/react/hooks/useReadQuery.js +6 -6
  445. package/react/hooks/useReadQuery.js.map +1 -1
  446. package/react/hooks/useSubscription.d.ts +2 -2
  447. package/react/hooks/useSubscription.d.ts.map +1 -1
  448. package/react/hooks/useSubscription.js +14 -14
  449. package/react/hooks/useSubscription.js.map +1 -1
  450. package/react/hooks/useSuspenseCache.d.ts +1 -1
  451. package/react/hooks/useSuspenseCache.d.ts.map +1 -1
  452. package/react/hooks/useSuspenseCache.js +5 -5
  453. package/react/hooks/useSuspenseCache.js.map +1 -1
  454. package/react/hooks/useSuspenseQuery.d.ts +4 -6
  455. package/react/hooks/useSuspenseQuery.d.ts.map +1 -1
  456. package/react/hooks/useSuspenseQuery.js +30 -34
  457. package/react/hooks/useSuspenseQuery.js.map +1 -1
  458. package/react/hooks/useSyncExternalStore.js +4 -4
  459. package/react/hooks/useSyncExternalStore.js.map +1 -1
  460. package/react/index.d.ts +6 -6
  461. package/react/index.d.ts.map +1 -1
  462. package/react/index.js +6 -6
  463. package/react/index.js.map +1 -1
  464. package/react/parser/index.js +6 -6
  465. package/react/parser/index.js.map +1 -1
  466. package/react/parser/parser.cjs +5 -5
  467. package/react/parser/parser.cjs.map +1 -1
  468. package/react/parser/parser.cjs.native.js +5 -5
  469. package/react/react.cjs +106 -50
  470. package/react/react.cjs.map +1 -1
  471. package/react/react.cjs.native.js +106 -50
  472. package/react/ssr/RenderPromises.d.ts +2 -2
  473. package/react/ssr/RenderPromises.d.ts.map +1 -1
  474. package/react/ssr/RenderPromises.js.map +1 -1
  475. package/react/ssr/getDataFromTree.js +2 -2
  476. package/react/ssr/getDataFromTree.js.map +1 -1
  477. package/react/ssr/index.d.ts +3 -3
  478. package/react/ssr/index.d.ts.map +1 -1
  479. package/react/ssr/index.js +3 -3
  480. package/react/ssr/index.js.map +1 -1
  481. package/react/ssr/renderToStringWithData.js +1 -1
  482. package/react/ssr/renderToStringWithData.js.map +1 -1
  483. package/react/ssr/ssr.cjs.map +1 -1
  484. package/react/types/types.d.ts +7 -7
  485. package/react/types/types.d.ts.map +1 -1
  486. package/react/types/types.js.map +1 -1
  487. package/testing/core/core.cjs +1 -1
  488. package/testing/core/core.cjs.map +1 -1
  489. package/testing/core/core.cjs.native.js +1 -1
  490. package/testing/core/index.d.ts +7 -7
  491. package/testing/core/index.d.ts.map +1 -1
  492. package/testing/core/index.js +7 -7
  493. package/testing/core/index.js.map +1 -1
  494. package/testing/core/mocking/mockClient.d.ts +2 -2
  495. package/testing/core/mocking/mockClient.d.ts.map +1 -1
  496. package/testing/core/mocking/mockClient.js +3 -3
  497. package/testing/core/mocking/mockClient.js.map +1 -1
  498. package/testing/core/mocking/mockLink.d.ts +3 -3
  499. package/testing/core/mocking/mockLink.d.ts.map +1 -1
  500. package/testing/core/mocking/mockLink.js +4 -4
  501. package/testing/core/mocking/mockLink.js.map +1 -1
  502. package/testing/core/mocking/mockQueryManager.d.ts +3 -3
  503. package/testing/core/mocking/mockQueryManager.d.ts.map +1 -1
  504. package/testing/core/mocking/mockQueryManager.js +3 -3
  505. package/testing/core/mocking/mockQueryManager.js.map +1 -1
  506. package/testing/core/mocking/mockSubscriptionLink.d.ts +3 -3
  507. package/testing/core/mocking/mockSubscriptionLink.d.ts.map +1 -1
  508. package/testing/core/mocking/mockSubscriptionLink.js +2 -2
  509. package/testing/core/mocking/mockSubscriptionLink.js.map +1 -1
  510. package/testing/core/mocking/mockWatchQuery.d.ts +2 -2
  511. package/testing/core/mocking/mockWatchQuery.d.ts.map +1 -1
  512. package/testing/core/mocking/mockWatchQuery.js +1 -1
  513. package/testing/core/mocking/mockWatchQuery.js.map +1 -1
  514. package/testing/core/observableToPromise.d.ts +2 -2
  515. package/testing/core/observableToPromise.d.ts.map +1 -1
  516. package/testing/core/observableToPromise.js.map +1 -1
  517. package/testing/core/subscribeAndCount.d.ts +1 -1
  518. package/testing/core/subscribeAndCount.d.ts.map +1 -1
  519. package/testing/core/subscribeAndCount.js +1 -1
  520. package/testing/core/subscribeAndCount.js.map +1 -1
  521. package/testing/index.d.ts +3 -3
  522. package/testing/index.d.ts.map +1 -1
  523. package/testing/index.js +3 -3
  524. package/testing/index.js.map +1 -1
  525. package/testing/matchers/index.js +2 -2
  526. package/testing/matchers/index.js.map +1 -1
  527. package/testing/matchers/toHaveSuspenseCacheEntryUsing.d.ts +1 -1
  528. package/testing/matchers/toHaveSuspenseCacheEntryUsing.d.ts.map +1 -1
  529. package/testing/matchers/toHaveSuspenseCacheEntryUsing.js +2 -2
  530. package/testing/matchers/toHaveSuspenseCacheEntryUsing.js.map +1 -1
  531. package/testing/matchers/toMatchDocument.d.ts +1 -1
  532. package/testing/matchers/toMatchDocument.d.ts.map +1 -1
  533. package/testing/matchers/toMatchDocument.js +1 -1
  534. package/testing/matchers/toMatchDocument.js.map +1 -1
  535. package/testing/react/MockedProvider.d.ts +7 -7
  536. package/testing/react/MockedProvider.d.ts.map +1 -1
  537. package/testing/react/MockedProvider.js +5 -5
  538. package/testing/react/MockedProvider.js.map +1 -1
  539. package/testing/testing.cjs.map +1 -1
  540. package/utilities/common/canUse.js.map +1 -1
  541. package/utilities/common/compact.d.ts +1 -1
  542. package/utilities/common/compact.d.ts.map +1 -1
  543. package/utilities/common/compact.js.map +1 -1
  544. package/utilities/common/errorHandling.d.ts +1 -1
  545. package/utilities/common/errorHandling.d.ts.map +1 -1
  546. package/utilities/common/errorHandling.js.map +1 -1
  547. package/utilities/common/incrementalResult.d.ts +1 -1
  548. package/utilities/common/incrementalResult.d.ts.map +1 -1
  549. package/utilities/common/incrementalResult.js.map +1 -1
  550. package/utilities/common/maybeDeepFreeze.d.ts.map +1 -1
  551. package/utilities/common/maybeDeepFreeze.js +3 -4
  552. package/utilities/common/maybeDeepFreeze.js.map +1 -1
  553. package/utilities/common/mergeDeep.d.ts +1 -1
  554. package/utilities/common/mergeDeep.d.ts.map +1 -1
  555. package/utilities/common/mergeDeep.js.map +1 -1
  556. package/utilities/common/mergeOptions.d.ts +1 -1
  557. package/utilities/common/mergeOptions.d.ts.map +1 -1
  558. package/utilities/common/mergeOptions.js.map +1 -1
  559. package/utilities/common/omitDeep.d.ts +1 -1
  560. package/utilities/common/omitDeep.d.ts.map +1 -1
  561. package/utilities/common/omitDeep.js +1 -1
  562. package/utilities/common/omitDeep.js.map +1 -1
  563. package/utilities/common/responseIterator.js.map +1 -1
  564. package/utilities/common/stringifyForDisplay.js.map +1 -1
  565. package/utilities/common/stripTypename.d.ts +1 -1
  566. package/utilities/common/stripTypename.d.ts.map +1 -1
  567. package/utilities/common/stripTypename.js +1 -1
  568. package/utilities/common/stripTypename.js.map +1 -1
  569. package/utilities/globals/global.d.ts.map +1 -1
  570. package/utilities/globals/global.js.map +1 -1
  571. package/utilities/globals/globals.cjs +4 -16
  572. package/utilities/globals/globals.cjs.map +1 -1
  573. package/utilities/globals/globals.cjs.native.js +4 -16
  574. package/utilities/globals/index.d.ts +5 -6
  575. package/utilities/globals/index.d.ts.map +1 -1
  576. package/utilities/globals/index.js +2 -5
  577. package/utilities/globals/index.js.map +1 -1
  578. package/utilities/globals/invariantWrappers.d.ts +1 -1
  579. package/utilities/globals/invariantWrappers.d.ts.map +1 -1
  580. package/utilities/globals/invariantWrappers.js +3 -3
  581. package/utilities/globals/invariantWrappers.js.map +1 -1
  582. package/utilities/graphql/DocumentTransform.js +4 -4
  583. package/utilities/graphql/DocumentTransform.js.map +1 -1
  584. package/utilities/graphql/directives.js +5 -5
  585. package/utilities/graphql/directives.js.map +1 -1
  586. package/utilities/graphql/fragments.js +4 -4
  587. package/utilities/graphql/fragments.js.map +1 -1
  588. package/utilities/graphql/getFromAST.js +10 -10
  589. package/utilities/graphql/getFromAST.js.map +1 -1
  590. package/utilities/graphql/operations.d.ts +1 -1
  591. package/utilities/graphql/operations.d.ts.map +1 -1
  592. package/utilities/graphql/operations.js +1 -1
  593. package/utilities/graphql/operations.js.map +1 -1
  594. package/utilities/graphql/print.js +1 -1
  595. package/utilities/graphql/print.js.map +1 -1
  596. package/utilities/graphql/storeUtils.d.ts +1 -1
  597. package/utilities/graphql/storeUtils.d.ts.map +1 -1
  598. package/utilities/graphql/storeUtils.js +4 -4
  599. package/utilities/graphql/storeUtils.js.map +1 -1
  600. package/utilities/graphql/transform.js +7 -7
  601. package/utilities/graphql/transform.js.map +1 -1
  602. package/utilities/index.d.ts +34 -34
  603. package/utilities/index.d.ts.map +1 -1
  604. package/utilities/index.js +32 -32
  605. package/utilities/index.js.map +1 -1
  606. package/utilities/observables/Concast.d.ts +2 -2
  607. package/utilities/observables/Concast.d.ts.map +1 -1
  608. package/utilities/observables/Concast.js.map +1 -1
  609. package/utilities/observables/asyncMap.d.ts +1 -1
  610. package/utilities/observables/asyncMap.d.ts.map +1 -1
  611. package/utilities/observables/asyncMap.js.map +1 -1
  612. package/utilities/observables/iteration.d.ts +1 -1
  613. package/utilities/observables/iteration.d.ts.map +1 -1
  614. package/utilities/observables/iteration.js.map +1 -1
  615. package/utilities/observables/subclassing.d.ts +1 -1
  616. package/utilities/observables/subclassing.d.ts.map +1 -1
  617. package/utilities/observables/subclassing.js.map +1 -1
  618. package/utilities/policies/pagination.d.ts +1 -1
  619. package/utilities/policies/pagination.d.ts.map +1 -1
  620. package/utilities/policies/pagination.js +1 -1
  621. package/utilities/policies/pagination.js.map +1 -1
  622. package/utilities/promises/decoration.d.ts.map +1 -1
  623. package/utilities/promises/decoration.js +1 -0
  624. package/utilities/promises/decoration.js.map +1 -1
  625. package/utilities/types/DeepOmit.d.ts +1 -1
  626. package/utilities/types/DeepOmit.d.ts.map +1 -1
  627. package/utilities/types/DeepOmit.js.map +1 -1
  628. package/utilities/types/DeepPartial.d.ts +1 -1
  629. package/utilities/types/DeepPartial.d.ts.map +1 -1
  630. package/utilities/types/DeepPartial.js.map +1 -1
  631. package/utilities/utilities.cjs +22 -21
  632. package/utilities/utilities.cjs.map +1 -1
  633. package/utilities/utilities.cjs.native.js +22 -21
  634. package/version.js +1 -1
  635. package/react/hooks/internal/useStrictModeSafeCleanupEffect.d.ts +0 -2
  636. package/react/hooks/internal/useStrictModeSafeCleanupEffect.d.ts.map +0 -1
  637. package/react/hooks/internal/useStrictModeSafeCleanupEffect.js +0 -11
  638. package/react/hooks/internal/useStrictModeSafeCleanupEffect.js.map +0 -1
  639. package/utilities/globals/DEV.d.ts +0 -3
  640. package/utilities/globals/DEV.d.ts.map +0 -1
  641. package/utilities/globals/DEV.js +0 -4
  642. package/utilities/globals/DEV.js.map +0 -1
  643. package/utilities/globals/fix-graphql.d.ts +0 -2
  644. package/utilities/globals/fix-graphql.d.ts.map +0 -1
  645. package/utilities/globals/fix-graphql.js +0 -6
  646. package/utilities/globals/fix-graphql.js.map +0 -1
@@ -1,12 +1,12 @@
1
- import '../../utilities/globals';
2
- export * from './useApolloClient';
3
- export * from './useLazyQuery';
4
- export * from './useMutation';
5
- export { useQuery } from './useQuery';
6
- export * from './useSubscription';
7
- export * from './useReactiveVar';
8
- export * from './useFragment';
9
- export { useSuspenseQuery, UseSuspenseQueryResult, FetchMoreFunction, RefetchFunction, SubscribeToMoreFunction, } from './useSuspenseQuery';
10
- export { useBackgroundQuery, UseBackgroundQueryResult, } from './useBackgroundQuery';
11
- export { useReadQuery } from './useReadQuery';
1
+ import '../../utilities/globals/index.js';
2
+ export * from './useApolloClient.js';
3
+ export * from './useLazyQuery.js';
4
+ export * from './useMutation.js';
5
+ export { useQuery } from './useQuery.js';
6
+ export * from './useSubscription.js';
7
+ export * from './useReactiveVar.js';
8
+ export * from './useFragment.js';
9
+ export { useSuspenseQuery, UseSuspenseQueryResult, FetchMoreFunction, RefetchFunction, SubscribeToMoreFunction, } from './useSuspenseQuery.js';
10
+ export { useBackgroundQuery, UseBackgroundQueryResult, } from './useBackgroundQuery.js';
11
+ export { useReadQuery } from './useReadQuery.js';
12
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAEjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,EACf,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC;AAE1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,EACf,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,12 +1,12 @@
1
- import "../../utilities/globals/index.js";
2
- export * from "./useApolloClient.js";
3
- export * from "./useLazyQuery.js";
4
- export * from "./useMutation.js";
5
- export { useQuery } from "./useQuery.js";
6
- export * from "./useSubscription.js";
7
- export * from "./useReactiveVar.js";
8
- export * from "./useFragment.js";
9
- export { useSuspenseQuery, } from "./useSuspenseQuery.js";
10
- export { useBackgroundQuery, } from "./useBackgroundQuery.js";
11
- export { useReadQuery } from "./useReadQuery.js";
1
+ import '../../utilities/globals/index.js';
2
+ export * from './useApolloClient.js';
3
+ export * from './useLazyQuery.js';
4
+ export * from './useMutation.js';
5
+ export { useQuery } from './useQuery.js';
6
+ export * from './useSubscription.js';
7
+ export * from './useReactiveVar.js';
8
+ export * from './useFragment.js';
9
+ export { useSuspenseQuery, } from './useSuspenseQuery.js';
10
+ export { useBackgroundQuery, } from './useBackgroundQuery.js';
11
+ export { useReadQuery } from './useReadQuery.js';
12
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAEjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,OAAO,EACL,gBAAgB,GAKjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,kBAAkB,GAEnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["import '../../utilities/globals';\n\nexport * from './useApolloClient';\nexport * from './useLazyQuery';\nexport * from './useMutation';\nexport { useQuery } from './useQuery';\nexport * from './useSubscription';\nexport * from './useReactiveVar';\nexport * from './useFragment';\nexport {\n useSuspenseQuery,\n UseSuspenseQueryResult,\n FetchMoreFunction,\n RefetchFunction,\n SubscribeToMoreFunction,\n} from './useSuspenseQuery';\nexport {\n useBackgroundQuery,\n UseBackgroundQueryResult,\n} from './useBackgroundQuery';\nexport { useReadQuery } from './useReadQuery';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC;AAE1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EACL,gBAAgB,GAKjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,kBAAkB,GAEnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["import '../../utilities/globals/index.js';\n\nexport * from './useApolloClient.js';\nexport * from './useLazyQuery.js';\nexport * from './useMutation.js';\nexport { useQuery } from './useQuery.js';\nexport * from './useSubscription.js';\nexport * from './useReactiveVar.js';\nexport * from './useFragment.js';\nexport {\n useSuspenseQuery,\n UseSuspenseQueryResult,\n FetchMoreFunction,\n RefetchFunction,\n SubscribeToMoreFunction,\n} from './useSuspenseQuery.js';\nexport {\n useBackgroundQuery,\n UseBackgroundQueryResult,\n} from './useBackgroundQuery.js';\nexport { useReadQuery } from './useReadQuery.js';\n"]}
@@ -1,5 +1,5 @@
1
- import { wrapPromiseWithState } from "../../../utilities/index.js";
2
- import React from 'react';
1
+ import { wrapPromiseWithState } from '../../../utilities/index.js';
2
+ import * as React from 'react';
3
3
  var useKey = 'use';
4
4
  var realHook = React[useKey];
5
5
  export var __use = realHook ||
@@ -1 +1 @@
1
- {"version":3,"file":"__use.js","sourceRoot":"","sources":["../../../../src/react/hooks/internal/__use.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,IAAM,MAAM,GAAG,KAA2B,CAAC;AAC3C,IAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAoB,CAAC;AAIlD,MAAM,CAAC,IAAM,KAAK,GAChB,QAAQ;IACR,SAAS,KAAK,CAAS,OAAwB;QAC7C,IAAM,eAAe,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAEtD,QAAQ,eAAe,CAAC,MAAM,EAAE;YAC9B,KAAK,SAAS;gBACZ,MAAM,eAAe,CAAC;YACxB,KAAK,UAAU;gBACb,MAAM,eAAe,CAAC,MAAM,CAAC;YAC/B,KAAK,WAAW;gBACd,OAAO,eAAe,CAAC,KAAK,CAAC;SAChC;IACH,CAAC,CAAC","sourcesContent":["import { wrapPromiseWithState } from '../../../utilities';\nimport React from 'react';\n\ntype Use = <T>(promise: Promise<T>) => T;\n// Prevent webpack from complaining about our feature detection of the\n// use property of the React namespace, which is expected not\n// to exist when using current stable versions, and that's fine.\nconst useKey = 'use' as keyof typeof React;\nconst realHook = React[useKey] as Use | undefined;\n\n// This is named with two underscores to allow this hook to evade typical rules of\n// hooks (i.e. it can be used conditionally)\nexport const __use =\n realHook ||\n function __use<TValue>(promise: Promise<TValue>) {\n const statefulPromise = wrapPromiseWithState(promise);\n\n switch (statefulPromise.status) {\n case 'pending':\n throw statefulPromise;\n case 'rejected':\n throw statefulPromise.reason;\n case 'fulfilled':\n return statefulPromise.value;\n }\n };\n"]}
1
+ {"version":3,"file":"__use.js","sourceRoot":"","sources":["../../../../src/react/hooks/internal/__use.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,IAAM,MAAM,GAAG,KAA2B,CAAC;AAC3C,IAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAoB,CAAC;AAIlD,MAAM,CAAC,IAAM,KAAK,GAChB,QAAQ;IACR,SAAS,KAAK,CAAS,OAAwB;QAC7C,IAAM,eAAe,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAEtD,QAAQ,eAAe,CAAC,MAAM,EAAE;YAC9B,KAAK,SAAS;gBACZ,MAAM,eAAe,CAAC;YACxB,KAAK,UAAU;gBACb,MAAM,eAAe,CAAC,MAAM,CAAC;YAC/B,KAAK,WAAW;gBACd,OAAO,eAAe,CAAC,KAAK,CAAC;SAChC;IACH,CAAC,CAAC","sourcesContent":["import { wrapPromiseWithState } from '../../../utilities/index.js';\nimport * as React from 'react';\n\ntype Use = <T>(promise: Promise<T>) => T;\n// Prevent webpack from complaining about our feature detection of the\n// use property of the React namespace, which is expected not\n// to exist when using current stable versions, and that's fine.\nconst useKey = 'use' as keyof typeof React;\nconst realHook = React[useKey] as Use | undefined;\n\n// This is named with two underscores to allow this hook to evade typical rules of\n// hooks (i.e. it can be used conditionally)\nexport const __use =\n realHook ||\n function __use<TValue>(promise: Promise<TValue>) {\n const statefulPromise = wrapPromiseWithState(promise);\n\n switch (statefulPromise.status) {\n case 'pending':\n throw statefulPromise;\n case 'rejected':\n throw statefulPromise.reason;\n case 'fulfilled':\n return statefulPromise.value;\n }\n };\n"]}
@@ -1,5 +1,4 @@
1
- export { useDeepMemo } from './useDeepMemo';
2
- export { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';
3
- export { useStrictModeSafeCleanupEffect } from './useStrictModeSafeCleanupEffect';
4
- export { __use } from './__use';
1
+ export { useDeepMemo } from './useDeepMemo.js';
2
+ export { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect.js';
3
+ export { __use } from './__use.js';
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/react/hooks/internal/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/react/hooks/internal/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC"}
@@ -1,5 +1,4 @@
1
- export { useDeepMemo } from "./useDeepMemo.js";
2
- export { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect.js";
3
- export { useStrictModeSafeCleanupEffect } from "./useStrictModeSafeCleanupEffect.js";
4
- export { __use } from "./__use.js";
1
+ export { useDeepMemo } from './useDeepMemo.js';
2
+ export { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect.js';
3
+ export { __use } from './__use.js';
5
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/react/hooks/internal/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC","sourcesContent":["// These hooks are used internally and are not exported publicly by the library\nexport { useDeepMemo } from './useDeepMemo';\nexport { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';\nexport { useStrictModeSafeCleanupEffect } from './useStrictModeSafeCleanupEffect';\nexport { __use } from './__use';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/react/hooks/internal/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC","sourcesContent":["// These hooks are used internally and are not exported publicly by the library\nexport { useDeepMemo } from './useDeepMemo.js';\nexport { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect.js';\nexport { __use } from './__use.js';\n"]}
@@ -1,7 +1,7 @@
1
- import { useRef } from 'react';
1
+ import * as React from 'react';
2
2
  import { equal } from '@wry/equality';
3
3
  export function useDeepMemo(memoFn, deps) {
4
- var ref = useRef();
4
+ var ref = React.useRef();
5
5
  if (!ref.current || !equal(ref.current.deps, deps)) {
6
6
  ref.current = { value: memoFn(), deps: deps };
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useDeepMemo.js","sourceRoot":"","sources":["../../../../src/react/hooks/internal/useDeepMemo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,MAAM,UAAU,WAAW,CACzB,MAAoB,EACpB,IAAoB;IAEpB,IAAM,GAAG,GAAG,MAAM,EAA2C,CAAC;IAE9D,IAAI,CAAC,GAAG,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE;QAClD,GAAG,CAAC,OAAO,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,MAAA,EAAE,CAAC;KACzC;IAED,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC;AAC3B,CAAC","sourcesContent":["import type { DependencyList } from 'react';\nimport { useRef } from 'react';\nimport { equal } from '@wry/equality';\n\nexport function useDeepMemo<TValue>(\n memoFn: () => TValue,\n deps: DependencyList\n) {\n const ref = useRef<{ deps: DependencyList; value: TValue }>();\n\n if (!ref.current || !equal(ref.current.deps, deps)) {\n ref.current = { value: memoFn(), deps };\n }\n\n return ref.current.value;\n}\n"]}
1
+ {"version":3,"file":"useDeepMemo.js","sourceRoot":"","sources":["../../../../src/react/hooks/internal/useDeepMemo.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,MAAM,UAAU,WAAW,CACzB,MAAoB,EACpB,IAAoB;IAEpB,IAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAA2C,CAAC;IAEpE,IAAI,CAAC,GAAG,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE;QAClD,GAAG,CAAC,OAAO,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,MAAA,EAAE,CAAC;KACzC;IAED,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC;AAC3B,CAAC","sourcesContent":["import type { DependencyList } from 'react';\nimport * as React from 'react';\nimport { equal } from '@wry/equality';\n\nexport function useDeepMemo<TValue>(\n memoFn: () => TValue,\n deps: DependencyList\n) {\n const ref = React.useRef<{ deps: DependencyList; value: TValue }>();\n\n if (!ref.current || !equal(ref.current.deps, deps)) {\n ref.current = { value: memoFn(), deps };\n }\n\n return ref.current.value;\n}\n"]}
@@ -1,3 +1,3 @@
1
- import { useLayoutEffect } from 'react';
2
- export declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;
1
+ import * as React from 'react';
2
+ export declare const useIsomorphicLayoutEffect: typeof React.useLayoutEffect;
3
3
  //# sourceMappingURL=useIsomorphicLayoutEffect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useIsomorphicLayoutEffect.d.ts","sourceRoot":"","sources":["../../../../src/react/hooks/internal/useIsomorphicLayoutEffect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAa,MAAM,OAAO,CAAC;AAQnD,eAAO,MAAM,yBAAyB,wBAEzB,CAAC"}
1
+ {"version":3,"file":"useIsomorphicLayoutEffect.d.ts","sourceRoot":"","sources":["../../../../src/react/hooks/internal/useIsomorphicLayoutEffect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,eAAO,MAAM,yBAAyB,8BAEnB,CAAC"}
@@ -1,6 +1,6 @@
1
- import { useLayoutEffect, useEffect } from 'react';
2
- import { canUseDOM } from "../../../utilities/index.js";
1
+ import * as React from 'react';
2
+ import { canUseDOM } from '../../../utilities/index.js';
3
3
  export var useIsomorphicLayoutEffect = canUseDOM
4
- ? useLayoutEffect
5
- : useEffect;
4
+ ? React.useLayoutEffect
5
+ : React.useEffect;
6
6
  //# sourceMappingURL=useIsomorphicLayoutEffect.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useIsomorphicLayoutEffect.js","sourceRoot":"","sources":["../../../../src/react/hooks/internal/useIsomorphicLayoutEffect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAO/C,MAAM,CAAC,IAAM,yBAAyB,GAAG,SAAS;IAChD,CAAC,CAAC,eAAe;IACjB,CAAC,CAAC,SAAS,CAAC","sourcesContent":["import { useLayoutEffect, useEffect } from 'react';\nimport { canUseDOM } from '../../../utilities';\n\n// use canUseDOM here instead of canUseLayoutEffect because we want to be able\n// to use useLayoutEffect in our jest tests. useLayoutEffect seems to work fine\n// in useSuspenseQuery tests, but to honor the original comment about the\n// warnings for useSyncExternalStore implementation, canUseLayoutEffect is left\n// alone.\nexport const useIsomorphicLayoutEffect = canUseDOM\n ? useLayoutEffect\n : useEffect;\n"]}
1
+ {"version":3,"file":"useIsomorphicLayoutEffect.js","sourceRoot":"","sources":["../../../../src/react/hooks/internal/useIsomorphicLayoutEffect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAOxD,MAAM,CAAC,IAAM,yBAAyB,GAAG,SAAS;IAChD,CAAC,CAAC,KAAK,CAAC,eAAe;IACvB,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC","sourcesContent":["import * as React from 'react';\nimport { canUseDOM } from '../../../utilities/index.js';\n\n// use canUseDOM here instead of canUseLayoutEffect because we want to be able\n// to use useLayoutEffect in our jest tests. useLayoutEffect seems to work fine\n// in useSuspenseQuery tests, but to honor the original comment about the\n// warnings for useSyncExternalStore implementation, canUseLayoutEffect is left\n// alone.\nexport const useIsomorphicLayoutEffect = canUseDOM\n ? React.useLayoutEffect\n : React.useEffect;\n"]}
@@ -1,3 +1,3 @@
1
- import type { ApolloClient } from '../../core';
1
+ import type { ApolloClient } from '../../core/index.js';
2
2
  export declare function useApolloClient(override?: ApolloClient<object>): ApolloClient<object>;
3
3
  //# sourceMappingURL=useApolloClient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useApolloClient.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/useApolloClient.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C,wBAAgB,eAAe,CAC7B,QAAQ,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,GAC9B,YAAY,CAAC,MAAM,CAAC,CAWtB"}
1
+ {"version":3,"file":"useApolloClient.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/useApolloClient.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGxD,wBAAgB,eAAe,CAC7B,QAAQ,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,GAC9B,YAAY,CAAC,MAAM,CAAC,CAWtB"}
@@ -1,10 +1,10 @@
1
- import { invariant } from "../../utilities/globals/index.js";
2
- import { useContext } from 'react';
3
- import { getApolloContext } from "../context/index.js";
1
+ import { invariant } from '../../utilities/globals/index.js';
2
+ import * as React from 'react';
3
+ import { getApolloContext } from '../context/index.js';
4
4
  export function useApolloClient(override) {
5
- var context = useContext(getApolloContext());
5
+ var context = React.useContext(getApolloContext());
6
6
  var client = override || context.client;
7
- invariant(!!client, 48);
7
+ invariant(!!client, 47);
8
8
  return client;
9
9
  }
10
10
  //# sourceMappingURL=useApolloClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useApolloClient.js","sourceRoot":"","sources":["../../../src/react/hooks/useApolloClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,UAAU,eAAe,CAC7B,QAA+B;IAE/B,IAAM,OAAO,GAAG,UAAU,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC/C,IAAM,MAAM,GAAG,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC;IAC1C,SAAS,CACP,CAAC,CAAC,MAAM,EACR,oEAAoE;QACpE,0EAA0E;QAC1E,0BAA0B,CAC3B,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { invariant } from '../../utilities/globals';\nimport { useContext } from 'react';\nimport type { ApolloClient } from '../../core';\nimport { getApolloContext } from '../context';\n\nexport function useApolloClient(\n override?: ApolloClient<object>,\n): ApolloClient<object> {\n const context = useContext(getApolloContext());\n const client = override || context.client;\n invariant(\n !!client,\n 'Could not find \"client\" in the context or passed in as an option. ' +\n 'Wrap the root component in an <ApolloProvider>, or pass an ApolloClient ' +\n 'instance in via options.',\n );\n\n return client;\n}\n"]}
1
+ {"version":3,"file":"useApolloClient.js","sourceRoot":"","sources":["../../../src/react/hooks/useApolloClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,UAAU,eAAe,CAC7B,QAA+B;IAE/B,IAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC,CAAC;IACrD,IAAM,MAAM,GAAG,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC;IAC1C,SAAS,CACP,CAAC,CAAC,MAAM,EACR,oEAAoE;QACpE,0EAA0E;QAC1E,0BAA0B,CAC3B,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { invariant } from '../../utilities/globals/index.js';\nimport * as React from 'react';\nimport type { ApolloClient } from '../../core/index.js';\nimport { getApolloContext } from '../context/index.js';\n\nexport function useApolloClient(\n override?: ApolloClient<object>,\n): ApolloClient<object> {\n const context = React.useContext(getApolloContext());\n const client = override || context.client;\n invariant(\n !!client,\n 'Could not find \"client\" in the context or passed in as an option. ' +\n 'Wrap the root component in an <ApolloProvider>, or pass an ApolloClient ' +\n 'instance in via options.',\n );\n\n return client;\n}\n"]}
@@ -1,8 +1,8 @@
1
- import type { DocumentNode, OperationVariables, TypedDocumentNode } from '../../core';
2
- import { type QueryReference } from '../cache/QueryReference';
3
- import type { BackgroundQueryHookOptions, NoInfer } from '../types/types';
4
- import type { FetchMoreFunction, RefetchFunction } from './useSuspenseQuery';
5
- import type { DeepPartial } from '../../utilities';
1
+ import type { DocumentNode, OperationVariables, TypedDocumentNode } from '../../core/index.js';
2
+ import { type QueryReference } from '../cache/QueryReference.js';
3
+ import type { BackgroundQueryHookOptions, NoInfer } from '../types/types.js';
4
+ import type { FetchMoreFunction, RefetchFunction } from './useSuspenseQuery.js';
5
+ import type { DeepPartial } from '../../utilities/index.js';
6
6
  export type UseBackgroundQueryResult<TData = unknown, TVariables extends OperationVariables = OperationVariables> = [
7
7
  QueryReference<TData>,
8
8
  {
@@ -1 +1 @@
1
- {"version":3,"file":"useBackgroundQuery.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/useBackgroundQuery.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,0BAA0B,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAI1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;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,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC;AAE5D,wBAAgB,kBAAkB,CAChC,KAAK,GAAG,OAAO,EACf,UAAU,SAAS,kBAAkB,GAAG,kBAAkB,EAE1D,KAAK,EAAE,YAAY,GAAG,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,EAC1D,OAAO,EAAE,iCAAiC,CAAC,KAAK,EAAE,UAAU,CAAC,GAAG;IAC9D,IAAI,EAAE,OAAO,CAAC;CACf,GACA,wBAAwB,CAAC,KAAK,GAAG,SAAS,EAAE,UAAU,CAAC,CAAC;AAE3D,wBAAgB,kBAAkB,CAChC,KAAK,GAAG,OAAO,EACf,UAAU,SAAS,kBAAkB,GAAG,kBAAkB,EAE1D,KAAK,EAAE,YAAY,GAAG,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,EAC1D,OAAO,CAAC,EAAE,iCAAiC,CAAC,KAAK,EAAE,UAAU,CAAC,GAC7D,wBAAwB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC"}
@@ -1,43 +1,42 @@
1
- import { useState, useMemo, useCallback } from 'react';
2
- import { useApolloClient } from "./useApolloClient.js";
3
- import { QUERY_REFERENCE_SYMBOL, } from "../cache/QueryReference.js";
4
- import { useSuspenseCache } from "./useSuspenseCache.js";
5
- import { useTrackedQueryRefs, useWatchQueryOptions } from "./useSuspenseQuery.js";
6
- import { canonicalStringify } from "../../cache/index.js";
1
+ import * as React from 'react';
2
+ import { useApolloClient } from './useApolloClient.js';
3
+ import { QUERY_REFERENCE_SYMBOL, } from '../cache/QueryReference.js';
4
+ import { useSuspenseCache } from './useSuspenseCache.js';
5
+ import { useWatchQueryOptions } from './useSuspenseQuery.js';
6
+ import { canonicalStringify } from '../../cache/index.js';
7
7
  export function useBackgroundQuery(query, options) {
8
8
  if (options === void 0) { options = Object.create(null); }
9
9
  var suspenseCache = useSuspenseCache(options.suspenseCache);
10
10
  var client = useApolloClient(options.client);
11
11
  var watchQueryOptions = useWatchQueryOptions({ client: client, query: query, options: options });
12
- var fetchPolicy = watchQueryOptions.fetchPolicy, variables = watchQueryOptions.variables;
12
+ var variables = watchQueryOptions.variables;
13
13
  var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a;
14
14
  var cacheKey = [client, query, canonicalStringify(variables)].concat(queryKey);
15
15
  var queryRef = suspenseCache.getQueryRef(cacheKey, function () {
16
16
  return client.watchQuery(watchQueryOptions);
17
17
  });
18
- var currentFetchPolicy = queryRef.watchQueryOptions.fetchPolicy;
19
- var _b = useState(function () { return new Map([[queryRef.key, queryRef.promise]]); }), promiseCache = _b[0], setPromiseCache = _b[1];
20
- if (currentFetchPolicy === 'standby' && fetchPolicy !== currentFetchPolicy) {
21
- var promise = queryRef.reobserve({ fetchPolicy: fetchPolicy });
18
+ var _b = React.useState(function () { return new Map([[queryRef.key, queryRef.promise]]); }), promiseCache = _b[0], setPromiseCache = _b[1];
19
+ if (queryRef.didChangeOptions(watchQueryOptions)) {
20
+ var promise = queryRef.applyOptions(watchQueryOptions);
22
21
  promiseCache.set(queryRef.key, promise);
23
22
  }
24
- useTrackedQueryRefs(queryRef);
25
- var fetchMore = useCallback(function (options) {
23
+ React.useEffect(function () { return queryRef.retain(); }, [queryRef]);
24
+ var fetchMore = React.useCallback(function (options) {
26
25
  var promise = queryRef.fetchMore(options);
27
26
  setPromiseCache(function (promiseCache) {
28
- return new Map(promiseCache).set(queryRef.key, promise);
27
+ return new Map(promiseCache).set(queryRef.key, queryRef.promise);
29
28
  });
30
29
  return promise;
31
30
  }, [queryRef]);
32
- var refetch = useCallback(function (variables) {
31
+ var refetch = React.useCallback(function (variables) {
33
32
  var promise = queryRef.refetch(variables);
34
33
  setPromiseCache(function (promiseCache) {
35
- return new Map(promiseCache).set(queryRef.key, promise);
34
+ return new Map(promiseCache).set(queryRef.key, queryRef.promise);
36
35
  });
37
36
  return promise;
38
37
  }, [queryRef]);
39
38
  queryRef.promiseCache = promiseCache;
40
- return useMemo(function () {
39
+ return React.useMemo(function () {
41
40
  var _a;
42
41
  return [
43
42
  (_a = {}, _a[QUERY_REFERENCE_SYMBOL] = queryRef, _a),
@@ -1 +1 @@
1
- {"version":3,"file":"useBackgroundQuery.js","sourceRoot":"","sources":["../../../src/react/hooks/useBackgroundQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAMvD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EACL,sBAAsB,GAEvB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAqGjD,MAAM,UAAU,kBAAkB,CAIhC,KAA0D,EAC1D,OAEC;IAFD,wBAAA,EAAA,UAAgE,MAAM,CAAC,MAAM,CAC3E,IAAI,CACL;IAED,IAAM,aAAa,GAAG,gBAAgB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAC9D,IAAM,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/C,IAAM,iBAAiB,GAAG,oBAAoB,CAAC,EAAE,MAAM,QAAA,EAAE,KAAK,OAAA,EAAE,OAAO,SAAA,EAAE,CAAC,CAAC;IACnE,IAAA,WAAW,GAAgB,iBAAiB,YAAjC,EAAE,SAAS,GAAK,iBAAiB,UAAtB,CAAuB;IAC7C,IAAA,KAAkB,OAAO,SAAZ,EAAb,QAAQ,mBAAG,EAAE,KAAA,CAAa;IAElC,IAAM,QAAQ,GACZ,CAAC,MAAM,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAC9C,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAEnB,IAAM,QAAQ,GAAG,aAAa,CAAC,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D,CAAgD,CACjD,CAAC;QAEF,OAAO,OAAO,CAAC;IACjB,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,QAAQ,CAAC,YAAY,GAAG,YAAY,CAAC;IAErC,OAAO,OAAO,CAAC;;QACb,OAAO;sBACH,GAAC,sBAAsB,IAAG,QAAQ;YACpC;gBACE,SAAS,WAAA;gBACT,OAAO,SAAA;aACR;SACF,CAAC;IACJ,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;AACrC,CAAC","sourcesContent":["import { useState, useMemo, useCallback } from 'react';\nimport type {\n DocumentNode,\n OperationVariables,\n TypedDocumentNode,\n} from '../../core';\nimport { useApolloClient } from './useApolloClient';\nimport {\n QUERY_REFERENCE_SYMBOL,\n type QueryReference,\n} from '../cache/QueryReference';\nimport type { BackgroundQueryHookOptions, NoInfer } from '../types/types';\nimport { __use } from './internal';\nimport { useSuspenseCache } from './useSuspenseCache';\nimport { useTrackedQueryRefs, useWatchQueryOptions } from './useSuspenseQuery';\nimport type { FetchMoreFunction, RefetchFunction } from './useSuspenseQuery';\nimport { canonicalStringify } from '../../cache';\nimport type { DeepPartial } from '../../utilities';\n\nexport type UseBackgroundQueryResult<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables\n> = [\n QueryReference<TData>,\n {\n fetchMore: FetchMoreFunction<TData, TVariables>;\n refetch: RefetchFunction<TData, TVariables>;\n }\n];\n\ntype BackgroundQueryHookOptionsNoInfer<\n TData,\n TVariables extends OperationVariables\n> = BackgroundQueryHookOptions<NoInfer<TData>, NoInfer<TVariables>>;\n\nexport function useBackgroundQuery<\n TData,\n TVariables extends OperationVariables,\n TOptions extends Omit<BackgroundQueryHookOptions<TData>, 'variables'>\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options?: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & TOptions\n): UseBackgroundQueryResult<\n TOptions['errorPolicy'] extends 'ignore' | 'all'\n ? TOptions['returnPartialData'] extends true\n ? DeepPartial<TData> | undefined\n : TData | undefined\n : TOptions['returnPartialData'] extends true\n ? TOptions['skip'] extends boolean\n ? DeepPartial<TData> | undefined\n : DeepPartial<TData>\n : TOptions['skip'] extends boolean\n ? TData | undefined\n : TData,\n TVariables\n>;\n\nexport function useBackgroundQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {\n returnPartialData: true;\n errorPolicy: 'ignore' | 'all';\n }\n): UseBackgroundQueryResult<DeepPartial<TData> | undefined, TVariables>;\n\nexport function useBackgroundQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {\n errorPolicy: 'ignore' | 'all';\n }\n): UseBackgroundQueryResult<TData | undefined, TVariables>;\n\nexport function useBackgroundQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {\n skip: boolean;\n returnPartialData: true;\n }\n): UseBackgroundQueryResult<DeepPartial<TData> | undefined, TVariables>;\n\nexport function useBackgroundQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {\n returnPartialData: true;\n }\n): UseBackgroundQueryResult<DeepPartial<TData>, TVariables>;\n\nexport function useBackgroundQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {\n skip: boolean;\n }\n): UseBackgroundQueryResult<TData | undefined, TVariables>;\n\nexport function useBackgroundQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options?: BackgroundQueryHookOptionsNoInfer<TData, TVariables>\n): UseBackgroundQueryResult<TData, TVariables>;\n\nexport function useBackgroundQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: BackgroundQueryHookOptionsNoInfer<TData, TVariables> = Object.create(\n null\n )\n): UseBackgroundQueryResult<TData> {\n const suspenseCache = useSuspenseCache(options.suspenseCache);\n const client = useApolloClient(options.client);\n const watchQueryOptions = useWatchQueryOptions({ client, query, options });\n const { fetchPolicy, variables } = watchQueryOptions;\n const { queryKey = [] } = options;\n\n const cacheKey = (\n [client, query, canonicalStringify(variables)] as any[]\n ).concat(queryKey);\n\n const queryRef = suspenseCache.getQueryRef(cacheKey, () =>\n client.watchQuery(watchQueryOptions)\n );\n\n const { fetchPolicy: currentFetchPolicy } = queryRef.watchQueryOptions;\n\n const [promiseCache, setPromiseCache] = useState(\n () => new Map([[queryRef.key, queryRef.promise]])\n );\n\n if (currentFetchPolicy === 'standby' && fetchPolicy !== currentFetchPolicy) {\n const promise = queryRef.reobserve({ fetchPolicy });\n promiseCache.set(queryRef.key, promise);\n }\n\n useTrackedQueryRefs(queryRef);\n\n const fetchMore: FetchMoreFunction<TData, TVariables> = useCallback(\n (options) => {\n const promise = queryRef.fetchMore(options);\n\n setPromiseCache((promiseCache) =>\n new Map(promiseCache).set(queryRef.key, promise)\n );\n\n return promise;\n },\n [queryRef]\n );\n\n const refetch: RefetchFunction<TData, TVariables> = useCallback(\n (variables) => {\n const promise = queryRef.refetch(variables);\n\n setPromiseCache((promiseCache) =>\n new Map(promiseCache).set(queryRef.key, promise)\n );\n\n return promise;\n },\n [queryRef]\n );\n\n queryRef.promiseCache = promiseCache;\n\n return useMemo(() => {\n return [\n { [QUERY_REFERENCE_SYMBOL]: queryRef },\n {\n fetchMore,\n refetch,\n },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CAAC;IAEF,QAAQ,CAAC,YAAY,GAAG,YAAY,CAAC;IAErC,OAAO,KAAK,CAAC,OAAO,CAAC;;QACnB,OAAO;sBACH,GAAC,sBAAsB,IAAG,QAAQ;YACpC;gBACE,SAAS,WAAA;gBACT,OAAO,SAAA;aACR;SACF,CAAC;IACJ,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;AACrC,CAAC","sourcesContent":["import * as React from 'react';\nimport type {\n DocumentNode,\n OperationVariables,\n TypedDocumentNode,\n} from '../../core/index.js';\nimport { useApolloClient } from './useApolloClient.js';\nimport {\n QUERY_REFERENCE_SYMBOL,\n type QueryReference,\n} from '../cache/QueryReference.js';\nimport type { BackgroundQueryHookOptions, NoInfer } from '../types/types.js';\nimport { __use } from './internal/index.js';\nimport { useSuspenseCache } from './useSuspenseCache.js';\nimport { useWatchQueryOptions } from './useSuspenseQuery.js';\nimport type { FetchMoreFunction, RefetchFunction } from './useSuspenseQuery.js';\nimport { canonicalStringify } from '../../cache/index.js';\nimport type { DeepPartial } from '../../utilities/index.js';\n\nexport type UseBackgroundQueryResult<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables\n> = [\n QueryReference<TData>,\n {\n fetchMore: FetchMoreFunction<TData, TVariables>;\n refetch: RefetchFunction<TData, TVariables>;\n }\n];\n\ntype BackgroundQueryHookOptionsNoInfer<\n TData,\n TVariables extends OperationVariables\n> = BackgroundQueryHookOptions<NoInfer<TData>, NoInfer<TVariables>>;\n\nexport function useBackgroundQuery<\n TData,\n TVariables extends OperationVariables,\n TOptions extends Omit<BackgroundQueryHookOptions<TData>, 'variables'>\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options?: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & TOptions\n): UseBackgroundQueryResult<\n TOptions['errorPolicy'] extends 'ignore' | 'all'\n ? TOptions['returnPartialData'] extends true\n ? DeepPartial<TData> | undefined\n : TData | undefined\n : TOptions['returnPartialData'] extends true\n ? TOptions['skip'] extends boolean\n ? DeepPartial<TData> | undefined\n : DeepPartial<TData>\n : TOptions['skip'] extends boolean\n ? TData | undefined\n : TData,\n TVariables\n>;\n\nexport function useBackgroundQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {\n returnPartialData: true;\n errorPolicy: 'ignore' | 'all';\n }\n): UseBackgroundQueryResult<DeepPartial<TData> | undefined, TVariables>;\n\nexport function useBackgroundQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {\n errorPolicy: 'ignore' | 'all';\n }\n): UseBackgroundQueryResult<TData | undefined, TVariables>;\n\nexport function useBackgroundQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {\n skip: boolean;\n returnPartialData: true;\n }\n): UseBackgroundQueryResult<DeepPartial<TData> | undefined, TVariables>;\n\nexport function useBackgroundQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {\n returnPartialData: true;\n }\n): UseBackgroundQueryResult<DeepPartial<TData>, TVariables>;\n\nexport function useBackgroundQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {\n skip: boolean;\n }\n): UseBackgroundQueryResult<TData | undefined, TVariables>;\n\nexport function useBackgroundQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options?: BackgroundQueryHookOptionsNoInfer<TData, TVariables>\n): UseBackgroundQueryResult<TData, TVariables>;\n\nexport function useBackgroundQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: BackgroundQueryHookOptionsNoInfer<TData, TVariables> = Object.create(\n null\n )\n): UseBackgroundQueryResult<TData> {\n const suspenseCache = useSuspenseCache(options.suspenseCache);\n const client = useApolloClient(options.client);\n const watchQueryOptions = useWatchQueryOptions({ client, query, options });\n const { variables } = watchQueryOptions;\n const { queryKey = [] } = options;\n\n const cacheKey = (\n [client, query, canonicalStringify(variables)] as any[]\n ).concat(queryKey);\n\n const queryRef = suspenseCache.getQueryRef(cacheKey, () =>\n client.watchQuery(watchQueryOptions)\n );\n\n const [promiseCache, setPromiseCache] = React.useState(\n () => new Map([[queryRef.key, queryRef.promise]])\n );\n\n if (queryRef.didChangeOptions(watchQueryOptions)) {\n const promise = queryRef.applyOptions(watchQueryOptions);\n promiseCache.set(queryRef.key, promise);\n }\n\n React.useEffect(() => queryRef.retain(), [queryRef]);\n\n const fetchMore: FetchMoreFunction<TData, TVariables> = React.useCallback(\n (options) => {\n const promise = queryRef.fetchMore(options);\n\n setPromiseCache((promiseCache) =>\n new Map(promiseCache).set(queryRef.key, queryRef.promise)\n );\n\n return promise;\n },\n [queryRef]\n );\n\n const refetch: RefetchFunction<TData, TVariables> = React.useCallback(\n (variables) => {\n const promise = queryRef.refetch(variables);\n\n setPromiseCache((promiseCache) =>\n new Map(promiseCache).set(queryRef.key, queryRef.promise)\n );\n\n return promise;\n },\n [queryRef]\n );\n\n queryRef.promiseCache = promiseCache;\n\n return React.useMemo(() => {\n return [\n { [QUERY_REFERENCE_SYMBOL]: queryRef },\n {\n fetchMore,\n refetch,\n },\n ];\n }, [queryRef, fetchMore, refetch]);\n}\n"]}
@@ -1,7 +1,7 @@
1
- import type { DeepPartial } from "../../utilities";
2
- import type { Cache, Reference, StoreObject, MissingTree } from "../../cache";
3
- import type { OperationVariables } from "../../core";
4
- import type { NoInfer } from "../types/types";
1
+ import type { DeepPartial } from "../../utilities/index.js";
2
+ import type { Cache, Reference, StoreObject, MissingTree } from "../../cache/index.js";
3
+ import type { OperationVariables } from "../../core/index.js";
4
+ import type { NoInfer } from "../types/types.js";
5
5
  export interface UseFragmentOptions<TData, TVars> extends Omit<Cache.DiffOptions<NoInfer<TData>, NoInfer<TVars>>, "id" | "query" | "optimistic" | "previousResult" | "returnPartialData">, Omit<Cache.ReadFragmentOptions<TData, TVars>, "id" | "variables" | "returnPartialData"> {
6
6
  from: StoreObject | Reference | string;
7
7
  optimistic?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"useFragment.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/useFragment.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAElD,OAAO,KAAK,EACV,KAAK,EACL,SAAS,EACT,WAAW,EACX,WAAW,EACZ,MAAM,aAAa,CAAC;AAIrB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,WAAW,kBAAkB,CAAC,KAAK,EAAE,KAAK,CAChD,SAAQ,IAAI,CACV,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,EAC/C,IAAI,GACJ,OAAO,GACP,YAAY,GACZ,gBAAgB,GAChB,mBAAmB,CACtB,EAAE,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,KAAK,EAAE,KAAK,CAAC,EAC3C,IAAI,GACJ,WAAW,GACX,mBAAmB,CACtB;IACC,IAAI,EAAE,WAAW,GAAG,SAAS,GAAG,MAAM,CAAC;IAEvC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,MAAM,iB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BAAiB,CAAC,KAAK,IAC/B;IACE,IAAI,EAAE,KAAK,CAAC;IACZ,QAAQ,EAAE,IAAI,CAAC;IACf,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB,GACD;IACE,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC;IAChB,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB,CAAC;AAEN,wBAAgB,WAAW,CACzB,KAAK,GAAG,GAAG,EACX,KAAK,GAAG,kBAAkB,EAE1B,OAAO,EAAE,kBAAkB,CAAC,KAAK,EAAE,KAAK,CAAC,GACxC,iBAAiB,CAAC,KAAK,CAAC,CA+C1B"}
@@ -1,5 +1,5 @@
1
1
  import { __assign, __rest } from "tslib";
2
- import { useRef } from "react";
2
+ import * as React from "react";
3
3
  import { equal } from "@wry/equality";
4
4
  import { mergeDeepArray } from "../../utilities/index.js";
5
5
  import { useApolloClient } from "./useApolloClient.js";
@@ -8,7 +8,7 @@ export function useFragment(options) {
8
8
  var cache = useApolloClient().cache;
9
9
  var fragment = options.fragment, fragmentName = options.fragmentName, from = options.from, _a = options.optimistic, optimistic = _a === void 0 ? true : _a, rest = __rest(options, ["fragment", "fragmentName", "from", "optimistic"]);
10
10
  var diffOptions = __assign(__assign({}, rest), { returnPartialData: true, id: typeof from === "string" ? from : cache.identify(from), query: cache["getFragmentDoc"](fragment, fragmentName), optimistic: optimistic });
11
- var resultRef = useRef();
11
+ var resultRef = React.useRef();
12
12
  var latestDiff = cache.diff(diffOptions);
13
13
  var getSnapshot = function () {
14
14
  var latestDiffToResult = diffToResult(latestDiff);
@@ -1 +1 @@
1
- {"version":3,"file":"useFragment.js","sourceRoot":"","sources":["../../../src/react/hooks/useFragment.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAGtC,OAAO,EAAE,cAAc,EAAE,MAA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QAAQ,YAAC,IAAI;gBACX,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE;oBAC5B,SAAS,CAAC,OAAO,GAAG,YAAY,CAAC,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC;oBACtD,WAAW,EAAE,CAAC;iBACf;YACH,CAAC,IACD,CAAC;IACL,CAAC,EACD,WAAW,EACX,WAAW,CACZ,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CACnB,IAA6B;IAE7B,IAAM,MAAM,GAAG;QACb,IAAI,EAAE,IAAI,CAAC,MAAO;QAClB,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ;KACE,CAAC;IAE9B,IAAI,IAAI,CAAC,OAAO,EAAE;QAChB,MAAM,CAAC,OAAO,GAAG,cAAc,CAC7B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,OAAO,EAAb,CAAa,CAAC,CACzC,CAAC;KACH;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { useRef } from \"react\";\nimport { equal } from \"@wry/equality\";\n\nimport type { DeepPartial} from \"../../utilities\";\nimport { mergeDeepArray } from \"../../utilities\";\nimport type {\n Cache,\n Reference,\n StoreObject,\n MissingTree,\n} from \"../../cache\";\n\nimport { useApolloClient } from \"./useApolloClient\";\nimport { useSyncExternalStore } from \"./useSyncExternalStore\";\nimport type { OperationVariables } from \"../../core\";\nimport type { NoInfer } from \"../types/types\";\n\nexport interface UseFragmentOptions<TData, TVars>\nextends Omit<\n Cache.DiffOptions<NoInfer<TData>, NoInfer<TVars>>,\n | \"id\"\n | \"query\"\n | \"optimistic\"\n | \"previousResult\"\n | \"returnPartialData\"\n>, Omit<Cache.ReadFragmentOptions<TData, TVars>,\n | \"id\"\n | \"variables\"\n | \"returnPartialData\"\n> {\n from: StoreObject | Reference | string;\n // Override this field to make it optional (default: true).\n optimistic?: boolean;\n}\n\nexport type UseFragmentResult<TData> =\n | {\n data: TData;\n complete: true;\n missing?: never;\n }\n | {\n data: DeepPartial<TData>;\n complete: false;\n missing?: MissingTree;\n };\n\nexport function useFragment<\n TData = any,\n TVars = OperationVariables\n>(\n options: UseFragmentOptions<TData, TVars>,\n): UseFragmentResult<TData> {\n const { cache } = useApolloClient();\n\n const {\n fragment,\n fragmentName,\n from,\n optimistic = true,\n ...rest\n } = options;\n\n const diffOptions: Cache.DiffOptions<TData, TVars> = {\n ...rest,\n returnPartialData: true,\n id: typeof from === \"string\" ? from : cache.identify(from),\n query: cache[\"getFragmentDoc\"](fragment, fragmentName),\n optimistic\n };\n\n const resultRef = useRef<UseFragmentResult<TData>>();\n let latestDiff = cache.diff<TData>(diffOptions);\n\n // Used for both getSnapshot and getServerSnapshot\n const getSnapshot = () => {\n const latestDiffToResult = diffToResult(latestDiff);\n return resultRef.current &&\n equal(resultRef.current.data, latestDiffToResult.data)\n ? resultRef.current\n : (resultRef.current = latestDiffToResult);\n };\n\n return useSyncExternalStore(\n (forceUpdate) => {\n return cache.watch({\n ...diffOptions,\n immediate: true,\n callback(diff) {\n if (!equal(diff, latestDiff)) {\n resultRef.current = diffToResult((latestDiff = diff));\n forceUpdate();\n }\n },\n });\n },\n getSnapshot,\n getSnapshot\n );\n}\n\nfunction diffToResult<TData>(\n diff: Cache.DiffResult<TData>,\n): UseFragmentResult<TData> {\n const result = {\n data: diff.result!,\n complete: !!diff.complete,\n } as UseFragmentResult<TData>;\n\n if (diff.missing) {\n result.missing = mergeDeepArray(\n diff.missing.map(error => error.missing),\n );\n }\n\n return result;\n}\n"]}
1
+ {"version":3,"file":"useFragment.js","sourceRoot":"","sources":["../../../src/react/hooks/useFragment.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAGtC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAQ1D,OAAO,EAAE,eA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IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE;oBAC5B,SAAS,CAAC,OAAO,GAAG,YAAY,CAAC,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC;oBACtD,WAAW,EAAE,CAAC;iBACf;YACH,CAAC,IACD,CAAC;IACL,CAAC,EACD,WAAW,EACX,WAAW,CACZ,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CACnB,IAA6B;IAE7B,IAAM,MAAM,GAAG;QACb,IAAI,EAAE,IAAI,CAAC,MAAO;QAClB,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ;KACE,CAAC;IAE9B,IAAI,IAAI,CAAC,OAAO,EAAE;QAChB,MAAM,CAAC,OAAO,GAAG,cAAc,CAC7B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,OAAO,EAAb,CAAa,CAAC,CACzC,CAAC;KACH;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import * as React from \"react\";\nimport { equal } from \"@wry/equality\";\n\nimport type { DeepPartial} from \"../../utilities/index.js\";\nimport { mergeDeepArray } from \"../../utilities/index.js\";\nimport type {\n Cache,\n Reference,\n StoreObject,\n MissingTree,\n} from \"../../cache/index.js\";\n\nimport { useApolloClient } from \"./useApolloClient.js\";\nimport { useSyncExternalStore } from \"./useSyncExternalStore.js\";\nimport type { OperationVariables } from \"../../core/index.js\";\nimport type { NoInfer } from \"../types/types.js\";\n\nexport interface UseFragmentOptions<TData, TVars>\nextends Omit<\n Cache.DiffOptions<NoInfer<TData>, NoInfer<TVars>>,\n | \"id\"\n | \"query\"\n | \"optimistic\"\n | \"previousResult\"\n | \"returnPartialData\"\n>, Omit<Cache.ReadFragmentOptions<TData, TVars>,\n | \"id\"\n | \"variables\"\n | \"returnPartialData\"\n> {\n from: StoreObject | Reference | string;\n // Override this field to make it optional (default: true).\n optimistic?: boolean;\n}\n\nexport type UseFragmentResult<TData> =\n | {\n data: TData;\n complete: true;\n missing?: never;\n }\n | {\n data: DeepPartial<TData>;\n complete: false;\n missing?: MissingTree;\n };\n\nexport function useFragment<\n TData = any,\n TVars = OperationVariables\n>(\n options: UseFragmentOptions<TData, TVars>,\n): UseFragmentResult<TData> {\n const { cache } = useApolloClient();\n\n const {\n fragment,\n fragmentName,\n from,\n optimistic = true,\n ...rest\n } = options;\n\n const diffOptions: Cache.DiffOptions<TData, TVars> = {\n ...rest,\n returnPartialData: true,\n id: typeof from === \"string\" ? from : cache.identify(from),\n query: cache[\"getFragmentDoc\"](fragment, fragmentName),\n optimistic\n };\n\n const resultRef = React.useRef<UseFragmentResult<TData>>();\n let latestDiff = cache.diff<TData>(diffOptions);\n\n // Used for both getSnapshot and getServerSnapshot\n const getSnapshot = () => {\n const latestDiffToResult = diffToResult(latestDiff);\n return resultRef.current &&\n equal(resultRef.current.data, latestDiffToResult.data)\n ? resultRef.current\n : (resultRef.current = latestDiffToResult);\n };\n\n return useSyncExternalStore(\n (forceUpdate) => {\n return cache.watch({\n ...diffOptions,\n immediate: true,\n callback(diff) {\n if (!equal(diff, latestDiff)) {\n resultRef.current = diffToResult((latestDiff = diff));\n forceUpdate();\n }\n },\n });\n },\n getSnapshot,\n getSnapshot\n );\n}\n\nfunction diffToResult<TData>(\n diff: Cache.DiffResult<TData>,\n): UseFragmentResult<TData> {\n const result = {\n data: diff.result!,\n complete: !!diff.complete,\n } as UseFragmentResult<TData>;\n\n if (diff.missing) {\n result.missing = mergeDeepArray(\n diff.missing.map(error => error.missing),\n );\n }\n\n return result;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import type { DocumentNode } from 'graphql';
2
2
  import type { TypedDocumentNode } from '@graphql-typed-document-node/core';
3
- import type { OperationVariables } from '../../core';
4
- import type { LazyQueryHookOptions, LazyQueryResultTuple, NoInfer } from '../types/types';
3
+ import type { OperationVariables } from '../../core/index.js';
4
+ import type { LazyQueryHookOptions, LazyQueryResultTuple, NoInfer } from '../types/types.js';
5
5
  export declare function useLazyQuery<TData = any, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: LazyQueryHookOptions<NoInfer<TData>, NoInfer<TVariables>>): LazyQueryResultTuple<TData, TVariables>;
6
6
  //# sourceMappingURL=useLazyQuery.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useLazyQuery.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/useLazyQuery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAG3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,OAAO,KAAK,EAEV,oBAAoB,EACpB,oBAAoB,EACpB,OAAO,EAER,MAAM,gBAAgB,CAAC;AAexB,wBAAgB,YAAY,CAAC,KAAK,GAAG,GAAG,EAAE,UAAU,SAAS,kBAAkB,GAAG,kBAAkB,EAClG,KAAK,EAAE,YAAY,GAAG,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,EAC1D,OAAO,CAAC,EAAE,oBAAoB,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,GAClE,oBAAoB,CAAC,KAAK,EAAE,UAAU,CAAC,CA8EzC"}
1
+ {"version":3,"file":"useLazyQuery.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/useLazyQuery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAG3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,OAAO,KAAK,EAEV,oBAAoB,EACpB,oBAAoB,EACpB,OAAO,EAER,MAAM,mBAAmB,CAAC;AAe3B,wBAAgB,YAAY,CAAC,KAAK,GAAG,GAAG,EAAE,UAAU,SAAS,kBAAkB,GAAG,kBAAkB,EAClG,KAAK,EAAE,YAAY,GAAG,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,EAC1D,OAAO,CAAC,EAAE,oBAAoB,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,GAClE,oBAAoB,CAAC,KAAK,EAAE,UAAU,CAAC,CA8EzC"}
@@ -1,8 +1,8 @@
1
1
  import { __assign } from "tslib";
2
- import { useCallback, useMemo, useRef } from 'react';
3
- import { mergeOptions } from "../../utilities/index.js";
4
- import { useInternalState } from "./useQuery.js";
5
- import { useApolloClient } from "./useApolloClient.js";
2
+ import * as React from 'react';
3
+ import { mergeOptions } from '../../utilities/index.js';
4
+ import { useInternalState } from './useQuery.js';
5
+ import { useApolloClient } from './useApolloClient.js';
6
6
  var EAGER_METHODS = [
7
7
  'refetch',
8
8
  'reobserve',
@@ -13,9 +13,9 @@ var EAGER_METHODS = [
13
13
  ];
14
14
  export function useLazyQuery(query, options) {
15
15
  var _a;
16
- var execOptionsRef = useRef();
17
- var optionsRef = useRef();
18
- var queryRef = useRef();
16
+ var execOptionsRef = React.useRef();
17
+ var optionsRef = React.useRef();
18
+ var queryRef = React.useRef();
19
19
  var merged = mergeOptions(options, execOptionsRef.current || {});
20
20
  var document = (_a = merged === null || merged === void 0 ? void 0 : merged.query) !== null && _a !== void 0 ? _a : query;
21
21
  optionsRef.current = merged;
@@ -27,7 +27,7 @@ export function useLazyQuery(query, options) {
27
27
  var result = Object.assign(useQueryResult, {
28
28
  called: !!execOptionsRef.current,
29
29
  });
30
- var eagerMethods = useMemo(function () {
30
+ var eagerMethods = React.useMemo(function () {
31
31
  var eagerMethods = {};
32
32
  var _loop_1 = function (key) {
33
33
  var method = result[key];
@@ -46,7 +46,7 @@ export function useLazyQuery(query, options) {
46
46
  return eagerMethods;
47
47
  }, []);
48
48
  Object.assign(result, eagerMethods);
49
- var execute = useCallback(function (executeOptions) {
49
+ var execute = React.useCallback(function (executeOptions) {
50
50
  execOptionsRef.current = executeOptions ? __assign(__assign({}, executeOptions), { fetchPolicy: executeOptions.fetchPolicy || initialFetchPolicy }) : {
51
51
  fetchPolicy: initialFetchPolicy,
52
52
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useLazyQuery.js","sourceRoot":"","sources":["../../../src/react/hooks/useLazyQuery.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAGrD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAQ/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAIpD,IAAM,aAAa,GAAG;IACpB,SAAS;IACT,WAAW;IACX,WAAW;IACX,aAAa;IACb,cAAc;IACd,iBAAiB;CACT,CAAC;AAEX,MAAM,UAAU,YAAY,CAC1B,KAA0D,EAC1D,OAAmE;;IAEnE,IAAM,cAAc,GAAG,MAAM,EAAwD,CAAC;IACtF,IAAM,UAAU,GAAG,MAAM,EAA2C,CAAC;IACrE,IAAM,QAAQ,GAAG,MAAM,EAAuD,CAAC;IAC/E,IAAM,MAAM,GAAG,YAAY,CAAC,OAAO,EAAE,cAAc,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;IACnE,IAAM,QAAQ,GAAG,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,mCAAI,KAAK,CAAC;IAIxC,UAAU,CAAC,OAAO,GAAG,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC;IAE5B,IAAM,aAAa,GAAG,gBAAgB,CACpC,eAAe,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,EAC1C,QAAQ,CACT,CAAC;IAEF,IAAM,cAAc,GAAG,aAAa,CAA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AAO,aAC7C,KAAK,EAAE,QAAQ,CAAC,OAAO,IACpB,cAAc,CAAC,OAAO,EACzB,CAAA;QAEF,IAAM,OAAO,GAAG,aAAa;aAC1B,YAAY,uBAAM,OAAO,KAAE,IAAI,EAAE,KAAK,IAAG;aACzC,IAAI,CAAC,UAAC,WAAW,IAAK,OAAA,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,YAAY,CAAC,EAAxC,CAAwC,CAAC,CAAC;QAInE,OAAO,CAAC,KAAK,CAAC,cAAO,CAAC,CAAC,CAAC;QAExB,OAAO,OAAO,CAAC;IACjB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["import type { DocumentNode } from 'graphql';\nimport type { TypedDocumentNode } from '@graphql-typed-document-node/core';\nimport { useCallback, useMemo, useRef } from 'react';\n\nimport type { OperationVariables } from '../../core';\nimport { mergeOptions } from '../../utilities';\nimport type {\n LazyQueryHookExecOptions,\n LazyQueryHookOptions,\n LazyQueryResultTuple,\n NoInfer,\n QueryResult,\n} from '../types/types';\nimport { useInternalState } from './useQuery';\nimport { useApolloClient } from './useApolloClient';\n\n// The following methods, when called will execute the query, regardless of\n// whether the useLazyQuery execute function was called before.\nconst EAGER_METHODS = [\n 'refetch',\n 'reobserve',\n 'fetchMore',\n 'updateQuery',\n 'startPolling',\n 'subscribeToMore',\n] as const;\n\nexport function useLazyQuery<TData = any, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options?: LazyQueryHookOptions<NoInfer<TData>, NoInfer<TVariables>>\n): LazyQueryResultTuple<TData, TVariables> {\n const execOptionsRef = useRef<Partial<LazyQueryHookExecOptions<TData, TVariables>>>();\n const optionsRef = useRef<LazyQueryHookOptions<TData, TVariables>>();\n const queryRef = useRef<DocumentNode | TypedDocumentNode<TData, TVariables>>();\n const merged = mergeOptions(options, execOptionsRef.current || {});\n const document = merged?.query ?? query;\n\n // Use refs to track options and the used query to ensure the `execute` \n // function remains referentially stable between renders.\n optionsRef.current = merged;\n queryRef.current = document;\n\n const internalState = useInternalState<TData, TVariables>(\n useApolloClient(options && options.client),\n document\n );\n\n const useQueryResult = internalState.useQuery({\n ...merged,\n skip: !execOptionsRef.current,\n });\n\n const initialFetchPolicy =\n useQueryResult.observable.options.initialFetchPolicy ||\n internalState.getDefaultFetchPolicy();\n\n const result: QueryResult<TData, TVariables> =\n Object.assign(useQueryResult, {\n called: !!execOptionsRef.current,\n });\n\n // We use useMemo here to make sure the eager methods have a stable identity.\n const eagerMethods = useMemo(() => {\n const eagerMethods: Record<string, any> = {};\n for (const key of EAGER_METHODS) {\n const method = result[key];\n eagerMethods[key] = function () {\n if (!execOptionsRef.current) {\n execOptionsRef.current = Object.create(null);\n // Only the first time populating execOptionsRef.current matters here.\n internalState.forceUpdate();\n }\n return method.apply(this, arguments);\n };\n }\n\n return eagerMethods;\n }, []);\n\n Object.assign(result, eagerMethods);\n\n const execute = useCallback<\n LazyQueryResultTuple<TData, TVariables>[0]\n >(executeOptions => {\n execOptionsRef.current = executeOptions ? {\n ...executeOptions,\n fetchPolicy: executeOptions.fetchPolicy || initialFetchPolicy,\n } : {\n fetchPolicy: initialFetchPolicy,\n };\n\n const options = mergeOptions(optionsRef.current, {\n query: queryRef.current,\n ...execOptionsRef.current,\n })\n\n const promise = internalState\n .executeQuery({ ...options, skip: false })\n .then((queryResult) => Object.assign(queryResult, eagerMethods));\n\n // Because the return value of `useLazyQuery` is usually floated, we need\n // to catch the promise to prevent unhandled rejections.\n promise.catch(() => {});\n\n return promise;\n }, []);\n\n return [execute, result];\n}\n"]}
1
+ {"version":3,"file":"useLazyQuery.js","sourceRoot":"","sources":["../../../src/react/hooks/useLazyQuery.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAQxD,OAA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AAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["import type { DocumentNode } from 'graphql';\nimport type { TypedDocumentNode } from '@graphql-typed-document-node/core';\nimport * as React from 'react';\n\nimport type { OperationVariables } from '../../core/index.js';\nimport { mergeOptions } from '../../utilities/index.js';\nimport type {\n LazyQueryHookExecOptions,\n LazyQueryHookOptions,\n LazyQueryResultTuple,\n NoInfer,\n QueryResult,\n} from '../types/types.js';\nimport { useInternalState } from './useQuery.js';\nimport { useApolloClient } from './useApolloClient.js';\n\n// The following methods, when called will execute the query, regardless of\n// whether the useLazyQuery execute function was called before.\nconst EAGER_METHODS = [\n 'refetch',\n 'reobserve',\n 'fetchMore',\n 'updateQuery',\n 'startPolling',\n 'subscribeToMore',\n] as const;\n\nexport function useLazyQuery<TData = any, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options?: LazyQueryHookOptions<NoInfer<TData>, NoInfer<TVariables>>\n): LazyQueryResultTuple<TData, TVariables> {\n const execOptionsRef = React.useRef<Partial<LazyQueryHookExecOptions<TData, TVariables>>>();\n const optionsRef = React.useRef<LazyQueryHookOptions<TData, TVariables>>();\n const queryRef = React.useRef<DocumentNode | TypedDocumentNode<TData, TVariables>>();\n const merged = mergeOptions(options, execOptionsRef.current || {});\n const document = merged?.query ?? query;\n\n // Use refs to track options and the used query to ensure the `execute`\n // function remains referentially stable between renders.\n optionsRef.current = merged;\n queryRef.current = document;\n\n const internalState = useInternalState<TData, TVariables>(\n useApolloClient(options && options.client),\n document\n );\n\n const useQueryResult = internalState.useQuery({\n ...merged,\n skip: !execOptionsRef.current,\n });\n\n const initialFetchPolicy =\n useQueryResult.observable.options.initialFetchPolicy ||\n internalState.getDefaultFetchPolicy();\n\n const result: QueryResult<TData, TVariables> =\n Object.assign(useQueryResult, {\n called: !!execOptionsRef.current,\n });\n\n // We use useMemo here to make sure the eager methods have a stable identity.\n const eagerMethods = React.useMemo(() => {\n const eagerMethods: Record<string, any> = {};\n for (const key of EAGER_METHODS) {\n const method = result[key];\n eagerMethods[key] = function () {\n if (!execOptionsRef.current) {\n execOptionsRef.current = Object.create(null);\n // Only the first time populating execOptionsRef.current matters here.\n internalState.forceUpdate();\n }\n return method.apply(this, arguments);\n };\n }\n\n return eagerMethods;\n }, []);\n\n Object.assign(result, eagerMethods);\n\n const execute = React.useCallback<\n LazyQueryResultTuple<TData, TVariables>[0]\n >(executeOptions => {\n execOptionsRef.current = executeOptions ? {\n ...executeOptions,\n fetchPolicy: executeOptions.fetchPolicy || initialFetchPolicy,\n } : {\n fetchPolicy: initialFetchPolicy,\n };\n\n const options = mergeOptions(optionsRef.current, {\n query: queryRef.current,\n ...execOptionsRef.current,\n })\n\n const promise = internalState\n .executeQuery({ ...options, skip: false })\n .then((queryResult) => Object.assign(queryResult, eagerMethods));\n\n // Because the return value of `useLazyQuery` is usually floated, we need\n // to catch the promise to prevent unhandled rejections.\n promise.catch(() => {});\n\n return promise;\n }, []);\n\n return [execute, result];\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import type { DocumentNode } from 'graphql';
2
2
  import type { TypedDocumentNode } from '@graphql-typed-document-node/core';
3
- import type { MutationHookOptions, MutationTuple, NoInfer } from '../types/types';
4
- import type { ApolloCache, DefaultContext, OperationVariables } from '../../core';
3
+ import type { MutationHookOptions, MutationTuple, NoInfer } from '../types/types.js';
4
+ import type { ApolloCache, DefaultContext, OperationVariables } from '../../core/index.js';
5
5
  export declare function useMutation<TData = any, TVariables = OperationVariables, TContext = DefaultContext, TCache extends ApolloCache<any> = ApolloCache<any>>(mutation: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: MutationHookOptions<NoInfer<TData>, NoInfer<TVariables>, TContext, TCache>): MutationTuple<TData, TVariables, TContext, TCache>;
6
6
  //# sourceMappingURL=useMutation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useMutation.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/useMutation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,KAAK,EAEV,mBAAmB,EAEnB,aAAa,EACb,OAAO,EACR,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACd,kBAAkB,EAAC,MAAM,YAAY,CAAC;AASxC,wBAAgB,WAAW,CACzB,KAAK,GAAG,GAAG,EACX,UAAU,GAAG,kBAAkB,EAC/B,QAAQ,GAAG,cAAc,EACzB,MAAM,SAAS,WAAW,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,EAElD,QAAQ,EAAE,YAAY,GAAG,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,EAC7D,OAAO,CAAC,EAAE,mBAAmB,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GACnF,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,CA8HpD"}
1
+ {"version":3,"file":"useMutation.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/useMutation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,KAAK,EAEV,mBAAmB,EAEnB,aAAa,EACb,OAAO,EACR,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACd,kBAAkB,EAAC,MAAM,qBAAqB,CAAC;AASjD,wBAAgB,WAAW,CACzB,KAAK,GAAG,GAAG,EACX,UAAU,GAAG,kBAAkB,EAC/B,QAAQ,GAAG,cAAc,EACzB,MAAM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