-
-
Save souenzzo/ff7bda87108cb51adc5f7db4aa367b6e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(p.eql/process (-> (p.plugin/register | |
{::p.plugin/id `as-plugin | |
:com.wsscode.pathom3.format.eql/wrap-map-select-entry | |
(fn [original] | |
(fn [env out {:keys [params dispatch-key] | |
:as ast}] | |
(if-let [as (:as params)] | |
(original env | |
(into (empty out) (map (fn [[k v]] | |
[({dispatch-key as} k k) v])) | |
out) | |
(assoc ast :key as :dispatch-key as)) | |
(original env out ast))))}) | |
(pci/register (pco/resolver `a | |
{::pco/output [:a] | |
::pco/params [:v] | |
::pco/resolve (fn [env input] | |
{:a (:v (pco/params env))})})) | |
(assoc ::pcr/resolver-cache* nil)) | |
`[(:a {:v 1 | |
:as :a1}) | |
(:a {:v 2 | |
:as :a2})]) | |
=> {:a1 1 | |
:a2 1} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment