pathom

:pathom: https://github.com/wilkerlucio/pathom/ & https://pathom3.wsscode.com & https://roamresearch.com/#/app/wsscode
prnc 2021-04-23T14:52:01.238100Z

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?

wilkerlucio 2021-04-24T08:14:13.239400Z

yes, user identifier is a common thing that gets filled in the env for each request

wilkerlucio 2021-04-23T14:56:21.238300Z

its ok to modify the env on every request, the global things can go there 👍

wilkerlucio 2021-04-23T14:56:51.238500Z

env access is more direct, I usually put things like DB connections there for example

wilkerlucio 2021-04-23T14:57:45.238700Z

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)

prnc 2021-04-23T14:59:52.238900Z

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!