export function initConsoleApi(): void {
if (typeof __RESPONSE_AGGREGATE__ !== 'undefined' && __RESPONSE_AGGREGATE__) {
const api = {
download: downloadAsZip,
list,
clear,
get count() {
return captured.size;
},
};
// window has no typed slot for our custom debug property; widen to a string-keyed record to attach it.
(window as unknown as Record<string, unknown>).__responseAggregate = api;
console.log(
'%c[ResponseAggregate] Capture mode enabled!',
'color: #4CAF50; font-weight: bold; font-size: 14px;',
);
console.log('Available commands:');
console.log(' window.__responseAggregate.download() - Download captured responses as zip');
console.log(' window.__responseAggregate.list() - List all captured responses');
console.log(' window.__responseAggregate.clear() - Clear captured responses');
console.log(' window.__responseAggregate.count - Number of captured responses');
}
}
Expose console API on
window.__responseAggregatewhen in aggregate mode.