metadata: modernize namespacing

This commit is contained in:
Liam Fitzgerald 2021-01-28 16:13:57 +10:00
parent f2fd69df90
commit a1c30ef230
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB
11 changed files with 182 additions and 212 deletions

View File

@ -6,8 +6,7 @@
/-
inv=invite-store,
*contact-hook,
*metadata-store,
*metadata-hook,
metadata=metadata-store,
pull-hook,
push-hook
/+ *server, *contact-json, default-agent, dbug, verb,
@ -297,31 +296,21 @@
[%pass / %agent [our.bol %group-pull-hook] %poke %pull-hook-action !>(act)]
::
++ metadata-poke
|= act=metadata-action
|= =action:metadata
^- card
[%pass / %agent [our.bol %metadata-store] %poke metadata-action+!>(act)]
::
++ metadata-hook-poke
|= act=metadata-hook-action
^- card
[%pass / %agent [our.bol %metadata-hook] %poke %metadata-hook-action !>(act)]
::
++ sync-metadata
|= [=ship =path]
^- card
(metadata-hook-poke %add-synced ship path)
[%pass / %agent [our.bol %metadata-store] %poke metadata-action+!>(action)]
::
++ create-metadata
|= [rid=resource title=@t description=@t]
^- (list card)
=/ =metadata
%* . *metadata
=/ =metadatum:metadata
%* . *metadatum:metadata
title title
description description
date-created now.bol
creator our.bol
==
:~ (metadata-poke [%add rid [%contacts rid] metadata])
:~ (metadata-poke [%add rid [%contacts rid] metadatum])
(push-metadata rid)
==
::

View File

