fastify 4.16.3 → 4.18.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/GOVERNANCE.md +2 -2
- package/README.md +13 -10
- package/docs/Guides/Ecosystem.md +6 -0
- package/docs/Guides/Serverless.md +12 -1
- package/docs/Reference/Errors.md +5 -0
- package/docs/Reference/LTS.md +5 -5
- package/docs/Reference/Lifecycle.md +3 -0
- package/docs/Reference/Logging.md +34 -1
- package/docs/Reference/Reply.md +19 -0
- package/docs/Reference/Request.md +1 -1
- package/docs/Reference/Server.md +20 -2
- package/docs/Reference/Validation-and-Serialization.md +3 -2
- package/examples/benchmark/body.json +3 -0
- package/fastify.d.ts +6 -1
- package/fastify.js +18 -13
- package/lib/contentTypeParser.js +3 -1
- package/lib/errors.js +5 -0
- package/lib/handleRequest.js +15 -4
- package/lib/reply.js +3 -2
- package/lib/route.js +14 -3
- package/lib/schemas.js +18 -21
- package/lib/server.js +9 -4
- package/lib/validation.js +100 -16
- package/package.json +33 -33
- package/test/404s.test.js +4 -2
- package/test/custom-parser.0.test.js +777 -0
- package/test/{custom-parser.test.js → custom-parser.1.test.js} +1 -742
- package/test/delete.test.js +3 -0
- package/test/fastify-instance.test.js +39 -0
- package/test/fluent-schema.test.js +4 -4
- package/test/get.test.js +3 -0
- package/test/hooks-async.test.js +154 -0
- package/test/hooks.test.js +29 -29
- package/test/input-validation.js +10 -5
- package/test/internals/reply.test.js +114 -45
- package/test/internals/validation.test.js +58 -0
- package/test/reply-error.test.js +7 -7
- package/test/request-error.test.js +3 -0
- package/test/route-hooks.test.js +38 -0
- package/test/route.test.js +192 -74
- package/test/schema-examples.test.js +2 -0
- package/test/schema-serialization.test.js +7 -5
- package/test/schema-special-usage.test.js +569 -0
- package/test/schema-validation.test.js +8 -4
- package/test/search.test.js +3 -0
- package/test/types/fastify.test-d.ts +4 -1
- package/test/types/hooks.test-d.ts +42 -0
- package/test/types/instance.test-d.ts +1 -0
- package/test/types/logger.test-d.ts +10 -4
- package/test/types/reply.test-d.ts +4 -1
- package/test/types/route.test-d.ts +12 -0
- package/test/url-rewriting.test.js +3 -0
- package/test/validation-error-handling.test.js +18 -3
- package/types/.eslintrc.json +1 -1
- package/types/instance.d.ts +1 -1
- package/types/logger.d.ts +10 -1
- package/types/reply.d.ts +7 -1
- package/types/route.d.ts +11 -31
- package/types/type-provider.d.ts +0 -1
- package/types/utils.d.ts +3 -1
- /package/types/{tsconfig.json → tsconfig.eslint.json} +0 -0
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { expectDeprecated, expectError, expectType } from 'tsd'
|
|
1
|
+
import { expectAssignable, expectDeprecated, expectError, expectNotAssignable, expectType } from 'tsd'
|
|
2
2
|
import fastify, {
|
|
3
3
|
FastifyLogFn,
|
|
4
4
|
LogLevel,
|
|
5
5
|
FastifyLoggerInstance,
|
|
6
6
|
FastifyRequest,
|
|
7
7
|
FastifyReply,
|
|
8
|
-
FastifyBaseLogger
|
|
8
|
+
FastifyBaseLogger,
|
|
9
|
+
FastifyInstance
|
|
9
10
|
} from '../../fastify'
|
|
10
11
|
import { Server, IncomingMessage, ServerResponse } from 'http'
|
|
11
12
|
import * as fs from 'fs'
|
|
12
13
|
import P from 'pino'
|
|
14
|
+
import { ResSerializerReply } from '../../types/logger'
|
|
13
15
|
|
|
14
16
|
expectType<FastifyLoggerInstance>(fastify().log)
|
|
15
17
|
|
|
@@ -127,7 +129,9 @@ const serverAutoInferredSerializerResponseObjectOption = fastify({
|
|
|
127
129
|
logger: {
|
|
128
130
|
serializers: {
|
|
129
131
|
res (ServerResponse) {
|
|
130
|
-
expectType<FastifyReply
|
|
132
|
+
expectType<ResSerializerReply<Server, FastifyReply>>(ServerResponse)
|
|
133
|
+
expectAssignable<Partial<FastifyReply> & Pick<FastifyReply, 'statusCode'>>(ServerResponse)
|
|
134
|
+
expectNotAssignable<FastifyReply>(ServerResponse)
|
|
131
135
|
return {
|
|
132
136
|
status: '200'
|
|
133
137
|
}
|
|
@@ -154,7 +158,9 @@ const serverAutoInferredSerializerObjectOption = fastify({
|
|
|
154
158
|
}
|
|
155
159
|
},
|
|
156
160
|
res (ServerResponse) {
|
|
157
|
-
expectType<FastifyReply
|
|
161
|
+
expectType<ResSerializerReply<Server, FastifyReply>>(ServerResponse)
|
|
162
|
+
expectAssignable<Partial<FastifyReply> & Pick<FastifyReply, 'statusCode'>>(ServerResponse)
|
|
163
|
+
expectNotAssignable<FastifyReply>(ServerResponse)
|
|
158
164
|
return {
|
|
159
165
|
statusCode: 'statusCode'
|
|
160
166
|
}
|
|
@@ -23,7 +23,7 @@ const getHandler: RouteHandlerMethod = function (_request, reply) {
|
|
|
23
23
|
expectType<(values: {[key: string]: any}) => FastifyReply>(reply.headers)
|
|
24
24
|
expectType<(key: string) => number | string | string[] | undefined>(reply.getHeader)
|
|
25
25
|
expectType<() => { [key: string]: number | string | string[] | undefined }>(reply.getHeaders)
|
|
26
|
-
expectType<(key: string) =>
|
|
26
|
+
expectType<(key: string) => FastifyReply>(reply.removeHeader)
|
|
27
27
|
expectType<(key: string) => boolean>(reply.hasHeader)
|
|
28
28
|
expectType<{(statusCode: number, url: string): FastifyReply; (url: string): FastifyReply }>(reply.redirect)
|
|
29
29
|
expectType<() => FastifyReply>(reply.hijack)
|
|
@@ -33,6 +33,9 @@ const getHandler: RouteHandlerMethod = function (_request, reply) {
|
|
|
33
33
|
expectType<(fn: (payload: any) => string) => FastifyReply>(reply.serializer)
|
|
34
34
|
expectType<(payload: any) => string | ArrayBuffer | Buffer>(reply.serialize)
|
|
35
35
|
expectType<(fulfilled: () => void, rejected: (err: Error) => void) => void>(reply.then)
|
|
36
|
+
expectType<(key: string, fn: ((reply: FastifyReply, payload: string | Buffer | null) => Promise<string>) | ((reply: FastifyReply, payload: string | Buffer | null, done: (err: Error | null, value?: string) => void) => void)) => FastifyReply>(reply.trailer)
|
|
37
|
+
expectType<(key: string) => boolean>(reply.hasTrailer)
|
|
38
|
+
expectType<(key: string) => FastifyReply>(reply.removeTrailer)
|
|
36
39
|
expectType<FastifyInstance>(reply.server)
|
|
37
40
|
expectAssignable<((httpStatus: string) => DefaultSerializationFunction)>(reply.getSerializationFunction)
|
|
38
41
|
expectAssignable<((schema: {[key: string]: unknown}) => DefaultSerializationFunction)>(reply.getSerializationFunction)
|
|
@@ -342,3 +342,15 @@ expectType<boolean>(fastify().hasRoute({
|
|
|
342
342
|
method: 'GET',
|
|
343
343
|
constraints: { version: '1.2.0' }
|
|
344
344
|
}))
|
|
345
|
+
|
|
346
|
+
expectType<FastifyInstance>(fastify().route({
|
|
347
|
+
url: '/',
|
|
348
|
+
method: 'get',
|
|
349
|
+
handler: routeHandlerWithReturnValue
|
|
350
|
+
}))
|
|
351
|
+
|
|
352
|
+
expectType<FastifyInstance>(fastify().route({
|
|
353
|
+
url: '/',
|
|
354
|
+
method: ['put', 'patch'],
|
|
355
|
+
handler: routeHandlerWithReturnValue
|
|
356
|
+
}))
|
|
@@ -10,6 +10,7 @@ test('Should rewrite url', t => {
|
|
|
10
10
|
const fastify = Fastify({
|
|
11
11
|
rewriteUrl (req) {
|
|
12
12
|
t.equal(req.url, '/this-would-404-without-url-rewrite')
|
|
13
|
+
this.log.info('rewriting url')
|
|
13
14
|
return '/'
|
|
14
15
|
}
|
|
15
16
|
})
|
|
@@ -43,6 +44,7 @@ test('Should not rewrite if the url is the same', t => {
|
|
|
43
44
|
const fastify = Fastify({
|
|
44
45
|
rewriteUrl (req) {
|
|
45
46
|
t.equal(req.url, '/this-would-404-without-url-rewrite')
|
|
47
|
+
this.log.info('rewriting url')
|
|
46
48
|
return req.url
|
|
47
49
|
}
|
|
48
50
|
})
|
|
@@ -74,6 +76,7 @@ test('Should throw an error', t => {
|
|
|
74
76
|
const fastify = Fastify({
|
|
75
77
|
rewriteUrl (req) {
|
|
76
78
|
t.equal(req.url, '/this-would-404-without-url-rewrite')
|
|
79
|
+
this.log.info('rewriting url')
|
|
77
80
|
return undefined
|
|
78
81
|
}
|
|
79
82
|
})
|
|
@@ -57,6 +57,7 @@ test('should fail immediately with invalid payload', t => {
|
|
|
57
57
|
t.error(err)
|
|
58
58
|
t.same(res.json(), {
|
|
59
59
|
statusCode: 400,
|
|
60
|
+
code: 'FST_ERR_VALIDATION',
|
|
60
61
|
error: 'Bad Request',
|
|
61
62
|
message: "body must have required property 'name'"
|
|
62
63
|
})
|
|
@@ -244,6 +245,7 @@ test('should respect when attachValidation is explicitly set to false', t => {
|
|
|
244
245
|
t.error(err)
|
|
245
246
|
t.same(JSON.parse(res.payload), {
|
|
246
247
|
statusCode: 400,
|
|
248
|
+
code: 'FST_ERR_VALIDATION',
|
|
247
249
|
error: 'Bad Request',
|
|
248
250
|
message: "body must have required property 'name'"
|
|
249
251
|
})
|
|
@@ -368,7 +370,7 @@ test('should return a defined output message parsing AJV errors', t => {
|
|
|
368
370
|
url: '/'
|
|
369
371
|
}, (err, res) => {
|
|
370
372
|
t.error(err)
|
|
371
|
-
t.equal(res.payload, '{"statusCode":400,"error":"Bad Request","message":"body must have required property \'name\'"}')
|
|
373
|
+
t.equal(res.payload, '{"statusCode":400,"code":"FST_ERR_VALIDATION","error":"Bad Request","message":"body must have required property \'name\'"}')
|
|
372
374
|
})
|
|
373
375
|
})
|
|
374
376
|
|
|
@@ -398,7 +400,7 @@ test('should return a defined output message parsing JOI errors', t => {
|
|
|
398
400
|
url: '/'
|
|
399
401
|
}, (err, res) => {
|
|
400
402
|
t.error(err)
|
|
401
|
-
t.equal(res.payload, '{"statusCode":400,"error":"Bad Request","message":"\\"name\\" is required"}')
|
|
403
|
+
t.equal(res.payload, '{"statusCode":400,"code":"FST_ERR_VALIDATION","error":"Bad Request","message":"\\"name\\" is required"}')
|
|
402
404
|
})
|
|
403
405
|
})
|
|
404
406
|
|
|
@@ -431,7 +433,7 @@ test('should return a defined output message parsing JOI error details', t => {
|
|
|
431
433
|
url: '/'
|
|
432
434
|
}, (err, res) => {
|
|
433
435
|
t.error(err)
|
|
434
|
-
t.equal(res.payload, '{"statusCode":400,"error":"Bad Request","message":"body \\"name\\" is required"}')
|
|
436
|
+
t.equal(res.payload, '{"statusCode":400,"code":"FST_ERR_VALIDATION","error":"Bad Request","message":"body \\"name\\" is required"}')
|
|
435
437
|
})
|
|
436
438
|
})
|
|
437
439
|
|
|
@@ -457,6 +459,7 @@ test('the custom error formatter context must be the server instance', t => {
|
|
|
457
459
|
t.error(err)
|
|
458
460
|
t.same(res.json(), {
|
|
459
461
|
statusCode: 400,
|
|
462
|
+
code: 'FST_ERR_VALIDATION',
|
|
460
463
|
error: 'Bad Request',
|
|
461
464
|
message: 'my error'
|
|
462
465
|
})
|
|
@@ -486,6 +489,7 @@ test('the custom error formatter context must be the server instance in options'
|
|
|
486
489
|
t.error(err)
|
|
487
490
|
t.same(res.json(), {
|
|
488
491
|
statusCode: 400,
|
|
492
|
+
code: 'FST_ERR_VALIDATION',
|
|
489
493
|
error: 'Bad Request',
|
|
490
494
|
message: 'my error'
|
|
491
495
|
})
|
|
@@ -522,6 +526,7 @@ test('should call custom error formatter', t => {
|
|
|
522
526
|
t.error(err)
|
|
523
527
|
t.same(res.json(), {
|
|
524
528
|
statusCode: 400,
|
|
529
|
+
code: 'FST_ERR_VALIDATION',
|
|
525
530
|
error: 'Bad Request',
|
|
526
531
|
message: 'my error'
|
|
527
532
|
})
|
|
@@ -609,6 +614,7 @@ test('should register a route based schema error formatter', t => {
|
|
|
609
614
|
t.error(err)
|
|
610
615
|
t.same(res.json(), {
|
|
611
616
|
statusCode: 400,
|
|
617
|
+
code: 'FST_ERR_VALIDATION',
|
|
612
618
|
error: 'Bad Request',
|
|
613
619
|
message: 'abc'
|
|
614
620
|
})
|
|
@@ -652,6 +658,7 @@ test('prefer route based error formatter over global one', t => {
|
|
|
652
658
|
t.error(err)
|
|
653
659
|
t.same(res.json(), {
|
|
654
660
|
statusCode: 400,
|
|
661
|
+
code: 'FST_ERR_VALIDATION',
|
|
655
662
|
error: 'Bad Request',
|
|
656
663
|
message: '123'
|
|
657
664
|
})
|
|
@@ -668,6 +675,7 @@ test('prefer route based error formatter over global one', t => {
|
|
|
668
675
|
t.error(err)
|
|
669
676
|
t.same(res.json(), {
|
|
670
677
|
statusCode: 400,
|
|
678
|
+
code: 'FST_ERR_VALIDATION',
|
|
671
679
|
error: 'Bad Request',
|
|
672
680
|
message: 'abc'
|
|
673
681
|
})
|
|
@@ -684,6 +692,7 @@ test('prefer route based error formatter over global one', t => {
|
|
|
684
692
|
t.error(err)
|
|
685
693
|
t.same(res.json(), {
|
|
686
694
|
statusCode: 400,
|
|
695
|
+
code: 'FST_ERR_VALIDATION',
|
|
687
696
|
error: 'Bad Request',
|
|
688
697
|
message: 'abc123'
|
|
689
698
|
})
|
|
@@ -712,6 +721,7 @@ test('adding schemaErrorFormatter', t => {
|
|
|
712
721
|
t.error(err)
|
|
713
722
|
t.same(res.json(), {
|
|
714
723
|
statusCode: 400,
|
|
724
|
+
code: 'FST_ERR_VALIDATION',
|
|
715
725
|
error: 'Bad Request',
|
|
716
726
|
message: 'abc'
|
|
717
727
|
})
|
|
@@ -772,6 +782,7 @@ test('plugin override', t => {
|
|
|
772
782
|
t.error(err)
|
|
773
783
|
t.same(res.json(), {
|
|
774
784
|
statusCode: 400,
|
|
785
|
+
code: 'FST_ERR_VALIDATION',
|
|
775
786
|
error: 'Bad Request',
|
|
776
787
|
message: 'A'
|
|
777
788
|
})
|
|
@@ -788,6 +799,7 @@ test('plugin override', t => {
|
|
|
788
799
|
t.error(err)
|
|
789
800
|
t.same(res.json(), {
|
|
790
801
|
statusCode: 400,
|
|
802
|
+
code: 'FST_ERR_VALIDATION',
|
|
791
803
|
error: 'Bad Request',
|
|
792
804
|
message: 'B'
|
|
793
805
|
})
|
|
@@ -804,6 +816,7 @@ test('plugin override', t => {
|
|
|
804
816
|
t.error(err)
|
|
805
817
|
t.same(res.json(), {
|
|
806
818
|
statusCode: 400,
|
|
819
|
+
code: 'FST_ERR_VALIDATION',
|
|
807
820
|
error: 'Bad Request',
|
|
808
821
|
message: 'C'
|
|
809
822
|
})
|
|
@@ -820,6 +833,7 @@ test('plugin override', t => {
|
|
|
820
833
|
t.error(err)
|
|
821
834
|
t.same(res.json(), {
|
|
822
835
|
statusCode: 400,
|
|
836
|
+
code: 'FST_ERR_VALIDATION',
|
|
823
837
|
error: 'Bad Request',
|
|
824
838
|
message: 'D'
|
|
825
839
|
})
|
|
@@ -836,6 +850,7 @@ test('plugin override', t => {
|
|
|
836
850
|
t.error(err)
|
|
837
851
|
t.same(res.json(), {
|
|
838
852
|
statusCode: 400,
|
|
853
|
+
code: 'FST_ERR_VALIDATION',
|
|
839
854
|
error: 'Bad Request',
|
|
840
855
|
message: 'C'
|
|
841
856
|
})
|
package/types/.eslintrc.json
CHANGED
package/types/instance.d.ts
CHANGED
|
@@ -99,7 +99,7 @@ export interface FastifyInstance<
|
|
|
99
99
|
prefix: string;
|
|
100
100
|
version: string;
|
|
101
101
|
log: Logger;
|
|
102
|
-
|
|
102
|
+
listeningOrigin: string;
|
|
103
103
|
addresses(): AddressInfo[]
|
|
104
104
|
withTypeProvider<Provider extends FastifyTypeProvider>(): FastifyInstance<RawServer, RawRequest, RawReply, Logger, Provider>;
|
|
105
105
|
|
package/types/logger.d.ts
CHANGED
|
@@ -35,6 +35,15 @@ export interface FastifyLoggerStreamDestination {
|
|
|
35
35
|
|
|
36
36
|
export type PinoLoggerOptions = pino.LoggerOptions
|
|
37
37
|
|
|
38
|
+
// TODO: once node 18 is EOL, this type can be replaced with plain FastifyReply.
|
|
39
|
+
/**
|
|
40
|
+
* Specialized reply type used for the `res` log serializer, since only `statusCode` is passed in certain cases.
|
|
41
|
+
*/
|
|
42
|
+
export type ResSerializerReply<
|
|
43
|
+
RawServer extends RawServerBase,
|
|
44
|
+
RawReply extends FastifyReply<RawServer>
|
|
45
|
+
> = Partial<RawReply> & Pick<RawReply, 'statusCode'>;
|
|
46
|
+
|
|
38
47
|
/**
|
|
39
48
|
* Fastify Custom Logger options.
|
|
40
49
|
*/
|
|
@@ -59,7 +68,7 @@ export interface FastifyLoggerOptions<
|
|
|
59
68
|
stack: string;
|
|
60
69
|
[key: string]: unknown;
|
|
61
70
|
};
|
|
62
|
-
res?: (res: RawReply) => {
|
|
71
|
+
res?: (res: ResSerializerReply<RawServer, RawReply>) => {
|
|
63
72
|
statusCode?: string | number;
|
|
64
73
|
[key: string]: unknown;
|
|
65
74
|
};
|
package/types/reply.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export interface FastifyReply<
|
|
|
43
43
|
// Node's `getHeaders()` can return numbers and arrays, so they're included here as possible types.
|
|
44
44
|
[key: string]: number | string | string[] | undefined;
|
|
45
45
|
};
|
|
46
|
-
removeHeader(key: string):
|
|
46
|
+
removeHeader(key: string): FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>;
|
|
47
47
|
hasHeader(key: string): boolean;
|
|
48
48
|
// Note: should consider refactoring the argument order for redirect. statusCode is optional so it should be after the required url param
|
|
49
49
|
redirect(statusCode: number, url: string): FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>;
|
|
@@ -61,4 +61,10 @@ export interface FastifyReply<
|
|
|
61
61
|
serializeInput(input: {[key: string]: unknown}, schema: {[key: string]: unknown}, httpStatus?: string, contentType?: string): string;
|
|
62
62
|
serializeInput(input: {[key: string]: unknown}, httpStatus: string, contentType?: string): unknown;
|
|
63
63
|
then(fulfilled: () => void, rejected: (err: Error) => void): void;
|
|
64
|
+
trailer: (
|
|
65
|
+
key: string,
|
|
66
|
+
fn: ((reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>, payload: string | Buffer | null) => Promise<string>) | ((reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>, payload: string | Buffer | null, done: (err: Error | null, value?: string) => void) => void)
|
|
67
|
+
) => FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>;
|
|
68
|
+
hasTrailer(key: string): boolean;
|
|
69
|
+
removeTrailer(key: string): FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider>;
|
|
64
70
|
}
|
package/types/route.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { FastifyRequest, RequestGenericInterface } from './request'
|
|
|
3
3
|
import { FastifyReply, ReplyGenericInterface } from './reply'
|
|
4
4
|
import { FastifySchema, FastifySchemaCompiler, FastifySerializerCompiler, SchemaErrorFormatter } from './schema'
|
|
5
5
|
import { HTTPMethods, RawServerBase, RawServerDefault, RawRequestDefaultExpression, RawReplyDefaultExpression, ContextConfigDefault } from './utils'
|
|
6
|
-
import { preValidationHookHandler, preHandlerHookHandler, preSerializationHookHandler, onRequestHookHandler, preParsingHookHandler, onResponseHookHandler, onSendHookHandler, onErrorHookHandler, onTimeoutHookHandler, onRequestAbortHookHandler
|
|
6
|
+
import { preValidationHookHandler, preHandlerHookHandler, preSerializationHookHandler, onRequestHookHandler, preParsingHookHandler, onResponseHookHandler, onSendHookHandler, onErrorHookHandler, onTimeoutHookHandler, onRequestAbortHookHandler } from './hooks'
|
|
7
7
|
import { FastifyError } from '@fastify/error'
|
|
8
8
|
import { FastifyContext } from './context'
|
|
9
9
|
import {
|
|
@@ -45,45 +45,25 @@ export interface RouteShorthandOptions<
|
|
|
45
45
|
|
|
46
46
|
// hooks
|
|
47
47
|
onRequest?: onRequestHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
48
|
-
| onRequestHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>[]
|
|
49
|
-
| onRequestAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
50
|
-
| onRequestAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>[];
|
|
48
|
+
| onRequestHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>[];
|
|
51
49
|
preParsing?: preParsingHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
52
|
-
| preParsingHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>[]
|
|
53
|
-
| preParsingAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
54
|
-
| preParsingAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>[];
|
|
50
|
+
| preParsingHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>[];
|
|
55
51
|
preValidation?: preValidationHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
56
|
-
| preValidationHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>[]
|
|
57
|
-
| preValidationAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
58
|
-
| preValidationAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>[];
|
|
52
|
+
| preValidationHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>[];
|
|
59
53
|
preHandler?: preHandlerHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
60
|
-
| preHandlerHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>[]
|
|
61
|
-
| preHandlerAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
62
|
-
| preHandlerAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>[];
|
|
54
|
+
| preHandlerHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>[];
|
|
63
55
|
preSerialization?: preSerializationHookHandler<unknown, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
64
|
-
| preSerializationHookHandler<unknown, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>[]
|
|
65
|
-
| preSerializationAsyncHookHandler<unknown, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
66
|
-
| preSerializationAsyncHookHandler<unknown, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>[];
|
|
56
|
+
| preSerializationHookHandler<unknown, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>[];
|
|
67
57
|
onSend?: onSendHookHandler<unknown, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
68
|
-
| onSendHookHandler<unknown, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>[]
|
|
69
|
-
| onSendAsyncHookHandler<unknown, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
70
|
-
| onSendAsyncHookHandler<unknown, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>[];
|
|
58
|
+
| onSendHookHandler<unknown, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>[];
|
|
71
59
|
onResponse?: onResponseHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
72
|
-
| onResponseHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>[]
|
|
73
|
-
| onResponseAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
74
|
-
| onResponseAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>[];
|
|
60
|
+
| onResponseHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>[];
|
|
75
61
|
onTimeout?: onTimeoutHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
76
|
-
| onTimeoutHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>[]
|
|
77
|
-
| onTimeoutAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
78
|
-
| onTimeoutAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>[];
|
|
62
|
+
| onTimeoutHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>[];
|
|
79
63
|
onError?: onErrorHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, FastifyError, SchemaCompiler, TypeProvider, Logger>
|
|
80
|
-
| onErrorHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, FastifyError, SchemaCompiler, TypeProvider, Logger>[]
|
|
81
|
-
| onErrorAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, FastifyError, SchemaCompiler, TypeProvider, Logger>
|
|
82
|
-
| onErrorAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, FastifyError, SchemaCompiler, TypeProvider, Logger>[];
|
|
64
|
+
| onErrorHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, FastifyError, SchemaCompiler, TypeProvider, Logger>[];
|
|
83
65
|
onRequestAbort?: onRequestAbortHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
84
|
-
| onRequestAbortHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>[]
|
|
85
|
-
| onRequestAbortAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>
|
|
86
|
-
| onRequestAbortAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>[];
|
|
66
|
+
| onRequestAbortHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>[];
|
|
87
67
|
}
|
|
88
68
|
|
|
89
69
|
/**
|
package/types/type-provider.d.ts
CHANGED
package/types/utils.d.ts
CHANGED
|
@@ -5,9 +5,11 @@ import * as https from 'https'
|
|
|
5
5
|
/**
|
|
6
6
|
* Standard HTTP method strings
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
type _HTTPMethods = 'DELETE' | 'GET' | 'HEAD' | 'PATCH' | 'POST' | 'PUT' | 'OPTIONS' |
|
|
9
9
|
'PROPFIND' | 'PROPPATCH' | 'MKCOL' | 'COPY' | 'MOVE' | 'LOCK' | 'UNLOCK' | 'TRACE' | 'SEARCH'
|
|
10
10
|
|
|
11
|
+
export type HTTPMethods = Uppercase<_HTTPMethods> | Lowercase<_HTTPMethods>
|
|
12
|
+
|
|
11
13
|
/**
|
|
12
14
|
* A union type of the Node.js server types from the http, https, and http2 modules.
|
|
13
15
|
*/
|
|
File without changes
|