fastify 4.9.1 → 4.9.2
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/fastify.js +1 -1
- package/package.json +1 -1
- package/test/logger.test.js +0 -14
- package/test/types/logger.test-d.ts +1 -3
- package/test/types/request.test-d.ts +3 -2
- package/types/context.d.ts +3 -0
- package/types/hooks.d.ts +25 -25
- package/types/instance.d.ts +21 -21
- package/types/logger.d.ts +3 -7
- package/types/plugin.d.ts +3 -3
- package/types/reply.d.ts +3 -4
- package/types/request.d.ts +5 -3
- package/types/route.d.ts +9 -9
package/fastify.js
CHANGED
package/package.json
CHANGED
package/test/logger.test.js
CHANGED
|
@@ -1687,17 +1687,3 @@ test('should not throw error when serializing custom req', t => {
|
|
|
1687
1687
|
|
|
1688
1688
|
t.same(lines[0].req, {})
|
|
1689
1689
|
})
|
|
1690
|
-
|
|
1691
|
-
test('set bindings', t => {
|
|
1692
|
-
t.plan(1)
|
|
1693
|
-
|
|
1694
|
-
const stream = split(JSON.parse)
|
|
1695
|
-
stream.once('data', info => {
|
|
1696
|
-
t.same(info.hello, 'world')
|
|
1697
|
-
})
|
|
1698
|
-
|
|
1699
|
-
const fastify = Fastify({ logger: { level: 'info', stream } })
|
|
1700
|
-
|
|
1701
|
-
fastify.log.setBindings({ hello: 'world' })
|
|
1702
|
-
fastify.log.info('hello world')
|
|
1703
|
-
})
|
|
@@ -10,7 +10,6 @@ import fastify, {
|
|
|
10
10
|
import { Server, IncomingMessage, ServerResponse } from 'http'
|
|
11
11
|
import * as fs from 'fs'
|
|
12
12
|
import P from 'pino'
|
|
13
|
-
import { DefaultFastifyLogger } from '../../types/logger'
|
|
14
13
|
|
|
15
14
|
expectType<FastifyLoggerInstance>(fastify().log)
|
|
16
15
|
|
|
@@ -25,7 +24,7 @@ class Foo {}
|
|
|
25
24
|
expectType<void>(fastify<Server, IncomingMessage, ServerResponse, FastifyLoggerInstance>().log[logLevel as LogLevel](new Foo()))
|
|
26
25
|
})
|
|
27
26
|
|
|
28
|
-
interface CustomLogger extends
|
|
27
|
+
interface CustomLogger extends FastifyBaseLogger {
|
|
29
28
|
customMethod(msg: string, ...args: unknown[]): void;
|
|
30
29
|
}
|
|
31
30
|
|
|
@@ -46,7 +45,6 @@ class CustomLoggerImpl implements CustomLogger {
|
|
|
46
45
|
silent (...args: unknown[]) { }
|
|
47
46
|
|
|
48
47
|
child (bindings: P.Bindings, options?: P.ChildLoggerOptions): CustomLoggerImpl { return new CustomLoggerImpl() }
|
|
49
|
-
setBindings (bindings: P.Bindings): void { }
|
|
50
48
|
}
|
|
51
49
|
|
|
52
50
|
const customLogger = new CustomLoggerImpl()
|
|
@@ -75,6 +75,8 @@ const getHandler: RouteHandler = function (request, _reply) {
|
|
|
75
75
|
expectType<RequestParamsDefault>(request.params)
|
|
76
76
|
expectType<FastifyContext<ContextConfigDefault>>(request.context)
|
|
77
77
|
expectType<FastifyContextConfig>(request.context.config)
|
|
78
|
+
expectType<FastifyContextConfig>(request.routeConfig)
|
|
79
|
+
expectType<FastifySchema>(request.routeSchema)
|
|
78
80
|
|
|
79
81
|
expectType<RequestHeadersDefault & RawRequestDefaultExpression['headers']>(request.headers)
|
|
80
82
|
request.headers = {}
|
|
@@ -142,8 +144,7 @@ const customLogger: CustomLoggerInterface = {
|
|
|
142
144
|
trace: () => { },
|
|
143
145
|
debug: () => { },
|
|
144
146
|
foo: () => { }, // custom severity logger method
|
|
145
|
-
child: () => customLogger as pino.Logger<never
|
|
146
|
-
setBindings: () => { }
|
|
147
|
+
child: () => customLogger as pino.Logger<never>
|
|
147
148
|
}
|
|
148
149
|
|
|
149
150
|
const serverWithCustomLogger = fastify({ logger: customLogger })
|
package/types/context.d.ts
CHANGED
|
@@ -8,5 +8,8 @@ export interface FastifyContextConfig {
|
|
|
8
8
|
* Route context object. Properties defined here will be available in the route's handler
|
|
9
9
|
*/
|
|
10
10
|
export interface FastifyContext<ContextConfig = ContextConfigDefault> {
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Use Request#routeConfig or Request#routeSchema instead
|
|
13
|
+
*/
|
|
11
14
|
config: FastifyContextConfig & ContextConfig;
|
|
12
15
|
}
|
package/types/hooks.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { RawServerBase, RawServerDefault, RawRequestDefaultExpression, RawReplyD
|
|
|
5
5
|
import { FastifyRequest } from './request'
|
|
6
6
|
import { FastifyReply } from './reply'
|
|
7
7
|
import { FastifyError } from '@fastify/error'
|
|
8
|
-
import {
|
|
8
|
+
import { FastifyBaseLogger } from './logger'
|
|
9
9
|
import {
|
|
10
10
|
FastifyTypeProvider,
|
|
11
11
|
FastifyTypeProviderDefault
|
|
@@ -34,7 +34,7 @@ export interface onRequestHookHandler<
|
|
|
34
34
|
ContextConfig = ContextConfigDefault,
|
|
35
35
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
36
36
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
37
|
-
Logger extends FastifyBaseLogger =
|
|
37
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
38
38
|
> {
|
|
39
39
|
(
|
|
40
40
|
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
|
|
@@ -52,7 +52,7 @@ export interface onRequestAsyncHookHandler<
|
|
|
52
52
|
ContextConfig = ContextConfigDefault,
|
|
53
53
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
54
54
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
55
|
-
Logger extends FastifyBaseLogger =
|
|
55
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
56
56
|
> {
|
|
57
57
|
(
|
|
58
58
|
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
|
|
@@ -73,7 +73,7 @@ export interface preParsingHookHandler<
|
|
|
73
73
|
ContextConfig = ContextConfigDefault,
|
|
74
74
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
75
75
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
76
|
-
Logger extends FastifyBaseLogger =
|
|
76
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
77
77
|
> {
|
|
78
78
|
(
|
|
79
79
|
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
|
|
@@ -92,7 +92,7 @@ export interface preParsingAsyncHookHandler<
|
|
|
92
92
|
ContextConfig = ContextConfigDefault,
|
|
93
93
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
94
94
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
95
|
-
Logger extends FastifyBaseLogger =
|
|
95
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
96
96
|
> {
|
|
97
97
|
(
|
|
98
98
|
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
|
|
@@ -113,7 +113,7 @@ export interface preValidationHookHandler<
|
|
|
113
113
|
ContextConfig = ContextConfigDefault,
|
|
114
114
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
115
115
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
116
|
-
Logger extends FastifyBaseLogger =
|
|
116
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
117
117
|
> {
|
|
118
118
|
(
|
|
119
119
|
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
|
|
@@ -131,7 +131,7 @@ export interface preValidationAsyncHookHandler<
|
|
|
131
131
|
ContextConfig = ContextConfigDefault,
|
|
132
132
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
133
133
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
134
|
-
Logger extends FastifyBaseLogger =
|
|
134
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
135
135
|
> {
|
|
136
136
|
(
|
|
137
137
|
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
|
|
@@ -151,7 +151,7 @@ export interface preHandlerHookHandler<
|
|
|
151
151
|
ContextConfig = ContextConfigDefault,
|
|
152
152
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
153
153
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
154
|
-
Logger extends FastifyBaseLogger =
|
|
154
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
155
155
|
> {
|
|
156
156
|
(
|
|
157
157
|
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
|
|
@@ -169,7 +169,7 @@ export interface preHandlerAsyncHookHandler<
|
|
|
169
169
|
ContextConfig = ContextConfigDefault,
|
|
170
170
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
171
171
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
172
|
-
Logger extends FastifyBaseLogger =
|
|
172
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
173
173
|
> {
|
|
174
174
|
(
|
|
175
175
|
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
|
|
@@ -198,7 +198,7 @@ export interface preSerializationHookHandler<
|
|
|
198
198
|
ContextConfig = ContextConfigDefault,
|
|
199
199
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
200
200
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
201
|
-
Logger extends FastifyBaseLogger =
|
|
201
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
202
202
|
> {
|
|
203
203
|
(
|
|
204
204
|
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
|
|
@@ -218,7 +218,7 @@ export interface preSerializationAsyncHookHandler<
|
|
|
218
218
|
ContextConfig = ContextConfigDefault,
|
|
219
219
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
220
220
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
221
|
-
Logger extends FastifyBaseLogger =
|
|
221
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
222
222
|
> {
|
|
223
223
|
(
|
|
224
224
|
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
|
|
@@ -241,7 +241,7 @@ export interface onSendHookHandler<
|
|
|
241
241
|
ContextConfig = ContextConfigDefault,
|
|
242
242
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
243
243
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
244
|
-
Logger extends FastifyBaseLogger =
|
|
244
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
245
245
|
> {
|
|
246
246
|
(
|
|
247
247
|
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
|
|
@@ -261,7 +261,7 @@ export interface onSendAsyncHookHandler<
|
|
|
261
261
|
ContextConfig = ContextConfigDefault,
|
|
262
262
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
263
263
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
264
|
-
Logger extends FastifyBaseLogger =
|
|
264
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
265
265
|
> {
|
|
266
266
|
(
|
|
267
267
|
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
|
|
@@ -283,7 +283,7 @@ export interface onResponseHookHandler<
|
|
|
283
283
|
ContextConfig = ContextConfigDefault,
|
|
284
284
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
285
285
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
286
|
-
Logger extends FastifyBaseLogger =
|
|
286
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
287
287
|
> {
|
|
288
288
|
(
|
|
289
289
|
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
|
|
@@ -301,7 +301,7 @@ export interface onResponseAsyncHookHandler<
|
|
|
301
301
|
ContextConfig = ContextConfigDefault,
|
|
302
302
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
303
303
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
304
|
-
Logger extends FastifyBaseLogger =
|
|
304
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
305
305
|
> {
|
|
306
306
|
(
|
|
307
307
|
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
|
|
@@ -322,7 +322,7 @@ export interface onTimeoutHookHandler<
|
|
|
322
322
|
ContextConfig = ContextConfigDefault,
|
|
323
323
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
324
324
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
325
|
-
Logger extends FastifyBaseLogger =
|
|
325
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
326
326
|
> {
|
|
327
327
|
(
|
|
328
328
|
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
|
|
@@ -340,7 +340,7 @@ export interface onTimeoutAsyncHookHandler<
|
|
|
340
340
|
ContextConfig = ContextConfigDefault,
|
|
341
341
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
342
342
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
343
|
-
Logger extends FastifyBaseLogger =
|
|
343
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
344
344
|
> {
|
|
345
345
|
(
|
|
346
346
|
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
|
|
@@ -364,7 +364,7 @@ export interface onErrorHookHandler<
|
|
|
364
364
|
TError extends Error = FastifyError,
|
|
365
365
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
366
366
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
367
|
-
Logger extends FastifyBaseLogger =
|
|
367
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
368
368
|
> {
|
|
369
369
|
(
|
|
370
370
|
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
|
|
@@ -384,7 +384,7 @@ export interface onErrorAsyncHookHandler<
|
|
|
384
384
|
TError extends Error = FastifyError,
|
|
385
385
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
386
386
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
387
|
-
Logger extends FastifyBaseLogger =
|
|
387
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
388
388
|
> {
|
|
389
389
|
(
|
|
390
390
|
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
|
|
@@ -407,7 +407,7 @@ export interface onRouteHookHandler<
|
|
|
407
407
|
ContextConfig = ContextConfigDefault,
|
|
408
408
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
409
409
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
410
|
-
Logger extends FastifyBaseLogger =
|
|
410
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
411
411
|
> {
|
|
412
412
|
(
|
|
413
413
|
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
|
|
@@ -424,7 +424,7 @@ export interface onRegisterHookHandler<
|
|
|
424
424
|
RawServer extends RawServerBase = RawServerDefault,
|
|
425
425
|
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
|
|
426
426
|
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
427
|
-
Logger extends FastifyBaseLogger =
|
|
427
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger,
|
|
428
428
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
429
429
|
Options extends FastifyPluginOptions = FastifyPluginOptions
|
|
430
430
|
> {
|
|
@@ -442,7 +442,7 @@ export interface onReadyHookHandler<
|
|
|
442
442
|
RawServer extends RawServerBase = RawServerDefault,
|
|
443
443
|
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
|
|
444
444
|
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
445
|
-
Logger extends FastifyBaseLogger =
|
|
445
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger,
|
|
446
446
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
447
447
|
> {
|
|
448
448
|
(
|
|
@@ -455,7 +455,7 @@ export interface onReadyAsyncHookHandler<
|
|
|
455
455
|
RawServer extends RawServerBase = RawServerDefault,
|
|
456
456
|
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
|
|
457
457
|
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
458
|
-
Logger extends FastifyBaseLogger =
|
|
458
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger,
|
|
459
459
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
460
460
|
> {
|
|
461
461
|
(
|
|
@@ -469,7 +469,7 @@ export interface onCloseHookHandler<
|
|
|
469
469
|
RawServer extends RawServerBase = RawServerDefault,
|
|
470
470
|
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
|
|
471
471
|
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
472
|
-
Logger extends FastifyBaseLogger =
|
|
472
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger,
|
|
473
473
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
474
474
|
> {
|
|
475
475
|
(
|
|
@@ -482,7 +482,7 @@ export interface onCloseAsyncHookHandler<
|
|
|
482
482
|
RawServer extends RawServerBase = RawServerDefault,
|
|
483
483
|
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
|
|
484
484
|
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
485
|
-
Logger extends FastifyBaseLogger =
|
|
485
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger,
|
|
486
486
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault
|
|
487
487
|
> {
|
|
488
488
|
(
|
package/types/instance.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as http from 'http'
|
|
|
4
4
|
import { CallbackFunc as LightMyRequestCallback, Chain as LightMyRequestChain, InjectOptions, Response as LightMyRequestResponse } from 'light-my-request'
|
|
5
5
|
import { AddContentTypeParser, ConstructorAction, FastifyBodyParser, getDefaultJsonParser, hasContentTypeParser, ProtoAction, removeAllContentTypeParsers, removeContentTypeParser } from './content-type-parser'
|
|
6
6
|
import { onCloseAsyncHookHandler, onCloseHookHandler, onErrorAsyncHookHandler, onErrorHookHandler, onReadyAsyncHookHandler, onReadyHookHandler, onRegisterHookHandler, onRequestAsyncHookHandler, onRequestHookHandler, onResponseAsyncHookHandler, onResponseHookHandler, onRouteHookHandler, onSendAsyncHookHandler, onSendHookHandler, onTimeoutAsyncHookHandler, onTimeoutHookHandler, preHandlerAsyncHookHandler, preHandlerHookHandler, preParsingAsyncHookHandler, preParsingHookHandler, preSerializationAsyncHookHandler, preSerializationHookHandler, preValidationAsyncHookHandler, preValidationHookHandler } from './hooks'
|
|
7
|
-
import {
|
|
7
|
+
import { FastifyBaseLogger } from './logger'
|
|
8
8
|
import { FastifyRegister } from './register'
|
|
9
9
|
import { FastifyReply } from './reply'
|
|
10
10
|
import { FastifyRequest } from './request'
|
|
@@ -84,7 +84,7 @@ export interface FastifyInstance<
|
|
|
84
84
|
RawServer extends RawServerBase = RawServerDefault,
|
|
85
85
|
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
|
|
86
86
|
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
87
|
-
Logger extends FastifyBaseLogger =
|
|
87
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger,
|
|
88
88
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
89
89
|
> {
|
|
90
90
|
server: RawServer;
|
|
@@ -204,7 +204,7 @@ export interface FastifyInstance<
|
|
|
204
204
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
205
205
|
ContextConfig = ContextConfigDefault,
|
|
206
206
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
207
|
-
Logger extends FastifyBaseLogger =
|
|
207
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
208
208
|
>(
|
|
209
209
|
name: 'onRequest',
|
|
210
210
|
hook: onRequestHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
@@ -214,7 +214,7 @@ export interface FastifyInstance<
|
|
|
214
214
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
215
215
|
ContextConfig = ContextConfigDefault,
|
|
216
216
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
217
|
-
Logger extends FastifyBaseLogger =
|
|
217
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
218
218
|
>(
|
|
219
219
|
name: 'onRequest',
|
|
220
220
|
hook: onRequestAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
@@ -228,7 +228,7 @@ export interface FastifyInstance<
|
|
|
228
228
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
229
229
|
ContextConfig = ContextConfigDefault,
|
|
230
230
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
231
|
-
Logger extends FastifyBaseLogger =
|
|
231
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
232
232
|
>(
|
|
233
233
|
name: 'preParsing',
|
|
234
234
|
hook: preParsingHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
@@ -238,7 +238,7 @@ export interface FastifyInstance<
|
|
|
238
238
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
239
239
|
ContextConfig = ContextConfigDefault,
|
|
240
240
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
241
|
-
Logger extends FastifyBaseLogger =
|
|
241
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
242
242
|
>(
|
|
243
243
|
name: 'preParsing',
|
|
244
244
|
hook: preParsingAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
@@ -251,7 +251,7 @@ export interface FastifyInstance<
|
|
|
251
251
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
252
252
|
ContextConfig = ContextConfigDefault,
|
|
253
253
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
254
|
-
Logger extends FastifyBaseLogger =
|
|
254
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
255
255
|
>(
|
|
256
256
|
name: 'preValidation',
|
|
257
257
|
hook: preValidationHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
@@ -261,7 +261,7 @@ export interface FastifyInstance<
|
|
|
261
261
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
262
262
|
ContextConfig = ContextConfigDefault,
|
|
263
263
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
264
|
-
Logger extends FastifyBaseLogger =
|
|
264
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
265
265
|
>(
|
|
266
266
|
name: 'preValidation',
|
|
267
267
|
hook: preValidationAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
@@ -274,7 +274,7 @@ export interface FastifyInstance<
|
|
|
274
274
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
275
275
|
ContextConfig = ContextConfigDefault,
|
|
276
276
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
277
|
-
Logger extends FastifyBaseLogger =
|
|
277
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
278
278
|
>(
|
|
279
279
|
name: 'preHandler',
|
|
280
280
|
hook: preHandlerHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
@@ -284,7 +284,7 @@ export interface FastifyInstance<
|
|
|
284
284
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
285
285
|
ContextConfig = ContextConfigDefault,
|
|
286
286
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
287
|
-
Logger extends FastifyBaseLogger =
|
|
287
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
288
288
|
>(
|
|
289
289
|
name: 'preHandler',
|
|
290
290
|
hook: preHandlerAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
@@ -299,7 +299,7 @@ export interface FastifyInstance<
|
|
|
299
299
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
300
300
|
ContextConfig = ContextConfigDefault,
|
|
301
301
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
302
|
-
Logger extends FastifyBaseLogger =
|
|
302
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
303
303
|
>(
|
|
304
304
|
name: 'preSerialization',
|
|
305
305
|
hook: preSerializationHookHandler<PreSerializationPayload, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
@@ -310,7 +310,7 @@ export interface FastifyInstance<
|
|
|
310
310
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
311
311
|
ContextConfig = ContextConfigDefault,
|
|
312
312
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
313
|
-
Logger extends FastifyBaseLogger =
|
|
313
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
314
314
|
>(
|
|
315
315
|
name: 'preSerialization',
|
|
316
316
|
hook: preSerializationAsyncHookHandler<PreSerializationPayload, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
@@ -325,7 +325,7 @@ export interface FastifyInstance<
|
|
|
325
325
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
326
326
|
ContextConfig = ContextConfigDefault,
|
|
327
327
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
328
|
-
Logger extends FastifyBaseLogger =
|
|
328
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
329
329
|
>(
|
|
330
330
|
name: 'onSend',
|
|
331
331
|
hook: onSendHookHandler<OnSendPayload, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
@@ -336,7 +336,7 @@ export interface FastifyInstance<
|
|
|
336
336
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
337
337
|
ContextConfig = ContextConfigDefault,
|
|
338
338
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
339
|
-
Logger extends FastifyBaseLogger =
|
|
339
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
340
340
|
>(
|
|
341
341
|
name: 'onSend',
|
|
342
342
|
hook: onSendAsyncHookHandler<OnSendPayload, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
@@ -350,7 +350,7 @@ export interface FastifyInstance<
|
|
|
350
350
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
351
351
|
ContextConfig = ContextConfigDefault,
|
|
352
352
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
353
|
-
Logger extends FastifyBaseLogger =
|
|
353
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
354
354
|
>(
|
|
355
355
|
name: 'onResponse',
|
|
356
356
|
hook: onResponseHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
@@ -360,7 +360,7 @@ export interface FastifyInstance<
|
|
|
360
360
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
361
361
|
ContextConfig = ContextConfigDefault,
|
|
362
362
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
363
|
-
Logger extends FastifyBaseLogger =
|
|
363
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
364
364
|
>(
|
|
365
365
|
name: 'onResponse',
|
|
366
366
|
hook: onResponseAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
@@ -374,7 +374,7 @@ export interface FastifyInstance<
|
|
|
374
374
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
375
375
|
ContextConfig = ContextConfigDefault,
|
|
376
376
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
377
|
-
Logger extends FastifyBaseLogger =
|
|
377
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
378
378
|
>(
|
|
379
379
|
name: 'onTimeout',
|
|
380
380
|
hook: onTimeoutHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
@@ -384,7 +384,7 @@ export interface FastifyInstance<
|
|
|
384
384
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
385
385
|
ContextConfig = ContextConfigDefault,
|
|
386
386
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
387
|
-
Logger extends FastifyBaseLogger =
|
|
387
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
388
388
|
>(
|
|
389
389
|
name: 'onTimeout',
|
|
390
390
|
hook: onTimeoutAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
@@ -400,7 +400,7 @@ export interface FastifyInstance<
|
|
|
400
400
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
401
401
|
ContextConfig = ContextConfigDefault,
|
|
402
402
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
403
|
-
Logger extends FastifyBaseLogger =
|
|
403
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
404
404
|
>(
|
|
405
405
|
name: 'onError',
|
|
406
406
|
hook: onErrorHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, FastifyError, SchemaCompiler, TypeProvider, Logger>
|
|
@@ -410,7 +410,7 @@ export interface FastifyInstance<
|
|
|
410
410
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
411
411
|
ContextConfig = ContextConfigDefault,
|
|
412
412
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
413
|
-
Logger extends FastifyBaseLogger =
|
|
413
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
414
414
|
>(
|
|
415
415
|
name: 'onError',
|
|
416
416
|
hook: onErrorAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, FastifyError, SchemaCompiler, TypeProvider, Logger>
|
|
@@ -425,7 +425,7 @@ export interface FastifyInstance<
|
|
|
425
425
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
426
426
|
ContextConfig = ContextConfigDefault,
|
|
427
427
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
428
|
-
Logger extends FastifyBaseLogger =
|
|
428
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
429
429
|
>(
|
|
430
430
|
name: 'onRoute',
|
|
431
431
|
hook: onRouteHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
package/types/logger.d.ts
CHANGED
|
@@ -19,19 +19,15 @@ export type Bindings = pino.Bindings
|
|
|
19
19
|
|
|
20
20
|
export type ChildLoggerOptions = pino.ChildLoggerOptions
|
|
21
21
|
|
|
22
|
-
export
|
|
23
|
-
child(bindings: Bindings, options?: ChildLoggerOptions):
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface DefaultFastifyLogger extends FastifyBaseLogger<DefaultFastifyLogger>, Pick<pino.Logger, 'setBindings'> {
|
|
27
|
-
|
|
22
|
+
export type FastifyBaseLogger = pino.BaseLogger & {
|
|
23
|
+
child(bindings: Bindings, options?: ChildLoggerOptions): FastifyBaseLogger
|
|
28
24
|
}
|
|
29
25
|
|
|
30
26
|
// TODO delete FastifyBaseLogger in the next major release. It seems that it is enough to have only FastifyBaseLogger.
|
|
31
27
|
/**
|
|
32
28
|
* @deprecated Use FastifyBaseLogger instead
|
|
33
29
|
*/
|
|
34
|
-
export type FastifyLoggerInstance =
|
|
30
|
+
export type FastifyLoggerInstance = FastifyBaseLogger
|
|
35
31
|
|
|
36
32
|
export interface FastifyLoggerStreamDestination {
|
|
37
33
|
write(msg: string): void;
|
package/types/plugin.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FastifyInstance } from './instance'
|
|
2
2
|
import { RawServerBase, RawRequestDefaultExpression, RawReplyDefaultExpression, RawServerDefault } from './utils'
|
|
3
3
|
import { FastifyTypeProvider, FastifyTypeProviderDefault } from './type-provider'
|
|
4
|
-
import {
|
|
4
|
+
import { FastifyBaseLogger } from './logger'
|
|
5
5
|
|
|
6
6
|
export type FastifyPluginOptions = Record<string, any>
|
|
7
7
|
|
|
@@ -11,7 +11,7 @@ export type FastifyPluginOptions = Record<string, any>
|
|
|
11
11
|
* Fastify allows the user to extend its functionalities with plugins. A plugin can be a set of routes, a server decorator or whatever. To activate plugins, use the `fastify.register()` method.
|
|
12
12
|
*/
|
|
13
13
|
export type FastifyPluginCallback<Options extends FastifyPluginOptions = Record<never, never>, Server extends RawServerBase = RawServerDefault, TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault> = (
|
|
14
|
-
instance: FastifyInstance<Server, RawRequestDefaultExpression<Server>, RawReplyDefaultExpression<Server>,
|
|
14
|
+
instance: FastifyInstance<Server, RawRequestDefaultExpression<Server>, RawReplyDefaultExpression<Server>, FastifyBaseLogger, TypeProvider>,
|
|
15
15
|
opts: Options,
|
|
16
16
|
done: (err?: Error) => void
|
|
17
17
|
) => void
|
|
@@ -26,7 +26,7 @@ export type FastifyPluginAsync<
|
|
|
26
26
|
Server extends RawServerBase = RawServerDefault,
|
|
27
27
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
28
28
|
> = (
|
|
29
|
-
instance: FastifyInstance<Server, RawRequestDefaultExpression<Server>, RawReplyDefaultExpression<Server>,
|
|
29
|
+
instance: FastifyInstance<Server, RawRequestDefaultExpression<Server>, RawReplyDefaultExpression<Server>, FastifyBaseLogger, TypeProvider>,
|
|
30
30
|
opts: Options
|
|
31
31
|
) => Promise<void>;
|
|
32
32
|
|
package/types/reply.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RawReplyDefaultExpression, RawServerBase, RawServerDefault, ContextConfigDefault, RawRequestDefaultExpression, ReplyDefault } from './utils'
|
|
2
2
|
import { FastifyReplyType, ResolveFastifyReplyType, FastifyTypeProvider, FastifyTypeProviderDefault } from './type-provider'
|
|
3
3
|
import { FastifyContext } from './context'
|
|
4
|
-
import {
|
|
4
|
+
import { FastifyBaseLogger } from './logger'
|
|
5
5
|
import { FastifyRequest } from './request'
|
|
6
6
|
import { RouteGenericInterface } from './route'
|
|
7
7
|
import { FastifyInstance } from './instance'
|
|
@@ -24,12 +24,11 @@ export interface FastifyReply<
|
|
|
24
24
|
ContextConfig = ContextConfigDefault,
|
|
25
25
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
26
26
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
27
|
-
ReplyType extends FastifyReplyType = ResolveFastifyReplyType<TypeProvider, SchemaCompiler, RouteGeneric
|
|
28
|
-
Logger extends FastifyBaseLogger = DefaultFastifyLogger,
|
|
27
|
+
ReplyType extends FastifyReplyType = ResolveFastifyReplyType<TypeProvider, SchemaCompiler, RouteGeneric>
|
|
29
28
|
> {
|
|
30
29
|
raw: RawReply;
|
|
31
30
|
context: FastifyContext<ContextConfig>;
|
|
32
|
-
log:
|
|
31
|
+
log: FastifyBaseLogger;
|
|
33
32
|
request: FastifyRequest<RouteGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider>;
|
|
34
33
|
server: FastifyInstance;
|
|
35
34
|
code(statusCode: number): FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>;
|
package/types/request.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ErrorObject } from '@fastify/ajv-compiler'
|
|
2
|
-
import {
|
|
2
|
+
import { FastifyBaseLogger } from './logger'
|
|
3
3
|
import { ContextConfigDefault, RawServerBase, RawServerDefault, RawRequestDefaultExpression, RequestBodyDefault, RequestQuerystringDefault, RequestParamsDefault, RequestHeadersDefault } from './utils'
|
|
4
4
|
import { RouteGenericInterface } from './route'
|
|
5
5
|
import { FastifyInstance } from './instance'
|
|
6
6
|
import { FastifyTypeProvider, FastifyTypeProviderDefault, FastifyRequestType, ResolveFastifyRequestType } from './type-provider'
|
|
7
7
|
import { FastifySchema } from './schema'
|
|
8
|
-
import { FastifyContext } from './context'
|
|
8
|
+
import { FastifyContext, FastifyContextConfig } from './context'
|
|
9
9
|
|
|
10
10
|
type HTTPRequestPart = 'body' | 'query' | 'querystring' | 'params' | 'headers'
|
|
11
11
|
export interface RequestGenericInterface {
|
|
@@ -30,7 +30,7 @@ export interface FastifyRequest<RouteGeneric extends RouteGenericInterface = Rou
|
|
|
30
30
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
31
31
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
32
32
|
ContextConfig = ContextConfigDefault,
|
|
33
|
-
Logger extends FastifyBaseLogger =
|
|
33
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger,
|
|
34
34
|
RequestType extends FastifyRequestType = ResolveFastifyRequestType<TypeProvider, SchemaCompiler, RouteGeneric>
|
|
35
35
|
// ^ Temporary Note: RequestType has been re-ordered to be the last argument in
|
|
36
36
|
// generic list. This generic argument is now considered optional as it can be
|
|
@@ -48,6 +48,8 @@ export interface FastifyRequest<RouteGeneric extends RouteGenericInterface = Rou
|
|
|
48
48
|
server: FastifyInstance;
|
|
49
49
|
body: RequestType['body'];
|
|
50
50
|
context: FastifyContext<ContextConfig>;
|
|
51
|
+
routeConfig: FastifyContextConfig & ContextConfig;
|
|
52
|
+
routeSchema: FastifySchema
|
|
51
53
|
|
|
52
54
|
/** in order for this to be used the user should ensure they have set the attachValidation option. */
|
|
53
55
|
validationError?: Error & { validation: any; validationContext: string };
|
package/types/route.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
FastifyTypeProviderDefault,
|
|
12
12
|
ResolveFastifyReplyReturnType
|
|
13
13
|
} from './type-provider'
|
|
14
|
-
import {
|
|
14
|
+
import { FastifyBaseLogger, LogLevel } from './logger'
|
|
15
15
|
|
|
16
16
|
export interface RouteGenericInterface extends RequestGenericInterface, ReplyGenericInterface {}
|
|
17
17
|
|
|
@@ -26,7 +26,7 @@ export interface RouteShorthandOptions<
|
|
|
26
26
|
ContextConfig = ContextConfigDefault,
|
|
27
27
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
28
28
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
29
|
-
Logger extends FastifyBaseLogger =
|
|
29
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
30
30
|
> {
|
|
31
31
|
schema?: SchemaCompiler, // originally FastifySchema
|
|
32
32
|
attachValidation?: boolean;
|
|
@@ -67,7 +67,7 @@ export type RouteHandlerMethod<
|
|
|
67
67
|
ContextConfig = ContextConfigDefault,
|
|
68
68
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
69
69
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
70
|
-
Logger extends FastifyBaseLogger =
|
|
70
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
71
71
|
> = (
|
|
72
72
|
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
|
|
73
73
|
request: FastifyRequest<RouteGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider, ContextConfig, Logger>,
|
|
@@ -86,7 +86,7 @@ export interface RouteShorthandOptionsWithHandler<
|
|
|
86
86
|
ContextConfig = ContextConfigDefault,
|
|
87
87
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
88
88
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
89
|
-
Logger extends FastifyBaseLogger =
|
|
89
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
90
90
|
> extends RouteShorthandOptions<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger> {
|
|
91
91
|
handler: RouteHandlerMethod<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>;
|
|
92
92
|
}
|
|
@@ -100,16 +100,16 @@ export interface RouteShorthandMethod<
|
|
|
100
100
|
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
101
101
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
102
102
|
> {
|
|
103
|
-
<RouteGeneric extends RouteGenericInterface = RouteGenericInterface, ContextConfig = ContextConfigDefault, SchemaCompiler extends FastifySchema = FastifySchema, Logger extends FastifyBaseLogger =
|
|
103
|
+
<RouteGeneric extends RouteGenericInterface = RouteGenericInterface, ContextConfig = ContextConfigDefault, SchemaCompiler extends FastifySchema = FastifySchema, Logger extends FastifyBaseLogger = FastifyBaseLogger>(
|
|
104
104
|
path: string,
|
|
105
105
|
opts: RouteShorthandOptions<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>,
|
|
106
106
|
handler: RouteHandlerMethod<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
107
107
|
): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
|
|
108
|
-
<RouteGeneric extends RouteGenericInterface = RouteGenericInterface, ContextConfig = ContextConfigDefault, SchemaCompiler extends FastifySchema = FastifySchema, Logger extends FastifyBaseLogger =
|
|
108
|
+
<RouteGeneric extends RouteGenericInterface = RouteGenericInterface, ContextConfig = ContextConfigDefault, SchemaCompiler extends FastifySchema = FastifySchema, Logger extends FastifyBaseLogger = FastifyBaseLogger>(
|
|
109
109
|
path: string,
|
|
110
110
|
handler: RouteHandlerMethod<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
111
111
|
): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
|
|
112
|
-
<RouteGeneric extends RouteGenericInterface = RouteGenericInterface, ContextConfig = ContextConfigDefault, SchemaCompiler extends FastifySchema = FastifySchema, Logger extends FastifyBaseLogger =
|
|
112
|
+
<RouteGeneric extends RouteGenericInterface = RouteGenericInterface, ContextConfig = ContextConfigDefault, SchemaCompiler extends FastifySchema = FastifySchema, Logger extends FastifyBaseLogger = FastifyBaseLogger>(
|
|
113
113
|
path: string,
|
|
114
114
|
opts: RouteShorthandOptionsWithHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
115
115
|
): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>;
|
|
@@ -126,7 +126,7 @@ export interface RouteOptions<
|
|
|
126
126
|
ContextConfig = ContextConfigDefault,
|
|
127
127
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
128
128
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
129
|
-
Logger extends FastifyBaseLogger =
|
|
129
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
130
130
|
> extends RouteShorthandOptions<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger> {
|
|
131
131
|
method: HTTPMethods | HTTPMethods[];
|
|
132
132
|
url: string;
|
|
@@ -141,7 +141,7 @@ export type RouteHandler<
|
|
|
141
141
|
ContextConfig = ContextConfigDefault,
|
|
142
142
|
SchemaCompiler extends FastifySchema = FastifySchema,
|
|
143
143
|
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
|
|
144
|
-
Logger extends FastifyBaseLogger =
|
|
144
|
+
Logger extends FastifyBaseLogger = FastifyBaseLogger
|
|
145
145
|
> = (
|
|
146
146
|
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
|
|
147
147
|
request: FastifyRequest<RouteGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider, ContextConfig, Logger>,
|