Fork me on GitHub

noob question: Is there a pathom ring handler and corresponding cljs client for making pathom queries anywhere? Or do people hand roll this each time; or am I misunderstanding something?


@austin021 I'm not sure if I understand, a resolver should only be called if the inputs can be satisfied, can you send an example that demonstrates what you are saying?


@rickmoynihan hello Rick, not sure what you mean, when I'm doing a server I usually roll an endpoint and put the parser to work on it, many times I juts use it in CLJS directly, so there is not need for server setup in these cases, what kind of setup are you looking into doing?


@wilkerlucio I’m more at the pondering stage right now, than actively looking at implementing anything — but was essentially thinking about having a single endpoint/route to serve EQL requests from cljs front end components


@rickmoynihan maybe this could be helpful to you to see. This is what I do. I am sending my data over in transit form (although it isn't necessary I could just send the raw query. Here is a link to it though This is in hooked into an Ion since I am running it in the cloud and my query is placed in the body of the request at the :input

(defn untransitize [query]
      (ByteArrayInputStream. (.getBytes query))

(defn eql-query
  "run eql query into pathom and return the transitized result"
  [{:keys [context input]}]
  (let [query (untransitize input)
        response (<!! (parser {} query))
        out (ByteArrayOutputStream. 4096)]
    (transit/write (transit/writer out :json) response)
    (str out)))


I've then listed the eql-query function in my ion config like so

:lambdas  {:eql-query
            {:fn          my-namespace/eql-query
             :description "run eql query into pathom and return the transitized result"}}
and now I have an endpoint I can just throw eql queries at. In my case they are using transit, but I could very easily just use the raw query. Does this help?

rickmoynihan15:02:22 thanks, that’s exactly the kind of thing I was expecting to do


Hm, how do I translate this example query in GraphQL into pathom eql query?

  countries(where: {name: {eq: "United Kingdom"}}) {
    cities {


Currently I have

::pcg/prefix    "eb"
   ::pcg/ident-map {"countries" {"where" :eb.Country/where}}
and then I tried query:
(parser {} [[:eb.Country/where {:name {:eq "United Kingdom"}}]])


I don’t think I understand this ident map correctly I guess


@roklenarcic I think you are blending edn data and eql queries without meaning to. Or perhaps blending datomic pull syntax and eql queries. That looks to me like you're putting pull syntax into an eql query


I'm imagining a resolver where the input would be a country name and the output would be :population in which case your parser and query call would look something like this:

(parser {} [{[:name "United Kingdom"][:population]}])
here you're saying in the first square brackets that you have an input of :name and you want pathom to give you a :population . This could be used with a resolver like this
(pc/defresolver population-resolver [_ {:keys [name]}]
  {::pc/input #{:name}
   ::pc/output [:population]
   {:population (get-population-function name)}})
and you'd need to write the get-population-function yourself and query your database, likely with pull syntax


Does that help?


from the query I guess @roklenarcic is trying to use pathom to connect to a hasura graphql server?


I am not mixing. But the where parameter is complex and judging by pathom docs i need to put as the ident


Sorry on phone now


Ah in that case I cannot help. Good luck!


You need to parameterize your query; it should look something like this:

[{'(:my.prefix/countries {:where {:name {:eq "United Kingdom"}}}) [{:my.prefix/cities [:my.prefix/name :my.prefix/population]}]}]


Hey y'all I've got a question regarding using transit-js to turn some js into a pathom query. I think this is more transit-based but perhaps someone can identify my issue. My issue has to do with the ' character and () characters in the query:

[{'([:num1 1] {:pathom/context {:num2 1 :num3 1}})
because I am using multiple inputs, I'm using a query like this which I've only gotten to work with that ' character and the following ( character which encompasses most of the rest of the query. On the javascript side I'm having a lot of problem turning that into transit because javascript expects different things from the parentheses characters.[
      [(transit.keyword("num1"), 1], {
        // pathom/context part should go here, but the parenthesis screws it all up
So 1) does anyone know how I can recreate that query using transit of any language implementation (preferably js of course)? Or 2) does anyone know how I can rewrite the query so that it's less convoluted and therefore easier for me to convert with transit?

myguidingstar19:02:13 you only need ' in clojure code, not edn strings


And the () characters denote a list. Use transit.list to produce one