changemaker.lite/api/dist/utils/health-check.d.ts

39 lines
1.4 KiB
TypeScript

/**
* Shared health check utilities for external services
* Replaces duplicated checkServiceHealth() across modules
*/
/**
* Health check result interface
*/
export interface HealthCheckResult {
online: boolean;
error?: string;
}
/**
* Shared health check utility for external services
* Uses fetchWithTimeout to prevent hangs
*
* @param url - The service URL to check
* @param timeoutMs - Timeout in milliseconds (default: 3000)
* @returns HealthCheckResult with online status and optional error
*/
export declare function checkServiceHealth(url: string, timeoutMs?: number): Promise<HealthCheckResult>;
/**
* Check multiple services in parallel
* Useful for dashboard status checks
*
* @param services - Record of service name to URL mappings
* @param timeoutMs - Timeout in milliseconds for each check (default: 3000)
* @returns Record of service name to HealthCheckResult
*/
export declare function checkServicesHealth(services: Record<string, string>, timeoutMs?: number): Promise<Record<string, HealthCheckResult>>;
/**
* Simplified boolean health check (backwards compatible)
* Returns only online status without error details
*
* @param url - The service URL to check
* @param timeoutMs - Timeout in milliseconds (default: 3000)
* @returns boolean indicating if service is online
*/
export declare function isServiceOnline(url: string, timeoutMs?: number): Promise<boolean>;
//# sourceMappingURL=health-check.d.ts.map