/** * Copyright (c) 2026 AzerothJS. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ /** * The AzerothJS server kernel. * * A zero-dependency HTTP stack for Node >= 22 built on web-standard Request/Response: * handlers are `(context) => Response`, the Node adapters (node:http/https/http2) live * at the edge, and `app.handle(new Request(...))` is the entire testing story. Every request * runs inside a reactive root (`createRoot` + `runInStoreScope`), so `onCleanup` is request * teardown, stores are request-isolated exactly as they are under SSR, and the client * disconnect AbortSignal aborts in-flight work - the same lifecycle vocabulary components * have on the frontend. * * The package is organized in four layers. The KERNEL maps one Request to one Response: * routing (router.ts), the single error path (errors.ts), response constructors (respond.ts), * body readers with limits (body.ts, multipart.ts), cookies, static files, compression, and * Server-Sent Events (sse.ts). The APP MODEL composes above it: typed middleware and plugins * (app.ts), the per-request root (request-root.ts), configuration (config.ts), and logging * (logger.ts). The EDGE wraps the whole app for cross-cutting response concerns - request ids * (edge.ts), security headers (security.ts), CORS (cors.ts), rate limiting (rate-limit.ts), * composed with `pipeline()`. The ADAPTERS sit below: node:http and h2c servers with graceful * shutdown and tunable socket timeouts (adapter-node.ts) plus the lazy Request/Response shims * that keep the hot path allocation-light (adapter-request.ts, payload.ts). */ export { RadixRouter } from './router.ts'; export type { PathParams, RouteResult, RouteMatch, RouteMethodMismatch, RouteMiss, RouteDecodeError } from './router.ts'; export { App } from './app.ts'; export type { AppOptions, Handler, Middleware, RequestContext, RequestObserver, AzerothPlugin } from './app.ts'; export { onWorkUnitCleanup, runInRequestRoot, runInWorkUnit, createWorkUnitInterceptor, type WorkUnitInterceptor, type WorkUnitOptions } from './request-root.ts'; export { forwardIdentity } from './forward-identity.ts'; export { attachApiBridge } from './api/attach-bridge.ts'; export { loadConfig, str, num, flag, oneOf } from './config.ts'; export type { ConfigVar, ConfigOf } from './config.ts'; export { logRequests } from './logger.ts'; export type { RequestLogger } from './logger.ts'; export { HttpError, BadRequestError, UnauthorizedError, ForbiddenError, NotFoundError, MethodNotAllowedError, ConflictError, PayloadTooLargeError, UnsupportedMediaTypeError, ValidationError, TooManyRequestsError, errorResponse } from './errors.ts'; export type { ErrorContext, ErrorObserver, ErrorSerializer, ErrorSerializerContext } from './errors.ts'; export { json, text, html, redirect, noContent, created } from './respond.ts'; export { conditional, etagFor, matchesEtag } from './conditional.ts'; export type { ConditionalOptions } from './conditional.ts'; export { jsonEncoder } from './encode-json.ts'; export type { EncodableSchema, EncoderMeta } from './encode-json.ts'; export { readRaw, readText, readJson, readForm, readValidated, mediaTypeOf, DEFAULT_BODY_LIMIT } from './body.ts'; export type { ReadOptions, SchemaLike, StandardSchemaLike } from './body.ts'; export { pipeline, withResponseHeaders, requestId, requestIdOf, edge, isEdge, toFetchHandler, toNativeResponse } from './edge.ts'; export type { HandlerWrapper, EdgeMiddleware, RequestIdOptions, WebHandler } from './edge.ts'; export { securityHeaders } from './security.ts'; export type { SecurityHeadersOptions, HstsOptions } from './security.ts'; export { cors } from './cors.ts'; export type { CorsOptions, CorsOrigin } from './cors.ts'; export { clientIp, ipBucket } from './client-ip.ts'; export type { ClientIpOptions } from './client-ip.ts'; export { rateLimit, MemoryRateStore } from './rate-limit.ts'; export type { RateStore, RateLimitOptions, RateLimitDecision } from './rate-limit.ts'; export { readMultipart, streamMultipart, boundaryOf } from './multipart.ts'; export type { MultipartBody, MultipartOptions, StreamMultipartOptions, UploadedFile } from './multipart.ts'; export { parseCookies, serializeCookie, expireCookie } from './cookies.ts'; export type { CookieOptions } from './cookies.ts'; export { csrfCookie, csrfProtect, csrfToken, verifyCsrfField, CSRF_FIELD } from './csrf.ts'; export type { CsrfOptions } from './csrf.ts'; export { sse } from './sse.ts'; export type { SseConnection, SseOptions, SseSendOptions } from './sse.ts';