import { ServerResponse, IncomingMessage } from 'node:http'; type AfterCallback = () => void | Promise; /** Runtime hooks supplied by a deployment adapter. */ interface FarmAfterPlatformContext { /** Keep a serverless invocation alive until the scheduled work settles. */ waitUntil?: (promise: Promise) => void; /** Register a callback that runs once the response has finished. */ onResponseFinished?: (callback: () => void) => void; } /** * Schedule non-blocking work for after the current response finishes. * * Callbacks run in registration order. A callback failure is reported without * changing the response or preventing later callbacks from running. */ declare function after(callback: AfterCallback): void; /** @internal Run a Web Request handler inside Farm's post-response lifecycle. */ declare function _runWithAfterRequest(request: Request, handler: () => Response | Promise, context?: FarmAfterPlatformContext): Promise; /** @internal Run a Node response handler inside Farm's post-response lifecycle. */ declare function _runWithAfterNodeResponse(response: ServerResponse, handler: () => T | Promise, context?: Pick): Promise; /** @internal Add Farm's post-response lifecycle to a Node middleware. */ declare function _withAfterNodeMiddleware(handler: (request: IncomingMessage, response: ServerResponse, next: (error?: unknown) => void) => void | Promise): (request: IncomingMessage, response: ServerResponse, next: (error?: unknown) => void) => Promise; export { type AfterCallback, type FarmAfterPlatformContext, _runWithAfterNodeResponse, _runWithAfterRequest, _withAfterNodeMiddleware, after };