MCPcopy Create free account
hub / github.com/bywwcnll/StreamPanel / messagesToCSV

Function messagesToCSV

devtools/modules/exportManager.js:105–146  ·  view source on GitHub ↗
(messages, connectionInfo = null)

Source from the content-addressed store, hash-verified

103}
104
105export function messagesToCSV(messages, connectionInfo = null) {
106 const headers = ['ID', 'EventType', 'Data', 'LastEventId', 'Timestamp'];
107 if (connectionInfo) {
108 headers.unshift(
109 'ConnectionID',
110 'ConnectionURL',
111 'RequestType',
112 'Source',
113 'Status',
114 'IsIframe',
115 'FrameURL',
116 'ConnectionCreatedAt'
117 );
118 }
119
120 const rows = messages.map(msg => {
121 const row = [
122 escapeCSV(msg.id),
123 escapeCSV(msg.eventType),
124 escapeCSV(msg.data),
125 escapeCSV(msg.lastEventId),
126 escapeCSV(msg.timestamp)
127 ];
128
129 if (connectionInfo) {
130 row.unshift(
131 escapeCSV(connectionInfo.id),
132 escapeCSV(connectionInfo.url),
133 escapeCSV(connectionInfo.requestType),
134 escapeCSV(connectionInfo.source),
135 escapeCSV(connectionInfo.status),
136 escapeCSV(connectionInfo.isIframe),
137 escapeCSV(connectionInfo.frameUrl),
138 escapeCSV(connectionInfo.createdAt)
139 );
140 }
141
142 return row.join(',');
143 });
144
145 return [headers.join(','), ...rows].join('\n');
146}
147
148export function exportCurrentToCSV() {
149 const connection = state.connections[state.selectedConnectionId];

Callers 1

exportCurrentToCSVFunction · 0.70

Calls 1

escapeCSVFunction · 0.70

Tested by

no test coverage detected