Jean-Sébastien Herbaux 357fd163b0
V4/graphql customization (#10850)
* Add basic implementation for the graphql extension service

* Add createPolicyContext in @strapi/utils

* policiesMiddleware implementation for graphql

* wrapResolvers first implementation (authentication, middlewares, policies)

* move the content API schema build from /generators to /content-api. Extract types' register functions into a dedicated folder

* fix schema generation on bootstrap

* update the graphql service file to match new services arch

* fix single type queries

* simplify entity's resolver

* use apollo graphql conventions for resolver's args naming

* use the graphql extension system in i18n to add a locale arg to localized queries & mutations
2021-09-01 12:06:51 +02:00

53 lines
966 B
JavaScript

'use strict';
module.exports = ({ strapi }) => {
const registry = new Map();
return {
/**
* Create & add a new extension to the registry
* @param {string} name
* @return {this}
*/
add(name) {
const extension = strapi
.plugin('graphql')
.service('extension')
.createExtension({ strapi });
registry.set(name, extension);
return this;
},
/**
* Delete an extension by its name
* @param {string} name
* @return {this}
*/
remove(name) {
registry.delete(name);
return this;
},
/**
* Retrieve an extension by its name
* @param {string} name
* @return {object}
*/
get(name) {
return registry.get(name);
},
/**
* Check if a given name is available in the extension registry
* @param {string} name
* @return {boolean}
*/
has(name) {
return registry.has(name);
},
};
};