11.0.0-beta.0 (2025-01-23)
Features
BREAKING CHANGES
- Drop support for Node 16 / 18
Installaion
# npm
npm install @nestjs/terminus@11.0.0-beta.0
# pnpm
pnpm add @nestjs/termminus@11.0.0-beta.0
# yarn
yarn add @nestjs/terminus@11.0.0-beta.0
For users who have implemented a custom health indicator, an enhanced API is now available. However, the existing API will continue to function as-is without requiring any changes.
The new and improved HealthIndicatorService
provides a streamlined way to indicate whether a health indicator is up or down.
Please note that the HealthIndicator
and HealthCheckError
classes have been marked as deprecated and are scheduled for removal in the next major release, version 12.0.0.
@Injectable()
export class DogHealthIndicator {
constructor(
private readonly dogService: DogService,
private readonly healthIndicatorService: HealthIndicatorService,
) {}
async isHealthy(key: string) {
const indicator = this.healthIndicatorService.check(key);
const dogs = await this.dogService.getDogs();
const badboys = dogs.filter((dog) => dog.state === DogState.BAD_BOY);
const isHealthy = badboys.length === 0;
if (!isHealthy) {
return indicator.down({
badboys: badboys.length,
});
}
return indicator.up();
}
}