@tanstack/query-core 5.0.0-alpha.85 → 5.0.0-alpha.87

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 (448) hide show
  1. package/build/legacy/focusManager.cjs +116 -0
  2. package/build/legacy/focusManager.cjs.map +1 -0
  3. package/build/legacy/focusManager.d.cts +16 -0
  4. package/build/{lib → legacy}/focusManager.d.ts +6 -5
  5. package/build/legacy/focusManager.js +91 -0
  6. package/build/legacy/focusManager.js.map +1 -0
  7. package/build/legacy/hydration.cjs +109 -0
  8. package/build/legacy/hydration.cjs.map +1 -0
  9. package/build/legacy/hydration.d.cts +35 -0
  10. package/build/legacy/hydration.d.ts +35 -0
  11. package/build/legacy/hydration.js +82 -0
  12. package/build/legacy/hydration.js.map +1 -0
  13. package/build/legacy/index.cjs +85 -0
  14. package/build/legacy/index.cjs.map +1 -0
  15. package/build/legacy/index.d.cts +9 -0
  16. package/build/legacy/index.d.ts +9 -0
  17. package/build/legacy/index.js +50 -0
  18. package/build/legacy/index.js.map +1 -0
  19. package/build/legacy/infiniteQueryBehavior.cjs +141 -0
  20. package/build/legacy/infiniteQueryBehavior.cjs.map +1 -0
  21. package/build/legacy/infiniteQueryBehavior.d.cts +15 -0
  22. package/build/legacy/infiniteQueryBehavior.d.ts +15 -0
  23. package/build/legacy/infiniteQueryBehavior.js +115 -0
  24. package/build/legacy/infiniteQueryBehavior.js.map +1 -0
  25. package/build/legacy/infiniteQueryObserver.cjs +88 -0
  26. package/build/legacy/infiniteQueryObserver.cjs.map +1 -0
  27. package/build/legacy/infiniteQueryObserver.d.cts +19 -0
  28. package/build/{lib → legacy}/infiniteQueryObserver.d.ts +7 -8
  29. package/build/{lib/infiniteQueryObserver.legacy.js → legacy/infiniteQueryObserver.js} +24 -32
  30. package/build/legacy/infiniteQueryObserver.js.map +1 -0
  31. package/build/legacy/mutation.cjs +297 -0
  32. package/build/legacy/mutation.cjs.map +1 -0
  33. package/build/legacy/mutation.d.cts +3 -0
  34. package/build/legacy/mutation.d.ts +3 -0
  35. package/build/legacy/mutation.js +272 -0
  36. package/build/legacy/mutation.js.map +1 -0
  37. package/build/legacy/mutationCache.cjs +133 -0
  38. package/build/legacy/mutationCache.cjs.map +1 -0
  39. package/build/legacy/mutationCache.d.cts +3 -0
  40. package/build/legacy/mutationCache.d.ts +3 -0
  41. package/build/legacy/mutationCache.js +109 -0
  42. package/build/legacy/mutationCache.js.map +1 -0
  43. package/build/legacy/mutationObserver.cjs +171 -0
  44. package/build/legacy/mutationObserver.cjs.map +1 -0
  45. package/build/legacy/mutationObserver.d.cts +3 -0
  46. package/build/legacy/mutationObserver.d.ts +3 -0
  47. package/build/legacy/mutationObserver.js +147 -0
  48. package/build/legacy/mutationObserver.js.map +1 -0
  49. package/build/legacy/notifyManager.cjs +97 -0
  50. package/build/legacy/notifyManager.cjs.map +1 -0
  51. package/build/legacy/notifyManager.d.cts +20 -0
  52. package/build/{lib → legacy}/notifyManager.d.ts +4 -4
  53. package/build/{lib → legacy}/notifyManager.js +14 -31
  54. package/build/legacy/notifyManager.js.map +1 -0
  55. package/build/legacy/onlineManager.cjs +106 -0
  56. package/build/legacy/onlineManager.cjs.map +1 -0
  57. package/build/legacy/onlineManager.d.cts +16 -0
  58. package/build/legacy/onlineManager.d.ts +16 -0
  59. package/build/legacy/onlineManager.js +81 -0
  60. package/build/legacy/onlineManager.js.map +1 -0
  61. package/build/legacy/queriesObserver.cjs +242 -0
  62. package/build/legacy/queriesObserver.cjs.map +1 -0
  63. package/build/legacy/queriesObserver.d.cts +26 -0
  64. package/build/{lib → legacy}/queriesObserver.d.ts +10 -11
  65. package/build/legacy/queriesObserver.js +218 -0
  66. package/build/legacy/queriesObserver.js.map +1 -0
  67. package/build/legacy/query.cjs +423 -0
  68. package/build/legacy/query.cjs.map +1 -0
  69. package/build/legacy/query.d.cts +3 -0
  70. package/build/legacy/query.d.ts +3 -0
  71. package/build/legacy/query.js +399 -0
  72. package/build/legacy/query.js.map +1 -0
  73. package/build/legacy/queryCache.cjs +140 -0
  74. package/build/legacy/queryCache.cjs.map +1 -0
  75. package/build/legacy/queryCache.d.cts +3 -0
  76. package/build/legacy/queryCache.d.ts +3 -0
  77. package/build/legacy/queryCache.js +116 -0
  78. package/build/legacy/queryCache.js.map +1 -0
  79. package/build/legacy/queryClient-4ba6364e.d.ts +916 -0
  80. package/build/legacy/queryClient-d615ed9f.d.ts +916 -0
  81. package/build/legacy/queryClient.cjs +322 -0
  82. package/build/legacy/queryClient.cjs.map +1 -0
  83. package/build/legacy/queryClient.d.cts +3 -0
  84. package/build/legacy/queryClient.d.ts +3 -0
  85. package/build/legacy/queryClient.js +304 -0
  86. package/build/legacy/queryClient.js.map +1 -0
  87. package/build/legacy/queryObserver.cjs +501 -0
  88. package/build/legacy/queryObserver.cjs.map +1 -0
  89. package/build/legacy/queryObserver.d.cts +3 -0
  90. package/build/legacy/queryObserver.d.ts +3 -0
  91. package/build/legacy/queryObserver.js +484 -0
  92. package/build/legacy/queryObserver.js.map +1 -0
  93. package/build/legacy/removable.cjs +77 -0
  94. package/build/legacy/removable.cjs.map +1 -0
  95. package/build/legacy/removable.d.cts +11 -0
  96. package/build/{lib → legacy}/removable.d.ts +3 -2
  97. package/build/legacy/removable.js +53 -0
  98. package/build/legacy/removable.js.map +1 -0
  99. package/build/legacy/retryer.cjs +169 -0
  100. package/build/legacy/retryer.cjs.map +1 -0
  101. package/build/legacy/retryer.d.cts +3 -0
  102. package/build/legacy/retryer.d.ts +3 -0
  103. package/build/{lib/retryer.legacy.js → legacy/retryer.js} +37 -48
  104. package/build/legacy/retryer.js.map +1 -0
  105. package/build/legacy/subscribable.cjs +49 -0
  106. package/build/legacy/subscribable.cjs.map +1 -0
  107. package/build/legacy/subscribable.d.cts +11 -0
  108. package/build/{lib → legacy}/subscribable.d.ts +3 -3
  109. package/build/{lib → legacy}/subscribable.js +5 -6
  110. package/build/legacy/subscribable.js.map +1 -0
  111. package/build/legacy/types.cjs +17 -0
  112. package/build/legacy/types.cjs.map +1 -0
  113. package/build/legacy/types.d.cts +3 -0
  114. package/build/legacy/types.d.ts +3 -0
  115. package/build/legacy/types.js +1 -0
  116. package/build/legacy/types.js.map +1 -0
  117. package/build/{lib/utils.legacy.cjs → legacy/utils.cjs} +92 -93
  118. package/build/legacy/utils.cjs.map +1 -0
  119. package/build/legacy/utils.d.cts +3 -0
  120. package/build/legacy/utils.d.ts +3 -0
  121. package/build/{lib/utils.legacy.js → legacy/utils.js} +49 -72
  122. package/build/legacy/utils.js.map +1 -0
  123. package/build/modern/focusManager.cjs +91 -0
  124. package/build/modern/focusManager.cjs.map +1 -0
  125. package/build/modern/focusManager.d.cts +16 -0
  126. package/build/modern/focusManager.d.ts +16 -0
  127. package/build/modern/focusManager.js +66 -0
  128. package/build/modern/focusManager.js.map +1 -0
  129. package/build/modern/hydration.cjs +107 -0
  130. package/build/modern/hydration.cjs.map +1 -0
  131. package/build/modern/hydration.d.cts +35 -0
  132. package/build/modern/hydration.d.ts +35 -0
  133. package/build/modern/hydration.js +80 -0
  134. package/build/modern/hydration.js.map +1 -0
  135. package/build/modern/index.cjs +85 -0
  136. package/build/modern/index.cjs.map +1 -0
  137. package/build/modern/index.d.cts +9 -0
  138. package/build/modern/index.d.ts +9 -0
  139. package/build/modern/index.js +50 -0
  140. package/build/modern/index.js.map +1 -0
  141. package/build/modern/infiniteQueryBehavior.cjs +138 -0
  142. package/build/modern/infiniteQueryBehavior.cjs.map +1 -0
  143. package/build/modern/infiniteQueryBehavior.d.cts +15 -0
  144. package/build/modern/infiniteQueryBehavior.d.ts +15 -0
  145. package/build/{lib → modern}/infiniteQueryBehavior.js +46 -53
  146. package/build/modern/infiniteQueryBehavior.js.map +1 -0
  147. package/build/modern/infiniteQueryObserver.cjs +87 -0
  148. package/build/modern/infiniteQueryObserver.cjs.map +1 -0
  149. package/build/modern/infiniteQueryObserver.d.cts +19 -0
  150. package/build/modern/infiniteQueryObserver.d.ts +19 -0
  151. package/build/{lib → modern}/infiniteQueryObserver.js +23 -31
  152. package/build/modern/infiniteQueryObserver.js.map +1 -0
  153. package/build/modern/mutation.cjs +259 -0
  154. package/build/modern/mutation.cjs.map +1 -0
  155. package/build/modern/mutation.d.cts +3 -0
  156. package/build/modern/mutation.d.ts +3 -0
  157. package/build/{lib → modern}/mutation.js +86 -86
  158. package/build/modern/mutation.js.map +1 -0
  159. package/build/modern/mutationCache.cjs +103 -0
  160. package/build/modern/mutationCache.cjs.map +1 -0
  161. package/build/modern/mutationCache.d.cts +3 -0
  162. package/build/modern/mutationCache.d.ts +3 -0
  163. package/build/modern/mutationCache.js +79 -0
  164. package/build/modern/mutationCache.js.map +1 -0
  165. package/build/modern/mutationObserver.cjs +132 -0
  166. package/build/modern/mutationObserver.cjs.map +1 -0
  167. package/build/modern/mutationObserver.d.cts +3 -0
  168. package/build/modern/mutationObserver.d.ts +3 -0
  169. package/build/{lib → modern}/mutationObserver.js +44 -32
  170. package/build/modern/mutationObserver.js.map +1 -0
  171. package/build/modern/notifyManager.cjs +97 -0
  172. package/build/modern/notifyManager.cjs.map +1 -0
  173. package/build/modern/notifyManager.d.cts +20 -0
  174. package/build/modern/notifyManager.d.ts +20 -0
  175. package/build/{lib/notifyManager.legacy.js → modern/notifyManager.js} +14 -31
  176. package/build/modern/notifyManager.js.map +1 -0
  177. package/build/modern/onlineManager.cjs +82 -0
  178. package/build/modern/onlineManager.cjs.map +1 -0
  179. package/build/modern/onlineManager.d.cts +16 -0
  180. package/build/modern/onlineManager.d.ts +16 -0
  181. package/build/modern/onlineManager.js +57 -0
  182. package/build/modern/onlineManager.js.map +1 -0
  183. package/build/modern/queriesObserver.cjs +202 -0
  184. package/build/modern/queriesObserver.cjs.map +1 -0
  185. package/build/modern/queriesObserver.d.cts +26 -0
  186. package/build/modern/queriesObserver.d.ts +26 -0
  187. package/build/{lib → modern}/queriesObserver.js +69 -50
  188. package/build/modern/queriesObserver.js.map +1 -0
  189. package/build/{lib → modern}/query.cjs +143 -186
  190. package/build/modern/query.cjs.map +1 -0
  191. package/build/modern/query.d.cts +3 -0
  192. package/build/modern/query.d.ts +3 -0
  193. package/build/{lib → modern}/query.js +110 -175
  194. package/build/modern/query.js.map +1 -0
  195. package/build/modern/queryCache.cjs +120 -0
  196. package/build/modern/queryCache.cjs.map +1 -0
  197. package/build/modern/queryCache.d.cts +3 -0
  198. package/build/modern/queryCache.d.ts +3 -0
  199. package/build/{lib → modern}/queryCache.js +21 -29
  200. package/build/modern/queryCache.js.map +1 -0
  201. package/build/modern/queryClient-4ba6364e.d.ts +916 -0
  202. package/build/modern/queryClient-d615ed9f.d.ts +916 -0
  203. package/build/modern/queryClient.cjs +284 -0
  204. package/build/modern/queryClient.cjs.map +1 -0
  205. package/build/modern/queryClient.d.cts +3 -0
  206. package/build/modern/queryClient.d.ts +3 -0
  207. package/build/{lib → modern}/queryClient.js +77 -94
  208. package/build/modern/queryClient.js.map +1 -0
  209. package/build/{lib → modern}/queryObserver.cjs +133 -149
  210. package/build/modern/queryObserver.cjs.map +1 -0
  211. package/build/modern/queryObserver.d.cts +3 -0
  212. package/build/modern/queryObserver.d.ts +3 -0
  213. package/build/{lib → modern}/queryObserver.js +107 -138
  214. package/build/modern/queryObserver.js.map +1 -0
  215. package/build/modern/removable.cjs +55 -0
  216. package/build/modern/removable.cjs.map +1 -0
  217. package/build/modern/removable.d.cts +11 -0
  218. package/build/modern/removable.d.ts +11 -0
  219. package/build/{lib → modern}/removable.js +10 -8
  220. package/build/modern/removable.js.map +1 -0
  221. package/build/{lib → modern}/retryer.cjs +50 -44
  222. package/build/modern/retryer.cjs.map +1 -0
  223. package/build/modern/retryer.d.cts +3 -0
  224. package/build/modern/retryer.d.ts +3 -0
  225. package/build/{lib → modern}/retryer.js +23 -39
  226. package/build/modern/retryer.js.map +1 -0
  227. package/build/modern/subscribable.cjs +49 -0
  228. package/build/modern/subscribable.cjs.map +1 -0
  229. package/build/modern/subscribable.d.cts +11 -0
  230. package/build/modern/subscribable.d.ts +11 -0
  231. package/build/{lib/subscribable.legacy.js → modern/subscribable.js} +5 -6
  232. package/build/modern/subscribable.js.map +1 -0
  233. package/build/modern/types.cjs +17 -0
  234. package/build/modern/types.cjs.map +1 -0
  235. package/build/modern/types.d.cts +3 -0
  236. package/build/modern/types.d.ts +3 -0
  237. package/build/modern/types.js +1 -0
  238. package/build/modern/types.js.map +1 -0
  239. package/build/{lib → modern}/utils.cjs +92 -93
  240. package/build/modern/utils.cjs.map +1 -0
  241. package/build/modern/utils.d.cts +3 -0
  242. package/build/modern/utils.d.ts +3 -0
  243. package/build/{lib → modern}/utils.js +49 -72
  244. package/build/modern/utils.js.map +1 -0
  245. package/package.json +15 -13
  246. package/src/onlineManager.ts +16 -41
  247. package/src/tests/hydration.test.tsx +2 -2
  248. package/src/tests/onlineManager.test.tsx +6 -10
  249. package/src/tests/queryClient.test.tsx +9 -9
  250. package/src/tests/utils.ts +5 -3
  251. package/build/lib/_virtual/_rollupPluginBabelHelpers.legacy.cjs +0 -16
  252. package/build/lib/_virtual/_rollupPluginBabelHelpers.legacy.cjs.map +0 -1
  253. package/build/lib/_virtual/_rollupPluginBabelHelpers.legacy.js +0 -13
  254. package/build/lib/_virtual/_rollupPluginBabelHelpers.legacy.js.map +0 -1
  255. package/build/lib/focusManager.cjs +0 -75
  256. package/build/lib/focusManager.cjs.map +0 -1
  257. package/build/lib/focusManager.d.ts.map +0 -1
  258. package/build/lib/focusManager.js +0 -72
  259. package/build/lib/focusManager.js.map +0 -1
  260. package/build/lib/focusManager.legacy.cjs +0 -91
  261. package/build/lib/focusManager.legacy.cjs.map +0 -1
  262. package/build/lib/focusManager.legacy.js +0 -88
  263. package/build/lib/focusManager.legacy.js.map +0 -1
  264. package/build/lib/hydration.cjs +0 -97
  265. package/build/lib/hydration.cjs.map +0 -1
  266. package/build/lib/hydration.d.ts +0 -35
  267. package/build/lib/hydration.d.ts.map +0 -1
  268. package/build/lib/hydration.js +0 -92
  269. package/build/lib/hydration.js.map +0 -1
  270. package/build/lib/hydration.legacy.cjs +0 -100
  271. package/build/lib/hydration.legacy.cjs.map +0 -1
  272. package/build/lib/hydration.legacy.js +0 -95
  273. package/build/lib/hydration.legacy.js.map +0 -1
  274. package/build/lib/index.cjs +0 -40
  275. package/build/lib/index.cjs.map +0 -1
  276. package/build/lib/index.d.ts +0 -22
  277. package/build/lib/index.d.ts.map +0 -1
  278. package/build/lib/index.js +0 -14
  279. package/build/lib/index.js.map +0 -1
  280. package/build/lib/index.legacy.cjs +0 -40
  281. package/build/lib/index.legacy.cjs.map +0 -1
  282. package/build/lib/index.legacy.js +0 -14
  283. package/build/lib/index.legacy.js.map +0 -1
  284. package/build/lib/infiniteQueryBehavior.cjs +0 -123
  285. package/build/lib/infiniteQueryBehavior.cjs.map +0 -1
  286. package/build/lib/infiniteQueryBehavior.d.ts +0 -12
  287. package/build/lib/infiniteQueryBehavior.d.ts.map +0 -1
  288. package/build/lib/infiniteQueryBehavior.js.map +0 -1
  289. package/build/lib/infiniteQueryBehavior.legacy.cjs +0 -125
  290. package/build/lib/infiniteQueryBehavior.legacy.cjs.map +0 -1
  291. package/build/lib/infiniteQueryBehavior.legacy.js +0 -121
  292. package/build/lib/infiniteQueryBehavior.legacy.js.map +0 -1
  293. package/build/lib/infiniteQueryObserver.cjs +0 -77
  294. package/build/lib/infiniteQueryObserver.cjs.map +0 -1
  295. package/build/lib/infiniteQueryObserver.d.ts.map +0 -1
  296. package/build/lib/infiniteQueryObserver.js.map +0 -1
  297. package/build/lib/infiniteQueryObserver.legacy.cjs +0 -78
  298. package/build/lib/infiniteQueryObserver.legacy.cjs.map +0 -1
  299. package/build/lib/infiniteQueryObserver.legacy.js.map +0 -1
  300. package/build/lib/mutation.cjs +0 -237
  301. package/build/lib/mutation.cjs.map +0 -1
  302. package/build/lib/mutation.d.ts +0 -64
  303. package/build/lib/mutation.d.ts.map +0 -1
  304. package/build/lib/mutation.js.map +0 -1
  305. package/build/lib/mutation.legacy.cjs +0 -262
  306. package/build/lib/mutation.legacy.cjs.map +0 -1
  307. package/build/lib/mutation.legacy.js +0 -259
  308. package/build/lib/mutation.legacy.js.map +0 -1
  309. package/build/lib/mutationCache.cjs +0 -85
  310. package/build/lib/mutationCache.cjs.map +0 -1
  311. package/build/lib/mutationCache.d.ts +0 -59
  312. package/build/lib/mutationCache.d.ts.map +0 -1
  313. package/build/lib/mutationCache.js +0 -83
  314. package/build/lib/mutationCache.js.map +0 -1
  315. package/build/lib/mutationCache.legacy.cjs +0 -98
  316. package/build/lib/mutationCache.legacy.cjs.map +0 -1
  317. package/build/lib/mutationCache.legacy.js +0 -96
  318. package/build/lib/mutationCache.legacy.js.map +0 -1
  319. package/build/lib/mutationObserver.cjs +0 -98
  320. package/build/lib/mutationObserver.cjs.map +0 -1
  321. package/build/lib/mutationObserver.d.ts +0 -19
  322. package/build/lib/mutationObserver.d.ts.map +0 -1
  323. package/build/lib/mutationObserver.js.map +0 -1
  324. package/build/lib/mutationObserver.legacy.cjs +0 -128
  325. package/build/lib/mutationObserver.legacy.cjs.map +0 -1
  326. package/build/lib/mutationObserver.legacy.js +0 -126
  327. package/build/lib/mutationObserver.legacy.js.map +0 -1
  328. package/build/lib/notifyManager.cjs +0 -92
  329. package/build/lib/notifyManager.cjs.map +0 -1
  330. package/build/lib/notifyManager.d.ts.map +0 -1
  331. package/build/lib/notifyManager.js.map +0 -1
  332. package/build/lib/notifyManager.legacy.cjs +0 -92
  333. package/build/lib/notifyManager.legacy.cjs.map +0 -1
  334. package/build/lib/notifyManager.legacy.js.map +0 -1
  335. package/build/lib/onlineManager.cjs +0 -80
  336. package/build/lib/onlineManager.cjs.map +0 -1
  337. package/build/lib/onlineManager.d.ts +0 -15
  338. package/build/lib/onlineManager.d.ts.map +0 -1
  339. package/build/lib/onlineManager.js +0 -77
  340. package/build/lib/onlineManager.js.map +0 -1
  341. package/build/lib/onlineManager.legacy.cjs +0 -95
  342. package/build/lib/onlineManager.legacy.cjs.map +0 -1
  343. package/build/lib/onlineManager.legacy.js +0 -92
  344. package/build/lib/onlineManager.legacy.js.map +0 -1
  345. package/build/lib/queriesObserver.cjs +0 -161
  346. package/build/lib/queriesObserver.cjs.map +0 -1
  347. package/build/lib/queriesObserver.d.ts.map +0 -1
  348. package/build/lib/queriesObserver.js.map +0 -1
  349. package/build/lib/queriesObserver.legacy.cjs +0 -207
  350. package/build/lib/queriesObserver.legacy.cjs.map +0 -1
  351. package/build/lib/queriesObserver.legacy.js +0 -205
  352. package/build/lib/queriesObserver.legacy.js.map +0 -1
  353. package/build/lib/query.cjs.map +0 -1
  354. package/build/lib/query.d.ts +0 -115
  355. package/build/lib/query.d.ts.map +0 -1
  356. package/build/lib/query.js.map +0 -1
  357. package/build/lib/query.legacy.cjs +0 -471
  358. package/build/lib/query.legacy.cjs.map +0 -1
  359. package/build/lib/query.legacy.js +0 -469
  360. package/build/lib/query.legacy.js.map +0 -1
  361. package/build/lib/queryCache.cjs +0 -106
  362. package/build/lib/queryCache.cjs.map +0 -1
  363. package/build/lib/queryCache.d.ts +0 -71
  364. package/build/lib/queryCache.d.ts.map +0 -1
  365. package/build/lib/queryCache.js.map +0 -1
  366. package/build/lib/queryCache.legacy.cjs +0 -111
  367. package/build/lib/queryCache.legacy.cjs.map +0 -1
  368. package/build/lib/queryCache.legacy.js +0 -109
  369. package/build/lib/queryCache.legacy.js.map +0 -1
  370. package/build/lib/queryClient.cjs +0 -285
  371. package/build/lib/queryClient.cjs.map +0 -1
  372. package/build/lib/queryClient.d.ts +0 -41
  373. package/build/lib/queryClient.d.ts.map +0 -1
  374. package/build/lib/queryClient.js.map +0 -1
  375. package/build/lib/queryClient.legacy.cjs +0 -322
  376. package/build/lib/queryClient.legacy.cjs.map +0 -1
  377. package/build/lib/queryClient.legacy.js +0 -320
  378. package/build/lib/queryClient.legacy.js.map +0 -1
  379. package/build/lib/queryObserver.cjs.map +0 -1
  380. package/build/lib/queryObserver.d.ts +0 -35
  381. package/build/lib/queryObserver.d.ts.map +0 -1
  382. package/build/lib/queryObserver.js.map +0 -1
  383. package/build/lib/queryObserver.legacy.cjs +0 -561
  384. package/build/lib/queryObserver.legacy.cjs.map +0 -1
  385. package/build/lib/queryObserver.legacy.js +0 -559
  386. package/build/lib/queryObserver.legacy.js.map +0 -1
  387. package/build/lib/removable.cjs +0 -31
  388. package/build/lib/removable.cjs.map +0 -1
  389. package/build/lib/removable.d.ts.map +0 -1
  390. package/build/lib/removable.js.map +0 -1
  391. package/build/lib/removable.legacy.cjs +0 -38
  392. package/build/lib/removable.legacy.cjs.map +0 -1
  393. package/build/lib/removable.legacy.js +0 -36
  394. package/build/lib/removable.legacy.js.map +0 -1
  395. package/build/lib/retryer.cjs.map +0 -1
  396. package/build/lib/retryer.d.ts +0 -34
  397. package/build/lib/retryer.d.ts.map +0 -1
  398. package/build/lib/retryer.js.map +0 -1
  399. package/build/lib/retryer.legacy.cjs +0 -158
  400. package/build/lib/retryer.legacy.cjs.map +0 -1
  401. package/build/lib/retryer.legacy.js.map +0 -1
  402. package/build/lib/subscribable.cjs +0 -28
  403. package/build/lib/subscribable.cjs.map +0 -1
  404. package/build/lib/subscribable.d.ts.map +0 -1
  405. package/build/lib/subscribable.js.map +0 -1
  406. package/build/lib/subscribable.legacy.cjs +0 -28
  407. package/build/lib/subscribable.legacy.cjs.map +0 -1
  408. package/build/lib/subscribable.legacy.js.map +0 -1
  409. package/build/lib/tests/focusManager.test.d.ts +0 -2
  410. package/build/lib/tests/focusManager.test.d.ts.map +0 -1
  411. package/build/lib/tests/hydration.test.d.ts +0 -2
  412. package/build/lib/tests/hydration.test.d.ts.map +0 -1
  413. package/build/lib/tests/infiniteQueryBehavior.test.d.ts +0 -2
  414. package/build/lib/tests/infiniteQueryBehavior.test.d.ts.map +0 -1
  415. package/build/lib/tests/infiniteQueryObserver.test.d.ts +0 -2
  416. package/build/lib/tests/infiniteQueryObserver.test.d.ts.map +0 -1
  417. package/build/lib/tests/mutationCache.test.d.ts +0 -2
  418. package/build/lib/tests/mutationCache.test.d.ts.map +0 -1
  419. package/build/lib/tests/mutationObserver.test.d.ts +0 -2
  420. package/build/lib/tests/mutationObserver.test.d.ts.map +0 -1
  421. package/build/lib/tests/mutations.test.d.ts +0 -2
  422. package/build/lib/tests/mutations.test.d.ts.map +0 -1
  423. package/build/lib/tests/notifyManager.test.d.ts +0 -2
  424. package/build/lib/tests/notifyManager.test.d.ts.map +0 -1
  425. package/build/lib/tests/onlineManager.test.d.ts +0 -2
  426. package/build/lib/tests/onlineManager.test.d.ts.map +0 -1
  427. package/build/lib/tests/queriesObserver.test.d.ts +0 -2
  428. package/build/lib/tests/queriesObserver.test.d.ts.map +0 -1
  429. package/build/lib/tests/query.test.d.ts +0 -2
  430. package/build/lib/tests/query.test.d.ts.map +0 -1
  431. package/build/lib/tests/queryCache.test.d.ts +0 -2
  432. package/build/lib/tests/queryCache.test.d.ts.map +0 -1
  433. package/build/lib/tests/queryClient.test.d.ts +0 -2
  434. package/build/lib/tests/queryClient.test.d.ts.map +0 -1
  435. package/build/lib/tests/queryObserver.test.d.ts +0 -2
  436. package/build/lib/tests/queryObserver.test.d.ts.map +0 -1
  437. package/build/lib/tests/utils.d.ts +0 -17
  438. package/build/lib/tests/utils.d.ts.map +0 -1
  439. package/build/lib/tests/utils.test.d.ts +0 -2
  440. package/build/lib/tests/utils.test.d.ts.map +0 -1
  441. package/build/lib/types.d.ts +0 -437
  442. package/build/lib/types.d.ts.map +0 -1
  443. package/build/lib/utils.cjs.map +0 -1
  444. package/build/lib/utils.d.ts +0 -90
  445. package/build/lib/utils.d.ts.map +0 -1
  446. package/build/lib/utils.js.map +0 -1
  447. package/build/lib/utils.legacy.cjs.map +0 -1
  448. package/build/lib/utils.legacy.js.map +0 -1
