@strapi/plugin-graphql 4.3.4 → 4.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/admin/src/index.js +1 -1
  2. package/package.json +4 -4
  3. package/server/bootstrap.js +18 -21
  4. package/server/format-graphql-error.js +5 -10
  5. package/server/services/builders/dynamic-zones.js +6 -6
  6. package/server/services/builders/entity-meta.js +1 -1
  7. package/server/services/builders/filters/content-type.js +44 -47
  8. package/server/services/builders/filters/index.js +1 -1
  9. package/server/services/builders/filters/operators/index.js +1 -1
  10. package/server/services/builders/index.js +1 -1
  11. package/server/services/builders/input.js +17 -17
  12. package/server/services/builders/mutations/collection-type.js +1 -1
  13. package/server/services/builders/mutations/index.js +1 -1
  14. package/server/services/builders/mutations/single-type.js +1 -1
  15. package/server/services/builders/queries/collection-type.js +2 -2
  16. package/server/services/builders/queries/index.js +1 -1
  17. package/server/services/builders/queries/single-type.js +2 -2
  18. package/server/services/builders/resolvers/association.js +4 -4
  19. package/server/services/builders/resolvers/dynamic-zone.js +1 -1
  20. package/server/services/builders/resolvers/index.js +1 -1
  21. package/server/services/builders/type.js +14 -15
  22. package/server/services/builders/utils.js +3 -3
  23. package/server/services/content-api/index.js +4 -4
  24. package/server/services/content-api/register-functions/collection-type.js +1 -1
  25. package/server/services/content-api/register-functions/content-type/dynamic-zones.js +1 -1
  26. package/server/services/content-api/register-functions/content-type/enums.js +1 -1
  27. package/server/services/content-api/register-functions/polymorphic.js +2 -2
  28. package/server/services/content-api/register-functions/single-type.js +1 -1
  29. package/server/services/content-api/wrap-resolvers.js +31 -27
  30. package/server/services/extension/extension.js +3 -4
  31. package/server/services/extension/shadow-crud-manager.js +5 -3
  32. package/server/services/format/index.js +1 -1
  33. package/server/services/internals/args/index.js +1 -1
  34. package/server/services/internals/helpers/get-enabled-scalars.js +12 -10
  35. package/server/services/internals/helpers/index.js +1 -1
  36. package/server/services/internals/index.js +1 -1
  37. package/server/services/internals/scalars/date.js +9 -7
  38. package/server/services/internals/scalars/time.js +1 -1
  39. package/server/services/internals/types/filters.js +1 -1
  40. package/server/services/internals/types/index.js +1 -1
  41. package/server/services/utils/attributes.js +5 -11
  42. package/server/services/utils/index.js +1 -1
  43. package/server/services/utils/mappers/entity-to-response-entity.js +1 -1
  44. package/server/services/utils/mappers/graphql-filters-to-strapi-query.js +3 -3
  45. package/server/services/utils/mappers/graphql-scalar-to-operators.js +1 -1
  46. package/server/services/utils/mappers/index.js +1 -1
  47. package/server/services/utils/naming.js +15 -15
