Skip to content
File

Blob: src/worker/types.ts

typescript23 lines
1import type { Context } from "hono";
2import type { SessionRecord } from "@/shared/contracts";
3import type { Database } from "@/worker/db";
4import type { inboxes } from "@/worker/db/schema";
5 
6export type InboxRecord = typeof inboxes.$inferSelect;
7 
8export 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 
17export interface AppBindings {
18 Bindings: Env;
19 Variables: AppVariables;
20}
21 
22export type AppContext = Context<AppBindings>;