Skip to content

Release 11.0.0-beta.0

Pre-release
Pre-release
Compare
Choose a tag to compare
@BrunnerLivio BrunnerLivio released this 23 Jan 20:30
· 44 commits to master since this release

11.0.0-beta.0 (2025-01-23)

Features

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

BREAKING CHANGES

  • Drop support for Node 16 / 18

Installaion

# npm
npm install @nestjs/[email protected]
# pnpm
pnpm add @nestjs/[email protected]
# yarn
yarn add @nestjs/[email protected]

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