Built motion from commit 753c950e.|2.5.42
[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 _0x20d5=['then','info','request\x20sent','debug','stringify','error','Condition,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x41ccb6,_0x55aeeb){var _0x5fd3df=function(_0x32e9ab){while(--_0x32e9ab){_0x41ccb6['push'](_0x41ccb6['shift']());}};_0x5fd3df(++_0x55aeeb);}(_0x20d5,0x1ed));var _0x520d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20d5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x520d('0x0'));var moment=require(_0x520d('0x1'));var BPromise=require('bluebird');var rs=require(_0x520d('0x2'));var fs=require('fs');var Redis=require(_0x520d('0x3'));var db=require(_0x520d('0x4'))['db'];var utils=require(_0x520d('0x5'));var logger=require(_0x520d('0x6'))(_0x520d('0x7'));var config=require(_0x520d('0x8'));var jayson=require(_0x520d('0x9'));var client=jayson[_0x520d('0xa')][_0x520d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb927d9,_0x3b9d44,_0x5ec473){return new BPromise(function(_0x1de3bb,_0x25fed5){return client[_0x520d('0xc')](_0xb927d9,_0x5ec473)[_0x520d('0xd')](function(_0x574c03){logger[_0x520d('0xe')]('Condition,\x20%s,\x20%s',_0x3b9d44,_0x520d('0xf'));logger[_0x520d('0x10')]('Condition,\x20%s,\x20%s,\x20%s',_0x3b9d44,_0x520d('0xf'),JSON[_0x520d('0x11')](_0x574c03));if(_0x574c03[_0x520d('0x12')]){if(_0x574c03[_0x520d('0x12')]['code']===0x1f4){logger['error'](_0x520d('0x13'),_0x3b9d44,_0x574c03['error'][_0x520d('0x14')]);return _0x25fed5(_0x574c03[_0x520d('0x12')][_0x520d('0x14')]);}logger[_0x520d('0x12')](_0x520d('0x13'),_0x3b9d44,_0x574c03['error'][_0x520d('0x14')]);return _0x1de3bb(_0x574c03[_0x520d('0x12')][_0x520d('0x14')]);}else{logger[_0x520d('0xe')](_0x520d('0x13'),_0x3b9d44,_0x520d('0xf'));_0x1de3bb(_0x574c03[_0x520d('0x15')][_0x520d('0x14')]);}})[_0x520d('0x16')](function(_0x3e9ce5){logger[_0x520d('0x12')](_0x520d('0x13'),_0x3b9d44,_0x3e9ce5);_0x25fed5(_0x3e9ce5);});});}