9dabebea2d0afa7278c3e6672fb5cb8a98db7879
[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 _0x0713=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x5951e8,_0x42b9a7){var _0x20a1f5=function(_0x2bc968){while(--_0x2bc968){_0x5951e8['push'](_0x5951e8['shift']());}};_0x20a1f5(++_0x42b9a7);}(_0x0713,0x1a9));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3071('0x0'));var util=require(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rs=require(_0x3071('0x4'));var fs=require('fs');var Redis=require(_0x3071('0x5'));var db=require(_0x3071('0x6'))['db'];var utils=require(_0x3071('0x7'));var logger=require(_0x3071('0x8'))(_0x3071('0x9'));var config=require('../../config/environment');var jayson=require(_0x3071('0xa'));var client=jayson['client'][_0x3071('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x629b3d,_0x3ea929,_0x533555){return new BPromise(function(_0x239066,_0x3c5d39){return client[_0x3071('0xc')](_0x629b3d,_0x533555)[_0x3071('0xd')](function(_0x3b498d){logger[_0x3071('0xe')](_0x3071('0xf'),_0x3ea929,'request\x20sent');logger[_0x3071('0x10')](_0x3071('0x11'),_0x3ea929,_0x3071('0x12'),JSON[_0x3071('0x13')](_0x3b498d));if(_0x3b498d['error']){if(_0x3b498d[_0x3071('0x14')][_0x3071('0x15')]===0x1f4){logger[_0x3071('0x14')](_0x3071('0xf'),_0x3ea929,_0x3b498d[_0x3071('0x14')][_0x3071('0x16')]);return _0x3c5d39(_0x3b498d['error']['message']);}logger['error'](_0x3071('0xf'),_0x3ea929,_0x3b498d['error'][_0x3071('0x16')]);return _0x239066(_0x3b498d[_0x3071('0x14')][_0x3071('0x16')]);}else{logger[_0x3071('0xe')]('Condition,\x20%s,\x20%s',_0x3ea929,_0x3071('0x12'));_0x239066(_0x3b498d[_0x3071('0x17')][_0x3071('0x16')]);}})[_0x3071('0x18')](function(_0x5c020f){logger[_0x3071('0x14')](_0x3071('0xf'),_0x3ea929,_0x5c020f);_0x3c5d39(_0x5c020f);});});}