@envelop/core 2.3.0 → 2.3.1
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.
- package/index.js +7 -1
- package/index.mjs +7 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1229,9 +1229,15 @@ const useMaskedErrors = (opts) => {
|
|
|
1229
1229
|
|
|
1230
1230
|
const OnNonIntrospectionFieldReachedValidationRule = (onNonIntrospectionField) => ctx => {
|
|
1231
1231
|
const rootQueryType = ctx.getSchema().getQueryType();
|
|
1232
|
+
const rootMutationType = ctx.getSchema().getMutationType();
|
|
1233
|
+
const rootSubscriptionType = ctx.getSchema().getSubscriptionType();
|
|
1232
1234
|
return {
|
|
1233
1235
|
Field(field) {
|
|
1234
|
-
|
|
1236
|
+
const parentType = ctx.getParentType();
|
|
1237
|
+
const isQuery = parentType === rootQueryType;
|
|
1238
|
+
const isMutation = parentType === rootMutationType;
|
|
1239
|
+
const isSubscription = parentType === rootSubscriptionType;
|
|
1240
|
+
if ((isQuery && !field.name.value.startsWith('__')) || isMutation || isSubscription) {
|
|
1235
1241
|
onNonIntrospectionField();
|
|
1236
1242
|
return graphql.BREAK;
|
|
1237
1243
|
}
|
package/index.mjs
CHANGED
|
@@ -1225,9 +1225,15 @@ const useMaskedErrors = (opts) => {
|
|
|
1225
1225
|
|
|
1226
1226
|
const OnNonIntrospectionFieldReachedValidationRule = (onNonIntrospectionField) => ctx => {
|
|
1227
1227
|
const rootQueryType = ctx.getSchema().getQueryType();
|
|
1228
|
+
const rootMutationType = ctx.getSchema().getMutationType();
|
|
1229
|
+
const rootSubscriptionType = ctx.getSchema().getSubscriptionType();
|
|
1228
1230
|
return {
|
|
1229
1231
|
Field(field) {
|
|
1230
|
-
|
|
1232
|
+
const parentType = ctx.getParentType();
|
|
1233
|
+
const isQuery = parentType === rootQueryType;
|
|
1234
|
+
const isMutation = parentType === rootMutationType;
|
|
1235
|
+
const isSubscription = parentType === rootSubscriptionType;
|
|
1236
|
+
if ((isQuery && !field.name.value.startsWith('__')) || isMutation || isSubscription) {
|
|
1231
1237
|
onNonIntrospectionField();
|
|
1232
1238
|
return BREAK;
|
|
1233
1239
|
}
|