@autofleet/fastify-boilerplate 1.1.29 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -7,7 +7,7 @@ Fastify Boilerplate is a chunk of code that is likely to be required in any `Fas
7
7
  - **Error Handling**: Custom error handling for different types of errors.
8
8
  - **Authorization**: Adds the `zehut` plugin for authorizing via JWT user header.
9
9
  - **Security**: Adds various security headers. (`helmet`)
10
- - **Health Checks**: An endpoint to check if the server is `/alive`.
10
+ - **Health Checks**: Kubernetes-ready liveness (`/alive`) and readiness (`/ready`) probes with graceful shutdown support.
11
11
  - **Stats Endpoint**: Provides server and application base data.
12
12
  - **Tracing**: Adds HTTP request tracing.
13
13
  - **Request Cancellation**: Provides `AbortSignal` on each request for operation cancellation, if request is aborted.
@@ -20,6 +20,9 @@ To use the Fastify Boilerplate, you need to import and initialize it in your app
20
20
  import Fastify from 'fastify';
21
21
  import { fastifyBoilerplatePlugin } from '@autofleet/fastify-boilerplate';
22
22
  import { logger } from './logger';
23
+ import { sequelize } from './models';
24
+ import { redis } from './lib/redis';
25
+ import { rabbit } from './rabbit';
23
26
  import pkgJson from '../package.json' with { type: 'json' };
24
27
 
25
28
  const API_TAGS = [
@@ -33,11 +36,38 @@ await app.register(fastifyBoilerplatePlugin, {
33
36
  tags: API_TAGS, // Optional, when provided initializes a swagger UI
34
37
  name: pkgJson.name,
35
38
  version: pkgJson.version,
36
- // aliveEndpointOptions: { sequelize, redis, rabbit, elasticsearch },
37
-
39
+ healthManager: {
40
+ // HealthManager options - provides /alive and /ready endpoints with graceful shutdown
41
+ clients: {
42
+ sequelize: { connection: sequelize },
43
+ redis: { connection: redis },
44
+ rabbit: { connection: rabbit },
45
+ },
46
+ },
38
47
  });
39
48
  ```
40
49
 
50
+ ## Health Checks & Graceful Shutdown
51
+
52
+ The boilerplate integrates with `@autofleet/nitur`'s `HealthManager` to provide Kubernetes-ready health endpoints and graceful shutdown capabilities.
53
+
54
+ ### Endpoints
55
+
56
+ - **`/alive`** - Liveness probe endpoint. Returns 200 when the application is running and dependencies are healthy.
57
+ - **`/ready`** - Readiness probe endpoint. Returns 200 when the application is ready to receive traffic, 503 during shutdown or when dependencies are unhealthy.
58
+
59
+ ### Features
60
+
61
+ - **Automatic Health Checks**: Monitors configured clients (database, cache, message queues) and reports their health status.
62
+ - **Graceful Shutdown**: Automatically handles SIGTERM/SIGINT signals:
63
+ 1. Marks the pod as not ready (failing readiness probes)
64
+ 2. Waits for load balancers to stop routing traffic (configurable delay)
65
+ 3. Closes client connections gracefully
66
+ 4. Shuts down the HTTP server
67
+ - **Server Auto-Attachment**: The HTTP server is automatically attached to HealthManager after `listen()` is called.
68
+
69
+ For more details on HealthManager configuration, see the [@autofleet/nitur documentation](../nitur/README.md).
70
+
41
71
  ## Request Cancellation
42
72
 
43
73
  The boilerplate automatically provides an `AbortSignal` on each request through `req.signal`. This signal is automatically aborted when the client disconnects or the request encounters an error, allowing you to cancel ongoing operations gracefully.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { systemAliveCheck } from "@autofleet/nitur/fastify";
2
1
  import { authFromUserIdHeaderPlugin } from "@autofleet/zehut";
2
+ import { HealthManagerOptions } from "@autofleet/nitur";
3
3
  import { FastifyDynamicSwaggerOptions } from "@fastify/swagger";
4
4
  import { FastifyPluginAsync } from "fastify";
5
5
  import { LoggerInstanceManager } from "@autofleet/logger";
@@ -19,14 +19,14 @@ interface FastifyBoilerPlateOptions {
19
19
  version?: string;
20
20
  /** The logger instance to use across the application. */
21
21
  logger: LoggerInstanceManager;
22
- /** The options for the alive endpoint. */
23
- aliveEndpointOptions?: Omit<Parameters<typeof systemAliveCheck>[0], "logger">;
24
22
  /** When tags are provided, a few plugins will be added for fastify to include OpenAPI docs, and a SwaggerUI. */
25
23
  tags?: NonNullable<FastifyDynamicSwaggerOptions["openapi"]>["tags"];
26
24
  /** Should user permissions be loaded eagerly. @default true */
27
25
  eagerLoadUserPermissions?: boolean;
28
26
  /** Custom permission loader function to be used in the `zehut` authorization plugin. */
29
27
  customPermissionLoader?: Parameters<typeof authFromUserIdHeaderPlugin>[1]["customPermissionLoader"];
28
+ /** HealthManager options to create a HealthManager instance for Kubernetes liveness/readiness probes and graceful shutdown. */
29
+ healthManagerOptions: Omit<HealthManagerOptions, "logger">;
30
30
  }
31
31
  declare const fastifyBoilerplatePlugin: FastifyPluginAsync<FastifyBoilerPlateOptions>;
