mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
perf: avoid excess memory usage when syncing state
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import type { proto } from '../../WAProto'
|
||||
import type { AccountSettings } from './Auth'
|
||||
import type { MinimalMessage } from './Message'
|
||||
import type { AccountSettings, AuthenticationCreds } from './Auth'
|
||||
import { Contact } from './Contact'
|
||||
import type { MinimalMessage, WAMessageUpdate } from './Message'
|
||||
|
||||
/** set of statuses visible to other people; see updatePresence() in WhatsAppWeb.Send */
|
||||
export type WAPresence = 'unavailable' | 'available' | 'composing' | 'recording' | 'paused'
|
||||
@@ -25,7 +26,19 @@ export type ChatMutation = {
|
||||
index: string[]
|
||||
}
|
||||
|
||||
export type AppStateChunk = { totalMutations : ChatMutation[], collectionsToHandle: WAPatchName[] }
|
||||
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
|
||||
@@ -76,7 +89,6 @@ export type ChatModification =
|
||||
} |
|
||||
{ delete: true, lastMessages: LastMessageList }
|
||||
|
||||
|
||||
export type InitialReceivedChatsState = {
|
||||
[jid: string]: { lastMsgRecvTimestamp: number }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user