2021-07-20 07:14:16 +03:00
|
|
|
/- sur=graph-store, pos=post, pull-hook
|
2021-04-14 22:26:36 +03:00
|
|
|
/+ res=resource, migrate
|
2020-06-05 22:22:36 +03:00
|
|
|
=< [sur .]
|
|
|
|
=< [pos .]
|
|
|
|
=, sur
|
|
|
|
=, pos
|
|
|
|
|%
|
2020-06-11 22:30:19 +03:00
|
|
|
:: NOTE: move these functions to zuse
|
2020-06-11 21:25:49 +03:00
|
|
|
++ nu :: parse number as hex
|
2020-11-25 23:22:55 +03:00
|
|
|
|= jon=json
|
2020-11-26 17:09:31 +03:00
|
|
|
?> ?=([%s *] jon)
|
2020-06-11 21:25:49 +03:00
|
|
|
(rash p.jon hex)
|
|
|
|
::
|
2020-06-11 22:30:19 +03:00
|
|
|
++ re :: recursive reparsers
|
2020-11-26 17:09:31 +03:00
|
|
|
|* [gar=* sef=_|.(fist:dejs-soft:format)]
|
2020-11-25 23:22:55 +03:00
|
|
|
|= jon=json
|
2020-06-11 22:30:19 +03:00
|
|
|
^- (unit _gar)
|
|
|
|
=- ~! gar ~! (need -) -
|
|
|
|
((sef) jon)
|
|
|
|
::
|
|
|
|
++ dank :: tank
|
|
|
|
^- $-(json (unit tank))
|
|
|
|
=, ^? dejs-soft:format
|
|
|
|
%+ re *tank |. ~+
|
|
|
|
%- of :~
|
|
|
|
leaf+sa
|
|
|
|
palm+(ot style+(ot mid+sa cap+sa open+sa close+sa ~) lines+(ar dank) ~)
|
|
|
|
rose+(ot style+(ot mid+sa open+sa close+sa ~) lines+(ar dank) ~)
|
|
|
|
==
|
|
|
|
::
|
2021-06-07 21:42:26 +03:00
|
|
|
++ orm ((on atom node) gth)
|
|
|
|
++ orm-log ((on time logged-update) gth)
|
2020-06-10 23:47:18 +03:00
|
|
|
::
|
2020-06-05 22:22:36 +03:00
|
|
|
++ enjs
|
|
|
|
=, enjs:format
|
|
|
|
|%
|
2020-10-27 08:01:24 +03:00
|
|
|
::
|
|
|
|
++ signatures
|
|
|
|
|= s=^signatures
|
|
|
|
^- json
|
|
|
|
[%a (turn ~(tap in s) signature)]
|
|
|
|
::
|
|
|
|
++ signature
|
|
|
|
|= s=^signature
|
|
|
|
^- json
|
|
|
|
%- pairs
|
|
|
|
:~ [%signature s+(scot %ux p.s)]
|
|
|
|
[%ship (ship q.s)]
|
|
|
|
[%life (numb r.s)]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ index
|
2021-04-20 23:58:12 +03:00
|
|
|
|= ind=^index
|
2020-10-27 08:01:24 +03:00
|
|
|
^- json
|
2021-04-20 23:58:12 +03:00
|
|
|
:- %s
|
|
|
|
?: =(~ ind)
|
|
|
|
'/'
|
|
|
|
%+ roll ind
|
|
|
|
|= [cur=@ acc=@t]
|
|
|
|
^- @t
|
|
|
|
=/ num (numb cur)
|
|
|
|
?> ?=(%n -.num)
|
|
|
|
(rap 3 acc '/' p.num ~)
|
2020-10-27 08:01:24 +03:00
|
|
|
::
|
|
|
|
++ uid
|
|
|
|
|= u=^uid
|
|
|
|
^- json
|
|
|
|
%- pairs
|
|
|
|
:~ [%resource (enjs:res resource.u)]
|
|
|
|
[%index (index index.u)]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ content
|
|
|
|
|= c=^content
|
|
|
|
^- json
|
|
|
|
?- -.c
|
2020-11-03 03:39:24 +03:00
|
|
|
%mention (frond %mention (ship ship.c))
|
2020-10-27 08:01:24 +03:00
|
|
|
%text (frond %text s+text.c)
|
|
|
|
%url (frond %url s+url.c)
|
2021-03-18 04:50:14 +03:00
|
|
|
%reference (frond %reference (reference +.c))
|
2020-10-27 08:01:24 +03:00
|
|
|
%code
|
|
|
|
%+ frond %code
|
|
|
|
%- pairs
|
|
|
|
:- [%expression s+expression.c]
|
|
|
|
:_ ~
|
|
|
|
:- %output
|
|
|
|
:: virtualize output rendering, +tank:enjs:format might crash
|
|
|
|
::
|
|
|
|
=/ result=(each (list json) tang)
|
|
|
|
(mule |.((turn output.c tank)))
|
|
|
|
?- -.result
|
|
|
|
%& a+p.result
|
|
|
|
%| a+[a+[%s '[[output rendering error]]']~]~
|
|
|
|
==
|
|
|
|
==
|
|
|
|
::
|
2021-03-18 04:50:14 +03:00
|
|
|
++ reference
|
|
|
|
|= ref=^reference
|
|
|
|
|^
|
|
|
|
%+ frond -.ref
|
|
|
|
?- -.ref
|
|
|
|
%graph (graph +.ref)
|
|
|
|
%group (group +.ref)
|
2021-09-17 00:05:54 +03:00
|
|
|
%app (app +.ref)
|
2021-03-18 04:50:14 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
++ graph
|
|
|
|
|= [grp=res gra=res idx=^index]
|
|
|
|
%- pairs
|
2021-03-19 01:51:29 +03:00
|
|
|
:~ graph+s+(enjs-path:res gra)
|
|
|
|
group+s+(enjs-path:res grp)
|
2021-03-18 04:50:14 +03:00
|
|
|
index+(index idx)
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ group
|
|
|
|
|= grp=res
|
|
|
|
s+(enjs-path:res grp)
|
2021-09-17 00:05:54 +03:00
|
|
|
::
|
|
|
|
++ app
|
2021-09-18 02:25:32 +03:00
|
|
|
|= [=^ship =desk path=@ta]
|
2021-09-17 00:05:54 +03:00
|
|
|
%- pairs
|
2021-09-18 02:25:32 +03:00
|
|
|
:~ ship+s+(scot %p ship)
|
|
|
|
desk+s+desk
|
|
|
|
path+s+path
|
2021-09-17 00:05:54 +03:00
|
|
|
==
|
2021-03-18 04:50:14 +03:00
|
|
|
--
|
|
|
|
::
|
2021-04-14 00:17:39 +03:00
|
|
|
++ maybe-post
|
|
|
|
|= mp=^maybe-post
|
|
|
|
^- json
|
|
|
|
?- -.mp
|
|
|
|
%| s+(scot %ux p.mp)
|
|
|
|
%& (post p.mp)
|
|
|
|
==
|
|
|
|
::
|
2020-10-27 08:01:24 +03:00
|
|
|
++ post
|
|
|
|
|= p=^post
|
|
|
|
^- json
|
|
|
|
%- pairs
|
|
|
|
:~ [%author (ship author.p)]
|
|
|
|
[%index (index index.p)]
|
|
|
|
[%time-sent (time time-sent.p)]
|
|
|
|
[%contents [%a (turn contents.p content)]]
|
|
|
|
[%hash ?~(hash.p ~ s+(scot %ux u.hash.p))]
|
|
|
|
[%signatures (signatures signatures.p)]
|
|
|
|
==
|
|
|
|
::
|
2020-06-05 22:22:36 +03:00
|
|
|
++ update
|
|
|
|
|= upd=^update
|
|
|
|
^- json
|
2020-06-30 04:14:55 +03:00
|
|
|
|^ (frond %graph-update (pairs ~[(encode q.upd)]))
|
2020-06-05 22:22:36 +03:00
|
|
|
::
|
|
|
|
++ encode
|
2021-03-18 04:50:14 +03:00
|
|
|
|= upd=action
|
2020-06-05 22:22:36 +03:00
|
|
|
^- [cord json]
|
2020-06-10 21:45:00 +03:00
|
|
|
?- -.upd
|
2020-06-12 20:50:22 +03:00
|
|
|
%add-graph
|
|
|
|
:- %add-graph
|
|
|
|
%- pairs
|
|
|
|
:~ [%resource (enjs:res resource.upd)]
|
|
|
|
[%graph (graph graph.upd)]
|
2020-07-07 02:31:57 +03:00
|
|
|
[%mark ?~(mark.upd ~ s+u.mark.upd)]
|
2020-11-12 23:40:12 +03:00
|
|
|
[%overwrite b+overwrite.upd]
|
2020-06-12 20:50:22 +03:00
|
|
|
==
|
2020-06-10 21:45:00 +03:00
|
|
|
::
|
|
|
|
%remove-graph
|
|
|
|
[%remove-graph (enjs:res resource.upd)]
|
|
|
|
::
|
2020-06-12 20:27:43 +03:00
|
|
|
%add-nodes
|
|
|
|
:- %add-nodes
|
|
|
|
%- pairs
|
|
|
|
:~ [%resource (enjs:res resource.upd)]
|
|
|
|
[%nodes (nodes nodes.upd)]
|
|
|
|
==
|
|
|
|
::
|
2021-04-14 00:17:39 +03:00
|
|
|
%remove-posts
|
|
|
|
:- %remove-posts
|
2020-06-12 20:27:43 +03:00
|
|
|
%- pairs
|
|
|
|
:~ [%resource (enjs:res resource.upd)]
|
|
|
|
[%indices (indices indices.upd)]
|
|
|
|
==
|
2020-06-10 21:45:00 +03:00
|
|
|
::
|
|
|
|
%add-signatures
|
|
|
|
:- %add-signatures
|
|
|
|
%- pairs
|
|
|
|
:~ [%uid (uid uid.upd)]
|
|
|
|
[%signatures (signatures signatures.upd)]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
%remove-signatures
|
|
|
|
:- %remove-signatures
|
|
|
|
%- pairs
|
|
|
|
:~ [%uid (uid uid.upd)]
|
|
|
|
[%signatures (signatures signatures.upd)]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
%add-tag
|
|
|
|
:- %add-tag
|
|
|
|
%- pairs
|
|
|
|
:~ [%term s+term.upd]
|
2021-04-19 23:53:07 +03:00
|
|
|
[%uid (uid uid.upd)]
|
2020-06-10 21:45:00 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
%remove-tag
|
|
|
|
:- %remove-tag
|
|
|
|
%- pairs
|
|
|
|
:~ [%term s+term.upd]
|
2021-04-19 23:53:07 +03:00
|
|
|
[%uid (uid uid.upd)]
|
2020-06-10 21:45:00 +03:00
|
|
|
==
|
2020-06-23 20:53:50 +03:00
|
|
|
::
|
|
|
|
%archive-graph
|
|
|
|
[%archive-graph (enjs:res resource.upd)]
|
|
|
|
::
|
|
|
|
%unarchive-graph
|
|
|
|
[%unarchive-graph (enjs:res resource.upd)]
|
2020-06-26 21:38:11 +03:00
|
|
|
::
|
|
|
|
%keys
|
|
|
|
[%keys [%a (turn ~(tap in resources.upd) enjs:res)]]
|
|
|
|
::
|
|
|
|
%tags
|
|
|
|
[%tags [%a (turn ~(tap in tags.upd) |=(=term s+term))]]
|
2020-06-30 04:14:55 +03:00
|
|
|
::
|
|
|
|
%run-updates
|
|
|
|
[%run-updates ~]
|
2020-06-26 21:38:11 +03:00
|
|
|
::
|
|
|
|
%tag-queries
|
|
|
|
:- %tag-queries
|
|
|
|
%- pairs
|
|
|
|
%+ turn ~(tap by tag-queries.upd)
|
2021-04-19 23:53:07 +03:00
|
|
|
|= [=term uids=(set ^uid)]
|
2020-06-26 21:38:11 +03:00
|
|
|
^- [cord json]
|
2021-04-19 23:53:07 +03:00
|
|
|
[term [%a (turn ~(tap in uids) uid)]]
|
2020-06-10 21:45:00 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
++ graph
|
|
|
|
|= g=^graph
|
|
|
|
^- json
|
2020-12-02 06:17:49 +03:00
|
|
|
%- pairs
|
|
|
|
%+ turn
|
|
|
|
(tap:orm g)
|
2020-06-10 23:47:18 +03:00
|
|
|
|= [a=atom n=^node]
|
2020-12-02 06:17:49 +03:00
|
|
|
^- [@t json]
|
|
|
|
:_ (node n)
|
2020-12-07 05:46:15 +03:00
|
|
|
=/ idx (numb a)
|
2020-12-02 06:17:49 +03:00
|
|
|
?> ?=(%n -.idx)
|
|
|
|
p.idx
|
|
|
|
::
|
2020-06-10 23:47:18 +03:00
|
|
|
++ node
|
|
|
|
|= n=^node
|
|
|
|
^- json
|
|
|
|
%- pairs
|
2021-04-14 00:17:39 +03:00
|
|
|
:~ [%post (maybe-post post.n)]
|
2020-06-10 23:47:18 +03:00
|
|
|
:- %children
|
|
|
|
?- -.children.n
|
|
|
|
%empty ~
|
|
|
|
%graph (graph +.children.n)
|
|
|
|
==
|
|
|
|
==
|
|
|
|
::
|
2020-06-10 21:45:00 +03:00
|
|
|
++ nodes
|
2020-06-10 23:47:18 +03:00
|
|
|
|= m=(map ^index ^node)
|
|
|
|
^- json
|
2020-12-02 06:17:49 +03:00
|
|
|
%- pairs
|
2020-06-10 23:47:18 +03:00
|
|
|
%+ turn ~(tap by m)
|
|
|
|
|= [n=^index o=^node]
|
2020-12-02 06:17:49 +03:00
|
|
|
^- [@t json]
|
|
|
|
:_ (node o)
|
2020-12-07 05:46:15 +03:00
|
|
|
=/ idx (index n)
|
2020-12-02 06:17:49 +03:00
|
|
|
?> ?=(%s -.idx)
|
|
|
|
p.idx
|
2020-06-10 21:45:00 +03:00
|
|
|
::
|
|
|
|
++ indices
|
|
|
|
|= i=(set ^index)
|
|
|
|
^- json
|
2020-06-10 23:47:18 +03:00
|
|
|
[%a (turn ~(tap in i) index)]
|
2020-06-10 21:45:00 +03:00
|
|
|
::
|
2020-06-05 22:22:36 +03:00
|
|
|
--
|
|
|
|
--
|
|
|
|
::
|
|
|
|
++ dejs
|
|
|
|
=, dejs:format
|
|
|
|
|%
|
2020-06-26 21:38:11 +03:00
|
|
|
++ update
|
2020-06-11 22:30:19 +03:00
|
|
|
|= jon=json
|
2020-06-26 21:38:11 +03:00
|
|
|
^- ^update
|
2020-06-30 04:14:55 +03:00
|
|
|
:- *time
|
2021-03-18 04:50:14 +03:00
|
|
|
^- action
|
2020-06-11 22:30:19 +03:00
|
|
|
=< (decode jon)
|
2020-06-11 21:25:49 +03:00
|
|
|
|%
|
|
|
|
++ decode
|
|
|
|
%- of
|
2020-08-28 01:31:36 +03:00
|
|
|
:~ [%add-nodes add-nodes]
|
2021-04-14 00:17:39 +03:00
|
|
|
[%remove-posts remove-posts]
|
2020-06-12 20:27:43 +03:00
|
|
|
[%add-signatures add-signatures]
|
2020-06-11 21:25:49 +03:00
|
|
|
[%remove-signatures remove-signatures]
|
2020-08-28 01:31:36 +03:00
|
|
|
::
|
|
|
|
[%add-graph add-graph]
|
|
|
|
[%remove-graph remove-graph]
|
|
|
|
::
|
2020-06-11 22:30:19 +03:00
|
|
|
[%add-tag add-tag]
|
|
|
|
[%remove-tag remove-tag]
|
2020-08-28 01:31:36 +03:00
|
|
|
::
|
2020-06-23 20:53:50 +03:00
|
|
|
[%archive-graph archive-graph]
|
|
|
|
[%unarchive-graph unarchive-graph]
|
2020-08-28 01:31:36 +03:00
|
|
|
[%run-updates run-updates]
|
|
|
|
::
|
2020-06-26 21:38:11 +03:00
|
|
|
[%keys keys]
|
|
|
|
[%tags tags]
|
|
|
|
[%tag-queries tag-queries]
|
2020-06-11 21:25:49 +03:00
|
|
|
==
|
|
|
|
::
|
2020-06-12 20:50:22 +03:00
|
|
|
++ add-graph
|
|
|
|
%- ot
|
|
|
|
:~ [%resource dejs:res]
|
|
|
|
[%graph graph]
|
2020-07-07 02:31:57 +03:00
|
|
|
[%mark (mu so)]
|
2020-11-12 23:40:12 +03:00
|
|
|
[%overwrite bo]
|
2020-06-12 20:50:22 +03:00
|
|
|
==
|
2020-06-12 20:27:43 +03:00
|
|
|
::
|
2020-06-12 20:50:22 +03:00
|
|
|
++ graph
|
|
|
|
|= a=json
|
|
|
|
^- ^graph
|
2021-06-08 18:46:23 +03:00
|
|
|
=/ or-mp ((on atom ^node) gth)
|
2020-06-12 20:50:22 +03:00
|
|
|
%+ gas:or-mp ~
|
|
|
|
%+ turn ~(tap by ((om node) a))
|
|
|
|
|* [b=cord c=*]
|
|
|
|
^- [atom ^node]
|
|
|
|
=> .(+< [b c]=+<)
|
|
|
|
[(rash b dem) c]
|
2020-06-11 21:25:49 +03:00
|
|
|
::
|
2020-06-11 22:30:19 +03:00
|
|
|
++ remove-graph (ot [%resource dejs:res]~)
|
2020-06-23 20:53:50 +03:00
|
|
|
++ archive-graph (ot [%resource dejs:res]~)
|
|
|
|
++ unarchive-graph (ot [%resource dejs:res]~)
|
2020-06-11 21:25:49 +03:00
|
|
|
::
|
2020-06-12 20:27:43 +03:00
|
|
|
++ add-nodes
|
|
|
|
%- ot
|
|
|
|
:~ [%resource dejs:res]
|
|
|
|
[%nodes nodes]
|
|
|
|
==
|
2020-06-11 21:25:49 +03:00
|
|
|
::
|
2020-11-15 08:08:52 +03:00
|
|
|
++ nodes (op ;~(pfix fas (more fas dem)) node)
|
2020-06-11 21:25:49 +03:00
|
|
|
::
|
2020-06-12 20:27:43 +03:00
|
|
|
++ node
|
|
|
|
%- ot
|
2021-04-14 00:17:39 +03:00
|
|
|
:~ [%post maybe-post]
|
2020-09-15 08:32:04 +03:00
|
|
|
[%children internal-graph]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ internal-graph
|
2020-12-02 06:17:49 +03:00
|
|
|
|= jon=json
|
|
|
|
^- ^internal-graph
|
|
|
|
?~ jon
|
|
|
|
[%empty ~]
|
|
|
|
[%graph (graph jon)]
|
2020-12-07 05:46:15 +03:00
|
|
|
::
|
2021-04-14 00:17:39 +03:00
|
|
|
++ maybe-post
|
|
|
|
|= jon=json
|
|
|
|
^- ^maybe-post
|
|
|
|
?~ jon !!
|
|
|
|
?+ -.jon !!
|
|
|
|
%s [%| (nu jon)]
|
|
|
|
%o [%& (post jon)]
|
|
|
|
==
|
|
|
|
::
|
2020-06-12 20:27:43 +03:00
|
|
|
++ post
|
|
|
|
%- ot
|
|
|
|
:~ [%author (su ;~(pfix sig fed:ag))]
|
2020-11-25 22:39:13 +03:00
|
|
|
[%index index]
|
2020-06-12 20:27:43 +03:00
|
|
|
[%time-sent di]
|
|
|
|
[%contents (ar content)]
|
|
|
|
[%hash (mu nu)]
|
|
|
|
[%signatures (as signature)]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ content
|
|
|
|
%- of
|
2020-11-03 03:39:24 +03:00
|
|
|
:~ [%mention (su ;~(pfix sig fed:ag))]
|
|
|
|
[%text so]
|
2020-06-12 20:27:43 +03:00
|
|
|
[%url so]
|
2021-03-18 04:50:14 +03:00
|
|
|
[%reference reference]
|
2020-06-12 20:27:43 +03:00
|
|
|
[%code eval]
|
|
|
|
==
|
|
|
|
::
|
2021-03-18 04:50:14 +03:00
|
|
|
++ reference
|
|
|
|
|^
|
|
|
|
%- of
|
|
|
|
:~ graph+graph
|
|
|
|
group+dejs-path:res
|
2021-09-18 02:25:32 +03:00
|
|
|
app+app
|
2021-03-18 04:50:14 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
++ graph
|
|
|
|
%- ot
|
|
|
|
:~ group+dejs-path:res
|
|
|
|
graph+dejs-path:res
|
|
|
|
index+index
|
|
|
|
==
|
2021-09-18 02:25:32 +03:00
|
|
|
::
|
|
|
|
++ app
|
|
|
|
%- ot
|
|
|
|
:~ ship+(su ;~(pfix sig fed:ag))
|
|
|
|
desk+so
|
|
|
|
path+so
|
|
|
|
==
|
2021-03-18 04:50:14 +03:00
|
|
|
--
|
|
|
|
::
|
2020-12-11 08:51:29 +03:00
|
|
|
++ tang
|
|
|
|
|= jon=^json
|
|
|
|
^- ^tang
|
|
|
|
?> ?=(%a -.jon)
|
|
|
|
%- zing
|
|
|
|
%+ turn
|
|
|
|
p.jon
|
|
|
|
|= jo=^json
|
|
|
|
^- (list tank)
|
|
|
|
?> ?=(%a -.jo)
|
|
|
|
%+ turn
|
|
|
|
p.jo
|
|
|
|
|= j=^json
|
|
|
|
?> ?=(%s -.j)
|
|
|
|
^- tank
|
|
|
|
leaf+(trip p.j)
|
|
|
|
::
|
2020-06-12 20:27:43 +03:00
|
|
|
++ eval
|
2020-12-11 08:51:29 +03:00
|
|
|
%- ot
|
|
|
|
:~ expression+so
|
|
|
|
output+tang
|
|
|
|
==
|
2020-06-12 20:27:43 +03:00
|
|
|
::
|
2021-04-14 00:17:39 +03:00
|
|
|
++ remove-posts
|
2020-06-12 20:27:43 +03:00
|
|
|
%- ot
|
|
|
|
:~ [%resource dejs:res]
|
|
|
|
[%indices (as index)]
|
|
|
|
==
|
2020-06-11 21:25:49 +03:00
|
|
|
::
|
|
|
|
++ add-signatures
|
|
|
|
%- ot
|
|
|
|
:~ [%uid uid]
|
|
|
|
[%signatures (as signature)]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ remove-signatures
|
|
|
|
%- ot
|
|
|
|
:~ [%uid uid]
|
|
|
|
[%signatures (as signature)]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ signature
|
|
|
|
%- ot
|
|
|
|
:~ [%hash nu]
|
|
|
|
[%ship (su ;~(pfix sig fed:ag))]
|
|
|
|
[%life ni]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ uid
|
|
|
|
%- ot
|
|
|
|
:~ [%resource dejs:res]
|
2020-11-25 22:39:13 +03:00
|
|
|
[%index index]
|
2020-06-11 21:25:49 +03:00
|
|
|
==
|
|
|
|
::
|
2020-11-15 08:08:52 +03:00
|
|
|
++ index (su ;~(pfix fas (more fas dem)))
|
2020-06-11 21:25:49 +03:00
|
|
|
::
|
2020-06-11 22:30:19 +03:00
|
|
|
++ add-tag
|
2020-06-11 21:25:49 +03:00
|
|
|
%- ot
|
2020-06-11 22:30:19 +03:00
|
|
|
:~ [%term so]
|
2021-04-19 23:53:07 +03:00
|
|
|
[%uid uid]
|
2020-06-11 21:25:49 +03:00
|
|
|
==
|
|
|
|
::
|
2020-06-11 22:30:19 +03:00
|
|
|
++ remove-tag
|
2020-06-11 21:25:49 +03:00
|
|
|
%- ot
|
2020-06-11 22:30:19 +03:00
|
|
|
:~ [%term so]
|
2021-04-19 23:53:07 +03:00
|
|
|
[%uid uid]
|
2020-06-11 21:25:49 +03:00
|
|
|
==
|
2020-06-26 21:38:11 +03:00
|
|
|
::
|
|
|
|
++ keys
|
|
|
|
|= =json
|
|
|
|
*resources
|
|
|
|
::
|
|
|
|
++ tags
|
|
|
|
|= =json
|
|
|
|
*(set term)
|
|
|
|
::
|
|
|
|
++ tag-queries
|
|
|
|
|= =json
|
|
|
|
*^tag-queries
|
2020-06-30 04:14:55 +03:00
|
|
|
::
|
|
|
|
++ run-updates
|
|
|
|
|= a=json
|
|
|
|
^- [resource update-log]
|
|
|
|
[*resource *update-log]
|
2020-06-11 21:25:49 +03:00
|
|
|
--
|
2020-06-05 22:22:36 +03:00
|
|
|
--
|
2020-06-10 19:17:55 +03:00
|
|
|
::
|
2020-06-12 20:50:22 +03:00
|
|
|
++ create
|
|
|
|
|_ [our=ship now=time]
|
|
|
|
++ post
|
|
|
|
|= [=index contents=(list content)]
|
|
|
|
^- ^post
|
|
|
|
:* our
|
|
|
|
index
|
|
|
|
now
|
|
|
|
contents
|
|
|
|
~
|
|
|
|
*signatures
|
|
|
|
==
|
|
|
|
--
|
2021-04-13 23:37:32 +03:00
|
|
|
::
|
|
|
|
++ upgrade
|
|
|
|
|%
|
2021-04-14 22:26:36 +03:00
|
|
|
::
|
|
|
|
:: +two
|
|
|
|
::
|
|
|
|
++ marked-graph-to-two
|
|
|
|
|= [=graph:one m=(unit mark)]
|
|
|
|
[(graph-to-two graph) m]
|
|
|
|
::
|
|
|
|
++ graph-to-two
|
|
|
|
|= =graph:one
|
|
|
|
(graph:(upgrade ,post:one ,maybe-post) graph post-to-two)
|
|
|
|
::
|
|
|
|
++ post-to-two
|
|
|
|
|= p=post:one
|
|
|
|
^- maybe-post
|
|
|
|
[%& p]
|
|
|
|
::
|
2021-06-08 18:46:23 +03:00
|
|
|
::
|
|
|
|
:: +one
|
|
|
|
::
|
|
|
|
++ update-log-to-one
|
|
|
|
|= =update-log:zero
|
|
|
|
^- update-log:one
|
|
|
|
%+ gas:orm-log:one *update-log:one
|
|
|
|
%+ turn (tap:orm-log:zero update-log)
|
|
|
|
|= [=time =logged-update:zero]
|
|
|
|
^- [^time logged-update:one]
|
|
|
|
:- time
|
|
|
|
:- p.logged-update
|
|
|
|
(logged-update-to-one q.logged-update)
|
|
|
|
::
|
|
|
|
++ logged-update-to-one
|
|
|
|
|= upd=logged-update-0:zero
|
|
|
|
^- logged-action:one
|
|
|
|
?+ -.upd upd
|
|
|
|
%add-graph upd(graph (graph-to-one graph.upd))
|
|
|
|
%add-nodes upd(nodes (~(run by nodes.upd) node-to-one))
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ node-to-one
|
|
|
|
|= =node:zero
|
|
|
|
(node:(upgrade ,post:zero ,post) node post-to-one)
|
|
|
|
::
|
|
|
|
++ graph-to-one
|
|
|
|
|= =graph:zero
|
|
|
|
(graph:(upgrade ,post:zero ,post) graph post-to-one)
|
|
|
|
::
|
|
|
|
++ marked-graph-to-one
|
|
|
|
|= [=graph:zero m=(unit mark)]
|
|
|
|
[(graph-to-one graph) m]
|
|
|
|
::
|
|
|
|
++ post-to-one
|
|
|
|
|= p=post:zero
|
|
|
|
^- post
|
|
|
|
p(contents (contents-to-one contents.p))
|
|
|
|
::
|
|
|
|
++ contents-to-one
|
|
|
|
|= cs=(list content:zero)
|
|
|
|
^- (list content)
|
|
|
|
%+ murn cs
|
|
|
|
|= =content:zero
|
|
|
|
^- (unit ^content)
|
|
|
|
?: ?=(%reference -.content) ~
|
|
|
|
`content
|
|
|
|
::
|
2021-04-13 23:37:32 +03:00
|
|
|
++ upgrade
|
|
|
|
|* [in-pst=mold out-pst=mold]
|
|
|
|
=>
|
|
|
|
|%
|
|
|
|
++ in-orm
|
2021-06-08 18:46:23 +03:00
|
|
|
((on atom in-node) gth)
|
2021-04-13 23:37:32 +03:00
|
|
|
+$ in-node
|
|
|
|
[post=in-pst children=in-internal-graph]
|
|
|
|
+$ in-graph
|
|
|
|
((mop atom in-node) gth)
|
|
|
|
+$ in-internal-graph
|
|
|
|
$~ [%empty ~]
|
|
|
|
$% [%graph p=in-graph]
|
|
|
|
[%empty ~]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ out-orm
|
2021-06-08 18:46:23 +03:00
|
|
|
((on atom out-node) gth)
|
2021-04-13 23:37:32 +03:00
|
|
|
+$ out-node
|
|
|
|
[post=out-pst children=out-internal-graph]
|
|
|
|
+$ out-graph
|
|
|
|
((mop atom out-node) gth)
|
|
|
|
+$ out-internal-graph
|
|
|
|
$~ [%empty ~]
|
|
|
|
$% [%graph p=out-graph]
|
|
|
|
[%empty ~]
|
|
|
|
==
|
|
|
|
--
|
|
|
|
|%
|
|
|
|
::
|
|
|
|
++ graph
|
|
|
|
|= $: gra=in-graph
|
|
|
|
fn=$-(in-pst out-pst)
|
|
|
|
==
|
|
|
|
^- out-graph
|
|
|
|
%+ gas:out-orm *out-graph
|
|
|
|
^- (list [atom out-node])
|
|
|
|
%+ turn (tap:in-orm gra)
|
|
|
|
|= [a=atom n=in-node]
|
|
|
|
^- [atom out-node]
|
|
|
|
[a (node n fn)]
|
|
|
|
::
|
|
|
|
++ node
|
|
|
|
|= [nod=in-node fn=$-(in-pst out-pst)]
|
|
|
|
^- out-node
|
|
|
|
:- (fn post.nod)
|
|
|
|
^- out-internal-graph
|
|
|
|
?: ?=(%empty -.children.nod)
|
|
|
|
[%empty ~]
|
|
|
|
[%graph (graph p.children.nod fn)]
|
|
|
|
--
|
2021-06-08 18:46:23 +03:00
|
|
|
::
|
|
|
|
++ zero-load
|
|
|
|
:: =* infinitely recurses
|
|
|
|
=, store=zero
|
|
|
|
=, orm=orm:zero
|
|
|
|
=, orm-log=orm-log:zero
|
|
|
|
|%
|
|
|
|
++ change-revision-graph
|
|
|
|
|= [=graph:store q=(unit mark)]
|
|
|
|
^- [graph:store (unit mark)]
|
|
|
|
|^
|
|
|
|
:_ q
|
|
|
|
?+ q graph
|
|
|
|
[~ %graph-validator-link] convert-links
|
|
|
|
[~ %graph-validator-publish] convert-publish
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ convert-links
|
|
|
|
%+ gas:orm *graph:store
|
|
|
|
%+ turn (tap:orm graph)
|
|
|
|
|= [=atom =node:store]
|
|
|
|
^- [^atom node:store]
|
|
|
|
:: top-level
|
|
|
|
::
|
|
|
|
:+ atom post.node
|
|
|
|
?: ?=(%empty -.children.node)
|
|
|
|
[%empty ~]
|
|
|
|
:- %graph
|
|
|
|
%+ gas:orm *graph:store
|
|
|
|
%+ turn (tap:orm p.children.node)
|
|
|
|
|= [=^atom =node:store]
|
|
|
|
^- [^^atom node:store]
|
|
|
|
:: existing comments get turned into containers for revisions
|
|
|
|
::
|
|
|
|
:^ atom
|
|
|
|
post.node(contents ~, hash ~)
|
|
|
|
%graph
|
|
|
|
%+ gas:orm *graph:store
|
|
|
|
:_ ~ :- %0
|
|
|
|
:_ [%empty ~]
|
|
|
|
post.node(index (snoc index.post.node atom), hash ~)
|
|
|
|
::
|
|
|
|
++ convert-publish
|
|
|
|
%+ gas:orm *graph:store
|
|
|
|
%+ turn (tap:orm graph)
|
|
|
|
|= [=atom =node:store]
|
|
|
|
^- [^atom node:store]
|
|
|
|
:: top-level
|
|
|
|
::
|
|
|
|
:+ atom post.node
|
|
|
|
?: ?=(%empty -.children.node)
|
|
|
|
[%empty ~]
|
|
|
|
:- %graph
|
|
|
|
%+ gas:orm *graph:store
|
|
|
|
%+ turn (tap:orm p.children.node)
|
|
|
|
|= [=^atom =node:store]
|
|
|
|
^- [^^atom node:store]
|
|
|
|
:: existing container for publish note revisions
|
|
|
|
::
|
|
|
|
?+ atom !!
|
|
|
|
%1 [atom node]
|
|
|
|
%2
|
|
|
|
:+ atom post.node
|
|
|
|
?: ?=(%empty -.children.node)
|
|
|
|
[%empty ~]
|
|
|
|
:- %graph
|
|
|
|
%+ gas:orm *graph:store
|
|
|
|
%+ turn (tap:orm p.children.node)
|
|
|
|
|= [=^^atom =node:store]
|
|
|
|
^- [^^^atom node:store]
|
|
|
|
:+ atom post.node(contents ~, hash ~)
|
|
|
|
:- %graph
|
|
|
|
%+ gas:orm *graph:store
|
|
|
|
:_ ~ :- %1
|
|
|
|
:_ [%empty ~]
|
|
|
|
post.node(index (snoc index.post.node atom), hash ~)
|
|
|
|
==
|
|
|
|
--
|
|
|
|
::
|
|
|
|
++ maybe-unix-to-da
|
|
|
|
|= =atom
|
|
|
|
^- @
|
|
|
|
:: (bex 127) is roughly 226AD
|
|
|
|
?. (lte atom (bex 127))
|
|
|
|
atom
|
|
|
|
(add ~1970.1.1 (div (mul ~s1 atom) 1.000))
|
|
|
|
::
|
|
|
|
++ convert-unix-timestamped-node
|
|
|
|
|= =node:store
|
|
|
|
^- node:store
|
|
|
|
=. index.post.node
|
|
|
|
(convert-unix-timestamped-index index.post.node)
|
|
|
|
?. ?=(%graph -.children.node)
|
|
|
|
node
|
|
|
|
:+ post.node
|
|
|
|
%graph
|
|
|
|
(convert-unix-timestamped-graph p.children.node)
|
|
|
|
::
|
|
|
|
++ convert-unix-timestamped-index
|
|
|
|
|= =index:store
|
|
|
|
(turn index maybe-unix-to-da)
|
|
|
|
::
|
|
|
|
++ convert-unix-timestamped-graph
|
|
|
|
|= =graph:store
|
|
|
|
%+ gas:orm *graph:store
|
|
|
|
%+ turn
|
|
|
|
(tap:orm graph)
|
|
|
|
|= [=atom =node:store]
|
|
|
|
^- [^atom node:store]
|
|
|
|
:- (maybe-unix-to-da atom)
|
|
|
|
(convert-unix-timestamped-node node)
|
|
|
|
--
|
2021-04-13 23:37:32 +03:00
|
|
|
--
|
2021-04-14 22:26:36 +03:00
|
|
|
++ import
|
|
|
|
|= [arc=* our=ship]
|
2021-04-30 15:16:48 +03:00
|
|
|
^- (quip card:agent:gall [%5 network])
|
2021-04-14 22:26:36 +03:00
|
|
|
|^
|
2021-04-30 15:16:48 +03:00
|
|
|
=/ sty [%5 (remake-network ;;(tree-network +.arc))]
|
2021-04-14 22:26:36 +03:00
|
|
|
:_ sty
|
|
|
|
%+ turn ~(tap by graphs.sty)
|
|
|
|
|= [rid=resource =marked-graph]
|
|
|
|
^- card:agent:gall
|
|
|
|
?: =(our entity.rid)
|
|
|
|
=/ =cage [%push-hook-action !>([%add rid])]
|
|
|
|
[%pass / %agent [our %graph-push-hook] %poke cage]
|
|
|
|
(try-rejoin rid 0)
|
|
|
|
::
|
|
|
|
+$ tree-network
|
|
|
|
$: graphs=tree-graphs
|
2021-04-19 23:53:07 +03:00
|
|
|
tag-queries=(tree [term (tree uid)])
|
2021-04-14 22:26:36 +03:00
|
|
|
update-logs=tree-update-logs
|
|
|
|
archive=tree-graphs
|
2021-04-26 21:28:13 +03:00
|
|
|
~
|
2021-04-14 22:26:36 +03:00
|
|
|
==
|
|
|
|
+$ tree-graphs (tree [resource tree-marked-graph])
|
|
|
|
+$ tree-marked-graph [p=tree-graph q=(unit ^mark)]
|
|
|
|
+$ tree-graph (tree [atom tree-node])
|
|
|
|
+$ tree-node [post=tree-maybe-post children=tree-internal-graph]
|
|
|
|
+$ tree-internal-graph
|
|
|
|
$~ [%empty ~]
|
|
|
|
$% [%graph p=tree-graph]
|
|
|
|
[%empty ~]
|
|
|
|
==
|
|
|
|
+$ tree-update-logs (tree [resource tree-update-log])
|
|
|
|
+$ tree-update-log (tree [time tree-logged-update])
|
|
|
|
+$ tree-logged-update
|
|
|
|
$: p=time
|
|
|
|
$= q
|
|
|
|
$% [%add-graph =resource =tree-graph mark=(unit ^mark) ow=?]
|
|
|
|
[%add-nodes =resource nodes=(tree [index tree-node])]
|
|
|
|
[%remove-posts =resource indices=(tree index)]
|
|
|
|
[%add-signatures =uid signatures=tree-signatures]
|
|
|
|
[%remove-signatures =uid signatures=tree-signatures]
|
|
|
|
==
|
|
|
|
==
|
|
|
|
+$ tree-signatures (tree signature)
|
|
|
|
+$ tree-maybe-post (each tree-post hash)
|
|
|
|
+$ tree-post
|
|
|
|
$: author=ship
|
|
|
|
=index
|
|
|
|
time-sent=time
|
|
|
|
contents=(list content)
|
|
|
|
hash=(unit hash)
|
|
|
|
signatures=tree-signatures
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ remake-network
|
|
|
|
|= t=tree-network
|
|
|
|
^- network
|
|
|
|
:* (remake-graphs graphs.t)
|
|
|
|
(remake-jug:migrate tag-queries.t)
|
|
|
|
(remake-update-logs update-logs.t)
|
|
|
|
(remake-graphs archive.t)
|
2021-04-26 21:28:13 +03:00
|
|
|
~
|
2021-04-14 22:26:36 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
++ remake-graphs
|
|
|
|
|= t=tree-graphs
|
|
|
|
^- graphs
|
|
|
|
%- remake-map:migrate
|
|
|
|
(~(run by t) remake-marked-graph)
|
|
|
|
::
|
|
|
|
++ remake-marked-graph
|
|
|
|
|= t=tree-marked-graph
|
|
|
|
^- marked-graph
|
|
|
|
[(remake-graph p.t) q.t]
|
|
|
|
::
|
|
|
|
++ remake-graph
|
|
|
|
|= t=tree-graph
|
|
|
|
^- graph
|
|
|
|
%+ gas:orm *graph
|
|
|
|
%+ turn ~(tap by t)
|
|
|
|
|= [a=atom tn=tree-node]
|
|
|
|
^- [atom node]
|
|
|
|
[a (remake-node tn)]
|
|
|
|
::
|
|
|
|
++ remake-internal-graph
|
|
|
|
|= t=tree-internal-graph
|
|
|
|
^- internal-graph
|
|
|
|
?: ?=(%empty -.t)
|
|
|
|
[%empty ~]
|
|
|
|
[%graph (remake-graph p.t)]
|
|
|
|
::
|
|
|
|
++ remake-node
|
|
|
|
|= t=tree-node
|
|
|
|
^- node
|
|
|
|
:- (remake-post post.t)
|
|
|
|
(remake-internal-graph children.t)
|
|
|
|
::
|
|
|
|
++ remake-update-logs
|
|
|
|
|= t=tree-update-logs
|
|
|
|
^- update-logs
|
|
|
|
%- remake-map:migrate
|
|
|
|
(~(run by t) remake-update-log)
|
|
|
|
::
|
|
|
|
++ remake-update-log
|
|
|
|
|= t=tree-update-log
|
|
|
|
^- update-log
|
2021-06-08 18:46:23 +03:00
|
|
|
=/ ulm ((on time logged-update) gth)
|
2021-04-14 22:26:36 +03:00
|
|
|
%+ gas:ulm *update-log
|
|
|
|
%+ turn ~(tap by t)
|
|
|
|
|= [=time tlu=tree-logged-update]
|
|
|
|
^- [^time logged-update]
|
|
|
|
[time (remake-logged-update tlu)]
|
|
|
|
::
|
|
|
|
++ remake-logged-update
|
|
|
|
|= t=tree-logged-update
|
|
|
|
^- logged-update
|
|
|
|
:- p.t
|
|
|
|
?- -.q.t
|
|
|
|
%add-graph
|
|
|
|
:* %add-graph
|
|
|
|
resource.q.t
|
|
|
|
(remake-graph tree-graph.q.t)
|
|
|
|
mark.q.t
|
|
|
|
ow.q.t
|
|
|
|
==
|
|
|
|
::
|
|
|
|
%add-nodes
|
|
|
|
:- %add-nodes
|
|
|
|
:- resource.q.t
|
|
|
|
%- remake-map:migrate
|
|
|
|
(~(run by nodes.q.t) remake-node)
|
|
|
|
::
|
|
|
|
%remove-posts
|
|
|
|
[%remove-posts resource.q.t (remake-set:migrate indices.q.t)]
|
|
|
|
::
|
|
|
|
%add-signatures
|
|
|
|
[%add-signatures uid.q.t (remake-set:migrate signatures.q.t)]
|
|
|
|
::
|
|
|
|
%remove-signatures
|
|
|
|
[%remove-signatures uid.q.t (remake-set:migrate signatures.q.t)]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ remake-post
|
|
|
|
|= t=tree-maybe-post
|
|
|
|
^- maybe-post
|
|
|
|
?- -.t
|
|
|
|
%| t
|
|
|
|
%& t(signatures.p (remake-set:migrate signatures.p.t))
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ try-rejoin
|
|
|
|
|= [rid=resource nack-count=@]
|
|
|
|
^- card:agent:gall
|
|
|
|
=/ res-path (en-path:res rid)
|
|
|
|
=/ wire [%try-rejoin (scot %ud nack-count) res-path]
|
2021-07-20 07:14:16 +03:00
|
|
|
=/ =cage
|
|
|
|
:- %pull-hook-action
|
|
|
|
!> ^- action:pull-hook
|
|
|
|
[%add [entity .]:rid]
|
|
|
|
[%pass wire %agent [our %graph-pull-hook] %poke cage]
|
2021-04-14 22:26:36 +03:00
|
|
|
--
|
2020-06-05 22:22:36 +03:00
|
|
|
--
|