| 1 | interface FixtureCache { |
| 2 | match(key: string | Request): Promise<Response | undefined>; |
| 3 | put(key: string | Request, response: Response): Promise<void>; |
| 4 | delete(key: string | Request): Promise<boolean>; |
| 5 | } |
| 6 | |
| 7 | interface FixtureKvNamespace { |
| 8 | get(key: string): Promise<string | null>; |
| 9 | put(key: string, value: string): Promise<void>; |
| 10 | delete(key: string): Promise<void>; |
| 11 | } |
| 12 | |
| 13 | /** Virtual module served by the user Vite plugin in `vite.config.ts`. */ |
| 14 | declare module "virtual:fixture-marker" { |
| 15 | export const marker: string; |
| 16 | } |
| 17 | |
| 18 | declare global { |
| 19 | namespace App { |
| 20 | interface Platform { |
| 21 | env?: { |
| 22 | FIXTURE_SECRET?: string; |
| 23 | /** |
| 24 | * Declared both as a Text binding and a dev `env` literal — the |
| 25 | * literal wins in dev, the binding value serves live. |
| 26 | */ |
| 27 | FIXTURE_OVERRIDE?: string; |
| 28 | /** |
| 29 | * A real KV namespace binding. In dev it is served through |
| 30 | * cloudflare-runtime's platform proxy (calls round-trip to a |
| 31 | * workerd-hosted local namespace). |
| 32 | */ |
| 33 | FIXTURE_KV?: FixtureKvNamespace; |
| 34 | ASSETS?: { fetch(input: Request | string | URL): Promise<Response> }; |
| 35 | }; |
| 36 | ctx?: { waitUntil(promise: Promise<unknown>): void }; |
| 37 | /** |
| 38 | * Workers Cache API live; the platform proxy's cache in dev — |
| 39 | * `put`/`match`/`delete` round-trip in both modes. |
| 40 | */ |
| 41 | caches?: { |
| 42 | default: FixtureCache; |
| 43 | open(name: string): Promise<FixtureCache>; |
| 44 | }; |
| 45 | /** `request.cf` live; wrangler-parity mock (via the proxy) in dev. */ |
| 46 | cf?: { colo?: string } & Record<string, unknown>; |
| 47 | } |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | export {}; |