Built motion from commit (unavailable).|2.5.0
[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 _0x4e07=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./dashboardItem.socket','register','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x58582f,_0x447380){var _0x35ae78=function(_0x1db019){while(--_0x1db019){_0x58582f['push'](_0x58582f['shift']());}};_0x35ae78(++_0x447380);}(_0x4e07,0xcc));var _0x74e0=function(_0x4af713,_0x540f7d){_0x4af713=_0x4af713-0x0;var _0x41a1ec=_0x4e07[_0x4af713];return _0x41a1ec;};'use strict';var _=require(_0x74e0('0x0'));var util=require('util');var moment=require(_0x74e0('0x1'));var BPromise=require(_0x74e0('0x2'));var rs=require(_0x74e0('0x3'));var fs=require('fs');var Redis=require(_0x74e0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x74e0('0x5'));var logger=require(_0x74e0('0x6'))(_0x74e0('0x7'));var config=require(_0x74e0('0x8'));var jayson=require(_0x74e0('0x9'));var client=jayson[_0x74e0('0xa')][_0x74e0('0xb')]({'port':0x232a});config[_0x74e0('0xc')]=_['defaults'](config[_0x74e0('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x74e0('0xd'))(new Redis(config[_0x74e0('0xc')]));require(_0x74e0('0xe'))[_0x74e0('0xf')](socket);function respondWithRpcPromise(_0xc9f4d3,_0x561328,_0x568b2b){return new BPromise(function(_0x4e7903,_0x49bf50){return client[_0x74e0('0x10')](_0xc9f4d3,_0x568b2b)['then'](function(_0x117671){logger[_0x74e0('0x11')](_0x74e0('0x12'),_0x561328,_0x74e0('0x13'));logger['debug'](_0x74e0('0x14'),_0x561328,'request\x20sent',JSON[_0x74e0('0x15')](_0x117671));if(_0x117671[_0x74e0('0x16')]){if(_0x117671[_0x74e0('0x16')]['code']===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0x561328,_0x117671['error']['message']);return _0x49bf50(_0x117671[_0x74e0('0x16')]['message']);}logger[_0x74e0('0x16')]('DashboardItem,\x20%s,\x20%s',_0x561328,_0x117671['error']['message']);return _0x4e7903(_0x117671['error'][_0x74e0('0x17')]);}else{logger['info'](_0x74e0('0x12'),_0x561328,'request\x20sent');_0x4e7903(_0x117671[_0x74e0('0x18')][_0x74e0('0x17')]);}})[_0x74e0('0x19')](function(_0x3b9252){logger[_0x74e0('0x16')](_0x74e0('0x12'),_0x561328,_0x3b9252);_0x49bf50(_0x3b9252);});});}