import * as Effect from "effect/Effect"; import type { HttpEffect } from "../Http.ts"; import type { BaseRuntimeContext } from "../RuntimeContext.ts"; export interface FunctionContext extends BaseRuntimeContext { /** * Register an HTTP handler. The optional `shape` payload is the user's * full default-export shape — Cloudflare Workers use it to expose * non-handler methods (e.g. `greet`) as RPC methods on the deployed * `WorkerEntrypoint`. Other platforms (Lambda, etc.) ignore it. */ serve( handler: HttpEffect, options?: { shape?: Record }, ): Effect.Effect; listen( handler: FunctionListener, ): Effect.Effect; listen( effect: Effect.Effect, never, InitReq>, ): Effect.Effect; exports: Effect.Effect, never, never>; } export type FunctionListener = ( event: any, ) => Effect.Effect | void;