@tanstack/query-core 5.0.0-alpha.86 → 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 (441) 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/{lib → legacy}/onlineManager.d.ts +6 -5
  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/{lib → modern}/onlineManager.js +14 -17
  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/build/lib/_virtual/_rollupPluginBabelHelpers.legacy.cjs +0 -16
  247. package/build/lib/_virtual/_rollupPluginBabelHelpers.legacy.cjs.map +0 -1
  248. package/build/lib/_virtual/_rollupPluginBabelHelpers.legacy.js +0 -13
  249. package/build/lib/_virtual/_rollupPluginBabelHelpers.legacy.js.map +0 -1
  250. package/build/lib/focusManager.cjs +0 -75
  251. package/build/lib/focusManager.cjs.map +0 -1
  252. package/build/lib/focusManager.d.ts.map +0 -1
  253. package/build/lib/focusManager.js +0 -72
  254. package/build/lib/focusManager.js.map +0 -1
  255. package/build/lib/focusManager.legacy.cjs +0 -91
  256. package/build/lib/focusManager.legacy.cjs.map +0 -1
  257. package/build/lib/focusManager.legacy.js +0 -88
  258. package/build/lib/focusManager.legacy.js.map +0 -1
  259. package/build/lib/hydration.cjs +0 -97
  260. package/build/lib/hydration.cjs.map +0 -1
  261. package/build/lib/hydration.d.ts +0 -35
  262. package/build/lib/hydration.d.ts.map +0 -1
  263. package/build/lib/hydration.js +0 -92
  264. package/build/lib/hydration.js.map +0 -1
  265. package/build/lib/hydration.legacy.cjs +0 -100
  266. package/build/lib/hydration.legacy.cjs.map +0 -1
  267. package/build/lib/hydration.legacy.js +0 -95
  268. package/build/lib/hydration.legacy.js.map +0 -1
  269. package/build/lib/index.cjs +0 -40
  270. package/build/lib/index.cjs.map +0 -1
  271. package/build/lib/index.d.ts +0 -22
  272. package/build/lib/index.d.ts.map +0 -1
  273. package/build/lib/index.js +0 -14
  274. package/build/lib/index.js.map +0 -1
  275. package/build/lib/index.legacy.cjs +0 -40
  276. package/build/lib/index.legacy.cjs.map +0 -1
  277. package/build/lib/index.legacy.js +0 -14
  278. package/build/lib/index.legacy.js.map +0 -1
  279. package/build/lib/infiniteQueryBehavior.cjs +0 -123
  280. package/build/lib/infiniteQueryBehavior.cjs.map +0 -1
  281. package/build/lib/infiniteQueryBehavior.d.ts +0 -12
  282. package/build/lib/infiniteQueryBehavior.d.ts.map +0 -1
  283. package/build/lib/infiniteQueryBehavior.js.map +0 -1
  284. package/build/lib/infiniteQueryBehavior.legacy.cjs +0 -125
  285. package/build/lib/infiniteQueryBehavior.legacy.cjs.map +0 -1
  286. package/build/lib/infiniteQueryBehavior.legacy.js +0 -121
  287. package/build/lib/infiniteQueryBehavior.legacy.js.map +0 -1
  288. package/build/lib/infiniteQueryObserver.cjs +0 -77
  289. package/build/lib/infiniteQueryObserver.cjs.map +0 -1
  290. package/build/lib/infiniteQueryObserver.d.ts.map +0 -1
  291. package/build/lib/infiniteQueryObserver.js.map +0 -1
  292. package/build/lib/infiniteQueryObserver.legacy.cjs +0 -78
  293. package/build/lib/infiniteQueryObserver.legacy.cjs.map +0 -1
  294. package/build/lib/infiniteQueryObserver.legacy.js.map +0 -1
  295. package/build/lib/mutation.cjs +0 -237
  296. package/build/lib/mutation.cjs.map +0 -1
  297. package/build/lib/mutation.d.ts +0 -64
  298. package/build/lib/mutation.d.ts.map +0 -1
  299. package/build/lib/mutation.js.map +0 -1
  300. package/build/lib/mutation.legacy.cjs +0 -262
  301. package/build/lib/mutation.legacy.cjs.map +0 -1
  302. package/build/lib/mutation.legacy.js +0 -259
  303. package/build/lib/mutation.legacy.js.map +0 -1
  304. package/build/lib/mutationCache.cjs +0 -85
  305. package/build/lib/mutationCache.cjs.map +0 -1
  306. package/build/lib/mutationCache.d.ts +0 -59
  307. package/build/lib/mutationCache.d.ts.map +0 -1
  308. package/build/lib/mutationCache.js +0 -83
  309. package/build/lib/mutationCache.js.map +0 -1
  310. package/build/lib/mutationCache.legacy.cjs +0 -98
  311. package/build/lib/mutationCache.legacy.cjs.map +0 -1
  312. package/build/lib/mutationCache.legacy.js +0 -96
  313. package/build/lib/mutationCache.legacy.js.map +0 -1
  314. package/build/lib/mutationObserver.cjs +0 -98
  315. package/build/lib/mutationObserver.cjs.map +0 -1
  316. package/build/lib/mutationObserver.d.ts +0 -19
  317. package/build/lib/mutationObserver.d.ts.map +0 -1
  318. package/build/lib/mutationObserver.js.map +0 -1
  319. package/build/lib/mutationObserver.legacy.cjs +0 -128
  320. package/build/lib/mutationObserver.legacy.cjs.map +0 -1
  321. package/build/lib/mutationObserver.legacy.js +0 -126
  322. package/build/lib/mutationObserver.legacy.js.map +0 -1
  323. package/build/lib/notifyManager.cjs +0 -92
  324. package/build/lib/notifyManager.cjs.map +0 -1
  325. package/build/lib/notifyManager.d.ts.map +0 -1
  326. package/build/lib/notifyManager.js.map +0 -1
  327. package/build/lib/notifyManager.legacy.cjs +0 -92
  328. package/build/lib/notifyManager.legacy.cjs.map +0 -1
  329. package/build/lib/notifyManager.legacy.js.map +0 -1
  330. package/build/lib/onlineManager.cjs +0 -63
  331. package/build/lib/onlineManager.cjs.map +0 -1
  332. package/build/lib/onlineManager.d.ts.map +0 -1
  333. package/build/lib/onlineManager.js.map +0 -1
  334. package/build/lib/onlineManager.legacy.cjs +0 -78
  335. package/build/lib/onlineManager.legacy.cjs.map +0 -1
  336. package/build/lib/onlineManager.legacy.js +0 -75
  337. package/build/lib/onlineManager.legacy.js.map +0 -1
  338. package/build/lib/queriesObserver.cjs +0 -161
  339. package/build/lib/queriesObserver.cjs.map +0 -1
  340. package/build/lib/queriesObserver.d.ts.map +0 -1
  341. package/build/lib/queriesObserver.js.map +0 -1
  342. package/build/lib/queriesObserver.legacy.cjs +0 -207
  343. package/build/lib/queriesObserver.legacy.cjs.map +0 -1
  344. package/build/lib/queriesObserver.legacy.js +0 -205
  345. package/build/lib/queriesObserver.legacy.js.map +0 -1
  346. package/build/lib/query.cjs.map +0 -1
  347. package/build/lib/query.d.ts +0 -115
  348. package/build/lib/query.d.ts.map +0 -1
  349. package/build/lib/query.js.map +0 -1
  350. package/build/lib/query.legacy.cjs +0 -471
  351. package/build/lib/query.legacy.cjs.map +0 -1
  352. package/build/lib/query.legacy.js +0 -469
  353. package/build/lib/query.legacy.js.map +0 -1
  354. package/build/lib/queryCache.cjs +0 -106
  355. package/build/lib/queryCache.cjs.map +0 -1
  356. package/build/lib/queryCache.d.ts +0 -71
  357. package/build/lib/queryCache.d.ts.map +0 -1
  358. package/build/lib/queryCache.js.map +0 -1
  359. package/build/lib/queryCache.legacy.cjs +0 -111
  360. package/build/lib/queryCache.legacy.cjs.map +0 -1
  361. package/build/lib/queryCache.legacy.js +0 -109
  362. package/build/lib/queryCache.legacy.js.map +0 -1
  363. package/build/lib/queryClient.cjs +0 -285
  364. package/build/lib/queryClient.cjs.map +0 -1
  365. package/build/lib/queryClient.d.ts +0 -41
  366. package/build/lib/queryClient.d.ts.map +0 -1
  367. package/build/lib/queryClient.js.map +0 -1
  368. package/build/lib/queryClient.legacy.cjs +0 -322
  369. package/build/lib/queryClient.legacy.cjs.map +0 -1
  370. package/build/lib/queryClient.legacy.js +0 -320
  371. package/build/lib/queryClient.legacy.js.map +0 -1
  372. package/build/lib/queryObserver.cjs.map +0 -1
  373. package/build/lib/queryObserver.d.ts +0 -35
  374. package/build/lib/queryObserver.d.ts.map +0 -1
  375. package/build/lib/queryObserver.js.map +0 -1
  376. package/build/lib/queryObserver.legacy.cjs +0 -561
  377. package/build/lib/queryObserver.legacy.cjs.map +0 -1
  378. package/build/lib/queryObserver.legacy.js +0 -559
  379. package/build/lib/queryObserver.legacy.js.map +0 -1
  380. package/build/lib/removable.cjs +0 -31
  381. package/build/lib/removable.cjs.map +0 -1
  382. package/build/lib/removable.d.ts.map +0 -1
  383. package/build/lib/removable.js.map +0 -1
  384. package/build/lib/removable.legacy.cjs +0 -38
  385. package/build/lib/removable.legacy.cjs.map +0 -1
  386. package/build/lib/removable.legacy.js +0 -36
  387. package/build/lib/removable.legacy.js.map +0 -1
  388. package/build/lib/retryer.cjs.map +0 -1
  389. package/build/lib/retryer.d.ts +0 -34
  390. package/build/lib/retryer.d.ts.map +0 -1
  391. package/build/lib/retryer.js.map +0 -1
  392. package/build/lib/retryer.legacy.cjs +0 -158
  393. package/build/lib/retryer.legacy.cjs.map +0 -1
  394. package/build/lib/retryer.legacy.js.map +0 -1
  395. package/build/lib/subscribable.cjs +0 -28
  396. package/build/lib/subscribable.cjs.map +0 -1
  397. package/build/lib/subscribable.d.ts.map +0 -1
  398. package/build/lib/subscribable.js.map +0 -1
  399. package/build/lib/subscribable.legacy.cjs +0 -28
  400. package/build/lib/subscribable.legacy.cjs.map +0 -1
  401. package/build/lib/subscribable.legacy.js.map +0 -1
  402. package/build/lib/tests/focusManager.test.d.ts +0 -2
  403. package/build/lib/tests/focusManager.test.d.ts.map +0 -1
  404. package/build/lib/tests/hydration.test.d.ts +0 -2
  405. package/build/lib/tests/hydration.test.d.ts.map +0 -1
  406. package/build/lib/tests/infiniteQueryBehavior.test.d.ts +0 -2
  407. package/build/lib/tests/infiniteQueryBehavior.test.d.ts.map +0 -1
  408. package/build/lib/tests/infiniteQueryObserver.test.d.ts +0 -2
  409. package/build/lib/tests/infiniteQueryObserver.test.d.ts.map +0 -1
  410. package/build/lib/tests/mutationCache.test.d.ts +0 -2
  411. package/build/lib/tests/mutationCache.test.d.ts.map +0 -1
  412. package/build/lib/tests/mutationObserver.test.d.ts +0 -2
  413. package/build/lib/tests/mutationObserver.test.d.ts.map +0 -1
  414. package/build/lib/tests/mutations.test.d.ts +0 -2
  415. package/build/lib/tests/mutations.test.d.ts.map +0 -1
  416. package/build/lib/tests/notifyManager.test.d.ts +0 -2
  417. package/build/lib/tests/notifyManager.test.d.ts.map +0 -1
  418. package/build/lib/tests/onlineManager.test.d.ts +0 -2
  419. package/build/lib/tests/onlineManager.test.d.ts.map +0 -1
  420. package/build/lib/tests/queriesObserver.test.d.ts +0 -2
  421. package/build/lib/tests/queriesObserver.test.d.ts.map +0 -1
  422. package/build/lib/tests/query.test.d.ts +0 -2
  423. package/build/lib/tests/query.test.d.ts.map +0 -1
  424. package/build/lib/tests/queryCache.test.d.ts +0 -2
  425. package/build/lib/tests/queryCache.test.d.ts.map +0 -1
  426. package/build/lib/tests/queryClient.test.d.ts +0 -2
  427. package/build/lib/tests/queryClient.test.d.ts.map +0 -1
  428. package/build/lib/tests/queryObserver.test.d.ts +0 -2
  429. package/build/lib/tests/queryObserver.test.d.ts.map +0 -1
  430. package/build/lib/tests/utils.d.ts +0 -17
  431. package/build/lib/tests/utils.d.ts.map +0 -1
  432. package/build/lib/tests/utils.test.d.ts +0 -2
  433. package/build/lib/tests/utils.test.d.ts.map +0 -1
  434. package/build/lib/types.d.ts +0 -437
  435. package/build/lib/types.d.ts.map +0 -1
  436. package/build/lib/utils.cjs.map +0 -1
  437. package/build/lib/utils.d.ts +0 -90
  438. package/build/lib/utils.d.ts.map +0 -1
  439. package/build/lib/utils.js.map +0 -1
  440. package/build/lib/utils.legacy.cjs.map +0 -1
  441. package/build/lib/utils.legacy.js.map +0 -1
