331 Commits

Author SHA1 Message Date
Ralph
81a9a63cad
GraphQL Plugin (bug): Content type's attributes marked as private are being exposed in the exported GraphQL schema (#9805)
* Fixes #9804

* Fixes isPrivateAttribute function in strapi utils to take into account the private property within an attribute

* removing comment

* removing isNotPrivate function + adding call to already existing isPrivateAttribute function instead of isNotPrivate

* isPrivateAttribute fixed based on coments from Alexandre and confirmed that the model does indeed contain all private fields in an array at startup time

* removing isNotPrivate function and fixing generateEnumDefinitions to use the already available isPrivateAttribute function

* checking if created_at and update_at are also marked as private and if this is the case then hiding them

* allowIds by default when generating the input model to see if the tests will pass

* moving allowIds back to false by default

* adding isTypeAttributeEnabled function to check if a type attribute has been disabled and remove it from the exported graphql schema

* removing unused var

* only using isTypeAttributeEnabled instead of isPrivateAttribute.

* adding isPrivateAttribute at association level

* Adding isNotPrivate back together with isTypeAttributeEnabled

* adding unit test for removing a disabled attribute from a graphql schema

* renaming person to player in the test model

* Deleting the file as it has been renamed in the strapi master branch

* fixing lint issues

* fixing some lint issues

* adding isTypeAttributeEnabled support

* adding enumeration field in graphql

* adding use strict; to test file

* fixing test checking that disabled attributes in graphql are removed from the graphql schema

* adding test for buidShadowCrud

* Update packages/strapi-plugin-graphql/services/type-builder.js

Co-authored-by: Jean-Sébastien Herbaux <jean-sebastien.herbaux@epitech.eu>

Co-authored-by: Rmaroun <rmaroun@outlook.com>
Co-authored-by: Jean-Sébastien Herbaux <jean-sebastien.herbaux@epitech.eu>
2021-05-10 09:35:07 +02:00
Guilherme Pacheco
11a128ead2
Fix #10125 - Accept falsy values returned by controllers in GraphQL queries and mutations (#10145)
* Fix #10125 - accept falsy values returned by controllers

* Add test for falsy ctx.body on built graphql resolver

