/
directives.d.ts
97 lines (81 loc) · 2.79 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import type { Maybe } from '../jsutils/Maybe';
import type { DirectiveDefinitionNode } from '../language/ast';
import type { DirectiveLocationEnum } from '../language/directiveLocation';
import type {
GraphQLFieldConfigArgumentMap,
GraphQLArgument,
} from './definition';
/**
* Test if the given value is a GraphQL directive.
*/
export function isDirective(directive: unknown): directive is GraphQLDirective;
export function assertDirective(directive: unknown): GraphQLDirective;
/**
* Custom extensions
*
* @remarks
* Use a unique identifier name for your extension, for example the name of
* your library or project. Do not use a shortened identifier as this increases
* the risk of conflicts. We recommend you add at most one extension field,
* an object which can contain all the values you need.
*/
export interface GraphQLDirectiveExtensions {
[attributeName: string]: unknown;
}
/**
* 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: Array<DirectiveLocationEnum>;
isRepeatable: boolean;
args: Array<GraphQLArgument>;
extensions: Maybe<Readonly<GraphQLDirectiveExtensions>>;
astNode: Maybe<DirectiveDefinitionNode>;
constructor(config: Readonly<GraphQLDirectiveConfig>);
toConfig(): GraphQLDirectiveConfig & {
args: GraphQLFieldConfigArgumentMap;
isRepeatable: boolean;
extensions: Maybe<Readonly<GraphQLDirectiveExtensions>>;
};
toString(): string;
toJSON(): string;
inspect(): string;
get [Symbol.toStringTag](): string;
}
export interface GraphQLDirectiveConfig {
name: string;
description?: Maybe<string>;
locations: Array<DirectiveLocationEnum>;
args?: Maybe<GraphQLFieldConfigArgumentMap>;
isRepeatable?: Maybe<boolean>;
extensions?: Maybe<Readonly<GraphQLDirectiveExtensions>>;
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;
/**
* Used to provide a URL for specifying the behavior of custom scalar definitions.
*/
export const GraphQLSpecifiedByDirective: 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: GraphQLDirective): boolean;