/** * Fastify HTTP Adapter * * Converts Fastify Request/Reply to GenericRequest/GenericResponse * * @module */ import type { FastifyRequest, FastifyReply } from 'fastify'; import type { GenericRequest, GenericResponse } from '@johnhenry/aimatey-http-core'; /** * Adapter that converts Fastify Request to GenericRequest */ export declare class FastifyRequestAdapter implements GenericRequest { private request; constructor(request: FastifyRequest); get method(): string; get url(): string; get headers(): Record; get body(): any; get params(): Record | undefined; get query(): Record | undefined; get ip(): string | undefined; /** * Get the underlying Fastify request object */ get raw(): FastifyRequest; } /** * Adapter that converts GenericResponse methods to Fastify Reply */ export declare class FastifyResponseAdapter implements GenericResponse { private reply; private _statusCode; private _headersSent; constructor(reply: FastifyReply); status(code: number): void; header(name: string, value: string): void; send(data: any): void; stream(generator: AsyncGenerator): Promise; /** * Whether a *new* response can still be started. * * Committing to a response is a pre-flight concern: once Fastify has sent a * reply, or once this adapter has flushed SSE headers, a fresh response can * no longer begin. That says nothing about whether the socket will take * another write -- see isWritable(). */ private canStartResponse; /** * Whether the socket can still accept a write. * * Deliberately does NOT consult `_headersSent`. stream() sets that flag and * flushes SSE headers before the first chunk, so during a stream it is the * expected state rather than a reason to stop. Folding it in here made the * per-chunk guard in stream() false on its very first iteration -- the same * defect reported against the Node adapter in #89, which this adapter shares * because it drives reply.raw through the same SSE helpers. */ isWritable(): boolean; /** * Get the underlying Fastify reply object */ get raw(): FastifyReply; } //# sourceMappingURL=adapter.d.ts.map