UNPKG

3.12 kBTypeScriptView Raw
1import type { Maybe } from '../jsutils/Maybe';
2import type { DirectiveDefinitionNode } from '../language/ast';
3import { DirectiveLocation } from '../language/directiveLocation';
4import type {
5 GraphQLArgument,
6 GraphQLFieldConfigArgumentMap,
7} from './definition';
8/**
9 * Test if the given value is a GraphQL directive.
10 */
11export declare function isDirective(
12 directive: unknown,
13): directive is GraphQLDirective;
14export declare function assertDirective(directive: unknown): GraphQLDirective;
15/**
16 * Custom extensions
17 *
18 * @remarks
19 * Use a unique identifier name for your extension, for example the name of
20 * your library or project. Do not use a shortened identifier as this increases
21 * the risk of conflicts. We recommend you add at most one extension field,
22 * an object which can contain all the values you need.
23 */
24export interface GraphQLDirectiveExtensions {
25 [attributeName: string]: unknown;
26}
27/**
28 * Directives are used by the GraphQL runtime as a way of modifying execution
29 * behavior. Type system creators will usually not create these directly.
30 */
31export declare class GraphQLDirective {
32 name: string;
33 description: Maybe<string>;
34 locations: ReadonlyArray<DirectiveLocation>;
35 args: ReadonlyArray<GraphQLArgument>;
36 isRepeatable: boolean;
37 extensions: Readonly<GraphQLDirectiveExtensions>;
38 astNode: Maybe<DirectiveDefinitionNode>;
39 constructor(config: Readonly<GraphQLDirectiveConfig>);
40 get [Symbol.toStringTag](): string;
41 toConfig(): GraphQLDirectiveNormalizedConfig;
42 toString(): string;
43 toJSON(): string;
44}
45export interface GraphQLDirectiveConfig {
46 name: string;
47 description?: Maybe<string>;
48 locations: ReadonlyArray<DirectiveLocation>;
49 args?: Maybe<GraphQLFieldConfigArgumentMap>;
50 isRepeatable?: Maybe<boolean>;
51 extensions?: Maybe<Readonly<GraphQLDirectiveExtensions>>;
52 astNode?: Maybe<DirectiveDefinitionNode>;
53}
54interface GraphQLDirectiveNormalizedConfig extends GraphQLDirectiveConfig {
55 args: GraphQLFieldConfigArgumentMap;
56 isRepeatable: boolean;
57 extensions: Readonly<GraphQLDirectiveExtensions>;
58}
59/**
60 * Used to conditionally include fields or fragments.
61 */
62export declare const GraphQLIncludeDirective: GraphQLDirective;
63/**
64 * Used to conditionally skip (exclude) fields or fragments.
65 */
66export declare const GraphQLSkipDirective: GraphQLDirective;
67/**
68 * Constant string used for default reason for a deprecation.
69 */
70export declare const DEFAULT_DEPRECATION_REASON = 'No longer supported';
71/**
72 * Used to declare element of a GraphQL schema as deprecated.
73 */
74export declare const GraphQLDeprecatedDirective: GraphQLDirective;
75/**
76 * Used to provide a URL for specifying the behavior of custom scalar definitions.
77 */
78export declare const GraphQLSpecifiedByDirective: GraphQLDirective;
79/**
80 * Used to indicate an Input Object is a OneOf Input Object.
81 */
82export declare const GraphQLOneOfDirective: GraphQLDirective;
83/**
84 * The full list of specified directives.
85 */
86export declare const specifiedDirectives: ReadonlyArray<GraphQLDirective>;
87export declare function isSpecifiedDirective(
88 directive: GraphQLDirective,
89): boolean;
90export {};