aab7cfb6a529e8602d26d3b712c7ec819df5cb4b
[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 _0x29a2=['error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x535c56,_0x3f5a88){var _0x116087=function(_0x1d8c08){while(--_0x1d8c08){_0x535c56['push'](_0x535c56['shift']());}};_0x116087(++_0x3f5a88);}(_0x29a2,0x1cf));var _0x229a=function(_0x2e2681,_0x4089c1){_0x2e2681=_0x2e2681-0x0;var _0x368a64=_0x29a2[_0x2e2681];return _0x368a64;};'use strict';var _=require(_0x229a('0x0'));var util=require(_0x229a('0x1'));var moment=require(_0x229a('0x2'));var BPromise=require(_0x229a('0x3'));var rs=require(_0x229a('0x4'));var fs=require('fs');var Redis=require(_0x229a('0x5'));var db=require(_0x229a('0x6'))['db'];var utils=require(_0x229a('0x7'));var logger=require(_0x229a('0x8'))(_0x229a('0x9'));var config=require(_0x229a('0xa'));var jayson=require(_0x229a('0xb'));var client=jayson[_0x229a('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d4c44,_0x32c8ee,_0x37fcfe){return new BPromise(function(_0x745f5,_0x45b173){return client['request'](_0x4d4c44,_0x37fcfe)['then'](function(_0x2a60c5){logger[_0x229a('0xd')](_0x229a('0xe'),_0x32c8ee,_0x229a('0xf'));logger[_0x229a('0x10')](_0x229a('0x11'),_0x32c8ee,_0x229a('0xf'),JSON[_0x229a('0x12')](_0x2a60c5));if(_0x2a60c5['error']){if(_0x2a60c5['error'][_0x229a('0x13')]===0x1f4){logger[_0x229a('0x14')](_0x229a('0xe'),_0x32c8ee,_0x2a60c5['error'][_0x229a('0x15')]);return _0x45b173(_0x2a60c5['error']['message']);}logger[_0x229a('0x14')](_0x229a('0xe'),_0x32c8ee,_0x2a60c5[_0x229a('0x14')][_0x229a('0x15')]);return _0x745f5(_0x2a60c5['error']['message']);}else{logger[_0x229a('0xd')](_0x229a('0xe'),_0x32c8ee,_0x229a('0xf'));_0x745f5(_0x2a60c5[_0x229a('0x16')][_0x229a('0x15')]);}})['catch'](function(_0x322c62){logger[_0x229a('0x14')](_0x229a('0xe'),_0x32c8ee,_0x322c62);_0x45b173(_0x322c62);});});}