fastify 5.1.0 → 5.2.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 +12 -7
- package/docs/Guides/Database.md +15 -15
- package/docs/Guides/Detecting-When-Clients-Abort.md +28 -28
- package/docs/Guides/Ecosystem.md +13 -7
- package/docs/Guides/Index.md +1 -1
- package/docs/Guides/Migration-Guide-V4.md +11 -11
- package/docs/Guides/Migration-Guide-V5.md +5 -5
- package/docs/Guides/Plugins-Guide.md +1 -1
- package/docs/Guides/Prototype-Poisoning.md +3 -3
- package/docs/Guides/Recommendations.md +9 -9
- package/docs/Guides/Serverless.md +5 -5
- package/docs/Guides/Testing.md +8 -8
- package/docs/Guides/Write-Plugin.md +1 -1
- package/docs/Guides/Write-Type-Provider.md +3 -3
- package/docs/Reference/Decorators.md +2 -2
- package/docs/Reference/Errors.md +2 -2
- package/docs/Reference/Hooks.md +7 -7
- package/docs/Reference/LTS.md +8 -0
- package/docs/Reference/Logging.md +5 -4
- package/docs/Reference/Reply.md +54 -53
- package/docs/Reference/Request.md +49 -43
- package/docs/Reference/Routes.md +7 -7
- package/docs/Reference/Server.md +31 -27
- package/docs/Reference/TypeScript.md +9 -9
- package/docs/Reference/Validation-and-Serialization.md +5 -5
- package/examples/typescript-server.ts +1 -1
- package/fastify.d.ts +4 -4
- package/fastify.js +1 -1
- package/lib/error-handler.js +9 -9
- package/lib/errors.js +1 -1
- package/lib/hooks.js +4 -1
- package/lib/request.js +11 -10
- package/package.json +3 -4
- package/test/{allowUnsafeRegex.test.js → allow-unsafe-regex.test.js} +4 -4
- package/test/async-dispose.test.js +0 -1
- package/test/async_hooks.test.js +4 -4
- package/test/buffer.test.js +4 -4
- package/test/build-certificate.js +1 -1
- package/test/bundler/README.md +5 -5
- package/test/case-insensitive.test.js +10 -10
- package/test/check.test.js +2 -3
- package/test/{childLoggerFactory.test.js → child-logger-factory.test.js} +1 -1
- package/test/client-timeout.test.js +1 -1
- package/test/close-pipelining.test.js +0 -1
- package/test/conditional-pino.test.js +3 -3
- package/test/content-length.test.js +53 -68
- package/test/content-parser.test.js +178 -167
- package/test/content-type.test.js +8 -9
- package/test/context-config.test.js +44 -54
- package/test/custom-parser.5.test.js +32 -32
- package/test/encapsulated-child-logger-factory.test.js +8 -8
- package/test/encapsulated-error-handler.test.js +20 -20
- package/test/fastify-instance.test.js +33 -34
- package/test/{findRoute.test.js → find-route.test.js} +11 -10
- package/test/fluent-schema.test.js +33 -36
- package/test/handler-context.test.js +11 -11
- package/test/has-route.test.js +12 -15
- package/test/header-overflow.test.js +13 -12
- package/test/hooks.on-ready.test.js +2 -2
- package/test/hooks.test.js +19 -19
- package/test/http-methods/head.test.js +0 -3
- package/test/imports.test.js +2 -2
- package/test/internals/errors.test.js +1 -1
- package/test/listen.5.test.js +9 -9
- package/test/{maxRequestsPerSocket.test.js → max-requests-per-socket.test.js} +30 -30
- package/test/middleware.test.js +4 -5
- package/test/noop-set.test.js +1 -1
- package/test/post-empty-body.test.js +18 -11
- package/test/pretty-print.test.js +59 -49
- package/test/proto-poisoning.test.js +42 -37
- package/test/reply-code.test.js +34 -32
- package/test/{reply-earlyHints.test.js → reply-early-hints.test.js} +21 -19
- package/test/request-header-host.test.js +154 -12
- package/test/request-id.test.js +31 -25
- package/test/{requestTimeout.test.js → request-timeout.test.js} +11 -11
- package/test/route.3.test.js +3 -2
- package/test/route.8.test.js +20 -20
- package/test/router-options.test.js +80 -77
- package/test/schema-examples.test.js +72 -38
- package/test/server.test.js +12 -12
- package/test/set-error-handler.test.js +2 -3
- package/test/stream-serializers.test.js +10 -7
- package/test/sync-routes.test.js +18 -18
- package/test/trust-proxy.test.js +51 -45
- package/test/type-provider.test.js +8 -6
- package/test/types/content-type-parser.test-d.ts +1 -1
- package/test/types/fastify.test-d.ts +4 -4
- package/test/types/instance.test-d.ts +3 -1
- package/test/types/logger.test-d.ts +2 -2
- package/test/types/plugin.test-d.ts +2 -2
- package/test/types/register.test-d.ts +2 -2
- package/test/types/reply.test-d.ts +1 -1
- package/test/types/route.test-d.ts +1 -1
- package/test/types/serverFactory.test-d.ts +1 -1
- package/test/types/type-provider.test-d.ts +1 -1
- package/test/url-rewriting.test.js +35 -38
- package/test/{useSemicolonDelimiter.test.js → use-semicolon-delimiter.test.js} +30 -30
- package/test/validation-error-handling.test.js +259 -285
- package/types/hooks.d.ts +1 -1
- package/types/instance.d.ts +9 -2
- package/types/reply.d.ts +1 -1
- package/types/request.d.ts +0 -4
- package/types/serverFactory.d.ts +3 -3
- package/types/utils.d.ts +3 -3
- /package/test/{connectionTimeout.test.js → connection-timeout.test.js} +0 -0
- /package/test/internals/{contentTypeParser.test.js → content-type-parser.test.js} +0 -0
- /package/test/internals/{handleRequest.test.js → handle-request.test.js} +0 -0
- /package/test/internals/{hookRunner.test.js → hook-runner.test.js} +0 -0
- /package/test/internals/{initialConfig.test.js → initial-config.test.js} +0 -0
- /package/test/internals/{reqIdGenFactory.test.js → req-id-gen-factory.test.js} +0 -0
- /package/test/{wrapThenable.test.js → wrap-thenable.test.js} +0 -0
package/types/hooks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Readable } from 'stream'
|
|
1
|
+
import { Readable } from 'node:stream'
|
|
2
2
|
import { FastifyInstance } from './instance'
|
|
3
3
|
import { RouteOptions, RouteGenericInterface } from './route'
|
|
4
4
|
import { RawServerBase, RawServerDefault, RawRequestDefaultExpression, RawReplyDefaultExpression, ContextConfigDefault } from './utils'
|
package/types/instance.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FastifyError } from '@fastify/error'
|
|
2
2
|
import { ConstraintStrategy, FindResult, HTTPVersion } from 'find-my-way'
|
|
3
|
-
import * as http from 'http'
|
|
3
|
+
import * as http from 'node:http'
|
|
4
4
|
import { InjectOptions, CallbackFunc as LightMyRequestCallback, Chain as LightMyRequestChain, Response as LightMyRequestResponse } from 'light-my-request'
|
|
5
|
-
import { AddressInfo } from 'net'
|
|
5
|
+
import { AddressInfo } from 'node:net'
|
|
6
6
|
import { AddContentTypeParser, ConstructorAction, FastifyBodyParser, ProtoAction, getDefaultJsonParser, hasContentTypeParser, removeAllContentTypeParsers, removeContentTypeParser } from './content-type-parser'
|
|
7
7
|
import { ApplicationHook, HookAsyncLookup, HookLookup, LifecycleHook, onCloseAsyncHookHandler, onCloseHookHandler, onErrorAsyncHookHandler, onErrorHookHandler, onListenAsyncHookHandler, onListenHookHandler, onReadyAsyncHookHandler, onReadyHookHandler, onRegisterHookHandler, onRequestAbortAsyncHookHandler, onRequestAbortHookHandler, onRequestAsyncHookHandler, onRequestHookHandler, onResponseAsyncHookHandler, onResponseHookHandler, onRouteHookHandler, onSendAsyncHookHandler, onSendHookHandler, onTimeoutAsyncHookHandler, onTimeoutHookHandler, preCloseAsyncHookHandler, preCloseHookHandler, preHandlerAsyncHookHandler, preHandlerHookHandler, preParsingAsyncHookHandler, preParsingHookHandler, preSerializationAsyncHookHandler, preSerializationHookHandler, preValidationAsyncHookHandler, preValidationHookHandler } from './hooks'
|
|
8
8
|
import { FastifyBaseLogger, FastifyChildLoggerFactory } from './logger'
|
|
@@ -548,6 +548,13 @@ export interface FastifyInstance<
|
|
|
548
548
|
* Remove all content type parsers, including the default ones
|
|
549
549
|
*/
|
|
550
550
|
removeAllContentTypeParsers: removeAllContentTypeParsers
|
|
551
|
+
/**
|
|
552
|
+
* Add a non-standard HTTP method
|
|
553
|
+
*
|
|
554
|
+
* Methods defined by default include `GET`, `HEAD`, `TRACE`, `DELETE`,
|
|
555
|
+
* `OPTIONS`, `PATCH`, `PUT` and `POST`
|
|
556
|
+
*/
|
|
557
|
+
addHttpMethod(method: string, methodOptions?: { hasBody: boolean }): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
|
|
551
558
|
/**
|
|
552
559
|
* Fastify default JSON parser
|
|
553
560
|
*/
|
package/types/reply.d.ts
CHANGED
package/types/request.d.ts
CHANGED
|
@@ -87,8 +87,4 @@ export interface FastifyRequest<RouteGeneric extends RouteGenericInterface = Rou
|
|
|
87
87
|
compileValidationSchema(schema: { [key: string]: any }, httpPart?: HTTPRequestPart): ValidationFunction
|
|
88
88
|
validateInput(input: any, schema: { [key: string]: any }, httpPart?: HTTPRequestPart): boolean
|
|
89
89
|
validateInput(input: any, httpPart?: HTTPRequestPart): boolean
|
|
90
|
-
|
|
91
|
-
// Prefer `socket` over deprecated `connection` property in node 13.0.0 or higher
|
|
92
|
-
// @deprecated
|
|
93
|
-
readonly connection: RawRequest['socket'];
|
|
94
90
|
}
|
package/types/serverFactory.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RawServerBase, RawServerDefault, RawReplyDefaultExpression, RawRequestDefaultExpression } from './utils'
|
|
2
|
-
import * as http from 'http'
|
|
3
|
-
import * as https from 'https'
|
|
4
|
-
import * as http2 from 'http2'
|
|
2
|
+
import * as http from 'node:http'
|
|
3
|
+
import * as https from 'node:https'
|
|
4
|
+
import * as http2 from 'node:http2'
|
|
5
5
|
|
|
6
6
|
export type FastifyServerFactoryHandler<
|
|
7
7
|
RawServer extends RawServerBase = RawServerDefault,
|
package/types/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as http from 'http'
|
|
2
|
-
import * as http2 from 'http2'
|
|
3
|
-
import * as https from 'https'
|
|
1
|
+
import * as http from 'node:http'
|
|
2
|
+
import * as http2 from 'node:http2'
|
|
3
|
+
import * as https from 'node:https'
|
|
4
4
|
|
|
5
5
|
type AutocompletePrimitiveBaseType<T> =
|
|
6
6
|
T extends string ? string :
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|