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
schemaComposer: SchemaComposer<TContext>;
Methods
get()
get(
name: string
): GraphQLNamedType | void
set()
set(
name: string,
type: GraphQLNamedType
): void
has()
has(
name: string
): boolean
getWrapped()
getWrapped(
str: TypeWrappedString | TypeNameString
): GraphQLType | null
createType()
createType(
str: TypeDefinitionString
): GraphQLNamedType | void
parseTypesFromString()
parseTypesFromString(
str: string
): TypeStorage<string, GraphQLNamedType>
parseTypesFromAst()
parseTypesFromAst(
astDocument: DocumentNode
): TypeStorage<string, GraphQLNamedType>
convertOutputType()
convertOutputType(
composeType: ComposeObjectType
): GraphQLObjectType
convertOutputFieldConfig()
convertOutputFieldConfig<TSource = any, TContext = any>(
composeFC: ComposeFieldConfig<TSource, TContext>,
fieldName: string,
typeName: string
): GraphQLFieldConfig<TSource, TContext>
convertOutputFieldConfigMap()
convertOutputFieldConfigMap<TSource = any, TContext = any>(
composeFields: ComposeFieldConfigMap<TSource, TContext> | GraphQLFieldConfigMap<TSource, TContext>,
typeName: string
): GraphQLFieldConfigMap<TSource, TContext>
convertArgConfig()
convertArgConfig(
composeAC: ComposeArgumentConfig,
argName: string,
fieldName: string,
typeName: string
): GraphQLArgumentConfig
convertArgConfigMap()
convertArgConfigMap(
composeArgsConfigMap: ComposeFieldConfigArgumentMap<any>,
fieldName: string,
typeName: string
): GraphQLFieldConfigArgumentMap
convertInputFieldConfig()
convertInputFieldConfig(
composeIFC: ComposeInputFieldConfig,
fieldName: string,
typeName: string
): GraphQLInputFieldConfig
convertInputFieldConfigMap()
convertInputFieldConfigMap(
composeFields: ComposeInputFieldConfigMap,
typeName: string
): GraphQLInputFieldConfigMap
Internal type definitions
TypeDefinitionString
/**
* Eg. `type Name { field: Int }`
*/
export type TypeDefinitionString = string;
TypeWrappedString
/**
* Eg. `Int`, `Int!`, `[Int]`
*/
export type TypeWrappedString = string;
TypeNameString
/**
* Eg. `Int`, `Float`
*/
export type TypeNameString = string;
TypeAsString
export type TypeAsString =
| TypeDefinitionString
| TypeWrappedString
| TypeNameString;
ComposeObjectType
export type ComposeObjectType =
| ObjectTypeComposer<any, any>
| GraphQLObjectType
| TypeDefinitionString
| TypeAsString;