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ACA,gBAEJ,CAEA,SAAS,uBAAwB,GAG/B,MAAM,EAAY,CAAC,EAOnB,MANqB,CAAC,eAAgB,WAAY,kBAErC,OAAO,gBAAgB,QAAQ,IAC1C,EAAU,GAAK,EAAM,MAAM,KAGtB,OAAO,OAAO,CAAC,EAAG,EAC3B,CAEA,SAAS,0BAA2B,EAAK,GAGvC,GAAiB,eAAb,EAAI,MAAyB,EAAO,UACtC,OAGF,IAAI,EAAM,EAAW,EAAa,EAEjB,6BAAb,EAAI,MACN,EAAY,MACZ,EAAc,KAAK,aAAa,GAChC,EAAO,aAAa,kDACpB,EAAa,WACS,wBAAb,EAAI,MACb,EAAY,MACZ,EAAc,KAAK,aAAa,GAChC,EAAO,aAAa,6EACpB,EAAa,oBAEb,EAAY,MACZ,EAAc,KAAK,aAAa,GAChC,EAAO,aAAa,gDACpB,EAAa,SAMf,KAAK,IAAI,MAAM,CAAE,OAAO,UAAU,KAK9B,EAAO,UACT,EAAO,MAAM,YAAY,KAAa,wBAAkC,EAAK,mDAAmD,KAElI,EAAO,QAAQ,EACjB,CAEA,SAAS,6BAA8B,GACrC,GAAoC,mBAAzB,EACT,MAAM,IAAI,6CAA6C,GAClD,GAA8C,kBAA1C,EAAqB,YAAY,KAC1C,MAAM,IAAI,sCAAsC,gBAEpD,CAaA,OAAO,QAAU,QACjB,OAAO,QAAQ,WAAa,WAC5B,OAAO,QAAQ,cAAgB,cAC/B,OAAO,QAAQ,QAAU,QACzB,OAAO,QAAQ,QAAU","file":"/npm/fastify@5.12.1/fastify.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.48.0.\n * Original file: /npm/fastify@5.12.1/fastify.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict'\n\nconst VERSION = '5.12.1'\n\nconst Avvio = require('avvio')\nconst http = require('node:http')\nconst diagnostics = require('node:diagnostics_channel')\nlet lightMyRequest\n\nconst {\n  kAvvioBoot,\n  kChildren,\n  kServerBindings,\n  kBodyLimit,\n  kSupportedHTTPMethods,\n  kRoutePrefix,\n  kLogLevel,\n  kLogSerializers,\n  kHooks,\n  kSchemaController,\n  kRequestAcceptVersion,\n  kReplySerializerDefault,\n  kContentTypeParser,\n  kReply,\n  kRequest,\n  kFourOhFour,\n  kState,\n  kOptions,\n  kPluginNameChain,\n  kSchemaErrorFormatter,\n  kErrorHandler,\n  kKeepAliveConnections,\n  kChildLoggerFactory,\n  kGenReqId,\n  kErrorHandlerAlreadySet,\n  kHandlerTimeout,\n  kLogController\n} = require('./lib/symbols.js')\n\nconst { createServer } = require('./lib/server')\nconst Reply = require('./lib/reply')\nconst Request = require('./lib/request')\nconst Context = require('./lib/context.js')\nconst decorator = require('./lib/decorate')\nconst ContentTypeParser = require('./lib/content-type-parser.js')\nconst SchemaController = require('./lib/schema-controller')\nconst { Hooks, hookRunnerApplication, supportedHooks } = require('./lib/hooks')\nconst { createChildLogger, defaultChildLoggerFactory, createLogger, createLogController, LogController } = require('./lib/logger-factory')\nconst pluginUtils = require('./lib/plugin-utils.js')\nconst { getGenReqId, reqIdGenFactory } = require('./lib/req-id-gen-factory.js')\nconst { buildRouting, validateBodyLimitOption, buildRouterOptions } = require('./lib/route')\nconst build404 = require('./lib/four-oh-four')\nconst getSecuredInitialConfig = require('./lib/initial-config-validation.js')\nconst override = require('./lib/plugin-override')\nconst {\n  appendStackTrace,\n  AVVIO_ERRORS_MAP,\n  ...errorCodes\n} = require('./lib/errors')\nconst PonyPromise = require('./lib/promise')\n\nconst { defaultInitOptions } = getSecuredInitialConfig\n\nconst {\n  FST_ERR_ASYNC_CONSTRAINT,\n  FST_ERR_BAD_URL,\n  FST_ERR_MAX_PARAM_LENGTH,\n  FST_ERR_OPTIONS_NOT_OBJ,\n  FST_ERR_QSP_NOT_FN,\n  FST_ERR_SCHEMA_CONTROLLER_BUCKET_OPT_NOT_FN,\n  FST_ERR_AJV_CUSTOM_OPTIONS_OPT_NOT_OBJ,\n  FST_ERR_AJV_CUSTOM_OPTIONS_OPT_NOT_ARR,\n  FST_ERR_INSTANCE_ALREADY_LISTENING,\n  FST_ERR_REOPENED_CLOSE_SERVER,\n  FST_ERR_ROUTE_REWRITE_NOT_STR,\n  FST_ERR_SCHEMA_ERROR_FORMATTER_NOT_FN,\n  FST_ERR_ERROR_HANDLER_NOT_FN,\n  FST_ERR_ERROR_HANDLER_ALREADY_SET,\n  FST_ERR_ROUTE_METHOD_INVALID\n} = errorCodes\n\nconst { buildErrorHandler } = require('./lib/error-handler.js')\nconst { FSTWRN004, FSTDEP023, FSTDEP024, FSTDEP025 } = require('./lib/warnings.js')\n\nconst initChannel = diagnostics.channel('fastify.initialization')\n\n/**\n * @param {import('./fastify.js').FastifyServerOptions} serverOptions\n */\nfunction fastify (serverOptions) {\n  const {\n    options,\n    genReqId,\n    logController,\n    hasLogger,\n    initialConfig\n  } = processOptions(serverOptions, defaultRoute, onBadUrl, onMaxParamLength)\n\n  // Default router\n  const router = buildRouting(options.routerOptions)\n\n  // 404 router, used for handling encapsulated 404 handlers\n  const fourOhFour = build404(options)\n\n  // HTTP server and its handler\n  const httpHandler = wrapRouting(router, options)\n\n  const {\n    server,\n    listen,\n    forceCloseConnections,\n    serverHasCloseAllConnections,\n    serverHasCloseHttp2Sessions,\n    keepAliveConnections\n  } = createServer(options, httpHandler)\n\n  const setupResponseListeners = Reply.setupResponseListeners\n  const schemaController = SchemaController.buildSchemaController(null, options.schemaController)\n\n  // Public API\n  const fastify = {\n    // Fastify internals\n    [kState]: {\n      listening: false,\n      closing: false,\n      started: false,\n      ready: false,\n      booting: false,\n      aborted: false,\n      readyResolver: null\n    },\n    [kKeepAliveConnections]: keepAliveConnections,\n    [kSupportedHTTPMethods]: {\n      bodyless: new Set([\n        // Standard\n        'GET',\n        'HEAD',\n        'TRACE'\n      ]),\n      bodywith: new Set([\n        // Standard\n        'DELETE',\n        'OPTIONS',\n        'PATCH',\n        'PUT',\n        'POST',\n        // RFC 10008\n        'QUERY'\n      ])\n    },\n    [kOptions]: options,\n    [kChildren]: [],\n    [kServerBindings]: [],\n    [kBodyLimit]: options.bodyLimit,\n    [kHandlerTimeout]: options.handlerTimeout,\n    [kRoutePrefix]: '',\n    [kLogLevel]: '',\n    [kLogSerializers]: null,\n    [kHooks]: new Hooks(),\n    [kSchemaController]: schemaController,\n    [kSchemaErrorFormatter]: null,\n    [kErrorHandler]: buildErrorHandler(),\n    [kErrorHandlerAlreadySet]: false,\n    [kChildLoggerFactory]: options.childLoggerFactory || defaultChildLoggerFactory,\n    [kReplySerializerDefault]: null,\n    [kContentTypeParser]: new ContentTypeParser(\n      options.bodyLimit,\n      (options.onProtoPoisoning || defaultInitOptions.onProtoPoisoning),\n      (options.onConstructorPoisoning || defaultInitOptions.onConstructorPoisoning)\n    ),\n    [kReply]: Reply.buildReply(Reply),\n    [kRequest]: Request.buildRequest(Request, options.trustProxy),\n    [kFourOhFour]: fourOhFour,\n    [pluginUtils.kRegisteredPlugins]: [],\n    [kPluginNameChain]: ['fastify'],\n    [kAvvioBoot]: null,\n    [kGenReqId]: genReqId,\n    // routing method\n    routing: httpHandler,\n    // routes shorthand methods\n    delete: function _delete (url, options, handler) {\n      return router.prepareRoute.call(this, { method: 'DELETE', url, options, handler })\n    },\n    get: function _get (url, options, handler) {\n      return router.prepareRoute.call(this, { method: 'GET', url, options, handler })\n    },\n    head: function _head (url, options, handler) {\n      return router.prepareRoute.call(this, { method: 'HEAD', url, options, handler })\n    },\n    trace: function _trace (url, options, handler) {\n      return router.prepareRoute.call(this, { method: 'TRACE', url, options, handler })\n    },\n    patch: function _patch (url, options, handler) {\n      return router.prepareRoute.call(this, { method: 'PATCH', url, options, handler })\n    },\n    post: function _post (url, options, handler) {\n      return router.prepareRoute.call(this, { method: 'POST', url, options, handler })\n    },\n    put: function _put (url, options, handler) {\n      return router.prepareRoute.call(this, { method: 'PUT', url, options, handler })\n    },\n    options: function _options (url, options, handler) {\n      return router.prepareRoute.call(this, { method: 'OPTIONS', url, options, handler })\n    },\n    query: function _query (url, options, handler) {\n      return router.prepareRoute.call(this, { method: 'QUERY', url, options, handler })\n    },\n    all: function _all (url, options, handler) {\n      return router.prepareRoute.call(this, { method: this.supportedMethods, url, options, handler })\n    },\n    // extended route\n    route: function _route (options) {\n      // we need the fastify object that we are producing so we apply a lazy loading of the function,\n      // otherwise we should bind it after the declaration\n      return router.route.call(this, { options })\n    },\n    hasRoute: function _route (options) {\n      return router.hasRoute.call(this, { options })\n    },\n    findRoute: function _findRoute (options) {\n      return router.findRoute(options)\n    },\n    // expose logger instance\n    log: options.logger,\n    [kLogController]: logController,\n    // type provider\n    withTypeProvider,\n    // hooks\n    addHook,\n    // schemas\n    addSchema,\n    getSchema: schemaController.getSchema.bind(schemaController),\n    getSchemas: schemaController.getSchemas.bind(schemaController),\n    setValidatorCompiler,\n    setSerializerCompiler,\n    setSchemaController,\n    setReplySerializer,\n    setSchemaErrorFormatter,\n    // set generated request id\n    setGenReqId,\n    // custom parsers\n    addContentTypeParser: ContentTypeParser.helpers.addContentTypeParser,\n    hasContentTypeParser: ContentTypeParser.helpers.hasContentTypeParser,\n    getDefaultJsonParser: ContentTypeParser.defaultParsers.getDefaultJsonParser,\n    defaultTextParser: ContentTypeParser.defaultParsers.defaultTextParser,\n    removeContentTypeParser: ContentTypeParser.helpers.removeContentTypeParser,\n    removeAllContentTypeParsers: ContentTypeParser.helpers.removeAllContentTypeParsers,\n    // Fastify architecture methods (initialized by Avvio)\n    register: null,\n    after: null,\n    ready: null,\n    onClose: null,\n    close: null,\n    printPlugins: null,\n    hasPlugin: function (name) {\n      return this[pluginUtils.kRegisteredPlugins].includes(name) || this[kPluginNameChain].includes(name)\n    },\n    // http server\n    listen,\n    server,\n    addresses: function () {\n      /* istanbul ignore next */\n      const binded = this[kServerBindings].map(b => b.address())\n      binded.push(this.server.address())\n      return binded.filter(adr => adr)\n    },\n    // extend fastify objects\n    decorate: decorator.add,\n    hasDecorator: decorator.exist,\n    decorateReply: decorator.decorateReply,\n    decorateRequest: decorator.decorateRequest,\n    hasRequestDecorator: decorator.existRequest,\n    hasReplyDecorator: decorator.existReply,\n    getDecorator: decorator.getInstanceDecorator,\n    addHttpMethod,\n    // fake http injection\n    inject,\n    // pretty print of the registered routes\n    printRoutes,\n    // custom error handling\n    setNotFoundHandler,\n    setErrorHandler,\n    // child logger\n    setChildLoggerFactory,\n    // Set fastify initial configuration options read-only object\n    initialConfig,\n    // constraint strategies\n    addConstraintStrategy: router.addConstraintStrategy.bind(router),\n    hasConstraintStrategy: router.hasConstraintStrategy.bind(router)\n  }\n\n  Object.defineProperties(fastify, {\n    listeningOrigin: {\n      get () {\n        const address = this.addresses().slice(-1).pop()\n        /* ignore if windows: unix socket is not testable on Windows platform */\n        /* c8 ignore next 3 */\n        if (typeof address === 'string') {\n          return address\n        }\n        const host = address.family === 'IPv6' ? `[${address.address}]` : address.address\n        return `${this[kOptions].https ? 'https' : 'http'}://${host}:${address.port}`\n      }\n    },\n    pluginName: {\n      configurable: true,\n      get () {\n        if (this[kPluginNameChain].length > 1) {\n          return this[kPluginNameChain].join(' -> ')\n        }\n        return this[kPluginNameChain][0]\n      }\n    },\n    prefix: {\n      configurable: true,\n      get () { return this[kRoutePrefix] }\n    },\n    validatorCompiler: {\n      configurable: true,\n      get () { return this[kSchemaController].getValidatorCompiler() }\n    },\n    serializerCompiler: {\n      configurable: true,\n      get () { return this[kSchemaController].getSerializerCompiler() }\n    },\n    childLoggerFactory: {\n      configurable: true,\n      get () { return this[kChildLoggerFactory] }\n    },\n    version: {\n      configurable: true,\n      get () { return VERSION }\n    },\n    errorHandler: {\n      configurable: true,\n      get () {\n        return this[kErrorHandler].func\n      }\n    },\n    genReqId: {\n      configurable: true,\n      get () { return this[kGenReqId] }\n    },\n    supportedMethods: {\n      configurable: false,\n      get () {\n        return [\n          ...this[kSupportedHTTPMethods].bodyless,\n          ...this[kSupportedHTTPMethods].bodywith\n        ]\n      }\n    }\n  })\n\n  if (options.schemaErrorFormatter) {\n    validateSchemaErrorFormatter(options.schemaErrorFormatter)\n    fastify[kSchemaErrorFormatter] = options.schemaErrorFormatter.bind(fastify)\n  }\n\n  // Install and configure Avvio\n  // Avvio will update the following Fastify methods:\n  // - register\n  // - after\n  // - ready\n  // - onClose\n  // - close\n\n  const avvioPluginTimeout = Number(options.pluginTimeout)\n  const avvio = Avvio(fastify, {\n    autostart: false,\n    timeout: isNaN(avvioPluginTimeout) === false ? avvioPluginTimeout : defaultInitOptions.pluginTimeout,\n    expose: {\n      use: 'register'\n    }\n  })\n  // Override to allow the plugin encapsulation\n  avvio.override = override\n  avvio.on('start', () => (fastify[kState].started = true))\n  fastify[kAvvioBoot] = fastify.ready // the avvio ready function\n  fastify.ready = ready // overwrite the avvio ready function\n  fastify.printPlugins = avvio.prettyPrint.bind(avvio)\n\n  // cache the closing value, since we are checking it in an hot path\n  avvio.once('preReady', () => {\n    fastify.onClose((instance, done) => {\n      fastify[kState].closing = true\n      router.closeRoutes()\n\n      hookRunnerApplication('preClose', fastify[kAvvioBoot], fastify, function () {\n        if (fastify[kState].listening) {\n          /* istanbul ignore next: Cannot test this without Node.js core support */\n          if (forceCloseConnections === 'idle' && options.serverFactory) {\n            instance.server.closeIdleConnections()\n            /* istanbul ignore next: Cannot test this without Node.js core support */\n          } else if (serverHasCloseAllConnections && forceCloseConnections === true) {\n            instance.server.closeAllConnections()\n          } else if (forceCloseConnections === true) {\n            for (const conn of fastify[kKeepAliveConnections]) {\n              // We must invoke the destroy method instead of merely unreffing\n              // the sockets. If we only unref, then the callback passed to\n              // `fastify.close` will never be invoked; nor will any of the\n              // registered `onClose` hooks.\n              conn.destroy()\n              fastify[kKeepAliveConnections].delete(conn)\n            }\n          }\n        }\n\n        if (serverHasCloseHttp2Sessions) {\n          instance.server.closeHttp2Sessions()\n        }\n\n        // No new TCP connections are accepted.\n        // We must call close on the server even if we are not listening\n        // otherwise memory will be leaked.\n        // https://github.com/nodejs/node/issues/48604\n        if (!options.serverFactory || fastify[kState].listening) {\n          instance.server.close(function (err) {\n            /* c8 ignore next 6 */\n            if (err && err.code !== 'ERR_SERVER_NOT_RUNNING') {\n              done(null)\n            } else {\n              done()\n            }\n          })\n        } else {\n          process.nextTick(done, null)\n        }\n      })\n    })\n  })\n\n  // Create route event (bad URL, max param length, etc) context\n  const routeEventContext = new Context({\n    server: fastify,\n    config: {}\n  })\n\n  // Set the default 404 handler\n  fastify.setNotFoundHandler()\n  fourOhFour.arrange404(fastify)\n\n  router.setup(options, {\n    avvio,\n    fourOhFour,\n    hasLogger,\n    setupResponseListeners,\n    throwIfAlreadyStarted,\n    keepAliveConnections\n  })\n\n  // Delay configuring clientError handler so that it can access fastify state.\n  server.on('clientError', options.clientErrorHandler.bind(fastify))\n\n  if (initChannel.hasSubscribers) {\n    initChannel.publish({ fastify })\n  }\n\n  // Older nodejs versions may not have asyncDispose\n  if ('asyncDispose' in Symbol) {\n    fastify[Symbol.asyncDispose] = function dispose () {\n      return fastify.close()\n    }\n  }\n\n  return fastify\n\n  function throwIfAlreadyStarted (msg) {\n    if (fastify[kState].started) throw new FST_ERR_INSTANCE_ALREADY_LISTENING(msg)\n  }\n\n  // HTTP injection handling\n  // If the server is not ready yet, this\n  // utility will automatically force it.\n  function inject (opts, cb) {\n    // lightMyRequest is dynamically loaded as it seems very expensive\n    // because of Ajv\n    if (lightMyRequest === undefined) {\n      lightMyRequest = require('light-my-request')\n    }\n\n    if (fastify[kState].started) {\n      if (fastify[kState].closing) {\n        // Force to return an error\n        const error = new FST_ERR_REOPENED_CLOSE_SERVER()\n        if (cb) {\n          cb(error)\n          return\n        } else {\n          return Promise.reject(error)\n        }\n      }\n      return lightMyRequest(httpHandler, opts, cb)\n    }\n\n    if (cb) {\n      this.ready(err => {\n        if (err) cb(err, null)\n        else lightMyRequest(httpHandler, opts, cb)\n      })\n    } else {\n      return lightMyRequest((req, res) => {\n        this.ready(function (err) {\n          if (err) {\n            res.emit('error', err)\n            return\n          }\n          httpHandler(req, res)\n        })\n      }, opts)\n    }\n  }\n\n  function ready (cb) {\n    if (this[kState].readyResolver !== null) {\n      if (cb != null) {\n        this[kState].readyResolver.promise.then(() => cb(null, fastify), cb)\n        return\n      }\n\n      return this[kState].readyResolver.promise\n    }\n\n    // run the hooks after returning the promise\n    process.nextTick(runHooks)\n\n    // Create a promise no matter what\n    // It will work as a barrier for all the .ready() calls (ensuring single hook execution)\n    // as well as a flow control mechanism to chain cbs and further\n    // promises\n    this[kState].readyResolver = PonyPromise.withResolvers()\n\n    if (!cb) {\n      return this[kState].readyResolver.promise\n    } else {\n      this[kState].readyResolver.promise.then(() => cb(null, fastify), cb)\n    }\n\n    function runHooks () {\n      // start loading\n      fastify[kAvvioBoot]((err, done) => {\n        if (err || fastify[kState].started || fastify[kState].ready || fastify[kState].booting) {\n          manageErr(err)\n        } else {\n          fastify[kState].booting = true\n          hookRunnerApplication('onReady', fastify[kAvvioBoot], fastify, manageErr)\n        }\n        done()\n      })\n    }\n\n    function manageErr (err) {\n      // If the error comes out of Avvio's Error codes\n      // We create a make and preserve the previous error\n      // as cause\n      err = err != null && AVVIO_ERRORS_MAP[err.code] != null\n        ? appendStackTrace(err, new AVVIO_ERRORS_MAP[err.code](err.message))\n        : err\n\n      if (err) {\n        return fastify[kState].readyResolver.reject(err)\n      }\n\n      fastify[kState].readyResolver.resolve(fastify)\n      fastify[kState].booting = false\n      fastify[kState].ready = true\n      fastify[kState].readyResolver = null\n    }\n  }\n\n  // Used exclusively in TypeScript contexts to enable auto type inference from JSON schema.\n  function withTypeProvider () {\n    return this\n  }\n\n  // wrapper that we expose to the user for hooks handling\n  function addHook (name, fn) {\n    throwIfAlreadyStarted('Cannot call \"addHook\"!')\n\n    if (fn == null) {\n      throw new errorCodes.FST_ERR_HOOK_INVALID_HANDLER(name, fn)\n    }\n\n    if (name === 'onSend' || name === 'preSerialization' || name === 'onError' || name === 'preParsing') {\n      if (fn.constructor.name === 'AsyncFunction' && fn.length === 4) {\n        throw new errorCodes.FST_ERR_HOOK_INVALID_ASYNC_HANDLER()\n      }\n    } else if (name === 'onReady' || name === 'onListen') {\n      if (fn.constructor.name === 'AsyncFunction' && fn.length !== 0) {\n        throw new errorCodes.FST_ERR_HOOK_INVALID_ASYNC_HANDLER()\n      }\n    } else if (name === 'onRequestAbort') {\n      if (fn.constructor.name === 'AsyncFunction' && fn.length !== 1) {\n        throw new errorCodes.FST_ERR_HOOK_INVALID_ASYNC_HANDLER()\n      }\n    } else {\n      if (fn.constructor.name === 'AsyncFunction' && fn.length === 3) {\n        throw new errorCodes.FST_ERR_HOOK_INVALID_ASYNC_HANDLER()\n      }\n    }\n\n    if (name === 'onClose') {\n      this.onClose(fn.bind(this))\n    } else if (name === 'onReady' || name === 'onListen' || name === 'onRoute' || name === 'preClose') {\n      this[kHooks].add(name, fn)\n    } else {\n      this.after((err, done) => {\n        try {\n          _addHook.call(this, name, fn)\n          done(err)\n        } catch (err) {\n          done(err)\n        }\n      })\n    }\n    return this\n\n    function _addHook (name, fn) {\n      this[kHooks].add(name, fn)\n      this[kChildren].forEach(child => _addHook.call(child, name, fn))\n    }\n  }\n\n  // wrapper that we expose to the user for schemas handling\n  function addSchema (schema) {\n    throwIfAlreadyStarted('Cannot call \"addSchema\"!')\n    this[kSchemaController].add(schema)\n    this[kChildren].forEach(child => child.addSchema(schema))\n    return this\n  }\n\n  // If the router does not match any route, every request will land here\n  // req and res are Node.js core objects\n  function defaultRoute (req, res) {\n    if (req.headers['accept-version'] !== undefined) {\n      // we remove the accept-version header for performance result\n      // because we do not want to go through the constraint checking\n      // the usage of symbol here to prevent any collision on custom header name\n      req.headers[kRequestAcceptVersion] = req.headers['accept-version']\n      req.headers['accept-version'] = undefined\n    }\n    fourOhFour.router.lookup(req, res)\n  }\n\n  function onBadUrl (path, req, res) {\n    if (options.frameworkErrors) {\n      const id = getGenReqId(routeEventContext.server, req)\n      const childLogger = createChildLogger(routeEventContext, options.logger, req, id)\n\n      const request = new Request(id, null, req, null, childLogger, routeEventContext)\n      const reply = new Reply(res, request, childLogger)\n\n      routeEventContext.server[kLogController].incomingRequest(request, reply)\n\n      return options.frameworkErrors(new FST_ERR_BAD_URL(path), request, reply)\n    }\n    const body = JSON.stringify({\n      error: 'Bad Request',\n      code: 'FST_ERR_BAD_URL',\n      message: `'${path}' is not a valid url component`,\n      statusCode: 400\n    })\n    res.writeHead(400, {\n      'Content-Type': 'application/json',\n      'Content-Length': Buffer.byteLength(body)\n    })\n    res.end(body)\n  }\n\n  function onMaxParamLength (path, req, res) {\n    if (options.frameworkErrors) {\n      const id = getGenReqId(routeEventContext.server, req)\n      const childLogger = createChildLogger(routeEventContext, options.logger, req, id)\n\n      const request = new Request(id, null, req, null, childLogger, routeEventContext)\n      const reply = new Reply(res, request, childLogger)\n\n      routeEventContext.server[kLogController].incomingRequest(request, reply)\n\n      return options.frameworkErrors(new FST_ERR_MAX_PARAM_LENGTH(path), request, reply)\n    }\n    const body = JSON.stringify({\n      error: 'Bad Request',\n      code: 'FST_ERR_MAX_PARAM_LENGTH',\n      message: `'${path}' is exceeding the max param length`,\n      statusCode: 414\n    })\n    res.writeHead(414, {\n      'Content-Type': 'application/json',\n      'Content-Length': Buffer.byteLength(body)\n    })\n    res.end(body)\n  }\n\n  function buildAsyncConstraintCallback (isAsync, req, res) {\n    if (isAsync === false) return undefined\n    return function onAsyncConstraintError (err) {\n      if (err) {\n        if (options.frameworkErrors) {\n          const id = getGenReqId(routeEventContext.server, req)\n          const childLogger = createChildLogger(routeEventContext, options.logger, req, id)\n\n          const request = new Request(id, null, req, null, childLogger, routeEventContext)\n          const reply = new Reply(res, request, childLogger)\n\n          routeEventContext.server[kLogController].incomingRequest(request, reply)\n\n          return options.frameworkErrors(new FST_ERR_ASYNC_CONSTRAINT(), request, reply)\n        }\n        const body = '{\"error\":\"Internal Server Error\",\"message\":\"Unexpected error from async constraint\",\"statusCode\":500}'\n        res.writeHead(500, {\n          'Content-Type': 'application/json',\n          'Content-Length': body.length\n        })\n        res.end(body)\n      }\n    }\n  }\n\n  function setNotFoundHandler (opts, handler) {\n    throwIfAlreadyStarted('Cannot call \"setNotFoundHandler\"!')\n\n    fourOhFour.setNotFoundHandler.call(this, opts, handler, avvio, router.routeHandler)\n    return this\n  }\n\n  function setValidatorCompiler (validatorCompiler) {\n    throwIfAlreadyStarted('Cannot call \"setValidatorCompiler\"!')\n    this[kSchemaController].setValidatorCompiler(validatorCompiler)\n    return this\n  }\n\n  function setSchemaErrorFormatter (errorFormatter) {\n    throwIfAlreadyStarted('Cannot call \"setSchemaErrorFormatter\"!')\n    validateSchemaErrorFormatter(errorFormatter)\n    this[kSchemaErrorFormatter] = errorFormatter.bind(this)\n    return this\n  }\n\n  function setSerializerCompiler (serializerCompiler) {\n    throwIfAlreadyStarted('Cannot call \"setSerializerCompiler\"!')\n    this[kSchemaController].setSerializerCompiler(serializerCompiler)\n    return this\n  }\n\n  function setSchemaController (schemaControllerOpts) {\n    throwIfAlreadyStarted('Cannot call \"setSchemaController\"!')\n    const old = this[kSchemaController]\n    const schemaController = SchemaController.buildSchemaController(\n      old,\n      Object.assign({}, old.opts, schemaControllerOpts)\n    )\n    this[kSchemaController] = schemaController\n    this.getSchema = schemaController.getSchema.bind(schemaController)\n    this.getSchemas = schemaController.getSchemas.bind(schemaController)\n    return this\n  }\n\n  function setReplySerializer (replySerializer) {\n    throwIfAlreadyStarted('Cannot call \"setReplySerializer\"!')\n\n    this[kReplySerializerDefault] = replySerializer\n    return this\n  }\n\n  // wrapper that we expose to the user for configure the custom error handler\n  function setErrorHandler (func) {\n    throwIfAlreadyStarted('Cannot call \"setErrorHandler\"!')\n\n    if (typeof func !== 'function') {\n      throw new FST_ERR_ERROR_HANDLER_NOT_FN()\n    }\n\n    if (!options.allowErrorHandlerOverride && this[kErrorHandlerAlreadySet]) {\n      throw new FST_ERR_ERROR_HANDLER_ALREADY_SET()\n    } else if (this[kErrorHandlerAlreadySet]) {\n      FSTWRN004()\n    }\n\n    this[kErrorHandlerAlreadySet] = true\n    this[kErrorHandler] = buildErrorHandler(this[kErrorHandler], func.bind(this))\n    return this\n  }\n\n  function setChildLoggerFactory (factory) {\n    throwIfAlreadyStarted('Cannot call \"setChildLoggerFactory\"!')\n\n    this[kChildLoggerFactory] = factory\n    return this\n  }\n\n  function printRoutes (opts = {}) {\n    // includeHooks:true - shortcut to include all supported hooks exported by fastify.Hooks\n    opts.includeMeta = opts.includeHooks\n      ? opts.includeMeta ? supportedHooks.concat(opts.includeMeta) : supportedHooks\n      : opts.includeMeta\n    return router.printRoutes(opts)\n  }\n\n  function wrapRouting (router, { rewriteUrl, logger }) {\n    let isAsync\n    return function preRouting (req, res) {\n      // only call isAsyncConstraint once\n      if (isAsync === undefined) isAsync = router.isAsyncConstraint()\n      if (rewriteUrl) {\n        req.originalUrl = req.url\n        const url = rewriteUrl.call(fastify, req)\n        if (typeof url === 'string') {\n          req.url = url\n        } else {\n          const err = new FST_ERR_ROUTE_REWRITE_NOT_STR(req.url, typeof url)\n          req.destroy(err)\n        }\n      }\n      router.routing(req, res, buildAsyncConstraintCallback(isAsync, req, res))\n    }\n  }\n\n  function setGenReqId (func) {\n    throwIfAlreadyStarted('Cannot call \"setGenReqId\"!')\n\n    this[kGenReqId] = reqIdGenFactory(this[kOptions].requestIdHeader, func)\n    return this\n  }\n\n  function addHttpMethod (method, { hasBody = false, overrideExisting = false } = {}) {\n    if (typeof method !== 'string' || http.METHODS.indexOf(method) === -1) {\n      throw new FST_ERR_ROUTE_METHOD_INVALID()\n    }\n\n    const alreadyExists = this[kSupportedHTTPMethods].bodyless.has(method) ||\n      this[kSupportedHTTPMethods].bodywith.has(method)\n\n    if (alreadyExists && !overrideExisting) {\n      FSTDEP025(method)\n    }\n\n    if (hasBody === true) {\n      this[kSupportedHTTPMethods].bodywith.add(method)\n      this[kSupportedHTTPMethods].bodyless.delete(method)\n    } else {\n      this[kSupportedHTTPMethods].bodywith.delete(method)\n      this[kSupportedHTTPMethods].bodyless.add(method)\n    }\n\n    const _method = method.toLowerCase()\n    if (!this.hasDecorator(_method)) {\n      this.decorate(_method, function (url, options, handler) {\n        return router.prepareRoute.call(this, { method, url, options, handler })\n      })\n    }\n\n    return this\n  }\n}\n\nfunction processOptions (options, defaultRoute, onBadUrl, onMaxParamLength) {\n  // Options validations\n  if (options && typeof options !== 'object') {\n    throw new FST_ERR_OPTIONS_NOT_OBJ()\n  } else {\n    // Shallow copy options object to prevent mutations outside of this function\n    options = Object.assign({}, options)\n  }\n\n  if (\n    (options.querystringParser && typeof options.querystringParser !== 'function') ||\n    (\n      options.routerOptions?.querystringParser &&\n      typeof options.routerOptions.querystringParser !== 'function'\n    )\n  ) {\n    throw new FST_ERR_QSP_NOT_FN(typeof (options.querystringParser ?? options.routerOptions.querystringParser))\n  }\n\n  if (options.schemaController && options.schemaController.bucket && typeof options.schemaController.bucket !== 'function') {\n    throw new FST_ERR_SCHEMA_CONTROLLER_BUCKET_OPT_NOT_FN(typeof options.schemaController.bucket)\n  }\n\n  validateBodyLimitOption(options.bodyLimit)\n\n  const requestIdHeader = typeof options.requestIdHeader === 'string' && options.requestIdHeader.length !== 0 ? options.requestIdHeader.toLowerCase() : (options.requestIdHeader === true && 'request-id')\n  const genReqId = reqIdGenFactory(requestIdHeader, options.genReqId)\n  if (options.requestIdLogLabel !== undefined) {\n    FSTDEP024()\n  }\n  options.bodyLimit = options.bodyLimit || defaultInitOptions.bodyLimit\n  if (options.disableRequestLogging !== undefined) {\n    FSTDEP023()\n  }\n\n  const ajvOptions = Object.assign({\n    customOptions: {},\n    plugins: []\n  }, options.ajv)\n\n  if (!ajvOptions.customOptions || Object.prototype.toString.call(ajvOptions.customOptions) !== '[object Object]') {\n    throw new FST_ERR_AJV_CUSTOM_OPTIONS_OPT_NOT_OBJ(typeof ajvOptions.customOptions)\n  }\n  if (!ajvOptions.plugins || !Array.isArray(ajvOptions.plugins)) {\n    throw new FST_ERR_AJV_CUSTOM_OPTIONS_OPT_NOT_ARR(typeof ajvOptions.plugins)\n  }\n\n  const { logger, hasLogger } = createLogger(options)\n\n  // the internal logger uses the input logger to execute the logging. This allows the user\n  // to customize every internal log line\n  const logController = createLogController(options)\n\n  // Update the options with the fixed values\n  options.connectionTimeout = options.connectionTimeout || defaultInitOptions.connectionTimeout\n  options.keepAliveTimeout = options.keepAliveTimeout || defaultInitOptions.keepAliveTimeout\n  options.maxRequestsPerSocket = options.maxRequestsPerSocket || defaultInitOptions.maxRequestsPerSocket\n  options.requestTimeout = options.requestTimeout || defaultInitOptions.requestTimeout\n  options.logger = logger\n  options.requestIdHeader = requestIdHeader\n  options.ajv = ajvOptions\n  options.clientErrorHandler = options.clientErrorHandler || defaultClientErrorHandler\n  options.allowErrorHandlerOverride = options.allowErrorHandlerOverride ?? defaultInitOptions.allowErrorHandlerOverride\n\n  const initialConfig = getSecuredInitialConfig(options)\n\n  // exposeHeadRoutes have its default set from the validator\n  options.exposeHeadRoutes = initialConfig.exposeHeadRoutes\n\n  // we need to set this before calling createServer\n  options.http2SessionTimeout = initialConfig.http2SessionTimeout\n\n  options.routerOptions = buildRouterOptions(options, {\n    defaultRoute,\n    onBadUrl,\n    onMaxParamLength,\n    ignoreTrailingSlash: defaultInitOptions.ignoreTrailingSlash,\n    ignoreDuplicateSlashes: defaultInitOptions.ignoreDuplicateSlashes,\n    maxParamLength: defaultInitOptions.maxParamLength,\n    allowUnsafeRegex: defaultInitOptions.allowUnsafeRegex,\n    buildPrettyMeta: defaultBuildPrettyMeta,\n    useSemicolonDelimiter: defaultInitOptions.useSemicolonDelimiter\n  })\n\n  return {\n    options,\n    genReqId,\n    logController,\n    hasLogger,\n    initialConfig\n  }\n}\n\nfunction defaultBuildPrettyMeta (route) {\n  // return a shallow copy of route's sanitized context\n\n  const cleanKeys = {}\n  const allowedProps = ['errorHandler', 'logLevel', 'logSerializers']\n\n  allowedProps.concat(supportedHooks).forEach(k => {\n    cleanKeys[k] = route.store[k]\n  })\n\n  return Object.assign({}, cleanKeys)\n}\n\nfunction defaultClientErrorHandler (err, socket) {\n  // In case of a connection reset, the socket has been destroyed and there is nothing that needs to be done.\n  // https://nodejs.org/api/http.html#event-clienterror\n  if (err.code === 'ECONNRESET' || socket.destroyed) {\n    return\n  }\n\n  let body, errorCode, errorStatus, errorLabel\n\n  if (err.code === 'ERR_HTTP_REQUEST_TIMEOUT') {\n    errorCode = '408'\n    errorStatus = http.STATUS_CODES[errorCode]\n    body = `{\"error\":\"${errorStatus}\",\"message\":\"Client Timeout\",\"statusCode\":408}`\n    errorLabel = 'timeout'\n  } else if (err.code === 'HPE_HEADER_OVERFLOW') {\n    errorCode = '431'\n    errorStatus = http.STATUS_CODES[errorCode]\n    body = `{\"error\":\"${errorStatus}\",\"message\":\"Exceeded maximum allowed HTTP header size\",\"statusCode\":431}`\n    errorLabel = 'header_overflow'\n  } else {\n    errorCode = '400'\n    errorStatus = http.STATUS_CODES[errorCode]\n    body = `{\"error\":\"${errorStatus}\",\"message\":\"Client Error\",\"statusCode\":400}`\n    errorLabel = 'error'\n  }\n\n  // Most devs do not know what to do with this error.\n  // In the vast majority of cases, it's a network error and/or some\n  // config issue on the load balancer side.\n  this.log.trace({ err }, `client ${errorLabel}`)\n  // Copying standard node behavior\n  // https://github.com/nodejs/node/blob/6ca23d7846cb47e84fd344543e394e50938540be/lib/_http_server.js#L666\n\n  // If the socket is not writable, there is no reason to try to send data.\n  if (socket.writable) {\n    socket.write(`HTTP/1.1 ${errorCode} ${errorStatus}\\r\\nContent-Length: ${body.length}\\r\\nContent-Type: application/json\\r\\n\\r\\n${body}`)\n  }\n  socket.destroy(err)\n}\n\nfunction validateSchemaErrorFormatter (schemaErrorFormatter) {\n  if (typeof schemaErrorFormatter !== 'function') {\n    throw new FST_ERR_SCHEMA_ERROR_FORMATTER_NOT_FN(typeof schemaErrorFormatter)\n  } else if (schemaErrorFormatter.constructor.name === 'AsyncFunction') {\n    throw new FST_ERR_SCHEMA_ERROR_FORMATTER_NOT_FN('AsyncFunction')\n  }\n}\n\n/**\n * These export configurations enable JS and TS developers\n * to consume fastify in whatever way best suits their needs.\n * Some examples of supported import syntax includes:\n * - `const fastify = require('fastify')`\n * - `const { fastify } = require('fastify')`\n * - `import * as Fastify from 'fastify'`\n * - `import { fastify, TSC_definition } from 'fastify'`\n * - `import fastify from 'fastify'`\n * - `import fastify, { TSC_definition } from 'fastify'`\n */\nmodule.exports = fastify\nmodule.exports.errorCodes = errorCodes\nmodule.exports.LogController = LogController\nmodule.exports.fastify = fastify\nmodule.exports.default = fastify\n"]}