Built motion from commit 43538d75.|2.5.35
[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 _0x736c=['message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','./dashboardItem.socket','register','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x35e61e,_0x864ec1){var _0x48b478=function(_0x3ac252){while(--_0x3ac252){_0x35e61e['push'](_0x35e61e['shift']());}};_0x48b478(++_0x864ec1);}(_0x736c,0x156));var _0xc736=function(_0xf4add4,_0x5b9cc1){_0xf4add4=_0xf4add4-0x0;var _0x1c42fb=_0x736c[_0xf4add4];return _0x1c42fb;};'use strict';var _=require(_0xc736('0x0'));var util=require(_0xc736('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc736('0x2'));var fs=require('fs');var Redis=require(_0xc736('0x3'));var db=require(_0xc736('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc736('0x5'))(_0xc736('0x6'));var config=require(_0xc736('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc736('0x8')][_0xc736('0x9')]({'port':0x232a});config['redis']=_[_0xc736('0xa')](config[_0xc736('0xb')],{'host':_0xc736('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc736('0xd'))[_0xc736('0xe')](socket);function respondWithRpcPromise(_0x5c4b35,_0x2e7f77,_0x1529b9){return new BPromise(function(_0xb8d889,_0x45fdb6){return client['request'](_0x5c4b35,_0x1529b9)[_0xc736('0xf')](function(_0x3e18cc){logger['info'](_0xc736('0x10'),_0x2e7f77,_0xc736('0x11'));logger[_0xc736('0x12')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x2e7f77,_0xc736('0x11'),JSON[_0xc736('0x13')](_0x3e18cc));if(_0x3e18cc[_0xc736('0x14')]){if(_0x3e18cc[_0xc736('0x14')][_0xc736('0x15')]===0x1f4){logger[_0xc736('0x14')](_0xc736('0x10'),_0x2e7f77,_0x3e18cc[_0xc736('0x14')][_0xc736('0x16')]);return _0x45fdb6(_0x3e18cc[_0xc736('0x14')][_0xc736('0x16')]);}logger['error'](_0xc736('0x10'),_0x2e7f77,_0x3e18cc[_0xc736('0x14')][_0xc736('0x16')]);return _0xb8d889(_0x3e18cc[_0xc736('0x14')][_0xc736('0x16')]);}else{logger[_0xc736('0x17')](_0xc736('0x10'),_0x2e7f77,_0xc736('0x11'));_0xb8d889(_0x3e18cc[_0xc736('0x18')]['message']);}})[_0xc736('0x19')](function(_0x5130ad){logger[_0xc736('0x14')]('DashboardItem,\x20%s,\x20%s',_0x2e7f77,_0x5130ad);_0x45fdb6(_0x5130ad);});});}