b0eea88e88a6b6026c9c0b2c5a7057592b50e542
[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 _0xa8a8=['redis','defaults','localhost','socket.io-emitter','request','then','info','request\x20sent','debug','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http'];(function(_0x2c16e1,_0x3ef6d0){var _0x1108b2=function(_0x2b900b){while(--_0x2b900b){_0x2c16e1['push'](_0x2c16e1['shift']());}};_0x1108b2(++_0x3ef6d0);}(_0xa8a8,0x155));var _0x8a8a=function(_0x26e499,_0x30ec10){_0x26e499=_0x26e499-0x0;var _0x2b1dbe=_0xa8a8[_0x26e499];return _0x2b1dbe;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var moment=require(_0x8a8a('0x2'));var BPromise=require('bluebird');var rs=require(_0x8a8a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8a8a('0x4'))['db'];var utils=require(_0x8a8a('0x5'));var logger=require('../../config/logger')(_0x8a8a('0x6'));var config=require('../../config/environment');var jayson=require(_0x8a8a('0x7'));var client=jayson['client'][_0x8a8a('0x8')]({'port':0x232a});config[_0x8a8a('0x9')]=_[_0x8a8a('0xa')](config['redis'],{'host':_0x8a8a('0xb'),'port':0x18eb});var socket=require(_0x8a8a('0xc'))(new Redis(config[_0x8a8a('0x9')]));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x50bf45,_0x350d7e,_0xf071aa){return new BPromise(function(_0x456cec,_0xb33b90){return client[_0x8a8a('0xd')](_0x50bf45,_0xf071aa)[_0x8a8a('0xe')](function(_0x2989d8){logger[_0x8a8a('0xf')]('DashboardItem,\x20%s,\x20%s',_0x350d7e,_0x8a8a('0x10'));logger[_0x8a8a('0x11')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x350d7e,_0x8a8a('0x10'),JSON[_0x8a8a('0x12')](_0x2989d8));if(_0x2989d8[_0x8a8a('0x13')]){if(_0x2989d8['error'][_0x8a8a('0x14')]===0x1f4){logger[_0x8a8a('0x13')](_0x8a8a('0x15'),_0x350d7e,_0x2989d8['error']['message']);return _0xb33b90(_0x2989d8[_0x8a8a('0x13')][_0x8a8a('0x16')]);}logger[_0x8a8a('0x13')](_0x8a8a('0x15'),_0x350d7e,_0x2989d8[_0x8a8a('0x13')][_0x8a8a('0x16')]);return _0x456cec(_0x2989d8['error'][_0x8a8a('0x16')]);}else{logger[_0x8a8a('0xf')](_0x8a8a('0x15'),_0x350d7e,'request\x20sent');_0x456cec(_0x2989d8[_0x8a8a('0x17')][_0x8a8a('0x16')]);}})[_0x8a8a('0x18')](function(_0x39cf97){logger[_0x8a8a('0x13')]('DashboardItem,\x20%s,\x20%s',_0x350d7e,_0x39cf97);_0xb33b90(_0x39cf97);});});}