@ -1,7 +1,7 @@
:: hark-graph-hook: notifications for graph-store [landscape]
::
/- post, group-store, metadata-store, hook=hark-graph-hook, store=hark-store
/+ resource, metadata, default-agent, dbug, graph-store, graph, grouplib=group, store=hark-store
/- post, group-store, metadata=metadata-store, hook=hark-graph-hook, store=hark-store
/+ resource, mdl=metadata, default-agent, dbug, graph-store, graph, grouplib=group, store=hark-store
::
::
~% %hark-graph-hook-top ..part ~
@ -53,7 +53,7 @@
+* this .
ha ~(. +> bowl)
def ~(. (default-agent this %|) bowl)
met ~(. metadata bowl)
met ~(. mdl bowl)
grp ~(. grouplib bowl)
gra ~(. graph bowl)
::
@ -276,10 +276,10 @@
?~ group
~& no-group+rid
`state
=/ metadata=(unit metadata:metadata-store)
(peek-metadata:met %graph rid)
?~ metadata `state
abet:check:(abed:handle-update:ha rid nodes u.group module.u.metadata)
=/ metadatum=(unit metadatum:metadata)
(peek-metadatum:met %graph rid)
?~ metadatum `state
abet:check:(abed:handle-update:ha rid nodes u.group module.u.metadatum)
--
::
++ on-peek on-peek:def
@ -300,7 +300,7 @@
--
::
|_ =bowl:gall
+* met ~(. metadata bowl)
+* met ~(. mdl bowl)
grp ~(. grouplib bowl)
gra ~(. graph bowl)
::

View File

@ -1,7 +1,7 @@
:: hark-group-hook: notifications for groups [landscape]
::
/- store=hark-store, post, group-store, metadata-store, hook=hark-group-hook
/+ resource, metadata, default-agent, dbug, graph-store
/- store=hark-store, post, group-store, metadata=metadata-store, hook=hark-group-hook
/+ resource, mdl=metadata, default-agent, dbug, graph-store
::
~% %hark-group-hook-top ..part ~
|%
@ -28,7 +28,7 @@
+* this .
ha ~(. +> bowl)
def ~(. (default-agent this %|) bowl)
met ~(. metadata bowl)
met ~(. mdl bowl)
::
++ on-init
:_ this
@ -115,7 +115,7 @@
::
%metadata-update
=^ cards state
(metadata-update !<(metadata-update:metadata-store q.cage.sign))
(metadata-update !<(update:metadata q.cage.sign))
[cards this]
==
==
@ -140,7 +140,7 @@
:: - We have no way of retrieving old metadata to e.g. get a
:: channel's old name when it is renamed
++ metadata-update
|= update=metadata-update:metadata-store
|= =update:metadata
^- (quip card _state)
[~ state]
::

View File

@ -2,7 +2,7 @@
::
:: allow syncing group data from foreign paths to local paths
::
/- *group, invite-store, *metadata-store
/- *group, invite-store, metadata=metadata-store
/+ default-agent, verb, dbug, store=group-store, grpl=group, pull-hook
/+ resource, mdl=metadata
~% %group-hook-top ..part ~
@ -12,12 +12,12 @@
++ config
^- config:pull-hook
:* %metadata-store
metadata-update
update:metadata
%metadata-update
%metadata-push-hook
==
+$ state-zero
[%0 previews=(map resource group-preview)]
[%0 previews=(map resource group-preview:metadata)]
::
--
::
@ -81,12 +81,12 @@
|= [=mark =vase]
?. ?=(%metadata-hook-update mark)
(on-poke:def mark vase)
=+ !<(upd=metadata-hook-update vase)
?. ?=(%preview -.upd)
=+ !<(=hook-update:metadata vase)
?. ?=(%preview -.hook-update)
(on-poke:def mark vase)
:_ this(previews (~(put by previews) group.upd +.upd))
:_ this(previews (~(put by previews) group.hook-update +.hook-update))
=/ paths=(list path)
~[preview+(en-path:resource group.upd)]
~[preview+(en-path:resource group.hook-update)]
:~ [%give %fact paths mark^vase]
[%give %kick paths ~]
==
@ -115,7 +115,7 @@
(on-watch:def path)
=/ rid=resource
(de-path:resource t.path)
=/ prev=(unit group-preview)
=/ prev=(unit group-preview:metadata)
(~(get by previews) rid)
:_ this
?~ prev
@ -130,14 +130,14 @@
++ on-pull-nack
|= [=resource =tang]
^- (quip card _this)
=/ =associations
=/ =associations:metadata
(metadata-for-group:met resource)
:_ this
%+ turn ~(tap by associations)
|= [=md-resource =association]
|= [=md-resource:metadata =association:metadata]
=- [%pass / %agent [our.bowl %metadata-store] %poke -]
:- %metadata-update
!> ^- metadata-update
!> ^- update:metadata
[%remove resource md-resource]
::
++ on-pull-kick

View File

@ -1,6 +1,6 @@
:: metadata-push-hook [landscape]:
::
/- *group, *invite-store, *metadata-store
/- *group, *invite-store, store=metadata-store
/+ default-agent, verb, dbug, grpl=group, push-hook,
resource, mdl=metadata, gral=graph
~% %group-hook-top ..part ~
@ -11,7 +11,7 @@
^- config:push-hook
:* %metadata-store
/all
metadata-update
update:store
%metadata-update
%metadata-pull-hook
==
@ -39,28 +39,28 @@
|= [=mark =vase]
?. ?=(%metadata-hook-update mark)
(on-poke:def mark vase)
=+ !<(upd=metadata-hook-update vase)
?. ?=(%req-preview -.upd)
=+ !<(=hook-update:store vase)
?. ?=(%req-preview -.hook-update)
(on-poke:def mark vase)
=* rid group.upd
=* rid group.hook-update
|^
?> =(entity.rid our.bowl)
?> (can-join:grp rid src.bowl)
=/ members
~(wyt in (members:grp rid))
=/ =metadata
(need (peek-metadata:met %contacts rid))
=/ =metadatum:store
(need (peek-metadatum:met %contacts rid))
:_ this
=; =cage
[%pass / %agent [src.bowl %metadata-pull-hook] %poke cage]~
:- %metadata-hook-update
!> ^- metadata-hook-update
[%preview rid channels members channel-count metadata]
!> ^- hook-update:store
[%preview rid channels members channel-count metadatum]
::
++ channels
%- ~(gas by *associations)
%- ~(gas by *associations:store)
%+ skim ~(tap by (app-metadata-for-group:met rid %graph))
|=([=md-resource group=resource =metadata] preview.metadata)
|=([=md-resource:store group=resource =metadatum:store] preview.metadatum)
::
++ channel-count
~(wyt by (app-metadata-for-group:met rid %graph))
@ -75,11 +75,11 @@
::
++ should-proxy-update
|= =vase
=+ !<(upd=metadata-update vase)
?. ?=(?(%add %remove %update) -.upd)
=+ !<(=update:store vase)
?. ?=(?(%add %remove %update) -.update)
%.n
=/ role=(unit (unit role-tag))
(role-for-ship:grp group.upd src.bowl)
(role-for-ship:grp group.update src.bowl)
?~ role %.n
?~ u.role %.n
?=(?(%admin %moderator) u.u.role)
@ -94,11 +94,11 @@
^- vase
=/ group
(scry-group:grp rid)
=/ =associations
=/ =associations:store
(metadata-for-group:met rid)
?> ?=(^ group)
?> (~(has in members.u.group) src.bowl)
!> ^- metadata-update
!> ^- update:store
[%initial-group rid associations]
::
--

View File

@ -3,11 +3,11 @@
:: data store for application metadata and mappings
:: between groups and resources within applications
::
:: group-paths are expected to be an existing group path
:: paths are expected to be an existing group path
:: resources are expected to correspond to existing app paths
::
:: note: when scrying for metadata, to make the arguments safe in paths,
:: encode group-path and app-path using (scot %t (spat group-path))
:: encode path and path using (scot %t (spat path))
::
:: +watch paths:
:: /all associations + updates
@ -19,22 +19,22 @@
:: /group-indices all group indices
:: /app-indices all app indices
:: /resource-indices all resource indices
:: /metadata/%group-path/%app-name/%app-path specific metadatum
:: /metadata/%path/%app-name/%path specific metadatum
:: /app-name/%app-name associations for app
:: /group/%group-path associations for group
:: /group/%path associations for group
::
/- *metadata-store, *metadata-hook
/- store=metadata-store
/+ *metadata-json, default-agent, verb, dbug, resource, *migrate
|%
+$ card card:agent:gall
+$ base-state-0
$: associations=associations-0
group-indices=(jug group-path md-resource)
app-indices=(jug app-name [group-path app-path])
resource-indices=(jug md-resource group-path)
group-indices=(jug path md-resource:store)
app-indices=(jug app-name:store [path path])
resource-indices=(jug md-resource:store path)
==
::
+$ associations-0 (map [group-path md-resource] metadata-0)
+$ associations-0 (map [path md-resource:store] metadata-0)
::
+$ metadata-0
$: title=@t
@ -53,25 +53,25 @@
module=term
==
::
+$ md-resource-1 [=app-name =app-path]
+$ md-resource-1 [=app-name:store =path]
::
+$ associations-1 (map [group-path md-resource-1] metadata-1)
+$ associations-1 (map [path md-resource-1] metadata-1)
::
+$ base-state-1
$: associations=associations-1
group-indices=(jug group-path md-resource-1)
app-indices=(jug app-name [group-path app-path])
resource-indices=(jug md-resource-1 group-path)
group-indices=(jug path md-resource-1)
app-indices=(jug app-name:store [path path])
resource-indices=(jug md-resource-1 path)
==
::
+$ cached-indices
$: group-indices=(jug resource md-resource)
app-indices=(jug app-name [group=resource =resource])
resource-indices=(map md-resource resource)
$: group-indices=(jug resource md-resource:store)
app-indices=(jug app-name:store [group=resource =resource])
resource-indices=(map md-resource:store resource)
==
::
+$ base-state-2
$: =associations
$: =associations:store
~
==
::
@ -127,7 +127,7 @@
=^ cards state
?+ mark (on-poke:def mark vase)
?(%metadata-action %metadata-update)
(poke-metadata-update:mc !<(metadata-update vase))
(poke-metadata-update:mc !<(update:store vase))
::
%import
(poke-import:mc q.vase)
@ -150,7 +150,7 @@
~
::
[%app-name @ ~]
=/ =app-name i.t.path
=/ =app-name:store i.t.path
=/ app-indices (metadata-for-app:mc app-name)
(give %metadata-update !>([%associations app-indices]))
==
@ -171,7 +171,7 @@
[%y %resource-indices ~] ``noun+!>(resource-indices)
[%x %associations ~] ``noun+!>(associations)
[%x %app-name @ ~]
=/ =app-name i.t.t.path
=/ =app-name:store i.t.t.path
``noun+!>((metadata-for-app:mc app-name))
::
[%x %group *]
@ -179,7 +179,7 @@
``noun+!>((metadata-for-group:mc group))
::
[%x %metadata @ @ @ @ ~]
=/ =md-resource
=/ =md-resource:store
[i.t.t.path (de-path:resource t.t.t.path)]
``noun+!>((~(get by associations) md-resource))
::
@ -240,26 +240,26 @@
::
++ associations-1-to-2
|= assoc=associations-1
^- ^associations
%- ~(gas by *^associations)
^- associations:store
%- ~(gas by *associations:store)
%+ murn
~(tap by assoc)
|= [[group=path m=md-resource-1] met=metadata-1]
%+ biff (de-path-soft:resource group)
|= g=resource
%+ bind (md-resource-1-to-2 m)
|= =md-resource
|= =md-resource:store
[md-resource g (metadata-1-to-2 met)]
::
++ md-resource-1-to-2
|= m=md-resource-1
^- (unit md-resource)
%+ bind (de-path-soft:resource app-path.m)
^- (unit md-resource:store)
%+ bind (de-path-soft:resource path.m)
|=(rid=resource [app-name.m rid])
::
++ metadata-1-to-2
|= m=metadata-1
%* . *metadata
%* . *metadatum:store
title title.m
description description.m
color color.m
@ -269,25 +269,25 @@
==
::
++ rebuild-resource-indices
|= =^associations
%- ~(gas by *(map md-resource resource))
|= =associations:store
%- ~(gas by *(map md-resource:store resource))
%+ turn ~(tap by associations)
|= [r=md-resource g=resource =metadata]
|= [r=md-resource:store g=resource =metadatum:store]
[r g]
::
++ rebuild-group-indices
|= =^associations
%- ~(gas ju *(jug resource md-resource))
|= =associations:store
%- ~(gas ju *(jug resource md-resource:store))
%+ turn
~(tap by associations)
|= [r=md-resource g=resource =metadata]
|= [r=md-resource:store g=resource =metadatum:store]
[g r]
::
++ rebuild-app-indices
|= =^associations
%- ~(gas ju *(jug app-name [group=resource resource]))
|= =associations:store
%- ~(gas ju *(jug app-name:store [group=resource resource]))
%+ turn ~(tap by associations)
|= [r=md-resource g=resource =metadata]
|= [r=md-resource:store g=resource =metadatum:store]
[app-name.r g resource.r]
::
++ migrate-app-to-graph-store
@ -295,18 +295,18 @@
^- associations-1
%- malt
%+ turn ~(tap by associations)
|= [[=group-path md-resource=md-resource-1] m=metadata-1]
^- [[^group-path md-resource-1] metadata-1]
|= [[=path md-resource=md-resource-1] m=metadata-1]
^- [[^path md-resource-1] metadata-1]
?. =(app-name.md-resource app)
[[group-path md-resource] m]
=/ new-app-path=path
?. ?=([@ @ ~] app-path.md-resource)
app-path.md-resource
ship+app-path.md-resource
[[group-path [%graph new-app-path]] m(module app)]
[[path md-resource] m]
=/ new-path=^path
?. ?=([@ @ ~] path.md-resource)
path.md-resource
ship+path.md-resource
[[path [%graph new-path]] m(module app)]
--
++ poke-metadata-update
|= upd=metadata-update
|= upd=update:store
^- (quip card _state)
?> (team:title [our src]:bowl)
?+ -.upd !!
@ -338,7 +338,7 @@
[%pass / %agent [our.bowl app] %poke cage]
::
+$ tree-metadata
$: associations=(tree [md-resource [resource metadata]])
$: associations=(tree [md-resource:store [resource metadatum:store]])
~
==
::
@ -351,15 +351,13 @@
--
::
++ handle-add
|= [group=resource =md-resource =metadata]
|= [group=resource =md-resource:store =metadatum:store]
^- (quip card _state)
:- %+ send-diff app-name.md-resource
?: (~(has by resource-indices) md-resource)
[%updated-metadata group md-resource metadata metadata]
[%add group md-resource metadata]
[%add group md-resource metadatum]
%= state
associations
(~(put by associations) md-resource [group metadata])
(~(put by associations) md-resource [group metadatum])
::
app-indices
%+ ~(put ju app-indices)
@ -374,7 +372,7 @@
==
::
++ handle-remove
|= [group=resource =md-resource]
|= [group=resource =md-resource:store]
^- (quip card _state)
:- (send-diff app-name.md-resource [%remove group md-resource])
%= state
@ -394,8 +392,8 @@
==
::
++ handle-initial-group
|= [group=resource =^associations]
=/ assocs=(list [=md-resource grp=resource =metadata])
|= [group=resource =associations:store]
=/ assocs=(list [=md-resource:store grp=resource =metadatum:store])
~(tap by associations)
=| cards=(list card)
|-
@ -404,44 +402,44 @@
=, assocs
?> =(group grp.i)
=^ new-cards state
(handle-add group [md-resource metadata]:i)
(handle-add group [md-resource metadatum]:i)
$(cards (weld cards new-cards), assocs t)
::
++ metadata-for-app
|= =app-name
|= =app-name:store
^+ associations
%+ roll ~(tap in (~(gut by app-indices) app-name ~))
|= [[group=resource rid=resource] out=^associations]
=/ =md-resource
|= [[group=resource rid=resource] out=associations:store]
=/ =md-resource:store
[app-name rid]
=/ [resource =metadata]
=/ [resource =metadatum:store]
(~(got by associations) md-resource)
(~(put by out) md-resource [group metadata])
(~(put by out) md-resource [group metadatum])
::
++ metadata-for-group
|= group=resource
=/ resources=(set md-resource)
=/ resources=(set md-resource:store)
(~(get ju group-indices) group)
%+ roll
~(tap in resources)
|= [=md-resource out=^associations]
=/ [resource =metadata]
|= [=md-resource:store out=associations:store]
=/ [resource =metadatum:store]
(~(got by associations) md-resource)
(~(put by out) md-resource [group metadata])
(~(put by out) md-resource [group metadatum])
::
++ send-diff
|= [=app-name upd=metadata-update]
|= [=app-name:store =update:store]
^- (list card)
|^
%- zing
:~ (update-subscribers /all upd)
(update-subscribers /updates upd)
(update-subscribers [%app-name app-name ~] upd)
:~ (update-subscribers /all update)
(update-subscribers /updates update)
(update-subscribers [%app-name app-name ~] update)
==
::
++ update-subscribers
|= [pax=path upd=metadata-update]
|= [pax=path =update:store]
^- (list card)
[%give %fact ~[pax] %metadata-update !>(upd)]~
[%give %fact ~[pax] %metadata-update !>(update)]~
--
--

View File

@ -1,16 +1,18 @@
/- *group, *metadata-store
/- *group
/+ store=group-store, resource
::
|_ =bowl:gall
+$ card card:agent:gall
++ scry-for
|* [=mold =path]
=. path
(snoc path %noun)
.^ mold
%gx
(scot %p our.bowl)
%group-store
(scot %da now.bowl)
(snoc `^path`path %noun)
path
==
++ scry-tag
|= [rid=resource =tag]
@ -21,27 +23,16 @@
~
`(~(gut by tags.u.group) tag ~)
::
++ scry-group-path
|= =path
%+ scry-for
(unit group)
[%groups path]
::
++ scry-group
|= rid=resource
%- scry-group-path
(en-path:resource rid)
%+ scry-for ,(unit group)
`path`groups+(en-path:resource rid)
::
++ members
|= rid=resource
%- members-from-path
(en-path:resource rid)
::
++ members-from-path
|= =group-path
^- (set ship)
=- members:(fall - *group)
(scry-group-path group-path)
=; =group
members.group
(fall (scry-group rid) *group)
::
++ is-member
|= [=ship group=resource]
@ -85,31 +76,18 @@
[~ ~]
~
::
++ can-join-from-path
|= [=path =ship]
%+ scry-for
?
%+ welp
[%groups path]
/join/[(scot %p ship)]
::
++ can-join
|= [rid=resource =ship]
%+ can-join-from-path
(en-path:resource rid)
ship
::
++ is-managed-path
|= =path
^- ?
=/ group=(unit group)
(scry-group-path path)
?~ group %.n
!hidden.u.group
%+ scry-for ,?
^- path
:- %groups
(weld (en-path:resource rid) /join/(scot %p ship))
::
++ is-managed
|= rid=resource
%- is-managed-path
(en-path:resource rid)
=/ group=(unit group)
(scry-group rid)
?~ group %.n
!hidden.u.group
::
--