@@ -0,0 +1,20 @@
1
+ type NotifyCallback = () => void;
2
+ type NotifyFunction = (callback: () => void) => void;
3
+ type BatchNotifyFunction = (callback: () => void) => void;
4
+ type BatchCallsCallback<T extends unknown[]> = (...args: T) => void;
5
+ declare function createNotifyManager(): {
6
+ readonly batch: <T>(callback: () => T) => T;
7
+ readonly batchCalls: <T_1 extends unknown[]>(callback: BatchCallsCallback<T_1>) => BatchCallsCallback<T_1>;
8
+ readonly schedule: (callback: NotifyCallback) => void;
9
+ readonly setNotifyFunction: (fn: NotifyFunction) => void;
10
+ readonly setBatchNotifyFunction: (fn: BatchNotifyFunction) => void;
11
+ };
12
+ declare const notifyManager: {
13
+ readonly batch: <T>(callback: () => T) => T;
14
+ readonly batchCalls: <T_1 extends unknown[]>(callback: BatchCallsCallback<T_1>) => BatchCallsCallback<T_1>;
15
+ readonly schedule: (callback: NotifyCallback) => void;
16
+ readonly setNotifyFunction: (fn: NotifyFunction) => void;
17
+ readonly setBatchNotifyFunction: (fn: BatchNotifyFunction) => void;
18
+ };
19
+
20
+ export { createNotifyManager, notifyManager };
@@ -1,17 +1,14 @@
1
- import { scheduleMicrotask } from './utils.legacy.js';
2
-
3
- // TYPES
4
-
1
+ import { scheduleMicrotask } from "./utils";
5
2
  function createNotifyManager() {
6
3
  let queue = [];
7
4
  let transactions = 0;
8
- let notifyFn = callback => {
5
+ let notifyFn = (callback) => {
9
6
  callback();
10
7
  };
11
- let batchNotifyFn = callback => {
8
+ let batchNotifyFn = (callback) => {
12
9
  callback();
13
10
  };
14
- const batch = callback => {
11
+ const batch = (callback) => {
15
12
  let result;
16
13
  transactions++;
17
14
  try {
@@ -24,7 +21,7 @@ function createNotifyManager() {
24
21
  }
25
22
  return result;
26
23
  };
27
- const schedule = callback => {
24
+ const schedule = (callback) => {
28
25
  if (transactions) {
29
26
  queue.push(callback);
30
27
  } else {
@@ -33,11 +30,7 @@ function createNotifyManager() {
33
30
  });
34
31
  }
35
32
  };
36
-
37
- /**
38
- * All calls to the wrapped function will be batched.
39
- */
40
- const batchCalls = callback => {
33
+ const batchCalls = (callback) => {
41
34
  return (...args) => {
42
35
  schedule(() => {
43
36
  callback(...args);
@@ -50,27 +43,17 @@ function createNotifyManager() {
50
43
  if (originalQueue.length) {
51
44
  scheduleMicrotask(() => {
52
45
  batchNotifyFn(() => {
53
- originalQueue.forEach(callback => {
46
+ originalQueue.forEach((callback) => {
54
47
  notifyFn(callback);
55
48
  });
56
49
  });
57
50
  });
58
51
  }
59
52
  };
60
-
61
- /**
62
- * Use this method to set a custom notify function.
63
- * This can be used to for example wrap notifications with `React.act` while running tests.
64
- */
65
- const setNotifyFunction = fn => {
53
+ const setNotifyFunction = (fn) => {
66
54
  notifyFn = fn;
67
55
  };
68
-
69
- /**
70
- * Use this method to set a custom function to batch notifications together into a single tick.
71
- * By default React Query will use the batch function provided by ReactDOM or React Native.
72
- */
73
- const setBatchNotifyFunction = fn => {
56
+ const setBatchNotifyFunction = (fn) => {
74
57
  batchNotifyFn = fn;
75
58
  };
76
59
  return {
@@ -81,9 +64,9 @@ function createNotifyManager() {
81
64
  setBatchNotifyFunction
82
65
  };
83
66
  }
84
-
85
- // SINGLETON
86
67
  const notifyManager = createNotifyManager();
87
-
88
- export { createNotifyManager, notifyManager };
89
- //# sourceMappingURL=notifyManager.legacy.js.map
68
+ export {
69
+ createNotifyManager,
70
+ notifyManager
71
+ };
72
+ //# sourceMappingURL=notifyManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/notifyManager.ts"],"sourcesContent":["import { scheduleMicrotask } from './utils'\n\n// TYPES\n\ntype NotifyCallback = () => void\n\ntype NotifyFunction = (callback: () => void) => void\n\ntype BatchNotifyFunction = (callback: () => void) => void\n\ntype BatchCallsCallback<T extends unknown[]> = (...args: T) => void\n\nexport function createNotifyManager() {\n let queue: NotifyCallback[] = []\n let transactions = 0\n let notifyFn: NotifyFunction = (callback) => {\n callback()\n }\n let batchNotifyFn: BatchNotifyFunction = (callback: () => void) => {\n callback()\n }\n\n const batch = <T>(callback: () => T): T => {\n let result\n transactions++\n try {\n result = callback()\n } finally {\n transactions--\n if (!transactions) {\n flush()\n }\n }\n return result\n }\n\n const schedule = (callback: NotifyCallback): void => {\n if (transactions) {\n queue.push(callback)\n } else {\n scheduleMicrotask(() => {\n notifyFn(callback)\n })\n }\n }\n\n /**\n * All calls to the wrapped function will be batched.\n */\n const batchCalls = <T extends unknown[]>(\n callback: BatchCallsCallback<T>,\n ): BatchCallsCallback<T> => {\n return (...args) => {\n schedule(() => {\n callback(...args)\n })\n }\n }\n\n const flush = (): void => {\n const originalQueue = queue\n queue = []\n if (originalQueue.length) {\n scheduleMicrotask(() => {\n batchNotifyFn(() => {\n originalQueue.forEach((callback) => {\n notifyFn(callback)\n })\n })\n })\n }\n }\n\n /**\n * Use this method to set a custom notify function.\n * This can be used to for example wrap notifications with `React.act` while running tests.\n */\n const setNotifyFunction = (fn: NotifyFunction) => {\n notifyFn = fn\n }\n\n /**\n * Use this method to set a custom function to batch notifications together into a single tick.\n * By default React Query will use the batch function provided by ReactDOM or React Native.\n */\n const setBatchNotifyFunction = (fn: BatchNotifyFunction) => {\n batchNotifyFn = fn\n }\n\n return {\n batch,\n batchCalls,\n schedule,\n setNotifyFunction,\n setBatchNotifyFunction,\n } as const\n}\n\n// SINGLETON\nexport const notifyManager = createNotifyManager()\n"],"mappings":"AAAA,SAAS,yBAAyB;AAY3B,SAAS,sBAAsB;AACpC,MAAI,QAA0B,CAAC;AAC/B,MAAI,eAAe;AACnB,MAAI,WAA2B,CAAC,aAAa;AAC3C,aAAS;AAAA,EACX;AACA,MAAI,gBAAqC,CAAC,aAAyB;AACjE,aAAS;AAAA,EACX;AAEA,QAAM,QAAQ,CAAI,aAAyB;AACzC,QAAI;AACJ;AACA,QAAI;AACF,eAAS,SAAS;AAAA,IACpB,UAAE;AACA;AACA,UAAI,CAAC,cAAc;AACjB,cAAM;AAAA,MACR;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAEA,QAAM,WAAW,CAAC,aAAmC;AACnD,QAAI,cAAc;AAChB,YAAM,KAAK,QAAQ;AAAA,IACrB,OAAO;AACL,wBAAkB,MAAM;AACtB,iBAAS,QAAQ;AAAA,MACnB,CAAC;AAAA,IACH;AAAA,EACF;AAKA,QAAM,aAAa,CACjB,aAC0B;AAC1B,WAAO,IAAI,SAAS;AAClB,eAAS,MAAM;AACb,iBAAS,GAAG,IAAI;AAAA,MAClB,CAAC;AAAA,IACH;AAAA,EACF;AAEA,QAAM,QAAQ,MAAY;AACxB,UAAM,gBAAgB;AACtB,YAAQ,CAAC;AACT,QAAI,cAAc,QAAQ;AACxB,wBAAkB,MAAM;AACtB,sBAAc,MAAM;AAClB,wBAAc,QAAQ,CAAC,aAAa;AAClC,qBAAS,QAAQ;AAAA,UACnB,CAAC;AAAA,QACH,CAAC;AAAA,MACH,CAAC;AAAA,IACH;AAAA,EACF;AAMA,QAAM,oBAAoB,CAAC,OAAuB;AAChD,eAAW;AAAA,EACb;AAMA,QAAM,yBAAyB,CAAC,OAA4B;AAC1D,oBAAgB;AAAA,EAClB;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAGO,MAAM,gBAAgB,oBAAoB;","names":[]}
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var onlineManager_exports = {};
20
+ __export(onlineManager_exports, {
21
+ OnlineManager: () => OnlineManager,
22
+ onlineManager: () => onlineManager
23
+ });
24
+ module.exports = __toCommonJS(onlineManager_exports);
25
+ var import_subscribable = require("./subscribable");
26
+ var import_utils = require("./utils");
27
+ class OnlineManager extends import_subscribable.Subscribable {
28
+ #online = true;
29
+ #cleanup;
30
+ #setup;
31
+ constructor() {
32
+ super();
33
+ this.#setup = (onOnline) => {
34
+ if (!import_utils.isServer && window.addEventListener) {
35
+ const onlineListener = () => onOnline(true);
36
+ const offlineListener = () => onOnline(false);
37
+ window.addEventListener("online", onlineListener, false);
38
+ window.addEventListener("offline", offlineListener, false);
39
+ return () => {
40
+ window.removeEventListener("online", onlineListener);
41
+ window.removeEventListener("offline", offlineListener);
42
+ };
43
+ }
44
+ return;
45
+ };
46
+ }
47
+ onSubscribe() {
48
+ if (!this.#cleanup) {
49
+ this.setEventListener(this.#setup);
50
+ }
51
+ }
52
+ onUnsubscribe() {
53
+ if (!this.hasListeners()) {
54
+ this.#cleanup?.();
55
+ this.#cleanup = void 0;
56
+ }
57
+ }
58
+ setEventListener(setup) {
59
+ this.#setup = setup;
60
+ this.#cleanup?.();
61
+ this.#cleanup = setup(this.setOnline.bind(this));
62
+ }
63
+ setOnline(online) {
64
+ const changed = this.#online !== online;
65
+ if (changed) {
66
+ this.#online = online;
67
+ this.listeners.forEach((listener) => {
68
+ listener(online);
69
+ });
70
+ }
71
+ }
72
+ isOnline() {
73
+ return this.#online;
74
+ }
75
+ }
76
+ const onlineManager = new OnlineManager();
77
+ // Annotate the CommonJS export names for ESM import in node:
78
+ 0 && (module.exports = {
79
+ OnlineManager,
80
+ onlineManager
81
+ });
82
+ //# sourceMappingURL=onlineManager.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/onlineManager.ts"],"sourcesContent":["import { Subscribable } from './subscribable'\nimport { isServer } from './utils'\n\ntype Listener = (online: boolean) => void\ntype SetupFn = (setOnline: Listener) => (() => void) | undefined\n\nexport class OnlineManager extends Subscribable<Listener> {\n #online = true\n #cleanup?: () => void\n\n #setup: SetupFn\n\n constructor() {\n super()\n this.#setup = (onOnline) => {\n // addEventListener does not exist in React Native, but window does\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!isServer && window.addEventListener) {\n const onlineListener = () => onOnline(true)\n const offlineListener = () => onOnline(false)\n // Listen to online\n window.addEventListener('online', onlineListener, false)\n window.addEventListener('offline', offlineListener, false)\n\n return () => {\n // Be sure to unsubscribe if a new handler is set\n window.removeEventListener('online', onlineListener)\n window.removeEventListener('offline', offlineListener)\n }\n }\n\n return\n }\n }\n\n protected onSubscribe(): void {\n if (!this.#cleanup) {\n this.setEventListener(this.#setup)\n }\n }\n\n protected onUnsubscribe() {\n if (!this.hasListeners()) {\n this.#cleanup?.()\n this.#cleanup = undefined\n }\n }\n\n setEventListener(setup: SetupFn): void {\n this.#setup = setup\n this.#cleanup?.()\n this.#cleanup = setup(this.setOnline.bind(this))\n }\n\n setOnline(online: boolean): void {\n const changed = this.#online !== online\n\n if (changed) {\n this.#online = online\n this.listeners.forEach((listener) => {\n listener(online)\n })\n }\n }\n\n isOnline(): boolean {\n return this.#online\n }\n}\n\nexport const onlineManager = new OnlineManager()\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA6B;AAC7B,mBAAyB;AAKlB,MAAM,sBAAsB,iCAAuB;AAAA,EACxD,UAAU;AAAA,EACV;AAAA,EAEA;AAAA,EAEA,cAAc;AACZ,UAAM;AACN,SAAK,SAAS,CAAC,aAAa;AAG1B,UAAI,CAAC,yBAAY,OAAO,kBAAkB;AACxC,cAAM,iBAAiB,MAAM,SAAS,IAAI;AAC1C,cAAM,kBAAkB,MAAM,SAAS,KAAK;AAE5C,eAAO,iBAAiB,UAAU,gBAAgB,KAAK;AACvD,eAAO,iBAAiB,WAAW,iBAAiB,KAAK;AAEzD,eAAO,MAAM;AAEX,iBAAO,oBAAoB,UAAU,cAAc;AACnD,iBAAO,oBAAoB,WAAW,eAAe;AAAA,QACvD;AAAA,MACF;AAEA;AAAA,IACF;AAAA,EACF;AAAA,EAEU,cAAoB;AAC5B,QAAI,CAAC,KAAK,UAAU;AAClB,WAAK,iBAAiB,KAAK,MAAM;AAAA,IACnC;AAAA,EACF;AAAA,EAEU,gBAAgB;AACxB,QAAI,CAAC,KAAK,aAAa,GAAG;AACxB,WAAK,WAAW;AAChB,WAAK,WAAW;AAAA,IAClB;AAAA,EACF;AAAA,EAEA,iBAAiB,OAAsB;AACrC,SAAK,SAAS;AACd,SAAK,WAAW;AAChB,SAAK,WAAW,MAAM,KAAK,UAAU,KAAK,IAAI,CAAC;AAAA,EACjD;AAAA,EAEA,UAAU,QAAuB;AAC/B,UAAM,UAAU,KAAK,YAAY;AAEjC,QAAI,SAAS;AACX,WAAK,UAAU;AACf,WAAK,UAAU,QAAQ,CAAC,aAAa;AACnC,iBAAS,MAAM;AAAA,MACjB,CAAC;AAAA,IACH;AAAA,EACF;AAAA,EAEA,WAAoB;AAClB,WAAO,KAAK;AAAA,EACd;AACF;AAEO,MAAM,gBAAgB,IAAI,cAAc;","names":[]}
@@ -0,0 +1,16 @@
1
+ import { Subscribable } from './subscribable.cjs';
2
+
3
+ type Listener = (online: boolean) => void;
4
+ type SetupFn = (setOnline: Listener) => (() => void) | undefined;
5
+ declare class OnlineManager extends Subscribable<Listener> {
6
+ #private;
7
+ constructor();
8
+ protected onSubscribe(): void;
9
+ protected onUnsubscribe(): void;
10
+ setEventListener(setup: SetupFn): void;
11
+ setOnline(online: boolean): void;
12
+ isOnline(): boolean;
13
+ }
14
+ declare const onlineManager: OnlineManager;
15
+
16
+ export { OnlineManager, onlineManager };
@@ -0,0 +1,16 @@
1
+ import { Subscribable } from './subscribable.js';
2
+
3
+ type Listener = (online: boolean) => void;
4
+ type SetupFn = (setOnline: Listener) => (() => void) | undefined;
5
+ declare class OnlineManager extends Subscribable<Listener> {
6
+ #private;
7
+ constructor();
8
+ protected onSubscribe(): void;
9
+ protected onUnsubscribe(): void;
10
+ setEventListener(setup: SetupFn): void;
11
+ setOnline(online: boolean): void;
12
+ isOnline(): boolean;
13
+ }
14
+ declare const onlineManager: OnlineManager;
15
+
16
+ export { OnlineManager, onlineManager };
@@ -0,0 +1,57 @@
1
+ import { Subscribable } from "./subscribable";
2
+ import { isServer } from "./utils";
3
+ class OnlineManager extends Subscribable {
4
+ #online = true;
5
+ #cleanup;
6
+ #setup;
7
+ constructor() {
8
+ super();
9
+ this.#setup = (onOnline) => {
10
+ if (!isServer && window.addEventListener) {
11
+ const onlineListener = () => onOnline(true);
12
+ const offlineListener = () => onOnline(false);
13
+ window.addEventListener("online", onlineListener, false);
14
+ window.addEventListener("offline", offlineListener, false);
15
+ return () => {
16
+ window.removeEventListener("online", onlineListener);
17
+ window.removeEventListener("offline", offlineListener);
18
+ };
19
+ }
20
+ return;
21
+ };
22
+ }
23
+ onSubscribe() {
24
+ if (!this.#cleanup) {
25
+ this.setEventListener(this.#setup);
26
+ }
27
+ }
28
+ onUnsubscribe() {
29
+ if (!this.hasListeners()) {
30
+ this.#cleanup?.();
31
+ this.#cleanup = void 0;
32
+ }
33
+ }
34
+ setEventListener(setup) {
35
+ this.#setup = setup;
36
+ this.#cleanup?.();
37
+ this.#cleanup = setup(this.setOnline.bind(this));
38
+ }
39
+ setOnline(online) {
40
+ const changed = this.#online !== online;
41
+ if (changed) {
42
+ this.#online = online;
43
+ this.listeners.forEach((listener) => {
44
+ listener(online);
45
+ });
46
+ }
47
+ }
48
+ isOnline() {
49
+ return this.#online;
50
+ }
51
+ }
52
+ const onlineManager = new OnlineManager();
53
+ export {
54
+ OnlineManager,
55
+ onlineManager
56
+ };
57
+ //# sourceMappingURL=onlineManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/onlineManager.ts"],"sourcesContent":["import { Subscribable } from './subscribable'\nimport { isServer } from './utils'\n\ntype Listener = (online: boolean) => void\ntype SetupFn = (setOnline: Listener) => (() => void) | undefined\n\nexport class OnlineManager extends Subscribable<Listener> {\n #online = true\n #cleanup?: () => void\n\n #setup: SetupFn\n\n constructor() {\n super()\n this.#setup = (onOnline) => {\n // addEventListener does not exist in React Native, but window does\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!isServer && window.addEventListener) {\n const onlineListener = () => onOnline(true)\n const offlineListener = () => onOnline(false)\n // Listen to online\n window.addEventListener('online', onlineListener, false)\n window.addEventListener('offline', offlineListener, false)\n\n return () => {\n // Be sure to unsubscribe if a new handler is set\n window.removeEventListener('online', onlineListener)\n window.removeEventListener('offline', offlineListener)\n }\n }\n\n return\n }\n }\n\n protected onSubscribe(): void {\n if (!this.#cleanup) {\n this.setEventListener(this.#setup)\n }\n }\n\n protected onUnsubscribe() {\n if (!this.hasListeners()) {\n this.#cleanup?.()\n this.#cleanup = undefined\n }\n }\n\n setEventListener(setup: SetupFn): void {\n this.#setup = setup\n this.#cleanup?.()\n this.#cleanup = setup(this.setOnline.bind(this))\n }\n\n setOnline(online: boolean): void {\n const changed = this.#online !== online\n\n if (changed) {\n this.#online = online\n this.listeners.forEach((listener) => {\n listener(online)\n })\n }\n }\n\n isOnline(): boolean {\n return this.#online\n }\n}\n\nexport const onlineManager = new OnlineManager()\n"],"mappings":"AAAA,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB;AAKlB,MAAM,sBAAsB,aAAuB;AAAA,EACxD,UAAU;AAAA,EACV;AAAA,EAEA;AAAA,EAEA,cAAc;AACZ,UAAM;AACN,SAAK,SAAS,CAAC,aAAa;AAG1B,UAAI,CAAC,YAAY,OAAO,kBAAkB;AACxC,cAAM,iBAAiB,MAAM,SAAS,IAAI;AAC1C,cAAM,kBAAkB,MAAM,SAAS,KAAK;AAE5C,eAAO,iBAAiB,UAAU,gBAAgB,KAAK;AACvD,eAAO,iBAAiB,WAAW,iBAAiB,KAAK;AAEzD,eAAO,MAAM;AAEX,iBAAO,oBAAoB,UAAU,cAAc;AACnD,iBAAO,oBAAoB,WAAW,eAAe;AAAA,QACvD;AAAA,MACF;AAEA;AAAA,IACF;AAAA,EACF;AAAA,EAEU,cAAoB;AAC5B,QAAI,CAAC,KAAK,UAAU;AAClB,WAAK,iBAAiB,KAAK,MAAM;AAAA,IACnC;AAAA,EACF;AAAA,EAEU,gBAAgB;AACxB,QAAI,CAAC,KAAK,aAAa,GAAG;AACxB,WAAK,WAAW;AAChB,WAAK,WAAW;AAAA,IAClB;AAAA,EACF;AAAA,EAEA,iBAAiB,OAAsB;AACrC,SAAK,SAAS;AACd,SAAK,WAAW;AAChB,SAAK,WAAW,MAAM,KAAK,UAAU,KAAK,IAAI,CAAC;AAAA,EACjD;AAAA,EAEA,UAAU,QAAuB;AAC/B,UAAM,UAAU,KAAK,YAAY;AAEjC,QAAI,SAAS;AACX,WAAK,UAAU;AACf,WAAK,UAAU,QAAQ,CAAC,aAAa;AACnC,iBAAS,MAAM;AAAA,MACjB,CAAC;AAAA,IACH;AAAA,EACF;AAAA,EAEA,WAAoB;AAClB,WAAO,KAAK;AAAA,EACd;AACF;AAEO,MAAM,gBAAgB,IAAI,cAAc;","names":[]}
@@ -0,0 +1,202 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var queriesObserver_exports = {};
20
+ __export(queriesObserver_exports, {
21
+ QueriesObserver: () => QueriesObserver
22
+ });
23
+ module.exports = __toCommonJS(queriesObserver_exports);
24
+ var import_notifyManager = require("./notifyManager");
25
+ var import_queryObserver = require("./queryObserver");
26
+ var import_subscribable = require("./subscribable");
27
+ var import_utils = require("./utils");
28
+ function difference(array1, array2) {
29
+ return array1.filter((x) => !array2.includes(x));
30
+ }
31
+ function replaceAt(array, index, value) {
32
+ const copy = array.slice(0);
33
+ copy[index] = value;
34
+ return copy;
35
+ }
36
+ class QueriesObserver extends import_subscribable.Subscribable {
37
+ #client;
38
+ #result;
39
+ #queries;
40
+ #observers;
41
+ #options;
42
+ #combinedResult;
43
+ constructor(client, queries, options) {
44
+ super();
45
+ this.#client = client;
46
+ this.#queries = [];
47
+ this.#observers = [];
48
+ this.#setResult([]);
49
+ this.setQueries(queries, options);
50
+ }
51
+ #setResult(value) {
52
+ this.#result = value;
53
+ this.#combinedResult = this.#combineResult(value);
54
+ }
55
+ onSubscribe() {
56
+ if (this.listeners.size === 1) {
57
+ this.#observers.forEach((observer) => {
58
+ observer.subscribe((result) => {
59
+ this.#onUpdate(observer, result);
60
+ });
61
+ });
62
+ }
63
+ }
64
+ onUnsubscribe() {
65
+ if (!this.listeners.size) {
66
+ this.destroy();
67
+ }
68
+ }
69
+ destroy() {
70
+ this.listeners = /* @__PURE__ */ new Set();
71
+ this.#observers.forEach((observer) => {
72
+ observer.destroy();
73
+ });
74
+ }
75
+ setQueries(queries, options, notifyOptions) {
76
+ this.#queries = queries;
77
+ this.#options = options;
78
+ import_notifyManager.notifyManager.batch(() => {
79
+ const prevObservers = this.#observers;
80
+ const newObserverMatches = this.#findMatchingObservers(this.#queries);
81
+ newObserverMatches.forEach(
82
+ (match) => match.observer.setOptions(match.defaultedQueryOptions, notifyOptions)
83
+ );
84
+ const newObservers = newObserverMatches.map((match) => match.observer);
85
+ const newResult = newObservers.map(
86
+ (observer) => observer.getCurrentResult()
87
+ );
88
+ const hasIndexChange = newObservers.some(
89
+ (observer, index) => observer !== prevObservers[index]
90
+ );
91
+ if (prevObservers.length === newObservers.length && !hasIndexChange) {
92
+ return;
93
+ }
94
+ this.#observers = newObservers;
95
+ this.#setResult(newResult);
96
+ if (!this.hasListeners()) {
97
+ return;
98
+ }
99
+ difference(prevObservers, newObservers).forEach((observer) => {
100
+ observer.destroy();
101
+ });
102
+ difference(newObservers, prevObservers).forEach((observer) => {
103
+ observer.subscribe((result) => {
104
+ this.#onUpdate(observer, result);
105
+ });
106
+ });
107
+ this.#notify();
108
+ });
109
+ }
110
+ getCurrentResult() {
111
+ return this.#combinedResult;
112
+ }
113
+ getQueries() {
114
+ return this.#observers.map((observer) => observer.getCurrentQuery());
115
+ }
116
+ getObservers() {
117
+ return this.#observers;
118
+ }
119
+ getOptimisticResult(queries) {
120
+ const matches = this.#findMatchingObservers(queries);
121
+ const result = matches.map(
122
+ (match) => match.observer.getOptimisticResult(match.defaultedQueryOptions)
123
+ );
124
+ return [
125
+ result,
126
+ (r) => {
127
+ return this.#combineResult(r ?? result);
128
+ },
129
+ () => {
130
+ return matches.map((match, index) => {
131
+ const observerResult = result[index];
132
+ return !match.defaultedQueryOptions.notifyOnChangeProps ? match.observer.trackResult(observerResult) : observerResult;
133
+ });
134
+ }
135
+ ];
136
+ }
137
+ #combineResult(input) {
138
+ const combine = this.#options?.combine;
139
+ if (combine) {
140
+ return (0, import_utils.replaceEqualDeep)(this.#combinedResult, combine(input));
141
+ }
142
+ return input;
143
+ }
144
+ #findMatchingObservers(queries) {
145
+ const prevObservers = this.#observers;
146
+ const prevObserversMap = new Map(
147
+ prevObservers.map((observer) => [observer.options.queryHash, observer])
148
+ );
149
+ const defaultedQueryOptions = queries.map(
150
+ (options) => this.#client.defaultQueryOptions(options)
151
+ );
152
+ const matchingObservers = defaultedQueryOptions.flatMap((defaultedOptions) => {
153
+ const match = prevObserversMap.get(defaultedOptions.queryHash);
154
+ if (match != null) {
155
+ return [{ defaultedQueryOptions: defaultedOptions, observer: match }];
156
+ }
157
+ return [];
158
+ });
159
+ const matchedQueryHashes = new Set(
160
+ matchingObservers.map((match) => match.defaultedQueryOptions.queryHash)
161
+ );
162
+ const unmatchedQueries = defaultedQueryOptions.filter(
163
+ (defaultedOptions) => !matchedQueryHashes.has(defaultedOptions.queryHash)
164
+ );
165
+ const getObserver = (options) => {
166
+ const defaultedOptions = this.#client.defaultQueryOptions(options);
167
+ const currentObserver = this.#observers.find(
168
+ (o) => o.options.queryHash === defaultedOptions.queryHash
169
+ );
170
+ return currentObserver ?? new import_queryObserver.QueryObserver(this.#client, defaultedOptions);
171
+ };
172
+ const newOrReusedObservers = unmatchedQueries.map(
173
+ (options) => {
174
+ return {
175
+ defaultedQueryOptions: options,
176
+ observer: getObserver(options)
177
+ };
178
+ }
179
+ );
180
+ const sortMatchesByOrderOfQueries = (a, b) => defaultedQueryOptions.indexOf(a.defaultedQueryOptions) - defaultedQueryOptions.indexOf(b.defaultedQueryOptions);
181
+ return matchingObservers.concat(newOrReusedObservers).sort(sortMatchesByOrderOfQueries);
182
+ }
183
+ #onUpdate(observer, result) {
184
+ const index = this.#observers.indexOf(observer);
185
+ if (index !== -1) {
186
+ this.#setResult(replaceAt(this.#result, index, result));
187
+ this.#notify();
188
+ }
189
+ }
190
+ #notify() {
191
+ import_notifyManager.notifyManager.batch(() => {
192
+ this.listeners.forEach((listener) => {
193
+ listener(this.#result);
194
+ });
195
+ });
196
+ }
197
+ }
198
+ // Annotate the CommonJS export names for ESM import in node:
199
+ 0 && (module.exports = {
200
+ QueriesObserver
201
+ });
202
+ //# sourceMappingURL=queriesObserver.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/queriesObserver.ts"],"sourcesContent":["import { notifyManager } from './notifyManager'\nimport { QueryObserver } from './queryObserver'\nimport { Subscribable } from './subscribable'\nimport { replaceEqualDeep } from './utils'\nimport type {\n DefaultedQueryObserverOptions,\n QueryObserverOptions,\n QueryObserverResult,\n} from './types'\nimport type { QueryClient } from './queryClient'\nimport type { NotifyOptions } from './queryObserver'\n\nfunction difference<T>(array1: T[], array2: T[]): T[] {\n return array1.filter((x) => !array2.includes(x))\n}\n\nfunction replaceAt<T>(array: T[], index: number, value: T): T[] {\n const copy = array.slice(0)\n copy[index] = value\n return copy\n}\n\ntype QueriesObserverListener = (result: QueryObserverResult[]) => void\n\nexport interface QueriesObserverOptions<\n TCombinedResult = QueryObserverResult[],\n> {\n combine?: (result: QueryObserverResult[]) => TCombinedResult\n}\n\nexport class QueriesObserver<\n TCombinedResult = QueryObserverResult[],\n> extends Subscribable<QueriesObserverListener> {\n #client: QueryClient\n #result!: QueryObserverResult[]\n #queries: QueryObserverOptions[]\n #observers: QueryObserver[]\n #options?: QueriesObserverOptions<TCombinedResult>\n #combinedResult!: TCombinedResult\n\n constructor(\n client: QueryClient,\n queries: QueryObserverOptions[],\n options?: QueriesObserverOptions<TCombinedResult>,\n ) {\n super()\n\n this.#client = client\n this.#queries = []\n this.#observers = []\n\n this.#setResult([])\n this.setQueries(queries, options)\n }\n\n #setResult(value: QueryObserverResult[]) {\n this.#result = value\n this.#combinedResult = this.#combineResult(value)\n }\n\n protected onSubscribe(): void {\n if (this.listeners.size === 1) {\n this.#observers.forEach((observer) => {\n observer.subscribe((result) => {\n this.#onUpdate(observer, result)\n })\n })\n }\n }\n\n protected onUnsubscribe(): void {\n if (!this.listeners.size) {\n this.destroy()\n }\n }\n\n destroy(): void {\n this.listeners = new Set()\n this.#observers.forEach((observer) => {\n observer.destroy()\n })\n }\n\n setQueries(\n queries: QueryObserverOptions[],\n options?: QueriesObserverOptions<TCombinedResult>,\n notifyOptions?: NotifyOptions,\n ): void {\n this.#queries = queries\n this.#options = options\n\n notifyManager.batch(() => {\n const prevObservers = this.#observers\n\n const newObserverMatches = this.#findMatchingObservers(this.#queries)\n\n // set options for the new observers to notify of changes\n newObserverMatches.forEach((match) =>\n match.observer.setOptions(match.defaultedQueryOptions, notifyOptions),\n )\n\n const newObservers = newObserverMatches.map((match) => match.observer)\n const newResult = newObservers.map((observer) =>\n observer.getCurrentResult(),\n )\n\n const hasIndexChange = newObservers.some(\n (observer, index) => observer !== prevObservers[index],\n )\n if (prevObservers.length === newObservers.length && !hasIndexChange) {\n return\n }\n\n this.#observers = newObservers\n this.#setResult(newResult)\n\n if (!this.hasListeners()) {\n return\n }\n\n difference(prevObservers, newObservers).forEach((observer) => {\n observer.destroy()\n })\n\n difference(newObservers, prevObservers).forEach((observer) => {\n observer.subscribe((result) => {\n this.#onUpdate(observer, result)\n })\n })\n\n this.#notify()\n })\n }\n\n getCurrentResult(): TCombinedResult {\n return this.#combinedResult\n }\n\n getQueries() {\n return this.#observers.map((observer) => observer.getCurrentQuery())\n }\n\n getObservers() {\n return this.#observers\n }\n\n getOptimisticResult(\n queries: QueryObserverOptions[],\n ): [\n rawResult: QueryObserverResult[],\n combineResult: (r?: QueryObserverResult[]) => TCombinedResult,\n trackResult: () => QueryObserverResult[],\n ] {\n const matches = this.#findMatchingObservers(queries)\n const result = matches.map((match) =>\n match.observer.getOptimisticResult(match.defaultedQueryOptions),\n )\n\n return [\n result,\n (r?: QueryObserverResult[]) => {\n return this.#combineResult(r ?? result)\n },\n () => {\n return matches.map((match, index) => {\n const observerResult = result[index]!\n return !match.defaultedQueryOptions.notifyOnChangeProps\n ? match.observer.trackResult(observerResult)\n : observerResult\n })\n },\n ]\n }\n\n #combineResult(input: QueryObserverResult[]): TCombinedResult {\n const combine = this.#options?.combine\n if (combine) {\n return replaceEqualDeep(this.#combinedResult, combine(input))\n }\n return input as any\n }\n\n #findMatchingObservers(\n queries: QueryObserverOptions[],\n ): QueryObserverMatch[] {\n const prevObservers = this.#observers\n const prevObserversMap = new Map(\n prevObservers.map((observer) => [observer.options.queryHash, observer]),\n )\n\n const defaultedQueryOptions = queries.map((options) =>\n this.#client.defaultQueryOptions(options),\n )\n\n const matchingObservers: QueryObserverMatch[] =\n defaultedQueryOptions.flatMap((defaultedOptions) => {\n const match = prevObserversMap.get(defaultedOptions.queryHash)\n if (match != null) {\n return [{ defaultedQueryOptions: defaultedOptions, observer: match }]\n }\n return []\n })\n\n const matchedQueryHashes = new Set(\n matchingObservers.map((match) => match.defaultedQueryOptions.queryHash),\n )\n const unmatchedQueries = defaultedQueryOptions.filter(\n (defaultedOptions) => !matchedQueryHashes.has(defaultedOptions.queryHash),\n )\n\n const getObserver = (options: QueryObserverOptions): QueryObserver => {\n const defaultedOptions = this.#client.defaultQueryOptions(options)\n const currentObserver = this.#observers.find(\n (o) => o.options.queryHash === defaultedOptions.queryHash,\n )\n return (\n currentObserver ?? new QueryObserver(this.#client, defaultedOptions)\n )\n }\n\n const newOrReusedObservers: QueryObserverMatch[] = unmatchedQueries.map(\n (options) => {\n return {\n defaultedQueryOptions: options,\n observer: getObserver(options),\n }\n },\n )\n\n const sortMatchesByOrderOfQueries = (\n a: QueryObserverMatch,\n b: QueryObserverMatch,\n ): number =>\n defaultedQueryOptions.indexOf(a.defaultedQueryOptions) -\n defaultedQueryOptions.indexOf(b.defaultedQueryOptions)\n\n return matchingObservers\n .concat(newOrReusedObservers)\n .sort(sortMatchesByOrderOfQueries)\n }\n\n #onUpdate(observer: QueryObserver, result: QueryObserverResult): void {\n const index = this.#observers.indexOf(observer)\n if (index !== -1) {\n this.#setResult(replaceAt(this.#result, index, result))\n this.#notify()\n }\n }\n\n #notify(): void {\n notifyManager.batch(() => {\n this.listeners.forEach((listener) => {\n listener(this.#result)\n })\n })\n }\n}\n\ntype QueryObserverMatch = {\n defaultedQueryOptions: DefaultedQueryObserverOptions\n observer: QueryObserver\n}\n"],"mappings":"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","names":[]}
@@ -0,0 +1,26 @@
1
+ import { a7 as QueryObserverResult, b as QueryClient, B as QueryObserverOptions, aA as NotifyOptions, j as Query, p as QueryKey, c as QueryObserver } from './queryClient-4ba6364e.js';
2
+ import { Subscribable } from './subscribable.cjs';
3
+ import './removable.cjs';
4
+
5
+ type QueriesObserverListener = (result: QueryObserverResult[]) => void;
6
+ interface QueriesObserverOptions<TCombinedResult = QueryObserverResult[]> {
7
+ combine?: (result: QueryObserverResult[]) => TCombinedResult;
8
+ }
9
+ declare class QueriesObserver<TCombinedResult = QueryObserverResult[]> extends Subscribable<QueriesObserverListener> {
10
+ #private;
11
+ constructor(client: QueryClient, queries: QueryObserverOptions[], options?: QueriesObserverOptions<TCombinedResult>);
12
+ protected onSubscribe(): void;
13
+ protected onUnsubscribe(): void;
14
+ destroy(): void;
15
+ setQueries(queries: QueryObserverOptions[], options?: QueriesObserverOptions<TCombinedResult>, notifyOptions?: NotifyOptions): void;
16
+ getCurrentResult(): TCombinedResult;
17
+ getQueries(): Query<unknown, Error, unknown, QueryKey>[];
18
+ getObservers(): QueryObserver<unknown, Error, unknown, unknown, QueryKey>[];
19
+ getOptimisticResult(queries: QueryObserverOptions[]): [
20
+ rawResult: QueryObserverResult[],
21
+ combineResult: (r?: QueryObserverResult[]) => TCombinedResult,
22
+ trackResult: () => QueryObserverResult[]
23
+ ];
24
+ }
25
+
26
+ export { QueriesObserver, QueriesObserverOptions };
@@ -0,0 +1,26 @@
1
+ import { a7 as QueryObserverResult, b as QueryClient, B as QueryObserverOptions, aA as NotifyOptions, j as Query, p as QueryKey, c as QueryObserver } from './queryClient-d615ed9f.js';
2
+ import { Subscribable } from './subscribable.js';
3
+ import './removable.js';
4
+
5
+ type QueriesObserverListener = (result: QueryObserverResult[]) => void;
6
+ interface QueriesObserverOptions<TCombinedResult = QueryObserverResult[]> {
7
+ combine?: (result: QueryObserverResult[]) => TCombinedResult;
8
+ }
9
+ declare class QueriesObserver<TCombinedResult = QueryObserverResult[]> extends Subscribable<QueriesObserverListener> {
10
+ #private;
11
+ constructor(client: QueryClient, queries: QueryObserverOptions[], options?: QueriesObserverOptions<TCombinedResult>);
12
+ protected onSubscribe(): void;
13
+ protected onUnsubscribe(): void;
14
+ destroy(): void;
15
+ setQueries(queries: QueryObserverOptions[], options?: QueriesObserverOptions<TCombinedResult>, notifyOptions?: NotifyOptions): void;
16
+ getCurrentResult(): TCombinedResult;
17
+ getQueries(): Query<unknown, Error, unknown, QueryKey>[];
18
+ getObservers(): QueryObserver<unknown, Error, unknown, unknown, QueryKey>[];
19
+ getOptimisticResult(queries: QueryObserverOptions[]): [
20
+ rawResult: QueryObserverResult[],
21
+ combineResult: (r?: QueryObserverResult[]) => TCombinedResult,
22
+ trackResult: () => QueryObserverResult[]
23
+ ];
24
+ }
25
+
26
+ export { QueriesObserver, QueriesObserverOptions };