refactor: use event-buffer for state sync resyncs

This commit is contained in:
Adhiraj Singh
2022-06-27 14:51:26 +05:30
parent 7421f55daa
commit eaf0f37d24
5 changed files with 68 additions and 130 deletions

View File

@@ -1,7 +1,6 @@
import type { proto } from '../../WAProto'
import type { AccountSettings, AuthenticationCreds } from './Auth'
import { Contact } from './Contact'
import type { MinimalMessage, WAMessageUpdate } from './Message'
import type { AccountSettings } from './Auth'
import type { MinimalMessage } from './Message'
/** set of statuses visible to other people; see updatePresence() in WhatsAppWeb.Send */
export type WAPresence = 'unavailable' | 'available' | 'composing' | 'recording' | 'paused'
@@ -26,20 +25,6 @@ export type ChatMutation = {
index: string[]
}
export type SyncActionUpdates = {
credsUpdates: Partial<AuthenticationCreds>
chatUpdates: { [jid: string]: Partial<Chat> }
chatDeletes: string[]
contactUpserts: { [jid: string]: Contact }
msgUpdates: { [jid: string]: WAMessageUpdate }
msgDeletes: proto.IMessageKey[]
}
export type AppStateChunk = {
updates: SyncActionUpdates
collectionsToHandle: WAPatchName[]
}
export type WAPatchCreate = {
syncAction: proto.ISyncActionValue
index: string[]