b548fd7c3d356e9e5ff5d8364f6a0a29023843bc
[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 _0x220d=['register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket'];(function(_0xf34b0a,_0x11e116){var _0x5021e1=function(_0x4eff67){while(--_0x4eff67){_0xf34b0a['push'](_0xf34b0a['shift']());}};_0x5021e1(++_0x11e116);}(_0x220d,0x132));var _0xd220=function(_0x7a8888,_0xea50a8){_0x7a8888=_0x7a8888-0x0;var _0xecd5f8=_0x220d[_0x7a8888];return _0xecd5f8;};'use strict';var _=require(_0xd220('0x0'));var util=require(_0xd220('0x1'));var moment=require('moment');var BPromise=require(_0xd220('0x2'));var rs=require(_0xd220('0x3'));var fs=require('fs');var Redis=require(_0xd220('0x4'));var db=require(_0xd220('0x5'))['db'];var utils=require(_0xd220('0x6'));var logger=require(_0xd220('0x7'))(_0xd220('0x8'));var config=require(_0xd220('0x9'));var jayson=require(_0xd220('0xa'));var client=jayson[_0xd220('0xb')][_0xd220('0xc')]({'port':0x232a});config[_0xd220('0xd')]=_[_0xd220('0xe')](config['redis'],{'host':_0xd220('0xf'),'port':0x18eb});var socket=require(_0xd220('0x10'))(new Redis(config[_0xd220('0xd')]));require(_0xd220('0x11'))[_0xd220('0x12')](socket);function respondWithRpcPromise(_0x3c85ab,_0x177f7c,_0x2b2e12){return new BPromise(function(_0x4ad480,_0x49d4d2){return client['request'](_0x3c85ab,_0x2b2e12)[_0xd220('0x13')](function(_0x1c81c6){logger[_0xd220('0x14')](_0xd220('0x15'),_0x177f7c,_0xd220('0x16'));logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x177f7c,'request\x20sent',JSON['stringify'](_0x1c81c6));if(_0x1c81c6[_0xd220('0x17')]){if(_0x1c81c6[_0xd220('0x17')]['code']===0x1f4){logger[_0xd220('0x17')]('Dashboard,\x20%s,\x20%s',_0x177f7c,_0x1c81c6[_0xd220('0x17')][_0xd220('0x18')]);return _0x49d4d2(_0x1c81c6[_0xd220('0x17')][_0xd220('0x18')]);}logger[_0xd220('0x17')](_0xd220('0x15'),_0x177f7c,_0x1c81c6['error'][_0xd220('0x18')]);return _0x4ad480(_0x1c81c6['error'][_0xd220('0x18')]);}else{logger[_0xd220('0x14')]('Dashboard,\x20%s,\x20%s',_0x177f7c,_0xd220('0x16'));_0x4ad480(_0x1c81c6[_0xd220('0x19')]['message']);}})[_0xd220('0x1a')](function(_0x33b9a2){logger['error'](_0xd220('0x15'),_0x177f7c,_0x33b9a2);_0x49d4d2(_0x33b9a2);});});}