Built motion from commit e1760111.|2.6.18
[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 _0x0973=['localhost','socket.io-emitter','./dashboardItem.socket','register','then','info','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x24fbc1,_0x42a096){var _0x5b03bd=function(_0xa728f3){while(--_0xa728f3){_0x24fbc1['push'](_0x24fbc1['shift']());}};_0x5b03bd(++_0x42a096);}(_0x0973,0x7a));var _0x3097=function(_0x23ae05,_0x26148e){_0x23ae05=_0x23ae05-0x0;var _0x2ff6d1=_0x0973[_0x23ae05];return _0x2ff6d1;};'use strict';var _=require(_0x3097('0x0'));var util=require(_0x3097('0x1'));var moment=require(_0x3097('0x2'));var BPromise=require(_0x3097('0x3'));var rs=require(_0x3097('0x4'));var fs=require('fs');var Redis=require(_0x3097('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3097('0x6'));var config=require(_0x3097('0x7'));var jayson=require(_0x3097('0x8'));var client=jayson[_0x3097('0x9')][_0x3097('0xa')]({'port':0x232a});config[_0x3097('0xb')]=_[_0x3097('0xc')](config[_0x3097('0xb')],{'host':_0x3097('0xd'),'port':0x18eb});var socket=require(_0x3097('0xe'))(new Redis(config[_0x3097('0xb')]));require(_0x3097('0xf'))[_0x3097('0x10')](socket);function respondWithRpcPromise(_0x55dca8,_0x15e80c,_0x3684e7){return new BPromise(function(_0x47b37f,_0x58fe39){return client['request'](_0x55dca8,_0x3684e7)[_0x3097('0x11')](function(_0x4e70fa){logger[_0x3097('0x12')]('DashboardItem,\x20%s,\x20%s',_0x15e80c,_0x3097('0x13'));logger['debug'](_0x3097('0x14'),_0x15e80c,_0x3097('0x13'),JSON[_0x3097('0x15')](_0x4e70fa));if(_0x4e70fa[_0x3097('0x16')]){if(_0x4e70fa['error'][_0x3097('0x17')]===0x1f4){logger['error'](_0x3097('0x18'),_0x15e80c,_0x4e70fa[_0x3097('0x16')][_0x3097('0x19')]);return _0x58fe39(_0x4e70fa['error']['message']);}logger[_0x3097('0x16')]('DashboardItem,\x20%s,\x20%s',_0x15e80c,_0x4e70fa[_0x3097('0x16')][_0x3097('0x19')]);return _0x47b37f(_0x4e70fa[_0x3097('0x16')][_0x3097('0x19')]);}else{logger['info'](_0x3097('0x18'),_0x15e80c,_0x3097('0x13'));_0x47b37f(_0x4e70fa['result']['message']);}})[_0x3097('0x1a')](function(_0x58460a){logger[_0x3097('0x16')](_0x3097('0x18'),_0x15e80c,_0x58460a);_0x58fe39(_0x58460a);});});}