UNPKG

@piggly/fastify-chassis

Version:

An ESM/CommonJS toolkit to help you to do common operations in your back-end applications with Fastify and NodeJS.

54 lines (53 loc) 1.31 kB
/** * @file Handle health check services. * @copyright Piggly Lab 2024 */ export declare class HealthCheckService { /** * Handlers to check. * * @type {Map<string, () => Promise<boolean>>} * @protected * @memberof HealthCheckService * @since 4.0.0 * @author Caique Araujo <caique@piggly.com.br> */ protected handlers: Map<string, () => Promise<boolean>>; /** * Constructor. * * @public * @constructor * @memberof HealthCheckService * @since 4.0.0 * @author Caique Araujo <caique@piggly.com.br> */ constructor(); /** * Check all handlers. * * @returns {Promise<{ * success: boolean; * services: Record<string, boolean>; * }>} * @public * @memberof HealthCheckService * @since 4.0.0 * @author Caique Araujo <caique@piggly.com.br> */ check(): Promise<{ services: Record<string, boolean>; success: boolean; }>; /** * Register a new handler. * * @param {string} name * @param {() => Promise<boolean>} handler * @public * @memberof HealthCheckService * @since 4.0.0 * @author Caique Araujo <caique@piggly.com.br> */ register(name: string, handler: () => Promise<boolean>): void; }