Built motion from commit (unavailable).|2.5.30
[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 _0x79b4=['error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','info','DashboardItem,\x20%s,\x20%s','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x79b4,0x9a));var _0x479b=function(_0x1ccab3,_0x5bbda2){_0x1ccab3=_0x1ccab3-0x0;var _0x410985=_0x79b4[_0x1ccab3];return _0x410985;};'use strict';var _=require(_0x479b('0x0'));var util=require(_0x479b('0x1'));var moment=require(_0x479b('0x2'));var BPromise=require('bluebird');var rs=require(_0x479b('0x3'));var fs=require('fs');var Redis=require(_0x479b('0x4'));var db=require(_0x479b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x479b('0x6'));var jayson=require(_0x479b('0x7'));var client=jayson['client'][_0x479b('0x8')]({'port':0x232a});config[_0x479b('0x9')]=_[_0x479b('0xa')](config[_0x479b('0x9')],{'host':_0x479b('0xb'),'port':0x18eb});var socket=require(_0x479b('0xc'))(new Redis(config['redis']));require(_0x479b('0xd'))[_0x479b('0xe')](socket);function respondWithRpcPromise(_0x1e6716,_0x4be018,_0x3003ef){return new BPromise(function(_0x5424e1,_0x509f86){return client[_0x479b('0xf')](_0x1e6716,_0x3003ef)['then'](function(_0x416f6c){logger[_0x479b('0x10')](_0x479b('0x11'),_0x4be018,'request\x20sent');logger['debug'](_0x479b('0x12'),_0x4be018,_0x479b('0x13'),JSON[_0x479b('0x14')](_0x416f6c));if(_0x416f6c['error']){if(_0x416f6c['error']['code']===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0x4be018,_0x416f6c[_0x479b('0x15')][_0x479b('0x16')]);return _0x509f86(_0x416f6c[_0x479b('0x15')][_0x479b('0x16')]);}logger[_0x479b('0x15')](_0x479b('0x11'),_0x4be018,_0x416f6c['error'][_0x479b('0x16')]);return _0x5424e1(_0x416f6c['error']['message']);}else{logger[_0x479b('0x10')](_0x479b('0x11'),_0x4be018,'request\x20sent');_0x5424e1(_0x416f6c[_0x479b('0x17')][_0x479b('0x16')]);}})[_0x479b('0x18')](function(_0x2bd9af){logger[_0x479b('0x15')](_0x479b('0x11'),_0x4be018,_0x2bd9af);_0x509f86(_0x2bd9af);});});}