@tanstack/vue-query 5.102.8 → 5.103.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (329) hide show
  1. package/build/legacy/devtools/devtools.d.cts +1 -1
  2. package/build/legacy/devtools/devtools.d.ts +1 -1
  3. package/build/legacy/index.d.cts +8 -6
  4. package/build/legacy/index.d.ts +8 -6
  5. package/build/legacy/infiniteQueryOptions-CEDiLwh5.d.ts +365 -0
  6. package/build/legacy/infiniteQueryOptions-CEDiLwh5.d.ts.map +1 -0
  7. package/build/legacy/infiniteQueryOptions-qN6sOJM-.d.cts +365 -0
  8. package/build/legacy/infiniteQueryOptions-qN6sOJM-.d.cts.map +1 -0
  9. package/build/legacy/infiniteQueryOptions.cjs.map +1 -1
  10. package/build/legacy/infiniteQueryOptions.d.cts +1 -1
  11. package/build/legacy/infiniteQueryOptions.d.ts +1 -1
  12. package/build/legacy/infiniteQueryOptions.js.map +1 -1
  13. package/build/legacy/mutationCache.cjs +5 -0
  14. package/build/legacy/mutationCache.cjs.map +1 -1
  15. package/build/legacy/mutationCache.d.cts +6 -1
  16. package/build/legacy/mutationCache.d.cts.map +1 -1
  17. package/build/legacy/mutationCache.d.ts +6 -1
  18. package/build/legacy/mutationCache.d.ts.map +1 -1
  19. package/build/legacy/mutationCache.js +5 -0
  20. package/build/legacy/mutationCache.js.map +1 -1
  21. package/build/legacy/mutationOptions.cjs.map +1 -1
  22. package/build/legacy/mutationOptions.d.cts +121 -1
  23. package/build/legacy/mutationOptions.d.cts.map +1 -1
  24. package/build/legacy/mutationOptions.d.ts +121 -1
  25. package/build/legacy/mutationOptions.d.ts.map +1 -1
  26. package/build/legacy/mutationOptions.js.map +1 -1
  27. package/build/legacy/queryCache.cjs +5 -0
  28. package/build/legacy/queryCache.cjs.map +1 -1
  29. package/build/legacy/queryCache.d.cts +6 -1
  30. package/build/legacy/queryCache.d.cts.map +1 -1
  31. package/build/legacy/queryCache.d.ts +6 -1
  32. package/build/legacy/queryCache.d.ts.map +1 -1
  33. package/build/legacy/queryCache.js +5 -0
  34. package/build/legacy/queryCache.js.map +1 -1
  35. package/build/legacy/queryClient-CZeNAt68.d.cts +71 -0
  36. package/build/legacy/queryClient-CZeNAt68.d.cts.map +1 -0
  37. package/build/legacy/queryClient-Cv73nzNT.d.ts +71 -0
  38. package/build/legacy/queryClient-Cv73nzNT.d.ts.map +1 -0
  39. package/build/legacy/queryClient.cjs +7 -0
  40. package/build/legacy/queryClient.cjs.map +1 -1
  41. package/build/legacy/queryClient.d.cts +1 -1
  42. package/build/legacy/queryClient.d.ts +1 -1
  43. package/build/legacy/queryClient.js +7 -0
  44. package/build/legacy/queryClient.js.map +1 -1
  45. package/build/legacy/queryOptions-DPDwdVBu.d.ts +227 -0
  46. package/build/legacy/queryOptions-DPDwdVBu.d.ts.map +1 -0
  47. package/build/legacy/queryOptions-rkZ3sk6g.d.cts +227 -0
  48. package/build/legacy/queryOptions-rkZ3sk6g.d.cts.map +1 -0
  49. package/build/legacy/queryOptions.cjs.map +1 -1
  50. package/build/legacy/queryOptions.d.cts +2 -19
  51. package/build/legacy/queryOptions.d.ts +2 -19
  52. package/build/legacy/queryOptions.js.map +1 -1
  53. package/build/{modern/types-BzZi3_rS.d.cts → legacy/types-JpJB72CS.d.cts} +19 -1
  54. package/build/legacy/types-JpJB72CS.d.cts.map +1 -0
  55. package/build/legacy/{types-BzZi3_rS.d.cts → types-JpJB72CS.d.ts} +19 -1
  56. package/build/legacy/types-JpJB72CS.d.ts.map +1 -0
  57. package/build/legacy/types.d.cts +1 -1
  58. package/build/legacy/types.d.ts +1 -1
  59. package/build/legacy/useBaseQuery.cjs +8 -0
  60. package/build/legacy/useBaseQuery.cjs.map +1 -1
  61. package/build/legacy/useBaseQuery.d.cts +1 -1
  62. package/build/legacy/useBaseQuery.d.ts +1 -1
  63. package/build/legacy/useBaseQuery.js +8 -0
  64. package/build/legacy/useBaseQuery.js.map +1 -1
  65. package/build/legacy/useInfiniteQuery.cjs.map +1 -1
  66. package/build/legacy/useInfiniteQuery.d.cts +1 -1
  67. package/build/legacy/useInfiniteQuery.d.ts +1 -1
  68. package/build/legacy/useInfiniteQuery.js.map +1 -1
  69. package/build/legacy/useIsFetching.cjs +41 -0
  70. package/build/legacy/useIsFetching.cjs.map +1 -1
  71. package/build/legacy/useIsFetching.d.cts +47 -6
  72. package/build/legacy/useIsFetching.d.cts.map +1 -1
  73. package/build/legacy/useIsFetching.d.ts +47 -6
  74. package/build/legacy/useIsFetching.d.ts.map +1 -1
  75. package/build/legacy/useIsFetching.js +41 -0
  76. package/build/legacy/useIsFetching.js.map +1 -1
  77. package/build/legacy/useMutation.cjs +170 -9
  78. package/build/legacy/useMutation.cjs.map +1 -1
  79. package/build/legacy/useMutation.d.cts +164 -3
  80. package/build/legacy/useMutation.d.cts.map +1 -1
  81. package/build/legacy/useMutation.d.ts +164 -3
  82. package/build/legacy/useMutation.d.ts.map +1 -1
  83. package/build/legacy/useMutation.js +170 -9
  84. package/build/legacy/useMutation.js.map +1 -1
  85. package/build/legacy/useMutationState.cjs +103 -0
  86. package/build/legacy/useMutationState.cjs.map +1 -1
  87. package/build/legacy/useMutationState.d.cts +111 -7
  88. package/build/legacy/useMutationState.d.cts.map +1 -1
  89. package/build/legacy/useMutationState.d.ts +111 -7
  90. package/build/legacy/useMutationState.d.ts.map +1 -1
  91. package/build/legacy/useMutationState.js +103 -0
  92. package/build/legacy/useMutationState.js.map +1 -1
  93. package/build/legacy/usePrefetchInfiniteQuery.cjs +46 -0
  94. package/build/legacy/usePrefetchInfiniteQuery.cjs.map +1 -1
  95. package/build/legacy/usePrefetchInfiniteQuery.d.cts +48 -2
  96. package/build/legacy/usePrefetchInfiniteQuery.d.cts.map +1 -1
  97. package/build/legacy/usePrefetchInfiniteQuery.d.ts +48 -2
  98. package/build/legacy/usePrefetchInfiniteQuery.d.ts.map +1 -1
  99. package/build/legacy/usePrefetchInfiniteQuery.js +46 -0
  100. package/build/legacy/usePrefetchInfiniteQuery.js.map +1 -1
  101. package/build/legacy/usePrefetchQuery.cjs +37 -0
  102. package/build/legacy/usePrefetchQuery.cjs.map +1 -1
  103. package/build/legacy/usePrefetchQuery.d.cts +39 -2
  104. package/build/legacy/usePrefetchQuery.d.cts.map +1 -1
  105. package/build/legacy/usePrefetchQuery.d.ts +39 -2
  106. package/build/legacy/usePrefetchQuery.d.ts.map +1 -1
  107. package/build/legacy/usePrefetchQuery.js +37 -0
  108. package/build/legacy/usePrefetchQuery.js.map +1 -1
  109. package/build/legacy/useQueries.cjs +123 -0
  110. package/build/legacy/useQueries.cjs.map +1 -1
  111. package/build/legacy/useQueries.d.cts +126 -2
  112. package/build/legacy/useQueries.d.cts.map +1 -1
  113. package/build/legacy/useQueries.d.ts +126 -2
  114. package/build/legacy/useQueries.d.ts.map +1 -1
  115. package/build/legacy/useQueries.js +123 -0
  116. package/build/legacy/useQueries.js.map +1 -1
  117. package/build/legacy/useQuery.cjs.map +1 -1
  118. package/build/legacy/useQuery.d.cts +248 -2
  119. package/build/legacy/useQuery.d.cts.map +1 -0
  120. package/build/legacy/useQuery.d.ts +248 -2
  121. package/build/legacy/useQuery.d.ts.map +1 -0
  122. package/build/legacy/useQuery.js.map +1 -1
  123. package/build/legacy/useQueryClient.cjs +21 -0
  124. package/build/legacy/useQueryClient.cjs.map +1 -1
  125. package/build/legacy/useQueryClient.d.cts +22 -1
  126. package/build/legacy/useQueryClient.d.cts.map +1 -1
  127. package/build/legacy/useQueryClient.d.ts +22 -1
  128. package/build/legacy/useQueryClient.d.ts.map +1 -1
  129. package/build/legacy/useQueryClient.js +21 -0
  130. package/build/legacy/useQueryClient.js.map +1 -1
  131. package/build/legacy/utils.cjs +15 -0
  132. package/build/legacy/utils.cjs.map +1 -1
  133. package/build/legacy/utils.d.cts +16 -1
  134. package/build/legacy/utils.d.cts.map +1 -1
  135. package/build/legacy/utils.d.ts +16 -1
  136. package/build/legacy/utils.d.ts.map +1 -1
  137. package/build/legacy/utils.js +15 -0
  138. package/build/legacy/utils.js.map +1 -1
  139. package/build/legacy/vueQueryPlugin.cjs +34 -0
  140. package/build/legacy/vueQueryPlugin.cjs.map +1 -1
  141. package/build/legacy/vueQueryPlugin.d.cts +48 -2
  142. package/build/legacy/vueQueryPlugin.d.cts.map +1 -1
  143. package/build/legacy/vueQueryPlugin.d.ts +48 -2
  144. package/build/legacy/vueQueryPlugin.d.ts.map +1 -1
  145. package/build/legacy/vueQueryPlugin.js +34 -0
  146. package/build/legacy/vueQueryPlugin.js.map +1 -1
  147. package/build/modern/devtools/devtools.d.cts +1 -1
  148. package/build/modern/devtools/devtools.d.ts +1 -1
  149. package/build/modern/index.d.cts +8 -6
  150. package/build/modern/index.d.ts +8 -6
  151. package/build/modern/infiniteQueryOptions-CEDiLwh5.d.ts +365 -0
  152. package/build/modern/infiniteQueryOptions-CEDiLwh5.d.ts.map +1 -0
  153. package/build/modern/infiniteQueryOptions-qN6sOJM-.d.cts +365 -0
  154. package/build/modern/infiniteQueryOptions-qN6sOJM-.d.cts.map +1 -0
  155. package/build/modern/infiniteQueryOptions.cjs.map +1 -1
  156. package/build/modern/infiniteQueryOptions.d.cts +1 -1
  157. package/build/modern/infiniteQueryOptions.d.ts +1 -1
  158. package/build/modern/infiniteQueryOptions.js.map +1 -1
  159. package/build/modern/mutationCache.cjs +5 -0
  160. package/build/modern/mutationCache.cjs.map +1 -1
  161. package/build/modern/mutationCache.d.cts +6 -1
  162. package/build/modern/mutationCache.d.cts.map +1 -1
  163. package/build/modern/mutationCache.d.ts +6 -1
  164. package/build/modern/mutationCache.d.ts.map +1 -1
  165. package/build/modern/mutationCache.js +5 -0
  166. package/build/modern/mutationCache.js.map +1 -1
  167. package/build/modern/mutationOptions.cjs.map +1 -1
  168. package/build/modern/mutationOptions.d.cts +121 -1
  169. package/build/modern/mutationOptions.d.cts.map +1 -1
  170. package/build/modern/mutationOptions.d.ts +121 -1
  171. package/build/modern/mutationOptions.d.ts.map +1 -1
  172. package/build/modern/mutationOptions.js.map +1 -1
  173. package/build/modern/queryCache.cjs +5 -0
  174. package/build/modern/queryCache.cjs.map +1 -1
  175. package/build/modern/queryCache.d.cts +6 -1
  176. package/build/modern/queryCache.d.cts.map +1 -1
  177. package/build/modern/queryCache.d.ts +6 -1
  178. package/build/modern/queryCache.d.ts.map +1 -1
  179. package/build/modern/queryCache.js +5 -0
  180. package/build/modern/queryCache.js.map +1 -1
  181. package/build/modern/queryClient-CZeNAt68.d.cts +71 -0
  182. package/build/modern/queryClient-CZeNAt68.d.cts.map +1 -0
  183. package/build/modern/queryClient-Cv73nzNT.d.ts +71 -0
  184. package/build/modern/queryClient-Cv73nzNT.d.ts.map +1 -0
  185. package/build/modern/queryClient.cjs +7 -0
  186. package/build/modern/queryClient.cjs.map +1 -1
  187. package/build/modern/queryClient.d.cts +1 -1
  188. package/build/modern/queryClient.d.ts +1 -1
  189. package/build/modern/queryClient.js +7 -0
  190. package/build/modern/queryClient.js.map +1 -1
  191. package/build/modern/queryOptions-DPDwdVBu.d.ts +227 -0
  192. package/build/modern/queryOptions-DPDwdVBu.d.ts.map +1 -0
  193. package/build/modern/queryOptions-rkZ3sk6g.d.cts +227 -0
  194. package/build/modern/queryOptions-rkZ3sk6g.d.cts.map +1 -0
  195. package/build/modern/queryOptions.cjs.map +1 -1
  196. package/build/modern/queryOptions.d.cts +2 -19
  197. package/build/modern/queryOptions.d.ts +2 -19
  198. package/build/modern/queryOptions.js.map +1 -1
  199. package/build/modern/{types-BzZi3_rS.d.ts → types-JpJB72CS.d.cts} +19 -1
  200. package/build/modern/types-JpJB72CS.d.cts.map +1 -0
  201. package/build/{legacy/types-BzZi3_rS.d.ts → modern/types-JpJB72CS.d.ts} +19 -1
  202. package/build/modern/types-JpJB72CS.d.ts.map +1 -0
  203. package/build/modern/types.d.cts +1 -1
  204. package/build/modern/types.d.ts +1 -1
  205. package/build/modern/useBaseQuery.cjs +8 -0
  206. package/build/modern/useBaseQuery.cjs.map +1 -1
  207. package/build/modern/useBaseQuery.d.cts +1 -1
  208. package/build/modern/useBaseQuery.d.ts +1 -1
  209. package/build/modern/useBaseQuery.js +8 -0
  210. package/build/modern/useBaseQuery.js.map +1 -1
  211. package/build/modern/useInfiniteQuery.cjs.map +1 -1
  212. package/build/modern/useInfiniteQuery.d.cts +1 -1
  213. package/build/modern/useInfiniteQuery.d.ts +1 -1
  214. package/build/modern/useInfiniteQuery.js.map +1 -1
  215. package/build/modern/useIsFetching.cjs +41 -0
  216. package/build/modern/useIsFetching.cjs.map +1 -1
  217. package/build/modern/useIsFetching.d.cts +47 -6
  218. package/build/modern/useIsFetching.d.cts.map +1 -1
  219. package/build/modern/useIsFetching.d.ts +47 -6
  220. package/build/modern/useIsFetching.d.ts.map +1 -1
  221. package/build/modern/useIsFetching.js +41 -0
  222. package/build/modern/useIsFetching.js.map +1 -1
  223. package/build/modern/useMutation.cjs +170 -9
  224. package/build/modern/useMutation.cjs.map +1 -1
  225. package/build/modern/useMutation.d.cts +164 -3
  226. package/build/modern/useMutation.d.cts.map +1 -1
  227. package/build/modern/useMutation.d.ts +164 -3
  228. package/build/modern/useMutation.d.ts.map +1 -1
  229. package/build/modern/useMutation.js +170 -9
  230. package/build/modern/useMutation.js.map +1 -1
  231. package/build/modern/useMutationState.cjs +103 -0
  232. package/build/modern/useMutationState.cjs.map +1 -1
  233. package/build/modern/useMutationState.d.cts +111 -7
  234. package/build/modern/useMutationState.d.cts.map +1 -1
  235. package/build/modern/useMutationState.d.ts +111 -7
  236. package/build/modern/useMutationState.d.ts.map +1 -1
  237. package/build/modern/useMutationState.js +103 -0
  238. package/build/modern/useMutationState.js.map +1 -1
  239. package/build/modern/usePrefetchInfiniteQuery.cjs +46 -0
  240. package/build/modern/usePrefetchInfiniteQuery.cjs.map +1 -1
  241. package/build/modern/usePrefetchInfiniteQuery.d.cts +48 -2
  242. package/build/modern/usePrefetchInfiniteQuery.d.cts.map +1 -1
  243. package/build/modern/usePrefetchInfiniteQuery.d.ts +48 -2
  244. package/build/modern/usePrefetchInfiniteQuery.d.ts.map +1 -1
  245. package/build/modern/usePrefetchInfiniteQuery.js +46 -0
  246. package/build/modern/usePrefetchInfiniteQuery.js.map +1 -1
  247. package/build/modern/usePrefetchQuery.cjs +37 -0
  248. package/build/modern/usePrefetchQuery.cjs.map +1 -1
  249. package/build/modern/usePrefetchQuery.d.cts +39 -2
  250. package/build/modern/usePrefetchQuery.d.cts.map +1 -1
  251. package/build/modern/usePrefetchQuery.d.ts +39 -2
  252. package/build/modern/usePrefetchQuery.d.ts.map +1 -1
  253. package/build/modern/usePrefetchQuery.js +37 -0
  254. package/build/modern/usePrefetchQuery.js.map +1 -1
  255. package/build/modern/useQueries.cjs +123 -0
  256. package/build/modern/useQueries.cjs.map +1 -1
  257. package/build/modern/useQueries.d.cts +126 -2
  258. package/build/modern/useQueries.d.cts.map +1 -1
  259. package/build/modern/useQueries.d.ts +126 -2
  260. package/build/modern/useQueries.d.ts.map +1 -1
  261. package/build/modern/useQueries.js +123 -0
  262. package/build/modern/useQueries.js.map +1 -1
  263. package/build/modern/useQuery.cjs.map +1 -1
  264. package/build/modern/useQuery.d.cts +248 -2
  265. package/build/modern/useQuery.d.cts.map +1 -0
  266. package/build/modern/useQuery.d.ts +248 -2
  267. package/build/modern/useQuery.d.ts.map +1 -0
  268. package/build/modern/useQuery.js.map +1 -1
  269. package/build/modern/useQueryClient.cjs +21 -0
  270. package/build/modern/useQueryClient.cjs.map +1 -1
  271. package/build/modern/useQueryClient.d.cts +22 -1
  272. package/build/modern/useQueryClient.d.cts.map +1 -1
  273. package/build/modern/useQueryClient.d.ts +22 -1
  274. package/build/modern/useQueryClient.d.ts.map +1 -1
  275. package/build/modern/useQueryClient.js +21 -0
  276. package/build/modern/useQueryClient.js.map +1 -1
  277. package/build/modern/utils.cjs +15 -0
  278. package/build/modern/utils.cjs.map +1 -1
  279. package/build/modern/utils.d.cts +16 -1
  280. package/build/modern/utils.d.cts.map +1 -1
  281. package/build/modern/utils.d.ts +16 -1
  282. package/build/modern/utils.d.ts.map +1 -1
  283. package/build/modern/utils.js +15 -0
  284. package/build/modern/utils.js.map +1 -1
  285. package/build/modern/vueQueryPlugin.cjs +34 -0
  286. package/build/modern/vueQueryPlugin.cjs.map +1 -1
  287. package/build/modern/vueQueryPlugin.d.cts +48 -2
  288. package/build/modern/vueQueryPlugin.d.cts.map +1 -1
  289. package/build/modern/vueQueryPlugin.d.ts +48 -2
  290. package/build/modern/vueQueryPlugin.d.ts.map +1 -1
  291. package/build/modern/vueQueryPlugin.js +34 -0
  292. package/build/modern/vueQueryPlugin.js.map +1 -1
  293. package/package.json +10 -10
  294. package/src/index.ts +9 -9
  295. package/src/infiniteQueryOptions.ts +86 -0
  296. package/src/mutationCache.ts +5 -0
  297. package/src/mutationOptions.ts +123 -0
  298. package/src/queryCache.ts +5 -0
  299. package/src/queryClient.ts +17 -1
  300. package/src/queryOptions.ts +276 -10
  301. package/src/types.ts +18 -0
  302. package/src/useBaseQuery.ts +9 -1
  303. package/src/useInfiniteQuery.ts +240 -0
  304. package/src/useIsFetching.ts +46 -3
  305. package/src/useMutation.ts +170 -17
  306. package/src/useMutationState.ts +111 -4
  307. package/src/usePrefetchInfiniteQuery.ts +46 -0
  308. package/src/usePrefetchQuery.ts +37 -0
  309. package/src/useQueries.ts +124 -1
  310. package/src/useQuery.ts +240 -79
  311. package/src/useQueryClient.ts +21 -0
  312. package/src/utils.ts +15 -0
  313. package/src/vueQueryPlugin.ts +46 -0
  314. package/build/legacy/queryClient-C07d0chJ.d.cts +0 -97
  315. package/build/legacy/queryClient-C07d0chJ.d.cts.map +0 -1
  316. package/build/legacy/queryClient-hf6i_vCa.d.ts +0 -97
  317. package/build/legacy/queryClient-hf6i_vCa.d.ts.map +0 -1
  318. package/build/legacy/queryOptions.d.cts.map +0 -1
  319. package/build/legacy/queryOptions.d.ts.map +0 -1
  320. package/build/legacy/types-BzZi3_rS.d.cts.map +0 -1
  321. package/build/legacy/types-BzZi3_rS.d.ts.map +0 -1
  322. package/build/modern/queryClient-C07d0chJ.d.cts +0 -97
  323. package/build/modern/queryClient-C07d0chJ.d.cts.map +0 -1
  324. package/build/modern/queryClient-hf6i_vCa.d.ts +0 -97
  325. package/build/modern/queryClient-hf6i_vCa.d.ts.map +0 -1
  326. package/build/modern/queryOptions.d.cts.map +0 -1
  327. package/build/modern/queryOptions.d.ts.map +0 -1
  328. package/build/modern/types-BzZi3_rS.d.cts.map +0 -1
  329. package/build/modern/types-BzZi3_rS.d.ts.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/vue-query",
