github nestjs/terminus 11.0.0
Release 11.0.0

5 days ago

11.0.0 (2025-01-25)

Migration Guide

Features

  • simplify custom health indicator creation (9f10a9b)
  • upgrade to nestjs v11 (c2569df), closes #2570
  • update dependencies

BREAKING CHANGES

  • Drop support for Node 16 / 18

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();
  }
}

Don't miss a new terminus release

NewReleases is sending notifications on new releases.