Built motion from commit da617fac.|2.6.6
[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 _0x803f=['client','http','info','Condition,\x20%s,\x20%s','debug','request\x20sent','code','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x34ac63,_0x40f4da){var _0x44aee2=function(_0x5a1140){while(--_0x5a1140){_0x34ac63['push'](_0x34ac63['shift']());}};_0x44aee2(++_0x40f4da);}(_0x803f,0x10e));var _0xf803=function(_0x1a2793,_0x8c946d){_0x1a2793=_0x1a2793-0x0;var _0x580695=_0x803f[_0x1a2793];return _0x580695;};'use strict';var _=require(_0xf803('0x0'));var util=require('util');var moment=require(_0xf803('0x1'));var BPromise=require(_0xf803('0x2'));var rs=require(_0xf803('0x3'));var fs=require('fs');var Redis=require(_0xf803('0x4'));var db=require(_0xf803('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf803('0x6'))(_0xf803('0x7'));var config=require(_0xf803('0x8'));var jayson=require(_0xf803('0x9'));var client=jayson[_0xf803('0xa')][_0xf803('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1080ac,_0x3d7ccb,_0x32a09e){return new BPromise(function(_0x33f2b4,_0x5d83d3){return client['request'](_0x1080ac,_0x32a09e)['then'](function(_0x56dd99){logger[_0xf803('0xc')](_0xf803('0xd'),_0x3d7ccb,'request\x20sent');logger[_0xf803('0xe')]('Condition,\x20%s,\x20%s,\x20%s',_0x3d7ccb,_0xf803('0xf'),JSON['stringify'](_0x56dd99));if(_0x56dd99['error']){if(_0x56dd99['error'][_0xf803('0x10')]===0x1f4){logger[_0xf803('0x11')](_0xf803('0xd'),_0x3d7ccb,_0x56dd99[_0xf803('0x11')]['message']);return _0x5d83d3(_0x56dd99['error']['message']);}logger[_0xf803('0x11')](_0xf803('0xd'),_0x3d7ccb,_0x56dd99[_0xf803('0x11')][_0xf803('0x12')]);return _0x33f2b4(_0x56dd99[_0xf803('0x11')][_0xf803('0x12')]);}else{logger[_0xf803('0xc')](_0xf803('0xd'),_0x3d7ccb,'request\x20sent');_0x33f2b4(_0x56dd99['result'][_0xf803('0x12')]);}})[_0xf803('0x13')](function(_0x50e02a){logger[_0xf803('0x11')](_0xf803('0xd'),_0x3d7ccb,_0x50e02a);_0x5d83d3(_0x50e02a);});});}