fcafee7e88b448f385f4590db8f26a770dd15131
[motion2.git] / server / api / dashboard / dashboard.rpc.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x0d39=['code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./dashboard.socket','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error'];(function(_0x46c10c,_0x2fe433){var _0x40d371=function(_0x397721){while(--_0x397721){_0x46c10c['push'](_0x46c10c['shift']());}};_0x40d371(++_0x2fe433);}(_0x0d39,0xef));var _0x90d3=function(_0x5e2a39,_0x2e0a1b){_0x5e2a39=_0x5e2a39-0x0;var _0x5481cc=_0x0d39[_0x5e2a39];return _0x5481cc;};'use strict';var _=require(_0x90d3('0x0'));var util=require(_0x90d3('0x1'));var moment=require(_0x90d3('0x2'));var BPromise=require(_0x90d3('0x3'));var rs=require(_0x90d3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x90d3('0x5'))['db'];var utils=require(_0x90d3('0x6'));var logger=require('../../config/logger')(_0x90d3('0x7'));var config=require(_0x90d3('0x8'));var jayson=require(_0x90d3('0x9'));var client=jayson[_0x90d3('0xa')][_0x90d3('0xb')]({'port':0x232a});config[_0x90d3('0xc')]=_[_0x90d3('0xd')](config['redis'],{'host':_0x90d3('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x90d3('0xc')]));require(_0x90d3('0xf'))['register'](socket);function respondWithRpcPromise(_0x264374,_0x29deec,_0x15c0f8){return new BPromise(function(_0x5e1fdf,_0x4554c4){return client['request'](_0x264374,_0x15c0f8)['then'](function(_0x4085ff){logger['info'](_0x90d3('0x10'),_0x29deec,_0x90d3('0x11'));logger[_0x90d3('0x12')](_0x90d3('0x13'),_0x29deec,_0x90d3('0x11'),JSON['stringify'](_0x4085ff));if(_0x4085ff[_0x90d3('0x14')]){if(_0x4085ff[_0x90d3('0x14')][_0x90d3('0x15')]===0x1f4){logger[_0x90d3('0x14')]('Dashboard,\x20%s,\x20%s',_0x29deec,_0x4085ff[_0x90d3('0x14')]['message']);return _0x4554c4(_0x4085ff[_0x90d3('0x14')][_0x90d3('0x16')]);}logger['error'](_0x90d3('0x10'),_0x29deec,_0x4085ff[_0x90d3('0x14')][_0x90d3('0x16')]);return _0x5e1fdf(_0x4085ff[_0x90d3('0x14')][_0x90d3('0x16')]);}else{logger[_0x90d3('0x17')]('Dashboard,\x20%s,\x20%s',_0x29deec,_0x90d3('0x11'));_0x5e1fdf(_0x4085ff[_0x90d3('0x18')][_0x90d3('0x16')]);}})[_0x90d3('0x19')](function(_0x1dabbc){logger[_0x90d3('0x14')](_0x90d3('0x10'),_0x29deec,_0x1dabbc);_0x4554c4(_0x1dabbc);});});}