@@ -14,7 +14,7 @@ export default {
14
14
  bootstrap() {},
15
15
  async registerTrads({ locales }) {
16
16
  const importedTrads = await Promise.all(
17
- locales.map(locale => {
17
+ locales.map((locale) => {
18
18
  return import(
19
19
  /* webpackChunkName: "graphql-translation-[request]" */ `./translations/${locale}.json`
20
20
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/plugin-graphql",
3
- "version": "4.3.4",
3
+ "version": "4.3.5",
4
4
  "description": "Adds GraphQL endpoint with default API methods.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -28,8 +28,8 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@graphql-tools/schema": "8.1.2",
31
- "@graphql-tools/utils": "^8.9.0",
32
- "@strapi/utils": "4.3.4",
31
+ "@graphql-tools/utils": "^8.10.0",
32
+ "@strapi/utils": "4.3.5",
33
33
  "apollo-server-core": "3.1.2",
34
34
  "apollo-server-koa": "3.10.0",
35
35
  "glob": "^7.1.7",
@@ -61,5 +61,5 @@
61
61
  "description": "Adds GraphQL endpoint with default API methods.",
62
62
  "kind": "plugin"
63
63
  },
64
- "gitHead": "28a2a00db8234ffcf644661c4c8092aa82f8c119"
64
+ "gitHead": "a52b0535513ff35b4ef46c9daf7be48f2ba71737"
65
65
  }
@@ -18,12 +18,26 @@ const merge = mergeWith((a, b) => {
18
18
  }
19
19
  });
20
20
 
21
+ /**
22
+ * Register the upload middleware powered by graphql-upload in Strapi
23
+ * @param {object} strapi
24
+ * @param {string} path
25
+ */
26
+ const useUploadMiddleware = (strapi, path) => {
27
+ const uploadMiddleware = graphqlUploadKoa();
28
+
29
+ strapi.server.app.use((ctx, next) => {
30
+ if (ctx.path === path) {
31
+ return uploadMiddleware(ctx, next);
32
+ }
33
+
34
+ return next();
35
+ });
36
+ };
37
+
21
38
  module.exports = async ({ strapi }) => {
22
39
  // Generate the GraphQL schema for the content API
23
- const schema = strapi
24
- .plugin('graphql')
25
- .service('content-api')
26
- .buildSchema();
40
+ const schema = strapi.plugin('graphql').service('content-api').buildSchema();
27
41
 
28
42
  if (isEmpty(schema)) {
29
43
  strapi.log.warn('The GraphQL schema has not been generated because it is empty');
@@ -138,20 +152,3 @@ module.exports = async ({ strapi }) => {
138
152
  await server.stop();
139
153
  };
140
154
  };
141
-
142
- /**
143
- * Register the upload middleware powered by graphql-upload in Strapi
144
- * @param {object} strapi
145
- * @param {string} path
146
- */
147
- const useUploadMiddleware = (strapi, path) => {
148
- const uploadMiddleware = graphqlUploadKoa();
149
-
150
- strapi.server.app.use((ctx, next) => {
151
- if (ctx.path === path) {
152
- return uploadMiddleware(ctx, next);
153
- }
154
-
155
- return next();
156
- });
157
- };
@@ -1,13 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  const { toUpper, snakeCase, pick, isEmpty } = require('lodash/fp');
4
- const {
5
- HttpError,
6
- ForbiddenError,
7
- UnauthorizedError,
8
- ApplicationError,
9
- ValidationError,
10
- } = require('@strapi/utils').errors;
4
+ const { HttpError, ForbiddenError, UnauthorizedError, ApplicationError, ValidationError } =
5
+ require('@strapi/utils').errors;
11
6
  const {
12
7
  ApolloError,
13
8
  UserInputError: ApolloUserInputError,
@@ -15,10 +10,10 @@ const {
15
10
  } = require('apollo-server-koa');
16
11
  const { GraphQLError } = require('graphql');
17
12
 
18
- const formatToCode = name => `STRAPI_${toUpper(snakeCase(name))}`;
19
- const formatErrorToExtension = error => ({ error: pick(['name', 'message', 'details'])(error) });
13
+ const formatToCode = (name) => `STRAPI_${toUpper(snakeCase(name))}`;
14
+ const formatErrorToExtension = (error) => ({ error: pick(['name', 'message', 'details'])(error) });
20
15
 
21
- const formatGraphqlError = error => {
16
+ const formatGraphqlError = (error) => {
22
17
  const { originalError } = error;
23
18
 
24
19
  if (isEmpty(originalError)) {
@@ -10,7 +10,7 @@ module.exports = ({ strapi }) => {
10
10
  const { ERROR_TYPE_NAME } = strapi.plugin('graphql').service('constants');
11
11
  const isEmpty = components.length === 0;
12
12
 
13
- const componentsTypeNames = components.map(componentUID => {
13
+ const componentsTypeNames = components.map((componentUID) => {
14
14
  const component = strapi.components[componentUID];
15
15
 
16
16
  if (!component) {
@@ -40,15 +40,15 @@ module.exports = ({ strapi }) => {
40
40
  };
41
41
 
42
42
  const buildInputDefinition = (name, components) => {
43
- const parseData = value => {
43
+ const parseData = (value) => {
44
44
  const component = Object.values(strapi.components).find(
45
- component => component.globalId === value.__typename
45
+ (component) => component.globalId === value.__typename
46
46
  );
47
47
 
48
48
  if (!component) {
49
49
  throw new ApplicationError(
50
50
  `Component not found. expected one of: ${components
51
- .map(uid => strapi.components[uid].globalId)
51
+ .map((uid) => strapi.components[uid].globalId)
52
52
  .join(', ')}`
53
53
  );
54
54
  }
@@ -62,9 +62,9 @@ module.exports = ({ strapi }) => {
62
62
  return scalarType({
63
63
  name,
64
64
 
65
- serialize: value => value,
65
+ serialize: (value) => value,
66
66
 
67
- parseValue: value => parseData(value),
67
+ parseValue: (value) => parseData(value),
68
68
 
69
69
  parseLiteral(ast, variables) {
70
70
  if (ast.kind !== Kind.OBJECT) {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- function buildEntityMetaDefinition(/*contentType*/) {}
3
+ function buildEntityMetaDefinition(/* contentType */) {}
4
4
 
5
5
  module.exports = () => ({
6
6
  buildEntityMetaDefinition,
@@ -9,7 +9,49 @@ module.exports = ({ strapi }) => {
9
9
  return [operators.and, operators.or, operators.not];
10
10
  };
11
11
 
12
- const buildContentTypeFilters = contentType => {
12
+ const addScalarAttribute = (builder, attributeName, attribute) => {
13
+ const { naming, mappers } = strapi.plugin('graphql').service('utils');
14
+
15
+ const gqlType = mappers.strapiScalarToGraphQLScalar(attribute.type);
16
+
17
+ builder.field(attributeName, { type: naming.getScalarFilterInputTypeName(gqlType) });
18
+ };
19
+
20
+ const addRelationalAttribute = (builder, attributeName, attribute) => {
21
+ const utils = strapi.plugin('graphql').service('utils');
22
+ const extension = strapi.plugin('graphql').service('extension');
23
+ const { getFiltersInputTypeName } = utils.naming;
24
+ const { isMorphRelation } = utils.attributes;
25
+
26
+ const model = strapi.getModel(attribute.target);
27
+
28
+ // If there is no model corresponding to the attribute configuration
29
+ // or if the attribute is a polymorphic relation, then ignore it
30
+ if (!model || isMorphRelation(attribute)) return;
31
+
32
+ // If the target model is disabled, then ignore it too
33
+ if (extension.shadowCRUD(model.uid).isDisabled()) return;
34
+
35
+ builder.field(attributeName, { type: getFiltersInputTypeName(model) });
36
+ };
37
+
38
+ const addComponentAttribute = (builder, attributeName, attribute) => {
39
+ const utils = strapi.plugin('graphql').service('utils');
40
+ const extension = strapi.plugin('graphql').service('extension');
41
+ const { getFiltersInputTypeName } = utils.naming;
42
+
43
+ const component = strapi.getModel(attribute.component);
44
+
45
+ // If there is no component corresponding to the attribute configuration, then ignore it
46
+ if (!component) return;
47
+
48
+ // If the component is disabled, then ignore it too
49
+ if (extension.shadowCRUD(component.uid).isDisabled()) return;
50
+
51
+ builder.field(attributeName, { type: getFiltersInputTypeName(component) });
52
+ };
53
+
54
+ const buildContentTypeFilters = (contentType) => {
13
55
  const utils = strapi.plugin('graphql').service('utils');
14
56
  const extension = strapi.plugin('graphql').service('extension');
15
57
 
@@ -25,10 +67,7 @@ module.exports = ({ strapi }) => {
25
67
 
26
68
  definition(t) {
27
69
  const validAttributes = Object.entries(attributes).filter(([attributeName]) =>
28
- extension
29
- .shadowCRUD(contentType.uid)
30
- .field(attributeName)
31
- .hasFiltersEnabeld()
70
+ extension.shadowCRUD(contentType.uid).field(attributeName).hasFiltersEnabeld()
32
71
  );
33
72
 
34
73
  const isIDFilterEnabled = extension
@@ -66,48 +105,6 @@ module.exports = ({ strapi }) => {
66
105
  });
67
106
  };
68
107
 
69
- const addScalarAttribute = (builder, attributeName, attribute) => {
70
- const { naming, mappers } = strapi.plugin('graphql').service('utils');
71
-
72
- const gqlType = mappers.strapiScalarToGraphQLScalar(attribute.type);
73
-
74
- builder.field(attributeName, { type: naming.getScalarFilterInputTypeName(gqlType) });
75
- };
76
-
77
- const addRelationalAttribute = (builder, attributeName, attribute) => {
78
- const utils = strapi.plugin('graphql').service('utils');
79
- const extension = strapi.plugin('graphql').service('extension');
80
- const { getFiltersInputTypeName } = utils.naming;
81
- const { isMorphRelation } = utils.attributes;
82
-
83
- const model = strapi.getModel(attribute.target);
84
-
85
- // If there is no model corresponding to the attribute configuration
86
- // or if the attribute is a polymorphic relation, then ignore it
87
- if (!model || isMorphRelation(attribute)) return;
88
-
89
- // If the target model is disabled, then ignore it too
90
- if (extension.shadowCRUD(model.uid).isDisabled()) return;
91
-
92
- builder.field(attributeName, { type: getFiltersInputTypeName(model) });
93
- };
94
-
95
- const addComponentAttribute = (builder, attributeName, attribute) => {
96
- const utils = strapi.plugin('graphql').service('utils');
97
- const extension = strapi.plugin('graphql').service('extension');
98
- const { getFiltersInputTypeName } = utils.naming;
99
-
100
- const component = strapi.getModel(attribute.component);
101
-
102
- // If there is no component corresponding to the attribute configuration, then ignore it
103
- if (!component) return;
104
-
105
- // If the component is disabled, then ignore it too
106
- if (extension.shadowCRUD(component.uid).isDisabled()) return;
107
-
108
- builder.field(attributeName, { type: getFiltersInputTypeName(component) });
109
- };
110
-
111
108
  return {
112
109
  buildContentTypeFilters,
113
110
  };
@@ -2,6 +2,6 @@
2
2
 
3
3
  const contentType = require('./content-type');
4
4
 
5
- module.exports = context => ({
5
+ module.exports = (context) => ({
6
6
  ...contentType(context),
7
7
  });
@@ -36,4 +36,4 @@ const operators = {
36
36
  };
37
37
 
38
38
  // Instantiate every operator with the Strapi instance
39
- module.exports = context => mapValues(opCtor => opCtor(context), operators);
39
+ module.exports = (context) => mapValues((opCtor) => opCtor(context), operators);
@@ -55,7 +55,7 @@ module.exports = ({ strapi }) => {
55
55
 
56
56
  const builders = pipe(
57
57
  // Create a new instance of every builders
58
- map(factory => factory(context)),
58
+ map((factory) => factory(context)),
59
59
  // Merge every builder into the same object
60
60
  reduce(merge, {})
61
61
  ).call(null, buildersFactories);
@@ -5,18 +5,14 @@ const {
5
5
  contentTypes: { isWritableAttribute },
6
6
  } = require('@strapi/utils');
7
7
 
8
- module.exports = context => {
8
+ module.exports = (context) => {
9
9
  const { strapi } = context;
10
10
 
11
11
  const { naming, mappers, attributes } = strapi.plugin('graphql').service('utils');
12
12
  const extension = strapi.plugin('graphql').service('extension');
13
13
 
14
- const {
15
- getComponentInputName,
16
- getContentTypeInputName,
17
- getEnumName,
18
- getDynamicZoneInputName,
19
- } = naming;
14
+ const { getComponentInputName, getContentTypeInputName, getEnumName, getDynamicZoneInputName } =
15
+ naming;
20
16
 
21
17
  const {
22
18
  isStrapiScalar,
@@ -32,20 +28,16 @@ module.exports = context => {
32
28
  buildInputType(contentType) {
33
29
  const { attributes, modelType } = contentType;
34
30
 
35
- const name = (modelType === 'component'
36
- ? getComponentInputName
37
- : getContentTypeInputName
31
+ const name = (
32
+ modelType === 'component' ? getComponentInputName : getContentTypeInputName
38
33
  ).call(null, contentType);
39
34
 
40
35
  return inputObjectType({
41
36
  name,
42
37
 
43
38
  definition(t) {
44
- const isFieldEnabled = fieldName => {
45
- return extension
46
- .shadowCRUD(contentType.uid)
47
- .field(fieldName)
48
- .hasInputEnabled();
39
+ const isFieldEnabled = (fieldName) => {
40
+ return extension.shadowCRUD(contentType.uid).field(fieldName).hasInputEnabled();
49
41
  };
50
42
 
51
43
  const validAttributes = Object.entries(attributes).filter(([attributeName]) => {
@@ -80,7 +72,11 @@ module.exports = context => {
80
72
  return;
81
73
  }
82
74
 
83
- isMultiple ? t.list.id(attributeName) : t.id(attributeName);
75
+ if (isMultiple) {
76
+ t.list.id(attributeName);
77
+ } else {
78
+ t.id(attributeName);
79
+ }
84
80
  }
85
81
 
86
82
  // Regular Relations (ignore polymorphic relations)
@@ -91,7 +87,11 @@ module.exports = context => {
91
87
 
92
88
  const isToManyRelation = attribute.relation.endsWith('Many');
93
89
 
94
- isToManyRelation ? t.list.id(attributeName) : t.id(attributeName);
90
+ if (isToManyRelation) {
91
+ t.list.id(attributeName);
92
+ } else {
93
+ t.id(attributeName);
94
+ }
95
95
  }
96
96
 
97
97
  // Components
@@ -149,7 +149,7 @@ module.exports = ({ strapi }) => {
149
149
  return extension.use({ resolversConfig: { [action]: { auth } } });
150
150
  };
151
151
 
152
- const isActionEnabled = action => {
152
+ const isActionEnabled = (action) => {
153
153
  return extension.shadowCRUD(contentType.uid).isActionEnabled(action);
154
154
  };
155
155
 
@@ -3,7 +3,7 @@
3
3
  const createCollectionTypeMutationsBuilder = require('./collection-type');
4
4
  const createSingleTypeMutationsBuilder = require('./single-type');
5
5
 
6
- module.exports = context => ({
6
+ module.exports = (context) => ({
7
7
  ...createCollectionTypeMutationsBuilder(context),
8
8
  ...createSingleTypeMutationsBuilder(context),
9
9
  });
@@ -108,7 +108,7 @@ module.exports = ({ strapi }) => {
108
108
  return extension.use({ resolversConfig: { [action]: { auth } } });
109
109
  };
110
110
 
111
- const isActionEnabled = action => {
111
+ const isActionEnabled = (action) => {
112
112
  return extension.shadowCRUD(contentType.uid).isActionEnabled(action);
113
113
  };
114
114
 
@@ -16,7 +16,7 @@ module.exports = ({ strapi }) => {
16
16
  getEntityResponseCollectionName,
17
17
  } = naming;
18
18
 
19
- const buildCollectionTypeQueries = contentType => {
19
+ const buildCollectionTypeQueries = (contentType) => {
20
20
  const findOneQueryName = `Query.${getFindOneQueryName(contentType)}`;
21
21
  const findQueryName = `Query.${getFindQueryName(contentType)}`;
22
22
 
@@ -26,7 +26,7 @@ module.exports = ({ strapi }) => {
26
26
  return extension.use({ resolversConfig: { [action]: { auth } } });
27
27
  };
28
28
 
29
- const isActionEnabled = action => {
29
+ const isActionEnabled = (action) => {
30
30
  return extension.shadowCRUD(contentType.uid).isActionEnabled(action);
31
31
  };
32
32
 
@@ -3,7 +3,7 @@
3
3
  const createCollectionTypeQueriesBuilder = require('./collection-type');
4
4
  const createSingleTypeQueriesBuilder = require('./single-type');
5
5
 
6
- module.exports = context => ({
6
+ module.exports = (context) => ({
7
7
  ...createCollectionTypeQueriesBuilder(context),
8
8
  ...createSingleTypeQueriesBuilder(context),
9
9
  });
@@ -11,7 +11,7 @@ module.exports = ({ strapi }) => {
11
11
 
12
12
  const { getFindOneQueryName, getEntityResponseName } = naming;
13
13
 
14
- const buildSingleTypeQueries = contentType => {
14
+ const buildSingleTypeQueries = (contentType) => {
15
15
  const findQueryName = `Query.${getFindOneQueryName(contentType)}`;
16
16
 
17
17
  const extension = getService('extension');
@@ -20,7 +20,7 @@ module.exports = ({ strapi }) => {
20
20
  return extension.use({ resolversConfig: { [action]: { auth } } });
21
21
  };
22
22
 
23
- const isActionEnabled = action => {
23
+ const isActionEnabled = (action) => {
24
24
  return extension.shadowCRUD(contentType.uid).isActionEnabled(action);
25
25
  };
26
26
 
@@ -33,7 +33,7 @@ module.exports = ({ strapi }) => {
33
33
 
34
34
  const targetContentType = strapi.getModel(targetUID);
35
35
 
36
- return async (parent, args = {}, context) => {
36
+ return async (parent, args = {}, context = {}) => {
37
37
  const { auth } = context.state;
38
38
 
39
39
  const transformedArgs = transformArgs(args, {
@@ -58,8 +58,8 @@ module.exports = ({ strapi }) => {
58
58
  // so that the sanitize util can work properly.
59
59
  if (isMorphAttribute) {
60
60
  // Helpers used for the data cleanup
61
- const wrapData = dataToWrap => ({ [attributeName]: dataToWrap });
62
- const sanitizeData = dataToSanitize => {
61
+ const wrapData = (dataToWrap) => ({ [attributeName]: dataToWrap });
62
+ const sanitizeData = (dataToSanitize) => {
63
63
  return sanitize.contentAPI.output(dataToSanitize, contentType, { auth });
64
64
  };
65
65
  const unwrapData = get(attributeName);
@@ -72,7 +72,7 @@ module.exports = ({ strapi }) => {
72
72
 
73
73
  // If this is a to-many relation, it returns an object that
74
74
  // matches what the entity-response-collection's resolvers expect
75
- else if (isToMany) {
75
+ if (isToMany) {
76
76
  return toEntityResponseCollection(data, info);
77
77
  }
78
78
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module.exports = ({ strapi }) => ({
4
4
  buildDynamicZoneResolver({ contentTypeUID, attributeName }) {
5
- return async parent => {
5
+ return async (parent) => {
6
6
  return strapi.entityService.load(contentTypeUID, parent, attributeName);
7
7
  };
8
8
  },
@@ -6,7 +6,7 @@ const mutationsResolvers = require('./mutation');
6
6
  const componentResolvers = require('./component');
7
7
  const dynamicZoneResolvers = require('./dynamic-zone');
8
8
 
9
- module.exports = context => ({
9
+ module.exports = (context) => ({
10
10
  // Generics
11
11
  ...associationResolvers(context),
12
12
 
@@ -16,7 +16,7 @@ const { contentTypes } = require('@strapi/utils');
16
16
  * @property {object} context.strapi
17
17
  * @property {object} context.registry
18
18
  */
19
- module.exports = context => {
19
+ module.exports = (context) => {
20
20
  const { strapi } = context;
21
21
 
22
22
  const getGraphQLService = strapi.plugin('graphql').service;
@@ -48,6 +48,8 @@ module.exports = context => {
48
48
  * @param {TypeBuildersOptions} options
49
49
  */
50
50
  const addComponentAttribute = ({ builder, attributeName, contentType, attribute }) => {
51
+ let localBuilder = builder;
52
+
51
53
  const { naming } = getGraphQLService('utils');
52
54
  const { getContentTypeArgs } = getGraphQLService('builders').utils;
53
55
  const { buildComponentResolver } = getGraphQLService('builders').get('content-api');
@@ -55,7 +57,7 @@ module.exports = context => {
55
57
  const type = naming.getComponentNameFromAttribute(attribute);
56
58
 
57
59
  if (attribute.repeatable) {
58
- builder = builder.list;
60
+ localBuilder = localBuilder.list;
59
61
  }
60
62
 
61
63
  const targetComponent = strapi.getModel(attribute.component);
@@ -68,7 +70,7 @@ module.exports = context => {
68
70
 
69
71
  const args = getContentTypeArgs(targetComponent, { multiple: !!attribute.repeatable });
70
72
 
71
- builder.field(attributeName, { type, resolve, args });
73
+ localBuilder.field(attributeName, { type, resolve, args });
72
74
  };
73
75
 
74
76
  /**
@@ -124,13 +126,13 @@ module.exports = context => {
124
126
  * Add a media attribute to the type definition
125
127
  * @param {TypeBuildersOptions} options
126
128
  */
127
- const addMediaAttribute = options => {
129
+ const addMediaAttribute = (options) => {
128
130
  const { naming } = getGraphQLService('utils');
129
131
  const { getContentTypeArgs } = getGraphQLService('builders').utils;
130
132
  const { buildAssociationResolver } = getGraphQLService('builders').get('content-api');
131
133
  const extension = getGraphQLService('extension');
132
134
 
133
- let { builder } = options;
135
+ const { builder } = options;
134
136
  const { attributeName, attribute, contentType } = options;
135
137
  const fileUID = 'plugin::upload.file';
136
138
 
@@ -158,7 +160,7 @@ module.exports = context => {
158
160
  * Add a polymorphic relational attribute to the type definition
159
161
  * @param {TypeBuildersOptions} options
160
162
  */
161
- const addPolymorphicRelationalAttribute = options => {
163
+ const addPolymorphicRelationalAttribute = (options) => {
162
164
  const { GENERIC_MORPH_TYPENAME } = getGraphQLService('constants');
163
165
  const { naming } = getGraphQLService('utils');
164
166
  const { buildAssociationResolver } = getGraphQLService('builders').get('content-api');
@@ -201,13 +203,13 @@ module.exports = context => {
201
203
  * Add a regular relational attribute to the type definition
202
204
  * @param {TypeBuildersOptions} options
203
205
  */
204
- const addRegularRelationalAttribute = options => {
206
+ const addRegularRelationalAttribute = (options) => {
205
207
  const { naming } = getGraphQLService('utils');
206
208
  const { getContentTypeArgs } = getGraphQLService('builders').utils;
207
209
  const { buildAssociationResolver } = getGraphQLService('builders').get('content-api');
208
210
  const extension = getGraphQLService('extension');
209
211
 
210
- let { builder } = options;
212
+ const { builder } = options;
211
213
  const { attributeName, attribute, contentType } = options;
212
214
 
213
215
  if (extension.shadowCRUD(attribute.target).isDisabled()) {
@@ -238,15 +240,12 @@ module.exports = context => {
238
240
  builder.field(attributeName, { type, resolve, args });
239
241
  };
240
242
 
241
- const isNotPrivate = contentType => attributeName => {
243
+ const isNotPrivate = (contentType) => (attributeName) => {
242
244
  return !contentTypes.isPrivateAttribute(contentType, attributeName);
243
245
  };
244
246
 
245
- const isNotDisabled = contentType => attributeName => {
246
- return extension
247
- .shadowCRUD(contentType.uid)
248
- .field(attributeName)
249
- .hasOutputEnabled();
247
+ const isNotDisabled = (contentType) => (attributeName) => {
248
+ return extension.shadowCRUD(contentType.uid).field(attributeName).hasOutputEnabled();
250
249
  };
251
250
 
252
251
  return {
@@ -306,7 +305,7 @@ module.exports = context => {
306
305
  // Ignore disabled fields (from extension service)
307
306
  .filter(isNotDisabled(contentType))
308
307
  // Add each attribute to the type definition
309
- .forEach(attributeName => {
308
+ .forEach((attributeName) => {
310
309
  const attribute = attributes[attributeName];
311
310
 
312
311
  // We create a copy of the builder (t) to apply custom
@@ -35,7 +35,7 @@ module.exports = ({ strapi }) => {
35
35
  }
36
36
 
37
37
  // Collection Types
38
- else if (kind === 'collectionType') {
38
+ if (kind === 'collectionType') {
39
39
  if (!multiple) {
40
40
  return { id: 'ID' };
41
41
  }
@@ -54,7 +54,7 @@ module.exports = ({ strapi }) => {
54
54
  }
55
55
 
56
56
  // Single Types
57
- else if (kind === 'singleType') {
57
+ if (kind === 'singleType') {
58
58
  const params = {};
59
59
 
60
60
  if (hasDraftAndPublish(contentType)) {
@@ -85,7 +85,7 @@ module.exports = ({ strapi }) => {
85
85
  * @param {object} attributes - The attributes object to transform
86
86
  * @return {Object<string, string>}
87
87
  */
88
- scalarAttributesToFiltersMap: mapValues(attribute => {
88
+ scalarAttributesToFiltersMap: mapValues((attribute) => {
89
89
  const { mappers, naming } = getService('utils');
90
90
 
91
91
  const gqlScalar = mappers.strapiScalarToGraphQLScalar(attribute.type);
@@ -127,9 +127,9 @@ module.exports = ({ strapi }) => {
127
127
  contentTypes
128
128
  .map(prop('uid'))
129
129
  .filter(startsWith('admin::'))
130
- .forEach(uid => extensionService.shadowCRUD(uid).disable());
130
+ .forEach((uid) => extensionService.shadowCRUD(uid).disable());
131
131
 
132
- const contentTypesWithShadowCRUD = contentTypes.filter(ct =>
132
+ const contentTypesWithShadowCRUD = contentTypes.filter((ct) =>
133
133
  extensionService.shadowCRUD(ct.uid).isEnabled()
134
134
  );
135
135
 
@@ -144,7 +144,7 @@ module.exports = ({ strapi }) => {
144
144
  * Register needed GraphQL types for every content type
145
145
  * @param {object[]} contentTypes
146
146
  */
147
- const registerAPITypes = contentTypes => {
147
+ const registerAPITypes = (contentTypes) => {
148
148
  for (const contentType of contentTypes) {
149
149
  const { kind, modelType } = contentType;
150
150
 
@@ -174,7 +174,7 @@ module.exports = ({ strapi }) => {
174
174
  }
175
175
  };
176
176
 
177
- const registerMorphTypes = contentTypes => {
177
+ const registerMorphTypes = (contentTypes) => {
178
178
  // Create & register a union type that includes every type or component registered
179
179
  const genericMorphType = builders.buildGenericMorphDefinition();
180
180
  registry.register(GENERIC_MORPH_TYPENAME, genericMorphType, { kind: KINDS.morph });
@@ -19,7 +19,7 @@ const registerCollectionType = (contentType, { registry, strapi, builders }) =>
19
19
  mutations: naming.getEntityMutationsTypeName(contentType),
20
20
  };
21
21
 
22
- const getConfig = kind => ({ kind, contentType });
22
+ const getConfig = (kind) => ({ kind, contentType });
23
23
 
24
24
  // Type definition
25
25
  registry.register(types.base, builders.buildTypeDefinition(contentType), getConfig(KINDS.type));
@@ -11,7 +11,7 @@ const registerDynamicZonesDefinition = (contentType, { registry, strapi, builder
11
11
 
12
12
  const { attributes } = contentType;
13
13
 
14
- const dynamicZoneAttributes = Object.keys(attributes).filter(attributeName =>
14
+ const dynamicZoneAttributes = Object.keys(attributes).filter((attributeName) =>
15
15
  isDynamicZone(attributes[attributeName])
16
16
  );
17
17
 
@@ -11,7 +11,7 @@ const registerEnumsDefinition = (contentType, { registry, strapi, builders }) =>
11
11
 
12
12
  const { attributes } = contentType;
13
13
 
14
- const enumAttributes = Object.keys(attributes).filter(attributeName =>
14
+ const enumAttributes = Object.keys(attributes).filter((attributeName) =>
15
15
  isEnumeration(attributes[attributeName])
16
16
  );
17
17
 
@@ -31,9 +31,9 @@ const registerPolymorphicContentType = (contentType, { registry, strapi }) => {
31
31
  // Transform target UIDs into types names
32
32
  const members = target
33
33
  // Get content types definitions
34
- .map(uid => strapi.getModel(uid))
34
+ .map((uid) => strapi.getModel(uid))
35
35
  // Resolve types names
36
- .map(contentType => naming.getTypeName(contentType));
36
+ .map((contentType) => naming.getTypeName(contentType));
37
37
 
38
38
  // Register the new polymorphic union type
39
39
  registry.register(
@@ -18,7 +18,7 @@ const registerSingleType = (contentType, { registry, strapi, builders }) => {
18
18
  mutations: naming.getEntityMutationsTypeName(contentType),
19
19
  };
20
20
 
21
- const getConfig = kind => ({ kind, contentType });
21
+ const getConfig = (kind) => ({ kind, contentType });
22
22
 
23
23
  // Single type's definition
24
24
  registry.register(types.base, builders.buildTypeDefinition(contentType), getConfig(KINDS.type));
@@ -15,6 +15,37 @@ const introspectionQueries = [
15
15
  '__Directive',
16
16
  ];
17
17
 
18
+ /**
19
+ * Get & parse middlewares definitions from the resolver's config
20
+ * @param {object} resolverConfig
21
+ * @param {object} strapi
22
+ * @return {function[]}
23
+ */
24
+ const parseMiddlewares = (resolverConfig, strapi) => {
25
+ const resolverMiddlewares = getOr([], 'middlewares', resolverConfig);
26
+
27
+ // TODO: [v4] to factorize with compose endpoints (routes)
28
+ return resolverMiddlewares.map((middleware) => {
29
+ if (isFunction(middleware)) {
30
+ return middleware;
31
+ }
32
+
33
+ if (typeof middleware === 'string') {
34
+ return strapi.middleware(middleware);
35
+ }
36
+
37
+ if (typeof middleware === 'object') {
38
+ const { name, options = {} } = middleware;
39
+
40
+ return strapi.middleware(name)(options);
41
+ }
42
+
43
+ throw new Error(
44
+ `Invalid middleware type, expected (function,string,object), received ${typeof middleware}`
45
+ );
46
+ });
47
+ };
48
+
18
49
  /**
19
50
  * Wrap the schema's resolvers if they've been
20
51
  * customized using the GraphQL extension service
@@ -114,31 +145,4 @@ const wrapResolvers = ({ schema, strapi, extension = {} }) => {
114
145
  return schema;
115
146
  };
116
147
 
117
- /**
118
- * Get & parse middlewares definitions from the resolver's config
119
- * @param {object} resolverConfig
120
- * @param {object} strapi
121
- * @return {function[]}
122
- */
123
- const parseMiddlewares = (resolverConfig, strapi) => {
124
- const resolverMiddlewares = getOr([], 'middlewares', resolverConfig);
125
-
126
- // TODO: [v4] to factorize with compose endpoints (routes)
127
- return resolverMiddlewares.map(middleware => {
128
- if (isFunction(middleware)) {
129
- return middleware;
130
- }
131
-
132
- if (typeof middleware === 'string') {
133
- return strapi.middleware(middleware);
134
- }
135
-
136
- if (typeof middleware === 'object') {
137
- const { name, options = {} } = middleware;
138
-
139
- return strapi.middleware(name)(options);
140
- }
141
- });
142
- };
143
-
144
148
  module.exports = { wrapResolvers };
@@ -50,15 +50,14 @@ const createExtension = ({ strapi } = {}) => {
50
50
  * @return {object}
51
51
  */
52
52
  generate({ typeRegistry }) {
53
- const resolveConfig = config => {
53
+ const resolveConfig = (config) => {
54
54
  return typeof config === 'function' ? config({ strapi, nexus, typeRegistry }) : config;
55
55
  };
56
56
 
57
57
  // Evaluate & merge every registered configuration object, then return the result
58
58
  return configs.reduce((acc, configuration) => {
59
- const { types, typeDefs, resolvers, resolversConfig, plugins } = resolveConfig(
60
- configuration
61
- );
59
+ const { types, typeDefs, resolvers, resolversConfig, plugins } =
60
+ resolveConfig(configuration);
62
61
 
63
62
  // Register type definitions
64
63
  if (typeof typeDefs === 'string') {
@@ -24,7 +24,7 @@ const ALL_ACTIONS = '*';
24
24
  module.exports = () => {
25
25
  const configs = new Map();
26
26
 
27
- return uid => {
27
+ return (uid) => {
28
28
  if (!configs.has(uid)) {
29
29
  configs.set(uid, getDefaultContentTypeConfig());
30
30
  }
@@ -57,7 +57,9 @@ module.exports = () => {
57
57
  isActionEnabled(action) {
58
58
  const matchingActions = [action, ALL_ACTIONS];
59
59
 
60
- return configs.get(uid).disabledActions.every(action => !matchingActions.includes(action));
60
+ return configs
61
+ .get(uid)
62
+ .disabledActions.every((action) => !matchingActions.includes(action));
61
63
  },
62
64
 
63
65
  isActionDisabled(action) {
@@ -93,7 +95,7 @@ module.exports = () => {
93
95
  },
94
96
 
95
97
  disableActions(actions = []) {
96
- actions.forEach(action => this.disableAction(action));
98
+ actions.forEach((action) => this.disableAction(action));
97
99
 
98
100
  return this;
99
101
  },
@@ -2,6 +2,6 @@
2
2
 
3
3
  const returnTypes = require('./return-types');
4
4
 
5
- module.exports = context => ({
5
+ module.exports = (context) => ({
6
6
  returnTypes: returnTypes(context),
7
7
  });
@@ -4,7 +4,7 @@ const SortArg = require('./sort');
4
4
  const publicationState = require('./publication-state');
5
5
  const PaginationArg = require('./pagination');
6
6
 
7
- module.exports = context => ({
7
+ module.exports = (context) => ({
8
8
  SortArg,
9
9
  PaginationArg,
10
10
  PublicationStateArg: publicationState(context),
@@ -2,14 +2,16 @@
2
2
 
3
3
  const { first } = require('lodash/fp');
4
4
 
5
- module.exports = ({ strapi }) => () => {
6
- const { GRAPHQL_SCALAR_OPERATORS } = strapi.plugin('graphql').service('constants');
5
+ module.exports =
6
+ ({ strapi }) =>
7
+ () => {
8
+ const { GRAPHQL_SCALAR_OPERATORS } = strapi.plugin('graphql').service('constants');
7
9
 
8
- return (
9
- Object.entries(GRAPHQL_SCALAR_OPERATORS)
10
- // To be valid, a GraphQL scalar must have at least one operator enabled
11
- .filter(([, value]) => value.length > 0)
12
- // Only keep the key (the scalar name)
13
- .map(first)
14
- );
15
- };
10
+ return (
11
+ Object.entries(GRAPHQL_SCALAR_OPERATORS)
12
+ // To be valid, a GraphQL scalar must have at least one operator enabled
13
+ .filter(([, value]) => value.length > 0)
14
+ // Only keep the key (the scalar name)
15
+ .map(first)
16
+ );
17
+ };
@@ -2,6 +2,6 @@
2
2
 
3
3
  const getEnabledScalars = require('./get-enabled-scalars');
4
4
 
5
- module.exports = context => ({
5
+ module.exports = (context) => ({
6
6
  getEnabledScalars: getEnabledScalars(context),
7
7
  });
@@ -5,7 +5,7 @@ const scalars = require('./scalars');
5
5
  const types = require('./types');
6
6
  const helpers = require('./helpers');
7
7
 
8
- module.exports = context => ({
8
+ module.exports = (context) => ({
9
9
  args: args(context),
10
10
  scalars: scalars(context),
11
11
  buildInternalTypes: types(context),
@@ -2,15 +2,17 @@
2
2
 
3
3
  const { GraphQLDate } = require('graphql-scalars');
4
4
 
5
- const parseAndCast = parseFn => (...args) => {
6
- const parsedValue = parseFn(...args);
5
+ const parseAndCast =
6
+ (parseFn) =>
7
+ (...args) => {
8
+ const parsedValue = parseFn(...args);
7
9
 
8
- if (parsedValue instanceof Date) {
9
- return parsedValue.toISOString().split('T')[0];
10
- }
10
+ if (parsedValue instanceof Date) {
11
+ return parsedValue.toISOString().split('T')[0];
12
+ }
11
13
 
12
- return parsedValue;
13
- };
14
+ return parsedValue;
15
+ };
14
16
 
15
17
  // GraphQLDate casts the date string to new Date, we want to keep it as a string so we cast it back to a string
16
18
  // see https://github.com/excitement-engineer/graphql-iso-date/issues/106
@@ -27,7 +27,7 @@ const TimeScalar = new GraphQLScalarType({
27
27
  throw new ValidationError('Time cannot represent non string type');
28
28
  }
29
29
 
30
- const value = ast.value;
30
+ const { value } = ast;
31
31
 
32
32
  return parseType({ type: 'time', value });
33
33
  },
@@ -34,6 +34,6 @@ const buildScalarFilters = ({ strapi }) => {
34
34
  }, {});
35
35
  };
36
36
 
37
- module.exports = context => ({
37
+ module.exports = (context) => ({
38
38
  scalars: buildScalarFilters(context),
39
39
  });
@@ -6,7 +6,7 @@ const publicationState = require('./publication-state');
6
6
  const filters = require('./filters');
7
7
  const error = require('./error');
8
8
 
9
- module.exports = context => () => {
9
+ module.exports = (context) => () => {
10
10
  const { strapi } = context;
11
11
 
12
12
  const { KINDS } = strapi.plugin('graphql').service('constants');
@@ -8,11 +8,8 @@ module.exports = ({ strapi }) => {
8
8
  * @param {object} attribute
9
9
  * @return {boolean}
10
10
  */
11
- const isStrapiScalar = attribute => {
12
- return strapi
13
- .plugin('graphql')
14
- .service('constants')
15
- .STRAPI_SCALARS.includes(attribute.type);
11
+ const isStrapiScalar = (attribute) => {
12
+ return strapi.plugin('graphql').service('constants').STRAPI_SCALARS.includes(attribute.type);
16
13
  };
17
14
 
18
15
  /**
@@ -20,11 +17,8 @@ module.exports = ({ strapi }) => {
20
17
  * @param {object} attribute
21
18
  * @return {boolean}
22
19
  */
23
- const isGraphQLScalar = attribute => {
24
- return strapi
25
- .plugin('graphql')
26
- .service('constants')
27
- .GRAPHQL_SCALARS.includes(attribute.type);
20
+ const isGraphQLScalar = (attribute) => {
21
+ return strapi.plugin('graphql').service('constants').GRAPHQL_SCALARS.includes(attribute.type);
28
22
  };
29
23
 
30
24
  /**
@@ -32,7 +26,7 @@ module.exports = ({ strapi }) => {
32
26
  * @param {object} attribute
33
27
  * @return {boolean}
34
28
  */
35
- const isMorphRelation = attribute => {
29
+ const isMorphRelation = (attribute) => {
36
30
  return isRelation(attribute) && attribute.relation.includes('morph');
37
31
  };
38
32
 
@@ -4,7 +4,7 @@ const mappers = require('./mappers');
4
4
  const attributes = require('./attributes');
5
5
  const naming = require('./naming');
6
6
 
7
- module.exports = context => ({
7
+ module.exports = (context) => ({
8
8
  naming: naming(context),
9
9
  attributes: attributes(context),
10
10
  mappers: mappers(context),
@@ -2,7 +2,7 @@
2
2
 
3
3
  const { map } = require('lodash/fp');
4
4
 
5
- const entityToResponseEntity = entity => ({ id: entity.id, attributes: entity });
5
+ const entityToResponseEntity = (entity) => ({ id: entity.id, attributes: entity });
6
6
 
7
7
  const entitiesToResponseEntities = map(entityToResponseEntity);
8
8
 
@@ -8,7 +8,7 @@ const virtualScalarAttributes = ['id'];
8
8
  module.exports = ({ strapi }) => {
9
9
  const { service: getService } = strapi.plugin('graphql');
10
10
 
11
- const recursivelyReplaceScalarOperators = data => {
11
+ const recursivelyReplaceScalarOperators = (data) => {
12
12
  const { operators } = getService('builders').filters;
13
13
 
14
14
  if (Array.isArray(data)) {
@@ -54,7 +54,7 @@ module.exports = ({ strapi }) => {
54
54
 
55
55
  // If filters is a collection, then apply the transformation to every item of the list
56
56
  if (Array.isArray(filters)) {
57
- return filters.map(filtersItem =>
57
+ return filters.map((filtersItem) =>
58
58
  this.graphQLFiltersToStrapiQuery(filtersItem, contentType)
59
59
  );
60
60
  }
@@ -62,7 +62,7 @@ module.exports = ({ strapi }) => {
62
62
  const resultMap = {};
63
63
  const { attributes } = contentType;
64
64
 
65
- const isAttribute = attributeName => {
65
+ const isAttribute = (attributeName) => {
66
66
  return virtualScalarAttributes.includes(attributeName) || has(attributeName, attributes);
67
67
  };
68
68
 
@@ -8,7 +8,7 @@ module.exports = ({ strapi }) => ({
8
8
  const { operators } = strapi.plugin('graphql').service('builders').filters;
9
9
 
10
10
  const associations = mapValues(
11
- map(operatorName => operators[operatorName]),
11
+ map((operatorName) => operators[operatorName]),
12
12
  GRAPHQL_SCALAR_OPERATORS
13
13
  );
14
14
 
@@ -5,7 +5,7 @@ const graphQLFiltersToStrapiQuery = require('./graphql-filters-to-strapi-query')
5
5
  const graphqlScalarToOperators = require('./graphql-scalar-to-operators');
6
6
  const entityToResponseEntity = require('./entity-to-response-entity');
7
7
 
8
- module.exports = context => ({
8
+ module.exports = (context) => ({
9
9
  ...strapiScalarToGraphQLScalar(context),
10
10
  ...graphQLFiltersToStrapiQuery(context),
11
11
  ...graphqlScalarToOperators(context),
@@ -50,7 +50,7 @@ module.exports = ({ strapi }) => {
50
50
  * @param {object} contentType
51
51
  * @return {string}
52
52
  */
53
- const getEntityName = contentType => {
53
+ const getEntityName = (contentType) => {
54
54
  return `${getTypeName(contentType)}Entity`;
55
55
  };
56
56
 
@@ -59,7 +59,7 @@ module.exports = ({ strapi }) => {
59
59
  * @param {object} contentType
60
60
  * @return {string}
61
61
  */
62
- const getEntityMetaName = contentType => {
62
+ const getEntityMetaName = (contentType) => {
63
63
  return `${getEntityName(contentType)}Meta`;
64
64
  };
65
65
 
@@ -68,7 +68,7 @@ module.exports = ({ strapi }) => {
68
68
  * @param {object} contentType
69
69
  * @return {string}
70
70
  */
71
- const getEntityResponseName = contentType => {
71
+ const getEntityResponseName = (contentType) => {
72
72
  return `${getEntityName(contentType)}Response`;
73
73
  };
74
74
 
@@ -77,7 +77,7 @@ module.exports = ({ strapi }) => {
77
77
  * @param {object} contentType
78
78
  * @return {string}
79
79
  */
80
- const getEntityResponseCollectionName = contentType => {
80
+ const getEntityResponseCollectionName = (contentType) => {
81
81
  return `${getEntityName(contentType)}ResponseCollection`;
82
82
  };
83
83
 
@@ -86,7 +86,7 @@ module.exports = ({ strapi }) => {
86
86
  * @param {object} contentType
87
87
  * @return {string}
88
88
  */
89
- const getRelationResponseCollectionName = contentType => {
89
+ const getRelationResponseCollectionName = (contentType) => {
90
90
  return `${getTypeName(contentType)}RelationResponseCollection`;
91
91
  };
92
92
 
@@ -95,7 +95,7 @@ module.exports = ({ strapi }) => {
95
95
  * @param {object} contentType
96
96
  * @return {string}
97
97
  */
98
- const getComponentName = contentType => {
98
+ const getComponentName = (contentType) => {
99
99
  return contentType.globalId;
100
100
  };
101
101
 
@@ -104,7 +104,7 @@ module.exports = ({ strapi }) => {
104
104
  * @param {object} attribute
105
105
  * @return {string}
106
106
  */
107
- const getComponentNameFromAttribute = attribute => {
107
+ const getComponentNameFromAttribute = (attribute) => {
108
108
  return strapi.components[attribute.component].globalId;
109
109
  };
110
110
 
@@ -139,7 +139,7 @@ module.exports = ({ strapi }) => {
139
139
  * @param {object} contentType
140
140
  * @return {string}
141
141
  */
142
- const getComponentInputName = contentType => {
142
+ const getComponentInputName = (contentType) => {
143
143
  const componentName = getComponentName(contentType);
144
144
 
145
145
  return `${componentName}Input`;
@@ -150,7 +150,7 @@ module.exports = ({ strapi }) => {
150
150
  * @param {object} contentType
151
151
  * @return {string}
152
152
  */
153
- const getContentTypeInputName = contentType => {
153
+ const getContentTypeInputName = (contentType) => {
154
154
  const typeName = getTypeName(contentType);
155
155
 
156
156
  return `${typeName}Input`;
@@ -161,7 +161,7 @@ module.exports = ({ strapi }) => {
161
161
  * @param {object} contentType
162
162
  * @return {string}
163
163
  */
164
- const getEntityQueriesTypeName = contentType => {
164
+ const getEntityQueriesTypeName = (contentType) => {
165
165
  return `${getEntityName(contentType)}Queries`;
166
166
  };
167
167
 
@@ -170,7 +170,7 @@ module.exports = ({ strapi }) => {
170
170
  * @param {object} contentType
171
171
  * @return {string}
172
172
  */
173
- const getEntityMutationsTypeName = contentType => {
173
+ const getEntityMutationsTypeName = (contentType) => {
174
174
  return `${getEntityName(contentType)}Mutations`;
175
175
  };
176
176
 
@@ -179,7 +179,7 @@ module.exports = ({ strapi }) => {
179
179
  * @param {object} contentType
180
180
  * @return {string}
181
181
  */
182
- const getFiltersInputTypeName = contentType => {
182
+ const getFiltersInputTypeName = (contentType) => {
183
183
  const isComponent = contentType.modelType === 'component';
184
184
 
185
185
  const baseName = isComponent ? getComponentName(contentType) : getTypeName(contentType);
@@ -192,7 +192,7 @@ module.exports = ({ strapi }) => {
192
192
  * @param {NexusGenScalars} scalarType
193
193
  * @return {string}
194
194
  */
195
- const getScalarFilterInputTypeName = scalarType => {
195
+ const getScalarFilterInputTypeName = (scalarType) => {
196
196
  return `${scalarType}FilterInput`;
197
197
  };
198
198
 
@@ -229,11 +229,11 @@ module.exports = ({ strapi }) => {
229
229
  }
230
230
 
231
231
  const getCustomTypeName = pipe(
232
- ct => getTypeName(ct, { plurality }),
232
+ (ct) => getTypeName(ct, { plurality }),
233
233
  firstLetterCase === 'upper' ? upperFirst : lowerFirst
234
234
  );
235
235
 
236
- return contentType => `${prefix}${getCustomTypeName(contentType)}${suffix}`;
236
+ return (contentType) => `${prefix}${getCustomTypeName(contentType)}${suffix}`;
237
237
  };
238
238
 
239
239
  const getFindQueryName = buildCustomTypeNameGenerator({