95c13e0c0875a9e5b5dd708c39303ad8aa99f414
[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 _0x0086=['AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','debug'];(function(_0x336df4,_0x52c1dc){var _0x580d8c=function(_0x2febf1){while(--_0x2febf1){_0x336df4['push'](_0x336df4['shift']());}};_0x580d8c(++_0x52c1dc);}(_0x0086,0xc0));var _0x6008=function(_0x567f90,_0x425d38){_0x567f90=_0x567f90-0x0;var _0x12e074=_0x0086[_0x567f90];return _0x12e074;};'use strict';var _=require(_0x6008('0x0'));var util=require(_0x6008('0x1'));var moment=require(_0x6008('0x2'));var BPromise=require(_0x6008('0x3'));var rs=require(_0x6008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6008('0x5'))['db'];var utils=require(_0x6008('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6008('0x7'));var jayson=require(_0x6008('0x8'));var client=jayson[_0x6008('0x9')][_0x6008('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31c285,_0x2666b8,_0x2955ec){return new BPromise(function(_0x32b719,_0xe55ce0){return client['request'](_0x31c285,_0x2955ec)[_0x6008('0xb')](function(_0x148bb9){logger[_0x6008('0xc')](_0x6008('0xd'),_0x2666b8,'request\x20sent');logger[_0x6008('0xe')](_0x6008('0xf'),_0x2666b8,'request\x20sent',JSON[_0x6008('0x10')](_0x148bb9));if(_0x148bb9[_0x6008('0x11')]){if(_0x148bb9[_0x6008('0x11')][_0x6008('0x12')]===0x1f4){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x2666b8,_0x148bb9[_0x6008('0x11')]['message']);return _0xe55ce0(_0x148bb9[_0x6008('0x11')][_0x6008('0x13')]);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x2666b8,_0x148bb9[_0x6008('0x11')]['message']);return _0x32b719(_0x148bb9[_0x6008('0x11')][_0x6008('0x13')]);}else{logger[_0x6008('0xc')](_0x6008('0xd'),_0x2666b8,_0x6008('0x14'));_0x32b719(_0x148bb9[_0x6008('0x15')][_0x6008('0x13')]);}})[_0x6008('0x16')](function(_0xf0dad6){logger[_0x6008('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x2666b8,_0xf0dad6);_0xe55ce0(_0xf0dad6);});});}