Built motion from commit 25580385.|2.6.2
[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 _0xdc0e=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','then','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x33de83,_0x5cd14a){var _0x2dc227=function(_0x7a3560){while(--_0x7a3560){_0x33de83['push'](_0x33de83['shift']());}};_0x2dc227(++_0x5cd14a);}(_0xdc0e,0x112));var _0xedc0=function(_0x4f840d,_0x5d6218){_0x4f840d=_0x4f840d-0x0;var _0x315f81=_0xdc0e[_0x4f840d];return _0x315f81;};'use strict';var _=require(_0xedc0('0x0'));var util=require(_0xedc0('0x1'));var moment=require(_0xedc0('0x2'));var BPromise=require(_0xedc0('0x3'));var rs=require(_0xedc0('0x4'));var fs=require('fs');var Redis=require(_0xedc0('0x5'));var db=require(_0xedc0('0x6'))['db'];var utils=require(_0xedc0('0x7'));var logger=require(_0xedc0('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xedc0('0x9'));var client=jayson[_0xedc0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ee830,_0x2d7cf6,_0x8292a8){return new BPromise(function(_0x20d767,_0x4347df){return client['request'](_0x2ee830,_0x8292a8)[_0xedc0('0xb')](function(_0x33912e){logger['info'](_0xedc0('0xc'),_0x2d7cf6,_0xedc0('0xd'));logger[_0xedc0('0xe')](_0xedc0('0xf'),_0x2d7cf6,_0xedc0('0xd'),JSON[_0xedc0('0x10')](_0x33912e));if(_0x33912e[_0xedc0('0x11')]){if(_0x33912e[_0xedc0('0x11')][_0xedc0('0x12')]===0x1f4){logger[_0xedc0('0x11')]('Condition,\x20%s,\x20%s',_0x2d7cf6,_0x33912e['error'][_0xedc0('0x13')]);return _0x4347df(_0x33912e[_0xedc0('0x11')]['message']);}logger[_0xedc0('0x11')](_0xedc0('0xc'),_0x2d7cf6,_0x33912e[_0xedc0('0x11')]['message']);return _0x20d767(_0x33912e[_0xedc0('0x11')][_0xedc0('0x13')]);}else{logger[_0xedc0('0x14')]('Condition,\x20%s,\x20%s',_0x2d7cf6,_0xedc0('0xd'));_0x20d767(_0x33912e[_0xedc0('0x15')][_0xedc0('0x13')]);}})[_0xedc0('0x16')](function(_0x5dd8e9){logger['error'](_0xedc0('0xc'),_0x2d7cf6,_0x5dd8e9);_0x4347df(_0x5dd8e9);});});}