fastify 3.27.2 → 4.0.0-alpha.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.
Files changed (116) hide show
  1. package/README.md +5 -4
  2. package/build/build-error-serializer.js +27 -0
  3. package/build/build-validation.js +47 -35
  4. package/docs/Migration-Guide-V4.md +12 -0
  5. package/docs/Reference/ContentTypeParser.md +4 -0
  6. package/docs/Reference/Errors.md +51 -6
  7. package/docs/Reference/Hooks.md +4 -7
  8. package/docs/Reference/LTS.md +5 -4
  9. package/docs/Reference/Reply.md +23 -22
  10. package/docs/Reference/Request.md +1 -3
  11. package/docs/Reference/Routes.md +17 -10
  12. package/docs/Reference/Server.md +48 -63
  13. package/docs/Reference/TypeScript.md +11 -13
  14. package/docs/Reference/Validation-and-Serialization.md +28 -53
  15. package/docs/Type-Providers.md +257 -0
  16. package/examples/hooks.js +1 -1
  17. package/examples/simple-stream.js +18 -0
  18. package/fastify.d.ts +34 -22
  19. package/fastify.js +37 -35
  20. package/lib/configValidator.js +902 -1023
  21. package/lib/contentTypeParser.js +6 -16
  22. package/lib/context.js +36 -10
  23. package/lib/decorate.js +3 -1
  24. package/lib/error-handler.js +158 -0
  25. package/lib/error-serializer.js +257 -0
  26. package/lib/errors.js +43 -9
  27. package/lib/fourOhFour.js +31 -20
  28. package/lib/handleRequest.js +10 -13
  29. package/lib/hooks.js +14 -9
  30. package/lib/pluginOverride.js +0 -3
  31. package/lib/pluginUtils.js +3 -2
  32. package/lib/reply.js +28 -157
  33. package/lib/request.js +13 -10
  34. package/lib/route.js +131 -138
  35. package/lib/schema-controller.js +2 -2
  36. package/lib/schemas.js +27 -1
  37. package/lib/server.js +219 -116
  38. package/lib/symbols.js +4 -3
  39. package/lib/validation.js +2 -1
  40. package/lib/warnings.js +2 -12
  41. package/lib/wrapThenable.js +4 -11
  42. package/package.json +31 -35
  43. package/test/404s.test.js +243 -110
  44. package/test/500s.test.js +2 -2
  45. package/test/async-await.test.js +13 -69
  46. package/test/content-parser.test.js +32 -0
  47. package/test/context-config.test.js +52 -0
  48. package/test/custom-http-server.test.js +14 -7
  49. package/test/custom-parser-async.test.js +0 -65
  50. package/test/custom-parser.test.js +54 -121
  51. package/test/decorator.test.js +1 -3
  52. package/test/delete.test.js +5 -5
  53. package/test/encapsulated-error-handler.test.js +50 -0
  54. package/test/esm/index.test.js +0 -14
  55. package/test/fastify-instance.test.js +4 -4
  56. package/test/fluent-schema.test.js +4 -4
  57. package/test/get.test.js +3 -3
  58. package/test/helper.js +18 -3
  59. package/test/hooks-async.test.js +14 -47
  60. package/test/hooks.on-ready.test.js +9 -4
  61. package/test/hooks.test.js +58 -99
  62. package/test/http2/closing.test.js +5 -11
  63. package/test/http2/unknown-http-method.test.js +3 -9
  64. package/test/https/custom-https-server.test.js +12 -6
  65. package/test/input-validation.js +2 -2
  66. package/test/internals/handleRequest.test.js +3 -40
  67. package/test/internals/initialConfig.test.js +33 -12
  68. package/test/internals/reply.test.js +245 -3
  69. package/test/internals/request.test.js +13 -7
  70. package/test/internals/server.test.js +88 -0
  71. package/test/listen.test.js +84 -1
  72. package/test/logger.test.js +80 -40
  73. package/test/maxRequestsPerSocket.test.js +6 -4
  74. package/test/middleware.test.js +2 -25
  75. package/test/nullable-validation.test.js +51 -14
  76. package/test/plugin.test.js +31 -5
  77. package/test/pretty-print.test.js +22 -10
  78. package/test/reply-error.test.js +123 -12
  79. package/test/request-error.test.js +2 -5
  80. package/test/route-hooks.test.js +17 -17
  81. package/test/route-prefix.test.js +2 -1
  82. package/test/route.test.js +204 -20
  83. package/test/router-options.test.js +1 -1
  84. package/test/schema-examples.test.js +11 -5
  85. package/test/schema-feature.test.js +24 -19
  86. package/test/schema-serialization.test.js +9 -9
  87. package/test/schema-special-usage.test.js +14 -81
  88. package/test/schema-validation.test.js +9 -9
  89. package/test/skip-reply-send.test.js +1 -1
  90. package/test/stream.test.js +23 -12
  91. package/test/throw.test.js +8 -5
  92. package/test/type-provider.test.js +20 -0
  93. package/test/types/fastify.test-d.ts +10 -18
  94. package/test/types/import.js +2 -0
  95. package/test/types/import.ts +1 -0
  96. package/test/types/instance.test-d.ts +35 -14
  97. package/test/types/logger.test-d.ts +44 -15
  98. package/test/types/route.test-d.ts +8 -2
  99. package/test/types/schema.test-d.ts +2 -39
  100. package/test/types/type-provider.test-d.ts +417 -0
  101. package/test/validation-error-handling.test.js +8 -8
  102. package/test/versioned-routes.test.js +28 -16
  103. package/test/wrapThenable.test.js +7 -6
  104. package/types/content-type-parser.d.ts +17 -8
  105. package/types/hooks.d.ts +102 -59
  106. package/types/instance.d.ts +124 -104
  107. package/types/logger.d.ts +18 -104
  108. package/types/plugin.d.ts +10 -4
  109. package/types/reply.d.ts +16 -11
  110. package/types/request.d.ts +10 -5
  111. package/types/route.d.ts +42 -31
  112. package/types/schema.d.ts +1 -1
  113. package/types/type-provider.d.ts +99 -0
  114. package/types/utils.d.ts +1 -1
  115. package/lib/schema-compilers.js +0 -12
  116. package/test/emit-warning.test.js +0 -166
