Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
useFactory: () => (schema: GraphQLSchema) => {
let externalSchema;
try {
const config = JSON.parse(
readFileSync(join(process.cwd(), 'gj.json'), {
encoding: 'utf-8'
})
);
config.$schema = config.$schema || nextOrDefault('--schema', false);
if (config.$schema) {
externalSchema = readFileSync(config.$schema, {
encoding: 'utf-8'
});
externalSchema = buildSchema(externalSchema);
}
} catch (e) {}
const schemas = [externalSchema, schema].filter(i => !!i);
let mergedSchemas: GraphQLSchema;
if (schemas.length === 1) {
mergedSchemas = schema;
} else {
mergedSchemas = mergeSchemas({
schemas
});
}
if (includes('--verbose')) {
console.log(`
Schema:
${printSchema(mergedSchemas)}
useFactory: () => (schema) => {
let externalSchema;
try {
const config = JSON.parse(fs_1.readFileSync(path_1.join(process.cwd(), 'gj.json'), {
encoding: 'utf-8'
}));
config.$schema = config.$schema || args_extractors_1.nextOrDefault('--schema', false);
if (config.$schema) {
externalSchema = fs_1.readFileSync(config.$schema, {
encoding: 'utf-8'
});
externalSchema = core_1.buildSchema(externalSchema);
}
}
catch (e) { }
const schemas = [externalSchema, schema].filter(i => !!i);
let mergedSchemas;
if (schemas.length === 1) {
mergedSchemas = schema;
}
else {
mergedSchemas = core_1.mergeSchemas({
schemas
});
}
if (args_extractors_1.includes('--verbose')) {
console.log(`
Schema: