mercurius-auth
Advanced tools
Comparing version 3.0.0 to 4.0.0
16
index.js
@@ -22,9 +22,11 @@ 'use strict' | ||
// Add hook to regenerate the resolvers when the schema is refreshed | ||
app.graphql.addHook('onGatewayReplaceSchema', async (instance, schema) => { | ||
const authSchema = auth.getPolicy(schema) | ||
auth.registerAuthHandlers(schema, authSchema) | ||
if (opts.filterSchema === true) { | ||
filterSchema.updatePolicy(app, authSchema, opts) | ||
} | ||
}) | ||
if (app.graphqlGateway) { | ||
app.graphqlGateway.addHook('onGatewayReplaceSchema', async (instance, schema) => { | ||
const authSchema = auth.getPolicy(schema) | ||
auth.registerAuthHandlers(schema, authSchema) | ||
if (opts.filterSchema === true) { | ||
filterSchema.updatePolicy(app, authSchema, opts) | ||
} | ||
}) | ||
} | ||
@@ -31,0 +33,0 @@ if (typeof opts.authContext !== 'undefined') { |
{ | ||
"name": "mercurius-auth", | ||
"version": "3.0.0", | ||
"version": "4.0.0", | ||
"description": "Mercurius Auth Plugin adds configurable Authentication and Authorization support to Mercurius.", | ||
@@ -33,2 +33,4 @@ "main": "index.js", | ||
"devDependencies": { | ||
"@mercuriusjs/federation": "^1.0.0", | ||
"@mercuriusjs/gateway": "^1.0.0", | ||
"@sinonjs/fake-timers": "^9.1.2", | ||
@@ -42,3 +44,3 @@ "@types/node": "^18.0.3", | ||
"fastify": "^4.2.0", | ||
"mercurius": "^10.1.0", | ||
"mercurius": "^12.0.0", | ||
"pre-commit": "^1.2.2", | ||
@@ -48,9 +50,9 @@ "snazzy": "^9.0.0", | ||
"tap": "^16.3.0", | ||
"tsd": "^0.22.0", | ||
"tsd": "^0.25.0", | ||
"typescript": "^4.7.4", | ||
"wait-on": "^6.0.1" | ||
"wait-on": "^7.0.1" | ||
}, | ||
"dependencies": { | ||
"@fastify/error": "^3.0.0", | ||
"fastify-plugin": "^3.0.0", | ||
"fastify-plugin": "^4.0.0", | ||
"graphql": "^16.2.0" | ||
@@ -57,0 +59,0 @@ }, |
@@ -5,3 +5,4 @@ 'use strict' | ||
const Fastify = require('fastify') | ||
const mercurius = require('mercurius') | ||
const { mercuriusFederationPlugin } = require('@mercuriusjs/federation') | ||
const mercuriusGateway = require('@mercuriusjs/gateway') | ||
const mercuriusAuth = require('..') | ||
@@ -11,6 +12,5 @@ | ||
const service = Fastify() | ||
service.register(mercurius, { | ||
service.register(mercuriusFederationPlugin, { | ||
schema, | ||
resolvers, | ||
federationMetadata: true | ||
resolvers | ||
}) | ||
@@ -187,3 +187,3 @@ service.register(mercuriusAuth, { | ||
}) | ||
gateway.register(mercurius, { | ||
gateway.register(mercuriusGateway, { | ||
gateway: { | ||
@@ -190,0 +190,0 @@ services: [ |
@@ -5,3 +5,4 @@ 'use strict' | ||
const Fastify = require('fastify') | ||
const mercurius = require('mercurius') | ||
const { mercuriusFederationPlugin } = require('@mercuriusjs/federation') | ||
const mercuriusGateway = require('@mercuriusjs/gateway') | ||
const mercuriusAuth = require('..') | ||
@@ -11,6 +12,5 @@ | ||
const service = Fastify() | ||
service.register(mercurius, { | ||
service.register(mercuriusFederationPlugin, { | ||
schema, | ||
resolvers, | ||
federationMetadata: true | ||
resolvers | ||
}) | ||
@@ -154,3 +154,3 @@ await service.listen({ port: 0 }) | ||
}) | ||
gateway.register(mercurius, { | ||
gateway.register(mercuriusGateway, { | ||
gateway: { | ||
@@ -381,3 +381,3 @@ services: [{ | ||
app.graphql.addHook('preGatewayExecution', async (schema, document, context, service) => { | ||
app.graphqlGateway.addHook('preGatewayExecution', async (schema, document, context, service) => { | ||
Object.assign(context, { | ||
@@ -384,0 +384,0 @@ other: { |
@@ -6,2 +6,3 @@ 'use strict' | ||
const mercurius = require('mercurius') | ||
const { mercuriusFederationPlugin } = require('@mercuriusjs/federation') | ||
const mercuriusAuth = require('..') | ||
@@ -1106,6 +1107,5 @@ | ||
app.register(mercurius, { | ||
app.register(mercuriusFederationPlugin, { | ||
schema, | ||
resolvers, | ||
federationMetadata: true | ||
resolvers | ||
}) | ||
@@ -1112,0 +1112,0 @@ app.register(mercuriusAuth, { |
@@ -5,3 +5,4 @@ 'use strict' | ||
const Fastify = require('fastify') | ||
const mercurius = require('mercurius') | ||
const { mercuriusFederationPlugin } = require('@mercuriusjs/federation') | ||
const mercuriusGateway = require('@mercuriusjs/gateway') | ||
const mercuriusAuth = require('..') | ||
@@ -11,6 +12,5 @@ | ||
const service = Fastify() | ||
service.register(mercurius, { | ||
service.register(mercuriusFederationPlugin, { | ||
schema, | ||
resolvers, | ||
federationMetadata: true | ||
resolvers | ||
}) | ||
@@ -129,3 +129,3 @@ | ||
}) | ||
gateway.register(mercurius, { | ||
gateway.register(mercuriusGateway, { | ||
gateway: { | ||
@@ -132,0 +132,0 @@ services: [ |
@@ -5,3 +5,4 @@ 'use strict' | ||
const Fastify = require('fastify') | ||
const mercurius = require('mercurius') | ||
const { mercuriusFederationPlugin } = require('@mercuriusjs/federation') | ||
const mercuriusGateway = require('@mercuriusjs/gateway') | ||
const mercuriusAuth = require('..') | ||
@@ -11,6 +12,5 @@ | ||
const service = Fastify() | ||
service.register(mercurius, { | ||
service.register(mercuriusFederationPlugin, { | ||
schema, | ||
resolvers, | ||
federationMetadata: true | ||
resolvers | ||
}) | ||
@@ -128,3 +128,3 @@ await service.listen({ port: 0 }) | ||
}) | ||
gateway.register(mercurius, { | ||
gateway.register(mercuriusGateway, { | ||
gateway: { | ||
@@ -131,0 +131,0 @@ services: [{ |
@@ -6,2 +6,3 @@ 'use strict' | ||
const mercurius = require('mercurius') | ||
const { mercuriusFederationPlugin } = require('@mercuriusjs/federation') | ||
const mercuriusAuth = require('..') | ||
@@ -886,6 +887,5 @@ | ||
app.register(mercurius, { | ||
app.register(mercuriusFederationPlugin, { | ||
schema, | ||
resolvers, | ||
federationMetadata: true | ||
resolvers | ||
}) | ||
@@ -892,0 +892,0 @@ app.register(mercuriusAuth, { |
@@ -7,3 +7,4 @@ 'use strict' | ||
const Fastify = require('fastify') | ||
const mercurius = require('mercurius') | ||
const { mercuriusFederationPlugin, buildFederationSchema } = require('@mercuriusjs/federation') | ||
const mercuriusGateway = require('@mercuriusjs/gateway') | ||
const mercuriusAuth = require('..') | ||
@@ -44,3 +45,3 @@ | ||
userService.register(mercurius, { | ||
userService.register(mercuriusFederationPlugin, { | ||
schema: ` | ||
@@ -58,4 +59,3 @@ directive @auth on OBJECT | FIELD_DEFINITION | ||
`, | ||
resolvers, | ||
federationMetadata: true | ||
resolvers | ||
}) | ||
@@ -67,3 +67,3 @@ | ||
await gateway.register(mercurius, { | ||
await gateway.register(mercuriusGateway, { | ||
gateway: { | ||
@@ -134,3 +134,3 @@ services: [ | ||
userService.graphql.replaceSchema( | ||
mercurius.buildFederationSchema(` | ||
buildFederationSchema(` | ||
directive @auth on OBJECT | FIELD_DEFINITION | ||
@@ -232,3 +232,3 @@ | ||
userService.register(mercurius, { | ||
userService.register(mercuriusFederationPlugin, { | ||
schema: ` | ||
@@ -246,4 +246,3 @@ directive @auth on OBJECT | FIELD_DEFINITION | ||
`, | ||
resolvers, | ||
federationMetadata: true | ||
resolvers | ||
}) | ||
@@ -255,3 +254,3 @@ | ||
await gateway.register(mercurius, { | ||
await gateway.register(mercuriusGateway, { | ||
gateway: { | ||
@@ -352,3 +351,3 @@ services: [ | ||
userService.graphql.replaceSchema( | ||
mercurius.buildFederationSchema(` | ||
buildFederationSchema(` | ||
directive @auth on OBJECT | FIELD_DEFINITION | ||
@@ -355,0 +354,0 @@ |
@@ -5,3 +5,4 @@ 'use strict' | ||
const Fastify = require('fastify') | ||
const mercurius = require('mercurius') | ||
const { mercuriusFederationPlugin } = require('@mercuriusjs/federation') | ||
const mercuriusGateway = require('@mercuriusjs/gateway') | ||
const mercuriusAuth = require('..') | ||
@@ -11,6 +12,5 @@ | ||
const service = Fastify() | ||
service.register(mercurius, { | ||
service.register(mercuriusFederationPlugin, { | ||
schema, | ||
resolvers, | ||
federationMetadata: true | ||
resolvers | ||
}) | ||
@@ -136,3 +136,3 @@ await service.listen({ port: 0 }) | ||
}) | ||
gateway.register(mercurius, { | ||
gateway.register(mercuriusGateway, { | ||
gateway: { | ||
@@ -139,0 +139,0 @@ services: [{ |
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
279325
8815
18
+ Addedfastify-plugin@4.5.1(transitive)
- Removedfastify-plugin@3.0.1(transitive)
Updatedfastify-plugin@^4.0.0