File
Blob: src/worker/types.ts
| 1 | import type { Context } from "hono"; |
| 2 | import type { SessionRecord } from "@/shared/contracts"; |
| 3 | import type { Database } from "@/worker/db"; |
| 4 | import type { inboxes } from "@/worker/db/schema"; |
| 5 | |
| 6 | export type InboxRecord = typeof inboxes.$inferSelect; |
| 7 | |
| 8 | export interface AppVariables { |
| 9 | db: Database; |
| 10 | session: SessionRecord; |
| 11 | // Set when authentication came from the Authorization bearer header |
| 12 | // (user inbox flow). Cookie-backed admin flows leave it undefined. |
| 13 | token?: string; |
| 14 | inbox: InboxRecord; |
| 15 | } |
| 16 | |
| 17 | export interface AppBindings { |
| 18 | Bindings: Env; |
| 19 | Variables: AppVariables; |
| 20 | } |
| 21 | |
| 22 | export type AppContext = Context<AppBindings>; |