fastify-healthcheck
Advanced tools
Comparing version 4.3.0 to 4.4.0
# Change Log | ||
## [4.4.0](https://github.com/smartiniOnGitHub/fastify-healthcheck/releases/tag/4.4.0) (2023-01-06) | ||
[Full Changelog](https://github.com/smartiniOnGitHub/fastify-healthcheck/compare/4.3.0...4.4.0) | ||
Summary Changelog: | ||
- Updated requirements to Fastify '^4.11.0' and all other dependencies to latest | ||
- Adds schema options for health endpoint | ||
## [4.3.0](https://github.com/smartiniOnGitHub/fastify-healthcheck/releases/tag/4.3.0) (2022-12-12) | ||
@@ -4,0 +10,0 @@ [Full Changelog](https://github.com/smartiniOnGitHub/fastify-healthcheck/compare/4.2.0...4.3.0) |
{ | ||
"name": "fastify-healthcheck", | ||
"version": "4.3.0", | ||
"version": "4.4.0", | ||
"description": "Fastify Plugin to serve responses for health checks", | ||
@@ -46,6 +46,6 @@ "main": "src/plugin", | ||
"devDependencies": { | ||
"@types/node": "^18.11.13", | ||
"@typescript-eslint/eslint-plugin": "^5.46.1", | ||
"@typescript-eslint/parser": "^5.46.1", | ||
"fastify": "^4.10.2", | ||
"@types/node": "^18.11.18", | ||
"@typescript-eslint/eslint-plugin": "^5.48.0", | ||
"@typescript-eslint/parser": "^5.48.0", | ||
"fastify": "^4.11.0", | ||
"jsdoc": "^4.0.0", | ||
@@ -52,0 +52,0 @@ "simple-get": "^4.0.1", |
@@ -27,2 +27,3 @@ # fastify-healthcheck | ||
- `underPressureOptions`, for options to send directly to under-pressure | ||
- `schemaOptions`, for options to use for route schema (no default value provided) | ||
@@ -90,3 +91,3 @@ Under the hood, the healthcheck status is determined by the | ||
Fastify ^4.10.2 , Node.js 14 LTS (14.15.0) or later. | ||
Fastify ^4.11.0 , Node.js 14 LTS (14.15.0) or later. | ||
Note that plugin releases 3.x are for Fastify 3.x, 4.x are for Fastify 4.x, etc. | ||
@@ -93,0 +94,0 @@ |
@@ -38,2 +38,3 @@ /* | ||
* <li>underPressureOptions (object, default empty) for options to send directly to under-pressure,</li> | ||
* <li>schemaOptions (object, default empty) for options to use for route schema,</li> | ||
* </ul> | ||
@@ -50,3 +51,4 @@ * @param {!function} done callback, to call as last step | ||
exposeUptime = false, | ||
underPressureOptions = { } | ||
underPressureOptions = { }, | ||
schemaOptions | ||
} = options | ||
@@ -59,2 +61,5 @@ | ||
ensureIsObject(underPressureOptions, 'underPressureOptions') | ||
if (schemaOptions) { | ||
ensureIsObject(schemaOptions, 'schemaOptions') | ||
} | ||
@@ -81,3 +86,4 @@ // execute plugin code | ||
url: healthcheckUrl, | ||
handler: healthcheckHandler | ||
handler: healthcheckHandler, | ||
schema: schemaOptions | ||
}) | ||
@@ -84,0 +90,0 @@ } |
@@ -37,2 +37,7 @@ /// <reference types="node" /> | ||
underPressureOptions?: UnderPressureOptions | ||
/** | ||
* Fastify schema for the healthcheck route (default: undefined). | ||
*/ | ||
schemaOptions?: unknown | ||
} | ||
@@ -39,0 +44,0 @@ |
@@ -25,3 +25,25 @@ import fastify from 'fastify' | ||
healthcheckUrlAlwaysFail: true, | ||
exposeUptime: true | ||
exposeUptime: true, | ||
schemaOptions: { | ||
operationId: 'getHealth', | ||
description: 'Serve responses for health checks', | ||
response: { | ||
default: { | ||
description: 'Default Response', | ||
type: 'object', | ||
properties: { | ||
statusCode: { | ||
type: 'number' | ||
}, | ||
status: { | ||
type: 'string' | ||
}, | ||
uptime: { | ||
type: 'number', | ||
optional: true | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}) |
44345
377
138