Built motion from commit 19a84241.|2.5.34
[motion2.git] / server / api / team / team.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 _0x9335=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./team.socket','request','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x309128,_0x48a791){var _0x51c06a=function(_0x490a0d){while(--_0x490a0d){_0x309128['push'](_0x309128['shift']());}};_0x51c06a(++_0x48a791);}(_0x9335,0xfd));var _0x5933=function(_0x4c8ee0,_0x280802){_0x4c8ee0=_0x4c8ee0-0x0;var _0x2d3260=_0x9335[_0x4c8ee0];return _0x2d3260;};'use strict';var _=require(_0x5933('0x0'));var util=require(_0x5933('0x1'));var moment=require('moment');var BPromise=require(_0x5933('0x2'));var rs=require(_0x5933('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5933('0x4'))['db'];var utils=require(_0x5933('0x5'));var logger=require(_0x5933('0x6'))(_0x5933('0x7'));var config=require(_0x5933('0x8'));var jayson=require(_0x5933('0x9'));var client=jayson[_0x5933('0xa')][_0x5933('0xb')]({'port':0x232a});config[_0x5933('0xc')]=_[_0x5933('0xd')](config[_0x5933('0xc')],{'host':_0x5933('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5933('0xc')]));require(_0x5933('0xf'))['register'](socket);function respondWithRpcPromise(_0x247c49,_0x31d380,_0x116590){return new BPromise(function(_0x298236,_0x5b3f46){return client[_0x5933('0x10')](_0x247c49,_0x116590)['then'](function(_0xd324b3){logger[_0x5933('0x11')](_0x5933('0x12'),_0x31d380,_0x5933('0x13'));logger['debug'](_0x5933('0x14'),_0x31d380,_0x5933('0x13'),JSON[_0x5933('0x15')](_0xd324b3));if(_0xd324b3['error']){if(_0xd324b3[_0x5933('0x16')]['code']===0x1f4){logger[_0x5933('0x16')]('Team,\x20%s,\x20%s',_0x31d380,_0xd324b3[_0x5933('0x16')][_0x5933('0x17')]);return _0x5b3f46(_0xd324b3[_0x5933('0x16')]['message']);}logger[_0x5933('0x16')](_0x5933('0x12'),_0x31d380,_0xd324b3[_0x5933('0x16')][_0x5933('0x17')]);return _0x298236(_0xd324b3[_0x5933('0x16')]['message']);}else{logger[_0x5933('0x11')](_0x5933('0x12'),_0x31d380,_0x5933('0x13'));_0x298236(_0xd324b3[_0x5933('0x18')][_0x5933('0x17')]);}})[_0x5933('0x19')](function(_0x45a19f){logger[_0x5933('0x16')](_0x5933('0x12'),_0x31d380,_0x45a19f);_0x5b3f46(_0x45a19f);});});}