0083dc6631b2244cff639c127eef4a322556a79d
[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 _0x1bc1=['info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then'];(function(_0x112182,_0x5da656){var _0x210661=function(_0x37001c){while(--_0x37001c){_0x112182['push'](_0x112182['shift']());}};_0x210661(++_0x5da656);}(_0x1bc1,0xea));var _0x11bc=function(_0x4146ef,_0x1b007b){_0x4146ef=_0x4146ef-0x0;var _0x2998f9=_0x1bc1[_0x4146ef];return _0x2998f9;};'use strict';var _=require(_0x11bc('0x0'));var util=require(_0x11bc('0x1'));var moment=require(_0x11bc('0x2'));var BPromise=require(_0x11bc('0x3'));var rs=require(_0x11bc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x11bc('0x5'))['db'];var utils=require(_0x11bc('0x6'));var logger=require(_0x11bc('0x7'))(_0x11bc('0x8'));var config=require('../../config/environment');var jayson=require(_0x11bc('0x9'));var client=jayson[_0x11bc('0xa')][_0x11bc('0xb')]({'port':0x232a});config[_0x11bc('0xc')]=_[_0x11bc('0xd')](config[_0x11bc('0xc')],{'host':_0x11bc('0xe'),'port':0x18eb});var socket=require(_0x11bc('0xf'))(new Redis(config[_0x11bc('0xc')]));require('./dashboard.socket')[_0x11bc('0x10')](socket);function respondWithRpcPromise(_0xcb96f8,_0x5ab709,_0x5cb346){return new BPromise(function(_0xc6014c,_0x6eb21f){return client['request'](_0xcb96f8,_0x5cb346)[_0x11bc('0x11')](function(_0x1e1e8b){logger[_0x11bc('0x12')](_0x11bc('0x13'),_0x5ab709,_0x11bc('0x14'));logger[_0x11bc('0x15')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x5ab709,'request\x20sent',JSON[_0x11bc('0x16')](_0x1e1e8b));if(_0x1e1e8b[_0x11bc('0x17')]){if(_0x1e1e8b[_0x11bc('0x17')][_0x11bc('0x18')]===0x1f4){logger[_0x11bc('0x17')]('Dashboard,\x20%s,\x20%s',_0x5ab709,_0x1e1e8b['error'][_0x11bc('0x19')]);return _0x6eb21f(_0x1e1e8b[_0x11bc('0x17')][_0x11bc('0x19')]);}logger[_0x11bc('0x17')](_0x11bc('0x13'),_0x5ab709,_0x1e1e8b[_0x11bc('0x17')][_0x11bc('0x19')]);return _0xc6014c(_0x1e1e8b[_0x11bc('0x17')][_0x11bc('0x19')]);}else{logger[_0x11bc('0x12')]('Dashboard,\x20%s,\x20%s',_0x5ab709,_0x11bc('0x14'));_0xc6014c(_0x1e1e8b[_0x11bc('0x1a')][_0x11bc('0x19')]);}})[_0x11bc('0x1b')](function(_0x3dc786){logger[_0x11bc('0x17')]('Dashboard,\x20%s,\x20%s',_0x5ab709,_0x3dc786);_0x6eb21f(_0x3dc786);});});}