1032eb76c16f77bca45cabe501c62c80898b9a23
[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 _0x605d=['request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','localhost','socket.io-emitter','redis','./dashboard.socket','register','request','info','Dashboard,\x20%s,\x20%s'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x605d,0x1c7));var _0xd605=function(_0x361bd6,_0x3c03ee){_0x361bd6=_0x361bd6-0x0;var _0x56956f=_0x605d[_0x361bd6];return _0x56956f;};'use strict';var _=require(_0xd605('0x0'));var util=require(_0xd605('0x1'));var moment=require(_0xd605('0x2'));var BPromise=require(_0xd605('0x3'));var rs=require(_0xd605('0x4'));var fs=require('fs');var Redis=require(_0xd605('0x5'));var db=require(_0xd605('0x6'))['db'];var utils=require(_0xd605('0x7'));var logger=require(_0xd605('0x8'))(_0xd605('0x9'));var config=require(_0xd605('0xa'));var jayson=require(_0xd605('0xb'));var client=jayson['client'][_0xd605('0xc')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xd605('0xd'),'port':0x18eb});var socket=require(_0xd605('0xe'))(new Redis(config[_0xd605('0xf')]));require(_0xd605('0x10'))[_0xd605('0x11')](socket);function respondWithRpcPromise(_0x33ab21,_0x109950,_0xb874d8){return new BPromise(function(_0x2a28a5,_0x1276d8){return client[_0xd605('0x12')](_0x33ab21,_0xb874d8)['then'](function(_0x54fd8c){logger[_0xd605('0x13')](_0xd605('0x14'),_0x109950,_0xd605('0x15'));logger[_0xd605('0x16')](_0xd605('0x17'),_0x109950,_0xd605('0x15'),JSON['stringify'](_0x54fd8c));if(_0x54fd8c[_0xd605('0x18')]){if(_0x54fd8c[_0xd605('0x18')][_0xd605('0x19')]===0x1f4){logger['error'](_0xd605('0x14'),_0x109950,_0x54fd8c[_0xd605('0x18')][_0xd605('0x1a')]);return _0x1276d8(_0x54fd8c[_0xd605('0x18')][_0xd605('0x1a')]);}logger[_0xd605('0x18')](_0xd605('0x14'),_0x109950,_0x54fd8c[_0xd605('0x18')][_0xd605('0x1a')]);return _0x2a28a5(_0x54fd8c[_0xd605('0x18')][_0xd605('0x1a')]);}else{logger[_0xd605('0x13')](_0xd605('0x14'),_0x109950,'request\x20sent');_0x2a28a5(_0x54fd8c['result'][_0xd605('0x1a')]);}})[_0xd605('0x1b')](function(_0x1a59d3){logger[_0xd605('0x18')](_0xd605('0x14'),_0x109950,_0x1a59d3);_0x1276d8(_0x1a59d3);});});}