Skip to content

I health indicator interface and built in indicators#1

Merged
saadmoumou merged 11 commits intodevelopfrom
IHealthIndicator-interface-and-built-in-indicators
Apr 1, 2026
Merged

I health indicator interface and built in indicators#1
saadmoumou merged 11 commits intodevelopfrom
IHealthIndicator-interface-and-built-in-indicators

Conversation

@saadmoumou
Copy link
Copy Markdown
Contributor

Summary

  • What does this PR change?

Why

  • Why is this change needed?

Checklist

  • Added/updated tests (if behavior changed)
  • npm run lint passes
  • npm run typecheck passes
  • npm test passes
  • npm run build passes
  • Added a changeset (npx changeset) if this affects consumers

Notes

  • Anything reviewers should pay attention to?

Copilot AI review requested due to automatic review settings April 1, 2026 12:29
@saadmoumou saadmoumou requested a review from a team as a code owner April 1, 2026 12:29
@saadmoumou saadmoumou merged commit 840988c into develop Apr 1, 2026
2 checks passed
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 1, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a health indicator contract (IHealthIndicator) plus three built-in indicators (HTTP, Redis, Postgres) with Jest coverage, and updates project tooling/config (TypeScript path aliases, Jest moduleNameMapper, ESLint flat config, lint-staged, Husky hook) to support the new structure.

Changes:

  • Added IHealthIndicator + result/status types under src/interfaces/.
  • Added built-in health indicators for Redis, Postgres, and HTTP under src/indicators/ with corresponding unit tests.
  • Updated TS/Jest path aliasing and refreshed linting + pre-commit automation (ESLint config, lint-staged, Husky).

Reviewed changes

Copilot reviewed 11 out of 14 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
tsconfig.json Adds path aliases for @interfaces/* and @indicators/*.
src/interfaces/health-indicator.interface.ts Introduces shared health indicator contract and result types.
src/indicators/redis.indicator.ts Adds Redis health indicator implementation.
src/indicators/redis.indicator.spec.ts Adds unit tests for Redis indicator.
src/indicators/postgres.indicator.ts Adds Postgres health indicator implementation.
src/indicators/postgres.indicator.spec.ts Adds unit tests for Postgres indicator.
src/indicators/http.indicator.ts Adds HTTP health indicator implementation using fetch + timeout.
src/indicators/http.indicator.spec.ts Adds unit tests for HTTP indicator.
jest.config.ts Adds moduleNameMapper entries for new path aliases.
eslint.config.mjs Updates ESLint flat config (rules, ignores, import ordering, TS setup).
eslint.config.js Removes redundant/old ESLint config file.
lint-staged.config.mjs Adds lint-staged configuration for Prettier + ESLint.
.husky/pre-commit Changes pre-commit hook to run lint-staged.
package-lock.json Locks updated dev dependency set (includes @eslint/js).

#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged No newline at end of file
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Husky hook is missing the shebang and the husky.sh bootstrap line. Without those, Git may fail to execute the hook (e.g., “Exec format error”) and Husky won’t set up the environment consistently. Restore the standard Husky header (as in .husky/pre-push) before running npx lint-staged.

Copilot uses AI. Check for mistakes.
Comment on lines +8 to +16
*/
export interface HealthIndicatorResult {
/** Unique name identifying this indicator (e.g. "postgres", "redis"). */
name: string;
/** Whether the dependency is healthy. */
status: HealthStatus;
/** Optional human-readable message (required when status is "down"). */
message?: string;
}
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs say message is “required when status is "down"”, but the type makes it optional in all cases. Consider using a discriminated union so message is required for { status: 'down' } and optional/absent for { status: 'up' } to keep the contract enforceable at compile time.

Suggested change
*/
export interface HealthIndicatorResult {
/** Unique name identifying this indicator (e.g. "postgres", "redis"). */
name: string;
/** Whether the dependency is healthy. */
status: HealthStatus;
/** Optional human-readable message (required when status is "down"). */
message?: string;
}
*
* When `status` is `"down"`, `message` is required.
*/
export type HealthIndicatorResult =
| {
/** Unique name identifying this indicator (e.g. "postgres", "redis"). */
name: string;
/** Whether the dependency is healthy. */
status: "up";
/** Optional human-readable message. */
message?: string;
}
| {
/** Unique name identifying this indicator (e.g. "postgres", "redis"). */
name: string;
/** Whether the dependency is healthy. */
status: "down";
/** Human-readable message describing why the dependency is unhealthy. */
message: string;
};

