Built motion from commit a61a4a20.|2.5.46
[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 _0xac59=['stringify','error','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xac59,0xa5));var _0x9ac5=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xac59[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x9ac5('0x0'));var util=require(_0x9ac5('0x1'));var moment=require(_0x9ac5('0x2'));var BPromise=require('bluebird');var rs=require(_0x9ac5('0x3'));var fs=require('fs');var Redis=require(_0x9ac5('0x4'));var db=require(_0x9ac5('0x5'))['db'];var utils=require(_0x9ac5('0x6'));var logger=require('../../config/logger')(_0x9ac5('0x7'));var config=require(_0x9ac5('0x8'));var jayson=require(_0x9ac5('0x9'));var client=jayson[_0x9ac5('0xa')][_0x9ac5('0xb')]({'port':0x232a});config[_0x9ac5('0xc')]=_[_0x9ac5('0xd')](config['redis'],{'host':_0x9ac5('0xe'),'port':0x18eb});var socket=require(_0x9ac5('0xf'))(new Redis(config[_0x9ac5('0xc')]));require('./dashboardItem.socket')[_0x9ac5('0x10')](socket);function respondWithRpcPromise(_0x17a513,_0xa0e25e,_0x4461b9){return new BPromise(function(_0x52a815,_0x7f02e9){return client[_0x9ac5('0x11')](_0x17a513,_0x4461b9)[_0x9ac5('0x12')](function(_0x148bf5){logger[_0x9ac5('0x13')](_0x9ac5('0x14'),_0xa0e25e,'request\x20sent');logger[_0x9ac5('0x15')](_0x9ac5('0x16'),_0xa0e25e,_0x9ac5('0x17'),JSON[_0x9ac5('0x18')](_0x148bf5));if(_0x148bf5[_0x9ac5('0x19')]){if(_0x148bf5['error']['code']===0x1f4){logger[_0x9ac5('0x19')]('DashboardItem,\x20%s,\x20%s',_0xa0e25e,_0x148bf5[_0x9ac5('0x19')][_0x9ac5('0x1a')]);return _0x7f02e9(_0x148bf5[_0x9ac5('0x19')][_0x9ac5('0x1a')]);}logger[_0x9ac5('0x19')](_0x9ac5('0x14'),_0xa0e25e,_0x148bf5[_0x9ac5('0x19')]['message']);return _0x52a815(_0x148bf5[_0x9ac5('0x19')][_0x9ac5('0x1a')]);}else{logger['info'](_0x9ac5('0x14'),_0xa0e25e,'request\x20sent');_0x52a815(_0x148bf5['result'][_0x9ac5('0x1a')]);}})['catch'](function(_0x5f23ed){logger[_0x9ac5('0x19')](_0x9ac5('0x14'),_0xa0e25e,_0x5f23ed);_0x7f02e9(_0x5f23ed);});});}