fastify 3.27.4 → 4.0.0-alpha.3

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.
Files changed (168) hide show
  1. package/.taprc +3 -0
  2. package/README.md +7 -7
  3. package/build/build-error-serializer.js +27 -0
  4. package/build/build-validation.js +47 -35
  5. package/docs/Guides/Database.md +320 -0
  6. package/docs/Guides/Ecosystem.md +9 -0
  7. package/docs/Guides/Getting-Started.md +7 -7
  8. package/docs/Guides/Plugins-Guide.md +1 -1
  9. package/docs/Guides/Serverless.md +3 -3
  10. package/docs/Guides/Testing.md +2 -2
  11. package/docs/Migration-Guide-V4.md +12 -0
  12. package/docs/Reference/ContentTypeParser.md +4 -0
  13. package/docs/Reference/Decorators.md +2 -2
  14. package/docs/Reference/Encapsulation.md +2 -2
  15. package/docs/Reference/Errors.md +51 -6
  16. package/docs/Reference/HTTP2.md +3 -3
  17. package/docs/Reference/Hooks.md +4 -7
  18. package/docs/Reference/LTS.md +5 -4
  19. package/docs/Reference/Plugins.md +3 -3
  20. package/docs/Reference/Reply.md +73 -22
  21. package/docs/Reference/Request.md +1 -3
  22. package/docs/Reference/Routes.md +22 -15
  23. package/docs/Reference/Server.md +69 -119
  24. package/docs/Reference/TypeScript.md +20 -22
  25. package/docs/Reference/Validation-and-Serialization.md +30 -55
  26. package/docs/Type-Providers.md +257 -0
  27. package/examples/asyncawait.js +1 -1
  28. package/examples/benchmark/hooks-benchmark-async-await.js +1 -1
  29. package/examples/benchmark/hooks-benchmark.js +1 -1
  30. package/examples/benchmark/simple.js +1 -1
  31. package/examples/hooks.js +2 -2
  32. package/examples/http2.js +1 -1
  33. package/examples/https.js +1 -1
  34. package/examples/parser.js +13 -3
  35. package/examples/route-prefix.js +1 -1
  36. package/examples/shared-schema.js +1 -1
  37. package/examples/simple-stream.js +18 -0
  38. package/examples/simple.js +1 -1
  39. package/examples/simple.mjs +1 -1
  40. package/examples/typescript-server.ts +1 -1
  41. package/examples/use-plugin.js +1 -1
  42. package/fastify.d.ts +34 -22
  43. package/fastify.js +40 -36
  44. package/lib/configValidator.js +902 -1023
  45. package/lib/contentTypeParser.js +6 -16
  46. package/lib/context.js +36 -10
  47. package/lib/decorate.js +3 -1
  48. package/lib/error-handler.js +158 -0
  49. package/lib/error-serializer.js +257 -0
  50. package/lib/errors.js +51 -9
  51. package/lib/fourOhFour.js +31 -20
  52. package/lib/handleRequest.js +10 -13
  53. package/lib/hooks.js +14 -9
  54. package/lib/pluginOverride.js +0 -3
  55. package/lib/pluginUtils.js +3 -2
  56. package/lib/reply.js +121 -175
  57. package/lib/request.js +13 -10
  58. package/lib/route.js +131 -138
  59. package/lib/schema-controller.js +2 -2
  60. package/lib/schemas.js +27 -1
  61. package/lib/server.js +242 -116
  62. package/lib/symbols.js +5 -3
  63. package/lib/validation.js +11 -9
  64. package/lib/warnings.js +4 -12
  65. package/lib/wrapThenable.js +4 -11
  66. package/package.json +37 -39
  67. package/test/404s.test.js +258 -125
  68. package/test/500s.test.js +3 -3
  69. package/test/als.test.js +1 -1
  70. package/test/async-await.test.js +20 -76
  71. package/test/bodyLimit.test.js +1 -1
  72. package/test/build-certificate.js +6 -7
  73. package/test/case-insensitive.test.js +4 -4
  74. package/test/close-pipelining.test.js +2 -2
  75. package/test/close.test.js +11 -11
  76. package/test/content-parser.test.js +32 -0
  77. package/test/context-config.test.js +52 -0
  78. package/test/custom-http-server.test.js +14 -7
  79. package/test/custom-parser-async.test.js +1 -66
  80. package/test/custom-parser.test.js +92 -159
  81. package/test/custom-querystring-parser.test.js +3 -3
  82. package/test/decorator.test.js +11 -13
  83. package/test/delete.test.js +6 -6
  84. package/test/encapsulated-error-handler.test.js +50 -0
  85. package/test/esm/index.test.js +0 -14
  86. package/test/fastify-instance.test.js +4 -4
  87. package/test/fluent-schema.test.js +4 -4
  88. package/test/genReqId.test.js +1 -1
  89. package/test/get.test.js +4 -4
  90. package/test/handler-context.test.js +2 -2
  91. package/test/head.test.js +1 -1
  92. package/test/helper.js +19 -4
  93. package/test/hooks-async.test.js +15 -48
  94. package/test/hooks.on-ready.test.js +10 -5
  95. package/test/hooks.test.js +78 -119
  96. package/test/http2/closing.test.js +10 -16
  97. package/test/http2/constraint.test.js +1 -1
  98. package/test/http2/head.test.js +1 -1
  99. package/test/http2/plain.test.js +1 -1
  100. package/test/http2/secure-with-fallback.test.js +1 -1
  101. package/test/http2/secure.test.js +1 -1
  102. package/test/http2/unknown-http-method.test.js +4 -10
  103. package/test/https/custom-https-server.test.js +12 -6
  104. package/test/https/https.test.js +1 -1
  105. package/test/input-validation.js +3 -3
  106. package/test/internals/handleRequest.test.js +6 -43
  107. package/test/internals/initialConfig.test.js +41 -12
  108. package/test/internals/logger.test.js +2 -2
  109. package/test/internals/reply.test.js +317 -48
  110. package/test/internals/request.test.js +13 -7
  111. package/test/internals/server.test.js +88 -0
  112. package/test/listen.deprecated.test.js +202 -0
  113. package/test/listen.test.js +140 -145
  114. package/test/logger.test.js +82 -42
  115. package/test/maxRequestsPerSocket.test.js +8 -6
  116. package/test/middleware.test.js +2 -25
  117. package/test/nullable-validation.test.js +53 -16
  118. package/test/output-validation.test.js +1 -1
  119. package/test/plugin.test.js +47 -21
  120. package/test/pretty-print.test.js +22 -10
  121. package/test/promises.test.js +1 -1
  122. package/test/proto-poisoning.test.js +6 -6
  123. package/test/register.test.js +3 -3
  124. package/test/reply-error.test.js +126 -15
  125. package/test/reply-trailers.test.js +270 -0
  126. package/test/request-error.test.js +3 -6
  127. package/test/route-hooks.test.js +18 -18
  128. package/test/route-prefix.test.js +2 -1
  129. package/test/route.test.js +206 -22
  130. package/test/router-options.test.js +2 -2
  131. package/test/schema-examples.test.js +11 -5
  132. package/test/schema-feature.test.js +25 -20
  133. package/test/schema-serialization.test.js +9 -9
  134. package/test/schema-special-usage.test.js +5 -153
  135. package/test/schema-validation.test.js +9 -9
  136. package/test/skip-reply-send.test.js +2 -2
  137. package/test/stream.test.js +82 -23
  138. package/test/throw.test.js +8 -5
  139. package/test/trust-proxy.test.js +6 -6
  140. package/test/type-provider.test.js +20 -0
  141. package/test/types/fastify.test-d.ts +10 -18
  142. package/test/types/hooks.test-d.ts +61 -5
  143. package/test/types/import.js +2 -0
  144. package/test/types/import.ts +1 -0
  145. package/test/types/instance.test-d.ts +68 -17
  146. package/test/types/logger.test-d.ts +44 -15
  147. package/test/types/reply.test-d.ts +2 -1
  148. package/test/types/request.test-d.ts +71 -1
  149. package/test/types/route.test-d.ts +8 -2
  150. package/test/types/schema.test-d.ts +2 -39
  151. package/test/types/type-provider.test-d.ts +424 -0
  152. package/test/url-rewriting.test.js +3 -3
  153. package/test/validation-error-handling.test.js +8 -8
  154. package/test/versioned-routes.test.js +30 -18
  155. package/test/wrapThenable.test.js +7 -6
  156. package/types/content-type-parser.d.ts +17 -8
  157. package/types/hooks.d.ts +182 -85
  158. package/types/instance.d.ts +286 -118
  159. package/types/logger.d.ts +18 -104
  160. package/types/plugin.d.ts +10 -4
  161. package/types/reply.d.ts +18 -12
  162. package/types/request.d.ts +13 -8
  163. package/types/route.d.ts +62 -34
  164. package/types/schema.d.ts +1 -1
  165. package/types/type-provider.d.ts +99 -0
  166. package/types/utils.d.ts +1 -1
  167. package/lib/schema-compilers.js +0 -12
  168. package/test/emit-warning.test.js +0 -166
