fastify 5.10.0 → 5.11.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/SPONSORS.md +1 -0
- package/docs/Guides/Ecosystem.md +2 -2
- package/docs/Guides/Getting-Started.md +8 -8
- package/docs/Reference/Errors.md +4 -0
- package/docs/Reference/Reply.md +2 -2
- package/docs/Reference/Request.md +11 -11
- package/docs/Reference/Server.md +16 -15
- package/docs/Reference/TypeScript.md +5 -7
- package/docs/Reference/Warnings.md +1 -0
- package/eslint.config.js +1 -1
- package/fastify.d.ts +55 -13
- package/fastify.js +7 -2
- package/lib/content-type.js +36 -18
- package/lib/errors.js +10 -0
- package/lib/handle-request.js +35 -7
- package/lib/hooks.js +5 -1
- package/lib/route.js +1 -1
- package/lib/schemas.js +3 -3
- package/lib/validation.js +1 -1
- package/package.json +2 -2
- package/test/content-type.test.js +31 -4
- package/test/find-route.test.js +35 -0
- package/test/fix-6411.test.js +65 -0
- package/test/internals/all.test.js +2 -1
- package/test/internals/errors.test.js +21 -1
- package/test/internals/reply.test.js +22 -0
- package/test/reply-error.test.js +35 -0
- package/test/rfc-10008.test.js +147 -0
- package/test/route-shorthand.test.js +14 -4
- package/test/schema-serialization.test.js +33 -0
- package/test/types/errors.tst.ts +2 -0
- package/test/types/route.tst.ts +3 -3
- package/types/content-type-parser.d.ts +26 -6
- package/types/errors.d.ts +2 -0
- package/types/hooks.d.ts +137 -76
- package/types/instance.d.ts +150 -47
- package/types/logger.d.ts +36 -3
- package/types/plugin.d.ts +7 -3
- package/types/register.d.ts +53 -10
- package/types/reply.d.ts +62 -14
- package/types/route.d.ts +68 -34
- package/types/type-provider.d.ts +29 -8
- package/types/utils.d.ts +2 -2
package/types/errors.d.ts
CHANGED
|
@@ -81,6 +81,8 @@ export type FastifyErrorCodes = Record<
|
|
|
81
81
|
'FST_ERR_HANDLER_TIMEOUT' |
|
|
82
82
|
'FST_ERR_ROUTE_HANDLER_TIMEOUT_OPTION_NOT_INT' |
|
|
83
83
|
'FST_ERR_ROUTE_REWRITE_NOT_STR' |
|
|
84
|
+
'FST_ERR_ROUTE_MISSING_CONTENT_TYPE' |
|
|
85
|
+
'FST_ERR_ROUTE_MISSING_CONTENT' |
|
|
84
86
|
'FST_ERR_REOPENED_CLOSE_SERVER' |
|
|
85
87
|
'FST_ERR_REOPENED_SERVER' |
|
|
86
88
|
'FST_ERR_INSTANCE_ALREADY_LISTENING' |
|
package/types/hooks.d.ts
CHANGED
|
@@ -72,12 +72,18 @@ export type onRequestMetaHookHandler<
|
|
|
72
72
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
73
73
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
74
74
|
Logger extends FastifyBaseLogger = FastifyBaseLogger,
|
|
75
|
-
Return extends ReturnType<onRequestHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
Return extends ReturnType<onRequestHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig,
|
|
76
|
+
SchemaCompiler, TypeProvider, Logger>>
|
|
77
|
+
| ReturnType<onRequestAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler,
|
|
78
|
+
TypeProvider, Logger>>
|
|
79
|
+
= ReturnType<onRequestHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler,
|
|
80
|
+
TypeProvider, Logger>>
|
|
81
|
+
> = Return extends ReturnType<onRequestHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig,
|
|
82
|
+
SchemaCompiler, TypeProvider, Logger>>
|
|
83
|
+
? onRequestHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider,
|
|
84
|
+
Logger>
|
|
85
|
+
: onRequestAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler,
|
|
86
|
+
TypeProvider, Logger>
|
|
81
87
|
|
|
82
88
|
/**
|
|
83
89
|
* `preParsing` is the second hook to be executed in the request lifecycle. The previous hook was `onRequest`, the next hook will be `preValidation`.
|
|
@@ -131,12 +137,18 @@ export type preParsingMetaHookHandler<
|
|
|
131
137
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
132
138
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
133
139
|
Logger extends FastifyBaseLogger = FastifyBaseLogger,
|
|
134
|
-
Return extends ReturnType<preParsingHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
+
Return extends ReturnType<preParsingHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig,
|
|
141
|
+
SchemaCompiler, TypeProvider, Logger>>
|
|
142
|
+
| ReturnType<preParsingAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig,
|
|
143
|
+
SchemaCompiler, TypeProvider, Logger>>
|
|
144
|
+
= ReturnType<preParsingHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler,
|
|
145
|
+
TypeProvider, Logger>>
|
|
146
|
+
> = Return extends ReturnType<preParsingHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig,
|
|
147
|
+
SchemaCompiler, TypeProvider, Logger>>
|
|
148
|
+
? preParsingHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider,
|
|
149
|
+
Logger>
|
|
150
|
+
: preParsingAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler,
|
|
151
|
+
TypeProvider, Logger>
|
|
140
152
|
|
|
141
153
|
/**
|
|
142
154
|
* `preValidation` is the third hook to be executed in the request lifecycle. The previous hook was `preParsing`, the next hook will be `preHandler`.
|
|
@@ -187,12 +199,18 @@ export type preValidationMetaHookHandler<
|
|
|
187
199
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
188
200
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
189
201
|
Logger extends FastifyBaseLogger = FastifyBaseLogger,
|
|
190
|
-
Return extends ReturnType<preValidationHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig,
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
202
|
+
Return extends ReturnType<preValidationHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig,
|
|
203
|
+
SchemaCompiler, TypeProvider, Logger>>
|
|
204
|
+
| ReturnType<preValidationAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig,
|
|
205
|
+
SchemaCompiler, TypeProvider, Logger>>
|
|
206
|
+
= ReturnType<preValidationHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler,
|
|
207
|
+
TypeProvider, Logger>>
|
|
208
|
+
> = Return extends ReturnType<preValidationHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig,
|
|
209
|
+
SchemaCompiler, TypeProvider, Logger>>
|
|
210
|
+
? preValidationHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider,
|
|
211
|
+
Logger>
|
|
212
|
+
: preValidationAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler,
|
|
213
|
+
TypeProvider, Logger>
|
|
196
214
|
|
|
197
215
|
/**
|
|
198
216
|
* `preHandler` is the fourth hook to be executed in the request lifecycle. The previous hook was `preValidation`, the next hook will be `preSerialization`.
|
|
@@ -243,12 +261,18 @@ export type preHandlerMetaHookHandler<
|
|
|
243
261
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
244
262
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
245
263
|
Logger extends FastifyBaseLogger = FastifyBaseLogger,
|
|
246
|
-
Return extends ReturnType<preHandlerHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig,
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
264
|
+
Return extends ReturnType<preHandlerHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig,
|
|
265
|
+
SchemaCompiler, TypeProvider, Logger>>
|
|
266
|
+
| ReturnType<preHandlerAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig,
|
|
267
|
+
SchemaCompiler, TypeProvider, Logger>>
|
|
268
|
+
= ReturnType<preHandlerHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler,
|
|
269
|
+
TypeProvider, Logger>>
|
|
270
|
+
> = Return extends ReturnType<preHandlerHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig,
|
|
271
|
+
SchemaCompiler, TypeProvider, Logger>>
|
|
272
|
+
? preHandlerHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider,
|
|
273
|
+
Logger>
|
|
274
|
+
: preHandlerAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler,
|
|
275
|
+
TypeProvider, Logger>
|
|
252
276
|
|
|
253
277
|
// This is used within the `preSerialization` and `onSend` hook handlers
|
|
254
278
|
interface DoneFuncWithErrOrRes {
|
|
@@ -312,12 +336,18 @@ export type preSerializationMetaHookHandler<
|
|
|
312
336
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
313
337
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
314
338
|
Logger extends FastifyBaseLogger = FastifyBaseLogger,
|
|
315
|
-
Return extends ReturnType<preSerializationHookHandler<PreSerializationPayload, RawServer, RawRequest, RawReply,
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
339
|
+
Return extends ReturnType<preSerializationHookHandler<PreSerializationPayload, RawServer, RawRequest, RawReply,
|
|
340
|
+
RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>>
|
|
341
|
+
| ReturnType<preSerializationAsyncHookHandler<PreSerializationPayload, RawServer, RawRequest, RawReply,
|
|
342
|
+
RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>>
|
|
343
|
+
= ReturnType<preSerializationHookHandler<PreSerializationPayload, RawServer, RawRequest, RawReply, RouteGeneric,
|
|
344
|
+
ContextConfig, SchemaCompiler, TypeProvider, Logger>>
|
|
345
|
+
> = Return extends ReturnType<preSerializationHookHandler<PreSerializationPayload, RawServer, RawRequest, RawReply,
|
|
346
|
+
RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>>
|
|
347
|
+
? preSerializationHookHandler<PreSerializationPayload, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig,
|
|
348
|
+
SchemaCompiler, TypeProvider, Logger>
|
|
349
|
+
: preSerializationAsyncHookHandler<PreSerializationPayload, RawServer, RawRequest, RawReply, RouteGeneric,
|
|
350
|
+
ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
321
351
|
|
|
322
352
|
/**
|
|
323
353
|
* You can change the payload with the `onSend` hook. It is the sixth hook to be executed in the request lifecycle. The previous hook was `preSerialization`, the next hook will be `onResponse`.
|
|
@@ -374,12 +404,18 @@ export type onSendMetaHookHandler<
|
|
|
374
404
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
375
405
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
376
406
|
Logger extends FastifyBaseLogger = FastifyBaseLogger,
|
|
377
|
-
Return extends ReturnType<onSendHookHandler<OnSendPayload, RawServer, RawRequest, RawReply, RouteGeneric,
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
407
|
+
Return extends ReturnType<onSendHookHandler<OnSendPayload, RawServer, RawRequest, RawReply, RouteGeneric,
|
|
408
|
+
ContextConfig, SchemaCompiler, TypeProvider, Logger>>
|
|
409
|
+
| ReturnType<onSendAsyncHookHandler<OnSendPayload, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig,
|
|
410
|
+
SchemaCompiler, TypeProvider, Logger>>
|
|
411
|
+
= ReturnType<onSendHookHandler<OnSendPayload, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig,
|
|
412
|
+
SchemaCompiler, TypeProvider, Logger>>
|
|
413
|
+
> = Return extends ReturnType<onSendHookHandler<OnSendPayload, RawServer, RawRequest, RawReply, RouteGeneric,
|
|
414
|
+
ContextConfig, SchemaCompiler, TypeProvider, Logger>>
|
|
415
|
+
? onSendHookHandler<OnSendPayload, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler,
|
|
416
|
+
TypeProvider, Logger>
|
|
417
|
+
: onSendAsyncHookHandler<OnSendPayload, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler,
|
|
418
|
+
TypeProvider, Logger>
|
|
383
419
|
|
|
384
420
|
/**
|
|
385
421
|
* `onResponse` is the seventh and last hook in the request hook lifecycle. The previous hook was `onSend`, there is no next hook.
|
|
@@ -431,12 +467,18 @@ export type onResponseMetaHookHandler<
|
|
|
431
467
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
432
468
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
433
469
|
Logger extends FastifyBaseLogger = FastifyBaseLogger,
|
|
434
|
-
Return extends ReturnType<onResponseHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig,
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
470
|
+
Return extends ReturnType<onResponseHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig,
|
|
471
|
+
SchemaCompiler, TypeProvider, Logger>>
|
|
472
|
+
| ReturnType<onResponseAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig,
|
|
473
|
+
SchemaCompiler, TypeProvider, Logger>>
|
|
474
|
+
= ReturnType<onResponseHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler,
|
|
475
|
+
TypeProvider, Logger>>
|
|
476
|
+
> = Return extends ReturnType<onResponseHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig,
|
|
477
|
+
SchemaCompiler, TypeProvider, Logger>>
|
|
478
|
+
? onResponseHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider,
|
|
479
|
+
Logger>
|
|
480
|
+
: onResponseAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler,
|
|
481
|
+
TypeProvider, Logger>
|
|
440
482
|
|
|
441
483
|
/**
|
|
442
484
|
* `onTimeout` is useful if you need to monitor the request timed out in your service. (if the `connectionTimeout` property is set on the fastify instance)
|
|
@@ -488,12 +530,18 @@ export type onTimeoutMetaHookHandler<
|
|
|
488
530
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
489
531
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
490
532
|
Logger extends FastifyBaseLogger = FastifyBaseLogger,
|
|
491
|
-
Return extends ReturnType<onTimeoutHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig,
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
533
|
+
Return extends ReturnType<onTimeoutHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig,
|
|
534
|
+
SchemaCompiler, TypeProvider, Logger>>
|
|
535
|
+
| ReturnType<onTimeoutAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler,
|
|
536
|
+
TypeProvider, Logger>>
|
|
537
|
+
= ReturnType<onTimeoutHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler,
|
|
538
|
+
TypeProvider, Logger>>
|
|
539
|
+
> = Return extends ReturnType<onTimeoutHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig,
|
|
540
|
+
SchemaCompiler, TypeProvider, Logger>>
|
|
541
|
+
? onTimeoutHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider,
|
|
542
|
+
Logger>
|
|
543
|
+
: onTimeoutAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler,
|
|
544
|
+
TypeProvider, Logger>
|
|
497
545
|
|
|
498
546
|
/**
|
|
499
547
|
* This hook is useful if you need to do some custom error logging or add some specific header in case of error.
|
|
@@ -552,12 +600,18 @@ export type onErrorMetaHookHandler<
|
|
|
552
600
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
553
601
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
554
602
|
Logger extends FastifyBaseLogger = FastifyBaseLogger,
|
|
555
|
-
Return extends ReturnType<onErrorHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, TError,
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
603
|
+
Return extends ReturnType<onErrorHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, TError,
|
|
604
|
+
SchemaCompiler, TypeProvider, Logger>>
|
|
605
|
+
| ReturnType<onErrorAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, TError,
|
|
606
|
+
SchemaCompiler, TypeProvider, Logger>>
|
|
607
|
+
= ReturnType<onErrorHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, TError, SchemaCompiler,
|
|
608
|
+
TypeProvider, Logger>>
|
|
609
|
+
> = Return extends ReturnType<onErrorHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, TError,
|
|
610
|
+
SchemaCompiler, TypeProvider, Logger>>
|
|
611
|
+
? onErrorHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, TError, SchemaCompiler,
|
|
612
|
+
TypeProvider, Logger>
|
|
613
|
+
: onErrorAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, TError, SchemaCompiler,
|
|
614
|
+
TypeProvider, Logger>
|
|
561
615
|
|
|
562
616
|
/**
|
|
563
617
|
* `onRequestAbort` is useful if you need to monitor the if the client aborts the request (if the `request.raw.aborted` property is set to `true`).
|
|
@@ -608,24 +662,30 @@ export type onRequestAbortMetaHookHandler<
|
|
|
608
662
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
609
663
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
610
664
|
Logger extends FastifyBaseLogger = FastifyBaseLogger,
|
|
611
|
-
Return extends ReturnType<onRequestAbortHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig,
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
665
|
+
Return extends ReturnType<onRequestAbortHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig,
|
|
666
|
+
SchemaCompiler, TypeProvider, Logger>>
|
|
667
|
+
| ReturnType<onRequestAbortAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig,
|
|
668
|
+
SchemaCompiler, TypeProvider, Logger>>
|
|
669
|
+
= ReturnType<onRequestAbortHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler,
|
|
670
|
+
TypeProvider, Logger>>
|
|
671
|
+
> = Return extends ReturnType<onRequestAbortHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig,
|
|
672
|
+
SchemaCompiler, TypeProvider, Logger>>
|
|
673
|
+
? onRequestAbortHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler,
|
|
674
|
+
TypeProvider, Logger>
|
|
675
|
+
: onRequestAbortAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler,
|
|
676
|
+
TypeProvider, Logger>
|
|
617
677
|
|
|
618
678
|
export type LifecycleHook = 'onRequest'
|
|
619
|
-
| 'preParsing'
|
|
620
|
-
| 'preValidation'
|
|
621
|
-
| 'preHandler'
|
|
622
|
-
| 'preSerialization'
|
|
623
|
-
| 'onSend'
|
|
624
|
-
| 'onResponse'
|
|
625
|
-
| 'onRequest'
|
|
626
|
-
| 'onError'
|
|
627
|
-
| 'onTimeout'
|
|
628
|
-
| 'onRequestAbort'
|
|
679
|
+
| 'preParsing'
|
|
680
|
+
| 'preValidation'
|
|
681
|
+
| 'preHandler'
|
|
682
|
+
| 'preSerialization'
|
|
683
|
+
| 'onSend'
|
|
684
|
+
| 'onResponse'
|
|
685
|
+
| 'onRequest'
|
|
686
|
+
| 'onError'
|
|
687
|
+
| 'onTimeout'
|
|
688
|
+
| 'onRequestAbort'
|
|
629
689
|
|
|
630
690
|
export type LifecycleHookLookup<K extends LifecycleHook> = K extends 'onRequest'
|
|
631
691
|
? onRequestHookHandler
|
|
@@ -692,7 +752,8 @@ export interface onRouteHookHandler<
|
|
|
692
752
|
> {
|
|
693
753
|
(
|
|
694
754
|
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
|
|
695
|
-
opts: RouteOptions<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler,
|
|
755
|
+
opts: RouteOptions<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler,
|
|
756
|
+
TypeProvider> & { routePath: string; path: string; prefix: string }
|
|
696
757
|
): Promise<unknown> | void;
|
|
697
758
|
}
|
|
698
759
|
|
|
@@ -830,11 +891,11 @@ export interface preCloseAsyncHookHandler<
|
|
|
830
891
|
}
|
|
831
892
|
|
|
832
893
|
export type ApplicationHook = 'onRoute'
|
|
833
|
-
| 'onRegister'
|
|
834
|
-
| 'onReady'
|
|
835
|
-
| 'onListen'
|
|
836
|
-
| 'onClose'
|
|
837
|
-
| 'preClose'
|
|
894
|
+
| 'onRegister'
|
|
895
|
+
| 'onReady'
|
|
896
|
+
| 'onListen'
|
|
897
|
+
| 'onClose'
|
|
898
|
+
| 'preClose'
|
|
838
899
|
|
|
839
900
|
export type ApplicationHookLookup<K extends ApplicationHook> = K extends 'onRegister'
|
|
840
901
|
? onRegisterHookHandler
|