Built motion from commit (unavailable).|2.5.31
[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 _0x2c34=['info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x1d2ce5,_0x59dc24){var _0x57cf79=function(_0x40ef45){while(--_0x40ef45){_0x1d2ce5['push'](_0x1d2ce5['shift']());}};_0x57cf79(++_0x59dc24);}(_0x2c34,0x111));var _0x42c3=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x2c34[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x42c3('0x0'));var moment=require(_0x42c3('0x1'));var BPromise=require(_0x42c3('0x2'));var rs=require(_0x42c3('0x3'));var fs=require('fs');var Redis=require(_0x42c3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x42c3('0x5'));var logger=require(_0x42c3('0x6'))(_0x42c3('0x7'));var config=require(_0x42c3('0x8'));var jayson=require(_0x42c3('0x9'));var client=jayson[_0x42c3('0xa')][_0x42c3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x155ada,_0x469230,_0x1c2292){return new BPromise(function(_0x180d6d,_0xe19aec){return client['request'](_0x155ada,_0x1c2292)[_0x42c3('0xc')](function(_0x42e6d6){logger[_0x42c3('0xd')](_0x42c3('0xe'),_0x469230,_0x42c3('0xf'));logger['debug'](_0x42c3('0x10'),_0x469230,_0x42c3('0xf'),JSON[_0x42c3('0x11')](_0x42e6d6));if(_0x42e6d6[_0x42c3('0x12')]){if(_0x42e6d6[_0x42c3('0x12')][_0x42c3('0x13')]===0x1f4){logger[_0x42c3('0x12')](_0x42c3('0xe'),_0x469230,_0x42e6d6['error'][_0x42c3('0x14')]);return _0xe19aec(_0x42e6d6[_0x42c3('0x12')][_0x42c3('0x14')]);}logger[_0x42c3('0x12')](_0x42c3('0xe'),_0x469230,_0x42e6d6['error'][_0x42c3('0x14')]);return _0x180d6d(_0x42e6d6[_0x42c3('0x12')][_0x42c3('0x14')]);}else{logger['info'](_0x42c3('0xe'),_0x469230,_0x42c3('0xf'));_0x180d6d(_0x42e6d6[_0x42c3('0x15')][_0x42c3('0x14')]);}})['catch'](function(_0x57c52e){logger[_0x42c3('0x12')](_0x42c3('0xe'),_0x469230,_0x57c52e);_0xe19aec(_0x57c52e);});});}