UNPKG

@nestjs-redis/health-indicator

Version:

A comprehensive Redis health indicator for NestJS applications using the Terminus health check library

46 lines 1.61 kB
/** * @publicApi */ export type HealthIndicatorStatus = 'up' | 'down'; /** * The result object of a health indicator * @publicApi */ export type HealthIndicatorResult<Key extends string = string, Status extends HealthIndicatorStatus = HealthIndicatorStatus, OptionalData extends Record<string, any> = Record<string, any>> = Record<Key, { status: Status; } & OptionalData>; /** * Helper service which can be used to create health indicator results * @publicApi */ export declare class HealthIndicatorService { check<const Key extends string>(key: Key): HealthIndicatorSession<Key>; } type AdditionalData = Record<string, unknown>; /** * Indicate the health of a health indicator with the given key * * @publicApi */ export declare class HealthIndicatorSession<Key extends Readonly<string> = string> { private readonly key; constructor(key: Key); /** * Mark the health indicator as `down` * @param data additional data which will get appended to the result object */ down<T extends AdditionalData>(data?: T): HealthIndicatorResult<typeof this.key, 'down', T>; down<T extends string>(data?: T): HealthIndicatorResult<typeof this.key, 'down', { message: T; }>; /** * Mark the health indicator as `up` * @param data additional data which will get appended to the result object */ up<T extends AdditionalData>(data?: T): HealthIndicatorResult<Key, 'up', T>; up<T extends string>(data?: T): HealthIndicatorResult<Key, 'up', { message: T; }>; } export {}; //# sourceMappingURL=health-indicator.service.d.ts.map