@@ -15,6 +15,7 @@ import { FastifyRequest } from './request'
15
15
  import { FastifyReply } from './reply'
16
16
  import { FastifyError } from 'fastify-error'
17
17
  import { AddContentTypeParser, hasContentTypeParser, getDefaultJsonParser, ProtoAction, ConstructorAction, FastifyBodyParser, removeContentTypeParser, removeAllContentTypeParsers } from './content-type-parser'
18
+ import { FastifyTypeProvider, FastifyTypeProviderDefault } from './type-provider'
18
19
 
19
20
  export interface PrintRoutesOptions {
20
21
  includeMeta?: boolean | (string | symbol)[]
@@ -22,6 +23,8 @@ export interface PrintRoutesOptions {
22
23
  includeHooks?: boolean
23
24
  }
24
25
 
26
+ type NotInInterface<Key, _Interface> = Key extends keyof _Interface ? never : Key
27
+
25
28
  /**
26
29
  * Fastify server instance. Returned by the core `fastify()` method.
27
30
  */
@@ -29,19 +32,22 @@ export interface FastifyInstance<
29
32
  RawServer extends RawServerBase = RawServerDefault,
30
33
  RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
31
34
  RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
32
- Logger = FastifyLoggerInstance
35
+ Logger = FastifyLoggerInstance,
36
+ TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
33
37
  > {
34
38
  server: RawServer;
35
39
  prefix: string;
36
40
  version: string;
37
41
  log: Logger;
38
42
 
39
- addSchema(schema: unknown): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
43
+ withTypeProvider<Provider extends FastifyTypeProvider>(): FastifyInstance<RawServer, RawRequest, RawReply, Logger, Provider>;
44
+
45
+ addSchema(schema: unknown): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
40
46
  getSchema(schemaId: string): unknown;
41
47
  getSchemas(): Record<string, unknown>;
42
48
 
43
- after(): FastifyInstance<RawServer, RawRequest, RawReply, Logger> & PromiseLike<undefined>;
44
- after(afterListener: (err: Error) => void): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
49
+ after(): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider> & PromiseLike<undefined>;
50
+ after(afterListener: (err: Error) => void): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
45
51
 
46
52
  close(): Promise<undefined>;
47
53
  close(closeListener: () => void): undefined;
@@ -49,24 +55,24 @@ export interface FastifyInstance<
49
55
  // should be able to define something useful with the decorator getter/setter pattern using Generics to enforce the users function returns what they expect it to
50
56
  decorate<T>(property: string | symbol,
51
57
  value: T extends (...args: any[]) => any
52
- ? (this: FastifyInstance<RawServer, RawRequest, RawReply, Logger>, ...args: Parameters<T>) => ReturnType<T>
58
+ ? (this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>, ...args: Parameters<T>) => ReturnType<T>
53
59
  : T,
54
60
  dependencies?: string[]
55
- ): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
61
+ ): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
56
62
 
57
63
  decorateRequest<T>(property: string | symbol,
58
64
  value: T extends (...args: any[]) => any
59
65
  ? (this: FastifyRequest, ...args: Parameters<T>) => ReturnType<T>
60
66
  : T,
61
67
  dependencies?: string[]
62
- ): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
68
+ ): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
63
69
 
