UNPKG

@vtex/diagnostics-nodejs

Version:

Diagnostics library for Node.js applications

25 lines 804 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FastifyContextPlugin = void 0; exports.createFastifyContextPlugin = createFastifyContextPlugin; const core_1 = require("./core"); function contextPropagationPlugin(fastify, opts, done) { fastify.addHook('onRequest', (request, reply, hookDone) => { (0, core_1.ensureContextPropagation)(hookDone); }); done(); } exports.FastifyContextPlugin = contextPropagationPlugin; function createFastifyContextPlugin() { try { const fp = require('fastify-plugin'); return fp(contextPropagationPlugin, { fastify: '4.x', name: 'fastify-diagnostics-context' }); } catch { return contextPropagationPlugin; } } //# sourceMappingURL=fastify.js.map