5be4442649d7dfd77d0d82375b70b104c82e825f
[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 _0xa5b7=['debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent'];(function(_0x2ba2b4,_0x5b45f9){var _0x393417=function(_0x4d186f){while(--_0x4d186f){_0x2ba2b4['push'](_0x2ba2b4['shift']());}};_0x393417(++_0x5b45f9);}(_0xa5b7,0x178));var _0x7a5b=function(_0x49e2d0,_0x149903){_0x49e2d0=_0x49e2d0-0x0;var _0x540149=_0xa5b7[_0x49e2d0];return _0x540149;};'use strict';var _=require(_0x7a5b('0x0'));var util=require(_0x7a5b('0x1'));var moment=require(_0x7a5b('0x2'));var BPromise=require(_0x7a5b('0x3'));var rs=require(_0x7a5b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7a5b('0x5'))['db'];var utils=require(_0x7a5b('0x6'));var logger=require(_0x7a5b('0x7'))(_0x7a5b('0x8'));var config=require(_0x7a5b('0x9'));var jayson=require(_0x7a5b('0xa'));var client=jayson[_0x7a5b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c1444,_0x4efbee,_0x2a9881){return new BPromise(function(_0x8142c0,_0x5469e0){return client['request'](_0x3c1444,_0x2a9881)[_0x7a5b('0xc')](function(_0xe51b49){logger[_0x7a5b('0xd')]('Condition,\x20%s,\x20%s',_0x4efbee,_0x7a5b('0xe'));logger[_0x7a5b('0xf')](_0x7a5b('0x10'),_0x4efbee,_0x7a5b('0xe'),JSON[_0x7a5b('0x11')](_0xe51b49));if(_0xe51b49[_0x7a5b('0x12')]){if(_0xe51b49['error'][_0x7a5b('0x13')]===0x1f4){logger[_0x7a5b('0x12')](_0x7a5b('0x14'),_0x4efbee,_0xe51b49['error'][_0x7a5b('0x15')]);return _0x5469e0(_0xe51b49[_0x7a5b('0x12')]['message']);}logger[_0x7a5b('0x12')](_0x7a5b('0x14'),_0x4efbee,_0xe51b49[_0x7a5b('0x12')][_0x7a5b('0x15')]);return _0x8142c0(_0xe51b49['error'][_0x7a5b('0x15')]);}else{logger[_0x7a5b('0xd')](_0x7a5b('0x14'),_0x4efbee,'request\x20sent');_0x8142c0(_0xe51b49['result']['message']);}})[_0x7a5b('0x16')](function(_0x5da013){logger['error'](_0x7a5b('0x14'),_0x4efbee,_0x5da013);_0x5469e0(_0x5da013);});});}