Fork me on GitHub
#pathom
<
2022-11-14
>
Tom H.08:11:10

If I put a custom field in a resolver config like so:

(pco/defresolver my-resolver [env params]
  {::permissions/require #{:project-user}}
  (...))
And then use ::pcr/wrap-resolve in a plugin like so:
(defn protect-resolver-wrapper [resolve]
  (fn [env input]
    (tap> env)
    (resolve env input)))

(p.plugin/defplugin protect-resolver-plugin
  {::pcr/wrap-resolve protect-resolver-wrapper})
Am I able to check for my custom key? I can’t seem to spot it in the env or input except in the indexes. Should I look up the resolver in the indexes using another key?

Panel12:11:10

Does anyone use pathom without fulcro ?

markaddleman12:11:06

We do. We use Pathom as an API layer for an a vue.js application.

Tom H.12:11:58

Yup! Pathom (via Pedestal) serving re-frame clients

Panel12:11:08

So you just send eql query or using something to sync the front end ?

Tom H.13:11:40

Many of our re-frame events still do a regular http request to various backend endpoints but we’re slowly moving everything to a single /pathom POST endpoint. We use Pedestal interceptors to do some authentication, insert db connections and some other things then the requests are resolved using a com.wsscode.pathom3.interface.eql/boundary-interface that’s constructed on the fly for each request. We pass the pedestal context into the pathom environment so resolvers have access to the database and authentication etc.

Tom H.13:11:10

It’s up to the re-frame event that sent the request to deal with the result in some way but we’re working on a more systematic approach

danieroux14:11:51

Fulcro-RAD with Datomic Cloud and Pathom3. ... it is such a joyful place to be.

jmayaalv15:11:16

we use pathom as an api as well, with a graphql engine on top for a part of the index

Mark Wardle19:11:04

Yes definitely. Have a re-frame front-end talking to pathom via pedestal - have functions in front-end just send the EQL and then generally, but not always, normalise into the state db. But I then moved to Fulcro and a lot of the code I needed to write was no longer needed.

Panel22:11:58

Can anyone share some public code ?

Mark Wardle14:11:51

I wouldn't do it quite like this now, but here is an example https://github.com/wardle/pc4/blob/main/pc4-ward/src/eldrix/pc4_ward/snomed/events.cljs - I have events in a number of different namespaces correlating with domains within healthcare - so this one is SNOMED CT - you can see I simply define EQL at the top level and then pass those data down my react tree. Fulcro takes a different approach, which has been easier in many respects. If I were doing this again, I'd normalise my results using something like 'pyramid' perhaps.

Mark Wardle14:11:32

Arguably, for simple demos, re-frame and bespoke EQL is easier, but I would have needed to re-architect if I wanted to move to anything less trivial, and likely reimplement the stuff one gets in Fulcro for free.

dvingo18:11:33

I have been frustrated with using fulcro for UI rendering, but it does have great features for mutations and networking, speaking to pathom. https://github.com/matterandvoid-space/todomvc-fulcro-subscriptions I put this demo app together showing how you can use subscriptions (from re-frame) and helix to render your UI while using fulcro to talk to pathom and manage your app-db, and managing form state. It does require some fulcro knowledge, but only the data manipulation part. In my experience the complexity of fulcro is on the UI side (defsc, composing queries, the router). Getting rid of the UI part has made developing with fulcro a lot easier for me. I'm not sure what your motivation for not wanting to use fulcro is but maybe this can inspire some ideas.