2020-09-01 04:54:39 +03:00
|
|
|
:: metadata-store [landscape]:
|
|
|
|
::
|
|
|
|
:: data store for application metadata and mappings
|
2020-02-15 01:59:22 +03:00
|
|
|
:: between groups and resources within applications
|
|
|
|
::
|
|
|
|
:: group-paths are expected to be an existing group path
|
|
|
|
:: resources are expected to correspond to existing app paths
|
|
|
|
::
|
2020-02-15 03:37:49 +03:00
|
|
|
:: note: when scrying for metadata, to make the arguments safe in paths,
|
|
|
|
:: encode group-path and app-path using (scot %t (spat group-path))
|
|
|
|
::
|
2020-02-15 01:59:22 +03:00
|
|
|
:: +watch paths:
|
2020-10-13 06:38:56 +03:00
|
|
|
:: /all associations + updates
|
2020-02-15 01:59:22 +03:00
|
|
|
:: /updates just updates
|
|
|
|
:: /app-name/%app-name specific app's associations + updates
|
|
|
|
::
|
|
|
|
:: +peek paths:
|
2020-02-15 03:37:49 +03:00
|
|
|
:: /associations all associations
|
|
|
|
:: /group-indices all group indices
|
|
|
|
:: /app-indices all app indices
|
|
|
|
:: /resource-indices all resource indices
|
|
|
|
:: /metadata/%group-path/%app-name/%app-path specific metadatum
|
|
|
|
:: /app-name/%app-name associations for app
|
2020-02-21 01:55:46 +03:00
|
|
|
:: /group/%group-path associations for group
|
2020-02-13 03:45:01 +03:00
|
|
|
::
|
2020-07-23 08:02:54 +03:00
|
|
|
/- *metadata-store, *metadata-hook
|
2021-01-14 01:50:39 +03:00
|
|
|
/+ *metadata-json, default-agent, verb, dbug, resource, *migrate
|
2020-02-13 03:45:01 +03:00
|
|
|
|%
|
|
|
|
+$ card card:agent:gall
|
2020-09-22 20:26:19 +03:00
|
|
|
+$ base-state-0
|
|
|
|
$: associations=associations-0
|
2020-06-08 10:53:16 +03:00
|
|
|
group-indices=(jug group-path md-resource)
|
2020-02-15 01:59:22 +03:00
|
|
|
app-indices=(jug app-name [group-path app-path])
|
2020-06-08 10:53:16 +03:00
|
|
|
resource-indices=(jug md-resource group-path)
|
2020-02-13 03:45:01 +03:00
|
|
|
==
|
2020-06-24 03:28:57 +03:00
|
|
|
::
|
2020-09-22 20:26:19 +03:00
|
|
|
+$ associations-0 (map [group-path md-resource] metadata-0)
|
2020-06-24 03:28:57 +03:00
|
|
|
::
|
2020-09-22 20:26:19 +03:00
|
|
|
+$ metadata-0
|
|
|
|
$: title=@t
|
|
|
|
description=@t
|
|
|
|
color=@ux
|
|
|
|
date-created=@da
|
|
|
|
creator=@p
|
2020-06-24 03:28:57 +03:00
|
|
|
==
|
|
|
|
::
|
2021-01-14 06:10:32 +03:00
|
|
|
+$ metadata-1
|
|
|
|
$: title=@t
|
|
|
|
description=@t
|
|
|
|
color=@ux
|
|
|
|
date-created=@da
|
|
|
|
creator=@p
|
|
|
|
module=term
|
|
|
|
==
|
|
|
|
::
|
2021-01-12 07:26:19 +03:00
|
|
|
+$ md-resource-1 [=app-name =app-path]
|
|
|
|
::
|
2021-01-14 06:10:32 +03:00
|
|
|
+$ associations-1 (map [group-path md-resource-1] metadata-1)
|
2021-01-12 07:26:19 +03:00
|
|
|
::
|
2020-09-22 20:26:19 +03:00
|
|
|
+$ base-state-1
|
2021-01-12 07:26:19 +03:00
|
|
|
$: associations=associations-1
|
|
|
|
group-indices=(jug group-path md-resource-1)
|
2020-09-22 20:26:19 +03:00
|
|
|
app-indices=(jug app-name [group-path app-path])
|
2021-01-12 07:26:19 +03:00
|
|
|
resource-indices=(jug md-resource-1 group-path)
|
|
|
|
==
|
|
|
|
::
|
|
|
|
+$ cached-indices
|
|
|
|
$: group-indices=(jug resource md-resource)
|
|
|
|
app-indices=(jug app-name [group=resource =resource])
|
2021-01-13 06:50:04 +03:00
|
|
|
resource-indices=(map md-resource resource)
|
2021-01-12 07:26:19 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
+$ base-state-2
|
|
|
|
$: =associations
|
|
|
|
~
|
2020-07-23 08:02:54 +03:00
|
|
|
==
|
|
|
|
::
|
2020-09-22 20:26:19 +03:00
|
|
|
+$ state-0 [%0 base-state-0]
|
|
|
|
+$ state-1 [%1 base-state-0]
|
|
|
|
+$ state-2 [%2 base-state-0]
|
|
|
|
+$ state-3 [%3 base-state-1]
|
2020-09-25 09:21:29 +03:00
|
|
|
+$ state-4 [%4 base-state-1]
|
2020-10-05 07:50:11 +03:00
|
|
|
+$ state-5 [%5 base-state-1]
|
2020-10-29 03:25:16 +03:00
|
|
|
+$ state-6 [%6 base-state-1]
|
2021-01-12 07:26:19 +03:00
|
|
|
+$ state-7 [%7 base-state-2]
|
2020-06-24 03:28:57 +03:00
|
|
|
+$ versioned-state
|
2020-09-22 20:26:19 +03:00
|
|
|
$% state-0
|
|
|
|
state-1
|
|
|
|
state-2
|
|
|
|
state-3
|
2020-09-25 09:21:29 +03:00
|
|
|
state-4
|
2020-10-05 07:50:11 +03:00
|
|
|
state-5
|
2020-10-29 03:25:16 +03:00
|
|
|
state-6
|
2021-01-12 07:26:19 +03:00
|
|
|
state-7
|
|
|
|
==
|
|
|
|
::
|
|
|
|
+$ inflated-state
|
|
|
|
$: state-7
|
|
|
|
cached-indices
|
2020-06-24 03:28:57 +03:00
|
|
|
==
|
2020-02-13 03:45:01 +03:00
|
|
|
--
|
|
|
|
::
|
2021-01-12 07:26:19 +03:00
|
|
|
=| inflated-state
|
2020-02-13 03:45:01 +03:00
|
|
|
=* state -
|
2020-02-26 00:23:07 +03:00
|
|
|
%+ verb |
|
2020-02-21 00:27:09 +03:00
|
|
|
%- agent:dbug
|
2020-02-13 03:45:01 +03:00
|
|
|
^- agent:gall
|
|
|
|
=<
|
|
|
|
|_ =bowl:gall
|
2020-09-25 18:41:39 +03:00
|
|
|
+* this .
|
|
|
|
mc ~(. +> bowl)
|
|
|
|
def ~(. (default-agent this %|) bowl)
|
2020-02-13 03:45:01 +03:00
|
|
|
::
|
2020-02-14 04:22:52 +03:00
|
|
|
++ on-init on-init:def
|
2021-01-12 07:26:19 +03:00
|
|
|
++ on-save !>(-.state)
|
2020-02-13 03:45:01 +03:00
|
|
|
++ on-load
|
2020-06-24 03:28:57 +03:00
|
|
|
|= =vase
|
|
|
|
^- (quip card _this)
|
2020-12-11 03:56:41 +03:00
|
|
|
=^ cards state
|
|
|
|
(on-load:mc vase)
|
|
|
|
[cards this]
|
2020-02-13 03:45:01 +03:00
|
|
|
::
|
|
|
|
++ on-poke
|
|
|
|
|= [=mark =vase]
|
|
|
|
^- (quip card _this)
|
|
|
|
?> (team:title our.bowl src.bowl)
|
|
|
|
=^ cards state
|
2020-06-29 06:12:46 +03:00
|
|
|
?+ mark (on-poke:def mark vase)
|
2021-01-14 01:50:39 +03:00
|
|
|
?(%metadata-action %metadata-update)
|
|
|
|
(poke-metadata-update:mc !<(metadata-update vase))
|
2020-12-01 00:06:41 +03:00
|
|
|
::
|
|
|
|
%import
|
|
|
|
(poke-import:mc q.vase)
|
2021-01-14 01:50:39 +03:00
|
|
|
::
|
|
|
|
%noun ~& +.state `state
|
2020-06-29 06:12:46 +03:00
|
|
|
==
|
2020-02-13 03:45:01 +03:00
|
|
|
[cards this]
|
|
|
|
::
|
|
|
|
++ on-watch
|
|
|
|
|= =path
|
|
|
|
^- (quip card _this)
|
|
|
|
?> (team:title our.bowl src.bowl)
|
|
|
|
|^
|
|
|
|
=/ cards=(list card)
|
|
|
|
?+ path (on-watch:def path)
|
2020-09-22 20:26:19 +03:00
|
|
|
[%all ~]
|
|
|
|
(give %metadata-update !>([%associations associations]))
|
|
|
|
::
|
|
|
|
[%updates ~]
|
|
|
|
~
|
|
|
|
::
|
2020-02-14 04:22:52 +03:00
|
|
|
[%app-name @ ~]
|
|
|
|
=/ =app-name i.t.path
|
|
|
|
=/ app-indices (metadata-for-app:mc app-name)
|
2020-02-15 01:59:22 +03:00
|
|
|
(give %metadata-update !>([%associations app-indices]))
|
2020-02-13 03:45:01 +03:00
|
|
|
==
|
|
|
|
[cards this]
|
|
|
|
::
|
|
|
|
++ give
|
|
|
|
|= =cage
|
|
|
|
^- (list card)
|
|
|
|
[%give %fact ~ cage]~
|
|
|
|
--
|
|
|
|
::
|
|
|
|
++ on-peek
|
|
|
|
|= =path
|
|
|
|
^- (unit (unit cage))
|
|
|
|
?+ path (on-peek:def path)
|
2021-01-14 01:50:39 +03:00
|
|
|
[%y %group-indices ~] ``noun+!>(group-indices)
|
2020-02-15 01:59:22 +03:00
|
|
|
[%y %app-indices ~] ``noun+!>(app-indices)
|
|
|
|
[%y %resource-indices ~] ``noun+!>(resource-indices)
|
2020-02-15 03:37:49 +03:00
|
|
|
[%x %associations ~] ``noun+!>(associations)
|
2020-02-14 04:22:52 +03:00
|
|
|
[%x %app-name @ ~]
|
|
|
|
=/ =app-name i.t.t.path
|
|
|
|
``noun+!>((metadata-for-app:mc app-name))
|
2020-02-21 01:55:46 +03:00
|
|
|
::
|
|
|
|
[%x %group *]
|
2021-01-12 07:26:19 +03:00
|
|
|
=/ group=resource (de-path:resource t.t.path)
|
|
|
|
``noun+!>((metadata-for-group:mc group))
|
2020-02-15 03:37:49 +03:00
|
|
|
::
|
2021-01-13 06:50:04 +03:00
|
|
|
[%x %metadata @ @ @ @ ~]
|
|
|
|
=/ =md-resource
|
2021-01-14 01:50:39 +03:00
|
|
|
[i.t.t.path (de-path:resource t.t.t.path)]
|
2021-01-13 06:50:04 +03:00
|
|
|
``noun+!>((~(get by associations) md-resource))
|
2020-07-28 03:41:30 +03:00
|
|
|
::
|
|
|
|
[%x %resource @ *]
|
2020-09-22 20:26:19 +03:00
|
|
|
=/ app=term i.t.t.path
|
2021-01-12 07:26:19 +03:00
|
|
|
=/ rid=resource (de-path:resource t.t.t.path)
|
2021-01-14 01:50:39 +03:00
|
|
|
``noun+!>((~(get by resource-indices) [app rid]))
|
|
|
|
|
2020-12-01 00:06:41 +03:00
|
|
|
::
|
|
|
|
[%x %export ~]
|
2021-01-12 07:26:19 +03:00
|
|
|
``noun+!>(-.state)
|
2020-02-13 03:45:01 +03:00
|
|
|
==
|
|
|
|
::
|
2020-09-22 20:26:19 +03:00
|
|
|
++ on-leave on-leave:def
|
2020-02-13 03:45:01 +03:00
|
|
|
++ on-agent on-agent:def
|
|
|
|
++ on-arvo on-arvo:def
|
|
|
|
++ on-fail on-fail:def
|
|
|
|
--
|
|
|
|
::
|
2020-02-14 04:22:52 +03:00
|
|
|
|_ =bowl:gall
|
2020-12-11 03:56:41 +03:00
|
|
|
::
|
|
|
|
++ on-load
|
|
|
|
|= =vase
|
|
|
|
^- (quip card _state)
|
|
|
|
=/ old !<(versioned-state vase)
|
|
|
|
=| cards=(list card)
|
|
|
|
|^
|
2021-01-14 06:10:32 +03:00
|
|
|
=* loop $
|
2021-01-12 07:26:19 +03:00
|
|
|
?: ?=(%7 -.old)
|
2020-12-11 03:56:41 +03:00
|
|
|
:- cards
|
2021-01-12 07:26:19 +03:00
|
|
|
%_ state
|
|
|
|
associations
|
|
|
|
associations.old
|
|
|
|
::
|
|
|
|
resource-indices
|
|
|
|
(rebuild-resource-indices associations.old)
|
2021-01-13 06:50:04 +03:00
|
|
|
::
|
|
|
|
group-indices
|
|
|
|
(rebuild-group-indices associations.old)
|
2020-12-11 03:56:41 +03:00
|
|
|
::
|
|
|
|
app-indices
|
2021-01-12 07:26:19 +03:00
|
|
|
(rebuild-app-indices associations.old)
|
2020-12-11 03:56:41 +03:00
|
|
|
==
|
2021-01-12 07:26:19 +03:00
|
|
|
?: ?=(%6 -.old)
|
|
|
|
=/ old-assoc=associations-1
|
|
|
|
(migrate-app-to-graph-store %chat associations.old)
|
|
|
|
$(old [%7 (associations-1-to-2 old-assoc) ~])
|
|
|
|
::
|
2020-12-11 03:56:41 +03:00
|
|
|
?: ?=(%5 -.old)
|
2021-01-12 07:26:19 +03:00
|
|
|
=/ associations=associations-1
|
2020-12-11 03:56:41 +03:00
|
|
|
(migrate-app-to-graph-store %publish associations.old)
|
|
|
|
%_ $
|
|
|
|
-.old %6
|
|
|
|
associations.old associations
|
|
|
|
==
|
2021-01-12 07:26:19 +03:00
|
|
|
:: pre-breach, can safely throw away
|
2021-01-14 06:10:32 +03:00
|
|
|
loop(old *state-7)
|
|
|
|
::
|
2021-01-12 07:26:19 +03:00
|
|
|
++ associations-1-to-2
|
2021-01-14 06:10:32 +03:00
|
|
|
|= assoc=associations-1
|
|
|
|
^- ^associations
|
|
|
|
%- ~(gas by *^associations)
|
|
|
|
%+ 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 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)
|
|
|
|
|=(rid=resource [app-name.m rid])
|
|
|
|
::
|
|
|
|
++ metadata-1-to-2
|
|
|
|
|= m=metadata-1
|
|
|
|
%* . *metadata
|
|
|
|
title title.m
|
|
|
|
description description.m
|
|
|
|
color color.m
|
|
|
|
date-created date-created.m
|
|
|
|
creator creator.m
|
|
|
|
module module.m
|
|
|
|
==
|
2020-12-11 03:56:41 +03:00
|
|
|
::
|
|
|
|
++ rebuild-resource-indices
|
|
|
|
|= =^associations
|
2021-01-13 06:50:04 +03:00
|
|
|
%- ~(gas by *(map md-resource resource))
|
|
|
|
%+ turn ~(tap by associations)
|
|
|
|
|= [r=md-resource g=resource =metadata]
|
2020-12-11 03:56:41 +03:00
|
|
|
[r g]
|
|
|
|
::
|
|
|
|
++ rebuild-group-indices
|
2021-01-13 06:50:04 +03:00
|
|
|
|= =^associations
|
2021-01-12 07:26:19 +03:00
|
|
|
%- ~(gas ju *(jug resource md-resource))
|
2021-01-13 06:50:04 +03:00
|
|
|
%+ turn
|
|
|
|
~(tap by associations)
|
|
|
|
|= [r=md-resource g=resource =metadata]
|
|
|
|
[g r]
|
2020-12-11 03:56:41 +03:00
|
|
|
::
|
|
|
|
++ rebuild-app-indices
|
|
|
|
|= =^associations
|
2021-01-12 07:26:19 +03:00
|
|
|
%- ~(gas ju *(jug app-name [group=resource resource]))
|
2021-01-13 06:50:04 +03:00
|
|
|
%+ turn ~(tap by associations)
|
|
|
|
|= [r=md-resource g=resource =metadata]
|
|
|
|
[app-name.r g resource.r]
|
2020-12-11 03:56:41 +03:00
|
|
|
::
|
|
|
|
++ migrate-app-to-graph-store
|
2021-01-12 07:26:19 +03:00
|
|
|
|= [app=@tas associations=associations-1]
|
|
|
|
^- associations-1
|
2020-12-11 03:56:41 +03:00
|
|
|
%- malt
|
|
|
|
%+ turn ~(tap by associations)
|
2021-01-14 06:10:32 +03:00
|
|
|
|= [[=group-path md-resource=md-resource-1] m=metadata-1]
|
|
|
|
^- [[^group-path md-resource-1] metadata-1]
|
2020-12-11 03:56:41 +03:00
|
|
|
?. =(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)]
|
|
|
|
--
|
2021-01-14 01:50:39 +03:00
|
|
|
++ poke-metadata-update
|
|
|
|
|= upd=metadata-update
|
2020-02-13 03:45:01 +03:00
|
|
|
^- (quip card _state)
|
2021-01-14 01:50:39 +03:00
|
|
|
?> (team:title [our src]:bowl)
|
|
|
|
?+ -.upd !!
|
|
|
|
%add (handle-add +.upd)
|
|
|
|
%remove (handle-remove +.upd)
|
|
|
|
%initial-group (handle-initial-group +.upd)
|
2020-02-13 03:45:01 +03:00
|
|
|
==
|
|
|
|
::
|
2020-12-01 00:06:41 +03:00
|
|
|
++ poke-import
|
|
|
|
|= arc=*
|
|
|
|
^- (quip card _state)
|
2020-12-02 10:03:05 +03:00
|
|
|
|^
|
2021-01-18 04:10:16 +03:00
|
|
|
=^ cards state
|
|
|
|
(on-load !>([%7 (remake-metadata ;;(tree-metadata +.arc))]))
|
|
|
|
:_ state
|
|
|
|
%+ weld cards
|
|
|
|
%+ turn ~(tap in ~(key by group-indices))
|
|
|
|
|= rid=resource
|
|
|
|
%- poke-our
|
|
|
|
?: =(entity.rid our.bowl)
|
|
|
|
:- %metadata-push-hook
|
|
|
|
push-hook-action+!>([%add rid])
|
|
|
|
:- %metadata-pull-hook
|
|
|
|
pull-hook-action+!>([%add [entity .]:rid])
|
|
|
|
::
|
|
|
|
++ poke-our
|
|
|
|
|= [app=term =cage]
|
|
|
|
^- card
|
|
|
|
[%pass / %agent [our.bowl app] %poke cage]
|
2020-12-02 10:03:05 +03:00
|
|
|
::
|
|
|
|
+$ tree-metadata
|
2021-01-13 06:50:04 +03:00
|
|
|
$: associations=(tree [md-resource [resource metadata]])
|
2021-01-12 07:26:19 +03:00
|
|
|
~
|
2020-12-02 10:03:05 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
++ remake-metadata
|
|
|
|
|= tm=tree-metadata
|
2021-01-12 07:26:19 +03:00
|
|
|
^- base-state-2
|
2020-12-02 10:03:05 +03:00
|
|
|
:* (remake-map associations.tm)
|
2021-01-12 07:26:19 +03:00
|
|
|
~
|
2020-12-02 10:03:05 +03:00
|
|
|
==
|
|
|
|
--
|
2020-12-01 00:06:41 +03:00
|
|
|
::
|
2020-02-13 03:45:01 +03:00
|
|
|
++ handle-add
|
2021-01-12 07:26:19 +03:00
|
|
|
|= [group=resource =md-resource =metadata]
|
2020-02-13 03:45:01 +03:00
|
|
|
^- (quip card _state)
|
2020-06-08 10:53:16 +03:00
|
|
|
:- %+ send-diff app-name.md-resource
|
2020-09-22 20:26:19 +03:00
|
|
|
?: (~(has by resource-indices) md-resource)
|
2021-01-13 06:50:04 +03:00
|
|
|
[%updated-metadata group md-resource metadata metadata]
|
2021-01-12 07:26:19 +03:00
|
|
|
[%add group md-resource metadata]
|
2020-02-13 03:45:01 +03:00
|
|
|
%= state
|
2020-02-15 01:59:22 +03:00
|
|
|
associations
|
2021-01-13 06:50:04 +03:00
|
|
|
(~(put by associations) md-resource [group metadata])
|
2020-02-13 03:45:01 +03:00
|
|
|
::
|
2020-02-15 01:59:22 +03:00
|
|
|
app-indices
|
2020-09-22 20:26:19 +03:00
|
|
|
%+ ~(put ju app-indices)
|
|
|
|
app-name.md-resource
|
2021-01-12 07:26:19 +03:00
|
|
|
[group resource.md-resource]
|
2020-02-13 03:45:01 +03:00
|
|
|
::
|
2020-02-15 01:59:22 +03:00
|
|
|
resource-indices
|
2021-01-13 06:50:04 +03:00
|
|
|
(~(put by resource-indices) md-resource group)
|
2021-01-14 01:50:39 +03:00
|
|
|
::
|
|
|
|
group-indices
|
|
|
|
(~(put ju group-indices) group md-resource)
|
2020-02-13 03:45:01 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
++ handle-remove
|
2021-01-12 07:26:19 +03:00
|
|
|
|= [group=resource =md-resource]
|
2020-02-13 03:45:01 +03:00
|
|
|
^- (quip card _state)
|
2021-01-12 07:26:19 +03:00
|
|
|
:- (send-diff app-name.md-resource [%remove group md-resource])
|
2020-02-13 03:45:01 +03:00
|
|
|
%= state
|
2020-02-15 01:59:22 +03:00
|
|
|
associations
|
2021-01-13 06:50:04 +03:00
|
|
|
(~(del by associations) md-resource)
|
2020-02-13 03:45:01 +03:00
|
|
|
::
|
2020-02-15 01:59:22 +03:00
|
|
|
app-indices
|
2020-09-22 20:26:19 +03:00
|
|
|
%+ ~(del ju app-indices)
|
|
|
|
app-name.md-resource
|
2021-01-12 07:26:19 +03:00
|
|
|
[group resource.md-resource]
|
2020-02-13 03:45:01 +03:00
|
|
|
::
|
2020-02-15 01:59:22 +03:00
|
|
|
resource-indices
|
2021-01-13 06:50:04 +03:00
|
|
|
(~(del by resource-indices) md-resource)
|
2021-01-14 01:50:39 +03:00
|
|
|
::
|
|
|
|
group-indices
|
|
|
|
(~(del ju group-indices) group md-resource)
|
2020-02-13 03:45:01 +03:00
|
|
|
==
|
|
|
|
::
|
2021-01-14 01:50:39 +03:00
|
|
|
++ handle-initial-group
|
|
|
|
|= [group=resource =^associations]
|
|
|
|
=/ assocs=(list [=md-resource grp=resource =metadata])
|
|
|
|
~(tap by associations)
|
|
|
|
=| cards=(list card)
|
|
|
|
|-
|
|
|
|
?~ assocs
|
|
|
|
[cards state]
|
|
|
|
=, assocs
|
|
|
|
?> =(group grp.i)
|
|
|
|
=^ new-cards state
|
|
|
|
(handle-add group [md-resource metadata]:i)
|
|
|
|
$(cards (weld cards new-cards), assocs t)
|
|
|
|
::
|
2020-02-14 04:22:52 +03:00
|
|
|
++ metadata-for-app
|
|
|
|
|= =app-name
|
2021-01-13 06:50:04 +03:00
|
|
|
^+ associations
|
|
|
|
%+ roll ~(tap in (~(gut by app-indices) app-name ~))
|
|
|
|
|= [[group=resource rid=resource] out=^associations]
|
|
|
|
=/ =md-resource
|
|
|
|
[app-name rid]
|
|
|
|
=/ [resource =metadata]
|
|
|
|
(~(got by associations) md-resource)
|
|
|
|
(~(put by out) md-resource [group metadata])
|
2020-02-14 04:22:52 +03:00
|
|
|
::
|
2020-02-21 01:55:46 +03:00
|
|
|
++ metadata-for-group
|
2021-01-12 07:26:19 +03:00
|
|
|
|= group=resource
|
2021-01-13 06:50:04 +03:00
|
|
|
=/ resources=(set md-resource)
|
|
|
|
(~(get ju group-indices) group)
|
|
|
|
%+ roll
|
|
|
|
~(tap in resources)
|
|
|
|
|= [=md-resource out=^associations]
|
|
|
|
=/ [resource =metadata]
|
|
|
|
(~(got by associations) md-resource)
|
|
|
|
(~(put by out) md-resource [group metadata])
|
2020-02-21 01:55:46 +03:00
|
|
|
::
|
2020-02-13 03:45:01 +03:00
|
|
|
++ send-diff
|
2020-02-14 04:22:52 +03:00
|
|
|
|= [=app-name upd=metadata-update]
|
2020-02-13 03:45:01 +03:00
|
|
|
^- (list card)
|
|
|
|
|^
|
|
|
|
%- zing
|
2020-02-14 04:22:52 +03:00
|
|
|
:~ (update-subscribers /all upd)
|
|
|
|
(update-subscribers /updates upd)
|
|
|
|
(update-subscribers [%app-name app-name ~] upd)
|
2020-02-13 03:45:01 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
++ update-subscribers
|
2020-02-14 04:22:52 +03:00
|
|
|
|= [pax=path upd=metadata-update]
|
2020-02-13 03:45:01 +03:00
|
|
|
^- (list card)
|
2020-02-14 04:22:52 +03:00
|
|
|
[%give %fact ~[pax] %metadata-update !>(upd)]~
|
2020-02-13 03:45:01 +03:00
|
|
|
--
|
|
|
|
--
|