Resolvers Composition Transform

The resolversComposition transform allow you add middleware to your existing resolvers.

yarn add @graphql-mesh/transform-resolvers-composition

How to use?

Add the following configuration to your Mesh config file:

- resolversComposition:
- resolver: ''
composer: is-auth#isAuth
- resolver: 'Mutation.*'
composer: is-admin#isAdmin
export const isAuth = next => (root, args, context, info) => {
if(!context.currentUser) {
throw new Error('Unauthorized');
return next(root, args, context, info);

Config API Reference

  • resolver (type: String, required) - The GraphQL Resolver path Example: Query.users
  • composer (type: String, required) - Path to the composer function Example: ./src/auth.js#authComposer