9ce2ae4a92877469a00cd1048b0fc46acfaaa445
[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 _0xbb83=['error','Dashboard,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','socket.io-emitter','register','request','then','info','debug','request\x20sent','stringify'];(function(_0x177d1d,_0xe8ed96){var _0x3316a0=function(_0x4b2842){while(--_0x4b2842){_0x177d1d['push'](_0x177d1d['shift']());}};_0x3316a0(++_0xe8ed96);}(_0xbb83,0x68));var _0x3bb8=function(_0x4fa1c7,_0x5b2ce3){_0x4fa1c7=_0x4fa1c7-0x0;var _0x31c4e9=_0xbb83[_0x4fa1c7];return _0x31c4e9;};'use strict';var _=require(_0x3bb8('0x0'));var util=require(_0x3bb8('0x1'));var moment=require(_0x3bb8('0x2'));var BPromise=require(_0x3bb8('0x3'));var rs=require(_0x3bb8('0x4'));var fs=require('fs');var Redis=require(_0x3bb8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3bb8('0x6'));var logger=require(_0x3bb8('0x7'))(_0x3bb8('0x8'));var config=require('../../config/environment');var jayson=require(_0x3bb8('0x9'));var client=jayson['client'][_0x3bb8('0xa')]({'port':0x232a});config['redis']=_[_0x3bb8('0xb')](config[_0x3bb8('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x3bb8('0xd'))(new Redis(config[_0x3bb8('0xc')]));require('./dashboard.socket')[_0x3bb8('0xe')](socket);function respondWithRpcPromise(_0x24a7af,_0x4f5608,_0x4dd2c8){return new BPromise(function(_0x157d7a,_0x4d36b8){return client[_0x3bb8('0xf')](_0x24a7af,_0x4dd2c8)[_0x3bb8('0x10')](function(_0x1d309b){logger[_0x3bb8('0x11')]('Dashboard,\x20%s,\x20%s',_0x4f5608,'request\x20sent');logger[_0x3bb8('0x12')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x4f5608,_0x3bb8('0x13'),JSON[_0x3bb8('0x14')](_0x1d309b));if(_0x1d309b[_0x3bb8('0x15')]){if(_0x1d309b[_0x3bb8('0x15')]['code']===0x1f4){logger[_0x3bb8('0x15')](_0x3bb8('0x16'),_0x4f5608,_0x1d309b['error']['message']);return _0x4d36b8(_0x1d309b[_0x3bb8('0x15')][_0x3bb8('0x17')]);}logger[_0x3bb8('0x15')]('Dashboard,\x20%s,\x20%s',_0x4f5608,_0x1d309b[_0x3bb8('0x15')][_0x3bb8('0x17')]);return _0x157d7a(_0x1d309b[_0x3bb8('0x15')]['message']);}else{logger[_0x3bb8('0x11')](_0x3bb8('0x16'),_0x4f5608,_0x3bb8('0x13'));_0x157d7a(_0x1d309b['result'][_0x3bb8('0x17')]);}})[_0x3bb8('0x18')](function(_0x2a35a5){logger['error'](_0x3bb8('0x16'),_0x4f5608,_0x2a35a5);_0x4d36b8(_0x2a35a5);});});}