1a961697060ebe7eab25930828f01ab035b3c4c3
[motion2.git] / server / api / userProfile / userProfile.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 _0xaaee=['redis','defaults','localhost','./userProfile.socket','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2232b2,_0x4404a7){var _0x4871e0=function(_0x50d6ee){while(--_0x50d6ee){_0x2232b2['push'](_0x2232b2['shift']());}};_0x4871e0(++_0x4404a7);}(_0xaaee,0x132));var _0xeaae=function(_0x2de633,_0x3ce734){_0x2de633=_0x2de633-0x0;var _0x3f18dd=_0xaaee[_0x2de633];return _0x3f18dd;};'use strict';var _=require(_0xeaae('0x0'));var util=require(_0xeaae('0x1'));var moment=require(_0xeaae('0x2'));var BPromise=require(_0xeaae('0x3'));var rs=require(_0xeaae('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeaae('0x5'))['db'];var utils=require(_0xeaae('0x6'));var logger=require(_0xeaae('0x7'))(_0xeaae('0x8'));var config=require(_0xeaae('0x9'));var jayson=require(_0xeaae('0xa'));var client=jayson[_0xeaae('0xb')][_0xeaae('0xc')]({'port':0x232a});config[_0xeaae('0xd')]=_[_0xeaae('0xe')](config[_0xeaae('0xd')],{'host':_0xeaae('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeaae('0xd')]));require(_0xeaae('0x10'))['register'](socket);function respondWithRpcPromise(_0x149943,_0x295a9a,_0xc3570c){return new BPromise(function(_0x435340,_0x484be3){return client['request'](_0x149943,_0xc3570c)[_0xeaae('0x11')](function(_0x465002){logger['info'](_0xeaae('0x12'),_0x295a9a,_0xeaae('0x13'));logger[_0xeaae('0x14')](_0xeaae('0x15'),_0x295a9a,'request\x20sent',JSON[_0xeaae('0x16')](_0x465002));if(_0x465002['error']){if(_0x465002[_0xeaae('0x17')][_0xeaae('0x18')]===0x1f4){logger[_0xeaae('0x17')](_0xeaae('0x12'),_0x295a9a,_0x465002[_0xeaae('0x17')][_0xeaae('0x19')]);return _0x484be3(_0x465002[_0xeaae('0x17')][_0xeaae('0x19')]);}logger[_0xeaae('0x17')](_0xeaae('0x12'),_0x295a9a,_0x465002[_0xeaae('0x17')][_0xeaae('0x19')]);return _0x435340(_0x465002[_0xeaae('0x17')]['message']);}else{logger[_0xeaae('0x1a')]('UserProfile,\x20%s,\x20%s',_0x295a9a,_0xeaae('0x13'));_0x435340(_0x465002[_0xeaae('0x1b')][_0xeaae('0x19')]);}})[_0xeaae('0x1c')](function(_0x5ec06e){logger[_0xeaae('0x17')](_0xeaae('0x12'),_0x295a9a,_0x5ec06e);_0x484be3(_0x5ec06e);});});}