(
msg: { platformMessageId?: string; timestamp: number; senderPlatformId: string; content: string | null },
existingPlatformMsgIds: Set<string>,
existingKeys: Set<string>
)
| 98 | } |
| 99 | |
| 100 | function isDuplicate( |
| 101 | msg: { platformMessageId?: string; timestamp: number; senderPlatformId: string; content: string | null }, |
| 102 | existingPlatformMsgIds: Set<string>, |
| 103 | existingKeys: Set<string> |
| 104 | ): boolean { |
| 105 | if (msg.platformMessageId) { |
| 106 | if (existingPlatformMsgIds.has(msg.platformMessageId)) return true |
| 107 | existingPlatformMsgIds.add(msg.platformMessageId) |
| 108 | return false |
| 109 | } |
| 110 | const key = generateMessageKey(msg.timestamp, msg.senderPlatformId, msg.content) |
| 111 | if (existingKeys.has(key)) return true |
| 112 | existingKeys.add(key) |
| 113 | return false |
| 114 | } |
| 115 | |
| 116 | function normalizeTimestamp(timestamp: unknown): number | null { |
| 117 | const value = typeof timestamp === 'string' && timestamp.trim() !== '' ? Number(timestamp) : timestamp |
no test coverage detected