@datalayer/core
Version:
[](https://datalayer.io)
73 lines (72 loc) • 1.83 kB
TypeScript
/**
* Represents a health check response from a Datalayer service.
* Provides standardized health status information across all services.
*/
export declare class HealthCheck {
healthy: boolean;
status: string;
responseTime: number;
errors: string[];
timestamp: Date;
/**
* Create a HealthCheck instance.
* @param data - The health check data
* @param sdk - Reference to the SDK instance (unused but kept for consistency)
*/
constructor(data: any, sdk: any);
/**
* Check if the service is healthy.
* @returns True if the service is healthy
*/
isHealthy(): boolean;
/**
* Get the service status.
* @returns The status string
*/
getStatus(): string;
/**
* Get the response time in milliseconds.
* @returns The response time
*/
getResponseTime(): number;
/**
* Get any errors reported during the health check.
* @returns Array of error messages
*/
getErrors(): string[];
/**
* Get the timestamp of the health check.
* @returns The timestamp
*/
getTimestamp(): Date;
/**
* Check if there are any errors.
* @returns True if there are errors
*/
hasErrors(): boolean;
/**
* Get a human-readable summary of the health check.
* @returns Summary string
*/
getSummary(): string;
/**
* Convert to a plain object.
* @returns Plain object representation
*/
toJSON(): Promise<HealthCheckJSON>;
/**
* Get a string representation.
* @returns String representation
*/
toString(): string;
}
/**
* JSON representation of a HealthCheck.
*/
export interface HealthCheckJSON {
healthy: boolean;
status: string;
responseTime: number;
errors: string[];
timestamp: string;
}