8982ddf6abfde67ed224aac6f7d9b847db46e26b
[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 _0x3287=['http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x30f5bb,_0x4db4bd){var _0x1cfc00=function(_0x20f833){while(--_0x20f833){_0x30f5bb['push'](_0x30f5bb['shift']());}};_0x1cfc00(++_0x4db4bd);}(_0x3287,0xdb));var _0x7328=function(_0x9f2d3,_0x226f0f){_0x9f2d3=_0x9f2d3-0x0;var _0x176342=_0x3287[_0x9f2d3];return _0x176342;};'use strict';var _=require(_0x7328('0x0'));var util=require(_0x7328('0x1'));var moment=require('moment');var BPromise=require(_0x7328('0x2'));var rs=require(_0x7328('0x3'));var fs=require('fs');var Redis=require(_0x7328('0x4'));var db=require(_0x7328('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7328('0x6'))(_0x7328('0x7'));var config=require(_0x7328('0x8'));var jayson=require(_0x7328('0x9'));var client=jayson[_0x7328('0xa')][_0x7328('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40957d,_0x2fc3ae,_0x280641){return new BPromise(function(_0x2a03fe,_0x359629){return client['request'](_0x40957d,_0x280641)[_0x7328('0xc')](function(_0x36ba86){logger[_0x7328('0xd')](_0x7328('0xe'),_0x2fc3ae,_0x7328('0xf'));logger[_0x7328('0x10')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x2fc3ae,_0x7328('0xf'),JSON[_0x7328('0x11')](_0x36ba86));if(_0x36ba86[_0x7328('0x12')]){if(_0x36ba86['error'][_0x7328('0x13')]===0x1f4){logger[_0x7328('0x12')](_0x7328('0xe'),_0x2fc3ae,_0x36ba86['error'][_0x7328('0x14')]);return _0x359629(_0x36ba86[_0x7328('0x12')][_0x7328('0x14')]);}logger[_0x7328('0x12')](_0x7328('0xe'),_0x2fc3ae,_0x36ba86['error']['message']);return _0x2a03fe(_0x36ba86[_0x7328('0x12')][_0x7328('0x14')]);}else{logger[_0x7328('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x2fc3ae,'request\x20sent');_0x2a03fe(_0x36ba86[_0x7328('0x15')][_0x7328('0x14')]);}})[_0x7328('0x16')](function(_0x57f2ac){logger[_0x7328('0x12')](_0x7328('0xe'),_0x2fc3ae,_0x57f2ac);_0x359629(_0x57f2ac);});});}