Built motion from commit (unavailable).|2.3.4
[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 _0x6412=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring'];(function(_0x3b6fd9,_0x1e4363){var _0x25c92e=function(_0x596db9){while(--_0x596db9){_0x3b6fd9['push'](_0x3b6fd9['shift']());}};_0x25c92e(++_0x1e4363);}(_0x6412,0x7a));var _0x2641=function(_0x464bea,_0x4b9258){_0x464bea=_0x464bea-0x0;var _0x1d7d37=_0x6412[_0x464bea];return _0x1d7d37;};'use strict';var _=require(_0x2641('0x0'));var util=require(_0x2641('0x1'));var moment=require(_0x2641('0x2'));var BPromise=require('bluebird');var rs=require(_0x2641('0x3'));var fs=require('fs');var Redis=require(_0x2641('0x4'));var db=require(_0x2641('0x5'))['db'];var utils=require(_0x2641('0x6'));var logger=require('../../config/logger')(_0x2641('0x7'));var config=require(_0x2641('0x8'));var jayson=require(_0x2641('0x9'));var client=jayson['client'][_0x2641('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32ecac,_0x18c3d0,_0x45cf33){return new BPromise(function(_0xa72bb8,_0x5dfc0c){return client['request'](_0x32ecac,_0x45cf33)[_0x2641('0xb')](function(_0x325381){logger[_0x2641('0xc')](_0x2641('0xd'),_0x18c3d0,_0x2641('0xe'));logger[_0x2641('0xf')](_0x2641('0x10'),_0x18c3d0,_0x2641('0xe'),JSON[_0x2641('0x11')](_0x325381));if(_0x325381[_0x2641('0x12')]){if(_0x325381[_0x2641('0x12')][_0x2641('0x13')]===0x1f4){logger[_0x2641('0x12')]('Condition,\x20%s,\x20%s',_0x18c3d0,_0x325381['error']['message']);return _0x5dfc0c(_0x325381[_0x2641('0x12')][_0x2641('0x14')]);}logger[_0x2641('0x12')](_0x2641('0xd'),_0x18c3d0,_0x325381[_0x2641('0x12')][_0x2641('0x14')]);return _0xa72bb8(_0x325381[_0x2641('0x12')][_0x2641('0x14')]);}else{logger['info'](_0x2641('0xd'),_0x18c3d0,_0x2641('0xe'));_0xa72bb8(_0x325381['result'][_0x2641('0x14')]);}})['catch'](function(_0x2c54e4){logger['error'](_0x2641('0xd'),_0x18c3d0,_0x2c54e4);_0x5dfc0c(_0x2c54e4);});});}