Built motion from commit 85328c08.|2.5.50
[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 _0x6c49=['message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','./dashboardItem.socket','register','request','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x58eeba,_0x48e6c3){var _0x15aa6e=function(_0x4801bf){while(--_0x4801bf){_0x58eeba['push'](_0x58eeba['shift']());}};_0x15aa6e(++_0x48e6c3);}(_0x6c49,0xfd));var _0x96c4=function(_0x526f3e,_0x2a2a5d){_0x526f3e=_0x526f3e-0x0;var _0x34b218=_0x6c49[_0x526f3e];return _0x34b218;};'use strict';var _=require(_0x96c4('0x0'));var util=require(_0x96c4('0x1'));var moment=require('moment');var BPromise=require(_0x96c4('0x2'));var rs=require(_0x96c4('0x3'));var fs=require('fs');var Redis=require(_0x96c4('0x4'));var db=require(_0x96c4('0x5'))['db'];var utils=require(_0x96c4('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x96c4('0x7'));var jayson=require(_0x96c4('0x8'));var client=jayson[_0x96c4('0x9')][_0x96c4('0xa')]({'port':0x232a});config[_0x96c4('0xb')]=_[_0x96c4('0xc')](config[_0x96c4('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x96c4('0xd'))[_0x96c4('0xe')](socket);function respondWithRpcPromise(_0x5f396c,_0x4c0359,_0x3e4932){return new BPromise(function(_0xd3ee6f,_0x402f0d){return client[_0x96c4('0xf')](_0x5f396c,_0x3e4932)['then'](function(_0x23c614){logger['info'](_0x96c4('0x10'),_0x4c0359,_0x96c4('0x11'));logger['debug'](_0x96c4('0x12'),_0x4c0359,_0x96c4('0x11'),JSON[_0x96c4('0x13')](_0x23c614));if(_0x23c614[_0x96c4('0x14')]){if(_0x23c614['error'][_0x96c4('0x15')]===0x1f4){logger[_0x96c4('0x14')](_0x96c4('0x10'),_0x4c0359,_0x23c614['error']['message']);return _0x402f0d(_0x23c614['error'][_0x96c4('0x16')]);}logger[_0x96c4('0x14')](_0x96c4('0x10'),_0x4c0359,_0x23c614[_0x96c4('0x14')][_0x96c4('0x16')]);return _0xd3ee6f(_0x23c614[_0x96c4('0x14')][_0x96c4('0x16')]);}else{logger[_0x96c4('0x17')](_0x96c4('0x10'),_0x4c0359,_0x96c4('0x11'));_0xd3ee6f(_0x23c614[_0x96c4('0x18')][_0x96c4('0x16')]);}})['catch'](function(_0x104cff){logger['error']('DashboardItem,\x20%s,\x20%s',_0x4c0359,_0x104cff);_0x402f0d(_0x104cff);});});}