@openapi-qraft/react 1.6.0 → 1.7.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 +10 -0
- package/dist/ServiceOperation.d.ts +21 -560
- package/dist/ServiceOperation.d.ts.map +1 -1
- package/dist/callbacks/cancelQueries.d.ts +1 -1
- package/dist/callbacks/cancelQueries.d.ts.map +1 -1
- package/dist/callbacks/fetchInfiniteQuery.d.ts +1 -1
- package/dist/callbacks/fetchInfiniteQuery.d.ts.map +1 -1
- package/dist/callbacks/fetchQuery.d.ts +1 -1
- package/dist/callbacks/fetchQuery.d.ts.map +1 -1
- package/dist/callbacks/getInfiniteQueryData.d.ts +1 -1
- package/dist/callbacks/getInfiniteQueryData.d.ts.map +1 -1
- package/dist/callbacks/getInfiniteQueryKey.d.ts +2 -2
- package/dist/callbacks/getInfiniteQueryKey.d.ts.map +1 -1
- package/dist/callbacks/getInfiniteQueryState.d.ts +1 -1
- package/dist/callbacks/getInfiniteQueryState.d.ts.map +1 -1
- package/dist/callbacks/getMutationKey.d.ts +1 -1
- package/dist/callbacks/getMutationKey.d.ts.map +1 -1
- package/dist/callbacks/getQueriesData.d.ts +1 -1
- package/dist/callbacks/getQueriesData.d.ts.map +1 -1
- package/dist/callbacks/getQueryData.d.ts +1 -1
- package/dist/callbacks/getQueryData.d.ts.map +1 -1
- package/dist/callbacks/getQueryKey.d.ts +2 -2
- package/dist/callbacks/getQueryKey.d.ts.map +1 -1
- package/dist/callbacks/getQueryState.d.ts +1 -1
- package/dist/callbacks/getQueryState.d.ts.map +1 -1
- package/dist/callbacks/invalidateQueries.d.ts +1 -1
- package/dist/callbacks/invalidateQueries.d.ts.map +1 -1
- package/dist/callbacks/isFetching.d.ts +1 -1
- package/dist/callbacks/isFetching.d.ts.map +1 -1
- package/dist/callbacks/isMutating.d.ts +1 -1
- package/dist/callbacks/isMutating.d.ts.map +1 -1
- package/dist/callbacks/prefetchInfiniteQuery.d.ts +1 -1
- package/dist/callbacks/prefetchInfiniteQuery.d.ts.map +1 -1
- package/dist/callbacks/prefetchQuery.d.ts +1 -1
- package/dist/callbacks/prefetchQuery.d.ts.map +1 -1
- package/dist/callbacks/queryFn.d.ts +1 -1
- package/dist/callbacks/queryFn.d.ts.map +1 -1
- package/dist/callbacks/refetchQueries.d.ts +2 -2
- package/dist/callbacks/refetchQueries.d.ts.map +1 -1
- package/dist/callbacks/removeQueries.d.ts +1 -1
- package/dist/callbacks/removeQueries.d.ts.map +1 -1
- package/dist/callbacks/resetQueries.d.ts +1 -1
- package/dist/callbacks/resetQueries.d.ts.map +1 -1
- package/dist/callbacks/setInfiniteQueryData.d.ts +1 -1
- package/dist/callbacks/setInfiniteQueryData.d.ts.map +1 -1
- package/dist/callbacks/setQueriesData.d.ts +1 -1
- package/dist/callbacks/setQueriesData.d.ts.map +1 -1
- package/dist/callbacks/setQueryData.d.ts +1 -1
- package/dist/callbacks/setQueryData.d.ts.map +1 -1
- package/dist/callbacks/useInfiniteQuery.d.ts +1 -1
- package/dist/callbacks/useInfiniteQuery.d.ts.map +1 -1
- package/dist/callbacks/useIsFetching.d.ts +1 -1
- package/dist/callbacks/useIsFetching.d.ts.map +1 -1
- package/dist/callbacks/useIsMutating.d.ts +1 -1
- package/dist/callbacks/useIsMutating.d.ts.map +1 -1
- package/dist/callbacks/useMutation.d.ts +1 -1
- package/dist/callbacks/useMutation.d.ts.map +1 -1
- package/dist/callbacks/useMutation.js.map +1 -1
- package/dist/callbacks/useMutationState.d.ts +1 -1
- package/dist/callbacks/useMutationState.d.ts.map +1 -1
- package/dist/callbacks/useQueries.d.ts +1 -1
- package/dist/callbacks/useQueries.d.ts.map +1 -1
- package/dist/callbacks/useQuery.d.ts +1 -1
- package/dist/callbacks/useQuery.d.ts.map +1 -1
- package/dist/callbacks/useSuspenseInfiniteQuery.d.ts +1 -1
- package/dist/callbacks/useSuspenseInfiniteQuery.d.ts.map +1 -1
- package/dist/callbacks/useSuspenseQueries.d.ts +1 -1
- package/dist/callbacks/useSuspenseQueries.d.ts.map +1 -1
- package/dist/callbacks/useSuspenseQuery.d.ts +1 -1
- package/dist/callbacks/useSuspenseQuery.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/PartialParameters.type.d.ts +13 -0
- package/dist/lib/PartialParameters.type.d.ts.map +1 -0
- package/dist/lib/PartialParameters.type.js +2 -0
- package/dist/lib/PartialParameters.type.js.map +1 -0
- package/dist/lib/composeBaseQueryKey.d.ts +1 -1
- package/dist/lib/composeBaseQueryKey.d.ts.map +1 -1
- package/dist/lib/composeInfiniteQueryKey.d.ts +1 -1
- package/dist/lib/composeInfiniteQueryKey.d.ts.map +1 -1
- package/dist/lib/composeMutationKey.d.ts +1 -1
- package/dist/lib/composeMutationKey.d.ts.map +1 -1
- package/dist/lib/composeQueryKey.d.ts +1 -1
- package/dist/lib/composeQueryKey.d.ts.map +1 -1
- package/dist/service-operation/OperationInfiniteData.d.ts +4 -0
- package/dist/service-operation/OperationInfiniteData.d.ts.map +1 -0
- package/dist/service-operation/OperationInfiniteData.js +2 -0
- package/dist/service-operation/OperationInfiniteData.js.map +1 -0
- package/dist/service-operation/QueryFilters.d.ts +123 -0
- package/dist/service-operation/QueryFilters.d.ts.map +1 -0
- package/dist/service-operation/QueryFilters.js +2 -0
- package/dist/service-operation/QueryFilters.js.map +1 -0
- package/dist/service-operation/ServiceOperation.d.ts +53 -0
- package/dist/service-operation/ServiceOperation.d.ts.map +1 -0
- package/dist/service-operation/ServiceOperation.js +2 -0
- package/dist/service-operation/ServiceOperation.js.map +1 -0
- package/dist/service-operation/ServiceOperationCancelQueries.d.ts +20 -0
- package/dist/service-operation/ServiceOperationCancelQueries.d.ts.map +1 -0
- package/dist/service-operation/ServiceOperationCancelQueries.js +2 -0
- package/dist/service-operation/ServiceOperationCancelQueries.js.map +1 -0
- package/dist/service-operation/ServiceOperationFetchInfiniteQuery.d.ts +58 -0
- package/dist/service-operation/ServiceOperationFetchInfiniteQuery.d.ts.map +1 -0
- package/dist/service-operation/ServiceOperationFetchInfiniteQuery.js +2 -0
- package/dist/service-operation/ServiceOperationFetchInfiniteQuery.js.map +1 -0
- package/dist/service-operation/ServiceOperationFetchQuery.d.ts +49 -0
- package/dist/service-operation/ServiceOperationFetchQuery.d.ts.map +1 -0
- package/dist/service-operation/ServiceOperationFetchQuery.js +2 -0
- package/dist/service-operation/ServiceOperationFetchQuery.js.map +1 -0
- package/dist/service-operation/ServiceOperationGetInfiniteQueryData.d.ts +10 -0
- package/dist/service-operation/ServiceOperationGetInfiniteQueryData.d.ts.map +1 -0
- package/dist/service-operation/ServiceOperationGetInfiniteQueryData.js +2 -0
- package/dist/service-operation/ServiceOperationGetInfiniteQueryData.js.map +1 -0
- package/dist/service-operation/ServiceOperationGetQueriesData.d.ts +18 -0
- package/dist/service-operation/ServiceOperationGetQueriesData.d.ts.map +1 -0
- package/dist/service-operation/ServiceOperationGetQueriesData.js +2 -0
- package/dist/service-operation/ServiceOperationGetQueriesData.js.map +1 -0
- package/dist/service-operation/ServiceOperationGetQueryData.d.ts +9 -0
- package/dist/service-operation/ServiceOperationGetQueryData.d.ts.map +1 -0
- package/dist/service-operation/ServiceOperationGetQueryData.js +2 -0
- package/dist/service-operation/ServiceOperationGetQueryData.js.map +1 -0
- package/dist/service-operation/ServiceOperationGetQueryState.d.ts +11 -0
- package/dist/service-operation/ServiceOperationGetQueryState.d.ts.map +1 -0
- package/dist/service-operation/ServiceOperationGetQueryState.js +2 -0
- package/dist/service-operation/ServiceOperationGetQueryState.js.map +1 -0
- package/dist/service-operation/ServiceOperationInvalidateQueries.d.ts +26 -0
- package/dist/service-operation/ServiceOperationInvalidateQueries.d.ts.map +1 -0
- package/dist/service-operation/ServiceOperationInvalidateQueries.js +2 -0
- package/dist/service-operation/ServiceOperationInvalidateQueries.js.map +1 -0
- package/dist/service-operation/ServiceOperationIsFetchingQueries.d.ts +19 -0
- package/dist/service-operation/ServiceOperationIsFetchingQueries.d.ts.map +1 -0
- package/dist/service-operation/ServiceOperationIsFetchingQueries.js +2 -0
- package/dist/service-operation/ServiceOperationIsFetchingQueries.js.map +1 -0
- package/dist/service-operation/ServiceOperationIsMutatingQueries.d.ts +19 -0
- package/dist/service-operation/ServiceOperationIsMutatingQueries.d.ts.map +1 -0
- package/dist/service-operation/ServiceOperationIsMutatingQueries.js +2 -0
- package/dist/service-operation/ServiceOperationIsMutatingQueries.js.map +1 -0
- package/dist/service-operation/ServiceOperationKey.d.ts +16 -0
- package/dist/service-operation/ServiceOperationKey.d.ts.map +1 -0
- package/dist/service-operation/ServiceOperationKey.js +2 -0
- package/dist/service-operation/ServiceOperationKey.js.map +1 -0
- package/dist/service-operation/ServiceOperationMutationFn.d.ts +20 -0
- package/dist/service-operation/ServiceOperationMutationFn.d.ts.map +1 -0
- package/dist/service-operation/ServiceOperationMutationFn.js +2 -0
- package/dist/service-operation/ServiceOperationMutationFn.js.map +1 -0
- package/dist/service-operation/ServiceOperationQueryFn.d.ts +32 -0
- package/dist/service-operation/ServiceOperationQueryFn.d.ts.map +1 -0
- package/dist/service-operation/ServiceOperationQueryFn.js +2 -0
- package/dist/service-operation/ServiceOperationQueryFn.js.map +1 -0
- package/dist/service-operation/ServiceOperationRefetchQueries.d.ts +30 -0
- package/dist/service-operation/ServiceOperationRefetchQueries.d.ts.map +1 -0
- package/dist/service-operation/ServiceOperationRefetchQueries.js +2 -0
- package/dist/service-operation/ServiceOperationRefetchQueries.js.map +1 -0
- package/dist/service-operation/ServiceOperationRemoveQueries.d.ts +19 -0
- package/dist/service-operation/ServiceOperationRemoveQueries.d.ts.map +1 -0
- package/dist/service-operation/ServiceOperationRemoveQueries.js +2 -0
- package/dist/service-operation/ServiceOperationRemoveQueries.js.map +1 -0
- package/dist/service-operation/ServiceOperationResetQueries.d.ts +20 -0
- package/dist/service-operation/ServiceOperationResetQueries.d.ts.map +1 -0
- package/dist/service-operation/ServiceOperationResetQueries.js +2 -0
- package/dist/service-operation/ServiceOperationResetQueries.js.map +1 -0
- package/dist/service-operation/ServiceOperationSetInfiniteQueryData.d.ts +10 -0
- package/dist/service-operation/ServiceOperationSetInfiniteQueryData.d.ts.map +1 -0
- package/dist/service-operation/ServiceOperationSetInfiniteQueryData.js +2 -0
- package/dist/service-operation/ServiceOperationSetInfiniteQueryData.js.map +1 -0
- package/dist/service-operation/ServiceOperationSetQueriesData.d.ts +20 -0
- package/dist/service-operation/ServiceOperationSetQueriesData.d.ts.map +1 -0
- package/dist/service-operation/ServiceOperationSetQueriesData.js +2 -0
- package/dist/service-operation/ServiceOperationSetQueriesData.js.map +1 -0
- package/dist/service-operation/ServiceOperationSetQueryData.d.ts +19 -0
- package/dist/service-operation/ServiceOperationSetQueryData.d.ts.map +1 -0
- package/dist/service-operation/ServiceOperationSetQueryData.js +2 -0
- package/dist/service-operation/ServiceOperationSetQueryData.js.map +1 -0
- package/dist/service-operation/ServiceOperationUseInfiniteQuery.d.ts +14 -0
- package/dist/service-operation/ServiceOperationUseInfiniteQuery.d.ts.map +1 -0
- package/dist/service-operation/ServiceOperationUseInfiniteQuery.js +2 -0
- package/dist/service-operation/ServiceOperationUseInfiniteQuery.js.map +1 -0
- package/dist/service-operation/ServiceOperationUseIsFetchingQueries.d.ts +9 -0
- package/dist/service-operation/ServiceOperationUseIsFetchingQueries.d.ts.map +1 -0
- package/dist/service-operation/ServiceOperationUseIsFetchingQueries.js +2 -0
- package/dist/service-operation/ServiceOperationUseIsFetchingQueries.js.map +1 -0
- package/dist/service-operation/ServiceOperationUseIsMutating.d.ts +9 -0
- package/dist/service-operation/ServiceOperationUseIsMutating.d.ts.map +1 -0
- package/dist/service-operation/ServiceOperationUseIsMutating.js +2 -0
- package/dist/service-operation/ServiceOperationUseIsMutating.js.map +1 -0
- package/dist/service-operation/ServiceOperationUseMutation.d.ts +17 -0
- package/dist/service-operation/ServiceOperationUseMutation.d.ts.map +1 -0
- package/dist/service-operation/ServiceOperationUseMutation.js +2 -0
- package/dist/service-operation/ServiceOperationUseMutation.js.map +1 -0
- package/dist/service-operation/ServiceOperationUseMutationState.d.ts +46 -0
- package/dist/service-operation/ServiceOperationUseMutationState.d.ts.map +1 -0
- package/dist/service-operation/ServiceOperationUseMutationState.js +2 -0
- package/dist/service-operation/ServiceOperationUseMutationState.js.map +1 -0
- package/dist/service-operation/ServiceOperationUseQueries.d.ts +20 -0
- package/dist/service-operation/ServiceOperationUseQueries.d.ts.map +1 -0
- package/dist/service-operation/ServiceOperationUseQueries.js +2 -0
- package/dist/service-operation/ServiceOperationUseQueries.js.map +1 -0
- package/dist/service-operation/ServiceOperationUseQuery.d.ts +12 -0
- package/dist/service-operation/ServiceOperationUseQuery.d.ts.map +1 -0
- package/dist/service-operation/ServiceOperationUseQuery.js +2 -0
- package/dist/service-operation/ServiceOperationUseQuery.js.map +1 -0
- package/dist/service-operation/ServiceOperationUseSuspenseInfiniteQuery.d.ts +12 -0
- package/dist/service-operation/ServiceOperationUseSuspenseInfiniteQuery.d.ts.map +1 -0
- package/dist/service-operation/ServiceOperationUseSuspenseInfiniteQuery.js +2 -0
- package/dist/service-operation/ServiceOperationUseSuspenseInfiniteQuery.js.map +1 -0
- package/dist/service-operation/ServiceOperationUseSuspenseQueries.d.ts +18 -0
- package/dist/service-operation/ServiceOperationUseSuspenseQueries.d.ts.map +1 -0
- package/dist/service-operation/ServiceOperationUseSuspenseQueries.js +2 -0
- package/dist/service-operation/ServiceOperationUseSuspenseQueries.js.map +1 -0
- package/dist/service-operation/ServiceOperationUseSuspenseQueryQuery.d.ts +10 -0
- package/dist/service-operation/ServiceOperationUseSuspenseQueryQuery.d.ts.map +1 -0
- package/dist/service-operation/ServiceOperationUseSuspenseQueryQuery.js +2 -0
- package/dist/service-operation/ServiceOperationUseSuspenseQueryQuery.js.map +1 -0
- package/dist/service-operation/index.d.ts +2 -0
- package/dist/service-operation/index.d.ts.map +1 -0
- package/dist/service-operation/index.js +2 -0
- package/dist/service-operation/index.js.map +1 -0
- package/package.json +2 -2
- package/src/ServiceOperation.ts +38 -1375
- package/src/callbacks/cancelQueries.ts +1 -1
- package/src/callbacks/fetchInfiniteQuery.ts +1 -1
- package/src/callbacks/fetchQuery.ts +1 -1
- package/src/callbacks/getInfiniteQueryData.ts +1 -1
- package/src/callbacks/getInfiniteQueryKey.ts +1 -1
- package/src/callbacks/getInfiniteQueryState.ts +1 -1
- package/src/callbacks/getMutationKey.ts +1 -1
- package/src/callbacks/getQueriesData.ts +1 -1
- package/src/callbacks/getQueryData.ts +1 -1
- package/src/callbacks/getQueryKey.ts +1 -1
- package/src/callbacks/getQueryState.ts +1 -1
- package/src/callbacks/invalidateQueries.ts +1 -1
- package/src/callbacks/isFetching.ts +1 -1
- package/src/callbacks/isMutating.ts +1 -1
- package/src/callbacks/mutationFn.ts +1 -1
- package/src/callbacks/prefetchInfiniteQuery.ts +1 -1
- package/src/callbacks/prefetchQuery.ts +1 -1
- package/src/callbacks/queryFn.ts +1 -1
- package/src/callbacks/refetchQueries.ts +2 -2
- package/src/callbacks/removeQueries.ts +1 -1
- package/src/callbacks/resetQueries.ts +1 -1
- package/src/callbacks/setInfiniteQueryData.ts +1 -1
- package/src/callbacks/setQueriesData.ts +1 -1
- package/src/callbacks/setQueryData.ts +1 -1
- package/src/callbacks/useInfiniteQuery.ts +1 -1
- package/src/callbacks/useIsFetching.ts +1 -1
- package/src/callbacks/useIsMutating.ts +1 -1
- package/src/callbacks/useMutation.ts +2 -4
- package/src/callbacks/useMutationState.ts +1 -1
- package/src/callbacks/useQueries.ts +1 -1
- package/src/callbacks/useQuery.ts +1 -1
- package/src/callbacks/useSuspenseInfiniteQuery.ts +1 -1
- package/src/callbacks/useSuspenseQueries.ts +1 -1
- package/src/callbacks/useSuspenseQuery.ts +1 -1
- package/src/index.ts +1 -4
- package/src/lib/PartialParameters.type.ts +12 -0
- package/src/lib/composeBaseQueryKey.ts +2 -2
- package/src/lib/composeInfiniteQueryKey.ts +1 -1
- package/src/lib/composeMutationKey.ts +1 -1
- package/src/lib/composeQueryKey.ts +1 -1
- package/src/lib/useComposeUseQueryOptions.ts +1 -1
- package/src/service-operation/OperationInfiniteData.ts +8 -0
- package/src/service-operation/QueryFilters.ts +227 -0
- package/src/service-operation/ServiceOperation.ts +86 -0
- package/src/service-operation/ServiceOperationCancelQueries.ts +53 -0
- package/src/service-operation/ServiceOperationFetchInfiniteQuery.ts +156 -0
- package/src/service-operation/ServiceOperationFetchQuery.ts +95 -0
- package/src/service-operation/ServiceOperationGetInfiniteQueryData.ts +15 -0
- package/src/service-operation/ServiceOperationGetQueriesData.ts +37 -0
- package/src/service-operation/ServiceOperationGetQueryData.ts +14 -0
- package/src/service-operation/ServiceOperationGetQueryState.ts +28 -0
- package/src/service-operation/ServiceOperationInvalidateQueries.ts +62 -0
- package/src/service-operation/ServiceOperationIsFetchingQueries.ts +40 -0
- package/src/service-operation/ServiceOperationIsMutatingQueries.ts +62 -0
- package/src/service-operation/ServiceOperationKey.ts +20 -0
- package/src/service-operation/ServiceOperationMutationFn.ts +34 -0
- package/src/service-operation/ServiceOperationQueryFn.ts +67 -0
- package/src/service-operation/ServiceOperationRefetchQueries.ts +74 -0
- package/src/service-operation/ServiceOperationRemoveQueries.ts +40 -0
- package/src/service-operation/ServiceOperationResetQueries.ts +53 -0
- package/src/service-operation/ServiceOperationSetInfiniteQueryData.ts +25 -0
- package/src/service-operation/ServiceOperationSetQueriesData.ts +55 -0
- package/src/service-operation/ServiceOperationSetQueryData.ts +43 -0
- package/src/service-operation/ServiceOperationUseInfiniteQuery.ts +70 -0
- package/src/service-operation/ServiceOperationUseIsFetchingQueries.ts +20 -0
- package/src/service-operation/ServiceOperationUseIsMutating.ts +28 -0
- package/src/service-operation/ServiceOperationUseMutation.ts +46 -0
- package/src/service-operation/ServiceOperationUseMutationState.ts +112 -0
- package/src/service-operation/ServiceOperationUseQueries.ts +40 -0
- package/src/service-operation/ServiceOperationUseQuery.ts +48 -0
- package/src/service-operation/ServiceOperationUseSuspenseInfiniteQuery.ts +43 -0
- package/src/service-operation/ServiceOperationUseSuspenseQueries.ts +40 -0
- package/src/service-operation/ServiceOperationUseSuspenseQueryQuery.ts +28 -0
- package/src/service-operation/index.ts +4 -0
package/src/ServiceOperation.ts
CHANGED
|
@@ -1,1404 +1,67 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CancelOptions,
|
|
3
|
-
DefaultError,
|
|
4
|
-
FetchStatus,
|
|
5
|
-
InfiniteData,
|
|
6
|
-
InfiniteQueryPageParamsOptions,
|
|
7
|
-
InvalidateOptions,
|
|
8
|
-
Mutation,
|
|
9
|
-
MutationState,
|
|
10
|
-
MutationStatus,
|
|
11
|
-
NoInfer,
|
|
12
|
-
QueriesPlaceholderDataFunction,
|
|
13
|
-
Query,
|
|
14
|
-
QueryClient,
|
|
15
|
-
FetchQueryOptions,
|
|
16
|
-
RefetchOptions,
|
|
17
|
-
ResetOptions,
|
|
18
|
-
SetDataOptions,
|
|
19
|
-
Updater,
|
|
20
|
-
QueryFunction,
|
|
21
|
-
InitialPageParam,
|
|
22
|
-
GetNextPageParamFunction,
|
|
23
|
-
QueryState,
|
|
24
|
-
} from '@tanstack/query-core';
|
|
25
|
-
import type {
|
|
26
|
-
DefinedInitialDataInfiniteOptions,
|
|
27
|
-
DefinedInitialDataOptions,
|
|
28
|
-
DefinedUseInfiniteQueryResult,
|
|
29
|
-
DefinedUseQueryResult,
|
|
30
|
-
UndefinedInitialDataInfiniteOptions,
|
|
31
|
-
UndefinedInitialDataOptions,
|
|
32
|
-
UseInfiniteQueryResult,
|
|
33
|
-
UseMutationOptions,
|
|
34
|
-
UseMutationResult,
|
|
35
|
-
UseQueryOptions,
|
|
36
|
-
UseQueryResult,
|
|
37
|
-
UseSuspenseInfiniteQueryOptions,
|
|
38
|
-
UseSuspenseInfiniteQueryResult,
|
|
39
|
-
UseSuspenseQueryOptions,
|
|
40
|
-
UseSuspenseQueryResult,
|
|
41
|
-
} from '@tanstack/react-query';
|
|
42
|
-
|
|
43
|
-
import type { RequestFn } from './lib/requestFn.js';
|
|
44
|
-
|
|
45
|
-
type ServiceOperationBaseQueryKey<
|
|
46
|
-
S extends { url: string; method: string },
|
|
47
|
-
Infinite extends boolean,
|
|
48
|
-
T,
|
|
49
|
-
> = [S & { infinite: Infinite }, T];
|
|
50
|
-
|
|
51
|
-
export type ServiceOperationQueryKey<
|
|
52
|
-
S extends { url: string; method: string },
|
|
53
|
-
T,
|
|
54
|
-
> = ServiceOperationBaseQueryKey<S, false, T>;
|
|
55
|
-
|
|
56
|
-
export type ServiceOperationInfiniteQueryKey<
|
|
57
|
-
S extends { url: string; method: string },
|
|
58
|
-
T,
|
|
59
|
-
> = ServiceOperationBaseQueryKey<S, true, T>;
|
|
60
|
-
|
|
61
|
-
export type ServiceOperationMutationKey<
|
|
62
|
-
S extends Record<'url' | 'method', string>,
|
|
63
|
-
T extends unknown,
|
|
64
|
-
> = NonNullable<T> extends never ? [S] : [S, T];
|
|
65
|
-
|
|
66
|
-
export interface ServiceOperationQuery<
|
|
67
|
-
TSchema extends { url: string; method: string },
|
|
68
|
-
TData,
|
|
69
|
-
TParams,
|
|
70
|
-
TError = DefaultError,
|
|
71
|
-
> extends ServiceOperationUseQuery<TSchema, TData, TParams, TError>,
|
|
72
|
-
ServiceOperationUseQueries<TSchema, TData, TParams, TError>,
|
|
73
|
-
ServiceOperationUseSuspenseQueries<TSchema, TData, TParams, TError>,
|
|
74
|
-
ServiceOperationUseInfiniteQuery<TSchema, TData, TParams, TError>,
|
|
75
|
-
ServiceOperationUseSuspenseQueryQuery<TSchema, TData, TParams, TError>,
|
|
76
|
-
ServiceOperationUseSuspenseInfiniteQuery<TSchema, TData, TParams, TError>,
|
|
77
|
-
ServiceOperationUseIsFetchingQueries<TSchema, TData, TParams, TError>,
|
|
78
|
-
ServiceOperationQueryFn<TSchema, TData, TParams>,
|
|
79
|
-
ServiceOperationFetchQuery<TSchema, TData, TParams, TError>,
|
|
80
|
-
ServiceOperationFetchInfiniteQuery<TSchema, TData, TParams, TError>,
|
|
81
|
-
ServiceOperationGetQueryData<TSchema, TData, TParams>,
|
|
82
|
-
ServiceOperationGetQueryState<TSchema, TData, TParams, TError>,
|
|
83
|
-
ServiceOperationGetQueriesData<TSchema, TData, TParams, TError>,
|
|
84
|
-
ServiceOperationGetInfiniteQueryData<TSchema, TData, TParams>,
|
|
85
|
-
ServiceOperationSetQueryData<TSchema, TData, TParams>,
|
|
86
|
-
ServiceOperationSetQueriesData<TSchema, TData, TParams, TError>,
|
|
87
|
-
ServiceOperationSetInfiniteQueryData<TSchema, TData, TParams>,
|
|
88
|
-
ServiceOperationInvalidateQueries<TSchema, TData, TParams, TError>,
|
|
89
|
-
ServiceOperationCancelQueries<TSchema, TData, TParams, TError>,
|
|
90
|
-
ServiceOperationRemoveQueries<TSchema, TData, TParams, TError>,
|
|
91
|
-
ServiceOperationResetQueries<TSchema, TData, TParams, TError>,
|
|
92
|
-
ServiceOperationRefetchQueries<TSchema, TData, TParams, TError>,
|
|
93
|
-
ServiceOperationIsFetchingQueries<TSchema, TData, TParams, TError> {
|
|
94
|
-
schema: TSchema;
|
|
95
|
-
types: {
|
|
96
|
-
parameters: TParams;
|
|
97
|
-
data: TData;
|
|
98
|
-
error: TError;
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
interface ServiceOperationUseQuery<
|
|
103
|
-
TSchema extends { url: string; method: string },
|
|
104
|
-
TData,
|
|
105
|
-
TParams = {},
|
|
106
|
-
TError = DefaultError,
|
|
107
|
-
> {
|
|
108
|
-
getQueryKey<QueryKeyParams extends TParams | undefined = undefined>(
|
|
109
|
-
parameters?: QueryKeyParams
|
|
110
|
-
): ServiceOperationQueryKey<TSchema, QueryKeyParams>;
|
|
111
|
-
|
|
112
|
-
useQuery(
|
|
113
|
-
parameters: TParams | ServiceOperationQueryKey<TSchema, TParams>,
|
|
114
|
-
options?: Omit<
|
|
115
|
-
UndefinedInitialDataOptions<
|
|
116
|
-
TData,
|
|
117
|
-
TError,
|
|
118
|
-
TData,
|
|
119
|
-
ServiceOperationQueryKey<TSchema, TParams>
|
|
120
|
-
>,
|
|
121
|
-
'queryKey'
|
|
122
|
-
>,
|
|
123
|
-
queryClient?: QueryClient
|
|
124
|
-
): UseQueryResult<TData, TError | Error>;
|
|
125
|
-
useQuery(
|
|
126
|
-
parameters: TParams | ServiceOperationQueryKey<TSchema, TParams>,
|
|
127
|
-
options: Omit<
|
|
128
|
-
DefinedInitialDataOptions<
|
|
129
|
-
TData,
|
|
130
|
-
TError,
|
|
131
|
-
TData,
|
|
132
|
-
ServiceOperationQueryKey<TSchema, TParams>
|
|
133
|
-
>,
|
|
134
|
-
'queryKey'
|
|
135
|
-
>,
|
|
136
|
-
queryClient?: QueryClient
|
|
137
|
-
): DefinedUseQueryResult<TData, TError | Error>;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
type FetchQueryOptionsBase<
|
|
141
|
-
TSchema extends { url: string; method: string },
|
|
142
|
-
TData,
|
|
143
|
-
TParams = {},
|
|
144
|
-
TError = DefaultError,
|
|
145
|
-
> = Omit<
|
|
146
|
-
FetchQueryOptions<
|
|
147
|
-
TData,
|
|
148
|
-
TError,
|
|
149
|
-
TData,
|
|
150
|
-
ServiceOperationQueryKey<TSchema, TParams>
|
|
151
|
-
>,
|
|
152
|
-
'queryKey' | 'queryFn'
|
|
153
|
-
>;
|
|
154
|
-
|
|
155
|
-
interface FetchQueryOptionsByQueryKey<
|
|
156
|
-
TSchema extends { url: string; method: string },
|
|
157
|
-
TData,
|
|
158
|
-
TParams = {},
|
|
159
|
-
TError = DefaultError,
|
|
160
|
-
> extends FetchQueryOptionsBase<TSchema, TData, TParams, TError> {
|
|
161
|
-
/**
|
|
162
|
-
* Fetch Queries by query key
|
|
163
|
-
*/
|
|
164
|
-
queryKey?: ServiceOperationQueryKey<TSchema, TParams>;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
interface FetchQueryOptionsByParameters<
|
|
168
|
-
TSchema extends { url: string; method: string },
|
|
169
|
-
TData,
|
|
170
|
-
TParams = {},
|
|
171
|
-
TError = DefaultError,
|
|
172
|
-
> extends FetchQueryOptionsBase<TSchema, TData, TParams, TError> {
|
|
173
|
-
/**
|
|
174
|
-
* Fetch Queries by parameters
|
|
175
|
-
*/
|
|
176
|
-
parameters?: TParams;
|
|
177
|
-
queryKey?: never;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
type FetchQueryOptionsQueryFn<
|
|
181
|
-
TSchema extends { url: string; method: string },
|
|
182
|
-
TData,
|
|
183
|
-
TParams = {},
|
|
184
|
-
> =
|
|
185
|
-
| {
|
|
186
|
-
queryFn?: QueryFunction<
|
|
187
|
-
TData,
|
|
188
|
-
ServiceOperationQueryKey<TSchema, TParams>
|
|
189
|
-
>;
|
|
190
|
-
}
|
|
191
|
-
| {
|
|
192
|
-
requestFn: RequestFn<TData>;
|
|
193
|
-
/**
|
|
194
|
-
* Base URL to use for the request (used in the `queryFn`)
|
|
195
|
-
* @example 'https://api.example.com'
|
|
196
|
-
*/
|
|
197
|
-
baseUrl: string | undefined;
|
|
198
|
-
queryFn?: never; // Workaround to fix union type error
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
interface ServiceOperationFetchQuery<
|
|
202
|
-
TSchema extends { url: string; method: string },
|
|
203
|
-
TData,
|
|
204
|
-
TParams = {},
|
|
205
|
-
TError = DefaultError,
|
|
206
|
-
> {
|
|
207
|
-
fetchQuery(
|
|
208
|
-
options:
|
|
209
|
-
| (FetchQueryOptionsByQueryKey<TSchema, TData, TParams, TError> &
|
|
210
|
-
FetchQueryOptionsQueryFn<TSchema, TData, TParams>)
|
|
211
|
-
| (FetchQueryOptionsByParameters<TSchema, TData, TParams, TError> &
|
|
212
|
-
FetchQueryOptionsQueryFn<TSchema, TData, TParams>),
|
|
213
|
-
queryClient: QueryClient
|
|
214
|
-
): Promise<TData>;
|
|
215
|
-
prefetchQuery(
|
|
216
|
-
options:
|
|
217
|
-
| (FetchQueryOptionsByQueryKey<TSchema, TData, TParams, TError> &
|
|
218
|
-
FetchQueryOptionsQueryFn<TSchema, TData, TParams>)
|
|
219
|
-
| (FetchQueryOptionsByParameters<TSchema, TData, TParams, TError> &
|
|
220
|
-
FetchQueryOptionsQueryFn<TSchema, TData, TParams>),
|
|
221
|
-
queryClient: QueryClient
|
|
222
|
-
): Promise<void>;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
type FetchInfiniteQueryOptionsBase<
|
|
226
|
-
TSchema extends { url: string; method: string },
|
|
227
|
-
TData,
|
|
228
|
-
TParams = {},
|
|
229
|
-
TPageParam = unknown,
|
|
230
|
-
TError = DefaultError,
|
|
231
|
-
> = Omit<
|
|
232
|
-
FetchQueryOptions<
|
|
233
|
-
TData,
|
|
234
|
-
TError,
|
|
235
|
-
InfiniteData<TData, TPageParam>,
|
|
236
|
-
ServiceOperationQueryKey<TSchema, TParams>,
|
|
237
|
-
TPageParam
|
|
238
|
-
>,
|
|
239
|
-
'queryKey'
|
|
240
|
-
> &
|
|
241
|
-
InitialPageParam<PartialParameters<TPageParam>> &
|
|
242
|
-
FetchInfiniteQueryPages<TData, TPageParam>;
|
|
243
|
-
|
|
244
|
-
type FetchInfiniteQueryPages<TData = unknown, TPageParam = unknown> =
|
|
245
|
-
| {
|
|
246
|
-
pages?: never;
|
|
247
|
-
}
|
|
248
|
-
| {
|
|
249
|
-
pages: number;
|
|
250
|
-
getNextPageParam: GetNextPageParamFunction<
|
|
251
|
-
PartialParameters<TPageParam>,
|
|
252
|
-
TData
|
|
253
|
-
>;
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
type FetchInfiniteQueryOptionsByQueryKey<
|
|
257
|
-
TSchema extends { url: string; method: string },
|
|
258
|
-
TData,
|
|
259
|
-
TParams = {},
|
|
260
|
-
TPageParam = {},
|
|
261
|
-
TError = DefaultError,
|
|
262
|
-
> = FetchInfiniteQueryOptionsBase<
|
|
263
|
-
TSchema,
|
|
264
|
-
TData,
|
|
265
|
-
TParams,
|
|
266
|
-
TPageParam,
|
|
267
|
-
TError
|
|
268
|
-
> & {
|
|
269
|
-
/**
|
|
270
|
-
* Fetch Queries by query key
|
|
271
|
-
*/
|
|
272
|
-
queryKey?: ServiceOperationInfiniteQueryKey<TSchema, TParams>;
|
|
273
|
-
parameters?: never;
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
type FetchInfiniteQueryOptionsByParameters<
|
|
277
|
-
TSchema extends { url: string; method: string },
|
|
278
|
-
TData,
|
|
279
|
-
TParams = {},
|
|
280
|
-
TPageParam = {},
|
|
281
|
-
TError = DefaultError,
|
|
282
|
-
> = FetchInfiniteQueryOptionsBase<
|
|
283
|
-
TSchema,
|
|
284
|
-
TData,
|
|
285
|
-
TParams,
|
|
286
|
-
TPageParam,
|
|
287
|
-
TError
|
|
288
|
-
> & {
|
|
289
|
-
/**
|
|
290
|
-
* Fetch Queries by parameters
|
|
291
|
-
*/
|
|
292
|
-
parameters?: TParams;
|
|
293
|
-
queryKey?: never;
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
type FetchInfiniteQueryOptionsQueryFn<
|
|
297
|
-
TSchema extends { url: string; method: string },
|
|
298
|
-
TData,
|
|
299
|
-
TParams = {},
|
|
300
|
-
> =
|
|
301
|
-
| {
|
|
302
|
-
queryFn?: QueryFunction<
|
|
303
|
-
TData,
|
|
304
|
-
ServiceOperationInfiniteQueryKey<TSchema, TParams>
|
|
305
|
-
>;
|
|
306
|
-
}
|
|
307
|
-
| {
|
|
308
|
-
requestFn: RequestFn<TData>;
|
|
309
|
-
/**
|
|
310
|
-
* Base URL to use for the request (used in the `queryFn`)
|
|
311
|
-
* @example 'https://api.example.com'
|
|
312
|
-
*/
|
|
313
|
-
baseUrl: string | undefined;
|
|
314
|
-
queryFn?: never; // Workaround to fix union type error
|
|
315
|
-
};
|
|
316
|
-
|
|
317
|
-
interface ServiceOperationFetchInfiniteQuery<
|
|
318
|
-
TSchema extends { url: string; method: string },
|
|
319
|
-
TData,
|
|
320
|
-
TParams = {},
|
|
321
|
-
TError = DefaultError,
|
|
322
|
-
> {
|
|
323
|
-
fetchInfiniteQuery<TPageParam extends TParams>(
|
|
324
|
-
options:
|
|
325
|
-
| (FetchInfiniteQueryOptionsByQueryKey<
|
|
326
|
-
TSchema,
|
|
327
|
-
TData,
|
|
328
|
-
TParams,
|
|
329
|
-
TPageParam,
|
|
330
|
-
TError
|
|
331
|
-
> &
|
|
332
|
-
FetchInfiniteQueryOptionsQueryFn<TSchema, TData, TParams>)
|
|
333
|
-
| (FetchInfiniteQueryOptionsByParameters<
|
|
334
|
-
TSchema,
|
|
335
|
-
TData,
|
|
336
|
-
TParams,
|
|
337
|
-
TPageParam,
|
|
338
|
-
TError
|
|
339
|
-
> &
|
|
340
|
-
FetchInfiniteQueryOptionsQueryFn<TSchema, TData, TParams>),
|
|
341
|
-
queryClient: QueryClient
|
|
342
|
-
): Promise<InfiniteData<TData, TPageParam>>;
|
|
343
|
-
|
|
344
|
-
prefetchInfiniteQuery<TPageParam extends TParams>(
|
|
345
|
-
options:
|
|
346
|
-
| (FetchInfiniteQueryOptionsByQueryKey<
|
|
347
|
-
TSchema,
|
|
348
|
-
TData,
|
|
349
|
-
TParams,
|
|
350
|
-
TPageParam,
|
|
351
|
-
TError
|
|
352
|
-
> &
|
|
353
|
-
FetchInfiniteQueryOptionsQueryFn<TSchema, TData, TParams>)
|
|
354
|
-
| (FetchInfiniteQueryOptionsByParameters<
|
|
355
|
-
TSchema,
|
|
356
|
-
TData,
|
|
357
|
-
TParams,
|
|
358
|
-
TPageParam,
|
|
359
|
-
TError
|
|
360
|
-
> &
|
|
361
|
-
FetchInfiniteQueryOptionsQueryFn<TSchema, TData, TParams>),
|
|
362
|
-
queryClient: QueryClient
|
|
363
|
-
): Promise<void>;
|
|
364
|
-
}
|
|
1
|
+
import type { DefaultError } from '@tanstack/query-core';
|
|
365
2
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
UseQueryOptions<
|
|
377
|
-
TData,
|
|
378
|
-
TError,
|
|
379
|
-
TData,
|
|
380
|
-
ServiceOperationQueryKey<TSchema, TParams>
|
|
381
|
-
>,
|
|
382
|
-
'placeholderData' | 'suspense' | 'queryKey'
|
|
383
|
-
> & {
|
|
384
|
-
placeholderData?: TData | QueriesPlaceholderDataFunction<TData>;
|
|
385
|
-
} & (
|
|
386
|
-
| { parameters: TParams; queryKey?: never }
|
|
387
|
-
| { queryKey: ServiceOperationQueryKey<TSchema, TParams> }
|
|
388
|
-
)
|
|
389
|
-
>;
|
|
390
|
-
combine?: (
|
|
391
|
-
results: Array<UseQueryResult<TData, TError>>
|
|
392
|
-
) => TCombinedResult;
|
|
393
|
-
},
|
|
394
|
-
queryClient?: QueryClient
|
|
395
|
-
): TCombinedResult;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
type QueryTypeFilter = 'all' | 'active' | 'inactive';
|
|
399
|
-
|
|
400
|
-
interface QueryFiltersBase<
|
|
401
|
-
TSchema extends { url: string; method: string },
|
|
402
|
-
TData,
|
|
403
|
-
TInfinite extends boolean,
|
|
404
|
-
TParams = {},
|
|
405
|
-
TError = DefaultError,
|
|
406
|
-
> {
|
|
407
|
-
/**
|
|
408
|
-
* Include queries matching this predicate function
|
|
409
|
-
*/
|
|
410
|
-
predicate?: TInfinite extends true
|
|
411
|
-
? QueryFilterInfinitePredicate<TSchema, TData, TParams, TError>
|
|
412
|
-
: TInfinite extends false
|
|
413
|
-
? QueryFilterRegularPredicate<TSchema, TData, TParams, TError>
|
|
414
|
-
: (query: string) => boolean;
|
|
415
|
-
/**
|
|
416
|
-
* Filter to active queries, inactive queries or all queries
|
|
417
|
-
*/
|
|
418
|
-
type?: QueryTypeFilter;
|
|
419
|
-
/**
|
|
420
|
-
* Match query key exactly
|
|
421
|
-
*/
|
|
422
|
-
exact?: boolean;
|
|
423
|
-
/**
|
|
424
|
-
* Include or exclude stale queries
|
|
425
|
-
*/
|
|
426
|
-
stale?: boolean;
|
|
427
|
-
/**
|
|
428
|
-
* Include queries matching their fetchStatus
|
|
429
|
-
*/
|
|
430
|
-
fetchStatus?: FetchStatus;
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
interface QueryFiltersByQueryKey<
|
|
434
|
-
TSchema extends { url: string; method: string },
|
|
435
|
-
TData,
|
|
436
|
-
TInfinite extends boolean,
|
|
437
|
-
TParams = {},
|
|
438
|
-
TError = DefaultError,
|
|
439
|
-
> extends QueryFiltersBase<TSchema, TData, TInfinite, TParams, TError> {
|
|
440
|
-
/**
|
|
441
|
-
* Include queries matching this query key
|
|
442
|
-
*/
|
|
443
|
-
queryKey?: ServiceOperationBaseQueryKey<TSchema, TInfinite, TParams>;
|
|
444
|
-
|
|
445
|
-
infinite?: never;
|
|
446
|
-
parameters?: never;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
interface QueryFiltersByParameters<
|
|
450
|
-
TSchema extends { url: string; method: string },
|
|
451
|
-
TData,
|
|
452
|
-
TInfinite extends boolean,
|
|
453
|
-
TParams = {},
|
|
454
|
-
TError = DefaultError,
|
|
455
|
-
> extends QueryFiltersBase<TSchema, TData, TInfinite, TParams, TError> {
|
|
456
|
-
/**
|
|
457
|
-
* Is the query infinite
|
|
458
|
-
*/
|
|
459
|
-
infinite?: TInfinite;
|
|
460
|
-
|
|
461
|
-
/**
|
|
462
|
-
* Include queries matching parameters
|
|
463
|
-
*/
|
|
464
|
-
parameters?: TParams;
|
|
465
|
-
|
|
466
|
-
queryKey?: never;
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
interface QueryFilterInfinitePredicate<
|
|
470
|
-
TSchema extends { url: string; method: string },
|
|
471
|
-
TData,
|
|
472
|
-
TParams = {},
|
|
473
|
-
TError = DefaultError,
|
|
474
|
-
> {
|
|
475
|
-
/**
|
|
476
|
-
* Include queries matching this predicate function
|
|
477
|
-
*/
|
|
478
|
-
(
|
|
479
|
-
query: Query<
|
|
480
|
-
InfiniteData<TData, TParams>,
|
|
481
|
-
TError,
|
|
482
|
-
InfiniteData<TData, TParams>,
|
|
483
|
-
ServiceOperationInfiniteQueryKey<TSchema, TParams>
|
|
484
|
-
>
|
|
485
|
-
): boolean;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
interface QueryFilterRegularPredicate<
|
|
489
|
-
TSchema extends { url: string; method: string },
|
|
490
|
-
TData,
|
|
491
|
-
TParams = {},
|
|
492
|
-
TError = DefaultError,
|
|
493
|
-
> {
|
|
494
|
-
/**
|
|
495
|
-
* Include queries matching this predicate function
|
|
496
|
-
*/
|
|
497
|
-
(
|
|
498
|
-
query: Query<
|
|
499
|
-
TData,
|
|
500
|
-
TError,
|
|
501
|
-
TData,
|
|
502
|
-
ServiceOperationQueryKey<TSchema, TParams>
|
|
503
|
-
>
|
|
504
|
-
): boolean;
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
type InvalidateQueryFilters<
|
|
508
|
-
TSchema extends { url: string; method: string },
|
|
509
|
-
TData,
|
|
510
|
-
TInfinite extends boolean,
|
|
511
|
-
TParams = {},
|
|
512
|
-
TError = DefaultError,
|
|
513
|
-
> = (
|
|
514
|
-
| QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError>
|
|
515
|
-
| QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>
|
|
516
|
-
) & {
|
|
517
|
-
refetchType?: QueryTypeFilter | 'none';
|
|
518
|
-
};
|
|
519
|
-
|
|
520
|
-
interface ServiceOperationInvalidateQueries<
|
|
521
|
-
TSchema extends { url: string; method: string },
|
|
522
|
-
TData,
|
|
523
|
-
TParams = {},
|
|
524
|
-
TError = DefaultError,
|
|
525
|
-
> {
|
|
526
|
-
invalidateQueries<TInfinite extends boolean>(
|
|
527
|
-
filters: InvalidateQueryFilters<TSchema, TData, TInfinite, TParams, TError>,
|
|
528
|
-
options: InvalidateOptions,
|
|
529
|
-
queryClient: QueryClient
|
|
530
|
-
): Promise<void>;
|
|
531
|
-
invalidateQueries<TInfinite extends boolean>(
|
|
532
|
-
filters: InvalidateQueryFilters<TSchema, TData, TInfinite, TParams, TError>,
|
|
533
|
-
queryClient: QueryClient
|
|
534
|
-
): Promise<void>;
|
|
535
|
-
invalidateQueries(queryClient: QueryClient): Promise<void>;
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
/**
|
|
539
|
-
* @internal
|
|
540
|
-
*/
|
|
541
|
-
export interface ServiceOperationInvalidateQueriesCallback<
|
|
542
|
-
TSchema extends { url: string; method: string },
|
|
543
|
-
TData,
|
|
544
|
-
TParams = {},
|
|
545
|
-
TError = DefaultError,
|
|
546
|
-
> extends ServiceOperationInvalidateQueries<TSchema, TData, TParams, TError> {
|
|
547
|
-
invalidateQueries<TInfinite extends boolean>(
|
|
548
|
-
filters:
|
|
549
|
-
| InvalidateQueryFilters<TSchema, TData, TInfinite, TParams, TError>
|
|
550
|
-
| QueryClient,
|
|
551
|
-
options?: InvalidateOptions | QueryClient,
|
|
552
|
-
queryClient?: QueryClient
|
|
553
|
-
): Promise<void>;
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
interface ServiceOperationCancelQueries<
|
|
557
|
-
TSchema extends { url: string; method: string },
|
|
558
|
-
TData,
|
|
559
|
-
TParams = {},
|
|
560
|
-
TError = DefaultError,
|
|
561
|
-
> {
|
|
562
|
-
cancelQueries<TInfinite extends boolean>(
|
|
563
|
-
filters:
|
|
564
|
-
| QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError>
|
|
565
|
-
| QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>,
|
|
566
|
-
options: CancelOptions,
|
|
567
|
-
queryClient: QueryClient
|
|
568
|
-
): Promise<void>;
|
|
569
|
-
cancelQueries<TInfinite extends boolean>(
|
|
570
|
-
filters:
|
|
571
|
-
| QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError>
|
|
572
|
-
| QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>,
|
|
573
|
-
queryClient: QueryClient
|
|
574
|
-
): Promise<void>;
|
|
575
|
-
cancelQueries(queryClient: QueryClient): Promise<void>;
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
/**
|
|
579
|
-
* @internal
|
|
580
|
-
*/
|
|
581
|
-
export interface ServiceOperationCancelQueriesCallback<
|
|
582
|
-
TSchema extends { url: string; method: string },
|
|
583
|
-
TData,
|
|
584
|
-
TParams = {},
|
|
585
|
-
TError = DefaultError,
|
|
586
|
-
> extends ServiceOperationCancelQueries<TSchema, TData, TParams, TError> {
|
|
587
|
-
cancelQueries<TInfinite extends boolean>(
|
|
588
|
-
filters:
|
|
589
|
-
| QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError>
|
|
590
|
-
| QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>
|
|
591
|
-
| QueryClient,
|
|
592
|
-
options?: CancelOptions | QueryClient,
|
|
593
|
-
queryClient?: QueryClient
|
|
594
|
-
): Promise<void>;
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
interface ServiceOperationRemoveQueries<
|
|
598
|
-
TSchema extends { url: string; method: string },
|
|
599
|
-
TData,
|
|
600
|
-
TParams = {},
|
|
601
|
-
TError = DefaultError,
|
|
602
|
-
> {
|
|
603
|
-
removeQueries<TInfinite extends boolean>(
|
|
604
|
-
filters:
|
|
605
|
-
| QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError>
|
|
606
|
-
| QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>,
|
|
607
|
-
queryClient: QueryClient
|
|
608
|
-
): void;
|
|
609
|
-
removeQueries(queryClient: QueryClient): void;
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
/**
|
|
613
|
-
* @internal
|
|
614
|
-
*/
|
|
615
|
-
export interface ServiceOperationRemoveQueriesCallback<
|
|
616
|
-
TSchema extends { url: string; method: string },
|
|
617
|
-
TData,
|
|
618
|
-
TParams = {},
|
|
619
|
-
TError = DefaultError,
|
|
620
|
-
> extends ServiceOperationRemoveQueries<TSchema, TData, TParams, TError> {
|
|
621
|
-
removeQueries<TInfinite extends boolean>(
|
|
622
|
-
filters:
|
|
623
|
-
| QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError>
|
|
624
|
-
| QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>
|
|
625
|
-
| QueryClient,
|
|
626
|
-
queryClient?: QueryClient
|
|
627
|
-
): void;
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
interface ServiceOperationResetQueries<
|
|
631
|
-
TSchema extends { url: string; method: string },
|
|
632
|
-
TData,
|
|
633
|
-
TParams = {},
|
|
634
|
-
TError = DefaultError,
|
|
635
|
-
> {
|
|
636
|
-
resetQueries<TInfinite extends boolean>(
|
|
637
|
-
filters:
|
|
638
|
-
| QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError>
|
|
639
|
-
| QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>,
|
|
640
|
-
options: ResetOptions,
|
|
641
|
-
queryClient: QueryClient
|
|
642
|
-
): Promise<void>;
|
|
643
|
-
resetQueries<TInfinite extends boolean>(
|
|
644
|
-
filters:
|
|
645
|
-
| QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError>
|
|
646
|
-
| QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>,
|
|
647
|
-
queryClient: QueryClient
|
|
648
|
-
): Promise<void>;
|
|
649
|
-
resetQueries(queryClient: QueryClient): Promise<void>;
|
|
650
|
-
}
|
|
3
|
+
import type {
|
|
4
|
+
ServiceOperationQuery as ServiceOperationQueryBase,
|
|
5
|
+
ServiceOperationMutation as ServiceOperationMutationBase,
|
|
6
|
+
} from './service-operation/ServiceOperation.js';
|
|
7
|
+
import type {
|
|
8
|
+
ServiceOperationInfiniteQueryKey as ServiceOperationInfiniteQueryKeyBase,
|
|
9
|
+
ServiceOperationMutationKey as ServiceOperationMutationKeyBase,
|
|
10
|
+
ServiceOperationQueryKey as ServiceOperationQueryKeyBase,
|
|
11
|
+
} from './service-operation/ServiceOperationKey.js';
|
|
12
|
+
import type { ServiceOperationMutationFn as ServiceOperationMutationFnBase } from './service-operation/ServiceOperationMutationFn.js';
|
|
651
13
|
|
|
652
14
|
/**
|
|
653
|
-
* @
|
|
15
|
+
* @deprecated Use `ServiceOperationMutationFn` from `@openapi-qraft/react/service-operation/ServiceOperationMutationFn` instead.
|
|
654
16
|
*/
|
|
655
|
-
export
|
|
656
|
-
TSchema extends { url: string; method: string },
|
|
657
|
-
TData,
|
|
658
|
-
TParams = {},
|
|
659
|
-
TError = DefaultError,
|
|
660
|
-
> extends ServiceOperationResetQueries<TSchema, TData, TParams, TError> {
|
|
661
|
-
resetQueries<TInfinite extends boolean>(
|
|
662
|
-
filters:
|
|
663
|
-
| QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError>
|
|
664
|
-
| QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>
|
|
665
|
-
| QueryClient,
|
|
666
|
-
options?: ResetOptions | QueryClient,
|
|
667
|
-
queryClient?: QueryClient
|
|
668
|
-
): Promise<void>;
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
interface ServiceOperationRefetchQueries<
|
|
17
|
+
export type ServiceOperationMutationFn<
|
|
672
18
|
TSchema extends { url: string; method: string },
|
|
19
|
+
TBody,
|
|
673
20
|
TData,
|
|
674
|
-
TParams
|
|
675
|
-
|
|
676
|
-
> {
|
|
677
|
-
refetchQueries<TInfinite extends boolean>(
|
|
678
|
-
filters:
|
|
679
|
-
| QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError>
|
|
680
|
-
| QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>,
|
|
681
|
-
options: RefetchOptions,
|
|
682
|
-
queryClient: QueryClient
|
|
683
|
-
): Promise<void>;
|
|
684
|
-
refetchQueries<TInfinite extends boolean>(
|
|
685
|
-
filters:
|
|
686
|
-
| QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError>
|
|
687
|
-
| QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>,
|
|
688
|
-
queryClient: QueryClient
|
|
689
|
-
): Promise<void>;
|
|
690
|
-
refetchQueries(queryClient: QueryClient): Promise<void>;
|
|
691
|
-
}
|
|
21
|
+
TParams,
|
|
22
|
+
> = ServiceOperationMutationFnBase<TSchema, TBody, TData, TParams>;
|
|
692
23
|
|
|
693
24
|
/**
|
|
694
|
-
* @
|
|
25
|
+
* @deprecated Use `ServiceOperationQuery` from `@openapi-qraft/react` instead.
|
|
695
26
|
*/
|
|
696
|
-
export
|
|
27
|
+
export type ServiceOperationQuery<
|
|
697
28
|
TSchema extends { url: string; method: string },
|
|
698
29
|
TData,
|
|
699
|
-
TParams
|
|
700
|
-
TError = DefaultError,
|
|
701
|
-
> extends ServiceOperationRefetchQueries<TSchema, TData, TParams, TError> {
|
|
702
|
-
refetchQueries<TInfinite extends boolean>(
|
|
703
|
-
filters:
|
|
704
|
-
| QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError>
|
|
705
|
-
| QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>
|
|
706
|
-
| QueryClient,
|
|
707
|
-
options?: RefetchOptions | QueryClient,
|
|
708
|
-
queryClient?: QueryClient
|
|
709
|
-
): Promise<void>;
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
interface ServiceOperationIsFetchingQueries<
|
|
713
|
-
TSchema extends { url: string; method: string },
|
|
714
|
-
TData,
|
|
715
|
-
TParams = {},
|
|
30
|
+
TParams,
|
|
716
31
|
TError = DefaultError,
|
|
717
|
-
>
|
|
718
|
-
isFetching<TInfinite extends boolean>(
|
|
719
|
-
filters:
|
|
720
|
-
| QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError>
|
|
721
|
-
| QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>,
|
|
722
|
-
queryClient: QueryClient
|
|
723
|
-
): number;
|
|
724
|
-
isFetching(queryClient: QueryClient): number;
|
|
725
|
-
}
|
|
32
|
+
> = ServiceOperationQueryBase<TSchema, TData, TParams, TError>;
|
|
726
33
|
|
|
727
34
|
/**
|
|
728
|
-
* @
|
|
35
|
+
* @deprecated Use `ServiceOperationMutation` from `@openapi-qraft/react` instead.
|
|
729
36
|
*/
|
|
730
|
-
export
|
|
731
|
-
TSchema extends { url: string; method: string },
|
|
732
|
-
TData,
|
|
733
|
-
TParams = {},
|
|
734
|
-
TError = DefaultError,
|
|
735
|
-
> extends ServiceOperationIsFetchingQueries<TSchema, TData, TParams, TError> {
|
|
736
|
-
refetchQueries<TInfinite extends boolean>(
|
|
737
|
-
filters:
|
|
738
|
-
| QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError>
|
|
739
|
-
| QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>
|
|
740
|
-
| QueryClient,
|
|
741
|
-
queryClient?: QueryClient
|
|
742
|
-
): number;
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
interface ServiceOperationUseIsFetchingQueries<
|
|
746
|
-
TSchema extends { url: string; method: string },
|
|
747
|
-
TData,
|
|
748
|
-
TParams = {},
|
|
749
|
-
TError = DefaultError,
|
|
750
|
-
> {
|
|
751
|
-
useIsFetching<TInfinite extends boolean>(
|
|
752
|
-
filters?:
|
|
753
|
-
| QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError>
|
|
754
|
-
| QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>,
|
|
755
|
-
queryClient?: QueryClient
|
|
756
|
-
): number;
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
interface ServiceOperationUseSuspenseQueries<
|
|
760
|
-
TSchema extends { url: string; method: string },
|
|
761
|
-
TData,
|
|
762
|
-
TParams = {},
|
|
763
|
-
TError = DefaultError,
|
|
764
|
-
> {
|
|
765
|
-
useSuspenseQueries<
|
|
766
|
-
TCombinedResult = Array<UseSuspenseQueryResult<TData, TError>>,
|
|
767
|
-
>(
|
|
768
|
-
options: {
|
|
769
|
-
queries: ReadonlyArray<
|
|
770
|
-
Omit<
|
|
771
|
-
UseSuspenseQueryOptions<
|
|
772
|
-
TData,
|
|
773
|
-
TError,
|
|
774
|
-
TData,
|
|
775
|
-
ServiceOperationQueryKey<TSchema, TParams>
|
|
776
|
-
>,
|
|
777
|
-
'queryKey'
|
|
778
|
-
> &
|
|
779
|
-
(
|
|
780
|
-
| { parameters: TParams; queryKey?: never }
|
|
781
|
-
| { queryKey: ServiceOperationQueryKey<TSchema, TParams> }
|
|
782
|
-
)
|
|
783
|
-
>;
|
|
784
|
-
combine?: (
|
|
785
|
-
results: Array<UseSuspenseQueryResult<TData, TError>>
|
|
786
|
-
) => TCombinedResult;
|
|
787
|
-
},
|
|
788
|
-
queryClient?: QueryClient
|
|
789
|
-
): TCombinedResult;
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
interface ServiceOperationUseInfiniteQuery<
|
|
793
|
-
TSchema extends { url: string; method: string },
|
|
794
|
-
TData,
|
|
795
|
-
TParams = {},
|
|
796
|
-
TError = DefaultError,
|
|
797
|
-
> {
|
|
798
|
-
getInfiniteQueryKey<TQueryKeyParams extends TParams>(
|
|
799
|
-
parameters: TQueryKeyParams
|
|
800
|
-
): ServiceOperationInfiniteQueryKey<TSchema, TQueryKeyParams>;
|
|
801
|
-
|
|
802
|
-
useInfiniteQuery<TPageParam extends TParams>(
|
|
803
|
-
parameters: TParams | ServiceOperationInfiniteQueryKey<TSchema, TParams>,
|
|
804
|
-
options: Omit<
|
|
805
|
-
UndefinedInitialDataInfiniteOptions<
|
|
806
|
-
TData,
|
|
807
|
-
TError,
|
|
808
|
-
InfiniteData<TData, TParams>,
|
|
809
|
-
ServiceOperationInfiniteQueryKey<TSchema, TParams>,
|
|
810
|
-
PartialParameters<TPageParam>
|
|
811
|
-
>,
|
|
812
|
-
| 'queryKey'
|
|
813
|
-
| 'getPreviousPageParam'
|
|
814
|
-
| 'getNextPageParam'
|
|
815
|
-
| 'initialPageParam'
|
|
816
|
-
> &
|
|
817
|
-
InfiniteQueryPageParamsOptions<TData, PartialParameters<TPageParam>>,
|
|
818
|
-
queryClient?: QueryClient
|
|
819
|
-
): UseInfiniteQueryResult<InfiniteData<TData, TParams>, TError | Error>;
|
|
820
|
-
useInfiniteQuery<TPageParam extends TParams>(
|
|
821
|
-
parameters: TParams | ServiceOperationInfiniteQueryKey<TSchema, TParams>,
|
|
822
|
-
options: Omit<
|
|
823
|
-
DefinedInitialDataInfiniteOptions<
|
|
824
|
-
TData,
|
|
825
|
-
TError,
|
|
826
|
-
InfiniteData<TData, TParams>,
|
|
827
|
-
ServiceOperationInfiniteQueryKey<TSchema, TParams>,
|
|
828
|
-
PartialParameters<TPageParam>
|
|
829
|
-
>,
|
|
830
|
-
| 'queryKey'
|
|
831
|
-
| 'getPreviousPageParam'
|
|
832
|
-
| 'getNextPageParam'
|
|
833
|
-
| 'initialPageParam'
|
|
834
|
-
> &
|
|
835
|
-
InfiniteQueryPageParamsOptions<TData, PartialParameters<TPageParam>>,
|
|
836
|
-
queryClient?: QueryClient
|
|
837
|
-
): DefinedUseInfiniteQueryResult<
|
|
838
|
-
InfiniteData<TData, TParams>,
|
|
839
|
-
TError | Error
|
|
840
|
-
>;
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
interface ServiceOperationUseSuspenseInfiniteQuery<
|
|
844
|
-
TSchema extends { url: string; method: string },
|
|
845
|
-
TData,
|
|
846
|
-
TParams = {},
|
|
847
|
-
TError = DefaultError,
|
|
848
|
-
> {
|
|
849
|
-
useSuspenseInfiniteQuery<TPageParam extends TParams>(
|
|
850
|
-
parameters: TParams | ServiceOperationInfiniteQueryKey<TSchema, TParams>,
|
|
851
|
-
options: Omit<
|
|
852
|
-
UseSuspenseInfiniteQueryOptions<
|
|
853
|
-
TData,
|
|
854
|
-
TError,
|
|
855
|
-
InfiniteData<TData, TParams>,
|
|
856
|
-
TData,
|
|
857
|
-
ServiceOperationInfiniteQueryKey<TSchema, TParams>,
|
|
858
|
-
PartialParameters<TPageParam>
|
|
859
|
-
>,
|
|
860
|
-
| 'queryKey'
|
|
861
|
-
| 'getPreviousPageParam'
|
|
862
|
-
| 'getNextPageParam'
|
|
863
|
-
| 'initialPageParam'
|
|
864
|
-
> &
|
|
865
|
-
InfiniteQueryPageParamsOptions<TData, PartialParameters<TPageParam>>,
|
|
866
|
-
queryClient?: QueryClient
|
|
867
|
-
): UseSuspenseInfiniteQueryResult<
|
|
868
|
-
InfiniteData<TData, TParams>,
|
|
869
|
-
TError | Error
|
|
870
|
-
>;
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
interface ServiceOperationUseSuspenseQueryQuery<
|
|
874
|
-
TSchema extends { url: string; method: string },
|
|
875
|
-
TData,
|
|
876
|
-
TParams = {},
|
|
877
|
-
TError = DefaultError,
|
|
878
|
-
> {
|
|
879
|
-
useSuspenseQuery(
|
|
880
|
-
parameters: TParams | ServiceOperationQueryKey<TSchema, TParams>,
|
|
881
|
-
options?: Omit<
|
|
882
|
-
UseSuspenseQueryOptions<
|
|
883
|
-
TData,
|
|
884
|
-
TError,
|
|
885
|
-
TData,
|
|
886
|
-
ServiceOperationQueryKey<TSchema, TParams>
|
|
887
|
-
>,
|
|
888
|
-
'queryKey'
|
|
889
|
-
>,
|
|
890
|
-
queryClient?: QueryClient
|
|
891
|
-
): UseSuspenseQueryResult<TData, TError | Error>;
|
|
892
|
-
}
|
|
893
|
-
|
|
894
|
-
export interface ServiceOperationMutation<
|
|
895
|
-
TSchema extends { url: string; method: string },
|
|
896
|
-
TBody,
|
|
897
|
-
TData,
|
|
898
|
-
TParams,
|
|
899
|
-
TError = DefaultError,
|
|
900
|
-
> extends ServiceOperationUseMutation<TSchema, TBody, TData, TParams, TError>,
|
|
901
|
-
ServiceOperationUseIsMutating<TSchema, TBody, TData, TParams, TError>,
|
|
902
|
-
ServiceOperationUseMutationState<TSchema, TBody, TData, TParams, TError>,
|
|
903
|
-
ServiceOperationIsMutatingQueries<TSchema, TBody, TData, TParams, TError>,
|
|
904
|
-
ServiceOperationMutationFn<TSchema, TBody, TData, TParams> {
|
|
905
|
-
schema: TSchema;
|
|
906
|
-
types: {
|
|
907
|
-
parameters: TParams;
|
|
908
|
-
data: TData;
|
|
909
|
-
error: TError;
|
|
910
|
-
body: TBody;
|
|
911
|
-
};
|
|
912
|
-
}
|
|
913
|
-
|
|
914
|
-
interface ServiceOperationUseMutation<
|
|
915
|
-
TSchema extends { url: string; method: string },
|
|
916
|
-
TBody,
|
|
917
|
-
TData,
|
|
918
|
-
TParams,
|
|
919
|
-
TError = DefaultError,
|
|
920
|
-
> {
|
|
921
|
-
getMutationKey<TMutationKeyParams extends TParams | undefined = undefined>(
|
|
922
|
-
parameters?: TMutationKeyParams
|
|
923
|
-
): ServiceOperationMutationKey<TSchema, TMutationKeyParams>;
|
|
924
|
-
|
|
925
|
-
useMutation<
|
|
926
|
-
TVariables extends MutationVariables<TBody, TParams>,
|
|
927
|
-
TContext = unknown,
|
|
928
|
-
>(
|
|
929
|
-
parameters?: undefined,
|
|
930
|
-
options?: Omit<
|
|
931
|
-
UseMutationOptions<TData, TError, TVariables, TContext>,
|
|
932
|
-
'mutationKey'
|
|
933
|
-
> & {
|
|
934
|
-
mutationKey?: ServiceOperationMutationKey<TSchema, TParams>;
|
|
935
|
-
},
|
|
936
|
-
queryClient?: QueryClient
|
|
937
|
-
): UseMutationResult<TData, TError | Error, TVariables, TContext>;
|
|
938
|
-
|
|
939
|
-
useMutation<TVariables extends TBody, TContext = unknown>(
|
|
940
|
-
parameters: TParams,
|
|
941
|
-
options?: Omit<
|
|
942
|
-
UseMutationOptions<TData, TError, TVariables, TContext>,
|
|
943
|
-
'mutationKey'
|
|
944
|
-
>,
|
|
945
|
-
queryClient?: QueryClient
|
|
946
|
-
): UseMutationResult<TData, TError | Error, TVariables, TContext>;
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
interface UseMutationStateFiltersBase<
|
|
950
|
-
TBody,
|
|
951
|
-
TData,
|
|
952
|
-
TParams,
|
|
953
|
-
TError = DefaultError,
|
|
954
|
-
TContext = unknown,
|
|
955
|
-
> {
|
|
956
|
-
/**
|
|
957
|
-
* Match mutation key exactly
|
|
958
|
-
*/
|
|
959
|
-
exact?: boolean;
|
|
960
|
-
/**
|
|
961
|
-
* Include mutations matching this predicate function
|
|
962
|
-
*/
|
|
963
|
-
predicate?: (
|
|
964
|
-
mutation: Mutation<
|
|
965
|
-
TData,
|
|
966
|
-
TError,
|
|
967
|
-
MutationVariables<TBody, TParams>,
|
|
968
|
-
TContext
|
|
969
|
-
>
|
|
970
|
-
) => boolean;
|
|
971
|
-
|
|
972
|
-
/**
|
|
973
|
-
* Filter by mutation status
|
|
974
|
-
*/
|
|
975
|
-
status?: MutationStatus;
|
|
976
|
-
}
|
|
977
|
-
|
|
978
|
-
interface MutationFiltersByParameters<
|
|
979
|
-
TBody,
|
|
980
|
-
TData,
|
|
981
|
-
TParams,
|
|
982
|
-
TError = DefaultError,
|
|
983
|
-
TContext = unknown,
|
|
984
|
-
> extends UseMutationStateFiltersBase<TBody, TData, TParams, TError, TContext> {
|
|
985
|
-
/**
|
|
986
|
-
* Include mutations matching these parameters
|
|
987
|
-
*/
|
|
988
|
-
parameters?: PartialParameters<TParams>;
|
|
989
|
-
mutationKey?: never;
|
|
990
|
-
}
|
|
991
|
-
|
|
992
|
-
interface MutationFiltersByMutationKey<
|
|
993
|
-
TSchema extends { url: string; method: string },
|
|
994
|
-
TBody,
|
|
995
|
-
TData,
|
|
996
|
-
TParams,
|
|
997
|
-
TError = DefaultError,
|
|
998
|
-
TContext = unknown,
|
|
999
|
-
> extends UseMutationStateFiltersBase<TBody, TData, TParams, TError, TContext> {
|
|
1000
|
-
/**
|
|
1001
|
-
* Include mutations matching this mutation key
|
|
1002
|
-
*/
|
|
1003
|
-
mutationKey?: ServiceOperationMutationKey<
|
|
1004
|
-
TSchema,
|
|
1005
|
-
PartialParameters<TParams>
|
|
1006
|
-
>;
|
|
1007
|
-
parameters?: never;
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
|
-
type MutationVariables<TBody, TParams> = {
|
|
1011
|
-
body: TBody;
|
|
1012
|
-
} & (NonNullable<TParams> extends never ? {} : TParams);
|
|
1013
|
-
|
|
1014
|
-
interface ServiceOperationUseMutationState<
|
|
1015
|
-
TSchema extends { url: string; method: string },
|
|
1016
|
-
TBody,
|
|
1017
|
-
TData,
|
|
1018
|
-
TParams,
|
|
1019
|
-
TError = DefaultError,
|
|
1020
|
-
> {
|
|
1021
|
-
useMutationState<
|
|
1022
|
-
TContext = unknown,
|
|
1023
|
-
TResult = MutationState<
|
|
1024
|
-
TData,
|
|
1025
|
-
TError,
|
|
1026
|
-
MutationVariables<TBody, TParams>,
|
|
1027
|
-
TContext
|
|
1028
|
-
>,
|
|
1029
|
-
>(
|
|
1030
|
-
options?: {
|
|
1031
|
-
filters?:
|
|
1032
|
-
| MutationFiltersByParameters<TBody, TData, TParams, TError, TContext>
|
|
1033
|
-
| MutationFiltersByMutationKey<
|
|
1034
|
-
TSchema,
|
|
1035
|
-
TBody,
|
|
1036
|
-
TData,
|
|
1037
|
-
TParams,
|
|
1038
|
-
TError,
|
|
1039
|
-
TContext
|
|
1040
|
-
>;
|
|
1041
|
-
select?: (
|
|
1042
|
-
mutation: Mutation<
|
|
1043
|
-
TData,
|
|
1044
|
-
TError,
|
|
1045
|
-
MutationVariables<TBody, TParams>,
|
|
1046
|
-
TContext
|
|
1047
|
-
>
|
|
1048
|
-
) => TResult;
|
|
1049
|
-
},
|
|
1050
|
-
queryClient?: QueryClient
|
|
1051
|
-
): Array<TResult>;
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1054
|
-
interface ServiceOperationUseIsMutating<
|
|
37
|
+
export type ServiceOperationMutation<
|
|
1055
38
|
TSchema extends { url: string; method: string },
|
|
1056
39
|
TBody,
|
|
1057
40
|
TData,
|
|
1058
41
|
TParams,
|
|
1059
42
|
TError = DefaultError,
|
|
1060
|
-
>
|
|
1061
|
-
useIsMutating<TContext = unknown>(
|
|
1062
|
-
filters?:
|
|
1063
|
-
| MutationFiltersByParameters<TBody, TData, TParams, TError, TContext>
|
|
1064
|
-
| MutationFiltersByMutationKey<
|
|
1065
|
-
TSchema,
|
|
1066
|
-
TBody,
|
|
1067
|
-
TData,
|
|
1068
|
-
TParams,
|
|
1069
|
-
TError,
|
|
1070
|
-
TContext
|
|
1071
|
-
>,
|
|
1072
|
-
queryClient?: QueryClient
|
|
1073
|
-
): number;
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
|
-
interface QueryFnOptionsBase<
|
|
1077
|
-
TMeta extends Record<string, any>,
|
|
1078
|
-
TSignal extends AbortSignal = AbortSignal,
|
|
1079
|
-
> {
|
|
1080
|
-
signal?: TSignal;
|
|
1081
|
-
meta?: TMeta;
|
|
1082
|
-
}
|
|
1083
|
-
|
|
1084
|
-
interface QueryFnOptionsByParameters<
|
|
1085
|
-
TParams,
|
|
1086
|
-
TMeta extends Record<string, any>,
|
|
1087
|
-
TSignal extends AbortSignal = AbortSignal,
|
|
1088
|
-
> extends QueryFnOptionsBase<TMeta, TSignal> {
|
|
1089
|
-
parameters: TParams;
|
|
1090
|
-
queryKey?: never;
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
interface QueryFnOptionsByQueryKey<
|
|
1094
|
-
TSchema extends { url: string; method: string },
|
|
1095
|
-
TParams,
|
|
1096
|
-
TMeta extends Record<string, any>,
|
|
1097
|
-
TSignal extends AbortSignal = AbortSignal,
|
|
1098
|
-
> extends QueryFnOptionsBase<TMeta, TSignal> {
|
|
1099
|
-
queryKey: ServiceOperationQueryKey<TSchema, TParams>;
|
|
1100
|
-
}
|
|
1101
|
-
|
|
1102
|
-
interface ServiceOperationQueryFn<
|
|
1103
|
-
TSchema extends { url: string; method: string },
|
|
1104
|
-
TData,
|
|
1105
|
-
TParams,
|
|
1106
|
-
> {
|
|
1107
|
-
queryFn<
|
|
1108
|
-
TMeta extends Record<string, any>,
|
|
1109
|
-
TSignal extends AbortSignal = AbortSignal,
|
|
1110
|
-
>(
|
|
1111
|
-
options:
|
|
1112
|
-
| QueryFnOptionsByParameters<TParams, TMeta, TSignal>
|
|
1113
|
-
| QueryFnOptionsByQueryKey<TSchema, TParams, TMeta, TSignal>,
|
|
1114
|
-
client: (
|
|
1115
|
-
schema: TSchema,
|
|
1116
|
-
options: {
|
|
1117
|
-
parameters: TParams;
|
|
1118
|
-
signal?: TSignal;
|
|
1119
|
-
meta?: TMeta;
|
|
1120
|
-
}
|
|
1121
|
-
) => TData
|
|
1122
|
-
): TData;
|
|
1123
|
-
|
|
1124
|
-
queryFn<
|
|
1125
|
-
TMeta extends Record<string, any>,
|
|
1126
|
-
TSignal extends AbortSignal = AbortSignal,
|
|
1127
|
-
>(
|
|
1128
|
-
options:
|
|
1129
|
-
| QueryFnOptionsByParameters<TParams, TMeta, TSignal>
|
|
1130
|
-
| QueryFnOptionsByQueryKey<TSchema, TParams, TMeta, TSignal>,
|
|
1131
|
-
client: (
|
|
1132
|
-
schema: TSchema,
|
|
1133
|
-
options: {
|
|
1134
|
-
parameters: TParams;
|
|
1135
|
-
signal?: TSignal;
|
|
1136
|
-
meta?: TMeta;
|
|
1137
|
-
}
|
|
1138
|
-
) => Promise<TData>
|
|
1139
|
-
): Promise<TData>;
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
interface ServiceOperationSetQueryData<
|
|
1143
|
-
TSchema extends { url: string; method: string },
|
|
1144
|
-
TData,
|
|
1145
|
-
TParams = {}, // todo::try to replace `TParams = {}` with `TParams = undefined`
|
|
1146
|
-
> {
|
|
1147
|
-
setQueryData(
|
|
1148
|
-
parameters: TParams | ServiceOperationQueryKey<TSchema, TParams>,
|
|
1149
|
-
updater: Updater<NoInfer<TData> | undefined, NoInfer<TData> | undefined>,
|
|
1150
|
-
options: SetDataOptions,
|
|
1151
|
-
queryClient: QueryClient
|
|
1152
|
-
): TData | undefined;
|
|
1153
|
-
|
|
1154
|
-
setQueryData(
|
|
1155
|
-
parameters: TParams | ServiceOperationQueryKey<TSchema, TParams>,
|
|
1156
|
-
updater: Updater<NoInfer<TData> | undefined, NoInfer<TData> | undefined>,
|
|
1157
|
-
queryClient: QueryClient
|
|
1158
|
-
): TData | undefined;
|
|
1159
|
-
}
|
|
43
|
+
> = ServiceOperationMutationBase<TSchema, TBody, TData, TParams, TError>;
|
|
1160
44
|
|
|
1161
45
|
/**
|
|
1162
|
-
* @
|
|
46
|
+
* @deprecated Use `ServiceOperationQueryKey` from `@openapi-qraft/react/service-operation/ServiceOperationKey` instead.
|
|
1163
47
|
*/
|
|
1164
|
-
export
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
> extends ServiceOperationSetQueryData<TSchema, TData, TParams> {
|
|
1169
|
-
setQueryData(
|
|
1170
|
-
parameters: TParams | ServiceOperationQueryKey<TSchema, TParams>,
|
|
1171
|
-
updater: Updater<NoInfer<TData> | undefined, NoInfer<TData> | undefined>,
|
|
1172
|
-
options: SetDataOptions | QueryClient,
|
|
1173
|
-
queryClient?: QueryClient
|
|
1174
|
-
): TData | undefined;
|
|
1175
|
-
}
|
|
1176
|
-
|
|
1177
|
-
interface ServiceOperationSetQueriesData<
|
|
1178
|
-
TSchema extends { url: string; method: string },
|
|
1179
|
-
TData,
|
|
1180
|
-
TParams = {}, // todo::try to replace `TParams = {}` with `TParams = undefined`
|
|
1181
|
-
TError = DefaultError,
|
|
1182
|
-
> {
|
|
1183
|
-
setQueriesData<TInfinite extends boolean>(
|
|
1184
|
-
filters:
|
|
1185
|
-
| QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError>
|
|
1186
|
-
| QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>,
|
|
1187
|
-
updater: Updater<NoInfer<TData> | undefined, NoInfer<TData> | undefined>,
|
|
1188
|
-
options: SetDataOptions,
|
|
1189
|
-
queryClient: QueryClient
|
|
1190
|
-
): Array<TData | undefined>;
|
|
1191
|
-
|
|
1192
|
-
setQueriesData<TInfinite extends boolean>(
|
|
1193
|
-
filters:
|
|
1194
|
-
| QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError>
|
|
1195
|
-
| QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>,
|
|
1196
|
-
updater: Updater<NoInfer<TData> | undefined, NoInfer<TData> | undefined>,
|
|
1197
|
-
queryClient: QueryClient
|
|
1198
|
-
): Array<TData | undefined>;
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
|
-
/**
|
|
1202
|
-
* @internal
|
|
1203
|
-
*/
|
|
1204
|
-
export interface ServiceOperationSetQueriesDataCallback<
|
|
1205
|
-
TSchema extends { url: string; method: string },
|
|
1206
|
-
TData,
|
|
1207
|
-
TParams = {},
|
|
1208
|
-
TError = DefaultError,
|
|
1209
|
-
> extends ServiceOperationSetQueriesData<TSchema, TData, TParams, TError> {
|
|
1210
|
-
setQueriesData<TInfinite extends boolean>(
|
|
1211
|
-
filters:
|
|
1212
|
-
| QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError>
|
|
1213
|
-
| QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>,
|
|
1214
|
-
updater: Updater<NoInfer<TData> | undefined, NoInfer<TData> | undefined>,
|
|
1215
|
-
options: SetDataOptions | QueryClient,
|
|
1216
|
-
queryClient?: QueryClient
|
|
1217
|
-
): Array<TData | undefined>;
|
|
1218
|
-
}
|
|
1219
|
-
|
|
1220
|
-
interface ServiceOperationGetQueriesData<
|
|
1221
|
-
TSchema extends { url: string; method: string },
|
|
1222
|
-
TData,
|
|
1223
|
-
TParams = {}, // todo::try to replace `TParams = {}` with `TParams = undefined`
|
|
1224
|
-
TError = DefaultError,
|
|
1225
|
-
> {
|
|
1226
|
-
getQueriesData<TInfinite extends boolean>(
|
|
1227
|
-
filters:
|
|
1228
|
-
| QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError>
|
|
1229
|
-
| QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>,
|
|
1230
|
-
queryClient: QueryClient
|
|
1231
|
-
): TInfinite extends true
|
|
1232
|
-
? Array<
|
|
1233
|
-
[
|
|
1234
|
-
queryKey: ServiceOperationInfiniteQueryKey<TSchema, TParams>,
|
|
1235
|
-
data: NoInfer<InfiniteData<TData, TParams>> | undefined,
|
|
1236
|
-
]
|
|
1237
|
-
>
|
|
1238
|
-
: Array<
|
|
1239
|
-
[
|
|
1240
|
-
queryKey: ServiceOperationQueryKey<TSchema, TParams>,
|
|
1241
|
-
data: TData | undefined,
|
|
1242
|
-
]
|
|
1243
|
-
>;
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1246
|
-
interface ServiceOperationSetInfiniteQueryData<
|
|
1247
|
-
TSchema extends { url: string; method: string },
|
|
1248
|
-
TData,
|
|
1249
|
-
TParams = {},
|
|
1250
|
-
> {
|
|
1251
|
-
setInfiniteQueryData(
|
|
1252
|
-
parameters: TParams | ServiceOperationInfiniteQueryKey<TSchema, TParams>,
|
|
1253
|
-
updater: Updater<
|
|
1254
|
-
NoInfer<InfiniteData<TData, TParams>> | undefined,
|
|
1255
|
-
NoInfer<InfiniteData<TData, TParams>> | undefined
|
|
1256
|
-
>,
|
|
1257
|
-
queryClient: QueryClient,
|
|
1258
|
-
options?: SetDataOptions
|
|
1259
|
-
): InfiniteData<TData, TParams> | undefined;
|
|
1260
|
-
}
|
|
1261
|
-
|
|
1262
|
-
interface ServiceOperationGetQueryData<
|
|
1263
|
-
TSchema extends { url: string; method: string },
|
|
1264
|
-
TData,
|
|
1265
|
-
TParams = {},
|
|
1266
|
-
> {
|
|
1267
|
-
getQueryData(
|
|
1268
|
-
parameters: TParams | ServiceOperationQueryKey<TSchema, TParams>,
|
|
1269
|
-
queryClient: QueryClient
|
|
1270
|
-
): TData | undefined;
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
interface ServiceOperationGetInfiniteQueryData<
|
|
1274
|
-
TSchema extends { url: string; method: string },
|
|
1275
|
-
TData,
|
|
1276
|
-
TParams = {},
|
|
1277
|
-
> {
|
|
1278
|
-
getInfiniteQueryData(
|
|
1279
|
-
parameters: TParams | ServiceOperationInfiniteQueryKey<TSchema, TParams>,
|
|
1280
|
-
queryClient: QueryClient
|
|
1281
|
-
): InfiniteData<TData, TParams> | undefined;
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
interface ServiceOperationGetQueryState<
|
|
1285
|
-
TSchema extends { url: string; method: string },
|
|
1286
|
-
TData,
|
|
1287
|
-
TParams = {},
|
|
1288
|
-
TError = DefaultError,
|
|
1289
|
-
> {
|
|
1290
|
-
getQueryState(
|
|
1291
|
-
parameters: TParams | ServiceOperationQueryKey<TSchema, TParams>,
|
|
1292
|
-
queryClient: QueryClient
|
|
1293
|
-
): QueryState<TData, TError> | undefined;
|
|
1294
|
-
|
|
1295
|
-
getInfiniteQueryState(
|
|
1296
|
-
parameters: TParams | ServiceOperationInfiniteQueryKey<TSchema, TParams>,
|
|
1297
|
-
queryClient: QueryClient
|
|
1298
|
-
):
|
|
1299
|
-
| QueryState<InfiniteData<TData, PartialParameters<TParams>>, TError>
|
|
1300
|
-
| undefined;
|
|
1301
|
-
}
|
|
1302
|
-
|
|
1303
|
-
export interface ServiceOperationMutationFn<
|
|
1304
|
-
TSchema extends { url: string; method: string },
|
|
1305
|
-
TBody,
|
|
1306
|
-
TData,
|
|
1307
|
-
TParams,
|
|
1308
|
-
> {
|
|
1309
|
-
mutationFn(
|
|
1310
|
-
client: (
|
|
1311
|
-
schema: TSchema,
|
|
1312
|
-
options: {
|
|
1313
|
-
parameters: TParams;
|
|
1314
|
-
body: TBody;
|
|
1315
|
-
}
|
|
1316
|
-
) => TData,
|
|
1317
|
-
options: {
|
|
1318
|
-
parameters: TParams;
|
|
1319
|
-
body: TBody;
|
|
1320
|
-
}
|
|
1321
|
-
): TData;
|
|
1322
|
-
|
|
1323
|
-
mutationFn(
|
|
1324
|
-
client: (
|
|
1325
|
-
schema: TSchema,
|
|
1326
|
-
options: {
|
|
1327
|
-
parameters: TParams;
|
|
1328
|
-
body: TBody;
|
|
1329
|
-
}
|
|
1330
|
-
) => Promise<TData>,
|
|
1331
|
-
options: {
|
|
1332
|
-
parameters: TParams;
|
|
1333
|
-
body: TBody;
|
|
1334
|
-
}
|
|
1335
|
-
): Promise<TData>;
|
|
1336
|
-
}
|
|
1337
|
-
|
|
1338
|
-
interface ServiceOperationIsMutatingQueries<
|
|
1339
|
-
TSchema extends { url: string; method: string },
|
|
1340
|
-
TBody,
|
|
1341
|
-
TData,
|
|
1342
|
-
TParams = {},
|
|
1343
|
-
TError = DefaultError,
|
|
1344
|
-
> {
|
|
1345
|
-
isMutating<TContext>(
|
|
1346
|
-
filters:
|
|
1347
|
-
| MutationFiltersByParameters<TBody, TData, TParams, TError, TContext>
|
|
1348
|
-
| MutationFiltersByMutationKey<
|
|
1349
|
-
TSchema,
|
|
1350
|
-
TBody,
|
|
1351
|
-
TData,
|
|
1352
|
-
TParams,
|
|
1353
|
-
TError,
|
|
1354
|
-
TContext
|
|
1355
|
-
>,
|
|
1356
|
-
queryClient: QueryClient
|
|
1357
|
-
): number;
|
|
1358
|
-
isMutating(queryClient: QueryClient): number;
|
|
1359
|
-
}
|
|
48
|
+
export type ServiceOperationQueryKey<
|
|
49
|
+
S extends { url: string; method: string },
|
|
50
|
+
T,
|
|
51
|
+
> = ServiceOperationQueryKeyBase<S, T>;
|
|
1360
52
|
|
|
1361
53
|
/**
|
|
1362
|
-
* @
|
|
54
|
+
* @deprecated Use `ServiceOperationInfiniteQueryKey` from `@openapi-qraft/react/service-operation/ServiceOperationKey` instead.
|
|
1363
55
|
*/
|
|
1364
|
-
export
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
TParams = {},
|
|
1369
|
-
TError = DefaultError,
|
|
1370
|
-
> extends ServiceOperationIsMutatingQueries<
|
|
1371
|
-
TSchema,
|
|
1372
|
-
TBody,
|
|
1373
|
-
TData,
|
|
1374
|
-
TParams,
|
|
1375
|
-
TError
|
|
1376
|
-
> {
|
|
1377
|
-
isMutating<TContext>(
|
|
1378
|
-
filters:
|
|
1379
|
-
| MutationFiltersByParameters<TBody, TData, TParams, TError, TContext>
|
|
1380
|
-
| MutationFiltersByMutationKey<
|
|
1381
|
-
TSchema,
|
|
1382
|
-
TBody,
|
|
1383
|
-
TData,
|
|
1384
|
-
TParams,
|
|
1385
|
-
TError,
|
|
1386
|
-
TContext
|
|
1387
|
-
>
|
|
1388
|
-
| QueryClient,
|
|
1389
|
-
queryClient?: QueryClient
|
|
1390
|
-
): number;
|
|
1391
|
-
}
|
|
56
|
+
export type ServiceOperationInfiniteQueryKey<
|
|
57
|
+
S extends { url: string; method: string },
|
|
58
|
+
T,
|
|
59
|
+
> = ServiceOperationInfiniteQueryKeyBase<S, T>;
|
|
1392
60
|
|
|
1393
61
|
/**
|
|
1394
|
-
*
|
|
1395
|
-
* @example
|
|
1396
|
-
* ```ts
|
|
1397
|
-
* {query?: {page: number, nested: {still: 'not_partial'}}}
|
|
1398
|
-
* // =>
|
|
1399
|
-
* {query?: {page?: number, nested?: {still: 'not_partial'}}}
|
|
1400
|
-
* ```
|
|
62
|
+
* @deprecated Use `ServiceOperationMutationKey` from `@openapi-qraft/react/service-operation/ServiceOperationKey` instead.
|
|
1401
63
|
*/
|
|
1402
|
-
type
|
|
1403
|
-
|
|
1404
|
-
|
|
64
|
+
export type ServiceOperationMutationKey<
|
|
65
|
+
S extends Record<'url' | 'method', string>,
|
|
66
|
+
T extends unknown,
|
|
67
|
+
> = ServiceOperationMutationKeyBase<S, T>;
|