@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 CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@envelop/extended-validation",
3
- "version": "1.7.1-alpha-ffbace6f.0",
3
+ "version": "1.7.2",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
- "@envelop/core": "2.4.1-alpha-ffbace6f.0",
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.ts",
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.ts",
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,3 @@
1
+ export * from './plugin.cjs';
2
+ export * from './common.cjs';
3
+ export * from './rules/one-of.cjs';
@@ -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 {};
@@ -0,0 +1,3 @@
1
+ import { ExtendedValidationRule } from '../common.cjs';
2
+ export declare const ONE_OF_DIRECTIVE_SDL = "\n directive @oneOf on INPUT_OBJECT | FIELD_DEFINITION\n";
3
+ export declare const OneOfInputObjectsRule: ExtendedValidationRule;