Built motion from commit efa66e19.|2.6.22
[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 _0x7217=['request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','Dashboard,\x20%s,\x20%s'];(function(_0x4854d6,_0x2f1264){var _0x3885c0=function(_0x4d564d){while(--_0x4d564d){_0x4854d6['push'](_0x4854d6['shift']());}};_0x3885c0(++_0x2f1264);}(_0x7217,0x134));var _0x7721=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x7217[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0x7721('0x0'));var util=require(_0x7721('0x1'));var moment=require(_0x7721('0x2'));var BPromise=require(_0x7721('0x3'));var rs=require(_0x7721('0x4'));var fs=require('fs');var Redis=require(_0x7721('0x5'));var db=require(_0x7721('0x6'))['db'];var utils=require(_0x7721('0x7'));var logger=require(_0x7721('0x8'))(_0x7721('0x9'));var config=require(_0x7721('0xa'));var jayson=require(_0x7721('0xb'));var client=jayson[_0x7721('0xc')][_0x7721('0xd')]({'port':0x232a});config['redis']=_[_0x7721('0xe')](config['redis'],{'host':_0x7721('0xf'),'port':0x18eb});var socket=require(_0x7721('0x10'))(new Redis(config['redis']));require(_0x7721('0x11'))[_0x7721('0x12')](socket);function respondWithRpcPromise(_0x1a7bd2,_0x14573d,_0x2ef2b6){return new BPromise(function(_0x467acb,_0x31d7f4){return client[_0x7721('0x13')](_0x1a7bd2,_0x2ef2b6)[_0x7721('0x14')](function(_0xabd834){logger['info'](_0x7721('0x15'),_0x14573d,_0x7721('0x16'));logger[_0x7721('0x17')](_0x7721('0x18'),_0x14573d,_0x7721('0x16'),JSON[_0x7721('0x19')](_0xabd834));if(_0xabd834[_0x7721('0x1a')]){if(_0xabd834[_0x7721('0x1a')][_0x7721('0x1b')]===0x1f4){logger['error'](_0x7721('0x15'),_0x14573d,_0xabd834['error'][_0x7721('0x1c')]);return _0x31d7f4(_0xabd834[_0x7721('0x1a')][_0x7721('0x1c')]);}logger[_0x7721('0x1a')](_0x7721('0x15'),_0x14573d,_0xabd834[_0x7721('0x1a')]['message']);return _0x467acb(_0xabd834[_0x7721('0x1a')][_0x7721('0x1c')]);}else{logger[_0x7721('0x1d')](_0x7721('0x15'),_0x14573d,'request\x20sent');_0x467acb(_0xabd834['result'][_0x7721('0x1c')]);}})['catch'](function(_0x369b34){logger[_0x7721('0x1a')](_0x7721('0x15'),_0x14573d,_0x369b34);_0x31d7f4(_0x369b34);});});}