/** * @prettier */ import { Attachment } from './Attachment'; import { IndexableBoolean } from './IndexedDB'; export type Message = IncomingMessage | OutgoingMessage | VerifiedChangeMessage; export type IncomingMessage = Readonly< { type: 'incoming'; // Required attachments: Array; id: string; received_at: number; // Optional body?: string; decrypted_at?: number; errors?: Array; flags?: number; source?: string; sourceDevice?: number; } & SharedMessageProperties & Message4 & ExpirationTimerUpdate >; export type OutgoingMessage = Readonly< { type: 'outgoing'; // Required attachments: Array; delivered: number; delivered_to: Array; destination: string; // PhoneNumber expirationStartTimestamp: number; id: string; received_at: number; sent: boolean; sent_to: Array; // Array // Optional body?: string; expires_at?: number; expireTimer?: number; recipients?: Array; // Array synced: boolean; } & SharedMessageProperties & Message4 & ExpirationTimerUpdate >; export type VerifiedChangeMessage = Readonly< { type: 'verified-change'; } & SharedMessageProperties & Message4 & ExpirationTimerUpdate >; type SharedMessageProperties = Readonly<{ conversationId: string; sent_at: number; timestamp: number; }>; type ExpirationTimerUpdate = Partial< Readonly<{ expirationTimerUpdate: Readonly<{ expireTimer: number; fromSync: boolean; source: string; // PhoneNumber }>; }> >; type Message4 = Partial< Readonly<{ hasAttachments: IndexableBoolean; hasVisualMediaAttachments: IndexableBoolean; hasFileAttachments: IndexableBoolean; }> >;