abb2600294ed5d84b580e137a96bb1da2b0284c8
[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 _0x63ec=['request','then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DashboardItem,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket'];(function(_0x5f0290,_0x195613){var _0x46157a=function(_0x5a1ae0){while(--_0x5a1ae0){_0x5f0290['push'](_0x5f0290['shift']());}};_0x46157a(++_0x195613);}(_0x63ec,0x109));var _0xc63e=function(_0x162137,_0x53b113){_0x162137=_0x162137-0x0;var _0x3b9786=_0x63ec[_0x162137];return _0x3b9786;};'use strict';var _=require(_0xc63e('0x0'));var util=require(_0xc63e('0x1'));var moment=require('moment');var BPromise=require(_0xc63e('0x2'));var rs=require(_0xc63e('0x3'));var fs=require('fs');var Redis=require(_0xc63e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc63e('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xc63e('0x6'));var jayson=require(_0xc63e('0x7'));var client=jayson[_0xc63e('0x8')][_0xc63e('0x9')]({'port':0x232a});config[_0xc63e('0xa')]=_[_0xc63e('0xb')](config[_0xc63e('0xa')],{'host':_0xc63e('0xc'),'port':0x18eb});var socket=require(_0xc63e('0xd'))(new Redis(config[_0xc63e('0xa')]));require(_0xc63e('0xe'))['register'](socket);function respondWithRpcPromise(_0x18f3b4,_0x4fc759,_0x1470f0){return new BPromise(function(_0x568dc8,_0x146a99){return client[_0xc63e('0xf')](_0x18f3b4,_0x1470f0)[_0xc63e('0x10')](function(_0x5a93ec){logger[_0xc63e('0x11')]('DashboardItem,\x20%s,\x20%s',_0x4fc759,_0xc63e('0x12'));logger[_0xc63e('0x13')](_0xc63e('0x14'),_0x4fc759,_0xc63e('0x12'),JSON[_0xc63e('0x15')](_0x5a93ec));if(_0x5a93ec[_0xc63e('0x16')]){if(_0x5a93ec['error'][_0xc63e('0x17')]===0x1f4){logger[_0xc63e('0x16')]('DashboardItem,\x20%s,\x20%s',_0x4fc759,_0x5a93ec[_0xc63e('0x16')][_0xc63e('0x18')]);return _0x146a99(_0x5a93ec['error'][_0xc63e('0x18')]);}logger[_0xc63e('0x16')](_0xc63e('0x19'),_0x4fc759,_0x5a93ec[_0xc63e('0x16')][_0xc63e('0x18')]);return _0x568dc8(_0x5a93ec[_0xc63e('0x16')]['message']);}else{logger[_0xc63e('0x11')](_0xc63e('0x19'),_0x4fc759,'request\x20sent');_0x568dc8(_0x5a93ec[_0xc63e('0x1a')]['message']);}})[_0xc63e('0x1b')](function(_0x22ed60){logger[_0xc63e('0x16')](_0xc63e('0x19'),_0x4fc759,_0x22ed60);_0x146a99(_0x22ed60);});});}