shrub/pkg/arvo/lib/hark/graph-hook.hoon

67 lines
1.2 KiB
Plaintext
Raw Normal View History

/- sur=hark-graph-hook, post
2020-10-27 08:04:39 +03:00
/+ graph-store, resource
^?
=< [. sur]
=, sur
|%
++ dejs
=, dejs:format
|%
::
++ index
^- $-(json index:graph-store)
(su ;~(pfix net (more net dem)))
::
++ graph-index
2020-10-27 08:04:39 +03:00
%- ot
:~ graph+dejs-path:resource
index+index
2020-10-27 08:04:39 +03:00
==
::
++ action
%- of
:~ listen+graph-index
ignore+graph-index
2020-10-27 08:04:39 +03:00
set-mentions+bo
set-watch-on-self+bo
==
--
2020-11-10 06:32:48 +03:00
::
2020-10-27 08:04:39 +03:00
++ enjs
=, enjs:format
|%
::
++ graph-index
|= [graph=resource =index:post]
2020-10-27 08:04:39 +03:00
%- pairs
:~ graph+s+(enjs-path:resource graph)
index+(index:enjs:graph-store index)
2020-10-27 08:04:39 +03:00
==
::
++ action
|= act=^action
^- json
%+ frond -.act
?- -.act
2020-10-27 08:04:39 +03:00
%set-watch-on-self b+watch-on-self.act
%set-mentions b+mentions.act
?(%listen %ignore) (graph-index graph.act index.act)
2020-10-27 08:04:39 +03:00
==
::
::
::
2020-10-27 08:04:39 +03:00
++ update
|= upd=^update
^- json
?. ?=(%initial -.upd)
(action upd)
%+ frond -.upd
%- pairs
:~ 'watchOnSelf'^b+watch-on-self.upd
'mentions'^b+mentions.upd
:+ %watching %a
(turn ~(tap in watching.upd) graph-index)
2020-10-27 08:04:39 +03:00
==
--
--