Merge branch 'master' into bump-version-3-9-0

This commit is contained in:
Kim Gardner
2017-12-19 08:28:01 -06:00
committed by GitHub
2 changed files with 21 additions and 2 deletions
+9 -1
View File
@@ -1,3 +1,6 @@
const debug = require('debug')('talk:graph:connectors');
const merge = require('lodash/merge');
// Errors.
const errors = require('../errors');
@@ -76,4 +79,9 @@ const connectors = {
},
};
module.exports = connectors;
module.exports = Plugins.get('server', 'connectors').reduce((defaultConnectors, {plugin, connectors: pluginConnectors}) => {
debug(`adding plugin '${plugin.name}'`);
// Merge in the plugin connectors.
return merge(defaultConnectors, pluginConnectors);
}, connectors);
+12 -1
View File
@@ -1,4 +1,8 @@
const {makeExecutableSchema} = require('graphql-tools');
const {
makeExecutableSchema,
addSchemaLevelResolveFunction,
} = require('graphql-tools');
const debug = require('debug')('talk:graph:schema');
const {decorateWithHooks} = require('./hooks');
const {decorateWithErrorHandler} = require('./errorHandler');
@@ -14,4 +18,11 @@ decorateWithHooks(schema, plugins.get('server', 'hooks'));
// Handle errors like masking in production and mutation errors.
decorateWithErrorHandler(schema);
// For each schemaLevelResolveFunction, add it to the schema.
plugins.get('server', 'schemaLevelResolveFunction').forEach(({plugin, schemaLevelResolveFunction}) => {
debug(`added schemaLevelResolveFunction from plugin '${plugin.name}'`);
addSchemaLevelResolveFunction(schema, schemaLevelResolveFunction);
});
module.exports = schema;