6a2825901fb439a18d68557321f7c7522e37199a
[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 _0x4927=['request','then','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register'];(function(_0x3b9083,_0x2d2b2e){var _0x2ac587=function(_0x173826){while(--_0x173826){_0x3b9083['push'](_0x3b9083['shift']());}};_0x2ac587(++_0x2d2b2e);}(_0x4927,0x122));var _0x7492=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4927[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7492('0x0'));var util=require(_0x7492('0x1'));var moment=require(_0x7492('0x2'));var BPromise=require(_0x7492('0x3'));var rs=require(_0x7492('0x4'));var fs=require('fs');var Redis=require(_0x7492('0x5'));var db=require(_0x7492('0x6'))['db'];var utils=require(_0x7492('0x7'));var logger=require(_0x7492('0x8'))(_0x7492('0x9'));var config=require(_0x7492('0xa'));var jayson=require(_0x7492('0xb'));var client=jayson[_0x7492('0xc')][_0x7492('0xd')]({'port':0x232a});config[_0x7492('0xe')]=_[_0x7492('0xf')](config[_0x7492('0xe')],{'host':_0x7492('0x10'),'port':0x18eb});var socket=require(_0x7492('0x11'))(new Redis(config[_0x7492('0xe')]));require(_0x7492('0x12'))[_0x7492('0x13')](socket);function respondWithRpcPromise(_0x5b7ecb,_0x1f17fe,_0x12300b){return new BPromise(function(_0x1aa9f6,_0x368033){return client[_0x7492('0x14')](_0x5b7ecb,_0x12300b)[_0x7492('0x15')](function(_0x533f59){logger[_0x7492('0x16')](_0x7492('0x17'),_0x1f17fe,'request\x20sent');logger[_0x7492('0x18')](_0x7492('0x19'),_0x1f17fe,_0x7492('0x1a'),JSON[_0x7492('0x1b')](_0x533f59));if(_0x533f59[_0x7492('0x1c')]){if(_0x533f59[_0x7492('0x1c')]['code']===0x1f4){logger[_0x7492('0x1c')](_0x7492('0x17'),_0x1f17fe,_0x533f59[_0x7492('0x1c')]['message']);return _0x368033(_0x533f59[_0x7492('0x1c')][_0x7492('0x1d')]);}logger[_0x7492('0x1c')]('Dashboard,\x20%s,\x20%s',_0x1f17fe,_0x533f59['error'][_0x7492('0x1d')]);return _0x1aa9f6(_0x533f59[_0x7492('0x1c')][_0x7492('0x1d')]);}else{logger[_0x7492('0x16')](_0x7492('0x17'),_0x1f17fe,_0x7492('0x1a'));_0x1aa9f6(_0x533f59[_0x7492('0x1e')][_0x7492('0x1d')]);}})['catch'](function(_0x3eafcf){logger[_0x7492('0x1c')](_0x7492('0x17'),_0x1f17fe,_0x3eafcf);_0x368033(_0x3eafcf);});});}