import * as Config from "effect/Config"; import * as Context from "effect/Context"; import * as Effect from "effect/Effect"; import * as FileSystem from "effect/FileSystem"; import * as Etag from "effect/http/Etag"; import type { HttpBodyError } from "effect/http/HttpBody"; import * as HttpPlatform from "effect/http/HttpPlatform"; import { type HttpServerError } from "effect/http/HttpServerError"; import { HttpServerRequest } from "effect/http/HttpServerRequest"; import * as HttpServerResponse from "effect/http/HttpServerResponse"; import * as Layer from "effect/Layer"; import * as Path from "effect/Path"; import * as Scope from "effect/Scope"; export type HttpEffect = Effect.Effect; /** * `effect`'s HttpEffect brands a request scope as "ejected" when ownership * is transferred to a consumer that outlives the handler's return — a * streaming response body, a WebSocket upgrade, an RPC stream. Bridges check * this before their close-on-return path: an ejected scope is closed by its * new owner when it finishes, not by the bridge. */ declare const scopeEjected: unique symbol; export declare const isScopeEjected: (scope: Scope.Scope) => scope is Scope.Scope & Record; export declare const serve: (handler: Effect.Effect) => Effect.Effect>; declare const HttpServer_base: Context.ServiceClass(handler: Effect.Effect, options?: { port?: number; }) => Effect.Effect | Scope.Scope>; }>; export declare class HttpServer extends HttpServer_base { } export declare const safeHttpEffect: (handler: HttpEffect | Effect.Effect>) => Effect.Effect; export declare const resolvePort: (options: { port?: number; } | undefined) => Config.Config | Effect.Effect; export interface BunHttpServerOptions { /** * Network interface on which the Bun HTTP server listens. * * Always passed explicitly to `Bun.serve` so container bootstraps bind a * predictable IPv4 wildcard regardless of the platform default * (`@effect/platform-bun` ≥ 4.0.0-rc.115 defaults to `::`; rc.113/114 * crash-looped on the omitted-hostname case). * * @default "0.0.0.0" */ hostname?: string; } export declare const BunHttpServer: (serverOptions?: BunHttpServerOptions) => Layer.Layer; export interface NodeHttpServerOptions { /** * Address the Node HTTP server binds. Fly / Hetzner / Railway machines * need `0.0.0.0`; omit to use that default. * @default "0.0.0.0" */ hostname?: string; /** * Port the Node HTTP server binds when the handler is served without an * explicit port. Omit to read `PORT` (default `3000`). */ port?: number; } export declare const NodeHttpServer: (serverOptions?: NodeHttpServerOptions) => Layer.Layer; /** * The `HttpPlatform`, `Etag`, `Path`, and no-op `FileSystem` services `HttpApiBuilder.layer` * wants, for runtimes without a filesystem: Workers, Lambda. File responses * die, compression never engages. * * Provide it to `HttpApiBuilder.layer(api)` in a Worker or a Lambda: * * ```typescript * HttpApiBuilder.layer(Api).pipe( * Layer.provide(handlers), * Layer.provide(Http.Platform), * HttpRouter.toHttpEffect, * ) * ``` */ export declare const Platform: Layer.Layer; export {}; //# sourceMappingURL=Http.d.ts.map