| 1 | import type { RegistryUser } from "./types"; |
| 2 | |
| 3 | // Cloudflare's native rate-limit binding (configured under [[unsafe.bindings]]). |
| 4 | export interface RateLimiter { |
| 5 | limit(opts: { key: string }): Promise<{ success: boolean }>; |
| 6 | } |
| 7 | |
| 8 | export interface Bindings { |
| 9 | DB: D1Database; |
| 10 | WRITE_LIMITER?: RateLimiter; |
| 11 | |
| 12 | // Plain vars (wrangler.toml [vars]). |
| 13 | ACCOUNTS_ORIGIN: string; |
| 14 | APP_ORIGIN: string; |
| 15 | ALLOWED_ORIGINS: string; |
| 16 | } |
| 17 | |
| 18 | // Set by requireAuth on protected routes; absent on public reads. |
| 19 | export interface Variables { |
| 20 | user: RegistryUser; |
| 21 | } |
| 22 | |
| 23 | export type AppEnv = { Bindings: Bindings; Variables: Variables }; |
| 24 |