fastify 4.20.0 → 4.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/docs/Guides/Ecosystem.md +5 -3
- package/docs/Guides/Getting-Started.md +1 -1
- package/docs/Reference/Hooks.md +3 -0
- package/docs/Reference/Server.md +199 -181
- package/docs/Reference/TypeScript.md +1 -1
- package/docs/Reference/Validation-and-Serialization.md +1 -1
- package/fastify.d.ts +7 -10
- package/fastify.js +3 -3
- package/lib/contentTypeParser.js +5 -2
- package/lib/error-serializer.js +31 -29
- package/lib/errors.js +1 -1
- package/lib/pluginOverride.js +10 -3
- package/lib/pluginUtils.js +13 -10
- package/lib/reply.js +16 -4
- package/lib/wrapThenable.js +4 -1
- package/package.json +7 -9
- package/test/async-await.test.js +1 -1
- package/test/bodyLimit.test.js +69 -0
- package/test/custom-http-server.test.js +2 -1
- package/test/https/custom-https-server.test.js +2 -1
- package/test/internals/errors.test.js +2 -2
- package/test/internals/plugin.test.js +17 -2
- package/test/internals/reply.test.js +33 -2
- package/test/plugin.test.js +26 -0
- package/test/serial/logger.0.test.js +6 -1
- package/test/stream.test.js +4 -4
- package/test/types/fastify.test-d.ts +8 -3
- package/test/types/hooks.test-d.ts +13 -0
- package/test/types/instance.test-d.ts +7 -2
- package/test/types/reply.test-d.ts +25 -0
- package/test/types/request.test-d.ts +1 -1
- package/test/types/type-provider.test-d.ts +82 -1
- package/test/wrapThenable.test.js +22 -0
- package/types/hooks.d.ts +104 -4
- package/types/instance.d.ts +52 -143
- package/types/reply.d.ts +8 -6
- package/types/request.d.ts +1 -1
- package/types/route.d.ts +6 -1
- package/types/schema.d.ts +1 -1
- package/types/tsconfig.eslint.json +2 -2
- package/types/type-provider.d.ts +2 -1
- package/types/utils.d.ts +9 -0
package/README.md
CHANGED
|
@@ -15,6 +15,7 @@ CI](https://github.com/fastify/fastify/workflows/package-manager-ci/badge.svg?br
|
|
|
15
15
|
[](https://github.com/fastify/fastify/actions/workflows/website.yml)
|
|
17
17
|
[](https://standardjs.com/)
|
|
18
|
+
[](https://bestpractices.coreinfrastructure.org/projects/7585)
|
|
18
19
|
|
|
19
20
|
</div>
|
|
20
21
|
|
|
@@ -48,7 +49,7 @@ The `main` branch refers to the Fastify `v4` release. Check out the
|
|
|
48
49
|
|
|
49
50
|
|
|
50
51
|
|
|
51
|
-
### Table of Contents
|
|
52
|
+
### Table of Contents
|
|
52
53
|
|
|
53
54
|
- [Quick start](#quick-start)
|
|
54
55
|
- [Install](#install)
|
package/docs/Guides/Ecosystem.md
CHANGED
|
@@ -44,6 +44,9 @@ section.
|
|
|
44
44
|
Fastify.
|
|
45
45
|
- [`@fastify/diagnostics-channel`](https://github.com/fastify/fastify-diagnostics-channel)
|
|
46
46
|
Plugin to deal with `diagnostics_channel` on Fastify
|
|
47
|
+
- [`@fastify/early-hints`](https://github.com/fastify/fastify-early-hints) Plugin
|
|
48
|
+
to add HTTP 103 feature based on [RFC
|
|
49
|
+
8297](https://httpwg.org/specs/rfc8297.html).
|
|
47
50
|
- [`@fastify/elasticsearch`](https://github.com/fastify/fastify-elasticsearch)
|
|
48
51
|
Plugin to share the same ES client.
|
|
49
52
|
- [`@fastify/env`](https://github.com/fastify/fastify-env) Load and check
|
|
@@ -304,9 +307,6 @@ section.
|
|
|
304
307
|
object.
|
|
305
308
|
- [`fastify-dynareg`](https://github.com/greguz/fastify-dynareg) Dynamic plugin
|
|
306
309
|
register for Fastify.
|
|
307
|
-
- [`fastify-early-hints`](https://github.com/zekth/fastify-early-hints) Plugin
|
|
308
|
-
to add HTTP 103 feature based on [RFC
|
|
309
|
-
8297](https://httpwg.org/specs/rfc8297.html)
|
|
310
310
|
- [`fastify-envalid`](https://github.com/alemagio/fastify-envalid) Fastify
|
|
311
311
|
plugin to integrate [envalid](https://github.com/af/envalid) in your Fastify
|
|
312
312
|
project.
|
|
@@ -358,6 +358,8 @@ section.
|
|
|
358
358
|
Providers.
|
|
359
359
|
- [`fastify-guard`](https://github.com/hsynlms/fastify-guard) A Fastify plugin
|
|
360
360
|
that protects endpoints by checking authenticated user roles and/or scopes.
|
|
361
|
+
- [`fastify-hashids`](https://github.com/andersonjoseph/fastify-hashids) A Fastify
|
|
362
|
+
plugin to encode/decode IDs using [hashids](https://github.com/niieani/hashids.js).
|
|
361
363
|
- [`fastify-hasura`](https://github.com/ManUtopiK/fastify-hasura) A Fastify
|
|
362
364
|
plugin to have fun with [Hasura](https://github.com/hasura/graphql-engine).
|
|
363
365
|
- [`fastify-healthcheck`](https://github.com/smartiniOnGitHub/fastify-healthcheck)
|
|
@@ -277,7 +277,7 @@ async function dbConnector (fastify, options) {
|
|
|
277
277
|
|
|
278
278
|
// Wrapping a plugin function with fastify-plugin exposes the decorators
|
|
279
279
|
// and hooks, declared inside the plugin to the parent scope.
|
|
280
|
-
|
|
280
|
+
export default fastifyPlugin(dbConnector)
|
|
281
281
|
|
|
282
282
|
```
|
|
283
283
|
|
package/docs/Reference/Hooks.md
CHANGED
|
@@ -106,6 +106,9 @@ returned stream. This property is used to correctly match the request payload
|
|
|
106
106
|
with the `Content-Length` header value. Ideally, this property should be updated
|
|
107
107
|
on each received chunk.
|
|
108
108
|
|
|
109
|
+
**Notice:** The size of the returned stream is checked to not exceed the limit
|
|
110
|
+
set in [`bodyLimit`](./Server.md#bodylimit) option.
|
|
111
|
+
|
|
109
112
|
### preValidation
|
|
110
113
|
|
|
111
114
|
If you are using the `preValidation` hook, you can change the payload before it
|