@envelop/core 2.1.0 → 2.1.1-alpha-60d043b.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +5 -2
  2. package/index.mjs +5 -2
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -1199,12 +1199,15 @@ const useMaskedErrors = (opts) => {
1199
1199
  };
1200
1200
  };
1201
1201
 
1202
- const OnNonIntrospectionFieldReachedValidationRule = (onNonIntrospectionField) => () => {
1202
+ const OnNonIntrospectionFieldReachedValidationRule = (onNonIntrospectionField) => ctx => {
1203
+ const rootQueryType = ctx.getSchema().getQueryType();
1203
1204
  return {
1204
1205
  Field(field) {
1205
- if (!field.name.value.startsWith('__')) {
1206
+ if (ctx.getParentType() === rootQueryType && !field.name.value.startsWith('__')) {
1206
1207
  onNonIntrospectionField();
1208
+ return graphql.BREAK;
1207
1209
  }
1210
+ return undefined;
1208
1211
  },
1209
1212
  };
1210
1213
  };
package/index.mjs CHANGED
@@ -1195,12 +1195,15 @@ const useMaskedErrors = (opts) => {
1195
1195
  };
1196
1196
  };
1197
1197
 
1198
- const OnNonIntrospectionFieldReachedValidationRule = (onNonIntrospectionField) => () => {
1198
+ const OnNonIntrospectionFieldReachedValidationRule = (onNonIntrospectionField) => ctx => {
1199
+ const rootQueryType = ctx.getSchema().getQueryType();
1199
1200
  return {
1200
1201
  Field(field) {
1201
- if (!field.name.value.startsWith('__')) {
1202
+ if (ctx.getParentType() === rootQueryType && !field.name.value.startsWith('__')) {
1202
1203
  onNonIntrospectionField();
1204
+ return BREAK;
1203
1205
  }
1206
+ return undefined;
1204
1207
  },
1205
1208
  };
1206
1209
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@envelop/core",
3
- "version": "2.1.0",
3
+ "version": "2.1.1-alpha-60d043b.0",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
6
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"