Comparing version 4.0.0-rc.4 to 4.0.0-rc.5
@@ -27,3 +27,3 @@ 'use strict' | ||
keepAliveTimeout: 72000, // 72 seconds | ||
forceCloseConnections: false, // keep-alive connections | ||
forceCloseConnections: undefined, // keep-alive connections | ||
maxRequestsPerSocket: 0, // no limit | ||
@@ -54,3 +54,13 @@ requestTimeout: 0, // no limit | ||
keepAliveTimeout: { type: 'integer', default: defaultInitOptions.keepAliveTimeout }, | ||
forceCloseConnections: { type: 'boolean', default: defaultInitOptions.forceCloseConnections }, | ||
forceCloseConnections: { | ||
oneOf: [ | ||
{ | ||
type: 'string', | ||
pattern: 'idle' | ||
}, | ||
{ | ||
type: 'boolean' | ||
} | ||
] | ||
}, | ||
maxRequestsPerSocket: { type: 'integer', default: defaultInitOptions.maxRequestsPerSocket, nullable: true }, | ||
@@ -57,0 +67,0 @@ requestTimeout: { type: 'integer', default: defaultInitOptions.requestTimeout }, |
@@ -13,3 +13,3 @@ <h1 align="center">Fastify</h1> | ||
the project's code style. | ||
+ [`Delay Accepting Requests`](./Delay-Accepting-Requests.md): A practical guide | ||
+ [Delay Accepting Requests](./Delay-Accepting-Requests.md): A practical guide | ||
on how to delay serving requests to specific routes until some condition is | ||
@@ -16,0 +16,0 @@ met in your application. This guide focuses on solving the problem using |
@@ -63,2 +63,3 @@ <h1 align="center">Fastify</h1> | ||
- [pluginName](#pluginname) | ||
- [hasPlugin](#hasplugin) | ||
- [log](#log) | ||
@@ -139,12 +140,15 @@ - [version](#version) | ||
When set to `true` requests with the header `connection: keep-alive` will be | ||
tracked by the server. Upon [`close`](#close), the server will iterate the | ||
current persistent connections and [destroy their | ||
sockets](https://nodejs.org/dist/latest-v16.x/docs/api/net.html#socketdestroyerror). | ||
This means the server will shutdown immediately instead of waiting for existing | ||
persistent connections to timeout first. Important: connections are not | ||
inspected to determine if requests have been completed. | ||
When set to `true`, upon [`close`](#close) the server will iterate the | ||
current persistent connections and [destroy their sockets](https://nodejs.org/dist/latest-v16.x/docs/api/net.html#socketdestroyerror). | ||
+ Default: `false` | ||
> Important: connections are not inspected to determine if requests have been completed. | ||
Fastify will prefer the HTTP server's [`closeAllConnections`](https://nodejs.org/dist/latest-v18.x/docs/api/http.html#servercloseallconnections) method if supported, otherwise it will use internal connection tracking. | ||
When set to `"idle"`, upon [`close`](#close) the server will iterate the | ||
current persistent connections which are not sending a request or waiting for a response and destroy their sockets. | ||
The value is supported only if the HTTP server supports the [`closeIdleConnections`](https://nodejs.org/dist/latest-v18.x/docs/api/http.html#servercloseidleconnections) method, otherwise attempting to set it will throw an exception. | ||
+ Default: `"idle"` if the HTTP server allows it, `false` otherwise | ||
### `maxRequestsPerSocket` | ||
@@ -1110,2 +1114,22 @@ <a id="factory-max-requests-per-socket"></a> | ||
#### hasPlugin | ||
<a id="hasPlugin"></a> | ||
Method to check if a specific plugin has been registered. | ||
Relies on the plugin metadata name. | ||
Returns `true` if the plugin is registered. | ||
Otherwise, returns `false`. | ||
```js | ||
const fastify = require('fastify')() | ||
fastify.register(require('@fastify/cookie'), { | ||
secret: 'my-secret', | ||
parseOptions: {} | ||
}) | ||
fastify.ready(() => { | ||
fastify.hasPlugin('@fastify/cookie') // true | ||
}) | ||
``` | ||
#### log | ||
@@ -1112,0 +1136,0 @@ <a id="log"></a> |
@@ -59,3 +59,3 @@ <h1 align="center">Fastify</h1> | ||
or use one of the [recommended | ||
ones](https://github.com/tsconfig/bases#node-10-tsconfigjson). | ||
ones](https://github.com/tsconfig/bases#node-14-tsconfigjson). | ||
@@ -62,0 +62,0 @@ *Note: Set `target` property in `tsconfig.json` to `es2017` or greater to avoid |
@@ -113,3 +113,3 @@ import * as http from 'http' | ||
maxRequestsPerSocket?: number, | ||
forceCloseConnections?: boolean, | ||
forceCloseConnections?: boolean | 'idle', | ||
requestTimeout?: number, | ||
@@ -116,0 +116,0 @@ pluginTimeout?: number, |
'use strict' | ||
const VERSION = '4.0.0-rc.4' | ||
const VERSION = '4.0.0-rc.5' | ||
@@ -55,2 +55,3 @@ const Avvio = require('avvio') | ||
FST_ERR_BAD_URL, | ||
FST_ERR_FORCE_CLOSE_CONNECTIONS_IDLE_NOT_AVAILABLE, | ||
AVVIO_ERRORS_MAP, | ||
@@ -127,3 +128,2 @@ appendStackTrace | ||
options.keepAliveTimeout = options.keepAliveTimeout || defaultInitOptions.keepAliveTimeout | ||
options.forceCloseConnections = typeof options.forceCloseConnections === 'boolean' ? options.forceCloseConnections : defaultInitOptions.forceCloseConnections | ||
options.maxRequestsPerSocket = options.maxRequestsPerSocket || defaultInitOptions.maxRequestsPerSocket | ||
@@ -140,3 +140,2 @@ options.requestTimeout = options.requestTimeout || defaultInitOptions.requestTimeout | ||
const initialConfig = getSecuredInitialConfig(options) | ||
const keepAliveConnections = options.forceCloseConnections === true ? new Set() : noopSet() | ||
@@ -178,4 +177,3 @@ // exposeHeadRoutes have its default set from the validator | ||
querystringParser: options.querystringParser | ||
}, | ||
keepAliveConnections | ||
} | ||
}) | ||
@@ -193,2 +191,15 @@ | ||
const serverHasCloseAllConnections = typeof server.closeAllConnections === 'function' | ||
const serverHasCloseIdleConnections = typeof server.closeIdleConnections === 'function' | ||
let forceCloseConnections = options.forceCloseConnections | ||
if (forceCloseConnections === 'idle' && !serverHasCloseIdleConnections) { | ||
throw new FST_ERR_FORCE_CLOSE_CONNECTIONS_IDLE_NOT_AVAILABLE() | ||
} else if (typeof forceCloseConnections !== 'boolean') { | ||
/* istanbul ignore next: only one branch can be valid in a given Node.js version */ | ||
forceCloseConnections = serverHasCloseIdleConnections ? 'idle' : false | ||
} | ||
const keepAliveConnections = !serverHasCloseAllConnections && forceCloseConnections === true ? new Set() : noopSet() | ||
const setupResponseListeners = Reply.setupResponseListeners | ||
@@ -293,2 +304,5 @@ const schemaController = SchemaController.buildSchemaController(null, options.schemaController) | ||
printPlugins: null, | ||
hasPlugin: function (name) { | ||
return this[kPluginNameChain].includes(name) | ||
}, | ||
// http server | ||
@@ -395,9 +409,17 @@ listen, | ||
for (const conn of fastify[kKeepAliveConnections]) { | ||
// We must invoke the destroy method instead of merely unreffing | ||
// the sockets. If we only unref, then the callback passed to | ||
// `fastify.close` will never be invoked; nor will any of the | ||
// registered `onClose` hooks. | ||
conn.destroy() | ||
fastify[kKeepAliveConnections].delete(conn) | ||
/* istanbul ignore next: Cannot test this without Node.js core support */ | ||
if (forceCloseConnections === 'idle') { | ||
instance.server.closeIdleConnections() | ||
/* istanbul ignore next: Cannot test this without Node.js core support */ | ||
} else if (serverHasCloseAllConnections && forceCloseConnections) { | ||
instance.server.closeAllConnections() | ||
} else { | ||
for (const conn of fastify[kKeepAliveConnections]) { | ||
// We must invoke the destroy method instead of merely unreffing | ||
// the sockets. If we only unref, then the callback passed to | ||
// `fastify.close` will never be invoked; nor will any of the | ||
// registered `onClose` hooks. | ||
conn.destroy() | ||
fastify[kKeepAliveConnections].delete(conn) | ||
} | ||
} | ||
@@ -421,3 +443,4 @@ } else { | ||
throwIfAlreadyStarted, | ||
validateHTTPVersion: compileValidateHTTPVersion(options) | ||
validateHTTPVersion: compileValidateHTTPVersion(options), | ||
keepAliveConnections | ||
}) | ||
@@ -424,0 +447,0 @@ |
@@ -6,4 +6,5 @@ // This file is autogenerated by build/build-validation.js, do not edit | ||
module.exports.default = validate10; | ||
const schema11 = {"type":"object","additionalProperties":false,"properties":{"connectionTimeout":{"type":"integer","default":0},"keepAliveTimeout":{"type":"integer","default":72000},"forceCloseConnections":{"type":"boolean","default":false},"maxRequestsPerSocket":{"type":"integer","default":0,"nullable":true},"requestTimeout":{"type":"integer","default":0},"bodyLimit":{"type":"integer","default":1048576},"caseSensitive":{"type":"boolean","default":true},"allowUnsafeRegex":{"type":"boolean","default":false},"http2":{"type":"boolean"},"https":{"if":{"not":{"oneOf":[{"type":"boolean"},{"type":"null"},{"type":"object","additionalProperties":false,"required":["allowHTTP1"],"properties":{"allowHTTP1":{"type":"boolean"}}}]}},"then":{"setDefaultValue":true}},"ignoreTrailingSlash":{"type":"boolean","default":false},"ignoreDuplicateSlashes":{"type":"boolean","default":false},"disableRequestLogging":{"type":"boolean","default":false},"jsonShorthand":{"type":"boolean","default":true},"maxParamLength":{"type":"integer","default":100},"onProtoPoisoning":{"type":"string","default":"error"},"onConstructorPoisoning":{"type":"string","default":"error"},"pluginTimeout":{"type":"integer","default":10000},"requestIdHeader":{"type":"string","default":"request-id"},"requestIdLogLabel":{"type":"string","default":"reqId"},"http2SessionTimeout":{"type":"integer","default":72000},"exposeHeadRoutes":{"type":"boolean","default":true},"versioning":{"type":"object","additionalProperties":true,"required":["storage","deriveVersion"],"properties":{"storage":{},"deriveVersion":{}}},"constraints":{"type":"object","additionalProperties":{"type":"object","required":["name","storage","validate","deriveConstraint"],"additionalProperties":true,"properties":{"name":{"type":"string"},"storage":{},"validate":{},"deriveConstraint":{}}}}}}; | ||
const schema11 = {"type":"object","additionalProperties":false,"properties":{"connectionTimeout":{"type":"integer","default":0},"keepAliveTimeout":{"type":"integer","default":72000},"forceCloseConnections":{"oneOf":[{"type":"string","pattern":"idle"},{"type":"boolean"}]},"maxRequestsPerSocket":{"type":"integer","default":0,"nullable":true},"requestTimeout":{"type":"integer","default":0},"bodyLimit":{"type":"integer","default":1048576},"caseSensitive":{"type":"boolean","default":true},"allowUnsafeRegex":{"type":"boolean","default":false},"http2":{"type":"boolean"},"https":{"if":{"not":{"oneOf":[{"type":"boolean"},{"type":"null"},{"type":"object","additionalProperties":false,"required":["allowHTTP1"],"properties":{"allowHTTP1":{"type":"boolean"}}}]}},"then":{"setDefaultValue":true}},"ignoreTrailingSlash":{"type":"boolean","default":false},"ignoreDuplicateSlashes":{"type":"boolean","default":false},"disableRequestLogging":{"type":"boolean","default":false},"jsonShorthand":{"type":"boolean","default":true},"maxParamLength":{"type":"integer","default":100},"onProtoPoisoning":{"type":"string","default":"error"},"onConstructorPoisoning":{"type":"string","default":"error"},"pluginTimeout":{"type":"integer","default":10000},"requestIdHeader":{"type":"string","default":"request-id"},"requestIdLogLabel":{"type":"string","default":"reqId"},"http2SessionTimeout":{"type":"integer","default":72000},"exposeHeadRoutes":{"type":"boolean","default":true},"versioning":{"type":"object","additionalProperties":true,"required":["storage","deriveVersion"],"properties":{"storage":{},"deriveVersion":{}}},"constraints":{"type":"object","additionalProperties":{"type":"object","required":["name","storage","validate","deriveConstraint"],"additionalProperties":true,"properties":{"name":{"type":"string"},"storage":{},"validate":{},"deriveConstraint":{}}}}}}; | ||
const func2 = Object.prototype.hasOwnProperty; | ||
const pattern0 = new RegExp("idle", "u"); | ||
@@ -21,5 +22,2 @@ function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){ | ||
} | ||
if(data.forceCloseConnections === undefined){ | ||
data.forceCloseConnections = false; | ||
} | ||
if(data.maxRequestsPerSocket === undefined){ | ||
@@ -131,18 +129,30 @@ data.maxRequestsPerSocket = 0; | ||
if(valid0){ | ||
if(data.forceCloseConnections !== undefined){ | ||
let data2 = data.forceCloseConnections; | ||
const _errs6 = errors; | ||
if(typeof data2 !== "boolean"){ | ||
const _errs7 = errors; | ||
let valid1 = false; | ||
let passing0 = null; | ||
const _errs8 = errors; | ||
if(typeof data2 !== "string"){ | ||
let dataType2 = typeof data2; | ||
let coerced2 = undefined; | ||
if(!(coerced2 !== undefined)){ | ||
if(data2 === "false" || data2 === 0 || data2 === null){ | ||
coerced2 = false; | ||
if(dataType2 == "number" || dataType2 == "boolean"){ | ||
coerced2 = "" + data2; | ||
} | ||
else if(data2 === "true" || data2 === 1){ | ||
coerced2 = true; | ||
else if(data2 === null){ | ||
coerced2 = ""; | ||
} | ||
else { | ||
validate10.errors = [{instancePath:instancePath+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}]; | ||
return false; | ||
const err0 = {instancePath:instancePath+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"}; | ||
if(vErrors === null){ | ||
vErrors = [err0]; | ||
} | ||
else { | ||
vErrors.push(err0); | ||
} | ||
errors++; | ||
} | ||
} | ||
if(coerced2 !== undefined){ | ||
@@ -155,16 +165,101 @@ data2 = coerced2; | ||
} | ||
if(errors === _errs8){ | ||
if(typeof data2 === "string"){ | ||
if(!pattern0.test(data2)){ | ||
const err1 = {instancePath:instancePath+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf/0/pattern",keyword:"pattern",params:{pattern: "idle"},message:"must match pattern \""+"idle"+"\""}; | ||
if(vErrors === null){ | ||
vErrors = [err1]; | ||
} | ||
else { | ||
vErrors.push(err1); | ||
} | ||
errors++; | ||
} | ||
} | ||
} | ||
var _valid0 = _errs8 === errors; | ||
if(_valid0){ | ||
valid1 = true; | ||
passing0 = 0; | ||
} | ||
const _errs10 = errors; | ||
if(typeof data2 !== "boolean"){ | ||
let coerced3 = undefined; | ||
if(!(coerced3 !== undefined)){ | ||
if(data2 === "false" || data2 === 0 || data2 === null){ | ||
coerced3 = false; | ||
} | ||
else if(data2 === "true" || data2 === 1){ | ||
coerced3 = true; | ||
} | ||
else { | ||
const err2 = {instancePath:instancePath+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf/1/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}; | ||
if(vErrors === null){ | ||
vErrors = [err2]; | ||
} | ||
else { | ||
vErrors.push(err2); | ||
} | ||
errors++; | ||
} | ||
} | ||
if(coerced3 !== undefined){ | ||
data2 = coerced3; | ||
if(data !== undefined){ | ||
data["forceCloseConnections"] = coerced3; | ||
} | ||
} | ||
} | ||
var _valid0 = _errs10 === errors; | ||
if(_valid0 && valid1){ | ||
valid1 = false; | ||
passing0 = [passing0, 1]; | ||
} | ||
else { | ||
if(_valid0){ | ||
valid1 = true; | ||
passing0 = 1; | ||
} | ||
} | ||
if(!valid1){ | ||
const err3 = {instancePath:instancePath+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"}; | ||
if(vErrors === null){ | ||
vErrors = [err3]; | ||
} | ||
else { | ||
vErrors.push(err3); | ||
} | ||
errors++; | ||
validate10.errors = vErrors; | ||
return false; | ||
} | ||
else { | ||
errors = _errs7; | ||
if(vErrors !== null){ | ||
if(_errs7){ | ||
vErrors.length = _errs7; | ||
} | ||
else { | ||
vErrors = null; | ||
} | ||
} | ||
} | ||
var valid0 = _errs6 === errors; | ||
} | ||
else { | ||
var valid0 = true; | ||
} | ||
if(valid0){ | ||
let data3 = data.maxRequestsPerSocket; | ||
const _errs8 = errors; | ||
const _errs12 = errors; | ||
if((!(((typeof data3 == "number") && (!(data3 % 1) && !isNaN(data3))) && (isFinite(data3)))) && (data3 !== null)){ | ||
let dataType3 = typeof data3; | ||
let coerced3 = undefined; | ||
if(!(coerced3 !== undefined)){ | ||
if(dataType3 === "boolean" || data3 === null | ||
|| (dataType3 === "string" && data3 && data3 == +data3 && !(data3 % 1))){ | ||
coerced3 = +data3; | ||
let dataType4 = typeof data3; | ||
let coerced4 = undefined; | ||
if(!(coerced4 !== undefined)){ | ||
if(dataType4 === "boolean" || data3 === null | ||
|| (dataType4 === "string" && data3 && data3 == +data3 && !(data3 % 1))){ | ||
coerced4 = +data3; | ||
} | ||
else if(data3 === "" || data3 === 0 || data3 === false){ | ||
coerced3 = null; | ||
coerced4 = null; | ||
} | ||
@@ -176,20 +271,20 @@ else { | ||
} | ||
if(coerced3 !== undefined){ | ||
data3 = coerced3; | ||
if(coerced4 !== undefined){ | ||
data3 = coerced4; | ||
if(data !== undefined){ | ||
data["maxRequestsPerSocket"] = coerced3; | ||
data["maxRequestsPerSocket"] = coerced4; | ||
} | ||
} | ||
} | ||
var valid0 = _errs8 === errors; | ||
var valid0 = _errs12 === errors; | ||
if(valid0){ | ||
let data4 = data.requestTimeout; | ||
const _errs11 = errors; | ||
const _errs15 = errors; | ||
if(!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))){ | ||
let dataType4 = typeof data4; | ||
let coerced4 = undefined; | ||
if(!(coerced4 !== undefined)){ | ||
if(dataType4 === "boolean" || data4 === null | ||
|| (dataType4 === "string" && data4 && data4 == +data4 && !(data4 % 1))){ | ||
coerced4 = +data4; | ||
let dataType5 = typeof data4; | ||
let coerced5 = undefined; | ||
if(!(coerced5 !== undefined)){ | ||
if(dataType5 === "boolean" || data4 === null | ||
|| (dataType5 === "string" && data4 && data4 == +data4 && !(data4 % 1))){ | ||
coerced5 = +data4; | ||
} | ||
@@ -201,20 +296,20 @@ else { | ||
} | ||
if(coerced4 !== undefined){ | ||
data4 = coerced4; | ||
if(coerced5 !== undefined){ | ||
data4 = coerced5; | ||
if(data !== undefined){ | ||
data["requestTimeout"] = coerced4; | ||
data["requestTimeout"] = coerced5; | ||
} | ||
} | ||
} | ||
var valid0 = _errs11 === errors; | ||
var valid0 = _errs15 === errors; | ||
if(valid0){ | ||
let data5 = data.bodyLimit; | ||
const _errs13 = errors; | ||
const _errs17 = errors; | ||
if(!(((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5))) && (isFinite(data5)))){ | ||
let dataType5 = typeof data5; | ||
let coerced5 = undefined; | ||
if(!(coerced5 !== undefined)){ | ||
if(dataType5 === "boolean" || data5 === null | ||
|| (dataType5 === "string" && data5 && data5 == +data5 && !(data5 % 1))){ | ||
coerced5 = +data5; | ||
let dataType6 = typeof data5; | ||
let coerced6 = undefined; | ||
if(!(coerced6 !== undefined)){ | ||
if(dataType6 === "boolean" || data5 === null | ||
|| (dataType6 === "string" && data5 && data5 == +data5 && !(data5 % 1))){ | ||
coerced6 = +data5; | ||
} | ||
@@ -226,21 +321,21 @@ else { | ||
} | ||
if(coerced5 !== undefined){ | ||
data5 = coerced5; | ||
if(coerced6 !== undefined){ | ||
data5 = coerced6; | ||
if(data !== undefined){ | ||
data["bodyLimit"] = coerced5; | ||
data["bodyLimit"] = coerced6; | ||
} | ||
} | ||
} | ||
var valid0 = _errs13 === errors; | ||
var valid0 = _errs17 === errors; | ||
if(valid0){ | ||
let data6 = data.caseSensitive; | ||
const _errs15 = errors; | ||
const _errs19 = errors; | ||
if(typeof data6 !== "boolean"){ | ||
let coerced6 = undefined; | ||
if(!(coerced6 !== undefined)){ | ||
let coerced7 = undefined; | ||
if(!(coerced7 !== undefined)){ | ||
if(data6 === "false" || data6 === 0 || data6 === null){ | ||
coerced6 = false; | ||
coerced7 = false; | ||
} | ||
else if(data6 === "true" || data6 === 1){ | ||
coerced6 = true; | ||
coerced7 = true; | ||
} | ||
@@ -252,21 +347,21 @@ else { | ||
} | ||
if(coerced6 !== undefined){ | ||
data6 = coerced6; | ||
if(coerced7 !== undefined){ | ||
data6 = coerced7; | ||
if(data !== undefined){ | ||
data["caseSensitive"] = coerced6; | ||
data["caseSensitive"] = coerced7; | ||
} | ||
} | ||
} | ||
var valid0 = _errs15 === errors; | ||
var valid0 = _errs19 === errors; | ||
if(valid0){ | ||
let data7 = data.allowUnsafeRegex; | ||
const _errs17 = errors; | ||
const _errs21 = errors; | ||
if(typeof data7 !== "boolean"){ | ||
let coerced7 = undefined; | ||
if(!(coerced7 !== undefined)){ | ||
let coerced8 = undefined; | ||
if(!(coerced8 !== undefined)){ | ||
if(data7 === "false" || data7 === 0 || data7 === null){ | ||
coerced7 = false; | ||
coerced8 = false; | ||
} | ||
else if(data7 === "true" || data7 === 1){ | ||
coerced7 = true; | ||
coerced8 = true; | ||
} | ||
@@ -278,22 +373,22 @@ else { | ||
} | ||
if(coerced7 !== undefined){ | ||
data7 = coerced7; | ||
if(coerced8 !== undefined){ | ||
data7 = coerced8; | ||
if(data !== undefined){ | ||
data["allowUnsafeRegex"] = coerced7; | ||
data["allowUnsafeRegex"] = coerced8; | ||
} | ||
} | ||
} | ||
var valid0 = _errs17 === errors; | ||
var valid0 = _errs21 === errors; | ||
if(valid0){ | ||
if(data.http2 !== undefined){ | ||
let data8 = data.http2; | ||
const _errs19 = errors; | ||
const _errs23 = errors; | ||
if(typeof data8 !== "boolean"){ | ||
let coerced8 = undefined; | ||
if(!(coerced8 !== undefined)){ | ||
let coerced9 = undefined; | ||
if(!(coerced9 !== undefined)){ | ||
if(data8 === "false" || data8 === 0 || data8 === null){ | ||
coerced8 = false; | ||
coerced9 = false; | ||
} | ||
else if(data8 === "true" || data8 === 1){ | ||
coerced8 = true; | ||
coerced9 = true; | ||
} | ||
@@ -305,10 +400,10 @@ else { | ||
} | ||
if(coerced8 !== undefined){ | ||
data8 = coerced8; | ||
if(coerced9 !== undefined){ | ||
data8 = coerced9; | ||
if(data !== undefined){ | ||
data["http2"] = coerced8; | ||
data["http2"] = coerced9; | ||
} | ||
} | ||
} | ||
var valid0 = _errs19 === errors; | ||
var valid0 = _errs23 === errors; | ||
} | ||
@@ -321,28 +416,28 @@ else { | ||
let data9 = data.https; | ||
const _errs21 = errors; | ||
const _errs22 = errors; | ||
let valid1 = true; | ||
const _errs23 = errors; | ||
const _errs24 = errors; | ||
const _errs25 = errors; | ||
const _errs26 = errors; | ||
let valid3 = false; | ||
let passing0 = null; | ||
let valid2 = true; | ||
const _errs27 = errors; | ||
const _errs28 = errors; | ||
const _errs29 = errors; | ||
const _errs30 = errors; | ||
let valid4 = false; | ||
let passing1 = null; | ||
const _errs31 = errors; | ||
if(typeof data9 !== "boolean"){ | ||
let coerced9 = undefined; | ||
if(!(coerced9 !== undefined)){ | ||
let coerced10 = undefined; | ||
if(!(coerced10 !== undefined)){ | ||
if(data9 === "false" || data9 === 0 || data9 === null){ | ||
coerced9 = false; | ||
coerced10 = false; | ||
} | ||
else if(data9 === "true" || data9 === 1){ | ||
coerced9 = true; | ||
coerced10 = true; | ||
} | ||
else { | ||
const err0 = {}; | ||
const err4 = {}; | ||
if(vErrors === null){ | ||
vErrors = [err0]; | ||
vErrors = [err4]; | ||
} | ||
else { | ||
vErrors.push(err0); | ||
vErrors.push(err4); | ||
} | ||
@@ -352,28 +447,28 @@ errors++; | ||
} | ||
if(coerced9 !== undefined){ | ||
data9 = coerced9; | ||
if(coerced10 !== undefined){ | ||
data9 = coerced10; | ||
if(data !== undefined){ | ||
data["https"] = coerced9; | ||
data["https"] = coerced10; | ||
} | ||
} | ||
} | ||
var _valid1 = _errs27 === errors; | ||
if(_valid1){ | ||
valid3 = true; | ||
passing0 = 0; | ||
var _valid2 = _errs31 === errors; | ||
if(_valid2){ | ||
valid4 = true; | ||
passing1 = 0; | ||
} | ||
const _errs29 = errors; | ||
const _errs33 = errors; | ||
if(data9 !== null){ | ||
let coerced10 = undefined; | ||
if(!(coerced10 !== undefined)){ | ||
let coerced11 = undefined; | ||
if(!(coerced11 !== undefined)){ | ||
if(data9 === "" || data9 === 0 || data9 === false){ | ||
coerced10 = null; | ||
coerced11 = null; | ||
} | ||
else { | ||
const err1 = {}; | ||
const err5 = {}; | ||
if(vErrors === null){ | ||
vErrors = [err1]; | ||
vErrors = [err5]; | ||
} | ||
else { | ||
vErrors.push(err1); | ||
vErrors.push(err5); | ||
} | ||
@@ -383,30 +478,30 @@ errors++; | ||
} | ||
if(coerced10 !== undefined){ | ||
data9 = coerced10; | ||
if(coerced11 !== undefined){ | ||
data9 = coerced11; | ||
if(data !== undefined){ | ||
data["https"] = coerced10; | ||
data["https"] = coerced11; | ||
} | ||
} | ||
} | ||
var _valid1 = _errs29 === errors; | ||
if(_valid1 && valid3){ | ||
valid3 = false; | ||
passing0 = [passing0, 1]; | ||
var _valid2 = _errs33 === errors; | ||
if(_valid2 && valid4){ | ||
valid4 = false; | ||
passing1 = [passing1, 1]; | ||
} | ||
else { | ||
if(_valid1){ | ||
valid3 = true; | ||
passing0 = 1; | ||
if(_valid2){ | ||
valid4 = true; | ||
passing1 = 1; | ||
} | ||
const _errs31 = errors; | ||
if(errors === _errs31){ | ||
const _errs35 = errors; | ||
if(errors === _errs35){ | ||
if(data9 && typeof data9 == "object" && !Array.isArray(data9)){ | ||
let missing0; | ||
if((data9.allowHTTP1 === undefined) && (missing0 = "allowHTTP1")){ | ||
const err2 = {}; | ||
const err6 = {}; | ||
if(vErrors === null){ | ||
vErrors = [err2]; | ||
vErrors = [err6]; | ||
} | ||
else { | ||
vErrors.push(err2); | ||
vErrors.push(err6); | ||
} | ||
@@ -416,3 +511,3 @@ errors++; | ||
else { | ||
const _errs33 = errors; | ||
const _errs37 = errors; | ||
for(const key1 in data9){ | ||
@@ -423,21 +518,21 @@ if(!(key1 === "allowHTTP1")){ | ||
} | ||
if(_errs33 === errors){ | ||
if(_errs37 === errors){ | ||
if(data9.allowHTTP1 !== undefined){ | ||
let data10 = data9.allowHTTP1; | ||
if(typeof data10 !== "boolean"){ | ||
let coerced11 = undefined; | ||
if(!(coerced11 !== undefined)){ | ||
let coerced12 = undefined; | ||
if(!(coerced12 !== undefined)){ | ||
if(data10 === "false" || data10 === 0 || data10 === null){ | ||
coerced11 = false; | ||
coerced12 = false; | ||
} | ||
else if(data10 === "true" || data10 === 1){ | ||
coerced11 = true; | ||
coerced12 = true; | ||
} | ||
else { | ||
const err3 = {}; | ||
const err7 = {}; | ||
if(vErrors === null){ | ||
vErrors = [err3]; | ||
vErrors = [err7]; | ||
} | ||
else { | ||
vErrors.push(err3); | ||
vErrors.push(err7); | ||
} | ||
@@ -447,6 +542,6 @@ errors++; | ||
} | ||
if(coerced11 !== undefined){ | ||
data10 = coerced11; | ||
if(coerced12 !== undefined){ | ||
data10 = coerced12; | ||
if(data9 !== undefined){ | ||
data9["allowHTTP1"] = coerced11; | ||
data9["allowHTTP1"] = coerced12; | ||
} | ||
@@ -460,8 +555,8 @@ } | ||
else { | ||
const err4 = {}; | ||
const err8 = {}; | ||
if(vErrors === null){ | ||
vErrors = [err4]; | ||
vErrors = [err8]; | ||
} | ||
else { | ||
vErrors.push(err4); | ||
vErrors.push(err8); | ||
} | ||
@@ -471,21 +566,21 @@ errors++; | ||
} | ||
var _valid1 = _errs31 === errors; | ||
if(_valid1 && valid3){ | ||
valid3 = false; | ||
passing0 = [passing0, 2]; | ||
var _valid2 = _errs35 === errors; | ||
if(_valid2 && valid4){ | ||
valid4 = false; | ||
passing1 = [passing1, 2]; | ||
} | ||
else { | ||
if(_valid1){ | ||
valid3 = true; | ||
passing0 = 2; | ||
if(_valid2){ | ||
valid4 = true; | ||
passing1 = 2; | ||
} | ||
} | ||
} | ||
if(!valid3){ | ||
const err5 = {}; | ||
if(!valid4){ | ||
const err9 = {}; | ||
if(vErrors === null){ | ||
vErrors = [err5]; | ||
vErrors = [err9]; | ||
} | ||
else { | ||
vErrors.push(err5); | ||
vErrors.push(err9); | ||
} | ||
@@ -495,6 +590,6 @@ errors++; | ||
else { | ||
errors = _errs26; | ||
errors = _errs30; | ||
if(vErrors !== null){ | ||
if(_errs26){ | ||
vErrors.length = _errs26; | ||
if(_errs30){ | ||
vErrors.length = _errs30; | ||
} | ||
@@ -506,10 +601,10 @@ else { | ||
} | ||
var valid2 = _errs25 === errors; | ||
if(valid2){ | ||
const err6 = {}; | ||
var valid3 = _errs29 === errors; | ||
if(valid3){ | ||
const err10 = {}; | ||
if(vErrors === null){ | ||
vErrors = [err6]; | ||
vErrors = [err10]; | ||
} | ||
else { | ||
vErrors.push(err6); | ||
vErrors.push(err10); | ||
} | ||
@@ -519,6 +614,6 @@ errors++; | ||
else { | ||
errors = _errs24; | ||
errors = _errs28; | ||
if(vErrors !== null){ | ||
if(_errs24){ | ||
vErrors.length = _errs24; | ||
if(_errs28){ | ||
vErrors.length = _errs28; | ||
} | ||
@@ -530,7 +625,7 @@ else { | ||
} | ||
var _valid0 = _errs23 === errors; | ||
errors = _errs22; | ||
var _valid1 = _errs27 === errors; | ||
errors = _errs26; | ||
if(vErrors !== null){ | ||
if(_errs22){ | ||
vErrors.length = _errs22; | ||
if(_errs26){ | ||
vErrors.length = _errs26; | ||
} | ||
@@ -541,15 +636,15 @@ else { | ||
} | ||
if(_valid0){ | ||
const _errs36 = errors; | ||
if(_valid1){ | ||
const _errs40 = errors; | ||
data["https"] = true; | ||
var _valid0 = _errs36 === errors; | ||
valid1 = _valid0; | ||
var _valid1 = _errs40 === errors; | ||
valid2 = _valid1; | ||
} | ||
if(!valid1){ | ||
const err7 = {instancePath:instancePath+"/https",schemaPath:"#/properties/https/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"}; | ||
if(!valid2){ | ||
const err11 = {instancePath:instancePath+"/https",schemaPath:"#/properties/https/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"}; | ||
if(vErrors === null){ | ||
vErrors = [err7]; | ||
vErrors = [err11]; | ||
} | ||
else { | ||
vErrors.push(err7); | ||
vErrors.push(err11); | ||
} | ||
@@ -560,3 +655,3 @@ errors++; | ||
} | ||
var valid0 = _errs21 === errors; | ||
var valid0 = _errs25 === errors; | ||
} | ||
@@ -568,11 +663,11 @@ else { | ||
let data11 = data.ignoreTrailingSlash; | ||
const _errs37 = errors; | ||
const _errs41 = errors; | ||
if(typeof data11 !== "boolean"){ | ||
let coerced12 = undefined; | ||
if(!(coerced12 !== undefined)){ | ||
let coerced13 = undefined; | ||
if(!(coerced13 !== undefined)){ | ||
if(data11 === "false" || data11 === 0 || data11 === null){ | ||
coerced12 = false; | ||
coerced13 = false; | ||
} | ||
else if(data11 === "true" || data11 === 1){ | ||
coerced12 = true; | ||
coerced13 = true; | ||
} | ||
@@ -584,21 +679,21 @@ else { | ||
} | ||
if(coerced12 !== undefined){ | ||
data11 = coerced12; | ||
if(coerced13 !== undefined){ | ||
data11 = coerced13; | ||
if(data !== undefined){ | ||
data["ignoreTrailingSlash"] = coerced12; | ||
data["ignoreTrailingSlash"] = coerced13; | ||
} | ||
} | ||
} | ||
var valid0 = _errs37 === errors; | ||
var valid0 = _errs41 === errors; | ||
if(valid0){ | ||
let data12 = data.ignoreDuplicateSlashes; | ||
const _errs39 = errors; | ||
const _errs43 = errors; | ||
if(typeof data12 !== "boolean"){ | ||
let coerced13 = undefined; | ||
if(!(coerced13 !== undefined)){ | ||
let coerced14 = undefined; | ||
if(!(coerced14 !== undefined)){ | ||
if(data12 === "false" || data12 === 0 || data12 === null){ | ||
coerced13 = false; | ||
coerced14 = false; | ||
} | ||
else if(data12 === "true" || data12 === 1){ | ||
coerced13 = true; | ||
coerced14 = true; | ||
} | ||
@@ -610,21 +705,21 @@ else { | ||
} | ||
if(coerced13 !== undefined){ | ||
data12 = coerced13; | ||
if(coerced14 !== undefined){ | ||
data12 = coerced14; | ||
if(data !== undefined){ | ||
data["ignoreDuplicateSlashes"] = coerced13; | ||
data["ignoreDuplicateSlashes"] = coerced14; | ||
} | ||
} | ||
} | ||
var valid0 = _errs39 === errors; | ||
var valid0 = _errs43 === errors; | ||
if(valid0){ | ||
let data13 = data.disableRequestLogging; | ||
const _errs41 = errors; | ||
const _errs45 = errors; | ||
if(typeof data13 !== "boolean"){ | ||
let coerced14 = undefined; | ||
if(!(coerced14 !== undefined)){ | ||
let coerced15 = undefined; | ||
if(!(coerced15 !== undefined)){ | ||
if(data13 === "false" || data13 === 0 || data13 === null){ | ||
coerced14 = false; | ||
coerced15 = false; | ||
} | ||
else if(data13 === "true" || data13 === 1){ | ||
coerced14 = true; | ||
coerced15 = true; | ||
} | ||
@@ -636,21 +731,21 @@ else { | ||
} | ||
if(coerced14 !== undefined){ | ||
data13 = coerced14; | ||
if(coerced15 !== undefined){ | ||
data13 = coerced15; | ||
if(data !== undefined){ | ||
data["disableRequestLogging"] = coerced14; | ||
data["disableRequestLogging"] = coerced15; | ||
} | ||
} | ||
} | ||
var valid0 = _errs41 === errors; | ||
var valid0 = _errs45 === errors; | ||
if(valid0){ | ||
let data14 = data.jsonShorthand; | ||
const _errs43 = errors; | ||
const _errs47 = errors; | ||
if(typeof data14 !== "boolean"){ | ||
let coerced15 = undefined; | ||
if(!(coerced15 !== undefined)){ | ||
let coerced16 = undefined; | ||
if(!(coerced16 !== undefined)){ | ||
if(data14 === "false" || data14 === 0 || data14 === null){ | ||
coerced15 = false; | ||
coerced16 = false; | ||
} | ||
else if(data14 === "true" || data14 === 1){ | ||
coerced15 = true; | ||
coerced16 = true; | ||
} | ||
@@ -662,20 +757,20 @@ else { | ||
} | ||
if(coerced15 !== undefined){ | ||
data14 = coerced15; | ||
if(coerced16 !== undefined){ | ||
data14 = coerced16; | ||
if(data !== undefined){ | ||
data["jsonShorthand"] = coerced15; | ||
data["jsonShorthand"] = coerced16; | ||
} | ||
} | ||
} | ||
var valid0 = _errs43 === errors; | ||
var valid0 = _errs47 === errors; | ||
if(valid0){ | ||
let data15 = data.maxParamLength; | ||
const _errs45 = errors; | ||
const _errs49 = errors; | ||
if(!(((typeof data15 == "number") && (!(data15 % 1) && !isNaN(data15))) && (isFinite(data15)))){ | ||
let dataType16 = typeof data15; | ||
let coerced16 = undefined; | ||
if(!(coerced16 !== undefined)){ | ||
if(dataType16 === "boolean" || data15 === null | ||
|| (dataType16 === "string" && data15 && data15 == +data15 && !(data15 % 1))){ | ||
coerced16 = +data15; | ||
let dataType17 = typeof data15; | ||
let coerced17 = undefined; | ||
if(!(coerced17 !== undefined)){ | ||
if(dataType17 === "boolean" || data15 === null | ||
|| (dataType17 === "string" && data15 && data15 == +data15 && !(data15 % 1))){ | ||
coerced17 = +data15; | ||
} | ||
@@ -687,22 +782,22 @@ else { | ||
} | ||
if(coerced16 !== undefined){ | ||
data15 = coerced16; | ||
if(coerced17 !== undefined){ | ||
data15 = coerced17; | ||
if(data !== undefined){ | ||
data["maxParamLength"] = coerced16; | ||
data["maxParamLength"] = coerced17; | ||
} | ||
} | ||
} | ||
var valid0 = _errs45 === errors; | ||
var valid0 = _errs49 === errors; | ||
if(valid0){ | ||
let data16 = data.onProtoPoisoning; | ||
const _errs47 = errors; | ||
const _errs51 = errors; | ||
if(typeof data16 !== "string"){ | ||
let dataType17 = typeof data16; | ||
let coerced17 = undefined; | ||
if(!(coerced17 !== undefined)){ | ||
if(dataType17 == "number" || dataType17 == "boolean"){ | ||
coerced17 = "" + data16; | ||
let dataType18 = typeof data16; | ||
let coerced18 = undefined; | ||
if(!(coerced18 !== undefined)){ | ||
if(dataType18 == "number" || dataType18 == "boolean"){ | ||
coerced18 = "" + data16; | ||
} | ||
else if(data16 === null){ | ||
coerced17 = ""; | ||
coerced18 = ""; | ||
} | ||
@@ -714,22 +809,22 @@ else { | ||
} | ||
if(coerced17 !== undefined){ | ||
data16 = coerced17; | ||
if(coerced18 !== undefined){ | ||
data16 = coerced18; | ||
if(data !== undefined){ | ||
data["onProtoPoisoning"] = coerced17; | ||
data["onProtoPoisoning"] = coerced18; | ||
} | ||
} | ||
} | ||
var valid0 = _errs47 === errors; | ||
var valid0 = _errs51 === errors; | ||
if(valid0){ | ||
let data17 = data.onConstructorPoisoning; | ||
const _errs49 = errors; | ||
const _errs53 = errors; | ||
if(typeof data17 !== "string"){ | ||
let dataType18 = typeof data17; | ||
let coerced18 = undefined; | ||
if(!(coerced18 !== undefined)){ | ||
if(dataType18 == "number" || dataType18 == "boolean"){ | ||
coerced18 = "" + data17; | ||
let dataType19 = typeof data17; | ||
let coerced19 = undefined; | ||
if(!(coerced19 !== undefined)){ | ||
if(dataType19 == "number" || dataType19 == "boolean"){ | ||
coerced19 = "" + data17; | ||
} | ||
else if(data17 === null){ | ||
coerced18 = ""; | ||
coerced19 = ""; | ||
} | ||
@@ -741,20 +836,20 @@ else { | ||
} | ||
if(coerced18 !== undefined){ | ||
data17 = coerced18; | ||
if(coerced19 !== undefined){ | ||
data17 = coerced19; | ||
if(data !== undefined){ | ||
data["onConstructorPoisoning"] = coerced18; | ||
data["onConstructorPoisoning"] = coerced19; | ||
} | ||
} | ||
} | ||
var valid0 = _errs49 === errors; | ||
var valid0 = _errs53 === errors; | ||
if(valid0){ | ||
let data18 = data.pluginTimeout; | ||
const _errs51 = errors; | ||
const _errs55 = errors; | ||
if(!(((typeof data18 == "number") && (!(data18 % 1) && !isNaN(data18))) && (isFinite(data18)))){ | ||
let dataType19 = typeof data18; | ||
let coerced19 = undefined; | ||
if(!(coerced19 !== undefined)){ | ||
if(dataType19 === "boolean" || data18 === null | ||
|| (dataType19 === "string" && data18 && data18 == +data18 && !(data18 % 1))){ | ||
coerced19 = +data18; | ||
let dataType20 = typeof data18; | ||
let coerced20 = undefined; | ||
if(!(coerced20 !== undefined)){ | ||
if(dataType20 === "boolean" || data18 === null | ||
|| (dataType20 === "string" && data18 && data18 == +data18 && !(data18 % 1))){ | ||
coerced20 = +data18; | ||
} | ||
@@ -766,22 +861,22 @@ else { | ||
} | ||
if(coerced19 !== undefined){ | ||
data18 = coerced19; | ||
if(coerced20 !== undefined){ | ||
data18 = coerced20; | ||
if(data !== undefined){ | ||
data["pluginTimeout"] = coerced19; | ||
data["pluginTimeout"] = coerced20; | ||
} | ||
} | ||
} | ||
var valid0 = _errs51 === errors; | ||
var valid0 = _errs55 === errors; | ||
if(valid0){ | ||
let data19 = data.requestIdHeader; | ||
const _errs53 = errors; | ||
const _errs57 = errors; | ||
if(typeof data19 !== "string"){ | ||
let dataType20 = typeof data19; | ||
let coerced20 = undefined; | ||
if(!(coerced20 !== undefined)){ | ||
if(dataType20 == "number" || dataType20 == "boolean"){ | ||
coerced20 = "" + data19; | ||
let dataType21 = typeof data19; | ||
let coerced21 = undefined; | ||
if(!(coerced21 !== undefined)){ | ||
if(dataType21 == "number" || dataType21 == "boolean"){ | ||
coerced21 = "" + data19; | ||
} | ||
else if(data19 === null){ | ||
coerced20 = ""; | ||
coerced21 = ""; | ||
} | ||
@@ -793,22 +888,22 @@ else { | ||
} | ||
if(coerced20 !== undefined){ | ||
data19 = coerced20; | ||
if(coerced21 !== undefined){ | ||
data19 = coerced21; | ||
if(data !== undefined){ | ||
data["requestIdHeader"] = coerced20; | ||
data["requestIdHeader"] = coerced21; | ||
} | ||
} | ||
} | ||
var valid0 = _errs53 === errors; | ||
var valid0 = _errs57 === errors; | ||
if(valid0){ | ||
let data20 = data.requestIdLogLabel; | ||
const _errs55 = errors; | ||
const _errs59 = errors; | ||
if(typeof data20 !== "string"){ | ||
let dataType21 = typeof data20; | ||
let coerced21 = undefined; | ||
if(!(coerced21 !== undefined)){ | ||
if(dataType21 == "number" || dataType21 == "boolean"){ | ||
coerced21 = "" + data20; | ||
let dataType22 = typeof data20; | ||
let coerced22 = undefined; | ||
if(!(coerced22 !== undefined)){ | ||
if(dataType22 == "number" || dataType22 == "boolean"){ | ||
coerced22 = "" + data20; | ||
} | ||
else if(data20 === null){ | ||
coerced21 = ""; | ||
coerced22 = ""; | ||
} | ||
@@ -820,20 +915,20 @@ else { | ||
} | ||
if(coerced21 !== undefined){ | ||
data20 = coerced21; | ||
if(coerced22 !== undefined){ | ||
data20 = coerced22; | ||
if(data !== undefined){ | ||
data["requestIdLogLabel"] = coerced21; | ||
data["requestIdLogLabel"] = coerced22; | ||
} | ||
} | ||
} | ||
var valid0 = _errs55 === errors; | ||
var valid0 = _errs59 === errors; | ||
if(valid0){ | ||
let data21 = data.http2SessionTimeout; | ||
const _errs57 = errors; | ||
const _errs61 = errors; | ||
if(!(((typeof data21 == "number") && (!(data21 % 1) && !isNaN(data21))) && (isFinite(data21)))){ | ||
let dataType22 = typeof data21; | ||
let coerced22 = undefined; | ||
if(!(coerced22 !== undefined)){ | ||
if(dataType22 === "boolean" || data21 === null | ||
|| (dataType22 === "string" && data21 && data21 == +data21 && !(data21 % 1))){ | ||
coerced22 = +data21; | ||
let dataType23 = typeof data21; | ||
let coerced23 = undefined; | ||
if(!(coerced23 !== undefined)){ | ||
if(dataType23 === "boolean" || data21 === null | ||
|| (dataType23 === "string" && data21 && data21 == +data21 && !(data21 % 1))){ | ||
coerced23 = +data21; | ||
} | ||
@@ -845,21 +940,21 @@ else { | ||
} | ||
if(coerced22 !== undefined){ | ||
data21 = coerced22; | ||
if(coerced23 !== undefined){ | ||
data21 = coerced23; | ||
if(data !== undefined){ | ||
data["http2SessionTimeout"] = coerced22; | ||
data["http2SessionTimeout"] = coerced23; | ||
} | ||
} | ||
} | ||
var valid0 = _errs57 === errors; | ||
var valid0 = _errs61 === errors; | ||
if(valid0){ | ||
let data22 = data.exposeHeadRoutes; | ||
const _errs59 = errors; | ||
const _errs63 = errors; | ||
if(typeof data22 !== "boolean"){ | ||
let coerced23 = undefined; | ||
if(!(coerced23 !== undefined)){ | ||
let coerced24 = undefined; | ||
if(!(coerced24 !== undefined)){ | ||
if(data22 === "false" || data22 === 0 || data22 === null){ | ||
coerced23 = false; | ||
coerced24 = false; | ||
} | ||
else if(data22 === "true" || data22 === 1){ | ||
coerced23 = true; | ||
coerced24 = true; | ||
} | ||
@@ -871,15 +966,15 @@ else { | ||
} | ||
if(coerced23 !== undefined){ | ||
data22 = coerced23; | ||
if(coerced24 !== undefined){ | ||
data22 = coerced24; | ||
if(data !== undefined){ | ||
data["exposeHeadRoutes"] = coerced23; | ||
data["exposeHeadRoutes"] = coerced24; | ||
} | ||
} | ||
} | ||
var valid0 = _errs59 === errors; | ||
var valid0 = _errs63 === errors; | ||
if(valid0){ | ||
if(data.versioning !== undefined){ | ||
let data23 = data.versioning; | ||
const _errs61 = errors; | ||
if(errors === _errs61){ | ||
const _errs65 = errors; | ||
if(errors === _errs65){ | ||
if(data23 && typeof data23 == "object" && !Array.isArray(data23)){ | ||
@@ -897,3 +992,3 @@ let missing1; | ||
} | ||
var valid0 = _errs61 === errors; | ||
var valid0 = _errs65 === errors; | ||
} | ||
@@ -906,9 +1001,9 @@ else { | ||
let data24 = data.constraints; | ||
const _errs64 = errors; | ||
if(errors === _errs64){ | ||
const _errs68 = errors; | ||
if(errors === _errs68){ | ||
if(data24 && typeof data24 == "object" && !Array.isArray(data24)){ | ||
for(const key2 in data24){ | ||
let data25 = data24[key2]; | ||
const _errs67 = errors; | ||
if(errors === _errs67){ | ||
const _errs71 = errors; | ||
if(errors === _errs71){ | ||
if(data25 && typeof data25 == "object" && !Array.isArray(data25)){ | ||
@@ -924,10 +1019,10 @@ let missing2; | ||
if(typeof data26 !== "string"){ | ||
let dataType24 = typeof data26; | ||
let coerced24 = undefined; | ||
if(!(coerced24 !== undefined)){ | ||
if(dataType24 == "number" || dataType24 == "boolean"){ | ||
coerced24 = "" + data26; | ||
let dataType25 = typeof data26; | ||
let coerced25 = undefined; | ||
if(!(coerced25 !== undefined)){ | ||
if(dataType25 == "number" || dataType25 == "boolean"){ | ||
coerced25 = "" + data26; | ||
} | ||
else if(data26 === null){ | ||
coerced24 = ""; | ||
coerced25 = ""; | ||
} | ||
@@ -939,6 +1034,6 @@ else { | ||
} | ||
if(coerced24 !== undefined){ | ||
data26 = coerced24; | ||
if(coerced25 !== undefined){ | ||
data26 = coerced25; | ||
if(data25 !== undefined){ | ||
data25["name"] = coerced24; | ||
data25["name"] = coerced25; | ||
} | ||
@@ -955,4 +1050,4 @@ } | ||
} | ||
var valid5 = _errs67 === errors; | ||
if(!valid5){ | ||
var valid6 = _errs71 === errors; | ||
if(!valid6){ | ||
break; | ||
@@ -967,3 +1062,3 @@ } | ||
} | ||
var valid0 = _errs64 === errors; | ||
var valid0 = _errs68 === errors; | ||
} | ||
@@ -1008,2 +1103,2 @@ else { | ||
module.exports.defaultInitOptions = {"connectionTimeout":0,"keepAliveTimeout":72000,"forceCloseConnections":false,"maxRequestsPerSocket":0,"requestTimeout":0,"bodyLimit":1048576,"caseSensitive":true,"allowUnsafeRegex":false,"disableRequestLogging":false,"jsonShorthand":true,"ignoreTrailingSlash":false,"ignoreDuplicateSlashes":false,"maxParamLength":100,"onProtoPoisoning":"error","onConstructorPoisoning":"error","pluginTimeout":10000,"requestIdHeader":"request-id","requestIdLogLabel":"reqId","http2SessionTimeout":72000,"exposeHeadRoutes":true} | ||
module.exports.defaultInitOptions = {"connectionTimeout":0,"keepAliveTimeout":72000,"maxRequestsPerSocket":0,"requestTimeout":0,"bodyLimit":1048576,"caseSensitive":true,"allowUnsafeRegex":false,"disableRequestLogging":false,"jsonShorthand":true,"ignoreTrailingSlash":false,"ignoreDuplicateSlashes":false,"maxParamLength":100,"onProtoPoisoning":"error","onConstructorPoisoning":"error","pluginTimeout":10000,"requestIdHeader":"request-id","requestIdLogLabel":"reqId","http2SessionTimeout":72000,"exposeHeadRoutes":true} |
@@ -203,2 +203,6 @@ 'use strict' | ||
), | ||
FST_ERR_FORCE_CLOSE_CONNECTIONS_IDLE_NOT_AVAILABLE: createError( | ||
'FST_ERR_FORCE_CLOSE_CONNECTIONS_IDLE_NOT_AVAILABLE', | ||
"Cannot set forceCloseConnections to 'idle' as your HTTP server does not support closeIdleConnections method" | ||
), | ||
@@ -205,0 +209,0 @@ /** |
@@ -45,3 +45,2 @@ 'use strict' | ||
function buildRouting (options) { | ||
const { keepAliveConnections } = options | ||
const router = FindMyWay(options.config) | ||
@@ -64,2 +63,3 @@ | ||
let validateHTTPVersion | ||
let keepAliveConnections | ||
@@ -86,2 +86,3 @@ let closing = false | ||
return503OnClosing = Object.prototype.hasOwnProperty.call(options, 'return503OnClosing') ? options.return503OnClosing : true | ||
keepAliveConnections = fastifyArgs.keepAliveConnections | ||
}, | ||
@@ -88,0 +89,0 @@ routing: router.lookup.bind(router), // router func to find the right handler to call |
@@ -19,2 +19,4 @@ 'use strict' | ||
.reduce(function (acc, statusCode) { | ||
const schema = context.schema.response[statusCode] | ||
statusCode = statusCode.toLowerCase() | ||
if (!scChecker.exec(statusCode)) { | ||
@@ -25,3 +27,3 @@ throw new Error('response schemas should be nested under a valid status code, e.g { 2xx: { type: "object" } }') | ||
acc[statusCode] = compile({ | ||
schema: context.schema.response[statusCode], | ||
schema, | ||
url, | ||
@@ -28,0 +30,0 @@ method, |
{ | ||
"name": "fastify", | ||
"version": "4.0.0-rc.4", | ||
"version": "4.0.0-rc.5", | ||
"description": "Fast and low overhead web framework, for Node.js", | ||
@@ -127,9 +127,9 @@ "main": "fastify.js", | ||
"devDependencies": { | ||
"@fastify/pre-commit": "^2.0.1", | ||
"@sinclair/typebox": "^0.23.1", | ||
"@sinonjs/fake-timers": "^9.1.0", | ||
"@types/node": "^17.0.18", | ||
"@typescript-eslint/eslint-plugin": "^5.7.0", | ||
"@typescript-eslint/parser": "^5.7.0", | ||
"ajv": "^8.10.0", | ||
"@fastify/pre-commit": "^2.0.2", | ||
"@sinclair/typebox": "^0.23.5", | ||
"@sinonjs/fake-timers": "^9.1.2", | ||
"@types/node": "^17.0.38", | ||
"@typescript-eslint/eslint-plugin": "^5.27.0", | ||
"@typescript-eslint/parser": "^5.27.0", | ||
"ajv": "^8.11.0", | ||
"ajv-errors": "^3.0.0", | ||
@@ -142,20 +142,20 @@ "ajv-formats": "^2.1.1", | ||
"dns-prefetch-control": "^0.3.0", | ||
"eslint": "^8.0.1", | ||
"eslint": "^8.16.0", | ||
"eslint-config-standard": "^17.0.0-1", | ||
"eslint-import-resolver-node": "^0.3.2", | ||
"eslint-plugin-import": "^2.25.4", | ||
"eslint-plugin-n": "^15.1.0", | ||
"eslint-import-resolver-node": "^0.3.6", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-n": "^15.2.0", | ||
"eslint-plugin-promise": "^6.0.0", | ||
"fast-json-body": "^1.1.0", | ||
"fast-json-stringify": "^3.0.0", | ||
"fastify-plugin": "^3.0.0", | ||
"fluent-json-schema": "^3.0.1", | ||
"fast-json-stringify": "^4.0.0", | ||
"fastify-plugin": "^3.0.1", | ||
"fluent-json-schema": "^3.1.0", | ||
"form-data": "^4.0.0", | ||
"frameguard": "^4.0.0", | ||
"h2url": "^0.2.0", | ||
"helmet": "^5.0.1", | ||
"helmet": "^5.1.0", | ||
"hide-powered-by": "^1.1.0", | ||
"http-errors": "^2.0.0", | ||
"joi": "^17.5.0", | ||
"json-schema-to-ts": "^5.2.3", | ||
"joi": "^17.6.0", | ||
"json-schema-to-ts": "^2.5.3", | ||
"JSONStream": "^1.3.5", | ||
@@ -167,11 +167,11 @@ "license-checker": "^25.0.1", | ||
"send": "^0.18.0", | ||
"serve-static": "^1.14.1", | ||
"simple-get": "^4.0.0", | ||
"serve-static": "^1.15.0", | ||
"simple-get": "^4.0.1", | ||
"snazzy": "^9.0.0", | ||
"split2": "^4.1.0", | ||
"standard": "^17.0.0-2", | ||
"tap": "^16.0.0", | ||
"tap": "^16.2.0", | ||
"tsd": "^0.20.0", | ||
"typescript": "^4.5.4", | ||
"undici": "^4.11.3", | ||
"typescript": "^4.7.2", | ||
"undici": "^5.4.0", | ||
"x-xss-protection": "^2.0.0", | ||
@@ -183,14 +183,14 @@ "yup": "^0.32.11" | ||
"@fastify/error": "^3.0.0", | ||
"@fastify/fast-json-stringify-compiler": "^2.0.0", | ||
"@fastify/fast-json-stringify-compiler": "^3.0.0", | ||
"abstract-logging": "^2.0.1", | ||
"avvio": "^8.1.0", | ||
"find-my-way": "v6.2.0", | ||
"avvio": "^8.1.3", | ||
"find-my-way": "^6.3.0", | ||
"light-my-request": "^5.0.0", | ||
"pino": "^7.5.1", | ||
"pino": "^8.0.0", | ||
"process-warning": "^2.0.0", | ||
"proxy-addr": "^2.0.7", | ||
"rfdc": "^1.1.4", | ||
"secure-json-parse": "^2.0.0", | ||
"semver": "^7.3.2", | ||
"tiny-lru": "^8.0.1" | ||
"rfdc": "^1.3.0", | ||
"secure-json-parse": "^2.4.0", | ||
"semver": "^7.3.7", | ||
"tiny-lru": "^8.0.2" | ||
}, | ||
@@ -197,0 +197,0 @@ "standard": { |
@@ -10,3 +10,4 @@ 'use strict' | ||
const fastify = Fastify({ | ||
return503OnClosing: true | ||
return503OnClosing: true, | ||
forceCloseConnections: false | ||
}) | ||
@@ -44,3 +45,4 @@ | ||
const fastify = Fastify({ | ||
return503OnClosing: false | ||
return503OnClosing: false, | ||
forceCloseConnections: false | ||
}) | ||
@@ -47,0 +49,0 @@ |
'use strict' | ||
const net = require('net') | ||
const http = require('http') | ||
const t = require('tap') | ||
@@ -206,3 +207,4 @@ const test = t.test | ||
const fastify = Fastify({ | ||
return503OnClosing: false | ||
return503OnClosing: false, | ||
forceCloseConnections: false | ||
}) | ||
@@ -244,3 +246,3 @@ | ||
t.plan(3) | ||
const fastify = Fastify() | ||
const fastify = Fastify({ forceCloseConnections: false }) | ||
fastify.get('/', (req, reply) => { | ||
@@ -297,3 +299,6 @@ fastify.close() | ||
test('shutsdown while keep-alive connections are active (non-async)', t => { | ||
const server = http.createServer() | ||
const noSupport = typeof server.closeAllConnections !== 'function' | ||
test('shutsdown while keep-alive connections are active (non-async, native)', { skip: noSupport }, t => { | ||
t.plan(5) | ||
@@ -335,1 +340,86 @@ | ||
}) | ||
test('shutsdown while keep-alive connections are active (non-async, idle, native)', { skip: noSupport }, t => { | ||
t.plan(5) | ||
const timeoutTime = 2 * 60 * 1000 | ||
const fastify = Fastify({ forceCloseConnections: 'idle' }) | ||
fastify.server.setTimeout(timeoutTime) | ||
fastify.server.keepAliveTimeout = timeoutTime | ||
fastify.get('/', (req, reply) => { | ||
reply.send({ hello: 'world' }) | ||
}) | ||
fastify.listen({ port: 0 }, (err, address) => { | ||
t.error(err) | ||
const client = new Client( | ||
'http://localhost:' + fastify.server.address().port, | ||
{ keepAliveTimeout: 1 * 60 * 1000 } | ||
) | ||
client.request({ path: '/', method: 'GET' }, (err, response) => { | ||
t.error(err) | ||
t.equal(client.closed, false) | ||
fastify.close((err) => { | ||
t.error(err) | ||
// Due to the nature of the way we reap these keep-alive connections, | ||
// there hasn't been enough time before the server fully closed in order | ||
// for the client to have seen the socket get destroyed. The mere fact | ||
// that we have reached this callback is enough indication that the | ||
// feature being tested works as designed. | ||
t.equal(client.closed, false) | ||
}) | ||
}) | ||
}) | ||
}) | ||
test('shutsdown while keep-alive connections are active (non-async, custom)', t => { | ||
t.plan(5) | ||
const timeoutTime = 2 * 60 * 1000 | ||
const fastify = Fastify({ | ||
forceCloseConnections: true, | ||
serverFactory (handler) { | ||
const server = http.createServer(handler) | ||
server.closeAllConnections = null | ||
return server | ||
} | ||
}) | ||
fastify.server.setTimeout(timeoutTime) | ||
fastify.server.keepAliveTimeout = timeoutTime | ||
fastify.get('/', (req, reply) => { | ||
reply.send({ hello: 'world' }) | ||
}) | ||
fastify.listen({ port: 0 }, (err, address) => { | ||
t.error(err) | ||
const client = new Client( | ||
'http://localhost:' + fastify.server.address().port, | ||
{ keepAliveTimeout: 1 * 60 * 1000 } | ||
) | ||
client.request({ path: '/', method: 'GET' }, (err, response) => { | ||
t.error(err) | ||
t.equal(client.closed, false) | ||
fastify.close((err) => { | ||
t.error(err) | ||
// Due to the nature of the way we reap these keep-alive connections, | ||
// there hasn't been enough time before the server fully closed in order | ||
// for the client to have seen the socket get destroyed. The mere fact | ||
// that we have reached this callback is enough indication that the | ||
// feature being tested works as designed. | ||
t.equal(client.closed, false) | ||
}) | ||
}) | ||
}) | ||
}) |
@@ -7,2 +7,3 @@ 'use strict' | ||
const http = require('http') | ||
const { FST_ERR_FORCE_CLOSE_CONNECTIONS_IDLE_NOT_AVAILABLE } = require('../lib/errors') | ||
const sget = require('simple-get').concat | ||
@@ -53,1 +54,22 @@ const dns = require('dns').promises | ||
}) | ||
test('Should not allow forceCloseConnection=idle if the server does not support closeIdleConnections', t => { | ||
t.plan(1) | ||
t.throws( | ||
() => { | ||
Fastify({ | ||
forceCloseConnections: 'idle', | ||
serverFactory (handler, opts) { | ||
return { | ||
on () { | ||
} | ||
} | ||
} | ||
}) | ||
}, | ||
FST_ERR_FORCE_CLOSE_CONNECTIONS_IDLE_NOT_AVAILABLE, | ||
"Cannot set forceCloseConnections to 'idle' as your HTTP server does not support closeIdleConnections method" | ||
) | ||
}) |
@@ -35,3 +35,2 @@ 'use strict' | ||
keepAliveTimeout: 72000, | ||
forceCloseConnections: false, | ||
maxRequestsPerSocket: 0, | ||
@@ -269,3 +268,2 @@ requestTimeout: 0, | ||
keepAliveTimeout: 72000, | ||
forceCloseConnections: false, | ||
maxRequestsPerSocket: 0, | ||
@@ -272,0 +270,0 @@ requestTimeout: 0, |
@@ -130,5 +130,9 @@ 'use strict' | ||
t.error(err) | ||
t.equal(response.statusCode, 201) | ||
t.equal(response.statusCode, 500) | ||
t.equal(response.headers['content-length'], '' + body.length) | ||
t.same(JSON.parse(body), {}) | ||
t.same(JSON.parse(body), { | ||
statusCode: 500, | ||
error: 'Internal Server Error', | ||
message: 'The value "world" cannot be converted to a number.' | ||
}) | ||
}) | ||
@@ -135,0 +139,0 @@ }) |
@@ -1059,1 +1059,160 @@ 'use strict' | ||
}) | ||
test('hasPlugin method exists as a function', t => { | ||
t.plan(1) | ||
const fastify = Fastify() | ||
t.equal(typeof fastify.hasPlugin, 'function') | ||
}) | ||
test('hasPlugin returns true if the specified plugin has been registered', async t => { | ||
t.plan(4) | ||
const fastify = Fastify() | ||
function pluginA (fastify, opts, done) { | ||
t.ok(fastify.hasPlugin('plugin-A')) | ||
done() | ||
} | ||
pluginA[Symbol.for('fastify.display-name')] = 'plugin-A' | ||
fastify.register(pluginA) | ||
fastify.register(function pluginB (fastify, opts, done) { | ||
t.ok(fastify.hasPlugin('pluginB')) | ||
done() | ||
}) | ||
fastify.register(function (fastify, opts, done) { | ||
// one line | ||
t.ok(fastify.hasPlugin('function (fastify, opts, done) { -- // one line')) | ||
done() | ||
}) | ||
await fastify.ready() | ||
t.ok(fastify.hasPlugin('fastify')) | ||
}) | ||
test('hasPlugin returns false if the specified plugin has not been registered', t => { | ||
t.plan(1) | ||
const fastify = Fastify() | ||
t.notOk(fastify.hasPlugin('pluginFoo')) | ||
}) | ||
test('hasPlugin returns false when using encapsulation', async t => { | ||
t.plan(25) | ||
const fastify = Fastify() | ||
fastify.register(function pluginA (fastify, opts, done) { | ||
t.ok(fastify.hasPlugin('pluginA')) | ||
t.notOk(fastify.hasPlugin('pluginAA')) | ||
t.notOk(fastify.hasPlugin('pluginAAA')) | ||
t.notOk(fastify.hasPlugin('pluginAB')) | ||
t.notOk(fastify.hasPlugin('pluginB')) | ||
fastify.register(function pluginAA (fastify, opts, done) { | ||
t.notOk(fastify.hasPlugin('pluginA')) | ||
t.ok(fastify.hasPlugin('pluginAA')) | ||
t.notOk(fastify.hasPlugin('pluginAAA')) | ||
t.notOk(fastify.hasPlugin('pluginAB')) | ||
t.notOk(fastify.hasPlugin('pluginB')) | ||
fastify.register(function pluginAAA (fastify, opts, done) { | ||
t.notOk(fastify.hasPlugin('pluginA')) | ||
t.notOk(fastify.hasPlugin('pluginAA')) | ||
t.ok(fastify.hasPlugin('pluginAAA')) | ||
t.notOk(fastify.hasPlugin('pluginAB')) | ||
t.notOk(fastify.hasPlugin('pluginB')) | ||
done() | ||
}) | ||
done() | ||
}) | ||
fastify.register(function pluginAB (fastify, opts, done) { | ||
t.notOk(fastify.hasPlugin('pluginA')) | ||
t.notOk(fastify.hasPlugin('pluginAA')) | ||
t.notOk(fastify.hasPlugin('pluginAAA')) | ||
t.ok(fastify.hasPlugin('pluginAB')) | ||
t.notOk(fastify.hasPlugin('pluginB')) | ||
done() | ||
}) | ||
done() | ||
}) | ||
fastify.register(function pluginB (fastify, opts, done) { | ||
t.notOk(fastify.hasPlugin('pluginA')) | ||
t.notOk(fastify.hasPlugin('pluginAA')) | ||
t.notOk(fastify.hasPlugin('pluginAAA')) | ||
t.notOk(fastify.hasPlugin('pluginAB')) | ||
t.ok(fastify.hasPlugin('pluginB')) | ||
done() | ||
}) | ||
await fastify.ready() | ||
}) | ||
test('hasPlugin returns true when using no encapsulation', async t => { | ||
t.plan(26) | ||
const fastify = Fastify() | ||
fastify.register(fp((fastify, opts, done) => { | ||
t.equal(fastify.pluginName, 'fastify -> plugin-AA') | ||
t.ok(fastify.hasPlugin('plugin-AA')) | ||
t.notOk(fastify.hasPlugin('plugin-A')) | ||
t.notOk(fastify.hasPlugin('plugin-AAA')) | ||
t.notOk(fastify.hasPlugin('plugin-AB')) | ||
t.notOk(fastify.hasPlugin('plugin-B')) | ||
fastify.register(fp((fastify, opts, done) => { | ||
t.ok(fastify.hasPlugin('plugin-AA')) | ||
t.ok(fastify.hasPlugin('plugin-A')) | ||
t.notOk(fastify.hasPlugin('plugin-AAA')) | ||
t.notOk(fastify.hasPlugin('plugin-AB')) | ||
t.notOk(fastify.hasPlugin('plugin-B')) | ||
fastify.register(fp((fastify, opts, done) => { | ||
t.ok(fastify.hasPlugin('plugin-AA')) | ||
t.ok(fastify.hasPlugin('plugin-A')) | ||
t.ok(fastify.hasPlugin('plugin-AAA')) | ||
t.notOk(fastify.hasPlugin('plugin-AB')) | ||
t.notOk(fastify.hasPlugin('plugin-B')) | ||
done() | ||
}, { name: 'plugin-AAA' })) | ||
done() | ||
}, { name: 'plugin-A' })) | ||
fastify.register(fp((fastify, opts, done) => { | ||
t.ok(fastify.hasPlugin('plugin-AA')) | ||
t.ok(fastify.hasPlugin('plugin-A')) | ||
t.ok(fastify.hasPlugin('plugin-AAA')) | ||
t.ok(fastify.hasPlugin('plugin-AB')) | ||
t.notOk(fastify.hasPlugin('plugin-B')) | ||
done() | ||
}, { name: 'plugin-AB' })) | ||
done() | ||
}, { name: 'plugin-AA' })) | ||
fastify.register(fp((fastify, opts, done) => { | ||
t.ok(fastify.hasPlugin('plugin-AA')) | ||
t.ok(fastify.hasPlugin('plugin-A')) | ||
t.ok(fastify.hasPlugin('plugin-AAA')) | ||
t.ok(fastify.hasPlugin('plugin-AB')) | ||
t.ok(fastify.hasPlugin('plugin-B')) | ||
done() | ||
}, { name: 'plugin-B' })) | ||
await fastify.ready() | ||
}) |
@@ -714,1 +714,28 @@ 'use strict' | ||
}) | ||
test('capital X', t => { | ||
t.plan(3) | ||
const fastify = Fastify() | ||
fastify.get('/', { | ||
schema: { | ||
response: { | ||
'2XX': { | ||
type: 'object', | ||
properties: { | ||
name: { type: 'string' }, | ||
work: { type: 'string' } | ||
} | ||
} | ||
} | ||
} | ||
}, function (req, reply) { | ||
reply.code(200).send({ name: 'Foo', work: 'Bar', nick: 'Boo' }) | ||
}) | ||
fastify.inject('/', (err, res) => { | ||
t.error(err) | ||
t.same(res.json(), { name: 'Foo', work: 'Bar' }) | ||
t.equal(res.statusCode, 200) | ||
}) | ||
}) |
@@ -1,2 +0,2 @@ | ||
import { expectType } from 'tsd' | ||
import { expectError, expectType } from 'tsd' | ||
import fastify, { | ||
@@ -215,1 +215,13 @@ FastifyLogFn, | ||
expectType<FastifyBaseLogger>(passPinoOption.log) | ||
const childParent = fastify().log | ||
// we test different option variant here | ||
expectType<FastifyLoggerInstance>(childParent.child({}, { level: 'info' })) | ||
expectType<FastifyLoggerInstance>(childParent.child({}, { redact: ['pass', 'pin'] })) | ||
expectType<FastifyLoggerInstance>(childParent.child({}, { serializers: { key: () => {} } })) | ||
expectType<FastifyLoggerInstance>(childParent.child({}, { level: 'info', redact: ['pass', 'pin'], serializers: { key: () => {} } })) | ||
// no option pass | ||
expectError(childParent.child()) | ||
// wrong option | ||
expectError(childParent.child({}, { nonExist: true })) |
@@ -17,2 +17,8 @@ import fastify, { | ||
// ------------------------------------------------------------------- | ||
// Default (unknown) | ||
// ------------------------------------------------------------------- | ||
expectAssignable(server.get('/', (req) => expectType<unknown>(req.body))) | ||
// ------------------------------------------------------------------- | ||
// Remapping | ||
@@ -19,0 +25,0 @@ // ------------------------------------------------------------------- |
@@ -20,2 +20,4 @@ import { FastifyError } from '@fastify/error' | ||
export type ChildLoggerOptions = pino.ChildLoggerOptions | ||
export type FastifyLoggerInstance = pino.Logger | ||
@@ -25,3 +27,3 @@ // TODO make pino export BaseLogger again | ||
export type FastifyBaseLogger = pino.Logger & { | ||
child(bindings: Bindings): FastifyBaseLogger | ||
child(bindings: Bindings, options?: ChildLoggerOptions): FastifyBaseLogger | ||
} | ||
@@ -28,0 +30,0 @@ |
@@ -7,3 +7,3 @@ import { ValidatorCompiler } from '@fastify/ajv-compiler' | ||
* an example in our documentation on how to solve this problem. Check it | ||
* out here: https://github.com/fastify/fastify/blob/main/docs/TypeScript.md#json-schema | ||
* out here: https://github.com/fastify/fastify/blob/main/docs/Reference/TypeScript.md#json-schema | ||
*/ | ||
@@ -10,0 +10,0 @@ export interface FastifySchema { |
@@ -14,5 +14,4 @@ | ||
export interface FastifyTypeProviderDefault extends FastifyTypeProvider { | ||
output: unknown | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
export interface FastifyTypeProviderDefault extends FastifyTypeProvider {} | ||
@@ -19,0 +18,0 @@ export type CallTypeProvider<F extends FastifyTypeProvider, I> = (F & { input: I })['output'] |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1790179
42722
44
+ Added@fastify/fast-json-stringify-compiler@3.0.1(transitive)
+ Addedabort-controller@3.0.0(transitive)
+ Addedbase64-js@1.5.1(transitive)
+ Addedbuffer@6.0.3(transitive)
+ Addedevent-target-shim@5.0.1(transitive)
+ Addedevents@3.3.0(transitive)
+ Addedfast-json-stringify@4.2.0(transitive)
+ Addedfind-my-way@6.4.0(transitive)
+ Addedieee754@1.2.1(transitive)
+ Addedon-exit-leak-free@2.1.2(transitive)
+ Addedpino@8.21.0(transitive)
+ Addedpino-abstract-transport@1.2.0(transitive)
+ Addedpino-std-serializers@6.2.2(transitive)
+ Addedprocess@0.11.10(transitive)
+ Addedreadable-stream@4.5.2(transitive)
+ Addedreal-require@0.2.0(transitive)
+ Addedret@0.2.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsafe-regex2@2.0.0(transitive)
+ Addedsonic-boom@3.8.1(transitive)
+ Addedsplit2@4.2.0(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedthread-stream@2.7.0(transitive)
- Removed@fastify/fast-json-stringify-compiler@2.0.0(transitive)
- Removedfast-json-stringify@3.2.0(transitive)
- Removedfast-uri@1.0.1(transitive)
- Removedon-exit-leak-free@0.2.0(transitive)
- Removedpino@7.11.0(transitive)
- Removedpino-std-serializers@4.0.0(transitive)
- Removedprocess-warning@1.0.0(transitive)
- Removedreal-require@0.1.0(transitive)
- Removedsonic-boom@2.8.0(transitive)
- Removedthread-stream@0.15.2(transitive)
Updatedavvio@^8.1.3
Updatedfind-my-way@^6.3.0
Updatedpino@^8.0.0
Updatedrfdc@^1.3.0
Updatedsecure-json-parse@^2.4.0
Updatedsemver@^7.3.7
Updatedtiny-lru@^8.0.2