Built motion from commit 97153652.|2.6.26
[motion2.git] / server / api / analyticCustomReport / analyticCustomReport.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 _0xfa52=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash'];(function(_0x1893ad,_0x25c0ec){var _0x2b0d88=function(_0x169439){while(--_0x169439){_0x1893ad['push'](_0x1893ad['shift']());}};_0x2b0d88(++_0x25c0ec);}(_0xfa52,0x8b));var _0x2fa5=function(_0x47e91f,_0x33abea){_0x47e91f=_0x47e91f-0x0;var _0x4629c4=_0xfa52[_0x47e91f];return _0x4629c4;};'use strict';var _=require(_0x2fa5('0x0'));var util=require('util');var moment=require(_0x2fa5('0x1'));var BPromise=require(_0x2fa5('0x2'));var rs=require(_0x2fa5('0x3'));var fs=require('fs');var Redis=require(_0x2fa5('0x4'));var db=require(_0x2fa5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2fa5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2fa5('0x7'));var client=jayson[_0x2fa5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ce759,_0x4109f8,_0x5a959a){return new BPromise(function(_0x47d468,_0x3951db){return client[_0x2fa5('0x9')](_0x5ce759,_0x5a959a)[_0x2fa5('0xa')](function(_0x15ea69){logger[_0x2fa5('0xb')](_0x2fa5('0xc'),_0x4109f8,_0x2fa5('0xd'));logger[_0x2fa5('0xe')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x4109f8,_0x2fa5('0xd'),JSON[_0x2fa5('0xf')](_0x15ea69));if(_0x15ea69[_0x2fa5('0x10')]){if(_0x15ea69[_0x2fa5('0x10')]['code']===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x4109f8,_0x15ea69[_0x2fa5('0x10')][_0x2fa5('0x11')]);return _0x3951db(_0x15ea69[_0x2fa5('0x10')][_0x2fa5('0x11')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x4109f8,_0x15ea69['error']['message']);return _0x47d468(_0x15ea69['error'][_0x2fa5('0x11')]);}else{logger[_0x2fa5('0xb')](_0x2fa5('0xc'),_0x4109f8,'request\x20sent');_0x47d468(_0x15ea69[_0x2fa5('0x12')][_0x2fa5('0x11')]);}})[_0x2fa5('0x13')](function(_0x41de26){logger[_0x2fa5('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4109f8,_0x41de26);_0x3951db(_0x41de26);});});}