@tanstack/solid-query 5.71.6 → 5.71.8
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.
- package/build/dev.cjs +13 -17
- package/build/dev.js +10 -10
- package/build/index.cjs +13 -17
- package/build/index.d.cts +40 -40
- package/build/index.d.ts +40 -40
- package/build/index.js +10 -10
- package/package.json +1 -1
- package/src/{useBaseQuery.ts → createBaseQuery.ts} +3 -3
- package/src/{useInfiniteQuery.ts → createInfiniteQuery.ts} +13 -13
- package/src/{useMutation.ts → createMutation.ts} +8 -8
- package/src/{useQueries.ts → createQueries.ts} +25 -25
- package/src/{useQuery.ts → createQuery.ts} +11 -11
- package/src/index.ts +4 -47
- package/src/types.ts +22 -22
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { QueryObserver } from '@tanstack/query-core'
|
|
2
2
|
import { createMemo } from 'solid-js'
|
|
3
|
-
import {
|
|
3
|
+
import { createBaseQuery } from './createBaseQuery'
|
|
4
4
|
import type { DefaultError, QueryKey } from '@tanstack/query-core'
|
|
5
5
|
import type { QueryClient } from './QueryClient'
|
|
6
6
|
import type { Accessor } from 'solid-js'
|
|
7
7
|
import type {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
CreateQueryOptions,
|
|
9
|
+
CreateQueryResult,
|
|
10
|
+
DefinedCreateQueryResult,
|
|
11
11
|
} from './types'
|
|
12
12
|
import type {
|
|
13
13
|
DefinedInitialDataOptions,
|
|
14
14
|
UndefinedInitialDataOptions,
|
|
15
15
|
} from './queryOptions'
|
|
16
16
|
|
|
17
|
-
export function
|
|
17
|
+
export function createQuery<
|
|
18
18
|
TQueryFnData = unknown,
|
|
19
19
|
TError = DefaultError,
|
|
20
20
|
TData = TQueryFnData,
|
|
@@ -22,9 +22,9 @@ export function useQuery<
|
|
|
22
22
|
>(
|
|
23
23
|
options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,
|
|
24
24
|
queryClient?: () => QueryClient,
|
|
25
|
-
):
|
|
25
|
+
): CreateQueryResult<TData, TError>
|
|
26
26
|
|
|
27
|
-
export function
|
|
27
|
+
export function createQuery<
|
|
28
28
|
TQueryFnData = unknown,
|
|
29
29
|
TError = DefaultError,
|
|
30
30
|
TData = TQueryFnData,
|
|
@@ -32,17 +32,17 @@ export function useQuery<
|
|
|
32
32
|
>(
|
|
33
33
|
options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,
|
|
34
34
|
queryClient?: () => QueryClient,
|
|
35
|
-
):
|
|
36
|
-
export function
|
|
35
|
+
): DefinedCreateQueryResult<TData, TError>
|
|
36
|
+
export function createQuery<
|
|
37
37
|
TQueryFnData,
|
|
38
38
|
TError = DefaultError,
|
|
39
39
|
TData = TQueryFnData,
|
|
40
40
|
TQueryKey extends QueryKey = QueryKey,
|
|
41
41
|
>(
|
|
42
|
-
options:
|
|
42
|
+
options: CreateQueryOptions<TQueryFnData, TError, TData, TQueryKey>,
|
|
43
43
|
queryClient?: Accessor<QueryClient>,
|
|
44
44
|
) {
|
|
45
|
-
return
|
|
45
|
+
return createBaseQuery(
|
|
46
46
|
createMemo(() => options()),
|
|
47
47
|
QueryObserver,
|
|
48
48
|
queryClient,
|
package/src/index.ts
CHANGED
|
@@ -5,45 +5,6 @@ export * from '@tanstack/query-core'
|
|
|
5
5
|
|
|
6
6
|
// Solid Query
|
|
7
7
|
export * from './types'
|
|
8
|
-
|
|
9
|
-
export type {
|
|
10
|
-
UseQueryOptions,
|
|
11
|
-
UseBaseQueryResult,
|
|
12
|
-
UseQueryResult,
|
|
13
|
-
DefinedUseBaseQueryResult,
|
|
14
|
-
DefinedUseQueryResult,
|
|
15
|
-
UseInfiniteQueryOptions,
|
|
16
|
-
UseInfiniteQueryResult,
|
|
17
|
-
DefinedUseInfiniteQueryResult,
|
|
18
|
-
UseMutationOptions,
|
|
19
|
-
UseMutateFunction,
|
|
20
|
-
UseMutateAsyncFunction,
|
|
21
|
-
UseBaseMutationResult,
|
|
22
|
-
UseMutationResult,
|
|
23
|
-
UseBaseQueryOptions,
|
|
24
|
-
SolidQueryOptions,
|
|
25
|
-
SolidInfiniteQueryOptions,
|
|
26
|
-
SolidMutationOptions,
|
|
27
|
-
} from './types'
|
|
28
|
-
|
|
29
|
-
// Compatibility types
|
|
30
|
-
export type {
|
|
31
|
-
UseQueryOptions as CreateQueryOptions,
|
|
32
|
-
UseBaseQueryResult as CreateBaseQueryResult,
|
|
33
|
-
UseQueryResult as CreateQueryResult,
|
|
34
|
-
DefinedUseBaseQueryResult as DefinedCreateBaseQueryResult,
|
|
35
|
-
DefinedUseQueryResult as DefinedCreateQueryResult,
|
|
36
|
-
UseInfiniteQueryOptions as CreateInfiniteQueryOptions,
|
|
37
|
-
UseInfiniteQueryResult as CreateInfiniteQueryResult,
|
|
38
|
-
DefinedUseInfiniteQueryResult as DefinedCreateInfiniteQueryResult,
|
|
39
|
-
UseMutationOptions as CreateMutationOptions,
|
|
40
|
-
UseMutateFunction as CreateMutateFunction,
|
|
41
|
-
UseMutateAsyncFunction as CreateMutateAsyncFunction,
|
|
42
|
-
UseBaseMutationResult as CreateBaseMutationResult,
|
|
43
|
-
UseMutationResult as CreateMutationResult,
|
|
44
|
-
UseBaseQueryOptions as CreateBaseQueryOptions,
|
|
45
|
-
} from './types'
|
|
46
|
-
|
|
47
8
|
export { QueryClient } from './QueryClient'
|
|
48
9
|
export type {
|
|
49
10
|
QueryObserverOptions,
|
|
@@ -51,8 +12,7 @@ export type {
|
|
|
51
12
|
QueryClientConfig,
|
|
52
13
|
InfiniteQueryObserverOptions,
|
|
53
14
|
} from './QueryClient'
|
|
54
|
-
export {
|
|
55
|
-
export { useQuery as createQuery } from './useQuery'
|
|
15
|
+
export { createQuery } from './createQuery'
|
|
56
16
|
export { queryOptions } from './queryOptions'
|
|
57
17
|
export type {
|
|
58
18
|
DefinedInitialDataOptions,
|
|
@@ -65,17 +25,14 @@ export {
|
|
|
65
25
|
} from './QueryClientProvider'
|
|
66
26
|
export type { QueryClientProviderProps } from './QueryClientProvider'
|
|
67
27
|
export { useIsFetching } from './useIsFetching'
|
|
68
|
-
export {
|
|
69
|
-
export { useInfiniteQuery as createInfiniteQuery } from './useInfiniteQuery'
|
|
28
|
+
export { createInfiniteQuery } from './createInfiniteQuery'
|
|
70
29
|
export { infiniteQueryOptions } from './infiniteQueryOptions'
|
|
71
30
|
export type {
|
|
72
31
|
DefinedInitialDataInfiniteOptions,
|
|
73
32
|
UndefinedInitialDataInfiniteOptions,
|
|
74
33
|
} from './infiniteQueryOptions'
|
|
75
|
-
export {
|
|
76
|
-
export { useMutation as createMutation } from './useMutation'
|
|
34
|
+
export { createMutation } from './createMutation'
|
|
77
35
|
export { useIsMutating } from './useIsMutating'
|
|
78
36
|
export { useMutationState } from './useMutationState'
|
|
79
|
-
export {
|
|
80
|
-
export { useQueries as createQueries } from './useQueries'
|
|
37
|
+
export { createQueries } from './createQueries'
|
|
81
38
|
export { useIsRestoring, IsRestoringProvider } from './isRestoring'
|
package/src/types.ts
CHANGED
|
@@ -19,7 +19,7 @@ import type {
|
|
|
19
19
|
} from './QueryClient'
|
|
20
20
|
import type { Accessor } from 'solid-js'
|
|
21
21
|
|
|
22
|
-
export interface
|
|
22
|
+
export interface CreateBaseQueryOptions<
|
|
23
23
|
TQueryFnData = unknown,
|
|
24
24
|
TError = DefaultError,
|
|
25
25
|
TData = TQueryFnData,
|
|
@@ -38,7 +38,7 @@ export interface UseBaseQueryOptions<
|
|
|
38
38
|
deferStream?: boolean
|
|
39
39
|
/**
|
|
40
40
|
* @deprecated The `suspense` option has been deprecated in v5 and will be removed in the next major version.
|
|
41
|
-
* The `data` property on
|
|
41
|
+
* The `data` property on createQuery is a SolidJS resource and will automatically suspend when the data is loading.
|
|
42
42
|
* Setting `suspense` to `false` will be a no-op.
|
|
43
43
|
*/
|
|
44
44
|
suspense?: boolean
|
|
@@ -49,7 +49,7 @@ export interface SolidQueryOptions<
|
|
|
49
49
|
TError = DefaultError,
|
|
50
50
|
TData = TQueryFnData,
|
|
51
51
|
TQueryKey extends QueryKey = QueryKey,
|
|
52
|
-
> extends
|
|
52
|
+
> extends CreateBaseQueryOptions<
|
|
53
53
|
TQueryFnData,
|
|
54
54
|
TError,
|
|
55
55
|
TData,
|
|
@@ -57,7 +57,7 @@ export interface SolidQueryOptions<
|
|
|
57
57
|
TQueryKey
|
|
58
58
|
> {}
|
|
59
59
|
|
|
60
|
-
export type
|
|
60
|
+
export type CreateQueryOptions<
|
|
61
61
|
TQueryFnData = unknown,
|
|
62
62
|
TError = DefaultError,
|
|
63
63
|
TData = TQueryFnData,
|
|
@@ -66,25 +66,25 @@ export type UseQueryOptions<
|
|
|
66
66
|
|
|
67
67
|
/* --- Create Query and Create Base Query Types --- */
|
|
68
68
|
|
|
69
|
-
export type
|
|
69
|
+
export type CreateBaseQueryResult<
|
|
70
70
|
TData = unknown,
|
|
71
71
|
TError = DefaultError,
|
|
72
72
|
> = QueryObserverResult<TData, TError>
|
|
73
73
|
|
|
74
|
-
export type
|
|
74
|
+
export type CreateQueryResult<
|
|
75
75
|
TData = unknown,
|
|
76
76
|
TError = DefaultError,
|
|
77
|
-
> =
|
|
77
|
+
> = CreateBaseQueryResult<TData, TError>
|
|
78
78
|
|
|
79
|
-
export type
|
|
79
|
+
export type DefinedCreateBaseQueryResult<
|
|
80
80
|
TData = unknown,
|
|
81
81
|
TError = DefaultError,
|
|
82
82
|
> = DefinedQueryObserverResult<TData, TError>
|
|
83
83
|
|
|
84
|
-
export type
|
|
84
|
+
export type DefinedCreateQueryResult<
|
|
85
85
|
TData = unknown,
|
|
86
86
|
TError = DefaultError,
|
|
87
|
-
> =
|
|
87
|
+
> = DefinedCreateBaseQueryResult<TData, TError>
|
|
88
88
|
|
|
89
89
|
/* --- Create Infinite Queries Types --- */
|
|
90
90
|
export interface SolidInfiniteQueryOptions<
|
|
@@ -115,13 +115,13 @@ export interface SolidInfiniteQueryOptions<
|
|
|
115
115
|
deferStream?: boolean
|
|
116
116
|
/**
|
|
117
117
|
* @deprecated The `suspense` option has been deprecated in v5 and will be removed in the next major version.
|
|
118
|
-
* The `data` property on
|
|
118
|
+
* The `data` property on createInfiniteQuery is a SolidJS resource and will automatically suspend when the data is loading.
|
|
119
119
|
* Setting `suspense` to `false` will be a no-op.
|
|
120
120
|
*/
|
|
121
121
|
suspense?: boolean
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
export type
|
|
124
|
+
export type CreateInfiniteQueryOptions<
|
|
125
125
|
TQueryFnData = unknown,
|
|
126
126
|
TError = DefaultError,
|
|
127
127
|
TData = TQueryFnData,
|
|
@@ -138,12 +138,12 @@ export type UseInfiniteQueryOptions<
|
|
|
138
138
|
>
|
|
139
139
|
>
|
|
140
140
|
|
|
141
|
-
export type
|
|
141
|
+
export type CreateInfiniteQueryResult<
|
|
142
142
|
TData = unknown,
|
|
143
143
|
TError = DefaultError,
|
|
144
144
|
> = InfiniteQueryObserverResult<TData, TError>
|
|
145
145
|
|
|
146
|
-
export type
|
|
146
|
+
export type DefinedCreateInfiniteQueryResult<
|
|
147
147
|
TData = unknown,
|
|
148
148
|
TError = DefaultError,
|
|
149
149
|
> = DefinedInfiniteQueryObserverResult<TData, TError>
|
|
@@ -159,14 +159,14 @@ export interface SolidMutationOptions<
|
|
|
159
159
|
'_defaulted'
|
|
160
160
|
> {}
|
|
161
161
|
|
|
162
|
-
export type
|
|
162
|
+
export type CreateMutationOptions<
|
|
163
163
|
TData = unknown,
|
|
164
164
|
TError = DefaultError,
|
|
165
165
|
TVariables = void,
|
|
166
166
|
TContext = unknown,
|
|
167
167
|
> = Accessor<SolidMutationOptions<TData, TError, TVariables, TContext>>
|
|
168
168
|
|
|
169
|
-
export type
|
|
169
|
+
export type CreateMutateFunction<
|
|
170
170
|
TData = unknown,
|
|
171
171
|
TError = DefaultError,
|
|
172
172
|
TVariables = void,
|
|
@@ -175,28 +175,28 @@ export type UseMutateFunction<
|
|
|
175
175
|
...args: Parameters<MutateFunction<TData, TError, TVariables, TContext>>
|
|
176
176
|
) => void
|
|
177
177
|
|
|
178
|
-
export type
|
|
178
|
+
export type CreateMutateAsyncFunction<
|
|
179
179
|
TData = unknown,
|
|
180
180
|
TError = DefaultError,
|
|
181
181
|
TVariables = void,
|
|
182
182
|
TContext = unknown,
|
|
183
183
|
> = MutateFunction<TData, TError, TVariables, TContext>
|
|
184
184
|
|
|
185
|
-
export type
|
|
185
|
+
export type CreateBaseMutationResult<
|
|
186
186
|
TData = unknown,
|
|
187
187
|
TError = DefaultError,
|
|
188
188
|
TVariables = unknown,
|
|
189
189
|
TContext = unknown,
|
|
190
190
|
> = Override<
|
|
191
191
|
MutationObserverResult<TData, TError, TVariables, TContext>,
|
|
192
|
-
{ mutate:
|
|
192
|
+
{ mutate: CreateMutateFunction<TData, TError, TVariables, TContext> }
|
|
193
193
|
> & {
|
|
194
|
-
mutateAsync:
|
|
194
|
+
mutateAsync: CreateMutateAsyncFunction<TData, TError, TVariables, TContext>
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
export type
|
|
197
|
+
export type CreateMutationResult<
|
|
198
198
|
TData = unknown,
|
|
199
199
|
TError = DefaultError,
|
|
200
200
|
TVariables = unknown,
|
|
201
201
|
TContext = unknown,
|
|
202
|
-
> =
|
|
202
|
+
> = CreateBaseMutationResult<TData, TError, TVariables, TContext>
|