Built motion from commit 21186556.|2.6.19
[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 _0x0c61=['jayson/promise','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x6a474,_0x3b8732){var _0x4c65a6=function(_0x4a5867){while(--_0x4a5867){_0x6a474['push'](_0x6a474['shift']());}};_0x4c65a6(++_0x3b8732);}(_0x0c61,0xdd));var _0x10c6=function(_0xa79977,_0x4f7f12){_0xa79977=_0xa79977-0x0;var _0x109f10=_0x0c61[_0xa79977];return _0x109f10;};'use strict';var _=require(_0x10c6('0x0'));var util=require(_0x10c6('0x1'));var moment=require(_0x10c6('0x2'));var BPromise=require('bluebird');var rs=require(_0x10c6('0x3'));var fs=require('fs');var Redis=require(_0x10c6('0x4'));var db=require(_0x10c6('0x5'))['db'];var utils=require(_0x10c6('0x6'));var logger=require(_0x10c6('0x7'))(_0x10c6('0x8'));var config=require(_0x10c6('0x9'));var jayson=require(_0x10c6('0xa'));var client=jayson[_0x10c6('0xb')][_0x10c6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41388c,_0x234031,_0x549930){return new BPromise(function(_0x2125e1,_0x1ce6b6){return client['request'](_0x41388c,_0x549930)[_0x10c6('0xd')](function(_0x35955f){logger[_0x10c6('0xe')](_0x10c6('0xf'),_0x234031,'request\x20sent');logger[_0x10c6('0x10')](_0x10c6('0x11'),_0x234031,'request\x20sent',JSON[_0x10c6('0x12')](_0x35955f));if(_0x35955f[_0x10c6('0x13')]){if(_0x35955f['error']['code']===0x1f4){logger[_0x10c6('0x13')](_0x10c6('0xf'),_0x234031,_0x35955f[_0x10c6('0x13')]['message']);return _0x1ce6b6(_0x35955f[_0x10c6('0x13')]['message']);}logger['error'](_0x10c6('0xf'),_0x234031,_0x35955f[_0x10c6('0x13')][_0x10c6('0x14')]);return _0x2125e1(_0x35955f[_0x10c6('0x13')][_0x10c6('0x14')]);}else{logger['info'](_0x10c6('0xf'),_0x234031,'request\x20sent');_0x2125e1(_0x35955f['result'][_0x10c6('0x14')]);}})['catch'](function(_0x5dd0c0){logger[_0x10c6('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x234031,_0x5dd0c0);_0x1ce6b6(_0x5dd0c0);});});}