Built motion from commit 5ad77b03.|2.6.3
[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 _0xb205=['../../config/environment','client','http','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb205,0xf0));var _0x5b20=function(_0x63cd07,_0x46bc54){_0x63cd07=_0x63cd07-0x0;var _0x16e6c7=_0xb205[_0x63cd07];return _0x16e6c7;};'use strict';var _=require(_0x5b20('0x0'));var util=require(_0x5b20('0x1'));var moment=require(_0x5b20('0x2'));var BPromise=require(_0x5b20('0x3'));var rs=require(_0x5b20('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5b20('0x5'));var logger=require('../../config/logger')(_0x5b20('0x6'));var config=require(_0x5b20('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5b20('0x8')][_0x5b20('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x364e48,_0x5c1ff9,_0x32b467){return new BPromise(function(_0x13fb27,_0x528c54){return client['request'](_0x364e48,_0x32b467)[_0x5b20('0xa')](function(_0xb77426){logger[_0x5b20('0xb')](_0x5b20('0xc'),_0x5c1ff9,_0x5b20('0xd'));logger[_0x5b20('0xe')](_0x5b20('0xf'),_0x5c1ff9,'request\x20sent',JSON[_0x5b20('0x10')](_0xb77426));if(_0xb77426[_0x5b20('0x11')]){if(_0xb77426[_0x5b20('0x11')]['code']===0x1f4){logger['error'](_0x5b20('0xc'),_0x5c1ff9,_0xb77426[_0x5b20('0x11')][_0x5b20('0x12')]);return _0x528c54(_0xb77426[_0x5b20('0x11')][_0x5b20('0x12')]);}logger['error'](_0x5b20('0xc'),_0x5c1ff9,_0xb77426[_0x5b20('0x11')][_0x5b20('0x12')]);return _0x13fb27(_0xb77426[_0x5b20('0x11')]['message']);}else{logger['info'](_0x5b20('0xc'),_0x5c1ff9,'request\x20sent');_0x13fb27(_0xb77426['result'][_0x5b20('0x12')]);}})['catch'](function(_0x43b7b0){logger[_0x5b20('0x11')](_0x5b20('0xc'),_0x5c1ff9,_0x43b7b0);_0x528c54(_0x43b7b0);});});}