'use strict' ; import { ResolverMappings } from '@aerogear/voyager-tools' ; import { ApolloServer , Config } from 'apollo-server-express' ; import { buildSchemaDirectives } from './buildSchemaDirectives' ; import { DefaultVoyagerConfig } from './config/DefaultVoyagerConfig' ; import { VoyagerConfig } from './config/VoyagerConfig' ; import { ApolloVoyagerContextProvider } from './context/ApolloVoyagerContextProvider' ; param baseApolloConfig export function VoyagerServer ( baseApolloConfig , clientVoyagerConfig ) { const { context } = baseApolloConfig ; const voyagerConfig = new DefaultVoyagerConfig ( ) . merge ( clientVoyagerConfig ) ; const contextProviderConfig = { userContext : context , ... voyagerConfig } ; const contextProvider = new ApolloVoyagerContextProvider ( contextProviderConfig ) ; const schemaDirectives = buildSchemaDirectives ( baseApolloConfig , voyagerConfig ) ; const apolloConfig = { ... baseApolloConfig , context : contextProvider . getContext ( ) , schemaDirectives } ; const server = new ApolloServer ( apolloConfig ) ; return server ; }