c9dbf8c5054fabce47a315078831ff4063a4b115
[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 _0x81bb=['info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userProfile.socket','register','request'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x81bb,0xc7));var _0xb81b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81bb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb81b('0x0'));var util=require('util');var moment=require(_0xb81b('0x1'));var BPromise=require('bluebird');var rs=require(_0xb81b('0x2'));var fs=require('fs');var Redis=require(_0xb81b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb81b('0x4'));var logger=require(_0xb81b('0x5'))(_0xb81b('0x6'));var config=require(_0xb81b('0x7'));var jayson=require(_0xb81b('0x8'));var client=jayson[_0xb81b('0x9')][_0xb81b('0xa')]({'port':0x232a});config[_0xb81b('0xb')]=_[_0xb81b('0xc')](config[_0xb81b('0xb')],{'host':_0xb81b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb81b('0xb')]));require(_0xb81b('0xe'))[_0xb81b('0xf')](socket);function respondWithRpcPromise(_0x3eabd1,_0x31c282,_0x507690){return new BPromise(function(_0x4ca4dd,_0x3532f4){return client[_0xb81b('0x10')](_0x3eabd1,_0x507690)['then'](function(_0x3110c8){logger[_0xb81b('0x11')](_0xb81b('0x12'),_0x31c282,'request\x20sent');logger[_0xb81b('0x13')](_0xb81b('0x14'),_0x31c282,_0xb81b('0x15'),JSON[_0xb81b('0x16')](_0x3110c8));if(_0x3110c8[_0xb81b('0x17')]){if(_0x3110c8['error']['code']===0x1f4){logger[_0xb81b('0x17')]('UserProfile,\x20%s,\x20%s',_0x31c282,_0x3110c8['error'][_0xb81b('0x18')]);return _0x3532f4(_0x3110c8[_0xb81b('0x17')]['message']);}logger[_0xb81b('0x17')](_0xb81b('0x12'),_0x31c282,_0x3110c8[_0xb81b('0x17')][_0xb81b('0x18')]);return _0x4ca4dd(_0x3110c8[_0xb81b('0x17')][_0xb81b('0x18')]);}else{logger[_0xb81b('0x11')](_0xb81b('0x12'),_0x31c282,_0xb81b('0x15'));_0x4ca4dd(_0x3110c8[_0xb81b('0x19')][_0xb81b('0x18')]);}})[_0xb81b('0x1a')](function(_0x11c326){logger[_0xb81b('0x17')](_0xb81b('0x12'),_0x31c282,_0x11c326);_0x3532f4(_0x11c326);});});}