0409d4b6468da86a8f7bda236f14d671e903ec22
[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 _0x479c=['debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticCustomReport,\x20%s,\x20%s','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent'];(function(_0x14d770,_0x41b389){var _0x4283a5=function(_0x1bc6e7){while(--_0x1bc6e7){_0x14d770['push'](_0x14d770['shift']());}};_0x4283a5(++_0x41b389);}(_0x479c,0x11e));var _0xc479=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x479c[_0x4ed520];return _0x4415a6;};'use strict';var _=require(_0xc479('0x0'));var util=require(_0xc479('0x1'));var moment=require(_0xc479('0x2'));var BPromise=require(_0xc479('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc479('0x4'));var db=require(_0xc479('0x5'))['db'];var utils=require(_0xc479('0x6'));var logger=require('../../config/logger')(_0xc479('0x7'));var config=require(_0xc479('0x8'));var jayson=require(_0xc479('0x9'));var client=jayson['client'][_0xc479('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ec119,_0x3316bd,_0x1aeaa6){return new BPromise(function(_0x424e74,_0x25ae02){return client[_0xc479('0xb')](_0x2ec119,_0x1aeaa6)['then'](function(_0x2ae8f9){logger[_0xc479('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3316bd,_0xc479('0xd'));logger[_0xc479('0xe')](_0xc479('0xf'),_0x3316bd,_0xc479('0xd'),JSON[_0xc479('0x10')](_0x2ae8f9));if(_0x2ae8f9['error']){if(_0x2ae8f9[_0xc479('0x11')]['code']===0x1f4){logger['error'](_0xc479('0x12'),_0x3316bd,_0x2ae8f9[_0xc479('0x11')][_0xc479('0x13')]);return _0x25ae02(_0x2ae8f9[_0xc479('0x11')]['message']);}logger[_0xc479('0x11')](_0xc479('0x12'),_0x3316bd,_0x2ae8f9['error'][_0xc479('0x13')]);return _0x424e74(_0x2ae8f9['error'][_0xc479('0x13')]);}else{logger[_0xc479('0xc')](_0xc479('0x12'),_0x3316bd,'request\x20sent');_0x424e74(_0x2ae8f9['result'][_0xc479('0x13')]);}})['catch'](function(_0x1803e3){logger['error'](_0xc479('0x12'),_0x3316bd,_0x1803e3);_0x25ae02(_0x1803e3);});});}