Skip to content

Commit 27599f3

Browse files
committed
Upgrade fastify to v4
1 parent a0cef9d commit 27599f3

18 files changed

+44
-44
lines changed

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ app.register(mercuriusValidation, {
117117
}
118118
})
119119

120-
app.listen(3000)
120+
app.listen({ port: 3000 })
121121
```
122122

123123
### Validation with the GraphQL `@constraint` directive
@@ -187,7 +187,7 @@ app.register(mercurius, {
187187
})
188188
app.register(mercuriusValidation)
189189

190-
app.listen(3000)
190+
app.listen({ port: 3000 })
191191
```
192192

193193
## Benchmarks
@@ -197,7 +197,7 @@ app.listen(3000)
197197
Last run: `2021-09-27`
198198

199199
```text
200-
Running 10s test @ http://localhost:3000/graphql
200+
Running 10s test @ http://127.0.0.1:3000/graphql
201201
100 connections
202202
203203
┌─────────┬──────┬──────┬───────┬───────┬─────────┬─────────┬───────┐
@@ -223,7 +223,7 @@ Req/Bytes counts sampled once per second.
223223
Last run: `2021-09-27`
224224

225225
```text
226-
Running 10s test @ http://localhost:3000/graphql
226+
Running 10s test @ http://127.0.0.1:3000/graphql
227227
100 connections
228228
229229
┌─────────┬──────┬──────┬───────┬───────┬─────────┬─────────┬───────┐
@@ -249,7 +249,7 @@ Req/Bytes counts sampled once per second.
249249
Last run: `2021-09-27`
250250

251251
```text
252-
Running 10s test @ http://localhost:3000/graphql
252+
Running 10s test @ http://127.0.0.1:3000/graphql
253253
100 connections
254254
255255
┌─────────┬───────┬───────┬───────┬────────┬──────────┬──────────┬────────┐
@@ -275,7 +275,7 @@ Req/Bytes counts sampled once per second.
275275
Last run: `2021-09-27`
276276

277277
```text
278-
Running 10s test @ http://localhost:3000/graphql
278+
Running 10s test @ http://127.0.0.1:3000/graphql
279279
100 connections
280280
281281
┌─────────┬───────┬───────┬───────┬────────┬──────────┬──────────┬────────┐

bench/gateway-bench.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const query = `
2222

2323
const instance = autocannon(
2424
{
25-
url: 'http://localhost:3000/graphql',
25+
url: 'http://127.0.0.1:3000/graphql',
2626
connections: 100,
2727
title: '',
2828
method: 'POST',

bench/gateway-post-service.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,4 @@ app.register(mercurius, {
7777
jit: 1
7878
})
7979

80-
app.listen(3002)
80+
app.listen({ port: 3002 })

bench/gateway-user-service.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ app.register(mercurius, {
4747
jit: 1
4848
})
4949

50-
app.listen(3001)
50+
app.listen({ port: 3001 })

bench/gateway-with-validation.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ app.register(mercurius, {
1010
gateway: {
1111
services: [{
1212
name: 'user',
13-
url: 'http://localhost:3001/graphql'
13+
url: 'http://127.0.0.1:3001/graphql'
1414
}, {
1515
name: 'post',
16-
url: 'http://localhost:3002/graphql'
16+
url: 'http://127.0.0.1:3002/graphql'
1717
}]
1818
},
1919
graphiql: false,
@@ -38,4 +38,4 @@ app.register(mercuriusValidation, {
3838
}
3939
})
4040

41-
app.listen(3000)
41+
app.listen({ port: 3000 })

bench/gateway-without-validation.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ app.register(mercurius, {
99
gateway: {
1010
services: [{
1111
name: 'user',
12-
url: 'http://localhost:3001/graphql'
12+
url: 'http://127.0.0.1:3001/graphql'
1313
}, {
1414
name: 'post',
15-
url: 'http://localhost:3002/graphql'
15+
url: 'http://127.0.0.1:3002/graphql'
1616
}]
1717
},
1818
graphiql: false,
1919
jit: 1
2020
})
2121

22-
app.listen(3000)
22+
app.listen({ port: 3000 })

bench/normal-bench.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const query = `query {
2020

2121
const instance = autocannon(
2222
{
23-
url: 'http://localhost:3000/graphql',
23+
url: 'http://127.0.0.1:3000/graphql',
2424
connections: 100,
2525
title: '',
2626
method: 'POST',

bench/normal-with-validation.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ app.register(mercuriusValidation, {
4141
}
4242
})
4343

44-
app.listen(3000)
44+
app.listen({ port: 3000 })

bench/normal-without-validation.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ app.register(mercurius, {
1313
jit: 1
1414
})
1515

16-
app.listen(3000)
16+
app.listen({ port: 3000 })

docs/registration.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@ app.register(mercuriusValidation, {
5252
validationDirective: 'validation'
5353
})
5454

55-
app.listen(3000)
55+
app.listen({ port: 3000 })
5656
```

examples/directive-validation.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ app.register(mercurius, {
6060
})
6161
app.register(mercuriusValidation)
6262

63-
app.listen(3000)
63+
app.listen({ port: 3000 })

examples/gateway.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ async function createService (schema, resolvers = {}) {
1111
resolvers,
1212
federationMetadata: true
1313
})
14-
await service.listen(0)
14+
await service.listen({ port: 0 })
1515
return [service, service.server.address().port]
1616
}
1717

@@ -122,10 +122,10 @@ async function start (authOpts) {
122122
gateway: {
123123
services: [{
124124
name: 'user',
125-
url: `http://localhost:${userServicePort}/graphql`
125+
url: `http://127.0.0.1:${userServicePort}/graphql`
126126
}, {
127127
name: 'post',
128-
url: `http://localhost:${postServicePort}/graphql`
128+
url: `http://127.0.0.1:${postServicePort}/graphql`
129129
}]
130130
}
131131
})
@@ -148,7 +148,7 @@ async function start (authOpts) {
148148
}
149149
})
150150

