0f8c5c16677dc2b53086b2e23e8c2047c3010f75
[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 _0x8162=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','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'];(function(_0x11384d,_0x3294b4){var _0x4694f0=function(_0x876213){while(--_0x876213){_0x11384d['push'](_0x11384d['shift']());}};_0x4694f0(++_0x3294b4);}(_0x8162,0xb5));var _0x2816=function(_0x1fac98,_0x3a615e){_0x1fac98=_0x1fac98-0x0;var _0x56dfff=_0x8162[_0x1fac98];return _0x56dfff;};'use strict';var _=require(_0x2816('0x0'));var util=require(_0x2816('0x1'));var moment=require(_0x2816('0x2'));var BPromise=require(_0x2816('0x3'));var rs=require(_0x2816('0x4'));var fs=require('fs');var Redis=require(_0x2816('0x5'));var db=require(_0x2816('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2816('0x7'))(_0x2816('0x8'));var config=require(_0x2816('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2816('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x274cee,_0x58c25c,_0x281757){return new BPromise(function(_0x573575,_0xb6f04f){return client[_0x2816('0xb')](_0x274cee,_0x281757)['then'](function(_0x12ac32){logger[_0x2816('0xc')](_0x2816('0xd'),_0x58c25c,_0x2816('0xe'));logger[_0x2816('0xf')](_0x2816('0x10'),_0x58c25c,_0x2816('0xe'),JSON[_0x2816('0x11')](_0x12ac32));if(_0x12ac32[_0x2816('0x12')]){if(_0x12ac32[_0x2816('0x12')][_0x2816('0x13')]===0x1f4){logger['error'](_0x2816('0xd'),_0x58c25c,_0x12ac32[_0x2816('0x12')][_0x2816('0x14')]);return _0xb6f04f(_0x12ac32['error'][_0x2816('0x14')]);}logger['error'](_0x2816('0xd'),_0x58c25c,_0x12ac32[_0x2816('0x12')][_0x2816('0x14')]);return _0x573575(_0x12ac32['error']['message']);}else{logger[_0x2816('0xc')](_0x2816('0xd'),_0x58c25c,_0x2816('0xe'));_0x573575(_0x12ac32[_0x2816('0x15')]['message']);}})[_0x2816('0x16')](function(_0x5be4a3){logger['error'](_0x2816('0xd'),_0x58c25c,_0x5be4a3);_0xb6f04f(_0x5be4a3);});});}