pathom

:pathom: https://github.com/wilkerlucio/pathom/ & https://pathom3.wsscode.com & https://roamresearch.com/#/app/wsscode
2021-04-15T12:27:59.168700Z

I did use Pathom while experimenting on the Vrac library.

cjsauer 2021-04-15T21:13:52.171300Z

Is it necessary to specify ::pc/output of a resolver? I’ve noticed that if I don’t query for any keys that exist in the ::pc/output vector, then my resolver stops working (all keys are :not-found).

cjsauer 2021-04-15T21:18:54.174300Z

But if I query for even one key that matches what’s in ::pc/output, now it’s able to find keys that weren’t declared ahead of time.

wilkerlucio 2021-04-15T22:15:19.174400Z

yes, that’s required, there are a few cases in which Pathom can infer the output, but only very simple cases, for the most part you need to define the output

wilkerlucio 2021-04-15T22:15:41.174600Z

this happens because pathom just merges the result, and them you kind get it by accident

wilkerlucio 2021-04-15T22:16:14.174800Z

think that pathom uses ::pc/output to generate the attribute index, if you try to lookup for something and its not there, pathom will make it not-found

wilkerlucio 2021-04-15T22:17:03.175Z

this is how you can get the “work by accident” case:

(pc/defresolver x []
  {::pco/output [:a]}
  {:a 1 :b 2})

(parser [:a :b])

wilkerlucio 2021-04-15T22:17:38.175200Z

the :a attribute made pathom call x, which had the full result merged (`{:a 1 :b 2}`), now, when looking for :b it sees its already on the entity data, so it works

wilkerlucio 2021-04-15T22:17:45.175400Z

but if you remove :a from this query (as : (parser {} [:b])), it wont, because :b isn’t indexed

cjsauer 2021-04-15T22:54:19.175800Z

Ah right. It took me too long to realize, but without the output you wouldn’t know which resolver to actually call…