import { buildSchema } from 'graphql' ; function sleep ( ms ) { return new Promise ( ( resolve ) => { setTimeout ( resolve , ms ) ; } ) ; } export const schema = buildSchema ( `
type Query {
    hello: String
}
type Subscription {
    countDown: Int
}
` ) ; export const roots = { Query : { hello : ( ) => 'Hello World!' , } , subscription : { countDown : async function * fiveToOne ( ) { for ( const number of [ 5 , 4 , 3 , 2 , 1 ] ) { await sleep ( 1000 ) ; yield { countDown : number } ; } } , } , } ; export const rootValue = { hello : roots . Query . hello , countDown : roots . subscription . countDown , } ;