import { AsyncLocalStorage } from "node:async_hooks"; import type { ExecutionContext, Request } from "@cloudflare/workers-types"; import { WorkerKVRateLimit } from "@edgefirst-dev/worker-kv-rate-limit"; import SuperHeaders from "@mjackson/headers"; import type { Logger } from "drizzle-orm"; import { DrizzleD1Database } from "drizzle-orm/d1"; import { AI } from "../ai/ai.js"; import { Cache } from "../cache/cache.js"; import { Env } from "../env/env.js"; import { FS } from "../fs/fs.js"; import { Geo } from "../geo/geo.js"; import { KV } from "../kv/kv.js"; import { Queue } from "../queue/queue.js"; import type { Bindings, DatabaseSchema, PassThroughOnExceptionFunction, WaitUntilFunction } from "../types.js"; export interface EdgeFirstContext { ai?: AI; fs?: FS; kv?: KV; env: Env; geo?: Geo; orm?: DrizzleD1Database; cache?: Cache; queue?: Queue; signal?: AbortSignal; headers?: SuperHeaders; request?: Request; bindings: Bindings; rateLimit?: WorkerKVRateLimit; waitUntil: WaitUntilFunction; passThroughOnException: PassThroughOnExceptionFunction; } declare class Storage extends AsyncLocalStorage { setup({ request, bindings, ctx, options }: Storage.SetupOptions, callback: () => T): T; access(key: K): NonNullable; } export declare const storage: Storage; export declare namespace Storage { interface SetupOptions { bindings: Bindings; ctx: ExecutionContext; request?: Request; options: { /** The options for the ORM. */ orm?: { /** The database schema for the ORM. */ schema: DatabaseSchema; /** The logger for the ORM. */ logger?: Logger; }; /** The options for the rate limit. */ rateLimit?: WorkerKVRateLimit.Options; }; } } export {};