@envelop/extended-validation 1.7.1-alpha-ffbace6f.0 → 1.7.2
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/package.json +4 -4
- package/typings/common.d.cts +5 -0
- package/typings/index.d.cts +3 -0
- package/typings/plugin.d.cts +16 -0
- package/typings/rules/one-of.d.cts +3 -0
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envelop/extended-validation",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.2",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@envelop/core": "2.4.
|
|
6
|
+
"@envelop/core": "^2.4.2",
|
|
7
7
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"exports": {
|
|
27
27
|
".": {
|
|
28
28
|
"require": {
|
|
29
|
-
"types": "./typings/index.d.
|
|
29
|
+
"types": "./typings/index.d.cts",
|
|
30
30
|
"default": "./cjs/index.js"
|
|
31
31
|
},
|
|
32
32
|
"import": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"./*": {
|
|
42
42
|
"require": {
|
|
43
|
-
"types": "./typings/*.d.
|
|
43
|
+
"types": "./typings/*.d.cts",
|
|
44
44
|
"default": "./cjs/*.js"
|
|
45
45
|
},
|
|
46
46
|
"import": {
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ASTVisitor, DirectiveNode, ExecutionArgs, ValidationContext } from 'graphql';
|
|
2
|
+
export declare type ExtendedValidationRule = (context: ValidationContext, executionArgs: ExecutionArgs) => ASTVisitor;
|
|
3
|
+
export declare function getDirectiveFromAstNode(astNode: {
|
|
4
|
+
directives?: ReadonlyArray<DirectiveNode>;
|
|
5
|
+
}, names: string | string[]): null | DirectiveNode;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Plugin } from '@envelop/core';
|
|
2
|
+
import { ExecutionArgs, ExecutionResult } from 'graphql';
|
|
3
|
+
import { ExtendedValidationRule } from './common.cjs';
|
|
4
|
+
declare type OnValidationFailedCallback = (params: {
|
|
5
|
+
args: ExecutionArgs;
|
|
6
|
+
result: ExecutionResult;
|
|
7
|
+
setResult: (result: ExecutionResult) => void;
|
|
8
|
+
}) => void;
|
|
9
|
+
export declare const useExtendedValidation: (options: {
|
|
10
|
+
rules: Array<ExtendedValidationRule>;
|
|
11
|
+
/**
|
|
12
|
+
* Callback that is invoked if the extended validation yields any errors.
|
|
13
|
+
*/
|
|
14
|
+
onValidationFailed?: OnValidationFailedCallback;
|
|
15
|
+
}) => Plugin;
|
|
16
|
+
export {};
|