cb8d600f1ff1477c8d9844b6cc5a1962e2135a49
[motion2.git] / server / api / analyticMetric / analyticMetric.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 _0x613e=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch'];(function(_0x2fba72,_0x21d94a){var _0x3b2058=function(_0x14fa21){while(--_0x14fa21){_0x2fba72['push'](_0x2fba72['shift']());}};_0x3b2058(++_0x21d94a);}(_0x613e,0x1a2));var _0xe613=function(_0x1de6e9,_0x162fe4){_0x1de6e9=_0x1de6e9-0x0;var _0x540a91=_0x613e[_0x1de6e9];return _0x540a91;};'use strict';var _=require(_0xe613('0x0'));var util=require('util');var moment=require(_0xe613('0x1'));var BPromise=require(_0xe613('0x2'));var rs=require(_0xe613('0x3'));var fs=require('fs');var Redis=require(_0xe613('0x4'));var db=require(_0xe613('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe613('0x6'))(_0xe613('0x7'));var config=require(_0xe613('0x8'));var jayson=require(_0xe613('0x9'));var client=jayson[_0xe613('0xa')][_0xe613('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b6652,_0x5cbca3,_0x51ca54){return new BPromise(function(_0xcab406,_0x4ec57a){return client[_0xe613('0xc')](_0x1b6652,_0x51ca54)['then'](function(_0x2c4590){logger[_0xe613('0xd')](_0xe613('0xe'),_0x5cbca3,_0xe613('0xf'));logger[_0xe613('0x10')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x5cbca3,_0xe613('0xf'),JSON['stringify'](_0x2c4590));if(_0x2c4590[_0xe613('0x11')]){if(_0x2c4590[_0xe613('0x11')][_0xe613('0x12')]===0x1f4){logger[_0xe613('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x5cbca3,_0x2c4590[_0xe613('0x11')][_0xe613('0x13')]);return _0x4ec57a(_0x2c4590['error'][_0xe613('0x13')]);}logger[_0xe613('0x11')](_0xe613('0xe'),_0x5cbca3,_0x2c4590[_0xe613('0x11')][_0xe613('0x13')]);return _0xcab406(_0x2c4590[_0xe613('0x11')][_0xe613('0x13')]);}else{logger[_0xe613('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x5cbca3,_0xe613('0xf'));_0xcab406(_0x2c4590[_0xe613('0x14')]['message']);}})[_0xe613('0x15')](function(_0x5cf8e4){logger['error'](_0xe613('0xe'),_0x5cbca3,_0x5cf8e4);_0x4ec57a(_0x5cf8e4);});});}