mirror of
https://github.com/urbit/shrub.git
synced 2024-11-28 22:33:06 +03:00
Merge master into mingw-port to make typescript-check.yml happy
This commit is contained in:
commit
aea35d54ab
2
.github/workflows/glob.yml
vendored
2
.github/workflows/glob.yml
vendored
@ -2,7 +2,7 @@ name: glob
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'release/next-js'
|
||||
- 'release/next-userspace'
|
||||
jobs:
|
||||
glob:
|
||||
runs-on: ubuntu-latest
|
||||
|
4
.github/workflows/merge-master.yml
vendored
4
.github/workflows/merge-master.yml
vendored
@ -6,13 +6,13 @@ on:
|
||||
jobs:
|
||||
merge-to-next-js:
|
||||
runs-on: ubuntu-latest
|
||||
name: "Merge master to release/next-js"
|
||||
name: "Merge master to release/next-userspace"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: devmasx/merge-branch@v1.3.1
|
||||
with:
|
||||
type: now
|
||||
target_branch: release/next-js
|
||||
target_branch: release/next-userspace
|
||||
github_token: ${{ secrets.JANEWAY_BOT_TOKEN }}
|
||||
|
||||
merge-to-group-timer:
|
||||
|
14
.github/workflows/typescript-check.yml
vendored
Normal file
14
.github/workflows/typescript-check.yml
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
name: typescript-check
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'pkg/interface/**'
|
||||
|
||||
jobs:
|
||||
typescript-check:
|
||||
runs-on: ubuntu-latest
|
||||
name: "Check pkg/interface types"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: cd 'pkg/interface' && npm i && npm run tsc
|
@ -309,9 +309,9 @@ the new binary, and restarting the pier with it.
|
||||
#### Continuous deployment
|
||||
|
||||
A subset of release branches are deployed continuously to the network. Thus far
|
||||
this only includes `release/next-js`, which deploys livenet-compatible
|
||||
JavaScript changes to select QA ships. Any push to master will automatically
|
||||
merge master into `release/next-js` to keep the streams at parity.
|
||||
this only includes `release/next-userspace`, which deploys livenet-compatible
|
||||
changes to select QA ships. Any push to master will automatically
|
||||
merge master into `release/next-userspace` to keep the streams at parity.
|
||||
|
||||
### Announce the update
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f6b5e33e573818120051651c1182163527edbbe0dff0eb6591e12a55cfccb273
|
||||
size 10486101
|
||||
oid sha256:88acd8aa1aae3d11579ada954b6e0b06c940de7856d22017cc1a1442de97fcf3
|
||||
size 13650762
|
||||
|
@ -1394,8 +1394,6 @@
|
||||
^+ this
|
||||
?: =(~ dom)
|
||||
~|(%acme-empty-certificate-order !!)
|
||||
?: ?=(?(%earl %pawn) (clan:title our.bow))
|
||||
this
|
||||
=. ..emit (queue-next-order 1 | dom)
|
||||
=. ..emit cancel-current-order
|
||||
:: notify %dill
|
||||
|
@ -169,7 +169,7 @@
|
||||
::
|
||||
%fact
|
||||
?+ p.cage.sign ~|([dap.bowl %bad-sub-mark wire p.cage.sign] !!)
|
||||
%graph-update-1
|
||||
%graph-update-2
|
||||
%- on-graph-update:tc
|
||||
!<(update:graph q.cage.sign)
|
||||
==
|
||||
@ -401,12 +401,16 @@
|
||||
:: +read-post: add envelope to state and show it to user
|
||||
::
|
||||
++ read-post
|
||||
|= [=target =index:post =post:post]
|
||||
|= [=target =index:post =maybe-post:graph]
|
||||
^- (quip card _session)
|
||||
:- (show-post:sh-out target post)
|
||||
%_ session
|
||||
history [[target index] history.session]
|
||||
count +(count.session)
|
||||
?- -.maybe-post
|
||||
%| [~ session]
|
||||
%&
|
||||
:- (show-post:sh-out target p.maybe-post)
|
||||
%_ session
|
||||
history [[target index] history.session]
|
||||
count +(count.session)
|
||||
==
|
||||
==
|
||||
::
|
||||
++ notice-remove
|
||||
@ -734,7 +738,8 @@
|
||||
::
|
||||
?. (is-chat-graph target)
|
||||
[[(note:sh-out "no such chat")]~ put-ses]
|
||||
=. viewing (~(put in viewing) target)
|
||||
=. audience target
|
||||
=. viewing (~(put in viewing) target)
|
||||
=^ cards state
|
||||
?: (~(has by bound) target)
|
||||
[~ state]
|
||||
@ -758,15 +763,15 @@
|
||||
::TODO move creation into lib?
|
||||
%^ act %out-message
|
||||
%graph-push-hook
|
||||
:- %graph-update-1
|
||||
:- %graph-update-2
|
||||
!> ^- update:graph
|
||||
:- now.bowl
|
||||
:+ %add-nodes audience
|
||||
%- ~(put by *(map index:post node:graph))
|
||||
:- ~[now.bowl]
|
||||
:_ *internal-graph:graph
|
||||
^- post:post
|
||||
[our-self ~[now.bowl] now.bowl [msg]~ ~ ~]
|
||||
^- maybe-post:graph
|
||||
[%& `post:post`[our-self ~[now.bowl] now.bowl [msg]~ ~ ~]]
|
||||
:: +eval: run hoon, send code and result as message
|
||||
::
|
||||
:: this double-virtualizes and clams to disable .^ for security reasons
|
||||
@ -890,10 +895,12 @@
|
||||
=/ =uid:post (snag index history)
|
||||
=/ =node:graph (got-node:libgraph uid)
|
||||
=. audience resource.uid
|
||||
?: ?=(%| -.post.node)
|
||||
[~ state]
|
||||
:_ put-ses
|
||||
^- (list card)
|
||||
:~ (print:sh-out ['?' ' ' number])
|
||||
(effect:sh-out ~(render-activate mr resource.uid post.node))
|
||||
(effect:sh-out ~(render-activate mr resource.uid p.post.node))
|
||||
prompt:sh-out
|
||||
==
|
||||
--
|
||||
|
@ -154,7 +154,7 @@
|
||||
++ poke-graph-store
|
||||
|= =update:graph-store
|
||||
^- card
|
||||
(poke-our %graph-store %graph-update-1 !>(update))
|
||||
(poke-our %graph-store %graph-update-2 !>(update))
|
||||
::
|
||||
++ nobody
|
||||
^- @p
|
||||
|
@ -1,334 +1,28 @@
|
||||
:: chat-store [landscape]:
|
||||
:: chat-store [landscape]: deprecated
|
||||
::
|
||||
:: data store that holds linear sequences of chat messages
|
||||
::
|
||||
/- *group, store=chat-store
|
||||
/+ default-agent, verb, dbug, group-store,
|
||||
graph-store, resource, *migrate, grpl=group, mdl=metadata
|
||||
~% %chat-store-top ..part ~
|
||||
/- store=chat-store
|
||||
/+ default-agent
|
||||
|%
|
||||
+$ card card:agent:gall
|
||||
+$ versioned-state
|
||||
$% state-0
|
||||
state-1
|
||||
state-2
|
||||
state-3
|
||||
state-4
|
||||
==
|
||||
::
|
||||
+$ state-0 [%0 =inbox:store]
|
||||
+$ state-1 [%1 =inbox:store]
|
||||
+$ state-2 [%2 =inbox:store]
|
||||
+$ state-3 [%3 =inbox:store]
|
||||
+$ state-4 [%4 =inbox:store]
|
||||
+$ admin-action
|
||||
$% [%trim ~]
|
||||
[%migrate-graph ~]
|
||||
==
|
||||
--
|
||||
::
|
||||
=| state-4
|
||||
=* state -
|
||||
::
|
||||
%- agent:dbug
|
||||
%+ verb |
|
||||
^- agent:gall
|
||||
=<
|
||||
~% %chat-store-agent-core ..peek-x-envelopes ~
|
||||
|_ =bowl:gall
|
||||
+* this .
|
||||
chat-core +>
|
||||
cc ~(. chat-core bowl)
|
||||
def ~(. (default-agent this %|) bowl)
|
||||
::
|
||||
++ on-init on-init:def
|
||||
++ on-save !>(state)
|
||||
++ on-load
|
||||
|= old-vase=vase
|
||||
^- (quip card _this)
|
||||
|^
|
||||
=/ old !<(versioned-state old-vase)
|
||||
=| cards=(list card)
|
||||
|-
|
||||
^- (quip card _this)
|
||||
?- -.old
|
||||
%4 [cards this(state old)]
|
||||
::
|
||||
%3
|
||||
=. cards :_(cards (poke-admin %migrate-graph ~))
|
||||
$(old [%4 inbox.old])
|
||||
::
|
||||
%2
|
||||
=/ =inbox:store
|
||||
(migrate-path-map:group-store inbox.old)
|
||||
=/ kick-paths
|
||||
%~ tap in
|
||||
%+ roll
|
||||
~(val by sup.bowl)
|
||||
|= [[=ship sub=path] subs=(set path)]
|
||||
^- (set path)
|
||||
?. ?=([@ @ *] sub)
|
||||
subs
|
||||
?. &(=(%mailbox i.sub) =('~' i.t.sub))
|
||||
subs
|
||||
(~(put in subs) sub)
|
||||
=? cards ?=(^ kick-paths)
|
||||
:_ cards
|
||||
[%give %kick kick-paths ~]
|
||||
$(old [%3 inbox])
|
||||
::
|
||||
?(%0 %1) $(old (old-to-2 inbox.old))
|
||||
::
|
||||
==
|
||||
++ poke-admin
|
||||
|= =admin-action
|
||||
^- card
|
||||
[%pass / %agent [our dap]:bowl %poke noun+!>(admin-action)]
|
||||
::
|
||||
++ old-to-2
|
||||
|= =inbox:store
|
||||
^- state-2
|
||||
:- %2
|
||||
%- ~(run by inbox)
|
||||
|= =mailbox:store
|
||||
^- mailbox:store
|
||||
[config.mailbox (flop envelopes.mailbox)]
|
||||
--
|
||||
::
|
||||
++ on-poke
|
||||
~/ %chat-store-poke
|
||||
|= [=mark =vase]
|
||||
^- (quip card _this)
|
||||
?> (team:title our.bowl src.bowl)
|
||||
=^ cards state
|
||||
?+ mark (on-poke:def mark vase)
|
||||
%noun (poke-noun:cc !<(admin-action vase))
|
||||
%import (poke-import:cc q.vase)
|
||||
==
|
||||
[cards this]
|
||||
::
|
||||
++ on-watch on-watch:def
|
||||
++ on-leave on-leave:def
|
||||
++ on-peek
|
||||
~/ %chat-store-peek
|
||||
|= =path
|
||||
^- (unit (unit cage))
|
||||
?+ path (on-peek:def path)
|
||||
[%x %all ~] ``noun+!>(inbox)
|
||||
[%x %keys ~] ``noun+!>(~(key by inbox))
|
||||
[%x %envelopes *] (peek-x-envelopes:cc t.t.path)
|
||||
[%x %mailbox *]
|
||||
?~ t.t.path
|
||||
~
|
||||
``noun+!>((~(get by inbox) t.t.path))
|
||||
::
|
||||
[%x %config *]
|
||||
?~ t.t.path
|
||||
~
|
||||
=/ mailbox (~(get by inbox) t.t.path)
|
||||
?~ mailbox
|
||||
~
|
||||
``noun+!>(config.u.mailbox)
|
||||
::
|
||||
[%x %export ~]
|
||||
``noun+!>(state)
|
||||
==
|
||||
::
|
||||
++ on-agent on-agent:def
|
||||
++ on-arvo on-arvo:def
|
||||
++ on-fail on-fail:def
|
||||
--
|
||||
|_ =bowl:gall
|
||||
+* this .
|
||||
def ~(. (default-agent this %|) bowl)
|
||||
::
|
||||
~% %chat-store-library ..card ~
|
||||
|_ bol=bowl:gall
|
||||
++ met ~(. mdl bol)
|
||||
++ grp ~(. grpl bol)
|
||||
++ on-init on-init:def
|
||||
++ on-save !>(~)
|
||||
++ on-load
|
||||
|= old-vase=vase
|
||||
^- (quip card _this)
|
||||
[~ this]
|
||||
::
|
||||
++ peek-x-envelopes
|
||||
|= pax=path
|
||||
^- (unit (unit [%noun vase]))
|
||||
?+ pax ~
|
||||
[@ @ *]
|
||||
=/ mail-path t.t.pax
|
||||
=/ mailbox (~(get by inbox) mail-path)
|
||||
?~ mailbox
|
||||
[~ ~ %noun !>(~)]
|
||||
=* envelopes envelopes.u.mailbox
|
||||
=/ sign-test=[?(%neg %pos) @]
|
||||
%- need
|
||||
%+ rush i.pax
|
||||
;~ pose
|
||||
%+ cook
|
||||
|= n=@
|
||||
[%neg n]
|
||||
;~(pfix hep dem:ag)
|
||||
::
|
||||
%+ cook
|
||||
|= n=@
|
||||
[%pos n]
|
||||
dem:ag
|
||||
==
|
||||
=* length length.config.u.mailbox
|
||||
=* start +.sign-test
|
||||
?: =(-.sign-test %neg)
|
||||
?: (gth start length)
|
||||
[~ ~ %noun !>(envelopes)]
|
||||
[~ ~ %noun !>((swag [(sub length start) start] envelopes))]
|
||||
::
|
||||
=/ end (slav %ud i.t.pax)
|
||||
?. (lte start end)
|
||||
~
|
||||
=. end ?:((lth end length) end length)
|
||||
[~ ~ %noun !>((swag [start (sub end start)] envelopes))]
|
||||
==
|
||||
::
|
||||
++ poke-noun
|
||||
|= nou=admin-action
|
||||
^- (quip card _state)
|
||||
?: ?=([%migrate-graph ~] nou)
|
||||
:_ state
|
||||
(migrate-inbox inbox)
|
||||
~& %trimming-chat-store
|
||||
:- ~
|
||||
%_ state
|
||||
inbox
|
||||
%- ~(urn by inbox)
|
||||
|= [=path mailbox:store]
|
||||
^- mailbox:store
|
||||
=/ [a=* out=(list envelope:store)]
|
||||
%+ roll envelopes
|
||||
|= $: =envelope:store
|
||||
o=[[hav=(set serial:store) curr=@] out=(list envelope:store)]
|
||||
==
|
||||
?: (~(has in hav.o) uid.envelope)
|
||||
[[hav.o curr.o] out.o]
|
||||
:-
|
||||
^- [(set serial:store) @]
|
||||
[(~(put in hav.o) uid.envelope) +(curr.o)]
|
||||
^- (list envelope:store)
|
||||
[envelope(number curr.o) out.o]
|
||||
=/ len (lent out)
|
||||
~? !=(len (lent envelopes)) [path [%old (lent envelopes)] [%new len]]
|
||||
[[len len] (flop out)]
|
||||
==
|
||||
::
|
||||
++ poke-import
|
||||
|= arc=*
|
||||
^- (quip card _state)
|
||||
=/ sty=state-4 [%4 (remake-map ;;((tree [path mailbox:store]) +.arc))]
|
||||
:_ sty
|
||||
(migrate-inbox inbox.sty)
|
||||
::
|
||||
++ update-subscribers
|
||||
|= [pax=path =update:store]
|
||||
^- (list card)
|
||||
[%give %fact ~[pax] %chat-update !>(update)]~
|
||||
::
|
||||
++ send-diff
|
||||
|= [pax=path upd=update:store]
|
||||
^- (list card)
|
||||
%- zing
|
||||
:~ (update-subscribers /all upd)
|
||||
(update-subscribers /updates upd)
|
||||
(update-subscribers [%mailbox pax] upd)
|
||||
?. |(|(=(%read -.upd) =(%message -.upd)) =(%messages -.upd))
|
||||
~
|
||||
?. |(=(%create -.upd) =(%delete -.upd))
|
||||
~
|
||||
(update-subscribers /keys upd)
|
||||
==
|
||||
::
|
||||
++ migrate-inbox
|
||||
|= =inbox:store
|
||||
^- (list card)
|
||||
%- zing
|
||||
(turn ~(tap by inbox) mailbox-to-updates)
|
||||
::
|
||||
++ add-graph
|
||||
|= [rid=resource =mailbox:store]
|
||||
%- poke-graph-store
|
||||
:- now.bol
|
||||
:+ %add-graph rid
|
||||
:- (mailbox-to-graph mailbox)
|
||||
[`%graph-validator-chat %.y]
|
||||
::
|
||||
++ archive-graph
|
||||
|= rid=resource
|
||||
%- poke-graph-store
|
||||
[now.bol %archive-graph rid]
|
||||
::
|
||||
++ nobody
|
||||
^- @p
|
||||
(bex 128)
|
||||
::
|
||||
++ path-to-resource
|
||||
|= =path
|
||||
^- resource
|
||||
?. ?=([@ @ ~] path)
|
||||
nobody^(spat path)
|
||||
=/ m-ship=(unit ship)
|
||||
(slaw %p i.path)
|
||||
?~ m-ship
|
||||
nobody^(spat path)
|
||||
[u.m-ship i.t.path]
|
||||
::
|
||||
++ mailbox-to-updates
|
||||
|= [=path =mailbox:store]
|
||||
^- (list card)
|
||||
=/ app-rid=resource
|
||||
(path-to-resource path)
|
||||
=/ group-rid=resource
|
||||
(fall (peek-group:met %graph app-rid) [nobody %bad-group])
|
||||
=/ group=(unit group)
|
||||
(scry-group:grp group-rid)
|
||||
:- (add-graph app-rid mailbox)
|
||||
?~ group (archive-graph app-rid)^~
|
||||
?. &(=(~ members.u.group) hidden.u.group) ~
|
||||
~& >>> "archiving {<app-rid>}"
|
||||
:~ (archive-graph app-rid)
|
||||
(remove-group group-rid)
|
||||
==
|
||||
::
|
||||
++ remove-group
|
||||
|= group=resource
|
||||
^- card
|
||||
=- [%pass / %agent [our.bol %group-store] %poke -]
|
||||
group-update-0+!>([%remove-group group ~])
|
||||
::
|
||||
++ poke-graph-store
|
||||
|= =update:graph-store
|
||||
^- card
|
||||
[%pass / %agent [our.bol %graph-store] %poke %graph-update-1 !>(update)]
|
||||
::
|
||||
++ letter-to-contents
|
||||
|= =letter:store
|
||||
^- (list content:graph-store)
|
||||
:_ ~
|
||||
?. ?=(%me -.letter)
|
||||
letter
|
||||
[%text narrative.letter]
|
||||
::
|
||||
++ envelope-to-node
|
||||
|= =envelope:store
|
||||
^- [atom:graph-store node:graph-store]
|
||||
=/ contents=(list content:graph-store)
|
||||
(letter-to-contents letter.envelope)
|
||||
=/ =index:graph-store
|
||||
[when.envelope ~]
|
||||
=, envelope
|
||||
:- when.envelope
|
||||
:_ [%empty ~]
|
||||
^- post:graph-store
|
||||
:* author
|
||||
index
|
||||
when
|
||||
contents
|
||||
~ ~
|
||||
==
|
||||
::
|
||||
++ mailbox-to-graph
|
||||
|= =mailbox:store
|
||||
^- graph:graph-store
|
||||
%+ gas:orm:graph-store *graph:graph-store
|
||||
(turn envelopes.mailbox envelope-to-node)
|
||||
++ on-poke on-poke:def
|
||||
++ on-watch on-watch:def
|
||||
++ on-leave on-leave:def
|
||||
++ on-peek on-peek:def
|
||||
++ on-agent on-agent:def
|
||||
++ on-arvo on-arvo:def
|
||||
++ on-fail on-fail:def
|
||||
--
|
||||
|
@ -70,10 +70,11 @@
|
||||
::
|
||||
++ transform-proxy-update
|
||||
|= vas=vase
|
||||
^- (unit vase)
|
||||
^- (quip card (unit vase))
|
||||
:: TODO: should check if user is allowed to %add, %remove, %edit
|
||||
:: contact
|
||||
=/ =update:store !<(update:store vas)
|
||||
:- ~
|
||||
?- -.update
|
||||
%initial ~
|
||||
%add `vas
|
||||
|
@ -43,8 +43,8 @@
|
||||
::
|
||||
++ transform-proxy-update
|
||||
|= vas=vase
|
||||
^- (unit vase)
|
||||
`vas
|
||||
^- (quip card (unit vase))
|
||||
``vas
|
||||
::
|
||||
++ resource-for-update
|
||||
|= =vase
|
||||
|
@ -875,7 +875,7 @@
|
||||
%ge (dy-run-generator (dy-cage p.p.p.bil) q.p.bil)
|
||||
%sa
|
||||
=+ .^(=dais:clay cb+(en-beam he-beak /[p.bil]))
|
||||
(dy-hand p.bil bunt:dais)
|
||||
(dy-hand p.bil *vale:dais)
|
||||
::
|
||||
%as
|
||||
=/ cag=cage (dy-cage p.q.bil)
|
||||
|
@ -188,8 +188,11 @@
|
||||
?: ?=([%'~landscape' %js %session ~] site.req-line)
|
||||
%+ require-authorization-simple:app
|
||||
inbound-request
|
||||
%- js-response:gen
|
||||
(as-octt:mimes:html "window.ship = '{+:(scow %p our.bowl)}';")
|
||||
%. %- as-octs:mimes:html
|
||||
(rap 3 'window.ship = "' (rsh 3 (scot %p our.bowl)) '";' ~)
|
||||
%* . js-response:gen
|
||||
cache %.n
|
||||
==
|
||||
::
|
||||
=/ [payload=simple-payload:http public=?] (get-file req-line is-file)
|
||||
?: public payload
|
||||
@ -222,6 +225,7 @@
|
||||
[~ %js] (js-response:gen file)
|
||||
[~ %css] (css-response:gen file)
|
||||
[~ %png] (png-response:gen file)
|
||||
[~ %ico] (ico-response:gen file)
|
||||
::
|
||||
[~ %html]
|
||||
%. file
|
||||
@ -238,11 +242,9 @@
|
||||
[not-found:gen %.n]
|
||||
:_ public.u.content
|
||||
=/ mime-type=@t (rsh 3 (crip <p.u.data>))
|
||||
:: Should maybe inspect to see how long cache should hold
|
||||
::
|
||||
=/ headers
|
||||
:~ content-type+mime-type
|
||||
max-1-da:gen
|
||||
max-1-wk:gen
|
||||
'service-worker-allowed'^'/'
|
||||
==
|
||||
[[200 headers] `q.u.data]
|
||||
|
@ -5,7 +5,7 @@
|
||||
/- glob
|
||||
/+ default-agent, verb, dbug
|
||||
|%
|
||||
++ hash 0v3.g6u13.haedt.jt4hd.61ek5.6t30q
|
||||
++ hash 0v4.vrvkt.4gcnm.dgg5o.e73d6.kqnaq
|
||||
+$ state-0 [%0 hash=@uv glob=(unit (each glob:glob tid=@ta))]
|
||||
+$ all-states
|
||||
$% state-0
|
||||
|
@ -9,7 +9,7 @@
|
||||
update:store
|
||||
%graph-update
|
||||
%graph-push-hook
|
||||
1 1
|
||||
2 2
|
||||
%.n
|
||||
==
|
||||
--
|
||||
@ -41,7 +41,7 @@
|
||||
%- (slog leaf+"nacked {<resource>}" tang)
|
||||
:_ this
|
||||
?. (~(has in get-keys:gra) resource) ~
|
||||
=- [%pass /pull-nack %agent [our.bowl %graph-store] %poke %graph-update-1 -]~
|
||||
=- [%pass /pull-nack %agent [our.bowl %graph-store] %poke %graph-update-2 -]~
|
||||
!> ^- update:store
|
||||
[now.bowl [%archive-graph resource]]
|
||||
::
|
||||
|
@ -1,6 +1,6 @@
|
||||
/- *group, metadata=metadata-store
|
||||
/+ store=graph-store, mdl=metadata, res=resource, graph, group, default-agent,
|
||||
dbug, verb, push-hook
|
||||
dbug, verb, push-hook, agentio
|
||||
::
|
||||
~% %graph-push-hook-top ..part ~
|
||||
|%
|
||||
@ -12,16 +12,38 @@
|
||||
update:store
|
||||
%graph-update
|
||||
%graph-pull-hook
|
||||
1 1
|
||||
2 2
|
||||
==
|
||||
::
|
||||
+$ agent (push-hook:push-hook config)
|
||||
::
|
||||
+$ state-null ~
|
||||
+$ state-zero [%0 marks=(set mark)]
|
||||
+$ state-one [%1 ~]
|
||||
+$ versioned-state
|
||||
$@ state-null
|
||||
state-zero
|
||||
$% state-zero
|
||||
state-one
|
||||
==
|
||||
::
|
||||
:: TODO: come back to this and potentially use send a %t
|
||||
:: to be notified of validator changes
|
||||
+$ cache
|
||||
$: graph-to-mark=(map resource:res (unit mark))
|
||||
perm-marks=(map [mark @tas] tube:clay)
|
||||
transform-marks=(map mark tube:clay)
|
||||
==
|
||||
::
|
||||
+$ inflated-state
|
||||
$: state-one
|
||||
cache
|
||||
==
|
||||
::
|
||||
+$ cache-action
|
||||
$% [%graph-to-mark (pair resource:res (unit mark))]
|
||||
[%perm-marks (pair (pair mark @tas) tube:clay)]
|
||||
[%transform-marks (pair mark tube:clay)]
|
||||
==
|
||||
--
|
||||
::
|
||||
%- agent:dbug
|
||||
@ -30,26 +52,48 @@
|
||||
%- (agent:push-hook config)
|
||||
^- agent
|
||||
=-
|
||||
=| state-zero
|
||||
~% %graph-push-hook-agent ..scry.hook-core ~
|
||||
=| inflated-state
|
||||
=* state -
|
||||
|_ =bowl:gall
|
||||
+* this .
|
||||
def ~(. (default-agent this %|) bowl)
|
||||
grp ~(. group bowl)
|
||||
gra ~(. graph bowl)
|
||||
hc ~(. hook-core bowl)
|
||||
met ~(. mdl bowl)
|
||||
hc ~(. hook-core bowl +.state)
|
||||
io ~(. agentio bowl)
|
||||
::
|
||||
++ on-init on-init:def
|
||||
++ on-save !>(state)
|
||||
++ on-save !>(-.state)
|
||||
++ on-load
|
||||
|= =vase
|
||||
=+ !<(old=versioned-state vase)
|
||||
=? old ?=(~ old)
|
||||
[%0 ~]
|
||||
?> ?=(%0 -.old)
|
||||
`this(state old)
|
||||
=? old ?=(%0 -.old)
|
||||
[%1 ~]
|
||||
?> ?=(%1 -.old)
|
||||
`this(-.state old, +.state *cache)
|
||||
::
|
||||
++ on-poke
|
||||
|= [=mark =vase]
|
||||
^- (quip card _this)
|
||||
?. =(mark %graph-cache-hook)
|
||||
[~ this]
|
||||
=/ a=cache-action !<(cache-action vase)
|
||||
=* c +.state
|
||||
=* graph-to-mark graph-to-mark.c
|
||||
=* perm-marks perm-marks.c
|
||||
=* transform-marks transform-marks.c
|
||||
=. c
|
||||
?- -.a
|
||||
%graph-to-mark c(graph-to-mark (~(put by graph-to-mark) p.a q.a))
|
||||
%perm-marks c(perm-marks (~(put by perm-marks) p.a q.a))
|
||||
%transform-marks c(transform-marks (~(put by transform-marks) p.a q.a))
|
||||
==
|
||||
[~ this(+.state c)]
|
||||
::
|
||||
++ on-poke on-poke:def
|
||||
++ on-agent on-agent:def
|
||||
++ on-watch on-watch:def
|
||||
++ on-leave on-leave:def
|
||||
@ -58,47 +102,72 @@
|
||||
|= [=wire =sign-arvo]
|
||||
^- (quip card _this)
|
||||
?+ wire (on-arvo:def wire sign-arvo)
|
||||
:: XX: no longer necessary
|
||||
::
|
||||
[%perms @ @ ~]
|
||||
?> ?=(?(%add %remove) i.t.t.wire)
|
||||
=* mark i.t.wire
|
||||
:_ this
|
||||
(build-permissions:hc mark i.t.t.wire %next)^~
|
||||
::
|
||||
[%transform-add @ ~]
|
||||
=* mark i.t.wire
|
||||
:_ this
|
||||
(build-transform-add:hc mark %next)^~
|
||||
[%perms @ @ ~] [~ this]
|
||||
[%transform-add @ ~] [~ this]
|
||||
==
|
||||
::
|
||||
++ on-fail on-fail:def
|
||||
++ transform-proxy-update
|
||||
~/ %transform-proxy-update
|
||||
|= vas=vase
|
||||
^- (unit vase)
|
||||
^- (quip card (unit vase))
|
||||
=/ =update:store !<(update:store vas)
|
||||
=* rid resource.q.update
|
||||
=. p.update now.bowl
|
||||
?- -.q.update
|
||||
%add-nodes
|
||||
?. (is-allowed-add:hc rid nodes.q.update)
|
||||
~
|
||||
=/ mark (get-mark:gra rid)
|
||||
?~ mark `vas
|
||||
|^
|
||||
=/ transform
|
||||
!< $-([index:store post:store atom ?] [index:store post:store])
|
||||
%. !>(*indexed-post:store)
|
||||
.^(tube:clay (scry:hc %cc %home /[u.mark]/transform-add-nodes))
|
||||
=/ [* result=(list [index:store node:store])]
|
||||
%+ roll
|
||||
(flatten-node-map ~(tap by nodes.q.update))
|
||||
(transform-list transform)
|
||||
=. nodes.q.update
|
||||
%- ~(gas by *(map index:store node:store))
|
||||
result
|
||||
[~ !>(update)]
|
||||
=| cards=(list card)
|
||||
=^ allowed cards (is-allowed-add:hc rid nodes.q.update)
|
||||
?. allowed
|
||||
[cards ~]
|
||||
=/ mark-cached (~(has by graph-to-mark) rid)
|
||||
=/ mark
|
||||
?: mark-cached
|
||||
(~(got by graph-to-mark) rid)
|
||||
(get-mark:gra rid)
|
||||
?~ mark
|
||||
[cards `vas]
|
||||
=< $
|
||||
~% %transform-add-nodes ..transform-proxy-update ~
|
||||
|%
|
||||
++ $
|
||||
^- (quip card (unit vase))
|
||||
=/ transform-cached (~(has by transform-marks) u.mark)
|
||||
=/ =tube:clay
|
||||
?: transform-cached
|
||||
(~(got by transform-marks) u.mark)
|
||||
.^(tube:clay (scry:hc %cc %home /[u.mark]/transform-add-nodes))
|
||||
=/ transform
|
||||
!< $-([index:store post:store atom ?] [index:store post:store])
|
||||
%. !>(*indexed-post:store)
|
||||
tube
|
||||
=/ [* result=(list [index:store node:store])]
|
||||
%+ roll
|
||||
(flatten-node-map ~(tap by nodes.q.update))
|
||||
(transform-list transform)
|
||||
=. nodes.q.update
|
||||
%- ~(gas by *(map index:store node:store))
|
||||
result
|
||||
:_ [~ !>(update)]
|
||||
%+ weld cards
|
||||
%- zing
|
||||
:~ ?: mark-cached ~
|
||||
:_ ~
|
||||
%+ poke-self:pass:io %graph-cache-hook
|
||||
!> ^- cache-action
|
||||
[%graph-to-mark rid mark]
|
||||
::
|
||||
?: transform-cached ~
|
||||
:_ ~
|
||||
%+ poke-self:pass:io %graph-cache-hook
|
||||
!> ^- cache-action
|
||||
[%transform-marks u.mark tube]
|
||||
==
|
||||
::
|
||||
++ flatten-node-map
|
||||
~/ %flatten-node-map
|
||||
|= lis=(list [index:store node:store])
|
||||
^- (list [index:store node:store])
|
||||
|^
|
||||
@ -130,10 +199,13 @@
|
||||
--
|
||||
::
|
||||
++ transform-list
|
||||
~/ %transform-list
|
||||
|= transform=$-([index:store post:store atom ?] [index:store post:store])
|
||||
|= $: [=index:store =node:store]
|
||||
[indices=(set index:store) lis=(list [index:store node:store])]
|
||||
==
|
||||
~| "cannot put a deleted post into %add-nodes {<post.node>}"
|
||||
?> ?=(%& -.post.node)
|
||||
=/ l (lent index)
|
||||
=/ parent-modified=?
|
||||
%- ~(rep in indices)
|
||||
@ -144,36 +216,42 @@
|
||||
%.n
|
||||
=((swag [0 k] index) i)
|
||||
=/ [ind=index:store =post:store]
|
||||
(transform index post.node now.bowl parent-modified)
|
||||
(transform index p.post.node now.bowl parent-modified)
|
||||
:- (~(put in indices) index)
|
||||
(snoc lis [ind node(post post)])
|
||||
(snoc lis [ind node(p.post post)])
|
||||
--
|
||||
::
|
||||
%remove-nodes
|
||||
?. (is-allowed-remove:hc resource.q.update indices.q.update)
|
||||
%remove-posts
|
||||
=| cards=(list card)
|
||||
=^ allowed cards
|
||||
(is-allowed-remove:hc rid indices.q.update)
|
||||
:- cards
|
||||
?. allowed
|
||||
~
|
||||
`vas
|
||||
::
|
||||
%add-graph ~
|
||||
%remove-graph ~
|
||||
%add-signatures ~
|
||||
%remove-signatures ~
|
||||
%archive-graph ~
|
||||
%unarchive-graph ~
|
||||
%add-tag ~
|
||||
%remove-tag ~
|
||||
%keys ~
|
||||
%tags ~
|
||||
%tag-queries ~
|
||||
%run-updates ~
|
||||
%add-graph [~ ~]
|
||||
%remove-graph [~ ~]
|
||||
%add-signatures [~ ~]
|
||||
%remove-signatures [~ ~]
|
||||
%archive-graph [~ ~]
|
||||
%unarchive-graph [~ ~]
|
||||
%add-tag [~ ~]
|
||||
%remove-tag [~ ~]
|
||||
%keys [~ ~]
|
||||
%tags [~ ~]
|
||||
%tag-queries [~ ~]
|
||||
%run-updates [~ ~]
|
||||
==
|
||||
::
|
||||
++ resource-for-update resource-for-update:gra
|
||||
::
|
||||
++ initial-watch
|
||||
~/ %initial-watch
|
||||
|= [=path =resource:res]
|
||||
^- vase
|
||||
?> (is-allowed:hc resource)
|
||||
|^
|
||||
?> (is-allowed resource)
|
||||
!> ^- update:store
|
||||
?~ path
|
||||
:: new subscribe
|
||||
@ -186,22 +264,19 @@
|
||||
=/ =time (slav %da i.path)
|
||||
=/ =update-log:store (get-update-log-subset:gra resource time)
|
||||
[now.bowl [%run-updates resource update-log]]
|
||||
::
|
||||
++ is-allowed
|
||||
|= =resource:res
|
||||
=/ group-res=resource:res
|
||||
(need (peek-group:met %graph resource))
|
||||
(is-member:grp src.bowl group-res)
|
||||
--
|
||||
::
|
||||
++ take-update
|
||||
|= =vase
|
||||
^- [(list card) agent]
|
||||
=/ =update:store !<(update:store vase)
|
||||
?+ -.q.update [~ this]
|
||||
%add-graph
|
||||
?~ mark.q.update `this
|
||||
=* mark u.mark.q.update
|
||||
?: (~(has in marks) mark) `this
|
||||
:_ this(marks (~(put in marks) mark))
|
||||
:~ (build-permissions:hc mark %add %sing)
|
||||
(build-permissions:hc mark %remove %sing)
|
||||
(build-transform-add:hc mark %sing)
|
||||
==
|
||||
::
|
||||
%remove-graph
|
||||
:_ this
|
||||
[%give %kick ~[resource+(en-path:res resource.q.update)] ~]~
|
||||
@ -211,11 +286,14 @@
|
||||
[%give %kick ~[resource+(en-path:res resource.q.update)] ~]~
|
||||
==
|
||||
--
|
||||
^| ^= hook-core
|
||||
|_ =bowl:gall
|
||||
::
|
||||
~% %graph-push-hook-helper ..card.hook-core ~
|
||||
^= hook-core
|
||||
|_ [=bowl:gall =cache]
|
||||
+* grp ~(. group bowl)
|
||||
met ~(. mdl bowl)
|
||||
gra ~(. graph bowl)
|
||||
io ~(. agentio bowl)
|
||||
::
|
||||
++ scry
|
||||
|= [care=@t desk=@t =path]
|
||||
@ -223,28 +301,46 @@
|
||||
/[care]/(scot %p our.bowl)/[desk]/(scot %da now.bowl)
|
||||
path
|
||||
::
|
||||
++ perm-mark-name
|
||||
|= perm=@t
|
||||
^- @t
|
||||
(cat 3 'graph-permissions-' perm)
|
||||
::
|
||||
++ perm-mark
|
||||
|= [=resource:res perm=@t vip=vip-metadata:metadata =indexed-post:store]
|
||||
^- permissions:store
|
||||
=- (check vip)
|
||||
!< check=$-(vip-metadata:metadata permissions:store)
|
||||
%. !>(indexed-post)
|
||||
=/ mark (get-mark:gra resource)
|
||||
?~ mark |=(=vase !>([%no %no %no]))
|
||||
.^(tube:clay (scry %cc %home /[u.mark]/(perm-mark-name perm)))
|
||||
::
|
||||
++ add-mark
|
||||
|= [=resource:res vip=vip-metadata:metadata =indexed-post:store]
|
||||
(perm-mark resource %add vip indexed-post)
|
||||
::
|
||||
++ remove-mark
|
||||
|= [=resource:res vip=vip-metadata:metadata =indexed-post:store]
|
||||
(perm-mark resource %remove vip indexed-post)
|
||||
^- [permissions:store (list card)]
|
||||
|^
|
||||
=/ mark-cached (~(has by graph-to-mark.cache) resource)
|
||||
=/ mark
|
||||
?: mark-cached
|
||||
(~(got by graph-to-mark.cache) resource)
|
||||
(get-mark:gra resource)
|
||||
?~ mark
|
||||
[[%no %no %no] ~]
|
||||
=/ key [u.mark (perm-mark-name perm)]
|
||||
=/ perms-cached (~(has by perm-marks.cache) key)
|
||||
=/ =tube:clay
|
||||
?: perms-cached
|
||||
(~(got by perm-marks.cache) key)
|
||||
.^(tube:clay (scry %cc %home /[u.mark]/(perm-mark-name perm)))
|
||||
=/ check
|
||||
!< $-(vip-metadata:metadata permissions:store)
|
||||
(tube !>(indexed-post))
|
||||
:- (check vip)
|
||||
%- zing
|
||||
:~ ?: mark-cached ~
|
||||
:_ ~
|
||||
%+ poke-self:pass:io %graph-cache-hook
|
||||
!> ^- cache-action
|
||||
[%graph-to-mark resource mark]
|
||||
::
|
||||
?: perms-cached ~
|
||||
:_ ~
|
||||
%+ poke-self:pass:io %graph-cache-hook
|
||||
!> ^- cache-action
|
||||
[%perm-marks [u.mark (perm-mark-name perm)] tube]
|
||||
==
|
||||
::
|
||||
++ perm-mark-name
|
||||
|= perm=@t
|
||||
^- @t
|
||||
(cat 3 'graph-permissions-' perm)
|
||||
--
|
||||
::
|
||||
++ get-permission
|
||||
|= [=permissions:store is-admin=? writers=(set ship)]
|
||||
@ -257,22 +353,23 @@
|
||||
writer.permissions
|
||||
reader.permissions
|
||||
::
|
||||
++ is-allowed
|
||||
|= =resource:res
|
||||
=/ group-res=resource:res
|
||||
(need (peek-group:met %graph resource))
|
||||
(is-member:grp src.bowl group-res)
|
||||
::
|
||||
++ get-roles-writers-variation
|
||||
~/ %get-roles-writers-variation
|
||||
|= =resource:res
|
||||
^- (unit [is-admin=? writers=(set ship) vip=vip-metadata:metadata])
|
||||
=/ assoc=(unit association:metadata)
|
||||
(peek-association:met %graph resource)
|
||||
(peek-association:met %graph resource)
|
||||
?~ assoc ~
|
||||
=/ group=(unit group:grp)
|
||||
(scry-group:grp group.u.assoc)
|
||||
?~ group ~
|
||||
=/ role=(unit (unit role-tag))
|
||||
(role-for-ship:grp group.u.assoc src.bowl)
|
||||
(role-for-ship-with-group:grp u.group group.u.assoc src.bowl)
|
||||
=/ writers=(set ship)
|
||||
(get-tagged-ships:grp group.u.assoc [%graph resource %writers])
|
||||
%^ get-tagged-ships-with-group:grp
|
||||
u.group
|
||||
group.u.assoc
|
||||
[%graph resource %writers]
|
||||
?~ role ~
|
||||
=/ is-admin=?
|
||||
?=(?([~ %admin] [~ %moderator]) u.role)
|
||||
@ -281,74 +378,111 @@
|
||||
++ node-to-indexed-post
|
||||
|= =node:store
|
||||
^- indexed-post:store
|
||||
=* index index.post.node
|
||||
[(snag (dec (lent index)) index) post.node]
|
||||
?> ?=(%& -.post.node)
|
||||
=* index index.p.post.node
|
||||
[(snag (dec (lent index)) index) p.post.node]
|
||||
::
|
||||
++ is-allowed-add
|
||||
~/ %is-allowed-add
|
||||
|= [=resource:res nodes=(map index:store node:store)]
|
||||
^- ?
|
||||
%- (bond |.(%.n))
|
||||
^- [? (list card)]
|
||||
|^
|
||||
%- (bond |.([%.n ~]))
|
||||
%+ biff (get-roles-writers-variation resource)
|
||||
|= [is-admin=? writers=(set ship) vip=vip-metadata:metadata]
|
||||
^- (unit [? (list card)])
|
||||
%- some
|
||||
%+ levy ~(tap by nodes)
|
||||
|= [=index:store =node:store]
|
||||
=/ parent-index=index:store
|
||||
(scag (dec (lent index)) index)
|
||||
?: (~(has by nodes) parent-index) %.y
|
||||
?. =(author.post.node src.bowl)
|
||||
%.n
|
||||
=/ =permissions:store
|
||||
%^ add-mark resource vip
|
||||
(node-to-indexed-post node)
|
||||
=/ =permission-level:store
|
||||
(get-permission permissions is-admin writers)
|
||||
?- permission-level
|
||||
%yes %.y
|
||||
%no %.n
|
||||
::
|
||||
%self
|
||||
=/ parent-node=node:store
|
||||
(got-node:gra resource parent-index)
|
||||
=(author.post.parent-node src.bowl)
|
||||
==
|
||||
=/ a ~(tap by nodes)
|
||||
=| cards=(list card)
|
||||
|- ^- [? (list card)]
|
||||
?~ a [& cards]
|
||||
=/ c (check i.a is-admin writers vip)
|
||||
?. -.c
|
||||
[| (weld cards +.c)]
|
||||
$(a t.a, cards (weld cards +.c))
|
||||
::
|
||||
++ check
|
||||
|= $: [=index:store =node:store]
|
||||
is-admin=?
|
||||
writers=(set ship)
|
||||
vip=vip-metadata:metadata
|
||||
==
|
||||
^- [? (list card)]
|
||||
=/ parent-index=index:store
|
||||
(scag (dec (lent index)) index)
|
||||
?: (~(has by nodes) parent-index)
|
||||
[%.y ~]
|
||||
?: ?=(%| -.post.node)
|
||||
[%.n ~]
|
||||
?. =(author.p.post.node src.bowl)
|
||||
[%.n ~]
|
||||
=/ added
|
||||
%^ add-mark resource vip
|
||||
(node-to-indexed-post node)
|
||||
=* permissions -.added
|
||||
=* cards +.added
|
||||
=/ =permission-level:store
|
||||
(get-permission permissions is-admin writers)
|
||||
:_ cards
|
||||
?- permission-level
|
||||
%yes %.y
|
||||
%no %.n
|
||||
::
|
||||
%self
|
||||
=/ parent-node=node:store
|
||||
(got-node:gra resource parent-index)
|
||||
?: ?=(%| -.post.parent-node)
|
||||
%.n
|
||||
=(author.p.post.parent-node src.bowl)
|
||||
==
|
||||
::
|
||||
++ add-mark
|
||||
|= [=resource:res vip=vip-metadata:metadata =indexed-post:store]
|
||||
(perm-mark resource %add vip indexed-post)
|
||||
--
|
||||
::
|
||||
++ is-allowed-remove
|
||||
~/ %is-allowed-remove
|
||||
|= [=resource:res indices=(set index:store)]
|
||||
^- ?
|
||||
%- (bond |.(%.n))
|
||||
^- [? (list card)]
|
||||
|^
|
||||
%- (bond |.([%.n ~]))
|
||||
%+ biff (get-roles-writers-variation resource)
|
||||
|= [is-admin=? writers=(set ship) vip=vip-metadata:metadata]
|
||||
%- some
|
||||
%+ levy ~(tap by indices)
|
||||
|= =index:store
|
||||
=/ =node:store
|
||||
(got-node:gra resource index)
|
||||
=/ =permissions:store
|
||||
%^ remove-mark resource vip
|
||||
(node-to-indexed-post node)
|
||||
=/ =permission-level:store
|
||||
(get-permission permissions is-admin writers)
|
||||
?- permission-level
|
||||
%yes %.y
|
||||
%no %.n
|
||||
%self =(author.post.node src.bowl)
|
||||
==
|
||||
::
|
||||
++ build-permissions
|
||||
|= [=mark kind=?(%add %remove) mode=?(%sing %next)]
|
||||
^- card
|
||||
=/ =wire /perms/[mark]/[kind]
|
||||
=/ =mood:clay [%c da+now.bowl /[mark]/(perm-mark-name kind)]
|
||||
=/ =rave:clay ?:(?=(%sing mode) [mode mood] [mode mood])
|
||||
[%pass wire %arvo %c %warp our.bowl %home `rave]
|
||||
::
|
||||
++ build-transform-add
|
||||
|= [=mark mode=?(%sing %next)]
|
||||
^- card
|
||||
=/ =wire /transform-add/[mark]
|
||||
=/ =mood:clay [%c da+now.bowl /[mark]/transform-add-nodes]
|
||||
=/ =rave:clay ?:(?=(%sing mode) [mode mood] [mode mood])
|
||||
[%pass wire %arvo %c %warp our.bowl %home `rave]
|
||||
%- some
|
||||
=/ a ~(tap by indices)
|
||||
=| cards=(list card)
|
||||
|- ^- [? (list card)]
|
||||
?~ a [& cards]
|
||||
=/ c (check i.a is-admin writers vip)
|
||||
?. -.c
|
||||
[| (weld cards +.c)]
|
||||
$(a t.a, cards (weld cards +.c))
|
||||
::
|
||||
++ check
|
||||
|= [=index:store is-admin=? writers=(set ship) vip=vip-metadata:metadata]
|
||||
^- [? (list card)]
|
||||
=/ =node:store
|
||||
(got-node:gra resource index)
|
||||
?: ?=(%| -.post.node)
|
||||
[%.n ~]
|
||||
=/ removed
|
||||
%^ remove-mark resource vip
|
||||
(node-to-indexed-post node)
|
||||
=* permissions -.removed
|
||||
=* cards +.removed
|
||||
=/ =permission-level:store
|
||||
(get-permission permissions is-admin writers)
|
||||
:_ cards
|
||||
?- permission-level
|
||||
%yes %.y
|
||||
%no %.n
|
||||
%self =(author.p.post.node src.bowl)
|
||||
==
|
||||
::
|
||||
++ remove-mark
|
||||
|= [=resource:res vip=vip-metadata:metadata =indexed-post:store]
|
||||
(perm-mark resource %remove vip indexed-post)
|
||||
--
|
||||
--
|
||||
|
||||
|
@ -1,29 +1,36 @@
|
||||
:: graph-store [landscape]
|
||||
::
|
||||
::
|
||||
/+ store=graph-store, sigs=signatures, res=resource, default-agent, dbug, verb,
|
||||
*migrate
|
||||
/+ store=graph-store, sigs=signatures, res=resource, default-agent, dbug, verb
|
||||
~% %graph-store-top ..part ~
|
||||
|%
|
||||
+$ card card:agent:gall
|
||||
+$ versioned-state
|
||||
$% state-0
|
||||
state-1
|
||||
state-2
|
||||
state-3
|
||||
$% [%0 network:zero:store]
|
||||
[%1 network:zero:store]
|
||||
[%2 network:zero:store]
|
||||
[%3 network:one:store]
|
||||
[%4 network:store]
|
||||
state-5
|
||||
==
|
||||
::
|
||||
+$ state-0 [%0 network:zero:store]
|
||||
+$ state-1 [%1 network:zero:store]
|
||||
+$ state-2 [%2 network:zero:store]
|
||||
+$ state-3 [%3 network:store]
|
||||
::
|
||||
+$ state-5 [%5 network:store]
|
||||
++ orm orm:store
|
||||
++ orm-log orm-log:store
|
||||
+$ debug-input [%validate-graph =resource:store]
|
||||
::
|
||||
+$ cache
|
||||
$: validators=(map mark dais:clay)
|
||||
==
|
||||
::
|
||||
:: TODO: come back to this and potentially use ford runes or otherwise
|
||||
:: send a %t to be notified of validator changes
|
||||
+$ inflated-state
|
||||
$: state-5
|
||||
cache
|
||||
==
|
||||
--
|
||||
::
|
||||
=| state-3
|
||||
=| inflated-state
|
||||
=* state -
|
||||
::
|
||||
%- agent:dbug
|
||||
@ -35,25 +42,24 @@
|
||||
def ~(. (default-agent this %|) bowl)
|
||||
::
|
||||
++ on-init [~ this]
|
||||
++ on-save !>(state)
|
||||
++ on-save !>(-.state)
|
||||
++ on-load
|
||||
|= =old=vase
|
||||
^- (quip card _this)
|
||||
=+ !<(old=versioned-state old-vase)
|
||||
=| cards=(list card)
|
||||
|^
|
||||
|-
|
||||
?- -.old
|
||||
%0
|
||||
%0
|
||||
=* zro zero-load:upgrade:store
|
||||
%_ $
|
||||
-.old %1
|
||||
cards cards
|
||||
validators.old validators.old
|
||||
::
|
||||
graphs.old
|
||||
%- ~(run by graphs.old)
|
||||
|= [=graph:zero:store q=(unit mark)]
|
||||
^- [graph:zero:store (unit mark)]
|
||||
:- (convert-unix-timestamped-graph:zero-load graph)
|
||||
:- (convert-unix-timestamped-graph:zro graph)
|
||||
?^ q q
|
||||
`%graph-validator-link
|
||||
::
|
||||
@ -63,138 +69,57 @@
|
||||
==
|
||||
::
|
||||
%1
|
||||
=* zro zero-load:upgrade:store
|
||||
%_ $
|
||||
-.old %2
|
||||
graphs.old (~(run by graphs.old) change-revision-graph:zero-load)
|
||||
graphs.old (~(run by graphs.old) change-revision-graph:zro)
|
||||
::
|
||||
update-logs.old
|
||||
%- ~(run by update-logs.old)
|
||||
|=(a=* *update-log:zero:store)
|
||||
==
|
||||
::
|
||||
%2
|
||||
%2
|
||||
=* upg upgrade:store
|
||||
%_ $
|
||||
-.old %3
|
||||
update-logs.old (~(run by update-logs.old) update-log-to-one:store)
|
||||
graphs.old (~(run by graphs.old) marked-graph-to-one:store)
|
||||
archive.old (~(run by archive.old) marked-graph-to-one:store)
|
||||
update-logs.old (~(run by update-logs.old) update-log-to-one:upg)
|
||||
graphs.old (~(run by graphs.old) marked-graph-to-one:upg)
|
||||
archive.old (~(run by archive.old) marked-graph-to-one:upg)
|
||||
==
|
||||
::
|
||||
%3 [cards this(state old)]
|
||||
==
|
||||
%3
|
||||
=* upg upgrade:store
|
||||
%_ $
|
||||
-.old %4
|
||||
graphs.old (~(run by graphs.old) marked-graph-to-two:upg)
|
||||
archive.old (~(run by archive.old) marked-graph-to-two:upg)
|
||||
tag-queries.old *tag-queries:store
|
||||
validators.old ~
|
||||
::
|
||||
update-logs.old
|
||||
%- ~(run by update-logs.old)
|
||||
|=(a=* *update-log:store)
|
||||
==
|
||||
::
|
||||
++ zero-load
|
||||
:: =* infinitely recurses
|
||||
=, store=zero:store
|
||||
=, orm=orm:zero:store
|
||||
=, orm-log=orm-log:zero:store
|
||||
|%
|
||||
++ 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))
|
||||
%4
|
||||
%_ $
|
||||
-.old %5
|
||||
::
|
||||
++ 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)
|
||||
--
|
||||
--
|
||||
update-logs.old
|
||||
%- ~(gas by *update-logs:store)
|
||||
%+ turn ~(tap by graphs.old)
|
||||
|= [=resource:store =graph:store mar=(unit mark)]
|
||||
:- resource
|
||||
=/ log (~(got by update-logs.old) resource)
|
||||
?. =(~ log) log
|
||||
=/ =logged-update:store
|
||||
[now.bowl %add-graph resource graph mar %.y]
|
||||
(gas:orm-log ~ [now.bowl logged-update] ~)
|
||||
==
|
||||
::
|
||||
%5 [cards this(-.state old, +.state *cache)]
|
||||
==
|
||||
::
|
||||
++ on-watch
|
||||
~/ %graph-store-watch
|
||||
@ -213,7 +138,7 @@
|
||||
++ give
|
||||
|= =action:store
|
||||
^- (list card)
|
||||
[%give %fact ~ [%graph-update-1 !>([now.bowl action])]]~
|
||||
[%give %fact ~ [%graph-update-2 !>([now.bowl action])]]~
|
||||
--
|
||||
::
|
||||
++ on-poke
|
||||
@ -224,7 +149,7 @@
|
||||
?> (team:title our.bowl src.bowl)
|
||||
=^ cards state
|
||||
?+ mark (on-poke:def mark vase)
|
||||
%graph-update-1 (graph-update !<(update:store vase))
|
||||
%graph-update-2 (graph-update !<(update:store vase))
|
||||
%noun (debug !<(debug-input vase))
|
||||
%import (poke-import q.vase)
|
||||
==
|
||||
@ -239,7 +164,7 @@
|
||||
%add-graph (add-graph p.update +.q.update)
|
||||
%remove-graph (remove-graph +.q.update)
|
||||
%add-nodes (add-nodes p.update +.q.update)
|
||||
%remove-nodes (remove-nodes p.update +.q.update)
|
||||
%remove-posts (remove-posts p.update +.q.update)
|
||||
%add-signatures (add-signatures p.update +.q.update)
|
||||
%remove-signatures (remove-signatures p.update +.q.update)
|
||||
%add-tag (add-tag +.q.update)
|
||||
@ -265,7 +190,9 @@
|
||||
!(~(has by graphs) resource)
|
||||
== ==
|
||||
~| "validation of graph {<resource>} failed using mark {<mark>}"
|
||||
?> (validate-graph graph mark)
|
||||
=^ is-valid state
|
||||
(validate-graph graph mark)
|
||||
?> is-valid
|
||||
=/ =logged-update:store
|
||||
[time %add-graph resource graph mark overwrite]
|
||||
=/ =update-log:store
|
||||
@ -302,6 +229,10 @@
|
||||
(~(got by graphs) resource)
|
||||
~| "cannot add duplicate nodes to {<resource>}"
|
||||
?< (check-for-duplicates graph ~(key by nodes))
|
||||
~| "validation of nodes failed using mark {<mark>}"
|
||||
=^ is-valid state
|
||||
(check-validity ~(tap by nodes) mark)
|
||||
?> is-valid
|
||||
=/ =update-log:store (~(got by update-logs) resource)
|
||||
=. update-log
|
||||
(put:orm-log update-log time [time [%add-nodes resource nodes]])
|
||||
@ -316,30 +247,41 @@
|
||||
(add-node-list resource graph mark (sort-nodes nodes))
|
||||
==
|
||||
::
|
||||
++ check-validity
|
||||
|= [lis=(list (pair index:store node:store)) mark=(unit ^mark)]
|
||||
^- [? _state]
|
||||
|-
|
||||
?~ lis [& state]
|
||||
=^ is-valid state
|
||||
(validate-graph (gas:orm ~ [(rear p.i.lis) q.i.lis]~) mark)
|
||||
?. is-valid
|
||||
[| state]
|
||||
$(lis t.lis)
|
||||
::
|
||||
++ check-for-duplicates
|
||||
|= [=graph:store nodes=(set index:store)]
|
||||
^- ?
|
||||
=/ node-list ~(tap in nodes)
|
||||
|-
|
||||
?~ node-list %.n
|
||||
?: (has-node graph i.node-list) %.y
|
||||
$(node-list t.node-list)
|
||||
::
|
||||
++ has-node
|
||||
|= [=graph:store =index:store]
|
||||
^- ?
|
||||
=/ node=(unit node:store) ~
|
||||
|-
|
||||
?~ index
|
||||
?=(^ node)
|
||||
?~ t.index
|
||||
?=(^ (get:orm graph i.index))
|
||||
=. node (get:orm graph i.index)
|
||||
?~ node %.n
|
||||
?- -.children.u.node
|
||||
%empty %.n
|
||||
%graph $(graph p.children.u.node, index t.index)
|
||||
==
|
||||
|^
|
||||
%+ lien ~(tap in nodes)
|
||||
|= =index:store
|
||||
(has-node graph index)
|
||||
::
|
||||
++ has-node
|
||||
|= [=graph:store =index:store]
|
||||
^- ?
|
||||
=/ node=(unit node:store) ~
|
||||
|-
|
||||
?~ index
|
||||
?=(^ node)
|
||||
?~ t.index
|
||||
?=(^ (get:orm graph i.index))
|
||||
=. node (get:orm graph i.index)
|
||||
?~ node %.n
|
||||
?- -.children.u.node
|
||||
%empty %.n
|
||||
%graph $(graph p.children.u.node, index t.index)
|
||||
==
|
||||
--
|
||||
::
|
||||
++ sort-nodes
|
||||
|= nodes=(map index:store node:store)
|
||||
@ -373,8 +315,6 @@
|
||||
==
|
||||
^- graph:store
|
||||
?< ?=(~ index)
|
||||
~| "validation of node failed using mark {<mark>}"
|
||||
?> (validate-graph (gas:orm ~ [i.index node]~) mark)
|
||||
=* atom i.index
|
||||
%^ put:orm
|
||||
graph
|
||||
@ -382,8 +322,10 @@
|
||||
:: add child
|
||||
::
|
||||
?~ t.index
|
||||
=* p post.node
|
||||
?~ hash.p node(signatures.post *signatures:store)
|
||||
~| "cannot add deleted post"
|
||||
?> ?=(%& -.post.node)
|
||||
=* p p.post.node
|
||||
?~ hash.p node(signatures.p.post *signatures:store)
|
||||
=/ =validated-portion:store
|
||||
[parent-hash author.p time-sent.p contents.p]
|
||||
=/ =hash:store `@ux`(sham validated-portion)
|
||||
@ -402,8 +344,14 @@
|
||||
^- internal-graph:store
|
||||
:- %graph
|
||||
%_ $
|
||||
index t.index
|
||||
parent-hash hash.post.parent
|
||||
index t.index
|
||||
::
|
||||
parent-hash
|
||||
?- -.post.parent
|
||||
%| `p.post.parent
|
||||
%& hash.p.post.parent
|
||||
==
|
||||
::
|
||||
graph
|
||||
?: ?=(%graph -.children.parent)
|
||||
p.children.parent
|
||||
@ -412,7 +360,7 @@
|
||||
==
|
||||
--
|
||||
::
|
||||
++ remove-nodes
|
||||
++ remove-posts
|
||||
|= [=time =resource:store indices=(set index:store)]
|
||||
^- (quip card _state)
|
||||
|^
|
||||
@ -420,82 +368,83 @@
|
||||
(~(got by graphs) resource)
|
||||
=/ =update-log:store (~(got by update-logs) resource)
|
||||
=. update-log
|
||||
(put:orm-log update-log time [time [%remove-nodes resource indices]])
|
||||
=/ [affected-indices=(set index:store) new-graph=graph:store]
|
||||
(remove-indices resource graph (sort ~(tap in indices) by-lent))
|
||||
::
|
||||
:- (give [/updates]~ [%remove-nodes resource (~(uni in indices) affected-indices)])
|
||||
(put:orm-log update-log time [time [%remove-posts resource indices]])
|
||||
:- (give [/updates]~ [%remove-posts resource indices])
|
||||
%_ state
|
||||
update-logs (~(put by update-logs) resource update-log)
|
||||
update-logs (~(put by update-logs) resource update-log)
|
||||
::
|
||||
graphs
|
||||
%+ ~(put by graphs)
|
||||
resource
|
||||
[new-graph mark]
|
||||
:_ mark
|
||||
%^ remove-indices
|
||||
resource
|
||||
graph
|
||||
(sort ~(tap in indices) by-lent)
|
||||
==
|
||||
::
|
||||
:: we always want to remove the deepest node first,
|
||||
:: so we don't remove parents before children
|
||||
++ by-lent
|
||||
|* [a=(list) b=(list)]
|
||||
^- ?
|
||||
(gth (lent a) (lent b))
|
||||
::
|
||||
++ remove-indices
|
||||
=| affected=(set index:store)
|
||||
|= [=resource:store =graph:store indices=(list index:store)]
|
||||
^- [(set index:store) graph:store]
|
||||
?~ indices [affected graph]
|
||||
=^ new-affected graph
|
||||
(remove-index graph i.indices)
|
||||
^- graph:store
|
||||
?~ indices graph
|
||||
%_ $
|
||||
indices t.indices
|
||||
affected (~(uni in affected) new-affected)
|
||||
==
|
||||
::
|
||||
++ get-descendants
|
||||
|= =graph:store
|
||||
=| indices=(list index:store)
|
||||
=/ nodes (tap:orm:store graph)
|
||||
%- ~(gas in *(set index:store))
|
||||
|- =* tap-nodes $
|
||||
^+ indices
|
||||
%- zing
|
||||
%+ turn nodes
|
||||
|= [atom =node:store]
|
||||
^- (list index:store)
|
||||
%+ welp
|
||||
index.post.node^~
|
||||
?. ?=(%graph -.children.node)
|
||||
~
|
||||
%_ tap-nodes
|
||||
nodes (tap:orm p.children.node)
|
||||
indices t.indices
|
||||
graph (remove-index graph i.indices)
|
||||
==
|
||||
::
|
||||
++ remove-index
|
||||
=| indices=(set index:store)
|
||||
=| parent-hash=(unit hash:store)
|
||||
|= [=graph:store =index:store]
|
||||
^- [(set index:store) graph:store]
|
||||
?~ index [indices graph]
|
||||
^- graph:store
|
||||
?~ index graph
|
||||
=* atom i.index
|
||||
%^ put:orm
|
||||
graph
|
||||
atom
|
||||
:: last index in list
|
||||
::
|
||||
?~ t.index
|
||||
=^ rm-node graph (del:orm graph atom)
|
||||
?~ rm-node `graph
|
||||
?. ?=(%graph -.children.u.rm-node)
|
||||
`graph
|
||||
=/ new-indices
|
||||
(get-descendants p.children.u.rm-node)
|
||||
[(~(uni in indices) new-indices) graph]
|
||||
=/ =node:store
|
||||
=/ =node:store
|
||||
~| "cannot remove index that does not exist {<index>}"
|
||||
(need (get:orm graph atom))
|
||||
%_ node
|
||||
post
|
||||
~| "cannot remove post that has already been removed"
|
||||
?> ?=(%& -.post.node)
|
||||
=* p p.post.node
|
||||
^- maybe-post:store
|
||||
:- %|
|
||||
?~ hash.p
|
||||
=/ =validated-portion:store
|
||||
[parent-hash author.p time-sent.p contents.p]
|
||||
`@ux`(sham validated-portion)
|
||||
u.hash.p
|
||||
==
|
||||
:: recurse children
|
||||
::
|
||||
=/ parent=node:store
|
||||
~| "parent index does not exist to remove a node from!"
|
||||
(need (get:orm graph atom))
|
||||
~| "child index does not exist to remove a node from!"
|
||||
?> ?=(%graph -.children.node)
|
||||
=^ new-indices p.children.node
|
||||
$(graph p.children.node, index t.index)
|
||||
:- (~(uni in indices) new-indices)
|
||||
(put:orm graph atom node)
|
||||
?> ?=(%graph -.children.parent)
|
||||
%_ parent
|
||||
p.children
|
||||
%_ $
|
||||
index t.index
|
||||
graph p.children.parent
|
||||
::
|
||||
parent-hash
|
||||
?- -.post.parent
|
||||
%| `p.post.parent
|
||||
%& hash.p.post.parent
|
||||
==
|
||||
==
|
||||
==
|
||||
--
|
||||
::
|
||||
++ add-signatures
|
||||
@ -531,11 +480,13 @@
|
||||
graph
|
||||
atom
|
||||
?~ t.index
|
||||
~| "cannot add signatures to a deleted post"
|
||||
?> ?=(%& -.post.node)
|
||||
~| "cannot add signatures to a node missing a hash"
|
||||
?> ?=(^ hash.post.node)
|
||||
?> ?=(^ hash.p.post.node)
|
||||
~| "signatures did not match public keys!"
|
||||
?> (are-signatures-valid:sigs our.bowl signatures u.hash.post.node now.bowl)
|
||||
node(signatures.post (~(uni in signatures) signatures.post.node))
|
||||
?> (are-signatures-valid:sigs our.bowl signatures u.hash.p.post.node now.bowl)
|
||||
node(signatures.p.post (~(uni in signatures) signatures.p.post.node))
|
||||
~| "child graph does not exist to add signatures to!"
|
||||
?> ?=(%graph -.children.node)
|
||||
node(p.children $(graph p.children.node, index t.index))
|
||||
@ -576,28 +527,29 @@
|
||||
graph
|
||||
atom
|
||||
?~ t.index
|
||||
node(signatures.post (~(dif in signatures) signatures.post.node))
|
||||
~| "cannot add signatures to a deleted post"
|
||||
?> ?=(%& -.post.node)
|
||||
node(signatures.p.post (~(dif in signatures) signatures.p.post.node))
|
||||
~| "child graph does not exist to add signatures to!"
|
||||
?> ?=(%graph -.children.node)
|
||||
node(p.children $(graph p.children.node, index t.index))
|
||||
--
|
||||
::
|
||||
++ add-tag
|
||||
|= [=term =resource:store]
|
||||
|= [=term =uid:store]
|
||||
^- (quip card _state)
|
||||
?> (~(has by graphs) resource)
|
||||
:- (give [/updates /tags ~] [%add-tag term resource])
|
||||
?> (~(has by graphs) resource.uid)
|
||||
:- (give [/updates /tags ~] [%add-tag term uid])
|
||||
%_ state
|
||||
tag-queries (~(put ju tag-queries) term resource)
|
||||
tag-queries (~(put ju tag-queries) term uid)
|
||||
==
|
||||
::
|
||||
++ remove-tag
|
||||
|= [=term =resource:store]
|
||||
|= [=term =uid:store]
|
||||
^- (quip card _state)
|
||||
?> (~(has by graphs) resource)
|
||||
:- (give [/updates /tags ~] [%remove-tag term resource])
|
||||
:- (give [/updates /tags ~] [%remove-tag term uid])
|
||||
%_ state
|
||||
tag-queries (~(del ju tag-queries) term resource)
|
||||
tag-queries (~(del ju tag-queries) term uid)
|
||||
==
|
||||
::
|
||||
++ archive-graph
|
||||
@ -610,10 +562,6 @@
|
||||
archive (~(put by archive) resource (~(got by graphs) resource))
|
||||
graphs (~(del by graphs) resource)
|
||||
update-logs (~(del by update-logs) resource)
|
||||
tag-queries
|
||||
%- ~(run by tag-queries)
|
||||
|= =resources:store
|
||||
(~(del in resources) resource)
|
||||
==
|
||||
::
|
||||
++ unarchive-graph
|
||||
@ -648,7 +596,7 @@
|
||||
?- -.q.update
|
||||
%add-graph update(resource.q resource)
|
||||
%add-nodes update(resource.q resource)
|
||||
%remove-nodes update(resource.q resource)
|
||||
%remove-posts update(resource.q resource)
|
||||
%add-signatures update(resource.uid.q resource)
|
||||
%remove-signatures update(resource.uid.q resource)
|
||||
==
|
||||
@ -657,7 +605,7 @@
|
||||
++ give
|
||||
|= [paths=(list path) update=action:store]
|
||||
^- (list card)
|
||||
[%give %fact paths [%graph-update-1 !>([now.bowl update])]]~
|
||||
[%give %fact paths [%graph-update-2 !>([now.bowl update])]]~
|
||||
--
|
||||
::
|
||||
++ debug
|
||||
@ -665,24 +613,33 @@
|
||||
^- (quip card _state)
|
||||
=/ [=graph:store mark=(unit mark:store)]
|
||||
(~(got by graphs) resource.debug-input)
|
||||
?> (validate-graph graph mark)
|
||||
=^ is-valid state
|
||||
(validate-graph graph mark)
|
||||
?> is-valid
|
||||
[~ state]
|
||||
::
|
||||
++ validate-graph
|
||||
|= [=graph:store mark=(unit mark:store)]
|
||||
^- ?
|
||||
?~ mark %.y
|
||||
^- [? _state]
|
||||
?~ mark [%.y state]
|
||||
=/ has-dais (~(has by validators) u.mark)
|
||||
=/ =dais:clay
|
||||
?: has-dais
|
||||
(~(got by validators) u.mark)
|
||||
.^ =dais:clay
|
||||
%cb
|
||||
/(scot %p our.bowl)/[q.byk.bowl]/(scot %da now.bowl)/[u.mark]
|
||||
==
|
||||
:_ state(validators (~(put by validators) u.mark dais))
|
||||
|- ^- ?
|
||||
?~ graph %.y
|
||||
%+ roll (tap:orm graph)
|
||||
|= [[=atom =node:store] out=?]
|
||||
^- ?
|
||||
?& ?=(^ (vale:dais [atom post.node]))
|
||||
?& ?| ?=(%| -.post.node)
|
||||
?=(^ (vale:dais [atom p.post.node]))
|
||||
==
|
||||
::
|
||||
?- -.children.node
|
||||
%empty %.y
|
||||
%graph ^$(graph p.children.node)
|
||||
@ -691,155 +648,9 @@
|
||||
++ poke-import
|
||||
|= arc=*
|
||||
^- (quip card _state)
|
||||
|^
|
||||
=/ sty=state-3 [%3 (remake-network ;;(tree-network +.arc))]
|
||||
:_ sty
|
||||
%+ turn ~(tap by graphs.sty)
|
||||
|= [rid=resource:store =marked-graph:store]
|
||||
^- card
|
||||
?: =(our.bowl entity.rid)
|
||||
=/ =cage [%push-hook-action !>([%add rid])]
|
||||
[%pass / %agent [our.bowl %graph-push-hook] %poke cage]
|
||||
(try-rejoin rid 0)
|
||||
::
|
||||
+$ tree-network
|
||||
$: graphs=tree-graphs
|
||||
tag-queries=(tree [term (tree resource:store)])
|
||||
update-logs=tree-update-logs
|
||||
archive=tree-graphs
|
||||
validators=(tree ^mark)
|
||||
==
|
||||
+$ tree-graphs (tree [resource:store tree-marked-graph])
|
||||
+$ tree-marked-graph [p=tree-graph q=(unit ^mark)]
|
||||
+$ tree-graph (tree [atom tree-node])
|
||||
+$ tree-node [post=tree-post children=tree-internal-graph]
|
||||
+$ tree-internal-graph
|
||||
$~ [%empty ~]
|
||||
$% [%graph p=tree-graph]
|
||||
[%empty ~]
|
||||
==
|
||||
+$ tree-update-logs (tree [resource:store tree-update-log])
|
||||
+$ tree-update-log (tree [time tree-logged-update])
|
||||
+$ tree-logged-update
|
||||
$: p=time
|
||||
$= q
|
||||
$% [%add-graph =resource:store =tree-graph mark=(unit ^mark) ow=?]
|
||||
[%add-nodes =resource:store nodes=(tree [index:store tree-node])]
|
||||
[%remove-nodes =resource:store indices=(tree index:store)]
|
||||
[%add-signatures =uid:store signatures=tree-signatures]
|
||||
[%remove-signatures =uid:store signatures=tree-signatures]
|
||||
==
|
||||
==
|
||||
+$ tree-signatures (tree signature:store)
|
||||
+$ tree-post
|
||||
$: author=ship
|
||||
=index:store
|
||||
time-sent=time
|
||||
contents=(list content:store)
|
||||
hash=(unit hash:store)
|
||||
signatures=tree-signatures
|
||||
==
|
||||
::
|
||||
++ remake-network
|
||||
|= t=tree-network
|
||||
^- network:store
|
||||
:* (remake-graphs graphs.t)
|
||||
(remake-jug tag-queries.t)
|
||||
(remake-update-logs update-logs.t)
|
||||
(remake-graphs archive.t)
|
||||
(remake-set validators.t)
|
||||
==
|
||||
::
|
||||
++ remake-graphs
|
||||
|= t=tree-graphs
|
||||
^- graphs:store
|
||||
%- remake-map
|
||||
(~(run by t) remake-marked-graph)
|
||||
::
|
||||
++ remake-marked-graph
|
||||
|= t=tree-marked-graph
|
||||
^- marked-graph:store
|
||||
[(remake-graph p.t) q.t]
|
||||
::
|
||||
++ remake-graph
|
||||
|= t=tree-graph
|
||||
^- graph:store
|
||||
%+ gas:orm *graph:store
|
||||
%+ turn ~(tap by t)
|
||||
|= [a=atom tn=tree-node]
|
||||
^- [atom node:store]
|
||||
[a (remake-node tn)]
|
||||
::
|
||||
++ remake-internal-graph
|
||||
|= t=tree-internal-graph
|
||||
^- internal-graph:store
|
||||
?: ?=(%empty -.t)
|
||||
[%empty ~]
|
||||
[%graph (remake-graph p.t)]
|
||||
::
|
||||
++ remake-node
|
||||
|= t=tree-node
|
||||
^- node:store
|
||||
:- (remake-post post.t)
|
||||
(remake-internal-graph children.t)
|
||||
::
|
||||
++ remake-update-logs
|
||||
|= t=tree-update-logs
|
||||
^- update-logs:store
|
||||
%- remake-map
|
||||
(~(run by t) remake-update-log)
|
||||
::
|
||||
++ remake-update-log
|
||||
|= t=tree-update-log
|
||||
^- update-log:store
|
||||
=/ ulm ((ordered-map time logged-update:store) gth)
|
||||
%+ gas:ulm *update-log:store
|
||||
%+ turn ~(tap by t)
|
||||
|= [=time tlu=tree-logged-update]
|
||||
^- [^time logged-update:store]
|
||||
[time (remake-logged-update tlu)]
|
||||
::
|
||||
++ remake-logged-update
|
||||
|= t=tree-logged-update
|
||||
^- logged-update:store
|
||||
:- 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
|
||||
(~(run by nodes.q.t) remake-node)
|
||||
::
|
||||
%remove-nodes
|
||||
[%remove-nodes resource.q.t (remake-set indices.q.t)]
|
||||
::
|
||||
%add-signatures
|
||||
[%add-signatures uid.q.t (remake-set signatures.q.t)]
|
||||
::
|
||||
%remove-signatures
|
||||
[%remove-signatures uid.q.t (remake-set signatures.q.t)]
|
||||
==
|
||||
::
|
||||
++ remake-post
|
||||
|= t=tree-post
|
||||
^- post:store
|
||||
t(signatures (remake-set signatures.t))
|
||||
--
|
||||
::
|
||||
++ try-rejoin
|
||||
|= [rid=resource:store nack-count=@]
|
||||
^- card
|
||||
=/ res-path (en-path:res rid)
|
||||
=/ wire [%try-rejoin (scot %ud nack-count) res-path]
|
||||
[%pass wire %agent [entity.rid %graph-push-hook] %watch resource+res-path]
|
||||
=^ cards -.state
|
||||
(import:store arc our.bowl)
|
||||
[cards state]
|
||||
--
|
||||
::
|
||||
++ on-peek
|
||||
@ -858,15 +669,15 @@
|
||||
``noun+!>(q.u.result)
|
||||
::
|
||||
[%x %keys ~]
|
||||
:- ~ :- ~ :- %graph-update-1
|
||||
:- ~ :- ~ :- %graph-update-2
|
||||
!>(`update:store`[now.bowl [%keys ~(key by graphs)]])
|
||||
::
|
||||
[%x %tags ~]
|
||||
:- ~ :- ~ :- %graph-update-1
|
||||
:- ~ :- ~ :- %graph-update-2
|
||||
!>(`update:store`[now.bowl [%tags ~(key by tag-queries)]])
|
||||
::
|
||||
[%x %tag-queries ~]
|
||||
:- ~ :- ~ :- %graph-update-1
|
||||
:- ~ :- ~ :- %graph-update-2
|
||||
!>(`update:store`[now.bowl [%tag-queries tag-queries]])
|
||||
::
|
||||
[%x %graph @ @ ~]
|
||||
@ -875,7 +686,7 @@
|
||||
=/ result=(unit marked-graph:store)
|
||||
(~(get by graphs) [ship term])
|
||||
?~ result [~ ~]
|
||||
:- ~ :- ~ :- %graph-update-1
|
||||
:- ~ :- ~ :- %graph-update-2
|
||||
!> ^- update:store
|
||||
:- now.bowl
|
||||
[%add-graph [ship term] `graph:store`p.u.result q.u.result %.y]
|
||||
@ -890,7 +701,7 @@
|
||||
?~ result
|
||||
~& no-archived-graph+[ship term]
|
||||
[~ ~]
|
||||
:- ~ :- ~ :- %graph-update-1
|
||||
:- ~ :- ~ :- %graph-update-2
|
||||
!> ^- update:store
|
||||
:- now.bowl
|
||||
[%add-graph [ship term] `graph:store`p.u.result q.u.result %.y]
|
||||
@ -906,13 +717,13 @@
|
||||
=/ graph=(unit marked-graph:store)
|
||||
(~(get by graphs) [ship term])
|
||||
?~ graph [~ ~]
|
||||
:- ~ :- ~ :- %graph-update-1
|
||||
:- ~ :- ~ :- %graph-update-2
|
||||
!> ^- update:store
|
||||
:- now.bowl
|
||||
:+ %add-nodes
|
||||
[ship term]
|
||||
%- ~(gas by *(map index:store node:store))
|
||||
%+ turn (tap:orm `graph:store`(subset:orm p.u.graph start end))
|
||||
%+ turn (tap:orm `graph:store`(lot:orm p.u.graph start end))
|
||||
|= [=atom =node:store]
|
||||
^- [index:store node:store]
|
||||
[~[atom] node]
|
||||
@ -933,7 +744,7 @@
|
||||
(turn t.t.t.t.path (cury slav %ud))
|
||||
=/ node=(unit node:store) (get-node ship term index)
|
||||
?~ node [~ ~]
|
||||
:- ~ :- ~ :- %graph-update-1
|
||||
:- ~ :- ~ :- %graph-update-2
|
||||
!> ^- update:store
|
||||
:- now.bowl
|
||||
:+ %add-nodes
|
||||
@ -952,7 +763,7 @@
|
||||
=/ graph
|
||||
(get-node-children ship term parent)
|
||||
?~ graph [~ ~]
|
||||
:- ~ :- ~ :- %graph-update-1
|
||||
:- ~ :- ~ :- %graph-update-2
|
||||
!> ^- update:store
|
||||
:- now.bowl
|
||||
:+ %add-nodes
|
||||
@ -963,7 +774,7 @@
|
||||
%+ turn
|
||||
=- ?.(older (slag (safe-sub (lent -) count) -) (scag count -))
|
||||
%- tap:orm
|
||||
%+ subset:orm u.graph
|
||||
%+ lot:orm u.graph
|
||||
=/ idx
|
||||
(snag (dec (lent index)) index)
|
||||
?:(older [`idx ~] [~ `idx])
|
||||
@ -982,7 +793,7 @@
|
||||
=/ children
|
||||
(get-node-children ship term index)
|
||||
?~ children [~ ~]
|
||||
:- ~ :- ~ :- %graph-update-1
|
||||
:- ~ :- ~ :- %graph-update-2
|
||||
!> ^- update:store
|
||||
:- now.bowl
|
||||
:+ %add-nodes
|
||||
@ -1008,13 +819,13 @@
|
||||
?- -.children.u.node
|
||||
%empty [~ ~]
|
||||
%graph
|
||||
:- ~ :- ~ :- %graph-update-1
|
||||
:- ~ :- ~ :- %graph-update-2
|
||||
!> ^- update:store
|
||||
:- now.bowl
|
||||
:+ %add-nodes
|
||||
[ship term]
|
||||
%- ~(gas by *(map index:store node:store))
|
||||
%+ turn (tap:orm `graph:store`(subset:orm p.children.u.node end start))
|
||||
%+ turn (tap:orm `graph:store`(lot:orm p.children.u.node end start))
|
||||
|= [=atom =node:store]
|
||||
^- [index:store node:store]
|
||||
[(snoc index atom) node]
|
||||
@ -1028,7 +839,7 @@
|
||||
=/ update-log=(unit update-log:store) (~(get by update-logs) [ship term])
|
||||
?~ update-log [~ ~]
|
||||
:: orm-log is ordered backwards, so swap start and end
|
||||
``noun+!>((subset:orm-log u.update-log end start))
|
||||
``noun+!>((lot:orm-log u.update-log end start))
|
||||
::
|
||||
[%x %update-log @ @ ~]
|
||||
=/ =ship (slav %p i.t.t.path)
|
||||
@ -1046,7 +857,7 @@
|
||||
%+ biff m-update-log
|
||||
|= =update-log:store
|
||||
=/ result=(unit [=time =update:store])
|
||||
(peek:orm-log:store update-log)
|
||||
(pry:orm-log:store update-log)
|
||||
(bind result |=([=time update:store] time))
|
||||
==
|
||||
::
|
||||
|
@ -47,8 +47,9 @@
|
||||
::
|
||||
++ transform-proxy-update
|
||||
|= vas=vase
|
||||
^- (unit vase)
|
||||
^- (quip card (unit vase))
|
||||
=/ =update:store !<(update:store vas)
|
||||
:- ~
|
||||
?: ?=(%initial -.update)
|
||||
~
|
||||
|^
|
||||
|
@ -24,7 +24,6 @@
|
||||
watch-on-self=_&
|
||||
==
|
||||
::
|
||||
::
|
||||
++ scry
|
||||
|* [[our=@p now=@da] =mold p=path]
|
||||
?> ?=(^ p)
|
||||
@ -37,7 +36,6 @@
|
||||
%^ scry [our now]
|
||||
tube:clay
|
||||
/cc/[desk]/[mark]/notification-kind
|
||||
::
|
||||
--
|
||||
::
|
||||
=| state-1
|
||||
@ -126,15 +124,15 @@
|
||||
::
|
||||
++ poke-noun
|
||||
|= non=*
|
||||
?> ?=(%rewatch-dms non)
|
||||
=/ graphs=(list resource)
|
||||
~(tap in get-keys:gra)
|
||||
:- ~
|
||||
%_ state
|
||||
watching
|
||||
%- ~(gas in watching)
|
||||
(murn graphs |=(rid=resource ?:((should-watch:ha rid) `[rid ~] ~)))
|
||||
==
|
||||
[~ state]
|
||||
:: ?> ?=(%rewatch-dms non)
|
||||
:: =/ graphs=(list resource)
|
||||
:: ~(tap in get-keys:gra)
|
||||
:: %_ state
|
||||
:: watching
|
||||
:: %- ~(gas in watching)
|
||||
:: (murn graphs |=(rid=resource ?:((should-watch:ha rid) `[rid ~] ~)))
|
||||
:: ==
|
||||
::
|
||||
++ hark-graph-hook-action
|
||||
|= =action:hook
|
||||
@ -182,7 +180,7 @@
|
||||
~[watch-graph:ha]
|
||||
::
|
||||
%fact
|
||||
?. ?=(%graph-update-1 p.cage.sign)
|
||||
?. ?=(%graph-update-2 p.cage.sign)
|
||||
(on-agent:def wire sign)
|
||||
=^ cards state
|
||||
(graph-update !<(update:graph-store q.cage.sign))
|
||||
@ -197,18 +195,20 @@
|
||||
::
|
||||
?(%remove-graph %archive-graph)
|
||||
(remove-graph resource.q.update)
|
||||
::
|
||||
%remove-nodes
|
||||
(remove-nodes resource.q.update indices.q.update)
|
||||
::
|
||||
::
|
||||
%remove-posts
|
||||
(remove-posts resource.q.update indices.q.update)
|
||||
::
|
||||
%add-nodes
|
||||
=* rid resource.q.update
|
||||
(check-nodes ~(val by nodes.q.update) rid)
|
||||
=/ assoc=(unit association:metadata)
|
||||
(peek-association:met %graph rid)
|
||||
(check-nodes ~(val by nodes.q.update) rid assoc)
|
||||
==
|
||||
:: this is awful, but notification kind should always switch
|
||||
:: on the index, so hopefully doesn't matter
|
||||
:: TODO: rethink this
|
||||
++ remove-nodes
|
||||
++ remove-posts
|
||||
|= [rid=resource indices=(set index:graph-store)]
|
||||
=/ to-remove
|
||||
%- ~(gas by *(set [resource index:graph-store]))
|
||||
@ -256,32 +256,31 @@
|
||||
=/ graph=graph:graph-store :: graph in subscription is bunted
|
||||
(get-graph-mop:gra rid)
|
||||
=/ node=(unit node:graph-store)
|
||||
(bind (peek:orm:graph-store graph) |=([@ =node:graph-store] node))
|
||||
(bind (pry:orm:graph-store graph) |=([@ =node:graph-store] node))
|
||||
=/ assoc=(unit association:metadata)
|
||||
(peek-association:met %graph rid)
|
||||
=^ cards state
|
||||
(check-nodes (drop node) rid)
|
||||
?. (should-watch:ha rid)
|
||||
(check-nodes (drop node) rid assoc)
|
||||
?. (should-watch:ha rid assoc)
|
||||
[cards state]
|
||||
:_ state(watching (~(put in watching) [rid ~]))
|
||||
(weld cards (give:ha ~[/updates] %listen [rid ~]))
|
||||
::
|
||||
::
|
||||
++ check-nodes
|
||||
|= $: nodes=(list node:graph-store)
|
||||
rid=resource
|
||||
assoc=(unit association:metadata)
|
||||
==
|
||||
=/ group=(unit resource)
|
||||
(peek-group:met %graph rid)
|
||||
?~ group
|
||||
~& no-group+rid
|
||||
?~ assoc
|
||||
~& no-assoc+rid
|
||||
`state
|
||||
=/ metadatum=(unit metadatum:metadata)
|
||||
(peek-metadatum:met %graph rid)
|
||||
?~ metadatum `state
|
||||
=* group group.u.assoc
|
||||
=* metadatum metadatum.u.assoc
|
||||
=/ module=term
|
||||
?: ?=(%empty -.config.u.metadatum) %$
|
||||
?: ?=(%group -.config.u.metadatum) %$
|
||||
module.config.u.metadatum
|
||||
abet:check:(abed:handle-update:ha rid nodes u.group module)
|
||||
?: ?=(%empty -.config.metadatum) %$
|
||||
?: ?=(%group -.config.metadatum) %$
|
||||
module.config.metadatum
|
||||
abet:check:(abed:handle-update:ha rid nodes group module)
|
||||
--
|
||||
::
|
||||
++ on-peek on-peek:def
|
||||
@ -343,12 +342,11 @@
|
||||
$(contents t.contents)
|
||||
::
|
||||
++ should-watch
|
||||
|= rid=resource
|
||||
|= [rid=resource assoc=(unit association:metadata)]
|
||||
^- ?
|
||||
=/ group-rid=(unit resource)
|
||||
(peek-group:met %graph rid)
|
||||
?~ group-rid %.n
|
||||
?| !(is-managed:grp u.group-rid)
|
||||
?~ assoc
|
||||
%.n
|
||||
?| !(is-managed:grp group.u.assoc)
|
||||
&(watch-on-self =(our.bowl entity.rid))
|
||||
==
|
||||
::
|
||||
@ -367,7 +365,9 @@
|
||||
update-core(rid r, updates upds, group grp, module mod)
|
||||
::
|
||||
++ get-conversion
|
||||
(^get-conversion rid)
|
||||
:: LA: this tube should be cached in %hark-graph-hook state
|
||||
:: instead of just trying to keep it warm, as the scry overhead is large
|
||||
~+ (^get-conversion rid)
|
||||
::
|
||||
++ abet
|
||||
^- (quip card _state)
|
||||
@ -417,30 +417,34 @@
|
||||
|= =node:graph-store
|
||||
^+ update-core
|
||||
=. update-core (check-node-children node)
|
||||
?: ?=(%| -.post.node)
|
||||
update-core
|
||||
=* pos p.post.node
|
||||
=+ !< notif-kind=(unit notif-kind:hook)
|
||||
(get-conversion !>([0 post.node]))
|
||||
%- get-conversion
|
||||
!>(`indexed-post:graph-store`[0 pos])
|
||||
?~ notif-kind
|
||||
update-core
|
||||
=/ desc=@t
|
||||
?: (is-mention contents.post.node)
|
||||
?: (is-mention contents.pos)
|
||||
%mention
|
||||
name.u.notif-kind
|
||||
=* not-kind u.notif-kind
|
||||
=/ parent=index:post
|
||||
(scag parent.index-len.not-kind index.post.node)
|
||||
(scag parent.index-len.not-kind index.pos)
|
||||
=/ notif-index=index:store
|
||||
[%graph group rid module desc parent]
|
||||
?: =(our.bowl author.post.node)
|
||||
?: =(our.bowl author.pos)
|
||||
(self-post node notif-index not-kind)
|
||||
=. update-core
|
||||
(update-unread-count not-kind notif-index [time-sent index]:post.node)
|
||||
(update-unread-count not-kind notif-index [time-sent index]:pos)
|
||||
=? update-core
|
||||
?| =(desc %mention)
|
||||
(~(has in watching) [rid parent])
|
||||
==
|
||||
=/ =contents:store
|
||||
[%graph (limo post.node ~)]
|
||||
(add-unread notif-index [time-sent.post.node %.n contents])
|
||||
[%graph (limo pos ~)]
|
||||
(add-unread notif-index [time-sent.pos %.n contents])
|
||||
update-core
|
||||
::
|
||||
++ update-unread-count
|
||||
@ -459,19 +463,19 @@
|
||||
=notif-kind:hook
|
||||
==
|
||||
^+ update-core
|
||||
?> ?=(%& -.post.node)
|
||||
=/ =stats-index:store
|
||||
(to-stats-index:store index)
|
||||
=. update-core
|
||||
(hark %seen-index time-sent.post.node stats-index)
|
||||
(hark %seen-index time-sent.p.post.node stats-index)
|
||||
=? update-core ?=(%count mode.notif-kind)
|
||||
(hark %read-count stats-index)
|
||||
=? update-core watch-on-self
|
||||
(new-watch index.post.node [watch-for index-len]:notif-kind)
|
||||
(new-watch index.p.post.node [watch-for index-len]:notif-kind)
|
||||
update-core
|
||||
::
|
||||
++ add-unread
|
||||
|= [=index:store =notification:store]
|
||||
(hark %add-note index notification)
|
||||
::
|
||||
--
|
||||
--
|
||||
|
@ -202,7 +202,7 @@
|
||||
++ convert-graph-contents-4
|
||||
|= con=(list post:post-zero:post)
|
||||
^- (list post:post)
|
||||
(turn con post-to-one:graph-store)
|
||||
(turn con post-to-one:upgrade:graph-store)
|
||||
::
|
||||
++ convert-notifications-3
|
||||
|= old=notifications:state-two:store
|
||||
|
@ -24,6 +24,6 @@
|
||||
<div id="portal-root"></div>
|
||||
<script src="/~landscape/js/channel.js"></script>
|
||||
<script src="/~landscape/js/session.js"></script>
|
||||
<script src="/~landscape/js/bundle/index.59e682153138f604d358.js"></script>
|
||||
<script src="/~landscape/js/bundle/index.f252a9afb6e952de19c9.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -191,9 +191,14 @@
|
||||
^- (unit (unit cage))
|
||||
?. (team:title our.bowl src.bowl) ~
|
||||
?+ path [~ ~]
|
||||
[%x %tiles ~] ``noun+!>([tiles tile-ordering])
|
||||
[%x %first-time ~] ``noun+!>(first-time)
|
||||
[%x %keys ~] ``noun+!>(~(key by tiles))
|
||||
[%x %tiles ~] ``noun+!>([tiles tile-ordering])
|
||||
[%x %first-time ~] ``noun+!>(first-time)
|
||||
[%x %keys ~] ``noun+!>(~(key by tiles))
|
||||
::
|
||||
[%x %runtime-lag ~]
|
||||
:^ ~ ~ %json
|
||||
!> ^- json
|
||||
b+.^(? //(scot %p our.bowl)//(scot %da now.bowl)/zen/lag)
|
||||
==
|
||||
::
|
||||
++ on-arvo
|
||||
|
@ -59,8 +59,9 @@
|
||||
::
|
||||
++ transform-proxy-update
|
||||
|= vas=vase
|
||||
^- (unit vase)
|
||||
^- (quip card (unit vase))
|
||||
=/ =update:store !<(update:store vas)
|
||||
:- ~
|
||||
?. ?=(?(%add %remove) -.update)
|
||||
~
|
||||
=/ role=(unit (unit role-tag))
|
||||
|
@ -5,6 +5,6 @@
|
||||
|= $: [now=@da eny=@uvJ =beak]
|
||||
[[=resource mark=(unit mark) overwrite=? ~] ~]
|
||||
==
|
||||
:- %graph-update-1
|
||||
:- %graph-update-2
|
||||
^- update
|
||||
[now [%add-graph resource (gas:orm ~ ~) mark overwrite]]
|
||||
|
@ -12,9 +12,9 @@
|
||||
contents.post contents
|
||||
==
|
||||
::
|
||||
:- %graph-update-1
|
||||
:- %graph-update-2
|
||||
^- update
|
||||
:- now
|
||||
:+ %add-nodes [our name]
|
||||
%- ~(gas by *(map index node))
|
||||
~[[[now]~ [post [%empty ~]]]]
|
||||
~[[[now]~ [[%& post] [%empty ~]]]]
|
||||
|
@ -5,6 +5,6 @@
|
||||
|= $: [now=@da eny=@uvJ =beak]
|
||||
[[[=resource =index] =signatures ~] ~]
|
||||
==
|
||||
:- %graph-update-1
|
||||
:- %graph-update-2
|
||||
^- update
|
||||
[now [%add-signatures [resource index] signatures]]
|
||||
|
@ -3,8 +3,8 @@
|
||||
/- *graph-store
|
||||
:- %say
|
||||
|= $: [now=@da eny=@uvJ =beak]
|
||||
[[=term =resource ~] ~]
|
||||
[[=term =uid ~] ~]
|
||||
==
|
||||
:- %graph-update-1
|
||||
:- %graph-update-2
|
||||
^- update
|
||||
[now [%add-tag term resource]]
|
||||
[now [%add-tag term uid]]
|
||||
|
@ -5,6 +5,6 @@
|
||||
|= $: [now=@da eny=@uvJ =beak]
|
||||
[[=resource ~] ~]
|
||||
==
|
||||
:- %graph-update-1
|
||||
:- %graph-update-2
|
||||
^- update
|
||||
[now [%archive-graph resource]]
|
||||
|
@ -4,7 +4,7 @@
|
||||
|= $: [now=@da eny=@uvJ bec=beak]
|
||||
[[=ship graph=term ~] ~]
|
||||
==
|
||||
:- %graph-update-1
|
||||
:- %graph-update-2
|
||||
=/ our (scot %p p.bec)
|
||||
=/ wen (scot %da now)
|
||||
=/ who (scot %p ship)
|
||||
|
@ -4,6 +4,6 @@
|
||||
|= $: [now=@da eny=@uvJ bec=beak]
|
||||
[[graph=term =path ~] ~]
|
||||
==
|
||||
:- %graph-update-1
|
||||
:- %graph-update-2
|
||||
=- ~& update=- -
|
||||
.^(=update:graph-store %cx path)
|
||||
|
@ -5,6 +5,6 @@
|
||||
|= $: [now=@da eny=@uvJ =beak]
|
||||
[[=resource ~] ~]
|
||||
==
|
||||
:- %graph-update-1
|
||||
:- %graph-update-2
|
||||
^- update
|
||||
[now [%remove-graph resource]]
|
||||
|
@ -1,10 +1,10 @@
|
||||
:: graph-store|remove-nodes: remove nodes from a graph at indices
|
||||
:: graph-store|remove-posts: remove nodes from a graph at indices
|
||||
::
|
||||
/- *graph-store
|
||||
:- %say
|
||||
|= $: [now=@da eny=@uvJ =beak]
|
||||
[[=resource indices=(set index) ~] ~]
|
||||
==
|
||||
:- %graph-update-1
|
||||
:- %graph-update-2
|
||||
^- update
|
||||
[now [%remove-nodes resource indices]]
|
||||
[now [%remove-posts resource indices]]
|
@ -6,6 +6,6 @@
|
||||
|= $: [now=@da eny=@uvJ =beak]
|
||||
[[[=resource =index] =signatures ~] ~]
|
||||
==
|
||||
:- %graph-update-1
|
||||
:- %graph-update-2
|
||||
^- update
|
||||
[now [%remove-signatures [resource index] signatures]]
|
||||
|
@ -3,8 +3,8 @@
|
||||
/- *graph-store
|
||||
:- %say
|
||||
|= $: [now=@da eny=@uvJ =beak]
|
||||
[[=term =resource ~] ~]
|
||||
[[=term =uid ~] ~]
|
||||
==
|
||||
:- %graph-update-1
|
||||
:- %graph-update-2
|
||||
^- update
|
||||
[now [%remove-tag term resource]]
|
||||
[now [%remove-tag term uid]]
|
||||
|
@ -5,6 +5,6 @@
|
||||
|= $: [now=@da eny=@uvJ =beak]
|
||||
[[=resource ~] ~]
|
||||
==
|
||||
:- %graph-update-1
|
||||
:- %graph-update-2
|
||||
^- update
|
||||
[now [%unarchive-graph resource]]
|
||||
|
@ -3,15 +3,14 @@
|
||||
:::: /hoon/code/hood/gen
|
||||
::
|
||||
/? 310
|
||||
::
|
||||
::::
|
||||
::
|
||||
:- %say
|
||||
/- *sole
|
||||
/+ *generators
|
||||
:- %ask
|
||||
|= $: [now=@da eny=@uvJ bec=beak]
|
||||
[arg=?(~ [%reset ~]) ~]
|
||||
==
|
||||
=* our p.bec
|
||||
:- %helm-code
|
||||
^- (sole-result [%helm-code ?(~ %reset)])
|
||||
?~ arg
|
||||
=/ code=tape
|
||||
%+ slag 1
|
||||
@ -20,11 +19,23 @@
|
||||
=/ step=tape
|
||||
%+ scow %ud
|
||||
.^(@ud %j /(scot %p our)/step/(scot %da now)/(scot %p our))
|
||||
%- %- slog
|
||||
:~ [%leaf code]
|
||||
[%leaf (weld "current step=" step)]
|
||||
[%leaf "use |code %reset to invalidate this and generate a new code"]
|
||||
==
|
||||
~
|
||||
::
|
||||
%+ print 'use |code %reset to invalidate this and generate a new code'
|
||||
%+ print leaf+(weld "current step=" step)
|
||||
%+ print leaf+code
|
||||
(produce [%helm-code ~])
|
||||
::
|
||||
?> =(%reset -.arg)
|
||||
%reset
|
||||
%+ print 'continue?'
|
||||
%+ print 'warning: resetting your code closes all web sessions'
|
||||
%+ prompt
|
||||
[%& %project "y/n: "]
|
||||
%+ parse
|
||||
;~ pose
|
||||
(cold %.y (mask "yY"))
|
||||
(cold %.n (mask "nN"))
|
||||
==
|
||||
|= reset=?
|
||||
?. reset
|
||||
no-product
|
||||
(produce [%helm-code %reset])
|
||||
|
15
pkg/arvo/gen/hood/fuse.hoon
Normal file
15
pkg/arvo/gen/hood/fuse.hoon
Normal file
@ -0,0 +1,15 @@
|
||||
:: Kiln: Fuse local desk from (optionally-)foreign sources
|
||||
::
|
||||
:::: /hoon/fuse/hood/gen
|
||||
::
|
||||
/* help-text %txt /gen/hood/fuse/help/txt
|
||||
=, clay
|
||||
::
|
||||
::::
|
||||
::
|
||||
:- %say
|
||||
|= [[now=@da eny=@uvJ bec=beak] [arg=[?(~ [des=desk bas=beak con=(list [beak germ]) ~])]] ~]
|
||||
:- %kiln-fuse
|
||||
?~ arg
|
||||
((slog (turn `wain`help-text |=(=@t leaf+(trip t)))) ~)
|
||||
[des bas con]:arg
|
8
pkg/arvo/gen/hood/fuse/help.txt
Normal file
8
pkg/arvo/gen/hood/fuse/help.txt
Normal file
@ -0,0 +1,8 @@
|
||||
Usage:
|
||||
|
||||
|fuse %destination-desk base-beak ~[[source-beak %some-germ] [another-beak %another-germ]]
|
||||
|
||||
A fuse replaces the contents of %destination-desk with the merge of the
|
||||
specified beaks according to their merge strategies. This has no dependence
|
||||
on the previous state of %destination-desk so any commits/work there will
|
||||
be overwritten.
|
@ -1,5 +1,5 @@
|
||||
/- gr=group, md=metadata-store, ga=graph-store
|
||||
/+ re=resource
|
||||
/+ re=resource, graph=graph-store
|
||||
!:
|
||||
:- %say
|
||||
|= $: [now=@da eny=@uvJ =beak]
|
||||
@ -67,7 +67,7 @@
|
||||
=/ real=(set resource:re)
|
||||
=/ upd=update:ga
|
||||
%+ scry update:ga
|
||||
[%x %graph-store /keys/graph-update-1]
|
||||
[%x %graph-store /keys/graph-update-2]
|
||||
?> ?=(%keys -.q.upd)
|
||||
resources.q.upd
|
||||
:: count activity per channel
|
||||
@ -86,14 +86,17 @@
|
||||
%+ scry update:ga
|
||||
[%x %graph-store /graph/(scot %p entity.r)/[name.r]/noun]
|
||||
?> ?=(%add-graph -.q.upd)
|
||||
=/ mo ((ordered-map atom node:ga) gth)
|
||||
=* mo orm:graph
|
||||
=/ week=(list [@da node:ga])
|
||||
(tap:mo (subset:mo graph.q.upd ~ `(sub now ~d7)))
|
||||
(tap:mo (lot:mo graph.q.upd ~ `(sub now ~d7)))
|
||||
:- (lent week)
|
||||
%~ wyt in
|
||||
%+ roll week
|
||||
|= [[* [author=ship *] *] a=(set ship)]
|
||||
(~(put in a) author)
|
||||
|= [[* mp=maybe-post:ga *] a=(set ship)]
|
||||
?- -.mp
|
||||
%| a
|
||||
%& (~(put in a) author.p.mp)
|
||||
==
|
||||
:: render results
|
||||
::
|
||||
:- (tac 'the date is ' (scot %da now))
|
||||
|
@ -1,105 +1,10 @@
|
||||
/- sur=graph-store, pos=post
|
||||
/+ res=resource
|
||||
/+ res=resource, migrate
|
||||
=< [sur .]
|
||||
=< [pos .]
|
||||
=, sur
|
||||
=, pos
|
||||
|%
|
||||
::
|
||||
++ update-log-to-one
|
||||
|= =update-log:zero
|
||||
^- ^update-log
|
||||
%+ gas:orm-log *^update-log
|
||||
%+ turn (tap:orm-log:zero update-log)
|
||||
|= [=time =logged-update:zero]
|
||||
:- time
|
||||
:- p.logged-update
|
||||
(logged-update-to-one q.logged-update)
|
||||
::
|
||||
++ logged-update-to-one
|
||||
|= upd=logged-update-0:zero
|
||||
?+ -.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
|
||||
::
|
||||
++ upgrade
|
||||
|* [in-pst=mold out-pst=mold]
|
||||
=>
|
||||
|%
|
||||
++ in-orm
|
||||
((ordered-map atom in-node) gth)
|
||||
+$ 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
|
||||
((ordered-map atom out-node) gth)
|
||||
+$ 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)]
|
||||
--
|
||||
:: NOTE: move these functions to zuse
|
||||
++ nu :: parse number as hex
|
||||
|= jon=json
|
||||
@ -145,18 +50,17 @@
|
||||
==
|
||||
::
|
||||
++ index
|
||||
|= i=^index
|
||||
|= ind=^index
|
||||
^- json
|
||||
?: =(~ i) s+'/'
|
||||
=/ j=^tape ""
|
||||
|-
|
||||
?~ i [%s (crip j)]
|
||||
=/ k=json (numb i.i)
|
||||
?> ?=(%n -.k)
|
||||
%_ $
|
||||
i t.i
|
||||
j (weld j (weld "/" (trip +.k)))
|
||||
==
|
||||
:- %s
|
||||
?: =(~ ind)
|
||||
'/'
|
||||
%+ roll ind
|
||||
|= [cur=@ acc=@t]
|
||||
^- @t
|
||||
=/ num (numb cur)
|
||||
?> ?=(%n -.num)
|
||||
(rap 3 acc '/' p.num ~)
|
||||
::
|
||||
++ uid
|
||||
|= u=^uid
|
||||
@ -212,6 +116,14 @@
|
||||
s+(enjs-path:res grp)
|
||||
--
|
||||
::
|
||||
++ maybe-post
|
||||
|= mp=^maybe-post
|
||||
^- json
|
||||
?- -.mp
|
||||
%| s+(scot %ux p.mp)
|
||||
%& (post p.mp)
|
||||
==
|
||||
::
|
||||
++ post
|
||||
|= p=^post
|
||||
^- json
|
||||
@ -252,8 +164,8 @@
|
||||
[%nodes (nodes nodes.upd)]
|
||||
==
|
||||
::
|
||||
%remove-nodes
|
||||
:- %remove-nodes
|
||||
%remove-posts
|
||||
:- %remove-posts
|
||||
%- pairs
|
||||
:~ [%resource (enjs:res resource.upd)]
|
||||
[%indices (indices indices.upd)]
|
||||
@ -277,14 +189,14 @@
|
||||
:- %add-tag
|
||||
%- pairs
|
||||
:~ [%term s+term.upd]
|
||||
[%resource (enjs:res resource.upd)]
|
||||
[%uid (uid uid.upd)]
|
||||
==
|
||||
::
|
||||
%remove-tag
|
||||
:- %remove-tag
|
||||
%- pairs
|
||||
:~ [%term s+term.upd]
|
||||
[%resource (enjs:res resource.upd)]
|
||||
[%uid (uid uid.upd)]
|
||||
==
|
||||
::
|
||||
%archive-graph
|
||||
@ -306,9 +218,9 @@
|
||||
:- %tag-queries
|
||||
%- pairs
|
||||
%+ turn ~(tap by tag-queries.upd)
|
||||
|= [=term =resources]
|
||||
|= [=term uids=(set ^uid)]
|
||||
^- [cord json]
|
||||
[term [%a (turn ~(tap in resources) enjs:res)]]
|
||||
[term [%a (turn ~(tap in uids) uid)]]
|
||||
==
|
||||
::
|
||||
++ graph
|
||||
@ -328,7 +240,7 @@
|
||||
|= n=^node
|
||||
^- json
|
||||
%- pairs
|
||||
:~ [%post (post post.n)]
|
||||
:~ [%post (maybe-post post.n)]
|
||||
:- %children
|
||||
?- -.children.n
|
||||
%empty ~
|
||||
@ -336,7 +248,6 @@
|
||||
==
|
||||
==
|
||||
::
|
||||
::
|
||||
++ nodes
|
||||
|= m=(map ^index ^node)
|
||||
^- json
|
||||
@ -370,7 +281,7 @@
|
||||
++ decode
|
||||
%- of
|
||||
:~ [%add-nodes add-nodes]
|
||||
[%remove-nodes remove-nodes]
|
||||
[%remove-posts remove-posts]
|
||||
[%add-signatures add-signatures]
|
||||
[%remove-signatures remove-signatures]
|
||||
::
|
||||
@ -422,7 +333,7 @@
|
||||
::
|
||||
++ node
|
||||
%- ot
|
||||
:~ [%post post]
|
||||
:~ [%post maybe-post]
|
||||
[%children internal-graph]
|
||||
==
|
||||
::
|
||||
@ -433,6 +344,15 @@
|
||||
[%empty ~]
|
||||
[%graph (graph jon)]
|
||||
::
|
||||
++ maybe-post
|
||||
|= jon=json
|
||||
^- ^maybe-post
|
||||
?~ jon !!
|
||||
?+ -.jon !!
|
||||
%s [%| (nu jon)]
|
||||
%o [%& (post jon)]
|
||||
==
|
||||
::
|
||||
++ post
|
||||
%- ot
|
||||
:~ [%author (su ;~(pfix sig fed:ag))]
|
||||
@ -489,9 +409,8 @@
|
||||
:~ expression+so
|
||||
output+tang
|
||||
==
|
||||
|
||||
::
|
||||
++ remove-nodes
|
||||
++ remove-posts
|
||||
%- ot
|
||||
:~ [%resource dejs:res]
|
||||
[%indices (as index)]
|
||||
@ -527,13 +446,13 @@
|
||||
++ add-tag
|
||||
%- ot
|
||||
:~ [%term so]
|
||||
[%resource dejs:res]
|
||||
[%uid uid]
|
||||
==
|
||||
::
|
||||
++ remove-tag
|
||||
%- ot
|
||||
:~ [%term so]
|
||||
[%resource dejs:res]
|
||||
[%uid uid]
|
||||
==
|
||||
::
|
||||
++ keys
|
||||
@ -568,4 +487,391 @@
|
||||
*signatures
|
||||
==
|
||||
--
|
||||
::
|
||||
++ upgrade
|
||||
|%
|
||||
::
|
||||
:: +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]
|
||||
::
|
||||
::
|
||||
:: +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
|
||||
::
|
||||
++ upgrade
|
||||
|* [in-pst=mold out-pst=mold]
|
||||
=>
|
||||
|%
|
||||
++ in-orm
|
||||
((ordered-map atom in-node) gth)
|
||||
+$ 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
|
||||
((ordered-map atom out-node) gth)
|
||||
+$ 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)]
|
||||
--
|
||||
::
|
||||
++ 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)
|
||||
--
|
||||
--
|
||||
++ import
|
||||
|= [arc=* our=ship]
|
||||
^- (quip card:agent:gall [%5 network])
|
||||
|^
|
||||
=/ sty [%5 (remake-network ;;(tree-network +.arc))]
|
||||
:_ 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
|
||||
tag-queries=(tree [term (tree uid)])
|
||||
update-logs=tree-update-logs
|
||||
archive=tree-graphs
|
||||
~
|
||||
==
|
||||
+$ 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)
|
||||
~
|
||||
==
|
||||
::
|
||||
++ 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
|
||||
=/ ulm ((ordered-map time logged-update) gth)
|
||||
%+ 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]
|
||||
[%pass wire %agent [entity.rid %graph-push-hook] %watch resource+res-path]
|
||||
--
|
||||
--
|
||||
|
@ -19,7 +19,7 @@
|
||||
%add-graph ~[resource.q.update]
|
||||
%remove-graph ~[resource.q.update]
|
||||
%add-nodes ~[resource.q.update]
|
||||
%remove-nodes ~[resource.q.update]
|
||||
%remove-posts ~[resource.q.update]
|
||||
%add-signatures ~[resource.uid.q.update]
|
||||
%remove-signatures ~[resource.uid.q.update]
|
||||
%archive-graph ~[resource.q.update]
|
||||
@ -76,6 +76,7 @@
|
||||
++ get-graph
|
||||
|= res=resource
|
||||
^- update:store
|
||||
=- -(p *time)
|
||||
%+ scry-for update:store
|
||||
/graph/(scot %p entity.res)/[name.res]
|
||||
::
|
||||
|
@ -75,7 +75,12 @@
|
||||
=/ grp=(unit group)
|
||||
(scry-group rid)
|
||||
?~ grp ~
|
||||
=* group u.grp
|
||||
(role-for-ship-with-group u.grp rid ship)
|
||||
::
|
||||
++ role-for-ship-with-group
|
||||
|= [grp=group rid=resource =ship]
|
||||
^- (unit (unit role-tag))
|
||||
=* group grp
|
||||
=* policy policy.group
|
||||
=* tags tags.group
|
||||
=/ admins=(set ^ship)
|
||||
@ -106,8 +111,13 @@
|
||||
^- (set ship)
|
||||
=/ grp=(unit group)
|
||||
(scry-group rid)
|
||||
?~ grp ~
|
||||
(~(get ju tags.u.grp) tag)
|
||||
?~ grp ~
|
||||
(get-tagged-ships-with-group u.grp rid tag)
|
||||
::
|
||||
++ get-tagged-ships-with-group
|
||||
|= [grp=group rid=resource =tag]
|
||||
^- (set ship)
|
||||
(~(get ju tags.grp) tag)
|
||||
::
|
||||
++ is-managed
|
||||
|= rid=resource
|
||||
|
@ -55,6 +55,12 @@
|
||||
cas=case ::
|
||||
gim=?(%auto germ) ::
|
||||
==
|
||||
+$ kiln-fuse
|
||||
$@ ~
|
||||
$: syd=desk
|
||||
bas=beak
|
||||
con=(list [beak germ])
|
||||
==
|
||||
--
|
||||
|= [bowl:gall state]
|
||||
?> =(src our)
|
||||
@ -381,6 +387,11 @@
|
||||
?~ +< abet
|
||||
abet:abet:(merge:(work syd) ali sud cas gim)
|
||||
::
|
||||
++ poke-fuse
|
||||
|= k=kiln-fuse
|
||||
?~ k abet
|
||||
abet:(emit [%pass /kiln/fuse/[syd.k] %arvo %c [%fuse syd.k bas.k con.k]])
|
||||
::
|
||||
++ poke-cancel
|
||||
|= a=@tas
|
||||
abet:(emit %pass /cancel %arvo %c [%drop a])
|
||||
@ -430,6 +441,7 @@
|
||||
%kiln-info =;(f (f !<(_+<.f vase)) poke-info)
|
||||
%kiln-label =;(f (f !<(_+<.f vase)) poke-label)
|
||||
%kiln-merge =;(f (f !<(_+<.f vase)) poke-merge)
|
||||
%kiln-fuse =;(f (f !<(_+<.f vase)) poke-fuse)
|
||||
%kiln-mount =;(f (f !<(_+<.f vase)) poke-mount)
|
||||
%kiln-ota =;(f (f !<(_+<.f vase)) poke:update)
|
||||
%kiln-ota-info =;(f (f !<(_+<.f vase)) poke-ota-info)
|
||||
@ -489,6 +501,8 @@
|
||||
++ take |=(way=wire ?>(?=([@ ~] way) (work i.way))) :: general handler
|
||||
++ take-mere ::
|
||||
|= [way=wire are=(each (set path) (pair term tang))]
|
||||
?. ?=([@ ~] way)
|
||||
abet
|
||||
abet:abet:(mere:(take way) are)
|
||||
::
|
||||
++ take-coup-fancy ::
|
||||
|
@ -21,7 +21,10 @@
|
||||
(most ;~(plug com gaw) taut-rule)
|
||||
::
|
||||
%+ rune tis
|
||||
;~(plug sym ;~(pfix gap fas (more fas urs:ab)))
|
||||
;~(plug sym ;~(pfix gap stap))
|
||||
::
|
||||
%+ rune sig
|
||||
;~((glue gap) sym wyde:vast stap)
|
||||
::
|
||||
%+ rune cen
|
||||
;~(plug sym ;~(pfix gap ;~(pfix cen sym)))
|
||||
@ -37,7 +40,7 @@
|
||||
;~ (glue gap)
|
||||
sym
|
||||
;~(pfix cen sym)
|
||||
;~(pfix fas (more fas urs:ab))
|
||||
stap
|
||||
==
|
||||
::
|
||||
%+ stag %tssg
|
||||
|
@ -23,13 +23,13 @@
|
||||
%+ turn ~(tap by associations)
|
||||
|= [=md-resource [group=resource =^metadatum]]
|
||||
^- [cord json]
|
||||
:-
|
||||
%- crip
|
||||
;: weld
|
||||
(trip (spat (en-path:resource group)))
|
||||
(weld "/" (trip app-name.md-resource))
|
||||
(trip (spat (en-path:resource resource.md-resource)))
|
||||
==
|
||||
:- %: rap 3
|
||||
(spat (en-path:resource group))
|
||||
'/'
|
||||
app-name.md-resource
|
||||
(spat (en-path:resource resource.md-resource))
|
||||
~
|
||||
==
|
||||
%- pairs
|
||||
:~ [%group s+(enjs-path:resource group)]
|
||||
[%app-name s+app-name.md-resource]
|
||||
|
@ -90,7 +90,12 @@
|
||||
$: tracking=(map resource track)
|
||||
inner-state=vase
|
||||
==
|
||||
|
||||
::
|
||||
+$ base-state-3
|
||||
$: prev-version=@ud
|
||||
prev-min-version=@ud
|
||||
base-state-2
|
||||
==
|
||||
::
|
||||
+$ state-0 [%0 base-state-0]
|
||||
::
|
||||
@ -100,12 +105,23 @@
|
||||
::
|
||||
+$ state-3 [%3 base-state-2]
|
||||
::
|
||||
+$ state-4 [%4 base-state-3]
|
||||
::
|
||||
+$ versioned-state
|
||||
$% state-0
|
||||
state-1
|
||||
state-2
|
||||
state-3
|
||||
state-4
|
||||
==
|
||||
:: +diplomatic: only renegotiate if versions changed
|
||||
::
|
||||
:: If %.n please leave note as to why renegotiation necessary
|
||||
::
|
||||
::
|
||||
++ diplomatic
|
||||
^- ?
|
||||
%.y
|
||||
::
|
||||
++ default
|
||||
|* [pull-hook=* =config]
|
||||
@ -198,7 +214,7 @@
|
||||
++ agent
|
||||
|* =config
|
||||
|= =(pull-hook config)
|
||||
=| state-3
|
||||
=| state-4
|
||||
=* state -
|
||||
^- agent:gall
|
||||
=<
|
||||
@ -224,13 +240,21 @@
|
||||
=| cards=(list card:agent:gall)
|
||||
|^
|
||||
?- -.old
|
||||
%3
|
||||
%4
|
||||
=^ og-cards pull-hook
|
||||
(on-load:og inner-state.old)
|
||||
=. state old
|
||||
=/ kick=(list card)
|
||||
?: ?& =(min-version.config prev-min-version.old)
|
||||
=(version.config prev-version.old)
|
||||
diplomatic
|
||||
==
|
||||
~
|
||||
(poke-self:pass kick+!>(%kick))^~
|
||||
:_ this
|
||||
:(weld cards og-cards (poke-self:pass kick+!>(%kick))^~)
|
||||
:(weld cards og-cards kick)
|
||||
::
|
||||
%3 $(old [%4 0 0 +.old])
|
||||
%2 $(old (state-to-3 old))
|
||||
%1 $(old [%2 +.old ~])
|
||||
%0 !! :: pre-breach
|
||||
@ -255,8 +279,10 @@
|
||||
::
|
||||
++ on-save
|
||||
^- vase
|
||||
=. inner-state
|
||||
on-save:og
|
||||
=: inner-state on-save:og
|
||||
prev-min-version min-version.config
|
||||
prev-version version.config
|
||||
==
|
||||
!>(state)
|
||||
::
|
||||
++ on-poke
|
||||
@ -422,6 +448,7 @@
|
||||
?~ tan tr-core
|
||||
?. versioned
|
||||
(tr-ap-og:tr-cleanup |.((on-pull-nack:og rid u.tan)))
|
||||
%- (slog leaf+"versioned nack for {<rid>} in {<dap.bowl>}" u.tan)
|
||||
=/ pax
|
||||
(kick-mule:virt rid |.((on-pull-kick:og rid)))
|
||||
?~ pax tr-failed-kick
|
||||
@ -446,18 +473,18 @@
|
||||
:: subscription
|
||||
tr-core
|
||||
(tr-suspend-pub-ver min-version.config)
|
||||
=/ =vase
|
||||
=/ =^cage
|
||||
(convert-to:ver cage)
|
||||
=/ =wire
|
||||
(make-wire /store)
|
||||
=+ resources=(~(gas in *(set resource)) (resource-for-update:og vase))
|
||||
=+ resources=(~(gas in *(set resource)) (resource-for-update:og q.cage))
|
||||
?> ?| no-validate.config
|
||||
?& (check-src resources)
|
||||
(~(has in resources) rid)
|
||||
== ==
|
||||
=/ =mark
|
||||
(append-version:ver version.config)
|
||||
(tr-emit (~(poke-our pass wire) store-name.config mark vase))
|
||||
(tr-emit (~(poke-our pass wire) store-name.config cage))
|
||||
--
|
||||
::
|
||||
++ tr-kick
|
||||
@ -472,6 +499,7 @@
|
||||
::
|
||||
++ tr-add
|
||||
|= [s=^ship r=resource]
|
||||
?< =(s our.bowl)
|
||||
=: ship s
|
||||
rid r
|
||||
status [%active ~]
|
||||
|
@ -26,6 +26,7 @@
|
||||
::
|
||||
/- *push-hook
|
||||
/+ default-agent, resource, verb, versioning, agentio
|
||||
~% %push-hook-top ..part ~
|
||||
|%
|
||||
+$ card card:agent:gall
|
||||
::
|
||||
@ -57,15 +58,32 @@
|
||||
inner-state=vase
|
||||
==
|
||||
::
|
||||
+$ base-state-1
|
||||
$: prev-version=@ud
|
||||
prev-min-version=@ud
|
||||
base-state-0
|
||||
==
|
||||
::
|
||||
+$ state-0 [%0 base-state-0]
|
||||
::
|
||||
+$ state-1 [%1 base-state-0]
|
||||
+$ state-2 [%2 base-state-1]
|
||||
::
|
||||
+$ versioned-state
|
||||
$% state-0
|
||||
state-1
|
||||
state-2
|
||||
==
|
||||
:: +diplomatic: only renegotiate if versions changed
|
||||
::
|
||||
:: If %.n please leave note as to why renegotiation necessary
|
||||
::
|
||||
++ diplomatic
|
||||
^- ?
|
||||
%.y
|
||||
::
|
||||
++ push-hook
|
||||
~/ %push-hook
|
||||
|* =config
|
||||
$_ ^|
|
||||
|_ bowl:gall
|
||||
@ -95,7 +113,7 @@
|
||||
::
|
||||
++ transform-proxy-update
|
||||
|~ vase
|
||||
*(unit vase)
|
||||
*[(list card) (unit vase)]
|
||||
:: +initial-watch: produce initial state for a subscription
|
||||
::
|
||||
:: .resource is the resource being subscribed to.
|
||||
@ -153,10 +171,11 @@
|
||||
++ agent
|
||||
|* =config
|
||||
|= =(push-hook config)
|
||||
=| state-1
|
||||
=| state-2
|
||||
=* state -
|
||||
^- agent:gall
|
||||
=<
|
||||
~% %push-agent-lib ..poke-hook-action ~
|
||||
|_ =bowl:gall
|
||||
+* this .
|
||||
og ~(. push-hook bowl)
|
||||
@ -179,16 +198,21 @@
|
||||
=| cards=(list card:agent:gall)
|
||||
|^
|
||||
?- -.old
|
||||
%1
|
||||
%2
|
||||
=^ og-cards push-hook
|
||||
(on-load:og inner-state.old)
|
||||
=/ old-subs
|
||||
find-old-subs
|
||||
(find-old-subs [prev-version prev-min-version]:old)
|
||||
=/ version-cards
|
||||
:- (fact:io version+!>(version.config) /version ~)
|
||||
?~ old-subs ~
|
||||
(kick:io old-subs)^~
|
||||
[:(weld cards og-cards version-cards) this(state old)]
|
||||
::
|
||||
%1
|
||||
%_ $
|
||||
old [%2 0 0 +.old]
|
||||
==
|
||||
::
|
||||
::
|
||||
%0
|
||||
@ -205,6 +229,13 @@
|
||||
==
|
||||
::
|
||||
++ find-old-subs
|
||||
|= [prev-min-version=@ud prev-version=@ud]
|
||||
?: ?& =(min-version.config prev-min-version)
|
||||
=(prev-version version.config)
|
||||
diplomatic
|
||||
==
|
||||
:: bail on kick if we didn't change versions
|
||||
~
|
||||
%~ tap in
|
||||
%+ roll
|
||||
~(val by sup.bowl)
|
||||
@ -230,11 +261,14 @@
|
||||
--
|
||||
::
|
||||
++ on-save
|
||||
=. inner-state
|
||||
on-save:og
|
||||
=: prev-version version.config
|
||||
prev-min-version min-version.config
|
||||
inner-state on-save:og
|
||||
==
|
||||
!>(state)
|
||||
::
|
||||
++ on-poke
|
||||
~/ %on-poke
|
||||
|= [=mark =vase]
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
?: =(mark %push-hook-action)
|
||||
@ -251,6 +285,7 @@
|
||||
[cards this]
|
||||
::
|
||||
++ on-watch
|
||||
~/ %on-watch
|
||||
|= =path
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
?: ?=([%version ~] path)
|
||||
@ -270,26 +305,25 @@
|
||||
?. (supported:ver mark)
|
||||
:_ this
|
||||
(fact-init-kick:io version+!>(min-version.config))
|
||||
=/ =vase
|
||||
(convert-to:ver mark (initial-watch:og t.t.t.t.t.t.path resource))
|
||||
:_ this
|
||||
[%give %fact ~ mark vase]~
|
||||
=- [%give %fact ~ -]~
|
||||
(convert-to:ver mark (initial-watch:og t.t.t.t.t.t.path resource))
|
||||
::
|
||||
++ unversioned
|
||||
?> ?=([%ship @ @ *] t.path)
|
||||
?. =(min-version.config 0)
|
||||
~& >>> "unversioned req from: {<src.bowl>}, nooping"
|
||||
`this
|
||||
=/ =resource
|
||||
(de-path:resource t.path)
|
||||
=/ =vase
|
||||
%+ convert-to:ver update-mark.config
|
||||
=/ =vase
|
||||
(initial-watch:og t.t.t.t.path resource)
|
||||
:_ this
|
||||
[%give %fact ~ update-mark.config vase]~
|
||||
?. =(min-version.config 0)
|
||||
~& >>> "unversioned req from: {<src.bowl>}, nooping"
|
||||
~
|
||||
[%give %fact ~ (convert-to:ver update-mark.config vase)]~
|
||||
--
|
||||
::
|
||||
++ on-agent
|
||||
~/ %on-agent
|
||||
|= [=wire =sign:agent:gall]
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
?. ?=([%helper %push-hook @ *] wire)
|
||||
@ -343,6 +377,7 @@
|
||||
[%x %min-version ~] ``version+!>(version.config)
|
||||
==
|
||||
--
|
||||
~% %push-helper-lib ..card ~
|
||||
|_ =bowl:gall
|
||||
+* og ~(. push-hook bowl)
|
||||
ver ~(. versioning [bowl [update-mark version min-version]:config])
|
||||
@ -350,6 +385,7 @@
|
||||
pass pass:io
|
||||
::
|
||||
++ poke-hook-action
|
||||
~/ %poke-hook-action
|
||||
|= =action
|
||||
^- (quip card:agent:gall _state)
|
||||
|^
|
||||
@ -418,6 +454,7 @@
|
||||
[%pass wire %agent [our.bowl store-name.config] %watch store-path.config]
|
||||
::
|
||||
++ push-updates
|
||||
~/ %push-updates
|
||||
|= =cage
|
||||
^- (list card:agent:gall)
|
||||
%+ roll (resource-for-update q.cage)
|
||||
@ -440,10 +477,7 @@
|
||||
|= [fact-ver=@ud paths=(set path)]
|
||||
=/ =mark
|
||||
(append-version:ver fact-ver)
|
||||
=/ =^cage
|
||||
:- mark
|
||||
(convert-from:ver mark q.cage)
|
||||
(fact:io cage ~(tap in paths))
|
||||
(fact:io (convert-from:ver mark q.cage) ~(tap in paths))
|
||||
:: TODO: deprecate
|
||||
++ unversioned
|
||||
?. =(min-version.config 0) ~
|
||||
@ -453,52 +487,47 @@
|
||||
%- ~(gas in *(set path))
|
||||
(turn (incoming-subscriptions prefix) tail)
|
||||
?: =(0 ~(wyt in unversioned)) ~
|
||||
=/ =^cage
|
||||
:- update-mark.config
|
||||
(convert-from:ver update-mark.config q.cage)
|
||||
(fact:io cage ~(tap in unversioned))^~
|
||||
(fact:io (convert-from:ver update-mark.config q.cage) ~(tap in unversioned))^~
|
||||
--
|
||||
::
|
||||
++ forward-update
|
||||
~/ %forward-update
|
||||
|= =cage
|
||||
^- (list card:agent:gall)
|
||||
=- lis
|
||||
=/ vas
|
||||
(convert-to:ver cage)
|
||||
=/ vas=vase
|
||||
q:(convert-to:ver cage)
|
||||
%+ roll (resource-for-update q.cage)
|
||||
|= [rid=resource [lis=(list card:agent:gall) tf-vas=(unit vase)]]
|
||||
^- [(list card:agent:gall) (unit vase)]
|
||||
=/ =path
|
||||
resource+(en-path:resource rid)
|
||||
=/ =wire (make-wire path)
|
||||
=* ship entity.rid
|
||||
=. tf-vas
|
||||
=/ out=(pair (list card:agent:gall) (unit vase))
|
||||
?. =(our.bowl ship)
|
||||
:: do not transform before forwarding
|
||||
::
|
||||
`vas
|
||||
``vas
|
||||
:: use cached transform
|
||||
::
|
||||
?^ tf-vas tf-vas
|
||||
?^ tf-vas `tf-vas
|
||||
:: transform before poking store
|
||||
::
|
||||
(transform-proxy-update:og vas)
|
||||
~| "forwarding failed during transform. mark: {<p.cage>} resource: {<rid>}"
|
||||
?> ?=(^ tf-vas)
|
||||
=/ =dock
|
||||
:- ship
|
||||
?. =(our.bowl ship)
|
||||
:: forward to host
|
||||
::
|
||||
dap.bowl
|
||||
:: poke our store
|
||||
~| "forwarding failed during transform. mark: {<p.cage>} rid: {<rid>}"
|
||||
?> ?=(^ q.out)
|
||||
:_ q.out
|
||||
:_ (weld lis p.out)
|
||||
=/ =wire (make-wire path)
|
||||
=- [%pass wire %agent - %poke [current-version:ver u.q.out]]
|
||||
:- ship
|
||||
?. =(our.bowl ship)
|
||||
:: forward to host
|
||||
::
|
||||
store-name.config
|
||||
=/ cag=^cage
|
||||
:- current-version:ver
|
||||
u.tf-vas
|
||||
:_ tf-vas
|
||||
[[%pass wire %agent dock %poke cag] lis]
|
||||
dap.bowl
|
||||
:: poke our store
|
||||
::
|
||||
store-name.config
|
||||
::
|
||||
++ ver-from-path
|
||||
|= =path
|
||||
@ -508,6 +537,7 @@
|
||||
(slav %ud i.extra)
|
||||
::
|
||||
++ resource-for-update
|
||||
~/ %resource-for-update
|
||||
|= =vase
|
||||
^- (list resource)
|
||||
%~ tap in
|
||||
|
@ -39,10 +39,10 @@
|
||||
~! +:*handler
|
||||
(handler inbound-request)
|
||||
::
|
||||
=/ redirect=cord
|
||||
%- crip
|
||||
"/~/login?redirect={(trip url.request.inbound-request)}"
|
||||
[[307 ['location' redirect]~] ~]
|
||||
=- [[307 ['location' -]~] ~]
|
||||
%^ cat 3
|
||||
'/~/login?redirect='
|
||||
url.request.inbound-request
|
||||
::
|
||||
:: +require-authorization-simple:
|
||||
:: redirect to the login page when unauthenticated
|
||||
@ -56,10 +56,10 @@
|
||||
~! this
|
||||
simple-payload
|
||||
::
|
||||
=/ redirect=cord
|
||||
%- crip
|
||||
"/~/login?redirect={(trip url.request.inbound-request)}"
|
||||
[[307 ['location' redirect]~] ~]
|
||||
=- [[307 ['location' -]~] ~]
|
||||
%^ cat 3
|
||||
'/~/login?redirect='
|
||||
url.request.inbound-request
|
||||
::
|
||||
++ give-simple-payload
|
||||
|= [eyre-id=@ta =simple-payload:http]
|
||||
@ -86,36 +86,52 @@
|
||||
:_ `octs
|
||||
[200 [['content-type' 'text/html'] ?:(cache [max-1-wk ~] ~)]]
|
||||
::
|
||||
++ js-response
|
||||
|= =octs
|
||||
^- simple-payload:http
|
||||
[[200 [['content-type' 'text/javascript'] max-1-da ~]] `octs]
|
||||
::
|
||||
++ json-response
|
||||
|= =json
|
||||
^- simple-payload:http
|
||||
[[200 ['content-type' 'application/json']~] `(json-to-octs json)]
|
||||
::
|
||||
++ css-response
|
||||
=| cache=?
|
||||
|= =octs
|
||||
^- simple-payload:http
|
||||
[[200 [['content-type' 'text/css'] max-1-da ~]] `octs]
|
||||
:_ `octs
|
||||
[200 [['content-type' 'text/css'] ?:(cache [max-1-wk ~] ~)]]
|
||||
::
|
||||
++ manx-response
|
||||
|= man=manx
|
||||
++ js-response
|
||||
=| cache=?
|
||||
|= =octs
|
||||
^- simple-payload:http
|
||||
[[200 ['content-type' 'text/html']~] `(manx-to-octs man)]
|
||||
:_ `octs
|
||||
[200 [['content-type' 'text/javascript'] ?:(cache [max-1-wk ~] ~)]]
|
||||
::
|
||||
++ png-response
|
||||
=| cache=?
|
||||
|= =octs
|
||||
^- simple-payload:http
|
||||
[[200 [['content-type' 'image/png'] max-1-wk ~]] `octs]
|
||||
:_ `octs
|
||||
[200 [['content-type' 'image/png'] ?:(cache [max-1-wk ~] ~)]]
|
||||
::
|
||||
++ ico-response
|
||||
|= =octs
|
||||
^- simple-payload:http
|
||||
[[200 [['content-type' 'image/x-icon'] max-1-wk ~]] `octs]
|
||||
::
|
||||
++ woff2-response
|
||||
=| cache=?
|
||||
|= =octs
|
||||
^- simple-payload:http
|
||||
[[200 [['content-type' 'font/woff2'] max-1-wk ~]] `octs]
|
||||
::
|
||||
++ json-response
|
||||
=| cache=_|
|
||||
|= =json
|
||||
^- simple-payload:http
|
||||
:_ `(json-to-octs json)
|
||||
[200 [['content-type' 'application/json'] ?:(cache [max-1-da ~] ~)]]
|
||||
::
|
||||
++ manx-response
|
||||
=| cache=_|
|
||||
|= man=manx
|
||||
^- simple-payload:http
|
||||
:_ `(manx-to-octs man)
|
||||
[200 [['content-type' 'text/html'] ?:(cache [max-1-da ~] ~)]]
|
||||
::
|
||||
++ not-found
|
||||
^- simple-payload:http
|
||||
[[404 ~] ~]
|
||||
@ -123,10 +139,10 @@
|
||||
++ login-redirect
|
||||
|= =request:http
|
||||
^- simple-payload:http
|
||||
=/ redirect=cord
|
||||
%- crip
|
||||
"/~/login?redirect={(trip url.request)}"
|
||||
[[307 ['location' redirect]~] ~]
|
||||
=- [[307 ['location' -]~] ~]
|
||||
%^ cat 3
|
||||
'/~/login?redirect='
|
||||
url.request
|
||||
::
|
||||
++ redirect
|
||||
|= redirect=cord
|
||||
|
@ -490,7 +490,7 @@
|
||||
=/ m (strand ,vase)
|
||||
^- form:m
|
||||
;< =riot:clay bind:m
|
||||
(warp ship desk ~ %sing %b case /[mak])
|
||||
(warp ship desk ~ %sing %e case /[mak])
|
||||
?~ riot
|
||||
(strand-fail %build-nave >arg< ~)
|
||||
?> =(%nave p.r.u.riot)
|
||||
|
@ -29,11 +29,12 @@
|
||||
&((gte ver min) (lte ver version))
|
||||
::
|
||||
++ convert-to
|
||||
|= =cage
|
||||
^- vase
|
||||
?: =(p.cage current-version)
|
||||
q.cage
|
||||
((tube-to p.cage) q.cage)
|
||||
|= [=mark =vase]
|
||||
^- cage
|
||||
:- current-version
|
||||
?: =(mark current-version)
|
||||
vase
|
||||
((tube-to mark) vase)
|
||||
::
|
||||
++ tube-to
|
||||
|= =mark
|
||||
@ -44,10 +45,11 @@
|
||||
.^(tube:clay %cc (scry:io %home /[current-version]/[mark]))
|
||||
::
|
||||
++ convert-from
|
||||
|= =cage
|
||||
^- vase
|
||||
?: =(p.cage current-version)
|
||||
q.cage
|
||||
((tube-from p.cage) q.cage)
|
||||
|= [=mark =vase]
|
||||
^- cage
|
||||
:- mark
|
||||
?: =(mark current-version)
|
||||
vase
|
||||
((tube-from mark) vase)
|
||||
--
|
||||
|
||||
|
20
pkg/arvo/mar/graph/cache/hook.hoon
vendored
Normal file
20
pkg/arvo/mar/graph/cache/hook.hoon
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
/- metadata=metadata-store, res=resource
|
||||
|%
|
||||
+$ cache-action
|
||||
$% [%graph-to-mark (pair resource:res (unit mark))]
|
||||
[%perm-marks (pair (pair mark @tas) tube:clay)]
|
||||
[%transform-marks (pair mark tube:clay)]
|
||||
==
|
||||
--
|
||||
::
|
||||
|_ act=cache-action
|
||||
++ grad %noun
|
||||
++ grow
|
||||
|%
|
||||
++ noun act
|
||||
--
|
||||
++ grab
|
||||
|%
|
||||
++ noun cache-action
|
||||
--
|
||||
--
|
@ -1,19 +1,17 @@
|
||||
/+ *graph-store
|
||||
=* as-octs as-octs:mimes:html
|
||||
::
|
||||
|_ upd=update
|
||||
|_ upd=update:one
|
||||
++ grad %noun
|
||||
++ grow
|
||||
|%
|
||||
++ noun upd
|
||||
++ json (update:enjs upd)
|
||||
++ mime [/application/x-urb-graph-update (as-octs (jam upd))]
|
||||
--
|
||||
::
|
||||
++ grab
|
||||
|%
|
||||
++ noun update
|
||||
++ json update:dejs
|
||||
++ noun update:one
|
||||
++ mime |=([* =octs] ;;(update (cue q.octs)))
|
||||
--
|
||||
--
|
||||
|
19
pkg/arvo/mar/graph/update-2.hoon
Normal file
19
pkg/arvo/mar/graph/update-2.hoon
Normal file
@ -0,0 +1,19 @@
|
||||
/+ *graph-store
|
||||
=* as-octs as-octs:mimes:html
|
||||
::
|
||||
|_ upd=update
|
||||
++ grad %noun
|
||||
++ grow
|
||||
|%
|
||||
++ noun upd
|
||||
++ json (update:enjs upd)
|
||||
++ mime [/application/x-urb-graph-update (as-octs (jam upd))]
|
||||
--
|
||||
::
|
||||
++ grab
|
||||
|%
|
||||
++ noun update
|
||||
++ json update:dejs
|
||||
++ mime |=([* =octs] ;;(update (cue q.octs)))
|
||||
--
|
||||
--
|
@ -33,7 +33,7 @@
|
||||
++ grab
|
||||
|%
|
||||
++ noun
|
||||
|= p=*
|
||||
|: p=`*`%*(. *indexed-post index.p [0 ~])
|
||||
=/ ip ;;(indexed-post p)
|
||||
?> ?=([@ ~] index.p.ip)
|
||||
ip
|
||||
|
@ -49,7 +49,7 @@
|
||||
++ grab
|
||||
|%
|
||||
++ noun
|
||||
|= p=*
|
||||
|: p=`*`%*(. *indexed-post index.p [0 0 ~])
|
||||
=/ ip ;;(indexed-post p)
|
||||
?+ index.p.ip ~|(index+index.p.ip !!)
|
||||
:: top-level link post; title and url
|
||||
|
@ -43,7 +43,7 @@
|
||||
:: +noun: validate post
|
||||
::
|
||||
++ noun
|
||||
|= p=*
|
||||
|: p=`*`%*(. *indexed-post contents.p [%text '']~)
|
||||
=/ ip ;;(indexed-post p)
|
||||
?> ?=(^ contents.p.ip)
|
||||
ip
|
||||
|
@ -58,7 +58,7 @@
|
||||
:: +noun: validate publish note
|
||||
::
|
||||
++ noun
|
||||
|= p=*
|
||||
|: p=`*`%*(. *indexed-post index.p [0 ~])
|
||||
=/ ip ;;(indexed-post p)
|
||||
?+ index.p.ip !!
|
||||
:: top level post must have no content
|
||||
|
12
pkg/arvo/mar/ico.hoon
Normal file
12
pkg/arvo/mar/ico.hoon
Normal file
@ -0,0 +1,12 @@
|
||||
|_ dat=@
|
||||
++ grow
|
||||
|%
|
||||
++ mime [/image/x-icon (as-octs:mimes:html dat)]
|
||||
--
|
||||
++ grab
|
||||
|%
|
||||
++ mime |=([p=mite q=octs] q.q)
|
||||
++ noun @
|
||||
--
|
||||
++ grad %mime
|
||||
--
|
@ -1,5 +1,61 @@
|
||||
/- *post
|
||||
|%
|
||||
+$ graph ((mop atom node) gth)
|
||||
+$ marked-graph [p=graph q=(unit mark)]
|
||||
::
|
||||
+$ maybe-post (each post hash)
|
||||
+$ node [post=maybe-post children=internal-graph]
|
||||
+$ graphs (map resource marked-graph)
|
||||
::
|
||||
+$ tag-queries (jug term uid)
|
||||
::
|
||||
+$ update-log ((mop time logged-update) gth)
|
||||
+$ update-logs (map resource update-log)
|
||||
::
|
||||
+$ internal-graph
|
||||
$~ [%empty ~]
|
||||
$% [%graph p=graph]
|
||||
[%empty ~]
|
||||
==
|
||||
::
|
||||
+$ network
|
||||
$: =graphs
|
||||
=tag-queries
|
||||
=update-logs
|
||||
archive=graphs
|
||||
~
|
||||
==
|
||||
::
|
||||
+$ update [p=time q=action]
|
||||
::
|
||||
+$ logged-update [p=time q=logged-action]
|
||||
|
||||
::
|
||||
+$ logged-action
|
||||
$% [%add-graph =resource =graph mark=(unit mark) overwrite=?]
|
||||
[%add-nodes =resource nodes=(map index node)]
|
||||
[%remove-posts =resource indices=(set index)]
|
||||
[%add-signatures =uid =signatures]
|
||||
[%remove-signatures =uid =signatures]
|
||||
==
|
||||
::
|
||||
+$ action
|
||||
$% logged-action
|
||||
[%remove-graph =resource]
|
||||
::
|
||||
[%add-tag =term =uid]
|
||||
[%remove-tag =term =uid]
|
||||
::
|
||||
[%archive-graph =resource]
|
||||
[%unarchive-graph =resource]
|
||||
[%run-updates =resource =update-log]
|
||||
::
|
||||
:: NOTE: cannot be sent as pokes
|
||||
::
|
||||
[%keys =resources]
|
||||
[%tags tags=(set term)]
|
||||
[%tag-queries =tag-queries]
|
||||
==
|
||||
::
|
||||
+$ permissions
|
||||
[admin=permission-level writer=permission-level reader=permission-level]
|
||||
@ -13,11 +69,75 @@
|
||||
+$ permission-level
|
||||
?(%no %self %yes)
|
||||
::
|
||||
:: %graph-store types version 1
|
||||
::
|
||||
++ one
|
||||
|%
|
||||
++ orm ((ordered-map atom node) gth)
|
||||
++ orm-log ((ordered-map time logged-update) gth)
|
||||
::
|
||||
+$ graph ((mop atom node) gth)
|
||||
+$ marked-graph [p=graph q=(unit mark)]
|
||||
::
|
||||
+$ node [=post children=internal-graph]
|
||||
+$ graphs (map resource marked-graph)
|
||||
::
|
||||
+$ tag-queries (jug term resource)
|
||||
::
|
||||
+$ update-log ((mop time logged-update) gth)
|
||||
+$ update-logs (map resource update-log)
|
||||
::
|
||||
+$ internal-graph
|
||||
$~ [%empty ~]
|
||||
$% [%graph p=graph]
|
||||
[%empty ~]
|
||||
==
|
||||
::
|
||||
+$ network
|
||||
$: =graphs
|
||||
=tag-queries
|
||||
=update-logs
|
||||
archive=graphs
|
||||
validators=(set mark)
|
||||
==
|
||||
::
|
||||
+$ update [p=time q=action]
|
||||
::
|
||||
+$ logged-update [p=time q=logged-action]
|
||||
::
|
||||
+$ logged-action
|
||||
$% [%add-graph =resource =graph mark=(unit mark) overwrite=?]
|
||||
[%add-nodes =resource nodes=(map index node)]
|
||||
[%remove-nodes =resource indices=(set index)]
|
||||
[%add-signatures =uid =signatures]
|
||||
[%remove-signatures =uid =signatures]
|
||||
==
|
||||
::
|
||||
+$ action
|
||||
$% logged-action
|
||||
[%remove-graph =resource]
|
||||
::
|
||||
[%add-tag =term =resource]
|
||||
[%remove-tag =term =resource]
|
||||
::
|
||||
[%archive-graph =resource]
|
||||
[%unarchive-graph =resource]
|
||||
[%run-updates =resource =update-log]
|
||||
::
|
||||
:: NOTE: cannot be sent as pokes
|
||||
::
|
||||
[%keys =resources]
|
||||
[%tags tags=(set term)]
|
||||
[%tag-queries =tag-queries]
|
||||
==
|
||||
--
|
||||
::
|
||||
:: %graph-store types version 0
|
||||
::
|
||||
++ zero
|
||||
=< [. post-zero]
|
||||
=, post-zero
|
||||
|%
|
||||
::
|
||||
++ orm ((ordered-map atom node) gth)
|
||||
++ orm-log ((ordered-map time logged-update) gth)
|
||||
::
|
||||
@ -81,61 +201,4 @@
|
||||
[%tag-queries =tag-queries]
|
||||
==
|
||||
--
|
||||
|
||||
+$ graph ((mop atom node) gth)
|
||||
+$ marked-graph [p=graph q=(unit mark)]
|
||||
::
|
||||
+$ node [=post children=internal-graph]
|
||||
+$ graphs (map resource marked-graph)
|
||||
::
|
||||
+$ tag-queries (jug term resource)
|
||||
::
|
||||
+$ update-log ((mop time logged-update) gth)
|
||||
+$ update-logs (map resource update-log)
|
||||
::
|
||||
::
|
||||
+$ internal-graph
|
||||
$~ [%empty ~]
|
||||
$% [%graph p=graph]
|
||||
[%empty ~]
|
||||
==
|
||||
::
|
||||
+$ network
|
||||
$: =graphs
|
||||
=tag-queries
|
||||
=update-logs
|
||||
archive=graphs
|
||||
validators=(set mark)
|
||||
==
|
||||
::
|
||||
+$ update [p=time q=action]
|
||||
::
|
||||
+$ logged-update [p=time q=logged-action]
|
||||
|
||||
::
|
||||
+$ logged-action
|
||||
$% [%add-graph =resource =graph mark=(unit mark) overwrite=?]
|
||||
[%add-nodes =resource nodes=(map index node)]
|
||||
[%remove-nodes =resource indices=(set index)]
|
||||
[%add-signatures =uid =signatures]
|
||||
[%remove-signatures =uid =signatures]
|
||||
==
|
||||
::
|
||||
+$ action
|
||||
$% logged-action
|
||||
[%remove-graph =resource]
|
||||
::
|
||||
[%add-tag =term =resource]
|
||||
[%remove-tag =term =resource]
|
||||
::
|
||||
[%archive-graph =resource]
|
||||
[%unarchive-graph =resource]
|
||||
[%run-updates =resource =update-log]
|
||||
::
|
||||
:: NOTE: cannot be sent as pokes
|
||||
::
|
||||
[%keys =resources]
|
||||
[%tags tags=(set term)]
|
||||
[%tag-queries =tag-queries]
|
||||
==
|
||||
--
|
||||
|
@ -1,27 +1,5 @@
|
||||
/- *resource
|
||||
|%
|
||||
::
|
||||
++ post-zero
|
||||
|%
|
||||
::
|
||||
+$ content
|
||||
$% [%text text=cord]
|
||||
[%mention =ship]
|
||||
[%url url=cord]
|
||||
[%code expression=cord output=(list tank)]
|
||||
[%reference =uid]
|
||||
==
|
||||
::
|
||||
+$ post
|
||||
$: author=ship
|
||||
=index
|
||||
time-sent=time
|
||||
contents=(list content)
|
||||
hash=(unit hash)
|
||||
=signatures
|
||||
==
|
||||
--
|
||||
|
||||
+$ index (list atom)
|
||||
+$ uid [=resource =index]
|
||||
::
|
||||
@ -60,4 +38,25 @@
|
||||
[%code expression=cord output=(list tank)]
|
||||
[%reference =reference]
|
||||
==
|
||||
::
|
||||
++ post-zero
|
||||
|%
|
||||
::
|
||||
+$ content
|
||||
$% [%text text=cord]
|
||||
[%mention =ship]
|
||||
[%url url=cord]
|
||||
[%code expression=cord output=(list tank)]
|
||||
[%reference =uid]
|
||||
==
|
||||
::
|
||||
+$ post
|
||||
$: author=ship
|
||||
=index
|
||||
time-sent=time
|
||||
contents=(list content)
|
||||
hash=(unit hash)
|
||||
=signatures
|
||||
==
|
||||
--
|
||||
--
|
||||
|
@ -5452,12 +5452,14 @@
|
||||
:::: 4k: atom printing
|
||||
::
|
||||
++ co
|
||||
!:
|
||||
~% %co ..co ~
|
||||
=< |_ lot=coin
|
||||
++ rear |=(rom=tape rend(rep rom))
|
||||
++ rent `@ta`(rap 3 rend)
|
||||
++ rent ~+ `@ta`(rap 3 rend)
|
||||
++ rend
|
||||
^- tape
|
||||
~+
|
||||
?: ?=(%blob -.lot)
|
||||
['~' '0' ((v-co 1) (jam p.lot))]
|
||||
?: ?=(%many -.lot)
|
||||
@ -5602,18 +5604,17 @@
|
||||
|= a=dn
|
||||
?: ?=([%i *] a) (weld ?:(s.a "inf" "-inf") rep)
|
||||
?: ?=([%n *] a) (weld "nan" rep)
|
||||
=/ f=(pair tape @)
|
||||
%. a.a
|
||||
%+ ed-co(rep ~) [10 1]
|
||||
|=([a=? b=@ c=tape] [~(d ne b) ?.(a c ['.' c])])
|
||||
=. e.a (sum:si e.a (sun:si (dec q.f)))
|
||||
=/ res
|
||||
%+ weld p.f
|
||||
?~ e.a
|
||||
rep
|
||||
%+ weld ?:((syn:si e.a) "e" "e-")
|
||||
((d-co 1) (abs:si e.a))
|
||||
?:(s.a res ['-' res])
|
||||
=; rep ?:(s.a rep ['-' rep])
|
||||
=/ f ((d-co 1) a.a)
|
||||
=^ e e.a
|
||||
=/ e=@s (sun:si (lent f))
|
||||
=/ sci :(sum:si e.a e -1)
|
||||
?: (syn:si (dif:si e.a --3)) [--1 sci] :: 12000 -> 12e3 e>+2
|
||||
?: !(syn:si (dif:si sci -2)) [--1 sci] :: 0.001 -> 1e-3 e<-2
|
||||
[(sum:si sci --1) --0] :: 1.234e2 -> '.'@3 -> 123 .4
|
||||
=? rep !=(--0 e.a)
|
||||
:(weld ?:((syn:si e.a) "e" "e-") ((d-co 1) (abs:si e.a)))
|
||||
(weld (ed-co e f) rep)
|
||||
::
|
||||
++ s-co
|
||||
|= esc=(list @) ^- tape
|
||||
@ -5659,20 +5660,13 @@
|
||||
:: - used only for @r* floats
|
||||
::
|
||||
++ ed-co
|
||||
|= [[bas=@ min=@] par=$-([? @ tape] tape)]
|
||||
=| [fir=? cou=@ud]
|
||||
|= hol=@
|
||||
^- [tape @]
|
||||
?: &(=(0 hol) =(0 min))
|
||||
[rep cou]
|
||||
=/ [dar=@ rad=@] (dvr hol bas)
|
||||
%= $
|
||||
min ?:(=(0 min) 0 (dec min))
|
||||
hol dar
|
||||
rep (par &(=(0 dar) !fir) rad rep)
|
||||
fir |
|
||||
cou +(cou)
|
||||
==
|
||||
|= [exp=@s int=tape] ^- tape
|
||||
=/ [pos=? dig=@u] [=(--1 (cmp:si exp --0)) (abs:si exp)]
|
||||
?. pos
|
||||
(into (weld (reap +(dig) '0') int) 1 '.')
|
||||
=/ len (lent int)
|
||||
?: (lth dig len) (into int dig '.')
|
||||
(weld int (reap (sub dig len) '0'))
|
||||
::
|
||||
:: +ox-co: format '.'-separated digit sequences in numeric base
|
||||
::
|
||||
@ -5965,9 +5959,8 @@
|
||||
::
|
||||
++ spat |=(pax=path (crip (spud pax))) :: render path to cord
|
||||
++ spud |=(pax=path ~(ram re (smyt pax))) :: render path to tape
|
||||
++ stab :: parse cord to path
|
||||
=+ fel=;~(pfix fas (more fas urs:ab))
|
||||
|=(zep=@t `path`(rash zep fel))
|
||||
++ stab |=(zep=@t `path`(rash zep stap)) :: parse cord to path
|
||||
++ stap ;~(pfix fas (more fas urs:ab)) :: path parser
|
||||
::
|
||||
:::: 4n: virtualization
|
||||
::
|
||||
@ -6627,7 +6620,7 @@
|
||||
+$ seminoun
|
||||
:: partial noun; blocked subtrees are ~
|
||||
::
|
||||
$~ [[%full ~] ~]
|
||||
$~ [[%full / ~ ~] ~]
|
||||
[mask=stencil data=noun]
|
||||
::
|
||||
:: +stencil: noun knowledge map
|
||||
|
@ -762,6 +762,11 @@
|
||||
her=@p dem=desk cas=case :: source
|
||||
how=germ :: method
|
||||
== ::
|
||||
$: %fuse :: merge many
|
||||
des=desk :: target desk
|
||||
bas=beak :: base desk
|
||||
con=(list [beak germ]) :: merges
|
||||
==
|
||||
[%mont pot=term bem=beam] :: mount to unix
|
||||
[%dirk des=desk] :: mark mount dirty
|
||||
[%ogre pot=$@(desk beam)] :: delete mount point
|
||||
@ -928,6 +933,7 @@
|
||||
:: /- sur-file :: surface imports from /sur
|
||||
:: /+ lib-file :: library imports from /lib
|
||||
:: /= face /path :: imports built hoon file at path
|
||||
:: /~ face type /path :: imports built hoon files from directory
|
||||
:: /% face %mark :: imports mark definition from /mar
|
||||
:: /$ face %from %to :: imports mark converter from /mar
|
||||
:: /* face %mark /path :: unbuilt file imports, as mark
|
||||
@ -936,6 +942,7 @@
|
||||
$: sur=(list taut)
|
||||
lib=(list taut)
|
||||
raw=(list [face=term =path])
|
||||
raz=(list [face=term =spec =path])
|
||||
maz=(list [face=term =mark])
|
||||
caz=(list [face=term =mars])
|
||||
bar=(list [face=term =mark =path])
|
||||
@ -955,7 +962,6 @@
|
||||
$_
|
||||
^?
|
||||
|%
|
||||
++ bunt *typ
|
||||
++ diff |~([old=typ new=typ] *dif)
|
||||
++ form *mark
|
||||
++ join |~([a=dif b=dif] *(unit (unit dif)))
|
||||
@ -970,7 +976,6 @@
|
||||
+$ dais
|
||||
$_ ^|
|
||||
|_ sam=vase
|
||||
++ bunt sam
|
||||
++ diff |~(new=_sam *vase)
|
||||
++ form *mark
|
||||
++ join |~([a=vase b=vase] *(unit (unit vase)))
|
||||
|
@ -1944,11 +1944,11 @@
|
||||
=/ =bone bone.shut-packet
|
||||
::
|
||||
?: ?=(%& -.meat.shut-packet)
|
||||
=+ ?~ dud ~
|
||||
=+ ?. &(?=(^ dud) msg.veb) ~
|
||||
%. ~
|
||||
%+ slog
|
||||
leaf+"ames: {<her.channel>} fragment crashed {<mote.u.dud>}"
|
||||
?.(msg.veb ~ tang.u.dud)
|
||||
%- slog
|
||||
:_ tang.u.dud
|
||||
leaf+"ames: {<her.channel>} fragment crashed {<mote.u.dud>}"
|
||||
(run-message-sink bone %hear lane shut-packet ?=(~ dud))
|
||||
:: Just try again on error, printing trace
|
||||
::
|
||||
@ -1967,20 +1967,12 @@
|
||||
++ on-memo
|
||||
|= [=bone payload=* valence=?(%plea %boon)]
|
||||
^+ peer-core
|
||||
:: if we haven't been trying to talk to %live, reset timer
|
||||
::
|
||||
=? last-contact.qos.peer-state
|
||||
?& ?=(%live -.qos.peer-state)
|
||||
%- ~(all by snd.peer-state)
|
||||
|= =message-pump-state
|
||||
=(~ live.packet-pump-state.message-pump-state)
|
||||
==
|
||||
now
|
||||
::
|
||||
=/ =message-blob (dedup-message (jim payload))
|
||||
=. peer-core (run-message-pump bone %memo message-blob)
|
||||
::
|
||||
?: &(=(%boon valence) ?=(?(%dead %unborn) -.qos.peer-state))
|
||||
?: ?& =(%boon valence)
|
||||
(gte now (add ~s30 last-contact.qos.peer-state))
|
||||
==
|
||||
check-clog
|
||||
peer-core
|
||||
:: +dedup-message: replace with any existing copy of this message
|
||||
@ -2535,7 +2527,7 @@
|
||||
++ assert
|
||||
^+ message-pump
|
||||
=/ top-live
|
||||
(peek:packet-queue:*make-packet-pump live.packet-pump-state.state)
|
||||
(pry:packet-queue:*make-packet-pump live.packet-pump-state.state)
|
||||
?. |(?=(~ top-live) (lte current.state message-num.key.u.top-live))
|
||||
~| [%strange-current current=current.state key.u.top-live]
|
||||
!!
|
||||
@ -2603,7 +2595,7 @@
|
||||
=| acc=(unit static-fragment)
|
||||
^+ [static-fragment=acc live=live.state]
|
||||
::
|
||||
%^ (traverse:packet-queue _acc) live.state acc
|
||||
%^ (dip:packet-queue _acc) live.state acc
|
||||
|= $: acc=_acc
|
||||
key=live-packet-key
|
||||
val=live-packet-val
|
||||
@ -2681,7 +2673,7 @@
|
||||
=/ acc
|
||||
resends=*(list static-fragment)
|
||||
::
|
||||
%^ (traverse:packet-queue _acc) live.state acc
|
||||
%^ (dip:packet-queue _acc) live.state acc
|
||||
|= $: acc=_acc
|
||||
key=live-packet-key
|
||||
val=live-packet-val
|
||||
@ -2734,7 +2726,7 @@
|
||||
::
|
||||
^+ [acc live=live.state]
|
||||
::
|
||||
%^ (traverse:packet-queue _acc) live.state acc
|
||||
%^ (dip:packet-queue _acc) live.state acc
|
||||
|= $: acc=_acc
|
||||
key=live-packet-key
|
||||
val=live-packet-val
|
||||
@ -2781,7 +2773,7 @@
|
||||
::
|
||||
^+ [metrics=metrics.state live=live.state]
|
||||
::
|
||||
%^ (traverse:packet-queue pump-metrics) live.state acc=metrics.state
|
||||
%^ (dip:packet-queue pump-metrics) live.state acc=metrics.state
|
||||
|= $: metrics=pump-metrics
|
||||
key=live-packet-key
|
||||
val=live-packet-val
|
||||
@ -2804,10 +2796,10 @@
|
||||
::
|
||||
++ set-wake
|
||||
^+ packet-pump
|
||||
:: if nonempty .live, peek at head to get next wake time
|
||||
:: if nonempty .live, pry at head to get next wake time
|
||||
::
|
||||
=/ new-wake=(unit @da)
|
||||
?~ head=(peek:packet-queue live.state)
|
||||
?~ head=(pry:packet-queue live.state)
|
||||
~
|
||||
`(next-expiry:gauge u.head)
|
||||
:: no-op if no change
|
||||
|
@ -186,7 +186,7 @@
|
||||
=* timers timers.state
|
||||
:: if no timers, cancel existing wakeup timer or no-op
|
||||
::
|
||||
=/ first=(unit [date=@da *]) (peek:timer-map timers.state)
|
||||
=/ first=(unit [date=@da *]) (pry:timer-map timers.state)
|
||||
?~ first
|
||||
?~ next-wake
|
||||
event-core
|
||||
@ -351,7 +351,7 @@
|
||||
[%timers %next ~]
|
||||
:^ ~ ~ %noun
|
||||
!> ^- (unit @da)
|
||||
(bind (peek:timer-map timers) head)
|
||||
(bind (pry:timer-map timers) head)
|
||||
::
|
||||
[%timers @ ~]
|
||||
?~ til=(slaw %da i.t.tyl)
|
||||
|
@ -59,6 +59,12 @@
|
||||
::
|
||||
+$ cult (jug wove duct)
|
||||
::
|
||||
:: State for ongoing %fuse merges. `con` maintains the ordering,
|
||||
:: `sto` stores the data needed to merge, and `bas` is the base
|
||||
:: beak for the merge.
|
||||
::
|
||||
+$ melt [bas=beak con=(list [beak germ]) sto=(map beak (unit dome:clay))]
|
||||
::
|
||||
:: Domestic desk state.
|
||||
::
|
||||
:: Includes subscriber list, dome (desk content), possible commit state (for
|
||||
@ -69,6 +75,7 @@
|
||||
dom=dome :: desk state
|
||||
per=regs :: read perms per path
|
||||
pew=regs :: write perms per path
|
||||
fiz=melt :: state for mega merges
|
||||
==
|
||||
::
|
||||
:: Desk state.
|
||||
@ -118,11 +125,11 @@
|
||||
:: Ford cache
|
||||
::
|
||||
+$ ford-cache
|
||||
$: files=(map path [res=vase dez=(set path)])
|
||||
naves=(map mark [res=vase dez=(set path)])
|
||||
marks=(map mark [res=dais dez=(set path)])
|
||||
casts=(map mars [res=vase dez=(set path)])
|
||||
tubes=(map mars [res=tube dez=(set path)])
|
||||
$: files=(map path [res=vase dez=(set [dir=? =path])])
|
||||
naves=(map mark [res=vase dez=(set [dir=? =path])])
|
||||
marks=(map mark [res=dais dez=(set [dir=? =path])])
|
||||
casts=(map mars [res=vase dez=(set [dir=? =path])])
|
||||
tubes=(map mars [res=tube dez=(set [dir=? =path])])
|
||||
==
|
||||
:: $reef-cache: built system files
|
||||
::
|
||||
@ -212,6 +219,7 @@
|
||||
dom=dome :: revision state
|
||||
per=regs :: read perms per path
|
||||
pew=regs :: write perms per path
|
||||
fiz=melt :: domestic mega merges
|
||||
== ::
|
||||
::
|
||||
:: Foreign request manager.
|
||||
@ -303,6 +311,7 @@
|
||||
$: %c :: to %clay
|
||||
$> $? %info :: internal edit
|
||||
%merg :: merge desks
|
||||
%fuse :: merge many
|
||||
%pork ::
|
||||
%warp ::
|
||||
%werp ::
|
||||
@ -428,18 +437,23 @@
|
||||
::
|
||||
++ an
|
||||
|_ nak=ankh
|
||||
:: +dug: produce ankh at path
|
||||
::
|
||||
++ dug
|
||||
|= =path
|
||||
^- (unit ankh)
|
||||
?~ path `nak
|
||||
?~ kid=(~(get by dir.nak) i.path)
|
||||
~
|
||||
$(nak u.kid, path t.path)
|
||||
:: +get: produce file at path
|
||||
::
|
||||
++ get
|
||||
|= =path
|
||||
^- (unit cage)
|
||||
?~ path
|
||||
?~ fil.nak
|
||||
~
|
||||
`q.u.fil.nak
|
||||
?~ kid=(~(get by dir.nak) i.path)
|
||||
~
|
||||
$(nak u.kid, path t.path)
|
||||
?~ nik=(dug path) ~
|
||||
?~ fil.u.nik ~
|
||||
`q.u.fil.u.nik
|
||||
--
|
||||
++ with-face |=([face=@tas =vase] vase(p [%face face p.vase]))
|
||||
++ with-faces
|
||||
@ -472,7 +486,7 @@
|
||||
+$ state
|
||||
$: baked=(map path cage)
|
||||
cache=ford-cache
|
||||
stack=(list (set path))
|
||||
stack=(list (set [dir=? =path]))
|
||||
cycle=(set build)
|
||||
==
|
||||
+$ args
|
||||
@ -493,8 +507,8 @@
|
||||
:: +pop-stack: pop build stack, copying deps downward
|
||||
::
|
||||
++ pop-stack
|
||||
^- [(set path) _stack.nub]
|
||||
=^ top=(set path) stack.nub stack.nub
|
||||
^- [(set [dir=? =path]) _stack.nub]
|
||||
=^ top=(set [dir=? =path]) stack.nub stack.nub
|
||||
=? stack.nub ?=(^ stack.nub)
|
||||
stack.nub(i (~(uni in i.stack.nub) top))
|
||||
[top stack.nub]
|
||||
@ -559,7 +573,6 @@
|
||||
=/ dif diff:deg
|
||||
^- (nave typ dif)
|
||||
|%
|
||||
++ bunt +<.cor
|
||||
++ diff
|
||||
|= [old=typ new=typ]
|
||||
^- dif
|
||||
@ -581,7 +594,6 @@
|
||||
=/ dif _*diff:grad:cor
|
||||
^- (nave:clay typ dif)
|
||||
|%
|
||||
++ bunt +<.cor
|
||||
++ diff |=([old=typ new=typ] (diff:~(grad cor old) new))
|
||||
++ form form:grad:cor
|
||||
++ join
|
||||
@ -622,7 +634,6 @@
|
||||
:_ nub
|
||||
^- dais
|
||||
|_ sam=vase
|
||||
++ bunt (slap nav limb/%bunt)
|
||||
++ diff
|
||||
|= new=vase
|
||||
(slam (slap nav limb/%diff) (slop sam new))
|
||||
@ -649,7 +660,7 @@
|
||||
|= diff=vase
|
||||
(slam (slap nav limb/%pact) (slop sam diff))
|
||||
++ vale
|
||||
|= =noun
|
||||
|: noun=q:(slap nav !,(*hoon *vale))
|
||||
(slam (slap nav limb/%vale) noun/noun)
|
||||
--
|
||||
:: +build-cast: produce gate to convert mark .a to, statically typed
|
||||
@ -805,9 +816,11 @@
|
||||
=^ res=vase nub (run-pile pile)
|
||||
res
|
||||
::
|
||||
++ build-file
|
||||
|= =path
|
||||
++ build-dependency
|
||||
|= dep=(each [dir=path fil=path] path)
|
||||
^- [vase state]
|
||||
=/ =path
|
||||
?:(?=(%| -.dep) p.dep fil.p.dep)
|
||||
~| %error-building^path
|
||||
?^ got=(~(get by files.cache.nub) path)
|
||||
=? stack.nub ?=(^ stack.nub)
|
||||
@ -816,7 +829,9 @@
|
||||
?: (~(has in cycle.nub) file+path)
|
||||
~|(cycle+file+path^stack.nub !!)
|
||||
=. cycle.nub (~(put in cycle.nub) file+path)
|
||||
=. stack.nub [(sy path ~) stack.nub]
|
||||
=. stack.nub
|
||||
=- [(sy - ~) stack.nub]
|
||||
?:(?=(%| -.dep) dep [& dir.p.dep])
|
||||
=^ cag=cage nub (read-file path)
|
||||
?> =(%hoon p.cag)
|
||||
=/ tex=tape (trip !<(@t q.cag))
|
||||
@ -826,11 +841,42 @@
|
||||
=. files.cache.nub (~(put by files.cache.nub) path [res top])
|
||||
[res nub]
|
||||
::
|
||||
++ build-file
|
||||
|= =path
|
||||
(build-dependency |+path)
|
||||
:: +build-directory: builds files in top level of a directory
|
||||
::
|
||||
:: this excludes files directly at /path/hoon,
|
||||
:: instead only including files in the unix-style directory at /path,
|
||||
:: such as /path/file/hoon, but not /path/more/file/hoon.
|
||||
::
|
||||
++ build-directory
|
||||
|= =path
|
||||
^- [(map @ta vase) state]
|
||||
=/ fiz=(list @ta)
|
||||
=/ nuk=(unit _ankh) (~(dug an ankh) path)
|
||||
?~ nuk ~
|
||||
%+ murn
|
||||
~(tap by dir.u.nuk)
|
||||
|= [nom=@ta nak=_ankh]
|
||||
?. ?=([~ [~ *] *] (~(get by dir.nak) %hoon)) ~
|
||||
`nom
|
||||
::
|
||||
=| rez=(map @ta vase)
|
||||
|-
|
||||
?~ fiz
|
||||
[rez nub]
|
||||
=* nom=@ta i.fiz
|
||||
=/ pax=^path (weld path nom %hoon ~)
|
||||
=^ res nub (build-dependency &+[path pax])
|
||||
$(fiz t.fiz, rez (~(put by rez) nom res))
|
||||
::
|
||||
++ run-pile
|
||||
|= =pile
|
||||
=^ sut=vase nub (run-tauts bud %sur sur.pile)
|
||||
=^ sut=vase nub (run-tauts sut %lib lib.pile)
|
||||
=^ sut=vase nub (run-raw sut raw.pile)
|
||||
=^ sut=vase nub (run-raz sut raz.pile)
|
||||
=^ sut=vase nub (run-maz sut maz.pile)
|
||||
=^ sut=vase nub (run-caz sut caz.pile)
|
||||
=^ sut=vase nub (run-bar sut bar.pile)
|
||||
@ -869,7 +915,10 @@
|
||||
(most ;~(plug com gaw) taut-rule)
|
||||
::
|
||||
%+ rune tis
|
||||
;~(plug sym ;~(pfix gap fas (more fas urs:ab)))
|
||||
;~(plug sym ;~(pfix gap stap))
|
||||
::
|
||||
%+ rune sig
|
||||
;~((glue gap) sym wyde:vast stap)
|
||||
::
|
||||
%+ rune cen
|
||||
;~(plug sym ;~(pfix gap ;~(pfix cen sym)))
|
||||
@ -885,7 +934,7 @@
|
||||
;~ (glue gap)
|
||||
sym
|
||||
;~(pfix cen sym)
|
||||
;~(pfix fas (more fas urs:ab))
|
||||
;~(pfix stap)
|
||||
==
|
||||
::
|
||||
%+ stag %tssg
|
||||
@ -931,6 +980,30 @@
|
||||
=. p.pin [%face face.i.raw p.pin]
|
||||
$(sut (slop pin sut), raw t.raw)
|
||||
::
|
||||
++ run-raz
|
||||
|= [sut=vase raz=(list [face=term =spec =path])]
|
||||
^- [vase state]
|
||||
?~ raz [sut nub]
|
||||
=^ res=(map @ta vase) nub
|
||||
(build-directory path.i.raz)
|
||||
=; pin=vase
|
||||
=. p.pin [%face face.i.raz p.pin]
|
||||
$(sut (slop pin sut), raz t.raz)
|
||||
::
|
||||
=/ =type (~(play ut p.sut) [%kttr spec.i.raz])
|
||||
:: ensure results nest in the specified type,
|
||||
:: and produce a homogenous map containing that type.
|
||||
::
|
||||
:- %- ~(play ut p.sut)
|
||||
[%kttr %make [%wing ~[%map]] ~[[%base %atom %ta] spec.i.raz]]
|
||||
|-
|
||||
?~ res ~
|
||||
?. (~(nest ut type) | p.q.n.res)
|
||||
~| [%nest-fail path.i.raz p.n.res]
|
||||
!!
|
||||
:- [p.n.res q.q.n.res]
|
||||
[$(res l.res) $(res r.res)]
|
||||
::
|
||||
++ run-maz
|
||||
|= [sut=vase maz=(list [face=term =mark])]
|
||||
^- [vase state]
|
||||
@ -1043,12 +1116,12 @@
|
||||
~
|
||||
=/ rus rus:(~(gut by hoy.ruf) her *rung)
|
||||
%+ ~(gut by rus) syd
|
||||
[lim=~2000.1.1 ref=`*rind qyx=~ dom=*dome per=~ pew=~]
|
||||
[lim=~2000.1.1 ref=`*rind qyx=~ dom=*dome per=~ pew=~ fiz=*melt]
|
||||
:: administrative duct, domestic +rede
|
||||
::
|
||||
:+ ~ `hun.rom.ruf
|
||||
=/ jod (~(gut by dos.rom.ruf) syd *dojo)
|
||||
[lim=now ref=~ [qyx dom per pew]:jod]
|
||||
[lim=now ref=~ [qyx dom per pew fiz]:jod]
|
||||
::
|
||||
=* red=rede ->+
|
||||
|%
|
||||
@ -1065,7 +1138,7 @@
|
||||
::
|
||||
%= ruf
|
||||
hun.rom (need hun)
|
||||
dos.rom (~(put by dos.rom.ruf) syd [qyx dom per pew]:red)
|
||||
dos.rom (~(put by dos.rom.ruf) syd [qyx dom per pew fiz]:red)
|
||||
==
|
||||
::
|
||||
:: Handle `%sing` requests
|
||||
@ -1256,6 +1329,24 @@
|
||||
=/ =path [%question desk (scot %ud index) ~]
|
||||
(emit duct %pass wire %a %plea ship %c path `riff-any`[%1 riff])
|
||||
::
|
||||
++ foreign-capable
|
||||
|= =rave
|
||||
|^
|
||||
?- -.rave
|
||||
%many &
|
||||
%sing (good-care care.mood.rave)
|
||||
%next (good-care care.mood.rave)
|
||||
%mult
|
||||
%- ~(all in paths.mool.rave)
|
||||
|= [=care =path]
|
||||
(good-care care)
|
||||
==
|
||||
::
|
||||
++ good-care
|
||||
|= =care
|
||||
(~(has in ^~((silt `(list ^care)`~[%u %w %x %y %z]))) care)
|
||||
--
|
||||
::
|
||||
:: Create a request that cannot be filled immediately.
|
||||
::
|
||||
:: If it's a local request, we just put in in `qyx`, setting a timer if it's
|
||||
@ -1275,6 +1366,10 @@
|
||||
=. rave
|
||||
?. ?=([%sing %v *] rave) rave
|
||||
[%many %| [%ud let.dom] case.mood.rave path.mood.rave]
|
||||
::
|
||||
?. (foreign-capable rave)
|
||||
~|([%clay-bad-foreign-request-care rave] !!)
|
||||
::
|
||||
=+ inx=nix.u.ref
|
||||
=. +>+.$
|
||||
=< ?>(?=(^ ref) .)
|
||||
@ -1582,12 +1677,19 @@
|
||||
::
|
||||
++ invalidate
|
||||
|* [key=mold value=mold]
|
||||
|= [cache=(map key [value dez=(set path)]) invalid=(set path)]
|
||||
=/ builds=(list [key value dez=(set path)]) ~(tap by cache)
|
||||
|= [cache=(map key [value dez=(set [dir=? =path])]) invalid=(set path)]
|
||||
=/ builds=(list [key value dez=(set [dir=? =path])])
|
||||
~(tap by cache)
|
||||
|- ^+ cache
|
||||
?~ builds
|
||||
~
|
||||
?: ?=(^ (~(int in dez.i.builds) invalid))
|
||||
?: %- ~(any in dez.i.builds)
|
||||
|= [dir=? =path]
|
||||
?. dir (~(has in invalid) path)
|
||||
=+ l=(lent path)
|
||||
%- ~(any in invalid)
|
||||
|= i=^path
|
||||
&(=(path (scag l i)) ?=([@ %hoon ~] (slag l i)))
|
||||
$(builds t.builds)
|
||||
(~(put by $(builds t.builds)) i.builds)
|
||||
::
|
||||
@ -1962,32 +2064,178 @@
|
||||
=/ =wire /merge/[syd]/(scot %p ali-ship)/[ali-desk]/[germ]
|
||||
(emit hen %pass wire %c %warp ali-ship ali-desk `[%sing %v case /])
|
||||
::
|
||||
++ make-melt
|
||||
|= [bas=beak con=(list [beak germ])]
|
||||
^- melt
|
||||
:+ bas con
|
||||
%- ~(gas by *(map beak (unit dome:clay)))
|
||||
:- [bas *(unit dome:clay)]
|
||||
(turn con |=(a=[beak germ] [-.a *(unit dome:clay)]))
|
||||
::
|
||||
++ start-fuse
|
||||
|= [bas=beak con=(list [beak germ])]
|
||||
^+ ..start-fuse
|
||||
=/ moves=(list move)
|
||||
%+ turn
|
||||
[[bas *germ] con]
|
||||
|= [bec=beak germ]
|
||||
^- move
|
||||
=/ wir=wire /fuse/[syd]/(scot %p p.bec)/[q.bec]/(scot r.bec)
|
||||
[hen %pass wir %c %warp p.bec q.bec `[%sing %v r.bec /]]
|
||||
::
|
||||
:: We also want to clear the state (fiz) associated with this
|
||||
:: merge and print a warning if it's non trivial i.e. we're
|
||||
:: starting a new fuse before the previous one terminated.
|
||||
::
|
||||
=/ err=tang
|
||||
?~ con.fiz
|
||||
~
|
||||
=/ discarded=tang
|
||||
%+ turn
|
||||
~(tap in sto.fiz)
|
||||
|= [k=beak v=(unit dome:clay)]
|
||||
^- tank
|
||||
=/ received=tape ?~(v "missing" "received")
|
||||
leaf+"{<k>} {received}"
|
||||
:_ discarded
|
||||
leaf+"fusing into {<syd>} from {<bas>} {<con>} - overwriting prior fuse"
|
||||
=. fiz (make-melt bas con)
|
||||
((slog err) (emil moves))
|
||||
::
|
||||
++ take-fuse
|
||||
|^
|
||||
::
|
||||
|= [bec=beak =riot]
|
||||
^+ ..take-fuse
|
||||
?~ riot
|
||||
::
|
||||
:: By setting fiz to *melt the merge is aborted - any further
|
||||
:: responses we get for the merge will cause take-fuse to crash
|
||||
::
|
||||
=. fiz *melt
|
||||
((slog [leaf+"clay: fuse failed, missing {<bec>}"]~) ..take-fuse)
|
||||
?> (~(has by sto.fiz) bec)
|
||||
=. fiz
|
||||
:+ bas.fiz con.fiz
|
||||
(~(put by sto.fiz) bec `!<(dome:clay q.r.u.riot))
|
||||
=/ all-done=flag
|
||||
%- ~(all by sto.fiz)
|
||||
|= res=(unit dome:clay)
|
||||
^- flag
|
||||
!=(res ~)
|
||||
?. all-done
|
||||
..take-fuse
|
||||
=| rag=rang
|
||||
=/ clean-state ..take-fuse
|
||||
=/ initial-dome=dome:clay (need (~(got by sto.fiz) bas.fiz))
|
||||
=/ continuation-yaki=yaki
|
||||
(~(got by hut.ran) (~(got by hit.initial-dome) let.initial-dome))
|
||||
=/ parents=(list tako) ~[(~(got by hit.initial-dome) let.initial-dome)]
|
||||
=/ merges con.fiz
|
||||
|-
|
||||
^+ ..take-fuse
|
||||
?~ merges
|
||||
=/ t=tang [leaf+"{<syd>} fused from {<bas.fiz>} {<con.fiz>}" ~]
|
||||
=. ..take-fuse (done-fuse clean-state %& ~)
|
||||
(park | [%| continuation-yaki(p (flop parents))] rag)
|
||||
=/ [bec=beak g=germ] i.merges
|
||||
=/ ali-dom=dome:clay (need (~(got by sto.fiz) bec))
|
||||
=/ result (merge-helper p.bec q.bec g ali-dom `continuation-yaki)
|
||||
?- -.result
|
||||
%|
|
||||
(done-fuse clean-state %| %fuse-merge-failed p.result)
|
||||
::
|
||||
%&
|
||||
=/ merge-result=(unit merge-result) +.result
|
||||
?~ merge-result
|
||||
::
|
||||
:: This merge was a no-op, just continue
|
||||
::
|
||||
$(merges t.merges)
|
||||
?^ conflicts.u.merge-result
|
||||
::
|
||||
:: If there are merge conflicts send the error and abort the merge
|
||||
::
|
||||
(done-fuse clean-state %& conflicts.u.merge-result)
|
||||
=/ merged-yaki=yaki
|
||||
?- -.new.u.merge-result
|
||||
%|
|
||||
+.new.u.merge-result
|
||||
::
|
||||
%&
|
||||
::
|
||||
:: Convert the yuki to yaki
|
||||
::
|
||||
=/ yuk=yuki +.new.u.merge-result
|
||||
=/ lobes=(map path lobe)
|
||||
%- ~(run by q.yuk)
|
||||
|= val=(each page lobe)
|
||||
^- lobe
|
||||
?- -.val
|
||||
%& (page-to-lobe +.val)
|
||||
%| +.val
|
||||
==
|
||||
(make-yaki p.yuk lobes now)
|
||||
==
|
||||
%= $
|
||||
continuation-yaki merged-yaki
|
||||
merges t.merges
|
||||
hut.ran (~(put by hut.ran) r.merged-yaki merged-yaki)
|
||||
lat.rag (~(uni by lat.rag) lat.u.merge-result)
|
||||
parents [(~(got by hit.ali-dom) let.ali-dom) parents]
|
||||
==
|
||||
==
|
||||
:: +done-fuse: restore state after a fuse is attempted, whether it
|
||||
:: succeeds or fails.
|
||||
::
|
||||
++ done-fuse
|
||||
|= [to-restore=_..take-fuse result=(each (set path) (pair term tang))]
|
||||
^+ ..take-fuse
|
||||
=. fiz.to-restore *melt
|
||||
(done:to-restore result)
|
||||
--
|
||||
::
|
||||
++ done
|
||||
|= result=(each (set path) (pair term tang))
|
||||
^+ ..merge
|
||||
(emit hen %give %mere result)
|
||||
::
|
||||
++ merge
|
||||
|= [=ali=ship =ali=desk =germ =riot]
|
||||
^+ ..merge
|
||||
|^
|
||||
?~ riot
|
||||
(done %| %ali-unavailable >[ali-ship ali-desk germ]< ~)
|
||||
(done %| %ali-unavailable ~[>[ali-ship ali-desk germ]<])
|
||||
=/ ali-dome=dome:clay !<(dome:clay q.r.u.riot)
|
||||
=/ result=(each (unit merge-result) (pair term tang))
|
||||
(merge-helper ali-ship ali-desk germ ali-dome ~)
|
||||
?- -.result
|
||||
%|
|
||||
(done %| +.result)
|
||||
::
|
||||
%&
|
||||
=/ mr=(unit merge-result) +.result
|
||||
?~ mr
|
||||
(done %& ~)
|
||||
=. ..merge (done %& conflicts.u.mr)
|
||||
(park | new.u.mr ~ lat.u.mr)
|
||||
==
|
||||
::
|
||||
+$ merge-result [conflicts=(set path) new=yoki lat=(map lobe blob)]
|
||||
::
|
||||
++ merge-helper
|
||||
|= [=ali=ship =ali=desk =germ ali-dome=dome:clay continuation-yaki=(unit yaki)]
|
||||
^- (each (unit merge-result) [term tang])
|
||||
|^
|
||||
^- (each (unit merge-result) [term tang])
|
||||
=/ ali-yaki=yaki (~(got by hut.ran) (~(got by hit.ali-dome) let.ali-dome))
|
||||
=/ bob-yaki=(unit yaki)
|
||||
?~ let.dom
|
||||
~
|
||||
(~(get by hut.ran) (~(got by hit.dom) let.dom))
|
||||
=/ merge-result (merge-by-germ ali-yaki bob-yaki)
|
||||
?: ?=(%| -.merge-result)
|
||||
(done %| p.merge-result)
|
||||
?~ p.merge-result
|
||||
(done %& ~)
|
||||
=. ..merge (done %& conflicts.u.p.merge-result)
|
||||
(park | new.u.p.merge-result ~ lat.u.p.merge-result)
|
||||
?~ continuation-yaki
|
||||
?~ let.dom
|
||||
~
|
||||
(~(get by hut.ran) (~(got by hit.dom) let.dom))
|
||||
continuation-yaki
|
||||
(merge-by-germ ali-yaki bob-yaki)
|
||||
::
|
||||
++ done
|
||||
|= result=(each (set path) (pair term tang))
|
||||
^+ ..merge
|
||||
(emit hen %give %mere result)
|
||||
::
|
||||
+$ merge-result [conflicts=(set path) new=yoki lat=(map lobe blob)]
|
||||
++ merge-by-germ
|
||||
|= [=ali=yaki bob-yaki=(unit yaki)]
|
||||
^- (each (unit merge-result) [term tang])
|
||||
@ -2005,16 +2253,13 @@
|
||||
?- germ
|
||||
::
|
||||
:: If this is a %only-this merge, we check to see if ali's and bob's
|
||||
:: commits are the same, in which case we're done. Otherwise, we
|
||||
:: check to see if ali's commit is in the ancestry of bob's, in
|
||||
:: which case we're done. Otherwise, we create a new commit with
|
||||
:: bob's data plus ali and bob as parents.
|
||||
:: commits are the same, in which case we're done.
|
||||
:: Otherwise, we create a new commit with bob's data plus ali and
|
||||
:: bob as parents.
|
||||
::
|
||||
%only-this
|
||||
?: =(r.ali-yaki r.bob-yaki)
|
||||
&+~
|
||||
?: (~(has in (reachable-takos:ze r.bob-yaki)) r.ali-yaki)
|
||||
&+~
|
||||
:* %& ~
|
||||
conflicts=~
|
||||
new=&+[[r.bob-yaki r.ali-yaki ~] (to-yuki q.bob-yaki)]
|
||||
@ -2042,8 +2287,6 @@
|
||||
%take-this
|
||||
?: =(r.ali-yaki r.bob-yaki)
|
||||
&+~
|
||||
?: (~(has in (reachable-takos:ze r.bob-yaki)) r.ali-yaki)
|
||||
&+~
|
||||
=/ new-data (~(uni by q.ali-yaki) q.bob-yaki)
|
||||
:* %& ~
|
||||
conflicts=~
|
||||
@ -2313,7 +2556,7 @@
|
||||
=+ (slag (dec (lent path)) path)
|
||||
?~(- %$ i.-)
|
||||
=/ =dais (get-dais mark)
|
||||
=/ res=(unit (unit vase)) (~(join dais bunt:dais) q.cal q.cob)
|
||||
=/ res=(unit (unit vase)) (~(join dais *vale:dais) q.cal q.cob)
|
||||
?~ res
|
||||
`[form:dais q.cob]
|
||||
?~ u.res
|
||||
@ -2665,6 +2908,9 @@
|
||||
++ start-request
|
||||
|= [for=(unit [ship @ud]) rav=rave]
|
||||
^+ ..start-request
|
||||
?: &(?=(^ for) !(foreign-capable rav))
|
||||
~& [%bad-foreign-request-care from=for rav]
|
||||
..start-request
|
||||
=^ [new-sub=(unit rove) sub-results=(list sub-result)] fod.dom
|
||||
(try-fill-sub for (rave-to-rove rav))
|
||||
=. ..start-request (send-sub-results sub-results [hen ~ ~])
|
||||
@ -2721,14 +2967,23 @@
|
||||
%r ~| %no-cages-please-they-are-just-way-too-big !!
|
||||
%s ~| %please-dont-get-your-takos-over-a-network !!
|
||||
%t ~| %requesting-foreign-directory-is-vaporware !!
|
||||
%u ~| %prolly-poor-idea-to-get-rang-over-network !!
|
||||
%v ~| %weird-shouldnt-get-v-request-from-network !!
|
||||
%z `(validate-z r.rand)
|
||||
%u `(validate-u r.rand)
|
||||
%w `(validate-w r.rand)
|
||||
%x (validate-x [p.p q.p q r]:rand)
|
||||
%y `[p.r.rand !>(;;(arch q.r.rand))]
|
||||
%z `(validate-z r.rand)
|
||||
==
|
||||
::
|
||||
:: Make sure the incoming data is a %u response
|
||||
::
|
||||
++ validate-u
|
||||
|= =page
|
||||
^- cage
|
||||
?> ?=(%flag p.page)
|
||||
:- p.page
|
||||
!> ;;(? q.page)
|
||||
::
|
||||
:: Make sure the incoming data is a %w response
|
||||
::
|
||||
++ validate-w
|
||||
@ -2749,7 +3004,11 @@
|
||||
=/ vale-result
|
||||
%- mule |.
|
||||
%- wrap:fusion
|
||||
(page-to-cage:(ford:fusion static-ford-args) peg)
|
||||
:: Use %home's marks to validate, so we don't have to build the
|
||||
:: foreign hoon/zuse
|
||||
::
|
||||
=/ args %*(static-ford-args . dom dom:(~(got by dos.rom) %home))
|
||||
(page-to-cage:(ford:fusion args) peg)
|
||||
?: ?=(%| -.vale-result)
|
||||
%- (slog >%validate-x-failed< p.vale-result)
|
||||
~
|
||||
@ -2762,7 +3021,7 @@
|
||||
^- cage
|
||||
?> ?=(%uvi p.page)
|
||||
:- p.page
|
||||
!>(;;(@uvI q.page))
|
||||
!> ;;(@uvI q.page)
|
||||
--
|
||||
::
|
||||
:: Respond to backfill request
|
||||
@ -3391,12 +3650,29 @@
|
||||
|-
|
||||
?: =(b let.dom)
|
||||
hit.dom
|
||||
:: del everything after b
|
||||
$(hit.dom (~(del by hit.dom) let.dom), let.dom (dec let.dom))
|
||||
b
|
||||
?: =(0 b)
|
||||
[~ ~]
|
||||
(data-twixt-takos =(0 ver) (~(get by hit.dom) a) (aeon-to-tako b))
|
||||
::
|
||||
=/ excludes=(set tako)
|
||||
=| acc=(set tako)
|
||||
=/ lower=@ud 1
|
||||
|-
|
||||
:: a should be excluded, so wait until we're past it
|
||||
?: =(lower +(a))
|
||||
acc
|
||||
=/ res=(set tako) (reachable-takos (~(got by hit.dom) lower))
|
||||
$(acc (~(uni in acc) res), lower +(lower))
|
||||
=/ includes=(set tako)
|
||||
=| acc=(set tako)
|
||||
=/ upper=@ud b
|
||||
|-
|
||||
?: =(upper a)
|
||||
acc
|
||||
=/ res=(set tako) (reachable-takos (~(got by hit.dom) upper))
|
||||
$(acc (~(uni in acc) res), upper (dec upper))
|
||||
[(~(run in (~(dif in includes) excludes)) tako-to-yaki) ~]
|
||||
:: Traverse parentage and find all ancestor hashes
|
||||
::
|
||||
++ reachable-takos :: reachable
|
||||
@ -3415,30 +3691,6 @@
|
||||
=. s ^$(p i.p.y)
|
||||
$(p.y t.p.y)
|
||||
::
|
||||
:: Gets the data between two commit hashes, assuming the first is an
|
||||
:: ancestor of the second.
|
||||
::
|
||||
:: Get all the takos before `a`, then get all takos before `b` except the
|
||||
:: ones we found before `a`. Then convert the takos to yakis and also get
|
||||
:: all the data in all the yakis.
|
||||
::
|
||||
:: What happens if you run an %init merge on a desk that already
|
||||
:: had a commit?
|
||||
::
|
||||
++ data-twixt-takos
|
||||
|= [plops=? a=(unit tako) b=tako]
|
||||
^- [(set yaki) (set plop)]
|
||||
=+ old=?~(a ~ (reachable-takos u.a))
|
||||
=/ yal=(set tako)
|
||||
%- silt
|
||||
%+ skip
|
||||
~(tap in (reachable-takos b))
|
||||
|=(tak=tako (~(has in old) tak))
|
||||
:- (silt (turn ~(tap in yal) tako-to-yaki))
|
||||
?. plops
|
||||
~
|
||||
(silt (turn ~(tap in (new-lobes (new-lobes ~ old) yal)) lobe-to-blob))
|
||||
::
|
||||
:: Get all the lobes that are referenced in `a` except those that are
|
||||
:: already in `b`.
|
||||
::
|
||||
@ -3528,11 +3780,11 @@
|
||||
[[~ ~] fod.dom]
|
||||
=/ cached=(unit [=vase *]) (~(get by naves.fod.dom) i.path)
|
||||
?^ cached
|
||||
:_(fod.dom [~ ~ %& %nave !>(vase.u.cached)])
|
||||
:_(fod.dom [~ ~ %& %nave vase.u.cached])
|
||||
=^ =vase fod.dom
|
||||
%- wrap:fusion
|
||||
(build-nave:(ford:fusion static-ford-args) i.path)
|
||||
:_(fod.dom [~ ~ %& %nave !>(vase)])
|
||||
:_(fod.dom [~ ~ %& %nave vase])
|
||||
::
|
||||
++ read-f
|
||||
!.
|
||||
@ -3958,12 +4210,14 @@
|
||||
::
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
=| :: instrument state
|
||||
$: ver=%7 :: vane version
|
||||
$: ver=%8 :: vane version
|
||||
ruf=raft :: revision tree
|
||||
== ::
|
||||
|= [now=@da eny=@uvJ rof=roof] :: current invocation
|
||||
~% %clay-top ..part ~
|
||||
|% ::
|
||||
++ call :: handle request
|
||||
~/ %clay-call
|
||||
|= $: hen=duct
|
||||
dud=(unit goof)
|
||||
wrapped-task=(hobo task)
|
||||
@ -4074,6 +4328,14 @@
|
||||
=/ den ((de now rof hen ruf) our des.req)
|
||||
abet:(start-merge:den her.req dem.req cas.req how.req)
|
||||
[mos ..^$]
|
||||
::
|
||||
%fuse
|
||||
?: =(%$ des.req)
|
||||
~&(%fuse-no-desk !!)
|
||||
=^ mos ruf
|
||||
=/ den ((de now rof hen ruf) our des.req)
|
||||
abet:(start-fuse:den bas.req con.req)
|
||||
[mos ..^$]
|
||||
::
|
||||
%mont
|
||||
=. hez.ruf ?^(hez.ruf hez.ruf `[[%$ %sync ~] ~])
|
||||
@ -4202,11 +4464,41 @@
|
||||
++ load
|
||||
=> |%
|
||||
+$ raft-any
|
||||
$% [%7 raft-7]
|
||||
$% [%8 raft-8]
|
||||
[%7 raft-7]
|
||||
[%6 raft-6]
|
||||
==
|
||||
+$ raft-7 raft
|
||||
+$ dojo-7 dojo
|
||||
+$ raft-8 raft
|
||||
+$ raft-7
|
||||
$: rom=room-7
|
||||
hoy=(map ship rung-7)
|
||||
ran=rang
|
||||
mon=(map term beam)
|
||||
hez=(unit duct)
|
||||
cez=(map @ta crew)
|
||||
pud=(unit [=desk =yoki])
|
||||
==
|
||||
+$ room-7
|
||||
$: hun=duct
|
||||
dos=(map desk dojo-7)
|
||||
==
|
||||
+$ rung-7
|
||||
$: rus=(map desk rede-7)
|
||||
==
|
||||
+$ dojo-7
|
||||
$: qyx=cult
|
||||
dom=dome
|
||||
per=regs
|
||||
pew=regs
|
||||
==
|
||||
+$ rede-7
|
||||
$: lim=@da
|
||||
ref=(unit rind)
|
||||
qyx=cult
|
||||
dom=dome
|
||||
per=regs
|
||||
pew=regs
|
||||
==
|
||||
+$ ford-cache-7 ford-cache
|
||||
+$ raft-6
|
||||
$: rom=room-6 :: domestic
|
||||
@ -4249,7 +4541,8 @@
|
||||
|= old=raft-any
|
||||
|^
|
||||
=? old ?=(%6 -.old) 7+(raft-6-to-7 +.old)
|
||||
?> ?=(%7 -.old)
|
||||
=? old ?=(%7 -.old) 8+(raft-7-to-8 +.old)
|
||||
?> ?=(%8 -.old)
|
||||
..^^$(ruf +.old)
|
||||
:: +raft-6-to-7: delete stale ford caches (they could all be invalid)
|
||||
::
|
||||
@ -4270,9 +4563,30 @@
|
||||
|= =rede-6
|
||||
rede-6(dom dom.rede-6(fod *ford-cache-7))
|
||||
==
|
||||
:: +raft-7-to-8: create bunted melts in each dojo/rede
|
||||
::
|
||||
++ raft-7-to-8
|
||||
|= raf=raft-7
|
||||
^- raft-8
|
||||
%= raf
|
||||
dos.rom
|
||||
%- ~(run by dos.rom.raf)
|
||||
|= doj=dojo-7
|
||||
^- dojo
|
||||
[qyx.doj dom.doj per.doj pew.doj *melt]
|
||||
::
|
||||
hoy
|
||||
%- ~(run by hoy.raf)
|
||||
|= =rung-7
|
||||
%- ~(run by rus.rung-7)
|
||||
|= r=rede-7
|
||||
^- rede
|
||||
[lim.r ref.r qyx.r dom.r per.r pew.r *melt]
|
||||
==
|
||||
--
|
||||
::
|
||||
++ scry :: inspect
|
||||
~/ %clay-scry
|
||||
^- roon
|
||||
|= [lyc=gang car=term bem=beam]
|
||||
^- (unit (unit cage))
|
||||
@ -4334,6 +4648,7 @@
|
||||
==
|
||||
::
|
||||
++ take :: accept response
|
||||
~/ %clay-take
|
||||
|= [tea=wire hen=duct dud=(unit goof) hin=sign]
|
||||
^+ [*(list move) ..^$]
|
||||
?^ dud
|
||||
@ -4350,6 +4665,18 @@
|
||||
abet:(merge:den ali-ship ali-desk germ p.hin)
|
||||
[mos ..^$]
|
||||
::
|
||||
?: ?=([%fuse @ @ @ @ ~] tea)
|
||||
?> ?=(%writ +<.hin)
|
||||
=* syd i.t.tea
|
||||
=/ ali-ship=@p (slav %p i.t.t.tea)
|
||||
=* ali-desk=desk i.t.t.t.tea
|
||||
=/ ali-case (rash i.t.t.t.t.tea nuck:so)
|
||||
?> ?=([%$ *] ali-case)
|
||||
=^ mos ruf
|
||||
=/ den ((de now rof hen ruf) our i.t.tea)
|
||||
abet:(take-fuse:den [ali-ship ali-desk (case +.ali-case)] p.hin)
|
||||
[mos ..^$]
|
||||
::
|
||||
?: ?=([%foreign-warp *] tea)
|
||||
?> ?=(%writ +<.hin)
|
||||
:_ ..^$
|
||||
|
@ -215,7 +215,7 @@
|
||||
?: =('subscribe' u.maybe-key)
|
||||
%. item
|
||||
%+ pe %subscribe
|
||||
(ot id+ni ship+(su fed:ag) app+so path+(su ;~(pfix fas (more fas urs:ab))) ~)
|
||||
(ot id+ni ship+(su fed:ag) app+so path+(su stap) ~)
|
||||
?: =('unsubscribe' u.maybe-key)
|
||||
%. item
|
||||
%+ pe %unsubscribe
|
||||
@ -426,10 +426,12 @@
|
||||
:- ~
|
||||
%- as-octs:mimes:html
|
||||
%- crip
|
||||
%- zing
|
||||
%- zing ^- ^wall
|
||||
%- zing ^- (list ^wall)
|
||||
%+ turn wall
|
||||
|= t=tape
|
||||
"{t}\0a"
|
||||
^- ^wall
|
||||
~[t "\0a"]
|
||||
:: +internal-server-error: 500 page, with a tang
|
||||
::
|
||||
++ internal-server-error
|
||||
@ -1598,6 +1600,7 @@
|
||||
:: +channel-event-to-sign: attempt to recover a sign from a channel-event
|
||||
::
|
||||
++ channel-event-to-sign
|
||||
~% %eyre-channel-event-to-sign ..part ~
|
||||
|= event=channel-event
|
||||
^- (unit sign:agent:gall)
|
||||
?. ?=(%fact -.event) `event
|
||||
@ -1678,6 +1681,7 @@
|
||||
==
|
||||
::
|
||||
++ event-json-to-wall
|
||||
~% %eyre-json-to-wall ..part ~
|
||||
|= [event-id=@ud =json]
|
||||
^- wall
|
||||
:~ (weld "id: " (format-ud-as-integer event-id))
|
||||
@ -2095,6 +2099,7 @@
|
||||
~% %http-server ..part ~
|
||||
|%
|
||||
++ call
|
||||
~/ %eyre-call
|
||||
|= [=duct dud=(unit goof) wrapped-task=(hobo task)]
|
||||
^- [(list move) _http-server-gate]
|
||||
::
|
||||
@ -2297,6 +2302,7 @@
|
||||
==
|
||||
::
|
||||
++ take
|
||||
~/ %eyre-take
|
||||
|= [=wire =duct dud=(unit goof) =sign]
|
||||
^- [(list move) _http-server-gate]
|
||||
?^ dud
|
||||
@ -2484,6 +2490,7 @@
|
||||
:: +scry: request a path in the urbit namespace
|
||||
::
|
||||
++ scry
|
||||
~/ %eyre-scry
|
||||
^- roon
|
||||
|= [lyc=gang car=term bem=beam]
|
||||
^- (unit (unit cage))
|
||||
|
@ -646,6 +646,7 @@
|
||||
:: cleared queue in +load 3-to-4 or +load-4-to-5
|
||||
::
|
||||
=? stand ?=(~ stand)
|
||||
~& [%gall-missing wire hen]
|
||||
(~(put to *(qeu remote-request)) %missing)
|
||||
~| [full-wire=full-wire hen=hen stand=stand]
|
||||
=^ rr stand ~(get to stand)
|
||||
|
@ -3286,7 +3286,7 @@
|
||||
++ ship :: string from ship
|
||||
|= a=^ship
|
||||
^- json
|
||||
(tape (slag 1 (scow %p a)))
|
||||
[%n (rap 3 '"' (rsh [3 1] (scot %p a)) '"' ~)]
|
||||
:: :: ++numb:enjs:format
|
||||
++ numb :: number from unsigned
|
||||
|= a=@u
|
||||
@ -3458,7 +3458,7 @@
|
||||
[(rash a fel) b]
|
||||
:: :: ++pa:dejs:format
|
||||
++ pa :: string as path
|
||||
(su ;~(pfix fas (more fas urs:ab)))
|
||||
(su stap)
|
||||
:: :: ++pe:dejs:format
|
||||
++ pe :: prefix
|
||||
|* [pre=* wit=fist]
|
||||
@ -5070,36 +5070,54 @@
|
||||
|= ord=$-([key key] ?)
|
||||
|= a=*
|
||||
=/ b ;;((tree [key=key val=value]) a)
|
||||
?> (check-balance:((ordered-map key value) ord) b)
|
||||
?> (apt:((on key value) ord) b)
|
||||
b
|
||||
::
|
||||
:: $mk-item: constructor for +ordered-map item type
|
||||
::
|
||||
++ mk-item |$ [key val] [key=key val=val]
|
||||
:: +ordered-map: treap with user-specified horizontal order
|
||||
::
|
||||
:: Conceptually smaller items go on the left, so the item with the
|
||||
:: smallest key can be popped off the head. If $key is `@` and
|
||||
:: .compare is +lte, then the numerically smallest item is the head.
|
||||
++ ordered-map on
|
||||
:: +on: treap with user-specified horizontal order, ordered-map
|
||||
::
|
||||
:: WARNING: ordered-map will not work properly if two keys can be
|
||||
:: unequal under noun equality but equal via the compare gate
|
||||
::
|
||||
++ ordered-map
|
||||
++ on
|
||||
~/ %on
|
||||
|* [key=mold val=mold]
|
||||
=> |%
|
||||
+$ item (mk-item key val)
|
||||
+$ item [key=key val=val]
|
||||
--
|
||||
:: +compare: item comparator for horizontal order
|
||||
::
|
||||
~% %comp +>+ ~
|
||||
|= compare=$-([key key] ?)
|
||||
~% %core + ~
|
||||
|%
|
||||
:: +check-balance: verify horizontal and vertical orderings
|
||||
:: +all: apply logical AND boolean test on all values
|
||||
::
|
||||
++ check-balance
|
||||
=| [l=(unit key) r=(unit key)]
|
||||
|= a=(tree item)
|
||||
++ all
|
||||
~/ %all
|
||||
|= [a=(tree item) b=$-(item ?)]
|
||||
^- ?
|
||||
|-
|
||||
?~ a
|
||||
&
|
||||
?&((b n.a) $(a l.a) $(a r.a))
|
||||
:: +any: apply logical OR boolean test on all values
|
||||
::
|
||||
++ any
|
||||
~/ %any
|
||||
|= [a=(tree item) b=$-(item ?)]
|
||||
|- ^- ?
|
||||
?~ a
|
||||
|
|
||||
?|((b n.a) $(a l.a) $(a r.a))
|
||||
:: +apt: verify horizontal and vertical orderings
|
||||
::
|
||||
++ apt
|
||||
~/ %apt
|
||||
|= a=(tree item)
|
||||
=| [l=(unit key) r=(unit key)]
|
||||
|- ^- ?
|
||||
:: empty tree is valid
|
||||
::
|
||||
?~ a %.y
|
||||
@ -5122,64 +5140,22 @@
|
||||
::
|
||||
?~(r.a %.y &((mor key.n.a key.n.r.a) $(a r.a, r `key.n.a)))
|
||||
==
|
||||
:: +put: ordered item insert
|
||||
:: +bap: convert to list, right to left
|
||||
::
|
||||
++ put
|
||||
|= [a=(tree item) =key =val]
|
||||
^- (tree item)
|
||||
:: base case: replace null with single-item tree
|
||||
::
|
||||
?~ a [n=[key val] l=~ r=~]
|
||||
:: base case: overwrite existing .key with new .val
|
||||
::
|
||||
?: =(key.n.a key) a(val.n val)
|
||||
:: if item goes on left, recurse left then rebalance vertical order
|
||||
::
|
||||
?: (compare key key.n.a)
|
||||
=/ l $(a l.a)
|
||||
?> ?=(^ l)
|
||||
?: (mor key.n.a key.n.l)
|
||||
a(l l)
|
||||
l(r a(l r.l))
|
||||
:: item goes on right; recurse right then rebalance vertical order
|
||||
::
|
||||
=/ r $(a r.a)
|
||||
?> ?=(^ r)
|
||||
?: (mor key.n.a key.n.r)
|
||||
a(r r)
|
||||
r(l a(r l.r))
|
||||
:: +peek: produce head (smallest item) or null
|
||||
::
|
||||
++ peek
|
||||
++ bap
|
||||
~/ %bap
|
||||
|= a=(tree item)
|
||||
^- (unit item)
|
||||
::
|
||||
?~ a ~
|
||||
?~ l.a `n.a
|
||||
$(a l.a)
|
||||
::
|
||||
:: +pop: produce .head (smallest item) and .rest or crash if empty
|
||||
::
|
||||
++ pop
|
||||
|= a=(tree item)
|
||||
^- [head=item rest=(tree item)]
|
||||
::
|
||||
?~ a !!
|
||||
?~ l.a [n.a r.a]
|
||||
::
|
||||
=/ l $(a l.a)
|
||||
:- head.l
|
||||
:: load .rest.l back into .a and rebalance
|
||||
::
|
||||
?: |(?=(~ rest.l) (mor key.n.a key.n.rest.l))
|
||||
a(l rest.l)
|
||||
rest.l(r a(r r.rest.l))
|
||||
^- (list item)
|
||||
=| b=(list item)
|
||||
|- ^+ b
|
||||
?~ a b
|
||||
$(a r.a, b [n.a $(a l.a)])
|
||||
:: +del: delete .key from .a if it exists, producing value iff deleted
|
||||
::
|
||||
++ del
|
||||
~/ %del
|
||||
|= [a=(tree item) =key]
|
||||
^- [(unit val) (tree item)]
|
||||
::
|
||||
?~ a [~ ~]
|
||||
:: we found .key at the root; delete and rebalance
|
||||
::
|
||||
@ -5192,30 +5168,15 @@
|
||||
[found a(l lef)]
|
||||
=+ [found rig]=$(a r.a)
|
||||
[found a(r rig)]
|
||||
:: +nip: remove root; for internal use
|
||||
::
|
||||
++ nip
|
||||
|= a=(tree item)
|
||||
^- (tree item)
|
||||
::
|
||||
?> ?=(^ a)
|
||||
:: delete .n.a; merge and balance .l.a and .r.a
|
||||
::
|
||||
|- ^- (tree item)
|
||||
?~ l.a r.a
|
||||
?~ r.a l.a
|
||||
?: (mor key.n.l.a key.n.r.a)
|
||||
l.a(r $(l.a r.l.a))
|
||||
r.a(l $(r.a l.r.a))
|
||||
:: +traverse: stateful partial inorder traversal
|
||||
:: +dip: stateful partial inorder traversal
|
||||
::
|
||||
:: Mutates .state on each run of .f. Starts at .start key, or if
|
||||
:: .start is ~, starts at the head (item with smallest key). Stops
|
||||
:: when .f produces .stop=%.y. Traverses from smaller to larger
|
||||
:: keys. Each run of .f can replace an item's value or delete the
|
||||
:: item.
|
||||
:: .start is ~, starts at the head. Stops when .f produces .stop=%.y.
|
||||
:: Traverses from left to right keys.
|
||||
:: Each run of .f can replace an item's value or delete the item.
|
||||
::
|
||||
++ traverse
|
||||
++ dip
|
||||
~/ %dip
|
||||
|* state=mold
|
||||
|= $: a=(tree item)
|
||||
=state
|
||||
@ -5274,63 +5235,18 @@
|
||||
=/ rig main(a r.a)
|
||||
rig(a a(r a.rig))
|
||||
--
|
||||
:: +tap: convert to list, smallest to largest
|
||||
::
|
||||
++ tap
|
||||
|= a=(tree item)
|
||||
^- (list item)
|
||||
::
|
||||
=| b=(list item)
|
||||
|- ^+ b
|
||||
?~ a b
|
||||
::
|
||||
$(a l.a, b [n.a $(a r.a)])
|
||||
:: +bap: convert to list, largest to smallest
|
||||
::
|
||||
++ bap
|
||||
|= a=(tree item)
|
||||
^- (list item)
|
||||
::
|
||||
=| b=(list item)
|
||||
|- ^+ b
|
||||
?~ a b
|
||||
::
|
||||
$(a r.a, b [n.a $(a l.a)])
|
||||
:: +gas: put a list of items
|
||||
::
|
||||
++ gas
|
||||
~/ %gas
|
||||
|= [a=(tree item) b=(list item)]
|
||||
^- (tree item)
|
||||
::
|
||||
?~ b a
|
||||
$(b t.b, a (put a i.b))
|
||||
:: +uni: unify two ordered maps
|
||||
::
|
||||
:: .b takes precedence over .a if keys overlap.
|
||||
::
|
||||
++ uni
|
||||
|= [a=(tree item) b=(tree item)]
|
||||
^- (tree item)
|
||||
::
|
||||
?~ b a
|
||||
?~ a b
|
||||
?: =(key.n.a key.n.b)
|
||||
::
|
||||
[n=n.b l=$(a l.a, b l.b) r=$(a r.a, b r.b)]
|
||||
::
|
||||
?: (mor key.n.a key.n.b)
|
||||
::
|
||||
?: (compare key.n.b key.n.a)
|
||||
$(l.a $(a l.a, r.b ~), b r.b)
|
||||
$(r.a $(a r.a, l.b ~), b l.b)
|
||||
::
|
||||
?: (compare key.n.a key.n.b)
|
||||
$(l.b $(b l.b, r.a ~), a r.a)
|
||||
$(r.b $(b r.b, l.a ~), a l.a)
|
||||
::
|
||||
:: +get: get val at key or return ~
|
||||
::
|
||||
++ get
|
||||
~/ %get
|
||||
|= [a=(tree item) b=key]
|
||||
^- (unit val)
|
||||
?~ a ~
|
||||
@ -5339,11 +5255,24 @@
|
||||
?: (compare b key.n.a)
|
||||
$(a l.a)
|
||||
$(a r.a)
|
||||
:: +got: need value at key
|
||||
::
|
||||
:: +subset: take a range excluding start and/or end and all elements
|
||||
++ got
|
||||
|= [a=(tree item) b=key]
|
||||
^- val
|
||||
(need (get a b))
|
||||
:: +has: check for key existence
|
||||
::
|
||||
++ has
|
||||
~/ %has
|
||||
|= [a=(tree item) b=key]
|
||||
^- ?
|
||||
!=(~ (get a b))
|
||||
:: +lot: take a subset range excluding start and/or end and all elements
|
||||
:: outside the range
|
||||
::
|
||||
++ subset
|
||||
++ lot
|
||||
~/ %lot
|
||||
|= $: tre=(tree item)
|
||||
start=(unit key)
|
||||
end=(unit key)
|
||||
@ -5389,6 +5318,154 @@
|
||||
$(a (nip a(r ~)))
|
||||
==
|
||||
--
|
||||
:: +nip: remove root; for internal use
|
||||
::
|
||||
++ nip
|
||||
~/ %nip
|
||||
|= a=(tree item)
|
||||
^- (tree item)
|
||||
?> ?=(^ a)
|
||||
:: delete .n.a; merge and balance .l.a and .r.a
|
||||
::
|
||||
|- ^- (tree item)
|
||||
?~ l.a r.a
|
||||
?~ r.a l.a
|
||||
?: (mor key.n.l.a key.n.r.a)
|
||||
l.a(r $(l.a r.l.a))
|
||||
r.a(l $(r.a l.r.a))
|
||||
::
|
||||
:: +pop: produce .head (leftmost item) and .rest or crash if empty
|
||||
::
|
||||
++ pop
|
||||
~/ %pop
|
||||
|= a=(tree item)
|
||||
^- [head=item rest=(tree item)]
|
||||
?~ a !!
|
||||
?~ l.a [n.a r.a]
|
||||
=/ l $(a l.a)
|
||||
:- head.l
|
||||
:: load .rest.l back into .a and rebalance
|
||||
::
|
||||
?: |(?=(~ rest.l) (mor key.n.a key.n.rest.l))
|
||||
a(l rest.l)
|
||||
rest.l(r a(r r.rest.l))
|
||||
:: +pry: produce head (leftmost item) or null
|
||||
::
|
||||
++ pry
|
||||
~/ %pry
|
||||
|= a=(tree item)
|
||||
^- (unit item)
|
||||
?~ a ~
|
||||
|-
|
||||
?~ l.a `n.a
|
||||
$(a l.a)
|
||||
:: +put: ordered item insert
|
||||
::
|
||||
++ put
|
||||
~/ %put
|
||||
|= [a=(tree item) =key =val]
|
||||
^- (tree item)
|
||||
:: base case: replace null with single-item tree
|
||||
::
|
||||
?~ a [n=[key val] l=~ r=~]
|
||||
:: base case: overwrite existing .key with new .val
|
||||
::
|
||||
?: =(key.n.a key) a(val.n val)
|
||||
:: if item goes on left, recurse left then rebalance vertical order
|
||||
::
|
||||
?: (compare key key.n.a)
|
||||
=/ l $(a l.a)
|
||||
?> ?=(^ l)
|
||||
?: (mor key.n.a key.n.l)
|
||||
a(l l)
|
||||
l(r a(l r.l))
|
||||
:: item goes on right; recurse right then rebalance vertical order
|
||||
::
|
||||
=/ r $(a r.a)
|
||||
?> ?=(^ r)
|
||||
?: (mor key.n.a key.n.r)
|
||||
a(r r)
|
||||
r(l a(r l.r))
|
||||
:: +ram: produce tail (rightmost item) or null
|
||||
::
|
||||
++ ram
|
||||
~/ %ram
|
||||
|= a=(tree item)
|
||||
^- (unit item)
|
||||
?~ a ~
|
||||
|-
|
||||
?~ r.a `n.a
|
||||
$(a r.a)
|
||||
:: +run: apply gate to transform all values in place
|
||||
::
|
||||
++ run
|
||||
~/ %run
|
||||
|* [a=(tree item) b=$-(val *)]
|
||||
|-
|
||||
?~ a a
|
||||
[n=[key.n.a (b val.n.a)] l=$(a l.a) r=$(a r.a)]
|
||||
:: +tab: tabulate a subset excluding start element with a max count
|
||||
::
|
||||
++ tab
|
||||
~/ %tab
|
||||
|= [a=(tree item) b=(unit key) c=@]
|
||||
^- (list item)
|
||||
|^
|
||||
(flop e:(tabulate (del-span a b) b c))
|
||||
::
|
||||
++ tabulate
|
||||
|= [a=(tree item) b=(unit key) c=@]
|
||||
^- [d=@ e=(list item)]
|
||||
?: ?&(?=(~ b) =(c 0))
|
||||
[0 ~]
|
||||
=| f=[d=@ e=(list item)]
|
||||
|- ^+ f
|
||||
?: ?|(?=(~ a) =(d.f c)) f
|
||||
=. f $(a l.a)
|
||||
?: =(d.f c) f
|
||||
=. f [+(d.f) [n.a e.f]]
|
||||
?:(=(d.f c) f $(a r.a))
|
||||
::
|
||||
++ del-span
|
||||
|= [a=(tree item) b=(unit key)]
|
||||
^- (tree item)
|
||||
?~ a a
|
||||
?~ b a
|
||||
?: =(key.n.a u.b)
|
||||
r.a
|
||||
?: (compare key.n.a u.b)
|
||||
$(a r.a)
|
||||
a(l $(a l.a))
|
||||
--
|
||||
:: +tap: convert to list, left to right
|
||||
::
|
||||
++ tap
|
||||
~/ %tap
|
||||
|= a=(tree item)
|
||||
^- (list item)
|
||||
=| b=(list item)
|
||||
|- ^+ b
|
||||
?~ a b
|
||||
$(a l.a, b [n.a $(a r.a)])
|
||||
:: +uni: unify two ordered maps
|
||||
::
|
||||
:: .b takes precedence over .a if keys overlap.
|
||||
::
|
||||
++ uni
|
||||
~/ %uni
|
||||
|= [a=(tree item) b=(tree item)]
|
||||
^- (tree item)
|
||||
?~ b a
|
||||
?~ a b
|
||||
?: =(key.n.a key.n.b)
|
||||
[n=n.b l=$(a l.a, b l.b) r=$(a r.a, b r.b)]
|
||||
?: (mor key.n.a key.n.b)
|
||||
?: (compare key.n.b key.n.a)
|
||||
$(l.a $(a l.a, r.b ~), b r.b)
|
||||
$(r.a $(a r.a, l.b ~), b l.b)
|
||||
?: (compare key.n.a key.n.b)
|
||||
$(l.b $(b l.b, r.a ~), a r.a)
|
||||
$(r.b $(b r.b, l.a ~), a l.a)
|
||||
--
|
||||
:: ::
|
||||
:::: ++userlib :: (2u) non-vane utils
|
||||
@ -5535,7 +5612,8 @@
|
||||
:: :: ++unm:chrono:userlib
|
||||
++ unm :: Urbit to Unix ms
|
||||
|= a=@da
|
||||
(div (mul (sub a ~1970.1.1) 1.000) ~s1)
|
||||
=- (div (mul - 1.000) ~s1)
|
||||
(sub (add a (div ~s1 2.000)) ~1970.1.1)
|
||||
:: :: ++unt:chrono:userlib
|
||||
++ unt :: Urbit to Unix time
|
||||
|= a=@da
|
||||
|
@ -32,7 +32,7 @@
|
||||
=/ hashes (nodes-to-pending-indices nodes.q.update)
|
||||
;< ~ bind:m
|
||||
%^ poke-our %graph-push-hook
|
||||
%graph-update-1
|
||||
%graph-update-2
|
||||
!>(update)
|
||||
(pure:m !>(`action:graph-view`[%pending-indices hashes]))
|
||||
::
|
||||
@ -75,7 +75,8 @@
|
||||
^- [index:store node:store]
|
||||
=* loop $
|
||||
:- index
|
||||
=* p post.node
|
||||
?> ?=(%& -.post.node)
|
||||
=* p p.post.node
|
||||
=/ =hash:store
|
||||
=- `@ux`(sham -)
|
||||
:^ ?^ parent-hash
|
||||
@ -85,9 +86,9 @@
|
||||
time-sent.p
|
||||
contents.p
|
||||
%_ node
|
||||
hash.post `hash
|
||||
hash.p.post `hash
|
||||
::
|
||||
signatures.post
|
||||
signatures.p.post
|
||||
%- ~(gas in *signatures:store)
|
||||
[(sign:sig our.bowl now.bowl hash)]~
|
||||
::
|
||||
@ -115,7 +116,8 @@
|
||||
?: ?=([@ ~] index)
|
||||
~
|
||||
=/ node (got-deep:gra graph (snip `(list atom)`index))
|
||||
hash.post.node
|
||||
?> ?=(%& -.post.node)
|
||||
hash.p.post.node
|
||||
::
|
||||
++ nodes-to-pending-indices
|
||||
|= nodes=(map index:store node:store)
|
||||
@ -124,6 +126,7 @@
|
||||
%+ turn ~(tap by nodes)
|
||||
|= [=index:store =node:store]
|
||||
^- [hash:store index:store]
|
||||
?> ?=(^ hash.post.node)
|
||||
[u.hash.post.node index]
|
||||
?> ?=(%& -.post.node)
|
||||
?> ?=(^ hash.p.post.node)
|
||||
[u.hash.p.post.node index]
|
||||
--
|
||||
|
@ -39,7 +39,7 @@
|
||||
==
|
||||
;< ~ bind:m
|
||||
%+ poke-our %graph-store
|
||||
:- %graph-update-1
|
||||
:- %graph-update-2
|
||||
!> ^- update:graph
|
||||
[now.bowl %add-graph feed-rid *graph:graph `%graph-validator-post %&]
|
||||
;< ~ bind:m
|
||||
|
@ -54,7 +54,7 @@
|
||||
=/ =update:graph
|
||||
[now.bowl %add-graph rid.action *graph:graph mark.action overwrite]
|
||||
;< ~ bind:m
|
||||
(poke-our %graph-store graph-update-1+!>(update))
|
||||
(poke-our %graph-store graph-update-2+!>(update))
|
||||
;< ~ bind:m
|
||||
(poke-our %graph-push-hook %push-hook-action !>([%add rid.action]))
|
||||
::
|
||||
|
@ -36,7 +36,7 @@
|
||||
^- form:m
|
||||
;< =bowl:spider bind:m get-bowl:strandio
|
||||
;< ~ bind:m
|
||||
(poke-our %graph-store %graph-update-1 !>([now.bowl %remove-graph rid]))
|
||||
(poke-our %graph-store %graph-update-2 !>([now.bowl %remove-graph rid]))
|
||||
;< ~ bind:m
|
||||
(poke-our %graph-push-hook %push-hook-action !>([%remove rid]))
|
||||
;< ~ bind:m
|
||||
|
@ -40,7 +40,7 @@
|
||||
?: ?=([~ ^] feed.config.metadatum)
|
||||
;< ~ bind:m
|
||||
%+ poke-our %graph-store
|
||||
:- %graph-update-1
|
||||
:- %graph-update-2
|
||||
!> ^- update:graph
|
||||
[now.bowl [%archive-graph resource.u.u.feed.config.metadatum]]
|
||||
(pure:m !>(~))
|
||||
|
@ -39,7 +39,7 @@
|
||||
;< ~ bind:m
|
||||
(poke-our %graph-pull-hook %pull-hook-action !>([%remove rid]))
|
||||
;< ~ bind:m
|
||||
(poke-our %graph-store %graph-update-1 !>([now [%remove-graph rid]]))
|
||||
(poke-our %graph-store %graph-update-2 !>([now [%remove-graph rid]]))
|
||||
(pure:m ~)
|
||||
--
|
||||
::
|
||||
|
@ -17,7 +17,7 @@
|
||||
;< =bowl:spider bind:m get-bowl:strandio
|
||||
:: unarchive graph and share it
|
||||
;< ~ bind:m
|
||||
(poke-our %graph-store %graph-update-1 !>([now.bowl %unarchive-graph rid]))
|
||||
(poke-our %graph-store %graph-update-2 !>([now.bowl %unarchive-graph rid]))
|
||||
;< ~ bind:m
|
||||
(poke-our %graph-push-hook %push-hook-action !>([%add rid]))
|
||||
::
|
||||
|
@ -70,7 +70,7 @@
|
||||
;< ~ bind:m
|
||||
%+ raw-poke
|
||||
[our.bowl %graph-store]
|
||||
:- %graph-update-1
|
||||
:- %graph-update-2
|
||||
!> ^- update:gra
|
||||
[now.bowl [%archive-graph app-resource]]
|
||||
;< ~ bind:m
|
||||
|
@ -12,9 +12,9 @@
|
||||
|= [our=@p wen=@da rid=resource body=cord id=@]
|
||||
=/ =index:post [id]~
|
||||
=/ =post:post [our index wen [%text body]~ ~ ~]
|
||||
=/ =node:graph-store [post %empty ~]
|
||||
=/ =node:graph-store [[%& post] %empty ~]
|
||||
=/ act=update:graph-store [wen %add-nodes rid (my [index node] ~)]
|
||||
(poke-app our %graph-push-hook %graph-update-1 act)
|
||||
(poke-app our %graph-push-hook %graph-update-2 act)
|
||||
--
|
||||
::
|
||||
^- thread:spider
|
||||
|
@ -12,9 +12,9 @@
|
||||
|= [our=@p wen=@da rid=resource body=cord id=@]
|
||||
=/ =index:post [id]~
|
||||
=/ =post:post [our index wen [%text body]~ ~ ~]
|
||||
=/ =node:graph-store [post %empty ~]
|
||||
=/ =node:graph-store [[%& post] %empty ~]
|
||||
=/ act=update:graph-store [wen %add-nodes rid (my [index node] ~)]
|
||||
(poke-app our %graph-push-hook %graph-update-1 act)
|
||||
(poke-app our %graph-push-hook %graph-update-2 act)
|
||||
--
|
||||
::
|
||||
^- thread:spider
|
||||
|
@ -23,7 +23,7 @@
|
||||
=/ src "."
|
||||
%+ expect-eq
|
||||
!> ^- pile:fusion
|
||||
:* ~ ~ ~ ~ ~ ~
|
||||
:* ~ ~ ~ ~ ~ ~ ~
|
||||
tssg+[%dbug [/sur/foo/hoon [[1 1] [1 2]]] [%cnts ~[[%.y 1]] ~]]~
|
||||
==
|
||||
!> (parse-pile:(ford):fusion /sur/foo/hoon src)
|
||||
@ -32,7 +32,7 @@
|
||||
=/ src "/% moo %mime\0a."
|
||||
%+ expect-eq
|
||||
!> ^- pile:fusion
|
||||
:* sur=~ lib=~ raw=~
|
||||
:* sur=~ lib=~ raw=~ raz=~
|
||||
maz=[face=%moo mark=%mime]~
|
||||
caz=~ bar=~
|
||||
tssg+[%dbug [/sur/foo/hoon [[2 1] [2 2]]] [%cnts ~[[%.y 1]] ~]]~
|
||||
@ -43,7 +43,7 @@
|
||||
=/ src "/$ goo %mime %txt\0a."
|
||||
%+ expect-eq
|
||||
!> ^- pile:fusion
|
||||
:* sur=~ lib=~ raw=~ maz=~
|
||||
:* sur=~ lib=~ raw=~ raz=~ maz=~
|
||||
caz=[face=%goo from=%mime to=%txt]~
|
||||
bar=~
|
||||
tssg+[%dbug [/sur/foo/hoon [[2 1] [2 2]]] [%cnts ~[[%.y 1]] ~]]~
|
||||
@ -74,7 +74,7 @@
|
||||
[`%hood-drum %hood-drum]
|
||||
[`%hood-write %hood-write]
|
||||
==
|
||||
raw=~ maz=~ caz=~ bar=~
|
||||
raw=~ raz=~ maz=~ caz=~ bar=~
|
||||
tssg+[%dbug [/sur/foo/hoon [[10 1] [10 2]]] [%cnts ~[[%.y 1]] ~]]~
|
||||
==
|
||||
!> (parse-pile:(ford):fusion /sur/foo/hoon src)
|
||||
@ -112,10 +112,10 @@
|
||||
;: weld
|
||||
%+ expect-eq
|
||||
!>(*mime)
|
||||
(slap res limb/%bunt)
|
||||
(slap res !,(*hoon *vale))
|
||||
::
|
||||
%+ expect-eq
|
||||
!> (~(gas in *(set path)) /mar/mime/hoon ~)
|
||||
!> (~(gas in *(set [? path])) |^/mar/mime/hoon ~)
|
||||
!> dez:(~(got by files.cache.nub) /mar/mime/hoon)
|
||||
==
|
||||
::
|
||||
@ -139,10 +139,10 @@
|
||||
;: weld
|
||||
%+ expect-eq
|
||||
!>(*@t)
|
||||
(slap res limb/%bunt)
|
||||
(slap res !,(*hoon *vale))
|
||||
::
|
||||
%+ expect-eq
|
||||
!> (~(gas in *(set path)) /mar/udon/hoon /lib/cram/hoon ~)
|
||||
!> (~(gas in *(set [? path])) |^/mar/udon/hoon |^/lib/cram/hoon ~)
|
||||
!> dez:(~(got by files.cache.nub) /mar/udon/hoon)
|
||||
==
|
||||
::
|
||||
@ -170,7 +170,7 @@
|
||||
=/ changes
|
||||
%- my
|
||||
:~ [/mar/mime/hoon &+hoon+mar-mime]
|
||||
[/lib/foo/hoon &+hoon+'/% moo %mime\0abunt:moo']
|
||||
[/lib/foo/hoon &+hoon+'/% moo %mime\0a*vale:moo']
|
||||
==
|
||||
=/ ford
|
||||
%: ford:fusion
|
||||
@ -224,7 +224,7 @@
|
||||
(slap res (ream '(+ [*^ [%bob ~] ~])'))
|
||||
::
|
||||
%+ expect-eq
|
||||
!> (~(gas in *(set path)) /gen/hello/hoon ~)
|
||||
!> (~(gas in *(set [? path])) |^/gen/hello/hoon ~)
|
||||
!> dez:(~(got by files.cache.nub) /gen/hello/hoon)
|
||||
==
|
||||
::
|
||||
@ -249,10 +249,10 @@
|
||||
!>((slab %read %get-our -.res))
|
||||
::
|
||||
%+ expect-eq
|
||||
!> %- ~(gas in *(set path))
|
||||
:~ /lib/strandio/hoon
|
||||
/lib/strand/hoon
|
||||
/sur/spider/hoon
|
||||
!> %- ~(gas in *(set [? path]))
|
||||
:~ [| /lib/strandio/hoon]
|
||||
[| /lib/strand/hoon]
|
||||
[| /sur/spider/hoon]
|
||||
==
|
||||
!> dez:(~(got by files.cache.nub) /lib/strandio/hoon)
|
||||
==
|
||||
|
@ -2353,7 +2353,6 @@
|
||||
:^ ~ ~ %dais
|
||||
!> ^- dais:clay
|
||||
|_ sam=vase
|
||||
++ bunt !!
|
||||
++ diff !!
|
||||
++ form !!
|
||||
++ join !!
|
||||
|
@ -179,10 +179,15 @@
|
||||
%+ expect-eq
|
||||
!> [%n '1000']
|
||||
!> (time ~1970.1.1..0.0.1)
|
||||
:: timestamps should invert
|
||||
::
|
||||
%+ expect-eq
|
||||
!> [%n '1001']
|
||||
!> (time (from-unix-ms:chrono:userlib 1.001))
|
||||
:: ship - store ship identity as a string
|
||||
::
|
||||
%+ expect-eq
|
||||
!> [%s 'zod']
|
||||
!> [%n '"zod"']
|
||||
!> (ship ~zod)
|
||||
==
|
||||
:: dejs - recursive processing of `json` values
|
||||
|
@ -9,6 +9,7 @@
|
||||
(items-from-keys (gulf 0 6))
|
||||
::
|
||||
=/ atom-map ((ordered-map @ud @tas) lte)
|
||||
=/ gte-atom-map ((ordered-map @ud @tas) gte)
|
||||
::
|
||||
|%
|
||||
++ test-ordered-map-gas ^- tang
|
||||
@ -17,7 +18,7 @@
|
||||
::
|
||||
%+ expect-eq
|
||||
!> %.y
|
||||
!> (check-balance:atom-map a)
|
||||
!> (apt:atom-map a)
|
||||
::
|
||||
++ test-ordered-map-tap ^- tang
|
||||
::
|
||||
@ -27,6 +28,72 @@
|
||||
!> test-items
|
||||
!> (tap:atom-map a)
|
||||
::
|
||||
++ test-ordered-map-tab-gte ^- tang
|
||||
::
|
||||
=/ a=(tree [@ud @tas]) (gas:gte-atom-map ~ test-items)
|
||||
::
|
||||
%+ expect-eq
|
||||
!> (flop test-items)
|
||||
!> (tab:gte-atom-map a ~ 7)
|
||||
::
|
||||
++ test-ordered-map-tab-gte-starting-from ^- tang
|
||||
::
|
||||
=/ a=(tree [@ud @tas]) (gas:gte-atom-map ~ test-items)
|
||||
=/ small-test-items=(list [@ud @tas])
|
||||
(items-from-keys (gulf 2 5))
|
||||
::
|
||||
%+ expect-eq
|
||||
!> (flop small-test-items)
|
||||
!> (tab:gte-atom-map a [~ 6] 4)
|
||||
::
|
||||
++ test-ordered-map-tab-gte-count ^- tang
|
||||
::
|
||||
=/ a=(tree [@ud @tas]) (gas:gte-atom-map ~ test-items)
|
||||
=/ small-test-items=(list [@ud @tas])
|
||||
(items-from-keys (gulf 4 6))
|
||||
::
|
||||
%+ expect-eq
|
||||
!> (flop small-test-items)
|
||||
!> (tab:gte-atom-map a ~ 3)
|
||||
::
|
||||
++ test-ordered-map-tab ^- tang
|
||||
::
|
||||
=/ a=(tree [@ud @tas]) (gas:atom-map ~ test-items)
|
||||
::
|
||||
%+ expect-eq
|
||||
!> test-items
|
||||
!> (tab:atom-map a ~ 7)
|
||||
::
|
||||
++ test-ordered-map-tab-starting-from ^- tang
|
||||
::
|
||||
=/ a=(tree [@ud @tas]) (gas:atom-map ~ test-items)
|
||||
=/ small-test-items=(list [@ud @tas])
|
||||
(items-from-keys (gulf 1 4))
|
||||
::
|
||||
%+ expect-eq
|
||||
!> small-test-items
|
||||
!> (tab:atom-map a [~ 0] 4)
|
||||
::
|
||||
++ test-ordered-map-tab-count ^- tang
|
||||
::
|
||||
=/ a=(tree [@ud @tas]) (gas:atom-map ~ test-items)
|
||||
=/ small-test-items=(list [@ud @tas])
|
||||
(items-from-keys (gulf 0 2))
|
||||
::
|
||||
%+ expect-eq
|
||||
!> small-test-items
|
||||
!> (tab:atom-map a ~ 3)
|
||||
::
|
||||
++ test-ordered-map-tab-more-than-exist ^- tang
|
||||
::
|
||||
=/ specific-test-items=(list [@ud @tas])
|
||||
(items-from-keys (gulf 1 6))
|
||||
=/ a=(tree [@ud @tas]) (gas:atom-map ~ specific-test-items)
|
||||
::
|
||||
%+ expect-eq
|
||||
!> specific-test-items
|
||||
!> (tab:atom-map a [~ 0] 8)
|
||||
::
|
||||
++ test-ordered-map-pop ^- tang
|
||||
::
|
||||
=/ a=(tree [@ud @tas]) (gas:atom-map ~ test-items)
|
||||
@ -35,13 +102,13 @@
|
||||
!> [[0 %a] (gas:atom-map ~ (items-from-keys (gulf 1 6)))]
|
||||
!> (pop:atom-map a)
|
||||
::
|
||||
++ test-ordered-map-peek ^- tang
|
||||
++ test-ordered-map-pry ^- tang
|
||||
::
|
||||
=/ a=(tree [@ud @tas]) (gas:atom-map ~ test-items)
|
||||
::
|
||||
%+ expect-eq
|
||||
!> `[0 %a]
|
||||
!> (peek:atom-map a)
|
||||
!> (pry:atom-map a)
|
||||
::
|
||||
++ test-ordered-map-nip ^- tang
|
||||
::
|
||||
@ -53,61 +120,61 @@
|
||||
!> (gas:atom-map ~ ~[[0^%a] [1^%b] [2^%c] [3^%d] [4^%e] [5^%f]])
|
||||
!> b
|
||||
::
|
||||
++ test-ordered-map-subset ^- tang
|
||||
++ test-ordered-map-lot ^- tang
|
||||
::
|
||||
=/ a=(tree [@ud @tas]) (gas:atom-map ~ test-items)
|
||||
::
|
||||
=/ b (subset:atom-map a `0 `4)
|
||||
=/ b (lot:atom-map a `0 `4)
|
||||
::
|
||||
%+ expect-eq
|
||||
!> (gas:atom-map ~ ~[[1^%b] [2^%c] [3^%d]])
|
||||
!> b
|
||||
::
|
||||
++ test-ordered-map-null-start-subset ^- tang
|
||||
++ test-ordered-map-null-start-lot ^- tang
|
||||
::
|
||||
=/ a=(tree [@ud @tas]) (gas:atom-map ~ test-items)
|
||||
::
|
||||
=/ b (subset:atom-map a ~ `5)
|
||||
=/ b (lot:atom-map a ~ `5)
|
||||
::
|
||||
%+ expect-eq
|
||||
!> (gas:atom-map ~ ~[[0^%a] [1^%b] [2^%c] [3^%d] [4^%e]])
|
||||
!> b
|
||||
::
|
||||
++ test-ordered-map-null-end-subset ^- tang
|
||||
++ test-ordered-map-null-end-lot ^- tang
|
||||
::
|
||||
=/ a=(tree [@ud @tas]) (gas:atom-map ~ test-items)
|
||||
::
|
||||
=/ b (subset:atom-map a `1 ~)
|
||||
=/ b (lot:atom-map a `1 ~)
|
||||
::
|
||||
%+ expect-eq
|
||||
!> (gas:atom-map ~ ~[[2^%c] [3^%d] [4^%e] [5^%f] [6^%g]])
|
||||
!> b
|
||||
::
|
||||
++ test-ordered-map-double-null-subset ^- tang
|
||||
++ test-ordered-map-double-null-lot ^- tang
|
||||
::
|
||||
=/ a=(tree [@ud @tas]) (gas:atom-map ~ test-items)
|
||||
::
|
||||
=/ b (subset:atom-map a ~ ~)
|
||||
=/ b (lot:atom-map a ~ ~)
|
||||
::
|
||||
%+ expect-eq
|
||||
!> (gas:atom-map ~ ~[[0^%a] [1^%b] [2^%c] [3^%d] [4^%e] [5^%f] [6^%g]])
|
||||
!> b
|
||||
::
|
||||
++ test-ordered-map-not-found-start-subset ^- tang
|
||||
++ test-ordered-map-not-found-start-lot ^- tang
|
||||
::
|
||||
=/ a=(tree [@ud @tas]) (gas:atom-map ~ ~[[1^%b]])
|
||||
::
|
||||
=/ b (subset:atom-map a `0 ~)
|
||||
=/ b (lot:atom-map a `0 ~)
|
||||
::
|
||||
%+ expect-eq
|
||||
!> (gas:atom-map ~ ~[[1^%b]])
|
||||
!> b
|
||||
::
|
||||
++ test-ordered-map-traverse ^- tang
|
||||
++ test-ordered-map-dip ^- tang
|
||||
::
|
||||
=/ a=(tree [@ud @tas]) (gas:atom-map ~ test-items)
|
||||
::
|
||||
=/ b %- (traverse:atom-map ,(list [@ud @tas]))
|
||||
=/ b %- (dip:atom-map ,(list [@ud @tas]))
|
||||
:* a
|
||||
state=~
|
||||
::
|
||||
@ -129,11 +196,11 @@
|
||||
!> -.b
|
||||
==
|
||||
::
|
||||
++ test-ordered-map-traverse-delete-all ^- tang
|
||||
++ test-ordered-map-dip-delete-all ^- tang
|
||||
;: weld
|
||||
=/ q ((ordered-map ,@ ,~) lte)
|
||||
=/ o (gas:q ~ ~[1/~ 2/~ 3/~])
|
||||
=/ b ((traverse:q ,~) o ~ |=([~ key=@ ~] [~ %| ~]))
|
||||
=/ b ((dip:q ,~) o ~ |=([~ key=@ ~] [~ %| ~]))
|
||||
%+ expect-eq
|
||||
!> [~ ~]
|
||||
!> b
|
||||
@ -147,7 +214,7 @@
|
||||
?:((lth aa ba) %.y ?:((gth aa ba) %.n (lte ab bb)))
|
||||
=/ q ((ordered-map ,[@ @] ,~) compare)
|
||||
=/ o (gas:q ~ c)
|
||||
=/ b ((traverse:q ,~) o ~ |=([~ key=[@ @] ~] [~ %| ~]))
|
||||
=/ b ((dip:q ,~) o ~ |=([~ key=[@ @] ~] [~ %| ~]))
|
||||
%+ expect-eq
|
||||
!> [~ ~]
|
||||
!> b
|
||||
|
@ -1,3 +1,3 @@
|
||||
module.exports = {
|
||||
extends: "@urbit"
|
||||
};
|
||||
extends: '@urbit'
|
||||
};
|
||||
|
@ -111,7 +111,7 @@ module.exports = {
|
||||
]
|
||||
}
|
||||
},
|
||||
exclude: /node_modules\/(?!(@tlon\/indigo-dark|@tlon\/indigo-light)\/).*/
|
||||
exclude: /node_modules\/(?!(@tlon\/indigo-dark|@tlon\/indigo-light|@tlon\/indigo-react)\/).*/
|
||||
},
|
||||
{
|
||||
test: /\.css$/i,
|
||||
|
@ -30,7 +30,7 @@ module.exports = {
|
||||
]
|
||||
}
|
||||
},
|
||||
exclude: /node_modules\/(?!(@tlon\/indigo-dark|@tlon\/indigo-light)\/).*/
|
||||
exclude: /node_modules\/(?!(@tlon\/indigo-dark|@tlon\/indigo-light|@tlon\/indigo-react)\/).*/
|
||||
},
|
||||
{
|
||||
test: /\.css$/i,
|
||||
|
1511
pkg/interface/package-lock.json
generated
1511
pkg/interface/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -8,9 +8,10 @@
|
||||
"@reach/disclosure": "^0.10.5",
|
||||
"@reach/menu-button": "^0.10.5",
|
||||
"@reach/tabs": "^0.10.5",
|
||||
"@react-spring/web": "^9.1.1",
|
||||
"@tlon/indigo-dark": "^1.0.6",
|
||||
"@tlon/indigo-light": "^1.0.6",
|
||||
"@tlon/indigo-react": "^1.2.19",
|
||||
"@tlon/indigo-light": "^1.0.7",
|
||||
"@tlon/indigo-react": "^1.2.22",
|
||||
"@tlon/sigil-js": "^1.4.3",
|
||||
"@urbit/api": "file:../npm/api",
|
||||
"any-ascii": "^0.1.7",
|
||||
@ -22,8 +23,7 @@
|
||||
"file-saver": "^2.0.5",
|
||||
"formik": "^2.1.5",
|
||||
"immer": "^8.0.1",
|
||||
"lodash": "^4.17.20",
|
||||
"markdown-to-jsx": "^6.11.4",
|
||||
"lodash": "^4.17.21",
|
||||
"moment": "^2.29.1",
|
||||
"mousetrap": "^1.6.5",
|
||||
"mousetrap-global-bind": "^1.1.0",
|
||||
@ -38,15 +38,18 @@
|
||||
"react-markdown": "^4.3.1",
|
||||
"react-oembed-container": "^1.0.0",
|
||||
"react-router-dom": "^5.2.0",
|
||||
"react-use-gesture": "^9.1.3",
|
||||
"react-virtuoso": "^0.20.3",
|
||||
"react-visibility-sensor": "^5.1.1",
|
||||
"remark-breaks": "^2.0.1",
|
||||
"remark-disable-tokenizers": "^1.0.24",
|
||||
"remark": "^12.0.0",
|
||||
"remark-breaks": "^2.0.2",
|
||||
"remark-disable-tokenizers": "1.1.0",
|
||||
"stacktrace-js": "^2.0.2",
|
||||
"style-loader": "^1.3.0",
|
||||
"styled-components": "^5.1.1",
|
||||
"styled-system": "^5.1.5",
|
||||
"suncalc": "^1.8.0",
|
||||
"unist-util-visit": "^3.0.0",
|
||||
"urbit-ob": "^5.0.1",
|
||||
"workbox-core": "^6.0.2",
|
||||
"workbox-precaching": "^6.0.2",
|
||||
@ -88,7 +91,7 @@
|
||||
"react-hot-loader": "^4.13.0",
|
||||
"sass": "^1.32.5",
|
||||
"sass-loader": "^8.0.2",
|
||||
"typescript": "^3.9.7",
|
||||
"typescript": "^4.2.4",
|
||||
"webpack": "^4.46.0",
|
||||
"webpack-cli": "^3.3.12",
|
||||
"webpack-dev-server": "^3.11.2"
|
||||
|
@ -1,9 +1,7 @@
|
||||
import './wdyr';
|
||||
import * as React from 'react';
|
||||
import * as ReactDOM from 'react-dom';
|
||||
|
||||
import './register-sw';
|
||||
|
||||
import App from './views/App';
|
||||
import './wdyr';
|
||||
|
||||
ReactDOM.render(<App />, document.getElementById('root'));
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Path, Patp } from '@urbit/api';
|
||||
import _ from 'lodash';
|
||||
import { Patp, Path } from '@urbit/api';
|
||||
import BaseStore from '../store/base';
|
||||
|
||||
export default class BaseApi<S extends object = {}> {
|
||||
|
@ -1,7 +1,8 @@
|
||||
import BaseApi from './base';
|
||||
import { StoreState } from '../store/type';
|
||||
import { Patp } from '@urbit/api';
|
||||
import { ContactEdit } from '@urbit/api/contacts';
|
||||
import { ContactEditField } from '@urbit/api/contacts';
|
||||
import _ from 'lodash';
|
||||
import { StoreState } from '../store/type';
|
||||
import BaseApi from './base';
|
||||
|
||||
export default class ContactsApi extends BaseApi<StoreState> {
|
||||
add(ship: Patp, contact: any) {
|
||||
@ -13,7 +14,7 @@ export default class ContactsApi extends BaseApi<StoreState> {
|
||||
return this.storeAction({ remove: { ship } });
|
||||
}
|
||||
|
||||
edit(ship: Patp, editField: ContactEdit) {
|
||||
edit(ship: Patp, editField: ContactEditField) {
|
||||
/* editField can be...
|
||||
{nickname: ''}
|
||||
{email: ''}
|
||||
@ -73,6 +74,28 @@ export default class ContactsApi extends BaseApi<StoreState> {
|
||||
);
|
||||
}
|
||||
|
||||
async disallowedShipsForOurContact(ships: string[]): Promise<string[]> {
|
||||
return _.compact(
|
||||
await Promise.all(
|
||||
ships.map(
|
||||
async (s) => {
|
||||
const ship = `~${s}`;
|
||||
if(s === window.ship) {
|
||||
return null;
|
||||
}
|
||||
const allowed = await this.fetchIsAllowed(
|
||||
`~${window.ship}`,
|
||||
'personal',
|
||||
ship,
|
||||
true
|
||||
);
|
||||
return allowed ? null : ship;
|
||||
}
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
retrieve(ship: string) {
|
||||
const resource = { ship, name: '' };
|
||||
return this.action('contact-pull-hook', 'pull-hook-action', {
|
||||
|
@ -1,7 +1,5 @@
|
||||
import type { StoreState } from '../store/type';
|
||||
import BaseApi from './base';
|
||||
import type {StoreState} from '../store/type';
|
||||
import type {GcpToken} from '../../types/gcp-state';
|
||||
|
||||
|
||||
export default class GcpApi extends BaseApi<StoreState> {
|
||||
// Does not touch the store; use the value manually.
|
||||
@ -18,4 +16,4 @@ export default class GcpApi extends BaseApi<StoreState> {
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -1,17 +1,17 @@
|
||||
import { Patp } from '@urbit/api';
|
||||
import BaseApi from './base';
|
||||
import { StoreState } from '../store/type';
|
||||
import GlobalStore from '../store/store';
|
||||
import LocalApi from './local';
|
||||
import InviteApi from './invite';
|
||||
import MetadataApi from './metadata';
|
||||
import { StoreState } from '../store/type';
|
||||
import BaseApi from './base';
|
||||
import ContactsApi from './contacts';
|
||||
import GroupsApi from './groups';
|
||||
import LaunchApi from './launch';
|
||||
import GraphApi from './graph';
|
||||
import S3Api from './s3';
|
||||
import GcpApi from './gcp';
|
||||
import GraphApi from './graph';
|
||||
import GroupsApi from './groups';
|
||||
import { HarkApi } from './hark';
|
||||
import InviteApi from './invite';
|
||||
import LaunchApi from './launch';
|
||||
import LocalApi from './local';
|
||||
import MetadataApi from './metadata';
|
||||
import S3Api from './s3';
|
||||
import SettingsApi from './settings';
|
||||
|
||||
export default class GlobalApi extends BaseApi<StoreState> {
|
||||
|
@ -1,16 +1,16 @@
|
||||
import BaseApi from './base';
|
||||
import { StoreState } from '../store/type';
|
||||
import { Patp, Path, Resource } from '@urbit/api';
|
||||
import { Content, Enc, GraphNode, GroupPolicy, Path, Patp, Post, Resource } from '@urbit/api';
|
||||
import BigIntOrderedMap from '@urbit/api/lib/BigIntOrderedMap';
|
||||
import _ from 'lodash';
|
||||
import { decToUd, deSig, resourceAsPath, unixToDa } from '~/logic/lib/util';
|
||||
import { makeResource, resourceFromPath } from '../lib/group';
|
||||
import { GroupPolicy, Enc, Post, Content } from '@urbit/api';
|
||||
import { numToUd, unixToDa, decToUd, deSig, resourceAsPath } from '~/logic/lib/util';
|
||||
import { StoreState } from '../store/type';
|
||||
import BaseApi from './base';
|
||||
|
||||
export const createBlankNodeWithChildPost = (
|
||||
parentIndex = '',
|
||||
childIndex = '',
|
||||
contents: Content[]
|
||||
) => {
|
||||
): GraphNode => {
|
||||
const date = unixToDa(Date.now()).toString();
|
||||
const nodeIndex = parentIndex + '/' + date;
|
||||
|
||||
@ -36,7 +36,7 @@ export const createBlankNodeWithChildPost = (
|
||||
hash: null,
|
||||
signatures: []
|
||||
},
|
||||
children: childGraph
|
||||
children: childGraph as BigIntOrderedMap<GraphNode>
|
||||
};
|
||||
};
|
||||
|
||||
@ -83,7 +83,7 @@ export default class GraphApi extends BaseApi<StoreState> {
|
||||
joiningGraphs = new Set<string>();
|
||||
|
||||
private storeAction(action: any): Promise<any> {
|
||||
return this.action('graph-store', 'graph-update-1', action);
|
||||
return this.action('graph-store', 'graph-update-2', action);
|
||||
}
|
||||
|
||||
private viewAction(threadName: string, action: any) {
|
||||
@ -91,7 +91,7 @@ export default class GraphApi extends BaseApi<StoreState> {
|
||||
}
|
||||
|
||||
private hookAction(ship: Patp, action: any): Promise<any> {
|
||||
return this.action('graph-push-hook', 'graph-update-1', action);
|
||||
return this.action('graph-push-hook', 'graph-update-2', action);
|
||||
}
|
||||
|
||||
createManagedGraph(
|
||||
@ -185,13 +185,12 @@ export default class GraphApi extends BaseApi<StoreState> {
|
||||
});
|
||||
}
|
||||
|
||||
eval(cord: string) {
|
||||
eval(cord: string): Promise<string[] | undefined> {
|
||||
return this.spider('graph-view-action', 'tang', 'graph-eval', {
|
||||
eval: cord
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
addGraph(ship: Patp, name: string, graph: any, mark: any) {
|
||||
return this.storeAction({
|
||||
'add-graph': {
|
||||
@ -211,7 +210,7 @@ export default class GraphApi extends BaseApi<StoreState> {
|
||||
return this.addNodes(ship, name, nodes);
|
||||
}
|
||||
|
||||
addNode(ship: Patp, name: string, node: Object) {
|
||||
addNode(ship: Patp, name: string, node: GraphNode) {
|
||||
const nodes = {};
|
||||
nodes[node.post.index] = node;
|
||||
|
||||
@ -227,7 +226,7 @@ export default class GraphApi extends BaseApi<StoreState> {
|
||||
};
|
||||
|
||||
const pendingPromise = this.spider(
|
||||
'graph-update-1',
|
||||
'graph-update-2',
|
||||
'graph-view-action',
|
||||
'graph-add-nodes',
|
||||
action
|
||||
@ -265,7 +264,7 @@ export default class GraphApi extends BaseApi<StoreState> {
|
||||
'resource',
|
||||
'graph-create-group-feed',
|
||||
{
|
||||
"create-group-feed": { resource: group, vip }
|
||||
'create-group-feed': { resource: group, vip }
|
||||
}
|
||||
);
|
||||
return resource;
|
||||
@ -277,15 +276,14 @@ export default class GraphApi extends BaseApi<StoreState> {
|
||||
'json',
|
||||
'graph-disable-group-feed',
|
||||
{
|
||||
"disable-group-feed": { resource: group }
|
||||
'disable-group-feed': { resource: group }
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
removeNodes(ship: Patp, name: string, indices: string[]) {
|
||||
removePosts(ship: Patp, name: string, indices: string[]) {
|
||||
return this.hookAction(ship, {
|
||||
'remove-nodes': {
|
||||
'remove-posts': {
|
||||
resource: { ship, name },
|
||||
indices
|
||||
}
|
||||
@ -369,7 +367,7 @@ export default class GraphApi extends BaseApi<StoreState> {
|
||||
const node = data['graph-update'];
|
||||
this.store.handleEvent({
|
||||
data: {
|
||||
"graph-update-loose": node
|
||||
'graph-update-loose': node
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
import BaseApi from './base';
|
||||
import { StoreState } from '../store/type';
|
||||
import { Path, Patp, Enc } from '@urbit/api';
|
||||
import { Enc, Patp } from '@urbit/api';
|
||||
import {
|
||||
GroupAction,
|
||||
GroupPolicy,
|
||||
Resource,
|
||||
Tag,
|
||||
GroupPolicyDiff
|
||||
|
||||
GroupPolicyDiff, Resource,
|
||||
Tag
|
||||
} from '@urbit/api/groups';
|
||||
import { makeResource } from '../lib/group';
|
||||
import { StoreState } from '../store/type';
|
||||
import BaseApi from './base';
|
||||
|
||||
export default class GroupsApi extends BaseApi<StoreState> {
|
||||
remove(resource: Resource, ships: Patp[]) {
|
||||
|
@ -1,10 +1,10 @@
|
||||
import BaseApi from './base';
|
||||
import { StoreState } from '../store/type';
|
||||
import { dateToDa, decToUd } from '../lib/util';
|
||||
import { NotifIndex, IndexedNotification, Association, GraphNotifDescription } from '@urbit/api';
|
||||
import { Association, GraphNotifDescription, IndexedNotification, NotifIndex } from '@urbit/api';
|
||||
import { BigInteger } from 'big-integer';
|
||||
import { getParentIndex } from '../lib/notification';
|
||||
import { dateToDa, decToUd } from '../lib/util';
|
||||
import useHarkState from '../state/hark';
|
||||
import { StoreState } from '../store/type';
|
||||
import BaseApi from './base';
|
||||
|
||||
function getHarkSize() {
|
||||
return useHarkState.getState().notifications.size ?? 0;
|
||||
@ -75,7 +75,6 @@ export class HarkApi extends BaseApi<StoreState> {
|
||||
graph: {
|
||||
graph: association.resource,
|
||||
group: association.group,
|
||||
module: association.metadata.module,
|
||||
description,
|
||||
index: parent
|
||||
} }
|
||||
|
@ -1,6 +1,6 @@
|
||||
import BaseApi from './base';
|
||||
import { Serial } from '@urbit/api';
|
||||
import { StoreState } from '../store/type';
|
||||
import { Serial, Path } from '@urbit/api';
|
||||
import BaseApi from './base';
|
||||
|
||||
export default class InviteApi extends BaseApi<StoreState> {
|
||||
accept(app: string, uid: Serial) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import BaseApi from './base';
|
||||
import { StoreState } from '../store/type';
|
||||
import BaseApi from './base';
|
||||
|
||||
export default class LaunchApi extends BaseApi<StoreState> {
|
||||
add(name: string, tile = { basic : { title: '', linkedUrl: '', iconUrl: '' } }) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import BaseApi from './base';
|
||||
import { StoreState } from '../store/type';
|
||||
import BaseApi from './base';
|
||||
|
||||
export default class LocalApi extends BaseApi<StoreState> {
|
||||
getBaseHash() {
|
||||
@ -8,7 +8,9 @@ export default class LocalApi extends BaseApi<StoreState> {
|
||||
});
|
||||
}
|
||||
|
||||
dehydrate() {
|
||||
this.store.dehydrate();
|
||||
getRuntimeLag() {
|
||||
return this.scry<boolean>('launch', '/runtime-lag').then((runtimeLag) => {
|
||||
this.store.handleEvent({ data: { runtimeLag } });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
import BaseApi from './base';
|
||||
import { StoreState } from '../store/type';
|
||||
import { Path, Patp, Association, Metadata, MetadataUpdatePreview } from '@urbit/api';
|
||||
import { Association, Metadata, MetadataUpdatePreview, Path } from '@urbit/api';
|
||||
import { uxToHex } from '../lib/util';
|
||||
import { StoreState } from '../store/type';
|
||||
import BaseApi from './base';
|
||||
|
||||
export default class MetadataApi extends BaseApi<StoreState> {
|
||||
metadataAdd(appName: string, resource: Path, group: Path, title: string, description: string, dateCreated: string, color: string, moduleName: string) {
|
||||
|
@ -1,6 +1,5 @@
|
||||
import BaseApi from './base';
|
||||
import { StoreState } from '../store/type';
|
||||
import { S3Update } from '../../types/s3-update';
|
||||
import BaseApi from './base';
|
||||
|
||||
export default class S3Api extends BaseApi<StoreState> {
|
||||
setCurrentBucket(bucket: string) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user