@anvilco/apollo-server-plugin-introspection-metadata
Advanced tools
Comparing version 2.2.0 to 2.2.1
@@ -0,1 +1,5 @@ | ||
### 2.2.1 | ||
- `testFn` can be `async`, but `requestDidStart` cannot be. | ||
### 2.2.0 | ||
@@ -2,0 +6,0 @@ |
@@ -66,5 +66,6 @@ "use strict"; | ||
// Check at the beginning of the request whether we should do anything at all | ||
async requestDidStart(context) { | ||
requestDidStart(context) { | ||
const testResult = testFn(context); | ||
// If this request doesn't match what we're looking for (an Introspection Query), then do nothing. | ||
if (!(await testFn(context))) { | ||
if (!testResult) { | ||
return; | ||
@@ -74,3 +75,10 @@ } | ||
// Hook into the response event | ||
willSendResponse(context) { | ||
async willSendResponse(context) { | ||
// Is it a promise? Then we can finally await it here. Can't await it | ||
// in requestDidStart | ||
if (typeof testResult.then === 'function') { | ||
if (!(await testResult)) { | ||
return; | ||
} | ||
} | ||
const { | ||
@@ -77,0 +85,0 @@ response: introspectionQueryResponse |
{ | ||
"name": "@anvilco/apollo-server-plugin-introspection-metadata", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "A plugin for Apollo Server that allows for adding metadata to GraphQL Introspection Query responses.", | ||
@@ -53,4 +53,7 @@ "author": "Anvil Foundry Inc. <hello@useanvil.com>", | ||
"nodemon": "^2.0.20", | ||
"rimraf": "^5.0.0" | ||
"rewire": "^6.0.0", | ||
"rimraf": "^5.0.0", | ||
"sinon": "^15.1.0", | ||
"sinon-chai": "^3.7.0" | ||
} | ||
} |
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
21907
343
16