import schema from './lib/schema' ; import { graphql , GraphQLSchema } from 'graphql' ; import { makeExecutableSchema } from 'graphql-tools' ; import resolverMapBuilder from './lib/resolvers' ; import { spotifyWebAPIClient } from './lib/client' ; import { SpotifyClientConfiguration , SpotifyGraphQLInterface } from './lib/interfaces' ; export function getSchema ( spotifyClientConfiguration ) { return makeExecutableSchema ( { typeDefs : schema , resolvers : resolverMapBuilder ( spotifyWebAPIClient ( spotifyClientConfiguration ) ) , } ) ; } export function SpotifyGraphQLClient ( spotifyClientConfiguration ) { let executableSchema = getSchema ( spotifyClientConfiguration ) ; return { query ( requestString , rootValue ? , contextValue ? , variableValues ? , operationName ? ) { let graphqlArgs = [ executableSchema ] ; graphqlArgs = graphqlArgs . concat ( Array . from ( arguments ) ) ; return graphql . apply ( graphql , graphqlArgs ) ; } } ; } export * from './lib/decorators' ; export * from './lib/interfaces' ;