p3x-redis-ui-server
Version:
🏍️ P3X Redis UI server — Socket.IO backend for the dual Angular + React frontend with AI queries, 54 languages, and auto data decompression
2 lines (1 loc) • 599 B
JavaScript
export default async r=>{const{socket:e,payload:s}=r;try{const t=e.p3xrs.ioredis,o=s.key;console.info("socket.io timeseries info",o);const a=await t.call("TS.INFO",o),n={};for(let r=0;r<a.length;r+=2){const e=a[r];let s=a[r+1];if("labels"===e&&Array.isArray(s)){const r={};for(const e of s)Array.isArray(e)&&2===e.length&&(r[e[0]]=e[1]);s=r}"rules"===e&&Array.isArray(s)&&(s=s.map(r=>Array.isArray(r)?{destKey:r[0],bucketDuration:r[1],aggregationType:r[2]}:r)),n[e]=s}e.emit(r.responseEvent,{status:"ok",data:n})}catch(s){console.error(s),e.emit(r.responseEvent,{status:"error",error:s.message})}};