mirror of
https://github.com/urbit/shrub.git
synced 2024-12-04 04:35:02 +03:00
58 lines
1.6 KiB
Plaintext
58 lines
1.6 KiB
Plaintext
|
/- spider, graph-view, graph=graph-store, *metadata-store, *group, group-store
|
||
|
/+ strandio, resource
|
||
|
=>
|
||
|
|%
|
||
|
++ strand strand:spider
|
||
|
++ poke poke:strandio
|
||
|
++ poke-our poke-our:strandio
|
||
|
++ handle-group
|
||
|
|= [rid=resource associated=(each resource policy)]
|
||
|
=/ m (strand ,resource)
|
||
|
?: ?=(%& -.associated)
|
||
|
(pure:m p.associated)
|
||
|
=/ =action:group-store
|
||
|
[%add-group rid p.associated %&]
|
||
|
;< ~ bind:m (poke-our %group-store %group-action !>(action))
|
||
|
;< ~ bind:m
|
||
|
(poke-our %group-push-hook %push-hook-action !>([%add rid]))
|
||
|
(pure:m rid)
|
||
|
|
||
|
--
|
||
|
=, strand=strand:spider
|
||
|
^- thread:spider
|
||
|
|= arg=vase
|
||
|
=/ m (strand ,vase)
|
||
|
^- form:m
|
||
|
=+ !<([=action:graph-view ~] arg)
|
||
|
?> ?=(%create -.action)
|
||
|
;< =bowl:spider bind:m get-bowl:strandio
|
||
|
:: Add graph to graph-store
|
||
|
::
|
||
|
=/ =update:graph
|
||
|
[%0 now.bowl %add-graph rid.action *graph:graph mark.action]
|
||
|
;< ~ bind:m (poke-our %graph-store %graph-update !>(update))
|
||
|
::;< ~ bind:m
|
||
|
:: (poke-our %graph-push-hook %push-hook-action !>([%add rid.action]))
|
||
|
:: Add group, if graph is unmanaged
|
||
|
::
|
||
|
;< group=resource bind:m
|
||
|
(handle-group rid.action associated.action)
|
||
|
=/ group-path=path
|
||
|
(en-path:resource group)
|
||
|
:: Setup metadata
|
||
|
::
|
||
|
=/ =metadata
|
||
|
%* . *metadata
|
||
|
title title.action
|
||
|
description description.action
|
||
|
date-created now.bowl
|
||
|
creator our.bowl
|
||
|
==
|
||
|
=/ act=metadata-action
|
||
|
[%add group-path [%graph (en-path:resource rid.action)] metadata]
|
||
|
;< ~ bind:m (poke-our %metadata-hook %metadata-action !>(act))
|
||
|
;< ~ bind:m
|
||
|
(poke-our %metadata-hook %metadata-hook-action !>([%add-owned group-path]))
|
||
|
(pure:m !>(~))
|
||
|
|