@envelop/operation-field-permissions 3.3.3 → 3.3.4

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 +6 -1
  2. package/index.mjs +8 -3
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -37,7 +37,12 @@ const OperationScopeRule = (options) => (context, executionArgs) => {
37
37
  if (!permissionContext.allowAll &&
38
38
  !permissionContext.wildcardTypes.has(objectType.name) &&
39
39
  !permissionContext.schemaCoordinates.has(schemaCoordinate)) {
40
- context.reportError(new graphql.GraphQLError(options.formatError(schemaCoordinate), [node]));
40
+ // TODO: EnvelopError was a bad idea ;)
41
+ // We should use GraphQLError once the object constructor lands in stable GraphQL.js
42
+ // and useMaskedErrors supports it.
43
+ const error = new core.EnvelopError(options.formatError(schemaCoordinate));
44
+ error.nodes = [node];
45
+ context.reportError(error);
41
46
  }
42
47
  };
43
48
  return {
package/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { useExtendContext } from '@envelop/core';
1
+ import { useExtendContext, EnvelopError } from '@envelop/core';
2
2
  import { useExtendedValidation } from '@envelop/extended-validation';
3
- import { getNamedType, isIntrospectionType, isObjectType, isUnionType, isInterfaceType, GraphQLError } from 'graphql';
3
+ import { getNamedType, isIntrospectionType, isObjectType, isUnionType, isInterfaceType } from 'graphql';
4
4
 
5
5
  const OPERATION_PERMISSIONS_SYMBOL = Symbol('OPERATION_PERMISSIONS_SYMBOL');
6
6
  /**
@@ -33,7 +33,12 @@ const OperationScopeRule = (options) => (context, executionArgs) => {
33
33
  if (!permissionContext.allowAll &&
34
34
  !permissionContext.wildcardTypes.has(objectType.name) &&
35
35
  !permissionContext.schemaCoordinates.has(schemaCoordinate)) {
36
- context.reportError(new GraphQLError(options.formatError(schemaCoordinate), [node]));
36
+ // TODO: EnvelopError was a bad idea ;)
37
+ // We should use GraphQLError once the object constructor lands in stable GraphQL.js
38
+ // and useMaskedErrors supports it.
39
+ const error = new EnvelopError(options.formatError(schemaCoordinate));
40
+ error.nodes = [node];
41
+ context.reportError(error);
37
42
  }
38
43
  };
39
44
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@envelop/operation-field-permissions",
3
- "version": "3.3.3",
3
+ "version": "3.3.4",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
6
  "@envelop/core": "^2.3.3",