What is the best way to allow resolvers to access user provided global data? Something like e.g. pbir/constantly-resolver
or global-data-resolver
(if understand correctly), but user provided. E.g.
(p.eql/process (pci/register [top-level-resolver])
{:user-data "Hello"}
[{:top-level [:user-data]}])
So it’s available to all resolvers regardless of level. Examples I’ve come across are all through modifying the env which I guess I don’t want to do on every request, right? Does that make sense?yes, user identifier is a common thing that gets filled in the env for each request
its ok to modify the env on every request, the global things can go there 👍
env access is more direct, I usually put things like DB connections there for example
you can also make a resolver, which makes it extensible, but also more expensive and less predictable (compared to env which is always a simple key read)
Nice! That’s one of my use cases, but that can be considered static. The other thing I had in mind was some user identifier that can be used in many places in the graph but may be ofc different for each request and is provided through the initial data. So I guess I will just add that to env instead, thanks!