graphql-extensions
Advanced tools
Comparing version 0.1.0-beta.14 to 0.1.0-beta.15
@@ -17,2 +17,4 @@ import { GraphQLSchema, GraphQLError, GraphQLField, GraphQLFieldResolver, GraphQLResolveInfo, ExecutionArgs, DocumentNode } from 'graphql'; | ||
}; | ||
persistedQueryHit?: boolean; | ||
persistedQueryRegister?: boolean; | ||
}): EndHandler | void; | ||
@@ -28,7 +30,3 @@ parsingDidStart?(o: { | ||
graphqlResponse: GraphQLResponse; | ||
responseInit: ResponseInit; | ||
}): { | ||
graphqlResponse?: GraphQLResponse; | ||
responseInit?: ResponseInit; | ||
} | void; | ||
}): void; | ||
willResolveField?(source: any, args: { | ||
@@ -51,2 +49,4 @@ [argName: string]: any; | ||
}; | ||
persistedQueryHit?: boolean; | ||
persistedQueryRegister?: boolean; | ||
}): EndHandler; | ||
@@ -62,7 +62,3 @@ parsingDidStart(o: { | ||
graphqlResponse: GraphQLResponse; | ||
responseInit: ResponseInit; | ||
}): { | ||
graphqlResponse: GraphQLResponse; | ||
responseInit: ResponseInit; | ||
}; | ||
}): void; | ||
willResolveField(source: any, args: { | ||
@@ -69,0 +65,0 @@ [argName: string]: any; |
@@ -30,16 +30,7 @@ "use strict"; | ||
GraphQLExtensionStack.prototype.willSendResponse = function (o) { | ||
return this.extensions.reduce(function (prev, extension) { | ||
this.extensions.forEach(function (extension) { | ||
if (extension.willSendResponse) { | ||
var result = extension.willSendResponse(o); | ||
if (result) { | ||
if (result.graphqlResponse) { | ||
prev.graphqlResponse = result.graphqlResponse; | ||
} | ||
if (result.responseInit) { | ||
prev.responseInit = result.responseInit; | ||
} | ||
} | ||
extension.willSendResponse(o); | ||
} | ||
return prev; | ||
}, o); | ||
}); | ||
}; | ||
@@ -53,2 +44,3 @@ GraphQLExtensionStack.prototype.willResolveField = function (source, args, context, info) { | ||
.filter(function (x) { return x; }) | ||
// Reverse list so that handlers "nest", like in handleDidStart. | ||
.reverse(); | ||
@@ -55,0 +47,0 @@ return function (error, result) { |
{ | ||
"name": "graphql-extensions", | ||
"version": "0.1.0-beta.14", | ||
"version": "0.1.0-beta.15", | ||
"description": "Add extensions to GraphQL servers", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -38,2 +38,4 @@ import { | ||
variables?: { [key: string]: any }; | ||
persistedQueryHit?: boolean; | ||
persistedQueryRegister?: boolean; | ||
}): EndHandler | void; | ||
@@ -46,6 +48,3 @@ public parsingDidStart?(o: { queryString: string }): EndHandler | void; | ||
public willSendResponse?(o: { | ||
graphqlResponse: GraphQLResponse; | ||
responseInit: ResponseInit; | ||
}): { graphqlResponse?: GraphQLResponse; responseInit?: ResponseInit } | void; | ||
public willSendResponse?(o: { graphqlResponse: GraphQLResponse }): void; | ||
@@ -77,2 +76,4 @@ public willResolveField?( | ||
variables?: { [key: string]: any }; | ||
persistedQueryHit?: boolean; | ||
persistedQueryRegister?: boolean; | ||
}): EndHandler { | ||
@@ -102,21 +103,8 @@ return this.handleDidStart( | ||
public willSendResponse(o: { | ||
graphqlResponse: GraphQLResponse; | ||
responseInit: ResponseInit; | ||
}): { graphqlResponse: GraphQLResponse; responseInit: ResponseInit } { | ||
return this.extensions.reduce((prev, extension) => { | ||
public willSendResponse(o: { graphqlResponse: GraphQLResponse }): void { | ||
this.extensions.forEach(extension => { | ||
if (extension.willSendResponse) { | ||
const result = extension.willSendResponse(o); | ||
if (result) { | ||
if (result.graphqlResponse) { | ||
prev.graphqlResponse = result.graphqlResponse; | ||
} | ||
if (result.responseInit) { | ||
prev.responseInit = result.responseInit; | ||
} | ||
} | ||
extension.willSendResponse(o); | ||
} | ||
return prev; | ||
}, o); | ||
}); | ||
} | ||
@@ -123,0 +111,0 @@ |
Sorry, the diff of this file is not supported yet
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
28592
574