Built motion from commit (unavailable).|2.5.18
[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 _0x38a4=['error','code','message','result','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s'];(function(_0x27297f,_0x4983d3){var _0x297665=function(_0x14a77a){while(--_0x14a77a){_0x27297f['push'](_0x27297f['shift']());}};_0x297665(++_0x4983d3);}(_0x38a4,0x82));var _0x438a=function(_0x2f46f9,_0x46a26d){_0x2f46f9=_0x2f46f9-0x0;var _0x1fa811=_0x38a4[_0x2f46f9];return _0x1fa811;};'use strict';var _=require(_0x438a('0x0'));var util=require(_0x438a('0x1'));var moment=require('moment');var BPromise=require(_0x438a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x438a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x438a('0x4'));var logger=require(_0x438a('0x5'))(_0x438a('0x6'));var config=require(_0x438a('0x7'));var jayson=require(_0x438a('0x8'));var client=jayson[_0x438a('0x9')][_0x438a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30e4bb,_0x1f61f3,_0x3cb441){return new BPromise(function(_0x2e7c01,_0xc7de4b){return client[_0x438a('0xb')](_0x30e4bb,_0x3cb441)[_0x438a('0xc')](function(_0x52c7fb){logger[_0x438a('0xd')](_0x438a('0xe'),_0x1f61f3,_0x438a('0xf'));logger['debug'](_0x438a('0x10'),_0x1f61f3,'request\x20sent',JSON['stringify'](_0x52c7fb));if(_0x52c7fb['error']){if(_0x52c7fb[_0x438a('0x11')][_0x438a('0x12')]===0x1f4){logger[_0x438a('0x11')](_0x438a('0xe'),_0x1f61f3,_0x52c7fb[_0x438a('0x11')][_0x438a('0x13')]);return _0xc7de4b(_0x52c7fb[_0x438a('0x11')][_0x438a('0x13')]);}logger['error'](_0x438a('0xe'),_0x1f61f3,_0x52c7fb['error']['message']);return _0x2e7c01(_0x52c7fb[_0x438a('0x11')]['message']);}else{logger[_0x438a('0xd')](_0x438a('0xe'),_0x1f61f3,'request\x20sent');_0x2e7c01(_0x52c7fb[_0x438a('0x14')][_0x438a('0x13')]);}})['catch'](function(_0x4f29c6){logger[_0x438a('0x11')](_0x438a('0xe'),_0x1f61f3,_0x4f29c6);_0xc7de4b(_0x4f29c6);});});}