Built motion from commit (unavailable).|2.5.2
[motion2.git] / server / api / dashboardItem / dashboardItem.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 _0x0458=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','defaults','redis','./dashboardItem.socket','register','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash'];(function(_0x9d639c,_0x524dbe){var _0x1671de=function(_0x27888e){while(--_0x27888e){_0x9d639c['push'](_0x9d639c['shift']());}};_0x1671de(++_0x524dbe);}(_0x0458,0x17b));var _0x8045=function(_0x4e6665,_0x4f6947){_0x4e6665=_0x4e6665-0x0;var _0xdb1dd3=_0x0458[_0x4e6665];return _0xdb1dd3;};'use strict';var _=require(_0x8045('0x0'));var util=require(_0x8045('0x1'));var moment=require(_0x8045('0x2'));var BPromise=require(_0x8045('0x3'));var rs=require(_0x8045('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8045('0x5'))['db'];var utils=require(_0x8045('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x8045('0x7')](config[_0x8045('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8045('0x8')]));require(_0x8045('0x9'))[_0x8045('0xa')](socket);function respondWithRpcPromise(_0x585f76,_0x19c005,_0x76e4ee){return new BPromise(function(_0x41b0e0,_0x7c4247){return client['request'](_0x585f76,_0x76e4ee)['then'](function(_0xf0c46d){logger['info'](_0x8045('0xb'),_0x19c005,_0x8045('0xc'));logger['debug'](_0x8045('0xd'),_0x19c005,'request\x20sent',JSON[_0x8045('0xe')](_0xf0c46d));if(_0xf0c46d[_0x8045('0xf')]){if(_0xf0c46d[_0x8045('0xf')]['code']===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0x19c005,_0xf0c46d[_0x8045('0xf')]['message']);return _0x7c4247(_0xf0c46d[_0x8045('0xf')][_0x8045('0x10')]);}logger[_0x8045('0xf')](_0x8045('0xb'),_0x19c005,_0xf0c46d[_0x8045('0xf')]['message']);return _0x41b0e0(_0xf0c46d['error'][_0x8045('0x10')]);}else{logger[_0x8045('0x11')](_0x8045('0xb'),_0x19c005,_0x8045('0xc'));_0x41b0e0(_0xf0c46d[_0x8045('0x12')]['message']);}})[_0x8045('0x13')](function(_0x11da61){logger[_0x8045('0xf')]('DashboardItem,\x20%s,\x20%s',_0x19c005,_0x11da61);_0x7c4247(_0x11da61);});});}