fastify 3.27.4 → 4.0.0-alpha.3
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/.taprc +3 -0
- package/README.md +7 -7
- package/build/build-error-serializer.js +27 -0
- package/build/build-validation.js +47 -35
- package/docs/Guides/Database.md +320 -0
- package/docs/Guides/Ecosystem.md +9 -0
- package/docs/Guides/Getting-Started.md +7 -7
- package/docs/Guides/Plugins-Guide.md +1 -1
- package/docs/Guides/Serverless.md +3 -3
- package/docs/Guides/Testing.md +2 -2
- package/docs/Migration-Guide-V4.md +12 -0
- package/docs/Reference/ContentTypeParser.md +4 -0
- package/docs/Reference/Decorators.md +2 -2
- package/docs/Reference/Encapsulation.md +2 -2
- package/docs/Reference/Errors.md +51 -6
- package/docs/Reference/HTTP2.md +3 -3
- package/docs/Reference/Hooks.md +4 -7
- package/docs/Reference/LTS.md +5 -4
- package/docs/Reference/Plugins.md +3 -3
- package/docs/Reference/Reply.md +73 -22
- package/docs/Reference/Request.md +1 -3
- package/docs/Reference/Routes.md +22 -15
- package/docs/Reference/Server.md +69 -119
- package/docs/Reference/TypeScript.md +20 -22
- package/docs/Reference/Validation-and-Serialization.md +30 -55
- package/docs/Type-Providers.md +257 -0
- package/examples/asyncawait.js +1 -1
- package/examples/benchmark/hooks-benchmark-async-await.js +1 -1
- package/examples/benchmark/hooks-benchmark.js +1 -1
- package/examples/benchmark/simple.js +1 -1
- package/examples/hooks.js +2 -2
- package/examples/http2.js +1 -1
- package/examples/https.js +1 -1
- package/examples/parser.js +13 -3
- package/examples/route-prefix.js +1 -1
- package/examples/shared-schema.js +1 -1
- package/examples/simple-stream.js +18 -0
- package/examples/simple.js +1 -1
- package/examples/simple.mjs +1 -1
- package/examples/typescript-server.ts +1 -1
- package/examples/use-plugin.js +1 -1
- package/fastify.d.ts +34 -22
- package/fastify.js +40 -36
- package/lib/configValidator.js +902 -1023
- package/lib/contentTypeParser.js +6 -16
- package/lib/context.js +36 -10
- package/lib/decorate.js +3 -1
- package/lib/error-handler.js +158 -0
- package/lib/error-serializer.js +257 -0
- package/lib/errors.js +51 -9
- package/lib/fourOhFour.js +31 -20
- package/lib/handleRequest.js +10 -13
- package/lib/hooks.js +14 -9
- package/lib/pluginOverride.js +0 -3
- package/lib/pluginUtils.js +3 -2
- package/lib/reply.js +121 -175
- package/lib/request.js +13 -10
- package/lib/route.js +131 -138
- package/lib/schema-controller.js +2 -2
- package/lib/schemas.js +27 -1
- package/lib/server.js +242 -116
- package/lib/symbols.js +5 -3
- package/lib/validation.js +11 -9
- package/lib/warnings.js +4 -12
- package/lib/wrapThenable.js +4 -11
- package/package.json +37 -39
- package/test/404s.test.js +258 -125
- package/test/500s.test.js +3 -3
- package/test/als.test.js +1 -1
- package/test/async-await.test.js +20 -76
- package/test/bodyLimit.test.js +1 -1
- package/test/build-certificate.js +6 -7
- package/test/case-insensitive.test.js +4 -4
- package/test/close-pipelining.test.js +2 -2
- package/test/close.test.js +11 -11
- package/test/content-parser.test.js +32 -0
- package/test/context-config.test.js +52 -0
- package/test/custom-http-server.test.js +14 -7
- package/test/custom-parser-async.test.js +1 -66
- package/test/custom-parser.test.js +92 -159
- package/test/custom-querystring-parser.test.js +3 -3
- package/test/decorator.test.js +11 -13
- package/test/delete.test.js +6 -6
- package/test/encapsulated-error-handler.test.js +50 -0
- package/test/esm/index.test.js +0 -14
- package/test/fastify-instance.test.js +4 -4
- package/test/fluent-schema.test.js +4 -4
- package/test/genReqId.test.js +1 -1
- package/test/get.test.js +4 -4
- package/test/handler-context.test.js +2 -2
- package/test/head.test.js +1 -1
- package/test/helper.js +19 -4
- package/test/hooks-async.test.js +15 -48
- package/test/hooks.on-ready.test.js +10 -5
- package/test/hooks.test.js +78 -119
- package/test/http2/closing.test.js +10 -16
- package/test/http2/constraint.test.js +1 -1
- package/test/http2/head.test.js +1 -1
- package/test/http2/plain.test.js +1 -1
- package/test/http2/secure-with-fallback.test.js +1 -1
- package/test/http2/secure.test.js +1 -1
- package/test/http2/unknown-http-method.test.js +4 -10
- package/test/https/custom-https-server.test.js +12 -6
- package/test/https/https.test.js +1 -1
- package/test/input-validation.js +3 -3
- package/test/internals/handleRequest.test.js +6 -43
- package/test/internals/initialConfig.test.js +41 -12
- package/test/internals/logger.test.js +2 -2
- package/test/internals/reply.test.js +317 -48
- package/test/internals/request.test.js +13 -7
- package/test/internals/server.test.js +88 -0
- package/test/listen.deprecated.test.js +202 -0
- package/test/listen.test.js +140 -145
- package/test/logger.test.js +82 -42
- package/test/maxRequestsPerSocket.test.js +8 -6
- package/test/middleware.test.js +2 -25
- package/test/nullable-validation.test.js +53 -16
- package/test/output-validation.test.js +1 -1
- package/test/plugin.test.js +47 -21
- package/test/pretty-print.test.js +22 -10
- package/test/promises.test.js +1 -1
- package/test/proto-poisoning.test.js +6 -6
- package/test/register.test.js +3 -3
- package/test/reply-error.test.js +126 -15
- package/test/reply-trailers.test.js +270 -0
- package/test/request-error.test.js +3 -6
- package/test/route-hooks.test.js +18 -18
- package/test/route-prefix.test.js +2 -1
- package/test/route.test.js +206 -22
- package/test/router-options.test.js +2 -2
- package/test/schema-examples.test.js +11 -5
- package/test/schema-feature.test.js +25 -20
- package/test/schema-serialization.test.js +9 -9
- package/test/schema-special-usage.test.js +5 -153
- package/test/schema-validation.test.js +9 -9
- package/test/skip-reply-send.test.js +2 -2
- package/test/stream.test.js +82 -23
- package/test/throw.test.js +8 -5
- package/test/trust-proxy.test.js +6 -6
- package/test/type-provider.test.js +20 -0
- package/test/types/fastify.test-d.ts +10 -18
- package/test/types/hooks.test-d.ts +61 -5
- package/test/types/import.js +2 -0
- package/test/types/import.ts +1 -0
- package/test/types/instance.test-d.ts +68 -17
- package/test/types/logger.test-d.ts +44 -15
- package/test/types/reply.test-d.ts +2 -1
- package/test/types/request.test-d.ts +71 -1
- package/test/types/route.test-d.ts +8 -2
- package/test/types/schema.test-d.ts +2 -39
- package/test/types/type-provider.test-d.ts +424 -0
- package/test/url-rewriting.test.js +3 -3
- package/test/validation-error-handling.test.js +8 -8
- package/test/versioned-routes.test.js +30 -18
- package/test/wrapThenable.test.js +7 -6
- package/types/content-type-parser.d.ts +17 -8
- package/types/hooks.d.ts +182 -85
- package/types/instance.d.ts +286 -118
- package/types/logger.d.ts +18 -104
- package/types/plugin.d.ts +10 -4
- package/types/reply.d.ts +18 -12
- package/types/request.d.ts +13 -8
- package/types/route.d.ts +62 -34
- package/types/schema.d.ts +1 -1
- package/types/type-provider.d.ts +99 -0
- package/types/utils.d.ts +1 -1
- package/lib/schema-compilers.js +0 -12
- package/test/emit-warning.test.js +0 -166
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fastify",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha.3",
|
|
4
4
|
"description": "Fast and low overhead web framework, for Node.js",
|
|
5
5
|
"main": "fastify.js",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
"bench": "branchcmp -r 2 -g -s \"npm run benchmark\"",
|
|
10
10
|
"benchmark": "npx concurrently -k -s first \"node ./examples/benchmark/simple.js\" \"npx autocannon -c 100 -d 30 -p 10 localhost:3000/\"",
|
|
11
11
|
"coverage": "npm run unit -- --cov --coverage-report=html",
|
|
12
|
+
"coverage:ci": "npm run unit -- --cov --coverage-report=html --no-browser --no-check-coverage -R terse",
|
|
13
|
+
"coverage:ci-check-coverage": "nyc check-coverage --branches 100 --functions 100 --lines 100 --statements 100",
|
|
12
14
|
"license-checker": "license-checker --production --onlyAllow=\"MIT;ISC;BSD-3-Clause;BSD-2-Clause\"",
|
|
13
15
|
"lint": "npm run lint:standard && npm run lint:typescript",
|
|
14
16
|
"lint:fix": "standard --fix",
|
|
@@ -18,10 +20,11 @@
|
|
|
18
20
|
"test": "npm run lint && npm run unit && npm run test:typescript",
|
|
19
21
|
"test:ci": "npm run unit -- -R terse --cov --coverage-report=lcovonly && npm run test:typescript",
|
|
20
22
|
"test:report": "npm run lint && npm run unit:report && npm run test:typescript",
|
|
21
|
-
"test:typescript": "tsd",
|
|
22
|
-
"
|
|
23
|
+
"test:typescript": "tsc test/types/import.ts && tsd",
|
|
24
|
+
"test:watch": "npm run unit -- -w --no-coverage-report -R terse",
|
|
25
|
+
"unit": "tap",
|
|
23
26
|
"unit:junit": "tap-mocha-reporter xunit < out.tap > test/junit-testresults.xml",
|
|
24
|
-
"unit:report": "tap
|
|
27
|
+
"unit:report": "tap --cov --coverage-report=html --coverage-report=cobertura | tee out.tap"
|
|
25
28
|
},
|
|
26
29
|
"repository": {
|
|
27
30
|
"type": "git",
|
|
@@ -121,24 +124,19 @@
|
|
|
121
124
|
},
|
|
122
125
|
"homepage": "https://www.fastify.io/",
|
|
123
126
|
"devDependencies": {
|
|
124
|
-
"@fastify/ajv-compiler-8": "npm:@fastify/ajv-compiler@^2.0.0",
|
|
125
127
|
"@fastify/pre-commit": "^2.0.1",
|
|
126
|
-
"@
|
|
128
|
+
"@sinclair/typebox": "^0.23.1",
|
|
127
129
|
"@sinonjs/fake-timers": "^9.1.0",
|
|
128
|
-
"@types/node": "^
|
|
129
|
-
"@
|
|
130
|
-
"@typescript-eslint/
|
|
131
|
-
"
|
|
132
|
-
"
|
|
133
|
-
"ajv": "^6.0.0",
|
|
134
|
-
"ajv-errors": "^1.0.1",
|
|
130
|
+
"@types/node": "^17.0.18",
|
|
131
|
+
"@typescript-eslint/eslint-plugin": "^5.7.0",
|
|
132
|
+
"@typescript-eslint/parser": "^5.7.0",
|
|
133
|
+
"ajv": "^8.10.0",
|
|
134
|
+
"ajv-errors": "^3.0.0",
|
|
135
135
|
"ajv-formats": "^2.1.1",
|
|
136
|
-
"ajv-i18n": "^
|
|
137
|
-
"ajv-merge-patch": "^
|
|
138
|
-
"
|
|
139
|
-
"branch-comparer": "^1.0.2",
|
|
136
|
+
"ajv-i18n": "^4.2.0",
|
|
137
|
+
"ajv-merge-patch": "^5.0.1",
|
|
138
|
+
"branch-comparer": "^1.1.0",
|
|
140
139
|
"cors": "^2.8.5",
|
|
141
|
-
"coveralls": "^3.1.0",
|
|
142
140
|
"dns-prefetch-control": "^0.3.0",
|
|
143
141
|
"eslint": "^8.0.1",
|
|
144
142
|
"eslint-config-standard": "^17.0.0-1",
|
|
@@ -147,46 +145,45 @@
|
|
|
147
145
|
"eslint-plugin-n": "^14.0.0",
|
|
148
146
|
"eslint-plugin-promise": "^6.0.0",
|
|
149
147
|
"fast-json-body": "^1.1.0",
|
|
148
|
+
"fast-json-stringify": "^3.0.0",
|
|
150
149
|
"fastify-plugin": "^3.0.0",
|
|
151
|
-
"fluent-json-schema": "^3.0.
|
|
150
|
+
"fluent-json-schema": "^3.0.1",
|
|
152
151
|
"form-data": "^4.0.0",
|
|
153
152
|
"frameguard": "^4.0.0",
|
|
154
153
|
"h2url": "^0.2.0",
|
|
155
154
|
"helmet": "^5.0.1",
|
|
156
155
|
"hide-powered-by": "^1.1.0",
|
|
157
|
-
"hsts": "^2.2.0",
|
|
158
156
|
"http-errors": "^2.0.0",
|
|
159
|
-
"
|
|
157
|
+
"joi": "^17.5.0",
|
|
158
|
+
"json-schema-to-ts": "^1.6.4",
|
|
159
|
+
"JSONStream": "^1.3.5",
|
|
160
160
|
"license-checker": "^25.0.1",
|
|
161
|
-
"pem": "^1.14.4",
|
|
162
161
|
"proxyquire": "^2.1.3",
|
|
163
162
|
"pump": "^3.0.0",
|
|
164
|
-
"
|
|
163
|
+
"self-cert": "^2.0.0",
|
|
164
|
+
"send": "^0.18.0",
|
|
165
165
|
"serve-static": "^1.14.1",
|
|
166
166
|
"simple-get": "^4.0.0",
|
|
167
167
|
"snazzy": "^9.0.0",
|
|
168
168
|
"split2": "^4.1.0",
|
|
169
169
|
"standard": "^17.0.0-2",
|
|
170
|
-
"tap": "^
|
|
171
|
-
"
|
|
172
|
-
"
|
|
173
|
-
"
|
|
174
|
-
"typescript": "^4.0.2",
|
|
175
|
-
"undici": "^3.3.6",
|
|
170
|
+
"tap": "^16.0.0",
|
|
171
|
+
"tsd": "^0.19.1",
|
|
172
|
+
"typescript": "^4.5.4",
|
|
173
|
+
"undici": "^4.11.3",
|
|
176
174
|
"x-xss-protection": "^2.0.0",
|
|
177
|
-
"yup": "^0.32.
|
|
175
|
+
"yup": "^0.32.11"
|
|
178
176
|
},
|
|
179
177
|
"dependencies": {
|
|
180
|
-
"@fastify/ajv-compiler": "^1.0
|
|
181
|
-
"
|
|
182
|
-
"
|
|
183
|
-
"
|
|
184
|
-
"fastify-error": "^0.
|
|
178
|
+
"@fastify/ajv-compiler": "^3.1.0",
|
|
179
|
+
"@fastify/fast-json-stringify-compiler": "^1.0.0",
|
|
180
|
+
"abstract-logging": "^2.0.1",
|
|
181
|
+
"avvio": "^8.1.0",
|
|
182
|
+
"fastify-error": "^1.0.0",
|
|
183
|
+
"find-my-way": "^5.1.0",
|
|
184
|
+
"light-my-request": "^4.7.0",
|
|
185
|
+
"pino": "^7.5.1",
|
|
185
186
|
"process-warning": "^1.0.0",
|
|
186
|
-
"find-my-way": "^4.5.0",
|
|
187
|
-
"flatstr": "^1.0.12",
|
|
188
|
-
"light-my-request": "^4.2.0",
|
|
189
|
-
"pino": "^6.13.0",
|
|
190
187
|
"proxy-addr": "^2.0.7",
|
|
191
188
|
"rfdc": "^1.1.4",
|
|
192
189
|
"secure-json-parse": "^2.0.0",
|
|
@@ -196,6 +193,7 @@
|
|
|
196
193
|
"standard": {
|
|
197
194
|
"ignore": [
|
|
198
195
|
"lib/configValidator.js",
|
|
196
|
+
"lib/error-serializer.js",
|
|
199
197
|
"fastify.d.ts",
|
|
200
198
|
"types/*",
|
|
201
199
|
"test/types/*",
|