/** * Monthly Chunk Generator * * Groups messages by calendar month and generates fingerprints for deduplication. * See project_docs/CHAT_FINGERPRINTING.md for algorithm details. * * CRITICAL: Fingerprints do NOT include timestamps. * WhatsApp exports are not idempotent - same message can have different timestamps * across exports (±1-2 seconds drift). Identity comes from: * - Who said what (sender + content) * - In what order (first N messages of the month) * - How many messages (count detects partial uploads) */ import type { ParsedMessage } from '../types/parser'; import type { FingerprintConfig, MonthlyChunk } from './types'; /** * Get the UTC month start date for a timestamp. * Returns the first day of the month at 00:00:00 UTC. */ export declare function getMonthStart(timestamp: Date): Date; /** * Get a sortable month key in "YYYY-MM" format. */ export declare function getMonthKey(timestamp: Date): string; /** * Generate a SHA-256 fingerprint for a monthly chunk. * * The fingerprint is based on: * - Month key (YYYY-MM format) * - Message count (for detecting partial exports) * - First N messages (sender + content ONLY - no timestamps!) * * CRITICAL: Timestamps are NOT included in the fingerprint. * WhatsApp exports are not idempotent - the same message can have different * timestamps across exports (±1-2 seconds drift between iOS/Desktop/etc). * Identity comes from: who said what, in what order. * * @param monthMessages - All messages in this month * @param monthStart - First day of the month (UTC) * @param config - Optional configuration * @returns SHA-256 hex string */ export declare function generateChunkFingerprint(monthMessages: readonly ParsedMessage[], monthStart: Date, config?: FingerprintConfig): string; /** * Group messages by calendar month. * Returns a map of month key to messages in that month. */ export declare function groupMessagesByMonth(messages: readonly ParsedMessage[]): Map; /** * Generate monthly chunks with fingerprints for a set of messages. * * @param messages - All messages to chunk * @param config - Optional configuration * @returns Array of monthly chunks, sorted by month (oldest first) */ export declare function generateMonthlyChunks(messages: readonly ParsedMessage[], config?: FingerprintConfig): MonthlyChunk[]; /** * Create a deduplication plan by comparing chunks against known fingerprints. * * @param chunks - Monthly chunks from the current upload * @param knownFingerprints - Set of fingerprints already processed * @returns Plan showing what to process and what to skip */ export declare function createDeduplicationPlan(chunks: readonly MonthlyChunk[], knownFingerprints: ReadonlySet): { chunksToProcess: MonthlyChunk[]; duplicateChunks: MonthlyChunk[]; messagesToProcess: number; messagesSkipped: number; }; //# sourceMappingURL=chunker.d.ts.map