Fork me on GitHub
#pathom
<
2021-07-06
>
Björn Ebbinghaus12:07:35

I wrote a plugin, that checks before each resolver whether each entry in the input of said resolver is allowed. If yes, continue to resolve. If no, do necessary checks and if access is allowed, cache the input entry. Now I would like to hear feedback from people more experienced than me, if I have done something stupid or if I could do something better. https://gist.github.com/MrEbbinghaus/eb14937a0b0909530cbfa85c26c79139 Thanks. 🙂

🎉 2
MatthewLisp16:07:10

Hello Pathom users, I'm a bit new to EQL, and I'm wondering if it's possible to provide some specific data through eql for pathom This example using placeholders is from Pathom3 website

(pco/defresolver full-name [{::keys [first-name last-name]}]
 {::full-name (str first-name " " last-name)})
 
(def env (pci/register full-name))
 
(p.eql/process env
 [{'(:>/bret {::first-name "Bret" ::last-name "Victor"})
 [::full-name]}])
; => {:>/bret {:com.wsscode.pathom3.docs.placeholder/full-name "Bret Victor"}}
What i want to know is, can i say via EQL that the ::first-name or ::last-name, is actually an attribute that pathom should look for:
(p.eql/process env
 [{'(:>/bret {::first-name ::first-name/bret ::last-name ::last-name/bret})
 [::full-name]}])
In this case, i want to say that ::first-name/bret and ::last-name/bret are attributes that some other resolvers produces

Björn Ebbinghaus18:07:57

I am honestly not really sure what you are asking... You can provide constant data, if that's what you are after?

(pco/defresolver produce-bret []
  {::first-name "Bret"
   ::last-name "Victor"})

(pco/defresolver full-name [{::keys [first-name last-name]}]
 {::full-name (str first-name " " last-name)})

(p.eql/process env
  [::full-name])

=> {::full-name "Bret Victor"}

(p.eql/process env
  [{:>/bret [::full-name]}])

=> {:>/bret {::full-name "Bret Victor"}}