25ef2a6f92ede1c5b7d3a1b7f34b153d545b011c
[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 _0x3685=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x270323,_0x72160){var _0x48a027=function(_0x4cb12e){while(--_0x4cb12e){_0x270323['push'](_0x270323['shift']());}};_0x48a027(++_0x72160);}(_0x3685,0xf8));var _0x5368=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3685[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x5368('0x0'));var util=require('util');var moment=require(_0x5368('0x1'));var BPromise=require(_0x5368('0x2'));var rs=require(_0x5368('0x3'));var fs=require('fs');var Redis=require(_0x5368('0x4'));var db=require(_0x5368('0x5'))['db'];var utils=require(_0x5368('0x6'));var logger=require(_0x5368('0x7'))(_0x5368('0x8'));var config=require(_0x5368('0x9'));var jayson=require(_0x5368('0xa'));var client=jayson['client'][_0x5368('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2529a2,_0x39223d,_0xaf4549){return new BPromise(function(_0x55fb7d,_0x14e621){return client[_0x5368('0xc')](_0x2529a2,_0xaf4549)[_0x5368('0xd')](function(_0x2a6ce8){logger[_0x5368('0xe')](_0x5368('0xf'),_0x39223d,_0x5368('0x10'));logger[_0x5368('0x11')]('Tag,\x20%s,\x20%s,\x20%s',_0x39223d,_0x5368('0x10'),JSON[_0x5368('0x12')](_0x2a6ce8));if(_0x2a6ce8[_0x5368('0x13')]){if(_0x2a6ce8['error'][_0x5368('0x14')]===0x1f4){logger[_0x5368('0x13')]('Tag,\x20%s,\x20%s',_0x39223d,_0x2a6ce8['error']['message']);return _0x14e621(_0x2a6ce8[_0x5368('0x13')][_0x5368('0x15')]);}logger[_0x5368('0x13')](_0x5368('0xf'),_0x39223d,_0x2a6ce8[_0x5368('0x13')][_0x5368('0x15')]);return _0x55fb7d(_0x2a6ce8[_0x5368('0x13')][_0x5368('0x15')]);}else{logger[_0x5368('0xe')](_0x5368('0xf'),_0x39223d,'request\x20sent');_0x55fb7d(_0x2a6ce8[_0x5368('0x16')][_0x5368('0x15')]);}})['catch'](function(_0x19790d){logger[_0x5368('0x13')](_0x5368('0xf'),_0x39223d,_0x19790d);_0x14e621(_0x19790d);});});}