Fork me on GitHub
#pathom
<
2020-05-21
>
Chris O’Donnell19:05:40

@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.

wilkerlucio20:05:53

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?

Chris O’Donnell20:05:04

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

wilkerlucio20:05:35

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

wilkerlucio20:05:04

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)

wilkerlucio20:05:20

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

Chris O’Donnell20:05:49

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

Chris O’Donnell20:05:56

I am experiencing it.

wilkerlucio20:05:59

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

wilkerlucio20:05:15

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

wilkerlucio20:05:08

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

Chris O’Donnell20:05:20

Ah that's a bit simpler. Thanks!

👍 4
Chris O’Donnell20:05:21

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!

👍 8
😄 4