@daveyplate/better-auth-persistent
Version:
Persistent session management for Better Auth
934 lines (928 loc) • 127 kB
text/typescript
import * as _better_fetch_fetch from '@better-fetch/fetch';
import { BetterFetchError } from '@better-fetch/fetch';
import * as better_auth_react from 'better-auth/react';
import { createAuthClient } from 'better-auth/react';
import * as nanostores from 'nanostores';
import * as better_auth from 'better-auth';
import { Session, User } from 'better-auth';
type AnyAuthClient = Omit<ReturnType<typeof createAuthClient>, "signUp" | "getSession">;
declare function useListDeviceSessions<TAuthClient extends AnyAuthClient>(_?: TAuthClient): {
data: TAuthClient["$Infer"]["Session"][] | null;
isPending: boolean;
isRefetching: boolean;
error: _better_fetch_fetch.BetterFetchError["error"] | null;
refetch: () => Promise<void>;
};
declare function useSession<TAuthClient extends AnyAuthClient>(authClient: TAuthClient): {
data: null;
isPending: boolean;
isRefetching: boolean;
error: null;
refetch: () => Promise<void>;
} | {
data: TAuthClient["$Infer"]["Session"] | null;
isPending: boolean;
isRefetching: boolean;
optimistic?: boolean;
error: _better_fetch_fetch.BetterFetchError["error"] | null;
refetch: () => Promise<void>;
};
declare function useSubscribeDeviceSessions(): void;
declare function setActiveSession({ sessionToken }: {
sessionToken: string;
}): Promise<void>;
declare const $authClient: nanostores.PreinitializedWritableAtom<({
multiSession: {
listDeviceSessions: <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_fetch_fetch.RequestContext<T>) => Promise<_better_fetch_fetch.RequestContext | void> | _better_fetch_fetch.RequestContext | void) | undefined;
onResponse?: ((context: _better_fetch_fetch.ResponseContext) => Promise<Response | void | _better_fetch_fetch.ResponseContext> | Response | _better_fetch_fetch.ResponseContext | void) | undefined;
onSuccess?: ((context: _better_fetch_fetch.SuccessContext<any>) => Promise<void> | void) | undefined;
onError?: ((context: _better_fetch_fetch.ErrorContext) => Promise<void> | void) | undefined;
onRetry?: ((response: _better_fetch_fetch.ResponseContext) => Promise<void> | void) | undefined;
hookOptions?: {
cloneResponse?: boolean;
} | undefined;
timeout?: number | undefined;
customFetchImpl?: _better_fetch_fetch.FetchEsque | undefined;
plugins?: _better_fetch_fetch.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_fetch_fetch.RetryOptions | undefined;
retryAttempt?: number | undefined;
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
disableValidation?: boolean | undefined;
}>(data_0?: better_auth.Prettify<{
query?: Record<string, any> | undefined;
fetchOptions?: FetchOptions | undefined;
}> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
session: better_auth.Session;
user: better_auth.User;
}[], {
code?: string;
message?: string;
}, FetchOptions["throw"] extends true ? true : false>>;
};
} & {
multiSession: {
setActive: <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_fetch_fetch.RequestContext<T>) => Promise<_better_fetch_fetch.RequestContext | void> | _better_fetch_fetch.RequestContext | void) | undefined;
onResponse?: ((context: _better_fetch_fetch.ResponseContext) => Promise<Response | void | _better_fetch_fetch.ResponseContext> | Response | _better_fetch_fetch.ResponseContext | void) | undefined;
onSuccess?: ((context: _better_fetch_fetch.SuccessContext<any>) => Promise<void> | void) | undefined;
onError?: ((context: _better_fetch_fetch.ErrorContext) => Promise<void> | void) | undefined;
onRetry?: ((response: _better_fetch_fetch.ResponseContext) => Promise<void> | void) | undefined;
hookOptions?: {
cloneResponse?: boolean;
} | undefined;
timeout?: number | undefined;
customFetchImpl?: _better_fetch_fetch.FetchEsque | undefined;
plugins?: _better_fetch_fetch.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<{
sessionToken: string;
}> & 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_fetch_fetch.RetryOptions | undefined;
retryAttempt?: number | undefined;
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
disableValidation?: boolean | undefined;
}>(data_0: better_auth.Prettify<{
sessionToken: string;
} & {
fetchOptions?: FetchOptions | undefined;
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
session: better_auth.Session & Record<string, any>;
user: better_auth.User & Record<string, any>;
}, {
code?: string;
message?: string;
}, FetchOptions["throw"] extends true ? true : false>>;
};
} & {
multiSession: {
revoke: <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_fetch_fetch.RequestContext<T>) => Promise<_better_fetch_fetch.RequestContext | void> | _better_fetch_fetch.RequestContext | void) | undefined;
onResponse?: ((context: _better_fetch_fetch.ResponseContext) => Promise<Response | void | _better_fetch_fetch.ResponseContext> | Response | _better_fetch_fetch.ResponseContext | void) | undefined;
onSuccess?: ((context: _better_fetch_fetch.SuccessContext<any>) => Promise<void> | void) | undefined;
onError?: ((context: _better_fetch_fetch.ErrorContext) => Promise<void> | void) | undefined;
onRetry?: ((response: _better_fetch_fetch.ResponseContext) => Promise<void> | void) | undefined;
hookOptions?: {
cloneResponse?: boolean;
} | undefined;
timeout?: number | undefined;
customFetchImpl?: _better_fetch_fetch.FetchEsque | undefined;
plugins?: _better_fetch_fetch.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<{
sessionToken: string;
}> & 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_fetch_fetch.RetryOptions | undefined;
retryAttempt?: number | undefined;
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
disableValidation?: boolean | undefined;
}>(data_0: better_auth.Prettify<{
sessionToken: string;
} & {
fetchOptions?: FetchOptions | undefined;
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
status: boolean;
}, {
code?: string;
message?: string;
}, FetchOptions["throw"] extends true ? true : false>>;
};
} & {
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_fetch_fetch.RequestContext<T>) => Promise<_better_fetch_fetch.RequestContext | void> | _better_fetch_fetch.RequestContext | void) | undefined;
onResponse?: ((context: _better_fetch_fetch.ResponseContext) => Promise<Response | void | _better_fetch_fetch.ResponseContext> | Response | _better_fetch_fetch.ResponseContext | void) | undefined;
onSuccess?: ((context: _better_fetch_fetch.SuccessContext<any>) => Promise<void> | void) | undefined;
onError?: ((context: _better_fetch_fetch.ErrorContext) => Promise<void> | void) | undefined;
onRetry?: ((response: _better_fetch_fetch.ResponseContext) => Promise<void> | void) | undefined;
hookOptions?: {
cloneResponse?: boolean;
} | undefined;
timeout?: number | undefined;
customFetchImpl?: _better_fetch_fetch.FetchEsque | undefined;
plugins?: _better_fetch_fetch.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: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "huggingface" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "vk" | "zoom" | (string & {});
callbackURL?: string | undefined;
newUserCallbackURL?: string | undefined;
errorCallbackURL?: string | undefined;
disableRedirect?: boolean | undefined;
idToken?: {
token: string;
nonce?: string | undefined;
accessToken?: string | undefined;
refreshToken?: string | undefined;
expiresAt?: number | undefined;
} | undefined;
scopes?: string[] | undefined;
requestSignUp?: boolean | undefined;
loginHint?: 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_fetch_fetch.RetryOptions | undefined;
retryAttempt?: number | undefined;
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
disableValidation?: boolean | undefined;
}>(data_0: better_auth.Prettify<{
provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "huggingface" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "vk" | "zoom" | (string & {});
callbackURL?: string | undefined;
newUserCallbackURL?: string | undefined;
errorCallbackURL?: string | undefined;
disableRedirect?: boolean | undefined;
idToken?: {
token: string;
nonce?: string | undefined;
accessToken?: string | undefined;
refreshToken?: string | undefined;
expiresAt?: number | undefined;
} | undefined;
scopes?: string[] | undefined;
requestSignUp?: boolean | undefined;
loginHint?: string | undefined;
} & {
fetchOptions?: FetchOptions | undefined;
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.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_fetch_fetch.RequestContext<T>) => Promise<_better_fetch_fetch.RequestContext | void> | _better_fetch_fetch.RequestContext | void) | undefined;
onResponse?: ((context: _better_fetch_fetch.ResponseContext) => Promise<Response | void | _better_fetch_fetch.ResponseContext> | Response | _better_fetch_fetch.ResponseContext | void) | undefined;
onSuccess?: ((context: _better_fetch_fetch.SuccessContext<any>) => Promise<void> | void) | undefined;
onError?: ((context: _better_fetch_fetch.ErrorContext) => Promise<void> | void) | undefined;
onRetry?: ((response: _better_fetch_fetch.ResponseContext) => Promise<void> | void) | undefined;
hookOptions?: {
cloneResponse?: boolean;
} | undefined;
timeout?: number | undefined;
customFetchImpl?: _better_fetch_fetch.FetchEsque | undefined;
plugins?: _better_fetch_fetch.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_fetch_fetch.RetryOptions | undefined;
retryAttempt?: number | undefined;
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
disableValidation?: boolean | undefined;
}>(data_0?: better_auth.Prettify<{
query?: {
disableCookieCache?: string | boolean | undefined;
disableRefresh?: string | boolean | undefined;
} | undefined;
fetchOptions?: FetchOptions | undefined;
}> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
user: {
id: string;
name: string;
emailVerified: boolean;
email: string;
createdAt: Date;
updatedAt: Date;
image?: string | null | undefined | undefined;
};
session: {
id: string;
token: string;
userId: string;
expiresAt: Date;
createdAt: Date;
updatedAt: Date;
ipAddress?: string | null | undefined | undefined;
userAgent?: string | null | undefined | undefined;
};
} | null, {
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_fetch_fetch.RequestContext<T>) => Promise<_better_fetch_fetch.RequestContext | void> | _better_fetch_fetch.RequestContext | void) | undefined;
onResponse?: ((context: _better_fetch_fetch.ResponseContext) => Promise<Response | void | _better_fetch_fetch.ResponseContext> | Response | _better_fetch_fetch.ResponseContext | void) | undefined;
onSuccess?: ((context: _better_fetch_fetch.SuccessContext<any>) => Promise<void> | void) | undefined;
onError?: ((context: _better_fetch_fetch.ErrorContext) => Promise<void> | void) | undefined;
onRetry?: ((response: _better_fetch_fetch.ResponseContext) => Promise<void> | void) | undefined;
hookOptions?: {
cloneResponse?: boolean;
} | undefined;
timeout?: number | undefined;
customFetchImpl?: _better_fetch_fetch.FetchEsque | undefined;
plugins?: _better_fetch_fetch.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_fetch_fetch.RetryOptions | undefined;
retryAttempt?: number | undefined;
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
disableValidation?: boolean | undefined;
}>(data_0?: better_auth.Prettify<{
query?: Record<string, any> | undefined;
fetchOptions?: FetchOptions | undefined;
}> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.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_fetch_fetch.RequestContext<T>) => Promise<_better_fetch_fetch.RequestContext | void> | _better_fetch_fetch.RequestContext | void) | undefined;
onResponse?: ((context: _better_fetch_fetch.ResponseContext) => Promise<Response | void | _better_fetch_fetch.ResponseContext> | Response | _better_fetch_fetch.ResponseContext | void) | undefined;
onSuccess?: ((context: _better_fetch_fetch.SuccessContext<any>) => Promise<void> | void) | undefined;
onError?: ((context: _better_fetch_fetch.ErrorContext) => Promise<void> | void) | undefined;
onRetry?: ((response: _better_fetch_fetch.ResponseContext) => Promise<void> | void) | undefined;
hookOptions?: {
cloneResponse?: boolean;
} | undefined;
timeout?: number | undefined;
customFetchImpl?: _better_fetch_fetch.FetchEsque | undefined;
plugins?: _better_fetch_fetch.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;
password: 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_fetch_fetch.RetryOptions | undefined;
retryAttempt?: number | undefined;
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
disableValidation?: boolean | undefined;
}>(data_0: better_auth.Prettify<{
email: string;
password: string;
callbackURL?: string | undefined;
rememberMe?: boolean | undefined;
} & {
fetchOptions?: FetchOptions | undefined;
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.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_fetch_fetch.RequestContext<T>) => Promise<_better_fetch_fetch.RequestContext | void> | _better_fetch_fetch.RequestContext | void) | undefined;
onResponse?: ((context: _better_fetch_fetch.ResponseContext) => Promise<Response | void | _better_fetch_fetch.ResponseContext> | Response | _better_fetch_fetch.ResponseContext | void) | undefined;
onSuccess?: ((context: _better_fetch_fetch.SuccessContext<any>) => Promise<void> | void) | undefined;
onError?: ((context: _better_fetch_fetch.ErrorContext) => Promise<void> | void) | undefined;
onRetry?: ((response: _better_fetch_fetch.ResponseContext) => Promise<void> | void) | undefined;
hookOptions?: {
cloneResponse?: boolean;
} | undefined;
timeout?: number | undefined;
customFetchImpl?: _better_fetch_fetch.FetchEsque | undefined;
plugins?: _better_fetch_fetch.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_fetch_fetch.RetryOptions | undefined;
retryAttempt?: number | undefined;
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
disableValidation?: boolean | undefined;
}>(data_0: better_auth.Prettify<{
email: string;
redirectTo?: string | undefined;
} & {
fetchOptions?: FetchOptions | undefined;
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.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_fetch_fetch.RequestContext<T>) => Promise<_better_fetch_fetch.RequestContext | void> | _better_fetch_fetch.RequestContext | void) | undefined;
onResponse?: ((context: _better_fetch_fetch.ResponseContext) => Promise<Response | void | _better_fetch_fetch.ResponseContext> | Response | _better_fetch_fetch.ResponseContext | void) | undefined;
onSuccess?: ((context: _better_fetch_fetch.SuccessContext<any>) => Promise<void> | void) | undefined;
onError?: ((context: _better_fetch_fetch.ErrorContext) => Promise<void> | void) | undefined;
onRetry?: ((response: _better_fetch_fetch.ResponseContext) => Promise<void> | void) | undefined;
hookOptions?: {
cloneResponse?: boolean;
} | undefined;
timeout?: number | undefined;
customFetchImpl?: _better_fetch_fetch.FetchEsque | undefined;
plugins?: _better_fetch_fetch.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_fetch_fetch.RetryOptions | undefined;
retryAttempt?: number | undefined;
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
disableValidation?: boolean | undefined;
}>(data_0: better_auth.Prettify<{
newPassword: string;
token?: string | undefined;
} & {
fetchOptions?: FetchOptions | undefined;
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.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_fetch_fetch.RequestContext<T>) => Promise<_better_fetch_fetch.RequestContext | void> | _better_fetch_fetch.RequestContext | void) | undefined;
onResponse?: ((context: _better_fetch_fetch.ResponseContext) => Promise<Response | void | _better_fetch_fetch.ResponseContext> | Response | _better_fetch_fetch.ResponseContext | void) | undefined;
onSuccess?: ((context: _better_fetch_fetch.SuccessContext<any>) => Promise<void> | void) | undefined;
onError?: ((context: _better_fetch_fetch.ErrorContext) => Promise<void> | void) | undefined;
onRetry?: ((response: _better_fetch_fetch.ResponseContext) => Promise<void> | void) | undefined;
hookOptions?: {
cloneResponse?: boolean;
} | undefined;
timeout?: number | undefined;
customFetchImpl?: _better_fetch_fetch.FetchEsque | undefined;
plugins?: _better_fetch_fetch.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_fetch_fetch.RetryOptions | undefined;
retryAttempt?: number | undefined;
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
disableValidation?: boolean | undefined;
}>(data_0: better_auth.Prettify<{
query: {
token: string;
callbackURL?: string | undefined;
};
fetchOptions?: FetchOptions | undefined;
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.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_fetch_fetch.RequestContext<T>) => Promise<_better_fetch_fetch.RequestContext | void> | _better_fetch_fetch.RequestContext | void) | undefined;
onResponse?: ((context: _better_fetch_fetch.ResponseContext) => Promise<Response | void | _better_fetch_fetch.ResponseContext> | Response | _better_fetch_fetch.ResponseContext | void) | undefined;
onSuccess?: ((context: _better_fetch_fetch.SuccessContext<any>) => Promise<void> | void) | undefined;
onError?: ((context: _better_fetch_fetch.ErrorContext) => Promise<void> | void) | undefined;
onRetry?: ((response: _better_fetch_fetch.ResponseContext) => Promise<void> | void) | undefined;
hookOptions?: {
cloneResponse?: boolean;
} | undefined;
timeout?: number | undefined;
customFetchImpl?: _better_fetch_fetch.FetchEsque | undefined;
plugins?: _better_fetch_fetch.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_fetch_fetch.RetryOptions | undefined;
retryAttempt?: number | undefined;
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
disableValidation?: boolean | undefined;
}>(data_0: better_auth.Prettify<{
email: string;
callbackURL?: string | undefined;
} & {
fetchOptions?: FetchOptions | undefined;
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.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_fetch_fetch.RequestContext<T>) => Promise<_better_fetch_fetch.RequestContext | void> | _better_fetch_fetch.RequestContext | void) | undefined;
onResponse?: ((context: _better_fetch_fetch.ResponseContext) => Promise<Response | void | _better_fetch_fetch.ResponseContext> | Response | _better_fetch_fetch.ResponseContext | void) | undefined;
onSuccess?: ((context: _better_fetch_fetch.SuccessContext<any>) => Promise<void> | void) | undefined;
onError?: ((context: _better_fetch_fetch.ErrorContext) => Promise<void> | void) | undefined;
onRetry?: ((response: _better_fetch_fetch.ResponseContext) => Promise<void> | void) | undefined;
hookOptions?: {
cloneResponse?: boolean;
} | undefined;
timeout?: number | undefined;
customFetchImpl?: _better_fetch_fetch.FetchEsque | undefined;
plugins?: _better_fetch_fetch.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_fetch_fetch.RetryOptions | undefined;
retryAttempt?: number | undefined;
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
disableValidation?: boolean | undefined;
}>(data_0: better_auth.Prettify<{
newEmail: string;
c