@strapi/plugin-graphql 4.7.2-exp.175f7ac70ee76d6c825e4429e15fc85ee78d23bb → 4.8.0

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.7.2-exp.175f7ac70ee76d6c825e4429e15fc85ee78d23bb",
3
+ "version": "4.8.0",
4
4
  "description": "Adds GraphQL endpoint with default API methods.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,10 +29,10 @@
29
29
  "dependencies": {
30
30
  "@graphql-tools/schema": "8.5.1",
31
31
  "@graphql-tools/utils": "^8.12.0",
32
- "@strapi/design-system": "1.6.3",
33
- "@strapi/helper-plugin": "4.7.2-exp.175f7ac70ee76d6c825e4429e15fc85ee78d23bb",
34
- "@strapi/icons": "1.6.3",
35
- "@strapi/utils": "4.7.2-exp.175f7ac70ee76d6c825e4429e15fc85ee78d23bb",
32
+ "@strapi/design-system": "1.6.5",
33
+ "@strapi/helper-plugin": "4.8.0",
34
+ "@strapi/icons": "1.6.5",
35
+ "@strapi/utils": "4.8.0",
36
36
  "apollo-server-core": "3.11.1",
37
37
  "apollo-server-koa": "3.10.0",
38
38
  "glob": "^7.1.7",
@@ -72,5 +72,5 @@
72
72
  "description": "Adds GraphQL endpoint with default API methods.",
73
73
  "kind": "plugin"
74
74
  },
75
- "gitHead": "175f7ac70ee76d6c825e4429e15fc85ee78d23bb"
75
+ "gitHead": "e239e408f99c9e61e6d02b38f01632ce67412f2a"
76
76
  }
