@daveyplate/better-auth-tanstack
Version:
Tanstack hooks for better-auth
1,028 lines (1,023 loc) • 1.02 MB
TypeScript
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_organization from 'better-auth/plugins/organization';
import * as better_auth_plugins_passkey from 'better-auth/plugins/passkey';
import * as better_auth_types from 'better-auth/types';
import * as better_auth_dist_shared_better_auth_CYegVoq1 from 'better-auth/dist/shared/better-auth.CYegVoq1';
import * as better_auth_react from 'better-auth/react';
import { BetterFetchOption, createAuthClient, BetterFetchResponse } from 'better-auth/react';
import * as better_auth_client_plugins from 'better-auth/client/plugins';
import * as better_auth_dist_shared_better_auth_Bzjh9zg_ from 'better-auth/dist/shared/better-auth.Bzjh9zg_';
type AuthQueryOptions = {
queryOptions?: Partial<AnyUseQueryOptions>;
sessionQueryOptions?: Partial<AnyUseQueryOptions>;
tokenQueryOptions?: Partial<AnyUseQueryOptions>;
sessionKey: QueryKey;
tokenKey: QueryKey;
listAccountsKey: QueryKey;
listApiKeysKey: 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 AnyAuthClient = Omit<ReturnType<typeof createAuthClient>, "signUp" | "getSession">;
type BetterFetchRequest<TData> = ({ fetchOptions }: {
fetchOptions: BetterFetchOption;
}) => Promise<BetterFetchResponse<TData>>;
declare const authClient: {
useListPasskeys: () => {
data: better_auth_plugins_passkey.Passkey[] | null;
error: null | better_auth_react.BetterFetchError;
isPending: boolean;
isRefetching: boolean;
refetch: () => void;
};
} & {} & {
useActiveOrganization: () => {
data: better_auth_dist_shared_better_auth_CYegVoq1.P<{
id: string;
name: string;
createdAt: Date;
slug: string;
metadata?: any;
logo?: string | null | undefined;
} & {
members: (better_auth_plugins_organization.Member & {
user: {
id: string;
name: string;
email: string;
image: string | undefined;
};
})[];
invitations: better_auth_plugins_organization.Invitation[];
}> | null;
error: null | better_auth_react.BetterFetchError;
isPending: boolean;
isRefetching: boolean;
refetch: () => void;
};
useListOrganizations: () => {
data: {
id: string;
name: string;
createdAt: Date;
slug: string;
metadata?: any;
logo?: string | null | undefined;
}[] | null;
error: null | better_auth_react.BetterFetchError;
isPending: boolean;
isRefetching: boolean;
refetch: () => void;
};
useActiveMember: () => {
data: {
id: string;
createdAt: Date;
userId: string;
organizationId: string;
role: string;
teamId?: string | undefined;
} | null;
error: null | better_auth_react.BetterFetchError;
isPending: boolean;
isRefetching: boolean;
refetch: () => void;
};
} & {
signIn: {
social: <FetchOptions extends {
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 | Promise<string | undefined> | (() => string | Promise<string | undefined> | 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<{
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter" | "dropbox" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "vk" | "kick" | "zoom";
scopes?: string[] | undefined;
loginHint?: string | undefined;
idToken?: {
token: string;
refreshToken?: string | undefined;
accessToken?: string | undefined;
expiresAt?: number | undefined;
nonce?: string | undefined;
} | undefined;
callbackURL?: string | undefined;
requestSignUp?: boolean | undefined;
errorCallbackURL?: string | undefined;
newUserCallbackURL?: string | undefined;
disableRedirect?: boolean | undefined;
}> & 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;
}>(data_0: better_auth_dist_shared_better_auth_CYegVoq1.P<{
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter" | "dropbox" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "vk" | "kick" | "zoom";
scopes?: string[] | undefined;
loginHint?: string | undefined;
idToken?: {
token: string;
refreshToken?: string | undefined;
accessToken?: string | undefined;
expiresAt?: number | undefined;
nonce?: string | undefined;
} | undefined;
callbackURL?: string | undefined;
requestSignUp?: boolean | undefined;
errorCallbackURL?: string | undefined;
newUserCallbackURL?: string | undefined;
disableRedirect?: boolean | undefined;
} & {
fetchOptions?: FetchOptions | undefined;
}>, data_1?: FetchOptions | undefined) => Promise<better_auth_react.BetterFetchResponse<NonNullable<{
redirect: boolean;
token: string;
url: undefined;
user: {
id: string;
email: string;
name: string;
image: string | null | undefined;
emailVerified: boolean;
createdAt: Date;
updatedAt: Date;
};
} | {
url: string;
redirect: boolean;
}>, {
code?: string;
message?: string;
}, FetchOptions["throw"] extends true ? true : false>>;
};
} & {
getSession: <FetchOptions extends {
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 | Promise<string | undefined> | (() => string | Promise<string | undefined> | 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?: undefined;
query?: (Partial<{
disableCookieCache?: string | boolean | undefined;
disableRefresh?: string | boolean | undefined;
}> & 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;
}>(data_0?: better_auth_dist_shared_better_auth_CYegVoq1.P<{
query?: {
disableCookieCache?: string | boolean | undefined;
disableRefresh?: string | boolean | undefined;
} | undefined;
fetchOptions?: FetchOptions | undefined;
}> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_react.BetterFetchResponse<{
user: {
id: string;
name: string;
email: string;
emailVerified: boolean;
createdAt: Date;
updatedAt: Date;
image?: string | null | undefined | undefined;
isAnonymous?: boolean | null | undefined;
username?: string | null | undefined;
displayUsername?: string | null | undefined;
twoFactorEnabled: boolean | null | undefined;
};
session: {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined | undefined;
userAgent?: string | null | undefined | undefined;
activeOrganizationId?: string | null | undefined;
};
}, {
code?: string;
message?: string;
}, FetchOptions["throw"] extends true ? true : false>>;
} & {
signOut: <FetchOptions extends {
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 | Promise<string | undefined> | (() => string | Promise<string | undefined> | 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?: 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;
}>(data_0?: better_auth_dist_shared_better_auth_CYegVoq1.P<{
query?: Record<string, any> | undefined;
fetchOptions?: FetchOptions | undefined;
}> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_react.BetterFetchResponse<{
success: boolean;
}, {
code?: string;
message?: string;
}, FetchOptions["throw"] extends true ? true : false>>;
} & {
signIn: {
email: <FetchOptions extends {
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 | Promise<string | undefined> | (() => string | Promise<string | undefined> | 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<{
password: string;
email: string;
callbackURL?: string | undefined;
rememberMe?: boolean | undefined;
}> & 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;
}>(data_0: better_auth_dist_shared_better_auth_CYegVoq1.P<{
password: string;
email: string;
callbackURL?: string | undefined;
rememberMe?: boolean | undefined;
} & {
fetchOptions?: FetchOptions | undefined;
}>, data_1?: FetchOptions | undefined) => Promise<better_auth_react.BetterFetchResponse<{
redirect: boolean;
token: string;
url: string | undefined;
user: {
id: string;
email: string;
name: string;
image: string | null | undefined;
emailVerified: boolean;
createdAt: Date;
updatedAt: Date;
};
}, {
code?: string;
message?: string;
}, FetchOptions["throw"] extends true ? true : false>>;
};
} & {
forgetPassword: <FetchOptions extends {
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 | Promise<string | undefined> | (() => string | Promise<string | undefined> | 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<{
email: string;
redirectTo?: string | undefined;
}> & 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;
}>(data_0: better_auth_dist_shared_better_auth_CYegVoq1.P<{
email: string;
redirectTo?: string | undefined;
} & {
fetchOptions?: FetchOptions | undefined;
}>, data_1?: FetchOptions | undefined) => Promise<better_auth_react.BetterFetchResponse<{
status: boolean;
}, {
code?: string;
message?: string;
}, FetchOptions["throw"] extends true ? true : false>>;
} & {
resetPassword: <FetchOptions extends {
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 | Promise<string | undefined> | (() => string | Promise<string | undefined> | 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<{
newPassword: string;
token?: string | undefined;
}> & Record<string, any>) | undefined;
query?: (Partial<{
token?: string | undefined;
}> & 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;
}>(data_0: better_auth_dist_shared_better_auth_CYegVoq1.P<{
newPassword: string;
token?: string | undefined;
} & {
fetchOptions?: FetchOptions | undefined;
}>, data_1?: FetchOptions | undefined) => Promise<better_auth_react.BetterFetchResponse<{
status: boolean;
}, {
code?: string;
message?: string;
}, FetchOptions["throw"] extends true ? true : false>>;
} & {
verifyEmail: <FetchOptions extends {
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 | Promise<string | undefined> | (() => string | Promise<string | undefined> | 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?: undefined;
query?: (Partial<{
token: string;
callbackURL?: string | undefined;
}> & 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;
}>(data_0: better_auth_dist_shared_better_auth_CYegVoq1.P<{
query: {
token: string;
callbackURL?: string | undefined;
};
fetchOptions?: FetchOptions | undefined;
}>, data_1?: FetchOptions | undefined) => Promise<better_auth_react.BetterFetchResponse<NonNullable<void | {
status: boolean;
user: {
id: any;
email: any;
name: any;
image: any;
emailVerified: any;
createdAt: any;
updatedAt: any;
};
} | {
status: boolean;
user: null;
}>, {
code?: string;
message?: string;
}, FetchOptions["throw"] extends true ? true : false>>;
} & {
sendVerificationEmail: <FetchOptions extends {
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 | Promise<string | undefined> | (() => string | Promise<string | undefined> | 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<{
email: string;
callbackURL?: string | undefined;
}> & 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;
}>(data_0: better_auth_dist_shared_better_auth_CYegVoq1.P<{
email: string;
callbackURL?: string | undefined;
} & {
fetchOptions?: FetchOptions | undefined;
}>, data_1?: FetchOptions | undefined) => Promise<better_auth_react.BetterFetchResponse<{
status: boolean;
}, {
code?: string;
message?: string;
}, FetchOptions["throw"] extends true ? true : false>>;
} & {
changeEmail: <FetchOptions extends {
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 | Promise<string | undefined> | (() => string | Promise<string | undefined> | 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<{
newEmail: string;
callbackURL?: string | undefined;
}> & 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;
}>(data_0: better_auth_dist_shared_better_auth_CYegVoq1.P<{
newEmail: string;
callbackURL?: string | undefined;
} & {
fetchOptions?: FetchOptions | undefined;
}>, data_1?: FetchOptions | undefined) => Promise<better_auth_react.BetterFetchResponse<{
status: boolean;
}, {
code?: string;
message?: string;
}, FetchOptions["throw"] extends true ? true : false>>;
} & {
changePassword: <FetchOptions extends {
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 | Promise<string | undefined> | (() => string | Promise<string | undefined> | 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<{
newPassword: string;
currentPassword: string;
revokeOtherSessions?: boolean | undefined;
}> & 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;
}>(data_0: better_auth_dist_shared_better_auth_CYegVoq1.P<{
newPassword: string;
currentPassword: string;
revokeOtherSessions?: boolean | undefined;
} & {
fetchOptions?: FetchOptions | undefined;
}>, data_1?: FetchOptions | undefined) => Promise<better_auth_react.BetterFetchResponse<{
token: string | null;
user: {
id: string;
email: string;
name: string;
image: string | null | undefined;
emailVerified: boolean;
createdAt: Date;
updatedAt: Date;
};
}, {
code?: string;
message?: string;
}, FetchOptions["throw"] extends true ? true : false>>;
} & {
deleteUser: <FetchOptions extends {
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