Built motion from commit (unavailable).|2.4.20
[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 _0x0b73=['../../config/environment','jayson/promise','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3926de,_0x469cb5){var _0xd5ba4c=function(_0x40e4d2){while(--_0x40e4d2){_0x3926de['push'](_0x3926de['shift']());}};_0xd5ba4c(++_0x469cb5);}(_0x0b73,0x13a));var _0x30b7=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x0b73[_0x243b59];return _0x3e1676;};'use strict';var _=require(_0x30b7('0x0'));var util=require(_0x30b7('0x1'));var moment=require('moment');var BPromise=require(_0x30b7('0x2'));var rs=require(_0x30b7('0x3'));var fs=require('fs');var Redis=require(_0x30b7('0x4'));var db=require(_0x30b7('0x5'))['db'];var utils=require(_0x30b7('0x6'));var logger=require(_0x30b7('0x7'))('rpc');var config=require(_0x30b7('0x8'));var jayson=require(_0x30b7('0x9'));var client=jayson['client'][_0x30b7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2eaee9,_0xcafa82,_0x2035d4){return new BPromise(function(_0x21e59b,_0xd97cd7){return client[_0x30b7('0xb')](_0x2eaee9,_0x2035d4)[_0x30b7('0xc')](function(_0xaad1e8){logger[_0x30b7('0xd')](_0x30b7('0xe'),_0xcafa82,_0x30b7('0xf'));logger[_0x30b7('0x10')](_0x30b7('0x11'),_0xcafa82,_0x30b7('0xf'),JSON[_0x30b7('0x12')](_0xaad1e8));if(_0xaad1e8[_0x30b7('0x13')]){if(_0xaad1e8['error'][_0x30b7('0x14')]===0x1f4){logger[_0x30b7('0x13')]('Condition,\x20%s,\x20%s',_0xcafa82,_0xaad1e8[_0x30b7('0x13')][_0x30b7('0x15')]);return _0xd97cd7(_0xaad1e8[_0x30b7('0x13')][_0x30b7('0x15')]);}logger['error'](_0x30b7('0xe'),_0xcafa82,_0xaad1e8['error']['message']);return _0x21e59b(_0xaad1e8['error']['message']);}else{logger[_0x30b7('0xd')](_0x30b7('0xe'),_0xcafa82,_0x30b7('0xf'));_0x21e59b(_0xaad1e8['result'][_0x30b7('0x15')]);}})[_0x30b7('0x16')](function(_0x136ab2){logger['error'](_0x30b7('0xe'),_0xcafa82,_0x136ab2);_0xd97cd7(_0x136ab2);});});}