* Use test instead of it in unit tests
2021-04-26 16:46:37 +02:00
Alexandre Bodin
387b53bf35 Target shadowcrud mutations only 2021-04-14 17:14:45 +02:00
Alexandre Bodin
686aa2ae80 Pass extra args in ctx.query for every mutation 2021-04-14 16:30:00 +02:00
Alexandre Bodin
773069f7c5 Remove unnecessary code 2021-04-09 10:46:10 +02:00
Alexandre Bodin
02342ace0a Use objects instead of strings to declare queries & mutattions 2021-04-08 13:26:03 +02:00
Alexandre Bodin
a408dc1940 init 2021-04-06 16:59:32 +02:00
Alexandre Bodin
c57b3be1eb Merge branch 'master' into features/i18n 2021-03-12 09:45:51 +01:00
Alexandre BODIN
b3635962a3
Fix component assoc resolvers in graphql (#9660) 2021-03-10 10:46:46 +01:00
Alexandre Bodin
e9b4bf5616 Merge branch 'master' into features/i18n 2021-03-05 12:22:18 +01:00
Alexandre BODIN
65bc2d04d3
Fix config renamed by error (#9559) 2021-03-01 19:12:54 +01:00
Alexandre Bodin
469991f9f2 Merge branch 'master' into features/i18n 2021-02-18 14:36:32 +01:00
Pierre Noël
b3a9b5ad76 add pluginOptions 2021-02-10 14:29:54 +01:00
Alexandre BODIN
42d1d2b38e
test fix for many many perf issues (#9286) 2021-02-03 19:29:30 +01:00
pimsomeday
5d5ed0890b
Fix/8754 disable graphql queries other than crud (#9131)
* removes disabled resolvers from definitions

* cleanup

* fix empty query or mutation in schema

* filters disabled resolvers using graphql-tools

* returns generated schema directly

* return complete schema

* use lodash to get resolver

* uses printSchema from graphql
2021-01-22 19:06:04 +01:00
Alexandre Bodin
b08bc9ef48 Removed unused code & fix some typo 2021-01-05 09:38:12 +01:00
Alexandre Bodin
2a6e1e0b84 Add tests to data-loaders
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
2021-01-04 15:55:07 +01:00
HichamELBSI
53231b5833 Merge branch 'master' into feature/relational-fields 2020-12-16 10:17:47 +01:00
Diogo Correia
7585658128
Add ability to disable aggregation on GraphQL (#8119)
Signed-off-by: Diogo Correia <me@diogotc.com>
2020-12-14 11:57:13 +01:00
Alexandre Bodin
08a603623b Cleanup tests
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
2020-11-02 19:41:46 +01:00
Alexandre Bodin
0db015e6c2 Update tests
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
2020-11-02 19:41:45 +01:00
Alexandre Bodin
bfa6766475 init coll-type
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
2020-11-02 19:41:45 +01:00
Alexandre Bodin
07e7cfc0bd Make lint stricter and fix the errors
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
2020-11-02 19:41:42 +01:00
Alexandre BODIN
e53b54c218
Support query operators _or & _where in graphql with deep nesting (#8332)
* SUpport query operators _or _where in graphql with deep nesting

Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>

* Add testing for complexe graphql queries

Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
2020-10-15 13:22:40 +02:00
Alexandre Bodin
71a2657ed8 test node v14
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
2020-10-14 13:14:14 +02:00
Jean-Sébastien Herbaux
b2b4515d9b
Fix D&P population (#8249)
* Fix D&P population (gql, rest)

Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>

* Fix units tests

Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>

* Fix mongoose filtering on non draft & publish model

Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>

Co-authored-by: Alexandre Bodin <bodin.alex@gmail.com>
2020-10-08 20:54:48 +02:00
Alexandre Bodin
fcb2878987 Use a symbol to pass options add make it work with many before fixing them
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
2020-10-06 10:08:31 +02:00
Alexandre Bodin
60b52cf946 Add publicationState only if received in the args
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
2020-10-06 10:08:31 +02:00
Alexandre Bodin
5f7fcafc5f Fix publciationState for nested populations
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
2020-10-06 10:08:30 +02:00
Convly
773a86ae58 Fix conflicts / params => queryArguments
Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>
2020-10-05 16:02:44 +02:00
Convly
0951e45d12 Add publicationState argument for graphql queries
Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>
2020-10-05 15:56:30 +02:00
Jean-Sébastien Herbaux
e55ea1d6b5
Hide creator fields from public api by default (#8052)
* Add model option to hide/show creators fields in public API response

Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>

* Add content-types util, rework sanitize-entity's private handling

Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>

* Update search e2e tests, fix an issue on empty search for the core-api controller (find)

Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>

* Fix GraphQL plugin (handle privates attributes on typeDefs + resolver builds)

Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>

* Fix sanitizeEntity import

Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>

* Move doc update from beta to stable

Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>

* Fix e2e test

Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>

* Fix pr comments

Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>

* Remove creator's field from upload controller routes

Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>

* Fix typedef build for graphql association

Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>

* Fix pr (comments + several issues)

Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>

* Add tests for search behavior in content-manager

Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>

* Rename files variables to meaningful names (upload controllers)

Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>

* Fix test with search id matching serialNumber

Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>

* Add toHasBeenCalledWith check for config.get (utils/content-types.test.js)

Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>

Co-authored-by: Alexandre Bodin <bodin.alex@gmail.com>
2020-10-01 17:47:08 +02:00
Diego Albitres
0670c896e3
Add privateAttributes to global and per model response (#7331)
* Added privateAttributes globally and per model

Signed-off-by: Diego Albitres <diego.albitres@gmail.com>

* Added tests for sanitizeEntity

Signed-off-by: Diego Albitres <diego.albitres@gmail.com>

* Fixed broken test

Signed-off-by: Diego Albitres <diego.albitres@gmail.com>

* Added privateAttributes to GraphQL responses

Signed-off-by: Diego Albitres <diego.albitres@gmail.com>

* Added docs for privateAttributes

Signed-off-by: Diego Albitres <diego.albitres@gmail.com>

* Refactored and fixed PR comments

Signed-off-by: Diego Albitres <diego.albitres@gmail.com>

* Merged tests and fixed broken tests from merge

Signed-off-by: Diego Albitres <diego.albitres@gmail.com>

* Updated documentation for new option

Signed-off-by: Diego Albitres <diego.albitres@gmail.com>

* Refactored GraphQL implementation

Signed-off-by: Diego Albitres <diego.albitres@gmail.com>

* Fixed PR comments

Signed-off-by: Diego Albitres <diego.albitres@gmail.com>

* Fixed tests for sanitize-entity

Signed-off-by: Diego Albitres <diego.albitres@gmail.com>

* Removed code and tests for ignorePrivateFor

Signed-off-by: Diego Albitres <diego.albitres@gmail.com>

* Exported getPrivateAttributes for GraphQL plugin

Signed-off-by: Diego Albitres <diego.albitres@gmail.com>

* Removed ignorePrivateFor from docs

Signed-off-by: Diego Albitres <diego.albitres@gmail.com>
2020-09-24 09:40:10 +02:00
Daniel dos Santos Pereira
f5f0853942
fix(plugin-graphql): Fix associaion resolver for manyWay nature. (#7959)
This fixes strapi/strapi#4353 and all its duplicates.

Signed-off-by: Daniel dos Santos Pereira <danield1591998@gmail.com>
2020-09-22 17:05:27 +02:00
Daan van Ham
0f34541231
Merge branch 'master' into master 2020-08-07 16:16:09 +02:00
Adam
c8dc074d3b
fix(graphql): filter out orphaned relationships (#7363)
Signed-off-by: Adam Lee <admosity@users.noreply.github.com>
2020-08-07 15:55:53 +02:00
Daan van Ham
e933c28012 fixed strapi/strapi#7334 add the data-loader for admin users to the graphql-plugin
Signed-off-by: Daan van Ham <daan.van.ham@frontmen.nl>
2020-08-07 15:50:16 +02:00
Alexandre Bodin
b71ffa6c6c Merge branch 'master' into features/rbac 2020-07-16 14:52:55 +02:00
Shahein Moussavi
580102f0a5
Make Strapi GraphQL an implementing service for Federation (#6146)
* Add Strapi GraphQL to Apollo Federation as implementation

Signed-off-by: Shahein Moussavi <shaheinm@gmail.com>

* updated graphql plugin documentation for federation

Signed-off-by: Shahein Moussavi <shaheinm@gmail.com>

* Creating separate package while waiting for Strapi PR acceptance

Signed-off-by: Shahein Moussavi <shaheinm@gmail.com>

* v3.1.0-beta.0

Signed-off-by: Shahein Moussavi <shaheinm@gmail.com>

* Accidentally pushed bad changes

Signed-off-by: Shahein Moussavi <shaheinm@gmail.com>

* used lodash for config variable for consistency, updated comment to be more descriptive

Signed-off-by: Shahein Moussavi <shaheinm@gmail.com>
2020-07-16 09:09:59 +02:00
gp27
eb272e996c
- fix in graphql type builder (#6075)
a required attribute that has a default value it's now not required in the input schema used for entities creation

Signed-off-by: Gadi Piperno Corcos <gadi@skyriseltd.com>

Co-authored-by: Gadi Piperno Corcos <gadi@skyriseltd.com>
2020-07-16 08:45:44 +02:00
Alexandre Bodin
109e41ea1f Fix e2e tests
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
2020-07-08 13:53:56 +02:00
Alexandre Bodin
4edad86029 Add basic created_by updated_by
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
2020-07-08 11:48:16 +02:00
Alexandre Bodin
a4f294f1c4 Use passport standard error handling
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
2020-07-08 10:24:38 +02:00
Kim, Harim
465c19d2df
Add info to custom resolvers and add formatError to GraphQL service (#6524)
* Add info to custom resolvers, add formatError to GraphQL service

Signed-off-by: harimkims <harimkims@gmail.com>

* remove format-error service and use config instead

Signed-off-by: harimkims <harimkims@gmail.com>
2020-06-16 13:57:05 +02:00
Thomas Pockrandt
7120bb2558
Use singularName instead of pluralName for findOne resolver (#6574)
Signed-off-by: Thomas Pockrandt <me@thomaspockrandt.com>
2020-06-08 12:32:28 +02:00
Alexandre Bodin
3bf7947aa0 Remove dead code
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
2020-05-04 10:31:09 +02:00
Alexandre Bodin
9e34029878 Overwritte plugin config with user config
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
2020-04-29 11:06:37 +02:00
Alexandre Bodin
ed616333b2 Init new configuration management
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
2020-04-29 11:06:35 +02:00
Pierre Noël
4b7fbadef5
fix shadow crud breaking build when resolvers are not defined in a plugin (#5899)
* fix shadow crud breaking build when resolvers are not defined in a plugin

Signed-off-by: Pierre Noël <pierre.noel@strapi.io>

* refacto

Signed-off-by: Pierre Noël <pierre.noel@strapi.io>

Co-authored-by: Pierre Noël <pierre.noel@strapi.io>
2020-04-22 15:41:40 +02:00
Alexandre Bodin
cc9d23c3ac Merge branch 'develop' into features/media-lib
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
2020-04-07 20:24:39 +02:00