async-graphql icon indicating copy to clipboard operation
async-graphql copied to clipboard

feat: add relay persisted_query extension

Open Miaxos opened this issue 4 years ago • 4 comments

A draft to add relay persisted Query extension.

The purpose is to check if this could solve https://github.com/async-graphql/async-graphql/issues/637 If it's in the right way, test are to be added and the allowlist should also be implemented.

It's only slightly different than Apollo's version, so maybe merge them later?

Miaxos avatar Sep 20 '21 16:09 Miaxos

Just double checking here — this isnt in query execution time. The query is uploaded via FormData well and truely before its execution time.

At runtime, the query is in fact sent via the id property. Perhaps im missing the mark, but Apollo and Relay persistence layers are very different concepts.

maraisr avatar Sep 20 '21 21:09 maraisr

Yep you are right, I didn't understand you only wanted the endpoint to store the queries.

But for async-graphql to work when a relay client ask for a persisted query, you'll need an extension like this.

At runtime, the query is in fact sent via the id property

The query is sent with the id property when compiling but with a doc_id from a relay client (from the documentation) image

Miaxos avatar Sep 20 '21 22:09 Miaxos

A consumer 100% controls the network layer — we can send whatever we'd like. doc_id is a facebook way, and 100% just for illustration. If async-graphql want to standardize on id, that is more than fine. Heck you could even make that field configurable.

maraisr avatar Sep 20 '21 23:09 maraisr

hi @Miaxos was wondering if you're still looking after this? If not, id be more than happy to fork your PR and help ship this across the finishing line 🚀

maraisr avatar Aug 23 '22 02:08 maraisr