@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { callQueryClientMethodWithQueryFilters } from '../lib/callQueryClientMethodWithQueryFilters.js';
|
|
2
2
|
import type { OperationSchema } from '../lib/requestFn.js';
|
|
3
3
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
4
|
-
import { ServiceOperationCancelQueriesCallback } from '../
|
|
4
|
+
import type { ServiceOperationCancelQueriesCallback } from '../service-operation/ServiceOperationCancelQueries.js';
|
|
5
5
|
|
|
6
6
|
export function cancelQueries<TData>(
|
|
7
7
|
qraftOptions: QraftClientOptions | undefined,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { callQueryClientMethodWithQueryKey } from '../lib/callQueryClientFetchMethod.js';
|
|
2
2
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
3
|
-
import { ServiceOperationQuery } from '../ServiceOperation.js';
|
|
3
|
+
import { ServiceOperationQuery } from '../service-operation/ServiceOperation.js';
|
|
4
4
|
|
|
5
5
|
export const fetchInfiniteQuery: <
|
|
6
6
|
TSchema extends { url: string; method: 'get' | 'head' | 'options' },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { callQueryClientMethodWithQueryKey } from '../lib/callQueryClientFetchMethod.js';
|
|
2
2
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
3
|
-
import { ServiceOperationQuery } from '../ServiceOperation.js';
|
|
3
|
+
import { ServiceOperationQuery } from '../service-operation/ServiceOperation.js';
|
|
4
4
|
|
|
5
5
|
export const fetchQuery: <
|
|
6
6
|
TSchema extends { url: string; method: 'get' | 'head' | 'options' },
|
|
@@ -3,7 +3,7 @@ import type { InfiniteData } from '@tanstack/query-core';
|
|
|
3
3
|
import { callQueryClientMethodWithQueryKey } from '../lib/callQueryClientMethodWithQueryKey.js';
|
|
4
4
|
import type { OperationSchema } from '../lib/requestFn.js';
|
|
5
5
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
6
|
-
import type { ServiceOperationQuery } from '../ServiceOperation.js';
|
|
6
|
+
import type { ServiceOperationQuery } from '../service-operation/ServiceOperation.js';
|
|
7
7
|
|
|
8
8
|
export function getInfiniteQueryData<TData>(
|
|
9
9
|
_: QraftClientOptions | undefined,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { composeInfiniteQueryKey } from '../lib/composeInfiniteQueryKey.js';
|
|
2
2
|
import type { OperationSchema } from '../lib/requestFn.js';
|
|
3
3
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
4
|
-
import { ServiceOperationQuery } from '../ServiceOperation.js';
|
|
4
|
+
import { ServiceOperationQuery } from '../service-operation/ServiceOperation.js';
|
|
5
5
|
|
|
6
6
|
export const getInfiniteQueryKey = (
|
|
7
7
|
qraftOptions: QraftClientOptions | undefined,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { callQueryClientMethodWithQueryKey } from '../lib/callQueryClientMethodWithQueryKey.js';
|
|
2
2
|
import type { OperationSchema } from '../lib/requestFn.js';
|
|
3
3
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
4
|
-
import type { ServiceOperationQuery } from '../ServiceOperation.js';
|
|
4
|
+
import type { ServiceOperationQuery } from '../service-operation/ServiceOperation.js';
|
|
5
5
|
|
|
6
6
|
export function getInfiniteQueryState<TData>(
|
|
7
7
|
_: QraftClientOptions | undefined,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { composeMutationKey } from '../lib/composeMutationKey.js';
|
|
2
2
|
import type { OperationSchema } from '../lib/requestFn.js';
|
|
3
3
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
4
|
-
import { ServiceOperationMutation } from '../ServiceOperation.js';
|
|
4
|
+
import { ServiceOperationMutation } from '../service-operation/ServiceOperation.js';
|
|
5
5
|
|
|
6
6
|
export const getMutationKey = (
|
|
7
7
|
qraftOptions: QraftClientOptions | undefined,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { callQueryClientMethodWithQueryFilters } from '../lib/callQueryClientMethodWithQueryFilters.js';
|
|
2
2
|
import type { OperationSchema } from '../lib/requestFn.js';
|
|
3
3
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
4
|
-
import { ServiceOperationQuery } from '../ServiceOperation.js';
|
|
4
|
+
import { ServiceOperationQuery } from '../service-operation/ServiceOperation.js';
|
|
5
5
|
|
|
6
6
|
export function getQueriesData<TData>(
|
|
7
7
|
_: QraftClientOptions | undefined,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { callQueryClientMethodWithQueryKey } from '../lib/callQueryClientMethodWithQueryKey.js';
|
|
2
2
|
import type { OperationSchema } from '../lib/requestFn.js';
|
|
3
3
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
4
|
-
import type { ServiceOperationQuery } from '../ServiceOperation.js';
|
|
4
|
+
import type { ServiceOperationQuery } from '../service-operation/ServiceOperation.js';
|
|
5
5
|
|
|
6
6
|
export function getQueryData<TData>(
|
|
7
7
|
_: QraftClientOptions | undefined,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { composeQueryKey } from '../lib/composeQueryKey.js';
|
|
2
2
|
import type { OperationSchema } from '../lib/requestFn.js';
|
|
3
3
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
4
|
-
import { ServiceOperationQuery } from '../ServiceOperation.js';
|
|
4
|
+
import { ServiceOperationQuery } from '../service-operation/ServiceOperation.js';
|
|
5
5
|
|
|
6
6
|
export const getQueryKey = (
|
|
7
7
|
qraftOptions: QraftClientOptions | undefined,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { callQueryClientMethodWithQueryKey } from '../lib/callQueryClientMethodWithQueryKey.js';
|
|
2
2
|
import type { OperationSchema } from '../lib/requestFn.js';
|
|
3
3
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
4
|
-
import type { ServiceOperationQuery } from '../ServiceOperation.js';
|
|
4
|
+
import type { ServiceOperationQuery } from '../service-operation/ServiceOperation.js';
|
|
5
5
|
|
|
6
6
|
export function getQueryState<TData>(
|
|
7
7
|
_: QraftClientOptions | undefined,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { callQueryClientMethodWithQueryFilters } from '../lib/callQueryClientMethodWithQueryFilters.js';
|
|
2
2
|
import type { OperationSchema } from '../lib/requestFn.js';
|
|
3
3
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
4
|
-
import type { ServiceOperationInvalidateQueriesCallback } from '../
|
|
4
|
+
import type { ServiceOperationInvalidateQueriesCallback } from '../service-operation/ServiceOperationInvalidateQueries.js';
|
|
5
5
|
|
|
6
6
|
export function invalidateQueries<TData>(
|
|
7
7
|
qraftOptions: QraftClientOptions | undefined,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { callQueryClientMethodWithQueryFilters } from '../lib/callQueryClientMethodWithQueryFilters.js';
|
|
2
2
|
import type { OperationSchema } from '../lib/requestFn.js';
|
|
3
3
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
4
|
-
import { ServiceOperationIsFetchingQueriesCallback } from '../
|
|
4
|
+
import type { ServiceOperationIsFetchingQueriesCallback } from '../service-operation/ServiceOperationIsFetchingQueries.js';
|
|
5
5
|
|
|
6
6
|
export function isFetching<TData>(
|
|
7
7
|
qraftOptions: QraftClientOptions | undefined,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { callQueryClientMethodWithMutationFilters } from '../lib/callQueryClientMethodWithMutationFilters.js';
|
|
2
2
|
import type { OperationSchema } from '../lib/requestFn.js';
|
|
3
3
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
4
|
-
import { ServiceOperationIsMutatingQueriesCallback } from '../
|
|
4
|
+
import type { ServiceOperationIsMutatingQueriesCallback } from '../service-operation/ServiceOperationIsMutatingQueries.js';
|
|
5
5
|
|
|
6
6
|
export function isMutating<TData>(
|
|
7
7
|
_: QraftClientOptions | undefined,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { OperationSchema } from '../lib/requestFn.js';
|
|
2
2
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
3
|
-
import { ServiceOperationMutation } from '../ServiceOperation.js';
|
|
3
|
+
import { ServiceOperationMutation } from '../service-operation/ServiceOperation.js';
|
|
4
4
|
|
|
5
5
|
export const mutationFn = (
|
|
6
6
|
qraftOptions: QraftClientOptions | undefined,
|
|
@@ -16,7 +16,7 @@ export const mutationFn = (
|
|
|
16
16
|
>['mutationFn']
|
|
17
17
|
>;
|
|
18
18
|
return client(schema, {
|
|
19
|
-
parameters: options
|
|
20
|
-
body: options
|
|
19
|
+
parameters: options?.parameters,
|
|
20
|
+
body: options?.body,
|
|
21
21
|
});
|
|
22
22
|
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { OperationSchema } from '../lib/requestFn.js';
|
|
2
|
+
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
3
|
+
import { ServiceOperationMutationFn } from '../service-operation/ServiceOperationMutationFn.js';
|
|
4
|
+
import { ServiceOperationQueryFn } from '../service-operation/ServiceOperationQueryFn.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Called when <service>.<operation>(...) is invoked.
|
|
8
|
+
*/
|
|
9
|
+
export const operationInvokeFn: <
|
|
10
|
+
TSchema extends OperationSchema,
|
|
11
|
+
TBody,
|
|
12
|
+
TData,
|
|
13
|
+
TParams,
|
|
14
|
+
>(
|
|
15
|
+
qraftOptions: QraftClientOptions | undefined,
|
|
16
|
+
schema: TSchema,
|
|
17
|
+
args:
|
|
18
|
+
| Parameters<ServiceOperationQueryFn<TSchema, TData, TParams>>
|
|
19
|
+
| Parameters<ServiceOperationMutationFn<TSchema, TBody, TData, TParams>>
|
|
20
|
+
) => Promise<TData> = (_, schema, args) => {
|
|
21
|
+
const queryOperationMethods = ['get', 'head', 'options'] as const; // todo::make it shared
|
|
22
|
+
|
|
23
|
+
const isQueryOperationType = queryOperationMethods.includes(
|
|
24
|
+
schema.method as (typeof queryOperationMethods)[number]
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const [options, client] = args;
|
|
28
|
+
|
|
29
|
+
const invokeSchema =
|
|
30
|
+
isQueryOperationType && 'queryKey' in options
|
|
31
|
+
? options.queryKey![0]
|
|
32
|
+
: schema;
|
|
33
|
+
|
|
34
|
+
const invokeParameters =
|
|
35
|
+
isQueryOperationType && 'queryKey' in options
|
|
36
|
+
? options.queryKey![1]
|
|
37
|
+
: 'parameters' in options
|
|
38
|
+
? options.parameters
|
|
39
|
+
: undefined;
|
|
40
|
+
|
|
41
|
+
return client(invokeSchema, {
|
|
42
|
+
...options,
|
|
43
|
+
parameters: invokeParameters,
|
|
44
|
+
} as never);
|
|
45
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { callQueryClientMethodWithQueryKey } from '../lib/callQueryClientFetchMethod.js';
|
|
2
2
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
3
|
-
import { ServiceOperationQuery } from '../ServiceOperation.js';
|
|
3
|
+
import { ServiceOperationQuery } from '../service-operation/ServiceOperation.js';
|
|
4
4
|
|
|
5
5
|
export const prefetchInfiniteQuery: <
|
|
6
6
|
TSchema extends { url: string; method: 'get' | 'head' | 'options' },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { callQueryClientMethodWithQueryKey } from '../lib/callQueryClientFetchMethod.js';
|
|
2
2
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
3
|
-
import { ServiceOperationQuery } from '../ServiceOperation.js';
|
|
3
|
+
import { ServiceOperationQuery } from '../service-operation/ServiceOperation.js';
|
|
4
4
|
|
|
5
5
|
export const prefetchQuery: <
|
|
6
6
|
TSchema extends { url: string; method: 'get' | 'head' | 'options' },
|
package/src/callbacks/queryFn.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
2
|
-
import { ServiceOperationQuery } from '../ServiceOperation.js';
|
|
2
|
+
import { ServiceOperationQuery } from '../service-operation/ServiceOperation.js';
|
|
3
3
|
|
|
4
4
|
export const queryFn: <
|
|
5
5
|
TSchema extends { url: string; method: 'get' | 'head' | 'options' },
|
|
@@ -12,10 +12,15 @@ export const queryFn: <
|
|
|
12
12
|
) => Promise<TData> = (_, schema, args) => {
|
|
13
13
|
const [options, client] = args;
|
|
14
14
|
|
|
15
|
-
return client(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
return client(
|
|
16
|
+
options && 'queryKey' in options ? options.queryKey![0] : schema,
|
|
17
|
+
{
|
|
18
|
+
parameters:
|
|
19
|
+
options && 'queryKey' in options
|
|
20
|
+
? options.queryKey![1]
|
|
21
|
+
: options.parameters,
|
|
22
|
+
meta: options.meta,
|
|
23
|
+
signal: options.signal,
|
|
24
|
+
}
|
|
25
|
+
) as Promise<never>;
|
|
21
26
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { callQueryClientMethodWithQueryFilters } from '../lib/callQueryClientMethodWithQueryFilters.js';
|
|
2
2
|
import type { OperationSchema } from '../lib/requestFn.js';
|
|
3
3
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ServiceOperationRefetchQueriesCallback } from '../service-operation/ServiceOperationRefetchQueries.js';
|
|
5
5
|
|
|
6
6
|
export function refetchQueries<TData>(
|
|
7
7
|
qraftOptions: QraftClientOptions | undefined,
|
|
8
8
|
schema: OperationSchema,
|
|
9
9
|
args: Parameters<
|
|
10
|
-
|
|
10
|
+
ServiceOperationRefetchQueriesCallback<
|
|
11
11
|
OperationSchema,
|
|
12
12
|
unknown,
|
|
13
13
|
TData
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { callQueryClientMethodWithQueryFilters } from '../lib/callQueryClientMethodWithQueryFilters.js';
|
|
2
2
|
import type { OperationSchema } from '../lib/requestFn.js';
|
|
3
3
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
4
|
-
import { ServiceOperationRemoveQueriesCallback } from '../
|
|
4
|
+
import type { ServiceOperationRemoveQueriesCallback } from '../service-operation/ServiceOperationRemoveQueries.js';
|
|
5
5
|
|
|
6
6
|
export function removeQueries<TData>(
|
|
7
7
|
_: QraftClientOptions | undefined,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { callQueryClientMethodWithQueryFilters } from '../lib/callQueryClientMethodWithQueryFilters.js';
|
|
2
2
|
import type { OperationSchema } from '../lib/requestFn.js';
|
|
3
3
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
4
|
-
import type { ServiceOperationResetQueriesCallback } from '../
|
|
4
|
+
import type { ServiceOperationResetQueriesCallback } from '../service-operation/ServiceOperationResetQueries.js';
|
|
5
5
|
|
|
6
6
|
export function resetQueries<TData>(
|
|
7
7
|
qraftOptions: QraftClientOptions | undefined,
|
|
@@ -3,7 +3,7 @@ import { InfiniteData } from '@tanstack/query-core';
|
|
|
3
3
|
import { callQueryClientMethodWithQueryKey } from '../lib/callQueryClientMethodWithQueryKey.js';
|
|
4
4
|
import type { OperationSchema } from '../lib/requestFn.js';
|
|
5
5
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
6
|
-
import type { ServiceOperationQuery } from '../ServiceOperation.js';
|
|
6
|
+
import type { ServiceOperationQuery } from '../service-operation/ServiceOperation.js';
|
|
7
7
|
|
|
8
8
|
export function setInfiniteQueryData<TData>(
|
|
9
9
|
qraftOptions: QraftClientOptions | undefined,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { callQueryClientMethodWithQueryFilters } from '../lib/callQueryClientMethodWithQueryFilters.js';
|
|
2
2
|
import type { OperationSchema } from '../lib/requestFn.js';
|
|
3
3
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
4
|
-
import type { ServiceOperationSetQueriesDataCallback } from '../
|
|
4
|
+
import type { ServiceOperationSetQueriesDataCallback } from '../service-operation/ServiceOperationSetQueriesData.js';
|
|
5
5
|
|
|
6
6
|
export function setQueriesData<TData>(
|
|
7
7
|
_: QraftClientOptions | undefined,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { callQueryClientMethodWithQueryKey } from '../lib/callQueryClientMethodWithQueryKey.js';
|
|
2
2
|
import type { OperationSchema } from '../lib/requestFn.js';
|
|
3
3
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
4
|
-
import type { ServiceOperationSetQueryDataCallback } from '../
|
|
4
|
+
import type { ServiceOperationSetQueryDataCallback } from '../service-operation/ServiceOperationSetQueryData.js';
|
|
5
5
|
|
|
6
6
|
export function setQueryData<TData>(
|
|
7
7
|
_: QraftClientOptions | undefined,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import type { OperationSchema } from '../lib/requestFn.js';
|
|
10
10
|
import { useComposeUseQueryOptions } from '../lib/useComposeUseQueryOptions.js';
|
|
11
11
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
12
|
-
import type { ServiceOperationQuery } from '../ServiceOperation.js';
|
|
12
|
+
import type { ServiceOperationQuery } from '../service-operation/ServiceOperation.js';
|
|
13
13
|
|
|
14
14
|
export const useInfiniteQuery: <
|
|
15
15
|
TQueryFnData,
|
|
@@ -23,7 +23,7 @@ export const useInfiniteQuery: <
|
|
|
23
23
|
>
|
|
24
24
|
) => UseInfiniteQueryResult<TData, TError> = (qraftOptions, schema, args) => {
|
|
25
25
|
return useInfiniteQueryBase(
|
|
26
|
-
// @ts-expect-error
|
|
26
|
+
// @ts-expect-error - Too complex to type...
|
|
27
27
|
...useComposeUseQueryOptions(qraftOptions, schema, args, true)
|
|
28
28
|
) as never;
|
|
29
29
|
};
|
|
@@ -6,7 +6,7 @@ import { composeQueryFilters } from '../lib/composeQueryFilters.js';
|
|
|
6
6
|
import type { OperationSchema } from '../lib/requestFn.js';
|
|
7
7
|
import { useQueryClient } from '../lib/useQueryClient.js';
|
|
8
8
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
9
|
-
import type { ServiceOperationQuery } from '../ServiceOperation.js';
|
|
9
|
+
import type { ServiceOperationQuery } from '../service-operation/ServiceOperation.js';
|
|
10
10
|
|
|
11
11
|
export const useIsFetching: <TVariables = unknown>(
|
|
12
12
|
qraftOptions: QraftClientOptions | undefined,
|
|
@@ -10,7 +10,7 @@ import { composeMutationFilters } from '../lib/composeMutationFilters.js';
|
|
|
10
10
|
import type { OperationSchema } from '../lib/requestFn.js';
|
|
11
11
|
import { useQueryClient } from '../lib/useQueryClient.js';
|
|
12
12
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
13
|
-
import { ServiceOperationMutation } from '../ServiceOperation.js';
|
|
13
|
+
import { ServiceOperationMutation } from '../service-operation/ServiceOperation.js';
|
|
14
14
|
|
|
15
15
|
export const useIsMutating: <
|
|
16
16
|
TData = unknown,
|
|
@@ -13,10 +13,8 @@ import type { OperationSchema } from '../lib/requestFn.js';
|
|
|
13
13
|
import { useQueryClient } from '../lib/useQueryClient.js';
|
|
14
14
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
15
15
|
import { QraftContext } from '../QraftContext.js';
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
ServiceOperationMutationKey,
|
|
19
|
-
} from '../ServiceOperation.js';
|
|
16
|
+
import type { ServiceOperationMutation } from '../service-operation/ServiceOperation.js';
|
|
17
|
+
import type { ServiceOperationMutationKey } from '../service-operation/ServiceOperationKey.js';
|
|
20
18
|
|
|
21
19
|
export const useMutation: <
|
|
22
20
|
TData = unknown,
|
|
@@ -10,7 +10,7 @@ import { composeMutationFilters } from '../lib/composeMutationFilters.js';
|
|
|
10
10
|
import type { OperationSchema } from '../lib/requestFn.js';
|
|
11
11
|
import { useQueryClient } from '../lib/useQueryClient.js';
|
|
12
12
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
13
|
-
import { ServiceOperationMutation } from '../ServiceOperation.js';
|
|
13
|
+
import { ServiceOperationMutation } from '../service-operation/ServiceOperation.js';
|
|
14
14
|
|
|
15
15
|
export const useMutationState: <
|
|
16
16
|
TData = unknown,
|
|
@@ -12,7 +12,7 @@ import type { OperationSchema } from '../lib/requestFn.js';
|
|
|
12
12
|
import { useQueryClient } from '../lib/useQueryClient.js';
|
|
13
13
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
14
14
|
import { QraftContext } from '../QraftContext.js';
|
|
15
|
-
import { ServiceOperationQuery } from '../ServiceOperation.js';
|
|
15
|
+
import { ServiceOperationQuery } from '../service-operation/ServiceOperation.js';
|
|
16
16
|
|
|
17
17
|
export const useQueries: (
|
|
18
18
|
qraftOptions: QraftClientOptions | undefined,
|
|
@@ -40,7 +40,7 @@ export const useQueries: (
|
|
|
40
40
|
},
|
|
41
41
|
queryOptions
|
|
42
42
|
);
|
|
43
|
-
// @ts-expect-error
|
|
43
|
+
// @ts-expect-error - `parameters` is not inferred as a property of `queryOptionsCopy`
|
|
44
44
|
delete queryOptionsCopy.parameters;
|
|
45
45
|
return queryOptionsCopy;
|
|
46
46
|
})()
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import type { OperationSchema } from '../lib/requestFn.js';
|
|
10
10
|
import { useComposeUseQueryOptions } from '../lib/useComposeUseQueryOptions.js';
|
|
11
11
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
12
|
-
import type { ServiceOperationQuery } from '../ServiceOperation.js';
|
|
12
|
+
import type { ServiceOperationQuery } from '../service-operation/ServiceOperation.js';
|
|
13
13
|
|
|
14
14
|
export const useQuery: <TData = unknown, TError = DefaultError>(
|
|
15
15
|
qraftOptions: QraftClientOptions | undefined,
|
|
@@ -19,7 +19,7 @@ export const useQuery: <TData = unknown, TError = DefaultError>(
|
|
|
19
19
|
>
|
|
20
20
|
) => UseQueryResult<TData, TError> = (qraftOptions, schema, args) => {
|
|
21
21
|
return useQueryTanstack(
|
|
22
|
-
// @ts-expect-error
|
|
22
|
+
// @ts-expect-error - Too complex to type
|
|
23
23
|
...useComposeUseQueryOptions(qraftOptions, schema, args, false)
|
|
24
24
|
) as never;
|
|
25
25
|
};
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import type { OperationSchema } from '../lib/requestFn.js';
|
|
10
10
|
import { useComposeUseQueryOptions } from '../lib/useComposeUseQueryOptions.js';
|
|
11
11
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
12
|
-
import type { ServiceOperationQuery } from '../ServiceOperation.js';
|
|
12
|
+
import type { ServiceOperationQuery } from '../service-operation/ServiceOperation.js';
|
|
13
13
|
|
|
14
14
|
export const useSuspenseInfiniteQuery: <
|
|
15
15
|
TQueryFnData,
|
|
@@ -31,7 +31,7 @@ export const useSuspenseInfiniteQuery: <
|
|
|
31
31
|
args
|
|
32
32
|
) => {
|
|
33
33
|
return useSuspenseInfiniteQueryTanstack(
|
|
34
|
-
// @ts-expect-error
|
|
34
|
+
// @ts-expect-error - Too complex to type
|
|
35
35
|
...useComposeUseQueryOptions(qraftOptions, schema, args, true)
|
|
36
36
|
) as never;
|
|
37
37
|
};
|
|
@@ -12,7 +12,7 @@ import type { OperationSchema } from '../lib/requestFn.js';
|
|
|
12
12
|
import { useQueryClient } from '../lib/useQueryClient.js';
|
|
13
13
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
14
14
|
import { QraftContext } from '../QraftContext.js';
|
|
15
|
-
import { ServiceOperationQuery } from '../ServiceOperation.js';
|
|
15
|
+
import { ServiceOperationQuery } from '../service-operation/ServiceOperation.js';
|
|
16
16
|
|
|
17
17
|
export const useSuspenseQueries: (
|
|
18
18
|
qraftOptions: QraftClientOptions | undefined,
|
|
@@ -44,7 +44,7 @@ export const useSuspenseQueries: (
|
|
|
44
44
|
},
|
|
45
45
|
queryOptions
|
|
46
46
|
);
|
|
47
|
-
// @ts-expect-error
|
|
47
|
+
// @ts-expect-error - `parameters` is not inferred as a property of `queryOptionsCopy`
|
|
48
48
|
delete queryOptionsCopy.parameters;
|
|
49
49
|
return queryOptionsCopy;
|
|
50
50
|
})()
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import type { OperationSchema } from '../lib/requestFn.js';
|
|
10
10
|
import { useComposeUseQueryOptions } from '../lib/useComposeUseQueryOptions.js';
|
|
11
11
|
import type { QraftClientOptions } from '../qraftAPIClient.js';
|
|
12
|
-
import type { ServiceOperationQuery } from '../ServiceOperation.js';
|
|
12
|
+
import type { ServiceOperationQuery } from '../service-operation/ServiceOperation.js';
|
|
13
13
|
|
|
14
14
|
export const useSuspenseQuery: <
|
|
15
15
|
TQueryFnData = unknown,
|
|
@@ -23,7 +23,7 @@ export const useSuspenseQuery: <
|
|
|
23
23
|
>
|
|
24
24
|
) => UseQueryResult<TData, TError> = (qraftOptions, schema, args) => {
|
|
25
25
|
return useSuspenseQueryTanstack(
|
|
26
|
-
// @ts-expect-error
|
|
26
|
+
// @ts-expect-error - Too complex to type
|
|
27
27
|
...useComposeUseQueryOptions(qraftOptions, schema, args, false)
|
|
28
28
|
) as never;
|
|
29
29
|
};
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shallow partial 'parameters'.
|
|
3
|
+
* @example
|
|
4
|
+
* ```ts
|
|
5
|
+
* {query?: {page: number, nested: {still: 'not_partial'}}}
|
|
6
|
+
* // =>
|
|
7
|
+
* {query?: {page?: number, nested?: {still: 'not_partial'}}}
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
10
|
+
export type PartialParameters<T> = T extends object
|
|
11
|
+
? { [K in keyof T]?: T[K] extends object ? Partial<T[K]> : T[K] }
|
|
12
|
+
: T;
|
|
@@ -40,7 +40,7 @@ export function callQueryClientMethodWithQueryKey<
|
|
|
40
40
|
const queryFn =
|
|
41
41
|
options.queryFn ??
|
|
42
42
|
(requestFn
|
|
43
|
-
? // @ts-expect-error
|
|
43
|
+
? // @ts-expect-error - Not inferring the correct type for `queryFn`
|
|
44
44
|
function ({ queryKey: [, queryParams], signal, meta, pageParam }) {
|
|
45
45
|
return requestFn(schema, {
|
|
46
46
|
parameters: infinite
|
|
@@ -54,7 +54,7 @@ export function callQueryClientMethodWithQueryKey<
|
|
|
54
54
|
: undefined);
|
|
55
55
|
|
|
56
56
|
if (parameters) {
|
|
57
|
-
// @ts-expect-error
|
|
57
|
+
// @ts-expect-error - Too complex union to type
|
|
58
58
|
return queryClient[queryFilterMethod]({
|
|
59
59
|
...options,
|
|
60
60
|
// Event if queryFn is undefined, it will override the default queryFn from `setQueryDefaults(...)`
|
|
@@ -65,7 +65,7 @@ export function callQueryClientMethodWithQueryKey<
|
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
// @ts-expect-error
|
|
68
|
+
// @ts-expect-error - Too complex union to type
|
|
69
69
|
return queryClient[queryFilterMethod]({ ...options, queryFn });
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -23,10 +23,10 @@ export function callQueryClientMethodWithMutationFilters<
|
|
|
23
23
|
`queryClient is invalid, ${queryFilterMethod} method does not exist`
|
|
24
24
|
);
|
|
25
25
|
|
|
26
|
-
// @ts-expect-error
|
|
26
|
+
// @ts-expect-error - Too complex to type
|
|
27
27
|
return queryClient[queryFilterMethod](
|
|
28
28
|
composeMutationFilters(schema, filters as never),
|
|
29
|
-
// @ts-expect-error
|
|
29
|
+
// @ts-expect-error - Argument types are too complex
|
|
30
30
|
...args.slice(1, -1)
|
|
31
31
|
);
|
|
32
32
|
}
|
|
@@ -23,10 +23,10 @@ export function callQueryClientMethodWithQueryFilters<
|
|
|
23
23
|
`queryClient is invalid, ${queryFilterMethod} method does not exist`
|
|
24
24
|
);
|
|
25
25
|
|
|
26
|
-
// @ts-expect-error
|
|
26
|
+
// @ts-expect-error - Too complex to type
|
|
27
27
|
return queryClient[queryFilterMethod](
|
|
28
28
|
composeQueryFilters(schema, filters as never),
|
|
29
|
-
// @ts-expect-error
|
|
29
|
+
// @ts-expect-error - Argument types are too complex
|
|
30
30
|
...args.slice(1, -1)
|
|
31
31
|
);
|
|
32
32
|
}
|
|
@@ -31,7 +31,7 @@ export function callQueryClientMethodWithQueryKey<
|
|
|
31
31
|
? composeInfiniteQueryKey(schema, parameters)
|
|
32
32
|
: composeQueryKey(schema, parameters);
|
|
33
33
|
|
|
34
|
-
// @ts-expect-error
|
|
34
|
+
// @ts-expect-error - Too complex to type
|
|
35
35
|
return queryClient[queryFilterMethod](queryKey, ...args.slice(1, -1));
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
2
|
ServiceOperationInfiniteQueryKey,
|
|
3
3
|
ServiceOperationQueryKey,
|
|
4
|
-
} from '../
|
|
4
|
+
} from '../service-operation/ServiceOperationKey.js';
|
|
5
5
|
import type { OperationSchema } from './requestFn.js';
|
|
6
6
|
|
|
7
7
|
export function composeBaseQueryKey<TSchema extends OperationSchema, TParams>(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ServiceOperationInfiniteQueryKey } from '../
|
|
1
|
+
import type { ServiceOperationInfiniteQueryKey } from '../service-operation/ServiceOperationKey.js';
|
|
2
2
|
import { composeBaseQueryKey } from './composeBaseQueryKey.js';
|
|
3
3
|
import type { OperationSchema } from './requestFn.js';
|
|
4
4
|
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import type { ServiceOperationMutationKey } from '../
|
|
1
|
+
import type { ServiceOperationMutationKey } from '../service-operation/ServiceOperationKey.js';
|
|
2
2
|
import type { OperationSchema } from './requestFn.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Omit `body` or `requestBody` from mutation parameters if exists
|
|
6
6
|
* and return the rest of the parameters
|
|
7
7
|
*/
|
|
8
|
-
export function composeMutationKey<
|
|
9
|
-
TSchema extends OperationSchema,
|
|
10
|
-
TParams = undefined,
|
|
11
|
-
>(
|
|
8
|
+
export function composeMutationKey<TSchema extends OperationSchema>(
|
|
12
9
|
schema: TSchema,
|
|
13
10
|
parameters: undefined
|
|
14
11
|
): ServiceOperationMutationKey<TSchema, undefined>;
|
|
@@ -36,10 +33,11 @@ export function omitMutationPayload<T>(params: T) {
|
|
|
36
33
|
throw new Error('`params` must be object');
|
|
37
34
|
|
|
38
35
|
if ('body' in params || 'requestBody' in params) {
|
|
39
|
-
const {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
const {
|
|
37
|
+
body: _,
|
|
38
|
+
requestBody: __,
|
|
39
|
+
...paramsRest
|
|
40
|
+
} = params as Record<'body' | 'requestBody', unknown>;
|
|
43
41
|
return paramsRest;
|
|
44
42
|
}
|
|
45
43
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ServiceOperationQueryKey } from '../
|
|
1
|
+
import type { ServiceOperationQueryKey } from '../service-operation/ServiceOperationKey.js';
|
|
2
2
|
import { composeBaseQueryKey } from './composeBaseQueryKey.js';
|
|
3
3
|
import type { OperationSchema } from './requestFn.js';
|
|
4
4
|
|