mercurius
Advanced tools
Comparing version 9.8.0 to 10.0.0
# FAQ | ||
This page answers common asked questions about Mercurius. | ||
This page answers commonly asked questions about Mercurius. | ||
## Disable Graphql instrospection | ||
To disable Graphql instrospection you can use `NoSchemaIntrospectionCustomRule` from graphql, we have an example on "example/disable-instrospection.js", using this approach: | ||
## Disable Graphql introspection | ||
To disable Graphql introspection you can use `NoSchemaIntrospectionCustomRule` from graphql. We have an example on "example/disable-instrospection.js", using this approach: | ||
@@ -19,2 +19,2 @@ ```js | ||
}); | ||
``` | ||
``` |
@@ -683,3 +683,3 @@ 'use strict' | ||
name: 'mercurius', | ||
fastify: '>=3.x' | ||
fastify: '4.x' | ||
}) | ||
@@ -686,0 +686,0 @@ |
@@ -91,5 +91,5 @@ 'use strict' | ||
const postSchema = (allowBatchedQueries) => ({ | ||
body: { | ||
type: allowBatchedQueries ? ['object', 'array'] : 'object', | ||
const postSchema = (allowBatchedQueries) => { | ||
let body = { | ||
type: 'object', | ||
properties: { | ||
@@ -104,13 +104,29 @@ ...requestProperties, | ||
} | ||
}, | ||
// JSON schema isn't allowing ['object', 'array'] on response. | ||
response: allowBatchedQueries | ||
? {} | ||
: { | ||
'2xx': { | ||
type: 'object', | ||
properties: responseProperties | ||
} | ||
if (allowBatchedQueries) { | ||
body = { | ||
anyOf: [{ | ||
...body | ||
}, { | ||
type: 'array', | ||
items: { | ||
...body | ||
} | ||
} | ||
}) | ||
}] | ||
} | ||
} | ||
return { | ||
body, | ||
// JSON schema isn't allowing ['object', 'array'] on response. | ||
response: allowBatchedQueries | ||
? {} | ||
: { | ||
'2xx': { | ||
type: 'object', | ||
properties: responseProperties | ||
} | ||
} | ||
} | ||
} | ||
@@ -117,0 +133,0 @@ function validationHandler (validationError) { |
@@ -62,3 +62,3 @@ 'use strict' | ||
module.exports = function (fastify, opts, next) { | ||
module.exports = async function (fastify, opts) { | ||
const { getOptions, subscriber, verifyClient, onConnect, onDisconnect, lruGatewayResolvers, entityResolversFactory, subscriptionContextFn, keepAlive, fullWsTransport } = opts | ||
@@ -69,3 +69,3 @@ | ||
if (fastify.websocketServer === undefined) { | ||
fastify.register(fastifyWebsocket, { | ||
await fastify.register(fastifyWebsocket, { | ||
options: { | ||
@@ -92,4 +92,2 @@ maxPayload: 1048576, | ||
}) | ||
next() | ||
} |
{ | ||
"name": "mercurius", | ||
"version": "9.8.0", | ||
"version": "10.0.0", | ||
"description": "Fastify GraphQL adapter with gateway and subscription support", | ||
@@ -38,2 +38,3 @@ "main": "index.js", | ||
"@types/ws": "^8.2.0", | ||
"@types/isomorphic-form-data": "^2.0.0", | ||
"@typescript-eslint/eslint-plugin": "^5.21.0", | ||
@@ -44,3 +45,3 @@ "@typescript-eslint/parser": "^5.21.0", | ||
"docsify-cli": "^4.4.3", | ||
"fastify": "^3.28.0", | ||
"fastify": "^4.0.0", | ||
"pre-commit": "^1.2.2", | ||
@@ -59,5 +60,4 @@ "proxyquire": "^2.1.3", | ||
"@fastify/error": "^3.0.0", | ||
"@fastify/static": "^5.0.0", | ||
"@fastify/websocket": "^5.0.0", | ||
"@types/isomorphic-form-data": "^2.0.0", | ||
"@fastify/static": "^6.0.0", | ||
"@fastify/websocket": "^6.0.0", | ||
"events.on": "^1.0.1", | ||
@@ -81,4 +81,4 @@ "fastify-plugin": "^3.0.1", | ||
"engines": { | ||
"node": ">=12.9.0" | ||
"node": ">=14.19.3" | ||
} | ||
} |
@@ -216,3 +216,3 @@ 'use strict' | ||
app.listen(0, err => { | ||
app.listen({ port: 0 }, err => { | ||
t.error(err) | ||
@@ -219,0 +219,0 @@ |
@@ -812,3 +812,3 @@ 'use strict' | ||
app.listen(0, err => { | ||
app.listen({ port: 0 }, err => { | ||
t.error(err) | ||
@@ -815,0 +815,0 @@ |
@@ -15,3 +15,3 @@ 'use strict' | ||
}) | ||
await service.listen(0) | ||
await service.listen({ port: 0 }) | ||
return [service, service.server.address().port] | ||
@@ -18,0 +18,0 @@ } |
@@ -14,3 +14,3 @@ 'use strict' | ||
}) | ||
await service.listen(0) | ||
await service.listen({ port: 0 }) | ||
return [service, service.server.address().port] | ||
@@ -17,0 +17,0 @@ } |
@@ -62,3 +62,3 @@ 'use strict' | ||
await userService.listen(0) | ||
await userService.listen({ port: 0 }) | ||
@@ -153,3 +153,3 @@ const userServicePort = userService.server.address().port | ||
await userService.listen(0) | ||
await userService.listen({ port: 0 }) | ||
@@ -156,0 +156,0 @@ const userServicePort = userService.server.address().port |
@@ -15,3 +15,3 @@ 'use strict' | ||
}) | ||
await service.listen(0) | ||
await service.listen({ port: 0 }) | ||
return [service, service.server.address().port] | ||
@@ -18,0 +18,0 @@ } |
@@ -155,4 +155,4 @@ 'use strict' | ||
notificationService.ready(), | ||
userService.listen(0), | ||
notificationService.listen(0) | ||
userService.listen({ port: 0 }), | ||
notificationService.listen({ port: 0 }) | ||
]).then(() => { | ||
@@ -197,3 +197,3 @@ gateway.register(GQL, { | ||
gateway.listen(0, err => { | ||
gateway.listen({ port: 0 }, err => { | ||
t.error(err) | ||
@@ -200,0 +200,0 @@ async function addUser () { |
@@ -16,3 +16,3 @@ 'use strict' | ||
}) | ||
await service.listen(0) | ||
await service.listen({ port: 0 }) | ||
return [service, service.server.address().port] | ||
@@ -19,0 +19,0 @@ } |
@@ -15,3 +15,3 @@ 'use strict' | ||
}) | ||
await service.listen(0) | ||
await service.listen({ port: 0 }) | ||
return [service, service.server.address().port] | ||
@@ -18,0 +18,0 @@ } |
@@ -16,3 +16,3 @@ 'use strict' | ||
}) | ||
await service.listen(0) | ||
await service.listen({ port: 0 }) | ||
return [service, service.server.address().port] | ||
@@ -19,0 +19,0 @@ } |
@@ -14,3 +14,3 @@ 'use strict' | ||
}) | ||
await service.listen(0) | ||
await service.listen({ port: 0 }) | ||
@@ -411,3 +411,3 @@ return [service, service.server.address().port] | ||
await gateway.listen(0) | ||
await gateway.listen({ port: 0 }) | ||
@@ -414,0 +414,0 @@ const query = ` |
@@ -150,3 +150,3 @@ 'use strict' | ||
const serviceOne = await buildService() | ||
await serviceOne.listen(port1) | ||
await serviceOne.listen({ port: port1 }) | ||
t.teardown(() => { serviceOne.close() }) | ||
@@ -156,3 +156,3 @@ | ||
const serviceTwo = await buildServiceExternal() | ||
await serviceTwo.listen(port2) | ||
await serviceTwo.listen({ port: port2 }) | ||
t.teardown(() => { serviceTwo.close() }) | ||
@@ -159,0 +159,0 @@ |
@@ -19,3 +19,3 @@ 'use strict' | ||
}) | ||
await service.listen(0) | ||
await service.listen({ port: 0 }) | ||
return [service, service.server.address().port] | ||
@@ -22,0 +22,0 @@ } |
@@ -18,3 +18,3 @@ 'use strict' | ||
}) | ||
await service.listen(0) | ||
await service.listen({ port: 0 }) | ||
return [service, service.server.address().port] | ||
@@ -21,0 +21,0 @@ } |
@@ -15,3 +15,3 @@ 'use strict' | ||
}) | ||
await service.listen(0) | ||
await service.listen({ port: 0 }) | ||
return [service, service.server.address().port] | ||
@@ -18,0 +18,0 @@ } |
@@ -14,3 +14,3 @@ 'use strict' | ||
}) | ||
await service.listen(0) | ||
await service.listen({ port: 0 }) | ||
return [service, service.server.address().port] | ||
@@ -17,0 +17,0 @@ } |
@@ -16,3 +16,3 @@ 'use strict' | ||
}) | ||
await service.listen(0) | ||
await service.listen({ port: 0 }) | ||
return [service, service.server.address().port] | ||
@@ -19,0 +19,0 @@ } |
@@ -15,3 +15,3 @@ 'use strict' | ||
}) | ||
await service.listen(0) | ||
await service.listen({ port: 0 }) | ||
return [service, service.server.address().port] | ||
@@ -18,0 +18,0 @@ } |
@@ -14,3 +14,3 @@ 'use strict' | ||
}) | ||
await service.listen(0) | ||
await service.listen({ port: 0 }) | ||
@@ -17,0 +17,0 @@ return [service, service.server.address().port] |
@@ -60,3 +60,3 @@ 'use strict' | ||
await userService.listen(0) | ||
await userService.listen({ port: 0 }) | ||
@@ -150,3 +150,3 @@ const userServicePort = userService.server.address().port | ||
await userService.listen(0) | ||
await userService.listen({ port: 0 }) | ||
@@ -321,3 +321,3 @@ const userServicePort = userService.server.address().port | ||
await userService.listen(0) | ||
await userService.listen({ port: 0 }) | ||
@@ -338,3 +338,3 @@ const userServicePort = userService.server.address().port | ||
await gateway.listen(0) | ||
await gateway.listen({ port: 0 }) | ||
}) | ||
@@ -387,3 +387,3 @@ | ||
await userService.listen(0) | ||
await userService.listen({ port: 0 }) | ||
await clock.tickAsync() | ||
@@ -398,3 +398,3 @@ | ||
name: 'user', | ||
url: `http://localhost:${userServicePort}/graphql` | ||
url: `http://127.0.0.1:${userServicePort}/graphql` | ||
} | ||
@@ -545,3 +545,3 @@ ], | ||
await userService.listen(0) | ||
await userService.listen({ port: 0 }) | ||
@@ -673,3 +673,3 @@ const userServicePort = userService.server.address().port | ||
await userService.listen(0) | ||
await userService.listen({ port: 0 }) | ||
@@ -690,3 +690,3 @@ const userServicePort = userService.server.address().port | ||
await gateway.listen(0) | ||
await gateway.listen({ port: 0 }) | ||
@@ -842,3 +842,3 @@ const res = await gateway.inject({ | ||
await userService.listen(0) | ||
await userService.listen({ port: 0 }) | ||
@@ -927,3 +927,3 @@ const userServicePort = userService.server.address().port | ||
await restartedUserService.listen(userServicePort) | ||
await restartedUserService.listen({ port: userServicePort }) | ||
@@ -1067,3 +1067,3 @@ await clock.tickAsync(10000) | ||
await userService.listen(0) | ||
await userService.listen({ port: 0 }) | ||
@@ -1086,3 +1086,3 @@ const userServicePort = userService.server.address().port | ||
await gateway.listen(0) | ||
await gateway.listen({ port: 0 }) | ||
@@ -1089,0 +1089,0 @@ const ws = new WebSocket( |
@@ -25,3 +25,3 @@ 'use strict' | ||
await service.listen(0) | ||
await service.listen({ port: 0 }) | ||
@@ -63,4 +63,6 @@ return [service, service.server.address().port] | ||
t.teardown(async () => { | ||
await gateway.close() | ||
await service.close() | ||
await Promise.all([ | ||
gateway.close(), | ||
service.close() | ||
]) | ||
}) | ||
@@ -73,3 +75,5 @@ | ||
url: `http://localhost:${servicePort}/graphql`, | ||
mandatory: true | ||
mandatory: true, | ||
keepAliveTimeout: 10, // milliseconds | ||
keepAliveMaxTimeout: 10 // milliseconds | ||
}] | ||
@@ -101,5 +105,7 @@ } | ||
t.teardown(async () => { | ||
await gateway.close() | ||
await service.close() | ||
await invalidService.close() | ||
await Promise.all([ | ||
gateway.close(), | ||
service.close(), | ||
invalidService.close() | ||
]) | ||
}) | ||
@@ -106,0 +112,0 @@ |
@@ -31,3 +31,3 @@ const { test } = require('tap') | ||
await app.listen(0) | ||
await app.listen({ port: 0 }) | ||
@@ -70,3 +70,3 @@ const url = new URL(`http://localhost:${app.server.address().port}`) | ||
await app.listen(0) | ||
await app.listen({ port: 0 }) | ||
@@ -109,3 +109,3 @@ const url = new URL(`http://localhost:${app.server.address().port}`) | ||
await app.listen(0) | ||
await app.listen({ port: 0 }) | ||
@@ -152,3 +152,3 @@ const url = new URL(`http://localhost:${app.server.address().port}`) | ||
await app.listen(0) | ||
await app.listen({ port: 0 }) | ||
@@ -155,0 +155,0 @@ const url = new URL(`http://localhost:${app.server.address().port}`) |
@@ -14,3 +14,3 @@ 'use strict' | ||
}) | ||
await service.listen(0) | ||
await service.listen({ port: 0 }) | ||
@@ -39,3 +39,3 @@ return service | ||
await gateway.listen(0) | ||
await gateway.listen({ port: 0 }) | ||
return { gateway, teardown } | ||
@@ -42,0 +42,0 @@ } |
@@ -16,3 +16,3 @@ 'use strict' | ||
}) | ||
await service.listen(port) | ||
await service.listen({ port }) | ||
return service | ||
@@ -19,0 +19,0 @@ } |
@@ -15,3 +15,3 @@ 'use strict' | ||
await service.listen(0) | ||
await service.listen({ port: 0 }) | ||
return [service, service.server.address().port] | ||
@@ -18,0 +18,0 @@ } |
@@ -14,3 +14,3 @@ 'use strict' | ||
}) | ||
await service.listen(0) | ||
await service.listen({ port: 0 }) | ||
@@ -1280,3 +1280,3 @@ return [service, service.server.address().port] | ||
await service.listen(0) | ||
await service.listen({ port: 0 }) | ||
@@ -1328,3 +1328,3 @@ const gateway = Fastify() | ||
await service.listen(0) | ||
await service.listen({ port: 0 }) | ||
@@ -1331,0 +1331,0 @@ const gateway = Fastify() |
@@ -14,3 +14,3 @@ 'use strict' | ||
}) | ||
await service.listen(0) | ||
await service.listen({ port: 0 }) | ||
return [service, service.server.address().port] | ||
@@ -17,0 +17,0 @@ } |
@@ -150,3 +150,3 @@ 'use strict' | ||
}) | ||
await service.listen(0) | ||
await service.listen({ port: 0 }) | ||
return [service, service.server.address().port] | ||
@@ -238,3 +238,3 @@ } | ||
await gateway.listen(0) | ||
await gateway.listen({ port: 0 }) | ||
@@ -331,3 +331,3 @@ const { client } = createWebSocketClient(t, gateway) | ||
await gateway.listen(0) | ||
await gateway.listen({ port: 0 }) | ||
@@ -388,3 +388,3 @@ const { client } = createWebSocketClient(t, gateway) | ||
await gateway.listen(0) | ||
await gateway.listen({ port: 0 }) | ||
@@ -440,3 +440,3 @@ const { client } = createWebSocketClient(t, gateway) | ||
await gateway.listen(0) | ||
await gateway.listen({ port: 0 }) | ||
@@ -489,3 +489,3 @@ const { client } = createWebSocketClient(t, gateway) | ||
await gateway.listen(0) | ||
await gateway.listen({ port: 0 }) | ||
@@ -570,3 +570,3 @@ const { client } = createWebSocketClient(t, gateway) | ||
await gateway.listen(0) | ||
await gateway.listen({ port: 0 }) | ||
@@ -626,3 +626,3 @@ const { client, ws } = createWebSocketClient(t, gateway) | ||
await gateway.listen(0) | ||
await gateway.listen({ port: 0 }) | ||
@@ -671,3 +671,3 @@ const { client } = createWebSocketClient(t, gateway) | ||
await gateway.listen(0) | ||
await gateway.listen({ port: 0 }) | ||
@@ -674,0 +674,0 @@ const { client, ws } = createWebSocketClient(t, gateway) |
@@ -135,3 +135,3 @@ 'use strict' | ||
}) | ||
userService.listen(0, callback) | ||
userService.listen({ port: 0 }, callback) | ||
} | ||
@@ -147,3 +147,3 @@ | ||
}) | ||
messageService.listen(0, callback) | ||
messageService.listen({ port: 0 }, callback) | ||
} | ||
@@ -172,3 +172,3 @@ | ||
gateway.listen(0, callback) | ||
gateway.listen({ port: 0 }, callback) | ||
} | ||
@@ -309,3 +309,3 @@ | ||
testService.listen(0, async err => { | ||
testService.listen({ port: 0 }, async err => { | ||
t.error(err) | ||
@@ -357,3 +357,3 @@ const testServicePort = testService.server.address().port | ||
testService.listen(0, async err => { | ||
testService.listen({ port: 0 }, async err => { | ||
t.error(err) | ||
@@ -432,3 +432,3 @@ const testServicePort = testService.server.address().port | ||
testService.listen(0, async err => { | ||
testService.listen({ port: 0 }, async err => { | ||
t.error(err) | ||
@@ -454,3 +454,3 @@ | ||
gateway.listen(0, async err => { | ||
gateway.listen({ port: 0 }, async err => { | ||
t.error(err) | ||
@@ -551,3 +551,3 @@ const ws = new WebSocket(`ws://localhost:${(gateway.server.address()).port}/graphql`, 'graphql-ws') | ||
testService.listen(0, async err => { | ||
testService.listen({ port: 0 }, async err => { | ||
t.error(err) | ||
@@ -578,3 +578,3 @@ | ||
gateway.listen(0, async err => { | ||
gateway.listen({ port: 0 }, async err => { | ||
t.error(err) | ||
@@ -664,3 +664,3 @@ const ws = new WebSocket(`ws://localhost:${(gateway.server.address()).port}/graphql`, 'graphql-ws') | ||
return testService.listen(0) | ||
return testService.listen({ port: 0 }) | ||
} | ||
@@ -683,3 +683,3 @@ | ||
return gateway.listen(0) | ||
return gateway.listen({ port: 0 }) | ||
} | ||
@@ -833,3 +833,3 @@ | ||
return testService.listen(0) | ||
return testService.listen({ port: 0 }) | ||
} | ||
@@ -852,3 +852,3 @@ | ||
return gateway.listen(0) | ||
return gateway.listen({ port: 0 }) | ||
} | ||
@@ -1005,3 +1005,3 @@ | ||
return resolverService.listen(0) | ||
return resolverService.listen({ port: 0 }) | ||
} | ||
@@ -1064,3 +1064,3 @@ | ||
return subscriptionService.listen(0) | ||
return subscriptionService.listen({ port: 0 }) | ||
} | ||
@@ -1093,3 +1093,3 @@ | ||
return gateway.listen(0) | ||
return gateway.listen({ port: 0 }) | ||
} | ||
@@ -1096,0 +1096,0 @@ |
@@ -133,3 +133,3 @@ 'use strict' | ||
const serviceOne = await buildService() | ||
await serviceOne.listen(port1) | ||
await serviceOne.listen({ port: port1 }) | ||
t.teardown(() => { serviceOne.close() }) | ||
@@ -139,3 +139,3 @@ | ||
const serviceTwo = await buildServiceExternal() | ||
await serviceTwo.listen(port2) | ||
await serviceTwo.listen({ port: port2 }) | ||
t.teardown(() => { serviceTwo.close() }) | ||
@@ -142,0 +142,0 @@ |
@@ -18,3 +18,3 @@ 'use strict' | ||
}) | ||
await service.listen(0) | ||
await service.listen({ port: 0 }) | ||
return [service, service.server.address().port] | ||
@@ -21,0 +21,0 @@ } |
@@ -15,3 +15,3 @@ 'use strict' | ||
}) | ||
await service.listen(0) | ||
await service.listen({ port: 0 }) | ||
return [service, service.server.address().port] | ||
@@ -18,0 +18,0 @@ } |
@@ -14,3 +14,3 @@ 'use strict' | ||
}) | ||
await service.listen(0) | ||
await service.listen({ port: 0 }) | ||
@@ -17,0 +17,0 @@ return [service, service.server.address().port] |
@@ -682,3 +682,3 @@ 'use strict' | ||
app.listen(0, err => { | ||
app.listen({ port: 0 }, err => { | ||
t.error(err) | ||
@@ -685,0 +685,0 @@ |
@@ -109,3 +109,4 @@ 'use strict' | ||
app.setErrorHandler(async function (err, request, reply) { | ||
t.pass('error handler called') | ||
reply.code(err.statusCode) | ||
t.equal(err.statusCode, 400) | ||
return { errors: err.errors } | ||
@@ -112,0 +113,0 @@ }) |
@@ -1250,3 +1250,3 @@ 'use strict' | ||
const expectedResult = { errors: [{ message: 'body should be object' }], data: null } | ||
const expectedResult = { errors: [{ message: 'body must be object' }], data: null } | ||
@@ -1460,3 +1460,3 @@ t.equal(res.statusCode, 400) | ||
app.listen(0, () => { | ||
app.listen({ port: 0 }, () => { | ||
const url = 'ws://localhost:' + (app.server.address()).port + '/graphql' | ||
@@ -1526,3 +1526,3 @@ const ws = new WebSocket(url, 'graphql-ws', { | ||
app.listen(0, () => { | ||
app.listen({ port: 0 }, () => { | ||
const url = 'ws://localhost:' + (app.server.address()).port + '/graphql' | ||
@@ -1594,3 +1594,3 @@ const ws = new WebSocket(url, 'graphql-ws') | ||
app.listen(0, () => { | ||
app.listen({ port: 0 }, () => { | ||
const url = 'ws://localhost:' + (app.server.address()).port + '/graphql' | ||
@@ -1649,3 +1649,3 @@ const ws = new WebSocket(url, 'graphql-ws') | ||
app.listen(0, () => { | ||
app.listen({ port: 0 }, () => { | ||
const url = 'ws://localhost:' + (app.server.address()).port + '/graphql' | ||
@@ -1699,3 +1699,3 @@ const ws = new WebSocket(url, 'graphql-ws') | ||
app.listen(0, () => { | ||
app.listen({ port: 0 }, () => { | ||
const url = 'ws://localhost:' + (app.server.address()).port + '/graphql' | ||
@@ -1751,3 +1751,3 @@ const ws = new WebSocket(url, 'graphql-ws') | ||
app.listen(0, () => { | ||
app.listen({ port: 0 }, () => { | ||
const url = 'ws://localhost:' + (app.server.address()).port + '/graphql' | ||
@@ -1802,3 +1802,3 @@ const ws = new WebSocket(url, 'graphql-ws') | ||
app.listen(0, () => { | ||
app.listen({ port: 0 }, () => { | ||
const url = 'ws://localhost:' + (app.server.address()).port + '/graphql' | ||
@@ -1805,0 +1805,0 @@ const ws = new WebSocket(url, 'graphql-ws') |
@@ -49,3 +49,3 @@ 'use strict' | ||
app.listen(0, () => { | ||
app.listen({ port: 0 }, () => { | ||
const url = 'ws://localhost:' + (app.server.address()).port + '/graphql' | ||
@@ -52,0 +52,0 @@ const ws = new WebSocket(url, 'graphql-transport-ws') |
@@ -135,3 +135,3 @@ 'use strict' | ||
await app.listen(0) | ||
await app.listen({ port: 0 }) | ||
@@ -197,3 +197,3 @@ const { client } = createWebSocketClient(t, app) | ||
await app.listen(0) | ||
await app.listen({ port: 0 }) | ||
@@ -248,3 +248,3 @@ const { client } = createWebSocketClient(t, app) | ||
await app.listen(0) | ||
await app.listen({ port: 0 }) | ||
@@ -297,3 +297,3 @@ const { client } = createWebSocketClient(t, app) | ||
await app.listen(0) | ||
await app.listen({ port: 0 }) | ||
@@ -337,3 +337,3 @@ const { client, ws } = createWebSocketClient(t, app) | ||
await app.listen(0) | ||
await app.listen({ port: 0 }) | ||
@@ -379,3 +379,3 @@ const { client } = createWebSocketClient(t, app) | ||
await app.listen(0) | ||
await app.listen({ port: 0 }) | ||
@@ -382,0 +382,0 @@ const { client, ws } = createWebSocketClient(t, app) |
@@ -0,1 +1,3 @@ | ||
'use strict' | ||
const { test } = require('tap') | ||
@@ -33,3 +35,3 @@ const Fastify = require('fastify') | ||
app.listen(0, err => { | ||
app.listen({ port: 0 }, err => { | ||
t.error(err) | ||
@@ -80,3 +82,3 @@ | ||
app.listen(0, err => { | ||
app.listen({ port: 0 }, err => { | ||
t.error(err) | ||
@@ -208,3 +210,3 @@ | ||
app.listen(0, err => { | ||
app.listen({ port: 0 }, err => { | ||
t.error(err) | ||
@@ -404,3 +406,3 @@ | ||
app.listen(0, err => { | ||
app.listen({ port: 0 }, err => { | ||
t.error(err) | ||
@@ -581,3 +583,3 @@ | ||
app.listen(0, err => { | ||
app.listen({ port: 0 }, err => { | ||
t.error(err) | ||
@@ -674,3 +676,3 @@ | ||
app.listen(0, () => { | ||
app.listen({ port: 0 }, () => { | ||
const url = 'ws://localhost:' + (app.server.address()).port + '/graphql' | ||
@@ -714,3 +716,3 @@ const ws = new WebSocket(url, 'foobar') | ||
app.listen(0, err => { | ||
app.listen({ port: 0 }, err => { | ||
t.error(err) | ||
@@ -851,3 +853,3 @@ | ||
app.listen(0, err => { | ||
app.listen({ port: 0 }, err => { | ||
t.error(err) | ||
@@ -960,3 +962,3 @@ | ||
app.listen(0, err => { | ||
app.listen({ port: 0 }, err => { | ||
t.error(err) | ||
@@ -1020,3 +1022,3 @@ | ||
app.listen(0, err => { | ||
app.listen({ port: 0 }, err => { | ||
t.error(err) | ||
@@ -1102,3 +1104,3 @@ | ||
app.listen(0, err => { | ||
app.listen({ port: 0 }, err => { | ||
t.error(err) | ||
@@ -1204,3 +1206,3 @@ | ||
app.listen(0, err => { | ||
app.listen({ port: 0 }, err => { | ||
t.error(err) | ||
@@ -1284,3 +1286,3 @@ | ||
app.listen(0, err => { | ||
app.listen({ port: 0 }, err => { | ||
t.error(err) | ||
@@ -1392,3 +1394,3 @@ | ||
}) | ||
app.listen(0, err => { | ||
app.listen({ port: 0 }, err => { | ||
t.error(err) | ||
@@ -1547,3 +1549,3 @@ | ||
}) | ||
app.listen(0, err => { | ||
app.listen({ port: 0 }, err => { | ||
t.error(err) | ||
@@ -1700,3 +1702,3 @@ | ||
}) | ||
app.listen(0, err => { | ||
app.listen({ port: 0 }, err => { | ||
t.error(err) | ||
@@ -1797,5 +1799,7 @@ | ||
app.get('/fastify-websocket', { websocket: true }, (connection, req) => { | ||
connection.socket.on('message', message => { | ||
connection.socket.send('hi from server') | ||
app.register(async function (app) { | ||
app.get('/fastify-websocket', { websocket: true }, (connection, req) => { | ||
connection.socket.on('message', message => { | ||
connection.socket.send('hi from server') | ||
}) | ||
}) | ||
@@ -1883,3 +1887,3 @@ }) | ||
app.listen(0, err => { | ||
app.listen({ port: 0 }, err => { | ||
t.error(err) | ||
@@ -2047,3 +2051,3 @@ | ||
app.listen(0, err => { | ||
app.listen({ port: 0 }, err => { | ||
t.error(err) | ||
@@ -2050,0 +2054,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
990074
17
35039
23
+ Added@fastify/accept-negotiator@1.1.0(transitive)
+ Added@fastify/send@2.1.0(transitive)
+ Added@fastify/static@6.12.0(transitive)
+ Added@fastify/websocket@6.0.1(transitive)
+ Added@lukeed/ms@2.0.2(transitive)
+ Addedbrace-expansion@2.0.1(transitive)
+ Addeddepd@2.0.0(transitive)
+ Addedfast-decode-uri-component@1.0.1(transitive)
+ Addedfastify-plugin@4.5.1(transitive)
+ Addedglob@8.1.0(transitive)
+ Addedhttp-errors@2.0.0(transitive)
+ Addedmime@3.0.0(transitive)
+ Addedminimatch@5.1.6(transitive)
+ Addedstatuses@2.0.1(transitive)
- Removed@types/isomorphic-form-data@^2.0.0
- Removed@fastify/static@5.0.2(transitive)
- Removed@fastify/websocket@5.0.1(transitive)
- Removed@types/isomorphic-form-data@2.0.4(transitive)
- Removed@types/node@22.10.2(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removeddebug@2.6.9(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removeddepd@1.1.2(transitive)
- Removeddestroy@1.0.4(transitive)
- Removedee-first@1.1.1(transitive)
- Removedencodeurl@1.0.2(transitive)
- Removedencoding-negotiator@2.0.1(transitive)
- Removedetag@1.8.1(transitive)
- Removedform-data@2.5.2(transitive)
- Removedfresh@0.5.2(transitive)
- Removedglob@7.2.3(transitive)
- Removedhttp-errors@1.8.1(transitive)
- Removedmime@1.6.0(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedms@2.0.02.1.3(transitive)
- Removedon-finished@2.3.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedrange-parser@1.2.1(transitive)
- Removedsend@0.17.2(transitive)
- Removedstatuses@1.5.0(transitive)
- Removedundici-types@6.20.0(transitive)
Updated@fastify/static@^6.0.0
Updated@fastify/websocket@^6.0.0