@@ -2,21 +2,22 @@
2
2
 
3
3
  const t = require('tap')
4
4
  const test = t.test
5
- const { kReplySentOverwritten } = require('../lib/symbols')
5
+ const { kReplyHijacked } = require('../lib/symbols')
6
6
  const wrapThenable = require('../lib/wrapThenable')
7
+ const Reply = require('../lib/reply')
7
8
 
8
- test('should resolve immediately when reply[kReplySentOverwritten] is true', t => {
9
+ test('should resolve immediately when reply[kReplyHijacked] is true', t => {
9
10
  const reply = {}
10
- reply[kReplySentOverwritten] = true
11
+ reply[kReplyHijacked] = true
11
12
  const thenable = Promise.resolve()
12
13
  wrapThenable(thenable, reply)
13
14
  t.end()
14
15
  })
15
16
 
16
- test('should reject immediately when reply[kReplySentOverwritten] is true', t => {
17
+ test('should reject immediately when reply[kReplyHijacked] is true', t => {
17
18
  t.plan(1)
18
- const reply = { res: {} }
19
- reply[kReplySentOverwritten] = true
19
+ const reply = new Reply({}, {}, {})
20
+ reply[kReplyHijacked] = true
20
21
  reply.log = {
21
22
  error: ({ err }) => {
22
23
  t.equal(err.message, 'Reply sent already')
@@ -1,6 +1,8 @@
1
1
  import { RawServerBase, RawServerDefault, RawRequestDefaultExpression } from './utils'
2
2
  import { FastifyRequest } from './request'
3
3
  import { RouteGenericInterface } from './route'
4
+ import { FastifyTypeProvider, FastifyTypeProviderDefault } from './type-provider'
5
+ import { FastifySchema } from './schema'
4
6
 
5
7
  type ContentTypeParserDoneFunction = (err: Error | null, body?: any) => void
6
8
 
@@ -12,8 +14,10 @@ export type FastifyBodyParser<
12
14
  RawServer extends RawServerBase = RawServerDefault,
13
15
  RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
14
16
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
15
- > = ((request: FastifyRequest<RouteGeneric, RawServer, RawRequest>, rawBody: RawBody, done: ContentTypeParserDoneFunction) => void)
16
- | ((request: FastifyRequest<RouteGeneric, RawServer, RawRequest>, rawBody: RawBody) => Promise<any>)
17
+ SchemaCompiler extends FastifySchema = FastifySchema,
18
+ TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
19
+ > = ((request: FastifyRequest<RouteGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider>, rawBody: RawBody, done: ContentTypeParserDoneFunction) => void)
20
+ | ((request: FastifyRequest<RouteGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider>, rawBody: RawBody) => Promise<any>)
17
21
 
18
22
  /**
19
23
  * Content Type Parser method that operates on request content
@@ -22,31 +26,36 @@ export type FastifyContentTypeParser<
22
26
  RawServer extends RawServerBase = RawServerDefault,
23
27
  RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
24
28
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
25
- > = ((request: FastifyRequest<RouteGeneric, RawServer, RawRequest>, payload: RawRequest) => Promise<any>)
26
- | ((request: FastifyRequest<RouteGeneric, RawServer, RawRequest>, payload: RawRequest, done: ContentTypeParserDoneFunction) => void)
29
+ SchemaCompiler extends FastifySchema = FastifySchema,
30
+ TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
31
+ > = ((request: FastifyRequest<RouteGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider>, payload: RawRequest) => Promise<any>)
32
+ | ((request: FastifyRequest<RouteGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider>, payload: RawRequest, done: ContentTypeParserDoneFunction) => void)
27
33
 
28
34
  /**
29
35
  * Natively, Fastify only supports 'application/json' and 'text/plain' content types. The default charset is utf-8. If you need to support different content types, you can use the addContentTypeParser API. The default JSON and/or plain text parser can be changed.
30
36
  */
31
37
  export interface AddContentTypeParser<
32
38
  RawServer extends RawServerBase = RawServerDefault,
33
- RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>
39
+ RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
40
+ RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
41
+ SchemaCompiler extends FastifySchema = FastifySchema,
42
+ TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
34
43
  > {
35
44
  (
36
45
  contentType: string | string[] | RegExp,
37
46
  opts: {
38
47
  bodyLimit?: number;
39
48
  },
40
- parser: FastifyContentTypeParser<RawServer, RawRequest>
49
+ parser: FastifyContentTypeParser<RawServer, RawRequest, RouteGeneric, SchemaCompiler, TypeProvider>
41
50
  ): void;
42
- (contentType: string | string[] | RegExp, parser: FastifyContentTypeParser<RawServer, RawRequest>): void;
51
+ (contentType: string | string[] | RegExp, parser: FastifyContentTypeParser<RawServer, RawRequest, RouteGeneric, SchemaCompiler, TypeProvider>): void;
43
52
  <parseAs extends string | Buffer>(
44
53
  contentType: string | string[] | RegExp,
45
54
  opts: {
46
55
  parseAs: parseAs extends Buffer ? 'buffer' : 'string';
47
56
  bodyLimit?: number;
48
57
  },
49
- parser: FastifyBodyParser<parseAs, RawServer, RawRequest>
58
+ parser: FastifyBodyParser<parseAs, RawServer, RawRequest, RouteGeneric, SchemaCompiler, TypeProvider>
50
59
  ): void;
51
60
  }
52
61
 
package/types/hooks.d.ts CHANGED
@@ -6,7 +6,14 @@ import { FastifyRequest } from './request'
6
6
  import { FastifyReply } from './reply'
7
7
  import { FastifyError } from 'fastify-error'
8
8
  import { FastifyLoggerInstance } from './logger'
9
+ import {
10
+ FastifyRequestType,
11
+ FastifyTypeProvider,
12
+ FastifyTypeProviderDefault,
13
+ ResolveFastifyRequestType
14
+ } from './type-provider'
9
15
  import { RegisterOptions } from './register'
16
+ import { FastifySchema } from './schema'
10
17
  import { FastifyPluginOptions } from './plugin'
11
18
 
12
19
  type HookHandlerDoneFunction = <TError extends Error = FastifyError>(err?: TError) => void
@@ -26,12 +33,16 @@ export interface onRequestHookHandler<
26
33
  RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
27
34
  RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
28
35
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
29
- ContextConfig = ContextConfigDefault
36
+ ContextConfig = ContextConfigDefault,
37
+ SchemaCompiler extends FastifySchema = FastifySchema,
38
+ TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
39
+ RequestType extends FastifyRequestType = ResolveFastifyRequestType<TypeProvider, SchemaCompiler, RouteGeneric>,
40
+ Logger extends FastifyLoggerInstance = FastifyLoggerInstance
30
41
  > {
31
42
  (
32
- this: FastifyInstance,
33
- request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
34
- reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
43
+ this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
44
+ request: FastifyRequest<RouteGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider, ContextConfig, RequestType, Logger>,
45
+ reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>,
35
46
  done: HookHandlerDoneFunction
36
47
  ): void;
37
48
  }
@@ -41,12 +52,16 @@ export interface onRequestAsyncHookHandler<
41
52
  RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
42
53
  RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
43
54
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
44
- ContextConfig = ContextConfigDefault
55
+ ContextConfig = ContextConfigDefault,
56
+ SchemaCompiler extends FastifySchema = FastifySchema,
57
+ TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
58
+ RequestType extends FastifyRequestType = ResolveFastifyRequestType<TypeProvider, SchemaCompiler, RouteGeneric>,
59
+ Logger extends FastifyLoggerInstance = FastifyLoggerInstance
45
60
  > {
46
61
  (
47
- this: FastifyInstance,
48
- request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
49
- reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
62
+ this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
63
+ request: FastifyRequest<RouteGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider, ContextConfig, RequestType, Logger>,
64
+ reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>,
50
65
  ): Promise<unknown>;
51
66
  }
52
67
 
@@ -59,12 +74,16 @@ export interface preParsingHookHandler<
59
74
  RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
60
75
  RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
61
76
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
62
- ContextConfig = ContextConfigDefault
77
+ ContextConfig = ContextConfigDefault,
78
+ SchemaCompiler extends FastifySchema = FastifySchema,
79
+ TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
80
+ RequestType extends FastifyRequestType = ResolveFastifyRequestType<TypeProvider, SchemaCompiler, RouteGeneric>,
81
+ Logger extends FastifyLoggerInstance = FastifyLoggerInstance
63
82
  > {
64
83
  (
65
- this: FastifyInstance,
66
- request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
67
- reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
84
+ this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
85
+ request: FastifyRequest<RouteGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider, ContextConfig, RequestType, Logger>,
86
+ reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>,
68
87
  payload: RequestPayload,
69
88
  done: <TError extends Error = FastifyError>(err?: TError | null, res?: RequestPayload) => void
70
89
  ): void;
@@ -75,12 +94,16 @@ export interface preParsingAsyncHookHandler<
75
94
  RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
76
95
  RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
77
96
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
78
- ContextConfig = ContextConfigDefault
97
+ ContextConfig = ContextConfigDefault,
98
+ SchemaCompiler extends FastifySchema = FastifySchema,
99
+ TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
100
+ RequestType extends FastifyRequestType = ResolveFastifyRequestType<TypeProvider, SchemaCompiler, RouteGeneric>,
101
+ Logger extends FastifyLoggerInstance = FastifyLoggerInstance
79
102
  > {
80
103
  (
81
- this: FastifyInstance,
82
- request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
83
- reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
104
+ this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
105
+ request: FastifyRequest<RouteGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider, ContextConfig, RequestType, Logger>,
106
+ reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>,
84
107
  payload: RequestPayload,
85
108
  ): Promise<RequestPayload | unknown>;
86
109
  }
@@ -93,12 +116,16 @@ export interface preValidationHookHandler<
93
116
  RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
94
117
  RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
95
118
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
96
- ContextConfig = ContextConfigDefault
119
+ ContextConfig = ContextConfigDefault,
120
+ SchemaCompiler extends FastifySchema = FastifySchema,
121
+ TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
122
+ RequestType extends FastifyRequestType = ResolveFastifyRequestType<TypeProvider, SchemaCompiler, RouteGeneric>,
123
+ Logger extends FastifyLoggerInstance = FastifyLoggerInstance
97
124
  > {
98
125
  (
99
- this: FastifyInstance,
100
- request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
101
- reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
126
+ this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
127
+ request: FastifyRequest<RouteGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider, ContextConfig, RequestType, Logger>,
128
+ reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>,
102
129
  done: HookHandlerDoneFunction
103
130
  ): void;
104
131
  }
@@ -108,12 +135,16 @@ export interface preValidationAsyncHookHandler<
108
135
  RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
109
136
  RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
110
137
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
111
- ContextConfig = ContextConfigDefault
138
+ ContextConfig = ContextConfigDefault,
139
+ SchemaCompiler extends FastifySchema = FastifySchema,
140
+ TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
141
+ RequestType extends FastifyRequestType = ResolveFastifyRequestType<TypeProvider, SchemaCompiler, RouteGeneric>,
142
+ Logger extends FastifyLoggerInstance = FastifyLoggerInstance
112
143
  > {
113
144
  (
114
- this: FastifyInstance,
115
- request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
116
- reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
145
+ this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
146
+ request: FastifyRequest<RouteGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider, ContextConfig, RequestType, Logger>,
147
+ reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>,
117
148
  ): Promise<unknown>;
118
149
  }
119
150
 
@@ -125,12 +156,16 @@ export interface preHandlerHookHandler<
125
156
  RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
126
157
  RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
127
158
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
128
- ContextConfig = ContextConfigDefault
159
+ ContextConfig = ContextConfigDefault,
160
+ SchemaCompiler extends FastifySchema = FastifySchema,
161
+ TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
162
+ RequestType extends FastifyRequestType = ResolveFastifyRequestType<TypeProvider, SchemaCompiler, RouteGeneric>,
163
+ Logger extends FastifyLoggerInstance = FastifyLoggerInstance
129
164
  > {
130
165
  (
131
- this: FastifyInstance,
132
- request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
133
- reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
166
+ this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
167
+ request: FastifyRequest<RouteGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider, ContextConfig, RequestType, Logger>,
168
+ reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>,
134
169
  done: HookHandlerDoneFunction
135
170
  ): void;
136
171
  }
@@ -140,12 +175,16 @@ export interface preHandlerAsyncHookHandler<
140
175
  RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
141
176
  RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
142
177
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
143
- ContextConfig = ContextConfigDefault
178
+ ContextConfig = ContextConfigDefault,
179
+ SchemaCompiler extends FastifySchema = FastifySchema,
180
+ TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
181
+ RequestType extends FastifyRequestType = ResolveFastifyRequestType<TypeProvider, SchemaCompiler, RouteGeneric>,
182
+ Logger extends FastifyLoggerInstance = FastifyLoggerInstance
144
183
  > {
145
184
  (
146
- this: FastifyInstance,
147
- request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
148
- reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
185
+ this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
186
+ request: FastifyRequest<RouteGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider, ContextConfig, RequestType, Logger>,
187
+ reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>,
149
188
  ): Promise<unknown>;
150
189
  }
151
190
 
@@ -166,12 +205,16 @@ export interface preSerializationHookHandler<
166
205
  RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
167
206
  RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
168
207
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
169
- ContextConfig = ContextConfigDefault
208
+ ContextConfig = ContextConfigDefault,
209
+ SchemaCompiler extends FastifySchema = FastifySchema,
210
+ TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
211
+ RequestType extends FastifyRequestType = ResolveFastifyRequestType<TypeProvider, SchemaCompiler, RouteGeneric>,
212
+ Logger extends FastifyLoggerInstance = FastifyLoggerInstance
170
213
  > {
171
214
  (
172
- this: FastifyInstance,
173
- request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
174
- reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
215
+ this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
216
+ request: FastifyRequest<RouteGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider, ContextConfig, RequestType, Logger>,
217
+ reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>,
175
218
  payload: PreSerializationPayload,
176
219
  done: DoneFuncWithErrOrRes
177
220
  ): void;
@@ -183,12 +226,16 @@ export interface preSerializationAsyncHookHandler<
183
226
  RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
184
227
  RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
185
228
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
186
- ContextConfig = ContextConfigDefault
229
+ ContextConfig = ContextConfigDefault,
230
+ SchemaCompiler extends FastifySchema = FastifySchema,
231
+ TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
232
+ RequestType extends FastifyRequestType = ResolveFastifyRequestType<TypeProvider, SchemaCompiler, RouteGeneric>,
233
+ Logger extends FastifyLoggerInstance = FastifyLoggerInstance
187
234
  > {
188
235
  (
189
- this: FastifyInstance,
190
- request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
191
- reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
236
+ this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
237
+ request: FastifyRequest<RouteGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider, ContextConfig, RequestType, Logger>,
238
+ reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>,
192
239
  payload: PreSerializationPayload
193
240
  ): Promise<unknown>;
194
241
  }
@@ -203,12 +250,16 @@ export interface onSendHookHandler<
203
250
  RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
204
251
  RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
205
252
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
206
- ContextConfig = ContextConfigDefault
253
+ ContextConfig = ContextConfigDefault,
254
+ SchemaCompiler extends FastifySchema = FastifySchema,
255
+ TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
256
+ RequestType extends FastifyRequestType = ResolveFastifyRequestType<TypeProvider, SchemaCompiler, RouteGeneric>,
257
+ Logger extends FastifyLoggerInstance = FastifyLoggerInstance
207
258
  > {
208
259
  (
209
- this: FastifyInstance,
210
- request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
211
- reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
260
+ this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
261
+ request: FastifyRequest<RouteGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider, ContextConfig, RequestType, Logger>,
262
+ reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>,
212
263
  payload: OnSendPayload,
213
264
  done: DoneFuncWithErrOrRes
214
265
  ): void;
@@ -220,12 +271,16 @@ export interface onSendAsyncHookHandler<
220
271
  RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
221
272
  RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
222
273
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
223
- ContextConfig = ContextConfigDefault
274
+ ContextConfig = ContextConfigDefault,
275
+ SchemaCompiler extends FastifySchema = FastifySchema,
276
+ TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
277
+ RequestType extends FastifyRequestType = ResolveFastifyRequestType<TypeProvider, SchemaCompiler, RouteGeneric>,
278
+ Logger extends FastifyLoggerInstance = FastifyLoggerInstance
224
279
  > {
225
280
  (
226
- this: FastifyInstance,
227
- request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
228
- reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
281
+ this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
282
+ request: FastifyRequest<RouteGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider, ContextConfig, RequestType, Logger>,
283
+ reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>,
229
284
  payload: OnSendPayload,
230
285
  ): Promise<unknown>;
231
286
  }
@@ -239,12 +294,16 @@ export interface onResponseHookHandler<
239
294
  RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
240
295
  RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
241
296
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
242
- ContextConfig = ContextConfigDefault
297
+ ContextConfig = ContextConfigDefault,
298
+ SchemaCompiler extends FastifySchema = FastifySchema,
299
+ TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
300
+ RequestType extends FastifyRequestType = ResolveFastifyRequestType<TypeProvider, SchemaCompiler, RouteGeneric>,
301
+ Logger extends FastifyLoggerInstance = FastifyLoggerInstance
243
302
  > {
244
303
  (
245
- this: FastifyInstance,
246
- request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
247
- reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
304
+ this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
305
+ request: FastifyRequest<RouteGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider, ContextConfig, RequestType, Logger>,
306
+ reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>,
248
307
  done: HookHandlerDoneFunction
249
308
  ): void;
250
309
  }
@@ -254,12 +313,16 @@ export interface onResponseAsyncHookHandler<
254
313
  RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
255
314
  RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
256
315
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
257
- ContextConfig = ContextConfigDefault
316
+ ContextConfig = ContextConfigDefault,
317
+ SchemaCompiler extends FastifySchema = FastifySchema,
318
+ TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
319
+ RequestType extends FastifyRequestType = ResolveFastifyRequestType<TypeProvider, SchemaCompiler, RouteGeneric>,
320
+ Logger extends FastifyLoggerInstance = FastifyLoggerInstance
258
321
  > {
259
322
  (
260
- this: FastifyInstance,
261
- request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
262
- reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
323
+ this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
324
+ request: FastifyRequest<RouteGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider, ContextConfig, RequestType, Logger>,
325
+ reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>
263
326
  ): Promise<unknown>;
264
327
  }
265
328
 
@@ -272,12 +335,16 @@ export interface onTimeoutHookHandler<
272
335
  RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
273
336
  RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
274
337
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
275
- ContextConfig = ContextConfigDefault
338
+ ContextConfig = ContextConfigDefault,
339
+ SchemaCompiler extends FastifySchema = FastifySchema,
340
+ TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
341
+ RequestType extends FastifyRequestType = ResolveFastifyRequestType<TypeProvider, SchemaCompiler, RouteGeneric>,
342
+ Logger extends FastifyLoggerInstance = FastifyLoggerInstance
276
343
  > {
277
344
  (
278
- this: FastifyInstance,
279
- request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
280
- reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
345
+ this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
346
+ request: FastifyRequest<RouteGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider, ContextConfig, RequestType, Logger>,
347
+ reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>,
281
348
  done: HookHandlerDoneFunction
282
349
  ): void;
283
350
  }
@@ -287,12 +354,16 @@ export interface onTimeoutAsyncHookHandler<
287
354
  RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
288
355
  RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
289
356
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
290
- ContextConfig = ContextConfigDefault
357
+ ContextConfig = ContextConfigDefault,
358
+ SchemaCompiler extends FastifySchema = FastifySchema,
359
+ TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
360
+ RequestType extends FastifyRequestType = ResolveFastifyRequestType<TypeProvider, SchemaCompiler, RouteGeneric>,
361
+ Logger extends FastifyLoggerInstance = FastifyLoggerInstance
291
362
  > {
292
363
  (
293
- this: FastifyInstance,
294
- request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
295
- reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
364
+ this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
365
+ request: FastifyRequest<RouteGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider, ContextConfig, RequestType, Logger>,
366
+ reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>
296
367
  ): Promise<unknown>;
297
368
  }
298
369
 
@@ -308,12 +379,16 @@ export interface onErrorHookHandler<
308
379
  RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
309
380
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
310
381
  ContextConfig = ContextConfigDefault,
311
- TError extends Error = FastifyError
382
+ TError extends Error = FastifyError,
383
+ SchemaCompiler extends FastifySchema = FastifySchema,
384
+ TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
385
+ RequestType extends FastifyRequestType = ResolveFastifyRequestType<TypeProvider, SchemaCompiler, RouteGeneric>,
386
+ Logger extends FastifyLoggerInstance = FastifyLoggerInstance
312
387
  > {
313
388
  (
314
- this: FastifyInstance,
315
- request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
316
- reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
389
+ this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
390
+ request: FastifyRequest<RouteGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider, ContextConfig, RequestType, Logger>,
391
+ reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>,
317
392
  error: TError,
318
393
  done: () => void
319
394
  ): void;
@@ -325,12 +400,16 @@ export interface onErrorAsyncHookHandler<
325
400
  RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
326
401
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
327
402
  ContextConfig = ContextConfigDefault,
328
- TError extends Error = FastifyError
403
+ TError extends Error = FastifyError,
404
+ SchemaCompiler extends FastifySchema = FastifySchema,
405
+ TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
406
+ RequestType extends FastifyRequestType = ResolveFastifyRequestType<TypeProvider, SchemaCompiler, RouteGeneric>,
407
+ Logger extends FastifyLoggerInstance = FastifyLoggerInstance
329
408
  > {
330
409
  (
331
- this: FastifyInstance,
332
- request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
333
- reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
410
+ this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
411
+ request: FastifyRequest<RouteGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider, ContextConfig, RequestType, Logger>,
412
+ reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>,
334
413
  error: TError
335
414
  ): Promise<unknown>;
336
415
  }
@@ -345,11 +424,14 @@ export interface onRouteHookHandler<
345
424
  RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
346
425
  RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
347
426
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
348
- ContextConfig = ContextConfigDefault
427
+ ContextConfig = ContextConfigDefault,
428
+ SchemaCompiler extends FastifySchema = FastifySchema,
429
+ TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
430
+ Logger extends FastifyLoggerInstance = FastifyLoggerInstance
349
431
  > {
350
432
  (
351
- this: FastifyInstance,
352
- opts: RouteOptions<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig> & { routePath: string; path: string; prefix: string }
433
+ this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
434
+ opts: RouteOptions<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider> & { routePath: string; path: string; prefix: string }
353
435
  ): Promise<unknown> | void;
354
436
  }
355
437
 
@@ -362,11 +444,12 @@ export interface onRegisterHookHandler<
362
444
  RawServer extends RawServerBase = RawServerDefault,
363
445
  RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
364
446
  RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
365
- Logger = FastifyLoggerInstance,
447
+ Logger extends FastifyLoggerInstance = FastifyLoggerInstance,
448
+ TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
366
449
  Options extends FastifyPluginOptions = FastifyPluginOptions
367
450
  > {
368
451
  (
369
- instance: FastifyInstance<RawServer, RawRequest, RawReply, Logger>,
452
+ instance: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
370
453
  opts: RegisterOptions & Options,
371
454
  done: HookHandlerDoneFunction
372
455
  ): Promise<unknown> | void; // documentation is missing the `done` method
@@ -375,16 +458,28 @@ export interface onRegisterHookHandler<
375
458
  /**
376
459
  * Triggered when fastify.listen() or fastify.ready() is invoked to start the server. It is useful when plugins need a "ready" event, for example to load data before the server start listening for requests.
377
460
  */
378
- export interface onReadyHookHandler {
461
+ export interface onReadyHookHandler<
462
+ RawServer extends RawServerBase = RawServerDefault,
463
+ RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
464
+ RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
465
+ Logger extends FastifyLoggerInstance = FastifyLoggerInstance,
466
+ TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
467
+ > {
379
468
  (
380
- this: FastifyInstance,
469
+ this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
381
470
  done: HookHandlerDoneFunction
382
471
  ): void;
383
472
  }
384
473
 
385
- export interface onReadyAsyncHookHandler {
474
+ export interface onReadyAsyncHookHandler<
475
+ RawServer extends RawServerBase = RawServerDefault,
476
+ RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
477
+ RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
478
+ Logger extends FastifyLoggerInstance = FastifyLoggerInstance,
479
+ TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
480
+ > {
386
481
  (
387
- this: FastifyInstance,
482
+ this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
388
483
  ): Promise<unknown>;
389
484
  }
390
485
  /**
@@ -394,10 +489,11 @@ export interface onCloseHookHandler<
394
489
  RawServer extends RawServerBase = RawServerDefault,
395
490
  RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
396
491
  RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
397
- Logger = FastifyLoggerInstance
492
+ Logger extends FastifyLoggerInstance = FastifyLoggerInstance,
493
+ TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
398
494
  > {
399
495
  (
400
- instance: FastifyInstance<RawServer, RawRequest, RawReply, Logger>,
496
+ instance: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
401
497
  done: HookHandlerDoneFunction
402
498
  ): void;
403
499
  }
@@ -406,9 +502,10 @@ export interface onCloseAsyncHookHandler<
406
502
  RawServer extends RawServerBase = RawServerDefault,
407
503
  RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
408
504
  RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
409
- Logger = FastifyLoggerInstance
505
+ Logger extends FastifyLoggerInstance = FastifyLoggerInstance,
506
+ TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault
410
507
  > {
411
508
  (
412
- instance: FastifyInstance<RawServer, RawRequest, RawReply, Logger>
509
+ instance: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>
413
510
  ): Promise<unknown>;
414
511
  }