32
32
  //#endregion
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import*as e from"zod";import t from"@fastify/helmet";import n from"fastify-plugin";import r from"@fastify/compress";import{handleErrorFastify as i}from"@autofleet/errors";import{systemAliveCheck as a}from"@autofleet/nitur/fastify";import{authFromUserIdHeaderPlugin as o}from"@autofleet/zehut";const s=n((e,t,n)=>{let r=new WeakMap;function i(e){if(!r.has(e))return;let{boundOnceRequestClosed:t,boundOnceRequestError:n}=r.get(e);t&&e.raw.removeListener(`close`,t),n&&e.raw.removeListener(`error`,n)}function a(){if(i(this),r.has(this)&&this.raw.destroyed){let{controller:e}=r.get(this);if(e.signal.aborted)return;e.abort()}}function o(e){if(i(this),r.has(this)){let{controller:t}=r.get(this);t.abort(e)}}e.decorateRequest(`signal`,{getter(){let{raw:e,id:t}=this;if(e.socket.destroyed===!0)throw Error(`Socket for request with ID '${t}' already closed`);if(r.has(this))return r.get(this).controller.signal;let n=a.bind(this),i=o.bind(this),s=new AbortController;return r.set(this,{controller:s,boundOnceRequestClosed:n,boundOnceRequestError:i}),e.once(`close`,n),e.once(`error`,i),s.signal}}),e.addHook(`onResponse`,(e,t,n)=>{r.has(e)&&(i(e),r.delete(e)),n()}),n()}),{version:c}={name:`@autofleet/fastify-boilerplate`,version:`1.1.29`,type:`module`,main:`./dist/index.js`,module:`./dist/index.js`,types:`./dist/index.d.ts`,exports:{".":{import:{types:`./dist/index.d.ts`,default:`./dist/index.js`}}},scripts:{build:`tsdown`,test:`vitest`,coverage:`vitest --coverage`},repository:{type:`git`,url:`git+https://github.com/Autofleet/autorepo.git`},author:``,license:`Proprietary`,bugs:{url:`https://github.com/Autofleet/autorepo/issues`},homepage:`https://github.com/Autofleet/autorepo/tree/master/packages/fastify-boilerplate#readme`,engines:{node:`>=22`},peerDependencies:{"@autofleet/logger":`*`},devDependencies:{"@autofleet/logger":`workspace:^`,fastify:`catalog:`,"fastify-plugin":`catalog:`,"zod-openapi":`catalog:`},files:[`dist`],dependencies:{"@autofleet/errors":`workspace:^`,"@autofleet/nitur":`workspace:^`,"@autofleet/zehut":`workspace:^`,"@fastify/compress":`catalog:`,"@fastify/helmet":`catalog:`,"@fastify/swagger":`catalog:`,"@fastify/swagger-ui":`catalog:`,"fastify-zod-openapi":`catalog:`,zod:`catalog:`}},l=n(async(n,l)=>{let{logger:u,name:d,openApiName:f,version:p,tags:m,aliveEndpointOptions:h,eagerLoadUserPermissions:g=!0,customPermissionLoader:_}=l;if(n.decorateRequest(`logger`,{getter:()=>u}),n.register(i,{fallbackMsg:`Unhandled error caught`}),n.register(t),n.register(o,{eagerLoadUserPermissions:g,customPermissionLoader:_}),n.register(r,{global:!0,threshold:1024}),m?.length){let[e,{default:t},{default:r}]=await Promise.all([import(`fastify-zod-openapi`),import(`@fastify/swagger`),import(`@fastify/swagger-ui`)]),{validatorCompiler:i,serializerCompiler:a,fastifyZodOpenApiTransform:o,fastifyZodOpenApiTransformObject:s,fastifyZodOpenApiPlugin:c}=e;n.setValidatorCompiler(i),n.setSerializerCompiler(a),await n.register(c),await n.register(t,{openapi:{openapi:`3.1.1`,info:{title:f||`${d} API`,version:p||`1.0.0`},tags:[{name:`Server status`,description:`General endpoints indicating server's status`},...m]},transform:o,transformObject:s}),await n.register(r)}let v=new Date;n.withTypeProvider().route({method:`GET`,url:`/`,logLevel:`warn`,...m?.length&&{schema:{tags:[`Server status`],description:`Get server status`,response:{200:{content:{"application/json":{schema:e.object({name:e.literal(d).optional().meta({description:`The name of ${d}`}),version:e.literal(p).optional().meta({description:`The version in package.json file of ${d}`}),boilerPlateVersion:e.literal(c).optional().meta({description:`The version in package.json file of the fastify boilerplate`}),serverRunningSince:e.date().optional().meta({description:`The date when the server started running`}),commit:e.string().meta({description:`The commit SHA of the current deployment`})})}}}}}},handler:()=>({name:d,version:p,serverRunningSince:v,boilerPlateVersion:c,commit:process.env.DD_GIT_COMMIT_SHA||`unknown`})}),n.withTypeProvider().route({method:`GET`,url:`/alive`,logLevel:`warn`,...m?.length&&{schema:{tags:[`Server status`],description:`Server health status`,response:{200:{content:{"application/json":{schema:e.object({status:e.literal(`ok`)})}}}}}},handler:()=>a({logger:u,...h})}),n.register(s)});export{l as fastifyBoilerplatePlugin};
1
+ import*as e from"zod";import t from"@fastify/helmet";import n from"fastify-plugin";import r from"@fastify/compress";import{handleErrorFastify as i}from"@autofleet/errors";import{authFromUserIdHeaderPlugin as a}from"@autofleet/zehut";import{HealthManager as o}from"@autofleet/nitur";const s=n((e,t,n)=>{let r=new WeakMap;function i(e){if(!r.has(e))return;let{boundOnceRequestClosed:t,boundOnceRequestError:n}=r.get(e);t&&e.raw.removeListener(`close`,t),n&&e.raw.removeListener(`error`,n)}function a(){if(i(this),r.has(this)&&this.raw.destroyed){let{controller:e}=r.get(this);if(e.signal.aborted)return;e.abort()}}function o(e){if(i(this),r.has(this)){let{controller:t}=r.get(this);t.abort(e)}}e.decorateRequest(`signal`,{getter(){let{raw:e,id:t}=this;if(e.socket.destroyed===!0)throw Error(`Socket for request with ID '${t}' already closed`);if(r.has(this))return r.get(this).controller.signal;let n=a.bind(this),i=o.bind(this),s=new AbortController;return r.set(this,{controller:s,boundOnceRequestClosed:n,boundOnceRequestError:i}),e.once(`close`,n),e.once(`error`,i),s.signal}}),e.addHook(`onResponse`,(e,t,n)=>{r.has(e)&&(i(e),r.delete(e)),n()}),n()}),{version:c}={name:`@autofleet/fastify-boilerplate`,version:`2.0.1`,type:`module`,main:`./dist/index.js`,module:`./dist/index.js`,types:`./dist/index.d.ts`,exports:{".":{import:{types:`./dist/index.d.ts`,default:`./dist/index.js`}}},scripts:{build:`tsdown`,test:`vitest`,coverage:`vitest --coverage`},repository:{type:`git`,url:`git+https://github.com/Autofleet/autorepo.git`},author:``,license:`Proprietary`,bugs:{url:`https://github.com/Autofleet/autorepo/issues`},homepage:`https://github.com/Autofleet/autorepo/tree/master/packages/fastify-boilerplate#readme`,engines:{node:`>=22`},peerDependencies:{"@autofleet/logger":`*`},devDependencies:{"@autofleet/logger":`workspace:^`,fastify:`catalog:`,"fastify-plugin":`catalog:`,"zod-openapi":`catalog:`},files:[`dist`],dependencies:{"@autofleet/errors":`workspace:^`,"@autofleet/nitur":`workspace:^`,"@autofleet/zehut":`workspace:^`,"@fastify/compress":`catalog:`,"@fastify/helmet":`catalog:`,"@fastify/swagger":`catalog:`,"@fastify/swagger-ui":`catalog:`,"fastify-zod-openapi":`catalog:`,zod:`catalog:`}},l=n(async(n,l)=>{let{logger:u,name:d,openApiName:f,version:p,tags:m,eagerLoadUserPermissions:h=!0,customPermissionLoader:g,healthManagerOptions:_}=l;if(n.decorateRequest(`logger`,{getter:()=>u}),n.register(i,{fallbackMsg:`Unhandled error caught`}),n.register(t),n.register(a,{eagerLoadUserPermissions:h,customPermissionLoader:g}),n.register(r,{global:!0,threshold:1024}),m?.length){let[e,{default:t},{default:r}]=await Promise.all([import(`fastify-zod-openapi`),import(`@fastify/swagger`),import(`@fastify/swagger-ui`)]),{validatorCompiler:i,serializerCompiler:a,fastifyZodOpenApiTransform:o,fastifyZodOpenApiTransformObject:s,fastifyZodOpenApiPlugin:c}=e;n.setValidatorCompiler(i),n.setSerializerCompiler(a),await n.register(c),await n.register(t,{openapi:{openapi:`3.1.1`,info:{title:f||`${d} API`,version:p||`1.0.0`},tags:[{name:`Server status`,description:`General endpoints indicating server's status`},...m]},transform:o,transformObject:s}),await n.register(r)}let v=new Date;if(n.withTypeProvider().route({method:`GET`,url:`/`,logLevel:`warn`,...m?.length&&{schema:{tags:[`Server status`],description:`Get server status`,response:{200:{content:{"application/json":{schema:e.object({name:e.literal(d).optional().meta({description:`The name of ${d}`}),version:e.literal(p).optional().meta({description:`The version in package.json file of ${d}`}),boilerPlateVersion:e.literal(c).optional().meta({description:`The version in package.json file of the fastify boilerplate`}),serverRunningSince:e.date().optional().meta({description:`The date when the server started running`}),commit:e.string().meta({description:`The commit SHA of the current deployment`})})}}}}}},handler:()=>({name:d,version:p,serverRunningSince:v,boilerPlateVersion:c,commit:process.env.DD_GIT_COMMIT_SHA||`unknown`})}),_){let t=new o({..._,logger:u});n.withTypeProvider().route({method:`GET`,url:`/alive`,logLevel:`warn`,...m?.length&&{schema:{tags:[`Server status`],description:`Server liveness status`,response:{200:{content:{"application/json":{schema:e.object({status:e.literal(`ok`)})}}},503:{content:{"application/json":{schema:e.object({status:e.literal(`ERROR`),errors:e.array(e.string())})}}}}}},handler:()=>t.aliveCheck()}),n.withTypeProvider().route({method:`GET`,url:`/ready`,logLevel:`warn`,...m?.length&&{schema:{tags:[`Server status`],description:`Server readiness status`,response:{200:{content:{"application/json":{schema:e.object({status:e.literal(`ok`)})}}},503:{content:{"application/json":{schema:e.object({status:e.literal(`ERROR`),errors:e.array(e.string())})}}}}}},handler:()=>t.readyCheck()}),n.addHook(`onReady`,function(){this.server&&(t.attachServer({server:this.server}),u.debug(`[FastifyBoilerplate] HTTP server attached to HealthManager for graceful shutdown`))})}n.register(s)});export{l as fastifyBoilerplatePlugin};
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["fastifyRequestSignal: FastifyPluginCallback","fastifyRequestSignalPlugin: FastifyPluginCallback","pkgJson","fastifyBoilerplate: FastifyPluginAsync<FastifyBoilerPlateOptions>","name","version","fastifyBoilerplatePlugin: FastifyPluginAsync<FastifyBoilerPlateOptions>"],"sources":["../src/cancelSignalProvider.ts","../package.json","../src/index.ts"],"sourcesContent":["import fastifyPlugin from 'fastify-plugin';\nimport type { FastifyRequest, FastifyPluginCallback } from 'fastify';\n\ndeclare module 'fastify' {\n interface FastifyRequest {\n /**\n * The AbortSignal associated with the request.\n * This signal can be used to abort operations related to the request.\n * It is automatically aborted when the request is closed or destroyed.\n *\n * This signal is created lazily, meaning it is only created if this field is accessed.\n *\n * Make sure to handle the signal carefully in your request handlers to avoid memory leaks or unexpected behavior.\n * If you add an event listener, make sure to remove it when the request is done.\n * Consider using the disposable {@link https://nodejs.org/docs/latest/api/events.html#eventsaddabortlistenersignal-listener `addAbortListener`} method.\n */\n signal: AbortSignal;\n }\n}\n\nconst fastifyRequestSignal: FastifyPluginCallback = (fastify, _options, next) => {\n const controllers = new WeakMap<FastifyRequest, { controller: AbortController; boundOnceRequestClosed: typeof onceRequestClosed; boundOnceRequestError: typeof onceRequestError; }>();\n\n function removeRequestListeners(req: FastifyRequest): void {\n if (!controllers.has(req)) {\n return;\n }\n const { boundOnceRequestClosed, boundOnceRequestError } = controllers.get(req)!;\n if (boundOnceRequestClosed) {\n req.raw.removeListener('close', boundOnceRequestClosed);\n }\n if (boundOnceRequestError) {\n req.raw.removeListener('error', boundOnceRequestError);\n }\n }\n\n function onceRequestClosed(this: FastifyRequest) {\n removeRequestListeners(this);\n if (controllers.has(this) && this.raw.destroyed) {\n const { controller } = controllers.get(this)!;\n if (controller.signal.aborted) {\n return;\n }\n controller.abort();\n }\n }\n function onceRequestError(this: FastifyRequest, err: Error) {\n removeRequestListeners(this);\n if (controllers.has(this)) {\n const { controller } = controllers.get(this)!;\n controller.abort(err);\n }\n }\n\n fastify.decorateRequest('signal', {\n getter() {\n const { raw, id } = this;\n if (raw.socket.destroyed === true) {\n throw new Error(`Socket for request with ID '${id}' already closed`);\n }\n if (controllers.has(this)) {\n // Since this is a getter, we can return the existing controller's signal, if the signal was already created.\n return controllers.get(this)!.controller.signal;\n }\n const boundOnceRequestClosed = onceRequestClosed.bind(this);\n const boundOnceRequestError = onceRequestError.bind(this);\n const controller = new AbortController();\n controllers.set(this, { controller, boundOnceRequestClosed, boundOnceRequestError });\n\n raw.once('close', boundOnceRequestClosed);\n raw.once('error', boundOnceRequestError);\n return controller.signal;\n },\n });\n\n fastify.addHook('onResponse', (request, _reply, done) => {\n if (controllers.has(request)) {\n removeRequestListeners(request);\n controllers.delete(request);\n }\n done();\n });\n\n next();\n};\n\nexport const fastifyRequestSignalPlugin: FastifyPluginCallback = fastifyPlugin(fastifyRequestSignal);\n","{\n \"name\": \"@autofleet/fastify-boilerplate\",\n \"version\": \"1.1.29\",\n \"type\": \"module\",\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n }\n }\n },\n \"scripts\": {\n \"build\": \"tsdown\",\n \"test\": \"vitest\",\n \"coverage\": \"vitest --coverage\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/Autofleet/autorepo.git\"\n },\n \"author\": \"\",\n \"license\": \"Proprietary\",\n \"bugs\": {\n \"url\": \"https://github.com/Autofleet/autorepo/issues\"\n },\n \"homepage\": \"https://github.com/Autofleet/autorepo/tree/master/packages/fastify-boilerplate#readme\",\n \"engines\": {\n \"node\": \">=22\"\n },\n \"peerDependencies\": {\n \"@autofleet/logger\": \"*\"\n },\n \"devDependencies\": {\n \"@autofleet/logger\": \"workspace:^\",\n \"fastify\": \"catalog:\",\n \"fastify-plugin\": \"catalog:\",\n \"zod-openapi\": \"catalog:\"\n },\n \"files\": [\n \"dist\"\n ],\n \"dependencies\": {\n \"@autofleet/errors\": \"workspace:^\",\n \"@autofleet/nitur\": \"workspace:^\",\n \"@autofleet/zehut\": \"workspace:^\",\n \"@fastify/compress\": \"catalog:\",\n \"@fastify/helmet\": \"catalog:\",\n \"@fastify/swagger\": \"catalog:\",\n \"@fastify/swagger-ui\": \"catalog:\",\n \"fastify-zod-openapi\": \"catalog:\",\n \"zod\": \"catalog:\"\n }\n}\n","import * as z from 'zod';\nimport helmet from '@fastify/helmet';\nimport fastifyPlugin from 'fastify-plugin';\nimport type { FastifyPluginAsync } from 'fastify';\nimport compression from '@fastify/compress';\nimport type { ZodOpenApiVersion } from 'zod-openapi';\nimport { handleErrorFastify } from '@autofleet/errors';\nimport { systemAliveCheck } from '@autofleet/nitur/fastify';\nimport { authFromUserIdHeaderPlugin } from '@autofleet/zehut';\nimport type { LoggerInstanceManager } from '@autofleet/logger';\nimport type { FastifyDynamicSwaggerOptions } from '@fastify/swagger';\nimport type { FastifyZodOpenApiSchema, FastifyZodOpenApiTypeProvider } from 'fastify-zod-openapi';\nimport { fastifyRequestSignalPlugin } from './cancelSignalProvider.js';\nimport pkgJson from '../package.json' with { type: 'json' };\n\nconst { version: boilerPlateVersion } = pkgJson;\n\ndeclare module 'fastify' {\n interface FastifyRequest {\n logger: LoggerInstanceManager;\n }\n}\n\nexport interface FastifyBoilerPlateOptions {\n /** The name of the Fastify application. */\n name?: string;\n /** The name to show in the swagger UI. @default `${name} API` */\n openApiName?: string;\n /** The version of the MS. */\n version?: string;\n /** The logger instance to use across the application. */\n logger: LoggerInstanceManager;\n /** The options for the alive endpoint. */\n aliveEndpointOptions?: Omit<Parameters<typeof systemAliveCheck>[0], 'logger'>;\n /** When tags are provided, a few plugins will be added for fastify to include OpenAPI docs, and a SwaggerUI. */\n tags?: NonNullable<FastifyDynamicSwaggerOptions['openapi']>['tags'];\n /** Should user permissions be loaded eagerly. @default true */\n eagerLoadUserPermissions?: boolean;\n /** Custom permission loader function to be used in the `zehut` authorization plugin. */\n customPermissionLoader?: Parameters<typeof authFromUserIdHeaderPlugin>[1]['customPermissionLoader'];\n}\n\nconst fastifyBoilerplate: FastifyPluginAsync<FastifyBoilerPlateOptions> = async (fastify, options) => {\n const { logger, name, openApiName, version, tags, aliveEndpointOptions, eagerLoadUserPermissions = true, customPermissionLoader } = options;\n fastify.decorateRequest('logger', { getter: () => logger });\n\n fastify.register(handleErrorFastify, { fallbackMsg: 'Unhandled error caught' });\n\n fastify.register(helmet);\n\n fastify.register(authFromUserIdHeaderPlugin, { eagerLoadUserPermissions, customPermissionLoader });\n\n fastify.register(compression, { global: true, threshold: 1024 });\n\n // #region zod + swagger\n if (tags?.length) {\n const [fastifyZodOpenAPI, { default: fastifySwagger }, { default: fastifySwaggerUI }] = await Promise.all([\n import('fastify-zod-openapi'),\n import('@fastify/swagger'),\n import('@fastify/swagger-ui'),\n ]);\n const { validatorCompiler, serializerCompiler, fastifyZodOpenApiTransform, fastifyZodOpenApiTransformObject, fastifyZodOpenApiPlugin } = fastifyZodOpenAPI;\n fastify.setValidatorCompiler(validatorCompiler);\n fastify.setSerializerCompiler(serializerCompiler);\n await fastify.register(fastifyZodOpenApiPlugin);\n await fastify.register(fastifySwagger, {\n openapi: {\n openapi: '3.1.1' satisfies ZodOpenApiVersion,\n info: {\n title: openApiName || `${name} API`,\n /* v8 ignore next */\n version: version || '1.0.0',\n },\n tags: [\n { name: 'Server status', description: 'General endpoints indicating server\\'s status' },\n ...tags,\n ],\n },\n transform: fastifyZodOpenApiTransform,\n transformObject: fastifyZodOpenApiTransformObject,\n });\n await fastify.register(fastifySwaggerUI);\n }\n // #endregion\n\n const serverRunningSince = new Date();\n fastify.withTypeProvider<FastifyZodOpenApiTypeProvider>().route({\n method: 'GET',\n url: '/',\n logLevel: 'warn',\n ...(tags?.length && {\n schema: {\n tags: ['Server status'],\n description: 'Get server status',\n response: {\n 200: {\n content: {\n 'application/json': {\n schema: z.object({\n name: z.literal(name).optional().meta({ description: `The name of ${name}` }),\n version: z.literal(version).optional().meta({ description: `The version in package.json file of ${name}` }),\n boilerPlateVersion: z.literal(boilerPlateVersion).optional().meta({ description: 'The version in package.json file of the fastify boilerplate' }),\n serverRunningSince: z.date().optional().meta({ description: 'The date when the server started running' }),\n commit: z.string().meta({ description: 'The commit SHA of the current deployment' }),\n }),\n },\n },\n },\n },\n } satisfies FastifyZodOpenApiSchema,\n }),\n handler: () => ({\n name,\n version,\n serverRunningSince,\n boilerPlateVersion,\n commit: process.env.DD_GIT_COMMIT_SHA || 'unknown',\n }),\n });\n\n fastify.withTypeProvider<FastifyZodOpenApiTypeProvider>().route({\n method: 'GET',\n url: '/alive',\n logLevel: 'warn',\n ...(tags?.length && {\n schema: {\n tags: ['Server status'],\n description: 'Server health status',\n response: {\n 200: {\n content: {\n 'application/json': {\n schema: z.object({ status: z.literal('ok') }),\n },\n },\n },\n },\n } satisfies FastifyZodOpenApiSchema,\n }),\n handler: () => systemAliveCheck({ logger, ...aliveEndpointOptions }),\n });\n\n fastify.register(fastifyRequestSignalPlugin);\n};\n\nexport const fastifyBoilerplatePlugin: FastifyPluginAsync<FastifyBoilerPlateOptions> = fastifyPlugin(fastifyBoilerplate);\n"],"mappings":"qSAsFA,MAAaC,EAAoD,GAlEZ,EAAS,EAAU,IAAS,CAC/E,IAAM,EAAc,IAAI,QAExB,SAAS,EAAuB,EAA2B,CACzD,GAAI,CAAC,EAAY,IAAI,EAAI,CACvB,OAEF,GAAM,CAAE,yBAAwB,yBAA0B,EAAY,IAAI,EAAI,CAC1E,GACF,EAAI,IAAI,eAAe,QAAS,EAAuB,CAErD,GACF,EAAI,IAAI,eAAe,QAAS,EAAsB,CAI1D,SAAS,GAAwC,CAE/C,GADA,EAAuB,KAAK,CACxB,EAAY,IAAI,KAAK,EAAI,KAAK,IAAI,UAAW,CAC/C,GAAM,CAAE,cAAe,EAAY,IAAI,KAAK,CAC5C,GAAI,EAAW,OAAO,QACpB,OAEF,EAAW,OAAO,EAGtB,SAAS,EAAuC,EAAY,CAE1D,GADA,EAAuB,KAAK,CACxB,EAAY,IAAI,KAAK,CAAE,CACzB,GAAM,CAAE,cAAe,EAAY,IAAI,KAAK,CAC5C,EAAW,MAAM,EAAI,EAIzB,EAAQ,gBAAgB,SAAU,CAChC,QAAS,CACP,GAAM,CAAE,MAAK,MAAO,KACpB,GAAI,EAAI,OAAO,YAAc,GAC3B,MAAU,MAAM,+BAA+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D,CAAC,CACjJ,mBAAoB,EAAE,MAAM,CAAC,UAAU,CAAC,KAAK,CAAE,YAAa,2CAA4C,CAAC,CACzG,OAAQ,EAAE,QAAQ,CAAC,KAAK,CAAE,YAAa,2CAA4C,CAAC,CACrF,CAAC,CACH,CACF,CACF,CACF,CACF,CACF,CACD,aAAgB,CACd,KAAA,EACA,QAAA,EACA,qBACA,qBACA,OAAQ,QAAQ,IAAI,mBAAqB,UAC1C,EACF,CAAC,CAEF,EAAQ,kBAAiD,CAAC,MAAM,CAC9D,OAAQ,MACR,IAAK,SACL,SAAU,OACV,GAAI,GAAM,QAAU,CAClB,OAAQ,CACN,KAAM,CAAC,gBAAgB,CACvB,YAAa,uBACb,SAAU,CACR,IAAK,CACH,QAAS,CACP,mBAAoB,CAClB,OAAQ,EAAE,OAAO,CAAE,OAAQ,EAAE,QAAQ,KAAK,CAAE,CAAC,CAC9C,CACF,CACF,CACF,CACF,CACF,CACD,YAAe,EAAiB,CAAE,SAAQ,GAAG,EAAsB,CAAC,CACrE,CAAC,CAEF,EAAQ,SAAS,EAA2B,EAG0E"}
1
+ {"version":3,"file":"index.js","names":["fastifyRequestSignal: FastifyPluginCallback","fastifyRequestSignalPlugin: FastifyPluginCallback","pkgJson","fastifyBoilerplate: FastifyPluginAsync<FastifyBoilerPlateOptions>","name","version","healthManager: HealthManager","fastifyBoilerplatePlugin: FastifyPluginAsync<FastifyBoilerPlateOptions>"],"sources":["../src/cancelSignalProvider.ts","../package.json","../src/index.ts"],"sourcesContent":["import fastifyPlugin from 'fastify-plugin';\nimport type { FastifyRequest, FastifyPluginCallback } from 'fastify';\n\ndeclare module 'fastify' {\n interface FastifyRequest {\n /**\n * The AbortSignal associated with the request.\n * This signal can be used to abort operations related to the request.\n * It is automatically aborted when the request is closed or destroyed.\n *\n * This signal is created lazily, meaning it is only created if this field is accessed.\n *\n * Make sure to handle the signal carefully in your request handlers to avoid memory leaks or unexpected behavior.\n * If you add an event listener, make sure to remove it when the request is done.\n * Consider using the disposable {@link https://nodejs.org/docs/latest/api/events.html#eventsaddabortlistenersignal-listener `addAbortListener`} method.\n */\n signal: AbortSignal;\n }\n}\n\nconst fastifyRequestSignal: FastifyPluginCallback = (fastify, _options, next) => {\n const controllers = new WeakMap<FastifyRequest, { controller: AbortController; boundOnceRequestClosed: typeof onceRequestClosed; boundOnceRequestError: typeof onceRequestError; }>();\n\n function removeRequestListeners(req: FastifyRequest): void {\n if (!controllers.has(req)) {\n return;\n }\n const { boundOnceRequestClosed, boundOnceRequestError } = controllers.get(req)!;\n if (boundOnceRequestClosed) {\n req.raw.removeListener('close', boundOnceRequestClosed);\n }\n if (boundOnceRequestError) {\n req.raw.removeListener('error', boundOnceRequestError);\n }\n }\n\n function onceRequestClosed(this: FastifyRequest) {\n removeRequestListeners(this);\n if (controllers.has(this) && this.raw.destroyed) {\n const { controller } = controllers.get(this)!;\n if (controller.signal.aborted) {\n return;\n }\n controller.abort();\n }\n }\n function onceRequestError(this: FastifyRequest, err: Error) {\n removeRequestListeners(this);\n if (controllers.has(this)) {\n const { controller } = controllers.get(this)!;\n controller.abort(err);\n }\n }\n\n fastify.decorateRequest('signal', {\n getter() {\n const { raw, id } = this;\n if (raw.socket.destroyed === true) {\n throw new Error(`Socket for request with ID '${id}' already closed`);\n }\n if (controllers.has(this)) {\n // Since this is a getter, we can return the existing controller's signal, if the signal was already created.\n return controllers.get(this)!.controller.signal;\n }\n const boundOnceRequestClosed = onceRequestClosed.bind(this);\n const boundOnceRequestError = onceRequestError.bind(this);\n const controller = new AbortController();\n controllers.set(this, { controller, boundOnceRequestClosed, boundOnceRequestError });\n\n raw.once('close', boundOnceRequestClosed);\n raw.once('error', boundOnceRequestError);\n return controller.signal;\n },\n });\n\n fastify.addHook('onResponse', (request, _reply, done) => {\n if (controllers.has(request)) {\n removeRequestListeners(request);\n controllers.delete(request);\n }\n done();\n });\n\n next();\n};\n\nexport const fastifyRequestSignalPlugin: FastifyPluginCallback = fastifyPlugin(fastifyRequestSignal);\n","{\n \"name\": \"@autofleet/fastify-boilerplate\",\n \"version\": \"2.0.1\",\n \"type\": \"module\",\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n }\n }\n },\n \"scripts\": {\n \"build\": \"tsdown\",\n \"test\": \"vitest\",\n \"coverage\": \"vitest --coverage\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/Autofleet/autorepo.git\"\n },\n \"author\": \"\",\n \"license\": \"Proprietary\",\n \"bugs\": {\n \"url\": \"https://github.com/Autofleet/autorepo/issues\"\n },\n \"homepage\": \"https://github.com/Autofleet/autorepo/tree/master/packages/fastify-boilerplate#readme\",\n \"engines\": {\n \"node\": \">=22\"\n },\n \"peerDependencies\": {\n \"@autofleet/logger\": \"*\"\n },\n \"devDependencies\": {\n \"@autofleet/logger\": \"workspace:^\",\n \"fastify\": \"catalog:\",\n \"fastify-plugin\": \"catalog:\",\n \"zod-openapi\": \"catalog:\"\n },\n \"files\": [\n \"dist\"\n ],\n \"dependencies\": {\n \"@autofleet/errors\": \"workspace:^\",\n \"@autofleet/nitur\": \"workspace:^\",\n \"@autofleet/zehut\": \"workspace:^\",\n \"@fastify/compress\": \"catalog:\",\n \"@fastify/helmet\": \"catalog:\",\n \"@fastify/swagger\": \"catalog:\",\n \"@fastify/swagger-ui\": \"catalog:\",\n \"fastify-zod-openapi\": \"catalog:\",\n \"zod\": \"catalog:\"\n }\n}\n","import * as z from 'zod';\nimport helmet from '@fastify/helmet';\nimport fastifyPlugin from 'fastify-plugin';\nimport type { FastifyPluginAsync } from 'fastify';\nimport compression from '@fastify/compress';\nimport type { ZodOpenApiVersion } from 'zod-openapi';\nimport { handleErrorFastify } from '@autofleet/errors';\nimport { authFromUserIdHeaderPlugin } from '@autofleet/zehut';\nimport type { LoggerInstanceManager } from '@autofleet/logger';\nimport { HealthManager, type HealthManagerOptions } from '@autofleet/nitur';\nimport type { FastifyDynamicSwaggerOptions } from '@fastify/swagger';\nimport type { FastifyZodOpenApiSchema, FastifyZodOpenApiTypeProvider } from 'fastify-zod-openapi';\nimport { fastifyRequestSignalPlugin } from './cancelSignalProvider.js';\nimport pkgJson from '../package.json' with { type: 'json' };\n\nconst { version: boilerPlateVersion } = pkgJson;\n\ndeclare module 'fastify' {\n interface FastifyRequest {\n logger: LoggerInstanceManager;\n }\n}\n\nexport interface FastifyBoilerPlateOptions {\n /** The name of the Fastify application. */\n name?: string;\n /** The name to show in the swagger UI. @default `${name} API` */\n openApiName?: string;\n /** The version of the MS. */\n version?: string;\n /** The logger instance to use across the application. */\n logger: LoggerInstanceManager;\n /** When tags are provided, a few plugins will be added for fastify to include OpenAPI docs, and a SwaggerUI. */\n tags?: NonNullable<FastifyDynamicSwaggerOptions['openapi']>['tags'];\n /** Should user permissions be loaded eagerly. @default true */\n eagerLoadUserPermissions?: boolean;\n /** Custom permission loader function to be used in the `zehut` authorization plugin. */\n customPermissionLoader?: Parameters<typeof authFromUserIdHeaderPlugin>[1]['customPermissionLoader'];\n /** HealthManager options to create a HealthManager instance for Kubernetes liveness/readiness probes and graceful shutdown. */\n healthManagerOptions: Omit<HealthManagerOptions, 'logger'>;\n}\n\nconst fastifyBoilerplate: FastifyPluginAsync<FastifyBoilerPlateOptions> = async (fastify, options) => {\n const { logger, name, openApiName, version, tags, eagerLoadUserPermissions = true, customPermissionLoader, healthManagerOptions } = options;\n fastify.decorateRequest('logger', { getter: () => logger });\n\n fastify.register(handleErrorFastify, { fallbackMsg: 'Unhandled error caught' });\n\n fastify.register(helmet);\n\n fastify.register(authFromUserIdHeaderPlugin, { eagerLoadUserPermissions, customPermissionLoader });\n\n fastify.register(compression, { global: true, threshold: 1024 });\n\n // #region zod + swagger\n if (tags?.length) {\n const [fastifyZodOpenAPI, { default: fastifySwagger }, { default: fastifySwaggerUI }] = await Promise.all([\n import('fastify-zod-openapi'),\n import('@fastify/swagger'),\n import('@fastify/swagger-ui'),\n ]);\n const { validatorCompiler, serializerCompiler, fastifyZodOpenApiTransform, fastifyZodOpenApiTransformObject, fastifyZodOpenApiPlugin } = fastifyZodOpenAPI;\n fastify.setValidatorCompiler(validatorCompiler);\n fastify.setSerializerCompiler(serializerCompiler);\n await fastify.register(fastifyZodOpenApiPlugin);\n await fastify.register(fastifySwagger, {\n openapi: {\n openapi: '3.1.1' satisfies ZodOpenApiVersion,\n info: {\n title: openApiName || `${name} API`,\n /* v8 ignore next */\n version: version || '1.0.0',\n },\n tags: [\n { name: 'Server status', description: 'General endpoints indicating server\\'s status' },\n ...tags,\n ],\n },\n transform: fastifyZodOpenApiTransform,\n transformObject: fastifyZodOpenApiTransformObject,\n });\n await fastify.register(fastifySwaggerUI);\n }\n // #endregion\n\n const serverRunningSince = new Date();\n fastify.withTypeProvider<FastifyZodOpenApiTypeProvider>().route({\n method: 'GET',\n url: '/',\n logLevel: 'warn',\n ...(tags?.length && {\n schema: {\n tags: ['Server status'],\n description: 'Get server status',\n response: {\n 200: {\n content: {\n 'application/json': {\n schema: z.object({\n name: z.literal(name).optional().meta({ description: `The name of ${name}` }),\n version: z.literal(version).optional().meta({ description: `The version in package.json file of ${name}` }),\n boilerPlateVersion: z.literal(boilerPlateVersion).optional().meta({ description: 'The version in package.json file of the fastify boilerplate' }),\n serverRunningSince: z.date().optional().meta({ description: 'The date when the server started running' }),\n commit: z.string().meta({ description: 'The commit SHA of the current deployment' }),\n }),\n },\n },\n },\n },\n } satisfies FastifyZodOpenApiSchema,\n }),\n handler: () => ({\n name,\n version,\n serverRunningSince,\n boilerPlateVersion,\n commit: process.env.DD_GIT_COMMIT_SHA || 'unknown',\n }),\n });\n\n if (healthManagerOptions) {\n const healthManager: HealthManager = new HealthManager({ ...healthManagerOptions, logger });\n fastify.withTypeProvider<FastifyZodOpenApiTypeProvider>().route({\n method: 'GET',\n url: '/alive',\n logLevel: 'warn',\n ...(tags?.length && {\n schema: {\n tags: ['Server status'],\n description: 'Server liveness status',\n response: {\n 200: {\n content: {\n 'application/json': {\n schema: z.object({ status: z.literal('ok') }),\n },\n },\n },\n 503: {\n content: {\n 'application/json': {\n schema: z.object({\n status: z.literal('ERROR'),\n errors: z.array(z.string()),\n }),\n },\n },\n },\n },\n } satisfies FastifyZodOpenApiSchema,\n }),\n handler: () => healthManager.aliveCheck(),\n });\n\n fastify.withTypeProvider<FastifyZodOpenApiTypeProvider>().route({\n method: 'GET',\n url: '/ready',\n logLevel: 'warn',\n ...(tags?.length && {\n schema: {\n tags: ['Server status'],\n description: 'Server readiness status',\n response: {\n 200: {\n content: {\n 'application/json': {\n schema: z.object({ status: z.literal('ok') }),\n },\n },\n },\n 503: {\n content: {\n 'application/json': {\n schema: z.object({\n status: z.literal('ERROR'),\n errors: z.array(z.string()),\n }),\n },\n },\n },\n },\n } satisfies FastifyZodOpenApiSchema,\n }),\n handler: () => healthManager.readyCheck(),\n });\n\n fastify.addHook('onReady', function () {\n if (this.server) {\n healthManager.attachServer({ server: this.server });\n logger.debug('[FastifyBoilerplate] HTTP server attached to HealthManager for graceful shutdown');\n }\n });\n }\n\n fastify.register(fastifyRequestSignalPlugin);\n};\n\nexport const fastifyBoilerplatePlugin: FastifyPluginAsync<FastifyBoilerPlateOptions> = fastifyPlugin(fastifyBoilerplate);\n"],"mappings":"0RAsFA,MAAaC,EAAoD,GAlEZ,EAAS,EAAU,IAAS,CAC/E,IAAM,EAAc,IAAI,QAExB,SAAS,EAAuB,EAA2B,CACzD,GAAI,CAAC,EAAY,IAAI,EAAI,CACvB,OAEF,GAAM,CAAE,yBAAwB,yBAA0B,EAAY,IAAI,EAAI,CAC1E,GACF,EAAI,IAAI,eAAe,QAAS,EAAuB,CAErD,GACF,EAAI,IAAI,eAAe,QAAS,EAAsB,CAI1D,SAAS,GAAwC,CAE/C,GADA,EAAuB,KAAK,CACxB,EAAY,IAAI,KAAK,EAAI,KAAK,IAAI,UAAW,CAC/C,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AEF,EAAQ,kBAAiD,CAAC,MAAM,CAC9D,OAAQ,MACR,IAAK,SACL,SAAU,OACV,GAAI,GAAM,QAAU,CAClB,OAAQ,CACN,KAAM,CAAC,gBAAgB,CACvB,YAAa,0BACb,SAAU,CACR,IAAK,CACH,QAAS,CACP,mBAAoB,CAClB,OAAQ,EAAE,OAAO,CAAE,OAAQ,EAAE,QAAQ,KAAK,CAAE,CAAC,CAC9C,CACF,CACF,CACD,IAAK,CACH,QAAS,CACP,mBAAoB,CAClB,OAAQ,EAAE,OAAO,CACf,OAAQ,EAAE,QAAQ,QAAQ,CAC1B,OAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,CAC5B,CAAC,CACH,CACF,CACF,CACF,CACF,CACF,CACD,YAAe,EAAc,YAAY,CAC1C,CAAC,CAEF,EAAQ,QAAQ,UAAW,UAAY,CACjC,KAAK,SACP,EAAc,aAAa,CAAE,OAAQ,KAAK,OAAQ,CAAC,CACnD,EAAO,MAAM,mFAAmF,GAElG,CAGJ,EAAQ,SAAS,EAA2B,EAG0E"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/fastify-boilerplate",
3
- "version": "1.1.29",
3
+ "version": "2.0.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -30,24 +30,24 @@
30
30
  "@autofleet/logger": "*"
31
31
  },
