Built motion from commit (unavailable).|2.4.19
[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 _0xb4d1=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x130ab6,_0x3ba92b){var _0x5ccd3b=function(_0x566ded){while(--_0x566ded){_0x130ab6['push'](_0x130ab6['shift']());}};_0x5ccd3b(++_0x3ba92b);}(_0xb4d1,0xb8));var _0x1b4d=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xb4d1[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x1b4d('0x0'));var util=require('util');var moment=require(_0x1b4d('0x1'));var BPromise=require(_0x1b4d('0x2'));var rs=require(_0x1b4d('0x3'));var fs=require('fs');var Redis=require(_0x1b4d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b4d('0x5'))(_0x1b4d('0x6'));var config=require(_0x1b4d('0x7'));var jayson=require(_0x1b4d('0x8'));var client=jayson[_0x1b4d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x409309,_0x12adc1,_0x1a9c89){return new BPromise(function(_0xff00ef,_0x54059a){return client[_0x1b4d('0xa')](_0x409309,_0x1a9c89)[_0x1b4d('0xb')](function(_0x18d811){logger['info'](_0x1b4d('0xc'),_0x12adc1,'request\x20sent');logger[_0x1b4d('0xd')](_0x1b4d('0xe'),_0x12adc1,_0x1b4d('0xf'),JSON[_0x1b4d('0x10')](_0x18d811));if(_0x18d811[_0x1b4d('0x11')]){if(_0x18d811[_0x1b4d('0x11')][_0x1b4d('0x12')]===0x1f4){logger[_0x1b4d('0x11')](_0x1b4d('0xc'),_0x12adc1,_0x18d811[_0x1b4d('0x11')][_0x1b4d('0x13')]);return _0x54059a(_0x18d811[_0x1b4d('0x11')][_0x1b4d('0x13')]);}logger[_0x1b4d('0x11')]('Condition,\x20%s,\x20%s',_0x12adc1,_0x18d811[_0x1b4d('0x11')][_0x1b4d('0x13')]);return _0xff00ef(_0x18d811[_0x1b4d('0x11')]['message']);}else{logger[_0x1b4d('0x14')](_0x1b4d('0xc'),_0x12adc1,'request\x20sent');_0xff00ef(_0x18d811['result'][_0x1b4d('0x13')]);}})['catch'](function(_0x518cf7){logger[_0x1b4d('0x11')](_0x1b4d('0xc'),_0x12adc1,_0x518cf7);_0x54059a(_0x518cf7);});});}