@openapi-qraft/react 2.0.0-next.0 → 2.0.0-next.10
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 +73 -1
- package/README.md +3 -6
- package/dist/cjs/callbacks/cancelQueries.cjs.map +1 -1
- package/dist/cjs/callbacks/fetchInfiniteQuery.cjs.map +1 -1
- package/dist/cjs/callbacks/fetchQuery.cjs.map +1 -1
- package/dist/cjs/callbacks/getInfiniteQueryData.cjs.map +1 -1
- package/dist/cjs/callbacks/getInfiniteQueryKey.cjs.map +1 -1
- package/dist/cjs/callbacks/getInfiniteQueryState.cjs.map +1 -1
- package/dist/cjs/callbacks/getMutationKey.cjs.map +1 -1
- package/dist/cjs/callbacks/getQueriesData.cjs.map +1 -1
- package/dist/cjs/callbacks/getQueryData.cjs.map +1 -1
- package/dist/cjs/callbacks/getQueryKey.cjs.map +1 -1
- package/dist/cjs/callbacks/getQueryState.cjs.map +1 -1
- package/dist/cjs/callbacks/invalidateQueries.cjs.map +1 -1
- package/dist/cjs/callbacks/isFetching.cjs.map +1 -1
- package/dist/cjs/callbacks/isMutating.cjs.map +1 -1
- package/dist/cjs/callbacks/operationInvokeFn.cjs.map +1 -1
- package/dist/cjs/callbacks/prefetchInfiniteQuery.cjs.map +1 -1
- package/dist/cjs/callbacks/prefetchQuery.cjs.map +1 -1
- package/dist/cjs/callbacks/refetchQueries.cjs.map +1 -1
- package/dist/cjs/callbacks/removeQueries.cjs.map +1 -1
- package/dist/cjs/callbacks/resetQueries.cjs.map +1 -1
- package/dist/cjs/callbacks/setInfiniteQueryData.cjs.map +1 -1
- package/dist/cjs/callbacks/setQueriesData.cjs.map +1 -1
- package/dist/cjs/callbacks/setQueryData.cjs.map +1 -1
- package/dist/cjs/callbacks/useInfiniteQuery.cjs.map +1 -1
- package/dist/cjs/callbacks/useIsFetching.cjs.map +1 -1
- package/dist/cjs/callbacks/useIsMutating.cjs.map +1 -1
- package/dist/cjs/callbacks/useMutation.cjs.map +1 -1
- package/dist/cjs/callbacks/useMutationState.cjs.map +1 -1
- package/dist/cjs/callbacks/useQueries.cjs +1 -0
- package/dist/cjs/callbacks/useQueries.cjs.map +1 -1
- package/dist/cjs/callbacks/useQuery.cjs.map +1 -1
- package/dist/cjs/callbacks/useSuspenseInfiniteQuery.cjs.map +1 -1
- package/dist/cjs/callbacks/useSuspenseQueries.cjs +1 -0
- package/dist/cjs/callbacks/useSuspenseQueries.cjs.map +1 -1
- package/dist/cjs/callbacks/useSuspenseQuery.cjs.map +1 -1
- package/dist/cjs/lib/callQueryClientFetchMethod.cjs +2 -3
- package/dist/cjs/lib/callQueryClientFetchMethod.cjs.map +1 -1
- package/dist/cjs/lib/composeBaseQueryKey.cjs.map +1 -1
- package/dist/cjs/lib/composeInfiniteQueryKey.cjs.map +1 -1
- package/dist/cjs/lib/composeMutationKey.cjs.map +1 -1
- package/dist/cjs/lib/composeQueryKey.cjs.map +1 -1
- package/dist/cjs/lib/requestFn.cjs.map +1 -1
- package/dist/cjs/lib/useComposeUseQueryOptions.cjs +1 -2
- package/dist/cjs/lib/useComposeUseQueryOptions.cjs.map +1 -1
- package/dist/cjs/qraftAPIClient.cjs +1 -1
- package/dist/cjs/qraftAPIClient.cjs.map +1 -1
- package/dist/cjs/qraftPredefinedParametersRequestFn.cjs +39 -0
- package/dist/cjs/qraftPredefinedParametersRequestFn.cjs.map +1 -0
- package/dist/esm/callbacks/cancelQueries.js.map +1 -1
- package/dist/esm/callbacks/fetchInfiniteQuery.js.map +1 -1
- package/dist/esm/callbacks/fetchQuery.js.map +1 -1
- package/dist/esm/callbacks/getInfiniteQueryData.js.map +1 -1
- package/dist/esm/callbacks/getInfiniteQueryKey.js.map +1 -1
- package/dist/esm/callbacks/getInfiniteQueryState.js.map +1 -1
- package/dist/esm/callbacks/getMutationKey.js.map +1 -1
- package/dist/esm/callbacks/getQueriesData.js.map +1 -1
- package/dist/esm/callbacks/getQueryData.js.map +1 -1
- package/dist/esm/callbacks/getQueryKey.js.map +1 -1
- package/dist/esm/callbacks/getQueryState.js.map +1 -1
- package/dist/esm/callbacks/invalidateQueries.js.map +1 -1
- package/dist/esm/callbacks/isFetching.js.map +1 -1
- package/dist/esm/callbacks/isMutating.js.map +1 -1
- package/dist/esm/callbacks/operationInvokeFn.js.map +1 -1
- package/dist/esm/callbacks/prefetchInfiniteQuery.js.map +1 -1
- package/dist/esm/callbacks/prefetchQuery.js.map +1 -1
- package/dist/esm/callbacks/refetchQueries.js.map +1 -1
- package/dist/esm/callbacks/removeQueries.js.map +1 -1
- package/dist/esm/callbacks/resetQueries.js.map +1 -1
- package/dist/esm/callbacks/setInfiniteQueryData.js.map +1 -1
- package/dist/esm/callbacks/setQueriesData.js.map +1 -1
- package/dist/esm/callbacks/setQueryData.js.map +1 -1
- package/dist/esm/callbacks/useInfiniteQuery.js.map +1 -1
- package/dist/esm/callbacks/useIsFetching.js.map +1 -1
- package/dist/esm/callbacks/useIsMutating.js.map +1 -1
- package/dist/esm/callbacks/useMutation.js.map +1 -1
- package/dist/esm/callbacks/useMutationState.js.map +1 -1
- package/dist/esm/callbacks/useQueries.js +1 -0
- package/dist/esm/callbacks/useQueries.js.map +1 -1
- package/dist/esm/callbacks/useQuery.js.map +1 -1
- package/dist/esm/callbacks/useSuspenseInfiniteQuery.js.map +1 -1
- package/dist/esm/callbacks/useSuspenseQueries.js +1 -0
- package/dist/esm/callbacks/useSuspenseQueries.js.map +1 -1
- package/dist/esm/callbacks/useSuspenseQuery.js.map +1 -1
- package/dist/esm/lib/callQueryClientFetchMethod.js +2 -3
- package/dist/esm/lib/callQueryClientFetchMethod.js.map +1 -1
- package/dist/esm/lib/composeBaseQueryKey.js.map +1 -1
- package/dist/esm/lib/composeInfiniteQueryKey.js.map +1 -1
- package/dist/esm/lib/composeMutationKey.js.map +1 -1
- package/dist/esm/lib/composeQueryKey.js.map +1 -1
- package/dist/esm/lib/requestFn.js.map +1 -1
- package/dist/esm/lib/useComposeUseQueryOptions.js +1 -2
- package/dist/esm/lib/useComposeUseQueryOptions.js.map +1 -1
- package/dist/esm/qraftAPIClient.js +1 -1
- package/dist/esm/qraftAPIClient.js.map +1 -1
- package/dist/esm/qraftPredefinedParametersRequestFn.js +37 -0
- package/dist/esm/qraftPredefinedParametersRequestFn.js.map +1 -0
- package/dist/types/Unstable_QraftSecureRequestFn.d.ts +1 -1
- package/dist/types/Unstable_QraftSecureRequestFn.d.ts.map +1 -1
- package/dist/types/callbacks/cancelQueries.d.ts +3 -3
- package/dist/types/callbacks/cancelQueries.d.ts.map +1 -1
- package/dist/types/callbacks/fetchInfiniteQuery.d.ts +3 -2
- package/dist/types/callbacks/fetchInfiniteQuery.d.ts.map +1 -1
- package/dist/types/callbacks/fetchQuery.d.ts +3 -2
- package/dist/types/callbacks/fetchQuery.d.ts.map +1 -1
- package/dist/types/callbacks/getInfiniteQueryData.d.ts +2 -3
- package/dist/types/callbacks/getInfiniteQueryData.d.ts.map +1 -1
- package/dist/types/callbacks/getInfiniteQueryKey.d.ts +4 -4
- package/dist/types/callbacks/getInfiniteQueryKey.d.ts.map +1 -1
- package/dist/types/callbacks/getInfiniteQueryState.d.ts +3 -3
- package/dist/types/callbacks/getInfiniteQueryState.d.ts.map +1 -1
- package/dist/types/callbacks/getMutationKey.d.ts +3 -3
- package/dist/types/callbacks/getMutationKey.d.ts.map +1 -1
- package/dist/types/callbacks/getQueriesData.d.ts +3 -3
- package/dist/types/callbacks/getQueriesData.d.ts.map +1 -1
- package/dist/types/callbacks/getQueryData.d.ts +2 -3
- package/dist/types/callbacks/getQueryData.d.ts.map +1 -1
- package/dist/types/callbacks/getQueryKey.d.ts +3 -3
- package/dist/types/callbacks/getQueryKey.d.ts.map +1 -1
- package/dist/types/callbacks/getQueryState.d.ts +3 -3
- package/dist/types/callbacks/getQueryState.d.ts.map +1 -1
- package/dist/types/callbacks/invalidateQueries.d.ts +3 -3
- package/dist/types/callbacks/invalidateQueries.d.ts.map +1 -1
- package/dist/types/callbacks/isFetching.d.ts +3 -3
- package/dist/types/callbacks/isFetching.d.ts.map +1 -1
- package/dist/types/callbacks/isMutating.d.ts +3 -3
- package/dist/types/callbacks/isMutating.d.ts.map +1 -1
- package/dist/types/callbacks/operationInvokeFn.d.ts +1 -3
- package/dist/types/callbacks/operationInvokeFn.d.ts.map +1 -1
- package/dist/types/callbacks/prefetchInfiniteQuery.d.ts +3 -2
- package/dist/types/callbacks/prefetchInfiniteQuery.d.ts.map +1 -1
- package/dist/types/callbacks/prefetchQuery.d.ts +3 -2
- package/dist/types/callbacks/prefetchQuery.d.ts.map +1 -1
- package/dist/types/callbacks/refetchQueries.d.ts +3 -3
- package/dist/types/callbacks/refetchQueries.d.ts.map +1 -1
- package/dist/types/callbacks/removeQueries.d.ts +3 -3
- package/dist/types/callbacks/removeQueries.d.ts.map +1 -1
- package/dist/types/callbacks/resetQueries.d.ts +3 -3
- package/dist/types/callbacks/resetQueries.d.ts.map +1 -1
- package/dist/types/callbacks/setInfiniteQueryData.d.ts +1 -2
- package/dist/types/callbacks/setInfiniteQueryData.d.ts.map +1 -1
- package/dist/types/callbacks/setQueriesData.d.ts +3 -3
- package/dist/types/callbacks/setQueriesData.d.ts.map +1 -1
- package/dist/types/callbacks/setQueryData.d.ts +1 -2
- package/dist/types/callbacks/setQueryData.d.ts.map +1 -1
- package/dist/types/callbacks/useInfiniteQuery.d.ts +2 -3
- package/dist/types/callbacks/useInfiniteQuery.d.ts.map +1 -1
- package/dist/types/callbacks/useIsFetching.d.ts +2 -3
- package/dist/types/callbacks/useIsFetching.d.ts.map +1 -1
- package/dist/types/callbacks/useIsMutating.d.ts +2 -3
- package/dist/types/callbacks/useIsMutating.d.ts.map +1 -1
- package/dist/types/callbacks/useMutation.d.ts +2 -3
- package/dist/types/callbacks/useMutation.d.ts.map +1 -1
- package/dist/types/callbacks/useMutationState.d.ts +2 -3
- package/dist/types/callbacks/useMutationState.d.ts.map +1 -1
- package/dist/types/callbacks/useQueries.d.ts +3 -3
- package/dist/types/callbacks/useQueries.d.ts.map +1 -1
- package/dist/types/callbacks/useQuery.d.ts +2 -3
- package/dist/types/callbacks/useQuery.d.ts.map +1 -1
- package/dist/types/callbacks/useSuspenseInfiniteQuery.d.ts +2 -3
- package/dist/types/callbacks/useSuspenseInfiniteQuery.d.ts.map +1 -1
- package/dist/types/callbacks/useSuspenseQueries.d.ts +3 -3
- package/dist/types/callbacks/useSuspenseQueries.d.ts.map +1 -1
- package/dist/types/callbacks/useSuspenseQuery.d.ts +2 -3
- package/dist/types/callbacks/useSuspenseQuery.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/callQueryClientFetchMethod.d.ts.map +1 -1
- package/dist/types/lib/composeBaseQueryKey.d.ts +1 -1
- package/dist/types/lib/composeBaseQueryKey.d.ts.map +1 -1
- package/dist/types/lib/composeInfiniteQueryKey.d.ts +1 -1
- package/dist/types/lib/composeInfiniteQueryKey.d.ts.map +1 -1
- package/dist/types/lib/composeMutationKey.d.ts +1 -1
- package/dist/types/lib/composeMutationKey.d.ts.map +1 -1
- package/dist/types/lib/composeQueryKey.d.ts +1 -1
- package/dist/types/lib/composeQueryKey.d.ts.map +1 -1
- package/dist/types/lib/requestFn.d.ts +8 -77
- package/dist/types/lib/requestFn.d.ts.map +1 -1
- package/dist/types/lib/useComposeUseQueryOptions.d.ts.map +1 -1
- package/dist/types/migrate-to-v2-codemod.d.ts +3 -0
- package/dist/types/migrate-to-v2-codemod.d.ts.map +1 -0
- package/dist/types/qraftAPIClient.d.ts +10 -6
- package/dist/types/qraftAPIClient.d.ts.map +1 -1
- package/dist/types/qraftPredefinedParametersRequestFn.d.ts +19 -0
- package/dist/types/qraftPredefinedParametersRequestFn.d.ts.map +1 -0
- package/package.json +28 -17
- package/src/callbacks/cancelQueries.ts +7 -3
- package/src/callbacks/fetchInfiniteQuery.ts +4 -2
- package/src/callbacks/fetchQuery.ts +8 -2
- package/src/callbacks/getInfiniteQueryData.ts +5 -3
- package/src/callbacks/getInfiniteQueryKey.ts +9 -5
- package/src/callbacks/getInfiniteQueryState.ts +8 -4
- package/src/callbacks/getMutationKey.ts +8 -4
- package/src/callbacks/getQueriesData.ts +11 -3
- package/src/callbacks/getQueryData.ts +9 -3
- package/src/callbacks/getQueryKey.ts +11 -3
- package/src/callbacks/getQueryState.ts +11 -3
- package/src/callbacks/invalidateQueries.ts +7 -3
- package/src/callbacks/isFetching.ts +7 -3
- package/src/callbacks/isMutating.ts +8 -3
- package/src/callbacks/operationInvokeFn.ts +6 -3
- package/src/callbacks/prefetchInfiniteQuery.ts +4 -2
- package/src/callbacks/prefetchQuery.ts +8 -2
- package/src/callbacks/refetchQueries.ts +7 -3
- package/src/callbacks/removeQueries.ts +7 -3
- package/src/callbacks/resetQueries.ts +7 -3
- package/src/callbacks/setInfiniteQueryData.ts +4 -2
- package/src/callbacks/setQueriesData.ts +7 -3
- package/src/callbacks/setQueryData.ts +4 -2
- package/src/callbacks/useInfiniteQuery.ts +10 -3
- package/src/callbacks/useIsFetching.ts +5 -3
- package/src/callbacks/useIsMutating.ts +7 -4
- package/src/callbacks/useMutation.ts +8 -5
- package/src/callbacks/useMutationState.ts +7 -4
- package/src/callbacks/useQueries.ts +12 -3
- package/src/callbacks/useQuery.ts +10 -3
- package/src/callbacks/useSuspenseInfiniteQuery.ts +7 -4
- package/src/callbacks/useSuspenseQueries.ts +9 -4
- package/src/callbacks/useSuspenseQuery.ts +10 -3
- package/src/index.ts +9 -10
- package/src/lib/callQueryClientFetchMethod.ts +13 -11
- package/src/lib/composeBaseQueryKey.ts +1 -1
- package/src/lib/composeInfiniteQueryKey.ts +1 -1
- package/src/lib/composeMutationKey.ts +1 -1
- package/src/lib/composeQueryKey.ts +1 -1
- package/src/lib/requestFn.ts +26 -113
- package/src/lib/useComposeUseQueryOptions.ts +1 -2
- package/src/migrate-to-v2-codemod.ts +118 -0
- package/src/qraftAPIClient.ts +74 -11
- package/src/qraftPredefinedParametersRequestFn.ts +149 -0
- package/dist/types/lib/AreAllOptional.d.ts +0 -4
- package/dist/types/lib/AreAllOptional.d.ts.map +0 -1
- package/dist/types/lib/PartialParameters.type.d.ts +0 -13
- package/dist/types/lib/PartialParameters.type.d.ts.map +0 -1
- package/dist/types/service-operation/OperationInfiniteData.d.ts +0 -4
- package/dist/types/service-operation/OperationInfiniteData.d.ts.map +0 -1
- package/dist/types/service-operation/QueryFilters.d.ts +0 -123
- package/dist/types/service-operation/QueryFilters.d.ts.map +0 -1
- package/dist/types/service-operation/ServiceOperation.d.ts +0 -53
- package/dist/types/service-operation/ServiceOperation.d.ts.map +0 -1
- package/dist/types/service-operation/ServiceOperationCancelQueries.d.ts +0 -9
- package/dist/types/service-operation/ServiceOperationCancelQueries.d.ts.map +0 -1
- package/dist/types/service-operation/ServiceOperationFetchInfiniteQuery.d.ts +0 -61
- package/dist/types/service-operation/ServiceOperationFetchInfiniteQuery.d.ts.map +0 -1
- package/dist/types/service-operation/ServiceOperationFetchQuery.d.ts +0 -58
- package/dist/types/service-operation/ServiceOperationFetchQuery.d.ts.map +0 -1
- package/dist/types/service-operation/ServiceOperationGetInfiniteQueryData.d.ts +0 -10
- package/dist/types/service-operation/ServiceOperationGetInfiniteQueryData.d.ts.map +0 -1
- package/dist/types/service-operation/ServiceOperationGetQueriesData.d.ts +0 -17
- package/dist/types/service-operation/ServiceOperationGetQueriesData.d.ts.map +0 -1
- package/dist/types/service-operation/ServiceOperationGetQueryData.d.ts +0 -9
- package/dist/types/service-operation/ServiceOperationGetQueryData.d.ts.map +0 -1
- package/dist/types/service-operation/ServiceOperationGetQueryState.d.ts +0 -11
- package/dist/types/service-operation/ServiceOperationGetQueryState.d.ts.map +0 -1
- package/dist/types/service-operation/ServiceOperationInvalidateQueries.d.ts +0 -15
- package/dist/types/service-operation/ServiceOperationInvalidateQueries.d.ts.map +0 -1
- package/dist/types/service-operation/ServiceOperationIsFetchingQueries.d.ts +0 -9
- package/dist/types/service-operation/ServiceOperationIsFetchingQueries.d.ts.map +0 -1
- package/dist/types/service-operation/ServiceOperationIsMutatingQueries.d.ts +0 -9
- package/dist/types/service-operation/ServiceOperationIsMutatingQueries.d.ts.map +0 -1
- package/dist/types/service-operation/ServiceOperationKey.d.ts +0 -16
- package/dist/types/service-operation/ServiceOperationKey.d.ts.map +0 -1
- package/dist/types/service-operation/ServiceOperationMutationFn.d.ts +0 -30
- package/dist/types/service-operation/ServiceOperationMutationFn.d.ts.map +0 -1
- package/dist/types/service-operation/ServiceOperationQueryFn.d.ts +0 -37
- package/dist/types/service-operation/ServiceOperationQueryFn.d.ts.map +0 -1
- package/dist/types/service-operation/ServiceOperationRefetchQueries.d.ts +0 -9
- package/dist/types/service-operation/ServiceOperationRefetchQueries.d.ts.map +0 -1
- package/dist/types/service-operation/ServiceOperationRemoveQueries.d.ts +0 -9
- package/dist/types/service-operation/ServiceOperationRemoveQueries.d.ts.map +0 -1
- package/dist/types/service-operation/ServiceOperationResetQueries.d.ts +0 -9
- package/dist/types/service-operation/ServiceOperationResetQueries.d.ts.map +0 -1
- package/dist/types/service-operation/ServiceOperationSetInfiniteQueryData.d.ts +0 -10
- package/dist/types/service-operation/ServiceOperationSetInfiniteQueryData.d.ts.map +0 -1
- package/dist/types/service-operation/ServiceOperationSetQueriesData.d.ts +0 -9
- package/dist/types/service-operation/ServiceOperationSetQueriesData.d.ts.map +0 -1
- package/dist/types/service-operation/ServiceOperationSetQueryData.d.ts +0 -9
- package/dist/types/service-operation/ServiceOperationSetQueryData.d.ts.map +0 -1
- package/dist/types/service-operation/ServiceOperationUseInfiniteQuery.d.ts +0 -15
- package/dist/types/service-operation/ServiceOperationUseInfiniteQuery.d.ts.map +0 -1
- package/dist/types/service-operation/ServiceOperationUseIsFetchingQueries.d.ts +0 -9
- package/dist/types/service-operation/ServiceOperationUseIsFetchingQueries.d.ts.map +0 -1
- package/dist/types/service-operation/ServiceOperationUseIsMutating.d.ts +0 -9
- package/dist/types/service-operation/ServiceOperationUseIsMutating.d.ts.map +0 -1
- package/dist/types/service-operation/ServiceOperationUseMutation.d.ts +0 -28
- package/dist/types/service-operation/ServiceOperationUseMutation.d.ts.map +0 -1
- package/dist/types/service-operation/ServiceOperationUseMutationState.d.ts +0 -46
- package/dist/types/service-operation/ServiceOperationUseMutationState.d.ts.map +0 -1
- package/dist/types/service-operation/ServiceOperationUseQueries.d.ts +0 -26
- package/dist/types/service-operation/ServiceOperationUseQueries.d.ts.map +0 -1
- package/dist/types/service-operation/ServiceOperationUseQuery.d.ts +0 -13
- package/dist/types/service-operation/ServiceOperationUseQuery.d.ts.map +0 -1
- package/dist/types/service-operation/ServiceOperationUseSuspenseInfiniteQuery.d.ts +0 -12
- package/dist/types/service-operation/ServiceOperationUseSuspenseInfiniteQuery.d.ts.map +0 -1
- package/dist/types/service-operation/ServiceOperationUseSuspenseQueries.d.ts +0 -25
- package/dist/types/service-operation/ServiceOperationUseSuspenseQueries.d.ts.map +0 -1
- package/dist/types/service-operation/ServiceOperationUseSuspenseQuery.d.ts +0 -10
- package/dist/types/service-operation/ServiceOperationUseSuspenseQuery.d.ts.map +0 -1
- package/dist/types/service-operation/index.d.ts +0 -2
- package/dist/types/service-operation/index.d.ts.map +0 -1
- package/src/lib/AreAllOptional.ts +0 -8
- package/src/lib/PartialParameters.type.ts +0 -12
- package/src/service-operation/OperationInfiniteData.ts +0 -7
- package/src/service-operation/QueryFilters.ts +0 -226
- package/src/service-operation/ServiceOperation.ts +0 -85
- package/src/service-operation/ServiceOperationCancelQueries.ts +0 -19
- package/src/service-operation/ServiceOperationFetchInfiniteQuery.ts +0 -156
- package/src/service-operation/ServiceOperationFetchQuery.ts +0 -111
- package/src/service-operation/ServiceOperationGetInfiniteQueryData.ts +0 -15
- package/src/service-operation/ServiceOperationGetQueriesData.ts +0 -35
- package/src/service-operation/ServiceOperationGetQueryData.ts +0 -14
- package/src/service-operation/ServiceOperationGetQueryState.ts +0 -21
- package/src/service-operation/ServiceOperationInvalidateQueries.ts +0 -37
- package/src/service-operation/ServiceOperationIsFetchingQueries.ts +0 -18
- package/src/service-operation/ServiceOperationIsMutatingQueries.ts +0 -26
- package/src/service-operation/ServiceOperationKey.ts +0 -20
- package/src/service-operation/ServiceOperationMutationFn.ts +0 -49
- package/src/service-operation/ServiceOperationQueryFn.ts +0 -71
- package/src/service-operation/ServiceOperationRefetchQueries.ts +0 -19
- package/src/service-operation/ServiceOperationRemoveQueries.ts +0 -18
- package/src/service-operation/ServiceOperationResetQueries.ts +0 -19
- package/src/service-operation/ServiceOperationSetInfiniteQueryData.ts +0 -18
- package/src/service-operation/ServiceOperationSetQueriesData.ts +0 -25
- package/src/service-operation/ServiceOperationSetQueryData.ts +0 -14
- package/src/service-operation/ServiceOperationUseInfiniteQuery.ts +0 -77
- package/src/service-operation/ServiceOperationUseIsFetchingQueries.ts +0 -18
- package/src/service-operation/ServiceOperationUseIsMutating.ts +0 -26
- package/src/service-operation/ServiceOperationUseMutation.ts +0 -74
- package/src/service-operation/ServiceOperationUseMutationState.ts +0 -107
- package/src/service-operation/ServiceOperationUseQueries.ts +0 -57
- package/src/service-operation/ServiceOperationUseQuery.ts +0 -50
- package/src/service-operation/ServiceOperationUseSuspenseInfiniteQuery.ts +0 -43
- package/src/service-operation/ServiceOperationUseSuspenseQueries.ts +0 -55
- package/src/service-operation/ServiceOperationUseSuspenseQuery.ts +0 -26
- package/src/service-operation/index.ts +0 -4
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
OperationSchema,
|
|
3
|
+
ServiceOperationResetQueries,
|
|
4
|
+
} from '@openapi-qraft/tanstack-query-react-types';
|
|
5
|
+
import type { DefaultError } from '@tanstack/query-core';
|
|
2
6
|
import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js';
|
|
3
|
-
import type { ServiceOperationResetQueries } from '../service-operation/ServiceOperationResetQueries.js';
|
|
4
7
|
import { callQueryClientMethodWithQueryFilters } from '../lib/callQueryClientMethodWithQueryFilters.js';
|
|
5
8
|
|
|
6
9
|
export function resetQueries<TData>(
|
|
@@ -10,7 +13,8 @@ export function resetQueries<TData>(
|
|
|
10
13
|
ServiceOperationResetQueries<
|
|
11
14
|
OperationSchema,
|
|
12
15
|
unknown,
|
|
13
|
-
TData
|
|
16
|
+
TData,
|
|
17
|
+
DefaultError
|
|
14
18
|
>['resetQueries']
|
|
15
19
|
>
|
|
16
20
|
): Promise<void> {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
OperationSchema,
|
|
3
|
+
ServiceOperationSetInfiniteQueryData,
|
|
4
|
+
} from '@openapi-qraft/tanstack-query-react-types';
|
|
1
5
|
import type { InfiniteData } from '@tanstack/query-core';
|
|
2
|
-
import type { OperationSchema } from '../lib/requestFn.js';
|
|
3
6
|
import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js';
|
|
4
|
-
import type { ServiceOperationSetInfiniteQueryData } from '../service-operation/ServiceOperationSetInfiniteQueryData.js';
|
|
5
7
|
import { callQueryClientMethodWithQueryKey } from '../lib/callQueryClientMethodWithQueryKey.js';
|
|
6
8
|
|
|
7
9
|
export function setInfiniteQueryData<TData>(
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
OperationSchema,
|
|
3
|
+
ServiceOperationSetQueriesData,
|
|
4
|
+
} from '@openapi-qraft/tanstack-query-react-types';
|
|
5
|
+
import type { DefaultError } from '@tanstack/query-core';
|
|
2
6
|
import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js';
|
|
3
|
-
import type { ServiceOperationSetQueriesData } from '../service-operation/ServiceOperationSetQueriesData.js';
|
|
4
7
|
import { callQueryClientMethodWithQueryFilters } from '../lib/callQueryClientMethodWithQueryFilters.js';
|
|
5
8
|
|
|
6
9
|
export function setQueriesData<TData>(
|
|
@@ -10,7 +13,8 @@ export function setQueriesData<TData>(
|
|
|
10
13
|
ServiceOperationSetQueriesData<
|
|
11
14
|
OperationSchema,
|
|
12
15
|
unknown,
|
|
13
|
-
TData
|
|
16
|
+
TData,
|
|
17
|
+
DefaultError
|
|
14
18
|
>['setQueriesData']
|
|
15
19
|
>
|
|
16
20
|
): TData | undefined {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
OperationSchema,
|
|
3
|
+
ServiceOperationSetQueryData,
|
|
4
|
+
} from '@openapi-qraft/tanstack-query-react-types';
|
|
2
5
|
import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js';
|
|
3
|
-
import type { ServiceOperationSetQueryData } from '../service-operation/ServiceOperationSetQueryData.js';
|
|
4
6
|
import { callQueryClientMethodWithQueryKey } from '../lib/callQueryClientMethodWithQueryKey.js';
|
|
5
7
|
|
|
6
8
|
export function setQueryData<TData>(
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import type {
|
|
4
|
+
OperationSchema,
|
|
5
|
+
ServiceOperationUseInfiniteQuery,
|
|
6
|
+
} from '@openapi-qraft/tanstack-query-react-types';
|
|
3
7
|
import type { DefaultError, InfiniteData } from '@tanstack/query-core';
|
|
4
8
|
import type { UseInfiniteQueryResult } from '@tanstack/react-query';
|
|
5
|
-
import type { OperationSchema } from '../lib/requestFn.js';
|
|
6
9
|
import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js';
|
|
7
|
-
import type { ServiceOperationQuery } from '../service-operation/ServiceOperation.js';
|
|
8
10
|
import { useInfiniteQuery as useInfiniteQueryBase } from '@tanstack/react-query';
|
|
9
11
|
import { useComposeUseQueryOptions } from '../lib/useComposeUseQueryOptions.js';
|
|
10
12
|
|
|
@@ -16,7 +18,12 @@ export const useInfiniteQuery: <
|
|
|
16
18
|
qraftOptions: CreateAPIQueryClientOptions,
|
|
17
19
|
schema: OperationSchema,
|
|
18
20
|
args: Parameters<
|
|
19
|
-
|
|
21
|
+
ServiceOperationUseInfiniteQuery<
|
|
22
|
+
OperationSchema,
|
|
23
|
+
unknown,
|
|
24
|
+
unknown,
|
|
25
|
+
DefaultError
|
|
26
|
+
>['useInfiniteQuery']
|
|
20
27
|
>
|
|
21
28
|
) => UseInfiniteQueryResult<TData, TError> = (qraftOptions, schema, args) => {
|
|
22
29
|
return useInfiniteQueryBase(
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type {
|
|
4
|
+
OperationSchema,
|
|
5
|
+
ServiceOperationUseIsFetchingQueries,
|
|
6
|
+
} from '@openapi-qraft/tanstack-query-react-types';
|
|
4
7
|
import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js';
|
|
5
|
-
import type { ServiceOperationQuery } from '../service-operation/ServiceOperation.js';
|
|
6
8
|
import { useIsFetching as useIsFetchingTanstack } from '@tanstack/react-query';
|
|
7
9
|
import { composeQueryFilters } from '../lib/composeQueryFilters.js';
|
|
8
10
|
|
|
@@ -10,7 +12,7 @@ export const useIsFetching: <TVariables = unknown>(
|
|
|
10
12
|
qraftOptions: CreateAPIQueryClientOptions,
|
|
11
13
|
schema: OperationSchema,
|
|
12
14
|
args: Parameters<
|
|
13
|
-
|
|
15
|
+
ServiceOperationUseIsFetchingQueries<
|
|
14
16
|
OperationSchema,
|
|
15
17
|
object | undefined,
|
|
16
18
|
TVariables,
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import type {
|
|
4
|
+
OperationSchema,
|
|
5
|
+
ServiceOperationUseIsMutating,
|
|
6
|
+
} from '@openapi-qraft/tanstack-query-react-types';
|
|
3
7
|
import type { DefaultError } from '@tanstack/query-core';
|
|
4
8
|
import type { UseMutationResult } from '@tanstack/react-query';
|
|
5
|
-
import type { OperationSchema } from '../lib/requestFn.js';
|
|
6
9
|
import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js';
|
|
7
|
-
import type { ServiceOperationMutation } from '../service-operation/ServiceOperation.js';
|
|
8
10
|
import { useIsMutating as useIsMutatingStateTanstack } from '@tanstack/react-query';
|
|
9
11
|
import { composeMutationFilters } from '../lib/composeMutationFilters.js';
|
|
10
12
|
|
|
@@ -17,11 +19,12 @@ export const useIsMutating: <
|
|
|
17
19
|
qraftOptions: CreateAPIQueryClientOptions,
|
|
18
20
|
schema: OperationSchema,
|
|
19
21
|
args: Parameters<
|
|
20
|
-
|
|
22
|
+
ServiceOperationUseIsMutating<
|
|
21
23
|
OperationSchema,
|
|
22
24
|
object | undefined,
|
|
23
25
|
TVariables,
|
|
24
|
-
TData
|
|
26
|
+
TData,
|
|
27
|
+
DefaultError
|
|
25
28
|
>['useIsMutating']
|
|
26
29
|
>
|
|
27
30
|
) => UseMutationResult<TData, TError, TVariables, TContext> = (
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import type {
|
|
4
|
+
OperationSchema,
|
|
5
|
+
ServiceOperationMutationKey,
|
|
6
|
+
ServiceOperationUseMutation,
|
|
7
|
+
} from '@openapi-qraft/tanstack-query-react-types';
|
|
3
8
|
import type { DefaultError } from '@tanstack/query-core';
|
|
4
9
|
import type { UseMutationResult } from '@tanstack/react-query';
|
|
5
|
-
import type { OperationSchema } from '../lib/requestFn.js';
|
|
6
10
|
import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js';
|
|
7
|
-
import type { ServiceOperationMutation } from '../service-operation/ServiceOperation.js';
|
|
8
|
-
import type { ServiceOperationMutationKey } from '../service-operation/ServiceOperationKey.js';
|
|
9
11
|
import { useMutation as useMutationBase } from '@tanstack/react-query';
|
|
10
12
|
import { composeMutationKey } from '../lib/composeMutationKey.js';
|
|
11
13
|
import { requestFnResponseResolver } from '../lib/requestFnResponseResolver.js';
|
|
@@ -19,11 +21,12 @@ export const useMutation: <
|
|
|
19
21
|
qraftOptions: CreateAPIQueryClientOptions,
|
|
20
22
|
schema: OperationSchema,
|
|
21
23
|
args: Parameters<
|
|
22
|
-
|
|
24
|
+
ServiceOperationUseMutation<
|
|
23
25
|
OperationSchema,
|
|
24
26
|
object | undefined,
|
|
25
27
|
TVariables,
|
|
26
|
-
TData
|
|
28
|
+
TData,
|
|
29
|
+
DefaultError
|
|
27
30
|
>['useMutation']
|
|
28
31
|
>
|
|
29
32
|
) => UseMutationResult<TData, TError, TVariables, TContext> = (
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import type {
|
|
4
|
+
OperationSchema,
|
|
5
|
+
ServiceOperationUseMutationState,
|
|
6
|
+
} from '@openapi-qraft/tanstack-query-react-types';
|
|
3
7
|
import type { DefaultError } from '@tanstack/query-core';
|
|
4
8
|
import type { UseMutationResult } from '@tanstack/react-query';
|
|
5
|
-
import type { OperationSchema } from '../lib/requestFn.js';
|
|
6
9
|
import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js';
|
|
7
|
-
import type { ServiceOperationMutation } from '../service-operation/ServiceOperation.js';
|
|
8
10
|
import { useMutationState as useMutationStateTanstack } from '@tanstack/react-query';
|
|
9
11
|
import { composeMutationFilters } from '../lib/composeMutationFilters.js';
|
|
10
12
|
|
|
@@ -17,11 +19,12 @@ export const useMutationState: <
|
|
|
17
19
|
qraftOptions: CreateAPIQueryClientOptions,
|
|
18
20
|
schema: OperationSchema,
|
|
19
21
|
args: Parameters<
|
|
20
|
-
|
|
22
|
+
ServiceOperationUseMutationState<
|
|
21
23
|
OperationSchema,
|
|
22
24
|
object | undefined,
|
|
23
25
|
TVariables,
|
|
24
|
-
TData
|
|
26
|
+
TData,
|
|
27
|
+
DefaultError
|
|
25
28
|
>['useMutationState']
|
|
26
29
|
>
|
|
27
30
|
) => UseMutationResult<TData, TError, TVariables, TContext> = (
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import type {
|
|
4
|
+
OperationSchema,
|
|
5
|
+
ServiceOperationUseQueries,
|
|
6
|
+
} from '@openapi-qraft/tanstack-query-react-types';
|
|
7
|
+
import type { DefaultError } from '@tanstack/query-core';
|
|
3
8
|
import type { QueriesResults } from '@tanstack/react-query';
|
|
4
|
-
import type { OperationSchema } from '../lib/requestFn.js';
|
|
5
9
|
import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js';
|
|
6
|
-
import type { ServiceOperationQuery } from '../service-operation/ServiceOperation.js';
|
|
7
10
|
import { useQueries as useQueriesTanstack } from '@tanstack/react-query';
|
|
8
11
|
import { composeQueryKey } from '../lib/composeQueryKey.js';
|
|
9
12
|
import { requestFnResponseResolver } from '../lib/requestFnResponseResolver.js';
|
|
@@ -12,7 +15,12 @@ export const useQueries: (
|
|
|
12
15
|
qraftOptions: CreateAPIQueryClientOptions,
|
|
13
16
|
schema: OperationSchema,
|
|
14
17
|
args: Parameters<
|
|
15
|
-
|
|
18
|
+
ServiceOperationUseQueries<
|
|
19
|
+
OperationSchema,
|
|
20
|
+
unknown,
|
|
21
|
+
unknown,
|
|
22
|
+
DefaultError
|
|
23
|
+
>['useQueries']
|
|
16
24
|
>
|
|
17
25
|
) => QueriesResults<never> = (qraftOptions, schema, args) => {
|
|
18
26
|
const [options] = args;
|
|
@@ -20,6 +28,7 @@ export const useQueries: (
|
|
|
20
28
|
return useQueriesTanstack(
|
|
21
29
|
{
|
|
22
30
|
...options,
|
|
31
|
+
// @ts-expect-error - Too complex to type
|
|
23
32
|
queries: options.queries.map((queryOptions) => {
|
|
24
33
|
const optionsWithQueryKey =
|
|
25
34
|
'parameters' in queryOptions
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import type {
|
|
4
|
+
OperationSchema,
|
|
5
|
+
ServiceOperationUseQuery,
|
|
6
|
+
} from '@openapi-qraft/tanstack-query-react-types';
|
|
3
7
|
import type { DefaultError } from '@tanstack/query-core';
|
|
4
8
|
import type { UseQueryResult } from '@tanstack/react-query';
|
|
5
|
-
import type { OperationSchema } from '../lib/requestFn.js';
|
|
6
9
|
import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js';
|
|
7
|
-
import type { ServiceOperationQuery } from '../service-operation/ServiceOperation.js';
|
|
8
10
|
import { useQuery as useQueryTanstack } from '@tanstack/react-query';
|
|
9
11
|
import { useComposeUseQueryOptions } from '../lib/useComposeUseQueryOptions.js';
|
|
10
12
|
|
|
@@ -12,7 +14,12 @@ export const useQuery: <TData = unknown, TError = DefaultError>(
|
|
|
12
14
|
qraftOptions: CreateAPIQueryClientOptions,
|
|
13
15
|
schema: OperationSchema,
|
|
14
16
|
args: Parameters<
|
|
15
|
-
|
|
17
|
+
ServiceOperationUseQuery<
|
|
18
|
+
OperationSchema,
|
|
19
|
+
unknown,
|
|
20
|
+
unknown,
|
|
21
|
+
DefaultError
|
|
22
|
+
>['useQuery']
|
|
16
23
|
>
|
|
17
24
|
) => UseQueryResult<TData, TError> = (qraftOptions, schema, args) => {
|
|
18
25
|
return useQueryTanstack(
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import type {
|
|
4
|
+
OperationSchema,
|
|
5
|
+
ServiceOperationUseSuspenseInfiniteQuery,
|
|
6
|
+
} from '@openapi-qraft/tanstack-query-react-types';
|
|
3
7
|
import type { DefaultError, InfiniteData } from '@tanstack/query-core';
|
|
4
8
|
import type { UseSuspenseInfiniteQueryResult } from '@tanstack/react-query';
|
|
5
|
-
import type { OperationSchema } from '../lib/requestFn.js';
|
|
6
9
|
import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js';
|
|
7
|
-
import type { ServiceOperationQuery } from '../service-operation/ServiceOperation.js';
|
|
8
10
|
import { useSuspenseInfiniteQuery as useSuspenseInfiniteQueryTanstack } from '@tanstack/react-query';
|
|
9
11
|
import { useComposeUseQueryOptions } from '../lib/useComposeUseQueryOptions.js';
|
|
10
12
|
|
|
@@ -16,10 +18,11 @@ export const useSuspenseInfiniteQuery: <
|
|
|
16
18
|
qraftOptions: CreateAPIQueryClientOptions,
|
|
17
19
|
schema: OperationSchema,
|
|
18
20
|
args: Parameters<
|
|
19
|
-
|
|
21
|
+
ServiceOperationUseSuspenseInfiniteQuery<
|
|
20
22
|
OperationSchema,
|
|
21
23
|
unknown,
|
|
22
|
-
unknown
|
|
24
|
+
unknown,
|
|
25
|
+
DefaultError
|
|
23
26
|
>['useSuspenseInfiniteQuery']
|
|
24
27
|
>
|
|
25
28
|
) => UseSuspenseInfiniteQueryResult<TData, TError> = (
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import type {
|
|
4
|
+
OperationSchema,
|
|
5
|
+
ServiceOperationUseSuspenseQueries,
|
|
6
|
+
} from '@openapi-qraft/tanstack-query-react-types';
|
|
7
|
+
import type { DefaultError } from '@tanstack/query-core';
|
|
3
8
|
import type { SuspenseQueriesResults } from '@tanstack/react-query';
|
|
4
|
-
import type { OperationSchema } from '../lib/requestFn.js';
|
|
5
9
|
import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js';
|
|
6
|
-
import type { ServiceOperationQuery } from '../service-operation/ServiceOperation.js';
|
|
7
10
|
import { useSuspenseQueries as useSuspenseQueriesTanstack } from '@tanstack/react-query';
|
|
8
11
|
import { composeQueryKey } from '../lib/composeQueryKey.js';
|
|
9
12
|
import { requestFnResponseResolver } from '../lib/requestFnResponseResolver.js';
|
|
@@ -12,10 +15,11 @@ export const useSuspenseQueries: (
|
|
|
12
15
|
qraftOptions: CreateAPIQueryClientOptions,
|
|
13
16
|
schema: OperationSchema,
|
|
14
17
|
args: Parameters<
|
|
15
|
-
|
|
18
|
+
ServiceOperationUseSuspenseQueries<
|
|
16
19
|
OperationSchema,
|
|
17
20
|
unknown,
|
|
18
|
-
unknown
|
|
21
|
+
unknown,
|
|
22
|
+
DefaultError
|
|
19
23
|
>['useSuspenseQueries']
|
|
20
24
|
>
|
|
21
25
|
) => SuspenseQueriesResults<never> = (qraftOptions, schema, args) => {
|
|
@@ -24,6 +28,7 @@ export const useSuspenseQueries: (
|
|
|
24
28
|
return useSuspenseQueriesTanstack(
|
|
25
29
|
{
|
|
26
30
|
...options,
|
|
31
|
+
// @ts-expect-error - Too complex to type
|
|
27
32
|
queries: options.queries.map((queryOptions) => {
|
|
28
33
|
const optionsWithQueryKey =
|
|
29
34
|
'parameters' in queryOptions
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import type {
|
|
4
|
+
OperationSchema,
|
|
5
|
+
ServiceOperationUseSuspenseQuery,
|
|
6
|
+
} from '@openapi-qraft/tanstack-query-react-types';
|
|
3
7
|
import type { DefaultError } from '@tanstack/query-core';
|
|
4
8
|
import type { UseQueryResult } from '@tanstack/react-query';
|
|
5
|
-
import type { OperationSchema } from '../lib/requestFn.js';
|
|
6
9
|
import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js';
|
|
7
|
-
import type { ServiceOperationQuery } from '../service-operation/ServiceOperation.js';
|
|
8
10
|
import { useSuspenseQuery as useSuspenseQueryTanstack } from '@tanstack/react-query';
|
|
9
11
|
import { useComposeUseQueryOptions } from '../lib/useComposeUseQueryOptions.js';
|
|
10
12
|
|
|
@@ -16,7 +18,12 @@ export const useSuspenseQuery: <
|
|
|
16
18
|
qraftOptions: CreateAPIQueryClientOptions,
|
|
17
19
|
schema: OperationSchema,
|
|
18
20
|
args: Parameters<
|
|
19
|
-
|
|
21
|
+
ServiceOperationUseSuspenseQuery<
|
|
22
|
+
OperationSchema,
|
|
23
|
+
unknown,
|
|
24
|
+
unknown,
|
|
25
|
+
DefaultError
|
|
26
|
+
>['useSuspenseQuery']
|
|
20
27
|
>
|
|
21
28
|
) => UseQueryResult<TData, TError> = (qraftOptions, schema, args) => {
|
|
22
29
|
return useSuspenseQueryTanstack(
|
package/src/index.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
export {
|
|
2
2
|
qraftAPIClient,
|
|
3
3
|
type CreateAPIClientOptions,
|
|
4
|
+
type CreateAPIBasicQueryClientOptions,
|
|
4
5
|
type CreateAPIBasicClientOptions,
|
|
5
6
|
type CreateAPIQueryClientOptions,
|
|
6
7
|
type APIQueryClientServices,
|
|
8
|
+
type APIBasicQueryClientServices,
|
|
7
9
|
type APIBasicClientServices,
|
|
10
|
+
type APIUtilityClientServices,
|
|
8
11
|
type QraftClientOptions,
|
|
9
12
|
} from './qraftAPIClient.js';
|
|
10
13
|
export {
|
|
@@ -13,15 +16,11 @@ export {
|
|
|
13
16
|
urlSerializer,
|
|
14
17
|
bodySerializer,
|
|
15
18
|
mergeHeaders,
|
|
19
|
+
type RequestFn,
|
|
16
20
|
type RequestFnResponse,
|
|
21
|
+
type HeadersOptions,
|
|
22
|
+
type RequestFnOptions,
|
|
23
|
+
type RequestFnInfo,
|
|
24
|
+
type OperationSchema,
|
|
25
|
+
type RequestFnPayload,
|
|
17
26
|
} from './lib/requestFn.js';
|
|
18
|
-
|
|
19
|
-
export type {
|
|
20
|
-
RequestFnPayload,
|
|
21
|
-
RequestFnOptions,
|
|
22
|
-
HeadersOptions,
|
|
23
|
-
OperationSchema,
|
|
24
|
-
RequestFn,
|
|
25
|
-
} from './lib/requestFn.js';
|
|
26
|
-
|
|
27
|
-
export type * from './service-operation/index.js';
|
|
@@ -46,17 +46,19 @@ export function callQueryClientMethodWithQueryKey<
|
|
|
46
46
|
|
|
47
47
|
const queryFn =
|
|
48
48
|
queryFnOption ??
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
49
|
+
(requestFn
|
|
50
|
+
? // @ts-expect-error - Too complex union to type
|
|
51
|
+
function ({ queryKey: [, queryParams], signal, meta, pageParam }) {
|
|
52
|
+
return requestFn(schema, {
|
|
53
|
+
parameters: infinite
|
|
54
|
+
? (shelfMerge(2, queryParams, pageParam) as never)
|
|
55
|
+
: queryParams,
|
|
56
|
+
baseUrl,
|
|
57
|
+
signal,
|
|
58
|
+
meta,
|
|
59
|
+
}).then(requestFnResponseResolver, requestFnResponseResolver);
|
|
60
|
+
}
|
|
61
|
+
: undefined);
|
|
60
62
|
|
|
61
63
|
// @ts-expect-error - Too complex union to type
|
|
62
64
|
return queryClient[queryFilterMethod]({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
ServiceOperationInfiniteQueryKey,
|
|
3
3
|
ServiceOperationQueryKey,
|
|
4
|
-
} from '
|
|
4
|
+
} from '@openapi-qraft/tanstack-query-react-types';
|
|
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 '@openapi-qraft/tanstack-query-react-types';
|
|
2
2
|
import type { OperationSchema } from './requestFn.js';
|
|
3
3
|
import { composeBaseQueryKey } from './composeBaseQueryKey.js';
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ServiceOperationQueryKey } from '
|
|
1
|
+
import type { ServiceOperationQueryKey } from '@openapi-qraft/tanstack-query-react-types';
|
|
2
2
|
import type { OperationSchema } from './requestFn.js';
|
|
3
3
|
import { composeBaseQueryKey } from './composeBaseQueryKey.js';
|
|
4
4
|
|
package/src/lib/requestFn.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
HeadersOptions,
|
|
3
|
+
OperationSchema,
|
|
4
|
+
RequestFnInfo,
|
|
5
|
+
RequestFnOptions,
|
|
6
|
+
RequestFnResponse,
|
|
7
|
+
} from '@openapi-qraft/tanstack-query-react-types';
|
|
8
|
+
|
|
1
9
|
/**
|
|
2
10
|
* This function is used to make a request to a specified endpoint.
|
|
3
11
|
*
|
|
@@ -88,7 +96,7 @@ export async function baseRequestFn<TData, TError>(
|
|
|
88
96
|
*/
|
|
89
97
|
export function urlSerializer(
|
|
90
98
|
schema: OperationSchema,
|
|
91
|
-
info:
|
|
99
|
+
info: Pick<RequestFnInfo, 'baseUrl' | 'parameters'>
|
|
92
100
|
): string {
|
|
93
101
|
const path = schema.url.replace(
|
|
94
102
|
/{(.*?)}/g,
|
|
@@ -171,10 +179,7 @@ export function mergeHeaders(...allHeaders: (HeadersOptions | undefined)[]) {
|
|
|
171
179
|
return headers;
|
|
172
180
|
}
|
|
173
181
|
|
|
174
|
-
export function bodySerializer(
|
|
175
|
-
schema: OperationSchema,
|
|
176
|
-
info: RequestFnPayload
|
|
177
|
-
) {
|
|
182
|
+
export function bodySerializer(schema: OperationSchema, info: RequestFnInfo) {
|
|
178
183
|
if (info.body === undefined) return;
|
|
179
184
|
|
|
180
185
|
if (
|
|
@@ -201,7 +206,7 @@ export function bodySerializer(
|
|
|
201
206
|
|
|
202
207
|
function getRequestBodyFormData({
|
|
203
208
|
body,
|
|
204
|
-
}: Pick<
|
|
209
|
+
}: Pick<RequestFnInfo, 'body'>): FormData | undefined {
|
|
205
210
|
if (body instanceof FormData) return body;
|
|
206
211
|
if (body === null) return;
|
|
207
212
|
|
|
@@ -240,7 +245,7 @@ function getRequestBodyFormData({
|
|
|
240
245
|
return formData;
|
|
241
246
|
}
|
|
242
247
|
|
|
243
|
-
function getBodyContentType(body:
|
|
248
|
+
function getBodyContentType(body: RequestFnInfo['body']) {
|
|
244
249
|
if (!body) return;
|
|
245
250
|
if (body instanceof Blob) return body.type || 'application/octet-stream';
|
|
246
251
|
if (typeof body === 'string') return 'text/plain';
|
|
@@ -315,112 +320,20 @@ function resolveResponse<TData, TError>(
|
|
|
315
320
|
);
|
|
316
321
|
}
|
|
317
322
|
|
|
318
|
-
// To have definitely typed headers without a conversion to stings
|
|
319
|
-
export type HeadersOptions =
|
|
320
|
-
| HeadersInit
|
|
321
|
-
| Record<string, string | number | boolean | null | undefined>;
|
|
322
|
-
|
|
323
|
-
export interface OperationSchema {
|
|
324
|
-
/**
|
|
325
|
-
* Operation path
|
|
326
|
-
* @example /user/{id}
|
|
327
|
-
*/
|
|
328
|
-
readonly url: string; //todo::rename to `path`
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* Operation method
|
|
332
|
-
*/
|
|
333
|
-
readonly method:
|
|
334
|
-
| 'get'
|
|
335
|
-
| 'put'
|
|
336
|
-
| 'post'
|
|
337
|
-
| 'patch'
|
|
338
|
-
| 'delete'
|
|
339
|
-
| 'options'
|
|
340
|
-
| 'head'
|
|
341
|
-
| 'trace';
|
|
342
|
-
|
|
343
|
-
/**
|
|
344
|
-
* Media type of the request body
|
|
345
|
-
* @example application/json
|
|
346
|
-
*/
|
|
347
|
-
readonly mediaType?: string;
|
|
348
|
-
|
|
349
|
-
readonly security?: string[];
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
export interface RequestFnPayload {
|
|
353
|
-
/**
|
|
354
|
-
* Base URL to use for the request
|
|
355
|
-
* @example 'https://api.example.com'
|
|
356
|
-
*/
|
|
357
|
-
baseUrl?: string;
|
|
358
|
-
|
|
359
|
-
/**
|
|
360
|
-
* OpenAPI parameters
|
|
361
|
-
* @example
|
|
362
|
-
* ```ts
|
|
363
|
-
* { path: {id: 1}, query: {search: 'hello'} }
|
|
364
|
-
* ```
|
|
365
|
-
*/
|
|
366
|
-
readonly parameters?: {
|
|
367
|
-
readonly path?: Record<string, any>;
|
|
368
|
-
readonly header?: Record<string, any>;
|
|
369
|
-
readonly query?: Record<string, any>;
|
|
370
|
-
};
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
* Request body
|
|
374
|
-
* @example { name: 'John' }
|
|
375
|
-
*/
|
|
376
|
-
readonly body?: BodyInit | Record<string, unknown> | null;
|
|
377
|
-
|
|
378
|
-
/**
|
|
379
|
-
* Tanstack Query Meta
|
|
380
|
-
*/
|
|
381
|
-
meta?: Record<string, unknown>;
|
|
382
|
-
|
|
383
|
-
/** An AbortSignal to set request's signal. */
|
|
384
|
-
signal?: AbortSignal | null;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
export interface RequestFnInfo
|
|
388
|
-
extends RequestFnPayload,
|
|
389
|
-
Omit<RequestInit, 'headers' | 'method' | 'body' | 'signal'> {
|
|
390
|
-
/**
|
|
391
|
-
* Request headers
|
|
392
|
-
* @example { 'X-Auth': '123' }
|
|
393
|
-
*/
|
|
394
|
-
readonly headers?: HeadersOptions;
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
export interface RequestFnOptions {
|
|
398
|
-
urlSerializer?: typeof urlSerializer;
|
|
399
|
-
bodySerializer?: typeof bodySerializer;
|
|
400
|
-
fetch?: typeof fetch;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
export type RequestFn<TData, TError> = typeof requestFn<TData, TError>;
|
|
404
|
-
|
|
405
|
-
export type RequestFnResponse<TData, TError> =
|
|
406
|
-
| {
|
|
407
|
-
data?: TData;
|
|
408
|
-
response: Response;
|
|
409
|
-
error?: never;
|
|
410
|
-
}
|
|
411
|
-
| {
|
|
412
|
-
// server error
|
|
413
|
-
error?: TError | Error;
|
|
414
|
-
response: Response;
|
|
415
|
-
data?: never;
|
|
416
|
-
}
|
|
417
|
-
| {
|
|
418
|
-
// network error
|
|
419
|
-
error?: Error;
|
|
420
|
-
data?: never;
|
|
421
|
-
response?: never;
|
|
422
|
-
};
|
|
423
|
-
|
|
424
323
|
type WithRequired<T, K extends keyof T> = T & {
|
|
425
324
|
[_ in K]: {};
|
|
426
325
|
};
|
|
326
|
+
|
|
327
|
+
export type {
|
|
328
|
+
RequestFn,
|
|
329
|
+
RequestFnResponse,
|
|
330
|
+
HeadersOptions,
|
|
331
|
+
RequestFnOptions,
|
|
332
|
+
RequestFnInfo,
|
|
333
|
+
OperationSchema,
|
|
334
|
+
} from '@openapi-qraft/tanstack-query-react-types';
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* @deprecated use `RequestFnInfo` instead
|
|
338
|
+
*/
|
|
339
|
+
export type RequestFnPayload = RequestFnInfo;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import type { ServiceOperationQueryKey } from '@openapi-qraft/tanstack-query-react-types';
|
|
3
4
|
import type { QueryClient } from '@tanstack/query-core';
|
|
4
5
|
import type { UseQueryOptions } from '@tanstack/react-query';
|
|
5
6
|
import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js';
|
|
6
|
-
import type { ServiceOperationQueryKey } from '../service-operation/ServiceOperationKey.js';
|
|
7
7
|
import type { OperationSchema } from './requestFn.js';
|
|
8
8
|
import { composeInfiniteQueryKey } from './composeInfiniteQueryKey.js';
|
|
9
9
|
import { composeQueryKey } from './composeQueryKey.js';
|
|
@@ -24,7 +24,6 @@ export function useComposeUseQueryOptions(
|
|
|
24
24
|
|
|
25
25
|
const queryFn =
|
|
26
26
|
options?.queryFn ??
|
|
27
|
-
// @ts-expect-error - Too complex to type
|
|
28
27
|
function ({ queryKey: [, queryParams], signal, meta, pageParam }) {
|
|
29
28
|
return qraftOptions
|
|
30
29
|
.requestFn(schema, {
|