How to use the graphql-compose.InterfaceTypeComposer.createTemp function in graphql-compose

To help you get started, we’ve selected a few graphql-compose examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github graphql-compose / graphql-compose-relay / src / nodeInterface.js View on Github external
/* @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();
github gridsome / gridsome / gridsome / lib / graphql / createSchema.js View on Github external
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)
  }
}