676e7424ac9886f19b70027cb13c0da66ac2cc79
[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 _0xf550=['stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s'];(function(_0x4e1d9d,_0x492d58){var _0x5b702b=function(_0x29ce40){while(--_0x29ce40){_0x4e1d9d['push'](_0x4e1d9d['shift']());}};_0x5b702b(++_0x492d58);}(_0xf550,0x1f3));var _0x0f55=function(_0x146a85,_0x529b52){_0x146a85=_0x146a85-0x0;var _0x1b59bf=_0xf550[_0x146a85];return _0x1b59bf;};'use strict';var _=require('lodash');var util=require(_0x0f55('0x0'));var moment=require(_0x0f55('0x1'));var BPromise=require('bluebird');var rs=require(_0x0f55('0x2'));var fs=require('fs');var Redis=require(_0x0f55('0x3'));var db=require(_0x0f55('0x4'))['db'];var utils=require(_0x0f55('0x5'));var logger=require(_0x0f55('0x6'))(_0x0f55('0x7'));var config=require('../../config/environment');var jayson=require(_0x0f55('0x8'));var client=jayson[_0x0f55('0x9')][_0x0f55('0xa')]({'port':0x232a});config['redis']=_[_0x0f55('0xb')](config[_0x0f55('0xc')],{'host':_0x0f55('0xd'),'port':0x18eb});var socket=require(_0x0f55('0xe'))(new Redis(config[_0x0f55('0xc')]));require('./dashboard.socket')[_0x0f55('0xf')](socket);function respondWithRpcPromise(_0x390dc4,_0x4d7d13,_0x1b1039){return new BPromise(function(_0x528ac1,_0x5bd1d9){return client[_0x0f55('0x10')](_0x390dc4,_0x1b1039)[_0x0f55('0x11')](function(_0xe523d4){logger[_0x0f55('0x12')](_0x0f55('0x13'),_0x4d7d13,_0x0f55('0x14'));logger[_0x0f55('0x15')](_0x0f55('0x16'),_0x4d7d13,'request\x20sent',JSON[_0x0f55('0x17')](_0xe523d4));if(_0xe523d4[_0x0f55('0x18')]){if(_0xe523d4[_0x0f55('0x18')][_0x0f55('0x19')]===0x1f4){logger['error'](_0x0f55('0x13'),_0x4d7d13,_0xe523d4[_0x0f55('0x18')]['message']);return _0x5bd1d9(_0xe523d4[_0x0f55('0x18')][_0x0f55('0x1a')]);}logger[_0x0f55('0x18')](_0x0f55('0x13'),_0x4d7d13,_0xe523d4[_0x0f55('0x18')][_0x0f55('0x1a')]);return _0x528ac1(_0xe523d4[_0x0f55('0x18')][_0x0f55('0x1a')]);}else{logger[_0x0f55('0x12')](_0x0f55('0x13'),_0x4d7d13,_0x0f55('0x14'));_0x528ac1(_0xe523d4[_0x0f55('0x1b')][_0x0f55('0x1a')]);}})[_0x0f55('0x1c')](function(_0x18cb19){logger['error'](_0x0f55('0x13'),_0x4d7d13,_0x18cb19);_0x5bd1d9(_0x18cb19);});});}