Built motion from commit 5ad77b03.|2.6.3
[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 _0x7c26=['stringify','error','code','Dashboard,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','register','request','info','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s'];(function(_0x80e1e8,_0x220149){var _0x9c466f=function(_0x259058){while(--_0x259058){_0x80e1e8['push'](_0x80e1e8['shift']());}};_0x9c466f(++_0x220149);}(_0x7c26,0x83));var _0x67c2=function(_0x3bd792,_0x300fb1){_0x3bd792=_0x3bd792-0x0;var _0x5127fb=_0x7c26[_0x3bd792];return _0x5127fb;};'use strict';var _=require(_0x67c2('0x0'));var util=require(_0x67c2('0x1'));var moment=require(_0x67c2('0x2'));var BPromise=require(_0x67c2('0x3'));var rs=require(_0x67c2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x67c2('0x5'))['db'];var utils=require(_0x67c2('0x6'));var logger=require(_0x67c2('0x7'))(_0x67c2('0x8'));var config=require(_0x67c2('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x67c2('0xa')]({'port':0x232a});config[_0x67c2('0xb')]=_[_0x67c2('0xc')](config[_0x67c2('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x67c2('0xd'))(new Redis(config[_0x67c2('0xb')]));require('./dashboard.socket')[_0x67c2('0xe')](socket);function respondWithRpcPromise(_0x47041d,_0x4df8b3,_0x4d84e8){return new BPromise(function(_0x3ab936,_0x1b56f9){return client[_0x67c2('0xf')](_0x47041d,_0x4d84e8)['then'](function(_0x3538db){logger[_0x67c2('0x10')]('Dashboard,\x20%s,\x20%s',_0x4df8b3,_0x67c2('0x11'));logger['debug'](_0x67c2('0x12'),_0x4df8b3,_0x67c2('0x11'),JSON[_0x67c2('0x13')](_0x3538db));if(_0x3538db[_0x67c2('0x14')]){if(_0x3538db[_0x67c2('0x14')][_0x67c2('0x15')]===0x1f4){logger[_0x67c2('0x14')](_0x67c2('0x16'),_0x4df8b3,_0x3538db['error'][_0x67c2('0x17')]);return _0x1b56f9(_0x3538db[_0x67c2('0x14')][_0x67c2('0x17')]);}logger[_0x67c2('0x14')](_0x67c2('0x16'),_0x4df8b3,_0x3538db['error']['message']);return _0x3ab936(_0x3538db[_0x67c2('0x14')][_0x67c2('0x17')]);}else{logger[_0x67c2('0x10')]('Dashboard,\x20%s,\x20%s',_0x4df8b3,'request\x20sent');_0x3ab936(_0x3538db['result'][_0x67c2('0x17')]);}})[_0x67c2('0x18')](function(_0x1fe162){logger[_0x67c2('0x14')](_0x67c2('0x16'),_0x4df8b3,_0x1fe162);_0x1b56f9(_0x1fe162);});});}