7d4835fbeacd6a2d9a6be06ff3e4e85f3834bca0
[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 _0x4099=['request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','request','then','info','Dashboard,\x20%s,\x20%s'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x4099,0xb7));var _0x9409=function(_0x3e531a,_0x28a82a){_0x3e531a=_0x3e531a-0x0;var _0x3c2574=_0x4099[_0x3e531a];return _0x3c2574;};'use strict';var _=require('lodash');var util=require(_0x9409('0x0'));var moment=require(_0x9409('0x1'));var BPromise=require(_0x9409('0x2'));var rs=require(_0x9409('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9409('0x4'))(_0x9409('0x5'));var config=require(_0x9409('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9409('0x7')][_0x9409('0x8')]({'port':0x232a});config[_0x9409('0x9')]=_[_0x9409('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9409('0xb'))(new Redis(config[_0x9409('0x9')]));require('./dashboard.socket')[_0x9409('0xc')](socket);function respondWithRpcPromise(_0x388e7e,_0x58c52e,_0xf85241){return new BPromise(function(_0x426be9,_0x1f1b39){return client[_0x9409('0xd')](_0x388e7e,_0xf85241)[_0x9409('0xe')](function(_0x408f2d){logger[_0x9409('0xf')](_0x9409('0x10'),_0x58c52e,_0x9409('0x11'));logger[_0x9409('0x12')](_0x9409('0x13'),_0x58c52e,_0x9409('0x11'),JSON[_0x9409('0x14')](_0x408f2d));if(_0x408f2d['error']){if(_0x408f2d[_0x9409('0x15')]['code']===0x1f4){logger[_0x9409('0x15')]('Dashboard,\x20%s,\x20%s',_0x58c52e,_0x408f2d[_0x9409('0x15')][_0x9409('0x16')]);return _0x1f1b39(_0x408f2d['error'][_0x9409('0x16')]);}logger[_0x9409('0x15')](_0x9409('0x10'),_0x58c52e,_0x408f2d['error'][_0x9409('0x16')]);return _0x426be9(_0x408f2d[_0x9409('0x15')][_0x9409('0x16')]);}else{logger['info'](_0x9409('0x10'),_0x58c52e,_0x9409('0x11'));_0x426be9(_0x408f2d[_0x9409('0x17')]['message']);}})[_0x9409('0x18')](function(_0x15fae9){logger[_0x9409('0x15')](_0x9409('0x10'),_0x58c52e,_0x15fae9);_0x1f1b39(_0x15fae9);});});}