UNPKG

@daveyplate/better-auth-tanstack

Version:

Tanstack hooks for better-auth

950 lines (944 loc) 530 kB
import * as react_jsx_runtime from 'react/jsx-runtime'; import * as react from 'react'; import { ReactNode } from 'react'; import * as _tanstack_react_query from '@tanstack/react-query'; import { AnyUseQueryOptions, QueryKey, QueryClient } from '@tanstack/react-query'; import * as better_auth_plugins_passkey from 'better-auth/plugins/passkey'; import * as better_auth_types from 'better-auth/types'; import * as better_auth__ from 'better-auth/*'; import * as better_auth_react from 'better-auth/react'; import { BetterFetchOption, createAuthClient, BetterFetchResponse } from 'better-auth/react'; type AuthQueryOptions = { queryOptions?: Partial<AnyUseQueryOptions>; sessionQueryOptions?: Partial<AnyUseQueryOptions>; tokenQueryOptions?: Partial<AnyUseQueryOptions>; sessionKey: QueryKey; tokenKey: QueryKey; listAccountsKey: QueryKey; listSessionsKey: QueryKey; listDeviceSessionsKey: QueryKey; listPasskeysKey: QueryKey; optimistic: boolean; refetchOnMutate: boolean; }; declare const defaultAuthQueryOptions: AuthQueryOptions; declare const AuthQueryContext: react.Context<AuthQueryOptions>; declare const AuthQueryProvider: ({ children, sessionQueryOptions, tokenQueryOptions, ...props }: { children: ReactNode; } & Partial<AuthQueryOptions>) => react_jsx_runtime.JSX.Element; type AuthMutationFn<TParams> = (params: TParams) => Promise<ThrowableResult | NonThrowableResult>; declare function useAuthMutation<TAuthFn extends AuthMutationFn<any>>({ queryKey, mutationFn, optimisticData, options }: { queryKey: QueryKey; mutationFn: TAuthFn; optimisticData?(params: Omit<Parameters<TAuthFn>[0], "fetchOptions">, previousData: unknown): unknown; options?: Partial<AuthQueryOptions>; }): { mutate: _tanstack_react_query.UseMutateFunction<NonThrowableResult | ThrowableResult, Error, Parameters<TAuthFn>[0], { previousData: {}; }>; mutateAsync: { (params: Omit<Parameters<TAuthFn>[0], "fetchOptions"> & { fetchOptions?: { throw?: true; } | undefined; }): Promise<ThrowableResult>; (params: Omit<Parameters<TAuthFn>[0], "fetchOptions"> & { fetchOptions?: BetterFetchOption; }): Promise<NonThrowableResult>; }; isPending: boolean; error: Error | null; data: undefined; variables: undefined; isError: false; isIdle: true; isSuccess: false; status: "idle"; reset: () => void; context: { previousData: {}; } | undefined; failureCount: number; failureReason: Error | null; isPaused: boolean; submittedAt: number; } | { mutate: _tanstack_react_query.UseMutateFunction<NonThrowableResult | ThrowableResult, Error, Parameters<TAuthFn>[0], { previousData: {}; }>; mutateAsync: { (params: Omit<Parameters<TAuthFn>[0], "fetchOptions"> & { fetchOptions?: { throw?: true; } | undefined; }): Promise<ThrowableResult>; (params: Omit<Parameters<TAuthFn>[0], "fetchOptions"> & { fetchOptions?: BetterFetchOption; }): Promise<NonThrowableResult>; }; isPending: boolean; error: Error | null; data: undefined; variables: Parameters<TAuthFn>[0]; isError: false; isIdle: false; isSuccess: false; status: "pending"; reset: () => void; context: { previousData: {}; } | undefined; failureCount: number; failureReason: Error | null; isPaused: boolean; submittedAt: number; } | { mutate: _tanstack_react_query.UseMutateFunction<NonThrowableResult | ThrowableResult, Error, Parameters<TAuthFn>[0], { previousData: {}; }>; mutateAsync: { (params: Omit<Parameters<TAuthFn>[0], "fetchOptions"> & { fetchOptions?: { throw?: true; } | undefined; }): Promise<ThrowableResult>; (params: Omit<Parameters<TAuthFn>[0], "fetchOptions"> & { fetchOptions?: BetterFetchOption; }): Promise<NonThrowableResult>; }; isPending: boolean; error: Error | null; data: undefined; variables: Parameters<TAuthFn>[0]; isError: true; isIdle: false; isSuccess: false; status: "error"; reset: () => void; context: { previousData: {}; } | undefined; failureCount: number; failureReason: Error | null; isPaused: boolean; submittedAt: number; } | { mutate: _tanstack_react_query.UseMutateFunction<NonThrowableResult | ThrowableResult, Error, Parameters<TAuthFn>[0], { previousData: {}; }>; mutateAsync: { (params: Omit<Parameters<TAuthFn>[0], "fetchOptions"> & { fetchOptions?: { throw?: true; } | undefined; }): Promise<ThrowableResult>; (params: Omit<Parameters<TAuthFn>[0], "fetchOptions"> & { fetchOptions?: BetterFetchOption; }): Promise<NonThrowableResult>; }; isPending: boolean; error: Error | null; data: NonThrowableResult | ThrowableResult; variables: Parameters<TAuthFn>[0]; isError: false; isIdle: false; isSuccess: true; status: "success"; reset: () => void; context: { previousData: {}; } | undefined; failureCount: number; failureReason: Error | null; isPaused: boolean; submittedAt: number; }; type AuthClient = Omit<ReturnType<typeof createAuthClient>, "signUp"> type BetterFetchRequest<TData> = ({ fetchOptions }: { fetchOptions: BetterFetchOption; }) => Promise<BetterFetchResponse<TData>>; declare function createAuthHooks<TAuthClient extends AuthClient>(authClient: TAuthClient): { useSession: (options?: Partial<AnyUseQueryOptions>) => { session: TAuthClient["$Infer"]["Session"] | undefined; user: TAuthClient["$Infer"]["Session"] | undefined; data: TAuthClient["$Infer"]["Session"]; error: Error; isError: true; isPending: false; isLoading: false; isLoadingError: false; isRefetchError: true; isSuccess: false; isPlaceholderData: false; status: "error"; dataUpdatedAt: number; errorUpdatedAt: number; failureCount: number; failureReason: Error | null; errorUpdateCount: number; isFetched: boolean; isFetchedAfterMount: boolean; isFetching: boolean; isInitialLoading: boolean; isPaused: boolean; isRefetching: boolean; isStale: boolean; refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<TAuthClient["$Infer"]["Session"], Error>>; fetchStatus: _tanstack_react_query.FetchStatus; promise: Promise<TAuthClient["$Infer"]["Session"]>; } | { session: TAuthClient["$Infer"]["Session"] | undefined; user: TAuthClient["$Infer"]["Session"] | undefined; data: TAuthClient["$Infer"]["Session"]; error: null; isError: false; isPending: false; isLoading: false; isLoadingError: false; isRefetchError: false; isSuccess: true; isPlaceholderData: false; status: "success"; dataUpdatedAt: number; errorUpdatedAt: number; failureCount: number; failureReason: Error | null; errorUpdateCount: number; isFetched: boolean; isFetchedAfterMount: boolean; isFetching: boolean; isInitialLoading: boolean; isPaused: boolean; isRefetching: boolean; isStale: boolean; refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<TAuthClient["$Infer"]["Session"], Error>>; fetchStatus: _tanstack_react_query.FetchStatus; promise: Promise<TAuthClient["$Infer"]["Session"]>; } | { session: TAuthClient["$Infer"]["Session"] | undefined; user: TAuthClient["$Infer"]["Session"] | undefined; data: undefined; error: Error; isError: true; isPending: false; isLoading: false; isLoadingError: true; isRefetchError: false; isSuccess: false; isPlaceholderData: false; status: "error"; dataUpdatedAt: number; errorUpdatedAt: number; failureCount: number; failureReason: Error | null; errorUpdateCount: number; isFetched: boolean; isFetchedAfterMount: boolean; isFetching: boolean; isInitialLoading: boolean; isPaused: boolean; isRefetching: boolean; isStale: boolean; refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<TAuthClient["$Infer"]["Session"], Error>>; fetchStatus: _tanstack_react_query.FetchStatus; promise: Promise<TAuthClient["$Infer"]["Session"]>; } | { session: TAuthClient["$Infer"]["Session"] | undefined; user: TAuthClient["$Infer"]["Session"] | undefined; data: undefined; error: null; isError: false; isPending: true; isLoading: true; isLoadingError: false; isRefetchError: false; isSuccess: false; isPlaceholderData: false; status: "pending"; dataUpdatedAt: number; errorUpdatedAt: number; failureCount: number; failureReason: Error | null; errorUpdateCount: number; isFetched: boolean; isFetchedAfterMount: boolean; isFetching: boolean; isInitialLoading: boolean; isPaused: boolean; isRefetching: boolean; isStale: boolean; refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<TAuthClient["$Infer"]["Session"], Error>>; fetchStatus: _tanstack_react_query.FetchStatus; promise: Promise<TAuthClient["$Infer"]["Session"]>; } | { session: TAuthClient["$Infer"]["Session"] | undefined; user: TAuthClient["$Infer"]["Session"] | undefined; data: undefined; error: null; isError: false; isPending: true; isLoadingError: false; isRefetchError: false; isSuccess: false; isPlaceholderData: false; status: "pending"; dataUpdatedAt: number; errorUpdatedAt: number; failureCount: number; failureReason: Error | null; errorUpdateCount: number; isFetched: boolean; isFetchedAfterMount: boolean; isFetching: boolean; isLoading: boolean; isInitialLoading: boolean; isPaused: boolean; isRefetching: boolean; isStale: boolean; refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<TAuthClient["$Infer"]["Session"], Error>>; fetchStatus: _tanstack_react_query.FetchStatus; promise: Promise<TAuthClient["$Infer"]["Session"]>; } | { session: TAuthClient["$Infer"]["Session"] | undefined; user: TAuthClient["$Infer"]["Session"] | undefined; data: TAuthClient["$Infer"]["Session"]; isError: false; error: null; isPending: false; isLoading: false; isLoadingError: false; isRefetchError: false; isSuccess: true; isPlaceholderData: true; status: "success"; dataUpdatedAt: number; errorUpdatedAt: number; failureCount: number; failureReason: Error | null; errorUpdateCount: number; isFetched: boolean; isFetchedAfterMount: boolean; isFetching: boolean; isInitialLoading: boolean; isPaused: boolean; isRefetching: boolean; isStale: boolean; refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<TAuthClient["$Infer"]["Session"], Error>>; fetchStatus: _tanstack_react_query.FetchStatus; promise: Promise<TAuthClient["$Infer"]["Session"]>; }; usePrefetchSession: (options?: Partial<AnyUseQueryOptions>) => { prefetch: () => Promise<{ error: { code?: string | undefined; message?: string | undefined; t?: boolean | undefined; status: number; statusText: string; } | null; data: TAuthClient["$Infer"]["Session"] | undefined; session: TAuthClient["$Infer"]["Session"]["session"] | undefined; user: TAuthClient["$Infer"]["Session"]["user"] | undefined; }>; }; useUpdateUser: (options?: Partial<AuthQueryOptions>) => { mutate: _tanstack_react_query.UseMutateFunction<NonThrowableResult | ThrowableResult, Error, better_auth__.Prettify<{ image?: string | null; name?: string; fetchOptions?: { method?: string | undefined; headers?: (HeadersInit & (HeadersInit | { accept: "application/json" | "text/plain" | "application/octet-stream"; "content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream"; authorization: "Bearer" | "Basic"; })) | undefined; cache?: RequestCache | undefined; credentials?: RequestCredentials | undefined; integrity?: string | undefined; keepalive?: boolean | undefined; mode?: RequestMode | undefined; priority?: RequestPriority | undefined; redirect?: RequestRedirect | undefined; referrer?: string | undefined; referrerPolicy?: ReferrerPolicy | undefined; signal?: (AbortSignal | null) | undefined; window?: null | undefined; onRequest?: (<T extends Record<string, any>>(context: better_auth_react.RequestContext<T>) => Promise<better_auth_react.RequestContext | void> | better_auth_react.RequestContext | void) | undefined; onResponse?: ((context: better_auth_react.ResponseContext) => Promise<Response | void | better_auth_react.ResponseContext> | Response | better_auth_react.ResponseContext | void) | undefined; onSuccess?: ((context: better_auth_react.SuccessContext<any>) => Promise<void> | void) | undefined; onError?: ((context: better_auth_react.ErrorContext) => Promise<void> | void) | undefined; onRetry?: ((response: better_auth_react.ResponseContext) => Promise<void> | void) | undefined; hookOptions?: { cloneResponse?: boolean; } | undefined; timeout?: number | undefined; customFetchImpl?: better_auth_react.FetchEsque | undefined; plugins?: better_auth_react.BetterFetchPlugin[] | undefined; baseURL?: string | undefined; throw?: boolean | undefined; auth?: ({ type: "Bearer"; token: string | (() => string | undefined) | undefined; } | { type: "Basic"; username: string | (() => string | undefined) | undefined; password: string | (() => string | undefined) | undefined; } | { type: "Custom"; prefix: string | (() => string | undefined) | undefined; value: string | (() => string | undefined) | undefined; }) | undefined; body?: (Partial<Partial<better_auth__.Prettify<{ name?: string; image?: string | null; }>>> & Record<string, any>) | undefined; query?: (Partial<Record<string, any>> & Record<string, any>) | undefined; params?: Record<string, any> | undefined; duplex?: "full" | "half" | undefined; jsonParser?: ((text: string) => Promise<any> | any) | undefined; retry?: better_auth_react.RetryOptions | undefined; retryAttempt?: number | undefined; output?: (better_auth_react.StandardSchemaV1 | typeof Blob | typeof File) | undefined; errorSchema?: better_auth_react.StandardSchemaV1 | undefined; disableValidation?: boolean | undefined; } | undefined; } & Partial<{}>> | undefined, { previousData: {}; }>; mutateAsync: { (params: Omit<better_auth__.Prettify<{ image?: string | null; name?: string; fetchOptions?: { method?: string | undefined; headers?: (HeadersInit & (HeadersInit | { accept: "application/json" | "text/plain" | "application/octet-stream"; "content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream"; authorization: "Bearer" | "Basic"; })) | undefined; cache?: RequestCache | undefined; credentials?: RequestCredentials | undefined; integrity?: string | undefined; keepalive?: boolean | undefined; mode?: RequestMode | undefined; priority?: RequestPriority | undefined; redirect?: RequestRedirect | undefined; referrer?: string | undefined; referrerPolicy?: ReferrerPolicy | undefined; signal?: (AbortSignal | null) | undefined; window?: null | undefined; onRequest?: (<T extends Record<string, any>>(context: better_auth_react.RequestContext<T>) => Promise<better_auth_react.RequestContext | void> | better_auth_react.RequestContext | void) | undefined; onResponse?: ((context: better_auth_react.ResponseContext) => Promise<Response | void | better_auth_react.ResponseContext> | Response | better_auth_react.ResponseContext | void) | undefined; onSuccess?: ((context: better_auth_react.SuccessContext<any>) => Promise<void> | void) | undefined; onError?: ((context: better_auth_react.ErrorContext) => Promise<void> | void) | undefined; onRetry?: ((response: better_auth_react.ResponseContext) => Promise<void> | void) | undefined; hookOptions?: { cloneResponse?: boolean; } | undefined; timeout?: number | undefined; customFetchImpl?: better_auth_react.FetchEsque | undefined; plugins?: better_auth_react.BetterFetchPlugin[] | undefined; baseURL?: string | undefined; throw?: boolean | undefined; auth?: ({ type: "Bearer"; token: string | (() => string | undefined) | undefined; } | { type: "Basic"; username: string | (() => string | undefined) | undefined; password: string | (() => string | undefined) | undefined; } | { type: "Custom"; prefix: string | (() => string | undefined) | undefined; value: string | (() => string | undefined) | undefined; }) | undefined; body?: (Partial<Partial<better_auth__.Prettify<{ name?: string; image?: string | null; }>>> & Record<string, any>) | undefined; query?: (Partial<Record<string, any>> & Record<string, any>) | undefined; params?: Record<string, any> | undefined; duplex?: "full" | "half" | undefined; jsonParser?: ((text: string) => Promise<any> | any) | undefined; retry?: better_auth_react.RetryOptions | undefined; retryAttempt?: number | undefined; output?: (better_auth_react.StandardSchemaV1 | typeof Blob | typeof File) | undefined; errorSchema?: better_auth_react.StandardSchemaV1 | undefined; disableValidation?: boolean | undefined; } | undefined; } & Partial<{}>> | undefined, "fetchOptions"> & { fetchOptions?: { throw?: true; } | undefined; }): Promise<ThrowableResult>; (params: Omit<better_auth__.Prettify<{ image?: string | null; name?: string; fetchOptions?: { method?: string | undefined; headers?: (HeadersInit & (HeadersInit | { accept: "application/json" | "text/plain" | "application/octet-stream"; "content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream"; authorization: "Bearer" | "Basic"; })) | undefined; cache?: RequestCache | undefined; credentials?: RequestCredentials | undefined; integrity?: string | undefined; keepalive?: boolean | undefined; mode?: RequestMode | undefined; priority?: RequestPriority | undefined; redirect?: RequestRedirect | undefined; referrer?: string | undefined; referrerPolicy?: ReferrerPolicy | undefined; signal?: (AbortSignal | null) | undefined; window?: null | undefined; onRequest?: (<T extends Record<string, any>>(context: better_auth_react.RequestContext<T>) => Promise<better_auth_react.RequestContext | void> | better_auth_react.RequestContext | void) | undefined; onResponse?: ((context: better_auth_react.ResponseContext) => Promise<Response | void | better_auth_react.ResponseContext> | Response | better_auth_react.ResponseContext | void) | undefined; onSuccess?: ((context: better_auth_react.SuccessContext<any>) => Promise<void> | void) | undefined; onError?: ((context: better_auth_react.ErrorContext) => Promise<void> | void) | undefined; onRetry?: ((response: better_auth_react.ResponseContext) => Promise<void> | void) | undefined; hookOptions?: { cloneResponse?: boolean; } | undefined; timeout?: number | undefined; customFetchImpl?: better_auth_react.FetchEsque | undefined; plugins?: better_auth_react.BetterFetchPlugin[] | undefined; baseURL?: string | undefined; throw?: boolean | undefined; auth?: ({ type: "Bearer"; token: string | (() => string | undefined) | undefined; } | { type: "Basic"; username: string | (() => string | undefined) | undefined; password: string | (() => string | undefined) | undefined; } | { type: "Custom"; prefix: string | (() => string | undefined) | undefined; value: string | (() => string | undefined) | undefined; }) | undefined; body?: (Partial<Partial<better_auth__.Prettify<{ name?: string; image?: string | null; }>>> & Record<string, any>) | undefined; query?: (Partial<Record<string, any>> & Record<string, any>) | undefined; params?: Record<string, any> | undefined; duplex?: "full" | "half" | undefined; jsonParser?: ((text: string) => Promise<any> | any) | undefined; retry?: better_auth_react.RetryOptions | undefined; retryAttempt?: number | undefined; output?: (better_auth_react.StandardSchemaV1 | typeof Blob | typeof File) | undefined; errorSchema?: better_auth_react.StandardSchemaV1 | undefined; disableValidation?: boolean | undefined; } | undefined; } & Partial<{}>> | undefined, "fetchOptions"> & { fetchOptions?: better_auth_react.BetterFetchOption; }): Promise<NonThrowableResult>; }; isPending: boolean; error: Error | null; data: undefined; variables: undefined; isError: false; isIdle: true; isSuccess: false; status: "idle"; reset: () => void; context: { previousData: {}; } | undefined; failureCount: number; failureReason: Error | null; isPaused: boolean; submittedAt: number; } | { mutate: _tanstack_react_query.UseMutateFunction<NonThrowableResult | ThrowableResult, Error, better_auth__.Prettify<{ image?: string | null; name?: string; fetchOptions?: { method?: string | undefined; headers?: (HeadersInit & (HeadersInit | { accept: "application/json" | "text/plain" | "application/octet-stream"; "content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream"; authorization: "Bearer" | "Basic"; })) | undefined; cache?: RequestCache | undefined; credentials?: RequestCredentials | undefined; integrity?: string | undefined; keepalive?: boolean | undefined; mode?: RequestMode | undefined; priority?: RequestPriority | undefined; redirect?: RequestRedirect | undefined; referrer?: string | undefined; referrerPolicy?: ReferrerPolicy | undefined; signal?: (AbortSignal | null) | undefined; window?: null | undefined; onRequest?: (<T extends Record<string, any>>(context: better_auth_react.RequestContext<T>) => Promise<better_auth_react.RequestContext | void> | better_auth_react.RequestContext | void) | undefined; onResponse?: ((context: better_auth_react.ResponseContext) => Promise<Response | void | better_auth_react.ResponseContext> | Response | better_auth_react.ResponseContext | void) | undefined; onSuccess?: ((context: better_auth_react.SuccessContext<any>) => Promise<void> | void) | undefined; onError?: ((context: better_auth_react.ErrorContext) => Promise<void> | void) | undefined; onRetry?: ((response: better_auth_react.ResponseContext) => Promise<void> | void) | undefined; hookOptions?: { cloneResponse?: boolean; } | undefined; timeout?: number | undefined; customFetchImpl?: better_auth_react.FetchEsque | undefined; plugins?: better_auth_react.BetterFetchPlugin[] | undefined; baseURL?: string | undefined; throw?: boolean | undefined; auth?: ({ type: "Bearer"; token: string | (() => string | undefined) | undefined; } | { type: "Basic"; username: string | (() => string | undefined) | undefined; password: string | (() => string | undefined) | undefined; } | { type: "Custom"; prefix: string | (() => string | undefined) | undefined; value: string | (() => string | undefined) | undefined; }) | undefined; body?: (Partial<Partial<better_auth__.Prettify<{ name?: string; image?: string | null; }>>> & Record<string, any>) | undefined; query?: (Partial<Record<string, any>> & Record<string, any>) | undefined; params?: Record<string, any> | undefined; duplex?: "full" | "half" | undefined; jsonParser?: ((text: string) => Promise<any> | any) | undefined; retry?: better_auth_react.RetryOptions | undefined; retryAttempt?: number | undefined; output?: (better_auth_react.StandardSchemaV1 | typeof Blob | typeof File) | undefined; errorSchema?: better_auth_react.StandardSchemaV1 | undefined; disableValidation?: boolean | undefined; } | undefined; } & Partial<{}>> | undefined, { previousData: {}; }>; mutateAsync: { (params: Omit<better_auth__.Prettify<{ image?: string | null; name?: string; fetchOptions?: { method?: string | undefined; headers?: (HeadersInit & (HeadersInit | { accept: "application/json" | "text/plain" | "application/octet-stream"; "content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream"; authorization: "Bearer" | "Basic"; })) | undefined; cache?: RequestCache | undefined; credentials?: RequestCredentials | undefined; integrity?: string | undefined; keepalive?: boolean | undefined; mode?: RequestMode | undefined; priority?: RequestPriority | undefined; redirect?: RequestRedirect | undefined; referrer?: string | undefined; referrerPolicy?: ReferrerPolicy | undefined; signal?: (AbortSignal | null) | undefined; window?: null | undefined; onRequest?: (<T extends Record<string, any>>(context: better_auth_react.RequestContext<T>) => Promise<better_auth_react.RequestContext | void> | better_auth_react.RequestContext | void) | undefined; onResponse?: ((context: better_auth_react.ResponseContext) => Promise<Response | void | better_auth_react.ResponseContext> | Response | better_auth_react.ResponseContext | void) | undefined; onSuccess?: ((context: better_auth_react.SuccessContext<any>) => Promise<void> | void) | undefined; onError?: ((context: better_auth_react.ErrorContext) => Promise<void> | void) | undefined; onRetry?: ((response: better_auth_react.ResponseContext) => Promise<void> | void) | undefined; hookOptions?: { cloneResponse?: boolean; } | undefined; timeout?: number | undefined; customFetchImpl?: better_auth_react.FetchEsque | undefined; plugins?: better_auth_react.BetterFetchPlugin[] | undefined; baseURL?: string | undefined; throw?: boolean | undefined; auth?: ({ type: "Bearer"; token: string | (() => string | undefined) | undefined; } | { type: "Basic"; username: string | (() => string | undefined) | undefined; password: string | (() => string | undefined) | undefined; } | { type: "Custom"; prefix: string | (() => string | undefined) | undefined; value: string | (() => string | undefined) | undefined; }) | undefined; body?: (Partial<Partial<better_auth__.Prettify<{ name?: string; image?: string | null; }>>> & Record<string, any>) | undefined; query?: (Partial<Record<string, any>> & Record<string, any>) | undefined; params?: Record<string, any> | undefined; duplex?: "full" | "half" | undefined; jsonParser?: ((text: string) => Promise<any> | any) | undefined; retry?: better_auth_react.RetryOptions | undefined; retryAttempt?: number | undefined; output?: (better_auth_react.StandardSchemaV1 | typeof Blob | typeof File) | undefined; errorSchema?: better_auth_react.StandardSchemaV1 | undefined; disableValidation?: boolean | undefined; } | undefined; } & Partial<{}>> | undefined, "fetchOptions"> & { fetchOptions?: { throw?: true; } | undefined; }): Promise<ThrowableResult>; (params: Omit<better_auth__.Prettify<{ image?: string | null; name?: string; fetchOptions?: { method?: string | undefined; headers?: (HeadersInit & (HeadersInit | { accept: "application/json" | "text/plain" | "application/octet-stream"; "content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream"; authorization: "Bearer" | "Basic"; })) | undefined; cache?: RequestCache | undefined; credentials?: RequestCredentials | undefined; integrity?: string | undefined; keepalive?: boolean | undefined; mode?: RequestMode | undefined; priority?: RequestPriority | undefined; redirect?: RequestRedirect | undefined; referrer?: string | undefined; referrerPolicy?: ReferrerPolicy | undefined; signal?: (AbortSignal | null) | undefined; window?: null | undefined; onRequest?: (<T extends Record<string, any>>(context: better_auth_react.RequestContext<T>) => Promise<better_auth_react.RequestContext | void> | better_auth_react.RequestContext | void) | undefined; onResponse?: ((context: better_auth_react.ResponseContext) => Promise<Response | void | better_auth_react.ResponseContext> | Response | better_auth_react.ResponseContext | void) | undefined; onSuccess?: ((context: better_auth_react.SuccessContext<any>) => Promise<void> | void) | undefined; onError?: ((context: better_auth_react.ErrorContext) => Promise<void> | void) | undefined; onRetry?: ((response: better_auth_react.ResponseContext) => Promise<void> | void) | undefined; hookOptions?: { cloneResponse?: boolean; } | undefined; timeout?: number | undefined; customFetchImpl?: better_auth_react.FetchEsque | undefined; plugins?: better_auth_react.BetterFetchPlugin[] | undefined; baseURL?: string | undefined; throw?: boolean | undefined; auth?: ({ type: "Bearer"; token: string | (() => string | undefined) | undefined; } | { type: "Basic"; username: string | (() => string | undefined) | undefined; password: string | (() => string | undefined) | undefined; } | { type: "Custom"; prefix: string | (() => string | undefined) | undefined; value: string | (() => string | undefined) | undefined; }) | undefined; body?: (Partial<Partial<better_auth__.Prettify<{ name?: string; image?: string | null; }>>> & Record<string, any>) | undefined; query?: (Partial<Record<string, any>> & Record<string, any>) | undefined; params?: Record<string, any> | undefined; duplex?: "full" | "half" | undefined; jsonParser?: ((text: string) => Promise<any> | any) | undefined; retry?: better_auth_react.RetryOptions | undefined; retryAttempt?: number | undefined; output?: (better_auth_react.StandardSchemaV1 | typeof Blob | typeof File) | undefined; errorSchema?: better_auth_react.StandardSchemaV1 | undefined; disableValidation?: boolean | undefined; } | undefined; } & Partial<{}>> | undefined, "fetchOptions"> & { fetchOptions?: better_auth_react.BetterFetchOption; }): Promise<NonThrowableResult>; }; isPending: boolean; error: Error | null; data: undefined; variables: better_auth__.Prettify<{ image?: string | null; name?: string; fetchOptions?: { method?: string | undefined; headers?: (HeadersInit & (HeadersInit | { accept: "application/json" | "text/plain" | "application/octet-stream"; "content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream"; authorization: "Bearer" | "Basic"; })) | undefined; cache?: RequestCache | undefined; credentials?: RequestCredentials | undefined; integrity?: string | undefined; keepalive?: boolean | undefined; mode?: RequestMode | undefined; priority?: RequestPriority | undefined; redirect?: RequestRedirect | undefined; referrer?: string | undefined; referrerPolicy?: ReferrerPolicy | undefined; signal?: (AbortSignal | null) | undefined; window?: null | undefined; onRequest?: (<T extends Record<string, any>>(context: better_auth_react.RequestContext<T>) => Promise<better_auth_react.RequestContext | void> | better_auth_react.RequestContext | void) | undefined; onResponse?: ((context: better_auth_react.ResponseContext) => Promise<Response | void | better_auth_react.ResponseContext> | Response | better_auth_react.ResponseContext | void) | undefined; onSuccess?: ((context: better_auth_react.SuccessContext<any>) => Promise<void> | void) | undefined; onError?: ((context: better_auth_react.ErrorContext) => Promise<void> | void) | undefined; onRetry?: ((response: better_auth_react.ResponseContext) => Promise<void> | void) | undefined; hookOptions?: { cloneResponse?: boolean; } | undefined; timeout?: number | undefined; customFetchImpl?: better_auth_react.FetchEsque | undefined; plugins?: better_auth_react.BetterFetchPlugin[] | undefined; baseURL?: string | undefined; throw?: boolean | undefined; auth?: ({ type: "Bearer"; token: string | (() => string | undefined) | undefined; } | { type: "Basic"; username: string | (() => string | undefined) | undefined; password: string | (() => string | undefined) | undefined; } | { type: "Custom"; prefix: string | (() => string | undefined) | undefined; value: string | (() => string | undefined) | undefined; }) | undefined; body?: (Partial<Partial<better_auth__.Prettify<{ name?: string; image?: string | null; }>>> & Record<string, any>) | undefined; query?: (Partial<Record<string, any>> & Record<string, any>) | undefined; params?: Record<string, any> | undefined; duplex?: "full" | "half" | undefined; jsonParser?: ((text: string) => Promise<any> | any) | undefined; retry?: better_auth_react.RetryOptions | undefined; retryAttempt?: number | undefined; output?: (better_auth_react.StandardSchemaV1 | typeof Blob | typeof File) | undefined; errorSchema?: better_auth_react.StandardSchemaV1 | undefined; disableValidation?: boolean | undefined; } | undefined; } & Partial<{}>> | undefined; isError: false; isIdle: false; isSuccess: false; status: "pending"; reset: () => void; context: { previousData: {}; } | undefined; failureCount: number; failureReason: Error | null; isPaused: boolean; submittedAt: number; } | { mutate: _tanstack_react_query.UseMutateFunction<NonThrowableResult | ThrowableResult, Error, better_auth__.Prettify<{ image?: string | null; name?: string; fetchOptions?: { method?: string | undefined; headers?: (HeadersInit & (HeadersInit | { accept: "application/json" | "text/plain" | "application/octet-stream"; "content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream"; authorization: "Bearer" | "Basic"; })) | undefined; cache?: RequestCache | undefined; credentials?: RequestCredentials | undefined; integrity?: string | undefined; keepalive?: boolean | undefined; mode?: RequestMode | undefined; priority?: RequestPriority | undefined; redirect?: RequestRedirect | undefined; referrer?: string | undefined; referrerPolicy?: ReferrerPolicy | undefined; signal?: (AbortSignal | null) | undefined; window?: null | undefined; onRequest?: (<T extends Record<string, any>>(context: better_auth_react.RequestContext<T>) => Promise<better_auth_react.RequestContext | void> | better_auth_react.RequestContext | void) | undefined; onResponse?: ((context: better_auth_react.ResponseContext) => Promise<Response | void | better_auth_react.ResponseContext> | Response | better_auth_react.ResponseContext | void) | undefined; onSuccess?: ((context: better_auth_react.SuccessContext<any>) => Promise<void> | void) | undefined; onError?: ((context: better_auth_react.ErrorContext) => Promise<void> | void) | undefined; onRetry?: ((response: better_auth_react.ResponseContext) => Promise<void> | void) | undefined; hookOptions?: { cloneResponse?: boolean; } | undefined; timeout?: number | undefined; customFetchImpl?: better_auth_react.FetchEsque | undefined; plugins?: better_auth_react.BetterFetchPlugin[] | undefined; baseURL?: string | undefined; throw?: boolean | undefined; auth?: ({ type: "Bearer"; token: string | (() => string | undefined) | undefined; } | { type: "Basic"; username: string | (() => string | undefined) | undefined; password: string | (() => string | undefined) | undefined; } | { type: "Custom"; prefix: string | (() => string | undefined) | undefined; value: string | (() => string | undefined) | undefined; }) | undefined; body?: (Partial<Partial<better_auth__.Prettify<{ name?: string; image?: string | null; }>>> & Record<string, any>) | undefined; query?: (Partial<Record<string, any>> & Record<string, any>) | undefined; params?: Record<string, any> | undefined; duplex?: "full" | "half" | undefined; jsonParser?: ((text: string) => Promise<any> | any) | undefined; retry?: better_auth_react.RetryOptions | undefined; retryAttempt?: number | undefined; output?: (better_auth_react.StandardSchemaV1 | typeof Blob | typeof File) | undefined; errorSchema?: better_auth_react.StandardSchemaV1 | undefined; disableValidation?: boolean | undefined; } | undefined; } & Partial<{}>> | undefined, { previousData: {}; }>; mutateAsync: { (params: Omit<better_auth__.Prettify<{ image?: string | null; name?: string; fetchOptions?: { method?: string | undefined; headers?: (HeadersInit & (HeadersInit | { accept: "application/json" | "text/plain" | "application/octet-stream"; "content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream"; authorization: "Bearer" | "Basic"; })) | undefined; cache?: RequestCache | undefined; credentials?: RequestCredentials | undefined; integrity?: string | undefined; keepalive?: boolean | undefined; mode?: RequestMode | undefined; priority?: RequestPriority | undefined; redirect?: RequestRedirect | undefined; referrer?: string | undefined; referrerPolicy?: ReferrerPolicy | undefined; signal?: (AbortSignal | null) | undefined; window?: null | undefined; onRequest?: (<T extends Record<string, any>>(context: better_auth_react.RequestContext<T>) => Promise<better_auth_react.RequestContext | void> | better_auth_react.RequestContext | void) | undefined; onResponse?: ((context: better_auth_react.ResponseContext) => Promise<Response | void | better_auth_react.ResponseContext> | Response | better_auth_react.ResponseContext | void) | undefined; onSuccess?: ((context: better_auth_react.SuccessContext<any>) => Promise<void> | void) | undefined; onError?: ((context: better_auth_react.ErrorContext) => Promise<void> | void) | undefined; onRetry?: ((response: better_auth_react.ResponseContext) => Promise<void> | void) | undefined; hookOptions?: { cloneResponse?: boolean; } | undefined; timeout?: number | undefined; customFetchImpl?: better_auth_react.FetchEsque | undefined; plugins?: better_auth_react.BetterFetchPlugin[] | undefined; baseURL?: string | undefined; throw?: boolean | undefined; auth?: ({ type: "Bearer"; token: string | (() => string | undefined) | undefined; } | { type: "Basic"; username: string | (() => string | undefined) | undefined; password: string | (() => string | undefined) | undefined; } | { type: "Custom"; prefix: string | (() => string | undefined) | undefined; value: string | (() => string | undefined) | undefined; }) | undefined; body?: (Partial<Partial<better_auth__.Prettify<{ name?: string; image?: string | null; }>>> & Record<string, any>) | undefined; query?: (Partial<Record<string, any>> & Record<string, any>) | undefined; params?: Record<string, any> | undefined; duplex?: "full" | "half" | undefined; jsonParser?: ((text: string) => Promise<any> | any) | undefined; retry?: better_auth_react.RetryOptions | undefined; retryAttempt?: number | undefined;