Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const plugin: PluginFunction = async (schema: GraphQLSchema, _documents, pluginConfig: FragmentMatcherConfig, info): Promise => {
const config: Required = {
module: 'es2015',
federation: false,
...pluginConfig,
};
const cleanSchema = config.federation
? removeFederation(schema, {
withDirectives: false,
})
: schema;
const introspection = await execute({
schema: cleanSchema,
document: parse(`
{
__schema {
types {
kind
name
possibleTypes {
name
}
}
export const plugin: PluginFunction = async (schema: GraphQLSchema, _documents, { commentDescriptions = false, includeDirectives = false, federation }): Promise => {
const outputSchema = federation
? removeFederation(schema, {
withDirectives: includeDirectives,
})
: schema;
if (includeDirectives) {
return printSchemaWithDirectives(outputSchema);
}
return printSchema(outputSchema, { commentDescriptions: commentDescriptions });
};
export const plugin: PluginFunction = async (schema: GraphQLSchema, _documents, pluginConfig: IntrospectionPluginConfig): Promise => {
const cleanSchema = pluginConfig.federation
? removeFederation(schema, {
withDirectives: true,
})
: schema;
const introspection = introspectionFromSchema(cleanSchema, { descriptions: true });
return pluginConfig.minify ? JSON.stringify(introspection) : JSON.stringify(introspection, null, 2);
};