I’ve tried to add a property (key-value) to my resolver (I can see it in its map). Now I am trying to enact a policy based on that property on my resolvers via a plugin. I have tried a `
:com.wsscode.pathom3.connect.runner/wrap-resolve
plugin, but in that plugin, I cannot find in env map data about the resolver to check this flag. How could I do something like thisThanks
hi @roklenarcic, here is an example on how to get the resolver config in that context:
(ns pathom3.demos.wrap-resolver-options
(:require [com.wsscode.pathom3.connect.indexes :as pci]
[com.wsscode.pathom3.connect.operation :as pco]
[com.wsscode.pathom3.interface.eql :as p.eql]
[com.wsscode.pathom3.plugin :as p.plugin]))
(pco/defresolver my-resolver []
{:my/custom-config "something"}
{:ran true})
(p.plugin/defplugin my-plugin
{:com.wsscode.pathom3.connect.runner/wrap-resolve
(fn [resolve]
(fn [env input]
(let [op-name (-> env :com.wsscode.pathom3.connect.planner/node ::pco/op-name)
resolver-config (-> env ::pci/index-resolvers op-name pco/operation-config)]
(println "RESOLVER CUSTOM CONFIG" (:my/custom-config resolver-config))
(resolve env input))))})
(def env
(-> {}
(pci/register my-resolver)
(p.plugin/register my-plugin)))
(comment
(p.eql/process env [:ran]))also started a new Cookbook section in Pathom 3 docs where I plan to include more specific examples like this: https://pathom3.wsscode.com/docs/cookbook/using-resolver-configuration-with-wrap-resolve