2019-05-09 09:59:51 +03:00
|
|
|
/- lens
|
2019-04-30 23:38:40 +03:00
|
|
|
/+ *server
|
2019-05-09 09:59:51 +03:00
|
|
|
/= lens-mark /: /===/mar/lens/command
|
|
|
|
/!noun/
|
2019-04-30 23:38:40 +03:00
|
|
|
=, format
|
|
|
|
|%
|
|
|
|
:: +move: output effect
|
|
|
|
::
|
|
|
|
+$ move [bone card]
|
|
|
|
:: +card: output effect payload
|
|
|
|
::
|
|
|
|
+$ card
|
2019-07-04 09:09:44 +03:00
|
|
|
$% [%connect wire binding:eyre term]
|
2019-04-30 23:38:40 +03:00
|
|
|
[%http-response =http-event:http]
|
2019-05-09 09:59:51 +03:00
|
|
|
[%peel wire dock mark path]
|
2019-04-30 23:38:40 +03:00
|
|
|
[%poke wire dock poke]
|
2019-05-09 09:59:51 +03:00
|
|
|
[%pull wire dock ~]
|
2019-04-30 23:38:40 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
+$ poke
|
2019-05-09 09:59:51 +03:00
|
|
|
$% [%lens-command command:lens]
|
2019-04-30 23:38:40 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
+$ state
|
2019-05-09 09:59:51 +03:00
|
|
|
$% $: %0
|
|
|
|
job=(unit [=bone com=command:lens])
|
2019-04-30 23:38:40 +03:00
|
|
|
==
|
|
|
|
==
|
|
|
|
::
|
|
|
|
--
|
|
|
|
::
|
2019-05-09 09:59:51 +03:00
|
|
|
|_ [bow=bowl:gall state=state]
|
2019-04-30 23:38:40 +03:00
|
|
|
::
|
|
|
|
++ this .
|
|
|
|
::
|
|
|
|
++ prep
|
|
|
|
|= old=(unit *)
|
|
|
|
^- (quip move _this)
|
|
|
|
[~ this]
|
|
|
|
::
|
|
|
|
:: alerts us that we were bound. we need this because the vane calls back.
|
|
|
|
::
|
|
|
|
++ bound
|
2019-07-04 09:09:44 +03:00
|
|
|
|= [wir=wire success=? binding=binding:eyre]
|
2019-04-30 23:38:40 +03:00
|
|
|
^- (quip move _this)
|
|
|
|
[~ this]
|
|
|
|
::
|
|
|
|
++ poke-handle-http-request
|
|
|
|
%- (require-authorization:app ost.bow move this)
|
2019-07-04 09:09:44 +03:00
|
|
|
|= =inbound-request:eyre
|
2019-04-30 23:38:40 +03:00
|
|
|
^- (quip move _this)
|
2019-05-09 09:59:51 +03:00
|
|
|
?^ job.state
|
|
|
|
:_ this
|
|
|
|
[ost.bow %http-response %start [%500 ~] ~ %.y]~
|
2019-04-30 23:38:40 +03:00
|
|
|
::
|
|
|
|
=/ request-line (parse-request-line url.request.inbound-request)
|
|
|
|
=/ site (flop site.request-line)
|
|
|
|
::
|
2019-05-09 09:59:51 +03:00
|
|
|
=/ jon=json
|
|
|
|
(need (de-json:html q:(need body.request.inbound-request)))
|
|
|
|
=/ com=command:lens
|
|
|
|
(json:grab:lens-mark jon)
|
|
|
|
:_ this(job.state (some [ost.bow com]))
|
|
|
|
[ost.bow %peel /sole [our.bow %dojo] %lens-json /sole]~
|
|
|
|
::
|
|
|
|
++ diff-lens-json
|
|
|
|
|= [=wire jon=json]
|
|
|
|
^- (quip move _this)
|
|
|
|
?~ jon
|
|
|
|
[~ this]
|
|
|
|
?> ?=(^ job.state)
|
|
|
|
:_ this(job.state ~)
|
|
|
|
[bone.u.job.state %http-response (json-response:app (json-to-octs jon))]~
|
|
|
|
::
|
|
|
|
++ quit
|
|
|
|
|= =wire
|
|
|
|
^- (quip move _this)
|
|
|
|
~& [%quit wire]
|
|
|
|
[~ this]
|
|
|
|
::
|
|
|
|
++ reap
|
|
|
|
|= [=wire saw=(unit tang)]
|
|
|
|
^- (quip move _this)
|
|
|
|
?^ saw
|
|
|
|
[((slog u.saw) ~) this]
|
|
|
|
?> ?=(^ job.state)
|
2019-04-30 23:38:40 +03:00
|
|
|
:_ this
|
2019-05-09 09:59:51 +03:00
|
|
|
:~ [ost.bow %poke /sole [our.bow %dojo] %lens-command com.u.job.state]
|
|
|
|
[ost.bow %pull /sole [our.bow %dojo] ~]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ coup
|
|
|
|
|= [=wire saw=(unit tang)]
|
|
|
|
^- (quip move _this)
|
|
|
|
?^ saw
|
|
|
|
[((slog u.saw) ~) this]
|
|
|
|
[~ this]
|
2019-04-30 23:38:40 +03:00
|
|
|
::
|
|
|
|
:: +poke-handle-http-cancel: received when a connection was killed
|
|
|
|
::
|
|
|
|
++ poke-handle-http-cancel
|
2019-07-04 09:09:44 +03:00
|
|
|
|= =inbound-request:eyre
|
2019-04-30 23:38:40 +03:00
|
|
|
^- (quip move _this)
|
|
|
|
:: the only long lived connections we keep state about are the stream ones.
|
|
|
|
::
|
|
|
|
[~ this]
|
|
|
|
::
|
|
|
|
++ poke-noun
|
|
|
|
|= a=*
|
|
|
|
^- (quip move _this)
|
|
|
|
~& poke+a
|
|
|
|
[~ this]
|
|
|
|
::
|
|
|
|
--
|