cfec735fc115ce94b490b4ce7745ada77c77d8b5
[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 _0x975a=['socket.io-emitter','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x271798,_0x29b3e9){var _0x138905=function(_0x24e55f){while(--_0x24e55f){_0x271798['push'](_0x271798['shift']());}};_0x138905(++_0x29b3e9);}(_0x975a,0x142));var _0xa975=function(_0x4dfb57,_0x563264){_0x4dfb57=_0x4dfb57-0x0;var _0x243f1e=_0x975a[_0x4dfb57];return _0x243f1e;};'use strict';var _=require(_0xa975('0x0'));var util=require(_0xa975('0x1'));var moment=require(_0xa975('0x2'));var BPromise=require(_0xa975('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa975('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa975('0x5'));var logger=require('../../config/logger')(_0xa975('0x6'));var config=require(_0xa975('0x7'));var jayson=require(_0xa975('0x8'));var client=jayson[_0xa975('0x9')][_0xa975('0xa')]({'port':0x232a});config[_0xa975('0xb')]=_[_0xa975('0xc')](config[_0xa975('0xb')],{'host':_0xa975('0xd'),'port':0x18eb});var socket=require(_0xa975('0xe'))(new Redis(config[_0xa975('0xb')]));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x23e8a7,_0x52ce47,_0x4091f1){return new BPromise(function(_0x16f94c,_0x1192fb){return client['request'](_0x23e8a7,_0x4091f1)['then'](function(_0x45c8e){logger[_0xa975('0xf')](_0xa975('0x10'),_0x52ce47,_0xa975('0x11'));logger['debug'](_0xa975('0x12'),_0x52ce47,_0xa975('0x11'),JSON['stringify'](_0x45c8e));if(_0x45c8e['error']){if(_0x45c8e[_0xa975('0x13')][_0xa975('0x14')]===0x1f4){logger[_0xa975('0x13')]('Dashboard,\x20%s,\x20%s',_0x52ce47,_0x45c8e[_0xa975('0x13')]['message']);return _0x1192fb(_0x45c8e['error'][_0xa975('0x15')]);}logger[_0xa975('0x13')](_0xa975('0x10'),_0x52ce47,_0x45c8e[_0xa975('0x13')][_0xa975('0x15')]);return _0x16f94c(_0x45c8e['error'][_0xa975('0x15')]);}else{logger[_0xa975('0xf')](_0xa975('0x10'),_0x52ce47,_0xa975('0x11'));_0x16f94c(_0x45c8e[_0xa975('0x16')][_0xa975('0x15')]);}})[_0xa975('0x17')](function(_0x19cbf4){logger['error'](_0xa975('0x10'),_0x52ce47,_0x19cbf4);_0x1192fb(_0x19cbf4);});});}