Built motion from commit (unavailable).|2.4.21
[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 _0x4887=['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','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','http'];(function(_0x2e1a9a,_0x11e43f){var _0x33f5e7=function(_0x4ef53e){while(--_0x4ef53e){_0x2e1a9a['push'](_0x2e1a9a['shift']());}};_0x33f5e7(++_0x11e43f);}(_0x4887,0x12b));var _0x7488=function(_0x21a470,_0x1a733d){_0x21a470=_0x21a470-0x0;var _0x409d00=_0x4887[_0x21a470];return _0x409d00;};'use strict';var _=require(_0x7488('0x0'));var util=require(_0x7488('0x1'));var moment=require(_0x7488('0x2'));var BPromise=require(_0x7488('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7488('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7488('0x5'));var config=require(_0x7488('0x6'));var jayson=require(_0x7488('0x7'));var client=jayson['client'][_0x7488('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x75783b,_0x26f520,_0x3b8ea6){return new BPromise(function(_0x4d6e3d,_0x18695a){return client[_0x7488('0x9')](_0x75783b,_0x3b8ea6)[_0x7488('0xa')](function(_0x1e5ce8){logger[_0x7488('0xb')](_0x7488('0xc'),_0x26f520,_0x7488('0xd'));logger[_0x7488('0xe')](_0x7488('0xf'),_0x26f520,_0x7488('0xd'),JSON[_0x7488('0x10')](_0x1e5ce8));if(_0x1e5ce8[_0x7488('0x11')]){if(_0x1e5ce8[_0x7488('0x11')][_0x7488('0x12')]===0x1f4){logger[_0x7488('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x26f520,_0x1e5ce8[_0x7488('0x11')]['message']);return _0x18695a(_0x1e5ce8[_0x7488('0x11')][_0x7488('0x13')]);}logger['error'](_0x7488('0xc'),_0x26f520,_0x1e5ce8['error'][_0x7488('0x13')]);return _0x4d6e3d(_0x1e5ce8['error'][_0x7488('0x13')]);}else{logger[_0x7488('0xb')](_0x7488('0xc'),_0x26f520,_0x7488('0xd'));_0x4d6e3d(_0x1e5ce8[_0x7488('0x14')]['message']);}})[_0x7488('0x15')](function(_0x20a6d5){logger[_0x7488('0x11')](_0x7488('0xc'),_0x26f520,_0x20a6d5);_0x18695a(_0x20a6d5);});});}