@strapi/plugin-graphql 4.0.2 → 4.0.3

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/plugin-graphql",
3
- "version": "4.0.2",
3
+ "version": "4.0.3",
4
4
  "description": "Adds GraphQL endpoint with default API methods.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,7 +30,7 @@
30
30
  "@apollo/federation": "^0.28.0",
31
31
  "@graphql-tools/schema": "8.1.2",
32
32
  "@graphql-tools/utils": "^8.0.2",
33
- "@strapi/utils": "4.0.2",
33
+ "@strapi/utils": "4.0.3",
34
34
  "apollo-server-core": "3.1.2",
35
35
  "apollo-server-koa": "3.1.2",
36
36
  "glob": "^7.1.7",
@@ -52,7 +52,7 @@
52
52
  "koa": "^2.13.1"
53
53
  },
54
54
  "engines": {
55
- "node": ">=12.x.x <=16.x.x",
55
+ "node": ">=12.22.0 <=16.x.x",
56
56
  "npm": ">=6.0.0"
57
57
  },
58
58
  "strapi": {
@@ -61,5 +61,5 @@
61
61
  "description": "Adds GraphQL endpoint with default API methods.",
62
62
  "kind": "plugin"
63
63
  },
64
- "gitHead": "fd656a47698e0a33aae42abd4330410c8cba1d08"
64
+ "gitHead": "48893ae3fc951b618fd8c4fdc6970e623d2c92db"
65
65
  }
@@ -57,7 +57,7 @@ module.exports = async ({ strapi }) => {
57
57
  bodyParserConfig: true,
58
58
 
59
59
  plugins: [
60
- process.env.NODE_ENV === 'production'
60
+ process.env.NODE_ENV === 'production' && !config('playgroundAlways')
61
61
  ? ApolloServerPluginLandingPageDisabled()
62
62
  : ApolloServerPluginLandingPageGraphQLPlayground(),
63
63
  ],
@@ -58,8 +58,15 @@ module.exports = context => {
58
58
  }
59
59
 
60
60
  validAttributes.forEach(([attributeName, attribute]) => {
61
+ // Enums
62
+ if (isEnumeration(attribute)) {
63
+ const enumTypeName = getEnumName(contentType, attributeName);
64
+
65
+ t.field(attributeName, { type: enumTypeName });
66
+ }
67
+
61
68
  // Scalars
62
- if (isStrapiScalar(attribute)) {
69
+ else if (isStrapiScalar(attribute)) {
63
70
  const gqlScalar = mappers.strapiScalarToGraphQLScalar(attribute.type);
64
71
 
65
72
  t.field(attributeName, { type: gqlScalar });
@@ -87,13 +94,6 @@ module.exports = context => {
87
94
  isToManyRelation ? t.list.id(attributeName) : t.id(attributeName);
88
95
  }
89
96
 
90
- // Enums
91
- else if (isEnumeration(attribute)) {
92
- const enumTypeName = getEnumName(contentType, attributeName);
93
-
94
- t.field(attributeName, { type: enumTypeName });
95
- }
96
-
97
97
  // Components
98
98
  else if (isComponent(attribute)) {
99
99
  const isRepeatable = attribute.repeatable === true;
@@ -322,8 +322,13 @@ module.exports = context => {
322
322
  */
323
323
  const options = { builder, attributeName, attribute, contentType, context };
324
324
 
325
+ // Enums
326
+ if (isEnumeration(attribute)) {
327
+ addEnumAttribute(options);
328
+ }
329
+
325
330
  // Scalars
326
- if (isStrapiScalar(attribute)) {
331
+ else if (isStrapiScalar(attribute)) {
327
332
  addScalarAttribute(options);
328
333
  }
329
334
 
@@ -337,11 +342,6 @@ module.exports = context => {
337
342
  addDynamicZoneAttribute(options);
338
343
  }
339
344
 
340
- // Enums
341
- else if (isEnumeration(attribute)) {
342
- addEnumAttribute(options);
343
- }
344
-
345
345
  // Media
346
346
  else if (isMedia(attribute)) {
347
347
  addMediaAttribute(options);