@@ -0,0 +1,484 @@
1
+ var __accessCheck = (obj, member, msg) => {
2
+ if (!member.has(obj))
3
+ throw TypeError("Cannot " + msg);
4
+ };
5
+ var __privateGet = (obj, member, getter) => {
6
+ __accessCheck(obj, member, "read from private field");
7
+ return getter ? getter.call(obj) : member.get(obj);
8
+ };
9
+ var __privateAdd = (obj, member, value) => {
10
+ if (member.has(obj))
11
+ throw TypeError("Cannot add the same private member more than once");
12
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
13
+ };
14
+ var __privateSet = (obj, member, value, setter) => {
15
+ __accessCheck(obj, member, "write to private field");
16
+ setter ? setter.call(obj, value) : member.set(obj, value);
17
+ return value;
18
+ };
19
+ var __privateMethod = (obj, member, method) => {
20
+ __accessCheck(obj, member, "access private method");
21
+ return method;
22
+ };
23
+ var _client, _currentQuery, _currentQueryInitialState, _currentResult, _currentResultState, _currentResultOptions, _selectError, _selectFn, _selectResult, _lastQueryWithDefinedData, _staleTimeoutId, _refetchIntervalId, _currentRefetchInterval, _trackedProps, _executeFetch, executeFetch_fn, _updateStaleTimeout, updateStaleTimeout_fn, _computeRefetchInterval, computeRefetchInterval_fn, _updateRefetchInterval, updateRefetchInterval_fn, _updateTimers, updateTimers_fn, _clearStaleTimeout, clearStaleTimeout_fn, _clearRefetchInterval, clearRefetchInterval_fn, _updateQuery, updateQuery_fn, _notify, notify_fn;
24
+ import {
25
+ isServer,
26
+ isValidTimeout,
27
+ noop,
28
+ replaceData,
29
+ shallowEqualObjects,
30
+ timeUntilStale
31
+ } from "./utils";
32
+ import { notifyManager } from "./notifyManager";
33
+ import { focusManager } from "./focusManager";
34
+ import { Subscribable } from "./subscribable";
35
+ import { canFetch } from "./retryer";
36
+ class QueryObserver extends Subscribable {
37
+ constructor(client, options) {
38
+ super();
39
+ __privateAdd(this, _executeFetch);
40
+ __privateAdd(this, _updateStaleTimeout);
41
+ __privateAdd(this, _computeRefetchInterval);
42
+ __privateAdd(this, _updateRefetchInterval);
43
+ __privateAdd(this, _updateTimers);
44
+ __privateAdd(this, _clearStaleTimeout);
45
+ __privateAdd(this, _clearRefetchInterval);
46
+ __privateAdd(this, _updateQuery);
47
+ __privateAdd(this, _notify);
48
+ __privateAdd(this, _client, void 0);
49
+ __privateAdd(this, _currentQuery, void 0);
50
+ __privateAdd(this, _currentQueryInitialState, void 0);
51
+ __privateAdd(this, _currentResult, void 0);
52
+ __privateAdd(this, _currentResultState, void 0);
53
+ __privateAdd(this, _currentResultOptions, void 0);
54
+ __privateAdd(this, _selectError, void 0);
55
+ __privateAdd(this, _selectFn, void 0);
56
+ __privateAdd(this, _selectResult, void 0);
57
+ // This property keeps track of the last query with defined data.
58
+ // It will be used to pass the previous data and query to the placeholder function between renders.
59
+ __privateAdd(this, _lastQueryWithDefinedData, void 0);
60
+ __privateAdd(this, _staleTimeoutId, void 0);
61
+ __privateAdd(this, _refetchIntervalId, void 0);
62
+ __privateAdd(this, _currentRefetchInterval, void 0);
63
+ __privateAdd(this, _trackedProps, /* @__PURE__ */ new Set());
64
+ __privateSet(this, _client, client);
65
+ this.options = options;
66
+ __privateSet(this, _selectError, null);
67
+ this.bindMethods();
68
+ this.setOptions(options);
69
+ }
70
+ bindMethods() {
71
+ this.refetch = this.refetch.bind(this);
72
+ }
73
+ onSubscribe() {
74
+ if (this.listeners.size === 1) {
75
+ __privateGet(this, _currentQuery).addObserver(this);
76
+ if (shouldFetchOnMount(__privateGet(this, _currentQuery), this.options)) {
77
+ __privateMethod(this, _executeFetch, executeFetch_fn).call(this);
78
+ }
79
+ __privateMethod(this, _updateTimers, updateTimers_fn).call(this);
80
+ }
81
+ }
82
+ onUnsubscribe() {
83
+ if (!this.hasListeners()) {
84
+ this.destroy();
85
+ }
86
+ }
87
+ shouldFetchOnReconnect() {
88
+ return shouldFetchOn(
89
+ __privateGet(this, _currentQuery),
90
+ this.options,
91
+ this.options.refetchOnReconnect
92
+ );
93
+ }
94
+ shouldFetchOnWindowFocus() {
95
+ return shouldFetchOn(
96
+ __privateGet(this, _currentQuery),
97
+ this.options,
98
+ this.options.refetchOnWindowFocus
99
+ );
100
+ }
101
+ destroy() {
102
+ this.listeners = /* @__PURE__ */ new Set();
103
+ __privateMethod(this, _clearStaleTimeout, clearStaleTimeout_fn).call(this);
104
+ __privateMethod(this, _clearRefetchInterval, clearRefetchInterval_fn).call(this);
105
+ __privateGet(this, _currentQuery).removeObserver(this);
106
+ }
107
+ setOptions(options, notifyOptions) {
108
+ const prevOptions = this.options;
109
+ const prevQuery = __privateGet(this, _currentQuery);
110
+ this.options = __privateGet(this, _client).defaultQueryOptions(options);
111
+ if (!shallowEqualObjects(prevOptions, this.options)) {
112
+ __privateGet(this, _client).getQueryCache().notify({
113
+ type: "observerOptionsUpdated",
114
+ query: __privateGet(this, _currentQuery),
115
+ observer: this
116
+ });
117
+ }
118
+ if (typeof this.options.enabled !== "undefined" && typeof this.options.enabled !== "boolean") {
119
+ throw new Error("Expected enabled to be a boolean");
120
+ }
121
+ if (!this.options.queryKey) {
122
+ this.options.queryKey = prevOptions.queryKey;
123
+ }
124
+ __privateMethod(this, _updateQuery, updateQuery_fn).call(this);
125
+ const mounted = this.hasListeners();
126
+ if (mounted && shouldFetchOptionally(
127
+ __privateGet(this, _currentQuery),
128
+ prevQuery,
129
+ this.options,
130
+ prevOptions
131
+ )) {
132
+ __privateMethod(this, _executeFetch, executeFetch_fn).call(this);
133
+ }
134
+ this.updateResult(notifyOptions);
135
+ if (mounted && (__privateGet(this, _currentQuery) !== prevQuery || this.options.enabled !== prevOptions.enabled || this.options.staleTime !== prevOptions.staleTime)) {
136
+ __privateMethod(this, _updateStaleTimeout, updateStaleTimeout_fn).call(this);
137
+ }
138
+ const nextRefetchInterval = __privateMethod(this, _computeRefetchInterval, computeRefetchInterval_fn).call(this);
139
+ if (mounted && (__privateGet(this, _currentQuery) !== prevQuery || this.options.enabled !== prevOptions.enabled || nextRefetchInterval !== __privateGet(this, _currentRefetchInterval))) {
140
+ __privateMethod(this, _updateRefetchInterval, updateRefetchInterval_fn).call(this, nextRefetchInterval);
141
+ }
142
+ }
143
+ getOptimisticResult(options) {
144
+ const query = __privateGet(this, _client).getQueryCache().build(__privateGet(this, _client), options);
145
+ const result = this.createResult(query, options);
146
+ if (shouldAssignObserverCurrentProperties(this, result)) {
147
+ __privateSet(this, _currentResult, result);
148
+ __privateSet(this, _currentResultOptions, this.options);
149
+ __privateSet(this, _currentResultState, __privateGet(this, _currentQuery).state);
150
+ }
151
+ return result;
152
+ }
153
+ getCurrentResult() {
154
+ return __privateGet(this, _currentResult);
155
+ }
156
+ trackResult(result) {
157
+ const trackedResult = {};
158
+ Object.keys(result).forEach((key) => {
159
+ Object.defineProperty(trackedResult, key, {
160
+ configurable: false,
161
+ enumerable: true,
162
+ get: () => {
163
+ __privateGet(this, _trackedProps).add(key);
164
+ return result[key];
165
+ }
166
+ });
167
+ });
168
+ return trackedResult;
169
+ }
170
+ getCurrentQuery() {
171
+ return __privateGet(this, _currentQuery);
172
+ }
173
+ refetch({ ...options } = {}) {
174
+ return this.fetch({
175
+ ...options
176
+ });
177
+ }
178
+ fetchOptimistic(options) {
179
+ const defaultedOptions = __privateGet(this, _client).defaultQueryOptions(options);
180
+ const query = __privateGet(this, _client).getQueryCache().build(__privateGet(this, _client), defaultedOptions);
181
+ query.isFetchingOptimistic = true;
182
+ return query.fetch().then(() => this.createResult(query, defaultedOptions));
183
+ }
184
+ fetch(fetchOptions) {
185
+ return __privateMethod(this, _executeFetch, executeFetch_fn).call(this, {
186
+ ...fetchOptions,
187
+ cancelRefetch: fetchOptions.cancelRefetch ?? true
188
+ }).then(() => {
189
+ this.updateResult();
190
+ return __privateGet(this, _currentResult);
191
+ });
192
+ }
193
+ createResult(query, options) {
194
+ var _a;
195
+ const prevQuery = __privateGet(this, _currentQuery);
196
+ const prevOptions = this.options;
197
+ const prevResult = __privateGet(this, _currentResult);
198
+ const prevResultState = __privateGet(this, _currentResultState);
199
+ const prevResultOptions = __privateGet(this, _currentResultOptions);
200
+ const queryChange = query !== prevQuery;
201
+ const queryInitialState = queryChange ? query.state : __privateGet(this, _currentQueryInitialState);
202
+ const { state } = query;
203
+ let { error, errorUpdatedAt, fetchStatus, status } = state;
204
+ let isPlaceholderData = false;
205
+ let data;
206
+ if (options._optimisticResults) {
207
+ const mounted = this.hasListeners();
208
+ const fetchOnMount = !mounted && shouldFetchOnMount(query, options);
209
+ const fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);
210
+ if (fetchOnMount || fetchOptionally) {
211
+ fetchStatus = canFetch(query.options.networkMode) ? "fetching" : "paused";
212
+ if (!state.dataUpdatedAt) {
213
+ status = "pending";
214
+ }
215
+ }
216
+ if (options._optimisticResults === "isRestoring") {
217
+ fetchStatus = "idle";
218
+ }
219
+ }
220
+ if (options.select && typeof state.data !== "undefined") {
221
+ if (prevResult && state.data === (prevResultState == null ? void 0 : prevResultState.data) && options.select === __privateGet(this, _selectFn)) {
222
+ data = __privateGet(this, _selectResult);
223
+ } else {
224
+ try {
225
+ __privateSet(this, _selectFn, options.select);
226
+ data = options.select(state.data);
227
+ data = replaceData(prevResult == null ? void 0 : prevResult.data, data, options);
228
+ __privateSet(this, _selectResult, data);
229
+ __privateSet(this, _selectError, null);
230
+ } catch (selectError) {
231
+ __privateSet(this, _selectError, selectError);
232
+ }
233
+ }
234
+ } else {
235
+ data = state.data;
236
+ }
237
+ if (typeof options.placeholderData !== "undefined" && typeof data === "undefined" && status === "pending") {
238
+ let placeholderData;
239
+ if ((prevResult == null ? void 0 : prevResult.isPlaceholderData) && options.placeholderData === (prevResultOptions == null ? void 0 : prevResultOptions.placeholderData)) {
240
+ placeholderData = prevResult.data;
241
+ } else {
242
+ placeholderData = typeof options.placeholderData === "function" ? options.placeholderData(
243
+ (_a = __privateGet(this, _lastQueryWithDefinedData)) == null ? void 0 : _a.state.data,
244
+ __privateGet(this, _lastQueryWithDefinedData)
245
+ ) : options.placeholderData;
246
+ if (options.select && typeof placeholderData !== "undefined") {
247
+ try {
248
+ placeholderData = options.select(placeholderData);
249
+ __privateSet(this, _selectError, null);
250
+ } catch (selectError) {
251
+ __privateSet(this, _selectError, selectError);
252
+ }
253
+ }
254
+ }
255
+ if (typeof placeholderData !== "undefined") {
256
+ status = "success";
257
+ data = replaceData(
258
+ prevResult == null ? void 0 : prevResult.data,
259
+ placeholderData,
260
+ options
261
+ );
262
+ isPlaceholderData = true;
263
+ }
264
+ }
265
+ if (__privateGet(this, _selectError)) {
266
+ error = __privateGet(this, _selectError);
267
+ data = __privateGet(this, _selectResult);
268
+ errorUpdatedAt = Date.now();
269
+ status = "error";
270
+ }
271
+ const isFetching = fetchStatus === "fetching";
272
+ const isPending = status === "pending";
273
+ const isError = status === "error";
274
+ const isLoading = isPending && isFetching;
275
+ const result = {
276
+ status,
277
+ fetchStatus,
278
+ isPending,
279
+ isSuccess: status === "success",
280
+ isError,
281
+ isInitialLoading: isLoading,
282
+ isLoading,
283
+ data,
284
+ dataUpdatedAt: state.dataUpdatedAt,
285
+ error,
286
+ errorUpdatedAt,
287
+ failureCount: state.fetchFailureCount,
288
+ failureReason: state.fetchFailureReason,
289
+ errorUpdateCount: state.errorUpdateCount,
290
+ isFetched: state.dataUpdateCount > 0 || state.errorUpdateCount > 0,
291
+ isFetchedAfterMount: state.dataUpdateCount > queryInitialState.dataUpdateCount || state.errorUpdateCount > queryInitialState.errorUpdateCount,
292
+ isFetching,
293
+ isRefetching: isFetching && !isPending,
294
+ isLoadingError: isError && state.dataUpdatedAt === 0,
295
+ isPaused: fetchStatus === "paused",
296
+ isPlaceholderData,
297
+ isRefetchError: isError && state.dataUpdatedAt !== 0,
298
+ isStale: isStale(query, options),
299
+ refetch: this.refetch
300
+ };
301
+ return result;
302
+ }
303
+ updateResult(notifyOptions) {
304
+ const prevResult = __privateGet(this, _currentResult);
305
+ const nextResult = this.createResult(__privateGet(this, _currentQuery), this.options);
306
+ __privateSet(this, _currentResultState, __privateGet(this, _currentQuery).state);
307
+ __privateSet(this, _currentResultOptions, this.options);
308
+ if (shallowEqualObjects(nextResult, prevResult)) {
309
+ return;
310
+ }
311
+ if (__privateGet(this, _currentResultState).data !== void 0) {
312
+ __privateSet(this, _lastQueryWithDefinedData, __privateGet(this, _currentQuery));
313
+ }
314
+ __privateSet(this, _currentResult, nextResult);
315
+ const defaultNotifyOptions = {};
316
+ const shouldNotifyListeners = () => {
317
+ if (!prevResult) {
318
+ return true;
319
+ }
320
+ const { notifyOnChangeProps } = this.options;
321
+ if (notifyOnChangeProps === "all" || !notifyOnChangeProps && !__privateGet(this, _trackedProps).size) {
322
+ return true;
323
+ }
324
+ const includedProps = new Set(notifyOnChangeProps ?? __privateGet(this, _trackedProps));
325
+ if (this.options.throwOnError) {
326
+ includedProps.add("error");
327
+ }
328
+ return Object.keys(__privateGet(this, _currentResult)).some((key) => {
329
+ const typedKey = key;
330
+ const changed = __privateGet(this, _currentResult)[typedKey] !== prevResult[typedKey];
331
+ return changed && includedProps.has(typedKey);
332
+ });
333
+ };
334
+ if ((notifyOptions == null ? void 0 : notifyOptions.listeners) !== false && shouldNotifyListeners()) {
335
+ defaultNotifyOptions.listeners = true;
336
+ }
337
+ __privateMethod(this, _notify, notify_fn).call(this, { ...defaultNotifyOptions, ...notifyOptions });
338
+ }
339
+ onQueryUpdate() {
340
+ this.updateResult();
341
+ if (this.hasListeners()) {
342
+ __privateMethod(this, _updateTimers, updateTimers_fn).call(this);
343
+ }
344
+ }
345
+ }
346
+ _client = new WeakMap();
347
+ _currentQuery = new WeakMap();
348
+ _currentQueryInitialState = new WeakMap();
349
+ _currentResult = new WeakMap();
350
+ _currentResultState = new WeakMap();
351
+ _currentResultOptions = new WeakMap();
352
+ _selectError = new WeakMap();
353
+ _selectFn = new WeakMap();
354
+ _selectResult = new WeakMap();
355
+ _lastQueryWithDefinedData = new WeakMap();
356
+ _staleTimeoutId = new WeakMap();
357
+ _refetchIntervalId = new WeakMap();
358
+ _currentRefetchInterval = new WeakMap();
359
+ _trackedProps = new WeakMap();
360
+ _executeFetch = new WeakSet();
361
+ executeFetch_fn = function(fetchOptions) {
362
+ __privateMethod(this, _updateQuery, updateQuery_fn).call(this);
363
+ let promise = __privateGet(this, _currentQuery).fetch(
364
+ this.options,
365
+ fetchOptions
366
+ );
367
+ if (!(fetchOptions == null ? void 0 : fetchOptions.throwOnError)) {
368
+ promise = promise.catch(noop);
369
+ }
370
+ return promise;
371
+ };
372
+ _updateStaleTimeout = new WeakSet();
373
+ updateStaleTimeout_fn = function() {
374
+ __privateMethod(this, _clearStaleTimeout, clearStaleTimeout_fn).call(this);
375
+ if (isServer || __privateGet(this, _currentResult).isStale || !isValidTimeout(this.options.staleTime)) {
376
+ return;
377
+ }
378
+ const time = timeUntilStale(
379
+ __privateGet(this, _currentResult).dataUpdatedAt,
380
+ this.options.staleTime
381
+ );
382
+ const timeout = time + 1;
383
+ __privateSet(this, _staleTimeoutId, setTimeout(() => {
384
+ if (!__privateGet(this, _currentResult).isStale) {
385
+ this.updateResult();
386
+ }
387
+ }, timeout));
388
+ };
389
+ _computeRefetchInterval = new WeakSet();
390
+ computeRefetchInterval_fn = function() {
391
+ return (typeof this.options.refetchInterval === "function" ? this.options.refetchInterval(
392
+ __privateGet(this, _currentResult).data,
393
+ __privateGet(this, _currentQuery)
394
+ ) : this.options.refetchInterval) ?? false;
395
+ };
396
+ _updateRefetchInterval = new WeakSet();
397
+ updateRefetchInterval_fn = function(nextInterval) {
398
+ __privateMethod(this, _clearRefetchInterval, clearRefetchInterval_fn).call(this);
399
+ __privateSet(this, _currentRefetchInterval, nextInterval);
400
+ if (isServer || this.options.enabled === false || !isValidTimeout(__privateGet(this, _currentRefetchInterval)) || __privateGet(this, _currentRefetchInterval) === 0) {
401
+ return;
402
+ }
403
+ __privateSet(this, _refetchIntervalId, setInterval(() => {
404
+ if (this.options.refetchIntervalInBackground || focusManager.isFocused()) {
405
+ __privateMethod(this, _executeFetch, executeFetch_fn).call(this);
406
+ }
407
+ }, __privateGet(this, _currentRefetchInterval)));
408
+ };
409
+ _updateTimers = new WeakSet();
410
+ updateTimers_fn = function() {
411
+ __privateMethod(this, _updateStaleTimeout, updateStaleTimeout_fn).call(this);
412
+ __privateMethod(this, _updateRefetchInterval, updateRefetchInterval_fn).call(this, __privateMethod(this, _computeRefetchInterval, computeRefetchInterval_fn).call(this));
413
+ };
414
+ _clearStaleTimeout = new WeakSet();
415
+ clearStaleTimeout_fn = function() {
416
+ if (__privateGet(this, _staleTimeoutId)) {
417
+ clearTimeout(__privateGet(this, _staleTimeoutId));
418
+ __privateSet(this, _staleTimeoutId, void 0);
419
+ }
420
+ };
421
+ _clearRefetchInterval = new WeakSet();
422
+ clearRefetchInterval_fn = function() {
423
+ if (__privateGet(this, _refetchIntervalId)) {
424
+ clearInterval(__privateGet(this, _refetchIntervalId));
425
+ __privateSet(this, _refetchIntervalId, void 0);
426
+ }
427
+ };
428
+ _updateQuery = new WeakSet();
429
+ updateQuery_fn = function() {
430
+ const query = __privateGet(this, _client).getQueryCache().build(__privateGet(this, _client), this.options);
431
+ if (query === __privateGet(this, _currentQuery)) {
432
+ return;
433
+ }
434
+ const prevQuery = __privateGet(this, _currentQuery);
435
+ __privateSet(this, _currentQuery, query);
436
+ __privateSet(this, _currentQueryInitialState, query.state);
437
+ if (this.hasListeners()) {
438
+ prevQuery == null ? void 0 : prevQuery.removeObserver(this);
439
+ query.addObserver(this);
440
+ }
441
+ };
442
+ _notify = new WeakSet();
443
+ notify_fn = function(notifyOptions) {
444
+ notifyManager.batch(() => {
445
+ if (notifyOptions.listeners) {
446
+ this.listeners.forEach((listener) => {
447
+ listener(__privateGet(this, _currentResult));
448
+ });
449
+ }
450
+ __privateGet(this, _client).getQueryCache().notify({
451
+ query: __privateGet(this, _currentQuery),
452
+ type: "observerResultsUpdated"
453
+ });
454
+ });
455
+ };
456
+ function shouldLoadOnMount(query, options) {
457
+ return options.enabled !== false && !query.state.dataUpdatedAt && !(query.state.status === "error" && options.retryOnMount === false);
458
+ }
459
+ function shouldFetchOnMount(query, options) {
460
+ return shouldLoadOnMount(query, options) || query.state.dataUpdatedAt > 0 && shouldFetchOn(query, options, options.refetchOnMount);
461
+ }
462
+ function shouldFetchOn(query, options, field) {
463
+ if (options.enabled !== false) {
464
+ const value = typeof field === "function" ? field(query) : field;
465
+ return value === "always" || value !== false && isStale(query, options);
466
+ }
467
+ return false;
468
+ }
469
+ function shouldFetchOptionally(query, prevQuery, options, prevOptions) {
470
+ return options.enabled !== false && (query !== prevQuery || prevOptions.enabled === false) && (!options.suspense || query.state.status !== "error") && isStale(query, options);
471
+ }
472
+ function isStale(query, options) {
473
+ return query.isStaleByTime(options.staleTime);
474
+ }
475
+ function shouldAssignObserverCurrentProperties(observer, optimisticResult) {
476
+ if (observer.getCurrentResult() !== optimisticResult) {
477
+ return true;
478
+ }
479
+ return false;
480
+ }
481
+ export {
482
+ QueryObserver
483
+ };
484
+ //# sourceMappingURL=queryObserver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/queryObserver.ts"],"sourcesContent":["import {\n isServer,\n isValidTimeout,\n noop,\n replaceData,\n shallowEqualObjects,\n timeUntilStale,\n} from './utils'\nimport { notifyManager } from './notifyManager'\nimport { focusManager } from './focusManager'\nimport { Subscribable } from './subscribable'\nimport { canFetch } from './retryer'\nimport type { QueryClient } from './queryClient'\nimport type { FetchOptions, Query, QueryState } from './query'\nimport type {\n DefaultError,\n DefaultedQueryObserverOptions,\n PlaceholderDataFunction,\n QueryKey,\n QueryObserverBaseResult,\n QueryObserverOptions,\n QueryObserverResult,\n QueryOptions,\n RefetchOptions,\n} from './types'\n\ntype QueryObserverListener<TData, TError> = (\n result: QueryObserverResult<TData, TError>,\n) => void\n\nexport interface NotifyOptions {\n listeners?: boolean\n}\n\nexport interface ObserverFetchOptions extends FetchOptions {\n throwOnError?: boolean\n}\n\nexport class QueryObserver<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> extends Subscribable<QueryObserverListener<TData, TError>> {\n options: QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >\n\n #client: QueryClient\n #currentQuery: Query<TQueryFnData, TError, TQueryData, TQueryKey> = undefined!\n #currentQueryInitialState: QueryState<TQueryData, TError> = undefined!\n #currentResult: QueryObserverResult<TData, TError> = undefined!\n #currentResultState?: QueryState<TQueryData, TError>\n #currentResultOptions?: QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >\n #selectError: TError | null\n #selectFn?: (data: TQueryData) => TData\n #selectResult?: TData\n // This property keeps track of the last query with defined data.\n // It will be used to pass the previous data and query to the placeholder function between renders.\n #lastQueryWithDefinedData?: Query<TQueryFnData, TError, TQueryData, TQueryKey>\n #staleTimeoutId?: ReturnType<typeof setTimeout>\n #refetchIntervalId?: ReturnType<typeof setInterval>\n #currentRefetchInterval?: number | false\n #trackedProps: Set<keyof QueryObserverResult> = new Set()\n\n constructor(\n client: QueryClient,\n options: QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n ) {\n super()\n\n this.#client = client\n this.options = options\n this.#selectError = null\n this.bindMethods()\n this.setOptions(options)\n }\n\n protected bindMethods(): void {\n this.refetch = this.refetch.bind(this)\n }\n\n protected onSubscribe(): void {\n if (this.listeners.size === 1) {\n this.#currentQuery.addObserver(this)\n\n if (shouldFetchOnMount(this.#currentQuery, this.options)) {\n this.#executeFetch()\n }\n\n this.#updateTimers()\n }\n }\n\n protected onUnsubscribe(): void {\n if (!this.hasListeners()) {\n this.destroy()\n }\n }\n\n shouldFetchOnReconnect(): boolean {\n return shouldFetchOn(\n this.#currentQuery,\n this.options,\n this.options.refetchOnReconnect,\n )\n }\n\n shouldFetchOnWindowFocus(): boolean {\n return shouldFetchOn(\n this.#currentQuery,\n this.options,\n this.options.refetchOnWindowFocus,\n )\n }\n\n destroy(): void {\n this.listeners = new Set()\n this.#clearStaleTimeout()\n this.#clearRefetchInterval()\n this.#currentQuery.removeObserver(this)\n }\n\n setOptions(\n options?: QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n notifyOptions?: NotifyOptions,\n ): void {\n const prevOptions = this.options\n const prevQuery = this.#currentQuery\n\n this.options = this.#client.defaultQueryOptions(options)\n\n if (!shallowEqualObjects(prevOptions, this.options)) {\n this.#client.getQueryCache().notify({\n type: 'observerOptionsUpdated',\n query: this.#currentQuery,\n observer: this,\n })\n }\n\n if (\n typeof this.options.enabled !== 'undefined' &&\n typeof this.options.enabled !== 'boolean'\n ) {\n throw new Error('Expected enabled to be a boolean')\n }\n\n // Keep previous query key if the user does not supply one\n if (!this.options.queryKey) {\n this.options.queryKey = prevOptions.queryKey\n }\n\n this.#updateQuery()\n\n const mounted = this.hasListeners()\n\n // Fetch if there are subscribers\n if (\n mounted &&\n shouldFetchOptionally(\n this.#currentQuery,\n prevQuery,\n this.options,\n prevOptions,\n )\n ) {\n this.#executeFetch()\n }\n\n // Update result\n this.updateResult(notifyOptions)\n\n // Update stale interval if needed\n if (\n mounted &&\n (this.#currentQuery !== prevQuery ||\n this.options.enabled !== prevOptions.enabled ||\n this.options.staleTime !== prevOptions.staleTime)\n ) {\n this.#updateStaleTimeout()\n }\n\n const nextRefetchInterval = this.#computeRefetchInterval()\n\n // Update refetch interval if needed\n if (\n mounted &&\n (this.#currentQuery !== prevQuery ||\n this.options.enabled !== prevOptions.enabled ||\n nextRefetchInterval !== this.#currentRefetchInterval)\n ) {\n this.#updateRefetchInterval(nextRefetchInterval)\n }\n }\n\n getOptimisticResult(\n options: DefaultedQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n ): QueryObserverResult<TData, TError> {\n const query = this.#client.getQueryCache().build(this.#client, options)\n\n const result = this.createResult(query, options)\n\n if (shouldAssignObserverCurrentProperties(this, result)) {\n // this assigns the optimistic result to the current Observer\n // because if the query function changes, useQuery will be performing\n // an effect where it would fetch again.\n // When the fetch finishes, we perform a deep data cloning in order\n // to reuse objects references. This deep data clone is performed against\n // the `observer.currentResult.data` property\n // When QueryKey changes, we refresh the query and get new `optimistic`\n // result, while we leave the `observer.currentResult`, so when new data\n // arrives, it finds the old `observer.currentResult` which is related\n // to the old QueryKey. Which means that currentResult and selectData are\n // out of sync already.\n // To solve this, we move the cursor of the currentResult everytime\n // an observer reads an optimistic value.\n\n // When keeping the previous data, the result doesn't change until new\n // data arrives.\n this.#currentResult = result\n this.#currentResultOptions = this.options\n this.#currentResultState = this.#currentQuery.state\n }\n return result\n }\n\n getCurrentResult(): QueryObserverResult<TData, TError> {\n return this.#currentResult\n }\n\n trackResult(\n result: QueryObserverResult<TData, TError>,\n ): QueryObserverResult<TData, TError> {\n const trackedResult = {} as QueryObserverResult<TData, TError>\n\n Object.keys(result).forEach((key) => {\n Object.defineProperty(trackedResult, key, {\n configurable: false,\n enumerable: true,\n get: () => {\n this.#trackedProps.add(key as keyof QueryObserverResult)\n return result[key as keyof QueryObserverResult]\n },\n })\n })\n\n return trackedResult\n }\n\n getCurrentQuery(): Query<TQueryFnData, TError, TQueryData, TQueryKey> {\n return this.#currentQuery\n }\n\n refetch({ ...options }: RefetchOptions = {}): Promise<\n QueryObserverResult<TData, TError>\n > {\n return this.fetch({\n ...options,\n })\n }\n\n fetchOptimistic(\n options: QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n ): Promise<QueryObserverResult<TData, TError>> {\n const defaultedOptions = this.#client.defaultQueryOptions(options)\n\n const query = this.#client\n .getQueryCache()\n .build(this.#client, defaultedOptions)\n query.isFetchingOptimistic = true\n\n return query.fetch().then(() => this.createResult(query, defaultedOptions))\n }\n\n protected fetch(\n fetchOptions: ObserverFetchOptions,\n ): Promise<QueryObserverResult<TData, TError>> {\n return this.#executeFetch({\n ...fetchOptions,\n cancelRefetch: fetchOptions.cancelRefetch ?? true,\n }).then(() => {\n this.updateResult()\n return this.#currentResult\n })\n }\n\n #executeFetch(\n fetchOptions?: ObserverFetchOptions,\n ): Promise<TQueryData | undefined> {\n // Make sure we reference the latest query as the current one might have been removed\n this.#updateQuery()\n\n // Fetch\n let promise: Promise<TQueryData | undefined> = this.#currentQuery.fetch(\n this.options as QueryOptions<TQueryFnData, TError, TQueryData, TQueryKey>,\n fetchOptions,\n )\n\n if (!fetchOptions?.throwOnError) {\n promise = promise.catch(noop)\n }\n\n return promise\n }\n\n #updateStaleTimeout(): void {\n this.#clearStaleTimeout()\n\n if (\n isServer ||\n this.#currentResult.isStale ||\n !isValidTimeout(this.options.staleTime)\n ) {\n return\n }\n\n const time = timeUntilStale(\n this.#currentResult.dataUpdatedAt,\n this.options.staleTime,\n )\n\n // The timeout is sometimes triggered 1 ms before the stale time expiration.\n // To mitigate this issue we always add 1 ms to the timeout.\n const timeout = time + 1\n\n this.#staleTimeoutId = setTimeout(() => {\n if (!this.#currentResult.isStale) {\n this.updateResult()\n }\n }, timeout)\n }\n\n #computeRefetchInterval() {\n return (\n (typeof this.options.refetchInterval === 'function'\n ? this.options.refetchInterval(\n this.#currentResult.data,\n this.#currentQuery,\n )\n : this.options.refetchInterval) ?? false\n )\n }\n\n #updateRefetchInterval(nextInterval: number | false): void {\n this.#clearRefetchInterval()\n\n this.#currentRefetchInterval = nextInterval\n\n if (\n isServer ||\n this.options.enabled === false ||\n !isValidTimeout(this.#currentRefetchInterval) ||\n this.#currentRefetchInterval === 0\n ) {\n return\n }\n\n this.#refetchIntervalId = setInterval(() => {\n if (\n this.options.refetchIntervalInBackground ||\n focusManager.isFocused()\n ) {\n this.#executeFetch()\n }\n }, this.#currentRefetchInterval)\n }\n\n #updateTimers(): void {\n this.#updateStaleTimeout()\n this.#updateRefetchInterval(this.#computeRefetchInterval())\n }\n\n #clearStaleTimeout(): void {\n if (this.#staleTimeoutId) {\n clearTimeout(this.#staleTimeoutId)\n this.#staleTimeoutId = undefined\n }\n }\n\n #clearRefetchInterval(): void {\n if (this.#refetchIntervalId) {\n clearInterval(this.#refetchIntervalId)\n this.#refetchIntervalId = undefined\n }\n }\n\n protected createResult(\n query: Query<TQueryFnData, TError, TQueryData, TQueryKey>,\n options: QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n ): QueryObserverResult<TData, TError> {\n const prevQuery = this.#currentQuery\n const prevOptions = this.options\n const prevResult = this.#currentResult as\n | QueryObserverResult<TData, TError>\n | undefined\n const prevResultState = this.#currentResultState\n const prevResultOptions = this.#currentResultOptions\n const queryChange = query !== prevQuery\n const queryInitialState = queryChange\n ? query.state\n : this.#currentQueryInitialState\n\n const { state } = query\n let { error, errorUpdatedAt, fetchStatus, status } = state\n let isPlaceholderData = false\n let data: TData | undefined\n\n // Optimistically set result in fetching state if needed\n if (options._optimisticResults) {\n const mounted = this.hasListeners()\n\n const fetchOnMount = !mounted && shouldFetchOnMount(query, options)\n\n const fetchOptionally =\n mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions)\n\n if (fetchOnMount || fetchOptionally) {\n fetchStatus = canFetch(query.options.networkMode)\n ? 'fetching'\n : 'paused'\n if (!state.dataUpdatedAt) {\n status = 'pending'\n }\n }\n if (options._optimisticResults === 'isRestoring') {\n fetchStatus = 'idle'\n }\n }\n\n // Select data if needed\n if (options.select && typeof state.data !== 'undefined') {\n // Memoize select result\n if (\n prevResult &&\n state.data === prevResultState?.data &&\n options.select === this.#selectFn\n ) {\n data = this.#selectResult\n } else {\n try {\n this.#selectFn = options.select\n data = options.select(state.data)\n data = replaceData(prevResult?.data, data, options)\n this.#selectResult = data\n this.#selectError = null\n } catch (selectError) {\n this.#selectError = selectError as TError\n }\n }\n }\n // Use query data\n else {\n data = state.data as unknown as TData\n }\n\n // Show placeholder data if needed\n if (\n typeof options.placeholderData !== 'undefined' &&\n typeof data === 'undefined' &&\n status === 'pending'\n ) {\n let placeholderData\n\n // Memoize placeholder data\n if (\n prevResult?.isPlaceholderData &&\n options.placeholderData === prevResultOptions?.placeholderData\n ) {\n placeholderData = prevResult.data\n } else {\n placeholderData =\n typeof options.placeholderData === 'function'\n ? (\n options.placeholderData as unknown as PlaceholderDataFunction<TQueryData>\n )(\n this.#lastQueryWithDefinedData?.state.data,\n this.#lastQueryWithDefinedData as any,\n )\n : options.placeholderData\n if (options.select && typeof placeholderData !== 'undefined') {\n try {\n placeholderData = options.select(placeholderData)\n this.#selectError = null\n } catch (selectError) {\n this.#selectError = selectError as TError\n }\n }\n }\n\n if (typeof placeholderData !== 'undefined') {\n status = 'success'\n data = replaceData(\n prevResult?.data,\n placeholderData as unknown,\n options,\n ) as TData\n isPlaceholderData = true\n }\n }\n\n if (this.#selectError) {\n error = this.#selectError as any\n data = this.#selectResult\n errorUpdatedAt = Date.now()\n status = 'error'\n }\n\n const isFetching = fetchStatus === 'fetching'\n const isPending = status === 'pending'\n const isError = status === 'error'\n\n const isLoading = isPending && isFetching\n\n const result: QueryObserverBaseResult<TData, TError> = {\n status,\n fetchStatus,\n isPending,\n isSuccess: status === 'success',\n isError,\n isInitialLoading: isLoading,\n isLoading,\n data,\n dataUpdatedAt: state.dataUpdatedAt,\n error,\n errorUpdatedAt,\n failureCount: state.fetchFailureCount,\n failureReason: state.fetchFailureReason,\n errorUpdateCount: state.errorUpdateCount,\n isFetched: state.dataUpdateCount > 0 || state.errorUpdateCount > 0,\n isFetchedAfterMount:\n state.dataUpdateCount > queryInitialState.dataUpdateCount ||\n state.errorUpdateCount > queryInitialState.errorUpdateCount,\n isFetching,\n isRefetching: isFetching && !isPending,\n isLoadingError: isError && state.dataUpdatedAt === 0,\n isPaused: fetchStatus === 'paused',\n isPlaceholderData,\n isRefetchError: isError && state.dataUpdatedAt !== 0,\n isStale: isStale(query, options),\n refetch: this.refetch,\n }\n\n return result as QueryObserverResult<TData, TError>\n }\n\n updateResult(notifyOptions?: NotifyOptions): void {\n const prevResult = this.#currentResult as\n | QueryObserverResult<TData, TError>\n | undefined\n\n const nextResult = this.createResult(this.#currentQuery, this.options)\n this.#currentResultState = this.#currentQuery.state\n this.#currentResultOptions = this.options\n\n // Only notify and update result if something has changed\n if (shallowEqualObjects(nextResult, prevResult)) {\n return\n }\n\n if (this.#currentResultState.data !== undefined) {\n this.#lastQueryWithDefinedData = this.#currentQuery\n }\n this.#currentResult = nextResult\n\n // Determine which callbacks to trigger\n const defaultNotifyOptions: NotifyOptions = {}\n\n const shouldNotifyListeners = (): boolean => {\n if (!prevResult) {\n return true\n }\n\n const { notifyOnChangeProps } = this.options\n\n if (\n notifyOnChangeProps === 'all' ||\n (!notifyOnChangeProps && !this.#trackedProps.size)\n ) {\n return true\n }\n\n const includedProps = new Set(notifyOnChangeProps ?? this.#trackedProps)\n\n if (this.options.throwOnError) {\n includedProps.add('error')\n }\n\n return Object.keys(this.#currentResult).some((key) => {\n const typedKey = key as keyof QueryObserverResult\n const changed = this.#currentResult[typedKey] !== prevResult[typedKey]\n return changed && includedProps.has(typedKey)\n })\n }\n\n if (notifyOptions?.listeners !== false && shouldNotifyListeners()) {\n defaultNotifyOptions.listeners = true\n }\n\n this.#notify({ ...defaultNotifyOptions, ...notifyOptions })\n }\n\n #updateQuery(): void {\n const query = this.#client.getQueryCache().build(this.#client, this.options)\n\n if (query === this.#currentQuery) {\n return\n }\n\n const prevQuery = this.#currentQuery as\n | Query<TQueryFnData, TError, TQueryData, TQueryKey>\n | undefined\n this.#currentQuery = query\n this.#currentQueryInitialState = query.state\n\n if (this.hasListeners()) {\n prevQuery?.removeObserver(this)\n query.addObserver(this)\n }\n }\n\n onQueryUpdate(): void {\n this.updateResult()\n\n if (this.hasListeners()) {\n this.#updateTimers()\n }\n }\n\n #notify(notifyOptions: NotifyOptions): void {\n notifyManager.batch(() => {\n // First, trigger the listeners\n if (notifyOptions.listeners) {\n this.listeners.forEach((listener) => {\n listener(this.#currentResult)\n })\n }\n\n // Then the cache listeners\n this.#client.getQueryCache().notify({\n query: this.#currentQuery,\n type: 'observerResultsUpdated',\n })\n })\n }\n}\n\nfunction shouldLoadOnMount(\n query: Query<any, any, any, any>,\n options: QueryObserverOptions<any, any, any, any>,\n): boolean {\n return (\n options.enabled !== false &&\n !query.state.dataUpdatedAt &&\n !(query.state.status === 'error' && options.retryOnMount === false)\n )\n}\n\nfunction shouldFetchOnMount(\n query: Query<any, any, any, any>,\n options: QueryObserverOptions<any, any, any, any, any>,\n): boolean {\n return (\n shouldLoadOnMount(query, options) ||\n (query.state.dataUpdatedAt > 0 &&\n shouldFetchOn(query, options, options.refetchOnMount))\n )\n}\n\nfunction shouldFetchOn(\n query: Query<any, any, any, any>,\n options: QueryObserverOptions<any, any, any, any, any>,\n field: (typeof options)['refetchOnMount'] &\n (typeof options)['refetchOnWindowFocus'] &\n (typeof options)['refetchOnReconnect'],\n) {\n if (options.enabled !== false) {\n const value = typeof field === 'function' ? field(query) : field\n\n return value === 'always' || (value !== false && isStale(query, options))\n }\n return false\n}\n\nfunction shouldFetchOptionally(\n query: Query<any, any, any, any>,\n prevQuery: Query<any, any, any, any>,\n options: QueryObserverOptions<any, any, any, any, any>,\n prevOptions: QueryObserverOptions<any, any, any, any, any>,\n): boolean {\n return (\n options.enabled !== false &&\n (query !== prevQuery || prevOptions.enabled === false) &&\n (!options.suspense || query.state.status !== 'error') &&\n isStale(query, options)\n )\n}\n\nfunction isStale(\n query: Query<any, any, any, any>,\n options: QueryObserverOptions<any, any, any, any, any>,\n): boolean {\n return query.isStaleByTime(options.staleTime)\n}\n\n// this function would decide if we will update the observer's 'current'\n// properties after an optimistic reading via getOptimisticResult\nfunction shouldAssignObserverCurrentProperties<\n TQueryFnData = unknown,\n TError = unknown,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n observer: QueryObserver<TQueryFnData, TError, TData, TQueryData, TQueryKey>,\n optimisticResult: QueryObserverResult<TData, TError>,\n) {\n // if the newly created result isn't what the observer is holding as current,\n // then we'll need to update the properties as well\n if (observer.getCurrentResult() !== optimisticResult) {\n return true\n }\n\n // basically, just keep previous properties if nothing changed\n return false\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB;AA2BlB,MAAM,sBAMH,aAAmD;AAAA,EAgC3D,YACE,QACA,SAOA;AACA,UAAM;AA2OR;AAmBA;AA2BA;AAWA;AAwBA;AAKA;AAOA;AA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AAM,WAAW,YAC7C,QAAQ,OAAO,OAAO;AAE1B;AAEA,SAAS,QACP,OACA,SACS;AACT,SAAO,MAAM,cAAc,QAAQ,SAAS;AAC9C;AAIA,SAAS,sCAOP,UACA,kBACA;AAGA,MAAI,SAAS,iBAAiB,MAAM,kBAAkB;AACpD,WAAO;AAAA,EACT;AAGA,SAAO;AACT;","names":[]}
@@ -0,0 +1,77 @@
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 __accessCheck = (obj, member, msg) => {
20
+ if (!member.has(obj))
21
+ throw TypeError("Cannot " + msg);
22
+ };
23
+ var __privateGet = (obj, member, getter) => {
24
+ __accessCheck(obj, member, "read from private field");
25
+ return getter ? getter.call(obj) : member.get(obj);
26
+ };
27
+ var __privateAdd = (obj, member, value) => {
28
+ if (member.has(obj))
29
+ throw TypeError("Cannot add the same private member more than once");
30
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
31
+ };
32
+ var __privateSet = (obj, member, value, setter) => {
33
+ __accessCheck(obj, member, "write to private field");
34
+ setter ? setter.call(obj, value) : member.set(obj, value);
35
+ return value;
36
+ };
37
+ var removable_exports = {};
38
+ __export(removable_exports, {
39
+ Removable: () => Removable
40
+ });
41
+ module.exports = __toCommonJS(removable_exports);
42
+ var import_utils = require("./utils");
43
+ var _gcTimeout;
44
+ class Removable {
45
+ constructor() {
46
+ __privateAdd(this, _gcTimeout, void 0);
47
+ }
48
+ destroy() {
49
+ this.clearGcTimeout();
50
+ }
51
+ scheduleGc() {
52
+ this.clearGcTimeout();
53
+ if ((0, import_utils.isValidTimeout)(this.gcTime)) {
54
+ __privateSet(this, _gcTimeout, setTimeout(() => {
55
+ this.optionalRemove();
56
+ }, this.gcTime));
57
+ }
58
+ }
59
+ updateGcTime(newGcTime) {
60
+ this.gcTime = Math.max(
61
+ this.gcTime || 0,
62
+ newGcTime ?? (import_utils.isServer ? Infinity : 5 * 60 * 1e3)
63
+ );
64
+ }
65
+ clearGcTimeout() {
66
+ if (__privateGet(this, _gcTimeout)) {
67
+ clearTimeout(__privateGet(this, _gcTimeout));
68
+ __privateSet(this, _gcTimeout, void 0);
69
+ }
70
+ }
71
+ }
72
+ _gcTimeout = new WeakMap();
73
+ // Annotate the CommonJS export names for ESM import in node:
74
+ 0 && (module.exports = {
75
+ Removable
76
+ });
77
+ //# sourceMappingURL=removable.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/removable.ts"],"sourcesContent":["import { isServer, isValidTimeout } from './utils'\n\nexport abstract class Removable {\n gcTime!: number\n #gcTimeout?: ReturnType<typeof setTimeout>\n\n destroy(): void {\n this.clearGcTimeout()\n }\n\n protected scheduleGc(): void {\n this.clearGcTimeout()\n\n if (isValidTimeout(this.gcTime)) {\n this.#gcTimeout = setTimeout(() => {\n this.optionalRemove()\n }, this.gcTime)\n }\n }\n\n protected updateGcTime(newGcTime: number | undefined): void {\n // Default to 5 minutes (Infinity for server-side) if no gcTime is set\n this.gcTime = Math.max(\n this.gcTime || 0,\n newGcTime ?? (isServer ? Infinity : 5 * 60 * 1000),\n )\n }\n\n protected clearGcTimeout() {\n if (this.#gcTimeout) {\n clearTimeout(this.#gcTimeout)\n this.#gcTimeout = undefined\n }\n }\n\n protected abstract optionalRemove(): void\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAyC;AAAzC;AAEO,MAAe,UAAU;AAAA,EAAzB;AAEL;AAAA;AAAA,EAEA,UAAgB;AACd,SAAK,eAAe;AAAA,EACtB;AAAA,EAEU,aAAmB;AAC3B,SAAK,eAAe;AAEpB,YAAI,6BAAe,KAAK,MAAM,GAAG;AAC/B,yBAAK,YAAa,WAAW,MAAM;AACjC,aAAK,eAAe;AAAA,MACtB,GAAG,KAAK,MAAM;AAAA,IAChB;AAAA,EACF;AAAA,EAEU,aAAa,WAAqC;AAE1D,SAAK,SAAS,KAAK;AAAA,MACjB,KAAK,UAAU;AAAA,MACf,cAAc,wBAAW,WAAW,IAAI,KAAK;AAAA,IAC/C;AAAA,EACF;AAAA,EAEU,iBAAiB;AACzB,QAAI,mBAAK,aAAY;AACnB,mBAAa,mBAAK,WAAU;AAC5B,yBAAK,YAAa;AAAA,IACpB;AAAA,EACF;AAGF;AAhCE;","names":[]}
@@ -0,0 +1,11 @@
1
+ declare abstract class Removable {
2
+ #private;
3
+ gcTime: number;
4
+ destroy(): void;
5
+ protected scheduleGc(): void;
6
+ protected updateGcTime(newGcTime: number | undefined): void;
7
+ protected clearGcTimeout(): void;
8
+ protected abstract optionalRemove(): void;
9
+ }
10
+
11
+ export { Removable };
@@ -1,4 +1,4 @@
1
- export declare abstract class Removable {
1
+ declare abstract class Removable {
2
2
  #private;
3
3
  gcTime: number;
4
4
  destroy(): void;
@@ -7,4 +7,5 @@ export declare abstract class Removable {
7
7
  protected clearGcTimeout(): void;
8
8
  protected abstract optionalRemove(): void;
9
9
  }
10
- //# sourceMappingURL=removable.d.ts.map
10
+
11
+ export { Removable };