Copilot uses AI. Check for mistakes.
Comment on lines +36 to +41
@Injectable()
export class RedisHealthIndicator implements IHealthIndicator {
constructor(
private readonly client: RedisClient,
private readonly timeoutMs: number = DEFAULT_TIMEOUT_MS,
) {}
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These indicators are marked @Injectable(), but their constructor dependencies are an interface type (RedisClient), which Nest cannot resolve via DI without an explicit injection token / factory provider. Either remove @Injectable() (if consumers should new these) or introduce exported injection tokens (e.g., @Inject(REDIS_CLIENT)) / provider factories so they can be registered as providers safely.

Copilot uses AI. Check for mistakes.

async check(): Promise<HealthIndicatorResult> {
try {
await Promise.race([this.client.ping(), this._timeout()]);
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indicator description says it “expects a "PONG" response”, but the implementation doesn’t validate the ping() result. As written, any resolved value (even unexpected) reports status: 'up'. Capture the return value and treat non-PONG responses as down (with an explanatory message).

Suggested change
await Promise.race([this.client.ping(), this._timeout()]);
const pingResult = await Promise.race([
this.client.ping(),
this._timeout(),
]);
if (pingResult !== "PONG") {
return {
name: "redis",
status: "down",
message: `Unexpected PING response: ${String(pingResult)}`,
};
}

Copilot uses AI. Check for mistakes.
Comment on lines +43 to +60
async check(): Promise<HealthIndicatorResult> {
try {
await Promise.race([this.client.ping(), this._timeout()]);
return { name: "redis", status: "up" };
} catch (error) {
return {
name: "redis",
status: "down",
message: error instanceof Error ? error.message : "Unknown error",
};
}
}

private _timeout(): Promise<never> {
return new Promise((_, reject) =>
setTimeout(() => reject(new Error("Timeout")), this.timeoutMs),
);
}
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_timeout() schedules a setTimeout that is never cleared when ping() wins the race, leaving unnecessary timers running and adding avoidable event-loop work. Consider implementing the timeout with a timer that is cleared in a finally (or a small helper) so successful checks don’t leave pending timeouts behind.

Copilot uses AI. Check for mistakes.
Comment on lines +19 to +29
* HealthModule.register({
* path: 'health',
* liveness: [],
* readiness: [
* new HttpHealthIndicator('https://api.example.com/health'),
* ],
* });
* ```
*/
@Injectable()
export class HttpHealthIndicator implements IHealthIndicator {
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JSDoc examples reference HealthModule.register(...), but there is no HealthModule in this package (and it isn’t imported in the example). This makes the example misleading for consumers. Either add the referenced module/API in this PR or update the example to demonstrate the intended integration point that actually exists in the codebase.

Suggested change
* HealthModule.register({
* path: 'health',
* liveness: [],
* readiness: [
* new HttpHealthIndicator('https://api.example.com/health'),
* ],
* });
* ```
*/
@Injectable()
export class HttpHealthIndicator implements IHealthIndicator {
* const indicator = new HttpHealthIndicator('https://api.example.com/health');
* const result = await indicator.check();
*
* console.log(result.status); // "up" | "down"
* ```
*/
@Injectable()
export class HttpHealthIndicator implements IHealthIndicator {
*/
@Injectable()
export class HttpHealthIndicator implements IHealthIndicator {

Copilot uses AI. Check for mistakes.
Comment on lines +26 to +33
*
* const redis = new Redis({ host: 'localhost', port: 6379 });
*
* HealthModule.register({
* path: 'health',
* liveness: [],
* readiness: [new RedisHealthIndicator(redis)],
* });
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JSDoc example references HealthModule.register(...), but this package doesn’t currently define/export a HealthModule. Either add the referenced module/API in this PR or update the example to show how consumers should actually wire this indicator into their app.

Suggested change
*
* const redis = new Redis({ host: 'localhost', port: 6379 });
*
* HealthModule.register({
* path: 'health',
* liveness: [],
* readiness: [new RedisHealthIndicator(redis)],
* });
* import { RedisHealthIndicator } from '@ciscode/health-kit';
*
* const redis = new Redis({ host: 'localhost', port: 6379 });
*
* // Register the indicator in your own health check setup:
* const redisHealthIndicator = new RedisHealthIndicator(redis);
*
* const result = await redisHealthIndicator.check();
* console.log(result); // { name: 'redis', status: 'up' } on success

Copilot uses AI. Check for mistakes.
Comment on lines +28 to +32
* HealthModule.register({
* path: 'health',
* liveness: [],
* readiness: [new PostgresHealthIndicator(pool)],
* });
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JSDoc example references HealthModule.register(...), but this package doesn’t currently define/export a HealthModule. Either add the referenced module/API in this PR or update the example to show how consumers should actually wire this indicator into their app.

Suggested change
* HealthModule.register({
* path: 'health',
* liveness: [],
* readiness: [new PostgresHealthIndicator(pool)],
* });
* @Module({
* providers: [
* {
* provide: PostgresHealthIndicator,
* useFactory: () => new PostgresHealthIndicator(pool),
* },
* ],
* exports: [PostgresHealthIndicator],
* })
* export class AppModule {}

Copilot uses AI. Check for mistakes.
Comment on lines +45 to +53
if (response.ok) {
return { name: "http", status: "up" };
}

return {
name: "http",
status: "down",
message: `HTTP ${response.status} ${response.statusText}`,
};
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name is hard-coded to "http" in the result. If consumers need to check multiple HTTP endpoints, results will collide and won’t be uniquely identifiable. Consider allowing a configurable name (defaulting to "http") or deriving it from the URL.

Copilot uses AI. Check for mistakes.
Comment on lines +33 to +35
export interface IHealthIndicator {
check(): Promise<HealthIndicatorResult>;
}
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These new health indicator types/classes are not exported from the package’s public entrypoint (src/index.ts), so consumers can’t import them from the module root. If they’re intended for external use, add explicit exports for the interface and built-in indicators.

Copilot uses AI. Check for mistakes.
@saadmoumou saadmoumou deleted the IHealthIndicator-interface-and-built-in-indicators branch April 2, 2026 11:19
Zaiidmo added a commit that referenced this pull request Apr 7, 2026
* initiated dev environment

* ops (ci): standardize publish validation and dependabot across all packages

- Replace git tag --list strategy with package.json-driven tag validation
  in all 16 publish workflows; use git rev-parse to verify the exact tag
  exists rather than guessing the latest repo-wide tag
- Update error guidance to reflect feat/** → develop → master flow
- Standardize dependabot to npm-only, grouped, monthly cadence across
  all 16 packages; remove github-actions ecosystem updates
- Add missing dependabot.yml to AuthKit-UI, ChartKit-UI, HealthKit,
  HooksKit, paymentkit, StorageKit

* security: added CODEOWNER file for branches security \\

* ops: updated relese check workflow#

* I health indicator interface and built in indicators (#1)

* chore(config): add @interfaces/* and @indicators/* path aliases

* chore(config): rename eslint.config.js to .mjs to fix ESM loading

* chore(git): fix husky pre-commit hook for v10 compatibility

* feat(interfaces): add IHealthIndicator, HealthStatus, HealthIndicatorResult

* feat(indicators): add PostgresHealthIndicator (SELECT 1 + timeout)

* test(indicators): add PostgresHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add RedisHealthIndicator (PING + timeout)

* test(indicators): add RedisHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add HttpHealthIndicator (GET + 2xx check + timeout)

* test(indicators): add HttpHealthIndicator unit tests (2xx/non-2xx/network/timeout)

* chore(deps): update package-lock after npm install

---------

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* Health module and health endpoints (#2)

* chore(config): add @interfaces/* and @indicators/* path aliases

* chore(config): rename eslint.config.js to .mjs to fix ESM loading

* chore(git): fix husky pre-commit hook for v10 compatibility

* feat(interfaces): add IHealthIndicator, HealthStatus, HealthIndicatorResult

* feat(indicators): add PostgresHealthIndicator (SELECT 1 + timeout)

* test(indicators): add PostgresHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add RedisHealthIndicator (PING + timeout)

* test(indicators): add RedisHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add HttpHealthIndicator (GET + 2xx check + timeout)

* test(indicators): add HttpHealthIndicator unit tests (2xx/non-2xx/network/timeout)

* chore(deps): update package-lock after npm install

* chore(config): set module to CommonJS and moduleResolution to Node for dist output

* chore(package): rename to @ciscode/health-kit

* chore(deps): update package-lock

* feat(indicators): add MongoHealthIndicator with ping command and timeout

* test(indicators): add MongoHealthIndicator unit tests (success/error/timeout)

* feat(services): add HealthService with Promise.allSettled orchestration

* test(services): add HealthService unit tests (liveness/readiness/concurrency)

* feat(controllers): add HealthController factory (GET live/ready, platform-agnostic)

* test(controllers): add HealthController unit tests (200 ok / 503 ServiceUnavailableException)

* feat(module): add HealthKitModule.register() dynamic module

* feat(exports): update public API exports for health-kit

---------

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* Ihealth indicator interface and built in indicators (#3)

* chore(config): add @interfaces/* and @indicators/* path aliases

* chore(config): rename eslint.config.js to .mjs to fix ESM loading

* chore(git): fix husky pre-commit hook for v10 compatibility

* feat(interfaces): add IHealthIndicator, HealthStatus, HealthIndicatorResult

* feat(indicators): add PostgresHealthIndicator (SELECT 1 + timeout)

* test(indicators): add PostgresHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add RedisHealthIndicator (PING + timeout)

* test(indicators): add RedisHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add HttpHealthIndicator (GET + 2xx check + timeout)

* test(indicators): add HttpHealthIndicator unit tests (2xx/non-2xx/network/timeout)

* chore(deps): update package-lock after npm install

---------

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* Health module and health endpoints (#5)

* chore(config): add @interfaces/* and @indicators/* path aliases

* chore(config): rename eslint.config.js to .mjs to fix ESM loading

* chore(git): fix husky pre-commit hook for v10 compatibility

* feat(interfaces): add IHealthIndicator, HealthStatus, HealthIndicatorResult

* feat(indicators): add PostgresHealthIndicator (SELECT 1 + timeout)

* test(indicators): add PostgresHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add RedisHealthIndicator (PING + timeout)

* test(indicators): add RedisHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add HttpHealthIndicator (GET + 2xx check + timeout)

* test(indicators): add HttpHealthIndicator unit tests (2xx/non-2xx/network/timeout)

* chore(deps): update package-lock after npm install

* chore(config): set module to CommonJS and moduleResolution to Node for dist output

* chore(package): rename to @ciscode/health-kit

* chore(deps): update package-lock

* feat(indicators): add MongoHealthIndicator with ping command and timeout

* test(indicators): add MongoHealthIndicator unit tests (success/error/timeout)

* feat(services): add HealthService with Promise.allSettled orchestration

* test(services): add HealthService unit tests (liveness/readiness/concurrency)

* feat(controllers): add HealthController factory (GET live/ready, platform-agnostic)

* test(controllers): add HealthController unit tests (200 ok / 503 ServiceUnavailableException)

* feat(module): add HealthKitModule.register() dynamic module

* feat(exports): update public API exports for health-kit

---------

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* Custom indicator api and health service (#7)

* chore(config): add @interfaces/* and @indicators/* path aliases

* chore(config): rename eslint.config.js to .mjs to fix ESM loading

* chore(git): fix husky pre-commit hook for v10 compatibility

* feat(interfaces): add IHealthIndicator, HealthStatus, HealthIndicatorResult

* feat(indicators): add PostgresHealthIndicator (SELECT 1 + timeout)

* test(indicators): add PostgresHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add RedisHealthIndicator (PING + timeout)

* test(indicators): add RedisHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add HttpHealthIndicator (GET + 2xx check + timeout)

* test(indicators): add HttpHealthIndicator unit tests (2xx/non-2xx/network/timeout)

* chore(deps): update package-lock after npm install

* chore(config): set module to CommonJS and moduleResolution to Node for dist output

* chore(package): rename to @ciscode/health-kit

* chore(deps): update package-lock

* feat(indicators): add MongoHealthIndicator with ping command and timeout

* test(indicators): add MongoHealthIndicator unit tests (success/error/timeout)

* feat(services): add HealthService with Promise.allSettled orchestration

* test(services): add HealthService unit tests (liveness/readiness/concurrency)

* feat(controllers): add HealthController factory (GET live/ready, platform-agnostic)

* test(controllers): add HealthController unit tests (200 ok / 503 ServiceUnavailableException)

* feat(module): add HealthKitModule.register() dynamic module

* feat(exports): update public API exports for health-kit

* feat(indicators): add createIndicator inline factory with timeout support

* test(indicators): add createIndicator unit tests (true/false/void/throw/timeout)

* feat(indicators): add BaseHealthIndicator abstract class with result() helper

* test(indicators): add BaseHealthIndicator unit tests

* feat(decorators): add @healthindicator decorator for auto-registration by scope

* test(decorators): add @healthindicator decorator unit tests

* feat(module): extend HealthKitModule.register() with indicators[] option for DI-based auto-registration

* feat(exports): export createIndicator, BaseHealthIndicator, @healthindicator, HealthIndicatorScope

* chore(package): update description to mention MongoDB

---------

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* Feat/compt 80 ihealth indicator interface and built in indicators (#8)

* chore(config): add @interfaces/* and @indicators/* path aliases

* chore(config): rename eslint.config.js to .mjs to fix ESM loading

* chore(git): fix husky pre-commit hook for v10 compatibility

* feat(interfaces): add IHealthIndicator, HealthStatus, HealthIndicatorResult

* feat(indicators): add PostgresHealthIndicator (SELECT 1 + timeout)

* test(indicators): add PostgresHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add RedisHealthIndicator (PING + timeout)

* test(indicators): add RedisHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add HttpHealthIndicator (GET + 2xx check + timeout)

* test(indicators): add HttpHealthIndicator unit tests (2xx/non-2xx/network/timeout)

* chore(deps): update package-lock after npm install

---------

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* Feat/compt 81 health module and health endpoints (#9)

* chore(config): add @interfaces/* and @indicators/* path aliases

* chore(config): rename eslint.config.js to .mjs to fix ESM loading

* chore(git): fix husky pre-commit hook for v10 compatibility

* feat(interfaces): add IHealthIndicator, HealthStatus, HealthIndicatorResult

* feat(indicators): add PostgresHealthIndicator (SELECT 1 + timeout)

* test(indicators): add PostgresHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add RedisHealthIndicator (PING + timeout)

* test(indicators): add RedisHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add HttpHealthIndicator (GET + 2xx check + timeout)

* test(indicators): add HttpHealthIndicator unit tests (2xx/non-2xx/network/timeout)

* chore(deps): update package-lock after npm install

* chore(config): set module to CommonJS and moduleResolution to Node for dist output

* chore(package): rename to @ciscode/health-kit

* chore(deps): update package-lock

* feat(indicators): add MongoHealthIndicator with ping command and timeout

* test(indicators): add MongoHealthIndicator unit tests (success/error/timeout)

* feat(services): add HealthService with Promise.allSettled orchestration

* test(services): add HealthService unit tests (liveness/readiness/concurrency)

* feat(controllers): add HealthController factory (GET live/ready, platform-agnostic)

* test(controllers): add HealthController unit tests (200 ok / 503 ServiceUnavailableException)

* feat(module): add HealthKitModule.register() dynamic module

* feat(exports): update public API exports for health-kit

---------

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* Feat/compt 82 custom indicator api and health service (#11)

* chore(config): add @interfaces/* and @indicators/* path aliases

* chore(config): rename eslint.config.js to .mjs to fix ESM loading

* chore(git): fix husky pre-commit hook for v10 compatibility

* feat(interfaces): add IHealthIndicator, HealthStatus, HealthIndicatorResult

* feat(indicators): add PostgresHealthIndicator (SELECT 1 + timeout)

* test(indicators): add PostgresHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add RedisHealthIndicator (PING + timeout)

* test(indicators): add RedisHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add HttpHealthIndicator (GET + 2xx check + timeout)

* test(indicators): add HttpHealthIndicator unit tests (2xx/non-2xx/network/timeout)

* chore(deps): update package-lock after npm install

* chore(config): set module to CommonJS and moduleResolution to Node for dist output

* chore(package): rename to @ciscode/health-kit

* chore(deps): update package-lock

* feat(indicators): add MongoHealthIndicator with ping command and timeout

* test(indicators): add MongoHealthIndicator unit tests (success/error/timeout)

* feat(services): add HealthService with Promise.allSettled orchestration

* test(services): add HealthService unit tests (liveness/readiness/concurrency)

* feat(controllers): add HealthController factory (GET live/ready, platform-agnostic)

* test(controllers): add HealthController unit tests (200 ok / 503 ServiceUnavailableException)

* feat(module): add HealthKitModule.register() dynamic module

* feat(exports): update public API exports for health-kit

* feat(indicators): add createIndicator inline factory with timeout support

* test(indicators): add createIndicator unit tests (true/false/void/throw/timeout)

* feat(indicators): add BaseHealthIndicator abstract class with result() helper

* test(indicators): add BaseHealthIndicator unit tests

* feat(decorators): add @healthindicator decorator for auto-registration by scope

* test(decorators): add @healthindicator decorator unit tests

* feat(module): extend HealthKitModule.register() with indicators[] option for DI-based auto-registration

* feat(exports): export createIndicator, BaseHealthIndicator, @healthindicator, HealthIndicatorScope

* chore(package): update description to mention MongoDB

---------

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* Feat/compt 80 ihealth indicator interface and built in indicators (#12)

* chore(config): add @interfaces/* and @indicators/* path aliases

* chore(config): rename eslint.config.js to .mjs to fix ESM loading

* chore(git): fix husky pre-commit hook for v10 compatibility

* feat(interfaces): add IHealthIndicator, HealthStatus, HealthIndicatorResult

* feat(indicators): add PostgresHealthIndicator (SELECT 1 + timeout)

* test(indicators): add PostgresHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add RedisHealthIndicator (PING + timeout)

* test(indicators): add RedisHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add HttpHealthIndicator (GET + 2xx check + timeout)

* test(indicators): add HttpHealthIndicator unit tests (2xx/non-2xx/network/timeout)

* chore(deps): update package-lock after npm install

* fix(interfaces): add optional details field to HealthIndicatorResult

---------

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* Feat/compt 81 health module and health endpoints (#18)

* fix(services): rename indicators to results in HealthCheckResult response

* fix(tests): update health.service.spec to use results instead of indicators

---------

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* Feat/compt 82 custom indicator api and health service (#23)

* fix(services): rename indicators to results in HealthCheckResult response

* fix(tests): update health.service.spec to use results instead of indicators

* chore(indicators): remove MongoHealthIndicator

* feat(module): make path optional with default 'health', add registerAsync

* feat(exports): remove MongoHealthIndicator, export HealthModuleAsyncOptions

* chore(package): add @nestjs/terminus peer dep, fix description

* chore(indicators): remove MongoHealthIndicator spec

* refactor(module): extract shared logic to eliminate code duplication

---------

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* Feat/compt 83 testing suite (#25)

* chore(indicators): remove MongoHealthIndicator spec

* test(module): add HealthKitModule spec - register, registerAsync, path default

---------

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* Feat/compt 84 readme changeset publish v0.1.0 (#26)

* fix(package): remove unused bundled dependencies (class-transformer, class-validator)

* chore(package): bump version to 0.1.0

---------

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* docs(readme): rewrite README and add changeset for v0.1.0 (#28)

- Rewrite README.md for @ciscode/health-kit (remove template content)
- Add register/registerAsync usage examples
- Document built-in indicators: PostgresHealthIndicator, RedisHealthIndicator, HttpHealthIndicator
- Document custom indicator APIs: createIndicator, BaseHealthIndicator + @healthindicator
- Add 200/503 response body examples
- Add API reference tables
- Add .changeset/health-kit-v0-1-0.md: minor bump (0.0.0 -> 0.1.0)
- Fix .changeset/config.json repo field to CISCODE-MA/HealthKit
- Set package.json version to 0.0.0 (changeset will bump to 0.1.0)

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* Feat/compt 84 readme changeset publish v0.1.0 (#30)

* docs(readme): rewrite README and add changeset for v0.1.0

- Rewrite README.md for @ciscode/health-kit (remove template content)
- Add register/registerAsync usage examples
- Document built-in indicators: PostgresHealthIndicator, RedisHealthIndicator, HttpHealthIndicator
- Document custom indicator APIs: createIndicator, BaseHealthIndicator + @healthindicator
- Add 200/503 response body examples
- Add API reference tables
- Add .changeset/health-kit-v0-1-0.md: minor bump (0.0.0 -> 0.1.0)
- Fix .changeset/config.json repo field to CISCODE-MA/HealthKit
- Set package.json version to 0.0.0 (changeset will bump to 0.1.0)

* chore(package): set version to 0.1.0

---------

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* chore(release): version packages (#31)

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* ci: update release check workflow

* ops: updated release check jobs

---------

Co-authored-by: Zaiidmo <zaiidmoumnii@gmail.com>
Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants