Built motion from commit d5e4af8c.|2.6.23
[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 _0x5bda=['AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','AnalyticMetric,\x20%s,\x20%s','debug'];(function(_0x101fe8,_0x20df0){var _0x2f5451=function(_0x2eb634){while(--_0x2eb634){_0x101fe8['push'](_0x101fe8['shift']());}};_0x2f5451(++_0x20df0);}(_0x5bda,0x1a9));var _0xa5bd=function(_0x389adb,_0x166f1c){_0x389adb=_0x389adb-0x0;var _0x59768e=_0x5bda[_0x389adb];return _0x59768e;};'use strict';var _=require(_0xa5bd('0x0'));var util=require(_0xa5bd('0x1'));var moment=require(_0xa5bd('0x2'));var BPromise=require('bluebird');var rs=require(_0xa5bd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa5bd('0x4'))['db'];var utils=require(_0xa5bd('0x5'));var logger=require(_0xa5bd('0x6'))(_0xa5bd('0x7'));var config=require(_0xa5bd('0x8'));var jayson=require(_0xa5bd('0x9'));var client=jayson['client'][_0xa5bd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x179378,_0x4d2274,_0x13cf13){return new BPromise(function(_0x14ea9c,_0x2f3015){return client['request'](_0x179378,_0x13cf13)[_0xa5bd('0xb')](function(_0x11df57){logger[_0xa5bd('0xc')](_0xa5bd('0xd'),_0x4d2274,'request\x20sent');logger[_0xa5bd('0xe')](_0xa5bd('0xf'),_0x4d2274,_0xa5bd('0x10'),JSON[_0xa5bd('0x11')](_0x11df57));if(_0x11df57[_0xa5bd('0x12')]){if(_0x11df57[_0xa5bd('0x12')][_0xa5bd('0x13')]===0x1f4){logger[_0xa5bd('0x12')](_0xa5bd('0xd'),_0x4d2274,_0x11df57['error'][_0xa5bd('0x14')]);return _0x2f3015(_0x11df57[_0xa5bd('0x12')][_0xa5bd('0x14')]);}logger[_0xa5bd('0x12')](_0xa5bd('0xd'),_0x4d2274,_0x11df57[_0xa5bd('0x12')][_0xa5bd('0x14')]);return _0x14ea9c(_0x11df57[_0xa5bd('0x12')]['message']);}else{logger[_0xa5bd('0xc')](_0xa5bd('0xd'),_0x4d2274,_0xa5bd('0x10'));_0x14ea9c(_0x11df57[_0xa5bd('0x15')][_0xa5bd('0x14')]);}})['catch'](function(_0x1e1f9b){logger[_0xa5bd('0x12')](_0xa5bd('0xd'),_0x4d2274,_0x1e1f9b);_0x2f3015(_0x1e1f9b);});});}