32
32
  "devDependencies": {
33
- "fastify": "^5.6.0",
33
+ "fastify": "^5.6.2",
34
34
  "fastify-plugin": "^5.1.0",
35
35
  "zod-openapi": "^5.4.5",
36
- "@autofleet/logger": "^4.2.36"
36
+ "@autofleet/logger": "^4.2.37"
37
37
  },
38
38
  "files": [
39
39
  "dist"
40
40
  ],
41
41
  "dependencies": {
42
- "@fastify/compress": "^8.3.0",
42
+ "@fastify/compress": "^8.3.1",
43
43
  "@fastify/helmet": "^13.0.2",
44
44
  "@fastify/swagger": "^9.6.1",
45
45
  "@fastify/swagger-ui": "^5.2.3",
46
46
  "fastify-zod-openapi": "^5.5.0",
47
- "zod": "^4.1.13",
48
- "@autofleet/errors": "^3.1.31",
49
- "@autofleet/nitur": "^2.1.36",
50
- "@autofleet/zehut": "^4.5.12"
47
+ "zod": "^4.2.1",
48
+ "@autofleet/errors": "^3.1.33",
49
+ "@autofleet/nitur": "^2.2.1",
50
+ "@autofleet/zehut": "^4.5.13"
51
51
  },
52
52
  "scripts": {
53
53
  "build": "tsdown",