Skip to content
🔌 Resolver composition library for GraphQL.
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs Split API docs. May 8, 2017
src Updated combineResolvers and pipeResolvers not to swallow throw errors. Mar 20, 2018
test Updated combineResolvers and pipeResolvers not to swallow throw errors. Mar 20, 2018
.babelrc
.eslintrc
.gitignore Added test coverage script. May 8, 2017
.npmignore Added git/npm ignores. Apr 9, 2017
.travis.yml
LICENSE Added LICENSE file. Apr 9, 2017
README.md
index.js
package.json
yarn.lock

README.md

GraphQL Resolvers

Resolver composition library for GraphQL

build status coverage npm version sponsored by Taller


This library consists of simple but well tested helper functions for combining other functions into more specialized ones.

Installation

This package is available on npm as: graphql-resolvers

npm install graphql-resolvers

You should consider using yarn, though.

Motivation

Many times we end-up repeating lots of logic on our resolvers. Access control, for instance, is something that can be done in the resolver level but just tends to end up with repeated code, even when creating services for such a task. This package aims to make it easier to build smart resolvers with logic being reusable and split in small pieces. Think recompose, but for GraphQL resolvers.

Documentation

Read full documentation here

Similar projects

Besides being inspired by some functional libraries out there, this project has some goals in common with other projects:

apollo-resolvers:

While graphql-resolvers follows the functional paradigm, apollo-resolvers project solves some problems using an opinionated and OOP approach. Furthermore, the second also solves other problems which graphql-resolvers does not intend to work on, such as solving circular references on the resolver's context.

graphql-tools

At first, my idea was to incorporate the combineResolvers method into the wider project graphql-tools. That may yet happen some day, but I think people my not want to install the whole graphql-tools project when wanting this simple package's helper on their projects. Also, combineResolvers should work pretty fine with resolvers binded into graphql/types too.

You can’t perform that action at this time.