Health Check Decorator (decorators/health-check.decorator.ts)

nitrostack · sample-apps/seizure-monitor/agentic-ai-ot-security/typescript/packages/core/src/core/decorators/health-check.decorator.ts · typescript · Apache-2.0
database, infra, lang:typescript, tag:decorator

Provides a decorator to register and manage health checks for services, returning status up/down/degraded.

// Source: https://github.com/nitrocloudofficial/nitrostack | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import 'reflect-metadata';

const HEALTH_CHECK_KEY = 'nitrostack:health_check';

/**
 * Health check result
 */
export interface HealthCheckResult {
  status: 'up' | 'down' | 'degraded';
  message?: string;
  details?: unknown;
  timestamp?: number;
}

/**
 * Health check interface
 */
export interface HealthCheckInterface {
  check(): Promise<HealthCheckResult> | HealthCheckResult;
}

/**
 * Health check options
 */
export interface HealthCheckOptions {
  /** Health check name/identifier */
  name: string;
  
  /** Description */
  description?: string;
  
  /** Interval to

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key