@tanstack/preact-query 5.103.2 → 5.104.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 (249) hide show
  1. package/README.md +2 -2
  2. package/build/legacy/HydrationBoundary.d.cts +2 -3
  3. package/build/legacy/HydrationBoundary.d.cts.map +1 -1
  4. package/build/legacy/HydrationBoundary.d.ts +2 -3
  5. package/build/legacy/HydrationBoundary.d.ts.map +1 -1
  6. package/build/legacy/IsRestoringProvider.d.cts +2 -3
  7. package/build/legacy/IsRestoringProvider.d.cts.map +1 -1
  8. package/build/legacy/IsRestoringProvider.d.ts +2 -3
  9. package/build/legacy/IsRestoringProvider.d.ts.map +1 -1
  10. package/build/legacy/QueryClientProvider.d.cts +4 -5
  11. package/build/legacy/QueryClientProvider.d.cts.map +1 -1
  12. package/build/legacy/QueryClientProvider.d.ts +4 -5
  13. package/build/legacy/QueryClientProvider.d.ts.map +1 -1
  14. package/build/legacy/QueryErrorResetBoundary.d.cts +8 -9
  15. package/build/legacy/QueryErrorResetBoundary.d.cts.map +1 -1
  16. package/build/legacy/QueryErrorResetBoundary.d.ts +8 -9
  17. package/build/legacy/QueryErrorResetBoundary.d.ts.map +1 -1
  18. package/build/legacy/errorBoundaryUtils.d.cts +3 -4
  19. package/build/legacy/errorBoundaryUtils.d.cts.map +1 -1
  20. package/build/legacy/errorBoundaryUtils.d.ts +3 -4
  21. package/build/legacy/errorBoundaryUtils.d.ts.map +1 -1
  22. package/build/legacy/infiniteQueryOptions.cjs.map +1 -1
  23. package/build/legacy/infiniteQueryOptions.d.cts +7 -8
  24. package/build/legacy/infiniteQueryOptions.d.cts.map +1 -1
  25. package/build/legacy/infiniteQueryOptions.d.ts +7 -8
  26. package/build/legacy/infiniteQueryOptions.d.ts.map +1 -1
  27. package/build/legacy/infiniteQueryOptions.js.map +1 -1
  28. package/build/legacy/mutationOptions.d.cts +2 -3
  29. package/build/legacy/mutationOptions.d.cts.map +1 -1
  30. package/build/legacy/mutationOptions.d.ts +2 -3
  31. package/build/legacy/mutationOptions.d.ts.map +1 -1
  32. package/build/legacy/queryOptions.cjs.map +1 -1
  33. package/build/legacy/queryOptions.d.cts +9 -9
  34. package/build/legacy/queryOptions.d.cts.map +1 -1
  35. package/build/legacy/queryOptions.d.ts +9 -9
  36. package/build/legacy/queryOptions.d.ts.map +1 -1
  37. package/build/legacy/queryOptions.js.map +1 -1
  38. package/build/legacy/suspense.cjs.map +1 -1
  39. package/build/legacy/suspense.d.cts +4 -5
  40. package/build/legacy/suspense.d.cts.map +1 -1
  41. package/build/legacy/suspense.d.ts +4 -5
  42. package/build/legacy/suspense.d.ts.map +1 -1
  43. package/build/legacy/suspense.js.map +1 -1
  44. package/build/legacy/types.cjs.map +1 -1
  45. package/build/legacy/types.d.cts +30 -30
  46. package/build/legacy/types.d.cts.map +1 -1
  47. package/build/legacy/types.d.ts +30 -30
  48. package/build/legacy/types.d.ts.map +1 -1
  49. package/build/legacy/types.js.map +1 -1
  50. package/build/legacy/useBaseQuery.cjs.map +1 -1
  51. package/build/legacy/useBaseQuery.d.cts +1 -2
  52. package/build/legacy/useBaseQuery.d.cts.map +1 -1
  53. package/build/legacy/useBaseQuery.d.ts +1 -2
  54. package/build/legacy/useBaseQuery.d.ts.map +1 -1
  55. package/build/legacy/useBaseQuery.js.map +1 -1
  56. package/build/legacy/useInfiniteQuery.d.cts +3 -4
  57. package/build/legacy/useInfiniteQuery.d.cts.map +1 -1
  58. package/build/legacy/useInfiniteQuery.d.ts +3 -4
  59. package/build/legacy/useInfiniteQuery.d.ts.map +1 -1
  60. package/build/legacy/useIsFetching.d.cts +1 -2
  61. package/build/legacy/useIsFetching.d.cts.map +1 -1
  62. package/build/legacy/useIsFetching.d.ts +1 -2
  63. package/build/legacy/useIsFetching.d.ts.map +1 -1
  64. package/build/legacy/useMutation.d.cts +1 -2
  65. package/build/legacy/useMutation.d.cts.map +1 -1
  66. package/build/legacy/useMutation.d.ts +1 -2
  67. package/build/legacy/useMutation.d.ts.map +1 -1
  68. package/build/legacy/useMutationState.d.cts +2 -3
  69. package/build/legacy/useMutationState.d.cts.map +1 -1
  70. package/build/legacy/useMutationState.d.ts +2 -3
  71. package/build/legacy/useMutationState.d.ts.map +1 -1
  72. package/build/legacy/usePrefetchInfiniteQuery.d.cts +1 -2
  73. package/build/legacy/usePrefetchInfiniteQuery.d.cts.map +1 -1
  74. package/build/legacy/usePrefetchInfiniteQuery.d.ts +1 -2
  75. package/build/legacy/usePrefetchInfiniteQuery.d.ts.map +1 -1
  76. package/build/legacy/usePrefetchQuery.d.cts +1 -2
  77. package/build/legacy/usePrefetchQuery.d.cts.map +1 -1
  78. package/build/legacy/usePrefetchQuery.d.ts +1 -2
  79. package/build/legacy/usePrefetchQuery.d.ts.map +1 -1
  80. package/build/legacy/useQueries.cjs.map +1 -1
  81. package/build/legacy/useQueries.d.cts +9 -6
  82. package/build/legacy/useQueries.d.cts.map +1 -1
  83. package/build/legacy/useQueries.d.ts +9 -6
  84. package/build/legacy/useQueries.d.ts.map +1 -1
  85. package/build/legacy/useQueries.js.map +1 -1
  86. package/build/legacy/useQuery.cjs.map +1 -1
  87. package/build/legacy/useQuery.d.cts +10 -6
  88. package/build/legacy/useQuery.d.cts.map +1 -1
  89. package/build/legacy/useQuery.d.ts +10 -6
  90. package/build/legacy/useQuery.d.ts.map +1 -1
  91. package/build/legacy/useQuery.js.map +1 -1
  92. package/build/legacy/useSuspenseInfiniteQuery.d.cts +1 -2
  93. package/build/legacy/useSuspenseInfiniteQuery.d.cts.map +1 -1
  94. package/build/legacy/useSuspenseInfiniteQuery.d.ts +1 -2
  95. package/build/legacy/useSuspenseInfiniteQuery.d.ts.map +1 -1
  96. package/build/legacy/useSuspenseQueries.cjs.map +1 -1
  97. package/build/legacy/useSuspenseQueries.d.cts +11 -8
  98. package/build/legacy/useSuspenseQueries.d.cts.map +1 -1
  99. package/build/legacy/useSuspenseQueries.d.ts +11 -8
  100. package/build/legacy/useSuspenseQueries.d.ts.map +1 -1
  101. package/build/legacy/useSuspenseQueries.js.map +1 -1
  102. package/build/legacy/useSuspenseQuery.d.cts +1 -2
  103. package/build/legacy/useSuspenseQuery.d.cts.map +1 -1
  104. package/build/legacy/useSuspenseQuery.d.ts +1 -2
  105. package/build/legacy/useSuspenseQuery.d.ts.map +1 -1
  106. package/build/legacy/utils.d.cts +2 -3
  107. package/build/legacy/utils.d.cts.map +1 -1
  108. package/build/legacy/utils.d.ts +2 -3
  109. package/build/legacy/utils.d.ts.map +1 -1
  110. package/build/modern/HydrationBoundary.d.cts +2 -3
  111. package/build/modern/HydrationBoundary.d.cts.map +1 -1
  112. package/build/modern/HydrationBoundary.d.ts +2 -3
  113. package/build/modern/HydrationBoundary.d.ts.map +1 -1
  114. package/build/modern/IsRestoringProvider.d.cts +2 -3
  115. package/build/modern/IsRestoringProvider.d.cts.map +1 -1
  116. package/build/modern/IsRestoringProvider.d.ts +2 -3
  117. package/build/modern/IsRestoringProvider.d.ts.map +1 -1
  118. package/build/modern/QueryClientProvider.d.cts +4 -5
  119. package/build/modern/QueryClientProvider.d.cts.map +1 -1
  120. package/build/modern/QueryClientProvider.d.ts +4 -5
  121. package/build/modern/QueryClientProvider.d.ts.map +1 -1
  122. package/build/modern/QueryErrorResetBoundary.d.cts +8 -9
  123. package/build/modern/QueryErrorResetBoundary.d.cts.map +1 -1
  124. package/build/modern/QueryErrorResetBoundary.d.ts +8 -9
  125. package/build/modern/QueryErrorResetBoundary.d.ts.map +1 -1
  126. package/build/modern/errorBoundaryUtils.d.cts +3 -4
  127. package/build/modern/errorBoundaryUtils.d.cts.map +1 -1
  128. package/build/modern/errorBoundaryUtils.d.ts +3 -4
  129. package/build/modern/errorBoundaryUtils.d.ts.map +1 -1
  130. package/build/modern/infiniteQueryOptions.cjs.map +1 -1
  131. package/build/modern/infiniteQueryOptions.d.cts +7 -8
  132. package/build/modern/infiniteQueryOptions.d.cts.map +1 -1
  133. package/build/modern/infiniteQueryOptions.d.ts +7 -8
  134. package/build/modern/infiniteQueryOptions.d.ts.map +1 -1
  135. package/build/modern/infiniteQueryOptions.js.map +1 -1
  136. package/build/modern/mutationOptions.d.cts +2 -3
  137. package/build/modern/mutationOptions.d.cts.map +1 -1
  138. package/build/modern/mutationOptions.d.ts +2 -3
  139. package/build/modern/mutationOptions.d.ts.map +1 -1
  140. package/build/modern/queryOptions.cjs.map +1 -1
  141. package/build/modern/queryOptions.d.cts +9 -9
  142. package/build/modern/queryOptions.d.cts.map +1 -1
  143. package/build/modern/queryOptions.d.ts +9 -9
  144. package/build/modern/queryOptions.d.ts.map +1 -1
  145. package/build/modern/queryOptions.js.map +1 -1
  146. package/build/modern/suspense.cjs.map +1 -1
  147. package/build/modern/suspense.d.cts +4 -5
  148. package/build/modern/suspense.d.cts.map +1 -1
  149. package/build/modern/suspense.d.ts +4 -5
  150. package/build/modern/suspense.d.ts.map +1 -1
  151. package/build/modern/suspense.js.map +1 -1
  152. package/build/modern/types.cjs.map +1 -1
  153. package/build/modern/types.d.cts +30 -30
  154. package/build/modern/types.d.cts.map +1 -1
  155. package/build/modern/types.d.ts +30 -30
  156. package/build/modern/types.d.ts.map +1 -1
  157. package/build/modern/types.js.map +1 -1
  158. package/build/modern/useBaseQuery.cjs.map +1 -1
  159. package/build/modern/useBaseQuery.d.cts +1 -2
  160. package/build/modern/useBaseQuery.d.cts.map +1 -1
  161. package/build/modern/useBaseQuery.d.ts +1 -2
  162. package/build/modern/useBaseQuery.d.ts.map +1 -1
  163. package/build/modern/useBaseQuery.js.map +1 -1
  164. package/build/modern/useInfiniteQuery.d.cts +3 -4
  165. package/build/modern/useInfiniteQuery.d.cts.map +1 -1
  166. package/build/modern/useInfiniteQuery.d.ts +3 -4
  167. package/build/modern/useInfiniteQuery.d.ts.map +1 -1
  168. package/build/modern/useIsFetching.d.cts +1 -2
  169. package/build/modern/useIsFetching.d.cts.map +1 -1
  170. package/build/modern/useIsFetching.d.ts +1 -2
  171. package/build/modern/useIsFetching.d.ts.map +1 -1
  172. package/build/modern/useMutation.d.cts +1 -2
  173. package/build/modern/useMutation.d.cts.map +1 -1
  174. package/build/modern/useMutation.d.ts +1 -2
  175. package/build/modern/useMutation.d.ts.map +1 -1
  176. package/build/modern/useMutationState.d.cts +2 -3
  177. package/build/modern/useMutationState.d.cts.map +1 -1
  178. package/build/modern/useMutationState.d.ts +2 -3
  179. package/build/modern/useMutationState.d.ts.map +1 -1
  180. package/build/modern/usePrefetchInfiniteQuery.d.cts +1 -2
  181. package/build/modern/usePrefetchInfiniteQuery.d.cts.map +1 -1
  182. package/build/modern/usePrefetchInfiniteQuery.d.ts +1 -2
  183. package/build/modern/usePrefetchInfiniteQuery.d.ts.map +1 -1
  184. package/build/modern/usePrefetchQuery.d.cts +1 -2
  185. package/build/modern/usePrefetchQuery.d.cts.map +1 -1
  186. package/build/modern/usePrefetchQuery.d.ts +1 -2
  187. package/build/modern/usePrefetchQuery.d.ts.map +1 -1
  188. package/build/modern/useQueries.cjs.map +1 -1
  189. package/build/modern/useQueries.d.cts +9 -6
  190. package/build/modern/useQueries.d.cts.map +1 -1
  191. package/build/modern/useQueries.d.ts +9 -6
  192. package/build/modern/useQueries.d.ts.map +1 -1
  193. package/build/modern/useQueries.js.map +1 -1
  194. package/build/modern/useQuery.cjs.map +1 -1
  195. package/build/modern/useQuery.d.cts +10 -6
  196. package/build/modern/useQuery.d.cts.map +1 -1
  197. package/build/modern/useQuery.d.ts +10 -6
  198. package/build/modern/useQuery.d.ts.map +1 -1
  199. package/build/modern/useQuery.js.map +1 -1
  200. package/build/modern/useSuspenseInfiniteQuery.d.cts +1 -2
  201. package/build/modern/useSuspenseInfiniteQuery.d.cts.map +1 -1
  202. package/build/modern/useSuspenseInfiniteQuery.d.ts +1 -2
  203. package/build/modern/useSuspenseInfiniteQuery.d.ts.map +1 -1
  204. package/build/modern/useSuspenseQueries.cjs.map +1 -1
  205. package/build/modern/useSuspenseQueries.d.cts +11 -8
  206. package/build/modern/useSuspenseQueries.d.cts.map +1 -1
  207. package/build/modern/useSuspenseQueries.d.ts +11 -8
  208. package/build/modern/useSuspenseQueries.d.ts.map +1 -1
  209. package/build/modern/useSuspenseQueries.js.map +1 -1
  210. package/build/modern/useSuspenseQuery.d.cts +1 -2
  211. package/build/modern/useSuspenseQuery.d.cts.map +1 -1
  212. package/build/modern/useSuspenseQuery.d.ts +1 -2
  213. package/build/modern/useSuspenseQuery.d.ts.map +1 -1
  214. package/build/modern/utils.d.cts +2 -3
  215. package/build/modern/utils.d.cts.map +1 -1
  216. package/build/modern/utils.d.ts +2 -3
  217. package/build/modern/utils.d.ts.map +1 -1
  218. package/package.json +9 -10
  219. package/src/infiniteQueryOptions.ts +1 -1
  220. package/src/queryOptions.ts +4 -4
  221. package/src/suspense.ts +1 -2
  222. package/src/types.ts +5 -4
  223. package/src/useBaseQuery.ts +3 -6
  224. package/src/useQueries.ts +6 -2
  225. package/src/useQuery.ts +7 -2
  226. package/src/useSuspenseQueries.ts +7 -3
  227. package/build/query-codemods/eslint.config.js +0 -25
  228. package/build/query-codemods/package.json +0 -38
  229. package/build/query-codemods/root.eslint.config.js +0 -113
  230. package/build/query-codemods/tsconfig.json +0 -8
  231. package/build/query-codemods/vite.config.ts +0 -30
  232. /package/build/codemods/{src/utils → utils}/index.cjs +0 -0
  233. /package/build/codemods/{src/utils → utils}/transformers/query-cache-transformer.cjs +0 -0
  234. /package/build/codemods/{src/utils → utils}/transformers/query-client-transformer.cjs +0 -0
  235. /package/build/codemods/{src/utils → utils}/transformers/use-query-like-transformer.cjs +0 -0
  236. /package/build/codemods/{src/v4 → v4}/key-transformation.cjs +0 -0
  237. /package/build/codemods/{src/v4 → v4}/replace-import-specifier.cjs +0 -0
  238. /package/build/codemods/{src/v4 → v4}/utils/replacers/key-replacer.cjs +0 -0
  239. /package/build/codemods/{src/v5 → v5}/is-loading/is-loading.cjs +0 -0
  240. /package/build/codemods/{src/v5 → v5}/keep-previous-data/README.md +0 -0
  241. /package/build/codemods/{src/v5 → v5}/keep-previous-data/keep-previous-data.cjs +0 -0
  242. /package/build/codemods/{src/v5 → v5}/keep-previous-data/utils/already-has-placeholder-data-property.cjs +0 -0
  243. /package/build/codemods/{src/v5 → v5}/remove-overloads/remove-overloads.cjs +0 -0
  244. /package/build/codemods/{src/v5 → v5}/remove-overloads/transformers/filter-aware-usage-transformer.cjs +0 -0
  245. /package/build/codemods/{src/v5 → v5}/remove-overloads/transformers/query-fn-aware-usage-transformer.cjs +0 -0
  246. /package/build/codemods/{src/v5 → v5}/remove-overloads/utils/index.cjs +0 -0
  247. /package/build/codemods/{src/v5 → v5}/remove-overloads/utils/unknown-usage-error.cjs +0 -0
  248. /package/build/codemods/{src/v5 → v5}/rename-hydrate/rename-hydrate.cjs +0 -0
  249. /package/build/codemods/{src/v5 → v5}/rename-properties/rename-properties.cjs +0 -0
