Fork me on GitHub
#pathom
<
2020-01-16
>
cjmurphy06:01:02

Anyone seen this error message before? How best to get some better context for where it came from (without altering the source):

Execution error (IllegalArgumentException) at com.wsscode.pathom.connect/split-good-bad-keys$fn (connect.cljc:643). => Don't know how to create ISeq from: clojure.lang.Keyword

cjmurphy06:01:45

It turned out that I wasn't returning the correct format from a resolver. I was (for reasons unknown!) returning a vector of vectors rather than a vector of maps at a particular join.

fjolne15:01:44

@U0D5RN0S1 @U066U8JQJ it looks like the latest Pathom release (one of, at least) became more strict on what is allowed to be returned. I did return true in a few mutations and it stopped working. Not a big deal ofc, jfy

🙏 4
thosmos10:01:15

I’m looking into moving an existing javascript UI to query a pathom/eql/transit api instead of graphql. Has anyone done this with transit-js? … Well, that was easy enough … I got the basic idea to work for reading the result, something like:

var t = require("transit-js")
var r = t.reader("json" , {
// , {
//   "handlers": {
//     "key": function(rep) { return rep.toString() }
//   }
   mapBuilder: {
    init: function(node) { return {} },
    add: function(ret, key, val, node) { 
    let k = key;
    let v = val;
    
    if( t.isKeyword(key) )
        k = key.toString();

    if( t.isKeyword(val) )
        v = val.toString();
    ret[k] = v;
    return ret },
    finalize: function(ret, node) { return ret }
  }
}
);

var res = r.read('["^ ","~:org.riverdb.db.agencylookup",[["^ ","~:db/id","17592186158592","~:agencylookup/AgencyCode","AMS"]]]');

=> 

{":org.riverdb.db.agencylookup": [{":agencylookup/AgencyCode": "AMS", ":db/id": "17592186158592"}]}

cjmurphy23:01:25

I'm still trying to understand when transitive dependencies are picked up. For example I'm supplying :organisation/id as an input to a resolver. With that attribute alone a lot of other attributes are determined. For example given an organisation you get a time-info which has a current-period. So should I be able to rely on Pathom to work out :time-info/current-period by itself? If so the query could supply the :organisation/id input, but :time-info/current-period would just be stated as a 'co-input' to the resolver, and Pathom would find the current period of the organisation and put it in. What I'm seeing is that as soon as I put :time-info/current-period in as an input the resolver is not called.