Built motion from commit 5ba5b610.|2.5.33
[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 _0x68b8=['http','request','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68b8,0xee));var _0x868b=function(_0x2d4421,_0x15a84f){_0x2d4421=_0x2d4421-0x0;var _0x2d3b01=_0x68b8[_0x2d4421];return _0x2d3b01;};'use strict';var _=require(_0x868b('0x0'));var util=require(_0x868b('0x1'));var moment=require(_0x868b('0x2'));var BPromise=require('bluebird');var rs=require(_0x868b('0x3'));var fs=require('fs');var Redis=require(_0x868b('0x4'));var db=require(_0x868b('0x5'))['db'];var utils=require(_0x868b('0x6'));var logger=require(_0x868b('0x7'))(_0x868b('0x8'));var config=require(_0x868b('0x9'));var jayson=require(_0x868b('0xa'));var client=jayson[_0x868b('0xb')][_0x868b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x11150b,_0x46b502,_0x5e3236){return new BPromise(function(_0x4011a2,_0x127d76){return client[_0x868b('0xd')](_0x11150b,_0x5e3236)['then'](function(_0x227954){logger[_0x868b('0xe')](_0x868b('0xf'),_0x46b502,'request\x20sent');logger[_0x868b('0x10')](_0x868b('0x11'),_0x46b502,_0x868b('0x12'),JSON[_0x868b('0x13')](_0x227954));if(_0x227954[_0x868b('0x14')]){if(_0x227954[_0x868b('0x14')][_0x868b('0x15')]===0x1f4){logger['error'](_0x868b('0xf'),_0x46b502,_0x227954['error'][_0x868b('0x16')]);return _0x127d76(_0x227954[_0x868b('0x14')][_0x868b('0x16')]);}logger['error']('Condition,\x20%s,\x20%s',_0x46b502,_0x227954['error']['message']);return _0x4011a2(_0x227954[_0x868b('0x14')][_0x868b('0x16')]);}else{logger[_0x868b('0xe')](_0x868b('0xf'),_0x46b502,_0x868b('0x12'));_0x4011a2(_0x227954[_0x868b('0x17')][_0x868b('0x16')]);}})[_0x868b('0x18')](function(_0x19b4c6){logger[_0x868b('0x14')]('Condition,\x20%s,\x20%s',_0x46b502,_0x19b4c6);_0x127d76(_0x19b4c6);});});}