/** * iMessage JSON Bundle Parser * * Parses the multi-chat JSON format produced by the ChatToMap desktop app * (one `manifest.json` plus N `chat_NNN.json` files inside a zip). * * Each `chat_NNN.json` contains: * { * meta: { name, identifier, service, message_count }, * messages: [{ timestamp: ISO8601, sender, is_from_me, text }] * } * * Unlike the iMessage **text** parser (`./imessage.ts`), this format is JSON * and bundles multiple chats. Following the Telegram pattern, JSON parsing is * non-streaming and exposed via dedicated entry points rather than the * generic `parseChat(string)` API. */ import type { ParseResult } from '../types'; export interface IMessageJsonManifest { readonly version: string; readonly source: 'imessage'; readonly export_date?: string; readonly chat_count: number; readonly total_messages: number; } export interface IMessageJsonChatMeta { readonly name: string; readonly identifier: string; readonly service: string; readonly message_count: number; /** Number of OTHER participants (excludes device owner). 1 = 1:1 chat. */ readonly participant_count?: number; } export interface IMessageJsonMessage { readonly timestamp: string; readonly sender: string; readonly is_from_me: boolean; readonly text: string; } export interface IMessageJsonChat { readonly meta: IMessageJsonChatMeta; readonly messages: readonly IMessageJsonMessage[]; } /** A chat entry as found in the zip, paired with its filename for traceability. */ export interface IMessageJsonChatEntry { /** Filename without extension, e.g. `chat_001`. Used as `chatId`. */ readonly id: string; readonly chat: IMessageJsonChat; } export declare function isIMessageJsonManifest(value: unknown): value is IMessageJsonManifest; export declare function isIMessageJsonChat(value: unknown): value is IMessageJsonChat; /** * Parse a list of iMessage JSON chats into a flat ParseResult, preserving the * source chat on each message via `chatId`. * * The `manifest` is accepted for validation (chat_count check) but its * authoritative data is the chats themselves. */ export declare function parseIMessageJsonBundle(manifest: IMessageJsonManifest, entries: readonly IMessageJsonChatEntry[]): ParseResult; //# sourceMappingURL=imessage-json.d.ts.map