Skip to content

Commit d890603

Browse files
authored
Merge pull request #129 from jonnydgreen/prepare-fasify-v5
Prepare for fastify v5
2 parents 2e9bd58 + 49feadc commit d890603

File tree

5 files changed

+9
-37
lines changed

5 files changed

+9
-37
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jobs:
55
runs-on: ${{ matrix.os }}
66
strategy:
77
matrix:
8-
node-version: [18.x, 20.x]
8+
node-version: [20.x, 22.x]
99
os: [ubuntu-latest, windows-latest, macOS-latest]
1010
steps:
1111
- uses: actions/checkout@v3

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const plugin = fp(
3939
},
4040
{
4141
name: 'mercurius-auth',
42-
fastify: '4.x',
42+
fastify: '5.x',
4343
dependencies: ['mercurius']
4444
}
4545
)

lib/filter-schema.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ function filterIntrospectionSchema (app, policy, { applyPolicy: policyFunction }
1111
app[kDirectiveGrouping] = []
1212

1313
// the filter hook must be the last one to be executed (after all the authContextHook ones)
14-
app.ready(err => {
15-
/* istanbul ignore next */
16-
if (err) throw err
14+
app.addHook('onReady', async function () {
1715
app.graphql.addHook('preExecution', filterGraphQLSchemaHook.bind(app))
1816
})
1917
}

package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@
3030
},
3131
"homepage": "https://github.com/mercurius-js/auth",
3232
"devDependencies": {
33-
"@mercuriusjs/federation": "^2.0.0",
34-
"@mercuriusjs/gateway": "^1.0.0",
33+
"@mercuriusjs/federation": "^4.0.0",
34+
"@mercuriusjs/gateway": "^4.0.0",
3535
"@sinonjs/fake-timers": "^10.0.2",
3636
"@types/node": "^20.1.0",
3737
"@types/ws": "^8.5.3",
3838
"@typescript-eslint/eslint-plugin": "^5.30.5",
3939
"@typescript-eslint/parser": "^5.30.5",
4040
"autocannon": "^7.9.0",
4141
"concurrently": "^8.0.1",
42-
"fastify": "^4.2.0",
43-
"mercurius": "^13.0.0",
42+
"fastify": "^5.0.0",
43+
"mercurius": "^15.0.0",
4444
"pre-commit": "^1.2.2",
4545
"snazzy": "^9.0.0",
4646
"standard": "^17.0.0",
@@ -50,8 +50,8 @@
5050
"wait-on": "^7.0.1"
5151
},
5252
"dependencies": {
53-
"@fastify/error": "^3.0.0",
54-
"fastify-plugin": "^4.0.0",
53+
"@fastify/error": "^4.0.0",
54+
"fastify-plugin": "^5.0.0",
5555
"graphql": "^16.2.0"
5656
},
5757
"tsd": {

test/auth_on_type-gateway.js

-26
Original file line numberDiff line numberDiff line change
@@ -345,32 +345,6 @@ test('gateway - should protect the schema, user object protected', async (t) =>
345345
'0'
346346
]
347347
},
348-
{
349-
message: 'Failed auth policy check on User',
350-
locations: [
351-
{
352-
line: 2,
353-
column: 3
354-
}
355-
],
356-
path: [
357-
'_entities',
358-
'1'
359-
]
360-
},
361-
{
362-
message: 'Failed auth policy check on User',
363-
locations: [
364-
{
365-
line: 2,
366-
column: 3
367-
}
368-
],
369-
path: [
370-
'_entities',
371-
'0'
372-
]
373-
},
374348
{
375349
message: 'Failed auth policy check on User',
376350
locations: [

0 commit comments

Comments
 (0)