Built motion from commit 9d7072cc.|2.5.39
[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 _0x13ae=['message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','Condition,\x20%s,\x20%s'];(function(_0x2b45c8,_0x2ec8bd){var _0x3791fc=function(_0x448d18){while(--_0x448d18){_0x2b45c8['push'](_0x2b45c8['shift']());}};_0x3791fc(++_0x2ec8bd);}(_0x13ae,0xe9));var _0xe13a=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x13ae[_0x173441];return _0x2423a8;};'use strict';var _=require(_0xe13a('0x0'));var util=require(_0xe13a('0x1'));var moment=require(_0xe13a('0x2'));var BPromise=require('bluebird');var rs=require(_0xe13a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe13a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe13a('0x5'))(_0xe13a('0x6'));var config=require('../../config/environment');var jayson=require(_0xe13a('0x7'));var client=jayson[_0xe13a('0x8')][_0xe13a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x113ec9,_0x3629a1,_0x486ef0){return new BPromise(function(_0x54ab01,_0x274a1c){return client[_0xe13a('0xa')](_0x113ec9,_0x486ef0)[_0xe13a('0xb')](function(_0x48d47d){logger[_0xe13a('0xc')]('Condition,\x20%s,\x20%s',_0x3629a1,_0xe13a('0xd'));logger[_0xe13a('0xe')]('Condition,\x20%s,\x20%s,\x20%s',_0x3629a1,_0xe13a('0xd'),JSON[_0xe13a('0xf')](_0x48d47d));if(_0x48d47d['error']){if(_0x48d47d[_0xe13a('0x10')][_0xe13a('0x11')]===0x1f4){logger['error'](_0xe13a('0x12'),_0x3629a1,_0x48d47d[_0xe13a('0x10')]['message']);return _0x274a1c(_0x48d47d[_0xe13a('0x10')][_0xe13a('0x13')]);}logger[_0xe13a('0x10')]('Condition,\x20%s,\x20%s',_0x3629a1,_0x48d47d[_0xe13a('0x10')][_0xe13a('0x13')]);return _0x54ab01(_0x48d47d[_0xe13a('0x10')]['message']);}else{logger[_0xe13a('0xc')](_0xe13a('0x12'),_0x3629a1,_0xe13a('0xd'));_0x54ab01(_0x48d47d[_0xe13a('0x14')][_0xe13a('0x13')]);}})['catch'](function(_0x3ae646){logger[_0xe13a('0x10')](_0xe13a('0x12'),_0x3629a1,_0x3ae646);_0x274a1c(_0x3ae646);});});}