64
70
  decorateReply<T>(property: string | symbol,
65
71
  value: T extends (...args: any[]) => any
66
72
  ? (this: FastifyReply, ...args: Parameters<T>) => ReturnType<T>
67
73
  : T,
68
74
  dependencies?: string[]
69
- ): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
75
+ ): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
70
76
 
71
77
  hasDecorator(decorator: string | symbol): boolean;
72
78
  hasRequestDecorator(decorator: string | symbol): boolean;
@@ -83,10 +89,10 @@ export interface FastifyInstance<
83
89
  listen(opts: { port: number; host?: string; backlog?: number }, callback: (err: Error|null, address: string) => void): void;
84
90
  listen(opts: { port: number; host?: string; backlog?: number }): Promise<string>;
85
91
 
86
- ready(): FastifyInstance<RawServer, RawRequest, RawReply> & PromiseLike<undefined>;
87
- ready(readyListener: (err: Error) => void): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
92
+ ready(): FastifyInstance<RawServer, RawRequest, RawReply, FastifyLoggerInstance, TypeProvider> & PromiseLike<undefined>;
93
+ ready(readyListener: (err: Error) => void): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
88
94
 
89
- register: FastifyRegister<FastifyInstance<RawServer, RawRequest, RawReply, Logger> & PromiseLike<undefined>>;
95
+ register: FastifyRegister<FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider> & PromiseLike<undefined>>;
90
96
 
91
97
  routing(req: RawRequest, res: RawReply): void;
92
98
  getDefaultRoute: DefaultRoute<RawRequest, RawReply>;
@@ -96,16 +102,16 @@ export interface FastifyInstance<
96
102
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
97
103
  ContextConfig = ContextConfigDefault,
98
104
  SchemaCompiler = FastifySchema,
99
- >(opts: RouteOptions<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler>): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
105
+ >(opts: RouteOptions<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
100
106
 
101
- get: RouteShorthandMethod<RawServer, RawRequest, RawReply>;
102
- head: RouteShorthandMethod<RawServer, RawRequest, RawReply>;
103
- post: RouteShorthandMethod<RawServer, RawRequest, RawReply>;
104
- put: RouteShorthandMethod<RawServer, RawRequest, RawReply>;
105
- delete: RouteShorthandMethod<RawServer, RawRequest, RawReply>;
106
- options: RouteShorthandMethod<RawServer, RawRequest, RawReply>;
107
- patch: RouteShorthandMethod<RawServer, RawRequest, RawReply>;
108
- all: RouteShorthandMethod<RawServer, RawRequest, RawReply>;
107
+ get: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider>;
108
+ head: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider>;
109
+ post: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider>;
110
+ put: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider>;
111
+ delete: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider>;
112
+ options: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider>;
113
+ patch: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider>;
114
+ all: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider>;
109
115
 
110
116
  // addHook: overloads
111
117
 
@@ -117,19 +123,21 @@ export interface FastifyInstance<
117
123
  */
118
124
  addHook<
119
125
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
120
- ContextConfig = ContextConfigDefault
126
+ ContextConfig = ContextConfigDefault,
127
+ SchemaCompiler extends FastifySchema = FastifySchema
121
128
  >(
122
129
  name: 'onRequest',
123
- hook: onRequestHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
124
- ): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
130
+ hook: onRequestHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>
131
+ ): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
125
132
 
126
133
  addHook<
127
134
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
128
- ContextConfig = ContextConfigDefault
135
+ ContextConfig = ContextConfigDefault,
136
+ SchemaCompiler extends FastifySchema = FastifySchema
129
137
  >(
130
138
  name: 'onRequest',
131
- hook: onRequestAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
132
- ): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
139
+ hook: onRequestAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>
140
+ ): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
133
141
 
134
142
  /**
135
143
  * `preParsing` is the second hook to be executed in the request lifecycle. The previous hook was `onRequest`, the next hook will be `preValidation`.
@@ -137,57 +145,63 @@ export interface FastifyInstance<
137
145
  */
138
146
  addHook<
139
147
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
140
- ContextConfig = ContextConfigDefault
148
+ ContextConfig = ContextConfigDefault,
149
+ SchemaCompiler extends FastifySchema = FastifySchema
141
150
  >(
142
151
  name: 'preParsing',
143
- hook: preParsingHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
144
- ): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
152
+ hook: preParsingHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>
153
+ ): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
145
154
 