151-
await gateway.listen(3000)
151+
await gateway.listen({ port: 3000 })
152152
}
153153

154154
start()

examples/json-schema-validation.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,4 @@ app.register(mercuriusValidation, {
7878
}
7979
})
8080

81-
app.listen(3000)
81+
app.listen({ port: 3000 })

examples/jtd-validation.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,4 @@ app.register(mercuriusValidation, {
7979
}
8080
})
8181

82-
app.listen(3000)
82+
app.listen({ port: 3000 })

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const mercuriusValidation = fp(
2222
},
2323
{
2424
name: 'mercurius-validation',
25-
fastify: '>=3.x',
25+
fastify: '4.x',
2626
dependencies: ['mercurius']
2727
}
2828
)

package.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,22 @@
3434
},
3535
"homepage": "https://github.com/mercurius-js/validation",
3636
"devDependencies": {
37-
"@sinonjs/fake-timers": "^9.0.0",
37+
"@sinonjs/fake-timers": "^9.1.2",
3838
"@types/node": "^18.0.0",
39-
"@types/ws": "^8.2.0",
40-
"@typescript-eslint/eslint-plugin": "^4.1.0",
41-
"@typescript-eslint/parser": "^4.1.0",
42-
"autocannon": "^7.0.5",
43-
"concurrently": "^7.0.0",
44-
"fastify": "^3.0.2",
45-
"mercurius": "^9.1.0",
39+
"@types/ws": "^8.5.3",
40+
"@typescript-eslint/eslint-plugin": "^5.30.3",
41+
"@typescript-eslint/parser": "^5.30.3",
42+
"autocannon": "^7.9.0",
43+
"concurrently": "^7.2.2",
44+
"fastify": "^4.2.0",
45+
"mercurius": "^10.0.0",
4646
"pre-commit": "^1.2.2",
4747
"snazzy": "^9.0.0",
4848
"standard": "^17.0.0",
49-
"tap": "^16.0.0",
50-
"tsd": "^0.21.0",
51-
"typescript": "^4.0.3",
52-
"wait-on": "^6.0.0"
49+
"tap": "^16.3.0",
50+
"tsd": "^0.22.0",
51+
"typescript": "^4.7.4",
52+
"wait-on": "^6.0.1"
5353
},
5454
"dependencies": {
5555
"@fastify/error": "^3.0.0",

test/gateway-validation.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ async function createTestService (t, schema, resolvers = {}) {
1212
resolvers,
1313
federationMetadata: true
1414
})
15-
await service.listen(0)
15+
await service.listen({ port: 0 })
1616
return [service, service.server.address().port]
1717
}
1818

@@ -139,10 +139,10 @@ async function createTestGatewayServer (t, validationOptions) {
139139
gateway: {
140140
services: [{
141141
name: 'user',
142-
url: `http://localhost:${userServicePort}/graphql`
142+
url: `http://127.0.0.1:${userServicePort}/graphql`
143143
}, {
144144
name: 'post',
145-
url: `http://localhost:${postServicePort}/graphql`
145+
url: `http://127.0.0.1:${postServicePort}/graphql`
146146
}]
147147
}
148148
})

test/refresh.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ t.test('gateway refresh', t => {
8383
federationMetadata: true
8484
})
8585

86-
await messageService.listen(0)
86+
await messageService.listen({ port: 0 })
8787

8888
const messageServicePort = messageService.server.address().port
8989

@@ -92,7 +92,7 @@ t.test('gateway refresh', t => {
9292
services: [
9393
{
9494
name: 'message',
95-
url: `http://localhost:${messageServicePort}/graphql`
95+
url: `http://127.0.0.1:${messageServicePort}/graphql`
9696
}
9797
],
9898
pollingInterval: 2000

0 commit comments

Comments
 (0)