@tanstack/query-core 5.101.4 → 5.102.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (370) hide show
  1. package/build/legacy/classPrivateFieldSet2-Bo0ZyOIv.cjs +56 -0
  2. package/build/legacy/classPrivateFieldSet2-CV7wyte-.js +27 -0
  3. package/build/legacy/classPrivateMethodInitSpec-CBwa_Y7C.js +7 -0
  4. package/build/legacy/classPrivateMethodInitSpec-DVhcLejn.cjs +12 -0
  5. package/build/legacy/environmentManager.cjs +25 -46
  6. package/build/legacy/environmentManager.cjs.map +1 -1
  7. package/build/legacy/environmentManager.d.cts +18 -2
  8. package/build/legacy/environmentManager.d.cts.map +1 -0
  9. package/build/legacy/environmentManager.d.ts +18 -2
  10. package/build/legacy/environmentManager.d.ts.map +1 -0
  11. package/build/legacy/environmentManager.js +23 -22
  12. package/build/legacy/environmentManager.js.map +1 -1
  13. package/build/legacy/focusManager.cjs +63 -104
  14. package/build/legacy/focusManager.cjs.map +1 -1
  15. package/build/legacy/focusManager.d.cts +18 -2
  16. package/build/legacy/focusManager.d.cts.map +1 -0
  17. package/build/legacy/focusManager.d.ts +18 -2
  18. package/build/legacy/focusManager.d.ts.map +1 -0
  19. package/build/legacy/focusManager.js +60 -76
  20. package/build/legacy/focusManager.js.map +1 -1
  21. package/build/legacy/hydration-D1E7ZbjZ.d.ts +1374 -0
  22. package/build/legacy/hydration-D1E7ZbjZ.d.ts.map +1 -0
  23. package/build/legacy/hydration-NBquRCHe.d.cts +1374 -0
  24. package/build/legacy/hydration-NBquRCHe.d.cts.map +1 -0
  25. package/build/legacy/hydration.cjs +114 -194
  26. package/build/legacy/hydration.cjs.map +1 -1
  27. package/build/legacy/hydration.d.cts +2 -7
  28. package/build/legacy/hydration.d.ts +2 -7
  29. package/build/legacy/hydration.js +108 -167
  30. package/build/legacy/hydration.js.map +1 -1
  31. package/build/legacy/index.cjs +59 -111
  32. package/build/legacy/index.cjs.map +1 -1
  33. package/build/legacy/index.d.cts +10 -141
  34. package/build/legacy/index.d.ts +10 -141
  35. package/build/legacy/index.js +16 -66
  36. package/build/legacy/index.js.map +1 -1
  37. package/build/legacy/infiniteQueryBehavior.cjs +92 -135
  38. package/build/legacy/infiniteQueryBehavior.cjs.map +1 -1
  39. package/build/legacy/infiniteQueryBehavior.d.cts +14 -3
  40. package/build/legacy/infiniteQueryBehavior.d.cts.map +1 -0
  41. package/build/legacy/infiniteQueryBehavior.d.ts +14 -3
  42. package/build/legacy/infiniteQueryBehavior.d.ts.map +1 -0
  43. package/build/legacy/infiniteQueryBehavior.js +89 -115
  44. package/build/legacy/infiniteQueryBehavior.js.map +1 -1
  45. package/build/legacy/infiniteQueryObserver.cjs +59 -88
  46. package/build/legacy/infiniteQueryObserver.cjs.map +1 -1
  47. package/build/legacy/infiniteQueryObserver.d.cts +20 -1
  48. package/build/legacy/infiniteQueryObserver.d.cts.map +1 -0
  49. package/build/legacy/infiniteQueryObserver.d.ts +20 -1
  50. package/build/legacy/infiniteQueryObserver.d.ts.map +1 -0
  51. package/build/legacy/infiniteQueryObserver.js +57 -64
  52. package/build/legacy/infiniteQueryObserver.js.map +1 -1
  53. package/build/legacy/mutation.cjs +236 -329
  54. package/build/legacy/mutation.cjs.map +1 -1
  55. package/build/legacy/mutation.d.cts +2 -4
  56. package/build/legacy/mutation.d.ts +2 -4
  57. package/build/legacy/mutation.js +231 -299
  58. package/build/legacy/mutation.js.map +1 -1
  59. package/build/legacy/mutationCache.cjs +121 -166
  60. package/build/legacy/mutationCache.cjs.map +1 -1
  61. package/build/legacy/mutationCache.d.cts +2 -2
  62. package/build/legacy/mutationCache.d.ts +2 -2
  63. package/build/legacy/mutationCache.js +117 -130
  64. package/build/legacy/mutationCache.js.map +1 -1
  65. package/build/legacy/mutationObserver.cjs +134 -187
  66. package/build/legacy/mutationObserver.cjs.map +1 -1
  67. package/build/legacy/mutationObserver.d.cts +2 -1
  68. package/build/legacy/mutationObserver.d.ts +2 -1
  69. package/build/legacy/mutationObserver.js +132 -160
  70. package/build/legacy/mutationObserver.js.map +1 -1
  71. package/build/legacy/notifyManager.cjs +76 -110
  72. package/build/legacy/notifyManager.cjs.map +1 -1
  73. package/build/legacy/notifyManager.d.cts +48 -3
  74. package/build/legacy/notifyManager.d.cts.map +1 -0
  75. package/build/legacy/notifyManager.d.ts +48 -3
  76. package/build/legacy/notifyManager.d.ts.map +1 -0
  77. package/build/legacy/notifyManager.js +73 -84
  78. package/build/legacy/notifyManager.js.map +1 -1
  79. package/build/legacy/onlineManager.cjs +57 -93
  80. package/build/legacy/onlineManager.cjs.map +1 -1
  81. package/build/legacy/onlineManager.d.cts +17 -2
  82. package/build/legacy/onlineManager.d.cts.map +1 -0
  83. package/build/legacy/onlineManager.d.ts +17 -2
  84. package/build/legacy/onlineManager.d.ts.map +1 -0
  85. package/build/legacy/onlineManager.js +54 -65
  86. package/build/legacy/onlineManager.js.map +1 -1
  87. package/build/legacy/queriesObserver.cjs +203 -262
  88. package/build/legacy/queriesObserver.cjs.map +1 -1
  89. package/build/legacy/queriesObserver.d.cts +23 -2
  90. package/build/legacy/queriesObserver.d.cts.map +1 -0
  91. package/build/legacy/queriesObserver.d.ts +23 -2
  92. package/build/legacy/queriesObserver.d.ts.map +1 -0
  93. package/build/legacy/queriesObserver.js +199 -233
  94. package/build/legacy/queriesObserver.js.map +1 -1
  95. package/build/legacy/query.cjs +409 -491
  96. package/build/legacy/query.cjs.map +1 -1
  97. package/build/legacy/query.d.cts +2 -9
  98. package/build/legacy/query.d.ts +2 -9
  99. package/build/legacy/query.js +402 -467
  100. package/build/legacy/query.js.map +1 -1
  101. package/build/legacy/queryCache.cjs +99 -128
  102. package/build/legacy/queryCache.cjs.map +1 -1
  103. package/build/legacy/queryCache.d.cts +2 -3
  104. package/build/legacy/queryCache.d.ts +2 -3
  105. package/build/legacy/queryCache.js +96 -100
  106. package/build/legacy/queryCache.js.map +1 -1
  107. package/build/legacy/queryClient.cjs +295 -345
  108. package/build/legacy/queryClient.cjs.map +1 -1
  109. package/build/legacy/queryClient.d.cts +2 -1
  110. package/build/legacy/queryClient.d.ts +2 -1
  111. package/build/legacy/queryClient.js +292 -318
  112. package/build/legacy/queryClient.js.map +1 -1
  113. package/build/legacy/queryObserver.cjs +350 -502
  114. package/build/legacy/queryObserver.cjs.map +1 -1
  115. package/build/legacy/queryObserver.d.cts +2 -1
  116. package/build/legacy/queryObserver.d.ts +2 -1
  117. package/build/legacy/queryObserver.js +345 -480
  118. package/build/legacy/queryObserver.js.map +1 -1
  119. package/build/legacy/removable-DeMjhW5M.d.cts +13 -0
  120. package/build/legacy/removable-DeMjhW5M.d.cts.map +1 -0
  121. package/build/legacy/removable-DeMjhW5M.d.ts +13 -0
  122. package/build/legacy/removable-DeMjhW5M.d.ts.map +1 -0
  123. package/build/legacy/removable.cjs +31 -67
  124. package/build/legacy/removable.cjs.map +1 -1
  125. package/build/legacy/removable.d.cts +2 -1
  126. package/build/legacy/removable.d.ts +2 -1
  127. package/build/legacy/removable.js +28 -39
  128. package/build/legacy/removable.js.map +1 -1
  129. package/build/legacy/retryer.cjs +127 -155
  130. package/build/legacy/retryer.cjs.map +1 -1
  131. package/build/legacy/retryer.d.cts +2 -7
  132. package/build/legacy/retryer.d.ts +2 -7
  133. package/build/legacy/retryer.js +121 -127
  134. package/build/legacy/retryer.js.map +1 -1
  135. package/build/legacy/streamedQuery.cjs +49 -78
  136. package/build/legacy/streamedQuery.cjs.map +1 -1
  137. package/build/legacy/streamedQuery.d.cts +33 -1
  138. package/build/legacy/streamedQuery.d.cts.map +1 -0
  139. package/build/legacy/streamedQuery.d.ts +33 -1
  140. package/build/legacy/streamedQuery.d.ts.map +1 -0
  141. package/build/legacy/streamedQuery.js +47 -54
  142. package/build/legacy/streamedQuery.js.map +1 -1
  143. package/build/legacy/subscribable-CbifVTKz.d.cts +12 -0
  144. package/build/legacy/subscribable-CbifVTKz.d.cts.map +1 -0
  145. package/build/legacy/subscribable-CbifVTKz.d.ts +12 -0
  146. package/build/legacy/subscribable-CbifVTKz.d.ts.map +1 -0
  147. package/build/legacy/subscribable.cjs +22 -48
  148. package/build/legacy/subscribable.cjs.map +1 -1
  149. package/build/legacy/subscribable.d.cts +2 -1
  150. package/build/legacy/subscribable.d.ts +2 -1
  151. package/build/legacy/subscribable.js +21 -25
  152. package/build/legacy/subscribable.js.map +1 -1
  153. package/build/legacy/timeoutManager.cjs +64 -105
  154. package/build/legacy/timeoutManager.cjs.map +1 -1
  155. package/build/legacy/timeoutManager.d.cts +60 -7
  156. package/build/legacy/timeoutManager.d.cts.map +1 -0
  157. package/build/legacy/timeoutManager.d.ts +60 -7
  158. package/build/legacy/timeoutManager.d.ts.map +1 -0
  159. package/build/legacy/timeoutManager.js +60 -76
  160. package/build/legacy/timeoutManager.js.map +1 -1
  161. package/build/legacy/types.cjs +10 -35
  162. package/build/legacy/types.cjs.map +1 -1
  163. package/build/legacy/types.d.cts +2 -94
  164. package/build/legacy/types.d.ts +2 -94
  165. package/build/legacy/types.js +7 -10
  166. package/build/legacy/types.js.map +1 -1
  167. package/build/legacy/utils.cjs +175 -300
  168. package/build/legacy/utils.cjs.map +1 -1
  169. package/build/legacy/utils.d.cts +2 -30
  170. package/build/legacy/utils.d.ts +2 -30
  171. package/build/legacy/utils.js +149 -252
  172. package/build/legacy/utils.js.map +1 -1
  173. package/build/modern/environmentManager.cjs +25 -46
  174. package/build/modern/environmentManager.cjs.map +1 -1
  175. package/build/modern/environmentManager.d.cts +18 -2
  176. package/build/modern/environmentManager.d.cts.map +1 -0
  177. package/build/modern/environmentManager.d.ts +18 -2
  178. package/build/modern/environmentManager.d.ts.map +1 -0
  179. package/build/modern/environmentManager.js +23 -20
  180. package/build/modern/environmentManager.js.map +1 -1
  181. package/build/modern/focusManager.cjs +56 -90
  182. package/build/modern/focusManager.cjs.map +1 -1
  183. package/build/modern/focusManager.d.cts +18 -2
  184. package/build/modern/focusManager.d.cts.map +1 -0
  185. package/build/modern/focusManager.d.ts +18 -2
  186. package/build/modern/focusManager.d.ts.map +1 -0
  187. package/build/modern/focusManager.js +53 -63
  188. package/build/modern/focusManager.js.map +1 -1
  189. package/build/modern/hydration-D1E7ZbjZ.d.ts +1374 -0
  190. package/build/modern/hydration-D1E7ZbjZ.d.ts.map +1 -0
  191. package/build/modern/hydration-NBquRCHe.d.cts +1374 -0
  192. package/build/modern/hydration-NBquRCHe.d.cts.map +1 -0
  193. package/build/modern/hydration.cjs +105 -189
  194. package/build/modern/hydration.cjs.map +1 -1
  195. package/build/modern/hydration.d.cts +2 -7
  196. package/build/modern/hydration.d.ts +2 -7
  197. package/build/modern/hydration.js +99 -160
  198. package/build/modern/hydration.js.map +1 -1
  199. package/build/modern/index.cjs +59 -111
  200. package/build/modern/index.cjs.map +1 -1
  201. package/build/modern/index.d.cts +10 -141
  202. package/build/modern/index.d.ts +10 -141
  203. package/build/modern/index.js +16 -64
  204. package/build/modern/index.js.map +1 -1
  205. package/build/modern/infiniteQueryBehavior.cjs +89 -131
  206. package/build/modern/infiniteQueryBehavior.cjs.map +1 -1
  207. package/build/modern/infiniteQueryBehavior.d.cts +14 -3
  208. package/build/modern/infiniteQueryBehavior.d.cts.map +1 -0
  209. package/build/modern/infiniteQueryBehavior.d.ts +14 -3
  210. package/build/modern/infiniteQueryBehavior.d.ts.map +1 -0
  211. package/build/modern/infiniteQueryBehavior.js +86 -109
  212. package/build/modern/infiniteQueryBehavior.js.map +1 -1
  213. package/build/modern/infiniteQueryObserver.cjs +58 -87
  214. package/build/modern/infiniteQueryObserver.cjs.map +1 -1
  215. package/build/modern/infiniteQueryObserver.d.cts +20 -1
  216. package/build/modern/infiniteQueryObserver.d.cts.map +1 -0
  217. package/build/modern/infiniteQueryObserver.d.ts +20 -1
  218. package/build/modern/infiniteQueryObserver.d.ts.map +1 -0
  219. package/build/modern/infiniteQueryObserver.js +56 -61
  220. package/build/modern/infiniteQueryObserver.js.map +1 -1
  221. package/build/modern/mutation.cjs +221 -303
  222. package/build/modern/mutation.cjs.map +1 -1
  223. package/build/modern/mutation.d.cts +2 -4
  224. package/build/modern/mutation.d.ts +2 -4
  225. package/build/modern/mutation.js +216 -274
  226. package/build/modern/mutation.js.map +1 -1
  227. package/build/modern/mutationCache.cjs +111 -145
  228. package/build/modern/mutationCache.cjs.map +1 -1
  229. package/build/modern/mutationCache.d.cts +2 -2
  230. package/build/modern/mutationCache.d.ts +2 -2
  231. package/build/modern/mutationCache.js +107 -117
  232. package/build/modern/mutationCache.js.map +1 -1
  233. package/build/modern/mutationObserver.cjs +115 -162
  234. package/build/modern/mutationObserver.cjs.map +1 -1
  235. package/build/modern/mutationObserver.d.cts +2 -1
  236. package/build/modern/mutationObserver.d.ts +2 -1
  237. package/build/modern/mutationObserver.js +113 -136
  238. package/build/modern/mutationObserver.js.map +1 -1
  239. package/build/modern/notifyManager.cjs +76 -110
  240. package/build/modern/notifyManager.cjs.map +1 -1
  241. package/build/modern/notifyManager.d.cts +48 -3
  242. package/build/modern/notifyManager.d.cts.map +1 -0
  243. package/build/modern/notifyManager.d.ts +48 -3
  244. package/build/modern/notifyManager.d.ts.map +1 -0
  245. package/build/modern/notifyManager.js +73 -82
  246. package/build/modern/notifyManager.js.map +1 -1
  247. package/build/modern/onlineManager.cjs +51 -80
  248. package/build/modern/onlineManager.cjs.map +1 -1
  249. package/build/modern/onlineManager.d.cts +17 -2
  250. package/build/modern/onlineManager.d.cts.map +1 -0
  251. package/build/modern/onlineManager.d.ts +17 -2
  252. package/build/modern/onlineManager.d.ts.map +1 -0
  253. package/build/modern/onlineManager.js +48 -53
  254. package/build/modern/onlineManager.js.map +1 -1
  255. package/build/modern/queriesObserver.cjs +185 -237
  256. package/build/modern/queriesObserver.cjs.map +1 -1
  257. package/build/modern/queriesObserver.d.cts +23 -2
  258. package/build/modern/queriesObserver.d.cts.map +1 -0
  259. package/build/modern/queriesObserver.d.ts +23 -2
  260. package/build/modern/queriesObserver.d.ts.map +1 -0
  261. package/build/modern/queriesObserver.js +181 -209
  262. package/build/modern/queriesObserver.js.map +1 -1
  263. package/build/modern/query.cjs +384 -464
  264. package/build/modern/query.cjs.map +1 -1
  265. package/build/modern/query.d.cts +2 -9
  266. package/build/modern/query.d.ts +2 -9
  267. package/build/modern/query.js +377 -441
  268. package/build/modern/query.js.map +1 -1
  269. package/build/modern/queryCache.cjs +97 -119
  270. package/build/modern/queryCache.cjs.map +1 -1
  271. package/build/modern/queryCache.d.cts +2 -3
  272. package/build/modern/queryCache.d.ts +2 -3
  273. package/build/modern/queryCache.js +94 -92
  274. package/build/modern/queryCache.js.map +1 -1
  275. package/build/modern/queryClient.cjs +281 -318
  276. package/build/modern/queryClient.cjs.map +1 -1
  277. package/build/modern/queryClient.d.cts +2 -1
  278. package/build/modern/queryClient.d.ts +2 -1
  279. package/build/modern/queryClient.js +278 -299
  280. package/build/modern/queryClient.js.map +1 -1
  281. package/build/modern/queryObserver.cjs +329 -475
  282. package/build/modern/queryObserver.cjs.map +1 -1
  283. package/build/modern/queryObserver.d.cts +2 -1
  284. package/build/modern/queryObserver.d.ts +2 -1
  285. package/build/modern/queryObserver.js +324 -454
  286. package/build/modern/queryObserver.js.map +1 -1
  287. package/build/modern/removable-DeMjhW5M.d.cts +13 -0
  288. package/build/modern/removable-DeMjhW5M.d.cts.map +1 -0
  289. package/build/modern/removable-DeMjhW5M.d.ts +13 -0
  290. package/build/modern/removable-DeMjhW5M.d.ts.map +1 -0
  291. package/build/modern/removable.cjs +27 -56
  292. package/build/modern/removable.cjs.map +1 -1
  293. package/build/modern/removable.d.cts +2 -1
  294. package/build/modern/removable.d.ts +2 -1
  295. package/build/modern/removable.js +24 -29
  296. package/build/modern/removable.js.map +1 -1
  297. package/build/modern/retryer.cjs +121 -151
  298. package/build/modern/retryer.cjs.map +1 -1
  299. package/build/modern/retryer.d.cts +2 -7
  300. package/build/modern/retryer.d.ts +2 -7
  301. package/build/modern/retryer.js +115 -121
  302. package/build/modern/retryer.js.map +1 -1
  303. package/build/modern/streamedQuery.cjs +49 -78
  304. package/build/modern/streamedQuery.cjs.map +1 -1
  305. package/build/modern/streamedQuery.d.cts +33 -1
  306. package/build/modern/streamedQuery.d.cts.map +1 -0
  307. package/build/modern/streamedQuery.d.ts +33 -1
  308. package/build/modern/streamedQuery.d.ts.map +1 -0
  309. package/build/modern/streamedQuery.js +47 -52
  310. package/build/modern/streamedQuery.js.map +1 -1
  311. package/build/modern/subscribable-CbifVTKz.d.cts +12 -0
  312. package/build/modern/subscribable-CbifVTKz.d.cts.map +1 -0
  313. package/build/modern/subscribable-CbifVTKz.d.ts +12 -0
  314. package/build/modern/subscribable-CbifVTKz.d.ts.map +1 -0
  315. package/build/modern/subscribable.cjs +22 -48
  316. package/build/modern/subscribable.cjs.map +1 -1
  317. package/build/modern/subscribable.d.cts +2 -1
  318. package/build/modern/subscribable.d.ts +2 -1
  319. package/build/modern/subscribable.js +21 -23
  320. package/build/modern/subscribable.js.map +1 -1
  321. package/build/modern/timeoutManager.cjs +59 -93
  322. package/build/modern/timeoutManager.cjs.map +1 -1
  323. package/build/modern/timeoutManager.d.cts +60 -7
  324. package/build/modern/timeoutManager.d.cts.map +1 -0
  325. package/build/modern/timeoutManager.d.ts +60 -7
  326. package/build/modern/timeoutManager.d.ts.map +1 -0
  327. package/build/modern/timeoutManager.js +55 -65
  328. package/build/modern/timeoutManager.js.map +1 -1
  329. package/build/modern/types.cjs +10 -35
  330. package/build/modern/types.cjs.map +1 -1
  331. package/build/modern/types.d.cts +2 -94
  332. package/build/modern/types.d.ts +2 -94
  333. package/build/modern/types.js +8 -9
  334. package/build/modern/types.js.map +1 -1
  335. package/build/modern/utils.cjs +175 -300
  336. package/build/modern/utils.cjs.map +1 -1
  337. package/build/modern/utils.d.cts +2 -30
  338. package/build/modern/utils.d.ts +2 -30
  339. package/build/modern/utils.js +149 -250
  340. package/build/modern/utils.js.map +1 -1
  341. package/package.json +3 -5
  342. package/src/hydration.ts +62 -44
  343. package/src/index.ts +1 -0
  344. package/src/mutation.ts +14 -6
  345. package/src/mutationObserver.ts +8 -0
  346. package/src/queriesObserver.ts +14 -8
  347. package/src/query.ts +14 -6
  348. package/src/queryClient.ts +90 -2
  349. package/src/queryObserver.ts +41 -64
  350. package/src/retryer.ts +20 -12
  351. package/src/types.ts +70 -58
  352. package/build/legacy/_tsup-dts-rollup.d.cts +0 -2188
  353. package/build/legacy/_tsup-dts-rollup.d.ts +0 -2188
  354. package/build/legacy/chunk-PXG64RU4.js +0 -25
  355. package/build/legacy/chunk-PXG64RU4.js.map +0 -1
  356. package/build/legacy/thenable.cjs +0 -76
  357. package/build/legacy/thenable.cjs.map +0 -1
  358. package/build/legacy/thenable.d.cts +0 -6
  359. package/build/legacy/thenable.d.ts +0 -6
  360. package/build/legacy/thenable.js +0 -52
  361. package/build/legacy/thenable.js.map +0 -1
  362. package/build/modern/_tsup-dts-rollup.d.cts +0 -2188
  363. package/build/modern/_tsup-dts-rollup.d.ts +0 -2188
  364. package/build/modern/thenable.cjs +0 -75
  365. package/build/modern/thenable.cjs.map +0 -1
  366. package/build/modern/thenable.d.cts +0 -6
  367. package/build/modern/thenable.d.ts +0 -6
  368. package/build/modern/thenable.js +0 -49
  369. package/build/modern/thenable.js.map +0 -1
  370. package/src/thenable.ts +0 -111
