Built motion from commit e02f907f.|2.6.14
[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 _0xf468=['./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf468,0x195));var _0x8f46=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xf468[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x8f46('0x0'));var util=require(_0x8f46('0x1'));var moment=require(_0x8f46('0x2'));var BPromise=require(_0x8f46('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f46('0x4'));var db=require(_0x8f46('0x5'))['db'];var utils=require(_0x8f46('0x6'));var logger=require(_0x8f46('0x7'))(_0x8f46('0x8'));var config=require('../../config/environment');var jayson=require(_0x8f46('0x9'));var client=jayson[_0x8f46('0xa')][_0x8f46('0xb')]({'port':0x232a});config['redis']=_[_0x8f46('0xc')](config[_0x8f46('0xd')],{'host':_0x8f46('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8f46('0xd')]));require(_0x8f46('0xf'))[_0x8f46('0x10')](socket);function respondWithRpcPromise(_0x574cd5,_0x3622cc,_0x25427c){return new BPromise(function(_0xfbbf34,_0x41e5a5){return client[_0x8f46('0x11')](_0x574cd5,_0x25427c)[_0x8f46('0x12')](function(_0xdcacc1){logger[_0x8f46('0x13')](_0x8f46('0x14'),_0x3622cc,_0x8f46('0x15'));logger[_0x8f46('0x16')](_0x8f46('0x17'),_0x3622cc,_0x8f46('0x15'),JSON[_0x8f46('0x18')](_0xdcacc1));if(_0xdcacc1[_0x8f46('0x19')]){if(_0xdcacc1[_0x8f46('0x19')][_0x8f46('0x1a')]===0x1f4){logger['error'](_0x8f46('0x14'),_0x3622cc,_0xdcacc1[_0x8f46('0x19')][_0x8f46('0x1b')]);return _0x41e5a5(_0xdcacc1['error']['message']);}logger[_0x8f46('0x19')](_0x8f46('0x14'),_0x3622cc,_0xdcacc1['error']['message']);return _0xfbbf34(_0xdcacc1['error'][_0x8f46('0x1b')]);}else{logger[_0x8f46('0x13')]('Dashboard,\x20%s,\x20%s',_0x3622cc,_0x8f46('0x15'));_0xfbbf34(_0xdcacc1[_0x8f46('0x1c')][_0x8f46('0x1b')]);}})[_0x8f46('0x1d')](function(_0x599bf4){logger[_0x8f46('0x19')](_0x8f46('0x14'),_0x3622cc,_0x599bf4);_0x41e5a5(_0x599bf4);});});}