Built motion from commit 511216ff.|2.6.34
[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 _0x0849=['error','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code'];(function(_0x59f0dc,_0x1e2497){var _0x5b5445=function(_0x57ca91){while(--_0x57ca91){_0x59f0dc['push'](_0x59f0dc['shift']());}};_0x5b5445(++_0x1e2497);}(_0x0849,0x1bc));var _0x9084=function(_0xf090bb,_0x4b4d9f){_0xf090bb=_0xf090bb-0x0;var _0x4a57f5=_0x0849[_0xf090bb];return _0x4a57f5;};'use strict';var _=require('lodash');var util=require(_0x9084('0x0'));var moment=require('moment');var BPromise=require(_0x9084('0x1'));var rs=require(_0x9084('0x2'));var fs=require('fs');var Redis=require(_0x9084('0x3'));var db=require(_0x9084('0x4'))['db'];var utils=require(_0x9084('0x5'));var logger=require(_0x9084('0x6'))(_0x9084('0x7'));var config=require('../../config/environment');var jayson=require(_0x9084('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x42c3c2,_0x5f1321,_0x1e506d){return new BPromise(function(_0x179906,_0x461599){return client[_0x9084('0x9')](_0x42c3c2,_0x1e506d)[_0x9084('0xa')](function(_0x35753a){logger[_0x9084('0xb')](_0x9084('0xc'),_0x5f1321,'request\x20sent');logger[_0x9084('0xd')](_0x9084('0xe'),_0x5f1321,_0x9084('0xf'),JSON[_0x9084('0x10')](_0x35753a));if(_0x35753a['error']){if(_0x35753a['error'][_0x9084('0x11')]===0x1f4){logger[_0x9084('0x12')](_0x9084('0xc'),_0x5f1321,_0x35753a[_0x9084('0x12')][_0x9084('0x13')]);return _0x461599(_0x35753a[_0x9084('0x12')][_0x9084('0x13')]);}logger[_0x9084('0x12')](_0x9084('0xc'),_0x5f1321,_0x35753a[_0x9084('0x12')][_0x9084('0x13')]);return _0x179906(_0x35753a[_0x9084('0x12')][_0x9084('0x13')]);}else{logger[_0x9084('0xb')](_0x9084('0xc'),_0x5f1321,_0x9084('0xf'));_0x179906(_0x35753a[_0x9084('0x14')][_0x9084('0x13')]);}})['catch'](function(_0x3e2c10){logger[_0x9084('0x12')](_0x9084('0xc'),_0x5f1321,_0x3e2c10);_0x461599(_0x3e2c10);});});}