mirror of
https://github.com/strapi/strapi.git
synced 2025-10-17 11:08:14 +00:00
Merge branch 'master' into tech/middleware-load
This commit is contained in:
commit
0d480fe11d
@ -216,6 +216,7 @@ type Query {
|
||||
test(id: ID!): MypluginTest
|
||||
tests(sort: String, limit: Int, start: Int, where: JSON): [MypluginTest]
|
||||
me: UsersPermissionsMe
|
||||
userCustomRoute: String
|
||||
}
|
||||
|
||||
input RoleInput {
|
||||
|
@ -0,0 +1,15 @@
|
||||
module.exports = {
|
||||
query: `
|
||||
userCustomRoute: String
|
||||
`,
|
||||
resolver: {
|
||||
Query: {
|
||||
userCustomRoute: {
|
||||
resolver: {
|
||||
plugin: 'users-permissions',
|
||||
handler: 'UsersPermissions.customRoute',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
@ -23,8 +23,11 @@ module.exports = strapi => {
|
||||
strapi.config.hook.load.after.push('graphql');
|
||||
// Load core utils.
|
||||
|
||||
const configs = await loadConfigs({ appPath, installedPlugins });
|
||||
_.merge(strapi, configs);
|
||||
const { api, plugins, extensions } = await loadConfigs({
|
||||
appPath,
|
||||
installedPlugins,
|
||||
});
|
||||
_.merge(strapi, { api, plugins });
|
||||
|
||||
/*
|
||||
* Create a merge of all the GraphQL configuration.
|
||||
@ -37,11 +40,15 @@ module.exports = strapi => {
|
||||
_.get(strapi.plugins[key], 'config.schema.graphql', {})
|
||||
);
|
||||
|
||||
const extensionsSchemas = Object.keys(extensions || {}).map(key =>
|
||||
_.get(extensions[key], 'config.schema.graphql', {})
|
||||
);
|
||||
|
||||
// save the final schema in the plugin's config
|
||||
_.set(
|
||||
strapi,
|
||||
['plugins', 'graphql', 'config', '_schema', 'graphql'],
|
||||
mergeSchemas([...apisSchemas, ...pluginsSchemas])
|
||||
mergeSchemas([...apisSchemas, ...pluginsSchemas, ...extensionsSchemas])
|
||||
);
|
||||
},
|
||||
|
||||
|
@ -16,21 +16,26 @@ const loadPluginsGraphqlConfig = async installedPlugins => {
|
||||
);
|
||||
_.set(root, ['plugins', pluginName], result);
|
||||
}
|
||||
|
||||
return root;
|
||||
};
|
||||
|
||||
const loadLocalPluginsGraphqlConfig = async appPath =>
|
||||
loadUtils.loadFiles(appPath, 'plugins/**/config/*.graphql?(.js)');
|
||||
|
||||
const loadExtensions = async appPath =>
|
||||
loadUtils.loadFiles(appPath, 'extensions/**/config/*.graphql?(.js)');
|
||||
|
||||
/**
|
||||
* Loads the graphql config files
|
||||
*/
|
||||
module.exports = async ({ appPath, installedPlugins }) => {
|
||||
const [apis, plugins, localPlugins] = await Promise.all([
|
||||
const [apis, plugins, localPlugins, extensions] = await Promise.all([
|
||||
loadApisGraphqlConfig(appPath),
|
||||
loadPluginsGraphqlConfig(installedPlugins),
|
||||
loadLocalPluginsGraphqlConfig(appPath),
|
||||
loadExtensions(appPath),
|
||||
]);
|
||||
|
||||
return _.merge({}, apis, plugins, localPlugins);
|
||||
return _.merge({}, apis, plugins, extensions, localPlugins);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user