Fork me on GitHub

[com.wsscode.pathom "2.2.15" is out! Changes: * Fix pc/data->shape breaking when data has complex keys * Fix alias on p/join-seq-parallel optimized runs (

🎉 8

also updated docs for placeholders: thanks to @tony.kay for pointing the missing full examples


Any obvious places to look if the index-explorer isn't working? When I try to connect I get an error like this java.lang.RuntimeException: java.lang.Exception: Not supported: class <one of my resolvers>


@uwo the issue that happens here is because its likely trying to encode things in transit that it doesn't know about, my suggestion is to use transit default handlers so it encode it anyway (even if it can't properly read on the other side, doesn't matter, those keys are not going to be read anyway)

🙏 4

I really need to add this to the docs there


specially because there is a bug in transit where the default write handlers don't work, so there is some code needed to make that work


(deftype DefaultHandler []
  (tag [this v] "unknown")
  (rep [this v] (pr-str v)))

(defn writer
  "Creates a writer over the provided destination `out` using
   the specified format, one of: :msgpack, :json or :json-verbose.
   An optional opts map may be passed. Supported options are:
   :handlers - a map of types to WriteHandler instances, they are merged
   with the default-handlers and then with the default handlers
   provided by transit-java.
   :transform - a function of one argument that will transform values before
   they are written."
  ([out type] (writer out type {}))
  ([^OutputStream out type {:keys [handlers transform default-handler]}]
   (if (#{:json :json-verbose :msgpack} type)
     (let [handler-map (merge transit/default-write-handlers handlers)]
         (TransitFactory/writer (#'transit/transit-format type) out handler-map default-handler
           (when transform
             (reify Function
               (apply [_ x]
                 (transform x)))))))
     (throw (ex-info "Type must be :json, :json-verbose or :msgpack" {:type type})))))

🙏 4

then you can write with


(defn write-transit [x]
  (let [baos (ByteArrayOutputStream.)
        w    (writer baos :json {:handlers transit-write-handlers
                                 :default-handler (DefaultHandler.)})
        _    (transit/write w x)
        ret  (.toString baos)]
    (.reset baos)

🙏 4

ok people, new section in the docs, how to fix transit encoding issues:

🙏 12

Thank you!!


Has anyone here attempted to integrate vim omni-completion, ctrl-x-o, with pathom-index enabled autocompletion?


@uwo not that I know, but if you have a running repl with pathom and the index, and you can communicate with that, the impl can be quite easy


ctx is a vector with a path, examples: [:customer/id], [:my-app/all-users :user/groups]


cache is optional, but can do great on improving performance, just send an atom with a map (and hold this atom, keep sending the same one)