import type { Context } from "hono"; import type { Auth } from "@/worker/auth"; import type { Database } from "@/worker/db"; import type { LogLevel, Logger } from "@/worker/logger"; // `Auth["$Infer"]["Session"]` is Better Auth's plugin-inferred session // shape — carries the admin plugin's `role`, `banned`, `banExpires`, // `banReason` and any future `additionalFields` (e.g. // `preferredUsername`) through to every handler that pulls the session // off the request context. Manually-written shapes drift as the plugin // tuple changes. export type AppSession = Auth["$Infer"]["Session"]; export interface AppBindings { Bindings: Env; Variables: { auth: Auth; baseURL: string; issuer: string; db: Database; log: Logger; logLevel: LogLevel; session?: AppSession | null; }; } export type AppContext = Context;