fastify 3.20.0 → 3.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/Ecosystem.md CHANGED
@@ -178,6 +178,7 @@ Plugins maintained by the Fastify team are listed under [Core](#core) while plug
178
178
  - [`fastify-sequelize`](https://github.com/lyquocnam/fastify-sequelize) Fastify plugin work with Sequelize (adapter for NodeJS -> Sqlite, Mysql, Mssql, Postgres).
179
179
  - [`fastify-server-session`](https://github.com/jsumners/fastify-server-session) A session plugin with support for arbitrary backing caches via `fastify-caching`.
180
180
  - [`fastify-session`](https://github.com/SerayaEryn/fastify-session) a session plugin for Fastify.
181
+ - [`fastify-slonik`](https://github.com/Unbuttun/fastify-slonik) Fastify Slonik plugin, with this you can use slonik in every part of your server.
181
182
  - [`fastify-soap-client`](https://github.com/fastify/fastify-soap-client) a SOAP client plugin for Fastify.
182
183
  - [`fastify-socket.io`](https://github.com/alemagio/fastify-socket.io) a Socket.io plugin for Fastify.
183
184
  - [`fastify-sse`](https://github.com/lolo32/fastify-sse) to provide Server-Sent Events with `reply.sse( … )` to Fastify.
package/docs/Reply.md CHANGED
@@ -53,8 +53,8 @@ and properties:
53
53
  - `.serializer(function)` - Sets a custom serializer for the payload.
54
54
  - `.send(payload)` - Sends the payload to the user, could be a plain text, a buffer, JSON, stream, or an Error object.
55
55
  - `.sent` - A boolean value that you can use if you need to know if `send` has already been called.
56
- - `.raw` - The [`http.ServerResponse`](https://nodejs.org/dist/latest/docs/api/http.html#http_class_http_serverresponse) from Node core.
57
- - `.res` *(deprecated, use `.raw` instead)* - The [`http.ServerResponse`](https://nodejs.org/dist/latest/docs/api/http.html#http_class_http_serverresponse) from Node core.
56
+ - `.raw` - The [`http.ServerResponse`](https://nodejs.org/dist/latest-v14.x/docs/api/http.html#http_class_http_serverresponse) from Node core.
57
+ - `.res` *(deprecated, use `.raw` instead)* - The [`http.ServerResponse`](https://nodejs.org/dist/latest-v14.x/docs/api/http.html#http_class_http_serverresponse) from Node core.
58
58
  - `.log` - The logger instance of the incoming request.
59
59
  - `.request` - The incoming request.
60
60
  - `.context` - Access the [Request's context](Request.md#Request) property.
@@ -109,7 +109,7 @@ fastify.get('/', async function (req, rep) {
109
109
  Sets a response header. If the value is omitted or undefined, it is coerced
110
110
  to `''`.
111
111
 
112
- For more information, see [`http.ServerResponse#setHeader`](https://nodejs.org/dist/latest/docs/api/http.html#http_response_setheader_name_value).
112
+ For more information, see [`http.ServerResponse#setHeader`](https://nodejs.org/dist/latest-v14.x/docs/api/http.html#http_response_setheader_name_value).
113
113
 
114
114
  <a name="headers"></a>
115
115
  ### .headers(object)
@@ -228,7 +228,7 @@ See [`.send()`](#send) for more information on sending different types of values
228
228
 
229
229
  <a name="raw"></a>
230
230
  ### .raw
231
- This is the [`http.ServerResponse`](https://nodejs.org/dist/latest/docs/api/http.html#http_class_http_serverresponse) from Node core. Whilst you are using the Fastify `Reply` object, the use of `Reply.raw` functions is at your own risk as you are skipping all the Fastify
231
+ This is the [`http.ServerResponse`](https://nodejs.org/dist/latest-v14.x/docs/api/http.html#http_class_http_serverresponse) from Node core. Whilst you are using the Fastify `Reply` object, the use of `Reply.raw` functions is at your own risk as you are skipping all the Fastify
232
232
  logic of handling the HTTP response. e.g.:
233
233
 
234
234
  ```js
package/docs/Server.md CHANGED
@@ -11,7 +11,7 @@ document describes the properties available in that options object.
11
11
  <a name="factory-http2"></a>
12
12
  ### `http2`
13
13
 
14
- If `true` Node.js core's [HTTP/2](https://nodejs.org/dist/latest-v8.x/docs/api/http2.html) module is used for binding the socket.
14
+ If `true` Node.js core's [HTTP/2](https://nodejs.org/dist/latest-v14.x/docs/api/http2.html) module is used for binding the socket.
15
15
 
16
16
  + Default: `false`
17
17
 
@@ -20,7 +20,7 @@ If `true` Node.js core's [HTTP/2](https://nodejs.org/dist/latest-v8.x/docs/api/h
20
20
 
21
21
  An object used to configure the server's listening socket for TLS. The options
22
22
  are the same as the Node.js core
23
- [`createServer` method](https://nodejs.org/dist/latest-v8.x/docs/api/https.html#https_https_createserver_options_requestlistener).
23
+ [`createServer` method](https://nodejs.org/dist/latest-v14.x/docs/api/https.html#https_https_createserver_options_requestlistener).
24
24
  When this property is `null`, the socket will not be configured for TLS.
25
25
 
26
26
  This option also applies when the
package/fastify.d.ts CHANGED
@@ -14,6 +14,7 @@ import { FastifyReply } from './types/reply'
14
14
  import { FastifySchemaValidationError } from './types/schema'
15
15
  import { ConstructorAction, ProtoAction } from "./types/content-type-parser";
16
16
  import { Socket } from 'net'
17
+ import { Options as FJSOptions } from 'fast-json-stringify'
17
18
 
18
19
  /**
19
20
  * Fastify factory function for the standard fastify http, https, or http2 server instance.
@@ -102,6 +103,7 @@ export type FastifyServerOptions<
102
103
  onProtoPoisoning?: ProtoAction,
103
104
  onConstructorPoisoning?: ConstructorAction,
104
105
  logger?: boolean | FastifyLoggerOptions<RawServer> | Logger,
106
+ serializerOpts?: FJSOptions | Record<string, unknown>,
105
107
  serverFactory?: FastifyServerFactory<RawServer>,
106
108
  caseSensitive?: boolean,
107
109
  requestIdHeader?: string,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fastify",
3
- "version": "3.20.0",
3
+ "version": "3.20.1",
4
4
  "description": "Fast and low overhead web framework, for Node.js",
5
5
  "main": "fastify.js",
6
6
  "type": "commonjs",
@@ -177,7 +177,7 @@
177
177
  "fast-json-stringify": "^2.5.2",
178
178
  "fastify-error": "^0.3.0",
179
179
  "fastify-warning": "^0.2.0",
180
- "find-my-way": "^4.0.0",
180
+ "find-my-way": "^4.1.0",
181
181
  "flatstr": "^1.0.12",
182
182
  "light-my-request": "^4.2.0",
183
183
  "pino": "^6.13.0",
@@ -50,6 +50,10 @@ expectAssignable<FastifyInstance>(fastify({ disableRequestLogging: true }))
50
50
  expectAssignable<FastifyInstance>(fastify({ requestIdLogLabel: 'request-id' }))
51
51
  expectAssignable<FastifyInstance>(fastify({ onProtoPoisoning: 'error' }))
52
52
  expectAssignable<FastifyInstance>(fastify({ onConstructorPoisoning: 'error' }))
53
+ expectAssignable<FastifyInstance>(fastify({ serializerOpts: { rounding: 'ceil' } }))
54
+ expectAssignable<FastifyInstance>(fastify({ serializerOpts: { ajv: { missingRefs: 'ignore' } } }))
55
+ expectAssignable<FastifyInstance>(fastify({ serializerOpts: { schema: { } } }))
56
+ expectAssignable<FastifyInstance>(fastify({ serializerOpts: { otherProp: { } } }))
53
57
  expectAssignable<FastifyInstance<http.Server, http.IncomingMessage, http.ServerResponse>>(fastify({ logger: true }))
54
58
  expectAssignable<FastifyInstance<http.Server, http.IncomingMessage, http.ServerResponse, FastifyLoggerInstance>>(fastify({ logger: true }))
55
59
  expectAssignable<FastifyInstance<http.Server, http.IncomingMessage, http.ServerResponse, FastifyLoggerInstance>>(fastify({