Built motion from commit (unavailable).|2.4.12
[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 _0x089f=['util','moment','ioredis','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x181cc3,_0x564eb4){var _0x5565cd=function(_0xd8b12a){while(--_0xd8b12a){_0x181cc3['push'](_0x181cc3['shift']());}};_0x5565cd(++_0x564eb4);}(_0x089f,0x1b7));var _0xf089=function(_0x1f5d9d,_0x415ea1){_0x1f5d9d=_0x1f5d9d-0x0;var _0x52fad5=_0x089f[_0x1f5d9d];return _0x52fad5;};'use strict';var _=require(_0xf089('0x0'));var util=require(_0xf089('0x1'));var moment=require(_0xf089('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf089('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf089('0x4'));var logger=require(_0xf089('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf089('0x6'));var client=jayson['client'][_0xf089('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x35ec04,_0x2a4002,_0x206144){return new BPromise(function(_0x276a64,_0x1a39f1){return client[_0xf089('0x8')](_0x35ec04,_0x206144)[_0xf089('0x9')](function(_0x17e7fe){logger[_0xf089('0xa')](_0xf089('0xb'),_0x2a4002,_0xf089('0xc'));logger[_0xf089('0xd')](_0xf089('0xe'),_0x2a4002,'request\x20sent',JSON[_0xf089('0xf')](_0x17e7fe));if(_0x17e7fe[_0xf089('0x10')]){if(_0x17e7fe[_0xf089('0x10')][_0xf089('0x11')]===0x1f4){logger[_0xf089('0x10')](_0xf089('0xb'),_0x2a4002,_0x17e7fe[_0xf089('0x10')][_0xf089('0x12')]);return _0x1a39f1(_0x17e7fe['error'][_0xf089('0x12')]);}logger[_0xf089('0x10')](_0xf089('0xb'),_0x2a4002,_0x17e7fe['error']['message']);return _0x276a64(_0x17e7fe[_0xf089('0x10')]['message']);}else{logger[_0xf089('0xa')](_0xf089('0xb'),_0x2a4002,_0xf089('0xc'));_0x276a64(_0x17e7fe[_0xf089('0x13')][_0xf089('0x12')]);}})['catch'](function(_0x1d5537){logger[_0xf089('0x10')]('Condition,\x20%s,\x20%s',_0x2a4002,_0x1d5537);_0x1a39f1(_0x1d5537);});});}