c88c0a8716b64777aa30cd13d530c062a358335b
[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 _0x2705=['localhost','./dashboard.socket','register','request','then','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','Dashboard,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults'];(function(_0x1de42f,_0x360043){var _0x5a9ac4=function(_0x1141a9){while(--_0x1141a9){_0x1de42f['push'](_0x1de42f['shift']());}};_0x5a9ac4(++_0x360043);}(_0x2705,0x11d));var _0x5270=function(_0x1cc9f7,_0x3f250c){_0x1cc9f7=_0x1cc9f7-0x0;var _0x52257a=_0x2705[_0x1cc9f7];return _0x52257a;};'use strict';var _=require(_0x5270('0x0'));var util=require(_0x5270('0x1'));var moment=require(_0x5270('0x2'));var BPromise=require(_0x5270('0x3'));var rs=require(_0x5270('0x4'));var fs=require('fs');var Redis=require(_0x5270('0x5'));var db=require(_0x5270('0x6'))['db'];var utils=require(_0x5270('0x7'));var logger=require(_0x5270('0x8'))(_0x5270('0x9'));var config=require(_0x5270('0xa'));var jayson=require(_0x5270('0xb'));var client=jayson[_0x5270('0xc')]['http']({'port':0x232a});config[_0x5270('0xd')]=_[_0x5270('0xe')](config['redis'],{'host':_0x5270('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5270('0xd')]));require(_0x5270('0x10'))[_0x5270('0x11')](socket);function respondWithRpcPromise(_0x58610f,_0x327167,_0x46111e){return new BPromise(function(_0x194305,_0x5757aa){return client[_0x5270('0x12')](_0x58610f,_0x46111e)[_0x5270('0x13')](function(_0x18e37e){logger['info']('Dashboard,\x20%s,\x20%s',_0x327167,_0x5270('0x14'));logger[_0x5270('0x15')](_0x5270('0x16'),_0x327167,'request\x20sent',JSON['stringify'](_0x18e37e));if(_0x18e37e[_0x5270('0x17')]){if(_0x18e37e[_0x5270('0x17')][_0x5270('0x18')]===0x1f4){logger[_0x5270('0x17')]('Dashboard,\x20%s,\x20%s',_0x327167,_0x18e37e['error'][_0x5270('0x19')]);return _0x5757aa(_0x18e37e[_0x5270('0x17')][_0x5270('0x19')]);}logger[_0x5270('0x17')](_0x5270('0x1a'),_0x327167,_0x18e37e[_0x5270('0x17')][_0x5270('0x19')]);return _0x194305(_0x18e37e[_0x5270('0x17')][_0x5270('0x19')]);}else{logger[_0x5270('0x1b')](_0x5270('0x1a'),_0x327167,_0x5270('0x14'));_0x194305(_0x18e37e[_0x5270('0x1c')][_0x5270('0x19')]);}})[_0x5270('0x1d')](function(_0xdd3a0d){logger[_0x5270('0x17')](_0x5270('0x1a'),_0x327167,_0xdd3a0d);_0x5757aa(_0xdd3a0d);});});}