b0b71b531f936f81cb1bb25d45585124d998f0f9
[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 _0x73a8=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x73a8,0x103));var _0x873a=function(_0x9474d9,_0x29c7e3){_0x9474d9=_0x9474d9-0x0;var _0x2ebcd7=_0x73a8[_0x9474d9];return _0x2ebcd7;};'use strict';var _=require(_0x873a('0x0'));var util=require(_0x873a('0x1'));var moment=require(_0x873a('0x2'));var BPromise=require(_0x873a('0x3'));var rs=require(_0x873a('0x4'));var fs=require('fs');var Redis=require(_0x873a('0x5'));var db=require(_0x873a('0x6'))['db'];var utils=require(_0x873a('0x7'));var logger=require(_0x873a('0x8'))(_0x873a('0x9'));var config=require(_0x873a('0xa'));var jayson=require(_0x873a('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x87b60a,_0x33359d,_0x4cbf80){return new BPromise(function(_0x3c19f9,_0x7f7f7d){return client[_0x873a('0xc')](_0x87b60a,_0x4cbf80)[_0x873a('0xd')](function(_0x4e15cd){logger[_0x873a('0xe')](_0x873a('0xf'),_0x33359d,_0x873a('0x10'));logger['debug'](_0x873a('0x11'),_0x33359d,_0x873a('0x10'),JSON[_0x873a('0x12')](_0x4e15cd));if(_0x4e15cd[_0x873a('0x13')]){if(_0x4e15cd[_0x873a('0x13')][_0x873a('0x14')]===0x1f4){logger[_0x873a('0x13')](_0x873a('0xf'),_0x33359d,_0x4e15cd[_0x873a('0x13')][_0x873a('0x15')]);return _0x7f7f7d(_0x4e15cd[_0x873a('0x13')][_0x873a('0x15')]);}logger[_0x873a('0x13')](_0x873a('0xf'),_0x33359d,_0x4e15cd[_0x873a('0x13')][_0x873a('0x15')]);return _0x3c19f9(_0x4e15cd[_0x873a('0x13')]['message']);}else{logger[_0x873a('0xe')](_0x873a('0xf'),_0x33359d,'request\x20sent');_0x3c19f9(_0x4e15cd[_0x873a('0x16')]['message']);}})[_0x873a('0x17')](function(_0x49d89a){logger[_0x873a('0x13')](_0x873a('0xf'),_0x33359d,_0x49d89a);_0x7f7f7d(_0x49d89a);});});}