Built motion from commit 85328c08.|2.5.50
[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 _0x2aa9=['../../config/logger','rpc','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x21d0c3,_0x16c71c){var _0x4df18e=function(_0x576bfe){while(--_0x576bfe){_0x21d0c3['push'](_0x21d0c3['shift']());}};_0x4df18e(++_0x16c71c);}(_0x2aa9,0x18a));var _0x92aa=function(_0x305753,_0x299ca1){_0x305753=_0x305753-0x0;var _0x3ad6ff=_0x2aa9[_0x305753];return _0x3ad6ff;};'use strict';var _=require(_0x92aa('0x0'));var util=require(_0x92aa('0x1'));var moment=require(_0x92aa('0x2'));var BPromise=require(_0x92aa('0x3'));var rs=require(_0x92aa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92aa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x92aa('0x6'))(_0x92aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x92aa('0x8')][_0x92aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x486b33,_0x7655b7,_0x3a0ec5){return new BPromise(function(_0x60d396,_0x361f52){return client['request'](_0x486b33,_0x3a0ec5)[_0x92aa('0xa')](function(_0x27b665){logger[_0x92aa('0xb')](_0x92aa('0xc'),_0x7655b7,_0x92aa('0xd'));logger[_0x92aa('0xe')](_0x92aa('0xf'),_0x7655b7,_0x92aa('0xd'),JSON[_0x92aa('0x10')](_0x27b665));if(_0x27b665['error']){if(_0x27b665[_0x92aa('0x11')]['code']===0x1f4){logger[_0x92aa('0x11')](_0x92aa('0xc'),_0x7655b7,_0x27b665['error'][_0x92aa('0x12')]);return _0x361f52(_0x27b665[_0x92aa('0x11')][_0x92aa('0x12')]);}logger[_0x92aa('0x11')](_0x92aa('0xc'),_0x7655b7,_0x27b665['error'][_0x92aa('0x12')]);return _0x60d396(_0x27b665[_0x92aa('0x11')][_0x92aa('0x12')]);}else{logger[_0x92aa('0xb')](_0x92aa('0xc'),_0x7655b7,_0x92aa('0xd'));_0x60d396(_0x27b665['result']['message']);}})[_0x92aa('0x13')](function(_0x35e1aa){logger[_0x92aa('0x11')](_0x92aa('0xc'),_0x7655b7,_0x35e1aa);_0x361f52(_0x35e1aa);});});}