Built motion from commit b5413ace.|2.6.9
[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 _0x05d6=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','catch','moment','bluebird','randomstring','ioredis'];(function(_0x7abd7,_0x1ca3f9){var _0x3a2577=function(_0x18456d){while(--_0x18456d){_0x7abd7['push'](_0x7abd7['shift']());}};_0x3a2577(++_0x1ca3f9);}(_0x05d6,0xc2));var _0x605d=function(_0x33b374,_0xc44a1c){_0x33b374=_0x33b374-0x0;var _0x4792aa=_0x05d6[_0x33b374];return _0x4792aa;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x605d('0x0'));var BPromise=require(_0x605d('0x1'));var rs=require(_0x605d('0x2'));var fs=require('fs');var Redis=require(_0x605d('0x3'));var db=require(_0x605d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x605d('0x5'))(_0x605d('0x6'));var config=require(_0x605d('0x7'));var jayson=require(_0x605d('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x605d('0x9')]=_[_0x605d('0xa')](config[_0x605d('0x9')],{'host':_0x605d('0xb'),'port':0x18eb});var socket=require(_0x605d('0xc'))(new Redis(config[_0x605d('0x9')]));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x810284,_0x47d3e1,_0x573f81){return new BPromise(function(_0x105503,_0x317c42){return client['request'](_0x810284,_0x573f81)[_0x605d('0xd')](function(_0x39cc55){logger['info'](_0x605d('0xe'),_0x47d3e1,_0x605d('0xf'));logger[_0x605d('0x10')](_0x605d('0x11'),_0x47d3e1,_0x605d('0xf'),JSON['stringify'](_0x39cc55));if(_0x39cc55[_0x605d('0x12')]){if(_0x39cc55['error'][_0x605d('0x13')]===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0x47d3e1,_0x39cc55[_0x605d('0x12')][_0x605d('0x14')]);return _0x317c42(_0x39cc55['error'][_0x605d('0x14')]);}logger[_0x605d('0x12')](_0x605d('0xe'),_0x47d3e1,_0x39cc55[_0x605d('0x12')][_0x605d('0x14')]);return _0x105503(_0x39cc55[_0x605d('0x12')][_0x605d('0x14')]);}else{logger['info'](_0x605d('0xe'),_0x47d3e1,'request\x20sent');_0x105503(_0x39cc55['result'][_0x605d('0x14')]);}})[_0x605d('0x15')](function(_0x48ca92){logger['error'](_0x605d('0xe'),_0x47d3e1,_0x48ca92);_0x317c42(_0x48ca92);});});}