fastify 5.8.5 → 5.9.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.
Files changed (103) hide show
  1. package/SECURITY.md +1 -1
  2. package/SPONSORS.md +6 -4
  3. package/docs/Guides/Database.md +0 -28
  4. package/docs/Guides/Ecosystem.md +13 -2
  5. package/docs/Guides/Serverless.md +2 -2
  6. package/docs/Guides/Write-Plugin.md +1 -1
  7. package/docs/Reference/Encapsulation.md +27 -26
  8. package/docs/Reference/Errors.md +10 -4
  9. package/docs/Reference/HTTP2.md +10 -10
  10. package/docs/Reference/Hooks.md +4 -4
  11. package/docs/Reference/Index.md +14 -16
  12. package/docs/Reference/LTS.md +12 -13
  13. package/docs/Reference/Lifecycle.md +9 -8
  14. package/docs/Reference/Logging.md +44 -39
  15. package/docs/Reference/Middleware.md +21 -25
  16. package/docs/Reference/Principles.md +2 -2
  17. package/docs/Reference/Reply.md +6 -1
  18. package/docs/Reference/Request.md +27 -16
  19. package/docs/Reference/Routes.md +5 -2
  20. package/docs/Reference/Server.md +31 -3
  21. package/docs/Reference/Type-Providers.md +29 -5
  22. package/docs/Reference/Validation-and-Serialization.md +15 -2
  23. package/docs/Reference/Warnings.md +7 -6
  24. package/eslint.config.js +7 -2
  25. package/fastify.d.ts +8 -3
  26. package/fastify.js +43 -14
  27. package/lib/content-type-parser.js +13 -1
  28. package/lib/decorate.js +11 -3
  29. package/lib/error-handler.js +4 -3
  30. package/lib/error-serializer.js +59 -59
  31. package/lib/errors.js +16 -1
  32. package/lib/four-oh-four.js +14 -9
  33. package/lib/handle-request.js +11 -5
  34. package/lib/plugin-override.js +2 -1
  35. package/lib/plugin-utils.js +5 -5
  36. package/lib/reply.js +63 -8
  37. package/lib/request.js +14 -4
  38. package/lib/route.js +20 -6
  39. package/lib/schema-controller.js +1 -1
  40. package/lib/schemas.js +37 -30
  41. package/lib/symbols.js +3 -1
  42. package/lib/validation.js +1 -13
  43. package/lib/warnings.js +3 -3
  44. package/package.json +13 -15
  45. package/scripts/validate-ecosystem-links.js +1 -0
  46. package/test/bundler/esbuild/package.json +1 -1
  47. package/test/close-pipelining.test.js +1 -2
  48. package/test/custom-http-server.test.js +38 -0
  49. package/test/decorator-instance-properties.test.js +63 -0
  50. package/test/diagnostics-channel/async-error-handler.test.js +74 -0
  51. package/test/hooks.test.js +23 -0
  52. package/test/http-methods/get.test.js +1 -1
  53. package/test/http2/plain.test.js +135 -0
  54. package/test/http2/secure-with-fallback.test.js +1 -1
  55. package/test/https/https.test.js +1 -2
  56. package/test/internals/errors.test.js +31 -1
  57. package/test/internals/plugin.test.js +3 -1
  58. package/test/internals/request.test.js +27 -3
  59. package/test/internals/schema-controller-perf.test.js +33 -0
  60. package/test/logger/logging.test.js +18 -1
  61. package/test/logger/options.test.js +38 -1
  62. package/test/reply-error.test.js +1 -1
  63. package/test/reply-trailers.test.js +70 -0
  64. package/test/request-media-type.test.js +105 -0
  65. package/test/route-prefix.test.js +34 -0
  66. package/test/router-options.test.js +222 -11
  67. package/test/schema-serialization.test.js +108 -0
  68. package/test/schema-validation.test.js +24 -0
  69. package/test/scripts/validate-ecosystem-links.test.js +40 -57
  70. package/test/throw.test.js +14 -0
  71. package/test/trust-proxy.test.js +21 -0
  72. package/test/types/content-type-parser.tst.ts +70 -0
  73. package/test/types/{decorate-request-reply.test-d.ts → decorate-request-reply.tst.ts} +4 -4
  74. package/test/types/{dummy-plugin.ts → dummy-plugin.mts} +1 -1
  75. package/test/types/errors.tst.ts +91 -0
  76. package/test/types/fastify.tst.ts +351 -0
  77. package/test/types/hooks.tst.ts +578 -0
  78. package/test/types/instance.tst.ts +597 -0
  79. package/test/types/{logger.test-d.ts → logger.tst.ts} +61 -62
  80. package/test/types/plugin.tst.ts +96 -0
  81. package/test/types/register.tst.ts +245 -0
  82. package/test/types/reply.tst.ts +297 -0
  83. package/test/types/request.tst.ts +199 -0
  84. package/test/types/route.tst.ts +576 -0
  85. package/test/types/{schema.test-d.ts → schema.tst.ts} +22 -22
  86. package/test/types/{serverFactory.test-d.ts → serverFactory.tst.ts} +4 -4
  87. package/test/types/tsconfig.json +9 -0
  88. package/test/types/{type-provider.test-d.ts → type-provider.tst.ts} +256 -250
  89. package/test/types/using.tst.ts +14 -0
  90. package/types/errors.d.ts +3 -0
  91. package/types/request.d.ts +23 -2
  92. package/test/types/content-type-parser.test-d.ts +0 -72
  93. package/test/types/errors.test-d.ts +0 -90
  94. package/test/types/fastify.test-d.ts +0 -352
  95. package/test/types/hooks.test-d.ts +0 -550
  96. package/test/types/import.ts +0 -2
  97. package/test/types/instance.test-d.ts +0 -588
  98. package/test/types/plugin.test-d.ts +0 -97
  99. package/test/types/register.test-d.ts +0 -237
  100. package/test/types/reply.test-d.ts +0 -254
  101. package/test/types/request.test-d.ts +0 -188
  102. package/test/types/route.test-d.ts +0 -553
  103. package/test/types/using.test-d.ts +0 -17
@@ -1,6 +1,6 @@
1
- import fastify, { FastifyServerFactory } from '../../fastify'
2
1
  import * as http from 'node:http'
3
- import { expectType } from 'tsd'
2
+ import { expect } from 'tstyche'
3
+ import fastify, { FastifyServerFactory } from '../../fastify.js'
4
4
 
5
5
  // Custom Server
6
6
  type CustomType = void
@@ -28,10 +28,10 @@ const customServer = fastify<http.Server, CustomIncomingMessage, CustomServerRes
28
28
 
29
29
  customServer.get('/', function (request, reply) {
30
30
  if (request.raw.fakeMethod) {
31
- expectType<CustomType>(request.raw.fakeMethod())
31
+ expect(request.raw.fakeMethod()).type.toBe<CustomType>()
32
32
  }
33
33
 
34
34
  if (reply.raw.fakeMethod) {
35
- expectType<CustomType>(reply.raw.fakeMethod())
35
+ expect(reply.raw.fakeMethod()).type.toBe<CustomType>()
36
36
  }
37
37
  })
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "fastify-tsconfig",
3
+ "compilerOptions": {
4
+ "noEmit": true,
5
+ "noUnusedLocals": false,
6
+ "noUnusedParameters": false,
7
+ "types": ["node"]
8
+ }
9
+ }