fb7c2c127797eca7bce0a14f87436dd6fa09e7bc
[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 _0xaf8f=['moment','randomstring','ioredis','../../config/utils','rpc','http','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','info','Dashboard,\x20%s,\x20%s','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util'];(function(_0x48c19b,_0x3a1721){var _0x7b88f=function(_0x4e45e9){while(--_0x4e45e9){_0x48c19b['push'](_0x48c19b['shift']());}};_0x7b88f(++_0x3a1721);}(_0xaf8f,0xcd));var _0xfaf8=function(_0x4d7d40,_0xb7b2a8){_0x4d7d40=_0x4d7d40-0x0;var _0xfac4c4=_0xaf8f[_0x4d7d40];return _0xfac4c4;};'use strict';var _=require(_0xfaf8('0x0'));var util=require(_0xfaf8('0x1'));var moment=require(_0xfaf8('0x2'));var BPromise=require('bluebird');var rs=require(_0xfaf8('0x3'));var fs=require('fs');var Redis=require(_0xfaf8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfaf8('0x5'));var logger=require('../../config/logger')(_0xfaf8('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xfaf8('0x7')]({'port':0x232a});config['redis']=_[_0xfaf8('0x8')](config[_0xfaf8('0x9')],{'host':_0xfaf8('0xa'),'port':0x18eb});var socket=require(_0xfaf8('0xb'))(new Redis(config['redis']));require(_0xfaf8('0xc'))['register'](socket);function respondWithRpcPromise(_0x47c846,_0x446c80,_0x471e21){return new BPromise(function(_0x546887,_0x22f06b){return client['request'](_0x47c846,_0x471e21)['then'](function(_0x20e4e2){logger[_0xfaf8('0xd')](_0xfaf8('0xe'),_0x446c80,'request\x20sent');logger['debug'](_0xfaf8('0xf'),_0x446c80,'request\x20sent',JSON[_0xfaf8('0x10')](_0x20e4e2));if(_0x20e4e2[_0xfaf8('0x11')]){if(_0x20e4e2[_0xfaf8('0x11')][_0xfaf8('0x12')]===0x1f4){logger[_0xfaf8('0x11')](_0xfaf8('0xe'),_0x446c80,_0x20e4e2[_0xfaf8('0x11')][_0xfaf8('0x13')]);return _0x22f06b(_0x20e4e2[_0xfaf8('0x11')]['message']);}logger[_0xfaf8('0x11')]('Dashboard,\x20%s,\x20%s',_0x446c80,_0x20e4e2[_0xfaf8('0x11')][_0xfaf8('0x13')]);return _0x546887(_0x20e4e2[_0xfaf8('0x11')]['message']);}else{logger[_0xfaf8('0xd')](_0xfaf8('0xe'),_0x446c80,_0xfaf8('0x14'));_0x546887(_0x20e4e2[_0xfaf8('0x15')]['message']);}})[_0xfaf8('0x16')](function(_0x1f3a33){logger[_0xfaf8('0x11')](_0xfaf8('0xe'),_0x446c80,_0x1f3a33);_0x22f06b(_0x1f3a33);});});}