chat-store: added in chat-history changes

This commit is contained in:
Logan Allen 2019-11-22 14:04:36 -08:00
parent 4d1457bbaa
commit 8b63aeb865
3 changed files with 19 additions and 53 deletions

View File

@ -2,7 +2,7 @@
::
/+ *chat-json, *chat-eval, default-agent
|%
+$ card card:agent:gall
+$ card card:agent:gall
+$ versioned-state
$% state-zero
==
@ -16,7 +16,6 @@
$% [%chat-initial inbox]
[%chat-configs chat-configs]
[%chat-update chat-update]
[%chat-two-update chat-two-update]
==
--
::
@ -199,7 +198,7 @@
|- ^- (quip card _state)
?~ envelopes.act
:_ state(inbox (~(put by inbox) path.act u.mailbox))
%+ send-two-diff path.act
%+ send-diff path.act
:* %messages
path.act
(sub length.config.u.mailbox (lent evaluated-envelopes))
@ -210,7 +209,7 @@
=. evaluated-envelopes (snoc evaluated-envelopes i.envelopes.act)
=. u.mailbox (append-envelope u.mailbox i.envelopes.act)
$(envelopes.act t.envelopes.act)
::
::
++ handle-read
|= act=chat-action
^- (quip card _state)
@ -240,9 +239,9 @@
mailbox
::
++ update-subscribers
|= [pax=path act=chat-update]
|= [pax=path update=chat-update]
^- (list card)
[%give %fact `pax %chat-update !>(act)]~
[%give %fact `pax %chat-update !>(update)]~
::
++ send-diff
|= [pax=path upd=chat-update]
@ -258,18 +257,4 @@
~
(update-subscribers /keys upd)
==
::
++ send-two-diff
|= [pax=path upd=chat-two-update]
^- (list card)
%- zing
:~ (update-two-subscribers /all upd)
(update-two-subscribers /updates upd)
(update-two-subscribers [%mailbox pax] upd)
==
::
++ update-two-subscribers
|= [pax=path upd=chat-two-update]
^- (list card)
[%give %fact `pax %chat-two-update !>(upd)]~
--

View File

@ -118,25 +118,6 @@
[%config (conf config.mailbox)]
==
::
++ two-update-to-json
|= upd=chat-two-update
=, enjs:format
^- json
%+ frond %chat-update
%- pairs
:~
?: =(%messages -.upd)
?> ?=(%messages -.upd)
:- %messages
%- pairs
:~ [%path (path path.upd)]
[%start (numb start.upd)]
[%end (numb end.upd)]
[%envelopes [%a (turn envelopes.upd enve)]]
==
[*@t *^json]
==
::
++ update-to-json
|= upd=chat-update
=, enjs:format
@ -144,28 +125,31 @@
%+ frond %chat-update
%- pairs
:~
?: =(%message -.upd)
?> ?=(%message -.upd)
?: ?=(%message -.upd)
:- %message
%- pairs
:~ [%path (path path.upd)]
[%envelope (enve envelope.upd)]
==
?: =(%read -.upd)
?> ?=(%read -.upd)
?: ?=(%messages -.upd)
:- %messages
%- pairs
:~ [%path (path path.upd)]
[%start (numb start.upd)]
[%end (numb end.upd)]
[%envelopes [%a (turn envelopes.upd enve)]]
==
?: ?=(%read -.upd)
[%read (pairs [%path (path path.upd)]~)]
?: =(%create -.upd)
?> ?=(%create -.upd)
?: ?=(%create -.upd)
:- %create
%- pairs
:~ [%ship (ship ship.upd)]
[%path (path path.upd)]
==
?: =(%delete -.upd)
?> ?=(%delete -.upd)
?: ?=(%delete -.upd)
[%delete (pairs [%path (path path.upd)]~)]
?: =(%config -.upd)
?> ?=(%config -.upd)
?: ?=(%config -.upd)
:- %config
%- pairs
:~ [%path (path path.upd)]
@ -270,4 +254,3 @@
(su (perk %channel %village %journal %mailbox ~))
--
--

View File

@ -47,9 +47,7 @@
+$ chat-update
$% [%keys keys=(set path)]
[%config =path =config]
[%messages =path start=@ud end=@ud envelopes=(list envelope)]
chat-base
==
::
+$ chat-two-update
[%messages =path start=@ud end=@ud envelopes=(list envelope)]
--