cb433206bde4fab0ff881ef122ce98d678aba343
[motion2.git] / server / api / tag / tag.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 _0xf290=['message','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf290,0xde));var _0x0f29=function(_0x533110,_0x20937f){_0x533110=_0x533110-0x0;var _0xc3c866=_0xf290[_0x533110];return _0xc3c866;};'use strict';var _=require('lodash');var util=require(_0x0f29('0x0'));var moment=require('moment');var BPromise=require(_0x0f29('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f29('0x2'));var db=require(_0x0f29('0x3'))['db'];var utils=require(_0x0f29('0x4'));var logger=require(_0x0f29('0x5'))(_0x0f29('0x6'));var config=require('../../config/environment');var jayson=require(_0x0f29('0x7'));var client=jayson['client'][_0x0f29('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c45ec,_0x355e21,_0xaa2675){return new BPromise(function(_0xc78ca2,_0x45350b){return client[_0x0f29('0x9')](_0x1c45ec,_0xaa2675)[_0x0f29('0xa')](function(_0x376de4){logger[_0x0f29('0xb')](_0x0f29('0xc'),_0x355e21,_0x0f29('0xd'));logger[_0x0f29('0xe')](_0x0f29('0xf'),_0x355e21,_0x0f29('0xd'),JSON['stringify'](_0x376de4));if(_0x376de4[_0x0f29('0x10')]){if(_0x376de4['error'][_0x0f29('0x11')]===0x1f4){logger[_0x0f29('0x10')](_0x0f29('0xc'),_0x355e21,_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);return _0x45350b(_0x376de4[_0x0f29('0x10')]['message']);}logger[_0x0f29('0x10')](_0x0f29('0xc'),_0x355e21,_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);return _0xc78ca2(_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);}else{logger[_0x0f29('0xb')](_0x0f29('0xc'),_0x355e21,'request\x20sent');_0xc78ca2(_0x376de4['result'][_0x0f29('0x12')]);}})[_0x0f29('0x13')](function(_0x38031e){logger[_0x0f29('0x10')]('Tag,\x20%s,\x20%s',_0x355e21,_0x38031e);_0x45350b(_0x38031e);});});}