graphql-resolve
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -16,7 +16,3 @@ const { argv } = require('yargs'); | ||
'test', | ||
[ | ||
'transpile', | ||
], | ||
['transpile'], | ||
() => gulp.src([ | ||
@@ -23,0 +19,0 @@ 'src/**/test/**/*.unit.js', |
@@ -42,2 +42,3 @@ 'use strict'; | ||
}; | ||
var promisifyNext = exports.promisifyNext = function promisifyNext(next) { | ||
@@ -44,0 +45,0 @@ return function (parent, args, context, ast) { |
{ | ||
"name": "graphql-resolve", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Hook into each resolve method on a GraphQL schema", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -9,9 +9,9 @@ # graphql-resolve | ||
const intercept = next => (p, a, c, ast) => { | ||
return promisifyNext(next)(p, a, c, ast); | ||
const intercept = next => (parent, args, context, ast) => { | ||
return promisifyNext(next)(parent, args, context, ast); | ||
}; | ||
wrapResolve(schema, (field, type) => { | ||
graphqlResolve(schema, (field, type) => { | ||
field.resolve = intercept(field.resolve || defaultNext); | ||
}); | ||
``` |
// @flow | ||
import type { GraphQLSchema } from 'graphql'; | ||
import _ from 'lodash'; | ||
@@ -7,5 +9,5 @@ import Promise from 'bluebird'; | ||
type Parent = *; | ||
type Args = *; | ||
type Context = *; | ||
type Ast = *; | ||
type Args = Object; | ||
type Context = Object; | ||
type Ast = { fieldName:string }; | ||
@@ -38,3 +40,3 @@ export const defaultNext = ( | ||
export default function ( | ||
schema:*, | ||
schema:GraphQLSchema, | ||
cb:(field:*, type:GraphQLObjectType) => *, | ||
@@ -46,3 +48,3 @@ ) { | ||
.filter(type => type instanceof GraphQLObjectType) | ||
.forEach((type:GraphQLObjectType) => { | ||
.forEach((type:any) => { | ||
const fields = type.getFields(); | ||
@@ -49,0 +51,0 @@ Object.keys(fields).forEach((fieldName) => { |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
7074
13
138
1