308f878b37b08a7843a10c19896b5f41b90393e1
[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 _0xfd9b=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xfd9b,0x1b8));var _0xbfd9=function(_0x592705,_0x3b2389){_0x592705=_0x592705-0x0;var _0x10dff0=_0xfd9b[_0x592705];return _0x10dff0;};'use strict';var _=require(_0xbfd9('0x0'));var util=require('util');var moment=require(_0xbfd9('0x1'));var BPromise=require(_0xbfd9('0x2'));var rs=require(_0xbfd9('0x3'));var fs=require('fs');var Redis=require(_0xbfd9('0x4'));var db=require(_0xbfd9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbfd9('0x6'))(_0xbfd9('0x7'));var config=require(_0xbfd9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbfd9('0x9')][_0xbfd9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17cce6,_0x2eb4e3,_0x1b2792){return new BPromise(function(_0x540d7c,_0x3f0c85){return client[_0xbfd9('0xb')](_0x17cce6,_0x1b2792)[_0xbfd9('0xc')](function(_0x50ba97){logger['info'](_0xbfd9('0xd'),_0x2eb4e3,_0xbfd9('0xe'));logger['debug'](_0xbfd9('0xf'),_0x2eb4e3,_0xbfd9('0xe'),JSON[_0xbfd9('0x10')](_0x50ba97));if(_0x50ba97['error']){if(_0x50ba97[_0xbfd9('0x11')][_0xbfd9('0x12')]===0x1f4){logger['error'](_0xbfd9('0xd'),_0x2eb4e3,_0x50ba97[_0xbfd9('0x11')][_0xbfd9('0x13')]);return _0x3f0c85(_0x50ba97['error']['message']);}logger[_0xbfd9('0x11')](_0xbfd9('0xd'),_0x2eb4e3,_0x50ba97[_0xbfd9('0x11')][_0xbfd9('0x13')]);return _0x540d7c(_0x50ba97[_0xbfd9('0x11')][_0xbfd9('0x13')]);}else{logger[_0xbfd9('0x14')](_0xbfd9('0xd'),_0x2eb4e3,_0xbfd9('0xe'));_0x540d7c(_0x50ba97[_0xbfd9('0x15')][_0xbfd9('0x13')]);}})['catch'](function(_0x2e3ad2){logger[_0xbfd9('0x11')](_0xbfd9('0xd'),_0x2eb4e3,_0x2e3ad2);_0x3f0c85(_0x2e3ad2);});});}