Fork me on GitHub
Björn Ebbinghaus11:03:27
is depending on fulcro 2 Is there a way to use pathom on the client with fulcro 3?


@mroerni yes, but you have to implement, its quite simple, here is an example:

(ns pathom-remote-fulcro3
  (:require [com.fulcrologic.fulcro.algorithms.tx-processing :as txn]
            [com.wsscode.async.async-cljs :refer [go-promise <?maybe]]
            [edn-query-language.core :as eql]))

(defn pathom-remote [parser]
   (fn transmit! [_ {::txn/keys [ast result-handler]}]
     (let [edn           (eql/ast->query ast)
           ok-handler    (fn [result]
                             (result-handler (assoc result :status-code 200))
                             (catch :default e
                               (js/console.error e "Result handler for remote failed with an exception."))))
           error-handler (fn [error-result]
                             (result-handler (merge error-result {:status-code 500}))
                             (catch :default e
                               (js/console.error e "Error handler for remote failed with an exception."))))]
           (ok-handler {:body (<?maybe (parser {} edn))})
           (catch :default e
             (js/console.error "Pathom Remote error:" e)
             (error-handler {:body e}))))))})

❤️ 4

@wilkerlucio a dynamic resolver is one that doesn't have fixed input and output. What does ::pc/provides of such resolver look like? What about oir and io indexes for dynamic resolvers?


there is no output or provides on dynamic resolvers (in the new model) in the past there was a ::pc/compute-output, but that's not used in the new reader. what matters is how you build the index to point to this resolvers, Pathom will try to accumulate all the calls for that and run a single one


there is some things to figure still, if you look at how pathom is dealing with foreign parsers, its another example of how dynamic resolvers work


another question: why the code here throw exception if ::pc/output is not specified? (Though the pathom-datomic resolver still doesn't have ::pc/output!!!)


what exactly throws that? is this some spec validation? it should not require it


{:a/x :com.wsscode.pathom.core/reader-error, :com.wsscode.pathom.core/errors {[:a/x] "class clojure.lang.ExceptionInfo: No output available - #:com.wsscode.pathom.connect{:sym dev/my-resolver}"}}


the result if I comment out the line ::pc/output []


Hey, where can I find any information how to build Pathom API on top of Ring?


(just like with Fulcro, but I'd like to try using it without it)


@slawek098 the parser is just a function, in any case the work is about reading the EQL query somehow (usually on the POST body), pass that to the parser and encode the response


Yes, I started to wrap it on my own.


Seems like it's working.


Should be at least. Now I need to ask some transit queries from frontend.


I'm trying to better understand how to use Walkable. Do I still need to explicitly define resolvers which wrap parser calls, or is Walkable abstracting that away?