Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
schema: GQLSchema,
tokenState: TokenState,
): Info {
const info: Info = {
type: null,
parentType: null,
inputType: null,
directiveDef: null,
fieldDef: null,
argDef: null,
argDefs: null,
objectFieldDefs: null,
objectFieldDef: null,
};
forEachState(tokenState, (state) => { // eslint-disable-line complexity
switch (state.kind) {
case 'Query':
case 'ShortQuery':
info.type = schema.getQueryType();
break;
case 'Mutation':
info.type = schema.getMutationType();
break;
case 'Subscription':
info.type = schema.getSubscriptionType();
break;
case 'InlineFragment':
case 'FragmentDefinition':
if (state.type) {
info.type = schema.getType(state.type);
}
constructor(context: TypeInfoContext, tokenState: TokenState) {
forEachState(tokenState, state => {
switch (state.kind) {
case 'Query':
case 'ShortQuery':
this._type = context.getQueryType();
break;
case 'Mutation':
this._type = context.getMutationType();
break;
case 'Subscription':
this._type = context.getSubscriptionType();
break;
case 'InlineFragment':
case 'FragmentDefinition': {
const outputType: mixed = state.type
? context.getType(state.type)
: getNamedType(this.getType());