/** * FeltDB HTTP Server * * Provides HTTP endpoints for FeltDB collection operations including atomic CAS. * Can be used as middleware in Express, Hono, or any HTTP framework. * * Endpoints: * - GET /collections/{collection}/{id} - Get a record * - POST /collections/{collection} - Insert a record * - PATCH /collections/{collection}/{id} - Update a record * - POST /collections/{collection}/{id}/cas - Compare-and-set atomic update * - DELETE /collections/{collection}/{id} - Delete a record * * The CAS endpoint preserves atomic semantics across the HTTP boundary by: * 1. Receiving expectedVersion and value from client * 2. Delegating to Collection.updateIfVersion() inside transaction boundary * 3. Returning structured conflict response on version mismatch * 4. Ensuring exactly one concurrent writer succeeds on same version */ import type { StateFirstDB } from './db.js'; export interface HttpServerOptions { db: StateFirstDB; } export interface HttpRequest { method: string; path: string; headers: Record; body?: string; } export interface HttpResponse { status: number; headers: Record; body: string; } /** * HTTP Server Request Handler * * This is a framework-agnostic handler that can be adapted to Express, Hono, etc. * Returns {status, headers, body} that can be sent to the client. */ export declare function handleHttpRequest(options: HttpServerOptions, request: HttpRequest): Promise; //# sourceMappingURL=http-server.d.ts.map