js-waku/packages/interfaces/src/health_indicator.ts
Sasha 3136f3a704
feat: add HealthIndicator with simplified logic and testing (#2251)
* implement HealthIndicator

* up libp2p interface version

* up lock

* remove unused tests

* expose HealthIndicator from Waku

* update test, add start and stop

* fix error handling
2025-02-05 13:24:50 +01:00

25 lines
574 B
TypeScript

import { TypedEventEmitter } from "@libp2p/interface";
import { Libp2p } from "./libp2p.js";
export enum HealthStatusChangeEvents {
StatusChange = "health:change"
}
export enum HealthStatus {
Unhealthy = "Unhealthy",
MinimallyHealthy = "MinimallyHealthy",
SufficientlyHealthy = "SufficientlyHealthy"
}
export type HealthIndicatorEvents = {
[HealthStatusChangeEvents.StatusChange]: CustomEvent<HealthStatus>;
};
export interface IHealthIndicator
extends TypedEventEmitter<HealthIndicatorEvents> {}
export type HealthIndicatorParams = {
libp2p: Libp2p;
};