2d7a9b2edd5bee5d7a2955ae808630291d4d0414
[motion2.git] / server / api / condition / condition.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 _0x85b3=['bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment'];(function(_0x10a558,_0x465d6a){var _0x596934=function(_0x38320a){while(--_0x38320a){_0x10a558['push'](_0x10a558['shift']());}};_0x596934(++_0x465d6a);}(_0x85b3,0x1cc));var _0x385b=function(_0x3c4474,_0xb9a182){_0x3c4474=_0x3c4474-0x0;var _0x2cfd03=_0x85b3[_0x3c4474];return _0x2cfd03;};'use strict';var _=require(_0x385b('0x0'));var util=require('util');var moment=require(_0x385b('0x1'));var BPromise=require(_0x385b('0x2'));var rs=require(_0x385b('0x3'));var fs=require('fs');var Redis=require(_0x385b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x385b('0x5'));var logger=require('../../config/logger')(_0x385b('0x6'));var config=require(_0x385b('0x7'));var jayson=require(_0x385b('0x8'));var client=jayson['client'][_0x385b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4752a6,_0x354e4c,_0x4a1744){return new BPromise(function(_0x5bdb23,_0xd992f){return client['request'](_0x4752a6,_0x4a1744)[_0x385b('0xa')](function(_0x435d7e){logger[_0x385b('0xb')](_0x385b('0xc'),_0x354e4c,'request\x20sent');logger[_0x385b('0xd')](_0x385b('0xe'),_0x354e4c,_0x385b('0xf'),JSON[_0x385b('0x10')](_0x435d7e));if(_0x435d7e[_0x385b('0x11')]){if(_0x435d7e[_0x385b('0x11')][_0x385b('0x12')]===0x1f4){logger[_0x385b('0x11')]('Condition,\x20%s,\x20%s',_0x354e4c,_0x435d7e['error'][_0x385b('0x13')]);return _0xd992f(_0x435d7e[_0x385b('0x11')][_0x385b('0x13')]);}logger['error'](_0x385b('0xc'),_0x354e4c,_0x435d7e['error']['message']);return _0x5bdb23(_0x435d7e[_0x385b('0x11')][_0x385b('0x13')]);}else{logger['info'](_0x385b('0xc'),_0x354e4c,_0x385b('0xf'));_0x5bdb23(_0x435d7e[_0x385b('0x14')]['message']);}})['catch'](function(_0x4cbf69){logger[_0x385b('0x11')]('Condition,\x20%s,\x20%s',_0x354e4c,_0x4cbf69);_0xd992f(_0x4cbf69);});});}