@tanstack/solid-query 5.51.17 → 5.51.19

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 CHANGED
@@ -306,9 +306,6 @@ function createBaseQuery(options, Observer, queryClient) {
306
306
  }
307
307
 
308
308
  // src/createQuery.ts
309
- function queryOptions(options) {
310
- return options;
311
- }
312
309
  function createQuery(options, queryClient) {
313
310
  return createBaseQuery(
314
311
  solidJs.createMemo(() => options()),
@@ -316,6 +313,11 @@ function createQuery(options, queryClient) {
316
313
  queryClient
317
314
  );
318
315
  }
316
+
317
+ // src/queryOptions.ts
318
+ function queryOptions(options) {
319
+ return options;
320
+ }
319
321
  function useIsFetching(filters, queryClient) {
320
322
  const client = solidJs.createMemo(() => exports.useQueryClient(queryClient?.()));
321
323
  const queryCache = solidJs.createMemo(() => client().getQueryCache());
@@ -326,9 +328,6 @@ function useIsFetching(filters, queryClient) {
326
328
  solidJs.onCleanup(unsubscribe);
327
329
  return fetches;
328
330
  }
329
- function infiniteQueryOptions(options) {
330
- return options;
331
- }
332
331
  function createInfiniteQuery(options, queryClient) {
333
332
  return createBaseQuery(
334
333
  solidJs.createMemo(() => options()),
@@ -336,6 +335,11 @@ function createInfiniteQuery(options, queryClient) {
336
335
  queryClient
337
336
  );
338
337
  }
338
+
339
+ // src/infiniteQueryOptions.ts
340
+ function infiniteQueryOptions(options) {
341
+ return options;
342
+ }
339
343
  function createMutation(options, queryClient) {
340
344
  const client = solidJs.createMemo(() => exports.useQueryClient(queryClient?.()));
341
345
  const observer = new queryCore.MutationObserver(
package/build/dev.js CHANGED
@@ -305,9 +305,6 @@ function createBaseQuery(options, Observer, queryClient) {
305
305
  }
306
306
 
307
307
  // src/createQuery.ts
308
- function queryOptions(options) {
309
- return options;
310
- }
311
308
  function createQuery(options, queryClient) {
312
309
  return createBaseQuery(
313
310
  createMemo(() => options()),
@@ -315,6 +312,11 @@ function createQuery(options, queryClient) {
315
312
  queryClient
316
313
  );
317
314
  }
315
+
316
+ // src/queryOptions.ts
317
+ function queryOptions(options) {
318
+ return options;
319
+ }
318
320
  function useIsFetching(filters, queryClient) {
319
321
  const client = createMemo(() => useQueryClient(queryClient?.()));
320
322
  const queryCache = createMemo(() => client().getQueryCache());
@@ -325,9 +327,6 @@ function useIsFetching(filters, queryClient) {
325
327
  onCleanup(unsubscribe);
326
328
  return fetches;
327
329
  }
328
- function infiniteQueryOptions(options) {
329
- return options;
330
- }
331
330
  function createInfiniteQuery(options, queryClient) {
332
331
  return createBaseQuery(
333
332
  createMemo(() => options()),
@@ -335,6 +334,11 @@ function createInfiniteQuery(options, queryClient) {
335
334
  queryClient
336
335
  );
337
336
  }
337
+
338
+ // src/infiniteQueryOptions.ts
339
+ function infiniteQueryOptions(options) {
340
+ return options;
341
+ }
338
342
  function createMutation(options, queryClient) {
339
343
  const client = createMemo(() => useQueryClient(queryClient?.()));
340
344
  const observer = new MutationObserver(
package/build/index.cjs CHANGED
@@ -297,9 +297,6 @@ function createBaseQuery(options, Observer, queryClient) {
297
297
  }
298
298
 
299
299
  // src/createQuery.ts
300
- function queryOptions(options) {
301
- return options;
302
- }
303
300
  function createQuery(options, queryClient) {
304
301
  return createBaseQuery(
305
302
  solidJs.createMemo(() => options()),
@@ -307,6 +304,11 @@ function createQuery(options, queryClient) {
307
304
  queryClient
308
305
  );
309
306
  }
307
+
308
+ // src/queryOptions.ts
309
+ function queryOptions(options) {
310
+ return options;
311
+ }
310
312
  function useIsFetching(filters, queryClient) {
311
313
  const client = solidJs.createMemo(() => exports.useQueryClient(queryClient?.()));
312
314
  const queryCache = solidJs.createMemo(() => client().getQueryCache());
@@ -317,9 +319,6 @@ function useIsFetching(filters, queryClient) {
317
319
  solidJs.onCleanup(unsubscribe);
318
320
  return fetches;
319
321
  }
320
- function infiniteQueryOptions(options) {
321
- return options;
322
- }
323
322
  function createInfiniteQuery(options, queryClient) {
324
323
  return createBaseQuery(
325
324
  solidJs.createMemo(() => options()),
@@ -327,6 +326,11 @@ function createInfiniteQuery(options, queryClient) {
327
326
  queryClient
328
327
  );
329
328
  }
329
+
330
+ // src/infiniteQueryOptions.ts
331
+ function infiniteQueryOptions(options) {
332
+ return options;
333
+ }
330
334
  function createMutation(options, queryClient) {
331
335
  const client = solidJs.createMemo(() => exports.useQueryClient(queryClient?.()));
332
336
  const observer = new queryCore.MutationObserver(
package/build/index.d.cts CHANGED
@@ -100,6 +100,7 @@ declare function queryOptions<TQueryFnData = unknown, TError = unknown, TData =
100
100
  declare function queryOptions<TQueryFnData = unknown, TError = unknown, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TOptions extends ReturnType<DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>> = ReturnType<DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>>>(options: ReturnType<DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>>): ReturnType<DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>> & {
101
101
  queryKey: DataTag<TQueryKey, TQueryFnData>;
102
102
  };
103
+
103
104
  declare function createQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>, queryClient?: () => QueryClient): CreateQueryResult<TData, TError>;
104
105
  declare function createQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>, queryClient?: () => QueryClient): DefinedCreateQueryResult<TData, TError>;
105
106
 
package/build/index.d.ts CHANGED
@@ -100,6 +100,7 @@ declare function queryOptions<TQueryFnData = unknown, TError = unknown, TData =
100
100
  declare function queryOptions<TQueryFnData = unknown, TError = unknown, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TOptions extends ReturnType<DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>> = ReturnType<DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>>>(options: ReturnType<DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>>): ReturnType<DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>> & {
101
101
  queryKey: DataTag<TQueryKey, TQueryFnData>;
102
102
  };
103
+
103
104
  declare function createQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>, queryClient?: () => QueryClient): CreateQueryResult<TData, TError>;
104
105
  declare function createQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>, queryClient?: () => QueryClient): DefinedCreateQueryResult<TData, TError>;
105
106
 
package/build/index.js CHANGED
@@ -296,9 +296,6 @@ function createBaseQuery(options, Observer, queryClient) {
296
296
  }
297
297
 
298
298
  // src/createQuery.ts
299
- function queryOptions(options) {
300
- return options;
301
- }
302
299
  function createQuery(options, queryClient) {
303
300
  return createBaseQuery(
304
301
  createMemo(() => options()),
@@ -306,6 +303,11 @@ function createQuery(options, queryClient) {
306
303
  queryClient
307
304
  );
308
305
  }
306
+
307
+ // src/queryOptions.ts
308
+ function queryOptions(options) {
309
+ return options;
310
+ }
309
311
  function useIsFetching(filters, queryClient) {
310
312
  const client = createMemo(() => useQueryClient(queryClient?.()));
311
313
  const queryCache = createMemo(() => client().getQueryCache());
@@ -316,9 +318,6 @@ function useIsFetching(filters, queryClient) {
316
318
  onCleanup(unsubscribe);
317
319
  return fetches;
318
320
  }
319
- function infiniteQueryOptions(options) {
320
- return options;
321
- }
322
321
  function createInfiniteQuery(options, queryClient) {
323
322
  return createBaseQuery(
324
323
  createMemo(() => options()),
@@ -326,6 +325,11 @@ function createInfiniteQuery(options, queryClient) {
326
325
  queryClient
327
326
  );
328
327
  }
328
+
329
+ // src/infiniteQueryOptions.ts
330
+ function infiniteQueryOptions(options) {
331
+ return options;
332
+ }
329
333
  function createMutation(options, queryClient) {
330
334
  const client = createMemo(() => useQueryClient(queryClient?.()));
331
335
  const observer = new MutationObserver(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/solid-query",
3
- "version": "5.51.17",
3
+ "version": "5.51.19",
4
4
  "description": "Primitives for managing, caching and syncing asynchronous and remote data in Solid",
5
5
  "author": "tannerlinsley",
6
6
  "license": "MIT",
@@ -1,14 +1,12 @@
1
1
  import { describe } from 'node:test'
2
2
  import { expectTypeOf, it } from 'vitest'
3
3
  import { type InfiniteData, dataTagSymbol } from '@tanstack/query-core'
4
- import {
5
- createInfiniteQuery,
6
- infiniteQueryOptions,
7
- } from '../createInfiniteQuery'
4
+ import { createInfiniteQuery } from '../createInfiniteQuery'
5
+ import { infiniteQueryOptions } from '../infiniteQueryOptions'
8
6
  import type {
9
7
  DefinedInitialDataInfiniteOptions,
10
8
  UndefinedInitialDataInfiniteOptions,
11
- } from '../createInfiniteQuery'
9
+ } from '../infiniteQueryOptions'
12
10
 
13
11
  const doNotRun = (_callback: () => void) => {}
14
12
 
@@ -1,6 +1,7 @@
1
1
  import { describe, expect, expectTypeOf, it } from 'vitest'
2
2
  import { QueryClient, dataTagSymbol, skipToken } from '@tanstack/query-core'
3
- import { createQuery, queryOptions } from '../createQuery'
3
+ import { createQuery } from '../createQuery'
4
+ import { queryOptions } from '../queryOptions'
4
5
 
5
6
  describe('queryOptions', () => {
6
7
  it('should not allow excess properties', () => {
@@ -2,7 +2,6 @@ import { InfiniteQueryObserver } from '@tanstack/query-core'
2
2
  import { createMemo } from 'solid-js'
3
3
  import { createBaseQuery } from './createBaseQuery'
4
4
  import type {
5
- DataTag,
6
5
  DefaultError,
7
6
  InfiniteData,
8
7
  QueryKey,
@@ -13,111 +12,12 @@ import type {
13
12
  CreateInfiniteQueryOptions,
14
13
  CreateInfiniteQueryResult,
15
14
  DefinedCreateInfiniteQueryResult,
16
- FunctionedParams,
17
- SolidInfiniteQueryOptions,
18
15
  } from './types'
19
16
  import type { Accessor } from 'solid-js'
20
-
21
- export type UndefinedInitialDataInfiniteOptions<
22
- TQueryFnData,
23
- TError = DefaultError,
24
- TData = InfiniteData<TQueryFnData>,
25
- TQueryKey extends QueryKey = QueryKey,
26
- TPageParam = unknown,
27
- > = FunctionedParams<
28
- SolidInfiniteQueryOptions<
29
- TQueryFnData,
30
- TError,
31
- TData,
32
- TQueryFnData,
33
- TQueryKey,
34
- TPageParam
35
- > & {
36
- initialData?: undefined
37
- }
38
- >
39
- type NonUndefinedGuard<T> = T extends undefined ? never : T
40
- export type DefinedInitialDataInfiniteOptions<
41
- TQueryFnData,
42
- TError = DefaultError,
43
- // should we handle page param correctly
44
- TData = InfiniteData<TQueryFnData>,
45
- TQueryKey extends QueryKey = QueryKey,
46
- TPageParam = unknown,
47
- > = FunctionedParams<
48
- SolidInfiniteQueryOptions<
49
- TQueryFnData,
50
- TError,
51
- TData,
52
- TQueryFnData,
53
- TQueryKey,
54
- TPageParam
55
- > & {
56
- initialData:
57
- | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>
58
- | (() => NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>)
59
- }
60
- >
61
- function infiniteQueryOptions<
62
- TQueryFnData,
63
- TError = DefaultError,
64
- TData = InfiniteData<TQueryFnData>,
65
- TQueryKey extends QueryKey = QueryKey,
66
- TPageParam = unknown,
67
- >(
68
- options: ReturnType<
69
- DefinedInitialDataInfiniteOptions<
70
- TQueryFnData,
71
- TError,
72
- TData,
73
- TQueryKey,
74
- TPageParam
75
- >
76
- >,
77
- ): ReturnType<
78
- DefinedInitialDataInfiniteOptions<
79
- TQueryFnData,
80
- TError,
81
- TData,
82
- TQueryKey,
83
- TPageParam
84
- >
85
- > & {
86
- queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>>
87
- }
88
- function infiniteQueryOptions<
89
- TQueryFnData,
90
- TError = DefaultError,
91
- TData = InfiniteData<TQueryFnData>,
92
- TQueryKey extends QueryKey = QueryKey,
93
- TPageParam = unknown,
94
- >(
95
- options: ReturnType<
96
- UndefinedInitialDataInfiniteOptions<
97
- TQueryFnData,
98
- TError,
99
- TData,
100
- TQueryKey,
101
- TPageParam
102
- >
103
- >,
104
- ): ReturnType<
105
- UndefinedInitialDataInfiniteOptions<
106
- TQueryFnData,
107
- TError,
108
- TData,
109
- TQueryKey,
110
- TPageParam
111
- >
112
- > & {
113
- queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>>
114
- }
115
-
116
- function infiniteQueryOptions(options: unknown) {
117
- return options
118
- }
119
-
120
- export { infiniteQueryOptions }
17
+ import type {
18
+ DefinedInitialDataInfiniteOptions,
19
+ UndefinedInitialDataInfiniteOptions,
20
+ } from './infiniteQueryOptions'
121
21
 
122
22
  export function createInfiniteQuery<
123
23
  TQueryFnData,
@@ -1,82 +1,18 @@
1
1
  import { QueryObserver } from '@tanstack/query-core'
2
2
  import { createMemo } from 'solid-js'
3
3
  import { createBaseQuery } from './createBaseQuery'
4
- import type { DataTag, DefaultError, QueryKey } from '@tanstack/query-core'
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
8
  CreateQueryOptions,
9
9
  CreateQueryResult,
10
10
  DefinedCreateQueryResult,
11
- FunctionedParams,
12
- SolidQueryOptions,
13
11
  } from './types'
14
-
15
- export type UndefinedInitialDataOptions<
16
- TQueryFnData = unknown,
17
- TError = DefaultError,
18
- TData = TQueryFnData,
19
- TQueryKey extends QueryKey = QueryKey,
20
- > = FunctionedParams<
21
- SolidQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {
22
- initialData?: undefined
23
- }
24
- >
25
-
26
- export type DefinedInitialDataOptions<
27
- TQueryFnData = unknown,
28
- TError = DefaultError,
29
- TData = TQueryFnData,
30
- TQueryKey extends QueryKey = QueryKey,
31
- > = FunctionedParams<
32
- SolidQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {
33
- initialData: TQueryFnData | (() => TQueryFnData)
34
- }
35
- >
36
-
37
- export function queryOptions<
38
- TQueryFnData = unknown,
39
- TError = unknown,
40
- TData = TQueryFnData,
41
- TQueryKey extends QueryKey = QueryKey,
42
- TOptions extends ReturnType<
43
- UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>
44
- > = ReturnType<
45
- UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>
46
- >,
47
- >(
48
- options: ReturnType<
49
- UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>
50
- >,
51
- ): ReturnType<
52
- UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>
53
- > & {
54
- queryKey: DataTag<TQueryKey, TQueryFnData>
55
- }
56
-
57
- export function queryOptions<
58
- TQueryFnData = unknown,
59
- TError = unknown,
60
- TData = TQueryFnData,
61
- TQueryKey extends QueryKey = QueryKey,
62
- TOptions extends ReturnType<
63
- DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>
64
- > = ReturnType<
65
- DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>
66
- >,
67
- >(
68
- options: ReturnType<
69
- DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>
70
- >,
71
- ): ReturnType<
72
- DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>
73
- > & {
74
- queryKey: DataTag<TQueryKey, TQueryFnData>
75
- }
76
-
77
- export function queryOptions(options: unknown) {
78
- return options
79
- }
12
+ import type {
13
+ DefinedInitialDataOptions,
14
+ UndefinedInitialDataOptions,
15
+ } from './queryOptions'
80
16
 
81
17
  export function createQuery<
82
18
  TQueryFnData = unknown,
package/src/index.ts CHANGED
@@ -12,11 +12,12 @@ export type {
12
12
  QueryClientConfig,
13
13
  InfiniteQueryObserverOptions,
14
14
  } from './QueryClient'
15
- export { createQuery, queryOptions } from './createQuery'
15
+ export { createQuery } from './createQuery'
16
+ export { queryOptions } from './queryOptions'
16
17
  export type {
17
18
  DefinedInitialDataOptions,
18
19
  UndefinedInitialDataOptions,
19
- } from './createQuery'
20
+ } from './queryOptions'
20
21
  export {
21
22
  QueryClientContext,
22
23
  QueryClientProvider,
@@ -24,14 +25,12 @@ export {
24
25
  } from './QueryClientProvider'
25
26
  export type { QueryClientProviderProps } from './QueryClientProvider'
26
27
  export { useIsFetching } from './useIsFetching'
27
- export {
28
- createInfiniteQuery,
29
- infiniteQueryOptions,
30
- } from './createInfiniteQuery'
28
+ export { createInfiniteQuery } from './createInfiniteQuery'
29
+ export { infiniteQueryOptions } from './infiniteQueryOptions'
31
30
  export type {
32
31
  DefinedInitialDataInfiniteOptions,
33
32
  UndefinedInitialDataInfiniteOptions,
34
- } from './createInfiniteQuery'
33
+ } from './infiniteQueryOptions'
35
34
  export { createMutation } from './createMutation'
36
35
  export { useIsMutating } from './useIsMutating'
37
36
  export { useMutationState } from './useMutationState'
@@ -0,0 +1,108 @@
1
+ import type {
2
+ DataTag,
3
+ DefaultError,
4
+ InfiniteData,
5
+ QueryKey,
6
+ } from '@tanstack/query-core'
7
+ import type { FunctionedParams, SolidInfiniteQueryOptions } from './types'
8
+
9
+ export type UndefinedInitialDataInfiniteOptions<
10
+ TQueryFnData,
11
+ TError = DefaultError,
12
+ TData = InfiniteData<TQueryFnData>,
13
+ TQueryKey extends QueryKey = QueryKey,
14
+ TPageParam = unknown,
15
+ > = FunctionedParams<
16
+ SolidInfiniteQueryOptions<
17
+ TQueryFnData,
18
+ TError,
19
+ TData,
20
+ TQueryFnData,
21
+ TQueryKey,
22
+ TPageParam
23
+ > & {
24
+ initialData?: undefined
25
+ }
26
+ >
27
+
28
+ type NonUndefinedGuard<T> = T extends undefined ? never : T
29
+
30
+ export type DefinedInitialDataInfiniteOptions<
31
+ TQueryFnData,
32
+ TError = DefaultError,
33
+ // should we handle page param correctly
34
+ TData = InfiniteData<TQueryFnData>,
35
+ TQueryKey extends QueryKey = QueryKey,
36
+ TPageParam = unknown,
37
+ > = FunctionedParams<
38
+ SolidInfiniteQueryOptions<
39
+ TQueryFnData,
40
+ TError,
41
+ TData,
42
+ TQueryFnData,
43
+ TQueryKey,
44
+ TPageParam
45
+ > & {
46
+ initialData:
47
+ | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>
48
+ | (() => NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>)
49
+ }
50
+ >
51
+ export function infiniteQueryOptions<
52
+ TQueryFnData,
53
+ TError = DefaultError,
54
+ TData = InfiniteData<TQueryFnData>,
55
+ TQueryKey extends QueryKey = QueryKey,
56
+ TPageParam = unknown,
57
+ >(
58
+ options: ReturnType<
59
+ DefinedInitialDataInfiniteOptions<
60
+ TQueryFnData,
61
+ TError,
62
+ TData,
63
+ TQueryKey,
64
+ TPageParam
65
+ >
66
+ >,
67
+ ): ReturnType<
68
+ DefinedInitialDataInfiniteOptions<
69
+ TQueryFnData,
70
+ TError,
71
+ TData,
72
+ TQueryKey,
73
+ TPageParam
74
+ >
75
+ > & {
76
+ queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>>
77
+ }
78
+ export function infiniteQueryOptions<
79
+ TQueryFnData,
80
+ TError = DefaultError,
81
+ TData = InfiniteData<TQueryFnData>,
82
+ TQueryKey extends QueryKey = QueryKey,
83
+ TPageParam = unknown,
84
+ >(
85
+ options: ReturnType<
86
+ UndefinedInitialDataInfiniteOptions<
87
+ TQueryFnData,
88
+ TError,
89
+ TData,
90
+ TQueryKey,
91
+ TPageParam
92
+ >
93
+ >,
94
+ ): ReturnType<
95
+ UndefinedInitialDataInfiniteOptions<
96
+ TQueryFnData,
97
+ TError,
98
+ TData,
99
+ TQueryKey,
100
+ TPageParam
101
+ >
102
+ > & {
103
+ queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>>
104
+ }
105
+
106
+ export function infiniteQueryOptions(options: unknown) {
107
+ return options
108
+ }
@@ -0,0 +1,68 @@
1
+ import type { DataTag, DefaultError, QueryKey } from '@tanstack/query-core'
2
+ import type { FunctionedParams, SolidQueryOptions } from './types'
3
+
4
+ export type UndefinedInitialDataOptions<
5
+ TQueryFnData = unknown,
6
+ TError = DefaultError,
7
+ TData = TQueryFnData,
8
+ TQueryKey extends QueryKey = QueryKey,
9
+ > = FunctionedParams<
10
+ SolidQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {
11
+ initialData?: undefined
12
+ }
13
+ >
14
+
15
+ export type DefinedInitialDataOptions<
16
+ TQueryFnData = unknown,
17
+ TError = DefaultError,
18
+ TData = TQueryFnData,
19
+ TQueryKey extends QueryKey = QueryKey,
20
+ > = FunctionedParams<
21
+ SolidQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {
22
+ initialData: TQueryFnData | (() => TQueryFnData)
23
+ }
24
+ >
25
+
26
+ export function queryOptions<
27
+ TQueryFnData = unknown,
28
+ TError = unknown,
29
+ TData = TQueryFnData,
30
+ TQueryKey extends QueryKey = QueryKey,
31
+ TOptions extends ReturnType<
32
+ UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>
33
+ > = ReturnType<
34
+ UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>
35
+ >,
36
+ >(
37
+ options: ReturnType<
38
+ UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>
39
+ >,
40
+ ): ReturnType<
41
+ UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>
42
+ > & {
43
+ queryKey: DataTag<TQueryKey, TQueryFnData>
44
+ }
45
+
46
+ export function queryOptions<
47
+ TQueryFnData = unknown,
48
+ TError = unknown,
49
+ TData = TQueryFnData,
50
+ TQueryKey extends QueryKey = QueryKey,
51
+ TOptions extends ReturnType<
52
+ DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>
53
+ > = ReturnType<
54
+ DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>
55
+ >,
56
+ >(
57
+ options: ReturnType<
58
+ DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>
59
+ >,
60
+ ): ReturnType<
61
+ DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>
62
+ > & {
63
+ queryKey: DataTag<TQueryKey, TQueryFnData>
64
+ }
65
+
66
+ export function queryOptions(options: unknown) {
67
+ return options
68
+ }