fastify 4.10.0 → 4.10.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.
@@ -265,6 +265,8 @@ section.
265
265
  - [`fastify-cockroachdb`](https://github.com/alex-ppg/fastify-cockroachdb)
266
266
  Fastify plugin to connect to a CockroachDB PostgreSQL instance via the
267
267
  Sequelize ORM.
268
+ - [`fastify-constraints`](https://github.com/nearform/fastify-constraints)
269
+ Fastify plugin to add constraints to multiple routes
268
270
  - [`fastify-couchdb`](https://github.com/nigelhanlon/fastify-couchdb) Fastify
269
271
  plugin to add CouchDB support via [nano](https://github.com/apache/nano).
270
272
  - [`fastify-crud-generator`](https://github.com/beliven-it/fastify-crud-generator)
package/fastify.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- const VERSION = '4.10.0'
3
+ const VERSION = '4.10.1'
4
4
 
5
5
  const Avvio = require('avvio')
6
6
  const http = require('http')
package/package.json CHANGED
@@ -1,10 +1,32 @@
1
1
  {
2
2
  "name": "fastify",
3
- "version": "4.10.0",
3
+ "version": "4.10.1",
4
4
  "description": "Fast and low overhead web framework, for Node.js",
5
5
  "main": "fastify.js",
6
6
  "type": "commonjs",
7
7
  "types": "fastify.d.ts",
8
+ "scripts": {
9
+ "bench": "branchcmp -r 2 -g -s \"npm run benchmark\"",
10
+ "benchmark": "npx concurrently -k -s first \"node ./examples/benchmark/simple.js\" \"npx autocannon -c 100 -d 30 -p 10 localhost:3000/\"",
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",
14
+ "license-checker": "license-checker --production --onlyAllow=\"MIT;ISC;BSD-3-Clause;BSD-2-Clause\"",
15
+ "lint": "npm run lint:standard && npm run lint:typescript && npm run lint:markdown",
16
+ "lint:fix": "standard --fix",
17
+ "lint:markdown": "markdownlint-cli2",
18
+ "lint:standard": "standard | snazzy",
19
+ "lint:typescript": "eslint -c types/.eslintrc.json types/**/*.d.ts test/types/**/*.test-d.ts",
20
+ "prepublishOnly": "PREPUBLISH=true tap --no-check-coverage test/build/**.test.js",
21
+ "test": "npm run lint && npm run unit && npm run test:typescript",
22
+ "test:ci": "npm run unit -- -R terse --cov --coverage-report=lcovonly && npm run test:typescript",
23
+ "test:report": "npm run lint && npm run unit:report && npm run test:typescript",
24
+ "test:typescript": "tsc test/types/import.ts && tsd",
25
+ "test:watch": "npm run unit -- -w --no-coverage-report -R terse",
26
+ "unit": "tap",
27
+ "unit:junit": "tap-mocha-reporter xunit < out.tap > test/junit-testresults.xml",
28
+ "unit:report": "tap --cov --coverage-report=html --coverage-report=cobertura | tee out.tap"
29
+ },
8
30
  "repository": {
9
31
  "type": "git",
10
32
  "url": "git+https://github.com/fastify/fastify.git"
@@ -105,7 +127,7 @@
105
127
  "devDependencies": {
106
128
  "@fastify/pre-commit": "^2.0.2",
107
129
  "@sinclair/typebox": "^0.25.2",
108
- "@sinonjs/fake-timers": "^9.1.2",
130
+ "@sinonjs/fake-timers": "^10.0.0",
109
131
  "@types/node": "^18.7.18",
110
132
  "@typescript-eslint/eslint-plugin": "^5.37.0",
111
133
  "@typescript-eslint/parser": "^5.37.0",
@@ -176,26 +198,5 @@
176
198
  },
177
199
  "tsd": {
178
200
  "directory": "test/types"
179
- },
180
- "scripts": {
181
- "bench": "branchcmp -r 2 -g -s \"npm run benchmark\"",
182
- "benchmark": "npx concurrently -k -s first \"node ./examples/benchmark/simple.js\" \"npx autocannon -c 100 -d 30 -p 10 localhost:3000/\"",
183
- "coverage": "npm run unit -- --cov --coverage-report=html",
184
- "coverage:ci": "npm run unit -- --cov --coverage-report=html --no-browser --no-check-coverage -R terse",
185
- "coverage:ci-check-coverage": "nyc check-coverage --branches 100 --functions 100 --lines 100 --statements 100",
186
- "license-checker": "license-checker --production --onlyAllow=\"MIT;ISC;BSD-3-Clause;BSD-2-Clause\"",
187
- "lint": "npm run lint:standard && npm run lint:typescript && npm run lint:markdown",
188
- "lint:fix": "standard --fix",
189
- "lint:markdown": "markdownlint-cli2",
190
- "lint:standard": "standard | snazzy",
191
- "lint:typescript": "eslint -c types/.eslintrc.json types/**/*.d.ts test/types/**/*.test-d.ts",
192
- "test": "npm run lint && npm run unit && npm run test:typescript",
193
- "test:ci": "npm run unit -- -R terse --cov --coverage-report=lcovonly && npm run test:typescript",
194
- "test:report": "npm run lint && npm run unit:report && npm run test:typescript",
195
- "test:typescript": "tsc test/types/import.ts && tsd",
196
- "test:watch": "npm run unit -- -w --no-coverage-report -R terse",
197
- "unit": "tap",
198
- "unit:junit": "tap-mocha-reporter xunit < out.tap > test/junit-testresults.xml",
199
- "unit:report": "tap --cov --coverage-report=html --coverage-report=cobertura | tee out.tap"
200
201
  }
201
- }
202
+ }
@@ -36,19 +36,18 @@ test('listen should accept stringified number port', t => {
36
36
 
37
37
  test('listen should reject string port', async (t) => {
38
38
  t.plan(2)
39
-
40
39
  const fastify = Fastify()
41
40
  t.teardown(fastify.close.bind(fastify))
42
41
 
43
42
  try {
44
43
  await fastify.listen({ port: 'hello-world' })
45
44
  } catch (error) {
46
- t.same(error.message, 'options.port should be >= 0 and < 65536. Received hello-world.')
45
+ t.equal(error.code, 'ERR_SOCKET_BAD_PORT')
47
46
  }
48
47
 
49
48
  try {
50
49
  await fastify.listen({ port: '1234hello' })
51
50
  } catch (error) {
52
- t.same(error.message, 'options.port should be >= 0 and < 65536. Received 1234hello.')
51
+ t.equal(error.code, 'ERR_SOCKET_BAD_PORT')
53
52
  }
54
53
  })
@@ -183,6 +183,7 @@ expectDeprecated({} as FastifyLoggerInstance)
183
183
  const childParent = fastify().log
184
184
  // we test different option variant here
185
185
  expectType<FastifyLoggerInstance>(childParent.child({}, { level: 'info' }))
186
+ expectType<FastifyLoggerInstance>(childParent.child({}, { level: 'silent' }))
186
187
  expectType<FastifyLoggerInstance>(childParent.child({}, { redact: ['pass', 'pin'] }))
187
188
  expectType<FastifyLoggerInstance>(childParent.child({}, { serializers: { key: () => {} } }))
188
189
  expectType<FastifyLoggerInstance>(childParent.child({}, { level: 'info', redact: ['pass', 'pin'], serializers: { key: () => {} } }))
package/types/logger.d.ts CHANGED
@@ -13,7 +13,7 @@ import pino from 'pino'
13
13
  */
14
14
  export type FastifyLogFn = pino.LogFn
15
15
 
16
- export type LogLevel = pino.Level
16
+ export type LogLevel = pino.LevelWithSilent
17
17
 
18
18
  export type Bindings = pino.Bindings
19
19