da3fad88050451dfd5f8bb195dba74fb7483ce9f
[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 _0xe61d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment'];(function(_0x2f1205,_0x2303d7){var _0x2db2ab=function(_0x3ff6b4){while(--_0x3ff6b4){_0x2f1205['push'](_0x2f1205['shift']());}};_0x2db2ab(++_0x2303d7);}(_0xe61d,0x10b));var _0xde61=function(_0x5c82a9,_0x12cd7a){_0x5c82a9=_0x5c82a9-0x0;var _0x13880d=_0xe61d[_0x5c82a9];return _0x13880d;};'use strict';var _=require(_0xde61('0x0'));var util=require(_0xde61('0x1'));var moment=require(_0xde61('0x2'));var BPromise=require(_0xde61('0x3'));var rs=require(_0xde61('0x4'));var fs=require('fs');var Redis=require(_0xde61('0x5'));var db=require(_0xde61('0x6'))['db'];var utils=require(_0xde61('0x7'));var logger=require(_0xde61('0x8'))('rpc');var config=require(_0xde61('0x9'));var jayson=require(_0xde61('0xa'));var client=jayson[_0xde61('0xb')][_0xde61('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0xde61('0xd')],{'host':_0xde61('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xde61('0xd')]));require(_0xde61('0xf'))['register'](socket);function respondWithRpcPromise(_0x5b4f2f,_0x6efb93,_0x296ed8){return new BPromise(function(_0x1e8ac8,_0x1a0590){return client[_0xde61('0x10')](_0x5b4f2f,_0x296ed8)[_0xde61('0x11')](function(_0x41e7a3){logger[_0xde61('0x12')](_0xde61('0x13'),_0x6efb93,_0xde61('0x14'));logger[_0xde61('0x15')](_0xde61('0x16'),_0x6efb93,'request\x20sent',JSON['stringify'](_0x41e7a3));if(_0x41e7a3[_0xde61('0x17')]){if(_0x41e7a3['error']['code']===0x1f4){logger[_0xde61('0x17')](_0xde61('0x13'),_0x6efb93,_0x41e7a3[_0xde61('0x17')][_0xde61('0x18')]);return _0x1a0590(_0x41e7a3['error'][_0xde61('0x18')]);}logger['error'](_0xde61('0x13'),_0x6efb93,_0x41e7a3[_0xde61('0x17')][_0xde61('0x18')]);return _0x1e8ac8(_0x41e7a3[_0xde61('0x17')][_0xde61('0x18')]);}else{logger[_0xde61('0x12')](_0xde61('0x13'),_0x6efb93,_0xde61('0x14'));_0x1e8ac8(_0x41e7a3[_0xde61('0x19')][_0xde61('0x18')]);}})[_0xde61('0x1a')](function(_0x51c432){logger[_0xde61('0x17')](_0xde61('0x13'),_0x6efb93,_0x51c432);_0x1a0590(_0x51c432);});});}