Built motion from commit b5413ace.|2.6.9
[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 _0x2412=['rpc','../../config/environment','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x37185e,_0x2b6d15){var _0x123c79=function(_0x271323){while(--_0x271323){_0x37185e['push'](_0x37185e['shift']());}};_0x123c79(++_0x2b6d15);}(_0x2412,0xa9));var _0x2241=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2412[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x2241('0x0'));var moment=require(_0x2241('0x1'));var BPromise=require(_0x2241('0x2'));var rs=require(_0x2241('0x3'));var fs=require('fs');var Redis=require(_0x2241('0x4'));var db=require(_0x2241('0x5'))['db'];var utils=require(_0x2241('0x6'));var logger=require('../../config/logger')(_0x2241('0x7'));var config=require(_0x2241('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2241('0x9')][_0x2241('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44ae0e,_0xcb0f47,_0x4d8cdd){return new BPromise(function(_0xa624b4,_0xf9fa44){return client[_0x2241('0xb')](_0x44ae0e,_0x4d8cdd)[_0x2241('0xc')](function(_0x7fab2d){logger[_0x2241('0xd')](_0x2241('0xe'),_0xcb0f47,_0x2241('0xf'));logger['debug'](_0x2241('0x10'),_0xcb0f47,_0x2241('0xf'),JSON[_0x2241('0x11')](_0x7fab2d));if(_0x7fab2d['error']){if(_0x7fab2d[_0x2241('0x12')][_0x2241('0x13')]===0x1f4){logger['error'](_0x2241('0xe'),_0xcb0f47,_0x7fab2d['error'][_0x2241('0x14')]);return _0xf9fa44(_0x7fab2d[_0x2241('0x12')][_0x2241('0x14')]);}logger[_0x2241('0x12')](_0x2241('0xe'),_0xcb0f47,_0x7fab2d['error'][_0x2241('0x14')]);return _0xa624b4(_0x7fab2d['error'][_0x2241('0x14')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0xcb0f47,_0x2241('0xf'));_0xa624b4(_0x7fab2d[_0x2241('0x15')][_0x2241('0x14')]);}})['catch'](function(_0x3d261c){logger[_0x2241('0x12')](_0x2241('0xe'),_0xcb0f47,_0x3d261c);_0xf9fa44(_0x3d261c);});});}