Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
} = this.options;
const app = httpAdapter.getInstance();
// @ts-ignore
const typeDefs = await this.graphqlTypesLoader.getTypesFromPaths(typePaths);
const mergedTypeDefs = extend(typeDefs, this.options.typeDefs);
const apolloOptions = await this.graphqlDistributedFactory.mergeOptions({
...this.options,
typeDefs: mergedTypeDefs,
});
if (this.options.definitions && this.options.definitions.path) {
await this.graphqlFactory.generateDefinitions(
// @ts-ignore
printSchema(apolloOptions.schema),
this.options,
);
}
this.apolloServer = new ApolloServer(apolloOptions as any);
this.apolloServer.applyMiddleware({
app,
path,
disableHealthCheck,
onHealthCheck,
cors,
bodyParserConfig,
});
if (this.options.installSubscriptionHandlers) {
// TL;DR
if (!typeWrap.isAbstract()) {
Object.values(type.getFields()).map(field => {
if (getDirective(field, 'unique')) {
type.astNode.directives.push(
this.generateKeyDirective(field.name)
);
}
});
if (!typeWrap.isInterface()) {
keyTypes.push(type);
}
}
}
});
const sdl = printSchema(schema);
const _Service = new GraphQLObjectType({
name: '_Service',
fields: {
sdl: {
name: 'sdl',
type: GraphQLString,
},
},
});
this.SchemaTypes._Service = _Service;
this.Query._fields._service = {
name: '_service',
args: [],
isDeprecated: false,
type: _Service,