Built motion from commit 14588770.|2.5.38
[motion2.git] / server / api / analyticExtractedReport / analyticExtractedReport.controller.js
index 000f8fc..0f2d438 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x759f=['catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','download','basename','savename','output','existsSync','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','join','format','%s.%s','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','status','json','count','offset','Content-Range','apply','reject','then','destroy','get','ExtractedReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','order','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x1c1420,_0x725c67){var _0x135494=function(_0x59f14c){while(--_0x59f14c){_0x1c1420['push'](_0x1c1420['shift']());}};_0x135494(++_0x725c67);}(_0x759f,0xc9));var _0xf759=function(_0x5c3b45,_0x1ab73e){_0x5c3b45=_0x5c3b45-0x0;var _0x4fbd0b=_0x759f[_0x5c3b45];return _0x4fbd0b;};'use strict';var pdf=require(_0xf759('0x0'));var emlformat=require(_0xf759('0x1'));var rimraf=require(_0xf759('0x2'));var zipdir=require(_0xf759('0x3'));var jsonpatch=require(_0xf759('0x4'));var rp=require(_0xf759('0x5'));var moment=require(_0xf759('0x6'));var BPromise=require(_0xf759('0x7'));var Mustache=require(_0xf759('0x8'));var util=require(_0xf759('0x9'));var path=require(_0xf759('0xa'));var sox=require(_0xf759('0xb'));var csv=require(_0xf759('0xc'));var ejs=require(_0xf759('0xd'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf759('0xe'));var jsforce=require(_0xf759('0xf'));var deskjs=require(_0xf759('0x10'));var toCsv=require(_0xf759('0xc'));var querystring=require(_0xf759('0x11'));var Papa=require(_0xf759('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf759('0x13'));var as=require(_0xf759('0x14'));var hardwareService=require(_0xf759('0x15'));var logger=require('../../config/logger')(_0xf759('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xf759('0x17'))['db'];function respondWithStatusCode(_0x1197ed,_0x5e5a35){_0x5e5a35=_0x5e5a35||0xcc;return function(_0x554eca){if(_0x554eca){return _0x1197ed['sendStatus'](_0x5e5a35);}return _0x1197ed[_0xf759('0x18')](_0x5e5a35)['end']();};}function respondWithResult(_0x1bb4ef,_0x42573b){_0x42573b=_0x42573b||0xc8;return function(_0x5efa8d){if(_0x5efa8d){return _0x1bb4ef['status'](_0x42573b)[_0xf759('0x19')](_0x5efa8d);}};}function respondWithFilteredResult(_0x17249a,_0x65a392){return function(_0x33fb44){if(_0x33fb44){var _0x13da01=_0x33fb44[_0xf759('0x1a')],_0x4d9cf0=_0x65a392[_0xf759('0x1b')],_0x52a22f=_0x65a392[_0xf759('0x1b')]+_0x65a392['limit'],_0x43f80c;if(_0x52a22f>=_0x13da01){_0x52a22f=_0x13da01;_0x43f80c=0xc8;}else{_0x43f80c=0xce;}_0x17249a['status'](_0x43f80c);return _0x17249a['set'](_0xf759('0x1c'),_0x4d9cf0+'-'+_0x52a22f+'/'+_0x13da01)[_0xf759('0x19')](_0x33fb44);}return null;};}function patchUpdates(_0x2d0e01){return function(_0x544cad){try{jsonpatch[_0xf759('0x1d')](_0x544cad,_0x2d0e01,!![]);}catch(_0x579dc2){return BPromise[_0xf759('0x1e')](_0x579dc2);}return _0x544cad['save']();};}function saveUpdates(_0x1d8f11,_0x4950ac){return function(_0x2814be){if(_0x2814be){return _0x2814be['update'](_0x1d8f11)[_0xf759('0x1f')](function(_0x59932e){return _0x59932e;});}return null;};}function removeEntity(_0x495e89,_0x52af87){return function(_0x2fff0d){if(_0x2fff0d){return _0x2fff0d[_0xf759('0x20')]()[_0xf759('0x1f')](function(){var _0x269f40=_0x2fff0d[_0xf759('0x21')]({'plain':!![]});var _0x331f13=_0xf759('0x22');return db[_0xf759('0x23')][_0xf759('0x20')]({'where':{'type':_0x331f13,'resourceId':_0x269f40['id']}})[_0xf759('0x1f')](function(){return _0x2fff0d;});})['then'](function(){_0x495e89['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x666f36,_0xccb116){return function(_0x1a6d83){if(!_0x1a6d83){_0x666f36[_0xf759('0x24')](0x194);}return _0x1a6d83;};}function handleError(_0x1e7f87,_0x56e470){_0x56e470=_0x56e470||0x1f4;return function(_0x1cb09e){logger[_0xf759('0x25')](_0x1cb09e[_0xf759('0x26')]);if(_0x1cb09e[_0xf759('0x27')]){delete _0x1cb09e[_0xf759('0x27')];}_0x1e7f87[_0xf759('0x18')](_0x56e470)[_0xf759('0x28')](_0x1cb09e);};}exports[_0xf759('0x29')]=function(_0x42b289,_0xe0a49){var _0x2bf70b={},_0x13a65f={},_0x22c92e={'count':0x0,'rows':[]};var _0x1a8385=_[_0xf759('0x2a')](db[_0xf759('0x2b')][_0xf759('0x2c')],function(_0x2f3094){return{'name':_0x2f3094[_0xf759('0x2d')],'type':_0x2f3094[_0xf759('0x2e')]['key']};});_0x13a65f[_0xf759('0x2f')]=_[_0xf759('0x2a')](_0x1a8385,_0xf759('0x27'));_0x13a65f[_0xf759('0x30')]=_[_0xf759('0x31')](_0x42b289[_0xf759('0x30')]);_0x13a65f[_0xf759('0x32')]=_[_0xf759('0x33')](_0x13a65f[_0xf759('0x2f')],_0x13a65f[_0xf759('0x30')]);_0x2bf70b[_0xf759('0x34')]=_['intersection'](_0x13a65f['model'],qs[_0xf759('0x35')](_0x42b289[_0xf759('0x30')][_0xf759('0x35')]));_0x2bf70b['attributes']=_0x2bf70b[_0xf759('0x34')]['length']?_0x2bf70b['attributes']:_0x13a65f[_0xf759('0x2f')];if(!_0x42b289[_0xf759('0x30')]['hasOwnProperty'](_0xf759('0x36'))){_0x2bf70b[_0xf759('0x37')]=qs[_0xf759('0x37')](_0x42b289[_0xf759('0x30')][_0xf759('0x37')]);_0x2bf70b[_0xf759('0x1b')]=qs[_0xf759('0x1b')](_0x42b289[_0xf759('0x30')][_0xf759('0x1b')]);}_0x2bf70b[_0xf759('0x38')]=qs['sort'](_0x42b289[_0xf759('0x30')]['sort']);_0x2bf70b[_0xf759('0x39')]=qs[_0xf759('0x32')](_[_0xf759('0x3a')](_0x42b289[_0xf759('0x30')],_0x13a65f['filters']),_0x1a8385);if(_0x42b289[_0xf759('0x30')]['filter']){_0x2bf70b[_0xf759('0x39')]=_[_0xf759('0x3b')](_0x2bf70b['where'],{'$or':_[_0xf759('0x2a')](_0x1a8385,function(_0x1fa190){if(_0x1fa190['type']!==_0xf759('0x3c')){var _0x540d1e={};_0x540d1e[_0x1fa190[_0xf759('0x27')]]={'$like':'%'+_0x42b289[_0xf759('0x30')][_0xf759('0x3d')]+'%'};return _0x540d1e;}})});}_0x2bf70b=_[_0xf759('0x3b')]({},_0x2bf70b,_0x42b289[_0xf759('0x3e')]);var _0x3fe491={'where':_0x2bf70b[_0xf759('0x39')]};return db['AnalyticExtractedReport']['count'](_0x3fe491)[_0xf759('0x1f')](function(_0x39af8c){_0x22c92e[_0xf759('0x1a')]=_0x39af8c;if(_0x42b289['query'][_0xf759('0x3f')]){_0x2bf70b[_0xf759('0x40')]=[{'all':!![]}];}return db[_0xf759('0x2b')][_0xf759('0x41')](_0x2bf70b);})[_0xf759('0x1f')](function(_0x5c67cc){_0x22c92e[_0xf759('0x42')]=_0x5c67cc;return _0x22c92e;})[_0xf759('0x1f')](respondWithFilteredResult(_0xe0a49,_0x2bf70b))['catch'](handleError(_0xe0a49,null));};exports['show']=function(_0xad3bf7,_0xebe103){var _0x22044d={'raw':!![],'where':{'id':_0xad3bf7[_0xf759('0x43')]['id']}},_0x50372a={};_0x50372a[_0xf759('0x2f')]=_[_0xf759('0x31')](db[_0xf759('0x2b')][_0xf759('0x2c')]);_0x50372a[_0xf759('0x30')]=_[_0xf759('0x31')](_0xad3bf7[_0xf759('0x30')]);_0x50372a[_0xf759('0x32')]=_[_0xf759('0x33')](_0x50372a[_0xf759('0x2f')],_0x50372a[_0xf759('0x30')]);_0x22044d[_0xf759('0x34')]=_[_0xf759('0x33')](_0x50372a[_0xf759('0x2f')],qs[_0xf759('0x35')](_0xad3bf7[_0xf759('0x30')][_0xf759('0x35')]));_0x22044d[_0xf759('0x34')]=_0x22044d[_0xf759('0x34')][_0xf759('0x44')]?_0x22044d[_0xf759('0x34')]:_0x50372a[_0xf759('0x2f')];if(_0xad3bf7[_0xf759('0x30')][_0xf759('0x3f')]){_0x22044d['include']=[{'all':!![]}];}_0x22044d=_[_0xf759('0x3b')]({},_0x22044d,_0xad3bf7[_0xf759('0x3e')]);return db[_0xf759('0x2b')]['find'](_0x22044d)[_0xf759('0x1f')](handleEntityNotFound(_0xebe103,null))[_0xf759('0x1f')](respondWithResult(_0xebe103,null))['catch'](handleError(_0xebe103,null));};exports[_0xf759('0x45')]=function(_0x541455,_0x2f1d25){return db[_0xf759('0x2b')][_0xf759('0x45')](_0x541455[_0xf759('0x46')],{})[_0xf759('0x1f')](function(_0x3f4fe0){var _0x128a48=_0x541455[_0xf759('0x47')][_0xf759('0x21')]({'plain':!![]});if(!_0x128a48)throw new Error(_0xf759('0x48'));if(_0x128a48[_0xf759('0x49')]===_0xf759('0x47')){var _0x354edb=_0x3f4fe0[_0xf759('0x21')]({'plain':!![]});var _0x32f470='ExtractedReports';return db[_0xf759('0x4a')]['find']({'where':{'name':_0x32f470,'userProfileId':_0x128a48['userProfileId']},'raw':!![]})[_0xf759('0x1f')](function(_0x3c75b8){if(_0x3c75b8&&_0x3c75b8['autoAssociation']===0x0){return db[_0xf759('0x23')]['create']({'name':_0x354edb[_0xf759('0x27')],'resourceId':_0x354edb['id'],'type':_0x3c75b8[_0xf759('0x27')],'sectionId':_0x3c75b8['id']},{})[_0xf759('0x1f')](function(){return _0x3f4fe0;});}else{return _0x3f4fe0;}})[_0xf759('0x4b')](function(_0x522ede){logger[_0xf759('0x25')](_0xf759('0x4c'),_0x522ede);throw _0x522ede;});}return _0x3f4fe0;})[_0xf759('0x1f')](respondWithResult(_0x2f1d25,0xc9))['catch'](handleError(_0x2f1d25,null));};exports[_0xf759('0x4d')]=function(_0x5d5c44,_0x193063){if(_0x5d5c44[_0xf759('0x46')]['id']){delete _0x5d5c44[_0xf759('0x46')]['id'];}return db[_0xf759('0x2b')][_0xf759('0x4e')]({'where':{'id':_0x5d5c44[_0xf759('0x43')]['id']}})[_0xf759('0x1f')](handleEntityNotFound(_0x193063,null))[_0xf759('0x1f')](saveUpdates(_0x5d5c44[_0xf759('0x46')],null))[_0xf759('0x1f')](respondWithResult(_0x193063,null))[_0xf759('0x4b')](handleError(_0x193063,null));};exports[_0xf759('0x20')]=function(_0x537e7d,_0x3e40d1){return db[_0xf759('0x2b')][_0xf759('0x4e')]({'where':{'id':_0x537e7d['params']['id']}})[_0xf759('0x1f')](handleEntityNotFound(_0x3e40d1,null))['then'](removeEntity(_0x3e40d1,null))[_0xf759('0x4b')](handleError(_0x3e40d1,null));};exports[_0xf759('0x4f')]=function(_0x2fc8c6,_0x4135d8,_0x1afb10){return db[_0xf759('0x2b')]['find']({'where':{'id':_0x2fc8c6['params']['id']},'attributes':[_0xf759('0x27'),_0xf759('0x50'),_0xf759('0x51'),_0xf759('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0x4135d8,null))[_0xf759('0x1f')](function(_0x18e209){if(_0x18e209){if(!fs[_0xf759('0x53')](path['join'](config[_0xf759('0x54')],_0xf759('0x55'),_0x18e209[_0xf759('0x51')]))){throw new db[(_0xf759('0x56'))]['ValidationError'](_0xf759('0x57'));}if(_0x2fc8c6[_0xf759('0x30')]['exists']){return _0x4135d8[_0xf759('0x24')](0xc8);}return _0x4135d8['download'](path[_0xf759('0x58')](config[_0xf759('0x54')],_0xf759('0x55'),_0x18e209['savename']),util[_0xf759('0x59')](_0xf759('0x5a'),_0x18e209[_0xf759('0x50')]||_0x18e209[_0xf759('0x27')],_0x18e209[_0xf759('0x52')][_0xf759('0x5b')]()));}})['catch'](handleError(_0x4135d8,null));};
\ No newline at end of file
+var _0xa42f=['order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','update','download','savename','output','join','root','server/files/reports','Sequelize','ValidationError','exists','format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','UserProfileResource','destroy','then','end','sendStatus','error','stack','name','send','index','AnalyticExtractedReport','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa42f,0x145));var _0xfa42=function(_0x3b8548,_0x2a1461){_0x3b8548=_0x3b8548-0x0;var _0x5bfe9d=_0xa42f[_0x3b8548];return _0x5bfe9d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfa42('0x0'));var zipdir=require(_0xfa42('0x1'));var jsonpatch=require(_0xfa42('0x2'));var rp=require(_0xfa42('0x3'));var moment=require(_0xfa42('0x4'));var BPromise=require(_0xfa42('0x5'));var Mustache=require(_0xfa42('0x6'));var util=require(_0xfa42('0x7'));var path=require(_0xfa42('0x8'));var sox=require(_0xfa42('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa42('0xa'));var _=require(_0xfa42('0xb'));var squel=require(_0xfa42('0xc'));var crypto=require(_0xfa42('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xfa42('0xe'));var toCsv=require(_0xfa42('0xf'));var querystring=require(_0xfa42('0x10'));var Papa=require(_0xfa42('0x11'));var Redis=require('ioredis');var authService=require(_0xfa42('0x12'));var qs=require(_0xfa42('0x13'));var as=require(_0xfa42('0x14'));var hardwareService=require(_0xfa42('0x15'));var logger=require(_0xfa42('0x16'))(_0xfa42('0x17'));var utils=require(_0xfa42('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x437a9c,_0x11c065){_0x11c065=_0x11c065||0xcc;return function(_0x4611cc){if(_0x4611cc){return _0x437a9c['sendStatus'](_0x11c065);}return _0x437a9c[_0xfa42('0x19')](_0x11c065)['end']();};}function respondWithResult(_0x249501,_0x1237d2){_0x1237d2=_0x1237d2||0xc8;return function(_0x43dac2){if(_0x43dac2){return _0x249501[_0xfa42('0x19')](_0x1237d2)[_0xfa42('0x1a')](_0x43dac2);}};}function respondWithFilteredResult(_0x418290,_0xd1e831){return function(_0x440a9c){if(_0x440a9c){var _0x551119=typeof _0xd1e831['offset']===_0xfa42('0x1b')&&typeof _0xd1e831[_0xfa42('0x1c')]===_0xfa42('0x1b');var _0x4bf88e=_0x440a9c[_0xfa42('0x1d')];var _0x1be195=_0x551119?0x0:_0xd1e831[_0xfa42('0x1e')];var _0x2d0d0f=_0x551119?_0x440a9c[_0xfa42('0x1d')]:_0xd1e831[_0xfa42('0x1e')]+_0xd1e831[_0xfa42('0x1c')];var _0x4bf806;if(_0x2d0d0f>=_0x4bf88e){_0x2d0d0f=_0x4bf88e;_0x4bf806=0xc8;}else{_0x4bf806=0xce;}_0x418290['status'](_0x4bf806);return _0x418290[_0xfa42('0x1f')](_0xfa42('0x20'),_0x1be195+'-'+_0x2d0d0f+'/'+_0x4bf88e)[_0xfa42('0x1a')](_0x440a9c);}return null;};}function patchUpdates(_0x2560f2){return function(_0x160012){try{jsonpatch[_0xfa42('0x21')](_0x160012,_0x2560f2,!![]);}catch(_0x344736){return BPromise[_0xfa42('0x22')](_0x344736);}return _0x160012[_0xfa42('0x23')]();};}function saveUpdates(_0x52f51e,_0x52a4ee){return function(_0x1e0efc){if(_0x1e0efc){return _0x1e0efc['update'](_0x52f51e)['then'](function(_0x2f4958){return _0x2f4958;});}return null;};}function removeEntity(_0x348022,_0x36f30e){return function(_0xa552bf){if(_0xa552bf){return _0xa552bf['destroy']()['then'](function(){var _0x382611=_0xa552bf['get']({'plain':!![]});var _0x12b102='ExtractedReports';return db[_0xfa42('0x24')][_0xfa42('0x25')]({'where':{'type':_0x12b102,'resourceId':_0x382611['id']}})[_0xfa42('0x26')](function(){return _0xa552bf;});})[_0xfa42('0x26')](function(){_0x348022[_0xfa42('0x19')](0xcc)[_0xfa42('0x27')]();});}};}function handleEntityNotFound(_0x491dce,_0x5d0d4d){return function(_0x3ba192){if(!_0x3ba192){_0x491dce[_0xfa42('0x28')](0x194);}return _0x3ba192;};}function handleError(_0x437b9f,_0x16bee1){_0x16bee1=_0x16bee1||0x1f4;return function(_0x3c2d2b){logger[_0xfa42('0x29')](_0x3c2d2b[_0xfa42('0x2a')]);if(_0x3c2d2b[_0xfa42('0x2b')]){delete _0x3c2d2b[_0xfa42('0x2b')];}_0x437b9f[_0xfa42('0x19')](_0x16bee1)[_0xfa42('0x2c')](_0x3c2d2b);};}exports[_0xfa42('0x2d')]=function(_0x38bffe,_0x4f4b87){var _0x33e48d={},_0xf16471={},_0x19e046={'count':0x0,'rows':[]};var _0x596713=_['map'](db[_0xfa42('0x2e')][_0xfa42('0x2f')],function(_0x1d6025){return{'name':_0x1d6025['fieldName'],'type':_0x1d6025[_0xfa42('0x30')][_0xfa42('0x31')]};});_0xf16471['model']=_['map'](_0x596713,'name');_0xf16471[_0xfa42('0x32')]=_['keys'](_0x38bffe['query']);_0xf16471[_0xfa42('0x33')]=_[_0xfa42('0x34')](_0xf16471[_0xfa42('0x35')],_0xf16471[_0xfa42('0x32')]);_0x33e48d[_0xfa42('0x36')]=_[_0xfa42('0x34')](_0xf16471[_0xfa42('0x35')],qs[_0xfa42('0x37')](_0x38bffe[_0xfa42('0x32')][_0xfa42('0x37')]));_0x33e48d[_0xfa42('0x36')]=_0x33e48d[_0xfa42('0x36')][_0xfa42('0x38')]?_0x33e48d[_0xfa42('0x36')]:_0xf16471[_0xfa42('0x35')];if(!_0x38bffe[_0xfa42('0x32')][_0xfa42('0x39')](_0xfa42('0x3a'))){_0x33e48d['limit']=qs['limit'](_0x38bffe[_0xfa42('0x32')][_0xfa42('0x1c')]);_0x33e48d['offset']=qs[_0xfa42('0x1e')](_0x38bffe[_0xfa42('0x32')][_0xfa42('0x1e')]);}_0x33e48d[_0xfa42('0x3b')]=qs[_0xfa42('0x3c')](_0x38bffe[_0xfa42('0x32')][_0xfa42('0x3c')]);_0x33e48d['where']=qs[_0xfa42('0x33')](_[_0xfa42('0x3d')](_0x38bffe[_0xfa42('0x32')],_0xf16471[_0xfa42('0x33')]),_0x596713);if(_0x38bffe[_0xfa42('0x32')][_0xfa42('0x3e')]){_0x33e48d[_0xfa42('0x3f')]=_[_0xfa42('0x40')](_0x33e48d[_0xfa42('0x3f')],{'$or':_[_0xfa42('0x41')](_0x596713,function(_0x205008){if(_0x205008['type']!==_0xfa42('0x42')){var _0x5066eb={};_0x5066eb[_0x205008[_0xfa42('0x2b')]]={'$like':'%'+_0x38bffe['query'][_0xfa42('0x3e')]+'%'};return _0x5066eb;}})});}_0x33e48d=_[_0xfa42('0x40')]({},_0x33e48d,_0x38bffe[_0xfa42('0x43')]);var _0x4eb961={'where':_0x33e48d[_0xfa42('0x3f')]};return db[_0xfa42('0x2e')][_0xfa42('0x1d')](_0x4eb961)['then'](function(_0x346782){_0x19e046[_0xfa42('0x1d')]=_0x346782;if(_0x38bffe['query'][_0xfa42('0x44')]){_0x33e48d[_0xfa42('0x45')]=[{'all':!![]}];}return db[_0xfa42('0x2e')][_0xfa42('0x46')](_0x33e48d);})['then'](function(_0x22c491){_0x19e046[_0xfa42('0x47')]=_0x22c491;return _0x19e046;})[_0xfa42('0x26')](respondWithFilteredResult(_0x4f4b87,_0x33e48d))[_0xfa42('0x48')](handleError(_0x4f4b87,null));};exports[_0xfa42('0x49')]=function(_0x236b67,_0x3bef8b){var _0x494103={'raw':!![],'where':{'id':_0x236b67[_0xfa42('0x4a')]['id']}},_0x4f1fb2={};_0x4f1fb2[_0xfa42('0x35')]=_[_0xfa42('0x4b')](db[_0xfa42('0x2e')]['rawAttributes']);_0x4f1fb2[_0xfa42('0x32')]=_[_0xfa42('0x4b')](_0x236b67[_0xfa42('0x32')]);_0x4f1fb2[_0xfa42('0x33')]=_['intersection'](_0x4f1fb2[_0xfa42('0x35')],_0x4f1fb2[_0xfa42('0x32')]);_0x494103[_0xfa42('0x36')]=_[_0xfa42('0x34')](_0x4f1fb2['model'],qs[_0xfa42('0x37')](_0x236b67[_0xfa42('0x32')]['fields']));_0x494103[_0xfa42('0x36')]=_0x494103['attributes'][_0xfa42('0x38')]?_0x494103[_0xfa42('0x36')]:_0x4f1fb2['model'];if(_0x236b67[_0xfa42('0x32')][_0xfa42('0x44')]){_0x494103['include']=[{'all':!![]}];}_0x494103=_['merge']({},_0x494103,_0x236b67[_0xfa42('0x43')]);return db['AnalyticExtractedReport'][_0xfa42('0x4c')](_0x494103)[_0xfa42('0x26')](handleEntityNotFound(_0x3bef8b,null))[_0xfa42('0x26')](respondWithResult(_0x3bef8b,null))[_0xfa42('0x48')](handleError(_0x3bef8b,null));};exports[_0xfa42('0x4d')]=function(_0x3f86c4,_0x49bd33){return db[_0xfa42('0x2e')][_0xfa42('0x4d')](_0x3f86c4[_0xfa42('0x4e')],{})['then'](function(_0x413750){var _0x10d8ae=_0x3f86c4[_0xfa42('0x4f')]['get']({'plain':!![]});if(!_0x10d8ae)throw new Error(_0xfa42('0x50'));if(_0x10d8ae[_0xfa42('0x51')]==='user'){var _0x59cde2=_0x413750[_0xfa42('0x52')]({'plain':!![]});var _0x1c80df='ExtractedReports';return db[_0xfa42('0x53')][_0xfa42('0x4c')]({'where':{'name':_0x1c80df,'userProfileId':_0x10d8ae['userProfileId']},'raw':!![]})['then'](function(_0x200a7d){if(_0x200a7d&&_0x200a7d[_0xfa42('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x59cde2[_0xfa42('0x2b')],'resourceId':_0x59cde2['id'],'type':_0x200a7d[_0xfa42('0x2b')],'sectionId':_0x200a7d['id']},{})[_0xfa42('0x26')](function(){return _0x413750;});}else{return _0x413750;}})[_0xfa42('0x48')](function(_0x46b66c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x46b66c);throw _0x46b66c;});}return _0x413750;})[_0xfa42('0x26')](respondWithResult(_0x49bd33,0xc9))[_0xfa42('0x48')](handleError(_0x49bd33,null));};exports[_0xfa42('0x55')]=function(_0x22c8af,_0x10a605){if(_0x22c8af[_0xfa42('0x4e')]['id']){delete _0x22c8af[_0xfa42('0x4e')]['id'];}return db[_0xfa42('0x2e')]['find']({'where':{'id':_0x22c8af['params']['id']}})[_0xfa42('0x26')](handleEntityNotFound(_0x10a605,null))[_0xfa42('0x26')](saveUpdates(_0x22c8af[_0xfa42('0x4e')],null))[_0xfa42('0x26')](respondWithResult(_0x10a605,null))['catch'](handleError(_0x10a605,null));};exports[_0xfa42('0x25')]=function(_0x3b87ae,_0x13def5){return db['AnalyticExtractedReport'][_0xfa42('0x4c')]({'where':{'id':_0x3b87ae[_0xfa42('0x4a')]['id']}})[_0xfa42('0x26')](handleEntityNotFound(_0x13def5,null))['then'](removeEntity(_0x13def5,null))['catch'](handleError(_0x13def5,null));};exports[_0xfa42('0x56')]=function(_0x335dbc,_0x293f2c,_0x359e42){return db[_0xfa42('0x2e')][_0xfa42('0x4c')]({'where':{'id':_0x335dbc[_0xfa42('0x4a')]['id']},'attributes':[_0xfa42('0x2b'),'basename',_0xfa42('0x57'),_0xfa42('0x58')],'raw':!![]})['then'](handleEntityNotFound(_0x293f2c,null))[_0xfa42('0x26')](function(_0x1a3232){if(_0x1a3232){if(!fs['existsSync'](path[_0xfa42('0x59')](config[_0xfa42('0x5a')],_0xfa42('0x5b'),_0x1a3232['savename']))){throw new db[(_0xfa42('0x5c'))][(_0xfa42('0x5d'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x335dbc['query'][_0xfa42('0x5e')]){return _0x293f2c[_0xfa42('0x28')](0xc8);}return _0x293f2c['download'](path['join'](config[_0xfa42('0x5a')],_0xfa42('0x5b'),_0x1a3232['savename']),util[_0xfa42('0x5f')]('%s.%s',_0x1a3232['basename']||_0x1a3232[_0xfa42('0x2b')],_0x1a3232['output']['toLowerCase']()));}})[_0xfa42('0x48')](handleError(_0x293f2c,null));};
\ No newline at end of file