@openapi-qraft/react 1.6.0 → 1.8.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 +16 -0
- package/dist/QraftContext.d.ts +1 -1
- 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/mutationFn.js +2 -2
- package/dist/callbacks/mutationFn.js.map +1 -1
- package/dist/callbacks/operationInvokeFn.d.ts +9 -0
- package/dist/callbacks/operationInvokeFn.d.ts.map +1 -0
- package/dist/callbacks/operationInvokeFn.js +21 -0
- package/dist/callbacks/operationInvokeFn.js.map +1 -0
- 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/queryFn.js +4 -2
- 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/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/useInfiniteQuery.js +1 -1
- package/dist/callbacks/useInfiniteQuery.js.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/useQueries.js +1 -1
- package/dist/callbacks/useQueries.js.map +1 -1
- package/dist/callbacks/useQuery.d.ts +1 -1
- package/dist/callbacks/useQuery.d.ts.map +1 -1
- package/dist/callbacks/useQuery.js +1 -1
- package/dist/callbacks/useQuery.js.map +1 -1
- package/dist/callbacks/useSuspenseInfiniteQuery.d.ts +1 -1
- package/dist/callbacks/useSuspenseInfiniteQuery.d.ts.map +1 -1
- package/dist/callbacks/useSuspenseInfiniteQuery.js +1 -1
- package/dist/callbacks/useSuspenseInfiniteQuery.js.map +1 -1
- package/dist/callbacks/useSuspenseQueries.d.ts +1 -1
- package/dist/callbacks/useSuspenseQueries.d.ts.map +1 -1
- package/dist/callbacks/useSuspenseQueries.js +1 -1
- package/dist/callbacks/useSuspenseQueries.js.map +1 -1
- package/dist/callbacks/useSuspenseQuery.d.ts +1 -1
- package/dist/callbacks/useSuspenseQuery.d.ts.map +1 -1
- package/dist/callbacks/useSuspenseQuery.js +1 -1
- 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 -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/callQueryClientFetchMethod.js +3 -3
- package/dist/lib/callQueryClientFetchMethod.js.map +1 -1
- package/dist/lib/callQueryClientMethodWithMutationFilters.js +2 -2
- package/dist/lib/callQueryClientMethodWithMutationFilters.js.map +1 -1
- package/dist/lib/callQueryClientMethodWithQueryFilters.js +2 -2
- package/dist/lib/callQueryClientMethodWithQueryFilters.js.map +1 -1
- package/dist/lib/callQueryClientMethodWithQueryKey.js +1 -1
- package/dist/lib/callQueryClientMethodWithQueryKey.js.map +1 -1
- 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 +2 -2
- 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/composeQueryKey.d.ts +1 -1
- package/dist/lib/composeQueryKey.d.ts.map +1 -1
- package/dist/lib/createRecursiveProxy.d.ts +6 -0
- package/dist/lib/createRecursiveProxy.d.ts.map +1 -1
- package/dist/lib/createRecursiveProxy.js +7 -0
- package/dist/lib/createRecursiveProxy.js.map +1 -1
- package/dist/lib/requestFn.d.ts +26 -3
- package/dist/lib/requestFn.d.ts.map +1 -1
- package/dist/lib/requestFn.js +27 -3
- package/dist/lib/requestFn.js.map +1 -1
- package/dist/lib/useComposeUseQueryOptions.js +2 -2
- package/dist/lib/useComposeUseQueryOptions.js.map +1 -1
- package/dist/lib/useQueryClient.d.ts.map +1 -1
- package/dist/lib/useQueryClient.js +1 -2
- package/dist/lib/useQueryClient.js.map +1 -1
- package/dist/qraftAPIClient.d.ts +4 -16
- package/dist/qraftAPIClient.d.ts.map +1 -1
- package/dist/qraftAPIClient.js +28 -9
- package/dist/qraftAPIClient.js.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 +47 -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 +79 -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 +9 -4
- package/src/QraftContext.ts +1 -1
- 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 +3 -3
- package/src/callbacks/operationInvokeFn.ts +45 -0
- package/src/callbacks/prefetchInfiniteQuery.ts +1 -1
- package/src/callbacks/prefetchQuery.ts +1 -1
- package/src/callbacks/queryFn.ts +12 -7
- 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 +2 -2
- 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 +2 -2
- package/src/callbacks/useQuery.ts +2 -2
- package/src/callbacks/useSuspenseInfiniteQuery.ts +2 -2
- package/src/callbacks/useSuspenseQueries.ts +2 -2
- package/src/callbacks/useSuspenseQuery.ts +2 -2
- package/src/index.ts +1 -4
- package/src/lib/PartialParameters.type.ts +12 -0
- package/src/lib/callQueryClientFetchMethod.ts +3 -3
- package/src/lib/callQueryClientMethodWithMutationFilters.ts +2 -2
- package/src/lib/callQueryClientMethodWithQueryFilters.ts +2 -2
- package/src/lib/callQueryClientMethodWithQueryKey.ts +1 -1
- package/src/lib/composeBaseQueryKey.ts +2 -2
- package/src/lib/composeInfiniteQueryKey.ts +1 -1
- package/src/lib/composeMutationKey.ts +7 -9
- package/src/lib/composeQueryKey.ts +1 -1
- package/src/lib/createRecursiveProxy.ts +7 -0
- package/src/lib/requestFn.ts +31 -5
- package/src/lib/useComposeUseQueryOptions.ts +3 -3
- package/src/lib/useQueryClient.ts +3 -2
- package/src/qraftAPIClient.ts +39 -39
- 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 +92 -0
- package/src/service-operation/ServiceOperationQueryFn.ts +177 -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
|
@@ -5,6 +5,13 @@ type ProxyApplyCallback = (path: string[], args: unknown[]) => unknown;
|
|
|
5
5
|
*/
|
|
6
6
|
type ProxyGetCallback = (path: string[], key: string) => unknown | undefined;
|
|
7
7
|
|
|
8
|
+
// todo::rename to `qraftRecursiveProxy` with deprecated `createRecursiveProxy`
|
|
9
|
+
/**
|
|
10
|
+
* Creates a recursive proxy that calls the `getCallback` and `applyCallback` functions
|
|
11
|
+
* @param getCallback The callback to call when a proxy property is accessed
|
|
12
|
+
* @param applyCallback The callback to call when a proxy is called as a function
|
|
13
|
+
* @param path The current path of the proxy
|
|
14
|
+
*/
|
|
8
15
|
export function createRecursiveProxy(
|
|
9
16
|
getCallback: ProxyGetCallback,
|
|
10
17
|
applyCallback: ProxyApplyCallback,
|
package/src/lib/requestFn.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* This function is used to make a request to a specified endpoint.
|
|
3
|
+
*
|
|
4
|
+
* @template T The expected return type of the request.
|
|
5
|
+
*
|
|
6
|
+
* @param schema The schema of the operation to be performed. It includes the OpenAPI path, HTTP method and media type.
|
|
7
|
+
* @param requestInfo The information required to make the request. It includes parameters, headers, body, etc.
|
|
8
|
+
* @param [options] Optional. Additional options for the request. It includes custom urlSerializer, bodySerializer, and fetch function.
|
|
9
|
+
*
|
|
10
|
+
* @returns {Promise<T>} Returns a promise that resolves with the response of the request.
|
|
11
|
+
*
|
|
12
|
+
* @throws {error: object|string, response: Response} Throws an error if the request fails. The error includes the error message and the response from the server.
|
|
3
13
|
*/
|
|
4
14
|
export async function requestFn<T>(
|
|
5
15
|
schema: OperationSchema,
|
|
@@ -14,7 +24,20 @@ export async function requestFn<T>(
|
|
|
14
24
|
}
|
|
15
25
|
|
|
16
26
|
/**
|
|
17
|
-
*
|
|
27
|
+
* This function is used to make a request to a specified endpoint.
|
|
28
|
+
* It's needed to create a custom `requestFn` with a custom `urlSerializer`
|
|
29
|
+
* and `bodySerializer`, with the tree-shaking of the default `requestFn`
|
|
30
|
+
* and its serializers.
|
|
31
|
+
*
|
|
32
|
+
* @template T The expected return type of the request.
|
|
33
|
+
*
|
|
34
|
+
* @param requestSchema The schema of the operation to be performed. It includes the OpenAPI path, HTTP method and media type.
|
|
35
|
+
* @param requestInfo The information required to make the request. It includes parameters, headers, body, etc.
|
|
36
|
+
* @param options The options for the request. It includes urlSerializer, bodySerializer, and fetch function. The 'urlSerializer' and 'bodySerializer' are required.
|
|
37
|
+
*
|
|
38
|
+
* @returns {Promise<T>} Returns a promise that resolves with the response of the request.
|
|
39
|
+
*
|
|
40
|
+
* @throws {error: object|string, response: Response} Throws an error if the request fails. The error includes the error message and the response from the server.
|
|
18
41
|
*/
|
|
19
42
|
export async function baseRequestFn<T>(
|
|
20
43
|
requestSchema: OperationSchema,
|
|
@@ -65,7 +88,10 @@ export function urlSerializer(
|
|
|
65
88
|
const path = schema.url.replace(
|
|
66
89
|
/{(.*?)}/g,
|
|
67
90
|
(substring: string, group: string) => {
|
|
68
|
-
if (
|
|
91
|
+
if (
|
|
92
|
+
info.parameters?.path &&
|
|
93
|
+
Object.prototype.hasOwnProperty.call(info.parameters.path, group)
|
|
94
|
+
) {
|
|
69
95
|
return encodeURI(String(info.parameters?.path[group]));
|
|
70
96
|
}
|
|
71
97
|
return substring;
|
|
@@ -254,7 +280,7 @@ export interface OperationSchema {
|
|
|
254
280
|
* Operation path
|
|
255
281
|
* @example /user/{id}
|
|
256
282
|
*/
|
|
257
|
-
readonly url: string;
|
|
283
|
+
readonly url: string; //todo::rename to `path`
|
|
258
284
|
|
|
259
285
|
/**
|
|
260
286
|
* Operation method
|
|
@@ -279,6 +305,7 @@ export interface OperationSchema {
|
|
|
279
305
|
export interface RequestFnPayload {
|
|
280
306
|
/**
|
|
281
307
|
* Base URL to use for the request
|
|
308
|
+
* @example 'https://api.example.com'
|
|
282
309
|
*/
|
|
283
310
|
baseUrl: string | undefined;
|
|
284
311
|
|
|
@@ -291,7 +318,6 @@ export interface RequestFnPayload {
|
|
|
291
318
|
*/
|
|
292
319
|
readonly parameters?: {
|
|
293
320
|
readonly path?: Record<string, any>;
|
|
294
|
-
readonly cookie?: Record<string, any>;
|
|
295
321
|
readonly header?: Record<string, any>;
|
|
296
322
|
readonly query?: Record<string, any>;
|
|
297
323
|
};
|
|
@@ -7,7 +7,7 @@ import type { UseQueryOptions } from '@tanstack/react-query';
|
|
|
7
7
|
|
|
8
8
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
9
9
|
import { QraftContext } from '../QraftContext.js';
|
|
10
|
-
import type { ServiceOperationQueryKey } from '../
|
|
10
|
+
import type { ServiceOperationQueryKey } from '../service-operation/ServiceOperationKey.js';
|
|
11
11
|
import { composeInfiniteQueryKey } from './composeInfiniteQueryKey.js';
|
|
12
12
|
import { composeQueryKey } from './composeQueryKey.js';
|
|
13
13
|
import type { OperationSchema } from './requestFn.js';
|
|
@@ -32,10 +32,10 @@ export function useComposeUseQueryOptions(
|
|
|
32
32
|
|
|
33
33
|
const queryFn =
|
|
34
34
|
options?.queryFn ??
|
|
35
|
-
// @ts-expect-error
|
|
35
|
+
// @ts-expect-error - Too complex to type
|
|
36
36
|
function ({ queryKey: [, queryParams], signal, meta, pageParam }) {
|
|
37
37
|
return contextValue.requestFn(schema, {
|
|
38
|
-
// @ts-expect-error
|
|
38
|
+
// @ts-expect-error - Too complex to type
|
|
39
39
|
parameters: infinite
|
|
40
40
|
? (shelfMerge(2, queryParams, pageParam) as never)
|
|
41
41
|
: queryParams,
|
|
@@ -19,8 +19,9 @@ export function useQueryClient(
|
|
|
19
19
|
qraftOptions: QraftClientOptions | undefined,
|
|
20
20
|
queryClient: QueryClient | undefined
|
|
21
21
|
) {
|
|
22
|
-
const queryClientByContext = useContext(
|
|
23
|
-
?.
|
|
22
|
+
const queryClientByContext = useContext(
|
|
23
|
+
qraftOptions?.context ?? QraftContext
|
|
24
|
+
)?.queryClient;
|
|
24
25
|
|
|
25
26
|
return useQueryClientTanstack(queryClient ?? queryClientByContext);
|
|
26
27
|
}
|
package/src/qraftAPIClient.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Context } from 'react';
|
|
2
2
|
|
|
3
|
+
import type * as operationInvokeModule from './callbacks/operationInvokeFn.js';
|
|
3
4
|
import { createRecursiveProxy } from './lib/createRecursiveProxy.js';
|
|
4
5
|
import type { OperationSchema } from './lib/requestFn.js';
|
|
5
6
|
import type { QraftContextValue } from './QraftContext.js';
|
|
@@ -9,36 +10,34 @@ export interface QraftClientOptions {
|
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export const qraftAPIClient = <
|
|
12
|
-
Services extends
|
|
13
|
+
Services extends ServicesBaseDeclaration<Services>,
|
|
13
14
|
Callbacks extends ServicesCallbacks,
|
|
14
15
|
>(
|
|
15
16
|
services: ServicesDeclaration<Services>,
|
|
16
17
|
callbacks: Callbacks,
|
|
17
18
|
options?: QraftClientOptions
|
|
18
|
-
):
|
|
19
|
+
): Services => {
|
|
19
20
|
return createRecursiveProxy(
|
|
20
|
-
(getPath, key)
|
|
21
|
-
if (getPath.length !== 2 || key !== 'schema') return;
|
|
21
|
+
function getCallback(getPath, key) {
|
|
22
|
+
if (getPath.length !== 2 || key !== 'schema') return; // todo::maybe return callback?
|
|
22
23
|
|
|
23
24
|
const serviceOperation = getByPath(services, getPath);
|
|
24
25
|
if (!isServiceOperation(serviceOperation))
|
|
25
26
|
throw new Error(`Service operation not found: ${getPath.join('.')}`);
|
|
26
27
|
return serviceOperation.schema;
|
|
27
28
|
},
|
|
28
|
-
(applyPath, args)
|
|
29
|
-
const path = applyPath
|
|
29
|
+
function applyCallback(applyPath, args) {
|
|
30
|
+
const { path, callbackName } = extractCallbackDetails(applyPath);
|
|
31
|
+
|
|
32
|
+
if (!(callbackName in callbacks))
|
|
33
|
+
throw new Error(`Function ${callbackName} is not supported`);
|
|
34
|
+
|
|
30
35
|
const serviceOperation = getByPath(services, path);
|
|
31
36
|
|
|
32
37
|
if (!isServiceOperation(serviceOperation))
|
|
33
38
|
throw new Error(`Service operation not found: ${path.join('.')}`);
|
|
34
39
|
|
|
35
|
-
|
|
36
|
-
const functionName = applyPath[applyPath.length - 1];
|
|
37
|
-
|
|
38
|
-
if (!(functionName in callbacks))
|
|
39
|
-
throw new Error(`Function ${functionName} is not supported`);
|
|
40
|
-
|
|
41
|
-
return callbacks[functionName as keyof Callbacks](
|
|
40
|
+
return callbacks[callbackName as keyof Callbacks](
|
|
42
41
|
options,
|
|
43
42
|
serviceOperation.schema,
|
|
44
43
|
args
|
|
@@ -48,6 +47,30 @@ export const qraftAPIClient = <
|
|
|
48
47
|
) as never;
|
|
49
48
|
};
|
|
50
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Extracts Callback details from the applyPath
|
|
52
|
+
* @param applyPath
|
|
53
|
+
*/
|
|
54
|
+
function extractCallbackDetails(applyPath: string[]) {
|
|
55
|
+
// <service>.<operation>()
|
|
56
|
+
if (applyPath.length === 2) {
|
|
57
|
+
return {
|
|
58
|
+
path: applyPath,
|
|
59
|
+
callbackName: 'operationInvokeFn' satisfies Extract<
|
|
60
|
+
keyof typeof operationInvokeModule,
|
|
61
|
+
'operationInvokeFn'
|
|
62
|
+
>,
|
|
63
|
+
};
|
|
64
|
+
} else {
|
|
65
|
+
// <service>.<operation>.<method>()
|
|
66
|
+
return {
|
|
67
|
+
path: applyPath.slice(0, -1),
|
|
68
|
+
// The last arg is for instance `.useMutation` or `.useQuery()`
|
|
69
|
+
callbackName: applyPath[applyPath.length - 1],
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
51
74
|
function isServiceOperation(
|
|
52
75
|
input: unknown
|
|
53
76
|
): input is { schema: OperationSchema } {
|
|
@@ -61,13 +84,13 @@ function getByPath(obj: Record<string, unknown>, path: string[]) {
|
|
|
61
84
|
}, obj);
|
|
62
85
|
}
|
|
63
86
|
|
|
64
|
-
type
|
|
87
|
+
type ServicesBaseDeclaration<Services> = {
|
|
65
88
|
[service in keyof Services]: {
|
|
66
89
|
[method in keyof Services[service]]: { schema: OperationSchema };
|
|
67
90
|
};
|
|
68
91
|
};
|
|
69
92
|
|
|
70
|
-
type ServicesDeclaration<Services extends
|
|
93
|
+
type ServicesDeclaration<Services extends ServicesBaseDeclaration<Services>> = {
|
|
71
94
|
[service in keyof Services]: {
|
|
72
95
|
[method in keyof Services[service]]: {
|
|
73
96
|
schema: Services[service][method]['schema'];
|
|
@@ -75,27 +98,4 @@ type ServicesDeclaration<Services extends ServicesOutput<Services>> = {
|
|
|
75
98
|
};
|
|
76
99
|
};
|
|
77
100
|
|
|
78
|
-
type ServicesCallbacks = Record<string, (...rest: any[]) =>
|
|
79
|
-
|
|
80
|
-
type ServicesCallbacksFilter<
|
|
81
|
-
Services extends ServicesOutput<Services>,
|
|
82
|
-
Callbacks,
|
|
83
|
-
> = Services extends {
|
|
84
|
-
[serviceName in keyof Services]: {
|
|
85
|
-
[method in keyof Services[serviceName]]: { schema: OperationSchema };
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
? {
|
|
89
|
-
[serviceName in keyof Services]: {
|
|
90
|
-
[method in keyof Services[serviceName]]: Pick<
|
|
91
|
-
Services[serviceName][method],
|
|
92
|
-
FilterKeys<
|
|
93
|
-
keyof Services[serviceName][method],
|
|
94
|
-
Callbacks | 'schema' | 'types'
|
|
95
|
-
>
|
|
96
|
-
>;
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
: never;
|
|
100
|
-
|
|
101
|
-
type FilterKeys<T, K> = K extends T ? K : never;
|
|
101
|
+
type ServicesCallbacks = Record<string, (...rest: any[]) => unknown>;
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import type { DefaultError, FetchStatus, Query } from '@tanstack/query-core';
|
|
2
|
+
|
|
3
|
+
import type { PartialParameters } from '../lib/PartialParameters.type.js';
|
|
4
|
+
import type { OperationInfiniteData } from './OperationInfiniteData.js';
|
|
5
|
+
import type {
|
|
6
|
+
ServiceOperationBaseQueryKey,
|
|
7
|
+
ServiceOperationInfiniteQueryKey,
|
|
8
|
+
ServiceOperationQueryKey,
|
|
9
|
+
} from './ServiceOperationKey.js';
|
|
10
|
+
|
|
11
|
+
export type QueryTypeFilter = 'all' | 'active' | 'inactive';
|
|
12
|
+
|
|
13
|
+
interface QueryFiltersBase<
|
|
14
|
+
TSchema extends { url: string; method: string },
|
|
15
|
+
TData,
|
|
16
|
+
TInfinite extends boolean,
|
|
17
|
+
TParams = {},
|
|
18
|
+
TError = DefaultError,
|
|
19
|
+
> {
|
|
20
|
+
/**
|
|
21
|
+
* Include queries matching this predicate function
|
|
22
|
+
*/
|
|
23
|
+
predicate?: TInfinite extends true
|
|
24
|
+
? QueryFilterInfinitePredicate<TSchema, TData, TParams, TError>
|
|
25
|
+
: TInfinite extends false
|
|
26
|
+
? QueryFilterRegularPredicate<TSchema, TData, TParams, TError>
|
|
27
|
+
: (query: string) => boolean;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Filter to active queries, inactive queries or all queries
|
|
31
|
+
*/
|
|
32
|
+
type?: QueryTypeFilter;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Include or exclude stale queries
|
|
36
|
+
*/
|
|
37
|
+
stale?: boolean;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Include queries matching their fetchStatus
|
|
41
|
+
*/
|
|
42
|
+
fetchStatus?: FetchStatus;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
interface QueryFiltersByQueryKeyBase<
|
|
46
|
+
TSchema extends { url: string; method: string },
|
|
47
|
+
TData,
|
|
48
|
+
TInfinite extends boolean,
|
|
49
|
+
TParams = {},
|
|
50
|
+
TError = DefaultError,
|
|
51
|
+
> extends QueryFiltersBase<TSchema, TData, TInfinite, TParams, TError> {
|
|
52
|
+
infinite?: never;
|
|
53
|
+
parameters?: never;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
interface QueryFiltersByExactQueryKey<
|
|
57
|
+
TSchema extends { url: string; method: string },
|
|
58
|
+
TData,
|
|
59
|
+
TInfinite extends boolean,
|
|
60
|
+
TParams = {},
|
|
61
|
+
TError = DefaultError,
|
|
62
|
+
> extends QueryFiltersByQueryKeyBase<
|
|
63
|
+
TSchema,
|
|
64
|
+
TData,
|
|
65
|
+
TInfinite,
|
|
66
|
+
TParams,
|
|
67
|
+
TError
|
|
68
|
+
> {
|
|
69
|
+
/**
|
|
70
|
+
* Include queries matching this query key
|
|
71
|
+
*/
|
|
72
|
+
queryKey: ServiceOperationBaseQueryKey<TSchema, TInfinite, TParams>;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Match query key exactly
|
|
76
|
+
*/
|
|
77
|
+
exact: true;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
interface QueryFiltersWeakExactQueryKey<
|
|
81
|
+
TSchema extends { url: string; method: string },
|
|
82
|
+
TData,
|
|
83
|
+
TInfinite extends boolean,
|
|
84
|
+
TParams = {},
|
|
85
|
+
TError = DefaultError,
|
|
86
|
+
> extends QueryFiltersByQueryKeyBase<
|
|
87
|
+
TSchema,
|
|
88
|
+
TData,
|
|
89
|
+
TInfinite,
|
|
90
|
+
TParams,
|
|
91
|
+
TError
|
|
92
|
+
> {
|
|
93
|
+
/**
|
|
94
|
+
* Include queries matching this query key
|
|
95
|
+
*/
|
|
96
|
+
queryKey?: ServiceOperationBaseQueryKey<
|
|
97
|
+
TSchema,
|
|
98
|
+
TInfinite,
|
|
99
|
+
PartialParameters<TParams>
|
|
100
|
+
>;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Match query key exactly
|
|
104
|
+
*/
|
|
105
|
+
exact?: false;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export type QueryFiltersByQueryKey<
|
|
109
|
+
TSchema extends { url: string; method: string },
|
|
110
|
+
TData,
|
|
111
|
+
TInfinite extends boolean,
|
|
112
|
+
TParams = {},
|
|
113
|
+
TError = DefaultError,
|
|
114
|
+
> =
|
|
115
|
+
| QueryFiltersByExactQueryKey<TSchema, TData, TInfinite, TParams, TError>
|
|
116
|
+
| QueryFiltersWeakExactQueryKey<TSchema, TData, TInfinite, TParams, TError>;
|
|
117
|
+
|
|
118
|
+
interface QueryFiltersByParametersBase<
|
|
119
|
+
TSchema extends { url: string; method: string },
|
|
120
|
+
TData,
|
|
121
|
+
TInfinite extends boolean,
|
|
122
|
+
TParams = {},
|
|
123
|
+
TError = DefaultError,
|
|
124
|
+
> extends QueryFiltersBase<TSchema, TData, TInfinite, TParams, TError> {
|
|
125
|
+
/**
|
|
126
|
+
* Is the query infinite
|
|
127
|
+
*/
|
|
128
|
+
infinite?: TInfinite;
|
|
129
|
+
|
|
130
|
+
queryKey?: never;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
interface QueryFiltersByExactParameters<
|
|
134
|
+
TSchema extends { url: string; method: string },
|
|
135
|
+
TData,
|
|
136
|
+
TInfinite extends boolean,
|
|
137
|
+
TParams = {},
|
|
138
|
+
TError = DefaultError,
|
|
139
|
+
> extends QueryFiltersByParametersBase<
|
|
140
|
+
TSchema,
|
|
141
|
+
TData,
|
|
142
|
+
TInfinite,
|
|
143
|
+
TParams,
|
|
144
|
+
TError
|
|
145
|
+
> {
|
|
146
|
+
/**
|
|
147
|
+
* Match query key exactly
|
|
148
|
+
*/
|
|
149
|
+
exact: true;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Include queries matching parameters
|
|
153
|
+
*/
|
|
154
|
+
parameters: TParams;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
interface QueryFiltersByWeakParameters<
|
|
158
|
+
TSchema extends { url: string; method: string },
|
|
159
|
+
TData,
|
|
160
|
+
TInfinite extends boolean,
|
|
161
|
+
TParams = {},
|
|
162
|
+
TError = DefaultError,
|
|
163
|
+
> extends QueryFiltersByParametersBase<
|
|
164
|
+
TSchema,
|
|
165
|
+
TData,
|
|
166
|
+
TInfinite,
|
|
167
|
+
TParams,
|
|
168
|
+
TError
|
|
169
|
+
> {
|
|
170
|
+
/**
|
|
171
|
+
* Match query key exactly
|
|
172
|
+
*/
|
|
173
|
+
exact?: false;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Include queries matching parameters
|
|
177
|
+
*/
|
|
178
|
+
parameters?: PartialParameters<TParams>;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export type QueryFiltersByParameters<
|
|
182
|
+
TSchema extends { url: string; method: string },
|
|
183
|
+
TData,
|
|
184
|
+
TInfinite extends boolean,
|
|
185
|
+
TParams = {},
|
|
186
|
+
TError = DefaultError,
|
|
187
|
+
> =
|
|
188
|
+
| QueryFiltersByExactParameters<TSchema, TData, TInfinite, TParams, TError>
|
|
189
|
+
| QueryFiltersByWeakParameters<TSchema, TData, TInfinite, TParams, TError>;
|
|
190
|
+
|
|
191
|
+
interface QueryFilterInfinitePredicate<
|
|
192
|
+
TSchema extends { url: string; method: string },
|
|
193
|
+
TData,
|
|
194
|
+
TParams = {},
|
|
195
|
+
TError = DefaultError,
|
|
196
|
+
> {
|
|
197
|
+
/**
|
|
198
|
+
* Include queries matching this predicate function
|
|
199
|
+
*/
|
|
200
|
+
(
|
|
201
|
+
query: Query<
|
|
202
|
+
OperationInfiniteData<TData, TParams>,
|
|
203
|
+
TError,
|
|
204
|
+
OperationInfiniteData<TData, TParams>,
|
|
205
|
+
ServiceOperationInfiniteQueryKey<TSchema, TParams>
|
|
206
|
+
>
|
|
207
|
+
): boolean;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
interface QueryFilterRegularPredicate<
|
|
211
|
+
TSchema extends { url: string; method: string },
|
|
212
|
+
TData,
|
|
213
|
+
TParams = {},
|
|
214
|
+
TError = DefaultError,
|
|
215
|
+
> {
|
|
216
|
+
/**
|
|
217
|
+
* Include queries matching this predicate function
|
|
218
|
+
*/
|
|
219
|
+
(
|
|
220
|
+
query: Query<
|
|
221
|
+
TData,
|
|
222
|
+
TError,
|
|
223
|
+
TData,
|
|
224
|
+
ServiceOperationQueryKey<TSchema, TParams>
|
|
225
|
+
>
|
|
226
|
+
): boolean;
|
|
227
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { DefaultError } from '@tanstack/query-core';
|
|
2
|
+
|
|
3
|
+
import type { ServiceOperationCancelQueries } from './ServiceOperationCancelQueries.js';
|
|
4
|
+
import type { ServiceOperationFetchInfiniteQuery } from './ServiceOperationFetchInfiniteQuery.js';
|
|
5
|
+
import type { ServiceOperationFetchQuery } from './ServiceOperationFetchQuery.js';
|
|
6
|
+
import type { ServiceOperationGetInfiniteQueryData } from './ServiceOperationGetInfiniteQueryData.js';
|
|
7
|
+
import type { ServiceOperationGetQueriesData } from './ServiceOperationGetQueriesData.js';
|
|
8
|
+
import type { ServiceOperationGetQueryData } from './ServiceOperationGetQueryData.js';
|
|
9
|
+
import type { ServiceOperationGetQueryState } from './ServiceOperationGetQueryState.js';
|
|
10
|
+
import type { ServiceOperationInvalidateQueries } from './ServiceOperationInvalidateQueries.js';
|
|
11
|
+
import type { ServiceOperationIsFetchingQueries } from './ServiceOperationIsFetchingQueries.js';
|
|
12
|
+
import type { ServiceOperationIsMutatingQueries } from './ServiceOperationIsMutatingQueries.js';
|
|
13
|
+
import type { ServiceOperationMutationFn } from './ServiceOperationMutationFn.js';
|
|
14
|
+
import type { ServiceOperationQueryFn } from './ServiceOperationQueryFn.js';
|
|
15
|
+
import type { ServiceOperationRefetchQueries } from './ServiceOperationRefetchQueries.js';
|
|
16
|
+
import type { ServiceOperationRemoveQueries } from './ServiceOperationRemoveQueries.js';
|
|
17
|
+
import type { ServiceOperationResetQueries } from './ServiceOperationResetQueries.js';
|
|
18
|
+
import type { ServiceOperationSetInfiniteQueryData } from './ServiceOperationSetInfiniteQueryData.js';
|
|
19
|
+
import type { ServiceOperationSetQueriesData } from './ServiceOperationSetQueriesData.js';
|
|
20
|
+
import type { ServiceOperationSetQueryData } from './ServiceOperationSetQueryData.js';
|
|
21
|
+
import type { ServiceOperationUseInfiniteQuery } from './ServiceOperationUseInfiniteQuery.js';
|
|
22
|
+
import type { ServiceOperationUseIsFetchingQueries } from './ServiceOperationUseIsFetchingQueries.js';
|
|
23
|
+
import type { ServiceOperationUseIsMutating } from './ServiceOperationUseIsMutating.js';
|
|
24
|
+
import type { ServiceOperationUseMutation } from './ServiceOperationUseMutation.js';
|
|
25
|
+
import type { ServiceOperationUseMutationState } from './ServiceOperationUseMutationState.js';
|
|
26
|
+
import type { ServiceOperationUseQueries } from './ServiceOperationUseQueries.js';
|
|
27
|
+
import type { ServiceOperationUseQuery } from './ServiceOperationUseQuery.js';
|
|
28
|
+
import type { ServiceOperationUseSuspenseInfiniteQuery } from './ServiceOperationUseSuspenseInfiniteQuery.js';
|
|
29
|
+
import type { ServiceOperationUseSuspenseQueries } from './ServiceOperationUseSuspenseQueries.js';
|
|
30
|
+
import type { ServiceOperationUseSuspenseQueryQuery } from './ServiceOperationUseSuspenseQueryQuery.js';
|
|
31
|
+
|
|
32
|
+
export interface ServiceOperationQuery<
|
|
33
|
+
TSchema extends { url: string; method: string },
|
|
34
|
+
TData,
|
|
35
|
+
TParams,
|
|
36
|
+
TError = DefaultError,
|
|
37
|
+
> extends ServiceOperationUseQuery<TSchema, TData, TParams, TError>,
|
|
38
|
+
ServiceOperationUseQueries<TSchema, TData, TParams, TError>,
|
|
39
|
+
ServiceOperationUseSuspenseQueries<TSchema, TData, TParams, TError>,
|
|
40
|
+
ServiceOperationUseInfiniteQuery<TSchema, TData, TParams, TError>,
|
|
41
|
+
ServiceOperationUseSuspenseQueryQuery<TSchema, TData, TParams, TError>,
|
|
42
|
+
ServiceOperationUseSuspenseInfiniteQuery<TSchema, TData, TParams, TError>,
|
|
43
|
+
ServiceOperationUseIsFetchingQueries<TSchema, TData, TParams, TError>,
|
|
44
|
+
ServiceOperationQueryFn<TSchema, TData, TParams>,
|
|
45
|
+
ServiceOperationFetchQuery<TSchema, TData, TParams, TError>,
|
|
46
|
+
ServiceOperationFetchInfiniteQuery<TSchema, TData, TParams, TError>,
|
|
47
|
+
ServiceOperationGetQueryData<TSchema, TData, TParams>,
|
|
48
|
+
ServiceOperationGetQueryState<TSchema, TData, TParams, TError>,
|
|
49
|
+
ServiceOperationGetQueriesData<TSchema, TData, TParams, TError>,
|
|
50
|
+
ServiceOperationGetInfiniteQueryData<TSchema, TData, TParams>,
|
|
51
|
+
ServiceOperationSetQueryData<TSchema, TData, TParams>,
|
|
52
|
+
ServiceOperationSetQueriesData<TSchema, TData, TParams, TError>,
|
|
53
|
+
ServiceOperationSetInfiniteQueryData<TSchema, TData, TParams>,
|
|
54
|
+
ServiceOperationInvalidateQueries<TSchema, TData, TParams, TError>,
|
|
55
|
+
ServiceOperationCancelQueries<TSchema, TData, TParams, TError>,
|
|
56
|
+
ServiceOperationRemoveQueries<TSchema, TData, TParams, TError>,
|
|
57
|
+
ServiceOperationResetQueries<TSchema, TData, TParams, TError>,
|
|
58
|
+
ServiceOperationRefetchQueries<TSchema, TData, TParams, TError>,
|
|
59
|
+
ServiceOperationIsFetchingQueries<TSchema, TData, TParams, TError> {
|
|
60
|
+
schema: TSchema;
|
|
61
|
+
types: {
|
|
62
|
+
parameters: TParams;
|
|
63
|
+
data: TData;
|
|
64
|
+
error: TError;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface ServiceOperationMutation<
|
|
69
|
+
TSchema extends { url: string; method: string },
|
|
70
|
+
TBody,
|
|
71
|
+
TData,
|
|
72
|
+
TParams,
|
|
73
|
+
TError = DefaultError,
|
|
74
|
+
> extends ServiceOperationUseMutation<TSchema, TBody, TData, TParams, TError>,
|
|
75
|
+
ServiceOperationUseIsMutating<TSchema, TBody, TData, TParams, TError>,
|
|
76
|
+
ServiceOperationUseMutationState<TSchema, TBody, TData, TParams, TError>,
|
|
77
|
+
ServiceOperationIsMutatingQueries<TSchema, TBody, TData, TParams, TError>,
|
|
78
|
+
ServiceOperationMutationFn<TSchema, TBody, TData, TParams> {
|
|
79
|
+
schema: TSchema;
|
|
80
|
+
types: {
|
|
81
|
+
parameters: TParams;
|
|
82
|
+
data: TData;
|
|
83
|
+
error: TError;
|
|
84
|
+
body: TBody;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CancelOptions,
|
|
3
|
+
DefaultError,
|
|
4
|
+
QueryClient,
|
|
5
|
+
} from '@tanstack/query-core';
|
|
6
|
+
|
|
7
|
+
import type {
|
|
8
|
+
QueryFiltersByParameters,
|
|
9
|
+
QueryFiltersByQueryKey,
|
|
10
|
+
} from './QueryFilters.js';
|
|
11
|
+
|
|
12
|
+
export interface ServiceOperationCancelQueries<
|
|
13
|
+
TSchema extends { url: string; method: string },
|
|
14
|
+
TData,
|
|
15
|
+
TParams = {},
|
|
16
|
+
TError = DefaultError,
|
|
17
|
+
> {
|
|
18
|
+
cancelQueries<TInfinite extends boolean>(
|
|
19
|
+
filters:
|
|
20
|
+
| QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError>
|
|
21
|
+
| QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>,
|
|
22
|
+
options: CancelOptions,
|
|
23
|
+
queryClient: QueryClient
|
|
24
|
+
): Promise<void>;
|
|
25
|
+
|
|
26
|
+
cancelQueries<TInfinite extends boolean>(
|
|
27
|
+
filters:
|
|
28
|
+
| QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError>
|
|
29
|
+
| QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>,
|
|
30
|
+
queryClient: QueryClient
|
|
31
|
+
): Promise<void>;
|
|
32
|
+
|
|
33
|
+
cancelQueries(queryClient: QueryClient): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
export interface ServiceOperationCancelQueriesCallback<
|
|
40
|
+
TSchema extends { url: string; method: string },
|
|
41
|
+
TData,
|
|
42
|
+
TParams = {},
|
|
43
|
+
TError = DefaultError,
|
|
44
|
+
> extends ServiceOperationCancelQueries<TSchema, TData, TParams, TError> {
|
|
45
|
+
cancelQueries<TInfinite extends boolean>(
|
|
46
|
+
filters:
|
|
47
|
+
| QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError>
|
|
48
|
+
| QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>
|
|
49
|
+
| QueryClient,
|
|
50
|
+
options?: CancelOptions | QueryClient,
|
|
51
|
+
queryClient?: QueryClient
|
|
52
|
+
): Promise<void>;
|
|
53
|
+
}
|