Provides a GraphQL types for representing EF Carbon Conversation.
import { GraphQLObjectType, GraphQLSchema } from 'graphql';
import { Cache } from '@ef-carbon/conversation';
import Provider, {
formationsDom as formations,
formationsDomStart as start,
} from '@ef-carbon/conversation-provider-demo';
import { INodeImmutable, INodeMutable, nodeFactory } from '@ef-carbon/dom';
import { GraphQLFormation, GraphQLFormationConnectionConfig } from '@ef-carbon/graphql-type-conversation';
const cache = new Cache<INodeImmutable>({
provider: new Provider<INodeImmutable>({ formations })
});
const GraphQLFormationDom = new GraphQLFormation<INodeMutable, INodeImmutable>({
data: 'Dom',
factory: nodeFactory
});
const schema = new GraphQLSchema({
query: new GraphQLObjectType({
name: 'Query',
fields: {
formationsConnection: new GraphQLFormationConnectionConfig<Node>({
type: GraphQLFormationDom,
cache,
start,
}),
},
}),
});
Grab data from the connection with the @ef-carbon/conversation-provider-graphql
.