1 | import Maybe from '../tsutils/Maybe';
|
2 | import { SchemaDefinitionNode, SchemaExtensionNode } from '../language/ast';
|
3 | import { GraphQLDirective } from './directives';
|
4 | import {
|
5 | GraphQLType,
|
6 | GraphQLNamedType,
|
7 | GraphQLAbstractType,
|
8 | GraphQLObjectType,
|
9 | } from './definition';
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | export function isSchema(schema: any): schema is GraphQLSchema;
|
15 | export function assertSchema(schema: any): GraphQLSchema;
|
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 | export class GraphQLSchema {
|
44 | extensions: Maybe<Readonly<Record<string, any>>>;
|
45 | astNode: Maybe<SchemaDefinitionNode>;
|
46 | extensionASTNodes: Maybe<ReadonlyArray<SchemaExtensionNode>>;
|
47 |
|
48 | constructor(config: GraphQLSchemaConfig);
|
49 |
|
50 | getQueryType(): Maybe<GraphQLObjectType>;
|
51 | getMutationType(): Maybe<GraphQLObjectType>;
|
52 | getSubscriptionType(): Maybe<GraphQLObjectType>;
|
53 | getTypeMap(): TypeMap;
|
54 | getType(name: string): Maybe<GraphQLNamedType>;
|
55 | getPossibleTypes(
|
56 | abstractType: GraphQLAbstractType,
|
57 | ): ReadonlyArray<GraphQLObjectType>;
|
58 |
|
59 | isPossibleType(
|
60 | abstractType: GraphQLAbstractType,
|
61 | possibleType: GraphQLObjectType,
|
62 | ): boolean;
|
63 |
|
64 | getDirectives(): ReadonlyArray<GraphQLDirective>;
|
65 | getDirective(name: string): Maybe<GraphQLDirective>;
|
66 |
|
67 | toConfig(): GraphQLSchemaConfig & {
|
68 | types: GraphQLNamedType[];
|
69 | directives: GraphQLDirective[];
|
70 | extensions: Maybe<Readonly<Record<string, any>>>;
|
71 | extensionASTNodes: ReadonlyArray<SchemaExtensionNode>;
|
72 | assumeValid: boolean;
|
73 | allowedLegacyNames: ReadonlyArray<string>;
|
74 | };
|
75 | }
|
76 |
|
77 | type TypeMap = { [key: string]: GraphQLNamedType };
|
78 |
|
79 | export interface GraphQLSchemaValidationOptions {
|
80 | |
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 | assumeValid?: boolean;
|
88 |
|
89 | |
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 |
|
96 | allowedLegacyNames?: Maybe<ReadonlyArray<string>>;
|
97 | }
|
98 |
|
99 | export interface GraphQLSchemaConfig extends GraphQLSchemaValidationOptions {
|
100 | query: Maybe<GraphQLObjectType>;
|
101 | mutation?: Maybe<GraphQLObjectType>;
|
102 | subscription?: Maybe<GraphQLObjectType>;
|
103 | types?: Maybe<GraphQLNamedType[]>;
|
104 | directives?: Maybe<GraphQLDirective[]>;
|
105 | extensions?: Maybe<Readonly<Record<string, any>>>;
|
106 | astNode?: Maybe<SchemaDefinitionNode>;
|
107 | extensionASTNodes?: Maybe<ReadonlyArray<SchemaExtensionNode>>;
|
108 | }
|