f1ab1db2437a495edee5f44f53524b157d20c649
[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 _0x21ce=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./dashboard.socket','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x21ce,0x179));var _0xe21c=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x21ce[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xe21c('0x0'));var util=require(_0xe21c('0x1'));var moment=require(_0xe21c('0x2'));var BPromise=require(_0xe21c('0x3'));var rs=require(_0xe21c('0x4'));var fs=require('fs');var Redis=require(_0xe21c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe21c('0x6'));var logger=require('../../config/logger')(_0xe21c('0x7'));var config=require(_0xe21c('0x8'));var jayson=require(_0xe21c('0x9'));var client=jayson[_0xe21c('0xa')][_0xe21c('0xb')]({'port':0x232a});config[_0xe21c('0xc')]=_['defaults'](config['redis'],{'host':_0xe21c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe21c('0xc')]));require(_0xe21c('0xe'))['register'](socket);function respondWithRpcPromise(_0xed3379,_0x364ed1,_0xc4b55){return new BPromise(function(_0x60b9f7,_0x2361fa){return client['request'](_0xed3379,_0xc4b55)[_0xe21c('0xf')](function(_0x5e0b32){logger[_0xe21c('0x10')](_0xe21c('0x11'),_0x364ed1,_0xe21c('0x12'));logger[_0xe21c('0x13')](_0xe21c('0x14'),_0x364ed1,'request\x20sent',JSON['stringify'](_0x5e0b32));if(_0x5e0b32[_0xe21c('0x15')]){if(_0x5e0b32[_0xe21c('0x15')][_0xe21c('0x16')]===0x1f4){logger[_0xe21c('0x15')](_0xe21c('0x11'),_0x364ed1,_0x5e0b32[_0xe21c('0x15')]['message']);return _0x2361fa(_0x5e0b32[_0xe21c('0x15')]['message']);}logger['error'](_0xe21c('0x11'),_0x364ed1,_0x5e0b32[_0xe21c('0x15')][_0xe21c('0x17')]);return _0x60b9f7(_0x5e0b32['error']['message']);}else{logger[_0xe21c('0x10')](_0xe21c('0x11'),_0x364ed1,_0xe21c('0x12'));_0x60b9f7(_0x5e0b32[_0xe21c('0x18')][_0xe21c('0x17')]);}})['catch'](function(_0x1b5fe5){logger[_0xe21c('0x15')]('Dashboard,\x20%s,\x20%s',_0x364ed1,_0x1b5fe5);_0x2361fa(_0x1b5fe5);});});}