1 | import { defaultFieldResolver } from 'graphql';
|
2 | export function chainResolvers(resolvers) {
|
3 | return (root, args, ctx, info) => resolvers.reduce((prev, curResolver) => {
|
4 | if (curResolver != null) {
|
5 | return curResolver(prev, args, ctx, info);
|
6 | }
|
7 | return defaultFieldResolver(prev, args, ctx, info);
|
8 | }, root);
|
9 | }
|