@openapi-qraft/react 1.2.0 → 1.4.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.
- package/CHANGELOG.md +38 -0
- package/README.md +118 -38
- package/dist/QraftContext.d.ts +8 -10
- package/dist/QraftContext.d.ts.map +1 -1
- package/dist/QraftContext.js.map +1 -1
- package/dist/ServiceOperation.d.ts +152 -5
- package/dist/ServiceOperation.d.ts.map +1 -1
- package/dist/callbacks/cancelQueries.d.ts +2 -2
- package/dist/callbacks/cancelQueries.d.ts.map +1 -1
- package/dist/callbacks/cancelQueries.js.map +1 -1
- package/dist/callbacks/fetchInfiniteQuery.d.ts +7 -0
- package/dist/callbacks/fetchInfiniteQuery.d.ts.map +1 -0
- package/dist/callbacks/fetchInfiniteQuery.js +5 -0
- package/dist/callbacks/fetchInfiniteQuery.js.map +1 -0
- package/dist/callbacks/fetchQuery.d.ts +7 -0
- package/dist/callbacks/fetchQuery.d.ts.map +1 -0
- package/dist/callbacks/fetchQuery.js +5 -0
- package/dist/callbacks/fetchQuery.js.map +1 -0
- package/dist/callbacks/getInfiniteQueryData.d.ts +4 -4
- package/dist/callbacks/getInfiniteQueryData.d.ts.map +1 -1
- package/dist/callbacks/getInfiniteQueryData.js +3 -6
- package/dist/callbacks/getInfiniteQueryData.js.map +1 -1
- package/dist/callbacks/getInfiniteQueryKey.d.ts +2 -2
- package/dist/callbacks/getInfiniteQueryKey.d.ts.map +1 -1
- package/dist/callbacks/getInfiniteQueryKey.js.map +1 -1
- package/dist/callbacks/getMutationKey.d.ts +2 -2
- package/dist/callbacks/getMutationKey.d.ts.map +1 -1
- package/dist/callbacks/getMutationKey.js.map +1 -1
- package/dist/callbacks/getQueryData.d.ts +3 -3
- package/dist/callbacks/getQueryData.d.ts.map +1 -1
- package/dist/callbacks/getQueryData.js +3 -4
- package/dist/callbacks/getQueryData.js.map +1 -1
- package/dist/callbacks/getQueryKey.d.ts +2 -2
- package/dist/callbacks/getQueryKey.d.ts.map +1 -1
- package/dist/callbacks/getQueryKey.js.map +1 -1
- package/dist/callbacks/invalidateQueries.d.ts +2 -2
- package/dist/callbacks/invalidateQueries.d.ts.map +1 -1
- package/dist/callbacks/invalidateQueries.js.map +1 -1
- package/dist/callbacks/isFetching.d.ts +2 -2
- package/dist/callbacks/isFetching.d.ts.map +1 -1
- package/dist/callbacks/isFetching.js.map +1 -1
- package/dist/callbacks/isMutating.d.ts +5 -0
- package/dist/callbacks/isMutating.d.ts.map +1 -0
- package/dist/callbacks/isMutating.js +5 -0
- package/dist/callbacks/isMutating.js.map +1 -0
- package/dist/callbacks/mutationFn.d.ts +2 -2
- package/dist/callbacks/mutationFn.d.ts.map +1 -1
- package/dist/callbacks/mutationFn.js.map +1 -1
- package/dist/callbacks/prefetchInfiniteQuery.d.ts +7 -0
- package/dist/callbacks/prefetchInfiniteQuery.d.ts.map +1 -0
- package/dist/callbacks/prefetchInfiniteQuery.js +5 -0
- package/dist/callbacks/prefetchInfiniteQuery.js.map +1 -0
- package/dist/callbacks/prefetchQuery.d.ts +7 -0
- package/dist/callbacks/prefetchQuery.d.ts.map +1 -0
- package/dist/callbacks/prefetchQuery.js +5 -0
- package/dist/callbacks/prefetchQuery.js.map +1 -0
- package/dist/callbacks/queryFn.js.map +1 -1
- package/dist/callbacks/refetchQueries.d.ts +2 -2
- package/dist/callbacks/refetchQueries.d.ts.map +1 -1
- package/dist/callbacks/refetchQueries.js.map +1 -1
- package/dist/callbacks/removeQueries.d.ts +5 -0
- package/dist/callbacks/removeQueries.d.ts.map +1 -0
- package/dist/callbacks/removeQueries.js +5 -0
- package/dist/callbacks/removeQueries.js.map +1 -0
- package/dist/callbacks/resetQueries.d.ts +2 -2
- package/dist/callbacks/resetQueries.d.ts.map +1 -1
- package/dist/callbacks/resetQueries.js.map +1 -1
- package/dist/callbacks/setInfiniteQueryData.d.ts +2 -2
- package/dist/callbacks/setInfiniteQueryData.d.ts.map +1 -1
- package/dist/callbacks/setInfiniteQueryData.js +2 -6
- package/dist/callbacks/setInfiniteQueryData.js.map +1 -1
- package/dist/callbacks/setQueryData.d.ts +3 -3
- package/dist/callbacks/setQueryData.d.ts.map +1 -1
- package/dist/callbacks/setQueryData.js +3 -7
- package/dist/callbacks/setQueryData.js.map +1 -1
- package/dist/callbacks/useInfiniteQuery.d.ts +4 -4
- package/dist/callbacks/useInfiniteQuery.d.ts.map +1 -1
- package/dist/callbacks/useInfiniteQuery.js +4 -24
- package/dist/callbacks/useInfiniteQuery.js.map +1 -1
- package/dist/callbacks/useIsFetching.d.ts +2 -2
- package/dist/callbacks/useIsFetching.d.ts.map +1 -1
- package/dist/callbacks/useIsFetching.js +0 -3
- package/dist/callbacks/useIsFetching.js.map +1 -1
- package/dist/callbacks/useIsMutating.d.ts +7 -0
- package/dist/callbacks/useIsMutating.d.ts.map +1 -0
- package/dist/callbacks/useIsMutating.js +9 -0
- package/dist/callbacks/useIsMutating.js.map +1 -0
- package/dist/callbacks/useMutation.d.ts +2 -2
- package/dist/callbacks/useMutation.d.ts.map +1 -1
- package/dist/callbacks/useMutation.js +6 -4
- package/dist/callbacks/useMutation.js.map +1 -1
- package/dist/callbacks/useMutationState.d.ts +2 -2
- package/dist/callbacks/useMutationState.d.ts.map +1 -1
- package/dist/callbacks/useMutationState.js +2 -15
- package/dist/callbacks/useMutationState.js.map +1 -1
- package/dist/callbacks/useQueries.d.ts +2 -2
- package/dist/callbacks/useQueries.d.ts.map +1 -1
- package/dist/callbacks/useQueries.js +5 -3
- package/dist/callbacks/useQueries.js.map +1 -1
- package/dist/callbacks/useQuery.d.ts +3 -3
- package/dist/callbacks/useQuery.d.ts.map +1 -1
- package/dist/callbacks/useQuery.js +4 -23
- package/dist/callbacks/useQuery.js.map +1 -1
- package/dist/callbacks/useSuspenseInfiniteQuery.d.ts +4 -4
- package/dist/callbacks/useSuspenseInfiniteQuery.d.ts.map +1 -1
- package/dist/callbacks/useSuspenseInfiniteQuery.js +4 -24
- package/dist/callbacks/useSuspenseInfiniteQuery.js.map +1 -1
- package/dist/callbacks/useSuspenseQueries.d.ts +2 -2
- package/dist/callbacks/useSuspenseQueries.d.ts.map +1 -1
- package/dist/callbacks/useSuspenseQueries.js +5 -3
- package/dist/callbacks/useSuspenseQueries.js.map +1 -1
- package/dist/callbacks/useSuspenseQuery.d.ts +4 -4
- package/dist/callbacks/useSuspenseQuery.d.ts.map +1 -1
- package/dist/callbacks/useSuspenseQuery.js +4 -23
- package/dist/callbacks/useSuspenseQuery.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/callQueryClientFetchMethod.d.ts +20 -0
- package/dist/lib/callQueryClientFetchMethod.d.ts.map +1 -0
- package/dist/lib/callQueryClientFetchMethod.js +48 -0
- package/dist/lib/callQueryClientFetchMethod.js.map +1 -0
- package/dist/lib/callQueryClientMethodWithMutationFilters.d.ts +11 -0
- package/dist/lib/callQueryClientMethodWithMutationFilters.d.ts.map +1 -0
- package/dist/lib/callQueryClientMethodWithMutationFilters.js +18 -0
- package/dist/lib/callQueryClientMethodWithMutationFilters.js.map +1 -0
- package/dist/lib/callQueryClientMethodWithQueryFilters.d.ts +2 -2
- package/dist/lib/callQueryClientMethodWithQueryFilters.d.ts.map +1 -1
- package/dist/lib/callQueryClientMethodWithQueryFilters.js +5 -13
- package/dist/lib/callQueryClientMethodWithQueryFilters.js.map +1 -1
- package/dist/lib/callQueryClientMethodWithQueryKey.d.ts +11 -0
- package/dist/lib/callQueryClientMethodWithQueryKey.d.ts.map +1 -0
- package/dist/lib/callQueryClientMethodWithQueryKey.js +22 -0
- package/dist/lib/callQueryClientMethodWithQueryKey.js.map +1 -0
- package/dist/lib/composeInfiniteQueryKey.d.ts +2 -2
- package/dist/lib/composeInfiniteQueryKey.d.ts.map +1 -1
- package/dist/lib/composeMutationFilters.d.ts +11 -0
- package/dist/lib/composeMutationFilters.d.ts.map +1 -0
- package/dist/lib/composeMutationFilters.js +32 -0
- package/dist/lib/composeMutationFilters.js.map +1 -0
- package/dist/lib/composeMutationKey.d.ts +3 -3
- package/dist/lib/composeMutationKey.d.ts.map +1 -1
- package/dist/lib/composeMutationKey.js +1 -1
- package/dist/lib/composeMutationKey.js.map +1 -1
- package/dist/lib/composeQueryFilters.d.ts +3 -3
- package/dist/lib/composeQueryFilters.d.ts.map +1 -1
- package/dist/lib/composeQueryFilters.js.map +1 -1
- package/dist/lib/composeQueryKey.d.ts +2 -2
- package/dist/lib/composeQueryKey.d.ts.map +1 -1
- package/dist/lib/composeQueryKey.js.map +1 -1
- package/dist/lib/{request.d.ts → requestFn.d.ts} +28 -18
- package/dist/lib/requestFn.d.ts.map +1 -0
- package/dist/lib/{request.js → requestFn.js} +16 -21
- package/dist/lib/requestFn.js.map +1 -0
- package/dist/lib/useComposeUseQueryOptions.d.ts +16 -0
- package/dist/lib/useComposeUseQueryOptions.d.ts.map +1 -0
- package/dist/lib/useComposeUseQueryOptions.js +40 -0
- package/dist/lib/useComposeUseQueryOptions.js.map +1 -0
- package/dist/qraftAPIClient.d.ts +3 -3
- package/dist/qraftAPIClient.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/QraftContext.ts +13 -16
- package/src/ServiceOperation.ts +360 -6
- package/src/callbacks/cancelQueries.ts +3 -3
- package/src/callbacks/fetchInfiniteQuery.ts +22 -0
- package/src/callbacks/fetchQuery.ts +20 -0
- package/src/callbacks/getInfiniteQueryData.ts +13 -16
- package/src/callbacks/getInfiniteQueryKey.ts +3 -3
- package/src/callbacks/getMutationKey.ts +3 -3
- package/src/callbacks/getQueryData.ts +12 -14
- package/src/callbacks/getQueryKey.ts +3 -7
- package/src/callbacks/invalidateQueries.ts +3 -3
- package/src/callbacks/isFetching.ts +3 -3
- package/src/callbacks/isMutating.ts +22 -0
- package/src/callbacks/mutationFn.ts +3 -3
- package/src/callbacks/prefetchInfiniteQuery.ts +22 -0
- package/src/callbacks/prefetchQuery.ts +22 -0
- package/src/callbacks/queryFn.ts +2 -2
- package/src/callbacks/refetchQueries.ts +3 -3
- package/src/callbacks/removeQueries.ts +22 -0
- package/src/callbacks/resetQueries.ts +3 -3
- package/src/callbacks/setInfiniteQueryData.ts +11 -18
- package/src/callbacks/setQueryData.ts +13 -18
- package/src/callbacks/useInfiniteQuery.ts +8 -48
- package/src/callbacks/useIsFetching.ts +3 -9
- package/src/callbacks/useIsMutating.ts +42 -0
- package/src/callbacks/useMutation.ts +15 -20
- package/src/callbacks/useMutationState.ts +5 -30
- package/src/callbacks/useQueries.ts +12 -17
- package/src/callbacks/useQuery.ts +7 -43
- package/src/callbacks/useSuspenseInfiniteQuery.ts +8 -44
- package/src/callbacks/useSuspenseQueries.ts +12 -13
- package/src/callbacks/useSuspenseQuery.ts +8 -45
- package/src/index.ts +6 -6
- package/src/lib/callQueryClientFetchMethod.ts +90 -0
- package/src/lib/callQueryClientMethodWithMutationFilters.ts +37 -0
- package/src/lib/callQueryClientMethodWithQueryFilters.ts +10 -23
- package/src/lib/callQueryClientMethodWithQueryKey.ts +46 -0
- package/src/lib/composeInfiniteQueryKey.ts +2 -2
- package/src/lib/composeMutationFilters.ts +44 -0
- package/src/lib/composeMutationKey.ts +5 -8
- package/src/lib/composeQueryFilters.ts +2 -2
- package/src/lib/composeQueryKey.ts +2 -5
- package/src/lib/{request.ts → requestFn.ts} +61 -59
- package/src/lib/useComposeUseQueryOptions.ts +64 -0
- package/src/qraftAPIClient.ts +4 -4
- package/dist/RequestClient.d.ts +0 -3
- package/dist/RequestClient.d.ts.map +0 -1
- package/dist/RequestClient.js +0 -2
- package/dist/RequestClient.js.map +0 -1
- package/dist/lib/request.d.ts.map +0 -1
- package/dist/lib/request.js.map +0 -1
- package/src/RequestClient.ts +0 -11
|
@@ -1,61 +1,25 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { useContext } from 'react';
|
|
4
|
-
|
|
5
3
|
import type { DefaultError } from '@tanstack/query-core';
|
|
6
4
|
import {
|
|
7
5
|
useQuery as useQueryTanstack,
|
|
8
6
|
type UseQueryResult,
|
|
9
7
|
} from '@tanstack/react-query';
|
|
10
8
|
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import { useQueryClient } from '../lib/useQueryClient.js';
|
|
9
|
+
import type { OperationSchema } from '../lib/requestFn.js';
|
|
10
|
+
import { useComposeUseQueryOptions } from '../lib/useComposeUseQueryOptions.js';
|
|
14
11
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
ServiceOperationQuery,
|
|
18
|
-
ServiceOperationQueryKey,
|
|
19
|
-
} from '../ServiceOperation.js';
|
|
12
|
+
import type { ServiceOperationQuery } from '../ServiceOperation.js';
|
|
20
13
|
|
|
21
14
|
export const useQuery: <TData = unknown, TError = DefaultError>(
|
|
22
15
|
qraftOptions: QraftClientOptions | undefined,
|
|
23
|
-
schema:
|
|
16
|
+
schema: OperationSchema,
|
|
24
17
|
args: Parameters<
|
|
25
|
-
ServiceOperationQuery<
|
|
18
|
+
ServiceOperationQuery<OperationSchema, unknown, unknown>['useQuery']
|
|
26
19
|
>
|
|
27
20
|
) => UseQueryResult<TData, TError> = (qraftOptions, schema, args) => {
|
|
28
|
-
const [parameters, options, queryClientByArg] = args;
|
|
29
|
-
|
|
30
|
-
const contextValue = useContext(qraftOptions?.context ?? QraftContext);
|
|
31
|
-
if (!contextValue?.request) throw new Error(`QraftContext.request not found`);
|
|
32
|
-
|
|
33
|
-
const queryKey: ServiceOperationQueryKey<OperationRequestSchema, unknown> =
|
|
34
|
-
Array.isArray(parameters)
|
|
35
|
-
? (parameters as ServiceOperationQueryKey<
|
|
36
|
-
OperationRequestSchema,
|
|
37
|
-
unknown
|
|
38
|
-
>)
|
|
39
|
-
: composeQueryKey(schema, parameters);
|
|
40
|
-
|
|
41
21
|
return useQueryTanstack(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
queryKey,
|
|
45
|
-
queryFn:
|
|
46
|
-
options?.queryFn ??
|
|
47
|
-
function ({ queryKey: [, queryParams], signal, meta }) {
|
|
48
|
-
return contextValue.request(
|
|
49
|
-
{ baseUrl: contextValue.baseUrl },
|
|
50
|
-
schema,
|
|
51
|
-
{
|
|
52
|
-
parameters: queryParams as never,
|
|
53
|
-
signal,
|
|
54
|
-
meta,
|
|
55
|
-
}
|
|
56
|
-
);
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
useQueryClient(qraftOptions, queryClientByArg)
|
|
22
|
+
// @ts-expect-error
|
|
23
|
+
...useComposeUseQueryOptions(qraftOptions, schema, args, false)
|
|
60
24
|
) as never;
|
|
61
25
|
};
|
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { useContext } from 'react';
|
|
4
|
-
|
|
5
3
|
import type { DefaultError, InfiniteData } from '@tanstack/query-core';
|
|
6
4
|
import {
|
|
7
5
|
useSuspenseInfiniteQuery as useSuspenseInfiniteQueryTanstack,
|
|
8
|
-
UseSuspenseInfiniteQueryResult,
|
|
6
|
+
type UseSuspenseInfiniteQueryResult,
|
|
9
7
|
} from '@tanstack/react-query';
|
|
10
8
|
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import { shelfMerge } from '../lib/shelfMerge.js';
|
|
14
|
-
import { useQueryClient } from '../lib/useQueryClient.js';
|
|
9
|
+
import type { OperationSchema } from '../lib/requestFn.js';
|
|
10
|
+
import { useComposeUseQueryOptions } from '../lib/useComposeUseQueryOptions.js';
|
|
15
11
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
ServiceOperationInfiniteQueryKey,
|
|
19
|
-
ServiceOperationQuery,
|
|
20
|
-
} from '../ServiceOperation.js';
|
|
12
|
+
import type { ServiceOperationQuery } from '../ServiceOperation.js';
|
|
21
13
|
|
|
22
14
|
export const useSuspenseInfiniteQuery: <
|
|
23
15
|
TQueryFnData,
|
|
@@ -25,10 +17,10 @@ export const useSuspenseInfiniteQuery: <
|
|
|
25
17
|
TData = InfiniteData<TQueryFnData>,
|
|
26
18
|
>(
|
|
27
19
|
qraftOptions: QraftClientOptions | undefined,
|
|
28
|
-
schema:
|
|
20
|
+
schema: OperationSchema,
|
|
29
21
|
args: Parameters<
|
|
30
22
|
ServiceOperationQuery<
|
|
31
|
-
|
|
23
|
+
OperationSchema,
|
|
32
24
|
unknown,
|
|
33
25
|
unknown
|
|
34
26
|
>['useSuspenseInfiniteQuery']
|
|
@@ -38,36 +30,8 @@ export const useSuspenseInfiniteQuery: <
|
|
|
38
30
|
schema,
|
|
39
31
|
args
|
|
40
32
|
) => {
|
|
41
|
-
const [parameters, options, queryClientByArg] = args;
|
|
42
|
-
|
|
43
|
-
const contextValue = useContext(qraftOptions?.context ?? QraftContext);
|
|
44
|
-
if (!contextValue?.request) throw new Error(`QraftContext.request not found`);
|
|
45
|
-
|
|
46
|
-
const queryKey: ServiceOperationInfiniteQueryKey<
|
|
47
|
-
OperationRequestSchema,
|
|
48
|
-
unknown
|
|
49
|
-
> = Array.isArray(parameters)
|
|
50
|
-
? (parameters as never)
|
|
51
|
-
: composeInfiniteQueryKey(schema, parameters);
|
|
52
|
-
|
|
53
33
|
return useSuspenseInfiniteQueryTanstack(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
queryKey,
|
|
57
|
-
queryFn:
|
|
58
|
-
options?.queryFn ??
|
|
59
|
-
function ({ queryKey: [, queryParams], signal, meta, pageParam }) {
|
|
60
|
-
return contextValue.request(
|
|
61
|
-
{ baseUrl: contextValue.baseUrl },
|
|
62
|
-
schema,
|
|
63
|
-
{
|
|
64
|
-
parameters: shelfMerge(2, queryParams, pageParam) as never,
|
|
65
|
-
signal,
|
|
66
|
-
meta,
|
|
67
|
-
}
|
|
68
|
-
);
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
useQueryClient(qraftOptions, queryClientByArg)
|
|
34
|
+
// @ts-expect-error
|
|
35
|
+
...useComposeUseQueryOptions(qraftOptions, schema, args, true)
|
|
72
36
|
) as never;
|
|
73
37
|
};
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from '@tanstack/react-query';
|
|
9
9
|
|
|
10
10
|
import { composeQueryKey } from '../lib/composeQueryKey.js';
|
|
11
|
-
import type {
|
|
11
|
+
import type { OperationSchema } from '../lib/requestFn.js';
|
|
12
12
|
import { useQueryClient } from '../lib/useQueryClient.js';
|
|
13
13
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
14
14
|
import { QraftContext } from '../QraftContext.js';
|
|
@@ -16,10 +16,10 @@ import { ServiceOperationQuery } from '../ServiceOperation.js';
|
|
|
16
16
|
|
|
17
17
|
export const useSuspenseQueries: (
|
|
18
18
|
qraftOptions: QraftClientOptions | undefined,
|
|
19
|
-
schema:
|
|
19
|
+
schema: OperationSchema,
|
|
20
20
|
args: Parameters<
|
|
21
21
|
ServiceOperationQuery<
|
|
22
|
-
|
|
22
|
+
OperationSchema,
|
|
23
23
|
unknown,
|
|
24
24
|
unknown
|
|
25
25
|
>['useSuspenseQueries']
|
|
@@ -28,7 +28,8 @@ export const useSuspenseQueries: (
|
|
|
28
28
|
const [options, queryClientByArg] = args;
|
|
29
29
|
|
|
30
30
|
const contextValue = useContext(qraftOptions?.context ?? QraftContext);
|
|
31
|
-
if (!contextValue?.
|
|
31
|
+
if (!contextValue?.requestFn)
|
|
32
|
+
throw new Error(`QraftContext.requestFn not found`);
|
|
32
33
|
|
|
33
34
|
return useSuspenseQueriesTanstack(
|
|
34
35
|
{
|
|
@@ -43,6 +44,7 @@ export const useSuspenseQueries: (
|
|
|
43
44
|
},
|
|
44
45
|
queryOptions
|
|
45
46
|
);
|
|
47
|
+
// @ts-expect-error
|
|
46
48
|
delete queryOptionsCopy.parameters;
|
|
47
49
|
return queryOptionsCopy;
|
|
48
50
|
})()
|
|
@@ -53,15 +55,12 @@ export const useSuspenseQueries: (
|
|
|
53
55
|
queryFn:
|
|
54
56
|
optionsWithQueryKey.queryFn ??
|
|
55
57
|
function ({ queryKey: [, queryParams], signal, meta }) {
|
|
56
|
-
return contextValue.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
meta,
|
|
63
|
-
}
|
|
64
|
-
);
|
|
58
|
+
return contextValue.requestFn(schema, {
|
|
59
|
+
parameters: queryParams as never,
|
|
60
|
+
baseUrl: contextValue.baseUrl,
|
|
61
|
+
signal,
|
|
62
|
+
meta,
|
|
63
|
+
});
|
|
65
64
|
},
|
|
66
65
|
};
|
|
67
66
|
}),
|
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { useContext } from 'react';
|
|
4
|
-
|
|
5
3
|
import type { DefaultError } from '@tanstack/query-core';
|
|
6
4
|
import {
|
|
7
|
-
UseQueryResult,
|
|
5
|
+
type UseQueryResult,
|
|
8
6
|
useSuspenseQuery as useSuspenseQueryTanstack,
|
|
9
7
|
} from '@tanstack/react-query';
|
|
10
8
|
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import { useQueryClient } from '../lib/useQueryClient.js';
|
|
9
|
+
import type { OperationSchema } from '../lib/requestFn.js';
|
|
10
|
+
import { useComposeUseQueryOptions } from '../lib/useComposeUseQueryOptions.js';
|
|
14
11
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
ServiceOperationQuery,
|
|
18
|
-
ServiceOperationQueryKey,
|
|
19
|
-
} from '../ServiceOperation.js';
|
|
12
|
+
import type { ServiceOperationQuery } from '../ServiceOperation.js';
|
|
20
13
|
|
|
21
14
|
export const useSuspenseQuery: <
|
|
22
15
|
TQueryFnData = unknown,
|
|
@@ -24,43 +17,13 @@ export const useSuspenseQuery: <
|
|
|
24
17
|
TData = TQueryFnData,
|
|
25
18
|
>(
|
|
26
19
|
qraftOptions: QraftClientOptions | undefined,
|
|
27
|
-
schema:
|
|
20
|
+
schema: OperationSchema,
|
|
28
21
|
args: Parameters<
|
|
29
|
-
ServiceOperationQuery<
|
|
30
|
-
OperationRequestSchema,
|
|
31
|
-
unknown,
|
|
32
|
-
unknown
|
|
33
|
-
>['useSuspenseQuery']
|
|
22
|
+
ServiceOperationQuery<OperationSchema, unknown, unknown>['useSuspenseQuery']
|
|
34
23
|
>
|
|
35
24
|
) => UseQueryResult<TData, TError> = (qraftOptions, schema, args) => {
|
|
36
|
-
const [parameters, options, queryClientByArg] = args;
|
|
37
|
-
|
|
38
|
-
const contextValue = useContext(qraftOptions?.context ?? QraftContext);
|
|
39
|
-
if (!contextValue?.request) throw new Error(`QraftContext.request not found`);
|
|
40
|
-
|
|
41
|
-
const queryKey: ServiceOperationQueryKey<OperationRequestSchema, unknown> =
|
|
42
|
-
Array.isArray(parameters)
|
|
43
|
-
? (parameters as never)
|
|
44
|
-
: composeQueryKey(schema, parameters);
|
|
45
|
-
|
|
46
25
|
return useSuspenseQueryTanstack(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
queryKey,
|
|
50
|
-
queryFn:
|
|
51
|
-
options?.queryFn ??
|
|
52
|
-
function ({ queryKey: [, queryParams], signal, meta }) {
|
|
53
|
-
return contextValue.request(
|
|
54
|
-
{ baseUrl: contextValue.baseUrl },
|
|
55
|
-
schema,
|
|
56
|
-
{
|
|
57
|
-
parameters: queryParams as never,
|
|
58
|
-
signal,
|
|
59
|
-
meta,
|
|
60
|
-
}
|
|
61
|
-
);
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
useQueryClient(qraftOptions, queryClientByArg)
|
|
26
|
+
// @ts-expect-error
|
|
27
|
+
...useComposeUseQueryOptions(qraftOptions, schema, args, false)
|
|
65
28
|
) as never;
|
|
66
29
|
};
|
package/src/index.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export { qraftAPIClient, type QraftClientOptions } from './qraftAPIClient.js';
|
|
2
2
|
export { QraftContext, type QraftContextValue } from './QraftContext.js';
|
|
3
3
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
requestFn,
|
|
5
|
+
baseRequestFn,
|
|
6
6
|
urlSerializer,
|
|
7
7
|
bodySerializer,
|
|
8
|
-
type
|
|
9
|
-
type
|
|
10
|
-
type
|
|
8
|
+
type RequestFnPayload,
|
|
9
|
+
type OperationSchema,
|
|
10
|
+
type RequestFnOptions,
|
|
11
11
|
type HeadersOptions,
|
|
12
|
-
} from './lib/
|
|
12
|
+
} from './lib/requestFn.js';
|
|
13
13
|
export type {
|
|
14
14
|
ServiceOperationQuery,
|
|
15
15
|
ServiceOperationMutation,
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { QueryClient } from '@tanstack/query-core';
|
|
2
|
+
|
|
3
|
+
import { composeInfiniteQueryKey } from './composeInfiniteQueryKey.js';
|
|
4
|
+
import { composeQueryKey } from './composeQueryKey.js';
|
|
5
|
+
import type { OperationSchema, RequestFn } from './requestFn.js';
|
|
6
|
+
import { shelfMerge } from './shelfMerge.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Calls a query client fetch method with parameters and options,
|
|
10
|
+
* and automatically composes the `QueryKey` based on the schema and parameters.
|
|
11
|
+
*/
|
|
12
|
+
export function callQueryClientMethodWithQueryKey<
|
|
13
|
+
QFMethod extends QueryKeyMethods,
|
|
14
|
+
>(
|
|
15
|
+
queryFilterMethod: QFMethod,
|
|
16
|
+
schema: OperationSchema,
|
|
17
|
+
infinite: boolean,
|
|
18
|
+
args: QueryClientMethodArgs<QFMethod>
|
|
19
|
+
): ReturnType<(typeof QueryClient.prototype)[QFMethod]> {
|
|
20
|
+
const [{ requestFn, baseUrl, parameters, ...options }, queryClient] = args;
|
|
21
|
+
|
|
22
|
+
if (!queryClient) throw new Error('queryClient is required');
|
|
23
|
+
if (!queryClient[queryFilterMethod])
|
|
24
|
+
throw new Error(
|
|
25
|
+
`queryClient is invalid, ${queryFilterMethod} method does not exist`
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
if (options.queryKey && parameters) {
|
|
29
|
+
throw new Error(
|
|
30
|
+
'callQueryClientMethodWithQueryKey: options.queryKey and options.parameters are mutually exclusive'
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (options.queryFn && requestFn) {
|
|
35
|
+
throw new Error(
|
|
36
|
+
'callQueryClientMethodWithQueryKey: options.queryFn and requestFn are mutually exclusive'
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const queryFn =
|
|
41
|
+
options.queryFn ??
|
|
42
|
+
(requestFn
|
|
43
|
+
? // @ts-expect-error
|
|
44
|
+
function ({ queryKey: [, queryParams], signal, meta, pageParam }) {
|
|
45
|
+
return requestFn(schema, {
|
|
46
|
+
parameters: infinite
|
|
47
|
+
? (shelfMerge(2, queryParams, pageParam) as never)
|
|
48
|
+
: queryParams,
|
|
49
|
+
baseUrl,
|
|
50
|
+
signal,
|
|
51
|
+
meta,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
: undefined);
|
|
55
|
+
|
|
56
|
+
if (parameters) {
|
|
57
|
+
// @ts-expect-error
|
|
58
|
+
return queryClient[queryFilterMethod]({
|
|
59
|
+
...options,
|
|
60
|
+
// Event if queryFn is undefined, it will override the default queryFn from `setQueryDefaults(...)`
|
|
61
|
+
...(queryFn ? { queryFn } : {}),
|
|
62
|
+
queryKey: infinite
|
|
63
|
+
? composeInfiniteQueryKey(schema, parameters)
|
|
64
|
+
: composeQueryKey(schema, parameters),
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// @ts-expect-error
|
|
69
|
+
return queryClient[queryFilterMethod]({ ...options, queryFn });
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
type QueryClientMethodArgs<QMethod extends keyof QueryClientPrototype> = [
|
|
73
|
+
options: Parameters<QueryClientPrototype[QMethod]>[0] & {
|
|
74
|
+
parameters?: unknown;
|
|
75
|
+
baseUrl?: string;
|
|
76
|
+
requestFn?: RequestFn<unknown>;
|
|
77
|
+
},
|
|
78
|
+
queryClient: QueryClient,
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
type QueryKeyMethods =
|
|
82
|
+
| QueryKeyMethod<'fetchQuery'>
|
|
83
|
+
| QueryKeyMethod<'prefetchQuery'>
|
|
84
|
+
| QueryKeyMethod<'fetchInfiniteQuery'>
|
|
85
|
+
| QueryKeyMethod<'prefetchInfiniteQuery'>;
|
|
86
|
+
|
|
87
|
+
type QueryClientPrototype = typeof QueryClient.prototype;
|
|
88
|
+
|
|
89
|
+
type QueryKeyMethod<QFMethod extends keyof typeof QueryClient.prototype> =
|
|
90
|
+
QFMethod;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { QueryClient } from '@tanstack/query-core';
|
|
2
|
+
|
|
3
|
+
import { composeMutationFilters } from './composeMutationFilters.js';
|
|
4
|
+
import type { OperationSchema } from './requestFn.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Calls a query client method with mutation filters and options,
|
|
8
|
+
* and automatically composes the `MutationKey` based on the schema and parameters.
|
|
9
|
+
*/
|
|
10
|
+
export function callQueryClientMethodWithMutationFilters<
|
|
11
|
+
QFMethod extends QueryFilterMethods,
|
|
12
|
+
>(
|
|
13
|
+
queryFilterMethod: QFMethod,
|
|
14
|
+
schema: OperationSchema,
|
|
15
|
+
args: [...Parameters<(typeof QueryClient.prototype)[QFMethod]>, QueryClient]
|
|
16
|
+
): ReturnType<(typeof QueryClient.prototype)[QFMethod]> {
|
|
17
|
+
const filters = args[0];
|
|
18
|
+
const queryClient = args[args.length - 1] as QueryClient | undefined;
|
|
19
|
+
|
|
20
|
+
if (!queryClient) throw new Error('queryClient is required');
|
|
21
|
+
if (!queryClient[queryFilterMethod])
|
|
22
|
+
throw new Error(
|
|
23
|
+
`queryClient is invalid, ${queryFilterMethod} method does not exist`
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
// @ts-expect-error
|
|
27
|
+
return queryClient[queryFilterMethod](
|
|
28
|
+
composeMutationFilters(schema, filters as never),
|
|
29
|
+
// @ts-expect-error
|
|
30
|
+
...args.slice(1, -1)
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
type QueryFiltersMethod<QFMethod extends keyof typeof QueryClient.prototype> =
|
|
35
|
+
QFMethod;
|
|
36
|
+
|
|
37
|
+
type QueryFilterMethods = QueryFiltersMethod<'isMutating'>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { QueryClient } from '@tanstack/query-core';
|
|
2
2
|
|
|
3
3
|
import { composeQueryFilters } from './composeQueryFilters.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { OperationSchema } from './requestFn.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Calls a query client method with query filters and options,
|
|
@@ -11,24 +11,11 @@ export function callQueryClientMethodWithQueryFilters<
|
|
|
11
11
|
QFMethod extends QueryFilterMethods,
|
|
12
12
|
>(
|
|
13
13
|
queryFilterMethod: QFMethod,
|
|
14
|
-
schema:
|
|
15
|
-
args: [
|
|
14
|
+
schema: OperationSchema,
|
|
15
|
+
args: [...Parameters<(typeof QueryClient.prototype)[QFMethod]>, QueryClient]
|
|
16
16
|
): ReturnType<(typeof QueryClient.prototype)[QFMethod]> {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
? args[0]
|
|
20
|
-
: args.length === 2
|
|
21
|
-
? args[1]
|
|
22
|
-
: args.length === 3
|
|
23
|
-
? args[2]
|
|
24
|
-
: undefined
|
|
25
|
-
) as QueryClient | undefined;
|
|
26
|
-
|
|
27
|
-
const filters = composeQueryFilters(
|
|
28
|
-
schema,
|
|
29
|
-
args.length === 1 ? undefined : args[0]
|
|
30
|
-
);
|
|
31
|
-
const options = args.length === 3 ? args[1] : undefined;
|
|
17
|
+
const filters = args[0];
|
|
18
|
+
const queryClient = args[args.length - 1] as QueryClient | undefined;
|
|
32
19
|
|
|
33
20
|
if (!queryClient) throw new Error('queryClient is required');
|
|
34
21
|
if (!queryClient[queryFilterMethod])
|
|
@@ -36,12 +23,12 @@ export function callQueryClientMethodWithQueryFilters<
|
|
|
36
23
|
`queryClient is invalid, ${queryFilterMethod} method does not exist`
|
|
37
24
|
);
|
|
38
25
|
|
|
39
|
-
if (options)
|
|
40
|
-
// @ts-expect-error
|
|
41
|
-
return queryClient[queryFilterMethod](filters, options);
|
|
42
|
-
|
|
43
26
|
// @ts-expect-error
|
|
44
|
-
return queryClient[queryFilterMethod](
|
|
27
|
+
return queryClient[queryFilterMethod](
|
|
28
|
+
composeQueryFilters(schema, filters as never),
|
|
29
|
+
// @ts-expect-error
|
|
30
|
+
...args.slice(1, -1)
|
|
31
|
+
);
|
|
45
32
|
}
|
|
46
33
|
|
|
47
34
|
type QueryFiltersMethod<QFMethod extends keyof typeof QueryClient.prototype> =
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { QueryClient } from '@tanstack/query-core';
|
|
2
|
+
|
|
3
|
+
import { composeInfiniteQueryKey } from './composeInfiniteQueryKey.js';
|
|
4
|
+
import { composeQueryKey } from './composeQueryKey.js';
|
|
5
|
+
import type { OperationSchema } from './requestFn.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Calls a query client method with parameters and options,
|
|
9
|
+
* and automatically composes the `QueryKey` based on the schema and parameters.
|
|
10
|
+
*/
|
|
11
|
+
export function callQueryClientMethodWithQueryKey<
|
|
12
|
+
QFMethod extends QueryKeyMethods,
|
|
13
|
+
>(
|
|
14
|
+
queryFilterMethod: QFMethod,
|
|
15
|
+
schema: OperationSchema,
|
|
16
|
+
infinite: boolean,
|
|
17
|
+
args: [...Parameters<(typeof QueryClient.prototype)[QFMethod]>, QueryClient]
|
|
18
|
+
): ReturnType<(typeof QueryClient.prototype)[QFMethod]> {
|
|
19
|
+
const parameters = args[0];
|
|
20
|
+
const queryClient = args[args.length - 1] as QueryClient | undefined;
|
|
21
|
+
|
|
22
|
+
if (!queryClient) throw new Error('queryClient is required');
|
|
23
|
+
if (!queryClient[queryFilterMethod])
|
|
24
|
+
throw new Error(
|
|
25
|
+
`queryClient is invalid, ${queryFilterMethod} method does not exist`
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const queryKey = Array.isArray(parameters)
|
|
29
|
+
? parameters
|
|
30
|
+
: infinite
|
|
31
|
+
? composeInfiniteQueryKey(schema, parameters)
|
|
32
|
+
: composeQueryKey(schema, parameters);
|
|
33
|
+
|
|
34
|
+
// @ts-expect-error
|
|
35
|
+
return queryClient[queryFilterMethod](queryKey, ...args.slice(1, -1));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
type QueryKeyMethod<QFMethod extends keyof typeof QueryClient.prototype> =
|
|
39
|
+
QFMethod;
|
|
40
|
+
|
|
41
|
+
type QueryKeyMethods =
|
|
42
|
+
| QueryKeyMethod<'setQueryData'>
|
|
43
|
+
| QueryKeyMethod<'getQueryData'>
|
|
44
|
+
| QueryKeyMethod<'getQueryState'>
|
|
45
|
+
| QueryKeyMethod<'setQueryDefaults'>
|
|
46
|
+
| QueryKeyMethod<'getQueryDefaults'>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ServiceOperationInfiniteQueryKey } from '../ServiceOperation.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { OperationSchema } from './requestFn.js';
|
|
3
3
|
|
|
4
4
|
export function composeInfiniteQueryKey<
|
|
5
|
-
TSchema extends
|
|
5
|
+
TSchema extends OperationSchema,
|
|
6
6
|
TParams,
|
|
7
7
|
>(
|
|
8
8
|
schema: TSchema,
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { composeMutationKey } from './composeMutationKey.js';
|
|
2
|
+
import type { OperationSchema } from './requestFn.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Replaces the `parameters` field in the filters with a `mutationKey` field based on the schema.
|
|
6
|
+
* If no filters are provided, a `mutationKey` will be composed schema's base query key.
|
|
7
|
+
* @param schema
|
|
8
|
+
* @param filters
|
|
9
|
+
*/
|
|
10
|
+
export function composeMutationFilters<Filters extends object>(
|
|
11
|
+
schema: OperationSchema,
|
|
12
|
+
filters: Filters | undefined
|
|
13
|
+
) {
|
|
14
|
+
if (!filters) {
|
|
15
|
+
return {
|
|
16
|
+
mutationKey: composeMutationKey(schema, undefined),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (filters && 'mutationKey' in filters && 'parameters' in filters) {
|
|
21
|
+
throw new Error(
|
|
22
|
+
`'composeMutationFilters': 'mutationKey' and 'parameters' cannot be used together`
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if ('mutationKey' in filters) {
|
|
27
|
+
return filters;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if ('parameters' in filters) {
|
|
31
|
+
const { parameters, ...filtersWithoutParameters } = filters;
|
|
32
|
+
|
|
33
|
+
Object.assign(filtersWithoutParameters, {
|
|
34
|
+
mutationKey: composeMutationKey(schema, parameters),
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
return filtersWithoutParameters;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
...filters,
|
|
42
|
+
mutationKey: composeMutationKey(schema, undefined),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -1,30 +1,27 @@
|
|
|
1
1
|
import type { ServiceOperationMutationKey } from '../ServiceOperation.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { OperationSchema } from './requestFn.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Omit `body` or `requestBody` from mutation parameters if exists
|
|
6
6
|
* and return the rest of the parameters
|
|
7
7
|
*/
|
|
8
8
|
export function composeMutationKey<
|
|
9
|
-
TSchema extends
|
|
9
|
+
TSchema extends OperationSchema,
|
|
10
10
|
TParams = undefined,
|
|
11
11
|
>(
|
|
12
12
|
schema: TSchema,
|
|
13
13
|
parameters: undefined
|
|
14
14
|
): ServiceOperationMutationKey<TSchema, undefined>;
|
|
15
|
-
export function composeMutationKey<
|
|
16
|
-
TSchema extends OperationRequestSchema,
|
|
17
|
-
TParams,
|
|
18
|
-
>(
|
|
15
|
+
export function composeMutationKey<TSchema extends OperationSchema, TParams>(
|
|
19
16
|
schema: TSchema,
|
|
20
17
|
parameters: TParams
|
|
21
18
|
): ServiceOperationMutationKey<TSchema, TParams>;
|
|
22
19
|
export function composeMutationKey<
|
|
23
|
-
TSchema extends
|
|
20
|
+
TSchema extends OperationSchema,
|
|
24
21
|
TParams = unknown,
|
|
25
22
|
>(schema: TSchema, parameters: TParams | undefined) {
|
|
26
23
|
return parameters === undefined
|
|
27
|
-
? [{ url: schema.url, method: schema.method }]
|
|
24
|
+
? [{ url: schema.url, method: schema.method }, {}]
|
|
28
25
|
: [
|
|
29
26
|
{
|
|
30
27
|
url: schema.url,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { composeQueryKey } from './composeQueryKey.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { OperationSchema } from './requestFn.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Replaces the `parameters` field in the filters with a `queryKey` field based on the schema.
|
|
@@ -8,7 +8,7 @@ import type { OperationRequestSchema } from './request.js';
|
|
|
8
8
|
* @param filters
|
|
9
9
|
*/
|
|
10
10
|
export function composeQueryFilters<Filters extends object>(
|
|
11
|
-
schema:
|
|
11
|
+
schema: OperationSchema,
|
|
12
12
|
filters: Filters | undefined
|
|
13
13
|
) {
|
|
14
14
|
if (!filters) {
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import type { ServiceOperationQueryKey } from '../ServiceOperation.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { OperationSchema } from './requestFn.js';
|
|
3
3
|
|
|
4
|
-
export function composeQueryKey<
|
|
5
|
-
TSchema extends OperationRequestSchema,
|
|
6
|
-
TParams,
|
|
7
|
-
>(
|
|
4
|
+
export function composeQueryKey<TSchema extends OperationSchema, TParams>(
|
|
8
5
|
schema: TSchema,
|
|
9
6
|
parameters: TParams | undefined
|
|
10
7
|
): ServiceOperationQueryKey<TSchema, TParams> {
|