ed91c2e753a747ad117806bc06afb31b43cce335
[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 _0xad19=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','then','info','Dashboard,\x20%s,\x20%s','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3a702e,_0x2f73a6){var _0x383e2a=function(_0x485387){while(--_0x485387){_0x3a702e['push'](_0x3a702e['shift']());}};_0x383e2a(++_0x2f73a6);}(_0xad19,0x99));var _0x9ad1=function(_0x198d45,_0xa5f95f){_0x198d45=_0x198d45-0x0;var _0xc90a6d=_0xad19[_0x198d45];return _0xc90a6d;};'use strict';var _=require(_0x9ad1('0x0'));var util=require('util');var moment=require(_0x9ad1('0x1'));var BPromise=require(_0x9ad1('0x2'));var rs=require(_0x9ad1('0x3'));var fs=require('fs');var Redis=require(_0x9ad1('0x4'));var db=require(_0x9ad1('0x5'))['db'];var utils=require(_0x9ad1('0x6'));var logger=require(_0x9ad1('0x7'))(_0x9ad1('0x8'));var config=require(_0x9ad1('0x9'));var jayson=require(_0x9ad1('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x9ad1('0xb')]=_[_0x9ad1('0xc')](config[_0x9ad1('0xb')],{'host':_0x9ad1('0xd'),'port':0x18eb});var socket=require(_0x9ad1('0xe'))(new Redis(config[_0x9ad1('0xb')]));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x3f6e4b,_0x3a963c,_0x1a34e4){return new BPromise(function(_0x70139b,_0xe8f86){return client['request'](_0x3f6e4b,_0x1a34e4)[_0x9ad1('0xf')](function(_0x382441){logger[_0x9ad1('0x10')](_0x9ad1('0x11'),_0x3a963c,'request\x20sent');logger['debug'](_0x9ad1('0x12'),_0x3a963c,'request\x20sent',JSON[_0x9ad1('0x13')](_0x382441));if(_0x382441[_0x9ad1('0x14')]){if(_0x382441[_0x9ad1('0x14')][_0x9ad1('0x15')]===0x1f4){logger[_0x9ad1('0x14')](_0x9ad1('0x11'),_0x3a963c,_0x382441[_0x9ad1('0x14')][_0x9ad1('0x16')]);return _0xe8f86(_0x382441['error'][_0x9ad1('0x16')]);}logger[_0x9ad1('0x14')](_0x9ad1('0x11'),_0x3a963c,_0x382441['error'][_0x9ad1('0x16')]);return _0x70139b(_0x382441[_0x9ad1('0x14')][_0x9ad1('0x16')]);}else{logger[_0x9ad1('0x10')]('Dashboard,\x20%s,\x20%s',_0x3a963c,'request\x20sent');_0x70139b(_0x382441[_0x9ad1('0x17')][_0x9ad1('0x16')]);}})[_0x9ad1('0x18')](function(_0x2f0d87){logger[_0x9ad1('0x14')]('Dashboard,\x20%s,\x20%s',_0x3a963c,_0x2f0d87);_0xe8f86(_0x2f0d87);});});}