/** * `/jorvel/health` response builder for remotes. * * Each remote answers a tiny JSON document describing its name, version, * build sha, uptime, share-scope baseline, and a list of optional probes * (database, downstream API, queue, …). The host registry consults this * endpoint to mark remotes up/down and to refresh shared-dep majors before * loading a remoteEntry. */ export type HealthState = 'up' | 'degraded' | 'down'; export interface ProbeResult { name: string; ok: boolean; durationMs?: number; detail?: string; } export type Probe = () => Promise> | Omit; export interface HealthInput { /** Remote name. Must match the federation `name`. */ name: string; /** Semver — typically `process.env.JORVEL_VERSION` baked at build time. */ version: string; /** Optional commit / build identifier. */ build?: string; /** Map of shared deps the remote was compiled against. */ shared?: Record; /** Probes evaluated in parallel. Failures degrade the state. */ probes?: Record; /** Reference epoch for `uptimeMs`. Defaults to module-load time. */ startedAt?: number; /** Time source for tests. */ now?: () => number; } export interface HealthDocument { name: string; version: string; build?: string; state: HealthState; uptimeMs: number; /** Unix milliseconds at which the document was generated. */ timestamp: number; shared?: Record; probes?: ProbeResult[]; } /** Build a health document. Awaits probes in parallel. */ export declare function buildHealthDocument(input: HealthInput): Promise; export interface EdgeLikeRequest { url: string; headers?: Record; } export interface EdgeLikeResponse { status: number; headers: Record; body: string; } /** * Build a Web-style fetch handler that answers `/jorvel/health` (configurable). * Drop into a Worker, Vercel Edge function, or Node SSR server. */ export declare function createHealthHandler(input: HealthInput & { path?: string; }): (req: EdgeLikeRequest) => Promise; export interface FetchHealthOptions { /** Override `fetch` for tests. */ fetch?: typeof fetch; /** Abort signal. */ signal?: AbortSignal; /** Hard timeout in ms. Default: 5000. */ timeoutMs?: number; } /** * Fetch a remote's health doc. Throws on network error, non-2xx, or timeout. */ export declare function fetchHealth(url: string, opts?: FetchHealthOptions): Promise; //# sourceMappingURL=health.d.ts.map