146
155
  addHook<
147
156
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
148
- ContextConfig = ContextConfigDefault
157
+ ContextConfig = ContextConfigDefault,
158
+ SchemaCompiler extends FastifySchema = FastifySchema
149
159
  >(
150
160
  name: 'preParsing',
151
- hook: preParsingAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
152
- ): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
161
+ hook: preParsingAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>
162
+ ): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
153
163
 
154
164
  /**
155
165
  * `preValidation` is the third hook to be executed in the request lifecycle. The previous hook was `preParsing`, the next hook will be `preHandler`.
156
166
  */
157
167
  addHook<
158
168
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
159
- ContextConfig = ContextConfigDefault
169
+ ContextConfig = ContextConfigDefault,
170
+ SchemaCompiler extends FastifySchema = FastifySchema
160
171
  >(
161
172
  name: 'preValidation',
162
- hook: preValidationHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
163
- ): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
173
+ hook: preValidationHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>
174
+ ): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
164
175
 
165
176
  addHook<
166
177
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
167
- ContextConfig = ContextConfigDefault
178
+ ContextConfig = ContextConfigDefault,
179
+ SchemaCompiler extends FastifySchema = FastifySchema
168
180
  >(
169
181
  name: 'preValidation',
170
- hook: preValidationAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
171
- ): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
182
+ hook: preValidationAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>
183
+ ): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
172
184
 
173
185
  /**
174
186
  * `preHandler` is the fourth hook to be executed in the request lifecycle. The previous hook was `preValidation`, the next hook will be `preSerialization`.
175
187
  */
176
188
  addHook<
177
189
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
178
- ContextConfig = ContextConfigDefault
190
+ ContextConfig = ContextConfigDefault,
191
+ SchemaCompiler extends FastifySchema = FastifySchema
179
192
  >(
180
193
  name: 'preHandler',
181
- hook: preHandlerHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
182
- ): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
194
+ hook: preHandlerHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>
195
+ ): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
183
196
 
184
197
  addHook<
185
198
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
186
- ContextConfig = ContextConfigDefault
199
+ ContextConfig = ContextConfigDefault,
200
+ SchemaCompiler extends FastifySchema = FastifySchema
187
201
  >(
188
202
  name: 'preHandler',
189
- hook: preHandlerAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
190
- ): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
203
+ hook: preHandlerAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>
204
+ ): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
191
205
 
192
206
  /**
193
207
  * `preSerialization` is the fifth hook to be executed in the request lifecycle. The previous hook was `preHandler`, the next hook will be `onSend`.
@@ -196,20 +210,22 @@ export interface FastifyInstance<
196
210
  addHook<
197
211
  PreSerializationPayload = unknown,
198
212
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
199
- ContextConfig = ContextConfigDefault
213
+ ContextConfig = ContextConfigDefault,
214
+ SchemaCompiler extends FastifySchema = FastifySchema
200
215
  >(
201
216
  name: 'preSerialization',
202
- hook: preSerializationHookHandler<PreSerializationPayload, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
203
- ): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
217
+ hook: preSerializationHookHandler<PreSerializationPayload, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>
218
+ ): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
204
219
 
205
220
  addHook<
206
221
  PreSerializationPayload = unknown,
207
222
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
208
- ContextConfig = ContextConfigDefault
223
+ ContextConfig = ContextConfigDefault,
224
+ SchemaCompiler extends FastifySchema = FastifySchema
209
225
  >(
210
226
  name: 'preSerialization',
211
- hook: preSerializationAsyncHookHandler<PreSerializationPayload, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
212
- ): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
227
+ hook: preSerializationAsyncHookHandler<PreSerializationPayload, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>
228
+ ): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
213
229
 
214
230
  /**
215
231
  * 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`.
@@ -218,20 +234,22 @@ export interface FastifyInstance<
218
234
  addHook<
219
235
  OnSendPayload = unknown,
220
236
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
221
- ContextConfig = ContextConfigDefault
237
+ ContextConfig = ContextConfigDefault,
238
+ SchemaCompiler extends FastifySchema = FastifySchema
222
239
  >(
223
240
  name: 'onSend',
224
- hook: onSendHookHandler<OnSendPayload, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
225
- ): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
241
+ hook: onSendHookHandler<OnSendPayload, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>
242
+ ): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
226
243
 
227
244
  addHook<
228
245
  OnSendPayload = unknown,
229
246
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
230
- ContextConfig = ContextConfigDefault
247
+ ContextConfig = ContextConfigDefault,
248
+ SchemaCompiler extends FastifySchema = FastifySchema
231
249
  >(
232
250
  name: 'onSend',
233
- hook: onSendAsyncHookHandler<OnSendPayload, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
234
- ): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
251
+ hook: onSendAsyncHookHandler<OnSendPayload, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>
252
+ ): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
235
253
 
236
254
  /**
237
255
  * `onResponse` is the seventh and last hook in the request hook lifecycle. The previous hook was `onSend`, there is no next hook.
@@ -239,19 +257,21 @@ export interface FastifyInstance<
239
257
  */
