0ccfed37dd18a4d11c79d60adaf644ba12aa217f
[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 _0xcd5e=['localhost','redis','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xcd5e,0x15f));var _0xecd5=function(_0x310db7,_0x53e37f){_0x310db7=_0x310db7-0x0;var _0x206615=_0xcd5e[_0x310db7];return _0x206615;};'use strict';var _=require(_0xecd5('0x0'));var util=require(_0xecd5('0x1'));var moment=require('moment');var BPromise=require(_0xecd5('0x2'));var rs=require(_0xecd5('0x3'));var fs=require('fs');var Redis=require(_0xecd5('0x4'));var db=require(_0xecd5('0x5'))['db'];var utils=require(_0xecd5('0x6'));var logger=require(_0xecd5('0x7'))(_0xecd5('0x8'));var config=require(_0xecd5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xecd5('0xa')][_0xecd5('0xb')]({'port':0x232a});config['redis']=_[_0xecd5('0xc')](config['redis'],{'host':_0xecd5('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xecd5('0xe')]));require('./dashboardItem.socket')[_0xecd5('0xf')](socket);function respondWithRpcPromise(_0x1769d6,_0x10b5ae,_0x1b54de){return new BPromise(function(_0x1bf456,_0x68721e){return client[_0xecd5('0x10')](_0x1769d6,_0x1b54de)[_0xecd5('0x11')](function(_0x563e81){logger[_0xecd5('0x12')](_0xecd5('0x13'),_0x10b5ae,_0xecd5('0x14'));logger['debug'](_0xecd5('0x15'),_0x10b5ae,_0xecd5('0x14'),JSON[_0xecd5('0x16')](_0x563e81));if(_0x563e81[_0xecd5('0x17')]){if(_0x563e81[_0xecd5('0x17')][_0xecd5('0x18')]===0x1f4){logger[_0xecd5('0x17')](_0xecd5('0x13'),_0x10b5ae,_0x563e81[_0xecd5('0x17')][_0xecd5('0x19')]);return _0x68721e(_0x563e81[_0xecd5('0x17')]['message']);}logger[_0xecd5('0x17')](_0xecd5('0x13'),_0x10b5ae,_0x563e81[_0xecd5('0x17')][_0xecd5('0x19')]);return _0x1bf456(_0x563e81[_0xecd5('0x17')]['message']);}else{logger['info'](_0xecd5('0x13'),_0x10b5ae,_0xecd5('0x14'));_0x1bf456(_0x563e81[_0xecd5('0x1a')][_0xecd5('0x19')]);}})[_0xecd5('0x1b')](function(_0x4887d5){logger[_0xecd5('0x17')]('DashboardItem,\x20%s,\x20%s',_0x10b5ae,_0x4887d5);_0x68721e(_0x4887d5);});});}