Built motion from commit (unavailable).|2.6.0
[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 _0x1c20=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x1bb08b,_0xb5449e){var _0x239d8d=function(_0x1b4db2){while(--_0x1b4db2){_0x1bb08b['push'](_0x1bb08b['shift']());}};_0x239d8d(++_0xb5449e);}(_0x1c20,0x18c));var _0x01c2=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x1c20[_0x12d033];return _0x3b4e80;};'use strict';var _=require(_0x01c2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x01c2('0x1'));var rs=require(_0x01c2('0x2'));var fs=require('fs');var Redis=require(_0x01c2('0x3'));var db=require(_0x01c2('0x4'))['db'];var utils=require(_0x01c2('0x5'));var logger=require(_0x01c2('0x6'))(_0x01c2('0x7'));var config=require('../../config/environment');var jayson=require(_0x01c2('0x8'));var client=jayson['client'][_0x01c2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fd2e0,_0x1706af,_0x45888b){return new BPromise(function(_0x5b4e82,_0x3fdcb2){return client[_0x01c2('0xa')](_0x3fd2e0,_0x45888b)[_0x01c2('0xb')](function(_0x5ecac6){logger[_0x01c2('0xc')](_0x01c2('0xd'),_0x1706af,'request\x20sent');logger[_0x01c2('0xe')](_0x01c2('0xf'),_0x1706af,_0x01c2('0x10'),JSON[_0x01c2('0x11')](_0x5ecac6));if(_0x5ecac6[_0x01c2('0x12')]){if(_0x5ecac6[_0x01c2('0x12')][_0x01c2('0x13')]===0x1f4){logger[_0x01c2('0x12')](_0x01c2('0xd'),_0x1706af,_0x5ecac6[_0x01c2('0x12')][_0x01c2('0x14')]);return _0x3fdcb2(_0x5ecac6[_0x01c2('0x12')][_0x01c2('0x14')]);}logger[_0x01c2('0x12')](_0x01c2('0xd'),_0x1706af,_0x5ecac6['error'][_0x01c2('0x14')]);return _0x5b4e82(_0x5ecac6['error'][_0x01c2('0x14')]);}else{logger[_0x01c2('0xc')](_0x01c2('0xd'),_0x1706af,'request\x20sent');_0x5b4e82(_0x5ecac6['result'][_0x01c2('0x14')]);}})[_0x01c2('0x15')](function(_0x526bbf){logger[_0x01c2('0x12')](_0x01c2('0xd'),_0x1706af,_0x526bbf);_0x3fdcb2(_0x526bbf);});});}