mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-18 12:22:10 +03:00
move ++lens logic out into stateless core
This commit is contained in:
parent
1511ca501c
commit
d6bb4e234d
118
arvo/eyre.hoon
118
arvo/eyre.hoon
@ -79,7 +79,8 @@
|
|||||||
{$hi p/knot q/mark $~} :: outbound HTTP
|
{$hi p/knot q/mark $~} :: outbound HTTP
|
||||||
{$se p/whir-se q/{iden (list @t)}} :: outbound to domain
|
{$se p/whir-se q/{iden (list @t)}} :: outbound to domain
|
||||||
{$si $~} :: response done
|
{$si $~} :: response done
|
||||||
{$of p/ixor q/$@($~ ?(whir-of whir-off))} :: associated view
|
{$le $~} :: stateless lens req
|
||||||
|
{$of p/ixor q/$@($~ whir-of)} :: associated view
|
||||||
{$ow p/ixor $~} :: dying view
|
{$ow p/ixor $~} :: dying view
|
||||||
{$on $~} :: dependency
|
{$on $~} :: dependency
|
||||||
{$je p/whir-je}
|
{$je p/whir-je}
|
||||||
@ -90,8 +91,7 @@
|
|||||||
{$liv p/hole q/ixor $~}
|
{$liv p/hole q/ixor $~}
|
||||||
==
|
==
|
||||||
++ whir-ac {p/?($$ hole) q/mend r/$@($~ {p/@t $~})} :: auth? filter cookie?
|
++ whir-ac {p/?($$ hole) q/mend r/$@($~ {p/@t $~})} :: auth? filter cookie?
|
||||||
++ whir-of {p/knot:ship q/term $mess s/wire} :: path in dock
|
++ whir-of {p/knot:ship q/term s/wire} :: path in dock
|
||||||
++ whir-off {p/knot:ship q/term $lens s/wire} :: path in dock
|
|
||||||
++ whir-se ?($core vi-arm) :: build/call
|
++ whir-se ?($core vi-arm) :: build/call
|
||||||
++ vi-arm
|
++ vi-arm
|
||||||
$? $filter-request :: ++out mod request
|
$? $filter-request :: ++out mod request
|
||||||
@ -204,8 +204,7 @@
|
|||||||
?~ quy [%$ %n ~]~
|
?~ quy [%$ %n ~]~
|
||||||
[[%$ %t p.i.quy] [%$ %t q.i.quy] $(quy t.quy)]
|
[[%$ %t p.i.quy] [%$ %t q.i.quy] $(quy t.quy)]
|
||||||
::
|
::
|
||||||
++ gsig |=({a/dock b/$mess c/path} [(scot %p p.a) q.a b c])
|
++ gsig |=({a/dock b/path} [(scot %p p.a) q.a b])
|
||||||
++ gsig-lens |=({a/dock b/$lens c/path} [(scot %p p.a) q.a b c])
|
|
||||||
++ session-from-cookies
|
++ session-from-cookies
|
||||||
|= {nam/@t maf/math}
|
|= {nam/@t maf/math}
|
||||||
^- (unit hole)
|
^- (unit hole)
|
||||||
@ -763,7 +762,7 @@
|
|||||||
==
|
==
|
||||||
=. p.p.pul |(p.p.pul ?=(hoke r.p.pul))
|
=. p.p.pul |(p.p.pul ?=(hoke r.p.pul))
|
||||||
?: ?=($chis -.kyz) :: IPC escape hatch
|
?: ?=($chis -.kyz) :: IPC escape hatch
|
||||||
~(lens handle pul [q.+.kyz |] [p.heq maf s.heq])
|
~(as-lens handle pul [q.+.kyz |] [p.heq maf s.heq])
|
||||||
=+ her=(host-to-ship r.p.pul)
|
=+ her=(host-to-ship r.p.pul)
|
||||||
?: |(?=($~ her) =(our u.her))
|
?: |(?=($~ her) =(our u.her))
|
||||||
~(apex handle pul [q.+.kyz |] [p.heq maf s.heq])
|
~(apex handle pul [q.+.kyz |] [p.heq maf s.heq])
|
||||||
@ -901,26 +900,27 @@
|
|||||||
==
|
==
|
||||||
::
|
::
|
||||||
$unto :: app response
|
$unto :: app response
|
||||||
?> ?=({$of @ ^} tee)
|
?> ?=($%({$le $~} {$of @ ^}) tee)
|
||||||
=+ cuf=`cuft`+>.sih
|
=+ cuf=`cuft`+>.sih
|
||||||
?- -.cuf
|
?- -.cuf
|
||||||
?($coup $reap)
|
?($coup $reap)
|
||||||
?: ?=($lens &3.q.tee)
|
=/ ack ?~(p.cuf ~ `[-.cuf u.p.cuf])
|
||||||
(ack-lens:(ire-ix p.tee) ?~(p.cuf ~ `[-.cuf u.p.cuf]))
|
?: ?=($le -.tee) (~(get-ack lens ~) ack)
|
||||||
(get-ack:(ire-ix p.tee) q.tee ?~(p.cuf ~ `[-.cuf u.p.cuf]))
|
(get-ack:(ire-ix p.tee) q.tee ack)
|
||||||
::
|
::
|
||||||
$doff !!
|
$doff !!
|
||||||
$diff
|
$diff
|
||||||
?. ?=($json p.p.cuf)
|
?. ?=($json p.p.cuf)
|
||||||
:: ~> %slog.`%*(. >[%backing p.p.cuf %q-p-cuf]< &3.+> (sell q.p.cuf))
|
:: ~> %slog.`%*(. >[%backing p.p.cuf %q-p-cuf]< &3.+> (sell q.p.cuf))
|
||||||
(back tee %json p.cuf)
|
(back tee %json p.cuf)
|
||||||
?: ?=($lens &3.q.tee)
|
=/ jon ((hard json) q.q.p.cuf)
|
||||||
(get-lens:(ire-ix p.tee) q.tee ((hard json) q.q.p.cuf))
|
?: ?=($le -.tee) (~(get-diff lens ~) jon)
|
||||||
(get-rush:(ire-ix p.tee) q.tee ((hard json) q.q.p.cuf))
|
(get-rush:(ire-ix p.tee) q.tee jon)
|
||||||
::
|
::
|
||||||
$quit
|
$quit
|
||||||
?: ?=($lens &3.q.tee) (give-json 500 ~ (joba %quit b+&))
|
~& quit+tee
|
||||||
~&(quit+tee (get-quit:(ire-ix p.tee) q.tee))
|
?: ?=($le -.tee) ~(get-quit lens ~)
|
||||||
|
(get-quit:(ire-ix p.tee) q.tee)
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
$wake
|
$wake
|
||||||
@ -969,14 +969,17 @@
|
|||||||
:: =* cay p.q.sih
|
:: =* cay p.q.sih
|
||||||
:: ?> ?=($hiss p.cay)
|
:: ?> ?=($hiss p.cay)
|
||||||
:: (eyre-them p.tee q.cay)
|
:: (eyre-them p.tee q.cay)
|
||||||
|
::
|
||||||
|
{$le $~}
|
||||||
|
?: ?=($| -.q.sih)
|
||||||
|
((slog p.q.sih) +>.$) :: XX get-ack (some)?
|
||||||
|
%- ~(get-diff lens ~)
|
||||||
|
?> ?=($json p.p.q.sih) :: XX others
|
||||||
|
((hard json) q.q.p.q.sih)
|
||||||
::
|
::
|
||||||
{$of @ ^}
|
{$of @ ^}
|
||||||
?: ?=($| -.q.sih)
|
?: ?=($| -.q.sih)
|
||||||
((slog p.q.sih) +>.$) :: XX get-even %mean
|
((slog p.q.sih) +>.$) :: XX get-even %mean
|
||||||
?: ?=($lens &3.q.tee)
|
|
||||||
%+ get-lens:(ire-ix p.tee) q.tee
|
|
||||||
?> ?=($json p.p.q.sih) :: XX others
|
|
||||||
((hard json) q.q.p.q.sih)
|
|
||||||
%+ get-rush:(ire-ix p.tee) q.tee
|
%+ get-rush:(ire-ix p.tee) q.tee
|
||||||
?> ?=($json p.p.q.sih) :: XX others
|
?> ?=($json p.p.q.sih) :: XX others
|
||||||
((hard json) q.q.p.q.sih)
|
((hard json) q.q.p.q.sih)
|
||||||
@ -1201,12 +1204,10 @@
|
|||||||
?: ?=($| -.pez) p.pez
|
?: ?=($| -.pez) p.pez
|
||||||
(resolve ~ p.pez)
|
(resolve ~ p.pez)
|
||||||
::
|
::
|
||||||
++ lens
|
++ as-lens
|
||||||
=< abet
|
=< abet
|
||||||
:: (process-parsed [%mess [our %dojo] %lens-command /lens (need grab-json)])
|
:: (process-parsed [%mess [our %dojo] %lens-command /lens (need grab-json)])
|
||||||
=^ orx ..ya new-view:(for-authed-client our)
|
((teba ~(new lens ~)) (need grab-json))
|
||||||
=+ vew=(ire-ix (oryx-to-ixor orx))
|
|
||||||
((teba new-lens.vew) (need grab-json))
|
|
||||||
::
|
::
|
||||||
++ resolve
|
++ resolve
|
||||||
|= {cug/(list @t) pez/pest} ^+ done
|
|= {cug/(list @t) pez/pest} ^+ done
|
||||||
@ -1661,7 +1662,7 @@
|
|||||||
++ give-json (teba ^give-json)
|
++ give-json (teba ^give-json)
|
||||||
++ pass-note (teba ^pass-note)
|
++ pass-note (teba ^pass-note)
|
||||||
++ hurl-note
|
++ hurl-note
|
||||||
|= {a/{dock $mess path} b/note} ^+ ..ix
|
|= {a/{dock path} b/note} ^+ ..ix
|
||||||
=: med (~(put to med) hen)
|
=: med (~(put to med) hen)
|
||||||
hen `~
|
hen `~
|
||||||
==
|
==
|
||||||
@ -1681,47 +1682,26 @@
|
|||||||
|= a/even ^+ eve
|
|= a/even ^+ eve
|
||||||
[+(p.eve) (~(put by q.eve) p.eve a)]
|
[+(p.eve) (~(put by q.eve) p.eve a)]
|
||||||
::
|
::
|
||||||
++ new-lens
|
|
||||||
|= jon/json ^+ ..ix
|
|
||||||
=. +>.$
|
|
||||||
%+ pass-note
|
|
||||||
[%of ire (gsig-lens [our %dojo] lens+/)]
|
|
||||||
[%g %deal [our our] %dojo %peel %lens-json /sole]
|
|
||||||
=. +>.$
|
|
||||||
%+ pass-note
|
|
||||||
[%of ire (gsig-lens [our %dojo] lens+/)]
|
|
||||||
[%g %deal [our our] %dojo %punk %lens-command %json !>(`json`jon)]
|
|
||||||
abet
|
|
||||||
::
|
|
||||||
++ new-mess
|
++ new-mess
|
||||||
|= {a/dock b/mark c/wire d/cage} ^+ ..ix
|
|= {a/dock b/mark c/wire d/cage} ^+ ..ix
|
||||||
(hurl-note [a mess+c] [%g %deal [him -.a] +.a %punk b d])
|
(hurl-note [a c] [%g %deal [him -.a] +.a %punk b d])
|
||||||
::
|
::
|
||||||
++ add-subs
|
++ add-subs
|
||||||
|= {a/dock $json b/wire c/path} ^+ ..ix
|
|= {a/dock $json b/wire c/path} ^+ ..ix
|
||||||
?: (~(has in sus) +<) ~|(duplicate+c !!)
|
?: (~(has in sus) +<) ~|(duplicate+c !!)
|
||||||
=. sus (~(put in sus) +<)
|
=. sus (~(put in sus) +<)
|
||||||
(hurl-note [a mess+b] [%g %deal [him -.a] +.a %peel %json c])
|
(hurl-note [a b] [%g %deal [him -.a] +.a %peel %json c])
|
||||||
::
|
::
|
||||||
++ pul-subs
|
++ pul-subs
|
||||||
|= {a/dock $json b/wire c/path} ^+ ..ix
|
|= {a/dock $json b/wire c/path} ^+ ..ix
|
||||||
=. sus (~(del in sus) +<)
|
=. sus (~(del in sus) +<)
|
||||||
(hurl-note [a mess+b] [%g %deal [him -.a] +.a %pull ~])
|
(hurl-note [a b] [%g %deal [him -.a] +.a %pull ~])
|
||||||
::
|
::
|
||||||
++ del-subs :: XX per path?
|
++ del-subs :: XX per path?
|
||||||
|= {a/dock $json b/wire c/path} ^+ ..ix
|
|= {a/dock $json b/wire c/path} ^+ ..ix
|
||||||
=. ..ix (pul-subs +<)
|
=. ..ix (pul-subs +<)
|
||||||
(nice-json:pop-duct:(ire-ix ire)) :: XX gall ack
|
(nice-json:pop-duct:(ire-ix ire)) :: XX gall ack
|
||||||
::
|
::
|
||||||
++ get-lens
|
|
||||||
|= {a/whir-off fec/json} ^+ ..ix
|
|
||||||
?~ fec ..ix :: nulled event we don't care about
|
|
||||||
=. +>.$
|
|
||||||
%+ pass-note
|
|
||||||
`whir`[%of ire (gsig-lens [our %dojo] lens+/)]
|
|
||||||
`note`[%g %deal [our our] %dojo %pull ~]
|
|
||||||
abet:(give-json 200 ~ fec)
|
|
||||||
::
|
|
||||||
++ get-rush
|
++ get-rush
|
||||||
|= {a/whir-of b/json} ^+ ..ix
|
|= {a/whir-of b/json} ^+ ..ix
|
||||||
(get-even [%rush [[(slav %p p.a) q.a] s.a] (joba %json b)])
|
(get-even [%rush [[(slav %p p.a) q.a] s.a] (joba %json b)])
|
||||||
@ -1736,14 +1716,6 @@
|
|||||||
?~ b (nice-json:pop-duct)
|
?~ b (nice-json:pop-duct)
|
||||||
(mean-json:pop-duct 500 b)
|
(mean-json:pop-duct 500 b)
|
||||||
::
|
::
|
||||||
++ ack-lens
|
|
||||||
|= a/(unit (pair term tang)) ^+ ..ix
|
|
||||||
?~ a
|
|
||||||
..ix :: (give-json 200 ~ (joba %okey-dokey %b &))
|
|
||||||
=+ tag=(flop `tang`[>[%eyre-lens-fail p.u.a]< q.u.a])
|
|
||||||
%- (slog tag)
|
|
||||||
abet:(give-json 500 ~ (jape (wush 160 tag)))
|
|
||||||
::
|
|
||||||
++ get-even
|
++ get-even
|
||||||
|= ven/even ^+ ..ix
|
|= ven/even ^+ ..ix
|
||||||
=+ num=p.eve
|
=+ num=p.eve
|
||||||
@ -1767,7 +1739,7 @@
|
|||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ pass-took
|
++ pass-took
|
||||||
|= a/{p/dock $mess wire}
|
|= a/{p/dock wire}
|
||||||
%+ pass-note(hen `~)
|
%+ pass-note(hen `~)
|
||||||
[%of ire (gsig a)]
|
[%of ire (gsig a)]
|
||||||
[%g %deal [him -.p.a] +.p.a %pump ~]
|
[%g %deal [him -.p.a] +.p.a %pump ~]
|
||||||
@ -1813,6 +1785,38 @@
|
|||||||
(give-json:abet(pol ~, hen u.pol) 200 ~ (joba %beat %b &))
|
(give-json:abet(pol ~, hen u.pol) 200 ~ (joba %beat %b &))
|
||||||
==
|
==
|
||||||
--
|
--
|
||||||
|
++ lens :: urb.py engine
|
||||||
|
=/ him our :: XX other uses?
|
||||||
|
|_ $~ :: XX stateful?
|
||||||
|
++ abet ..lens
|
||||||
|
++ new
|
||||||
|
|= jon/json ^+ ..lens
|
||||||
|
=. ..lens
|
||||||
|
%+ pass-note [%le ~]
|
||||||
|
[%g %deal [him our] %dojo %peel %lens-json /sole]
|
||||||
|
=. ..lens
|
||||||
|
%+ pass-note [%le ~]
|
||||||
|
[%g %deal [him our] %dojo %punk %lens-command %json !>(`json`jon)]
|
||||||
|
abet
|
||||||
|
::
|
||||||
|
++ get-ack
|
||||||
|
|= a/(unit (pair term tang)) ^+ ..lens
|
||||||
|
?~ a
|
||||||
|
..lens :: (give-json 200 ~ (joba %okey-dokey %b &))
|
||||||
|
=+ tag=(flop `tang`[>[%eyre-lens-fail p.u.a]< q.u.a])
|
||||||
|
%- (slog tag)
|
||||||
|
(give-json:abet 500 ~ (jape (wush 160 tag)))
|
||||||
|
::
|
||||||
|
++ get-diff
|
||||||
|
|= fec/json ^+ ..lens
|
||||||
|
?~ fec ..lens :: nulled event we don't care about
|
||||||
|
=. ..lens
|
||||||
|
%+ pass-note [%le ~]
|
||||||
|
`note`[%g %deal [him our] %dojo %pull ~]
|
||||||
|
(give-json:abet 200 ~ fec)
|
||||||
|
::
|
||||||
|
++ get-quit (give-json:abet 500 ~ (joba %quit b+&))
|
||||||
|
--
|
||||||
++ vi :: auth engine
|
++ vi :: auth engine
|
||||||
~% %eyre-v ..is ~
|
~% %eyre-v ..is ~
|
||||||
|_ $: {usr/iden dom/path}
|
|_ $: {usr/iden dom/path}
|
||||||
|
Loading…
Reference in New Issue
Block a user