1e7eb748d8d0f22d5462265e42026bffd5af56a6
[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 _0x8cab=['../../config/logger','rpc','../../config/environment','http','localhost','socket.io-emitter','redis','register','then','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','Dashboard,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4dfd78,_0x3ce417){var _0x4377e8=function(_0x4c10f8){while(--_0x4c10f8){_0x4dfd78['push'](_0x4dfd78['shift']());}};_0x4377e8(++_0x3ce417);}(_0x8cab,0x13d));var _0xb8ca=function(_0x8d02f2,_0x3e53d4){_0x8d02f2=_0x8d02f2-0x0;var _0x16512f=_0x8cab[_0x8d02f2];return _0x16512f;};'use strict';var _=require(_0xb8ca('0x0'));var util=require(_0xb8ca('0x1'));var moment=require('moment');var BPromise=require(_0xb8ca('0x2'));var rs=require(_0xb8ca('0x3'));var fs=require('fs');var Redis=require(_0xb8ca('0x4'));var db=require(_0xb8ca('0x5'))['db'];var utils=require(_0xb8ca('0x6'));var logger=require(_0xb8ca('0x7'))(_0xb8ca('0x8'));var config=require(_0xb8ca('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb8ca('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xb8ca('0xb'),'port':0x18eb});var socket=require(_0xb8ca('0xc'))(new Redis(config[_0xb8ca('0xd')]));require('./dashboard.socket')[_0xb8ca('0xe')](socket);function respondWithRpcPromise(_0x19aae2,_0x4dfe27,_0x1b6dd9){return new BPromise(function(_0x551075,_0x3c4eac){return client['request'](_0x19aae2,_0x1b6dd9)[_0xb8ca('0xf')](function(_0x530929){logger['info']('Dashboard,\x20%s,\x20%s',_0x4dfe27,_0xb8ca('0x10'));logger[_0xb8ca('0x11')](_0xb8ca('0x12'),_0x4dfe27,'request\x20sent',JSON[_0xb8ca('0x13')](_0x530929));if(_0x530929[_0xb8ca('0x14')]){if(_0x530929[_0xb8ca('0x14')][_0xb8ca('0x15')]===0x1f4){logger[_0xb8ca('0x14')](_0xb8ca('0x16'),_0x4dfe27,_0x530929[_0xb8ca('0x14')][_0xb8ca('0x17')]);return _0x3c4eac(_0x530929[_0xb8ca('0x14')][_0xb8ca('0x17')]);}logger['error'](_0xb8ca('0x16'),_0x4dfe27,_0x530929[_0xb8ca('0x14')][_0xb8ca('0x17')]);return _0x551075(_0x530929[_0xb8ca('0x14')]['message']);}else{logger[_0xb8ca('0x18')](_0xb8ca('0x16'),_0x4dfe27,_0xb8ca('0x10'));_0x551075(_0x530929[_0xb8ca('0x19')]['message']);}})[_0xb8ca('0x1a')](function(_0x35a7fb){logger['error'](_0xb8ca('0x16'),_0x4dfe27,_0x35a7fb);_0x3c4eac(_0x35a7fb);});});}