dotansimha / dotansimha/graphql-code-generator
Generate a hash of the persisted query
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 23
Description
**Is your feature request related to a problem? Please describe.**
I want to have a persisted query hash on both server and client side. This will allow me to allow only certain requests. More details can be seen here https://www.apollographql.com/docs/react/api/link/persisted-queries/
**Describe the solution you'd like**
For the server, use a pair of hash and SDL. For the client, the operation name and hash.
**Describe alternatives you've considered**
Automatic calculation of the sha256 hash on the fly, but I can't help limiting requests.
**Additional context**
I think it might look like this, for the server:
```json
{
"a17fe338688a2c12e78b733dfc783f59f646907819c99d842d83389df095bf5c": "query fetchHeroFriends {\n hero {\n name\n friends {\n name\n }\n }\n}"
}
```
And for the client:
```json
{
"fetchHeroFriends": "a17fe338688a2c12e78b733dfc783f59f646907819c99d842d83389df095bf5c"
}
```
Or for the client to inject `document.documentId` how to do https://github.com/leoasis/graphql-persisted-document-loader
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.