@envelop/extended-validation 1.3.0 → 1.3.2-alpha-63e92f8.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.
package/index.js CHANGED
@@ -21,8 +21,13 @@ const useExtendedValidation = (options) => {
21
21
  });
22
22
  },
23
23
  onExecute({ args, setResultAndStopExecution }) {
24
+ // We hook into onExecute even though this is a validation pattern. The reasoning behind
25
+ // it is that hooking right after validation and before execution has started is the
26
+ // same as hooking into the validation step. The benefit of this approach is that
27
+ // we may use execution context in the validation rules.
24
28
  const rules = args.contextValue[SYMBOL_EXTENDED_VALIDATION_RULES];
25
29
  const errors = [];
30
+ // We replicate the default validation step manually before execution starts.
26
31
  const typeInfo = schemaTypeInfo || new graphql.TypeInfo(args.schema);
27
32
  const validationContext = new graphql.ValidationContext(args.schema, args.document, typeInfo, e => {
28
33
  errors.push(e);
package/index.mjs CHANGED
@@ -17,8 +17,13 @@ const useExtendedValidation = (options) => {
17
17
  });
18
18
  },
19
19
  onExecute({ args, setResultAndStopExecution }) {
20
+ // We hook into onExecute even though this is a validation pattern. The reasoning behind
21
+ // it is that hooking right after validation and before execution has started is the
22
+ // same as hooking into the validation step. The benefit of this approach is that
23
+ // we may use execution context in the validation rules.
20
24
  const rules = args.contextValue[SYMBOL_EXTENDED_VALIDATION_RULES];
21
25
  const errors = [];
26
+ // We replicate the default validation step manually before execution starts.
22
27
  const typeInfo = schemaTypeInfo || new TypeInfo(args.schema);
23
28
  const validationContext = new ValidationContext(args.schema, args.document, typeInfo, e => {
24
29
  errors.push(e);
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@envelop/extended-validation",
3
- "version": "1.3.0",
3
+ "version": "1.3.2-alpha-63e92f8.0",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
6
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
7
7
  },
8
8
  "dependencies": {
9
- "@graphql-tools/utils": "8.5.2"
9
+ "@envelop/core": "1.6.6-alpha-63e92f8.0",
10
+ "@graphql-tools/utils": "^8.5.3"
10
11
  },
11
12
  "repository": {
12
13
  "type": "git",
@@ -29,6 +30,7 @@
29
30
  "./*": {
30
31
  "require": "./*.js",
31
32
  "import": "./*.mjs"
32
- }
33
+ },
34
+ "./package.json": "./package.json"
33
35
  }
34
36
  }
package/plugin.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Plugin } from '@envelop/types';
1
+ import { Plugin } from '@envelop/core';
2
2
  import { ExecutionArgs, ExecutionResult } from 'graphql';
3
3
  import { ExtendedValidationRule } from './common';
4
4
  export declare const useExtendedValidation: (options: {