d2006f69601368089028335912b29912d0894e64
[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 _0xc860=['./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x513238,_0x1948ef){var _0x508dd0=function(_0x22035e){while(--_0x22035e){_0x513238['push'](_0x513238['shift']());}};_0x508dd0(++_0x1948ef);}(_0xc860,0x70));var _0x0c86=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xc860[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0x0c86('0x0'));var util=require('util');var moment=require(_0x0c86('0x1'));var BPromise=require(_0x0c86('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c86('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0c86('0x4'));var logger=require(_0x0c86('0x5'))('rpc');var config=require(_0x0c86('0x6'));var jayson=require(_0x0c86('0x7'));var client=jayson[_0x0c86('0x8')][_0x0c86('0x9')]({'port':0x232a});config[_0x0c86('0xa')]=_['defaults'](config[_0x0c86('0xa')],{'host':_0x0c86('0xb'),'port':0x18eb});var socket=require(_0x0c86('0xc'))(new Redis(config[_0x0c86('0xa')]));require(_0x0c86('0xd'))[_0x0c86('0xe')](socket);function respondWithRpcPromise(_0x34a1e1,_0x373dce,_0x4360bf){return new BPromise(function(_0x5e164d,_0x16f85b){return client['request'](_0x34a1e1,_0x4360bf)[_0x0c86('0xf')](function(_0x506bda){logger[_0x0c86('0x10')](_0x0c86('0x11'),_0x373dce,_0x0c86('0x12'));logger[_0x0c86('0x13')](_0x0c86('0x14'),_0x373dce,_0x0c86('0x12'),JSON[_0x0c86('0x15')](_0x506bda));if(_0x506bda[_0x0c86('0x16')]){if(_0x506bda[_0x0c86('0x16')]['code']===0x1f4){logger[_0x0c86('0x16')](_0x0c86('0x11'),_0x373dce,_0x506bda[_0x0c86('0x16')][_0x0c86('0x17')]);return _0x16f85b(_0x506bda['error'][_0x0c86('0x17')]);}logger['error'](_0x0c86('0x11'),_0x373dce,_0x506bda[_0x0c86('0x16')][_0x0c86('0x17')]);return _0x5e164d(_0x506bda[_0x0c86('0x16')]['message']);}else{logger[_0x0c86('0x10')](_0x0c86('0x11'),_0x373dce,_0x0c86('0x12'));_0x5e164d(_0x506bda[_0x0c86('0x18')]['message']);}})['catch'](function(_0x279844){logger['error'](_0x0c86('0x11'),_0x373dce,_0x279844);_0x16f85b(_0x279844);});});}