@@ -53,7 +53,7 @@ module.exports = ({ strapi }) => {
53
53
  .get('content-api')
54
54
  .buildMutationsResolvers({ contentType });
55
55
 
56
- const sanitizedParams = await sanitize.contentAPI.params(
56
+ const sanitizedQuery = await sanitize.contentAPI.query(
57
57
  omit(['data', 'files'], transformedArgs),
58
58
  contentType,
59
59
  {
@@ -61,7 +61,7 @@ module.exports = ({ strapi }) => {
61
61
  }
62
62
  );
63
63
 
64
- const entity = await strapi.entityService.findMany(uid, sanitizedParams);
64
+ const entity = await strapi.entityService.findMany(uid, sanitizedQuery);
65
65
 
66
66
  // Create or update
67
67
  const value = isNil(entity)
@@ -91,11 +91,11 @@ module.exports = ({ strapi }) => {
91
91
  .get('content-api')
92
92
  .buildMutationsResolvers({ contentType });
93
93
 
94
- const sanitizedParams = await sanitize.contentAPI.params(transformedArgs, contentType, {
94
+ const sanitizedQuery = await sanitize.contentAPI.query(transformedArgs, contentType, {
95
95
  auth: ctx?.state?.auth,
96
96
  });
97
97
 
98
- const entity = await strapi.entityService.findMany(uid, sanitizedParams);
98
+ const entity = await strapi.entityService.findMany(uid, sanitizedQuery);
99
99
 
100
100
  if (!entity) {
101
101
  throw new NotFoundError('Entity not found');
@@ -41,23 +41,19 @@ module.exports = ({ strapi }) => {
41
41
  usePagination: true,
42
42
  });
43
43
 
44
- const sanitizedParams = await sanitize.contentAPI.params(
45
- transformedArgs,
46
- targetContentType,
47
- {
48
- auth,
49
- }
50
- );
44
+ const sanitizedQuery = await sanitize.contentAPI.query(transformedArgs, targetContentType, {
45
+ auth,
46
+ });
51
47
 
52
48
  const data = await strapi.entityService.load(
53
49
  contentTypeUID,
54
50
  parent,
55
51
  attributeName,
56
- sanitizedParams
52
+ sanitizedQuery
57
53
  );
58
54
 
59
55
  const info = {
60
- args: sanitizedParams,
56
+ args: sanitizedQuery,
61
57
  resourceUID: targetUID,
62
58
  };
63
59
 
@@ -13,10 +13,10 @@ module.exports = ({ strapi }) => ({
13
13
  const component = strapi.getModel(componentName);
14
14
 
15
15
  const transformedArgs = transformArgs(args, { contentType: component, usePagination: true });
16
- const sanitizedParams = await sanitize.contentAPI.params(transformedArgs, contentType, {
16
+ const sanitizedQuery = await sanitize.contentAPI.query(transformedArgs, contentType, {
17
17
  auth: ctx?.state?.auth,
18
18
  });
19
- return strapi.entityService.load(contentTypeUID, parent, attributeName, sanitizedParams);
19
+ return strapi.entityService.load(contentTypeUID, parent, attributeName, sanitizedQuery);
20
20
  };
21
21
  },
22
22
  });
@@ -25,10 +25,10 @@ module.exports = ({ strapi }) => ({
25
25
 
26
26
  async delete(parent, args, ctx) {
27
27
  const { id, ...rest } = args;
28
- const sanitizedParams = sanitize.contentAPI.params(rest, contentType, {
28
+ const sanitizedQuery = sanitize.contentAPI.query(rest, contentType, {
29
29
  auth: ctx?.state?.auth,
30
30
  });
31
- return strapi.entityService.delete(uid, id, sanitizedParams);
31
+ return strapi.entityService.delete(uid, id, sanitizedQuery);
32
32
  },
33
33
  };
34
34
  },
@@ -9,19 +9,19 @@ module.exports = ({ strapi }) => ({
9
9
 
10
10
  return {
11
11
  async find(parent, args, ctx) {
12
- const sanitizedParams = await sanitize.contentAPI.params(args, contentType, {
12
+ const sanitizedQuery = await sanitize.contentAPI.query(args, contentType, {
13
13
  auth: ctx?.state?.auth,
14
14
  });
15
15
 
16
- return strapi.entityService.findMany(uid, sanitizedParams);
16
+ return strapi.entityService.findMany(uid, sanitizedQuery);
17
17
  },
18
18
 
19
19
  async findOne(parent, args, ctx) {
20
- const sanitizedParams = await sanitize.contentAPI.params(args, contentType, {
20
+ const sanitizedQuery = await sanitize.contentAPI.query(args, contentType, {
21
21
  auth: ctx?.state?.auth,
22
22
  });
23
23
 
24
- return strapi.entityService.findOne(uid, args.id, omit('id', sanitizedParams));
24
+ return strapi.entityService.findOne(uid, args.id, omit('id', sanitizedQuery));
25
25
  },
26
26
  };
27
27
  },
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const { entries, mapValues, omit } = require('lodash/fp');
4
+ const { idArg, nonNull } = require('nexus');
4
5
  const {
5
6
  pagination: { withDefaultPagination },
6
7
  contentTypes: { hasDraftAndPublish },
@@ -37,7 +38,7 @@ module.exports = ({ strapi }) => {
37
38
  // Collection Types
38
39
  if (kind === 'collectionType') {
39
40
  if (!multiple) {
40
- return { id: 'ID' };
41
+ return { id: nonNull(idArg()) };
41
42
  }
42
43
 
43
44
  const params = {
@@ -26,10 +26,10 @@ module.exports = ({ strapi }) => {
26
26
  const { start, limit } = args;
27
27
  const safeLimit = Math.max(limit, 1);
28
28
 
29
- const filteredArgs = await sanitize.contentAPI.params(args, parent.contentType, {
29
+ const sanitizedQuery = await sanitize.contentAPI.query(args, parent.contentType, {
30
30
  auth: ctx?.state?.auth,
31
31
  });
32
- const total = await strapi.entityService.count(resourceUID, filteredArgs);
32
+ const total = await strapi.entityService.count(resourceUID, sanitizedQuery);
33
33
  const pageSize = limit === -1 ? total - start : safeLimit;
34
34
  const pageCount = limit === -1 ? safeLimit : Math.ceil(total / safeLimit);
35
35
  const page = limit === -1 ? safeLimit : Math.floor(start / safeLimit) + 1;