Built motion from commit (unavailable).|2.5.1
[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 _0xf927=['then','info','request\x20sent','debug','stringify','error','code','message','Condition,\x20%s,\x20%s','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x494eab,_0x513478){var _0x2e9e71=function(_0x213159){while(--_0x213159){_0x494eab['push'](_0x494eab['shift']());}};_0x2e9e71(++_0x513478);}(_0xf927,0x191));var _0x7f92=function(_0x400aa0,_0x3be5cd){_0x400aa0=_0x400aa0-0x0;var _0x38ff10=_0xf927[_0x400aa0];return _0x38ff10;};'use strict';var _=require(_0x7f92('0x0'));var util=require(_0x7f92('0x1'));var moment=require(_0x7f92('0x2'));var BPromise=require(_0x7f92('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f92('0x4'));var db=require(_0x7f92('0x5'))['db'];var utils=require(_0x7f92('0x6'));var logger=require(_0x7f92('0x7'))(_0x7f92('0x8'));var config=require(_0x7f92('0x9'));var jayson=require(_0x7f92('0xa'));var client=jayson[_0x7f92('0xb')][_0x7f92('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x498193,_0x5d631b,_0x1fa4ca){return new BPromise(function(_0x2de0d6,_0x47da51){return client['request'](_0x498193,_0x1fa4ca)[_0x7f92('0xd')](function(_0x204624){logger[_0x7f92('0xe')]('Condition,\x20%s,\x20%s',_0x5d631b,_0x7f92('0xf'));logger[_0x7f92('0x10')]('Condition,\x20%s,\x20%s,\x20%s',_0x5d631b,_0x7f92('0xf'),JSON[_0x7f92('0x11')](_0x204624));if(_0x204624[_0x7f92('0x12')]){if(_0x204624[_0x7f92('0x12')][_0x7f92('0x13')]===0x1f4){logger[_0x7f92('0x12')]('Condition,\x20%s,\x20%s',_0x5d631b,_0x204624[_0x7f92('0x12')][_0x7f92('0x14')]);return _0x47da51(_0x204624['error'][_0x7f92('0x14')]);}logger[_0x7f92('0x12')](_0x7f92('0x15'),_0x5d631b,_0x204624['error']['message']);return _0x2de0d6(_0x204624[_0x7f92('0x12')][_0x7f92('0x14')]);}else{logger[_0x7f92('0xe')](_0x7f92('0x15'),_0x5d631b,'request\x20sent');_0x2de0d6(_0x204624[_0x7f92('0x16')][_0x7f92('0x14')]);}})['catch'](function(_0x542d54){logger['error'](_0x7f92('0x15'),_0x5d631b,_0x542d54);_0x47da51(_0x542d54);});});}