240
258
  addHook<
241
259
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
242
- ContextConfig = ContextConfigDefault
260
+ ContextConfig = ContextConfigDefault,
261
+ SchemaCompiler extends FastifySchema = FastifySchema
243
262
  >(
244
263
  name: 'onResponse',
245
- hook: onResponseHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
246
- ): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
264
+ hook: onResponseHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>
265
+ ): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
247
266
 
248
267
  addHook<
249
268
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
250
- ContextConfig = ContextConfigDefault
269
+ ContextConfig = ContextConfigDefault,
270
+ SchemaCompiler extends FastifySchema = FastifySchema
251
271
  >(
252
272
  name: 'onResponse',
253
- hook: onResponseAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
254
- ): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
273
+ hook: onResponseAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>
274
+ ): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
255
275
 
256
276
  /**
257
277
  * `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)
@@ -259,19 +279,21 @@ export interface FastifyInstance<
259
279
  */
260
280
  addHook<
261
281
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
262
- ContextConfig = ContextConfigDefault
282
+ ContextConfig = ContextConfigDefault,
283
+ SchemaCompiler extends FastifySchema = FastifySchema
263
284
  >(
264
285
  name: 'onTimeout',
265
- hook: onTimeoutHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
266
- ): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
286
+ hook: onTimeoutHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>
287
+ ): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
267
288
 
268
289
  addHook<
269
290
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
270
- ContextConfig = ContextConfigDefault
291
+ ContextConfig = ContextConfigDefault,
292
+ SchemaCompiler extends FastifySchema = FastifySchema
271
293
  >(
272
294
  name: 'onTimeout',
273
- hook: onTimeoutAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
274
- ): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
295
+ hook: onTimeoutAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>
296
+ ): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
275
297
 
276
298
  /**
277
299
  * This hook is useful if you need to do some custom error logging or add some specific header in case of error.
@@ -281,19 +303,21 @@ export interface FastifyInstance<
281
303
  */
282
304
  addHook<
283
305
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
284
- ContextConfig = ContextConfigDefault
306
+ ContextConfig = ContextConfigDefault,
307
+ SchemaCompiler extends FastifySchema = FastifySchema
285
308
  >(
286
309
  name: 'onError',
287
- hook: onErrorHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
288
- ): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
310
+ hook: onErrorHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, FastifyError, SchemaCompiler, TypeProvider>
311
+ ): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
289
312
 
290
313
  addHook<
291
314
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
292
- ContextConfig = ContextConfigDefault
315
+ ContextConfig = ContextConfigDefault,
316
+ SchemaCompiler extends FastifySchema = FastifySchema
293
317
  >(
294
318
  name: 'onError',
295
- hook: onErrorAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
296
- ): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
319
+ hook: onErrorAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, FastifyError, SchemaCompiler, TypeProvider>
320
+ ): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
297
321
 
298
322
  // Application addHooks
299
323
 
@@ -302,11 +326,12 @@ export interface FastifyInstance<
302
326
  */
303
327
  addHook<
304
328
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
305
- ContextConfig = ContextConfigDefault
329
+ ContextConfig = ContextConfigDefault,
330
+ SchemaCompiler extends FastifySchema = FastifySchema
306
331
  >(
307
332
  name: 'onRoute',
308
- hook: onRouteHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
309
- ): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
333
+ hook: onRouteHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>
334
+ ): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
310
335
 
311
336
  /**
312
337
  * Triggered when a new plugin is registered and a new encapsulation context is created. The hook will be executed before the registered code.
@@ -315,8 +340,8 @@ export interface FastifyInstance<
315
340
  */
316
341
  addHook(
317
342
  name: 'onRegister',
318
- hook: onRegisterHookHandler<RawServer, RawRequest, RawReply, Logger>
319
- ): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
343
+ hook: onRegisterHookHandler<RawServer, RawRequest, RawReply, Logger, TypeProvider>
344
+ ): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
320
345
 
