Built motion from commit c116dc8b.|2.6.30
[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 _0x5eb0=['Dashboard,\x20%s,\x20%s','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','./dashboard.socket','register','then','info','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x57a430,_0x281e18){var _0x533e30=function(_0x30f094){while(--_0x30f094){_0x57a430['push'](_0x57a430['shift']());}};_0x533e30(++_0x281e18);}(_0x5eb0,0x93));var _0x05eb=function(_0x1e0c40,_0x2d537c){_0x1e0c40=_0x1e0c40-0x0;var _0x106489=_0x5eb0[_0x1e0c40];return _0x106489;};'use strict';var _=require(_0x05eb('0x0'));var util=require('util');var moment=require(_0x05eb('0x1'));var BPromise=require('bluebird');var rs=require(_0x05eb('0x2'));var fs=require('fs');var Redis=require(_0x05eb('0x3'));var db=require(_0x05eb('0x4'))['db'];var utils=require(_0x05eb('0x5'));var logger=require(_0x05eb('0x6'))(_0x05eb('0x7'));var config=require('../../config/environment');var jayson=require(_0x05eb('0x8'));var client=jayson['client'][_0x05eb('0x9')]({'port':0x232a});config[_0x05eb('0xa')]=_[_0x05eb('0xb')](config[_0x05eb('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x05eb('0xc'))(new Redis(config['redis']));require(_0x05eb('0xd'))[_0x05eb('0xe')](socket);function respondWithRpcPromise(_0x2b0f78,_0x4647f6,_0x4ccd2f){return new BPromise(function(_0x49f76c,_0x3f2f99){return client['request'](_0x2b0f78,_0x4ccd2f)[_0x05eb('0xf')](function(_0x31f828){logger[_0x05eb('0x10')]('Dashboard,\x20%s,\x20%s',_0x4647f6,_0x05eb('0x11'));logger['debug'](_0x05eb('0x12'),_0x4647f6,_0x05eb('0x11'),JSON['stringify'](_0x31f828));if(_0x31f828[_0x05eb('0x13')]){if(_0x31f828['error'][_0x05eb('0x14')]===0x1f4){logger[_0x05eb('0x13')](_0x05eb('0x15'),_0x4647f6,_0x31f828[_0x05eb('0x13')]['message']);return _0x3f2f99(_0x31f828[_0x05eb('0x13')]['message']);}logger[_0x05eb('0x13')](_0x05eb('0x15'),_0x4647f6,_0x31f828[_0x05eb('0x13')][_0x05eb('0x16')]);return _0x49f76c(_0x31f828['error'][_0x05eb('0x16')]);}else{logger['info'](_0x05eb('0x15'),_0x4647f6,_0x05eb('0x11'));_0x49f76c(_0x31f828[_0x05eb('0x17')][_0x05eb('0x16')]);}})['catch'](function(_0x3765ef){logger[_0x05eb('0x13')](_0x05eb('0x15'),_0x4647f6,_0x3765ef);_0x3f2f99(_0x3765ef);});});}