n1ru4l / envelop

Envelop is a lightweight library allowing developers to easily develop, share, collaborate and extend their GraphQL execution layer. Envelop is the missing GraphQL plugin system.
https://envelop.dev
MIT License
777 stars 126 forks source link

feat(response-cache): added getScope callback in buildResponseCacheKey #2202

Open Dunk14 opened 5 months ago

Dunk14 commented 5 months ago

Issue related : https://github.com/n1ru4l/envelop/issues/2181

Description

Include a getScope callback in buildResponseCacheKey to enable an Apollo like behavior, where PUBLIC scopes have only one cache key to get better performances on larger scales.

Type of change

How Has This Been Tested?

I added some unit tests to check that PRIVATE scope is correctly retrieved from a query, when directive @cacheControl(scope: PRIVATE) is put on query, field and subfield.

Checklist:

changeset-bot[bot] commented 5 months ago

🦋 Changeset detected

Latest commit: 9e8ea70e3b71ce8265286fb4a450feb57f36e543

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages | Name | Type | | ------------------------------------- | ----- | | @envelop/response-cache | Minor | | @envelop/response-cache-cloudflare-kv | Major |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR