{"_id":"@dts-stn/health-checks","_rev":"2-d589dbfcc8126560fb4bd9fe2729050a","name":"@dts-stn/health-checks","dist-tags":{"latest":"2.0.0"},"versions":{"1.0.0":{"name":"@dts-stn/health-checks","version":"1.0.0","author":{"url":"https://github.com/DTS-STN","name":"Digital Technology Solutions"},"license":"MIT","_id":"@dts-stn/health-checks@1.0.0","maintainers":[{"name":"nicholas.ly","email":"nicholas.ly@hrsdc-rhdcc.gc.ca"},{"name":"sebastien-comeau","email":"sebastien.comeau@hrsdc-rhdcc.gc.ca"},{"name":"gregory.j.baker","email":"gregory.j.baker@hrsdc-rhdcc.gc.ca"}],"homepage":"https://github.com/DTS-STN/dts-wide#readme","bugs":{"url":"https://github.com/DTS-STN/dts-wide/issues"},"dist":{"shasum":"fb7c88c187c5f9c90b4687f5e81fc90994815151","tarball":"https://registry.npmjs.org/@dts-stn/health-checks/-/health-checks-1.0.0.tgz","fileCount":8,"integrity":"sha512-pzkfOW7MYHfNH1RsWD9o+z22YpR/NSe3pwQFCO57Kj5GGjYMiL7GJZjYbTP2xb+PE6skLJo4FUsmLQ/MRvyfqg==","signatures":[{"sig":"MEUCIFpLIPwqgSnZJzk6EmRA56x8FiNOx/9ue/OoLCDBkElWAiEA6GttJfZd/mG71DvNSs8Qfgo9D/efwCpYwFXohAJO67U=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":19995},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">= 20"},"exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"2ddc42e748a8595a8c535d0079870104eac1d3f4","scripts":{"test":"vitest","build":"unbuild","clean":"rimraf ./dist/","build:ci":"npm run format:check && npm run lint:check && npm run typecheck && npm run test -- run && npm run clean && npm run build && npm run exports:check","lint:fix":"eslint --fix ./","typecheck":"tsc","format:fix":"prettier --write ./","lint:check":"eslint ./","format:check":"prettier --check ./","exports:check":"attw --pack ./"},"_npmUser":{"name":"gregory.j.baker","email":"gregory.j.baker@hrsdc-rhdcc.gc.ca"},"repository":{"url":"git+https://github.com/DTS-STN/dts-wide.git","type":"git","directory":"packages/health-checks"},"_npmVersion":"10.8.2","description":"A health check module for DTS NodeJS applications.","directories":{},"sideEffects":false,"_nodeVersion":"20.17.0","_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.13.0","rimraf":"^6.0.1","vitest":"^2.1.3","unbuild":"^2.0.0","prettier":"^3.3.3","@eslint/js":"^9.13.0","typescript":"^5.6.3","@types/node":"^20.16.13","typescript-eslint":"^8.10.0","@vitest/coverage-v8":"^2.1.3","vite-tsconfig-paths":"^5.0.1","@arethetypeswrong/cli":"^0.16.4"},"_npmOperationalInternal":{"tmp":"tmp/health-checks_1.0.0_1729617242292_0.6983148850139884","host":"s3://npm-registry-packages"}},"2.0.0":{"name":"@dts-stn/health-checks","version":"2.0.0","description":"A health check module for DTS NodeJS applications.","type":"module","license":"MIT","author":{"name":"Digital Technology Solutions","url":"https://github.com/DTS-STN"},"repository":{"type":"git","url":"git+https://github.com/DTS-STN/dts-wide.git","directory":"packages/health-checks"},"bugs":{"url":"https://github.com/DTS-STN/dts-wide/issues"},"main":"./dist/index.cjs","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"sideEffects":false,"scripts":{"build":"unbuild","build:ci":"npm run format:check && npm run lint:check && npm run typecheck && npm run test -- run && npm run clean && npm run build && npm run exports:check","clean":"rimraf ./dist/","exports:check":"attw --pack ./","format:check":"prettier --check ./","format:fix":"prettier --write ./","lint:check":"eslint ./","lint:fix":"eslint --fix ./","test":"vitest","typecheck":"tsc"},"devDependencies":{"@arethetypeswrong/cli":"^0.16.4","@eslint/js":"^9.13.0","@types/node":"^20.16.13","@vitest/coverage-v8":"^2.1.3","eslint":"^9.13.0","prettier":"^3.3.3","rimraf":"^6.0.1","typescript":"^5.6.3","typescript-eslint":"^8.10.0","unbuild":"^2.0.0","vite-tsconfig-paths":"^5.0.1","vitest":"^2.1.3"},"engines":{"node":">= 20"},"_id":"@dts-stn/health-checks@2.0.0","gitHead":"b211719af60a95e514947fc0e0a6842b8adf27ca","homepage":"https://github.com/DTS-STN/dts-wide#readme","_nodeVersion":"23.1.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-z6n8HJnPHw4zIIfgj4sra1suTkLnO4iVriYbAGk0aiduelbZkFVLcHl1DBxesMd3Yj44U0+nSGIPcsY1zmNmuw==","shasum":"48c80a5bf1ff245a028b491275b48c1153fbeda7","tarball":"https://registry.npmjs.org/@dts-stn/health-checks/-/health-checks-2.0.0.tgz","fileCount":8,"unpackedSize":20076,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFSdo/eA9Trqoos1GTszVy7YOpnKsYo95hXg7axtTD47AiB5adhmfYxeKfuxdZNWn/GKY9djtVOwK0jpfPLmfo4YzQ=="}]},"_npmUser":{"name":"stefan-oconnell","email":"stefan.oconnell@hrsdc-rhdcc.gc.ca"},"directories":{},"maintainers":[{"name":"stefan-oconnell","email":"stefan.oconnell@hrsdc-rhdcc.gc.ca"},{"name":"nicholas.ly","email":"nicholas.ly@hrsdc-rhdcc.gc.ca"},{"name":"sebastien-comeau","email":"sebastien.comeau@hrsdc-rhdcc.gc.ca"},{"name":"gregory.j.baker","email":"gregory.j.baker@hrsdc-rhdcc.gc.ca"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/health-checks_2.0.0_1730301077828_0.13533313923096557"},"_hasShrinkwrap":false}},"time":{"created":"2024-10-22T17:14:01.646Z","modified":"2024-10-30T15:11:18.244Z","1.0.0":"2024-10-22T17:14:02.502Z","2.0.0":"2024-10-30T15:11:18.000Z"},"bugs":{"url":"https://github.com/DTS-STN/dts-wide/issues"},"author":{"name":"Digital Technology Solutions","url":"https://github.com/DTS-STN"},"license":"MIT","homepage":"https://github.com/DTS-STN/dts-wide#readme","repository":{"type":"git","url":"git+https://github.com/DTS-STN/dts-wide.git","directory":"packages/health-checks"},"description":"A health check module for DTS NodeJS applications.","maintainers":[{"name":"stefan-oconnell","email":"stefan.oconnell@hrsdc-rhdcc.gc.ca"},{"name":"nicholas.ly","email":"nicholas.ly@hrsdc-rhdcc.gc.ca"},{"name":"sebastien-comeau","email":"sebastien.comeau@hrsdc-rhdcc.gc.ca"},{"name":"gregory.j.baker","email":"gregory.j.baker@hrsdc-rhdcc.gc.ca"}],"readme":"# health-checks\n\nSimplifies the process of implementing server-side health checks in a NodeJS\napplication, ensuring that the test results conform to a standard structure.\n\n## Example usage\n\n```typescript\nimport type { HealthCheck, HealthCheckOptions } from '@dts-stn/health-checks';\nimport { HealthCheckResponses, execute } from '@dts-stn/health-checks';\n\nimport { getSqlClient } from '~/modules';\n\nconst healthChecks: HealthCheck[] = [\n  {\n    name: 'db',\n    check: async (signal) => {\n      console.debug('Testing database connectivity');\n      await getSqlClient().sql('SELECT 1', { signal });\n    },\n    metadata: {\n      db: `${sql.getDb()} on ${sql.getHost()}}`,\n    },\n  },\n  {\n    name: 'google',\n    check: async (signal) => {\n      console.debug('Testing google connectivity');\n      await fetch('https://www.google.com/', { signal });\n    },\n    metadata: {\n      url: 'https://www.google.com/',\n    },\n  },\n];\n\nconst summary = await execute(healthChecks, {\n  metadata: {\n    version: '1.0.0',\n    buildId: '1.0.0-00000000-00000',\n  },\n  includeDetails: true,\n  timeout: 1000,\n});\n```\n\n```json\ncurl http://localhost/health --verbose | jq\n< HTTP/1.1 503 Service Unavailable\n{\n  \"status\": \"UNHEALTHY\",\n  \"version\": \"1.0.0\",\n  \"buildId\": \"1.0.0-00000000-00000\",\n  \"responseTime\": 399,\n  \"components\": [\n    {\n      \"db\": {\n        \"status\": \"UNHEALTHY\",\n        \"responseTime\": 12,\n        \"metadata\": {\n          \"db\": \"testdb on localhost\"\n        },\n        \"errorDetails\": \"Could not connect to postgres://localhost/testdb\",\n        \"stackTrace\": \"[...truncated...]\"\n      }\n    },\n    {\n      \"google\": {\n        \"status\": \"HEALTHY\",\n        \"responseTime\": 389,\n        \"metadata\": {\n          \"url\": \"https://www.google.com/\"\n        }\n      }\n    }\n  ]\n}\n```\n","readmeFilename":"README.md"}