Files
gridpilot.gg/core/health/ports/HealthEventPublisher.ts
Marc Mintel 597bb48248
Some checks failed
Contract Testing / contract-tests (pull_request) Failing after 4m51s
Contract Testing / contract-snapshot (pull_request) Has been skipped
integration tests
2026-01-22 17:29:06 +01:00

81 lines
1.6 KiB
TypeScript

/**
* Health Event Publisher Port
*
* Defines the interface for publishing health-related events.
* This port is implemented by adapters that can publish events.
*/
export interface HealthEventPublisher {
/**
* Publish a health check completed event
*/
publishHealthCheckCompleted(event: HealthCheckCompletedEvent): Promise<void>;
/**
* Publish a health check failed event
*/
publishHealthCheckFailed(event: HealthCheckFailedEvent): Promise<void>;
/**
* Publish a health check timeout event
*/
publishHealthCheckTimeout(event: HealthCheckTimeoutEvent): Promise<void>;
/**
* Publish a connected event
*/
publishConnected(event: ConnectedEvent): Promise<void>;
/**
* Publish a disconnected event
*/
publishDisconnected(event: DisconnectedEvent): Promise<void>;
/**
* Publish a degraded event
*/
publishDegraded(event: DegradedEvent): Promise<void>;
/**
* Publish a checking event
*/
publishChecking(event: CheckingEvent): Promise<void>;
}
export interface HealthCheckCompletedEvent {
healthy: boolean;
responseTime: number;
timestamp: Date;
endpoint?: string;
}
export interface HealthCheckFailedEvent {
error: string;
timestamp: Date;
endpoint?: string;
}
export interface HealthCheckTimeoutEvent {
timestamp: Date;
endpoint?: string;
}
export interface ConnectedEvent {
timestamp: Date;
responseTime: number;
}
export interface DisconnectedEvent {
timestamp: Date;
consecutiveFailures: number;
}
export interface DegradedEvent {
timestamp: Date;
reliability: number;
}
export interface CheckingEvent {
timestamp: Date;
}