mirror of
https://github.com/urbit/shrub.git
synced 2024-11-28 22:33:06 +03:00
Merge branch 'release/next-userspace' into lf/ts-global-store
This commit is contained in:
commit
7be0831f39
@ -451,6 +451,7 @@
|
||||
::
|
||||
++ parser
|
||||
|^
|
||||
%+ stag |
|
||||
%+ knee *command |. ~+
|
||||
=- ;~(pose ;~(pfix mic -) message)
|
||||
;~ pose
|
||||
|
@ -14,8 +14,8 @@
|
||||
:: to expede this process, we prod other potential listeners when we add
|
||||
:: them to our metadata+groups definition.
|
||||
::
|
||||
/- link-listen-hook, *metadata-store, *link, group-store
|
||||
/+ mdl=metadata, default-agent, verb, dbug
|
||||
/- *link, listen-hook=link-listen-hook, *metadata-store, group-store
|
||||
/+ mdl=metadata, default-agent, verb, dbug, store=link-store
|
||||
::
|
||||
~% %link-listen-hook-top ..is ~
|
||||
|%
|
||||
@ -167,7 +167,7 @@
|
||||
?> (team:title [our src]:bowl)
|
||||
=^ cards state
|
||||
~| p.vase
|
||||
(handle-listen-action:do !<(action:link-listen-hook vase))
|
||||
(handle-listen-action:do !<(action:listen-hook vase))
|
||||
[cards this]
|
||||
==
|
||||
::
|
||||
@ -218,7 +218,7 @@
|
||||
:: user actions & updates
|
||||
::
|
||||
++ handle-listen-action
|
||||
|= =action:link-listen-hook
|
||||
|= =action:listen-hook
|
||||
^- (quip card _state)
|
||||
::NOTE no-opping where appropriate happens further down the call stack.
|
||||
:: we *could* no-op here, as %watch when we're already listening should
|
||||
@ -250,7 +250,7 @@
|
||||
$(cards (weld cards more-cards), groups t.groups)
|
||||
::
|
||||
++ send-update
|
||||
|= =update:link-listen-hook
|
||||
|= =update:listen-hook
|
||||
^- card
|
||||
[%give %fact ~[/listening] %link-listen-update !>(update)]
|
||||
::
|
||||
@ -500,11 +500,11 @@
|
||||
?+ mark ~|([dap.bowl %unexpected-mark mark] !!)
|
||||
%link-initial
|
||||
%- handle-link-initial
|
||||
[who.target where.target !<(initial vase)]
|
||||
[who.target where.target !<(initial:store vase)]
|
||||
::
|
||||
%link-update
|
||||
%- handle-link-update
|
||||
[who.target where.target !<(update vase)]
|
||||
[who.target where.target !<(update:store vase)]
|
||||
==
|
||||
==
|
||||
::
|
||||
@ -546,7 +546,7 @@
|
||||
group-path
|
||||
::
|
||||
++ do-link-action
|
||||
|= [=wire =action]
|
||||
|= [=wire =action:store]
|
||||
^- card
|
||||
:* %pass
|
||||
wire
|
||||
@ -558,7 +558,7 @@
|
||||
==
|
||||
::
|
||||
++ handle-link-initial
|
||||
|= [who=ship where=path =initial]
|
||||
|= [who=ship where=path =initial:store]
|
||||
^- (quip card _state)
|
||||
?> =(src.bowl who)
|
||||
?+ -.initial ~|([dap.bowl %unexpected-initial -.initial] !!)
|
||||
@ -580,7 +580,7 @@
|
||||
==
|
||||
::
|
||||
++ handle-link-update
|
||||
|= [who=ship where=path =update]
|
||||
|= [who=ship where=path =update:store]
|
||||
^- (quip card _state)
|
||||
?> =(src.bowl who)
|
||||
:_ state
|
||||
@ -594,11 +594,11 @@
|
||||
::
|
||||
%annotations
|
||||
%+ turn notes.update
|
||||
|= =note
|
||||
|= =^note
|
||||
^- card
|
||||
%+ do-link-action
|
||||
[%forward %annotation (scot %p who) where]
|
||||
[%read where url.update who note]
|
||||
[%read where url.update `comment`[who note]]
|
||||
==
|
||||
::
|
||||
++ take-forward-sign
|
||||
|
@ -19,8 +19,8 @@
|
||||
:: when adding support for new paths, the only things you'll likely want
|
||||
:: to touch are +permitted, +initial-response, & +kick-proxies.
|
||||
::
|
||||
/- group-store, *metadata-store
|
||||
/+ *link, metadata, default-agent, verb, dbug
|
||||
/- *link, group-store, *metadata-store
|
||||
/+ store=link-store, metadata, default-agent, verb, dbug
|
||||
~% %link-proxy-hook-top ..is ~
|
||||
|%
|
||||
+$ state-0
|
||||
@ -269,7 +269,7 @@
|
||||
++ initial-response
|
||||
|= =path
|
||||
^- card
|
||||
=; =initial
|
||||
=; =initial:store
|
||||
[%give %fact ~ %link-initial !>(initial)]
|
||||
?+ path !!
|
||||
[%local-pages ^]
|
||||
|
@ -50,7 +50,8 @@
|
||||
:: ?
|
||||
:: /seen/wood-url/some-path have we seen this here
|
||||
::
|
||||
/+ *link, default-agent, verb, dbug
|
||||
/- *link
|
||||
/+ store=link-store, default-agent, verb, dbug
|
||||
::
|
||||
|%
|
||||
+$ state-0
|
||||
@ -101,8 +102,8 @@
|
||||
=^ cards state
|
||||
?+ mark (on-poke:def mark vase)
|
||||
::TODO move json conversion into mark once mark performance improves
|
||||
%json (do-action:do (action:de-json !<(json vase)))
|
||||
%link-action (do-action:do !<(action vase))
|
||||
%json (do-action:do (action:dejs:store !<(json vase)))
|
||||
%link-action (do-action:do !<(action:store vase))
|
||||
==
|
||||
[cards this]
|
||||
::
|
||||
@ -121,7 +122,7 @@
|
||||
::
|
||||
[%y ?(%annotations %discussions) *]
|
||||
=/ [spath=^path surl=url]
|
||||
(break-discussion-path t.t.path)
|
||||
(break-discussion-path:store t.t.path)
|
||||
=- ``noun+!>(-)
|
||||
::
|
||||
?: =(~ surl)
|
||||
@ -174,22 +175,22 @@
|
||||
|^ ?+ path (on-watch:def path)
|
||||
[%local-pages *]
|
||||
%+ give %link-initial
|
||||
^- initial
|
||||
^- initial:store
|
||||
[%local-pages (get-local-pages:do t.path)]
|
||||
::
|
||||
[%submissions *]
|
||||
%+ give %link-initial
|
||||
^- initial
|
||||
^- initial:store
|
||||
[%submissions (get-submissions:do t.path)]
|
||||
::
|
||||
[%annotations *]
|
||||
%+ give %link-initial
|
||||
^- initial
|
||||
^- initial:store
|
||||
[%annotations (get-annotations:do t.path)]
|
||||
::
|
||||
[%discussions *]
|
||||
%+ give %link-initial
|
||||
^- initial
|
||||
^- initial:store
|
||||
[%discussions (get-discussions:do t.path)]
|
||||
::
|
||||
[%seen ~]
|
||||
@ -218,7 +219,7 @@
|
||||
:: writing
|
||||
::
|
||||
++ do-action
|
||||
|= =action
|
||||
|= =action:store
|
||||
^- (quip card _state)
|
||||
?- -.action
|
||||
%save (save-page +.action)
|
||||
@ -284,8 +285,8 @@
|
||||
:+ %give %fact
|
||||
:+ :~ /annotations
|
||||
[%annotations %$ path]
|
||||
[%annotations (build-discussion-path url)]
|
||||
[%annotations (build-discussion-path path url)]
|
||||
[%annotations (build-discussion-path:store url)]
|
||||
[%annotations (build-discussion-path:store path url)]
|
||||
==
|
||||
%link-update
|
||||
!>([%annotations path url [note]~])
|
||||
@ -324,11 +325,11 @@
|
||||
?: ?=(^ (find ~[submission] submissions.links))
|
||||
[| submissions.links]
|
||||
:- &
|
||||
(submissions:merge submissions.links ~[submission])
|
||||
(submissions:merge:store submissions.links ~[submission])
|
||||
=. by-group (~(put by by-group) path links)
|
||||
:: add submission to global sites
|
||||
::
|
||||
=/ =site (site-from-url url.submission)
|
||||
=/ =site (site-from-url:store url.submission)
|
||||
=. by-site (~(add ja by-site) site [path submission])
|
||||
:: send updates to subscribers
|
||||
::
|
||||
@ -354,7 +355,7 @@
|
||||
?: ?=(^ (find ~[comment] comments.discussion))
|
||||
[| comments.discussion]
|
||||
:- &
|
||||
(comments:merge comments.discussion ~[comment])
|
||||
(comments:merge:store comments.discussion ~[comment])
|
||||
=. urls (~(put by urls) url discussion)
|
||||
=. discussions (~(put by discussions) path urls)
|
||||
:: send updates to subscribers
|
||||
@ -365,8 +366,8 @@
|
||||
:+ %give %fact
|
||||
:+ :~ /discussions
|
||||
[%discussions '' path]
|
||||
[%discussions (build-discussion-path url)]
|
||||
[%discussions (build-discussion-path path url)]
|
||||
[%discussions (build-discussion-path:store url)]
|
||||
[%discussions (build-discussion-path:store path url)]
|
||||
==
|
||||
%link-update
|
||||
!>([%discussions path url [comment]~])
|
||||
@ -420,7 +421,7 @@
|
||||
|= =path
|
||||
^- ?
|
||||
=/ [=^path =url]
|
||||
(break-discussion-path path)
|
||||
(break-discussion-path:store path)
|
||||
%. url
|
||||
%~ has in
|
||||
seen:(~(gut by by-group) path *links)
|
||||
@ -430,7 +431,7 @@
|
||||
|= =path
|
||||
^- (per-path-url notes)
|
||||
=/ args=[=^path =url]
|
||||
(break-discussion-path path)
|
||||
(break-discussion-path:store path)
|
||||
|^ ?~ path
|
||||
:: all paths
|
||||
::
|
||||
@ -460,7 +461,7 @@
|
||||
|= =path
|
||||
^- (per-path-url comments)
|
||||
=/ args=[=^path =url]
|
||||
(break-discussion-path path)
|
||||
(break-discussion-path:store path)
|
||||
|^ ?~ path
|
||||
:: all paths
|
||||
::
|
||||
|
@ -10,12 +10,12 @@
|
||||
:: /json/[n]/submission/[wood-url]/[collection] nth matching submission
|
||||
:: /json/seen mark-as-read updates
|
||||
::
|
||||
/- *link-view,
|
||||
/- *link, view=link-view,
|
||||
*invite-store, group-store,
|
||||
link-listen-hook,
|
||||
listen-hook=link-listen-hook,
|
||||
group-hook, permission-hook, permission-group-hook,
|
||||
metadata-hook, contact-view
|
||||
/+ *link, metadata, *server, default-agent, verb, dbug
|
||||
/+ store=link-store, metadata, *server, default-agent, verb, dbug
|
||||
~% %link-view-top ..is ~
|
||||
::
|
||||
|%
|
||||
@ -89,10 +89,10 @@
|
||||
:_ this
|
||||
?+ mark (on-poke:def mark vase)
|
||||
%link-action
|
||||
[(handle-action:do !<(action vase)) ~]
|
||||
[(handle-action:do !<(action:store vase)) ~]
|
||||
::
|
||||
%link-view-action
|
||||
(handle-view-action:do !<(view-action vase))
|
||||
(handle-view-action:do !<(action:view vase))
|
||||
==
|
||||
::
|
||||
++ on-watch
|
||||
@ -117,11 +117,11 @@
|
||||
::
|
||||
[%submission @ ^]
|
||||
:_ this
|
||||
(give-specific-submission:do p (break-discussion-path t.t.t.path))
|
||||
(give-specific-submission:do p (break-discussion-path:store t.t.t.path))
|
||||
::
|
||||
[%discussions @ ^]
|
||||
:_ this
|
||||
(give-initial-discussions:do p (break-discussion-path t.t.t.path))
|
||||
(give-initial-discussions:do p (break-discussion-path:store t.t.t.path))
|
||||
==
|
||||
::
|
||||
++ on-agent
|
||||
@ -145,7 +145,7 @@
|
||||
::
|
||||
%link-update
|
||||
:_ this
|
||||
:- (send-update:do !<(update vase))
|
||||
:- (send-update:do !<(update:store vase))
|
||||
?: =(/discussions wire) ~
|
||||
~[give-tile-data:do]
|
||||
==
|
||||
@ -221,12 +221,12 @@
|
||||
==
|
||||
::
|
||||
++ handle-action
|
||||
|= =action
|
||||
|= =action:store
|
||||
^- card
|
||||
[%pass /action %agent [our.bowl %link-store] %poke %link-action !>(action)]
|
||||
::
|
||||
++ handle-view-action
|
||||
|= act=view-action
|
||||
|= act=action:view
|
||||
^- (list card)
|
||||
?- -.act
|
||||
%create (handle-create +.act)
|
||||
@ -235,7 +235,7 @@
|
||||
==
|
||||
::
|
||||
++ handle-create
|
||||
|= [=path title=@t description=@t members=create-members real-group=?]
|
||||
|= [=path title=@t description=@t members=create-members:view real-group=?]
|
||||
^- (list card)
|
||||
=/ group-path=^path
|
||||
?- -.members
|
||||
@ -273,7 +273,7 @@
|
||||
::
|
||||
%^ do-poke %link-listen-hook
|
||||
%link-listen-action
|
||||
!> ^- action:link-listen-hook
|
||||
!> ^- action:listen-hook
|
||||
[%watch path]
|
||||
==
|
||||
?: ?=(%group -.members) ~
|
||||
@ -487,7 +487,7 @@
|
||||
submissions
|
||||
|= =submission
|
||||
^- json
|
||||
=/ =json (submission:en-json submission)
|
||||
=/ =json (submission:enjs:store submission)
|
||||
?> ?=([%o *] json)
|
||||
:: add in seen status
|
||||
::
|
||||
@ -495,7 +495,7 @@
|
||||
%+ ~(put by p.json) 'seen'
|
||||
:- %b
|
||||
%+ scry-for ?
|
||||
[%seen (build-discussion-path path url.submission)]
|
||||
[%seen (build-discussion-path:store path url.submission)]
|
||||
:: add in comment count
|
||||
::
|
||||
=; comment-count=@ud
|
||||
@ -508,7 +508,7 @@
|
||||
=- (~(got by (~(got by -) path)) url.submission)
|
||||
%+ scry-for (per-path-url comments)
|
||||
:- %discussions
|
||||
(build-discussion-path path url.submission)
|
||||
(build-discussion-path:store path url.submission)
|
||||
::
|
||||
++ give-specific-submission
|
||||
|= [n=@ud =path =url]
|
||||
@ -520,7 +520,7 @@
|
||||
^- json
|
||||
=; sub=(unit submission)
|
||||
?~ sub ~
|
||||
(submission:en-json u.sub)
|
||||
(submission:enjs:store u.sub)
|
||||
=/ =submissions
|
||||
=- (~(got by -) path)
|
||||
%+ scry-for (map ^path submissions)
|
||||
@ -546,17 +546,17 @@
|
||||
%+ get-paginated `p
|
||||
=- (~(got by (~(got by -) path)) url)
|
||||
%+ scry-for (per-path-url comments)
|
||||
[%discussions (build-discussion-path path url)]
|
||||
comment:en-json
|
||||
[%discussions (build-discussion-path:store path url)]
|
||||
comment:enjs:store
|
||||
::
|
||||
++ send-update
|
||||
|= =update
|
||||
|= =update:store
|
||||
^- card
|
||||
?+ -.update ~|([dap.bowl %unexpected-update -.update] !!)
|
||||
%submissions
|
||||
%+ give-json
|
||||
%+ frond:enjs:format 'link-update'
|
||||
(update:en-json update)
|
||||
(update:enjs:store update)
|
||||
:~ /json/0/submissions
|
||||
(weld /json/0/submissions path.update)
|
||||
==
|
||||
@ -564,15 +564,15 @@
|
||||
%discussions
|
||||
%+ give-json
|
||||
%+ frond:enjs:format 'link-update'
|
||||
(update:en-json update)
|
||||
(update:enjs:store update)
|
||||
:_ ~
|
||||
%+ weld /json/0/discussions
|
||||
(build-discussion-path [path url]:update)
|
||||
(build-discussion-path:store [path url]:update)
|
||||
::
|
||||
%observation
|
||||
%+ give-json
|
||||
%+ frond:enjs:format 'link-update'
|
||||
(update:en-json update)
|
||||
(update:enjs:store update)
|
||||
~[/json/seen]
|
||||
==
|
||||
::
|
||||
|
@ -431,8 +431,13 @@
|
||||
[%subscribe @ @ ~]
|
||||
=/ who=@p (slav %p i.t.wir)
|
||||
=/ book=@tas i.t.t.wir
|
||||
=/ wen=(unit @da) (get-last-update:main who book)
|
||||
=/ pax=path
|
||||
?~ wen
|
||||
/notebook/[book]
|
||||
/notebook/[book]/(scot %da u.wen)
|
||||
:_ this
|
||||
[%pass wir %agent [who %publish] %watch /notebook/[book]]~
|
||||
[%pass wir %agent [who %publish] %watch pax]~
|
||||
::
|
||||
[%permissions ~]
|
||||
:_ this
|
||||
@ -518,6 +523,59 @@
|
||||
::
|
||||
|_ bol=bowl:gall
|
||||
::
|
||||
++ get-last-update
|
||||
|= [host=@p book-name=@tas]
|
||||
^- (unit @da)
|
||||
=/ book (~(get by books) host book-name)
|
||||
?~ book ~
|
||||
=/ wen date-created.u.book
|
||||
%- some
|
||||
%- ~(rep by notes.u.book)
|
||||
|= [[@tas =note] out=_wen]
|
||||
^- @da
|
||||
%+ max out
|
||||
%+ max last-edit.note
|
||||
%- ~(rep by comments.note)
|
||||
|= [[@da =comment] out=_out]
|
||||
(max date-created.comment out)
|
||||
::
|
||||
++ get-notebook-from-date
|
||||
|= [host=@p book-name=@tas wen=@da]
|
||||
^- notebook
|
||||
=/ book (~(got by books) host book-name)
|
||||
%= book
|
||||
notes
|
||||
%- ~(rep by notes.book)
|
||||
|= [[nom=@tas not=note] out=(map @tas note)]
|
||||
^- (map @tas note)
|
||||
?: (gth last-edit.not wen)
|
||||
(~(put by out) nom not)
|
||||
=. comments.not
|
||||
%- ~(rep by comments.not)
|
||||
|= [[nam=@da com=comment] out=(map @da comment)]
|
||||
?: (gth date-created.com wen)
|
||||
(~(put by out) nam com)
|
||||
out
|
||||
?~ comments.not
|
||||
out
|
||||
(~(put by out) nom not)
|
||||
==
|
||||
::
|
||||
++ merge-notebooks
|
||||
|= [base=notebook diff=notebook]
|
||||
^- notebook
|
||||
%= diff
|
||||
notes
|
||||
%- ~(rep by notes.diff)
|
||||
|= [[nom=@tas not=note] out=_notes.base]
|
||||
=/ base-note=(unit note) (~(get by out) nom)
|
||||
?~ base-note
|
||||
(~(put by out) nom not)
|
||||
=. comments.u.base-note
|
||||
(~(uni by comments.u.base-note) comments.not)
|
||||
(~(put by out) nom u.base-note)
|
||||
==
|
||||
::
|
||||
++ read-paths
|
||||
|= ran=rant:clay
|
||||
^- (quip card _state)
|
||||
@ -857,6 +915,19 @@
|
||||
%.n
|
||||
==
|
||||
::
|
||||
++ get-subscriber-paths
|
||||
|= [book-name=@tas who=@p]
|
||||
^- (list path)
|
||||
%+ roll ~(val by sup.bol)
|
||||
|= [[whom=@p pax=path] out=(list path)]
|
||||
?. =(who whom)
|
||||
out
|
||||
?. ?=([%notebook @ *] pax)
|
||||
out
|
||||
?. =(i.t.pax book-name)
|
||||
out
|
||||
[pax out]
|
||||
::
|
||||
++ handle-permission-update
|
||||
|= upd=permission-update
|
||||
^- (quip card _state)
|
||||
@ -877,7 +948,7 @@
|
||||
%+ turn ~(tap in who.upd)
|
||||
|= who=@p
|
||||
?. (allowed who %read u.book)
|
||||
[%give %kick [/notebook/[u.book]]~ `who]~
|
||||
[%give %kick (get-subscriber-paths u.book who) `who]~
|
||||
?: ?|(?=(%remove -.upd) (is-managed path.upd))
|
||||
~
|
||||
=/ uid (sham %publish who u.book eny.bol)
|
||||
@ -913,11 +984,15 @@
|
||||
::
|
||||
++ watch-notebook
|
||||
|= pax=path
|
||||
?> ?=([%notebook @ ~] pax)
|
||||
?> ?=([%notebook @ *] pax)
|
||||
=/ book-name i.t.pax
|
||||
?. (allowed src.bol %read book-name)
|
||||
~|("not permitted" !!)
|
||||
=/ book (~(got by books) our.bol book-name)
|
||||
=/ book
|
||||
?: ?=([%notebook @ @ ~] pax)
|
||||
=/ wen=@da (slav %da i.t.t.pax)
|
||||
(get-notebook-from-date our.bol book-name wen)
|
||||
(~(got by books) our.bol book-name)
|
||||
=/ delta=notebook-delta
|
||||
[%add-book our.bol book-name book]
|
||||
:_ state
|
||||
@ -1766,7 +1841,7 @@
|
||||
%+ turn ~(tap in dif-peeps)
|
||||
|= who=@p
|
||||
^- card
|
||||
[%give %kick [/notebook/[book.act]]~ `who]
|
||||
[%give %kick (get-subscriber-paths book.act who) `who]
|
||||
==
|
||||
::
|
||||
++ get-subscribers
|
||||
@ -1910,6 +1985,8 @@
|
||||
date-created.data.del
|
||||
==
|
||||
==
|
||||
=? data.del (~(has by books) host.del book.del)
|
||||
(merge-notebooks (~(got by books) host.del book.del) data.del)
|
||||
=^ cards state
|
||||
(emit-updates-and-state host.del book.del data.del del sty)
|
||||
:_ state
|
||||
|
@ -40,8 +40,8 @@
|
||||
::
|
||||
++ command-parser
|
||||
|= sole-id=@ta
|
||||
^+ |~(nail *(like command))
|
||||
(cold ~ (jest 'demo'))
|
||||
^+ |~(nail *(like [? command]))
|
||||
(cold [& ~] (jest 'demo'))
|
||||
::
|
||||
++ tab-list
|
||||
|= sole-id=@ta
|
||||
|
@ -1,6 +1,6 @@
|
||||
:: link-store|note: write a note on a link in a path
|
||||
::
|
||||
/- *link
|
||||
/- *link-store, *link
|
||||
:- %say
|
||||
|= $: [now=@da eny=@uvJ =beak]
|
||||
[[=path =url note=@t ~] ~]
|
||||
|
@ -1,6 +1,6 @@
|
||||
:: link-store|save: save a link to a path
|
||||
::
|
||||
/- *link
|
||||
/- *link-store, *link
|
||||
:- %say
|
||||
|= $: [now=@da eny=@uvJ =beak]
|
||||
[[=path title=@t =url ~] ~]
|
||||
|
@ -248,15 +248,15 @@
|
||||
::
|
||||
++ get-id
|
||||
|= [pos=@ud txt=tape]
|
||||
^- [forward=(unit term) backward=(unit term) id=(unit term)]
|
||||
=/ forward=(unit term)
|
||||
%+ scan `tape`(slag pos txt)
|
||||
;~(sfix (punt sym) (star ;~(pose prn (just `@`10))))
|
||||
=/ backward=(unit term)
|
||||
^- [forward=(unit @t) backward=(unit @t) id=(unit @t)]
|
||||
=/ seek
|
||||
;~(sfix (punt (cook crip (star prn))) (star ;~(pose prn (just `@`10))))
|
||||
=/ forward=(unit @t)
|
||||
(scan (slag pos txt) seek)
|
||||
=/ backward=(unit @t)
|
||||
%- (lift |=(t=@tas (swp 3 t)))
|
||||
%+ scan `tape`(flop (scag pos txt))
|
||||
;~(sfix (punt sym) (star ;~(pose prn (just `@`10))))
|
||||
=/ id=(unit term)
|
||||
(scan (flop (scag pos txt)) seek)
|
||||
=/ id=(unit @t)
|
||||
?~ forward
|
||||
?~ backward
|
||||
~
|
||||
|
@ -1,7 +1,10 @@
|
||||
:: link: social bookmarking
|
||||
::
|
||||
/- *link
|
||||
/- sur=link-store, *link
|
||||
::
|
||||
^?
|
||||
=< [. sur]
|
||||
=, sur
|
||||
|%
|
||||
++ site-from-url
|
||||
|= =url
|
||||
@ -92,8 +95,9 @@
|
||||
[a b]
|
||||
--
|
||||
::
|
||||
++ en-json
|
||||
++ enjs
|
||||
=, enjs:format
|
||||
^?
|
||||
|%
|
||||
++ update
|
||||
|= upd=^update
|
||||
@ -166,8 +170,9 @@
|
||||
==
|
||||
--
|
||||
::
|
||||
++ de-json
|
||||
++ dejs
|
||||
=, dejs:format
|
||||
^?
|
||||
|%
|
||||
:: +action: json into action
|
||||
::
|
@ -35,14 +35,20 @@
|
||||
|* command-type=mold
|
||||
$_ ^|
|
||||
|_ bowl:gall
|
||||
:: +command-parser: input parser for a specific session
|
||||
::
|
||||
:: if the head of the result is true, instantly run the command
|
||||
::
|
||||
++ command-parser
|
||||
|~ sole-id=@ta
|
||||
|~(nail *(like command-type))
|
||||
|~(nail *(like [? command-type]))
|
||||
:: +tab-list: autocomplete options for the session (to match +command-parser)
|
||||
::
|
||||
++ tab-list
|
||||
|~ sole-id=@ta
|
||||
:: (list [@t tank])
|
||||
*(list (option:auto tank))
|
||||
:: +on-command: called when a valid command is run
|
||||
::
|
||||
++ on-command
|
||||
|~ [sole-id=@ta command=command-type]
|
||||
@ -106,9 +112,11 @@
|
||||
|* [shoe=* command-type=mold]
|
||||
|_ =bowl:gall
|
||||
++ command-parser
|
||||
(easy *command-type)
|
||||
|= sole-id=@ta
|
||||
(easy *[? command-type])
|
||||
::
|
||||
++ tab-list
|
||||
|= sole-id=@ta
|
||||
~
|
||||
::
|
||||
++ on-command
|
||||
@ -193,9 +201,9 @@
|
||||
(~(gut by soles) sole-id *sole-share)
|
||||
|^ =^ [cards=(list card) =_cli-state] shoe
|
||||
?- -.dat.act
|
||||
%det [(apply-edit +.dat.act) shoe]
|
||||
%det (apply-edit +.dat.act)
|
||||
%clr [[~ cli-state] shoe]
|
||||
%ret run-command
|
||||
%ret try-command
|
||||
%tab [(tab +.dat.act) shoe]
|
||||
==
|
||||
:- (deal cards)
|
||||
@ -208,15 +216,19 @@
|
||||
::
|
||||
++ apply-edit
|
||||
|= =sole-change
|
||||
^- (quip card _cli-state)
|
||||
^+ [[*(list card) cli-state] shoe]
|
||||
=^ inverse cli-state
|
||||
(~(transceive sole cli-state) sole-change)
|
||||
:: res: & for fully parsed, | for parsing failure at location
|
||||
::
|
||||
=/ res=(each (unit) @ud)
|
||||
=/ res=(each (unit [run=? cmd=command-type]) @ud)
|
||||
%+ rose (tufa buf.cli-state)
|
||||
(command-parser:og sole-id)
|
||||
?: ?=(%& -.res) [~ cli-state]
|
||||
?: ?=(%& -.res)
|
||||
?. &(?=(^ p.res) run.u.p.res)
|
||||
[[~ cli-state] shoe]
|
||||
(run-command cmd.u.p.res)
|
||||
:_ shoe
|
||||
:: parsing failed
|
||||
::
|
||||
?. &(?=(%del -.inverse) =(+(p.inverse) (lent buf.cli-state)))
|
||||
@ -234,14 +246,18 @@
|
||||
[%err p.res] :: cursor to error location
|
||||
==
|
||||
::
|
||||
++ run-command
|
||||
++ try-command
|
||||
^+ [[*(list card) cli-state] shoe]
|
||||
=/ cmd=(unit command-type)
|
||||
=/ res=(unit [? cmd=command-type])
|
||||
%+ rust (tufa buf.cli-state)
|
||||
(command-parser:og sole-id)
|
||||
?~ cmd
|
||||
[[[(effect %bel ~)]~ cli-state] shoe]
|
||||
=^ cards shoe (on-command:og sole-id u.cmd)
|
||||
?^ res (run-command cmd.u.res)
|
||||
[[[(effect %bel ~)]~ cli-state] shoe]
|
||||
::
|
||||
++ run-command
|
||||
|= cmd=command-type
|
||||
^+ [[*(list card) cli-state] shoe]
|
||||
=^ cards shoe (on-command:og sole-id cmd)
|
||||
:: clear buffer
|
||||
::
|
||||
=^ clear cli-state (~(transmit sole cli-state) [%set ~])
|
||||
@ -251,7 +267,6 @@
|
||||
[%det clear]
|
||||
==
|
||||
::
|
||||
::NOTE cargo-culted
|
||||
++ tab
|
||||
|= pos=@ud
|
||||
^- (quip card _cli-state)
|
||||
@ -271,7 +286,9 @@
|
||||
%+ add pos
|
||||
(met 3 (fall forward ''))
|
||||
=| cards=(list card)
|
||||
=? cards ?=(^ options)
|
||||
:: only render the option list if we couldn't complete anything
|
||||
::
|
||||
=? cards &(?=(~ to-send) ?=(^ options))
|
||||
[(effect %tab options) cards]
|
||||
|- ^- (quip card _cli-state)
|
||||
?~ to-send
|
||||
|
@ -1,7 +1,7 @@
|
||||
:: link: subscription updates
|
||||
::
|
||||
::TODO this should include json conversion once mark performance improves
|
||||
/+ *link
|
||||
/+ *link-store
|
||||
|_ =action
|
||||
++ grow
|
||||
|%
|
||||
@ -11,6 +11,6 @@
|
||||
++ grab
|
||||
|%
|
||||
++ noun ^action
|
||||
++ json action:de-json
|
||||
++ json action:dejs
|
||||
--
|
||||
--
|
||||
|
@ -1,6 +1,6 @@
|
||||
:: link: initial subscription result
|
||||
::
|
||||
/- *link
|
||||
/- *link-store
|
||||
|_ =initial
|
||||
++ grow
|
||||
|%
|
||||
|
@ -1,6 +1,6 @@
|
||||
:: link: subscription updates
|
||||
::
|
||||
/- *link
|
||||
/- *link-store
|
||||
|_ =update
|
||||
++ grow
|
||||
|%
|
||||
|
@ -1,9 +1,9 @@
|
||||
/- *link-view
|
||||
=, dejs:format
|
||||
|_ act=view-action
|
||||
|_ act=action
|
||||
++ grab
|
||||
|%
|
||||
++ noun view-action
|
||||
++ noun action
|
||||
++ json
|
||||
|^ %- of
|
||||
:~ %create^create
|
||||
|
@ -31,7 +31,7 @@
|
||||
++ old-parser
|
||||
;~ plug
|
||||
(key-val (jest 'owner: ~') fed:ag)
|
||||
(key-val (jest 'title: ') (cook crip (star qit)))
|
||||
(key-val (jest 'title: ') (cook crip (star prn)))
|
||||
(key-val (jest 'filename: ') sym)
|
||||
%+ key-val (jest 'comments: ')
|
||||
;~(pose (jest %open) (jest %closed) (jest %none))
|
||||
@ -45,8 +45,8 @@
|
||||
==
|
||||
++ new-parser
|
||||
;~ plug
|
||||
(key-val (jest 'title: ') (cook crip (star qit)))
|
||||
(key-val (jest 'description: ') (cook crip (star qit)))
|
||||
(key-val (jest 'title: ') (cook crip (star prn)))
|
||||
(key-val (jest 'description: ') (cook crip (star prn)))
|
||||
%+ key-val (jest 'comments: ')
|
||||
(cook |=(a=@ =(%on a)) ;~(pose (jest %on) (jest %off)))
|
||||
(key-val (jest 'writers: ') ;~(pfix net (more net urs:ab)))
|
||||
|
50
pkg/arvo/sur/link-store.hoon
Normal file
50
pkg/arvo/sur/link-store.hoon
Normal file
@ -0,0 +1,50 @@
|
||||
:: link-store: store specific types
|
||||
::
|
||||
/- *link
|
||||
^?
|
||||
|%
|
||||
::
|
||||
:: +action: local actions
|
||||
::
|
||||
+$ action
|
||||
$% :: user actions
|
||||
::
|
||||
:: %save: save page to path on our ship
|
||||
::
|
||||
[%save =path title=@t =url]
|
||||
:: %note: save a note for a url
|
||||
::
|
||||
[%note =path =url udon=@t]
|
||||
:: %seen: mark item as read (~ for all in path)
|
||||
::
|
||||
[%seen =path url=(unit url)]
|
||||
:: hook actions
|
||||
::
|
||||
:: %hear: hear about page at path on other ship
|
||||
::
|
||||
[%hear =path submission]
|
||||
:: %read: hear about note on url from ship
|
||||
::
|
||||
[%read =path =url comment]
|
||||
==
|
||||
::
|
||||
:: +initial: local result
|
||||
::
|
||||
+$ initial
|
||||
$% [%local-pages pages=(map path pages)]
|
||||
[%submissions submissions=(map path submissions)]
|
||||
[%annotations notes=(per-path-url notes)]
|
||||
[%discussions comments=(per-path-url comments)]
|
||||
==
|
||||
:: +update: local updates
|
||||
::
|
||||
::NOTE we include paths/urls to support the "subscribed to all" case
|
||||
::
|
||||
+$ update
|
||||
$% [%local-pages =path =pages]
|
||||
[%submissions =path =submissions]
|
||||
[%annotations =path =url =notes]
|
||||
[%discussions =path =url =comments]
|
||||
[%observation =path urls=(set url)]
|
||||
==
|
||||
--
|
@ -1,7 +1,7 @@
|
||||
:: link-view: encapsulating link management
|
||||
::
|
||||
|%
|
||||
++ view-action
|
||||
++ action
|
||||
$% :: %create: create a new link collection
|
||||
::
|
||||
:: with specified metadata and group. %ships creates a new group,
|
||||
|
@ -46,48 +46,4 @@
|
||||
++ per-path-url
|
||||
|$ [value]
|
||||
(map path (map url value))
|
||||
::
|
||||
:: +action: local actions
|
||||
::
|
||||
+$ action
|
||||
$% :: user actions
|
||||
::
|
||||
:: %save: save page to path on our ship
|
||||
::
|
||||
[%save =path title=@t =url]
|
||||
:: %note: save a note for a url
|
||||
::
|
||||
[%note =path =url udon=@t]
|
||||
:: %seen: mark item as read (~ for all in path)
|
||||
::
|
||||
[%seen =path url=(unit url)]
|
||||
:: hook actions
|
||||
::
|
||||
:: %hear: hear about page at path on other ship
|
||||
::
|
||||
[%hear =path submission]
|
||||
:: %read: hear about note on url from ship
|
||||
::
|
||||
[%read =path =url comment]
|
||||
==
|
||||
::
|
||||
:: +initial: local result
|
||||
::
|
||||
+$ initial
|
||||
$% [%local-pages pages=(map path pages)]
|
||||
[%submissions submissions=(map path submissions)]
|
||||
[%annotations notes=(per-path-url notes)]
|
||||
[%discussions comments=(per-path-url comments)]
|
||||
==
|
||||
:: +update: local updates
|
||||
::
|
||||
::NOTE we include paths/urls to support the "subscribed to all" case
|
||||
::
|
||||
+$ update
|
||||
$% [%local-pages =path =pages]
|
||||
[%submissions =path =submissions]
|
||||
[%annotations =path =url =notes]
|
||||
[%discussions =path =url =comments]
|
||||
[%observation =path urls=(set url)]
|
||||
==
|
||||
--
|
||||
|
@ -33,7 +33,7 @@ export class SearchableList extends Component {
|
||||
|
||||
let items = props.items.filter(item => {
|
||||
return state.query.split(' ').reduce((match, query) => {
|
||||
return match && item.key.includes(query);
|
||||
return match && ('' + item.key).includes(query);
|
||||
}, true);
|
||||
})
|
||||
items = items.map(item =>
|
||||
@ -46,4 +46,4 @@ export class SearchableList extends Component {
|
||||
<div>{items.length === 0 ? 'none' : items}</div>
|
||||
</div>);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user