better-auth
Version:
The most comprehensive authentication framework for TypeScript.
1,560 lines (1,558 loc) • 417 kB
text/typescript
import { Prettify as Prettify$1, UnionToIntersection } from "../types/helper.mjs";
import { InferRoute } from "../client/path-to-object.mjs";
import { InferErrorCodes, IsSignal, SessionQueryParams } from "../client/types.mjs";
import { FilteredAPI, InferAPI } from "../types/api.mjs";
import { Session, User } from "../types/models.mjs";
import { Auth } from "../types/auth.mjs";
import "../types/index.mjs";
import "../index.mjs";
import { setCookieToHeader } from "../cookies/cookie-utils.mjs";
import "../cookies/index.mjs";
import * as _better_auth_core26 from "@better-auth/core";
import { Awaitable, BetterAuthClientOptions, BetterAuthOptions } from "@better-auth/core";
import * as _better_auth_core_oauth22 from "@better-auth/core/oauth2";
import * as _better_auth_core_db_adapter0 from "@better-auth/core/db/adapter";
import * as better_call307 from "better-call";
import * as zod618 from "zod";
import * as nanostores4 from "nanostores";
import * as _better_fetch_fetch96 from "@better-fetch/fetch";
import { SuccessContext } from "@better-fetch/fetch";
import * as zod_v4_core93 from "zod/v4/core";
//#region src/test-utils/test-instance.d.ts
declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends BetterAuthClientOptions>(options?: O | undefined, config?: {
clientOptions?: C;
port?: number;
disableTestUser?: boolean;
testUser?: Partial<User>;
testWith?: "sqlite" | "postgres" | "mongodb" | "mysql";
} | undefined): Promise<{
auth: Auth<O>;
client: UnionToIntersection<(C extends undefined ? {} : C) & {
baseURL: string | undefined;
fetchOptions: {
customFetchImpl: (url: string | URL | Request, init?: RequestInit | undefined) => Promise<Response>;
};
} extends infer T ? T extends (C extends undefined ? {} : C) & {
baseURL: string | undefined;
fetchOptions: {
customFetchImpl: (url: string | URL | Request, init?: RequestInit | undefined) => Promise<Response>;
};
} ? T extends {
plugins: Array<infer Plugin>;
} ? UnionToIntersection<Plugin extends _better_auth_core26.BetterAuthClientPlugin ? Plugin["getAtoms"] extends ((fetch: any) => infer Atoms) ? Atoms extends Record<string, any> ? { [key in keyof Atoms as IsSignal<key> extends true ? never : key extends string ? `use${Capitalize<key>}` : never]: Atoms[key] } : {} : {} : {}> : {} : never : never> & UnionToIntersection<InferRoute<((C extends undefined ? {} : C) & {
baseURL: string | undefined;
fetchOptions: {
customFetchImpl: (url: string | URL | Request, init?: RequestInit | undefined) => Promise<Response>;
};
})["plugins"] extends any[] ? {
getSession: <R extends boolean, H extends boolean = false>(context: {
headers: Headers;
query?: {
disableCookieCache?: boolean;
disableRefresh?: boolean;
} | undefined;
asResponse?: R | undefined;
returnHeaders?: H | undefined;
}) => false extends R ? H extends true ? Promise<{
headers: Headers;
response: {
session: {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
};
user: {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
};
} | null;
}> : Promise<{
session: {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
};
user: {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
};
} | null> : Promise<Response>;
} & FilteredAPI<{
readonly ok: better_call307.StrictEndpoint<"/ok", {
method: "GET";
metadata: {
openapi: {
description: string;
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
ok: {
type: string;
description: string;
};
};
required: string[];
};
};
};
};
};
};
scope: "server";
};
}, {
ok: boolean;
}>;
readonly error: better_call307.StrictEndpoint<"/error", {
method: "GET";
metadata: {
openapi: {
description: string;
responses: {
"200": {
description: string;
content: {
"text/html": {
schema: {
type: "string";
description: string;
};
};
};
};
};
};
scope: "server";
};
}, Response>;
readonly signInSocial: better_call307.StrictEndpoint<"/sign-in/social", {
method: "POST";
operationId: string;
body: zod618.ZodObject<{
callbackURL: zod618.ZodOptional<zod618.ZodString>;
newUserCallbackURL: zod618.ZodOptional<zod618.ZodString>;
errorCallbackURL: zod618.ZodOptional<zod618.ZodString>;
provider: zod618.ZodType<"github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel" | (string & {}), unknown, zod_v4_core93.$ZodTypeInternals<"github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel" | (string & {}), unknown>>;
disableRedirect: zod618.ZodOptional<zod618.ZodBoolean>;
idToken: zod618.ZodOptional<zod618.ZodObject<{
token: zod618.ZodString;
nonce: zod618.ZodOptional<zod618.ZodString>;
accessToken: zod618.ZodOptional<zod618.ZodString>;
refreshToken: zod618.ZodOptional<zod618.ZodString>;
expiresAt: zod618.ZodOptional<zod618.ZodNumber>;
}, zod_v4_core93.$strip>>;
scopes: zod618.ZodOptional<zod618.ZodArray<zod618.ZodString>>;
requestSignUp: zod618.ZodOptional<zod618.ZodBoolean>;
loginHint: zod618.ZodOptional<zod618.ZodString>;
additionalData: zod618.ZodOptional<zod618.ZodRecord<zod618.ZodString, zod618.ZodAny>>;
}, zod_v4_core93.$strip>;
metadata: {
$Infer: {
body: zod618.infer<zod618.ZodObject<{
callbackURL: zod618.ZodOptional<zod618.ZodString>;
newUserCallbackURL: zod618.ZodOptional<zod618.ZodString>;
errorCallbackURL: zod618.ZodOptional<zod618.ZodString>;
provider: zod618.ZodType<"github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel" | (string & {}), unknown, zod_v4_core93.$ZodTypeInternals<"github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel" | (string & {}), unknown>>;
disableRedirect: zod618.ZodOptional<zod618.ZodBoolean>;
idToken: zod618.ZodOptional<zod618.ZodObject<{
token: zod618.ZodString;
nonce: zod618.ZodOptional<zod618.ZodString>;
accessToken: zod618.ZodOptional<zod618.ZodString>;
refreshToken: zod618.ZodOptional<zod618.ZodString>;
expiresAt: zod618.ZodOptional<zod618.ZodNumber>;
}, zod_v4_core93.$strip>>;
scopes: zod618.ZodOptional<zod618.ZodArray<zod618.ZodString>>;
requestSignUp: zod618.ZodOptional<zod618.ZodBoolean>;
loginHint: zod618.ZodOptional<zod618.ZodString>;
additionalData: zod618.ZodOptional<zod618.ZodRecord<zod618.ZodString, zod618.ZodAny>>;
}, zod_v4_core93.$strip>>;
returned: {
redirect: boolean;
token?: string | undefined;
url?: string | undefined;
user?: {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
} | undefined;
};
};
openapi: {
description: string;
operationId: string;
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
description: string;
properties: {
token: {
type: string;
};
user: {
type: string;
$ref: string;
};
url: {
type: string;
};
redirect: {
type: string;
enum: boolean[];
};
};
required: string[];
};
};
};
};
};
};
};
}, {
redirect: boolean;
url: string;
} | {
redirect: boolean;
token: string;
url: undefined;
user: {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
};
}>;
readonly callbackOAuth: better_call307.StrictEndpoint<"/callback/:id", {
method: ("GET" | "POST")[];
operationId: string;
body: zod618.ZodOptional<zod618.ZodObject<{
code: zod618.ZodOptional<zod618.ZodString>;
error: zod618.ZodOptional<zod618.ZodString>;
device_id: zod618.ZodOptional<zod618.ZodString>;
error_description: zod618.ZodOptional<zod618.ZodString>;
state: zod618.ZodOptional<zod618.ZodString>;
user: zod618.ZodOptional<zod618.ZodString>;
}, zod_v4_core93.$strip>>;
query: zod618.ZodOptional<zod618.ZodObject<{
code: zod618.ZodOptional<zod618.ZodString>;
error: zod618.ZodOptional<zod618.ZodString>;
device_id: zod618.ZodOptional<zod618.ZodString>;
error_description: zod618.ZodOptional<zod618.ZodString>;
state: zod618.ZodOptional<zod618.ZodString>;
user: zod618.ZodOptional<zod618.ZodString>;
}, zod_v4_core93.$strip>>;
metadata: {
allowedMediaTypes: string[];
scope: "server";
};
}, void>;
readonly getSession: better_call307.StrictEndpoint<"/get-session", {
method: "GET";
operationId: string;
query: zod618.ZodOptional<zod618.ZodObject<{
disableCookieCache: zod618.ZodOptional<zod618.ZodCoercedBoolean<unknown>>;
disableRefresh: zod618.ZodOptional<zod618.ZodCoercedBoolean<unknown>>;
}, zod_v4_core93.$strip>>;
requireHeaders: true;
metadata: {
openapi: {
operationId: string;
description: string;
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
nullable: boolean;
properties: {
session: {
$ref: string;
};
user: {
$ref: string;
};
};
required: string[];
};
};
};
};
};
};
};
}, {
session: {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
};
user: {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
};
} | null>;
readonly signOut: better_call307.StrictEndpoint<"/sign-out", {
method: "POST";
operationId: string;
requireHeaders: true;
metadata: {
openapi: {
operationId: string;
description: string;
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
success: {
type: string;
};
};
};
};
};
};
};
};
};
}, {
success: boolean;
}>;
readonly signUpEmail: better_call307.StrictEndpoint<"/sign-up/email", {
method: "POST";
operationId: string;
use: ((inputContext: better_call307.MiddlewareInputContext<better_call307.MiddlewareOptions>) => Promise<void>)[];
body: zod618.ZodIntersection<zod618.ZodObject<{
name: zod618.ZodString;
email: zod618.ZodEmail;
password: zod618.ZodString;
image: zod618.ZodOptional<zod618.ZodString>;
callbackURL: zod618.ZodOptional<zod618.ZodString>;
rememberMe: zod618.ZodOptional<zod618.ZodBoolean>;
}, zod_v4_core93.$strip>, zod618.ZodRecord<zod618.ZodString, zod618.ZodAny>>;
metadata: {
allowedMediaTypes: string[];
$Infer: {
body: {
name: string;
email: string;
password: string;
image?: string | undefined;
callbackURL?: string | undefined;
rememberMe?: boolean | undefined;
};
returned: {
token: string | null;
user: {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
};
};
};
openapi: {
operationId: string;
description: string;
requestBody: {
content: {
"application/json": {
schema: {
type: "object";
properties: {
name: {
type: string;
description: string;
};
email: {
type: string;
description: string;
};
password: {
type: string;
description: string;
};
image: {
type: string;
description: string;
};
callbackURL: {
type: string;
description: string;
};
rememberMe: {
type: string;
description: string;
};
};
required: string[];
};
};
};
};
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
token: {
type: string;
nullable: boolean;
description: string;
};
user: {
type: string;
properties: {
id: {
type: string;
description: string;
};
email: {
type: string;
format: string;
description: string;
};
name: {
type: string;
description: string;
};
image: {
type: string;
format: string;
nullable: boolean;
description: string;
};
emailVerified: {
type: string;
description: string;
};
createdAt: {
type: string;
format: string;
description: string;
};
updatedAt: {
type: string;
format: string;
description: string;
};
};
required: string[];
};
};
required: string[];
};
};
};
};
"422": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
message: {
type: string;
};
};
};
};
};
};
};
};
};
}, {
token: null;
user: {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
};
} | {
token: string;
user: {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
};
}>;
readonly signInEmail: better_call307.StrictEndpoint<"/sign-in/email", {
method: "POST";
operationId: string;
use: ((inputContext: better_call307.MiddlewareInputContext<better_call307.MiddlewareOptions>) => Promise<void>)[];
body: zod618.ZodObject<{
email: zod618.ZodString;
password: zod618.ZodString;
callbackURL: zod618.ZodOptional<zod618.ZodString>;
rememberMe: zod618.ZodOptional<zod618.ZodDefault<zod618.ZodBoolean>>;
}, zod_v4_core93.$strip>;
metadata: {
allowedMediaTypes: string[];
$Infer: {
body: {
email: string;
password: string;
callbackURL?: string | undefined;
rememberMe?: boolean | undefined;
};
returned: {
redirect: boolean;
token: string;
url?: string | undefined;
user: {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
};
};
};
openapi: {
operationId: string;
description: string;
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
description: string;
properties: {
redirect: {
type: string;
enum: boolean[];
};
token: {
type: string;
description: string;
};
url: {
type: string;
nullable: boolean;
};
user: {
type: string;
$ref: string;
};
};
required: string[];
};
};
};
};
};
};
};
}, {
redirect: boolean;
token: string;
url?: string | undefined;
user: {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
};
}>;
readonly resetPassword: better_call307.StrictEndpoint<"/reset-password", {
method: "POST";
operationId: string;
query: zod618.ZodOptional<zod618.ZodObject<{
token: zod618.ZodOptional<zod618.ZodString>;
}, zod_v4_core93.$strip>>;
body: zod618.ZodObject<{
newPassword: zod618.ZodString;
token: zod618.ZodOptional<zod618.ZodString>;
}, zod_v4_core93.$strip>;
metadata: {
openapi: {
operationId: string;
description: string;
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
status: {
type: string;
};
};
};
};
};
};
};
};
};
}, {
status: boolean;
}>;
readonly verifyPassword: better_call307.StrictEndpoint<"/verify-password", {
method: "POST";
body: zod618.ZodObject<{
password: zod618.ZodString;
}, zod_v4_core93.$strip>;
metadata: {
scope: "server";
openapi: {
operationId: string;
description: string;
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
status: {
type: string;
};
};
};
};
};
};
};
};
};
use: ((inputContext: better_call307.MiddlewareInputContext<better_call307.MiddlewareOptions>) => Promise<{
session: {
session: Record<string, any> & {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
};
user: Record<string, any> & {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
};
};
}>)[];
}, {
status: boolean;
}>;
readonly verifyEmail: better_call307.StrictEndpoint<"/verify-email", {
method: "GET";
operationId: string;
query: zod618.ZodObject<{
token: zod618.ZodString;
callbackURL: zod618.ZodOptional<zod618.ZodString>;
}, zod_v4_core93.$strip>;
use: ((inputContext: better_call307.MiddlewareInputContext<better_call307.MiddlewareOptions>) => Promise<void>)[];
metadata: {
openapi: {
description: string;
parameters: ({
name: string;
in: "query";
description: string;
required: true;
schema: {
type: "string";
};
} | {
name: string;
in: "query";
description: string;
required: false;
schema: {
type: "string";
};
})[];
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
user: {
type: string;
$ref: string;
};
status: {
type: string;
description: string;
};
};
required: string[];
};
};
};
};
};
};
};
}, void | {
status: boolean;
}>;
readonly sendVerificationEmail: better_call307.StrictEndpoint<"/send-verification-email", {
method: "POST";
operationId: string;
body: zod618.ZodObject<{
email: zod618.ZodEmail;
callbackURL: zod618.ZodOptional<zod618.ZodString>;
}, zod_v4_core93.$strip>;
metadata: {
openapi: {
operationId: string;
description: string;
requestBody: {
content: {
"application/json": {
schema: {
type: "object";
properties: {
email: {
type: string;
description: string;
example: string;
};
callbackURL: {
type: string;
description: string;
example: string;
nullable: boolean;
};
};
required: string[];
};
};
};
};
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
status: {
type: string;
description: string;
example: boolean;
};
};
};
};
};
};
"400": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
message: {
type: string;
description: string;
example: string;
};
};
};
};
};
};
};
};
};
}, {
status: boolean;
}>;
readonly changeEmail: better_call307.StrictEndpoint<"/change-email", {
method: "POST";
body: zod618.ZodObject<{
newEmail: zod618.ZodEmail;
callbackURL: zod618.ZodOptional<zod618.ZodString>;
}, zod_v4_core93.$strip>;
use: ((inputContext: better_call307.MiddlewareInputContext<better_call307.MiddlewareOptions>) => Promise<{
session: {
session: Record<string, any> & {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
};
user: Record<string, any> & {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
};
};
}>)[];
metadata: {
openapi: {
operationId: string;
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
user: {
type: string;
$ref: string;
};
status: {
type: string;
description: string;
};
message: {
type: string;
enum: string[];
description: string;
nullable: boolean;
};
};
required: string[];
};
};
};
};
"422": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
message: {
type: string;
};
};
};
};
};
};
};
};
};
}, {
status: boolean;
}>;
readonly changePassword: better_call307.StrictEndpoint<"/change-password", {
method: "POST";
operationId: string;
body: zod618.ZodObject<{
newPassword: zod618.ZodString;
currentPassword: zod618.ZodString;
revokeOtherSessions: zod618.ZodOptional<zod618.ZodBoolean>;
}, zod_v4_core93.$strip>;
use: ((inputContext: better_call307.MiddlewareInputContext<better_call307.MiddlewareOptions>) => Promise<{
session: {
session: Record<string, any> & {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
};
user: Record<string, any> & {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
};
};
}>)[];
metadata: {
openapi: {
operationId: string;
description: string;
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
token: {
type: string;
nullable: boolean;
description: string;
};
user: {
type: string;
properties: {
id: {
type: string;
description: string;
};
email: {
type: string;
format: string;
description: string;
};
name: {
type: string;
description: string;
};
image: {
type: string;
format: string;
nullable: boolean;
description: string;
};
emailVerified: {
type: string;
description: string;
};
createdAt: {
type: string;
format: string;
description: string;
};
updatedAt: {
type: string;
format: string;
description: string;
};
};
required: string[];
};
};
required: string[];
};
};
};
};
};
};
};
}, {
token: string | null;
user: {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
} & Record<string, any>;
}>;
readonly setPassword: better_call307.StrictEndpoint<string, {
method: "POST";
body: zod618.ZodObject<{
newPassword: zod618.ZodString;
}, zod_v4_core93.$strip>;
use: ((inputContext: better_call307.MiddlewareInputContext<better_call307.MiddlewareOptions>) => Promise<{
session: {
session: Record<string, any> & {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
};
user: Record<string, any> & {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
};
};
}>)[];
}, {
status: boolean;
}>;
readonly updateUser: better_call307.StrictEndpoint<"/update-user", {
method: "POST";
operationId: string;
body: zod618.ZodRecord<zod618.ZodString, zod618.ZodAny>;
use: ((inputContext: better_call307.MiddlewareInputContext<better_call307.MiddlewareOptions>) => Promise<{
session: {
session: Record<string, any> & {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
};
user: Record<string, any> & {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
};
};
}>)[];
metadata: {
$Infer: {
body: Partial<{}> & {
name?: string | undefined;
image?: string | undefined | null;
};
};
openapi: {
operationId: string;
description: string;
requestBody: {
content: {
"application/json": {
schema: {
type: "object";
properties: {
name: {
type: string;
description: string;
};
image: {
type: string;
description: string;
nullable: boolean;
};
};
};
};
};
};
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
user: {
type: string;
$ref: string;
};
};
};
};
};
};
};
};
};
}, {
status: boolean;
}>;
readonly deleteUser: better_call307.StrictEndpoint<"/delete-user", {
method: "POST";
use: ((inputContext: better_call307.MiddlewareInputContext<better_call307.MiddlewareOptions>) => Promise<{
session: {
session: Record<string, any> & {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
};
user: Record<string, any> & {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
};
};
}>)[];
body: zod618.ZodObject<{
callbackURL: zod618.ZodOptional<zod618.ZodString>;
password: zod618.ZodOptional<zod618.ZodString>;
token: zod618.ZodOptional<zod618.ZodString>;
}, zod_v4_core93.$strip>;
metadata: {
openapi: {
operationId: string;
description: string;
requestBody: {
content: {
"application/json": {
schema: {
type: "object";
properties: {
callbackURL: {
type: string;
description: string;
};
password: {
type: string;
description: string;
};
token: {
type: string;
description: string;
};
};
};
};
};
};
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
success: {
type: string;
description: string;
};
message: {
type: string;
enum: string[];
description: string;
};
};
required: string[];
};
};
};
};
};
};
};
}, {
success: boolean;
message: string;
}>;
readonly requestPasswordReset: better_call307.StrictEndpoint<"/request-password-reset", {
method: "POST";
body: zod618.ZodObject<{
email: zod618.ZodEmail;
redirectTo: zod618.ZodOptional<zod618.ZodString>;
}, zod_v4_core93.$strip>;
metadata: {
openapi: {
operationId: string;
description: string;
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
status: {
type: string;
};
message: {
type: string;
};
};
};
};
};
};
};
};
};
}, {
status: boolean;
message: string;
}>;
readonly requestPasswordResetCallback: better_call307.StrictEndpoint<"/reset-password/:token", {
method: "GET";
operationId: string;
query: zod618.ZodObject<{
callbackURL: zod618.ZodString;
}, zod_v4_core93.$strip>;
use: ((inputContext: better_call307.MiddlewareInputContext<better_call307.MiddlewareOptions>) => Promise<void>)[];
metadata: {
openapi: {
operationId: string;
description: string;
parameters: ({
name: string;
in: "path";
required: true;
description: string;
schema: {
type: "string";
};
} | {
name: string;
in: "query";
required: true;
description: string;
schema: {
type: "string";
};
})[];
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
token: {
type: string;
};
};
};
};
};
};
};
};
};
}, never>;
readonly listSessions: better_call307.StrictEndpoint<"/list-sessions", {
method: "GET";
operationId: string;
use: ((inputContext: better_call307.MiddlewareInputContext<better_call307.MiddlewareOptions>) => Promise<{
session: {
session: Record<string, any> & {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
};
user: Record<string, any> & {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
};
};
}>)[];
requireHeaders: true;
metadata: {
openapi: {
operationId: string;
description: string;
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "array";
items: {
$ref: string;
};
};
};
};
};
};
};
};
}, Prettify$1<{
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
}>[]>;
readonly revokeSession: better_call307.StrictEndpoint<"/revoke-session", {
method: "POST";
body: zod618.ZodObject<{
token: zod618.ZodString;
}, zod_v4_core93.$strip>;
use: ((inputContext: better_call307.MiddlewareInputContext<better_call307.MiddlewareOptions>) => Promise<{
session: {
session: Record<string, any> & {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
};
user: Record<string, any> & {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
};
};
}>)[];
requireHeaders: true;
metadata: {
openapi: {
description: string;
requestBody: {
content: {
"application/json": {
schema: {
type: "object";
properties: {
token: {
type: string;
description: string;
};
};
required: string[];
};
};
};
};
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
status: {
type: string;
description: string;
};
};
required: string[];
};
};
};
};
};
};
};
}, {
status: boolean;
}>;
readonly revokeSessions: better_call307.StrictEndpoint<"/revoke-sessions", {
method: "POST";
use: ((inputContext: better_call307.MiddlewareInputContext<better_call307.MiddlewareOptions>) => Promise<{
session: {
session: Record<string, any> & {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
};
user: Record<string, any> & {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
};
};
}>)[];
requireHeaders: true;
metadata: {
openapi: {
description: string;
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
status: {
type: string;
description: string;
};
};
required: string[];
};
};
};
};
};
};
};
}, {
status: boolean;
}>;
readonly revokeOtherSessions: better_call307.StrictEndpoint<"/revoke-other-sessions", {
method: "POST";
requireHeaders: true;
use: ((inputContext: better_call307.MiddlewareInputContext<better_call307.MiddlewareOptions>) => Promise<{
session: {
session: Record<string, any> & {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
};
user: Record<string, any> & {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
};
};
}>)[];
metadata: {
openapi: {
description: string;
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
status: {
type: string;
description: string;
};
};
required: string[];
};
};
};
};
};
};
};
}, {
status: boolean;