035a7e763497accdbf7c8f4b976961def95e265d
[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 _0x7384=['stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s'];(function(_0x81ca42,_0x1c4809){var _0x59377d=function(_0x1ad32d){while(--_0x1ad32d){_0x81ca42['push'](_0x81ca42['shift']());}};_0x59377d(++_0x1c4809);}(_0x7384,0xdd));var _0x4738=function(_0x48b5e7,_0x5e249f){_0x48b5e7=_0x48b5e7-0x0;var _0x405730=_0x7384[_0x48b5e7];return _0x405730;};'use strict';var _=require(_0x4738('0x0'));var util=require(_0x4738('0x1'));var moment=require(_0x4738('0x2'));var BPromise=require(_0x4738('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4738('0x4'));var db=require(_0x4738('0x5'))['db'];var utils=require(_0x4738('0x6'));var logger=require('../../config/logger')(_0x4738('0x7'));var config=require(_0x4738('0x8'));var jayson=require(_0x4738('0x9'));var client=jayson[_0x4738('0xa')][_0x4738('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18aeeb,_0x3bcd76,_0xe0a3f9){return new BPromise(function(_0x203af1,_0x59d164){return client[_0x4738('0xc')](_0x18aeeb,_0xe0a3f9)[_0x4738('0xd')](function(_0xafe533){logger[_0x4738('0xe')](_0x4738('0xf'),_0x3bcd76,_0x4738('0x10'));logger[_0x4738('0x11')](_0x4738('0x12'),_0x3bcd76,_0x4738('0x10'),JSON[_0x4738('0x13')](_0xafe533));if(_0xafe533['error']){if(_0xafe533[_0x4738('0x14')]['code']===0x1f4){logger[_0x4738('0x14')]('Condition,\x20%s,\x20%s',_0x3bcd76,_0xafe533['error'][_0x4738('0x15')]);return _0x59d164(_0xafe533[_0x4738('0x14')][_0x4738('0x15')]);}logger[_0x4738('0x14')](_0x4738('0xf'),_0x3bcd76,_0xafe533[_0x4738('0x14')][_0x4738('0x15')]);return _0x203af1(_0xafe533[_0x4738('0x14')][_0x4738('0x15')]);}else{logger[_0x4738('0xe')](_0x4738('0xf'),_0x3bcd76,_0x4738('0x10'));_0x203af1(_0xafe533[_0x4738('0x16')][_0x4738('0x15')]);}})[_0x4738('0x17')](function(_0x4d2863){logger[_0x4738('0x14')](_0x4738('0xf'),_0x3bcd76,_0x4d2863);_0x59d164(_0x4d2863);});});}