()
| 68 | } |
| 69 | |
| 70 | export function getAllConnectionsExportData() { |
| 71 | const connections = Object.values(state.connections); |
| 72 | if (connections.length === 0) { |
| 73 | return null; |
| 74 | } |
| 75 | |
| 76 | return { |
| 77 | connections: connections.map(conn => { |
| 78 | const messages = getVisibleMessages(conn.messages); |
| 79 | return { |
| 80 | ...getConnectionExportInfo(conn), |
| 81 | messages: messages.map(msg => ({ |
| 82 | id: msg.id, |
| 83 | eventType: msg.eventType, |
| 84 | data: msg.data, |
| 85 | lastEventId: msg.lastEventId, |
| 86 | timestamp: formatTimestampForExport(msg.timestamp) |
| 87 | })), |
| 88 | messageCount: messages.length, |
| 89 | totalMessageCount: conn.messages.length |
| 90 | }; |
| 91 | }), |
| 92 | exportedAt: new Date().toISOString(), |
| 93 | totalConnections: connections.length, |
| 94 | totalMessages: connections.reduce((sum, conn) => sum + getVisibleMessages(conn.messages).length, 0), |
| 95 | totalRawMessages: connections.reduce((sum, conn) => sum + conn.messages.length, 0), |
| 96 | appliedFilters: getAppliedFiltersMetadata() |
| 97 | }; |
| 98 | } |
| 99 | |
| 100 | export function exportToJSON(data, filename) { |
| 101 | const jsonStr = JSON.stringify(data, null, 2); |
no test coverage detected