@envelop/core
Advanced tools
Comparing version
11
index.js
@@ -1185,3 +1185,3 @@ 'use strict'; | ||
return { | ||
onParse: (opts === null || opts === void 0 ? void 0 : opts.onParse) === true | ||
onParse: (opts === null || opts === void 0 ? void 0 : opts.handleParseErrors) === true | ||
? function onParse() { | ||
@@ -1195,3 +1195,3 @@ return function onParseEnd({ result, replaceParseResult }) { | ||
: undefined, | ||
onValidate: (opts === null || opts === void 0 ? void 0 : opts.onValidate) === true | ||
onValidate: (opts === null || opts === void 0 ? void 0 : opts.handleValidationErrors) === true | ||
? function onValidate() { | ||
@@ -1230,8 +1230,11 @@ return function onValidateEnd({ valid, result, setResult }) { | ||
const OnNonIntrospectionFieldReachedValidationRule = (onNonIntrospectionField) => () => { | ||
const OnNonIntrospectionFieldReachedValidationRule = (onNonIntrospectionField) => ctx => { | ||
const rootQueryType = ctx.getSchema().getQueryType(); | ||
return { | ||
Field(field) { | ||
if (!field.name.value.startsWith('__')) { | ||
if (ctx.getParentType() === rootQueryType && !field.name.value.startsWith('__')) { | ||
onNonIntrospectionField(); | ||
return graphql.BREAK; | ||
} | ||
return undefined; | ||
}, | ||
@@ -1238,0 +1241,0 @@ }; |
{ | ||
"name": "@envelop/core", | ||
"version": "2.2.0-alpha-e0e4d8e.0", | ||
"version": "2.2.0", | ||
"sideEffects": false, | ||
@@ -9,3 +9,3 @@ "peerDependencies": { | ||
"dependencies": { | ||
"@envelop/types": "2.1.0-alpha-e0e4d8e.0" | ||
"@envelop/types": "2.1.0" | ||
}, | ||
@@ -12,0 +12,0 @@ "repository": { |
@@ -20,12 +20,21 @@ import { Plugin } from '@envelop/types'; | ||
/** | ||
* Whether parse errors should be masked. | ||
* Whether parse errors should be processed by this plugin. | ||
* In general it is not recommend to set this flag to `true` | ||
* as a `parse` error contains useful information for debugging a GraphQL operation. | ||
* A `parse` error never contains any sensitive information. | ||
* @default false | ||
*/ | ||
onParse?: boolean; | ||
handleParseErrors?: boolean; | ||
/** | ||
* Whether validation errors should be masked. | ||
* Whether validation errors should processed by this plugin. | ||
* In general we recommend against setting this flag to `true` | ||
* as a `validate` error contains useful information for debugging a GraphQL operation. | ||
* A `validate` error contains "did you mean x" suggestions that make it easier | ||
* to reverse-introspect a GraphQL schema whose introspection capabilities got disabled. | ||
* Instead of disabling introspection and masking validation errors, using persisted operations | ||
* is a safer solution for avoiding the execution of unwanted/arbitrary operations. | ||
* @default false | ||
*/ | ||
onValidate?: boolean; | ||
handleValidationErrors?: boolean; | ||
}; | ||
export declare const useMaskedErrors: (opts?: UseMaskedErrorsOpts | undefined) => Plugin; |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
109241
1.05%2722
0.55%1
-50%+ Added
- Removed
Updated