@openapi-qraft/react 1.11.0-beta.1 → 1.11.0-beta.3
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 +12 -0
- package/dist/cjs/QraftContext.js +31 -0
- package/dist/cjs/QraftContext.js.map +1 -0
- package/dist/cjs/ServiceOperation.js +17 -0
- package/dist/cjs/ServiceOperation.js.map +1 -0
- package/dist/cjs/Unstable_QraftSecureRequestFn.js +214 -0
- package/dist/cjs/Unstable_QraftSecureRequestFn.js.map +1 -0
- package/dist/cjs/callbacks/cancelQueries.js +36 -0
- package/dist/cjs/callbacks/cancelQueries.js.map +1 -0
- package/dist/cjs/callbacks/fetchInfiniteQuery.js +37 -0
- package/dist/cjs/callbacks/fetchInfiniteQuery.js.map +1 -0
- package/dist/cjs/callbacks/fetchQuery.js +37 -0
- package/dist/cjs/callbacks/fetchQuery.js.map +1 -0
- package/dist/cjs/callbacks/getInfiniteQueryData.js +37 -0
- package/dist/cjs/callbacks/getInfiniteQueryData.js.map +1 -0
- package/dist/cjs/callbacks/getInfiniteQueryKey.js +32 -0
- package/dist/cjs/callbacks/getInfiniteQueryKey.js.map +1 -0
- package/dist/cjs/callbacks/getInfiniteQueryState.js +37 -0
- package/dist/cjs/callbacks/getInfiniteQueryState.js.map +1 -0
- package/dist/cjs/callbacks/getMutationKey.js +32 -0
- package/dist/cjs/callbacks/getMutationKey.js.map +1 -0
- package/dist/cjs/callbacks/getQueriesData.js +36 -0
- package/dist/cjs/callbacks/getQueriesData.js.map +1 -0
- package/dist/cjs/callbacks/getQueryData.js +37 -0
- package/dist/cjs/callbacks/getQueryData.js.map +1 -0
- package/dist/cjs/callbacks/getQueryKey.js +32 -0
- package/dist/cjs/callbacks/getQueryKey.js.map +1 -0
- package/dist/cjs/callbacks/getQueryState.js +37 -0
- package/dist/cjs/callbacks/getQueryState.js.map +1 -0
- package/dist/cjs/callbacks/index.js +131 -0
- package/dist/cjs/callbacks/index.js.map +1 -0
- package/dist/cjs/callbacks/invalidateQueries.js +36 -0
- package/dist/cjs/callbacks/invalidateQueries.js.map +1 -0
- package/dist/cjs/callbacks/isFetching.js +36 -0
- package/dist/cjs/callbacks/isFetching.js.map +1 -0
- package/dist/cjs/callbacks/isMutating.js +36 -0
- package/dist/cjs/callbacks/isMutating.js.map +1 -0
- package/dist/cjs/callbacks/mutationFn.js +35 -0
- package/dist/cjs/callbacks/mutationFn.js.map +1 -0
- package/dist/cjs/callbacks/operationInvokeFn.js +41 -0
- package/dist/cjs/callbacks/operationInvokeFn.js.map +1 -0
- package/dist/cjs/callbacks/prefetchInfiniteQuery.js +37 -0
- package/dist/cjs/callbacks/prefetchInfiniteQuery.js.map +1 -0
- package/dist/cjs/callbacks/prefetchQuery.js +37 -0
- package/dist/cjs/callbacks/prefetchQuery.js.map +1 -0
- package/dist/cjs/callbacks/queryFn.js +39 -0
- package/dist/cjs/callbacks/queryFn.js.map +1 -0
- package/dist/cjs/callbacks/refetchQueries.js +36 -0
- package/dist/cjs/callbacks/refetchQueries.js.map +1 -0
- package/dist/cjs/callbacks/removeQueries.js +36 -0
- package/dist/cjs/callbacks/removeQueries.js.map +1 -0
- package/dist/cjs/callbacks/resetQueries.js +36 -0
- package/dist/cjs/callbacks/resetQueries.js.map +1 -0
- package/dist/cjs/callbacks/setInfiniteQueryData.js +37 -0
- package/dist/cjs/callbacks/setInfiniteQueryData.js.map +1 -0
- package/dist/cjs/callbacks/setQueriesData.js +36 -0
- package/dist/cjs/callbacks/setQueriesData.js.map +1 -0
- package/dist/cjs/callbacks/setQueryData.js +37 -0
- package/dist/cjs/callbacks/setQueryData.js.map +1 -0
- package/dist/cjs/callbacks/useInfiniteQuery.js +36 -0
- package/dist/cjs/callbacks/useInfiniteQuery.js.map +1 -0
- package/dist/cjs/callbacks/useIsFetching.js +39 -0
- package/dist/cjs/callbacks/useIsFetching.js.map +1 -0
- package/dist/cjs/callbacks/useIsMutating.js +39 -0
- package/dist/cjs/callbacks/useIsMutating.js.map +1 -0
- package/dist/cjs/callbacks/useMutation.js +66 -0
- package/dist/cjs/callbacks/useMutation.js.map +1 -0
- package/dist/cjs/callbacks/useMutationState.js +42 -0
- package/dist/cjs/callbacks/useMutationState.js.map +1 -0
- package/dist/cjs/callbacks/useQueries.js +69 -0
- package/dist/cjs/callbacks/useQueries.js.map +1 -0
- package/dist/cjs/callbacks/useQuery.js +36 -0
- package/dist/cjs/callbacks/useQuery.js.map +1 -0
- package/dist/cjs/callbacks/useSuspenseInfiniteQuery.js +36 -0
- package/dist/cjs/callbacks/useSuspenseInfiniteQuery.js.map +1 -0
- package/dist/cjs/callbacks/useSuspenseQueries.js +69 -0
- package/dist/cjs/callbacks/useSuspenseQueries.js.map +1 -0
- package/dist/cjs/callbacks/useSuspenseQuery.js +36 -0
- package/dist/cjs/callbacks/useSuspenseQuery.js.map +1 -0
- package/dist/cjs/index.js +63 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/lib/PartialParameters.type.js +17 -0
- package/dist/cjs/lib/PartialParameters.type.js.map +1 -0
- package/dist/cjs/lib/callQueryClientFetchMethod.js +69 -0
- package/dist/cjs/lib/callQueryClientFetchMethod.js.map +1 -0
- package/dist/cjs/lib/callQueryClientMethodWithMutationFilters.js +42 -0
- package/dist/cjs/lib/callQueryClientMethodWithMutationFilters.js.map +1 -0
- package/dist/cjs/lib/callQueryClientMethodWithQueryFilters.js +42 -0
- package/dist/cjs/lib/callQueryClientMethodWithQueryFilters.js.map +1 -0
- package/dist/cjs/lib/callQueryClientMethodWithQueryKey.js +41 -0
- package/dist/cjs/lib/callQueryClientMethodWithQueryKey.js.map +1 -0
- package/dist/cjs/lib/composeBaseQueryKey.js +34 -0
- package/dist/cjs/lib/composeBaseQueryKey.js.map +1 -0
- package/dist/cjs/lib/composeInfiniteQueryKey.js +32 -0
- package/dist/cjs/lib/composeInfiniteQueryKey.js.map +1 -0
- package/dist/cjs/lib/composeMutationFilters.js +55 -0
- package/dist/cjs/lib/composeMutationFilters.js.map +1 -0
- package/dist/cjs/lib/composeMutationKey.js +52 -0
- package/dist/cjs/lib/composeMutationKey.js.map +1 -0
- package/dist/cjs/lib/composeQueryFilters.js +57 -0
- package/dist/cjs/lib/composeQueryFilters.js.map +1 -0
- package/dist/cjs/lib/composeQueryKey.js +32 -0
- package/dist/cjs/lib/composeQueryKey.js.map +1 -0
- package/dist/cjs/lib/createRecursiveProxy.js +49 -0
- package/dist/cjs/lib/createRecursiveProxy.js.map +1 -0
- package/dist/cjs/lib/jwt-decode/index.js +91 -0
- package/dist/cjs/lib/jwt-decode/index.js.map +1 -0
- package/dist/cjs/lib/requestFn.js +202 -0
- package/dist/cjs/lib/requestFn.js.map +1 -0
- package/dist/cjs/lib/shelfMerge.js +53 -0
- package/dist/cjs/lib/shelfMerge.js.map +1 -0
- package/dist/cjs/lib/useComposeUseQueryOptions.js +56 -0
- package/dist/cjs/lib/useComposeUseQueryOptions.js.map +1 -0
- package/dist/cjs/lib/useQueryClient.js +38 -0
- package/dist/cjs/lib/useQueryClient.js.map +1 -0
- package/dist/cjs/qraftAPIClient.js +77 -0
- package/dist/cjs/qraftAPIClient.js.map +1 -0
- package/dist/cjs/service-operation/OperationInfiniteData.js +17 -0
- package/dist/cjs/service-operation/OperationInfiniteData.js.map +1 -0
- package/dist/cjs/service-operation/QueryFilters.js +17 -0
- package/dist/cjs/service-operation/QueryFilters.js.map +1 -0
- package/dist/cjs/service-operation/ServiceOperation.js +17 -0
- package/dist/cjs/service-operation/ServiceOperation.js.map +1 -0
- package/dist/cjs/service-operation/ServiceOperationCancelQueries.js +17 -0
- package/dist/cjs/service-operation/ServiceOperationCancelQueries.js.map +1 -0
- package/dist/cjs/service-operation/ServiceOperationFetchInfiniteQuery.js +17 -0
- package/dist/cjs/service-operation/ServiceOperationFetchInfiniteQuery.js.map +1 -0
- package/dist/cjs/service-operation/ServiceOperationFetchQuery.js +17 -0
- package/dist/cjs/service-operation/ServiceOperationFetchQuery.js.map +1 -0
- package/dist/cjs/service-operation/ServiceOperationGetInfiniteQueryData.js +17 -0
- package/dist/cjs/service-operation/ServiceOperationGetInfiniteQueryData.js.map +1 -0
- package/dist/cjs/service-operation/ServiceOperationGetQueriesData.js +17 -0
- package/dist/cjs/service-operation/ServiceOperationGetQueriesData.js.map +1 -0
- package/dist/cjs/service-operation/ServiceOperationGetQueryData.js +17 -0
- package/dist/cjs/service-operation/ServiceOperationGetQueryData.js.map +1 -0
- package/dist/cjs/service-operation/ServiceOperationGetQueryState.js +17 -0
- package/dist/cjs/service-operation/ServiceOperationGetQueryState.js.map +1 -0
- package/dist/cjs/service-operation/ServiceOperationInvalidateQueries.js +17 -0
- package/dist/cjs/service-operation/ServiceOperationInvalidateQueries.js.map +1 -0
- package/dist/cjs/service-operation/ServiceOperationIsFetchingQueries.js +17 -0
- package/dist/cjs/service-operation/ServiceOperationIsFetchingQueries.js.map +1 -0
- package/dist/cjs/service-operation/ServiceOperationIsMutatingQueries.js +17 -0
- package/dist/cjs/service-operation/ServiceOperationIsMutatingQueries.js.map +1 -0
- package/dist/cjs/service-operation/ServiceOperationKey.js +17 -0
- package/dist/cjs/service-operation/ServiceOperationKey.js.map +1 -0
- package/dist/cjs/service-operation/ServiceOperationMutationFn.js +17 -0
- package/dist/cjs/service-operation/ServiceOperationMutationFn.js.map +1 -0
- package/dist/cjs/service-operation/ServiceOperationQueryFn.js +17 -0
- package/dist/cjs/service-operation/ServiceOperationQueryFn.js.map +1 -0
- package/dist/cjs/service-operation/ServiceOperationRefetchQueries.js +17 -0
- package/dist/cjs/service-operation/ServiceOperationRefetchQueries.js.map +1 -0
- package/dist/cjs/service-operation/ServiceOperationRemoveQueries.js +17 -0
- package/dist/cjs/service-operation/ServiceOperationRemoveQueries.js.map +1 -0
- package/dist/cjs/service-operation/ServiceOperationResetQueries.js +17 -0
- package/dist/cjs/service-operation/ServiceOperationResetQueries.js.map +1 -0
- package/dist/cjs/service-operation/ServiceOperationSetInfiniteQueryData.js +17 -0
- package/dist/cjs/service-operation/ServiceOperationSetInfiniteQueryData.js.map +1 -0
- package/dist/cjs/service-operation/ServiceOperationSetQueriesData.js +17 -0
- package/dist/cjs/service-operation/ServiceOperationSetQueriesData.js.map +1 -0
- package/dist/cjs/service-operation/ServiceOperationSetQueryData.js +17 -0
- package/dist/cjs/service-operation/ServiceOperationSetQueryData.js.map +1 -0
- package/dist/cjs/service-operation/ServiceOperationUseInfiniteQuery.js +17 -0
- package/dist/cjs/service-operation/ServiceOperationUseInfiniteQuery.js.map +1 -0
- package/dist/cjs/service-operation/ServiceOperationUseIsFetchingQueries.js +17 -0
- package/dist/cjs/service-operation/ServiceOperationUseIsFetchingQueries.js.map +1 -0
- package/dist/cjs/service-operation/ServiceOperationUseIsMutating.js +17 -0
- package/dist/cjs/service-operation/ServiceOperationUseIsMutating.js.map +1 -0
- package/dist/cjs/service-operation/ServiceOperationUseMutation.js +17 -0
- package/dist/cjs/service-operation/ServiceOperationUseMutation.js.map +1 -0
- package/dist/cjs/service-operation/ServiceOperationUseMutationState.js +17 -0
- package/dist/cjs/service-operation/ServiceOperationUseMutationState.js.map +1 -0
- package/dist/cjs/service-operation/ServiceOperationUseQueries.js +17 -0
- package/dist/cjs/service-operation/ServiceOperationUseQueries.js.map +1 -0
- package/dist/cjs/service-operation/ServiceOperationUseQuery.js +17 -0
- package/dist/cjs/service-operation/ServiceOperationUseQuery.js.map +1 -0
- package/dist/cjs/service-operation/ServiceOperationUseSuspenseInfiniteQuery.js +17 -0
- package/dist/cjs/service-operation/ServiceOperationUseSuspenseInfiniteQuery.js.map +1 -0
- package/dist/cjs/service-operation/ServiceOperationUseSuspenseQueries.js +17 -0
- package/dist/cjs/service-operation/ServiceOperationUseSuspenseQueries.js.map +1 -0
- package/dist/cjs/service-operation/ServiceOperationUseSuspenseQueryQuery.js +17 -0
- package/dist/cjs/service-operation/ServiceOperationUseSuspenseQueryQuery.js.map +1 -0
- package/dist/cjs/service-operation/index.js +17 -0
- package/dist/cjs/service-operation/index.js.map +1 -0
- package/dist/esm/QraftContext.js +7 -0
- package/dist/esm/QraftContext.js.map +1 -0
- package/dist/esm/ServiceOperation.js +1 -0
- package/dist/esm/ServiceOperation.js.map +1 -0
- package/dist/esm/Unstable_QraftSecureRequestFn.js +190 -0
- package/dist/esm/Unstable_QraftSecureRequestFn.js.map +1 -0
- package/dist/esm/callbacks/cancelQueries.js +12 -0
- package/dist/esm/callbacks/cancelQueries.js.map +1 -0
- package/dist/esm/callbacks/fetchInfiniteQuery.js +13 -0
- package/dist/esm/callbacks/fetchInfiniteQuery.js.map +1 -0
- package/dist/esm/callbacks/fetchQuery.js +13 -0
- package/dist/esm/callbacks/fetchQuery.js.map +1 -0
- package/dist/esm/callbacks/getInfiniteQueryData.js +13 -0
- package/dist/esm/callbacks/getInfiniteQueryData.js.map +1 -0
- package/dist/esm/callbacks/getInfiniteQueryKey.js +8 -0
- package/dist/esm/callbacks/getInfiniteQueryKey.js.map +1 -0
- package/dist/esm/callbacks/getInfiniteQueryState.js +13 -0
- package/dist/esm/callbacks/getInfiniteQueryState.js.map +1 -0
- package/dist/esm/callbacks/getMutationKey.js +8 -0
- package/dist/esm/callbacks/getMutationKey.js.map +1 -0
- package/dist/esm/callbacks/getQueriesData.js +12 -0
- package/dist/esm/callbacks/getQueriesData.js.map +1 -0
- package/dist/esm/callbacks/getQueryData.js +13 -0
- package/dist/esm/callbacks/getQueryData.js.map +1 -0
- package/dist/esm/callbacks/getQueryKey.js +8 -0
- package/dist/esm/callbacks/getQueryKey.js.map +1 -0
- package/dist/esm/callbacks/getQueryState.js +13 -0
- package/dist/esm/callbacks/getQueryState.js.map +1 -0
- package/dist/esm/callbacks/index.js +73 -0
- package/dist/esm/callbacks/index.js.map +1 -0
- package/dist/esm/callbacks/invalidateQueries.js +12 -0
- package/dist/esm/callbacks/invalidateQueries.js.map +1 -0
- package/dist/esm/callbacks/isFetching.js +12 -0
- package/dist/esm/callbacks/isFetching.js.map +1 -0
- package/dist/esm/callbacks/isMutating.js +12 -0
- package/dist/esm/callbacks/isMutating.js.map +1 -0
- package/dist/esm/callbacks/mutationFn.js +11 -0
- package/dist/esm/callbacks/mutationFn.js.map +1 -0
- package/dist/esm/callbacks/operationInvokeFn.js +17 -0
- package/dist/esm/callbacks/operationInvokeFn.js.map +1 -0
- package/dist/esm/callbacks/prefetchInfiniteQuery.js +13 -0
- package/dist/esm/callbacks/prefetchInfiniteQuery.js.map +1 -0
- package/dist/esm/callbacks/prefetchQuery.js +13 -0
- package/dist/esm/callbacks/prefetchQuery.js.map +1 -0
- package/dist/esm/callbacks/queryFn.js +15 -0
- package/dist/esm/callbacks/queryFn.js.map +1 -0
- package/dist/esm/callbacks/refetchQueries.js +12 -0
- package/dist/esm/callbacks/refetchQueries.js.map +1 -0
- package/dist/esm/callbacks/removeQueries.js +12 -0
- package/dist/esm/callbacks/removeQueries.js.map +1 -0
- package/dist/esm/callbacks/resetQueries.js +12 -0
- package/dist/esm/callbacks/resetQueries.js.map +1 -0
- package/dist/esm/callbacks/setInfiniteQueryData.js +13 -0
- package/dist/esm/callbacks/setInfiniteQueryData.js.map +1 -0
- package/dist/esm/callbacks/setQueriesData.js +12 -0
- package/dist/esm/callbacks/setQueriesData.js.map +1 -0
- package/dist/esm/callbacks/setQueryData.js +13 -0
- package/dist/esm/callbacks/setQueryData.js.map +1 -0
- package/dist/esm/callbacks/useInfiniteQuery.js +14 -0
- package/dist/esm/callbacks/useInfiniteQuery.js.map +1 -0
- package/dist/esm/callbacks/useIsFetching.js +15 -0
- package/dist/esm/callbacks/useIsFetching.js.map +1 -0
- package/dist/esm/callbacks/useIsMutating.js +17 -0
- package/dist/esm/callbacks/useIsMutating.js.map +1 -0
- package/dist/esm/callbacks/useMutation.js +44 -0
- package/dist/esm/callbacks/useMutation.js.map +1 -0
- package/dist/esm/callbacks/useMutationState.js +20 -0
- package/dist/esm/callbacks/useMutationState.js.map +1 -0
- package/dist/esm/callbacks/useQueries.js +47 -0
- package/dist/esm/callbacks/useQueries.js.map +1 -0
- package/dist/esm/callbacks/useQuery.js +14 -0
- package/dist/esm/callbacks/useQuery.js.map +1 -0
- package/dist/esm/callbacks/useSuspenseInfiniteQuery.js +14 -0
- package/dist/esm/callbacks/useSuspenseInfiniteQuery.js.map +1 -0
- package/dist/esm/callbacks/useSuspenseQueries.js +47 -0
- package/dist/esm/callbacks/useSuspenseQueries.js.map +1 -0
- package/dist/esm/callbacks/useSuspenseQuery.js +14 -0
- package/dist/esm/callbacks/useSuspenseQuery.js.map +1 -0
- package/dist/esm/index.js +15 -1206
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/PartialParameters.type.js +1 -0
- package/dist/esm/lib/PartialParameters.type.js.map +1 -0
- package/dist/esm/lib/callQueryClientFetchMethod.js +45 -0
- package/dist/esm/lib/callQueryClientFetchMethod.js.map +1 -0
- package/dist/esm/lib/callQueryClientMethodWithMutationFilters.js +18 -0
- package/dist/esm/lib/callQueryClientMethodWithMutationFilters.js.map +1 -0
- package/dist/esm/lib/callQueryClientMethodWithQueryFilters.js +18 -0
- package/dist/esm/lib/callQueryClientMethodWithQueryFilters.js.map +1 -0
- package/dist/esm/lib/callQueryClientMethodWithQueryKey.js +17 -0
- package/dist/esm/lib/callQueryClientMethodWithQueryKey.js.map +1 -0
- package/dist/esm/lib/composeBaseQueryKey.js +10 -0
- package/dist/esm/lib/composeBaseQueryKey.js.map +1 -0
- package/dist/esm/lib/composeInfiniteQueryKey.js +8 -0
- package/dist/esm/lib/composeInfiniteQueryKey.js.map +1 -0
- package/dist/esm/lib/composeMutationFilters.js +31 -0
- package/dist/esm/lib/composeMutationFilters.js.map +1 -0
- package/dist/esm/lib/composeMutationKey.js +27 -0
- package/dist/esm/lib/composeMutationKey.js.map +1 -0
- package/dist/esm/lib/composeQueryFilters.js +33 -0
- package/dist/esm/lib/composeQueryFilters.js.map +1 -0
- package/dist/esm/lib/composeQueryKey.js +8 -0
- package/dist/esm/lib/composeQueryKey.js.map +1 -0
- package/dist/esm/lib/createRecursiveProxy.js +25 -0
- package/dist/esm/lib/createRecursiveProxy.js.map +1 -0
- package/dist/esm/lib/jwt-decode/index.js +65 -0
- package/dist/esm/lib/jwt-decode/index.js.map +1 -0
- package/dist/esm/lib/requestFn.js +174 -0
- package/dist/esm/lib/requestFn.js.map +1 -0
- package/dist/esm/lib/shelfMerge.js +29 -0
- package/dist/esm/lib/shelfMerge.js.map +1 -0
- package/dist/esm/lib/useComposeUseQueryOptions.js +32 -0
- package/dist/esm/lib/useComposeUseQueryOptions.js.map +1 -0
- package/dist/esm/lib/useQueryClient.js +16 -0
- package/dist/esm/lib/useQueryClient.js.map +1 -0
- package/dist/esm/qraftAPIClient.js +53 -0
- package/dist/esm/qraftAPIClient.js.map +1 -0
- package/dist/esm/service-operation/OperationInfiniteData.js +1 -0
- package/dist/esm/service-operation/OperationInfiniteData.js.map +1 -0
- package/dist/esm/service-operation/QueryFilters.js +1 -0
- package/dist/esm/service-operation/QueryFilters.js.map +1 -0
- package/dist/esm/service-operation/ServiceOperation.js +1 -0
- package/dist/esm/service-operation/ServiceOperation.js.map +1 -0
- package/dist/esm/service-operation/ServiceOperationCancelQueries.js +1 -0
- package/dist/esm/service-operation/ServiceOperationCancelQueries.js.map +1 -0
- package/dist/esm/service-operation/ServiceOperationFetchInfiniteQuery.js +1 -0
- package/dist/esm/service-operation/ServiceOperationFetchInfiniteQuery.js.map +1 -0
- package/dist/esm/service-operation/ServiceOperationFetchQuery.js +1 -0
- package/dist/esm/service-operation/ServiceOperationFetchQuery.js.map +1 -0
- package/dist/esm/service-operation/ServiceOperationGetInfiniteQueryData.js +1 -0
- package/dist/esm/service-operation/ServiceOperationGetInfiniteQueryData.js.map +1 -0
- package/dist/esm/service-operation/ServiceOperationGetQueriesData.js +1 -0
- package/dist/esm/service-operation/ServiceOperationGetQueriesData.js.map +1 -0
- package/dist/esm/service-operation/ServiceOperationGetQueryData.js +1 -0
- package/dist/esm/service-operation/ServiceOperationGetQueryData.js.map +1 -0
- package/dist/esm/service-operation/ServiceOperationGetQueryState.js +1 -0
- package/dist/esm/service-operation/ServiceOperationGetQueryState.js.map +1 -0
- package/dist/esm/service-operation/ServiceOperationInvalidateQueries.js +1 -0
- package/dist/esm/service-operation/ServiceOperationInvalidateQueries.js.map +1 -0
- package/dist/esm/service-operation/ServiceOperationIsFetchingQueries.js +1 -0
- package/dist/esm/service-operation/ServiceOperationIsFetchingQueries.js.map +1 -0
- package/dist/esm/service-operation/ServiceOperationIsMutatingQueries.js +1 -0
- package/dist/esm/service-operation/ServiceOperationIsMutatingQueries.js.map +1 -0
- package/dist/esm/service-operation/ServiceOperationKey.js +1 -0
- package/dist/esm/service-operation/ServiceOperationKey.js.map +1 -0
- package/dist/esm/service-operation/ServiceOperationMutationFn.js +1 -0
- package/dist/esm/service-operation/ServiceOperationMutationFn.js.map +1 -0
- package/dist/esm/service-operation/ServiceOperationQueryFn.js +1 -0
- package/dist/esm/service-operation/ServiceOperationQueryFn.js.map +1 -0
- package/dist/esm/service-operation/ServiceOperationRefetchQueries.js +1 -0
- package/dist/esm/service-operation/ServiceOperationRefetchQueries.js.map +1 -0
- package/dist/esm/service-operation/ServiceOperationRemoveQueries.js +1 -0
- package/dist/esm/service-operation/ServiceOperationRemoveQueries.js.map +1 -0
- package/dist/esm/service-operation/ServiceOperationResetQueries.js +1 -0
- package/dist/esm/service-operation/ServiceOperationResetQueries.js.map +1 -0
- package/dist/esm/service-operation/ServiceOperationSetInfiniteQueryData.js +1 -0
- package/dist/esm/service-operation/ServiceOperationSetInfiniteQueryData.js.map +1 -0
- package/dist/esm/service-operation/ServiceOperationSetQueriesData.js +1 -0
- package/dist/esm/service-operation/ServiceOperationSetQueriesData.js.map +1 -0
- package/dist/esm/service-operation/ServiceOperationSetQueryData.js +1 -0
- package/dist/esm/service-operation/ServiceOperationSetQueryData.js.map +1 -0
- package/dist/esm/service-operation/ServiceOperationUseInfiniteQuery.js +1 -0
- package/dist/esm/service-operation/ServiceOperationUseInfiniteQuery.js.map +1 -0
- package/dist/esm/service-operation/ServiceOperationUseIsFetchingQueries.js +1 -0
- package/dist/esm/service-operation/ServiceOperationUseIsFetchingQueries.js.map +1 -0
- package/dist/esm/service-operation/ServiceOperationUseIsMutating.js +1 -0
- package/dist/esm/service-operation/ServiceOperationUseIsMutating.js.map +1 -0
- package/dist/esm/service-operation/ServiceOperationUseMutation.js +1 -0
- package/dist/esm/service-operation/ServiceOperationUseMutation.js.map +1 -0
- package/dist/esm/service-operation/ServiceOperationUseMutationState.js +1 -0
- package/dist/esm/service-operation/ServiceOperationUseMutationState.js.map +1 -0
- package/dist/esm/service-operation/ServiceOperationUseQueries.js +1 -0
- package/dist/esm/service-operation/ServiceOperationUseQueries.js.map +1 -0
- package/dist/esm/service-operation/ServiceOperationUseQuery.js +1 -0
- package/dist/esm/service-operation/ServiceOperationUseQuery.js.map +1 -0
- package/dist/esm/service-operation/ServiceOperationUseSuspenseInfiniteQuery.js +1 -0
- package/dist/esm/service-operation/ServiceOperationUseSuspenseInfiniteQuery.js.map +1 -0
- package/dist/esm/service-operation/ServiceOperationUseSuspenseQueries.js +1 -0
- package/dist/esm/service-operation/ServiceOperationUseSuspenseQueries.js.map +1 -0
- package/dist/esm/service-operation/ServiceOperationUseSuspenseQueryQuery.js +1 -0
- package/dist/esm/service-operation/ServiceOperationUseSuspenseQueryQuery.js.map +1 -0
- package/dist/esm/service-operation/index.js +1 -0
- package/dist/esm/service-operation/index.js.map +1 -0
- package/dist/types/QraftContext.d.ts +20 -0
- package/dist/types/QraftContext.d.ts.map +1 -0
- package/dist/types/ServiceOperation.d.ts +44 -0
- package/dist/types/ServiceOperation.d.ts.map +1 -0
- package/dist/types/Unstable_QraftSecureRequestFn.d.ts +81 -0
- package/dist/types/Unstable_QraftSecureRequestFn.d.ts.map +1 -0
- package/dist/types/callbacks/cancelQueries.d.ts +5 -0
- package/dist/types/callbacks/cancelQueries.d.ts.map +1 -0
- package/dist/types/callbacks/fetchInfiniteQuery.d.ts +7 -0
- package/dist/types/callbacks/fetchInfiniteQuery.d.ts.map +1 -0
- package/dist/types/callbacks/fetchQuery.d.ts +7 -0
- package/dist/types/callbacks/fetchQuery.d.ts.map +1 -0
- package/dist/types/callbacks/getInfiniteQueryData.d.ts +6 -0
- package/dist/types/callbacks/getInfiniteQueryData.d.ts.map +1 -0
- package/dist/types/callbacks/getInfiniteQueryKey.d.ts +5 -0
- package/dist/types/callbacks/getInfiniteQueryKey.d.ts.map +1 -0
- package/dist/types/callbacks/getInfiniteQueryState.d.ts +5 -0
- package/dist/types/callbacks/getInfiniteQueryState.d.ts.map +1 -0
- package/dist/types/callbacks/getMutationKey.d.ts +5 -0
- package/dist/types/callbacks/getMutationKey.d.ts.map +1 -0
- package/dist/types/callbacks/getQueriesData.d.ts +5 -0
- package/dist/types/callbacks/getQueriesData.d.ts.map +1 -0
- package/dist/types/callbacks/getQueryData.d.ts +5 -0
- package/dist/types/callbacks/getQueryData.d.ts.map +1 -0
- package/dist/types/callbacks/getQueryKey.d.ts +5 -0
- package/dist/types/callbacks/getQueryKey.d.ts.map +1 -0
- package/dist/types/callbacks/getQueryState.d.ts +5 -0
- package/dist/types/callbacks/getQueryState.d.ts.map +1 -0
- package/dist/types/callbacks/index.d.ts +36 -0
- package/dist/types/callbacks/index.d.ts.map +1 -0
- package/dist/types/callbacks/invalidateQueries.d.ts +5 -0
- package/dist/types/callbacks/invalidateQueries.d.ts.map +1 -0
- package/dist/types/callbacks/isFetching.d.ts +5 -0
- package/dist/types/callbacks/isFetching.d.ts.map +1 -0
- package/dist/types/callbacks/isMutating.d.ts +5 -0
- package/dist/types/callbacks/isMutating.d.ts.map +1 -0
- package/dist/types/callbacks/mutationFn.d.ts +4 -0
- package/dist/types/callbacks/mutationFn.d.ts.map +1 -0
- package/dist/types/callbacks/operationInvokeFn.d.ts +9 -0
- package/dist/types/callbacks/operationInvokeFn.d.ts.map +1 -0
- package/dist/types/callbacks/prefetchInfiniteQuery.d.ts +7 -0
- package/dist/types/callbacks/prefetchInfiniteQuery.d.ts.map +1 -0
- package/dist/types/callbacks/prefetchQuery.d.ts +7 -0
- package/dist/types/callbacks/prefetchQuery.d.ts.map +1 -0
- package/dist/types/callbacks/queryFn.d.ts +7 -0
- package/dist/types/callbacks/queryFn.d.ts.map +1 -0
- package/dist/types/callbacks/refetchQueries.d.ts +5 -0
- package/dist/types/callbacks/refetchQueries.d.ts.map +1 -0
- package/dist/types/callbacks/removeQueries.d.ts +5 -0
- package/dist/types/callbacks/removeQueries.d.ts.map +1 -0
- package/dist/types/callbacks/resetQueries.d.ts +5 -0
- package/dist/types/callbacks/resetQueries.d.ts.map +1 -0
- package/dist/types/callbacks/setInfiniteQueryData.d.ts +6 -0
- package/dist/types/callbacks/setInfiniteQueryData.d.ts.map +1 -0
- package/dist/types/callbacks/setQueriesData.d.ts +5 -0
- package/dist/types/callbacks/setQueriesData.d.ts.map +1 -0
- package/dist/types/callbacks/setQueryData.d.ts +5 -0
- package/dist/types/callbacks/setQueryData.d.ts.map +1 -0
- package/dist/types/callbacks/useInfiniteQuery.d.ts +7 -0
- package/dist/types/callbacks/useInfiniteQuery.d.ts.map +1 -0
- package/dist/types/callbacks/useIsFetching.d.ts +5 -0
- package/dist/types/callbacks/useIsFetching.d.ts.map +1 -0
- package/dist/types/callbacks/useIsMutating.d.ts +7 -0
- package/dist/types/callbacks/useIsMutating.d.ts.map +1 -0
- package/dist/types/callbacks/useMutation.d.ts +7 -0
- package/dist/types/callbacks/useMutation.d.ts.map +1 -0
- package/dist/types/callbacks/useMutationState.d.ts +7 -0
- package/dist/types/callbacks/useMutationState.d.ts.map +1 -0
- package/dist/types/callbacks/useQueries.d.ts +6 -0
- package/dist/types/callbacks/useQueries.d.ts.map +1 -0
- package/dist/types/callbacks/useQuery.d.ts +7 -0
- package/dist/types/callbacks/useQuery.d.ts.map +1 -0
- package/dist/types/callbacks/useSuspenseInfiniteQuery.d.ts +7 -0
- package/dist/types/callbacks/useSuspenseInfiniteQuery.d.ts.map +1 -0
- package/dist/types/callbacks/useSuspenseQueries.d.ts +6 -0
- package/dist/types/callbacks/useSuspenseQueries.d.ts.map +1 -0
- package/dist/types/callbacks/useSuspenseQuery.d.ts +7 -0
- package/dist/types/callbacks/useSuspenseQuery.d.ts.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/lib/PartialParameters.type.d.ts +13 -0
- package/dist/types/lib/PartialParameters.type.d.ts.map +1 -0
- package/dist/types/lib/callQueryClientFetchMethod.d.ts +20 -0
- package/dist/types/lib/callQueryClientFetchMethod.d.ts.map +1 -0
- package/dist/types/lib/callQueryClientMethodWithMutationFilters.d.ts +11 -0
- package/dist/types/lib/callQueryClientMethodWithMutationFilters.d.ts.map +1 -0
- package/dist/types/lib/callQueryClientMethodWithQueryFilters.d.ts +11 -0
- package/dist/types/lib/callQueryClientMethodWithQueryFilters.d.ts.map +1 -0
- package/dist/types/lib/callQueryClientMethodWithQueryKey.d.ts +11 -0
- package/dist/types/lib/callQueryClientMethodWithQueryKey.d.ts.map +1 -0
- package/dist/types/lib/composeBaseQueryKey.d.ts +6 -0
- package/dist/types/lib/composeBaseQueryKey.d.ts.map +1 -0
- package/dist/types/lib/composeInfiniteQueryKey.d.ts +4 -0
- package/dist/types/lib/composeInfiniteQueryKey.d.ts.map +1 -0
- package/dist/types/lib/composeMutationFilters.d.ts +11 -0
- package/dist/types/lib/composeMutationFilters.d.ts.map +1 -0
- package/dist/types/lib/composeMutationKey.d.ts +10 -0
- package/dist/types/lib/composeMutationKey.d.ts.map +1 -0
- package/dist/types/lib/composeQueryFilters.d.ts +14 -0
- package/dist/types/lib/composeQueryFilters.d.ts.map +1 -0
- package/dist/types/lib/composeQueryKey.d.ts +4 -0
- package/dist/types/lib/composeQueryKey.d.ts.map +1 -0
- package/dist/types/lib/createRecursiveProxy.d.ts +15 -0
- package/dist/types/lib/createRecursiveProxy.d.ts.map +1 -0
- package/dist/types/lib/jwt-decode/index.d.ts +29 -0
- package/dist/types/lib/jwt-decode/index.d.ts.map +1 -0
- package/dist/types/lib/jwt-decode/index.test.d.ts +2 -0
- package/dist/types/lib/jwt-decode/index.test.d.ts.map +1 -0
- package/dist/types/lib/requestFn.d.ts +100 -0
- package/dist/types/lib/requestFn.d.ts.map +1 -0
- package/dist/types/lib/shelfMerge.d.ts +7 -0
- package/dist/types/lib/shelfMerge.d.ts.map +1 -0
- package/dist/types/lib/useComposeUseQueryOptions.d.ts +16 -0
- package/dist/types/lib/useComposeUseQueryOptions.d.ts.map +1 -0
- package/dist/types/lib/useQueryClient.d.ts +9 -0
- package/dist/types/lib/useQueryClient.d.ts.map +1 -0
- package/dist/types/qraftAPIClient.d.ts +24 -0
- package/dist/types/qraftAPIClient.d.ts.map +1 -0
- package/dist/types/service-operation/OperationInfiniteData.d.ts +4 -0
- package/dist/types/service-operation/OperationInfiniteData.d.ts.map +1 -0
- package/dist/types/service-operation/QueryFilters.d.ts +123 -0
- package/dist/types/service-operation/QueryFilters.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperation.d.ts +53 -0
- package/dist/types/service-operation/ServiceOperation.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationCancelQueries.d.ts +20 -0
- package/dist/types/service-operation/ServiceOperationCancelQueries.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationFetchInfiniteQuery.d.ts +58 -0
- package/dist/types/service-operation/ServiceOperationFetchInfiniteQuery.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationFetchQuery.d.ts +49 -0
- package/dist/types/service-operation/ServiceOperationFetchQuery.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationGetInfiniteQueryData.d.ts +10 -0
- package/dist/types/service-operation/ServiceOperationGetInfiniteQueryData.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationGetQueriesData.d.ts +18 -0
- package/dist/types/service-operation/ServiceOperationGetQueriesData.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationGetQueryData.d.ts +9 -0
- package/dist/types/service-operation/ServiceOperationGetQueryData.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationGetQueryState.d.ts +11 -0
- package/dist/types/service-operation/ServiceOperationGetQueryState.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationInvalidateQueries.d.ts +26 -0
- package/dist/types/service-operation/ServiceOperationInvalidateQueries.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationIsFetchingQueries.d.ts +19 -0
- package/dist/types/service-operation/ServiceOperationIsFetchingQueries.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationIsMutatingQueries.d.ts +19 -0
- package/dist/types/service-operation/ServiceOperationIsMutatingQueries.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationKey.d.ts +16 -0
- package/dist/types/service-operation/ServiceOperationKey.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationMutationFn.d.ts +47 -0
- package/dist/types/service-operation/ServiceOperationMutationFn.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationQueryFn.d.ts +79 -0
- package/dist/types/service-operation/ServiceOperationQueryFn.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationRefetchQueries.d.ts +30 -0
- package/dist/types/service-operation/ServiceOperationRefetchQueries.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationRemoveQueries.d.ts +19 -0
- package/dist/types/service-operation/ServiceOperationRemoveQueries.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationResetQueries.d.ts +20 -0
- package/dist/types/service-operation/ServiceOperationResetQueries.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationSetInfiniteQueryData.d.ts +10 -0
- package/dist/types/service-operation/ServiceOperationSetInfiniteQueryData.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationSetQueriesData.d.ts +20 -0
- package/dist/types/service-operation/ServiceOperationSetQueriesData.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationSetQueryData.d.ts +19 -0
- package/dist/types/service-operation/ServiceOperationSetQueryData.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationUseInfiniteQuery.d.ts +14 -0
- package/dist/types/service-operation/ServiceOperationUseInfiniteQuery.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationUseIsFetchingQueries.d.ts +9 -0
- package/dist/types/service-operation/ServiceOperationUseIsFetchingQueries.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationUseIsMutating.d.ts +9 -0
- package/dist/types/service-operation/ServiceOperationUseIsMutating.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationUseMutation.d.ts +17 -0
- package/dist/types/service-operation/ServiceOperationUseMutation.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationUseMutationState.d.ts +46 -0
- package/dist/types/service-operation/ServiceOperationUseMutationState.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationUseQueries.d.ts +20 -0
- package/dist/types/service-operation/ServiceOperationUseQueries.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationUseQuery.d.ts +12 -0
- package/dist/types/service-operation/ServiceOperationUseQuery.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationUseSuspenseInfiniteQuery.d.ts +12 -0
- package/dist/types/service-operation/ServiceOperationUseSuspenseInfiniteQuery.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationUseSuspenseQueries.d.ts +18 -0
- package/dist/types/service-operation/ServiceOperationUseSuspenseQueries.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationUseSuspenseQueryQuery.d.ts +10 -0
- package/dist/types/service-operation/ServiceOperationUseSuspenseQueryQuery.d.ts.map +1 -0
- package/dist/types/service-operation/index.d.ts +2 -0
- package/dist/types/service-operation/index.d.ts.map +1 -0
- package/package.json +10 -15
- package/src/index.ts +1 -1
- package/dist/cjs/index.cjs +0 -1267
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/cjs/index.d.cts +0 -1035
- package/dist/esm/index.d.ts +0 -1035
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var composeMutationKey_exports = {};
|
|
20
|
+
__export(composeMutationKey_exports, {
|
|
21
|
+
composeMutationKey: () => composeMutationKey,
|
|
22
|
+
omitMutationPayload: () => omitMutationPayload
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(composeMutationKey_exports);
|
|
25
|
+
function composeMutationKey(schema, parameters) {
|
|
26
|
+
return parameters === void 0 ? [{ url: schema.url, method: schema.method }, {}] : [
|
|
27
|
+
{
|
|
28
|
+
url: schema.url,
|
|
29
|
+
method: schema.method
|
|
30
|
+
},
|
|
31
|
+
omitMutationPayload(parameters)
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
function omitMutationPayload(params) {
|
|
35
|
+
if (!params || typeof params !== "object")
|
|
36
|
+
throw new Error("`params` must be object");
|
|
37
|
+
if ("body" in params || "requestBody" in params) {
|
|
38
|
+
const {
|
|
39
|
+
body: _,
|
|
40
|
+
requestBody: __,
|
|
41
|
+
...paramsRest
|
|
42
|
+
} = params;
|
|
43
|
+
return paramsRest;
|
|
44
|
+
}
|
|
45
|
+
return params;
|
|
46
|
+
}
|
|
47
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
+
0 && (module.exports = {
|
|
49
|
+
composeMutationKey,
|
|
50
|
+
omitMutationPayload
|
|
51
|
+
});
|
|
52
|
+
//# sourceMappingURL=composeMutationKey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/composeMutationKey.ts"],"sourcesContent":["import type { ServiceOperationMutationKey } from '../service-operation/ServiceOperationKey.js';\nimport type { OperationSchema } from './requestFn.js';\n\n/**\n * Omit `body` or `requestBody` from mutation parameters if exists\n * and return the rest of the parameters\n */\nexport function composeMutationKey<TSchema extends OperationSchema>(\n schema: TSchema,\n parameters: undefined\n): ServiceOperationMutationKey<TSchema, undefined>;\nexport function composeMutationKey<TSchema extends OperationSchema, TParams>(\n schema: TSchema,\n parameters: TParams\n): ServiceOperationMutationKey<TSchema, TParams>;\nexport function composeMutationKey<\n TSchema extends OperationSchema,\n TParams = unknown,\n>(schema: TSchema, parameters: TParams | undefined) {\n return parameters === undefined\n ? [{ url: schema.url, method: schema.method }, {}]\n : [\n {\n url: schema.url,\n method: schema.method,\n },\n omitMutationPayload(parameters),\n ];\n}\n\nexport function omitMutationPayload<T>(params: T) {\n if (!params || typeof params !== 'object')\n throw new Error('`params` must be object');\n\n if ('body' in params || 'requestBody' in params) {\n const {\n body: _,\n requestBody: __,\n ...paramsRest\n } = params as Record<'body' | 'requestBody', unknown>;\n return paramsRest;\n }\n\n return params as Omit<T, 'body' | 'requestBody'>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAeO,SAAS,mBAGd,QAAiB,YAAiC;AAClD,SAAO,eAAe,SAClB,CAAC,EAAE,KAAK,OAAO,KAAK,QAAQ,OAAO,OAAO,GAAG,CAAC,CAAC,IAC/C;AAAA,IACE;AAAA,MACE,KAAK,OAAO;AAAA,MACZ,QAAQ,OAAO;AAAA,IACjB;AAAA,IACA,oBAAoB,UAAU;AAAA,EAChC;AACN;AAEO,SAAS,oBAAuB,QAAW;AAChD,MAAI,CAAC,UAAU,OAAO,WAAW;AAC/B,UAAM,IAAI,MAAM,yBAAyB;AAE3C,MAAI,UAAU,UAAU,iBAAiB,QAAQ;AAC/C,UAAM;AAAA,MACJ,MAAM;AAAA,MACN,aAAa;AAAA,MACb,GAAG;AAAA,IACL,IAAI;AACJ,WAAO;AAAA,EACT;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var composeQueryFilters_exports = {};
|
|
20
|
+
__export(composeQueryFilters_exports, {
|
|
21
|
+
composeQueryFilters: () => composeQueryFilters
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(composeQueryFilters_exports);
|
|
24
|
+
var import_composeBaseQueryKey = require("./composeBaseQueryKey.js");
|
|
25
|
+
var import_composeInfiniteQueryKey = require("./composeInfiniteQueryKey.js");
|
|
26
|
+
var import_composeQueryKey = require("./composeQueryKey.js");
|
|
27
|
+
function composeQueryFilters(schema, filters) {
|
|
28
|
+
if (!filters) {
|
|
29
|
+
return {
|
|
30
|
+
queryKey: (0, import_composeBaseQueryKey.composeBaseQueryKey)(schema, void 0, void 0)
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
if ("queryKey" in filters && "parameters" in filters) {
|
|
34
|
+
throw new Error(
|
|
35
|
+
`'composeQueryFilters': 'queryKey' and 'parameters' cannot be used together`
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
const { infinite, parameters, ...filtersRest } = filters;
|
|
39
|
+
if ("queryKey" in filtersRest) {
|
|
40
|
+
return filtersRest;
|
|
41
|
+
}
|
|
42
|
+
if (parameters) {
|
|
43
|
+
Object.assign(filtersRest, {
|
|
44
|
+
queryKey: infinite ? (0, import_composeInfiniteQueryKey.composeInfiniteQueryKey)(schema, parameters) : (0, import_composeQueryKey.composeQueryKey)(schema, parameters)
|
|
45
|
+
});
|
|
46
|
+
return filtersRest;
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
...filtersRest,
|
|
50
|
+
queryKey: infinite ? (0, import_composeInfiniteQueryKey.composeInfiniteQueryKey)(schema, void 0) : (0, import_composeQueryKey.composeQueryKey)(schema, void 0)
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
54
|
+
0 && (module.exports = {
|
|
55
|
+
composeQueryFilters
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=composeQueryFilters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/composeQueryFilters.ts"],"sourcesContent":["import { composeBaseQueryKey } from './composeBaseQueryKey.js';\nimport { composeInfiniteQueryKey } from './composeInfiniteQueryKey.js';\nimport { composeQueryKey } from './composeQueryKey.js';\nimport type { OperationSchema } from './requestFn.js';\n\n/**\n * Replaces the `parameters` field in the filters with a `queryKey` field based on the schema.\n * If no filters are provided, a `queryKey` will be composed schema's base query key.\n * @param schema\n * @param filters\n */\nexport function composeQueryFilters<\n Filters extends {\n infinite: boolean;\n parameters?: object;\n } & Record<string, unknown>,\n>(schema: OperationSchema, filters: Filters | undefined) {\n if (!filters) {\n return {\n queryKey: composeBaseQueryKey(schema, undefined, undefined),\n };\n }\n\n if ('queryKey' in filters && 'parameters' in filters) {\n throw new Error(\n `'composeQueryFilters': 'queryKey' and 'parameters' cannot be used together`\n );\n }\n\n const { infinite, parameters, ...filtersRest } = filters;\n\n if ('queryKey' in filtersRest) {\n return filtersRest;\n }\n\n if (parameters) {\n Object.assign(filtersRest, {\n queryKey: infinite\n ? composeInfiniteQueryKey(schema, parameters)\n : composeQueryKey(schema, parameters),\n });\n\n return filtersRest;\n }\n\n return {\n ...filtersRest,\n queryKey: infinite\n ? composeInfiniteQueryKey(schema, undefined)\n : composeQueryKey(schema, undefined),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iCAAoC;AACpC,qCAAwC;AACxC,6BAAgC;AASzB,SAAS,oBAKd,QAAyB,SAA8B;AACvD,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,MACL,cAAU,gDAAoB,QAAQ,QAAW,MAAS;AAAA,IAC5D;AAAA,EACF;AAEA,MAAI,cAAc,WAAW,gBAAgB,SAAS;AACpD,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,EAAE,UAAU,YAAY,GAAG,YAAY,IAAI;AAEjD,MAAI,cAAc,aAAa;AAC7B,WAAO;AAAA,EACT;AAEA,MAAI,YAAY;AACd,WAAO,OAAO,aAAa;AAAA,MACzB,UAAU,eACN,wDAAwB,QAAQ,UAAU,QAC1C,wCAAgB,QAAQ,UAAU;AAAA,IACxC,CAAC;AAED,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,UAAU,eACN,wDAAwB,QAAQ,MAAS,QACzC,wCAAgB,QAAQ,MAAS;AAAA,EACvC;AACF;","names":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var composeQueryKey_exports = {};
|
|
20
|
+
__export(composeQueryKey_exports, {
|
|
21
|
+
composeQueryKey: () => composeQueryKey
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(composeQueryKey_exports);
|
|
24
|
+
var import_composeBaseQueryKey = require("./composeBaseQueryKey.js");
|
|
25
|
+
function composeQueryKey(schema, parameters) {
|
|
26
|
+
return (0, import_composeBaseQueryKey.composeBaseQueryKey)(schema, parameters, false);
|
|
27
|
+
}
|
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
+
0 && (module.exports = {
|
|
30
|
+
composeQueryKey
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=composeQueryKey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/composeQueryKey.ts"],"sourcesContent":["import type { ServiceOperationQueryKey } from '../service-operation/ServiceOperationKey.js';\nimport { composeBaseQueryKey } from './composeBaseQueryKey.js';\nimport type { OperationSchema } from './requestFn.js';\n\nexport function composeQueryKey<TSchema extends OperationSchema, TParams>(\n schema: TSchema,\n parameters: TParams | undefined\n): ServiceOperationQueryKey<TSchema, TParams> {\n return composeBaseQueryKey(schema, parameters, false);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,iCAAoC;AAG7B,SAAS,gBACd,QACA,YAC4C;AAC5C,aAAO,gDAAoB,QAAQ,YAAY,KAAK;AACtD;","names":[]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var createRecursiveProxy_exports = {};
|
|
20
|
+
__export(createRecursiveProxy_exports, {
|
|
21
|
+
createRecursiveProxy: () => createRecursiveProxy
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(createRecursiveProxy_exports);
|
|
24
|
+
function createRecursiveProxy(getCallback, applyCallback, path) {
|
|
25
|
+
return new Proxy(noop, {
|
|
26
|
+
get(_obj, key) {
|
|
27
|
+
if (typeof key !== "string" || key === "then") {
|
|
28
|
+
return void 0;
|
|
29
|
+
}
|
|
30
|
+
return getCallback(path, key) ?? createRecursiveProxy(getCallback, applyCallback, [...path, key]);
|
|
31
|
+
},
|
|
32
|
+
apply(_1, _2, args) {
|
|
33
|
+
const functionName = path[path.length - 1];
|
|
34
|
+
const isCall = functionName === "call";
|
|
35
|
+
const isApply = isCall ? false : functionName === "apply";
|
|
36
|
+
return applyCallback(
|
|
37
|
+
isApply || isCall ? path.slice(0, -1) : path,
|
|
38
|
+
isApply ? args.length >= 2 ? args[1] : [] : isCall ? args.slice(1) : args
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function noop() {
|
|
44
|
+
}
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
createRecursiveProxy
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=createRecursiveProxy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/createRecursiveProxy.ts"],"sourcesContent":["type ProxyApplyCallback = (path: string[], args: unknown[]) => unknown;\n/**\n * @internal\n * If returns `undefined | null`, the proxy will continue to create a new proxy for the next key.\n */\ntype ProxyGetCallback = (path: string[], key: string) => unknown | undefined;\n\n// todo::rename to `qraftRecursiveProxy` with deprecated `createRecursiveProxy`\n/**\n * Creates a recursive proxy that calls the `getCallback` and `applyCallback` functions\n * @param getCallback The callback to call when a proxy property is accessed\n * @param applyCallback The callback to call when a proxy is called as a function\n * @param path The current path of the proxy\n */\nexport function createRecursiveProxy(\n getCallback: ProxyGetCallback,\n applyCallback: ProxyApplyCallback,\n path: string[]\n): unknown {\n return new Proxy(noop, {\n get(_obj, key) {\n if (typeof key !== 'string' || key === 'then') {\n // special case for if the proxy is accidentally treated\n // like a PromiseLike (like in `Promise.resolve(proxy)`)\n return undefined;\n }\n\n return (\n getCallback(path, key) ??\n createRecursiveProxy(getCallback, applyCallback, [...path, key])\n );\n },\n apply(_1, _2, args) {\n const functionName = path[path.length - 1];\n\n const isCall = functionName === 'call';\n const isApply = isCall ? false : functionName === 'apply';\n\n return applyCallback(\n isApply || isCall ? path.slice(0, -1) : path,\n isApply\n ? args.length >= 2\n ? args[1]\n : []\n : isCall\n ? args.slice(1)\n : args\n );\n },\n });\n}\n\nfunction noop() {\n // noop\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAcO,SAAS,qBACd,aACA,eACA,MACS;AACT,SAAO,IAAI,MAAM,MAAM;AAAA,IACrB,IAAI,MAAM,KAAK;AACb,UAAI,OAAO,QAAQ,YAAY,QAAQ,QAAQ;AAG7C,eAAO;AAAA,MACT;AAEA,aACE,YAAY,MAAM,GAAG,KACrB,qBAAqB,aAAa,eAAe,CAAC,GAAG,MAAM,GAAG,CAAC;AAAA,IAEnE;AAAA,IACA,MAAM,IAAI,IAAI,MAAM;AAClB,YAAM,eAAe,KAAK,KAAK,SAAS,CAAC;AAEzC,YAAM,SAAS,iBAAiB;AAChC,YAAM,UAAU,SAAS,QAAQ,iBAAiB;AAElD,aAAO;AAAA,QACL,WAAW,SAAS,KAAK,MAAM,GAAG,EAAE,IAAI;AAAA,QACxC,UACI,KAAK,UAAU,IACb,KAAK,CAAC,IACN,CAAC,IACH,SACE,KAAK,MAAM,CAAC,IACZ;AAAA,MACR;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAEA,SAAS,OAAO;AAEhB;","names":[]}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var jwt_decode_exports = {};
|
|
20
|
+
__export(jwt_decode_exports, {
|
|
21
|
+
InvalidTokenError: () => InvalidTokenError,
|
|
22
|
+
b64DecodeUnicode: () => b64DecodeUnicode,
|
|
23
|
+
jwtDecode: () => jwtDecode
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(jwt_decode_exports);
|
|
26
|
+
class InvalidTokenError extends Error {
|
|
27
|
+
}
|
|
28
|
+
InvalidTokenError.prototype.name = "InvalidTokenError";
|
|
29
|
+
function b64DecodeUnicode(data) {
|
|
30
|
+
if (typeof atob === "function")
|
|
31
|
+
return decodeURIComponent(Array.from(atob(data), byteToPercent).join(""));
|
|
32
|
+
return Buffer.from(data, "base64").toString("utf-8");
|
|
33
|
+
}
|
|
34
|
+
function base64UrlDecode(str) {
|
|
35
|
+
let output = str.replace(/-/g, "+").replace(/_/g, "/");
|
|
36
|
+
switch (output.length % 4) {
|
|
37
|
+
case 0:
|
|
38
|
+
break;
|
|
39
|
+
case 2:
|
|
40
|
+
output += "==";
|
|
41
|
+
break;
|
|
42
|
+
case 3:
|
|
43
|
+
output += "=";
|
|
44
|
+
break;
|
|
45
|
+
default:
|
|
46
|
+
throw new Error("base64 string is not of the correct length");
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
return b64DecodeUnicode(output);
|
|
50
|
+
} catch (err) {
|
|
51
|
+
return atob(output);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function jwtDecode(token, options) {
|
|
55
|
+
if (typeof token !== "string") {
|
|
56
|
+
throw new InvalidTokenError("Invalid token specified: must be a string");
|
|
57
|
+
}
|
|
58
|
+
options ||= {};
|
|
59
|
+
const pos = options.header === true ? 0 : 1;
|
|
60
|
+
const part = token.split(".")[pos];
|
|
61
|
+
if (typeof part !== "string") {
|
|
62
|
+
throw new InvalidTokenError(
|
|
63
|
+
`Invalid token specified: missing part #${pos + 1}`
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
let decoded;
|
|
67
|
+
try {
|
|
68
|
+
decoded = base64UrlDecode(part);
|
|
69
|
+
} catch (e) {
|
|
70
|
+
throw new InvalidTokenError(
|
|
71
|
+
`Invalid token specified: invalid base64 for part #${pos + 1} (${e.message})`
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
return JSON.parse(decoded);
|
|
76
|
+
} catch (e) {
|
|
77
|
+
throw new InvalidTokenError(
|
|
78
|
+
`Invalid token specified: invalid json for part #${pos + 1} (${e.message})`
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function byteToPercent(b) {
|
|
83
|
+
return `%${`00${b.charCodeAt(0).toString(16)}`.slice(-2)}`;
|
|
84
|
+
}
|
|
85
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
86
|
+
0 && (module.exports = {
|
|
87
|
+
InvalidTokenError,
|
|
88
|
+
b64DecodeUnicode,
|
|
89
|
+
jwtDecode
|
|
90
|
+
});
|
|
91
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/jwt-decode/index.ts"],"sourcesContent":["export interface JwtDecodeOptions {\n header?: boolean;\n}\n\nexport interface JwtHeader {\n typ?: string;\n alg?: string;\n kid?: string;\n}\n\nexport interface JwtPayload {\n iss?: string;\n sub?: string;\n aud?: string[] | string;\n exp?: number;\n nbf?: number;\n iat?: number;\n jti?: string;\n}\n\nexport class InvalidTokenError extends Error {}\n\nInvalidTokenError.prototype.name = 'InvalidTokenError';\n\n/**\n * Decode a base64 string to a UTF-8 string.\n * Could be used in Node.js or in the browser.\n */\nexport function b64DecodeUnicode(data: string): string {\n if (typeof atob === 'function')\n return decodeURIComponent(Array.from(atob(data), byteToPercent).join(''));\n\n return Buffer.from(data, 'base64').toString('utf-8');\n}\n\nfunction base64UrlDecode(str: string) {\n let output = str.replace(/-/g, '+').replace(/_/g, '/');\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += '==';\n break;\n case 3:\n output += '=';\n break;\n default:\n throw new Error('base64 string is not of the correct length');\n }\n\n try {\n return b64DecodeUnicode(output);\n } catch (err) {\n return atob(output);\n }\n}\n\nexport function jwtDecode<T = JwtHeader>(\n token: string,\n options: JwtDecodeOptions & { header: true }\n): T;\nexport function jwtDecode<T = JwtPayload>(\n token: string,\n options?: JwtDecodeOptions\n): T;\nexport function jwtDecode<T = JwtHeader | JwtPayload>(\n token: string,\n options?: JwtDecodeOptions\n): T {\n if (typeof token !== 'string') {\n throw new InvalidTokenError('Invalid token specified: must be a string');\n }\n\n options ||= {};\n\n const pos = options.header === true ? 0 : 1;\n const part = token.split('.')[pos];\n\n if (typeof part !== 'string') {\n throw new InvalidTokenError(\n `Invalid token specified: missing part #${pos + 1}`\n );\n }\n\n let decoded: string;\n try {\n decoded = base64UrlDecode(part);\n } catch (e) {\n throw new InvalidTokenError(\n `Invalid token specified: invalid base64 for part #${pos + 1} (${(e as Error).message})`\n );\n }\n\n try {\n return JSON.parse(decoded) as T;\n } catch (e) {\n throw new InvalidTokenError(\n `Invalid token specified: invalid json for part #${pos + 1} (${(e as Error).message})`\n );\n }\n}\n\nfunction byteToPercent(b: string) {\n return `%${`00${b.charCodeAt(0).toString(16)}`.slice(-2)}`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBO,MAAM,0BAA0B,MAAM;AAAC;AAE9C,kBAAkB,UAAU,OAAO;AAM5B,SAAS,iBAAiB,MAAsB;AACrD,MAAI,OAAO,SAAS;AAClB,WAAO,mBAAmB,MAAM,KAAK,KAAK,IAAI,GAAG,aAAa,EAAE,KAAK,EAAE,CAAC;AAE1E,SAAO,OAAO,KAAK,MAAM,QAAQ,EAAE,SAAS,OAAO;AACrD;AAEA,SAAS,gBAAgB,KAAa;AACpC,MAAI,SAAS,IAAI,QAAQ,MAAM,GAAG,EAAE,QAAQ,MAAM,GAAG;AACrD,UAAQ,OAAO,SAAS,GAAG;AAAA,IACzB,KAAK;AACH;AAAA,IACF,KAAK;AACH,gBAAU;AACV;AAAA,IACF,KAAK;AACH,gBAAU;AACV;AAAA,IACF;AACE,YAAM,IAAI,MAAM,4CAA4C;AAAA,EAChE;AAEA,MAAI;AACF,WAAO,iBAAiB,MAAM;AAAA,EAChC,SAAS,KAAK;AACZ,WAAO,KAAK,MAAM;AAAA,EACpB;AACF;AAUO,SAAS,UACd,OACA,SACG;AACH,MAAI,OAAO,UAAU,UAAU;AAC7B,UAAM,IAAI,kBAAkB,2CAA2C;AAAA,EACzE;AAEA,cAAY,CAAC;AAEb,QAAM,MAAM,QAAQ,WAAW,OAAO,IAAI;AAC1C,QAAM,OAAO,MAAM,MAAM,GAAG,EAAE,GAAG;AAEjC,MAAI,OAAO,SAAS,UAAU;AAC5B,UAAM,IAAI;AAAA,MACR,0CAA0C,MAAM,CAAC;AAAA,IACnD;AAAA,EACF;AAEA,MAAI;AACJ,MAAI;AACF,cAAU,gBAAgB,IAAI;AAAA,EAChC,SAAS,GAAG;AACV,UAAM,IAAI;AAAA,MACR,qDAAqD,MAAM,CAAC,KAAM,EAAY,OAAO;AAAA,IACvF;AAAA,EACF;AAEA,MAAI;AACF,WAAO,KAAK,MAAM,OAAO;AAAA,EAC3B,SAAS,GAAG;AACV,UAAM,IAAI;AAAA,MACR,mDAAmD,MAAM,CAAC,KAAM,EAAY,OAAO;AAAA,IACrF;AAAA,EACF;AACF;AAEA,SAAS,cAAc,GAAW;AAChC,SAAO,IAAI,KAAK,EAAE,WAAW,CAAC,EAAE,SAAS,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC;AAC1D;","names":[]}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var requestFn_exports = {};
|
|
20
|
+
__export(requestFn_exports, {
|
|
21
|
+
baseRequestFn: () => baseRequestFn,
|
|
22
|
+
bodySerializer: () => bodySerializer,
|
|
23
|
+
mergeHeaders: () => mergeHeaders,
|
|
24
|
+
requestFn: () => requestFn,
|
|
25
|
+
urlSerializer: () => urlSerializer
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(requestFn_exports);
|
|
28
|
+
async function requestFn(schema, requestInfo, options) {
|
|
29
|
+
return baseRequestFn(schema, requestInfo, {
|
|
30
|
+
urlSerializer,
|
|
31
|
+
bodySerializer,
|
|
32
|
+
...options
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
async function baseRequestFn(requestSchema, requestInfo, options) {
|
|
36
|
+
const { parameters, headers, body, ...requestInfoRest } = requestInfo;
|
|
37
|
+
const requestBody = options.bodySerializer(requestSchema, requestInfo);
|
|
38
|
+
const baseFetch = options.fetch ?? fetch;
|
|
39
|
+
const response = await baseFetch(
|
|
40
|
+
options.urlSerializer(requestSchema, requestInfo),
|
|
41
|
+
{
|
|
42
|
+
method: requestSchema.method.toUpperCase(),
|
|
43
|
+
body: requestBody,
|
|
44
|
+
headers: mergeHeaders(
|
|
45
|
+
{
|
|
46
|
+
Accept: "application/json",
|
|
47
|
+
"Content-Type": requestSchema.mediaType ?? getBodyContentType(body)
|
|
48
|
+
},
|
|
49
|
+
headers,
|
|
50
|
+
parameters?.header,
|
|
51
|
+
requestBody instanceof FormData ? (
|
|
52
|
+
// remove `Content-Type` if serialized body is FormData; browser will correctly set Content-Type & boundary expression
|
|
53
|
+
{ "Content-Type": null }
|
|
54
|
+
) : void 0
|
|
55
|
+
),
|
|
56
|
+
...requestInfoRest
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
const clonedResponse = response.clone();
|
|
60
|
+
if (!response.ok) {
|
|
61
|
+
throw await getResponseBody(clonedResponse);
|
|
62
|
+
}
|
|
63
|
+
return await getResponseBody(clonedResponse);
|
|
64
|
+
}
|
|
65
|
+
function urlSerializer(schema, info) {
|
|
66
|
+
const path = schema.url.replace(
|
|
67
|
+
/{(.*?)}/g,
|
|
68
|
+
(substring, group) => {
|
|
69
|
+
if (info.parameters?.path && Object.prototype.hasOwnProperty.call(info.parameters.path, group)) {
|
|
70
|
+
return encodeURI(String(info.parameters?.path[group]));
|
|
71
|
+
}
|
|
72
|
+
return substring;
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
const baseUrl = info.baseUrl ?? "";
|
|
76
|
+
if (info.parameters?.query) {
|
|
77
|
+
return `${baseUrl}${path}${getQueryString(info.parameters.query)}`;
|
|
78
|
+
}
|
|
79
|
+
return `${baseUrl}${path}`;
|
|
80
|
+
}
|
|
81
|
+
function getQueryString(params) {
|
|
82
|
+
const qs = [];
|
|
83
|
+
const append = (key, value) => {
|
|
84
|
+
qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
85
|
+
};
|
|
86
|
+
const process2 = (key, value) => {
|
|
87
|
+
if (typeof value === "undefined" || value === null) return;
|
|
88
|
+
if (Array.isArray(value)) {
|
|
89
|
+
value.forEach((v) => {
|
|
90
|
+
process2(key, v);
|
|
91
|
+
});
|
|
92
|
+
} else if (typeof value === "object") {
|
|
93
|
+
Object.entries(value).forEach(([k, v]) => {
|
|
94
|
+
process2(`${key}[${k}]`, v);
|
|
95
|
+
});
|
|
96
|
+
} else {
|
|
97
|
+
append(key, value);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
101
|
+
process2(key, value);
|
|
102
|
+
});
|
|
103
|
+
if (qs.length > 0) {
|
|
104
|
+
return `?${qs.join("&")}`;
|
|
105
|
+
}
|
|
106
|
+
return "";
|
|
107
|
+
}
|
|
108
|
+
function mergeHeaders(...allHeaders) {
|
|
109
|
+
const headers = new Headers();
|
|
110
|
+
for (const headerSet of allHeaders) {
|
|
111
|
+
if (!headerSet || typeof headerSet !== "object") {
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
const headersIterator = headerSet instanceof Headers ? headerSet.entries() : Object.entries(headerSet);
|
|
115
|
+
for (const [headerKey, headerValue] of headersIterator) {
|
|
116
|
+
if (headerValue === null) {
|
|
117
|
+
headers.delete(headerKey);
|
|
118
|
+
} else if (headerValue !== void 0) {
|
|
119
|
+
headers.set(headerKey, headerValue);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return headers;
|
|
124
|
+
}
|
|
125
|
+
function bodySerializer(schema, info) {
|
|
126
|
+
if (info.body === void 0) return;
|
|
127
|
+
if (schema.method === "get" || schema.method === "head" || schema.method === "options")
|
|
128
|
+
return;
|
|
129
|
+
if (schema.mediaType?.includes("/form-data"))
|
|
130
|
+
return getRequestBodyFormData(info);
|
|
131
|
+
if (!schema.mediaType?.includes("/json") && (typeof info.body === "string" || info.body instanceof Blob || info.body instanceof FormData)) {
|
|
132
|
+
return info.body;
|
|
133
|
+
}
|
|
134
|
+
return JSON.stringify(info.body);
|
|
135
|
+
}
|
|
136
|
+
function getRequestBodyFormData({
|
|
137
|
+
body
|
|
138
|
+
}) {
|
|
139
|
+
if (body instanceof FormData) return body;
|
|
140
|
+
if (body === null) return;
|
|
141
|
+
if (body instanceof Blob) throw new Error("Blob not supported in form-data");
|
|
142
|
+
if (body instanceof ArrayBuffer)
|
|
143
|
+
throw new Error("ArrayBuffer not supported in form-data");
|
|
144
|
+
if (body instanceof URLSearchParams)
|
|
145
|
+
throw new Error("URLSearchParams not supported in form-data");
|
|
146
|
+
if (body instanceof ReadableStream)
|
|
147
|
+
throw new Error("ReadableStream not supported in form-data");
|
|
148
|
+
if (typeof body === "string")
|
|
149
|
+
throw new Error("String not supported in form-data");
|
|
150
|
+
if (typeof body !== "object")
|
|
151
|
+
throw new Error(`Unsupported body type ${typeof body} in form-data.`);
|
|
152
|
+
const formData = new FormData();
|
|
153
|
+
const process2 = (key, value) => {
|
|
154
|
+
if (typeof value === "string" || value instanceof Blob) {
|
|
155
|
+
formData.append(key, value);
|
|
156
|
+
} else {
|
|
157
|
+
formData.append(key, JSON.stringify(value));
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
Object.entries(body).filter(([_, value]) => typeof value !== "undefined" && value !== null).forEach(([key, value]) => {
|
|
161
|
+
if (Array.isArray(value)) {
|
|
162
|
+
value.forEach((v) => process2(key, v));
|
|
163
|
+
} else {
|
|
164
|
+
process2(key, value);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
return formData;
|
|
168
|
+
}
|
|
169
|
+
function getBodyContentType(body) {
|
|
170
|
+
if (!body) return;
|
|
171
|
+
if (body instanceof Blob) return body.type || "application/octet-stream";
|
|
172
|
+
if (typeof body === "string") return "text/plain";
|
|
173
|
+
if (!(body instanceof FormData)) return "application/json";
|
|
174
|
+
}
|
|
175
|
+
async function getResponseBody(response) {
|
|
176
|
+
if (response.status === 204 || response.headers.get("Content-Length") === "0")
|
|
177
|
+
return void 0;
|
|
178
|
+
const contentType = response.headers.get("Content-Type")?.toLowerCase();
|
|
179
|
+
const isJSON = contentType?.includes("/json") || contentType?.includes("+json");
|
|
180
|
+
if (isJSON) {
|
|
181
|
+
if (response.ok) return response.json();
|
|
182
|
+
const errorFallbackResponse = response.clone();
|
|
183
|
+
return response.json().catch(() => {
|
|
184
|
+
if (process.env.NODE_ENV === "development") {
|
|
185
|
+
console.warn(
|
|
186
|
+
"Failed to parse response body as JSON. Falling back to .text()"
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
return errorFallbackResponse.text();
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
return response.text();
|
|
193
|
+
}
|
|
194
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
195
|
+
0 && (module.exports = {
|
|
196
|
+
baseRequestFn,
|
|
197
|
+
bodySerializer,
|
|
198
|
+
mergeHeaders,
|
|
199
|
+
requestFn,
|
|
200
|
+
urlSerializer
|
|
201
|
+
});
|
|
202
|
+
//# sourceMappingURL=requestFn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/requestFn.ts"],"sourcesContent":["/**\n * This function is used to make a request to a specified endpoint.\n *\n * @template T The expected return type of the request.\n *\n * @param schema The schema of the operation to be performed. It includes the OpenAPI path, HTTP method and media type.\n * @param requestInfo The information required to make the request. It includes parameters, headers, body, etc.\n * @param [options] Optional. Additional options for the request. It includes custom urlSerializer, bodySerializer, and fetch function.\n *\n * @returns {Promise<T>} Returns a promise that resolves with the response of the request.\n *\n * @throws {error: object|string, response: Response} Throws an error if the request fails. The error includes the error message and the response from the server.\n */\nexport async function requestFn<T>(\n schema: OperationSchema,\n requestInfo: RequestFnInfo,\n options?: RequestFnOptions\n): Promise<T> {\n return baseRequestFn(schema, requestInfo, {\n urlSerializer,\n bodySerializer,\n ...options,\n });\n}\n\n/**\n * This function is used to make a request to a specified endpoint.\n * It's needed to create a custom `requestFn` with a custom `urlSerializer`\n * and `bodySerializer`, with the tree-shaking of the default `requestFn`\n * and its serializers.\n *\n * @template T The expected return type of the request.\n *\n * @param requestSchema The schema of the operation to be performed. It includes the OpenAPI path, HTTP method and media type.\n * @param requestInfo The information required to make the request. It includes parameters, headers, body, etc.\n * @param options The options for the request. It includes urlSerializer, bodySerializer, and fetch function. The 'urlSerializer' and 'bodySerializer' are required.\n *\n * @returns {Promise<T>} Returns a promise that resolves with the response of the request.\n *\n * @throws {error: object|string, response: Response} Throws an error if the request fails. The error includes the error message and the response from the server.\n */\nexport async function baseRequestFn<T>(\n requestSchema: OperationSchema,\n requestInfo: RequestFnInfo,\n options: WithRequired<RequestFnOptions, 'urlSerializer' | 'bodySerializer'>\n): Promise<T> {\n const { parameters, headers, body, ...requestInfoRest } = requestInfo;\n\n const requestBody = options.bodySerializer(requestSchema, requestInfo);\n\n const baseFetch = options.fetch ?? fetch;\n\n const response = await baseFetch(\n options.urlSerializer(requestSchema, requestInfo),\n {\n method: requestSchema.method.toUpperCase(),\n body: requestBody,\n headers: mergeHeaders(\n {\n Accept: 'application/json',\n 'Content-Type': requestSchema.mediaType ?? getBodyContentType(body),\n },\n headers,\n parameters?.header,\n requestBody instanceof FormData\n ? // remove `Content-Type` if serialized body is FormData; browser will correctly set Content-Type & boundary expression\n { 'Content-Type': null }\n : undefined\n ),\n ...requestInfoRest,\n }\n );\n\n // clone response to allow multiple reads\n const clonedResponse = response.clone();\n\n if (!response.ok) {\n throw await getResponseBody(clonedResponse);\n }\n\n return (await getResponseBody(clonedResponse)) as T;\n}\n\nexport function urlSerializer(\n schema: OperationSchema,\n info: RequestFnPayload\n): string {\n const path = schema.url.replace(\n /{(.*?)}/g,\n (substring: string, group: string) => {\n if (\n info.parameters?.path &&\n Object.prototype.hasOwnProperty.call(info.parameters.path, group)\n ) {\n return encodeURI(String(info.parameters?.path[group]));\n }\n return substring;\n }\n );\n\n const baseUrl = info.baseUrl ?? '';\n\n if (info.parameters?.query) {\n return `${baseUrl}${path}${getQueryString(info.parameters.query)}`;\n }\n\n return `${baseUrl}${path}`;\n}\n\nfunction getQueryString(params: Record<string, any>): string {\n const qs: string[] = [];\n\n const append = (key: string, value: any) => {\n qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);\n };\n\n const process = (key: string, value: any) => {\n if (typeof value === 'undefined' || value === null) return;\n\n if (Array.isArray(value)) {\n value.forEach((v) => {\n process(key, v);\n });\n } else if (typeof value === 'object') {\n Object.entries(value).forEach(([k, v]) => {\n process(`${key}[${k}]`, v);\n });\n } else {\n append(key, value);\n }\n };\n\n Object.entries(params).forEach(([key, value]) => {\n process(key, value);\n });\n\n if (qs.length > 0) {\n return `?${qs.join('&')}`;\n }\n\n return '';\n}\n\nexport function mergeHeaders(...allHeaders: (HeadersOptions | undefined)[]) {\n const headers = new Headers();\n\n for (const headerSet of allHeaders) {\n if (!headerSet || typeof headerSet !== 'object') {\n continue;\n }\n\n const headersIterator =\n headerSet instanceof Headers\n ? headerSet.entries()\n : Object.entries(headerSet);\n\n for (const [headerKey, headerValue] of headersIterator) {\n if (headerValue === null) {\n headers.delete(headerKey);\n } else if (headerValue !== undefined) {\n headers.set(headerKey, headerValue);\n }\n }\n }\n\n return headers;\n}\n\nexport function bodySerializer(\n schema: OperationSchema,\n info: RequestFnPayload\n) {\n if (info.body === undefined) return;\n\n if (\n schema.method === 'get' ||\n schema.method === 'head' ||\n schema.method === 'options'\n )\n return;\n\n if (schema.mediaType?.includes('/form-data'))\n return getRequestBodyFormData(info);\n\n if (\n !schema.mediaType?.includes('/json') &&\n (typeof info.body === 'string' ||\n info.body instanceof Blob ||\n info.body instanceof FormData)\n ) {\n return info.body;\n }\n\n return JSON.stringify(info.body);\n}\n\nfunction getRequestBodyFormData({\n body,\n}: Pick<RequestFnPayload, 'body'>): FormData | undefined {\n if (body instanceof FormData) return body;\n if (body === null) return;\n\n if (body instanceof Blob) throw new Error('Blob not supported in form-data');\n if (body instanceof ArrayBuffer)\n throw new Error('ArrayBuffer not supported in form-data');\n if (body instanceof URLSearchParams)\n throw new Error('URLSearchParams not supported in form-data');\n if (body instanceof ReadableStream)\n throw new Error('ReadableStream not supported in form-data');\n if (typeof body === 'string')\n throw new Error('String not supported in form-data');\n if (typeof body !== 'object')\n throw new Error(`Unsupported body type ${typeof body} in form-data.`);\n\n const formData = new FormData();\n\n const process = (key: string, value: any) => {\n if (typeof value === 'string' || value instanceof Blob) {\n formData.append(key, value);\n } else {\n formData.append(key, JSON.stringify(value));\n }\n };\n\n Object.entries(body)\n .filter(([_, value]) => typeof value !== 'undefined' && value !== null)\n .forEach(([key, value]) => {\n if (Array.isArray(value)) {\n value.forEach((v) => process(key, v));\n } else {\n process(key, value);\n }\n });\n\n return formData;\n}\n\nfunction getBodyContentType(body: RequestFnPayload['body']) {\n if (!body) return;\n if (body instanceof Blob) return body.type || 'application/octet-stream';\n if (typeof body === 'string') return 'text/plain';\n if (!(body instanceof FormData)) return 'application/json';\n}\n\nasync function getResponseBody<T>(response: Response): Promise<T | undefined> {\n if (response.status === 204 || response.headers.get('Content-Length') === '0')\n return undefined;\n\n const contentType = response.headers.get('Content-Type')?.toLowerCase();\n const isJSON =\n contentType?.includes('/json') || contentType?.includes('+json');\n\n if (isJSON) {\n // attempt to parse JSON for successful responses, otherwise fail\n if (response.ok) return response.json();\n\n const errorFallbackResponse = response.clone(); // clone to allow multiple reads\n\n return response.json().catch(() => {\n if (process.env.NODE_ENV === 'development') {\n console.warn(\n 'Failed to parse response body as JSON. Falling back to .text()'\n );\n }\n // falling back to .text() when necessary for error messages\n return errorFallbackResponse.text();\n });\n }\n\n return response.text() as Promise<T>;\n}\n\n// To have definitely typed headers without a conversion to stings\nexport type HeadersOptions =\n | HeadersInit\n | Record<string, string | number | boolean | null | undefined>;\n\nexport interface OperationSchema {\n /**\n * Operation path\n * @example /user/{id}\n */\n readonly url: string; //todo::rename to `path`\n\n /**\n * Operation method\n */\n readonly method:\n | 'get'\n | 'put'\n | 'post'\n | 'patch'\n | 'delete'\n | 'options'\n | 'head'\n | 'trace';\n\n /**\n * Media type of the request body\n * @example application/json\n */\n readonly mediaType?: string;\n\n readonly security?: string[];\n}\n\nexport interface RequestFnPayload {\n /**\n * Base URL to use for the request\n * @example 'https://api.example.com'\n */\n baseUrl: string | undefined;\n\n /**\n * OpenAPI parameters\n * @example\n * ```ts\n * { path: {id: 1}, query: {search: 'hello'} }\n * ```\n */\n readonly parameters?: {\n readonly path?: Record<string, any>;\n readonly header?: Record<string, any>;\n readonly query?: Record<string, any>;\n };\n\n /**\n * Request body\n * @example { name: 'John' }\n */\n readonly body?: BodyInit | Record<string, unknown> | null;\n\n /**\n * Tanstack Query Meta\n */\n meta?: Record<string, unknown>;\n\n /** An AbortSignal to set request's signal. */\n signal?: AbortSignal | null;\n}\n\nexport interface RequestFnInfo\n extends RequestFnPayload,\n Omit<RequestInit, 'headers' | 'method' | 'body' | 'signal'> {\n /**\n * Request headers\n * @example { 'X-Auth': '123' }\n */\n readonly headers?: HeadersOptions;\n}\n\nexport interface RequestFnOptions {\n urlSerializer?: typeof urlSerializer;\n bodySerializer?: typeof bodySerializer;\n fetch?: typeof fetch;\n}\n\nexport type RequestFn<T> = typeof requestFn<T>;\n\ntype WithRequired<T, K extends keyof T> = T & {\n [_ in K]: {};\n};\n"],"mappings":"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","names":["process"]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var shelfMerge_exports = {};
|
|
20
|
+
__export(shelfMerge_exports, {
|
|
21
|
+
shelfMerge: () => shelfMerge
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(shelfMerge_exports);
|
|
24
|
+
function shelfMerge(depth = 2, ...args) {
|
|
25
|
+
return args.reduce((acc, arg) => {
|
|
26
|
+
if (!arg || typeof arg !== "object") return acc;
|
|
27
|
+
Object.entries(arg).forEach(([key, value]) => {
|
|
28
|
+
if (typeof value !== "object") {
|
|
29
|
+
acc[key] = value;
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (Array.isArray(value)) {
|
|
33
|
+
acc[key] = value;
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (depth > 1) {
|
|
37
|
+
acc[key] = shelfMerge(
|
|
38
|
+
depth - 1,
|
|
39
|
+
acc[key],
|
|
40
|
+
value
|
|
41
|
+
);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
acc[key] = value;
|
|
45
|
+
});
|
|
46
|
+
return acc;
|
|
47
|
+
}, {});
|
|
48
|
+
}
|
|
49
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
+
0 && (module.exports = {
|
|
51
|
+
shelfMerge
|
|
52
|
+
});
|
|
53
|
+
//# sourceMappingURL=shelfMerge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/shelfMerge.ts"],"sourcesContent":["/**\n * Merges objects with provided depth\n * @param depth\n * @param args\n */\nexport function shelfMerge<T>(depth = 2, ...args: T[]): T {\n return args.reduce((acc, arg) => {\n if (!arg || typeof arg !== 'object') return acc;\n\n Object.entries(arg).forEach(([key, value]) => {\n if (typeof value !== 'object') {\n acc[key as never] = value as never;\n return;\n }\n\n if (Array.isArray(value)) {\n acc[key as never] = value as never;\n return;\n }\n\n if (depth > 1) {\n acc[key as never] = shelfMerge(\n depth - 1,\n acc[key as never],\n value\n ) as never;\n return;\n }\n\n acc[key as never] = value as never;\n });\n\n return acc;\n }, {} as T);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,SAAS,WAAc,QAAQ,MAAM,MAAc;AACxD,SAAO,KAAK,OAAO,CAAC,KAAK,QAAQ;AAC/B,QAAI,CAAC,OAAO,OAAO,QAAQ,SAAU,QAAO;AAE5C,WAAO,QAAQ,GAAG,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AAC5C,UAAI,OAAO,UAAU,UAAU;AAC7B,YAAI,GAAY,IAAI;AACpB;AAAA,MACF;AAEA,UAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,YAAI,GAAY,IAAI;AACpB;AAAA,MACF;AAEA,UAAI,QAAQ,GAAG;AACb,YAAI,GAAY,IAAI;AAAA,UAClB,QAAQ;AAAA,UACR,IAAI,GAAY;AAAA,UAChB;AAAA,QACF;AACA;AAAA,MACF;AAEA,UAAI,GAAY,IAAI;AAAA,IACtB,CAAC;AAED,WAAO;AAAA,EACT,GAAG,CAAC,CAAM;AACZ;","names":[]}
|