pathom

:pathom: https://github.com/wilkerlucio/pathom/ & https://pathom3.wsscode.com & https://roamresearch.com/#/app/wsscode
2020-05-21T19:50:40.067400Z

@wilkerlucio is it possible to inject something into the parser env from pathom-viz? My eql endpoint adds some authentication data into env that my resolvers need, and I'd like to simulate that.

wilkerlucio 2020-05-21T20:06:53.067500Z

not sure if I understand, the pathom-viz should be using your parser at all the times, all the calls always goes though your parser, so you shouldn't need to simulate things, are you using the standalone app with the connector?

2020-05-21T20:09:04.067700Z

Yeah, I was thinking about the case of sending queries from the standalone app.

wilkerlucio 2020-05-21T20:09:35.067900Z

when you do that, it is still processing on your real parser

wilkerlucio 2020-05-21T20:10:04.068100Z

pathom-viz itself doens't have a parser (to be honest, it does, but its purely for UI purposes, nothing of that is related to calling your parser)

wilkerlucio 2020-05-21T20:10:20.068300Z

is this something you are experiencing or you were having thoughs about it?

2020-05-21T20:10:49.068500Z

So would you recommend doing something like conditionally adding fake authentication data into the env in a dev-only env wrap plug in?

2020-05-21T20:10:56.068700Z

I am experiencing it.

wilkerlucio 2020-05-21T20:10:59.068900Z

compared to calling the parser directly, the diff is that you can't add extra env, so all the parser configuration needs to be there already

wilkerlucio 2020-05-21T20:11:15.069100Z

yeah, you can do that, and consider that the parser can be wrapped, so you can do something like this:

wilkerlucio 2020-05-21T20:12:08.069300Z

(def tracked-parser
    (p.connector/connect-parser
      {::p.connector/parser-id ::my-parser}
      (fn [env tx]
        (parser (assoc env :extra-connector-stuff "bla") tx))))

2020-05-21T20:13:20.069500Z

Ah that's a bit simpler. Thanks!

👍 1
2020-05-21T20:21:21.069800Z

I'm currently working on replacing a somewhat crufty lacinia-based graphql server with a pathom-backed eql endpoint, and pathom has really been sparking joy. Thanks so much for all the work you've put in!

👍 2
😄 1