2020-06-01 21:17:14 +03:00
|
|
|
|
2020-04-30 06:29:06 +03:00
|
|
|
/- sur=chat-store
|
|
|
|
^?
|
|
|
|
=< [sur .]
|
|
|
|
=, sur
|
2020-04-25 06:51:28 +03:00
|
|
|
|%
|
|
|
|
++ enjs
|
|
|
|
=, enjs:format
|
|
|
|
|%
|
|
|
|
::
|
|
|
|
++ letter
|
2020-04-30 02:04:29 +03:00
|
|
|
|= =^letter
|
|
|
|
^- json
|
|
|
|
?- -.letter
|
|
|
|
%text
|
2020-05-01 07:11:49 +03:00
|
|
|
(frond %text s+text.letter)
|
2020-05-20 18:27:28 +03:00
|
|
|
::
|
|
|
|
%me
|
|
|
|
(frond %me s+narrative.letter)
|
2020-04-30 02:04:29 +03:00
|
|
|
::
|
|
|
|
%url
|
2020-05-01 07:11:49 +03:00
|
|
|
(frond %url s+url.letter)
|
2020-04-30 02:04:29 +03:00
|
|
|
::
|
|
|
|
%code
|
2020-05-01 07:11:49 +03:00
|
|
|
%+ frond %code
|
|
|
|
%- pairs
|
2020-05-20 18:27:28 +03:00
|
|
|
:- [%expression s+expression.letter]
|
|
|
|
:_ ~
|
|
|
|
:- %output
|
|
|
|
:: virtualize output rendering, +tank:enjs:format might crash
|
|
|
|
::
|
|
|
|
=/ result=(each (list json) tang)
|
|
|
|
(mule |.((turn output.letter tank)))
|
|
|
|
?- -.result
|
|
|
|
%& a+p.result
|
|
|
|
%| a+[a+[%s '[[output rendering error]]']~]~
|
2020-05-01 07:11:49 +03:00
|
|
|
==
|
2020-04-30 02:04:29 +03:00
|
|
|
==
|
2020-04-25 06:51:28 +03:00
|
|
|
::
|
|
|
|
++ envelope
|
2020-04-29 11:36:12 +03:00
|
|
|
|= =^envelope
|
|
|
|
^- json
|
|
|
|
%- pairs
|
|
|
|
:~ [%uid s+(scot %uv uid.envelope)]
|
|
|
|
[%number (numb number.envelope)]
|
|
|
|
[%author (ship author.envelope)]
|
|
|
|
[%when (time when.envelope)]
|
|
|
|
[%letter (letter letter.envelope)]
|
|
|
|
==
|
2020-04-25 06:51:28 +03:00
|
|
|
::
|
|
|
|
++ config
|
2020-04-29 11:36:12 +03:00
|
|
|
|= =^config
|
|
|
|
^- json
|
|
|
|
%- pairs
|
|
|
|
:~ [%length (numb length.config)]
|
|
|
|
[%read (numb read.config)]
|
|
|
|
==
|
2020-04-25 06:51:28 +03:00
|
|
|
::
|
|
|
|
++ update
|
2020-04-29 11:36:12 +03:00
|
|
|
|= upd=^update
|
|
|
|
^- json
|
|
|
|
%+ frond %chat-update
|
|
|
|
%- pairs
|
2020-08-13 11:05:05 +03:00
|
|
|
:_ ~
|
|
|
|
?- -.upd
|
|
|
|
%initial
|
2020-06-05 00:24:11 +03:00
|
|
|
:- %initial
|
|
|
|
%- pairs
|
|
|
|
%+ turn ~(tap by inbox.upd)
|
|
|
|
|= [pax=^path =mailbox]
|
|
|
|
^- [cord json]
|
|
|
|
:- (spat pax)
|
|
|
|
%- pairs
|
|
|
|
:~ [%envelopes [%a (turn envelopes.mailbox envelope)]]
|
|
|
|
[%config (config config.mailbox)]
|
|
|
|
==
|
2020-08-13 11:05:05 +03:00
|
|
|
::
|
|
|
|
%message
|
|
|
|
:- %message
|
|
|
|
%- pairs
|
|
|
|
:~ [%path (path path.upd)]
|
|
|
|
[%envelope (envelope envelope.upd)]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
%messages
|
|
|
|
:- %messages
|
|
|
|
%- pairs
|
|
|
|
:~ [%path (path path.upd)]
|
|
|
|
[%start (numb start.upd)]
|
|
|
|
[%end (numb end.upd)]
|
|
|
|
[%envelopes [%a (turn envelopes.upd envelope)]]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
%read
|
|
|
|
[%read (pairs [%path (path path.upd)]~)]
|
|
|
|
::
|
|
|
|
%create
|
|
|
|
[%create (pairs [%path (path path.upd)]~)]
|
|
|
|
::
|
|
|
|
%delete
|
|
|
|
[%delete (pairs [%path (path path.upd)]~)]
|
|
|
|
::
|
|
|
|
%keys
|
|
|
|
:- %keys
|
|
|
|
:- %a
|
|
|
|
%+ turn ~(tap by keys.upd)
|
|
|
|
|= pax=^path (path pax)
|
2020-04-29 11:36:12 +03:00
|
|
|
==
|
2020-04-25 06:51:28 +03:00
|
|
|
--
|
|
|
|
++ dejs
|
|
|
|
=, dejs:format
|
|
|
|
|%
|
|
|
|
::
|
|
|
|
++ action
|
|
|
|
|= jon=json
|
|
|
|
^- ^action
|
|
|
|
=< (parse-json jon)
|
|
|
|
|%
|
|
|
|
++ parse-json
|
|
|
|
%- of
|
|
|
|
:~ [%create create]
|
|
|
|
[%delete delete]
|
|
|
|
[%message message]
|
|
|
|
[%messages messages]
|
|
|
|
[%read read]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ create
|
|
|
|
(ot [%path pa]~)
|
|
|
|
::
|
|
|
|
++ delete
|
|
|
|
(ot [%path pa]~)
|
|
|
|
::
|
|
|
|
++ message
|
|
|
|
%- ot
|
|
|
|
:~ [%path pa]
|
|
|
|
[%envelope envelope]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ messages
|
|
|
|
%- ot
|
|
|
|
:~ [%path pa]
|
|
|
|
[%envelopes (ar envelope)]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ read
|
|
|
|
(ot [%path pa] ~)
|
|
|
|
::
|
|
|
|
++ envelope
|
|
|
|
%- ot
|
|
|
|
:~ [%uid serial]
|
|
|
|
[%number ni]
|
|
|
|
[%author (su ;~(pfix sig fed:ag))]
|
|
|
|
[%when di]
|
|
|
|
[%letter letter]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ letter
|
|
|
|
%- of
|
|
|
|
:~ [%text so]
|
|
|
|
[%url so]
|
|
|
|
[%code eval]
|
|
|
|
[%me so]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ serial
|
|
|
|
^- $-(json ^serial)
|
|
|
|
(cu (cury slav %uv) so)
|
|
|
|
::
|
|
|
|
++ re :: recursive reparsers
|
2020-11-26 17:09:31 +03:00
|
|
|
|* [gar=* sef=_|.(fist:dejs-soft:format)]
|
2020-11-25 23:22:55 +03:00
|
|
|
|= jon=json
|
2020-04-25 06:51:28 +03:00
|
|
|
^- (unit _gar)
|
|
|
|
=- ~! gar ~! (need -) -
|
|
|
|
((sef) jon)
|
|
|
|
::
|
|
|
|
++ dank :: tank
|
|
|
|
^- $-(json (unit tank))
|
|
|
|
=, ^? dejs-soft:format
|
|
|
|
%+ re *tank |. ~+
|
|
|
|
%- of :~
|
|
|
|
leaf+sa
|
|
|
|
palm+(ot style+(ot mid+sa cap+sa open+sa close+sa ~) lines+(ar dank) ~)
|
|
|
|
rose+(ot style+(ot mid+sa open+sa close+sa ~) lines+(ar dank) ~)
|
|
|
|
==
|
|
|
|
:: %exp speech
|
|
|
|
++ eval
|
|
|
|
::: extract contents of an %exp speech, evaluating
|
|
|
|
::: the {exp} if there is no {res} yet.
|
|
|
|
::
|
|
|
|
|= a=json
|
|
|
|
^- [cord (list tank)]
|
|
|
|
=, ^? dejs-soft:format
|
|
|
|
=+ exp=((ot expression+so ~) a)
|
|
|
|
%- need
|
|
|
|
?~ exp [~ '' ~]
|
|
|
|
:+ ~ u.exp
|
|
|
|
::NOTE when sending, if output is an empty list, chat-store will evaluate
|
|
|
|
(fall ((ot output+(ar dank) ~) a) ~)
|
|
|
|
::
|
|
|
|
--
|
|
|
|
--
|
2020-04-30 02:04:29 +03:00
|
|
|
::
|
|
|
|
++ eval
|
|
|
|
|= [=bowl:gall =hoon]
|
|
|
|
^- (list tank)
|
|
|
|
=/ fowl=[our=@p now=@da eny=@uvJ]
|
|
|
|
:+ our.bowl
|
|
|
|
now.bowl
|
|
|
|
(shaz (cat 3 (mix [now eny]:bowl) %eny))
|
|
|
|
::
|
|
|
|
=/ subject [fowl ..zuse]
|
|
|
|
=/ minted=(each [=type =nock] (list tank))
|
|
|
|
%- mule |.
|
|
|
|
(~(mint ut -:!>(subject)) %noun hoon)
|
|
|
|
?: ?=(%| -.minted) p.minted
|
|
|
|
=/ =toon
|
|
|
|
(mock [subject nock.p.minted] |=(^ ~))
|
|
|
|
?- -.toon
|
|
|
|
%0 [(sell type.p.minted p.toon) ~]
|
|
|
|
%1 :- leaf+".^ unsupported in chat eval"
|
|
|
|
(turn ;;((list path) p.toon) smyt)
|
|
|
|
%2 [leaf+"crash!" p.toon]
|
|
|
|
==
|
2020-04-25 06:51:28 +03:00
|
|
|
--
|