0f3ccd5429f4c25ffb600356664655292cb29baa
[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 _0x80b0=['../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x355f01,_0x59e13b){var _0x211005=function(_0x17360e){while(--_0x17360e){_0x355f01['push'](_0x355f01['shift']());}};_0x211005(++_0x59e13b);}(_0x80b0,0x1aa));var _0x080b=function(_0xb38a90,_0x4461f4){_0xb38a90=_0xb38a90-0x0;var _0x3ad009=_0x80b0[_0xb38a90];return _0x3ad009;};'use strict';var _=require(_0x080b('0x0'));var util=require(_0x080b('0x1'));var moment=require(_0x080b('0x2'));var BPromise=require(_0x080b('0x3'));var rs=require(_0x080b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x080b('0x5'))['db'];var utils=require(_0x080b('0x6'));var logger=require(_0x080b('0x7'))(_0x080b('0x8'));var config=require(_0x080b('0x9'));var jayson=require(_0x080b('0xa'));var client=jayson[_0x080b('0xb')]['http']({'port':0x232a});config[_0x080b('0xc')]=_['defaults'](config[_0x080b('0xc')],{'host':_0x080b('0xd'),'port':0x18eb});var socket=require(_0x080b('0xe'))(new Redis(config[_0x080b('0xc')]));require(_0x080b('0xf'))[_0x080b('0x10')](socket);function respondWithRpcPromise(_0x3801ec,_0x347eea,_0x4078a7){return new BPromise(function(_0x31c8a7,_0x53ad71){return client[_0x080b('0x11')](_0x3801ec,_0x4078a7)[_0x080b('0x12')](function(_0x5bcb78){logger[_0x080b('0x13')](_0x080b('0x14'),_0x347eea,'request\x20sent');logger[_0x080b('0x15')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x347eea,_0x080b('0x16'),JSON[_0x080b('0x17')](_0x5bcb78));if(_0x5bcb78[_0x080b('0x18')]){if(_0x5bcb78[_0x080b('0x18')][_0x080b('0x19')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x347eea,_0x5bcb78[_0x080b('0x18')][_0x080b('0x1a')]);return _0x53ad71(_0x5bcb78[_0x080b('0x18')][_0x080b('0x1a')]);}logger[_0x080b('0x18')](_0x080b('0x14'),_0x347eea,_0x5bcb78[_0x080b('0x18')][_0x080b('0x1a')]);return _0x31c8a7(_0x5bcb78[_0x080b('0x18')]['message']);}else{logger[_0x080b('0x13')]('Dashboard,\x20%s,\x20%s',_0x347eea,'request\x20sent');_0x31c8a7(_0x5bcb78[_0x080b('0x1b')][_0x080b('0x1a')]);}})[_0x080b('0x1c')](function(_0x35c436){logger[_0x080b('0x18')](_0x080b('0x14'),_0x347eea,_0x35c436);_0x53ad71(_0x35c436);});});}