1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-14 23:30:05 +02:00
copilot/spikes/metrics-service/graphql/src/schema.js

62 lines
1007 B
JavaScript
Raw Normal View History

2016-11-04 19:09:58 +02:00
const graphql = require('graphql');
const {
GraphQLID,
GraphQLSchema,
GraphQLObjectType,
GraphQLString
} = graphql;
const EventType = new GraphQLObjectType({
name: 'EventType',
fields: {
value: {
type: GraphQLString
},
when: {
type: GraphQLString
}
}
});
const EventSubscription = {
type: EventType,
args: {
container: {
type: GraphQLID
}
},
start: function() {
console.log('start', arguments);
},
stop: function() {
console.log('stop', arguments);
},
resolve: function() {
console.log('resolve', arguments);
}
};
const subscription = new GraphQLObjectType({
name: 'RootSubscriptionType',
fields: {
events: EventSubscription
}
});
module.exports = new GraphQLSchema({
query: new GraphQLObjectType({
name: 'Q',
fields: {
a: { type: GraphQLString },
}
}),
mutation: new GraphQLObjectType({
name: 'M',
fields: {
c: { type: GraphQLString },
}
}),
subscription
});