Built motion from commit ab870f9e.|2.5.44
[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 _0x1d01=['request','info','Dashboard,\x20%s,\x20%s','request\x20sent','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','./dashboard.socket','register'];(function(_0x4710ed,_0x211c8c){var _0x3c1e56=function(_0x3ec711){while(--_0x3ec711){_0x4710ed['push'](_0x4710ed['shift']());}};_0x3c1e56(++_0x211c8c);}(_0x1d01,0xb7));var _0x11d0=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1d01[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x11d0('0x0'));var util=require(_0x11d0('0x1'));var moment=require(_0x11d0('0x2'));var BPromise=require(_0x11d0('0x3'));var rs=require(_0x11d0('0x4'));var fs=require('fs');var Redis=require(_0x11d0('0x5'));var db=require(_0x11d0('0x6'))['db'];var utils=require(_0x11d0('0x7'));var logger=require(_0x11d0('0x8'))(_0x11d0('0x9'));var config=require(_0x11d0('0xa'));var jayson=require(_0x11d0('0xb'));var client=jayson[_0x11d0('0xc')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x11d0('0xd'))[_0x11d0('0xe')](socket);function respondWithRpcPromise(_0x31d546,_0x5f3ae2,_0x3f9def){return new BPromise(function(_0x146dff,_0x4a741f){return client[_0x11d0('0xf')](_0x31d546,_0x3f9def)['then'](function(_0x20e5e3){logger[_0x11d0('0x10')](_0x11d0('0x11'),_0x5f3ae2,'request\x20sent');logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x5f3ae2,_0x11d0('0x12'),JSON[_0x11d0('0x13')](_0x20e5e3));if(_0x20e5e3[_0x11d0('0x14')]){if(_0x20e5e3[_0x11d0('0x14')]['code']===0x1f4){logger[_0x11d0('0x14')]('Dashboard,\x20%s,\x20%s',_0x5f3ae2,_0x20e5e3[_0x11d0('0x14')][_0x11d0('0x15')]);return _0x4a741f(_0x20e5e3[_0x11d0('0x14')][_0x11d0('0x15')]);}logger[_0x11d0('0x14')](_0x11d0('0x11'),_0x5f3ae2,_0x20e5e3[_0x11d0('0x14')][_0x11d0('0x15')]);return _0x146dff(_0x20e5e3[_0x11d0('0x14')]['message']);}else{logger[_0x11d0('0x10')](_0x11d0('0x11'),_0x5f3ae2,_0x11d0('0x12'));_0x146dff(_0x20e5e3['result'][_0x11d0('0x15')]);}})['catch'](function(_0x5d01c0){logger[_0x11d0('0x14')]('Dashboard,\x20%s,\x20%s',_0x5f3ae2,_0x5d01c0);_0x4a741f(_0x5d01c0);});});}