Built motion from commit 9d0783e6.|2.6.13
[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 _0xd0c2=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboard.socket','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2abb8e,_0x10dae9){var _0x449948=function(_0x497eee){while(--_0x497eee){_0x2abb8e['push'](_0x2abb8e['shift']());}};_0x449948(++_0x10dae9);}(_0xd0c2,0x90));var _0x2d0c=function(_0x10e557,_0xfb23c8){_0x10e557=_0x10e557-0x0;var _0x3e4e93=_0xd0c2[_0x10e557];return _0x3e4e93;};'use strict';var _=require(_0x2d0c('0x0'));var util=require('util');var moment=require(_0x2d0c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d0c('0x2'));var db=require(_0x2d0c('0x3'))['db'];var utils=require(_0x2d0c('0x4'));var logger=require(_0x2d0c('0x5'))(_0x2d0c('0x6'));var config=require(_0x2d0c('0x7'));var jayson=require(_0x2d0c('0x8'));var client=jayson[_0x2d0c('0x9')][_0x2d0c('0xa')]({'port':0x232a});config[_0x2d0c('0xb')]=_[_0x2d0c('0xc')](config[_0x2d0c('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x2d0c('0xd'))(new Redis(config['redis']));require(_0x2d0c('0xe'))['register'](socket);function respondWithRpcPromise(_0x4d78b1,_0x517db5,_0xe08423){return new BPromise(function(_0x237e20,_0x324e95){return client[_0x2d0c('0xf')](_0x4d78b1,_0xe08423)['then'](function(_0x28a5e7){logger[_0x2d0c('0x10')](_0x2d0c('0x11'),_0x517db5,_0x2d0c('0x12'));logger[_0x2d0c('0x13')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x517db5,_0x2d0c('0x12'),JSON[_0x2d0c('0x14')](_0x28a5e7));if(_0x28a5e7[_0x2d0c('0x15')]){if(_0x28a5e7['error'][_0x2d0c('0x16')]===0x1f4){logger[_0x2d0c('0x15')](_0x2d0c('0x11'),_0x517db5,_0x28a5e7[_0x2d0c('0x15')][_0x2d0c('0x17')]);return _0x324e95(_0x28a5e7[_0x2d0c('0x15')][_0x2d0c('0x17')]);}logger[_0x2d0c('0x15')](_0x2d0c('0x11'),_0x517db5,_0x28a5e7[_0x2d0c('0x15')][_0x2d0c('0x17')]);return _0x237e20(_0x28a5e7[_0x2d0c('0x15')][_0x2d0c('0x17')]);}else{logger[_0x2d0c('0x10')](_0x2d0c('0x11'),_0x517db5,_0x2d0c('0x12'));_0x237e20(_0x28a5e7[_0x2d0c('0x18')][_0x2d0c('0x17')]);}})['catch'](function(_0xdb4a6f){logger[_0x2d0c('0x15')](_0x2d0c('0x11'),_0x517db5,_0xdb4a6f);_0x324e95(_0xdb4a6f);});});}