a059ad9ad195e50f0d90f2d8a0bd1449d0ffa99f
[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 _0x1b01=['AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent'];(function(_0x209e12,_0x2ce907){var _0x3f5b89=function(_0x39cc7f){while(--_0x39cc7f){_0x209e12['push'](_0x209e12['shift']());}};_0x3f5b89(++_0x2ce907);}(_0x1b01,0x118));var _0x11b0=function(_0x48cbba,_0x374761){_0x48cbba=_0x48cbba-0x0;var _0xdae2a=_0x1b01[_0x48cbba];return _0xdae2a;};'use strict';var _=require(_0x11b0('0x0'));var util=require(_0x11b0('0x1'));var moment=require('moment');var BPromise=require(_0x11b0('0x2'));var rs=require(_0x11b0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x11b0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x11b0('0x5'))(_0x11b0('0x6'));var config=require(_0x11b0('0x7'));var jayson=require(_0x11b0('0x8'));var client=jayson['client'][_0x11b0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x206af4,_0xaa4860,_0x22b287){return new BPromise(function(_0x184a32,_0x178e0d){return client[_0x11b0('0xa')](_0x206af4,_0x22b287)[_0x11b0('0xb')](function(_0x25d636){logger['info'](_0x11b0('0xc'),_0xaa4860,_0x11b0('0xd'));logger['debug'](_0x11b0('0xe'),_0xaa4860,'request\x20sent',JSON[_0x11b0('0xf')](_0x25d636));if(_0x25d636['error']){if(_0x25d636['error'][_0x11b0('0x10')]===0x1f4){logger[_0x11b0('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0xaa4860,_0x25d636[_0x11b0('0x11')][_0x11b0('0x12')]);return _0x178e0d(_0x25d636['error'][_0x11b0('0x12')]);}logger[_0x11b0('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0xaa4860,_0x25d636['error'][_0x11b0('0x12')]);return _0x184a32(_0x25d636['error'][_0x11b0('0x12')]);}else{logger['info'](_0x11b0('0xc'),_0xaa4860,_0x11b0('0xd'));_0x184a32(_0x25d636[_0x11b0('0x13')][_0x11b0('0x12')]);}})[_0x11b0('0x14')](function(_0xe09423){logger[_0x11b0('0x11')](_0x11b0('0xc'),_0xaa4860,_0xe09423);_0x178e0d(_0xe09423);});});}