0af679004ea5a5a99adaa9d3adfb79681fadb826
[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 _0x5dc7=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','Dashboard,\x20%s,\x20%s','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result'];(function(_0x283a29,_0x5b2e80){var _0x3e86b4=function(_0x18d0a8){while(--_0x18d0a8){_0x283a29['push'](_0x283a29['shift']());}};_0x3e86b4(++_0x5b2e80);}(_0x5dc7,0x1e0));var _0x75dc=function(_0x18801d,_0x3fee8e){_0x18801d=_0x18801d-0x0;var _0x3e98e0=_0x5dc7[_0x18801d];return _0x3e98e0;};'use strict';var _=require(_0x75dc('0x0'));var util=require('util');var moment=require(_0x75dc('0x1'));var BPromise=require(_0x75dc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x75dc('0x3'));var db=require(_0x75dc('0x4'))['db'];var utils=require(_0x75dc('0x5'));var logger=require('../../config/logger')(_0x75dc('0x6'));var config=require('../../config/environment');var jayson=require(_0x75dc('0x7'));var client=jayson[_0x75dc('0x8')][_0x75dc('0x9')]({'port':0x232a});config[_0x75dc('0xa')]=_['defaults'](config[_0x75dc('0xa')],{'host':_0x75dc('0xb'),'port':0x18eb});var socket=require(_0x75dc('0xc'))(new Redis(config['redis']));require('./dashboard.socket')[_0x75dc('0xd')](socket);function respondWithRpcPromise(_0x3dfab6,_0x57a95b,_0x47a1ad){return new BPromise(function(_0x3c4673,_0x151bfb){return client[_0x75dc('0xe')](_0x3dfab6,_0x47a1ad)[_0x75dc('0xf')](function(_0x5f1ee8){logger['info'](_0x75dc('0x10'),_0x57a95b,'request\x20sent');logger['debug'](_0x75dc('0x11'),_0x57a95b,'request\x20sent',JSON[_0x75dc('0x12')](_0x5f1ee8));if(_0x5f1ee8[_0x75dc('0x13')]){if(_0x5f1ee8['error'][_0x75dc('0x14')]===0x1f4){logger[_0x75dc('0x13')]('Dashboard,\x20%s,\x20%s',_0x57a95b,_0x5f1ee8['error'][_0x75dc('0x15')]);return _0x151bfb(_0x5f1ee8[_0x75dc('0x13')]['message']);}logger['error'](_0x75dc('0x10'),_0x57a95b,_0x5f1ee8['error'][_0x75dc('0x15')]);return _0x3c4673(_0x5f1ee8[_0x75dc('0x13')][_0x75dc('0x15')]);}else{logger['info'](_0x75dc('0x10'),_0x57a95b,_0x75dc('0x16'));_0x3c4673(_0x5f1ee8[_0x75dc('0x17')][_0x75dc('0x15')]);}})['catch'](function(_0x155f7f){logger[_0x75dc('0x13')]('Dashboard,\x20%s,\x20%s',_0x57a95b,_0x155f7f);_0x151bfb(_0x155f7f);});});}