9b458a7ce2e83510f3e33b3d050e7587fb6276a3
[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 _0xd771=['result','catch','lodash','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x31991b,_0xaf75d2){var _0x307304=function(_0x2f36c5){while(--_0x2f36c5){_0x31991b['push'](_0x31991b['shift']());}};_0x307304(++_0xaf75d2);}(_0xd771,0x7a));var _0x1d77=function(_0x4622b8,_0x1f8c65){_0x4622b8=_0x4622b8-0x0;var _0x24ed84=_0xd771[_0x4622b8];return _0x24ed84;};'use strict';var _=require(_0x1d77('0x0'));var util=require('util');var moment=require(_0x1d77('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1d77('0x2'));var logger=require(_0x1d77('0x3'))(_0x1d77('0x4'));var config=require(_0x1d77('0x5'));var jayson=require(_0x1d77('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x1d77('0x7')]=_[_0x1d77('0x8')](config[_0x1d77('0x7')],{'host':_0x1d77('0x9'),'port':0x18eb});var socket=require(_0x1d77('0xa'))(new Redis(config[_0x1d77('0x7')]));require('./dashboard.socket')[_0x1d77('0xb')](socket);function respondWithRpcPromise(_0x1bd340,_0x151565,_0x1dbbc8){return new BPromise(function(_0x57fd1a,_0x51a545){return client[_0x1d77('0xc')](_0x1bd340,_0x1dbbc8)[_0x1d77('0xd')](function(_0x4b39e2){logger[_0x1d77('0xe')](_0x1d77('0xf'),_0x151565,_0x1d77('0x10'));logger['debug'](_0x1d77('0x11'),_0x151565,'request\x20sent',JSON[_0x1d77('0x12')](_0x4b39e2));if(_0x4b39e2['error']){if(_0x4b39e2[_0x1d77('0x13')][_0x1d77('0x14')]===0x1f4){logger[_0x1d77('0x13')](_0x1d77('0xf'),_0x151565,_0x4b39e2[_0x1d77('0x13')][_0x1d77('0x15')]);return _0x51a545(_0x4b39e2[_0x1d77('0x13')][_0x1d77('0x15')]);}logger[_0x1d77('0x13')](_0x1d77('0xf'),_0x151565,_0x4b39e2[_0x1d77('0x13')]['message']);return _0x57fd1a(_0x4b39e2[_0x1d77('0x13')][_0x1d77('0x15')]);}else{logger[_0x1d77('0xe')](_0x1d77('0xf'),_0x151565,_0x1d77('0x10'));_0x57fd1a(_0x4b39e2[_0x1d77('0x16')][_0x1d77('0x15')]);}})[_0x1d77('0x17')](function(_0x133b61){logger[_0x1d77('0x13')](_0x1d77('0xf'),_0x151565,_0x133b61);_0x51a545(_0x133b61);});});}