Built motion from commit 00bf23f6.|2.6.16
[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 _0x8fe7=['debug','Condition,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Condition,\x20%s,\x20%s','request\x20sent'];(function(_0x31ca46,_0x1aaabd){var _0x46d55d=function(_0x31e536){while(--_0x31e536){_0x31ca46['push'](_0x31ca46['shift']());}};_0x46d55d(++_0x1aaabd);}(_0x8fe7,0x1e7));var _0x78fe=function(_0x56e4ba,_0x55da3e){_0x56e4ba=_0x56e4ba-0x0;var _0x5a501f=_0x8fe7[_0x56e4ba];return _0x5a501f;};'use strict';var _=require(_0x78fe('0x0'));var util=require(_0x78fe('0x1'));var moment=require(_0x78fe('0x2'));var BPromise=require(_0x78fe('0x3'));var rs=require(_0x78fe('0x4'));var fs=require('fs');var Redis=require(_0x78fe('0x5'));var db=require(_0x78fe('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x78fe('0x7'))(_0x78fe('0x8'));var config=require(_0x78fe('0x9'));var jayson=require(_0x78fe('0xa'));var client=jayson[_0x78fe('0xb')][_0x78fe('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21ee9d,_0x3632eb,_0x30ee33){return new BPromise(function(_0x1d53a9,_0x9b2dc6){return client['request'](_0x21ee9d,_0x30ee33)[_0x78fe('0xd')](function(_0xced216){logger[_0x78fe('0xe')](_0x78fe('0xf'),_0x3632eb,_0x78fe('0x10'));logger[_0x78fe('0x11')](_0x78fe('0x12'),_0x3632eb,_0x78fe('0x10'),JSON['stringify'](_0xced216));if(_0xced216[_0x78fe('0x13')]){if(_0xced216[_0x78fe('0x13')][_0x78fe('0x14')]===0x1f4){logger['error'](_0x78fe('0xf'),_0x3632eb,_0xced216['error'][_0x78fe('0x15')]);return _0x9b2dc6(_0xced216[_0x78fe('0x13')][_0x78fe('0x15')]);}logger[_0x78fe('0x13')]('Condition,\x20%s,\x20%s',_0x3632eb,_0xced216['error'][_0x78fe('0x15')]);return _0x1d53a9(_0xced216[_0x78fe('0x13')][_0x78fe('0x15')]);}else{logger['info'](_0x78fe('0xf'),_0x3632eb,_0x78fe('0x10'));_0x1d53a9(_0xced216[_0x78fe('0x16')]['message']);}})[_0x78fe('0x17')](function(_0xc3ab52){logger['error']('Condition,\x20%s,\x20%s',_0x3632eb,_0xc3ab52);_0x9b2dc6(_0xc3ab52);});});}