Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* @flow */
import { InterfaceTypeComposer, type SchemaComposer } from 'graphql-compose';
const NodeTC = InterfaceTypeComposer.createTemp({
name: 'Node',
description: 'An object, that can be fetched by the globally unique ID among all types.',
fields: {
id: {
type: 'ID!',
description: 'The globally unique ID among all types.',
},
},
resolveType: payload => {
// `payload.__nodeType` was added to payload via nodeFieldConfig.resolve
return payload.__nodeType ? payload.__nodeType : null;
},
});
export const NodeInterface = NodeTC.getType();
switch (type) {
case CreatedGraphQLType.Object: {
convertExtensionsToDirectives(options)
return ObjectTypeComposer.createTemp(options, schemaComposer)
}
case CreatedGraphQLType.Union:
return UnionTypeComposer.createTemp(options, schemaComposer)
case CreatedGraphQLType.Input:
return InputTypeComposer.createTemp(options, schemaComposer)
case CreatedGraphQLType.Scalar:
return ScalarTypeComposer.createTemp(options, schemaComposer)
case CreatedGraphQLType.Interface:
return InterfaceTypeComposer.createTemp(options, schemaComposer)
case CreatedGraphQLType.Enum:
return EnumTypeComposer.createTemp(options, schemaComposer)
}
}