This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-28
Channels
- # announcements (14)
- # autochrome-github (1)
- # babashka (4)
- # beginners (151)
- # biff (1)
- # calva (24)
- # cider (13)
- # clara (13)
- # clj-commons (1)
- # cljs-dev (24)
- # clojure (50)
- # clojure-europe (20)
- # clojure-france (13)
- # clojure-nl (4)
- # clojure-norway (12)
- # clojure-spec (43)
- # clojure-uk (6)
- # clojurescript (30)
- # cursive (2)
- # datahike (9)
- # editors (6)
- # emacs (2)
- # fulcro (29)
- # google-cloud (20)
- # graphql (2)
- # humbleui (2)
- # jobs (2)
- # juxt (4)
- # kaocha (5)
- # lsp (14)
- # malli (5)
- # membrane (10)
- # off-topic (39)
- # pathom (21)
- # polylith (10)
- # rdf (8)
- # reagent (4)
- # remote-jobs (3)
- # reveal (18)
- # shadow-cljs (27)
- # spacemacs (7)
- # tools-deps (30)
Hi! Can someone riddle me this, please? Why can I get to name in the last query but not in the first one? Thanks!
(require '[com.wsscode.pathom3.connect.built-in.resolvers :as pbir])
(require '[com.wsscode.pathom3.connect.indexes :as pci])
(require '[com.wsscode.pathom3.connect.operation :as pco])
(require '[com.wsscode.pathom3.interface.eql :as p.eql])
(def mock-accounts [#:gnucash.account{:id "e8bb8cdcdd964239bc0255c447f5174d",
:name "Root Account"}])
(def mock-transactions [#:gnucash.transaction{:id "75d3cf61239f425c9d1d5da30ef56476",
:description "Starting balance",
:splits [#:gnucash.split{:id "c5b722950d5947508d1acb41526ee278",
:quantity "203995/100",
:account "e8bb8cdcdd964239bc0255c447f5174d"}
#:gnucash.split{:id "b677a56fa6574df5bab5963d362ce0b6",
:quantity "-203995/100",
:account "e8bb8cdcdd964239bc0255c447f5174d"}]}])
(pco/defresolver gnucash-accounts []
{:gnucash/accounts mock-accounts})
(pco/defresolver gnucash-account [{:gnucash.account/keys [id]}]
{::pco/output [:gnucash.account/id
:gnucash.account/name]}
(->> mock-accounts
(filter (comp #{id} :gnucash.account/id))
(first)))
(pco/defresolver gnucash-transactions []
{::pco/output [{:gnucash/transactions [:gnucash.transaction/id
:gnucash.transaction/description
{:gnucash.transaction/splits
[:gnucash.split/id
:gnucash.split/quantity
:gnucash.split/account]}]}]}
{:gnucash/transactions mock-transactions})
(pco/defresolver gnucash-transaction [{:gnucash.transaction/keys [id]}]
{::pco/output [:gnucash.transaction/id
:gnucash.transaction/description
:gnucash.transaction/splits]}
(->> mock-transactions
(filter (comp #{id} :gnucash.transaction/id))
(first)))
(pco/defresolver gnucash-transaction-splits [{:gnucash.transaction/keys [id]}]
{::pco/input [:gnucash.transaction/id]
::pco/output [:gnucash.split/id
:gnucash.split/quantity
:gnucash.split/account]}
(->> mock-transactions
(filter (comp #{id} :gnucash.transaction/id))
(first)))
(def env
(pci/register
[gnucash-accounts
gnucash-transactions
gnucash-account
gnucash-transaction
gnucash-transaction-splits
(pbir/alias-resolver :gnucash.account/parent :gnucash.account/id)
(pbir/alias-resolver :gnucash.split/account :gnucash.account/id)]))
(p.eql/process env
{:gnucash.transaction/id "75d3cf61239f425c9d1d5da30ef56476"}
[:gnucash.transaction/description
{:gnucash.transaction/splits [:gnucash.split/id
:gnucash.split/quantity
{:gnucash.split/account [:gnucash.account/name]}]}])
;; =>
;; #:gnucash.transaction{:description "Starting balance",
;; :splits [#:gnucash.split{:id "c5b722950d5947508d1acb41526ee278",
;; :quantity "203995/100",
;; :account "e8bb8cdcdd964239bc0255c447f5174d"} ;; <----- NO NAME!
;; #:gnucash.split{:id "b677a56fa6574df5bab5963d362ce0b6",
;; :quantity "-203995/100",
;; :account "e8bb8cdcdd964239bc0255c447f5174d"}]} ;; <----- NO NAME!
(p.eql/process env
{:gnucash.split/account "e8bb8cdcdd964239bc0255c447f5174d"}
[:gnucash.account/name])
;; =>
;; #:gnucash.account{:name "Root Account"} ;; <----- HAS NAME!
try this query
(p.eql/process env
{:gnucash.transaction/id "75d3cf61239f425c9d1d5da30ef56476"}
[:gnucash.transaction/description
{:gnucash.transaction/splits [:gnucash.split/id
:gnucash.split/quantity
:gnucash.split/account
:gnucash.account/name]}])
if you remove your alias resolver you can see it won't work at all, because :gnucash.split/account
needs to have as its value a map, not a string, for pathom to understand it as joinable
so :gnucash.split/account {:gnucash.account/id "e8bb8cdcdd964239bc0255c447f5174d"}
instead of just the string ID
Yeah! I use it for my personal accounting. But I'm trying to get some bayesian transaction categorising going, so I need to scan the gnucash database to compile word frequencies. I thought Pathom could be useful for denormalising it
with the new way errors are done, it seems a call to p.eql/process
that used to be an exception (`All paths from an OR node failed`) now tries to print/serialize the whole env
, which in my case is so big it causes the JVM to crash. not sure where the env is being added but is there a way to hide it from the error result?
I have to second the request for the ability to hide the full env from the error info. Either that or it's been a reason to force me to be more conscious of what my tooling does with massive error data.
hello folks, I cna surely consider some of those changes, but before I wonder if you guys considered using the boundary interface
in this case?
because the boundary interface will convert the errors in something less dreading ot send over the wire (that doesn't include full env)
the reasoning for the full env in the process error is to allow underlying usages to have full context about the problem
sorry, I said the wrong name, its boundary interface, docs here: https://pathom3.wsscode.com/docs/eql/#boundary-interface
@U797MAJ8M and to answer you directly, env is getting add as part of the exception data on strict errors