Built motion from commit (unavailable).|2.5.26
[motion2.git] / server / api / integrationReport / integrationReport.controller.js
index 4dca288..b0e6451 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb928=['destroy','stack','name','send','map','IntegrationReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','then','include','findAll','rows','catch','show','params','rawAttributes','fields','length','includeAll','find','body','update','describe','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x53c9aa,_0x4cca69){var _0x438826=function(_0x2357d1){while(--_0x2357d1){_0x53c9aa['push'](_0x53c9aa['shift']());}};_0x438826(++_0x4cca69);}(_0xb928,0xb0));var _0x8b92=function(_0x4551f6,_0x48151b){_0x4551f6=_0x4551f6-0x0;var _0x581dc2=_0xb928[_0x4551f6];return _0x581dc2;};'use strict';var pdf=require(_0x8b92('0x0'));var emlformat=require(_0x8b92('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8b92('0x2'));var rp=require(_0x8b92('0x3'));var moment=require(_0x8b92('0x4'));var BPromise=require(_0x8b92('0x5'));var Mustache=require('mustache');var util=require(_0x8b92('0x6'));var path=require(_0x8b92('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8b92('0x8'));var squel=require(_0x8b92('0x9'));var crypto=require(_0x8b92('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8b92('0xb'));var Redis=require('ioredis');var authService=require(_0x8b92('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x8b92('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8b92('0xe'));var utils=require(_0x8b92('0xf'));var config=require(_0x8b92('0x10'));var licenseUtil=require(_0x8b92('0x11'));var db=require(_0x8b92('0x12'))['db'];function respondWithStatusCode(_0x1b2111,_0x3cf8ae){_0x3cf8ae=_0x3cf8ae||0xcc;return function(_0x37fb6a){if(_0x37fb6a){return _0x1b2111[_0x8b92('0x13')](_0x3cf8ae);}return _0x1b2111[_0x8b92('0x14')](_0x3cf8ae)[_0x8b92('0x15')]();};}function respondWithResult(_0x465d94,_0x46a0e5){_0x46a0e5=_0x46a0e5||0xc8;return function(_0x257f3d){if(_0x257f3d){return _0x465d94[_0x8b92('0x14')](_0x46a0e5)[_0x8b92('0x16')](_0x257f3d);}};}function respondWithFilteredResult(_0x21457f,_0x1d88c5){return function(_0xf915ca){if(_0xf915ca){var _0xfece68=_0xf915ca[_0x8b92('0x17')],_0x10b23f=_0x1d88c5[_0x8b92('0x18')],_0x3647af=_0x1d88c5[_0x8b92('0x18')]+_0x1d88c5[_0x8b92('0x19')],_0x27e17d;if(_0x3647af>=_0xfece68){_0x3647af=_0xfece68;_0x27e17d=0xc8;}else{_0x27e17d=0xce;}_0x21457f['status'](_0x27e17d);return _0x21457f[_0x8b92('0x1a')](_0x8b92('0x1b'),_0x10b23f+'-'+_0x3647af+'/'+_0xfece68)[_0x8b92('0x16')](_0xf915ca);}return null;};}function patchUpdates(_0x351928){return function(_0x7b63fd){try{jsonpatch[_0x8b92('0x1c')](_0x7b63fd,_0x351928,!![]);}catch(_0x520b0f){return BPromise[_0x8b92('0x1d')](_0x520b0f);}return _0x7b63fd[_0x8b92('0x1e')]();};}function saveUpdates(_0x26603a,_0x5f1df3){return function(_0x13dcdb){if(_0x13dcdb){return _0x13dcdb['update'](_0x26603a)['then'](function(_0x38511e){return _0x38511e;});}return null;};}function removeEntity(_0x5d3c18,_0x34c4a4){return function(_0x3f7986){if(_0x3f7986){return _0x3f7986[_0x8b92('0x1f')]()['then'](function(){_0x5d3c18[_0x8b92('0x14')](0xcc)[_0x8b92('0x15')]();});}};}function handleEntityNotFound(_0x33e83c,_0x5db2e4){return function(_0x12b069){if(!_0x12b069){_0x33e83c['sendStatus'](0x194);}return _0x12b069;};}function handleError(_0x478428,_0x507b97){_0x507b97=_0x507b97||0x1f4;return function(_0x3d0f95){logger['error'](_0x3d0f95[_0x8b92('0x20')]);if(_0x3d0f95[_0x8b92('0x21')]){delete _0x3d0f95['name'];}_0x478428[_0x8b92('0x14')](_0x507b97)[_0x8b92('0x22')](_0x3d0f95);};}exports['index']=function(_0x30aeba,_0xb73fbe){var _0x25dd68={},_0x614882={},_0xc06c43={'count':0x0,'rows':[]};var _0x568781=_[_0x8b92('0x23')](db[_0x8b92('0x24')]['rawAttributes'],function(_0x48e4a1){return{'name':_0x48e4a1[_0x8b92('0x25')],'type':_0x48e4a1[_0x8b92('0x26')][_0x8b92('0x27')]};});_0x614882[_0x8b92('0x28')]=_['map'](_0x568781,_0x8b92('0x21'));_0x614882[_0x8b92('0x29')]=_[_0x8b92('0x2a')](_0x30aeba[_0x8b92('0x29')]);_0x614882[_0x8b92('0x2b')]=_[_0x8b92('0x2c')](_0x614882['model'],_0x614882['query']);_0x25dd68['attributes']=_['intersection'](_0x614882[_0x8b92('0x28')],qs['fields'](_0x30aeba[_0x8b92('0x29')]['fields']));_0x25dd68[_0x8b92('0x2d')]=_0x25dd68[_0x8b92('0x2d')]['length']?_0x25dd68[_0x8b92('0x2d')]:_0x614882[_0x8b92('0x28')];if(!_0x30aeba[_0x8b92('0x29')][_0x8b92('0x2e')](_0x8b92('0x2f'))){_0x25dd68[_0x8b92('0x19')]=qs[_0x8b92('0x19')](_0x30aeba[_0x8b92('0x29')][_0x8b92('0x19')]);_0x25dd68[_0x8b92('0x18')]=qs[_0x8b92('0x18')](_0x30aeba['query'][_0x8b92('0x18')]);}_0x25dd68[_0x8b92('0x30')]=qs[_0x8b92('0x31')](_0x30aeba[_0x8b92('0x29')][_0x8b92('0x31')]);_0x25dd68[_0x8b92('0x32')]=qs[_0x8b92('0x2b')](_[_0x8b92('0x33')](_0x30aeba[_0x8b92('0x29')],_0x614882[_0x8b92('0x2b')]),_0x568781);if(_0x30aeba[_0x8b92('0x29')]['filter']){_0x25dd68[_0x8b92('0x32')]=_[_0x8b92('0x34')](_0x25dd68['where'],{'$or':_[_0x8b92('0x23')](_0x568781,function(_0x344174){if(_0x344174[_0x8b92('0x26')]!==_0x8b92('0x35')){var _0x3f5842={};_0x3f5842[_0x344174[_0x8b92('0x21')]]={'$like':'%'+_0x30aeba[_0x8b92('0x29')]['filter']+'%'};return _0x3f5842;}})});}_0x25dd68=_['merge']({},_0x25dd68,_0x30aeba['options']);var _0x1b3ff5={'where':_0x25dd68[_0x8b92('0x32')]};return db[_0x8b92('0x24')]['count'](_0x1b3ff5)[_0x8b92('0x36')](function(_0x2953b7){_0xc06c43[_0x8b92('0x17')]=_0x2953b7;if(_0x30aeba[_0x8b92('0x29')]['includeAll']){_0x25dd68[_0x8b92('0x37')]=[{'all':!![]}];}return db[_0x8b92('0x24')][_0x8b92('0x38')](_0x25dd68);})['then'](function(_0xc13cd1){_0xc06c43[_0x8b92('0x39')]=_0xc13cd1;return _0xc06c43;})[_0x8b92('0x36')](respondWithFilteredResult(_0xb73fbe,_0x25dd68))[_0x8b92('0x3a')](handleError(_0xb73fbe,null));};exports[_0x8b92('0x3b')]=function(_0x2c929f,_0x1be39f){var _0x3b8877={'raw':![],'where':{'id':_0x2c929f[_0x8b92('0x3c')]['id']}},_0x1433f3={};_0x1433f3[_0x8b92('0x28')]=_[_0x8b92('0x2a')](db['IntegrationReport'][_0x8b92('0x3d')]);_0x1433f3[_0x8b92('0x29')]=_[_0x8b92('0x2a')](_0x2c929f['query']);_0x1433f3[_0x8b92('0x2b')]=_[_0x8b92('0x2c')](_0x1433f3[_0x8b92('0x28')],_0x1433f3[_0x8b92('0x29')]);_0x3b8877[_0x8b92('0x2d')]=_[_0x8b92('0x2c')](_0x1433f3['model'],qs[_0x8b92('0x3e')](_0x2c929f[_0x8b92('0x29')][_0x8b92('0x3e')]));_0x3b8877[_0x8b92('0x2d')]=_0x3b8877[_0x8b92('0x2d')][_0x8b92('0x3f')]?_0x3b8877[_0x8b92('0x2d')]:_0x1433f3[_0x8b92('0x28')];if(_0x2c929f[_0x8b92('0x29')][_0x8b92('0x40')]){_0x3b8877[_0x8b92('0x37')]=[{'all':!![]}];}_0x3b8877=_[_0x8b92('0x34')]({},_0x3b8877,_0x2c929f['options']);return db[_0x8b92('0x24')][_0x8b92('0x41')](_0x3b8877)[_0x8b92('0x36')](handleEntityNotFound(_0x1be39f,null))[_0x8b92('0x36')](respondWithResult(_0x1be39f,null))['catch'](handleError(_0x1be39f,null));};exports['create']=function(_0x48aac8,_0x2aa8b4){return db[_0x8b92('0x24')]['create'](_0x48aac8[_0x8b92('0x42')],{})[_0x8b92('0x36')](respondWithResult(_0x2aa8b4,0xc9))['catch'](handleError(_0x2aa8b4,null));};exports[_0x8b92('0x43')]=function(_0x597610,_0x59e5aa){if(_0x597610[_0x8b92('0x42')]['id']){delete _0x597610['body']['id'];}return db[_0x8b92('0x24')][_0x8b92('0x41')]({'where':{'id':_0x597610[_0x8b92('0x3c')]['id']}})[_0x8b92('0x36')](handleEntityNotFound(_0x59e5aa,null))['then'](saveUpdates(_0x597610[_0x8b92('0x42')],null))[_0x8b92('0x36')](respondWithResult(_0x59e5aa,null))[_0x8b92('0x3a')](handleError(_0x59e5aa,null));};exports[_0x8b92('0x1f')]=function(_0x2ecee4,_0x46ea44){return db[_0x8b92('0x24')]['find']({'where':{'id':_0x2ecee4['params']['id']}})[_0x8b92('0x36')](handleEntityNotFound(_0x46ea44,null))[_0x8b92('0x36')](removeEntity(_0x46ea44,null))[_0x8b92('0x3a')](handleError(_0x46ea44,null));};exports[_0x8b92('0x44')]=function(_0x164a98,_0x1a5b49){return db['IntegrationReport'][_0x8b92('0x44')]()['then'](respondWithResult(_0x1a5b49,null))[_0x8b92('0x3a')](handleError(_0x1a5b49,null));};
\ No newline at end of file
+var _0x7f47=['rows','catch','rawAttributes','includeAll','include','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','count','offset','limit','status','Content-Range','json','apply','reject','save','update','then','destroy','error','name','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','IntegrationReport'];(function(_0x321248,_0x1bf881){var _0x32db83=function(_0x2321fc){while(--_0x2321fc){_0x321248['push'](_0x321248['shift']());}};_0x32db83(++_0x1bf881);}(_0x7f47,0x12e));var _0x77f4=function(_0x1d3791,_0x51c613){_0x1d3791=_0x1d3791-0x0;var _0x40fbf5=_0x7f47[_0x1d3791];return _0x40fbf5;};'use strict';var emlformat=require(_0x77f4('0x0'));var rimraf=require(_0x77f4('0x1'));var zipdir=require(_0x77f4('0x2'));var jsonpatch=require(_0x77f4('0x3'));var rp=require(_0x77f4('0x4'));var moment=require(_0x77f4('0x5'));var BPromise=require(_0x77f4('0x6'));var Mustache=require(_0x77f4('0x7'));var util=require('util');var path=require(_0x77f4('0x8'));var sox=require(_0x77f4('0x9'));var csv=require(_0x77f4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x77f4('0xb'));var _=require('lodash');var squel=require(_0x77f4('0xc'));var crypto=require(_0x77f4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x77f4('0xe'));var toCsv=require('to-csv');var querystring=require(_0x77f4('0xf'));var Papa=require(_0x77f4('0x10'));var Redis=require('ioredis');var authService=require(_0x77f4('0x11'));var qs=require(_0x77f4('0x12'));var as=require(_0x77f4('0x13'));var hardwareService=require(_0x77f4('0x14'));var logger=require('../../config/logger')(_0x77f4('0x15'));var utils=require(_0x77f4('0x16'));var config=require(_0x77f4('0x17'));var licenseUtil=require(_0x77f4('0x18'));var db=require(_0x77f4('0x19'))['db'];function respondWithStatusCode(_0x2a0243,_0x47428a){_0x47428a=_0x47428a||0xcc;return function(_0x15cce6){if(_0x15cce6){return _0x2a0243[_0x77f4('0x1a')](_0x47428a);}return _0x2a0243['status'](_0x47428a)[_0x77f4('0x1b')]();};}function respondWithResult(_0xd23097,_0x15a137){_0x15a137=_0x15a137||0xc8;return function(_0x2fadaf){if(_0x2fadaf){return _0xd23097['status'](_0x15a137)['json'](_0x2fadaf);}};}function respondWithFilteredResult(_0x2d2dbb,_0x18848d){return function(_0x249237){if(_0x249237){var _0x395bb1=_0x249237[_0x77f4('0x1c')],_0x5a8a43=_0x18848d[_0x77f4('0x1d')],_0x310435=_0x18848d[_0x77f4('0x1d')]+_0x18848d[_0x77f4('0x1e')],_0x9ed030;if(_0x310435>=_0x395bb1){_0x310435=_0x395bb1;_0x9ed030=0xc8;}else{_0x9ed030=0xce;}_0x2d2dbb[_0x77f4('0x1f')](_0x9ed030);return _0x2d2dbb['set'](_0x77f4('0x20'),_0x5a8a43+'-'+_0x310435+'/'+_0x395bb1)[_0x77f4('0x21')](_0x249237);}return null;};}function patchUpdates(_0xdf6582){return function(_0x3773a5){try{jsonpatch[_0x77f4('0x22')](_0x3773a5,_0xdf6582,!![]);}catch(_0x39e15c){return BPromise[_0x77f4('0x23')](_0x39e15c);}return _0x3773a5[_0x77f4('0x24')]();};}function saveUpdates(_0x49a688,_0x46ac19){return function(_0x2c7faa){if(_0x2c7faa){return _0x2c7faa[_0x77f4('0x25')](_0x49a688)[_0x77f4('0x26')](function(_0x4067a4){return _0x4067a4;});}return null;};}function removeEntity(_0x20cd71,_0x4ad47b){return function(_0x5ea739){if(_0x5ea739){return _0x5ea739[_0x77f4('0x27')]()[_0x77f4('0x26')](function(){_0x20cd71[_0x77f4('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12c3d5,_0x4a3e98){return function(_0x508076){if(!_0x508076){_0x12c3d5[_0x77f4('0x1a')](0x194);}return _0x508076;};}function handleError(_0x20519d,_0x560213){_0x560213=_0x560213||0x1f4;return function(_0x16c4a6){logger[_0x77f4('0x28')](_0x16c4a6['stack']);if(_0x16c4a6['name']){delete _0x16c4a6[_0x77f4('0x29')];}_0x20519d[_0x77f4('0x1f')](_0x560213)['send'](_0x16c4a6);};}exports['index']=function(_0x98b961,_0x3d487c){var _0x22a69d={},_0x4bef97={},_0x3f45a1={'count':0x0,'rows':[]};var _0x1542c8=_['map'](db['IntegrationReport']['rawAttributes'],function(_0x5c6c27){return{'name':_0x5c6c27['fieldName'],'type':_0x5c6c27[_0x77f4('0x2a')][_0x77f4('0x2b')]};});_0x4bef97[_0x77f4('0x2c')]=_[_0x77f4('0x2d')](_0x1542c8,_0x77f4('0x29'));_0x4bef97[_0x77f4('0x2e')]=_[_0x77f4('0x2f')](_0x98b961[_0x77f4('0x2e')]);_0x4bef97[_0x77f4('0x30')]=_[_0x77f4('0x31')](_0x4bef97[_0x77f4('0x2c')],_0x4bef97['query']);_0x22a69d[_0x77f4('0x32')]=_['intersection'](_0x4bef97[_0x77f4('0x2c')],qs[_0x77f4('0x33')](_0x98b961[_0x77f4('0x2e')][_0x77f4('0x33')]));_0x22a69d[_0x77f4('0x32')]=_0x22a69d[_0x77f4('0x32')][_0x77f4('0x34')]?_0x22a69d[_0x77f4('0x32')]:_0x4bef97['model'];if(!_0x98b961[_0x77f4('0x2e')][_0x77f4('0x35')](_0x77f4('0x36'))){_0x22a69d[_0x77f4('0x1e')]=qs['limit'](_0x98b961[_0x77f4('0x2e')][_0x77f4('0x1e')]);_0x22a69d[_0x77f4('0x1d')]=qs['offset'](_0x98b961[_0x77f4('0x2e')][_0x77f4('0x1d')]);}_0x22a69d['order']=qs[_0x77f4('0x37')](_0x98b961[_0x77f4('0x2e')][_0x77f4('0x37')]);_0x22a69d['where']=qs['filters'](_[_0x77f4('0x38')](_0x98b961[_0x77f4('0x2e')],_0x4bef97['filters']),_0x1542c8);if(_0x98b961[_0x77f4('0x2e')]['filter']){_0x22a69d[_0x77f4('0x39')]=_[_0x77f4('0x3a')](_0x22a69d[_0x77f4('0x39')],{'$or':_[_0x77f4('0x2d')](_0x1542c8,function(_0x4390e3){if(_0x4390e3['type']!==_0x77f4('0x3b')){var _0x398369={};_0x398369[_0x4390e3[_0x77f4('0x29')]]={'$like':'%'+_0x98b961['query'][_0x77f4('0x3c')]+'%'};return _0x398369;}})});}_0x22a69d=_[_0x77f4('0x3a')]({},_0x22a69d,_0x98b961[_0x77f4('0x3d')]);var _0x4be843={'where':_0x22a69d['where']};return db['IntegrationReport'][_0x77f4('0x1c')](_0x4be843)[_0x77f4('0x26')](function(_0x1ab721){_0x3f45a1[_0x77f4('0x1c')]=_0x1ab721;if(_0x98b961['query']['includeAll']){_0x22a69d['include']=[{'all':!![]}];}return db[_0x77f4('0x3e')]['findAll'](_0x22a69d);})['then'](function(_0x4b098a){_0x3f45a1[_0x77f4('0x3f')]=_0x4b098a;return _0x3f45a1;})[_0x77f4('0x26')](respondWithFilteredResult(_0x3d487c,_0x22a69d))[_0x77f4('0x40')](handleError(_0x3d487c,null));};exports['show']=function(_0x26fed3,_0x372618){var _0x4ed9c9={'raw':![],'where':{'id':_0x26fed3['params']['id']}},_0x56d0d8={};_0x56d0d8[_0x77f4('0x2c')]=_['keys'](db[_0x77f4('0x3e')][_0x77f4('0x41')]);_0x56d0d8['query']=_[_0x77f4('0x2f')](_0x26fed3[_0x77f4('0x2e')]);_0x56d0d8[_0x77f4('0x30')]=_[_0x77f4('0x31')](_0x56d0d8[_0x77f4('0x2c')],_0x56d0d8['query']);_0x4ed9c9['attributes']=_[_0x77f4('0x31')](_0x56d0d8[_0x77f4('0x2c')],qs[_0x77f4('0x33')](_0x26fed3[_0x77f4('0x2e')][_0x77f4('0x33')]));_0x4ed9c9[_0x77f4('0x32')]=_0x4ed9c9[_0x77f4('0x32')][_0x77f4('0x34')]?_0x4ed9c9[_0x77f4('0x32')]:_0x56d0d8[_0x77f4('0x2c')];if(_0x26fed3[_0x77f4('0x2e')][_0x77f4('0x42')]){_0x4ed9c9[_0x77f4('0x43')]=[{'all':!![]}];}_0x4ed9c9=_[_0x77f4('0x3a')]({},_0x4ed9c9,_0x26fed3[_0x77f4('0x3d')]);return db[_0x77f4('0x3e')][_0x77f4('0x44')](_0x4ed9c9)['then'](handleEntityNotFound(_0x372618,null))[_0x77f4('0x26')](respondWithResult(_0x372618,null))[_0x77f4('0x40')](handleError(_0x372618,null));};exports[_0x77f4('0x45')]=function(_0x5d4d06,_0x251dfe){return db[_0x77f4('0x3e')][_0x77f4('0x45')](_0x5d4d06['body'],{})[_0x77f4('0x26')](respondWithResult(_0x251dfe,0xc9))[_0x77f4('0x40')](handleError(_0x251dfe,null));};exports['update']=function(_0x39d7bb,_0x186bb8){if(_0x39d7bb[_0x77f4('0x46')]['id']){delete _0x39d7bb['body']['id'];}return db[_0x77f4('0x3e')][_0x77f4('0x44')]({'where':{'id':_0x39d7bb[_0x77f4('0x47')]['id']}})['then'](handleEntityNotFound(_0x186bb8,null))[_0x77f4('0x26')](saveUpdates(_0x39d7bb[_0x77f4('0x46')],null))[_0x77f4('0x26')](respondWithResult(_0x186bb8,null))[_0x77f4('0x40')](handleError(_0x186bb8,null));};exports['destroy']=function(_0x456f19,_0x92f207){return db[_0x77f4('0x3e')]['find']({'where':{'id':_0x456f19['params']['id']}})[_0x77f4('0x26')](handleEntityNotFound(_0x92f207,null))[_0x77f4('0x26')](removeEntity(_0x92f207,null))[_0x77f4('0x40')](handleError(_0x92f207,null));};exports[_0x77f4('0x48')]=function(_0xbb2a3a,_0x158e1c){return db[_0x77f4('0x3e')][_0x77f4('0x48')]()[_0x77f4('0x26')](respondWithResult(_0x158e1c,null))[_0x77f4('0x40')](handleError(_0x158e1c,null));};
\ No newline at end of file