@@ -4,7 +4,7 @@ import { DefaultError, DefinedInfiniteQueryObserverResult, DefinedQueryObserverR
4
4
  * {@link UseBaseQueryOptions} with all type parameters set to `any`, useful when the specific types aren't
5
5
  * relevant, e.g. when accepting options for any query in a helper function.
6
6
  */
7
- type AnyUseBaseQueryOptions = UseBaseQueryOptions<any, any, any, any, any>;
7
+ export type AnyUseBaseQueryOptions = UseBaseQueryOptions<any, any, any, any, any>;
8
8
  /**
9
9
  * The options shared by `useQuery` and `useSuspenseQuery`. Extends {@link QueryObserverOptions} from
10
10
  * `@tanstack/query-core` with the `preact-query`-specific `subscribed` option.
@@ -17,7 +17,7 @@ type AnyUseBaseQueryOptions = UseBaseQueryOptions<any, any, any, any, any>;
17
17
  * `placeholderData`. Defaults to, and is usually the same as, `TQueryFnData`.
18
18
  * @template TQueryKey - The type of your `queryKey`.
19
19
  */
20
- interface UseBaseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey> {
20
+ export interface UseBaseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey> {
21
21
  /**
22
22
  * Set this to `false` to unsubscribe this observer from updates to the query cache.
23
23
  *
@@ -37,7 +37,7 @@ interface UseBaseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TDa
37
37
  * `placeholderData`. Defaults to, and is usually the same as, `TQueryFnData`.
38
38
  * @template TQueryKey - The type of your `queryKey`.
39
39
  */
40
- type UsePrefetchQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = DistributiveOmit<QueryExecuteOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>, 'queryFn'> & {
40
+ export type UsePrefetchQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = DistributiveOmit<QueryExecuteOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>, 'queryFn'> & {
41
41
  /**
42
42
  * `skipToken` is not allowed as a value here — a prefetch always needs a query function to actually run,
43
43
  * unless a default query function has been defined.
@@ -56,7 +56,7 @@ type UsePrefetchQueryOptions<TQueryFnData = unknown, TError = DefaultError, TDat
56
56
  * @template TQueryKey - The type of your `queryKey`.
57
57
  * @template TPageParam - The type of the parameter passed to `queryFn` to fetch a given page.
58
58
  */
59
- type UsePrefetchInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = DistributiveOmit<InfiniteQueryExecuteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'queryFn'> & {
59
+ export type UsePrefetchInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = DistributiveOmit<InfiniteQueryExecuteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'queryFn'> & {
60
60
  /**
61
61
  * `skipToken` is not allowed as a value here — a prefetch always needs a query function to actually run,
62
62
  * unless a default query function has been defined.
@@ -67,7 +67,7 @@ type UsePrefetchInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultErr
67
67
  * {@link UseQueryOptions} with all type parameters set to `any`, useful when the specific types aren't
68
68
  * relevant, e.g. when accepting options for any query in a helper function.
69
69
  */
70
- type AnyUseQueryOptions = UseQueryOptions<any, any, any, any>;
70
+ export type AnyUseQueryOptions = UseQueryOptions<any, any, any, any>;
71
71
  /**
72
72
  * The options accepted by `useQuery`. Same as {@link UseBaseQueryOptions}, minus `suspense` (which
73
73
  * `preact-query` derives from which hook you call rather than exposing as an option).
@@ -78,12 +78,12 @@ type AnyUseQueryOptions = UseQueryOptions<any, any, any, any>;
78
78
  * `select` is used.
79
79
  * @template TQueryKey - The type of your `queryKey`.
80
80
  */
81
- interface UseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends OmitKeyof<UseBaseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>, 'suspense'> {}
81
+ export interface UseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends OmitKeyof<UseBaseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>, 'suspense'> {}
82
82
  /**
83
83
  * {@link UseSuspenseQueryOptions} with all type parameters set to `any`, useful when the specific types aren't
84
84
  * relevant, e.g. when accepting options for any query in a helper function.
85
85
  */
86
- type AnyUseSuspenseQueryOptions = UseSuspenseQueryOptions<any, any, any, any>;
86
+ export type AnyUseSuspenseQueryOptions = UseSuspenseQueryOptions<any, any, any, any>;
87
87
  /**
88
88
  * The options accepted by `useSuspenseQuery`. Same as {@link UseQueryOptions}, minus `enabled`, `throwOnError`,
89
89
  * and `placeholderData` — Suspense hooks cannot render a "disabled" or "placeholder" state, so those options
@@ -95,7 +95,7 @@ type AnyUseSuspenseQueryOptions = UseSuspenseQueryOptions<any, any, any, any>;
95
95
  * `select` is used.
96
96
  * @template TQueryKey - The type of your `queryKey`.
97
97
  */
98
- interface UseSuspenseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends OmitKeyof<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn' | 'enabled' | 'throwOnError' | 'placeholderData'> {
98
+ export interface UseSuspenseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends OmitKeyof<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn' | 'enabled' | 'throwOnError' | 'placeholderData'> {
99
99
  /**
100
100
  * `skipToken` is not allowed here — Suspense hooks cannot render a "disabled" state, so a query function
101
101
  * must always be provided, unless a default query function has been defined.
@@ -106,7 +106,7 @@ interface UseSuspenseQueryOptions<TQueryFnData = unknown, TError = DefaultError,
106
106
  * {@link UseInfiniteQueryOptions} with all type parameters set to `any`, useful when the specific types aren't
107
107
  * relevant, e.g. when accepting options for any query in a helper function.
108
108
  */
109
- type AnyUseInfiniteQueryOptions = UseInfiniteQueryOptions<any, any, any, any, any>;
109
+ export type AnyUseInfiniteQueryOptions = UseInfiniteQueryOptions<any, any, any, any, any>;
110
110
  /**
111
111
  * The options accepted by `useInfiniteQuery`. Extends {@link InfiniteQueryObserverOptions} from
112
112
  * `@tanstack/query-core` with the `preact-query`-specific `subscribed` option, minus `suspense` (which
@@ -119,7 +119,7 @@ type AnyUseInfiniteQueryOptions = UseInfiniteQueryOptions<any, any, any, any, an
119
119
  * @template TQueryKey - The type of your `queryKey`.
120
120
  * @template TPageParam - The type of the parameter passed to `queryFn` to fetch a given page.
121
121
  */
122
- interface UseInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'suspense'> {
122
+ export interface UseInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'suspense'> {
123
123
  /**
124
124
  * Set this to `false` to unsubscribe this observer from updates to the query cache.
125
125
  *
@@ -131,7 +131,7 @@ interface UseInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError,
131
131
  * {@link UseSuspenseInfiniteQueryOptions} with all type parameters set to `any`, useful when the specific types
132
132
  * aren't relevant, e.g. when accepting options for any query in a helper function.
133
133
  */
134
- type AnyUseSuspenseInfiniteQueryOptions = UseSuspenseInfiniteQueryOptions<any, any, any, any, any>;
134
+ export type AnyUseSuspenseInfiniteQueryOptions = UseSuspenseInfiniteQueryOptions<any, any, any, any, any>;
135
135
  /**
136
136
  * The options accepted by `useSuspenseInfiniteQuery`. Same as {@link UseInfiniteQueryOptions}, minus `enabled`,
137
137
  * `throwOnError`, and `placeholderData` — Suspense hooks cannot render a "disabled" or "placeholder" state, so
@@ -144,7 +144,7 @@ type AnyUseSuspenseInfiniteQueryOptions = UseSuspenseInfiniteQueryOptions<any, a
144
144
  * @template TQueryKey - The type of your `queryKey`.
145
145
  * @template TPageParam - The type of the parameter passed to `queryFn` to fetch a given page.
146
146
  */
147
- interface UseSuspenseInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'queryFn' | 'enabled' | 'throwOnError' | 'placeholderData'> {
147
+ export interface UseSuspenseInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'queryFn' | 'enabled' | 'throwOnError' | 'placeholderData'> {
148
148
  /**
149
149
  * `skipToken` is not allowed here — Suspense hooks cannot render a "disabled" state, so a query function
150
150
  * must always be provided, unless a default query function has been defined.
@@ -159,14 +159,14 @@ interface UseSuspenseInfiniteQueryOptions<TQueryFnData = unknown, TError = Defau
159
159
  * @template TData - The type `data` ends up as after `select` runs.
160
160
  * @template TError - The type of errors your `queryFn` may throw.
161
161
  */
162
- type UseBaseQueryResult<TData = unknown, TError = DefaultError> = QueryObserverResult<TData, TError>;
162
+ export type UseBaseQueryResult<TData = unknown, TError = DefaultError> = QueryObserverResult<TData, TError>;
163
163
  /**
164
164
  * The result of `useQuery`. Same as {@link UseBaseQueryResult}.
165
165
  *
166
166
  * @template TData - The type `data` ends up as after `select` runs.
167
167
  * @template TError - The type of errors your `queryFn` may throw.
168
168
  */
169
- type UseQueryResult<TData = unknown, TError = DefaultError> = UseBaseQueryResult<TData, TError>;
169
+ export type UseQueryResult<TData = unknown, TError = DefaultError> = UseBaseQueryResult<TData, TError>;
170
170
  /**
171
171
  * The result of `useSuspenseQuery`. Same as {@link DefinedUseQueryResult}, minus `isPlaceholderData` — always
172
172
  * `false` on that type, so this drops the dead field rather than an active state.
@@ -174,16 +174,16 @@ type UseQueryResult<TData = unknown, TError = DefaultError> = UseBaseQueryResult
174
174
  * @template TData - The type `data` ends up as after `select` runs.
175
175
  * @template TError - The type of errors your `queryFn` may throw.
176
176
  */
177
- type UseSuspenseQueryResult<TData = unknown, TError = DefaultError> = DistributiveOmit<DefinedQueryObserverResult<TData, TError>, 'isPlaceholderData'>;
177
+ export type UseSuspenseQueryResult<TData = unknown, TError = DefaultError> = DistributiveOmit<DefinedQueryObserverResult<TData, TError>, 'isPlaceholderData'>;
178
178
  /**
179
179
  * The result of `useQuery` when `initialData` is set, or of `useSuspenseQuery` before the `isPlaceholderData`
180
- * omission — `data` is never `undefined`. Re-exports {@link DefinedQueryObserverResult} from
181
- * `@tanstack/query-core`.
180
+ * omission — `data` is never `undefined` (unless a `select` changes `TData` to include `undefined`).
181
+ * Re-exports {@link DefinedQueryObserverResult} from `@tanstack/query-core`.
182
182
  *
183
183
  * @template TData - The type `data` ends up as after `select` runs.
184
184
  * @template TError - The type of errors your `queryFn` may throw.
185
185
  */
186
- type DefinedUseQueryResult<TData = unknown, TError = DefaultError> = DefinedQueryObserverResult<TData, TError>;
186
+ export type DefinedUseQueryResult<TData = unknown, TError = DefaultError> = DefinedQueryObserverResult<TData, TError>;
187
187
  /**
188
188
  * The result of `useInfiniteQuery` when `initialData` isn't set — `data` may be `undefined` while the query is
189
189
  * `pending`. Re-exports {@link InfiniteQueryObserverResult} from `@tanstack/query-core`.
@@ -191,15 +191,16 @@ type DefinedUseQueryResult<TData = unknown, TError = DefaultError> = DefinedQuer
191
191
  * @template TData - The type `data` ends up as after `select` runs.
192
192
  * @template TError - The type of errors your `queryFn` may throw.
193
193
  */
194
- type UseInfiniteQueryResult<TData = unknown, TError = DefaultError> = InfiniteQueryObserverResult<TData, TError>;
194
+ export type UseInfiniteQueryResult<TData = unknown, TError = DefaultError> = InfiniteQueryObserverResult<TData, TError>;
195
195
  /**
196
- * The result of `useInfiniteQuery` when `initialData` is set — `data` is never `undefined`. Re-exports
197
- * {@link DefinedInfiniteQueryObserverResult} from `@tanstack/query-core`.
196
+ * The result of `useInfiniteQuery` when `initialData` is set — `data` is never `undefined` (unless a
197
+ * `select` changes `TData` to include `undefined`). Re-exports {@link DefinedInfiniteQueryObserverResult}
198
+ * from `@tanstack/query-core`.
198
199
  *
199
200
  * @template TData - The type `data` ends up as after `select` runs.
200
201
  * @template TError - The type of errors your `queryFn` may throw.
201
202
  */
202
- type DefinedUseInfiniteQueryResult<TData = unknown, TError = DefaultError> = DefinedInfiniteQueryObserverResult<TData, TError>;
203
+ export type DefinedUseInfiniteQueryResult<TData = unknown, TError = DefaultError> = DefinedInfiniteQueryObserverResult<TData, TError>;
203
204
  /**
204
205
  * The result of `useSuspenseInfiniteQuery`. Same as {@link DefinedUseInfiniteQueryResult}, minus
205
206
  * `isPlaceholderData` — Suspense hooks never render placeholder data.
@@ -207,12 +208,12 @@ type DefinedUseInfiniteQueryResult<TData = unknown, TError = DefaultError> = Def
207
208
  * @template TData - The type `data` ends up as after `select` runs.
208
209
  * @template TError - The type of errors your `queryFn` may throw.
209
210
  */
210
- type UseSuspenseInfiniteQueryResult<TData = unknown, TError = DefaultError> = OmitKeyof<DefinedInfiniteQueryObserverResult<TData, TError>, 'isPlaceholderData'>;
211
+ export type UseSuspenseInfiniteQueryResult<TData = unknown, TError = DefaultError> = OmitKeyof<DefinedInfiniteQueryObserverResult<TData, TError>, 'isPlaceholderData'>;
211
212
  /**
212
213
  * {@link UseMutationOptions} with all type parameters set to `any`, useful when the specific types aren't
213
214
  * relevant, e.g. when accepting options for any mutation in a helper function.
214
215
  */
215
- type AnyUseMutationOptions = UseMutationOptions<any, any, any, any>;
216
+ export type AnyUseMutationOptions = UseMutationOptions<any, any, any, any>;
216
217
  /**
217
218
  * The options accepted by `useMutation`. Same as {@link MutationObserverOptions} from `@tanstack/query-core`,
218
219
  * minus the internal `_defaulted` flag.
@@ -223,7 +224,7 @@ type AnyUseMutationOptions = UseMutationOptions<any, any, any, any>;
223
224
  * @template TOnMutateResult - The type returned by `onMutate`, passed to `onSuccess`/`onError`/`onSettled` as
224
225
  * their `onMutateResult` parameter — useful for optimistic-update rollback data.
225
226
  */
226
- interface UseMutationOptions<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown> extends OmitKeyof<MutationObserverOptions<TData, TError, TVariables, TOnMutateResult>, '_defaulted'> {}
227
+ export interface UseMutationOptions<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown> extends OmitKeyof<MutationObserverOptions<TData, TError, TVariables, TOnMutateResult>, '_defaulted'> {}
227
228
  /**
228
229
  * The type of `mutate`, as returned by `useMutation`. Forwards the variables (and an optional per-call
229
230
  * `onSuccess`/`onError`/`onSettled`) to the underlying `mutate` call. Fire-and-forget — errors are surfaced
@@ -235,7 +236,7 @@ interface UseMutationOptions<TData = unknown, TError = DefaultError, TVariables
235
236
  * @template TOnMutateResult - The type returned by `onMutate`, passed to `onSuccess`/`onError`/`onSettled` as
236
237
  * their `onMutateResult` parameter — useful for optimistic-update rollback data.
237
238
  */
238
- type UseMutateFunction<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown> = (...args: Parameters<MutateFunction<TData, TError, TVariables, TOnMutateResult>>) => void;
239
+ export type UseMutateFunction<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown> = (...args: Parameters<MutateFunction<TData, TError, TVariables, TOnMutateResult>>) => void;
239
240
  /**
240
241
  * The type of `mutateAsync`, as returned by `useMutation`. Similar to {@link UseMutateFunction}, but returns a
241
242
  * promise which can be awaited.
@@ -246,7 +247,7 @@ type UseMutateFunction<TData = unknown, TError = DefaultError, TVariables = void
246
247
  * @template TOnMutateResult - The type returned by `onMutate`, passed to `onSuccess`/`onError`/`onSettled` as
247
248
  * their `onMutateResult` parameter — useful for optimistic-update rollback data.
248
249
  */
249
- type UseMutateAsyncFunction<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown> = MutateFunction<TData, TError, TVariables, TOnMutateResult>;
250
+ export type UseMutateAsyncFunction<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown> = MutateFunction<TData, TError, TVariables, TOnMutateResult>;
250
251
  /**
251
252
  * The result of `useMutation`. Same as {@link MutationObserverResult} from `@tanstack/query-core`, with
252
253
  * `mutate` narrowed to the fire-and-forget {@link UseMutateFunction} signature, plus the added `mutateAsync`.
@@ -257,7 +258,7 @@ type UseMutateAsyncFunction<TData = unknown, TError = DefaultError, TVariables =
257
258
  * @template TOnMutateResult - The type returned by `onMutate`, passed to `onSuccess`/`onError`/`onSettled` as
258
259
  * their `onMutateResult` parameter — useful for optimistic-update rollback data.
259
260
  */
260
- type UseBaseMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = Override<MutationObserverResult<TData, TError, TVariables, TOnMutateResult>, {
261
+ export type UseBaseMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = Override<MutationObserverResult<TData, TError, TVariables, TOnMutateResult>, {
261
262
  mutate: UseMutateFunction<TData, TError, TVariables, TOnMutateResult>;
262
263
  }> & {
263
264
  /**
@@ -274,7 +275,6 @@ type UseBaseMutationResult<TData = unknown, TError = DefaultError, TVariables =
274
275
  * @template TOnMutateResult - The type returned by `onMutate`, passed to `onSuccess`/`onError`/`onSettled` as
275
276
  * their `onMutateResult` parameter — useful for optimistic-update rollback data.
276
277
  */
277
- type UseMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = UseBaseMutationResult<TData, TError, TVariables, TOnMutateResult>;
278
+ export type UseMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = UseBaseMutationResult<TData, TError, TVariables, TOnMutateResult>;
278
279
  //#endregion
279
- export { AnyUseBaseQueryOptions, AnyUseInfiniteQueryOptions, AnyUseMutationOptions, AnyUseQueryOptions, AnyUseSuspenseInfiniteQueryOptions, AnyUseSuspenseQueryOptions, DefinedUseInfiniteQueryResult, DefinedUseQueryResult, UseBaseMutationResult, UseBaseQueryOptions, UseBaseQueryResult, UseInfiniteQueryOptions, UseInfiniteQueryResult, UseMutateAsyncFunction, UseMutateFunction, UseMutationOptions, UseMutationResult, UsePrefetchInfiniteQueryOptions, UsePrefetchQueryOptions, UseQueryOptions, UseQueryResult, UseSuspenseInfiniteQueryOptions, UseSuspenseInfiniteQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult };
280
280
  //# sourceMappingURL=types.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","names":[],"sources":["../../src/types.ts"],"mappings":";;;;;;KA0BY,yBAAyB;;;;;;;;;;;;;UAmBpB,oBACf,wBACA,SAAS,cACT,QAAQ,cACR,aAAa,cACb,kBAAkB,WAAW,kBACrB,qBACR,cACA,QACA,OACA,YACA;;;;;;EAOA;;;;;;;;;;;;;;KAeU,wBACV,wBACA,SAAS,cACT,QAAQ,cACR,aAAa,cACb,kBAAkB,WAAW,YAC3B,iBACF,oBAAoB,cAAc,QAAQ,OAAO,YAAY;;;;;EAO7D,UAAU,QACR,oBACE,cACA,QACA,OACA,cACA,uBAEF;;;;;;;;;;;;;;KAgBQ,gCACV,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,UAC7B,wBACE,iBACF,4BACE,cACA,QACA,OACA,WACA;;;;;EAQF,UAAU,QACR,4BACE,cACA,QACA,OACA,WACA,wBAEF;;;;;;KAQQ,qBAAqB;;;;;;;;;;;UAWhB,gBACf,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,kBACrB,UACR,oBAAoB,cAAc,QAAQ,OAAO,cAAc;;;;;KAQrD,6BAA6B;;;;;;;;;;;;UAiBxB,wBACf,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,kBACrB,UACR,gBAAgB,cAAc,QAAQ,OAAO;;;;;EAO7C,UAAU,QACR,gBAAgB,cAAc,QAAQ,OAAO,uBAC7C;;;;;;KAQQ,6BAA6B;;;;;;;;;;;;;UAmBxB,wBACf,wBACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,8BACQ,UACR,6BACE,cACA,QACA,OACA,WACA;;;;;;EASF;;;;;;KAOU,qCACV;;;;;;;;;;;;;UAae,gCACf,wBACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,8BACQ,UACR,wBAAwB,cAAc,QAAQ,OAAO,WAAW;;;;;EAOhE,UAAU,QACR,wBACE,cACA,QACA,OACA,WACA,wBAEF;;;;;;;;;;KAYQ,mBACV,iBACA,SAAS,gBACP,oBAAoB,OAAO;;;;;;;KAQnB,eACV,iBACA,SAAS,gBACP,mBAAmB,OAAO;;;;;;;;KASlB,uBACV,iBACA,SAAS,gBACP,iBACF,2BAA2B,OAAO;;;;;;;;;KAYxB,sBACV,iBACA,SAAS,gBACP,2BAA2B,OAAO;;;;;;;;KAS1B,uBACV,iBACA,SAAS,gBACP,4BAA4B,OAAO;;;;;;;;KAS3B,8BACV,iBACA,SAAS,gBACP,mCAAmC,OAAO;;;;;;;;KASlC,+BACV,iBACA,SAAS,gBACP,UACF,mCAAmC,OAAO;;;;;KAQhC,wBAAwB;;;;;;;;;;;UAWnB,mBACf,iBACA,SAAS,cACT,mBACA,mCACQ,UACR,wBAAwB,OAAO,QAAQ,YAAY;;;;;;;;;;;;KAezC,kBACV,iBACA,SAAS,cACT,mBACA,iCAEG,MAAM,WACP,eAAe,OAAO,QAAQ,YAAY;;;;;;;;;;;KAclC,uBACV,iBACA,SAAS,cACT,mBACA,6BACE,eAAe,OAAO,QAAQ,YAAY;;;;;;;;;;;KAYlC,sBACV,iBACA,SAAS,cACT,sBACA,6BACE,SACF,uBAAuB,OAAO,QAAQ,YAAY;EAChD,QAAQ,kBAAkB,OAAO,QAAQ,YAAY;;;;;EAKvD,aAAa,uBACX,OACA,QACA,YACA;;;;;;;;;;;KAaQ,kBACV,iBACA,SAAS,cACT,sBACA,6BACE,sBAAsB,OAAO,QAAQ,YAAY"}
1
+ {"version":3,"file":"types.d.cts","names":[],"sources":["../../src/types.ts"],"mappings":";;;;;;YA0BY,yBAAyB;;;;;;;;;;;;;iBAmBpB,oBACf,wBACA,SAAS,cACT,QAAQ,cACR,aAAa,cACb,kBAAkB,WAAW,kBACrB,qBACR,cACA,QACA,OACA,YACA;;;;;;EAOA;;;;;;;;;;;;;;YAeU,wBACV,wBACA,SAAS,cACT,QAAQ,cACR,aAAa,cACb,kBAAkB,WAAW,YAC3B,iBACF,oBAAoB,cAAc,QAAQ,OAAO,YAAY;;;;;EAO7D,UAAU,QACR,oBACE,cACA,QACA,OACA,cACA,uBAEF;;;;;;;;;;;;;;YAgBQ,gCACV,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,UAC7B,wBACE,iBACF,4BACE,cACA,QACA,OACA,WACA;;;;;EAQF,UAAU,QACR,4BACE,cACA,QACA,OACA,WACA,wBAEF;;;;;;YAQQ,qBAAqB;;;;;;;;;;;iBAWhB,gBACf,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,kBACrB,UACR,oBAAoB,cAAc,QAAQ,OAAO,cAAc;;;;;YAQrD,6BAA6B;;;;;;;;;;;;iBAiBxB,wBACf,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,kBACrB,UACR,gBAAgB,cAAc,QAAQ,OAAO;;;;;EAO7C,UAAU,QACR,gBAAgB,cAAc,QAAQ,OAAO,uBAC7C;;;;;;YAQQ,6BAA6B;;;;;;;;;;;;;iBAmBxB,wBACf,wBACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,8BACQ,UACR,6BACE,cACA,QACA,OACA,WACA;;;;;;EASF;;;;;;YAOU,qCACV;;;;;;;;;;;;;iBAae,gCACf,wBACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,8BACQ,UACR,wBAAwB,cAAc,QAAQ,OAAO,WAAW;;;;;EAOhE,UAAU,QACR,wBACE,cACA,QACA,OACA,WACA,wBAEF;;;;;;;;;;YAYQ,mBACV,iBACA,SAAS,gBACP,oBAAoB,OAAO;;;;;;;YAQnB,eACV,iBACA,SAAS,gBACP,mBAAmB,OAAO;;;;;;;;YASlB,uBACV,iBACA,SAAS,gBACP,iBACF,2BAA2B,OAAO;;;;;;;;;YAYxB,sBACV,iBACA,SAAS,gBACP,2BAA2B,OAAO;;;;;;;;YAS1B,uBACV,iBACA,SAAS,gBACP,4BAA4B,OAAO;;;;;;;;;YAU3B,8BACV,iBACA,SAAS,gBACP,mCAAmC,OAAO;;;;;;;;YASlC,+BACV,iBACA,SAAS,gBACP,UACF,mCAAmC,OAAO;;;;;YAQhC,wBAAwB;;;;;;;;;;;iBAWnB,mBACf,iBACA,SAAS,cACT,mBACA,mCACQ,UACR,wBAAwB,OAAO,QAAQ,YAAY;;;;;;;;;;;;YAezC,kBACV,iBACA,SAAS,cACT,mBACA,iCAEG,MAAM,WACP,eAAe,OAAO,QAAQ,YAAY;;;;;;;;;;;YAclC,uBACV,iBACA,SAAS,cACT,mBACA,6BACE,eAAe,OAAO,QAAQ,YAAY;;;;;;;;;;;YAYlC,sBACV,iBACA,SAAS,cACT,sBACA,6BACE,SACF,uBAAuB,OAAO,QAAQ,YAAY;EAChD,QAAQ,kBAAkB,OAAO,QAAQ,YAAY;;;;;EAKvD,aAAa,uBACX,OACA,QACA,YACA;;;;;;;;;;;YAaQ,kBACV,iBACA,SAAS,cACT,sBACA,6BACE,sBAAsB,OAAO,QAAQ,YAAY"}
@@ -4,7 +4,7 @@ import { DefaultError, DefinedInfiniteQueryObserverResult, DefinedQueryObserverR
4
4
  * {@link UseBaseQueryOptions} with all type parameters set to `any`, useful when the specific types aren't
5
5
  * relevant, e.g. when accepting options for any query in a helper function.
6
6
  */
7
- type AnyUseBaseQueryOptions = UseBaseQueryOptions<any, any, any, any, any>;
7
+ export type AnyUseBaseQueryOptions = UseBaseQueryOptions<any, any, any, any, any>;
8
8
  /**
9
9
  * The options shared by `useQuery` and `useSuspenseQuery`. Extends {@link QueryObserverOptions} from
10
10
  * `@tanstack/query-core` with the `preact-query`-specific `subscribed` option.
@@ -17,7 +17,7 @@ type AnyUseBaseQueryOptions = UseBaseQueryOptions<any, any, any, any, any>;
17
17
  * `placeholderData`. Defaults to, and is usually the same as, `TQueryFnData`.
18
18
  * @template TQueryKey - The type of your `queryKey`.
19
19
  */
20
- interface UseBaseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey> {
20
+ export interface UseBaseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey> {
21
21
  /**
22
22
  * Set this to `false` to unsubscribe this observer from updates to the query cache.
23
23
  *
@@ -37,7 +37,7 @@ interface UseBaseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TDa
37
37
  * `placeholderData`. Defaults to, and is usually the same as, `TQueryFnData`.
38
38
  * @template TQueryKey - The type of your `queryKey`.
39
39
  */
40
- type UsePrefetchQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = DistributiveOmit<QueryExecuteOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>, 'queryFn'> & {
40
+ export type UsePrefetchQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = DistributiveOmit<QueryExecuteOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>, 'queryFn'> & {
41
41
  /**
42
42
  * `skipToken` is not allowed as a value here — a prefetch always needs a query function to actually run,
43
43
  * unless a default query function has been defined.
@@ -56,7 +56,7 @@ type UsePrefetchQueryOptions<TQueryFnData = unknown, TError = DefaultError, TDat
56
56
  * @template TQueryKey - The type of your `queryKey`.
57
57
  * @template TPageParam - The type of the parameter passed to `queryFn` to fetch a given page.
58
58
  */
59
- type UsePrefetchInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = DistributiveOmit<InfiniteQueryExecuteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'queryFn'> & {
59
+ export type UsePrefetchInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = DistributiveOmit<InfiniteQueryExecuteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'queryFn'> & {
60
60
  /**
61
61
  * `skipToken` is not allowed as a value here — a prefetch always needs a query function to actually run,
62
62
  * unless a default query function has been defined.
@@ -67,7 +67,7 @@ type UsePrefetchInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultErr
67
67
  * {@link UseQueryOptions} with all type parameters set to `any`, useful when the specific types aren't
68
68
  * relevant, e.g. when accepting options for any query in a helper function.
69
69
  */
70
- type AnyUseQueryOptions = UseQueryOptions<any, any, any, any>;
70
+ export type AnyUseQueryOptions = UseQueryOptions<any, any, any, any>;
71
71
  /**
72
72
  * The options accepted by `useQuery`. Same as {@link UseBaseQueryOptions}, minus `suspense` (which
73
73
  * `preact-query` derives from which hook you call rather than exposing as an option).
@@ -78,12 +78,12 @@ type AnyUseQueryOptions = UseQueryOptions<any, any, any, any>;
78
78
  * `select` is used.
79
79
  * @template TQueryKey - The type of your `queryKey`.
80
80
  */
81
- interface UseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends OmitKeyof<UseBaseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>, 'suspense'> {}
81
+ export interface UseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends OmitKeyof<UseBaseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>, 'suspense'> {}
82
82
  /**
83
83
  * {@link UseSuspenseQueryOptions} with all type parameters set to `any`, useful when the specific types aren't
84
84
  * relevant, e.g. when accepting options for any query in a helper function.
85
85
  */
86
- type AnyUseSuspenseQueryOptions = UseSuspenseQueryOptions<any, any, any, any>;
86
+ export type AnyUseSuspenseQueryOptions = UseSuspenseQueryOptions<any, any, any, any>;
87
87
  /**
88
88
  * The options accepted by `useSuspenseQuery`. Same as {@link UseQueryOptions}, minus `enabled`, `throwOnError`,
89
89
  * and `placeholderData` — Suspense hooks cannot render a "disabled" or "placeholder" state, so those options
@@ -95,7 +95,7 @@ type AnyUseSuspenseQueryOptions = UseSuspenseQueryOptions<any, any, any, any>;
95
95
  * `select` is used.
96
96
  * @template TQueryKey - The type of your `queryKey`.
97
97
  */
98
- interface UseSuspenseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends OmitKeyof<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn' | 'enabled' | 'throwOnError' | 'placeholderData'> {
98
+ export interface UseSuspenseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends OmitKeyof<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn' | 'enabled' | 'throwOnError' | 'placeholderData'> {
99
99
  /**
100
100
  * `skipToken` is not allowed here — Suspense hooks cannot render a "disabled" state, so a query function
101
101
  * must always be provided, unless a default query function has been defined.
@@ -106,7 +106,7 @@ interface UseSuspenseQueryOptions<TQueryFnData = unknown, TError = DefaultError,
106
106
  * {@link UseInfiniteQueryOptions} with all type parameters set to `any`, useful when the specific types aren't
107
107
  * relevant, e.g. when accepting options for any query in a helper function.
108
108
  */
109
- type AnyUseInfiniteQueryOptions = UseInfiniteQueryOptions<any, any, any, any, any>;
109
+ export type AnyUseInfiniteQueryOptions = UseInfiniteQueryOptions<any, any, any, any, any>;
110
110
  /**
111
111
  * The options accepted by `useInfiniteQuery`. Extends {@link InfiniteQueryObserverOptions} from
112
112
  * `@tanstack/query-core` with the `preact-query`-specific `subscribed` option, minus `suspense` (which
@@ -119,7 +119,7 @@ type AnyUseInfiniteQueryOptions = UseInfiniteQueryOptions<any, any, any, any, an
119
119
  * @template TQueryKey - The type of your `queryKey`.
120
120
  * @template TPageParam - The type of the parameter passed to `queryFn` to fetch a given page.
121
121
  */
122
- interface UseInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'suspense'> {
122
+ export interface UseInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'suspense'> {
123
123
  /**
124
124
  * Set this to `false` to unsubscribe this observer from updates to the query cache.
125
125
  *
@@ -131,7 +131,7 @@ interface UseInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError,
131
131
  * {@link UseSuspenseInfiniteQueryOptions} with all type parameters set to `any`, useful when the specific types
132
132
  * aren't relevant, e.g. when accepting options for any query in a helper function.
133
133
  */
134
- type AnyUseSuspenseInfiniteQueryOptions = UseSuspenseInfiniteQueryOptions<any, any, any, any, any>;
134
+ export type AnyUseSuspenseInfiniteQueryOptions = UseSuspenseInfiniteQueryOptions<any, any, any, any, any>;
135
135
  /**
136
136
  * The options accepted by `useSuspenseInfiniteQuery`. Same as {@link UseInfiniteQueryOptions}, minus `enabled`,
137
137
  * `throwOnError`, and `placeholderData` — Suspense hooks cannot render a "disabled" or "placeholder" state, so
@@ -144,7 +144,7 @@ type AnyUseSuspenseInfiniteQueryOptions = UseSuspenseInfiniteQueryOptions<any, a
144
144
  * @template TQueryKey - The type of your `queryKey`.
145
145
  * @template TPageParam - The type of the parameter passed to `queryFn` to fetch a given page.
146
146
  */
147
- interface UseSuspenseInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'queryFn' | 'enabled' | 'throwOnError' | 'placeholderData'> {
147
+ export interface UseSuspenseInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'queryFn' | 'enabled' | 'throwOnError' | 'placeholderData'> {
148
148
  /**
149
149
  * `skipToken` is not allowed here — Suspense hooks cannot render a "disabled" state, so a query function
150
150
  * must always be provided, unless a default query function has been defined.
@@ -159,14 +159,14 @@ interface UseSuspenseInfiniteQueryOptions<TQueryFnData = unknown, TError = Defau
159
159
  * @template TData - The type `data` ends up as after `select` runs.
160
160
  * @template TError - The type of errors your `queryFn` may throw.
161
161
  */
162
- type UseBaseQueryResult<TData = unknown, TError = DefaultError> = QueryObserverResult<TData, TError>;
162
+ export type UseBaseQueryResult<TData = unknown, TError = DefaultError> = QueryObserverResult<TData, TError>;
163
163
  /**
164
164
  * The result of `useQuery`. Same as {@link UseBaseQueryResult}.
165
165
  *
166
166
  * @template TData - The type `data` ends up as after `select` runs.
167
167
  * @template TError - The type of errors your `queryFn` may throw.
168
168
  */
169
- type UseQueryResult<TData = unknown, TError = DefaultError> = UseBaseQueryResult<TData, TError>;
169
+ export type UseQueryResult<TData = unknown, TError = DefaultError> = UseBaseQueryResult<TData, TError>;
170
170
  /**
171
171
  * The result of `useSuspenseQuery`. Same as {@link DefinedUseQueryResult}, minus `isPlaceholderData` — always
172
172
  * `false` on that type, so this drops the dead field rather than an active state.
@@ -174,16 +174,16 @@ type UseQueryResult<TData = unknown, TError = DefaultError> = UseBaseQueryResult
174
174
  * @template TData - The type `data` ends up as after `select` runs.
175
175
  * @template TError - The type of errors your `queryFn` may throw.
176
176
  */
177
- type UseSuspenseQueryResult<TData = unknown, TError = DefaultError> = DistributiveOmit<DefinedQueryObserverResult<TData, TError>, 'isPlaceholderData'>;
177
+ export type UseSuspenseQueryResult<TData = unknown, TError = DefaultError> = DistributiveOmit<DefinedQueryObserverResult<TData, TError>, 'isPlaceholderData'>;
178
178
  /**
179
179
  * The result of `useQuery` when `initialData` is set, or of `useSuspenseQuery` before the `isPlaceholderData`
180
- * omission — `data` is never `undefined`. Re-exports {@link DefinedQueryObserverResult} from
181
- * `@tanstack/query-core`.
180
+ * omission — `data` is never `undefined` (unless a `select` changes `TData` to include `undefined`).
181
+ * Re-exports {@link DefinedQueryObserverResult} from `@tanstack/query-core`.
182
182
  *
183
183
  * @template TData - The type `data` ends up as after `select` runs.
184
184
  * @template TError - The type of errors your `queryFn` may throw.
185
185
  */
186
- type DefinedUseQueryResult<TData = unknown, TError = DefaultError> = DefinedQueryObserverResult<TData, TError>;
186
+ export type DefinedUseQueryResult<TData = unknown, TError = DefaultError> = DefinedQueryObserverResult<TData, TError>;
187
187
  /**
188
188
  * The result of `useInfiniteQuery` when `initialData` isn't set — `data` may be `undefined` while the query is
189
189
  * `pending`. Re-exports {@link InfiniteQueryObserverResult} from `@tanstack/query-core`.
@@ -191,15 +191,16 @@ type DefinedUseQueryResult<TData = unknown, TError = DefaultError> = DefinedQuer
191
191
  * @template TData - The type `data` ends up as after `select` runs.
192
192
  * @template TError - The type of errors your `queryFn` may throw.
193
193
  */
194
- type UseInfiniteQueryResult<TData = unknown, TError = DefaultError> = InfiniteQueryObserverResult<TData, TError>;
194
+ export type UseInfiniteQueryResult<TData = unknown, TError = DefaultError> = InfiniteQueryObserverResult<TData, TError>;
195
195
  /**
196
- * The result of `useInfiniteQuery` when `initialData` is set — `data` is never `undefined`. Re-exports
197
- * {@link DefinedInfiniteQueryObserverResult} from `@tanstack/query-core`.
196
+ * The result of `useInfiniteQuery` when `initialData` is set — `data` is never `undefined` (unless a
197
+ * `select` changes `TData` to include `undefined`). Re-exports {@link DefinedInfiniteQueryObserverResult}
198
+ * from `@tanstack/query-core`.
198
199
  *
199
200
  * @template TData - The type `data` ends up as after `select` runs.
200
201
  * @template TError - The type of errors your `queryFn` may throw.
201
202
  */
202
- type DefinedUseInfiniteQueryResult<TData = unknown, TError = DefaultError> = DefinedInfiniteQueryObserverResult<TData, TError>;
203
+ export type DefinedUseInfiniteQueryResult<TData = unknown, TError = DefaultError> = DefinedInfiniteQueryObserverResult<TData, TError>;
203
204
  /**
204
205
  * The result of `useSuspenseInfiniteQuery`. Same as {@link DefinedUseInfiniteQueryResult}, minus
205
206
  * `isPlaceholderData` — Suspense hooks never render placeholder data.
@@ -207,12 +208,12 @@ type DefinedUseInfiniteQueryResult<TData = unknown, TError = DefaultError> = Def
207
208
  * @template TData - The type `data` ends up as after `select` runs.
208
209
  * @template TError - The type of errors your `queryFn` may throw.
209
210
  */
210
- type UseSuspenseInfiniteQueryResult<TData = unknown, TError = DefaultError> = OmitKeyof<DefinedInfiniteQueryObserverResult<TData, TError>, 'isPlaceholderData'>;
211
+ export type UseSuspenseInfiniteQueryResult<TData = unknown, TError = DefaultError> = OmitKeyof<DefinedInfiniteQueryObserverResult<TData, TError>, 'isPlaceholderData'>;
211
212
  /**
212
213
  * {@link UseMutationOptions} with all type parameters set to `any`, useful when the specific types aren't
213
214
  * relevant, e.g. when accepting options for any mutation in a helper function.
214
215
  */
215
- type AnyUseMutationOptions = UseMutationOptions<any, any, any, any>;
216
+ export type AnyUseMutationOptions = UseMutationOptions<any, any, any, any>;
216
217
  /**
217
218
  * The options accepted by `useMutation`. Same as {@link MutationObserverOptions} from `@tanstack/query-core`,
218
219
  * minus the internal `_defaulted` flag.
@@ -223,7 +224,7 @@ type AnyUseMutationOptions = UseMutationOptions<any, any, any, any>;
223
224
  * @template TOnMutateResult - The type returned by `onMutate`, passed to `onSuccess`/`onError`/`onSettled` as
224
225
  * their `onMutateResult` parameter — useful for optimistic-update rollback data.
225
226
  */
226
- interface UseMutationOptions<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown> extends OmitKeyof<MutationObserverOptions<TData, TError, TVariables, TOnMutateResult>, '_defaulted'> {}
227
+ export interface UseMutationOptions<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown> extends OmitKeyof<MutationObserverOptions<TData, TError, TVariables, TOnMutateResult>, '_defaulted'> {}
227
228
  /**
228
229
  * The type of `mutate`, as returned by `useMutation`. Forwards the variables (and an optional per-call
229
230
  * `onSuccess`/`onError`/`onSettled`) to the underlying `mutate` call. Fire-and-forget — errors are surfaced
@@ -235,7 +236,7 @@ interface UseMutationOptions<TData = unknown, TError = DefaultError, TVariables
235
236
  * @template TOnMutateResult - The type returned by `onMutate`, passed to `onSuccess`/`onError`/`onSettled` as
236
237
  * their `onMutateResult` parameter — useful for optimistic-update rollback data.
237
238
  */
238
- type UseMutateFunction<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown> = (...args: Parameters<MutateFunction<TData, TError, TVariables, TOnMutateResult>>) => void;
239
+ export type UseMutateFunction<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown> = (...args: Parameters<MutateFunction<TData, TError, TVariables, TOnMutateResult>>) => void;
239
240
  /**
240
241
  * The type of `mutateAsync`, as returned by `useMutation`. Similar to {@link UseMutateFunction}, but returns a
241
242
  * promise which can be awaited.
@@ -246,7 +247,7 @@ type UseMutateFunction<TData = unknown, TError = DefaultError, TVariables = void
246
247
  * @template TOnMutateResult - The type returned by `onMutate`, passed to `onSuccess`/`onError`/`onSettled` as
247
248
  * their `onMutateResult` parameter — useful for optimistic-update rollback data.
248
249
  */
249
- type UseMutateAsyncFunction<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown> = MutateFunction<TData, TError, TVariables, TOnMutateResult>;
250
+ export type UseMutateAsyncFunction<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown> = MutateFunction<TData, TError, TVariables, TOnMutateResult>;
250
251
  /**
251
252
  * The result of `useMutation`. Same as {@link MutationObserverResult} from `@tanstack/query-core`, with
252
253
  * `mutate` narrowed to the fire-and-forget {@link UseMutateFunction} signature, plus the added `mutateAsync`.
@@ -257,7 +258,7 @@ type UseMutateAsyncFunction<TData = unknown, TError = DefaultError, TVariables =
257
258
  * @template TOnMutateResult - The type returned by `onMutate`, passed to `onSuccess`/`onError`/`onSettled` as
258
259
  * their `onMutateResult` parameter — useful for optimistic-update rollback data.
259
260
  */
260
- type UseBaseMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = Override<MutationObserverResult<TData, TError, TVariables, TOnMutateResult>, {
261
+ export type UseBaseMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = Override<MutationObserverResult<TData, TError, TVariables, TOnMutateResult>, {
261
262
  mutate: UseMutateFunction<TData, TError, TVariables, TOnMutateResult>;
262
263
  }> & {
263
264
  /**
@@ -274,7 +275,6 @@ type UseBaseMutationResult<TData = unknown, TError = DefaultError, TVariables =
274
275
  * @template TOnMutateResult - The type returned by `onMutate`, passed to `onSuccess`/`onError`/`onSettled` as
275
276
  * their `onMutateResult` parameter — useful for optimistic-update rollback data.
276
277
  */
277
- type UseMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = UseBaseMutationResult<TData, TError, TVariables, TOnMutateResult>;
278
+ export type UseMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = UseBaseMutationResult<TData, TError, TVariables, TOnMutateResult>;
278
279
  //#endregion
279
- export { AnyUseBaseQueryOptions, AnyUseInfiniteQueryOptions, AnyUseMutationOptions, AnyUseQueryOptions, AnyUseSuspenseInfiniteQueryOptions, AnyUseSuspenseQueryOptions, DefinedUseInfiniteQueryResult, DefinedUseQueryResult, UseBaseMutationResult, UseBaseQueryOptions, UseBaseQueryResult, UseInfiniteQueryOptions, UseInfiniteQueryResult, UseMutateAsyncFunction, UseMutateFunction, UseMutationOptions, UseMutationResult, UsePrefetchInfiniteQueryOptions, UsePrefetchQueryOptions, UseQueryOptions, UseQueryResult, UseSuspenseInfiniteQueryOptions, UseSuspenseInfiniteQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult };
280
280
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../../src/types.ts"],"mappings":";;;;;;KA0BY,yBAAyB;;;;;;;;;;;;;UAmBpB,oBACf,wBACA,SAAS,cACT,QAAQ,cACR,aAAa,cACb,kBAAkB,WAAW,kBACrB,qBACR,cACA,QACA,OACA,YACA;;;;;;EAOA;;;;;;;;;;;;;;KAeU,wBACV,wBACA,SAAS,cACT,QAAQ,cACR,aAAa,cACb,kBAAkB,WAAW,YAC3B,iBACF,oBAAoB,cAAc,QAAQ,OAAO,YAAY;;;;;EAO7D,UAAU,QACR,oBACE,cACA,QACA,OACA,cACA,uBAEF;;;;;;;;;;;;;;KAgBQ,gCACV,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,UAC7B,wBACE,iBACF,4BACE,cACA,QACA,OACA,WACA;;;;;EAQF,UAAU,QACR,4BACE,cACA,QACA,OACA,WACA,wBAEF;;;;;;KAQQ,qBAAqB;;;;;;;;;;;UAWhB,gBACf,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,kBACrB,UACR,oBAAoB,cAAc,QAAQ,OAAO,cAAc;;;;;KAQrD,6BAA6B;;;;;;;;;;;;UAiBxB,wBACf,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,kBACrB,UACR,gBAAgB,cAAc,QAAQ,OAAO;;;;;EAO7C,UAAU,QACR,gBAAgB,cAAc,QAAQ,OAAO,uBAC7C;;;;;;KAQQ,6BAA6B;;;;;;;;;;;;;UAmBxB,wBACf,wBACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,8BACQ,UACR,6BACE,cACA,QACA,OACA,WACA;;;;;;EASF;;;;;;KAOU,qCACV;;;;;;;;;;;;;UAae,gCACf,wBACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,8BACQ,UACR,wBAAwB,cAAc,QAAQ,OAAO,WAAW;;;;;EAOhE,UAAU,QACR,wBACE,cACA,QACA,OACA,WACA,wBAEF;;;;;;;;;;KAYQ,mBACV,iBACA,SAAS,gBACP,oBAAoB,OAAO;;;;;;;KAQnB,eACV,iBACA,SAAS,gBACP,mBAAmB,OAAO;;;;;;;;KASlB,uBACV,iBACA,SAAS,gBACP,iBACF,2BAA2B,OAAO;;;;;;;;;KAYxB,sBACV,iBACA,SAAS,gBACP,2BAA2B,OAAO;;;;;;;;KAS1B,uBACV,iBACA,SAAS,gBACP,4BAA4B,OAAO;;;;;;;;KAS3B,8BACV,iBACA,SAAS,gBACP,mCAAmC,OAAO;;;;;;;;KASlC,+BACV,iBACA,SAAS,gBACP,UACF,mCAAmC,OAAO;;;;;KAQhC,wBAAwB;;;;;;;;;;;UAWnB,mBACf,iBACA,SAAS,cACT,mBACA,mCACQ,UACR,wBAAwB,OAAO,QAAQ,YAAY;;;;;;;;;;;;KAezC,kBACV,iBACA,SAAS,cACT,mBACA,iCAEG,MAAM,WACP,eAAe,OAAO,QAAQ,YAAY;;;;;;;;;;;KAclC,uBACV,iBACA,SAAS,cACT,mBACA,6BACE,eAAe,OAAO,QAAQ,YAAY;;;;;;;;;;;KAYlC,sBACV,iBACA,SAAS,cACT,sBACA,6BACE,SACF,uBAAuB,OAAO,QAAQ,YAAY;EAChD,QAAQ,kBAAkB,OAAO,QAAQ,YAAY;;;;;EAKvD,aAAa,uBACX,OACA,QACA,YACA;;;;;;;;;;;KAaQ,kBACV,iBACA,SAAS,cACT,sBACA,6BACE,sBAAsB,OAAO,QAAQ,YAAY"}
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../../src/types.ts"],"mappings":";;;;;;YA0BY,yBAAyB;;;;;;;;;;;;;iBAmBpB,oBACf,wBACA,SAAS,cACT,QAAQ,cACR,aAAa,cACb,kBAAkB,WAAW,kBACrB,qBACR,cACA,QACA,OACA,YACA;;;;;;EAOA;;;;;;;;;;;;;;YAeU,wBACV,wBACA,SAAS,cACT,QAAQ,cACR,aAAa,cACb,kBAAkB,WAAW,YAC3B,iBACF,oBAAoB,cAAc,QAAQ,OAAO,YAAY;;;;;EAO7D,UAAU,QACR,oBACE,cACA,QACA,OACA,cACA,uBAEF;;;;;;;;;;;;;;YAgBQ,gCACV,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,UAC7B,wBACE,iBACF,4BACE,cACA,QACA,OACA,WACA;;;;;EAQF,UAAU,QACR,4BACE,cACA,QACA,OACA,WACA,wBAEF;;;;;;YAQQ,qBAAqB;;;;;;;;;;;iBAWhB,gBACf,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,kBACrB,UACR,oBAAoB,cAAc,QAAQ,OAAO,cAAc;;;;;YAQrD,6BAA6B;;;;;;;;;;;;iBAiBxB,wBACf,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,kBACrB,UACR,gBAAgB,cAAc,QAAQ,OAAO;;;;;EAO7C,UAAU,QACR,gBAAgB,cAAc,QAAQ,OAAO,uBAC7C;;;;;;YAQQ,6BAA6B;;;;;;;;;;;;;iBAmBxB,wBACf,wBACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,8BACQ,UACR,6BACE,cACA,QACA,OACA,WACA;;;;;;EASF;;;;;;YAOU,qCACV;;;;;;;;;;;;;iBAae,gCACf,wBACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,8BACQ,UACR,wBAAwB,cAAc,QAAQ,OAAO,WAAW;;;;;EAOhE,UAAU,QACR,wBACE,cACA,QACA,OACA,WACA,wBAEF;;;;;;;;;;YAYQ,mBACV,iBACA,SAAS,gBACP,oBAAoB,OAAO;;;;;;;YAQnB,eACV,iBACA,SAAS,gBACP,mBAAmB,OAAO;;;;;;;;YASlB,uBACV,iBACA,SAAS,gBACP,iBACF,2BAA2B,OAAO;;;;;;;;;YAYxB,sBACV,iBACA,SAAS,gBACP,2BAA2B,OAAO;;;;;;;;YAS1B,uBACV,iBACA,SAAS,gBACP,4BAA4B,OAAO;;;;;;;;;YAU3B,8BACV,iBACA,SAAS,gBACP,mCAAmC,OAAO;;;;;;;;YASlC,+BACV,iBACA,SAAS,gBACP,UACF,mCAAmC,OAAO;;;;;YAQhC,wBAAwB;;;;;;;;;;;iBAWnB,mBACf,iBACA,SAAS,cACT,mBACA,mCACQ,UACR,wBAAwB,OAAO,QAAQ,YAAY;;;;;;;;;;;;YAezC,kBACV,iBACA,SAAS,cACT,mBACA,iCAEG,MAAM,WACP,eAAe,OAAO,QAAQ,YAAY;;;;;;;;;;;YAclC,uBACV,iBACA,SAAS,cACT,mBACA,6BACE,eAAe,OAAO,QAAQ,YAAY;;;;;;;;;;;YAYlC,sBACV,iBACA,SAAS,cACT,sBACA,6BACE,SACF,uBAAuB,OAAO,QAAQ,YAAY;EAChD,QAAQ,kBAAkB,OAAO,QAAQ,YAAY;;;;;EAKvD,aAAa,uBACX,OACA,QACA,YACA;;;;;;;;;;;YAaQ,kBACV,iBACA,SAAS,cACT,sBACA,6BACE,sBAAsB,OAAO,QAAQ,YAAY"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../src/types.ts"],"sourcesContent":["/* istanbul ignore file */\nimport type {\n DefaultError,\n DefinedInfiniteQueryObserverResult,\n DefinedQueryObserverResult,\n DistributiveOmit,\n InfiniteData,\n InfiniteQueryExecuteOptions,\n InfiniteQueryObserverOptions,\n InfiniteQueryObserverResult,\n MutateFunction,\n MutationObserverOptions,\n MutationObserverResult,\n OmitKeyof,\n Override,\n QueryExecuteOptions,\n QueryKey,\n QueryObserverOptions,\n QueryObserverResult,\n SkipToken,\n} from '@tanstack/query-core'\n\n/**\n * {@link UseBaseQueryOptions} with all type parameters set to `any`, useful when the specific types aren't\n * relevant, e.g. when accepting options for any query in a helper function.\n */\nexport type AnyUseBaseQueryOptions = UseBaseQueryOptions<\n any,\n any,\n any,\n any,\n any\n>\n/**\n * The options shared by `useQuery` and `useSuspenseQuery`. Extends {@link QueryObserverOptions} from\n * `@tanstack/query-core` with the `preact-query`-specific `subscribed` option.\n *\n * @template TQueryFnData - The type your `queryFn` resolves to.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs. Defaults to `TQueryFnData` when no\n * `select` is used.\n * @template TQueryData - The type of the data actually held in the query cache — the input to `select` and\n * `placeholderData`. Defaults to, and is usually the same as, `TQueryFnData`.\n * @template TQueryKey - The type of your `queryKey`.\n */\nexport interface UseBaseQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> extends QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n> {\n /**\n * Set this to `false` to unsubscribe this observer from updates to the query cache.\n *\n * @defaultValue true\n */\n subscribed?: boolean\n}\n\n/**\n * The options accepted by `usePrefetchQuery` — everything you can pass to `queryClient.query`, except `queryFn`\n * is required unless a default query function has been defined.\n *\n * @template TQueryFnData - The type your `queryFn` resolves to.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs. Defaults to `TQueryFnData` when no\n * `select` is used.\n * @template TQueryData - The type of the data actually held in the query cache — the input to `select` and\n * `placeholderData`. Defaults to, and is usually the same as, `TQueryFnData`.\n * @template TQueryKey - The type of your `queryKey`.\n */\nexport type UsePrefetchQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = DistributiveOmit<\n QueryExecuteOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>,\n 'queryFn'\n> & {\n /**\n * `skipToken` is not allowed as a value here — a prefetch always needs a query function to actually run,\n * unless a default query function has been defined.\n */\n queryFn?: Exclude<\n QueryExecuteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryFnData,\n TQueryKey\n >['queryFn'],\n SkipToken\n >\n}\n\n/**\n * The options accepted by `usePrefetchInfiniteQuery` — everything you can pass to `queryClient.infiniteQuery`,\n * except `queryFn` is required unless a default query function has been defined.\n *\n * @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs. Defaults to `TQueryFnData` (a single page)\n * here, since a prefetch never reads `data` back out — this parameter only matters if you reuse these options\n * elsewhere with `select` applied.\n * @template TQueryKey - The type of your `queryKey`.\n * @template TPageParam - The type of the parameter passed to `queryFn` to fetch a given page.\n */\nexport type UsePrefetchInfiniteQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = DistributiveOmit<\n InfiniteQueryExecuteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n 'queryFn'\n> & {\n /**\n * `skipToken` is not allowed as a value here — a prefetch always needs a query function to actually run,\n * unless a default query function has been defined.\n */\n queryFn?: Exclude<\n InfiniteQueryExecuteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >['queryFn'],\n SkipToken\n >\n}\n\n/**\n * {@link UseQueryOptions} with all type parameters set to `any`, useful when the specific types aren't\n * relevant, e.g. when accepting options for any query in a helper function.\n */\nexport type AnyUseQueryOptions = UseQueryOptions<any, any, any, any>\n/**\n * The options accepted by `useQuery`. Same as {@link UseBaseQueryOptions}, minus `suspense` (which\n * `preact-query` derives from which hook you call rather than exposing as an option).\n *\n * @template TQueryFnData - The type your `queryFn` resolves to.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs. Defaults to `TQueryFnData` when no\n * `select` is used.\n * @template TQueryKey - The type of your `queryKey`.\n */\nexport interface UseQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> extends OmitKeyof<\n UseBaseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>,\n 'suspense'\n> {}\n\n/**\n * {@link UseSuspenseQueryOptions} with all type parameters set to `any`, useful when the specific types aren't\n * relevant, e.g. when accepting options for any query in a helper function.\n */\nexport type AnyUseSuspenseQueryOptions = UseSuspenseQueryOptions<\n any,\n any,\n any,\n any\n>\n/**\n * The options accepted by `useSuspenseQuery`. Same as {@link UseQueryOptions}, minus `enabled`, `throwOnError`,\n * and `placeholderData` — Suspense hooks cannot render a \"disabled\" or \"placeholder\" state, so those options\n * don't apply.\n *\n * @template TQueryFnData - The type your `queryFn` resolves to.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs. Defaults to `TQueryFnData` when no\n * `select` is used.\n * @template TQueryKey - The type of your `queryKey`.\n */\nexport interface UseSuspenseQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> extends OmitKeyof<\n UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'queryFn' | 'enabled' | 'throwOnError' | 'placeholderData'\n> {\n /**\n * `skipToken` is not allowed here — Suspense hooks cannot render a \"disabled\" state, so a query function\n * must always be provided, unless a default query function has been defined.\n */\n queryFn?: Exclude<\n UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'],\n SkipToken\n >\n}\n\n/**\n * {@link UseInfiniteQueryOptions} with all type parameters set to `any`, useful when the specific types aren't\n * relevant, e.g. when accepting options for any query in a helper function.\n */\nexport type AnyUseInfiniteQueryOptions = UseInfiniteQueryOptions<\n any,\n any,\n any,\n any,\n any\n>\n/**\n * The options accepted by `useInfiniteQuery`. Extends {@link InfiniteQueryObserverOptions} from\n * `@tanstack/query-core` with the `preact-query`-specific `subscribed` option, minus `suspense` (which\n * `preact-query` derives from which hook you call rather than exposing as an option).\n *\n * @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs — defaults to `InfiniteData<TQueryFnData>`,\n * the shape of all fetched pages plus their page params.\n * @template TQueryKey - The type of your `queryKey`.\n * @template TPageParam - The type of the parameter passed to `queryFn` to fetch a given page.\n */\nexport interface UseInfiniteQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> extends OmitKeyof<\n InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n 'suspense'\n> {\n /**\n * Set this to `false` to unsubscribe this observer from updates to the query cache.\n *\n * @defaultValue true\n */\n subscribed?: boolean\n}\n\n/**\n * {@link UseSuspenseInfiniteQueryOptions} with all type parameters set to `any`, useful when the specific types\n * aren't relevant, e.g. when accepting options for any query in a helper function.\n */\nexport type AnyUseSuspenseInfiniteQueryOptions =\n UseSuspenseInfiniteQueryOptions<any, any, any, any, any>\n/**\n * The options accepted by `useSuspenseInfiniteQuery`. Same as {@link UseInfiniteQueryOptions}, minus `enabled`,\n * `throwOnError`, and `placeholderData` — Suspense hooks cannot render a \"disabled\" or \"placeholder\" state, so\n * those options don't apply.\n *\n * @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs — defaults to `InfiniteData<TQueryFnData>`,\n * the shape of all fetched pages plus their page params.\n * @template TQueryKey - The type of your `queryKey`.\n * @template TPageParam - The type of the parameter passed to `queryFn` to fetch a given page.\n */\nexport interface UseSuspenseInfiniteQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> extends OmitKeyof<\n UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>,\n 'queryFn' | 'enabled' | 'throwOnError' | 'placeholderData'\n> {\n /**\n * `skipToken` is not allowed here — Suspense hooks cannot render a \"disabled\" state, so a query function\n * must always be provided, unless a default query function has been defined.\n */\n queryFn?: Exclude<\n UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >['queryFn'],\n SkipToken\n >\n}\n\n/**\n * The result of `useQuery` when `initialData` isn't set — `data` may be `undefined` while the query is\n * `pending`. Re-exports {@link QueryObserverResult} from `@tanstack/query-core`. `useInfiniteQuery` returns\n * {@link UseInfiniteQueryResult} instead.\n *\n * @template TData - The type `data` ends up as after `select` runs.\n * @template TError - The type of errors your `queryFn` may throw.\n */\nexport type UseBaseQueryResult<\n TData = unknown,\n TError = DefaultError,\n> = QueryObserverResult<TData, TError>\n\n/**\n * The result of `useQuery`. Same as {@link UseBaseQueryResult}.\n *\n * @template TData - The type `data` ends up as after `select` runs.\n * @template TError - The type of errors your `queryFn` may throw.\n */\nexport type UseQueryResult<\n TData = unknown,\n TError = DefaultError,\n> = UseBaseQueryResult<TData, TError>\n\n/**\n * The result of `useSuspenseQuery`. Same as {@link DefinedUseQueryResult}, minus `isPlaceholderData` — always\n * `false` on that type, so this drops the dead field rather than an active state.\n *\n * @template TData - The type `data` ends up as after `select` runs.\n * @template TError - The type of errors your `queryFn` may throw.\n */\nexport type UseSuspenseQueryResult<\n TData = unknown,\n TError = DefaultError,\n> = DistributiveOmit<\n DefinedQueryObserverResult<TData, TError>,\n 'isPlaceholderData'\n>\n\n/**\n * The result of `useQuery` when `initialData` is set, or of `useSuspenseQuery` before the `isPlaceholderData`\n * omission — `data` is never `undefined`. Re-exports {@link DefinedQueryObserverResult} from\n * `@tanstack/query-core`.\n *\n * @template TData - The type `data` ends up as after `select` runs.\n * @template TError - The type of errors your `queryFn` may throw.\n */\nexport type DefinedUseQueryResult<\n TData = unknown,\n TError = DefaultError,\n> = DefinedQueryObserverResult<TData, TError>\n\n/**\n * The result of `useInfiniteQuery` when `initialData` isn't set — `data` may be `undefined` while the query is\n * `pending`. Re-exports {@link InfiniteQueryObserverResult} from `@tanstack/query-core`.\n *\n * @template TData - The type `data` ends up as after `select` runs.\n * @template TError - The type of errors your `queryFn` may throw.\n */\nexport type UseInfiniteQueryResult<\n TData = unknown,\n TError = DefaultError,\n> = InfiniteQueryObserverResult<TData, TError>\n\n/**\n * The result of `useInfiniteQuery` when `initialData` is set — `data` is never `undefined`. Re-exports\n * {@link DefinedInfiniteQueryObserverResult} from `@tanstack/query-core`.\n *\n * @template TData - The type `data` ends up as after `select` runs.\n * @template TError - The type of errors your `queryFn` may throw.\n */\nexport type DefinedUseInfiniteQueryResult<\n TData = unknown,\n TError = DefaultError,\n> = DefinedInfiniteQueryObserverResult<TData, TError>\n\n/**\n * The result of `useSuspenseInfiniteQuery`. Same as {@link DefinedUseInfiniteQueryResult}, minus\n * `isPlaceholderData` — Suspense hooks never render placeholder data.\n *\n * @template TData - The type `data` ends up as after `select` runs.\n * @template TError - The type of errors your `queryFn` may throw.\n */\nexport type UseSuspenseInfiniteQueryResult<\n TData = unknown,\n TError = DefaultError,\n> = OmitKeyof<\n DefinedInfiniteQueryObserverResult<TData, TError>,\n 'isPlaceholderData'\n>\n\n/**\n * {@link UseMutationOptions} with all type parameters set to `any`, useful when the specific types aren't\n * relevant, e.g. when accepting options for any mutation in a helper function.\n */\nexport type AnyUseMutationOptions = UseMutationOptions<any, any, any, any>\n/**\n * The options accepted by `useMutation`. Same as {@link MutationObserverOptions} from `@tanstack/query-core`,\n * minus the internal `_defaulted` flag.\n *\n * @template TData - The type your mutation function resolves to.\n * @template TError - The type of errors your mutation function may throw.\n * @template TVariables - The type of the variable passed to `mutate`/`mutateAsync`.\n * @template TOnMutateResult - The type returned by `onMutate`, passed to `onSuccess`/`onError`/`onSettled` as\n * their `onMutateResult` parameter — useful for optimistic-update rollback data.\n */\nexport interface UseMutationOptions<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n> extends OmitKeyof<\n MutationObserverOptions<TData, TError, TVariables, TOnMutateResult>,\n '_defaulted'\n> {}\n\n/**\n * The type of `mutate`, as returned by `useMutation`. Forwards the variables (and an optional per-call\n * `onSuccess`/`onError`/`onSettled`) to the underlying `mutate` call. Fire-and-forget — errors are surfaced\n * through the mutation result, not thrown.\n *\n * @template TData - The type your mutation function resolves to.\n * @template TError - The type of errors your mutation function may throw.\n * @template TVariables - The type of the variable passed to `mutate`.\n * @template TOnMutateResult - The type returned by `onMutate`, passed to `onSuccess`/`onError`/`onSettled` as\n * their `onMutateResult` parameter — useful for optimistic-update rollback data.\n */\nexport type UseMutateFunction<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n> = (\n ...args: Parameters<\n MutateFunction<TData, TError, TVariables, TOnMutateResult>\n >\n) => void\n\n/**\n * The type of `mutateAsync`, as returned by `useMutation`. Similar to {@link UseMutateFunction}, but returns a\n * promise which can be awaited.\n *\n * @template TData - The type your mutation function resolves to.\n * @template TError - The type of errors your mutation function may throw.\n * @template TVariables - The type of the variable passed to `mutateAsync`.\n * @template TOnMutateResult - The type returned by `onMutate`, passed to `onSuccess`/`onError`/`onSettled` as\n * their `onMutateResult` parameter — useful for optimistic-update rollback data.\n */\nexport type UseMutateAsyncFunction<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n> = MutateFunction<TData, TError, TVariables, TOnMutateResult>\n\n/**\n * The result of `useMutation`. Same as {@link MutationObserverResult} from `@tanstack/query-core`, with\n * `mutate` narrowed to the fire-and-forget {@link UseMutateFunction} signature, plus the added `mutateAsync`.\n *\n * @template TData - The type your mutation function resolves to.\n * @template TError - The type of errors your mutation function may throw.\n * @template TVariables - The type of the variable passed to `mutate`/`mutateAsync`.\n * @template TOnMutateResult - The type returned by `onMutate`, passed to `onSuccess`/`onError`/`onSettled` as\n * their `onMutateResult` parameter — useful for optimistic-update rollback data.\n */\nexport type UseBaseMutationResult<\n TData = unknown,\n TError = DefaultError,\n TVariables = unknown,\n TOnMutateResult = unknown,\n> = Override<\n MutationObserverResult<TData, TError, TVariables, TOnMutateResult>,\n { mutate: UseMutateFunction<TData, TError, TVariables, TOnMutateResult> }\n> & {\n /**\n * Similar to `mutate`, but returns a promise which can be awaited.\n */\n mutateAsync: UseMutateAsyncFunction<\n TData,\n TError,\n TVariables,\n TOnMutateResult\n >\n}\n\n/**\n * The result of `useMutation`. Same as {@link UseBaseMutationResult}.\n *\n * @template TData - The type your mutation function resolves to.\n * @template TError - The type of errors your mutation function may throw.\n * @template TVariables - The type of the variable passed to `mutate`/`mutateAsync`.\n * @template TOnMutateResult - The type returned by `onMutate`, passed to `onSuccess`/`onError`/`onSettled` as\n * their `onMutateResult` parameter — useful for optimistic-update rollback data.\n */\nexport type UseMutationResult<\n TData = unknown,\n TError = DefaultError,\n TVariables = unknown,\n TOnMutateResult = unknown,\n> = UseBaseMutationResult<TData, TError, TVariables, TOnMutateResult>\n"],"mappings":""}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../src/types.ts"],"sourcesContent":["/* istanbul ignore file */\nimport type {\n DefaultError,\n DefinedInfiniteQueryObserverResult,\n DefinedQueryObserverResult,\n DistributiveOmit,\n InfiniteData,\n InfiniteQueryExecuteOptions,\n InfiniteQueryObserverOptions,\n InfiniteQueryObserverResult,\n MutateFunction,\n MutationObserverOptions,\n MutationObserverResult,\n OmitKeyof,\n Override,\n QueryExecuteOptions,\n QueryKey,\n QueryObserverOptions,\n QueryObserverResult,\n SkipToken,\n} from '@tanstack/query-core'\n\n/**\n * {@link UseBaseQueryOptions} with all type parameters set to `any`, useful when the specific types aren't\n * relevant, e.g. when accepting options for any query in a helper function.\n */\nexport type AnyUseBaseQueryOptions = UseBaseQueryOptions<\n any,\n any,\n any,\n any,\n any\n>\n/**\n * The options shared by `useQuery` and `useSuspenseQuery`. Extends {@link QueryObserverOptions} from\n * `@tanstack/query-core` with the `preact-query`-specific `subscribed` option.\n *\n * @template TQueryFnData - The type your `queryFn` resolves to.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs. Defaults to `TQueryFnData` when no\n * `select` is used.\n * @template TQueryData - The type of the data actually held in the query cache — the input to `select` and\n * `placeholderData`. Defaults to, and is usually the same as, `TQueryFnData`.\n * @template TQueryKey - The type of your `queryKey`.\n */\nexport interface UseBaseQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> extends QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n> {\n /**\n * Set this to `false` to unsubscribe this observer from updates to the query cache.\n *\n * @defaultValue true\n */\n subscribed?: boolean\n}\n\n/**\n * The options accepted by `usePrefetchQuery` — everything you can pass to `queryClient.query`, except `queryFn`\n * is required unless a default query function has been defined.\n *\n * @template TQueryFnData - The type your `queryFn` resolves to.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs. Defaults to `TQueryFnData` when no\n * `select` is used.\n * @template TQueryData - The type of the data actually held in the query cache — the input to `select` and\n * `placeholderData`. Defaults to, and is usually the same as, `TQueryFnData`.\n * @template TQueryKey - The type of your `queryKey`.\n */\nexport type UsePrefetchQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = DistributiveOmit<\n QueryExecuteOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>,\n 'queryFn'\n> & {\n /**\n * `skipToken` is not allowed as a value here — a prefetch always needs a query function to actually run,\n * unless a default query function has been defined.\n */\n queryFn?: Exclude<\n QueryExecuteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryFnData,\n TQueryKey\n >['queryFn'],\n SkipToken\n >\n}\n\n/**\n * The options accepted by `usePrefetchInfiniteQuery` — everything you can pass to `queryClient.infiniteQuery`,\n * except `queryFn` is required unless a default query function has been defined.\n *\n * @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs. Defaults to `TQueryFnData` (a single page)\n * here, since a prefetch never reads `data` back out — this parameter only matters if you reuse these options\n * elsewhere with `select` applied.\n * @template TQueryKey - The type of your `queryKey`.\n * @template TPageParam - The type of the parameter passed to `queryFn` to fetch a given page.\n */\nexport type UsePrefetchInfiniteQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = DistributiveOmit<\n InfiniteQueryExecuteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n 'queryFn'\n> & {\n /**\n * `skipToken` is not allowed as a value here — a prefetch always needs a query function to actually run,\n * unless a default query function has been defined.\n */\n queryFn?: Exclude<\n InfiniteQueryExecuteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >['queryFn'],\n SkipToken\n >\n}\n\n/**\n * {@link UseQueryOptions} with all type parameters set to `any`, useful when the specific types aren't\n * relevant, e.g. when accepting options for any query in a helper function.\n */\nexport type AnyUseQueryOptions = UseQueryOptions<any, any, any, any>\n/**\n * The options accepted by `useQuery`. Same as {@link UseBaseQueryOptions}, minus `suspense` (which\n * `preact-query` derives from which hook you call rather than exposing as an option).\n *\n * @template TQueryFnData - The type your `queryFn` resolves to.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs. Defaults to `TQueryFnData` when no\n * `select` is used.\n * @template TQueryKey - The type of your `queryKey`.\n */\nexport interface UseQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> extends OmitKeyof<\n UseBaseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>,\n 'suspense'\n> {}\n\n/**\n * {@link UseSuspenseQueryOptions} with all type parameters set to `any`, useful when the specific types aren't\n * relevant, e.g. when accepting options for any query in a helper function.\n */\nexport type AnyUseSuspenseQueryOptions = UseSuspenseQueryOptions<\n any,\n any,\n any,\n any\n>\n/**\n * The options accepted by `useSuspenseQuery`. Same as {@link UseQueryOptions}, minus `enabled`, `throwOnError`,\n * and `placeholderData` — Suspense hooks cannot render a \"disabled\" or \"placeholder\" state, so those options\n * don't apply.\n *\n * @template TQueryFnData - The type your `queryFn` resolves to.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs. Defaults to `TQueryFnData` when no\n * `select` is used.\n * @template TQueryKey - The type of your `queryKey`.\n */\nexport interface UseSuspenseQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> extends OmitKeyof<\n UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'queryFn' | 'enabled' | 'throwOnError' | 'placeholderData'\n> {\n /**\n * `skipToken` is not allowed here — Suspense hooks cannot render a \"disabled\" state, so a query function\n * must always be provided, unless a default query function has been defined.\n */\n queryFn?: Exclude<\n UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'],\n SkipToken\n >\n}\n\n/**\n * {@link UseInfiniteQueryOptions} with all type parameters set to `any`, useful when the specific types aren't\n * relevant, e.g. when accepting options for any query in a helper function.\n */\nexport type AnyUseInfiniteQueryOptions = UseInfiniteQueryOptions<\n any,\n any,\n any,\n any,\n any\n>\n/**\n * The options accepted by `useInfiniteQuery`. Extends {@link InfiniteQueryObserverOptions} from\n * `@tanstack/query-core` with the `preact-query`-specific `subscribed` option, minus `suspense` (which\n * `preact-query` derives from which hook you call rather than exposing as an option).\n *\n * @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs — defaults to `InfiniteData<TQueryFnData>`,\n * the shape of all fetched pages plus their page params.\n * @template TQueryKey - The type of your `queryKey`.\n * @template TPageParam - The type of the parameter passed to `queryFn` to fetch a given page.\n */\nexport interface UseInfiniteQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> extends OmitKeyof<\n InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n 'suspense'\n> {\n /**\n * Set this to `false` to unsubscribe this observer from updates to the query cache.\n *\n * @defaultValue true\n */\n subscribed?: boolean\n}\n\n/**\n * {@link UseSuspenseInfiniteQueryOptions} with all type parameters set to `any`, useful when the specific types\n * aren't relevant, e.g. when accepting options for any query in a helper function.\n */\nexport type AnyUseSuspenseInfiniteQueryOptions =\n UseSuspenseInfiniteQueryOptions<any, any, any, any, any>\n/**\n * The options accepted by `useSuspenseInfiniteQuery`. Same as {@link UseInfiniteQueryOptions}, minus `enabled`,\n * `throwOnError`, and `placeholderData` — Suspense hooks cannot render a \"disabled\" or \"placeholder\" state, so\n * those options don't apply.\n *\n * @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs — defaults to `InfiniteData<TQueryFnData>`,\n * the shape of all fetched pages plus their page params.\n * @template TQueryKey - The type of your `queryKey`.\n * @template TPageParam - The type of the parameter passed to `queryFn` to fetch a given page.\n */\nexport interface UseSuspenseInfiniteQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> extends OmitKeyof<\n UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>,\n 'queryFn' | 'enabled' | 'throwOnError' | 'placeholderData'\n> {\n /**\n * `skipToken` is not allowed here — Suspense hooks cannot render a \"disabled\" state, so a query function\n * must always be provided, unless a default query function has been defined.\n */\n queryFn?: Exclude<\n UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >['queryFn'],\n SkipToken\n >\n}\n\n/**\n * The result of `useQuery` when `initialData` isn't set — `data` may be `undefined` while the query is\n * `pending`. Re-exports {@link QueryObserverResult} from `@tanstack/query-core`. `useInfiniteQuery` returns\n * {@link UseInfiniteQueryResult} instead.\n *\n * @template TData - The type `data` ends up as after `select` runs.\n * @template TError - The type of errors your `queryFn` may throw.\n */\nexport type UseBaseQueryResult<\n TData = unknown,\n TError = DefaultError,\n> = QueryObserverResult<TData, TError>\n\n/**\n * The result of `useQuery`. Same as {@link UseBaseQueryResult}.\n *\n * @template TData - The type `data` ends up as after `select` runs.\n * @template TError - The type of errors your `queryFn` may throw.\n */\nexport type UseQueryResult<\n TData = unknown,\n TError = DefaultError,\n> = UseBaseQueryResult<TData, TError>\n\n/**\n * The result of `useSuspenseQuery`. Same as {@link DefinedUseQueryResult}, minus `isPlaceholderData` — always\n * `false` on that type, so this drops the dead field rather than an active state.\n *\n * @template TData - The type `data` ends up as after `select` runs.\n * @template TError - The type of errors your `queryFn` may throw.\n */\nexport type UseSuspenseQueryResult<\n TData = unknown,\n TError = DefaultError,\n> = DistributiveOmit<\n DefinedQueryObserverResult<TData, TError>,\n 'isPlaceholderData'\n>\n\n/**\n * The result of `useQuery` when `initialData` is set, or of `useSuspenseQuery` before the `isPlaceholderData`\n * omission — `data` is never `undefined` (unless a `select` changes `TData` to include `undefined`).\n * Re-exports {@link DefinedQueryObserverResult} from `@tanstack/query-core`.\n *\n * @template TData - The type `data` ends up as after `select` runs.\n * @template TError - The type of errors your `queryFn` may throw.\n */\nexport type DefinedUseQueryResult<\n TData = unknown,\n TError = DefaultError,\n> = DefinedQueryObserverResult<TData, TError>\n\n/**\n * The result of `useInfiniteQuery` when `initialData` isn't set — `data` may be `undefined` while the query is\n * `pending`. Re-exports {@link InfiniteQueryObserverResult} from `@tanstack/query-core`.\n *\n * @template TData - The type `data` ends up as after `select` runs.\n * @template TError - The type of errors your `queryFn` may throw.\n */\nexport type UseInfiniteQueryResult<\n TData = unknown,\n TError = DefaultError,\n> = InfiniteQueryObserverResult<TData, TError>\n\n/**\n * The result of `useInfiniteQuery` when `initialData` is set — `data` is never `undefined` (unless a\n * `select` changes `TData` to include `undefined`). Re-exports {@link DefinedInfiniteQueryObserverResult}\n * from `@tanstack/query-core`.\n *\n * @template TData - The type `data` ends up as after `select` runs.\n * @template TError - The type of errors your `queryFn` may throw.\n */\nexport type DefinedUseInfiniteQueryResult<\n TData = unknown,\n TError = DefaultError,\n> = DefinedInfiniteQueryObserverResult<TData, TError>\n\n/**\n * The result of `useSuspenseInfiniteQuery`. Same as {@link DefinedUseInfiniteQueryResult}, minus\n * `isPlaceholderData` — Suspense hooks never render placeholder data.\n *\n * @template TData - The type `data` ends up as after `select` runs.\n * @template TError - The type of errors your `queryFn` may throw.\n */\nexport type UseSuspenseInfiniteQueryResult<\n TData = unknown,\n TError = DefaultError,\n> = OmitKeyof<\n DefinedInfiniteQueryObserverResult<TData, TError>,\n 'isPlaceholderData'\n>\n\n/**\n * {@link UseMutationOptions} with all type parameters set to `any`, useful when the specific types aren't\n * relevant, e.g. when accepting options for any mutation in a helper function.\n */\nexport type AnyUseMutationOptions = UseMutationOptions<any, any, any, any>\n/**\n * The options accepted by `useMutation`. Same as {@link MutationObserverOptions} from `@tanstack/query-core`,\n * minus the internal `_defaulted` flag.\n *\n * @template TData - The type your mutation function resolves to.\n * @template TError - The type of errors your mutation function may throw.\n * @template TVariables - The type of the variable passed to `mutate`/`mutateAsync`.\n * @template TOnMutateResult - The type returned by `onMutate`, passed to `onSuccess`/`onError`/`onSettled` as\n * their `onMutateResult` parameter — useful for optimistic-update rollback data.\n */\nexport interface UseMutationOptions<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n> extends OmitKeyof<\n MutationObserverOptions<TData, TError, TVariables, TOnMutateResult>,\n '_defaulted'\n> {}\n\n/**\n * The type of `mutate`, as returned by `useMutation`. Forwards the variables (and an optional per-call\n * `onSuccess`/`onError`/`onSettled`) to the underlying `mutate` call. Fire-and-forget — errors are surfaced\n * through the mutation result, not thrown.\n *\n * @template TData - The type your mutation function resolves to.\n * @template TError - The type of errors your mutation function may throw.\n * @template TVariables - The type of the variable passed to `mutate`.\n * @template TOnMutateResult - The type returned by `onMutate`, passed to `onSuccess`/`onError`/`onSettled` as\n * their `onMutateResult` parameter — useful for optimistic-update rollback data.\n */\nexport type UseMutateFunction<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n> = (\n ...args: Parameters<\n MutateFunction<TData, TError, TVariables, TOnMutateResult>\n >\n) => void\n\n/**\n * The type of `mutateAsync`, as returned by `useMutation`. Similar to {@link UseMutateFunction}, but returns a\n * promise which can be awaited.\n *\n * @template TData - The type your mutation function resolves to.\n * @template TError - The type of errors your mutation function may throw.\n * @template TVariables - The type of the variable passed to `mutateAsync`.\n * @template TOnMutateResult - The type returned by `onMutate`, passed to `onSuccess`/`onError`/`onSettled` as\n * their `onMutateResult` parameter — useful for optimistic-update rollback data.\n */\nexport type UseMutateAsyncFunction<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n> = MutateFunction<TData, TError, TVariables, TOnMutateResult>\n\n/**\n * The result of `useMutation`. Same as {@link MutationObserverResult} from `@tanstack/query-core`, with\n * `mutate` narrowed to the fire-and-forget {@link UseMutateFunction} signature, plus the added `mutateAsync`.\n *\n * @template TData - The type your mutation function resolves to.\n * @template TError - The type of errors your mutation function may throw.\n * @template TVariables - The type of the variable passed to `mutate`/`mutateAsync`.\n * @template TOnMutateResult - The type returned by `onMutate`, passed to `onSuccess`/`onError`/`onSettled` as\n * their `onMutateResult` parameter — useful for optimistic-update rollback data.\n */\nexport type UseBaseMutationResult<\n TData = unknown,\n TError = DefaultError,\n TVariables = unknown,\n TOnMutateResult = unknown,\n> = Override<\n MutationObserverResult<TData, TError, TVariables, TOnMutateResult>,\n { mutate: UseMutateFunction<TData, TError, TVariables, TOnMutateResult> }\n> & {\n /**\n * Similar to `mutate`, but returns a promise which can be awaited.\n */\n mutateAsync: UseMutateAsyncFunction<\n TData,\n TError,\n TVariables,\n TOnMutateResult\n >\n}\n\n/**\n * The result of `useMutation`. Same as {@link UseBaseMutationResult}.\n *\n * @template TData - The type your mutation function resolves to.\n * @template TError - The type of errors your mutation function may throw.\n * @template TVariables - The type of the variable passed to `mutate`/`mutateAsync`.\n * @template TOnMutateResult - The type returned by `onMutate`, passed to `onSuccess`/`onError`/`onSettled` as\n * their `onMutateResult` parameter — useful for optimistic-update rollback data.\n */\nexport type UseMutationResult<\n TData = unknown,\n TError = DefaultError,\n TVariables = unknown,\n TOnMutateResult = unknown,\n> = UseBaseMutationResult<TData, TError, TVariables, TOnMutateResult>\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"useBaseQuery.cjs","names":["useIsRestoring","useQueryErrorResetBoundary","useQueryClient","useState","useCallback","notifyManager","noop","shouldSuspend","fetchOptimistic","getHasError"],"sources":["../../src/useBaseQuery.ts"],"sourcesContent":["import { noop, notifyManager } from '@tanstack/query-core'\nimport type {\n QueryClient,\n QueryKey,\n QueryObserver,\n QueryObserverResult,\n} from '@tanstack/query-core'\nimport { useCallback, useEffect, useState } from 'preact/hooks'\n\nimport { useIsRestoring } from './IsRestoringProvider'\nimport { useQueryClient } from './QueryClientProvider'\nimport { useQueryErrorResetBoundary } from './QueryErrorResetBoundary'\nimport {\n ensurePreventErrorBoundaryRetry,\n getHasError,\n useClearResetErrorBoundary,\n} from './errorBoundaryUtils'\nimport {\n ensureSuspenseTimers,\n fetchOptimistic,\n shouldSuspend,\n} from './suspense'\nimport type { UseBaseQueryOptions } from './types'\nimport { useSyncExternalStore } from './utils'\n\nexport function useBaseQuery<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n>(\n options: UseBaseQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n Observer: typeof QueryObserver,\n queryClient?: QueryClient,\n): QueryObserverResult<TData, TError> {\n if (process.env.NODE_ENV !== 'production') {\n if (typeof options !== 'object' || Array.isArray(options)) {\n throw new Error(\n 'Bad argument type. Starting with v5, only the \"Object\" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object',\n )\n }\n }\n\n const isRestoring = useIsRestoring()\n const errorResetBoundary = useQueryErrorResetBoundary()\n const client = useQueryClient(queryClient)\n const defaultedOptions = client.defaultQueryOptions(options)\n\n const query = client\n .getQueryCache()\n .get<\n TQueryFnData,\n TError,\n TQueryData,\n TQueryKey\n >(defaultedOptions.queryHash)\n\n if (process.env.NODE_ENV !== 'production') {\n if (!defaultedOptions.queryFn) {\n console.error(\n `[${defaultedOptions.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`,\n )\n }\n }\n\n // Make sure results are optimistically set in fetching state before subscribing or updating options\n defaultedOptions._optimisticResults = isRestoring\n ? 'isRestoring'\n : 'optimistic'\n\n ensureSuspenseTimers(defaultedOptions)\n ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary, query)\n\n useClearResetErrorBoundary(errorResetBoundary)\n\n const [observer] = useState(\n () =>\n new Observer<TQueryFnData, TError, TData, TQueryData, TQueryKey>(\n client,\n defaultedOptions,\n ),\n )\n\n // note: this must be called before useSyncExternalStore\n const result = observer.getOptimisticResult(defaultedOptions)\n\n const shouldSubscribe = !isRestoring && options.subscribed !== false\n useSyncExternalStore(\n useCallback(\n (onStoreChange) => {\n const unsubscribe = shouldSubscribe\n ? observer.subscribe(notifyManager.batchCalls(onStoreChange))\n : noop\n\n // Update result to make sure we did not miss any query updates\n // between creating the observer and subscribing to it.\n observer.updateResult()\n\n return unsubscribe\n },\n [observer, shouldSubscribe],\n ),\n () => observer.getCurrentResult(),\n )\n\n useEffect(() => {\n observer.setOptions(defaultedOptions)\n }, [defaultedOptions, observer])\n\n // Handle suspense\n if (shouldSuspend(defaultedOptions, result)) {\n throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary)\n }\n\n // Handle error boundary\n if (\n getHasError({\n result,\n errorResetBoundary,\n throwOnError: defaultedOptions.throwOnError,\n query,\n suspense: defaultedOptions.suspense,\n })\n ) {\n throw result.error\n }\n\n // Handle result property usage tracking\n return !defaultedOptions.notifyOnChangeProps\n ? observer.trackResult(result)\n : result\n}\n"],"mappings":";;;;;;;;;;AAyBA,SAAgB,aAOd,SAOA,UACA,aACoC;CACpC,IAAI,QAAQ,IAAI,aAAa,cACvB;MAAA,OAAO,YAAY,YAAY,MAAM,QAAQ,OAAO,GACtD,MAAM,IAAI,MACR,gSACF;CAAA;CAIJ,MAAM,cAAcA,4BAAAA,eAAe;CACnC,MAAM,qBAAqBC,gCAAAA,2BAA2B;CACtD,MAAM,SAASC,4BAAAA,eAAe,WAAW;CACzC,MAAM,mBAAmB,OAAO,oBAAoB,OAAO;CAE3D,MAAM,QAAQ,OACX,cAAc,CAAC,CACf,IAKC,iBAAiB,SAAS;CAE9B,IAAI,QAAQ,IAAI,aAAa,cACvB;MAAA,CAAC,iBAAiB,SACpB,QAAQ,MACN,IAAI,iBAAiB,UAAU,mPACjC;CAAA;CAKJ,iBAAiB,qBAAqB,cAClC,gBACA;CAEJ,iBAAA,qBAAqB,gBAAgB;CACrC,2BAAA,gCAAgC,kBAAkB,oBAAoB,KAAK;CAE3E,2BAAA,2BAA2B,kBAAkB;CAE7C,MAAM,CAAC,aAAA,GAAYC,aAAAA,SAAAA,OAEf,IAAI,SACF,QACA,gBACF,CACJ;CAGA,MAAM,SAAS,SAAS,oBAAoB,gBAAgB;CAE5D,MAAM,kBAAkB,CAAC,eAAe,QAAQ,eAAe;CAC/D,cAAA,sBAAA,GACEC,aAAAA,YAAAA,EACG,kBAAkB;EACjB,MAAM,cAAc,kBAChB,SAAS,UAAUC,qBAAAA,cAAc,WAAW,aAAa,CAAC,IAC1DC,qBAAAA;EAIJ,SAAS,aAAa;EAEtB,OAAO;CACT,GACA,CAAC,UAAU,eAAe,CAC5B,SACM,SAAS,iBAAiB,CAClC;CAEA,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,SAAS,WAAW,gBAAgB;CACtC,GAAG,CAAC,kBAAkB,QAAQ,CAAC;CAG/B,IAAIC,iBAAAA,cAAc,kBAAkB,MAAM,GACxC,MAAMC,iBAAAA,gBAAgB,kBAAkB,UAAU,kBAAkB;CAItE,IACEC,2BAAAA,YAAY;EACV;EACA;EACA,cAAc,iBAAiB;EAC/B;EACA,UAAU,iBAAiB;CAC7B,CAAC,GAED,MAAM,OAAO;CAIf,OAAO,CAAC,iBAAiB,sBACrB,SAAS,YAAY,MAAM,IAC3B;AACN"}
1
+ {"version":3,"file":"useBaseQuery.cjs","names":["useIsRestoring","useQueryErrorResetBoundary","useQueryClient","useState","useCallback","notifyManager","noop","shouldSuspend","fetchOptimistic","getHasError"],"sources":["../../src/useBaseQuery.ts"],"sourcesContent":["import { noop, notifyManager } from '@tanstack/query-core'\nimport type {\n QueryClient,\n QueryKey,\n QueryObserver,\n QueryObserverResult,\n} from '@tanstack/query-core'\nimport { useCallback, useEffect, useState } from 'preact/hooks'\n\nimport { useIsRestoring } from './IsRestoringProvider'\nimport { useQueryClient } from './QueryClientProvider'\nimport { useQueryErrorResetBoundary } from './QueryErrorResetBoundary'\nimport {\n ensurePreventErrorBoundaryRetry,\n getHasError,\n useClearResetErrorBoundary,\n} from './errorBoundaryUtils'\nimport {\n ensureSuspenseTimers,\n fetchOptimistic,\n shouldSuspend,\n} from './suspense'\nimport type { UseBaseQueryOptions } from './types'\nimport { useSyncExternalStore } from './utils'\n\nexport function useBaseQuery<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n>(\n options: UseBaseQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n Observer: typeof QueryObserver,\n queryClient?: QueryClient,\n): QueryObserverResult<TData, TError> {\n if (process.env.NODE_ENV !== 'production') {\n if (typeof options !== 'object' || Array.isArray(options)) {\n throw new Error(\n 'Bad argument type. Starting with v5, only the \"Object\" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object',\n )\n }\n }\n\n const isRestoring = useIsRestoring()\n const errorResetBoundary = useQueryErrorResetBoundary()\n const client = useQueryClient(queryClient)\n const defaultedOptions = client.defaultQueryOptions(options)\n\n const query = client\n .getQueryCache()\n .get<TQueryFnData, TError, TQueryData, TQueryKey>(\n defaultedOptions.queryHash,\n )\n\n if (process.env.NODE_ENV !== 'production') {\n if (!defaultedOptions.queryFn) {\n console.error(\n `[${defaultedOptions.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`,\n )\n }\n }\n\n // Make sure results are optimistically set in fetching state before subscribing or updating options\n defaultedOptions._optimisticResults = isRestoring\n ? 'isRestoring'\n : 'optimistic'\n\n ensureSuspenseTimers(defaultedOptions)\n ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary, query)\n\n useClearResetErrorBoundary(errorResetBoundary)\n\n const [observer] = useState(\n () =>\n new Observer<TQueryFnData, TError, TData, TQueryData, TQueryKey>(\n client,\n defaultedOptions,\n ),\n )\n\n // note: this must be called before useSyncExternalStore\n const result = observer.getOptimisticResult(defaultedOptions)\n\n const shouldSubscribe = !isRestoring && options.subscribed !== false\n useSyncExternalStore(\n useCallback(\n (onStoreChange) => {\n const unsubscribe = shouldSubscribe\n ? observer.subscribe(notifyManager.batchCalls(onStoreChange))\n : noop\n\n // Update result to make sure we did not miss any query updates\n // between creating the observer and subscribing to it.\n observer.updateResult()\n\n return unsubscribe\n },\n [observer, shouldSubscribe],\n ),\n () => observer.getCurrentResult(),\n )\n\n useEffect(() => {\n observer.setOptions(defaultedOptions)\n }, [defaultedOptions, observer])\n\n // Handle suspense\n if (shouldSuspend(defaultedOptions, result)) {\n throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary)\n }\n\n // Handle error boundary\n if (\n getHasError({\n result,\n errorResetBoundary,\n throwOnError: defaultedOptions.throwOnError,\n query,\n suspense: defaultedOptions.suspense,\n })\n ) {\n throw result.error\n }\n\n // Handle result property usage tracking\n return !defaultedOptions.notifyOnChangeProps\n ? observer.trackResult(result)\n : result\n}\n"],"mappings":";;;;;;;;;;AAyBA,SAAgB,aAOd,SAOA,UACA,aACoC;CACpC,IAAI,QAAQ,IAAI,aAAa,cACvB;MAAA,OAAO,YAAY,YAAY,MAAM,QAAQ,OAAO,GACtD,MAAM,IAAI,MACR,gSACF;CAAA;CAIJ,MAAM,cAAcA,4BAAAA,eAAe;CACnC,MAAM,qBAAqBC,gCAAAA,2BAA2B;CACtD,MAAM,SAASC,4BAAAA,eAAe,WAAW;CACzC,MAAM,mBAAmB,OAAO,oBAAoB,OAAO;CAE3D,MAAM,QAAQ,OACX,cAAc,CAAC,CACf,IACC,iBAAiB,SACnB;CAEF,IAAI,QAAQ,IAAI,aAAa,cACvB;MAAA,CAAC,iBAAiB,SACpB,QAAQ,MACN,IAAI,iBAAiB,UAAU,mPACjC;CAAA;CAKJ,iBAAiB,qBAAqB,cAClC,gBACA;CAEJ,iBAAA,qBAAqB,gBAAgB;CACrC,2BAAA,gCAAgC,kBAAkB,oBAAoB,KAAK;CAE3E,2BAAA,2BAA2B,kBAAkB;CAE7C,MAAM,CAAC,aAAA,GAAYC,aAAAA,SAAAA,OAEf,IAAI,SACF,QACA,gBACF,CACJ;CAGA,MAAM,SAAS,SAAS,oBAAoB,gBAAgB;CAE5D,MAAM,kBAAkB,CAAC,eAAe,QAAQ,eAAe;CAC/D,cAAA,sBAAA,GACEC,aAAAA,YAAAA,EACG,kBAAkB;EACjB,MAAM,cAAc,kBAChB,SAAS,UAAUC,qBAAAA,cAAc,WAAW,aAAa,CAAC,IAC1DC,qBAAAA;EAIJ,SAAS,aAAa;EAEtB,OAAO;CACT,GACA,CAAC,UAAU,eAAe,CAC5B,SACM,SAAS,iBAAiB,CAClC;CAEA,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,SAAS,WAAW,gBAAgB;CACtC,GAAG,CAAC,kBAAkB,QAAQ,CAAC;CAG/B,IAAIC,iBAAAA,cAAc,kBAAkB,MAAM,GACxC,MAAMC,iBAAAA,gBAAgB,kBAAkB,UAAU,kBAAkB;CAItE,IACEC,2BAAAA,YAAY;EACV;EACA;EACA,cAAc,iBAAiB;EAC/B;EACA,UAAU,iBAAiB;CAC7B,CAAC,GAED,MAAM,OAAO;CAIf,OAAO,CAAC,iBAAiB,sBACrB,SAAS,YAAY,MAAM,IAC3B;AACN"}