1ea16dce609a5fccd22246a4d8d49aa290d79f31
[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 _0x830c=['../../config/utils','rpc','../../config/environment','client','http','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x2fbcc6,_0x3613ec){var _0x565298=function(_0x10acb6){while(--_0x10acb6){_0x2fbcc6['push'](_0x2fbcc6['shift']());}};_0x565298(++_0x3613ec);}(_0x830c,0x136));var _0xc830=function(_0x8161c8,_0x50dfbd){_0x8161c8=_0x8161c8-0x0;var _0x4bcacf=_0x830c[_0x8161c8];return _0x4bcacf;};'use strict';var _=require('lodash');var util=require(_0xc830('0x0'));var moment=require(_0xc830('0x1'));var BPromise=require(_0xc830('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc830('0x3'));var db=require(_0xc830('0x4'))['db'];var utils=require(_0xc830('0x5'));var logger=require('../../config/logger')(_0xc830('0x6'));var config=require(_0xc830('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc830('0x8')][_0xc830('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x349bb0,_0x3553c7,_0x10d638){return new BPromise(function(_0x5b5fb4,_0x1ed733){return client['request'](_0x349bb0,_0x10d638)[_0xc830('0xa')](function(_0x39bd73){logger[_0xc830('0xb')](_0xc830('0xc'),_0x3553c7,_0xc830('0xd'));logger[_0xc830('0xe')](_0xc830('0xf'),_0x3553c7,'request\x20sent',JSON[_0xc830('0x10')](_0x39bd73));if(_0x39bd73[_0xc830('0x11')]){if(_0x39bd73[_0xc830('0x11')][_0xc830('0x12')]===0x1f4){logger[_0xc830('0x11')](_0xc830('0xc'),_0x3553c7,_0x39bd73[_0xc830('0x11')][_0xc830('0x13')]);return _0x1ed733(_0x39bd73[_0xc830('0x11')][_0xc830('0x13')]);}logger[_0xc830('0x11')](_0xc830('0xc'),_0x3553c7,_0x39bd73[_0xc830('0x11')]['message']);return _0x5b5fb4(_0x39bd73['error'][_0xc830('0x13')]);}else{logger['info'](_0xc830('0xc'),_0x3553c7,'request\x20sent');_0x5b5fb4(_0x39bd73[_0xc830('0x14')][_0xc830('0x13')]);}})['catch'](function(_0x63553f){logger[_0xc830('0x11')](_0xc830('0xc'),_0x3553c7,_0x63553f);_0x1ed733(_0x63553f);});});}