forked from graphql/graphql-js
/
directives.d.ts
70 lines (59 loc) · 2.06 KB
/
directives.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import Maybe from '../tsutils/Maybe';
import { GraphQLFieldConfigArgumentMap, GraphQLArgument } from './definition';
import { DirectiveDefinitionNode } from '../language/ast';
import { DirectiveLocationEnum } from '../language/directiveLocation';
/**
* Test if the given value is a GraphQL directive.
*/
export function isDirective(directive: any): directive is GraphQLDirective;
export function assertDirective(directive: any): GraphQLDirective;
/**
* Directives are used by the GraphQL runtime as a way of modifying execution
* behavior. Type system creators will usually not create these directly.
*/
export class GraphQLDirective {
name: string;
description: Maybe<string>;
locations: DirectiveLocationEnum[];
isRepeatable: boolean;
args: GraphQLArgument[];
extensions?: Maybe<Readonly<Record<string, any>>>;
astNode: Maybe<DirectiveDefinitionNode>;
constructor(config: GraphQLDirectiveConfig);
toString(): string;
toConfig(): GraphQLDirectiveConfig & {
args: GraphQLFieldConfigArgumentMap;
extensions?: Maybe<Readonly<Record<string, any>>>;
isRepeatable: boolean;
};
}
export interface GraphQLDirectiveConfig {
name: string;
description?: Maybe<string>;
locations: DirectiveLocationEnum[];
args?: Maybe<GraphQLFieldConfigArgumentMap>;
isRepeatable?: Maybe<boolean>;
extensions?: Maybe<Readonly<Record<string, any>>>;
astNode?: Maybe<DirectiveDefinitionNode>;
}
/**
* Used to conditionally include fields or fragments.
*/
export const GraphQLIncludeDirective: GraphQLDirective;
/**
* Used to conditionally skip (exclude) fields or fragments.
*/
export const GraphQLSkipDirective: GraphQLDirective;
/**
* Constant string used for default reason for a deprecation.
*/
export const DEFAULT_DEPRECATION_REASON: 'No longer supported';
/**
* Used to declare element of a GraphQL schema as deprecated.
*/
export const GraphQLDeprecatedDirective: GraphQLDirective;
/**
* The full list of specified directives.
*/
export const specifiedDirectives: ReadonlyArray<GraphQLDirective>;
export function isSpecifiedDirective(directive: any): boolean;