2d1666c3c3cebe015d01f36c678fefd028ee7e4a
[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 _0x9979=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x510176,_0x163896){var _0x3b9991=function(_0x5eb626){while(--_0x5eb626){_0x510176['push'](_0x510176['shift']());}};_0x3b9991(++_0x163896);}(_0x9979,0xb3));var _0x9997=function(_0x193b59,_0x1d3454){_0x193b59=_0x193b59-0x0;var _0x339e71=_0x9979[_0x193b59];return _0x339e71;};'use strict';var _=require(_0x9997('0x0'));var util=require(_0x9997('0x1'));var moment=require(_0x9997('0x2'));var BPromise=require(_0x9997('0x3'));var rs=require(_0x9997('0x4'));var fs=require('fs');var Redis=require(_0x9997('0x5'));var db=require(_0x9997('0x6'))['db'];var utils=require(_0x9997('0x7'));var logger=require(_0x9997('0x8'))(_0x9997('0x9'));var config=require(_0x9997('0xa'));var jayson=require(_0x9997('0xb'));var client=jayson[_0x9997('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x396c07,_0x59e190,_0x1a06ae){return new BPromise(function(_0x593740,_0x52dbc9){return client[_0x9997('0xd')](_0x396c07,_0x1a06ae)[_0x9997('0xe')](function(_0x370bc0){logger[_0x9997('0xf')](_0x9997('0x10'),_0x59e190,_0x9997('0x11'));logger[_0x9997('0x12')](_0x9997('0x13'),_0x59e190,_0x9997('0x11'),JSON[_0x9997('0x14')](_0x370bc0));if(_0x370bc0[_0x9997('0x15')]){if(_0x370bc0[_0x9997('0x15')][_0x9997('0x16')]===0x1f4){logger[_0x9997('0x15')](_0x9997('0x10'),_0x59e190,_0x370bc0['error'][_0x9997('0x17')]);return _0x52dbc9(_0x370bc0['error'][_0x9997('0x17')]);}logger['error'](_0x9997('0x10'),_0x59e190,_0x370bc0[_0x9997('0x15')]['message']);return _0x593740(_0x370bc0['error'][_0x9997('0x17')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x59e190,_0x9997('0x11'));_0x593740(_0x370bc0[_0x9997('0x18')][_0x9997('0x17')]);}})[_0x9997('0x19')](function(_0x2791c8){logger[_0x9997('0x15')](_0x9997('0x10'),_0x59e190,_0x2791c8);_0x52dbc9(_0x2791c8);});});}