Built motion from commit (unavailable).|2.5.0
[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 _0xac91=['AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x14dfe0,_0x2e6727){var _0x8fe235=function(_0x353d96){while(--_0x353d96){_0x14dfe0['push'](_0x14dfe0['shift']());}};_0x8fe235(++_0x2e6727);}(_0xac91,0x104));var _0x1ac9=function(_0x48e86c,_0x9f034d){_0x48e86c=_0x48e86c-0x0;var _0x54fa11=_0xac91[_0x48e86c];return _0x54fa11;};'use strict';var _=require(_0x1ac9('0x0'));var util=require(_0x1ac9('0x1'));var moment=require(_0x1ac9('0x2'));var BPromise=require(_0x1ac9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1ac9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ac9('0x5'))(_0x1ac9('0x6'));var config=require(_0x1ac9('0x7'));var jayson=require(_0x1ac9('0x8'));var client=jayson[_0x1ac9('0x9')][_0x1ac9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13d2b0,_0x37941b,_0x3d38d5){return new BPromise(function(_0x20e4af,_0x5ba6e1){return client[_0x1ac9('0xb')](_0x13d2b0,_0x3d38d5)[_0x1ac9('0xc')](function(_0x1916ec){logger['info'](_0x1ac9('0xd'),_0x37941b,_0x1ac9('0xe'));logger[_0x1ac9('0xf')](_0x1ac9('0x10'),_0x37941b,_0x1ac9('0xe'),JSON[_0x1ac9('0x11')](_0x1916ec));if(_0x1916ec['error']){if(_0x1916ec[_0x1ac9('0x12')][_0x1ac9('0x13')]===0x1f4){logger['error'](_0x1ac9('0xd'),_0x37941b,_0x1916ec[_0x1ac9('0x12')][_0x1ac9('0x14')]);return _0x5ba6e1(_0x1916ec['error']['message']);}logger[_0x1ac9('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x37941b,_0x1916ec[_0x1ac9('0x12')]['message']);return _0x20e4af(_0x1916ec['error'][_0x1ac9('0x14')]);}else{logger[_0x1ac9('0x15')](_0x1ac9('0xd'),_0x37941b,_0x1ac9('0xe'));_0x20e4af(_0x1916ec[_0x1ac9('0x16')][_0x1ac9('0x14')]);}})['catch'](function(_0x556cdd){logger['error'](_0x1ac9('0xd'),_0x37941b,_0x556cdd);_0x5ba6e1(_0x556cdd);});});}