UNPKG

2.97 kBTypeScriptView Raw
1import { GraphQLEnumType, GraphQLInputObjectType, GraphQLNamedType, GraphQLScalarType, visit } from 'graphql';
2export interface SchemaPrintOptions {
3 /**
4 * Descriptions are defined as preceding string literals, however an older
5 * experimental version of the SDL supported preceding comments as
6 * descriptions. Set to true to enable this deprecated behavior.
7 * This option is provided to ease adoption and will be removed in v16.
8 *
9 * Default: false
10 */
11 commentDescriptions?: boolean;
12 assumeValid?: boolean;
13}
14export interface GetDocumentNodeFromSchemaOptions {
15 pathToDirectivesInExtensions?: Array<string>;
16}
17export declare type PrintSchemaWithDirectivesOptions = SchemaPrintOptions & GetDocumentNodeFromSchemaOptions;
18export declare type Maybe<T> = null | undefined | T;
19export declare type Constructor<T> = new (...args: any[]) => T;
20export declare type PruneSchemaFilter = (type: GraphQLNamedType) => boolean;
21/**
22 * Options for removing unused types from the schema
23 */
24export interface PruneSchemaOptions {
25 /**
26 * Return true to skip pruning this type. This check will run first before any other options.
27 * This can be helpful for schemas that support type extensions like Apollo Federation.
28 */
29 skipPruning?: PruneSchemaFilter;
30 /**
31 * Set to `true` to skip pruning object types or interfaces with no no fields
32 */
33 skipEmptyCompositeTypePruning?: boolean;
34 /**
35 * Set to `true` to skip pruning interfaces that are not implemented by any
36 * other types
37 */
38 skipUnimplementedInterfacesPruning?: boolean;
39 /**
40 * Set to `true` to skip pruning empty unions
41 */
42 skipEmptyUnionPruning?: boolean;
43 /**
44 * Set to `true` to skip pruning unused types
45 */
46 skipUnusedTypesPruning?: boolean;
47}
48export declare type InputLeafValueTransformer = (type: GraphQLEnumType | GraphQLScalarType, originalValue: any) => any;
49export declare type InputObjectValueTransformer = (type: GraphQLInputObjectType, originalValue: Record<string, any>) => Record<string, any>;
50export declare type ASTVisitorKeyMap = Partial<Parameters<typeof visit>[2]>;
51export declare type DirectiveLocationEnum = typeof DirectiveLocation;
52export declare enum DirectiveLocation {
53 /** Request Definitions */
54 QUERY = "QUERY",
55 MUTATION = "MUTATION",
56 SUBSCRIPTION = "SUBSCRIPTION",
57 FIELD = "FIELD",
58 FRAGMENT_DEFINITION = "FRAGMENT_DEFINITION",
59 FRAGMENT_SPREAD = "FRAGMENT_SPREAD",
60 INLINE_FRAGMENT = "INLINE_FRAGMENT",
61 VARIABLE_DEFINITION = "VARIABLE_DEFINITION",
62 /** Type System Definitions */
63 SCHEMA = "SCHEMA",
64 SCALAR = "SCALAR",
65 OBJECT = "OBJECT",
66 FIELD_DEFINITION = "FIELD_DEFINITION",
67 ARGUMENT_DEFINITION = "ARGUMENT_DEFINITION",
68 INTERFACE = "INTERFACE",
69 UNION = "UNION",
70 ENUM = "ENUM",
71 ENUM_VALUE = "ENUM_VALUE",
72 INPUT_OBJECT = "INPUT_OBJECT",
73 INPUT_FIELD_DEFINITION = "INPUT_FIELD_DEFINITION"
74}