Graphcool / graphcool-framework

Apache License 2.0
1.77k stars 131 forks source link

Readable filenames for permission queries #226

Open marktani opened 6 years ago

marktani commented 6 years ago

Issue by timsuchanek Tuesday Sep 12, 2017 at 08:54 GMT Originally opened as https://github.com/graphcool/prisma/issues/535


Transfered from https://github.com/graphcool/graphcool-cli/issues/164

In graphcool-cli version 1.3.8, pulling a project that have permission queries in it leads to the generation of files with names like ./query/cj70obsb104lv01983w3rnhqc.graphql

It would be much nicer if these files had readable names, based on what they are applied to, such as ./query/Post_update.graphql

When there is more than one permission query for a particular operation, they could be named sequentially ( ./query/Post_update_2.graphql and so on)

marktani commented 6 years ago

Comment by sorenbs Tuesday Sep 12, 2017 at 13:13 GMT


This is an inconvenience developers will only experience once when mgirating their legacy project. We are unlikely to prioritise this.

marktani commented 6 years ago

Comment by kbrandwijk Tuesday Sep 12, 2017 at 13:17 GMT


As this new local workflow is introduced after most projects are already created, ejecting is going to be the most common starting point for the local workflow. Of course you can rename everything afterwards, but a bit more 'intelligence' in the process would be nice. For example, a lot of people duplicate their identical permission queries for many types (user can only update his own nodes is a very, very, very, common one). It would be nice if the eject option detects identical PQ's, and only creates one .graphql file.

marktani commented 6 years ago

Comment by jcheroske Monday Sep 18, 2017 at 19:38 GMT


We have a very young project that is just starting to use the CLI. I didn't see anything about ejecting in the docs, and we're about to make heavy use of permission queries. Can someone say more about this, or point me to the relevant documentation? We want to be able to manage all of our graph.cool assets in version control if possible.

marktani commented 6 years ago

Comment by marktani Monday Sep 18, 2017 at 19:39 GMT


Please have a look here: https://www.graph.cool/forum/t/feedback-new-cli-beta/949?u=nilan 🙂 Would love for you to participate in the beta!

marktani commented 6 years ago

Comment by jcheroske Monday Sep 18, 2017 at 19:43 GMT


"Projects with an active integration cannot be ejected."

Does that mean that if we are using the Auth0 stuff we are stuck?

marktani commented 6 years ago

Comment by marktani Monday Sep 18, 2017 at 19:44 GMT


You can migrate from the Auth0 integration to the custom Auth0 setup, here's an example: https://github.com/graphcool-examples/functions/tree/master/authentication/auth0-authentication

Or you build your own authentication solution, see https://github.com/graphcool-examples/functions/tree/master/authentication for more examples 🙂

marktani commented 6 years ago

Comment by jcheroske Monday Sep 18, 2017 at 19:51 GMT


Oh no! We don't want to roll all that stuff ourselves if we can help it. So, what you're saying is that, as it stands right now, we have to choose between using off-the-shelf integrations and using the new cli?

marktani commented 6 years ago

Comment by marktani Monday Sep 18, 2017 at 19:53 GMT


That's correct 🙂 We're compiling a list of modules that will help you getting started with authentication and other features: https://github.com/graphcool/modules/tree/master/authentication

marktani commented 6 years ago

Comment by jcheroske Monday Sep 18, 2017 at 20:01 GMT


I gotta say that I'm feeling pretty disappointed right now. We just spent a lot of time getting our project working with the current auth0 integration, and now it sounds like we're being left behind. It's called the bleeding edge for a reason I guess.

marktani commented 6 years ago

Comment by kbrandwijk Monday Sep 18, 2017 at 20:36 GMT


@jcheroske The transition from the built-in Auth0 integration to a custom Auth0 integration is pretty straightforward. I would advice you to use the method outlined here: https://github.com/graphcool-examples/functions/pull/77. It doesn't require any effort on the backend side to implement, and it will only require a minor change on the front-end, which is using the Graphcool token that is part of the returned claims, instead of the Auth0 token directly. It can be setup in less than 10 minutes.