3
- "version": "5.102.8",
3
+ "version": "5.103.0",
4
4
  "description": "Hooks for managing, caching and syncing asynchronous and remote data in Vue",
5
5
  "author": "Damian Osipiuk",
6
6
  "license": "MIT",
@@ -42,7 +42,7 @@
42
42
  "@tanstack/match-sorter-utils": "^8.19.4",
43
43
  "@vue/devtools-api": "^6.6.3",
44
44
  "vue-demi": "^0.14.10",
45
- "@tanstack/query-core": "5.102.8"
45
+ "@tanstack/query-core": "5.103.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@vitejs/plugin-vue": "^5.2.4",
@@ -63,16 +63,16 @@
63
63
  }
64
64
  },
65
65
  "scripts": {
66
- "clean": "premove ./build ./coverage ./dist-ts",
67
- "compile": "node ../../node_modules/typescript/lib/tsc.js --build",
66
+ "clean": "premove ./build ./coverage ./dist-ts ./.cache/test-types",
67
+ "compile": "node ../../node_modules/typescript/lib/tsc.js --project tsconfig.json",
68
68
  "test:eslint": "eslint --concurrency=auto ./src",
69
69
  "test:types": "vue-demi-switch 3 && pnpm run \"/^test:types:ts[0-9]{2}$/\"",
70
- "test:types:ts56": "node ../../node_modules/typescript56/lib/tsc.js --build tsconfig.legacy.json",
71
- "test:types:ts57": "node ../../node_modules/typescript57/lib/tsc.js --build tsconfig.legacy.json",
72
- "test:types:ts58": "node ../../node_modules/typescript58/lib/tsc.js --build tsconfig.legacy.json",
73
- "test:types:ts59": "node ../../node_modules/typescript59/lib/tsc.js --build tsconfig.legacy.json",
74
- "test:types:tscurrent": "tsc --build",
75
- "test:types:ts70": "node ../../node_modules/typescript70/lib/tsc.js --build tsconfig.legacy.json",
70
+ "test:types:ts56": "node ../../node_modules/typescript56/lib/tsc.js --project tsconfig.legacy.json --outDir .cache/test-types/ts56 --tsBuildInfoFile .cache/test-types/ts56.tsbuildinfo",
71
+ "test:types:ts57": "node ../../node_modules/typescript57/lib/tsc.js --project tsconfig.legacy.json --outDir .cache/test-types/ts57 --tsBuildInfoFile .cache/test-types/ts57.tsbuildinfo",
72
+ "test:types:ts58": "node ../../node_modules/typescript58/lib/tsc.js --project tsconfig.legacy.json --outDir .cache/test-types/ts58 --tsBuildInfoFile .cache/test-types/ts58.tsbuildinfo",
73
+ "test:types:ts59": "node ../../node_modules/typescript59/lib/tsc.js --project tsconfig.legacy.json --outDir .cache/test-types/ts59 --tsBuildInfoFile .cache/test-types/ts59.tsbuildinfo",
74
+ "test:types:tscurrent": "tsc --project tsconfig.json --outDir .cache/test-types/tscurrent --tsBuildInfoFile .cache/test-types/tscurrent.tsbuildinfo",
75
+ "test:types:ts70": "node ../../node_modules/typescript70/lib/tsc.js --project tsconfig.legacy.json --outDir .cache/test-types/ts70 --tsBuildInfoFile .cache/test-types/ts70.tsbuildinfo",
76
76
  "test:lib": "pnpm run test:lib:2 && pnpm run test:lib:2.7 && pnpm run test:lib:3",
77
77
  "test:lib:2": "vue-demi-switch 2 vue2 && vitest",
78
78
  "test:lib:2.7": "vue-demi-switch 2.7 vue2.7 && vitest",
package/src/index.ts CHANGED
@@ -8,6 +8,9 @@ export { QueryCache } from './queryCache'
8
8
  export { queryOptions } from './queryOptions'
9
9
  export type {
10
10
  QueryOptions,
11
+ UseQueryOptions,
12
+ UndefinedInitialQueryOptions,
13
+ DefinedInitialQueryOptions,
11
14
  UndefinedInitialQueryOptionsWithDataTag,
12
15
  DefinedInitialQueryOptionsWithDataTag,
13
16
  } from './queryOptions'
@@ -30,13 +33,7 @@ export { VUE_QUERY_CLIENT } from './utils'
30
33
 
31
34
  export type { UsePrefetchQueryOptions } from './usePrefetchQuery'
32
35
  export type { UsePrefetchInfiniteQueryOptions } from './usePrefetchInfiniteQuery'
33
- export type {
34
- UseQueryOptions,
35
- UseQueryReturnType,
36
- UseQueryDefinedReturnType,
37
- UndefinedInitialQueryOptions,
38
- DefinedInitialQueryOptions,
39
- } from './useQuery'
36
+ export type { UseQueryReturnType, UseQueryDefinedReturnType } from './useQuery'
40
37
  export type {
41
38
  UseInfiniteQueryOptions,
42
39
  UseInfiniteQueryReturnType,
@@ -44,6 +41,9 @@ export type {
44
41
  export type { UseMutationOptions, UseMutationReturnType } from './useMutation'
45
42
  export type { MutationOptions } from './types'
46
43
  export type { UseQueriesOptions, UseQueriesResults } from './useQueries'
47
- export type { MutationFilters, MutationStateOptions } from './useMutationState'
48
- export type { QueryFilters } from './useIsFetching'
44
+ export type {
45
+ MutationStateOptions,
46
+ UseIsMutatingFilters,
47
+ } from './useMutationState'
48
+ export type { UseIsFetchingFilters } from './useIsFetching'
49
49
  export type { VueQueryPluginOptions } from './vueQueryPlugin'
@@ -7,6 +7,17 @@ import type {
7
7
  } from '@tanstack/query-core'
8
8
  import type { UseInfiniteQueryOptions } from './useInfiniteQuery'
9
9
 
10
+ /**
11
+ * The options accepted by the `infiniteQueryOptions` overload selected when no `initialData` is set — `data`
12
+ * may be `undefined` while the query is `pending`.
13
+ *
14
+ * @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.
15
+ * @template TError - The type of errors your `queryFn` may throw.
16
+ * @template TData - The type `data` ends up as after `select` runs — defaults to `InfiniteData<TQueryFnData>`,
17
+ * the shape of all fetched pages plus their page params.
18
+ * @template TQueryKey - The type of your `queryKey`.
19
+ * @template TPageParam - The type of the parameter passed to `queryFn` to fetch a given page.
20
+ */
10
21
  export type UndefinedInitialDataInfiniteOptions<
11
22
  TQueryFnData,
12
23
  TError = DefaultError,
@@ -23,6 +34,17 @@ export type UndefinedInitialDataInfiniteOptions<
23
34
  initialData?: undefined
24
35
  }
25
36
 
37
+ /**
38
+ * The options accepted by the `infiniteQueryOptions` overload selected when `initialData` is set — `data` is
39
+ * never `undefined`.
40
+ *
41
+ * @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.
42
+ * @template TError - The type of errors your `queryFn` may throw.
43
+ * @template TData - The type `data` ends up as after `select` runs — defaults to `InfiniteData<TQueryFnData>`,
44
+ * the shape of all fetched pages plus their page params.
45
+ * @template TQueryKey - The type of your `queryKey`.
46
+ * @template TPageParam - The type of the parameter passed to `queryFn` to fetch a given page.
47
+ */
26
48
  export type DefinedInitialDataInfiniteOptions<
27
49
  TQueryFnData,
28
50
  TError = DefaultError,
@@ -36,11 +58,44 @@ export type DefinedInitialDataInfiniteOptions<
36
58
  TQueryKey,
37
59
  TPageParam
38
60
  > & {
61
+ /**
62
+ * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been
63
+ * created or cached yet). If set to a function, the function will be called **once** during the shared/root
64
+ * query initialization, and be expected to synchronously return the initial data. Initial data is
65
+ * considered stale by default unless a `staleTime` has been set. `initialData` **is persisted** to the
66
+ * cache.
67
+ */
39
68
  initialData:
40
69
  | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>
41
70
  | (() => NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>)
42
71
  }
43
72
 
73
+ /**
74
+ * You can generally pass everything to `infiniteQueryOptions` that you can also pass to `useInfiniteQuery`.
75
+ * These options can be shared across hooks and imperative APIs such as `queryClient.infiniteQuery`.
76
+ * `options.queryKey` is required and is the query key to generate options for.
77
+ *
78
+ * @see {@link useInfiniteQuery} to run an infinite query with these options.
79
+ * @param options - The {@link UndefinedInitialDataInfiniteOptions} to use — everything you can pass to
80
+ * `useInfiniteQuery`.
81
+ * @returns The same options object, typed so that `queryKey` carries the inferred data type.
82
+ *
83
+ * @example
84
+ * ```vue
85
+ * <script setup lang="ts">
86
+ * import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/vue-query'
87
+ *
88
+ * const projectsOptions = infiniteQueryOptions({
89
+ * queryKey: ['projects'],
90
+ * queryFn: ({ pageParam }) => fetchProjects(pageParam),
91
+ * initialPageParam: 0,
92
+ * getNextPageParam: (lastPage) => lastPage.nextId,
93
+ * })
94
+ *
95
+ * const { data, isError, error, fetchNextPage } = useInfiniteQuery(projectsOptions)
96
+ * </script>
97
+ * ```
98
+ */
44
99
  export function infiniteQueryOptions<
45
100
  TQueryFnData,
46
101
  TError = DefaultError,
@@ -64,6 +119,37 @@ export function infiniteQueryOptions<
64
119
  > &
65
120
  QueryKeyWithDataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>
66
121
 
122
+ /**
123
+ * You can generally pass everything to `infiniteQueryOptions` that you can also pass to `useInfiniteQuery`.
124
+ * These options can be shared across hooks and imperative APIs such as `queryClient.infiniteQuery`.
125
+ * `options.queryKey` is required and is the query key to generate options for.
126
+ *
127
+ * This overload is selected when `initialData` is set, so the resulting `data` is never `undefined`.
128
+ *
129
+ * @see {@link useInfiniteQuery} to run an infinite query with these options.
130
+ * @param options - The {@link DefinedInitialDataInfiniteOptions} to use — everything you can pass to
131
+ * `useInfiniteQuery`, with `initialData` set.
132
+ * @returns The same options object, typed so that `queryKey` carries the inferred data type.
133
+ *
134
+ * @example
135
+ * ```vue
136
+ * <script setup lang="ts">
137
+ * import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/vue-query'
138
+ *
139
+ * const projectsOptions = infiniteQueryOptions({
140
+ * queryKey: ['projects'],
141
+ * queryFn: ({ pageParam }) => fetchProjects(pageParam),
142
+ * initialPageParam: 0,
143
+ * getNextPageParam: (lastPage) => lastPage.nextId,
144
+ * initialData: { pages: [], pageParams: [] },
145
+ * })
146
+ *
147
+ * // `data` is never `undefined`, thanks to `initialData` — even if a refetch fails, so the
148
+ * // list stays visible alongside the error.
149
+ * const { data, isError, error } = useInfiniteQuery(projectsOptions)
150
+ * </script>
151
+ * ```
152
+ */
67
153
  export function infiniteQueryOptions<
68
154
  TQueryFnData,
69
155
  TError = DefaultError,
@@ -7,6 +7,11 @@ import type {
7
7
  } from '@tanstack/query-core'
8
8
  import type { MaybeRefDeep } from './types'
9
9
 
10
+ /**
11
+ * Vue-aware subclass of `@tanstack/query-core`'s `MutationCache`. `find`/`findAll` also accept a
12
+ * {@link MaybeRefDeep} filters object, so `ref`s can be passed directly without unwrapping. Access it via
13
+ * `queryClient.getMutationCache()` — `QueryClient` constructs one of these by default.
14
+ */
10
15
  export class MutationCache extends MC {
11
16
  find<
12
17
  TData = unknown,
@@ -1,6 +1,36 @@
1
1
  import type { DefaultError, WithRequired } from '@tanstack/query-core'
2
2
  import type { MutationOptions } from './types'
3
3
 
4
+ /**
5
+ * You can generally pass everything to `mutationOptions` that you can also pass to `useMutation`. A
6
+ * `mutationKey` is required on this overload so the mutation can be looked up later, e.g. with
7
+ * `useMutationState`.
8
+ *
9
+ * @see {@link useMutation} to run the mutation these options describe.
10
+ * @param options - The mutation options to use, identical to what you'd pass to `useMutation`, with a
11
+ * required `mutationKey`.
12
+ * @returns The same options object, unchanged.
13
+ *
14
+ * @example
15
+ * Looking the mutation up elsewhere via its `mutationKey`, e.g. for a global "saving…" indicator:
16
+ * ```vue
17
+ * <script setup lang="ts">
18
+ * import { mutationOptions, useMutationState } from '@tanstack/vue-query'
19
+ * import { computed } from 'vue'
20
+ *
21
+ * const createPostOptions = mutationOptions({
22
+ * mutationKey: ['posts', 'create'],
23
+ * mutationFn: createPost,
24
+ * })
25
+ *
26
+ * // Call `useMutationState` once — it manages its own subscription — then derive from its result.
27
+ * const creatingPosts = useMutationState({
28
+ * filters: { mutationKey: createPostOptions.mutationKey, status: 'pending' },
29
+ * })
30
+ * const isCreatingPost = computed(() => creatingPosts.value.length > 0)
31
+ * </script>
32
+ * ```
33
+ */
4
34
  export function mutationOptions<
5
35
  TData = unknown,
6
36
  TError = DefaultError,
@@ -15,6 +45,38 @@ export function mutationOptions<
15
45
  MutationOptions<TData, TError, TVariables, TOnMutateResult>,
16
46
  'mutationKey'
17
47
  >
48
+
49
+ /**
50
+ * Same as the plain-object overload with a required `mutationKey`, but for options that close over reactive
51
+ * state (`ref`s read inside the function body). Wrap them in a getter so `useMutation` and the other consumers
52
+ * always read the current values instead of the ones captured when the options were created.
53
+ *
54
+ * @see {@link useMutation} to run the mutation these options describe.
55
+ * @param options - A function returning the mutation options to use, with a required `mutationKey`,
56
+ * re-evaluated on demand.
57
+ * @returns A function that returns the same options object, unchanged.
58
+ *
59
+ * @example
60
+ * ```vue
61
+ * <script setup lang="ts">
62
+ * import { mutationOptions, useMutation } from '@tanstack/vue-query'
63
+ *
64
+ * const props = defineProps<{ userId: number }>()
65
+ *
66
+ * const createPostOptions = mutationOptions(() => ({
67
+ * mutationKey: ['posts', 'create'],
68
+ * // Reacts to changes on `props.userId`, unlike the plain-object overload.
69
+ * mutationFn: (title: string) => createPost({ title, userId: props.userId }),
70
+ * }))
71
+ *
72
+ * const mutation = useMutation(createPostOptions)
73
+ * </script>
74
+ *
75
+ * <template>
76
+ * <button @click="mutation.mutate('Hello')">Create</button>
77
+ * </template>
78
+ * ```
79
+ */
18
80
  export function mutationOptions<
19
81
  TData = unknown,
20
82
  TError = DefaultError,
@@ -29,6 +91,36 @@ export function mutationOptions<
29
91
  MutationOptions<TData, TError, TVariables, TOnMutateResult>,
30
92
  'mutationKey'
31
93
  >
94
+
95
+ /**
96
+ * You can generally pass everything to `mutationOptions` that you can also pass to `useMutation`. No
97
+ * `mutationKey` is required on this overload — use this when you don't need to target the mutation via a
98
+ * `mutationKey` filter later (e.g. with `useMutationState`); it can still be observed through other filters,
99
+ * such as `status`.
100
+ *
101
+ * @see {@link useMutation} to run the mutation these options describe.
102
+ * @param options - The mutation options to use, identical to what you'd pass to `useMutation`, without a
103
+ * `mutationKey`.
104
+ * @returns The same options object, unchanged.
105
+ * @remarks See the other overload's example for looking a mutation up via `useMutationState`.
106
+ *
107
+ * @example
108
+ * ```vue
109
+ * <script setup lang="ts">
110
+ * import { mutationOptions, useMutation } from '@tanstack/vue-query'
111
+ *
112
+ * const createPostOptions = mutationOptions({
113
+ * mutationFn: createPost,
114
+ * })
115
+ *
116
+ * const mutation = useMutation(createPostOptions)
117
+ * </script>
118
+ *
119
+ * <template>
120
+ * <button @click="mutation.mutate({ title: 'Hello' })">Create</button>
121
+ * </template>
122
+ * ```
123
+ */
32
124
  export function mutationOptions<
33
125
  TData = unknown,
34
126
  TError = DefaultError,
@@ -43,6 +135,37 @@ export function mutationOptions<
43
135
  MutationOptions<TData, TError, TVariables, TOnMutateResult>,
44
136
  'mutationKey'
45
137
  >
138
+
139
+ /**
140
+ * Same as the plain-object overload without a `mutationKey`, but for options that close over reactive state
141
+ * (`ref`s read inside the function body). Wrap them in a getter so `useMutation` and the other consumers
142
+ * always read the current values instead of the ones captured when the options were created.
143
+ *
144
+ * @see {@link useMutation} to run the mutation these options describe.
145
+ * @param options - A function returning the mutation options to use, without a `mutationKey`, re-evaluated on
146
+ * demand.
147
+ * @returns A function that returns the same options object, unchanged.
148
+ *
149
+ * @example
150
+ * ```vue
151
+ * <script setup lang="ts">
152
+ * import { mutationOptions, useMutation } from '@tanstack/vue-query'
153
+ *
154
+ * const props = defineProps<{ userId: number }>()
155
+ *
156
+ * const createPostOptions = mutationOptions(() => ({
157
+ * // Reacts to changes on `props.userId`, unlike the plain-object overload.
158
+ * mutationFn: (title: string) => createPost({ title, userId: props.userId }),
159
+ * }))
160
+ *
161
+ * const mutation = useMutation(createPostOptions)
162
+ * </script>
163
+ *
164
+ * <template>
165
+ * <button @click="mutation.mutate('Hello')">Create</button>
166
+ * </template>
167
+ * ```
168
+ */
46
169
  export function mutationOptions<
47
170
  TData = unknown,
48
171
  TError = DefaultError,
package/src/queryCache.ts CHANGED
@@ -8,6 +8,11 @@ import type {
8
8
  } from '@tanstack/query-core'
9
9
  import type { MaybeRefDeep } from './types'
10
10
 
11
+ /**
12
+ * Vue-aware subclass of `@tanstack/query-core`'s `QueryCache`. `find`/`findAll` also accept a
13
+ * {@link MaybeRefDeep} filters object, so `ref`s can be passed directly without unwrapping. Access it via
14
+ * `queryClient.getQueryCache()` — `QueryClient` constructs one of these by default.
15
+ */
11
16
  export class QueryCache extends QC {
12
17
  find<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData>(
13
18
  filters: MaybeRefDeep<WithRequired<QueryFilters, 'queryKey'>>,
@@ -3,7 +3,7 @@ import { QueryClient as QC } from '@tanstack/query-core'
3
3
  import { cloneDeepUnref } from './utils'
4
4
  import { QueryCache } from './queryCache'
5
5
  import { MutationCache } from './mutationCache'
6
- import type { UseQueryOptions } from './useQuery'
6
+ import type { UseQueryOptions } from './queryOptions'
7
7
  import type { Ref } from 'vue-demi'
8
8
  import type { MaybeRefDeep, NoUnknown, QueryClientConfig } from './types'
9
9
  import type {
@@ -34,6 +34,13 @@ import type {
34
34
  Updater,
35
35
  } from '@tanstack/query-core'
36
36
 
37
+ /**
38
+ * Vue-aware subclass of `@tanstack/query-core`'s `QueryClient`. Methods that accept `options` (such as
39
+ * `CancelOptions` or `InvalidateOptions`) or filters (such as the `QueryFilters` accepted by
40
+ * `invalidateQueries`) also accept a {@link MaybeRefDeep} version of it, so you can pass `ref`s directly
41
+ * without unwrapping them yourself — e.g. `queryClient.invalidateQueries({ queryKey: ['post', myRef] })`.
42
+ * Install one on your app with `VueQueryPlugin`, or retrieve it with `useQueryClient`.
43
+ */
37
44
  export class QueryClient extends QC {
38
45
  constructor(config: QueryClientConfig = {}) {
39
46
  const vueQueryConfig = {
@@ -44,6 +51,10 @@ export class QueryClient extends QC {
44
51
  super(vueQueryConfig)
45
52
  }
46
53
 
54
+ /**
55
+ * `true` while a `clientPersister` passed to `VueQueryPlugin` is restoring the cache. Queries don't fetch
56
+ * while this is `true`. Defaults to `false` if no persister is configured.
57
+ */
47
58
  isRestoring?: Ref<boolean> = ref(false)
48
59
 
49
60
  isFetching(filters: MaybeRefDeep<QueryFilters> = {}): number {
@@ -97,6 +108,7 @@ export class QueryClient extends QC {
97
108
  EnsureQueryDataOptions<TQueryFnData, TError, TData, TQueryKey>
98
109
  >,
99
110
  ): Promise<TData> {
111
+ // eslint-disable-next-line no-restricted-syntax -- grandfathered deprecated wrapper implementation
100
112
  return super.ensureQueryData(cloneDeepUnref(options))
101
113
  }
102
114
 
@@ -344,6 +356,7 @@ export class QueryClient extends QC {
344
356
  FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>
345
357
  >,
346
358
  ): Promise<TData> {
359
+ // eslint-disable-next-line no-restricted-syntax -- grandfathered deprecated wrapper implementation
347
360
  return super.fetchQuery(cloneDeepUnref(options))
348
361
  }
349
362
 
@@ -378,6 +391,7 @@ export class QueryClient extends QC {
378
391
  FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>
379
392
  >,
380
393
  ): Promise<void> {
394
+ // eslint-disable-next-line no-restricted-syntax -- grandfathered deprecated wrapper implementation
381
395
  return super.prefetchQuery(cloneDeepUnref(options))
382
396
  }
383
397
 
@@ -499,6 +513,7 @@ export class QueryClient extends QC {
499
513
  >
500
514
  >,
501
515
  ): Promise<InfiniteData<TData, TPageParam>> {
516
+ // eslint-disable-next-line no-restricted-syntax -- grandfathered deprecated wrapper implementation
502
517
  return super.fetchInfiniteQuery(cloneDeepUnref(options))
503
518
  }
504
519
 
@@ -554,6 +569,7 @@ export class QueryClient extends QC {
554
569
  >
555
570
  >,
556
571
  ): Promise<void> {
572
+ // eslint-disable-next-line no-restricted-syntax -- grandfathered deprecated wrapper implementation
557
573
  return super.prefetchInfiniteQuery(cloneDeepUnref(options))
558
574
  }
559
575