318 Commits

Author SHA1 Message Date
Pierre Noël
b3a9b5ad76 add pluginOptions 2021-02-10 14:29:54 +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
Long Nguyen
77e243f841 Refactor code convert GraphQL params to ORM conditions
Signed-off-by: Long Nguyen <olragon@gmail.com>
2020-03-31 16:01:39 +02:00
Long Nguyen
634592fb5b fix: GraphQL Aggregation Bookshelf where condition aren't applied to groupBy
Signed-off-by: Long Nguyen <olragon@gmail.com>
2020-03-31 16:01:39 +02:00
Alexandre Bodin
087920fb47 Merge branch 'develop' into features/media-lib
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
2020-03-31 11:58:31 +02:00
Convly
67187c38f2 Rename _type to type and type to nonRequiredType
Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>
2020-03-30 16:45:00 +02:00
Convly
1103d96500 Rename noRequired to nonRequired
Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>
2020-03-30 16:45:00 +02:00
Convly
98b5b4a029 GraphQL Aggregation: Remove required marker when checking for number types (int/float)
Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>
2020-03-30 16:45:00 +02:00
Alexandre Bodin
50df7365d6 Merge branch 'develop' into features/media-lib
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
2020-03-30 12:04:04 +02:00
Long Nguyen
77a5160d1a
Implement Graphql Aggregation Feature for Bookshelf (#5605)
* Implement Graphql Aggregation Feature for Bookshelf

Signed-off-by: Long Nguyen <olragon@gmail.com>

* Fix no-unused-vars

Signed-off-by: Long Nguyen <olragon@gmail.com>

* Fix code to use `model.get()` instead of internal structure

Signed-off-by: Long Nguyen <olragon@gmail.com>
2020-03-27 10:40:29 +01:00
soupette
818927f7b5 Fix conflicts
Signed-off-by: soupette <cyril.lpz@gmail.com>
2020-03-23 14:33:17 +01:00
Kim, Harim
40ea493b26
Fix context issue in custom GraphQL query and mutation (#5532)
* fix context issue in custom query and mutation

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

* merge only state-related context

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

* roll back the code, fix the test instead

Signed-off-by: harimkims <harimkims@gmail.com>
2020-03-20 14:24:14 +01:00
Alexandre Bodin
ed2b973b99 Merge branch 'develop' into features/media-lib 2020-03-20 11:04:10 +01:00
Jelmer Visser
7f3be5eb04 Return newObj instead of original object
Signed-off-by: Jelmer Visser <jelmer@weflycheap.nl>
2020-03-20 09:27:05 +01:00
Jelmer Visser
4bda9f3104 Leave custom resolvers alone when diff
Signed-off-by: Jelmer Visser <jelmer@weflycheap.nl>
2020-03-20 09:27:05 +01:00