View File

@ -2,13 +2,14 @@
/+ resource
^?
|%
::
++ associations-to-json
|= =associations
=, enjs:format
^- json
%- pairs
%+ turn ~(tap by associations)
|= [=md-resource [group=resource =metadata]]
|= [=md-resource [group=resource =metadatum]]
^- [cord json]
:-
%- crip
@ -21,12 +22,12 @@
:~ [%group s+(enjs-path:resource group)]
[%app-name s+app-name.md-resource]
[%resource s+(enjs-path:resource resource.md-resource)]
[%metadata (metadata-to-json metadata)]
[%metadata (metadata-to-json metadatum)]
==
::
++ json-to-action
|= jon=json
^- metadata-action
^- action
=, dejs:format
=< (parse-json jon)
|%
@ -40,7 +41,7 @@
%- ot
:~ [%group dejs-path:resource]
[%resource md-resource]
[%metadata metadata]
[%metadata metadatum]
==
++ remove
%- ot
@ -61,7 +62,7 @@
(tag %member-metadata)
==
::
++ metadata
++ metadatum
%- ot
:~ [%title so]
[%description so]
@ -85,7 +86,7 @@
--
::
++ metadata-to-json
|= met=metadata
|= met=metadatum
^- json
=, enjs:format
%- pairs
@ -100,7 +101,7 @@
[%vip s+`@t`vip.met]
==
++ hook-update-to-json
|= upd=metadata-hook-update
|= upd=hook-update
=, enjs:format
%+ frond %metadata-hook-update
%+ frond -.upd
@ -111,7 +112,7 @@
[%channels (associations-to-json channels.upd)]
[%members (numb members.upd)]
[%channel-count (numb channel-count.upd)]
[%metadata (metadata-to-json metadata.upd)]
[%metadata (metadata-to-json metadatum.upd)]
==
%req-preview
~[group+s+(enjs-path:resource group.upd)]
@ -119,7 +120,7 @@
::
++ update-to-json
|= upd=metadata-update
|= upd=update
^- json
=, enjs:format
%+ frond %metadata-update
@ -131,7 +132,7 @@
:~ [%group s+(enjs-path:resource group.upd)]
[%app-name s+app-name.resource.upd]
[%resource s+(enjs-path:resource resource.resource.upd)]
[%metadata (metadata-to-json metadata.upd)]
[%metadata (metadata-to-json metadatum.upd)]
==
%updated-metadata
:- %add
@ -139,7 +140,7 @@
:~ [%group s+(enjs-path:resource group.upd)]
[%app-name s+app-name.resource.upd]
[%resource s+(enjs-path:resource resource.resource.upd)]
[%metadata (metadata-to-json metadata.upd)]
[%metadata (metadata-to-json metadatum.upd)]
==
::
%remove

