095af34197e13da4acb43fb420e82c633772bd4f
[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 _0xae47=['http','request','then','info','request\x20sent','debug','error','code','Condition,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x4dadba,_0x2ed5e6){var _0x373bb0=function(_0x28e6dc){while(--_0x28e6dc){_0x4dadba['push'](_0x4dadba['shift']());}};_0x373bb0(++_0x2ed5e6);}(_0xae47,0x155));var _0x7ae4=function(_0x3cd10,_0x4a03fe){_0x3cd10=_0x3cd10-0x0;var _0x4b64c7=_0xae47[_0x3cd10];return _0x4b64c7;};'use strict';var _=require(_0x7ae4('0x0'));var util=require(_0x7ae4('0x1'));var moment=require('moment');var BPromise=require(_0x7ae4('0x2'));var rs=require(_0x7ae4('0x3'));var fs=require('fs');var Redis=require(_0x7ae4('0x4'));var db=require(_0x7ae4('0x5'))['db'];var utils=require(_0x7ae4('0x6'));var logger=require('../../config/logger')(_0x7ae4('0x7'));var config=require(_0x7ae4('0x8'));var jayson=require(_0x7ae4('0x9'));var client=jayson[_0x7ae4('0xa')][_0x7ae4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3915d0,_0x1f7701,_0x2f6d1b){return new BPromise(function(_0x9ba163,_0x171930){return client[_0x7ae4('0xc')](_0x3915d0,_0x2f6d1b)[_0x7ae4('0xd')](function(_0x2418bc){logger[_0x7ae4('0xe')]('Condition,\x20%s,\x20%s',_0x1f7701,_0x7ae4('0xf'));logger[_0x7ae4('0x10')]('Condition,\x20%s,\x20%s,\x20%s',_0x1f7701,_0x7ae4('0xf'),JSON['stringify'](_0x2418bc));if(_0x2418bc[_0x7ae4('0x11')]){if(_0x2418bc[_0x7ae4('0x11')][_0x7ae4('0x12')]===0x1f4){logger[_0x7ae4('0x11')](_0x7ae4('0x13'),_0x1f7701,_0x2418bc[_0x7ae4('0x11')][_0x7ae4('0x14')]);return _0x171930(_0x2418bc[_0x7ae4('0x11')][_0x7ae4('0x14')]);}logger[_0x7ae4('0x11')]('Condition,\x20%s,\x20%s',_0x1f7701,_0x2418bc[_0x7ae4('0x11')][_0x7ae4('0x14')]);return _0x9ba163(_0x2418bc[_0x7ae4('0x11')]['message']);}else{logger[_0x7ae4('0xe')](_0x7ae4('0x13'),_0x1f7701,_0x7ae4('0xf'));_0x9ba163(_0x2418bc['result'][_0x7ae4('0x14')]);}})[_0x7ae4('0x15')](function(_0x2cfc01){logger[_0x7ae4('0x11')](_0x7ae4('0x13'),_0x1f7701,_0x2cfc01);_0x171930(_0x2cfc01);});});}