TypeMapper
Type storage and type generator from Schema Definition Language
(SDL
). This is slightly rewritten buildASTSchema utility from graphql-js
that allows to create type from a string (SDL).
Properties
schemaComposer
Current SchemaComposer
instance which is used for getting types by name for type creation via SDL.
static schemaComposer: SchemaComposer;
Methods
get()
get(
name: string
): GraphQLNamedType | null;
set()
set(
name: string,
type: GraphQLNamedType
): void;
has()
has(
name: string
): boolean;
getWrapped()
getWrapped(
str:
| TypeWrappedString
| TypeNameString
): GraphQLType | null;
createType()
createType(
str: TypeDefinitionString
): GraphQLNamedType | null;
parseTypesFromString()
parseTypesFromString(
str: string
): TypeStorage<GraphQLNamedType>;
parseTypesFromAst()
parseTypesFromAst(
astDocument: DocumentNode
): TypeStorage<GraphQLNamedType>;
convertOutputFieldConfig()
convertOutputFieldConfig<TSource, TContext>(
composeFC: ComposeFieldConfig<TSource, TContext>,
fieldName?: string,
typeName?: string
): GraphQLFieldConfig<TSource, TContext>;
convertOutputFieldConfigMap()
convertOutputFieldConfigMap<TSource, TContext>(
composeFields:
| ComposeFieldConfigMap<TSource, TContext>
| GraphQLFieldConfigMap<TSource, TContext>,
typeName?: string
): GraphQLFieldConfigMap<TSource, TContext>;
convertArgConfig()
convertArgConfig(
omposeAC: ComposeArgumentConfig,
argName?: string,
fieldName?: string,
typeName?: string
): GraphQLArgumentConfig;
convertArgConfigMap()
convertArgConfigMap(
composeArgsConfigMap: ComposeFieldConfigArgumentMap,
fieldName?: string,
typeName?: string
): GraphQLFieldConfigArgumentMap;
convertInputFieldConfig()
convertInputFieldConfig(
composeIFC: ComposeInputFieldConfig,
fieldName?: string,
typeName?: string
): GraphQLInputFieldConfig;
convertInputFieldConfigMap()
convertInputFieldConfigMap(
composeFields: ComposeInputFieldConfigMap,
typeName?: string
): GraphQLInputFieldConfigMap;
Internal type definitions
Flowtype definitions which are used in this class.
TypeDefinitionString
type TypeDefinitionString = string; // eg type Name { field: Int }
TypeWrappedString
type TypeWrappedString = string; // eg. Int, Int!, [Int]
TypeNameString
type TypeNameString = string; // eg. Int, Float
TypeAsString
type TypeAsString = TypeDefinitionString | TypeWrappedString | TypeNameString;