7362e66a89ec28c521cfa29b8f4ca9b9ae0ebaab
[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 _0x6e45=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','Condition,\x20%s,\x20%s','message','catch','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6e45,0xf0));var _0x56e4=function(_0x311165,_0xadf2a){_0x311165=_0x311165-0x0;var _0x39ebb8=_0x6e45[_0x311165];return _0x39ebb8;};'use strict';var _=require(_0x56e4('0x0'));var util=require(_0x56e4('0x1'));var moment=require(_0x56e4('0x2'));var BPromise=require(_0x56e4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x56e4('0x4'));var db=require(_0x56e4('0x5'))['db'];var utils=require(_0x56e4('0x6'));var logger=require(_0x56e4('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x56e4('0x8'));var client=jayson[_0x56e4('0x9')][_0x56e4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x579d1a,_0x54f38e,_0x136912){return new BPromise(function(_0x4ea4ba,_0x37d908){return client[_0x56e4('0xb')](_0x579d1a,_0x136912)[_0x56e4('0xc')](function(_0x206ca7){logger[_0x56e4('0xd')]('Condition,\x20%s,\x20%s',_0x54f38e,_0x56e4('0xe'));logger[_0x56e4('0xf')]('Condition,\x20%s,\x20%s,\x20%s',_0x54f38e,_0x56e4('0xe'),JSON[_0x56e4('0x10')](_0x206ca7));if(_0x206ca7['error']){if(_0x206ca7[_0x56e4('0x11')][_0x56e4('0x12')]===0x1f4){logger[_0x56e4('0x11')](_0x56e4('0x13'),_0x54f38e,_0x206ca7[_0x56e4('0x11')]['message']);return _0x37d908(_0x206ca7[_0x56e4('0x11')][_0x56e4('0x14')]);}logger[_0x56e4('0x11')](_0x56e4('0x13'),_0x54f38e,_0x206ca7[_0x56e4('0x11')][_0x56e4('0x14')]);return _0x4ea4ba(_0x206ca7[_0x56e4('0x11')][_0x56e4('0x14')]);}else{logger[_0x56e4('0xd')](_0x56e4('0x13'),_0x54f38e,_0x56e4('0xe'));_0x4ea4ba(_0x206ca7['result'][_0x56e4('0x14')]);}})[_0x56e4('0x15')](function(_0x4e04b3){logger[_0x56e4('0x11')](_0x56e4('0x13'),_0x54f38e,_0x4e04b3);_0x37d908(_0x4e04b3);});});}