@@ -1,323 +1,297 @@
1
- import {
2
- __privateAdd,
3
- __privateGet,
4
- __privateSet,
5
- __privateWrapper
6
- } from "./chunk-PXG64RU4.js";
7
-
8
- // src/queryClient.ts
9
- import {
10
- functionalUpdate,
11
- hashKey,
12
- hashQueryKeyByOptions,
13
- noop,
14
- partialMatchKey,
15
- resolveStaleTime,
16
- skipToken
17
- } from "./utils.js";
18
- import { QueryCache } from "./queryCache.js";
19
- import { MutationCache } from "./mutationCache.js";
1
+ import { i as _classPrivateFieldInitSpec, n as _classPrivateFieldGet2, t as _classPrivateFieldSet2 } from "./classPrivateFieldSet2-CV7wyte-.js";
2
+ import { functionalUpdate, hashKey, hashQueryKeyByOptions, noop, partialMatchKey, resolveStaleTime, skipToken } from "./utils.js";
20
3
  import { focusManager } from "./focusManager.js";
21
- import { onlineManager } from "./onlineManager.js";
22
4
  import { notifyManager } from "./notifyManager.js";
23
- var _queryCache, _mutationCache, _defaultOptions, _queryDefaults, _mutationDefaults, _mountCount, _unsubscribeFocus, _unsubscribeOnline;
5
+ import { onlineManager } from "./onlineManager.js";
6
+ import { MutationCache } from "./mutationCache.js";
7
+ import { QueryCache } from "./queryCache.js";
8
+ //#region src/queryClient.ts
9
+ var _queryCache = /* @__PURE__ */ new WeakMap();
10
+ var _mutationCache = /* @__PURE__ */ new WeakMap();
11
+ var _defaultOptions = /* @__PURE__ */ new WeakMap();
12
+ var _queryDefaults = /* @__PURE__ */ new WeakMap();
13
+ var _mutationDefaults = /* @__PURE__ */ new WeakMap();
14
+ var _mountCount = /* @__PURE__ */ new WeakMap();
15
+ var _unsubscribeFocus = /* @__PURE__ */ new WeakMap();
16
+ var _unsubscribeOnline = /* @__PURE__ */ new WeakMap();
24
17
  var QueryClient = class {
25
- constructor(config = {}) {
26
- __privateAdd(this, _queryCache);
27
- __privateAdd(this, _mutationCache);
28
- __privateAdd(this, _defaultOptions);
29
- __privateAdd(this, _queryDefaults);
30
- __privateAdd(this, _mutationDefaults);
31
- __privateAdd(this, _mountCount);
32
- __privateAdd(this, _unsubscribeFocus);
33
- __privateAdd(this, _unsubscribeOnline);
34
- __privateSet(this, _queryCache, config.queryCache || new QueryCache());
35
- __privateSet(this, _mutationCache, config.mutationCache || new MutationCache());
36
- __privateSet(this, _defaultOptions, config.defaultOptions || {});
37
- __privateSet(this, _queryDefaults, /* @__PURE__ */ new Map());
38
- __privateSet(this, _mutationDefaults, /* @__PURE__ */ new Map());
39
- __privateSet(this, _mountCount, 0);
40
- }
41
- mount() {
42
- __privateWrapper(this, _mountCount)._++;
43
- if (__privateGet(this, _mountCount) !== 1) return;
44
- __privateSet(this, _unsubscribeFocus, focusManager.subscribe(async (focused) => {
45
- if (focused) {
46
- await this.resumePausedMutations();
47
- __privateGet(this, _queryCache).onFocus();
48
- }
49
- }));
50
- __privateSet(this, _unsubscribeOnline, onlineManager.subscribe(async (online) => {
51
- if (online) {
52
- await this.resumePausedMutations();
53
- __privateGet(this, _queryCache).onOnline();
54
- }
55
- }));
56
- }
57
- unmount() {
58
- var _a, _b;
59
- __privateWrapper(this, _mountCount)._--;
60
- if (__privateGet(this, _mountCount) !== 0) return;
61
- (_a = __privateGet(this, _unsubscribeFocus)) == null ? void 0 : _a.call(this);
62
- __privateSet(this, _unsubscribeFocus, void 0);
63
- (_b = __privateGet(this, _unsubscribeOnline)) == null ? void 0 : _b.call(this);
64
- __privateSet(this, _unsubscribeOnline, void 0);
65
- }
66
- isFetching(filters) {
67
- return __privateGet(this, _queryCache).findAll({ ...filters, fetchStatus: "fetching" }).length;
68
- }
69
- isMutating(filters) {
70
- return __privateGet(this, _mutationCache).findAll({ ...filters, status: "pending" }).length;
71
- }
72
- /**
73
- * Imperative (non-reactive) way to retrieve data for a QueryKey.
74
- * Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates.
75
- *
76
- * Hint: Do not use this function inside a component, because it won't receive updates.
77
- * Use `useQuery` to create a `QueryObserver` that subscribes to changes.
78
- */
79
- getQueryData(queryKey) {
80
- var _a;
81
- const options = this.defaultQueryOptions({ queryKey });
82
- return (_a = __privateGet(this, _queryCache).get(options.queryHash)) == null ? void 0 : _a.state.data;
83
- }
84
- ensureQueryData(options) {
85
- const defaultedOptions = this.defaultQueryOptions(options);
86
- const query = __privateGet(this, _queryCache).build(this, defaultedOptions);
87
- const cachedData = query.state.data;
88
- if (cachedData === void 0) {
89
- return this.fetchQuery(options);
90
- }
91
- if (options.revalidateIfStale && query.isStaleByTime(resolveStaleTime(defaultedOptions.staleTime, query))) {
92
- void this.prefetchQuery(defaultedOptions);
93
- }
94
- return Promise.resolve(cachedData);
95
- }
96
- getQueriesData(filters) {
97
- return __privateGet(this, _queryCache).findAll(filters).map(({ queryKey, state }) => {
98
- const data = state.data;
99
- return [queryKey, data];
100
- });
101
- }
102
- setQueryData(queryKey, updater, options) {
103
- const defaultedOptions = this.defaultQueryOptions({ queryKey });
104
- const query = __privateGet(this, _queryCache).get(
105
- defaultedOptions.queryHash
106
- );
107
- const prevData = query == null ? void 0 : query.state.data;
108
- const data = functionalUpdate(updater, prevData);
109
- if (data === void 0) {
110
- return void 0;
111
- }
112
- return __privateGet(this, _queryCache).build(this, defaultedOptions).setData(data, { ...options, manual: true });
113
- }
114
- setQueriesData(filters, updater, options) {
115
- return notifyManager.batch(
116
- () => __privateGet(this, _queryCache).findAll(filters).map(({ queryKey }) => [
117
- queryKey,
118
- this.setQueryData(queryKey, updater, options)
119
- ])
120
- );
121
- }
122
- getQueryState(queryKey) {
123
- var _a;
124
- const options = this.defaultQueryOptions({ queryKey });
125
- return (_a = __privateGet(this, _queryCache).get(
126
- options.queryHash
127
- )) == null ? void 0 : _a.state;
128
- }
129
- removeQueries(filters) {
130
- const queryCache = __privateGet(this, _queryCache);
131
- notifyManager.batch(() => {
132
- queryCache.findAll(filters).forEach((query) => {
133
- queryCache.remove(query);
134
- });
135
- });
136
- }
137
- resetQueries(filters, options) {
138
- const queryCache = __privateGet(this, _queryCache);
139
- return notifyManager.batch(() => {
140
- queryCache.findAll(filters).forEach((query) => {
141
- query.reset();
142
- });
143
- return this.refetchQueries(
144
- {
145
- type: "active",
146
- ...filters
147
- },
148
- options
149
- );
150
- });
151
- }
152
- cancelQueries(filters, cancelOptions = {}) {
153
- const defaultedCancelOptions = { revert: true, ...cancelOptions };
154
- const promises = notifyManager.batch(
155
- () => __privateGet(this, _queryCache).findAll(filters).map((query) => query.cancel(defaultedCancelOptions))
156
- );
157
- return Promise.all(promises).then(noop).catch(noop);
158
- }
159
- invalidateQueries(filters, options = {}) {
160
- return notifyManager.batch(() => {
161
- __privateGet(this, _queryCache).findAll(filters).forEach((query) => {
162
- query.invalidate();
163
- });
164
- if ((filters == null ? void 0 : filters.refetchType) === "none") {
165
- return Promise.resolve();
166
- }
167
- return this.refetchQueries(
168
- {
169
- ...filters,
170
- type: (filters == null ? void 0 : filters.refetchType) ?? (filters == null ? void 0 : filters.type) ?? "active"
171
- },
172
- options
173
- );
174
- });
175
- }
176
- refetchQueries(filters, options = {}) {
177
- const fetchOptions = {
178
- ...options,
179
- cancelRefetch: options.cancelRefetch ?? true
180
- };
181
- const promises = notifyManager.batch(
182
- () => __privateGet(this, _queryCache).findAll(filters).filter((query) => !query.isDisabled() && !query.isStatic()).map((query) => {
183
- let promise = query.fetch(void 0, fetchOptions);
184
- if (!fetchOptions.throwOnError) {
185
- promise = promise.catch(noop);
186
- }
187
- return query.state.fetchStatus === "paused" ? Promise.resolve() : promise;
188
- })
189
- );
190
- return Promise.all(promises).then(noop);
191
- }
192
- fetchQuery(options) {
193
- const defaultedOptions = this.defaultQueryOptions(options);
194
- if (defaultedOptions.retry === void 0) {
195
- defaultedOptions.retry = false;
196
- }
197
- const query = __privateGet(this, _queryCache).build(this, defaultedOptions);
198
- return query.isStaleByTime(
199
- resolveStaleTime(defaultedOptions.staleTime, query)
200
- ) ? query.fetch(defaultedOptions) : Promise.resolve(query.state.data);
201
- }
202
- prefetchQuery(options) {
203
- return this.fetchQuery(options).then(noop).catch(noop);
204
- }
205
- fetchInfiniteQuery(options) {
206
- options._type = "infinite";
207
- return this.fetchQuery(options);
208
- }
209
- prefetchInfiniteQuery(options) {
210
- return this.fetchInfiniteQuery(options).then(noop).catch(noop);
211
- }
212
- ensureInfiniteQueryData(options) {
213
- options._type = "infinite";
214
- return this.ensureQueryData(options);
215
- }
216
- resumePausedMutations() {
217
- if (onlineManager.isOnline()) {
218
- return __privateGet(this, _mutationCache).resumePausedMutations();
219
- }
220
- return Promise.resolve();
221
- }
222
- getQueryCache() {
223
- return __privateGet(this, _queryCache);
224
- }
225
- getMutationCache() {
226
- return __privateGet(this, _mutationCache);
227
- }
228
- getDefaultOptions() {
229
- return __privateGet(this, _defaultOptions);
230
- }
231
- setDefaultOptions(options) {
232
- __privateSet(this, _defaultOptions, options);
233
- }
234
- setQueryDefaults(queryKey, options) {
235
- __privateGet(this, _queryDefaults).set(hashKey(queryKey), {
236
- queryKey,
237
- defaultOptions: options
238
- });
239
- }
240
- getQueryDefaults(queryKey) {
241
- const defaults = [...__privateGet(this, _queryDefaults).values()];
242
- const result = {};
243
- defaults.forEach((queryDefault) => {
244
- if (partialMatchKey(queryKey, queryDefault.queryKey)) {
245
- Object.assign(result, queryDefault.defaultOptions);
246
- }
247
- });
248
- return result;
249
- }
250
- setMutationDefaults(mutationKey, options) {
251
- __privateGet(this, _mutationDefaults).set(hashKey(mutationKey), {
252
- mutationKey,
253
- defaultOptions: options
254
- });
255
- }
256
- getMutationDefaults(mutationKey) {
257
- const defaults = [...__privateGet(this, _mutationDefaults).values()];
258
- const result = {};
259
- defaults.forEach((queryDefault) => {
260
- if (partialMatchKey(mutationKey, queryDefault.mutationKey)) {
261
- Object.assign(result, queryDefault.defaultOptions);
262
- }
263
- });
264
- return result;
265
- }
266
- defaultQueryOptions(options) {
267
- if (options._defaulted) {
268
- return options;
269
- }
270
- const defaultedOptions = {
271
- ...__privateGet(this, _defaultOptions).queries,
272
- ...this.getQueryDefaults(options.queryKey),
273
- ...options,
274
- _defaulted: true
275
- };
276
- if (!defaultedOptions.queryHash) {
277
- defaultedOptions.queryHash = hashQueryKeyByOptions(
278
- defaultedOptions.queryKey,
279
- defaultedOptions
280
- );
281
- }
282
- if (defaultedOptions.refetchOnReconnect === void 0) {
283
- defaultedOptions.refetchOnReconnect = defaultedOptions.networkMode !== "always";
284
- }
285
- if (defaultedOptions.throwOnError === void 0) {
286
- defaultedOptions.throwOnError = !!defaultedOptions.suspense;
287
- }
288
- if (!defaultedOptions.networkMode && defaultedOptions.persister) {
289
- defaultedOptions.networkMode = "offlineFirst";
290
- }
291
- if (defaultedOptions.queryFn === skipToken) {
292
- defaultedOptions.enabled = false;
293
- }
294
- return defaultedOptions;
295
- }
296
- defaultMutationOptions(options) {
297
- if (options == null ? void 0 : options._defaulted) {
298
- return options;
299
- }
300
- return {
301
- ...__privateGet(this, _defaultOptions).mutations,
302
- ...(options == null ? void 0 : options.mutationKey) && this.getMutationDefaults(options.mutationKey),
303
- ...options,
304
- _defaulted: true
305
- };
306
- }
307
- clear() {
308
- __privateGet(this, _queryCache).clear();
309
- __privateGet(this, _mutationCache).clear();
310
- }
311
- };
312
- _queryCache = new WeakMap();
313
- _mutationCache = new WeakMap();
314
- _defaultOptions = new WeakMap();
315
- _queryDefaults = new WeakMap();
316
- _mutationDefaults = new WeakMap();
317
- _mountCount = new WeakMap();
318
- _unsubscribeFocus = new WeakMap();
319
- _unsubscribeOnline = new WeakMap();
320
- export {
321
- QueryClient
18
+ constructor(config = {}) {
19
+ _classPrivateFieldInitSpec(this, _queryCache, void 0);
20
+ _classPrivateFieldInitSpec(this, _mutationCache, void 0);
21
+ _classPrivateFieldInitSpec(this, _defaultOptions, void 0);
22
+ _classPrivateFieldInitSpec(this, _queryDefaults, void 0);
23
+ _classPrivateFieldInitSpec(this, _mutationDefaults, void 0);
24
+ _classPrivateFieldInitSpec(this, _mountCount, void 0);
25
+ _classPrivateFieldInitSpec(this, _unsubscribeFocus, void 0);
26
+ _classPrivateFieldInitSpec(this, _unsubscribeOnline, void 0);
27
+ _classPrivateFieldSet2(_queryCache, this, config.queryCache || new QueryCache());
28
+ _classPrivateFieldSet2(_mutationCache, this, config.mutationCache || new MutationCache());
29
+ _classPrivateFieldSet2(_defaultOptions, this, config.defaultOptions || {});
30
+ _classPrivateFieldSet2(_queryDefaults, this, /* @__PURE__ */ new Map());
31
+ _classPrivateFieldSet2(_mutationDefaults, this, /* @__PURE__ */ new Map());
32
+ _classPrivateFieldSet2(_mountCount, this, 0);
33
+ }
34
+ mount() {
35
+ var _this$mountCount;
36
+ _classPrivateFieldSet2(_mountCount, this, (_this$mountCount = _classPrivateFieldGet2(_mountCount, this), _this$mountCount++, _this$mountCount));
37
+ if (_classPrivateFieldGet2(_mountCount, this) !== 1) return;
38
+ _classPrivateFieldSet2(_unsubscribeFocus, this, focusManager.subscribe(async (focused) => {
39
+ if (focused) {
40
+ await this.resumePausedMutations();
41
+ _classPrivateFieldGet2(_queryCache, this).onFocus();
42
+ }
43
+ }));
44
+ _classPrivateFieldSet2(_unsubscribeOnline, this, onlineManager.subscribe(async (online) => {
45
+ if (online) {
46
+ await this.resumePausedMutations();
47
+ _classPrivateFieldGet2(_queryCache, this).onOnline();
48
+ }
49
+ }));
50
+ }
51
+ unmount() {
52
+ var _this$mountCount3, _classPrivateFieldGet2$1, _classPrivateFieldGet3;
53
+ _classPrivateFieldSet2(_mountCount, this, (_this$mountCount3 = _classPrivateFieldGet2(_mountCount, this), _this$mountCount3--, _this$mountCount3));
54
+ if (_classPrivateFieldGet2(_mountCount, this) !== 0) return;
55
+ (_classPrivateFieldGet2$1 = _classPrivateFieldGet2(_unsubscribeFocus, this)) === null || _classPrivateFieldGet2$1 === void 0 || _classPrivateFieldGet2$1.call(this);
56
+ _classPrivateFieldSet2(_unsubscribeFocus, this, void 0);
57
+ (_classPrivateFieldGet3 = _classPrivateFieldGet2(_unsubscribeOnline, this)) === null || _classPrivateFieldGet3 === void 0 || _classPrivateFieldGet3.call(this);
58
+ _classPrivateFieldSet2(_unsubscribeOnline, this, void 0);
59
+ }
60
+ isFetching(filters) {
61
+ return _classPrivateFieldGet2(_queryCache, this).findAll({
62
+ ...filters,
63
+ fetchStatus: "fetching"
64
+ }).length;
65
+ }
66
+ isMutating(filters) {
67
+ return _classPrivateFieldGet2(_mutationCache, this).findAll({
68
+ ...filters,
69
+ status: "pending"
70
+ }).length;
71
+ }
72
+ /**
73
+ * Imperative (non-reactive) way to retrieve data for a QueryKey.
74
+ * Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates.
75
+ *
76
+ * Hint: Do not use this function inside a component, because it won't receive updates.
77
+ * Use `useQuery` to create a `QueryObserver` that subscribes to changes.
78
+ */
79
+ getQueryData(queryKey) {
80
+ var _classPrivateFieldGet4;
81
+ const options = this.defaultQueryOptions({ queryKey });
82
+ return (_classPrivateFieldGet4 = _classPrivateFieldGet2(_queryCache, this).get(options.queryHash)) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.state.data;
83
+ }
84
+ /**
85
+ * @deprecated Use queryClient.query({ ...options, staleTime: 'static' }) instead. This method will be removed in the next major version.
86
+ */
87
+ ensureQueryData(options) {
88
+ const defaultedOptions = this.defaultQueryOptions(options);
89
+ const query = _classPrivateFieldGet2(_queryCache, this).build(this, defaultedOptions);
90
+ const cachedData = query.state.data;
91
+ if (cachedData === void 0) return this.fetchQuery(options);
92
+ if (options.revalidateIfStale && query.isStaleByTime(resolveStaleTime(defaultedOptions.staleTime, query))) this.prefetchQuery(defaultedOptions);
93
+ return Promise.resolve(cachedData);
94
+ }
95
+ getQueriesData(filters) {
96
+ return _classPrivateFieldGet2(_queryCache, this).findAll(filters).map(({ queryKey, state }) => {
97
+ return [queryKey, state.data];
98
+ });
99
+ }
100
+ setQueryData(queryKey, updater, options) {
101
+ const defaultedOptions = this.defaultQueryOptions({ queryKey });
102
+ const query = _classPrivateFieldGet2(_queryCache, this).get(defaultedOptions.queryHash);
103
+ const prevData = query === null || query === void 0 ? void 0 : query.state.data;
104
+ const data = functionalUpdate(updater, prevData);
105
+ if (data === void 0) return;
106
+ return _classPrivateFieldGet2(_queryCache, this).build(this, defaultedOptions).setData(data, {
107
+ ...options,
108
+ manual: true
109
+ });
110
+ }
111
+ setQueriesData(filters, updater, options) {
112
+ return notifyManager.batch(() => _classPrivateFieldGet2(_queryCache, this).findAll(filters).map(({ queryKey }) => [queryKey, this.setQueryData(queryKey, updater, options)]));
113
+ }
114
+ getQueryState(queryKey) {
115
+ var _classPrivateFieldGet5;
116
+ const options = this.defaultQueryOptions({ queryKey });
117
+ return (_classPrivateFieldGet5 = _classPrivateFieldGet2(_queryCache, this).get(options.queryHash)) === null || _classPrivateFieldGet5 === void 0 ? void 0 : _classPrivateFieldGet5.state;
118
+ }
119
+ removeQueries(filters) {
120
+ const queryCache = _classPrivateFieldGet2(_queryCache, this);
121
+ notifyManager.batch(() => {
122
+ queryCache.findAll(filters).forEach((query) => {
123
+ queryCache.remove(query);
124
+ });
125
+ });
126
+ }
127
+ resetQueries(filters, options) {
128
+ const queryCache = _classPrivateFieldGet2(_queryCache, this);
129
+ return notifyManager.batch(() => {
130
+ const matched = queryCache.findAll(filters);
131
+ const queriesToRefetch = new Set(matched);
132
+ matched.forEach((query) => {
133
+ query.reset();
134
+ });
135
+ return this.refetchQueries({
136
+ type: "active",
137
+ predicate: (query) => queriesToRefetch.has(query)
138
+ }, options);
139
+ });
140
+ }
141
+ cancelQueries(filters, cancelOptions = {}) {
142
+ const defaultedCancelOptions = {
143
+ revert: true,
144
+ ...cancelOptions
145
+ };
146
+ const promises = notifyManager.batch(() => _classPrivateFieldGet2(_queryCache, this).findAll(filters).map((query) => query.cancel(defaultedCancelOptions)));
147
+ return Promise.all(promises).then(noop).catch(noop);
148
+ }
149
+ invalidateQueries(filters, options = {}) {
150
+ return notifyManager.batch(() => {
151
+ _classPrivateFieldGet2(_queryCache, this).findAll(filters).forEach((query) => {
152
+ query.invalidate();
153
+ });
154
+ if ((filters === null || filters === void 0 ? void 0 : filters.refetchType) === "none") return Promise.resolve();
155
+ return this.refetchQueries({
156
+ ...filters,
157
+ type: (filters === null || filters === void 0 ? void 0 : filters.refetchType) ?? (filters === null || filters === void 0 ? void 0 : filters.type) ?? "active"
158
+ }, options);
159
+ });
160
+ }
161
+ refetchQueries(filters, options = {}) {
162
+ const fetchOptions = {
163
+ ...options,
164
+ cancelRefetch: options.cancelRefetch ?? true
165
+ };
166
+ const promises = notifyManager.batch(() => _classPrivateFieldGet2(_queryCache, this).findAll(filters).filter((query) => !query.isDisabled() && !query.isStatic()).map((query) => {
167
+ let promise = query.fetch(void 0, fetchOptions);
168
+ if (!fetchOptions.throwOnError) promise = promise.catch(noop);
169
+ return query.state.fetchStatus === "paused" ? Promise.resolve() : promise;
170
+ }));
171
+ return Promise.all(promises).then(noop);
172
+ }
173
+ async query(options) {
174
+ const defaultedOptions = this.defaultQueryOptions(options);
175
+ if (defaultedOptions.retry === void 0) defaultedOptions.retry = false;
176
+ const query = _classPrivateFieldGet2(_queryCache, this).build(this, defaultedOptions);
177
+ const queryData = query.isStaleByTime(resolveStaleTime(defaultedOptions.staleTime, query)) ? await query.fetch(defaultedOptions) : query.state.data;
178
+ const select = defaultedOptions.select;
179
+ if (select) return select(queryData);
180
+ return queryData;
181
+ }
182
+ /**
183
+ * @deprecated Use queryClient.query(options) instead. This method will be removed in the next major version.
184
+ */
185
+ fetchQuery(options) {
186
+ const defaultedOptions = this.defaultQueryOptions(options);
187
+ if (defaultedOptions.retry === void 0) defaultedOptions.retry = false;
188
+ const query = _classPrivateFieldGet2(_queryCache, this).build(this, defaultedOptions);
189
+ return query.isStaleByTime(resolveStaleTime(defaultedOptions.staleTime, query)) ? query.fetch(defaultedOptions) : Promise.resolve(query.state.data);
190
+ }
191
+ /**
192
+ * @deprecated Use queryClient.query(options) instead. You can swallow errors with `.catch(noop)`. This method will be removed in the next major version.
193
+ */
194
+ prefetchQuery(options) {
195
+ return this.fetchQuery(options).then(noop).catch(noop);
196
+ }
197
+ infiniteQuery(options) {
198
+ options._type = "infinite";
199
+ return this.query(options);
200
+ }
201
+ /**
202
+ * @deprecated Use queryClient.infiniteQuery(options) instead. This method will be removed in the next major version.
203
+ */
204
+ fetchInfiniteQuery(options) {
205
+ options._type = "infinite";
206
+ return this.fetchQuery(options);
207
+ }
208
+ /**
209
+ * @deprecated Use queryClient.infiniteQuery(options) instead. You can swallow errors with `.catch(noop)`. This method will be removed in the next major version.
210
+ */
211
+ prefetchInfiniteQuery(options) {
212
+ return this.fetchInfiniteQuery(options).then(noop).catch(noop);
213
+ }
214
+ /**
215
+ * @deprecated Use queryClient.infiniteQuery({ ...options, staleTime: 'static' }) instead. This method will be removed in the next major version.
216
+ */
217
+ ensureInfiniteQueryData(options) {
218
+ options._type = "infinite";
219
+ return this.ensureQueryData(options);
220
+ }
221
+ resumePausedMutations() {
222
+ if (onlineManager.isOnline()) return _classPrivateFieldGet2(_mutationCache, this).resumePausedMutations();
223
+ return Promise.resolve();
224
+ }
225
+ getQueryCache() {
226
+ return _classPrivateFieldGet2(_queryCache, this);
227
+ }
228
+ getMutationCache() {
229
+ return _classPrivateFieldGet2(_mutationCache, this);
230
+ }
231
+ getDefaultOptions() {
232
+ return _classPrivateFieldGet2(_defaultOptions, this);
233
+ }
234
+ setDefaultOptions(options) {
235
+ _classPrivateFieldSet2(_defaultOptions, this, options);
236
+ }
237
+ setQueryDefaults(queryKey, options) {
238
+ _classPrivateFieldGet2(_queryDefaults, this).set(hashKey(queryKey), {
239
+ queryKey,
240
+ defaultOptions: options
241
+ });
242
+ }
243
+ getQueryDefaults(queryKey) {
244
+ const defaults = [..._classPrivateFieldGet2(_queryDefaults, this).values()];
245
+ const result = {};
246
+ defaults.forEach((queryDefault) => {
247
+ if (partialMatchKey(queryKey, queryDefault.queryKey)) Object.assign(result, queryDefault.defaultOptions);
248
+ });
249
+ return result;
250
+ }
251
+ setMutationDefaults(mutationKey, options) {
252
+ _classPrivateFieldGet2(_mutationDefaults, this).set(hashKey(mutationKey), {
253
+ mutationKey,
254
+ defaultOptions: options
255
+ });
256
+ }
257
+ getMutationDefaults(mutationKey) {
258
+ const defaults = [..._classPrivateFieldGet2(_mutationDefaults, this).values()];
259
+ const result = {};
260
+ defaults.forEach((queryDefault) => {
261
+ if (partialMatchKey(mutationKey, queryDefault.mutationKey)) Object.assign(result, queryDefault.defaultOptions);
262
+ });
263
+ return result;
264
+ }
265
+ defaultQueryOptions(options) {
266
+ if (options._defaulted) return options;
267
+ const defaultedOptions = {
268
+ ..._classPrivateFieldGet2(_defaultOptions, this).queries,
269
+ ...this.getQueryDefaults(options.queryKey),
270
+ ...options,
271
+ _defaulted: true
272
+ };
273
+ if (!defaultedOptions.queryHash) defaultedOptions.queryHash = hashQueryKeyByOptions(defaultedOptions.queryKey, defaultedOptions);
274
+ if (defaultedOptions.refetchOnReconnect === void 0) defaultedOptions.refetchOnReconnect = defaultedOptions.networkMode !== "always";
275
+ if (defaultedOptions.throwOnError === void 0) defaultedOptions.throwOnError = !!defaultedOptions.suspense;
276
+ if (!defaultedOptions.networkMode && defaultedOptions.persister) defaultedOptions.networkMode = "offlineFirst";
277
+ if (defaultedOptions.queryFn === skipToken) defaultedOptions.enabled = false;
278
+ return defaultedOptions;
279
+ }
280
+ defaultMutationOptions(options) {
281
+ if (options === null || options === void 0 ? void 0 : options._defaulted) return options;
282
+ return {
283
+ ..._classPrivateFieldGet2(_defaultOptions, this).mutations,
284
+ ...(options === null || options === void 0 ? void 0 : options.mutationKey) && this.getMutationDefaults(options.mutationKey),
285
+ ...options,
286
+ _defaulted: true
287
+ };
288
+ }
289
+ clear() {
290
+ _classPrivateFieldGet2(_queryCache, this).clear();
291
+ _classPrivateFieldGet2(_mutationCache, this).clear();
292
+ }
322
293
  };
294
+ //#endregion
295
+ export { QueryClient };
296
+
323
297
  //# sourceMappingURL=queryClient.js.map