View File

@ -1,38 +1,39 @@
:: metadata: helpers for getting data from the metadata-store
::
/- *metadata-store
/- store=metadata-store
/+ resource
::
|_ =bowl:gall
++ app-paths-from-group
|= [=app-name group=resource]
|= [=app-name:store group=resource]
^- (list resource)
%+ murn
%~ tap in
=- (~(gut by -) group ~)
.^ (jug resource md-resource)
.^ (jug resource md-resource:store)
%gy
(scot %p our.bowl)
%metadata-store
(scot %da now.bowl)
/group-indices
==
|= =md-resource
|= =md-resource:store
^- (unit resource)
?. =(app-name.md-resource app-name) ~
`resource.md-resource
::
++ app-metadata-for-group
|= [group=resource =app-name]
=/ =associations
|= [group=resource =app-name:store]
=/ =associations:store
(metadata-for-group group)
%- ~(gas by *^associations)
%- ~(gas by *associations:store)
%+ skim ~(tap by associations)
|=([=md-resource association] =(app-name app-name.md-resource))
|= [=md-resource:store association:store]
=(app-name app-name.md-resource)
::
++ metadata-for-group
|= group=resource
.^ associations
.^ associations:store
%gx (scot %p our.bowl) %metadata-store (scot %da now.bowl)
%group (snoc (en-path:resource group) %noun)
==
@ -40,7 +41,7 @@
++ md-resources-from-group
|= group=resource
=- (~(get ju -) group)
.^ (jug resource md-resource)
.^ (jug resource md-resource:store)
%gy
(scot %p our.bowl)
%metadata-store
@ -50,19 +51,19 @@
::
++ peek-association
|= [app-name=term rid=resource]
.^ (unit association)
.^ (unit association:store)
%gx (scot %p our.bowl) %metadata-store (scot %da now.bowl)
%metadata app-name (snoc (en-path:resource rid) %noun)
==
::
++ peek-metadata
|= =md-resource
++ peek-metadatum
|= =md-resource:store
%+ bind (peek-association md-resource)
|=(association metadata)
|=(association:store metadatum)
::
++ peek-group
|= =md-resource
|= =md-resource:store
^- (unit resource)
%+ bind (peek-association md-resource)
|=(association group)
|=(association:store group)
--

View File

@ -1,19 +1,19 @@
/- *metadata-store
/- store=metadata-store
/+ *metadata-json
|_ upd=metadata-update
|_ =update:store
++ grad %noun
++ grow
|%
++ noun upd
++ noun update
++ resource
?> ?=(?(%add %remove %initial-group) -.upd)
group.upd
++ json (update-to-json upd)
?> ?=(?(%add %remove %initial-group) -.update)
group.update
++ json (update-to-json update)
--
::
++ grab
|%
++ noun metadata-update
++ noun update:store
++ json json-to-action
--
::

View File

@ -2,18 +2,16 @@
^?
|%
::
+$ group-path path
+$ app-name term
+$ app-path path
+$ md-resource [=app-name =resource]
+$ association [group=resource =metadata]
+$ association [group=resource =metadatum]
+$ associations (map md-resource association)
+$ group-preview
$: group=resource
channels=associations
members=@ud
channel-count=@ud
=metadata
=metadatum
==
::
+$ color @ux
@ -30,7 +28,7 @@
:: %$: No variation
::
+$ vip-metadata ?(%reader-comments %member-metadata %$)
+$ metadata
+$ metadatum
$: title=cord
description=cord
=color
@ -42,20 +40,25 @@
vip=vip-metadata
==
::
+$ metadata-action
$% [%add group=resource resource=md-resource =metadata]
+$ action
$% [%add group=resource resource=md-resource =metadatum]
[%remove group=resource resource=md-resource]
[%initial-group group=resource =associations]
==
::
+$ metadata-hook-update
+$ hook-update
$% [%req-preview group=resource]
[%preview group-preview]
==
::
+$ metadata-update
$% metadata-action
+$ update
$% action
[%associations =associations]
[%updated-metadata group=resource resource=md-resource before=metadata =metadata]
$: %updated-metadata
group=resource
resource=md-resource
before=metadatum
=metadatum
==
==
--