@strapi/plugin-graphql 4.0.0-beta.13 → 4.0.0-beta.17

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.
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@strapi/plugin-graphql",
3
- "version": "4.0.0-beta.13",
3
+ "version": "4.0.0-beta.17",
4
4
  "description": "Adds GraphQL endpoint with default API methods.",
5
5
  "strapi": {
6
6
  "displayName": "GraphQL",
7
7
  "name": "graphql",
8
- "description": "graphql.plugin.description",
8
+ "description": "Adds GraphQL endpoint with default API methods.",
9
9
  "kind": "plugin"
10
10
  },
11
11
  "scripts": {
@@ -15,7 +15,7 @@
15
15
  "@apollo/federation": "^0.28.0",
16
16
  "@graphql-tools/schema": "8.1.2",
17
17
  "@graphql-tools/utils": "^8.0.2",
18
- "@strapi/utils": "4.0.0-beta.13",
18
+ "@strapi/utils": "4.0.0-beta.17",
19
19
  "apollo-server-core": "3.1.2",
20
20
  "apollo-server-koa": "3.1.2",
21
21
  "glob": "^7.1.7",
@@ -53,5 +53,5 @@
53
53
  "npm": ">=6.0.0"
54
54
  },
55
55
  "license": "SEE LICENSE IN LICENSE",
56
- "gitHead": "3a31a96067aa0a74cabf51282215820ba46dd447"
56
+ "gitHead": "8f9cf3803464d3dbfc8c1090c16bb5f53a60c6c3"
57
57
  }
@@ -1,6 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  const { inputObjectType, nonNull } = require('nexus');
4
+ const {
5
+ contentTypes: { isWritableAttribute },
6
+ } = require('@strapi/utils');
4
7
 
5
8
  module.exports = context => {
6
9
  const { strapi } = context;
@@ -45,9 +48,9 @@ module.exports = context => {
45
48
  .hasInputEnabled();
46
49
  };
47
50
 
48
- const validAttributes = Object.entries(attributes).filter(([attributeName]) =>
49
- isFieldEnabled(attributeName)
50
- );
51
+ const validAttributes = Object.entries(attributes).filter(([attributeName]) => {
52
+ return isWritableAttribute(contentType, attributeName) && isFieldEnabled(attributeName);
53
+ });
51
54
 
52
55
  // Add the ID for the component to enable inplace updates
53
56
  if (modelType === 'component' && isFieldEnabled('id')) {
@@ -5,7 +5,7 @@ module.exports = ({ strapi }) => ({
5
5
  const { transformArgs } = strapi.plugin('graphql').service('builders').utils;
6
6
 
7
7
  return async (parent, args = {}) => {
8
- const contentType = strapi.contentTypes[contentTypeUID];
8
+ const contentType = strapi.getModel(contentTypeUID);
9
9
 
10
10
  const { component: componentName } = contentType.attributes[attributeName];
11
11
  const component = strapi.getModel(componentName);
@@ -150,12 +150,6 @@ module.exports = context => {
150
150
  const type = attribute.multiple
151
151
  ? naming.getRelationResponseCollectionName(fileContentType)
152
152
  : naming.getEntityResponseName(fileContentType);
153
- const resolverPath = `${naming.getTypeName(contentType)}.${attributeName}`;
154
- const resolverAuthScope = `${fileUID}.find`;
155
-
156
- extension.use({
157
- resolversConfig: { [resolverPath]: { auth: { scope: [resolverAuthScope] } } },
158
- });
159
153
 
160
154
  builder.field(attributeName, { type, resolve, args });
161
155
  };