mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-15 01:52:42 +03:00
graph-push-hook: first pass at modifying incoming %add-nodes updates using the %add-nodes-transform mark
This commit is contained in:
parent
4753ba5506
commit
face904377
@ -74,10 +74,37 @@
|
||||
=. p.update now.bowl
|
||||
?- -.q.update
|
||||
%add-nodes
|
||||
?. (is-allowed-add:hc resource.q.update nodes.q.update)
|
||||
?. (is-allowed-add:hc rid nodes.q.update)
|
||||
~
|
||||
:: TODO: use marks to transform based on graph-type
|
||||
`vas
|
||||
=/ mark (get-mark:gra rid)
|
||||
?~ mark `vas
|
||||
|^
|
||||
=/ transform=$-([index:store post:store] [index:store post:store])
|
||||
!< $-([index:store post:store] [index:store post:store])
|
||||
%. !>(*indexed-post:store)
|
||||
.^(tube:clay (scry:hc %cc %home /[u.mark]/transform-add-nodes))
|
||||
=. nodes.q.update
|
||||
%- ~(gas by *(map index:store node:store))
|
||||
%- zing
|
||||
%+ turn
|
||||
~(tap by nodes.q.update)
|
||||
(transform-list transform)
|
||||
[~ !>(update)]
|
||||
::
|
||||
++ transform-list
|
||||
|= transform=$-([index:store post:store] [index:store post:store])
|
||||
|= [=index:store =node:store]
|
||||
^- (list [index:store node:store])
|
||||
=/ [ind=index:store =post:store] (transform index post.node)
|
||||
:- [ind [post [%empty ~]]]
|
||||
?: ?=(%empty -.children.node)
|
||||
~
|
||||
%- zing
|
||||
%+ turn
|
||||
(tap-deep:gra p.children.node)
|
||||
(transform-list transform)
|
||||
--
|
||||
::
|
||||
%remove-nodes
|
||||
?. (is-allowed-remove:hc resource.q.update indices.q.update)
|
||||
@ -121,7 +148,7 @@
|
||||
|= =vase
|
||||
^- [(list card) agent]
|
||||
=/ =update:store !<(update:store vase)
|
||||
?+ -.q.update [~ this]
|
||||
?+ -.q.update [~ this]
|
||||
%add-graph
|
||||
?~ mark.q.update `this
|
||||
=* mark u.mark.q.update
|
||||
@ -143,19 +170,14 @@
|
||||
|_ =bowl:gall
|
||||
+* grp ~(. group bowl)
|
||||
met ~(. mdl bowl)
|
||||
gra ~(. graph bowl)
|
||||
gra ~(. graph bowl)
|
||||
::
|
||||
++ scry
|
||||
|= [care=@t desk=@t =path]
|
||||
%+ weld
|
||||
/[care]/(scot %p our.bowl)/[desk]/(scot %da now.bowl)
|
||||
path
|
||||
::
|
||||
++ scry-mark
|
||||
|= =resource:res
|
||||
.^ (unit mark)
|
||||
(scry %gx %graph-store /graph-mark/(scot %p entity.resource)/[name.resource]/noun)
|
||||
==
|
||||
::
|
||||
++ perm-mark-name
|
||||
|= perm=@t
|
||||
^- @t
|
||||
|
@ -20,6 +20,11 @@
|
||||
?+ index.p.i ~
|
||||
[@ ~] `[%message 0 %count %.n]
|
||||
==
|
||||
::
|
||||
++ transform-add-nodes
|
||||
|= [=index =post]
|
||||
^- [^index ^post]
|
||||
[index post]
|
||||
--
|
||||
++ grab
|
||||
|%
|
||||
|
@ -30,6 +30,11 @@
|
||||
[@ @ %1 ~] `[%comment 1 %count %.n]
|
||||
[@ @ @ ~] `[%edit-comment 1 %none %.n]
|
||||
==
|
||||
::
|
||||
++ transform-add-nodes
|
||||
|= [=index =post]
|
||||
^- [^index ^post]
|
||||
[index post]
|
||||
--
|
||||
++ grab
|
||||
|%
|
||||
|
@ -30,6 +30,11 @@
|
||||
[@ %2 @ %1 ~] `[%comment 1 %count %.n]
|
||||
[@ %2 @ @ ~] `[%edit-comment 1 %none %.n]
|
||||
==
|
||||
::
|
||||
++ transform-add-nodes
|
||||
|= [=index =post]
|
||||
^- [^index ^post]
|
||||
[index post]
|
||||
--
|
||||
++ grab
|
||||
|%
|
||||
|
Loading…
Reference in New Issue
Block a user