-
Notifications
You must be signed in to change notification settings - Fork 583
Description
Is your feature request related to a problem? Please describe.
When writing our custom response cache plugin based on the @graphql-yoga/plugin-response-cache API I noticed the following frictions.
The type Cache is not exported
Instead, I had to do this
import type { UseResponseCacheParameter } from '@graphql-yoga/plugin-response-cache';
type Cache = UseResponseCacheParameter['cache'];hashSHA256 is not exposed
I wanted to write my own buildResponseCacheKey, but I only want to add an extra item to the array of the default implementation and also modify the cache key to start with a certain pattern. For the checksum, I still want to use hashSHA256() which I think is a clever implementation that is compatible with both bun and node.
Instead, I had to copy the code for hashSHA256.
The docs are wrong
Here it says to do
import { cacheControlDirective } from '@graphql-yoga/plugin-response-cache'This doesn't work, you have to do
import { cacheControlDirective } from '@envelop/response-cache';which is a transitive dependency even.
A clear and concise description of what you want to happen
The type Cache is not exported
I want to do
import type { Cache } from '@graphql-yoga/plugin-response-cache';hashSHA256 is not exposed
Ideally, I want to do:
import { hashSHA256 } from '@graphql-yoga/plugin-response-cache';But actually, it needs to be exposed from here for that to work:
import { hashSHA256 } from '@envelop/response-cache';I would rather not import from transitive dep @envelop/response-cache in userland, I prefer first option to import from @graphql-yoga/plugin-response-cache
The docs are wrong
I want to do as the docs says:
import { cacheControlDirective } from '@graphql-yoga/plugin-response-cache'