61124345bbfce42439d49215e8b86c27562835c1
[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 _0x6192=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','localhost','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s'];(function(_0x34cbdb,_0x5793fb){var _0x5a20cf=function(_0x366e57){while(--_0x366e57){_0x34cbdb['push'](_0x34cbdb['shift']());}};_0x5a20cf(++_0x5793fb);}(_0x6192,0x10a));var _0x2619=function(_0x43e4de,_0x16d989){_0x43e4de=_0x43e4de-0x0;var _0x541f0a=_0x6192[_0x43e4de];return _0x541f0a;};'use strict';var _=require(_0x2619('0x0'));var util=require(_0x2619('0x1'));var moment=require(_0x2619('0x2'));var BPromise=require(_0x2619('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2619('0x4'));var db=require(_0x2619('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2619('0x6'))(_0x2619('0x7'));var config=require(_0x2619('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2619('0x9')]({'port':0x232a});config[_0x2619('0xa')]=_['defaults'](config['redis'],{'host':_0x2619('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2619('0xa')]));require(_0x2619('0xc'))['register'](socket);function respondWithRpcPromise(_0x1b4cb3,_0x415c86,_0x2cda3f){return new BPromise(function(_0x3119b4,_0x4b140b){return client[_0x2619('0xd')](_0x1b4cb3,_0x2cda3f)[_0x2619('0xe')](function(_0x59b625){logger[_0x2619('0xf')](_0x2619('0x10'),_0x415c86,_0x2619('0x11'));logger[_0x2619('0x12')](_0x2619('0x13'),_0x415c86,_0x2619('0x11'),JSON[_0x2619('0x14')](_0x59b625));if(_0x59b625['error']){if(_0x59b625[_0x2619('0x15')][_0x2619('0x16')]===0x1f4){logger[_0x2619('0x15')](_0x2619('0x10'),_0x415c86,_0x59b625[_0x2619('0x15')][_0x2619('0x17')]);return _0x4b140b(_0x59b625[_0x2619('0x15')][_0x2619('0x17')]);}logger[_0x2619('0x15')](_0x2619('0x10'),_0x415c86,_0x59b625[_0x2619('0x15')][_0x2619('0x17')]);return _0x3119b4(_0x59b625['error'][_0x2619('0x17')]);}else{logger[_0x2619('0xf')](_0x2619('0x10'),_0x415c86,_0x2619('0x11'));_0x3119b4(_0x59b625[_0x2619('0x18')][_0x2619('0x17')]);}})[_0x2619('0x19')](function(_0x345561){logger[_0x2619('0x15')](_0x2619('0x10'),_0x415c86,_0x345561);_0x4b140b(_0x345561);});});}