321
346
  /**
322
347
  * 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.
@@ -324,20 +349,20 @@ export interface FastifyInstance<
324
349
  addHook(
325
350
  name: 'onReady',
326
351
  hook: onReadyHookHandler
327
- ): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
352
+ ): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
328
353
 
329
354
  addHook(
330
355
  name: 'onReady',
331
356
  hook: onReadyAsyncHookHandler,
332
- ): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
357
+ ): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
333
358
 
334
359
  /**
335
360
  * Triggered when fastify.close() is invoked to stop the server. It is useful when plugins need a "shutdown" event, for example to close an open connection to a database.
336
361
  */
337
362
  addHook(
338
363
  name: 'onClose',
339
- hook: onCloseHookHandler<RawServer, RawRequest, RawReply, Logger>
340
- ): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
364
+ hook: onCloseHookHandler<RawServer, RawRequest, RawReply, Logger, TypeProvider>
365
+ ): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
341
366
 
342
367
  addHook(
343
368
  name: 'onClose',
@@ -347,17 +372,17 @@ export interface FastifyInstance<
347
372
  /**
348
373
  * Set the 404 handler
349
374
  */
350
- setNotFoundHandler<RouteGeneric extends RouteGenericInterface = RouteGenericInterface> (
351
- handler: (request: FastifyRequest<RouteGeneric, RawServer, RawRequest>, reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric>) => void
352
- ): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
375
+ setNotFoundHandler<RouteGeneric extends RouteGenericInterface = RouteGenericInterface, TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault, SchemaCompiler extends FastifySchema = FastifySchema> (
376
+ handler: (request: FastifyRequest<RouteGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider>, reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfigDefault, SchemaCompiler, TypeProvider>) => void
377
+ ): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
353
378
 
354
- setNotFoundHandler<RouteGeneric extends RouteGenericInterface = RouteGenericInterface, ContextConfig extends ContextConfigDefault = ContextConfigDefault> (
379
+ setNotFoundHandler<RouteGeneric extends RouteGenericInterface = RouteGenericInterface, ContextConfig extends ContextConfigDefault = ContextConfigDefault, TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault, SchemaCompiler extends FastifySchema = FastifySchema> (
355
380
  opts: {
356
- preValidation?: preValidationHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig> | preValidationHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>[];
357
- preHandler?: preHandlerHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig> | preHandlerHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>[];
381
+ preValidation?: preValidationHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider> | preValidationHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>[];
382
+ preHandler?: preHandlerHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider> | preHandlerHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>[];
358
383
  },
359
- handler: (request: FastifyRequest<RouteGeneric, RawServer, RawRequest>, reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric>) => void
360
- ): FastifyInstance<RawServer, RawRequest, RawReply, Logger>
384
+ handler: (request: FastifyRequest<RouteGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider>, reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfigDefault, SchemaCompiler, TypeProvider>) => void
385
+ ): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>
361
386
 
362
387
  /**
363
388
  * Fastify default error handler
@@ -367,24 +392,19 @@ export interface FastifyInstance<
367
392
  /**
368
393
  * Set a function that will be called whenever an error happens
369
394
  */
370
- setErrorHandler<TError extends Error = FastifyError, RouteGeneric extends RouteGenericInterface = RouteGenericInterface>(
371
- handler: (
372
- this: FastifyInstance<RawServer, RawRequest, RawReply, Logger>,
373
- error: TError,
374
- request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
375
- reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric>
376
- ) => void | Promise<RouteGeneric['Reply'] | void>
377
- ): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
395
+ setErrorHandler<TError extends Error = FastifyError, RouteGeneric extends RouteGenericInterface = RouteGenericInterface, SchemaCompiler extends FastifySchema = FastifySchema, TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault>(
396
+ handler: (this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>, error: TError, request: FastifyRequest<RouteGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider>, reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfigDefault, SchemaCompiler, TypeProvider>) => any | Promise<any>
397
+ ): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
378
398
 
379
399
  /**
380
400
  * Set the schema validator for all routes.
381
401
  */
382
- setValidatorCompiler<T = FastifySchema>(schemaCompiler: FastifySchemaCompiler<T>): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
402
+ setValidatorCompiler<T = FastifySchema>(schemaCompiler: FastifySchemaCompiler<T>): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
383
403
 
384
404
  /**
385
405
  * Set the schema serializer for all routes.
386
406
  */
387
- setSerializerCompiler<T = FastifySchema>(schemaCompiler: FastifySerializerCompiler<T>): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
407
+ setSerializerCompiler<T = FastifySchema>(schemaCompiler: FastifySerializerCompiler<T>): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
388
408
 
389
409
  /**
390
410
  * Set the schema controller for all routes.
@@ -394,16 +414,16 @@ export interface FastifyInstance<
394
414
  /**
395
415
  * Set the reply serializer for all routes.
396
416
  */
397
- setReplySerializer(replySerializer: (payload: unknown, statusCode: number) => string): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
417
+ setReplySerializer(replySerializer: (payload: unknown, statusCode: number) => string): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
398
418
 
399
419
  /*
400
420
  * Set the schema error formatter for all routes.
401
421
  */
402
- setSchemaErrorFormatter(errorFormatter: (errors: FastifySchemaValidationError[], dataVar: string) => Error): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
422
+ setSchemaErrorFormatter(errorFormatter: (errors: FastifySchemaValidationError[], dataVar: string) => Error): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
403
423
  /**
404
424
  * Add a content type parser
405
425
  */
406
- addContentTypeParser: AddContentTypeParser<RawServer, RawRequest>;
426
+ addContentTypeParser: AddContentTypeParser<RawServer, RawRequest, RouteGenericInterface, FastifySchema, TypeProvider>;
407
427
  hasContentTypeParser: hasContentTypeParser;
408
428
  /**
409
429
  * Remove an existing content type parser
package/types/logger.d.ts CHANGED
@@ -1,127 +1,42 @@
1
- /*
2
- * Rationale for not directly importing types from @types/pino for use in fastify interfaces:
3
- * - pino does not itself provide types so the types from @types must be used.
4
- * - the types from @types are unofficial and the preference is to avoid using them or requiring them as a dependency of fastify.
5
- * - the goal is to provide the minimum viable type definitions necessary to use fastify's official logger, pino.
6
- * - the types provided should cover the basic use cases for the majority of fastify users while also being easy to maintain.
7
- * - for advanced use cases needing the full set of types, users should be directed to manually install the unofficial types with
8
- * `npm i -D @types/pino` and to supply their own logger instance as described at https://www.fastify.io/docs/latest/Logging/.
9
- * - some fastify contributors have volunteered to maintain official types within pino (https://github.com/pinojs/pino/issues/910)
10
- * in which case if the proposal is followed through with then in the future fastify will be able to directly import the full
11
- * set of types rather than only duplicating and maintaining the subset chosen for providing a minimum viable logger api.
12
- *
13
- * Relevant discussions:
14
- *
15
- * https://github.com/fastify/fastify/pull/2550
16
- * https://github.com/pinojs/pino/issues/910
17
- * https://github.com/fastify/fastify/pull/1532
18
- * https://github.com/fastify/fastify/issues/649
19
- */
20
-
21
1
  import { FastifyError } from 'fastify-error'
22
- import { RawServerBase, RawServerDefault, RawRequestDefaultExpression, RawReplyDefaultExpression } from './utils'
23
2
  import { RouteGenericInterface } from './route'
24
3
  import { FastifyRequest } from './request'
25
4
  import { FastifyReply } from './reply'
5
+ import { RawServerBase, RawServerDefault, RawRequestDefaultExpression, RawReplyDefaultExpression, ContextConfigDefault } from './utils'
6
+ import { FastifyTypeProvider, FastifyTypeProviderDefault } from './type-provider'
7
+ import { FastifySchema } from './schema'
8
+
9
+ import pino from 'pino'
26
10
 
27
11
  /**
28
12
  * Standard Fastify logging function
29
13
  */
30
- export interface FastifyLogFn {
31
- (msg: string, ...args: unknown[]): void;
32
- (obj: unknown, msg?: string, ...args: unknown[]): void;
33
- }
14
+ export type FastifyLogFn = pino.LogFn
34
15
 
35
- export type LogLevel = 'info' | 'error' | 'debug' | 'fatal' | 'warn' | 'trace'
16
+ export type LogLevel = pino.Level
36
17
 
37
- export type SerializerFn = (value: unknown) => unknown;
18
+ export type Bindings = pino.Bindings
38
19
 
39
- export interface Bindings {
40
- level?: LogLevel | string;
41
- serializers?: { [key: string]: SerializerFn };
42
- [key: string]: unknown;
43
- }
44
-
45
- export interface FastifyLoggerInstance {
46
- info: FastifyLogFn;
47
- warn: FastifyLogFn;
48
- error: FastifyLogFn;
49
- fatal: FastifyLogFn;
50
- trace: FastifyLogFn;
51
- debug: FastifyLogFn;
52
- child(bindings: Bindings): FastifyLoggerInstance;
53
- }
54
-
55
- // This interface is accurate for pino 6.3 and was copied from the following permalink:
56
- // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/72c9bd83316bd31e93ab86d64ddf598d922f33cd/types/pino/index.d.ts#L514-L567
57
- export interface PrettyOptions {
58
- /**
59
- * Translate the epoch time value into a human readable date and time string.
60
- * This flag also can set the format string to apply when translating the date to human readable format.
61
- * The default format is yyyy-mm-dd HH:MM:ss.l o in UTC.
62
- * For a list of available pattern letters see the {@link https://www.npmjs.com/package/dateformat|dateformat documentation}.
63
- */
64
- translateTime?: boolean | string;
65
- /**
66
- * If set to true, it will print the name of the log level as the first field in the log line. Default: `false`.
67
- */
68
- levelFirst?: boolean;
69
- /**
70
- * The key in the JSON object to use as the highlighted message. Default: "msg".
71
- */
72
- messageKey?: string;
73
- /**
74
- * The key in the JSON object to use for timestamp display. Default: "time".
75
- */
76
- timestampKey?: string;
77
- /**
78
- * Format output of message, e.g. {level} - {pid} will output message: INFO - 1123 Default: `false`.
79
- */
80
- messageFormat?: false | string;
81
- /**
82
- * If set to true, will add color information to the formatted output message. Default: `false`.
83
- */
84
- colorize?: boolean;
85
- /**
86
- * Appends carriage return and line feed, instead of just a line feed, to the formatted log line.
87
- */
88
- crlf?: boolean;
89
- /**
90
- * Define the log keys that are associated with error like objects. Default: ["err", "error"]
91
- */
92
- errorLikeObjectKeys?: string[];
93
- /**
94
- * When formatting an error object, display this list of properties.
95
- * The list should be a comma separated list of properties. Default: ''
96
- */
97
- errorProps?: string;
98
- /**
99
- * Specify a search pattern according to {@link http://jmespath.org|jmespath}
100
- */
101
- search?: string;
102
- /**
103
- * Ignore one or several keys. Example: "time,hostname"
104
- */
105
- ignore?: string;
106
- /**
107
- * Suppress warning on first synchronous flushing.
108
- */
109
- suppressFlushSyncWarning?: boolean;
20
+ export type FastifyLoggerInstance = pino.Logger
21
+ // TODO make pino export BaseLogger again
22
+ // export type FastifyBaseLogger = pino.BaseLogger & {
23
+ export type FastifyBaseLogger = pino.Logger & {
24
+ child(bindings: Bindings): FastifyBaseLogger
110
25
  }
111
26
 
112
27
  export interface FastifyLoggerStreamDestination {
113
28
  write(msg: string): void;
114
29
  }
115
30
 
31
+ export type PinoLoggerOptions = pino.LoggerOptions
32
+
116
33
  /**
117
- * Fastify Custom Logger options. To enable configuration of all Pino options,
118
- * refer to this example:
119
- * https://github.com/fastify/fastify/blob/2f56e10a24ecb70c2c7950bfffd60eda8f7782a6/docs/TypeScript.md#example-5-specifying-logger-types
34
+ * Fastify Custom Logger options.
120
35
  */
121
36
  export interface FastifyLoggerOptions<
122
37
  RawServer extends RawServerBase = RawServerDefault,
123
- RawRequest extends FastifyRequest<RouteGenericInterface, RawServer, RawRequestDefaultExpression<RawServer>> = FastifyRequest<RouteGenericInterface, RawServer, RawRequestDefaultExpression<RawServer>>,
124
- RawReply extends FastifyReply<RawServer, RawRequestDefaultExpression<RawServer>, RawReplyDefaultExpression<RawServer>> = FastifyReply<RawServer, RawRequestDefaultExpression<RawServer>, RawReplyDefaultExpression<RawServer>>
38
+ RawRequest extends FastifyRequest<RouteGenericInterface, RawServer, RawRequestDefaultExpression<RawServer>, FastifySchema, FastifyTypeProvider> = FastifyRequest<RouteGenericInterface, RawServer, RawRequestDefaultExpression<RawServer>, FastifySchema, FastifyTypeProviderDefault>,
39
+ RawReply extends FastifyReply<RawServer, RawRequestDefaultExpression<RawServer>, RawReplyDefaultExpression<RawServer>, RouteGenericInterface, ContextConfigDefault, FastifySchema, FastifyTypeProvider> = FastifyReply<RawServer, RawRequestDefaultExpression<RawServer>, RawReplyDefaultExpression<RawServer>, RouteGenericInterface, ContextConfigDefault, FastifySchema, FastifyTypeProviderDefault>,
125
40
  > {
126
41
  serializers?: {
127
42
  req?: (req: RawRequest) => {
@@ -147,6 +62,5 @@ export interface FastifyLoggerOptions<
147
62
  level?: string;
148
63
  file?: string;
149
64
  genReqId?: (req: RawRequest) => string;
150
- prettyPrint?: boolean | PrettyOptions;
151
65
  stream?: FastifyLoggerStreamDestination;
152
66
  }